From f7e73d4ee3ae6102c303b190b4ac84574a1c4796 Mon Sep 17 00:00:00 2001 From: Alastair Donaldson Date: Fri, 23 Jul 2021 13:10:12 +0000 Subject: [PATCH] Add tests derived from VK-GL-CTS This adds SPIR-V assembly and WGSL tests derived from VK-GL-CTS commit 571256871c2e2f03995373e1e4a02958d8cd8cf5. The following procedure was followed: - Those .amber files in VK-GL-CTS wholly owned by Google were identified - All GLSL and SPIR-V shaders were extracted from the Amber files and converted into SPIR-V binaries - The compact-ids pass of spirv-opt was applied to each binary - Duplicate binaries were removed - spirv-opt -O was used to obtain an optimized version of each remaining binary, with duplicates discarded - Binaries that failed validation using spirv-val with target environment SPIR-V 1.3 were discarded - Those binaries that tint could not successfully convert into WGSL were put aside for further investigation - SPIR-V assembly versions of the remaining binaries are included in this CL - test-runner with -generate-expected and -generate-skip was used to generate expected .spvasm, .msl, .hlsl and .wgsl outputs for these SPIR-V assembly tests - Each successfully-generated .expected.wgsl is included in this CL again, as a WGLSL test - test-runner with -generate-expected and -generate-skip was used again, to generate expected outputs for these WGSL tests Change-Id: Ibe9baf2729cf97e0b633db9a426f53362a5de540 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58842 Kokoro: Kokoro Commit-Queue: Ben Clayton Reviewed-by: Ben Clayton --- .../layout_binding_order/0.spvasm | 75 + .../0.spvasm.expected.hlsl | 26 + .../0.spvasm.expected.msl | 33 + .../0.spvasm.expected.spvasm | 88 + .../0.spvasm.expected.wgsl | 44 + .../layout_binding_order/0.wgsl | 44 + .../layout_binding_order/0.wgsl.expected.hlsl | 26 + .../layout_binding_order/0.wgsl.expected.msl | 33 + .../0.wgsl.expected.spvasm | 88 + .../layout_binding_order/0.wgsl.expected.wgsl | 44 + .../0.spvasm | 35 + .../0.spvasm.expected.hlsl | 12 + .../0.spvasm.expected.msl | 17 + .../0.spvasm.expected.spvasm | 44 + .../0.spvasm.expected.wgsl | 16 + .../0.wgsl | 16 + .../0.wgsl.expected.hlsl | 12 + .../0.wgsl.expected.msl | 17 + .../0.wgsl.expected.spvasm | 44 + .../0.wgsl.expected.wgsl | 16 + .../0.spvasm | 56 + .../0.spvasm.expected.hlsl | 34 + .../0.spvasm.expected.msl | 38 + .../0.spvasm.expected.spvasm | 92 + .../0.spvasm.expected.wgsl | 34 + .../0.wgsl | 34 + .../0.wgsl.expected.hlsl | 34 + .../0.wgsl.expected.msl | 38 + .../0.wgsl.expected.spvasm | 92 + .../0.wgsl.expected.wgsl | 34 + .../1.spvasm | 25 + .../1.spvasm.expected.hlsl | 26 + .../1.spvasm.expected.msl | 30 + .../1.spvasm.expected.spvasm | 59 + .../1.spvasm.expected.wgsl | 21 + .../1.wgsl | 21 + .../1.wgsl.expected.hlsl | 26 + .../1.wgsl.expected.msl | 30 + .../1.wgsl.expected.spvasm | 59 + .../1.wgsl.expected.wgsl | 21 + .../negintdivand/0-opt.spvasm | 46 + .../negintdivand/0-opt.spvasm.expected.hlsl | 30 + .../negintdivand/0-opt.spvasm.expected.msl | 35 + .../negintdivand/0-opt.spvasm.expected.spvasm | 79 + .../negintdivand/0-opt.spvasm.expected.wgsl | 27 + .../negintdivand/0-opt.wgsl | 27 + .../negintdivand/0-opt.wgsl.expected.hlsl | 30 + .../negintdivand/0-opt.wgsl.expected.msl | 35 + .../negintdivand/0-opt.wgsl.expected.spvasm | 79 + .../negintdivand/0-opt.wgsl.expected.wgsl | 27 + .../combined_operations/negintdivand/1.spvasm | 59 + .../negintdivand/1.spvasm.expected.hlsl | 34 + .../negintdivand/1.spvasm.expected.msl | 37 + .../negintdivand/1.spvasm.expected.spvasm | 96 + .../negintdivand/1.spvasm.expected.wgsl | 28 + .../combined_operations/negintdivand/1.wgsl | 28 + .../negintdivand/1.wgsl.expected.hlsl | 34 + .../negintdivand/1.wgsl.expected.msl | 37 + .../negintdivand/1.wgsl.expected.spvasm | 96 + .../negintdivand/1.wgsl.expected.wgsl | 28 + .../0-opt.spvasm | 44 + .../0-opt.spvasm.expected.hlsl | 24 + .../0-opt.spvasm.expected.msl | 28 + .../0-opt.spvasm.expected.spvasm | 73 + .../0-opt.spvasm.expected.wgsl | 22 + .../0-opt.wgsl | 22 + .../0-opt.wgsl.expected.hlsl | 24 + .../0-opt.wgsl.expected.msl | 28 + .../0-opt.wgsl.expected.spvasm | 73 + .../0-opt.wgsl.expected.wgsl | 22 + .../always-discarding-function/0-opt.spvasm | 244 +++ .../0-opt.spvasm.expected.hlsl | 168 ++ .../0-opt.spvasm.expected.msl | 174 ++ .../0-opt.spvasm.expected.spvasm | 345 +++ .../0-opt.spvasm.expected.wgsl | 172 ++ .../always-discarding-function/0-opt.wgsl | 172 ++ .../0-opt.wgsl.expected.hlsl | 168 ++ .../0-opt.wgsl.expected.msl | 174 ++ .../0-opt.wgsl.expected.spvasm | 345 +++ .../0-opt.wgsl.expected.wgsl | 172 ++ .../0-opt.spvasm | 315 +++ .../0-opt.spvasm.expected.hlsl | 154 ++ .../0-opt.spvasm.expected.msl | 198 ++ .../0-opt.spvasm.expected.spvasm | 367 ++++ .../0-opt.spvasm.expected.wgsl | 197 ++ .../0-opt.wgsl | 197 ++ .../0-opt.wgsl.expected.hlsl | 154 ++ .../0-opt.wgsl.expected.msl | 198 ++ .../0-opt.wgsl.expected.spvasm | 367 ++++ .../0-opt.wgsl.expected.wgsl | 197 ++ .../0-opt.spvasm | 188 ++ .../0-opt.spvasm.expected.hlsl | 98 + .../0-opt.spvasm.expected.msl | 106 + .../0-opt.spvasm.expected.spvasm | 247 +++ .../0-opt.spvasm.expected.wgsl | 104 + .../0-opt.wgsl | 104 + .../0-opt.wgsl.expected.hlsl | 98 + .../0-opt.wgsl.expected.msl | 106 + .../0-opt.wgsl.expected.spvasm | 247 +++ .../0-opt.wgsl.expected.wgsl | 104 + .../0-opt.spvasm | 194 ++ .../0-opt.spvasm.expected.hlsl | 96 + .../0-opt.spvasm.expected.msl | 121 ++ .../0-opt.spvasm.expected.spvasm | 258 +++ .../0-opt.spvasm.expected.wgsl | 114 + .../0-opt.wgsl | 114 + .../0-opt.wgsl.expected.hlsl | 96 + .../0-opt.wgsl.expected.msl | 121 ++ .../0-opt.wgsl.expected.spvasm | 258 +++ .../0-opt.wgsl.expected.wgsl | 114 + .../0-opt.spvasm | 159 ++ .../0-opt.spvasm.expected.hlsl | 75 + .../0-opt.spvasm.expected.msl | 104 + .../0-opt.spvasm.expected.spvasm | 220 ++ .../0-opt.spvasm.expected.wgsl | 94 + .../0-opt.wgsl | 94 + .../0-opt.wgsl.expected.hlsl | 75 + .../0-opt.wgsl.expected.msl | 104 + .../0-opt.wgsl.expected.spvasm | 220 ++ .../0-opt.wgsl.expected.wgsl | 94 + .../barrier-in-loop-with-break/0-opt.spvasm | 125 ++ .../0-opt.spvasm.expected.hlsl | 45 + .../0-opt.spvasm.expected.msl | 57 + .../0-opt.spvasm.expected.spvasm | 144 ++ .../0-opt.spvasm.expected.wgsl | 64 + .../barrier-in-loop-with-break/0-opt.wgsl | 64 + .../0-opt.wgsl.expected.hlsl | 45 + .../0-opt.wgsl.expected.msl | 57 + .../0-opt.wgsl.expected.spvasm | 144 ++ .../0-opt.wgsl.expected.wgsl | 64 + .../0-opt.spvasm | 68 + .../0-opt.spvasm.expected.hlsl | 61 + .../0-opt.spvasm.expected.msl | 65 + .../0-opt.spvasm.expected.spvasm | 113 + .../0-opt.spvasm.expected.wgsl | 46 + .../0-opt.wgsl | 46 + .../0-opt.wgsl.expected.hlsl | 61 + .../0-opt.wgsl.expected.msl | 65 + .../0-opt.wgsl.expected.spvasm | 113 + .../0-opt.wgsl.expected.wgsl | 46 + .../call-function-with-discard/0-opt.spvasm | 59 + .../0-opt.spvasm.expected.hlsl | 39 + .../0-opt.spvasm.expected.msl | 42 + .../0-opt.spvasm.expected.spvasm | 101 + .../0-opt.spvasm.expected.wgsl | 40 + .../call-function-with-discard/0-opt.wgsl | 40 + .../0-opt.wgsl.expected.hlsl | 39 + .../0-opt.wgsl.expected.msl | 42 + .../0-opt.wgsl.expected.spvasm | 101 + .../0-opt.wgsl.expected.wgsl | 40 + .../call-if-while-switch/0-opt.spvasm | 93 + .../0-opt.spvasm.expected.hlsl | 85 + .../0-opt.spvasm.expected.msl | 91 + .../0-opt.spvasm.expected.spvasm | 162 ++ .../0-opt.spvasm.expected.wgsl | 74 + .../call-if-while-switch/0-opt.wgsl | 74 + .../0-opt.wgsl.expected.hlsl | 85 + .../0-opt.wgsl.expected.msl | 91 + .../0-opt.wgsl.expected.spvasm | 162 ++ .../0-opt.wgsl.expected.wgsl | 74 + .../color-set-in-for-loop/0-opt.spvasm | 62 + .../0-opt.spvasm.expected.hlsl | 38 + .../0-opt.spvasm.expected.msl | 33 + .../0-opt.spvasm.expected.spvasm | 88 + .../0-opt.spvasm.expected.wgsl | 31 + .../color-set-in-for-loop/0-opt.wgsl | 31 + .../0-opt.wgsl.expected.hlsl | 38 + .../0-opt.wgsl.expected.msl | 33 + .../0-opt.wgsl.expected.spvasm | 88 + .../0-opt.wgsl.expected.wgsl | 31 + .../graphicsfuzz/color-write-in-loop/0.spvasm | 100 + .../0.spvasm.expected.hlsl | 78 + .../color-write-in-loop/0.spvasm.expected.msl | 76 + .../0.spvasm.expected.spvasm | 190 ++ .../0.spvasm.expected.wgsl | 73 + .../graphicsfuzz/color-write-in-loop/0.wgsl | 73 + .../color-write-in-loop/0.wgsl.expected.hlsl | 78 + .../color-write-in-loop/0.wgsl.expected.msl | 76 + .../0.wgsl.expected.spvasm | 190 ++ .../color-write-in-loop/0.wgsl.expected.wgsl | 73 + .../0-opt.spvasm | 100 + .../0-opt.spvasm.expected.hlsl | 47 + .../0-opt.spvasm.expected.msl | 55 + .../0-opt.spvasm.expected.spvasm | 131 ++ .../0-opt.spvasm.expected.wgsl | 51 + .../0-opt.wgsl | 51 + .../0-opt.wgsl.expected.hlsl | 47 + .../0-opt.wgsl.expected.msl | 55 + .../0-opt.wgsl.expected.spvasm | 131 ++ .../0-opt.wgsl.expected.wgsl | 51 + .../control-flow-in-function/0-opt.spvasm | 627 ++++++ .../0-opt.spvasm.expected.hlsl | 237 ++ .../0-opt.spvasm.expected.msl | 312 +++ .../0-opt.spvasm.expected.spvasm | 663 ++++++ .../0-opt.spvasm.expected.wgsl | 317 +++ .../control-flow-in-function/0-opt.wgsl | 317 +++ .../0-opt.wgsl.expected.hlsl | 237 ++ .../0-opt.wgsl.expected.msl | 312 +++ .../0-opt.wgsl.expected.spvasm | 663 ++++++ .../0-opt.wgsl.expected.wgsl | 317 +++ .../cosh-return-inf-unused/0-opt.spvasm | 223 ++ .../0-opt.spvasm.expected.hlsl | 106 + .../0-opt.spvasm.expected.msl | 122 ++ .../0-opt.spvasm.expected.spvasm | 287 +++ .../0-opt.spvasm.expected.wgsl | 125 ++ .../cosh-return-inf-unused/0-opt.wgsl | 125 ++ .../0-opt.wgsl.expected.hlsl | 106 + .../0-opt.wgsl.expected.msl | 122 ++ .../0-opt.wgsl.expected.spvasm | 287 +++ .../0-opt.wgsl.expected.wgsl | 125 ++ .../cov-access-array-dot/0-opt.spvasm | 133 ++ .../0-opt.spvasm.expected.hlsl | 65 + .../0-opt.spvasm.expected.msl | 78 + .../0-opt.spvasm.expected.spvasm | 170 ++ .../0-opt.spvasm.expected.wgsl | 67 + .../cov-access-array-dot/0-opt.wgsl | 67 + .../0-opt.wgsl.expected.hlsl | 65 + .../0-opt.wgsl.expected.msl | 78 + .../0-opt.wgsl.expected.spvasm | 170 ++ .../0-opt.wgsl.expected.wgsl | 67 + .../0-opt.spvasm | 123 ++ .../0-opt.spvasm.expected.hlsl | 61 + .../0-opt.spvasm.expected.msl | 75 + .../0-opt.spvasm.expected.spvasm | 168 ++ .../0-opt.spvasm.expected.wgsl | 75 + .../0-opt.wgsl | 75 + .../0-opt.wgsl.expected.hlsl | 61 + .../0-opt.wgsl.expected.msl | 75 + .../0-opt.wgsl.expected.spvasm | 168 ++ .../0-opt.wgsl.expected.wgsl | 75 + .../0-opt.spvasm | 117 + .../0-opt.spvasm.expected.hlsl | 56 + .../0-opt.spvasm.expected.msl | 66 + .../0-opt.spvasm.expected.spvasm | 156 ++ .../0-opt.spvasm.expected.wgsl | 59 + .../0-opt.wgsl | 59 + .../0-opt.wgsl.expected.hlsl | 56 + .../0-opt.wgsl.expected.msl | 66 + .../0-opt.wgsl.expected.spvasm | 156 ++ .../0-opt.wgsl.expected.wgsl | 59 + .../cov-apfloat-acos-ldexp/0-opt.spvasm | 72 + .../0-opt.spvasm.expected.hlsl | 32 + .../0-opt.spvasm.expected.msl | 37 + .../0-opt.spvasm.expected.spvasm | 107 + .../0-opt.spvasm.expected.wgsl | 35 + .../cov-apfloat-acos-ldexp/0-opt.wgsl | 35 + .../0-opt.wgsl.expected.hlsl | 32 + .../0-opt.wgsl.expected.msl | 37 + .../0-opt.wgsl.expected.spvasm | 107 + .../0-opt.wgsl.expected.wgsl | 35 + .../cov-apfloat-mix-nan/0-opt.spvasm | 143 ++ .../0-opt.spvasm.expected.hlsl | 66 + .../0-opt.spvasm.expected.msl | 79 + .../0-opt.spvasm.expected.spvasm | 187 ++ .../0-opt.spvasm.expected.wgsl | 71 + .../cov-apfloat-mix-nan/0-opt.wgsl | 71 + .../0-opt.wgsl.expected.hlsl | 66 + .../0-opt.wgsl.expected.msl | 79 + .../0-opt.wgsl.expected.spvasm | 187 ++ .../0-opt.wgsl.expected.wgsl | 71 + .../cov-apfloat-mod-zero/0-opt.spvasm | 114 + .../0-opt.spvasm.expected.hlsl | 56 + .../0-opt.spvasm.expected.msl | 76 + .../0-opt.spvasm.expected.spvasm | 148 ++ .../0-opt.spvasm.expected.wgsl | 61 + .../cov-apfloat-mod-zero/0-opt.wgsl | 61 + .../0-opt.wgsl.expected.hlsl | 56 + .../0-opt.wgsl.expected.msl | 76 + .../0-opt.wgsl.expected.spvasm | 148 ++ .../0-opt.wgsl.expected.wgsl | 61 + .../0-opt.spvasm | 147 ++ .../0-opt.spvasm.expected.hlsl | 88 + .../0-opt.spvasm.expected.msl | 108 + .../0-opt.spvasm.expected.spvasm | 227 ++ .../0-opt.spvasm.expected.wgsl | 90 + .../0-opt.wgsl | 90 + .../0-opt.wgsl.expected.hlsl | 6 + .../0-opt.wgsl.expected.msl | 6 + .../0-opt.wgsl.expected.spvasm | 6 + .../0-opt.wgsl.expected.wgsl | 6 + .../cov-apfloat-reflect-denorm/0-opt.spvasm | 130 ++ .../0-opt.spvasm.expected.hlsl | 71 + .../0-opt.spvasm.expected.msl | 74 + .../0-opt.spvasm.expected.spvasm | 164 ++ .../0-opt.spvasm.expected.wgsl | 66 + .../cov-apfloat-reflect-denorm/0-opt.wgsl | 66 + .../0-opt.wgsl.expected.hlsl | 71 + .../0-opt.wgsl.expected.msl | 74 + .../0-opt.wgsl.expected.spvasm | 164 ++ .../0-opt.wgsl.expected.wgsl | 66 + .../0-opt.spvasm | 105 + .../0-opt.spvasm.expected.hlsl | 53 + .../0-opt.spvasm.expected.msl | 67 + .../0-opt.spvasm.expected.spvasm | 143 ++ .../0-opt.spvasm.expected.wgsl | 59 + .../cov-apfloat-sinh-negative-log2/0-opt.wgsl | 59 + .../0-opt.wgsl.expected.hlsl | 6 + .../0-opt.wgsl.expected.msl | 6 + .../0-opt.wgsl.expected.spvasm | 6 + .../0-opt.wgsl.expected.wgsl | 6 + .../cov-apfloat-tanh/0-opt.spvasm | 70 + .../0-opt.spvasm.expected.hlsl | 34 + .../0-opt.spvasm.expected.msl | 39 + .../0-opt.spvasm.expected.spvasm | 107 + .../0-opt.spvasm.expected.wgsl | 33 + .../graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl | 33 + .../cov-apfloat-tanh/0-opt.wgsl.expected.hlsl | 34 + .../cov-apfloat-tanh/0-opt.wgsl.expected.msl | 39 + .../0-opt.wgsl.expected.spvasm | 107 + .../cov-apfloat-tanh/0-opt.wgsl.expected.wgsl | 33 + .../0-opt.spvasm | 228 ++ .../0-opt.spvasm.expected.hlsl | 77 + .../0-opt.spvasm.expected.msl | 100 + .../0-opt.spvasm.expected.spvasm | 244 +++ .../0-opt.spvasm.expected.wgsl | 92 + .../0-opt.wgsl | 92 + .../0-opt.wgsl.expected.hlsl | 77 + .../0-opt.wgsl.expected.msl | 100 + .../0-opt.wgsl.expected.spvasm | 244 +++ .../0-opt.wgsl.expected.wgsl | 92 + .../cov-apfloat-unpackunorm-loop/0-opt.spvasm | 100 + .../0-opt.spvasm.expected.hlsl | 58 + .../0-opt.spvasm.expected.msl | 62 + .../0-opt.spvasm.expected.spvasm | 138 ++ .../0-opt.spvasm.expected.wgsl | 56 + .../cov-apfloat-unpackunorm-loop/0-opt.wgsl | 56 + .../0-opt.wgsl.expected.hlsl | 58 + .../0-opt.wgsl.expected.msl | 62 + .../0-opt.wgsl.expected.spvasm | 138 ++ .../0-opt.wgsl.expected.wgsl | 56 + .../cov-array-accesses-clamp/0-opt.spvasm | 133 ++ .../0-opt.spvasm.expected.hlsl | 68 + .../0-opt.spvasm.expected.msl | 83 + .../0-opt.spvasm.expected.spvasm | 173 ++ .../0-opt.spvasm.expected.wgsl | 72 + .../cov-array-accesses-clamp/0-opt.wgsl | 72 + .../0-opt.wgsl.expected.hlsl | 68 + .../0-opt.wgsl.expected.msl | 83 + .../0-opt.wgsl.expected.spvasm | 173 ++ .../0-opt.wgsl.expected.wgsl | 72 + .../0-opt.spvasm | 401 ++++ .../0-opt.spvasm.expected.hlsl | 204 ++ .../0-opt.spvasm.expected.msl | 237 ++ .../0-opt.spvasm.expected.spvasm | 489 +++++ .../0-opt.spvasm.expected.wgsl | 232 ++ .../0-opt.wgsl | 232 ++ .../0-opt.wgsl.expected.hlsl | 204 ++ .../0-opt.wgsl.expected.msl | 237 ++ .../0-opt.wgsl.expected.spvasm | 489 +++++ .../0-opt.wgsl.expected.wgsl | 232 ++ .../0-opt.spvasm | 154 ++ .../0-opt.spvasm.expected.hlsl | 94 + .../0-opt.spvasm.expected.msl | 103 + .../0-opt.spvasm.expected.spvasm | 224 ++ .../0-opt.spvasm.expected.wgsl | 96 + .../cov-asin-undefined-smoothstep/0-opt.wgsl | 96 + .../0-opt.wgsl.expected.hlsl | 6 + .../0-opt.wgsl.expected.msl | 6 + .../0-opt.wgsl.expected.spvasm | 6 + .../0-opt.wgsl.expected.wgsl | 6 + .../cov-atan-trunc-vec4/0-opt.spvasm | 116 + .../0-opt.spvasm.expected.hlsl | 62 + .../0-opt.spvasm.expected.msl | 74 + .../0-opt.spvasm.expected.spvasm | 161 ++ .../0-opt.spvasm.expected.wgsl | 66 + .../cov-atan-trunc-vec4/0-opt.wgsl | 66 + .../0-opt.wgsl.expected.hlsl | 62 + .../0-opt.wgsl.expected.msl | 74 + .../0-opt.wgsl.expected.spvasm | 161 ++ .../0-opt.wgsl.expected.wgsl | 66 + .../0-opt.spvasm | 90 + .../0-opt.spvasm.expected.hlsl | 58 + .../0-opt.spvasm.expected.msl | 61 + .../0-opt.spvasm.expected.spvasm | 145 ++ .../0-opt.spvasm.expected.wgsl | 59 + .../0-opt.wgsl | 59 + .../0-opt.wgsl.expected.hlsl | 58 + .../0-opt.wgsl.expected.msl | 61 + .../0-opt.wgsl.expected.spvasm | 145 ++ .../0-opt.wgsl.expected.wgsl | 59 + .../graphicsfuzz/cov-bitcount/0-opt.spvasm | 133 ++ .../cov-bitcount/0-opt.spvasm.expected.hlsl | 71 + .../cov-bitcount/0-opt.spvasm.expected.msl | 82 + .../cov-bitcount/0-opt.spvasm.expected.spvasm | 171 ++ .../cov-bitcount/0-opt.spvasm.expected.wgsl | 75 + .../graphicsfuzz/cov-bitcount/0-opt.wgsl | 75 + .../cov-bitcount/0-opt.wgsl.expected.hlsl | 71 + .../cov-bitcount/0-opt.wgsl.expected.msl | 82 + .../cov-bitcount/0-opt.wgsl.expected.spvasm | 171 ++ .../cov-bitcount/0-opt.wgsl.expected.wgsl | 75 + .../0.spvasm | 91 + .../0.spvasm.expected.hlsl | 67 + .../0.spvasm.expected.msl | 75 + .../0.spvasm.expected.spvasm | 161 ++ .../0.spvasm.expected.wgsl | 69 + .../0.wgsl | 69 + .../0.wgsl.expected.hlsl | 67 + .../0.wgsl.expected.msl | 75 + .../0.wgsl.expected.spvasm | 161 ++ .../0.wgsl.expected.wgsl | 69 + .../0-opt.spvasm | 119 + .../0-opt.spvasm.expected.hlsl | 58 + .../0-opt.spvasm.expected.msl | 71 + .../0-opt.spvasm.expected.spvasm | 155 ++ .../0-opt.spvasm.expected.wgsl | 67 + .../0-opt.wgsl | 67 + .../0-opt.wgsl.expected.hlsl | 58 + .../0-opt.wgsl.expected.msl | 71 + .../0-opt.wgsl.expected.spvasm | 155 ++ .../0-opt.wgsl.expected.wgsl | 67 + .../0-opt.spvasm | 229 ++ .../0-opt.spvasm.expected.hlsl | 102 + .../0-opt.spvasm.expected.msl | 156 ++ .../0-opt.spvasm.expected.spvasm | 323 +++ .../0-opt.spvasm.expected.wgsl | 161 ++ .../0-opt.wgsl | 161 ++ .../0-opt.wgsl.expected.hlsl | 102 + .../0-opt.wgsl.expected.msl | 156 ++ .../0-opt.wgsl.expected.spvasm | 323 +++ .../0-opt.wgsl.expected.wgsl | 161 ++ .../0-opt.spvasm | 296 +++ .../0-opt.spvasm.expected.hlsl | 128 ++ .../0-opt.spvasm.expected.msl | 157 ++ .../0-opt.spvasm.expected.spvasm | 320 +++ .../0-opt.spvasm.expected.wgsl | 150 ++ .../0-opt.wgsl | 150 ++ .../0-opt.wgsl.expected.hlsl | 128 ++ .../0-opt.wgsl.expected.msl | 157 ++ .../0-opt.wgsl.expected.spvasm | 320 +++ .../0-opt.wgsl.expected.wgsl | 150 ++ .../0-opt.spvasm | 74 + .../0-opt.spvasm.expected.hlsl | 38 + .../0-opt.spvasm.expected.msl | 46 + .../0-opt.spvasm.expected.spvasm | 107 + .../0-opt.spvasm.expected.wgsl | 39 + .../cov-cast-float-to-int-and-back/0-opt.wgsl | 39 + .../0-opt.wgsl.expected.hlsl | 38 + .../0-opt.wgsl.expected.msl | 46 + .../0-opt.wgsl.expected.spvasm | 107 + .../0-opt.wgsl.expected.wgsl | 39 + .../0-opt.spvasm | 148 ++ .../0-opt.spvasm.expected.hlsl | 76 + .../0-opt.spvasm.expected.msl | 89 + .../0-opt.spvasm.expected.spvasm | 190 ++ .../0-opt.spvasm.expected.wgsl | 78 + .../0-opt.wgsl | 78 + .../0-opt.wgsl.expected.hlsl | 76 + .../0-opt.wgsl.expected.msl | 89 + .../0-opt.wgsl.expected.spvasm | 190 ++ .../0-opt.wgsl.expected.wgsl | 78 + .../0-opt.spvasm | 97 + .../0-opt.spvasm.expected.hlsl | 48 + .../0-opt.spvasm.expected.msl | 62 + .../0-opt.spvasm.expected.spvasm | 132 ++ .../0-opt.spvasm.expected.wgsl | 54 + .../0-opt.wgsl | 54 + .../0-opt.wgsl.expected.hlsl | 48 + .../0-opt.wgsl.expected.msl | 62 + .../0-opt.wgsl.expected.spvasm | 132 ++ .../0-opt.wgsl.expected.wgsl | 54 + .../0-opt.spvasm | 184 ++ .../0-opt.spvasm.expected.hlsl | 81 + .../0-opt.spvasm.expected.msl | 91 + .../0-opt.spvasm.expected.spvasm | 222 ++ .../0-opt.spvasm.expected.wgsl | 84 + .../0-opt.wgsl | 84 + .../0-opt.wgsl.expected.hlsl | 81 + .../0-opt.wgsl.expected.msl | 91 + .../0-opt.wgsl.expected.spvasm | 222 ++ .../0-opt.wgsl.expected.wgsl | 84 + .../0-opt.spvasm | 106 + .../0-opt.spvasm.expected.hlsl | 50 + .../0-opt.spvasm.expected.msl | 63 + .../0-opt.spvasm.expected.spvasm | 141 ++ .../0-opt.spvasm.expected.wgsl | 55 + .../0-opt.wgsl | 55 + .../0-opt.wgsl.expected.hlsl | 50 + .../0-opt.wgsl.expected.msl | 63 + .../0-opt.wgsl.expected.spvasm | 141 ++ .../0-opt.wgsl.expected.wgsl | 55 + .../0-opt.spvasm | 110 + .../0-opt.spvasm.expected.hlsl | 49 + .../0-opt.spvasm.expected.msl | 63 + .../0-opt.spvasm.expected.spvasm | 145 ++ .../0-opt.spvasm.expected.wgsl | 55 + .../0-opt.wgsl | 55 + .../0-opt.wgsl.expected.hlsl | 49 + .../0-opt.wgsl.expected.msl | 63 + .../0-opt.wgsl.expected.spvasm | 145 ++ .../0-opt.wgsl.expected.wgsl | 55 + .../0-opt.spvasm | 95 + .../0-opt.spvasm.expected.hlsl | 52 + .../0-opt.spvasm.expected.msl | 59 + .../0-opt.spvasm.expected.spvasm | 140 ++ .../0-opt.spvasm.expected.wgsl | 56 + .../cov-clear-yz-inside-condition/0-opt.wgsl | 56 + .../0-opt.wgsl.expected.hlsl | 52 + .../0-opt.wgsl.expected.msl | 59 + .../0-opt.wgsl.expected.spvasm | 140 ++ .../0-opt.wgsl.expected.wgsl | 56 + .../0-opt.spvasm | 243 +++ .../0-opt.spvasm.expected.hlsl | 119 + .../0-opt.spvasm.expected.msl | 146 ++ .../0-opt.spvasm.expected.spvasm | 297 +++ .../0-opt.spvasm.expected.wgsl | 144 ++ .../0-opt.wgsl | 144 ++ .../0-opt.wgsl.expected.hlsl | 119 + .../0-opt.wgsl.expected.msl | 146 ++ .../0-opt.wgsl.expected.spvasm | 297 +++ .../0-opt.wgsl.expected.wgsl | 144 ++ .../0.spvasm | 93 + .../0.spvasm.expected.hlsl | 45 + .../0.spvasm.expected.msl | 51 + .../0.spvasm.expected.spvasm | 128 ++ .../0.spvasm.expected.wgsl | 45 + .../0.wgsl | 45 + .../0.wgsl.expected.hlsl | 45 + .../0.wgsl.expected.msl | 51 + .../0.wgsl.expected.spvasm | 128 ++ .../0.wgsl.expected.wgsl | 45 + .../cov-combine-and-or-xor-gt-lt/0-opt.spvasm | 112 + .../0-opt.spvasm.expected.hlsl | 49 + .../0-opt.spvasm.expected.msl | 58 + .../0-opt.spvasm.expected.spvasm | 139 ++ .../0-opt.spvasm.expected.wgsl | 55 + .../cov-combine-and-or-xor-gt-lt/0-opt.wgsl | 55 + .../0-opt.wgsl.expected.hlsl | 49 + .../0-opt.wgsl.expected.msl | 58 + .../0-opt.wgsl.expected.spvasm | 139 ++ .../0-opt.wgsl.expected.wgsl | 55 + .../0-opt.spvasm | 109 + .../0-opt.spvasm.expected.hlsl | 57 + .../0-opt.spvasm.expected.msl | 68 + .../0-opt.spvasm.expected.spvasm | 147 ++ .../0-opt.spvasm.expected.wgsl | 62 + .../0-opt.wgsl | 62 + .../0-opt.wgsl.expected.hlsl | 57 + .../0-opt.wgsl.expected.msl | 68 + .../0-opt.wgsl.expected.spvasm | 147 ++ .../0-opt.wgsl.expected.wgsl | 62 + .../0-opt.spvasm | 126 ++ .../0-opt.spvasm.expected.hlsl | 62 + .../0-opt.spvasm.expected.msl | 77 + .../0-opt.spvasm.expected.spvasm | 165 ++ .../0-opt.spvasm.expected.wgsl | 74 + .../0-opt.wgsl | 74 + .../0-opt.wgsl.expected.hlsl | 62 + .../0-opt.wgsl.expected.msl | 77 + .../0-opt.wgsl.expected.spvasm | 165 ++ .../0-opt.wgsl.expected.wgsl | 74 + .../cov-const-folding-ceil-vec4/0-opt.spvasm | 65 + .../0-opt.spvasm.expected.hlsl | 30 + .../0-opt.spvasm.expected.msl | 34 + .../0-opt.spvasm.expected.spvasm | 97 + .../0-opt.spvasm.expected.wgsl | 32 + .../cov-const-folding-ceil-vec4/0-opt.wgsl | 32 + .../0-opt.wgsl.expected.hlsl | 30 + .../0-opt.wgsl.expected.msl | 34 + .../0-opt.wgsl.expected.spvasm | 97 + .../0-opt.wgsl.expected.wgsl | 32 + .../0-opt.spvasm | 72 + .../0-opt.spvasm.expected.hlsl | 40 + .../0-opt.spvasm.expected.msl | 45 + .../0-opt.spvasm.expected.spvasm | 114 + .../0-opt.spvasm.expected.wgsl | 39 + .../0-opt.wgsl | 39 + .../0-opt.wgsl.expected.hlsl | 40 + .../0-opt.wgsl.expected.msl | 45 + .../0-opt.wgsl.expected.spvasm | 114 + .../0-opt.wgsl.expected.wgsl | 39 + .../cov-const-folding-clamp-min/0-opt.spvasm | 58 + .../0-opt.spvasm.expected.hlsl | 29 + .../0-opt.spvasm.expected.msl | 32 + .../0-opt.spvasm.expected.spvasm | 90 + .../0-opt.spvasm.expected.wgsl | 30 + .../cov-const-folding-clamp-min/0-opt.wgsl | 30 + .../0-opt.wgsl.expected.hlsl | 29 + .../0-opt.wgsl.expected.msl | 32 + .../0-opt.wgsl.expected.spvasm | 90 + .../0-opt.wgsl.expected.wgsl | 30 + .../0-opt.spvasm | 59 + .../0-opt.spvasm.expected.hlsl | 33 + .../0-opt.spvasm.expected.msl | 37 + .../0-opt.spvasm.expected.spvasm | 92 + .../0-opt.spvasm.expected.wgsl | 35 + .../0-opt.wgsl | 35 + .../0-opt.wgsl.expected.hlsl | 33 + .../0-opt.wgsl.expected.msl | 37 + .../0-opt.wgsl.expected.spvasm | 92 + .../0-opt.wgsl.expected.wgsl | 35 + .../cov-const-folding-clamp/0-opt.spvasm | 66 + .../0-opt.spvasm.expected.hlsl | 39 + .../0-opt.spvasm.expected.msl | 43 + .../0-opt.spvasm.expected.spvasm | 108 + .../0-opt.spvasm.expected.wgsl | 41 + .../cov-const-folding-clamp/0-opt.wgsl | 41 + .../0-opt.wgsl.expected.hlsl | 39 + .../0-opt.wgsl.expected.msl | 43 + .../0-opt.wgsl.expected.spvasm | 108 + .../0-opt.wgsl.expected.wgsl | 41 + .../0-opt.spvasm | 46 + .../0-opt.spvasm.expected.hlsl | 26 + .../0-opt.spvasm.expected.msl | 30 + .../0-opt.spvasm.expected.spvasm | 77 + .../0-opt.spvasm.expected.wgsl | 24 + .../0-opt.wgsl | 24 + .../0-opt.wgsl.expected.hlsl | 26 + .../0-opt.wgsl.expected.msl | 30 + .../0-opt.wgsl.expected.spvasm | 77 + .../0-opt.wgsl.expected.wgsl | 24 + .../0.spvasm | 62 + .../0.spvasm.expected.hlsl | 35 + .../0.spvasm.expected.msl | 34 + .../0.spvasm.expected.spvasm | 96 + .../0.spvasm.expected.wgsl | 33 + .../cov-const-folding-gte-const-first/0.wgsl | 33 + .../0.wgsl.expected.hlsl | 35 + .../0.wgsl.expected.msl | 34 + .../0.wgsl.expected.spvasm | 96 + .../0.wgsl.expected.wgsl | 33 + .../0-opt.spvasm | 133 ++ .../0-opt.spvasm.expected.hlsl | 72 + .../0-opt.spvasm.expected.msl | 83 + .../0-opt.spvasm.expected.spvasm | 191 ++ .../0-opt.spvasm.expected.wgsl | 80 + .../0-opt.wgsl | 80 + .../0-opt.wgsl.expected.hlsl | 72 + .../0-opt.wgsl.expected.msl | 83 + .../0-opt.wgsl.expected.spvasm | 191 ++ .../0-opt.wgsl.expected.wgsl | 80 + .../0-opt.spvasm | 65 + .../0-opt.spvasm.expected.hlsl | 35 + .../0-opt.spvasm.expected.msl | 49 + .../0-opt.spvasm.expected.spvasm | 97 + .../0-opt.spvasm.expected.wgsl | 35 + .../0-opt.wgsl | 35 + .../0-opt.wgsl.expected.hlsl | 35 + .../0-opt.wgsl.expected.msl | 49 + .../0-opt.wgsl.expected.spvasm | 97 + .../0-opt.wgsl.expected.wgsl | 35 + .../0-opt.spvasm | 106 + .../0-opt.spvasm.expected.hlsl | 56 + .../0-opt.spvasm.expected.msl | 69 + .../0-opt.spvasm.expected.spvasm | 151 ++ .../0-opt.spvasm.expected.wgsl | 61 + .../0-opt.wgsl | 61 + .../0-opt.wgsl.expected.hlsl | 56 + .../0-opt.wgsl.expected.msl | 69 + .../0-opt.wgsl.expected.spvasm | 151 ++ .../0-opt.wgsl.expected.wgsl | 61 + .../0-opt.spvasm | 83 + .../0-opt.spvasm.expected.hlsl | 50 + .../0-opt.spvasm.expected.msl | 54 + .../0-opt.spvasm.expected.spvasm | 129 ++ .../0-opt.spvasm.expected.wgsl | 52 + .../0-opt.wgsl | 52 + .../0-opt.wgsl.expected.hlsl | 50 + .../0-opt.wgsl.expected.msl | 54 + .../0-opt.wgsl.expected.spvasm | 129 ++ .../0-opt.wgsl.expected.wgsl | 52 + .../cov-const-folding-sinh-inf/0-opt.spvasm | 70 + .../0-opt.spvasm.expected.hlsl | 39 + .../0-opt.spvasm.expected.msl | 44 + .../0-opt.spvasm.expected.spvasm | 111 + .../0-opt.spvasm.expected.wgsl | 42 + .../cov-const-folding-sinh-inf/0-opt.wgsl | 42 + .../0-opt.wgsl.expected.hlsl | 39 + .../0-opt.wgsl.expected.msl | 44 + .../0-opt.wgsl.expected.spvasm | 111 + .../0-opt.wgsl.expected.wgsl | 42 + .../cov-const-folding-vector-shuffle/0.spvasm | 68 + .../0.spvasm.expected.hlsl | 54 + .../0.spvasm.expected.msl | 58 + .../0.spvasm.expected.spvasm | 145 ++ .../0.spvasm.expected.wgsl | 53 + .../cov-const-folding-vector-shuffle/0.wgsl | 53 + .../0.wgsl.expected.hlsl | 54 + .../0.wgsl.expected.msl | 58 + .../0.wgsl.expected.spvasm | 145 ++ .../0.wgsl.expected.wgsl | 53 + .../0-opt.spvasm | 46 + .../0-opt.spvasm.expected.hlsl | 30 + .../0-opt.spvasm.expected.msl | 31 + .../0-opt.spvasm.expected.spvasm | 83 + .../0-opt.spvasm.expected.wgsl | 25 + .../0-opt.wgsl | 25 + .../0-opt.wgsl.expected.hlsl | 30 + .../0-opt.wgsl.expected.msl | 31 + .../0-opt.wgsl.expected.spvasm | 83 + .../0-opt.wgsl.expected.wgsl | 25 + .../0-opt.spvasm | 154 ++ .../0-opt.spvasm.expected.hlsl | 80 + .../0-opt.spvasm.expected.msl | 92 + .../0-opt.spvasm.expected.spvasm | 193 ++ .../0-opt.spvasm.expected.wgsl | 86 + .../cov-constants-combine-add-sub/0-opt.wgsl | 86 + .../0-opt.wgsl.expected.hlsl | 80 + .../0-opt.wgsl.expected.msl | 92 + .../0-opt.wgsl.expected.spvasm | 193 ++ .../0-opt.wgsl.expected.wgsl | 86 + .../cov-constants-mix-uniform/0-opt.spvasm | 66 + .../0-opt.spvasm.expected.hlsl | 31 + .../0-opt.spvasm.expected.msl | 35 + .../0-opt.spvasm.expected.spvasm | 97 + .../0-opt.spvasm.expected.wgsl | 33 + .../cov-constants-mix-uniform/0-opt.wgsl | 33 + .../0-opt.wgsl.expected.hlsl | 31 + .../0-opt.wgsl.expected.msl | 35 + .../0-opt.wgsl.expected.spvasm | 97 + .../0-opt.wgsl.expected.wgsl | 33 + .../0-opt.spvasm | 109 + .../0-opt.spvasm.expected.hlsl | 66 + .../0-opt.spvasm.expected.msl | 73 + .../0-opt.spvasm.expected.spvasm | 154 ++ .../0-opt.spvasm.expected.wgsl | 65 + .../0-opt.wgsl | 65 + .../0-opt.wgsl.expected.hlsl | 66 + .../0-opt.wgsl.expected.msl | 73 + .../0-opt.wgsl.expected.spvasm | 154 ++ .../0-opt.wgsl.expected.wgsl | 65 + .../0-opt.spvasm | 173 ++ .../0-opt.spvasm.expected.hlsl | 119 + .../0-opt.spvasm.expected.msl | 126 ++ .../0-opt.spvasm.expected.spvasm | 249 +++ .../0-opt.spvasm.expected.wgsl | 122 ++ .../0-opt.wgsl | 122 ++ .../0-opt.wgsl.expected.hlsl | 119 + .../0-opt.wgsl.expected.msl | 126 ++ .../0-opt.wgsl.expected.spvasm | 249 +++ .../0-opt.wgsl.expected.wgsl | 122 ++ .../0-opt.spvasm | 77 + .../0-opt.spvasm.expected.hlsl | 39 + .../0-opt.spvasm.expected.msl | 46 + .../0-opt.spvasm.expected.spvasm | 107 + .../0-opt.spvasm.expected.wgsl | 42 + .../cov-copy-prop-arrays-no-stores/0-opt.wgsl | 42 + .../0-opt.wgsl.expected.hlsl | 39 + .../0-opt.wgsl.expected.msl | 46 + .../0-opt.wgsl.expected.spvasm | 107 + .../0-opt.wgsl.expected.wgsl | 42 + .../0-opt.spvasm | 181 ++ .../0-opt.spvasm.expected.hlsl | 122 ++ .../0-opt.spvasm.expected.msl | 132 ++ .../0-opt.spvasm.expected.spvasm | 261 +++ .../0-opt.spvasm.expected.wgsl | 129 ++ .../0-opt.wgsl | 129 ++ .../0-opt.wgsl.expected.hlsl | 122 ++ .../0-opt.wgsl.expected.msl | 132 ++ .../0-opt.wgsl.expected.spvasm | 261 +++ .../0-opt.wgsl.expected.wgsl | 129 ++ .../cov-cosh-clamped-to-one/0-opt.spvasm | 76 + .../0-opt.spvasm.expected.hlsl | 36 + .../0-opt.spvasm.expected.msl | 50 + .../0-opt.spvasm.expected.spvasm | 108 + .../0-opt.spvasm.expected.wgsl | 42 + .../cov-cosh-clamped-to-one/0-opt.wgsl | 42 + .../0-opt.wgsl.expected.hlsl | 36 + .../0-opt.wgsl.expected.msl | 50 + .../0-opt.wgsl.expected.spvasm | 108 + .../0-opt.wgsl.expected.wgsl | 42 + .../0-opt.spvasm | 181 ++ .../0-opt.spvasm.expected.hlsl | 98 + .../0-opt.spvasm.expected.msl | 112 + .../0-opt.spvasm.expected.spvasm | 231 ++ .../0-opt.spvasm.expected.wgsl | 103 + .../cov-cumulate-loops-unreachable/0-opt.wgsl | 103 + .../0-opt.wgsl.expected.hlsl | 98 + .../0-opt.wgsl.expected.msl | 112 + .../0-opt.wgsl.expected.spvasm | 231 ++ .../0-opt.wgsl.expected.wgsl | 103 + .../cov-cumulate-loops-unreachable/1.spvasm | 130 ++ .../1.spvasm.expected.hlsl | 59 + .../1.spvasm.expected.msl | 84 + .../1.spvasm.expected.spvasm | 178 ++ .../1.spvasm.expected.wgsl | 76 + .../cov-cumulate-loops-unreachable/1.wgsl | 76 + .../1.wgsl.expected.hlsl | 59 + .../1.wgsl.expected.msl | 84 + .../1.wgsl.expected.spvasm | 178 ++ .../1.wgsl.expected.wgsl | 76 + .../0-opt.spvasm | 146 ++ .../0-opt.spvasm.expected.hlsl | 77 + .../0-opt.spvasm.expected.msl | 90 + .../0-opt.spvasm.expected.spvasm | 186 ++ .../0-opt.spvasm.expected.wgsl | 78 + .../0-opt.wgsl | 78 + .../0-opt.wgsl.expected.hlsl | 77 + .../0-opt.wgsl.expected.msl | 90 + .../0-opt.wgsl.expected.spvasm | 186 ++ .../0-opt.wgsl.expected.wgsl | 78 + .../0-opt.spvasm | 128 ++ .../0-opt.spvasm.expected.hlsl | 66 + .../0-opt.spvasm.expected.msl | 70 + .../0-opt.spvasm.expected.spvasm | 164 ++ .../0-opt.spvasm.expected.wgsl | 64 + .../0-opt.wgsl | 64 + .../0-opt.wgsl.expected.hlsl | 66 + .../0-opt.wgsl.expected.msl | 70 + .../0-opt.wgsl.expected.spvasm | 164 ++ .../0-opt.wgsl.expected.wgsl | 64 + .../cov-dag-combiner-glf_color/0-opt.spvasm | 163 ++ .../0-opt.spvasm.expected.hlsl | 91 + .../0-opt.spvasm.expected.msl | 99 + .../0-opt.spvasm.expected.spvasm | 201 ++ .../0-opt.spvasm.expected.wgsl | 91 + .../cov-dag-combiner-glf_color/0-opt.wgsl | 91 + .../0-opt.wgsl.expected.hlsl | 91 + .../0-opt.wgsl.expected.msl | 99 + .../0-opt.wgsl.expected.spvasm | 201 ++ .../0-opt.wgsl.expected.wgsl | 91 + .../0-opt.spvasm | 90 + .../0-opt.spvasm.expected.hlsl | 44 + .../0-opt.spvasm.expected.msl | 55 + .../0-opt.spvasm.expected.spvasm | 122 ++ .../0-opt.spvasm.expected.wgsl | 48 + .../0-opt.wgsl | 48 + .../0-opt.wgsl.expected.hlsl | 44 + .../0-opt.wgsl.expected.msl | 55 + .../0-opt.wgsl.expected.spvasm | 122 ++ .../0-opt.wgsl.expected.wgsl | 48 + .../0-opt.spvasm | 103 + .../0-opt.spvasm.expected.hlsl | 52 + .../0-opt.spvasm.expected.msl | 63 + .../0-opt.spvasm.expected.spvasm | 141 ++ .../0-opt.spvasm.expected.wgsl | 56 + .../0-opt.wgsl | 56 + .../0-opt.wgsl.expected.hlsl | 52 + .../0-opt.wgsl.expected.msl | 63 + .../0-opt.wgsl.expected.spvasm | 141 ++ .../0-opt.wgsl.expected.wgsl | 56 + .../0-opt.spvasm | 106 + .../0-opt.spvasm.expected.hlsl | 53 + .../0-opt.spvasm.expected.msl | 61 + .../0-opt.spvasm.expected.spvasm | 146 ++ .../0-opt.spvasm.expected.wgsl | 64 + .../cov-dag-combiner-neg-div-pow2/0-opt.wgsl | 64 + .../0-opt.wgsl.expected.hlsl | 53 + .../0-opt.wgsl.expected.msl | 61 + .../0-opt.wgsl.expected.spvasm | 146 ++ .../0-opt.wgsl.expected.wgsl | 64 + .../0-opt.spvasm | 144 ++ .../0-opt.spvasm.expected.hlsl | 65 + .../0-opt.spvasm.expected.msl | 78 + .../0-opt.spvasm.expected.spvasm | 199 ++ .../0-opt.spvasm.expected.wgsl | 78 + .../0-opt.wgsl | 78 + .../0-opt.wgsl.expected.hlsl | 65 + .../0-opt.wgsl.expected.msl | 78 + .../0-opt.wgsl.expected.spvasm | 199 ++ .../0-opt.wgsl.expected.wgsl | 78 + .../0-opt.spvasm | 214 ++ .../0-opt.spvasm.expected.hlsl | 139 ++ .../0-opt.spvasm.expected.msl | 162 ++ .../0-opt.spvasm.expected.spvasm | 308 +++ .../0-opt.spvasm.expected.wgsl | 159 ++ .../0-opt.wgsl | 159 ++ .../0-opt.wgsl.expected.hlsl | 139 ++ .../0-opt.wgsl.expected.msl | 162 ++ .../0-opt.wgsl.expected.spvasm | 308 +++ .../0-opt.wgsl.expected.wgsl | 159 ++ .../0-opt.spvasm | 154 ++ .../0-opt.spvasm.expected.hlsl | 76 + .../0-opt.spvasm.expected.msl | 89 + .../0-opt.spvasm.expected.spvasm | 185 ++ .../0-opt.spvasm.expected.wgsl | 85 + .../0-opt.wgsl | 85 + .../0-opt.wgsl.expected.hlsl | 76 + .../0-opt.wgsl.expected.msl | 89 + .../0-opt.wgsl.expected.spvasm | 185 ++ .../0-opt.wgsl.expected.wgsl | 85 + .../0-opt.spvasm | 162 ++ .../0-opt.spvasm.expected.hlsl | 76 + .../0-opt.spvasm.expected.msl | 95 + .../0-opt.spvasm.expected.spvasm | 207 ++ .../0-opt.spvasm.expected.wgsl | 93 + .../0-opt.wgsl | 93 + .../0-opt.wgsl.expected.hlsl | 76 + .../0-opt.wgsl.expected.msl | 95 + .../0-opt.wgsl.expected.spvasm | 207 ++ .../0-opt.wgsl.expected.wgsl | 93 + .../0-opt.spvasm | 118 + .../0-opt.spvasm.expected.hlsl | 58 + .../0-opt.spvasm.expected.msl | 75 + .../0-opt.spvasm.expected.spvasm | 159 ++ .../0-opt.spvasm.expected.wgsl | 68 + .../0-opt.wgsl | 68 + .../0-opt.wgsl.expected.hlsl | 58 + .../0-opt.wgsl.expected.msl | 75 + .../0-opt.wgsl.expected.spvasm | 159 ++ .../0-opt.wgsl.expected.wgsl | 68 + .../0-opt.spvasm | 63 + .../0-opt.spvasm.expected.hlsl | 31 + .../0-opt.spvasm.expected.msl | 30 + .../0-opt.spvasm.expected.spvasm | 102 + .../0-opt.spvasm.expected.wgsl | 24 + .../0-opt.wgsl | 24 + .../0-opt.wgsl.expected.hlsl | 31 + .../0-opt.wgsl.expected.msl | 30 + .../0-opt.wgsl.expected.spvasm | 102 + .../0-opt.wgsl.expected.wgsl | 24 + .../cov-double-if-true-in-loop/0-opt.spvasm | 112 + .../0-opt.spvasm.expected.hlsl | 65 + .../0-opt.spvasm.expected.msl | 71 + .../0-opt.spvasm.expected.spvasm | 157 ++ .../0-opt.spvasm.expected.wgsl | 65 + .../cov-double-if-true-in-loop/0-opt.wgsl | 65 + .../0-opt.wgsl.expected.hlsl | 65 + .../0-opt.wgsl.expected.msl | 71 + .../0-opt.wgsl.expected.spvasm | 157 ++ .../0-opt.wgsl.expected.wgsl | 65 + .../0-opt.spvasm | 148 ++ .../0-opt.spvasm.expected.hlsl | 68 + .../0-opt.spvasm.expected.msl | 82 + .../0-opt.spvasm.expected.spvasm | 187 ++ .../0-opt.spvasm.expected.wgsl | 72 + .../0-opt.wgsl | 72 + .../0-opt.wgsl.expected.hlsl | 68 + .../0-opt.wgsl.expected.msl | 82 + .../0-opt.wgsl.expected.spvasm | 187 ++ .../0-opt.wgsl.expected.wgsl | 72 + .../graphicsfuzz/cov-exp2-two/0-opt.spvasm | 42 + .../cov-exp2-two/0-opt.spvasm.expected.hlsl | 26 + .../cov-exp2-two/0-opt.spvasm.expected.msl | 30 + .../cov-exp2-two/0-opt.spvasm.expected.spvasm | 74 + .../cov-exp2-two/0-opt.spvasm.expected.wgsl | 24 + .../graphicsfuzz/cov-exp2-two/0-opt.wgsl | 24 + .../cov-exp2-two/0-opt.wgsl.expected.hlsl | 26 + .../cov-exp2-two/0-opt.wgsl.expected.msl | 30 + .../cov-exp2-two/0-opt.wgsl.expected.spvasm | 74 + .../cov-exp2-two/0-opt.wgsl.expected.wgsl | 24 + .../cov-float-array-init-pow/0-opt.spvasm | 122 ++ .../0-opt.spvasm.expected.hlsl | 65 + .../0-opt.spvasm.expected.msl | 75 + .../0-opt.spvasm.expected.spvasm | 159 ++ .../0-opt.spvasm.expected.wgsl | 63 + .../cov-float-array-init-pow/0-opt.wgsl | 63 + .../0-opt.wgsl.expected.hlsl | 65 + .../0-opt.wgsl.expected.msl | 75 + .../0-opt.wgsl.expected.spvasm | 159 ++ .../0-opt.wgsl.expected.wgsl | 63 + .../0-opt.spvasm | 88 + .../0-opt.spvasm.expected.hlsl | 47 + .../0-opt.spvasm.expected.msl | 55 + .../0-opt.spvasm.expected.spvasm | 127 ++ .../0-opt.spvasm.expected.wgsl | 54 + .../cov-fold-and-in-for-loop-range/0-opt.wgsl | 54 + .../0-opt.wgsl.expected.hlsl | 47 + .../0-opt.wgsl.expected.msl | 55 + .../0-opt.wgsl.expected.spvasm | 127 ++ .../0-opt.wgsl.expected.wgsl | 54 + .../cov-fold-bitwise-and-zero/0.spvasm | 50 + .../0.spvasm.expected.hlsl | 28 + .../0.spvasm.expected.msl | 31 + .../0.spvasm.expected.spvasm | 83 + .../0.spvasm.expected.wgsl | 29 + .../cov-fold-bitwise-and-zero/0.wgsl | 29 + .../0.wgsl.expected.hlsl | 28 + .../0.wgsl.expected.msl | 31 + .../0.wgsl.expected.spvasm | 83 + .../0.wgsl.expected.wgsl | 29 + .../cov-fold-bitwise-or-full-mask/0.spvasm | 51 + .../0.spvasm.expected.hlsl | 28 + .../0.spvasm.expected.msl | 31 + .../0.spvasm.expected.spvasm | 83 + .../0.spvasm.expected.wgsl | 29 + .../cov-fold-bitwise-or-full-mask/0.wgsl | 29 + .../0.wgsl.expected.hlsl | 28 + .../0.wgsl.expected.msl | 31 + .../0.wgsl.expected.spvasm | 83 + .../0.wgsl.expected.wgsl | 29 + .../cov-fold-bitwise-xor/0-opt.spvasm | 53 + .../0-opt.spvasm.expected.hlsl | 28 + .../0-opt.spvasm.expected.msl | 33 + .../0-opt.spvasm.expected.spvasm | 79 + .../0-opt.spvasm.expected.wgsl | 27 + .../cov-fold-bitwise-xor/0-opt.wgsl | 27 + .../0-opt.wgsl.expected.hlsl | 28 + .../0-opt.wgsl.expected.msl | 33 + .../0-opt.wgsl.expected.spvasm | 79 + .../0-opt.wgsl.expected.wgsl | 27 + .../0.spvasm | 41 + .../0.spvasm.expected.hlsl | 30 + .../0.spvasm.expected.msl | 30 + .../0.spvasm.expected.spvasm | 77 + .../0.spvasm.expected.wgsl | 24 + .../0.wgsl | 24 + .../0.wgsl.expected.hlsl | 30 + .../0.wgsl.expected.msl | 30 + .../0.wgsl.expected.spvasm | 77 + .../0.wgsl.expected.wgsl | 24 + .../0-opt.spvasm | 71 + .../0-opt.spvasm.expected.hlsl | 46 + .../0-opt.spvasm.expected.msl | 43 + .../0-opt.spvasm.expected.spvasm | 119 + .../0-opt.spvasm.expected.wgsl | 39 + .../cov-fold-logical-and-constant/0-opt.wgsl | 39 + .../0-opt.wgsl.expected.hlsl | 46 + .../0-opt.wgsl.expected.msl | 43 + .../0-opt.wgsl.expected.spvasm | 119 + .../0-opt.wgsl.expected.wgsl | 39 + .../cov-fold-logical-or-constant/0.spvasm | 45 + .../0.spvasm.expected.hlsl | 35 + .../0.spvasm.expected.msl | 30 + .../0.spvasm.expected.spvasm | 84 + .../0.spvasm.expected.wgsl | 25 + .../cov-fold-logical-or-constant/0.wgsl | 25 + .../0.wgsl.expected.hlsl | 35 + .../0.wgsl.expected.msl | 30 + .../0.wgsl.expected.spvasm | 84 + .../0.wgsl.expected.wgsl | 25 + .../0-opt.spvasm | 62 + .../0-opt.spvasm.expected.hlsl | 34 + .../0-opt.spvasm.expected.msl | 38 + .../0-opt.spvasm.expected.spvasm | 95 + .../0-opt.spvasm.expected.wgsl | 36 + .../cov-fold-negate-min-int-value/0-opt.wgsl | 36 + .../0-opt.wgsl.expected.hlsl | 34 + .../0-opt.wgsl.expected.msl | 38 + .../0-opt.wgsl.expected.spvasm | 95 + .../0-opt.wgsl.expected.wgsl | 36 + .../cov-fold-negate-variable/0.spvasm | 46 + .../0.spvasm.expected.hlsl | 26 + .../0.spvasm.expected.msl | 30 + .../0.spvasm.expected.spvasm | 74 + .../0.spvasm.expected.wgsl | 24 + .../cov-fold-negate-variable/0.wgsl | 24 + .../0.wgsl.expected.hlsl | 26 + .../0.wgsl.expected.msl | 30 + .../0.wgsl.expected.spvasm | 74 + .../0.wgsl.expected.wgsl | 24 + .../cov-fold-shift-gte32/0.spvasm | 166 ++ .../0.spvasm.expected.hlsl | 83 + .../0.spvasm.expected.msl | 78 + .../0.spvasm.expected.spvasm | 221 ++ .../0.spvasm.expected.wgsl | 76 + .../graphicsfuzz/cov-fold-shift-gte32/0.wgsl | 76 + .../cov-fold-shift-gte32/0.wgsl.expected.hlsl | 83 + .../cov-fold-shift-gte32/0.wgsl.expected.msl | 78 + .../0.wgsl.expected.spvasm | 221 ++ .../cov-fold-shift-gte32/0.wgsl.expected.wgsl | 76 + .../cov-fold-shift-right-arithmetic/0.spvasm | 47 + .../0.spvasm.expected.hlsl | 26 + .../0.spvasm.expected.msl | 30 + .../0.spvasm.expected.spvasm | 77 + .../0.spvasm.expected.wgsl | 24 + .../cov-fold-shift-right-arithmetic/0.wgsl | 24 + .../0.wgsl.expected.hlsl | 26 + .../0.wgsl.expected.msl | 30 + .../0.wgsl.expected.spvasm | 77 + .../0.wgsl.expected.wgsl | 24 + .../cov-fold-switch-udiv/0.spvasm | 44 + .../0.spvasm.expected.hlsl | 31 + .../0.spvasm.expected.msl | 35 + .../0.spvasm.expected.spvasm | 72 + .../0.spvasm.expected.wgsl | 27 + .../graphicsfuzz/cov-fold-switch-udiv/0.wgsl | 27 + .../cov-fold-switch-udiv/0.wgsl.expected.hlsl | 31 + .../cov-fold-switch-udiv/0.wgsl.expected.msl | 35 + .../0.wgsl.expected.spvasm | 72 + .../cov-fold-switch-udiv/0.wgsl.expected.wgsl | 27 + .../0-opt.spvasm | 75 + .../0-opt.spvasm.expected.hlsl | 41 + .../0-opt.spvasm.expected.msl | 46 + .../0-opt.spvasm.expected.spvasm | 120 ++ .../0-opt.spvasm.expected.wgsl | 45 + .../0-opt.wgsl | 45 + .../0-opt.wgsl.expected.hlsl | 41 + .../0-opt.wgsl.expected.msl | 46 + .../0-opt.wgsl.expected.spvasm | 120 ++ .../0-opt.wgsl.expected.wgsl | 45 + .../0-opt.spvasm | 53 + .../0-opt.spvasm.expected.hlsl | 28 + .../0-opt.spvasm.expected.msl | 31 + .../0-opt.spvasm.expected.spvasm | 85 + .../0-opt.spvasm.expected.wgsl | 29 + .../0-opt.wgsl | 29 + .../0-opt.wgsl.expected.hlsl | 28 + .../0-opt.wgsl.expected.msl | 31 + .../0-opt.wgsl.expected.spvasm | 85 + .../0-opt.wgsl.expected.wgsl | 29 + .../0-opt.spvasm | 80 + .../0-opt.spvasm.expected.hlsl | 43 + .../0-opt.spvasm.expected.msl | 48 + .../0-opt.spvasm.expected.spvasm | 121 ++ .../0-opt.spvasm.expected.wgsl | 46 + .../0-opt.wgsl | 46 + .../0-opt.wgsl.expected.hlsl | 43 + .../0-opt.wgsl.expected.msl | 48 + .../0-opt.wgsl.expected.spvasm | 121 ++ .../0-opt.wgsl.expected.wgsl | 46 + .../0-opt.spvasm | 54 + .../0-opt.spvasm.expected.hlsl | 28 + .../0-opt.spvasm.expected.msl | 31 + .../0-opt.spvasm.expected.spvasm | 85 + .../0-opt.spvasm.expected.wgsl | 29 + .../cov-folding-rules-dot-extract/0-opt.wgsl | 29 + .../0-opt.wgsl.expected.hlsl | 28 + .../0-opt.wgsl.expected.msl | 31 + .../0-opt.wgsl.expected.spvasm | 85 + .../0-opt.wgsl.expected.wgsl | 29 + .../cov-folding-rules-dot-no-extract/0.spvasm | 55 + .../0.spvasm.expected.hlsl | 28 + .../0.spvasm.expected.msl | 31 + .../0.spvasm.expected.spvasm | 86 + .../0.spvasm.expected.wgsl | 29 + .../cov-folding-rules-dot-no-extract/0.wgsl | 29 + .../0.wgsl.expected.hlsl | 28 + .../0.wgsl.expected.msl | 31 + .../0.wgsl.expected.spvasm | 86 + .../0.wgsl.expected.wgsl | 29 + .../0-opt.spvasm | 71 + .../0-opt.spvasm.expected.hlsl | 34 + .../0-opt.spvasm.expected.msl | 41 + .../0-opt.spvasm.expected.spvasm | 100 + .../0-opt.spvasm.expected.wgsl | 35 + .../0-opt.wgsl | 35 + .../0-opt.wgsl.expected.hlsl | 34 + .../0-opt.wgsl.expected.msl | 41 + .../0-opt.wgsl.expected.spvasm | 100 + .../0-opt.wgsl.expected.wgsl | 35 + .../0-opt.spvasm | 63 + .../0-opt.spvasm.expected.hlsl | 34 + .../0-opt.spvasm.expected.msl | 35 + .../0-opt.spvasm.expected.spvasm | 100 + .../0-opt.spvasm.expected.wgsl | 33 + .../0-opt.wgsl | 33 + .../0-opt.wgsl.expected.hlsl | 34 + .../0-opt.wgsl.expected.msl | 35 + .../0-opt.wgsl.expected.spvasm | 100 + .../0-opt.wgsl.expected.wgsl | 33 + .../cov-folding-rules-merge-divs/0-opt.spvasm | 62 + .../0-opt.spvasm.expected.hlsl | 34 + .../0-opt.spvasm.expected.msl | 35 + .../0-opt.spvasm.expected.spvasm | 99 + .../0-opt.spvasm.expected.wgsl | 33 + .../cov-folding-rules-merge-divs/0-opt.wgsl | 33 + .../0-opt.wgsl.expected.hlsl | 34 + .../0-opt.wgsl.expected.msl | 35 + .../0-opt.wgsl.expected.spvasm | 99 + .../0-opt.wgsl.expected.wgsl | 33 + .../0-opt.spvasm | 63 + .../0-opt.spvasm.expected.hlsl | 34 + .../0-opt.spvasm.expected.msl | 35 + .../0-opt.spvasm.expected.spvasm | 100 + .../0-opt.spvasm.expected.wgsl | 33 + .../0-opt.wgsl | 33 + .../0-opt.wgsl.expected.hlsl | 34 + .../0-opt.wgsl.expected.msl | 35 + .../0-opt.wgsl.expected.spvasm | 100 + .../0-opt.wgsl.expected.wgsl | 33 + .../0-opt.spvasm | 85 + .../0-opt.spvasm.expected.hlsl | 37 + .../0-opt.spvasm.expected.msl | 50 + .../0-opt.spvasm.expected.spvasm | 118 + .../0-opt.spvasm.expected.wgsl | 45 + .../0-opt.wgsl | 45 + .../0-opt.wgsl.expected.hlsl | 37 + .../0-opt.wgsl.expected.msl | 50 + .../0-opt.wgsl.expected.spvasm | 118 + .../0-opt.wgsl.expected.wgsl | 45 + .../0-opt.spvasm | 86 + .../0-opt.spvasm.expected.hlsl | 37 + .../0-opt.spvasm.expected.msl | 50 + .../0-opt.spvasm.expected.spvasm | 119 + .../0-opt.spvasm.expected.wgsl | 45 + .../0-opt.wgsl | 45 + .../0-opt.wgsl.expected.hlsl | 37 + .../0-opt.wgsl.expected.msl | 50 + .../0-opt.wgsl.expected.spvasm | 119 + .../0-opt.wgsl.expected.wgsl | 45 + .../0-opt.spvasm | 75 + .../0-opt.spvasm.expected.hlsl | 38 + .../0-opt.spvasm.expected.msl | 45 + .../0-opt.spvasm.expected.spvasm | 114 + .../0-opt.spvasm.expected.wgsl | 43 + .../0-opt.wgsl | 43 + .../0-opt.wgsl.expected.hlsl | 38 + .../0-opt.wgsl.expected.msl | 45 + .../0-opt.wgsl.expected.spvasm | 114 + .../0-opt.wgsl.expected.wgsl | 43 + .../0-opt.spvasm | 75 + .../0-opt.spvasm.expected.hlsl | 33 + .../0-opt.spvasm.expected.msl | 38 + .../0-opt.spvasm.expected.spvasm | 107 + .../0-opt.spvasm.expected.wgsl | 36 + .../0-opt.wgsl | 36 + .../0-opt.wgsl.expected.hlsl | 33 + .../0-opt.wgsl.expected.msl | 38 + .../0-opt.wgsl.expected.spvasm | 107 + .../0-opt.wgsl.expected.wgsl | 36 + .../cov-folding-rules-negate-div/0-opt.spvasm | 57 + .../0-opt.spvasm.expected.hlsl | 28 + .../0-opt.spvasm.expected.msl | 31 + .../0-opt.spvasm.expected.spvasm | 85 + .../0-opt.spvasm.expected.wgsl | 29 + .../cov-folding-rules-negate-div/0-opt.wgsl | 29 + .../0-opt.wgsl.expected.hlsl | 28 + .../0-opt.wgsl.expected.msl | 31 + .../0-opt.wgsl.expected.spvasm | 85 + .../0-opt.wgsl.expected.wgsl | 29 + .../cov-folding-rules-negate-sub/0-opt.spvasm | 58 + .../0-opt.spvasm.expected.hlsl | 30 + .../0-opt.spvasm.expected.msl | 34 + .../0-opt.spvasm.expected.spvasm | 91 + .../0-opt.spvasm.expected.wgsl | 32 + .../cov-folding-rules-negate-sub/0-opt.wgsl | 32 + .../0-opt.wgsl.expected.hlsl | 30 + .../0-opt.wgsl.expected.msl | 34 + .../0-opt.wgsl.expected.spvasm | 91 + .../0-opt.wgsl.expected.wgsl | 32 + .../0-opt.spvasm | 56 + .../0-opt.spvasm.expected.hlsl | 28 + .../0-opt.spvasm.expected.msl | 31 + .../0-opt.spvasm.expected.spvasm | 88 + .../0-opt.spvasm.expected.wgsl | 29 + .../0-opt.wgsl | 29 + .../0-opt.wgsl.expected.hlsl | 28 + .../0-opt.wgsl.expected.msl | 31 + .../0-opt.wgsl.expected.spvasm | 88 + .../0-opt.wgsl.expected.wgsl | 29 + .../0-opt.spvasm | 58 + .../0-opt.spvasm.expected.hlsl | 28 + .../0-opt.spvasm.expected.msl | 31 + .../0-opt.spvasm.expected.spvasm | 87 + .../0-opt.spvasm.expected.wgsl | 29 + .../0-opt.wgsl | 29 + .../0-opt.wgsl.expected.hlsl | 28 + .../0-opt.wgsl.expected.msl | 31 + .../0-opt.wgsl.expected.spvasm | 87 + .../0-opt.wgsl.expected.wgsl | 29 + .../0-opt.spvasm | 76 + .../0-opt.spvasm.expected.hlsl | 33 + .../0-opt.spvasm.expected.msl | 37 + .../0-opt.spvasm.expected.spvasm | 110 + .../0-opt.spvasm.expected.wgsl | 35 + .../cov-folding-rules-shuffle-mix/0-opt.wgsl | 35 + .../0-opt.wgsl.expected.hlsl | 33 + .../0-opt.wgsl.expected.msl | 37 + .../0-opt.wgsl.expected.spvasm | 110 + .../0-opt.wgsl.expected.wgsl | 35 + .../0-opt.spvasm | 51 + .../0-opt.spvasm.expected.hlsl | 29 + .../0-opt.spvasm.expected.msl | 33 + .../0-opt.spvasm.expected.spvasm | 89 + .../0-opt.spvasm.expected.wgsl | 27 + .../0-opt.wgsl | 27 + .../0-opt.wgsl.expected.hlsl | 29 + .../0-opt.wgsl.expected.msl | 33 + .../0-opt.wgsl.expected.spvasm | 89 + .../0-opt.wgsl.expected.wgsl | 27 + .../0-opt.spvasm | 79 + .../0-opt.spvasm.expected.hlsl | 34 + .../0-opt.spvasm.expected.msl | 39 + .../0-opt.spvasm.expected.spvasm | 111 + .../0-opt.spvasm.expected.wgsl | 37 + .../0-opt.wgsl | 37 + .../0-opt.wgsl.expected.hlsl | 34 + .../0-opt.wgsl.expected.msl | 39 + .../0-opt.wgsl.expected.spvasm | 111 + .../0-opt.wgsl.expected.wgsl | 37 + .../0-opt.spvasm | 100 + .../0-opt.spvasm.expected.hlsl | 50 + .../0-opt.spvasm.expected.msl | 63 + .../0-opt.spvasm.expected.spvasm | 139 ++ .../0-opt.spvasm.expected.wgsl | 53 + .../0-opt.wgsl | 53 + .../0-opt.wgsl.expected.hlsl | 50 + .../0-opt.wgsl.expected.msl | 63 + .../0-opt.wgsl.expected.spvasm | 139 ++ .../0-opt.wgsl.expected.wgsl | 53 + .../0-opt.spvasm | 132 ++ .../0-opt.spvasm.expected.hlsl | 67 + .../0-opt.spvasm.expected.msl | 83 + .../0-opt.spvasm.expected.spvasm | 174 ++ .../0-opt.spvasm.expected.wgsl | 72 + .../0-opt.wgsl | 72 + .../0-opt.wgsl.expected.hlsl | 67 + .../0-opt.wgsl.expected.msl | 83 + .../0-opt.wgsl.expected.spvasm | 174 ++ .../0-opt.wgsl.expected.wgsl | 72 + .../cov-for-switch-fallthrough/0-opt.spvasm | 107 + .../0-opt.spvasm.expected.hlsl | 64 + .../0-opt.spvasm.expected.msl | 75 + .../0-opt.spvasm.expected.spvasm | 147 ++ .../0-opt.spvasm.expected.wgsl | 66 + .../cov-for-switch-fallthrough/0-opt.wgsl | 66 + .../0-opt.wgsl.expected.hlsl | 64 + .../0-opt.wgsl.expected.msl | 75 + .../0-opt.wgsl.expected.spvasm | 147 ++ .../0-opt.wgsl.expected.wgsl | 66 + .../0-opt.spvasm | 97 + .../0-opt.spvasm.expected.hlsl | 50 + .../0-opt.spvasm.expected.msl | 61 + .../0-opt.spvasm.expected.spvasm | 135 ++ .../0-opt.spvasm.expected.wgsl | 54 + .../0-opt.wgsl | 54 + .../0-opt.wgsl.expected.hlsl | 6 + .../0-opt.wgsl.expected.msl | 6 + .../0-opt.wgsl.expected.spvasm | 6 + .../0-opt.wgsl.expected.wgsl | 6 + .../0-opt.spvasm | 101 + .../0-opt.spvasm.expected.hlsl | 60 + .../0-opt.spvasm.expected.msl | 67 + .../0-opt.spvasm.expected.spvasm | 145 ++ .../0-opt.spvasm.expected.wgsl | 60 + .../cov-fract-smoothstep-undefined/0-opt.wgsl | 60 + .../0-opt.wgsl.expected.hlsl | 60 + .../0-opt.wgsl.expected.msl | 67 + .../0-opt.wgsl.expected.spvasm | 145 ++ .../0-opt.wgsl.expected.wgsl | 60 + .../cov-fragcoord-bitwise-not/0-opt.spvasm | 92 + .../0-opt.spvasm.expected.hlsl | 51 + .../0-opt.spvasm.expected.msl | 55 + .../0-opt.spvasm.expected.spvasm | 128 ++ .../0-opt.spvasm.expected.wgsl | 49 + .../cov-fragcoord-bitwise-not/0-opt.wgsl | 49 + .../0-opt.wgsl.expected.hlsl | 51 + .../0-opt.wgsl.expected.msl | 55 + .../0-opt.wgsl.expected.spvasm | 128 ++ .../0-opt.wgsl.expected.wgsl | 49 + .../0-opt.spvasm | 180 ++ .../0-opt.spvasm.expected.hlsl | 95 + .../0-opt.spvasm.expected.msl | 109 + .../0-opt.spvasm.expected.spvasm | 236 ++ .../0-opt.spvasm.expected.wgsl | 99 + .../0-opt.wgsl | 99 + .../0-opt.wgsl.expected.hlsl | 95 + .../0-opt.wgsl.expected.msl | 109 + .../0-opt.wgsl.expected.spvasm | 236 ++ .../0-opt.wgsl.expected.wgsl | 99 + .../cov-fragcoord-multiply/0-opt.spvasm | 153 ++ .../0-opt.spvasm.expected.hlsl | 75 + .../0-opt.spvasm.expected.msl | 83 + .../0-opt.spvasm.expected.spvasm | 196 ++ .../0-opt.spvasm.expected.wgsl | 76 + .../cov-fragcoord-multiply/0-opt.wgsl | 76 + .../0-opt.wgsl.expected.hlsl | 75 + .../0-opt.wgsl.expected.msl | 83 + .../0-opt.wgsl.expected.spvasm | 196 ++ .../0-opt.wgsl.expected.wgsl | 76 + .../0-opt.spvasm | 168 ++ .../0-opt.spvasm.expected.hlsl | 91 + .../0-opt.spvasm.expected.msl | 101 + .../0-opt.spvasm.expected.spvasm | 229 ++ .../0-opt.spvasm.expected.wgsl | 96 + .../0-opt.wgsl | 96 + .../0-opt.wgsl.expected.hlsl | 91 + .../0-opt.wgsl.expected.msl | 101 + .../0-opt.wgsl.expected.spvasm | 229 ++ .../0-opt.wgsl.expected.wgsl | 96 + .../0-opt.spvasm | 135 ++ .../0-opt.spvasm.expected.hlsl | 69 + .../0-opt.spvasm.expected.msl | 78 + .../0-opt.spvasm.expected.spvasm | 175 ++ .../0-opt.spvasm.expected.wgsl | 75 + .../0-opt.wgsl | 75 + .../0-opt.wgsl.expected.hlsl | 69 + .../0-opt.wgsl.expected.msl | 78 + .../0-opt.wgsl.expected.spvasm | 175 ++ .../0-opt.wgsl.expected.wgsl | 75 + .../0-opt.spvasm | 113 + .../0-opt.spvasm.expected.hlsl | 62 + .../0-opt.spvasm.expected.msl | 73 + .../0-opt.spvasm.expected.spvasm | 166 ++ .../0-opt.spvasm.expected.wgsl | 67 + .../0-opt.wgsl | 67 + .../0-opt.wgsl.expected.hlsl | 62 + .../0-opt.wgsl.expected.msl | 73 + .../0-opt.wgsl.expected.spvasm | 166 ++ .../0-opt.wgsl.expected.wgsl | 67 + .../0-opt.spvasm | 267 +++ .../0-opt.spvasm.expected.hlsl | 114 + .../0-opt.spvasm.expected.msl | 145 ++ .../0-opt.spvasm.expected.spvasm | 314 +++ .../0-opt.spvasm.expected.wgsl | 144 ++ .../0-opt.wgsl | 144 ++ .../0-opt.wgsl.expected.hlsl | 114 + .../0-opt.wgsl.expected.msl | 145 ++ .../0-opt.wgsl.expected.spvasm | 314 +++ .../0-opt.wgsl.expected.wgsl | 144 ++ .../0-opt.spvasm | 127 ++ .../0-opt.spvasm.expected.hlsl | 73 + .../0-opt.spvasm.expected.msl | 80 + .../0-opt.spvasm.expected.spvasm | 182 ++ .../0-opt.spvasm.expected.wgsl | 75 + .../0-opt.wgsl | 75 + .../0-opt.wgsl.expected.hlsl | 73 + .../0-opt.wgsl.expected.msl | 80 + .../0-opt.wgsl.expected.spvasm | 182 ++ .../0-opt.wgsl.expected.wgsl | 75 + .../0.spvasm | 89 + .../0.spvasm.expected.hlsl | 75 + .../0.spvasm.expected.msl | 85 + .../0.spvasm.expected.spvasm | 192 ++ .../0.spvasm.expected.wgsl | 80 + .../0.wgsl | 80 + .../0.wgsl.expected.hlsl | 75 + .../0.wgsl.expected.msl | 85 + .../0.wgsl.expected.spvasm | 192 ++ .../0.wgsl.expected.wgsl | 80 + .../0-opt.spvasm | 98 + .../0-opt.spvasm.expected.hlsl | 47 + .../0-opt.spvasm.expected.msl | 60 + .../0-opt.spvasm.expected.spvasm | 136 ++ .../0-opt.spvasm.expected.wgsl | 54 + .../0-opt.wgsl | 54 + .../0-opt.wgsl.expected.hlsl | 47 + .../0-opt.wgsl.expected.msl | 60 + .../0-opt.wgsl.expected.spvasm | 136 ++ .../0-opt.wgsl.expected.wgsl | 54 + .../0-opt.spvasm | 70 + .../0-opt.spvasm.expected.hlsl | 35 + .../0-opt.spvasm.expected.msl | 42 + .../0-opt.spvasm.expected.spvasm | 104 + .../0-opt.spvasm.expected.wgsl | 40 + .../0-opt.wgsl | 40 + .../0-opt.wgsl.expected.hlsl | 35 + .../0-opt.wgsl.expected.msl | 42 + .../0-opt.wgsl.expected.spvasm | 104 + .../0-opt.wgsl.expected.wgsl | 40 + .../cov-if-switch-fallthrough/0.spvasm | 96 + .../0.spvasm.expected.hlsl | 59 + .../0.spvasm.expected.msl | 69 + .../0.spvasm.expected.spvasm | 135 ++ .../0.spvasm.expected.wgsl | 59 + .../cov-if-switch-fallthrough/0.wgsl | 59 + .../0.wgsl.expected.hlsl | 59 + .../0.wgsl.expected.msl | 69 + .../0.wgsl.expected.spvasm | 135 ++ .../0.wgsl.expected.wgsl | 59 + .../cov-if-true-continue/0-opt.spvasm | 134 ++ .../0-opt.spvasm.expected.hlsl | 73 + .../0-opt.spvasm.expected.msl | 86 + .../0-opt.spvasm.expected.spvasm | 182 ++ .../0-opt.spvasm.expected.wgsl | 79 + .../cov-if-true-continue/0-opt.wgsl | 79 + .../0-opt.wgsl.expected.hlsl | 73 + .../0-opt.wgsl.expected.msl | 86 + .../0-opt.wgsl.expected.spvasm | 182 ++ .../0-opt.wgsl.expected.wgsl | 79 + .../0-opt.spvasm | 97 + .../0-opt.spvasm.expected.hlsl | 55 + .../0-opt.spvasm.expected.msl | 64 + .../0-opt.spvasm.expected.spvasm | 142 ++ .../0-opt.spvasm.expected.wgsl | 58 + .../0-opt.wgsl | 58 + .../0-opt.wgsl.expected.hlsl | 55 + .../0-opt.wgsl.expected.msl | 64 + .../0-opt.wgsl.expected.spvasm | 142 ++ .../0-opt.wgsl.expected.wgsl | 58 + .../0-opt.spvasm | 86 + .../0-opt.spvasm.expected.hlsl | 52 + .../0-opt.spvasm.expected.msl | 59 + .../0-opt.spvasm.expected.spvasm | 127 ++ .../0-opt.spvasm.expected.wgsl | 55 + .../cov-inc-inside-switch-and-for/0-opt.wgsl | 55 + .../0-opt.wgsl.expected.hlsl | 52 + .../0-opt.wgsl.expected.msl | 59 + .../0-opt.wgsl.expected.spvasm | 127 ++ .../0-opt.wgsl.expected.wgsl | 55 + .../0-opt.spvasm | 147 ++ .../0-opt.spvasm.expected.hlsl | 87 + .../0-opt.spvasm.expected.msl | 102 + .../0-opt.spvasm.expected.spvasm | 206 ++ .../0-opt.spvasm.expected.wgsl | 90 + .../0-opt.wgsl | 90 + .../0-opt.wgsl.expected.hlsl | 87 + .../0-opt.wgsl.expected.msl | 102 + .../0-opt.wgsl.expected.spvasm | 206 ++ .../0-opt.wgsl.expected.wgsl | 90 + .../0-opt.spvasm | 134 ++ .../0-opt.spvasm.expected.hlsl | 73 + .../0-opt.spvasm.expected.msl | 91 + .../0-opt.spvasm.expected.spvasm | 185 ++ .../0-opt.spvasm.expected.wgsl | 84 + .../0-opt.wgsl | 84 + .../0-opt.wgsl.expected.hlsl | 73 + .../0-opt.wgsl.expected.msl | 91 + .../0-opt.wgsl.expected.spvasm | 185 ++ .../0-opt.wgsl.expected.wgsl | 84 + .../0-opt.spvasm | 124 ++ .../0-opt.spvasm.expected.hlsl | 79 + .../0-opt.spvasm.expected.msl | 96 + .../0-opt.spvasm.expected.spvasm | 193 ++ .../0-opt.spvasm.expected.wgsl | 93 + .../0-opt.wgsl | 93 + .../0-opt.wgsl.expected.hlsl | 79 + .../0-opt.wgsl.expected.msl | 96 + .../0-opt.wgsl.expected.spvasm | 193 ++ .../0-opt.wgsl.expected.wgsl | 93 + .../cov-increment-inside-clamp/0-opt.spvasm | 96 + .../0-opt.spvasm.expected.hlsl | 47 + .../0-opt.spvasm.expected.msl | 56 + .../0-opt.spvasm.expected.spvasm | 133 ++ .../0-opt.spvasm.expected.wgsl | 51 + .../cov-increment-inside-clamp/0-opt.wgsl | 51 + .../0-opt.wgsl.expected.hlsl | 47 + .../0-opt.wgsl.expected.msl | 56 + .../0-opt.wgsl.expected.spvasm | 133 ++ .../0-opt.wgsl.expected.wgsl | 51 + .../0-opt.spvasm | 121 ++ .../0-opt.spvasm.expected.hlsl | 60 + .../0-opt.spvasm.expected.msl | 74 + .../0-opt.spvasm.expected.spvasm | 161 ++ .../0-opt.spvasm.expected.wgsl | 64 + .../0-opt.wgsl | 64 + .../0-opt.wgsl.expected.hlsl | 60 + .../0-opt.wgsl.expected.msl | 74 + .../0-opt.wgsl.expected.spvasm | 161 ++ .../0-opt.wgsl.expected.wgsl | 64 + .../0-opt.spvasm | 159 ++ .../0-opt.spvasm.expected.hlsl | 96 + .../0-opt.spvasm.expected.msl | 105 + .../0-opt.spvasm.expected.spvasm | 225 ++ .../0-opt.spvasm.expected.wgsl | 99 + .../0-opt.wgsl | 99 + .../0-opt.wgsl.expected.hlsl | 96 + .../0-opt.wgsl.expected.msl | 105 + .../0-opt.wgsl.expected.spvasm | 225 ++ .../0-opt.wgsl.expected.wgsl | 99 + .../0-opt.spvasm | 145 ++ .../0-opt.spvasm.expected.hlsl | 70 + .../0-opt.spvasm.expected.msl | 83 + .../0-opt.spvasm.expected.spvasm | 182 ++ .../0-opt.spvasm.expected.wgsl | 71 + .../0-opt.wgsl | 71 + .../0-opt.wgsl.expected.hlsl | 70 + .../0-opt.wgsl.expected.msl | 83 + .../0-opt.wgsl.expected.spvasm | 182 ++ .../0-opt.wgsl.expected.wgsl | 71 + .../0-opt.spvasm | 152 ++ .../0-opt.spvasm.expected.hlsl | 68 + .../0-opt.spvasm.expected.msl | 77 + .../0-opt.spvasm.expected.spvasm | 200 ++ .../0-opt.spvasm.expected.wgsl | 69 + .../0-opt.wgsl | 69 + .../0-opt.wgsl.expected.hlsl | 68 + .../0-opt.wgsl.expected.msl | 77 + .../0-opt.wgsl.expected.spvasm | 200 ++ .../0-opt.wgsl.expected.wgsl | 69 + .../cov-inline-pass-empty-block/0-opt.spvasm | 61 + .../0-opt.spvasm.expected.hlsl | 44 + .../0-opt.spvasm.expected.msl | 44 + .../0-opt.spvasm.expected.spvasm | 107 + .../0-opt.spvasm.expected.wgsl | 39 + .../cov-inline-pass-empty-block/0-opt.wgsl | 39 + .../0-opt.wgsl.expected.hlsl | 44 + .../0-opt.wgsl.expected.msl | 44 + .../0-opt.wgsl.expected.spvasm | 107 + .../0-opt.wgsl.expected.wgsl | 39 + .../cov-inline-pass-nested-loops/0-opt.spvasm | 93 + .../0-opt.spvasm.expected.hlsl | 76 + .../0-opt.spvasm.expected.msl | 80 + .../0-opt.spvasm.expected.spvasm | 175 ++ .../0-opt.spvasm.expected.wgsl | 80 + .../cov-inline-pass-nested-loops/0-opt.wgsl | 80 + .../0-opt.wgsl.expected.hlsl | 76 + .../0-opt.wgsl.expected.msl | 80 + .../0-opt.wgsl.expected.spvasm | 175 ++ .../0-opt.wgsl.expected.wgsl | 80 + .../0-opt.spvasm | 84 + .../0-opt.spvasm.expected.hlsl | 41 + .../0-opt.spvasm.expected.msl | 54 + .../0-opt.spvasm.expected.spvasm | 120 ++ .../0-opt.spvasm.expected.wgsl | 49 + .../cov-inline-pass-return-in-loop/0-opt.wgsl | 49 + .../0-opt.wgsl.expected.hlsl | 41 + .../0-opt.wgsl.expected.msl | 54 + .../0-opt.wgsl.expected.spvasm | 120 ++ .../0-opt.wgsl.expected.wgsl | 49 + .../0-opt.spvasm | 76 + .../0-opt.spvasm.expected.hlsl | 45 + .../0-opt.spvasm.expected.msl | 46 + .../0-opt.spvasm.expected.spvasm | 111 + .../0-opt.spvasm.expected.wgsl | 41 + .../0-opt.wgsl | 41 + .../0-opt.wgsl.expected.hlsl | 45 + .../0-opt.wgsl.expected.msl | 46 + .../0-opt.wgsl.expected.spvasm | 111 + .../0-opt.wgsl.expected.wgsl | 41 + .../0-opt.spvasm | 152 ++ .../0-opt.spvasm.expected.hlsl | 83 + .../0-opt.spvasm.expected.msl | 96 + .../0-opt.spvasm.expected.spvasm | 197 ++ .../0-opt.spvasm.expected.wgsl | 87 + .../0-opt.wgsl | 87 + .../0-opt.wgsl.expected.hlsl | 83 + .../0-opt.wgsl.expected.msl | 96 + .../0-opt.wgsl.expected.spvasm | 197 ++ .../0-opt.wgsl.expected.wgsl | 87 + .../0-opt.spvasm | 122 ++ .../0-opt.spvasm.expected.hlsl | 59 + .../0-opt.spvasm.expected.msl | 78 + .../0-opt.spvasm.expected.spvasm | 163 ++ .../0-opt.spvasm.expected.wgsl | 71 + .../cov-inst-combine-add-sub-ldexp/0-opt.wgsl | 71 + .../0-opt.wgsl.expected.hlsl | 59 + .../0-opt.wgsl.expected.msl | 78 + .../0-opt.wgsl.expected.spvasm | 163 ++ .../0-opt.wgsl.expected.wgsl | 71 + .../0-opt.spvasm | 154 ++ .../0-opt.spvasm.expected.hlsl | 80 + .../0-opt.spvasm.expected.msl | 92 + .../0-opt.spvasm.expected.spvasm | 193 ++ .../0-opt.spvasm.expected.wgsl | 86 + .../0-opt.wgsl | 86 + .../0-opt.wgsl.expected.hlsl | 80 + .../0-opt.wgsl.expected.msl | 92 + .../0-opt.wgsl.expected.spvasm | 193 ++ .../0-opt.wgsl.expected.wgsl | 86 + .../0-opt.spvasm | 156 ++ .../0-opt.spvasm.expected.hlsl | 85 + .../0-opt.spvasm.expected.msl | 102 + .../0-opt.spvasm.expected.spvasm | 201 ++ .../0-opt.spvasm.expected.wgsl | 93 + .../0-opt.wgsl | 93 + .../0-opt.wgsl.expected.hlsl | 85 + .../0-opt.wgsl.expected.msl | 102 + .../0-opt.wgsl.expected.spvasm | 201 ++ .../0-opt.wgsl.expected.wgsl | 93 + .../0-opt.spvasm | 178 ++ .../0-opt.spvasm.expected.hlsl | 109 + .../0-opt.spvasm.expected.msl | 110 + .../0-opt.spvasm.expected.spvasm | 239 ++ .../0-opt.spvasm.expected.wgsl | 102 + .../0-opt.wgsl | 102 + .../0-opt.wgsl.expected.hlsl | 109 + .../0-opt.wgsl.expected.msl | 110 + .../0-opt.wgsl.expected.spvasm | 239 ++ .../0-opt.wgsl.expected.wgsl | 102 + .../0-opt.spvasm | 133 ++ .../0-opt.spvasm.expected.hlsl | 78 + .../0-opt.spvasm.expected.msl | 91 + .../0-opt.spvasm.expected.spvasm | 173 ++ .../0-opt.spvasm.expected.wgsl | 81 + .../0-opt.wgsl | 81 + .../0-opt.wgsl.expected.hlsl | 78 + .../0-opt.wgsl.expected.msl | 91 + .../0-opt.wgsl.expected.spvasm | 173 ++ .../0-opt.wgsl.expected.wgsl | 81 + .../0-opt.spvasm | 103 + .../0-opt.spvasm.expected.hlsl | 53 + .../0-opt.spvasm.expected.msl | 68 + .../0-opt.spvasm.expected.spvasm | 139 ++ .../0-opt.spvasm.expected.wgsl | 57 + .../0-opt.wgsl | 57 + .../0-opt.wgsl.expected.hlsl | 53 + .../0-opt.wgsl.expected.msl | 68 + .../0-opt.wgsl.expected.spvasm | 139 ++ .../0-opt.wgsl.expected.wgsl | 57 + .../0-opt.spvasm | 73 + .../0-opt.spvasm.expected.hlsl | 35 + .../0-opt.spvasm.expected.msl | 43 + .../0-opt.spvasm.expected.spvasm | 98 + .../0-opt.spvasm.expected.wgsl | 36 + .../0-opt.wgsl | 36 + .../0-opt.wgsl.expected.hlsl | 35 + .../0-opt.wgsl.expected.msl | 43 + .../0-opt.wgsl.expected.spvasm | 98 + .../0-opt.wgsl.expected.wgsl | 36 + .../0-opt.spvasm | 94 + .../0-opt.spvasm.expected.hlsl | 46 + .../0-opt.spvasm.expected.msl | 57 + .../0-opt.spvasm.expected.spvasm | 128 ++ .../0-opt.spvasm.expected.wgsl | 49 + .../0-opt.wgsl | 49 + .../0-opt.wgsl.expected.hlsl | 46 + .../0-opt.wgsl.expected.msl | 57 + .../0-opt.wgsl.expected.spvasm | 128 ++ .../0-opt.wgsl.expected.wgsl | 49 + .../0-opt.spvasm | 146 ++ .../0-opt.spvasm.expected.hlsl | 74 + .../0-opt.spvasm.expected.msl | 87 + .../0-opt.spvasm.expected.spvasm | 186 ++ .../0-opt.spvasm.expected.wgsl | 80 + .../0-opt.wgsl | 80 + .../0-opt.wgsl.expected.hlsl | 74 + .../0-opt.wgsl.expected.msl | 87 + .../0-opt.wgsl.expected.spvasm | 186 ++ .../0-opt.wgsl.expected.wgsl | 80 + .../0-opt.spvasm | 114 + .../0-opt.spvasm.expected.hlsl | 57 + .../0-opt.spvasm.expected.msl | 67 + .../0-opt.spvasm.expected.spvasm | 153 ++ .../0-opt.spvasm.expected.wgsl | 60 + .../0-opt.wgsl | 60 + .../0-opt.wgsl.expected.hlsl | 57 + .../0-opt.wgsl.expected.msl | 67 + .../0-opt.wgsl.expected.spvasm | 153 ++ .../0-opt.wgsl.expected.wgsl | 60 + .../0-opt.spvasm | 101 + .../0-opt.spvasm.expected.hlsl | 47 + .../0-opt.spvasm.expected.msl | 64 + .../0-opt.spvasm.expected.spvasm | 140 ++ .../0-opt.spvasm.expected.wgsl | 56 + .../0-opt.wgsl | 56 + .../0-opt.wgsl.expected.hlsl | 47 + .../0-opt.wgsl.expected.msl | 64 + .../0-opt.wgsl.expected.spvasm | 140 ++ .../0-opt.wgsl.expected.wgsl | 56 + .../0-opt.spvasm | 152 ++ .../0-opt.spvasm.expected.hlsl | 78 + .../0-opt.spvasm.expected.msl | 85 + .../0-opt.spvasm.expected.spvasm | 191 ++ .../0-opt.spvasm.expected.wgsl | 78 + .../0-opt.wgsl | 78 + .../0-opt.wgsl.expected.hlsl | 78 + .../0-opt.wgsl.expected.msl | 85 + .../0-opt.wgsl.expected.spvasm | 191 ++ .../0-opt.wgsl.expected.wgsl | 78 + .../cov-inst-combine-pack-unpack/0-opt.spvasm | 176 ++ .../0-opt.spvasm.expected.hlsl | 96 + .../0-opt.spvasm.expected.msl | 106 + .../0-opt.spvasm.expected.spvasm | 238 ++ .../0-opt.spvasm.expected.wgsl | 98 + .../cov-inst-combine-pack-unpack/0-opt.wgsl | 98 + .../0-opt.wgsl.expected.hlsl | 96 + .../0-opt.wgsl.expected.msl | 106 + .../0-opt.wgsl.expected.spvasm | 238 ++ .../0-opt.wgsl.expected.wgsl | 98 + .../0-opt.spvasm | 116 + .../0-opt.spvasm.expected.hlsl | 68 + .../0-opt.spvasm.expected.msl | 79 + .../0-opt.spvasm.expected.spvasm | 170 ++ .../0-opt.spvasm.expected.wgsl | 73 + .../0-opt.wgsl | 73 + .../0-opt.wgsl.expected.hlsl | 68 + .../0-opt.wgsl.expected.msl | 79 + .../0-opt.wgsl.expected.spvasm | 170 ++ .../0-opt.wgsl.expected.wgsl | 73 + .../0-opt.spvasm | 197 ++ .../0-opt.spvasm.expected.hlsl | 94 + .../0-opt.spvasm.expected.msl | 106 + .../0-opt.spvasm.expected.spvasm | 239 ++ .../0-opt.spvasm.expected.wgsl | 95 + .../0-opt.wgsl | 95 + .../0-opt.wgsl.expected.hlsl | 94 + .../0-opt.wgsl.expected.msl | 106 + .../0-opt.wgsl.expected.spvasm | 239 ++ .../0-opt.wgsl.expected.wgsl | 95 + .../0-opt.spvasm | 170 ++ .../0-opt.spvasm.expected.hlsl | 98 + .../0-opt.spvasm.expected.msl | 105 + .../0-opt.spvasm.expected.spvasm | 232 ++ .../0-opt.spvasm.expected.wgsl | 97 + .../0-opt.wgsl | 97 + .../0-opt.wgsl.expected.hlsl | 98 + .../0-opt.wgsl.expected.msl | 105 + .../0-opt.wgsl.expected.spvasm | 232 ++ .../0-opt.wgsl.expected.wgsl | 97 + .../0-opt.spvasm | 169 ++ .../0-opt.spvasm.expected.hlsl | 99 + .../0-opt.spvasm.expected.msl | 107 + .../0-opt.spvasm.expected.spvasm | 231 ++ .../0-opt.spvasm.expected.wgsl | 99 + .../0-opt.wgsl | 99 + .../0-opt.wgsl.expected.hlsl | 99 + .../0-opt.wgsl.expected.msl | 107 + .../0-opt.wgsl.expected.spvasm | 231 ++ .../0-opt.wgsl.expected.wgsl | 99 + .../0-opt.spvasm | 81 + .../0-opt.spvasm.expected.hlsl | 52 + .../0-opt.spvasm.expected.msl | 62 + .../0-opt.spvasm.expected.spvasm | 116 + .../0-opt.spvasm.expected.wgsl | 52 + .../0-opt.wgsl | 52 + .../0-opt.wgsl.expected.hlsl | 52 + .../0-opt.wgsl.expected.msl | 62 + .../0-opt.wgsl.expected.spvasm | 116 + .../0-opt.wgsl.expected.wgsl | 52 + .../0-opt.spvasm | 142 ++ .../0-opt.spvasm.expected.hlsl | 75 + .../0-opt.spvasm.expected.msl | 97 + .../0-opt.spvasm.expected.spvasm | 193 ++ .../0-opt.spvasm.expected.wgsl | 90 + .../0-opt.wgsl | 90 + .../0-opt.wgsl.expected.hlsl | 75 + .../0-opt.wgsl.expected.msl | 97 + .../0-opt.wgsl.expected.spvasm | 193 ++ .../0-opt.wgsl.expected.wgsl | 90 + .../0-opt.spvasm | 64 + .../0-opt.spvasm.expected.hlsl | 36 + .../0-opt.spvasm.expected.msl | 43 + .../0-opt.spvasm.expected.spvasm | 97 + .../0-opt.spvasm.expected.wgsl | 36 + .../0-opt.wgsl | 36 + .../0-opt.wgsl.expected.hlsl | 36 + .../0-opt.wgsl.expected.msl | 43 + .../0-opt.wgsl.expected.spvasm | 97 + .../0-opt.wgsl.expected.wgsl | 36 + .../0-opt.spvasm | 77 + .../0-opt.spvasm.expected.hlsl | 40 + .../0-opt.spvasm.expected.msl | 48 + .../0-opt.spvasm.expected.spvasm | 113 + .../0-opt.spvasm.expected.wgsl | 41 + .../0-opt.wgsl | 41 + .../0-opt.wgsl.expected.hlsl | 40 + .../0-opt.wgsl.expected.msl | 48 + .../0-opt.wgsl.expected.spvasm | 113 + .../0-opt.wgsl.expected.wgsl | 41 + .../0-opt.spvasm | 92 + .../0-opt.spvasm.expected.hlsl | 46 + .../0-opt.spvasm.expected.msl | 59 + .../0-opt.spvasm.expected.spvasm | 126 ++ .../0-opt.spvasm.expected.wgsl | 51 + .../0-opt.wgsl | 51 + .../0-opt.wgsl.expected.hlsl | 46 + .../0-opt.wgsl.expected.msl | 59 + .../0-opt.wgsl.expected.spvasm | 126 ++ .../0-opt.wgsl.expected.wgsl | 51 + .../0-opt.spvasm | 407 ++++ .../0-opt.spvasm.expected.hlsl | 172 ++ .../0-opt.spvasm.expected.msl | 188 ++ .../0-opt.spvasm.expected.spvasm | 371 ++++ .../0-opt.spvasm.expected.wgsl | 177 ++ .../0-opt.wgsl | 177 ++ .../0-opt.wgsl.expected.hlsl | 172 ++ .../0-opt.wgsl.expected.msl | 188 ++ .../0-opt.wgsl.expected.spvasm | 371 ++++ .../0-opt.wgsl.expected.wgsl | 177 ++ .../0-opt.spvasm | 93 + .../0-opt.spvasm.expected.hlsl | 43 + .../0-opt.spvasm.expected.msl | 63 + .../0-opt.spvasm.expected.spvasm | 122 ++ .../0-opt.spvasm.expected.wgsl | 48 + .../0-opt.wgsl | 48 + .../0-opt.wgsl.expected.hlsl | 6 + .../0-opt.wgsl.expected.msl | 6 + .../0-opt.wgsl.expected.spvasm | 6 + .../0-opt.wgsl.expected.wgsl | 6 + .../0-opt.spvasm | 93 + .../0-opt.spvasm.expected.hlsl | 43 + .../0-opt.spvasm.expected.msl | 63 + .../0-opt.spvasm.expected.spvasm | 122 ++ .../0-opt.spvasm.expected.wgsl | 48 + .../0-opt.wgsl | 48 + .../0-opt.wgsl.expected.hlsl | 6 + .../0-opt.wgsl.expected.msl | 6 + .../0-opt.wgsl.expected.spvasm | 6 + .../0-opt.wgsl.expected.wgsl | 6 + .../cov-instruction-simplify-sqrt/0.spvasm | 80 + .../0.spvasm.expected.hlsl | 39 + .../0.spvasm.expected.msl | 54 + .../0.spvasm.expected.spvasm | 110 + .../0.spvasm.expected.wgsl | 46 + .../cov-instruction-simplify-sqrt/0.wgsl | 46 + .../0.wgsl.expected.hlsl | 39 + .../0.wgsl.expected.msl | 54 + .../0.wgsl.expected.spvasm | 110 + .../0.wgsl.expected.wgsl | 46 + .../0-opt.spvasm | 263 +++ .../0-opt.spvasm.expected.hlsl | 146 ++ .../0-opt.spvasm.expected.msl | 162 ++ .../0-opt.spvasm.expected.spvasm | 333 +++ .../0-opt.spvasm.expected.wgsl | 160 ++ .../0-opt.wgsl | 160 ++ .../0-opt.wgsl.expected.hlsl | 146 ++ .../0-opt.wgsl.expected.msl | 162 ++ .../0-opt.wgsl.expected.spvasm | 333 +++ .../0-opt.wgsl.expected.wgsl | 160 ++ .../0-opt.spvasm | 103 + .../0-opt.spvasm.expected.hlsl | 54 + .../0-opt.spvasm.expected.msl | 70 + .../0-opt.spvasm.expected.spvasm | 142 ++ .../0-opt.spvasm.expected.wgsl | 63 + .../0-opt.wgsl | 63 + .../0-opt.wgsl.expected.hlsl | 54 + .../0-opt.wgsl.expected.msl | 70 + .../0-opt.wgsl.expected.spvasm | 142 ++ .../0-opt.wgsl.expected.wgsl | 63 + .../cov-int-div-round-to-zero/0-opt.spvasm | 84 + .../0-opt.spvasm.expected.hlsl | 43 + .../0-opt.spvasm.expected.msl | 49 + .../0-opt.spvasm.expected.spvasm | 116 + .../0-opt.spvasm.expected.wgsl | 42 + .../cov-int-div-round-to-zero/0-opt.wgsl | 42 + .../0-opt.wgsl.expected.hlsl | 43 + .../0-opt.wgsl.expected.msl | 49 + .../0-opt.wgsl.expected.spvasm | 116 + .../0-opt.wgsl.expected.wgsl | 42 + .../0-opt.spvasm | 108 + .../0-opt.spvasm.expected.hlsl | 52 + .../0-opt.spvasm.expected.msl | 65 + .../0-opt.spvasm.expected.spvasm | 149 ++ .../0-opt.spvasm.expected.wgsl | 60 + .../0-opt.wgsl | 60 + .../0-opt.wgsl.expected.hlsl | 52 + .../0-opt.wgsl.expected.msl | 65 + .../0-opt.wgsl.expected.spvasm | 149 ++ .../0-opt.wgsl.expected.wgsl | 60 + .../cov-integer-modulo-negative/0-opt.spvasm | 112 + .../0-opt.spvasm.expected.hlsl | 58 + .../0-opt.spvasm.expected.msl | 69 + .../0-opt.spvasm.expected.spvasm | 150 ++ .../0-opt.spvasm.expected.wgsl | 63 + .../cov-integer-modulo-negative/0-opt.wgsl | 63 + .../0-opt.wgsl.expected.hlsl | 58 + .../0-opt.wgsl.expected.msl | 69 + .../0-opt.wgsl.expected.spvasm | 150 ++ .../0-opt.wgsl.expected.wgsl | 63 + .../cov-intervalmap-set-stop/0-opt.spvasm | 173 ++ .../0-opt.spvasm.expected.hlsl | 78 + .../0-opt.spvasm.expected.msl | 108 + .../0-opt.spvasm.expected.spvasm | 233 ++ .../0-opt.spvasm.expected.wgsl | 102 + .../cov-intervalmap-set-stop/0-opt.wgsl | 102 + .../0-opt.wgsl.expected.hlsl | 78 + .../0-opt.wgsl.expected.msl | 108 + .../0-opt.wgsl.expected.spvasm | 233 ++ .../0-opt.wgsl.expected.wgsl | 102 + .../0.spvasm | 96 + .../0.spvasm.expected.hlsl | 47 + .../0.spvasm.expected.msl | 59 + .../0.spvasm.expected.spvasm | 131 ++ .../0.spvasm.expected.wgsl | 51 + .../0.wgsl | 51 + .../0.wgsl.expected.hlsl | 47 + .../0.wgsl.expected.msl | 59 + .../0.wgsl.expected.spvasm | 131 ++ .../0.wgsl.expected.wgsl | 51 + .../cov-left-shift-array-access/0-opt.spvasm | 90 + .../0-opt.spvasm.expected.hlsl | 55 + .../0-opt.spvasm.expected.msl | 57 + .../0-opt.spvasm.expected.spvasm | 125 ++ .../0-opt.spvasm.expected.wgsl | 49 + .../cov-left-shift-array-access/0-opt.wgsl | 49 + .../0-opt.wgsl.expected.hlsl | 55 + .../0-opt.wgsl.expected.msl | 57 + .../0-opt.wgsl.expected.spvasm | 125 ++ .../0-opt.wgsl.expected.wgsl | 49 + .../0.spvasm | 72 + .../0.spvasm.expected.hlsl | 48 + .../0.spvasm.expected.msl | 57 + .../0.spvasm.expected.spvasm | 125 ++ .../0.spvasm.expected.wgsl | 51 + .../cov-left-shift-right-shift-compare/0.wgsl | 51 + .../0.wgsl.expected.hlsl | 48 + .../0.wgsl.expected.msl | 57 + .../0.wgsl.expected.spvasm | 125 ++ .../0.wgsl.expected.wgsl | 51 + .../0-opt.spvasm | 154 ++ .../0-opt.spvasm.expected.hlsl | 65 + .../0-opt.spvasm.expected.msl | 94 + .../0-opt.spvasm.expected.spvasm | 204 ++ .../0-opt.spvasm.expected.wgsl | 88 + .../0-opt.wgsl | 88 + .../0-opt.wgsl.expected.hlsl | 65 + .../0-opt.wgsl.expected.msl | 94 + .../0-opt.wgsl.expected.spvasm | 204 ++ .../0-opt.wgsl.expected.wgsl | 88 + .../cov-loop-abs-multiply-offset/0-opt.spvasm | 134 ++ .../0-opt.spvasm.expected.hlsl | 72 + .../0-opt.spvasm.expected.msl | 88 + .../0-opt.spvasm.expected.spvasm | 185 ++ .../0-opt.spvasm.expected.wgsl | 81 + .../cov-loop-abs-multiply-offset/0-opt.wgsl | 81 + .../0-opt.wgsl.expected.hlsl | 72 + .../0-opt.wgsl.expected.msl | 88 + .../0-opt.wgsl.expected.spvasm | 185 ++ .../0-opt.wgsl.expected.wgsl | 81 + .../0-opt.spvasm | 95 + .../0-opt.spvasm.expected.hlsl | 43 + .../0-opt.spvasm.expected.msl | 55 + .../0-opt.spvasm.expected.spvasm | 135 ++ .../0-opt.spvasm.expected.wgsl | 54 + .../0-opt.wgsl | 54 + .../0-opt.wgsl.expected.hlsl | 43 + .../0-opt.wgsl.expected.msl | 55 + .../0-opt.wgsl.expected.spvasm | 135 ++ .../0-opt.wgsl.expected.wgsl | 54 + .../0-opt.spvasm | 137 ++ .../0-opt.spvasm.expected.hlsl | 67 + .../0-opt.spvasm.expected.msl | 84 + .../0-opt.spvasm.expected.spvasm | 177 ++ .../0-opt.spvasm.expected.wgsl | 78 + .../0-opt.wgsl | 78 + .../0-opt.wgsl.expected.hlsl | 67 + .../0-opt.wgsl.expected.msl | 84 + .../0-opt.wgsl.expected.spvasm | 177 ++ .../0-opt.wgsl.expected.wgsl | 78 + .../0-opt.spvasm | 152 ++ .../0-opt.spvasm.expected.hlsl | 92 + .../0-opt.spvasm.expected.msl | 102 + .../0-opt.spvasm.expected.spvasm | 224 ++ .../0-opt.spvasm.expected.wgsl | 91 + .../0-opt.wgsl | 91 + .../0-opt.wgsl.expected.hlsl | 92 + .../0-opt.wgsl.expected.msl | 102 + .../0-opt.wgsl.expected.spvasm | 224 ++ .../0-opt.wgsl.expected.wgsl | 91 + .../0-opt.spvasm | 145 ++ .../0-opt.spvasm.expected.hlsl | 72 + .../0-opt.spvasm.expected.msl | 91 + .../0-opt.spvasm.expected.spvasm | 185 ++ .../0-opt.spvasm.expected.wgsl | 84 + .../cov-loop-dfdx-constant-divide/0-opt.wgsl | 84 + .../0-opt.wgsl.expected.hlsl | 72 + .../0-opt.wgsl.expected.msl | 91 + .../0-opt.wgsl.expected.spvasm | 185 ++ .../0-opt.wgsl.expected.wgsl | 84 + .../0-opt.spvasm | 192 ++ .../0-opt.spvasm.expected.hlsl | 100 + .../0-opt.spvasm.expected.msl | 101 + .../0-opt.spvasm.expected.spvasm | 249 +++ .../0-opt.spvasm.expected.wgsl | 95 + .../0-opt.wgsl | 95 + .../0-opt.wgsl.expected.hlsl | 100 + .../0-opt.wgsl.expected.msl | 101 + .../0-opt.wgsl.expected.spvasm | 249 +++ .../0-opt.wgsl.expected.wgsl | 95 + .../0-opt.spvasm | 113 + .../0-opt.spvasm.expected.hlsl | 53 + .../0-opt.spvasm.expected.msl | 71 + .../0-opt.spvasm.expected.spvasm | 151 ++ .../0-opt.spvasm.expected.wgsl | 65 + .../0-opt.wgsl | 65 + .../0-opt.wgsl.expected.hlsl | 53 + .../0-opt.wgsl.expected.msl | 71 + .../0-opt.wgsl.expected.spvasm | 151 ++ .../0-opt.wgsl.expected.wgsl | 65 + .../0-opt.spvasm | 93 + .../0-opt.spvasm.expected.hlsl | 48 + .../0-opt.spvasm.expected.msl | 57 + .../0-opt.spvasm.expected.spvasm | 131 ++ .../0-opt.spvasm.expected.wgsl | 50 + .../0-opt.wgsl | 50 + .../0-opt.wgsl.expected.hlsl | 48 + .../0-opt.wgsl.expected.msl | 57 + .../0-opt.wgsl.expected.spvasm | 131 ++ .../0-opt.wgsl.expected.wgsl | 50 + .../cov-loop-logical-xor/0-opt.spvasm | 81 + .../0-opt.spvasm.expected.hlsl | 44 + .../0-opt.spvasm.expected.msl | 52 + .../0-opt.spvasm.expected.spvasm | 119 + .../0-opt.spvasm.expected.wgsl | 45 + .../cov-loop-logical-xor/0-opt.wgsl | 45 + .../0-opt.wgsl.expected.hlsl | 44 + .../0-opt.wgsl.expected.msl | 52 + .../0-opt.wgsl.expected.spvasm | 119 + .../0-opt.wgsl.expected.wgsl | 45 + .../0-opt.spvasm | 117 + .../0-opt.spvasm.expected.hlsl | 73 + .../0-opt.spvasm.expected.msl | 81 + .../0-opt.spvasm.expected.spvasm | 164 ++ .../0-opt.spvasm.expected.wgsl | 74 + .../0-opt.wgsl | 74 + .../0-opt.wgsl.expected.hlsl | 73 + .../0-opt.wgsl.expected.msl | 81 + .../0-opt.wgsl.expected.spvasm | 164 ++ .../0-opt.wgsl.expected.wgsl | 74 + .../cov-loop-with-two-integers/0-opt.spvasm | 159 ++ .../0-opt.spvasm.expected.hlsl | 88 + .../0-opt.spvasm.expected.msl | 104 + .../0-opt.spvasm.expected.spvasm | 206 ++ .../0-opt.spvasm.expected.wgsl | 94 + .../cov-loop-with-two-integers/0-opt.wgsl | 94 + .../0-opt.wgsl.expected.hlsl | 88 + .../0-opt.wgsl.expected.msl | 104 + .../0-opt.wgsl.expected.spvasm | 206 ++ .../0-opt.wgsl.expected.wgsl | 94 + .../0-opt.spvasm | 223 ++ .../0-opt.spvasm.expected.hlsl | 123 ++ .../0-opt.spvasm.expected.msl | 140 ++ .../0-opt.spvasm.expected.spvasm | 287 +++ .../0-opt.spvasm.expected.wgsl | 133 ++ .../0-opt.wgsl | 133 ++ .../0-opt.wgsl.expected.hlsl | 123 ++ .../0-opt.wgsl.expected.msl | 140 ++ .../0-opt.wgsl.expected.spvasm | 287 +++ .../0-opt.wgsl.expected.wgsl | 133 ++ .../0-opt.spvasm | 182 ++ .../0-opt.spvasm.expected.hlsl | 92 + .../0-opt.spvasm.expected.msl | 101 + .../0-opt.spvasm.expected.spvasm | 221 ++ .../0-opt.spvasm.expected.wgsl | 95 + .../0-opt.wgsl | 95 + .../0-opt.wgsl.expected.hlsl | 92 + .../0-opt.wgsl.expected.msl | 101 + .../0-opt.wgsl.expected.spvasm | 221 ++ .../0-opt.wgsl.expected.wgsl | 95 + .../0-opt.spvasm | 92 + .../0-opt.spvasm.expected.hlsl | 47 + .../0-opt.spvasm.expected.msl | 53 + .../0-opt.spvasm.expected.spvasm | 130 ++ .../0-opt.spvasm.expected.wgsl | 52 + .../0-opt.wgsl | 52 + .../0-opt.wgsl.expected.hlsl | 47 + .../0-opt.wgsl.expected.msl | 53 + .../0-opt.wgsl.expected.spvasm | 130 ++ .../0-opt.wgsl.expected.wgsl | 52 + .../0-opt.spvasm | 140 ++ .../0-opt.spvasm.expected.hlsl | 74 + .../0-opt.spvasm.expected.msl | 79 + .../0-opt.spvasm.expected.spvasm | 181 ++ .../0-opt.spvasm.expected.wgsl | 74 + .../cov-matching-conditions-break/0-opt.wgsl | 74 + .../0-opt.wgsl.expected.hlsl | 74 + .../0-opt.wgsl.expected.msl | 79 + .../0-opt.wgsl.expected.spvasm | 181 ++ .../0-opt.wgsl.expected.wgsl | 74 + .../0-opt.spvasm | 175 ++ .../0-opt.spvasm.expected.hlsl | 99 + .../0-opt.spvasm.expected.msl | 107 + .../0-opt.spvasm.expected.spvasm | 215 ++ .../0-opt.spvasm.expected.wgsl | 97 + .../0-opt.wgsl | 97 + .../0-opt.wgsl.expected.hlsl | 99 + .../0-opt.wgsl.expected.msl | 107 + .../0-opt.wgsl.expected.spvasm | 215 ++ .../0-opt.wgsl.expected.wgsl | 97 + .../cov-matrix-double-transpose/0-opt.spvasm | 97 + .../0-opt.spvasm.expected.hlsl | 49 + .../0-opt.spvasm.expected.msl | 51 + .../0-opt.spvasm.expected.spvasm | 135 ++ .../0-opt.spvasm.expected.wgsl | 44 + .../cov-matrix-double-transpose/0-opt.wgsl | 44 + .../0-opt.wgsl.expected.hlsl | 49 + .../0-opt.wgsl.expected.msl | 51 + .../0-opt.wgsl.expected.spvasm | 135 ++ .../0-opt.wgsl.expected.wgsl | 44 + .../0-opt.spvasm | 98 + .../0-opt.spvasm.expected.hlsl | 49 + .../0-opt.spvasm.expected.msl | 56 + .../0-opt.spvasm.expected.spvasm | 129 ++ .../0-opt.spvasm.expected.wgsl | 49 + .../0-opt.wgsl | 49 + .../0-opt.wgsl.expected.hlsl | 49 + .../0-opt.wgsl.expected.msl | 56 + .../0-opt.wgsl.expected.spvasm | 129 ++ .../0-opt.wgsl.expected.wgsl | 49 + .../cov-max-clamp-same-minval/0-opt.spvasm | 56 + .../0-opt.spvasm.expected.hlsl | 30 + .../0-opt.spvasm.expected.msl | 33 + .../0-opt.spvasm.expected.spvasm | 89 + .../0-opt.spvasm.expected.wgsl | 31 + .../cov-max-clamp-same-minval/0-opt.wgsl | 31 + .../0-opt.wgsl.expected.hlsl | 30 + .../0-opt.wgsl.expected.msl | 33 + .../0-opt.wgsl.expected.spvasm | 89 + .../0-opt.wgsl.expected.wgsl | 31 + .../cov-max-min-less-than/0-opt.spvasm | 80 + .../0-opt.spvasm.expected.hlsl | 43 + .../0-opt.spvasm.expected.msl | 48 + .../0-opt.spvasm.expected.spvasm | 117 + .../0-opt.spvasm.expected.wgsl | 42 + .../cov-max-min-less-than/0-opt.wgsl | 42 + .../0-opt.wgsl.expected.hlsl | 43 + .../0-opt.wgsl.expected.msl | 48 + .../0-opt.wgsl.expected.spvasm | 117 + .../0-opt.wgsl.expected.wgsl | 42 + .../0-opt.spvasm | 196 ++ .../0-opt.spvasm.expected.hlsl | 99 + .../0-opt.spvasm.expected.msl | 120 ++ .../0-opt.spvasm.expected.spvasm | 274 +++ .../0-opt.spvasm.expected.wgsl | 122 ++ .../0-opt.wgsl | 122 ++ .../0-opt.wgsl.expected.hlsl | 99 + .../0-opt.wgsl.expected.msl | 120 ++ .../0-opt.wgsl.expected.spvasm | 274 +++ .../0-opt.wgsl.expected.wgsl | 122 ++ .../0-opt.spvasm | 83 + .../0-opt.spvasm.expected.hlsl | 42 + .../0-opt.spvasm.expected.msl | 46 + .../0-opt.spvasm.expected.spvasm | 114 + .../0-opt.spvasm.expected.wgsl | 44 + .../cov-mem-pass-unused-component/0-opt.wgsl | 44 + .../0-opt.wgsl.expected.hlsl | 42 + .../0-opt.wgsl.expected.msl | 46 + .../0-opt.wgsl.expected.spvasm | 114 + .../0-opt.wgsl.expected.wgsl | 44 + .../0-opt.spvasm | 88 + .../0-opt.spvasm.expected.hlsl | 59 + .../0-opt.spvasm.expected.msl | 63 + .../0-opt.spvasm.expected.spvasm | 144 ++ .../0-opt.spvasm.expected.wgsl | 62 + .../0-opt.wgsl | 62 + .../0-opt.wgsl.expected.hlsl | 59 + .../0-opt.wgsl.expected.msl | 63 + .../0-opt.wgsl.expected.spvasm | 144 ++ .../0-opt.wgsl.expected.wgsl | 62 + .../0-opt.spvasm | 95 + .../0-opt.spvasm.expected.hlsl | 48 + .../0-opt.spvasm.expected.msl | 58 + .../0-opt.spvasm.expected.spvasm | 133 ++ .../0-opt.spvasm.expected.wgsl | 51 + .../0-opt.wgsl | 51 + .../0-opt.wgsl.expected.hlsl | 48 + .../0-opt.wgsl.expected.msl | 58 + .../0-opt.wgsl.expected.spvasm | 133 ++ .../0-opt.wgsl.expected.wgsl | 51 + .../0-opt.spvasm | 47 + .../0-opt.spvasm.expected.hlsl | 30 + .../0-opt.spvasm.expected.msl | 29 + .../0-opt.spvasm.expected.spvasm | 81 + .../0-opt.spvasm.expected.wgsl | 24 + .../0-opt.wgsl | 24 + .../0-opt.wgsl.expected.hlsl | 30 + .../0-opt.wgsl.expected.msl | 29 + .../0-opt.wgsl.expected.spvasm | 81 + .../0-opt.wgsl.expected.wgsl | 24 + .../0-opt.spvasm | 111 + .../0-opt.spvasm.expected.hlsl | 68 + .../0-opt.spvasm.expected.msl | 69 + .../0-opt.spvasm.expected.spvasm | 150 ++ .../0-opt.spvasm.expected.wgsl | 65 + .../0-opt.wgsl | 65 + .../0-opt.wgsl.expected.hlsl | 68 + .../0-opt.wgsl.expected.msl | 69 + .../0-opt.wgsl.expected.spvasm | 150 ++ .../0-opt.wgsl.expected.wgsl | 65 + .../cov-mod-uint-bits-float/0-opt.spvasm | 70 + .../0-opt.spvasm.expected.hlsl | 37 + .../0-opt.spvasm.expected.msl | 52 + .../0-opt.spvasm.expected.spvasm | 103 + .../0-opt.spvasm.expected.wgsl | 38 + .../cov-mod-uint-bits-float/0-opt.wgsl | 38 + .../0-opt.wgsl.expected.hlsl | 37 + .../0-opt.wgsl.expected.msl | 52 + .../0-opt.wgsl.expected.spvasm | 103 + .../0-opt.wgsl.expected.wgsl | 38 + .../0-opt.spvasm | 127 ++ .../0-opt.spvasm.expected.hlsl | 63 + .../0-opt.spvasm.expected.msl | 79 + .../0-opt.spvasm.expected.spvasm | 166 ++ .../0-opt.spvasm.expected.wgsl | 71 + .../cov-modulo-zero-never-executed/0-opt.wgsl | 71 + .../0-opt.wgsl.expected.hlsl | 63 + .../0-opt.wgsl.expected.msl | 79 + .../0-opt.wgsl.expected.spvasm | 166 ++ .../0-opt.wgsl.expected.wgsl | 71 + .../0-opt.spvasm | 940 ++++++++ .../0-opt.spvasm.expected.hlsl | 324 +++ .../0-opt.spvasm.expected.msl | 624 ++++++ .../0-opt.spvasm.expected.spvasm | 1187 ++++++++++ .../0-opt.spvasm.expected.wgsl | 659 ++++++ .../0-opt.wgsl | 659 ++++++ .../0-opt.wgsl.expected.hlsl | 324 +++ .../0-opt.wgsl.expected.msl | 624 ++++++ .../0-opt.wgsl.expected.spvasm | 1187 ++++++++++ .../0-opt.wgsl.expected.wgsl | 659 ++++++ .../0-opt.spvasm | 246 +++ .../0-opt.spvasm.expected.hlsl | 146 ++ .../0-opt.spvasm.expected.msl | 134 ++ .../0-opt.spvasm.expected.spvasm | 329 +++ .../0-opt.spvasm.expected.wgsl | 133 ++ .../0-opt.wgsl | 133 ++ .../0-opt.wgsl.expected.hlsl | 146 ++ .../0-opt.wgsl.expected.msl | 134 ++ .../0-opt.wgsl.expected.spvasm | 329 +++ .../0-opt.wgsl.expected.wgsl | 133 ++ .../0-opt.spvasm | 183 ++ .../0-opt.spvasm.expected.hlsl | 92 + .../0-opt.spvasm.expected.msl | 107 + .../0-opt.spvasm.expected.spvasm | 227 ++ .../0-opt.spvasm.expected.wgsl | 101 + .../0-opt.wgsl | 101 + .../0-opt.wgsl.expected.hlsl | 92 + .../0-opt.wgsl.expected.msl | 107 + .../0-opt.wgsl.expected.spvasm | 227 ++ .../0-opt.wgsl.expected.wgsl | 101 + .../0-opt.spvasm | 496 +++++ .../0-opt.spvasm.expected.hlsl | 294 +++ .../0-opt.spvasm.expected.msl | 322 +++ .../0-opt.spvasm.expected.spvasm | 623 ++++++ .../0-opt.spvasm.expected.wgsl | 332 +++ .../0-opt.wgsl | 332 +++ .../0-opt.wgsl.expected.hlsl | 294 +++ .../0-opt.wgsl.expected.msl | 322 +++ .../0-opt.wgsl.expected.spvasm | 623 ++++++ .../0-opt.wgsl.expected.wgsl | 332 +++ .../cov-nir-array-access/0-opt.spvasm | 248 +++ .../0-opt.spvasm.expected.hlsl | 120 ++ .../0-opt.spvasm.expected.msl | 138 ++ .../0-opt.spvasm.expected.spvasm | 294 +++ .../0-opt.spvasm.expected.wgsl | 128 ++ .../cov-nir-array-access/0-opt.wgsl | 128 ++ .../0-opt.wgsl.expected.hlsl | 120 ++ .../0-opt.wgsl.expected.msl | 138 ++ .../0-opt.wgsl.expected.spvasm | 294 +++ .../0-opt.wgsl.expected.wgsl | 128 ++ .../0-opt.spvasm | 136 ++ .../0-opt.spvasm.expected.hlsl | 72 + .../0-opt.spvasm.expected.msl | 88 + .../0-opt.spvasm.expected.spvasm | 177 ++ .../0-opt.spvasm.expected.wgsl | 76 + .../0-opt.wgsl | 76 + .../0-opt.wgsl.expected.hlsl | 72 + .../0-opt.wgsl.expected.msl | 88 + .../0-opt.wgsl.expected.spvasm | 177 ++ .../0-opt.wgsl.expected.wgsl | 76 + .../0-opt.spvasm | 135 ++ .../0-opt.spvasm.expected.hlsl | 76 + .../0-opt.spvasm.expected.msl | 83 + .../0-opt.spvasm.expected.spvasm | 182 ++ .../0-opt.spvasm.expected.wgsl | 76 + .../0-opt.wgsl | 76 + .../0-opt.wgsl.expected.hlsl | 76 + .../0-opt.wgsl.expected.msl | 83 + .../0-opt.wgsl.expected.spvasm | 182 ++ .../0-opt.wgsl.expected.wgsl | 76 + .../cov-not-clamp-matrix-access/0-opt.spvasm | 144 ++ .../0-opt.spvasm.expected.hlsl | 66 + .../0-opt.spvasm.expected.msl | 84 + .../0-opt.spvasm.expected.spvasm | 184 ++ .../0-opt.spvasm.expected.wgsl | 77 + .../cov-not-clamp-matrix-access/0-opt.wgsl | 77 + .../0-opt.wgsl.expected.hlsl | 66 + .../0-opt.wgsl.expected.msl | 84 + .../0-opt.wgsl.expected.spvasm | 184 ++ .../0-opt.wgsl.expected.wgsl | 77 + .../0-opt.spvasm | 82 + .../0-opt.spvasm.expected.hlsl | 41 + .../0-opt.spvasm.expected.msl | 50 + .../0-opt.spvasm.expected.spvasm | 117 + .../0-opt.spvasm.expected.wgsl | 43 + .../0-opt.wgsl | 43 + .../0-opt.wgsl.expected.hlsl | 41 + .../0-opt.wgsl.expected.msl | 50 + .../0-opt.wgsl.expected.spvasm | 117 + .../0-opt.wgsl.expected.wgsl | 43 + .../0-opt.spvasm | 174 ++ .../0-opt.spvasm.expected.hlsl | 100 + .../0-opt.spvasm.expected.msl | 112 + .../0-opt.spvasm.expected.spvasm | 234 ++ .../0-opt.spvasm.expected.wgsl | 108 + .../0-opt.wgsl | 108 + .../0-opt.wgsl.expected.hlsl | 100 + .../0-opt.wgsl.expected.msl | 112 + .../0-opt.wgsl.expected.spvasm | 234 ++ .../0-opt.wgsl.expected.wgsl | 108 + .../cov-optimize-phis-for/0-opt.spvasm | 414 ++++ .../0-opt.spvasm.expected.hlsl | 212 ++ .../0-opt.spvasm.expected.msl | 229 ++ .../0-opt.spvasm.expected.spvasm | 441 ++++ .../0-opt.spvasm.expected.wgsl | 233 ++ .../cov-optimize-phis-for/0-opt.wgsl | 233 ++ .../0-opt.wgsl.expected.hlsl | 212 ++ .../0-opt.wgsl.expected.msl | 229 ++ .../0-opt.wgsl.expected.spvasm | 441 ++++ .../0-opt.wgsl.expected.wgsl | 233 ++ .../cov-packhalf-unpackunorm/0-opt.spvasm | 185 ++ .../0-opt.spvasm.expected.hlsl | 112 + .../0-opt.spvasm.expected.msl | 112 + .../0-opt.spvasm.expected.spvasm | 246 +++ .../0-opt.spvasm.expected.wgsl | 104 + .../cov-packhalf-unpackunorm/0-opt.wgsl | 104 + .../0-opt.wgsl.expected.hlsl | 112 + .../0-opt.wgsl.expected.msl | 112 + .../0-opt.wgsl.expected.spvasm | 246 +++ .../0-opt.wgsl.expected.wgsl | 104 + .../cov-pattern-match-signum/0-opt.spvasm | 73 + .../0-opt.spvasm.expected.hlsl | 40 + .../0-opt.spvasm.expected.msl | 43 + .../0-opt.spvasm.expected.spvasm | 107 + .../0-opt.spvasm.expected.wgsl | 41 + .../cov-pattern-match-signum/0-opt.wgsl | 41 + .../0-opt.wgsl.expected.hlsl | 40 + .../0-opt.wgsl.expected.msl | 43 + .../0-opt.wgsl.expected.spvasm | 107 + .../0-opt.wgsl.expected.wgsl | 41 + .../cov-pattern-match-single-bit/0.spvasm | 54 + .../0.spvasm.expected.hlsl | 28 + .../0.spvasm.expected.msl | 31 + .../0.spvasm.expected.spvasm | 86 + .../0.spvasm.expected.wgsl | 29 + .../cov-pattern-match-single-bit/0.wgsl | 29 + .../0.wgsl.expected.hlsl | 28 + .../0.wgsl.expected.msl | 31 + .../0.wgsl.expected.spvasm | 86 + .../0.wgsl.expected.wgsl | 29 + .../0-opt.spvasm | 152 ++ .../0-opt.spvasm.expected.hlsl | 83 + .../0-opt.spvasm.expected.msl | 91 + .../0-opt.spvasm.expected.spvasm | 194 ++ .../0-opt.spvasm.expected.wgsl | 85 + .../0-opt.wgsl | 85 + .../0-opt.wgsl.expected.hlsl | 83 + .../0-opt.wgsl.expected.msl | 91 + .../0-opt.wgsl.expected.spvasm | 194 ++ .../0-opt.wgsl.expected.wgsl | 85 + .../cov-pow-identical-value-sqrt/0-opt.spvasm | 127 ++ .../0-opt.spvasm.expected.hlsl | 59 + .../0-opt.spvasm.expected.msl | 75 + .../0-opt.spvasm.expected.spvasm | 163 ++ .../0-opt.spvasm.expected.wgsl | 71 + .../cov-pow-identical-value-sqrt/0-opt.wgsl | 71 + .../0-opt.wgsl.expected.hlsl | 59 + .../0-opt.wgsl.expected.msl | 75 + .../0-opt.wgsl.expected.spvasm | 163 ++ .../0-opt.wgsl.expected.wgsl | 71 + .../0-opt.spvasm | 113 + .../0-opt.spvasm.expected.hlsl | 59 + .../0-opt.spvasm.expected.msl | 72 + .../0-opt.spvasm.expected.spvasm | 159 ++ .../0-opt.spvasm.expected.wgsl | 68 + .../0-opt.wgsl | 68 + .../0-opt.wgsl.expected.hlsl | 59 + .../0-opt.wgsl.expected.msl | 72 + .../0-opt.wgsl.expected.spvasm | 159 ++ .../0-opt.wgsl.expected.wgsl | 68 + .../cov-pow-undefined/0-opt.spvasm | 82 + .../0-opt.spvasm.expected.hlsl | 47 + .../0-opt.spvasm.expected.msl | 54 + .../0-opt.spvasm.expected.spvasm | 121 ++ .../0-opt.spvasm.expected.wgsl | 47 + .../graphicsfuzz/cov-pow-undefined/0-opt.wgsl | 47 + .../0-opt.wgsl.expected.hlsl | 47 + .../cov-pow-undefined/0-opt.wgsl.expected.msl | 54 + .../0-opt.wgsl.expected.spvasm | 121 ++ .../0-opt.wgsl.expected.wgsl | 47 + .../cov-rcp-negative-int/0-opt.spvasm | 76 + .../0-opt.spvasm.expected.hlsl | 42 + .../0-opt.spvasm.expected.msl | 48 + .../0-opt.spvasm.expected.spvasm | 109 + .../0-opt.spvasm.expected.wgsl | 41 + .../cov-rcp-negative-int/0-opt.wgsl | 41 + .../0-opt.wgsl.expected.hlsl | 42 + .../0-opt.wgsl.expected.msl | 48 + .../0-opt.wgsl.expected.spvasm | 109 + .../0-opt.wgsl.expected.wgsl | 41 + .../cov-reciprocal-var-minus-one/0-opt.spvasm | 76 + .../0-opt.spvasm.expected.hlsl | 41 + .../0-opt.spvasm.expected.msl | 48 + .../0-opt.spvasm.expected.spvasm | 109 + .../0-opt.spvasm.expected.wgsl | 41 + .../cov-reciprocal-var-minus-one/0-opt.wgsl | 41 + .../0-opt.wgsl.expected.hlsl | 41 + .../0-opt.wgsl.expected.msl | 48 + .../0-opt.wgsl.expected.spvasm | 109 + .../0-opt.wgsl.expected.wgsl | 41 + .../0.spvasm | 86 + .../0.spvasm.expected.hlsl | 46 + .../0.spvasm.expected.msl | 49 + .../0.spvasm.expected.spvasm | 124 ++ .../0.spvasm.expected.wgsl | 44 + .../0.wgsl | 44 + .../0.wgsl.expected.hlsl | 46 + .../0.wgsl.expected.msl | 49 + .../0.wgsl.expected.spvasm | 124 ++ .../0.wgsl.expected.wgsl | 44 + .../0-opt.spvasm | 120 ++ .../0-opt.spvasm.expected.hlsl | 65 + .../0-opt.spvasm.expected.msl | 72 + .../0-opt.spvasm.expected.spvasm | 170 ++ .../0-opt.spvasm.expected.wgsl | 69 + .../0-opt.wgsl | 69 + .../0-opt.wgsl.expected.hlsl | 65 + .../0-opt.wgsl.expected.msl | 72 + .../0-opt.wgsl.expected.spvasm | 170 ++ .../0-opt.wgsl.expected.wgsl | 69 + .../0-opt.spvasm | 140 ++ .../0-opt.spvasm.expected.hlsl | 78 + .../0-opt.spvasm.expected.msl | 89 + .../0-opt.spvasm.expected.spvasm | 187 ++ .../0-opt.spvasm.expected.wgsl | 84 + .../0-opt.wgsl | 84 + .../0-opt.wgsl.expected.hlsl | 78 + .../0-opt.wgsl.expected.msl | 89 + .../0-opt.wgsl.expected.spvasm | 187 ++ .../0-opt.wgsl.expected.wgsl | 84 + .../0-opt.spvasm | 173 ++ .../0-opt.spvasm.expected.hlsl | 91 + .../0-opt.spvasm.expected.msl | 92 + .../0-opt.spvasm.expected.spvasm | 223 ++ .../0-opt.spvasm.expected.wgsl | 87 + .../0-opt.wgsl | 87 + .../0-opt.wgsl.expected.hlsl | 91 + .../0-opt.wgsl.expected.msl | 92 + .../0-opt.wgsl.expected.spvasm | 223 ++ .../0-opt.wgsl.expected.wgsl | 87 + .../cov-replace-copy-object/0-opt.spvasm | 177 ++ .../0-opt.spvasm.expected.hlsl | 81 + .../0-opt.spvasm.expected.msl | 92 + .../0-opt.spvasm.expected.spvasm | 196 ++ .../0-opt.spvasm.expected.wgsl | 89 + .../cov-replace-copy-object/0-opt.wgsl | 89 + .../0-opt.wgsl.expected.hlsl | 81 + .../0-opt.wgsl.expected.msl | 92 + .../0-opt.wgsl.expected.spvasm | 196 ++ .../0-opt.wgsl.expected.wgsl | 89 + .../cov-return-after-do-while/0-opt.spvasm | 81 + .../0-opt.spvasm.expected.hlsl | 50 + .../0-opt.spvasm.expected.msl | 55 + .../0-opt.spvasm.expected.spvasm | 125 ++ .../0-opt.spvasm.expected.wgsl | 49 + .../cov-return-after-do-while/0-opt.wgsl | 49 + .../0-opt.wgsl.expected.hlsl | 50 + .../0-opt.wgsl.expected.msl | 55 + .../0-opt.wgsl.expected.spvasm | 125 ++ .../0-opt.wgsl.expected.wgsl | 49 + .../0-opt.spvasm | 124 ++ .../0-opt.spvasm.expected.hlsl | 63 + .../0-opt.spvasm.expected.msl | 75 + .../0-opt.spvasm.expected.spvasm | 168 ++ .../0-opt.spvasm.expected.wgsl | 73 + .../0-opt.wgsl | 73 + .../0-opt.wgsl.expected.hlsl | 63 + .../0-opt.wgsl.expected.msl | 75 + .../0-opt.wgsl.expected.spvasm | 168 ++ .../0-opt.wgsl.expected.wgsl | 73 + .../0-opt.spvasm | 120 ++ .../0-opt.spvasm.expected.hlsl | 58 + .../0-opt.spvasm.expected.msl | 75 + .../0-opt.spvasm.expected.spvasm | 157 ++ .../0-opt.spvasm.expected.wgsl | 63 + .../0-opt.wgsl | 63 + .../0-opt.wgsl.expected.hlsl | 58 + .../0-opt.wgsl.expected.msl | 75 + .../0-opt.wgsl.expected.spvasm | 157 ++ .../0-opt.wgsl.expected.wgsl | 63 + .../0-opt.spvasm | 431 ++++ .../0-opt.spvasm.expected.hlsl | 208 ++ .../0-opt.spvasm.expected.msl | 232 ++ .../0-opt.spvasm.expected.spvasm | 456 ++++ .../0-opt.spvasm.expected.wgsl | 231 ++ .../0-opt.wgsl | 231 ++ .../0-opt.wgsl.expected.hlsl | 208 ++ .../0-opt.wgsl.expected.msl | 232 ++ .../0-opt.wgsl.expected.spvasm | 456 ++++ .../0-opt.wgsl.expected.wgsl | 231 ++ .../0-opt.spvasm | 283 +++ .../0-opt.spvasm.expected.hlsl | 168 ++ .../0-opt.spvasm.expected.msl | 183 ++ .../0-opt.spvasm.expected.spvasm | 372 ++++ .../0-opt.spvasm.expected.wgsl | 191 ++ .../cov-scaled-number-nested-loops/0-opt.wgsl | 191 ++ .../0-opt.wgsl.expected.hlsl | 168 ++ .../0-opt.wgsl.expected.msl | 183 ++ .../0-opt.wgsl.expected.spvasm | 372 ++++ .../0-opt.wgsl.expected.wgsl | 191 ++ .../0-opt.spvasm | 93 + .../0-opt.spvasm.expected.hlsl | 52 + .../0-opt.spvasm.expected.msl | 63 + .../0-opt.spvasm.expected.spvasm | 137 ++ .../0-opt.spvasm.expected.wgsl | 56 + .../0-opt.wgsl | 56 + .../0-opt.wgsl.expected.hlsl | 52 + .../0-opt.wgsl.expected.msl | 63 + .../0-opt.wgsl.expected.spvasm | 137 ++ .../0-opt.wgsl.expected.wgsl | 56 + .../0-opt.spvasm | 61 + .../0-opt.spvasm.expected.hlsl | 33 + .../0-opt.spvasm.expected.msl | 43 + .../0-opt.spvasm.expected.spvasm | 93 + .../0-opt.spvasm.expected.wgsl | 36 + .../0-opt.wgsl | 36 + .../0-opt.wgsl.expected.hlsl | 33 + .../0-opt.wgsl.expected.msl | 43 + .../0-opt.wgsl.expected.spvasm | 93 + .../0-opt.wgsl.expected.wgsl | 36 + .../0-opt.spvasm | 103 + .../0-opt.spvasm.expected.hlsl | 54 + .../0-opt.spvasm.expected.msl | 66 + .../0-opt.spvasm.expected.spvasm | 142 ++ .../0-opt.spvasm.expected.wgsl | 60 + .../0-opt.wgsl | 60 + .../0-opt.wgsl.expected.hlsl | 54 + .../0-opt.wgsl.expected.msl | 66 + .../0-opt.wgsl.expected.spvasm | 142 ++ .../0-opt.wgsl.expected.wgsl | 60 + .../cov-selection-dag-lt-gt/0-opt.spvasm | 98 + .../0-opt.spvasm.expected.hlsl | 49 + .../0-opt.spvasm.expected.msl | 56 + .../0-opt.spvasm.expected.spvasm | 130 ++ .../0-opt.spvasm.expected.wgsl | 53 + .../cov-selection-dag-lt-gt/0-opt.wgsl | 53 + .../0-opt.wgsl.expected.hlsl | 49 + .../0-opt.wgsl.expected.msl | 56 + .../0-opt.wgsl.expected.spvasm | 130 ++ .../0-opt.wgsl.expected.wgsl | 53 + .../0-opt.spvasm | 60 + .../0-opt.spvasm.expected.hlsl | 38 + .../0-opt.spvasm.expected.msl | 42 + .../0-opt.spvasm.expected.spvasm | 101 + .../0-opt.spvasm.expected.wgsl | 40 + .../0-opt.wgsl | 40 + .../0-opt.wgsl.expected.hlsl | 38 + .../0-opt.wgsl.expected.msl | 42 + .../0-opt.wgsl.expected.spvasm | 101 + .../0-opt.wgsl.expected.wgsl | 40 + .../0.spvasm | 126 ++ .../0.spvasm.expected.hlsl | 109 + .../0.spvasm.expected.msl | 119 + .../0.spvasm.expected.spvasm | 240 +++ .../0.spvasm.expected.wgsl | 113 + .../0.wgsl | 113 + .../0.wgsl.expected.hlsl | 109 + .../0.wgsl.expected.msl | 119 + .../0.wgsl.expected.spvasm | 240 +++ .../0.wgsl.expected.wgsl | 113 + .../cov-set-vector-cos-fragcoord/0-opt.spvasm | 174 ++ .../0-opt.spvasm.expected.hlsl | 83 + .../0-opt.spvasm.expected.msl | 83 + .../0-opt.spvasm.expected.spvasm | 229 ++ .../0-opt.spvasm.expected.wgsl | 82 + .../cov-set-vector-cos-fragcoord/0-opt.wgsl | 82 + .../0-opt.wgsl.expected.hlsl | 83 + .../0-opt.wgsl.expected.msl | 83 + .../0-opt.wgsl.expected.spvasm | 229 ++ .../0-opt.wgsl.expected.wgsl | 82 + .../0-opt.spvasm | 180 ++ .../0-opt.spvasm.expected.hlsl | 81 + .../0-opt.spvasm.expected.msl | 91 + .../0-opt.spvasm.expected.spvasm | 196 ++ .../0-opt.spvasm.expected.wgsl | 89 + .../0-opt.wgsl | 89 + .../0-opt.wgsl.expected.hlsl | 81 + .../0-opt.wgsl.expected.msl | 91 + .../0-opt.wgsl.expected.spvasm | 196 ++ .../0-opt.wgsl.expected.wgsl | 89 + .../0-opt.spvasm | 106 + .../0-opt.spvasm.expected.hlsl | 56 + .../0-opt.spvasm.expected.msl | 60 + .../0-opt.spvasm.expected.spvasm | 157 ++ .../0-opt.spvasm.expected.wgsl | 64 + .../0-opt.wgsl | 64 + .../0-opt.wgsl.expected.hlsl | 56 + .../0-opt.wgsl.expected.msl | 60 + .../0-opt.wgsl.expected.spvasm | 157 ++ .../0-opt.wgsl.expected.wgsl | 64 + .../0-opt.spvasm | 121 ++ .../0-opt.spvasm.expected.hlsl | 61 + .../0-opt.spvasm.expected.msl | 65 + .../0-opt.spvasm.expected.spvasm | 160 ++ .../0-opt.spvasm.expected.wgsl | 64 + .../cov-simplify-clamp-max-itself/0-opt.wgsl | 64 + .../0-opt.wgsl.expected.hlsl | 61 + .../0-opt.wgsl.expected.msl | 65 + .../0-opt.wgsl.expected.spvasm | 160 ++ .../0-opt.wgsl.expected.wgsl | 64 + .../0-opt.spvasm | 75 + .../0-opt.spvasm.expected.hlsl | 40 + .../0-opt.spvasm.expected.msl | 49 + .../0-opt.spvasm.expected.spvasm | 109 + .../0-opt.spvasm.expected.wgsl | 42 + .../0-opt.wgsl | 42 + .../0-opt.wgsl.expected.hlsl | 40 + .../0-opt.wgsl.expected.msl | 49 + .../0-opt.wgsl.expected.spvasm | 109 + .../0-opt.wgsl.expected.wgsl | 42 + .../0-opt.spvasm | 89 + .../0-opt.spvasm.expected.hlsl | 45 + .../0-opt.spvasm.expected.msl | 51 + .../0-opt.spvasm.expected.spvasm | 128 ++ .../0-opt.spvasm.expected.wgsl | 50 + .../0-opt.wgsl | 50 + .../0-opt.wgsl.expected.hlsl | 45 + .../0-opt.wgsl.expected.msl | 51 + .../0-opt.wgsl.expected.spvasm | 128 ++ .../0-opt.wgsl.expected.wgsl | 50 + .../cov-simplify-div-by-uint-one/0-opt.spvasm | 58 + .../0-opt.spvasm.expected.hlsl | 30 + .../0-opt.spvasm.expected.msl | 34 + .../0-opt.spvasm.expected.spvasm | 89 + .../0-opt.spvasm.expected.wgsl | 32 + .../cov-simplify-div-by-uint-one/0-opt.wgsl | 32 + .../0-opt.wgsl.expected.hlsl | 30 + .../0-opt.wgsl.expected.msl | 34 + .../0-opt.wgsl.expected.spvasm | 89 + .../0-opt.wgsl.expected.wgsl | 32 + .../0-opt.spvasm | 106 + .../0-opt.spvasm.expected.hlsl | 62 + .../0-opt.spvasm.expected.msl | 67 + .../0-opt.spvasm.expected.spvasm | 144 ++ .../0-opt.spvasm.expected.wgsl | 61 + .../0-opt.wgsl | 61 + .../0-opt.wgsl.expected.hlsl | 62 + .../0-opt.wgsl.expected.msl | 67 + .../0-opt.wgsl.expected.spvasm | 144 ++ .../0-opt.wgsl.expected.wgsl | 61 + .../0-opt.spvasm | 56 + .../0-opt.spvasm.expected.hlsl | 30 + .../0-opt.spvasm.expected.msl | 34 + .../0-opt.spvasm.expected.spvasm | 91 + .../0-opt.spvasm.expected.wgsl | 32 + .../0-opt.wgsl | 32 + .../0-opt.wgsl.expected.hlsl | 30 + .../0-opt.wgsl.expected.msl | 34 + .../0-opt.wgsl.expected.spvasm | 91 + .../0-opt.wgsl.expected.wgsl | 32 + .../0-opt.spvasm | 162 ++ .../0-opt.spvasm.expected.hlsl | 98 + .../0-opt.spvasm.expected.msl | 107 + .../0-opt.spvasm.expected.spvasm | 229 ++ .../0-opt.spvasm.expected.wgsl | 98 + .../0-opt.wgsl | 98 + .../0-opt.wgsl.expected.hlsl | 98 + .../0-opt.wgsl.expected.msl | 107 + .../0-opt.wgsl.expected.spvasm | 229 ++ .../0-opt.wgsl.expected.wgsl | 98 + .../cov-simplify-modulo-1/0-opt.spvasm | 83 + .../0-opt.spvasm.expected.hlsl | 44 + .../0-opt.spvasm.expected.msl | 64 + .../0-opt.spvasm.expected.spvasm | 117 + .../0-opt.spvasm.expected.wgsl | 49 + .../cov-simplify-modulo-1/0-opt.wgsl | 49 + .../0-opt.wgsl.expected.hlsl | 44 + .../0-opt.wgsl.expected.msl | 64 + .../0-opt.wgsl.expected.spvasm | 117 + .../0-opt.wgsl.expected.wgsl | 49 + .../cov-simplify-mul-identity/0-opt.spvasm | 72 + .../0-opt.spvasm.expected.hlsl | 32 + .../0-opt.spvasm.expected.msl | 38 + .../0-opt.spvasm.expected.spvasm | 104 + .../0-opt.spvasm.expected.wgsl | 36 + .../cov-simplify-mul-identity/0-opt.wgsl | 36 + .../0-opt.wgsl.expected.hlsl | 32 + .../0-opt.wgsl.expected.msl | 38 + .../0-opt.wgsl.expected.spvasm | 104 + .../0-opt.wgsl.expected.wgsl | 36 + .../cov-simplify-not-less-than-neg/0.spvasm | 68 + .../0.spvasm.expected.hlsl | 43 + .../0.spvasm.expected.msl | 43 + .../0.spvasm.expected.spvasm | 113 + .../0.spvasm.expected.wgsl | 42 + .../cov-simplify-not-less-than-neg/0.wgsl | 42 + .../0.wgsl.expected.hlsl | 43 + .../0.wgsl.expected.msl | 43 + .../0.wgsl.expected.spvasm | 113 + .../0.wgsl.expected.wgsl | 42 + .../0-opt.spvasm | 68 + .../0-opt.spvasm.expected.hlsl | 38 + .../0-opt.spvasm.expected.msl | 44 + .../0-opt.spvasm.expected.spvasm | 101 + .../0-opt.spvasm.expected.wgsl | 37 + .../0-opt.wgsl | 37 + .../0-opt.wgsl.expected.hlsl | 38 + .../0-opt.wgsl.expected.msl | 44 + .../0-opt.wgsl.expected.spvasm | 101 + .../0-opt.wgsl.expected.wgsl | 37 + .../cov-simplify-sign-cosh/0.spvasm | 63 + .../0.spvasm.expected.hlsl | 36 + .../0.spvasm.expected.msl | 40 + .../0.spvasm.expected.spvasm | 104 + .../0.spvasm.expected.wgsl | 38 + .../cov-simplify-sign-cosh/0.wgsl | 38 + .../0.wgsl.expected.hlsl | 36 + .../0.wgsl.expected.msl | 40 + .../0.wgsl.expected.spvasm | 104 + .../0.wgsl.expected.wgsl | 38 + .../0-opt.spvasm | 96 + .../0-opt.spvasm.expected.hlsl | 53 + .../0-opt.spvasm.expected.msl | 58 + .../0-opt.spvasm.expected.spvasm | 140 ++ .../0-opt.spvasm.expected.wgsl | 57 + .../cov-simplify-smoothstep-undef/0-opt.wgsl | 57 + .../0-opt.wgsl.expected.hlsl | 6 + .../0-opt.wgsl.expected.msl | 6 + .../0-opt.wgsl.expected.spvasm | 6 + .../0-opt.wgsl.expected.wgsl | 6 + .../0-opt.spvasm | 158 ++ .../0-opt.spvasm.expected.hlsl | 81 + .../0-opt.spvasm.expected.msl | 97 + .../0-opt.spvasm.expected.spvasm | 202 ++ .../0-opt.spvasm.expected.wgsl | 89 + .../0-opt.wgsl | 89 + .../0-opt.wgsl.expected.hlsl | 81 + .../0-opt.wgsl.expected.msl | 97 + .../0-opt.wgsl.expected.spvasm | 202 ++ .../0-opt.wgsl.expected.wgsl | 89 + .../0-opt.spvasm | 116 + .../0-opt.spvasm.expected.hlsl | 50 + .../0-opt.spvasm.expected.msl | 58 + .../0-opt.spvasm.expected.spvasm | 147 ++ .../0-opt.spvasm.expected.wgsl | 57 + .../0-opt.wgsl | 57 + .../0-opt.wgsl.expected.hlsl | 50 + .../0-opt.wgsl.expected.msl | 58 + .../0-opt.wgsl.expected.spvasm | 147 ++ .../0-opt.wgsl.expected.wgsl | 57 + .../graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm | 129 ++ .../cov-sinh-ldexp/0-opt.spvasm.expected.hlsl | 63 + .../cov-sinh-ldexp/0-opt.spvasm.expected.msl | 79 + .../0-opt.spvasm.expected.spvasm | 174 ++ .../cov-sinh-ldexp/0-opt.spvasm.expected.wgsl | 71 + .../graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl | 71 + .../cov-sinh-ldexp/0-opt.wgsl.expected.hlsl | 63 + .../cov-sinh-ldexp/0-opt.wgsl.expected.msl | 79 + .../cov-sinh-ldexp/0-opt.wgsl.expected.spvasm | 174 ++ .../cov-sinh-ldexp/0-opt.wgsl.expected.wgsl | 71 + .../0-opt.spvasm | 92 + .../0-opt.spvasm.expected.hlsl | 60 + .../0-opt.spvasm.expected.msl | 65 + .../0-opt.spvasm.expected.spvasm | 132 ++ .../0-opt.spvasm.expected.wgsl | 63 + .../0-opt.wgsl | 63 + .../0-opt.wgsl.expected.hlsl | 60 + .../0-opt.wgsl.expected.msl | 65 + .../0-opt.wgsl.expected.spvasm | 132 ++ .../0-opt.wgsl.expected.wgsl | 63 + .../graphicsfuzz/cov-step-sinh/0-opt.spvasm | 49 + .../cov-step-sinh/0-opt.spvasm.expected.hlsl | 28 + .../cov-step-sinh/0-opt.spvasm.expected.msl | 32 + .../0-opt.spvasm.expected.spvasm | 81 + .../cov-step-sinh/0-opt.spvasm.expected.wgsl | 26 + .../graphicsfuzz/cov-step-sinh/0-opt.wgsl | 26 + .../cov-step-sinh/0-opt.wgsl.expected.hlsl | 28 + .../cov-step-sinh/0-opt.wgsl.expected.msl | 32 + .../cov-step-sinh/0-opt.wgsl.expected.spvasm | 81 + .../cov-step-sinh/0-opt.wgsl.expected.wgsl | 26 + .../0-opt.spvasm | 173 ++ .../0-opt.spvasm.expected.hlsl | 84 + .../0-opt.spvasm.expected.msl | 122 ++ .../0-opt.spvasm.expected.spvasm | 214 ++ .../0-opt.spvasm.expected.wgsl | 93 + .../0-opt.wgsl | 93 + .../0-opt.wgsl.expected.hlsl | 84 + .../0-opt.wgsl.expected.msl | 122 ++ .../0-opt.wgsl.expected.spvasm | 214 ++ .../0-opt.wgsl.expected.wgsl | 93 + .../0-opt.spvasm | 115 + .../0-opt.spvasm.expected.hlsl | 51 + .../0-opt.spvasm.expected.msl | 65 + .../0-opt.spvasm.expected.spvasm | 150 ++ .../0-opt.spvasm.expected.wgsl | 61 + .../0-opt.wgsl | 61 + .../0-opt.wgsl.expected.hlsl | 51 + .../0-opt.wgsl.expected.msl | 65 + .../0-opt.wgsl.expected.spvasm | 150 ++ .../0-opt.wgsl.expected.wgsl | 61 + .../0-opt.spvasm | 152 ++ .../0-opt.spvasm.expected.hlsl | 86 + .../0-opt.spvasm.expected.msl | 112 + .../0-opt.spvasm.expected.spvasm | 203 ++ .../0-opt.spvasm.expected.wgsl | 104 + .../0-opt.wgsl | 104 + .../0-opt.wgsl.expected.hlsl | 86 + .../0-opt.wgsl.expected.msl | 112 + .../0-opt.wgsl.expected.spvasm | 203 ++ .../0-opt.wgsl.expected.wgsl | 104 + .../0-opt.spvasm | 157 ++ .../0-opt.spvasm.expected.hlsl | 95 + .../0-opt.spvasm.expected.msl | 99 + .../0-opt.spvasm.expected.spvasm | 214 ++ .../0-opt.spvasm.expected.wgsl | 98 + .../0-opt.wgsl | 98 + .../0-opt.wgsl.expected.hlsl | 95 + .../0-opt.wgsl.expected.msl | 99 + .../0-opt.wgsl.expected.spvasm | 214 ++ .../0-opt.wgsl.expected.wgsl | 98 + .../cov-target-lowering-dfdx-cos/0-opt.spvasm | 76 + .../0-opt.spvasm.expected.hlsl | 43 + .../0-opt.spvasm.expected.msl | 41 + .../0-opt.spvasm.expected.spvasm | 116 + .../0-opt.spvasm.expected.wgsl | 40 + .../cov-target-lowering-dfdx-cos/0-opt.wgsl | 40 + .../0-opt.wgsl.expected.hlsl | 43 + .../0-opt.wgsl.expected.msl | 41 + .../0-opt.wgsl.expected.spvasm | 116 + .../0-opt.wgsl.expected.wgsl | 40 + .../0-opt.spvasm | 274 +++ .../0-opt.spvasm.expected.hlsl | 153 ++ .../0-opt.spvasm.expected.msl | 168 ++ .../0-opt.spvasm.expected.spvasm | 350 +++ .../0-opt.spvasm.expected.wgsl | 166 ++ .../0-opt.wgsl | 166 ++ .../0-opt.wgsl.expected.hlsl | 153 ++ .../0-opt.wgsl.expected.msl | 168 ++ .../0-opt.wgsl.expected.spvasm | 350 +++ .../0-opt.wgsl.expected.wgsl | 166 ++ .../cov-transpose-multiply/0-opt.spvasm | 64 + .../0-opt.spvasm.expected.hlsl | 32 + .../0-opt.spvasm.expected.msl | 35 + .../0-opt.spvasm.expected.spvasm | 103 + .../0-opt.spvasm.expected.wgsl | 29 + .../cov-transpose-multiply/0-opt.wgsl | 29 + .../0-opt.wgsl.expected.hlsl | 32 + .../0-opt.wgsl.expected.msl | 35 + .../0-opt.wgsl.expected.spvasm | 103 + .../0-opt.wgsl.expected.wgsl | 29 + .../cov-trunc-fract-always-zero/0-opt.spvasm | 101 + .../0-opt.spvasm.expected.hlsl | 51 + .../0-opt.spvasm.expected.msl | 61 + .../0-opt.spvasm.expected.spvasm | 140 ++ .../0-opt.spvasm.expected.wgsl | 54 + .../cov-trunc-fract-always-zero/0-opt.wgsl | 54 + .../0-opt.wgsl.expected.hlsl | 51 + .../0-opt.wgsl.expected.msl | 61 + .../0-opt.wgsl.expected.spvasm | 140 ++ .../0-opt.wgsl.expected.wgsl | 54 + .../0-opt.spvasm | 56 + .../0-opt.spvasm.expected.hlsl | 34 + .../0-opt.spvasm.expected.msl | 37 + .../0-opt.spvasm.expected.spvasm | 90 + .../0-opt.spvasm.expected.wgsl | 35 + .../0-opt.wgsl | 35 + .../0-opt.wgsl.expected.hlsl | 34 + .../0-opt.wgsl.expected.msl | 37 + .../0-opt.wgsl.expected.spvasm | 90 + .../0-opt.wgsl.expected.wgsl | 35 + .../0-opt.spvasm | 114 + .../0-opt.spvasm.expected.hlsl | 55 + .../0-opt.spvasm.expected.msl | 62 + .../0-opt.spvasm.expected.spvasm | 155 ++ .../0-opt.spvasm.expected.wgsl | 59 + .../0-opt.wgsl | 59 + .../0-opt.wgsl.expected.hlsl | 6 + .../0-opt.wgsl.expected.msl | 6 + .../0-opt.wgsl.expected.spvasm | 6 + .../0-opt.wgsl.expected.wgsl | 6 + .../0-opt.spvasm | 171 ++ .../0-opt.spvasm.expected.hlsl | 89 + .../0-opt.spvasm.expected.msl | 105 + .../0-opt.spvasm.expected.spvasm | 213 ++ .../0-opt.spvasm.expected.wgsl | 97 + .../0-opt.wgsl | 97 + .../0-opt.wgsl.expected.hlsl | 89 + .../0-opt.wgsl.expected.msl | 105 + .../0-opt.wgsl.expected.spvasm | 213 ++ .../0-opt.wgsl.expected.wgsl | 97 + .../0-opt.spvasm | 126 ++ .../0-opt.spvasm.expected.hlsl | 65 + .../0-opt.spvasm.expected.msl | 74 + .../0-opt.spvasm.expected.spvasm | 161 ++ .../0-opt.spvasm.expected.wgsl | 65 + .../0-opt.wgsl | 65 + .../0-opt.wgsl.expected.hlsl | 65 + .../0-opt.wgsl.expected.msl | 74 + .../0-opt.wgsl.expected.spvasm | 161 ++ .../0-opt.wgsl.expected.wgsl | 65 + .../0-opt.spvasm | 185 ++ .../0-opt.spvasm.expected.hlsl | 109 + .../0-opt.spvasm.expected.msl | 105 + .../0-opt.spvasm.expected.spvasm | 228 ++ .../0-opt.spvasm.expected.wgsl | 97 + .../0-opt.wgsl | 97 + .../0-opt.wgsl.expected.hlsl | 109 + .../0-opt.wgsl.expected.msl | 105 + .../0-opt.wgsl.expected.spvasm | 228 ++ .../0-opt.wgsl.expected.wgsl | 97 + .../0-opt.spvasm | 218 ++ .../0-opt.spvasm.expected.hlsl | 103 + .../0-opt.spvasm.expected.msl | 103 + .../0-opt.spvasm.expected.spvasm | 274 +++ .../0-opt.spvasm.expected.wgsl | 96 + .../0-opt.wgsl | 96 + .../0-opt.wgsl.expected.hlsl | 103 + .../0-opt.wgsl.expected.msl | 103 + .../0-opt.wgsl.expected.spvasm | 274 +++ .../0-opt.wgsl.expected.wgsl | 96 + .../cov-val-cfg-case-fallthrough/0-opt.spvasm | 67 + .../0-opt.spvasm.expected.hlsl | 44 + .../0-opt.spvasm.expected.msl | 48 + .../0-opt.spvasm.expected.spvasm | 101 + .../0-opt.spvasm.expected.wgsl | 43 + .../cov-val-cfg-case-fallthrough/0-opt.wgsl | 43 + .../0-opt.wgsl.expected.hlsl | 44 + .../0-opt.wgsl.expected.msl | 48 + .../0-opt.wgsl.expected.spvasm | 101 + .../0-opt.wgsl.expected.wgsl | 43 + .../0-opt.spvasm | 115 + .../0-opt.spvasm.expected.hlsl | 58 + .../0-opt.spvasm.expected.msl | 72 + .../0-opt.spvasm.expected.spvasm | 156 ++ .../0-opt.spvasm.expected.wgsl | 63 + .../0-opt.wgsl | 63 + .../0-opt.wgsl.expected.hlsl | 58 + .../0-opt.wgsl.expected.msl | 72 + .../0-opt.wgsl.expected.spvasm | 156 ++ .../0-opt.wgsl.expected.wgsl | 63 + .../0-opt.spvasm | 112 + .../0-opt.spvasm.expected.hlsl | 62 + .../0-opt.spvasm.expected.msl | 74 + .../0-opt.spvasm.expected.spvasm | 150 ++ .../0-opt.spvasm.expected.wgsl | 64 + .../0-opt.wgsl | 64 + .../0-opt.wgsl.expected.hlsl | 62 + .../0-opt.wgsl.expected.msl | 74 + .../0-opt.wgsl.expected.spvasm | 150 ++ .../0-opt.wgsl.expected.wgsl | 64 + .../0-opt.spvasm | 77 + .../0-opt.spvasm.expected.hlsl | 36 + .../0-opt.spvasm.expected.msl | 48 + .../0-opt.spvasm.expected.spvasm | 114 + .../0-opt.spvasm.expected.wgsl | 47 + .../0-opt.wgsl | 47 + .../0-opt.wgsl.expected.hlsl | 36 + .../0-opt.wgsl.expected.msl | 48 + .../0-opt.wgsl.expected.spvasm | 114 + .../0-opt.wgsl.expected.wgsl | 47 + .../0-opt.spvasm | 117 + .../0-opt.spvasm.expected.hlsl | 61 + .../0-opt.spvasm.expected.msl | 73 + .../0-opt.spvasm.expected.spvasm | 155 ++ .../0-opt.spvasm.expected.wgsl | 67 + .../0-opt.wgsl | 67 + .../0-opt.wgsl.expected.hlsl | 61 + .../0-opt.wgsl.expected.msl | 73 + .../0-opt.wgsl.expected.spvasm | 155 ++ .../0-opt.wgsl.expected.wgsl | 67 + .../0-opt.spvasm | 104 + .../0-opt.spvasm.expected.hlsl | 48 + .../0-opt.spvasm.expected.msl | 68 + .../0-opt.spvasm.expected.spvasm | 140 ++ .../0-opt.spvasm.expected.wgsl | 59 + .../0-opt.wgsl | 59 + .../0-opt.wgsl.expected.hlsl | 48 + .../0-opt.wgsl.expected.msl | 68 + .../0-opt.wgsl.expected.spvasm | 140 ++ .../0-opt.wgsl.expected.wgsl | 59 + .../0-opt.spvasm | 305 +++ .../0-opt.spvasm.expected.hlsl | 150 ++ .../0-opt.spvasm.expected.msl | 167 ++ .../0-opt.spvasm.expected.spvasm | 361 ++++ .../0-opt.spvasm.expected.wgsl | 161 ++ .../0-opt.wgsl | 161 ++ .../0-opt.wgsl.expected.hlsl | 150 ++ .../0-opt.wgsl.expected.msl | 167 ++ .../0-opt.wgsl.expected.spvasm | 361 ++++ .../0-opt.wgsl.expected.wgsl | 161 ++ .../0-opt.spvasm | 86 + .../0-opt.spvasm.expected.hlsl | 36 + .../0-opt.spvasm.expected.msl | 43 + .../0-opt.spvasm.expected.spvasm | 118 + .../0-opt.spvasm.expected.wgsl | 41 + .../0-opt.wgsl | 41 + .../0-opt.wgsl.expected.hlsl | 36 + .../0-opt.wgsl.expected.msl | 43 + .../0-opt.wgsl.expected.spvasm | 118 + .../0-opt.wgsl.expected.wgsl | 41 + .../0-opt.spvasm | 86 + .../0-opt.spvasm.expected.hlsl | 37 + .../0-opt.spvasm.expected.msl | 41 + .../0-opt.spvasm.expected.spvasm | 117 + .../0-opt.spvasm.expected.wgsl | 39 + .../cov-vector-dce-inc-unused-comp/0-opt.wgsl | 39 + .../0-opt.wgsl.expected.hlsl | 37 + .../0-opt.wgsl.expected.msl | 41 + .../0-opt.wgsl.expected.spvasm | 117 + .../0-opt.wgsl.expected.wgsl | 39 + .../0-opt.spvasm | 56 + .../0-opt.spvasm.expected.hlsl | 31 + .../0-opt.spvasm.expected.msl | 35 + .../0-opt.spvasm.expected.spvasm | 88 + .../0-opt.spvasm.expected.wgsl | 29 + .../0-opt.wgsl | 29 + .../0-opt.wgsl.expected.hlsl | 31 + .../0-opt.wgsl.expected.msl | 35 + .../0-opt.wgsl.expected.spvasm | 88 + .../0-opt.wgsl.expected.wgsl | 29 + .../cov-vector-log2-cosh/0-opt.spvasm | 51 + .../0-opt.spvasm.expected.hlsl | 28 + .../0-opt.spvasm.expected.msl | 31 + .../0-opt.spvasm.expected.spvasm | 83 + .../0-opt.spvasm.expected.wgsl | 25 + .../cov-vector-log2-cosh/0-opt.wgsl | 25 + .../0-opt.wgsl.expected.hlsl | 28 + .../0-opt.wgsl.expected.msl | 31 + .../0-opt.wgsl.expected.spvasm | 83 + .../0-opt.wgsl.expected.wgsl | 25 + .../cov-wrap-op-kill-for-loop/0-opt.spvasm | 91 + .../0-opt.spvasm.expected.hlsl | 58 + .../0-opt.spvasm.expected.msl | 61 + .../0-opt.spvasm.expected.spvasm | 138 ++ .../0-opt.spvasm.expected.wgsl | 60 + .../cov-wrap-op-kill-for-loop/0-opt.wgsl | 60 + .../0-opt.wgsl.expected.hlsl | 58 + .../0-opt.wgsl.expected.msl | 61 + .../0-opt.wgsl.expected.spvasm | 138 ++ .../0-opt.wgsl.expected.wgsl | 60 + .../0-opt.spvasm | 123 ++ .../0-opt.spvasm.expected.hlsl | 69 + .../0-opt.spvasm.expected.msl | 71 + .../0-opt.spvasm.expected.spvasm | 169 ++ .../0-opt.spvasm.expected.wgsl | 71 + .../cov-wrap-op-kill-two-branches/0-opt.wgsl | 71 + .../0-opt.wgsl.expected.hlsl | 69 + .../0-opt.wgsl.expected.msl | 71 + .../0-opt.wgsl.expected.spvasm | 169 ++ .../0-opt.wgsl.expected.wgsl | 71 + .../0.spvasm | 112 + .../0.spvasm.expected.hlsl | 72 + .../0.spvasm.expected.msl | 79 + .../0.spvasm.expected.spvasm | 168 ++ .../0.spvasm.expected.wgsl | 68 + .../0.wgsl | 68 + .../0.wgsl.expected.hlsl | 72 + .../0.wgsl.expected.msl | 79 + .../0.wgsl.expected.spvasm | 168 ++ .../0.wgsl.expected.wgsl | 68 + .../0-opt.spvasm | 113 + .../0-opt.spvasm.expected.hlsl | 68 + .../0-opt.spvasm.expected.msl | 71 + .../0-opt.spvasm.expected.spvasm | 157 ++ .../0-opt.spvasm.expected.wgsl | 63 + .../0-opt.wgsl | 63 + .../0-opt.wgsl.expected.hlsl | 68 + .../0-opt.wgsl.expected.msl | 71 + .../0-opt.wgsl.expected.spvasm | 157 ++ .../0-opt.wgsl.expected.wgsl | 63 + .../0-opt.spvasm | 114 + .../0-opt.spvasm.expected.hlsl | 53 + .../0-opt.spvasm.expected.msl | 74 + .../0-opt.spvasm.expected.spvasm | 150 ++ .../0-opt.spvasm.expected.wgsl | 65 + .../0-opt.wgsl | 65 + .../0-opt.wgsl.expected.hlsl | 53 + .../0-opt.wgsl.expected.msl | 74 + .../0-opt.wgsl.expected.spvasm | 150 ++ .../0-opt.wgsl.expected.wgsl | 65 + .../0-opt.spvasm | 187 ++ .../0-opt.spvasm.expected.hlsl | 114 + .../0-opt.spvasm.expected.msl | 132 ++ .../0-opt.spvasm.expected.spvasm | 245 +++ .../0-opt.spvasm.expected.wgsl | 116 + .../0-opt.wgsl | 116 + .../0-opt.wgsl.expected.hlsl | 114 + .../0-opt.wgsl.expected.msl | 132 ++ .../0-opt.wgsl.expected.spvasm | 245 +++ .../0-opt.wgsl.expected.wgsl | 116 + .../0-opt.spvasm | 124 ++ .../0-opt.spvasm.expected.hlsl | 70 + .../0-opt.spvasm.expected.msl | 75 + .../0-opt.spvasm.expected.spvasm | 163 ++ .../0-opt.spvasm.expected.wgsl | 64 + .../0-opt.wgsl | 64 + .../0-opt.wgsl.expected.hlsl | 70 + .../0-opt.wgsl.expected.msl | 75 + .../0-opt.wgsl.expected.spvasm | 163 ++ .../0-opt.wgsl.expected.wgsl | 64 + .../0-opt.spvasm | 174 ++ .../0-opt.spvasm.expected.hlsl | 89 + .../0-opt.spvasm.expected.msl | 102 + .../0-opt.spvasm.expected.spvasm | 239 ++ .../0-opt.spvasm.expected.wgsl | 100 + .../0-opt.wgsl | 100 + .../0-opt.wgsl.expected.hlsl | 89 + .../0-opt.wgsl.expected.msl | 102 + .../0-opt.wgsl.expected.spvasm | 239 ++ .../0-opt.wgsl.expected.wgsl | 100 + .../dead-barriers-in-loops/0-opt.spvasm | 196 ++ .../0-opt.spvasm.expected.hlsl | 74 + .../0-opt.spvasm.expected.msl | 102 + .../0-opt.spvasm.expected.spvasm | 235 ++ .../0-opt.spvasm.expected.wgsl | 109 + .../dead-barriers-in-loops/0-opt.wgsl | 109 + .../0-opt.wgsl.expected.hlsl | 74 + .../0-opt.wgsl.expected.msl | 102 + .../0-opt.wgsl.expected.spvasm | 235 ++ .../0-opt.wgsl.expected.wgsl | 109 + .../disc-and-add-in-func-in-loop/0-opt.spvasm | 103 + .../0-opt.spvasm.expected.hlsl | 77 + .../0-opt.spvasm.expected.msl | 81 + .../0-opt.spvasm.expected.spvasm | 179 ++ .../0-opt.spvasm.expected.wgsl | 77 + .../disc-and-add-in-func-in-loop/0-opt.wgsl | 77 + .../0-opt.wgsl.expected.hlsl | 77 + .../0-opt.wgsl.expected.msl | 81 + .../0-opt.wgsl.expected.spvasm | 179 ++ .../0-opt.wgsl.expected.wgsl | 77 + .../discard-continue-return/0-opt.spvasm | 84 + .../0-opt.spvasm.expected.hlsl | 71 + .../0-opt.spvasm.expected.msl | 71 + .../0-opt.spvasm.expected.spvasm | 141 ++ .../0-opt.spvasm.expected.wgsl | 57 + .../discard-continue-return/0-opt.wgsl | 57 + .../0-opt.wgsl.expected.hlsl | 71 + .../0-opt.wgsl.expected.msl | 71 + .../0-opt.wgsl.expected.spvasm | 141 ++ .../0-opt.wgsl.expected.wgsl | 57 + .../0-opt.spvasm | 92 + .../0-opt.spvasm.expected.hlsl | 42 + .../0-opt.spvasm.expected.msl | 52 + .../0-opt.spvasm.expected.spvasm | 129 ++ .../0-opt.spvasm.expected.wgsl | 44 + .../0-opt.wgsl | 44 + .../0-opt.wgsl.expected.hlsl | 42 + .../0-opt.wgsl.expected.msl | 52 + .../0-opt.wgsl.expected.spvasm | 129 ++ .../0-opt.wgsl.expected.wgsl | 44 + .../discard-in-loop-in-function/0-opt.spvasm | 77 + .../0-opt.spvasm.expected.hlsl | 71 + .../0-opt.spvasm.expected.msl | 70 + .../0-opt.spvasm.expected.spvasm | 125 ++ .../0-opt.spvasm.expected.wgsl | 52 + .../discard-in-loop-in-function/0-opt.wgsl | 52 + .../0-opt.wgsl.expected.hlsl | 71 + .../0-opt.wgsl.expected.msl | 70 + .../0-opt.wgsl.expected.spvasm | 125 ++ .../0-opt.wgsl.expected.wgsl | 52 + .../graphicsfuzz/discard-in-loop/0-opt.spvasm | 82 + .../0-opt.spvasm.expected.hlsl | 74 + .../discard-in-loop/0-opt.spvasm.expected.msl | 74 + .../0-opt.spvasm.expected.spvasm | 147 ++ .../0-opt.spvasm.expected.wgsl | 62 + .../graphicsfuzz/discard-in-loop/0-opt.wgsl | 62 + .../discard-in-loop/0-opt.wgsl.expected.hlsl | 74 + .../discard-in-loop/0-opt.wgsl.expected.msl | 74 + .../0-opt.wgsl.expected.spvasm | 147 ++ .../discard-in-loop/0-opt.wgsl.expected.wgsl | 62 + .../discards-in-control-flow/0-opt.spvasm | 91 + .../0-opt.spvasm.expected.hlsl | 48 + .../0-opt.spvasm.expected.msl | 49 + .../0-opt.spvasm.expected.spvasm | 122 ++ .../0-opt.spvasm.expected.wgsl | 45 + .../discards-in-control-flow/0-opt.wgsl | 45 + .../0-opt.wgsl.expected.hlsl | 48 + .../0-opt.wgsl.expected.msl | 49 + .../0-opt.wgsl.expected.spvasm | 122 ++ .../0-opt.wgsl.expected.wgsl | 45 + .../do-while-false-loops/0-opt.spvasm | 113 + .../0-opt.spvasm.expected.hlsl | 45 + .../0-opt.spvasm.expected.msl | 59 + .../0-opt.spvasm.expected.spvasm | 137 ++ .../0-opt.spvasm.expected.wgsl | 54 + .../do-while-false-loops/0-opt.wgsl | 54 + .../0-opt.wgsl.expected.hlsl | 45 + .../0-opt.wgsl.expected.msl | 59 + .../0-opt.wgsl.expected.spvasm | 137 ++ .../0-opt.wgsl.expected.wgsl | 54 + .../do-while-if-return/0-opt.spvasm | 110 + .../0-opt.spvasm.expected.hlsl | 71 + .../0-opt.spvasm.expected.msl | 76 + .../0-opt.spvasm.expected.spvasm | 177 ++ .../0-opt.spvasm.expected.wgsl | 76 + .../do-while-if-return/0-opt.wgsl | 76 + .../0-opt.wgsl.expected.hlsl | 71 + .../0-opt.wgsl.expected.msl | 76 + .../0-opt.wgsl.expected.spvasm | 177 ++ .../0-opt.wgsl.expected.wgsl | 76 + .../0-opt.spvasm | 58 + .../0-opt.spvasm.expected.hlsl | 41 + .../0-opt.spvasm.expected.msl | 40 + .../0-opt.spvasm.expected.spvasm | 104 + .../0-opt.spvasm.expected.wgsl | 36 + .../do-while-loop-in-conditionals/0-opt.wgsl | 36 + .../0-opt.wgsl.expected.hlsl | 41 + .../0-opt.wgsl.expected.msl | 40 + .../0-opt.wgsl.expected.spvasm | 104 + .../0-opt.wgsl.expected.wgsl | 36 + .../early-return-and-barrier/0.spvasm | 78 + .../0.spvasm.expected.hlsl | 39 + .../0.spvasm.expected.msl | 44 + .../0.spvasm.expected.spvasm | 121 ++ .../0.spvasm.expected.wgsl | 44 + .../early-return-and-barrier/0.wgsl | 44 + .../0.wgsl.expected.hlsl | 39 + .../0.wgsl.expected.msl | 44 + .../0.wgsl.expected.spvasm | 121 ++ .../0.wgsl.expected.wgsl | 44 + .../flag-always-false-if/0-opt.spvasm | 139 ++ .../0-opt.spvasm.expected.hlsl | 71 + .../0-opt.spvasm.expected.msl | 85 + .../0-opt.spvasm.expected.spvasm | 191 ++ .../0-opt.spvasm.expected.wgsl | 86 + .../flag-always-false-if/0-opt.wgsl | 86 + .../0-opt.wgsl.expected.hlsl | 71 + .../0-opt.wgsl.expected.msl | 85 + .../0-opt.wgsl.expected.spvasm | 191 ++ .../0-opt.wgsl.expected.wgsl | 86 + .../for-condition-always-false/0-opt.spvasm | 62 + .../0-opt.spvasm.expected.hlsl | 47 + .../0-opt.spvasm.expected.msl | 47 + .../0-opt.spvasm.expected.spvasm | 105 + .../0-opt.spvasm.expected.wgsl | 42 + .../for-condition-always-false/0-opt.wgsl | 42 + .../0-opt.wgsl.expected.hlsl | 50 + .../0-opt.wgsl.expected.msl | 47 + .../0-opt.wgsl.expected.spvasm | 105 + .../0-opt.wgsl.expected.wgsl | 42 + .../for-loop-with-return/0.spvasm | 50 + .../0.spvasm.expected.hlsl | 31 + .../0.spvasm.expected.msl | 34 + .../0.spvasm.expected.spvasm | 81 + .../0.spvasm.expected.wgsl | 28 + .../graphicsfuzz/for-loop-with-return/0.wgsl | 28 + .../for-loop-with-return/0.wgsl.expected.hlsl | 31 + .../for-loop-with-return/0.wgsl.expected.msl | 34 + .../0.wgsl.expected.spvasm | 81 + .../for-loop-with-return/0.wgsl.expected.wgsl | 28 + .../for-with-ifs-and-return/0-opt.spvasm | 78 + .../0-opt.spvasm.expected.hlsl | 41 + .../0-opt.spvasm.expected.msl | 51 + .../0-opt.spvasm.expected.spvasm | 114 + .../0-opt.spvasm.expected.wgsl | 43 + .../for-with-ifs-and-return/0-opt.wgsl | 43 + .../0-opt.wgsl.expected.hlsl | 41 + .../0-opt.wgsl.expected.msl | 51 + .../0-opt.wgsl.expected.spvasm | 114 + .../0-opt.wgsl.expected.wgsl | 43 + .../frag-coord-func-call-and-ifs/0-opt.spvasm | 206 ++ .../0-opt.spvasm.expected.hlsl | 113 + .../0-opt.spvasm.expected.msl | 112 + .../0-opt.spvasm.expected.spvasm | 259 +++ .../0-opt.spvasm.expected.wgsl | 112 + .../frag-coord-func-call-and-ifs/0-opt.wgsl | 112 + .../0-opt.wgsl.expected.hlsl | 113 + .../0-opt.wgsl.expected.msl | 112 + .../0-opt.wgsl.expected.spvasm | 259 +++ .../0-opt.wgsl.expected.wgsl | 112 + .../function-with-uniform-return/0-opt.spvasm | 108 + .../0-opt.spvasm.expected.hlsl | 70 + .../0-opt.spvasm.expected.msl | 64 + .../0-opt.spvasm.expected.spvasm | 152 ++ .../0-opt.spvasm.expected.wgsl | 63 + .../function-with-uniform-return/0-opt.wgsl | 63 + .../0-opt.wgsl.expected.hlsl | 70 + .../0-opt.wgsl.expected.msl | 64 + .../0-opt.wgsl.expected.spvasm | 152 ++ .../0-opt.wgsl.expected.wgsl | 63 + .../global-array-loops/0-opt.spvasm | 257 +++ .../0-opt.spvasm.expected.hlsl | 201 ++ .../0-opt.spvasm.expected.msl | 213 ++ .../0-opt.spvasm.expected.spvasm | 406 ++++ .../0-opt.spvasm.expected.wgsl | 212 ++ .../global-array-loops/0-opt.wgsl | 212 ++ .../0-opt.wgsl.expected.hlsl | 201 ++ .../0-opt.wgsl.expected.msl | 213 ++ .../0-opt.wgsl.expected.spvasm | 406 ++++ .../0-opt.wgsl.expected.wgsl | 212 ++ .../graphicsfuzz/if-and-switch/0.spvasm | 74 + .../if-and-switch/0.spvasm.expected.hlsl | 48 + .../if-and-switch/0.spvasm.expected.msl | 55 + .../if-and-switch/0.spvasm.expected.spvasm | 120 ++ .../if-and-switch/0.spvasm.expected.wgsl | 49 + .../graphicsfuzz/if-and-switch/0.wgsl | 49 + .../if-and-switch/0.wgsl.expected.hlsl | 48 + .../if-and-switch/0.wgsl.expected.msl | 55 + .../if-and-switch/0.wgsl.expected.spvasm | 120 ++ .../if-and-switch/0.wgsl.expected.wgsl | 49 + .../0.spvasm | 275 +++ .../0.spvasm.expected.hlsl | 276 +++ .../0.spvasm.expected.msl | 277 +++ .../0.spvasm.expected.spvasm | 566 +++++ .../0.spvasm.expected.wgsl | 274 +++ .../increment-value-in-nested-for-loop/0.wgsl | 274 +++ .../0.wgsl.expected.hlsl | 276 +++ .../0.wgsl.expected.msl | 277 +++ .../0.wgsl.expected.spvasm | 566 +++++ .../0.wgsl.expected.wgsl | 274 +++ .../injection-switch-as-comparison/0.spvasm | 106 + .../0.spvasm.expected.hlsl | 108 + .../0.spvasm.expected.msl | 112 + .../0.spvasm.expected.spvasm | 243 +++ .../0.spvasm.expected.wgsl | 112 + .../injection-switch-as-comparison/0.wgsl | 112 + .../0.wgsl.expected.hlsl | 108 + .../0.wgsl.expected.msl | 112 + .../0.wgsl.expected.spvasm | 243 +++ .../0.wgsl.expected.wgsl | 112 + .../graphicsfuzz/int-mat2-struct/0-opt.spvasm | 96 + .../0-opt.spvasm.expected.hlsl | 50 + .../int-mat2-struct/0-opt.spvasm.expected.msl | 50 + .../0-opt.spvasm.expected.spvasm | 138 ++ .../0-opt.spvasm.expected.wgsl | 50 + .../graphicsfuzz/int-mat2-struct/0-opt.wgsl | 50 + .../int-mat2-struct/0-opt.wgsl.expected.hlsl | 50 + .../int-mat2-struct/0-opt.wgsl.expected.msl | 50 + .../0-opt.wgsl.expected.spvasm | 138 ++ .../int-mat2-struct/0-opt.wgsl.expected.wgsl | 50 + .../loop-dead-if-loop/0-opt.spvasm | 168 ++ .../0-opt.spvasm.expected.hlsl | 71 + .../0-opt.spvasm.expected.msl | 88 + .../0-opt.spvasm.expected.spvasm | 205 ++ .../0-opt.spvasm.expected.wgsl | 85 + .../graphicsfuzz/loop-dead-if-loop/0-opt.wgsl | 85 + .../0-opt.wgsl.expected.hlsl | 71 + .../loop-dead-if-loop/0-opt.wgsl.expected.msl | 88 + .../0-opt.wgsl.expected.spvasm | 205 ++ .../0-opt.wgsl.expected.wgsl | 85 + .../graphicsfuzz/loop-nested-ifs/0-opt.spvasm | 101 + .../0-opt.spvasm.expected.hlsl | 39 + .../loop-nested-ifs/0-opt.spvasm.expected.msl | 53 + .../0-opt.spvasm.expected.spvasm | 131 ++ .../0-opt.spvasm.expected.wgsl | 48 + .../graphicsfuzz/loop-nested-ifs/0-opt.wgsl | 48 + .../loop-nested-ifs/0-opt.wgsl.expected.hlsl | 39 + .../loop-nested-ifs/0-opt.wgsl.expected.msl | 53 + .../0-opt.wgsl.expected.spvasm | 131 ++ .../loop-nested-ifs/0-opt.wgsl.expected.wgsl | 48 + .../loops-ifs-continues-call/0.spvasm | 181 ++ .../0.spvasm.expected.hlsl | 76 + .../0.spvasm.expected.msl | 98 + .../0.spvasm.expected.spvasm | 220 ++ .../0.spvasm.expected.wgsl | 92 + .../loops-ifs-continues-call/0.wgsl | 92 + .../0.wgsl.expected.hlsl | 76 + .../0.wgsl.expected.msl | 98 + .../0.wgsl.expected.spvasm | 220 ++ .../0.wgsl.expected.wgsl | 92 + .../matrices-and-return-in-loop/0.spvasm | 72 + .../0.spvasm.expected.hlsl | 43 + .../0.spvasm.expected.msl | 42 + .../0.spvasm.expected.spvasm | 112 + .../0.spvasm.expected.wgsl | 37 + .../matrices-and-return-in-loop/0.wgsl | 37 + .../0.wgsl.expected.hlsl | 43 + .../0.wgsl.expected.msl | 42 + .../0.wgsl.expected.spvasm | 112 + .../0.wgsl.expected.wgsl | 37 + .../max-mix-conditional-discard/0-opt.spvasm | 87 + .../0-opt.spvasm.expected.hlsl | 35 + .../0-opt.spvasm.expected.msl | 41 + .../0-opt.spvasm.expected.spvasm | 111 + .../0-opt.spvasm.expected.wgsl | 40 + .../max-mix-conditional-discard/0-opt.wgsl | 40 + .../0-opt.wgsl.expected.hlsl | 35 + .../0-opt.wgsl.expected.msl | 41 + .../0-opt.wgsl.expected.spvasm | 111 + .../0-opt.wgsl.expected.wgsl | 40 + .../graphicsfuzz/mix-floor-add/0-opt.spvasm | 44 + .../mix-floor-add/0-opt.spvasm.expected.hlsl | 27 + .../mix-floor-add/0-opt.spvasm.expected.msl | 28 + .../0-opt.spvasm.expected.spvasm | 75 + .../mix-floor-add/0-opt.spvasm.expected.wgsl | 22 + .../graphicsfuzz/mix-floor-add/0-opt.wgsl | 22 + .../mix-floor-add/0-opt.wgsl.expected.hlsl | 27 + .../mix-floor-add/0-opt.wgsl.expected.msl | 28 + .../mix-floor-add/0-opt.wgsl.expected.spvasm | 75 + .../mix-floor-add/0-opt.wgsl.expected.wgsl | 22 + .../nested-for-break-mat-color/0.spvasm | 122 ++ .../0.spvasm.expected.hlsl | 79 + .../0.spvasm.expected.msl | 75 + .../0.spvasm.expected.spvasm | 202 ++ .../0.spvasm.expected.wgsl | 75 + .../nested-for-break-mat-color/0.wgsl | 75 + .../0.wgsl.expected.hlsl | 79 + .../0.wgsl.expected.msl | 75 + .../0.wgsl.expected.spvasm | 202 ++ .../0.wgsl.expected.wgsl | 75 + .../nested-for-loops-with-return/0-opt.spvasm | 86 + .../0-opt.spvasm.expected.hlsl | 49 + .../0-opt.spvasm.expected.msl | 48 + .../0-opt.spvasm.expected.spvasm | 120 ++ .../0-opt.spvasm.expected.wgsl | 43 + .../nested-for-loops-with-return/0-opt.wgsl | 43 + .../0-opt.wgsl.expected.hlsl | 49 + .../0-opt.wgsl.expected.msl | 48 + .../0-opt.wgsl.expected.spvasm | 120 ++ .../0-opt.wgsl.expected.wgsl | 43 + .../0-opt.spvasm | 83 + .../0-opt.spvasm.expected.hlsl | 37 + .../0-opt.spvasm.expected.msl | 47 + .../0-opt.spvasm.expected.spvasm | 117 + .../0-opt.spvasm.expected.wgsl | 46 + .../0-opt.wgsl | 46 + .../0-opt.wgsl.expected.hlsl | 37 + .../0-opt.wgsl.expected.msl | 47 + .../0-opt.wgsl.expected.spvasm | 117 + .../0-opt.wgsl.expected.wgsl | 46 + .../graphicsfuzz/nested-loops-switch/0.spvasm | 189 ++ .../0.spvasm.expected.hlsl | 85 + .../nested-loops-switch/0.spvasm.expected.msl | 124 ++ .../0.spvasm.expected.spvasm | 262 +++ .../0.spvasm.expected.wgsl | 121 ++ .../graphicsfuzz/nested-loops-switch/0.wgsl | 121 ++ .../nested-loops-switch/0.wgsl.expected.hlsl | 85 + .../nested-loops-switch/0.wgsl.expected.msl | 124 ++ .../0.wgsl.expected.spvasm | 262 +++ .../nested-loops-switch/0.wgsl.expected.wgsl | 121 ++ .../nested-switch-break-discard/0-opt.spvasm | 72 + .../0-opt.spvasm.expected.hlsl | 55 + .../0-opt.spvasm.expected.msl | 54 + .../0-opt.spvasm.expected.spvasm | 110 + .../0-opt.spvasm.expected.wgsl | 49 + .../nested-switch-break-discard/0-opt.wgsl | 49 + .../0-opt.wgsl.expected.hlsl | 55 + .../0-opt.wgsl.expected.msl | 54 + .../0-opt.wgsl.expected.spvasm | 110 + .../0-opt.wgsl.expected.wgsl | 49 + .../graphicsfuzz/one-sized-array/0-opt.spvasm | 87 + .../0-opt.spvasm.expected.hlsl | 47 + .../one-sized-array/0-opt.spvasm.expected.msl | 55 + .../0-opt.spvasm.expected.spvasm | 125 ++ .../0-opt.spvasm.expected.wgsl | 49 + .../graphicsfuzz/one-sized-array/0-opt.wgsl | 49 + .../one-sized-array/0-opt.wgsl.expected.hlsl | 47 + .../one-sized-array/0-opt.wgsl.expected.msl | 55 + .../0-opt.wgsl.expected.spvasm | 125 ++ .../one-sized-array/0-opt.wgsl.expected.wgsl | 49 + .../return-float-from-while-loop/0-opt.spvasm | 87 + .../0-opt.spvasm.expected.hlsl | 57 + .../0-opt.spvasm.expected.msl | 57 + .../0-opt.spvasm.expected.spvasm | 147 ++ .../0-opt.spvasm.expected.wgsl | 56 + .../return-float-from-while-loop/0-opt.wgsl | 56 + .../0-opt.wgsl.expected.hlsl | 57 + .../0-opt.wgsl.expected.msl | 57 + .../0-opt.wgsl.expected.spvasm | 147 ++ .../0-opt.wgsl.expected.wgsl | 56 + .../return-in-loop-in-function/0-opt.spvasm | 95 + .../0-opt.spvasm.expected.hlsl | 50 + .../0-opt.spvasm.expected.msl | 68 + .../0-opt.spvasm.expected.spvasm | 135 ++ .../0-opt.spvasm.expected.wgsl | 60 + .../return-in-loop-in-function/0-opt.wgsl | 60 + .../0-opt.wgsl.expected.hlsl | 50 + .../0-opt.wgsl.expected.msl | 68 + .../0-opt.wgsl.expected.spvasm | 135 ++ .../0-opt.wgsl.expected.wgsl | 60 + .../return-inside-loop-in-function/0.spvasm | 130 ++ .../0.spvasm.expected.hlsl | 129 ++ .../0.spvasm.expected.msl | 134 ++ .../0.spvasm.expected.spvasm | 245 +++ .../0.spvasm.expected.wgsl | 132 ++ .../return-inside-loop-in-function/0.wgsl | 132 ++ .../0.wgsl.expected.hlsl | 129 ++ .../0.wgsl.expected.msl | 134 ++ .../0.wgsl.expected.spvasm | 245 +++ .../0.wgsl.expected.wgsl | 132 ++ .../returned-boolean-in-vector/0-opt.spvasm | 124 ++ .../0-opt.spvasm.expected.hlsl | 113 + .../0-opt.spvasm.expected.msl | 112 + .../0-opt.spvasm.expected.spvasm | 238 ++ .../0-opt.spvasm.expected.wgsl | 113 + .../returned-boolean-in-vector/0-opt.wgsl | 113 + .../0-opt.wgsl.expected.hlsl | 113 + .../0-opt.wgsl.expected.msl | 112 + .../0-opt.wgsl.expected.spvasm | 238 ++ .../0-opt.wgsl.expected.wgsl | 113 + .../0.spvasm | 119 + .../0.spvasm.expected.hlsl | 101 + .../0.spvasm.expected.msl | 101 + .../0.spvasm.expected.spvasm | 252 +++ .../0.spvasm.expected.wgsl | 102 + .../0.wgsl | 102 + .../0.wgsl.expected.hlsl | 101 + .../0.wgsl.expected.msl | 101 + .../0.wgsl.expected.spvasm | 252 +++ .../0.wgsl.expected.wgsl | 102 + .../similar-nested-ifs/0-opt.spvasm | 152 ++ .../0-opt.spvasm.expected.hlsl | 71 + .../0-opt.spvasm.expected.msl | 78 + .../0-opt.spvasm.expected.spvasm | 203 ++ .../0-opt.spvasm.expected.wgsl | 79 + .../similar-nested-ifs/0-opt.wgsl | 79 + .../0-opt.wgsl.expected.hlsl | 71 + .../0-opt.wgsl.expected.msl | 78 + .../0-opt.wgsl.expected.spvasm | 203 ++ .../0-opt.wgsl.expected.wgsl | 79 + .../smoothstep-after-loop/0-opt.spvasm | 58 + .../0-opt.spvasm.expected.hlsl | 33 + .../0-opt.spvasm.expected.msl | 38 + .../0-opt.spvasm.expected.spvasm | 94 + .../0-opt.spvasm.expected.wgsl | 32 + .../smoothstep-after-loop/0-opt.wgsl | 32 + .../0-opt.wgsl.expected.hlsl | 33 + .../0-opt.wgsl.expected.msl | 38 + .../0-opt.wgsl.expected.spvasm | 94 + .../0-opt.wgsl.expected.wgsl | 32 + .../spv-access-chains/0-opt.spvasm | 609 ++++++ .../0-opt.spvasm.expected.hlsl | 292 +++ .../0-opt.spvasm.expected.msl | 347 +++ .../0-opt.spvasm.expected.spvasm | 775 +++++++ .../0-opt.spvasm.expected.wgsl | 348 +++ .../graphicsfuzz/spv-access-chains/0-opt.wgsl | 348 +++ .../0-opt.wgsl.expected.hlsl | 292 +++ .../spv-access-chains/0-opt.wgsl.expected.msl | 347 +++ .../0-opt.wgsl.expected.spvasm | 775 +++++++ .../0-opt.wgsl.expected.wgsl | 348 +++ .../graphicsfuzz/spv-composite-phi/0.spvasm | 223 ++ .../spv-composite-phi/0.spvasm.expected.hlsl | 202 ++ .../spv-composite-phi/0.spvasm.expected.msl | 208 ++ .../0.spvasm.expected.spvasm | 449 ++++ .../spv-composite-phi/0.spvasm.expected.wgsl | 200 ++ .../graphicsfuzz/spv-composite-phi/0.wgsl | 200 ++ .../spv-composite-phi/0.wgsl.expected.hlsl | 202 ++ .../spv-composite-phi/0.wgsl.expected.msl | 208 ++ .../spv-composite-phi/0.wgsl.expected.spvasm | 449 ++++ .../spv-composite-phi/0.wgsl.expected.wgsl | 200 ++ .../graphicsfuzz/spv-composite-phi/1.spvasm | 229 ++ .../spv-composite-phi/1.spvasm.expected.hlsl | 207 ++ .../spv-composite-phi/1.spvasm.expected.msl | 213 ++ .../1.spvasm.expected.spvasm | 462 ++++ .../spv-composite-phi/1.spvasm.expected.wgsl | 205 ++ .../graphicsfuzz/spv-composite-phi/1.wgsl | 205 ++ .../spv-composite-phi/1.wgsl.expected.hlsl | 207 ++ .../spv-composite-phi/1.wgsl.expected.msl | 213 ++ .../spv-composite-phi/1.wgsl.expected.spvasm | 462 ++++ .../spv-composite-phi/1.wgsl.expected.wgsl | 205 ++ .../graphicsfuzz/spv-composite2/0.spvasm | 104 + .../spv-composite2/0.spvasm.expected.hlsl | 58 + .../spv-composite2/0.spvasm.expected.msl | 60 + .../spv-composite2/0.spvasm.expected.spvasm | 180 ++ .../spv-composite2/0.spvasm.expected.wgsl | 56 + .../graphicsfuzz/spv-composite2/0.wgsl | 56 + .../spv-composite2/0.wgsl.expected.hlsl | 58 + .../spv-composite2/0.wgsl.expected.msl | 60 + .../spv-composite2/0.wgsl.expected.spvasm | 180 ++ .../spv-composite2/0.wgsl.expected.wgsl | 56 + .../graphicsfuzz/spv-composite2/1.spvasm | 110 + .../spv-composite2/1.spvasm.expected.hlsl | 59 + .../spv-composite2/1.spvasm.expected.msl | 61 + .../spv-composite2/1.spvasm.expected.spvasm | 189 ++ .../spv-composite2/1.spvasm.expected.wgsl | 57 + .../graphicsfuzz/spv-composite2/1.wgsl | 57 + .../spv-composite2/1.wgsl.expected.hlsl | 59 + .../spv-composite2/1.wgsl.expected.msl | 61 + .../spv-composite2/1.wgsl.expected.spvasm | 189 ++ .../spv-composite2/1.wgsl.expected.wgsl | 57 + .../graphicsfuzz/spv-composites/0.spvasm | 285 +++ .../spv-composites/0.spvasm.expected.hlsl | 97 + .../spv-composites/0.spvasm.expected.msl | 101 + .../spv-composites/0.spvasm.expected.spvasm | 384 ++++ .../spv-composites/0.spvasm.expected.wgsl | 94 + .../graphicsfuzz/spv-composites/0.wgsl | 94 + .../spv-composites/0.wgsl.expected.hlsl | 97 + .../spv-composites/0.wgsl.expected.msl | 101 + .../spv-composites/0.wgsl.expected.spvasm | 384 ++++ .../spv-composites/0.wgsl.expected.wgsl | 94 + .../graphicsfuzz/spv-composites/1.spvasm | 293 +++ .../spv-composites/1.spvasm.expected.hlsl | 10 + .../spv-composites/1.spvasm.expected.msl | 107 + .../spv-composites/1.spvasm.expected.spvasm | 401 ++++ .../spv-composites/1.spvasm.expected.wgsl | 99 + .../graphicsfuzz/spv-composites/1.wgsl | 99 + .../spv-composites/1.wgsl.expected.hlsl | 107 + .../spv-composites/1.wgsl.expected.msl | 107 + .../spv-composites/1.wgsl.expected.spvasm | 401 ++++ .../spv-composites/1.wgsl.expected.wgsl | 99 + .../spv-dead-break-and-unroll/1.spvasm | 620 ++++++ .../1.spvasm.expected.hlsl | 309 +++ .../1.spvasm.expected.msl | 359 +++ .../1.spvasm.expected.spvasm | 791 +++++++ .../1.spvasm.expected.wgsl | 357 +++ .../spv-dead-break-and-unroll/1.wgsl | 357 +++ .../1.wgsl.expected.hlsl | 309 +++ .../1.wgsl.expected.msl | 359 +++ .../1.wgsl.expected.spvasm | 791 +++++++ .../1.wgsl.expected.wgsl | 357 +++ .../spv-declare-bvec4/0-opt.spvasm | 255 +++ .../0-opt.spvasm.expected.hlsl | 106 + .../0-opt.spvasm.expected.msl | 122 ++ .../0-opt.spvasm.expected.spvasm | 306 +++ .../0-opt.spvasm.expected.wgsl | 113 + .../graphicsfuzz/spv-declare-bvec4/0-opt.wgsl | 113 + .../0-opt.wgsl.expected.hlsl | 106 + .../spv-declare-bvec4/0-opt.wgsl.expected.msl | 122 ++ .../0-opt.wgsl.expected.spvasm | 306 +++ .../0-opt.wgsl.expected.wgsl | 113 + .../graphicsfuzz/spv-declare-bvec4/1.spvasm | 259 +++ .../spv-declare-bvec4/1.spvasm.expected.hlsl | 107 + .../spv-declare-bvec4/1.spvasm.expected.msl | 123 ++ .../1.spvasm.expected.spvasm | 313 +++ .../spv-declare-bvec4/1.spvasm.expected.wgsl | 114 + .../graphicsfuzz/spv-declare-bvec4/1.wgsl | 114 + .../spv-declare-bvec4/1.wgsl.expected.hlsl | 107 + .../spv-declare-bvec4/1.wgsl.expected.msl | 123 ++ .../spv-declare-bvec4/1.wgsl.expected.spvasm | 313 +++ .../spv-declare-bvec4/1.wgsl.expected.wgsl | 114 + .../0-opt.spvasm | 565 +++++ .../0-opt.spvasm.expected.hlsl | 271 +++ .../0-opt.spvasm.expected.msl | 317 +++ .../0-opt.spvasm.expected.spvasm | 660 ++++++ .../0-opt.spvasm.expected.wgsl | 313 +++ .../0-opt.wgsl | 313 +++ .../0-opt.wgsl.expected.hlsl | 271 +++ .../0-opt.wgsl.expected.msl | 317 +++ .../0-opt.wgsl.expected.spvasm | 660 ++++++ .../0-opt.wgsl.expected.wgsl | 313 +++ .../spv-double-branch-to-same-block/1.spvasm | 566 +++++ .../1.spvasm.expected.hlsl | 281 +++ .../1.spvasm.expected.msl | 328 +++ .../1.spvasm.expected.spvasm | 668 ++++++ .../1.spvasm.expected.wgsl | 317 +++ .../spv-double-branch-to-same-block/1.wgsl | 317 +++ .../1.wgsl.expected.hlsl | 281 +++ .../1.wgsl.expected.msl | 328 +++ .../1.wgsl.expected.spvasm | 668 ++++++ .../1.wgsl.expected.wgsl | 317 +++ .../spv-double-branch-to-same-block2/0.spvasm | 177 ++ .../0.spvasm.expected.hlsl | 118 + .../0.spvasm.expected.msl | 121 ++ .../0.spvasm.expected.spvasm | 282 +++ .../0.spvasm.expected.wgsl | 120 ++ .../spv-double-branch-to-same-block2/0.wgsl | 120 ++ .../0.wgsl.expected.hlsl | 118 + .../0.wgsl.expected.msl | 121 ++ .../0.wgsl.expected.spvasm | 282 +++ .../0.wgsl.expected.wgsl | 120 ++ .../spv-double-branch-to-same-block2/1.spvasm | 178 ++ .../1.spvasm.expected.hlsl | 118 + .../1.spvasm.expected.msl | 121 ++ .../1.spvasm.expected.spvasm | 282 +++ .../1.spvasm.expected.wgsl | 120 ++ .../spv-double-branch-to-same-block2/1.wgsl | 120 ++ .../1.wgsl.expected.hlsl | 118 + .../1.wgsl.expected.msl | 121 ++ .../1.wgsl.expected.spvasm | 282 +++ .../1.wgsl.expected.wgsl | 120 ++ .../spv-double-branch-to-same-block3/1.spvasm | 570 +++++ .../1.spvasm.expected.hlsl | 275 +++ .../1.spvasm.expected.msl | 321 +++ .../1.spvasm.expected.spvasm | 670 ++++++ .../1.spvasm.expected.wgsl | 317 +++ .../spv-double-branch-to-same-block3/1.wgsl | 317 +++ .../1.wgsl.expected.hlsl | 275 +++ .../1.wgsl.expected.msl | 321 +++ .../1.wgsl.expected.spvasm | 670 ++++++ .../1.wgsl.expected.wgsl | 317 +++ .../spv-load-from-frag-color/1.spvasm | 695 ++++++ .../1.spvasm.expected.hlsl | 750 +++++++ .../1.spvasm.expected.msl | 764 +++++++ .../1.spvasm.expected.spvasm | 1174 ++++++++++ .../1.spvasm.expected.wgsl | 655 ++++++ .../spv-load-from-frag-color/1.wgsl | 655 ++++++ .../1.wgsl.expected.hlsl | 750 +++++++ .../1.wgsl.expected.msl | 764 +++++++ .../1.wgsl.expected.spvasm | 1174 ++++++++++ .../1.wgsl.expected.wgsl | 655 ++++++ .../spv-null-in-phi-and-unroll/1.spvasm | 183 ++ .../1.spvasm.expected.hlsl | 103 + .../1.spvasm.expected.msl | 108 + .../1.spvasm.expected.spvasm | 280 +++ .../1.spvasm.expected.wgsl | 97 + .../spv-null-in-phi-and-unroll/1.wgsl | 97 + .../1.wgsl.expected.hlsl | 103 + .../1.wgsl.expected.msl | 108 + .../1.wgsl.expected.spvasm | 280 +++ .../1.wgsl.expected.wgsl | 97 + .../1.spvasm | 111 + .../1.spvasm.expected.hlsl | 63 + .../1.spvasm.expected.msl | 65 + .../1.spvasm.expected.spvasm | 188 ++ .../1.spvasm.expected.wgsl | 60 + .../1.wgsl | 60 + .../1.wgsl.expected.hlsl | 63 + .../1.wgsl.expected.msl | 65 + .../1.wgsl.expected.spvasm | 188 ++ .../1.wgsl.expected.wgsl | 60 + .../2.spvasm | 108 + .../2.spvasm.expected.hlsl | 59 + .../2.spvasm.expected.msl | 61 + .../2.spvasm.expected.spvasm | 183 ++ .../2.spvasm.expected.wgsl | 57 + .../2.wgsl | 57 + .../2.wgsl.expected.hlsl | 59 + .../2.wgsl.expected.msl | 61 + .../2.wgsl.expected.spvasm | 183 ++ .../2.wgsl.expected.wgsl | 57 + .../0.spvasm | 248 +++ .../0.spvasm.expected.hlsl | 105 + .../0.spvasm.expected.msl | 141 ++ .../0.spvasm.expected.spvasm | 305 +++ .../0.spvasm.expected.wgsl | 140 ++ .../0.wgsl | 140 ++ .../0.wgsl.expected.hlsl | 105 + .../0.wgsl.expected.msl | 141 ++ .../0.wgsl.expected.spvasm | 305 +++ .../0.wgsl.expected.wgsl | 140 ++ .../1.spvasm | 305 +++ .../1.spvasm.expected.hlsl | 161 ++ .../1.spvasm.expected.msl | 198 ++ .../1.spvasm.expected.spvasm | 424 ++++ .../1.spvasm.expected.wgsl | 197 ++ .../1.wgsl | 197 ++ .../1.wgsl.expected.hlsl | 161 ++ .../1.wgsl.expected.msl | 198 ++ .../1.wgsl.expected.spvasm | 424 ++++ .../1.wgsl.expected.wgsl | 197 ++ .../0.spvasm | 114 + .../0.spvasm.expected.hlsl | 65 + .../0.spvasm.expected.msl | 67 + .../0.spvasm.expected.spvasm | 192 ++ .../0.spvasm.expected.wgsl | 63 + .../0.wgsl | 63 + .../0.wgsl.expected.hlsl | 65 + .../0.wgsl.expected.msl | 67 + .../0.wgsl.expected.spvasm | 192 ++ .../0.wgsl.expected.wgsl | 63 + .../1.spvasm | 125 ++ .../1.spvasm.expected.hlsl | 74 + .../1.spvasm.expected.msl | 76 + .../1.spvasm.expected.spvasm | 207 ++ .../1.spvasm.expected.wgsl | 70 + .../1.wgsl | 70 + .../1.wgsl.expected.hlsl | 74 + .../1.wgsl.expected.msl | 76 + .../1.wgsl.expected.spvasm | 207 ++ .../1.wgsl.expected.wgsl | 70 + .../1.spvasm | 223 ++ .../1.spvasm.expected.hlsl | 202 ++ .../1.spvasm.expected.msl | 208 ++ .../1.spvasm.expected.spvasm | 449 ++++ .../1.spvasm.expected.wgsl | 200 ++ .../1.wgsl | 200 ++ .../1.wgsl.expected.hlsl | 202 ++ .../1.wgsl.expected.msl | 208 ++ .../1.wgsl.expected.spvasm | 449 ++++ .../1.wgsl.expected.wgsl | 200 ++ .../1.spvasm | 662 ++++++ .../1.spvasm.expected.hlsl | 338 +++ .../1.spvasm.expected.msl | 394 ++++ .../1.spvasm.expected.spvasm | 860 ++++++++ .../1.spvasm.expected.wgsl | 392 ++++ .../1.wgsl | 392 ++++ .../1.wgsl.expected.hlsl | 338 +++ .../1.wgsl.expected.msl | 394 ++++ .../1.wgsl.expected.spvasm | 860 ++++++++ .../1.wgsl.expected.wgsl | 392 ++++ .../2.spvasm | 617 ++++++ .../2.spvasm.expected.hlsl | 300 +++ .../2.spvasm.expected.msl | 355 +++ .../2.spvasm.expected.spvasm | 782 +++++++ .../2.spvasm.expected.wgsl | 354 +++ .../2.wgsl | 354 +++ .../2.wgsl.expected.hlsl | 300 +++ .../2.wgsl.expected.msl | 355 +++ .../2.wgsl.expected.spvasm | 782 +++++++ .../2.wgsl.expected.wgsl | 354 +++ .../1.spvasm | 386 ++++ .../1.spvasm.expected.hlsl | 356 +++ .../1.spvasm.expected.msl | 350 +++ .../1.spvasm.expected.spvasm | 746 +++++++ .../1.spvasm.expected.wgsl | 341 +++ .../1.wgsl | 341 +++ .../1.wgsl.expected.hlsl | 356 +++ .../1.wgsl.expected.msl | 350 +++ .../1.wgsl.expected.spvasm | 746 +++++++ .../1.wgsl.expected.wgsl | 341 +++ .../2.spvasm | 383 ++++ .../2.spvasm.expected.hlsl | 352 +++ .../2.spvasm.expected.msl | 346 +++ .../2.spvasm.expected.spvasm | 742 +++++++ .../2.spvasm.expected.wgsl | 338 +++ .../2.wgsl | 338 +++ .../2.wgsl.expected.hlsl | 352 +++ .../2.wgsl.expected.msl | 346 +++ .../2.wgsl.expected.spvasm | 742 +++++++ .../2.wgsl.expected.wgsl | 338 +++ .../spv-stable-mergesort-dead-code/0.spvasm | 555 +++++ .../0.spvasm.expected.hlsl | 268 +++ .../0.spvasm.expected.msl | 314 +++ .../0.spvasm.expected.spvasm | 649 ++++++ .../0.spvasm.expected.wgsl | 306 +++ .../spv-stable-mergesort-dead-code/0.wgsl | 306 +++ .../0.wgsl.expected.hlsl | 268 +++ .../0.wgsl.expected.msl | 314 +++ .../0.wgsl.expected.spvasm | 649 ++++++ .../0.wgsl.expected.wgsl | 306 +++ .../spv-stable-mergesort-dead-code/1.spvasm | 571 +++++ .../1.spvasm.expected.hlsl | 288 +++ .../1.spvasm.expected.msl | 329 +++ .../1.spvasm.expected.spvasm | 690 ++++++ .../1.spvasm.expected.wgsl | 321 +++ .../spv-stable-mergesort-dead-code/1.wgsl | 321 +++ .../1.wgsl.expected.hlsl | 288 +++ .../1.wgsl.expected.msl | 329 +++ .../1.wgsl.expected.spvasm | 690 ++++++ .../1.wgsl.expected.wgsl | 321 +++ .../1.spvasm | 688 ++++++ .../1.spvasm.expected.hlsl | 373 ++++ .../1.spvasm.expected.msl | 422 ++++ .../1.spvasm.expected.spvasm | 864 ++++++++ .../1.spvasm.expected.wgsl | 414 ++++ .../1.wgsl | 414 ++++ .../1.wgsl.expected.hlsl | 373 ++++ .../1.wgsl.expected.msl | 422 ++++ .../1.wgsl.expected.spvasm | 864 ++++++++ .../1.wgsl.expected.wgsl | 414 ++++ .../2-opt.spvasm | 686 ++++++ .../2-opt.spvasm.expected.hlsl | 372 ++++ .../2-opt.spvasm.expected.msl | 421 ++++ .../2-opt.spvasm.expected.spvasm | 862 ++++++++ .../2-opt.spvasm.expected.wgsl | 413 ++++ .../2-opt.wgsl | 413 ++++ .../2-opt.wgsl.expected.hlsl | 372 ++++ .../2-opt.wgsl.expected.msl | 421 ++++ .../2-opt.wgsl.expected.spvasm | 862 ++++++++ .../2-opt.wgsl.expected.wgsl | 413 ++++ .../1.spvasm | 634 ++++++ .../1.spvasm.expected.hlsl | 302 +++ .../1.spvasm.expected.msl | 373 ++++ .../1.spvasm.expected.spvasm | 745 +++++++ .../1.spvasm.expected.wgsl | 366 ++++ .../1.wgsl | 366 ++++ .../1.wgsl.expected.hlsl | 302 +++ .../1.wgsl.expected.msl | 373 ++++ .../1.wgsl.expected.spvasm | 745 +++++++ .../1.wgsl.expected.wgsl | 366 ++++ .../2.spvasm | 631 ++++++ .../2.spvasm.expected.hlsl | 296 +++ .../2.spvasm.expected.msl | 369 ++++ .../2.spvasm.expected.spvasm | 741 +++++++ .../2.spvasm.expected.wgsl | 363 ++++ .../2.wgsl | 363 ++++ .../2.wgsl.expected.hlsl | 296 +++ .../2.wgsl.expected.msl | 369 ++++ .../2.wgsl.expected.spvasm | 741 +++++++ .../2.wgsl.expected.wgsl | 363 ++++ .../0.spvasm | 161 ++ .../0.spvasm.expected.hlsl | 104 + .../0.spvasm.expected.msl | 108 + .../0.spvasm.expected.spvasm | 292 +++ .../0.spvasm.expected.wgsl | 105 + .../spv-stable-orbit-O-mutate-variable/0.wgsl | 105 + .../0.wgsl.expected.hlsl | 104 + .../0.wgsl.expected.msl | 108 + .../0.wgsl.expected.spvasm | 292 +++ .../0.wgsl.expected.wgsl | 105 + .../1.spvasm | 167 ++ .../1.spvasm.expected.hlsl | 108 + .../1.spvasm.expected.msl | 112 + .../1.spvasm.expected.spvasm | 297 +++ .../1.spvasm.expected.wgsl | 108 + .../spv-stable-orbit-O-mutate-variable/1.wgsl | 108 + .../1.wgsl.expected.hlsl | 108 + .../1.wgsl.expected.msl | 112 + .../1.wgsl.expected.spvasm | 297 +++ .../1.wgsl.expected.wgsl | 108 + .../0.spvasm | 160 ++ .../0.spvasm.expected.hlsl | 105 + .../0.spvasm.expected.msl | 108 + .../0.spvasm.expected.spvasm | 292 +++ .../0.spvasm.expected.wgsl | 105 + .../0.wgsl | 105 + .../0.wgsl.expected.hlsl | 105 + .../0.wgsl.expected.msl | 108 + .../0.wgsl.expected.spvasm | 292 +++ .../0.wgsl.expected.wgsl | 105 + .../1.spvasm | 167 ++ .../1.spvasm.expected.hlsl | 109 + .../1.spvasm.expected.msl | 112 + .../1.spvasm.expected.spvasm | 297 +++ .../1.spvasm.expected.wgsl | 109 + .../1.wgsl | 109 + .../1.wgsl.expected.hlsl | 109 + .../1.wgsl.expected.msl | 112 + .../1.wgsl.expected.spvasm | 297 +++ .../1.wgsl.expected.wgsl | 109 + .../2.spvasm | 164 ++ .../2.spvasm.expected.hlsl | 105 + .../2.spvasm.expected.msl | 108 + .../2.spvasm.expected.spvasm | 292 +++ .../2.spvasm.expected.wgsl | 106 + .../2.wgsl | 106 + .../2.wgsl.expected.hlsl | 105 + .../2.wgsl.expected.msl | 108 + .../2.wgsl.expected.spvasm | 292 +++ .../2.wgsl.expected.wgsl | 106 + .../1.spvasm | 304 +++ .../1.spvasm.expected.hlsl | 108 + .../1.spvasm.expected.msl | 113 + .../1.spvasm.expected.spvasm | 408 ++++ .../1.spvasm.expected.wgsl | 106 + .../1.wgsl | 106 + .../1.wgsl.expected.hlsl | 108 + .../1.wgsl.expected.msl | 113 + .../1.wgsl.expected.spvasm | 408 ++++ .../1.wgsl.expected.wgsl | 106 + .../2.spvasm | 299 +++ .../2.spvasm.expected.hlsl | 102 + .../2.spvasm.expected.msl | 106 + .../2.spvasm.expected.spvasm | 397 ++++ .../2.spvasm.expected.wgsl | 99 + .../2.wgsl | 99 + .../2.wgsl.expected.hlsl | 102 + .../2.wgsl.expected.msl | 106 + .../2.wgsl.expected.spvasm | 397 ++++ .../2.wgsl.expected.wgsl | 99 + .../0.spvasm | 319 +++ .../0.spvasm.expected.hlsl | 84 + .../0.spvasm.expected.msl | 91 + .../0.spvasm.expected.spvasm | 378 ++++ .../0.spvasm.expected.wgsl | 85 + .../0.wgsl | 85 + .../0.wgsl.expected.hlsl | 84 + .../0.wgsl.expected.msl | 91 + .../0.wgsl.expected.spvasm | 378 ++++ .../0.wgsl.expected.wgsl | 85 + .../1.spvasm | 327 +++ .../1.spvasm.expected.hlsl | 91 + .../1.spvasm.expected.msl | 98 + .../1.spvasm.expected.spvasm | 388 ++++ .../1.spvasm.expected.wgsl | 92 + .../1.wgsl | 92 + .../1.wgsl.expected.hlsl | 91 + .../1.wgsl.expected.msl | 98 + .../1.wgsl.expected.spvasm | 388 ++++ .../1.wgsl.expected.wgsl | 92 + .../0-opt.spvasm | 481 +++++ .../0-opt.spvasm.expected.hlsl | 214 ++ .../0-opt.spvasm.expected.msl | 256 +++ .../0-opt.spvasm.expected.spvasm | 541 +++++ .../0-opt.spvasm.expected.wgsl | 256 +++ .../0-opt.wgsl | 256 +++ .../0-opt.wgsl.expected.hlsl | 214 ++ .../0-opt.wgsl.expected.msl | 256 +++ .../0-opt.wgsl.expected.spvasm | 541 +++++ .../0-opt.wgsl.expected.wgsl | 256 +++ .../1.spvasm | 486 +++++ .../1.spvasm.expected.hlsl | 214 ++ .../1.spvasm.expected.msl | 256 +++ .../1.spvasm.expected.spvasm | 547 +++++ .../1.spvasm.expected.wgsl | 256 +++ .../1.wgsl | 256 +++ .../1.wgsl.expected.hlsl | 214 ++ .../1.wgsl.expected.msl | 256 +++ .../1.wgsl.expected.spvasm | 547 +++++ .../1.wgsl.expected.wgsl | 256 +++ .../1.spvasm | 193 ++ .../1.spvasm.expected.hlsl | 110 + .../1.spvasm.expected.msl | 115 + .../1.spvasm.expected.spvasm | 290 +++ .../1.spvasm.expected.wgsl | 103 + .../1.wgsl | 103 + .../1.wgsl.expected.hlsl | 110 + .../1.wgsl.expected.msl | 115 + .../1.wgsl.expected.spvasm | 290 +++ .../1.wgsl.expected.wgsl | 103 + .../2.spvasm | 190 ++ .../2.spvasm.expected.hlsl | 106 + .../2.spvasm.expected.msl | 111 + .../2.spvasm.expected.spvasm | 287 +++ .../2.spvasm.expected.wgsl | 100 + .../2.wgsl | 100 + .../2.wgsl.expected.hlsl | 106 + .../2.wgsl.expected.msl | 111 + .../2.wgsl.expected.spvasm | 287 +++ .../2.wgsl.expected.wgsl | 100 + .../0.spvasm | 684 ++++++ .../0.spvasm.expected.hlsl | 748 +++++++ .../0.spvasm.expected.msl | 762 +++++++ .../0.spvasm.expected.spvasm | 1166 ++++++++++ .../0.spvasm.expected.wgsl | 653 ++++++ .../0.wgsl | 653 ++++++ .../0.wgsl.expected.hlsl | 748 +++++++ .../0.wgsl.expected.msl | 762 +++++++ .../0.wgsl.expected.spvasm | 1166 ++++++++++ .../0.wgsl.expected.wgsl | 653 ++++++ .../1.spvasm | 1053 +++++++++ .../1.spvasm.expected.hlsl | 1151 ++++++++++ .../1.spvasm.expected.msl | 1116 ++++++++++ .../1.spvasm.expected.spvasm | 1920 +++++++++++++++++ .../1.spvasm.expected.wgsl | 977 +++++++++ .../1.wgsl | 977 +++++++++ .../1.wgsl.expected.hlsl | 1151 ++++++++++ .../1.wgsl.expected.msl | 1116 ++++++++++ .../1.wgsl.expected.spvasm | 1920 +++++++++++++++++ .../1.wgsl.expected.wgsl | 977 +++++++++ .../0.spvasm | 420 ++++ .../0.spvasm.expected.hlsl | 232 ++ .../0.spvasm.expected.msl | 281 +++ .../0.spvasm.expected.spvasm | 476 ++++ .../0.spvasm.expected.wgsl | 264 +++ .../0.wgsl | 264 +++ .../0.wgsl.expected.hlsl | 232 ++ .../0.wgsl.expected.msl | 281 +++ .../0.wgsl.expected.spvasm | 476 ++++ .../0.wgsl.expected.wgsl | 264 +++ .../1.spvasm | 436 ++++ .../1.spvasm.expected.hlsl | 247 +++ .../1.spvasm.expected.msl | 293 +++ .../1.spvasm.expected.spvasm | 505 +++++ .../1.spvasm.expected.wgsl | 277 +++ .../1.wgsl | 277 +++ .../1.wgsl.expected.hlsl | 247 +++ .../1.wgsl.expected.msl | 293 +++ .../1.wgsl.expected.spvasm | 505 +++++ .../1.wgsl.expected.wgsl | 277 +++ .../1.spvasm | 483 +++++ .../1.spvasm.expected.hlsl | 255 +++ .../1.spvasm.expected.msl | 306 +++ .../1.spvasm.expected.spvasm | 539 +++++ .../1.spvasm.expected.wgsl | 293 +++ .../1.wgsl | 293 +++ .../1.wgsl.expected.hlsl | 255 +++ .../1.wgsl.expected.msl | 306 +++ .../1.wgsl.expected.spvasm | 539 +++++ .../1.wgsl.expected.wgsl | 293 +++ .../0-opt.spvasm | 420 ++++ .../0-opt.spvasm.expected.hlsl | 232 ++ .../0-opt.spvasm.expected.msl | 281 +++ .../0-opt.spvasm.expected.spvasm | 476 ++++ .../0-opt.spvasm.expected.wgsl | 264 +++ .../0-opt.wgsl | 264 +++ .../0-opt.wgsl.expected.hlsl | 232 ++ .../0-opt.wgsl.expected.msl | 281 +++ .../0-opt.wgsl.expected.spvasm | 476 ++++ .../0-opt.wgsl.expected.wgsl | 264 +++ .../1.spvasm | 508 +++++ .../1.spvasm.expected.hlsl | 271 +++ .../1.spvasm.expected.msl | 332 +++ .../1.spvasm.expected.spvasm | 572 +++++ .../1.spvasm.expected.wgsl | 319 +++ .../1.wgsl | 319 +++ .../1.wgsl.expected.hlsl | 271 +++ .../1.wgsl.expected.msl | 332 +++ .../1.wgsl.expected.spvasm | 572 +++++ .../1.wgsl.expected.wgsl | 319 +++ .../0.spvasm | 153 ++ .../0.spvasm.expected.hlsl | 67 + .../0.spvasm.expected.msl | 73 + .../0.spvasm.expected.spvasm | 200 ++ .../0.spvasm.expected.wgsl | 68 + .../0.wgsl | 68 + .../0.wgsl.expected.hlsl | 67 + .../0.wgsl.expected.msl | 73 + .../0.wgsl.expected.spvasm | 200 ++ .../0.wgsl.expected.wgsl | 68 + .../1.spvasm | 263 +++ .../1.spvasm.expected.hlsl | 220 ++ .../1.spvasm.expected.msl | 226 ++ .../1.spvasm.expected.spvasm | 490 +++++ .../1.spvasm.expected.wgsl | 222 ++ .../1.wgsl | 222 ++ .../1.wgsl.expected.hlsl | 220 ++ .../1.wgsl.expected.msl | 226 ++ .../1.wgsl.expected.spvasm | 490 +++++ .../1.wgsl.expected.wgsl | 222 ++ .../0.spvasm | 217 ++ .../0.spvasm.expected.hlsl | 95 + .../0.spvasm.expected.msl | 122 ++ .../0.spvasm.expected.spvasm | 266 +++ .../0.spvasm.expected.wgsl | 116 + .../0.wgsl | 116 + .../0.wgsl.expected.hlsl | 95 + .../0.wgsl.expected.msl | 122 ++ .../0.wgsl.expected.spvasm | 266 +++ .../0.wgsl.expected.wgsl | 116 + .../1.spvasm | 244 +++ .../1.spvasm.expected.hlsl | 106 + .../1.spvasm.expected.msl | 135 ++ .../1.spvasm.expected.spvasm | 295 +++ .../1.spvasm.expected.wgsl | 133 ++ .../1.wgsl | 133 ++ .../1.wgsl.expected.hlsl | 106 + .../1.wgsl.expected.msl | 135 ++ .../1.wgsl.expected.spvasm | 295 +++ .../1.wgsl.expected.wgsl | 133 ++ .../0-opt.spvasm | 180 ++ .../0-opt.spvasm.expected.hlsl | 123 ++ .../0-opt.spvasm.expected.msl | 126 ++ .../0-opt.spvasm.expected.spvasm | 291 +++ .../0-opt.spvasm.expected.wgsl | 122 ++ .../0-opt.wgsl | 122 ++ .../0-opt.wgsl.expected.hlsl | 123 ++ .../0-opt.wgsl.expected.msl | 126 ++ .../0-opt.wgsl.expected.spvasm | 291 +++ .../0-opt.wgsl.expected.wgsl | 122 ++ .../1.spvasm | 204 ++ .../1.spvasm.expected.hlsl | 133 ++ .../1.spvasm.expected.msl | 137 ++ .../1.spvasm.expected.spvasm | 316 +++ .../1.spvasm.expected.wgsl | 136 ++ .../1.wgsl | 136 ++ .../1.wgsl.expected.hlsl | 133 ++ .../1.wgsl.expected.msl | 137 ++ .../1.wgsl.expected.spvasm | 316 +++ .../1.wgsl.expected.wgsl | 136 ++ .../1.spvasm | 275 +++ .../1.spvasm.expected.hlsl | 122 ++ .../1.spvasm.expected.msl | 151 ++ .../1.spvasm.expected.spvasm | 331 +++ .../1.spvasm.expected.wgsl | 149 ++ .../1.wgsl | 149 ++ .../1.wgsl.expected.hlsl | 122 ++ .../1.wgsl.expected.msl | 151 ++ .../1.wgsl.expected.spvasm | 331 +++ .../1.wgsl.expected.wgsl | 149 ++ .../1.spvasm | 245 +++ .../1.spvasm.expected.hlsl | 100 + .../1.spvasm.expected.msl | 127 ++ .../1.spvasm.expected.spvasm | 296 +++ .../1.spvasm.expected.wgsl | 121 ++ .../1.wgsl | 121 ++ .../1.wgsl.expected.hlsl | 100 + .../1.wgsl.expected.msl | 127 ++ .../1.wgsl.expected.spvasm | 296 +++ .../1.wgsl.expected.wgsl | 121 ++ .../1.spvasm | 617 ++++++ .../1.spvasm.expected.hlsl | 302 +++ .../1.spvasm.expected.msl | 348 +++ .../1.spvasm.expected.spvasm | 716 ++++++ .../1.spvasm.expected.wgsl | 340 +++ .../1.wgsl | 340 +++ .../1.wgsl.expected.hlsl | 302 +++ .../1.wgsl.expected.msl | 348 +++ .../1.wgsl.expected.spvasm | 716 ++++++ .../1.wgsl.expected.wgsl | 340 +++ .../1.spvasm | 416 ++++ .../1.spvasm.expected.hlsl | 357 +++ .../1.spvasm.expected.msl | 351 +++ .../1.spvasm.expected.spvasm | 759 +++++++ .../1.spvasm.expected.wgsl | 344 +++ .../1.wgsl | 344 +++ .../1.wgsl.expected.hlsl | 357 +++ .../1.wgsl.expected.msl | 351 +++ .../1.wgsl.expected.spvasm | 759 +++++++ .../1.wgsl.expected.wgsl | 344 +++ .../1.spvasm | 574 +++++ .../1.spvasm.expected.hlsl | 278 +++ .../1.spvasm.expected.msl | 324 +++ .../1.spvasm.expected.spvasm | 673 ++++++ .../1.spvasm.expected.wgsl | 316 +++ .../stable-mergesort-reversed-for-loop/1.wgsl | 316 +++ .../1.wgsl.expected.hlsl | 278 +++ .../1.wgsl.expected.msl | 324 +++ .../1.wgsl.expected.spvasm | 673 ++++++ .../1.wgsl.expected.wgsl | 316 +++ .../1.spvasm | 524 +++++ .../1.spvasm.expected.hlsl | 232 ++ .../1.spvasm.expected.msl | 280 +++ .../1.spvasm.expected.spvasm | 587 +++++ .../1.spvasm.expected.wgsl | 280 +++ .../1.wgsl | 280 +++ .../1.wgsl.expected.hlsl | 232 ++ .../1.wgsl.expected.msl | 280 +++ .../1.wgsl.expected.spvasm | 587 +++++ .../1.wgsl.expected.wgsl | 280 +++ .../0-opt.spvasm | 503 +++++ .../0-opt.spvasm.expected.hlsl | 219 ++ .../0-opt.spvasm.expected.msl | 266 +++ .../0-opt.spvasm.expected.spvasm | 567 +++++ .../0-opt.spvasm.expected.wgsl | 264 +++ .../0-opt.wgsl | 264 +++ .../0-opt.wgsl.expected.hlsl | 219 ++ .../0-opt.wgsl.expected.msl | 266 +++ .../0-opt.wgsl.expected.spvasm | 567 +++++ .../0-opt.wgsl.expected.wgsl | 264 +++ .../1.spvasm | 25 + .../1.spvasm.expected.hlsl | 26 + .../1.spvasm.expected.msl | 30 + .../1.spvasm.expected.spvasm | 59 + .../1.spvasm.expected.wgsl | 21 + .../1.wgsl | 21 + .../1.wgsl.expected.hlsl | 26 + .../1.wgsl.expected.msl | 30 + .../1.wgsl.expected.spvasm | 59 + .../1.wgsl.expected.wgsl | 21 + .../2-opt.spvasm | 524 +++++ .../2-opt.spvasm.expected.hlsl | 227 ++ .../2-opt.spvasm.expected.msl | 274 +++ .../2-opt.spvasm.expected.spvasm | 589 +++++ .../2-opt.spvasm.expected.wgsl | 276 +++ .../2-opt.wgsl | 276 +++ .../2-opt.wgsl.expected.hlsl | 227 ++ .../2-opt.wgsl.expected.msl | 274 +++ .../2-opt.wgsl.expected.spvasm | 589 +++++ .../2-opt.wgsl.expected.wgsl | 276 +++ .../0.spvasm | 689 ++++++ .../0.spvasm.expected.hlsl | 306 +++ .../0.spvasm.expected.msl | 400 ++++ .../0.spvasm.expected.spvasm | 780 +++++++ .../0.spvasm.expected.wgsl | 399 ++++ .../0.wgsl | 399 ++++ .../0.wgsl.expected.hlsl | 306 +++ .../0.wgsl.expected.msl | 400 ++++ .../0.wgsl.expected.spvasm | 780 +++++++ .../0.wgsl.expected.wgsl | 399 ++++ .../2.spvasm | 636 ++++++ .../2.spvasm.expected.hlsl | 284 +++ .../2.spvasm.expected.msl | 358 +++ .../2.spvasm.expected.spvasm | 713 ++++++ .../2.spvasm.expected.wgsl | 356 +++ .../2.wgsl | 356 +++ .../2.wgsl.expected.hlsl | 284 +++ .../2.wgsl.expected.msl | 358 +++ .../2.wgsl.expected.spvasm | 713 ++++++ .../2.wgsl.expected.wgsl | 356 +++ .../2-opt.spvasm | 528 +++++ .../2-opt.spvasm.expected.hlsl | 225 ++ .../2-opt.spvasm.expected.msl | 272 +++ .../2-opt.spvasm.expected.spvasm | 593 +++++ .../2-opt.spvasm.expected.wgsl | 274 +++ .../2-opt.wgsl | 274 +++ .../2-opt.wgsl.expected.hlsl | 225 ++ .../2-opt.wgsl.expected.msl | 272 +++ .../2-opt.wgsl.expected.spvasm | 593 +++++ .../2-opt.wgsl.expected.wgsl | 274 +++ .../1.spvasm | 284 +++ .../1.spvasm.expected.hlsl | 119 + .../1.spvasm.expected.msl | 136 ++ .../1.spvasm.expected.spvasm | 336 +++ .../1.spvasm.expected.wgsl | 126 ++ .../1.wgsl | 126 ++ .../1.wgsl.expected.hlsl | 119 + .../1.wgsl.expected.msl | 136 ++ .../1.wgsl.expected.spvasm | 336 +++ .../1.wgsl.expected.wgsl | 126 ++ .../0-opt.spvasm | 259 +++ .../0-opt.spvasm.expected.hlsl | 159 ++ .../0-opt.spvasm.expected.msl | 145 ++ .../0-opt.spvasm.expected.spvasm | 360 ++++ .../0-opt.spvasm.expected.wgsl | 151 ++ .../0-opt.wgsl | 151 ++ .../0-opt.wgsl.expected.hlsl | 159 ++ .../0-opt.wgsl.expected.msl | 145 ++ .../0-opt.wgsl.expected.spvasm | 360 ++++ .../0-opt.wgsl.expected.wgsl | 151 ++ .../0.spvasm | 250 +++ .../0.spvasm.expected.hlsl | 141 ++ .../0.spvasm.expected.msl | 135 ++ .../0.spvasm.expected.spvasm | 343 +++ .../0.spvasm.expected.wgsl | 142 ++ .../0.wgsl | 142 ++ .../0.wgsl.expected.hlsl | 141 ++ .../0.wgsl.expected.msl | 135 ++ .../0.wgsl.expected.spvasm | 343 +++ .../0.wgsl.expected.wgsl | 142 ++ .../1.spvasm | 302 +++ .../1.spvasm.expected.hlsl | 168 ++ .../1.spvasm.expected.msl | 164 ++ .../1.spvasm.expected.spvasm | 399 ++++ .../1.spvasm.expected.wgsl | 172 ++ .../1.wgsl | 172 ++ .../1.wgsl.expected.hlsl | 168 ++ .../1.wgsl.expected.msl | 164 ++ .../1.wgsl.expected.spvasm | 399 ++++ .../1.wgsl.expected.wgsl | 172 ++ .../0.spvasm | 266 +++ .../0.spvasm.expected.hlsl | 141 ++ .../0.spvasm.expected.msl | 135 ++ .../0.spvasm.expected.spvasm | 343 +++ .../0.spvasm.expected.wgsl | 134 ++ .../0.wgsl | 134 ++ .../0.wgsl.expected.hlsl | 141 ++ .../0.wgsl.expected.msl | 135 ++ .../0.wgsl.expected.spvasm | 343 +++ .../0.wgsl.expected.wgsl | 134 ++ .../0.spvasm | 243 +++ .../0.spvasm.expected.hlsl | 144 ++ .../0.spvasm.expected.msl | 129 ++ .../0.spvasm.expected.spvasm | 339 +++ .../0.spvasm.expected.wgsl | 136 ++ .../0.wgsl | 136 ++ .../0.wgsl.expected.hlsl | 144 ++ .../0.wgsl.expected.msl | 129 ++ .../0.wgsl.expected.spvasm | 339 +++ .../0.wgsl.expected.wgsl | 136 ++ .../1.spvasm | 298 +++ .../1.spvasm.expected.hlsl | 183 ++ .../1.spvasm.expected.msl | 168 ++ .../1.spvasm.expected.spvasm | 423 ++++ .../1.spvasm.expected.wgsl | 181 ++ .../1.wgsl | 181 ++ .../1.wgsl.expected.hlsl | 183 ++ .../1.wgsl.expected.msl | 168 ++ .../1.wgsl.expected.spvasm | 423 ++++ .../1.wgsl.expected.wgsl | 181 ++ .../0.spvasm | 89 + .../0.spvasm.expected.hlsl | 44 + .../0.spvasm.expected.msl | 54 + .../0.spvasm.expected.spvasm | 125 ++ .../0.spvasm.expected.wgsl | 47 + .../0.wgsl | 47 + .../0.wgsl.expected.hlsl | 44 + .../0.wgsl.expected.msl | 54 + .../0.wgsl.expected.spvasm | 125 ++ .../0.wgsl.expected.wgsl | 47 + .../graphicsfuzz/struct-array-index/0.spvasm | 97 + .../struct-array-index/0.spvasm.expected.hlsl | 53 + .../struct-array-index/0.spvasm.expected.msl | 58 + .../0.spvasm.expected.spvasm | 133 ++ .../struct-array-index/0.spvasm.expected.wgsl | 51 + .../graphicsfuzz/struct-array-index/0.wgsl | 51 + .../struct-array-index/0.wgsl.expected.hlsl | 53 + .../struct-array-index/0.wgsl.expected.msl | 58 + .../struct-array-index/0.wgsl.expected.spvasm | 133 ++ .../struct-array-index/0.wgsl.expected.wgsl | 51 + .../struct-controlled-loop/0-opt.spvasm | 95 + .../0-opt.spvasm.expected.hlsl | 49 + .../0-opt.spvasm.expected.msl | 56 + .../0-opt.spvasm.expected.spvasm | 137 ++ .../0-opt.spvasm.expected.wgsl | 52 + .../struct-controlled-loop/0-opt.wgsl | 52 + .../0-opt.wgsl.expected.hlsl | 49 + .../0-opt.wgsl.expected.msl | 56 + .../0-opt.wgsl.expected.spvasm | 137 ++ .../0-opt.wgsl.expected.wgsl | 52 + .../struct-used-as-temporary/0-opt.spvasm | 35 + .../0-opt.spvasm.expected.hlsl | 30 + .../0-opt.spvasm.expected.msl | 33 + .../0-opt.spvasm.expected.spvasm | 83 + .../0-opt.spvasm.expected.wgsl | 32 + .../struct-used-as-temporary/0-opt.wgsl | 32 + .../0-opt.wgsl.expected.hlsl | 30 + .../0-opt.wgsl.expected.msl | 33 + .../0-opt.wgsl.expected.spvasm | 83 + .../0-opt.wgsl.expected.wgsl | 32 + .../switch-if-discard/0-opt.spvasm | 59 + .../0-opt.spvasm.expected.hlsl | 37 + .../0-opt.spvasm.expected.msl | 40 + .../0-opt.spvasm.expected.spvasm | 91 + .../0-opt.spvasm.expected.wgsl | 36 + .../graphicsfuzz/switch-if-discard/0-opt.wgsl | 36 + .../0-opt.wgsl.expected.hlsl | 37 + .../switch-if-discard/0-opt.wgsl.expected.msl | 40 + .../0-opt.wgsl.expected.spvasm | 91 + .../0-opt.wgsl.expected.wgsl | 36 + .../0-opt.spvasm | 83 + .../0-opt.spvasm.expected.hlsl | 54 + .../0-opt.spvasm.expected.msl | 58 + .../0-opt.spvasm.expected.spvasm | 126 ++ .../0-opt.spvasm.expected.wgsl | 55 + .../0-opt.wgsl | 55 + .../0-opt.wgsl.expected.hlsl | 54 + .../0-opt.wgsl.expected.msl | 58 + .../0-opt.wgsl.expected.spvasm | 126 ++ .../0-opt.wgsl.expected.wgsl | 55 + .../switch-loop-switch-if/0-opt.spvasm | 134 ++ .../0-opt.spvasm.expected.hlsl | 72 + .../0-opt.spvasm.expected.msl | 86 + .../0-opt.spvasm.expected.spvasm | 160 ++ .../0-opt.spvasm.expected.wgsl | 74 + .../switch-loop-switch-if/0-opt.wgsl | 74 + .../0-opt.wgsl.expected.hlsl | 72 + .../0-opt.wgsl.expected.msl | 86 + .../0-opt.wgsl.expected.spvasm | 160 ++ .../0-opt.wgsl.expected.wgsl | 74 + .../switch-with-empty-if-false/0.spvasm | 37 + .../0.spvasm.expected.hlsl | 30 + .../0.spvasm.expected.msl | 33 + .../0.spvasm.expected.spvasm | 69 + .../0.spvasm.expected.wgsl | 25 + .../switch-with-empty-if-false/0.wgsl | 25 + .../0.wgsl.expected.hlsl | 30 + .../0.wgsl.expected.msl | 33 + .../0.wgsl.expected.spvasm | 69 + .../0.wgsl.expected.wgsl | 25 + .../0-opt.spvasm | 96 + .../0-opt.spvasm.expected.hlsl | 71 + .../0-opt.spvasm.expected.msl | 76 + .../0-opt.spvasm.expected.spvasm | 149 ++ .../0-opt.spvasm.expected.wgsl | 74 + .../switch-with-fall-through-cases/0-opt.wgsl | 74 + .../0-opt.wgsl.expected.hlsl | 71 + .../0-opt.wgsl.expected.msl | 76 + .../0-opt.wgsl.expected.spvasm | 149 ++ .../0-opt.wgsl.expected.wgsl | 74 + .../transpose-rectangular-matrix/0.spvasm | 77 + .../0.spvasm.expected.hlsl | 46 + .../0.spvasm.expected.msl | 46 + .../0.spvasm.expected.spvasm | 128 ++ .../0.spvasm.expected.wgsl | 41 + .../transpose-rectangular-matrix/0.wgsl | 41 + .../0.wgsl.expected.hlsl | 46 + .../0.wgsl.expected.msl | 46 + .../0.wgsl.expected.spvasm | 128 ++ .../0.wgsl.expected.wgsl | 41 + .../two-2-iteration-loops/0-opt.spvasm | 211 ++ .../0-opt.spvasm.expected.hlsl | 96 + .../0-opt.spvasm.expected.msl | 114 + .../0-opt.spvasm.expected.spvasm | 254 +++ .../0-opt.spvasm.expected.wgsl | 110 + .../two-2-iteration-loops/0-opt.wgsl | 110 + .../0-opt.wgsl.expected.hlsl | 96 + .../0-opt.wgsl.expected.msl | 114 + .../0-opt.wgsl.expected.spvasm | 254 +++ .../0-opt.wgsl.expected.wgsl | 110 + .../0-opt.spvasm | 184 ++ .../0-opt.spvasm.expected.hlsl | 61 + .../0-opt.spvasm.expected.msl | 90 + .../0-opt.spvasm.expected.spvasm | 203 ++ .../0-opt.spvasm.expected.wgsl | 99 + .../0-opt.wgsl | 99 + .../0-opt.wgsl.expected.hlsl | 61 + .../0-opt.wgsl.expected.msl | 90 + .../0-opt.wgsl.expected.spvasm | 203 ++ .../0-opt.wgsl.expected.wgsl | 99 + .../graphicsfuzz/two-loops-matrix/0.spvasm | 126 ++ .../two-loops-matrix/0.spvasm.expected.hlsl | 58 + .../two-loops-matrix/0.spvasm.expected.msl | 69 + .../two-loops-matrix/0.spvasm.expected.spvasm | 160 ++ .../two-loops-matrix/0.spvasm.expected.wgsl | 69 + .../graphicsfuzz/two-loops-matrix/0.wgsl | 69 + .../two-loops-matrix/0.wgsl.expected.hlsl | 58 + .../two-loops-matrix/0.wgsl.expected.msl | 69 + .../two-loops-matrix/0.wgsl.expected.spvasm | 160 ++ .../two-loops-matrix/0.wgsl.expected.wgsl | 69 + .../two-loops-set-struct/0.spvasm | 84 + .../0.spvasm.expected.hlsl | 77 + .../0.spvasm.expected.msl | 79 + .../0.spvasm.expected.spvasm | 189 ++ .../0.spvasm.expected.wgsl | 79 + .../graphicsfuzz/two-loops-set-struct/0.wgsl | 79 + .../two-loops-set-struct/0.wgsl.expected.hlsl | 77 + .../two-loops-set-struct/0.wgsl.expected.msl | 79 + .../0.wgsl.expected.spvasm | 189 ++ .../two-loops-set-struct/0.wgsl.expected.wgsl | 79 + .../two-loops-with-break/0-opt.spvasm | 127 ++ .../0-opt.spvasm.expected.hlsl | 54 + .../0-opt.spvasm.expected.msl | 71 + .../0-opt.spvasm.expected.spvasm | 156 ++ .../0-opt.spvasm.expected.wgsl | 67 + .../two-loops-with-break/0-opt.wgsl | 67 + .../0-opt.wgsl.expected.hlsl | 54 + .../0-opt.wgsl.expected.msl | 71 + .../0-opt.wgsl.expected.spvasm | 156 ++ .../0-opt.wgsl.expected.wgsl | 67 + .../two-nested-do-whiles/0-opt.spvasm | 133 ++ .../0-opt.spvasm.expected.hlsl | 98 + .../0-opt.spvasm.expected.msl | 94 + .../0-opt.spvasm.expected.spvasm | 214 ++ .../0-opt.spvasm.expected.wgsl | 93 + .../two-nested-do-whiles/0-opt.wgsl | 93 + .../0-opt.wgsl.expected.hlsl | 101 + .../0-opt.wgsl.expected.msl | 94 + .../0-opt.wgsl.expected.spvasm | 214 ++ .../0-opt.wgsl.expected.wgsl | 93 + .../0-opt.spvasm | 102 + .../0-opt.spvasm.expected.hlsl | 55 + .../0-opt.spvasm.expected.msl | 61 + .../0-opt.spvasm.expected.spvasm | 140 ++ .../0-opt.spvasm.expected.wgsl | 62 + .../0-opt.wgsl | 62 + .../0-opt.wgsl.expected.hlsl | 55 + .../0-opt.wgsl.expected.msl | 61 + .../0-opt.wgsl.expected.spvasm | 140 ++ .../0-opt.wgsl.expected.wgsl | 62 + .../0-opt.spvasm | 91 + .../0-opt.spvasm.expected.hlsl | 57 + .../0-opt.spvasm.expected.msl | 54 + .../0-opt.spvasm.expected.spvasm | 132 ++ .../0-opt.spvasm.expected.wgsl | 53 + .../0-opt.wgsl | 53 + .../0-opt.wgsl.expected.hlsl | 57 + .../0-opt.wgsl.expected.msl | 54 + .../0-opt.wgsl.expected.spvasm | 132 ++ .../0-opt.wgsl.expected.wgsl | 53 + .../0.spvasm | 82 + .../0.spvasm.expected.hlsl | 47 + .../0.spvasm.expected.msl | 47 + .../0.spvasm.expected.spvasm | 116 + .../0.spvasm.expected.wgsl | 42 + .../undefined-assign-in-infinite-loop/0.wgsl | 42 + .../0.wgsl.expected.hlsl | 47 + .../0.wgsl.expected.msl | 47 + .../0.wgsl.expected.spvasm | 116 + .../0.wgsl.expected.wgsl | 42 + .../0-opt.spvasm | 113 + .../0-opt.spvasm.expected.hlsl | 86 + .../0-opt.spvasm.expected.msl | 89 + .../0-opt.spvasm.expected.spvasm | 172 ++ .../0-opt.spvasm.expected.wgsl | 72 + .../undefined-integer-in-function/0-opt.wgsl | 72 + .../0-opt.wgsl.expected.hlsl | 86 + .../0-opt.wgsl.expected.msl | 89 + .../0-opt.wgsl.expected.spvasm | 172 ++ .../0-opt.wgsl.expected.wgsl | 72 + .../uninit-element-cast-in-loop/0-opt.spvasm | 71 + .../0-opt.spvasm.expected.hlsl | 44 + .../0-opt.spvasm.expected.msl | 48 + .../0-opt.spvasm.expected.spvasm | 104 + .../0-opt.spvasm.expected.wgsl | 44 + .../uninit-element-cast-in-loop/0-opt.wgsl | 44 + .../0-opt.wgsl.expected.hlsl | 44 + .../0-opt.wgsl.expected.msl | 48 + .../0-opt.wgsl.expected.spvasm | 104 + .../0-opt.wgsl.expected.wgsl | 44 + .../0-opt.spvasm | 67 + .../0-opt.spvasm.expected.hlsl | 38 + .../0-opt.spvasm.expected.msl | 39 + .../0-opt.spvasm.expected.spvasm | 100 + .../0-opt.spvasm.expected.wgsl | 34 + .../0-opt.wgsl | 34 + .../0-opt.wgsl.expected.hlsl | 38 + .../0-opt.wgsl.expected.msl | 39 + .../0-opt.wgsl.expected.spvasm | 100 + .../0-opt.wgsl.expected.wgsl | 34 + .../unreachable-barrier-in-loops/0-opt.spvasm | 269 +++ .../0-opt.spvasm.expected.hlsl | 107 + .../0-opt.spvasm.expected.msl | 139 ++ .../0-opt.spvasm.expected.spvasm | 322 +++ .../0-opt.spvasm.expected.wgsl | 145 ++ .../unreachable-barrier-in-loops/0-opt.wgsl | 145 ++ .../0-opt.wgsl.expected.hlsl | 107 + .../0-opt.wgsl.expected.msl | 139 ++ .../0-opt.wgsl.expected.spvasm | 322 +++ .../0-opt.wgsl.expected.wgsl | 145 ++ .../unreachable-continue-statement/0.spvasm | 81 + .../0.spvasm.expected.hlsl | 43 + .../0.spvasm.expected.msl | 46 + .../0.spvasm.expected.spvasm | 113 + .../0.spvasm.expected.wgsl | 44 + .../unreachable-continue-statement/0.wgsl | 44 + .../0.wgsl.expected.hlsl | 43 + .../0.wgsl.expected.msl | 46 + .../0.wgsl.expected.spvasm | 113 + .../0.wgsl.expected.wgsl | 44 + .../0-opt.spvasm | 90 + .../0-opt.spvasm.expected.hlsl | 50 + .../0-opt.spvasm.expected.msl | 49 + .../0-opt.spvasm.expected.spvasm | 125 ++ .../0-opt.spvasm.expected.wgsl | 48 + .../0-opt.wgsl | 48 + .../0-opt.wgsl.expected.hlsl | 50 + .../0-opt.wgsl.expected.msl | 49 + .../0-opt.wgsl.expected.spvasm | 125 ++ .../0-opt.wgsl.expected.wgsl | 48 + .../unreachable-discard-statement/0.spvasm | 94 + .../0.spvasm.expected.hlsl | 55 + .../0.spvasm.expected.msl | 63 + .../0.spvasm.expected.spvasm | 144 ++ .../0.spvasm.expected.wgsl | 58 + .../unreachable-discard-statement/0.wgsl | 58 + .../0.wgsl.expected.hlsl | 55 + .../0.wgsl.expected.msl | 63 + .../0.wgsl.expected.spvasm | 144 ++ .../0.wgsl.expected.wgsl | 58 + .../unreachable-loops-in-switch/0.spvasm | 116 + .../0.spvasm.expected.hlsl | 55 + .../0.spvasm.expected.msl | 70 + .../0.spvasm.expected.spvasm | 155 ++ .../0.spvasm.expected.wgsl | 60 + .../unreachable-loops-in-switch/0.wgsl | 60 + .../0.wgsl.expected.hlsl | 55 + .../0.wgsl.expected.msl | 70 + .../0.wgsl.expected.spvasm | 155 ++ .../0.wgsl.expected.wgsl | 60 + .../unreachable-loops/0-opt.spvasm | 80 + .../0-opt.spvasm.expected.hlsl | 52 + .../0-opt.spvasm.expected.msl | 47 + .../0-opt.spvasm.expected.spvasm | 127 ++ .../0-opt.spvasm.expected.wgsl | 46 + .../graphicsfuzz/unreachable-loops/0-opt.wgsl | 46 + .../0-opt.wgsl.expected.hlsl | 52 + .../unreachable-loops/0-opt.wgsl.expected.msl | 47 + .../0-opt.wgsl.expected.spvasm | 127 ++ .../0-opt.wgsl.expected.wgsl | 46 + .../unreachable-return-in-loop/0.spvasm | 53 + .../0.spvasm.expected.hlsl | 52 + .../0.spvasm.expected.msl | 53 + .../0.spvasm.expected.spvasm | 111 + .../0.spvasm.expected.wgsl | 49 + .../unreachable-return-in-loop/0.wgsl | 49 + .../0.wgsl.expected.hlsl | 52 + .../0.wgsl.expected.msl | 53 + .../0.wgsl.expected.spvasm | 111 + .../0.wgsl.expected.wgsl | 49 + .../uv-value-comparison-as-boolean/0.spvasm | 74 + .../0.spvasm.expected.hlsl | 48 + .../0.spvasm.expected.msl | 53 + .../0.spvasm.expected.spvasm | 119 + .../0.spvasm.expected.wgsl | 48 + .../uv-value-comparison-as-boolean/0.wgsl | 48 + .../0.wgsl.expected.hlsl | 48 + .../0.wgsl.expected.msl | 53 + .../0.wgsl.expected.spvasm | 119 + .../0.wgsl.expected.wgsl | 48 + .../0-opt.spvasm | 195 ++ .../0-opt.spvasm.expected.hlsl | 104 + .../0-opt.spvasm.expected.msl | 111 + .../0-opt.spvasm.expected.spvasm | 269 +++ .../0-opt.spvasm.expected.wgsl | 112 + .../0-opt.wgsl | 112 + .../0-opt.wgsl.expected.hlsl | 104 + .../0-opt.wgsl.expected.msl | 111 + .../0-opt.wgsl.expected.spvasm | 269 +++ .../0-opt.wgsl.expected.wgsl | 112 + .../vectors-and-discard-in-function/0.spvasm | 81 + .../0.spvasm.expected.hlsl | 43 + .../0.spvasm.expected.msl | 49 + .../0.spvasm.expected.spvasm | 121 ++ .../0.spvasm.expected.wgsl | 40 + .../vectors-and-discard-in-function/0.wgsl | 40 + .../0.wgsl.expected.hlsl | 43 + .../0.wgsl.expected.msl | 49 + .../0.wgsl.expected.spvasm | 121 ++ .../0.wgsl.expected.wgsl | 40 + .../while-function-always-false/0-opt.spvasm | 75 + .../0-opt.spvasm.expected.hlsl | 44 + .../0-opt.spvasm.expected.msl | 48 + .../0-opt.spvasm.expected.spvasm | 130 ++ .../0-opt.spvasm.expected.wgsl | 47 + .../while-function-always-false/0-opt.wgsl | 47 + .../0-opt.wgsl.expected.hlsl | 44 + .../0-opt.wgsl.expected.msl | 48 + .../0-opt.wgsl.expected.spvasm | 130 ++ .../0-opt.wgsl.expected.wgsl | 47 + .../write-before-break/0-opt.spvasm | 231 ++ .../0-opt.spvasm.expected.hlsl | 99 + .../0-opt.spvasm.expected.msl | 109 + .../0-opt.spvasm.expected.spvasm | 255 +++ .../0-opt.spvasm.expected.wgsl | 106 + .../write-before-break/0-opt.wgsl | 106 + .../0-opt.wgsl.expected.hlsl | 99 + .../0-opt.wgsl.expected.msl | 109 + .../0-opt.wgsl.expected.spvasm | 255 +++ .../0-opt.wgsl.expected.wgsl | 106 + .../write-red-after-search/0-opt.spvasm | 817 +++++++ .../0-opt.spvasm.expected.hlsl | 364 ++++ .../0-opt.spvasm.expected.msl | 426 ++++ .../0-opt.spvasm.expected.spvasm | 815 +++++++ .../0-opt.spvasm.expected.wgsl | 420 ++++ .../write-red-after-search/0-opt.wgsl | 420 ++++ .../0-opt.wgsl.expected.hlsl | 364 ++++ .../0-opt.wgsl.expected.msl | 426 ++++ .../0-opt.wgsl.expected.spvasm | 815 +++++++ .../0-opt.wgsl.expected.wgsl | 420 ++++ .../write-red-in-loop-nest/0-opt.spvasm | 213 ++ .../0-opt.spvasm.expected.hlsl | 85 + .../0-opt.spvasm.expected.msl | 105 + .../0-opt.spvasm.expected.spvasm | 244 +++ .../0-opt.spvasm.expected.wgsl | 98 + .../write-red-in-loop-nest/0-opt.wgsl | 98 + .../0-opt.wgsl.expected.hlsl | 85 + .../0-opt.wgsl.expected.msl | 105 + .../0-opt.wgsl.expected.spvasm | 244 +++ .../0-opt.wgsl.expected.wgsl | 98 + .../0-opt.spvasm | 70 + .../0-opt.spvasm.expected.hlsl | 29 + .../0-opt.spvasm.expected.msl | 33 + .../0-opt.spvasm.expected.spvasm | 102 + .../0-opt.spvasm.expected.wgsl | 31 + .../wrong-color-in-always-false-if/0-opt.wgsl | 31 + .../0-opt.wgsl.expected.hlsl | 29 + .../0-opt.wgsl.expected.msl | 33 + .../0-opt.wgsl.expected.spvasm | 102 + .../0-opt.wgsl.expected.wgsl | 31 + .../unexecuted_oob_overflow/0-opt.spvasm | 209 ++ .../0-opt.spvasm.expected.hlsl | 69 + .../0-opt.spvasm.expected.msl | 108 + .../0-opt.spvasm.expected.spvasm | 224 ++ .../0-opt.spvasm.expected.wgsl | 120 ++ .../unexecuted_oob_overflow/0-opt.wgsl | 120 ++ .../0-opt.wgsl.expected.hlsl | 69 + .../0-opt.wgsl.expected.msl | 108 + .../0-opt.wgsl.expected.spvasm | 224 ++ .../0-opt.wgsl.expected.wgsl | 120 ++ .../unexecuted_oob_underflow/0-opt.spvasm | 207 ++ .../0-opt.spvasm.expected.hlsl | 69 + .../0-opt.spvasm.expected.msl | 108 + .../0-opt.spvasm.expected.spvasm | 222 ++ .../0-opt.spvasm.expected.wgsl | 120 ++ .../unexecuted_oob_underflow/0-opt.wgsl | 120 ++ .../0-opt.wgsl.expected.hlsl | 69 + .../0-opt.wgsl.expected.msl | 108 + .../0-opt.wgsl.expected.spvasm | 222 ++ .../0-opt.wgsl.expected.wgsl | 120 ++ .../line_continuity/line-strip/0.spvasm | 22 + .../line-strip/0.spvasm.expected.hlsl | 20 + .../line-strip/0.spvasm.expected.msl | 23 + .../line-strip/0.spvasm.expected.spvasm | 52 + .../line-strip/0.spvasm.expected.wgsl | 17 + .../line_continuity/line-strip/0.wgsl | 17 + .../line-strip/0.wgsl.expected.hlsl | 20 + .../line-strip/0.wgsl.expected.msl | 23 + .../line-strip/0.wgsl.expected.spvasm | 52 + .../line-strip/0.wgsl.expected.wgsl | 17 + .../line_continuity/line-strip/1.spvasm | 39 + .../line-strip/1.spvasm.expected.hlsl | 29 + .../line-strip/1.spvasm.expected.msl | 27 + .../line-strip/1.spvasm.expected.spvasm | 75 + .../line-strip/1.spvasm.expected.wgsl | 24 + .../line_continuity/line-strip/1.wgsl | 24 + .../line-strip/1.wgsl.expected.hlsl | 29 + .../line-strip/1.wgsl.expected.msl | 27 + .../line-strip/1.wgsl.expected.spvasm | 75 + .../line-strip/1.wgsl.expected.wgsl | 24 + .../1.spvasm | 84 + .../1.spvasm.expected.hlsl | 23 + .../1.spvasm.expected.msl | 39 + .../1.spvasm.expected.spvasm | 96 + .../1.spvasm.expected.wgsl | 45 + .../1.wgsl | 45 + .../1.wgsl.expected.hlsl | 23 + .../1.wgsl.expected.msl | 39 + .../1.wgsl.expected.spvasm | 96 + .../1.wgsl.expected.wgsl | 45 + .../uint_sgreaterthan/0.spvasm | 46 + .../uint_sgreaterthan/0.spvasm.expected.hlsl | 24 + .../uint_sgreaterthan/0.spvasm.expected.msl | 22 + .../0.spvasm.expected.spvasm | 72 + .../uint_sgreaterthan/0.spvasm.expected.wgsl | 28 + .../uint_sgreaterthan/0.wgsl | 28 + .../uint_sgreaterthan/0.wgsl.expected.hlsl | 24 + .../uint_sgreaterthan/0.wgsl.expected.msl | 22 + .../uint_sgreaterthan/0.wgsl.expected.spvasm | 72 + .../uint_sgreaterthan/0.wgsl.expected.wgsl | 28 + .../uint_sgreaterthanequal/0.spvasm | 46 + .../0.spvasm.expected.hlsl | 24 + .../0.spvasm.expected.msl | 22 + .../0.spvasm.expected.spvasm | 72 + .../0.spvasm.expected.wgsl | 28 + .../uint_sgreaterthanequal/0.wgsl | 28 + .../0.wgsl.expected.hlsl | 24 + .../0.wgsl.expected.msl | 22 + .../0.wgsl.expected.spvasm | 72 + .../0.wgsl.expected.wgsl | 28 + .../uint_slessthan/0.spvasm | 46 + .../uint_slessthan/0.spvasm.expected.hlsl | 24 + .../uint_slessthan/0.spvasm.expected.msl | 22 + .../uint_slessthan/0.spvasm.expected.spvasm | 72 + .../uint_slessthan/0.spvasm.expected.wgsl | 28 + .../signed_int_compare/uint_slessthan/0.wgsl | 28 + .../uint_slessthan/0.wgsl.expected.hlsl | 24 + .../uint_slessthan/0.wgsl.expected.msl | 22 + .../uint_slessthan/0.wgsl.expected.spvasm | 72 + .../uint_slessthan/0.wgsl.expected.wgsl | 28 + .../uint_slessthanequal/0.spvasm | 46 + .../0.spvasm.expected.hlsl | 24 + .../uint_slessthanequal/0.spvasm.expected.msl | 22 + .../0.spvasm.expected.spvasm | 72 + .../0.spvasm.expected.wgsl | 28 + .../uint_slessthanequal/0.wgsl | 28 + .../uint_slessthanequal/0.wgsl.expected.hlsl | 24 + .../uint_slessthanequal/0.wgsl.expected.msl | 22 + .../0.wgsl.expected.spvasm | 72 + .../uint_slessthanequal/0.wgsl.expected.wgsl | 28 + .../signed_op/glsl_int_uclamp/0-opt.spvasm | 53 + .../0-opt.spvasm.expected.hlsl | 26 + .../glsl_int_uclamp/0-opt.spvasm.expected.msl | 23 + .../0-opt.spvasm.expected.spvasm | 78 + .../0-opt.spvasm.expected.wgsl | 31 + .../signed_op/glsl_int_uclamp/0-opt.wgsl | 31 + .../glsl_int_uclamp/0-opt.wgsl.expected.hlsl | 26 + .../glsl_int_uclamp/0-opt.wgsl.expected.msl | 23 + .../0-opt.wgsl.expected.spvasm | 78 + .../glsl_int_uclamp/0-opt.wgsl.expected.wgsl | 31 + .../signed_op/glsl_uint_sabs/0-opt.spvasm | 40 + .../glsl_uint_sabs/0-opt.spvasm.expected.hlsl | 22 + .../glsl_uint_sabs/0-opt.spvasm.expected.msl | 21 + .../0-opt.spvasm.expected.spvasm | 64 + .../glsl_uint_sabs/0-opt.spvasm.expected.wgsl | 25 + .../signed_op/glsl_uint_sabs/0-opt.wgsl | 25 + .../glsl_uint_sabs/0-opt.wgsl.expected.hlsl | 22 + .../glsl_uint_sabs/0-opt.wgsl.expected.msl | 21 + .../glsl_uint_sabs/0-opt.wgsl.expected.spvasm | 64 + .../glsl_uint_sabs/0-opt.wgsl.expected.wgsl | 25 + .../signed_op/glsl_uint_sclamp/0-opt.spvasm | 50 + .../0-opt.spvasm.expected.hlsl | 26 + .../0-opt.spvasm.expected.msl | 23 + .../0-opt.spvasm.expected.spvasm | 78 + .../0-opt.spvasm.expected.wgsl | 31 + .../signed_op/glsl_uint_sclamp/0-opt.wgsl | 31 + .../glsl_uint_sclamp/0-opt.wgsl.expected.hlsl | 26 + .../glsl_uint_sclamp/0-opt.wgsl.expected.msl | 23 + .../0-opt.wgsl.expected.spvasm | 78 + .../glsl_uint_sclamp/0-opt.wgsl.expected.wgsl | 31 + .../signed_op/glsl_uint_smax/0-opt.spvasm | 44 + .../glsl_uint_smax/0-opt.spvasm.expected.hlsl | 24 + .../glsl_uint_smax/0-opt.spvasm.expected.msl | 22 + .../0-opt.spvasm.expected.spvasm | 71 + .../glsl_uint_smax/0-opt.spvasm.expected.wgsl | 28 + .../signed_op/glsl_uint_smax/0-opt.wgsl | 28 + .../glsl_uint_smax/0-opt.wgsl.expected.hlsl | 24 + .../glsl_uint_smax/0-opt.wgsl.expected.msl | 22 + .../glsl_uint_smax/0-opt.wgsl.expected.spvasm | 71 + .../glsl_uint_smax/0-opt.wgsl.expected.wgsl | 28 + .../signed_op/glsl_uint_smin/0-opt.spvasm | 44 + .../glsl_uint_smin/0-opt.spvasm.expected.hlsl | 24 + .../glsl_uint_smin/0-opt.spvasm.expected.msl | 22 + .../0-opt.spvasm.expected.spvasm | 71 + .../glsl_uint_smin/0-opt.spvasm.expected.wgsl | 28 + .../signed_op/glsl_uint_smin/0-opt.wgsl | 28 + .../glsl_uint_smin/0-opt.wgsl.expected.hlsl | 24 + .../glsl_uint_smin/0-opt.wgsl.expected.msl | 22 + .../glsl_uint_smin/0-opt.wgsl.expected.spvasm | 71 + .../glsl_uint_smin/0-opt.wgsl.expected.wgsl | 28 + .../compute/signed_op/uint_sdiv/0-opt.spvasm | 43 + .../uint_sdiv/0-opt.spvasm.expected.hlsl | 24 + .../uint_sdiv/0-opt.spvasm.expected.msl | 22 + .../uint_sdiv/0-opt.spvasm.expected.spvasm | 70 + .../uint_sdiv/0-opt.spvasm.expected.wgsl | 28 + .../compute/signed_op/uint_sdiv/0-opt.wgsl | 28 + .../uint_sdiv/0-opt.wgsl.expected.hlsl | 24 + .../uint_sdiv/0-opt.wgsl.expected.msl | 22 + .../uint_sdiv/0-opt.wgsl.expected.spvasm | 70 + .../uint_sdiv/0-opt.wgsl.expected.wgsl | 28 + .../signed_op/uint_snegate/0-opt.spvasm | 39 + .../uint_snegate/0-opt.spvasm.expected.hlsl | 22 + .../uint_snegate/0-opt.spvasm.expected.msl | 21 + .../uint_snegate/0-opt.spvasm.expected.spvasm | 63 + .../uint_snegate/0-opt.spvasm.expected.wgsl | 25 + .../compute/signed_op/uint_snegate/0-opt.wgsl | 25 + .../uint_snegate/0-opt.wgsl.expected.hlsl | 22 + .../uint_snegate/0-opt.wgsl.expected.msl | 21 + .../uint_snegate/0-opt.wgsl.expected.spvasm | 63 + .../uint_snegate/0-opt.wgsl.expected.wgsl | 25 + .../comparison/frexpstruct_1_frag/0.spvasm | 61 + .../frexpstruct_1_frag/0.spvasm.expected.hlsl | 33 + .../frexpstruct_1_frag/0.spvasm.expected.msl | 36 + .../0.spvasm.expected.spvasm | 108 + .../frexpstruct_1_frag/0.spvasm.expected.wgsl | 28 + .../comparison/frexpstruct_1_frag/0.wgsl | 28 + .../frexpstruct_1_frag/0.wgsl.expected.hlsl | 33 + .../frexpstruct_1_frag/0.wgsl.expected.msl | 36 + .../frexpstruct_1_frag/0.wgsl.expected.spvasm | 108 + .../frexpstruct_1_frag/0.wgsl.expected.wgsl | 28 + .../early_fragment/depth_equal/0-opt.spvasm | 46 + .../depth_equal/0-opt.spvasm.expected.hlsl | 28 + .../depth_equal/0-opt.spvasm.expected.msl | 31 + .../depth_equal/0-opt.spvasm.expected.spvasm | 73 + .../depth_equal/0-opt.spvasm.expected.wgsl | 22 + .../early_fragment/depth_equal/0-opt.wgsl | 22 + .../depth_equal/0-opt.wgsl.expected.hlsl | 28 + .../depth_equal/0-opt.wgsl.expected.msl | 31 + .../depth_equal/0-opt.wgsl.expected.spvasm | 73 + .../depth_equal/0-opt.wgsl.expected.wgsl | 22 + .../early_fragment/depth_equal/1.spvasm | 31 + .../depth_equal/1.spvasm.expected.hlsl | 24 + .../depth_equal/1.spvasm.expected.msl | 27 + .../depth_equal/1.spvasm.expected.spvasm | 69 + .../depth_equal/1.spvasm.expected.wgsl | 22 + .../early_fragment/depth_equal/1.wgsl | 22 + .../depth_equal/1.wgsl.expected.hlsl | 24 + .../depth_equal/1.wgsl.expected.msl | 27 + .../depth_equal/1.wgsl.expected.spvasm | 69 + .../depth_equal/1.wgsl.expected.wgsl | 22 + .../early_fragment/depth_greater/0-opt.spvasm | 46 + .../depth_greater/0-opt.spvasm.expected.hlsl | 28 + .../depth_greater/0-opt.spvasm.expected.msl | 31 + .../0-opt.spvasm.expected.spvasm | 73 + .../depth_greater/0-opt.spvasm.expected.wgsl | 22 + .../early_fragment/depth_greater/0-opt.wgsl | 22 + .../depth_greater/0-opt.wgsl.expected.hlsl | 28 + .../depth_greater/0-opt.wgsl.expected.msl | 31 + .../depth_greater/0-opt.wgsl.expected.spvasm | 73 + .../depth_greater/0-opt.wgsl.expected.wgsl | 22 + .../early_fragment/depth_greater/1.spvasm | 32 + .../depth_greater/1.spvasm.expected.hlsl | 24 + .../depth_greater/1.spvasm.expected.msl | 27 + .../depth_greater/1.spvasm.expected.spvasm | 69 + .../depth_greater/1.spvasm.expected.wgsl | 22 + .../early_fragment/depth_greater/1.wgsl | 22 + .../depth_greater/1.wgsl.expected.hlsl | 24 + .../depth_greater/1.wgsl.expected.msl | 27 + .../depth_greater/1.wgsl.expected.spvasm | 69 + .../depth_greater/1.wgsl.expected.wgsl | 22 + .../early_fragment/depth_less/0-opt.spvasm | 46 + .../depth_less/0-opt.spvasm.expected.hlsl | 28 + .../depth_less/0-opt.spvasm.expected.msl | 31 + .../depth_less/0-opt.spvasm.expected.spvasm | 73 + .../depth_less/0-opt.spvasm.expected.wgsl | 22 + .../early_fragment/depth_less/0-opt.wgsl | 22 + .../depth_less/0-opt.wgsl.expected.hlsl | 28 + .../depth_less/0-opt.wgsl.expected.msl | 31 + .../depth_less/0-opt.wgsl.expected.spvasm | 73 + .../depth_less/0-opt.wgsl.expected.wgsl | 22 + .../depth_less_or_equal/1.spvasm | 31 + .../1.spvasm.expected.hlsl | 24 + .../depth_less_or_equal/1.spvasm.expected.msl | 27 + .../1.spvasm.expected.spvasm | 69 + .../1.spvasm.expected.wgsl | 22 + .../early_fragment/depth_less_or_equal/1.wgsl | 22 + .../depth_less_or_equal/1.wgsl.expected.hlsl | 24 + .../depth_less_or_equal/1.wgsl.expected.msl | 27 + .../1.wgsl.expected.spvasm | 69 + .../depth_less_or_equal/1.wgsl.expected.wgsl | 22 + .../depth_not_equal/0-opt.spvasm | 46 + .../0-opt.spvasm.expected.hlsl | 28 + .../depth_not_equal/0-opt.spvasm.expected.msl | 31 + .../0-opt.spvasm.expected.spvasm | 73 + .../0-opt.spvasm.expected.wgsl | 22 + .../early_fragment/depth_not_equal/0-opt.wgsl | 22 + .../depth_not_equal/0-opt.wgsl.expected.hlsl | 28 + .../depth_not_equal/0-opt.wgsl.expected.msl | 31 + .../0-opt.wgsl.expected.spvasm | 73 + .../depth_not_equal/0-opt.wgsl.expected.wgsl | 22 + .../early_fragment/depth_not_equal/1.spvasm | 31 + .../depth_not_equal/1.spvasm.expected.hlsl | 24 + .../depth_not_equal/1.spvasm.expected.msl | 27 + .../depth_not_equal/1.spvasm.expected.spvasm | 69 + .../depth_not_equal/1.spvasm.expected.wgsl | 22 + .../early_fragment/depth_not_equal/1.wgsl | 22 + .../depth_not_equal/1.wgsl.expected.hlsl | 24 + .../depth_not_equal/1.wgsl.expected.msl | 27 + .../depth_not_equal/1.wgsl.expected.spvasm | 69 + .../depth_not_equal/1.wgsl.expected.wgsl | 22 + .../depthgreater_1/0-opt.spvasm | 46 + .../depthgreater_1/0-opt.spvasm.expected.hlsl | 28 + .../depthgreater_1/0-opt.spvasm.expected.msl | 31 + .../0-opt.spvasm.expected.spvasm | 73 + .../depthgreater_1/0-opt.spvasm.expected.wgsl | 22 + .../execution_mode/depthgreater_1/0-opt.wgsl | 22 + .../depthgreater_1/0-opt.wgsl.expected.hlsl | 28 + .../depthgreater_1/0-opt.wgsl.expected.msl | 31 + .../depthgreater_1/0-opt.wgsl.expected.spvasm | 73 + .../depthgreater_1/0-opt.wgsl.expected.wgsl | 22 + .../depthgreater_2/0-opt.spvasm | 46 + .../depthgreater_2/0-opt.spvasm.expected.hlsl | 28 + .../depthgreater_2/0-opt.spvasm.expected.msl | 31 + .../0-opt.spvasm.expected.spvasm | 73 + .../depthgreater_2/0-opt.spvasm.expected.wgsl | 22 + .../execution_mode/depthgreater_2/0-opt.wgsl | 22 + .../depthgreater_2/0-opt.wgsl.expected.hlsl | 28 + .../depthgreater_2/0-opt.wgsl.expected.msl | 31 + .../depthgreater_2/0-opt.wgsl.expected.spvasm | 73 + .../depthgreater_2/0-opt.wgsl.expected.wgsl | 22 + .../execution_mode/depthgreater_2/1.spvasm | 30 + .../depthgreater_2/1.spvasm.expected.hlsl | 24 + .../depthgreater_2/1.spvasm.expected.msl | 27 + .../depthgreater_2/1.spvasm.expected.spvasm | 68 + .../depthgreater_2/1.spvasm.expected.wgsl | 22 + .../execution_mode/depthgreater_2/1.wgsl | 22 + .../depthgreater_2/1.wgsl.expected.hlsl | 24 + .../depthgreater_2/1.wgsl.expected.msl | 27 + .../depthgreater_2/1.wgsl.expected.spvasm | 68 + .../depthgreater_2/1.wgsl.expected.wgsl | 22 + .../execution_mode/depthless_0/1.spvasm | 30 + .../depthless_0/1.spvasm.expected.hlsl | 24 + .../depthless_0/1.spvasm.expected.msl | 27 + .../depthless_0/1.spvasm.expected.spvasm | 68 + .../depthless_0/1.spvasm.expected.wgsl | 22 + .../execution_mode/depthless_0/1.wgsl | 22 + .../depthless_0/1.wgsl.expected.hlsl | 24 + .../depthless_0/1.wgsl.expected.msl | 27 + .../depthless_0/1.wgsl.expected.spvasm | 68 + .../depthless_0/1.wgsl.expected.wgsl | 22 + .../execution_mode/depthless_2/1.spvasm | 30 + .../depthless_2/1.spvasm.expected.hlsl | 24 + .../depthless_2/1.spvasm.expected.msl | 27 + .../depthless_2/1.spvasm.expected.spvasm | 68 + .../depthless_2/1.spvasm.expected.wgsl | 22 + .../execution_mode/depthless_2/1.wgsl | 22 + .../depthless_2/1.wgsl.expected.hlsl | 24 + .../depthless_2/1.wgsl.expected.msl | 27 + .../depthless_2/1.wgsl.expected.spvasm | 68 + .../depthless_2/1.wgsl.expected.wgsl | 22 + .../execution_mode/depthunchanged_0/1.spvasm | 38 + .../depthunchanged_0/1.spvasm.expected.hlsl | 31 + .../depthunchanged_0/1.spvasm.expected.msl | 30 + .../depthunchanged_0/1.spvasm.expected.spvasm | 79 + .../depthunchanged_0/1.spvasm.expected.wgsl | 26 + .../execution_mode/depthunchanged_0/1.wgsl | 26 + .../depthunchanged_0/1.wgsl.expected.hlsl | 31 + .../depthunchanged_0/1.wgsl.expected.msl | 30 + .../depthunchanged_0/1.wgsl.expected.spvasm | 79 + .../depthunchanged_0/1.wgsl.expected.wgsl | 26 + .../execution_mode/depthunchanged_2/1.spvasm | 30 + .../depthunchanged_2/1.spvasm.expected.hlsl | 24 + .../depthunchanged_2/1.spvasm.expected.msl | 27 + .../depthunchanged_2/1.spvasm.expected.spvasm | 68 + .../depthunchanged_2/1.spvasm.expected.wgsl | 22 + .../execution_mode/depthunchanged_2/1.wgsl | 22 + .../depthunchanged_2/1.wgsl.expected.hlsl | 24 + .../depthunchanged_2/1.wgsl.expected.msl | 27 + .../depthunchanged_2/1.wgsl.expected.spvasm | 68 + .../depthunchanged_2/1.wgsl.expected.wgsl | 22 + .../execution_mode/depthunchanged_3/1.spvasm | 30 + .../depthunchanged_3/1.spvasm.expected.hlsl | 24 + .../depthunchanged_3/1.spvasm.expected.msl | 27 + .../depthunchanged_3/1.spvasm.expected.spvasm | 68 + .../depthunchanged_3/1.spvasm.expected.wgsl | 22 + .../execution_mode/depthunchanged_3/1.wgsl | 22 + .../depthunchanged_3/1.wgsl.expected.hlsl | 24 + .../depthunchanged_3/1.wgsl.expected.msl | 27 + .../depthunchanged_3/1.wgsl.expected.spvasm | 68 + .../depthunchanged_3/1.wgsl.expected.wgsl | 22 + .../decorate_string/0.spvasm | 48 + .../decorate_string/0.spvasm.expected.hlsl | 30 + .../decorate_string/0.spvasm.expected.msl | 34 + .../decorate_string/0.spvasm.expected.spvasm | 82 + .../decorate_string/0.spvasm.expected.wgsl | 26 + .../decorate_string/0.wgsl | 26 + .../decorate_string/0.wgsl.expected.hlsl | 30 + .../decorate_string/0.wgsl.expected.msl | 34 + .../decorate_string/0.wgsl.expected.spvasm | 82 + .../decorate_string/0.wgsl.expected.wgsl | 26 + .../no_image_atomic/0-opt.spvasm | 36 + .../0-opt.spvasm.expected.hlsl | 34 + .../no_image_atomic/0-opt.spvasm.expected.msl | 38 + .../0-opt.spvasm.expected.spvasm | 97 + .../0-opt.spvasm.expected.wgsl | 29 + .../no_image_atomic/0-opt.wgsl | 29 + .../no_image_atomic/0-opt.wgsl.expected.hlsl | 34 + .../no_image_atomic/0-opt.wgsl.expected.msl | 38 + .../0-opt.wgsl.expected.spvasm | 97 + .../no_image_atomic/0-opt.wgsl.expected.wgsl | 29 + .../no_image_store/1.spvasm | 58 + .../no_image_store/1.spvasm.expected.hlsl | 37 + .../no_image_store/1.spvasm.expected.msl | 38 + .../no_image_store/1.spvasm.expected.spvasm | 104 + .../no_image_store/1.spvasm.expected.wgsl | 32 + .../no_image_store/1.wgsl | 32 + .../no_image_store/1.wgsl.expected.hlsl | 37 + .../no_image_store/1.wgsl.expected.msl | 38 + .../no_image_store/1.wgsl.expected.spvasm | 104 + .../no_image_store/1.wgsl.expected.wgsl | 32 + .../no_output_write/1.spvasm | 45 + .../no_output_write/1.spvasm.expected.hlsl | 33 + .../no_output_write/1.spvasm.expected.msl | 35 + .../no_output_write/1.spvasm.expected.spvasm | 90 + .../no_output_write/1.spvasm.expected.wgsl | 27 + .../no_output_write/1.wgsl | 27 + .../no_output_write/1.wgsl.expected.hlsl | 33 + .../no_output_write/1.wgsl.expected.msl | 35 + .../no_output_write/1.wgsl.expected.spvasm | 90 + .../no_output_write/1.wgsl.expected.wgsl | 27 + .../no_output_write/2-opt.spvasm | 53 + .../2-opt.spvasm.expected.hlsl | 36 + .../no_output_write/2-opt.spvasm.expected.msl | 33 + .../2-opt.spvasm.expected.spvasm | 95 + .../2-opt.spvasm.expected.wgsl | 28 + .../no_output_write/2-opt.wgsl | 28 + .../no_output_write/2-opt.wgsl.expected.hlsl | 36 + .../no_output_write/2-opt.wgsl.expected.msl | 33 + .../2-opt.wgsl.expected.spvasm | 95 + .../no_output_write/2-opt.wgsl.expected.wgsl | 28 + .../no_output_write_before_terminate/1.spvasm | 45 + .../1.spvasm.expected.hlsl | 34 + .../1.spvasm.expected.msl | 35 + .../1.spvasm.expected.spvasm | 90 + .../1.spvasm.expected.wgsl | 27 + .../no_output_write_before_terminate/1.wgsl | 27 + .../1.wgsl.expected.hlsl | 34 + .../1.wgsl.expected.msl | 35 + .../1.wgsl.expected.spvasm | 90 + .../1.wgsl.expected.wgsl | 27 + .../no_ssbo_store/1.spvasm | 62 + .../no_ssbo_store/1.spvasm.expected.hlsl | 37 + .../no_ssbo_store/1.spvasm.expected.msl | 41 + .../no_ssbo_store/1.spvasm.expected.spvasm | 110 + .../no_ssbo_store/1.spvasm.expected.wgsl | 39 + .../terminate_invocation/no_ssbo_store/1.wgsl | 39 + .../no_ssbo_store/1.wgsl.expected.hlsl | 37 + .../no_ssbo_store/1.wgsl.expected.msl | 41 + .../no_ssbo_store/1.wgsl.expected.spvasm | 110 + .../no_ssbo_store/1.wgsl.expected.wgsl | 39 + .../ssbo_store_before_terminate/1.spvasm | 62 + .../1.spvasm.expected.hlsl | 38 + .../1.spvasm.expected.msl | 41 + .../1.spvasm.expected.spvasm | 110 + .../1.spvasm.expected.wgsl | 39 + .../ssbo_store_before_terminate/1.wgsl | 39 + .../1.wgsl.expected.hlsl | 38 + .../1.wgsl.expected.msl | 41 + .../1.wgsl.expected.spvasm | 110 + .../1.wgsl.expected.wgsl | 39 + .../terminate_loop/1.spvasm | 57 + .../terminate_loop/1.spvasm.expected.hlsl | 48 + .../terminate_loop/1.spvasm.expected.msl | 49 + .../terminate_loop/1.spvasm.expected.spvasm | 123 ++ .../terminate_loop/1.spvasm.expected.wgsl | 42 + .../terminate_loop/1.wgsl | 42 + .../terminate_loop/1.wgsl.expected.hlsl | 48 + .../terminate_loop/1.wgsl.expected.msl | 49 + .../terminate_loop/1.wgsl.expected.spvasm | 123 ++ .../terminate_loop/1.wgsl.expected.wgsl | 42 + .../subgroup_reconverge_discard00/0.spvasm | 45 + .../0.spvasm.expected.hlsl | 27 + .../0.spvasm.expected.msl | 30 + .../0.spvasm.expected.spvasm | 72 + .../0.spvasm.expected.wgsl | 21 + .../subgroup_reconverge_discard00/0.wgsl | 21 + .../0.wgsl.expected.hlsl | 27 + .../0.wgsl.expected.msl | 30 + .../0.wgsl.expected.spvasm | 72 + .../0.wgsl.expected.wgsl | 21 + .../2-opt.spvasm | 55 + .../2-opt.spvasm.expected.hlsl | 38 + .../2-opt.spvasm.expected.msl | 39 + .../2-opt.spvasm.expected.spvasm | 97 + .../2-opt.spvasm.expected.wgsl | 34 + .../subgroup_reconverge_discard00/2-opt.wgsl | 34 + .../2-opt.wgsl.expected.hlsl | 38 + .../2-opt.wgsl.expected.msl | 39 + .../2-opt.wgsl.expected.spvasm | 97 + .../2-opt.wgsl.expected.wgsl | 34 + .../texture/subgroup_lod/texel_fetch/1.spvasm | 25 + .../texel_fetch/1.spvasm.expected.hlsl | 26 + .../texel_fetch/1.spvasm.expected.msl | 30 + .../texel_fetch/1.spvasm.expected.spvasm | 59 + .../texel_fetch/1.spvasm.expected.wgsl | 21 + .../texture/subgroup_lod/texel_fetch/1.wgsl | 21 + .../texel_fetch/1.wgsl.expected.hlsl | 26 + .../texel_fetch/1.wgsl.expected.msl | 30 + .../texel_fetch/1.wgsl.expected.spvasm | 59 + .../texel_fetch/1.wgsl.expected.wgsl | 21 + .../texel_offset/texel_offset/0-opt.spvasm | 39 + .../texel_offset/0-opt.spvasm.expected.hlsl | 28 + .../texel_offset/0-opt.spvasm.expected.msl | 27 + .../texel_offset/0-opt.spvasm.expected.spvasm | 74 + .../texel_offset/0-opt.spvasm.expected.wgsl | 22 + .../texel_offset/texel_offset/0-opt.wgsl | 22 + .../texel_offset/0-opt.wgsl.expected.hlsl | 28 + .../texel_offset/0-opt.wgsl.expected.msl | 27 + .../texel_offset/0-opt.wgsl.expected.spvasm | 74 + .../texel_offset/0-opt.wgsl.expected.wgsl | 22 + 5160 files changed, 621458 insertions(+) create mode 100644 test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm create mode 100644 test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl create mode 100644 test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/1.spvasm create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/1.wgsl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm create mode 100755 test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl create mode 100755 test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl create mode 100755 test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm create mode 100755 test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl create mode 100755 test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm create mode 100755 test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl create mode 100755 test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm create mode 100755 test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.hlsl create mode 100755 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm create mode 100755 test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl create mode 100755 test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm create mode 100755 test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl create mode 100755 test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm create mode 100755 test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl create mode 100755 test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm create mode 100755 test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl create mode 100755 test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm create mode 100755 test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl create mode 100755 test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl create mode 100644 test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.msl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.msl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm create mode 100644 test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.msl create mode 100644 test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl create mode 100644 test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.msl create mode 100644 test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.wgsl create mode 100644 test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm create mode 100644 test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.hlsl create mode 100644 test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.msl create mode 100644 test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.spvasm create mode 100644 test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.wgsl create mode 100644 test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl create mode 100644 test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.hlsl create mode 100644 test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.msl create mode 100644 test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.spvasm create mode 100644 test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.wgsl diff --git a/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm new file mode 100644 index 0000000000..ec35bd55f4 --- /dev/null +++ b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm @@ -0,0 +1,75 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %result "result" + OpMemberName %result 0 "res0" + OpMemberName %result 1 "res1" + OpMemberName %result 2 "res2" + OpName %_ "" + OpName %block0 "block0" + OpMemberName %block0 0 "data0" + OpName %__0 "" + OpName %block1 "block1" + OpMemberName %block1 0 "data1" + OpName %__1 "" + OpName %block2 "block2" + OpMemberName %block2 0 "data2" + OpName %__2 "" + OpMemberDecorate %result 0 Offset 0 + OpMemberDecorate %result 1 Offset 4 + OpMemberDecorate %result 2 Offset 8 + OpDecorate %result Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 3 + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %block1 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 1 + OpMemberDecorate %block2 0 Offset 0 + OpDecorate %block2 Block + OpDecorate %__2 DescriptorSet 0 + OpDecorate %__2 Binding 2 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %result = OpTypeStruct %int %int %int +%_ptr_StorageBuffer_result = OpTypePointer StorageBuffer %result + %_ = OpVariable %_ptr_StorageBuffer_result StorageBuffer + %int_0 = OpConstant %int 0 + %block0 = OpTypeStruct %int +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %__0 = OpVariable %_ptr_Uniform_block0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 + %block1 = OpTypeStruct %int +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %__1 = OpVariable %_ptr_Uniform_block1 Uniform + %int_2 = OpConstant %int 2 + %block2 = OpTypeStruct %int +%_ptr_Uniform_block2 = OpTypePointer Uniform %block2 + %__2 = OpVariable %_ptr_Uniform_block2 Uniform + %main = OpFunction %void None %12 + %23 = OpLabel + %24 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 + %25 = OpLoad %int %24 + %26 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 + OpStore %26 %25 + %27 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 + %28 = OpLoad %int %27 + %29 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_1 + OpStore %29 %28 + %30 = OpAccessChain %_ptr_Uniform_int %__2 %int_0 + %31 = OpLoad %int %30 + %32 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_2 + OpStore %32 %31 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.hlsl b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..970956bc6f --- /dev/null +++ b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.hlsl @@ -0,0 +1,26 @@ +RWByteAddressBuffer x_4 : register(u3, space0); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_10 : register(b2, space0) { + uint4 x_10[1]; +}; + +void main_1() { + const int x_25 = asint(x_6[0].x); + x_4.Store(0u, asuint(x_25)); + const int x_28 = asint(x_8[0].x); + x_4.Store(4u, asuint(x_28)); + const int x_31 = asint(x_10[0].x); + x_4.Store(8u, asuint(x_31)); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.msl b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.msl new file mode 100644 index 0000000000..396f33d09f --- /dev/null +++ b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct result { + /* 0x0000 */ int res0; + /* 0x0004 */ int res1; + /* 0x0008 */ int res2; +}; +struct block0 { + /* 0x0000 */ int data0; +}; +struct block1 { + /* 0x0000 */ int data1; +}; +struct block2 { + /* 0x0000 */ int data2; +}; + +void main_1(constant block0& x_6, constant block1& x_8, constant block2& x_10, device result& x_4) { + int const x_25 = x_6.data0; + x_4.res0 = x_25; + int const x_28 = x_8.data1; + x_4.res1 = x_28; + int const x_31 = x_10.data2; + x_4.res2 = x_31; + return; +} + +kernel void tint_symbol(constant block0& x_6 [[buffer(0)]], constant block1& x_8 [[buffer(1)]], constant block2& x_10 [[buffer(2)]], device result& x_4 [[buffer(3)]]) { + main_1(x_6, x_8, x_10, x_4); + return; +} + diff --git a/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.spvasm b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..bd8b189316 --- /dev/null +++ b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %result "result" + OpMemberName %result 0 "res0" + OpMemberName %result 1 "res1" + OpMemberName %result 2 "res2" + OpName %x_4 "x_4" + OpName %block0 "block0" + OpMemberName %block0 0 "data0" + OpName %x_6 "x_6" + OpName %block1 "block1" + OpMemberName %block1 0 "data1" + OpName %x_8 "x_8" + OpName %block2 "block2" + OpMemberName %block2 0 "data2" + OpName %x_10 "x_10" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %result Block + OpMemberDecorate %result 0 Offset 0 + OpMemberDecorate %result 1 Offset 4 + OpMemberDecorate %result 2 Offset 8 + OpDecorate %x_4 DescriptorSet 0 + OpDecorate %x_4 Binding 3 + OpDecorate %block0 Block + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %block1 Block + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %block2 Block + OpMemberDecorate %block2 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 2 + %int = OpTypeInt 32 1 + %result = OpTypeStruct %int %int %int +%_ptr_StorageBuffer_result = OpTypePointer StorageBuffer %result + %x_4 = OpVariable %_ptr_StorageBuffer_result StorageBuffer + %block0 = OpTypeStruct %int +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %x_6 = OpVariable %_ptr_Uniform_block0 Uniform + %block1 = OpTypeStruct %int +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %x_8 = OpVariable %_ptr_Uniform_block1 Uniform + %block2 = OpTypeStruct %int +%_ptr_Uniform_block2 = OpTypePointer Uniform %block2 + %x_10 = OpVariable %_ptr_Uniform_block2 Uniform + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %22 = OpLoad %int %21 + %24 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_0 + OpStore %24 %22 + %25 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %26 = OpLoad %int %25 + %28 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_1 + OpStore %28 %26 + %29 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 + %30 = OpLoad %int %29 + %32 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_2 + OpStore %32 %30 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %34 = OpLabel + %35 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.wgsl b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..7f8a2d7b6b --- /dev/null +++ b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.spvasm.expected.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct result { + res0 : i32; + res1 : i32; + res2 : i32; +}; + +[[block]] +struct block0 { + data0 : i32; +}; + +[[block]] +struct block1 { + data1 : i32; +}; + +[[block]] +struct block2 { + data2 : i32; +}; + +[[group(0), binding(3)]] var x_4 : result; + +[[group(0), binding(0)]] var x_6 : block0; + +[[group(0), binding(1)]] var x_8 : block1; + +[[group(0), binding(2)]] var x_10 : block2; + +fn main_1() { + let x_25 : i32 = x_6.data0; + x_4.res0 = x_25; + let x_28 : i32 = x_8.data1; + x_4.res1 = x_28; + let x_31 : i32 = x_10.data2; + x_4.res2 = x_31; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl new file mode 100644 index 0000000000..7f8a2d7b6b --- /dev/null +++ b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct result { + res0 : i32; + res1 : i32; + res2 : i32; +}; + +[[block]] +struct block0 { + data0 : i32; +}; + +[[block]] +struct block1 { + data1 : i32; +}; + +[[block]] +struct block2 { + data2 : i32; +}; + +[[group(0), binding(3)]] var x_4 : result; + +[[group(0), binding(0)]] var x_6 : block0; + +[[group(0), binding(1)]] var x_8 : block1; + +[[group(0), binding(2)]] var x_10 : block2; + +fn main_1() { + let x_25 : i32 = x_6.data0; + x_4.res0 = x_25; + let x_28 : i32 = x_8.data1; + x_4.res1 = x_28; + let x_31 : i32 = x_10.data2; + x_4.res2 = x_31; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.hlsl b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..970956bc6f --- /dev/null +++ b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +RWByteAddressBuffer x_4 : register(u3, space0); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_10 : register(b2, space0) { + uint4 x_10[1]; +}; + +void main_1() { + const int x_25 = asint(x_6[0].x); + x_4.Store(0u, asuint(x_25)); + const int x_28 = asint(x_8[0].x); + x_4.Store(4u, asuint(x_28)); + const int x_31 = asint(x_10[0].x); + x_4.Store(8u, asuint(x_31)); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.msl b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.msl new file mode 100644 index 0000000000..396f33d09f --- /dev/null +++ b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct result { + /* 0x0000 */ int res0; + /* 0x0004 */ int res1; + /* 0x0008 */ int res2; +}; +struct block0 { + /* 0x0000 */ int data0; +}; +struct block1 { + /* 0x0000 */ int data1; +}; +struct block2 { + /* 0x0000 */ int data2; +}; + +void main_1(constant block0& x_6, constant block1& x_8, constant block2& x_10, device result& x_4) { + int const x_25 = x_6.data0; + x_4.res0 = x_25; + int const x_28 = x_8.data1; + x_4.res1 = x_28; + int const x_31 = x_10.data2; + x_4.res2 = x_31; + return; +} + +kernel void tint_symbol(constant block0& x_6 [[buffer(0)]], constant block1& x_8 [[buffer(1)]], constant block2& x_10 [[buffer(2)]], device result& x_4 [[buffer(3)]]) { + main_1(x_6, x_8, x_10, x_4); + return; +} + diff --git a/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.spvasm b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..bd8b189316 --- /dev/null +++ b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %result "result" + OpMemberName %result 0 "res0" + OpMemberName %result 1 "res1" + OpMemberName %result 2 "res2" + OpName %x_4 "x_4" + OpName %block0 "block0" + OpMemberName %block0 0 "data0" + OpName %x_6 "x_6" + OpName %block1 "block1" + OpMemberName %block1 0 "data1" + OpName %x_8 "x_8" + OpName %block2 "block2" + OpMemberName %block2 0 "data2" + OpName %x_10 "x_10" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %result Block + OpMemberDecorate %result 0 Offset 0 + OpMemberDecorate %result 1 Offset 4 + OpMemberDecorate %result 2 Offset 8 + OpDecorate %x_4 DescriptorSet 0 + OpDecorate %x_4 Binding 3 + OpDecorate %block0 Block + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %block1 Block + OpMemberDecorate %block1 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %block2 Block + OpMemberDecorate %block2 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 2 + %int = OpTypeInt 32 1 + %result = OpTypeStruct %int %int %int +%_ptr_StorageBuffer_result = OpTypePointer StorageBuffer %result + %x_4 = OpVariable %_ptr_StorageBuffer_result StorageBuffer + %block0 = OpTypeStruct %int +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %x_6 = OpVariable %_ptr_Uniform_block0 Uniform + %block1 = OpTypeStruct %int +%_ptr_Uniform_block1 = OpTypePointer Uniform %block1 + %x_8 = OpVariable %_ptr_Uniform_block1 Uniform + %block2 = OpTypeStruct %int +%_ptr_Uniform_block2 = OpTypePointer Uniform %block2 + %x_10 = OpVariable %_ptr_Uniform_block2 Uniform + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %22 = OpLoad %int %21 + %24 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_0 + OpStore %24 %22 + %25 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %26 = OpLoad %int %25 + %28 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_1 + OpStore %28 %26 + %29 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 + %30 = OpLoad %int %29 + %32 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_2 + OpStore %32 %30 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %34 = OpLabel + %35 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.wgsl b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..7f8a2d7b6b --- /dev/null +++ b/test/vk-gl-cts/api/descriptor_set/descriptor_set_layout_binding/layout_binding_order/0.wgsl.expected.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct result { + res0 : i32; + res1 : i32; + res2 : i32; +}; + +[[block]] +struct block0 { + data0 : i32; +}; + +[[block]] +struct block1 { + data1 : i32; +}; + +[[block]] +struct block2 { + data2 : i32; +}; + +[[group(0), binding(3)]] var x_4 : result; + +[[group(0), binding(0)]] var x_6 : block0; + +[[group(0), binding(1)]] var x_8 : block1; + +[[group(0), binding(2)]] var x_10 : block2; + +fn main_1() { + let x_25 : i32 = x_6.data0; + x_4.res0 = x_25; + let x_28 : i32 = x_8.data1; + x_4.res1 = x_28; + let x_31 : i32 = x_10.data2; + x_4.res2 = x_31; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm new file mode 100644 index 0000000000..1fb15a693e --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm @@ -0,0 +1,35 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %block0 "block0" + OpMemberName %block0 0 "data" + OpName %_ "" + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %block0 = OpTypeStruct %v4float +%_ptr_StorageBuffer_block0 = OpTypePointer StorageBuffer %block0 + %_ = OpVariable %_ptr_StorageBuffer_block0 StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %16 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %main = OpFunction %void None %6 + %18 = OpLabel + %19 = OpAccessChain %_ptr_StorageBuffer_v4float %_ %int_0 + OpStore %19 %16 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.hlsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..a5513da4d9 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.hlsl @@ -0,0 +1,12 @@ +RWByteAddressBuffer x_4 : register(u1, space0); + +void main_1() { + x_4.Store4(0u, asuint(float4(1.0f, 2.0f, 3.0f, 4.0f))); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.msl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.msl new file mode 100644 index 0000000000..a410fd83b3 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +using namespace metal; +struct block0 { + /* 0x0000 */ packed_float4 data; +}; + +void main_1(device block0& x_4) { + x_4.data = float4(1.0f, 2.0f, 3.0f, 4.0f); + return; +} + +kernel void tint_symbol(device block0& x_4 [[buffer(1)]]) { + main_1(x_4); + return; +} + diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.spvasm b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..9494d1face --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %block0 "block0" + OpMemberName %block0 0 "data" + OpName %x_4 "x_4" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %block0 Block + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %x_4 DescriptorSet 0 + OpDecorate %x_4 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %block0 = OpTypeStruct %v4float +%_ptr_StorageBuffer_block0 = OpTypePointer StorageBuffer %block0 + %x_4 = OpVariable %_ptr_StorageBuffer_block0 StorageBuffer + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %main_1 = OpFunction %void None %6 + %9 = OpLabel + %13 = OpAccessChain %_ptr_StorageBuffer_v4float %x_4 %uint_0 + OpStore %13 %18 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.wgsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..40325a2ff5 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +[[block]] +struct block0 { + data : vec4; +}; + +[[group(0), binding(1)]] var x_4 : block0; + +fn main_1() { + x_4.data = vec4(1.0, 2.0, 3.0, 4.0); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl new file mode 100644 index 0000000000..40325a2ff5 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl @@ -0,0 +1,16 @@ +[[block]] +struct block0 { + data : vec4; +}; + +[[group(0), binding(1)]] var x_4 : block0; + +fn main_1() { + x_4.data = vec4(1.0, 2.0, 3.0, 4.0); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.hlsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..a5513da4d9 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +RWByteAddressBuffer x_4 : register(u1, space0); + +void main_1() { + x_4.Store4(0u, asuint(float4(1.0f, 2.0f, 3.0f, 4.0f))); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.msl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.msl new file mode 100644 index 0000000000..a410fd83b3 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.msl @@ -0,0 +1,17 @@ +#include + +using namespace metal; +struct block0 { + /* 0x0000 */ packed_float4 data; +}; + +void main_1(device block0& x_4) { + x_4.data = float4(1.0f, 2.0f, 3.0f, 4.0f); + return; +} + +kernel void tint_symbol(device block0& x_4 [[buffer(1)]]) { + main_1(x_4); + return; +} + diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.spvasm b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..9494d1face --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.spvasm @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %block0 "block0" + OpMemberName %block0 0 "data" + OpName %x_4 "x_4" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %block0 Block + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %x_4 DescriptorSet 0 + OpDecorate %x_4 Binding 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %block0 = OpTypeStruct %v4float +%_ptr_StorageBuffer_block0 = OpTypePointer StorageBuffer %block0 + %x_4 = OpVariable %_ptr_StorageBuffer_block0 StorageBuffer + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %main_1 = OpFunction %void None %6 + %9 = OpLabel + %13 = OpAccessChain %_ptr_StorageBuffer_v4float %x_4 %uint_0 + OpStore %13 %18 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.wgsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..40325a2ff5 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_compute/0.wgsl.expected.wgsl @@ -0,0 +1,16 @@ +[[block]] +struct block0 { + data : vec4; +}; + +[[group(0), binding(1)]] var x_4 : block0; + +fn main_1() { + x_4.data = vec4(1.0, 2.0, 3.0, 4.0); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm new file mode 100644 index 0000000000..3747c383c9 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm @@ -0,0 +1,56 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %position %frag_color + OpSource GLSL 430 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %_ "" + OpName %position "position" + OpName %frag_color "frag_color" + OpName %block0 "block0" + OpMemberName %block0 0 "in_color" + OpName %__0 "" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %position Location 0 + OpDecorate %frag_color Location 0 + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %block0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %position = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %frag_color = OpVariable %_ptr_Output_v4float Output + %block0 = OpTypeStruct %v4float +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %__0 = OpVariable %_ptr_Uniform_block0 Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %main = OpFunction %void None %10 + %23 = OpLabel + %24 = OpLoad %v4float %position + %25 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %25 %24 + %26 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 + %27 = OpLoad %v4float %26 + OpStore %frag_color %27 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.hlsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..3b1f34af37 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.hlsl @@ -0,0 +1,34 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + gl_Position = position; + const float4 x_27 = asfloat(x_8[0]); + frag_color = x_27; + return; +} + +struct main_out { + float4 gl_Position; + float4 frag_color_1; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position, frag_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.msl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.msl new file mode 100644 index 0000000000..de2d334c65 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct block0 { + /* 0x0000 */ packed_float4 in_color; +}; +struct main_out { + float4 gl_Position; + float4 frag_color_1; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void main_1(constant block0& x_8, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + float4 const x_24 = *(tint_symbol_6); + *(tint_symbol_7) = x_24; + float4 const x_27 = x_8.in_color; + *(tint_symbol_8) = x_27; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant block0& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_9 = position_param; + main_1(x_8, &(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_10, .frag_color_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.spvasm b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..a0529db081 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %frag_color "frag_color" + OpName %block0 "block0" + OpMemberName %block0 0 "in_color" + OpName %x_8 "x_8" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpMemberName %main_out 1 "frag_color_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %block0 Block + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 + %frag_color = OpVariable %_ptr_Private_v4float Private %8 + %block0 = OpTypeStruct %v4float +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %x_8 = OpVariable %_ptr_Uniform_block0 Uniform +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %main_out = OpTypeStruct %v4float %v4float + %29 = OpTypeFunction %void %main_out + %float_1 = OpConstant %float 1 + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %23 = OpLoad %v4float %position + OpStore %gl_Position %23 + %27 = OpAccessChain %_ptr_Uniform_v4float %x_8 %uint_0 + %28 = OpLoad %v4float %27 + OpStore %frag_color %28 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %29 +%tint_symbol_1 = OpFunctionParameter %main_out + %33 = OpLabel + %34 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %34 + %35 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %35 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %37 = OpLabel + OpStore %tint_pointsize %float_1 + %39 = OpLoad %v4float %tint_symbol + OpStore %position %39 + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %gl_Position + %43 = OpLoad %v4float %frag_color + %44 = OpCompositeConstruct %main_out %42 %43 + %41 = OpFunctionCall %void %tint_symbol_4 %44 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.wgsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..1b98faea09 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.spvasm.expected.wgsl @@ -0,0 +1,34 @@ +[[block]] +struct block0 { + in_color : vec4; +}; + +var position : vec4; + +var frag_color : vec4; + +[[group(0), binding(1)]] var x_8 : block0; + +var gl_Position : vec4; + +fn main_1() { + let x_24 : vec4 = position; + gl_Position = x_24; + let x_27 : vec4 = x_8.in_color; + frag_color = x_27; + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; + [[location(0)]] + frag_color_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position, frag_color); +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl new file mode 100644 index 0000000000..1b98faea09 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl @@ -0,0 +1,34 @@ +[[block]] +struct block0 { + in_color : vec4; +}; + +var position : vec4; + +var frag_color : vec4; + +[[group(0), binding(1)]] var x_8 : block0; + +var gl_Position : vec4; + +fn main_1() { + let x_24 : vec4 = position; + gl_Position = x_24; + let x_27 : vec4 = x_8.in_color; + frag_color = x_27; + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; + [[location(0)]] + frag_color_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position, frag_color); +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.hlsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..3b1f34af37 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + gl_Position = position; + const float4 x_27 = asfloat(x_8[0]); + frag_color = x_27; + return; +} + +struct main_out { + float4 gl_Position; + float4 frag_color_1; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position, frag_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.msl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.msl new file mode 100644 index 0000000000..de2d334c65 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct block0 { + /* 0x0000 */ packed_float4 in_color; +}; +struct main_out { + float4 gl_Position; + float4 frag_color_1; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void main_1(constant block0& x_8, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + float4 const x_24 = *(tint_symbol_6); + *(tint_symbol_7) = x_24; + float4 const x_27 = x_8.in_color; + *(tint_symbol_8) = x_27; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant block0& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_9 = position_param; + main_1(x_8, &(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_10, .frag_color_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.spvasm b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..a0529db081 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %frag_color "frag_color" + OpName %block0 "block0" + OpMemberName %block0 0 "in_color" + OpName %x_8 "x_8" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpMemberName %main_out 1 "frag_color_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %block0 Block + OpMemberDecorate %block0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 + %frag_color = OpVariable %_ptr_Private_v4float Private %8 + %block0 = OpTypeStruct %v4float +%_ptr_Uniform_block0 = OpTypePointer Uniform %block0 + %x_8 = OpVariable %_ptr_Uniform_block0 Uniform +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %main_out = OpTypeStruct %v4float %v4float + %29 = OpTypeFunction %void %main_out + %float_1 = OpConstant %float 1 + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %23 = OpLoad %v4float %position + OpStore %gl_Position %23 + %27 = OpAccessChain %_ptr_Uniform_v4float %x_8 %uint_0 + %28 = OpLoad %v4float %27 + OpStore %frag_color %28 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %29 +%tint_symbol_1 = OpFunctionParameter %main_out + %33 = OpLabel + %34 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %34 + %35 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %35 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %37 = OpLabel + OpStore %tint_pointsize %float_1 + %39 = OpLoad %v4float %tint_symbol + OpStore %position %39 + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %gl_Position + %43 = OpLoad %v4float %frag_color + %44 = OpCompositeConstruct %main_out %42 %43 + %41 = OpFunctionCall %void %tint_symbol_4 %44 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.wgsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..1b98faea09 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/0.wgsl.expected.wgsl @@ -0,0 +1,34 @@ +[[block]] +struct block0 { + in_color : vec4; +}; + +var position : vec4; + +var frag_color : vec4; + +[[group(0), binding(1)]] var x_8 : block0; + +var gl_Position : vec4; + +fn main_1() { + let x_24 : vec4 = position; + gl_Position = x_24; + let x_27 : vec4 = x_8.in_color; + frag_color = x_27; + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; + [[location(0)]] + frag_color_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position, frag_color); +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm new file mode 100644 index 0000000000..8c4be60c0a --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm @@ -0,0 +1,25 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %final_color %frag_color + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpName %main "main" + OpName %final_color "final_color" + OpName %frag_color "frag_color" + OpDecorate %final_color Location 0 + OpDecorate %frag_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%final_color = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %frag_color = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %6 + %11 = OpLabel + %12 = OpLoad %v4float %frag_color + OpStore %final_color %12 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.hlsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..acf1be902c --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.hlsl @@ -0,0 +1,26 @@ +static float4 final_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + final_color = frag_color; + return; +} + +struct main_out { + float4 final_color_1; +}; +struct tint_symbol_1 { + float4 frag_color_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 final_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 frag_color_param = tint_symbol.frag_color_param; + frag_color = frag_color_param; + main_1(); + const main_out tint_symbol_3 = {final_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.final_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.msl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.msl new file mode 100644 index 0000000000..838993af9a --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 final_color_1; +}; +struct tint_symbol_2 { + float4 frag_color_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + float4 final_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_12 = *(tint_symbol_6); + *(tint_symbol_7) = x_12; + return; +} + +fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const frag_color_param = tint_symbol_1.frag_color_param; + tint_symbol_8 = frag_color_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.final_color_1=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.final_color_1=tint_symbol_4.final_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.spvasm b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..dd25b21a8f --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.spvasm @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %final_color "final_color" + OpName %frag_color "frag_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "final_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%final_color = OpVariable %_ptr_Private_v4float Private %5 + %frag_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %16 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %15 = OpLoad %v4float %frag_color + OpStore %final_color %15 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %16 +%tint_symbol_1 = OpFunctionParameter %main_out + %20 = OpLabel + %21 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %21 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %23 = OpLabel + %24 = OpLoad %v4float %tint_symbol + OpStore %frag_color %24 + %25 = OpFunctionCall %void %main_1 + %27 = OpLoad %v4float %final_color + %28 = OpCompositeConstruct %main_out %27 + %26 = OpFunctionCall %void %tint_symbol_3 %28 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.wgsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..0901c1f0f4 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var final_color : vec4; + +var frag_color : vec4; + +fn main_1() { + let x_12 : vec4 = frag_color; + final_color = x_12; + return; +} + +struct main_out { + [[location(0)]] + final_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[location(0)]] frag_color_param : vec4) -> main_out { + frag_color = frag_color_param; + main_1(); + return main_out(final_color); +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl new file mode 100644 index 0000000000..0901c1f0f4 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl @@ -0,0 +1,21 @@ +var final_color : vec4; + +var frag_color : vec4; + +fn main_1() { + let x_12 : vec4 = frag_color; + final_color = x_12; + return; +} + +struct main_out { + [[location(0)]] + final_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[location(0)]] frag_color_param : vec4) -> main_out { + frag_color = frag_color_param; + main_1(); + return main_out(final_color); +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.hlsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..acf1be902c --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +static float4 final_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + final_color = frag_color; + return; +} + +struct main_out { + float4 final_color_1; +}; +struct tint_symbol_1 { + float4 frag_color_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 final_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 frag_color_param = tint_symbol.frag_color_param; + frag_color = frag_color_param; + main_1(); + const main_out tint_symbol_3 = {final_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.final_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.msl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.msl new file mode 100644 index 0000000000..838993af9a --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 final_color_1; +}; +struct tint_symbol_2 { + float4 frag_color_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + float4 final_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_12 = *(tint_symbol_6); + *(tint_symbol_7) = x_12; + return; +} + +fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const frag_color_param = tint_symbol_1.frag_color_param; + tint_symbol_8 = frag_color_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.final_color_1=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.final_color_1=tint_symbol_4.final_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.spvasm b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..dd25b21a8f --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.spvasm @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %final_color "final_color" + OpName %frag_color "frag_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "final_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%final_color = OpVariable %_ptr_Private_v4float Private %5 + %frag_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %16 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %15 = OpLoad %v4float %frag_color + OpStore %final_color %15 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %16 +%tint_symbol_1 = OpFunctionParameter %main_out + %20 = OpLabel + %21 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %21 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %23 = OpLabel + %24 = OpLoad %v4float %tint_symbol + OpStore %frag_color %24 + %25 = OpFunctionCall %void %main_1 + %27 = OpLoad %v4float %final_color + %28 = OpCompositeConstruct %main_out %27 + %26 = OpFunctionCall %void %tint_symbol_3 %28 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.wgsl b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..0901c1f0f4 --- /dev/null +++ b/test/vk-gl-cts/binding_model/dynamic_offset/shader_reuse_differing_layout_graphics/1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +var final_color : vec4; + +var frag_color : vec4; + +fn main_1() { + let x_12 : vec4 = frag_color; + final_color = x_12; + return; +} + +struct main_out { + [[location(0)]] + final_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[location(0)]] frag_color_param : vec4) -> main_out { + frag_color = frag_color_param; + main_1(); + return main_out(final_color); +} diff --git a/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm new file mode 100644 index 0000000000..a3139e646e --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %position %frag_color + OpSource GLSL 430 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %_ "" + OpName %position "position" + OpName %frag_color "frag_color" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %position Location 0 + OpDecorate %frag_color Location 1 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %position = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %frag_color = OpVariable %_ptr_Output_v4float Output + %float_0_5 = OpConstant %float 0.5 + %main = OpFunction %void None %8 + %20 = OpLabel + %21 = OpLoad %v4float %position + %22 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %22 %21 + %23 = OpLoad %v4float %position + %24 = OpVectorTimesScalar %v4float %23 %float_0_5 + OpStore %frag_color %24 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3cc9cde906 --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.hlsl @@ -0,0 +1,30 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + gl_Position = position; + frag_color = (position * 0.5f); + return; +} + +struct main_out { + float4 gl_Position; + float4 frag_color_1; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD1; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position, frag_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.msl b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..2ce3e850cf --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; + float4 frag_color_1; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + float4 const x_21 = *(tint_symbol_6); + *(tint_symbol_7) = x_21; + float4 const x_23 = *(tint_symbol_6); + *(tint_symbol_8) = (x_23 * 0.5f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_9 = position_param; + main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_10, .frag_color_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..ee8e35300c --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %frag_color "frag_color" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpMemberName %main_out 1 "frag_color_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpDecorate %tint_symbol_3 Location 1 + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 + %frag_color = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float_0_5 = OpConstant %float 0.5 + %main_out = OpTypeStruct %v4float %v4float + %24 = OpTypeFunction %void %main_out + %float_1 = OpConstant %float 1 + %main_1 = OpFunction %void None %16 + %19 = OpLabel + %20 = OpLoad %v4float %position + OpStore %gl_Position %20 + %21 = OpLoad %v4float %position + %23 = OpVectorTimesScalar %v4float %21 %float_0_5 + OpStore %frag_color %23 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %24 +%tint_symbol_1 = OpFunctionParameter %main_out + %28 = OpLabel + %29 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %29 + %30 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %30 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %16 + %32 = OpLabel + OpStore %tint_pointsize %float_1 + %34 = OpLoad %v4float %tint_symbol + OpStore %position %34 + %35 = OpFunctionCall %void %main_1 + %37 = OpLoad %v4float %gl_Position + %38 = OpLoad %v4float %frag_color + %39 = OpCompositeConstruct %main_out %37 %38 + %36 = OpFunctionCall %void %tint_symbol_4 %39 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b9cc524f09 --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.spvasm.expected.wgsl @@ -0,0 +1,27 @@ +var position : vec4; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_21 : vec4 = position; + gl_Position = x_21; + let x_23 : vec4 = position; + frag_color = (x_23 * 0.5); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; + [[location(1)]] + frag_color_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position, frag_color); +} diff --git a/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl new file mode 100644 index 0000000000..b9cc524f09 --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl @@ -0,0 +1,27 @@ +var position : vec4; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_21 : vec4 = position; + gl_Position = x_21; + let x_23 : vec4 = position; + frag_color = (x_23 * 0.5); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; + [[location(1)]] + frag_color_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position, frag_color); +} diff --git a/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3cc9cde906 --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.hlsl @@ -0,0 +1,30 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + gl_Position = position; + frag_color = (position * 0.5f); + return; +} + +struct main_out { + float4 gl_Position; + float4 frag_color_1; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD1; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position, frag_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.msl b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..2ce3e850cf --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; + float4 frag_color_1; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + float4 const x_21 = *(tint_symbol_6); + *(tint_symbol_7) = x_21; + float4 const x_23 = *(tint_symbol_6); + *(tint_symbol_8) = (x_23 * 0.5f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_9 = position_param; + main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_10, .frag_color_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..ee8e35300c --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %frag_color "frag_color" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpMemberName %main_out 1 "frag_color_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpDecorate %tint_symbol_3 Location 1 + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 + %frag_color = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float_0_5 = OpConstant %float 0.5 + %main_out = OpTypeStruct %v4float %v4float + %24 = OpTypeFunction %void %main_out + %float_1 = OpConstant %float 1 + %main_1 = OpFunction %void None %16 + %19 = OpLabel + %20 = OpLoad %v4float %position + OpStore %gl_Position %20 + %21 = OpLoad %v4float %position + %23 = OpVectorTimesScalar %v4float %21 %float_0_5 + OpStore %frag_color %23 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %24 +%tint_symbol_1 = OpFunctionParameter %main_out + %28 = OpLabel + %29 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %29 + %30 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %30 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %16 + %32 = OpLabel + OpStore %tint_pointsize %float_1 + %34 = OpLoad %v4float %tint_symbol + OpStore %position %34 + %35 = OpFunctionCall %void %main_1 + %37 = OpLoad %v4float %gl_Position + %38 = OpLoad %v4float %frag_color + %39 = OpCompositeConstruct %main_out %37 %38 + %36 = OpFunctionCall %void %tint_symbol_4 %39 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b9cc524f09 --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/0-opt.wgsl.expected.wgsl @@ -0,0 +1,27 @@ +var position : vec4; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_21 : vec4 = position; + gl_Position = x_21; + let x_23 : vec4 = position; + frag_color = (x_23 * 0.5); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; + [[location(1)]] + frag_color_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position, frag_color); +} diff --git a/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm b/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm new file mode 100644 index 0000000000..2496d109ef --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm @@ -0,0 +1,59 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %frag_color %color_out + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpName %main "main" + OpName %iv "iv" + OpName %frag_color "frag_color" + OpName %color_out "color_out" + OpDecorate %frag_color Location 1 + OpDecorate %color_out Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %frag_color = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 + %float_256 = OpConstant %float 256 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 + %int_64 = OpConstant %int 64 + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %26 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %main = OpFunction %void None %7 + %27 = OpLabel + %iv = OpVariable %_ptr_Function_v2int Function + %28 = OpLoad %v4float %frag_color + %29 = OpVectorShuffle %v2float %28 %28 0 1 + %30 = OpVectorTimesScalar %v2float %29 %float_256 + %31 = OpConvertFToS %v2int %30 + OpStore %iv %31 + %32 = OpAccessChain %_ptr_Function_int %iv %uint_1 + %33 = OpLoad %int %32 + %34 = OpSDiv %int %33 %int_2 + %35 = OpBitwiseAnd %int %34 %int_64 + %36 = OpIEqual %bool %35 %int_64 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpStore %color_out %25 + OpBranch %37 + %39 = OpLabel + OpStore %color_out %26 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.hlsl b/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..15b4ff657e --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.hlsl @@ -0,0 +1,34 @@ +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int2 iv = int2(0, 0); + const float4 x_28 = frag_color; + iv = int2((float2(x_28.x, x_28.y) * 256.0f)); + const int x_33 = iv.y; + if ((((x_33 / 2) & 64) == 64)) { + color_out = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + color_out = float4(0.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 color_out_1; +}; +struct tint_symbol_1 { + float4 frag_color_param : TEXCOORD1; +}; +struct tint_symbol_2 { + float4 color_out_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 frag_color_param = tint_symbol.frag_color_param; + frag_color = frag_color_param; + main_1(); + const main_out tint_symbol_3 = {color_out}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.color_out_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.msl b/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.msl new file mode 100644 index 0000000000..ae8e6eb9c4 --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; +}; +struct tint_symbol_2 { + float4 frag_color_param [[user(locn1)]]; +}; +struct tint_symbol_3 { + float4 color_out_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int2 iv = 0; + float4 const x_28 = *(tint_symbol_6); + iv = int2((float2(x_28.x, x_28.y) * 256.0f)); + int const x_33 = iv.y; + if ((((x_33 / 2) & 64) == 64)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const frag_color_param = tint_symbol_1.frag_color_param; + tint_symbol_8 = frag_color_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.color_out_1=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.color_out_1=tint_symbol_4.color_out_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.spvasm b/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..6d6715e300 --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %frag_color "frag_color" + OpName %color_out "color_out" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %iv "iv" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol Location 1 + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %frag_color = OpVariable %_ptr_Private_v4float Private %5 + %color_out = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int + %v2float = OpTypeVector %float 2 + %float_256 = OpConstant %float 256 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 + %int_64 = OpConstant %int 64 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %46 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %iv = OpVariable %_ptr_Function_v2int Function %19 + %20 = OpLoad %v4float %frag_color + %23 = OpCompositeExtract %float %20 0 + %24 = OpCompositeExtract %float %20 1 + %25 = OpCompositeConstruct %v2float %23 %24 + %27 = OpVectorTimesScalar %v2float %25 %float_256 + %21 = OpConvertFToS %v2int %27 + OpStore %iv %21 + %31 = OpAccessChain %_ptr_Function_int %iv %uint_1 + %32 = OpLoad %int %31 + %34 = OpSDiv %int %32 %int_2 + %36 = OpBitwiseAnd %int %34 %int_64 + %37 = OpIEqual %bool %36 %int_64 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + OpStore %color_out %44 + OpBranch %39 + %41 = OpLabel + OpStore %color_out %45 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %46 +%tint_symbol_1 = OpFunctionParameter %main_out + %50 = OpLabel + %51 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %51 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %53 = OpLabel + %54 = OpLoad %v4float %tint_symbol + OpStore %frag_color %54 + %55 = OpFunctionCall %void %main_1 + %57 = OpLoad %v4float %color_out + %58 = OpCompositeConstruct %main_out %57 + %56 = OpFunctionCall %void %tint_symbol_3 %58 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.wgsl b/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..cbbd62625c --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/1.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +var frag_color : vec4; + +var color_out : vec4; + +fn main_1() { + var iv : vec2; + let x_28 : vec4 = frag_color; + iv = vec2((vec2(x_28.x, x_28.y) * 256.0)); + let x_33 : i32 = iv.y; + if ((((x_33 / 2) & 64) == 64)) { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + } else { + color_out = vec4(0.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[location(1)]] frag_color_param : vec4) -> main_out { + frag_color = frag_color_param; + main_1(); + return main_out(color_out); +} diff --git a/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl b/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl new file mode 100644 index 0000000000..cbbd62625c --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl @@ -0,0 +1,28 @@ +var frag_color : vec4; + +var color_out : vec4; + +fn main_1() { + var iv : vec2; + let x_28 : vec4 = frag_color; + iv = vec2((vec2(x_28.x, x_28.y) * 256.0)); + let x_33 : i32 = iv.y; + if ((((x_33 / 2) & 64) == 64)) { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + } else { + color_out = vec4(0.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[location(1)]] frag_color_param : vec4) -> main_out { + frag_color = frag_color_param; + main_1(); + return main_out(color_out); +} diff --git a/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.hlsl b/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..15b4ff657e --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int2 iv = int2(0, 0); + const float4 x_28 = frag_color; + iv = int2((float2(x_28.x, x_28.y) * 256.0f)); + const int x_33 = iv.y; + if ((((x_33 / 2) & 64) == 64)) { + color_out = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + color_out = float4(0.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 color_out_1; +}; +struct tint_symbol_1 { + float4 frag_color_param : TEXCOORD1; +}; +struct tint_symbol_2 { + float4 color_out_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 frag_color_param = tint_symbol.frag_color_param; + frag_color = frag_color_param; + main_1(); + const main_out tint_symbol_3 = {color_out}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.color_out_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.msl b/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.msl new file mode 100644 index 0000000000..ae8e6eb9c4 --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; +}; +struct tint_symbol_2 { + float4 frag_color_param [[user(locn1)]]; +}; +struct tint_symbol_3 { + float4 color_out_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int2 iv = 0; + float4 const x_28 = *(tint_symbol_6); + iv = int2((float2(x_28.x, x_28.y) * 256.0f)); + int const x_33 = iv.y; + if ((((x_33 / 2) & 64) == 64)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const frag_color_param = tint_symbol_1.frag_color_param; + tint_symbol_8 = frag_color_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.color_out_1=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.color_out_1=tint_symbol_4.color_out_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.spvasm b/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..6d6715e300 --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %frag_color "frag_color" + OpName %color_out "color_out" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %iv "iv" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol Location 1 + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %frag_color = OpVariable %_ptr_Private_v4float Private %5 + %color_out = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %19 = OpConstantNull %v2int + %v2float = OpTypeVector %float 2 + %float_256 = OpConstant %float 256 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 + %int_64 = OpConstant %int 64 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %46 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %iv = OpVariable %_ptr_Function_v2int Function %19 + %20 = OpLoad %v4float %frag_color + %23 = OpCompositeExtract %float %20 0 + %24 = OpCompositeExtract %float %20 1 + %25 = OpCompositeConstruct %v2float %23 %24 + %27 = OpVectorTimesScalar %v2float %25 %float_256 + %21 = OpConvertFToS %v2int %27 + OpStore %iv %21 + %31 = OpAccessChain %_ptr_Function_int %iv %uint_1 + %32 = OpLoad %int %31 + %34 = OpSDiv %int %32 %int_2 + %36 = OpBitwiseAnd %int %34 %int_64 + %37 = OpIEqual %bool %36 %int_64 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + OpStore %color_out %44 + OpBranch %39 + %41 = OpLabel + OpStore %color_out %45 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %46 +%tint_symbol_1 = OpFunctionParameter %main_out + %50 = OpLabel + %51 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %51 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %53 = OpLabel + %54 = OpLoad %v4float %tint_symbol + OpStore %frag_color %54 + %55 = OpFunctionCall %void %main_1 + %57 = OpLoad %v4float %color_out + %58 = OpCompositeConstruct %main_out %57 + %56 = OpFunctionCall %void %tint_symbol_3 %58 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.wgsl b/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..cbbd62625c --- /dev/null +++ b/test/vk-gl-cts/combined_operations/negintdivand/1.wgsl.expected.wgsl @@ -0,0 +1,28 @@ +var frag_color : vec4; + +var color_out : vec4; + +fn main_1() { + var iv : vec2; + let x_28 : vec4 = frag_color; + iv = vec2((vec2(x_28.x, x_28.y) * 256.0)); + let x_33 : i32 = iv.y; + if ((((x_33 / 2) & 64) == 64)) { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + } else { + color_out = vec4(0.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[location(1)]] frag_color_param : vec4) -> main_out { + frag_color = frag_color_param; + main_1(); + return main_out(color_out); +} diff --git a/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm new file mode 100644 index 0000000000..cdbcbc0b87 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm @@ -0,0 +1,44 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %x "x" + OpName %_GLF_color "_GLF_color" + OpDecorate %x RelaxedPrecision + OpDecorate %5 RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %20 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %8 + %21 = OpLabel + %x = OpVariable %_ptr_Function_int Function + OpStore %x %int_0 + %5 = OpLoad %int %x + %6 = OpExtInst %int %1 SClamp %5 %int_0 %int_3 + %22 = OpVectorExtractDynamic %float %15 %6 + %23 = OpFOrdGreaterThanEqual %bool %22 %float_1 + OpSelectionMerge %24 None + OpBranchConditional %23 %25 %24 + %25 = OpLabel + OpBranch %24 + %24 = OpLabel + OpStore %_GLF_color %20 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..485db305e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x = 0; + x = 0; + if ((float4(1.0f, 1.0f, 1.0f, 1.0f)[clamp(x, 0, 3)] >= 1.0f)) { + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b9d21c38f6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.msl @@ -0,0 +1,28 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int x = 0; + x = 0; + int const x_5 = x; + if ((float4(1.0f, 1.0f, 1.0f, 1.0f)[clamp(x_5, 0, 3)] >= 1.0f)) { + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..ee25aef37c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x "x" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %30 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %x = OpVariable %_ptr_Function_int Function %15 + OpStore %x %int_0 + %17 = OpLoad %int %x + %20 = OpExtInst %int %21 SClamp %17 %int_0 %int_3 + %23 = OpVectorExtractDynamic %float %19 %20 + %24 = OpFOrdGreaterThanEqual %bool %23 %float_1 + OpSelectionMerge %26 None + OpBranchConditional %24 %27 %26 + %27 = OpLabel + OpBranch %26 + %26 = OpLabel + OpStore %x_GLF_color %29 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %30 +%tint_symbol = OpFunctionParameter %main_out + %34 = OpLabel + %35 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %35 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %37 = OpLabel + %38 = OpFunctionCall %void %main_1 + %40 = OpLoad %v4float %x_GLF_color + %41 = OpCompositeConstruct %main_out %40 + %39 = OpFunctionCall %void %tint_symbol_2 %41 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..8432d48e62 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x : i32; + x = 0; + let x_5 : i32 = x; + if ((vec4(1.0, 1.0, 1.0, 1.0)[clamp(x_5, 0, 3)] >= 1.0)) { + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl new file mode 100644 index 0000000000..8432d48e62 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl @@ -0,0 +1,22 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x : i32; + x = 0; + let x_5 : i32 = x; + if ((vec4(1.0, 1.0, 1.0, 1.0)[clamp(x_5, 0, 3)] >= 1.0)) { + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..485db305e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x = 0; + x = 0; + if ((float4(1.0f, 1.0f, 1.0f, 1.0f)[clamp(x, 0, 3)] >= 1.0f)) { + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b9d21c38f6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.msl @@ -0,0 +1,28 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int x = 0; + x = 0; + int const x_5 = x; + if ((float4(1.0f, 1.0f, 1.0f, 1.0f)[clamp(x_5, 0, 3)] >= 1.0f)) { + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..ee25aef37c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %21 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x "x" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %30 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %x = OpVariable %_ptr_Function_int Function %15 + OpStore %x %int_0 + %17 = OpLoad %int %x + %20 = OpExtInst %int %21 SClamp %17 %int_0 %int_3 + %23 = OpVectorExtractDynamic %float %19 %20 + %24 = OpFOrdGreaterThanEqual %bool %23 %float_1 + OpSelectionMerge %26 None + OpBranchConditional %24 %27 %26 + %27 = OpLabel + OpBranch %26 + %26 = OpLabel + OpStore %x_GLF_color %29 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %30 +%tint_symbol = OpFunctionParameter %main_out + %34 = OpLabel + %35 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %35 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %37 = OpLabel + %38 = OpFunctionCall %void %main_1 + %40 = OpLoad %v4float %x_GLF_color + %41 = OpCompositeConstruct %main_out %40 + %39 = OpFunctionCall %void %tint_symbol_2 %41 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..8432d48e62 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/access-new-vector-inside-if-condition/0-opt.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x : i32; + x = 0; + let x_5 : i32 = x; + if ((vec4(1.0, 1.0, 1.0, 1.0)[clamp(x_5, 0, 3)] >= 1.0)) { + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm new file mode 100644 index 0000000000..f43761b722 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm @@ -0,0 +1,244 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %tmp_struct "tmp_struct" + OpMemberName %tmp_struct 0 "nmb" + OpName %binarySearch_struct_tmp_struct_i1_1_1_ "binarySearch(struct-tmp_struct-i1[1]1;" + OpName %obj "obj" + OpName %one "one" + OpName %zero "zero" + OpName %tmp_float "tmp_float" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %color "color" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %tmp_struct 0 RelaxedPrecision + OpDecorate %binarySearch_struct_tmp_struct_i1_1_1_ RelaxedPrecision + OpDecorate %one RelaxedPrecision + OpDecorate %zero RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + %void = OpTypeVoid + %30 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %tmp_struct = OpTypeStruct %_arr_int_uint_1 +%_ptr_Function_tmp_struct = OpTypePointer Function %tmp_struct + %36 = OpTypeFunction %int %_ptr_Function_tmp_struct +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_n1 = OpConstant %int -1 + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %53 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %55 = OpConstantComposite %v2float %float_1 %float_1 + %uint_0 = OpConstant %uint 0 + %57 = OpUndef %tmp_struct + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %61 = OpConstantNull %_arr_int_uint_1 +%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1 + %63 = OpUndef %int + %64 = OpUndef %bool + %65 = OpUndef %int + %66 = OpUndef %bool + %main = OpFunction %void None %30 + %67 = OpLabel + %24 = OpVariable %_ptr_Function__arr_int_uint_1 Function + %68 = OpVariable %_ptr_Function_bool Function %false + %17 = OpVariable %_ptr_Function_int Function + %18 = OpVariable %_ptr_Function_int Function + %19 = OpVariable %_ptr_Function_int Function + %20 = OpVariable %_ptr_Function_int Function + %69 = OpVariable %_ptr_Function_bool Function %false + %tmp_float = OpVariable %_ptr_Function_float Function + %color = OpVariable %_ptr_Function_v3float Function + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %75 = OpLoad %float %74 + OpStore %tmp_float %75 + %76 = OpCompositeConstruct %v3float %75 %75 %75 + OpStore %color %76 + %77 = OpCompositeExtract %_arr_int_uint_1 %57 0 + OpStore %24 %77 + OpStore %68 %false + OpBranch %78 + %78 = OpLabel + %79 = OpPhi %bool %false %73 %64 %80 + OpLoopMerge %81 %80 None + OpBranch %82 + %82 = OpLabel + OpStore %18 %int_1 + OpBranch %83 + %83 = OpLabel + %21 = OpPhi %int %int_1 %82 %22 %84 + OpLoopMerge %85 %84 None + OpBranch %86 + %86 = OpLabel + %87 = OpSGreaterThan %bool %21 %int_10 + OpBranchConditional %87 %88 %85 + %88 = OpLabel + %22 = OpISub %int %21 %int_1 + OpStore %19 %22 + %89 = OpAccessChain %_ptr_Function_int %24 %22 + %23 = OpLoad %int %89 + %90 = OpIEqual %bool %23 %int_1 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + OpStore %68 %true + OpStore %17 %int_1 + OpBranch %85 + %91 = OpLabel + OpStore %18 %22 + OpBranch %84 + %84 = OpLabel + OpBranch %83 + %85 = OpLabel + %25 = OpPhi %int %63 %86 %int_1 %92 + %93 = OpPhi %bool %79 %86 %true %92 + OpSelectionMerge %94 None + OpBranchConditional %93 %81 %94 + %94 = OpLabel + OpStore %68 %true + OpStore %17 %int_n1 + OpBranch %81 + %80 = OpLabel + OpBranch %78 + %81 = OpLabel + %26 = OpPhi %int %25 %85 %int_n1 %94 + OpStore %20 %26 + %95 = OpIEqual %bool %26 %int_n1 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %98 + %97 = OpLabel + OpKill + %98 = OpLabel + OpStore %_GLF_color %53 + %99 = OpVectorShuffle %v2float %76 %76 1 2 + %100 = OpFAdd %v2float %99 %55 + %101 = OpVectorShuffle %v3float %76 %100 0 3 4 + OpStore %color %101 + %102 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %103 = OpLoad %float %102 + %104 = OpFOrdGreaterThan %bool %103 %float_1 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %105 + %106 = OpLabel + OpStore %69 %true + OpBranch %71 + %105 = OpLabel + OpBranch %96 + %96 = OpLabel + %107 = OpCompositeExtract %float %101 0 + %108 = OpCompositeExtract %float %101 1 + %109 = OpCompositeExtract %float %101 2 + %110 = OpCompositeConstruct %v4float %107 %108 %109 %float_1 + OpStore %_GLF_color %110 + OpStore %69 %true + OpBranch %71 + %72 = OpLabel + OpBranch %70 + %71 = OpLabel + OpReturn + OpFunctionEnd +%binarySearch_struct_tmp_struct_i1_1_1_ = OpFunction %int None %36 + %obj = OpFunctionParameter %_ptr_Function_tmp_struct + %111 = OpLabel + %112 = OpVariable %_ptr_Function_bool Function %false + %16 = OpVariable %_ptr_Function_int Function + %one = OpVariable %_ptr_Function_int Function + %zero = OpVariable %_ptr_Function_int Function + OpBranch %113 + %113 = OpLabel + %114 = OpPhi %bool %false %111 %66 %115 + OpLoopMerge %116 %115 None + OpBranch %117 + %117 = OpLabel + OpStore %one %int_1 + OpBranch %118 + %118 = OpLabel + %15 = OpPhi %int %int_1 %117 %13 %119 + OpLoopMerge %120 %119 None + OpBranch %121 + %121 = OpLabel + %122 = OpSGreaterThan %bool %15 %int_10 + OpBranchConditional %122 %123 %120 + %123 = OpLabel + %13 = OpISub %int %15 %int_1 + OpStore %zero %13 + %124 = OpAccessChain %_ptr_Function_int %obj %int_0 %13 + %14 = OpLoad %int %124 + %125 = OpIEqual %bool %14 %int_1 + OpSelectionMerge %126 None + OpBranchConditional %125 %127 %126 + %127 = OpLabel + OpStore %112 %true + OpStore %16 %int_1 + OpBranch %120 + %126 = OpLabel + OpStore %one %13 + OpBranch %119 + %119 = OpLabel + OpBranch %118 + %120 = OpLabel + %27 = OpPhi %int %65 %121 %int_1 %127 + %128 = OpPhi %bool %114 %121 %true %127 + OpSelectionMerge %129 None + OpBranchConditional %128 %116 %129 + %129 = OpLabel + OpStore %112 %true + OpStore %16 %int_n1 + OpBranch %116 + %115 = OpLabel + OpBranch %113 + %116 = OpLabel + %28 = OpPhi %int %27 %120 %int_n1 %129 + OpReturnValue %28 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f0e2766a28 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.hlsl @@ -0,0 +1,168 @@ +struct tmp_struct { + int nmb[1]; +}; + +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_24[1] = (int[1])0; + bool x_68 = false; + int x_17 = 0; + int x_18 = 0; + int x_19 = 0; + int x_20 = 0; + bool x_69 = false; + float tmp_float = 0.0f; + float3 color = float3(0.0f, 0.0f, 0.0f); + while (true) { + int x_25 = 0; + float3 x_101 = float3(0.0f, 0.0f, 0.0f); + bool x_79_phi = false; + int x_26_phi = 0; + const float x_75 = asfloat(x_11[0].y); + tmp_float = x_75; + const float3 x_76 = float3(x_75, x_75, x_75); + color = x_76; + const int tint_symbol_3[1] = {0}; + const tmp_struct tint_symbol_4 = {tint_symbol_3}; + x_24 = tint_symbol_4.nmb; + x_68 = false; + x_79_phi = false; + while (true) { + int x_21_phi = 0; + int x_25_phi = 0; + bool x_93_phi = false; + const bool x_79 = x_79_phi; + x_18 = 1; + x_21_phi = 1; + while (true) { + const int x_21 = x_21_phi; + x_25_phi = 0; + x_93_phi = x_79; + if ((x_21 > 10)) { + } else { + break; + } + const int x_22 = (x_21 - 1); + x_19 = x_22; + const int x_23 = x_24[x_22]; + if ((x_23 == 1)) { + x_68 = true; + x_17 = 1; + x_25_phi = 1; + x_93_phi = true; + break; + } + x_18 = x_22; + { + x_21_phi = x_22; + } + } + x_25 = x_25_phi; + const bool x_93 = x_93_phi; + x_26_phi = x_25; + if (x_93) { + break; + } + x_68 = true; + x_17 = -1; + x_26_phi = -1; + break; + { + x_79_phi = false; + } + } + const int x_26 = x_26_phi; + x_20 = x_26; + if ((x_26 == -1)) { + discard; + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float2 x_100 = (float2(x_76.y, x_76.z) + float2(1.0f, 1.0f)); + x_101 = float3(x_76.x, x_100.x, x_100.y); + color = x_101; + const float x_103 = asfloat(x_11[0].x); + if ((x_103 > 1.0f)) { + x_69 = true; + break; + } + } + x_GLF_color = float4(x_101.x, x_101.y, x_101.z, 1.0f); + x_69 = true; + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} + +int binarySearch_struct_tmp_struct_i1_1_1_(inout tmp_struct obj) { + bool x_112 = false; + int x_16 = 0; + int one = 0; + int zero = 0; + int x_27 = 0; + bool x_114_phi = false; + int x_28_phi = 0; + x_114_phi = false; + while (true) { + int x_15_phi = 0; + int x_27_phi = 0; + bool x_128_phi = false; + const bool x_114 = x_114_phi; + one = 1; + x_15_phi = 1; + while (true) { + const int x_15 = x_15_phi; + x_27_phi = 0; + x_128_phi = x_114; + if ((x_15 > 10)) { + } else { + break; + } + const int x_13 = (x_15 - 1); + zero = x_13; + const int x_14 = obj.nmb[x_13]; + if ((x_14 == 1)) { + x_112 = true; + x_16 = 1; + x_27_phi = 1; + x_128_phi = true; + break; + } + one = x_13; + { + x_15_phi = x_13; + } + } + x_27 = x_27_phi; + const bool x_128 = x_128_phi; + x_28_phi = x_27; + if (x_128) { + break; + } + x_112 = true; + x_16 = -1; + x_28_phi = -1; + break; + { + x_114_phi = false; + } + } + return x_28_phi; +} diff --git a/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..5262879438 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.msl @@ -0,0 +1,174 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[1]; +}; +struct tmp_struct { + tint_array_wrapper nmb; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_11, thread float4* const tint_symbol_6) { + tint_array_wrapper x_24 = {}; + bool x_68 = false; + int x_17 = 0; + int x_18 = 0; + int x_19 = 0; + int x_20 = 0; + bool x_69 = false; + float tmp_float = 0.0f; + float3 color = 0.0f; + while (true) { + int x_25 = 0; + float3 x_101 = 0.0f; + bool x_79_phi = false; + int x_26_phi = 0; + float const x_75 = x_11.injectionSwitch.y; + tmp_float = x_75; + float3 const x_76 = float3(x_75, x_75, x_75); + color = x_76; + tint_array_wrapper const tint_symbol_3 = {.arr={0}}; + tmp_struct const tint_symbol_4 = {.nmb=tint_symbol_3}; + x_24 = tint_symbol_4.nmb; + x_68 = false; + x_79_phi = false; + while (true) { + int x_21_phi = 0; + int x_25_phi = 0; + bool x_93_phi = false; + bool const x_79 = x_79_phi; + x_18 = 1; + x_21_phi = 1; + while (true) { + int const x_21 = x_21_phi; + x_25_phi = 0; + x_93_phi = x_79; + if ((x_21 > 10)) { + } else { + break; + } + int const x_22 = (x_21 - 1); + x_19 = x_22; + int const x_23 = x_24.arr[x_22]; + if ((x_23 == 1)) { + x_68 = true; + x_17 = 1; + x_25_phi = 1; + x_93_phi = true; + break; + } + x_18 = x_22; + { + x_21_phi = x_22; + } + } + x_25 = x_25_phi; + bool const x_93 = x_93_phi; + x_26_phi = x_25; + if (x_93) { + break; + } + x_68 = true; + x_17 = -1; + x_26_phi = -1; + break; + { + x_79_phi = false; + } + } + int const x_26 = x_26_phi; + x_20 = x_26; + if ((x_26 == -1)) { + discard_fragment(); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + float2 const x_100 = (float2(x_76.y, x_76.z) + float2(1.0f, 1.0f)); + x_101 = float3(x_76.x, x_100.x, x_100.y); + color = x_101; + float const x_103 = x_11.injectionSwitch.x; + if ((x_103 > 1.0f)) { + x_69 = true; + break; + } + } + *(tint_symbol_6) = float4(x_101.x, x_101.y, x_101.z, 1.0f); + x_69 = true; + break; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + main_1(x_11, &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_5; +} + +int binarySearch_struct_tmp_struct_i1_1_1_(thread tmp_struct* const obj) { + bool x_112 = false; + int x_16 = 0; + int one = 0; + int zero = 0; + int x_27 = 0; + bool x_114_phi = false; + int x_28_phi = 0; + x_114_phi = false; + while (true) { + int x_15_phi = 0; + int x_27_phi = 0; + bool x_128_phi = false; + bool const x_114 = x_114_phi; + one = 1; + x_15_phi = 1; + while (true) { + int const x_15 = x_15_phi; + x_27_phi = 0; + x_128_phi = x_114; + if ((x_15 > 10)) { + } else { + break; + } + int const x_13 = (x_15 - 1); + zero = x_13; + int const x_14 = (*(obj)).nmb.arr[x_13]; + if ((x_14 == 1)) { + x_112 = true; + x_16 = 1; + x_27_phi = 1; + x_128_phi = true; + break; + } + one = x_13; + { + x_15_phi = x_13; + } + } + x_27 = x_27_phi; + bool const x_128 = x_128_phi; + x_28_phi = x_27; + if (x_128) { + break; + } + x_112 = true; + x_16 = -1; + x_28_phi = -1; + break; + { + x_114_phi = false; + } + } + int const x_28 = x_28_phi; + return x_28; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..18ca5d58de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.spvasm @@ -0,0 +1,345 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 177 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_24 "x_24" + OpName %x_68 "x_68" + OpName %x_17 "x_17" + OpName %x_18 "x_18" + OpName %x_19 "x_19" + OpName %x_20 "x_20" + OpName %x_69 "x_69" + OpName %tmp_float "tmp_float" + OpName %color "color" + OpName %x_25 "x_25" + OpName %x_101 "x_101" + OpName %x_79_phi "x_79_phi" + OpName %x_26_phi "x_26_phi" + OpName %tmp_struct "tmp_struct" + OpMemberName %tmp_struct 0 "nmb" + OpName %x_21_phi "x_21_phi" + OpName %x_25_phi "x_25_phi" + OpName %x_93_phi "x_93_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %binarySearch_struct_tmp_struct_i1_1_1_ "binarySearch_struct_tmp_struct_i1_1_1_" + OpName %obj "obj" + OpName %x_112 "x_112" + OpName %x_16 "x_16" + OpName %one "one" + OpName %zero "zero" + OpName %x_27 "x_27" + OpName %x_114_phi "x_114_phi" + OpName %x_28_phi "x_28_phi" + OpName %x_15_phi "x_15_phi" + OpName %x_27_phi "x_27_phi" + OpName %x_128_phi "x_128_phi" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_1 ArrayStride 4 + OpMemberDecorate %tmp_struct 0 Offset 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 +%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1 + %22 = OpConstantNull %_arr_int_uint_1 + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %37 = OpConstantNull %float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %41 = OpConstantNull %v3float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %tmp_struct = OpTypeStruct %_arr_int_uint_1 + %int_0 = OpConstant %int 0 + %57 = OpConstantComposite %_arr_int_uint_1 %int_0 + %58 = OpConstantComposite %tmp_struct %57 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %true = OpConstantTrue %bool + %int_n1 = OpConstant %int -1 + %float_0 = OpConstant %float 0 + %98 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %103 = OpConstantComposite %v2float %float_1 %float_1 + %uint_2 = OpConstant %uint 2 + %main_out = OpTypeStruct %v4float + %123 = OpTypeFunction %void %main_out +%_ptr_Function_tmp_struct = OpTypePointer Function %tmp_struct + %135 = OpTypeFunction %int %_ptr_Function_tmp_struct + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_24 = OpVariable %_ptr_Function__arr_int_uint_1 Function %22 + %x_68 = OpVariable %_ptr_Function_bool Function %27 + %x_17 = OpVariable %_ptr_Function_int Function %30 + %x_18 = OpVariable %_ptr_Function_int Function %30 + %x_19 = OpVariable %_ptr_Function_int Function %30 + %x_20 = OpVariable %_ptr_Function_int Function %30 + %x_69 = OpVariable %_ptr_Function_bool Function %27 + %tmp_float = OpVariable %_ptr_Function_float Function %37 + %color = OpVariable %_ptr_Function_v3float Function %41 + %x_25 = OpVariable %_ptr_Function_int Function %30 + %x_101 = OpVariable %_ptr_Function_v3float Function %41 + %x_79_phi = OpVariable %_ptr_Function_bool Function %27 + %x_26_phi = OpVariable %_ptr_Function_int Function %30 + %x_21_phi = OpVariable %_ptr_Function_int Function %30 + %x_25_phi = OpVariable %_ptr_Function_int Function %30 + %x_93_phi = OpVariable %_ptr_Function_bool Function %27 + OpStore %x_68 %false + OpStore %x_69 %false + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_1 + %53 = OpLoad %float %52 + OpStore %tmp_float %53 + %54 = OpCompositeConstruct %v3float %53 %53 %53 + OpStore %color %54 + %59 = OpCompositeExtract %_arr_int_uint_1 %58 0 + OpStore %x_24 %59 + OpStore %x_68 %false + OpStore %x_79_phi %false + OpBranch %60 + %60 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + %67 = OpLoad %bool %x_79_phi + OpStore %x_18 %int_1 + OpStore %x_21_phi %int_1 + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %int %x_21_phi + OpStore %x_25_phi %int_0 + OpStore %x_93_phi %67 + %75 = OpSGreaterThan %bool %73 %int_10 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %78 + %77 = OpLabel + OpBranch %76 + %78 = OpLabel + OpBranch %70 + %76 = OpLabel + %79 = OpISub %int %73 %int_1 + OpStore %x_19 %79 + %80 = OpAccessChain %_ptr_Function_int %x_24 %79 + %81 = OpLoad %int %80 + %82 = OpIEqual %bool %81 %int_1 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + OpStore %x_68 %true + OpStore %x_17 %int_1 + OpStore %x_25_phi %int_1 + OpStore %x_93_phi %true + OpBranch %70 + %83 = OpLabel + OpStore %x_18 %79 + OpBranch %71 + %71 = OpLabel + OpStore %x_21_phi %79 + OpBranch %69 + %70 = OpLabel + %86 = OpLoad %int %x_25_phi + OpStore %x_25 %86 + %87 = OpLoad %bool %x_93_phi + %88 = OpLoad %int %x_25 + OpStore %x_26_phi %88 + OpSelectionMerge %89 None + OpBranchConditional %87 %90 %89 + %90 = OpLabel + OpBranch %61 + %89 = OpLabel + OpStore %x_68 %true + OpStore %x_17 %int_n1 + OpStore %x_26_phi %int_n1 + OpBranch %61 + %62 = OpLabel + OpStore %x_79_phi %false + OpBranch %60 + %61 = OpLabel + %92 = OpLoad %int %x_26_phi + OpStore %x_20 %92 + %93 = OpIEqual %bool %92 %int_n1 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %96 + %95 = OpLabel + OpKill + %96 = OpLabel + OpStore %x_GLF_color %98 + %99 = OpCompositeExtract %float %54 1 + %100 = OpCompositeExtract %float %54 2 + %101 = OpCompositeConstruct %v2float %99 %100 + %104 = OpFAdd %v2float %101 %103 + %105 = OpCompositeExtract %float %54 0 + %106 = OpCompositeExtract %float %104 0 + %107 = OpCompositeExtract %float %104 1 + %108 = OpCompositeConstruct %v3float %105 %106 %107 + OpStore %x_101 %108 + %109 = OpLoad %v3float %x_101 + OpStore %color %109 + %110 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_0 + %111 = OpLoad %float %110 + %112 = OpFOrdGreaterThan %bool %111 %float_1 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + OpStore %x_69 %true + OpBranch %43 + %113 = OpLabel + OpBranch %94 + %94 = OpLabel + %115 = OpAccessChain %_ptr_Function_float %x_101 %uint_0 + %116 = OpLoad %float %115 + %117 = OpAccessChain %_ptr_Function_float %x_101 %uint_1 + %118 = OpLoad %float %117 + %120 = OpAccessChain %_ptr_Function_float %x_101 %uint_2 + %121 = OpLoad %float %120 + %122 = OpCompositeConstruct %v4float %116 %118 %121 %float_1 + OpStore %x_GLF_color %122 + OpStore %x_69 %true + OpBranch %43 + %44 = OpLabel + OpBranch %42 + %43 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %123 +%tint_symbol = OpFunctionParameter %main_out + %127 = OpLabel + %128 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %128 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %130 = OpLabel + %131 = OpFunctionCall %void %main_1 + %133 = OpLoad %v4float %x_GLF_color + %134 = OpCompositeConstruct %main_out %133 + %132 = OpFunctionCall %void %tint_symbol_2 %134 + OpReturn + OpFunctionEnd +%binarySearch_struct_tmp_struct_i1_1_1_ = OpFunction %int None %135 + %obj = OpFunctionParameter %_ptr_Function_tmp_struct + %139 = OpLabel + %x_112 = OpVariable %_ptr_Function_bool Function %27 + %x_16 = OpVariable %_ptr_Function_int Function %30 + %one = OpVariable %_ptr_Function_int Function %30 + %zero = OpVariable %_ptr_Function_int Function %30 + %x_27 = OpVariable %_ptr_Function_int Function %30 + %x_114_phi = OpVariable %_ptr_Function_bool Function %27 + %x_28_phi = OpVariable %_ptr_Function_int Function %30 + %x_15_phi = OpVariable %_ptr_Function_int Function %30 + %x_27_phi = OpVariable %_ptr_Function_int Function %30 + %x_128_phi = OpVariable %_ptr_Function_bool Function %27 + OpStore %x_112 %false + OpStore %x_114_phi %false + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %154 = OpLoad %bool %x_114_phi + OpStore %one %int_1 + OpStore %x_15_phi %int_1 + OpBranch %155 + %155 = OpLabel + OpLoopMerge %156 %157 None + OpBranch %158 + %158 = OpLabel + %159 = OpLoad %int %x_15_phi + OpStore %x_27_phi %int_0 + OpStore %x_128_phi %154 + %160 = OpSGreaterThan %bool %159 %int_10 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + OpBranch %161 + %163 = OpLabel + OpBranch %156 + %161 = OpLabel + %164 = OpISub %int %159 %int_1 + OpStore %zero %164 + %166 = OpAccessChain %_ptr_Function_int %obj %uint_0 %164 + %167 = OpLoad %int %166 + %168 = OpIEqual %bool %167 %int_1 + OpSelectionMerge %169 None + OpBranchConditional %168 %170 %169 + %170 = OpLabel + OpStore %x_112 %true + OpStore %x_16 %int_1 + OpStore %x_27_phi %int_1 + OpStore %x_128_phi %true + OpBranch %156 + %169 = OpLabel + OpStore %one %164 + OpBranch %157 + %157 = OpLabel + OpStore %x_15_phi %164 + OpBranch %155 + %156 = OpLabel + %171 = OpLoad %int %x_27_phi + OpStore %x_27 %171 + %172 = OpLoad %bool %x_128_phi + %173 = OpLoad %int %x_27 + OpStore %x_28_phi %173 + OpSelectionMerge %174 None + OpBranchConditional %172 %175 %174 + %175 = OpLabel + OpBranch %148 + %174 = OpLabel + OpStore %x_112 %true + OpStore %x_16 %int_n1 + OpStore %x_28_phi %int_n1 + OpBranch %148 + %149 = OpLabel + OpStore %x_114_phi %false + OpBranch %147 + %148 = OpLabel + %176 = OpLoad %int %x_28_phi + OpReturnValue %176 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..58324d844d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.spvasm.expected.wgsl @@ -0,0 +1,172 @@ +struct tmp_struct { + nmb : array; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_24 : array; + var x_68 : bool = false; + var x_17 : i32; + var x_18 : i32; + var x_19 : i32; + var x_20 : i32; + var x_69 : bool = false; + var tmp_float : f32; + var color : vec3; + loop { + var x_25 : i32; + var x_101 : vec3; + var x_79_phi : bool; + var x_26_phi : i32; + let x_75 : f32 = x_11.injectionSwitch.y; + tmp_float = x_75; + let x_76 : vec3 = vec3(x_75, x_75, x_75); + color = x_76; + x_24 = tmp_struct(array(0)).nmb; + x_68 = false; + x_79_phi = false; + loop { + var x_21_phi : i32; + var x_25_phi : i32; + var x_93_phi : bool; + let x_79 : bool = x_79_phi; + x_18 = 1; + x_21_phi = 1; + loop { + let x_21 : i32 = x_21_phi; + x_25_phi = 0; + x_93_phi = x_79; + if ((x_21 > 10)) { + } else { + break; + } + let x_22 : i32 = (x_21 - 1); + x_19 = x_22; + let x_23 : i32 = x_24[x_22]; + if ((x_23 == 1)) { + x_68 = true; + x_17 = 1; + x_25_phi = 1; + x_93_phi = true; + break; + } + x_18 = x_22; + + continuing { + x_21_phi = x_22; + } + } + x_25 = x_25_phi; + let x_93 : bool = x_93_phi; + x_26_phi = x_25; + if (x_93) { + break; + } + x_68 = true; + x_17 = -1; + x_26_phi = -1; + break; + + continuing { + x_79_phi = false; + } + } + let x_26 : i32 = x_26_phi; + x_20 = x_26; + if ((x_26 == -1)) { + discard; + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_100 : vec2 = (vec2(x_76.y, x_76.z) + vec2(1.0, 1.0)); + x_101 = vec3(x_76.x, x_100.x, x_100.y); + color = x_101; + let x_103 : f32 = x_11.injectionSwitch.x; + if ((x_103 > 1.0)) { + x_69 = true; + break; + } + } + x_GLF_color = vec4(x_101.x, x_101.y, x_101.z, 1.0); + x_69 = true; + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn binarySearch_struct_tmp_struct_i1_1_1_(obj : ptr) -> i32 { + var x_112 : bool = false; + var x_16 : i32; + var one : i32; + var zero : i32; + var x_27 : i32; + var x_114_phi : bool; + var x_28_phi : i32; + x_114_phi = false; + loop { + var x_15_phi : i32; + var x_27_phi : i32; + var x_128_phi : bool; + let x_114 : bool = x_114_phi; + one = 1; + x_15_phi = 1; + loop { + let x_15 : i32 = x_15_phi; + x_27_phi = 0; + x_128_phi = x_114; + if ((x_15 > 10)) { + } else { + break; + } + let x_13 : i32 = (x_15 - 1); + zero = x_13; + let x_14 : i32 = (*(obj)).nmb[x_13]; + if ((x_14 == 1)) { + x_112 = true; + x_16 = 1; + x_27_phi = 1; + x_128_phi = true; + break; + } + one = x_13; + + continuing { + x_15_phi = x_13; + } + } + x_27 = x_27_phi; + let x_128 : bool = x_128_phi; + x_28_phi = x_27; + if (x_128) { + break; + } + x_112 = true; + x_16 = -1; + x_28_phi = -1; + break; + + continuing { + x_114_phi = false; + } + } + let x_28 : i32 = x_28_phi; + return x_28; +} diff --git a/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl new file mode 100644 index 0000000000..58324d844d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl @@ -0,0 +1,172 @@ +struct tmp_struct { + nmb : array; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_24 : array; + var x_68 : bool = false; + var x_17 : i32; + var x_18 : i32; + var x_19 : i32; + var x_20 : i32; + var x_69 : bool = false; + var tmp_float : f32; + var color : vec3; + loop { + var x_25 : i32; + var x_101 : vec3; + var x_79_phi : bool; + var x_26_phi : i32; + let x_75 : f32 = x_11.injectionSwitch.y; + tmp_float = x_75; + let x_76 : vec3 = vec3(x_75, x_75, x_75); + color = x_76; + x_24 = tmp_struct(array(0)).nmb; + x_68 = false; + x_79_phi = false; + loop { + var x_21_phi : i32; + var x_25_phi : i32; + var x_93_phi : bool; + let x_79 : bool = x_79_phi; + x_18 = 1; + x_21_phi = 1; + loop { + let x_21 : i32 = x_21_phi; + x_25_phi = 0; + x_93_phi = x_79; + if ((x_21 > 10)) { + } else { + break; + } + let x_22 : i32 = (x_21 - 1); + x_19 = x_22; + let x_23 : i32 = x_24[x_22]; + if ((x_23 == 1)) { + x_68 = true; + x_17 = 1; + x_25_phi = 1; + x_93_phi = true; + break; + } + x_18 = x_22; + + continuing { + x_21_phi = x_22; + } + } + x_25 = x_25_phi; + let x_93 : bool = x_93_phi; + x_26_phi = x_25; + if (x_93) { + break; + } + x_68 = true; + x_17 = -1; + x_26_phi = -1; + break; + + continuing { + x_79_phi = false; + } + } + let x_26 : i32 = x_26_phi; + x_20 = x_26; + if ((x_26 == -1)) { + discard; + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_100 : vec2 = (vec2(x_76.y, x_76.z) + vec2(1.0, 1.0)); + x_101 = vec3(x_76.x, x_100.x, x_100.y); + color = x_101; + let x_103 : f32 = x_11.injectionSwitch.x; + if ((x_103 > 1.0)) { + x_69 = true; + break; + } + } + x_GLF_color = vec4(x_101.x, x_101.y, x_101.z, 1.0); + x_69 = true; + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn binarySearch_struct_tmp_struct_i1_1_1_(obj : ptr) -> i32 { + var x_112 : bool = false; + var x_16 : i32; + var one : i32; + var zero : i32; + var x_27 : i32; + var x_114_phi : bool; + var x_28_phi : i32; + x_114_phi = false; + loop { + var x_15_phi : i32; + var x_27_phi : i32; + var x_128_phi : bool; + let x_114 : bool = x_114_phi; + one = 1; + x_15_phi = 1; + loop { + let x_15 : i32 = x_15_phi; + x_27_phi = 0; + x_128_phi = x_114; + if ((x_15 > 10)) { + } else { + break; + } + let x_13 : i32 = (x_15 - 1); + zero = x_13; + let x_14 : i32 = (*(obj)).nmb[x_13]; + if ((x_14 == 1)) { + x_112 = true; + x_16 = 1; + x_27_phi = 1; + x_128_phi = true; + break; + } + one = x_13; + + continuing { + x_15_phi = x_13; + } + } + x_27 = x_27_phi; + let x_128 : bool = x_128_phi; + x_28_phi = x_27; + if (x_128) { + break; + } + x_112 = true; + x_16 = -1; + x_28_phi = -1; + break; + + continuing { + x_114_phi = false; + } + } + let x_28 : i32 = x_28_phi; + return x_28; +} diff --git a/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f0e2766a28 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.hlsl @@ -0,0 +1,168 @@ +struct tmp_struct { + int nmb[1]; +}; + +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_24[1] = (int[1])0; + bool x_68 = false; + int x_17 = 0; + int x_18 = 0; + int x_19 = 0; + int x_20 = 0; + bool x_69 = false; + float tmp_float = 0.0f; + float3 color = float3(0.0f, 0.0f, 0.0f); + while (true) { + int x_25 = 0; + float3 x_101 = float3(0.0f, 0.0f, 0.0f); + bool x_79_phi = false; + int x_26_phi = 0; + const float x_75 = asfloat(x_11[0].y); + tmp_float = x_75; + const float3 x_76 = float3(x_75, x_75, x_75); + color = x_76; + const int tint_symbol_3[1] = {0}; + const tmp_struct tint_symbol_4 = {tint_symbol_3}; + x_24 = tint_symbol_4.nmb; + x_68 = false; + x_79_phi = false; + while (true) { + int x_21_phi = 0; + int x_25_phi = 0; + bool x_93_phi = false; + const bool x_79 = x_79_phi; + x_18 = 1; + x_21_phi = 1; + while (true) { + const int x_21 = x_21_phi; + x_25_phi = 0; + x_93_phi = x_79; + if ((x_21 > 10)) { + } else { + break; + } + const int x_22 = (x_21 - 1); + x_19 = x_22; + const int x_23 = x_24[x_22]; + if ((x_23 == 1)) { + x_68 = true; + x_17 = 1; + x_25_phi = 1; + x_93_phi = true; + break; + } + x_18 = x_22; + { + x_21_phi = x_22; + } + } + x_25 = x_25_phi; + const bool x_93 = x_93_phi; + x_26_phi = x_25; + if (x_93) { + break; + } + x_68 = true; + x_17 = -1; + x_26_phi = -1; + break; + { + x_79_phi = false; + } + } + const int x_26 = x_26_phi; + x_20 = x_26; + if ((x_26 == -1)) { + discard; + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float2 x_100 = (float2(x_76.y, x_76.z) + float2(1.0f, 1.0f)); + x_101 = float3(x_76.x, x_100.x, x_100.y); + color = x_101; + const float x_103 = asfloat(x_11[0].x); + if ((x_103 > 1.0f)) { + x_69 = true; + break; + } + } + x_GLF_color = float4(x_101.x, x_101.y, x_101.z, 1.0f); + x_69 = true; + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} + +int binarySearch_struct_tmp_struct_i1_1_1_(inout tmp_struct obj) { + bool x_112 = false; + int x_16 = 0; + int one = 0; + int zero = 0; + int x_27 = 0; + bool x_114_phi = false; + int x_28_phi = 0; + x_114_phi = false; + while (true) { + int x_15_phi = 0; + int x_27_phi = 0; + bool x_128_phi = false; + const bool x_114 = x_114_phi; + one = 1; + x_15_phi = 1; + while (true) { + const int x_15 = x_15_phi; + x_27_phi = 0; + x_128_phi = x_114; + if ((x_15 > 10)) { + } else { + break; + } + const int x_13 = (x_15 - 1); + zero = x_13; + const int x_14 = obj.nmb[x_13]; + if ((x_14 == 1)) { + x_112 = true; + x_16 = 1; + x_27_phi = 1; + x_128_phi = true; + break; + } + one = x_13; + { + x_15_phi = x_13; + } + } + x_27 = x_27_phi; + const bool x_128 = x_128_phi; + x_28_phi = x_27; + if (x_128) { + break; + } + x_112 = true; + x_16 = -1; + x_28_phi = -1; + break; + { + x_114_phi = false; + } + } + return x_28_phi; +} diff --git a/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..5262879438 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.msl @@ -0,0 +1,174 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[1]; +}; +struct tmp_struct { + tint_array_wrapper nmb; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_11, thread float4* const tint_symbol_6) { + tint_array_wrapper x_24 = {}; + bool x_68 = false; + int x_17 = 0; + int x_18 = 0; + int x_19 = 0; + int x_20 = 0; + bool x_69 = false; + float tmp_float = 0.0f; + float3 color = 0.0f; + while (true) { + int x_25 = 0; + float3 x_101 = 0.0f; + bool x_79_phi = false; + int x_26_phi = 0; + float const x_75 = x_11.injectionSwitch.y; + tmp_float = x_75; + float3 const x_76 = float3(x_75, x_75, x_75); + color = x_76; + tint_array_wrapper const tint_symbol_3 = {.arr={0}}; + tmp_struct const tint_symbol_4 = {.nmb=tint_symbol_3}; + x_24 = tint_symbol_4.nmb; + x_68 = false; + x_79_phi = false; + while (true) { + int x_21_phi = 0; + int x_25_phi = 0; + bool x_93_phi = false; + bool const x_79 = x_79_phi; + x_18 = 1; + x_21_phi = 1; + while (true) { + int const x_21 = x_21_phi; + x_25_phi = 0; + x_93_phi = x_79; + if ((x_21 > 10)) { + } else { + break; + } + int const x_22 = (x_21 - 1); + x_19 = x_22; + int const x_23 = x_24.arr[x_22]; + if ((x_23 == 1)) { + x_68 = true; + x_17 = 1; + x_25_phi = 1; + x_93_phi = true; + break; + } + x_18 = x_22; + { + x_21_phi = x_22; + } + } + x_25 = x_25_phi; + bool const x_93 = x_93_phi; + x_26_phi = x_25; + if (x_93) { + break; + } + x_68 = true; + x_17 = -1; + x_26_phi = -1; + break; + { + x_79_phi = false; + } + } + int const x_26 = x_26_phi; + x_20 = x_26; + if ((x_26 == -1)) { + discard_fragment(); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + float2 const x_100 = (float2(x_76.y, x_76.z) + float2(1.0f, 1.0f)); + x_101 = float3(x_76.x, x_100.x, x_100.y); + color = x_101; + float const x_103 = x_11.injectionSwitch.x; + if ((x_103 > 1.0f)) { + x_69 = true; + break; + } + } + *(tint_symbol_6) = float4(x_101.x, x_101.y, x_101.z, 1.0f); + x_69 = true; + break; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + main_1(x_11, &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_5; +} + +int binarySearch_struct_tmp_struct_i1_1_1_(thread tmp_struct* const obj) { + bool x_112 = false; + int x_16 = 0; + int one = 0; + int zero = 0; + int x_27 = 0; + bool x_114_phi = false; + int x_28_phi = 0; + x_114_phi = false; + while (true) { + int x_15_phi = 0; + int x_27_phi = 0; + bool x_128_phi = false; + bool const x_114 = x_114_phi; + one = 1; + x_15_phi = 1; + while (true) { + int const x_15 = x_15_phi; + x_27_phi = 0; + x_128_phi = x_114; + if ((x_15 > 10)) { + } else { + break; + } + int const x_13 = (x_15 - 1); + zero = x_13; + int const x_14 = (*(obj)).nmb.arr[x_13]; + if ((x_14 == 1)) { + x_112 = true; + x_16 = 1; + x_27_phi = 1; + x_128_phi = true; + break; + } + one = x_13; + { + x_15_phi = x_13; + } + } + x_27 = x_27_phi; + bool const x_128 = x_128_phi; + x_28_phi = x_27; + if (x_128) { + break; + } + x_112 = true; + x_16 = -1; + x_28_phi = -1; + break; + { + x_114_phi = false; + } + } + int const x_28 = x_28_phi; + return x_28; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..18ca5d58de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.spvasm @@ -0,0 +1,345 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 177 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_24 "x_24" + OpName %x_68 "x_68" + OpName %x_17 "x_17" + OpName %x_18 "x_18" + OpName %x_19 "x_19" + OpName %x_20 "x_20" + OpName %x_69 "x_69" + OpName %tmp_float "tmp_float" + OpName %color "color" + OpName %x_25 "x_25" + OpName %x_101 "x_101" + OpName %x_79_phi "x_79_phi" + OpName %x_26_phi "x_26_phi" + OpName %tmp_struct "tmp_struct" + OpMemberName %tmp_struct 0 "nmb" + OpName %x_21_phi "x_21_phi" + OpName %x_25_phi "x_25_phi" + OpName %x_93_phi "x_93_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %binarySearch_struct_tmp_struct_i1_1_1_ "binarySearch_struct_tmp_struct_i1_1_1_" + OpName %obj "obj" + OpName %x_112 "x_112" + OpName %x_16 "x_16" + OpName %one "one" + OpName %zero "zero" + OpName %x_27 "x_27" + OpName %x_114_phi "x_114_phi" + OpName %x_28_phi "x_28_phi" + OpName %x_15_phi "x_15_phi" + OpName %x_27_phi "x_27_phi" + OpName %x_128_phi "x_128_phi" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_1 ArrayStride 4 + OpMemberDecorate %tmp_struct 0 Offset 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 +%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1 + %22 = OpConstantNull %_arr_int_uint_1 + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %37 = OpConstantNull %float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %41 = OpConstantNull %v3float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %tmp_struct = OpTypeStruct %_arr_int_uint_1 + %int_0 = OpConstant %int 0 + %57 = OpConstantComposite %_arr_int_uint_1 %int_0 + %58 = OpConstantComposite %tmp_struct %57 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %true = OpConstantTrue %bool + %int_n1 = OpConstant %int -1 + %float_0 = OpConstant %float 0 + %98 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %103 = OpConstantComposite %v2float %float_1 %float_1 + %uint_2 = OpConstant %uint 2 + %main_out = OpTypeStruct %v4float + %123 = OpTypeFunction %void %main_out +%_ptr_Function_tmp_struct = OpTypePointer Function %tmp_struct + %135 = OpTypeFunction %int %_ptr_Function_tmp_struct + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_24 = OpVariable %_ptr_Function__arr_int_uint_1 Function %22 + %x_68 = OpVariable %_ptr_Function_bool Function %27 + %x_17 = OpVariable %_ptr_Function_int Function %30 + %x_18 = OpVariable %_ptr_Function_int Function %30 + %x_19 = OpVariable %_ptr_Function_int Function %30 + %x_20 = OpVariable %_ptr_Function_int Function %30 + %x_69 = OpVariable %_ptr_Function_bool Function %27 + %tmp_float = OpVariable %_ptr_Function_float Function %37 + %color = OpVariable %_ptr_Function_v3float Function %41 + %x_25 = OpVariable %_ptr_Function_int Function %30 + %x_101 = OpVariable %_ptr_Function_v3float Function %41 + %x_79_phi = OpVariable %_ptr_Function_bool Function %27 + %x_26_phi = OpVariable %_ptr_Function_int Function %30 + %x_21_phi = OpVariable %_ptr_Function_int Function %30 + %x_25_phi = OpVariable %_ptr_Function_int Function %30 + %x_93_phi = OpVariable %_ptr_Function_bool Function %27 + OpStore %x_68 %false + OpStore %x_69 %false + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_1 + %53 = OpLoad %float %52 + OpStore %tmp_float %53 + %54 = OpCompositeConstruct %v3float %53 %53 %53 + OpStore %color %54 + %59 = OpCompositeExtract %_arr_int_uint_1 %58 0 + OpStore %x_24 %59 + OpStore %x_68 %false + OpStore %x_79_phi %false + OpBranch %60 + %60 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + %67 = OpLoad %bool %x_79_phi + OpStore %x_18 %int_1 + OpStore %x_21_phi %int_1 + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %int %x_21_phi + OpStore %x_25_phi %int_0 + OpStore %x_93_phi %67 + %75 = OpSGreaterThan %bool %73 %int_10 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %78 + %77 = OpLabel + OpBranch %76 + %78 = OpLabel + OpBranch %70 + %76 = OpLabel + %79 = OpISub %int %73 %int_1 + OpStore %x_19 %79 + %80 = OpAccessChain %_ptr_Function_int %x_24 %79 + %81 = OpLoad %int %80 + %82 = OpIEqual %bool %81 %int_1 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + OpStore %x_68 %true + OpStore %x_17 %int_1 + OpStore %x_25_phi %int_1 + OpStore %x_93_phi %true + OpBranch %70 + %83 = OpLabel + OpStore %x_18 %79 + OpBranch %71 + %71 = OpLabel + OpStore %x_21_phi %79 + OpBranch %69 + %70 = OpLabel + %86 = OpLoad %int %x_25_phi + OpStore %x_25 %86 + %87 = OpLoad %bool %x_93_phi + %88 = OpLoad %int %x_25 + OpStore %x_26_phi %88 + OpSelectionMerge %89 None + OpBranchConditional %87 %90 %89 + %90 = OpLabel + OpBranch %61 + %89 = OpLabel + OpStore %x_68 %true + OpStore %x_17 %int_n1 + OpStore %x_26_phi %int_n1 + OpBranch %61 + %62 = OpLabel + OpStore %x_79_phi %false + OpBranch %60 + %61 = OpLabel + %92 = OpLoad %int %x_26_phi + OpStore %x_20 %92 + %93 = OpIEqual %bool %92 %int_n1 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %96 + %95 = OpLabel + OpKill + %96 = OpLabel + OpStore %x_GLF_color %98 + %99 = OpCompositeExtract %float %54 1 + %100 = OpCompositeExtract %float %54 2 + %101 = OpCompositeConstruct %v2float %99 %100 + %104 = OpFAdd %v2float %101 %103 + %105 = OpCompositeExtract %float %54 0 + %106 = OpCompositeExtract %float %104 0 + %107 = OpCompositeExtract %float %104 1 + %108 = OpCompositeConstruct %v3float %105 %106 %107 + OpStore %x_101 %108 + %109 = OpLoad %v3float %x_101 + OpStore %color %109 + %110 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_0 + %111 = OpLoad %float %110 + %112 = OpFOrdGreaterThan %bool %111 %float_1 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + OpStore %x_69 %true + OpBranch %43 + %113 = OpLabel + OpBranch %94 + %94 = OpLabel + %115 = OpAccessChain %_ptr_Function_float %x_101 %uint_0 + %116 = OpLoad %float %115 + %117 = OpAccessChain %_ptr_Function_float %x_101 %uint_1 + %118 = OpLoad %float %117 + %120 = OpAccessChain %_ptr_Function_float %x_101 %uint_2 + %121 = OpLoad %float %120 + %122 = OpCompositeConstruct %v4float %116 %118 %121 %float_1 + OpStore %x_GLF_color %122 + OpStore %x_69 %true + OpBranch %43 + %44 = OpLabel + OpBranch %42 + %43 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %123 +%tint_symbol = OpFunctionParameter %main_out + %127 = OpLabel + %128 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %128 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %130 = OpLabel + %131 = OpFunctionCall %void %main_1 + %133 = OpLoad %v4float %x_GLF_color + %134 = OpCompositeConstruct %main_out %133 + %132 = OpFunctionCall %void %tint_symbol_2 %134 + OpReturn + OpFunctionEnd +%binarySearch_struct_tmp_struct_i1_1_1_ = OpFunction %int None %135 + %obj = OpFunctionParameter %_ptr_Function_tmp_struct + %139 = OpLabel + %x_112 = OpVariable %_ptr_Function_bool Function %27 + %x_16 = OpVariable %_ptr_Function_int Function %30 + %one = OpVariable %_ptr_Function_int Function %30 + %zero = OpVariable %_ptr_Function_int Function %30 + %x_27 = OpVariable %_ptr_Function_int Function %30 + %x_114_phi = OpVariable %_ptr_Function_bool Function %27 + %x_28_phi = OpVariable %_ptr_Function_int Function %30 + %x_15_phi = OpVariable %_ptr_Function_int Function %30 + %x_27_phi = OpVariable %_ptr_Function_int Function %30 + %x_128_phi = OpVariable %_ptr_Function_bool Function %27 + OpStore %x_112 %false + OpStore %x_114_phi %false + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %154 = OpLoad %bool %x_114_phi + OpStore %one %int_1 + OpStore %x_15_phi %int_1 + OpBranch %155 + %155 = OpLabel + OpLoopMerge %156 %157 None + OpBranch %158 + %158 = OpLabel + %159 = OpLoad %int %x_15_phi + OpStore %x_27_phi %int_0 + OpStore %x_128_phi %154 + %160 = OpSGreaterThan %bool %159 %int_10 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + OpBranch %161 + %163 = OpLabel + OpBranch %156 + %161 = OpLabel + %164 = OpISub %int %159 %int_1 + OpStore %zero %164 + %166 = OpAccessChain %_ptr_Function_int %obj %uint_0 %164 + %167 = OpLoad %int %166 + %168 = OpIEqual %bool %167 %int_1 + OpSelectionMerge %169 None + OpBranchConditional %168 %170 %169 + %170 = OpLabel + OpStore %x_112 %true + OpStore %x_16 %int_1 + OpStore %x_27_phi %int_1 + OpStore %x_128_phi %true + OpBranch %156 + %169 = OpLabel + OpStore %one %164 + OpBranch %157 + %157 = OpLabel + OpStore %x_15_phi %164 + OpBranch %155 + %156 = OpLabel + %171 = OpLoad %int %x_27_phi + OpStore %x_27 %171 + %172 = OpLoad %bool %x_128_phi + %173 = OpLoad %int %x_27 + OpStore %x_28_phi %173 + OpSelectionMerge %174 None + OpBranchConditional %172 %175 %174 + %175 = OpLabel + OpBranch %148 + %174 = OpLabel + OpStore %x_112 %true + OpStore %x_16 %int_n1 + OpStore %x_28_phi %int_n1 + OpBranch %148 + %149 = OpLabel + OpStore %x_114_phi %false + OpBranch %147 + %148 = OpLabel + %176 = OpLoad %int %x_28_phi + OpReturnValue %176 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..58324d844d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/always-discarding-function/0-opt.wgsl.expected.wgsl @@ -0,0 +1,172 @@ +struct tmp_struct { + nmb : array; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_24 : array; + var x_68 : bool = false; + var x_17 : i32; + var x_18 : i32; + var x_19 : i32; + var x_20 : i32; + var x_69 : bool = false; + var tmp_float : f32; + var color : vec3; + loop { + var x_25 : i32; + var x_101 : vec3; + var x_79_phi : bool; + var x_26_phi : i32; + let x_75 : f32 = x_11.injectionSwitch.y; + tmp_float = x_75; + let x_76 : vec3 = vec3(x_75, x_75, x_75); + color = x_76; + x_24 = tmp_struct(array(0)).nmb; + x_68 = false; + x_79_phi = false; + loop { + var x_21_phi : i32; + var x_25_phi : i32; + var x_93_phi : bool; + let x_79 : bool = x_79_phi; + x_18 = 1; + x_21_phi = 1; + loop { + let x_21 : i32 = x_21_phi; + x_25_phi = 0; + x_93_phi = x_79; + if ((x_21 > 10)) { + } else { + break; + } + let x_22 : i32 = (x_21 - 1); + x_19 = x_22; + let x_23 : i32 = x_24[x_22]; + if ((x_23 == 1)) { + x_68 = true; + x_17 = 1; + x_25_phi = 1; + x_93_phi = true; + break; + } + x_18 = x_22; + + continuing { + x_21_phi = x_22; + } + } + x_25 = x_25_phi; + let x_93 : bool = x_93_phi; + x_26_phi = x_25; + if (x_93) { + break; + } + x_68 = true; + x_17 = -1; + x_26_phi = -1; + break; + + continuing { + x_79_phi = false; + } + } + let x_26 : i32 = x_26_phi; + x_20 = x_26; + if ((x_26 == -1)) { + discard; + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_100 : vec2 = (vec2(x_76.y, x_76.z) + vec2(1.0, 1.0)); + x_101 = vec3(x_76.x, x_100.x, x_100.y); + color = x_101; + let x_103 : f32 = x_11.injectionSwitch.x; + if ((x_103 > 1.0)) { + x_69 = true; + break; + } + } + x_GLF_color = vec4(x_101.x, x_101.y, x_101.z, 1.0); + x_69 = true; + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn binarySearch_struct_tmp_struct_i1_1_1_(obj : ptr) -> i32 { + var x_112 : bool = false; + var x_16 : i32; + var one : i32; + var zero : i32; + var x_27 : i32; + var x_114_phi : bool; + var x_28_phi : i32; + x_114_phi = false; + loop { + var x_15_phi : i32; + var x_27_phi : i32; + var x_128_phi : bool; + let x_114 : bool = x_114_phi; + one = 1; + x_15_phi = 1; + loop { + let x_15 : i32 = x_15_phi; + x_27_phi = 0; + x_128_phi = x_114; + if ((x_15 > 10)) { + } else { + break; + } + let x_13 : i32 = (x_15 - 1); + zero = x_13; + let x_14 : i32 = (*(obj)).nmb[x_13]; + if ((x_14 == 1)) { + x_112 = true; + x_16 = 1; + x_27_phi = 1; + x_128_phi = true; + break; + } + one = x_13; + + continuing { + x_15_phi = x_13; + } + } + x_27 = x_27_phi; + let x_128 : bool = x_128_phi; + x_28_phi = x_27; + if (x_128) { + break; + } + x_112 = true; + x_16 = -1; + x_28_phi = -1; + break; + + continuing { + x_114_phi = false; + } + } + let x_28 : i32 = x_28_phi; + return x_28; +} diff --git a/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm new file mode 100644 index 0000000000..323b9875a2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm @@ -0,0 +1,315 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %swap_i1_i1_ "swap(i1;i1;" + OpName %i "i" + OpName %j "j" + OpName %performPartition_i1_i1_ "performPartition(i1;i1;" + OpName %l "l" + OpName %h "h" + OpName %quicksort_ "quicksort(" + OpName %temp "temp" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %pivot "pivot" + OpName %i_0 "i" + OpName %j_0 "j" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %l_0 "l" + OpName %h_0 "h" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %i_1 "i" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %32 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %36 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %int_10 = OpConstant %int 10 + %int_4 = OpConstant %int 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %55 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %56 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %main = OpFunction %void None %32 + %59 = OpLabel + %i_1 = OpVariable %_ptr_Function_int Function + OpStore %i_1 %int_0 + OpBranch %60 + %60 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + %64 = OpLoad %int %i_1 + %65 = OpSLessThan %bool %64 %int_10 + OpBranchConditional %65 %66 %61 + %66 = OpLabel + %67 = OpLoad %int %i_1 + %68 = OpLoad %int %i_1 + %69 = OpISub %int %int_10 %68 + %70 = OpAccessChain %_ptr_Private_int %obj %int_0 %67 + OpStore %70 %69 + %71 = OpLoad %int %i_1 + %72 = OpLoad %int %i_1 + %73 = OpAccessChain %_ptr_Private_int %obj %int_0 %72 + %74 = OpLoad %int %73 + %75 = OpLoad %int %i_1 + %76 = OpAccessChain %_ptr_Private_int %obj %int_0 %75 + %77 = OpLoad %int %76 + %78 = OpIMul %int %74 %77 + %79 = OpAccessChain %_ptr_Private_int %obj %int_0 %71 + OpStore %79 %78 + OpBranch %62 + %62 = OpLabel + %80 = OpLoad %int %i_1 + %81 = OpIAdd %int %80 %int_1 + OpStore %i_1 %81 + OpBranch %60 + %61 = OpLabel + %82 = OpFunctionCall %void %quicksort_ + %83 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_0 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_4 + %86 = OpLoad %int %85 + %87 = OpSLessThan %bool %84 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %90 + %89 = OpLabel + OpStore %_GLF_color %55 + OpBranch %88 + %90 = OpLabel + OpStore %_GLF_color %56 + OpBranch %88 + %88 = OpLabel + OpReturn + OpFunctionEnd +%swap_i1_i1_ = OpFunction %void None %35 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %91 = OpLabel + %temp = OpVariable %_ptr_Function_int Function + %92 = OpLoad %int %i + %93 = OpAccessChain %_ptr_Private_int %obj %int_0 %92 + %94 = OpLoad %int %93 + OpStore %temp %94 + %95 = OpLoad %int %i + %96 = OpLoad %int %j + %97 = OpAccessChain %_ptr_Private_int %obj %int_0 %96 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Private_int %obj %int_0 %95 + OpStore %99 %98 + %100 = OpLoad %int %j + %101 = OpLoad %int %temp + %102 = OpAccessChain %_ptr_Private_int %obj %int_0 %100 + OpStore %102 %101 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %36 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %103 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_int Function + %104 = OpLoad %int %h + %105 = OpAccessChain %_ptr_Private_int %obj %int_0 %104 + %106 = OpLoad %int %105 + OpStore %pivot %106 + %107 = OpLoad %int %l + %108 = OpISub %int %107 %int_1 + OpStore %i_0 %108 + %109 = OpLoad %int %l + OpStore %j_0 %109 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %int %j_0 + %115 = OpLoad %int %h + %116 = OpISub %int %115 %int_1 + %117 = OpSLessThanEqual %bool %114 %116 + OpBranchConditional %117 %118 %111 + %118 = OpLabel + %119 = OpLoad %int %j_0 + %120 = OpAccessChain %_ptr_Private_int %obj %int_0 %119 + %121 = OpLoad %int %120 + %122 = OpLoad %int %pivot + %123 = OpSLessThanEqual %bool %121 %122 + OpSelectionMerge %124 None + OpBranchConditional %123 %125 %124 + %125 = OpLabel + %126 = OpLoad %int %i_0 + %127 = OpIAdd %int %126 %int_1 + OpStore %i_0 %127 + %128 = OpLoad %int %i_0 + OpStore %param %128 + %129 = OpLoad %int %j_0 + OpStore %param_0 %129 + %130 = OpFunctionCall %void %swap_i1_i1_ %param %param_0 + OpBranch %124 + %124 = OpLabel + OpBranch %112 + %112 = OpLabel + %131 = OpLoad %int %j_0 + %132 = OpIAdd %int %131 %int_1 + OpStore %j_0 %132 + OpBranch %110 + %111 = OpLabel + %133 = OpLoad %int %i_0 + %134 = OpIAdd %int %133 %int_1 + OpStore %param_1 %134 + %135 = OpLoad %int %h + OpStore %param_2 %135 + %136 = OpFunctionCall %void %swap_i1_i1_ %param_1 %param_2 + %137 = OpLoad %int %i_0 + %138 = OpIAdd %int %137 %int_1 + OpReturnValue %138 + OpFunctionEnd + %quicksort_ = OpFunction %void None %32 + %139 = OpLabel + %l_0 = OpVariable %_ptr_Function_int Function + %h_0 = OpVariable %_ptr_Function_int Function + %top = OpVariable %_ptr_Function_int Function + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function + %p = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_int Function + %param_4 = OpVariable %_ptr_Function_int Function + OpStore %l_0 %int_0 + OpStore %h_0 %int_9 + OpStore %top %int_n1 + %140 = OpLoad %int %top + %141 = OpIAdd %int %140 %int_1 + OpStore %top %141 + %142 = OpLoad %int %l_0 + %143 = OpAccessChain %_ptr_Function_int %stack %141 + OpStore %143 %142 + %144 = OpLoad %int %top + %145 = OpIAdd %int %144 %int_1 + OpStore %top %145 + %146 = OpLoad %int %h_0 + %147 = OpAccessChain %_ptr_Function_int %stack %145 + OpStore %147 %146 + OpBranch %148 + %148 = OpLabel + OpLoopMerge %149 %150 None + OpBranch %151 + %151 = OpLabel + %152 = OpLoad %int %top + %153 = OpSGreaterThanEqual %bool %152 %int_0 + OpBranchConditional %153 %154 %149 + %154 = OpLabel + %155 = OpLoad %int %top + %156 = OpISub %int %155 %int_1 + OpStore %top %156 + %157 = OpAccessChain %_ptr_Function_int %stack %155 + %158 = OpLoad %int %157 + OpStore %h_0 %158 + %159 = OpLoad %int %top + %160 = OpISub %int %159 %int_1 + OpStore %top %160 + %161 = OpAccessChain %_ptr_Function_int %stack %159 + %162 = OpLoad %int %161 + OpStore %l_0 %162 + %163 = OpLoad %int %l_0 + OpStore %param_3 %163 + %164 = OpLoad %int %h_0 + OpStore %param_4 %164 + %165 = OpFunctionCall %int %performPartition_i1_i1_ %param_3 %param_4 + OpStore %p %165 + %166 = OpLoad %int %p + %167 = OpISub %int %166 %int_1 + %168 = OpLoad %int %l_0 + %169 = OpSGreaterThan %bool %167 %168 + OpSelectionMerge %170 None + OpBranchConditional %169 %171 %170 + %171 = OpLabel + %172 = OpLoad %int %top + %173 = OpIAdd %int %172 %int_1 + OpStore %top %173 + %174 = OpLoad %int %l_0 + %175 = OpAccessChain %_ptr_Function_int %stack %173 + OpStore %175 %174 + %176 = OpLoad %int %top + %177 = OpIAdd %int %176 %int_1 + OpStore %top %177 + %178 = OpLoad %int %p + %179 = OpISub %int %178 %int_1 + %180 = OpAccessChain %_ptr_Function_int %stack %177 + OpStore %180 %179 + OpBranch %170 + %170 = OpLabel + %181 = OpLoad %int %p + %182 = OpIAdd %int %181 %int_1 + %183 = OpLoad %int %h_0 + %184 = OpSLessThan %bool %182 %183 + OpSelectionMerge %185 None + OpBranchConditional %184 %186 %185 + %186 = OpLabel + %187 = OpLoad %int %top + %188 = OpIAdd %int %187 %int_1 + OpStore %top %188 + %189 = OpLoad %int %p + %190 = OpIAdd %int %189 %int_1 + %191 = OpAccessChain %_ptr_Function_int %stack %188 + OpStore %191 %190 + %192 = OpLoad %int %top + %193 = OpIAdd %int %192 %int_1 + OpStore %top %193 + %194 = OpLoad %int %h_0 + %195 = OpAccessChain %_ptr_Function_int %stack %193 + OpStore %195 %194 + OpBranch %185 + %185 = OpLabel + OpBranch %150 + %150 = OpLabel + OpBranch %148 + %149 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2e1f778a27 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.hlsl @@ -0,0 +1,154 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_30 : register(b0, space0) { + uint4 x_30[1]; +}; + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_92 = i; + const int x_94 = obj.numbers[x_92]; + temp = x_94; + const int x_95 = i; + const int x_96 = j; + const int x_98 = obj.numbers[x_96]; + obj.numbers[x_95] = x_98; + const int x_100 = j; + obj.numbers[x_100] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_104 = h; + const int x_106 = obj.numbers[x_104]; + pivot = x_106; + const int x_107 = l; + i_1 = (x_107 - 1); + const int x_109 = l; + j_1 = x_109; + while (true) { + const int x_114 = j_1; + const int x_115 = h; + if ((x_114 <= (x_115 - 1))) { + } else { + break; + } + const int x_121 = obj.numbers[j_1]; + if ((x_121 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + param_2 = (i_1 + 1); + const int x_135 = h; + param_3 = x_135; + swap_i1_i1_(param_2, param_3); + return (i_1 + 1); +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_141 = (top + 1); + top = x_141; + stack[x_141] = l_1; + const int x_145 = (top + 1); + top = x_145; + stack[x_145] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_155 = top; + top = (x_155 - 1); + const int x_158 = stack[x_155]; + h_1 = x_158; + const int x_159 = top; + top = (x_159 - 1); + const int x_162 = stack[x_159]; + l_1 = x_162; + param_4 = l_1; + param_5 = h_1; + const int x_165 = performPartition_i1_i1_(param_4, param_5); + p = x_165; + if (((p - 1) > l_1)) { + const int x_173 = (top + 1); + top = x_173; + stack[x_173] = l_1; + const int x_177 = (top + 1); + top = x_177; + stack[x_177] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_188 = (top + 1); + top = x_188; + stack[x_188] = (p + 1); + const int x_193 = (top + 1); + top = x_193; + stack[x_193] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_71 = i_2; + const int x_74 = obj.numbers[i_2]; + const int x_77 = obj.numbers[i_2]; + obj.numbers[x_71] = (x_74 * x_77); + } + } + quicksort_(); + const int x_84 = obj.numbers[0]; + const int x_86 = obj.numbers[4]; + if ((x_84 < x_86)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 1.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..3bf51a59ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.msl @@ -0,0 +1,198 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_4) { + int temp = 0; + int const x_92 = *(i); + int const x_94 = (*(tint_symbol_4)).numbers.arr[x_92]; + temp = x_94; + int const x_95 = *(i); + int const x_96 = *(j); + int const x_98 = (*(tint_symbol_4)).numbers.arr[x_96]; + (*(tint_symbol_4)).numbers.arr[x_95] = x_98; + int const x_100 = *(j); + int const x_101 = temp; + (*(tint_symbol_4)).numbers.arr[x_100] = x_101; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_5) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_104 = *(h); + int const x_106 = (*(tint_symbol_5)).numbers.arr[x_104]; + pivot = x_106; + int const x_107 = *(l); + i_1 = (x_107 - 1); + int const x_109 = *(l); + j_1 = x_109; + while (true) { + int const x_114 = j_1; + int const x_115 = *(h); + if ((x_114 <= (x_115 - 1))) { + } else { + break; + } + int const x_119 = j_1; + int const x_121 = (*(tint_symbol_5)).numbers.arr[x_119]; + int const x_122 = pivot; + if ((x_121 <= x_122)) { + int const x_126 = i_1; + i_1 = (x_126 + 1); + int const x_128 = i_1; + param = x_128; + int const x_129 = j_1; + param_1 = x_129; + swap_i1_i1_(&(param), &(param_1), tint_symbol_5); + } + { + int const x_131 = j_1; + j_1 = (x_131 + 1); + } + } + int const x_133 = i_1; + param_2 = (x_133 + 1); + int const x_135 = *(h); + param_3 = x_135; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_5); + int const x_137 = i_1; + return (x_137 + 1); +} + +void quicksort_(thread QuicksortObject* const tint_symbol_6) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_140 = top; + int const x_141 = (x_140 + 1); + top = x_141; + int const x_142 = l_1; + stack.arr[x_141] = x_142; + int const x_144 = top; + int const x_145 = (x_144 + 1); + top = x_145; + int const x_146 = h_1; + stack.arr[x_145] = x_146; + while (true) { + int const x_152 = top; + if ((x_152 >= 0)) { + } else { + break; + } + int const x_155 = top; + top = (x_155 - 1); + int const x_158 = stack.arr[x_155]; + h_1 = x_158; + int const x_159 = top; + top = (x_159 - 1); + int const x_162 = stack.arr[x_159]; + l_1 = x_162; + int const x_163 = l_1; + param_4 = x_163; + int const x_164 = h_1; + param_5 = x_164; + int const x_165 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_6); + p = x_165; + int const x_166 = p; + int const x_168 = l_1; + if (((x_166 - 1) > x_168)) { + int const x_172 = top; + int const x_173 = (x_172 + 1); + top = x_173; + int const x_174 = l_1; + stack.arr[x_173] = x_174; + int const x_176 = top; + int const x_177 = (x_176 + 1); + top = x_177; + int const x_178 = p; + stack.arr[x_177] = (x_178 - 1); + } + int const x_181 = p; + int const x_183 = h_1; + if (((x_181 + 1) < x_183)) { + int const x_187 = top; + int const x_188 = (x_187 + 1); + top = x_188; + int const x_189 = p; + stack.arr[x_188] = (x_189 + 1); + int const x_192 = top; + int const x_193 = (x_192 + 1); + top = x_193; + int const x_194 = h_1; + stack.arr[x_193] = x_194; + } + } + return; +} + +void main_1(thread QuicksortObject* const tint_symbol_7, thread float4* const tint_symbol_8) { + int i_2 = 0; + i_2 = 0; + while (true) { + int const x_64 = i_2; + if ((x_64 < 10)) { + } else { + break; + } + int const x_67 = i_2; + int const x_68 = i_2; + (*(tint_symbol_7)).numbers.arr[x_67] = (10 - x_68); + int const x_71 = i_2; + int const x_72 = i_2; + int const x_74 = (*(tint_symbol_7)).numbers.arr[x_72]; + int const x_75 = i_2; + int const x_77 = (*(tint_symbol_7)).numbers.arr[x_75]; + (*(tint_symbol_7)).numbers.arr[x_71] = (x_74 * x_77); + { + int const x_80 = i_2; + i_2 = (x_80 + 1); + } + } + quicksort_(tint_symbol_7); + int const x_84 = (*(tint_symbol_7)).numbers.arr[0]; + int const x_86 = (*(tint_symbol_7)).numbers.arr[4]; + if ((x_84 < x_86)) { + *(tint_symbol_8) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_8) = float4(0.0f, 1.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread QuicksortObject tint_symbol_9 = {}; + thread float4 tint_symbol_10 = 0.0f; + main_1(&(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..7a0c9e691b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.spvasm @@ -0,0 +1,367 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 235 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_30 "x_30" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_30 NonWritable + OpDecorate %x_30 DescriptorSet 0 + OpDecorate %x_30 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %8 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_30 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %46 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %106 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %114 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 + %int_10 = OpConstant %int 10 + %int_4 = OpConstant %int 4 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %221 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %222 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %223 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %20 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %26 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %28 + %30 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Private_int %obj %uint_0 %30 + %34 = OpLoad %int %33 + OpStore %temp %34 + %36 = OpLoad %int %i + %38 = OpLoad %int %j + %39 = OpAccessChain %_ptr_Private_int %obj %uint_0 %38 + %40 = OpLoad %int %39 + %41 = OpAccessChain %_ptr_Private_int %obj %uint_0 %36 + OpStore %41 %40 + %43 = OpLoad %int %j + %44 = OpLoad %int %temp + %45 = OpAccessChain %_ptr_Private_int %obj %uint_0 %43 + OpStore %45 %44 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %46 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %50 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %28 + %i_1 = OpVariable %_ptr_Function_int Function %28 + %j_1 = OpVariable %_ptr_Function_int Function %28 + %param = OpVariable %_ptr_Function_int Function %28 + %param_1 = OpVariable %_ptr_Function_int Function %28 + %param_2 = OpVariable %_ptr_Function_int Function %28 + %param_3 = OpVariable %_ptr_Function_int Function %28 + %59 = OpLoad %int %h + %60 = OpAccessChain %_ptr_Private_int %obj %uint_0 %59 + %61 = OpLoad %int %60 + OpStore %pivot %61 + %63 = OpLoad %int %l + %65 = OpISub %int %63 %int_1 + OpStore %i_1 %65 + %67 = OpLoad %int %l + OpStore %j_1 %67 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %72 = OpLoad %int %j_1 + %74 = OpLoad %int %h + %75 = OpISub %int %74 %int_1 + %76 = OpSLessThanEqual %bool %72 %75 + OpSelectionMerge %78 None + OpBranchConditional %76 %79 %80 + %79 = OpLabel + OpBranch %78 + %80 = OpLabel + OpBranch %69 + %78 = OpLabel + %81 = OpLoad %int %j_1 + %82 = OpAccessChain %_ptr_Private_int %obj %uint_0 %81 + %83 = OpLoad %int %82 + %84 = OpLoad %int %pivot + %85 = OpSLessThanEqual %bool %83 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpLoad %int %i_1 + %89 = OpIAdd %int %88 %int_1 + OpStore %i_1 %89 + %90 = OpLoad %int %i_1 + OpStore %param %90 + %91 = OpLoad %int %j_1 + OpStore %param_1 %91 + %92 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %86 + %86 = OpLabel + OpBranch %70 + %70 = OpLabel + %95 = OpLoad %int %j_1 + %96 = OpIAdd %int %95 %int_1 + OpStore %j_1 %96 + OpBranch %68 + %69 = OpLabel + %97 = OpLoad %int %i_1 + %98 = OpIAdd %int %97 %int_1 + OpStore %param_2 %98 + %100 = OpLoad %int %h + OpStore %param_3 %100 + %101 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %104 = OpLoad %int %i_1 + %105 = OpIAdd %int %104 %int_1 + OpReturnValue %105 + OpFunctionEnd + %quicksort_ = OpFunction %void None %106 + %108 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %28 + %h_1 = OpVariable %_ptr_Function_int Function %28 + %top = OpVariable %_ptr_Function_int Function %28 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %114 + %p = OpVariable %_ptr_Function_int Function %28 + %param_4 = OpVariable %_ptr_Function_int Function %28 + %param_5 = OpVariable %_ptr_Function_int Function %28 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %121 = OpLoad %int %top + %122 = OpIAdd %int %121 %int_1 + OpStore %top %122 + %123 = OpLoad %int %l_1 + %124 = OpAccessChain %_ptr_Function_int %stack %122 + OpStore %124 %123 + %125 = OpLoad %int %top + %126 = OpIAdd %int %125 %int_1 + OpStore %top %126 + %127 = OpLoad %int %h_1 + %128 = OpAccessChain %_ptr_Function_int %stack %126 + OpStore %128 %127 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %133 = OpLoad %int %top + %134 = OpSGreaterThanEqual %bool %133 %int_0 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 + %136 = OpLabel + OpBranch %135 + %137 = OpLabel + OpBranch %130 + %135 = OpLabel + %138 = OpLoad %int %top + %139 = OpISub %int %138 %int_1 + OpStore %top %139 + %140 = OpAccessChain %_ptr_Function_int %stack %138 + %141 = OpLoad %int %140 + OpStore %h_1 %141 + %142 = OpLoad %int %top + %143 = OpISub %int %142 %int_1 + OpStore %top %143 + %144 = OpAccessChain %_ptr_Function_int %stack %142 + %145 = OpLoad %int %144 + OpStore %l_1 %145 + %146 = OpLoad %int %l_1 + OpStore %param_4 %146 + %147 = OpLoad %int %h_1 + OpStore %param_5 %147 + %148 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %148 + %151 = OpLoad %int %p + %152 = OpLoad %int %l_1 + %153 = OpISub %int %151 %int_1 + %154 = OpSGreaterThan %bool %153 %152 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %155 + %156 = OpLabel + %157 = OpLoad %int %top + %158 = OpIAdd %int %157 %int_1 + OpStore %top %158 + %159 = OpLoad %int %l_1 + %160 = OpAccessChain %_ptr_Function_int %stack %158 + OpStore %160 %159 + %161 = OpLoad %int %top + %162 = OpIAdd %int %161 %int_1 + OpStore %top %162 + %163 = OpLoad %int %p + %164 = OpAccessChain %_ptr_Function_int %stack %162 + %165 = OpISub %int %163 %int_1 + OpStore %164 %165 + OpBranch %155 + %155 = OpLabel + %166 = OpLoad %int %p + %167 = OpLoad %int %h_1 + %168 = OpIAdd %int %166 %int_1 + %169 = OpSLessThan %bool %168 %167 + OpSelectionMerge %170 None + OpBranchConditional %169 %171 %170 + %171 = OpLabel + %172 = OpLoad %int %top + %173 = OpIAdd %int %172 %int_1 + OpStore %top %173 + %174 = OpLoad %int %p + %175 = OpAccessChain %_ptr_Function_int %stack %173 + %176 = OpIAdd %int %174 %int_1 + OpStore %175 %176 + %177 = OpLoad %int %top + %178 = OpIAdd %int %177 %int_1 + OpStore %top %178 + %179 = OpLoad %int %h_1 + %180 = OpAccessChain %_ptr_Function_int %stack %178 + OpStore %180 %179 + OpBranch %170 + %170 = OpLabel + OpBranch %131 + %131 = OpLabel + OpBranch %129 + %130 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %106 + %182 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %28 + OpStore %i_2 %int_0 + OpBranch %184 + %184 = OpLabel + OpLoopMerge %185 %186 None + OpBranch %187 + %187 = OpLabel + %188 = OpLoad %int %i_2 + %190 = OpSLessThan %bool %188 %int_10 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %193 + %192 = OpLabel + OpBranch %191 + %193 = OpLabel + OpBranch %185 + %191 = OpLabel + %194 = OpLoad %int %i_2 + %195 = OpLoad %int %i_2 + %196 = OpAccessChain %_ptr_Private_int %obj %uint_0 %194 + %197 = OpISub %int %int_10 %195 + OpStore %196 %197 + %198 = OpLoad %int %i_2 + %199 = OpLoad %int %i_2 + %200 = OpAccessChain %_ptr_Private_int %obj %uint_0 %199 + %201 = OpLoad %int %200 + %202 = OpLoad %int %i_2 + %203 = OpAccessChain %_ptr_Private_int %obj %uint_0 %202 + %204 = OpLoad %int %203 + %205 = OpAccessChain %_ptr_Private_int %obj %uint_0 %198 + %206 = OpIMul %int %201 %204 + OpStore %205 %206 + OpBranch %186 + %186 = OpLabel + %207 = OpLoad %int %i_2 + %208 = OpIAdd %int %207 %int_1 + OpStore %i_2 %208 + OpBranch %184 + %185 = OpLabel + %209 = OpFunctionCall %void %quicksort_ + %210 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %211 = OpLoad %int %210 + %213 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %214 = OpLoad %int %213 + %215 = OpSLessThan %bool %211 %214 + OpSelectionMerge %216 None + OpBranchConditional %215 %217 %218 + %217 = OpLabel + OpStore %x_GLF_color %221 + OpBranch %216 + %218 = OpLabel + OpStore %x_GLF_color %222 + OpBranch %216 + %216 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %223 +%tint_symbol = OpFunctionParameter %main_out + %227 = OpLabel + %228 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %228 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %106 + %230 = OpLabel + %231 = OpFunctionCall %void %main_1 + %233 = OpLoad %v4float %x_GLF_color + %234 = OpCompositeConstruct %main_out %233 + %232 = OpFunctionCall %void %tint_symbol_2 %234 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..03cd2baa71 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.wgsl @@ -0,0 +1,197 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_30 : buf0; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_92 : i32 = *(i); + let x_94 : i32 = obj.numbers[x_92]; + temp = x_94; + let x_95 : i32 = *(i); + let x_96 : i32 = *(j); + let x_98 : i32 = obj.numbers[x_96]; + obj.numbers[x_95] = x_98; + let x_100 : i32 = *(j); + let x_101 : i32 = temp; + obj.numbers[x_100] = x_101; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_104 : i32 = *(h); + let x_106 : i32 = obj.numbers[x_104]; + pivot = x_106; + let x_107 : i32 = *(l); + i_1 = (x_107 - 1); + let x_109 : i32 = *(l); + j_1 = x_109; + loop { + let x_114 : i32 = j_1; + let x_115 : i32 = *(h); + if ((x_114 <= (x_115 - 1))) { + } else { + break; + } + let x_119 : i32 = j_1; + let x_121 : i32 = obj.numbers[x_119]; + let x_122 : i32 = pivot; + if ((x_121 <= x_122)) { + let x_126 : i32 = i_1; + i_1 = (x_126 + 1); + let x_128 : i32 = i_1; + param = x_128; + let x_129 : i32 = j_1; + param_1 = x_129; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_131 : i32 = j_1; + j_1 = (x_131 + 1); + } + } + let x_133 : i32 = i_1; + param_2 = (x_133 + 1); + let x_135 : i32 = *(h); + param_3 = x_135; + swap_i1_i1_(&(param_2), &(param_3)); + let x_137 : i32 = i_1; + return (x_137 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_140 : i32 = top; + let x_141 : i32 = (x_140 + 1); + top = x_141; + let x_142 : i32 = l_1; + stack[x_141] = x_142; + let x_144 : i32 = top; + let x_145 : i32 = (x_144 + 1); + top = x_145; + let x_146 : i32 = h_1; + stack[x_145] = x_146; + loop { + let x_152 : i32 = top; + if ((x_152 >= 0)) { + } else { + break; + } + let x_155 : i32 = top; + top = (x_155 - 1); + let x_158 : i32 = stack[x_155]; + h_1 = x_158; + let x_159 : i32 = top; + top = (x_159 - 1); + let x_162 : i32 = stack[x_159]; + l_1 = x_162; + let x_163 : i32 = l_1; + param_4 = x_163; + let x_164 : i32 = h_1; + param_5 = x_164; + let x_165 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_165; + let x_166 : i32 = p; + let x_168 : i32 = l_1; + if (((x_166 - 1) > x_168)) { + let x_172 : i32 = top; + let x_173 : i32 = (x_172 + 1); + top = x_173; + let x_174 : i32 = l_1; + stack[x_173] = x_174; + let x_176 : i32 = top; + let x_177 : i32 = (x_176 + 1); + top = x_177; + let x_178 : i32 = p; + stack[x_177] = (x_178 - 1); + } + let x_181 : i32 = p; + let x_183 : i32 = h_1; + if (((x_181 + 1) < x_183)) { + let x_187 : i32 = top; + let x_188 : i32 = (x_187 + 1); + top = x_188; + let x_189 : i32 = p; + stack[x_188] = (x_189 + 1); + let x_192 : i32 = top; + let x_193 : i32 = (x_192 + 1); + top = x_193; + let x_194 : i32 = h_1; + stack[x_193] = x_194; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + i_2 = 0; + loop { + let x_64 : i32 = i_2; + if ((x_64 < 10)) { + } else { + break; + } + let x_67 : i32 = i_2; + let x_68 : i32 = i_2; + obj.numbers[x_67] = (10 - x_68); + let x_71 : i32 = i_2; + let x_72 : i32 = i_2; + let x_74 : i32 = obj.numbers[x_72]; + let x_75 : i32 = i_2; + let x_77 : i32 = obj.numbers[x_75]; + obj.numbers[x_71] = (x_74 * x_77); + + continuing { + let x_80 : i32 = i_2; + i_2 = (x_80 + 1); + } + } + quicksort_(); + let x_84 : i32 = obj.numbers[0]; + let x_86 : i32 = obj.numbers[4]; + if ((x_84 < x_86)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 1.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl new file mode 100644 index 0000000000..03cd2baa71 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl @@ -0,0 +1,197 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_30 : buf0; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_92 : i32 = *(i); + let x_94 : i32 = obj.numbers[x_92]; + temp = x_94; + let x_95 : i32 = *(i); + let x_96 : i32 = *(j); + let x_98 : i32 = obj.numbers[x_96]; + obj.numbers[x_95] = x_98; + let x_100 : i32 = *(j); + let x_101 : i32 = temp; + obj.numbers[x_100] = x_101; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_104 : i32 = *(h); + let x_106 : i32 = obj.numbers[x_104]; + pivot = x_106; + let x_107 : i32 = *(l); + i_1 = (x_107 - 1); + let x_109 : i32 = *(l); + j_1 = x_109; + loop { + let x_114 : i32 = j_1; + let x_115 : i32 = *(h); + if ((x_114 <= (x_115 - 1))) { + } else { + break; + } + let x_119 : i32 = j_1; + let x_121 : i32 = obj.numbers[x_119]; + let x_122 : i32 = pivot; + if ((x_121 <= x_122)) { + let x_126 : i32 = i_1; + i_1 = (x_126 + 1); + let x_128 : i32 = i_1; + param = x_128; + let x_129 : i32 = j_1; + param_1 = x_129; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_131 : i32 = j_1; + j_1 = (x_131 + 1); + } + } + let x_133 : i32 = i_1; + param_2 = (x_133 + 1); + let x_135 : i32 = *(h); + param_3 = x_135; + swap_i1_i1_(&(param_2), &(param_3)); + let x_137 : i32 = i_1; + return (x_137 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_140 : i32 = top; + let x_141 : i32 = (x_140 + 1); + top = x_141; + let x_142 : i32 = l_1; + stack[x_141] = x_142; + let x_144 : i32 = top; + let x_145 : i32 = (x_144 + 1); + top = x_145; + let x_146 : i32 = h_1; + stack[x_145] = x_146; + loop { + let x_152 : i32 = top; + if ((x_152 >= 0)) { + } else { + break; + } + let x_155 : i32 = top; + top = (x_155 - 1); + let x_158 : i32 = stack[x_155]; + h_1 = x_158; + let x_159 : i32 = top; + top = (x_159 - 1); + let x_162 : i32 = stack[x_159]; + l_1 = x_162; + let x_163 : i32 = l_1; + param_4 = x_163; + let x_164 : i32 = h_1; + param_5 = x_164; + let x_165 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_165; + let x_166 : i32 = p; + let x_168 : i32 = l_1; + if (((x_166 - 1) > x_168)) { + let x_172 : i32 = top; + let x_173 : i32 = (x_172 + 1); + top = x_173; + let x_174 : i32 = l_1; + stack[x_173] = x_174; + let x_176 : i32 = top; + let x_177 : i32 = (x_176 + 1); + top = x_177; + let x_178 : i32 = p; + stack[x_177] = (x_178 - 1); + } + let x_181 : i32 = p; + let x_183 : i32 = h_1; + if (((x_181 + 1) < x_183)) { + let x_187 : i32 = top; + let x_188 : i32 = (x_187 + 1); + top = x_188; + let x_189 : i32 = p; + stack[x_188] = (x_189 + 1); + let x_192 : i32 = top; + let x_193 : i32 = (x_192 + 1); + top = x_193; + let x_194 : i32 = h_1; + stack[x_193] = x_194; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + i_2 = 0; + loop { + let x_64 : i32 = i_2; + if ((x_64 < 10)) { + } else { + break; + } + let x_67 : i32 = i_2; + let x_68 : i32 = i_2; + obj.numbers[x_67] = (10 - x_68); + let x_71 : i32 = i_2; + let x_72 : i32 = i_2; + let x_74 : i32 = obj.numbers[x_72]; + let x_75 : i32 = i_2; + let x_77 : i32 = obj.numbers[x_75]; + obj.numbers[x_71] = (x_74 * x_77); + + continuing { + let x_80 : i32 = i_2; + i_2 = (x_80 + 1); + } + } + quicksort_(); + let x_84 : i32 = obj.numbers[0]; + let x_86 : i32 = obj.numbers[4]; + if ((x_84 < x_86)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 1.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2e1f778a27 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.hlsl @@ -0,0 +1,154 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_30 : register(b0, space0) { + uint4 x_30[1]; +}; + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_92 = i; + const int x_94 = obj.numbers[x_92]; + temp = x_94; + const int x_95 = i; + const int x_96 = j; + const int x_98 = obj.numbers[x_96]; + obj.numbers[x_95] = x_98; + const int x_100 = j; + obj.numbers[x_100] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_104 = h; + const int x_106 = obj.numbers[x_104]; + pivot = x_106; + const int x_107 = l; + i_1 = (x_107 - 1); + const int x_109 = l; + j_1 = x_109; + while (true) { + const int x_114 = j_1; + const int x_115 = h; + if ((x_114 <= (x_115 - 1))) { + } else { + break; + } + const int x_121 = obj.numbers[j_1]; + if ((x_121 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + param_2 = (i_1 + 1); + const int x_135 = h; + param_3 = x_135; + swap_i1_i1_(param_2, param_3); + return (i_1 + 1); +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_141 = (top + 1); + top = x_141; + stack[x_141] = l_1; + const int x_145 = (top + 1); + top = x_145; + stack[x_145] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_155 = top; + top = (x_155 - 1); + const int x_158 = stack[x_155]; + h_1 = x_158; + const int x_159 = top; + top = (x_159 - 1); + const int x_162 = stack[x_159]; + l_1 = x_162; + param_4 = l_1; + param_5 = h_1; + const int x_165 = performPartition_i1_i1_(param_4, param_5); + p = x_165; + if (((p - 1) > l_1)) { + const int x_173 = (top + 1); + top = x_173; + stack[x_173] = l_1; + const int x_177 = (top + 1); + top = x_177; + stack[x_177] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_188 = (top + 1); + top = x_188; + stack[x_188] = (p + 1); + const int x_193 = (top + 1); + top = x_193; + stack[x_193] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_71 = i_2; + const int x_74 = obj.numbers[i_2]; + const int x_77 = obj.numbers[i_2]; + obj.numbers[x_71] = (x_74 * x_77); + } + } + quicksort_(); + const int x_84 = obj.numbers[0]; + const int x_86 = obj.numbers[4]; + if ((x_84 < x_86)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 1.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..3bf51a59ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.msl @@ -0,0 +1,198 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_4) { + int temp = 0; + int const x_92 = *(i); + int const x_94 = (*(tint_symbol_4)).numbers.arr[x_92]; + temp = x_94; + int const x_95 = *(i); + int const x_96 = *(j); + int const x_98 = (*(tint_symbol_4)).numbers.arr[x_96]; + (*(tint_symbol_4)).numbers.arr[x_95] = x_98; + int const x_100 = *(j); + int const x_101 = temp; + (*(tint_symbol_4)).numbers.arr[x_100] = x_101; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_5) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_104 = *(h); + int const x_106 = (*(tint_symbol_5)).numbers.arr[x_104]; + pivot = x_106; + int const x_107 = *(l); + i_1 = (x_107 - 1); + int const x_109 = *(l); + j_1 = x_109; + while (true) { + int const x_114 = j_1; + int const x_115 = *(h); + if ((x_114 <= (x_115 - 1))) { + } else { + break; + } + int const x_119 = j_1; + int const x_121 = (*(tint_symbol_5)).numbers.arr[x_119]; + int const x_122 = pivot; + if ((x_121 <= x_122)) { + int const x_126 = i_1; + i_1 = (x_126 + 1); + int const x_128 = i_1; + param = x_128; + int const x_129 = j_1; + param_1 = x_129; + swap_i1_i1_(&(param), &(param_1), tint_symbol_5); + } + { + int const x_131 = j_1; + j_1 = (x_131 + 1); + } + } + int const x_133 = i_1; + param_2 = (x_133 + 1); + int const x_135 = *(h); + param_3 = x_135; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_5); + int const x_137 = i_1; + return (x_137 + 1); +} + +void quicksort_(thread QuicksortObject* const tint_symbol_6) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_140 = top; + int const x_141 = (x_140 + 1); + top = x_141; + int const x_142 = l_1; + stack.arr[x_141] = x_142; + int const x_144 = top; + int const x_145 = (x_144 + 1); + top = x_145; + int const x_146 = h_1; + stack.arr[x_145] = x_146; + while (true) { + int const x_152 = top; + if ((x_152 >= 0)) { + } else { + break; + } + int const x_155 = top; + top = (x_155 - 1); + int const x_158 = stack.arr[x_155]; + h_1 = x_158; + int const x_159 = top; + top = (x_159 - 1); + int const x_162 = stack.arr[x_159]; + l_1 = x_162; + int const x_163 = l_1; + param_4 = x_163; + int const x_164 = h_1; + param_5 = x_164; + int const x_165 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_6); + p = x_165; + int const x_166 = p; + int const x_168 = l_1; + if (((x_166 - 1) > x_168)) { + int const x_172 = top; + int const x_173 = (x_172 + 1); + top = x_173; + int const x_174 = l_1; + stack.arr[x_173] = x_174; + int const x_176 = top; + int const x_177 = (x_176 + 1); + top = x_177; + int const x_178 = p; + stack.arr[x_177] = (x_178 - 1); + } + int const x_181 = p; + int const x_183 = h_1; + if (((x_181 + 1) < x_183)) { + int const x_187 = top; + int const x_188 = (x_187 + 1); + top = x_188; + int const x_189 = p; + stack.arr[x_188] = (x_189 + 1); + int const x_192 = top; + int const x_193 = (x_192 + 1); + top = x_193; + int const x_194 = h_1; + stack.arr[x_193] = x_194; + } + } + return; +} + +void main_1(thread QuicksortObject* const tint_symbol_7, thread float4* const tint_symbol_8) { + int i_2 = 0; + i_2 = 0; + while (true) { + int const x_64 = i_2; + if ((x_64 < 10)) { + } else { + break; + } + int const x_67 = i_2; + int const x_68 = i_2; + (*(tint_symbol_7)).numbers.arr[x_67] = (10 - x_68); + int const x_71 = i_2; + int const x_72 = i_2; + int const x_74 = (*(tint_symbol_7)).numbers.arr[x_72]; + int const x_75 = i_2; + int const x_77 = (*(tint_symbol_7)).numbers.arr[x_75]; + (*(tint_symbol_7)).numbers.arr[x_71] = (x_74 * x_77); + { + int const x_80 = i_2; + i_2 = (x_80 + 1); + } + } + quicksort_(tint_symbol_7); + int const x_84 = (*(tint_symbol_7)).numbers.arr[0]; + int const x_86 = (*(tint_symbol_7)).numbers.arr[4]; + if ((x_84 < x_86)) { + *(tint_symbol_8) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_8) = float4(0.0f, 1.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread QuicksortObject tint_symbol_9 = {}; + thread float4 tint_symbol_10 = 0.0f; + main_1(&(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..7a0c9e691b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.spvasm @@ -0,0 +1,367 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 235 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_30 "x_30" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_30 NonWritable + OpDecorate %x_30 DescriptorSet 0 + OpDecorate %x_30 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %8 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_30 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %46 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %106 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %114 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 + %int_10 = OpConstant %int 10 + %int_4 = OpConstant %int 4 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %221 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %222 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %223 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %20 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %26 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %28 + %30 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Private_int %obj %uint_0 %30 + %34 = OpLoad %int %33 + OpStore %temp %34 + %36 = OpLoad %int %i + %38 = OpLoad %int %j + %39 = OpAccessChain %_ptr_Private_int %obj %uint_0 %38 + %40 = OpLoad %int %39 + %41 = OpAccessChain %_ptr_Private_int %obj %uint_0 %36 + OpStore %41 %40 + %43 = OpLoad %int %j + %44 = OpLoad %int %temp + %45 = OpAccessChain %_ptr_Private_int %obj %uint_0 %43 + OpStore %45 %44 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %46 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %50 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %28 + %i_1 = OpVariable %_ptr_Function_int Function %28 + %j_1 = OpVariable %_ptr_Function_int Function %28 + %param = OpVariable %_ptr_Function_int Function %28 + %param_1 = OpVariable %_ptr_Function_int Function %28 + %param_2 = OpVariable %_ptr_Function_int Function %28 + %param_3 = OpVariable %_ptr_Function_int Function %28 + %59 = OpLoad %int %h + %60 = OpAccessChain %_ptr_Private_int %obj %uint_0 %59 + %61 = OpLoad %int %60 + OpStore %pivot %61 + %63 = OpLoad %int %l + %65 = OpISub %int %63 %int_1 + OpStore %i_1 %65 + %67 = OpLoad %int %l + OpStore %j_1 %67 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %72 = OpLoad %int %j_1 + %74 = OpLoad %int %h + %75 = OpISub %int %74 %int_1 + %76 = OpSLessThanEqual %bool %72 %75 + OpSelectionMerge %78 None + OpBranchConditional %76 %79 %80 + %79 = OpLabel + OpBranch %78 + %80 = OpLabel + OpBranch %69 + %78 = OpLabel + %81 = OpLoad %int %j_1 + %82 = OpAccessChain %_ptr_Private_int %obj %uint_0 %81 + %83 = OpLoad %int %82 + %84 = OpLoad %int %pivot + %85 = OpSLessThanEqual %bool %83 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpLoad %int %i_1 + %89 = OpIAdd %int %88 %int_1 + OpStore %i_1 %89 + %90 = OpLoad %int %i_1 + OpStore %param %90 + %91 = OpLoad %int %j_1 + OpStore %param_1 %91 + %92 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %86 + %86 = OpLabel + OpBranch %70 + %70 = OpLabel + %95 = OpLoad %int %j_1 + %96 = OpIAdd %int %95 %int_1 + OpStore %j_1 %96 + OpBranch %68 + %69 = OpLabel + %97 = OpLoad %int %i_1 + %98 = OpIAdd %int %97 %int_1 + OpStore %param_2 %98 + %100 = OpLoad %int %h + OpStore %param_3 %100 + %101 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %104 = OpLoad %int %i_1 + %105 = OpIAdd %int %104 %int_1 + OpReturnValue %105 + OpFunctionEnd + %quicksort_ = OpFunction %void None %106 + %108 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %28 + %h_1 = OpVariable %_ptr_Function_int Function %28 + %top = OpVariable %_ptr_Function_int Function %28 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %114 + %p = OpVariable %_ptr_Function_int Function %28 + %param_4 = OpVariable %_ptr_Function_int Function %28 + %param_5 = OpVariable %_ptr_Function_int Function %28 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %121 = OpLoad %int %top + %122 = OpIAdd %int %121 %int_1 + OpStore %top %122 + %123 = OpLoad %int %l_1 + %124 = OpAccessChain %_ptr_Function_int %stack %122 + OpStore %124 %123 + %125 = OpLoad %int %top + %126 = OpIAdd %int %125 %int_1 + OpStore %top %126 + %127 = OpLoad %int %h_1 + %128 = OpAccessChain %_ptr_Function_int %stack %126 + OpStore %128 %127 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %133 = OpLoad %int %top + %134 = OpSGreaterThanEqual %bool %133 %int_0 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 + %136 = OpLabel + OpBranch %135 + %137 = OpLabel + OpBranch %130 + %135 = OpLabel + %138 = OpLoad %int %top + %139 = OpISub %int %138 %int_1 + OpStore %top %139 + %140 = OpAccessChain %_ptr_Function_int %stack %138 + %141 = OpLoad %int %140 + OpStore %h_1 %141 + %142 = OpLoad %int %top + %143 = OpISub %int %142 %int_1 + OpStore %top %143 + %144 = OpAccessChain %_ptr_Function_int %stack %142 + %145 = OpLoad %int %144 + OpStore %l_1 %145 + %146 = OpLoad %int %l_1 + OpStore %param_4 %146 + %147 = OpLoad %int %h_1 + OpStore %param_5 %147 + %148 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %148 + %151 = OpLoad %int %p + %152 = OpLoad %int %l_1 + %153 = OpISub %int %151 %int_1 + %154 = OpSGreaterThan %bool %153 %152 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %155 + %156 = OpLabel + %157 = OpLoad %int %top + %158 = OpIAdd %int %157 %int_1 + OpStore %top %158 + %159 = OpLoad %int %l_1 + %160 = OpAccessChain %_ptr_Function_int %stack %158 + OpStore %160 %159 + %161 = OpLoad %int %top + %162 = OpIAdd %int %161 %int_1 + OpStore %top %162 + %163 = OpLoad %int %p + %164 = OpAccessChain %_ptr_Function_int %stack %162 + %165 = OpISub %int %163 %int_1 + OpStore %164 %165 + OpBranch %155 + %155 = OpLabel + %166 = OpLoad %int %p + %167 = OpLoad %int %h_1 + %168 = OpIAdd %int %166 %int_1 + %169 = OpSLessThan %bool %168 %167 + OpSelectionMerge %170 None + OpBranchConditional %169 %171 %170 + %171 = OpLabel + %172 = OpLoad %int %top + %173 = OpIAdd %int %172 %int_1 + OpStore %top %173 + %174 = OpLoad %int %p + %175 = OpAccessChain %_ptr_Function_int %stack %173 + %176 = OpIAdd %int %174 %int_1 + OpStore %175 %176 + %177 = OpLoad %int %top + %178 = OpIAdd %int %177 %int_1 + OpStore %top %178 + %179 = OpLoad %int %h_1 + %180 = OpAccessChain %_ptr_Function_int %stack %178 + OpStore %180 %179 + OpBranch %170 + %170 = OpLabel + OpBranch %131 + %131 = OpLabel + OpBranch %129 + %130 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %106 + %182 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %28 + OpStore %i_2 %int_0 + OpBranch %184 + %184 = OpLabel + OpLoopMerge %185 %186 None + OpBranch %187 + %187 = OpLabel + %188 = OpLoad %int %i_2 + %190 = OpSLessThan %bool %188 %int_10 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %193 + %192 = OpLabel + OpBranch %191 + %193 = OpLabel + OpBranch %185 + %191 = OpLabel + %194 = OpLoad %int %i_2 + %195 = OpLoad %int %i_2 + %196 = OpAccessChain %_ptr_Private_int %obj %uint_0 %194 + %197 = OpISub %int %int_10 %195 + OpStore %196 %197 + %198 = OpLoad %int %i_2 + %199 = OpLoad %int %i_2 + %200 = OpAccessChain %_ptr_Private_int %obj %uint_0 %199 + %201 = OpLoad %int %200 + %202 = OpLoad %int %i_2 + %203 = OpAccessChain %_ptr_Private_int %obj %uint_0 %202 + %204 = OpLoad %int %203 + %205 = OpAccessChain %_ptr_Private_int %obj %uint_0 %198 + %206 = OpIMul %int %201 %204 + OpStore %205 %206 + OpBranch %186 + %186 = OpLabel + %207 = OpLoad %int %i_2 + %208 = OpIAdd %int %207 %int_1 + OpStore %i_2 %208 + OpBranch %184 + %185 = OpLabel + %209 = OpFunctionCall %void %quicksort_ + %210 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %211 = OpLoad %int %210 + %213 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %214 = OpLoad %int %213 + %215 = OpSLessThan %bool %211 %214 + OpSelectionMerge %216 None + OpBranchConditional %215 %217 %218 + %217 = OpLabel + OpStore %x_GLF_color %221 + OpBranch %216 + %218 = OpLabel + OpStore %x_GLF_color %222 + OpBranch %216 + %216 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %223 +%tint_symbol = OpFunctionParameter %main_out + %227 = OpLabel + %228 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %228 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %106 + %230 = OpLabel + %231 = OpFunctionCall %void %main_1 + %233 = OpLoad %v4float %x_GLF_color + %234 = OpCompositeConstruct %main_out %233 + %232 = OpFunctionCall %void %tint_symbol_2 %234 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..03cd2baa71 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.wgsl @@ -0,0 +1,197 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_30 : buf0; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_92 : i32 = *(i); + let x_94 : i32 = obj.numbers[x_92]; + temp = x_94; + let x_95 : i32 = *(i); + let x_96 : i32 = *(j); + let x_98 : i32 = obj.numbers[x_96]; + obj.numbers[x_95] = x_98; + let x_100 : i32 = *(j); + let x_101 : i32 = temp; + obj.numbers[x_100] = x_101; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_104 : i32 = *(h); + let x_106 : i32 = obj.numbers[x_104]; + pivot = x_106; + let x_107 : i32 = *(l); + i_1 = (x_107 - 1); + let x_109 : i32 = *(l); + j_1 = x_109; + loop { + let x_114 : i32 = j_1; + let x_115 : i32 = *(h); + if ((x_114 <= (x_115 - 1))) { + } else { + break; + } + let x_119 : i32 = j_1; + let x_121 : i32 = obj.numbers[x_119]; + let x_122 : i32 = pivot; + if ((x_121 <= x_122)) { + let x_126 : i32 = i_1; + i_1 = (x_126 + 1); + let x_128 : i32 = i_1; + param = x_128; + let x_129 : i32 = j_1; + param_1 = x_129; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_131 : i32 = j_1; + j_1 = (x_131 + 1); + } + } + let x_133 : i32 = i_1; + param_2 = (x_133 + 1); + let x_135 : i32 = *(h); + param_3 = x_135; + swap_i1_i1_(&(param_2), &(param_3)); + let x_137 : i32 = i_1; + return (x_137 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_140 : i32 = top; + let x_141 : i32 = (x_140 + 1); + top = x_141; + let x_142 : i32 = l_1; + stack[x_141] = x_142; + let x_144 : i32 = top; + let x_145 : i32 = (x_144 + 1); + top = x_145; + let x_146 : i32 = h_1; + stack[x_145] = x_146; + loop { + let x_152 : i32 = top; + if ((x_152 >= 0)) { + } else { + break; + } + let x_155 : i32 = top; + top = (x_155 - 1); + let x_158 : i32 = stack[x_155]; + h_1 = x_158; + let x_159 : i32 = top; + top = (x_159 - 1); + let x_162 : i32 = stack[x_159]; + l_1 = x_162; + let x_163 : i32 = l_1; + param_4 = x_163; + let x_164 : i32 = h_1; + param_5 = x_164; + let x_165 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_165; + let x_166 : i32 = p; + let x_168 : i32 = l_1; + if (((x_166 - 1) > x_168)) { + let x_172 : i32 = top; + let x_173 : i32 = (x_172 + 1); + top = x_173; + let x_174 : i32 = l_1; + stack[x_173] = x_174; + let x_176 : i32 = top; + let x_177 : i32 = (x_176 + 1); + top = x_177; + let x_178 : i32 = p; + stack[x_177] = (x_178 - 1); + } + let x_181 : i32 = p; + let x_183 : i32 = h_1; + if (((x_181 + 1) < x_183)) { + let x_187 : i32 = top; + let x_188 : i32 = (x_187 + 1); + top = x_188; + let x_189 : i32 = p; + stack[x_188] = (x_189 + 1); + let x_192 : i32 = top; + let x_193 : i32 = (x_192 + 1); + top = x_193; + let x_194 : i32 = h_1; + stack[x_193] = x_194; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + i_2 = 0; + loop { + let x_64 : i32 = i_2; + if ((x_64 < 10)) { + } else { + break; + } + let x_67 : i32 = i_2; + let x_68 : i32 = i_2; + obj.numbers[x_67] = (10 - x_68); + let x_71 : i32 = i_2; + let x_72 : i32 = i_2; + let x_74 : i32 = obj.numbers[x_72]; + let x_75 : i32 = i_2; + let x_77 : i32 = obj.numbers[x_75]; + obj.numbers[x_71] = (x_74 * x_77); + + continuing { + let x_80 : i32 = i_2; + i_2 = (x_80 + 1); + } + } + quicksort_(); + let x_84 : i32 = obj.numbers[0]; + let x_86 : i32 = obj.numbers[4]; + if ((x_84 < x_86)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 1.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm new file mode 100644 index 0000000000..13024f7f9b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm @@ -0,0 +1,188 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %x "x" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %15 = OpTypeFunction %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_5 = OpConstant %float 5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %float_0 = OpConstant %float 0 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %uint_17 = OpConstant %uint 17 +%_arr_v2float_uint_17 = OpTypeArray %v2float %uint_17 +%_ptr_Function__arr_v2float_uint_17 = OpTypePointer Function %_arr_v2float_uint_17 +%_ptr_Function_float = OpTypePointer Function %float + %int_15 = OpConstant %int 15 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %40 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %41 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %13 + %43 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %data = OpVariable %_ptr_Function__arr_v2float_uint_17 Function + OpStore %i %int_0 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %50 = OpLoad %float %49 + %51 = OpConvertFToS %int %50 + %52 = OpIAdd %int %int_4 %51 + %53 = OpSLessThan %bool %48 %52 + OpBranchConditional %53 %54 %45 + %54 = OpLabel + %55 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %56 = OpLoad %float %55 + %57 = OpFOrdGreaterThanEqual %bool %56 %float_0 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + OpStore %j %int_0 + OpBranch %60 + %60 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + %64 = OpLoad %int %j + %65 = OpSLessThan %bool %64 %int_4 + OpBranchConditional %65 %66 %61 + %66 = OpLabel + %67 = OpLoad %int %j + %68 = OpIMul %int %int_4 %67 + %69 = OpLoad %int %i + %70 = OpIAdd %int %68 %69 + %71 = OpFunctionCall %float %func_ + %72 = OpAccessChain %_ptr_Function_float %data %70 %uint_0 + OpStore %72 %71 + %73 = OpAccessChain %_ptr_Function_float %data %int_0 %uint_0 + %74 = OpLoad %float %73 + %75 = OpFOrdEqual %bool %74 %float_5 + %76 = OpLogicalNot %bool %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + %79 = OpAccessChain %_ptr_Function_float %data %int_15 %uint_0 + %80 = OpLoad %float %79 + %81 = OpFOrdEqual %bool %80 %float_5 + OpBranch %77 + %77 = OpLabel + %82 = OpPhi %bool %75 %66 %81 %78 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + OpStore %_GLF_color %40 + OpBranch %83 + %85 = OpLabel + OpStore %_GLF_color %41 + OpBranch %83 + %83 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %89 = OpLoad %float %88 + %90 = OpFOrdGreaterThan %bool %87 %89 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + OpReturn + %91 = OpLabel + OpBranch %62 + %62 = OpLabel + %93 = OpLoad %int %j + %94 = OpIAdd %int %93 %int_1 + OpStore %j %94 + OpBranch %60 + %61 = OpLabel + OpBranch %58 + %58 = OpLabel + OpBranch %46 + %46 = OpLabel + %95 = OpLoad %int %i + %96 = OpIAdd %int %95 %int_1 + OpStore %i %96 + OpBranch %44 + %45 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %float None %15 + %97 = OpLabel + %x = OpVariable %_ptr_Function_int Function + %98 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %99 = OpLoad %float %98 + %100 = OpFOrdLessThan %bool %99 %float_1 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpReturnValue %float_5 + %101 = OpLabel + %103 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %104 = OpLoad %float %103 + %105 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %106 = OpLoad %float %105 + %107 = OpFOrdGreaterThan %bool %104 %106 + OpSelectionMerge %108 None + OpBranchConditional %107 %109 %108 + %109 = OpLabel + OpReturnValue %float_1 + %108 = OpLabel + %110 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %111 = OpLoad %float %110 + %112 = OpConvertFToS %int %111 + OpStore %x %112 + %113 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %114 = OpLoad %float %113 + %115 = OpExtInst %float %1 FClamp %114 %float_0 %float_1 + %116 = OpConvertFToS %int %115 + %117 = OpIMul %int %116 %int_3 + %118 = OpLoad %int %x + %119 = OpIAdd %int %118 %117 + OpStore %x %119 + %120 = OpLoad %int %x + %121 = OpConvertSToF %float %120 + %122 = OpFAdd %float %float_5 %121 + OpReturnValue %122 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..b29e01e2b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.hlsl @@ -0,0 +1,98 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_() { + int x = 0; + const float x_99 = gl_FragCoord.x; + if ((x_99 < 1.0f)) { + return 5.0f; + } + const float x_104 = asfloat(x_7[0].x); + const float x_106 = asfloat(x_7[0].y); + if ((x_104 > x_106)) { + return 1.0f; + } + const float x_111 = asfloat(x_7[0].x); + x = int(x_111); + const float x_114 = asfloat(x_7[0].x); + x = (x + (int(clamp(x_114, 0.0f, 1.0f)) * 3)); + return (5.0f + float(x)); +} + +void main_1() { + int i = 0; + int j = 0; + float2 data[17] = (float2[17])0; + i = 0; + while (true) { + const int x_48 = i; + const float x_50 = asfloat(x_7[0].x); + if ((x_48 < (4 + int(x_50)))) { + } else { + break; + } + const float x_56 = gl_FragCoord.x; + if ((x_56 >= 0.0f)) { + j = 0; + while (true) { + bool x_81 = false; + bool x_82_phi = false; + if ((j < 4)) { + } else { + break; + } + const int x_67 = j; + const int x_69 = i; + const float x_71 = func_(); + data[((4 * x_67) + x_69)].x = x_71; + const float x_74 = data[0].x; + const bool x_75 = (x_74 == 5.0f); + x_82_phi = x_75; + if (!(x_75)) { + const float x_80 = data[15].x; + x_81 = (x_80 == 5.0f); + x_82_phi = x_81; + } + if (x_82_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + const float x_87 = asfloat(x_7[0].x); + const float x_89 = asfloat(x_7[0].y); + if ((x_87 > x_89)) { + return; + } + { + j = (j + 1); + } + } + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4eedfbc1a5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.msl @@ -0,0 +1,106 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float2 arr[17]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_(constant buf0& x_7, thread float4* const tint_symbol_5) { + int x = 0; + float const x_99 = (*(tint_symbol_5)).x; + if ((x_99 < 1.0f)) { + return 5.0f; + } + float const x_104 = x_7.injectionSwitch.x; + float const x_106 = x_7.injectionSwitch.y; + if ((x_104 > x_106)) { + return 1.0f; + } + float const x_111 = x_7.injectionSwitch.x; + x = int(x_111); + float const x_114 = x_7.injectionSwitch.x; + int const x_118 = x; + x = (x_118 + (int(clamp(x_114, 0.0f, 1.0f)) * 3)); + int const x_120 = x; + return (5.0f + float(x_120)); +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int i = 0; + int j = 0; + tint_array_wrapper data = {}; + i = 0; + while (true) { + int const x_48 = i; + float const x_50 = x_7.injectionSwitch.x; + if ((x_48 < (4 + int(x_50)))) { + } else { + break; + } + float const x_56 = (*(tint_symbol_6)).x; + if ((x_56 >= 0.0f)) { + j = 0; + while (true) { + bool x_81 = false; + bool x_82_phi = false; + int const x_64 = j; + if ((x_64 < 4)) { + } else { + break; + } + int const x_67 = j; + int const x_69 = i; + float const x_71 = func_(x_7, tint_symbol_6); + data.arr[((4 * x_67) + x_69)].x = x_71; + float const x_74 = data.arr[0].x; + bool const x_75 = (x_74 == 5.0f); + x_82_phi = x_75; + if (!(x_75)) { + float const x_80 = data.arr[15].x; + x_81 = (x_80 == 5.0f); + x_82_phi = x_81; + } + bool const x_82 = x_82_phi; + if (x_82) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + float const x_87 = x_7.injectionSwitch.x; + float const x_89 = x_7.injectionSwitch.y; + if ((x_87 > x_89)) { + return; + } + { + int const x_93 = j; + j = (x_93 + 1); + } + } + } + { + int const x_95 = i; + i = (x_95 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..068c2557e9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.spvasm @@ -0,0 +1,247 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 151 +; Schema: 0 + OpCapability Shader + %50 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_ "func_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %x_81 "x_81" + OpName %x_82_phi "x_82_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v2float_uint_17 ArrayStride 8 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %15 = OpTypeFunction %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_5 = OpConstant %float 5 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %int_3 = OpConstant %int 3 + %void = OpTypeVoid + %58 = OpTypeFunction %void + %uint_17 = OpConstant %uint 17 +%_arr_v2float_uint_17 = OpTypeArray %v2float %uint_17 +%_ptr_Function__arr_v2float_uint_17 = OpTypePointer Function %_arr_v2float_uint_17 + %68 = OpConstantNull %_arr_v2float_uint_17 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 +%_ptr_Function_bool = OpTypePointer Function %bool + %95 = OpConstantNull %bool +%_ptr_Function_float = OpTypePointer Function %float + %int_15 = OpConstant %int 15 + %124 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %125 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %138 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %15 + %17 = OpLabel + %x = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %26 = OpLoad %float %25 + %28 = OpFOrdLessThan %bool %26 %float_1 + OpSelectionMerge %30 None + OpBranchConditional %28 %31 %30 + %31 = OpLabel + OpReturnValue %float_5 + %30 = OpLabel + %34 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %35 = OpLoad %float %34 + %37 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %38 = OpLoad %float %37 + %39 = OpFOrdGreaterThan %bool %35 %38 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + OpReturnValue %float_1 + %40 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %43 = OpLoad %float %42 + %44 = OpConvertFToS %int %43 + OpStore %x %44 + %45 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %46 = OpLoad %float %45 + %47 = OpLoad %int %x + %49 = OpExtInst %float %50 NClamp %46 %float_0 %float_1 + %48 = OpConvertFToS %int %49 + %53 = OpIMul %int %48 %int_3 + %54 = OpIAdd %int %47 %53 + OpStore %x %54 + %55 = OpLoad %int %x + %56 = OpConvertSToF %float %55 + %57 = OpFAdd %float %float_5 %56 + OpReturnValue %57 + OpFunctionEnd + %main_1 = OpFunction %void None %58 + %61 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %j = OpVariable %_ptr_Function_int Function %21 + %data = OpVariable %_ptr_Function__arr_v2float_uint_17 Function %68 + %x_81 = OpVariable %_ptr_Function_bool Function %95 + %x_82_phi = OpVariable %_ptr_Function_bool Function %95 + OpStore %i %int_0 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %76 = OpLoad %float %75 + %78 = OpConvertFToS %int %76 + %79 = OpIAdd %int %int_4 %78 + %80 = OpSLessThan %bool %74 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %71 + %81 = OpLabel + %84 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %85 = OpLoad %float %84 + %86 = OpFOrdGreaterThanEqual %bool %85 %float_0 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %87 + %88 = OpLabel + OpStore %j %int_0 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %90 %91 None + OpBranch %92 + %92 = OpLabel + %97 = OpLoad %int %j + %98 = OpSLessThan %bool %97 %int_4 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %101 + %100 = OpLabel + OpBranch %99 + %101 = OpLabel + OpBranch %90 + %99 = OpLabel + %102 = OpLoad %int %j + %103 = OpLoad %int %i + %104 = OpFunctionCall %float %func_ + %105 = OpIMul %int %int_4 %102 + %106 = OpIAdd %int %105 %103 + %108 = OpAccessChain %_ptr_Function_float %data %106 %uint_0 + OpStore %108 %104 + %109 = OpAccessChain %_ptr_Function_float %data %int_0 %uint_0 + %110 = OpLoad %float %109 + %111 = OpFOrdEqual %bool %110 %float_5 + OpStore %x_82_phi %111 + %112 = OpLogicalNot %bool %111 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + %116 = OpAccessChain %_ptr_Function_float %data %int_15 %uint_0 + %117 = OpLoad %float %116 + %118 = OpFOrdEqual %bool %117 %float_5 + OpStore %x_81 %118 + %119 = OpLoad %bool %x_81 + OpStore %x_82_phi %119 + OpBranch %113 + %113 = OpLabel + %120 = OpLoad %bool %x_82_phi + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + OpStore %x_GLF_color %124 + OpBranch %121 + %123 = OpLabel + OpStore %x_GLF_color %125 + OpBranch %121 + %121 = OpLabel + %126 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %127 = OpLoad %float %126 + %128 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %129 = OpLoad %float %128 + %130 = OpFOrdGreaterThan %bool %127 %129 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %131 + %132 = OpLabel + OpReturn + %131 = OpLabel + OpBranch %91 + %91 = OpLabel + %133 = OpLoad %int %j + %135 = OpIAdd %int %133 %int_1 + OpStore %j %135 + OpBranch %89 + %90 = OpLabel + OpBranch %87 + %87 = OpLabel + OpBranch %72 + %72 = OpLabel + %136 = OpLoad %int %i + %137 = OpIAdd %int %136 %int_1 + OpStore %i %137 + OpBranch %70 + %71 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %138 +%tint_symbol_1 = OpFunctionParameter %main_out + %142 = OpLabel + %143 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %143 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %58 + %145 = OpLabel + %146 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %146 + %147 = OpFunctionCall %void %main_1 + %149 = OpLoad %v4float %x_GLF_color + %150 = OpCompositeConstruct %main_out %149 + %148 = OpFunctionCall %void %tint_symbol_3 %150 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..430c6dbbdc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.spvasm.expected.wgsl @@ -0,0 +1,104 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var x : i32; + let x_99 : f32 = gl_FragCoord.x; + if ((x_99 < 1.0)) { + return 5.0; + } + let x_104 : f32 = x_7.injectionSwitch.x; + let x_106 : f32 = x_7.injectionSwitch.y; + if ((x_104 > x_106)) { + return 1.0; + } + let x_111 : f32 = x_7.injectionSwitch.x; + x = i32(x_111); + let x_114 : f32 = x_7.injectionSwitch.x; + let x_118 : i32 = x; + x = (x_118 + (i32(clamp(x_114, 0.0, 1.0)) * 3)); + let x_120 : i32 = x; + return (5.0 + f32(x_120)); +} + +fn main_1() { + var i : i32; + var j : i32; + var data : array, 17>; + i = 0; + loop { + let x_48 : i32 = i; + let x_50 : f32 = x_7.injectionSwitch.x; + if ((x_48 < (4 + i32(x_50)))) { + } else { + break; + } + let x_56 : f32 = gl_FragCoord.x; + if ((x_56 >= 0.0)) { + j = 0; + loop { + var x_81 : bool; + var x_82_phi : bool; + let x_64 : i32 = j; + if ((x_64 < 4)) { + } else { + break; + } + let x_67 : i32 = j; + let x_69 : i32 = i; + let x_71 : f32 = func_(); + data[((4 * x_67) + x_69)].x = x_71; + let x_74 : f32 = data[0].x; + let x_75 : bool = (x_74 == 5.0); + x_82_phi = x_75; + if (!(x_75)) { + let x_80 : f32 = data[15].x; + x_81 = (x_80 == 5.0); + x_82_phi = x_81; + } + let x_82 : bool = x_82_phi; + if (x_82) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + let x_87 : f32 = x_7.injectionSwitch.x; + let x_89 : f32 = x_7.injectionSwitch.y; + if ((x_87 > x_89)) { + return; + } + + continuing { + let x_93 : i32 = j; + j = (x_93 + 1); + } + } + } + + continuing { + let x_95 : i32 = i; + i = (x_95 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl new file mode 100644 index 0000000000..430c6dbbdc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl @@ -0,0 +1,104 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var x : i32; + let x_99 : f32 = gl_FragCoord.x; + if ((x_99 < 1.0)) { + return 5.0; + } + let x_104 : f32 = x_7.injectionSwitch.x; + let x_106 : f32 = x_7.injectionSwitch.y; + if ((x_104 > x_106)) { + return 1.0; + } + let x_111 : f32 = x_7.injectionSwitch.x; + x = i32(x_111); + let x_114 : f32 = x_7.injectionSwitch.x; + let x_118 : i32 = x; + x = (x_118 + (i32(clamp(x_114, 0.0, 1.0)) * 3)); + let x_120 : i32 = x; + return (5.0 + f32(x_120)); +} + +fn main_1() { + var i : i32; + var j : i32; + var data : array, 17>; + i = 0; + loop { + let x_48 : i32 = i; + let x_50 : f32 = x_7.injectionSwitch.x; + if ((x_48 < (4 + i32(x_50)))) { + } else { + break; + } + let x_56 : f32 = gl_FragCoord.x; + if ((x_56 >= 0.0)) { + j = 0; + loop { + var x_81 : bool; + var x_82_phi : bool; + let x_64 : i32 = j; + if ((x_64 < 4)) { + } else { + break; + } + let x_67 : i32 = j; + let x_69 : i32 = i; + let x_71 : f32 = func_(); + data[((4 * x_67) + x_69)].x = x_71; + let x_74 : f32 = data[0].x; + let x_75 : bool = (x_74 == 5.0); + x_82_phi = x_75; + if (!(x_75)) { + let x_80 : f32 = data[15].x; + x_81 = (x_80 == 5.0); + x_82_phi = x_81; + } + let x_82 : bool = x_82_phi; + if (x_82) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + let x_87 : f32 = x_7.injectionSwitch.x; + let x_89 : f32 = x_7.injectionSwitch.y; + if ((x_87 > x_89)) { + return; + } + + continuing { + let x_93 : i32 = j; + j = (x_93 + 1); + } + } + } + + continuing { + let x_95 : i32 = i; + i = (x_95 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..b29e01e2b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.hlsl @@ -0,0 +1,98 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_() { + int x = 0; + const float x_99 = gl_FragCoord.x; + if ((x_99 < 1.0f)) { + return 5.0f; + } + const float x_104 = asfloat(x_7[0].x); + const float x_106 = asfloat(x_7[0].y); + if ((x_104 > x_106)) { + return 1.0f; + } + const float x_111 = asfloat(x_7[0].x); + x = int(x_111); + const float x_114 = asfloat(x_7[0].x); + x = (x + (int(clamp(x_114, 0.0f, 1.0f)) * 3)); + return (5.0f + float(x)); +} + +void main_1() { + int i = 0; + int j = 0; + float2 data[17] = (float2[17])0; + i = 0; + while (true) { + const int x_48 = i; + const float x_50 = asfloat(x_7[0].x); + if ((x_48 < (4 + int(x_50)))) { + } else { + break; + } + const float x_56 = gl_FragCoord.x; + if ((x_56 >= 0.0f)) { + j = 0; + while (true) { + bool x_81 = false; + bool x_82_phi = false; + if ((j < 4)) { + } else { + break; + } + const int x_67 = j; + const int x_69 = i; + const float x_71 = func_(); + data[((4 * x_67) + x_69)].x = x_71; + const float x_74 = data[0].x; + const bool x_75 = (x_74 == 5.0f); + x_82_phi = x_75; + if (!(x_75)) { + const float x_80 = data[15].x; + x_81 = (x_80 == 5.0f); + x_82_phi = x_81; + } + if (x_82_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + const float x_87 = asfloat(x_7[0].x); + const float x_89 = asfloat(x_7[0].y); + if ((x_87 > x_89)) { + return; + } + { + j = (j + 1); + } + } + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4eedfbc1a5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.msl @@ -0,0 +1,106 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float2 arr[17]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_(constant buf0& x_7, thread float4* const tint_symbol_5) { + int x = 0; + float const x_99 = (*(tint_symbol_5)).x; + if ((x_99 < 1.0f)) { + return 5.0f; + } + float const x_104 = x_7.injectionSwitch.x; + float const x_106 = x_7.injectionSwitch.y; + if ((x_104 > x_106)) { + return 1.0f; + } + float const x_111 = x_7.injectionSwitch.x; + x = int(x_111); + float const x_114 = x_7.injectionSwitch.x; + int const x_118 = x; + x = (x_118 + (int(clamp(x_114, 0.0f, 1.0f)) * 3)); + int const x_120 = x; + return (5.0f + float(x_120)); +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int i = 0; + int j = 0; + tint_array_wrapper data = {}; + i = 0; + while (true) { + int const x_48 = i; + float const x_50 = x_7.injectionSwitch.x; + if ((x_48 < (4 + int(x_50)))) { + } else { + break; + } + float const x_56 = (*(tint_symbol_6)).x; + if ((x_56 >= 0.0f)) { + j = 0; + while (true) { + bool x_81 = false; + bool x_82_phi = false; + int const x_64 = j; + if ((x_64 < 4)) { + } else { + break; + } + int const x_67 = j; + int const x_69 = i; + float const x_71 = func_(x_7, tint_symbol_6); + data.arr[((4 * x_67) + x_69)].x = x_71; + float const x_74 = data.arr[0].x; + bool const x_75 = (x_74 == 5.0f); + x_82_phi = x_75; + if (!(x_75)) { + float const x_80 = data.arr[15].x; + x_81 = (x_80 == 5.0f); + x_82_phi = x_81; + } + bool const x_82 = x_82_phi; + if (x_82) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + float const x_87 = x_7.injectionSwitch.x; + float const x_89 = x_7.injectionSwitch.y; + if ((x_87 > x_89)) { + return; + } + { + int const x_93 = j; + j = (x_93 + 1); + } + } + } + { + int const x_95 = i; + i = (x_95 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..068c2557e9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.spvasm @@ -0,0 +1,247 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 151 +; Schema: 0 + OpCapability Shader + %50 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_ "func_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %x_81 "x_81" + OpName %x_82_phi "x_82_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v2float_uint_17 ArrayStride 8 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %15 = OpTypeFunction %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_5 = OpConstant %float 5 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %int_3 = OpConstant %int 3 + %void = OpTypeVoid + %58 = OpTypeFunction %void + %uint_17 = OpConstant %uint 17 +%_arr_v2float_uint_17 = OpTypeArray %v2float %uint_17 +%_ptr_Function__arr_v2float_uint_17 = OpTypePointer Function %_arr_v2float_uint_17 + %68 = OpConstantNull %_arr_v2float_uint_17 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 +%_ptr_Function_bool = OpTypePointer Function %bool + %95 = OpConstantNull %bool +%_ptr_Function_float = OpTypePointer Function %float + %int_15 = OpConstant %int 15 + %124 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %125 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %138 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %15 + %17 = OpLabel + %x = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %26 = OpLoad %float %25 + %28 = OpFOrdLessThan %bool %26 %float_1 + OpSelectionMerge %30 None + OpBranchConditional %28 %31 %30 + %31 = OpLabel + OpReturnValue %float_5 + %30 = OpLabel + %34 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %35 = OpLoad %float %34 + %37 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %38 = OpLoad %float %37 + %39 = OpFOrdGreaterThan %bool %35 %38 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + OpReturnValue %float_1 + %40 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %43 = OpLoad %float %42 + %44 = OpConvertFToS %int %43 + OpStore %x %44 + %45 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %46 = OpLoad %float %45 + %47 = OpLoad %int %x + %49 = OpExtInst %float %50 NClamp %46 %float_0 %float_1 + %48 = OpConvertFToS %int %49 + %53 = OpIMul %int %48 %int_3 + %54 = OpIAdd %int %47 %53 + OpStore %x %54 + %55 = OpLoad %int %x + %56 = OpConvertSToF %float %55 + %57 = OpFAdd %float %float_5 %56 + OpReturnValue %57 + OpFunctionEnd + %main_1 = OpFunction %void None %58 + %61 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %j = OpVariable %_ptr_Function_int Function %21 + %data = OpVariable %_ptr_Function__arr_v2float_uint_17 Function %68 + %x_81 = OpVariable %_ptr_Function_bool Function %95 + %x_82_phi = OpVariable %_ptr_Function_bool Function %95 + OpStore %i %int_0 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %76 = OpLoad %float %75 + %78 = OpConvertFToS %int %76 + %79 = OpIAdd %int %int_4 %78 + %80 = OpSLessThan %bool %74 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %71 + %81 = OpLabel + %84 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %85 = OpLoad %float %84 + %86 = OpFOrdGreaterThanEqual %bool %85 %float_0 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %87 + %88 = OpLabel + OpStore %j %int_0 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %90 %91 None + OpBranch %92 + %92 = OpLabel + %97 = OpLoad %int %j + %98 = OpSLessThan %bool %97 %int_4 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %101 + %100 = OpLabel + OpBranch %99 + %101 = OpLabel + OpBranch %90 + %99 = OpLabel + %102 = OpLoad %int %j + %103 = OpLoad %int %i + %104 = OpFunctionCall %float %func_ + %105 = OpIMul %int %int_4 %102 + %106 = OpIAdd %int %105 %103 + %108 = OpAccessChain %_ptr_Function_float %data %106 %uint_0 + OpStore %108 %104 + %109 = OpAccessChain %_ptr_Function_float %data %int_0 %uint_0 + %110 = OpLoad %float %109 + %111 = OpFOrdEqual %bool %110 %float_5 + OpStore %x_82_phi %111 + %112 = OpLogicalNot %bool %111 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + %116 = OpAccessChain %_ptr_Function_float %data %int_15 %uint_0 + %117 = OpLoad %float %116 + %118 = OpFOrdEqual %bool %117 %float_5 + OpStore %x_81 %118 + %119 = OpLoad %bool %x_81 + OpStore %x_82_phi %119 + OpBranch %113 + %113 = OpLabel + %120 = OpLoad %bool %x_82_phi + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + OpStore %x_GLF_color %124 + OpBranch %121 + %123 = OpLabel + OpStore %x_GLF_color %125 + OpBranch %121 + %121 = OpLabel + %126 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %127 = OpLoad %float %126 + %128 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %129 = OpLoad %float %128 + %130 = OpFOrdGreaterThan %bool %127 %129 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %131 + %132 = OpLabel + OpReturn + %131 = OpLabel + OpBranch %91 + %91 = OpLabel + %133 = OpLoad %int %j + %135 = OpIAdd %int %133 %int_1 + OpStore %j %135 + OpBranch %89 + %90 = OpLabel + OpBranch %87 + %87 = OpLabel + OpBranch %72 + %72 = OpLabel + %136 = OpLoad %int %i + %137 = OpIAdd %int %136 %int_1 + OpStore %i %137 + OpBranch %70 + %71 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %138 +%tint_symbol_1 = OpFunctionParameter %main_out + %142 = OpLabel + %143 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %143 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %58 + %145 = OpLabel + %146 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %146 + %147 = OpFunctionCall %void %main_1 + %149 = OpLoad %v4float %x_GLF_color + %150 = OpCompositeConstruct %main_out %149 + %148 = OpFunctionCall %void %tint_symbol_3 %150 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..430c6dbbdc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/array-idx-multiplied-by-for-loop-idx/0-opt.wgsl.expected.wgsl @@ -0,0 +1,104 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var x : i32; + let x_99 : f32 = gl_FragCoord.x; + if ((x_99 < 1.0)) { + return 5.0; + } + let x_104 : f32 = x_7.injectionSwitch.x; + let x_106 : f32 = x_7.injectionSwitch.y; + if ((x_104 > x_106)) { + return 1.0; + } + let x_111 : f32 = x_7.injectionSwitch.x; + x = i32(x_111); + let x_114 : f32 = x_7.injectionSwitch.x; + let x_118 : i32 = x; + x = (x_118 + (i32(clamp(x_114, 0.0, 1.0)) * 3)); + let x_120 : i32 = x; + return (5.0 + f32(x_120)); +} + +fn main_1() { + var i : i32; + var j : i32; + var data : array, 17>; + i = 0; + loop { + let x_48 : i32 = i; + let x_50 : f32 = x_7.injectionSwitch.x; + if ((x_48 < (4 + i32(x_50)))) { + } else { + break; + } + let x_56 : f32 = gl_FragCoord.x; + if ((x_56 >= 0.0)) { + j = 0; + loop { + var x_81 : bool; + var x_82_phi : bool; + let x_64 : i32 = j; + if ((x_64 < 4)) { + } else { + break; + } + let x_67 : i32 = j; + let x_69 : i32 = i; + let x_71 : f32 = func_(); + data[((4 * x_67) + x_69)].x = x_71; + let x_74 : f32 = data[0].x; + let x_75 : bool = (x_74 == 5.0); + x_82_phi = x_75; + if (!(x_75)) { + let x_80 : f32 = data[15].x; + x_81 = (x_80 == 5.0); + x_82_phi = x_81; + } + let x_82 : bool = x_82_phi; + if (x_82) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + let x_87 : f32 = x_7.injectionSwitch.x; + let x_89 : f32 = x_7.injectionSwitch.y; + if ((x_87 > x_89)) { + return; + } + + continuing { + let x_93 : i32 = j; + j = (x_93 + 1); + } + } + } + + continuing { + let x_95 : i32 = i; + i = (x_95 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm new file mode 100644 index 0000000000..8f8a7d6215 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm @@ -0,0 +1,194 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_i1_ "func(i1;" + OpName %a "a" + OpName %b "b" + OpName %data "data" + OpName %gl_FragCoord "gl_FragCoord" + OpName %temp "temp" + OpName %i "i" + OpName %i_0 "i" + OpName %param "param" + OpName %param_0 "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %19 = OpTypeFunction %float %_ptr_Function_int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_int_uint_9 = OpTypeArray %int %uint_9 +%_ptr_Private__arr_int_uint_9 = OpTypePointer Private %_arr_int_uint_9 + %data = OpVariable %_ptr_Private__arr_int_uint_9 Private + %int_5 = OpConstant %int 5 +%_ptr_Private_int = OpTypePointer Private %int + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %int_6 = OpConstant %int 6 + %int_8 = OpConstant %int 8 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %uint_7 = OpConstant %uint 7 +%_arr_int_uint_7 = OpTypeArray %int %uint_7 +%_ptr_Private__arr_int_uint_7 = OpTypePointer Private %_arr_int_uint_7 + %temp = OpVariable %_ptr_Private__arr_int_uint_7 Private + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %15 + %46 = OpLabel + %i_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + OpStore %i_0 %int_0 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i_0 + %52 = OpSLessThan %bool %51 %int_6 + OpBranchConditional %52 %53 %48 + %53 = OpLabel + %54 = OpLoad %int %i_0 + OpStore %param %54 + %55 = OpFunctionCall %float %func_i1_ %param + %56 = OpLoad %int %i_0 + OpStore %param_0 %56 + %57 = OpFunctionCall %float %func_i1_ %param_0 + %58 = OpFOrdEqual %bool %57 %float_1 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + OpStore %_GLF_color %44 + OpBranch %59 + %61 = OpLabel + OpStore %_GLF_color %45 + OpBranch %59 + %59 = OpLabel + OpBranch %49 + %49 = OpLabel + %62 = OpLoad %int %i_0 + %63 = OpIAdd %int %62 %int_1 + OpStore %i_0 %63 + OpBranch %47 + %48 = OpLabel + OpReturn + OpFunctionEnd + %func_i1_ = OpFunction %float None %19 + %a = OpFunctionParameter %_ptr_Function_int + %64 = OpLabel + %b = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %b %int_0 + %65 = OpAccessChain %_ptr_Private_int %data %int_0 + OpStore %65 %int_5 + %66 = OpAccessChain %_ptr_Private_int %data %int_2 + OpStore %66 %int_0 + %67 = OpAccessChain %_ptr_Private_int %data %int_4 + OpStore %67 %int_0 + %68 = OpAccessChain %_ptr_Private_int %data %int_6 + OpStore %68 %int_0 + %69 = OpAccessChain %_ptr_Private_int %data %int_8 + OpStore %69 %int_0 + %70 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %71 = OpLoad %float %70 + %72 = OpFOrdGreaterThanEqual %bool %71 %float_0 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + OpBranch %75 + %75 = OpLabel + OpLoopMerge %76 %77 None + OpBranch %78 + %78 = OpLabel + %79 = OpLoad %int %b + %80 = OpLoad %int %a + %81 = OpSLessThanEqual %bool %79 %80 + OpBranchConditional %81 %82 %76 + %82 = OpLabel + %83 = OpLoad %int %b + %84 = OpSLessThanEqual %bool %83 %int_5 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + %87 = OpLoad %int %b + %88 = OpLoad %int %b + %89 = OpAccessChain %_ptr_Private_int %data %88 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Private_int %temp %87 + OpStore %91 %90 + %92 = OpLoad %int %b + %93 = OpIAdd %int %92 %int_2 + OpStore %b %93 + OpBranch %85 + %85 = OpLabel + OpBranch %77 + %77 = OpLabel + OpBranch %75 + %76 = OpLabel + OpBranch %73 + %73 = OpLabel + OpStore %i %int_0 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %95 %96 None + OpBranch %97 + %97 = OpLabel + %98 = OpLoad %int %i + %99 = OpSLessThan %bool %98 %int_3 + OpBranchConditional %99 %100 %95 + %100 = OpLabel + %101 = OpLoad %int %i + %102 = OpAccessChain %_ptr_Private_int %temp %int_0 + %103 = OpLoad %int %102 + %104 = OpIAdd %int %103 %int_1 + %105 = OpAccessChain %_ptr_Private_int %data %101 + OpStore %105 %104 + OpBranch %96 + %96 = OpLabel + %106 = OpLoad %int %i + %107 = OpIAdd %int %106 %int_1 + OpStore %i %107 + OpBranch %94 + %95 = OpLabel + %108 = OpAccessChain %_ptr_Private_int %temp %int_0 + %109 = OpLoad %int %108 + %110 = OpIEqual %bool %109 %int_5 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %111 + %112 = OpLabel + %113 = OpAccessChain %_ptr_Private_int %data %int_0 + %114 = OpLoad %int %113 + %115 = OpIEqual %bool %114 %int_6 + OpBranch %111 + %111 = OpLabel + %116 = OpPhi %bool %110 %95 %115 %112 + OpSelectionMerge %117 None + OpBranchConditional %116 %118 %119 + %118 = OpLabel + OpReturnValue %float_1 + %119 = OpLabel + OpReturnValue %float_0 + %117 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..b2bb718bcd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.hlsl @@ -0,0 +1,96 @@ +static int data[9] = (int[9])0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int temp[7] = (int[7])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_i1_(inout int a) { + int b = 0; + int i = 0; + bool x_115 = false; + bool x_116_phi = false; + b = 0; + data[0] = 5; + data[2] = 0; + data[4] = 0; + data[6] = 0; + data[8] = 0; + const float x_71 = gl_FragCoord.x; + if ((x_71 >= 0.0f)) { + while (true) { + const int x_79 = b; + const int x_80 = a; + if ((x_79 <= x_80)) { + } else { + break; + } + if ((b <= 5)) { + const int x_87 = b; + const int x_90 = data[b]; + temp[x_87] = x_90; + b = (b + 2); + } + } + } + i = 0; + { + for(; (i < 3); i = (i + 1)) { + const int x_101 = i; + const int x_103 = temp[0]; + data[x_101] = (x_103 + 1); + } + } + const int x_109 = temp[0]; + const bool x_110 = (x_109 == 5); + x_116_phi = x_110; + if (x_110) { + const int x_114 = data[0]; + x_115 = (x_114 == 6); + x_116_phi = x_115; + } + if (x_116_phi) { + return 1.0f; + } else { + return 0.0f; + } + return 0.0f; +} + +void main_1() { + int i_1 = 0; + int param = 0; + int param_1 = 0; + i_1 = 0; + { + for(; (i_1 < 6); i_1 = (i_1 + 1)) { + param = i_1; + const float x_55 = func_i1_(param); + param_1 = i_1; + const float x_57 = func_i1_(param_1); + if ((x_57 == 1.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..106d1585e6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.msl @@ -0,0 +1,121 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[9]; +}; +struct tint_array_wrapper_1 { + int arr[7]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_i1_(thread int* const a, thread tint_array_wrapper* const tint_symbol_5, thread float4* const tint_symbol_6, thread tint_array_wrapper_1* const tint_symbol_7) { + int b = 0; + int i = 0; + bool x_115 = false; + bool x_116_phi = false; + b = 0; + (*(tint_symbol_5)).arr[0] = 5; + (*(tint_symbol_5)).arr[2] = 0; + (*(tint_symbol_5)).arr[4] = 0; + (*(tint_symbol_5)).arr[6] = 0; + (*(tint_symbol_5)).arr[8] = 0; + float const x_71 = (*(tint_symbol_6)).x; + if ((x_71 >= 0.0f)) { + while (true) { + int const x_79 = b; + int const x_80 = *(a); + if ((x_79 <= x_80)) { + } else { + break; + } + int const x_83 = b; + if ((x_83 <= 5)) { + int const x_87 = b; + int const x_88 = b; + int const x_90 = (*(tint_symbol_5)).arr[x_88]; + (*(tint_symbol_7)).arr[x_87] = x_90; + int const x_92 = b; + b = (x_92 + 2); + } + } + } + i = 0; + while (true) { + int const x_98 = i; + if ((x_98 < 3)) { + } else { + break; + } + int const x_101 = i; + int const x_103 = (*(tint_symbol_7)).arr[0]; + (*(tint_symbol_5)).arr[x_101] = (x_103 + 1); + { + int const x_106 = i; + i = (x_106 + 1); + } + } + int const x_109 = (*(tint_symbol_7)).arr[0]; + bool const x_110 = (x_109 == 5); + x_116_phi = x_110; + if (x_110) { + int const x_114 = (*(tint_symbol_5)).arr[0]; + x_115 = (x_114 == 6); + x_116_phi = x_115; + } + bool const x_116 = x_116_phi; + if (x_116) { + return 1.0f; + } else { + return 0.0f; + } + return 0.0f; +} + +void main_1(thread tint_array_wrapper* const tint_symbol_8, thread float4* const tint_symbol_9, thread tint_array_wrapper_1* const tint_symbol_10, thread float4* const tint_symbol_11) { + int i_1 = 0; + int param = 0; + int param_1 = 0; + i_1 = 0; + while (true) { + int const x_51 = i_1; + if ((x_51 < 6)) { + } else { + break; + } + int const x_54 = i_1; + param = x_54; + float const x_55 = func_i1_(&(param), tint_symbol_8, tint_symbol_9, tint_symbol_10); + int const x_56 = i_1; + param_1 = x_56; + float const x_57 = func_i1_(&(param_1), tint_symbol_8, tint_symbol_9, tint_symbol_10); + if ((x_57 == 1.0f)) { + *(tint_symbol_11) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_11) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + { + int const x_62 = i_1; + i_1 = (x_62 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_12 = 0.0f; + thread tint_array_wrapper tint_symbol_13 = {}; + thread tint_array_wrapper_1 tint_symbol_14 = {}; + thread float4 tint_symbol_15 = 0.0f; + tint_symbol_12 = gl_FragCoord_param; + main_1(&(tint_symbol_13), &(tint_symbol_12), &(tint_symbol_14), &(tint_symbol_15)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_15}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..0129c00f2e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.spvasm @@ -0,0 +1,258 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 153 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %gl_FragCoord "gl_FragCoord" + OpName %temp "temp" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_i1_ "func_i1_" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %x_115 "x_115" + OpName %x_116_phi "x_116_phi" + OpName %main_1 "main_1" + OpName %i_1 "i_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_9 ArrayStride 4 + OpDecorate %_arr_int_uint_7 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_int_uint_9 = OpTypeArray %int %uint_9 +%_ptr_Private__arr_int_uint_9 = OpTypePointer Private %_arr_int_uint_9 + %7 = OpConstantNull %_arr_int_uint_9 + %data = OpVariable %_ptr_Private__arr_int_uint_9 Private %7 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 + %uint_7 = OpConstant %uint 7 +%_arr_int_uint_7 = OpTypeArray %int %uint_7 +%_ptr_Private__arr_int_uint_7 = OpTypePointer Private %_arr_int_uint_7 + %17 = OpConstantNull %_arr_int_uint_7 + %temp = OpVariable %_ptr_Private__arr_int_uint_7 Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %float %_ptr_Function_int + %29 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %34 = OpConstantNull %bool + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %int_6 = OpConstant %int 6 + %int_8 = OpConstant %int 8 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %void = OpTypeVoid + %110 = OpTypeFunction %void + %136 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %137 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %140 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %float None %23 + %a = OpFunctionParameter %_ptr_Function_int + %27 = OpLabel + %b = OpVariable %_ptr_Function_int Function %29 + %i = OpVariable %_ptr_Function_int Function %29 + %x_115 = OpVariable %_ptr_Function_bool Function %34 + %x_116_phi = OpVariable %_ptr_Function_bool Function %34 + OpStore %b %int_0 + %38 = OpAccessChain %_ptr_Private_int %data %int_0 + OpStore %38 %int_5 + %41 = OpAccessChain %_ptr_Private_int %data %int_2 + OpStore %41 %int_0 + %43 = OpAccessChain %_ptr_Private_int %data %int_4 + OpStore %43 %int_0 + %45 = OpAccessChain %_ptr_Private_int %data %int_6 + OpStore %45 %int_0 + %47 = OpAccessChain %_ptr_Private_int %data %int_8 + OpStore %47 %int_0 + %50 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %51 = OpLoad %float %50 + %53 = OpFOrdGreaterThanEqual %bool %51 %float_0 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %int %b + %62 = OpLoad %int %a + %63 = OpSLessThanEqual %bool %60 %62 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %57 + %64 = OpLabel + %67 = OpLoad %int %b + %68 = OpSLessThanEqual %bool %67 %int_5 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + %71 = OpLoad %int %b + %72 = OpLoad %int %b + %73 = OpAccessChain %_ptr_Private_int %data %72 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Private_int %temp %71 + OpStore %75 %74 + %76 = OpLoad %int %b + %77 = OpIAdd %int %76 %int_2 + OpStore %b %77 + OpBranch %69 + %69 = OpLabel + OpBranch %58 + %58 = OpLabel + OpBranch %56 + %57 = OpLabel + OpBranch %54 + %54 = OpLabel + OpStore %i %int_0 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %int %i + %84 = OpSLessThan %bool %82 %int_3 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %87 + %86 = OpLabel + OpBranch %85 + %87 = OpLabel + OpBranch %79 + %85 = OpLabel + %88 = OpLoad %int %i + %89 = OpAccessChain %_ptr_Private_int %temp %int_0 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Private_int %data %88 + %93 = OpIAdd %int %90 %int_1 + OpStore %91 %93 + OpBranch %80 + %80 = OpLabel + %94 = OpLoad %int %i + %95 = OpIAdd %int %94 %int_1 + OpStore %i %95 + OpBranch %78 + %79 = OpLabel + %96 = OpAccessChain %_ptr_Private_int %temp %int_0 + %97 = OpLoad %int %96 + %98 = OpIEqual %bool %97 %int_5 + OpStore %x_116_phi %98 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %99 + %100 = OpLabel + %101 = OpAccessChain %_ptr_Private_int %data %int_0 + %102 = OpLoad %int %101 + %103 = OpIEqual %bool %102 %int_6 + OpStore %x_115 %103 + %104 = OpLoad %bool %x_115 + OpStore %x_116_phi %104 + OpBranch %99 + %99 = OpLabel + %105 = OpLoad %bool %x_116_phi + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %108 + %107 = OpLabel + OpReturnValue %float_1 + %108 = OpLabel + OpReturnValue %float_0 + %106 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + %main_1 = OpFunction %void None %110 + %113 = OpLabel + %i_1 = OpVariable %_ptr_Function_int Function %29 + %param = OpVariable %_ptr_Function_int Function %29 + %param_1 = OpVariable %_ptr_Function_int Function %29 + OpStore %i_1 %int_0 + OpBranch %117 + %117 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %121 = OpLoad %int %i_1 + %122 = OpSLessThan %bool %121 %int_6 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %125 + %124 = OpLabel + OpBranch %123 + %125 = OpLabel + OpBranch %118 + %123 = OpLabel + %126 = OpLoad %int %i_1 + OpStore %param %126 + %127 = OpFunctionCall %float %func_i1_ %param + %129 = OpLoad %int %i_1 + OpStore %param_1 %129 + %130 = OpFunctionCall %float %func_i1_ %param_1 + %132 = OpFOrdEqual %bool %130 %float_1 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %135 + %134 = OpLabel + OpStore %x_GLF_color %136 + OpBranch %133 + %135 = OpLabel + OpStore %x_GLF_color %137 + OpBranch %133 + %133 = OpLabel + OpBranch %119 + %119 = OpLabel + %138 = OpLoad %int %i_1 + %139 = OpIAdd %int %138 %int_1 + OpStore %i_1 %139 + OpBranch %117 + %118 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %140 +%tint_symbol_1 = OpFunctionParameter %main_out + %144 = OpLabel + %145 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %145 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %110 + %147 = OpLabel + %148 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %148 + %149 = OpFunctionCall %void %main_1 + %151 = OpLoad %v4float %x_GLF_color + %152 = OpCompositeConstruct %main_out %151 + %150 = OpFunctionCall %void %tint_symbol_3 %152 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a09f0d4d8c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.spvasm.expected.wgsl @@ -0,0 +1,114 @@ +var data : array; + +var gl_FragCoord : vec4; + +var temp : array; + +var x_GLF_color : vec4; + +fn func_i1_(a : ptr) -> f32 { + var b : i32; + var i : i32; + var x_115 : bool; + var x_116_phi : bool; + b = 0; + data[0] = 5; + data[2] = 0; + data[4] = 0; + data[6] = 0; + data[8] = 0; + let x_71 : f32 = gl_FragCoord.x; + if ((x_71 >= 0.0)) { + loop { + let x_79 : i32 = b; + let x_80 : i32 = *(a); + if ((x_79 <= x_80)) { + } else { + break; + } + let x_83 : i32 = b; + if ((x_83 <= 5)) { + let x_87 : i32 = b; + let x_88 : i32 = b; + let x_90 : i32 = data[x_88]; + temp[x_87] = x_90; + let x_92 : i32 = b; + b = (x_92 + 2); + } + } + } + i = 0; + loop { + let x_98 : i32 = i; + if ((x_98 < 3)) { + } else { + break; + } + let x_101 : i32 = i; + let x_103 : i32 = temp[0]; + data[x_101] = (x_103 + 1); + + continuing { + let x_106 : i32 = i; + i = (x_106 + 1); + } + } + let x_109 : i32 = temp[0]; + let x_110 : bool = (x_109 == 5); + x_116_phi = x_110; + if (x_110) { + let x_114 : i32 = data[0]; + x_115 = (x_114 == 6); + x_116_phi = x_115; + } + let x_116 : bool = x_116_phi; + if (x_116) { + return 1.0; + } else { + return 0.0; + } + return 0.0; +} + +fn main_1() { + var i_1 : i32; + var param : i32; + var param_1 : i32; + i_1 = 0; + loop { + let x_51 : i32 = i_1; + if ((x_51 < 6)) { + } else { + break; + } + let x_54 : i32 = i_1; + param = x_54; + let x_55 : f32 = func_i1_(&(param)); + let x_56 : i32 = i_1; + param_1 = x_56; + let x_57 : f32 = func_i1_(&(param_1)); + if ((x_57 == 1.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + + continuing { + let x_62 : i32 = i_1; + i_1 = (x_62 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl new file mode 100644 index 0000000000..a09f0d4d8c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl @@ -0,0 +1,114 @@ +var data : array; + +var gl_FragCoord : vec4; + +var temp : array; + +var x_GLF_color : vec4; + +fn func_i1_(a : ptr) -> f32 { + var b : i32; + var i : i32; + var x_115 : bool; + var x_116_phi : bool; + b = 0; + data[0] = 5; + data[2] = 0; + data[4] = 0; + data[6] = 0; + data[8] = 0; + let x_71 : f32 = gl_FragCoord.x; + if ((x_71 >= 0.0)) { + loop { + let x_79 : i32 = b; + let x_80 : i32 = *(a); + if ((x_79 <= x_80)) { + } else { + break; + } + let x_83 : i32 = b; + if ((x_83 <= 5)) { + let x_87 : i32 = b; + let x_88 : i32 = b; + let x_90 : i32 = data[x_88]; + temp[x_87] = x_90; + let x_92 : i32 = b; + b = (x_92 + 2); + } + } + } + i = 0; + loop { + let x_98 : i32 = i; + if ((x_98 < 3)) { + } else { + break; + } + let x_101 : i32 = i; + let x_103 : i32 = temp[0]; + data[x_101] = (x_103 + 1); + + continuing { + let x_106 : i32 = i; + i = (x_106 + 1); + } + } + let x_109 : i32 = temp[0]; + let x_110 : bool = (x_109 == 5); + x_116_phi = x_110; + if (x_110) { + let x_114 : i32 = data[0]; + x_115 = (x_114 == 6); + x_116_phi = x_115; + } + let x_116 : bool = x_116_phi; + if (x_116) { + return 1.0; + } else { + return 0.0; + } + return 0.0; +} + +fn main_1() { + var i_1 : i32; + var param : i32; + var param_1 : i32; + i_1 = 0; + loop { + let x_51 : i32 = i_1; + if ((x_51 < 6)) { + } else { + break; + } + let x_54 : i32 = i_1; + param = x_54; + let x_55 : f32 = func_i1_(&(param)); + let x_56 : i32 = i_1; + param_1 = x_56; + let x_57 : f32 = func_i1_(&(param_1)); + if ((x_57 == 1.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + + continuing { + let x_62 : i32 = i_1; + i_1 = (x_62 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..b2bb718bcd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.hlsl @@ -0,0 +1,96 @@ +static int data[9] = (int[9])0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int temp[7] = (int[7])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_i1_(inout int a) { + int b = 0; + int i = 0; + bool x_115 = false; + bool x_116_phi = false; + b = 0; + data[0] = 5; + data[2] = 0; + data[4] = 0; + data[6] = 0; + data[8] = 0; + const float x_71 = gl_FragCoord.x; + if ((x_71 >= 0.0f)) { + while (true) { + const int x_79 = b; + const int x_80 = a; + if ((x_79 <= x_80)) { + } else { + break; + } + if ((b <= 5)) { + const int x_87 = b; + const int x_90 = data[b]; + temp[x_87] = x_90; + b = (b + 2); + } + } + } + i = 0; + { + for(; (i < 3); i = (i + 1)) { + const int x_101 = i; + const int x_103 = temp[0]; + data[x_101] = (x_103 + 1); + } + } + const int x_109 = temp[0]; + const bool x_110 = (x_109 == 5); + x_116_phi = x_110; + if (x_110) { + const int x_114 = data[0]; + x_115 = (x_114 == 6); + x_116_phi = x_115; + } + if (x_116_phi) { + return 1.0f; + } else { + return 0.0f; + } + return 0.0f; +} + +void main_1() { + int i_1 = 0; + int param = 0; + int param_1 = 0; + i_1 = 0; + { + for(; (i_1 < 6); i_1 = (i_1 + 1)) { + param = i_1; + const float x_55 = func_i1_(param); + param_1 = i_1; + const float x_57 = func_i1_(param_1); + if ((x_57 == 1.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..106d1585e6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.msl @@ -0,0 +1,121 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[9]; +}; +struct tint_array_wrapper_1 { + int arr[7]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_i1_(thread int* const a, thread tint_array_wrapper* const tint_symbol_5, thread float4* const tint_symbol_6, thread tint_array_wrapper_1* const tint_symbol_7) { + int b = 0; + int i = 0; + bool x_115 = false; + bool x_116_phi = false; + b = 0; + (*(tint_symbol_5)).arr[0] = 5; + (*(tint_symbol_5)).arr[2] = 0; + (*(tint_symbol_5)).arr[4] = 0; + (*(tint_symbol_5)).arr[6] = 0; + (*(tint_symbol_5)).arr[8] = 0; + float const x_71 = (*(tint_symbol_6)).x; + if ((x_71 >= 0.0f)) { + while (true) { + int const x_79 = b; + int const x_80 = *(a); + if ((x_79 <= x_80)) { + } else { + break; + } + int const x_83 = b; + if ((x_83 <= 5)) { + int const x_87 = b; + int const x_88 = b; + int const x_90 = (*(tint_symbol_5)).arr[x_88]; + (*(tint_symbol_7)).arr[x_87] = x_90; + int const x_92 = b; + b = (x_92 + 2); + } + } + } + i = 0; + while (true) { + int const x_98 = i; + if ((x_98 < 3)) { + } else { + break; + } + int const x_101 = i; + int const x_103 = (*(tint_symbol_7)).arr[0]; + (*(tint_symbol_5)).arr[x_101] = (x_103 + 1); + { + int const x_106 = i; + i = (x_106 + 1); + } + } + int const x_109 = (*(tint_symbol_7)).arr[0]; + bool const x_110 = (x_109 == 5); + x_116_phi = x_110; + if (x_110) { + int const x_114 = (*(tint_symbol_5)).arr[0]; + x_115 = (x_114 == 6); + x_116_phi = x_115; + } + bool const x_116 = x_116_phi; + if (x_116) { + return 1.0f; + } else { + return 0.0f; + } + return 0.0f; +} + +void main_1(thread tint_array_wrapper* const tint_symbol_8, thread float4* const tint_symbol_9, thread tint_array_wrapper_1* const tint_symbol_10, thread float4* const tint_symbol_11) { + int i_1 = 0; + int param = 0; + int param_1 = 0; + i_1 = 0; + while (true) { + int const x_51 = i_1; + if ((x_51 < 6)) { + } else { + break; + } + int const x_54 = i_1; + param = x_54; + float const x_55 = func_i1_(&(param), tint_symbol_8, tint_symbol_9, tint_symbol_10); + int const x_56 = i_1; + param_1 = x_56; + float const x_57 = func_i1_(&(param_1), tint_symbol_8, tint_symbol_9, tint_symbol_10); + if ((x_57 == 1.0f)) { + *(tint_symbol_11) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_11) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + { + int const x_62 = i_1; + i_1 = (x_62 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_12 = 0.0f; + thread tint_array_wrapper tint_symbol_13 = {}; + thread tint_array_wrapper_1 tint_symbol_14 = {}; + thread float4 tint_symbol_15 = 0.0f; + tint_symbol_12 = gl_FragCoord_param; + main_1(&(tint_symbol_13), &(tint_symbol_12), &(tint_symbol_14), &(tint_symbol_15)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_15}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..0129c00f2e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.spvasm @@ -0,0 +1,258 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 153 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %gl_FragCoord "gl_FragCoord" + OpName %temp "temp" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_i1_ "func_i1_" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %x_115 "x_115" + OpName %x_116_phi "x_116_phi" + OpName %main_1 "main_1" + OpName %i_1 "i_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_9 ArrayStride 4 + OpDecorate %_arr_int_uint_7 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_int_uint_9 = OpTypeArray %int %uint_9 +%_ptr_Private__arr_int_uint_9 = OpTypePointer Private %_arr_int_uint_9 + %7 = OpConstantNull %_arr_int_uint_9 + %data = OpVariable %_ptr_Private__arr_int_uint_9 Private %7 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 + %uint_7 = OpConstant %uint 7 +%_arr_int_uint_7 = OpTypeArray %int %uint_7 +%_ptr_Private__arr_int_uint_7 = OpTypePointer Private %_arr_int_uint_7 + %17 = OpConstantNull %_arr_int_uint_7 + %temp = OpVariable %_ptr_Private__arr_int_uint_7 Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %float %_ptr_Function_int + %29 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %34 = OpConstantNull %bool + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %int_6 = OpConstant %int 6 + %int_8 = OpConstant %int 8 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %void = OpTypeVoid + %110 = OpTypeFunction %void + %136 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %137 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %140 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %float None %23 + %a = OpFunctionParameter %_ptr_Function_int + %27 = OpLabel + %b = OpVariable %_ptr_Function_int Function %29 + %i = OpVariable %_ptr_Function_int Function %29 + %x_115 = OpVariable %_ptr_Function_bool Function %34 + %x_116_phi = OpVariable %_ptr_Function_bool Function %34 + OpStore %b %int_0 + %38 = OpAccessChain %_ptr_Private_int %data %int_0 + OpStore %38 %int_5 + %41 = OpAccessChain %_ptr_Private_int %data %int_2 + OpStore %41 %int_0 + %43 = OpAccessChain %_ptr_Private_int %data %int_4 + OpStore %43 %int_0 + %45 = OpAccessChain %_ptr_Private_int %data %int_6 + OpStore %45 %int_0 + %47 = OpAccessChain %_ptr_Private_int %data %int_8 + OpStore %47 %int_0 + %50 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %51 = OpLoad %float %50 + %53 = OpFOrdGreaterThanEqual %bool %51 %float_0 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %int %b + %62 = OpLoad %int %a + %63 = OpSLessThanEqual %bool %60 %62 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %57 + %64 = OpLabel + %67 = OpLoad %int %b + %68 = OpSLessThanEqual %bool %67 %int_5 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + %71 = OpLoad %int %b + %72 = OpLoad %int %b + %73 = OpAccessChain %_ptr_Private_int %data %72 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Private_int %temp %71 + OpStore %75 %74 + %76 = OpLoad %int %b + %77 = OpIAdd %int %76 %int_2 + OpStore %b %77 + OpBranch %69 + %69 = OpLabel + OpBranch %58 + %58 = OpLabel + OpBranch %56 + %57 = OpLabel + OpBranch %54 + %54 = OpLabel + OpStore %i %int_0 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %int %i + %84 = OpSLessThan %bool %82 %int_3 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %87 + %86 = OpLabel + OpBranch %85 + %87 = OpLabel + OpBranch %79 + %85 = OpLabel + %88 = OpLoad %int %i + %89 = OpAccessChain %_ptr_Private_int %temp %int_0 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Private_int %data %88 + %93 = OpIAdd %int %90 %int_1 + OpStore %91 %93 + OpBranch %80 + %80 = OpLabel + %94 = OpLoad %int %i + %95 = OpIAdd %int %94 %int_1 + OpStore %i %95 + OpBranch %78 + %79 = OpLabel + %96 = OpAccessChain %_ptr_Private_int %temp %int_0 + %97 = OpLoad %int %96 + %98 = OpIEqual %bool %97 %int_5 + OpStore %x_116_phi %98 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %99 + %100 = OpLabel + %101 = OpAccessChain %_ptr_Private_int %data %int_0 + %102 = OpLoad %int %101 + %103 = OpIEqual %bool %102 %int_6 + OpStore %x_115 %103 + %104 = OpLoad %bool %x_115 + OpStore %x_116_phi %104 + OpBranch %99 + %99 = OpLabel + %105 = OpLoad %bool %x_116_phi + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %108 + %107 = OpLabel + OpReturnValue %float_1 + %108 = OpLabel + OpReturnValue %float_0 + %106 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + %main_1 = OpFunction %void None %110 + %113 = OpLabel + %i_1 = OpVariable %_ptr_Function_int Function %29 + %param = OpVariable %_ptr_Function_int Function %29 + %param_1 = OpVariable %_ptr_Function_int Function %29 + OpStore %i_1 %int_0 + OpBranch %117 + %117 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %121 = OpLoad %int %i_1 + %122 = OpSLessThan %bool %121 %int_6 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %125 + %124 = OpLabel + OpBranch %123 + %125 = OpLabel + OpBranch %118 + %123 = OpLabel + %126 = OpLoad %int %i_1 + OpStore %param %126 + %127 = OpFunctionCall %float %func_i1_ %param + %129 = OpLoad %int %i_1 + OpStore %param_1 %129 + %130 = OpFunctionCall %float %func_i1_ %param_1 + %132 = OpFOrdEqual %bool %130 %float_1 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %135 + %134 = OpLabel + OpStore %x_GLF_color %136 + OpBranch %133 + %135 = OpLabel + OpStore %x_GLF_color %137 + OpBranch %133 + %133 = OpLabel + OpBranch %119 + %119 = OpLabel + %138 = OpLoad %int %i_1 + %139 = OpIAdd %int %138 %int_1 + OpStore %i_1 %139 + OpBranch %117 + %118 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %140 +%tint_symbol_1 = OpFunctionParameter %main_out + %144 = OpLabel + %145 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %145 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %110 + %147 = OpLabel + %148 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %148 + %149 = OpFunctionCall %void %main_1 + %151 = OpLoad %v4float %x_GLF_color + %152 = OpCompositeConstruct %main_out %151 + %150 = OpFunctionCall %void %tint_symbol_3 %152 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a09f0d4d8c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array-2/0-opt.wgsl.expected.wgsl @@ -0,0 +1,114 @@ +var data : array; + +var gl_FragCoord : vec4; + +var temp : array; + +var x_GLF_color : vec4; + +fn func_i1_(a : ptr) -> f32 { + var b : i32; + var i : i32; + var x_115 : bool; + var x_116_phi : bool; + b = 0; + data[0] = 5; + data[2] = 0; + data[4] = 0; + data[6] = 0; + data[8] = 0; + let x_71 : f32 = gl_FragCoord.x; + if ((x_71 >= 0.0)) { + loop { + let x_79 : i32 = b; + let x_80 : i32 = *(a); + if ((x_79 <= x_80)) { + } else { + break; + } + let x_83 : i32 = b; + if ((x_83 <= 5)) { + let x_87 : i32 = b; + let x_88 : i32 = b; + let x_90 : i32 = data[x_88]; + temp[x_87] = x_90; + let x_92 : i32 = b; + b = (x_92 + 2); + } + } + } + i = 0; + loop { + let x_98 : i32 = i; + if ((x_98 < 3)) { + } else { + break; + } + let x_101 : i32 = i; + let x_103 : i32 = temp[0]; + data[x_101] = (x_103 + 1); + + continuing { + let x_106 : i32 = i; + i = (x_106 + 1); + } + } + let x_109 : i32 = temp[0]; + let x_110 : bool = (x_109 == 5); + x_116_phi = x_110; + if (x_110) { + let x_114 : i32 = data[0]; + x_115 = (x_114 == 6); + x_116_phi = x_115; + } + let x_116 : bool = x_116_phi; + if (x_116) { + return 1.0; + } else { + return 0.0; + } + return 0.0; +} + +fn main_1() { + var i_1 : i32; + var param : i32; + var param_1 : i32; + i_1 = 0; + loop { + let x_51 : i32 = i_1; + if ((x_51 < 6)) { + } else { + break; + } + let x_54 : i32 = i_1; + param = x_54; + let x_55 : f32 = func_i1_(&(param)); + let x_56 : i32 = i_1; + param_1 = x_56; + let x_57 : f32 = func_i1_(&(param_1)); + if ((x_57 == 1.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + + continuing { + let x_62 : i32 = i_1; + i_1 = (x_62 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm new file mode 100644 index 0000000000..ff91ed1cb2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm @@ -0,0 +1,159 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_i1_ "func(i1;" + OpName %x "x" + OpName %a "a" + OpName %data "data" + OpName %temp "temp" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpName %i_0 "i" + OpName %param "param" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %16 = OpTypeFunction %void %_ptr_Function_int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_int_uint_9 = OpTypeArray %int %uint_9 +%_ptr_Function__arr_int_uint_9 = OpTypePointer Function %_arr_int_uint_9 + %int_5 = OpConstant %int 5 + %bool = OpTypeBool + %int_10 = OpConstant %int 10 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %37 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %13 + %38 = OpLabel + %i_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + OpStore %i_0 %int_1 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i_0 + %44 = OpSLessThan %bool %43 %int_6 + OpBranchConditional %44 %45 %40 + %45 = OpLabel + %46 = OpLoad %int %i_0 + OpStore %param %46 + %47 = OpFunctionCall %void %func_i1_ %param + OpBranch %41 + %41 = OpLabel + %48 = OpLoad %int %i_0 + %49 = OpIAdd %int %48 %int_1 + OpStore %i_0 %49 + OpBranch %39 + %40 = OpLabel + OpReturn + OpFunctionEnd + %func_i1_ = OpFunction %void None %16 + %x = OpFunctionParameter %_ptr_Function_int + %50 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %data = OpVariable %_ptr_Function__arr_int_uint_9 Function + %temp = OpVariable %_ptr_Function__arr_int_uint_2 Function + %i = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + %51 = OpAccessChain %_ptr_Function_int %data %int_0 + OpStore %51 %int_5 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %a + %57 = OpLoad %int %x + %58 = OpSLessThanEqual %bool %56 %57 + OpBranchConditional %58 %59 %53 + %59 = OpLabel + %60 = OpLoad %int %a + %61 = OpSLessThanEqual %bool %60 %int_10 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpLoad %int %a + %65 = OpExtInst %int %1 SMin %64 %int_1 + %66 = OpLoad %int %a + %67 = OpExtInst %int %1 SMin %66 %int_0 + %68 = OpAccessChain %_ptr_Function_int %data %67 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Function_int %temp %65 + OpStore %70 %69 + %71 = OpLoad %int %a + %72 = OpIAdd %int %71 %int_1 + OpStore %a %72 + OpBranch %62 + %62 = OpLabel + OpBranch %54 + %54 = OpLabel + OpBranch %52 + %53 = OpLabel + OpStore %i %int_0 + OpBranch %73 + %73 = OpLabel + OpLoopMerge %74 %75 None + OpBranch %76 + %76 = OpLabel + %77 = OpLoad %int %i + %78 = OpSLessThan %bool %77 %int_2 + OpBranchConditional %78 %79 %74 + %79 = OpLabel + %80 = OpLoad %int %i + %81 = OpAccessChain %_ptr_Function_int %temp %int_0 + %82 = OpLoad %int %81 + %83 = OpLoad %int %i + %84 = OpIAdd %int %82 %83 + %85 = OpAccessChain %_ptr_Function_int %data %80 + OpStore %85 %84 + OpBranch %75 + %75 = OpLabel + %86 = OpLoad %int %i + %87 = OpIAdd %int %86 %int_1 + OpStore %i %87 + OpBranch %73 + %74 = OpLabel + %88 = OpAccessChain %_ptr_Function_int %data %int_0 + %89 = OpLoad %int %88 + %90 = OpIEqual %bool %89 %int_5 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + %93 = OpAccessChain %_ptr_Function_int %data %int_1 + %94 = OpLoad %int %93 + %95 = OpIEqual %bool %94 %int_6 + OpBranch %91 + %91 = OpLabel + %96 = OpPhi %bool %90 %74 %95 %92 + OpSelectionMerge %97 None + OpBranchConditional %96 %98 %99 + %98 = OpLabel + OpStore %_GLF_color %36 + OpBranch %97 + %99 = OpLabel + OpStore %_GLF_color %37 + OpBranch %97 + %97 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..86ba9e92bc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.hlsl @@ -0,0 +1,75 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_i1_(inout int x) { + int a = 0; + int data[9] = (int[9])0; + int temp[2] = (int[2])0; + int i = 0; + bool x_95 = false; + bool x_96_phi = false; + a = 0; + data[0] = 5; + while (true) { + const int x_56 = a; + const int x_57 = x; + if ((x_56 <= x_57)) { + } else { + break; + } + if ((a <= 10)) { + const int x_64 = a; + const int x_69 = data[min(a, 0)]; + temp[min(x_64, 1)] = x_69; + a = (a + 1); + } + } + i = 0; + { + for(; (i < 2); i = (i + 1)) { + const int x_80 = i; + const int x_82 = temp[0]; + data[x_80] = (x_82 + i); + } + } + const int x_89 = data[0]; + const bool x_90 = (x_89 == 5); + x_96_phi = x_90; + if (x_90) { + const int x_94 = data[1]; + x_95 = (x_94 == 6); + x_96_phi = x_95; + } + if (x_96_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +void main_1() { + int i_1 = 0; + int param = 0; + i_1 = 1; + { + for(; (i_1 < 6); i_1 = (i_1 + 1)) { + param = i_1; + func_i1_(param); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..8260441934 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.msl @@ -0,0 +1,104 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[9]; +}; +struct tint_array_wrapper_1 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_i1_(thread int* const x, thread float4* const tint_symbol_4) { + int a = 0; + tint_array_wrapper data = {}; + tint_array_wrapper_1 temp = {}; + int i = 0; + bool x_95 = false; + bool x_96_phi = false; + a = 0; + data.arr[0] = 5; + while (true) { + int const x_56 = a; + int const x_57 = *(x); + if ((x_56 <= x_57)) { + } else { + break; + } + int const x_60 = a; + if ((x_60 <= 10)) { + int const x_64 = a; + int const x_66 = a; + int const x_69 = data.arr[min(x_66, 0)]; + temp.arr[min(x_64, 1)] = x_69; + int const x_71 = a; + a = (x_71 + 1); + } + } + i = 0; + while (true) { + int const x_77 = i; + if ((x_77 < 2)) { + } else { + break; + } + int const x_80 = i; + int const x_82 = temp.arr[0]; + int const x_83 = i; + data.arr[x_80] = (x_82 + x_83); + { + int const x_86 = i; + i = (x_86 + 1); + } + } + int const x_89 = data.arr[0]; + bool const x_90 = (x_89 == 5); + x_96_phi = x_90; + if (x_90) { + int const x_94 = data.arr[1]; + x_95 = (x_94 == 6); + x_96_phi = x_95; + } + bool const x_96 = x_96_phi; + if (x_96) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +void main_1(thread float4* const tint_symbol_5) { + int i_1 = 0; + int param = 0; + i_1 = 1; + while (true) { + int const x_43 = i_1; + if ((x_43 < 6)) { + } else { + break; + } + int const x_46 = i_1; + param = x_46; + func_i1_(&(param), tint_symbol_5); + { + int const x_48 = i_1; + i_1 = (x_48 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + main_1(&(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..894502427a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.spvasm @@ -0,0 +1,220 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 131 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_i1_ "func_i1_" + OpName %x "x" + OpName %a "a" + OpName %data "data" + OpName %temp "temp" + OpName %i "i" + OpName %x_95 "x_95" + OpName %x_96_phi "x_96_phi" + OpName %main_1 "main_1" + OpName %i_1 "i_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_9 ArrayStride 4 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %8 = OpTypeFunction %void %_ptr_Function_int + %16 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_int_uint_9 = OpTypeArray %int %uint_9 +%_ptr_Function__arr_int_uint_9 = OpTypePointer Function %_arr_int_uint_9 + %22 = OpConstantNull %_arr_int_uint_9 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %27 = OpConstantNull %_arr_int_uint_2 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %32 = OpConstantNull %bool + %int_0 = OpConstant %int 0 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %98 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %99 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %100 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %119 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %void None %8 + %x = OpFunctionParameter %_ptr_Function_int + %14 = OpLabel + %a = OpVariable %_ptr_Function_int Function %16 + %data = OpVariable %_ptr_Function__arr_int_uint_9 Function %22 + %temp = OpVariable %_ptr_Function__arr_int_uint_2 Function %27 + %i = OpVariable %_ptr_Function_int Function %16 + %x_95 = OpVariable %_ptr_Function_bool Function %32 + %x_96_phi = OpVariable %_ptr_Function_bool Function %32 + OpStore %a %int_0 + %35 = OpAccessChain %_ptr_Function_int %data %int_0 + OpStore %35 %int_5 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %int %a + %43 = OpLoad %int %x + %44 = OpSLessThanEqual %bool %41 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %38 + %45 = OpLabel + %48 = OpLoad %int %a + %50 = OpSLessThanEqual %bool %48 %int_10 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %53 = OpLoad %int %a + %54 = OpLoad %int %a + %55 = OpExtInst %int %56 SMin %54 %int_0 + %57 = OpAccessChain %_ptr_Function_int %data %55 + %58 = OpLoad %int %57 + %59 = OpExtInst %int %56 SMin %53 %int_1 + %61 = OpAccessChain %_ptr_Function_int %temp %59 + OpStore %61 %58 + %62 = OpLoad %int %a + %63 = OpIAdd %int %62 %int_1 + OpStore %a %63 + OpBranch %51 + %51 = OpLabel + OpBranch %39 + %39 = OpLabel + OpBranch %37 + %38 = OpLabel + OpStore %i %int_0 + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %int %i + %70 = OpSLessThan %bool %68 %int_2 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %65 + %71 = OpLabel + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Function_int %temp %int_0 + %76 = OpLoad %int %75 + %77 = OpLoad %int %i + %78 = OpAccessChain %_ptr_Function_int %data %74 + %79 = OpIAdd %int %76 %77 + OpStore %78 %79 + OpBranch %66 + %66 = OpLabel + %80 = OpLoad %int %i + %81 = OpIAdd %int %80 %int_1 + OpStore %i %81 + OpBranch %64 + %65 = OpLabel + %82 = OpAccessChain %_ptr_Function_int %data %int_0 + %83 = OpLoad %int %82 + %84 = OpIEqual %bool %83 %int_5 + OpStore %x_96_phi %84 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + %87 = OpAccessChain %_ptr_Function_int %data %int_1 + %88 = OpLoad %int %87 + %90 = OpIEqual %bool %88 %int_6 + OpStore %x_95 %90 + %91 = OpLoad %bool %x_95 + OpStore %x_96_phi %91 + OpBranch %85 + %85 = OpLabel + %92 = OpLoad %bool %x_96_phi + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + OpStore %x_GLF_color %98 + OpBranch %93 + %95 = OpLabel + OpStore %x_GLF_color %99 + OpBranch %93 + %93 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %100 + %102 = OpLabel + %i_1 = OpVariable %_ptr_Function_int Function %16 + %param = OpVariable %_ptr_Function_int Function %16 + OpStore %i_1 %int_1 + OpBranch %105 + %105 = OpLabel + OpLoopMerge %106 %107 None + OpBranch %108 + %108 = OpLabel + %109 = OpLoad %int %i_1 + %110 = OpSLessThan %bool %109 %int_6 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %113 + %112 = OpLabel + OpBranch %111 + %113 = OpLabel + OpBranch %106 + %111 = OpLabel + %114 = OpLoad %int %i_1 + OpStore %param %114 + %115 = OpFunctionCall %void %func_i1_ %param + OpBranch %107 + %107 = OpLabel + %117 = OpLoad %int %i_1 + %118 = OpIAdd %int %117 %int_1 + OpStore %i_1 %118 + OpBranch %105 + %106 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %119 +%tint_symbol = OpFunctionParameter %main_out + %123 = OpLabel + %124 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %124 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %100 + %126 = OpLabel + %127 = OpFunctionCall %void %main_1 + %129 = OpLoad %v4float %x_GLF_color + %130 = OpCompositeConstruct %main_out %129 + %128 = OpFunctionCall %void %tint_symbol_2 %130 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..19735eedd9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.spvasm.expected.wgsl @@ -0,0 +1,94 @@ +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) { + var a : i32; + var data : array; + var temp : array; + var i : i32; + var x_95 : bool; + var x_96_phi : bool; + a = 0; + data[0] = 5; + loop { + let x_56 : i32 = a; + let x_57 : i32 = *(x); + if ((x_56 <= x_57)) { + } else { + break; + } + let x_60 : i32 = a; + if ((x_60 <= 10)) { + let x_64 : i32 = a; + let x_66 : i32 = a; + let x_69 : i32 = data[min(x_66, 0)]; + temp[min(x_64, 1)] = x_69; + let x_71 : i32 = a; + a = (x_71 + 1); + } + } + i = 0; + loop { + let x_77 : i32 = i; + if ((x_77 < 2)) { + } else { + break; + } + let x_80 : i32 = i; + let x_82 : i32 = temp[0]; + let x_83 : i32 = i; + data[x_80] = (x_82 + x_83); + + continuing { + let x_86 : i32 = i; + i = (x_86 + 1); + } + } + let x_89 : i32 = data[0]; + let x_90 : bool = (x_89 == 5); + x_96_phi = x_90; + if (x_90) { + let x_94 : i32 = data[1]; + x_95 = (x_94 == 6); + x_96_phi = x_95; + } + let x_96 : bool = x_96_phi; + if (x_96) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +fn main_1() { + var i_1 : i32; + var param : i32; + i_1 = 1; + loop { + let x_43 : i32 = i_1; + if ((x_43 < 6)) { + } else { + break; + } + let x_46 : i32 = i_1; + param = x_46; + func_i1_(&(param)); + + continuing { + let x_48 : i32 = i_1; + i_1 = (x_48 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl new file mode 100644 index 0000000000..19735eedd9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl @@ -0,0 +1,94 @@ +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) { + var a : i32; + var data : array; + var temp : array; + var i : i32; + var x_95 : bool; + var x_96_phi : bool; + a = 0; + data[0] = 5; + loop { + let x_56 : i32 = a; + let x_57 : i32 = *(x); + if ((x_56 <= x_57)) { + } else { + break; + } + let x_60 : i32 = a; + if ((x_60 <= 10)) { + let x_64 : i32 = a; + let x_66 : i32 = a; + let x_69 : i32 = data[min(x_66, 0)]; + temp[min(x_64, 1)] = x_69; + let x_71 : i32 = a; + a = (x_71 + 1); + } + } + i = 0; + loop { + let x_77 : i32 = i; + if ((x_77 < 2)) { + } else { + break; + } + let x_80 : i32 = i; + let x_82 : i32 = temp[0]; + let x_83 : i32 = i; + data[x_80] = (x_82 + x_83); + + continuing { + let x_86 : i32 = i; + i = (x_86 + 1); + } + } + let x_89 : i32 = data[0]; + let x_90 : bool = (x_89 == 5); + x_96_phi = x_90; + if (x_90) { + let x_94 : i32 = data[1]; + x_95 = (x_94 == 6); + x_96_phi = x_95; + } + let x_96 : bool = x_96_phi; + if (x_96) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +fn main_1() { + var i_1 : i32; + var param : i32; + i_1 = 1; + loop { + let x_43 : i32 = i_1; + if ((x_43 < 6)) { + } else { + break; + } + let x_46 : i32 = i_1; + param = x_46; + func_i1_(&(param)); + + continuing { + let x_48 : i32 = i_1; + i_1 = (x_48 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..86ba9e92bc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.hlsl @@ -0,0 +1,75 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_i1_(inout int x) { + int a = 0; + int data[9] = (int[9])0; + int temp[2] = (int[2])0; + int i = 0; + bool x_95 = false; + bool x_96_phi = false; + a = 0; + data[0] = 5; + while (true) { + const int x_56 = a; + const int x_57 = x; + if ((x_56 <= x_57)) { + } else { + break; + } + if ((a <= 10)) { + const int x_64 = a; + const int x_69 = data[min(a, 0)]; + temp[min(x_64, 1)] = x_69; + a = (a + 1); + } + } + i = 0; + { + for(; (i < 2); i = (i + 1)) { + const int x_80 = i; + const int x_82 = temp[0]; + data[x_80] = (x_82 + i); + } + } + const int x_89 = data[0]; + const bool x_90 = (x_89 == 5); + x_96_phi = x_90; + if (x_90) { + const int x_94 = data[1]; + x_95 = (x_94 == 6); + x_96_phi = x_95; + } + if (x_96_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +void main_1() { + int i_1 = 0; + int param = 0; + i_1 = 1; + { + for(; (i_1 < 6); i_1 = (i_1 + 1)) { + param = i_1; + func_i1_(param); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..8260441934 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.msl @@ -0,0 +1,104 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[9]; +}; +struct tint_array_wrapper_1 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_i1_(thread int* const x, thread float4* const tint_symbol_4) { + int a = 0; + tint_array_wrapper data = {}; + tint_array_wrapper_1 temp = {}; + int i = 0; + bool x_95 = false; + bool x_96_phi = false; + a = 0; + data.arr[0] = 5; + while (true) { + int const x_56 = a; + int const x_57 = *(x); + if ((x_56 <= x_57)) { + } else { + break; + } + int const x_60 = a; + if ((x_60 <= 10)) { + int const x_64 = a; + int const x_66 = a; + int const x_69 = data.arr[min(x_66, 0)]; + temp.arr[min(x_64, 1)] = x_69; + int const x_71 = a; + a = (x_71 + 1); + } + } + i = 0; + while (true) { + int const x_77 = i; + if ((x_77 < 2)) { + } else { + break; + } + int const x_80 = i; + int const x_82 = temp.arr[0]; + int const x_83 = i; + data.arr[x_80] = (x_82 + x_83); + { + int const x_86 = i; + i = (x_86 + 1); + } + } + int const x_89 = data.arr[0]; + bool const x_90 = (x_89 == 5); + x_96_phi = x_90; + if (x_90) { + int const x_94 = data.arr[1]; + x_95 = (x_94 == 6); + x_96_phi = x_95; + } + bool const x_96 = x_96_phi; + if (x_96) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +void main_1(thread float4* const tint_symbol_5) { + int i_1 = 0; + int param = 0; + i_1 = 1; + while (true) { + int const x_43 = i_1; + if ((x_43 < 6)) { + } else { + break; + } + int const x_46 = i_1; + param = x_46; + func_i1_(&(param), tint_symbol_5); + { + int const x_48 = i_1; + i_1 = (x_48 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + main_1(&(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..894502427a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.spvasm @@ -0,0 +1,220 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 131 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_i1_ "func_i1_" + OpName %x "x" + OpName %a "a" + OpName %data "data" + OpName %temp "temp" + OpName %i "i" + OpName %x_95 "x_95" + OpName %x_96_phi "x_96_phi" + OpName %main_1 "main_1" + OpName %i_1 "i_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_9 ArrayStride 4 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %8 = OpTypeFunction %void %_ptr_Function_int + %16 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_int_uint_9 = OpTypeArray %int %uint_9 +%_ptr_Function__arr_int_uint_9 = OpTypePointer Function %_arr_int_uint_9 + %22 = OpConstantNull %_arr_int_uint_9 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %27 = OpConstantNull %_arr_int_uint_2 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %32 = OpConstantNull %bool + %int_0 = OpConstant %int 0 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %98 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %99 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %100 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %119 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %void None %8 + %x = OpFunctionParameter %_ptr_Function_int + %14 = OpLabel + %a = OpVariable %_ptr_Function_int Function %16 + %data = OpVariable %_ptr_Function__arr_int_uint_9 Function %22 + %temp = OpVariable %_ptr_Function__arr_int_uint_2 Function %27 + %i = OpVariable %_ptr_Function_int Function %16 + %x_95 = OpVariable %_ptr_Function_bool Function %32 + %x_96_phi = OpVariable %_ptr_Function_bool Function %32 + OpStore %a %int_0 + %35 = OpAccessChain %_ptr_Function_int %data %int_0 + OpStore %35 %int_5 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %int %a + %43 = OpLoad %int %x + %44 = OpSLessThanEqual %bool %41 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %38 + %45 = OpLabel + %48 = OpLoad %int %a + %50 = OpSLessThanEqual %bool %48 %int_10 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %53 = OpLoad %int %a + %54 = OpLoad %int %a + %55 = OpExtInst %int %56 SMin %54 %int_0 + %57 = OpAccessChain %_ptr_Function_int %data %55 + %58 = OpLoad %int %57 + %59 = OpExtInst %int %56 SMin %53 %int_1 + %61 = OpAccessChain %_ptr_Function_int %temp %59 + OpStore %61 %58 + %62 = OpLoad %int %a + %63 = OpIAdd %int %62 %int_1 + OpStore %a %63 + OpBranch %51 + %51 = OpLabel + OpBranch %39 + %39 = OpLabel + OpBranch %37 + %38 = OpLabel + OpStore %i %int_0 + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %int %i + %70 = OpSLessThan %bool %68 %int_2 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %65 + %71 = OpLabel + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Function_int %temp %int_0 + %76 = OpLoad %int %75 + %77 = OpLoad %int %i + %78 = OpAccessChain %_ptr_Function_int %data %74 + %79 = OpIAdd %int %76 %77 + OpStore %78 %79 + OpBranch %66 + %66 = OpLabel + %80 = OpLoad %int %i + %81 = OpIAdd %int %80 %int_1 + OpStore %i %81 + OpBranch %64 + %65 = OpLabel + %82 = OpAccessChain %_ptr_Function_int %data %int_0 + %83 = OpLoad %int %82 + %84 = OpIEqual %bool %83 %int_5 + OpStore %x_96_phi %84 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + %87 = OpAccessChain %_ptr_Function_int %data %int_1 + %88 = OpLoad %int %87 + %90 = OpIEqual %bool %88 %int_6 + OpStore %x_95 %90 + %91 = OpLoad %bool %x_95 + OpStore %x_96_phi %91 + OpBranch %85 + %85 = OpLabel + %92 = OpLoad %bool %x_96_phi + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + OpStore %x_GLF_color %98 + OpBranch %93 + %95 = OpLabel + OpStore %x_GLF_color %99 + OpBranch %93 + %93 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %100 + %102 = OpLabel + %i_1 = OpVariable %_ptr_Function_int Function %16 + %param = OpVariable %_ptr_Function_int Function %16 + OpStore %i_1 %int_1 + OpBranch %105 + %105 = OpLabel + OpLoopMerge %106 %107 None + OpBranch %108 + %108 = OpLabel + %109 = OpLoad %int %i_1 + %110 = OpSLessThan %bool %109 %int_6 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %113 + %112 = OpLabel + OpBranch %111 + %113 = OpLabel + OpBranch %106 + %111 = OpLabel + %114 = OpLoad %int %i_1 + OpStore %param %114 + %115 = OpFunctionCall %void %func_i1_ %param + OpBranch %107 + %107 = OpLabel + %117 = OpLoad %int %i_1 + %118 = OpIAdd %int %117 %int_1 + OpStore %i_1 %118 + OpBranch %105 + %106 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %119 +%tint_symbol = OpFunctionParameter %main_out + %123 = OpLabel + %124 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %124 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %100 + %126 = OpLabel + %127 = OpFunctionCall %void %main_1 + %129 = OpLoad %v4float %x_GLF_color + %130 = OpCompositeConstruct %main_out %129 + %128 = OpFunctionCall %void %tint_symbol_2 %130 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..19735eedd9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/assign-array-value-to-another-array/0-opt.wgsl.expected.wgsl @@ -0,0 +1,94 @@ +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) { + var a : i32; + var data : array; + var temp : array; + var i : i32; + var x_95 : bool; + var x_96_phi : bool; + a = 0; + data[0] = 5; + loop { + let x_56 : i32 = a; + let x_57 : i32 = *(x); + if ((x_56 <= x_57)) { + } else { + break; + } + let x_60 : i32 = a; + if ((x_60 <= 10)) { + let x_64 : i32 = a; + let x_66 : i32 = a; + let x_69 : i32 = data[min(x_66, 0)]; + temp[min(x_64, 1)] = x_69; + let x_71 : i32 = a; + a = (x_71 + 1); + } + } + i = 0; + loop { + let x_77 : i32 = i; + if ((x_77 < 2)) { + } else { + break; + } + let x_80 : i32 = i; + let x_82 : i32 = temp[0]; + let x_83 : i32 = i; + data[x_80] = (x_82 + x_83); + + continuing { + let x_86 : i32 = i; + i = (x_86 + 1); + } + } + let x_89 : i32 = data[0]; + let x_90 : bool = (x_89 == 5); + x_96_phi = x_90; + if (x_90) { + let x_94 : i32 = data[1]; + x_95 = (x_94 == 6); + x_96_phi = x_95; + } + let x_96 : bool = x_96_phi; + if (x_96) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +fn main_1() { + var i_1 : i32; + var param : i32; + i_1 = 1; + loop { + let x_43 : i32 = i_1; + if ((x_43 < 6)) { + } else { + break; + } + let x_46 : i32 = i_1; + param = x_46; + func_i1_(&(param)); + + continuing { + let x_48 : i32 = i_1; + i_1 = (x_48 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm new file mode 100644 index 0000000000..ae7a96fc3d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm @@ -0,0 +1,125 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationID + OpExecutionMode %main LocalSize 16 1 1 + OpSource ESSL 310 + OpName %main "main" + OpName %lid "lid" + OpName %gl_LocalInvocationID "gl_LocalInvocationID" + OpName %val "val" + OpName %doesNotMatter "doesNotMatter" + OpMemberName %doesNotMatter 0 "global_seed" + OpMemberName %doesNotMatter 1 "data" + OpName %_ "" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %__0 "" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %doesNotMatter 0 Offset 0 + OpMemberDecorate %doesNotMatter 1 Offset 4 + OpDecorate %doesNotMatter BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_runtimearr_int = OpTypeRuntimeArray %int +%doesNotMatter = OpTypeStruct %int %_runtimearr_int +%_ptr_Uniform_doesNotMatter = OpTypePointer Uniform %doesNotMatter + %_ = OpVariable %_ptr_Uniform_doesNotMatter Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_100 = OpConstant %float 100 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %int_42 = OpConstant %int 42 + %uint_16 = OpConstant %uint 16 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_16 %uint_1 %uint_1 + %main = OpFunction %void None %14 + %38 = OpLabel + %lid = OpVariable %_ptr_Function_int Function + %val = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %39 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %40 = OpLoad %uint %39 + %41 = OpBitcast %int %40 + OpStore %lid %41 + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %43 = OpLoad %int %42 + OpStore %val %43 + OpStore %i %int_0 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %49 = OpSLessThan %bool %48 %int_2 + OpBranchConditional %49 %50 %45 + %50 = OpLabel + %51 = OpLoad %int %lid + %52 = OpSGreaterThan %bool %51 %int_0 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + %55 = OpLoad %int %lid + %56 = OpISub %int %55 %int_1 + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_1 %56 + %58 = OpLoad %int %57 + %59 = OpLoad %int %val + %60 = OpIAdd %int %59 %58 + OpStore %val %60 + %61 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %62 = OpLoad %float %61 + %63 = OpFOrdGreaterThan %bool %62 %float_100 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + OpBranch %45 + %64 = OpLabel + OpBranch %53 + %53 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %46 + %46 = OpLabel + %66 = OpLoad %int %i + %67 = OpIAdd %int %66 %int_1 + OpStore %i %67 + OpBranch %44 + %45 = OpLabel + %68 = OpLoad %int %lid + %69 = OpIEqual %bool %68 %int_0 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %_ %int_1 %int_0 + OpStore %72 %int_42 + OpBranch %70 + %70 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9ed54bc1f8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.hlsl @@ -0,0 +1,45 @@ +static uint3 gl_LocalInvocationID = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_7 : register(u0, space0); +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[1]; +}; + +void main_1() { + int lid = 0; + int val = 0; + int i = 0; + const uint x_40 = gl_LocalInvocationID.x; + lid = asint(x_40); + const int x_43 = asint(x_7.Load(0u)); + val = x_43; + i = 0; + { + for(; (i < 2); i = (i + 1)) { + if ((lid > 0)) { + const int x_58 = asint(x_7.Load((4u + (4u * uint((lid - 1)))))); + val = (val + x_58); + const float x_62 = asfloat(x_10[0].x); + if ((x_62 > 100.0f)) { + break; + } + } + GroupMemoryBarrierWithGroupSync(); + } + } + if ((lid == 0)) { + x_7.Store((4u + (4u * uint(0))), asuint(42)); + } + return; +} + +struct tint_symbol_1 { + uint3 gl_LocalInvocationID_param : SV_GroupThreadID; +}; + +[numthreads(16, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 gl_LocalInvocationID_param = tint_symbol.gl_LocalInvocationID_param; + gl_LocalInvocationID = gl_LocalInvocationID_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..99eb99a20b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; +struct doesNotMatter { + /* 0x0000 */ int global_seed; + /* 0x0004 */ int data[1]; +}; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; + +void main_1(constant buf1& x_10, device doesNotMatter& x_7, thread uint3* const tint_symbol_2) { + int lid = 0; + int val = 0; + int i = 0; + uint const x_40 = (*(tint_symbol_2)).x; + lid = as_type(x_40); + int const x_43 = x_7.global_seed; + val = x_43; + i = 0; + while (true) { + int const x_48 = i; + if ((x_48 < 2)) { + } else { + break; + } + int const x_51 = lid; + if ((x_51 > 0)) { + int const x_55 = lid; + int const x_58 = x_7.data[(x_55 - 1)]; + int const x_59 = val; + val = (x_59 + x_58); + float const x_62 = x_10.injectionSwitch.x; + if ((x_62 > 100.0f)) { + break; + } + } + threadgroup_barrier(mem_flags::mem_threadgroup); + { + int const x_66 = i; + i = (x_66 + 1); + } + } + int const x_68 = lid; + if ((x_68 == 0)) { + x_7.data[0] = 42; + } + return; +} + +kernel void tint_symbol(uint3 gl_LocalInvocationID_param [[thread_position_in_threadgroup]], constant buf1& x_10 [[buffer(1)]], device doesNotMatter& x_7 [[buffer(0)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = gl_LocalInvocationID_param; + main_1(x_10, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..552cb1b81b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 81 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 16 1 1 + OpName %gl_LocalInvocationID "gl_LocalInvocationID" + OpName %doesNotMatter "doesNotMatter" + OpMemberName %doesNotMatter 0 "global_seed" + OpMemberName %doesNotMatter 1 "data" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_10 "x_10" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %lid "lid" + OpName %val "val" + OpName %i "i" + OpName %main "main" + OpDecorate %doesNotMatter Block + OpMemberDecorate %doesNotMatter 0 Offset 0 + OpMemberDecorate %doesNotMatter 1 Offset 4 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol BuiltIn LocalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint +%gl_LocalInvocationID = OpVariable %_ptr_Private_v3uint Private %5 + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int +%doesNotMatter = OpTypeStruct %int %_runtimearr_int +%_ptr_StorageBuffer_doesNotMatter = OpTypePointer StorageBuffer %doesNotMatter + %x_7 = OpVariable %_ptr_StorageBuffer_doesNotMatter StorageBuffer + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_100 = OpConstant %float 100 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %int_42 = OpConstant %int 42 + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %lid = OpVariable %_ptr_Function_int Function %24 + %val = OpVariable %_ptr_Function_int Function %24 + %i = OpVariable %_ptr_Function_int Function %24 + %29 = OpAccessChain %_ptr_Private_uint %gl_LocalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %31 = OpBitcast %int %30 + OpStore %lid %31 + %33 = OpAccessChain %_ptr_StorageBuffer_int %x_7 %uint_0 + %34 = OpLoad %int %33 + OpStore %val %34 + OpStore %i %int_0 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %i + %42 = OpSLessThan %bool %40 %int_2 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %37 + %44 = OpLabel + %47 = OpLoad %int %lid + %48 = OpSGreaterThan %bool %47 %int_0 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + %51 = OpLoad %int %lid + %54 = OpISub %int %51 %int_1 + %55 = OpAccessChain %_ptr_StorageBuffer_int %x_7 %uint_1 %54 + %56 = OpLoad %int %55 + %57 = OpLoad %int %val + %58 = OpIAdd %int %57 %56 + OpStore %val %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0 + %61 = OpLoad %float %60 + %63 = OpFOrdGreaterThan %bool %61 %float_100 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + OpBranch %37 + %64 = OpLabel + OpBranch %49 + %49 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %38 + %38 = OpLabel + %69 = OpLoad %int %i + %70 = OpIAdd %int %69 %int_1 + OpStore %i %70 + OpBranch %36 + %37 = OpLabel + %71 = OpLoad %int %lid + %72 = OpIEqual %bool %71 %int_0 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpAccessChain %_ptr_StorageBuffer_int %x_7 %uint_1 %int_0 + OpStore %75 %int_42 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %78 = OpLabel + %79 = OpLoad %v3uint %tint_symbol + OpStore %gl_LocalInvocationID %79 + %80 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f57b088e0e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.spvasm.expected.wgsl @@ -0,0 +1,64 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct doesNotMatter { + global_seed : i32; + data : RTArr; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +var gl_LocalInvocationID : vec3; + +[[group(0), binding(0)]] var x_7 : doesNotMatter; + +[[group(0), binding(1)]] var x_10 : buf1; + +fn main_1() { + var lid : i32; + var val : i32; + var i : i32; + let x_40 : u32 = gl_LocalInvocationID.x; + lid = bitcast(x_40); + let x_43 : i32 = x_7.global_seed; + val = x_43; + i = 0; + loop { + let x_48 : i32 = i; + if ((x_48 < 2)) { + } else { + break; + } + let x_51 : i32 = lid; + if ((x_51 > 0)) { + let x_55 : i32 = lid; + let x_58 : i32 = x_7.data[(x_55 - 1)]; + let x_59 : i32 = val; + val = (x_59 + x_58); + let x_62 : f32 = x_10.injectionSwitch.x; + if ((x_62 > 100.0)) { + break; + } + } + workgroupBarrier(); + + continuing { + let x_66 : i32 = i; + i = (x_66 + 1); + } + } + let x_68 : i32 = lid; + if ((x_68 == 0)) { + x_7.data[0] = 42; + } + return; +} + +[[stage(compute), workgroup_size(16, 1, 1)]] +fn main([[builtin(local_invocation_id)]] gl_LocalInvocationID_param : vec3) { + gl_LocalInvocationID = gl_LocalInvocationID_param; + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl new file mode 100644 index 0000000000..f57b088e0e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl @@ -0,0 +1,64 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct doesNotMatter { + global_seed : i32; + data : RTArr; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +var gl_LocalInvocationID : vec3; + +[[group(0), binding(0)]] var x_7 : doesNotMatter; + +[[group(0), binding(1)]] var x_10 : buf1; + +fn main_1() { + var lid : i32; + var val : i32; + var i : i32; + let x_40 : u32 = gl_LocalInvocationID.x; + lid = bitcast(x_40); + let x_43 : i32 = x_7.global_seed; + val = x_43; + i = 0; + loop { + let x_48 : i32 = i; + if ((x_48 < 2)) { + } else { + break; + } + let x_51 : i32 = lid; + if ((x_51 > 0)) { + let x_55 : i32 = lid; + let x_58 : i32 = x_7.data[(x_55 - 1)]; + let x_59 : i32 = val; + val = (x_59 + x_58); + let x_62 : f32 = x_10.injectionSwitch.x; + if ((x_62 > 100.0)) { + break; + } + } + workgroupBarrier(); + + continuing { + let x_66 : i32 = i; + i = (x_66 + 1); + } + } + let x_68 : i32 = lid; + if ((x_68 == 0)) { + x_7.data[0] = 42; + } + return; +} + +[[stage(compute), workgroup_size(16, 1, 1)]] +fn main([[builtin(local_invocation_id)]] gl_LocalInvocationID_param : vec3) { + gl_LocalInvocationID = gl_LocalInvocationID_param; + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9ed54bc1f8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.hlsl @@ -0,0 +1,45 @@ +static uint3 gl_LocalInvocationID = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_7 : register(u0, space0); +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[1]; +}; + +void main_1() { + int lid = 0; + int val = 0; + int i = 0; + const uint x_40 = gl_LocalInvocationID.x; + lid = asint(x_40); + const int x_43 = asint(x_7.Load(0u)); + val = x_43; + i = 0; + { + for(; (i < 2); i = (i + 1)) { + if ((lid > 0)) { + const int x_58 = asint(x_7.Load((4u + (4u * uint((lid - 1)))))); + val = (val + x_58); + const float x_62 = asfloat(x_10[0].x); + if ((x_62 > 100.0f)) { + break; + } + } + GroupMemoryBarrierWithGroupSync(); + } + } + if ((lid == 0)) { + x_7.Store((4u + (4u * uint(0))), asuint(42)); + } + return; +} + +struct tint_symbol_1 { + uint3 gl_LocalInvocationID_param : SV_GroupThreadID; +}; + +[numthreads(16, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 gl_LocalInvocationID_param = tint_symbol.gl_LocalInvocationID_param; + gl_LocalInvocationID = gl_LocalInvocationID_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..99eb99a20b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; +struct doesNotMatter { + /* 0x0000 */ int global_seed; + /* 0x0004 */ int data[1]; +}; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; + +void main_1(constant buf1& x_10, device doesNotMatter& x_7, thread uint3* const tint_symbol_2) { + int lid = 0; + int val = 0; + int i = 0; + uint const x_40 = (*(tint_symbol_2)).x; + lid = as_type(x_40); + int const x_43 = x_7.global_seed; + val = x_43; + i = 0; + while (true) { + int const x_48 = i; + if ((x_48 < 2)) { + } else { + break; + } + int const x_51 = lid; + if ((x_51 > 0)) { + int const x_55 = lid; + int const x_58 = x_7.data[(x_55 - 1)]; + int const x_59 = val; + val = (x_59 + x_58); + float const x_62 = x_10.injectionSwitch.x; + if ((x_62 > 100.0f)) { + break; + } + } + threadgroup_barrier(mem_flags::mem_threadgroup); + { + int const x_66 = i; + i = (x_66 + 1); + } + } + int const x_68 = lid; + if ((x_68 == 0)) { + x_7.data[0] = 42; + } + return; +} + +kernel void tint_symbol(uint3 gl_LocalInvocationID_param [[thread_position_in_threadgroup]], constant buf1& x_10 [[buffer(1)]], device doesNotMatter& x_7 [[buffer(0)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = gl_LocalInvocationID_param; + main_1(x_10, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..552cb1b81b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 81 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 16 1 1 + OpName %gl_LocalInvocationID "gl_LocalInvocationID" + OpName %doesNotMatter "doesNotMatter" + OpMemberName %doesNotMatter 0 "global_seed" + OpMemberName %doesNotMatter 1 "data" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_10 "x_10" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %lid "lid" + OpName %val "val" + OpName %i "i" + OpName %main "main" + OpDecorate %doesNotMatter Block + OpMemberDecorate %doesNotMatter 0 Offset 0 + OpMemberDecorate %doesNotMatter 1 Offset 4 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol BuiltIn LocalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint +%gl_LocalInvocationID = OpVariable %_ptr_Private_v3uint Private %5 + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int +%doesNotMatter = OpTypeStruct %int %_runtimearr_int +%_ptr_StorageBuffer_doesNotMatter = OpTypePointer StorageBuffer %doesNotMatter + %x_7 = OpVariable %_ptr_StorageBuffer_doesNotMatter StorageBuffer + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_100 = OpConstant %float 100 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %int_42 = OpConstant %int 42 + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %lid = OpVariable %_ptr_Function_int Function %24 + %val = OpVariable %_ptr_Function_int Function %24 + %i = OpVariable %_ptr_Function_int Function %24 + %29 = OpAccessChain %_ptr_Private_uint %gl_LocalInvocationID %uint_0 + %30 = OpLoad %uint %29 + %31 = OpBitcast %int %30 + OpStore %lid %31 + %33 = OpAccessChain %_ptr_StorageBuffer_int %x_7 %uint_0 + %34 = OpLoad %int %33 + OpStore %val %34 + OpStore %i %int_0 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %i + %42 = OpSLessThan %bool %40 %int_2 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %37 + %44 = OpLabel + %47 = OpLoad %int %lid + %48 = OpSGreaterThan %bool %47 %int_0 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + %51 = OpLoad %int %lid + %54 = OpISub %int %51 %int_1 + %55 = OpAccessChain %_ptr_StorageBuffer_int %x_7 %uint_1 %54 + %56 = OpLoad %int %55 + %57 = OpLoad %int %val + %58 = OpIAdd %int %57 %56 + OpStore %val %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0 + %61 = OpLoad %float %60 + %63 = OpFOrdGreaterThan %bool %61 %float_100 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + OpBranch %37 + %64 = OpLabel + OpBranch %49 + %49 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %38 + %38 = OpLabel + %69 = OpLoad %int %i + %70 = OpIAdd %int %69 %int_1 + OpStore %i %70 + OpBranch %36 + %37 = OpLabel + %71 = OpLoad %int %lid + %72 = OpIEqual %bool %71 %int_0 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpAccessChain %_ptr_StorageBuffer_int %x_7 %uint_1 %int_0 + OpStore %75 %int_42 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %78 = OpLabel + %79 = OpLoad %v3uint %tint_symbol + OpStore %gl_LocalInvocationID %79 + %80 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f57b088e0e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/barrier-in-loop-with-break/0-opt.wgsl.expected.wgsl @@ -0,0 +1,64 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct doesNotMatter { + global_seed : i32; + data : RTArr; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +var gl_LocalInvocationID : vec3; + +[[group(0), binding(0)]] var x_7 : doesNotMatter; + +[[group(0), binding(1)]] var x_10 : buf1; + +fn main_1() { + var lid : i32; + var val : i32; + var i : i32; + let x_40 : u32 = gl_LocalInvocationID.x; + lid = bitcast(x_40); + let x_43 : i32 = x_7.global_seed; + val = x_43; + i = 0; + loop { + let x_48 : i32 = i; + if ((x_48 < 2)) { + } else { + break; + } + let x_51 : i32 = lid; + if ((x_51 > 0)) { + let x_55 : i32 = lid; + let x_58 : i32 = x_7.data[(x_55 - 1)]; + let x_59 : i32 = val; + val = (x_59 + x_58); + let x_62 : f32 = x_10.injectionSwitch.x; + if ((x_62 > 100.0)) { + break; + } + } + workgroupBarrier(); + + continuing { + let x_66 : i32 = i; + i = (x_66 + 1); + } + } + let x_68 : i32 = lid; + if ((x_68 == 0)) { + x_7.data[0] = 42; + } + return; +} + +[[stage(compute), workgroup_size(16, 1, 1)]] +fn main([[builtin(local_invocation_id)]] gl_LocalInvocationID_param : vec3) { + gl_LocalInvocationID = gl_LocalInvocationID_param; + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm new file mode 100644 index 0000000000..e46b7c45ef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm @@ -0,0 +1,68 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %GLF_live12c5 "GLF_live12c5" + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %14 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %false = OpConstantFalse %bool + %main = OpFunction %void None %8 + %25 = OpLabel +%GLF_live12c5 = OpVariable %_ptr_Function_bool Function + OpStore %_GLF_color %14 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %31 = OpLoad %float %30 + %32 = OpFOrdLessThan %bool %31 %float_0 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %33 + %34 = OpLabel + OpStore %GLF_live12c5 %false + %35 = OpLoad %bool %GLF_live12c5 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %28 + %37 = OpLabel + OpBranch %28 + %36 = OpLabel + OpBranch %28 + %28 = OpLabel + OpBranchConditional %false %26 %27 + %33 = OpLabel + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..896cc41376 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.hlsl @@ -0,0 +1,61 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + bool GLF_live12c5 = false; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + while (true) { + const float x_31 = asfloat(x_5[0].y); + if ((x_31 < 0.0f)) { + GLF_live12c5 = false; + if (GLF_live12c5) { + { + if (false) { + } else { + break; + } + } + continue; + } else { + { + if (false) { + } else { + break; + } + } + continue; + } + { + if (false) { + } else { + break; + } + } + continue; + } + break; + { + if (false) { + } else { + break; + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f5bdadcd3d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.msl @@ -0,0 +1,65 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + bool GLF_live12c5 = false; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + while (true) { + float const x_31 = x_5.injectionSwitch.y; + if ((x_31 < 0.0f)) { + GLF_live12c5 = false; + bool const x_35 = GLF_live12c5; + if (x_35) { + { + if (false) { + } else { + break; + } + } + continue; + } else { + { + if (false) { + } else { + break; + } + } + continue; + } + { + if (false) { + } else { + break; + } + } + continue; + } + break; + { + if (false) { + } else { + break; + } + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..84e6acaad7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.spvasm @@ -0,0 +1,113 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %GLF_live12c5 "GLF_live12c5" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %19 = OpConstantNull %bool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel +%GLF_live12c5 = OpVariable %_ptr_Function_bool Function %19 + OpStore %x_GLF_color %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %31 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %32 = OpLoad %float %31 + %33 = OpFOrdLessThan %bool %32 %float_0 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + OpStore %GLF_live12c5 %false + %37 = OpLoad %bool %GLF_live12c5 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %40 + %39 = OpLabel + OpBranch %25 + %40 = OpLabel + OpBranch %25 + %38 = OpLabel + OpBranch %25 + %34 = OpLabel + OpBranch %24 + %25 = OpLabel + OpSelectionMerge %41 None + OpBranchConditional %false %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %24 + %41 = OpLabel + OpBranch %23 + %24 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %44 +%tint_symbol = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %51 = OpLabel + %52 = OpFunctionCall %void %main_1 + %54 = OpLoad %v4float %x_GLF_color + %55 = OpCompositeConstruct %main_out %54 + %53 = OpFunctionCall %void %tint_symbol_2 %55 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 25[%25] is not post dominated by the back-edge block 41[%41] + %41 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..4e7bacdf18 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.spvasm.expected.wgsl @@ -0,0 +1,46 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var GLF_live12c5 : bool; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + loop { + let x_31 : f32 = x_5.injectionSwitch.y; + if ((x_31 < 0.0)) { + GLF_live12c5 = false; + let x_35 : bool = GLF_live12c5; + if (x_35) { + continue; + } else { + continue; + } + continue; + } + break; + + continuing { + if (false) { + } else { + break; + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl new file mode 100644 index 0000000000..4e7bacdf18 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl @@ -0,0 +1,46 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var GLF_live12c5 : bool; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + loop { + let x_31 : f32 = x_5.injectionSwitch.y; + if ((x_31 < 0.0)) { + GLF_live12c5 = false; + let x_35 : bool = GLF_live12c5; + if (x_35) { + continue; + } else { + continue; + } + continue; + } + break; + + continuing { + if (false) { + } else { + break; + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..896cc41376 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.hlsl @@ -0,0 +1,61 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + bool GLF_live12c5 = false; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + while (true) { + const float x_31 = asfloat(x_5[0].y); + if ((x_31 < 0.0f)) { + GLF_live12c5 = false; + if (GLF_live12c5) { + { + if (false) { + } else { + break; + } + } + continue; + } else { + { + if (false) { + } else { + break; + } + } + continue; + } + { + if (false) { + } else { + break; + } + } + continue; + } + break; + { + if (false) { + } else { + break; + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f5bdadcd3d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.msl @@ -0,0 +1,65 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + bool GLF_live12c5 = false; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + while (true) { + float const x_31 = x_5.injectionSwitch.y; + if ((x_31 < 0.0f)) { + GLF_live12c5 = false; + bool const x_35 = GLF_live12c5; + if (x_35) { + { + if (false) { + } else { + break; + } + } + continue; + } else { + { + if (false) { + } else { + break; + } + } + continue; + } + { + if (false) { + } else { + break; + } + } + continue; + } + break; + { + if (false) { + } else { + break; + } + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..84e6acaad7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.spvasm @@ -0,0 +1,113 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %GLF_live12c5 "GLF_live12c5" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %19 = OpConstantNull %bool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel +%GLF_live12c5 = OpVariable %_ptr_Function_bool Function %19 + OpStore %x_GLF_color %22 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %31 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %32 = OpLoad %float %31 + %33 = OpFOrdLessThan %bool %32 %float_0 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + OpStore %GLF_live12c5 %false + %37 = OpLoad %bool %GLF_live12c5 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %40 + %39 = OpLabel + OpBranch %25 + %40 = OpLabel + OpBranch %25 + %38 = OpLabel + OpBranch %25 + %34 = OpLabel + OpBranch %24 + %25 = OpLabel + OpSelectionMerge %41 None + OpBranchConditional %false %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %24 + %41 = OpLabel + OpBranch %23 + %24 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %44 +%tint_symbol = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %51 = OpLabel + %52 = OpFunctionCall %void %main_1 + %54 = OpLoad %v4float %x_GLF_color + %55 = OpCompositeConstruct %main_out %54 + %53 = OpFunctionCall %void %tint_symbol_2 %55 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 25[%25] is not post dominated by the back-edge block 41[%41] + %41 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..4e7bacdf18 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/break-in-do-while-with-nested-if/0-opt.wgsl.expected.wgsl @@ -0,0 +1,46 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var GLF_live12c5 : bool; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + loop { + let x_31 : f32 = x_5.injectionSwitch.y; + if ((x_31 < 0.0)) { + GLF_live12c5 = false; + let x_35 : bool = GLF_live12c5; + if (x_35) { + continue; + } else { + continue; + } + continue; + } + break; + + continuing { + if (false) { + } else { + break; + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm new file mode 100644 index 0000000000..d6c3f4709f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm @@ -0,0 +1,59 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %8 + %22 = OpLabel + OpStore %_GLF_color %19 + OpBranch %23 + %23 = OpLabel + %24 = OpFunctionCall %void %func_ + OpLoopMerge %25 %23 None + OpBranchConditional %false %23 %25 + %25 = OpLabel + OpStore %_GLF_color %21 + OpReturn + OpFunctionEnd + %func_ = OpFunction %void None %8 + %26 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %28 = OpLoad %float %27 + %29 = OpFOrdGreaterThan %bool %float_1 %28 + OpSelectionMerge %30 None + OpBranchConditional %29 %31 %30 + %31 = OpLabel + OpKill + %30 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..993c3df255 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.hlsl @@ -0,0 +1,39 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_() { + const float x_28 = asfloat(x_6[0].x); + if ((1.0f > x_28)) { + discard; + } + return; +} + +void main_1() { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + while (true) { + func_(); + if (false) { + } else { + break; + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..54b06ad781 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_(constant buf0& x_6) { + float const x_28 = x_6.one; + if ((1.0f > x_28)) { + discard_fragment(); + } + return; +} + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + while (true) { + func_(x_6); + if (false) { + } else { + break; + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..5378d7495f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %39 = OpTypeFunction %void %main_out + %func_ = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %19 = OpLoad %float %18 + %21 = OpFOrdGreaterThan %bool %float_1 %19 + OpSelectionMerge %23 None + OpBranchConditional %21 %24 %23 + %24 = OpLabel + OpKill + %23 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %11 + %26 = OpLabel + OpStore %x_GLF_color %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpFunctionCall %void %func_ + OpSelectionMerge %35 None + OpBranchConditional %false %36 %37 + %36 = OpLabel + OpBranch %35 + %37 = OpLabel + OpBranch %30 + %35 = OpLabel + OpBranch %31 + %31 = OpLabel + OpBranch %29 + %30 = OpLabel + OpStore %x_GLF_color %38 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %39 +%tint_symbol = OpFunctionParameter %main_out + %43 = OpLabel + %44 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %44 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %46 = OpLabel + %47 = OpFunctionCall %void %main_1 + %49 = OpLoad %v4float %x_GLF_color + %50 = OpCompositeConstruct %main_out %49 + %48 = OpFunctionCall %void %tint_symbol_2 %50 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..64f1aaacdc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn func_() { + let x_28 : f32 = x_6.one; + if ((1.0 > x_28)) { + discard; + } + return; +} + +fn main_1() { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + loop { + func_(); + if (false) { + } else { + break; + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl new file mode 100644 index 0000000000..64f1aaacdc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn func_() { + let x_28 : f32 = x_6.one; + if ((1.0 > x_28)) { + discard; + } + return; +} + +fn main_1() { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + loop { + func_(); + if (false) { + } else { + break; + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..993c3df255 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.hlsl @@ -0,0 +1,39 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_() { + const float x_28 = asfloat(x_6[0].x); + if ((1.0f > x_28)) { + discard; + } + return; +} + +void main_1() { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + while (true) { + func_(); + if (false) { + } else { + break; + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..54b06ad781 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_(constant buf0& x_6) { + float const x_28 = x_6.one; + if ((1.0f > x_28)) { + discard_fragment(); + } + return; +} + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + while (true) { + func_(x_6); + if (false) { + } else { + break; + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5378d7495f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %39 = OpTypeFunction %void %main_out + %func_ = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %19 = OpLoad %float %18 + %21 = OpFOrdGreaterThan %bool %float_1 %19 + OpSelectionMerge %23 None + OpBranchConditional %21 %24 %23 + %24 = OpLabel + OpKill + %23 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %11 + %26 = OpLabel + OpStore %x_GLF_color %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpFunctionCall %void %func_ + OpSelectionMerge %35 None + OpBranchConditional %false %36 %37 + %36 = OpLabel + OpBranch %35 + %37 = OpLabel + OpBranch %30 + %35 = OpLabel + OpBranch %31 + %31 = OpLabel + OpBranch %29 + %30 = OpLabel + OpStore %x_GLF_color %38 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %39 +%tint_symbol = OpFunctionParameter %main_out + %43 = OpLabel + %44 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %44 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %46 = OpLabel + %47 = OpFunctionCall %void %main_1 + %49 = OpLoad %v4float %x_GLF_color + %50 = OpCompositeConstruct %main_out %49 + %48 = OpFunctionCall %void %tint_symbol_2 %50 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..64f1aaacdc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn func_() { + let x_28 : f32 = x_6.one; + if ((1.0 > x_28)) { + discard; + } + return; +} + +fn main_1() { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + loop { + func_(); + if (false) { + } else { + break; + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm new file mode 100644 index 0000000000..07f5e01b17 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm @@ -0,0 +1,93 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %data "data" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %data RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %int_2 = OpConstant %int 2 + %main = OpFunction %void None %13 + %36 = OpLabel + %data = OpVariable %_ptr_Function__arr_int_uint_10 Function + %37 = OpAccessChain %_ptr_Function_int %data %int_1 + %7 = OpLoad %int %37 + %38 = OpSLessThan %bool %int_1 %7 + %10 = OpSelect %int %38 %int_2 %int_1 + OpBranch %39 + %39 = OpLabel + %40 = OpPhi %int %int_1 %36 %41 %42 + %11 = OpPhi %int %10 %36 %8 %42 + %43 = OpSLessThan %bool %11 %int_3 + OpLoopMerge %44 %42 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + %8 = OpIAdd %int %11 %int_1 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %47 = OpLoad %float %46 + %48 = OpConvertFToS %int %47 + OpSelectionMerge %49 None + OpSwitch %48 %50 19 %51 38 %52 23 %52 78 %53 + %50 = OpLabel + OpBranch %42 + %51 = OpLabel + %9 = OpIAdd %int %40 %int_1 + OpBranch %52 + %52 = OpLabel + %54 = OpPhi %int %40 %45 %9 %51 + OpBranch %42 + %53 = OpLabel + OpStore %_GLF_color %31 + OpBranch %50 + %49 = OpLabel + OpBranch %42 + %42 = OpLabel + %41 = OpPhi %int %40 %50 %54 %52 %int_0 %49 + OpBranch %39 + %44 = OpLabel + %55 = OpAccessChain %_ptr_Function_int %data %40 + OpStore %55 %int_1 + OpStore %_GLF_color %33 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..1dab6f0c01 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.hlsl @@ -0,0 +1,85 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int data[10] = (int[10])0; + int x_40 = 0; + int x_40_phi = 0; + int x_11_phi = 0; + const int x_7 = data[1]; + const int x_10 = ((1 < x_7) ? 2 : 1); + x_40_phi = 1; + x_11_phi = x_10; + while (true) { + int x_54 = 0; + int x_41 = 0; + int x_41_phi = 0; + x_40 = x_40_phi; + const int x_11 = x_11_phi; + if ((x_11 < 3)) { + } else { + break; + } + int x_54_phi = 0; + const int x_8 = (x_11 + 1); + const float x_47 = asfloat(x_6[0].x); + x_54_phi = x_40; + switch(int(x_47)) { + case 78: { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + /* fallthrough */ + } + case 19: { + x_54_phi = asint((x_40 + asint(1))); + /* fallthrough */ + } + case 23: + case 38: { + x_54 = x_54_phi; + x_41_phi = x_54; + { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + continue; + break; + } + default: { + x_41_phi = x_40; + { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + continue; + break; + } + } + x_41_phi = 0; + { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + } + data[x_40] = 1; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..1063af21fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + tint_array_wrapper data = {}; + int x_40 = 0; + int x_40_phi = 0; + int x_11_phi = 0; + int const x_7 = data.arr[1]; + int const x_10 = select(1, 2, (1 < x_7)); + x_40_phi = 1; + x_11_phi = x_10; + while (true) { + int x_54 = 0; + int x_41 = 0; + int x_41_phi = 0; + x_40 = x_40_phi; + int const x_11 = x_11_phi; + if ((x_11 < 3)) { + } else { + break; + } + int x_54_phi = 0; + int const x_8 = (x_11 + 1); + float const x_47 = x_6.injectionSwitch.x; + x_54_phi = x_40; + switch(int(x_47)) { + case 78: { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + /* fallthrough */ + } + case 19: { + x_54_phi = as_type((x_40 + as_type(1))); + /* fallthrough */ + } + case 23: + case 38: { + x_54 = x_54_phi; + x_41_phi = x_54; + { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + continue; + break; + } + default: { + x_41_phi = x_40; + { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + continue; + break; + } + } + x_41_phi = 0; + { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + } + data.arr[x_40] = 1; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..556a05f25d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.spvasm @@ -0,0 +1,162 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 90 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %data "data" + OpName %x_40 "x_40" + OpName %x_40_phi "x_40_phi" + OpName %x_11_phi "x_11_phi" + OpName %x_54 "x_54" + OpName %x_41 "x_41" + OpName %x_41_phi "x_41_phi" + OpName %x_54_phi "x_54_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %22 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %63 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %77 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %78 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %data = OpVariable %_ptr_Function__arr_int_uint_10 Function %22 + %x_40 = OpVariable %_ptr_Function_int Function %25 + %x_40_phi = OpVariable %_ptr_Function_int Function %25 + %x_11_phi = OpVariable %_ptr_Function_int Function %25 + %x_54 = OpVariable %_ptr_Function_int Function %25 + %x_41 = OpVariable %_ptr_Function_int Function %25 + %x_41_phi = OpVariable %_ptr_Function_int Function %25 + %x_54_phi = OpVariable %_ptr_Function_int Function %25 + %29 = OpAccessChain %_ptr_Function_int %data %int_1 + %30 = OpLoad %int %29 + %32 = OpSLessThan %bool %int_1 %30 + %31 = OpSelect %int %32 %int_2 %int_1 + OpStore %x_40_phi %int_1 + OpStore %x_11_phi %31 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %42 = OpLoad %int %x_40_phi + OpStore %x_40 %42 + %43 = OpLoad %int %x_11_phi + %45 = OpSLessThan %bool %43 %int_3 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %36 + %46 = OpLabel + %50 = OpIAdd %int %43 %int_1 + %53 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %54 = OpLoad %float %53 + %55 = OpLoad %int %x_40 + OpStore %x_54_phi %55 + %57 = OpConvertFToS %int %54 + OpSelectionMerge %56 None + OpSwitch %57 %58 78 %59 19 %60 23 %61 38 %61 + %59 = OpLabel + OpStore %x_GLF_color %63 + OpBranch %60 + %60 = OpLabel + %65 = OpLoad %int %x_40 + %66 = OpCopyObject %int %int_1 + %67 = OpIAdd %int %65 %66 + %64 = OpCopyObject %int %67 + OpStore %x_54_phi %64 + OpBranch %61 + %61 = OpLabel + %68 = OpLoad %int %x_54_phi + OpStore %x_54 %68 + %69 = OpLoad %int %x_54 + OpStore %x_41_phi %69 + OpBranch %37 + %58 = OpLabel + %70 = OpLoad %int %x_40 + OpStore %x_41_phi %70 + OpBranch %37 + %56 = OpLabel + OpStore %x_41_phi %int_0 + OpBranch %37 + %37 = OpLabel + %72 = OpLoad %int %x_41_phi + OpStore %x_41 %72 + %73 = OpLoad %int %x_41 + OpStore %x_40_phi %73 + OpStore %x_11_phi %50 + OpBranch %35 + %36 = OpLabel + %74 = OpLoad %int %x_40 + %75 = OpAccessChain %_ptr_Function_int %data %74 + OpStore %75 %int_1 + OpStore %x_GLF_color %77 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %78 +%tint_symbol = OpFunctionParameter %main_out + %82 = OpLabel + %83 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %83 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %85 = OpLabel + %86 = OpFunctionCall %void %main_1 + %88 = OpLoad %v4float %x_GLF_color + %89 = OpCompositeConstruct %main_out %88 + %87 = OpFunctionCall %void %tint_symbol_2 %89 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..e49880e84d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.wgsl @@ -0,0 +1,74 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var x_40 : i32; + var x_40_phi : i32; + var x_11_phi : i32; + let x_7 : i32 = data[1]; + let x_10 : i32 = select(1, 2, (1 < x_7)); + x_40_phi = 1; + x_11_phi = x_10; + loop { + var x_54 : i32; + var x_41 : i32; + var x_41_phi : i32; + x_40 = x_40_phi; + let x_11 : i32 = x_11_phi; + if ((x_11 < 3)) { + } else { + break; + } + var x_54_phi : i32; + let x_8 : i32 = (x_11 + 1); + let x_47 : f32 = x_6.injectionSwitch.x; + x_54_phi = x_40; + switch(i32(x_47)) { + case 78: { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + fallthrough; + } + case 19: { + x_54_phi = bitcast((x_40 + bitcast(1))); + fallthrough; + } + case 23, 38: { + x_54 = x_54_phi; + x_41_phi = x_54; + continue; + } + default: { + x_41_phi = x_40; + continue; + } + } + x_41_phi = 0; + + continuing { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + } + data[x_40] = 1; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl new file mode 100644 index 0000000000..e49880e84d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl @@ -0,0 +1,74 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var x_40 : i32; + var x_40_phi : i32; + var x_11_phi : i32; + let x_7 : i32 = data[1]; + let x_10 : i32 = select(1, 2, (1 < x_7)); + x_40_phi = 1; + x_11_phi = x_10; + loop { + var x_54 : i32; + var x_41 : i32; + var x_41_phi : i32; + x_40 = x_40_phi; + let x_11 : i32 = x_11_phi; + if ((x_11 < 3)) { + } else { + break; + } + var x_54_phi : i32; + let x_8 : i32 = (x_11 + 1); + let x_47 : f32 = x_6.injectionSwitch.x; + x_54_phi = x_40; + switch(i32(x_47)) { + case 78: { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + fallthrough; + } + case 19: { + x_54_phi = bitcast((x_40 + bitcast(1))); + fallthrough; + } + case 23, 38: { + x_54 = x_54_phi; + x_41_phi = x_54; + continue; + } + default: { + x_41_phi = x_40; + continue; + } + } + x_41_phi = 0; + + continuing { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + } + data[x_40] = 1; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..1dab6f0c01 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.hlsl @@ -0,0 +1,85 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int data[10] = (int[10])0; + int x_40 = 0; + int x_40_phi = 0; + int x_11_phi = 0; + const int x_7 = data[1]; + const int x_10 = ((1 < x_7) ? 2 : 1); + x_40_phi = 1; + x_11_phi = x_10; + while (true) { + int x_54 = 0; + int x_41 = 0; + int x_41_phi = 0; + x_40 = x_40_phi; + const int x_11 = x_11_phi; + if ((x_11 < 3)) { + } else { + break; + } + int x_54_phi = 0; + const int x_8 = (x_11 + 1); + const float x_47 = asfloat(x_6[0].x); + x_54_phi = x_40; + switch(int(x_47)) { + case 78: { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + /* fallthrough */ + } + case 19: { + x_54_phi = asint((x_40 + asint(1))); + /* fallthrough */ + } + case 23: + case 38: { + x_54 = x_54_phi; + x_41_phi = x_54; + { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + continue; + break; + } + default: { + x_41_phi = x_40; + { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + continue; + break; + } + } + x_41_phi = 0; + { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + } + data[x_40] = 1; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..1063af21fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + tint_array_wrapper data = {}; + int x_40 = 0; + int x_40_phi = 0; + int x_11_phi = 0; + int const x_7 = data.arr[1]; + int const x_10 = select(1, 2, (1 < x_7)); + x_40_phi = 1; + x_11_phi = x_10; + while (true) { + int x_54 = 0; + int x_41 = 0; + int x_41_phi = 0; + x_40 = x_40_phi; + int const x_11 = x_11_phi; + if ((x_11 < 3)) { + } else { + break; + } + int x_54_phi = 0; + int const x_8 = (x_11 + 1); + float const x_47 = x_6.injectionSwitch.x; + x_54_phi = x_40; + switch(int(x_47)) { + case 78: { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + /* fallthrough */ + } + case 19: { + x_54_phi = as_type((x_40 + as_type(1))); + /* fallthrough */ + } + case 23: + case 38: { + x_54 = x_54_phi; + x_41_phi = x_54; + { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + continue; + break; + } + default: { + x_41_phi = x_40; + { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + continue; + break; + } + } + x_41_phi = 0; + { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + } + data.arr[x_40] = 1; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..556a05f25d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.spvasm @@ -0,0 +1,162 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 90 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %data "data" + OpName %x_40 "x_40" + OpName %x_40_phi "x_40_phi" + OpName %x_11_phi "x_11_phi" + OpName %x_54 "x_54" + OpName %x_41 "x_41" + OpName %x_41_phi "x_41_phi" + OpName %x_54_phi "x_54_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %22 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %63 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %77 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %78 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %data = OpVariable %_ptr_Function__arr_int_uint_10 Function %22 + %x_40 = OpVariable %_ptr_Function_int Function %25 + %x_40_phi = OpVariable %_ptr_Function_int Function %25 + %x_11_phi = OpVariable %_ptr_Function_int Function %25 + %x_54 = OpVariable %_ptr_Function_int Function %25 + %x_41 = OpVariable %_ptr_Function_int Function %25 + %x_41_phi = OpVariable %_ptr_Function_int Function %25 + %x_54_phi = OpVariable %_ptr_Function_int Function %25 + %29 = OpAccessChain %_ptr_Function_int %data %int_1 + %30 = OpLoad %int %29 + %32 = OpSLessThan %bool %int_1 %30 + %31 = OpSelect %int %32 %int_2 %int_1 + OpStore %x_40_phi %int_1 + OpStore %x_11_phi %31 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %42 = OpLoad %int %x_40_phi + OpStore %x_40 %42 + %43 = OpLoad %int %x_11_phi + %45 = OpSLessThan %bool %43 %int_3 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %36 + %46 = OpLabel + %50 = OpIAdd %int %43 %int_1 + %53 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %54 = OpLoad %float %53 + %55 = OpLoad %int %x_40 + OpStore %x_54_phi %55 + %57 = OpConvertFToS %int %54 + OpSelectionMerge %56 None + OpSwitch %57 %58 78 %59 19 %60 23 %61 38 %61 + %59 = OpLabel + OpStore %x_GLF_color %63 + OpBranch %60 + %60 = OpLabel + %65 = OpLoad %int %x_40 + %66 = OpCopyObject %int %int_1 + %67 = OpIAdd %int %65 %66 + %64 = OpCopyObject %int %67 + OpStore %x_54_phi %64 + OpBranch %61 + %61 = OpLabel + %68 = OpLoad %int %x_54_phi + OpStore %x_54 %68 + %69 = OpLoad %int %x_54 + OpStore %x_41_phi %69 + OpBranch %37 + %58 = OpLabel + %70 = OpLoad %int %x_40 + OpStore %x_41_phi %70 + OpBranch %37 + %56 = OpLabel + OpStore %x_41_phi %int_0 + OpBranch %37 + %37 = OpLabel + %72 = OpLoad %int %x_41_phi + OpStore %x_41 %72 + %73 = OpLoad %int %x_41 + OpStore %x_40_phi %73 + OpStore %x_11_phi %50 + OpBranch %35 + %36 = OpLabel + %74 = OpLoad %int %x_40 + %75 = OpAccessChain %_ptr_Function_int %data %74 + OpStore %75 %int_1 + OpStore %x_GLF_color %77 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %78 +%tint_symbol = OpFunctionParameter %main_out + %82 = OpLabel + %83 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %83 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %85 = OpLabel + %86 = OpFunctionCall %void %main_1 + %88 = OpLoad %v4float %x_GLF_color + %89 = OpCompositeConstruct %main_out %88 + %87 = OpFunctionCall %void %tint_symbol_2 %89 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..e49880e84d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.wgsl @@ -0,0 +1,74 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var x_40 : i32; + var x_40_phi : i32; + var x_11_phi : i32; + let x_7 : i32 = data[1]; + let x_10 : i32 = select(1, 2, (1 < x_7)); + x_40_phi = 1; + x_11_phi = x_10; + loop { + var x_54 : i32; + var x_41 : i32; + var x_41_phi : i32; + x_40 = x_40_phi; + let x_11 : i32 = x_11_phi; + if ((x_11 < 3)) { + } else { + break; + } + var x_54_phi : i32; + let x_8 : i32 = (x_11 + 1); + let x_47 : f32 = x_6.injectionSwitch.x; + x_54_phi = x_40; + switch(i32(x_47)) { + case 78: { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + fallthrough; + } + case 19: { + x_54_phi = bitcast((x_40 + bitcast(1))); + fallthrough; + } + case 23, 38: { + x_54 = x_54_phi; + x_41_phi = x_54; + continue; + } + default: { + x_41_phi = x_40; + continue; + } + } + x_41_phi = 0; + + continuing { + x_41 = x_41_phi; + x_40_phi = x_41; + x_11_phi = x_8; + } + } + data[x_40] = 1; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm new file mode 100644 index 0000000000..79f78a20be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm @@ -0,0 +1,62 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %7 + %24 = OpLabel + %25 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %26 = OpLoad %float %25 + %27 = OpFOrdGreaterThan %bool %26 %float_1 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %28 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + OpBranch %34 + %34 = OpLabel + OpStore %_GLF_color %22 + OpBranch %32 + %32 = OpLabel + OpBranch %30 + %31 = OpLabel + OpUnreachable + %28 = OpLabel + OpStore %_GLF_color %23 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.hlsl new file mode 100755 index 0000000000..4f12524597 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_26 = asfloat(x_5[0].x); + if ((x_26 > 1.0f)) { + while (true) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} +error: validation errors +T:\tmp\u2wg.0:25: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..7bf030e374 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float const x_26 = x_5.injectionSwitch.x; + if ((x_26 > 1.0f)) { + while (true) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..5ae61bca5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %31 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %33 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %20 = OpLoad %float %19 + %22 = OpFOrdGreaterThan %bool %20 %float_1 + OpSelectionMerge %24 None + OpBranchConditional %22 %25 %24 + %25 = OpLabel + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %28 + %28 = OpLabel + OpBranch %26 + %27 = OpLabel + OpReturn + %24 = OpLabel + OpStore %x_GLF_color %32 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %33 +%tint_symbol = OpFunctionParameter %main_out + %37 = OpLabel + %38 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %38 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %40 = OpLabel + %41 = OpFunctionCall %void %main_1 + %43 = OpLoad %v4float %x_GLF_color + %44 = OpCompositeConstruct %main_out %43 + %42 = OpFunctionCall %void %tint_symbol_2 %44 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..1d247e75b8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,31 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_26 : f32 = x_5.injectionSwitch.x; + if ((x_26 > 1.0)) { + loop { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl new file mode 100644 index 0000000000..1d247e75b8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl @@ -0,0 +1,31 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_26 : f32 = x_5.injectionSwitch.x; + if ((x_26 > 1.0)) { + loop { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.hlsl new file mode 100755 index 0000000000..a19c1f6a35 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,38 @@ +SKIP: FAILED + +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_26 = asfloat(x_5[0].x); + if ((x_26 > 1.0f)) { + while (true) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} +error: validation errors +T:\tmp\uc0s.0:25: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..7bf030e374 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float const x_26 = x_5.injectionSwitch.x; + if ((x_26 > 1.0f)) { + while (true) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5ae61bca5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %31 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %33 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %20 = OpLoad %float %19 + %22 = OpFOrdGreaterThan %bool %20 %float_1 + OpSelectionMerge %24 None + OpBranchConditional %22 %25 %24 + %25 = OpLabel + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %28 + %28 = OpLabel + OpBranch %26 + %27 = OpLabel + OpReturn + %24 = OpLabel + OpStore %x_GLF_color %32 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %33 +%tint_symbol = OpFunctionParameter %main_out + %37 = OpLabel + %38 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %38 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %40 = OpLabel + %41 = OpFunctionCall %void %main_1 + %43 = OpLoad %v4float %x_GLF_color + %44 = OpCompositeConstruct %main_out %43 + %42 = OpFunctionCall %void %tint_symbol_2 %44 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..1d247e75b8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,31 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_26 : f32 = x_5.injectionSwitch.x; + if ((x_26 > 1.0)) { + loop { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm new file mode 100644 index 0000000000..4154ff33a1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm @@ -0,0 +1,100 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %S "S" + OpMemberName %S 0 "f0" + OpMemberName %S 1 "f1" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %S 0 RelaxedPrecision + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %S = OpTypeStruct %int %mat4v3float + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %23 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %24 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %25 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %26 = OpConstantComposite %mat4v3float %22 %23 %24 %25 + %27 = OpConstantComposite %S %int_0 %26 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %37 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int_1000 = OpConstant %int 1000 + %39 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %14 + %40 = OpLabel + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpPhi %S %27 %41 %46 %47 + %11 = OpPhi %int %int_0 %41 %9 %47 + %48 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %49 = OpLoad %float %48 + %50 = OpFOrdEqual %bool %49 %float_0 + %51 = OpSelect %int %50 %int_1 %int_2 + %52 = OpSLessThan %bool %11 %51 + OpLoopMerge %53 %47 None + OpBranchConditional %52 %47 %53 + %47 = OpLabel + OpStore %_GLF_color %37 + %7 = OpCompositeExtract %int %45 0 + %8 = OpIAdd %int %7 %int_1 + %46 = OpCompositeInsert %S %8 %45 0 + %9 = OpIAdd %int %11 %int_1 + OpBranch %44 + %53 = OpLabel + %10 = OpCompositeExtract %int %45 0 + %54 = OpSLessThan %bool %10 %int_1000 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + OpBranch %42 + %55 = OpLabel + OpBranch %42 + %43 = OpLabel + OpBranch %41 + %42 = OpLabel + OpBranch %57 + %57 = OpLabel + %12 = OpPhi %int %int_0 %42 %6 %58 + %59 = OpSLessThan %bool %12 %51 + OpLoopMerge %60 %58 None + OpBranchConditional %59 %58 %60 + %58 = OpLabel + OpStore %_GLF_color %39 + %6 = OpIAdd %int %12 %int_1 + OpBranch %57 + %60 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..f98d1d7f3a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.hlsl @@ -0,0 +1,78 @@ +struct S { + int f0; + float4x3 f1; +}; + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_51 = 0; + int x_12_phi = 0; + while (true) { + S x_45 = (S)0; + S x_45_phi = (S)0; + int x_11_phi = 0; + const S tint_symbol_4 = {0, float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f))}; + x_45_phi = tint_symbol_4; + x_11_phi = 0; + while (true) { + S x_46 = (S)0; + int x_9 = 0; + x_45 = x_45_phi; + const int x_11 = x_11_phi; + const float x_49 = gl_FragCoord.x; + x_51 = ((x_49 == 0.0f) ? 1 : 2); + if ((x_11 < x_51)) { + } else { + break; + } + { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + x_46 = x_45; + x_46.f0 = (x_45.f0 + 1); + x_9 = (x_11 + 1); + x_45_phi = x_46; + x_11_phi = x_9; + } + } + if ((x_45.f0 < 1000)) { + break; + } + break; + } + x_12_phi = 0; + while (true) { + int x_6 = 0; + const int x_12 = x_12_phi; + if ((x_12 < x_51)) { + } else { + break; + } + { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_6 = (x_12 + 1); + x_12_phi = x_6; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.msl new file mode 100644 index 0000000000..734666e7de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.msl @@ -0,0 +1,76 @@ +#include + +using namespace metal; +struct S { + int f0; + float4x3 f1; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int x_51 = 0; + int x_12_phi = 0; + while (true) { + S x_45 = {}; + S x_45_phi = {}; + int x_11_phi = 0; + S const tint_symbol_4 = {.f0=0, .f1=float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f))}; + x_45_phi = tint_symbol_4; + x_11_phi = 0; + while (true) { + S x_46 = {}; + int x_9 = 0; + x_45 = x_45_phi; + int const x_11 = x_11_phi; + float const x_49 = (*(tint_symbol_6)).x; + x_51 = select(2, 1, (x_49 == 0.0f)); + if ((x_11 < x_51)) { + } else { + break; + } + { + *(tint_symbol_7) = float4(1.0f, 1.0f, 1.0f, 1.0f); + x_46 = x_45; + x_46.f0 = (x_45.f0 + 1); + x_9 = (x_11 + 1); + x_45_phi = x_46; + x_11_phi = x_9; + } + } + if ((x_45.f0 < 1000)) { + break; + } + break; + } + x_12_phi = 0; + while (true) { + int x_6 = 0; + int const x_12 = x_12_phi; + if ((x_12 < x_51)) { + } else { + break; + } + { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_6 = (x_12 + 1); + x_12_phi = x_6; + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..c5af5adb7e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.spvasm @@ -0,0 +1,190 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 106 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_51 "x_51" + OpName %x_12_phi "x_12_phi" + OpName %S "S" + OpMemberName %S 0 "f0" + OpMemberName %S 1 "f1" + OpName %x_45 "x_45" + OpName %x_45_phi "x_45_phi" + OpName %x_11_phi "x_11_phi" + OpName %x_46 "x_46" + OpName %x_9 "x_9" + OpName %x_6 "x_6" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 16 + OpMemberDecorate %S 1 ColMajor + OpMemberDecorate %S 1 MatrixStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %S = OpTypeStruct %int %mat4v3float +%_ptr_Function_S = OpTypePointer Function %S + %29 = OpConstantNull %S + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %35 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %36 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %37 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %38 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %39 = OpConstantComposite %mat4v3float %35 %36 %37 %38 + %40 = OpConstantComposite %S %int_0 %39 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %64 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int_1000 = OpConstant %int 1000 + %90 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %93 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_51 = OpVariable %_ptr_Function_int Function %18 + %x_12_phi = OpVariable %_ptr_Function_int Function %18 + %x_45 = OpVariable %_ptr_Function_S Function %29 + %x_45_phi = OpVariable %_ptr_Function_S Function %29 + %x_11_phi = OpVariable %_ptr_Function_int Function %18 + %x_46 = OpVariable %_ptr_Function_S Function %29 + %x_9 = OpVariable %_ptr_Function_int Function %18 + %x_6 = OpVariable %_ptr_Function_int Function %18 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + OpStore %x_45_phi %40 + OpStore %x_11_phi %int_0 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %47 = OpLoad %S %x_45_phi + OpStore %x_45 %47 + %48 = OpLoad %int %x_11_phi + %52 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %53 = OpLoad %float %52 + %55 = OpFOrdEqual %bool %53 %float_0 + %54 = OpSelect %int %55 %int_1 %int_2 + OpStore %x_51 %54 + %59 = OpLoad %int %x_51 + %60 = OpSLessThan %bool %48 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %42 + %61 = OpLabel + OpBranch %43 + %43 = OpLabel + OpStore %x_GLF_color %64 + %65 = OpLoad %S %x_45 + OpStore %x_46 %65 + %66 = OpAccessChain %_ptr_Function_int %x_46 %uint_0 + %67 = OpAccessChain %_ptr_Function_int %x_45 %uint_0 + %68 = OpLoad %int %67 + %69 = OpIAdd %int %68 %int_1 + OpStore %66 %69 + %70 = OpIAdd %int %48 %int_1 + OpStore %x_9 %70 + %71 = OpLoad %S %x_46 + OpStore %x_45_phi %71 + %72 = OpLoad %int %x_9 + OpStore %x_11_phi %72 + OpBranch %41 + %42 = OpLabel + %73 = OpAccessChain %_ptr_Function_int %x_45 %uint_0 + %74 = OpLoad %int %73 + %76 = OpSLessThan %bool %74 %int_1000 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + OpBranch %21 + %77 = OpLabel + OpBranch %21 + %22 = OpLabel + OpBranch %20 + %21 = OpLabel + OpStore %x_12_phi %int_0 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %84 = OpLoad %int %x_12_phi + %85 = OpLoad %int %x_51 + %86 = OpSLessThan %bool %84 %85 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %89 + %88 = OpLabel + OpBranch %87 + %89 = OpLabel + OpBranch %80 + %87 = OpLabel + OpBranch %81 + %81 = OpLabel + OpStore %x_GLF_color %90 + %91 = OpIAdd %int %84 %int_1 + OpStore %x_6 %91 + %92 = OpLoad %int %x_6 + OpStore %x_12_phi %92 + OpBranch %79 + %80 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %93 +%tint_symbol_1 = OpFunctionParameter %main_out + %97 = OpLabel + %98 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %98 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %100 = OpLabel + %101 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %101 + %102 = OpFunctionCall %void %main_1 + %104 = OpLoad %v4float %x_GLF_color + %105 = OpCompositeConstruct %main_out %104 + %103 = OpFunctionCall %void %tint_symbol_3 %105 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..088c0f824a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.spvasm.expected.wgsl @@ -0,0 +1,73 @@ +struct S { + f0 : i32; + f1 : mat4x3; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var x_51 : i32; + var x_12_phi : i32; + loop { + var x_45 : S; + var x_45_phi : S; + var x_11_phi : i32; + x_45_phi = S(0, mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0))); + x_11_phi = 0; + loop { + var x_46 : S; + var x_9 : i32; + x_45 = x_45_phi; + let x_11 : i32 = x_11_phi; + let x_49 : f32 = gl_FragCoord.x; + x_51 = select(2, 1, (x_49 == 0.0)); + if ((x_11 < x_51)) { + } else { + break; + } + + continuing { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + x_46 = x_45; + x_46.f0 = (x_45.f0 + 1); + x_9 = (x_11 + 1); + x_45_phi = x_46; + x_11_phi = x_9; + } + } + if ((x_45.f0 < 1000)) { + break; + } + break; + } + x_12_phi = 0; + loop { + var x_6 : i32; + let x_12 : i32 = x_12_phi; + if ((x_12 < x_51)) { + } else { + break; + } + + continuing { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_6 = (x_12 + 1); + x_12_phi = x_6; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl new file mode 100644 index 0000000000..088c0f824a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl @@ -0,0 +1,73 @@ +struct S { + f0 : i32; + f1 : mat4x3; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var x_51 : i32; + var x_12_phi : i32; + loop { + var x_45 : S; + var x_45_phi : S; + var x_11_phi : i32; + x_45_phi = S(0, mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0))); + x_11_phi = 0; + loop { + var x_46 : S; + var x_9 : i32; + x_45 = x_45_phi; + let x_11 : i32 = x_11_phi; + let x_49 : f32 = gl_FragCoord.x; + x_51 = select(2, 1, (x_49 == 0.0)); + if ((x_11 < x_51)) { + } else { + break; + } + + continuing { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + x_46 = x_45; + x_46.f0 = (x_45.f0 + 1); + x_9 = (x_11 + 1); + x_45_phi = x_46; + x_11_phi = x_9; + } + } + if ((x_45.f0 < 1000)) { + break; + } + break; + } + x_12_phi = 0; + loop { + var x_6 : i32; + let x_12 : i32 = x_12_phi; + if ((x_12 < x_51)) { + } else { + break; + } + + continuing { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_6 = (x_12 + 1); + x_12_phi = x_6; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..f98d1d7f3a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.hlsl @@ -0,0 +1,78 @@ +struct S { + int f0; + float4x3 f1; +}; + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_51 = 0; + int x_12_phi = 0; + while (true) { + S x_45 = (S)0; + S x_45_phi = (S)0; + int x_11_phi = 0; + const S tint_symbol_4 = {0, float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f))}; + x_45_phi = tint_symbol_4; + x_11_phi = 0; + while (true) { + S x_46 = (S)0; + int x_9 = 0; + x_45 = x_45_phi; + const int x_11 = x_11_phi; + const float x_49 = gl_FragCoord.x; + x_51 = ((x_49 == 0.0f) ? 1 : 2); + if ((x_11 < x_51)) { + } else { + break; + } + { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + x_46 = x_45; + x_46.f0 = (x_45.f0 + 1); + x_9 = (x_11 + 1); + x_45_phi = x_46; + x_11_phi = x_9; + } + } + if ((x_45.f0 < 1000)) { + break; + } + break; + } + x_12_phi = 0; + while (true) { + int x_6 = 0; + const int x_12 = x_12_phi; + if ((x_12 < x_51)) { + } else { + break; + } + { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_6 = (x_12 + 1); + x_12_phi = x_6; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.msl new file mode 100644 index 0000000000..734666e7de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.msl @@ -0,0 +1,76 @@ +#include + +using namespace metal; +struct S { + int f0; + float4x3 f1; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int x_51 = 0; + int x_12_phi = 0; + while (true) { + S x_45 = {}; + S x_45_phi = {}; + int x_11_phi = 0; + S const tint_symbol_4 = {.f0=0, .f1=float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f))}; + x_45_phi = tint_symbol_4; + x_11_phi = 0; + while (true) { + S x_46 = {}; + int x_9 = 0; + x_45 = x_45_phi; + int const x_11 = x_11_phi; + float const x_49 = (*(tint_symbol_6)).x; + x_51 = select(2, 1, (x_49 == 0.0f)); + if ((x_11 < x_51)) { + } else { + break; + } + { + *(tint_symbol_7) = float4(1.0f, 1.0f, 1.0f, 1.0f); + x_46 = x_45; + x_46.f0 = (x_45.f0 + 1); + x_9 = (x_11 + 1); + x_45_phi = x_46; + x_11_phi = x_9; + } + } + if ((x_45.f0 < 1000)) { + break; + } + break; + } + x_12_phi = 0; + while (true) { + int x_6 = 0; + int const x_12 = x_12_phi; + if ((x_12 < x_51)) { + } else { + break; + } + { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_6 = (x_12 + 1); + x_12_phi = x_6; + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..c5af5adb7e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.spvasm @@ -0,0 +1,190 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 106 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_51 "x_51" + OpName %x_12_phi "x_12_phi" + OpName %S "S" + OpMemberName %S 0 "f0" + OpMemberName %S 1 "f1" + OpName %x_45 "x_45" + OpName %x_45_phi "x_45_phi" + OpName %x_11_phi "x_11_phi" + OpName %x_46 "x_46" + OpName %x_9 "x_9" + OpName %x_6 "x_6" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 16 + OpMemberDecorate %S 1 ColMajor + OpMemberDecorate %S 1 MatrixStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %S = OpTypeStruct %int %mat4v3float +%_ptr_Function_S = OpTypePointer Function %S + %29 = OpConstantNull %S + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %35 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %36 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %37 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %38 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %39 = OpConstantComposite %mat4v3float %35 %36 %37 %38 + %40 = OpConstantComposite %S %int_0 %39 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %64 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int_1000 = OpConstant %int 1000 + %90 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %93 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_51 = OpVariable %_ptr_Function_int Function %18 + %x_12_phi = OpVariable %_ptr_Function_int Function %18 + %x_45 = OpVariable %_ptr_Function_S Function %29 + %x_45_phi = OpVariable %_ptr_Function_S Function %29 + %x_11_phi = OpVariable %_ptr_Function_int Function %18 + %x_46 = OpVariable %_ptr_Function_S Function %29 + %x_9 = OpVariable %_ptr_Function_int Function %18 + %x_6 = OpVariable %_ptr_Function_int Function %18 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + OpStore %x_45_phi %40 + OpStore %x_11_phi %int_0 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %47 = OpLoad %S %x_45_phi + OpStore %x_45 %47 + %48 = OpLoad %int %x_11_phi + %52 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %53 = OpLoad %float %52 + %55 = OpFOrdEqual %bool %53 %float_0 + %54 = OpSelect %int %55 %int_1 %int_2 + OpStore %x_51 %54 + %59 = OpLoad %int %x_51 + %60 = OpSLessThan %bool %48 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %42 + %61 = OpLabel + OpBranch %43 + %43 = OpLabel + OpStore %x_GLF_color %64 + %65 = OpLoad %S %x_45 + OpStore %x_46 %65 + %66 = OpAccessChain %_ptr_Function_int %x_46 %uint_0 + %67 = OpAccessChain %_ptr_Function_int %x_45 %uint_0 + %68 = OpLoad %int %67 + %69 = OpIAdd %int %68 %int_1 + OpStore %66 %69 + %70 = OpIAdd %int %48 %int_1 + OpStore %x_9 %70 + %71 = OpLoad %S %x_46 + OpStore %x_45_phi %71 + %72 = OpLoad %int %x_9 + OpStore %x_11_phi %72 + OpBranch %41 + %42 = OpLabel + %73 = OpAccessChain %_ptr_Function_int %x_45 %uint_0 + %74 = OpLoad %int %73 + %76 = OpSLessThan %bool %74 %int_1000 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + OpBranch %21 + %77 = OpLabel + OpBranch %21 + %22 = OpLabel + OpBranch %20 + %21 = OpLabel + OpStore %x_12_phi %int_0 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %84 = OpLoad %int %x_12_phi + %85 = OpLoad %int %x_51 + %86 = OpSLessThan %bool %84 %85 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %89 + %88 = OpLabel + OpBranch %87 + %89 = OpLabel + OpBranch %80 + %87 = OpLabel + OpBranch %81 + %81 = OpLabel + OpStore %x_GLF_color %90 + %91 = OpIAdd %int %84 %int_1 + OpStore %x_6 %91 + %92 = OpLoad %int %x_6 + OpStore %x_12_phi %92 + OpBranch %79 + %80 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %93 +%tint_symbol_1 = OpFunctionParameter %main_out + %97 = OpLabel + %98 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %98 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %100 = OpLabel + %101 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %101 + %102 = OpFunctionCall %void %main_1 + %104 = OpLoad %v4float %x_GLF_color + %105 = OpCompositeConstruct %main_out %104 + %103 = OpFunctionCall %void %tint_symbol_3 %105 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..088c0f824a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/color-write-in-loop/0.wgsl.expected.wgsl @@ -0,0 +1,73 @@ +struct S { + f0 : i32; + f1 : mat4x3; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var x_51 : i32; + var x_12_phi : i32; + loop { + var x_45 : S; + var x_45_phi : S; + var x_11_phi : i32; + x_45_phi = S(0, mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0))); + x_11_phi = 0; + loop { + var x_46 : S; + var x_9 : i32; + x_45 = x_45_phi; + let x_11 : i32 = x_11_phi; + let x_49 : f32 = gl_FragCoord.x; + x_51 = select(2, 1, (x_49 == 0.0)); + if ((x_11 < x_51)) { + } else { + break; + } + + continuing { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + x_46 = x_45; + x_46.f0 = (x_45.f0 + 1); + x_9 = (x_11 + 1); + x_45_phi = x_46; + x_11_phi = x_9; + } + } + if ((x_45.f0 < 1000)) { + break; + } + break; + } + x_12_phi = 0; + loop { + var x_6 : i32; + let x_12 : i32 = x_12_phi; + if ((x_12 < x_51)) { + } else { + break; + } + + continuing { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_6 = (x_12 + 1); + x_12_phi = x_6; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm new file mode 100644 index 0000000000..c9c5d6f4e9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm @@ -0,0 +1,100 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %GLF_live6search_ "GLF_live6search(" + OpName %GLF_live6index "GLF_live6index" + OpName %GLF_live6currentNode "GLF_live6currentNode" + OpName %GLF_live6tree "GLF_live6tree" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %GLF_live6search_ RelaxedPrecision + OpDecorate %GLF_live6index RelaxedPrecision + OpDecorate %GLF_live6currentNode RelaxedPrecision + OpDecorate %GLF_live6tree RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %13 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %17 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 +%GLF_live6tree = OpVariable %_ptr_Private__arr_int_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %37 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %15 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %40 = OpLoad %float %39 + %41 = OpFOrdGreaterThan %bool %40 %float_1 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + %13 = OpFunctionCall %int %GLF_live6search_ + OpBranch %42 + %42 = OpLabel + OpStore %_GLF_color %37 + OpReturn + OpFunctionEnd +%GLF_live6search_ = OpFunction %int None %17 + %44 = OpLabel +%GLF_live6index = OpVariable %_ptr_Function_int Function +%GLF_live6currentNode = OpVariable %_ptr_Function_int Function + OpStore %GLF_live6index %int_0 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + OpBranchConditional %true %49 %46 + %49 = OpLabel + %10 = OpLoad %int %GLF_live6index + %50 = OpAccessChain %_ptr_Private_int %GLF_live6tree %10 + %11 = OpLoad %int %50 + OpStore %GLF_live6currentNode %11 + %12 = OpLoad %int %GLF_live6currentNode + %51 = OpINotEqual %bool %12 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + OpReturnValue %int_1 + %52 = OpLabel + OpStore %GLF_live6index %int_1 + OpBranch %47 + %47 = OpLabel + OpBranch %45 + %46 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..626404fe98 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.hlsl @@ -0,0 +1,47 @@ +static int GLF_live6tree[10] = (int[10])0; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int GLF_live6search_() { + int GLF_live6index = 0; + int GLF_live6currentNode = 0; + GLF_live6index = 0; + while (true) { + if (true) { + } else { + break; + } + const int x_11 = GLF_live6tree[GLF_live6index]; + GLF_live6currentNode = x_11; + if ((GLF_live6currentNode != 1)) { + return 1; + } + GLF_live6index = 1; + } + return 1; +} + +void main_1() { + const float x_40 = asfloat(x_9[0].x); + if ((x_40 > 1.0f)) { + const int x_13 = GLF_live6search_(); + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..8e00df92b3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int GLF_live6search_(thread tint_array_wrapper* const tint_symbol_4) { + int GLF_live6index = 0; + int GLF_live6currentNode = 0; + GLF_live6index = 0; + while (true) { + if (true) { + } else { + break; + } + int const x_10 = GLF_live6index; + int const x_11 = (*(tint_symbol_4)).arr[x_10]; + GLF_live6currentNode = x_11; + int const x_12 = GLF_live6currentNode; + if ((x_12 != 1)) { + return 1; + } + GLF_live6index = 1; + } + return 1; +} + +void main_1(constant buf0& x_9, thread tint_array_wrapper* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_40 = x_9.injectionSwitch.x; + if ((x_40 > 1.0f)) { + int const x_13 = GLF_live6search_(tint_symbol_5); + } + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_9 [[buffer(0)]]) { + thread tint_array_wrapper tint_symbol_7 = {}; + thread float4 tint_symbol_8 = 0.0f; + main_1(x_9, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..3e841df953 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.spvasm @@ -0,0 +1,131 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %GLF_live6tree "GLF_live6tree" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %GLF_live6search_ "GLF_live6search_" + OpName %GLF_live6index "GLF_live6index" + OpName %GLF_live6currentNode "GLF_live6currentNode" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 +%GLF_live6tree = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %19 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %45 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %59 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %60 = OpTypeFunction %void %main_out +%GLF_live6search_ = OpFunction %int None %19 + %21 = OpLabel +%GLF_live6index = OpVariable %_ptr_Function_int Function %24 +%GLF_live6currentNode = OpVariable %_ptr_Function_int Function %24 + OpStore %GLF_live6index %int_0 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + OpSelectionMerge %33 None + OpBranchConditional %true %34 %35 + %34 = OpLabel + OpBranch %33 + %35 = OpLabel + OpBranch %28 + %33 = OpLabel + %36 = OpLoad %int %GLF_live6index + %38 = OpAccessChain %_ptr_Private_int %GLF_live6tree %36 + %39 = OpLoad %int %38 + OpStore %GLF_live6currentNode %39 + %40 = OpLoad %int %GLF_live6currentNode + %42 = OpINotEqual %bool %40 %int_1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpReturnValue %int_1 + %43 = OpLabel + OpStore %GLF_live6index %int_1 + OpBranch %29 + %29 = OpLabel + OpBranch %27 + %28 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %45 + %48 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %52 = OpLoad %float %51 + %54 = OpFOrdGreaterThan %bool %52 %float_1 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + %57 = OpFunctionCall %int %GLF_live6search_ + OpBranch %55 + %55 = OpLabel + OpStore %x_GLF_color %59 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %60 +%tint_symbol = OpFunctionParameter %main_out + %64 = OpLabel + %65 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %65 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %45 + %67 = OpLabel + %68 = OpFunctionCall %void %main_1 + %70 = OpLoad %v4float %x_GLF_color + %71 = OpCompositeConstruct %main_out %70 + %69 = OpFunctionCall %void %tint_symbol_2 %71 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..bd10f845cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.spvasm.expected.wgsl @@ -0,0 +1,51 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var GLF_live6tree : array; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn GLF_live6search_() -> i32 { + var GLF_live6index : i32; + var GLF_live6currentNode : i32; + GLF_live6index = 0; + loop { + if (true) { + } else { + break; + } + let x_10 : i32 = GLF_live6index; + let x_11 : i32 = GLF_live6tree[x_10]; + GLF_live6currentNode = x_11; + let x_12 : i32 = GLF_live6currentNode; + if ((x_12 != 1)) { + return 1; + } + GLF_live6index = 1; + } + return 1; +} + +fn main_1() { + let x_40 : f32 = x_9.injectionSwitch.x; + if ((x_40 > 1.0)) { + let x_13 : i32 = GLF_live6search_(); + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl new file mode 100644 index 0000000000..bd10f845cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl @@ -0,0 +1,51 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var GLF_live6tree : array; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn GLF_live6search_() -> i32 { + var GLF_live6index : i32; + var GLF_live6currentNode : i32; + GLF_live6index = 0; + loop { + if (true) { + } else { + break; + } + let x_10 : i32 = GLF_live6index; + let x_11 : i32 = GLF_live6tree[x_10]; + GLF_live6currentNode = x_11; + let x_12 : i32 = GLF_live6currentNode; + if ((x_12 != 1)) { + return 1; + } + GLF_live6index = 1; + } + return 1; +} + +fn main_1() { + let x_40 : f32 = x_9.injectionSwitch.x; + if ((x_40 > 1.0)) { + let x_13 : i32 = GLF_live6search_(); + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..626404fe98 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.hlsl @@ -0,0 +1,47 @@ +static int GLF_live6tree[10] = (int[10])0; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int GLF_live6search_() { + int GLF_live6index = 0; + int GLF_live6currentNode = 0; + GLF_live6index = 0; + while (true) { + if (true) { + } else { + break; + } + const int x_11 = GLF_live6tree[GLF_live6index]; + GLF_live6currentNode = x_11; + if ((GLF_live6currentNode != 1)) { + return 1; + } + GLF_live6index = 1; + } + return 1; +} + +void main_1() { + const float x_40 = asfloat(x_9[0].x); + if ((x_40 > 1.0f)) { + const int x_13 = GLF_live6search_(); + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..8e00df92b3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int GLF_live6search_(thread tint_array_wrapper* const tint_symbol_4) { + int GLF_live6index = 0; + int GLF_live6currentNode = 0; + GLF_live6index = 0; + while (true) { + if (true) { + } else { + break; + } + int const x_10 = GLF_live6index; + int const x_11 = (*(tint_symbol_4)).arr[x_10]; + GLF_live6currentNode = x_11; + int const x_12 = GLF_live6currentNode; + if ((x_12 != 1)) { + return 1; + } + GLF_live6index = 1; + } + return 1; +} + +void main_1(constant buf0& x_9, thread tint_array_wrapper* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_40 = x_9.injectionSwitch.x; + if ((x_40 > 1.0f)) { + int const x_13 = GLF_live6search_(tint_symbol_5); + } + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_9 [[buffer(0)]]) { + thread tint_array_wrapper tint_symbol_7 = {}; + thread float4 tint_symbol_8 = 0.0f; + main_1(x_9, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..3e841df953 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.spvasm @@ -0,0 +1,131 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %GLF_live6tree "GLF_live6tree" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %GLF_live6search_ "GLF_live6search_" + OpName %GLF_live6index "GLF_live6index" + OpName %GLF_live6currentNode "GLF_live6currentNode" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 +%GLF_live6tree = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %19 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %45 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %59 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %60 = OpTypeFunction %void %main_out +%GLF_live6search_ = OpFunction %int None %19 + %21 = OpLabel +%GLF_live6index = OpVariable %_ptr_Function_int Function %24 +%GLF_live6currentNode = OpVariable %_ptr_Function_int Function %24 + OpStore %GLF_live6index %int_0 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + OpSelectionMerge %33 None + OpBranchConditional %true %34 %35 + %34 = OpLabel + OpBranch %33 + %35 = OpLabel + OpBranch %28 + %33 = OpLabel + %36 = OpLoad %int %GLF_live6index + %38 = OpAccessChain %_ptr_Private_int %GLF_live6tree %36 + %39 = OpLoad %int %38 + OpStore %GLF_live6currentNode %39 + %40 = OpLoad %int %GLF_live6currentNode + %42 = OpINotEqual %bool %40 %int_1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpReturnValue %int_1 + %43 = OpLabel + OpStore %GLF_live6index %int_1 + OpBranch %29 + %29 = OpLabel + OpBranch %27 + %28 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %45 + %48 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %52 = OpLoad %float %51 + %54 = OpFOrdGreaterThan %bool %52 %float_1 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + %57 = OpFunctionCall %int %GLF_live6search_ + OpBranch %55 + %55 = OpLabel + OpStore %x_GLF_color %59 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %60 +%tint_symbol = OpFunctionParameter %main_out + %64 = OpLabel + %65 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %65 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %45 + %67 = OpLabel + %68 = OpFunctionCall %void %main_1 + %70 = OpLoad %v4float %x_GLF_color + %71 = OpCompositeConstruct %main_out %70 + %69 = OpFunctionCall %void %tint_symbol_2 %71 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd10f845cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/conditional-return-in-infinite-while/0-opt.wgsl.expected.wgsl @@ -0,0 +1,51 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var GLF_live6tree : array; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn GLF_live6search_() -> i32 { + var GLF_live6index : i32; + var GLF_live6currentNode : i32; + GLF_live6index = 0; + loop { + if (true) { + } else { + break; + } + let x_10 : i32 = GLF_live6index; + let x_11 : i32 = GLF_live6tree[x_10]; + GLF_live6currentNode = x_11; + let x_12 : i32 = GLF_live6currentNode; + if ((x_12 != 1)) { + return 1; + } + GLF_live6index = 1; + } + return 1; +} + +fn main_1() { + let x_40 : f32 = x_9.injectionSwitch.x; + if ((x_40 > 1.0)) { + let x_13 : i32 = GLF_live6search_(); + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm new file mode 100644 index 0000000000..0cc68a090d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm @@ -0,0 +1,627 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %drawShape_vf2_ "drawShape(vf2;" + OpName %pos "pos" + OpName %c2 "c2" + OpName %c3 "c3" + OpName %c4 "c4" + OpName %c5 "c5" + OpName %c6 "c6" + OpName %GLF_live4i "GLF_live4i" + OpName %GLF_live4_looplimiter5 "GLF_live4_looplimiter5" + OpName %GLF_live7m42 "GLF_live7m42" + OpName %GLF_live7m33 "GLF_live7m33" + OpName %GLF_live7cols "GLF_live7cols" + OpName %GLF_live7_looplimiter3 "GLF_live7_looplimiter3" + OpName %GLF_live7rows "GLF_live7rows" + OpName %GLF_live7_looplimiter2 "GLF_live7_looplimiter2" + OpName %GLF_live7_looplimiter1 "GLF_live7_looplimiter1" + OpName %GLF_live7c "GLF_live7c" + OpName %GLF_live7r "GLF_live7r" + OpName %GLF_live7_looplimiter0 "GLF_live7_looplimiter0" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %GLF_live7sum_index "GLF_live7sum_index" + OpName %GLF_live7_looplimiter7 "GLF_live7_looplimiter7" + OpName %GLF_live7cols_0 "GLF_live7cols" + OpName %GLF_live7rows_0 "GLF_live7rows" + OpName %GLF_live7sums "GLF_live7sums" + OpName %GLF_live7c_0 "GLF_live7c" + OpName %GLF_live7r_0 "GLF_live7r" + OpName %indexable "indexable" + OpName %position "position" + OpName %gl_FragCoord "gl_FragCoord" + OpName %param "param" + OpName %param_0 "param" + OpName %i "i" + OpName %param_1 "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %GLF_live4i RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %GLF_live4_looplimiter5 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %GLF_live7cols RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %GLF_live7_looplimiter3 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %GLF_live7rows RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %GLF_live7_looplimiter2 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %GLF_live7_looplimiter1 RelaxedPrecision + OpDecorate %GLF_live7c RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %GLF_live7r RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %GLF_live7_looplimiter0 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + OpDecorate %59 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + OpDecorate %61 RelaxedPrecision + OpDecorate %62 RelaxedPrecision + OpDecorate %63 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %65 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %67 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %69 RelaxedPrecision + OpDecorate %70 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %74 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %77 RelaxedPrecision + OpDecorate %78 RelaxedPrecision + OpDecorate %GLF_live7sum_index RelaxedPrecision + OpDecorate %GLF_live7_looplimiter7 RelaxedPrecision + OpDecorate %GLF_live7cols_0 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %82 RelaxedPrecision + OpDecorate %GLF_live7rows_0 RelaxedPrecision + OpDecorate %83 RelaxedPrecision + OpDecorate %84 RelaxedPrecision + OpDecorate %85 RelaxedPrecision + OpDecorate %GLF_live7c_0 RelaxedPrecision + OpDecorate %86 RelaxedPrecision + OpDecorate %GLF_live7r_0 RelaxedPrecision + OpDecorate %87 RelaxedPrecision + OpDecorate %88 RelaxedPrecision + OpDecorate %89 RelaxedPrecision + OpDecorate %90 RelaxedPrecision + OpDecorate %91 RelaxedPrecision + OpDecorate %92 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %94 RelaxedPrecision + OpDecorate %95 RelaxedPrecision + OpDecorate %96 RelaxedPrecision + OpDecorate %97 RelaxedPrecision + OpDecorate %98 RelaxedPrecision + OpDecorate %99 RelaxedPrecision + OpDecorate %100 RelaxedPrecision + OpDecorate %101 RelaxedPrecision + OpDecorate %102 RelaxedPrecision + OpDecorate %103 RelaxedPrecision + OpDecorate %104 RelaxedPrecision + OpDecorate %105 RelaxedPrecision + OpDecorate %106 RelaxedPrecision + OpDecorate %107 RelaxedPrecision + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %i RelaxedPrecision + OpDecorate %108 RelaxedPrecision + OpDecorate %109 RelaxedPrecision + OpDecorate %110 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %112 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v3float = OpTypeVector %float 3 + %117 = OpTypeFunction %v3float %_ptr_Function_v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %124 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_7 = OpConstant %int 7 + %int_1 = OpConstant %int 1 +%mat4v2float = OpTypeMatrix %v2float 4 +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float + %float_0 = OpConstant %float 0 + %135 = OpConstantComposite %v2float %float_1 %float_0 + %136 = OpConstantComposite %v2float %float_0 %float_1 + %137 = OpConstantComposite %v2float %float_0 %float_0 + %138 = OpConstantComposite %mat4v2float %135 %136 %137 %135 +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %141 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %142 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %143 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %144 = OpConstantComposite %mat3v3float %141 %142 %143 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %int_9 = OpConstant %int 9 + %float_2 = OpConstant %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %int_25 = OpConstant %int 25 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %158 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %112 + %159 = OpLabel + %position = OpVariable %_ptr_Function_v2float Function + %param = OpVariable %_ptr_Function_v2float Function + %param_0 = OpVariable %_ptr_Function_v2float Function + %i = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_v2float Function + %160 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %161 = OpLoad %float %160 + %162 = OpFOrdGreaterThanEqual %bool %161 %float_2 + OpSelectionMerge %163 None + OpBranchConditional %162 %164 %163 + %164 = OpLabel + %165 = OpLoad %v4float %gl_FragCoord + %166 = OpVectorShuffle %v2float %165 %165 0 1 + OpStore %position %166 + %167 = OpLoad %v2float %position + OpStore %param %167 + %168 = OpFunctionCall %v3float %drawShape_vf2_ %param + %169 = OpLoad %v2float %position + OpStore %param_0 %169 + %170 = OpFunctionCall %v3float %drawShape_vf2_ %param_0 + OpStore %i %int_25 + OpBranch %171 + %171 = OpLabel + OpLoopMerge %172 %173 None + OpBranch %174 + %174 = OpLabel + %108 = OpLoad %int %i + %175 = OpSGreaterThan %bool %108 %int_0 + OpBranchConditional %175 %176 %172 + %176 = OpLabel + %177 = OpLoad %v2float %position + OpStore %param_1 %177 + %178 = OpFunctionCall %v3float %drawShape_vf2_ %param_1 + OpBranch %173 + %173 = OpLabel + %109 = OpLoad %int %i + %110 = OpISub %int %109 %int_1 + OpStore %i %110 + OpBranch %171 + %172 = OpLabel + OpBranch %163 + %163 = OpLabel + OpStore %_GLF_color %158 + OpReturn + OpFunctionEnd +%drawShape_vf2_ = OpFunction %v3float None %117 + %pos = OpFunctionParameter %_ptr_Function_v2float + %179 = OpLabel + %c2 = OpVariable %_ptr_Function_bool Function + %c3 = OpVariable %_ptr_Function_bool Function + %c4 = OpVariable %_ptr_Function_bool Function + %c5 = OpVariable %_ptr_Function_bool Function + %c6 = OpVariable %_ptr_Function_bool Function + %GLF_live4i = OpVariable %_ptr_Function_int Function +%GLF_live4_looplimiter5 = OpVariable %_ptr_Function_int Function +%GLF_live7m42 = OpVariable %_ptr_Function_mat4v2float Function +%GLF_live7m33 = OpVariable %_ptr_Function_mat3v3float Function +%GLF_live7cols = OpVariable %_ptr_Function_int Function +%GLF_live7_looplimiter3 = OpVariable %_ptr_Function_int Function +%GLF_live7rows = OpVariable %_ptr_Function_int Function +%GLF_live7_looplimiter2 = OpVariable %_ptr_Function_int Function +%GLF_live7_looplimiter1 = OpVariable %_ptr_Function_int Function + %GLF_live7c = OpVariable %_ptr_Function_int Function + %GLF_live7r = OpVariable %_ptr_Function_int Function +%GLF_live7_looplimiter0 = OpVariable %_ptr_Function_int Function +%GLF_live7sum_index = OpVariable %_ptr_Function_int Function +%GLF_live7_looplimiter7 = OpVariable %_ptr_Function_int Function +%GLF_live7cols_0 = OpVariable %_ptr_Function_int Function +%GLF_live7rows_0 = OpVariable %_ptr_Function_int Function +%GLF_live7sums = OpVariable %_ptr_Function__arr_float_uint_9 Function +%GLF_live7c_0 = OpVariable %_ptr_Function_int Function +%GLF_live7r_0 = OpVariable %_ptr_Function_int Function + %180 = OpVariable %_ptr_Function_int Function + %indexable = OpVariable %_ptr_Function_mat3v3float Function + %181 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %182 = OpLoad %float %181 + %183 = OpFOrdGreaterThan %bool %182 %float_1 + OpStore %c2 %183 + %184 = OpLoad %bool %c2 + OpSelectionMerge %185 None + OpBranchConditional %184 %186 %185 + %186 = OpLabel + OpReturnValue %124 + %185 = OpLabel + %187 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %188 = OpLoad %float %187 + %189 = OpFOrdLessThan %bool %188 %float_1 + OpStore %c3 %189 + %190 = OpLoad %bool %c3 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %191 + %192 = OpLabel + OpReturnValue %124 + %191 = OpLabel + %193 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %194 = OpLoad %float %193 + %195 = OpFOrdGreaterThan %bool %194 %float_1 + OpStore %c4 %195 + %196 = OpLoad %bool %c4 + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %197 + %198 = OpLabel + OpReturnValue %124 + %197 = OpLabel + %199 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %200 = OpLoad %float %199 + %201 = OpFOrdLessThan %bool %200 %float_1 + OpStore %c5 %201 + %202 = OpLoad %bool %c5 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %203 + %204 = OpLabel + OpReturnValue %124 + %203 = OpLabel + %205 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %206 = OpLoad %float %205 + %207 = OpFAdd %float %206 %float_1 + %208 = OpFOrdGreaterThan %bool %207 %float_1 + OpStore %c6 %208 + %209 = OpLoad %bool %c6 + OpSelectionMerge %210 None + OpBranchConditional %209 %211 %210 + %211 = OpLabel + OpReturnValue %124 + %210 = OpLabel + OpStore %GLF_live4i %int_0 + OpBranch %212 + %212 = OpLabel + OpLoopMerge %213 %214 None + OpBranch %215 + %215 = OpLabel + %39 = OpLoad %int %GLF_live4i + %216 = OpSLessThan %bool %39 %int_4 + OpBranchConditional %216 %217 %213 + %217 = OpLabel + %40 = OpLoad %int %GLF_live4_looplimiter5 + %218 = OpSGreaterThanEqual %bool %40 %int_7 + OpSelectionMerge %219 None + OpBranchConditional %218 %220 %219 + %220 = OpLabel + OpBranch %213 + %219 = OpLabel + %41 = OpLoad %int %GLF_live4_looplimiter5 + %42 = OpIAdd %int %41 %int_1 + OpStore %GLF_live4_looplimiter5 %42 + OpStore %GLF_live7m42 %138 + OpStore %GLF_live7m33 %144 + OpStore %GLF_live7cols %int_2 + OpBranch %221 + %221 = OpLabel + OpLoopMerge %222 %223 None + OpBranch %224 + %224 = OpLabel + %43 = OpLoad %int %GLF_live7cols + %225 = OpSLessThan %bool %43 %int_4 + OpBranchConditional %225 %226 %222 + %226 = OpLabel + %44 = OpLoad %int %GLF_live7_looplimiter3 + %227 = OpSGreaterThanEqual %bool %44 %int_7 + OpSelectionMerge %228 None + OpBranchConditional %227 %229 %228 + %229 = OpLabel + OpBranch %222 + %228 = OpLabel + %45 = OpLoad %int %GLF_live7_looplimiter3 + %46 = OpIAdd %int %45 %int_1 + OpStore %GLF_live7_looplimiter3 %46 + OpStore %GLF_live7rows %int_2 + OpBranch %230 + %230 = OpLabel + OpLoopMerge %231 %232 None + OpBranch %233 + %233 = OpLabel + %47 = OpLoad %int %GLF_live7rows + %234 = OpSLessThan %bool %47 %int_4 + OpBranchConditional %234 %235 %231 + %235 = OpLabel + %48 = OpLoad %int %GLF_live7_looplimiter2 + %236 = OpSGreaterThanEqual %bool %48 %int_7 + OpSelectionMerge %237 None + OpBranchConditional %236 %238 %237 + %238 = OpLabel + OpBranch %231 + %237 = OpLabel + %49 = OpLoad %int %GLF_live7_looplimiter2 + %50 = OpIAdd %int %49 %int_1 + OpStore %GLF_live7_looplimiter2 %50 + OpStore %GLF_live7_looplimiter1 %int_0 + OpStore %GLF_live7c %int_0 + OpBranch %239 + %239 = OpLabel + OpLoopMerge %240 %241 None + OpBranch %242 + %242 = OpLabel + %51 = OpLoad %int %GLF_live7c + %243 = OpSLessThan %bool %51 %int_3 + OpBranchConditional %243 %244 %240 + %244 = OpLabel + %52 = OpLoad %int %GLF_live7_looplimiter1 + %245 = OpSGreaterThanEqual %bool %52 %int_7 + OpSelectionMerge %246 None + OpBranchConditional %245 %247 %246 + %247 = OpLabel + OpBranch %240 + %246 = OpLabel + %53 = OpLoad %int %GLF_live7_looplimiter1 + %54 = OpIAdd %int %53 %int_1 + OpStore %GLF_live7_looplimiter1 %54 + OpStore %GLF_live7r %int_0 + OpBranch %248 + %248 = OpLabel + OpLoopMerge %249 %250 None + OpBranch %251 + %251 = OpLabel + %55 = OpLoad %int %GLF_live7r + %252 = OpSLessThan %bool %55 %int_2 + OpBranchConditional %252 %253 %249 + %253 = OpLabel + %56 = OpLoad %int %GLF_live7_looplimiter0 + %254 = OpSGreaterThanEqual %bool %56 %int_7 + OpSelectionMerge %255 None + OpBranchConditional %254 %256 %255 + %256 = OpLabel + OpBranch %249 + %255 = OpLabel + %57 = OpLoad %int %GLF_live7_looplimiter0 + %58 = OpIAdd %int %57 %int_1 + OpStore %GLF_live7_looplimiter0 %58 + %59 = OpLoad %int %GLF_live7c + %257 = OpSGreaterThanEqual %bool %59 %int_0 + %60 = OpLoad %int %GLF_live7c + %258 = OpSLessThan %bool %60 %int_3 + %259 = OpLogicalAnd %bool %257 %258 + %61 = OpLoad %int %GLF_live7c + %260 = OpSelect %int %259 %61 %int_0 + %62 = OpLoad %int %GLF_live7r + %261 = OpSGreaterThanEqual %bool %62 %int_0 + %63 = OpLoad %int %GLF_live7r + %262 = OpSLessThan %bool %63 %int_3 + %263 = OpLogicalAnd %bool %261 %262 + %64 = OpLoad %int %GLF_live7r + %264 = OpSelect %int %263 %64 %int_0 + %265 = OpAccessChain %_ptr_Function_float %GLF_live7m33 %260 %264 + OpStore %265 %float_1 + %266 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %267 = OpLoad %float %266 + %268 = OpFOrdGreaterThan %bool %float_0 %267 + OpSelectionMerge %269 None + OpBranchConditional %268 %270 %271 + %270 = OpLabel + OpBranch %269 + %271 = OpLabel + %65 = OpLoad %int %GLF_live7c + %272 = OpSGreaterThanEqual %bool %65 %int_0 + %66 = OpLoad %int %GLF_live7c + %273 = OpSLessThan %bool %66 %int_4 + %274 = OpLogicalAnd %bool %272 %273 + %67 = OpLoad %int %GLF_live7c + %275 = OpSelect %int %274 %67 %int_0 + %68 = OpLoad %int %GLF_live7r + %276 = OpSGreaterThanEqual %bool %68 %int_0 + %69 = OpLoad %int %GLF_live7r + %277 = OpSLessThan %bool %69 %int_2 + %278 = OpLogicalAnd %bool %276 %277 + %70 = OpLoad %int %GLF_live7r + %279 = OpSelect %int %278 %70 %int_0 + %280 = OpAccessChain %_ptr_Function_float %GLF_live7m42 %275 %279 + OpStore %280 %float_1 + OpBranch %269 + %269 = OpLabel + OpBranch %250 + %250 = OpLabel + %71 = OpLoad %int %GLF_live7r + %72 = OpIAdd %int %71 %int_1 + OpStore %GLF_live7r %72 + OpBranch %248 + %249 = OpLabel + OpBranch %241 + %241 = OpLabel + %73 = OpLoad %int %GLF_live7c + %74 = OpIAdd %int %73 %int_1 + OpStore %GLF_live7c %74 + OpBranch %239 + %240 = OpLabel + OpBranch %232 + %232 = OpLabel + %75 = OpLoad %int %GLF_live7rows + %76 = OpIAdd %int %75 %int_1 + OpStore %GLF_live7rows %76 + OpBranch %230 + %231 = OpLabel + OpBranch %223 + %223 = OpLabel + %77 = OpLoad %int %GLF_live7cols + %78 = OpIAdd %int %77 %int_1 + OpStore %GLF_live7cols %78 + OpBranch %221 + %222 = OpLabel + OpStore %GLF_live7sum_index %int_0 + OpStore %GLF_live7_looplimiter7 %int_0 + OpStore %GLF_live7cols_0 %int_2 + OpBranch %281 + %281 = OpLabel + OpLoopMerge %282 %283 None + OpBranch %284 + %284 = OpLabel + %79 = OpLoad %int %GLF_live7cols_0 + %285 = OpSLessThan %bool %79 %int_4 + OpBranchConditional %285 %286 %282 + %286 = OpLabel + %80 = OpLoad %int %GLF_live7_looplimiter7 + %287 = OpSGreaterThanEqual %bool %80 %int_7 + OpSelectionMerge %288 None + OpBranchConditional %287 %289 %288 + %289 = OpLabel + OpBranch %282 + %288 = OpLabel + %81 = OpLoad %int %GLF_live7_looplimiter7 + %82 = OpIAdd %int %81 %int_1 + OpStore %GLF_live7_looplimiter7 %82 + OpStore %GLF_live7rows_0 %int_2 + %83 = OpLoad %int %GLF_live7sum_index + %290 = OpSGreaterThanEqual %bool %83 %int_0 + %84 = OpLoad %int %GLF_live7sum_index + %291 = OpSLessThan %bool %84 %int_9 + %292 = OpLogicalAnd %bool %290 %291 + %85 = OpLoad %int %GLF_live7sum_index + %293 = OpSelect %int %292 %85 %int_0 + %294 = OpAccessChain %_ptr_Function_float %GLF_live7sums %293 + OpStore %294 %float_0 + OpStore %GLF_live7c_0 %int_0 + OpBranch %295 + %295 = OpLabel + OpLoopMerge %296 %297 None + OpBranch %298 + %298 = OpLabel + %86 = OpLoad %int %GLF_live7c_0 + %299 = OpSLessThan %bool %86 %int_1 + OpBranchConditional %299 %300 %296 + %300 = OpLabel + OpStore %GLF_live7r_0 %int_0 + OpBranch %301 + %301 = OpLabel + OpLoopMerge %302 %303 None + OpBranch %304 + %304 = OpLabel + %87 = OpLoad %int %GLF_live7r_0 + %88 = OpLoad %int %GLF_live7rows_0 + %305 = OpSLessThan %bool %87 %88 + OpBranchConditional %305 %306 %302 + %306 = OpLabel + %89 = OpLoad %int %GLF_live7sum_index + %307 = OpSGreaterThanEqual %bool %89 %int_0 + %90 = OpLoad %int %GLF_live7sum_index + %308 = OpSLessThan %bool %90 %int_9 + %309 = OpLogicalAnd %bool %307 %308 + %91 = OpLoad %int %GLF_live7sum_index + %310 = OpSelect %int %309 %91 %int_0 + %311 = OpLoad %mat3v3float %GLF_live7m33 + %312 = OpTranspose %mat3v3float %311 + %92 = OpLoad %int %GLF_live7c_0 + %313 = OpSLessThan %bool %92 %int_3 + OpSelectionMerge %314 None + OpBranchConditional %313 %315 %316 + %315 = OpLabel + OpStore %180 %int_1 + OpBranch %314 + %316 = OpLabel + %317 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %318 = OpLoad %float %317 + %319 = OpConvertFToS %int %318 + OpStore %180 %319 + OpBranch %314 + %314 = OpLabel + %320 = OpLoad %int %180 + %93 = OpLoad %int %GLF_live7r_0 + %321 = OpSLessThan %bool %93 %int_3 + %322 = OpSelect %int %321 %int_1 %int_0 + OpStore %indexable %312 + %323 = OpAccessChain %_ptr_Function_float %indexable %320 %322 + %324 = OpLoad %float %323 + %325 = OpAccessChain %_ptr_Function_float %GLF_live7sums %310 + %326 = OpLoad %float %325 + %327 = OpFAdd %float %326 %324 + %328 = OpAccessChain %_ptr_Function_float %GLF_live7sums %310 + OpStore %328 %327 + %94 = OpLoad %int %GLF_live7sum_index + %329 = OpSGreaterThanEqual %bool %94 %int_0 + %95 = OpLoad %int %GLF_live7sum_index + %330 = OpSLessThan %bool %95 %int_9 + %331 = OpLogicalAnd %bool %329 %330 + %96 = OpLoad %int %GLF_live7sum_index + %332 = OpSelect %int %331 %96 %int_0 + %97 = OpLoad %int %GLF_live7r_0 + %333 = OpAccessChain %_ptr_Function_float %GLF_live7m42 %int_1 %97 + %334 = OpLoad %float %333 + %335 = OpAccessChain %_ptr_Function_float %GLF_live7sums %332 + %336 = OpLoad %float %335 + %337 = OpFAdd %float %336 %334 + %338 = OpAccessChain %_ptr_Function_float %GLF_live7sums %332 + OpStore %338 %337 + OpBranch %303 + %303 = OpLabel + %98 = OpLoad %int %GLF_live7r_0 + %99 = OpIAdd %int %98 %int_1 + OpStore %GLF_live7r_0 %99 + OpBranch %301 + %302 = OpLabel + OpBranch %297 + %297 = OpLabel + %100 = OpLoad %int %GLF_live7c_0 + %101 = OpIAdd %int %100 %int_1 + OpStore %GLF_live7c_0 %101 + OpBranch %295 + %296 = OpLabel + %102 = OpLoad %int %GLF_live7sum_index + %103 = OpIAdd %int %102 %int_1 + OpStore %GLF_live7sum_index %103 + OpBranch %283 + %283 = OpLabel + %104 = OpLoad %int %GLF_live7cols_0 + %105 = OpIAdd %int %104 %int_1 + OpStore %GLF_live7cols_0 %105 + OpBranch %281 + %282 = OpLabel + OpBranch %214 + %214 = OpLabel + %106 = OpLoad %int %GLF_live4i + %107 = OpIAdd %int %106 %int_1 + OpStore %GLF_live4i %107 + OpBranch %212 + %213 = OpLabel + OpReturnValue %124 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..19070703c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.hlsl @@ -0,0 +1,237 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +cbuffer cbuffer_x_25 : register(b0, space0) { + uint4 x_25[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 drawShape_vf2_(inout float2 pos) { + bool c2 = false; + bool c3 = false; + bool c4 = false; + bool c5 = false; + bool c6 = false; + int GLF_live4i = 0; + int GLF_live4_looplimiter5 = 0; + float4x2 GLF_live7m42 = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x3 GLF_live7m33 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int GLF_live7cols = 0; + int GLF_live7_looplimiter3 = 0; + int GLF_live7rows = 0; + int GLF_live7_looplimiter2 = 0; + int GLF_live7_looplimiter1 = 0; + int GLF_live7c = 0; + int GLF_live7r = 0; + int GLF_live7_looplimiter0 = 0; + int GLF_live7sum_index = 0; + int GLF_live7_looplimiter7 = 0; + int GLF_live7cols_1 = 0; + int GLF_live7rows_1 = 0; + float GLF_live7sums[9] = (float[9])0; + int GLF_live7c_1 = 0; + int GLF_live7r_1 = 0; + int x_180 = 0; + float3x3 indexable = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + const float x_182 = pos.x; + c2 = (x_182 > 1.0f); + if (c2) { + return float3(1.0f, 1.0f, 1.0f); + } + const float x_188 = pos.y; + c3 = (x_188 < 1.0f); + if (c3) { + return float3(1.0f, 1.0f, 1.0f); + } + const float x_194 = pos.y; + c4 = (x_194 > 1.0f); + if (c4) { + return float3(1.0f, 1.0f, 1.0f); + } + const float x_200 = pos.x; + c5 = (x_200 < 1.0f); + if (c5) { + return float3(1.0f, 1.0f, 1.0f); + } + const float x_206 = pos.x; + c6 = ((x_206 + 1.0f) > 1.0f); + if (c6) { + return float3(1.0f, 1.0f, 1.0f); + } + GLF_live4i = 0; + { + for(; (GLF_live4i < 4); GLF_live4i = (GLF_live4i + 1)) { + if ((GLF_live4_looplimiter5 >= 7)) { + break; + } + GLF_live4_looplimiter5 = (GLF_live4_looplimiter5 + 1); + GLF_live7m42 = float4x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f), float2(0.0f, 0.0f), float2(1.0f, 0.0f)); + GLF_live7m33 = float3x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f)); + GLF_live7cols = 2; + { + for(; (GLF_live7cols < 4); GLF_live7cols = (GLF_live7cols + 1)) { + if ((GLF_live7_looplimiter3 >= 7)) { + break; + } + GLF_live7_looplimiter3 = (GLF_live7_looplimiter3 + 1); + GLF_live7rows = 2; + { + for(; (GLF_live7rows < 4); GLF_live7rows = (GLF_live7rows + 1)) { + if ((GLF_live7_looplimiter2 >= 7)) { + break; + } + GLF_live7_looplimiter2 = (GLF_live7_looplimiter2 + 1); + GLF_live7_looplimiter1 = 0; + GLF_live7c = 0; + { + for(; (GLF_live7c < 3); GLF_live7c = (GLF_live7c + 1)) { + if ((GLF_live7_looplimiter1 >= 7)) { + break; + } + GLF_live7_looplimiter1 = (GLF_live7_looplimiter1 + 1); + GLF_live7r = 0; + { + for(; (GLF_live7r < 2); GLF_live7r = (GLF_live7r + 1)) { + if ((GLF_live7_looplimiter0 >= 7)) { + break; + } + GLF_live7_looplimiter0 = (GLF_live7_looplimiter0 + 1); + bool tint_tmp = (GLF_live7c >= 0); + if (tint_tmp) { + tint_tmp = (GLF_live7c < 3); + } + bool tint_tmp_1 = (GLF_live7r >= 0); + if (tint_tmp_1) { + tint_tmp_1 = (GLF_live7r < 3); + } + set_float3(GLF_live7m33[((tint_tmp) ? GLF_live7c : 0)], ((tint_tmp_1) ? GLF_live7r : 0), 1.0f); + const float x_267 = asfloat(x_25[0].y); + if ((0.0f > x_267)) { + } else { + bool tint_tmp_2 = (GLF_live7c >= 0); + if (tint_tmp_2) { + tint_tmp_2 = (GLF_live7c < 4); + } + bool tint_tmp_3 = (GLF_live7r >= 0); + if (tint_tmp_3) { + tint_tmp_3 = (GLF_live7r < 2); + } + set_float2(GLF_live7m42[((tint_tmp_2) ? GLF_live7c : 0)], ((tint_tmp_3) ? GLF_live7r : 0), 1.0f); + } + } + } + } + } + } + } + } + } + GLF_live7sum_index = 0; + GLF_live7_looplimiter7 = 0; + GLF_live7cols_1 = 2; + { + for(; (GLF_live7cols_1 < 4); GLF_live7cols_1 = (GLF_live7cols_1 + 1)) { + if ((GLF_live7_looplimiter7 >= 7)) { + break; + } + GLF_live7_looplimiter7 = (GLF_live7_looplimiter7 + 1); + GLF_live7rows_1 = 2; + bool tint_tmp_4 = (GLF_live7sum_index >= 0); + if (tint_tmp_4) { + tint_tmp_4 = (GLF_live7sum_index < 9); + } + GLF_live7sums[((tint_tmp_4) ? GLF_live7sum_index : 0)] = 0.0f; + GLF_live7c_1 = 0; + { + for(; (GLF_live7c_1 < 1); GLF_live7c_1 = (GLF_live7c_1 + 1)) { + GLF_live7r_1 = 0; + { + for(; (GLF_live7r_1 < GLF_live7rows_1); GLF_live7r_1 = (GLF_live7r_1 + 1)) { + bool tint_tmp_5 = (GLF_live7sum_index >= 0); + if (tint_tmp_5) { + tint_tmp_5 = (GLF_live7sum_index < 9); + } + const int x_310 = ((tint_tmp_5) ? GLF_live7sum_index : 0); + const float3x3 x_312 = transpose(GLF_live7m33); + if ((GLF_live7c_1 < 3)) { + x_180 = 1; + } else { + const float x_318 = asfloat(x_25[0].x); + x_180 = int(x_318); + } + const int x_320 = x_180; + const int x_93 = GLF_live7r_1; + indexable = x_312; + const float x_324 = indexable[x_320][((x_93 < 3) ? 1 : 0)]; + const float x_326 = GLF_live7sums[x_310]; + GLF_live7sums[x_310] = (x_326 + x_324); + bool tint_tmp_6 = (GLF_live7sum_index >= 0); + if (tint_tmp_6) { + tint_tmp_6 = (GLF_live7sum_index < 9); + } + const int x_332 = ((tint_tmp_6) ? GLF_live7sum_index : 0); + const float x_334 = GLF_live7m42[1][GLF_live7r_1]; + const float x_336 = GLF_live7sums[x_332]; + GLF_live7sums[x_332] = (x_336 + x_334); + } + } + } + } + GLF_live7sum_index = (GLF_live7sum_index + 1); + } + } + } + } + return float3(1.0f, 1.0f, 1.0f); +} + +void main_1() { + float2 position = float2(0.0f, 0.0f); + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + int i = 0; + float2 param_2 = float2(0.0f, 0.0f); + const float x_161 = asfloat(x_25[0].x); + if ((x_161 >= 2.0f)) { + const float4 x_165 = gl_FragCoord; + position = float2(x_165.x, x_165.y); + param = position; + const float3 x_168 = drawShape_vf2_(param); + param_1 = position; + const float3 x_170 = drawShape_vf2_(param_1); + i = 25; + { + for(; (i > 0); i = (i - 1)) { + param_2 = position; + const float3 x_178 = drawShape_vf2_(param_2); + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..9f3a7ed7b2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.msl @@ -0,0 +1,312 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 drawShape_vf2_(constant buf0& x_25, thread float2* const pos) { + bool c2 = false; + bool c3 = false; + bool c4 = false; + bool c5 = false; + bool c6 = false; + int GLF_live4i = 0; + int GLF_live4_looplimiter5 = 0; + float4x2 GLF_live7m42 = float4x2(0.0f); + float3x3 GLF_live7m33 = float3x3(0.0f); + int GLF_live7cols = 0; + int GLF_live7_looplimiter3 = 0; + int GLF_live7rows = 0; + int GLF_live7_looplimiter2 = 0; + int GLF_live7_looplimiter1 = 0; + int GLF_live7c = 0; + int GLF_live7r = 0; + int GLF_live7_looplimiter0 = 0; + int GLF_live7sum_index = 0; + int GLF_live7_looplimiter7 = 0; + int GLF_live7cols_1 = 0; + int GLF_live7rows_1 = 0; + tint_array_wrapper GLF_live7sums = {}; + int GLF_live7c_1 = 0; + int GLF_live7r_1 = 0; + int x_180 = 0; + float3x3 indexable = float3x3(0.0f); + float const x_182 = (*(pos)).x; + c2 = (x_182 > 1.0f); + bool const x_184 = c2; + if (x_184) { + return float3(1.0f, 1.0f, 1.0f); + } + float const x_188 = (*(pos)).y; + c3 = (x_188 < 1.0f); + bool const x_190 = c3; + if (x_190) { + return float3(1.0f, 1.0f, 1.0f); + } + float const x_194 = (*(pos)).y; + c4 = (x_194 > 1.0f); + bool const x_196 = c4; + if (x_196) { + return float3(1.0f, 1.0f, 1.0f); + } + float const x_200 = (*(pos)).x; + c5 = (x_200 < 1.0f); + bool const x_202 = c5; + if (x_202) { + return float3(1.0f, 1.0f, 1.0f); + } + float const x_206 = (*(pos)).x; + c6 = ((x_206 + 1.0f) > 1.0f); + bool const x_209 = c6; + if (x_209) { + return float3(1.0f, 1.0f, 1.0f); + } + GLF_live4i = 0; + while (true) { + int const x_39 = GLF_live4i; + if ((x_39 < 4)) { + } else { + break; + } + int const x_40 = GLF_live4_looplimiter5; + if ((x_40 >= 7)) { + break; + } + int const x_41 = GLF_live4_looplimiter5; + GLF_live4_looplimiter5 = (x_41 + 1); + GLF_live7m42 = float4x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f), float2(0.0f, 0.0f), float2(1.0f, 0.0f)); + GLF_live7m33 = float3x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f)); + GLF_live7cols = 2; + while (true) { + int const x_43 = GLF_live7cols; + if ((x_43 < 4)) { + } else { + break; + } + int const x_44 = GLF_live7_looplimiter3; + if ((x_44 >= 7)) { + break; + } + int const x_45 = GLF_live7_looplimiter3; + GLF_live7_looplimiter3 = (x_45 + 1); + GLF_live7rows = 2; + while (true) { + int const x_47 = GLF_live7rows; + if ((x_47 < 4)) { + } else { + break; + } + int const x_48 = GLF_live7_looplimiter2; + if ((x_48 >= 7)) { + break; + } + int const x_49 = GLF_live7_looplimiter2; + GLF_live7_looplimiter2 = (x_49 + 1); + GLF_live7_looplimiter1 = 0; + GLF_live7c = 0; + while (true) { + int const x_51 = GLF_live7c; + if ((x_51 < 3)) { + } else { + break; + } + int const x_52 = GLF_live7_looplimiter1; + if ((x_52 >= 7)) { + break; + } + int const x_53 = GLF_live7_looplimiter1; + GLF_live7_looplimiter1 = (x_53 + 1); + GLF_live7r = 0; + while (true) { + int const x_55 = GLF_live7r; + if ((x_55 < 2)) { + } else { + break; + } + int const x_56 = GLF_live7_looplimiter0; + if ((x_56 >= 7)) { + break; + } + int const x_57 = GLF_live7_looplimiter0; + GLF_live7_looplimiter0 = (x_57 + 1); + int const x_59 = GLF_live7c; + int const x_60 = GLF_live7c; + int const x_61 = GLF_live7c; + int const x_62 = GLF_live7r; + int const x_63 = GLF_live7r; + int const x_64 = GLF_live7r; + GLF_live7m33[select(0, x_61, ((x_59 >= 0) && (x_60 < 3)))][select(0, x_64, ((x_62 >= 0) && (x_63 < 3)))] = 1.0f; + float const x_267 = x_25.injectionSwitch.y; + if ((0.0f > x_267)) { + } else { + int const x_65 = GLF_live7c; + int const x_66 = GLF_live7c; + int const x_67 = GLF_live7c; + int const x_68 = GLF_live7r; + int const x_69 = GLF_live7r; + int const x_70 = GLF_live7r; + GLF_live7m42[select(0, x_67, ((x_65 >= 0) && (x_66 < 4)))][select(0, x_70, ((x_68 >= 0) && (x_69 < 2)))] = 1.0f; + } + { + int const x_71 = GLF_live7r; + GLF_live7r = (x_71 + 1); + } + } + { + int const x_73 = GLF_live7c; + GLF_live7c = (x_73 + 1); + } + } + { + int const x_75 = GLF_live7rows; + GLF_live7rows = (x_75 + 1); + } + } + { + int const x_77 = GLF_live7cols; + GLF_live7cols = (x_77 + 1); + } + } + GLF_live7sum_index = 0; + GLF_live7_looplimiter7 = 0; + GLF_live7cols_1 = 2; + while (true) { + int const x_79 = GLF_live7cols_1; + if ((x_79 < 4)) { + } else { + break; + } + int const x_80 = GLF_live7_looplimiter7; + if ((x_80 >= 7)) { + break; + } + int const x_81 = GLF_live7_looplimiter7; + GLF_live7_looplimiter7 = (x_81 + 1); + GLF_live7rows_1 = 2; + int const x_83 = GLF_live7sum_index; + int const x_84 = GLF_live7sum_index; + int const x_85 = GLF_live7sum_index; + GLF_live7sums.arr[select(0, x_85, ((x_83 >= 0) && (x_84 < 9)))] = 0.0f; + GLF_live7c_1 = 0; + while (true) { + int const x_86 = GLF_live7c_1; + if ((x_86 < 1)) { + } else { + break; + } + GLF_live7r_1 = 0; + while (true) { + int const x_87 = GLF_live7r_1; + int const x_88 = GLF_live7rows_1; + if ((x_87 < x_88)) { + } else { + break; + } + int const x_89 = GLF_live7sum_index; + int const x_90 = GLF_live7sum_index; + int const x_91 = GLF_live7sum_index; + int const x_310 = select(0, x_91, ((x_89 >= 0) && (x_90 < 9))); + float3x3 const x_311 = GLF_live7m33; + float3x3 const x_312 = transpose(x_311); + int const x_92 = GLF_live7c_1; + if ((x_92 < 3)) { + x_180 = 1; + } else { + float const x_318 = x_25.injectionSwitch.x; + x_180 = int(x_318); + } + int const x_320 = x_180; + int const x_93 = GLF_live7r_1; + indexable = x_312; + float const x_324 = indexable[x_320][select(0, 1, (x_93 < 3))]; + float const x_326 = GLF_live7sums.arr[x_310]; + GLF_live7sums.arr[x_310] = (x_326 + x_324); + int const x_94 = GLF_live7sum_index; + int const x_95 = GLF_live7sum_index; + int const x_96 = GLF_live7sum_index; + int const x_332 = select(0, x_96, ((x_94 >= 0) && (x_95 < 9))); + int const x_97 = GLF_live7r_1; + float const x_334 = GLF_live7m42[1][x_97]; + float const x_336 = GLF_live7sums.arr[x_332]; + GLF_live7sums.arr[x_332] = (x_336 + x_334); + { + int const x_98 = GLF_live7r_1; + GLF_live7r_1 = (x_98 + 1); + } + } + { + int const x_100 = GLF_live7c_1; + GLF_live7c_1 = (x_100 + 1); + } + } + int const x_102 = GLF_live7sum_index; + GLF_live7sum_index = (x_102 + 1); + { + int const x_104 = GLF_live7cols_1; + GLF_live7cols_1 = (x_104 + 1); + } + } + { + int const x_106 = GLF_live4i; + GLF_live4i = (x_106 + 1); + } + } + return float3(1.0f, 1.0f, 1.0f); +} + +void main_1(constant buf0& x_25, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 position = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + int i = 0; + float2 param_2 = 0.0f; + float const x_161 = x_25.injectionSwitch.x; + if ((x_161 >= 2.0f)) { + float4 const x_165 = *(tint_symbol_5); + position = float2(x_165.x, x_165.y); + float2 const x_167 = position; + param = x_167; + float3 const x_168 = drawShape_vf2_(x_25, &(param)); + float2 const x_169 = position; + param_1 = x_169; + float3 const x_170 = drawShape_vf2_(x_25, &(param_1)); + i = 25; + while (true) { + int const x_108 = i; + if ((x_108 > 0)) { + } else { + break; + } + float2 const x_177 = position; + param_2 = x_177; + float3 const x_178 = drawShape_vf2_(x_25, &(param_2)); + { + int const x_109 = i; + i = (x_109 - 1); + } + } + } + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_25 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_25, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..694e3520ab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.spvasm @@ -0,0 +1,663 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 403 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_25 "x_25" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %drawShape_vf2_ "drawShape_vf2_" + OpName %pos "pos" + OpName %c2 "c2" + OpName %c3 "c3" + OpName %c4 "c4" + OpName %c5 "c5" + OpName %c6 "c6" + OpName %GLF_live4i "GLF_live4i" + OpName %GLF_live4_looplimiter5 "GLF_live4_looplimiter5" + OpName %GLF_live7m42 "GLF_live7m42" + OpName %GLF_live7m33 "GLF_live7m33" + OpName %GLF_live7cols "GLF_live7cols" + OpName %GLF_live7_looplimiter3 "GLF_live7_looplimiter3" + OpName %GLF_live7rows "GLF_live7rows" + OpName %GLF_live7_looplimiter2 "GLF_live7_looplimiter2" + OpName %GLF_live7_looplimiter1 "GLF_live7_looplimiter1" + OpName %GLF_live7c "GLF_live7c" + OpName %GLF_live7r "GLF_live7r" + OpName %GLF_live7_looplimiter0 "GLF_live7_looplimiter0" + OpName %GLF_live7sum_index "GLF_live7sum_index" + OpName %GLF_live7_looplimiter7 "GLF_live7_looplimiter7" + OpName %GLF_live7cols_1 "GLF_live7cols_1" + OpName %GLF_live7rows_1 "GLF_live7rows_1" + OpName %GLF_live7sums "GLF_live7sums" + OpName %GLF_live7c_1 "GLF_live7c_1" + OpName %GLF_live7r_1 "GLF_live7r_1" + OpName %x_180 "x_180" + OpName %indexable "indexable" + OpName %main_1 "main_1" + OpName %position "position" + OpName %param "param" + OpName %param_1 "param_1" + OpName %i "i" + OpName %param_2 "param_2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_25 NonWritable + OpDecorate %x_25 DescriptorSet 0 + OpDecorate %x_25 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_25 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpTypeFunction %v3float %_ptr_Function_v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %24 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %32 = OpConstantNull %int +%mat4v2float = OpTypeMatrix %v2float 4 +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float + %37 = OpConstantNull %mat4v2float +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %41 = OpConstantNull %mat3v3float + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %59 = OpConstantNull %_arr_float_uint_9 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %74 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %uint_1 = OpConstant %uint 1 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_7 = OpConstant %int 7 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %125 = OpConstantComposite %v2float %float_1 %float_0 + %126 = OpConstantComposite %v2float %float_0 %float_1 + %127 = OpConstantComposite %v2float %float_0 %float_0 + %128 = OpConstantComposite %mat4v2float %125 %126 %127 %125 + %129 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %130 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %131 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %132 = OpConstantComposite %mat3v3float %129 %130 %131 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_9 = OpConstant %int 9 + %void = OpTypeVoid + %348 = OpTypeFunction %void + %353 = OpConstantNull %v2float + %float_2 = OpConstant %float 2 + %int_25 = OpConstant %int 25 + %389 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %390 = OpTypeFunction %void %main_out +%drawShape_vf2_ = OpFunction %v3float None %15 + %pos = OpFunctionParameter %_ptr_Function_v2float + %20 = OpLabel + %c2 = OpVariable %_ptr_Function_bool Function %24 + %c3 = OpVariable %_ptr_Function_bool Function %24 + %c4 = OpVariable %_ptr_Function_bool Function %24 + %c5 = OpVariable %_ptr_Function_bool Function %24 + %c6 = OpVariable %_ptr_Function_bool Function %24 + %GLF_live4i = OpVariable %_ptr_Function_int Function %32 +%GLF_live4_looplimiter5 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7m42 = OpVariable %_ptr_Function_mat4v2float Function %37 +%GLF_live7m33 = OpVariable %_ptr_Function_mat3v3float Function %41 +%GLF_live7cols = OpVariable %_ptr_Function_int Function %32 +%GLF_live7_looplimiter3 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7rows = OpVariable %_ptr_Function_int Function %32 +%GLF_live7_looplimiter2 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7_looplimiter1 = OpVariable %_ptr_Function_int Function %32 + %GLF_live7c = OpVariable %_ptr_Function_int Function %32 + %GLF_live7r = OpVariable %_ptr_Function_int Function %32 +%GLF_live7_looplimiter0 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7sum_index = OpVariable %_ptr_Function_int Function %32 +%GLF_live7_looplimiter7 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7cols_1 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7rows_1 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7sums = OpVariable %_ptr_Function__arr_float_uint_9 Function %59 +%GLF_live7c_1 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7r_1 = OpVariable %_ptr_Function_int Function %32 + %x_180 = OpVariable %_ptr_Function_int Function %32 + %indexable = OpVariable %_ptr_Function_mat3v3float Function %41 + %67 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %68 = OpLoad %float %67 + %70 = OpFOrdGreaterThan %bool %68 %float_1 + OpStore %c2 %70 + %71 = OpLoad %bool %c2 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + OpReturnValue %74 + %72 = OpLabel + %77 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %78 = OpLoad %float %77 + %79 = OpFOrdLessThan %bool %78 %float_1 + OpStore %c3 %79 + %80 = OpLoad %bool %c3 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + OpReturnValue %74 + %81 = OpLabel + %84 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %85 = OpLoad %float %84 + %86 = OpFOrdGreaterThan %bool %85 %float_1 + OpStore %c4 %86 + %87 = OpLoad %bool %c4 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + OpReturnValue %74 + %88 = OpLabel + %91 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %92 = OpLoad %float %91 + %93 = OpFOrdLessThan %bool %92 %float_1 + OpStore %c5 %93 + %94 = OpLoad %bool %c5 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + OpReturnValue %74 + %95 = OpLabel + %98 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %99 = OpLoad %float %98 + %100 = OpFAdd %float %99 %float_1 + %101 = OpFOrdGreaterThan %bool %100 %float_1 + OpStore %c6 %101 + %102 = OpLoad %bool %c6 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %103 + %104 = OpLabel + OpReturnValue %74 + %103 = OpLabel + OpStore %GLF_live4i %int_0 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %110 = OpLoad %int %GLF_live4i + %112 = OpSLessThan %bool %110 %int_4 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %115 + %114 = OpLabel + OpBranch %113 + %115 = OpLabel + OpBranch %107 + %113 = OpLabel + %116 = OpLoad %int %GLF_live4_looplimiter5 + %118 = OpSGreaterThanEqual %bool %116 %int_7 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %119 + %120 = OpLabel + OpBranch %107 + %119 = OpLabel + %121 = OpLoad %int %GLF_live4_looplimiter5 + %123 = OpIAdd %int %121 %int_1 + OpStore %GLF_live4_looplimiter5 %123 + OpStore %GLF_live7m42 %128 + OpStore %GLF_live7m33 %132 + OpStore %GLF_live7cols %int_2 + OpBranch %134 + %134 = OpLabel + OpLoopMerge %135 %136 None + OpBranch %137 + %137 = OpLabel + %138 = OpLoad %int %GLF_live7cols + %139 = OpSLessThan %bool %138 %int_4 + OpSelectionMerge %140 None + OpBranchConditional %139 %141 %142 + %141 = OpLabel + OpBranch %140 + %142 = OpLabel + OpBranch %135 + %140 = OpLabel + %143 = OpLoad %int %GLF_live7_looplimiter3 + %144 = OpSGreaterThanEqual %bool %143 %int_7 + OpSelectionMerge %145 None + OpBranchConditional %144 %146 %145 + %146 = OpLabel + OpBranch %135 + %145 = OpLabel + %147 = OpLoad %int %GLF_live7_looplimiter3 + %148 = OpIAdd %int %147 %int_1 + OpStore %GLF_live7_looplimiter3 %148 + OpStore %GLF_live7rows %int_2 + OpBranch %149 + %149 = OpLabel + OpLoopMerge %150 %151 None + OpBranch %152 + %152 = OpLabel + %153 = OpLoad %int %GLF_live7rows + %154 = OpSLessThan %bool %153 %int_4 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %157 + %156 = OpLabel + OpBranch %155 + %157 = OpLabel + OpBranch %150 + %155 = OpLabel + %158 = OpLoad %int %GLF_live7_looplimiter2 + %159 = OpSGreaterThanEqual %bool %158 %int_7 + OpSelectionMerge %160 None + OpBranchConditional %159 %161 %160 + %161 = OpLabel + OpBranch %150 + %160 = OpLabel + %162 = OpLoad %int %GLF_live7_looplimiter2 + %163 = OpIAdd %int %162 %int_1 + OpStore %GLF_live7_looplimiter2 %163 + OpStore %GLF_live7_looplimiter1 %int_0 + OpStore %GLF_live7c %int_0 + OpBranch %164 + %164 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %int %GLF_live7c + %170 = OpSLessThan %bool %168 %int_3 + OpSelectionMerge %171 None + OpBranchConditional %170 %172 %173 + %172 = OpLabel + OpBranch %171 + %173 = OpLabel + OpBranch %165 + %171 = OpLabel + %174 = OpLoad %int %GLF_live7_looplimiter1 + %175 = OpSGreaterThanEqual %bool %174 %int_7 + OpSelectionMerge %176 None + OpBranchConditional %175 %177 %176 + %177 = OpLabel + OpBranch %165 + %176 = OpLabel + %178 = OpLoad %int %GLF_live7_looplimiter1 + %179 = OpIAdd %int %178 %int_1 + OpStore %GLF_live7_looplimiter1 %179 + OpStore %GLF_live7r %int_0 + OpBranch %180 + %180 = OpLabel + OpLoopMerge %181 %182 None + OpBranch %183 + %183 = OpLabel + %184 = OpLoad %int %GLF_live7r + %185 = OpSLessThan %bool %184 %int_2 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + OpBranch %186 + %188 = OpLabel + OpBranch %181 + %186 = OpLabel + %189 = OpLoad %int %GLF_live7_looplimiter0 + %190 = OpSGreaterThanEqual %bool %189 %int_7 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %191 + %192 = OpLabel + OpBranch %181 + %191 = OpLabel + %193 = OpLoad %int %GLF_live7_looplimiter0 + %194 = OpIAdd %int %193 %int_1 + OpStore %GLF_live7_looplimiter0 %194 + %195 = OpLoad %int %GLF_live7c + %196 = OpLoad %int %GLF_live7c + %197 = OpLoad %int %GLF_live7c + %198 = OpLoad %int %GLF_live7r + %199 = OpLoad %int %GLF_live7r + %200 = OpLoad %int %GLF_live7r + %202 = OpSGreaterThanEqual %bool %195 %int_0 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %203 + %204 = OpLabel + %205 = OpSLessThan %bool %196 %int_3 + OpBranch %203 + %203 = OpLabel + %206 = OpPhi %bool %202 %191 %205 %204 + %201 = OpSelect %int %206 %197 %int_0 + %208 = OpSGreaterThanEqual %bool %198 %int_0 + OpSelectionMerge %209 None + OpBranchConditional %208 %210 %209 + %210 = OpLabel + %211 = OpSLessThan %bool %199 %int_3 + OpBranch %209 + %209 = OpLabel + %212 = OpPhi %bool %208 %203 %211 %210 + %207 = OpSelect %int %212 %200 %int_0 + %213 = OpAccessChain %_ptr_Function_float %GLF_live7m33 %201 %207 + OpStore %213 %float_1 + %215 = OpAccessChain %_ptr_Uniform_float %x_25 %uint_0 %uint_1 + %216 = OpLoad %float %215 + %217 = OpFOrdGreaterThan %bool %float_0 %216 + OpSelectionMerge %218 None + OpBranchConditional %217 %219 %220 + %219 = OpLabel + OpBranch %218 + %220 = OpLabel + %221 = OpLoad %int %GLF_live7c + %222 = OpLoad %int %GLF_live7c + %223 = OpLoad %int %GLF_live7c + %224 = OpLoad %int %GLF_live7r + %225 = OpLoad %int %GLF_live7r + %226 = OpLoad %int %GLF_live7r + %228 = OpSGreaterThanEqual %bool %221 %int_0 + OpSelectionMerge %229 None + OpBranchConditional %228 %230 %229 + %230 = OpLabel + %231 = OpSLessThan %bool %222 %int_4 + OpBranch %229 + %229 = OpLabel + %232 = OpPhi %bool %228 %220 %231 %230 + %227 = OpSelect %int %232 %223 %int_0 + %234 = OpSGreaterThanEqual %bool %224 %int_0 + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %235 + %236 = OpLabel + %237 = OpSLessThan %bool %225 %int_2 + OpBranch %235 + %235 = OpLabel + %238 = OpPhi %bool %234 %229 %237 %236 + %233 = OpSelect %int %238 %226 %int_0 + %239 = OpAccessChain %_ptr_Function_float %GLF_live7m42 %227 %233 + OpStore %239 %float_1 + OpBranch %218 + %218 = OpLabel + OpBranch %182 + %182 = OpLabel + %240 = OpLoad %int %GLF_live7r + %241 = OpIAdd %int %240 %int_1 + OpStore %GLF_live7r %241 + OpBranch %180 + %181 = OpLabel + OpBranch %166 + %166 = OpLabel + %242 = OpLoad %int %GLF_live7c + %243 = OpIAdd %int %242 %int_1 + OpStore %GLF_live7c %243 + OpBranch %164 + %165 = OpLabel + OpBranch %151 + %151 = OpLabel + %244 = OpLoad %int %GLF_live7rows + %245 = OpIAdd %int %244 %int_1 + OpStore %GLF_live7rows %245 + OpBranch %149 + %150 = OpLabel + OpBranch %136 + %136 = OpLabel + %246 = OpLoad %int %GLF_live7cols + %247 = OpIAdd %int %246 %int_1 + OpStore %GLF_live7cols %247 + OpBranch %134 + %135 = OpLabel + OpStore %GLF_live7sum_index %int_0 + OpStore %GLF_live7_looplimiter7 %int_0 + OpStore %GLF_live7cols_1 %int_2 + OpBranch %248 + %248 = OpLabel + OpLoopMerge %249 %250 None + OpBranch %251 + %251 = OpLabel + %252 = OpLoad %int %GLF_live7cols_1 + %253 = OpSLessThan %bool %252 %int_4 + OpSelectionMerge %254 None + OpBranchConditional %253 %255 %256 + %255 = OpLabel + OpBranch %254 + %256 = OpLabel + OpBranch %249 + %254 = OpLabel + %257 = OpLoad %int %GLF_live7_looplimiter7 + %258 = OpSGreaterThanEqual %bool %257 %int_7 + OpSelectionMerge %259 None + OpBranchConditional %258 %260 %259 + %260 = OpLabel + OpBranch %249 + %259 = OpLabel + %261 = OpLoad %int %GLF_live7_looplimiter7 + %262 = OpIAdd %int %261 %int_1 + OpStore %GLF_live7_looplimiter7 %262 + OpStore %GLF_live7rows_1 %int_2 + %263 = OpLoad %int %GLF_live7sum_index + %264 = OpLoad %int %GLF_live7sum_index + %265 = OpLoad %int %GLF_live7sum_index + %267 = OpSGreaterThanEqual %bool %263 %int_0 + OpSelectionMerge %268 None + OpBranchConditional %267 %269 %268 + %269 = OpLabel + %271 = OpSLessThan %bool %264 %int_9 + OpBranch %268 + %268 = OpLabel + %272 = OpPhi %bool %267 %259 %271 %269 + %266 = OpSelect %int %272 %265 %int_0 + %273 = OpAccessChain %_ptr_Function_float %GLF_live7sums %266 + OpStore %273 %float_0 + OpStore %GLF_live7c_1 %int_0 + OpBranch %274 + %274 = OpLabel + OpLoopMerge %275 %276 None + OpBranch %277 + %277 = OpLabel + %278 = OpLoad %int %GLF_live7c_1 + %279 = OpSLessThan %bool %278 %int_1 + OpSelectionMerge %280 None + OpBranchConditional %279 %281 %282 + %281 = OpLabel + OpBranch %280 + %282 = OpLabel + OpBranch %275 + %280 = OpLabel + OpStore %GLF_live7r_1 %int_0 + OpBranch %283 + %283 = OpLabel + OpLoopMerge %284 %285 None + OpBranch %286 + %286 = OpLabel + %287 = OpLoad %int %GLF_live7r_1 + %288 = OpLoad %int %GLF_live7rows_1 + %289 = OpSLessThan %bool %287 %288 + OpSelectionMerge %290 None + OpBranchConditional %289 %291 %292 + %291 = OpLabel + OpBranch %290 + %292 = OpLabel + OpBranch %284 + %290 = OpLabel + %293 = OpLoad %int %GLF_live7sum_index + %294 = OpLoad %int %GLF_live7sum_index + %295 = OpLoad %int %GLF_live7sum_index + %297 = OpSGreaterThanEqual %bool %293 %int_0 + OpSelectionMerge %298 None + OpBranchConditional %297 %299 %298 + %299 = OpLabel + %300 = OpSLessThan %bool %294 %int_9 + OpBranch %298 + %298 = OpLabel + %301 = OpPhi %bool %297 %290 %300 %299 + %296 = OpSelect %int %301 %295 %int_0 + %302 = OpLoad %mat3v3float %GLF_live7m33 + %303 = OpTranspose %mat3v3float %302 + %304 = OpLoad %int %GLF_live7c_1 + %305 = OpSLessThan %bool %304 %int_3 + OpSelectionMerge %306 None + OpBranchConditional %305 %307 %308 + %307 = OpLabel + OpStore %x_180 %int_1 + OpBranch %306 + %308 = OpLabel + %309 = OpAccessChain %_ptr_Uniform_float %x_25 %uint_0 %uint_0 + %310 = OpLoad %float %309 + %311 = OpConvertFToS %int %310 + OpStore %x_180 %311 + OpBranch %306 + %306 = OpLabel + %312 = OpLoad %int %x_180 + %313 = OpLoad %int %GLF_live7r_1 + OpStore %indexable %303 + %315 = OpSLessThan %bool %313 %int_3 + %314 = OpSelect %int %315 %int_1 %int_0 + %316 = OpAccessChain %_ptr_Function_float %indexable %312 %314 + %317 = OpLoad %float %316 + %318 = OpAccessChain %_ptr_Function_float %GLF_live7sums %296 + %319 = OpLoad %float %318 + %320 = OpAccessChain %_ptr_Function_float %GLF_live7sums %296 + %321 = OpFAdd %float %319 %317 + OpStore %320 %321 + %322 = OpLoad %int %GLF_live7sum_index + %323 = OpLoad %int %GLF_live7sum_index + %324 = OpLoad %int %GLF_live7sum_index + %326 = OpSGreaterThanEqual %bool %322 %int_0 + OpSelectionMerge %327 None + OpBranchConditional %326 %328 %327 + %328 = OpLabel + %329 = OpSLessThan %bool %323 %int_9 + OpBranch %327 + %327 = OpLabel + %330 = OpPhi %bool %326 %306 %329 %328 + %325 = OpSelect %int %330 %324 %int_0 + %331 = OpLoad %int %GLF_live7r_1 + %332 = OpAccessChain %_ptr_Function_float %GLF_live7m42 %int_1 %331 + %333 = OpLoad %float %332 + %334 = OpAccessChain %_ptr_Function_float %GLF_live7sums %325 + %335 = OpLoad %float %334 + %336 = OpAccessChain %_ptr_Function_float %GLF_live7sums %325 + %337 = OpFAdd %float %335 %333 + OpStore %336 %337 + OpBranch %285 + %285 = OpLabel + %338 = OpLoad %int %GLF_live7r_1 + %339 = OpIAdd %int %338 %int_1 + OpStore %GLF_live7r_1 %339 + OpBranch %283 + %284 = OpLabel + OpBranch %276 + %276 = OpLabel + %340 = OpLoad %int %GLF_live7c_1 + %341 = OpIAdd %int %340 %int_1 + OpStore %GLF_live7c_1 %341 + OpBranch %274 + %275 = OpLabel + %342 = OpLoad %int %GLF_live7sum_index + %343 = OpIAdd %int %342 %int_1 + OpStore %GLF_live7sum_index %343 + OpBranch %250 + %250 = OpLabel + %344 = OpLoad %int %GLF_live7cols_1 + %345 = OpIAdd %int %344 %int_1 + OpStore %GLF_live7cols_1 %345 + OpBranch %248 + %249 = OpLabel + OpBranch %108 + %108 = OpLabel + %346 = OpLoad %int %GLF_live4i + %347 = OpIAdd %int %346 %int_1 + OpStore %GLF_live4i %347 + OpBranch %106 + %107 = OpLabel + OpReturnValue %74 + OpFunctionEnd + %main_1 = OpFunction %void None %348 + %351 = OpLabel + %position = OpVariable %_ptr_Function_v2float Function %353 + %param = OpVariable %_ptr_Function_v2float Function %353 + %param_1 = OpVariable %_ptr_Function_v2float Function %353 + %i = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_v2float Function %353 + %358 = OpAccessChain %_ptr_Uniform_float %x_25 %uint_0 %uint_0 + %359 = OpLoad %float %358 + %361 = OpFOrdGreaterThanEqual %bool %359 %float_2 + OpSelectionMerge %362 None + OpBranchConditional %361 %363 %362 + %363 = OpLabel + %364 = OpLoad %v4float %gl_FragCoord + %365 = OpCompositeExtract %float %364 0 + %366 = OpCompositeExtract %float %364 1 + %367 = OpCompositeConstruct %v2float %365 %366 + OpStore %position %367 + %368 = OpLoad %v2float %position + OpStore %param %368 + %369 = OpFunctionCall %v3float %drawShape_vf2_ %param + %371 = OpLoad %v2float %position + OpStore %param_1 %371 + %372 = OpFunctionCall %v3float %drawShape_vf2_ %param_1 + OpStore %i %int_25 + OpBranch %375 + %375 = OpLabel + OpLoopMerge %376 %377 None + OpBranch %378 + %378 = OpLabel + %379 = OpLoad %int %i + %380 = OpSGreaterThan %bool %379 %int_0 + OpSelectionMerge %381 None + OpBranchConditional %380 %382 %383 + %382 = OpLabel + OpBranch %381 + %383 = OpLabel + OpBranch %376 + %381 = OpLabel + %384 = OpLoad %v2float %position + OpStore %param_2 %384 + %385 = OpFunctionCall %v3float %drawShape_vf2_ %param_2 + OpBranch %377 + %377 = OpLabel + %387 = OpLoad %int %i + %388 = OpISub %int %387 %int_1 + OpStore %i %388 + OpBranch %375 + %376 = OpLabel + OpBranch %362 + %362 = OpLabel + OpStore %x_GLF_color %389 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %390 +%tint_symbol_1 = OpFunctionParameter %main_out + %394 = OpLabel + %395 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %395 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %348 + %397 = OpLabel + %398 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %398 + %399 = OpFunctionCall %void %main_1 + %401 = OpLoad %v4float %x_GLF_color + %402 = OpCompositeConstruct %main_out %401 + %400 = OpFunctionCall %void %tint_symbol_3 %402 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..9ca6d3775a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.wgsl @@ -0,0 +1,317 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_25 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn drawShape_vf2_(pos : ptr>) -> vec3 { + var c2 : bool; + var c3 : bool; + var c4 : bool; + var c5 : bool; + var c6 : bool; + var GLF_live4i : i32; + var GLF_live4_looplimiter5 : i32; + var GLF_live7m42 : mat4x2; + var GLF_live7m33 : mat3x3; + var GLF_live7cols : i32; + var GLF_live7_looplimiter3 : i32; + var GLF_live7rows : i32; + var GLF_live7_looplimiter2 : i32; + var GLF_live7_looplimiter1 : i32; + var GLF_live7c : i32; + var GLF_live7r : i32; + var GLF_live7_looplimiter0 : i32; + var GLF_live7sum_index : i32; + var GLF_live7_looplimiter7 : i32; + var GLF_live7cols_1 : i32; + var GLF_live7rows_1 : i32; + var GLF_live7sums : array; + var GLF_live7c_1 : i32; + var GLF_live7r_1 : i32; + var x_180 : i32; + var indexable : mat3x3; + let x_182 : f32 = (*(pos)).x; + c2 = (x_182 > 1.0); + let x_184 : bool = c2; + if (x_184) { + return vec3(1.0, 1.0, 1.0); + } + let x_188 : f32 = (*(pos)).y; + c3 = (x_188 < 1.0); + let x_190 : bool = c3; + if (x_190) { + return vec3(1.0, 1.0, 1.0); + } + let x_194 : f32 = (*(pos)).y; + c4 = (x_194 > 1.0); + let x_196 : bool = c4; + if (x_196) { + return vec3(1.0, 1.0, 1.0); + } + let x_200 : f32 = (*(pos)).x; + c5 = (x_200 < 1.0); + let x_202 : bool = c5; + if (x_202) { + return vec3(1.0, 1.0, 1.0); + } + let x_206 : f32 = (*(pos)).x; + c6 = ((x_206 + 1.0) > 1.0); + let x_209 : bool = c6; + if (x_209) { + return vec3(1.0, 1.0, 1.0); + } + GLF_live4i = 0; + loop { + let x_39 : i32 = GLF_live4i; + if ((x_39 < 4)) { + } else { + break; + } + let x_40 : i32 = GLF_live4_looplimiter5; + if ((x_40 >= 7)) { + break; + } + let x_41 : i32 = GLF_live4_looplimiter5; + GLF_live4_looplimiter5 = (x_41 + 1); + GLF_live7m42 = mat4x2(vec2(1.0, 0.0), vec2(0.0, 1.0), vec2(0.0, 0.0), vec2(1.0, 0.0)); + GLF_live7m33 = mat3x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0)); + GLF_live7cols = 2; + loop { + let x_43 : i32 = GLF_live7cols; + if ((x_43 < 4)) { + } else { + break; + } + let x_44 : i32 = GLF_live7_looplimiter3; + if ((x_44 >= 7)) { + break; + } + let x_45 : i32 = GLF_live7_looplimiter3; + GLF_live7_looplimiter3 = (x_45 + 1); + GLF_live7rows = 2; + loop { + let x_47 : i32 = GLF_live7rows; + if ((x_47 < 4)) { + } else { + break; + } + let x_48 : i32 = GLF_live7_looplimiter2; + if ((x_48 >= 7)) { + break; + } + let x_49 : i32 = GLF_live7_looplimiter2; + GLF_live7_looplimiter2 = (x_49 + 1); + GLF_live7_looplimiter1 = 0; + GLF_live7c = 0; + loop { + let x_51 : i32 = GLF_live7c; + if ((x_51 < 3)) { + } else { + break; + } + let x_52 : i32 = GLF_live7_looplimiter1; + if ((x_52 >= 7)) { + break; + } + let x_53 : i32 = GLF_live7_looplimiter1; + GLF_live7_looplimiter1 = (x_53 + 1); + GLF_live7r = 0; + loop { + let x_55 : i32 = GLF_live7r; + if ((x_55 < 2)) { + } else { + break; + } + let x_56 : i32 = GLF_live7_looplimiter0; + if ((x_56 >= 7)) { + break; + } + let x_57 : i32 = GLF_live7_looplimiter0; + GLF_live7_looplimiter0 = (x_57 + 1); + let x_59 : i32 = GLF_live7c; + let x_60 : i32 = GLF_live7c; + let x_61 : i32 = GLF_live7c; + let x_62 : i32 = GLF_live7r; + let x_63 : i32 = GLF_live7r; + let x_64 : i32 = GLF_live7r; + GLF_live7m33[select(0, x_61, ((x_59 >= 0) && (x_60 < 3)))][select(0, x_64, ((x_62 >= 0) && (x_63 < 3)))] = 1.0; + let x_267 : f32 = x_25.injectionSwitch.y; + if ((0.0 > x_267)) { + } else { + let x_65 : i32 = GLF_live7c; + let x_66 : i32 = GLF_live7c; + let x_67 : i32 = GLF_live7c; + let x_68 : i32 = GLF_live7r; + let x_69 : i32 = GLF_live7r; + let x_70 : i32 = GLF_live7r; + GLF_live7m42[select(0, x_67, ((x_65 >= 0) && (x_66 < 4)))][select(0, x_70, ((x_68 >= 0) && (x_69 < 2)))] = 1.0; + } + + continuing { + let x_71 : i32 = GLF_live7r; + GLF_live7r = (x_71 + 1); + } + } + + continuing { + let x_73 : i32 = GLF_live7c; + GLF_live7c = (x_73 + 1); + } + } + + continuing { + let x_75 : i32 = GLF_live7rows; + GLF_live7rows = (x_75 + 1); + } + } + + continuing { + let x_77 : i32 = GLF_live7cols; + GLF_live7cols = (x_77 + 1); + } + } + GLF_live7sum_index = 0; + GLF_live7_looplimiter7 = 0; + GLF_live7cols_1 = 2; + loop { + let x_79 : i32 = GLF_live7cols_1; + if ((x_79 < 4)) { + } else { + break; + } + let x_80 : i32 = GLF_live7_looplimiter7; + if ((x_80 >= 7)) { + break; + } + let x_81 : i32 = GLF_live7_looplimiter7; + GLF_live7_looplimiter7 = (x_81 + 1); + GLF_live7rows_1 = 2; + let x_83 : i32 = GLF_live7sum_index; + let x_84 : i32 = GLF_live7sum_index; + let x_85 : i32 = GLF_live7sum_index; + GLF_live7sums[select(0, x_85, ((x_83 >= 0) && (x_84 < 9)))] = 0.0; + GLF_live7c_1 = 0; + loop { + let x_86 : i32 = GLF_live7c_1; + if ((x_86 < 1)) { + } else { + break; + } + GLF_live7r_1 = 0; + loop { + let x_87 : i32 = GLF_live7r_1; + let x_88 : i32 = GLF_live7rows_1; + if ((x_87 < x_88)) { + } else { + break; + } + let x_89 : i32 = GLF_live7sum_index; + let x_90 : i32 = GLF_live7sum_index; + let x_91 : i32 = GLF_live7sum_index; + let x_310 : i32 = select(0, x_91, ((x_89 >= 0) && (x_90 < 9))); + let x_311 : mat3x3 = GLF_live7m33; + let x_312 : mat3x3 = transpose(x_311); + let x_92 : i32 = GLF_live7c_1; + if ((x_92 < 3)) { + x_180 = 1; + } else { + let x_318 : f32 = x_25.injectionSwitch.x; + x_180 = i32(x_318); + } + let x_320 : i32 = x_180; + let x_93 : i32 = GLF_live7r_1; + indexable = x_312; + let x_324 : f32 = indexable[x_320][select(0, 1, (x_93 < 3))]; + let x_326 : f32 = GLF_live7sums[x_310]; + GLF_live7sums[x_310] = (x_326 + x_324); + let x_94 : i32 = GLF_live7sum_index; + let x_95 : i32 = GLF_live7sum_index; + let x_96 : i32 = GLF_live7sum_index; + let x_332 : i32 = select(0, x_96, ((x_94 >= 0) && (x_95 < 9))); + let x_97 : i32 = GLF_live7r_1; + let x_334 : f32 = GLF_live7m42[1][x_97]; + let x_336 : f32 = GLF_live7sums[x_332]; + GLF_live7sums[x_332] = (x_336 + x_334); + + continuing { + let x_98 : i32 = GLF_live7r_1; + GLF_live7r_1 = (x_98 + 1); + } + } + + continuing { + let x_100 : i32 = GLF_live7c_1; + GLF_live7c_1 = (x_100 + 1); + } + } + let x_102 : i32 = GLF_live7sum_index; + GLF_live7sum_index = (x_102 + 1); + + continuing { + let x_104 : i32 = GLF_live7cols_1; + GLF_live7cols_1 = (x_104 + 1); + } + } + + continuing { + let x_106 : i32 = GLF_live4i; + GLF_live4i = (x_106 + 1); + } + } + return vec3(1.0, 1.0, 1.0); +} + +fn main_1() { + var position : vec2; + var param : vec2; + var param_1 : vec2; + var i : i32; + var param_2 : vec2; + let x_161 : f32 = x_25.injectionSwitch.x; + if ((x_161 >= 2.0)) { + let x_165 : vec4 = gl_FragCoord; + position = vec2(x_165.x, x_165.y); + let x_167 : vec2 = position; + param = x_167; + let x_168 : vec3 = drawShape_vf2_(&(param)); + let x_169 : vec2 = position; + param_1 = x_169; + let x_170 : vec3 = drawShape_vf2_(&(param_1)); + i = 25; + loop { + let x_108 : i32 = i; + if ((x_108 > 0)) { + } else { + break; + } + let x_177 : vec2 = position; + param_2 = x_177; + let x_178 : vec3 = drawShape_vf2_(&(param_2)); + + continuing { + let x_109 : i32 = i; + i = (x_109 - 1); + } + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl new file mode 100644 index 0000000000..9ca6d3775a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl @@ -0,0 +1,317 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_25 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn drawShape_vf2_(pos : ptr>) -> vec3 { + var c2 : bool; + var c3 : bool; + var c4 : bool; + var c5 : bool; + var c6 : bool; + var GLF_live4i : i32; + var GLF_live4_looplimiter5 : i32; + var GLF_live7m42 : mat4x2; + var GLF_live7m33 : mat3x3; + var GLF_live7cols : i32; + var GLF_live7_looplimiter3 : i32; + var GLF_live7rows : i32; + var GLF_live7_looplimiter2 : i32; + var GLF_live7_looplimiter1 : i32; + var GLF_live7c : i32; + var GLF_live7r : i32; + var GLF_live7_looplimiter0 : i32; + var GLF_live7sum_index : i32; + var GLF_live7_looplimiter7 : i32; + var GLF_live7cols_1 : i32; + var GLF_live7rows_1 : i32; + var GLF_live7sums : array; + var GLF_live7c_1 : i32; + var GLF_live7r_1 : i32; + var x_180 : i32; + var indexable : mat3x3; + let x_182 : f32 = (*(pos)).x; + c2 = (x_182 > 1.0); + let x_184 : bool = c2; + if (x_184) { + return vec3(1.0, 1.0, 1.0); + } + let x_188 : f32 = (*(pos)).y; + c3 = (x_188 < 1.0); + let x_190 : bool = c3; + if (x_190) { + return vec3(1.0, 1.0, 1.0); + } + let x_194 : f32 = (*(pos)).y; + c4 = (x_194 > 1.0); + let x_196 : bool = c4; + if (x_196) { + return vec3(1.0, 1.0, 1.0); + } + let x_200 : f32 = (*(pos)).x; + c5 = (x_200 < 1.0); + let x_202 : bool = c5; + if (x_202) { + return vec3(1.0, 1.0, 1.0); + } + let x_206 : f32 = (*(pos)).x; + c6 = ((x_206 + 1.0) > 1.0); + let x_209 : bool = c6; + if (x_209) { + return vec3(1.0, 1.0, 1.0); + } + GLF_live4i = 0; + loop { + let x_39 : i32 = GLF_live4i; + if ((x_39 < 4)) { + } else { + break; + } + let x_40 : i32 = GLF_live4_looplimiter5; + if ((x_40 >= 7)) { + break; + } + let x_41 : i32 = GLF_live4_looplimiter5; + GLF_live4_looplimiter5 = (x_41 + 1); + GLF_live7m42 = mat4x2(vec2(1.0, 0.0), vec2(0.0, 1.0), vec2(0.0, 0.0), vec2(1.0, 0.0)); + GLF_live7m33 = mat3x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0)); + GLF_live7cols = 2; + loop { + let x_43 : i32 = GLF_live7cols; + if ((x_43 < 4)) { + } else { + break; + } + let x_44 : i32 = GLF_live7_looplimiter3; + if ((x_44 >= 7)) { + break; + } + let x_45 : i32 = GLF_live7_looplimiter3; + GLF_live7_looplimiter3 = (x_45 + 1); + GLF_live7rows = 2; + loop { + let x_47 : i32 = GLF_live7rows; + if ((x_47 < 4)) { + } else { + break; + } + let x_48 : i32 = GLF_live7_looplimiter2; + if ((x_48 >= 7)) { + break; + } + let x_49 : i32 = GLF_live7_looplimiter2; + GLF_live7_looplimiter2 = (x_49 + 1); + GLF_live7_looplimiter1 = 0; + GLF_live7c = 0; + loop { + let x_51 : i32 = GLF_live7c; + if ((x_51 < 3)) { + } else { + break; + } + let x_52 : i32 = GLF_live7_looplimiter1; + if ((x_52 >= 7)) { + break; + } + let x_53 : i32 = GLF_live7_looplimiter1; + GLF_live7_looplimiter1 = (x_53 + 1); + GLF_live7r = 0; + loop { + let x_55 : i32 = GLF_live7r; + if ((x_55 < 2)) { + } else { + break; + } + let x_56 : i32 = GLF_live7_looplimiter0; + if ((x_56 >= 7)) { + break; + } + let x_57 : i32 = GLF_live7_looplimiter0; + GLF_live7_looplimiter0 = (x_57 + 1); + let x_59 : i32 = GLF_live7c; + let x_60 : i32 = GLF_live7c; + let x_61 : i32 = GLF_live7c; + let x_62 : i32 = GLF_live7r; + let x_63 : i32 = GLF_live7r; + let x_64 : i32 = GLF_live7r; + GLF_live7m33[select(0, x_61, ((x_59 >= 0) && (x_60 < 3)))][select(0, x_64, ((x_62 >= 0) && (x_63 < 3)))] = 1.0; + let x_267 : f32 = x_25.injectionSwitch.y; + if ((0.0 > x_267)) { + } else { + let x_65 : i32 = GLF_live7c; + let x_66 : i32 = GLF_live7c; + let x_67 : i32 = GLF_live7c; + let x_68 : i32 = GLF_live7r; + let x_69 : i32 = GLF_live7r; + let x_70 : i32 = GLF_live7r; + GLF_live7m42[select(0, x_67, ((x_65 >= 0) && (x_66 < 4)))][select(0, x_70, ((x_68 >= 0) && (x_69 < 2)))] = 1.0; + } + + continuing { + let x_71 : i32 = GLF_live7r; + GLF_live7r = (x_71 + 1); + } + } + + continuing { + let x_73 : i32 = GLF_live7c; + GLF_live7c = (x_73 + 1); + } + } + + continuing { + let x_75 : i32 = GLF_live7rows; + GLF_live7rows = (x_75 + 1); + } + } + + continuing { + let x_77 : i32 = GLF_live7cols; + GLF_live7cols = (x_77 + 1); + } + } + GLF_live7sum_index = 0; + GLF_live7_looplimiter7 = 0; + GLF_live7cols_1 = 2; + loop { + let x_79 : i32 = GLF_live7cols_1; + if ((x_79 < 4)) { + } else { + break; + } + let x_80 : i32 = GLF_live7_looplimiter7; + if ((x_80 >= 7)) { + break; + } + let x_81 : i32 = GLF_live7_looplimiter7; + GLF_live7_looplimiter7 = (x_81 + 1); + GLF_live7rows_1 = 2; + let x_83 : i32 = GLF_live7sum_index; + let x_84 : i32 = GLF_live7sum_index; + let x_85 : i32 = GLF_live7sum_index; + GLF_live7sums[select(0, x_85, ((x_83 >= 0) && (x_84 < 9)))] = 0.0; + GLF_live7c_1 = 0; + loop { + let x_86 : i32 = GLF_live7c_1; + if ((x_86 < 1)) { + } else { + break; + } + GLF_live7r_1 = 0; + loop { + let x_87 : i32 = GLF_live7r_1; + let x_88 : i32 = GLF_live7rows_1; + if ((x_87 < x_88)) { + } else { + break; + } + let x_89 : i32 = GLF_live7sum_index; + let x_90 : i32 = GLF_live7sum_index; + let x_91 : i32 = GLF_live7sum_index; + let x_310 : i32 = select(0, x_91, ((x_89 >= 0) && (x_90 < 9))); + let x_311 : mat3x3 = GLF_live7m33; + let x_312 : mat3x3 = transpose(x_311); + let x_92 : i32 = GLF_live7c_1; + if ((x_92 < 3)) { + x_180 = 1; + } else { + let x_318 : f32 = x_25.injectionSwitch.x; + x_180 = i32(x_318); + } + let x_320 : i32 = x_180; + let x_93 : i32 = GLF_live7r_1; + indexable = x_312; + let x_324 : f32 = indexable[x_320][select(0, 1, (x_93 < 3))]; + let x_326 : f32 = GLF_live7sums[x_310]; + GLF_live7sums[x_310] = (x_326 + x_324); + let x_94 : i32 = GLF_live7sum_index; + let x_95 : i32 = GLF_live7sum_index; + let x_96 : i32 = GLF_live7sum_index; + let x_332 : i32 = select(0, x_96, ((x_94 >= 0) && (x_95 < 9))); + let x_97 : i32 = GLF_live7r_1; + let x_334 : f32 = GLF_live7m42[1][x_97]; + let x_336 : f32 = GLF_live7sums[x_332]; + GLF_live7sums[x_332] = (x_336 + x_334); + + continuing { + let x_98 : i32 = GLF_live7r_1; + GLF_live7r_1 = (x_98 + 1); + } + } + + continuing { + let x_100 : i32 = GLF_live7c_1; + GLF_live7c_1 = (x_100 + 1); + } + } + let x_102 : i32 = GLF_live7sum_index; + GLF_live7sum_index = (x_102 + 1); + + continuing { + let x_104 : i32 = GLF_live7cols_1; + GLF_live7cols_1 = (x_104 + 1); + } + } + + continuing { + let x_106 : i32 = GLF_live4i; + GLF_live4i = (x_106 + 1); + } + } + return vec3(1.0, 1.0, 1.0); +} + +fn main_1() { + var position : vec2; + var param : vec2; + var param_1 : vec2; + var i : i32; + var param_2 : vec2; + let x_161 : f32 = x_25.injectionSwitch.x; + if ((x_161 >= 2.0)) { + let x_165 : vec4 = gl_FragCoord; + position = vec2(x_165.x, x_165.y); + let x_167 : vec2 = position; + param = x_167; + let x_168 : vec3 = drawShape_vf2_(&(param)); + let x_169 : vec2 = position; + param_1 = x_169; + let x_170 : vec3 = drawShape_vf2_(&(param_1)); + i = 25; + loop { + let x_108 : i32 = i; + if ((x_108 > 0)) { + } else { + break; + } + let x_177 : vec2 = position; + param_2 = x_177; + let x_178 : vec3 = drawShape_vf2_(&(param_2)); + + continuing { + let x_109 : i32 = i; + i = (x_109 - 1); + } + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..19070703c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.hlsl @@ -0,0 +1,237 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +cbuffer cbuffer_x_25 : register(b0, space0) { + uint4 x_25[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 drawShape_vf2_(inout float2 pos) { + bool c2 = false; + bool c3 = false; + bool c4 = false; + bool c5 = false; + bool c6 = false; + int GLF_live4i = 0; + int GLF_live4_looplimiter5 = 0; + float4x2 GLF_live7m42 = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x3 GLF_live7m33 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int GLF_live7cols = 0; + int GLF_live7_looplimiter3 = 0; + int GLF_live7rows = 0; + int GLF_live7_looplimiter2 = 0; + int GLF_live7_looplimiter1 = 0; + int GLF_live7c = 0; + int GLF_live7r = 0; + int GLF_live7_looplimiter0 = 0; + int GLF_live7sum_index = 0; + int GLF_live7_looplimiter7 = 0; + int GLF_live7cols_1 = 0; + int GLF_live7rows_1 = 0; + float GLF_live7sums[9] = (float[9])0; + int GLF_live7c_1 = 0; + int GLF_live7r_1 = 0; + int x_180 = 0; + float3x3 indexable = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + const float x_182 = pos.x; + c2 = (x_182 > 1.0f); + if (c2) { + return float3(1.0f, 1.0f, 1.0f); + } + const float x_188 = pos.y; + c3 = (x_188 < 1.0f); + if (c3) { + return float3(1.0f, 1.0f, 1.0f); + } + const float x_194 = pos.y; + c4 = (x_194 > 1.0f); + if (c4) { + return float3(1.0f, 1.0f, 1.0f); + } + const float x_200 = pos.x; + c5 = (x_200 < 1.0f); + if (c5) { + return float3(1.0f, 1.0f, 1.0f); + } + const float x_206 = pos.x; + c6 = ((x_206 + 1.0f) > 1.0f); + if (c6) { + return float3(1.0f, 1.0f, 1.0f); + } + GLF_live4i = 0; + { + for(; (GLF_live4i < 4); GLF_live4i = (GLF_live4i + 1)) { + if ((GLF_live4_looplimiter5 >= 7)) { + break; + } + GLF_live4_looplimiter5 = (GLF_live4_looplimiter5 + 1); + GLF_live7m42 = float4x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f), float2(0.0f, 0.0f), float2(1.0f, 0.0f)); + GLF_live7m33 = float3x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f)); + GLF_live7cols = 2; + { + for(; (GLF_live7cols < 4); GLF_live7cols = (GLF_live7cols + 1)) { + if ((GLF_live7_looplimiter3 >= 7)) { + break; + } + GLF_live7_looplimiter3 = (GLF_live7_looplimiter3 + 1); + GLF_live7rows = 2; + { + for(; (GLF_live7rows < 4); GLF_live7rows = (GLF_live7rows + 1)) { + if ((GLF_live7_looplimiter2 >= 7)) { + break; + } + GLF_live7_looplimiter2 = (GLF_live7_looplimiter2 + 1); + GLF_live7_looplimiter1 = 0; + GLF_live7c = 0; + { + for(; (GLF_live7c < 3); GLF_live7c = (GLF_live7c + 1)) { + if ((GLF_live7_looplimiter1 >= 7)) { + break; + } + GLF_live7_looplimiter1 = (GLF_live7_looplimiter1 + 1); + GLF_live7r = 0; + { + for(; (GLF_live7r < 2); GLF_live7r = (GLF_live7r + 1)) { + if ((GLF_live7_looplimiter0 >= 7)) { + break; + } + GLF_live7_looplimiter0 = (GLF_live7_looplimiter0 + 1); + bool tint_tmp = (GLF_live7c >= 0); + if (tint_tmp) { + tint_tmp = (GLF_live7c < 3); + } + bool tint_tmp_1 = (GLF_live7r >= 0); + if (tint_tmp_1) { + tint_tmp_1 = (GLF_live7r < 3); + } + set_float3(GLF_live7m33[((tint_tmp) ? GLF_live7c : 0)], ((tint_tmp_1) ? GLF_live7r : 0), 1.0f); + const float x_267 = asfloat(x_25[0].y); + if ((0.0f > x_267)) { + } else { + bool tint_tmp_2 = (GLF_live7c >= 0); + if (tint_tmp_2) { + tint_tmp_2 = (GLF_live7c < 4); + } + bool tint_tmp_3 = (GLF_live7r >= 0); + if (tint_tmp_3) { + tint_tmp_3 = (GLF_live7r < 2); + } + set_float2(GLF_live7m42[((tint_tmp_2) ? GLF_live7c : 0)], ((tint_tmp_3) ? GLF_live7r : 0), 1.0f); + } + } + } + } + } + } + } + } + } + GLF_live7sum_index = 0; + GLF_live7_looplimiter7 = 0; + GLF_live7cols_1 = 2; + { + for(; (GLF_live7cols_1 < 4); GLF_live7cols_1 = (GLF_live7cols_1 + 1)) { + if ((GLF_live7_looplimiter7 >= 7)) { + break; + } + GLF_live7_looplimiter7 = (GLF_live7_looplimiter7 + 1); + GLF_live7rows_1 = 2; + bool tint_tmp_4 = (GLF_live7sum_index >= 0); + if (tint_tmp_4) { + tint_tmp_4 = (GLF_live7sum_index < 9); + } + GLF_live7sums[((tint_tmp_4) ? GLF_live7sum_index : 0)] = 0.0f; + GLF_live7c_1 = 0; + { + for(; (GLF_live7c_1 < 1); GLF_live7c_1 = (GLF_live7c_1 + 1)) { + GLF_live7r_1 = 0; + { + for(; (GLF_live7r_1 < GLF_live7rows_1); GLF_live7r_1 = (GLF_live7r_1 + 1)) { + bool tint_tmp_5 = (GLF_live7sum_index >= 0); + if (tint_tmp_5) { + tint_tmp_5 = (GLF_live7sum_index < 9); + } + const int x_310 = ((tint_tmp_5) ? GLF_live7sum_index : 0); + const float3x3 x_312 = transpose(GLF_live7m33); + if ((GLF_live7c_1 < 3)) { + x_180 = 1; + } else { + const float x_318 = asfloat(x_25[0].x); + x_180 = int(x_318); + } + const int x_320 = x_180; + const int x_93 = GLF_live7r_1; + indexable = x_312; + const float x_324 = indexable[x_320][((x_93 < 3) ? 1 : 0)]; + const float x_326 = GLF_live7sums[x_310]; + GLF_live7sums[x_310] = (x_326 + x_324); + bool tint_tmp_6 = (GLF_live7sum_index >= 0); + if (tint_tmp_6) { + tint_tmp_6 = (GLF_live7sum_index < 9); + } + const int x_332 = ((tint_tmp_6) ? GLF_live7sum_index : 0); + const float x_334 = GLF_live7m42[1][GLF_live7r_1]; + const float x_336 = GLF_live7sums[x_332]; + GLF_live7sums[x_332] = (x_336 + x_334); + } + } + } + } + GLF_live7sum_index = (GLF_live7sum_index + 1); + } + } + } + } + return float3(1.0f, 1.0f, 1.0f); +} + +void main_1() { + float2 position = float2(0.0f, 0.0f); + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + int i = 0; + float2 param_2 = float2(0.0f, 0.0f); + const float x_161 = asfloat(x_25[0].x); + if ((x_161 >= 2.0f)) { + const float4 x_165 = gl_FragCoord; + position = float2(x_165.x, x_165.y); + param = position; + const float3 x_168 = drawShape_vf2_(param); + param_1 = position; + const float3 x_170 = drawShape_vf2_(param_1); + i = 25; + { + for(; (i > 0); i = (i - 1)) { + param_2 = position; + const float3 x_178 = drawShape_vf2_(param_2); + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..9f3a7ed7b2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.msl @@ -0,0 +1,312 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 drawShape_vf2_(constant buf0& x_25, thread float2* const pos) { + bool c2 = false; + bool c3 = false; + bool c4 = false; + bool c5 = false; + bool c6 = false; + int GLF_live4i = 0; + int GLF_live4_looplimiter5 = 0; + float4x2 GLF_live7m42 = float4x2(0.0f); + float3x3 GLF_live7m33 = float3x3(0.0f); + int GLF_live7cols = 0; + int GLF_live7_looplimiter3 = 0; + int GLF_live7rows = 0; + int GLF_live7_looplimiter2 = 0; + int GLF_live7_looplimiter1 = 0; + int GLF_live7c = 0; + int GLF_live7r = 0; + int GLF_live7_looplimiter0 = 0; + int GLF_live7sum_index = 0; + int GLF_live7_looplimiter7 = 0; + int GLF_live7cols_1 = 0; + int GLF_live7rows_1 = 0; + tint_array_wrapper GLF_live7sums = {}; + int GLF_live7c_1 = 0; + int GLF_live7r_1 = 0; + int x_180 = 0; + float3x3 indexable = float3x3(0.0f); + float const x_182 = (*(pos)).x; + c2 = (x_182 > 1.0f); + bool const x_184 = c2; + if (x_184) { + return float3(1.0f, 1.0f, 1.0f); + } + float const x_188 = (*(pos)).y; + c3 = (x_188 < 1.0f); + bool const x_190 = c3; + if (x_190) { + return float3(1.0f, 1.0f, 1.0f); + } + float const x_194 = (*(pos)).y; + c4 = (x_194 > 1.0f); + bool const x_196 = c4; + if (x_196) { + return float3(1.0f, 1.0f, 1.0f); + } + float const x_200 = (*(pos)).x; + c5 = (x_200 < 1.0f); + bool const x_202 = c5; + if (x_202) { + return float3(1.0f, 1.0f, 1.0f); + } + float const x_206 = (*(pos)).x; + c6 = ((x_206 + 1.0f) > 1.0f); + bool const x_209 = c6; + if (x_209) { + return float3(1.0f, 1.0f, 1.0f); + } + GLF_live4i = 0; + while (true) { + int const x_39 = GLF_live4i; + if ((x_39 < 4)) { + } else { + break; + } + int const x_40 = GLF_live4_looplimiter5; + if ((x_40 >= 7)) { + break; + } + int const x_41 = GLF_live4_looplimiter5; + GLF_live4_looplimiter5 = (x_41 + 1); + GLF_live7m42 = float4x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f), float2(0.0f, 0.0f), float2(1.0f, 0.0f)); + GLF_live7m33 = float3x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f)); + GLF_live7cols = 2; + while (true) { + int const x_43 = GLF_live7cols; + if ((x_43 < 4)) { + } else { + break; + } + int const x_44 = GLF_live7_looplimiter3; + if ((x_44 >= 7)) { + break; + } + int const x_45 = GLF_live7_looplimiter3; + GLF_live7_looplimiter3 = (x_45 + 1); + GLF_live7rows = 2; + while (true) { + int const x_47 = GLF_live7rows; + if ((x_47 < 4)) { + } else { + break; + } + int const x_48 = GLF_live7_looplimiter2; + if ((x_48 >= 7)) { + break; + } + int const x_49 = GLF_live7_looplimiter2; + GLF_live7_looplimiter2 = (x_49 + 1); + GLF_live7_looplimiter1 = 0; + GLF_live7c = 0; + while (true) { + int const x_51 = GLF_live7c; + if ((x_51 < 3)) { + } else { + break; + } + int const x_52 = GLF_live7_looplimiter1; + if ((x_52 >= 7)) { + break; + } + int const x_53 = GLF_live7_looplimiter1; + GLF_live7_looplimiter1 = (x_53 + 1); + GLF_live7r = 0; + while (true) { + int const x_55 = GLF_live7r; + if ((x_55 < 2)) { + } else { + break; + } + int const x_56 = GLF_live7_looplimiter0; + if ((x_56 >= 7)) { + break; + } + int const x_57 = GLF_live7_looplimiter0; + GLF_live7_looplimiter0 = (x_57 + 1); + int const x_59 = GLF_live7c; + int const x_60 = GLF_live7c; + int const x_61 = GLF_live7c; + int const x_62 = GLF_live7r; + int const x_63 = GLF_live7r; + int const x_64 = GLF_live7r; + GLF_live7m33[select(0, x_61, ((x_59 >= 0) && (x_60 < 3)))][select(0, x_64, ((x_62 >= 0) && (x_63 < 3)))] = 1.0f; + float const x_267 = x_25.injectionSwitch.y; + if ((0.0f > x_267)) { + } else { + int const x_65 = GLF_live7c; + int const x_66 = GLF_live7c; + int const x_67 = GLF_live7c; + int const x_68 = GLF_live7r; + int const x_69 = GLF_live7r; + int const x_70 = GLF_live7r; + GLF_live7m42[select(0, x_67, ((x_65 >= 0) && (x_66 < 4)))][select(0, x_70, ((x_68 >= 0) && (x_69 < 2)))] = 1.0f; + } + { + int const x_71 = GLF_live7r; + GLF_live7r = (x_71 + 1); + } + } + { + int const x_73 = GLF_live7c; + GLF_live7c = (x_73 + 1); + } + } + { + int const x_75 = GLF_live7rows; + GLF_live7rows = (x_75 + 1); + } + } + { + int const x_77 = GLF_live7cols; + GLF_live7cols = (x_77 + 1); + } + } + GLF_live7sum_index = 0; + GLF_live7_looplimiter7 = 0; + GLF_live7cols_1 = 2; + while (true) { + int const x_79 = GLF_live7cols_1; + if ((x_79 < 4)) { + } else { + break; + } + int const x_80 = GLF_live7_looplimiter7; + if ((x_80 >= 7)) { + break; + } + int const x_81 = GLF_live7_looplimiter7; + GLF_live7_looplimiter7 = (x_81 + 1); + GLF_live7rows_1 = 2; + int const x_83 = GLF_live7sum_index; + int const x_84 = GLF_live7sum_index; + int const x_85 = GLF_live7sum_index; + GLF_live7sums.arr[select(0, x_85, ((x_83 >= 0) && (x_84 < 9)))] = 0.0f; + GLF_live7c_1 = 0; + while (true) { + int const x_86 = GLF_live7c_1; + if ((x_86 < 1)) { + } else { + break; + } + GLF_live7r_1 = 0; + while (true) { + int const x_87 = GLF_live7r_1; + int const x_88 = GLF_live7rows_1; + if ((x_87 < x_88)) { + } else { + break; + } + int const x_89 = GLF_live7sum_index; + int const x_90 = GLF_live7sum_index; + int const x_91 = GLF_live7sum_index; + int const x_310 = select(0, x_91, ((x_89 >= 0) && (x_90 < 9))); + float3x3 const x_311 = GLF_live7m33; + float3x3 const x_312 = transpose(x_311); + int const x_92 = GLF_live7c_1; + if ((x_92 < 3)) { + x_180 = 1; + } else { + float const x_318 = x_25.injectionSwitch.x; + x_180 = int(x_318); + } + int const x_320 = x_180; + int const x_93 = GLF_live7r_1; + indexable = x_312; + float const x_324 = indexable[x_320][select(0, 1, (x_93 < 3))]; + float const x_326 = GLF_live7sums.arr[x_310]; + GLF_live7sums.arr[x_310] = (x_326 + x_324); + int const x_94 = GLF_live7sum_index; + int const x_95 = GLF_live7sum_index; + int const x_96 = GLF_live7sum_index; + int const x_332 = select(0, x_96, ((x_94 >= 0) && (x_95 < 9))); + int const x_97 = GLF_live7r_1; + float const x_334 = GLF_live7m42[1][x_97]; + float const x_336 = GLF_live7sums.arr[x_332]; + GLF_live7sums.arr[x_332] = (x_336 + x_334); + { + int const x_98 = GLF_live7r_1; + GLF_live7r_1 = (x_98 + 1); + } + } + { + int const x_100 = GLF_live7c_1; + GLF_live7c_1 = (x_100 + 1); + } + } + int const x_102 = GLF_live7sum_index; + GLF_live7sum_index = (x_102 + 1); + { + int const x_104 = GLF_live7cols_1; + GLF_live7cols_1 = (x_104 + 1); + } + } + { + int const x_106 = GLF_live4i; + GLF_live4i = (x_106 + 1); + } + } + return float3(1.0f, 1.0f, 1.0f); +} + +void main_1(constant buf0& x_25, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 position = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + int i = 0; + float2 param_2 = 0.0f; + float const x_161 = x_25.injectionSwitch.x; + if ((x_161 >= 2.0f)) { + float4 const x_165 = *(tint_symbol_5); + position = float2(x_165.x, x_165.y); + float2 const x_167 = position; + param = x_167; + float3 const x_168 = drawShape_vf2_(x_25, &(param)); + float2 const x_169 = position; + param_1 = x_169; + float3 const x_170 = drawShape_vf2_(x_25, &(param_1)); + i = 25; + while (true) { + int const x_108 = i; + if ((x_108 > 0)) { + } else { + break; + } + float2 const x_177 = position; + param_2 = x_177; + float3 const x_178 = drawShape_vf2_(x_25, &(param_2)); + { + int const x_109 = i; + i = (x_109 - 1); + } + } + } + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_25 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_25, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..694e3520ab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.spvasm @@ -0,0 +1,663 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 403 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_25 "x_25" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %drawShape_vf2_ "drawShape_vf2_" + OpName %pos "pos" + OpName %c2 "c2" + OpName %c3 "c3" + OpName %c4 "c4" + OpName %c5 "c5" + OpName %c6 "c6" + OpName %GLF_live4i "GLF_live4i" + OpName %GLF_live4_looplimiter5 "GLF_live4_looplimiter5" + OpName %GLF_live7m42 "GLF_live7m42" + OpName %GLF_live7m33 "GLF_live7m33" + OpName %GLF_live7cols "GLF_live7cols" + OpName %GLF_live7_looplimiter3 "GLF_live7_looplimiter3" + OpName %GLF_live7rows "GLF_live7rows" + OpName %GLF_live7_looplimiter2 "GLF_live7_looplimiter2" + OpName %GLF_live7_looplimiter1 "GLF_live7_looplimiter1" + OpName %GLF_live7c "GLF_live7c" + OpName %GLF_live7r "GLF_live7r" + OpName %GLF_live7_looplimiter0 "GLF_live7_looplimiter0" + OpName %GLF_live7sum_index "GLF_live7sum_index" + OpName %GLF_live7_looplimiter7 "GLF_live7_looplimiter7" + OpName %GLF_live7cols_1 "GLF_live7cols_1" + OpName %GLF_live7rows_1 "GLF_live7rows_1" + OpName %GLF_live7sums "GLF_live7sums" + OpName %GLF_live7c_1 "GLF_live7c_1" + OpName %GLF_live7r_1 "GLF_live7r_1" + OpName %x_180 "x_180" + OpName %indexable "indexable" + OpName %main_1 "main_1" + OpName %position "position" + OpName %param "param" + OpName %param_1 "param_1" + OpName %i "i" + OpName %param_2 "param_2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_25 NonWritable + OpDecorate %x_25 DescriptorSet 0 + OpDecorate %x_25 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_25 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpTypeFunction %v3float %_ptr_Function_v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %24 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %32 = OpConstantNull %int +%mat4v2float = OpTypeMatrix %v2float 4 +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float + %37 = OpConstantNull %mat4v2float +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %41 = OpConstantNull %mat3v3float + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %59 = OpConstantNull %_arr_float_uint_9 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %74 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %uint_1 = OpConstant %uint 1 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_7 = OpConstant %int 7 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %125 = OpConstantComposite %v2float %float_1 %float_0 + %126 = OpConstantComposite %v2float %float_0 %float_1 + %127 = OpConstantComposite %v2float %float_0 %float_0 + %128 = OpConstantComposite %mat4v2float %125 %126 %127 %125 + %129 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %130 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %131 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %132 = OpConstantComposite %mat3v3float %129 %130 %131 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_9 = OpConstant %int 9 + %void = OpTypeVoid + %348 = OpTypeFunction %void + %353 = OpConstantNull %v2float + %float_2 = OpConstant %float 2 + %int_25 = OpConstant %int 25 + %389 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %390 = OpTypeFunction %void %main_out +%drawShape_vf2_ = OpFunction %v3float None %15 + %pos = OpFunctionParameter %_ptr_Function_v2float + %20 = OpLabel + %c2 = OpVariable %_ptr_Function_bool Function %24 + %c3 = OpVariable %_ptr_Function_bool Function %24 + %c4 = OpVariable %_ptr_Function_bool Function %24 + %c5 = OpVariable %_ptr_Function_bool Function %24 + %c6 = OpVariable %_ptr_Function_bool Function %24 + %GLF_live4i = OpVariable %_ptr_Function_int Function %32 +%GLF_live4_looplimiter5 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7m42 = OpVariable %_ptr_Function_mat4v2float Function %37 +%GLF_live7m33 = OpVariable %_ptr_Function_mat3v3float Function %41 +%GLF_live7cols = OpVariable %_ptr_Function_int Function %32 +%GLF_live7_looplimiter3 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7rows = OpVariable %_ptr_Function_int Function %32 +%GLF_live7_looplimiter2 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7_looplimiter1 = OpVariable %_ptr_Function_int Function %32 + %GLF_live7c = OpVariable %_ptr_Function_int Function %32 + %GLF_live7r = OpVariable %_ptr_Function_int Function %32 +%GLF_live7_looplimiter0 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7sum_index = OpVariable %_ptr_Function_int Function %32 +%GLF_live7_looplimiter7 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7cols_1 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7rows_1 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7sums = OpVariable %_ptr_Function__arr_float_uint_9 Function %59 +%GLF_live7c_1 = OpVariable %_ptr_Function_int Function %32 +%GLF_live7r_1 = OpVariable %_ptr_Function_int Function %32 + %x_180 = OpVariable %_ptr_Function_int Function %32 + %indexable = OpVariable %_ptr_Function_mat3v3float Function %41 + %67 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %68 = OpLoad %float %67 + %70 = OpFOrdGreaterThan %bool %68 %float_1 + OpStore %c2 %70 + %71 = OpLoad %bool %c2 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + OpReturnValue %74 + %72 = OpLabel + %77 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %78 = OpLoad %float %77 + %79 = OpFOrdLessThan %bool %78 %float_1 + OpStore %c3 %79 + %80 = OpLoad %bool %c3 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + OpReturnValue %74 + %81 = OpLabel + %84 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %85 = OpLoad %float %84 + %86 = OpFOrdGreaterThan %bool %85 %float_1 + OpStore %c4 %86 + %87 = OpLoad %bool %c4 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + OpReturnValue %74 + %88 = OpLabel + %91 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %92 = OpLoad %float %91 + %93 = OpFOrdLessThan %bool %92 %float_1 + OpStore %c5 %93 + %94 = OpLoad %bool %c5 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + OpReturnValue %74 + %95 = OpLabel + %98 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %99 = OpLoad %float %98 + %100 = OpFAdd %float %99 %float_1 + %101 = OpFOrdGreaterThan %bool %100 %float_1 + OpStore %c6 %101 + %102 = OpLoad %bool %c6 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %103 + %104 = OpLabel + OpReturnValue %74 + %103 = OpLabel + OpStore %GLF_live4i %int_0 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %110 = OpLoad %int %GLF_live4i + %112 = OpSLessThan %bool %110 %int_4 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %115 + %114 = OpLabel + OpBranch %113 + %115 = OpLabel + OpBranch %107 + %113 = OpLabel + %116 = OpLoad %int %GLF_live4_looplimiter5 + %118 = OpSGreaterThanEqual %bool %116 %int_7 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %119 + %120 = OpLabel + OpBranch %107 + %119 = OpLabel + %121 = OpLoad %int %GLF_live4_looplimiter5 + %123 = OpIAdd %int %121 %int_1 + OpStore %GLF_live4_looplimiter5 %123 + OpStore %GLF_live7m42 %128 + OpStore %GLF_live7m33 %132 + OpStore %GLF_live7cols %int_2 + OpBranch %134 + %134 = OpLabel + OpLoopMerge %135 %136 None + OpBranch %137 + %137 = OpLabel + %138 = OpLoad %int %GLF_live7cols + %139 = OpSLessThan %bool %138 %int_4 + OpSelectionMerge %140 None + OpBranchConditional %139 %141 %142 + %141 = OpLabel + OpBranch %140 + %142 = OpLabel + OpBranch %135 + %140 = OpLabel + %143 = OpLoad %int %GLF_live7_looplimiter3 + %144 = OpSGreaterThanEqual %bool %143 %int_7 + OpSelectionMerge %145 None + OpBranchConditional %144 %146 %145 + %146 = OpLabel + OpBranch %135 + %145 = OpLabel + %147 = OpLoad %int %GLF_live7_looplimiter3 + %148 = OpIAdd %int %147 %int_1 + OpStore %GLF_live7_looplimiter3 %148 + OpStore %GLF_live7rows %int_2 + OpBranch %149 + %149 = OpLabel + OpLoopMerge %150 %151 None + OpBranch %152 + %152 = OpLabel + %153 = OpLoad %int %GLF_live7rows + %154 = OpSLessThan %bool %153 %int_4 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %157 + %156 = OpLabel + OpBranch %155 + %157 = OpLabel + OpBranch %150 + %155 = OpLabel + %158 = OpLoad %int %GLF_live7_looplimiter2 + %159 = OpSGreaterThanEqual %bool %158 %int_7 + OpSelectionMerge %160 None + OpBranchConditional %159 %161 %160 + %161 = OpLabel + OpBranch %150 + %160 = OpLabel + %162 = OpLoad %int %GLF_live7_looplimiter2 + %163 = OpIAdd %int %162 %int_1 + OpStore %GLF_live7_looplimiter2 %163 + OpStore %GLF_live7_looplimiter1 %int_0 + OpStore %GLF_live7c %int_0 + OpBranch %164 + %164 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %int %GLF_live7c + %170 = OpSLessThan %bool %168 %int_3 + OpSelectionMerge %171 None + OpBranchConditional %170 %172 %173 + %172 = OpLabel + OpBranch %171 + %173 = OpLabel + OpBranch %165 + %171 = OpLabel + %174 = OpLoad %int %GLF_live7_looplimiter1 + %175 = OpSGreaterThanEqual %bool %174 %int_7 + OpSelectionMerge %176 None + OpBranchConditional %175 %177 %176 + %177 = OpLabel + OpBranch %165 + %176 = OpLabel + %178 = OpLoad %int %GLF_live7_looplimiter1 + %179 = OpIAdd %int %178 %int_1 + OpStore %GLF_live7_looplimiter1 %179 + OpStore %GLF_live7r %int_0 + OpBranch %180 + %180 = OpLabel + OpLoopMerge %181 %182 None + OpBranch %183 + %183 = OpLabel + %184 = OpLoad %int %GLF_live7r + %185 = OpSLessThan %bool %184 %int_2 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + OpBranch %186 + %188 = OpLabel + OpBranch %181 + %186 = OpLabel + %189 = OpLoad %int %GLF_live7_looplimiter0 + %190 = OpSGreaterThanEqual %bool %189 %int_7 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %191 + %192 = OpLabel + OpBranch %181 + %191 = OpLabel + %193 = OpLoad %int %GLF_live7_looplimiter0 + %194 = OpIAdd %int %193 %int_1 + OpStore %GLF_live7_looplimiter0 %194 + %195 = OpLoad %int %GLF_live7c + %196 = OpLoad %int %GLF_live7c + %197 = OpLoad %int %GLF_live7c + %198 = OpLoad %int %GLF_live7r + %199 = OpLoad %int %GLF_live7r + %200 = OpLoad %int %GLF_live7r + %202 = OpSGreaterThanEqual %bool %195 %int_0 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %203 + %204 = OpLabel + %205 = OpSLessThan %bool %196 %int_3 + OpBranch %203 + %203 = OpLabel + %206 = OpPhi %bool %202 %191 %205 %204 + %201 = OpSelect %int %206 %197 %int_0 + %208 = OpSGreaterThanEqual %bool %198 %int_0 + OpSelectionMerge %209 None + OpBranchConditional %208 %210 %209 + %210 = OpLabel + %211 = OpSLessThan %bool %199 %int_3 + OpBranch %209 + %209 = OpLabel + %212 = OpPhi %bool %208 %203 %211 %210 + %207 = OpSelect %int %212 %200 %int_0 + %213 = OpAccessChain %_ptr_Function_float %GLF_live7m33 %201 %207 + OpStore %213 %float_1 + %215 = OpAccessChain %_ptr_Uniform_float %x_25 %uint_0 %uint_1 + %216 = OpLoad %float %215 + %217 = OpFOrdGreaterThan %bool %float_0 %216 + OpSelectionMerge %218 None + OpBranchConditional %217 %219 %220 + %219 = OpLabel + OpBranch %218 + %220 = OpLabel + %221 = OpLoad %int %GLF_live7c + %222 = OpLoad %int %GLF_live7c + %223 = OpLoad %int %GLF_live7c + %224 = OpLoad %int %GLF_live7r + %225 = OpLoad %int %GLF_live7r + %226 = OpLoad %int %GLF_live7r + %228 = OpSGreaterThanEqual %bool %221 %int_0 + OpSelectionMerge %229 None + OpBranchConditional %228 %230 %229 + %230 = OpLabel + %231 = OpSLessThan %bool %222 %int_4 + OpBranch %229 + %229 = OpLabel + %232 = OpPhi %bool %228 %220 %231 %230 + %227 = OpSelect %int %232 %223 %int_0 + %234 = OpSGreaterThanEqual %bool %224 %int_0 + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %235 + %236 = OpLabel + %237 = OpSLessThan %bool %225 %int_2 + OpBranch %235 + %235 = OpLabel + %238 = OpPhi %bool %234 %229 %237 %236 + %233 = OpSelect %int %238 %226 %int_0 + %239 = OpAccessChain %_ptr_Function_float %GLF_live7m42 %227 %233 + OpStore %239 %float_1 + OpBranch %218 + %218 = OpLabel + OpBranch %182 + %182 = OpLabel + %240 = OpLoad %int %GLF_live7r + %241 = OpIAdd %int %240 %int_1 + OpStore %GLF_live7r %241 + OpBranch %180 + %181 = OpLabel + OpBranch %166 + %166 = OpLabel + %242 = OpLoad %int %GLF_live7c + %243 = OpIAdd %int %242 %int_1 + OpStore %GLF_live7c %243 + OpBranch %164 + %165 = OpLabel + OpBranch %151 + %151 = OpLabel + %244 = OpLoad %int %GLF_live7rows + %245 = OpIAdd %int %244 %int_1 + OpStore %GLF_live7rows %245 + OpBranch %149 + %150 = OpLabel + OpBranch %136 + %136 = OpLabel + %246 = OpLoad %int %GLF_live7cols + %247 = OpIAdd %int %246 %int_1 + OpStore %GLF_live7cols %247 + OpBranch %134 + %135 = OpLabel + OpStore %GLF_live7sum_index %int_0 + OpStore %GLF_live7_looplimiter7 %int_0 + OpStore %GLF_live7cols_1 %int_2 + OpBranch %248 + %248 = OpLabel + OpLoopMerge %249 %250 None + OpBranch %251 + %251 = OpLabel + %252 = OpLoad %int %GLF_live7cols_1 + %253 = OpSLessThan %bool %252 %int_4 + OpSelectionMerge %254 None + OpBranchConditional %253 %255 %256 + %255 = OpLabel + OpBranch %254 + %256 = OpLabel + OpBranch %249 + %254 = OpLabel + %257 = OpLoad %int %GLF_live7_looplimiter7 + %258 = OpSGreaterThanEqual %bool %257 %int_7 + OpSelectionMerge %259 None + OpBranchConditional %258 %260 %259 + %260 = OpLabel + OpBranch %249 + %259 = OpLabel + %261 = OpLoad %int %GLF_live7_looplimiter7 + %262 = OpIAdd %int %261 %int_1 + OpStore %GLF_live7_looplimiter7 %262 + OpStore %GLF_live7rows_1 %int_2 + %263 = OpLoad %int %GLF_live7sum_index + %264 = OpLoad %int %GLF_live7sum_index + %265 = OpLoad %int %GLF_live7sum_index + %267 = OpSGreaterThanEqual %bool %263 %int_0 + OpSelectionMerge %268 None + OpBranchConditional %267 %269 %268 + %269 = OpLabel + %271 = OpSLessThan %bool %264 %int_9 + OpBranch %268 + %268 = OpLabel + %272 = OpPhi %bool %267 %259 %271 %269 + %266 = OpSelect %int %272 %265 %int_0 + %273 = OpAccessChain %_ptr_Function_float %GLF_live7sums %266 + OpStore %273 %float_0 + OpStore %GLF_live7c_1 %int_0 + OpBranch %274 + %274 = OpLabel + OpLoopMerge %275 %276 None + OpBranch %277 + %277 = OpLabel + %278 = OpLoad %int %GLF_live7c_1 + %279 = OpSLessThan %bool %278 %int_1 + OpSelectionMerge %280 None + OpBranchConditional %279 %281 %282 + %281 = OpLabel + OpBranch %280 + %282 = OpLabel + OpBranch %275 + %280 = OpLabel + OpStore %GLF_live7r_1 %int_0 + OpBranch %283 + %283 = OpLabel + OpLoopMerge %284 %285 None + OpBranch %286 + %286 = OpLabel + %287 = OpLoad %int %GLF_live7r_1 + %288 = OpLoad %int %GLF_live7rows_1 + %289 = OpSLessThan %bool %287 %288 + OpSelectionMerge %290 None + OpBranchConditional %289 %291 %292 + %291 = OpLabel + OpBranch %290 + %292 = OpLabel + OpBranch %284 + %290 = OpLabel + %293 = OpLoad %int %GLF_live7sum_index + %294 = OpLoad %int %GLF_live7sum_index + %295 = OpLoad %int %GLF_live7sum_index + %297 = OpSGreaterThanEqual %bool %293 %int_0 + OpSelectionMerge %298 None + OpBranchConditional %297 %299 %298 + %299 = OpLabel + %300 = OpSLessThan %bool %294 %int_9 + OpBranch %298 + %298 = OpLabel + %301 = OpPhi %bool %297 %290 %300 %299 + %296 = OpSelect %int %301 %295 %int_0 + %302 = OpLoad %mat3v3float %GLF_live7m33 + %303 = OpTranspose %mat3v3float %302 + %304 = OpLoad %int %GLF_live7c_1 + %305 = OpSLessThan %bool %304 %int_3 + OpSelectionMerge %306 None + OpBranchConditional %305 %307 %308 + %307 = OpLabel + OpStore %x_180 %int_1 + OpBranch %306 + %308 = OpLabel + %309 = OpAccessChain %_ptr_Uniform_float %x_25 %uint_0 %uint_0 + %310 = OpLoad %float %309 + %311 = OpConvertFToS %int %310 + OpStore %x_180 %311 + OpBranch %306 + %306 = OpLabel + %312 = OpLoad %int %x_180 + %313 = OpLoad %int %GLF_live7r_1 + OpStore %indexable %303 + %315 = OpSLessThan %bool %313 %int_3 + %314 = OpSelect %int %315 %int_1 %int_0 + %316 = OpAccessChain %_ptr_Function_float %indexable %312 %314 + %317 = OpLoad %float %316 + %318 = OpAccessChain %_ptr_Function_float %GLF_live7sums %296 + %319 = OpLoad %float %318 + %320 = OpAccessChain %_ptr_Function_float %GLF_live7sums %296 + %321 = OpFAdd %float %319 %317 + OpStore %320 %321 + %322 = OpLoad %int %GLF_live7sum_index + %323 = OpLoad %int %GLF_live7sum_index + %324 = OpLoad %int %GLF_live7sum_index + %326 = OpSGreaterThanEqual %bool %322 %int_0 + OpSelectionMerge %327 None + OpBranchConditional %326 %328 %327 + %328 = OpLabel + %329 = OpSLessThan %bool %323 %int_9 + OpBranch %327 + %327 = OpLabel + %330 = OpPhi %bool %326 %306 %329 %328 + %325 = OpSelect %int %330 %324 %int_0 + %331 = OpLoad %int %GLF_live7r_1 + %332 = OpAccessChain %_ptr_Function_float %GLF_live7m42 %int_1 %331 + %333 = OpLoad %float %332 + %334 = OpAccessChain %_ptr_Function_float %GLF_live7sums %325 + %335 = OpLoad %float %334 + %336 = OpAccessChain %_ptr_Function_float %GLF_live7sums %325 + %337 = OpFAdd %float %335 %333 + OpStore %336 %337 + OpBranch %285 + %285 = OpLabel + %338 = OpLoad %int %GLF_live7r_1 + %339 = OpIAdd %int %338 %int_1 + OpStore %GLF_live7r_1 %339 + OpBranch %283 + %284 = OpLabel + OpBranch %276 + %276 = OpLabel + %340 = OpLoad %int %GLF_live7c_1 + %341 = OpIAdd %int %340 %int_1 + OpStore %GLF_live7c_1 %341 + OpBranch %274 + %275 = OpLabel + %342 = OpLoad %int %GLF_live7sum_index + %343 = OpIAdd %int %342 %int_1 + OpStore %GLF_live7sum_index %343 + OpBranch %250 + %250 = OpLabel + %344 = OpLoad %int %GLF_live7cols_1 + %345 = OpIAdd %int %344 %int_1 + OpStore %GLF_live7cols_1 %345 + OpBranch %248 + %249 = OpLabel + OpBranch %108 + %108 = OpLabel + %346 = OpLoad %int %GLF_live4i + %347 = OpIAdd %int %346 %int_1 + OpStore %GLF_live4i %347 + OpBranch %106 + %107 = OpLabel + OpReturnValue %74 + OpFunctionEnd + %main_1 = OpFunction %void None %348 + %351 = OpLabel + %position = OpVariable %_ptr_Function_v2float Function %353 + %param = OpVariable %_ptr_Function_v2float Function %353 + %param_1 = OpVariable %_ptr_Function_v2float Function %353 + %i = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_v2float Function %353 + %358 = OpAccessChain %_ptr_Uniform_float %x_25 %uint_0 %uint_0 + %359 = OpLoad %float %358 + %361 = OpFOrdGreaterThanEqual %bool %359 %float_2 + OpSelectionMerge %362 None + OpBranchConditional %361 %363 %362 + %363 = OpLabel + %364 = OpLoad %v4float %gl_FragCoord + %365 = OpCompositeExtract %float %364 0 + %366 = OpCompositeExtract %float %364 1 + %367 = OpCompositeConstruct %v2float %365 %366 + OpStore %position %367 + %368 = OpLoad %v2float %position + OpStore %param %368 + %369 = OpFunctionCall %v3float %drawShape_vf2_ %param + %371 = OpLoad %v2float %position + OpStore %param_1 %371 + %372 = OpFunctionCall %v3float %drawShape_vf2_ %param_1 + OpStore %i %int_25 + OpBranch %375 + %375 = OpLabel + OpLoopMerge %376 %377 None + OpBranch %378 + %378 = OpLabel + %379 = OpLoad %int %i + %380 = OpSGreaterThan %bool %379 %int_0 + OpSelectionMerge %381 None + OpBranchConditional %380 %382 %383 + %382 = OpLabel + OpBranch %381 + %383 = OpLabel + OpBranch %376 + %381 = OpLabel + %384 = OpLoad %v2float %position + OpStore %param_2 %384 + %385 = OpFunctionCall %v3float %drawShape_vf2_ %param_2 + OpBranch %377 + %377 = OpLabel + %387 = OpLoad %int %i + %388 = OpISub %int %387 %int_1 + OpStore %i %388 + OpBranch %375 + %376 = OpLabel + OpBranch %362 + %362 = OpLabel + OpStore %x_GLF_color %389 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %390 +%tint_symbol_1 = OpFunctionParameter %main_out + %394 = OpLabel + %395 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %395 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %348 + %397 = OpLabel + %398 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %398 + %399 = OpFunctionCall %void %main_1 + %401 = OpLoad %v4float %x_GLF_color + %402 = OpCompositeConstruct %main_out %401 + %400 = OpFunctionCall %void %tint_symbol_3 %402 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..9ca6d3775a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.wgsl @@ -0,0 +1,317 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_25 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn drawShape_vf2_(pos : ptr>) -> vec3 { + var c2 : bool; + var c3 : bool; + var c4 : bool; + var c5 : bool; + var c6 : bool; + var GLF_live4i : i32; + var GLF_live4_looplimiter5 : i32; + var GLF_live7m42 : mat4x2; + var GLF_live7m33 : mat3x3; + var GLF_live7cols : i32; + var GLF_live7_looplimiter3 : i32; + var GLF_live7rows : i32; + var GLF_live7_looplimiter2 : i32; + var GLF_live7_looplimiter1 : i32; + var GLF_live7c : i32; + var GLF_live7r : i32; + var GLF_live7_looplimiter0 : i32; + var GLF_live7sum_index : i32; + var GLF_live7_looplimiter7 : i32; + var GLF_live7cols_1 : i32; + var GLF_live7rows_1 : i32; + var GLF_live7sums : array; + var GLF_live7c_1 : i32; + var GLF_live7r_1 : i32; + var x_180 : i32; + var indexable : mat3x3; + let x_182 : f32 = (*(pos)).x; + c2 = (x_182 > 1.0); + let x_184 : bool = c2; + if (x_184) { + return vec3(1.0, 1.0, 1.0); + } + let x_188 : f32 = (*(pos)).y; + c3 = (x_188 < 1.0); + let x_190 : bool = c3; + if (x_190) { + return vec3(1.0, 1.0, 1.0); + } + let x_194 : f32 = (*(pos)).y; + c4 = (x_194 > 1.0); + let x_196 : bool = c4; + if (x_196) { + return vec3(1.0, 1.0, 1.0); + } + let x_200 : f32 = (*(pos)).x; + c5 = (x_200 < 1.0); + let x_202 : bool = c5; + if (x_202) { + return vec3(1.0, 1.0, 1.0); + } + let x_206 : f32 = (*(pos)).x; + c6 = ((x_206 + 1.0) > 1.0); + let x_209 : bool = c6; + if (x_209) { + return vec3(1.0, 1.0, 1.0); + } + GLF_live4i = 0; + loop { + let x_39 : i32 = GLF_live4i; + if ((x_39 < 4)) { + } else { + break; + } + let x_40 : i32 = GLF_live4_looplimiter5; + if ((x_40 >= 7)) { + break; + } + let x_41 : i32 = GLF_live4_looplimiter5; + GLF_live4_looplimiter5 = (x_41 + 1); + GLF_live7m42 = mat4x2(vec2(1.0, 0.0), vec2(0.0, 1.0), vec2(0.0, 0.0), vec2(1.0, 0.0)); + GLF_live7m33 = mat3x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0)); + GLF_live7cols = 2; + loop { + let x_43 : i32 = GLF_live7cols; + if ((x_43 < 4)) { + } else { + break; + } + let x_44 : i32 = GLF_live7_looplimiter3; + if ((x_44 >= 7)) { + break; + } + let x_45 : i32 = GLF_live7_looplimiter3; + GLF_live7_looplimiter3 = (x_45 + 1); + GLF_live7rows = 2; + loop { + let x_47 : i32 = GLF_live7rows; + if ((x_47 < 4)) { + } else { + break; + } + let x_48 : i32 = GLF_live7_looplimiter2; + if ((x_48 >= 7)) { + break; + } + let x_49 : i32 = GLF_live7_looplimiter2; + GLF_live7_looplimiter2 = (x_49 + 1); + GLF_live7_looplimiter1 = 0; + GLF_live7c = 0; + loop { + let x_51 : i32 = GLF_live7c; + if ((x_51 < 3)) { + } else { + break; + } + let x_52 : i32 = GLF_live7_looplimiter1; + if ((x_52 >= 7)) { + break; + } + let x_53 : i32 = GLF_live7_looplimiter1; + GLF_live7_looplimiter1 = (x_53 + 1); + GLF_live7r = 0; + loop { + let x_55 : i32 = GLF_live7r; + if ((x_55 < 2)) { + } else { + break; + } + let x_56 : i32 = GLF_live7_looplimiter0; + if ((x_56 >= 7)) { + break; + } + let x_57 : i32 = GLF_live7_looplimiter0; + GLF_live7_looplimiter0 = (x_57 + 1); + let x_59 : i32 = GLF_live7c; + let x_60 : i32 = GLF_live7c; + let x_61 : i32 = GLF_live7c; + let x_62 : i32 = GLF_live7r; + let x_63 : i32 = GLF_live7r; + let x_64 : i32 = GLF_live7r; + GLF_live7m33[select(0, x_61, ((x_59 >= 0) && (x_60 < 3)))][select(0, x_64, ((x_62 >= 0) && (x_63 < 3)))] = 1.0; + let x_267 : f32 = x_25.injectionSwitch.y; + if ((0.0 > x_267)) { + } else { + let x_65 : i32 = GLF_live7c; + let x_66 : i32 = GLF_live7c; + let x_67 : i32 = GLF_live7c; + let x_68 : i32 = GLF_live7r; + let x_69 : i32 = GLF_live7r; + let x_70 : i32 = GLF_live7r; + GLF_live7m42[select(0, x_67, ((x_65 >= 0) && (x_66 < 4)))][select(0, x_70, ((x_68 >= 0) && (x_69 < 2)))] = 1.0; + } + + continuing { + let x_71 : i32 = GLF_live7r; + GLF_live7r = (x_71 + 1); + } + } + + continuing { + let x_73 : i32 = GLF_live7c; + GLF_live7c = (x_73 + 1); + } + } + + continuing { + let x_75 : i32 = GLF_live7rows; + GLF_live7rows = (x_75 + 1); + } + } + + continuing { + let x_77 : i32 = GLF_live7cols; + GLF_live7cols = (x_77 + 1); + } + } + GLF_live7sum_index = 0; + GLF_live7_looplimiter7 = 0; + GLF_live7cols_1 = 2; + loop { + let x_79 : i32 = GLF_live7cols_1; + if ((x_79 < 4)) { + } else { + break; + } + let x_80 : i32 = GLF_live7_looplimiter7; + if ((x_80 >= 7)) { + break; + } + let x_81 : i32 = GLF_live7_looplimiter7; + GLF_live7_looplimiter7 = (x_81 + 1); + GLF_live7rows_1 = 2; + let x_83 : i32 = GLF_live7sum_index; + let x_84 : i32 = GLF_live7sum_index; + let x_85 : i32 = GLF_live7sum_index; + GLF_live7sums[select(0, x_85, ((x_83 >= 0) && (x_84 < 9)))] = 0.0; + GLF_live7c_1 = 0; + loop { + let x_86 : i32 = GLF_live7c_1; + if ((x_86 < 1)) { + } else { + break; + } + GLF_live7r_1 = 0; + loop { + let x_87 : i32 = GLF_live7r_1; + let x_88 : i32 = GLF_live7rows_1; + if ((x_87 < x_88)) { + } else { + break; + } + let x_89 : i32 = GLF_live7sum_index; + let x_90 : i32 = GLF_live7sum_index; + let x_91 : i32 = GLF_live7sum_index; + let x_310 : i32 = select(0, x_91, ((x_89 >= 0) && (x_90 < 9))); + let x_311 : mat3x3 = GLF_live7m33; + let x_312 : mat3x3 = transpose(x_311); + let x_92 : i32 = GLF_live7c_1; + if ((x_92 < 3)) { + x_180 = 1; + } else { + let x_318 : f32 = x_25.injectionSwitch.x; + x_180 = i32(x_318); + } + let x_320 : i32 = x_180; + let x_93 : i32 = GLF_live7r_1; + indexable = x_312; + let x_324 : f32 = indexable[x_320][select(0, 1, (x_93 < 3))]; + let x_326 : f32 = GLF_live7sums[x_310]; + GLF_live7sums[x_310] = (x_326 + x_324); + let x_94 : i32 = GLF_live7sum_index; + let x_95 : i32 = GLF_live7sum_index; + let x_96 : i32 = GLF_live7sum_index; + let x_332 : i32 = select(0, x_96, ((x_94 >= 0) && (x_95 < 9))); + let x_97 : i32 = GLF_live7r_1; + let x_334 : f32 = GLF_live7m42[1][x_97]; + let x_336 : f32 = GLF_live7sums[x_332]; + GLF_live7sums[x_332] = (x_336 + x_334); + + continuing { + let x_98 : i32 = GLF_live7r_1; + GLF_live7r_1 = (x_98 + 1); + } + } + + continuing { + let x_100 : i32 = GLF_live7c_1; + GLF_live7c_1 = (x_100 + 1); + } + } + let x_102 : i32 = GLF_live7sum_index; + GLF_live7sum_index = (x_102 + 1); + + continuing { + let x_104 : i32 = GLF_live7cols_1; + GLF_live7cols_1 = (x_104 + 1); + } + } + + continuing { + let x_106 : i32 = GLF_live4i; + GLF_live4i = (x_106 + 1); + } + } + return vec3(1.0, 1.0, 1.0); +} + +fn main_1() { + var position : vec2; + var param : vec2; + var param_1 : vec2; + var i : i32; + var param_2 : vec2; + let x_161 : f32 = x_25.injectionSwitch.x; + if ((x_161 >= 2.0)) { + let x_165 : vec4 = gl_FragCoord; + position = vec2(x_165.x, x_165.y); + let x_167 : vec2 = position; + param = x_167; + let x_168 : vec3 = drawShape_vf2_(&(param)); + let x_169 : vec2 = position; + param_1 = x_169; + let x_170 : vec3 = drawShape_vf2_(&(param_1)); + i = 25; + loop { + let x_108 : i32 = i; + if ((x_108 > 0)) { + } else { + break; + } + let x_177 : vec2 = position; + param_2 = x_177; + let x_178 : vec3 = drawShape_vf2_(&(param_2)); + + continuing { + let x_109 : i32 = i; + i = (x_109 - 1); + } + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm new file mode 100644 index 0000000000..92880f1ec1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm @@ -0,0 +1,223 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_i1_ "func(i1;" + OpName %b "b" + OpName %ndx "ndx" + OpName %gl_FragCoord "gl_FragCoord" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %param "param" + OpName %x "x" + OpName %param_0 "param" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %20 = OpTypeFunction %float %_ptr_Function_int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %float_800 = OpConstant %float 800 + %33 = OpConstantComposite %v2float %float_1 %float_800 + %int_1 = OpConstant %int 1 + %float_3 = OpConstant %float 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %37 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_5 = OpConstant %float 5 + %39 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 +%_ptr_Output_float = OpTypePointer Output %float + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_65 = OpConstant %int 65 + %int_10 = OpConstant %int 10 + %47 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %16 + %48 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_int Function + %x = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %39 + OpStore %f %float_0 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_1 + %54 = OpLoad %float %53 + %55 = OpConvertFToS %int %54 + %56 = OpSLessThan %bool %55 %int_0 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + OpKill + %59 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %61 = OpLoad %float %60 + %62 = OpConvertFToS %int %61 + OpStore %param %62 + %63 = OpFunctionCall %float %func_i1_ %param + OpStore %f %63 + OpBranch %57 + %57 = OpLabel + %64 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_1 + %65 = OpLoad %float %64 + %66 = OpConvertFToS %int %65 + %67 = OpSGreaterThan %bool %66 %int_65 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + OpKill + %68 = OpLabel + OpStore %x %int_0 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %int %x + %75 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %76 = OpLoad %float %75 + %77 = OpConvertFToS %int %76 + %78 = OpIAdd %int %77 %int_1 + %79 = OpSLessThan %bool %74 %78 + OpBranchConditional %79 %80 %71 + %80 = OpLabel + %81 = OpLoad %int %x + %82 = OpIAdd %int %81 %int_10 + OpStore %param_0 %82 + %83 = OpFunctionCall %float %func_i1_ %param_0 + OpStore %f %83 + OpBranch %72 + %72 = OpLabel + %84 = OpLoad %int %x + %85 = OpIAdd %int %84 %int_1 + OpStore %x %85 + OpBranch %70 + %71 = OpLabel + OpBranch %51 + %51 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %87 = OpLoad %float %86 + %88 = OpConvertFToS %int %87 + %89 = OpSGreaterThan %bool %88 %int_1 + OpBranchConditional %89 %49 %50 + %50 = OpLabel + %90 = OpLoad %float %f + %91 = OpFOrdEqual %bool %90 %float_3 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %94 + %93 = OpLabel + OpStore %_GLF_color %47 + OpBranch %92 + %94 = OpLabel + OpStore %_GLF_color %37 + OpBranch %92 + %92 = OpLabel + OpReturn + OpFunctionEnd + %func_i1_ = OpFunction %float None %20 + %b = OpFunctionParameter %_ptr_Function_int + %95 = OpLabel + %ndx = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %ndx %int_0 + OpBranch %96 + %96 = OpLabel + OpLoopMerge %97 %98 None + OpBranch %99 + %99 = OpLabel + %100 = OpLoad %int %ndx + %101 = OpSLessThan %bool %100 %int_2 + OpBranchConditional %101 %102 %97 + %102 = OpLabel + %103 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %104 = OpLoad %float %103 + %105 = OpFOrdLessThan %bool %104 %float_0 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + OpStore %i %int_0 + OpBranch %108 + %108 = OpLabel + OpLoopMerge %109 %110 None + OpBranch %111 + %111 = OpLabel + %112 = OpLoad %int %i + %113 = OpSLessThan %bool %112 %int_2 + OpBranchConditional %113 %114 %109 + %114 = OpLabel + %115 = OpExtInst %v2float %1 Cosh %33 + %116 = OpCompositeExtract %float %115 0 + %117 = OpConvertFToS %int %116 + %118 = OpSLessThanEqual %bool %117 %int_1 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %119 + %120 = OpLabel + OpKill + %119 = OpLabel + OpBranch %110 + %110 = OpLabel + %121 = OpLoad %int %i + %122 = OpIAdd %int %121 %int_1 + OpStore %i %122 + OpBranch %108 + %109 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %98 + %98 = OpLabel + %123 = OpLoad %int %ndx + %124 = OpIAdd %int %123 %int_1 + OpStore %ndx %124 + OpBranch %96 + %97 = OpLabel + %125 = OpLoad %int %b + %126 = OpSGreaterThan %bool %125 %int_1 + OpSelectionMerge %127 None + OpBranchConditional %126 %128 %127 + %128 = OpLabel + OpReturnValue %float_3 + %127 = OpLabel + %129 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %130 = OpLoad %float %129 + %131 = OpFOrdLessThan %bool %130 %float_0 + OpSelectionMerge %132 None + OpBranchConditional %131 %133 %132 + %133 = OpLabel + OpStore %_GLF_color %37 + OpBranch %132 + %132 = OpLabel + OpReturnValue %float_5 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..96c79d3cc9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.hlsl @@ -0,0 +1,106 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; + +float func_i1_(inout int b) { + int ndx = 0; + int i = 0; + ndx = 0; + { + for(; (ndx < 2); ndx = (ndx + 1)) { + const float x_104 = gl_FragCoord.x; + if ((x_104 < 0.0f)) { + i = 0; + { + for(; (i < 2); i = (i + 1)) { + if ((int(cosh(float2(1.0f, 800.0f)).x) <= 1)) { + discard; + } + } + } + } + } + } + const int x_125 = b; + if ((x_125 > 1)) { + return 3.0f; + } + const float x_130 = gl_FragCoord.x; + if ((x_130 < 0.0f)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return 5.0f; +} + +void main_1() { + float f = 0.0f; + int param = 0; + int x_1 = 0; + int param_1 = 0; + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + f = 0.0f; + while (true) { + const float x_54 = x_GLF_color.y; + if ((int(x_54) < 0)) { + discard; + } else { + const float x_61 = asfloat(x_11[0].x); + param = int(x_61); + const float x_63 = func_i1_(param); + f = x_63; + } + const float x_65 = x_GLF_color.y; + if ((int(x_65) > 65)) { + discard; + } + x_1 = 0; + while (true) { + const int x_74 = x_1; + const float x_76 = asfloat(x_11[0].x); + if ((x_74 < (int(x_76) + 1))) { + } else { + break; + } + param_1 = (x_1 + 10); + const float x_83 = func_i1_(param_1); + f = x_83; + { + x_1 = (x_1 + 1); + } + } + { + const float x_87 = asfloat(x_11[0].x); + if ((int(x_87) > 1)) { + } else { + break; + } + } + } + if ((f == 3.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d5ad8847fc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.msl @@ -0,0 +1,122 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_i1_(thread int* const b, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int ndx = 0; + int i = 0; + ndx = 0; + while (true) { + int const x_100 = ndx; + if ((x_100 < 2)) { + } else { + break; + } + float const x_104 = (*(tint_symbol_5)).x; + if ((x_104 < 0.0f)) { + i = 0; + while (true) { + int const x_112 = i; + if ((x_112 < 2)) { + } else { + break; + } + if ((int(cosh(float2(1.0f, 800.0f)).x) <= 1)) { + discard_fragment(); + } + { + int const x_121 = i; + i = (x_121 + 1); + } + } + } + { + int const x_123 = ndx; + ndx = (x_123 + 1); + } + } + int const x_125 = *(b); + if ((x_125 > 1)) { + return 3.0f; + } + float const x_130 = (*(tint_symbol_5)).x; + if ((x_130 < 0.0f)) { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return 5.0f; +} + +void main_1(constant buf0& x_11, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + float f = 0.0f; + int param = 0; + int x_1 = 0; + int param_1 = 0; + *(tint_symbol_7) = float4(1.0f, 1.0f, 1.0f, 1.0f); + f = 0.0f; + while (true) { + float const x_54 = (*(tint_symbol_7)).y; + if ((int(x_54) < 0)) { + discard_fragment(); + } else { + float const x_61 = x_11.zero; + param = int(x_61); + float const x_63 = func_i1_(&(param), tint_symbol_8, tint_symbol_7); + f = x_63; + } + float const x_65 = (*(tint_symbol_7)).y; + if ((int(x_65) > 65)) { + discard_fragment(); + } + x_1 = 0; + while (true) { + int const x_74 = x_1; + float const x_76 = x_11.zero; + if ((x_74 < (int(x_76) + 1))) { + } else { + break; + } + int const x_81 = x_1; + param_1 = (x_81 + 10); + float const x_83 = func_i1_(&(param_1), tint_symbol_8, tint_symbol_7); + f = x_83; + { + int const x_84 = x_1; + x_1 = (x_84 + 1); + } + } + { + float const x_87 = x_11.zero; + if ((int(x_87) > 1)) { + } else { + break; + } + } + } + float const x_90 = f; + if ((x_90 == 3.0f)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_11, &(tint_symbol_10), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e54f592971 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.spvasm @@ -0,0 +1,287 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 164 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_11 "x_11" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_i1_ "func_i1_" + OpName %b "b" + OpName %ndx "ndx" + OpName %i "i" + OpName %main_1 "main_1" + OpName %f "f" + OpName %param "param" + OpName %x "x" + OpName %param_1 "param_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpTypeFunction %float %_ptr_Function_int + %21 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %float_800 = OpConstant %float 800 + %59 = OpConstantComposite %v2float %float_1 %float_800 + %int_1 = OpConstant %int 1 + %float_3 = OpConstant %float 3 + %80 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_5 = OpConstant %float 5 + %void = OpTypeVoid + %82 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %88 = OpConstantNull %float + %92 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_65 = OpConstant %int 65 + %int_10 = OpConstant %int 10 + %150 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %151 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %float None %14 + %b = OpFunctionParameter %_ptr_Function_int + %19 = OpLabel + %ndx = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + OpStore %ndx %int_0 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %ndx + %30 = OpSLessThan %bool %28 %int_2 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %25 + %32 = OpLabel + %38 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %39 = OpLoad %float %38 + %41 = OpFOrdLessThan %bool %39 %float_0 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpStore %i %int_0 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %49 = OpSLessThan %bool %48 %int_2 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %45 + %50 = OpLabel + %54 = OpExtInst %v2float %56 Cosh %59 + %60 = OpCompositeExtract %float %54 0 + %53 = OpConvertFToS %int %60 + %62 = OpSLessThanEqual %bool %53 %int_1 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + OpKill + %63 = OpLabel + OpBranch %46 + %46 = OpLabel + %65 = OpLoad %int %i + %66 = OpIAdd %int %65 %int_1 + OpStore %i %66 + OpBranch %44 + %45 = OpLabel + OpBranch %42 + %42 = OpLabel + OpBranch %26 + %26 = OpLabel + %67 = OpLoad %int %ndx + %68 = OpIAdd %int %67 %int_1 + OpStore %ndx %68 + OpBranch %24 + %25 = OpLabel + %70 = OpLoad %int %b + %71 = OpSGreaterThan %bool %70 %int_1 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + OpReturnValue %float_3 + %72 = OpLabel + %75 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %76 = OpLoad %float %75 + %77 = OpFOrdLessThan %bool %76 %float_0 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %78 + %79 = OpLabel + OpStore %x_GLF_color %80 + OpBranch %78 + %78 = OpLabel + OpReturnValue %float_5 + OpFunctionEnd + %main_1 = OpFunction %void None %82 + %85 = OpLabel + %f = OpVariable %_ptr_Function_float Function %88 + %param = OpVariable %_ptr_Function_int Function %21 + %x = OpVariable %_ptr_Function_int Function %21 + %param_1 = OpVariable %_ptr_Function_int Function %21 + OpStore %x_GLF_color %92 + OpStore %f %float_0 + OpBranch %93 + %93 = OpLabel + OpLoopMerge %94 %95 None + OpBranch %96 + %96 = OpLabel + %98 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + %99 = OpLoad %float %98 + %100 = OpConvertFToS %int %99 + %101 = OpSLessThan %bool %100 %int_0 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpKill + %104 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 + %107 = OpLoad %float %106 + %108 = OpConvertFToS %int %107 + OpStore %param %108 + %109 = OpFunctionCall %float %func_i1_ %param + OpStore %f %109 + OpBranch %102 + %102 = OpLabel + %111 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + %112 = OpLoad %float %111 + %113 = OpConvertFToS %int %112 + %115 = OpSGreaterThan %bool %113 %int_65 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + OpKill + %116 = OpLabel + OpStore %x %int_0 + OpBranch %118 + %118 = OpLabel + OpLoopMerge %119 %120 None + OpBranch %121 + %121 = OpLabel + %122 = OpLoad %int %x + %123 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 + %124 = OpLoad %float %123 + %125 = OpConvertFToS %int %124 + %126 = OpIAdd %int %125 %int_1 + %127 = OpSLessThan %bool %122 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %130 + %129 = OpLabel + OpBranch %128 + %130 = OpLabel + OpBranch %119 + %128 = OpLabel + %131 = OpLoad %int %x + %133 = OpIAdd %int %131 %int_10 + OpStore %param_1 %133 + %134 = OpFunctionCall %float %func_i1_ %param_1 + OpStore %f %134 + OpBranch %120 + %120 = OpLabel + %136 = OpLoad %int %x + %137 = OpIAdd %int %136 %int_1 + OpStore %x %137 + OpBranch %118 + %119 = OpLabel + OpBranch %95 + %95 = OpLabel + %138 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 + %139 = OpLoad %float %138 + %140 = OpConvertFToS %int %139 + %141 = OpSGreaterThan %bool %140 %int_1 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %144 + %143 = OpLabel + OpBranch %142 + %144 = OpLabel + OpBranch %94 + %142 = OpLabel + OpBranch %93 + %94 = OpLabel + %145 = OpLoad %float %f + %146 = OpFOrdEqual %bool %145 %float_3 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %149 + %148 = OpLabel + OpStore %x_GLF_color %150 + OpBranch %147 + %149 = OpLabel + OpStore %x_GLF_color %80 + OpBranch %147 + %147 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %151 +%tint_symbol_1 = OpFunctionParameter %main_out + %155 = OpLabel + %156 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %156 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %82 + %158 = OpLabel + %159 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %159 + %160 = OpFunctionCall %void %main_1 + %162 = OpLoad %v4float %x_GLF_color + %163 = OpCompositeConstruct %main_out %162 + %161 = OpFunctionCall %void %tint_symbol_3 %163 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 95[%95] is not post dominated by the back-edge block 142[%142] + %142 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a6a3d974f0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.spvasm.expected.wgsl @@ -0,0 +1,125 @@ +[[block]] +struct buf0 { + zero : f32; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_11 : buf0; + +fn func_i1_(b : ptr) -> f32 { + var ndx : i32; + var i : i32; + ndx = 0; + loop { + let x_100 : i32 = ndx; + if ((x_100 < 2)) { + } else { + break; + } + let x_104 : f32 = gl_FragCoord.x; + if ((x_104 < 0.0)) { + i = 0; + loop { + let x_112 : i32 = i; + if ((x_112 < 2)) { + } else { + break; + } + if ((i32(cosh(vec2(1.0, 800.0)).x) <= 1)) { + discard; + } + + continuing { + let x_121 : i32 = i; + i = (x_121 + 1); + } + } + } + + continuing { + let x_123 : i32 = ndx; + ndx = (x_123 + 1); + } + } + let x_125 : i32 = *(b); + if ((x_125 > 1)) { + return 3.0; + } + let x_130 : f32 = gl_FragCoord.x; + if ((x_130 < 0.0)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return 5.0; +} + +fn main_1() { + var f : f32; + var param : i32; + var x : i32; + var param_1 : i32; + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + f = 0.0; + loop { + let x_54 : f32 = x_GLF_color.y; + if ((i32(x_54) < 0)) { + discard; + } else { + let x_61 : f32 = x_11.zero; + param = i32(x_61); + let x_63 : f32 = func_i1_(&(param)); + f = x_63; + } + let x_65 : f32 = x_GLF_color.y; + if ((i32(x_65) > 65)) { + discard; + } + x = 0; + loop { + let x_74 : i32 = x; + let x_76 : f32 = x_11.zero; + if ((x_74 < (i32(x_76) + 1))) { + } else { + break; + } + let x_81 : i32 = x; + param_1 = (x_81 + 10); + let x_83 : f32 = func_i1_(&(param_1)); + f = x_83; + + continuing { + let x_84 : i32 = x; + x = (x_84 + 1); + } + } + + continuing { + let x_87 : f32 = x_11.zero; + if ((i32(x_87) > 1)) { + } else { + break; + } + } + } + let x_90 : f32 = f; + if ((x_90 == 3.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl new file mode 100644 index 0000000000..a6a3d974f0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl @@ -0,0 +1,125 @@ +[[block]] +struct buf0 { + zero : f32; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_11 : buf0; + +fn func_i1_(b : ptr) -> f32 { + var ndx : i32; + var i : i32; + ndx = 0; + loop { + let x_100 : i32 = ndx; + if ((x_100 < 2)) { + } else { + break; + } + let x_104 : f32 = gl_FragCoord.x; + if ((x_104 < 0.0)) { + i = 0; + loop { + let x_112 : i32 = i; + if ((x_112 < 2)) { + } else { + break; + } + if ((i32(cosh(vec2(1.0, 800.0)).x) <= 1)) { + discard; + } + + continuing { + let x_121 : i32 = i; + i = (x_121 + 1); + } + } + } + + continuing { + let x_123 : i32 = ndx; + ndx = (x_123 + 1); + } + } + let x_125 : i32 = *(b); + if ((x_125 > 1)) { + return 3.0; + } + let x_130 : f32 = gl_FragCoord.x; + if ((x_130 < 0.0)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return 5.0; +} + +fn main_1() { + var f : f32; + var param : i32; + var x : i32; + var param_1 : i32; + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + f = 0.0; + loop { + let x_54 : f32 = x_GLF_color.y; + if ((i32(x_54) < 0)) { + discard; + } else { + let x_61 : f32 = x_11.zero; + param = i32(x_61); + let x_63 : f32 = func_i1_(&(param)); + f = x_63; + } + let x_65 : f32 = x_GLF_color.y; + if ((i32(x_65) > 65)) { + discard; + } + x = 0; + loop { + let x_74 : i32 = x; + let x_76 : f32 = x_11.zero; + if ((x_74 < (i32(x_76) + 1))) { + } else { + break; + } + let x_81 : i32 = x; + param_1 = (x_81 + 10); + let x_83 : f32 = func_i1_(&(param_1)); + f = x_83; + + continuing { + let x_84 : i32 = x; + x = (x_84 + 1); + } + } + + continuing { + let x_87 : f32 = x_11.zero; + if ((i32(x_87) > 1)) { + } else { + break; + } + } + } + let x_90 : f32 = f; + if ((x_90 == 3.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..96c79d3cc9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.hlsl @@ -0,0 +1,106 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; + +float func_i1_(inout int b) { + int ndx = 0; + int i = 0; + ndx = 0; + { + for(; (ndx < 2); ndx = (ndx + 1)) { + const float x_104 = gl_FragCoord.x; + if ((x_104 < 0.0f)) { + i = 0; + { + for(; (i < 2); i = (i + 1)) { + if ((int(cosh(float2(1.0f, 800.0f)).x) <= 1)) { + discard; + } + } + } + } + } + } + const int x_125 = b; + if ((x_125 > 1)) { + return 3.0f; + } + const float x_130 = gl_FragCoord.x; + if ((x_130 < 0.0f)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return 5.0f; +} + +void main_1() { + float f = 0.0f; + int param = 0; + int x_1 = 0; + int param_1 = 0; + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + f = 0.0f; + while (true) { + const float x_54 = x_GLF_color.y; + if ((int(x_54) < 0)) { + discard; + } else { + const float x_61 = asfloat(x_11[0].x); + param = int(x_61); + const float x_63 = func_i1_(param); + f = x_63; + } + const float x_65 = x_GLF_color.y; + if ((int(x_65) > 65)) { + discard; + } + x_1 = 0; + while (true) { + const int x_74 = x_1; + const float x_76 = asfloat(x_11[0].x); + if ((x_74 < (int(x_76) + 1))) { + } else { + break; + } + param_1 = (x_1 + 10); + const float x_83 = func_i1_(param_1); + f = x_83; + { + x_1 = (x_1 + 1); + } + } + { + const float x_87 = asfloat(x_11[0].x); + if ((int(x_87) > 1)) { + } else { + break; + } + } + } + if ((f == 3.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d5ad8847fc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.msl @@ -0,0 +1,122 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_i1_(thread int* const b, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int ndx = 0; + int i = 0; + ndx = 0; + while (true) { + int const x_100 = ndx; + if ((x_100 < 2)) { + } else { + break; + } + float const x_104 = (*(tint_symbol_5)).x; + if ((x_104 < 0.0f)) { + i = 0; + while (true) { + int const x_112 = i; + if ((x_112 < 2)) { + } else { + break; + } + if ((int(cosh(float2(1.0f, 800.0f)).x) <= 1)) { + discard_fragment(); + } + { + int const x_121 = i; + i = (x_121 + 1); + } + } + } + { + int const x_123 = ndx; + ndx = (x_123 + 1); + } + } + int const x_125 = *(b); + if ((x_125 > 1)) { + return 3.0f; + } + float const x_130 = (*(tint_symbol_5)).x; + if ((x_130 < 0.0f)) { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return 5.0f; +} + +void main_1(constant buf0& x_11, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + float f = 0.0f; + int param = 0; + int x_1 = 0; + int param_1 = 0; + *(tint_symbol_7) = float4(1.0f, 1.0f, 1.0f, 1.0f); + f = 0.0f; + while (true) { + float const x_54 = (*(tint_symbol_7)).y; + if ((int(x_54) < 0)) { + discard_fragment(); + } else { + float const x_61 = x_11.zero; + param = int(x_61); + float const x_63 = func_i1_(&(param), tint_symbol_8, tint_symbol_7); + f = x_63; + } + float const x_65 = (*(tint_symbol_7)).y; + if ((int(x_65) > 65)) { + discard_fragment(); + } + x_1 = 0; + while (true) { + int const x_74 = x_1; + float const x_76 = x_11.zero; + if ((x_74 < (int(x_76) + 1))) { + } else { + break; + } + int const x_81 = x_1; + param_1 = (x_81 + 10); + float const x_83 = func_i1_(&(param_1), tint_symbol_8, tint_symbol_7); + f = x_83; + { + int const x_84 = x_1; + x_1 = (x_84 + 1); + } + } + { + float const x_87 = x_11.zero; + if ((int(x_87) > 1)) { + } else { + break; + } + } + } + float const x_90 = f; + if ((x_90 == 3.0f)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_11, &(tint_symbol_10), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e54f592971 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.spvasm @@ -0,0 +1,287 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 164 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_11 "x_11" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_i1_ "func_i1_" + OpName %b "b" + OpName %ndx "ndx" + OpName %i "i" + OpName %main_1 "main_1" + OpName %f "f" + OpName %param "param" + OpName %x "x" + OpName %param_1 "param_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpTypeFunction %float %_ptr_Function_int + %21 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %float_800 = OpConstant %float 800 + %59 = OpConstantComposite %v2float %float_1 %float_800 + %int_1 = OpConstant %int 1 + %float_3 = OpConstant %float 3 + %80 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_5 = OpConstant %float 5 + %void = OpTypeVoid + %82 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %88 = OpConstantNull %float + %92 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_65 = OpConstant %int 65 + %int_10 = OpConstant %int 10 + %150 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %151 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %float None %14 + %b = OpFunctionParameter %_ptr_Function_int + %19 = OpLabel + %ndx = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + OpStore %ndx %int_0 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %ndx + %30 = OpSLessThan %bool %28 %int_2 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %25 + %32 = OpLabel + %38 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %39 = OpLoad %float %38 + %41 = OpFOrdLessThan %bool %39 %float_0 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpStore %i %int_0 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %49 = OpSLessThan %bool %48 %int_2 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %45 + %50 = OpLabel + %54 = OpExtInst %v2float %56 Cosh %59 + %60 = OpCompositeExtract %float %54 0 + %53 = OpConvertFToS %int %60 + %62 = OpSLessThanEqual %bool %53 %int_1 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + OpKill + %63 = OpLabel + OpBranch %46 + %46 = OpLabel + %65 = OpLoad %int %i + %66 = OpIAdd %int %65 %int_1 + OpStore %i %66 + OpBranch %44 + %45 = OpLabel + OpBranch %42 + %42 = OpLabel + OpBranch %26 + %26 = OpLabel + %67 = OpLoad %int %ndx + %68 = OpIAdd %int %67 %int_1 + OpStore %ndx %68 + OpBranch %24 + %25 = OpLabel + %70 = OpLoad %int %b + %71 = OpSGreaterThan %bool %70 %int_1 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + OpReturnValue %float_3 + %72 = OpLabel + %75 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %76 = OpLoad %float %75 + %77 = OpFOrdLessThan %bool %76 %float_0 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %78 + %79 = OpLabel + OpStore %x_GLF_color %80 + OpBranch %78 + %78 = OpLabel + OpReturnValue %float_5 + OpFunctionEnd + %main_1 = OpFunction %void None %82 + %85 = OpLabel + %f = OpVariable %_ptr_Function_float Function %88 + %param = OpVariable %_ptr_Function_int Function %21 + %x = OpVariable %_ptr_Function_int Function %21 + %param_1 = OpVariable %_ptr_Function_int Function %21 + OpStore %x_GLF_color %92 + OpStore %f %float_0 + OpBranch %93 + %93 = OpLabel + OpLoopMerge %94 %95 None + OpBranch %96 + %96 = OpLabel + %98 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + %99 = OpLoad %float %98 + %100 = OpConvertFToS %int %99 + %101 = OpSLessThan %bool %100 %int_0 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpKill + %104 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 + %107 = OpLoad %float %106 + %108 = OpConvertFToS %int %107 + OpStore %param %108 + %109 = OpFunctionCall %float %func_i1_ %param + OpStore %f %109 + OpBranch %102 + %102 = OpLabel + %111 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + %112 = OpLoad %float %111 + %113 = OpConvertFToS %int %112 + %115 = OpSGreaterThan %bool %113 %int_65 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + OpKill + %116 = OpLabel + OpStore %x %int_0 + OpBranch %118 + %118 = OpLabel + OpLoopMerge %119 %120 None + OpBranch %121 + %121 = OpLabel + %122 = OpLoad %int %x + %123 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 + %124 = OpLoad %float %123 + %125 = OpConvertFToS %int %124 + %126 = OpIAdd %int %125 %int_1 + %127 = OpSLessThan %bool %122 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %130 + %129 = OpLabel + OpBranch %128 + %130 = OpLabel + OpBranch %119 + %128 = OpLabel + %131 = OpLoad %int %x + %133 = OpIAdd %int %131 %int_10 + OpStore %param_1 %133 + %134 = OpFunctionCall %float %func_i1_ %param_1 + OpStore %f %134 + OpBranch %120 + %120 = OpLabel + %136 = OpLoad %int %x + %137 = OpIAdd %int %136 %int_1 + OpStore %x %137 + OpBranch %118 + %119 = OpLabel + OpBranch %95 + %95 = OpLabel + %138 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 + %139 = OpLoad %float %138 + %140 = OpConvertFToS %int %139 + %141 = OpSGreaterThan %bool %140 %int_1 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %144 + %143 = OpLabel + OpBranch %142 + %144 = OpLabel + OpBranch %94 + %142 = OpLabel + OpBranch %93 + %94 = OpLabel + %145 = OpLoad %float %f + %146 = OpFOrdEqual %bool %145 %float_3 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %149 + %148 = OpLabel + OpStore %x_GLF_color %150 + OpBranch %147 + %149 = OpLabel + OpStore %x_GLF_color %80 + OpBranch %147 + %147 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %151 +%tint_symbol_1 = OpFunctionParameter %main_out + %155 = OpLabel + %156 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %156 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %82 + %158 = OpLabel + %159 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %159 + %160 = OpFunctionCall %void %main_1 + %162 = OpLoad %v4float %x_GLF_color + %163 = OpCompositeConstruct %main_out %162 + %161 = OpFunctionCall %void %tint_symbol_3 %163 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 95[%95] is not post dominated by the back-edge block 142[%142] + %142 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6a3d974f0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cosh-return-inf-unused/0-opt.wgsl.expected.wgsl @@ -0,0 +1,125 @@ +[[block]] +struct buf0 { + zero : f32; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_11 : buf0; + +fn func_i1_(b : ptr) -> f32 { + var ndx : i32; + var i : i32; + ndx = 0; + loop { + let x_100 : i32 = ndx; + if ((x_100 < 2)) { + } else { + break; + } + let x_104 : f32 = gl_FragCoord.x; + if ((x_104 < 0.0)) { + i = 0; + loop { + let x_112 : i32 = i; + if ((x_112 < 2)) { + } else { + break; + } + if ((i32(cosh(vec2(1.0, 800.0)).x) <= 1)) { + discard; + } + + continuing { + let x_121 : i32 = i; + i = (x_121 + 1); + } + } + } + + continuing { + let x_123 : i32 = ndx; + ndx = (x_123 + 1); + } + } + let x_125 : i32 = *(b); + if ((x_125 > 1)) { + return 3.0; + } + let x_130 : f32 = gl_FragCoord.x; + if ((x_130 < 0.0)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return 5.0; +} + +fn main_1() { + var f : f32; + var param : i32; + var x : i32; + var param_1 : i32; + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + f = 0.0; + loop { + let x_54 : f32 = x_GLF_color.y; + if ((i32(x_54) < 0)) { + discard; + } else { + let x_61 : f32 = x_11.zero; + param = i32(x_61); + let x_63 : f32 = func_i1_(&(param)); + f = x_63; + } + let x_65 : f32 = x_GLF_color.y; + if ((i32(x_65) > 65)) { + discard; + } + x = 0; + loop { + let x_74 : i32 = x; + let x_76 : f32 = x_11.zero; + if ((x_74 < (i32(x_76) + 1))) { + } else { + break; + } + let x_81 : i32 = x; + param_1 = (x_81 + 10); + let x_83 : f32 = func_i1_(&(param_1)); + f = x_83; + + continuing { + let x_84 : i32 = x; + x = (x_84 + 1); + } + } + + continuing { + let x_87 : f32 = x_11.zero; + if ((i32(x_87) > 1)) { + } else { + break; + } + } + } + let x_90 : f32 = f; + if ((x_90 == 3.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm new file mode 100644 index 0000000000..efa8502216 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm @@ -0,0 +1,133 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %numbers "numbers" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %b "b" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3_0 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 +%_arr_int_uint_3_0 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3_0 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_0 = OpConstant %float 0 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %36 = OpLabel + %numbers = OpVariable %_ptr_Function__arr_int_uint_3 Function + %a = OpVariable %_ptr_Function_v2float Function + %b = OpVariable %_ptr_Function_float Function + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %40 = OpLoad %int %39 + %41 = OpAccessChain %_ptr_Function_int %numbers %38 + OpStore %41 %40 + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Function_int %numbers %43 + OpStore %46 %45 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Function_int %numbers %48 + OpStore %51 %50 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_2 + %56 = OpLoad %float %55 + %57 = OpFOrdLessThan %bool %float_0 %56 + %58 = OpSelect %int %57 %int_1 %int_2 + %59 = OpAccessChain %_ptr_Function_int %numbers %58 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpCompositeConstruct %v2float %54 %61 + OpStore %a %62 + %63 = OpLoad %v2float %a + %64 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %67 = OpLoad %float %66 + %68 = OpCompositeConstruct %v2float %65 %67 + %69 = OpDot %float %63 %68 + OpStore %b %69 + %70 = OpLoad %float %b + %71 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %72 = OpLoad %float %71 + %73 = OpFOrdEqual %bool %70 %72 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %77 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpConvertSToF %float %78 + %80 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %81 + %83 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %84 = OpLoad %int %83 + %85 = OpConvertSToF %float %84 + %86 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpConvertSToF %float %87 + %89 = OpCompositeConstruct %v4float %79 %82 %85 %88 + OpStore %_GLF_color %89 + OpBranch %74 + %76 = OpLabel + %90 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %91 + %93 = OpCompositeConstruct %v4float %92 %92 %92 %92 + OpStore %_GLF_color %93 + OpBranch %74 + %74 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..01b699a0fc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.hlsl @@ -0,0 +1,65 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int numbers[3] = (int[3])0; + float2 a = float2(0.0f, 0.0f); + float b = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + numbers[x_38] = x_40; + const int x_43 = asint(x_6[1].x); + const int x_45 = asint(x_6[1].x); + numbers[x_43] = x_45; + const int x_48 = asint(x_6[2].x); + const int x_50 = asint(x_6[2].x); + numbers[x_48] = x_50; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_56 = asfloat(x_9[2].x); + const int x_60 = numbers[((0.0f < x_56) ? 1 : 2)]; + a = float2(float(x_53), float(x_60)); + const float2 x_63 = a; + const float x_65 = asfloat(x_9[1].x); + const float x_67 = asfloat(x_9[1].x); + b = dot(x_63, float2(x_65, x_67)); + const float x_70 = b; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_72 = asfloat(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_70 == x_72)) { + const int x_78 = asint(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_81 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_84 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_87 = asint(x_6[1].x); + x_GLF_color = float4(float(x_78), float(x_81), float(x_84), float(x_87)); + } else { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_91 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_92 = float(x_91); + x_GLF_color = float4(x_92, x_92, x_92, x_92); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..154546203a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.msl @@ -0,0 +1,78 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + int arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + tint_array_wrapper_2 numbers = {}; + float2 a = 0.0f; + float b = 0.0f; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[0].el; + numbers.arr[x_38] = x_40; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_45 = x_6.x_GLF_uniform_int_values.arr[1].el; + numbers.arr[x_43] = x_45; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[2].el; + numbers.arr[x_48] = x_50; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_56 = x_9.x_GLF_uniform_float_values.arr[2].el; + int const x_60 = numbers.arr[select(2, 1, (0.0f < x_56))]; + a = float2(float(x_53), float(x_60)); + float2 const x_63 = a; + float const x_65 = x_9.x_GLF_uniform_float_values.arr[1].el; + float const x_67 = x_9.x_GLF_uniform_float_values.arr[1].el; + b = dot(x_63, float2(x_65, x_67)); + float const x_70 = b; + float const x_72 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_70 == x_72)) { + int const x_78 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_81 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_84 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_87 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_78), float(x_81), float(x_84), float(x_87)); + } else { + int const x_91 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_92 = float(x_91); + *(tint_symbol_4) = float4(x_92, x_92, x_92, x_92); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..cad1211b01 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.spvasm @@ -0,0 +1,170 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %numbers "numbers" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_3_0 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_arr_int_uint_3_0 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3_0 = OpTypePointer Function %_arr_int_uint_3_0 + %26 = OpConstantNull %_arr_int_uint_3_0 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %30 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %33 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %100 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %numbers = OpVariable %_ptr_Function__arr_int_uint_3_0 Function %26 + %a = OpVariable %_ptr_Function_v2float Function %30 + %b = OpVariable %_ptr_Function_float Function %33 + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %40 = OpLoad %int %39 + %42 = OpAccessChain %_ptr_Function_int %numbers %38 + OpStore %42 %40 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Function_int %numbers %45 + OpStore %48 %47 + %50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Function_int %numbers %51 + OpStore %54 %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %56 = OpLoad %int %55 + %58 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_2 + %59 = OpLoad %float %58 + %62 = OpFOrdLessThan %bool %float_0 %59 + %60 = OpSelect %int %62 %int_1 %int_2 + %64 = OpAccessChain %_ptr_Function_int %numbers %60 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %56 + %67 = OpConvertSToF %float %65 + %68 = OpCompositeConstruct %v2float %66 %67 + OpStore %a %68 + %69 = OpLoad %v2float %a + %70 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %73 = OpLoad %float %72 + %75 = OpCompositeConstruct %v2float %71 %73 + %74 = OpDot %float %69 %75 + OpStore %b %74 + %76 = OpLoad %float %b + %77 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %78 = OpLoad %float %77 + %79 = OpFOrdEqual %bool %76 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + %83 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpConvertSToF %float %84 + %92 = OpConvertSToF %float %86 + %93 = OpConvertSToF %float %88 + %94 = OpConvertSToF %float %90 + %95 = OpCompositeConstruct %v4float %91 %92 %93 %94 + OpStore %x_GLF_color %95 + OpBranch %80 + %82 = OpLabel + %96 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %97 = OpLoad %int %96 + %98 = OpConvertSToF %float %97 + %99 = OpCompositeConstruct %v4float %98 %98 %98 %98 + OpStore %x_GLF_color %99 + OpBranch %80 + %80 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %100 +%tint_symbol = OpFunctionParameter %main_out + %104 = OpLabel + %105 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %105 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %107 = OpLabel + %108 = OpFunctionCall %void %main_1 + %110 = OpLoad %v4float %x_GLF_color + %111 = OpCompositeConstruct %main_out %110 + %109 = OpFunctionCall %void %tint_symbol_2 %111 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a706204f3a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.spvasm.expected.wgsl @@ -0,0 +1,67 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var numbers : array; + var a : vec2; + var b : f32; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + numbers[x_38] = x_40; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[1]; + numbers[x_43] = x_45; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[2]; + numbers[x_48] = x_50; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_56 : f32 = x_9.x_GLF_uniform_float_values[2]; + let x_60 : i32 = numbers[select(2, 1, (0.0 < x_56))]; + a = vec2(f32(x_53), f32(x_60)); + let x_63 : vec2 = a; + let x_65 : f32 = x_9.x_GLF_uniform_float_values[1]; + let x_67 : f32 = x_9.x_GLF_uniform_float_values[1]; + b = dot(x_63, vec2(x_65, x_67)); + let x_70 : f32 = b; + let x_72 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_70 == x_72)) { + let x_78 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_87 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_78), f32(x_81), f32(x_84), f32(x_87)); + } else { + let x_91 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_92 : f32 = f32(x_91); + x_GLF_color = vec4(x_92, x_92, x_92, x_92); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl new file mode 100644 index 0000000000..a706204f3a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl @@ -0,0 +1,67 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var numbers : array; + var a : vec2; + var b : f32; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + numbers[x_38] = x_40; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[1]; + numbers[x_43] = x_45; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[2]; + numbers[x_48] = x_50; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_56 : f32 = x_9.x_GLF_uniform_float_values[2]; + let x_60 : i32 = numbers[select(2, 1, (0.0 < x_56))]; + a = vec2(f32(x_53), f32(x_60)); + let x_63 : vec2 = a; + let x_65 : f32 = x_9.x_GLF_uniform_float_values[1]; + let x_67 : f32 = x_9.x_GLF_uniform_float_values[1]; + b = dot(x_63, vec2(x_65, x_67)); + let x_70 : f32 = b; + let x_72 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_70 == x_72)) { + let x_78 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_87 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_78), f32(x_81), f32(x_84), f32(x_87)); + } else { + let x_91 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_92 : f32 = f32(x_91); + x_GLF_color = vec4(x_92, x_92, x_92, x_92); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..01b699a0fc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.hlsl @@ -0,0 +1,65 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int numbers[3] = (int[3])0; + float2 a = float2(0.0f, 0.0f); + float b = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + numbers[x_38] = x_40; + const int x_43 = asint(x_6[1].x); + const int x_45 = asint(x_6[1].x); + numbers[x_43] = x_45; + const int x_48 = asint(x_6[2].x); + const int x_50 = asint(x_6[2].x); + numbers[x_48] = x_50; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_56 = asfloat(x_9[2].x); + const int x_60 = numbers[((0.0f < x_56) ? 1 : 2)]; + a = float2(float(x_53), float(x_60)); + const float2 x_63 = a; + const float x_65 = asfloat(x_9[1].x); + const float x_67 = asfloat(x_9[1].x); + b = dot(x_63, float2(x_65, x_67)); + const float x_70 = b; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_72 = asfloat(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_70 == x_72)) { + const int x_78 = asint(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_81 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_84 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_87 = asint(x_6[1].x); + x_GLF_color = float4(float(x_78), float(x_81), float(x_84), float(x_87)); + } else { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_91 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_92 = float(x_91); + x_GLF_color = float4(x_92, x_92, x_92, x_92); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..154546203a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.msl @@ -0,0 +1,78 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + int arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + tint_array_wrapper_2 numbers = {}; + float2 a = 0.0f; + float b = 0.0f; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[0].el; + numbers.arr[x_38] = x_40; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_45 = x_6.x_GLF_uniform_int_values.arr[1].el; + numbers.arr[x_43] = x_45; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[2].el; + numbers.arr[x_48] = x_50; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_56 = x_9.x_GLF_uniform_float_values.arr[2].el; + int const x_60 = numbers.arr[select(2, 1, (0.0f < x_56))]; + a = float2(float(x_53), float(x_60)); + float2 const x_63 = a; + float const x_65 = x_9.x_GLF_uniform_float_values.arr[1].el; + float const x_67 = x_9.x_GLF_uniform_float_values.arr[1].el; + b = dot(x_63, float2(x_65, x_67)); + float const x_70 = b; + float const x_72 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_70 == x_72)) { + int const x_78 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_81 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_84 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_87 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_78), float(x_81), float(x_84), float(x_87)); + } else { + int const x_91 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_92 = float(x_91); + *(tint_symbol_4) = float4(x_92, x_92, x_92, x_92); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..cad1211b01 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.spvasm @@ -0,0 +1,170 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %numbers "numbers" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_3_0 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_arr_int_uint_3_0 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3_0 = OpTypePointer Function %_arr_int_uint_3_0 + %26 = OpConstantNull %_arr_int_uint_3_0 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %30 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %33 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %100 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %numbers = OpVariable %_ptr_Function__arr_int_uint_3_0 Function %26 + %a = OpVariable %_ptr_Function_v2float Function %30 + %b = OpVariable %_ptr_Function_float Function %33 + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %40 = OpLoad %int %39 + %42 = OpAccessChain %_ptr_Function_int %numbers %38 + OpStore %42 %40 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Function_int %numbers %45 + OpStore %48 %47 + %50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Function_int %numbers %51 + OpStore %54 %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %56 = OpLoad %int %55 + %58 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_2 + %59 = OpLoad %float %58 + %62 = OpFOrdLessThan %bool %float_0 %59 + %60 = OpSelect %int %62 %int_1 %int_2 + %64 = OpAccessChain %_ptr_Function_int %numbers %60 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %56 + %67 = OpConvertSToF %float %65 + %68 = OpCompositeConstruct %v2float %66 %67 + OpStore %a %68 + %69 = OpLoad %v2float %a + %70 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %73 = OpLoad %float %72 + %75 = OpCompositeConstruct %v2float %71 %73 + %74 = OpDot %float %69 %75 + OpStore %b %74 + %76 = OpLoad %float %b + %77 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %78 = OpLoad %float %77 + %79 = OpFOrdEqual %bool %76 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + %83 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpConvertSToF %float %84 + %92 = OpConvertSToF %float %86 + %93 = OpConvertSToF %float %88 + %94 = OpConvertSToF %float %90 + %95 = OpCompositeConstruct %v4float %91 %92 %93 %94 + OpStore %x_GLF_color %95 + OpBranch %80 + %82 = OpLabel + %96 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %97 = OpLoad %int %96 + %98 = OpConvertSToF %float %97 + %99 = OpCompositeConstruct %v4float %98 %98 %98 %98 + OpStore %x_GLF_color %99 + OpBranch %80 + %80 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %100 +%tint_symbol = OpFunctionParameter %main_out + %104 = OpLabel + %105 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %105 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %107 = OpLabel + %108 = OpFunctionCall %void %main_1 + %110 = OpLoad %v4float %x_GLF_color + %111 = OpCompositeConstruct %main_out %110 + %109 = OpFunctionCall %void %tint_symbol_2 %111 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a706204f3a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-access-array-dot/0-opt.wgsl.expected.wgsl @@ -0,0 +1,67 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var numbers : array; + var a : vec2; + var b : f32; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + numbers[x_38] = x_40; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[1]; + numbers[x_43] = x_45; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[2]; + numbers[x_48] = x_50; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_56 : f32 = x_9.x_GLF_uniform_float_values[2]; + let x_60 : i32 = numbers[select(2, 1, (0.0 < x_56))]; + a = vec2(f32(x_53), f32(x_60)); + let x_63 : vec2 = a; + let x_65 : f32 = x_9.x_GLF_uniform_float_values[1]; + let x_67 : f32 = x_9.x_GLF_uniform_float_values[1]; + b = dot(x_63, vec2(x_65, x_67)); + let x_70 : f32 = b; + let x_72 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_70 == x_72)) { + let x_78 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_87 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_78), f32(x_81), f32(x_84), f32(x_87)); + } else { + let x_91 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_92 : f32 = f32(x_91); + x_GLF_color = vec4(x_92, x_92, x_92, x_92); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm new file mode 100644 index 0000000000..2fd2194a5e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm @@ -0,0 +1,123 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %s "s" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %j "j" + OpName %c "c" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %14 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %float_2 = OpConstant %float 2 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float_3 = OpConstant %float 3 + %int_10 = OpConstant %int 10 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %float_5 = OpConstant %float 5 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %32 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %12 + %33 = OpLabel + %c = OpVariable %_ptr_Function_v4float Function + %34 = OpFunctionCall %float %func_ + %35 = OpCompositeConstruct %v4float %34 %float_0 %float_0 %float_1 + OpStore %c %35 + %36 = OpFunctionCall %float %func_ + %37 = OpFOrdEqual %bool %36 %float_5 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %40 + %39 = OpLabel + %41 = OpLoad %v4float %c + OpStore %_GLF_color %41 + OpBranch %38 + %40 = OpLabel + OpStore %_GLF_color %32 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %float None %14 + %42 = OpLabel + %s = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + OpStore %s %float_2 + OpStore %i %int_0 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %47 = OpLoad %int %i + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %49 = OpLoad %int %48 + %50 = OpIAdd %int %49 %int_1 + %51 = OpSLessThan %bool %47 %50 + OpBranchConditional %51 %52 %44 + %52 = OpLabel + %53 = OpLoad %float %s + %54 = OpFAdd %float %53 %float_3 + OpStore %s %54 + OpStore %j %int_0 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %int %j + %60 = OpSLessThan %bool %59 %int_10 + OpBranchConditional %60 %61 %56 + %61 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %63 = OpLoad %int %62 + %64 = OpIEqual %bool %63 %int_1 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + OpKill + %65 = OpLabel + OpBranch %57 + %57 = OpLabel + %67 = OpLoad %int %j + %68 = OpIAdd %int %67 %int_1 + OpStore %j %68 + OpBranch %55 + %56 = OpLabel + OpBranch %45 + %45 = OpLabel + %69 = OpLoad %int %i + %70 = OpIAdd %int %69 %int_1 + OpStore %i %70 + OpBranch %43 + %44 = OpLabel + %71 = OpLoad %float %s + OpReturnValue %71 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..897064d85d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.hlsl @@ -0,0 +1,61 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_() { + float s = 0.0f; + int i = 0; + int j = 0; + s = 2.0f; + i = 0; + while (true) { + const int x_47 = i; + const int x_49 = asint(x_8[0].x); + if ((x_47 < (x_49 + 1))) { + } else { + break; + } + s = (s + 3.0f); + j = 0; + { + for(; (j < 10); j = (j + 1)) { + const int x_63 = asint(x_8[0].x); + if ((x_63 == 1)) { + discard; + } + } + } + { + i = (i + 1); + } + } + return s; +} + +void main_1() { + float4 c = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_34 = func_(); + c = float4(x_34, 0.0f, 0.0f, 1.0f); + const float x_36 = func_(); + if ((x_36 == 5.0f)) { + x_GLF_color = c; + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..9140262fdd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_(constant buf0& x_8) { + float s = 0.0f; + int i = 0; + int j = 0; + s = 2.0f; + i = 0; + while (true) { + int const x_47 = i; + int const x_49 = x_8.zero; + if ((x_47 < (x_49 + 1))) { + } else { + break; + } + float const x_53 = s; + s = (x_53 + 3.0f); + j = 0; + while (true) { + int const x_59 = j; + if ((x_59 < 10)) { + } else { + break; + } + int const x_63 = x_8.zero; + if ((x_63 == 1)) { + discard_fragment(); + } + { + int const x_67 = j; + j = (x_67 + 1); + } + } + { + int const x_69 = i; + i = (x_69 + 1); + } + } + float const x_71 = s; + return x_71; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + float4 c = 0.0f; + float const x_34 = func_(x_8); + c = float4(x_34, 0.0f, 0.0f, 1.0f); + float const x_36 = func_(x_8); + if ((x_36 == 5.0f)) { + float4 const x_41 = c; + *(tint_symbol_4) = x_41; + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..d7c1363a46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.spvasm @@ -0,0 +1,168 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 94 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %s "s" + OpName %i "i" + OpName %j "j" + OpName %main_1 "main_1" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %12 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_2 = OpConstant %float 2 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float_3 = OpConstant %float 3 + %int_10 = OpConstant %int 10 + %void = OpTypeVoid + %64 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %float_5 = OpConstant %float 5 + %81 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %82 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %12 + %14 = OpLabel + %s = OpVariable %_ptr_Function_float Function %17 + %i = OpVariable %_ptr_Function_int Function %20 + %j = OpVariable %_ptr_Function_int Function %20 + OpStore %s %float_2 + OpStore %i %int_0 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %i + %32 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %33 = OpLoad %int %32 + %35 = OpIAdd %int %33 %int_1 + %36 = OpSLessThan %bool %28 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + OpBranch %38 + %40 = OpLabel + OpBranch %25 + %38 = OpLabel + %41 = OpLoad %float %s + %43 = OpFAdd %float %41 %float_3 + OpStore %s %43 + OpStore %j %int_0 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %j + %50 = OpSLessThan %bool %48 %int_10 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpBranch %51 + %53 = OpLabel + OpBranch %45 + %51 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %55 = OpLoad %int %54 + %56 = OpIEqual %bool %55 %int_1 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + OpKill + %57 = OpLabel + OpBranch %46 + %46 = OpLabel + %59 = OpLoad %int %j + %60 = OpIAdd %int %59 %int_1 + OpStore %j %60 + OpBranch %44 + %45 = OpLabel + OpBranch %26 + %26 = OpLabel + %61 = OpLoad %int %i + %62 = OpIAdd %int %61 %int_1 + OpStore %i %62 + OpBranch %24 + %25 = OpLabel + %63 = OpLoad %float %s + OpReturnValue %63 + OpFunctionEnd + %main_1 = OpFunction %void None %64 + %67 = OpLabel + %c = OpVariable %_ptr_Function_v4float Function %9 + %70 = OpFunctionCall %float %func_ + %73 = OpCompositeConstruct %v4float %70 %float_0 %float_0 %float_1 + OpStore %c %73 + %74 = OpFunctionCall %float %func_ + %76 = OpFOrdEqual %bool %74 %float_5 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + %80 = OpLoad %v4float %c + OpStore %x_GLF_color %80 + OpBranch %77 + %79 = OpLabel + OpStore %x_GLF_color %81 + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %82 +%tint_symbol = OpFunctionParameter %main_out + %86 = OpLabel + %87 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %87 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %64 + %89 = OpLabel + %90 = OpFunctionCall %void %main_1 + %92 = OpLoad %v4float %x_GLF_color + %93 = OpCompositeConstruct %main_out %92 + %91 = OpFunctionCall %void %tint_symbol_2 %93 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f8b40bd14e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.spvasm.expected.wgsl @@ -0,0 +1,75 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var s : f32; + var i : i32; + var j : i32; + s = 2.0; + i = 0; + loop { + let x_47 : i32 = i; + let x_49 : i32 = x_8.zero; + if ((x_47 < (x_49 + 1))) { + } else { + break; + } + let x_53 : f32 = s; + s = (x_53 + 3.0); + j = 0; + loop { + let x_59 : i32 = j; + if ((x_59 < 10)) { + } else { + break; + } + let x_63 : i32 = x_8.zero; + if ((x_63 == 1)) { + discard; + } + + continuing { + let x_67 : i32 = j; + j = (x_67 + 1); + } + } + + continuing { + let x_69 : i32 = i; + i = (x_69 + 1); + } + } + let x_71 : f32 = s; + return x_71; +} + +fn main_1() { + var c : vec4; + let x_34 : f32 = func_(); + c = vec4(x_34, 0.0, 0.0, 1.0); + let x_36 : f32 = func_(); + if ((x_36 == 5.0)) { + let x_41 : vec4 = c; + x_GLF_color = x_41; + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl new file mode 100644 index 0000000000..f8b40bd14e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl @@ -0,0 +1,75 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var s : f32; + var i : i32; + var j : i32; + s = 2.0; + i = 0; + loop { + let x_47 : i32 = i; + let x_49 : i32 = x_8.zero; + if ((x_47 < (x_49 + 1))) { + } else { + break; + } + let x_53 : f32 = s; + s = (x_53 + 3.0); + j = 0; + loop { + let x_59 : i32 = j; + if ((x_59 < 10)) { + } else { + break; + } + let x_63 : i32 = x_8.zero; + if ((x_63 == 1)) { + discard; + } + + continuing { + let x_67 : i32 = j; + j = (x_67 + 1); + } + } + + continuing { + let x_69 : i32 = i; + i = (x_69 + 1); + } + } + let x_71 : f32 = s; + return x_71; +} + +fn main_1() { + var c : vec4; + let x_34 : f32 = func_(); + c = vec4(x_34, 0.0, 0.0, 1.0); + let x_36 : f32 = func_(); + if ((x_36 == 5.0)) { + let x_41 : vec4 = c; + x_GLF_color = x_41; + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..897064d85d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.hlsl @@ -0,0 +1,61 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_() { + float s = 0.0f; + int i = 0; + int j = 0; + s = 2.0f; + i = 0; + while (true) { + const int x_47 = i; + const int x_49 = asint(x_8[0].x); + if ((x_47 < (x_49 + 1))) { + } else { + break; + } + s = (s + 3.0f); + j = 0; + { + for(; (j < 10); j = (j + 1)) { + const int x_63 = asint(x_8[0].x); + if ((x_63 == 1)) { + discard; + } + } + } + { + i = (i + 1); + } + } + return s; +} + +void main_1() { + float4 c = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_34 = func_(); + c = float4(x_34, 0.0f, 0.0f, 1.0f); + const float x_36 = func_(); + if ((x_36 == 5.0f)) { + x_GLF_color = c; + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..9140262fdd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_(constant buf0& x_8) { + float s = 0.0f; + int i = 0; + int j = 0; + s = 2.0f; + i = 0; + while (true) { + int const x_47 = i; + int const x_49 = x_8.zero; + if ((x_47 < (x_49 + 1))) { + } else { + break; + } + float const x_53 = s; + s = (x_53 + 3.0f); + j = 0; + while (true) { + int const x_59 = j; + if ((x_59 < 10)) { + } else { + break; + } + int const x_63 = x_8.zero; + if ((x_63 == 1)) { + discard_fragment(); + } + { + int const x_67 = j; + j = (x_67 + 1); + } + } + { + int const x_69 = i; + i = (x_69 + 1); + } + } + float const x_71 = s; + return x_71; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + float4 c = 0.0f; + float const x_34 = func_(x_8); + c = float4(x_34, 0.0f, 0.0f, 1.0f); + float const x_36 = func_(x_8); + if ((x_36 == 5.0f)) { + float4 const x_41 = c; + *(tint_symbol_4) = x_41; + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..d7c1363a46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.spvasm @@ -0,0 +1,168 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 94 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %s "s" + OpName %i "i" + OpName %j "j" + OpName %main_1 "main_1" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %12 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_2 = OpConstant %float 2 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float_3 = OpConstant %float 3 + %int_10 = OpConstant %int 10 + %void = OpTypeVoid + %64 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %float_5 = OpConstant %float 5 + %81 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %82 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %12 + %14 = OpLabel + %s = OpVariable %_ptr_Function_float Function %17 + %i = OpVariable %_ptr_Function_int Function %20 + %j = OpVariable %_ptr_Function_int Function %20 + OpStore %s %float_2 + OpStore %i %int_0 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %i + %32 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %33 = OpLoad %int %32 + %35 = OpIAdd %int %33 %int_1 + %36 = OpSLessThan %bool %28 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + OpBranch %38 + %40 = OpLabel + OpBranch %25 + %38 = OpLabel + %41 = OpLoad %float %s + %43 = OpFAdd %float %41 %float_3 + OpStore %s %43 + OpStore %j %int_0 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %j + %50 = OpSLessThan %bool %48 %int_10 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpBranch %51 + %53 = OpLabel + OpBranch %45 + %51 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %55 = OpLoad %int %54 + %56 = OpIEqual %bool %55 %int_1 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + OpKill + %57 = OpLabel + OpBranch %46 + %46 = OpLabel + %59 = OpLoad %int %j + %60 = OpIAdd %int %59 %int_1 + OpStore %j %60 + OpBranch %44 + %45 = OpLabel + OpBranch %26 + %26 = OpLabel + %61 = OpLoad %int %i + %62 = OpIAdd %int %61 %int_1 + OpStore %i %62 + OpBranch %24 + %25 = OpLabel + %63 = OpLoad %float %s + OpReturnValue %63 + OpFunctionEnd + %main_1 = OpFunction %void None %64 + %67 = OpLabel + %c = OpVariable %_ptr_Function_v4float Function %9 + %70 = OpFunctionCall %float %func_ + %73 = OpCompositeConstruct %v4float %70 %float_0 %float_0 %float_1 + OpStore %c %73 + %74 = OpFunctionCall %float %func_ + %76 = OpFOrdEqual %bool %74 %float_5 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + %80 = OpLoad %v4float %c + OpStore %x_GLF_color %80 + OpBranch %77 + %79 = OpLabel + OpStore %x_GLF_color %81 + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %82 +%tint_symbol = OpFunctionParameter %main_out + %86 = OpLabel + %87 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %87 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %64 + %89 = OpLabel + %90 = OpFunctionCall %void %main_1 + %92 = OpLoad %v4float %x_GLF_color + %93 = OpCompositeConstruct %main_out %92 + %91 = OpFunctionCall %void %tint_symbol_2 %93 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f8b40bd14e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-analysis-reachable-from-many/0-opt.wgsl.expected.wgsl @@ -0,0 +1,75 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var s : f32; + var i : i32; + var j : i32; + s = 2.0; + i = 0; + loop { + let x_47 : i32 = i; + let x_49 : i32 = x_8.zero; + if ((x_47 < (x_49 + 1))) { + } else { + break; + } + let x_53 : f32 = s; + s = (x_53 + 3.0); + j = 0; + loop { + let x_59 : i32 = j; + if ((x_59 < 10)) { + } else { + break; + } + let x_63 : i32 = x_8.zero; + if ((x_63 == 1)) { + discard; + } + + continuing { + let x_67 : i32 = j; + j = (x_67 + 1); + } + } + + continuing { + let x_69 : i32 = i; + i = (x_69 + 1); + } + } + let x_71 : f32 = s; + return x_71; +} + +fn main_1() { + var c : vec4; + let x_34 : f32 = func_(); + c = vec4(x_34, 0.0, 0.0, 1.0); + let x_36 : f32 = func_(); + if ((x_36 == 5.0)) { + let x_41 : vec4 = c; + x_GLF_color = x_41; + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm new file mode 100644 index 0000000000..e055b345cf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm @@ -0,0 +1,117 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %v "v" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v2float = OpTypeVector %float 2 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_int = OpTypePointer Function %int + %uint_0 = OpConstant %uint 0 + %main = OpFunction %void None %13 + %37 = OpLabel + %v = OpVariable %_ptr_Function_v2int Function + %38 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpFOrdLessThan %bool %39 %41 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpConvertSToF %float %47 + %49 = OpCompositeConstruct %v4float %48 %48 %48 %48 + OpStore %_GLF_color %49 + OpBranch %43 + %45 = OpLabel + %50 = OpLoad %v4float %gl_FragCoord + %51 = OpVectorShuffle %v2float %50 %50 0 1 + %52 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpCompositeConstruct %v2float %53 %55 + %57 = OpFSub %v2float %51 %56 + %58 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %59 = OpLoad %float %58 + %60 = OpVectorTimesScalar %v2float %57 %59 + %61 = OpConvertFToS %v2int %60 + OpStore %v %61 + %62 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %63 = OpLoad %float %62 + %64 = OpAccessChain %_ptr_Function_int %v %uint_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpISub %int %65 %67 + %69 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %70 = OpLoad %int %69 + %71 = OpBitwiseAnd %int %68 %70 + %72 = OpConvertSToF %float %71 + %73 = OpAccessChain %_ptr_Function_int %v %uint_0 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %76 = OpLoad %int %75 + %77 = OpBitwiseAnd %int %74 %76 + %78 = OpConvertSToF %float %77 + %79 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %80 = OpLoad %float %79 + %81 = OpCompositeConstruct %v4float %63 %72 %78 %80 + OpStore %_GLF_color %81 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..810c81c7d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.hlsl @@ -0,0 +1,56 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[2]; +}; + +void main_1() { + int2 v = int2(0, 0); + const float x_39 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_39 < x_41)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_48 = float(x_47); + x_GLF_color = float4(x_48, x_48, x_48, x_48); + } else { + const float4 x_50 = gl_FragCoord; + const float x_53 = asfloat(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_59 = asfloat(x_6[2].x); + v = int2(((float2(x_50.x, x_50.y) - float2(x_53, x_55)) * x_59)); + const float x_63 = asfloat(x_6[1].x); + const int x_65 = v.y; + const int x_67 = asint(x_8[1].x); + const int x_70 = asint(x_8[1].x); + const int x_74 = v.x; + const int x_76 = asint(x_8[1].x); + const float x_80 = asfloat(x_6[1].x); + x_GLF_color = float4(x_63, float(((x_65 - x_67) & x_70)), float((x_74 & x_76)), x_80); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4c716f0b9a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.msl @@ -0,0 +1,66 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int2 v = 0; + float const x_39 = (*(tint_symbol_5)).y; + float const x_41 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_39 < x_41)) { + int const x_47 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_48 = float(x_47); + *(tint_symbol_6) = float4(x_48, x_48, x_48, x_48); + } else { + float4 const x_50 = *(tint_symbol_5); + float const x_53 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_55 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_59 = x_6.x_GLF_uniform_float_values.arr[2].el; + v = int2(((float2(x_50.x, x_50.y) - float2(x_53, x_55)) * x_59)); + float const x_63 = x_6.x_GLF_uniform_float_values.arr[1].el; + int const x_65 = v.y; + int const x_67 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_70 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_74 = v.x; + int const x_76 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_80 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_6) = float4(x_63, float(((x_65 - x_67) & x_70)), float((x_74 & x_76)), x_80); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, x_8, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..c4e83440ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.spvasm @@ -0,0 +1,156 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 101 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %30 = OpConstantNull %v2int + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %v2float = OpTypeVector %float 2 +%_ptr_Function_int = OpTypePointer Function %int + %main_out = OpTypeStruct %v4float + %88 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %v = OpVariable %_ptr_Function_v2int Function %30 + %33 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %34 = OpLoad %float %33 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpFOrdLessThan %bool %34 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %44 + %43 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpConvertSToF %float %47 + %49 = OpCompositeConstruct %v4float %48 %48 %48 %48 + OpStore %x_GLF_color %49 + OpBranch %42 + %44 = OpLabel + %50 = OpLoad %v4float %gl_FragCoord + %52 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %55 = OpLoad %float %54 + %57 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %58 = OpLoad %float %57 + %61 = OpCompositeExtract %float %50 0 + %62 = OpCompositeExtract %float %50 1 + %63 = OpCompositeConstruct %v2float %61 %62 + %64 = OpCompositeConstruct %v2float %53 %55 + %65 = OpFSub %v2float %63 %64 + %66 = OpVectorTimesScalar %v2float %65 %58 + %59 = OpConvertFToS %v2int %66 + OpStore %v %59 + %67 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %68 = OpLoad %float %67 + %70 = OpAccessChain %_ptr_Function_int %v %uint_1 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Function_int %v %uint_0 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %81 = OpLoad %float %80 + %83 = OpISub %int %71 %73 + %84 = OpBitwiseAnd %int %83 %75 + %82 = OpConvertSToF %float %84 + %86 = OpBitwiseAnd %int %77 %79 + %85 = OpConvertSToF %float %86 + %87 = OpCompositeConstruct %v4float %68 %82 %85 %81 + OpStore %x_GLF_color %87 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %88 +%tint_symbol_1 = OpFunctionParameter %main_out + %92 = OpLabel + %93 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %93 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %95 = OpLabel + %96 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %96 + %97 = OpFunctionCall %void %main_1 + %99 = OpLoad %v4float %x_GLF_color + %100 = OpCompositeConstruct %main_out %99 + %98 = OpFunctionCall %void %tint_symbol_3 %100 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..9a549c4231 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.spvasm.expected.wgsl @@ -0,0 +1,59 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var v : vec2; + let x_39 : f32 = gl_FragCoord.y; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_39 < x_41)) { + let x_47 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_48 : f32 = f32(x_47); + x_GLF_color = vec4(x_48, x_48, x_48, x_48); + } else { + let x_50 : vec4 = gl_FragCoord; + let x_53 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_59 : f32 = x_6.x_GLF_uniform_float_values[2]; + v = vec2(((vec2(x_50.x, x_50.y) - vec2(x_53, x_55)) * x_59)); + let x_63 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_65 : i32 = v.y; + let x_67 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_70 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_74 : i32 = v.x; + let x_76 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_80 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_63, f32(((x_65 - x_67) & x_70)), f32((x_74 & x_76)), x_80); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl new file mode 100644 index 0000000000..9a549c4231 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl @@ -0,0 +1,59 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var v : vec2; + let x_39 : f32 = gl_FragCoord.y; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_39 < x_41)) { + let x_47 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_48 : f32 = f32(x_47); + x_GLF_color = vec4(x_48, x_48, x_48, x_48); + } else { + let x_50 : vec4 = gl_FragCoord; + let x_53 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_59 : f32 = x_6.x_GLF_uniform_float_values[2]; + v = vec2(((vec2(x_50.x, x_50.y) - vec2(x_53, x_55)) * x_59)); + let x_63 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_65 : i32 = v.y; + let x_67 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_70 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_74 : i32 = v.x; + let x_76 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_80 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_63, f32(((x_65 - x_67) & x_70)), f32((x_74 & x_76)), x_80); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..810c81c7d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.hlsl @@ -0,0 +1,56 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[2]; +}; + +void main_1() { + int2 v = int2(0, 0); + const float x_39 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_39 < x_41)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_48 = float(x_47); + x_GLF_color = float4(x_48, x_48, x_48, x_48); + } else { + const float4 x_50 = gl_FragCoord; + const float x_53 = asfloat(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_59 = asfloat(x_6[2].x); + v = int2(((float2(x_50.x, x_50.y) - float2(x_53, x_55)) * x_59)); + const float x_63 = asfloat(x_6[1].x); + const int x_65 = v.y; + const int x_67 = asint(x_8[1].x); + const int x_70 = asint(x_8[1].x); + const int x_74 = v.x; + const int x_76 = asint(x_8[1].x); + const float x_80 = asfloat(x_6[1].x); + x_GLF_color = float4(x_63, float(((x_65 - x_67) & x_70)), float((x_74 & x_76)), x_80); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4c716f0b9a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.msl @@ -0,0 +1,66 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int2 v = 0; + float const x_39 = (*(tint_symbol_5)).y; + float const x_41 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_39 < x_41)) { + int const x_47 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_48 = float(x_47); + *(tint_symbol_6) = float4(x_48, x_48, x_48, x_48); + } else { + float4 const x_50 = *(tint_symbol_5); + float const x_53 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_55 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_59 = x_6.x_GLF_uniform_float_values.arr[2].el; + v = int2(((float2(x_50.x, x_50.y) - float2(x_53, x_55)) * x_59)); + float const x_63 = x_6.x_GLF_uniform_float_values.arr[1].el; + int const x_65 = v.y; + int const x_67 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_70 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_74 = v.x; + int const x_76 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_80 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_6) = float4(x_63, float(((x_65 - x_67) & x_70)), float((x_74 & x_76)), x_80); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, x_8, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..c4e83440ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.spvasm @@ -0,0 +1,156 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 101 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %30 = OpConstantNull %v2int + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %v2float = OpTypeVector %float 2 +%_ptr_Function_int = OpTypePointer Function %int + %main_out = OpTypeStruct %v4float + %88 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %v = OpVariable %_ptr_Function_v2int Function %30 + %33 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %34 = OpLoad %float %33 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpFOrdLessThan %bool %34 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %44 + %43 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpConvertSToF %float %47 + %49 = OpCompositeConstruct %v4float %48 %48 %48 %48 + OpStore %x_GLF_color %49 + OpBranch %42 + %44 = OpLabel + %50 = OpLoad %v4float %gl_FragCoord + %52 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %55 = OpLoad %float %54 + %57 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %58 = OpLoad %float %57 + %61 = OpCompositeExtract %float %50 0 + %62 = OpCompositeExtract %float %50 1 + %63 = OpCompositeConstruct %v2float %61 %62 + %64 = OpCompositeConstruct %v2float %53 %55 + %65 = OpFSub %v2float %63 %64 + %66 = OpVectorTimesScalar %v2float %65 %58 + %59 = OpConvertFToS %v2int %66 + OpStore %v %59 + %67 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %68 = OpLoad %float %67 + %70 = OpAccessChain %_ptr_Function_int %v %uint_1 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Function_int %v %uint_0 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %81 = OpLoad %float %80 + %83 = OpISub %int %71 %73 + %84 = OpBitwiseAnd %int %83 %75 + %82 = OpConvertSToF %float %84 + %86 = OpBitwiseAnd %int %77 %79 + %85 = OpConvertSToF %float %86 + %87 = OpCompositeConstruct %v4float %68 %82 %85 %81 + OpStore %x_GLF_color %87 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %88 +%tint_symbol_1 = OpFunctionParameter %main_out + %92 = OpLabel + %93 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %93 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %95 = OpLabel + %96 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %96 + %97 = OpFunctionCall %void %main_1 + %99 = OpLoad %v4float %x_GLF_color + %100 = OpCompositeConstruct %main_out %99 + %98 = OpFunctionCall %void %tint_symbol_3 %100 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..9a549c4231 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-and-even-numbers-from-fragcoord/0-opt.wgsl.expected.wgsl @@ -0,0 +1,59 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var v : vec2; + let x_39 : f32 = gl_FragCoord.y; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_39 < x_41)) { + let x_47 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_48 : f32 = f32(x_47); + x_GLF_color = vec4(x_48, x_48, x_48, x_48); + } else { + let x_50 : vec4 = gl_FragCoord; + let x_53 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_59 : f32 = x_6.x_GLF_uniform_float_values[2]; + v = vec2(((vec2(x_50.x, x_50.y) - vec2(x_53, x_55)) * x_59)); + let x_63 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_65 : i32 = v.y; + let x_67 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_70 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_74 : i32 = v.x; + let x_76 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_80 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_63, f32(((x_65 - x_67) & x_70)), f32((x_74 & x_76)), x_80); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm new file mode 100644 index 0000000000..5f64beef8f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm @@ -0,0 +1,72 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v "v" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %_ "" + OpName %d "d" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%float_0_100000001 = OpConstant %float 0.100000001 + %14 = OpConstantComposite %v2float %float_0_100000001 %float_0_100000001 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %v2int = OpTypeVector %int 2 +%_ptr_Function_float = OpTypePointer Function %float +%float_1_15927994 = OpConstant %float 1.15927994 +%float_0_64349997 = OpConstant %float 0.64349997 + %24 = OpConstantComposite %v2float %float_1_15927994 %float_0_64349997 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %32 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %33 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function + %d = OpVariable %_ptr_Function_float Function + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %35 = OpLoad %int %34 + %36 = OpCompositeConstruct %v2int %35 %int_3 + %37 = OpExtInst %v2float %1 Ldexp %14 %36 + %38 = OpExtInst %v2float %1 Acos %37 + OpStore %v %38 + %39 = OpLoad %v2float %v + %40 = OpExtInst %float %1 Distance %39 %24 + OpStore %d %40 + %41 = OpLoad %float %d + %42 = OpFOrdLessThan %bool %41 %float_0_00999999978 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + OpStore %_GLF_color %31 + OpBranch %43 + %45 = OpLabel + OpStore %_GLF_color %32 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..7f591b193f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,32 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v = float2(0.0f, 0.0f); + float d = 0.0f; + const int x_35 = asint(x_6[0].x); + v = acos(ldexp(float2(0.100000001f, 0.100000001f), int2(x_35, 3))); + d = distance(v, float2(1.159279943f, 0.64349997f)); + if ((d < 0.01f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..7cbea1ffed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int two; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2 v = 0.0f; + float d = 0.0f; + int const x_35 = x_6.two; + v = acos(ldexp(float2(0.100000001f, 0.100000001f), int2(x_35, 3))); + float2 const x_39 = v; + d = distance(x_39, float2(1.159279943f, 0.64349997f)); + float const x_41 = d; + if ((x_41 < 0.01f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..abe5509bdf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %29 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %d "d" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %19 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%float_0_100000001 = OpConstant %float 0.100000001 + %32 = OpConstantComposite %v2float %float_0_100000001 %float_0_100000001 + %v2int = OpTypeVector %int 2 + %int_3 = OpConstant %int 3 +%float_1_15927994 = OpConstant %float 1.15927994 +%float_0_64349997 = OpConstant %float 0.64349997 + %40 = OpConstantComposite %v2float %float_1_15927994 %float_0_64349997 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %50 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %51 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %52 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %19 + %d = OpVariable %_ptr_Function_float Function %22 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %27 = OpLoad %int %26 + %35 = OpCompositeConstruct %v2int %27 %int_3 + %30 = OpExtInst %v2float %29 Ldexp %32 %35 + %28 = OpExtInst %v2float %29 Acos %30 + OpStore %v %28 + %36 = OpLoad %v2float %v + %37 = OpExtInst %float %29 Distance %36 %40 + OpStore %d %37 + %41 = OpLoad %float %d + %43 = OpFOrdLessThan %bool %41 %float_0_00999999978 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpStore %x_GLF_color %50 + OpBranch %45 + %47 = OpLabel + OpStore %x_GLF_color %51 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %52 +%tint_symbol = OpFunctionParameter %main_out + %56 = OpLabel + %57 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %57 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %59 = OpLabel + %60 = OpFunctionCall %void %main_1 + %62 = OpLoad %v4float %x_GLF_color + %63 = OpCompositeConstruct %main_out %62 + %61 = OpFunctionCall %void %tint_symbol_2 %63 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..eb2961429c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,35 @@ +[[block]] +struct buf0 { + two : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec2; + var d : f32; + let x_35 : i32 = x_6.two; + v = acos(ldexp(vec2(0.100000001, 0.100000001), vec2(x_35, 3))); + let x_39 : vec2 = v; + d = distance(x_39, vec2(1.159279943, 0.64349997)); + let x_41 : f32 = d; + if ((x_41 < 0.01)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl new file mode 100644 index 0000000000..eb2961429c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl @@ -0,0 +1,35 @@ +[[block]] +struct buf0 { + two : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec2; + var d : f32; + let x_35 : i32 = x_6.two; + v = acos(ldexp(vec2(0.100000001, 0.100000001), vec2(x_35, 3))); + let x_39 : vec2 = v; + d = distance(x_39, vec2(1.159279943, 0.64349997)); + let x_41 : f32 = d; + if ((x_41 < 0.01)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..7f591b193f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v = float2(0.0f, 0.0f); + float d = 0.0f; + const int x_35 = asint(x_6[0].x); + v = acos(ldexp(float2(0.100000001f, 0.100000001f), int2(x_35, 3))); + d = distance(v, float2(1.159279943f, 0.64349997f)); + if ((d < 0.01f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..7cbea1ffed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int two; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2 v = 0.0f; + float d = 0.0f; + int const x_35 = x_6.two; + v = acos(ldexp(float2(0.100000001f, 0.100000001f), int2(x_35, 3))); + float2 const x_39 = v; + d = distance(x_39, float2(1.159279943f, 0.64349997f)); + float const x_41 = d; + if ((x_41 < 0.01f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..abe5509bdf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %29 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %d "d" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %19 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%float_0_100000001 = OpConstant %float 0.100000001 + %32 = OpConstantComposite %v2float %float_0_100000001 %float_0_100000001 + %v2int = OpTypeVector %int 2 + %int_3 = OpConstant %int 3 +%float_1_15927994 = OpConstant %float 1.15927994 +%float_0_64349997 = OpConstant %float 0.64349997 + %40 = OpConstantComposite %v2float %float_1_15927994 %float_0_64349997 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %50 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %51 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %52 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %19 + %d = OpVariable %_ptr_Function_float Function %22 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %27 = OpLoad %int %26 + %35 = OpCompositeConstruct %v2int %27 %int_3 + %30 = OpExtInst %v2float %29 Ldexp %32 %35 + %28 = OpExtInst %v2float %29 Acos %30 + OpStore %v %28 + %36 = OpLoad %v2float %v + %37 = OpExtInst %float %29 Distance %36 %40 + OpStore %d %37 + %41 = OpLoad %float %d + %43 = OpFOrdLessThan %bool %41 %float_0_00999999978 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpStore %x_GLF_color %50 + OpBranch %45 + %47 = OpLabel + OpStore %x_GLF_color %51 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %52 +%tint_symbol = OpFunctionParameter %main_out + %56 = OpLabel + %57 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %57 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %59 = OpLabel + %60 = OpFunctionCall %void %main_1 + %62 = OpLoad %v4float %x_GLF_color + %63 = OpCompositeConstruct %main_out %62 + %61 = OpFunctionCall %void %tint_symbol_2 %63 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..eb2961429c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-acos-ldexp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,35 @@ +[[block]] +struct buf0 { + two : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec2; + var d : f32; + let x_35 : i32 = x_6.two; + v = acos(ldexp(vec2(0.100000001, 0.100000001), vec2(x_35, 3))); + let x_39 : vec2 = v; + d = distance(x_39, vec2(1.159279943, 0.64349997)); + let x_41 : f32 = d; + if ((x_41 < 0.01)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm new file mode 100644 index 0000000000..835b59596a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm @@ -0,0 +1,143 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %nan "nan" + OpName %undefined "undefined" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_10 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 + %int_n1 = OpConstant %int -1 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 + %buf1 = OpTypeStruct %_arr_int_uint_10 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_8 = OpConstant %int 8 + %main = OpFunction %void None %13 + %40 = OpLabel + %nan = OpVariable %_ptr_Function_float Function + %undefined = OpVariable %_ptr_Function_v4float Function + %41 = OpBitcast %float %int_n1 + OpStore %nan %41 + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %43 + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %49 + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpCompositeConstruct %v4float %44 %47 %50 %53 + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %56 = OpLoad %int %55 + %57 = OpConvertSToF %float %56 + %58 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_7 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpCompositeConstruct %v4float %57 %60 %63 %66 + %68 = OpLoad %float %nan + %69 = OpCompositeConstruct %v4float %68 %68 %68 %68 + %70 = OpExtInst %v4float %1 FMix %54 %67 %69 + OpStore %undefined %70 + %71 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_9 + %74 = OpLoad %int %73 + %75 = OpIEqual %bool %72 %74 + %76 = OpLogicalNot %bool %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + %79 = OpAccessChain %_ptr_Function_float %undefined %uint_0 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %82 = OpLoad %float %81 + %83 = OpFOrdGreaterThan %bool %80 %82 + OpBranch %77 + %77 = OpLabel + %84 = OpPhi %bool %75 %40 %83 %78 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %87 + %86 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %89 = OpLoad %int %88 + %90 = OpConvertSToF %float %89 + %91 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %92 + %94 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %98 = OpLoad %int %97 + %99 = OpConvertSToF %float %98 + %100 = OpCompositeConstruct %v4float %90 %93 %96 %99 + OpStore %_GLF_color %100 + OpBranch %85 + %87 = OpLabel + %101 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %102 = OpLoad %int %101 + %103 = OpConvertSToF %float %102 + %104 = OpCompositeConstruct %v4float %103 %103 %103 %103 + OpStore %_GLF_color %104 + OpBranch %85 + %85 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..b8826cff8b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.hlsl @@ -0,0 +1,66 @@ +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[10]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float nan = 0.0f; + float4 undefined = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_83 = false; + bool x_84_phi = false; + nan = asfloat(-1); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_43 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const int x_46 = asint(x_7[1].x); + const int x_49 = asint(x_7[2].x); + const int x_52 = asint(x_7[3].x); + const int x_56 = asint(x_7[4].x); + const int x_59 = asint(x_7[5].x); + const int x_62 = asint(x_7[6].x); + const int x_65 = asint(x_7[7].x); + const float x_68 = nan; + undefined = lerp(float4(float(x_43), float(x_46), float(x_49), float(x_52)), float4(float(x_56), float(x_59), float(x_62), float(x_65)), float4(x_68, x_68, x_68, x_68)); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_72 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_74 = asint(x_7[9].x); + const bool x_75 = (x_72 == x_74); + x_84_phi = x_75; + if (!(x_75)) { + const float x_80 = undefined.x; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_82 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_83 = (x_80 > x_82); + x_84_phi = x_83; + } + if (x_84_phi) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_89 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_92 = asint(x_7[8].x); + const int x_95 = asint(x_7[8].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_98 = asint(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_89), float(x_92), float(x_95), float(x_98)); + } else { + const int x_102 = asint(x_7[8].x); + const float x_103 = float(x_102); + x_GLF_color = float4(x_103, x_103, x_103, x_103); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..95cc7fb0e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[10]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_9, thread float4* const tint_symbol_4) { + float nan = 0.0f; + float4 undefined = 0.0f; + bool x_83 = false; + bool x_84_phi = false; + nan = as_type(-1); + int const x_43 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_46 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_49 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_52 = x_7.x_GLF_uniform_int_values.arr[3].el; + int const x_56 = x_7.x_GLF_uniform_int_values.arr[4].el; + int const x_59 = x_7.x_GLF_uniform_int_values.arr[5].el; + int const x_62 = x_7.x_GLF_uniform_int_values.arr[6].el; + int const x_65 = x_7.x_GLF_uniform_int_values.arr[7].el; + float const x_68 = nan; + undefined = mix(float4(float(x_43), float(x_46), float(x_49), float(x_52)), float4(float(x_56), float(x_59), float(x_62), float(x_65)), float4(x_68, x_68, x_68, x_68)); + int const x_72 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_74 = x_7.x_GLF_uniform_int_values.arr[9].el; + bool const x_75 = (x_72 == x_74); + x_84_phi = x_75; + if (!(x_75)) { + float const x_80 = undefined.x; + float const x_82 = x_9.x_GLF_uniform_float_values.arr[0].el; + x_83 = (x_80 > x_82); + x_84_phi = x_83; + } + bool const x_84 = x_84_phi; + if (x_84) { + int const x_89 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_92 = x_7.x_GLF_uniform_int_values.arr[8].el; + int const x_95 = x_7.x_GLF_uniform_int_values.arr[8].el; + int const x_98 = x_7.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_89), float(x_92), float(x_95), float(x_98)); + } else { + int const x_102 = x_7.x_GLF_uniform_int_values.arr[8].el; + float const x_103 = float(x_102); + *(tint_symbol_4) = float4(x_103, x_103, x_103, x_103); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..a076bbb521 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.spvasm @@ -0,0 +1,187 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 126 +; Schema: 0 + OpCapability Shader + %64 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %nan "nan" + OpName %undefined "undefined" + OpName %x_83 "x_83" + OpName %x_84_phi "x_84_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 + %buf1 = OpTypeStruct %_arr_int_uint_10 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %32 = OpConstantNull %bool + %int_n1 = OpConstant %int -1 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_9 = OpConstant %int 9 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float + %114 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %nan = OpVariable %_ptr_Function_float Function %26 + %undefined = OpVariable %_ptr_Function_v4float Function %17 + %x_83 = OpVariable %_ptr_Function_bool Function %32 + %x_84_phi = OpVariable %_ptr_Function_bool Function %32 + %34 = OpBitcast %float %int_n1 + OpStore %nan %34 + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %40 = OpLoad %int %39 + %42 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %43 = OpLoad %int %42 + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %46 = OpLoad %int %45 + %48 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_3 + %49 = OpLoad %int %48 + %51 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_4 + %52 = OpLoad %int %51 + %54 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_5 + %55 = OpLoad %int %54 + %57 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_6 + %58 = OpLoad %int %57 + %60 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_7 + %61 = OpLoad %int %60 + %62 = OpLoad %float %nan + %65 = OpConvertSToF %float %40 + %66 = OpConvertSToF %float %43 + %67 = OpConvertSToF %float %46 + %68 = OpConvertSToF %float %49 + %69 = OpCompositeConstruct %v4float %65 %66 %67 %68 + %70 = OpConvertSToF %float %52 + %71 = OpConvertSToF %float %55 + %72 = OpConvertSToF %float %58 + %73 = OpConvertSToF %float %61 + %74 = OpCompositeConstruct %v4float %70 %71 %72 %73 + %75 = OpCompositeConstruct %v4float %62 %62 %62 %62 + %63 = OpExtInst %v4float %64 FMix %69 %74 %75 + OpStore %undefined %63 + %76 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %77 = OpLoad %int %76 + %79 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_9 + %80 = OpLoad %int %79 + %81 = OpIEqual %bool %77 %80 + OpStore %x_84_phi %81 + %82 = OpLogicalNot %bool %81 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + %85 = OpAccessChain %_ptr_Function_float %undefined %uint_0 + %86 = OpLoad %float %85 + %88 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %89 = OpLoad %float %88 + %90 = OpFOrdGreaterThan %bool %86 %89 + OpStore %x_83 %90 + %91 = OpLoad %bool %x_83 + OpStore %x_84_phi %91 + OpBranch %83 + %83 = OpLabel + %92 = OpLoad %bool %x_84_phi + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + %96 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %97 = OpLoad %int %96 + %99 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_8 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_8 + %102 = OpLoad %int %101 + %103 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %104 = OpLoad %int %103 + %105 = OpConvertSToF %float %97 + %106 = OpConvertSToF %float %100 + %107 = OpConvertSToF %float %102 + %108 = OpConvertSToF %float %104 + %109 = OpCompositeConstruct %v4float %105 %106 %107 %108 + OpStore %x_GLF_color %109 + OpBranch %93 + %95 = OpLabel + %110 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_8 + %111 = OpLoad %int %110 + %112 = OpConvertSToF %float %111 + %113 = OpCompositeConstruct %v4float %112 %112 %112 %112 + OpStore %x_GLF_color %113 + OpBranch %93 + %93 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %114 +%tint_symbol = OpFunctionParameter %main_out + %118 = OpLabel + %119 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %119 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %121 = OpLabel + %122 = OpFunctionCall %void %main_1 + %124 = OpLoad %v4float %x_GLF_color + %125 = OpCompositeConstruct %main_out %124 + %123 = OpFunctionCall %void %tint_symbol_2 %125 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a59f8d8fca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.spvasm.expected.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var nan : f32; + var undefined : vec4; + var x_83 : bool; + var x_84_phi : bool; + nan = bitcast(-1); + let x_43 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_46 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_49 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_52 : i32 = x_7.x_GLF_uniform_int_values[3]; + let x_56 : i32 = x_7.x_GLF_uniform_int_values[4]; + let x_59 : i32 = x_7.x_GLF_uniform_int_values[5]; + let x_62 : i32 = x_7.x_GLF_uniform_int_values[6]; + let x_65 : i32 = x_7.x_GLF_uniform_int_values[7]; + let x_68 : f32 = nan; + undefined = mix(vec4(f32(x_43), f32(x_46), f32(x_49), f32(x_52)), vec4(f32(x_56), f32(x_59), f32(x_62), f32(x_65)), vec4(x_68, x_68, x_68, x_68)); + let x_72 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_74 : i32 = x_7.x_GLF_uniform_int_values[9]; + let x_75 : bool = (x_72 == x_74); + x_84_phi = x_75; + if (!(x_75)) { + let x_80 : f32 = undefined.x; + let x_82 : f32 = x_9.x_GLF_uniform_float_values[0]; + x_83 = (x_80 > x_82); + x_84_phi = x_83; + } + let x_84 : bool = x_84_phi; + if (x_84) { + let x_89 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_92 : i32 = x_7.x_GLF_uniform_int_values[8]; + let x_95 : i32 = x_7.x_GLF_uniform_int_values[8]; + let x_98 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_89), f32(x_92), f32(x_95), f32(x_98)); + } else { + let x_102 : i32 = x_7.x_GLF_uniform_int_values[8]; + let x_103 : f32 = f32(x_102); + x_GLF_color = vec4(x_103, x_103, x_103, x_103); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl new file mode 100644 index 0000000000..a59f8d8fca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var nan : f32; + var undefined : vec4; + var x_83 : bool; + var x_84_phi : bool; + nan = bitcast(-1); + let x_43 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_46 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_49 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_52 : i32 = x_7.x_GLF_uniform_int_values[3]; + let x_56 : i32 = x_7.x_GLF_uniform_int_values[4]; + let x_59 : i32 = x_7.x_GLF_uniform_int_values[5]; + let x_62 : i32 = x_7.x_GLF_uniform_int_values[6]; + let x_65 : i32 = x_7.x_GLF_uniform_int_values[7]; + let x_68 : f32 = nan; + undefined = mix(vec4(f32(x_43), f32(x_46), f32(x_49), f32(x_52)), vec4(f32(x_56), f32(x_59), f32(x_62), f32(x_65)), vec4(x_68, x_68, x_68, x_68)); + let x_72 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_74 : i32 = x_7.x_GLF_uniform_int_values[9]; + let x_75 : bool = (x_72 == x_74); + x_84_phi = x_75; + if (!(x_75)) { + let x_80 : f32 = undefined.x; + let x_82 : f32 = x_9.x_GLF_uniform_float_values[0]; + x_83 = (x_80 > x_82); + x_84_phi = x_83; + } + let x_84 : bool = x_84_phi; + if (x_84) { + let x_89 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_92 : i32 = x_7.x_GLF_uniform_int_values[8]; + let x_95 : i32 = x_7.x_GLF_uniform_int_values[8]; + let x_98 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_89), f32(x_92), f32(x_95), f32(x_98)); + } else { + let x_102 : i32 = x_7.x_GLF_uniform_int_values[8]; + let x_103 : f32 = f32(x_102); + x_GLF_color = vec4(x_103, x_103, x_103, x_103); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..b8826cff8b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.hlsl @@ -0,0 +1,66 @@ +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[10]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float nan = 0.0f; + float4 undefined = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_83 = false; + bool x_84_phi = false; + nan = asfloat(-1); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_43 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const int x_46 = asint(x_7[1].x); + const int x_49 = asint(x_7[2].x); + const int x_52 = asint(x_7[3].x); + const int x_56 = asint(x_7[4].x); + const int x_59 = asint(x_7[5].x); + const int x_62 = asint(x_7[6].x); + const int x_65 = asint(x_7[7].x); + const float x_68 = nan; + undefined = lerp(float4(float(x_43), float(x_46), float(x_49), float(x_52)), float4(float(x_56), float(x_59), float(x_62), float(x_65)), float4(x_68, x_68, x_68, x_68)); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_72 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_74 = asint(x_7[9].x); + const bool x_75 = (x_72 == x_74); + x_84_phi = x_75; + if (!(x_75)) { + const float x_80 = undefined.x; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_82 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_83 = (x_80 > x_82); + x_84_phi = x_83; + } + if (x_84_phi) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_89 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_92 = asint(x_7[8].x); + const int x_95 = asint(x_7[8].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_98 = asint(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_89), float(x_92), float(x_95), float(x_98)); + } else { + const int x_102 = asint(x_7[8].x); + const float x_103 = float(x_102); + x_GLF_color = float4(x_103, x_103, x_103, x_103); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..95cc7fb0e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[10]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_9, thread float4* const tint_symbol_4) { + float nan = 0.0f; + float4 undefined = 0.0f; + bool x_83 = false; + bool x_84_phi = false; + nan = as_type(-1); + int const x_43 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_46 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_49 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_52 = x_7.x_GLF_uniform_int_values.arr[3].el; + int const x_56 = x_7.x_GLF_uniform_int_values.arr[4].el; + int const x_59 = x_7.x_GLF_uniform_int_values.arr[5].el; + int const x_62 = x_7.x_GLF_uniform_int_values.arr[6].el; + int const x_65 = x_7.x_GLF_uniform_int_values.arr[7].el; + float const x_68 = nan; + undefined = mix(float4(float(x_43), float(x_46), float(x_49), float(x_52)), float4(float(x_56), float(x_59), float(x_62), float(x_65)), float4(x_68, x_68, x_68, x_68)); + int const x_72 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_74 = x_7.x_GLF_uniform_int_values.arr[9].el; + bool const x_75 = (x_72 == x_74); + x_84_phi = x_75; + if (!(x_75)) { + float const x_80 = undefined.x; + float const x_82 = x_9.x_GLF_uniform_float_values.arr[0].el; + x_83 = (x_80 > x_82); + x_84_phi = x_83; + } + bool const x_84 = x_84_phi; + if (x_84) { + int const x_89 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_92 = x_7.x_GLF_uniform_int_values.arr[8].el; + int const x_95 = x_7.x_GLF_uniform_int_values.arr[8].el; + int const x_98 = x_7.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_89), float(x_92), float(x_95), float(x_98)); + } else { + int const x_102 = x_7.x_GLF_uniform_int_values.arr[8].el; + float const x_103 = float(x_102); + *(tint_symbol_4) = float4(x_103, x_103, x_103, x_103); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..a076bbb521 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.spvasm @@ -0,0 +1,187 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 126 +; Schema: 0 + OpCapability Shader + %64 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %nan "nan" + OpName %undefined "undefined" + OpName %x_83 "x_83" + OpName %x_84_phi "x_84_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 + %buf1 = OpTypeStruct %_arr_int_uint_10 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %32 = OpConstantNull %bool + %int_n1 = OpConstant %int -1 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_9 = OpConstant %int 9 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float + %114 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %nan = OpVariable %_ptr_Function_float Function %26 + %undefined = OpVariable %_ptr_Function_v4float Function %17 + %x_83 = OpVariable %_ptr_Function_bool Function %32 + %x_84_phi = OpVariable %_ptr_Function_bool Function %32 + %34 = OpBitcast %float %int_n1 + OpStore %nan %34 + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %40 = OpLoad %int %39 + %42 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %43 = OpLoad %int %42 + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %46 = OpLoad %int %45 + %48 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_3 + %49 = OpLoad %int %48 + %51 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_4 + %52 = OpLoad %int %51 + %54 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_5 + %55 = OpLoad %int %54 + %57 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_6 + %58 = OpLoad %int %57 + %60 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_7 + %61 = OpLoad %int %60 + %62 = OpLoad %float %nan + %65 = OpConvertSToF %float %40 + %66 = OpConvertSToF %float %43 + %67 = OpConvertSToF %float %46 + %68 = OpConvertSToF %float %49 + %69 = OpCompositeConstruct %v4float %65 %66 %67 %68 + %70 = OpConvertSToF %float %52 + %71 = OpConvertSToF %float %55 + %72 = OpConvertSToF %float %58 + %73 = OpConvertSToF %float %61 + %74 = OpCompositeConstruct %v4float %70 %71 %72 %73 + %75 = OpCompositeConstruct %v4float %62 %62 %62 %62 + %63 = OpExtInst %v4float %64 FMix %69 %74 %75 + OpStore %undefined %63 + %76 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %77 = OpLoad %int %76 + %79 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_9 + %80 = OpLoad %int %79 + %81 = OpIEqual %bool %77 %80 + OpStore %x_84_phi %81 + %82 = OpLogicalNot %bool %81 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + %85 = OpAccessChain %_ptr_Function_float %undefined %uint_0 + %86 = OpLoad %float %85 + %88 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %89 = OpLoad %float %88 + %90 = OpFOrdGreaterThan %bool %86 %89 + OpStore %x_83 %90 + %91 = OpLoad %bool %x_83 + OpStore %x_84_phi %91 + OpBranch %83 + %83 = OpLabel + %92 = OpLoad %bool %x_84_phi + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + %96 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %97 = OpLoad %int %96 + %99 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_8 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_8 + %102 = OpLoad %int %101 + %103 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %104 = OpLoad %int %103 + %105 = OpConvertSToF %float %97 + %106 = OpConvertSToF %float %100 + %107 = OpConvertSToF %float %102 + %108 = OpConvertSToF %float %104 + %109 = OpCompositeConstruct %v4float %105 %106 %107 %108 + OpStore %x_GLF_color %109 + OpBranch %93 + %95 = OpLabel + %110 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_8 + %111 = OpLoad %int %110 + %112 = OpConvertSToF %float %111 + %113 = OpCompositeConstruct %v4float %112 %112 %112 %112 + OpStore %x_GLF_color %113 + OpBranch %93 + %93 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %114 +%tint_symbol = OpFunctionParameter %main_out + %118 = OpLabel + %119 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %119 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %121 = OpLabel + %122 = OpFunctionCall %void %main_1 + %124 = OpLoad %v4float %x_GLF_color + %125 = OpCompositeConstruct %main_out %124 + %123 = OpFunctionCall %void %tint_symbol_2 %125 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a59f8d8fca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mix-nan/0-opt.wgsl.expected.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var nan : f32; + var undefined : vec4; + var x_83 : bool; + var x_84_phi : bool; + nan = bitcast(-1); + let x_43 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_46 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_49 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_52 : i32 = x_7.x_GLF_uniform_int_values[3]; + let x_56 : i32 = x_7.x_GLF_uniform_int_values[4]; + let x_59 : i32 = x_7.x_GLF_uniform_int_values[5]; + let x_62 : i32 = x_7.x_GLF_uniform_int_values[6]; + let x_65 : i32 = x_7.x_GLF_uniform_int_values[7]; + let x_68 : f32 = nan; + undefined = mix(vec4(f32(x_43), f32(x_46), f32(x_49), f32(x_52)), vec4(f32(x_56), f32(x_59), f32(x_62), f32(x_65)), vec4(x_68, x_68, x_68, x_68)); + let x_72 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_74 : i32 = x_7.x_GLF_uniform_int_values[9]; + let x_75 : bool = (x_72 == x_74); + x_84_phi = x_75; + if (!(x_75)) { + let x_80 : f32 = undefined.x; + let x_82 : f32 = x_9.x_GLF_uniform_float_values[0]; + x_83 = (x_80 > x_82); + x_84_phi = x_83; + } + let x_84 : bool = x_84_phi; + if (x_84) { + let x_89 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_92 : i32 = x_7.x_GLF_uniform_int_values[8]; + let x_95 : i32 = x_7.x_GLF_uniform_int_values[8]; + let x_98 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_89), f32(x_92), f32(x_95), f32(x_98)); + } else { + let x_102 : i32 = x_7.x_GLF_uniform_int_values[8]; + let x_103 : f32 = f32(x_102); + x_GLF_color = vec4(x_103, x_103, x_103, x_103); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm new file mode 100644 index 0000000000..995d851ee7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm @@ -0,0 +1,114 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %undefined "undefined" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 RelaxedPrecision + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + %void = OpTypeVoid + %21 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_5 = OpConstant %float 5 + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %21 + %39 = OpLabel + %undefined = OpVariable %_ptr_Function_float Function + %40 = OpFMod %float %float_5 %float_0 + OpStore %undefined %40 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %10 = OpLoad %int %41 + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %11 = OpLoad %int %42 + %43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %12 = OpLoad %int %43 + %13 = OpIAdd %int %11 %12 + %44 = OpIEqual %bool %10 %13 + %45 = OpLogicalNot %bool %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + %48 = OpLoad %float %undefined + %49 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %50 = OpLoad %float %49 + %51 = OpFOrdGreaterThan %bool %48 %50 + OpBranch %46 + %46 = OpLabel + %52 = OpPhi %bool %44 %39 %51 %47 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %15 = OpLoad %int %56 + %57 = OpConvertSToF %float %15 + %58 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %16 = OpLoad %int %58 + %59 = OpConvertSToF %float %16 + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %17 = OpLoad %int %60 + %61 = OpConvertSToF %float %17 + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %18 = OpLoad %int %62 + %63 = OpConvertSToF %float %18 + %64 = OpCompositeConstruct %v4float %57 %59 %61 %63 + OpStore %_GLF_color %64 + OpBranch %53 + %55 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %19 = OpLoad %int %65 + %66 = OpConvertSToF %float %19 + %67 = OpCompositeConstruct %v4float %66 %66 %66 %66 + OpStore %_GLF_color %67 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..84838efda2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.hlsl @@ -0,0 +1,56 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float undefined = 0.0f; + bool x_51 = false; + bool x_52_phi = false; + undefined = (5.0f % 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_10 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_11 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_12 = asint(x_6[1].x); + const bool x_44 = (x_10 == (x_11 + x_12)); + x_52_phi = x_44; + if (!(x_44)) { + const float x_48 = undefined; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_50 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_51 = (x_48 > x_50); + x_52_phi = x_51; + } + if (x_52_phi) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_15 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_16 = asint(x_6[1].x); + const int x_17 = asint(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_18 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_15), float(x_16), float(x_17), float(x_18)); + } else { + const int x_19 = asint(x_6[1].x); + const float x_66 = float(x_19); + x_GLF_color = float4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.msl new file mode 100755 index 0000000000..ad2c3caf6a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.msl @@ -0,0 +1,76 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_4) { + float undefined = 0.0f; + bool x_51 = false; + bool x_52_phi = false; + undefined = (5.0f % 0.0f); + int const x_10 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_11 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_12 = x_6.x_GLF_uniform_int_values.arr[1].el; + bool const x_44 = (x_10 == (x_11 + x_12)); + x_52_phi = x_44; + if (!(x_44)) { + float const x_48 = undefined; + float const x_50 = x_8.x_GLF_uniform_float_values.arr[0].el; + x_51 = (x_48 > x_50); + x_52_phi = x_51; + } + bool const x_52 = x_52_phi; + if (x_52) { + int const x_15 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_16 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_17 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_18 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_15), float(x_16), float(x_17), float(x_18)); + } else { + int const x_19 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_66 = float(x_19); + *(tint_symbol_4) = float4(x_66, x_66, x_66, x_66); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +T:\tmp\u348.0.metal:35:21: error: invalid operands to binary expression ('float' and 'float') + undefined = (5.0f % 0.0f); + ~~~~ ^ ~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..042259ad36 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.spvasm @@ -0,0 +1,148 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %undefined "undefined" + OpName %x_51 "x_51" + OpName %x_52_phi "x_52_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %30 = OpConstantNull %bool + %float_5 = OpConstant %float 5 + %float_0 = OpConstant %float 0 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %undefined = OpVariable %_ptr_Function_float Function %26 + %x_51 = OpVariable %_ptr_Function_bool Function %30 + %x_52_phi = OpVariable %_ptr_Function_bool Function %30 + %34 = OpFMod %float %float_5 %float_0 + OpStore %undefined %34 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %41 = OpLoad %int %40 + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpIAdd %int %41 %44 + %46 = OpIEqual %bool %39 %45 + OpStore %x_52_phi %46 + %47 = OpLogicalNot %bool %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + %50 = OpLoad %float %undefined + %52 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %53 = OpLoad %float %52 + %54 = OpFOrdGreaterThan %bool %50 %53 + OpStore %x_51 %54 + %55 = OpLoad %bool %x_51 + OpStore %x_52_phi %55 + OpBranch %48 + %48 = OpLabel + %56 = OpLoad %bool %x_52_phi + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %61 + %69 = OpConvertSToF %float %63 + %70 = OpConvertSToF %float %65 + %71 = OpConvertSToF %float %67 + %72 = OpCompositeConstruct %v4float %68 %69 %70 %71 + OpStore %x_GLF_color %72 + OpBranch %57 + %59 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %x_GLF_color %76 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %77 +%tint_symbol = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %84 = OpLabel + %85 = OpFunctionCall %void %main_1 + %87 = OpLoad %v4float %x_GLF_color + %88 = OpCompositeConstruct %main_out %87 + %86 = OpFunctionCall %void %tint_symbol_2 %88 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ee6f6f7f51 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.spvasm.expected.wgsl @@ -0,0 +1,61 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var undefined : f32; + var x_51 : bool; + var x_52_phi : bool; + undefined = (5.0 % 0.0); + let x_10 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_11 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_12 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_44 : bool = (x_10 == (x_11 + x_12)); + x_52_phi = x_44; + if (!(x_44)) { + let x_48 : f32 = undefined; + let x_50 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_51 = (x_48 > x_50); + x_52_phi = x_51; + } + let x_52 : bool = x_52_phi; + if (x_52) { + let x_15 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_16 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_17 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_18 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_15), f32(x_16), f32(x_17), f32(x_18)); + } else { + let x_19 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : f32 = f32(x_19); + x_GLF_color = vec4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl new file mode 100644 index 0000000000..ee6f6f7f51 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl @@ -0,0 +1,61 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var undefined : f32; + var x_51 : bool; + var x_52_phi : bool; + undefined = (5.0 % 0.0); + let x_10 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_11 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_12 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_44 : bool = (x_10 == (x_11 + x_12)); + x_52_phi = x_44; + if (!(x_44)) { + let x_48 : f32 = undefined; + let x_50 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_51 = (x_48 > x_50); + x_52_phi = x_51; + } + let x_52 : bool = x_52_phi; + if (x_52) { + let x_15 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_16 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_17 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_18 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_15), f32(x_16), f32(x_17), f32(x_18)); + } else { + let x_19 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : f32 = f32(x_19); + x_GLF_color = vec4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..84838efda2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.hlsl @@ -0,0 +1,56 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float undefined = 0.0f; + bool x_51 = false; + bool x_52_phi = false; + undefined = (5.0f % 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_10 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_11 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_12 = asint(x_6[1].x); + const bool x_44 = (x_10 == (x_11 + x_12)); + x_52_phi = x_44; + if (!(x_44)) { + const float x_48 = undefined; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_50 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_51 = (x_48 > x_50); + x_52_phi = x_51; + } + if (x_52_phi) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_15 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_16 = asint(x_6[1].x); + const int x_17 = asint(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_18 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_15), float(x_16), float(x_17), float(x_18)); + } else { + const int x_19 = asint(x_6[1].x); + const float x_66 = float(x_19); + x_GLF_color = float4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.msl new file mode 100755 index 0000000000..201dc73315 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.msl @@ -0,0 +1,76 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_4) { + float undefined = 0.0f; + bool x_51 = false; + bool x_52_phi = false; + undefined = (5.0f % 0.0f); + int const x_10 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_11 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_12 = x_6.x_GLF_uniform_int_values.arr[1].el; + bool const x_44 = (x_10 == (x_11 + x_12)); + x_52_phi = x_44; + if (!(x_44)) { + float const x_48 = undefined; + float const x_50 = x_8.x_GLF_uniform_float_values.arr[0].el; + x_51 = (x_48 > x_50); + x_52_phi = x_51; + } + bool const x_52 = x_52_phi; + if (x_52) { + int const x_15 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_16 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_17 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_18 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_15), float(x_16), float(x_17), float(x_18)); + } else { + int const x_19 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_66 = float(x_19); + *(tint_symbol_4) = float4(x_66, x_66, x_66, x_66); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +T:\tmp\u5b0.0.metal:35:21: error: invalid operands to binary expression ('float' and 'float') + undefined = (5.0f % 0.0f); + ~~~~ ^ ~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..042259ad36 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.spvasm @@ -0,0 +1,148 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %undefined "undefined" + OpName %x_51 "x_51" + OpName %x_52_phi "x_52_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %30 = OpConstantNull %bool + %float_5 = OpConstant %float 5 + %float_0 = OpConstant %float 0 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %undefined = OpVariable %_ptr_Function_float Function %26 + %x_51 = OpVariable %_ptr_Function_bool Function %30 + %x_52_phi = OpVariable %_ptr_Function_bool Function %30 + %34 = OpFMod %float %float_5 %float_0 + OpStore %undefined %34 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %41 = OpLoad %int %40 + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpIAdd %int %41 %44 + %46 = OpIEqual %bool %39 %45 + OpStore %x_52_phi %46 + %47 = OpLogicalNot %bool %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + %50 = OpLoad %float %undefined + %52 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %53 = OpLoad %float %52 + %54 = OpFOrdGreaterThan %bool %50 %53 + OpStore %x_51 %54 + %55 = OpLoad %bool %x_51 + OpStore %x_52_phi %55 + OpBranch %48 + %48 = OpLabel + %56 = OpLoad %bool %x_52_phi + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %61 + %69 = OpConvertSToF %float %63 + %70 = OpConvertSToF %float %65 + %71 = OpConvertSToF %float %67 + %72 = OpCompositeConstruct %v4float %68 %69 %70 %71 + OpStore %x_GLF_color %72 + OpBranch %57 + %59 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %x_GLF_color %76 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %77 +%tint_symbol = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %84 = OpLabel + %85 = OpFunctionCall %void %main_1 + %87 = OpLoad %v4float %x_GLF_color + %88 = OpCompositeConstruct %main_out %87 + %86 = OpFunctionCall %void %tint_symbol_2 %88 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee6f6f7f51 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-mod-zero/0-opt.wgsl.expected.wgsl @@ -0,0 +1,61 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var undefined : f32; + var x_51 : bool; + var x_52_phi : bool; + undefined = (5.0 % 0.0); + let x_10 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_11 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_12 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_44 : bool = (x_10 == (x_11 + x_12)); + x_52_phi = x_44; + if (!(x_44)) { + let x_48 : f32 = undefined; + let x_50 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_51 = (x_48 > x_50); + x_52_phi = x_51; + } + let x_52 : bool = x_52_phi; + if (x_52) { + let x_15 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_16 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_17 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_18 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_15), f32(x_16), f32(x_17), f32(x_18)); + } else { + let x_19 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : f32 = f32(x_19); + x_GLF_color = vec4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm new file mode 100644 index 0000000000..00788a0cc2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm @@ -0,0 +1,147 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f0 "f0" + OpName %s1 "s1" + OpName %f1 "f1" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_10 = OpConstant %float 10 +%float_9_99999997en07 = OpConstant %float 9.99999997e-07 +%float_0x1_b38fb8pn127 = OpConstant %float 0x1.b38fb8p-127 + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 +%float_0_99000001 = OpConstant %float 0.99000001 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %main = OpFunction %void None %14 + %36 = OpLabel + %f0 = OpVariable %_ptr_Function_float Function + %s1 = OpVariable %_ptr_Function_float Function + %f1 = OpVariable %_ptr_Function_float Function + %37 = OpFMod %float %float_10 %float_9_99999997en07 + OpStore %f0 %37 + OpStore %s1 %float_0x1_b38fb8pn127 + %38 = OpLoad %float %s1 + %39 = OpFOrdEqual %bool %38 %float_0 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + OpStore %s1 %float_1 + OpBranch %40 + %40 = OpLabel + %42 = OpLoad %float %s1 + %43 = OpFMod %float %float_10 %42 + OpStore %f1 %43 + %44 = OpLoad %float %f1 + %45 = OpIsInf %bool %44 + %46 = OpLoad %float %s1 + %47 = OpFOrdEqual %bool %46 %float_1 + %48 = OpLogicalOr %bool %45 %47 + %49 = OpLogicalNot %bool %48 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + %52 = OpLoad %float %f0 + %53 = OpLoad %float %f1 + %54 = OpFOrdEqual %bool %52 %53 + %55 = OpLogicalNot %bool %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + %58 = OpLoad %float %f0 + %59 = OpFOrdGreaterThan %bool %58 %float_0_99000001 + %60 = OpLoad %float %f0 + %61 = OpFOrdLessThan %bool %60 %float_0_00999999978 + %62 = OpLogicalAnd %bool %59 %61 + OpBranch %56 + %56 = OpLabel + %63 = OpPhi %bool %54 %51 %62 %57 + %64 = OpLogicalNot %bool %63 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + %67 = OpLoad %float %f1 + %68 = OpFOrdGreaterThan %bool %67 %float_0_99000001 + %69 = OpLoad %float %f1 + %70 = OpFOrdLessThan %bool %69 %float_0_00999999978 + %71 = OpLogicalAnd %bool %68 %70 + OpBranch %65 + %65 = OpLabel + %72 = OpPhi %bool %63 %56 %71 %66 + OpBranch %50 + %50 = OpLabel + %73 = OpPhi %bool %48 %40 %72 %65 + %74 = OpLoad %float %f1 + %75 = OpFOrdEqual %bool %74 %float_10 + %76 = OpLogicalOr %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %81 + %83 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %84 = OpLoad %int %83 + %85 = OpConvertSToF %float %84 + %86 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %87 = OpLoad %int %86 + %88 = OpConvertSToF %float %87 + %89 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpConvertSToF %float %90 + %92 = OpCompositeConstruct %v4float %82 %85 %88 %91 + OpStore %_GLF_color %92 + OpBranch %77 + %79 = OpLabel + %93 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %94 = OpLoad %int %93 + %95 = OpConvertSToF %float %94 + %96 = OpCompositeConstruct %v4float %95 %95 %95 %95 + OpStore %_GLF_color %96 + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..134d1e5bbb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.hlsl @@ -0,0 +1,88 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; + +void main_1() { + float f0 = 0.0f; + float s1 = 0.0f; + float f1 = 0.0f; + bool x_72 = false; + bool x_73_phi = false; + f0 = (10.0f % 0.000001f); + s1 = 9.99999935e-39f; + if ((s1 == 0.0f)) { + s1 = 1.0f; + } + bool x_62 = false; + bool x_71 = false; + bool x_63_phi = false; + bool x_72_phi = false; + f1 = (10.0f % s1); + bool tint_tmp = isinf(f1); + if (!tint_tmp) { + tint_tmp = (s1 == 1.0f); + } + const bool x_48 = (tint_tmp); + x_73_phi = x_48; + if (!(x_48)) { + const bool x_54 = (f0 == f1); + x_63_phi = x_54; + if (!(x_54)) { + bool tint_tmp_1 = (f0 > 0.99000001f); + if (tint_tmp_1) { + tint_tmp_1 = (f0 < 0.01f); + } + x_62 = (tint_tmp_1); + x_63_phi = x_62; + } + const bool x_63 = x_63_phi; + x_72_phi = x_63; + if (!(x_63)) { + bool tint_tmp_2 = (f1 > 0.99000001f); + if (tint_tmp_2) { + tint_tmp_2 = (f1 < 0.01f); + } + x_71 = (tint_tmp_2); + x_72_phi = x_71; + } + x_72 = x_72_phi; + x_73_phi = x_72; + } + bool tint_tmp_3 = x_73_phi; + if (!tint_tmp_3) { + tint_tmp_3 = (f1 == 10.0f); + } + if ((tint_tmp_3)) { + const int x_81 = asint(x_8[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_84 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_87 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_90 = asint(x_8[1].x); + x_GLF_color = float4(float(x_81), float(x_84), float(x_87), float(x_90)); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_94 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_95 = float(x_94); + x_GLF_color = float4(x_95, x_95, x_95, x_95); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.msl new file mode 100755 index 0000000000..b44e5d5d7f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.msl @@ -0,0 +1,108 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_8, thread float4* const tint_symbol_4) { + float f0 = 0.0f; + float s1 = 0.0f; + float f1 = 0.0f; + bool x_72 = false; + bool x_73_phi = false; + f0 = (10.0f % 0.000001f); + s1 = 9.99999935e-39f; + float const x_38 = s1; + if ((x_38 == 0.0f)) { + s1 = 1.0f; + } + bool x_62 = false; + bool x_71 = false; + bool x_63_phi = false; + bool x_72_phi = false; + float const x_42 = s1; + f1 = (10.0f % x_42); + float const x_44 = f1; + float const x_46 = s1; + bool const x_48 = (isinf(x_44) || (x_46 == 1.0f)); + x_73_phi = x_48; + if (!(x_48)) { + float const x_52 = f0; + float const x_53 = f1; + bool const x_54 = (x_52 == x_53); + x_63_phi = x_54; + if (!(x_54)) { + float const x_58 = f0; + float const x_60 = f0; + x_62 = ((x_58 > 0.99000001f) && (x_60 < 0.01f)); + x_63_phi = x_62; + } + bool const x_63 = x_63_phi; + x_72_phi = x_63; + if (!(x_63)) { + float const x_67 = f1; + float const x_69 = f1; + x_71 = ((x_67 > 0.99000001f) && (x_69 < 0.01f)); + x_72_phi = x_71; + } + x_72 = x_72_phi; + x_73_phi = x_72; + } + bool const x_73 = x_73_phi; + float const x_74 = f1; + if ((x_73 || (x_74 == 10.0f))) { + int const x_81 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_84 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_87 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_90 = x_8.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_81), float(x_84), float(x_87), float(x_90)); + } else { + int const x_94 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_95 = float(x_94); + *(tint_symbol_4) = float4(x_95, x_95, x_95, x_95); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +T:\tmp\u3v4.0.metal:37:15: error: invalid operands to binary expression ('float' and 'float') + f0 = (10.0f % 0.000001f); + ~~~~~ ^ ~~~~~~~~~ +T:\tmp\u3v4.0.metal:48:15: error: invalid operands to binary expression ('float' and 'const float') + f1 = (10.0f % x_42); + ~~~~~ ^ ~~~~ +2 errors generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f597477c80 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.spvasm @@ -0,0 +1,227 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 132 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f0 "f0" + OpName %s1 "s1" + OpName %f1 "f1" + OpName %x_72 "x_72" + OpName %x_73_phi "x_73_phi" + OpName %x_62 "x_62" + OpName %x_71 "x_71" + OpName %x_63_phi "x_63_phi" + OpName %x_72_phi "x_72_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %32 = OpConstantNull %bool + %float_10 = OpConstant %float 10 +%float_9_99999997en07 = OpConstant %float 9.99999997e-07 +%float_0x1_b38fb8pn127 = OpConstant %float 0x1.b38fb8p-127 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 +%float_0_99000001 = OpConstant %float 0.99000001 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %120 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %f0 = OpVariable %_ptr_Function_float Function %26 + %s1 = OpVariable %_ptr_Function_float Function %26 + %f1 = OpVariable %_ptr_Function_float Function %26 + %x_72 = OpVariable %_ptr_Function_bool Function %32 + %x_73_phi = OpVariable %_ptr_Function_bool Function %32 + %x_62 = OpVariable %_ptr_Function_bool Function %32 + %x_71 = OpVariable %_ptr_Function_bool Function %32 + %x_63_phi = OpVariable %_ptr_Function_bool Function %32 + %x_72_phi = OpVariable %_ptr_Function_bool Function %32 + %36 = OpFMod %float %float_10 %float_9_99999997en07 + OpStore %f0 %36 + OpStore %s1 %float_0x1_b38fb8pn127 + %38 = OpLoad %float %s1 + %40 = OpFOrdEqual %bool %38 %float_0 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + OpStore %s1 %float_1 + OpBranch %41 + %41 = OpLabel + %48 = OpLoad %float %s1 + %49 = OpFMod %float %float_10 %48 + OpStore %f1 %49 + %50 = OpLoad %float %f1 + %51 = OpLoad %float %s1 + %52 = OpIsInf %bool %50 + OpSelectionMerge %53 None + OpBranchConditional %52 %53 %54 + %54 = OpLabel + %55 = OpFOrdEqual %bool %51 %float_1 + OpBranch %53 + %53 = OpLabel + %56 = OpPhi %bool %52 %41 %55 %54 + OpStore %x_73_phi %56 + %57 = OpLogicalNot %bool %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + %60 = OpLoad %float %f0 + %61 = OpLoad %float %f1 + %62 = OpFOrdEqual %bool %60 %61 + OpStore %x_63_phi %62 + %63 = OpLogicalNot %bool %62 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + %66 = OpLoad %float %f0 + %67 = OpLoad %float %f0 + %69 = OpFOrdGreaterThan %bool %66 %float_0_99000001 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %73 = OpFOrdLessThan %bool %67 %float_0_00999999978 + OpBranch %70 + %70 = OpLabel + %74 = OpPhi %bool %69 %65 %73 %71 + OpStore %x_62 %74 + %75 = OpLoad %bool %x_62 + OpStore %x_63_phi %75 + OpBranch %64 + %64 = OpLabel + %76 = OpLoad %bool %x_63_phi + OpStore %x_72_phi %76 + %77 = OpLogicalNot %bool %76 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %78 + %79 = OpLabel + %80 = OpLoad %float %f1 + %81 = OpLoad %float %f1 + %82 = OpFOrdGreaterThan %bool %80 %float_0_99000001 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + %85 = OpFOrdLessThan %bool %81 %float_0_00999999978 + OpBranch %83 + %83 = OpLabel + %86 = OpPhi %bool %82 %79 %85 %84 + OpStore %x_71 %86 + %87 = OpLoad %bool %x_71 + OpStore %x_72_phi %87 + OpBranch %78 + %78 = OpLabel + %88 = OpLoad %bool %x_72_phi + OpStore %x_72 %88 + %89 = OpLoad %bool %x_72 + OpStore %x_73_phi %89 + OpBranch %58 + %58 = OpLabel + %90 = OpLoad %bool %x_73_phi + %91 = OpLoad %float %f1 + OpSelectionMerge %92 None + OpBranchConditional %90 %92 %93 + %93 = OpLabel + %94 = OpFOrdEqual %bool %91 %float_10 + OpBranch %92 + %92 = OpLabel + %95 = OpPhi %bool %90 %58 %94 %93 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %98 + %97 = OpLabel + %102 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %103 = OpLoad %int %102 + %105 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %106 = OpLoad %int %105 + %107 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %108 = OpLoad %int %107 + %109 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %110 = OpLoad %int %109 + %111 = OpConvertSToF %float %103 + %112 = OpConvertSToF %float %106 + %113 = OpConvertSToF %float %108 + %114 = OpConvertSToF %float %110 + %115 = OpCompositeConstruct %v4float %111 %112 %113 %114 + OpStore %x_GLF_color %115 + OpBranch %96 + %98 = OpLabel + %116 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %117 = OpLoad %int %116 + %118 = OpConvertSToF %float %117 + %119 = OpCompositeConstruct %v4float %118 %118 %118 %118 + OpStore %x_GLF_color %119 + OpBranch %96 + %96 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %120 +%tint_symbol = OpFunctionParameter %main_out + %124 = OpLabel + %125 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %125 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %127 = OpLabel + %128 = OpFunctionCall %void %main_1 + %130 = OpLoad %v4float %x_GLF_color + %131 = OpCompositeConstruct %main_out %130 + %129 = OpFunctionCall %void %tint_symbol_2 %131 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..8b2ad190d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.spvasm.expected.wgsl @@ -0,0 +1,90 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn main_1() { + var f0 : f32; + var s1 : f32; + var f1 : f32; + var x_72 : bool; + var x_73_phi : bool; + f0 = (10.0 % 0.000001); + s1 = 0x1.b38fb8p-127; + let x_38 : f32 = s1; + if ((x_38 == 0.0)) { + s1 = 1.0; + } + var x_62 : bool; + var x_71 : bool; + var x_63_phi : bool; + var x_72_phi : bool; + let x_42 : f32 = s1; + f1 = (10.0 % x_42); + let x_44 : f32 = f1; + let x_46 : f32 = s1; + let x_48 : bool = (isInf(x_44) || (x_46 == 1.0)); + x_73_phi = x_48; + if (!(x_48)) { + let x_52 : f32 = f0; + let x_53 : f32 = f1; + let x_54 : bool = (x_52 == x_53); + x_63_phi = x_54; + if (!(x_54)) { + let x_58 : f32 = f0; + let x_60 : f32 = f0; + x_62 = ((x_58 > 0.99000001) && (x_60 < 0.01)); + x_63_phi = x_62; + } + let x_63 : bool = x_63_phi; + x_72_phi = x_63; + if (!(x_63)) { + let x_67 : f32 = f1; + let x_69 : f32 = f1; + x_71 = ((x_67 > 0.99000001) && (x_69 < 0.01)); + x_72_phi = x_71; + } + x_72 = x_72_phi; + x_73_phi = x_72; + } + let x_73 : bool = x_73_phi; + let x_74 : f32 = f1; + if ((x_73 || (x_74 == 10.0))) { + let x_81 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_84 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_87 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_90 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_81), f32(x_84), f32(x_87), f32(x_90)); + } else { + let x_94 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_95 : f32 = f32(x_94); + x_GLF_color = vec4(x_95, x_95, x_95, x_95); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl new file mode 100644 index 0000000000..8b2ad190d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl @@ -0,0 +1,90 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn main_1() { + var f0 : f32; + var s1 : f32; + var f1 : f32; + var x_72 : bool; + var x_73_phi : bool; + f0 = (10.0 % 0.000001); + s1 = 0x1.b38fb8p-127; + let x_38 : f32 = s1; + if ((x_38 == 0.0)) { + s1 = 1.0; + } + var x_62 : bool; + var x_71 : bool; + var x_63_phi : bool; + var x_72_phi : bool; + let x_42 : f32 = s1; + f1 = (10.0 % x_42); + let x_44 : f32 = f1; + let x_46 : f32 = s1; + let x_48 : bool = (isInf(x_44) || (x_46 == 1.0)); + x_73_phi = x_48; + if (!(x_48)) { + let x_52 : f32 = f0; + let x_53 : f32 = f1; + let x_54 : bool = (x_52 == x_53); + x_63_phi = x_54; + if (!(x_54)) { + let x_58 : f32 = f0; + let x_60 : f32 = f0; + x_62 = ((x_58 > 0.99000001) && (x_60 < 0.01)); + x_63_phi = x_62; + } + let x_63 : bool = x_63_phi; + x_72_phi = x_63; + if (!(x_63)) { + let x_67 : f32 = f1; + let x_69 : f32 = f1; + x_71 = ((x_67 > 0.99000001) && (x_69 < 0.01)); + x_72_phi = x_71; + } + x_72 = x_72_phi; + x_73_phi = x_72; + } + let x_73 : bool = x_73_phi; + let x_74 : f32 = f1; + if ((x_73 || (x_74 == 10.0))) { + let x_81 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_84 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_87 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_90 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_81), f32(x_84), f32(x_87), f32(x_90)); + } else { + let x_94 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_95 : f32 = f32(x_94); + x_GLF_color = vec4(x_95, x_95, x_95, x_95); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..0fdd32b525 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.hlsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl:28:19 error: expected ';' for assignment statement + s1 = 0x1.b38fb8p-127; + ^^^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..0fdd32b525 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.msl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl:28:19 error: expected ';' for assignment statement + s1 = 0x1.b38fb8p-127; + ^^^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..0fdd32b525 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.spvasm @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl:28:19 error: expected ';' for assignment statement + s1 = 0x1.b38fb8p-127; + ^^^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..0fdd32b525 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-apfloat-module-small-number/0-opt.wgsl:28:19 error: expected ';' for assignment statement + s1 = 0x1.b38fb8p-127; + ^^^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm new file mode 100644 index 0000000000..4a6ac9d269 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm @@ -0,0 +1,130 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %I "I" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %N "N" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %R "R" + OpName %ref "ref" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %uint_92985 = OpConstant %uint 92985 + %v4uint = OpTypeVector %uint 4 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0_5 = OpConstant %float 0.5 + %35 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %15 + %38 = OpLabel + %I = OpVariable %_ptr_Function_v4float Function + %N = OpVariable %_ptr_Function_v4float Function + %R = OpVariable %_ptr_Function_v4float Function + %ref = OpVariable %_ptr_Function_v4float Function + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %40 = OpLoad %int %39 + %41 = OpBitcast %uint %40 + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %43 = OpLoad %int %42 + %44 = OpBitcast %uint %43 + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %46 = OpLoad %int %45 + %47 = OpBitcast %uint %46 + %48 = OpCompositeConstruct %v4uint %41 %44 %47 %uint_92985 + %49 = OpBitcast %v4float %48 + OpStore %I %49 + %50 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %51 = OpLoad %float %50 + %52 = OpCompositeConstruct %v4float %51 %51 %51 %51 + OpStore %N %52 + %53 = OpLoad %v4float %I + %54 = OpExtInst %v4float %1 Reflect %53 %35 + OpStore %R %54 + %55 = OpLoad %v4float %I + %56 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_2 + %57 = OpLoad %float %56 + %58 = OpLoad %v4float %N + %59 = OpLoad %v4float %I + %60 = OpDot %float %58 %59 + %61 = OpFMul %float %57 %60 + %62 = OpLoad %v4float %N + %63 = OpVectorTimesScalar %v4float %62 %61 + %64 = OpFSub %v4float %55 %63 + OpStore %ref %64 + %65 = OpLoad %v4float %R + %66 = OpLoad %v4float %ref + %67 = OpExtInst %float %1 Distance %65 %66 + %68 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %69 = OpLoad %float %68 + %70 = OpFOrdLessThan %bool %67 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpConvertSToF %float %78 + %80 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %81 + %83 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %84 = OpLoad %int %83 + %85 = OpConvertSToF %float %84 + %86 = OpCompositeConstruct %v4float %76 %79 %82 %85 + OpStore %_GLF_color %86 + OpBranch %71 + %73 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %88 + %90 = OpCompositeConstruct %v4float %89 %89 %89 %89 + OpStore %_GLF_color %90 + OpBranch %71 + %71 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9136c66b85 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.hlsl @@ -0,0 +1,71 @@ +SKIP: FAILED + + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var I : vec4; + var N : vec4; + var R : vec4; + var ref : vec4; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[4]; + I = bitcast>(vec4(bitcast(x_40), bitcast(x_43), bitcast(x_46), 92985u)); + let x_51 : f32 = x_9.x_GLF_uniform_float_values[1]; + N = vec4(x_51, x_51, x_51, x_51); + let x_53 : vec4 = I; + R = reflect(x_53, vec4(0.5, 0.5, 0.5, 0.5)); + let x_55 : vec4 = I; + let x_57 : f32 = x_9.x_GLF_uniform_float_values[2]; + let x_58 : vec4 = N; + let x_59 : vec4 = I; + let x_62 : vec4 = N; + ref = (x_55 - (x_62 * (x_57 * dot(x_58, x_59)))); + let x_65 : vec4 = R; + let x_66 : vec4 = ref; + let x_69 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((distance(x_65, x_66) < x_69)) { + let x_75 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_75), f32(x_78), f32(x_81), f32(x_84)); + } else { + let x_88 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_89 : f32 = f32(x_88); + x_GLF_color = vec4(x_89, x_89, x_89, x_89); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +Failed to generate: error: Unable to do bitcast to type __vec_4__f32 diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..9237c80b01 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + float4 I = 0.0f; + float4 N = 0.0f; + float4 R = 0.0f; + float4 ref = 0.0f; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[4].el; + I = as_type(uint4(as_type(x_40), as_type(x_43), as_type(x_46), 92985u)); + float const x_51 = x_9.x_GLF_uniform_float_values.arr[1].el; + N = float4(x_51, x_51, x_51, x_51); + float4 const x_53 = I; + R = reflect(x_53, float4(0.5f, 0.5f, 0.5f, 0.5f)); + float4 const x_55 = I; + float const x_57 = x_9.x_GLF_uniform_float_values.arr[2].el; + float4 const x_58 = N; + float4 const x_59 = I; + float4 const x_62 = N; + ref = (x_55 - (x_62 * (x_57 * dot(x_58, x_59)))); + float4 const x_65 = R; + float4 const x_66 = ref; + float const x_69 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((distance(x_65, x_66) < x_69)) { + int const x_75 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_78 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_81 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_84 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_75), float(x_78), float(x_81), float(x_84)); + } else { + int const x_88 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_89 = float(x_88); + *(tint_symbol_4) = float4(x_89, x_89, x_89, x_89); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..dcddef3ef4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.spvasm @@ -0,0 +1,164 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 107 +; Schema: 0 + OpCapability Shader + %54 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %I "I" + OpName %N "N" + OpName %R "R" + OpName %ref "ref" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %v4uint = OpTypeVector %uint 4 + %uint_92985 = OpConstant %uint 92985 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0_5 = OpConstant %float 0.5 + %56 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %95 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %I = OpVariable %_ptr_Function_v4float Function %17 + %N = OpVariable %_ptr_Function_v4float Function %17 + %R = OpVariable %_ptr_Function_v4float Function %17 + %ref = OpVariable %_ptr_Function_v4float Function %17 + %32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %33 = OpLoad %int %32 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %36 = OpLoad %int %35 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %39 = OpLoad %int %38 + %42 = OpBitcast %uint %33 + %43 = OpBitcast %uint %36 + %44 = OpBitcast %uint %39 + %46 = OpCompositeConstruct %v4uint %42 %43 %44 %uint_92985 + %40 = OpBitcast %v4float %46 + OpStore %I %40 + %49 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %50 = OpLoad %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %N %51 + %52 = OpLoad %v4float %I + %53 = OpExtInst %v4float %54 Reflect %52 %56 + OpStore %R %53 + %57 = OpLoad %v4float %I + %58 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_2 + %59 = OpLoad %float %58 + %60 = OpLoad %v4float %N + %61 = OpLoad %v4float %I + %62 = OpLoad %v4float %N + %63 = OpDot %float %60 %61 + %64 = OpFMul %float %59 %63 + %65 = OpVectorTimesScalar %v4float %62 %64 + %66 = OpFSub %v4float %57 %65 + OpStore %ref %66 + %67 = OpLoad %v4float %R + %68 = OpLoad %v4float %ref + %70 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %71 = OpLoad %float %70 + %72 = OpExtInst %float %54 Distance %67 %68 + %73 = OpFOrdLessThan %bool %72 %71 + OpSelectionMerge %75 None + OpBranchConditional %73 %76 %77 + %76 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %79 + %87 = OpConvertSToF %float %81 + %88 = OpConvertSToF %float %83 + %89 = OpConvertSToF %float %85 + %90 = OpCompositeConstruct %v4float %86 %87 %88 %89 + OpStore %x_GLF_color %90 + OpBranch %75 + %77 = OpLabel + %91 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %92 + %94 = OpCompositeConstruct %v4float %93 %93 %93 %93 + OpStore %x_GLF_color %94 + OpBranch %75 + %75 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %95 +%tint_symbol = OpFunctionParameter %main_out + %99 = OpLabel + %100 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %100 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %102 = OpLabel + %103 = OpFunctionCall %void %main_1 + %105 = OpLoad %v4float %x_GLF_color + %106 = OpCompositeConstruct %main_out %105 + %104 = OpFunctionCall %void %tint_symbol_2 %106 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c992ddc998 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.spvasm.expected.wgsl @@ -0,0 +1,66 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var I : vec4; + var N : vec4; + var R : vec4; + var ref : vec4; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[4]; + I = bitcast>(vec4(bitcast(x_40), bitcast(x_43), bitcast(x_46), 92985u)); + let x_51 : f32 = x_9.x_GLF_uniform_float_values[1]; + N = vec4(x_51, x_51, x_51, x_51); + let x_53 : vec4 = I; + R = reflect(x_53, vec4(0.5, 0.5, 0.5, 0.5)); + let x_55 : vec4 = I; + let x_57 : f32 = x_9.x_GLF_uniform_float_values[2]; + let x_58 : vec4 = N; + let x_59 : vec4 = I; + let x_62 : vec4 = N; + ref = (x_55 - (x_62 * (x_57 * dot(x_58, x_59)))); + let x_65 : vec4 = R; + let x_66 : vec4 = ref; + let x_69 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((distance(x_65, x_66) < x_69)) { + let x_75 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_75), f32(x_78), f32(x_81), f32(x_84)); + } else { + let x_88 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_89 : f32 = f32(x_88); + x_GLF_color = vec4(x_89, x_89, x_89, x_89); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl new file mode 100644 index 0000000000..c992ddc998 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl @@ -0,0 +1,66 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var I : vec4; + var N : vec4; + var R : vec4; + var ref : vec4; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[4]; + I = bitcast>(vec4(bitcast(x_40), bitcast(x_43), bitcast(x_46), 92985u)); + let x_51 : f32 = x_9.x_GLF_uniform_float_values[1]; + N = vec4(x_51, x_51, x_51, x_51); + let x_53 : vec4 = I; + R = reflect(x_53, vec4(0.5, 0.5, 0.5, 0.5)); + let x_55 : vec4 = I; + let x_57 : f32 = x_9.x_GLF_uniform_float_values[2]; + let x_58 : vec4 = N; + let x_59 : vec4 = I; + let x_62 : vec4 = N; + ref = (x_55 - (x_62 * (x_57 * dot(x_58, x_59)))); + let x_65 : vec4 = R; + let x_66 : vec4 = ref; + let x_69 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((distance(x_65, x_66) < x_69)) { + let x_75 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_75), f32(x_78), f32(x_81), f32(x_84)); + } else { + let x_88 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_89 : f32 = f32(x_88); + x_GLF_color = vec4(x_89, x_89, x_89, x_89); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9136c66b85 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.hlsl @@ -0,0 +1,71 @@ +SKIP: FAILED + + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var I : vec4; + var N : vec4; + var R : vec4; + var ref : vec4; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[4]; + I = bitcast>(vec4(bitcast(x_40), bitcast(x_43), bitcast(x_46), 92985u)); + let x_51 : f32 = x_9.x_GLF_uniform_float_values[1]; + N = vec4(x_51, x_51, x_51, x_51); + let x_53 : vec4 = I; + R = reflect(x_53, vec4(0.5, 0.5, 0.5, 0.5)); + let x_55 : vec4 = I; + let x_57 : f32 = x_9.x_GLF_uniform_float_values[2]; + let x_58 : vec4 = N; + let x_59 : vec4 = I; + let x_62 : vec4 = N; + ref = (x_55 - (x_62 * (x_57 * dot(x_58, x_59)))); + let x_65 : vec4 = R; + let x_66 : vec4 = ref; + let x_69 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((distance(x_65, x_66) < x_69)) { + let x_75 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_75), f32(x_78), f32(x_81), f32(x_84)); + } else { + let x_88 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_89 : f32 = f32(x_88); + x_GLF_color = vec4(x_89, x_89, x_89, x_89); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +Failed to generate: error: Unable to do bitcast to type __vec_4__f32 diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..9237c80b01 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + float4 I = 0.0f; + float4 N = 0.0f; + float4 R = 0.0f; + float4 ref = 0.0f; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[4].el; + I = as_type(uint4(as_type(x_40), as_type(x_43), as_type(x_46), 92985u)); + float const x_51 = x_9.x_GLF_uniform_float_values.arr[1].el; + N = float4(x_51, x_51, x_51, x_51); + float4 const x_53 = I; + R = reflect(x_53, float4(0.5f, 0.5f, 0.5f, 0.5f)); + float4 const x_55 = I; + float const x_57 = x_9.x_GLF_uniform_float_values.arr[2].el; + float4 const x_58 = N; + float4 const x_59 = I; + float4 const x_62 = N; + ref = (x_55 - (x_62 * (x_57 * dot(x_58, x_59)))); + float4 const x_65 = R; + float4 const x_66 = ref; + float const x_69 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((distance(x_65, x_66) < x_69)) { + int const x_75 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_78 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_81 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_84 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_75), float(x_78), float(x_81), float(x_84)); + } else { + int const x_88 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_89 = float(x_88); + *(tint_symbol_4) = float4(x_89, x_89, x_89, x_89); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..dcddef3ef4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.spvasm @@ -0,0 +1,164 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 107 +; Schema: 0 + OpCapability Shader + %54 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %I "I" + OpName %N "N" + OpName %R "R" + OpName %ref "ref" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %v4uint = OpTypeVector %uint 4 + %uint_92985 = OpConstant %uint 92985 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0_5 = OpConstant %float 0.5 + %56 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %95 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %I = OpVariable %_ptr_Function_v4float Function %17 + %N = OpVariable %_ptr_Function_v4float Function %17 + %R = OpVariable %_ptr_Function_v4float Function %17 + %ref = OpVariable %_ptr_Function_v4float Function %17 + %32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %33 = OpLoad %int %32 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %36 = OpLoad %int %35 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %39 = OpLoad %int %38 + %42 = OpBitcast %uint %33 + %43 = OpBitcast %uint %36 + %44 = OpBitcast %uint %39 + %46 = OpCompositeConstruct %v4uint %42 %43 %44 %uint_92985 + %40 = OpBitcast %v4float %46 + OpStore %I %40 + %49 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %50 = OpLoad %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %N %51 + %52 = OpLoad %v4float %I + %53 = OpExtInst %v4float %54 Reflect %52 %56 + OpStore %R %53 + %57 = OpLoad %v4float %I + %58 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_2 + %59 = OpLoad %float %58 + %60 = OpLoad %v4float %N + %61 = OpLoad %v4float %I + %62 = OpLoad %v4float %N + %63 = OpDot %float %60 %61 + %64 = OpFMul %float %59 %63 + %65 = OpVectorTimesScalar %v4float %62 %64 + %66 = OpFSub %v4float %57 %65 + OpStore %ref %66 + %67 = OpLoad %v4float %R + %68 = OpLoad %v4float %ref + %70 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %71 = OpLoad %float %70 + %72 = OpExtInst %float %54 Distance %67 %68 + %73 = OpFOrdLessThan %bool %72 %71 + OpSelectionMerge %75 None + OpBranchConditional %73 %76 %77 + %76 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %79 + %87 = OpConvertSToF %float %81 + %88 = OpConvertSToF %float %83 + %89 = OpConvertSToF %float %85 + %90 = OpCompositeConstruct %v4float %86 %87 %88 %89 + OpStore %x_GLF_color %90 + OpBranch %75 + %77 = OpLabel + %91 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %92 + %94 = OpCompositeConstruct %v4float %93 %93 %93 %93 + OpStore %x_GLF_color %94 + OpBranch %75 + %75 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %95 +%tint_symbol = OpFunctionParameter %main_out + %99 = OpLabel + %100 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %100 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %102 = OpLabel + %103 = OpFunctionCall %void %main_1 + %105 = OpLoad %v4float %x_GLF_color + %106 = OpCompositeConstruct %main_out %105 + %104 = OpFunctionCall %void %tint_symbol_2 %106 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c992ddc998 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-reflect-denorm/0-opt.wgsl.expected.wgsl @@ -0,0 +1,66 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var I : vec4; + var N : vec4; + var R : vec4; + var ref : vec4; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[4]; + I = bitcast>(vec4(bitcast(x_40), bitcast(x_43), bitcast(x_46), 92985u)); + let x_51 : f32 = x_9.x_GLF_uniform_float_values[1]; + N = vec4(x_51, x_51, x_51, x_51); + let x_53 : vec4 = I; + R = reflect(x_53, vec4(0.5, 0.5, 0.5, 0.5)); + let x_55 : vec4 = I; + let x_57 : f32 = x_9.x_GLF_uniform_float_values[2]; + let x_58 : vec4 = N; + let x_59 : vec4 = I; + let x_62 : vec4 = N; + ref = (x_55 - (x_62 * (x_57 * dot(x_58, x_59)))); + let x_65 : vec4 = R; + let x_66 : vec4 = ref; + let x_69 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((distance(x_65, x_66) < x_69)) { + let x_75 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_75), f32(x_78), f32(x_81), f32(x_84)); + } else { + let x_88 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_89 : f32 = f32(x_88); + x_GLF_color = vec4(x_89, x_89, x_89, x_89); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm new file mode 100644 index 0000000000..f4303ddc4c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm @@ -0,0 +1,105 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %undefined "undefined" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %10 RelaxedPrecision + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + %void = OpTypeVoid + %18 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %18 + %35 = OpLabel + %undefined = OpVariable %_ptr_Function_float Function + %36 = OpExtInst %float %1 Sinh %float_0x1_8p_128 + OpStore %undefined %36 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %10 = OpLoad %int %37 + %38 = OpIEqual %bool %int_1 %10 + %39 = OpLogicalNot %bool %38 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + %42 = OpLoad %float %undefined + %43 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpFOrdGreaterThan %bool %42 %44 + OpBranch %40 + %40 = OpLabel + %46 = OpPhi %bool %38 %35 %45 %41 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %12 = OpLoad %int %50 + %51 = OpConvertSToF %float %12 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %13 = OpLoad %int %52 + %53 = OpConvertSToF %float %13 + %54 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %14 = OpLoad %int %54 + %55 = OpConvertSToF %float %14 + %56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %15 = OpLoad %int %56 + %57 = OpConvertSToF %float %15 + %58 = OpCompositeConstruct %v4float %51 %53 %55 %57 + OpStore %_GLF_color %58 + OpBranch %47 + %49 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %16 = OpLoad %int %59 + %60 = OpConvertSToF %float %16 + %61 = OpCompositeConstruct %v4float %60 %60 %60 %60 + OpStore %_GLF_color %61 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ed5eaec306 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.hlsl @@ -0,0 +1,53 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float undefined = 0.0f; + bool x_45 = false; + bool x_46_phi = false; + undefined = sinh(asfloat(0x7fc00000u)); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_10 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const bool x_38 = (1 == x_10); + x_46_phi = x_38; + if (!(x_38)) { + const float x_42 = undefined; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_45 = (x_42 > x_44); + x_46_phi = x_45; + } + if (x_46_phi) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_12 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_13 = asint(x_6[1].x); + const int x_14 = asint(x_6[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_15 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_12), float(x_13), float(x_14), float(x_15)); + } else { + const int x_16 = asint(x_6[1].x); + const float x_60 = float(x_16); + x_GLF_color = float4(x_60, x_60, x_60, x_60); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..bea3fa46d3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.msl @@ -0,0 +1,67 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float undefined = 0.0f; + bool x_45 = false; + bool x_46_phi = false; + undefined = sinh(NAN); + int const x_10 = x_6.x_GLF_uniform_int_values.arr[0].el; + bool const x_38 = (1 == x_10); + x_46_phi = x_38; + if (!(x_38)) { + float const x_42 = undefined; + float const x_44 = x_8.x_GLF_uniform_float_values.arr[0].el; + x_45 = (x_42 > x_44); + x_46_phi = x_45; + } + bool const x_46 = x_46_phi; + if (x_46) { + int const x_12 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_13 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_14 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_15 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_12), float(x_13), float(x_14), float(x_15)); + } else { + int const x_16 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_60 = float(x_16); + *(tint_symbol_4) = float4(x_60, x_60, x_60, x_60); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..c418795e33 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.spvasm @@ -0,0 +1,143 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 84 +; Schema: 0 + OpCapability Shader + %33 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %undefined "undefined" + OpName %x_45 "x_45" + OpName %x_46_phi "x_46_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %30 = OpConstantNull %bool +%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %72 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %undefined = OpVariable %_ptr_Function_float Function %26 + %x_45 = OpVariable %_ptr_Function_bool Function %30 + %x_46_phi = OpVariable %_ptr_Function_bool Function %30 + %32 = OpExtInst %float %33 Sinh %float_0x1_8p_128 + OpStore %undefined %32 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %39 = OpLoad %int %38 + %41 = OpIEqual %bool %int_1 %39 + OpStore %x_46_phi %41 + %42 = OpLogicalNot %bool %41 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + %45 = OpLoad %float %undefined + %47 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %48 = OpLoad %float %47 + %49 = OpFOrdGreaterThan %bool %45 %48 + OpStore %x_45 %49 + %50 = OpLoad %bool %x_45 + OpStore %x_46_phi %50 + OpBranch %43 + %43 = OpLabel + %51 = OpLoad %bool %x_46_phi + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %56 + %64 = OpConvertSToF %float %58 + %65 = OpConvertSToF %float %60 + %66 = OpConvertSToF %float %62 + %67 = OpCompositeConstruct %v4float %63 %64 %65 %66 + OpStore %x_GLF_color %67 + OpBranch %52 + %54 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %69 + %71 = OpCompositeConstruct %v4float %70 %70 %70 %70 + OpStore %x_GLF_color %71 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %72 +%tint_symbol = OpFunctionParameter %main_out + %76 = OpLabel + %77 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %77 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %79 = OpLabel + %80 = OpFunctionCall %void %main_1 + %82 = OpLoad %v4float %x_GLF_color + %83 = OpCompositeConstruct %main_out %82 + %81 = OpFunctionCall %void %tint_symbol_2 %83 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..09b3c27d62 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.spvasm.expected.wgsl @@ -0,0 +1,59 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var undefined : f32; + var x_45 : bool; + var x_46_phi : bool; + undefined = sinh(0x1.8p+128); + let x_10 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_38 : bool = (1 == x_10); + x_46_phi = x_38; + if (!(x_38)) { + let x_42 : f32 = undefined; + let x_44 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_45 = (x_42 > x_44); + x_46_phi = x_45; + } + let x_46 : bool = x_46_phi; + if (x_46) { + let x_12 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_13 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_14 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_15 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_12), f32(x_13), f32(x_14), f32(x_15)); + } else { + let x_16 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_60 : f32 = f32(x_16); + x_GLF_color = vec4(x_60, x_60, x_60, x_60); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl new file mode 100644 index 0000000000..09b3c27d62 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl @@ -0,0 +1,59 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var undefined : f32; + var x_45 : bool; + var x_46_phi : bool; + undefined = sinh(0x1.8p+128); + let x_10 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_38 : bool = (1 == x_10); + x_46_phi = x_38; + if (!(x_38)) { + let x_42 : f32 = undefined; + let x_44 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_45 = (x_42 > x_44); + x_46_phi = x_45; + } + let x_46 : bool = x_46_phi; + if (x_46) { + let x_12 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_13 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_14 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_15 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_12), f32(x_13), f32(x_14), f32(x_15)); + } else { + let x_16 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_60 : f32 = f32(x_16); + x_GLF_color = vec4(x_60, x_60, x_60, x_60); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..7b92bee0ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.hlsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl:25:23 error: expected ')' for function call + undefined = sinh(0x1.8p+128); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..7b92bee0ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.msl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl:25:23 error: expected ')' for function call + undefined = sinh(0x1.8p+128); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..7b92bee0ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.spvasm @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl:25:23 error: expected ')' for function call + undefined = sinh(0x1.8p+128); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..7b92bee0ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-apfloat-sinh-negative-log2/0-opt.wgsl:25:23 error: expected ')' for function call + undefined = sinh(0x1.8p+128); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm new file mode 100644 index 0000000000..f4ea14efc7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm @@ -0,0 +1,70 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v "v" + OpName %dist1 "dist1" + OpName %dist2 "dist2" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %16 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 +%_ptr_Function_float = OpTypePointer Function %float +%float_0_761590004 = OpConstant %float 0.761590004 +%float_0_964030027 = OpConstant %float 0.964030027 +%float_0_995050013 = OpConstant %float 0.995050013 +%float_0_999329984 = OpConstant %float 0.999329984 + %22 = OpConstantComposite %v4float %float_0_761590004 %float_0_964030027 %float_0_995050013 %float_0_999329984 +%float_0_100000001 = OpConstant %float 0.100000001 + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %29 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + %dist1 = OpVariable %_ptr_Function_float Function + %dist2 = OpVariable %_ptr_Function_float Function + OpStore %v %16 + %30 = OpLoad %v4float %v + %31 = OpExtInst %v4float %1 Tanh %30 + %32 = OpLoad %v4float %v + %33 = OpExtInst %v4float %1 Sinh %32 + %34 = OpLoad %v4float %v + %35 = OpExtInst %v4float %1 Cosh %34 + %36 = OpFDiv %v4float %33 %35 + %37 = OpExtInst %float %1 Distance %31 %36 + OpStore %dist1 %37 + %38 = OpLoad %v4float %v + %39 = OpExtInst %v4float %1 Tanh %38 + %40 = OpExtInst %float %1 Distance %39 %22 + OpStore %dist2 %40 + %41 = OpLoad %float %dist1 + %42 = OpFOrdLessThan %bool %41 %float_0_100000001 + %43 = OpLoad %float %dist2 + %44 = OpFOrdLessThan %bool %43 %float_0_100000001 + %45 = OpLogicalAnd %bool %42 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpStore %_GLF_color %27 + OpBranch %46 + %48 = OpLabel + OpStore %_GLF_color %28 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..5cb60bd779 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.hlsl @@ -0,0 +1,34 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + float dist1 = 0.0f; + float dist2 = 0.0f; + v = float4(1.0f, 2.0f, 3.0f, 4.0f); + dist1 = distance(tanh(v), (sinh(v) / cosh(v))); + dist2 = distance(tanh(v), float4(0.761590004f, 0.964030027f, 0.995050013f, 0.999329984f)); + bool tint_tmp = (dist1 < 0.100000001f); + if (tint_tmp) { + tint_tmp = (dist2 < 0.100000001f); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..3b940f36bb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float4 v = 0.0f; + float dist1 = 0.0f; + float dist2 = 0.0f; + v = float4(1.0f, 2.0f, 3.0f, 4.0f); + float4 const x_30 = v; + float4 const x_32 = v; + float4 const x_34 = v; + dist1 = distance(tanh(x_30), (sinh(x_32) / cosh(x_34))); + float4 const x_38 = v; + dist2 = distance(tanh(x_38), float4(0.761590004f, 0.964030027f, 0.995050013f, 0.999329984f)); + float const x_41 = dist1; + float const x_43 = dist2; + if (((x_41 < 0.100000001f) && (x_43 < 0.100000001f))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..1f2f4f73be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %27 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %dist1 "dist1" + OpName %dist2 "dist2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %22 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 +%float_0_761590004 = OpConstant %float 0.761590004 +%float_0_964030027 = OpConstant %float 0.964030027 +%float_0_995050013 = OpConstant %float 0.995050013 +%float_0_999329984 = OpConstant %float 0.999329984 + %39 = OpConstantComposite %v4float %float_0_761590004 %float_0_964030027 %float_0_995050013 %float_0_999329984 +%float_0_100000001 = OpConstant %float 0.100000001 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %53 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %54 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %5 + %dist1 = OpVariable %_ptr_Function_float Function %16 + %dist2 = OpVariable %_ptr_Function_float Function %16 + OpStore %v %22 + %23 = OpLoad %v4float %v + %24 = OpLoad %v4float %v + %25 = OpLoad %v4float %v + %28 = OpExtInst %v4float %27 Tanh %23 + %29 = OpExtInst %v4float %27 Sinh %24 + %30 = OpExtInst %v4float %27 Cosh %25 + %31 = OpFDiv %v4float %29 %30 + %26 = OpExtInst %float %27 Distance %28 %31 + OpStore %dist1 %26 + %32 = OpLoad %v4float %v + %34 = OpExtInst %v4float %27 Tanh %32 + %33 = OpExtInst %float %27 Distance %34 %39 + OpStore %dist2 %33 + %40 = OpLoad %float %dist1 + %41 = OpLoad %float %dist2 + %43 = OpFOrdLessThan %bool %40 %float_0_100000001 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %45 + %46 = OpLabel + %47 = OpFOrdLessThan %bool %41 %float_0_100000001 + OpBranch %45 + %45 = OpLabel + %48 = OpPhi %bool %43 %11 %47 %46 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + OpStore %x_GLF_color %53 + OpBranch %49 + %51 = OpLabel + OpStore %x_GLF_color %54 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..8bcb3a5cee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.spvasm.expected.wgsl @@ -0,0 +1,33 @@ +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var dist1 : f32; + var dist2 : f32; + v = vec4(1.0, 2.0, 3.0, 4.0); + let x_30 : vec4 = v; + let x_32 : vec4 = v; + let x_34 : vec4 = v; + dist1 = distance(tanh(x_30), (sinh(x_32) / cosh(x_34))); + let x_38 : vec4 = v; + dist2 = distance(tanh(x_38), vec4(0.761590004, 0.964030027, 0.995050013, 0.999329984)); + let x_41 : f32 = dist1; + let x_43 : f32 = dist2; + if (((x_41 < 0.100000001) && (x_43 < 0.100000001))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl new file mode 100644 index 0000000000..8bcb3a5cee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl @@ -0,0 +1,33 @@ +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var dist1 : f32; + var dist2 : f32; + v = vec4(1.0, 2.0, 3.0, 4.0); + let x_30 : vec4 = v; + let x_32 : vec4 = v; + let x_34 : vec4 = v; + dist1 = distance(tanh(x_30), (sinh(x_32) / cosh(x_34))); + let x_38 : vec4 = v; + dist2 = distance(tanh(x_38), vec4(0.761590004, 0.964030027, 0.995050013, 0.999329984)); + let x_41 : f32 = dist1; + let x_43 : f32 = dist2; + if (((x_41 < 0.100000001) && (x_43 < 0.100000001))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..5cb60bd779 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + float dist1 = 0.0f; + float dist2 = 0.0f; + v = float4(1.0f, 2.0f, 3.0f, 4.0f); + dist1 = distance(tanh(v), (sinh(v) / cosh(v))); + dist2 = distance(tanh(v), float4(0.761590004f, 0.964030027f, 0.995050013f, 0.999329984f)); + bool tint_tmp = (dist1 < 0.100000001f); + if (tint_tmp) { + tint_tmp = (dist2 < 0.100000001f); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..3b940f36bb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float4 v = 0.0f; + float dist1 = 0.0f; + float dist2 = 0.0f; + v = float4(1.0f, 2.0f, 3.0f, 4.0f); + float4 const x_30 = v; + float4 const x_32 = v; + float4 const x_34 = v; + dist1 = distance(tanh(x_30), (sinh(x_32) / cosh(x_34))); + float4 const x_38 = v; + dist2 = distance(tanh(x_38), float4(0.761590004f, 0.964030027f, 0.995050013f, 0.999329984f)); + float const x_41 = dist1; + float const x_43 = dist2; + if (((x_41 < 0.100000001f) && (x_43 < 0.100000001f))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..1f2f4f73be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %27 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %dist1 "dist1" + OpName %dist2 "dist2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %22 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 +%float_0_761590004 = OpConstant %float 0.761590004 +%float_0_964030027 = OpConstant %float 0.964030027 +%float_0_995050013 = OpConstant %float 0.995050013 +%float_0_999329984 = OpConstant %float 0.999329984 + %39 = OpConstantComposite %v4float %float_0_761590004 %float_0_964030027 %float_0_995050013 %float_0_999329984 +%float_0_100000001 = OpConstant %float 0.100000001 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %53 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %54 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %5 + %dist1 = OpVariable %_ptr_Function_float Function %16 + %dist2 = OpVariable %_ptr_Function_float Function %16 + OpStore %v %22 + %23 = OpLoad %v4float %v + %24 = OpLoad %v4float %v + %25 = OpLoad %v4float %v + %28 = OpExtInst %v4float %27 Tanh %23 + %29 = OpExtInst %v4float %27 Sinh %24 + %30 = OpExtInst %v4float %27 Cosh %25 + %31 = OpFDiv %v4float %29 %30 + %26 = OpExtInst %float %27 Distance %28 %31 + OpStore %dist1 %26 + %32 = OpLoad %v4float %v + %34 = OpExtInst %v4float %27 Tanh %32 + %33 = OpExtInst %float %27 Distance %34 %39 + OpStore %dist2 %33 + %40 = OpLoad %float %dist1 + %41 = OpLoad %float %dist2 + %43 = OpFOrdLessThan %bool %40 %float_0_100000001 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %45 + %46 = OpLabel + %47 = OpFOrdLessThan %bool %41 %float_0_100000001 + OpBranch %45 + %45 = OpLabel + %48 = OpPhi %bool %43 %11 %47 %46 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + OpStore %x_GLF_color %53 + OpBranch %49 + %51 = OpLabel + OpStore %x_GLF_color %54 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..8bcb3a5cee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-tanh/0-opt.wgsl.expected.wgsl @@ -0,0 +1,33 @@ +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var dist1 : f32; + var dist2 : f32; + v = vec4(1.0, 2.0, 3.0, 4.0); + let x_30 : vec4 = v; + let x_32 : vec4 = v; + let x_34 : vec4 = v; + dist1 = distance(tanh(x_30), (sinh(x_32) / cosh(x_34))); + let x_38 : vec4 = v; + dist2 = distance(tanh(x_38), vec4(0.761590004, 0.964030027, 0.995050013, 0.999329984)); + let x_41 : f32 = dist1; + let x_43 : f32 = dist2; + if (((x_41 < 0.100000001) && (x_43 < 0.100000001))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm new file mode 100644 index 0000000000..65b9079c09 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm @@ -0,0 +1,228 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %m0 "m0" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %m1 "m1" + OpName %undefined "undefined" + OpName %defined "defined" + OpName %v0 "v0" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpDecorate %_arr_int_uint_12 ArrayStride 16 + OpMemberDecorate %buf1 0 RelaxedPrecision + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %37 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat3v4float = OpTypeMatrix %v4float 3 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_12 = OpConstant %uint 12 +%_arr_int_uint_12 = OpTypeArray %int %uint_12 + %buf1 = OpTypeStruct %_arr_int_uint_12 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %float_4 = OpConstant %float 4 + %int_10 = OpConstant %int 10 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %float_8 = OpConstant %float 8 + %int_11 = OpConstant %int 11 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %64 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %v3int = OpTypeVector %int 3 + %int_500 = OpConstant %int 500 + %67 = OpConstantComposite %v3int %int_500 %int_500 %int_500 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %37 + %78 = OpLabel + %m0 = OpVariable %_ptr_Function_mat3v4float Function + %m1 = OpVariable %_ptr_Function_mat3v4float Function + %undefined = OpVariable %_ptr_Function_v3float Function + %defined = OpVariable %_ptr_Function_v3float Function + %v0 = OpVariable %_ptr_Function_v4float Function + %v1 = OpVariable %_ptr_Function_v4float Function + %v2 = OpVariable %_ptr_Function_v4float Function + %v3 = OpVariable %_ptr_Function_v4float Function + %79 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %17 = OpLoad %int %79 + %80 = OpConvertSToF %float %17 + %81 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %18 = OpLoad %int %81 + %82 = OpConvertSToF %float %18 + %83 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %19 = OpLoad %int %83 + %84 = OpConvertSToF %float %19 + %85 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_10 + %20 = OpLoad %int %85 + %86 = OpConvertSToF %float %20 + %87 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_7 + %21 = OpLoad %int %87 + %88 = OpConvertSToF %float %21 + %89 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %22 = OpLoad %int %89 + %90 = OpConvertSToF %float %22 + %91 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_11 + %23 = OpLoad %int %91 + %92 = OpConvertSToF %float %23 + %93 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %24 = OpLoad %int %93 + %94 = OpConvertSToF %float %24 + %95 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %25 = OpLoad %int %95 + %96 = OpConvertSToF %float %25 + %97 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %26 = OpLoad %int %97 + %98 = OpConvertSToF %float %26 + %99 = OpCompositeConstruct %v4float %80 %82 %84 %float_4 + %100 = OpCompositeConstruct %v4float %86 %88 %90 %float_8 + %101 = OpCompositeConstruct %v4float %92 %94 %96 %98 + %102 = OpCompositeConstruct %mat3v4float %99 %100 %101 + OpStore %m0 %102 + %103 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %27 = OpLoad %int %103 + %104 = OpConvertSToF %float %27 + %105 = OpCompositeConstruct %v4float %104 %float_0 %float_0 %float_0 + %106 = OpCompositeConstruct %v4float %float_0 %104 %float_0 %float_0 + %107 = OpCompositeConstruct %v4float %float_0 %float_0 %104 %float_0 + %108 = OpCompositeConstruct %mat3v4float %105 %106 %107 + OpStore %m1 %108 + %109 = OpExtInst %v3float %1 Ldexp %64 %67 + OpStore %undefined %109 + %110 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %28 = OpLoad %int %110 + %111 = OpConvertSToF %float %28 + %112 = OpCompositeConstruct %v3float %111 %111 %111 + %113 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %29 = OpLoad %int %113 + %114 = OpCompositeConstruct %v3int %29 %29 %29 + %115 = OpExtInst %v3float %1 Ldexp %112 %114 + OpStore %defined %115 + %116 = OpLoad %mat3v4float %m0 + %117 = OpLoad %v3float %undefined + %118 = OpMatrixTimesVector %v4float %116 %117 + OpStore %v0 %118 + %119 = OpLoad %mat3v4float %m1 + %120 = OpLoad %v3float %undefined + %121 = OpMatrixTimesVector %v4float %119 %120 + OpStore %v1 %121 + %122 = OpLoad %mat3v4float %m0 + %123 = OpLoad %v3float %defined + %124 = OpMatrixTimesVector %v4float %122 %123 + OpStore %v2 %124 + %125 = OpLoad %mat3v4float %m1 + %126 = OpLoad %v3float %defined + %127 = OpMatrixTimesVector %v4float %125 %126 + OpStore %v3 %127 + %128 = OpAccessChain %_ptr_Function_float %v2 %uint_0 + %129 = OpLoad %float %128 + %130 = OpAccessChain %_ptr_Function_float %v3 %uint_0 + %131 = OpLoad %float %130 + %132 = OpFOrdGreaterThan %bool %129 %131 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %135 + %134 = OpLabel + %136 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %30 = OpLoad %int %136 + %137 = OpConvertSToF %float %30 + %138 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_9 + %31 = OpLoad %int %138 + %139 = OpConvertSToF %float %31 + %140 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_9 + %32 = OpLoad %int %140 + %141 = OpConvertSToF %float %32 + %142 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %33 = OpLoad %int %142 + %143 = OpConvertSToF %float %33 + %144 = OpCompositeConstruct %v4float %137 %139 %141 %143 + OpStore %_GLF_color %144 + OpBranch %133 + %135 = OpLabel + %145 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_9 + %34 = OpLoad %int %145 + %146 = OpConvertSToF %float %34 + %147 = OpCompositeConstruct %v4float %146 %146 %146 %146 + OpStore %_GLF_color %147 + OpBranch %133 + %133 = OpLabel + %148 = OpAccessChain %_ptr_Function_float %v0 %uint_0 + %149 = OpLoad %float %148 + %150 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %151 = OpLoad %float %150 + %152 = OpFOrdLessThan %bool %149 %151 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + %155 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %156 = OpLoad %float %155 + %157 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_1 + OpStore %157 %156 + OpBranch %153 + %153 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..4a1c25c351 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.hlsl @@ -0,0 +1,77 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[12]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_15 : register(b0, space0) { + uint4 x_15[1]; +}; + +void main_1() { + float3x4 m0 = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x4 m1 = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3 undefined = float3(0.0f, 0.0f, 0.0f); + float3 defined = float3(0.0f, 0.0f, 0.0f); + float4 v0 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 v2 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 v3 = float4(0.0f, 0.0f, 0.0f, 0.0f); + const int x_17 = asint(x_6[4].x); + const int x_18 = asint(x_6[5].x); + const int x_19 = asint(x_6[6].x); + const int x_20 = asint(x_6[10].x); + const int x_21 = asint(x_6[7].x); + const int x_22 = asint(x_6[8].x); + const int x_23 = asint(x_6[11].x); + const int x_24 = asint(x_6[1].x); + const int x_25 = asint(x_6[2].x); + const int x_26 = asint(x_6[3].x); + m0 = float3x4(float4(float(x_17), float(x_18), float(x_19), 4.0f), float4(float(x_20), float(x_21), float(x_22), 8.0f), float4(float(x_23), float(x_24), float(x_25), float(x_26))); + const int x_27 = asint(x_6[4].x); + const float x_104 = float(x_27); + m1 = float3x4(float4(x_104, 0.0f, 0.0f, 0.0f), float4(0.0f, x_104, 0.0f, 0.0f), float4(0.0f, 0.0f, x_104, 0.0f)); + undefined = ldexp(float3(1.0f, 1.0f, 1.0f), int3(500, 500, 500)); + const int x_28 = asint(x_6[4].x); + const float x_111 = float(x_28); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + defined = ldexp(float3(x_111, x_111, x_111), int3(x_29, x_29, x_29)); + v0 = mul(undefined, m0); + v1 = mul(undefined, m1); + v2 = mul(defined, m0); + v3 = mul(defined, m1); + const float x_129 = v2.x; + const float x_131 = v3.x; + if ((x_129 > x_131)) { + const int x_30 = asint(x_6[4].x); + const int x_31 = asint(x_6[9].x); + const int x_32 = asint(x_6[9].x); + const int x_33 = asint(x_6[4].x); + x_GLF_color = float4(float(x_30), float(x_31), float(x_32), float(x_33)); + } else { + const int x_34 = asint(x_6[9].x); + const float x_146 = float(x_34); + x_GLF_color = float4(x_146, x_146, x_146, x_146); + } + const float x_149 = v0.x; + const float x_151 = v1.x; + if ((x_149 < x_151)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_156 = asfloat(x_15[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color.y = x_156; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..80097259bc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.msl @@ -0,0 +1,100 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[12]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_15, thread float4* const tint_symbol_4) { + float3x4 m0 = float3x4(0.0f); + float3x4 m1 = float3x4(0.0f); + float3 undefined = 0.0f; + float3 defined = 0.0f; + float4 v0 = 0.0f; + float4 v1 = 0.0f; + float4 v2 = 0.0f; + float4 v3 = 0.0f; + int const x_17 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_18 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_19 = x_6.x_GLF_uniform_int_values.arr[6].el; + int const x_20 = x_6.x_GLF_uniform_int_values.arr[10].el; + int const x_21 = x_6.x_GLF_uniform_int_values.arr[7].el; + int const x_22 = x_6.x_GLF_uniform_int_values.arr[8].el; + int const x_23 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_24 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_26 = x_6.x_GLF_uniform_int_values.arr[3].el; + m0 = float3x4(float4(float(x_17), float(x_18), float(x_19), 4.0f), float4(float(x_20), float(x_21), float(x_22), 8.0f), float4(float(x_23), float(x_24), float(x_25), float(x_26))); + int const x_27 = x_6.x_GLF_uniform_int_values.arr[4].el; + float const x_104 = float(x_27); + m1 = float3x4(float4(x_104, 0.0f, 0.0f, 0.0f), float4(0.0f, x_104, 0.0f, 0.0f), float4(0.0f, 0.0f, x_104, 0.0f)); + undefined = ldexp(float3(1.0f, 1.0f, 1.0f), int3(500, 500, 500)); + int const x_28 = x_6.x_GLF_uniform_int_values.arr[4].el; + float const x_111 = float(x_28); + int const x_29 = x_6.x_GLF_uniform_int_values.arr[0].el; + defined = ldexp(float3(x_111, x_111, x_111), int3(x_29, x_29, x_29)); + float3x4 const x_116 = m0; + float3 const x_117 = undefined; + v0 = (x_116 * x_117); + float3x4 const x_119 = m1; + float3 const x_120 = undefined; + v1 = (x_119 * x_120); + float3x4 const x_122 = m0; + float3 const x_123 = defined; + v2 = (x_122 * x_123); + float3x4 const x_125 = m1; + float3 const x_126 = defined; + v3 = (x_125 * x_126); + float const x_129 = v2.x; + float const x_131 = v3.x; + if ((x_129 > x_131)) { + int const x_30 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[9].el; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[9].el; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[4].el; + *(tint_symbol_4) = float4(float(x_30), float(x_31), float(x_32), float(x_33)); + } else { + int const x_34 = x_6.x_GLF_uniform_int_values.arr[9].el; + float const x_146 = float(x_34); + *(tint_symbol_4) = float4(x_146, x_146, x_146, x_146); + } + float const x_149 = v0.x; + float const x_151 = v1.x; + if ((x_149 < x_151)) { + float const x_156 = x_15.x_GLF_uniform_float_values.arr[0].el; + (*(tint_symbol_4)).y = x_156; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_15 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_15, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..5f8230b341 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.spvasm @@ -0,0 +1,244 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 175 +; Schema: 0 + OpCapability Shader + %96 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_15 "x_15" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m0 "m0" + OpName %m1 "m1" + OpName %undefined "undefined" + OpName %defined "defined" + OpName %v0 "v0" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_12 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_15 NonWritable + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_12 = OpConstant %uint 12 +%_arr_int_uint_12 = OpTypeArray %int %uint_12 + %buf1 = OpTypeStruct %_arr_int_uint_12 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_15 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%mat3v4float = OpTypeMatrix %v4float 3 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %27 = OpConstantNull %mat3v4float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %32 = OpConstantNull %v3float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_4 = OpConstant %int 4 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_10 = OpConstant %int 10 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_11 = OpConstant %int 11 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %float_4 = OpConstant %float 4 + %float_8 = OpConstant %float 8 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %98 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %v3int = OpTypeVector %int 3 + %int_500 = OpConstant %int 500 + %101 = OpConstantComposite %v3int %int_500 %int_500 %int_500 + %int_0 = OpConstant %int 0 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %int_9 = OpConstant %int 9 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %163 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %m0 = OpVariable %_ptr_Function_mat3v4float Function %27 + %m1 = OpVariable %_ptr_Function_mat3v4float Function %27 + %undefined = OpVariable %_ptr_Function_v3float Function %32 + %defined = OpVariable %_ptr_Function_v3float Function %32 + %v0 = OpVariable %_ptr_Function_v4float Function %12 + %v1 = OpVariable %_ptr_Function_v4float Function %12 + %v2 = OpVariable %_ptr_Function_v4float Function %12 + %v3 = OpVariable %_ptr_Function_v4float Function %12 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %43 = OpLoad %int %42 + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %46 = OpLoad %int %45 + %48 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %49 = OpLoad %int %48 + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_10 + %52 = OpLoad %int %51 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_7 + %55 = OpLoad %int %54 + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_8 + %58 = OpLoad %int %57 + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %61 = OpLoad %int %60 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %64 = OpLoad %int %63 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %67 = OpLoad %int %66 + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %43 + %72 = OpConvertSToF %float %46 + %73 = OpConvertSToF %float %49 + %75 = OpCompositeConstruct %v4float %71 %72 %73 %float_4 + %76 = OpConvertSToF %float %52 + %77 = OpConvertSToF %float %55 + %78 = OpConvertSToF %float %58 + %80 = OpCompositeConstruct %v4float %76 %77 %78 %float_8 + %81 = OpConvertSToF %float %61 + %82 = OpConvertSToF %float %64 + %83 = OpConvertSToF %float %67 + %84 = OpConvertSToF %float %70 + %85 = OpCompositeConstruct %v4float %81 %82 %83 %84 + %86 = OpCompositeConstruct %mat3v4float %75 %80 %85 + OpStore %m0 %86 + %87 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %88 + %91 = OpCompositeConstruct %v4float %89 %float_0 %float_0 %float_0 + %92 = OpCompositeConstruct %v4float %float_0 %89 %float_0 %float_0 + %93 = OpCompositeConstruct %v4float %float_0 %float_0 %89 %float_0 + %94 = OpCompositeConstruct %mat3v4float %91 %92 %93 + OpStore %m1 %94 + %95 = OpExtInst %v3float %96 Ldexp %98 %101 + OpStore %undefined %95 + %102 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %103 = OpLoad %int %102 + %104 = OpConvertSToF %float %103 + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %107 = OpLoad %int %106 + %109 = OpCompositeConstruct %v3float %104 %104 %104 + %110 = OpCompositeConstruct %v3int %107 %107 %107 + %108 = OpExtInst %v3float %96 Ldexp %109 %110 + OpStore %defined %108 + %111 = OpLoad %mat3v4float %m0 + %112 = OpLoad %v3float %undefined + %113 = OpMatrixTimesVector %v4float %111 %112 + OpStore %v0 %113 + %114 = OpLoad %mat3v4float %m1 + %115 = OpLoad %v3float %undefined + %116 = OpMatrixTimesVector %v4float %114 %115 + OpStore %v1 %116 + %117 = OpLoad %mat3v4float %m0 + %118 = OpLoad %v3float %defined + %119 = OpMatrixTimesVector %v4float %117 %118 + OpStore %v2 %119 + %120 = OpLoad %mat3v4float %m1 + %121 = OpLoad %v3float %defined + %122 = OpMatrixTimesVector %v4float %120 %121 + OpStore %v3 %122 + %124 = OpAccessChain %_ptr_Function_float %v2 %uint_0 + %125 = OpLoad %float %124 + %126 = OpAccessChain %_ptr_Function_float %v3 %uint_0 + %127 = OpLoad %float %126 + %128 = OpFOrdGreaterThan %bool %125 %127 + OpSelectionMerge %130 None + OpBranchConditional %128 %131 %132 + %131 = OpLabel + %133 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %134 = OpLoad %int %133 + %136 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %137 = OpLoad %int %136 + %138 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %139 = OpLoad %int %138 + %140 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %141 = OpLoad %int %140 + %142 = OpConvertSToF %float %134 + %143 = OpConvertSToF %float %137 + %144 = OpConvertSToF %float %139 + %145 = OpConvertSToF %float %141 + %146 = OpCompositeConstruct %v4float %142 %143 %144 %145 + OpStore %x_GLF_color %146 + OpBranch %130 + %132 = OpLabel + %147 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %148 = OpLoad %int %147 + %149 = OpConvertSToF %float %148 + %150 = OpCompositeConstruct %v4float %149 %149 %149 %149 + OpStore %x_GLF_color %150 + OpBranch %130 + %130 = OpLabel + %151 = OpAccessChain %_ptr_Function_float %v0 %uint_0 + %152 = OpLoad %float %151 + %153 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %154 = OpLoad %float %153 + %155 = OpFOrdLessThan %bool %152 %154 + OpSelectionMerge %156 None + OpBranchConditional %155 %157 %156 + %157 = OpLabel + %159 = OpAccessChain %_ptr_Uniform_float %x_15 %uint_0 %int_0 + %160 = OpLoad %float %159 + %162 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + OpStore %162 %160 + OpBranch %156 + %156 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %163 +%tint_symbol = OpFunctionParameter %main_out + %167 = OpLabel + %168 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %168 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %170 = OpLabel + %171 = OpFunctionCall %void %main_1 + %173 = OpLoad %v4float %x_GLF_color + %174 = OpCompositeConstruct %main_out %173 + %172 = OpFunctionCall %void %tint_symbol_2 %174 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..e298a8c937 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.spvasm.expected.wgsl @@ -0,0 +1,92 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_15 : buf0; + +fn main_1() { + var m0 : mat3x4; + var m1 : mat3x4; + var undefined : vec3; + var defined : vec3; + var v0 : vec4; + var v1 : vec4; + var v2 : vec4; + var v3 : vec4; + let x_17 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_18 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_19 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_20 : i32 = x_6.x_GLF_uniform_int_values[10]; + let x_21 : i32 = x_6.x_GLF_uniform_int_values[7]; + let x_22 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_23 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_24 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[3]; + m0 = mat3x4(vec4(f32(x_17), f32(x_18), f32(x_19), 4.0), vec4(f32(x_20), f32(x_21), f32(x_22), 8.0), vec4(f32(x_23), f32(x_24), f32(x_25), f32(x_26))); + let x_27 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_104 : f32 = f32(x_27); + m1 = mat3x4(vec4(x_104, 0.0, 0.0, 0.0), vec4(0.0, x_104, 0.0, 0.0), vec4(0.0, 0.0, x_104, 0.0)); + undefined = ldexp(vec3(1.0, 1.0, 1.0), vec3(500, 500, 500)); + let x_28 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_111 : f32 = f32(x_28); + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + defined = ldexp(vec3(x_111, x_111, x_111), vec3(x_29, x_29, x_29)); + let x_116 : mat3x4 = m0; + let x_117 : vec3 = undefined; + v0 = (x_116 * x_117); + let x_119 : mat3x4 = m1; + let x_120 : vec3 = undefined; + v1 = (x_119 * x_120); + let x_122 : mat3x4 = m0; + let x_123 : vec3 = defined; + v2 = (x_122 * x_123); + let x_125 : mat3x4 = m1; + let x_126 : vec3 = defined; + v3 = (x_125 * x_126); + let x_129 : f32 = v2.x; + let x_131 : f32 = v3.x; + if ((x_129 > x_131)) { + let x_30 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[4]; + x_GLF_color = vec4(f32(x_30), f32(x_31), f32(x_32), f32(x_33)); + } else { + let x_34 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_146 : f32 = f32(x_34); + x_GLF_color = vec4(x_146, x_146, x_146, x_146); + } + let x_149 : f32 = v0.x; + let x_151 : f32 = v1.x; + if ((x_149 < x_151)) { + let x_156 : f32 = x_15.x_GLF_uniform_float_values[0]; + x_GLF_color.y = x_156; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl new file mode 100644 index 0000000000..e298a8c937 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl @@ -0,0 +1,92 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_15 : buf0; + +fn main_1() { + var m0 : mat3x4; + var m1 : mat3x4; + var undefined : vec3; + var defined : vec3; + var v0 : vec4; + var v1 : vec4; + var v2 : vec4; + var v3 : vec4; + let x_17 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_18 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_19 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_20 : i32 = x_6.x_GLF_uniform_int_values[10]; + let x_21 : i32 = x_6.x_GLF_uniform_int_values[7]; + let x_22 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_23 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_24 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[3]; + m0 = mat3x4(vec4(f32(x_17), f32(x_18), f32(x_19), 4.0), vec4(f32(x_20), f32(x_21), f32(x_22), 8.0), vec4(f32(x_23), f32(x_24), f32(x_25), f32(x_26))); + let x_27 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_104 : f32 = f32(x_27); + m1 = mat3x4(vec4(x_104, 0.0, 0.0, 0.0), vec4(0.0, x_104, 0.0, 0.0), vec4(0.0, 0.0, x_104, 0.0)); + undefined = ldexp(vec3(1.0, 1.0, 1.0), vec3(500, 500, 500)); + let x_28 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_111 : f32 = f32(x_28); + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + defined = ldexp(vec3(x_111, x_111, x_111), vec3(x_29, x_29, x_29)); + let x_116 : mat3x4 = m0; + let x_117 : vec3 = undefined; + v0 = (x_116 * x_117); + let x_119 : mat3x4 = m1; + let x_120 : vec3 = undefined; + v1 = (x_119 * x_120); + let x_122 : mat3x4 = m0; + let x_123 : vec3 = defined; + v2 = (x_122 * x_123); + let x_125 : mat3x4 = m1; + let x_126 : vec3 = defined; + v3 = (x_125 * x_126); + let x_129 : f32 = v2.x; + let x_131 : f32 = v3.x; + if ((x_129 > x_131)) { + let x_30 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[4]; + x_GLF_color = vec4(f32(x_30), f32(x_31), f32(x_32), f32(x_33)); + } else { + let x_34 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_146 : f32 = f32(x_34); + x_GLF_color = vec4(x_146, x_146, x_146, x_146); + } + let x_149 : f32 = v0.x; + let x_151 : f32 = v1.x; + if ((x_149 < x_151)) { + let x_156 : f32 = x_15.x_GLF_uniform_float_values[0]; + x_GLF_color.y = x_156; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..4a1c25c351 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.hlsl @@ -0,0 +1,77 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[12]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_15 : register(b0, space0) { + uint4 x_15[1]; +}; + +void main_1() { + float3x4 m0 = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x4 m1 = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3 undefined = float3(0.0f, 0.0f, 0.0f); + float3 defined = float3(0.0f, 0.0f, 0.0f); + float4 v0 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 v2 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 v3 = float4(0.0f, 0.0f, 0.0f, 0.0f); + const int x_17 = asint(x_6[4].x); + const int x_18 = asint(x_6[5].x); + const int x_19 = asint(x_6[6].x); + const int x_20 = asint(x_6[10].x); + const int x_21 = asint(x_6[7].x); + const int x_22 = asint(x_6[8].x); + const int x_23 = asint(x_6[11].x); + const int x_24 = asint(x_6[1].x); + const int x_25 = asint(x_6[2].x); + const int x_26 = asint(x_6[3].x); + m0 = float3x4(float4(float(x_17), float(x_18), float(x_19), 4.0f), float4(float(x_20), float(x_21), float(x_22), 8.0f), float4(float(x_23), float(x_24), float(x_25), float(x_26))); + const int x_27 = asint(x_6[4].x); + const float x_104 = float(x_27); + m1 = float3x4(float4(x_104, 0.0f, 0.0f, 0.0f), float4(0.0f, x_104, 0.0f, 0.0f), float4(0.0f, 0.0f, x_104, 0.0f)); + undefined = ldexp(float3(1.0f, 1.0f, 1.0f), int3(500, 500, 500)); + const int x_28 = asint(x_6[4].x); + const float x_111 = float(x_28); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + defined = ldexp(float3(x_111, x_111, x_111), int3(x_29, x_29, x_29)); + v0 = mul(undefined, m0); + v1 = mul(undefined, m1); + v2 = mul(defined, m0); + v3 = mul(defined, m1); + const float x_129 = v2.x; + const float x_131 = v3.x; + if ((x_129 > x_131)) { + const int x_30 = asint(x_6[4].x); + const int x_31 = asint(x_6[9].x); + const int x_32 = asint(x_6[9].x); + const int x_33 = asint(x_6[4].x); + x_GLF_color = float4(float(x_30), float(x_31), float(x_32), float(x_33)); + } else { + const int x_34 = asint(x_6[9].x); + const float x_146 = float(x_34); + x_GLF_color = float4(x_146, x_146, x_146, x_146); + } + const float x_149 = v0.x; + const float x_151 = v1.x; + if ((x_149 < x_151)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_156 = asfloat(x_15[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color.y = x_156; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..80097259bc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.msl @@ -0,0 +1,100 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[12]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_15, thread float4* const tint_symbol_4) { + float3x4 m0 = float3x4(0.0f); + float3x4 m1 = float3x4(0.0f); + float3 undefined = 0.0f; + float3 defined = 0.0f; + float4 v0 = 0.0f; + float4 v1 = 0.0f; + float4 v2 = 0.0f; + float4 v3 = 0.0f; + int const x_17 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_18 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_19 = x_6.x_GLF_uniform_int_values.arr[6].el; + int const x_20 = x_6.x_GLF_uniform_int_values.arr[10].el; + int const x_21 = x_6.x_GLF_uniform_int_values.arr[7].el; + int const x_22 = x_6.x_GLF_uniform_int_values.arr[8].el; + int const x_23 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_24 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_26 = x_6.x_GLF_uniform_int_values.arr[3].el; + m0 = float3x4(float4(float(x_17), float(x_18), float(x_19), 4.0f), float4(float(x_20), float(x_21), float(x_22), 8.0f), float4(float(x_23), float(x_24), float(x_25), float(x_26))); + int const x_27 = x_6.x_GLF_uniform_int_values.arr[4].el; + float const x_104 = float(x_27); + m1 = float3x4(float4(x_104, 0.0f, 0.0f, 0.0f), float4(0.0f, x_104, 0.0f, 0.0f), float4(0.0f, 0.0f, x_104, 0.0f)); + undefined = ldexp(float3(1.0f, 1.0f, 1.0f), int3(500, 500, 500)); + int const x_28 = x_6.x_GLF_uniform_int_values.arr[4].el; + float const x_111 = float(x_28); + int const x_29 = x_6.x_GLF_uniform_int_values.arr[0].el; + defined = ldexp(float3(x_111, x_111, x_111), int3(x_29, x_29, x_29)); + float3x4 const x_116 = m0; + float3 const x_117 = undefined; + v0 = (x_116 * x_117); + float3x4 const x_119 = m1; + float3 const x_120 = undefined; + v1 = (x_119 * x_120); + float3x4 const x_122 = m0; + float3 const x_123 = defined; + v2 = (x_122 * x_123); + float3x4 const x_125 = m1; + float3 const x_126 = defined; + v3 = (x_125 * x_126); + float const x_129 = v2.x; + float const x_131 = v3.x; + if ((x_129 > x_131)) { + int const x_30 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[9].el; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[9].el; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[4].el; + *(tint_symbol_4) = float4(float(x_30), float(x_31), float(x_32), float(x_33)); + } else { + int const x_34 = x_6.x_GLF_uniform_int_values.arr[9].el; + float const x_146 = float(x_34); + *(tint_symbol_4) = float4(x_146, x_146, x_146, x_146); + } + float const x_149 = v0.x; + float const x_151 = v1.x; + if ((x_149 < x_151)) { + float const x_156 = x_15.x_GLF_uniform_float_values.arr[0].el; + (*(tint_symbol_4)).y = x_156; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_15 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_15, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5f8230b341 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.spvasm @@ -0,0 +1,244 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 175 +; Schema: 0 + OpCapability Shader + %96 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_15 "x_15" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m0 "m0" + OpName %m1 "m1" + OpName %undefined "undefined" + OpName %defined "defined" + OpName %v0 "v0" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_12 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_15 NonWritable + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_12 = OpConstant %uint 12 +%_arr_int_uint_12 = OpTypeArray %int %uint_12 + %buf1 = OpTypeStruct %_arr_int_uint_12 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_15 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%mat3v4float = OpTypeMatrix %v4float 3 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %27 = OpConstantNull %mat3v4float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %32 = OpConstantNull %v3float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_4 = OpConstant %int 4 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_10 = OpConstant %int 10 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_11 = OpConstant %int 11 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %float_4 = OpConstant %float 4 + %float_8 = OpConstant %float 8 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %98 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %v3int = OpTypeVector %int 3 + %int_500 = OpConstant %int 500 + %101 = OpConstantComposite %v3int %int_500 %int_500 %int_500 + %int_0 = OpConstant %int 0 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %int_9 = OpConstant %int 9 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %163 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %m0 = OpVariable %_ptr_Function_mat3v4float Function %27 + %m1 = OpVariable %_ptr_Function_mat3v4float Function %27 + %undefined = OpVariable %_ptr_Function_v3float Function %32 + %defined = OpVariable %_ptr_Function_v3float Function %32 + %v0 = OpVariable %_ptr_Function_v4float Function %12 + %v1 = OpVariable %_ptr_Function_v4float Function %12 + %v2 = OpVariable %_ptr_Function_v4float Function %12 + %v3 = OpVariable %_ptr_Function_v4float Function %12 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %43 = OpLoad %int %42 + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %46 = OpLoad %int %45 + %48 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %49 = OpLoad %int %48 + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_10 + %52 = OpLoad %int %51 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_7 + %55 = OpLoad %int %54 + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_8 + %58 = OpLoad %int %57 + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %61 = OpLoad %int %60 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %64 = OpLoad %int %63 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %67 = OpLoad %int %66 + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %43 + %72 = OpConvertSToF %float %46 + %73 = OpConvertSToF %float %49 + %75 = OpCompositeConstruct %v4float %71 %72 %73 %float_4 + %76 = OpConvertSToF %float %52 + %77 = OpConvertSToF %float %55 + %78 = OpConvertSToF %float %58 + %80 = OpCompositeConstruct %v4float %76 %77 %78 %float_8 + %81 = OpConvertSToF %float %61 + %82 = OpConvertSToF %float %64 + %83 = OpConvertSToF %float %67 + %84 = OpConvertSToF %float %70 + %85 = OpCompositeConstruct %v4float %81 %82 %83 %84 + %86 = OpCompositeConstruct %mat3v4float %75 %80 %85 + OpStore %m0 %86 + %87 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %88 + %91 = OpCompositeConstruct %v4float %89 %float_0 %float_0 %float_0 + %92 = OpCompositeConstruct %v4float %float_0 %89 %float_0 %float_0 + %93 = OpCompositeConstruct %v4float %float_0 %float_0 %89 %float_0 + %94 = OpCompositeConstruct %mat3v4float %91 %92 %93 + OpStore %m1 %94 + %95 = OpExtInst %v3float %96 Ldexp %98 %101 + OpStore %undefined %95 + %102 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %103 = OpLoad %int %102 + %104 = OpConvertSToF %float %103 + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %107 = OpLoad %int %106 + %109 = OpCompositeConstruct %v3float %104 %104 %104 + %110 = OpCompositeConstruct %v3int %107 %107 %107 + %108 = OpExtInst %v3float %96 Ldexp %109 %110 + OpStore %defined %108 + %111 = OpLoad %mat3v4float %m0 + %112 = OpLoad %v3float %undefined + %113 = OpMatrixTimesVector %v4float %111 %112 + OpStore %v0 %113 + %114 = OpLoad %mat3v4float %m1 + %115 = OpLoad %v3float %undefined + %116 = OpMatrixTimesVector %v4float %114 %115 + OpStore %v1 %116 + %117 = OpLoad %mat3v4float %m0 + %118 = OpLoad %v3float %defined + %119 = OpMatrixTimesVector %v4float %117 %118 + OpStore %v2 %119 + %120 = OpLoad %mat3v4float %m1 + %121 = OpLoad %v3float %defined + %122 = OpMatrixTimesVector %v4float %120 %121 + OpStore %v3 %122 + %124 = OpAccessChain %_ptr_Function_float %v2 %uint_0 + %125 = OpLoad %float %124 + %126 = OpAccessChain %_ptr_Function_float %v3 %uint_0 + %127 = OpLoad %float %126 + %128 = OpFOrdGreaterThan %bool %125 %127 + OpSelectionMerge %130 None + OpBranchConditional %128 %131 %132 + %131 = OpLabel + %133 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %134 = OpLoad %int %133 + %136 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %137 = OpLoad %int %136 + %138 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %139 = OpLoad %int %138 + %140 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %141 = OpLoad %int %140 + %142 = OpConvertSToF %float %134 + %143 = OpConvertSToF %float %137 + %144 = OpConvertSToF %float %139 + %145 = OpConvertSToF %float %141 + %146 = OpCompositeConstruct %v4float %142 %143 %144 %145 + OpStore %x_GLF_color %146 + OpBranch %130 + %132 = OpLabel + %147 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %148 = OpLoad %int %147 + %149 = OpConvertSToF %float %148 + %150 = OpCompositeConstruct %v4float %149 %149 %149 %149 + OpStore %x_GLF_color %150 + OpBranch %130 + %130 = OpLabel + %151 = OpAccessChain %_ptr_Function_float %v0 %uint_0 + %152 = OpLoad %float %151 + %153 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %154 = OpLoad %float %153 + %155 = OpFOrdLessThan %bool %152 %154 + OpSelectionMerge %156 None + OpBranchConditional %155 %157 %156 + %157 = OpLabel + %159 = OpAccessChain %_ptr_Uniform_float %x_15 %uint_0 %int_0 + %160 = OpLoad %float %159 + %162 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + OpStore %162 %160 + OpBranch %156 + %156 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %163 +%tint_symbol = OpFunctionParameter %main_out + %167 = OpLabel + %168 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %168 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %170 = OpLabel + %171 = OpFunctionCall %void %main_1 + %173 = OpLoad %v4float %x_GLF_color + %174 = OpCompositeConstruct %main_out %173 + %172 = OpFunctionCall %void %tint_symbol_2 %174 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..e298a8c937 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-undefined-matrix-mul/0-opt.wgsl.expected.wgsl @@ -0,0 +1,92 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_15 : buf0; + +fn main_1() { + var m0 : mat3x4; + var m1 : mat3x4; + var undefined : vec3; + var defined : vec3; + var v0 : vec4; + var v1 : vec4; + var v2 : vec4; + var v3 : vec4; + let x_17 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_18 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_19 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_20 : i32 = x_6.x_GLF_uniform_int_values[10]; + let x_21 : i32 = x_6.x_GLF_uniform_int_values[7]; + let x_22 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_23 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_24 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[3]; + m0 = mat3x4(vec4(f32(x_17), f32(x_18), f32(x_19), 4.0), vec4(f32(x_20), f32(x_21), f32(x_22), 8.0), vec4(f32(x_23), f32(x_24), f32(x_25), f32(x_26))); + let x_27 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_104 : f32 = f32(x_27); + m1 = mat3x4(vec4(x_104, 0.0, 0.0, 0.0), vec4(0.0, x_104, 0.0, 0.0), vec4(0.0, 0.0, x_104, 0.0)); + undefined = ldexp(vec3(1.0, 1.0, 1.0), vec3(500, 500, 500)); + let x_28 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_111 : f32 = f32(x_28); + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + defined = ldexp(vec3(x_111, x_111, x_111), vec3(x_29, x_29, x_29)); + let x_116 : mat3x4 = m0; + let x_117 : vec3 = undefined; + v0 = (x_116 * x_117); + let x_119 : mat3x4 = m1; + let x_120 : vec3 = undefined; + v1 = (x_119 * x_120); + let x_122 : mat3x4 = m0; + let x_123 : vec3 = defined; + v2 = (x_122 * x_123); + let x_125 : mat3x4 = m1; + let x_126 : vec3 = defined; + v3 = (x_125 * x_126); + let x_129 : f32 = v2.x; + let x_131 : f32 = v3.x; + if ((x_129 > x_131)) { + let x_30 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[4]; + x_GLF_color = vec4(f32(x_30), f32(x_31), f32(x_32), f32(x_33)); + } else { + let x_34 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_146 : f32 = f32(x_34); + x_GLF_color = vec4(x_146, x_146, x_146, x_146); + } + let x_149 : f32 = v0.x; + let x_151 : f32 = v1.x; + if ((x_149 < x_151)) { + let x_156 : f32 = x_15.x_GLF_uniform_float_values[0]; + x_GLF_color.y = x_156; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm new file mode 100644 index 0000000000..7853f53d20 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm @@ -0,0 +1,100 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %v "v" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_100 = OpConstant %uint 100 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %28 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %v = OpVariable %_ptr_Function_v4float Function + %29 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %30 = OpLoad %int %29 + OpStore %i %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %37 = OpLoad %int %36 + %38 = OpSLessThan %bool %35 %37 + OpBranchConditional %38 %39 %32 + %39 = OpLabel + %40 = OpExtInst %v4float %1 UnpackUnorm4x8 %uint_100 + OpStore %v %40 + %41 = OpAccessChain %_ptr_Function_float %v %uint_0 + %42 = OpLoad %float %41 + %43 = OpConvertFToS %int %42 + %44 = OpLoad %int %i + %45 = OpSGreaterThan %bool %43 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %_GLF_color %51 + OpReturn + %46 = OpLabel + OpBranch %33 + %33 = OpLabel + %52 = OpLoad %int %i + %53 = OpIAdd %int %52 %int_1 + OpStore %i %53 + OpBranch %31 + %32 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %61 + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %56 %59 %62 %65 + OpStore %_GLF_color %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..7fc33ee60d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,58 @@ +float4 tint_unpack4x8unorm(uint param_0) { + uint j = param_0; + uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); + return float4(i) / 255.0; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + const int x_30 = asint(x_6[1].x); + i = x_30; + while (true) { + const int x_35 = i; + const int x_37 = asint(x_6[2].x); + if ((x_35 < x_37)) { + } else { + break; + } + v = tint_unpack4x8unorm(100u); + const float x_42 = v.x; + if ((int(x_42) > i)) { + const int x_49 = asint(x_6[1].x); + const float x_50 = float(x_49); + x_GLF_color = float4(x_50, x_50, x_50, x_50); + return; + } + { + i = (i + 1); + } + } + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_58 = asint(x_6[1].x); + const int x_61 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_64 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..5daa237480 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,62 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + float4 v = 0.0f; + int const x_30 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_30; + while (true) { + int const x_35 = i; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_35 < x_37)) { + } else { + break; + } + v = unpack_unorm4x8_to_float(100u); + float const x_42 = v.x; + int const x_44 = i; + if ((int(x_42) > x_44)) { + int const x_49 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_50 = float(x_49); + *(tint_symbol_4) = float4(x_50, x_50, x_50, x_50); + return; + } + { + int const x_52 = i; + i = (x_52 + 1); + } + } + int const x_55 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..1b6c2cfa9b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,138 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %43 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint_100 = OpConstant %uint 100 +%_ptr_Function_float = OpTypePointer Function %float + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %73 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %v = OpVariable %_ptr_Function_v4float Function %12 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %28 = OpLoad %int %27 + OpStore %i %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %i + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %36 = OpLoad %int %35 + %37 = OpSLessThan %bool %33 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %30 + %39 = OpLabel + %42 = OpExtInst %v4float %43 UnpackUnorm4x8 %uint_100 + OpStore %v %42 + %46 = OpAccessChain %_ptr_Function_float %v %uint_0 + %47 = OpLoad %float %46 + %48 = OpLoad %int %i + %49 = OpConvertFToS %int %47 + %50 = OpSGreaterThan %bool %49 %48 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %54 + %56 = OpCompositeConstruct %v4float %55 %55 %55 %55 + OpStore %x_GLF_color %56 + OpReturn + %51 = OpLabel + OpBranch %31 + %31 = OpLabel + %57 = OpLoad %int %i + %58 = OpIAdd %int %57 %int_1 + OpStore %i %58 + OpBranch %29 + %30 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %61 + %69 = OpConvertSToF %float %63 + %70 = OpConvertSToF %float %65 + %71 = OpConvertSToF %float %67 + %72 = OpCompositeConstruct %v4float %68 %69 %70 %71 + OpStore %x_GLF_color %72 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %73 +%tint_symbol = OpFunctionParameter %main_out + %77 = OpLabel + %78 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %78 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %80 = OpLabel + %81 = OpFunctionCall %void %main_1 + %83 = OpLoad %v4float %x_GLF_color + %84 = OpCompositeConstruct %main_out %83 + %82 = OpFunctionCall %void %tint_symbol_2 %84 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a67101bc93 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var v : vec4; + let x_30 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_30; + loop { + let x_35 : i32 = i; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_35 < x_37)) { + } else { + break; + } + v = unpack4x8unorm(100u); + let x_42 : f32 = v.x; + let x_44 : i32 = i; + if ((i32(x_42) > x_44)) { + let x_49 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_50 : f32 = f32(x_49); + x_GLF_color = vec4(x_50, x_50, x_50, x_50); + return; + } + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl new file mode 100644 index 0000000000..a67101bc93 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var v : vec4; + let x_30 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_30; + loop { + let x_35 : i32 = i; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_35 < x_37)) { + } else { + break; + } + v = unpack4x8unorm(100u); + let x_42 : f32 = v.x; + let x_44 : i32 = i; + if ((i32(x_42) > x_44)) { + let x_49 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_50 : f32 = f32(x_49); + x_GLF_color = vec4(x_50, x_50, x_50, x_50); + return; + } + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..7fc33ee60d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,58 @@ +float4 tint_unpack4x8unorm(uint param_0) { + uint j = param_0; + uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); + return float4(i) / 255.0; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + const int x_30 = asint(x_6[1].x); + i = x_30; + while (true) { + const int x_35 = i; + const int x_37 = asint(x_6[2].x); + if ((x_35 < x_37)) { + } else { + break; + } + v = tint_unpack4x8unorm(100u); + const float x_42 = v.x; + if ((int(x_42) > i)) { + const int x_49 = asint(x_6[1].x); + const float x_50 = float(x_49); + x_GLF_color = float4(x_50, x_50, x_50, x_50); + return; + } + { + i = (i + 1); + } + } + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_58 = asint(x_6[1].x); + const int x_61 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_64 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..5daa237480 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,62 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + float4 v = 0.0f; + int const x_30 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_30; + while (true) { + int const x_35 = i; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_35 < x_37)) { + } else { + break; + } + v = unpack_unorm4x8_to_float(100u); + float const x_42 = v.x; + int const x_44 = i; + if ((int(x_42) > x_44)) { + int const x_49 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_50 = float(x_49); + *(tint_symbol_4) = float4(x_50, x_50, x_50, x_50); + return; + } + { + int const x_52 = i; + i = (x_52 + 1); + } + } + int const x_55 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..1b6c2cfa9b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,138 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %43 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint_100 = OpConstant %uint 100 +%_ptr_Function_float = OpTypePointer Function %float + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %73 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %v = OpVariable %_ptr_Function_v4float Function %12 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %28 = OpLoad %int %27 + OpStore %i %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %i + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %36 = OpLoad %int %35 + %37 = OpSLessThan %bool %33 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %30 + %39 = OpLabel + %42 = OpExtInst %v4float %43 UnpackUnorm4x8 %uint_100 + OpStore %v %42 + %46 = OpAccessChain %_ptr_Function_float %v %uint_0 + %47 = OpLoad %float %46 + %48 = OpLoad %int %i + %49 = OpConvertFToS %int %47 + %50 = OpSGreaterThan %bool %49 %48 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %54 + %56 = OpCompositeConstruct %v4float %55 %55 %55 %55 + OpStore %x_GLF_color %56 + OpReturn + %51 = OpLabel + OpBranch %31 + %31 = OpLabel + %57 = OpLoad %int %i + %58 = OpIAdd %int %57 %int_1 + OpStore %i %58 + OpBranch %29 + %30 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %61 + %69 = OpConvertSToF %float %63 + %70 = OpConvertSToF %float %65 + %71 = OpConvertSToF %float %67 + %72 = OpCompositeConstruct %v4float %68 %69 %70 %71 + OpStore %x_GLF_color %72 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %73 +%tint_symbol = OpFunctionParameter %main_out + %77 = OpLabel + %78 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %78 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %80 = OpLabel + %81 = OpFunctionCall %void %main_1 + %83 = OpLoad %v4float %x_GLF_color + %84 = OpCompositeConstruct %main_out %83 + %82 = OpFunctionCall %void %tint_symbol_2 %84 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a67101bc93 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-apfloat-unpackunorm-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var v : vec4; + let x_30 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_30; + loop { + let x_35 : i32 = i; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_35 < x_37)) { + } else { + break; + } + v = unpack4x8unorm(100u); + let x_42 : f32 = v.x; + let x_44 : i32 = i; + if ((i32(x_42) > x_44)) { + let x_49 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_50 : f32 = f32(x_49); + x_GLF_color = vec4(x_50, x_50, x_50, x_50); + return; + } + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm new file mode 100644 index 0000000000..28c1c7a25a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm @@ -0,0 +1,133 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %arr "arr" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %a "a" + OpName %b "b" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %c "c" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3_0 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 +%_arr_int_uint_3_0 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3_0 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %16 + %38 = OpLabel + %arr = OpVariable %_ptr_Function__arr_int_uint_3 Function + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %c = OpVariable %_ptr_Function_int Function + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %40 = OpLoad %int %39 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpCompositeConstruct %_arr_int_uint_3 %40 %42 %44 + OpStore %arr %45 + %46 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Function_int %arr %47 + %49 = OpLoad %int %48 + OpStore %a %49 + %50 = OpLoad %int %a + %51 = OpISub %int %50 %int_1 + OpStore %b %51 + %52 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %53 = OpLoad %float %52 + %54 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpFOrdLessThan %bool %53 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + %59 = OpLoad %int %b + %60 = OpIAdd %int %59 %int_1 + OpStore %b %60 + OpBranch %57 + %57 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %62 = OpLoad %int %61 + OpStore %c %62 + %63 = OpLoad %int %c + %64 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %67 = OpLoad %int %66 + %68 = OpExtInst %int %1 SClamp %63 %65 %67 + %69 = OpLoad %int %b + %70 = OpAccessChain %_ptr_Function_int %arr %68 + OpStore %70 %69 + %71 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Function_int %arr %72 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Function_int %arr %77 + %79 = OpLoad %int %78 + %80 = OpConvertSToF %float %79 + %81 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Function_int %arr %82 + %84 = OpLoad %int %83 + %85 = OpConvertSToF %float %84 + %86 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Function_int %arr %87 + %89 = OpLoad %int %88 + %90 = OpConvertSToF %float %89 + %91 = OpCompositeConstruct %v4float %75 %80 %85 %90 + OpStore %_GLF_color %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..82c801a8dd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,68 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int arr[3] = (int[3])0; + int a = 0; + int b = 0; + int c = 0; + const int x_40 = asint(x_7[1].x); + const int x_42 = asint(x_7[1].x); + const int x_44 = asint(x_7[1].x); + const int tint_symbol_6[3] = {x_40, x_42, x_44}; + arr = tint_symbol_6; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_47 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const int x_49 = arr[x_47]; + a = x_49; + b = (a - 1); + const float x_53 = gl_FragCoord.x; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_11[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_53 < x_55)) { + b = (b + 1); + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_62 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + c = x_62; + const int x_63 = c; + const int x_65 = asint(x_7[1].x); + const int x_67 = asint(x_7[2].x); + arr[clamp(x_63, x_65, x_67)] = b; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_72 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_74 = arr[x_72]; + const int x_77 = asint(x_7[1].x); + const int x_79 = arr[x_77]; + const int x_82 = asint(x_7[1].x); + const int x_84 = arr[x_82]; + const int x_87 = asint(x_7[2].x); + const int x_89 = arr[x_87]; + x_GLF_color = float4(float(x_74), float(x_79), float(x_84), float(x_89)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..76666da7e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + int arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_11, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper_2 arr = {}; + int a = 0; + int b = 0; + int c = 0; + int const x_40 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_42 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_44 = x_7.x_GLF_uniform_int_values.arr[1].el; + tint_array_wrapper_2 const tint_symbol_4 = {.arr={x_40, x_42, x_44}}; + arr = tint_symbol_4; + int const x_47 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_49 = arr.arr[x_47]; + a = x_49; + int const x_50 = a; + b = (x_50 - 1); + float const x_53 = (*(tint_symbol_6)).x; + float const x_55 = x_11.x_GLF_uniform_float_values.arr[0].el; + if ((x_53 < x_55)) { + int const x_59 = b; + b = (x_59 + 1); + } + int const x_62 = x_7.x_GLF_uniform_int_values.arr[0].el; + c = x_62; + int const x_63 = c; + int const x_65 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_67 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_69 = b; + arr.arr[clamp(x_63, x_65, x_67)] = x_69; + int const x_72 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_74 = arr.arr[x_72]; + int const x_77 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_79 = arr.arr[x_77]; + int const x_82 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_84 = arr.arr[x_82]; + int const x_87 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_89 = arr.arr[x_87]; + *(tint_symbol_7) = float4(float(x_74), float(x_79), float(x_84), float(x_89)); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_7, x_11, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..5b91fa9f61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,173 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 111 +; Schema: 0 + OpCapability Shader + %75 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %arr "arr" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_3_0 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_arr_int_uint_3_0 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3_0 = OpTypePointer Function %_arr_int_uint_3_0 + %30 = OpConstantNull %_arr_int_uint_3_0 +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %98 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %arr = OpVariable %_ptr_Function__arr_int_uint_3_0 Function %30 + %a = OpVariable %_ptr_Function_int Function %33 + %b = OpVariable %_ptr_Function_int Function %33 + %c = OpVariable %_ptr_Function_int Function %33 + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %40 = OpLoad %int %39 + %41 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpCompositeConstruct %_arr_int_uint_3_0 %40 %42 %44 + OpStore %arr %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Function_int %arr %48 + %50 = OpLoad %int %49 + OpStore %a %50 + %51 = OpLoad %int %a + %52 = OpISub %int %51 %int_1 + OpStore %b %52 + %54 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %55 = OpLoad %float %54 + %57 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpFOrdLessThan %bool %55 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %62 %61 + %62 = OpLabel + %63 = OpLoad %int %b + %64 = OpIAdd %int %63 %int_1 + OpStore %b %64 + OpBranch %61 + %61 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %66 = OpLoad %int %65 + OpStore %c %66 + %67 = OpLoad %int %c + %68 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %69 = OpLoad %int %68 + %71 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %72 = OpLoad %int %71 + %73 = OpLoad %int %b + %74 = OpExtInst %int %75 SClamp %67 %69 %72 + %76 = OpAccessChain %_ptr_Function_int %arr %74 + OpStore %76 %73 + %77 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Function_int %arr %78 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Function_int %arr %82 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Function_int %arr %86 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Function_int %arr %90 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %80 + %94 = OpConvertSToF %float %84 + %95 = OpConvertSToF %float %88 + %96 = OpConvertSToF %float %92 + %97 = OpCompositeConstruct %v4float %93 %94 %95 %96 + OpStore %x_GLF_color %97 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %98 +%tint_symbol_1 = OpFunctionParameter %main_out + %102 = OpLabel + %103 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %103 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %105 = OpLabel + %106 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %106 + %107 = OpFunctionCall %void %main_1 + %109 = OpLoad %v4float %x_GLF_color + %110 = OpCompositeConstruct %main_out %109 + %108 = OpFunctionCall %void %tint_symbol_3 %110 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..eac5611fd9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,72 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var a : i32; + var b : i32; + var c : i32; + let x_40 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_42 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[1]; + arr = array(x_40, x_42, x_44); + let x_47 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_49 : i32 = arr[x_47]; + a = x_49; + let x_50 : i32 = a; + b = (x_50 - 1); + let x_53 : f32 = gl_FragCoord.x; + let x_55 : f32 = x_11.x_GLF_uniform_float_values[0]; + if ((x_53 < x_55)) { + let x_59 : i32 = b; + b = (x_59 + 1); + } + let x_62 : i32 = x_7.x_GLF_uniform_int_values[0]; + c = x_62; + let x_63 : i32 = c; + let x_65 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_67 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_69 : i32 = b; + arr[clamp(x_63, x_65, x_67)] = x_69; + let x_72 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_74 : i32 = arr[x_72]; + let x_77 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_79 : i32 = arr[x_77]; + let x_82 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_84 : i32 = arr[x_82]; + let x_87 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_89 : i32 = arr[x_87]; + x_GLF_color = vec4(f32(x_74), f32(x_79), f32(x_84), f32(x_89)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl new file mode 100644 index 0000000000..eac5611fd9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl @@ -0,0 +1,72 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var a : i32; + var b : i32; + var c : i32; + let x_40 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_42 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[1]; + arr = array(x_40, x_42, x_44); + let x_47 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_49 : i32 = arr[x_47]; + a = x_49; + let x_50 : i32 = a; + b = (x_50 - 1); + let x_53 : f32 = gl_FragCoord.x; + let x_55 : f32 = x_11.x_GLF_uniform_float_values[0]; + if ((x_53 < x_55)) { + let x_59 : i32 = b; + b = (x_59 + 1); + } + let x_62 : i32 = x_7.x_GLF_uniform_int_values[0]; + c = x_62; + let x_63 : i32 = c; + let x_65 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_67 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_69 : i32 = b; + arr[clamp(x_63, x_65, x_67)] = x_69; + let x_72 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_74 : i32 = arr[x_72]; + let x_77 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_79 : i32 = arr[x_77]; + let x_82 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_84 : i32 = arr[x_82]; + let x_87 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_89 : i32 = arr[x_87]; + x_GLF_color = vec4(f32(x_74), f32(x_79), f32(x_84), f32(x_89)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..82c801a8dd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,68 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int arr[3] = (int[3])0; + int a = 0; + int b = 0; + int c = 0; + const int x_40 = asint(x_7[1].x); + const int x_42 = asint(x_7[1].x); + const int x_44 = asint(x_7[1].x); + const int tint_symbol_6[3] = {x_40, x_42, x_44}; + arr = tint_symbol_6; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_47 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const int x_49 = arr[x_47]; + a = x_49; + b = (a - 1); + const float x_53 = gl_FragCoord.x; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_11[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_53 < x_55)) { + b = (b + 1); + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_62 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + c = x_62; + const int x_63 = c; + const int x_65 = asint(x_7[1].x); + const int x_67 = asint(x_7[2].x); + arr[clamp(x_63, x_65, x_67)] = b; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_72 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_74 = arr[x_72]; + const int x_77 = asint(x_7[1].x); + const int x_79 = arr[x_77]; + const int x_82 = asint(x_7[1].x); + const int x_84 = arr[x_82]; + const int x_87 = asint(x_7[2].x); + const int x_89 = arr[x_87]; + x_GLF_color = float4(float(x_74), float(x_79), float(x_84), float(x_89)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..76666da7e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + int arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_11, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper_2 arr = {}; + int a = 0; + int b = 0; + int c = 0; + int const x_40 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_42 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_44 = x_7.x_GLF_uniform_int_values.arr[1].el; + tint_array_wrapper_2 const tint_symbol_4 = {.arr={x_40, x_42, x_44}}; + arr = tint_symbol_4; + int const x_47 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_49 = arr.arr[x_47]; + a = x_49; + int const x_50 = a; + b = (x_50 - 1); + float const x_53 = (*(tint_symbol_6)).x; + float const x_55 = x_11.x_GLF_uniform_float_values.arr[0].el; + if ((x_53 < x_55)) { + int const x_59 = b; + b = (x_59 + 1); + } + int const x_62 = x_7.x_GLF_uniform_int_values.arr[0].el; + c = x_62; + int const x_63 = c; + int const x_65 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_67 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_69 = b; + arr.arr[clamp(x_63, x_65, x_67)] = x_69; + int const x_72 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_74 = arr.arr[x_72]; + int const x_77 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_79 = arr.arr[x_77]; + int const x_82 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_84 = arr.arr[x_82]; + int const x_87 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_89 = arr.arr[x_87]; + *(tint_symbol_7) = float4(float(x_74), float(x_79), float(x_84), float(x_89)); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_7, x_11, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5b91fa9f61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,173 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 111 +; Schema: 0 + OpCapability Shader + %75 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %arr "arr" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_3_0 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_arr_int_uint_3_0 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3_0 = OpTypePointer Function %_arr_int_uint_3_0 + %30 = OpConstantNull %_arr_int_uint_3_0 +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %98 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %arr = OpVariable %_ptr_Function__arr_int_uint_3_0 Function %30 + %a = OpVariable %_ptr_Function_int Function %33 + %b = OpVariable %_ptr_Function_int Function %33 + %c = OpVariable %_ptr_Function_int Function %33 + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %40 = OpLoad %int %39 + %41 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpCompositeConstruct %_arr_int_uint_3_0 %40 %42 %44 + OpStore %arr %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Function_int %arr %48 + %50 = OpLoad %int %49 + OpStore %a %50 + %51 = OpLoad %int %a + %52 = OpISub %int %51 %int_1 + OpStore %b %52 + %54 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %55 = OpLoad %float %54 + %57 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpFOrdLessThan %bool %55 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %62 %61 + %62 = OpLabel + %63 = OpLoad %int %b + %64 = OpIAdd %int %63 %int_1 + OpStore %b %64 + OpBranch %61 + %61 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %66 = OpLoad %int %65 + OpStore %c %66 + %67 = OpLoad %int %c + %68 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %69 = OpLoad %int %68 + %71 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %72 = OpLoad %int %71 + %73 = OpLoad %int %b + %74 = OpExtInst %int %75 SClamp %67 %69 %72 + %76 = OpAccessChain %_ptr_Function_int %arr %74 + OpStore %76 %73 + %77 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Function_int %arr %78 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Function_int %arr %82 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Function_int %arr %86 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Function_int %arr %90 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %80 + %94 = OpConvertSToF %float %84 + %95 = OpConvertSToF %float %88 + %96 = OpConvertSToF %float %92 + %97 = OpCompositeConstruct %v4float %93 %94 %95 %96 + OpStore %x_GLF_color %97 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %98 +%tint_symbol_1 = OpFunctionParameter %main_out + %102 = OpLabel + %103 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %103 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %105 = OpLabel + %106 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %106 + %107 = OpFunctionCall %void %main_1 + %109 = OpLoad %v4float %x_GLF_color + %110 = OpCompositeConstruct %main_out %109 + %108 = OpFunctionCall %void %tint_symbol_3 %110 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..eac5611fd9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-accesses-clamp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,72 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var a : i32; + var b : i32; + var c : i32; + let x_40 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_42 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[1]; + arr = array(x_40, x_42, x_44); + let x_47 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_49 : i32 = arr[x_47]; + a = x_49; + let x_50 : i32 = a; + b = (x_50 - 1); + let x_53 : f32 = gl_FragCoord.x; + let x_55 : f32 = x_11.x_GLF_uniform_float_values[0]; + if ((x_53 < x_55)) { + let x_59 : i32 = b; + b = (x_59 + 1); + } + let x_62 : i32 = x_7.x_GLF_uniform_int_values[0]; + c = x_62; + let x_63 : i32 = c; + let x_65 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_67 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_69 : i32 = b; + arr[clamp(x_63, x_65, x_67)] = x_69; + let x_72 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_74 : i32 = arr[x_72]; + let x_77 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_79 : i32 = arr[x_77]; + let x_82 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_84 : i32 = arr[x_82]; + let x_87 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_89 : i32 = arr[x_87]; + x_GLF_color = vec4(f32(x_74), f32(x_79), f32(x_84), f32(x_89)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm new file mode 100644 index 0000000000..973f76c03c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm @@ -0,0 +1,401 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %arr0 "arr0" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %arr1 "arr1" + OpName %a "a" + OpName %limiter0 "limiter0" + OpName %limiter1 "limiter1" + OpName %b "b" + OpName %limiter2 "limiter2" + OpName %limiter3 "limiter3" + OpName %d "d" + OpName %ref0 "ref0" + OpName %ref1 "ref1" + OpName %_GLF_color "_GLF_color" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "one" + OpName %__0 "" + OpDecorate %_arr_int_uint_20 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %22 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %uint_20 = OpConstant %uint 20 +%_arr_int_uint_20 = OpTypeArray %int %uint_20 + %buf0 = OpTypeStruct %_arr_int_uint_20 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_14 = OpConstant %int 14 + %int_11 = OpConstant %int 11 + %int_18 = OpConstant %int 18 + %int_19 = OpConstant %int 19 +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %buf1 = OpTypeStruct %int +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %main = OpFunction %void None %22 + %57 = OpLabel + %arr0 = OpVariable %_ptr_Function__arr_int_uint_10 Function + %arr1 = OpVariable %_ptr_Function__arr_int_uint_10 Function + %a = OpVariable %_ptr_Function_int Function + %limiter0 = OpVariable %_ptr_Function_int Function + %limiter1 = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %limiter2 = OpVariable %_ptr_Function_int Function + %limiter3 = OpVariable %_ptr_Function_int Function + %d = OpVariable %_ptr_Function_int Function + %ref0 = OpVariable %_ptr_Function__arr_int_uint_10 Function + %ref1 = OpVariable %_ptr_Function__arr_int_uint_10 Function + %i = OpVariable %_ptr_Function_int Function + %58 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_7 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_9 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_10 + %77 = OpLoad %int %76 + %78 = OpCompositeConstruct %_arr_int_uint_10 %59 %61 %63 %65 %67 %69 %71 %73 %75 %77 + OpStore %arr0 %78 + %79 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_12 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_15 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_16 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_17 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_13 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_14 + %92 = OpLoad %int %91 + %93 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_11 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_18 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_19 + %98 = OpLoad %int %97 + %99 = OpCompositeConstruct %_arr_int_uint_10 %80 %82 %84 %86 %88 %90 %92 %94 %96 %98 + OpStore %arr1 %99 + %100 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %101 = OpLoad %int %100 + OpStore %a %101 + OpBranch %102 + %102 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %int %a + %107 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %108 = OpLoad %int %107 + %109 = OpSLessThan %bool %106 %108 + OpBranchConditional %109 %110 %103 + %110 = OpLabel + %111 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %112 = OpLoad %int %111 + OpStore %limiter0 %112 + OpBranch %113 + %113 = OpLabel + OpLoopMerge %114 %115 None + OpBranch %116 + %116 = OpLabel + %117 = OpLoad %int %limiter0 + %118 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %119 = OpLoad %int %118 + %120 = OpSLessThan %bool %117 %119 + OpBranchConditional %120 %121 %114 + %121 = OpLabel + %122 = OpLoad %int %limiter0 + %123 = OpIAdd %int %122 %int_1 + OpStore %limiter0 %123 + %124 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %125 = OpLoad %int %124 + OpStore %limiter1 %125 + %126 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %127 = OpLoad %int %126 + OpStore %b %127 + OpBranch %128 + %128 = OpLabel + OpLoopMerge %129 %130 None + OpBranch %131 + %131 = OpLabel + %132 = OpLoad %int %b + %133 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %134 = OpLoad %int %133 + %135 = OpSLessThan %bool %132 %134 + OpBranchConditional %135 %136 %129 + %136 = OpLabel + %137 = OpLoad %int %limiter1 + %138 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %139 = OpLoad %int %138 + %140 = OpSGreaterThan %bool %137 %139 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + OpBranch %129 + %141 = OpLabel + %143 = OpLoad %int %limiter1 + %144 = OpIAdd %int %143 %int_1 + OpStore %limiter1 %144 + %145 = OpLoad %int %b + %146 = OpLoad %int %a + %147 = OpAccessChain %_ptr_Function_int %arr1 %146 + %148 = OpLoad %int %147 + %149 = OpAccessChain %_ptr_Function_int %arr0 %145 + OpStore %149 %148 + OpBranch %130 + %130 = OpLabel + %150 = OpLoad %int %b + %151 = OpIAdd %int %150 %int_1 + OpStore %b %151 + OpBranch %128 + %129 = OpLabel + OpBranch %115 + %115 = OpLabel + OpBranch %113 + %114 = OpLabel + OpStore %limiter2 %int_0 + OpBranch %152 + %152 = OpLabel + OpLoopMerge %153 %154 None + OpBranch %155 + %155 = OpLabel + %156 = OpLoad %int %limiter2 + %157 = OpSLessThan %bool %156 %int_5 + OpBranchConditional %157 %158 %153 + %158 = OpLabel + %159 = OpLoad %int %limiter2 + %160 = OpIAdd %int %159 %int_1 + OpStore %limiter2 %160 + %161 = OpAccessChain %_ptr_Function_int %arr1 %int_1 + %162 = OpLoad %int %161 + %163 = OpAccessChain %_ptr_Function_int %arr0 %int_1 + OpStore %163 %162 + OpBranch %154 + %154 = OpLabel + OpBranch %152 + %153 = OpLabel + OpBranch %164 + %164 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + OpStore %limiter3 %int_0 + OpStore %d %int_0 + OpBranch %168 + %168 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %172 = OpLoad %int %d + %173 = OpSLessThan %bool %172 %int_10 + OpBranchConditional %173 %174 %169 + %174 = OpLabel + %175 = OpLoad %int %limiter3 + %176 = OpSGreaterThan %bool %175 %int_4 + OpSelectionMerge %177 None + OpBranchConditional %176 %178 %177 + %178 = OpLabel + OpBranch %169 + %177 = OpLabel + %179 = OpLoad %int %limiter3 + %180 = OpIAdd %int %179 %int_1 + OpStore %limiter3 %180 + %181 = OpLoad %int %d + %182 = OpLoad %int %d + %183 = OpAccessChain %_ptr_Function_int %arr0 %182 + %184 = OpLoad %int %183 + %185 = OpAccessChain %_ptr_Function_int %arr1 %181 + OpStore %185 %184 + OpBranch %170 + %170 = OpLabel + %186 = OpLoad %int %d + %187 = OpIAdd %int %186 %int_1 + OpStore %d %187 + OpBranch %168 + %169 = OpLabel + OpBranch %166 + %166 = OpLabel + %188 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %189 = OpLoad %int %188 + %190 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %191 = OpLoad %int %190 + %192 = OpIEqual %bool %189 %191 + OpBranchConditional %192 %164 %165 + %165 = OpLabel + OpBranch %104 + %104 = OpLabel + %193 = OpLoad %int %a + %194 = OpIAdd %int %193 %int_1 + OpStore %a %194 + OpBranch %102 + %103 = OpLabel + %195 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_11 + %196 = OpLoad %int %195 + %197 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_12 + %198 = OpLoad %int %197 + %199 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_11 + %200 = OpLoad %int %199 + %201 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %202 = OpLoad %int %201 + %203 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %204 = OpLoad %int %203 + %205 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_7 + %206 = OpLoad %int %205 + %207 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %208 = OpLoad %int %207 + %209 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_9 + %210 = OpLoad %int %209 + %211 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %212 = OpLoad %int %211 + %213 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_10 + %214 = OpLoad %int %213 + %215 = OpCompositeConstruct %_arr_int_uint_10 %196 %198 %200 %202 %204 %206 %208 %210 %212 %214 + OpStore %ref0 %215 + %216 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_11 + %217 = OpLoad %int %216 + %218 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_12 + %219 = OpLoad %int %218 + %220 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_11 + %221 = OpLoad %int %220 + %222 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %223 = OpLoad %int %222 + %224 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %225 = OpLoad %int %224 + %226 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_13 + %227 = OpLoad %int %226 + %228 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_14 + %229 = OpLoad %int %228 + %230 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_11 + %231 = OpLoad %int %230 + %232 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_18 + %233 = OpLoad %int %232 + %234 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_19 + %235 = OpLoad %int %234 + %236 = OpCompositeConstruct %_arr_int_uint_10 %217 %219 %221 %223 %225 %227 %229 %231 %233 %235 + OpStore %ref1 %236 + %237 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %238 = OpLoad %int %237 + %239 = OpConvertSToF %float %238 + %240 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %241 = OpLoad %int %240 + %242 = OpConvertSToF %float %241 + %243 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %244 = OpLoad %int %243 + %245 = OpConvertSToF %float %244 + %246 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %247 = OpLoad %int %246 + %248 = OpConvertSToF %float %247 + %249 = OpCompositeConstruct %v4float %239 %242 %245 %248 + OpStore %_GLF_color %249 + %250 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %251 = OpLoad %int %250 + OpStore %i %251 + OpBranch %252 + %252 = OpLabel + OpLoopMerge %253 %254 None + OpBranch %255 + %255 = OpLabel + %256 = OpLoad %int %i + %257 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %258 = OpLoad %int %257 + %259 = OpSLessThan %bool %256 %258 + OpBranchConditional %259 %260 %253 + %260 = OpLabel + %261 = OpLoad %int %i + %262 = OpAccessChain %_ptr_Function_int %arr0 %261 + %263 = OpLoad %int %262 + %264 = OpLoad %int %i + %265 = OpAccessChain %_ptr_Function_int %ref0 %264 + %266 = OpLoad %int %265 + %267 = OpINotEqual %bool %263 %266 + %268 = OpLogicalNot %bool %267 + OpSelectionMerge %269 None + OpBranchConditional %268 %270 %269 + %270 = OpLabel + %271 = OpLoad %int %i + %272 = OpAccessChain %_ptr_Function_int %arr1 %271 + %273 = OpLoad %int %272 + %274 = OpLoad %int %i + %275 = OpAccessChain %_ptr_Function_int %ref1 %274 + %276 = OpLoad %int %275 + %277 = OpINotEqual %bool %273 %276 + OpBranch %269 + %269 = OpLabel + %278 = OpPhi %bool %267 %260 %277 %270 + OpSelectionMerge %279 None + OpBranchConditional %278 %280 %279 + %280 = OpLabel + %281 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %282 = OpLoad %int %281 + %283 = OpConvertSToF %float %282 + %284 = OpCompositeConstruct %v4float %283 %283 %283 %283 + OpStore %_GLF_color %284 + OpBranch %279 + %279 = OpLabel + OpBranch %254 + %254 = OpLabel + %285 = OpLoad %int %i + %286 = OpIAdd %int %285 %int_1 + OpStore %i %286 + OpBranch %252 + %253 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..de01a1a640 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.hlsl @@ -0,0 +1,204 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[20]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_19 : register(b1, space0) { + uint4 x_19[1]; +}; + +void main_1() { + int arr0[10] = (int[10])0; + int arr1[10] = (int[10])0; + int a = 0; + int limiter0 = 0; + int limiter1 = 0; + int b = 0; + int limiter2 = 0; + int limiter3 = 0; + int d = 0; + int ref0[10] = (int[10])0; + int ref1[10] = (int[10])0; + int i = 0; + const int x_59 = asint(x_6[3].x); + const int x_61 = asint(x_6[2].x); + const int x_63 = asint(x_6[4].x); + const int x_65 = asint(x_6[5].x); + const int x_67 = asint(x_6[6].x); + const int x_69 = asint(x_6[7].x); + const int x_71 = asint(x_6[8].x); + const int x_73 = asint(x_6[9].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_75 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_77 = asint(x_6[10].x); + const int tint_symbol_3[10] = {x_59, x_61, x_63, x_65, x_67, x_69, x_71, x_73, x_75, x_77}; + arr0 = tint_symbol_3; + const int x_80 = asint(x_6[1].x); + const int x_82 = asint(x_6[12].x); + const int x_84 = asint(x_6[15].x); + const int x_86 = asint(x_6[16].x); + const int x_88 = asint(x_6[17].x); + const int x_90 = asint(x_6[13].x); + const int x_92 = asint(x_6[14].x); + const int x_94 = asint(x_6[11].x); + const int x_96 = asint(x_6[18].x); + const int x_98 = asint(x_6[19].x); + const int tint_symbol_4[10] = {x_80, x_82, x_84, x_86, x_88, x_90, x_92, x_94, x_96, x_98}; + arr1 = tint_symbol_4; + const int x_101 = asint(x_6[8].x); + a = x_101; + while (true) { + const int x_106 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_108 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_106 < x_108)) { + } else { + break; + } + const int x_112 = asint(x_6[3].x); + limiter0 = x_112; + while (true) { + const int x_117 = limiter0; + const int x_119 = asint(x_6[4].x); + if ((x_117 < x_119)) { + } else { + break; + } + limiter0 = (limiter0 + 1); + const int x_125 = asint(x_6[2].x); + limiter1 = x_125; + const int x_127 = asint(x_6[3].x); + b = x_127; + while (true) { + const int x_132 = b; + const int x_134 = asint(x_6[1].x); + if ((x_132 < x_134)) { + } else { + break; + } + const int x_137 = limiter1; + const int x_139 = asint(x_6[5].x); + if ((x_137 > x_139)) { + break; + } + limiter1 = (limiter1 + 1); + const int x_145 = b; + const int x_148 = arr1[a]; + arr0[x_145] = x_148; + { + b = (b + 1); + } + } + } + limiter2 = 0; + while (true) { + if ((limiter2 < 5)) { + } else { + break; + } + limiter2 = (limiter2 + 1); + const int x_162 = arr1[1]; + arr0[1] = x_162; + } + while (true) { + limiter3 = 0; + d = 0; + { + for(; (d < 10); d = (d + 1)) { + if ((limiter3 > 4)) { + break; + } + limiter3 = (limiter3 + 1); + const int x_181 = d; + const int x_184 = arr0[d]; + arr1[x_181] = x_184; + } + } + { + const int x_189 = asint(x_6[2].x); + const int x_191 = asint(x_6[3].x); + if ((x_189 == x_191)) { + } else { + break; + } + } + } + { + a = (a + 1); + } + } + const int x_196 = asint(x_6[11].x); + const int x_198 = asint(x_6[12].x); + const int x_200 = asint(x_6[11].x); + const int x_202 = asint(x_6[5].x); + const int x_204 = asint(x_6[6].x); + const int x_206 = asint(x_6[7].x); + const int x_208 = asint(x_6[8].x); + const int x_210 = asint(x_6[9].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_212 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_214 = asint(x_6[10].x); + const int tint_symbol_5[10] = {x_196, x_198, x_200, x_202, x_204, x_206, x_208, x_210, x_212, x_214}; + ref0 = tint_symbol_5; + const int x_217 = asint(x_6[11].x); + const int x_219 = asint(x_6[12].x); + const int x_221 = asint(x_6[11].x); + const int x_223 = asint(x_6[5].x); + const int x_225 = asint(x_6[6].x); + const int x_227 = asint(x_6[13].x); + const int x_229 = asint(x_6[14].x); + const int x_231 = asint(x_6[11].x); + const int x_233 = asint(x_6[18].x); + const int x_235 = asint(x_6[19].x); + const int tint_symbol_6[10] = {x_217, x_219, x_221, x_223, x_225, x_227, x_229, x_231, x_233, x_235}; + ref1 = tint_symbol_6; + const int x_238 = asint(x_6[2].x); + const int x_241 = asint(x_6[3].x); + const int x_244 = asint(x_6[3].x); + const int x_247 = asint(x_6[2].x); + x_GLF_color = float4(float(x_238), float(x_241), float(x_244), float(x_247)); + const int x_251 = asint(x_6[3].x); + i = x_251; + while (true) { + bool x_277 = false; + bool x_278_phi = false; + const int x_256 = i; + const int x_258 = asint(x_6[1].x); + if ((x_256 < x_258)) { + } else { + break; + } + const int x_263 = arr0[i]; + const int x_266 = ref0[i]; + const bool x_267 = (x_263 != x_266); + x_278_phi = x_267; + if (!(x_267)) { + const int x_273 = arr1[i]; + const int x_276 = ref1[i]; + x_277 = (x_273 != x_276); + x_278_phi = x_277; + } + if (x_278_phi) { + const int x_282 = asint(x_6[3].x); + const float x_283 = float(x_282); + x_GLF_color = float4(x_283, x_283, x_283, x_283); + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_7 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..417083de2b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.msl @@ -0,0 +1,237 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[20]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct buf1 { + /* 0x0000 */ int one; +}; +struct tint_array_wrapper_1 { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_8) { + tint_array_wrapper_1 arr0 = {}; + tint_array_wrapper_1 arr1 = {}; + int a = 0; + int limiter0 = 0; + int limiter1 = 0; + int b = 0; + int limiter2 = 0; + int limiter3 = 0; + int d = 0; + tint_array_wrapper_1 ref0 = {}; + tint_array_wrapper_1 ref1 = {}; + int i = 0; + int const x_59 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_65 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_67 = x_6.x_GLF_uniform_int_values.arr[6].el; + int const x_69 = x_6.x_GLF_uniform_int_values.arr[7].el; + int const x_71 = x_6.x_GLF_uniform_int_values.arr[8].el; + int const x_73 = x_6.x_GLF_uniform_int_values.arr[9].el; + int const x_75 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_77 = x_6.x_GLF_uniform_int_values.arr[10].el; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_59, x_61, x_63, x_65, x_67, x_69, x_71, x_73, x_75, x_77}}; + arr0 = tint_symbol_3; + int const x_80 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_82 = x_6.x_GLF_uniform_int_values.arr[12].el; + int const x_84 = x_6.x_GLF_uniform_int_values.arr[15].el; + int const x_86 = x_6.x_GLF_uniform_int_values.arr[16].el; + int const x_88 = x_6.x_GLF_uniform_int_values.arr[17].el; + int const x_90 = x_6.x_GLF_uniform_int_values.arr[13].el; + int const x_92 = x_6.x_GLF_uniform_int_values.arr[14].el; + int const x_94 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_96 = x_6.x_GLF_uniform_int_values.arr[18].el; + int const x_98 = x_6.x_GLF_uniform_int_values.arr[19].el; + tint_array_wrapper_1 const tint_symbol_4 = {.arr={x_80, x_82, x_84, x_86, x_88, x_90, x_92, x_94, x_96, x_98}}; + arr1 = tint_symbol_4; + int const x_101 = x_6.x_GLF_uniform_int_values.arr[8].el; + a = x_101; + while (true) { + int const x_106 = a; + int const x_108 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_106 < x_108)) { + } else { + break; + } + int const x_112 = x_6.x_GLF_uniform_int_values.arr[3].el; + limiter0 = x_112; + while (true) { + int const x_117 = limiter0; + int const x_119 = x_6.x_GLF_uniform_int_values.arr[4].el; + if ((x_117 < x_119)) { + } else { + break; + } + int const x_122 = limiter0; + limiter0 = (x_122 + 1); + int const x_125 = x_6.x_GLF_uniform_int_values.arr[2].el; + limiter1 = x_125; + int const x_127 = x_6.x_GLF_uniform_int_values.arr[3].el; + b = x_127; + while (true) { + int const x_132 = b; + int const x_134 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_132 < x_134)) { + } else { + break; + } + int const x_137 = limiter1; + int const x_139 = x_6.x_GLF_uniform_int_values.arr[5].el; + if ((x_137 > x_139)) { + break; + } + int const x_143 = limiter1; + limiter1 = (x_143 + 1); + int const x_145 = b; + int const x_146 = a; + int const x_148 = arr1.arr[x_146]; + arr0.arr[x_145] = x_148; + { + int const x_150 = b; + b = (x_150 + 1); + } + } + } + limiter2 = 0; + while (true) { + int const x_156 = limiter2; + if ((x_156 < 5)) { + } else { + break; + } + int const x_159 = limiter2; + limiter2 = (x_159 + 1); + int const x_162 = arr1.arr[1]; + arr0.arr[1] = x_162; + } + while (true) { + limiter3 = 0; + d = 0; + while (true) { + int const x_172 = d; + if ((x_172 < 10)) { + } else { + break; + } + int const x_175 = limiter3; + if ((x_175 > 4)) { + break; + } + int const x_179 = limiter3; + limiter3 = (x_179 + 1); + int const x_181 = d; + int const x_182 = d; + int const x_184 = arr0.arr[x_182]; + arr1.arr[x_181] = x_184; + { + int const x_186 = d; + d = (x_186 + 1); + } + } + { + int const x_189 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_191 = x_6.x_GLF_uniform_int_values.arr[3].el; + if ((x_189 == x_191)) { + } else { + break; + } + } + } + { + int const x_193 = a; + a = (x_193 + 1); + } + } + int const x_196 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_198 = x_6.x_GLF_uniform_int_values.arr[12].el; + int const x_200 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_202 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_204 = x_6.x_GLF_uniform_int_values.arr[6].el; + int const x_206 = x_6.x_GLF_uniform_int_values.arr[7].el; + int const x_208 = x_6.x_GLF_uniform_int_values.arr[8].el; + int const x_210 = x_6.x_GLF_uniform_int_values.arr[9].el; + int const x_212 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_214 = x_6.x_GLF_uniform_int_values.arr[10].el; + tint_array_wrapper_1 const tint_symbol_5 = {.arr={x_196, x_198, x_200, x_202, x_204, x_206, x_208, x_210, x_212, x_214}}; + ref0 = tint_symbol_5; + int const x_217 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_219 = x_6.x_GLF_uniform_int_values.arr[12].el; + int const x_221 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_223 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_225 = x_6.x_GLF_uniform_int_values.arr[6].el; + int const x_227 = x_6.x_GLF_uniform_int_values.arr[13].el; + int const x_229 = x_6.x_GLF_uniform_int_values.arr[14].el; + int const x_231 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_233 = x_6.x_GLF_uniform_int_values.arr[18].el; + int const x_235 = x_6.x_GLF_uniform_int_values.arr[19].el; + tint_array_wrapper_1 const tint_symbol_6 = {.arr={x_217, x_219, x_221, x_223, x_225, x_227, x_229, x_231, x_233, x_235}}; + ref1 = tint_symbol_6; + int const x_238 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_241 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_244 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_247 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_8) = float4(float(x_238), float(x_241), float(x_244), float(x_247)); + int const x_251 = x_6.x_GLF_uniform_int_values.arr[3].el; + i = x_251; + while (true) { + bool x_277 = false; + bool x_278_phi = false; + int const x_256 = i; + int const x_258 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_256 < x_258)) { + } else { + break; + } + int const x_261 = i; + int const x_263 = arr0.arr[x_261]; + int const x_264 = i; + int const x_266 = ref0.arr[x_264]; + bool const x_267 = (x_263 != x_266); + x_278_phi = x_267; + if (!(x_267)) { + int const x_271 = i; + int const x_273 = arr1.arr[x_271]; + int const x_274 = i; + int const x_276 = ref1.arr[x_274]; + x_277 = (x_273 != x_276); + x_278_phi = x_277; + } + bool const x_278 = x_278_phi; + if (x_278) { + int const x_282 = x_6.x_GLF_uniform_int_values.arr[3].el; + float const x_283 = float(x_282); + *(tint_symbol_8) = float4(x_283, x_283, x_283, x_283); + } + { + int const x_285 = i; + i = (x_285 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + main_1(x_6, &(tint_symbol_9)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_1 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..db432fcac2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.spvasm @@ -0,0 +1,489 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 324 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "one" + OpName %x_19 "x_19" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %arr0 "arr0" + OpName %arr1 "arr1" + OpName %a "a" + OpName %limiter0 "limiter0" + OpName %limiter1 "limiter1" + OpName %b "b" + OpName %limiter2 "limiter2" + OpName %limiter3 "limiter3" + OpName %d "d" + OpName %ref0 "ref0" + OpName %ref1 "ref1" + OpName %i "i" + OpName %x_277 "x_277" + OpName %x_278_phi "x_278_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_20 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_19 NonWritable + OpDecorate %x_19 DescriptorSet 0 + OpDecorate %x_19 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_20 = OpConstant %uint 20 +%_arr_int_uint_20 = OpTypeArray %int %uint_20 + %buf0 = OpTypeStruct %_arr_int_uint_20 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 + %buf1 = OpTypeStruct %int +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_19 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %26 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_14 = OpConstant %int 14 + %int_11 = OpConstant %int 11 + %int_18 = OpConstant %int 18 + %int_19 = OpConstant %int 19 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %276 = OpConstantNull %bool + %main_out = OpTypeStruct %v4float + %312 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %arr0 = OpVariable %_ptr_Function__arr_int_uint_10 Function %26 + %arr1 = OpVariable %_ptr_Function__arr_int_uint_10 Function %26 + %a = OpVariable %_ptr_Function_int Function %30 + %limiter0 = OpVariable %_ptr_Function_int Function %30 + %limiter1 = OpVariable %_ptr_Function_int Function %30 + %b = OpVariable %_ptr_Function_int Function %30 + %limiter2 = OpVariable %_ptr_Function_int Function %30 + %limiter3 = OpVariable %_ptr_Function_int Function %30 + %d = OpVariable %_ptr_Function_int Function %30 + %ref0 = OpVariable %_ptr_Function__arr_int_uint_10 Function %26 + %ref1 = OpVariable %_ptr_Function__arr_int_uint_10 Function %26 + %i = OpVariable %_ptr_Function_int Function %30 + %x_277 = OpVariable %_ptr_Function_bool Function %276 + %x_278_phi = OpVariable %_ptr_Function_bool Function %276 + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %44 = OpLoad %int %43 + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %47 = OpLoad %int %46 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %50 = OpLoad %int %49 + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %53 = OpLoad %int %52 + %55 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %56 = OpLoad %int %55 + %58 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_7 + %59 = OpLoad %int %58 + %61 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_8 + %62 = OpLoad %int %61 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %65 = OpLoad %int %64 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %68 = OpLoad %int %67 + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_10 + %71 = OpLoad %int %70 + %72 = OpCompositeConstruct %_arr_int_uint_10 %44 %47 %50 %53 %56 %59 %62 %65 %68 %71 + OpStore %arr0 %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %75 = OpLoad %int %74 + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_12 + %78 = OpLoad %int %77 + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_15 + %81 = OpLoad %int %80 + %83 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_16 + %84 = OpLoad %int %83 + %86 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_17 + %87 = OpLoad %int %86 + %89 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_13 + %90 = OpLoad %int %89 + %92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_14 + %93 = OpLoad %int %92 + %95 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %96 = OpLoad %int %95 + %98 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_18 + %99 = OpLoad %int %98 + %101 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_19 + %102 = OpLoad %int %101 + %103 = OpCompositeConstruct %_arr_int_uint_10 %75 %78 %81 %84 %87 %90 %93 %96 %99 %102 + OpStore %arr1 %103 + %104 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_8 + %105 = OpLoad %int %104 + OpStore %a %105 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %110 = OpLoad %int %a + %111 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %112 = OpLoad %int %111 + %113 = OpSLessThan %bool %110 %112 + OpSelectionMerge %115 None + OpBranchConditional %113 %116 %117 + %116 = OpLabel + OpBranch %115 + %117 = OpLabel + OpBranch %107 + %115 = OpLabel + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %119 = OpLoad %int %118 + OpStore %limiter0 %119 + OpBranch %120 + %120 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %int %limiter0 + %125 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %126 = OpLoad %int %125 + %127 = OpSLessThan %bool %124 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %130 + %129 = OpLabel + OpBranch %128 + %130 = OpLabel + OpBranch %121 + %128 = OpLabel + %131 = OpLoad %int %limiter0 + %132 = OpIAdd %int %131 %int_1 + OpStore %limiter0 %132 + %133 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %134 = OpLoad %int %133 + OpStore %limiter1 %134 + %135 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %136 = OpLoad %int %135 + OpStore %b %136 + OpBranch %137 + %137 = OpLabel + OpLoopMerge %138 %139 None + OpBranch %140 + %140 = OpLabel + %141 = OpLoad %int %b + %142 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %143 = OpLoad %int %142 + %144 = OpSLessThan %bool %141 %143 + OpSelectionMerge %145 None + OpBranchConditional %144 %146 %147 + %146 = OpLabel + OpBranch %145 + %147 = OpLabel + OpBranch %138 + %145 = OpLabel + %148 = OpLoad %int %limiter1 + %149 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %150 = OpLoad %int %149 + %151 = OpSGreaterThan %bool %148 %150 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %152 + %153 = OpLabel + OpBranch %138 + %152 = OpLabel + %154 = OpLoad %int %limiter1 + %155 = OpIAdd %int %154 %int_1 + OpStore %limiter1 %155 + %156 = OpLoad %int %b + %157 = OpLoad %int %a + %158 = OpAccessChain %_ptr_Function_int %arr1 %157 + %159 = OpLoad %int %158 + %160 = OpAccessChain %_ptr_Function_int %arr0 %156 + OpStore %160 %159 + OpBranch %139 + %139 = OpLabel + %161 = OpLoad %int %b + %162 = OpIAdd %int %161 %int_1 + OpStore %b %162 + OpBranch %137 + %138 = OpLabel + OpBranch %122 + %122 = OpLabel + OpBranch %120 + %121 = OpLabel + OpStore %limiter2 %int_0 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %164 %165 None + OpBranch %166 + %166 = OpLabel + %167 = OpLoad %int %limiter2 + %168 = OpSLessThan %bool %167 %int_5 + OpSelectionMerge %169 None + OpBranchConditional %168 %170 %171 + %170 = OpLabel + OpBranch %169 + %171 = OpLabel + OpBranch %164 + %169 = OpLabel + %172 = OpLoad %int %limiter2 + %173 = OpIAdd %int %172 %int_1 + OpStore %limiter2 %173 + %174 = OpAccessChain %_ptr_Function_int %arr1 %int_1 + %175 = OpLoad %int %174 + %176 = OpAccessChain %_ptr_Function_int %arr0 %int_1 + OpStore %176 %175 + OpBranch %165 + %165 = OpLabel + OpBranch %163 + %164 = OpLabel + OpBranch %177 + %177 = OpLabel + OpLoopMerge %178 %179 None + OpBranch %180 + %180 = OpLabel + OpStore %limiter3 %int_0 + OpStore %d %int_0 + OpBranch %181 + %181 = OpLabel + OpLoopMerge %182 %183 None + OpBranch %184 + %184 = OpLabel + %185 = OpLoad %int %d + %186 = OpSLessThan %bool %185 %int_10 + OpSelectionMerge %187 None + OpBranchConditional %186 %188 %189 + %188 = OpLabel + OpBranch %187 + %189 = OpLabel + OpBranch %182 + %187 = OpLabel + %190 = OpLoad %int %limiter3 + %191 = OpSGreaterThan %bool %190 %int_4 + OpSelectionMerge %192 None + OpBranchConditional %191 %193 %192 + %193 = OpLabel + OpBranch %182 + %192 = OpLabel + %194 = OpLoad %int %limiter3 + %195 = OpIAdd %int %194 %int_1 + OpStore %limiter3 %195 + %196 = OpLoad %int %d + %197 = OpLoad %int %d + %198 = OpAccessChain %_ptr_Function_int %arr0 %197 + %199 = OpLoad %int %198 + %200 = OpAccessChain %_ptr_Function_int %arr1 %196 + OpStore %200 %199 + OpBranch %183 + %183 = OpLabel + %201 = OpLoad %int %d + %202 = OpIAdd %int %201 %int_1 + OpStore %d %202 + OpBranch %181 + %182 = OpLabel + OpBranch %179 + %179 = OpLabel + %203 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %204 = OpLoad %int %203 + %205 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %206 = OpLoad %int %205 + %207 = OpIEqual %bool %204 %206 + OpSelectionMerge %208 None + OpBranchConditional %207 %209 %210 + %209 = OpLabel + OpBranch %208 + %210 = OpLabel + OpBranch %178 + %208 = OpLabel + OpBranch %177 + %178 = OpLabel + OpBranch %108 + %108 = OpLabel + %211 = OpLoad %int %a + %212 = OpIAdd %int %211 %int_1 + OpStore %a %212 + OpBranch %106 + %107 = OpLabel + %213 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %214 = OpLoad %int %213 + %215 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_12 + %216 = OpLoad %int %215 + %217 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %218 = OpLoad %int %217 + %219 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %220 = OpLoad %int %219 + %221 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %222 = OpLoad %int %221 + %223 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_7 + %224 = OpLoad %int %223 + %225 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_8 + %226 = OpLoad %int %225 + %227 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %228 = OpLoad %int %227 + %229 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %230 = OpLoad %int %229 + %231 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_10 + %232 = OpLoad %int %231 + %233 = OpCompositeConstruct %_arr_int_uint_10 %214 %216 %218 %220 %222 %224 %226 %228 %230 %232 + OpStore %ref0 %233 + %234 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %235 = OpLoad %int %234 + %236 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_12 + %237 = OpLoad %int %236 + %238 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %239 = OpLoad %int %238 + %240 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %241 = OpLoad %int %240 + %242 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %243 = OpLoad %int %242 + %244 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_13 + %245 = OpLoad %int %244 + %246 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_14 + %247 = OpLoad %int %246 + %248 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %249 = OpLoad %int %248 + %250 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_18 + %251 = OpLoad %int %250 + %252 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_19 + %253 = OpLoad %int %252 + %254 = OpCompositeConstruct %_arr_int_uint_10 %235 %237 %239 %241 %243 %245 %247 %249 %251 %253 + OpStore %ref1 %254 + %255 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %256 = OpLoad %int %255 + %257 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %258 = OpLoad %int %257 + %259 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %260 = OpLoad %int %259 + %261 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %262 = OpLoad %int %261 + %263 = OpConvertSToF %float %256 + %264 = OpConvertSToF %float %258 + %265 = OpConvertSToF %float %260 + %266 = OpConvertSToF %float %262 + %267 = OpCompositeConstruct %v4float %263 %264 %265 %266 + OpStore %x_GLF_color %267 + %268 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %269 = OpLoad %int %268 + OpStore %i %269 + OpBranch %270 + %270 = OpLabel + OpLoopMerge %271 %272 None + OpBranch %273 + %273 = OpLabel + %278 = OpLoad %int %i + %279 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %280 = OpLoad %int %279 + %281 = OpSLessThan %bool %278 %280 + OpSelectionMerge %282 None + OpBranchConditional %281 %283 %284 + %283 = OpLabel + OpBranch %282 + %284 = OpLabel + OpBranch %271 + %282 = OpLabel + %285 = OpLoad %int %i + %286 = OpAccessChain %_ptr_Function_int %arr0 %285 + %287 = OpLoad %int %286 + %288 = OpLoad %int %i + %289 = OpAccessChain %_ptr_Function_int %ref0 %288 + %290 = OpLoad %int %289 + %291 = OpINotEqual %bool %287 %290 + OpStore %x_278_phi %291 + %292 = OpLogicalNot %bool %291 + OpSelectionMerge %293 None + OpBranchConditional %292 %294 %293 + %294 = OpLabel + %295 = OpLoad %int %i + %296 = OpAccessChain %_ptr_Function_int %arr1 %295 + %297 = OpLoad %int %296 + %298 = OpLoad %int %i + %299 = OpAccessChain %_ptr_Function_int %ref1 %298 + %300 = OpLoad %int %299 + %301 = OpINotEqual %bool %297 %300 + OpStore %x_277 %301 + %302 = OpLoad %bool %x_277 + OpStore %x_278_phi %302 + OpBranch %293 + %293 = OpLabel + %303 = OpLoad %bool %x_278_phi + OpSelectionMerge %304 None + OpBranchConditional %303 %305 %304 + %305 = OpLabel + %306 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %307 = OpLoad %int %306 + %308 = OpConvertSToF %float %307 + %309 = OpCompositeConstruct %v4float %308 %308 %308 %308 + OpStore %x_GLF_color %309 + OpBranch %304 + %304 = OpLabel + OpBranch %272 + %272 = OpLabel + %310 = OpLoad %int %i + %311 = OpIAdd %int %310 %int_1 + OpStore %i %311 + OpBranch %270 + %271 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %312 +%tint_symbol = OpFunctionParameter %main_out + %316 = OpLabel + %317 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %317 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %319 = OpLabel + %320 = OpFunctionCall %void %main_1 + %322 = OpLoad %v4float %x_GLF_color + %323 = OpCompositeConstruct %main_out %322 + %321 = OpFunctionCall %void %tint_symbol_2 %323 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 179[%179] is not post dominated by the back-edge block 208[%208] + %208 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..60a06045d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.spvasm.expected.wgsl @@ -0,0 +1,232 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[block]] +struct buf1 { + one : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_19 : buf1; + +fn main_1() { + var arr0 : array; + var arr1 : array; + var a : i32; + var limiter0 : i32; + var limiter1 : i32; + var b : i32; + var limiter2 : i32; + var limiter3 : i32; + var d : i32; + var ref0 : array; + var ref1 : array; + var i : i32; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[7]; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_73 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_75 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[10]; + arr0 = array(x_59, x_61, x_63, x_65, x_67, x_69, x_71, x_73, x_75, x_77); + let x_80 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_82 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[15]; + let x_86 : i32 = x_6.x_GLF_uniform_int_values[16]; + let x_88 : i32 = x_6.x_GLF_uniform_int_values[17]; + let x_90 : i32 = x_6.x_GLF_uniform_int_values[13]; + let x_92 : i32 = x_6.x_GLF_uniform_int_values[14]; + let x_94 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_96 : i32 = x_6.x_GLF_uniform_int_values[18]; + let x_98 : i32 = x_6.x_GLF_uniform_int_values[19]; + arr1 = array(x_80, x_82, x_84, x_86, x_88, x_90, x_92, x_94, x_96, x_98); + let x_101 : i32 = x_6.x_GLF_uniform_int_values[8]; + a = x_101; + loop { + let x_106 : i32 = a; + let x_108 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_106 < x_108)) { + } else { + break; + } + let x_112 : i32 = x_6.x_GLF_uniform_int_values[3]; + limiter0 = x_112; + loop { + let x_117 : i32 = limiter0; + let x_119 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_117 < x_119)) { + } else { + break; + } + let x_122 : i32 = limiter0; + limiter0 = (x_122 + 1); + let x_125 : i32 = x_6.x_GLF_uniform_int_values[2]; + limiter1 = x_125; + let x_127 : i32 = x_6.x_GLF_uniform_int_values[3]; + b = x_127; + loop { + let x_132 : i32 = b; + let x_134 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_132 < x_134)) { + } else { + break; + } + let x_137 : i32 = limiter1; + let x_139 : i32 = x_6.x_GLF_uniform_int_values[5]; + if ((x_137 > x_139)) { + break; + } + let x_143 : i32 = limiter1; + limiter1 = (x_143 + 1); + let x_145 : i32 = b; + let x_146 : i32 = a; + let x_148 : i32 = arr1[x_146]; + arr0[x_145] = x_148; + + continuing { + let x_150 : i32 = b; + b = (x_150 + 1); + } + } + } + limiter2 = 0; + loop { + let x_156 : i32 = limiter2; + if ((x_156 < 5)) { + } else { + break; + } + let x_159 : i32 = limiter2; + limiter2 = (x_159 + 1); + let x_162 : i32 = arr1[1]; + arr0[1] = x_162; + } + loop { + limiter3 = 0; + d = 0; + loop { + let x_172 : i32 = d; + if ((x_172 < 10)) { + } else { + break; + } + let x_175 : i32 = limiter3; + if ((x_175 > 4)) { + break; + } + let x_179 : i32 = limiter3; + limiter3 = (x_179 + 1); + let x_181 : i32 = d; + let x_182 : i32 = d; + let x_184 : i32 = arr0[x_182]; + arr1[x_181] = x_184; + + continuing { + let x_186 : i32 = d; + d = (x_186 + 1); + } + } + + continuing { + let x_189 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_191 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_189 == x_191)) { + } else { + break; + } + } + } + + continuing { + let x_193 : i32 = a; + a = (x_193 + 1); + } + } + let x_196 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_198 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_200 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_202 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_204 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_206 : i32 = x_6.x_GLF_uniform_int_values[7]; + let x_208 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_210 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_212 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_214 : i32 = x_6.x_GLF_uniform_int_values[10]; + ref0 = array(x_196, x_198, x_200, x_202, x_204, x_206, x_208, x_210, x_212, x_214); + let x_217 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_219 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_221 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_223 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_225 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_227 : i32 = x_6.x_GLF_uniform_int_values[13]; + let x_229 : i32 = x_6.x_GLF_uniform_int_values[14]; + let x_231 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_233 : i32 = x_6.x_GLF_uniform_int_values[18]; + let x_235 : i32 = x_6.x_GLF_uniform_int_values[19]; + ref1 = array(x_217, x_219, x_221, x_223, x_225, x_227, x_229, x_231, x_233, x_235); + let x_238 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_241 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_244 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_247 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_238), f32(x_241), f32(x_244), f32(x_247)); + let x_251 : i32 = x_6.x_GLF_uniform_int_values[3]; + i = x_251; + loop { + var x_277 : bool; + var x_278_phi : bool; + let x_256 : i32 = i; + let x_258 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_256 < x_258)) { + } else { + break; + } + let x_261 : i32 = i; + let x_263 : i32 = arr0[x_261]; + let x_264 : i32 = i; + let x_266 : i32 = ref0[x_264]; + let x_267 : bool = (x_263 != x_266); + x_278_phi = x_267; + if (!(x_267)) { + let x_271 : i32 = i; + let x_273 : i32 = arr1[x_271]; + let x_274 : i32 = i; + let x_276 : i32 = ref1[x_274]; + x_277 = (x_273 != x_276); + x_278_phi = x_277; + } + let x_278 : bool = x_278_phi; + if (x_278) { + let x_282 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_283 : f32 = f32(x_282); + x_GLF_color = vec4(x_283, x_283, x_283, x_283); + } + + continuing { + let x_285 : i32 = i; + i = (x_285 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl new file mode 100644 index 0000000000..60a06045d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl @@ -0,0 +1,232 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[block]] +struct buf1 { + one : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_19 : buf1; + +fn main_1() { + var arr0 : array; + var arr1 : array; + var a : i32; + var limiter0 : i32; + var limiter1 : i32; + var b : i32; + var limiter2 : i32; + var limiter3 : i32; + var d : i32; + var ref0 : array; + var ref1 : array; + var i : i32; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[7]; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_73 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_75 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[10]; + arr0 = array(x_59, x_61, x_63, x_65, x_67, x_69, x_71, x_73, x_75, x_77); + let x_80 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_82 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[15]; + let x_86 : i32 = x_6.x_GLF_uniform_int_values[16]; + let x_88 : i32 = x_6.x_GLF_uniform_int_values[17]; + let x_90 : i32 = x_6.x_GLF_uniform_int_values[13]; + let x_92 : i32 = x_6.x_GLF_uniform_int_values[14]; + let x_94 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_96 : i32 = x_6.x_GLF_uniform_int_values[18]; + let x_98 : i32 = x_6.x_GLF_uniform_int_values[19]; + arr1 = array(x_80, x_82, x_84, x_86, x_88, x_90, x_92, x_94, x_96, x_98); + let x_101 : i32 = x_6.x_GLF_uniform_int_values[8]; + a = x_101; + loop { + let x_106 : i32 = a; + let x_108 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_106 < x_108)) { + } else { + break; + } + let x_112 : i32 = x_6.x_GLF_uniform_int_values[3]; + limiter0 = x_112; + loop { + let x_117 : i32 = limiter0; + let x_119 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_117 < x_119)) { + } else { + break; + } + let x_122 : i32 = limiter0; + limiter0 = (x_122 + 1); + let x_125 : i32 = x_6.x_GLF_uniform_int_values[2]; + limiter1 = x_125; + let x_127 : i32 = x_6.x_GLF_uniform_int_values[3]; + b = x_127; + loop { + let x_132 : i32 = b; + let x_134 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_132 < x_134)) { + } else { + break; + } + let x_137 : i32 = limiter1; + let x_139 : i32 = x_6.x_GLF_uniform_int_values[5]; + if ((x_137 > x_139)) { + break; + } + let x_143 : i32 = limiter1; + limiter1 = (x_143 + 1); + let x_145 : i32 = b; + let x_146 : i32 = a; + let x_148 : i32 = arr1[x_146]; + arr0[x_145] = x_148; + + continuing { + let x_150 : i32 = b; + b = (x_150 + 1); + } + } + } + limiter2 = 0; + loop { + let x_156 : i32 = limiter2; + if ((x_156 < 5)) { + } else { + break; + } + let x_159 : i32 = limiter2; + limiter2 = (x_159 + 1); + let x_162 : i32 = arr1[1]; + arr0[1] = x_162; + } + loop { + limiter3 = 0; + d = 0; + loop { + let x_172 : i32 = d; + if ((x_172 < 10)) { + } else { + break; + } + let x_175 : i32 = limiter3; + if ((x_175 > 4)) { + break; + } + let x_179 : i32 = limiter3; + limiter3 = (x_179 + 1); + let x_181 : i32 = d; + let x_182 : i32 = d; + let x_184 : i32 = arr0[x_182]; + arr1[x_181] = x_184; + + continuing { + let x_186 : i32 = d; + d = (x_186 + 1); + } + } + + continuing { + let x_189 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_191 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_189 == x_191)) { + } else { + break; + } + } + } + + continuing { + let x_193 : i32 = a; + a = (x_193 + 1); + } + } + let x_196 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_198 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_200 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_202 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_204 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_206 : i32 = x_6.x_GLF_uniform_int_values[7]; + let x_208 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_210 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_212 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_214 : i32 = x_6.x_GLF_uniform_int_values[10]; + ref0 = array(x_196, x_198, x_200, x_202, x_204, x_206, x_208, x_210, x_212, x_214); + let x_217 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_219 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_221 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_223 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_225 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_227 : i32 = x_6.x_GLF_uniform_int_values[13]; + let x_229 : i32 = x_6.x_GLF_uniform_int_values[14]; + let x_231 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_233 : i32 = x_6.x_GLF_uniform_int_values[18]; + let x_235 : i32 = x_6.x_GLF_uniform_int_values[19]; + ref1 = array(x_217, x_219, x_221, x_223, x_225, x_227, x_229, x_231, x_233, x_235); + let x_238 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_241 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_244 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_247 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_238), f32(x_241), f32(x_244), f32(x_247)); + let x_251 : i32 = x_6.x_GLF_uniform_int_values[3]; + i = x_251; + loop { + var x_277 : bool; + var x_278_phi : bool; + let x_256 : i32 = i; + let x_258 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_256 < x_258)) { + } else { + break; + } + let x_261 : i32 = i; + let x_263 : i32 = arr0[x_261]; + let x_264 : i32 = i; + let x_266 : i32 = ref0[x_264]; + let x_267 : bool = (x_263 != x_266); + x_278_phi = x_267; + if (!(x_267)) { + let x_271 : i32 = i; + let x_273 : i32 = arr1[x_271]; + let x_274 : i32 = i; + let x_276 : i32 = ref1[x_274]; + x_277 = (x_273 != x_276); + x_278_phi = x_277; + } + let x_278 : bool = x_278_phi; + if (x_278) { + let x_282 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_283 : f32 = f32(x_282); + x_GLF_color = vec4(x_283, x_283, x_283, x_283); + } + + continuing { + let x_285 : i32 = i; + i = (x_285 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..de01a1a640 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.hlsl @@ -0,0 +1,204 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[20]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_19 : register(b1, space0) { + uint4 x_19[1]; +}; + +void main_1() { + int arr0[10] = (int[10])0; + int arr1[10] = (int[10])0; + int a = 0; + int limiter0 = 0; + int limiter1 = 0; + int b = 0; + int limiter2 = 0; + int limiter3 = 0; + int d = 0; + int ref0[10] = (int[10])0; + int ref1[10] = (int[10])0; + int i = 0; + const int x_59 = asint(x_6[3].x); + const int x_61 = asint(x_6[2].x); + const int x_63 = asint(x_6[4].x); + const int x_65 = asint(x_6[5].x); + const int x_67 = asint(x_6[6].x); + const int x_69 = asint(x_6[7].x); + const int x_71 = asint(x_6[8].x); + const int x_73 = asint(x_6[9].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_75 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_77 = asint(x_6[10].x); + const int tint_symbol_3[10] = {x_59, x_61, x_63, x_65, x_67, x_69, x_71, x_73, x_75, x_77}; + arr0 = tint_symbol_3; + const int x_80 = asint(x_6[1].x); + const int x_82 = asint(x_6[12].x); + const int x_84 = asint(x_6[15].x); + const int x_86 = asint(x_6[16].x); + const int x_88 = asint(x_6[17].x); + const int x_90 = asint(x_6[13].x); + const int x_92 = asint(x_6[14].x); + const int x_94 = asint(x_6[11].x); + const int x_96 = asint(x_6[18].x); + const int x_98 = asint(x_6[19].x); + const int tint_symbol_4[10] = {x_80, x_82, x_84, x_86, x_88, x_90, x_92, x_94, x_96, x_98}; + arr1 = tint_symbol_4; + const int x_101 = asint(x_6[8].x); + a = x_101; + while (true) { + const int x_106 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_108 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_106 < x_108)) { + } else { + break; + } + const int x_112 = asint(x_6[3].x); + limiter0 = x_112; + while (true) { + const int x_117 = limiter0; + const int x_119 = asint(x_6[4].x); + if ((x_117 < x_119)) { + } else { + break; + } + limiter0 = (limiter0 + 1); + const int x_125 = asint(x_6[2].x); + limiter1 = x_125; + const int x_127 = asint(x_6[3].x); + b = x_127; + while (true) { + const int x_132 = b; + const int x_134 = asint(x_6[1].x); + if ((x_132 < x_134)) { + } else { + break; + } + const int x_137 = limiter1; + const int x_139 = asint(x_6[5].x); + if ((x_137 > x_139)) { + break; + } + limiter1 = (limiter1 + 1); + const int x_145 = b; + const int x_148 = arr1[a]; + arr0[x_145] = x_148; + { + b = (b + 1); + } + } + } + limiter2 = 0; + while (true) { + if ((limiter2 < 5)) { + } else { + break; + } + limiter2 = (limiter2 + 1); + const int x_162 = arr1[1]; + arr0[1] = x_162; + } + while (true) { + limiter3 = 0; + d = 0; + { + for(; (d < 10); d = (d + 1)) { + if ((limiter3 > 4)) { + break; + } + limiter3 = (limiter3 + 1); + const int x_181 = d; + const int x_184 = arr0[d]; + arr1[x_181] = x_184; + } + } + { + const int x_189 = asint(x_6[2].x); + const int x_191 = asint(x_6[3].x); + if ((x_189 == x_191)) { + } else { + break; + } + } + } + { + a = (a + 1); + } + } + const int x_196 = asint(x_6[11].x); + const int x_198 = asint(x_6[12].x); + const int x_200 = asint(x_6[11].x); + const int x_202 = asint(x_6[5].x); + const int x_204 = asint(x_6[6].x); + const int x_206 = asint(x_6[7].x); + const int x_208 = asint(x_6[8].x); + const int x_210 = asint(x_6[9].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_212 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_214 = asint(x_6[10].x); + const int tint_symbol_5[10] = {x_196, x_198, x_200, x_202, x_204, x_206, x_208, x_210, x_212, x_214}; + ref0 = tint_symbol_5; + const int x_217 = asint(x_6[11].x); + const int x_219 = asint(x_6[12].x); + const int x_221 = asint(x_6[11].x); + const int x_223 = asint(x_6[5].x); + const int x_225 = asint(x_6[6].x); + const int x_227 = asint(x_6[13].x); + const int x_229 = asint(x_6[14].x); + const int x_231 = asint(x_6[11].x); + const int x_233 = asint(x_6[18].x); + const int x_235 = asint(x_6[19].x); + const int tint_symbol_6[10] = {x_217, x_219, x_221, x_223, x_225, x_227, x_229, x_231, x_233, x_235}; + ref1 = tint_symbol_6; + const int x_238 = asint(x_6[2].x); + const int x_241 = asint(x_6[3].x); + const int x_244 = asint(x_6[3].x); + const int x_247 = asint(x_6[2].x); + x_GLF_color = float4(float(x_238), float(x_241), float(x_244), float(x_247)); + const int x_251 = asint(x_6[3].x); + i = x_251; + while (true) { + bool x_277 = false; + bool x_278_phi = false; + const int x_256 = i; + const int x_258 = asint(x_6[1].x); + if ((x_256 < x_258)) { + } else { + break; + } + const int x_263 = arr0[i]; + const int x_266 = ref0[i]; + const bool x_267 = (x_263 != x_266); + x_278_phi = x_267; + if (!(x_267)) { + const int x_273 = arr1[i]; + const int x_276 = ref1[i]; + x_277 = (x_273 != x_276); + x_278_phi = x_277; + } + if (x_278_phi) { + const int x_282 = asint(x_6[3].x); + const float x_283 = float(x_282); + x_GLF_color = float4(x_283, x_283, x_283, x_283); + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_7 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..417083de2b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.msl @@ -0,0 +1,237 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[20]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct buf1 { + /* 0x0000 */ int one; +}; +struct tint_array_wrapper_1 { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_8) { + tint_array_wrapper_1 arr0 = {}; + tint_array_wrapper_1 arr1 = {}; + int a = 0; + int limiter0 = 0; + int limiter1 = 0; + int b = 0; + int limiter2 = 0; + int limiter3 = 0; + int d = 0; + tint_array_wrapper_1 ref0 = {}; + tint_array_wrapper_1 ref1 = {}; + int i = 0; + int const x_59 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_65 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_67 = x_6.x_GLF_uniform_int_values.arr[6].el; + int const x_69 = x_6.x_GLF_uniform_int_values.arr[7].el; + int const x_71 = x_6.x_GLF_uniform_int_values.arr[8].el; + int const x_73 = x_6.x_GLF_uniform_int_values.arr[9].el; + int const x_75 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_77 = x_6.x_GLF_uniform_int_values.arr[10].el; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_59, x_61, x_63, x_65, x_67, x_69, x_71, x_73, x_75, x_77}}; + arr0 = tint_symbol_3; + int const x_80 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_82 = x_6.x_GLF_uniform_int_values.arr[12].el; + int const x_84 = x_6.x_GLF_uniform_int_values.arr[15].el; + int const x_86 = x_6.x_GLF_uniform_int_values.arr[16].el; + int const x_88 = x_6.x_GLF_uniform_int_values.arr[17].el; + int const x_90 = x_6.x_GLF_uniform_int_values.arr[13].el; + int const x_92 = x_6.x_GLF_uniform_int_values.arr[14].el; + int const x_94 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_96 = x_6.x_GLF_uniform_int_values.arr[18].el; + int const x_98 = x_6.x_GLF_uniform_int_values.arr[19].el; + tint_array_wrapper_1 const tint_symbol_4 = {.arr={x_80, x_82, x_84, x_86, x_88, x_90, x_92, x_94, x_96, x_98}}; + arr1 = tint_symbol_4; + int const x_101 = x_6.x_GLF_uniform_int_values.arr[8].el; + a = x_101; + while (true) { + int const x_106 = a; + int const x_108 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_106 < x_108)) { + } else { + break; + } + int const x_112 = x_6.x_GLF_uniform_int_values.arr[3].el; + limiter0 = x_112; + while (true) { + int const x_117 = limiter0; + int const x_119 = x_6.x_GLF_uniform_int_values.arr[4].el; + if ((x_117 < x_119)) { + } else { + break; + } + int const x_122 = limiter0; + limiter0 = (x_122 + 1); + int const x_125 = x_6.x_GLF_uniform_int_values.arr[2].el; + limiter1 = x_125; + int const x_127 = x_6.x_GLF_uniform_int_values.arr[3].el; + b = x_127; + while (true) { + int const x_132 = b; + int const x_134 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_132 < x_134)) { + } else { + break; + } + int const x_137 = limiter1; + int const x_139 = x_6.x_GLF_uniform_int_values.arr[5].el; + if ((x_137 > x_139)) { + break; + } + int const x_143 = limiter1; + limiter1 = (x_143 + 1); + int const x_145 = b; + int const x_146 = a; + int const x_148 = arr1.arr[x_146]; + arr0.arr[x_145] = x_148; + { + int const x_150 = b; + b = (x_150 + 1); + } + } + } + limiter2 = 0; + while (true) { + int const x_156 = limiter2; + if ((x_156 < 5)) { + } else { + break; + } + int const x_159 = limiter2; + limiter2 = (x_159 + 1); + int const x_162 = arr1.arr[1]; + arr0.arr[1] = x_162; + } + while (true) { + limiter3 = 0; + d = 0; + while (true) { + int const x_172 = d; + if ((x_172 < 10)) { + } else { + break; + } + int const x_175 = limiter3; + if ((x_175 > 4)) { + break; + } + int const x_179 = limiter3; + limiter3 = (x_179 + 1); + int const x_181 = d; + int const x_182 = d; + int const x_184 = arr0.arr[x_182]; + arr1.arr[x_181] = x_184; + { + int const x_186 = d; + d = (x_186 + 1); + } + } + { + int const x_189 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_191 = x_6.x_GLF_uniform_int_values.arr[3].el; + if ((x_189 == x_191)) { + } else { + break; + } + } + } + { + int const x_193 = a; + a = (x_193 + 1); + } + } + int const x_196 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_198 = x_6.x_GLF_uniform_int_values.arr[12].el; + int const x_200 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_202 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_204 = x_6.x_GLF_uniform_int_values.arr[6].el; + int const x_206 = x_6.x_GLF_uniform_int_values.arr[7].el; + int const x_208 = x_6.x_GLF_uniform_int_values.arr[8].el; + int const x_210 = x_6.x_GLF_uniform_int_values.arr[9].el; + int const x_212 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_214 = x_6.x_GLF_uniform_int_values.arr[10].el; + tint_array_wrapper_1 const tint_symbol_5 = {.arr={x_196, x_198, x_200, x_202, x_204, x_206, x_208, x_210, x_212, x_214}}; + ref0 = tint_symbol_5; + int const x_217 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_219 = x_6.x_GLF_uniform_int_values.arr[12].el; + int const x_221 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_223 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_225 = x_6.x_GLF_uniform_int_values.arr[6].el; + int const x_227 = x_6.x_GLF_uniform_int_values.arr[13].el; + int const x_229 = x_6.x_GLF_uniform_int_values.arr[14].el; + int const x_231 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_233 = x_6.x_GLF_uniform_int_values.arr[18].el; + int const x_235 = x_6.x_GLF_uniform_int_values.arr[19].el; + tint_array_wrapper_1 const tint_symbol_6 = {.arr={x_217, x_219, x_221, x_223, x_225, x_227, x_229, x_231, x_233, x_235}}; + ref1 = tint_symbol_6; + int const x_238 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_241 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_244 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_247 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_8) = float4(float(x_238), float(x_241), float(x_244), float(x_247)); + int const x_251 = x_6.x_GLF_uniform_int_values.arr[3].el; + i = x_251; + while (true) { + bool x_277 = false; + bool x_278_phi = false; + int const x_256 = i; + int const x_258 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_256 < x_258)) { + } else { + break; + } + int const x_261 = i; + int const x_263 = arr0.arr[x_261]; + int const x_264 = i; + int const x_266 = ref0.arr[x_264]; + bool const x_267 = (x_263 != x_266); + x_278_phi = x_267; + if (!(x_267)) { + int const x_271 = i; + int const x_273 = arr1.arr[x_271]; + int const x_274 = i; + int const x_276 = ref1.arr[x_274]; + x_277 = (x_273 != x_276); + x_278_phi = x_277; + } + bool const x_278 = x_278_phi; + if (x_278) { + int const x_282 = x_6.x_GLF_uniform_int_values.arr[3].el; + float const x_283 = float(x_282); + *(tint_symbol_8) = float4(x_283, x_283, x_283, x_283); + } + { + int const x_285 = i; + i = (x_285 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + main_1(x_6, &(tint_symbol_9)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_1 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..db432fcac2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.spvasm @@ -0,0 +1,489 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 324 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "one" + OpName %x_19 "x_19" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %arr0 "arr0" + OpName %arr1 "arr1" + OpName %a "a" + OpName %limiter0 "limiter0" + OpName %limiter1 "limiter1" + OpName %b "b" + OpName %limiter2 "limiter2" + OpName %limiter3 "limiter3" + OpName %d "d" + OpName %ref0 "ref0" + OpName %ref1 "ref1" + OpName %i "i" + OpName %x_277 "x_277" + OpName %x_278_phi "x_278_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_20 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_19 NonWritable + OpDecorate %x_19 DescriptorSet 0 + OpDecorate %x_19 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_20 = OpConstant %uint 20 +%_arr_int_uint_20 = OpTypeArray %int %uint_20 + %buf0 = OpTypeStruct %_arr_int_uint_20 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 + %buf1 = OpTypeStruct %int +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_19 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %26 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_14 = OpConstant %int 14 + %int_11 = OpConstant %int 11 + %int_18 = OpConstant %int 18 + %int_19 = OpConstant %int 19 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %276 = OpConstantNull %bool + %main_out = OpTypeStruct %v4float + %312 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %arr0 = OpVariable %_ptr_Function__arr_int_uint_10 Function %26 + %arr1 = OpVariable %_ptr_Function__arr_int_uint_10 Function %26 + %a = OpVariable %_ptr_Function_int Function %30 + %limiter0 = OpVariable %_ptr_Function_int Function %30 + %limiter1 = OpVariable %_ptr_Function_int Function %30 + %b = OpVariable %_ptr_Function_int Function %30 + %limiter2 = OpVariable %_ptr_Function_int Function %30 + %limiter3 = OpVariable %_ptr_Function_int Function %30 + %d = OpVariable %_ptr_Function_int Function %30 + %ref0 = OpVariable %_ptr_Function__arr_int_uint_10 Function %26 + %ref1 = OpVariable %_ptr_Function__arr_int_uint_10 Function %26 + %i = OpVariable %_ptr_Function_int Function %30 + %x_277 = OpVariable %_ptr_Function_bool Function %276 + %x_278_phi = OpVariable %_ptr_Function_bool Function %276 + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %44 = OpLoad %int %43 + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %47 = OpLoad %int %46 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %50 = OpLoad %int %49 + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %53 = OpLoad %int %52 + %55 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %56 = OpLoad %int %55 + %58 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_7 + %59 = OpLoad %int %58 + %61 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_8 + %62 = OpLoad %int %61 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %65 = OpLoad %int %64 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %68 = OpLoad %int %67 + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_10 + %71 = OpLoad %int %70 + %72 = OpCompositeConstruct %_arr_int_uint_10 %44 %47 %50 %53 %56 %59 %62 %65 %68 %71 + OpStore %arr0 %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %75 = OpLoad %int %74 + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_12 + %78 = OpLoad %int %77 + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_15 + %81 = OpLoad %int %80 + %83 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_16 + %84 = OpLoad %int %83 + %86 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_17 + %87 = OpLoad %int %86 + %89 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_13 + %90 = OpLoad %int %89 + %92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_14 + %93 = OpLoad %int %92 + %95 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %96 = OpLoad %int %95 + %98 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_18 + %99 = OpLoad %int %98 + %101 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_19 + %102 = OpLoad %int %101 + %103 = OpCompositeConstruct %_arr_int_uint_10 %75 %78 %81 %84 %87 %90 %93 %96 %99 %102 + OpStore %arr1 %103 + %104 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_8 + %105 = OpLoad %int %104 + OpStore %a %105 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %110 = OpLoad %int %a + %111 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %112 = OpLoad %int %111 + %113 = OpSLessThan %bool %110 %112 + OpSelectionMerge %115 None + OpBranchConditional %113 %116 %117 + %116 = OpLabel + OpBranch %115 + %117 = OpLabel + OpBranch %107 + %115 = OpLabel + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %119 = OpLoad %int %118 + OpStore %limiter0 %119 + OpBranch %120 + %120 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %124 = OpLoad %int %limiter0 + %125 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %126 = OpLoad %int %125 + %127 = OpSLessThan %bool %124 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %130 + %129 = OpLabel + OpBranch %128 + %130 = OpLabel + OpBranch %121 + %128 = OpLabel + %131 = OpLoad %int %limiter0 + %132 = OpIAdd %int %131 %int_1 + OpStore %limiter0 %132 + %133 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %134 = OpLoad %int %133 + OpStore %limiter1 %134 + %135 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %136 = OpLoad %int %135 + OpStore %b %136 + OpBranch %137 + %137 = OpLabel + OpLoopMerge %138 %139 None + OpBranch %140 + %140 = OpLabel + %141 = OpLoad %int %b + %142 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %143 = OpLoad %int %142 + %144 = OpSLessThan %bool %141 %143 + OpSelectionMerge %145 None + OpBranchConditional %144 %146 %147 + %146 = OpLabel + OpBranch %145 + %147 = OpLabel + OpBranch %138 + %145 = OpLabel + %148 = OpLoad %int %limiter1 + %149 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %150 = OpLoad %int %149 + %151 = OpSGreaterThan %bool %148 %150 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %152 + %153 = OpLabel + OpBranch %138 + %152 = OpLabel + %154 = OpLoad %int %limiter1 + %155 = OpIAdd %int %154 %int_1 + OpStore %limiter1 %155 + %156 = OpLoad %int %b + %157 = OpLoad %int %a + %158 = OpAccessChain %_ptr_Function_int %arr1 %157 + %159 = OpLoad %int %158 + %160 = OpAccessChain %_ptr_Function_int %arr0 %156 + OpStore %160 %159 + OpBranch %139 + %139 = OpLabel + %161 = OpLoad %int %b + %162 = OpIAdd %int %161 %int_1 + OpStore %b %162 + OpBranch %137 + %138 = OpLabel + OpBranch %122 + %122 = OpLabel + OpBranch %120 + %121 = OpLabel + OpStore %limiter2 %int_0 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %164 %165 None + OpBranch %166 + %166 = OpLabel + %167 = OpLoad %int %limiter2 + %168 = OpSLessThan %bool %167 %int_5 + OpSelectionMerge %169 None + OpBranchConditional %168 %170 %171 + %170 = OpLabel + OpBranch %169 + %171 = OpLabel + OpBranch %164 + %169 = OpLabel + %172 = OpLoad %int %limiter2 + %173 = OpIAdd %int %172 %int_1 + OpStore %limiter2 %173 + %174 = OpAccessChain %_ptr_Function_int %arr1 %int_1 + %175 = OpLoad %int %174 + %176 = OpAccessChain %_ptr_Function_int %arr0 %int_1 + OpStore %176 %175 + OpBranch %165 + %165 = OpLabel + OpBranch %163 + %164 = OpLabel + OpBranch %177 + %177 = OpLabel + OpLoopMerge %178 %179 None + OpBranch %180 + %180 = OpLabel + OpStore %limiter3 %int_0 + OpStore %d %int_0 + OpBranch %181 + %181 = OpLabel + OpLoopMerge %182 %183 None + OpBranch %184 + %184 = OpLabel + %185 = OpLoad %int %d + %186 = OpSLessThan %bool %185 %int_10 + OpSelectionMerge %187 None + OpBranchConditional %186 %188 %189 + %188 = OpLabel + OpBranch %187 + %189 = OpLabel + OpBranch %182 + %187 = OpLabel + %190 = OpLoad %int %limiter3 + %191 = OpSGreaterThan %bool %190 %int_4 + OpSelectionMerge %192 None + OpBranchConditional %191 %193 %192 + %193 = OpLabel + OpBranch %182 + %192 = OpLabel + %194 = OpLoad %int %limiter3 + %195 = OpIAdd %int %194 %int_1 + OpStore %limiter3 %195 + %196 = OpLoad %int %d + %197 = OpLoad %int %d + %198 = OpAccessChain %_ptr_Function_int %arr0 %197 + %199 = OpLoad %int %198 + %200 = OpAccessChain %_ptr_Function_int %arr1 %196 + OpStore %200 %199 + OpBranch %183 + %183 = OpLabel + %201 = OpLoad %int %d + %202 = OpIAdd %int %201 %int_1 + OpStore %d %202 + OpBranch %181 + %182 = OpLabel + OpBranch %179 + %179 = OpLabel + %203 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %204 = OpLoad %int %203 + %205 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %206 = OpLoad %int %205 + %207 = OpIEqual %bool %204 %206 + OpSelectionMerge %208 None + OpBranchConditional %207 %209 %210 + %209 = OpLabel + OpBranch %208 + %210 = OpLabel + OpBranch %178 + %208 = OpLabel + OpBranch %177 + %178 = OpLabel + OpBranch %108 + %108 = OpLabel + %211 = OpLoad %int %a + %212 = OpIAdd %int %211 %int_1 + OpStore %a %212 + OpBranch %106 + %107 = OpLabel + %213 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %214 = OpLoad %int %213 + %215 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_12 + %216 = OpLoad %int %215 + %217 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %218 = OpLoad %int %217 + %219 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %220 = OpLoad %int %219 + %221 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %222 = OpLoad %int %221 + %223 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_7 + %224 = OpLoad %int %223 + %225 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_8 + %226 = OpLoad %int %225 + %227 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %228 = OpLoad %int %227 + %229 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %230 = OpLoad %int %229 + %231 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_10 + %232 = OpLoad %int %231 + %233 = OpCompositeConstruct %_arr_int_uint_10 %214 %216 %218 %220 %222 %224 %226 %228 %230 %232 + OpStore %ref0 %233 + %234 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %235 = OpLoad %int %234 + %236 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_12 + %237 = OpLoad %int %236 + %238 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %239 = OpLoad %int %238 + %240 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %241 = OpLoad %int %240 + %242 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %243 = OpLoad %int %242 + %244 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_13 + %245 = OpLoad %int %244 + %246 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_14 + %247 = OpLoad %int %246 + %248 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %249 = OpLoad %int %248 + %250 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_18 + %251 = OpLoad %int %250 + %252 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_19 + %253 = OpLoad %int %252 + %254 = OpCompositeConstruct %_arr_int_uint_10 %235 %237 %239 %241 %243 %245 %247 %249 %251 %253 + OpStore %ref1 %254 + %255 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %256 = OpLoad %int %255 + %257 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %258 = OpLoad %int %257 + %259 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %260 = OpLoad %int %259 + %261 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %262 = OpLoad %int %261 + %263 = OpConvertSToF %float %256 + %264 = OpConvertSToF %float %258 + %265 = OpConvertSToF %float %260 + %266 = OpConvertSToF %float %262 + %267 = OpCompositeConstruct %v4float %263 %264 %265 %266 + OpStore %x_GLF_color %267 + %268 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %269 = OpLoad %int %268 + OpStore %i %269 + OpBranch %270 + %270 = OpLabel + OpLoopMerge %271 %272 None + OpBranch %273 + %273 = OpLabel + %278 = OpLoad %int %i + %279 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %280 = OpLoad %int %279 + %281 = OpSLessThan %bool %278 %280 + OpSelectionMerge %282 None + OpBranchConditional %281 %283 %284 + %283 = OpLabel + OpBranch %282 + %284 = OpLabel + OpBranch %271 + %282 = OpLabel + %285 = OpLoad %int %i + %286 = OpAccessChain %_ptr_Function_int %arr0 %285 + %287 = OpLoad %int %286 + %288 = OpLoad %int %i + %289 = OpAccessChain %_ptr_Function_int %ref0 %288 + %290 = OpLoad %int %289 + %291 = OpINotEqual %bool %287 %290 + OpStore %x_278_phi %291 + %292 = OpLogicalNot %bool %291 + OpSelectionMerge %293 None + OpBranchConditional %292 %294 %293 + %294 = OpLabel + %295 = OpLoad %int %i + %296 = OpAccessChain %_ptr_Function_int %arr1 %295 + %297 = OpLoad %int %296 + %298 = OpLoad %int %i + %299 = OpAccessChain %_ptr_Function_int %ref1 %298 + %300 = OpLoad %int %299 + %301 = OpINotEqual %bool %297 %300 + OpStore %x_277 %301 + %302 = OpLoad %bool %x_277 + OpStore %x_278_phi %302 + OpBranch %293 + %293 = OpLabel + %303 = OpLoad %bool %x_278_phi + OpSelectionMerge %304 None + OpBranchConditional %303 %305 %304 + %305 = OpLabel + %306 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %307 = OpLoad %int %306 + %308 = OpConvertSToF %float %307 + %309 = OpCompositeConstruct %v4float %308 %308 %308 %308 + OpStore %x_GLF_color %309 + OpBranch %304 + %304 = OpLabel + OpBranch %272 + %272 = OpLabel + %310 = OpLoad %int %i + %311 = OpIAdd %int %310 %int_1 + OpStore %i %311 + OpBranch %270 + %271 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %312 +%tint_symbol = OpFunctionParameter %main_out + %316 = OpLabel + %317 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %317 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %319 = OpLabel + %320 = OpFunctionCall %void %main_1 + %322 = OpLoad %v4float %x_GLF_color + %323 = OpCompositeConstruct %main_out %322 + %321 = OpFunctionCall %void %tint_symbol_2 %323 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 179[%179] is not post dominated by the back-edge block 208[%208] + %208 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..60a06045d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-array-copies-loops-with-limiters/0-opt.wgsl.expected.wgsl @@ -0,0 +1,232 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[block]] +struct buf1 { + one : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_19 : buf1; + +fn main_1() { + var arr0 : array; + var arr1 : array; + var a : i32; + var limiter0 : i32; + var limiter1 : i32; + var b : i32; + var limiter2 : i32; + var limiter3 : i32; + var d : i32; + var ref0 : array; + var ref1 : array; + var i : i32; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[7]; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_73 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_75 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[10]; + arr0 = array(x_59, x_61, x_63, x_65, x_67, x_69, x_71, x_73, x_75, x_77); + let x_80 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_82 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[15]; + let x_86 : i32 = x_6.x_GLF_uniform_int_values[16]; + let x_88 : i32 = x_6.x_GLF_uniform_int_values[17]; + let x_90 : i32 = x_6.x_GLF_uniform_int_values[13]; + let x_92 : i32 = x_6.x_GLF_uniform_int_values[14]; + let x_94 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_96 : i32 = x_6.x_GLF_uniform_int_values[18]; + let x_98 : i32 = x_6.x_GLF_uniform_int_values[19]; + arr1 = array(x_80, x_82, x_84, x_86, x_88, x_90, x_92, x_94, x_96, x_98); + let x_101 : i32 = x_6.x_GLF_uniform_int_values[8]; + a = x_101; + loop { + let x_106 : i32 = a; + let x_108 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_106 < x_108)) { + } else { + break; + } + let x_112 : i32 = x_6.x_GLF_uniform_int_values[3]; + limiter0 = x_112; + loop { + let x_117 : i32 = limiter0; + let x_119 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_117 < x_119)) { + } else { + break; + } + let x_122 : i32 = limiter0; + limiter0 = (x_122 + 1); + let x_125 : i32 = x_6.x_GLF_uniform_int_values[2]; + limiter1 = x_125; + let x_127 : i32 = x_6.x_GLF_uniform_int_values[3]; + b = x_127; + loop { + let x_132 : i32 = b; + let x_134 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_132 < x_134)) { + } else { + break; + } + let x_137 : i32 = limiter1; + let x_139 : i32 = x_6.x_GLF_uniform_int_values[5]; + if ((x_137 > x_139)) { + break; + } + let x_143 : i32 = limiter1; + limiter1 = (x_143 + 1); + let x_145 : i32 = b; + let x_146 : i32 = a; + let x_148 : i32 = arr1[x_146]; + arr0[x_145] = x_148; + + continuing { + let x_150 : i32 = b; + b = (x_150 + 1); + } + } + } + limiter2 = 0; + loop { + let x_156 : i32 = limiter2; + if ((x_156 < 5)) { + } else { + break; + } + let x_159 : i32 = limiter2; + limiter2 = (x_159 + 1); + let x_162 : i32 = arr1[1]; + arr0[1] = x_162; + } + loop { + limiter3 = 0; + d = 0; + loop { + let x_172 : i32 = d; + if ((x_172 < 10)) { + } else { + break; + } + let x_175 : i32 = limiter3; + if ((x_175 > 4)) { + break; + } + let x_179 : i32 = limiter3; + limiter3 = (x_179 + 1); + let x_181 : i32 = d; + let x_182 : i32 = d; + let x_184 : i32 = arr0[x_182]; + arr1[x_181] = x_184; + + continuing { + let x_186 : i32 = d; + d = (x_186 + 1); + } + } + + continuing { + let x_189 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_191 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_189 == x_191)) { + } else { + break; + } + } + } + + continuing { + let x_193 : i32 = a; + a = (x_193 + 1); + } + } + let x_196 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_198 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_200 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_202 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_204 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_206 : i32 = x_6.x_GLF_uniform_int_values[7]; + let x_208 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_210 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_212 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_214 : i32 = x_6.x_GLF_uniform_int_values[10]; + ref0 = array(x_196, x_198, x_200, x_202, x_204, x_206, x_208, x_210, x_212, x_214); + let x_217 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_219 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_221 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_223 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_225 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_227 : i32 = x_6.x_GLF_uniform_int_values[13]; + let x_229 : i32 = x_6.x_GLF_uniform_int_values[14]; + let x_231 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_233 : i32 = x_6.x_GLF_uniform_int_values[18]; + let x_235 : i32 = x_6.x_GLF_uniform_int_values[19]; + ref1 = array(x_217, x_219, x_221, x_223, x_225, x_227, x_229, x_231, x_233, x_235); + let x_238 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_241 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_244 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_247 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_238), f32(x_241), f32(x_244), f32(x_247)); + let x_251 : i32 = x_6.x_GLF_uniform_int_values[3]; + i = x_251; + loop { + var x_277 : bool; + var x_278_phi : bool; + let x_256 : i32 = i; + let x_258 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_256 < x_258)) { + } else { + break; + } + let x_261 : i32 = i; + let x_263 : i32 = arr0[x_261]; + let x_264 : i32 = i; + let x_266 : i32 = ref0[x_264]; + let x_267 : bool = (x_263 != x_266); + x_278_phi = x_267; + if (!(x_267)) { + let x_271 : i32 = i; + let x_273 : i32 = arr1[x_271]; + let x_274 : i32 = i; + let x_276 : i32 = ref1[x_274]; + x_277 = (x_273 != x_276); + x_278_phi = x_277; + } + let x_278 : bool = x_278_phi; + if (x_278) { + let x_282 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_283 : f32 = f32(x_282); + x_GLF_color = vec4(x_283, x_283, x_283, x_283); + } + + continuing { + let x_285 : i32 = i; + i = (x_285 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm new file mode 100644 index 0000000000..c686e933a0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm @@ -0,0 +1,154 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v1 "v1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_7 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_7 = OpConstant %uint 7 +%_arr_float_uint_7 = OpTypeArray %float %uint_7 + %buf0 = OpTypeStruct %_arr_float_uint_7 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_1_57079637 = OpConstant %float 1.57079637 +%float_1_11976957 = OpConstant %float 1.11976957 +%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 +%float_0_927295208 = OpConstant %float 0.927295208 + %27 = OpConstantComposite %v4float %float_1_57079637 %float_1_11976957 %float_0x1_8p_128 %float_0_927295208 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 + %int_3 = OpConstant %int 3 + %int_6 = OpConstant %int 6 + %uint_3 = OpConstant %uint 3 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %12 + %39 = OpLabel + %v1 = OpVariable %_ptr_Function_v4float Function + %v2 = OpVariable %_ptr_Function_v4float Function + %v3 = OpVariable %_ptr_Function_v4float Function + %v4 = OpVariable %_ptr_Function_v4float Function + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %43 = OpLoad %float %42 + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %47 = OpLoad %float %46 + %48 = OpCompositeConstruct %v4float %41 %43 %45 %47 + OpStore %v1 %48 + OpStore %v2 %27 + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %50 = OpLoad %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %v3 %51 + %52 = OpLoad %v4float %v1 + %53 = OpLoad %v4float %v2 + %54 = OpLoad %v4float %v3 + %55 = OpExtInst %v4float %1 SmoothStep %52 %53 %54 + OpStore %v4 %55 + %56 = OpLoad %v4float %v4 + %57 = OpVectorShuffle %v4float %56 %56 0 1 3 0 + OpStore %_GLF_color %57 + %58 = OpAccessChain %_ptr_Function_float %v4 %uint_0 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_4 + %61 = OpLoad %float %60 + %62 = OpFOrdGreaterThan %bool %59 %61 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + %65 = OpAccessChain %_ptr_Function_float %v4 %uint_0 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_5 + %68 = OpLoad %float %67 + %69 = OpFOrdLessThan %bool %66 %68 + OpBranch %63 + %63 = OpLabel + %70 = OpPhi %bool %62 %39 %69 %64 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %73 = OpAccessChain %_ptr_Function_float %v4 %uint_1 + %74 = OpLoad %float %73 + %75 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %76 = OpLoad %float %75 + %77 = OpFOrdGreaterThan %bool %74 %76 + OpBranch %71 + %71 = OpLabel + %78 = OpPhi %bool %70 %63 %77 %72 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + %81 = OpAccessChain %_ptr_Function_float %v4 %uint_1 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_6 + %84 = OpLoad %float %83 + %85 = OpFOrdLessThan %bool %82 %84 + OpBranch %79 + %79 = OpLabel + %86 = OpPhi %bool %78 %71 %85 %80 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %87 + %88 = OpLabel + %89 = OpAccessChain %_ptr_Function_float %v4 %uint_3 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %92 = OpLoad %float %91 + %93 = OpFOrdEqual %bool %90 %92 + OpBranch %87 + %87 = OpLabel + %94 = OpPhi %bool %86 %79 %93 %88 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %97 + %96 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %101 = OpLoad %float %100 + %102 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %105 = OpLoad %float %104 + %106 = OpCompositeConstruct %v4float %99 %101 %103 %105 + OpStore %_GLF_color %106 + OpBranch %95 + %97 = OpLabel + %107 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %108 = OpLoad %float %107 + %109 = OpCompositeConstruct %v4float %108 %108 %108 %108 + OpStore %_GLF_color %109 + OpBranch %95 + %95 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..841bebfb4c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.hlsl @@ -0,0 +1,94 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[7]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 v2 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 v3 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 v4 = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_69 = false; + bool x_77 = false; + bool x_85 = false; + bool x_93 = false; + bool x_70_phi = false; + bool x_78_phi = false; + bool x_86_phi = false; + bool x_94_phi = false; + const float x_41 = asfloat(x_6[2].x); + const float x_43 = asfloat(x_6[2].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_47 = asfloat(x_6[2].x); + v1 = float4(x_41, x_43, x_45, x_47); + v2 = float4(1.570796371f, 1.119769573f, asfloat(0x7fc00000u), 0.927295208f); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_50 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + v3 = float4(x_50, x_50, x_50, x_50); + v4 = smoothstep(v1, v2, v3); + const float4 x_56 = v4; + x_GLF_color = float4(x_56.x, x_56.y, x_56.w, x_56.x); + const float x_59 = v4.x; + const float x_61 = asfloat(x_6[4].x); + const bool x_62 = (x_59 > x_61); + x_70_phi = x_62; + if (x_62) { + const float x_66 = v4.x; + const float x_68 = asfloat(x_6[5].x); + x_69 = (x_66 < x_68); + x_70_phi = x_69; + } + const bool x_70 = x_70_phi; + x_78_phi = x_70; + if (x_70) { + const float x_74 = v4.y; + const float x_76 = asfloat(x_6[3].x); + x_77 = (x_74 > x_76); + x_78_phi = x_77; + } + const bool x_78 = x_78_phi; + x_86_phi = x_78; + if (x_78) { + const float x_82 = v4.y; + const float x_84 = asfloat(x_6[6].x); + x_85 = (x_82 < x_84); + x_86_phi = x_85; + } + const bool x_86 = x_86_phi; + x_94_phi = x_86; + if (x_86) { + const float x_90 = v4.w; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_92 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_93 = (x_90 == x_92); + x_94_phi = x_93; + } + if (x_94_phi) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_99 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_101 = asfloat(x_6[1].x); + const float x_103 = asfloat(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_105 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(x_99, x_101, x_103, x_105); + } else { + const float x_108 = asfloat(x_6[1].x); + x_GLF_color = float4(x_108, x_108, x_108, x_108); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f541d0e056 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.msl @@ -0,0 +1,103 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[7]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float4 v1 = 0.0f; + float4 v2 = 0.0f; + float4 v3 = 0.0f; + float4 v4 = 0.0f; + bool x_69 = false; + bool x_77 = false; + bool x_85 = false; + bool x_93 = false; + bool x_70_phi = false; + bool x_78_phi = false; + bool x_86_phi = false; + bool x_94_phi = false; + float const x_41 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_43 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_45 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_47 = x_6.x_GLF_uniform_float_values.arr[2].el; + v1 = float4(x_41, x_43, x_45, x_47); + v2 = float4(1.570796371f, 1.119769573f, NAN, 0.927295208f); + float const x_50 = x_6.x_GLF_uniform_float_values.arr[0].el; + v3 = float4(x_50, x_50, x_50, x_50); + float4 const x_52 = v1; + float4 const x_53 = v2; + float4 const x_54 = v3; + v4 = smoothstep(x_52, x_53, x_54); + float4 const x_56 = v4; + *(tint_symbol_4) = float4(x_56.x, x_56.y, x_56.w, x_56.x); + float const x_59 = v4.x; + float const x_61 = x_6.x_GLF_uniform_float_values.arr[4].el; + bool const x_62 = (x_59 > x_61); + x_70_phi = x_62; + if (x_62) { + float const x_66 = v4.x; + float const x_68 = x_6.x_GLF_uniform_float_values.arr[5].el; + x_69 = (x_66 < x_68); + x_70_phi = x_69; + } + bool const x_70 = x_70_phi; + x_78_phi = x_70; + if (x_70) { + float const x_74 = v4.y; + float const x_76 = x_6.x_GLF_uniform_float_values.arr[3].el; + x_77 = (x_74 > x_76); + x_78_phi = x_77; + } + bool const x_78 = x_78_phi; + x_86_phi = x_78; + if (x_78) { + float const x_82 = v4.y; + float const x_84 = x_6.x_GLF_uniform_float_values.arr[6].el; + x_85 = (x_82 < x_84); + x_86_phi = x_85; + } + bool const x_86 = x_86_phi; + x_94_phi = x_86; + if (x_86) { + float const x_90 = v4.w; + float const x_92 = x_6.x_GLF_uniform_float_values.arr[0].el; + x_93 = (x_90 == x_92); + x_94_phi = x_93; + } + bool const x_94 = x_94_phi; + if (x_94) { + float const x_99 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_101 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_103 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_105 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_99, x_101, x_103, x_105); + } else { + float const x_108 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_108, x_108, x_108, x_108); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f43127a22c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.spvasm @@ -0,0 +1,224 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 143 +; Schema: 0 + OpCapability Shader + %60 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + OpName %x_69 "x_69" + OpName %x_77 "x_77" + OpName %x_85 "x_85" + OpName %x_93 "x_93" + OpName %x_70_phi "x_70_phi" + OpName %x_78_phi "x_78_phi" + OpName %x_86_phi "x_86_phi" + OpName %x_94_phi "x_94_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_7 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_7 = OpConstant %uint 7 +%_arr_float_uint_7 = OpTypeArray %float %uint_7 + %buf0 = OpTypeStruct %_arr_float_uint_7 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %26 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 +%float_1_57079637 = OpConstant %float 1.57079637 +%float_1_11976957 = OpConstant %float 1.11976957 +%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 +%float_0_927295208 = OpConstant %float 0.927295208 + %52 = OpConstantComposite %v4float %float_1_57079637 %float_1_11976957 %float_0x1_8p_128 %float_0_927295208 +%_ptr_Function_float = OpTypePointer Function %float + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 + %int_3 = OpConstant %int 3 + %int_6 = OpConstant %int 6 + %uint_3 = OpConstant %uint 3 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %131 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %v1 = OpVariable %_ptr_Function_v4float Function %11 + %v2 = OpVariable %_ptr_Function_v4float Function %11 + %v3 = OpVariable %_ptr_Function_v4float Function %11 + %v4 = OpVariable %_ptr_Function_v4float Function %11 + %x_69 = OpVariable %_ptr_Function_bool Function %26 + %x_77 = OpVariable %_ptr_Function_bool Function %26 + %x_85 = OpVariable %_ptr_Function_bool Function %26 + %x_93 = OpVariable %_ptr_Function_bool Function %26 + %x_70_phi = OpVariable %_ptr_Function_bool Function %26 + %x_78_phi = OpVariable %_ptr_Function_bool Function %26 + %x_86_phi = OpVariable %_ptr_Function_bool Function %26 + %x_94_phi = OpVariable %_ptr_Function_bool Function %26 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %46 = OpLoad %float %45 + %47 = OpCompositeConstruct %v4float %39 %41 %44 %46 + OpStore %v1 %47 + OpStore %v2 %52 + %53 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %54 = OpLoad %float %53 + %55 = OpCompositeConstruct %v4float %54 %54 %54 %54 + OpStore %v3 %55 + %56 = OpLoad %v4float %v1 + %57 = OpLoad %v4float %v2 + %58 = OpLoad %v4float %v3 + %59 = OpExtInst %v4float %60 SmoothStep %56 %57 %58 + OpStore %v4 %59 + %61 = OpLoad %v4float %v4 + %62 = OpCompositeExtract %float %61 0 + %63 = OpCompositeExtract %float %61 1 + %64 = OpCompositeExtract %float %61 3 + %65 = OpCompositeExtract %float %61 0 + %66 = OpCompositeConstruct %v4float %62 %63 %64 %65 + OpStore %x_GLF_color %66 + %68 = OpAccessChain %_ptr_Function_float %v4 %uint_0 + %69 = OpLoad %float %68 + %71 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_4 + %72 = OpLoad %float %71 + %73 = OpFOrdGreaterThan %bool %69 %72 + OpStore %x_70_phi %73 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %74 + %75 = OpLabel + %76 = OpAccessChain %_ptr_Function_float %v4 %uint_0 + %77 = OpLoad %float %76 + %79 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_5 + %80 = OpLoad %float %79 + %81 = OpFOrdLessThan %bool %77 %80 + OpStore %x_69 %81 + %82 = OpLoad %bool %x_69 + OpStore %x_70_phi %82 + OpBranch %74 + %74 = OpLabel + %83 = OpLoad %bool %x_70_phi + OpStore %x_78_phi %83 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %84 + %85 = OpLabel + %87 = OpAccessChain %_ptr_Function_float %v4 %uint_1 + %88 = OpLoad %float %87 + %90 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %91 = OpLoad %float %90 + %92 = OpFOrdGreaterThan %bool %88 %91 + OpStore %x_77 %92 + %93 = OpLoad %bool %x_77 + OpStore %x_78_phi %93 + OpBranch %84 + %84 = OpLabel + %94 = OpLoad %bool %x_78_phi + OpStore %x_86_phi %94 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + %97 = OpAccessChain %_ptr_Function_float %v4 %uint_1 + %98 = OpLoad %float %97 + %100 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_6 + %101 = OpLoad %float %100 + %102 = OpFOrdLessThan %bool %98 %101 + OpStore %x_85 %102 + %103 = OpLoad %bool %x_85 + OpStore %x_86_phi %103 + OpBranch %95 + %95 = OpLabel + %104 = OpLoad %bool %x_86_phi + OpStore %x_94_phi %104 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %105 + %106 = OpLabel + %108 = OpAccessChain %_ptr_Function_float %v4 %uint_3 + %109 = OpLoad %float %108 + %110 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %111 = OpLoad %float %110 + %112 = OpFOrdEqual %bool %109 %111 + OpStore %x_93 %112 + %113 = OpLoad %bool %x_93 + OpStore %x_94_phi %113 + OpBranch %105 + %105 = OpLabel + %114 = OpLoad %bool %x_94_phi + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %117 + %116 = OpLabel + %118 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %119 = OpLoad %float %118 + %121 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %122 = OpLoad %float %121 + %123 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %124 = OpLoad %float %123 + %125 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %126 = OpLoad %float %125 + %127 = OpCompositeConstruct %v4float %119 %122 %124 %126 + OpStore %x_GLF_color %127 + OpBranch %115 + %117 = OpLabel + %128 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %129 = OpLoad %float %128 + %130 = OpCompositeConstruct %v4float %129 %129 %129 %129 + OpStore %x_GLF_color %130 + OpBranch %115 + %115 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %131 +%tint_symbol = OpFunctionParameter %main_out + %135 = OpLabel + %136 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %136 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %138 = OpLabel + %139 = OpFunctionCall %void %main_1 + %141 = OpLoad %v4float %x_GLF_color + %142 = OpCompositeConstruct %main_out %141 + %140 = OpFunctionCall %void %tint_symbol_2 %142 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..32f966dc88 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.spvasm.expected.wgsl @@ -0,0 +1,96 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec4; + var v2 : vec4; + var v3 : vec4; + var v4 : vec4; + var x_69 : bool; + var x_77 : bool; + var x_85 : bool; + var x_93 : bool; + var x_70_phi : bool; + var x_78_phi : bool; + var x_86_phi : bool; + var x_94_phi : bool; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_45 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[2]; + v1 = vec4(x_41, x_43, x_45, x_47); + v2 = vec4(1.570796371, 1.119769573, 0x1.8p+128, 0.927295208); + let x_50 : f32 = x_6.x_GLF_uniform_float_values[0]; + v3 = vec4(x_50, x_50, x_50, x_50); + let x_52 : vec4 = v1; + let x_53 : vec4 = v2; + let x_54 : vec4 = v3; + v4 = smoothStep(x_52, x_53, x_54); + let x_56 : vec4 = v4; + x_GLF_color = vec4(x_56.x, x_56.y, x_56.w, x_56.x); + let x_59 : f32 = v4.x; + let x_61 : f32 = x_6.x_GLF_uniform_float_values[4]; + let x_62 : bool = (x_59 > x_61); + x_70_phi = x_62; + if (x_62) { + let x_66 : f32 = v4.x; + let x_68 : f32 = x_6.x_GLF_uniform_float_values[5]; + x_69 = (x_66 < x_68); + x_70_phi = x_69; + } + let x_70 : bool = x_70_phi; + x_78_phi = x_70; + if (x_70) { + let x_74 : f32 = v4.y; + let x_76 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_77 = (x_74 > x_76); + x_78_phi = x_77; + } + let x_78 : bool = x_78_phi; + x_86_phi = x_78; + if (x_78) { + let x_82 : f32 = v4.y; + let x_84 : f32 = x_6.x_GLF_uniform_float_values[6]; + x_85 = (x_82 < x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_94_phi = x_86; + if (x_86) { + let x_90 : f32 = v4.w; + let x_92 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_93 = (x_90 == x_92); + x_94_phi = x_93; + } + let x_94 : bool = x_94_phi; + if (x_94) { + let x_99 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_101 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_103 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_105 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_99, x_101, x_103, x_105); + } else { + let x_108 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_108, x_108, x_108, x_108); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl new file mode 100644 index 0000000000..32f966dc88 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl @@ -0,0 +1,96 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec4; + var v2 : vec4; + var v3 : vec4; + var v4 : vec4; + var x_69 : bool; + var x_77 : bool; + var x_85 : bool; + var x_93 : bool; + var x_70_phi : bool; + var x_78_phi : bool; + var x_86_phi : bool; + var x_94_phi : bool; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_45 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[2]; + v1 = vec4(x_41, x_43, x_45, x_47); + v2 = vec4(1.570796371, 1.119769573, 0x1.8p+128, 0.927295208); + let x_50 : f32 = x_6.x_GLF_uniform_float_values[0]; + v3 = vec4(x_50, x_50, x_50, x_50); + let x_52 : vec4 = v1; + let x_53 : vec4 = v2; + let x_54 : vec4 = v3; + v4 = smoothStep(x_52, x_53, x_54); + let x_56 : vec4 = v4; + x_GLF_color = vec4(x_56.x, x_56.y, x_56.w, x_56.x); + let x_59 : f32 = v4.x; + let x_61 : f32 = x_6.x_GLF_uniform_float_values[4]; + let x_62 : bool = (x_59 > x_61); + x_70_phi = x_62; + if (x_62) { + let x_66 : f32 = v4.x; + let x_68 : f32 = x_6.x_GLF_uniform_float_values[5]; + x_69 = (x_66 < x_68); + x_70_phi = x_69; + } + let x_70 : bool = x_70_phi; + x_78_phi = x_70; + if (x_70) { + let x_74 : f32 = v4.y; + let x_76 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_77 = (x_74 > x_76); + x_78_phi = x_77; + } + let x_78 : bool = x_78_phi; + x_86_phi = x_78; + if (x_78) { + let x_82 : f32 = v4.y; + let x_84 : f32 = x_6.x_GLF_uniform_float_values[6]; + x_85 = (x_82 < x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_94_phi = x_86; + if (x_86) { + let x_90 : f32 = v4.w; + let x_92 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_93 = (x_90 == x_92); + x_94_phi = x_93; + } + let x_94 : bool = x_94_phi; + if (x_94) { + let x_99 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_101 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_103 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_105 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_99, x_101, x_103, x_105); + } else { + let x_108 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_108, x_108, x_108, x_108); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..62792b6bfb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.hlsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl:30:47 error: expected ')' for type constructor + v2 = vec4(1.570796371, 1.119769573, 0x1.8p+128, 0.927295208); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..62792b6bfb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.msl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl:30:47 error: expected ')' for type constructor + v2 = vec4(1.570796371, 1.119769573, 0x1.8p+128, 0.927295208); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..62792b6bfb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.spvasm @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl:30:47 error: expected ')' for type constructor + v2 = vec4(1.570796371, 1.119769573, 0x1.8p+128, 0.927295208); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..62792b6bfb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-asin-undefined-smoothstep/0-opt.wgsl:30:47 error: expected ')' for type constructor + v2 = vec4(1.570796371, 1.119769573, 0x1.8p+128, 0.927295208); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm new file mode 100644 index 0000000000..d25e5e5062 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm @@ -0,0 +1,116 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %v "v" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%float_n621_596008 = OpConstant %float -621.596008 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %13 + %30 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + %f = OpVariable %_ptr_Function_float Function + %31 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %32 = OpLoad %int %31 + %33 = OpConvertSToF %float %32 + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %35 = OpLoad %int %34 + %36 = OpConvertSToF %float %35 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpConvertSToF %float %38 + %40 = OpCompositeConstruct %v4float %33 %36 %float_n621_596008 %39 + OpStore %v %40 + %41 = OpLoad %v4float %v + %42 = OpExtInst %v4float %1 Trunc %41 + %43 = OpExtInst %v4float %1 Atan %42 + %44 = OpCompositeExtract %float %43 2 + OpStore %f %44 + %45 = OpLoad %float %f + %46 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpFNegate %float %47 + %49 = OpFOrdGreaterThan %bool %45 %48 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + %52 = OpLoad %float %f + %53 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %54 = OpLoad %float %53 + %55 = OpFNegate %float %54 + %56 = OpFOrdLessThan %bool %52 %55 + OpBranch %50 + %50 = OpLabel + %57 = OpPhi %bool %49 %30 %56 %51 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %68 + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %71 + %73 = OpCompositeConstruct %v4float %63 %66 %69 %72 + OpStore %_GLF_color %73 + OpBranch %58 + %60 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpCompositeConstruct %v4float %76 %76 %76 %76 + OpStore %_GLF_color %77 + OpBranch %58 + %58 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..be0338b3f2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.hlsl @@ -0,0 +1,62 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + float f = 0.0f; + bool x_56 = false; + bool x_57_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_32 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_35 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + v = float4(float(x_32), float(x_35), -621.596008301f, float(x_38)); + f = atan(trunc(v)).z; + const float x_45 = f; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const bool x_49 = (x_45 > -(x_47)); + x_57_phi = x_49; + if (x_49) { + const float x_52 = f; + const float x_54 = asfloat(x_9[1].x); + x_56 = (x_52 < -(x_54)); + x_57_phi = x_56; + } + if (x_57_phi) { + const int x_62 = asint(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_65 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_68 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_71 = asint(x_6[1].x); + x_GLF_color = float4(float(x_62), float(x_65), float(x_68), float(x_71)); + } else { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_75 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_76 = float(x_75); + x_GLF_color = float4(x_76, x_76, x_76, x_76); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..7559de0360 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + float f = 0.0f; + bool x_56 = false; + bool x_57_phi = false; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + v = float4(float(x_32), float(x_35), -621.596008301f, float(x_38)); + float4 const x_41 = v; + f = atan(trunc(x_41)).z; + float const x_45 = f; + float const x_47 = x_9.x_GLF_uniform_float_values.arr[0].el; + bool const x_49 = (x_45 > -(x_47)); + x_57_phi = x_49; + if (x_49) { + float const x_52 = f; + float const x_54 = x_9.x_GLF_uniform_float_values.arr[1].el; + x_56 = (x_52 < -(x_54)); + x_57_phi = x_56; + } + bool const x_57 = x_57_phi; + if (x_57) { + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_68 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_71 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_62), float(x_65), float(x_68), float(x_71)); + } else { + int const x_75 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_76 = float(x_75); + *(tint_symbol_4) = float4(x_76, x_76, x_76, x_76); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f01fd576d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.spvasm @@ -0,0 +1,161 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + %49 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %f "f" + OpName %x_56 "x_56" + OpName %x_57_phi "x_57_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %27 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %31 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%float_n621_596008 = OpConstant %float -621.596008 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %88 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %16 + %f = OpVariable %_ptr_Function_float Function %27 + %x_56 = OpVariable %_ptr_Function_bool Function %31 + %x_57_phi = OpVariable %_ptr_Function_bool Function %31 + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpConvertSToF %float %37 + %43 = OpConvertSToF %float %39 + %45 = OpConvertSToF %float %41 + %46 = OpCompositeConstruct %v4float %42 %43 %float_n621_596008 %45 + OpStore %v %46 + %47 = OpLoad %v4float %v + %50 = OpExtInst %v4float %49 Trunc %47 + %48 = OpExtInst %v4float %49 Atan %50 + %51 = OpCompositeExtract %float %48 2 + OpStore %f %51 + %52 = OpLoad %float %f + %54 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpFNegate %float %55 + %57 = OpFOrdGreaterThan %bool %52 %56 + OpStore %x_57_phi %57 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + %60 = OpLoad %float %f + %62 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %63 = OpLoad %float %62 + %64 = OpFNegate %float %63 + %65 = OpFOrdLessThan %bool %60 %64 + OpStore %x_56 %65 + %66 = OpLoad %bool %x_56 + OpStore %x_57_phi %66 + OpBranch %58 + %58 = OpLabel + %67 = OpLoad %bool %x_57_phi + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpConvertSToF %float %72 + %80 = OpConvertSToF %float %74 + %81 = OpConvertSToF %float %76 + %82 = OpConvertSToF %float %78 + %83 = OpCompositeConstruct %v4float %79 %80 %81 %82 + OpStore %x_GLF_color %83 + OpBranch %68 + %70 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %85 + %87 = OpCompositeConstruct %v4float %86 %86 %86 %86 + OpStore %x_GLF_color %87 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %88 +%tint_symbol = OpFunctionParameter %main_out + %92 = OpLabel + %93 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %93 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %95 = OpLabel + %96 = OpFunctionCall %void %main_1 + %98 = OpLoad %v4float %x_GLF_color + %99 = OpCompositeConstruct %main_out %98 + %97 = OpFunctionCall %void %tint_symbol_2 %99 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..0ac797ea58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.spvasm.expected.wgsl @@ -0,0 +1,66 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var f : f32; + var x_56 : bool; + var x_57_phi : bool; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + v = vec4(f32(x_32), f32(x_35), -621.596008301, f32(x_38)); + let x_41 : vec4 = v; + f = atan(trunc(x_41)).z; + let x_45 : f32 = f; + let x_47 : f32 = x_9.x_GLF_uniform_float_values[0]; + let x_49 : bool = (x_45 > -(x_47)); + x_57_phi = x_49; + if (x_49) { + let x_52 : f32 = f; + let x_54 : f32 = x_9.x_GLF_uniform_float_values[1]; + x_56 = (x_52 < -(x_54)); + x_57_phi = x_56; + } + let x_57 : bool = x_57_phi; + if (x_57) { + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_68 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_62), f32(x_65), f32(x_68), f32(x_71)); + } else { + let x_75 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_76 : f32 = f32(x_75); + x_GLF_color = vec4(x_76, x_76, x_76, x_76); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl new file mode 100644 index 0000000000..0ac797ea58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl @@ -0,0 +1,66 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var f : f32; + var x_56 : bool; + var x_57_phi : bool; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + v = vec4(f32(x_32), f32(x_35), -621.596008301, f32(x_38)); + let x_41 : vec4 = v; + f = atan(trunc(x_41)).z; + let x_45 : f32 = f; + let x_47 : f32 = x_9.x_GLF_uniform_float_values[0]; + let x_49 : bool = (x_45 > -(x_47)); + x_57_phi = x_49; + if (x_49) { + let x_52 : f32 = f; + let x_54 : f32 = x_9.x_GLF_uniform_float_values[1]; + x_56 = (x_52 < -(x_54)); + x_57_phi = x_56; + } + let x_57 : bool = x_57_phi; + if (x_57) { + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_68 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_62), f32(x_65), f32(x_68), f32(x_71)); + } else { + let x_75 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_76 : f32 = f32(x_75); + x_GLF_color = vec4(x_76, x_76, x_76, x_76); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..be0338b3f2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.hlsl @@ -0,0 +1,62 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + float f = 0.0f; + bool x_56 = false; + bool x_57_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_32 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_35 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + v = float4(float(x_32), float(x_35), -621.596008301f, float(x_38)); + f = atan(trunc(v)).z; + const float x_45 = f; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const bool x_49 = (x_45 > -(x_47)); + x_57_phi = x_49; + if (x_49) { + const float x_52 = f; + const float x_54 = asfloat(x_9[1].x); + x_56 = (x_52 < -(x_54)); + x_57_phi = x_56; + } + if (x_57_phi) { + const int x_62 = asint(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_65 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_68 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_71 = asint(x_6[1].x); + x_GLF_color = float4(float(x_62), float(x_65), float(x_68), float(x_71)); + } else { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_75 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_76 = float(x_75); + x_GLF_color = float4(x_76, x_76, x_76, x_76); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..7559de0360 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + float f = 0.0f; + bool x_56 = false; + bool x_57_phi = false; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + v = float4(float(x_32), float(x_35), -621.596008301f, float(x_38)); + float4 const x_41 = v; + f = atan(trunc(x_41)).z; + float const x_45 = f; + float const x_47 = x_9.x_GLF_uniform_float_values.arr[0].el; + bool const x_49 = (x_45 > -(x_47)); + x_57_phi = x_49; + if (x_49) { + float const x_52 = f; + float const x_54 = x_9.x_GLF_uniform_float_values.arr[1].el; + x_56 = (x_52 < -(x_54)); + x_57_phi = x_56; + } + bool const x_57 = x_57_phi; + if (x_57) { + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_68 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_71 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_62), float(x_65), float(x_68), float(x_71)); + } else { + int const x_75 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_76 = float(x_75); + *(tint_symbol_4) = float4(x_76, x_76, x_76, x_76); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f01fd576d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.spvasm @@ -0,0 +1,161 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + %49 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %f "f" + OpName %x_56 "x_56" + OpName %x_57_phi "x_57_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %27 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %31 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%float_n621_596008 = OpConstant %float -621.596008 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %88 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %16 + %f = OpVariable %_ptr_Function_float Function %27 + %x_56 = OpVariable %_ptr_Function_bool Function %31 + %x_57_phi = OpVariable %_ptr_Function_bool Function %31 + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpConvertSToF %float %37 + %43 = OpConvertSToF %float %39 + %45 = OpConvertSToF %float %41 + %46 = OpCompositeConstruct %v4float %42 %43 %float_n621_596008 %45 + OpStore %v %46 + %47 = OpLoad %v4float %v + %50 = OpExtInst %v4float %49 Trunc %47 + %48 = OpExtInst %v4float %49 Atan %50 + %51 = OpCompositeExtract %float %48 2 + OpStore %f %51 + %52 = OpLoad %float %f + %54 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpFNegate %float %55 + %57 = OpFOrdGreaterThan %bool %52 %56 + OpStore %x_57_phi %57 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + %60 = OpLoad %float %f + %62 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %63 = OpLoad %float %62 + %64 = OpFNegate %float %63 + %65 = OpFOrdLessThan %bool %60 %64 + OpStore %x_56 %65 + %66 = OpLoad %bool %x_56 + OpStore %x_57_phi %66 + OpBranch %58 + %58 = OpLabel + %67 = OpLoad %bool %x_57_phi + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpConvertSToF %float %72 + %80 = OpConvertSToF %float %74 + %81 = OpConvertSToF %float %76 + %82 = OpConvertSToF %float %78 + %83 = OpCompositeConstruct %v4float %79 %80 %81 %82 + OpStore %x_GLF_color %83 + OpBranch %68 + %70 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %85 + %87 = OpCompositeConstruct %v4float %86 %86 %86 %86 + OpStore %x_GLF_color %87 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %88 +%tint_symbol = OpFunctionParameter %main_out + %92 = OpLabel + %93 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %93 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %95 = OpLabel + %96 = OpFunctionCall %void %main_1 + %98 = OpLoad %v4float %x_GLF_color + %99 = OpCompositeConstruct %main_out %98 + %97 = OpFunctionCall %void %tint_symbol_2 %99 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..0ac797ea58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-atan-trunc-vec4/0-opt.wgsl.expected.wgsl @@ -0,0 +1,66 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var f : f32; + var x_56 : bool; + var x_57_phi : bool; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + v = vec4(f32(x_32), f32(x_35), -621.596008301, f32(x_38)); + let x_41 : vec4 = v; + f = atan(trunc(x_41)).z; + let x_45 : f32 = f; + let x_47 : f32 = x_9.x_GLF_uniform_float_values[0]; + let x_49 : bool = (x_45 > -(x_47)); + x_57_phi = x_49; + if (x_49) { + let x_52 : f32 = f; + let x_54 : f32 = x_9.x_GLF_uniform_float_values[1]; + x_56 = (x_52 < -(x_54)); + x_57_phi = x_56; + } + let x_57 : bool = x_57_phi; + if (x_57) { + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_68 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_62), f32(x_65), f32(x_68), f32(x_71)); + } else { + let x_75 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_76 : f32 = f32(x_75); + x_GLF_color = vec4(x_76, x_76, x_76, x_76); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm new file mode 100644 index 0000000000..3fa5b16796 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm @@ -0,0 +1,90 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_i1_ "func(i1;" + OpName %x "x" + OpName %a "a" + OpName %b "b" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpTypeFunction %int %_ptr_Function_int + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %30 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %12 + %31 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %33 = OpLoad %int %32 + OpStore %b %33 + OpBranch %34 + %34 = OpLabel + %35 = OpPhi %int %33 %31 %36 %34 + OpStore %param %35 + %37 = OpFunctionCall %int %func_i1_ %param + OpStore %a %37 + %36 = OpIAdd %int %35 %int_1 + OpStore %b %36 + %38 = OpSLessThan %bool %36 %int_4 + OpLoopMerge %39 %34 None + OpBranchConditional %38 %34 %39 + %39 = OpLabel + %40 = OpIEqual %bool %37 %int_3 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %43 + %42 = OpLabel + OpStore %_GLF_color %29 + OpBranch %41 + %43 = OpLabel + OpStore %_GLF_color %30 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd + %func_i1_ = OpFunction %int None %15 + %x = OpFunctionParameter %_ptr_Function_int + %44 = OpLabel + %45 = OpLoad %int %x + %46 = OpIEqual %bool %45 %int_10 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + OpKill + %47 = OpLabel + %49 = OpLoad %int %x + OpReturnValue %49 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..847747946d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_i1_(inout int x) { + const int x_45 = x; + if ((x_45 == 10)) { + discard; + } + const int x_49 = x; + return x_49; +} + +void main_1() { + int a = 0; + int b = 0; + int param = 0; + int x_37 = 0; + int x_35_phi = 0; + a = 0; + const int x_33 = asint(x_9[0].x); + b = x_33; + x_35_phi = x_33; + while (true) { + const int x_35 = x_35_phi; + param = x_35; + x_37 = func_i1_(param); + a = x_37; + const int x_36 = (x_35 + 1); + b = x_36; + x_35_phi = x_36; + if ((x_36 < 4)) { + } else { + break; + } + } + if ((x_37 == asint(3))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..66a656e000 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_i1_(thread int* const x) { + int const x_45 = *(x); + if ((x_45 == 10)) { + discard_fragment(); + } + int const x_49 = *(x); + return x_49; +} + +void main_1(constant buf0& x_9, thread float4* const tint_symbol_4) { + int a = 0; + int b = 0; + int param = 0; + int x_37 = 0; + int x_35_phi = 0; + a = 0; + int const x_33 = x_9.zero; + b = x_33; + x_35_phi = x_33; + while (true) { + int const x_35 = x_35_phi; + param = x_35; + x_37 = func_i1_(&(param)); + a = x_37; + int const x_36 = (x_35 + 1); + b = x_36; + x_35_phi = x_36; + if ((x_36 < 4)) { + } else { + break; + } + } + if ((x_37 == as_type(3))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f8a6cead86 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.spvasm @@ -0,0 +1,145 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 80 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_i1_ "func_i1_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %param "param" + OpName %x_37 "x_37" + OpName %x_35_phi "x_35_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpTypeFunction %int %_ptr_Function_int + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %void = OpTypeVoid + %26 = OpTypeFunction %void + %31 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %66 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %67 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %68 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %int None %12 + %x = OpFunctionParameter %_ptr_Function_int + %16 = OpLabel + %18 = OpLoad %int %x + %20 = OpIEqual %bool %18 %int_10 + OpSelectionMerge %22 None + OpBranchConditional %20 %23 %22 + %23 = OpLabel + OpKill + %22 = OpLabel + %25 = OpLoad %int %x + OpReturnValue %25 + OpFunctionEnd + %main_1 = OpFunction %void None %26 + %29 = OpLabel + %a = OpVariable %_ptr_Function_int Function %31 + %b = OpVariable %_ptr_Function_int Function %31 + %param = OpVariable %_ptr_Function_int Function %31 + %x_37 = OpVariable %_ptr_Function_int Function %31 + %x_35_phi = OpVariable %_ptr_Function_int Function %31 + OpStore %a %int_0 + %40 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %41 = OpLoad %int %40 + OpStore %b %41 + OpStore %x_35_phi %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %int %x_35_phi + OpStore %param %46 + %47 = OpFunctionCall %int %func_i1_ %param + OpStore %x_37 %47 + %49 = OpLoad %int %x_37 + OpStore %a %49 + %51 = OpIAdd %int %46 %int_1 + OpStore %b %51 + OpStore %x_35_phi %51 + %53 = OpSLessThan %bool %51 %int_4 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + OpBranch %54 + %56 = OpLabel + OpBranch %43 + %54 = OpLabel + OpBranch %44 + %44 = OpLabel + OpBranch %42 + %43 = OpLabel + %57 = OpLoad %int %x_37 + %58 = OpCopyObject %int %int_3 + %60 = OpIEqual %bool %57 %58 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpStore %x_GLF_color %66 + OpBranch %61 + %63 = OpLabel + OpStore %x_GLF_color %67 + OpBranch %61 + %61 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %68 +%tint_symbol = OpFunctionParameter %main_out + %72 = OpLabel + %73 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %73 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %26 + %75 = OpLabel + %76 = OpFunctionCall %void %main_1 + %78 = OpLoad %v4float %x_GLF_color + %79 = OpCompositeConstruct %main_out %78 + %77 = OpFunctionCall %void %tint_symbol_2 %79 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..39b2064a65 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.spvasm.expected.wgsl @@ -0,0 +1,59 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) -> i32 { + let x_45 : i32 = *(x); + if ((x_45 == 10)) { + discard; + } + let x_49 : i32 = *(x); + return x_49; +} + +fn main_1() { + var a : i32; + var b : i32; + var param : i32; + var x_37 : i32; + var x_35_phi : i32; + a = 0; + let x_33 : i32 = x_9.zero; + b = x_33; + x_35_phi = x_33; + loop { + let x_35 : i32 = x_35_phi; + param = x_35; + x_37 = func_i1_(&(param)); + a = x_37; + let x_36 : i32 = (x_35 + 1); + b = x_36; + x_35_phi = x_36; + if ((x_36 < 4)) { + } else { + break; + } + } + if ((x_37 == bitcast(3))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl new file mode 100644 index 0000000000..39b2064a65 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl @@ -0,0 +1,59 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) -> i32 { + let x_45 : i32 = *(x); + if ((x_45 == 10)) { + discard; + } + let x_49 : i32 = *(x); + return x_49; +} + +fn main_1() { + var a : i32; + var b : i32; + var param : i32; + var x_37 : i32; + var x_35_phi : i32; + a = 0; + let x_33 : i32 = x_9.zero; + b = x_33; + x_35_phi = x_33; + loop { + let x_35 : i32 = x_35_phi; + param = x_35; + x_37 = func_i1_(&(param)); + a = x_37; + let x_36 : i32 = (x_35 + 1); + b = x_36; + x_35_phi = x_36; + if ((x_36 < 4)) { + } else { + break; + } + } + if ((x_37 == bitcast(3))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..847747946d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_i1_(inout int x) { + const int x_45 = x; + if ((x_45 == 10)) { + discard; + } + const int x_49 = x; + return x_49; +} + +void main_1() { + int a = 0; + int b = 0; + int param = 0; + int x_37 = 0; + int x_35_phi = 0; + a = 0; + const int x_33 = asint(x_9[0].x); + b = x_33; + x_35_phi = x_33; + while (true) { + const int x_35 = x_35_phi; + param = x_35; + x_37 = func_i1_(param); + a = x_37; + const int x_36 = (x_35 + 1); + b = x_36; + x_35_phi = x_36; + if ((x_36 < 4)) { + } else { + break; + } + } + if ((x_37 == asint(3))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..66a656e000 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_i1_(thread int* const x) { + int const x_45 = *(x); + if ((x_45 == 10)) { + discard_fragment(); + } + int const x_49 = *(x); + return x_49; +} + +void main_1(constant buf0& x_9, thread float4* const tint_symbol_4) { + int a = 0; + int b = 0; + int param = 0; + int x_37 = 0; + int x_35_phi = 0; + a = 0; + int const x_33 = x_9.zero; + b = x_33; + x_35_phi = x_33; + while (true) { + int const x_35 = x_35_phi; + param = x_35; + x_37 = func_i1_(&(param)); + a = x_37; + int const x_36 = (x_35 + 1); + b = x_36; + x_35_phi = x_36; + if ((x_36 < 4)) { + } else { + break; + } + } + if ((x_37 == as_type(3))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f8a6cead86 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.spvasm @@ -0,0 +1,145 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 80 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_i1_ "func_i1_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %param "param" + OpName %x_37 "x_37" + OpName %x_35_phi "x_35_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpTypeFunction %int %_ptr_Function_int + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %void = OpTypeVoid + %26 = OpTypeFunction %void + %31 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %66 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %67 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %68 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %int None %12 + %x = OpFunctionParameter %_ptr_Function_int + %16 = OpLabel + %18 = OpLoad %int %x + %20 = OpIEqual %bool %18 %int_10 + OpSelectionMerge %22 None + OpBranchConditional %20 %23 %22 + %23 = OpLabel + OpKill + %22 = OpLabel + %25 = OpLoad %int %x + OpReturnValue %25 + OpFunctionEnd + %main_1 = OpFunction %void None %26 + %29 = OpLabel + %a = OpVariable %_ptr_Function_int Function %31 + %b = OpVariable %_ptr_Function_int Function %31 + %param = OpVariable %_ptr_Function_int Function %31 + %x_37 = OpVariable %_ptr_Function_int Function %31 + %x_35_phi = OpVariable %_ptr_Function_int Function %31 + OpStore %a %int_0 + %40 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %41 = OpLoad %int %40 + OpStore %b %41 + OpStore %x_35_phi %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %int %x_35_phi + OpStore %param %46 + %47 = OpFunctionCall %int %func_i1_ %param + OpStore %x_37 %47 + %49 = OpLoad %int %x_37 + OpStore %a %49 + %51 = OpIAdd %int %46 %int_1 + OpStore %b %51 + OpStore %x_35_phi %51 + %53 = OpSLessThan %bool %51 %int_4 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + OpBranch %54 + %56 = OpLabel + OpBranch %43 + %54 = OpLabel + OpBranch %44 + %44 = OpLabel + OpBranch %42 + %43 = OpLabel + %57 = OpLoad %int %x_37 + %58 = OpCopyObject %int %int_3 + %60 = OpIEqual %bool %57 %58 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpStore %x_GLF_color %66 + OpBranch %61 + %63 = OpLabel + OpStore %x_GLF_color %67 + OpBranch %61 + %61 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %68 +%tint_symbol = OpFunctionParameter %main_out + %72 = OpLabel + %73 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %73 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %26 + %75 = OpLabel + %76 = OpFunctionCall %void %main_1 + %78 = OpLoad %v4float %x_GLF_color + %79 = OpCompositeConstruct %main_out %78 + %77 = OpFunctionCall %void %tint_symbol_2 %79 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..39b2064a65 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-basic-block-discard-in-function/0-opt.wgsl.expected.wgsl @@ -0,0 +1,59 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) -> i32 { + let x_45 : i32 = *(x); + if ((x_45 == 10)) { + discard; + } + let x_49 : i32 = *(x); + return x_49; +} + +fn main_1() { + var a : i32; + var b : i32; + var param : i32; + var x_37 : i32; + var x_35_phi : i32; + a = 0; + let x_33 : i32 = x_9.zero; + b = x_33; + x_35_phi = x_33; + loop { + let x_35 : i32 = x_35_phi; + param = x_35; + x_37 = func_i1_(&(param)); + a = x_37; + let x_36 : i32 = (x_35 + 1); + b = x_36; + x_35_phi = x_36; + if ((x_36 < 4)) { + } else { + break; + } + } + if ((x_37 == bitcast(3))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm new file mode 100644 index 0000000000..08cec7ec9a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm @@ -0,0 +1,133 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f1_ "f1(" + OpName %a "a" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %a_0 "a" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %18 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %16 + %37 = OpLabel + %a_0 = OpVariable %_ptr_Function_int Function + %38 = OpFunctionCall %int %f1_ + OpStore %a_0 %38 + %39 = OpLoad %int %a_0 + %40 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %41 = OpLoad %int %40 + %42 = OpIEqual %bool %39 %41 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpConvertSToF %float %47 + %49 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpConvertSToF %float %56 + %58 = OpCompositeConstruct %v4float %48 %51 %54 %57 + OpStore %_GLF_color %58 + OpBranch %43 + %45 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpCompositeConstruct %v4float %61 %61 %61 %61 + OpStore %_GLF_color %62 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd + %f1_ = OpFunction %int None %18 + %63 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %a %int_256 + %64 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %67 = OpLoad %float %66 + %68 = OpFOrdGreaterThan %bool %65 %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + %71 = OpLoad %int %a + %72 = OpIAdd %int %71 %int_1 + OpStore %a %72 + OpBranch %69 + %69 = OpLabel + %73 = OpLoad %int %a + %74 = OpBitCount %int %73 + OpStore %i %74 + %75 = OpLoad %int %i + %76 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %77 = OpLoad %int %76 + %78 = OpSLessThan %bool %75 %77 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %82 = OpLoad %int %81 + OpReturnValue %82 + %79 = OpLabel + %83 = OpLoad %int %i + OpReturnValue %83 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ff5511e11a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.hlsl @@ -0,0 +1,71 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int f1_() { + int a = 0; + int i = 0; + a = 256; + const float x_65 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_67 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_65 > x_67)) { + a = (a + 1); + } + i = countbits(a); + const int x_75 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_77 = asint(x_11[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_75 < x_77)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_82 = asint(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + return x_82; + } + return i; +} + +void main_1() { + int a_1 = 0; + const int x_38 = f1_(); + a_1 = x_38; + const int x_39 = a_1; + const int x_41 = asint(x_11[2].x); + if ((x_39 == x_41)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_11[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_50 = asint(x_11[1].x); + const int x_53 = asint(x_11[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_11[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_47), float(x_50), float(x_53), float(x_56)); + } else { + const int x_60 = asint(x_11[1].x); + const float x_61 = float(x_60); + x_GLF_color = float4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..cbab4dbd15 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.msl @@ -0,0 +1,82 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int f1_(constant buf0& x_8, constant buf1& x_11, thread float4* const tint_symbol_5) { + int a = 0; + int i = 0; + a = 256; + float const x_65 = (*(tint_symbol_5)).y; + float const x_67 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_65 > x_67)) { + int const x_71 = a; + a = (x_71 + 1); + } + int const x_73 = a; + i = popcount(x_73); + int const x_75 = i; + int const x_77 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_75 < x_77)) { + int const x_82 = x_11.x_GLF_uniform_int_values.arr[0].el; + return x_82; + } + int const x_83 = i; + return x_83; +} + +void main_1(constant buf0& x_8, constant buf1& x_11, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int a_1 = 0; + int const x_38 = f1_(x_8, x_11, tint_symbol_6); + a_1 = x_38; + int const x_39 = a_1; + int const x_41 = x_11.x_GLF_uniform_int_values.arr[2].el; + if ((x_39 == x_41)) { + int const x_47 = x_11.x_GLF_uniform_int_values.arr[0].el; + int const x_50 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_53 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_11.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_7) = float4(float(x_47), float(x_50), float(x_53), float(x_56)); + } else { + int const x_60 = x_11.x_GLF_uniform_int_values.arr[1].el; + float const x_61 = float(x_60); + *(tint_symbol_7) = float4(x_61, x_61, x_61, x_61); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_8, x_11, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f6ad90124e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.spvasm @@ -0,0 +1,171 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 102 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %f1_ "f1_" + OpName %a "a" + OpName %i "i" + OpName %main_1 "main_1" + OpName %a_1 "a_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %23 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %int_256 = OpConstant %int 256 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %void = OpTypeVoid + %58 = OpTypeFunction %void + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %89 = OpTypeFunction %void %main_out + %f1_ = OpFunction %int None %23 + %25 = OpLabel + %a = OpVariable %_ptr_Function_int Function %28 + %i = OpVariable %_ptr_Function_int Function %28 + OpStore %a %int_256 + %32 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %33 = OpLoad %float %32 + %37 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpFOrdGreaterThan %bool %33 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %41 + %42 = OpLabel + %43 = OpLoad %int %a + %45 = OpIAdd %int %43 %int_1 + OpStore %a %45 + OpBranch %41 + %41 = OpLabel + %46 = OpLoad %int %a + %47 = OpBitCount %int %46 + OpStore %i %47 + %48 = OpLoad %int %i + %50 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpSLessThan %bool %48 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %56 = OpLoad %int %55 + OpReturnValue %56 + %53 = OpLabel + %57 = OpLoad %int %i + OpReturnValue %57 + OpFunctionEnd + %main_1 = OpFunction %void None %58 + %61 = OpLabel + %a_1 = OpVariable %_ptr_Function_int Function %28 + %63 = OpFunctionCall %int %f1_ + OpStore %a_1 %63 + %64 = OpLoad %int %a_1 + %66 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_2 + %67 = OpLoad %int %66 + %68 = OpIEqual %bool %64 %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %79 = OpLoad %int %78 + %80 = OpConvertSToF %float %73 + %81 = OpConvertSToF %float %75 + %82 = OpConvertSToF %float %77 + %83 = OpConvertSToF %float %79 + %84 = OpCompositeConstruct %v4float %80 %81 %82 %83 + OpStore %x_GLF_color %84 + OpBranch %69 + %71 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %86 + %88 = OpCompositeConstruct %v4float %87 %87 %87 %87 + OpStore %x_GLF_color %88 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %89 +%tint_symbol_1 = OpFunctionParameter %main_out + %93 = OpLabel + %94 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %94 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %58 + %96 = OpLabel + %97 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %97 + %98 = OpFunctionCall %void %main_1 + %100 = OpLoad %v4float %x_GLF_color + %101 = OpCompositeConstruct %main_out %100 + %99 = OpFunctionCall %void %tint_symbol_3 %101 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a14b4cb154 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.spvasm.expected.wgsl @@ -0,0 +1,75 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +fn f1_() -> i32 { + var a : i32; + var i : i32; + a = 256; + let x_65 : f32 = gl_FragCoord.y; + let x_67 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_65 > x_67)) { + let x_71 : i32 = a; + a = (x_71 + 1); + } + let x_73 : i32 = a; + i = countOneBits(x_73); + let x_75 : i32 = i; + let x_77 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_75 < x_77)) { + let x_82 : i32 = x_11.x_GLF_uniform_int_values[0]; + return x_82; + } + let x_83 : i32 = i; + return x_83; +} + +fn main_1() { + var a_1 : i32; + let x_38 : i32 = f1_(); + a_1 = x_38; + let x_39 : i32 = a_1; + let x_41 : i32 = x_11.x_GLF_uniform_int_values[2]; + if ((x_39 == x_41)) { + let x_47 : i32 = x_11.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_11.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_47), f32(x_50), f32(x_53), f32(x_56)); + } else { + let x_60 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_61 : f32 = f32(x_60); + x_GLF_color = vec4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl new file mode 100644 index 0000000000..a14b4cb154 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl @@ -0,0 +1,75 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +fn f1_() -> i32 { + var a : i32; + var i : i32; + a = 256; + let x_65 : f32 = gl_FragCoord.y; + let x_67 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_65 > x_67)) { + let x_71 : i32 = a; + a = (x_71 + 1); + } + let x_73 : i32 = a; + i = countOneBits(x_73); + let x_75 : i32 = i; + let x_77 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_75 < x_77)) { + let x_82 : i32 = x_11.x_GLF_uniform_int_values[0]; + return x_82; + } + let x_83 : i32 = i; + return x_83; +} + +fn main_1() { + var a_1 : i32; + let x_38 : i32 = f1_(); + a_1 = x_38; + let x_39 : i32 = a_1; + let x_41 : i32 = x_11.x_GLF_uniform_int_values[2]; + if ((x_39 == x_41)) { + let x_47 : i32 = x_11.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_11.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_47), f32(x_50), f32(x_53), f32(x_56)); + } else { + let x_60 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_61 : f32 = f32(x_60); + x_GLF_color = vec4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..ff5511e11a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.hlsl @@ -0,0 +1,71 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int f1_() { + int a = 0; + int i = 0; + a = 256; + const float x_65 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_67 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_65 > x_67)) { + a = (a + 1); + } + i = countbits(a); + const int x_75 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_77 = asint(x_11[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_75 < x_77)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_82 = asint(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + return x_82; + } + return i; +} + +void main_1() { + int a_1 = 0; + const int x_38 = f1_(); + a_1 = x_38; + const int x_39 = a_1; + const int x_41 = asint(x_11[2].x); + if ((x_39 == x_41)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_11[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_50 = asint(x_11[1].x); + const int x_53 = asint(x_11[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_11[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_47), float(x_50), float(x_53), float(x_56)); + } else { + const int x_60 = asint(x_11[1].x); + const float x_61 = float(x_60); + x_GLF_color = float4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..cbab4dbd15 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.msl @@ -0,0 +1,82 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int f1_(constant buf0& x_8, constant buf1& x_11, thread float4* const tint_symbol_5) { + int a = 0; + int i = 0; + a = 256; + float const x_65 = (*(tint_symbol_5)).y; + float const x_67 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_65 > x_67)) { + int const x_71 = a; + a = (x_71 + 1); + } + int const x_73 = a; + i = popcount(x_73); + int const x_75 = i; + int const x_77 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_75 < x_77)) { + int const x_82 = x_11.x_GLF_uniform_int_values.arr[0].el; + return x_82; + } + int const x_83 = i; + return x_83; +} + +void main_1(constant buf0& x_8, constant buf1& x_11, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int a_1 = 0; + int const x_38 = f1_(x_8, x_11, tint_symbol_6); + a_1 = x_38; + int const x_39 = a_1; + int const x_41 = x_11.x_GLF_uniform_int_values.arr[2].el; + if ((x_39 == x_41)) { + int const x_47 = x_11.x_GLF_uniform_int_values.arr[0].el; + int const x_50 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_53 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_11.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_7) = float4(float(x_47), float(x_50), float(x_53), float(x_56)); + } else { + int const x_60 = x_11.x_GLF_uniform_int_values.arr[1].el; + float const x_61 = float(x_60); + *(tint_symbol_7) = float4(x_61, x_61, x_61, x_61); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_8, x_11, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f6ad90124e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.spvasm @@ -0,0 +1,171 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 102 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %f1_ "f1_" + OpName %a "a" + OpName %i "i" + OpName %main_1 "main_1" + OpName %a_1 "a_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %23 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %int_256 = OpConstant %int 256 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %void = OpTypeVoid + %58 = OpTypeFunction %void + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %89 = OpTypeFunction %void %main_out + %f1_ = OpFunction %int None %23 + %25 = OpLabel + %a = OpVariable %_ptr_Function_int Function %28 + %i = OpVariable %_ptr_Function_int Function %28 + OpStore %a %int_256 + %32 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %33 = OpLoad %float %32 + %37 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpFOrdGreaterThan %bool %33 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %41 + %42 = OpLabel + %43 = OpLoad %int %a + %45 = OpIAdd %int %43 %int_1 + OpStore %a %45 + OpBranch %41 + %41 = OpLabel + %46 = OpLoad %int %a + %47 = OpBitCount %int %46 + OpStore %i %47 + %48 = OpLoad %int %i + %50 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpSLessThan %bool %48 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %56 = OpLoad %int %55 + OpReturnValue %56 + %53 = OpLabel + %57 = OpLoad %int %i + OpReturnValue %57 + OpFunctionEnd + %main_1 = OpFunction %void None %58 + %61 = OpLabel + %a_1 = OpVariable %_ptr_Function_int Function %28 + %63 = OpFunctionCall %int %f1_ + OpStore %a_1 %63 + %64 = OpLoad %int %a_1 + %66 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_2 + %67 = OpLoad %int %66 + %68 = OpIEqual %bool %64 %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %79 = OpLoad %int %78 + %80 = OpConvertSToF %float %73 + %81 = OpConvertSToF %float %75 + %82 = OpConvertSToF %float %77 + %83 = OpConvertSToF %float %79 + %84 = OpCompositeConstruct %v4float %80 %81 %82 %83 + OpStore %x_GLF_color %84 + OpBranch %69 + %71 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %86 + %88 = OpCompositeConstruct %v4float %87 %87 %87 %87 + OpStore %x_GLF_color %88 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %89 +%tint_symbol_1 = OpFunctionParameter %main_out + %93 = OpLabel + %94 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %94 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %58 + %96 = OpLabel + %97 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %97 + %98 = OpFunctionCall %void %main_1 + %100 = OpLoad %v4float %x_GLF_color + %101 = OpCompositeConstruct %main_out %100 + %99 = OpFunctionCall %void %tint_symbol_3 %101 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a14b4cb154 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitcount/0-opt.wgsl.expected.wgsl @@ -0,0 +1,75 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +fn f1_() -> i32 { + var a : i32; + var i : i32; + a = 256; + let x_65 : f32 = gl_FragCoord.y; + let x_67 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_65 > x_67)) { + let x_71 : i32 = a; + a = (x_71 + 1); + } + let x_73 : i32 = a; + i = countOneBits(x_73); + let x_75 : i32 = i; + let x_77 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_75 < x_77)) { + let x_82 : i32 = x_11.x_GLF_uniform_int_values[0]; + return x_82; + } + let x_83 : i32 = i; + return x_83; +} + +fn main_1() { + var a_1 : i32; + let x_38 : i32 = f1_(); + a_1 = x_38; + let x_39 : i32 = a_1; + let x_41 : i32 = x_11.x_GLF_uniform_int_values[2]; + if ((x_39 == x_41)) { + let x_47 : i32 = x_11.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_11.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_47), f32(x_50), f32(x_53), f32(x_56)); + } else { + let x_60 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_61 : f32 = f32(x_60); + x_GLF_color = vec4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm new file mode 100644 index 0000000000..cc1186f93f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm @@ -0,0 +1,91 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %8 + %22 = OpLabel + %23 = OpBitReverse %int %int_1 + %24 = OpExtInst %int %1 SMin %int_1 %23 + %25 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %26 = OpLoad %int %25 + OpBranch %27 + %27 = OpLabel + %28 = OpPhi %int %26 %22 %29 %30 + %31 = OpPhi %int %int_1 %22 %32 %30 + %33 = OpISub %int %24 %int_1 + %34 = OpSLessThanEqual %bool %31 %33 + OpLoopMerge %35 %30 None + OpBranchConditional %34 %36 %35 + %36 = OpLabel + %29 = OpIAdd %int %28 %31 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpIEqual %bool %38 %int_1 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + OpBranch %35 + %40 = OpLabel + OpBranch %30 + %30 = OpLabel + %32 = OpIAdd %int %31 %int_1 + OpBranch %27 + %35 = OpLabel + %42 = OpPhi %int %28 %27 %29 %41 + %43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %44 = OpLoad %int %43 + %45 = OpIEqual %bool %42 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpCompositeConstruct %v4float %51 %54 %54 %51 + OpStore %_GLF_color %55 + OpBranch %46 + %48 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpCompositeConstruct %v4float %58 %58 %58 %58 + OpStore %_GLF_color %59 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..d241a8e85c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.hlsl @@ -0,0 +1,67 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_28 = 0; + int x_29 = 0; + int x_28_phi = 0; + int x_31_phi = 0; + int x_42_phi = 0; + const int x_24 = min(1, reversebits(1)); + const int x_26 = asint(x_5[3].x); + x_28_phi = x_26; + x_31_phi = 1; + while (true) { + int x_32 = 0; + x_28 = x_28_phi; + const int x_31 = x_31_phi; + x_42_phi = x_28; + if ((x_31 <= (x_24 - 1))) { + } else { + break; + } + x_29 = asint((x_28 + asint(x_31))); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_38 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + if ((x_38 == 1)) { + x_42_phi = x_29; + break; + } + { + x_32 = (x_31 + 1); + x_28_phi = x_29; + x_31_phi = x_32; + } + } + const int x_42 = x_42_phi; + const int x_44 = asint(x_5[2].x); + if ((x_42 == x_44)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_51 = float(x_50); + const int x_53 = asint(x_5[1].x); + const float x_54 = float(x_53); + x_GLF_color = float4(x_51, x_54, x_54, x_51); + } else { + const int x_57 = asint(x_5[1].x); + const float x_58 = float(x_57); + x_GLF_color = float4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.msl new file mode 100644 index 0000000000..971d8fe009 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int x_28 = 0; + int x_29 = 0; + int x_28_phi = 0; + int x_31_phi = 0; + int x_42_phi = 0; + int const x_24 = min(1, reverse_bits(1)); + int const x_26 = x_5.x_GLF_uniform_int_values.arr[3].el; + x_28_phi = x_26; + x_31_phi = 1; + while (true) { + int x_32 = 0; + x_28 = x_28_phi; + int const x_31 = x_31_phi; + x_42_phi = x_28; + if ((x_31 <= (x_24 - 1))) { + } else { + break; + } + x_29 = as_type((x_28 + as_type(x_31))); + int const x_38 = x_5.x_GLF_uniform_int_values.arr[0].el; + if ((x_38 == 1)) { + x_42_phi = x_29; + break; + } + { + x_32 = (x_31 + 1); + x_28_phi = x_29; + x_31_phi = x_32; + } + } + int const x_42 = x_42_phi; + int const x_44 = x_5.x_GLF_uniform_int_values.arr[2].el; + if ((x_42 == x_44)) { + int const x_50 = x_5.x_GLF_uniform_int_values.arr[0].el; + float const x_51 = float(x_50); + int const x_53 = x_5.x_GLF_uniform_int_values.arr[1].el; + float const x_54 = float(x_53); + *(tint_symbol_4) = float4(x_51, x_54, x_54, x_51); + } else { + int const x_57 = x_5.x_GLF_uniform_int_values.arr[1].el; + float const x_58 = float(x_57); + *(tint_symbol_4) = float4(x_58, x_58, x_58, x_58); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..5d23f771a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.spvasm @@ -0,0 +1,161 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 94 +; Schema: 0 + OpCapability Shader + %27 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_28 "x_28" + OpName %x_29 "x_29" + OpName %x_28_phi "x_28_phi" + OpName %x_31_phi "x_31_phi" + OpName %x_42_phi "x_42_phi" + OpName %x_32 "x_32" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %82 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_28 = OpVariable %_ptr_Function_int Function %21 + %x_29 = OpVariable %_ptr_Function_int Function %21 + %x_28_phi = OpVariable %_ptr_Function_int Function %21 + %x_31_phi = OpVariable %_ptr_Function_int Function %21 + %x_42_phi = OpVariable %_ptr_Function_int Function %21 + %x_32 = OpVariable %_ptr_Function_int Function %21 + %29 = OpBitReverse %int %int_1 + %26 = OpExtInst %int %27 SMin %int_1 %29 + %33 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_3 + %34 = OpLoad %int %33 + OpStore %x_28_phi %34 + OpStore %x_31_phi %int_1 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %40 = OpLoad %int %x_28_phi + OpStore %x_28 %40 + %41 = OpLoad %int %x_31_phi + %42 = OpLoad %int %x_28 + OpStore %x_42_phi %42 + %43 = OpISub %int %26 %int_1 + %44 = OpSLessThanEqual %bool %41 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %36 + %46 = OpLabel + %50 = OpLoad %int %x_28 + %51 = OpCopyObject %int %41 + %52 = OpIAdd %int %50 %51 + %49 = OpCopyObject %int %52 + OpStore %x_29 %49 + %54 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpIEqual %bool %55 %int_1 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + %59 = OpLoad %int %x_29 + OpStore %x_42_phi %59 + OpBranch %36 + %57 = OpLabel + OpBranch %37 + %37 = OpLabel + %60 = OpIAdd %int %41 %int_1 + OpStore %x_32 %60 + %61 = OpLoad %int %x_29 + OpStore %x_28_phi %61 + %62 = OpLoad %int %x_32 + OpStore %x_31_phi %62 + OpBranch %35 + %36 = OpLabel + %63 = OpLoad %int %x_42_phi + %65 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpIEqual %bool %63 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpCompositeConstruct %v4float %73 %76 %76 %73 + OpStore %x_GLF_color %77 + OpBranch %68 + %70 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpConvertSToF %float %79 + %81 = OpCompositeConstruct %v4float %80 %80 %80 %80 + OpStore %x_GLF_color %81 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %82 +%tint_symbol = OpFunctionParameter %main_out + %86 = OpLabel + %87 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %87 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %89 = OpLabel + %90 = OpFunctionCall %void %main_1 + %92 = OpLoad %v4float %x_GLF_color + %93 = OpCompositeConstruct %main_out %92 + %91 = OpFunctionCall %void %tint_symbol_2 %93 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..c0b46ef12d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.spvasm.expected.wgsl @@ -0,0 +1,69 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_28 : i32; + var x_29 : i32; + var x_28_phi : i32; + var x_31_phi : i32; + var x_42_phi : i32; + let x_24 : i32 = min(1, reverseBits(1)); + let x_26 : i32 = x_5.x_GLF_uniform_int_values[3]; + x_28_phi = x_26; + x_31_phi = 1; + loop { + var x_32 : i32; + x_28 = x_28_phi; + let x_31 : i32 = x_31_phi; + x_42_phi = x_28; + if ((x_31 <= (x_24 - 1))) { + } else { + break; + } + x_29 = bitcast((x_28 + bitcast(x_31))); + let x_38 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_38 == 1)) { + x_42_phi = x_29; + break; + } + + continuing { + x_32 = (x_31 + 1); + x_28_phi = x_29; + x_31_phi = x_32; + } + } + let x_42 : i32 = x_42_phi; + let x_44 : i32 = x_5.x_GLF_uniform_int_values[2]; + if ((x_42 == x_44)) { + let x_50 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_51 : f32 = f32(x_50); + let x_53 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_54 : f32 = f32(x_53); + x_GLF_color = vec4(x_51, x_54, x_54, x_51); + } else { + let x_57 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl new file mode 100644 index 0000000000..c0b46ef12d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl @@ -0,0 +1,69 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_28 : i32; + var x_29 : i32; + var x_28_phi : i32; + var x_31_phi : i32; + var x_42_phi : i32; + let x_24 : i32 = min(1, reverseBits(1)); + let x_26 : i32 = x_5.x_GLF_uniform_int_values[3]; + x_28_phi = x_26; + x_31_phi = 1; + loop { + var x_32 : i32; + x_28 = x_28_phi; + let x_31 : i32 = x_31_phi; + x_42_phi = x_28; + if ((x_31 <= (x_24 - 1))) { + } else { + break; + } + x_29 = bitcast((x_28 + bitcast(x_31))); + let x_38 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_38 == 1)) { + x_42_phi = x_29; + break; + } + + continuing { + x_32 = (x_31 + 1); + x_28_phi = x_29; + x_31_phi = x_32; + } + } + let x_42 : i32 = x_42_phi; + let x_44 : i32 = x_5.x_GLF_uniform_int_values[2]; + if ((x_42 == x_44)) { + let x_50 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_51 : f32 = f32(x_50); + let x_53 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_54 : f32 = f32(x_53); + x_GLF_color = vec4(x_51, x_54, x_54, x_51); + } else { + let x_57 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..d241a8e85c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.hlsl @@ -0,0 +1,67 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_28 = 0; + int x_29 = 0; + int x_28_phi = 0; + int x_31_phi = 0; + int x_42_phi = 0; + const int x_24 = min(1, reversebits(1)); + const int x_26 = asint(x_5[3].x); + x_28_phi = x_26; + x_31_phi = 1; + while (true) { + int x_32 = 0; + x_28 = x_28_phi; + const int x_31 = x_31_phi; + x_42_phi = x_28; + if ((x_31 <= (x_24 - 1))) { + } else { + break; + } + x_29 = asint((x_28 + asint(x_31))); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_38 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + if ((x_38 == 1)) { + x_42_phi = x_29; + break; + } + { + x_32 = (x_31 + 1); + x_28_phi = x_29; + x_31_phi = x_32; + } + } + const int x_42 = x_42_phi; + const int x_44 = asint(x_5[2].x); + if ((x_42 == x_44)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_51 = float(x_50); + const int x_53 = asint(x_5[1].x); + const float x_54 = float(x_53); + x_GLF_color = float4(x_51, x_54, x_54, x_51); + } else { + const int x_57 = asint(x_5[1].x); + const float x_58 = float(x_57); + x_GLF_color = float4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.msl new file mode 100644 index 0000000000..971d8fe009 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int x_28 = 0; + int x_29 = 0; + int x_28_phi = 0; + int x_31_phi = 0; + int x_42_phi = 0; + int const x_24 = min(1, reverse_bits(1)); + int const x_26 = x_5.x_GLF_uniform_int_values.arr[3].el; + x_28_phi = x_26; + x_31_phi = 1; + while (true) { + int x_32 = 0; + x_28 = x_28_phi; + int const x_31 = x_31_phi; + x_42_phi = x_28; + if ((x_31 <= (x_24 - 1))) { + } else { + break; + } + x_29 = as_type((x_28 + as_type(x_31))); + int const x_38 = x_5.x_GLF_uniform_int_values.arr[0].el; + if ((x_38 == 1)) { + x_42_phi = x_29; + break; + } + { + x_32 = (x_31 + 1); + x_28_phi = x_29; + x_31_phi = x_32; + } + } + int const x_42 = x_42_phi; + int const x_44 = x_5.x_GLF_uniform_int_values.arr[2].el; + if ((x_42 == x_44)) { + int const x_50 = x_5.x_GLF_uniform_int_values.arr[0].el; + float const x_51 = float(x_50); + int const x_53 = x_5.x_GLF_uniform_int_values.arr[1].el; + float const x_54 = float(x_53); + *(tint_symbol_4) = float4(x_51, x_54, x_54, x_51); + } else { + int const x_57 = x_5.x_GLF_uniform_int_values.arr[1].el; + float const x_58 = float(x_57); + *(tint_symbol_4) = float4(x_58, x_58, x_58, x_58); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d23f771a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.spvasm @@ -0,0 +1,161 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 94 +; Schema: 0 + OpCapability Shader + %27 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_28 "x_28" + OpName %x_29 "x_29" + OpName %x_28_phi "x_28_phi" + OpName %x_31_phi "x_31_phi" + OpName %x_42_phi "x_42_phi" + OpName %x_32 "x_32" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %82 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_28 = OpVariable %_ptr_Function_int Function %21 + %x_29 = OpVariable %_ptr_Function_int Function %21 + %x_28_phi = OpVariable %_ptr_Function_int Function %21 + %x_31_phi = OpVariable %_ptr_Function_int Function %21 + %x_42_phi = OpVariable %_ptr_Function_int Function %21 + %x_32 = OpVariable %_ptr_Function_int Function %21 + %29 = OpBitReverse %int %int_1 + %26 = OpExtInst %int %27 SMin %int_1 %29 + %33 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_3 + %34 = OpLoad %int %33 + OpStore %x_28_phi %34 + OpStore %x_31_phi %int_1 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %40 = OpLoad %int %x_28_phi + OpStore %x_28 %40 + %41 = OpLoad %int %x_31_phi + %42 = OpLoad %int %x_28 + OpStore %x_42_phi %42 + %43 = OpISub %int %26 %int_1 + %44 = OpSLessThanEqual %bool %41 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %36 + %46 = OpLabel + %50 = OpLoad %int %x_28 + %51 = OpCopyObject %int %41 + %52 = OpIAdd %int %50 %51 + %49 = OpCopyObject %int %52 + OpStore %x_29 %49 + %54 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpIEqual %bool %55 %int_1 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + %59 = OpLoad %int %x_29 + OpStore %x_42_phi %59 + OpBranch %36 + %57 = OpLabel + OpBranch %37 + %37 = OpLabel + %60 = OpIAdd %int %41 %int_1 + OpStore %x_32 %60 + %61 = OpLoad %int %x_29 + OpStore %x_28_phi %61 + %62 = OpLoad %int %x_32 + OpStore %x_31_phi %62 + OpBranch %35 + %36 = OpLabel + %63 = OpLoad %int %x_42_phi + %65 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpIEqual %bool %63 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpCompositeConstruct %v4float %73 %76 %76 %73 + OpStore %x_GLF_color %77 + OpBranch %68 + %70 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpConvertSToF %float %79 + %81 = OpCompositeConstruct %v4float %80 %80 %80 %80 + OpStore %x_GLF_color %81 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %82 +%tint_symbol = OpFunctionParameter %main_out + %86 = OpLabel + %87 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %87 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %89 = OpLabel + %90 = OpFunctionCall %void %main_1 + %92 = OpLoad %v4float %x_GLF_color + %93 = OpCompositeConstruct %main_out %92 + %91 = OpFunctionCall %void %tint_symbol_2 %93 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..c0b46ef12d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitfieldreverse-loop-limit-underflow/0.wgsl.expected.wgsl @@ -0,0 +1,69 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_28 : i32; + var x_29 : i32; + var x_28_phi : i32; + var x_31_phi : i32; + var x_42_phi : i32; + let x_24 : i32 = min(1, reverseBits(1)); + let x_26 : i32 = x_5.x_GLF_uniform_int_values[3]; + x_28_phi = x_26; + x_31_phi = 1; + loop { + var x_32 : i32; + x_28 = x_28_phi; + let x_31 : i32 = x_31_phi; + x_42_phi = x_28; + if ((x_31 <= (x_24 - 1))) { + } else { + break; + } + x_29 = bitcast((x_28 + bitcast(x_31))); + let x_38 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_38 == 1)) { + x_42_phi = x_29; + break; + } + + continuing { + x_32 = (x_31 + 1); + x_28_phi = x_29; + x_31_phi = x_32; + } + } + let x_42 : i32 = x_42_phi; + let x_44 : i32 = x_5.x_GLF_uniform_int_values[2]; + if ((x_42 == x_44)) { + let x_50 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_51 : f32 = f32(x_50); + let x_53 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_54 : f32 = f32(x_53); + x_GLF_color = vec4(x_51, x_54, x_54, x_51); + } else { + let x_57 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm new file mode 100644 index 0000000000..5b2a258628 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm @@ -0,0 +1,119 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zero" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__1 "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 2 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %_ = OpVariable %_ptr_Uniform_buf2 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__1 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %31 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %32 = OpVariable %_ptr_Function_int Function + %33 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %34 = OpLoad %float %33 + %35 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %36 = OpLoad %float %35 + %37 = OpFOrdLessThan %bool %34 %36 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %40 + %39 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %42 = OpLoad %int %41 + OpStore %32 %42 + OpBranch %38 + %40 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %44 = OpLoad %int %43 + OpStore %32 %44 + OpBranch %38 + %38 = OpLabel + %45 = OpLoad %int %32 + %46 = OpBitwiseOr %int %45 %int_1 + %47 = OpNot %int %46 + OpStore %a %47 + %48 = OpLoad %int %a + %49 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpNot %int %50 + %52 = OpIEqual %bool %48 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpConvertSToF %float %63 + %65 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + %68 = OpCompositeConstruct %v4float %58 %61 %64 %67 + OpStore %_GLF_color %68 + OpBranch %53 + %55 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %70 + %72 = OpCompositeConstruct %v4float %71 %71 %71 %71 + OpStore %_GLF_color %72 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..53fa4d4454 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_6 : register(b2, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int x_32 = 0; + const float x_34 = asfloat(x_6[0].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_34 < x_36)) { + const int x_42 = asint(x_10[1].x); + x_32 = x_42; + } else { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_44 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_32 = x_44; + } + a = ~((x_32 | 1)); + const int x_48 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_48 == ~(x_50))) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_60 = asint(x_10[1].x); + const int x_63 = asint(x_10[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_66 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_57), float(x_60), float(x_63), float(x_66)); + } else { + const int x_70 = asint(x_10[1].x); + const float x_71 = float(x_70); + x_GLF_color = float4(x_71, x_71, x_71, x_71); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d5bab816b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct buf2 { + /* 0x0000 */ float zero; +}; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf2& x_6, constant buf0& x_8, constant buf1& x_10, thread float4* const tint_symbol_4) { + int a = 0; + int x_32 = 0; + float const x_34 = x_6.zero; + float const x_36 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_34 < x_36)) { + int const x_42 = x_10.x_GLF_uniform_int_values.arr[1].el; + x_32 = x_42; + } else { + int const x_44 = x_10.x_GLF_uniform_int_values.arr[0].el; + x_32 = x_44; + } + int const x_45 = x_32; + a = ~((x_45 | 1)); + int const x_48 = a; + int const x_50 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_48 == ~(x_50))) { + int const x_57 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_60 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_63 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_66 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_57), float(x_60), float(x_63), float(x_66)); + } else { + int const x_70 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_71 = float(x_70); + *(tint_symbol_4) = float4(x_71, x_71, x_71, x_71); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf2& x_6 [[buffer(2)]], constant buf0& x_8 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2144540f4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.spvasm @@ -0,0 +1,155 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zero" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %x_32 "x_32" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_6 = OpVariable %_ptr_Uniform_buf2 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %20 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %20 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %a = OpVariable %_ptr_Function_int Function %29 + %x_32 = OpVariable %_ptr_Function_int Function %29 + %33 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %34 = OpLoad %float %33 + %36 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %37 = OpLoad %float %36 + %38 = OpFOrdLessThan %bool %34 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %46 = OpLoad %int %45 + OpStore %x_32 %46 + OpBranch %40 + %42 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %48 = OpLoad %int %47 + OpStore %x_32 %48 + OpBranch %40 + %40 = OpLabel + %49 = OpLoad %int %x_32 + %51 = OpBitwiseOr %int %49 %int_1 + %50 = OpNot %int %51 + OpStore %a %50 + %52 = OpLoad %int %a + %53 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpNot %int %54 + %56 = OpIEqual %bool %52 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %61 + %69 = OpConvertSToF %float %63 + %70 = OpConvertSToF %float %65 + %71 = OpConvertSToF %float %67 + %72 = OpCompositeConstruct %v4float %68 %69 %70 %71 + OpStore %x_GLF_color %72 + OpBranch %57 + %59 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %x_GLF_color %76 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %77 +%tint_symbol = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %84 = OpLabel + %85 = OpFunctionCall %void %main_1 + %87 = OpLoad %v4float %x_GLF_color + %88 = OpCompositeConstruct %main_out %87 + %86 = OpFunctionCall %void %tint_symbol_2 %88 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..1e307de9aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.spvasm.expected.wgsl @@ -0,0 +1,67 @@ +[[block]] +struct buf2 { + zero : f32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(2)]] var x_6 : buf2; + +[[group(0), binding(0)]] var x_8 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var x_32 : i32; + let x_34 : f32 = x_6.zero; + let x_36 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_34 < x_36)) { + let x_42 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_32 = x_42; + } else { + let x_44 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_32 = x_44; + } + let x_45 : i32 = x_32; + a = ~((x_45 | 1)); + let x_48 : i32 = a; + let x_50 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_48 == ~(x_50))) { + let x_57 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_57), f32(x_60), f32(x_63), f32(x_66)); + } else { + let x_70 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_71 : f32 = f32(x_70); + x_GLF_color = vec4(x_71, x_71, x_71, x_71); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl new file mode 100644 index 0000000000..1e307de9aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl @@ -0,0 +1,67 @@ +[[block]] +struct buf2 { + zero : f32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(2)]] var x_6 : buf2; + +[[group(0), binding(0)]] var x_8 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var x_32 : i32; + let x_34 : f32 = x_6.zero; + let x_36 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_34 < x_36)) { + let x_42 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_32 = x_42; + } else { + let x_44 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_32 = x_44; + } + let x_45 : i32 = x_32; + a = ~((x_45 | 1)); + let x_48 : i32 = a; + let x_50 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_48 == ~(x_50))) { + let x_57 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_57), f32(x_60), f32(x_63), f32(x_66)); + } else { + let x_70 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_71 : f32 = f32(x_70); + x_GLF_color = vec4(x_71, x_71, x_71, x_71); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..53fa4d4454 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_6 : register(b2, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int x_32 = 0; + const float x_34 = asfloat(x_6[0].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_34 < x_36)) { + const int x_42 = asint(x_10[1].x); + x_32 = x_42; + } else { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_44 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_32 = x_44; + } + a = ~((x_32 | 1)); + const int x_48 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_48 == ~(x_50))) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_60 = asint(x_10[1].x); + const int x_63 = asint(x_10[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_66 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_57), float(x_60), float(x_63), float(x_66)); + } else { + const int x_70 = asint(x_10[1].x); + const float x_71 = float(x_70); + x_GLF_color = float4(x_71, x_71, x_71, x_71); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d5bab816b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct buf2 { + /* 0x0000 */ float zero; +}; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf2& x_6, constant buf0& x_8, constant buf1& x_10, thread float4* const tint_symbol_4) { + int a = 0; + int x_32 = 0; + float const x_34 = x_6.zero; + float const x_36 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_34 < x_36)) { + int const x_42 = x_10.x_GLF_uniform_int_values.arr[1].el; + x_32 = x_42; + } else { + int const x_44 = x_10.x_GLF_uniform_int_values.arr[0].el; + x_32 = x_44; + } + int const x_45 = x_32; + a = ~((x_45 | 1)); + int const x_48 = a; + int const x_50 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_48 == ~(x_50))) { + int const x_57 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_60 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_63 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_66 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_57), float(x_60), float(x_63), float(x_66)); + } else { + int const x_70 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_71 = float(x_70); + *(tint_symbol_4) = float4(x_71, x_71, x_71, x_71); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf2& x_6 [[buffer(2)]], constant buf0& x_8 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2144540f4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.spvasm @@ -0,0 +1,155 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zero" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %x_32 "x_32" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_6 = OpVariable %_ptr_Uniform_buf2 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %20 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %20 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %a = OpVariable %_ptr_Function_int Function %29 + %x_32 = OpVariable %_ptr_Function_int Function %29 + %33 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %34 = OpLoad %float %33 + %36 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %37 = OpLoad %float %36 + %38 = OpFOrdLessThan %bool %34 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %46 = OpLoad %int %45 + OpStore %x_32 %46 + OpBranch %40 + %42 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %48 = OpLoad %int %47 + OpStore %x_32 %48 + OpBranch %40 + %40 = OpLabel + %49 = OpLoad %int %x_32 + %51 = OpBitwiseOr %int %49 %int_1 + %50 = OpNot %int %51 + OpStore %a %50 + %52 = OpLoad %int %a + %53 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpNot %int %54 + %56 = OpIEqual %bool %52 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %61 + %69 = OpConvertSToF %float %63 + %70 = OpConvertSToF %float %65 + %71 = OpConvertSToF %float %67 + %72 = OpCompositeConstruct %v4float %68 %69 %70 %71 + OpStore %x_GLF_color %72 + OpBranch %57 + %59 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %x_GLF_color %76 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %77 +%tint_symbol = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %84 = OpLabel + %85 = OpFunctionCall %void %main_1 + %87 = OpLoad %v4float %x_GLF_color + %88 = OpCompositeConstruct %main_out %87 + %86 = OpFunctionCall %void %tint_symbol_2 %88 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..1e307de9aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-bitwise-inverse-uniform-condition/0-opt.wgsl.expected.wgsl @@ -0,0 +1,67 @@ +[[block]] +struct buf2 { + zero : f32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(2)]] var x_6 : buf2; + +[[group(0), binding(0)]] var x_8 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var x_32 : i32; + let x_34 : f32 = x_6.zero; + let x_36 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_34 < x_36)) { + let x_42 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_32 = x_42; + } else { + let x_44 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_32 = x_44; + } + let x_45 : i32 = x_32; + a = ~((x_45 | 1)); + let x_48 : i32 = a; + let x_50 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_48 == ~(x_50))) { + let x_57 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_57), f32(x_60), f32(x_63), f32(x_66)); + } else { + let x_70 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_71 : f32 = f32(x_70); + x_GLF_color = vec4(x_71, x_71, x_71, x_71); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm new file mode 100644 index 0000000000..a53bb72908 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm @@ -0,0 +1,229 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %c "c" + OpName %a "a" + OpName %i1 "i1" + OpName %i2 "i2" + OpName %i3 "i3" + OpName %i4 "i4" + OpName %i5 "i5" + OpName %i6 "i6" + OpName %i7 "i7" + OpName %i8 "i8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_17 = OpConstant %int 17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_n1 = OpConstant %float -1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %16 + %37 = OpLabel + %c = OpVariable %_ptr_Function_v4float Function + %a = OpVariable %_ptr_Function_int Function + %i1 = OpVariable %_ptr_Function_int Function + %i2 = OpVariable %_ptr_Function_int Function + %i3 = OpVariable %_ptr_Function_int Function + %i4 = OpVariable %_ptr_Function_int Function + %i5 = OpVariable %_ptr_Function_int Function + %i6 = OpVariable %_ptr_Function_int Function + %i7 = OpVariable %_ptr_Function_int Function + %i8 = OpVariable %_ptr_Function_int Function + OpStore %c %22 + OpStore %a %int_0 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %int %a + %47 = OpAccessChain %_ptr_Function_float %c %46 + OpStore %47 %float_1 + OpStore %i1 %int_0 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %int %i1 + %53 = OpSLessThan %bool %52 %int_1 + OpBranchConditional %53 %54 %49 + %54 = OpLabel + OpStore %i2 %int_0 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %int %i2 + %60 = OpSLessThan %bool %59 %int_1 + OpBranchConditional %60 %61 %56 + %61 = OpLabel + OpStore %i3 %int_0 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %66 = OpLoad %int %i3 + %67 = OpSLessThan %bool %66 %int_1 + OpBranchConditional %67 %68 %63 + %68 = OpLabel + OpStore %i4 %int_0 + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %int %i4 + %74 = OpSLessThan %bool %73 %int_1 + OpBranchConditional %74 %75 %70 + %75 = OpLabel + OpStore %i5 %int_0 + OpBranch %76 + %76 = OpLabel + OpLoopMerge %77 %78 None + OpBranch %79 + %79 = OpLabel + %80 = OpLoad %int %i5 + %81 = OpSLessThan %bool %80 %int_1 + OpBranchConditional %81 %82 %77 + %82 = OpLabel + OpStore %i6 %int_0 + OpBranch %83 + %83 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + %87 = OpLoad %int %i6 + %88 = OpSLessThan %bool %87 %int_1 + OpBranchConditional %88 %89 %84 + %89 = OpLabel + OpStore %i7 %int_0 + OpBranch %90 + %90 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %int %i7 + %95 = OpSLessThan %bool %94 %int_1 + OpBranchConditional %95 %96 %91 + %96 = OpLabel + OpStore %i8 %int_0 + OpBranch %97 + %97 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %101 = OpLoad %int %i8 + %102 = OpSLessThan %bool %101 %int_17 + OpBranchConditional %102 %103 %98 + %103 = OpLabel + %104 = OpLoad %int %a + %105 = OpIAdd %int %104 %int_1 + OpStore %a %105 + OpBranch %99 + %99 = OpLabel + %106 = OpLoad %int %i8 + %107 = OpIAdd %int %106 %int_1 + OpStore %i8 %107 + OpBranch %97 + %98 = OpLabel + OpBranch %92 + %92 = OpLabel + %108 = OpLoad %int %i7 + %109 = OpIAdd %int %108 %int_1 + OpStore %i7 %109 + OpBranch %90 + %91 = OpLabel + OpBranch %85 + %85 = OpLabel + %110 = OpLoad %int %i6 + %111 = OpIAdd %int %110 %int_1 + OpStore %i6 %111 + OpBranch %83 + %84 = OpLabel + OpBranch %78 + %78 = OpLabel + %112 = OpLoad %int %i5 + %113 = OpIAdd %int %112 %int_1 + OpStore %i5 %113 + OpBranch %76 + %77 = OpLabel + OpBranch %71 + %71 = OpLabel + %114 = OpLoad %int %i4 + %115 = OpIAdd %int %114 %int_1 + OpStore %i4 %115 + OpBranch %69 + %70 = OpLabel + OpBranch %64 + %64 = OpLabel + %116 = OpLoad %int %i3 + %117 = OpIAdd %int %116 %int_1 + OpStore %i3 %117 + OpBranch %62 + %63 = OpLabel + OpBranch %57 + %57 = OpLabel + %118 = OpLoad %int %i2 + %119 = OpIAdd %int %118 %int_1 + OpStore %i2 %119 + OpBranch %55 + %56 = OpLabel + OpBranch %50 + %50 = OpLabel + %120 = OpLoad %int %i1 + %121 = OpIAdd %int %120 %int_1 + OpStore %i1 %121 + OpBranch %48 + %49 = OpLabel + OpBranch %44 + %44 = OpLabel + %122 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %123 = OpLoad %float %122 + %124 = OpFOrdLessThan %bool %123 %float_n1 + OpBranchConditional %124 %42 %43 + %43 = OpLabel + OpBranch %40 + %40 = OpLabel + %125 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %126 = OpLoad %float %125 + %127 = OpFOrdLessThan %bool %126 %float_n1 + OpBranchConditional %127 %38 %39 + %39 = OpLabel + %128 = OpLoad %v4float %c + OpStore %_GLF_color %128 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..400e058896 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.hlsl @@ -0,0 +1,102 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 c = float4(0.0f, 0.0f, 0.0f, 0.0f); + int a = 0; + int i1 = 0; + int i2 = 0; + int i3 = 0; + int i4 = 0; + int i5 = 0; + int i6 = 0; + int i7 = 0; + int i8_1 = 0; + c = float4(0.0f, 0.0f, 0.0f, 1.0f); + a = 0; + while (true) { + while (true) { + set_float4(c, a, 1.0f); + i1 = 0; + { + for(; (i1 < 1); i1 = (i1 + 1)) { + i2 = 0; + { + for(; (i2 < 1); i2 = (i2 + 1)) { + i3 = 0; + { + for(; (i3 < 1); i3 = (i3 + 1)) { + i4 = 0; + { + for(; (i4 < 1); i4 = (i4 + 1)) { + i5 = 0; + { + for(; (i5 < 1); i5 = (i5 + 1)) { + i6 = 0; + { + for(; (i6 < 1); i6 = (i6 + 1)) { + i7 = 0; + { + for(; (i7 < 1); i7 = (i7 + 1)) { + i8_1 = 0; + { + for(; (i8_1 < 17); i8_1 = (i8_1 + 1)) { + a = (a + 1); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + { + const float x_123 = gl_FragCoord.x; + if ((x_123 < -1.0f)) { + } else { + break; + } + } + } + { + const float x_126 = gl_FragCoord.y; + if ((x_126 < -1.0f)) { + } else { + break; + } + } + } + x_GLF_color = c; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..5e6ba535b3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.msl @@ -0,0 +1,156 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float4 c = 0.0f; + int a = 0; + int i1 = 0; + int i2 = 0; + int i3 = 0; + int i4 = 0; + int i5 = 0; + int i6 = 0; + int i7 = 0; + int i8_1 = 0; + c = float4(0.0f, 0.0f, 0.0f, 1.0f); + a = 0; + while (true) { + while (true) { + int const x_46 = a; + c[x_46] = 1.0f; + i1 = 0; + while (true) { + int const x_52 = i1; + if ((x_52 < 1)) { + } else { + break; + } + i2 = 0; + while (true) { + int const x_59 = i2; + if ((x_59 < 1)) { + } else { + break; + } + i3 = 0; + while (true) { + int const x_66 = i3; + if ((x_66 < 1)) { + } else { + break; + } + i4 = 0; + while (true) { + int const x_73 = i4; + if ((x_73 < 1)) { + } else { + break; + } + i5 = 0; + while (true) { + int const x_80 = i5; + if ((x_80 < 1)) { + } else { + break; + } + i6 = 0; + while (true) { + int const x_87 = i6; + if ((x_87 < 1)) { + } else { + break; + } + i7 = 0; + while (true) { + int const x_94 = i7; + if ((x_94 < 1)) { + } else { + break; + } + i8_1 = 0; + while (true) { + int const x_101 = i8_1; + if ((x_101 < 17)) { + } else { + break; + } + int const x_104 = a; + a = (x_104 + 1); + { + int const x_106 = i8_1; + i8_1 = (x_106 + 1); + } + } + { + int const x_108 = i7; + i7 = (x_108 + 1); + } + } + { + int const x_110 = i6; + i6 = (x_110 + 1); + } + } + { + int const x_112 = i5; + i5 = (x_112 + 1); + } + } + { + int const x_114 = i4; + i4 = (x_114 + 1); + } + } + { + int const x_116 = i3; + i3 = (x_116 + 1); + } + } + { + int const x_118 = i2; + i2 = (x_118 + 1); + } + } + { + int const x_120 = i1; + i1 = (x_120 + 1); + } + } + { + float const x_123 = (*(tint_symbol_5)).x; + if ((x_123 < -1.0f)) { + } else { + break; + } + } + } + { + float const x_126 = (*(tint_symbol_5)).y; + if ((x_126 < -1.0f)) { + } else { + break; + } + } + } + float4 const x_128 = c; + *(tint_symbol_6) = x_128; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..dde7eba97d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.spvasm @@ -0,0 +1,323 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 168 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %c "c" + OpName %a "a" + OpName %i1 "i1" + OpName %i2 "i2" + OpName %i3 "i3" + OpName %i4 "i4" + OpName %i5 "i5" + OpName %i6 "i6" + OpName %i7 "i7" + OpName %i8_1 "i8_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_17 = OpConstant %int 17 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_n1 = OpConstant %float -1 + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %155 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %c = OpVariable %_ptr_Function_v4float Function %5 + %a = OpVariable %_ptr_Function_int Function %20 + %i1 = OpVariable %_ptr_Function_int Function %20 + %i2 = OpVariable %_ptr_Function_int Function %20 + %i3 = OpVariable %_ptr_Function_int Function %20 + %i4 = OpVariable %_ptr_Function_int Function %20 + %i5 = OpVariable %_ptr_Function_int Function %20 + %i6 = OpVariable %_ptr_Function_int Function %20 + %i7 = OpVariable %_ptr_Function_int Function %20 + %i8_1 = OpVariable %_ptr_Function_int Function %20 + OpStore %c %31 + OpStore %a %int_0 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %int %a + %43 = OpAccessChain %_ptr_Function_float %c %41 + OpStore %43 %float_1 + OpStore %i1 %int_0 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i1 + %50 = OpSLessThan %bool %48 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %50 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %45 + %52 = OpLabel + OpStore %i2 %int_0 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %int %i2 + %60 = OpSLessThan %bool %59 %int_1 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %56 + %61 = OpLabel + OpStore %i3 %int_0 + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %int %i3 + %69 = OpSLessThan %bool %68 %int_1 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %65 + %70 = OpLabel + OpStore %i4 %int_0 + OpBranch %73 + %73 = OpLabel + OpLoopMerge %74 %75 None + OpBranch %76 + %76 = OpLabel + %77 = OpLoad %int %i4 + %78 = OpSLessThan %bool %77 %int_1 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %81 + %80 = OpLabel + OpBranch %79 + %81 = OpLabel + OpBranch %74 + %79 = OpLabel + OpStore %i5 %int_0 + OpBranch %82 + %82 = OpLabel + OpLoopMerge %83 %84 None + OpBranch %85 + %85 = OpLabel + %86 = OpLoad %int %i5 + %87 = OpSLessThan %bool %86 %int_1 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %90 + %89 = OpLabel + OpBranch %88 + %90 = OpLabel + OpBranch %83 + %88 = OpLabel + OpStore %i6 %int_0 + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %i6 + %96 = OpSLessThan %bool %95 %int_1 + OpSelectionMerge %97 None + OpBranchConditional %96 %98 %99 + %98 = OpLabel + OpBranch %97 + %99 = OpLabel + OpBranch %92 + %97 = OpLabel + OpStore %i7 %int_0 + OpBranch %100 + %100 = OpLabel + OpLoopMerge %101 %102 None + OpBranch %103 + %103 = OpLabel + %104 = OpLoad %int %i7 + %105 = OpSLessThan %bool %104 %int_1 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %108 + %107 = OpLabel + OpBranch %106 + %108 = OpLabel + OpBranch %101 + %106 = OpLabel + OpStore %i8_1 %int_0 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %110 %111 None + OpBranch %112 + %112 = OpLabel + %113 = OpLoad %int %i8_1 + %115 = OpSLessThan %bool %113 %int_17 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %118 + %117 = OpLabel + OpBranch %116 + %118 = OpLabel + OpBranch %110 + %116 = OpLabel + %119 = OpLoad %int %a + %120 = OpIAdd %int %119 %int_1 + OpStore %a %120 + OpBranch %111 + %111 = OpLabel + %121 = OpLoad %int %i8_1 + %122 = OpIAdd %int %121 %int_1 + OpStore %i8_1 %122 + OpBranch %109 + %110 = OpLabel + OpBranch %102 + %102 = OpLabel + %123 = OpLoad %int %i7 + %124 = OpIAdd %int %123 %int_1 + OpStore %i7 %124 + OpBranch %100 + %101 = OpLabel + OpBranch %93 + %93 = OpLabel + %125 = OpLoad %int %i6 + %126 = OpIAdd %int %125 %int_1 + OpStore %i6 %126 + OpBranch %91 + %92 = OpLabel + OpBranch %84 + %84 = OpLabel + %127 = OpLoad %int %i5 + %128 = OpIAdd %int %127 %int_1 + OpStore %i5 %128 + OpBranch %82 + %83 = OpLabel + OpBranch %75 + %75 = OpLabel + %129 = OpLoad %int %i4 + %130 = OpIAdd %int %129 %int_1 + OpStore %i4 %130 + OpBranch %73 + %74 = OpLabel + OpBranch %66 + %66 = OpLabel + %131 = OpLoad %int %i3 + %132 = OpIAdd %int %131 %int_1 + OpStore %i3 %132 + OpBranch %64 + %65 = OpLabel + OpBranch %57 + %57 = OpLabel + %133 = OpLoad %int %i2 + %134 = OpIAdd %int %133 %int_1 + OpStore %i2 %134 + OpBranch %55 + %56 = OpLabel + OpBranch %46 + %46 = OpLabel + %135 = OpLoad %int %i1 + %136 = OpIAdd %int %135 %int_1 + OpStore %i1 %136 + OpBranch %44 + %45 = OpLabel + OpBranch %39 + %39 = OpLabel + %140 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %141 = OpLoad %float %140 + %143 = OpFOrdLessThan %bool %141 %float_n1 + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %146 + %145 = OpLabel + OpBranch %144 + %146 = OpLabel + OpBranch %38 + %144 = OpLabel + OpBranch %37 + %38 = OpLabel + OpBranch %35 + %35 = OpLabel + %148 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %149 = OpLoad %float %148 + %150 = OpFOrdLessThan %bool %149 %float_n1 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %153 + %152 = OpLabel + OpBranch %151 + %153 = OpLabel + OpBranch %34 + %151 = OpLabel + OpBranch %33 + %34 = OpLabel + %154 = OpLoad %v4float %c + OpStore %x_GLF_color %154 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %155 +%tint_symbol_1 = OpFunctionParameter %main_out + %159 = OpLabel + %160 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %160 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %162 = OpLabel + %163 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %163 + %164 = OpFunctionCall %void %main_1 + %166 = OpLoad %v4float %x_GLF_color + %167 = OpCompositeConstruct %main_out %166 + %165 = OpFunctionCall %void %tint_symbol_3 %167 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 35[%35] is not post dominated by the back-edge block 151[%151] + %151 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..73515b97ab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.spvasm.expected.wgsl @@ -0,0 +1,161 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec4; + var a : i32; + var i1 : i32; + var i2 : i32; + var i3 : i32; + var i4 : i32; + var i5 : i32; + var i6 : i32; + var i7 : i32; + var i8_1 : i32; + c = vec4(0.0, 0.0, 0.0, 1.0); + a = 0; + loop { + loop { + let x_46 : i32 = a; + c[x_46] = 1.0; + i1 = 0; + loop { + let x_52 : i32 = i1; + if ((x_52 < 1)) { + } else { + break; + } + i2 = 0; + loop { + let x_59 : i32 = i2; + if ((x_59 < 1)) { + } else { + break; + } + i3 = 0; + loop { + let x_66 : i32 = i3; + if ((x_66 < 1)) { + } else { + break; + } + i4 = 0; + loop { + let x_73 : i32 = i4; + if ((x_73 < 1)) { + } else { + break; + } + i5 = 0; + loop { + let x_80 : i32 = i5; + if ((x_80 < 1)) { + } else { + break; + } + i6 = 0; + loop { + let x_87 : i32 = i6; + if ((x_87 < 1)) { + } else { + break; + } + i7 = 0; + loop { + let x_94 : i32 = i7; + if ((x_94 < 1)) { + } else { + break; + } + i8_1 = 0; + loop { + let x_101 : i32 = i8_1; + if ((x_101 < 17)) { + } else { + break; + } + let x_104 : i32 = a; + a = (x_104 + 1); + + continuing { + let x_106 : i32 = i8_1; + i8_1 = (x_106 + 1); + } + } + + continuing { + let x_108 : i32 = i7; + i7 = (x_108 + 1); + } + } + + continuing { + let x_110 : i32 = i6; + i6 = (x_110 + 1); + } + } + + continuing { + let x_112 : i32 = i5; + i5 = (x_112 + 1); + } + } + + continuing { + let x_114 : i32 = i4; + i4 = (x_114 + 1); + } + } + + continuing { + let x_116 : i32 = i3; + i3 = (x_116 + 1); + } + } + + continuing { + let x_118 : i32 = i2; + i2 = (x_118 + 1); + } + } + + continuing { + let x_120 : i32 = i1; + i1 = (x_120 + 1); + } + } + + continuing { + let x_123 : f32 = gl_FragCoord.x; + if ((x_123 < -1.0)) { + } else { + break; + } + } + } + + continuing { + let x_126 : f32 = gl_FragCoord.y; + if ((x_126 < -1.0)) { + } else { + break; + } + } + } + let x_128 : vec4 = c; + x_GLF_color = x_128; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl new file mode 100644 index 0000000000..73515b97ab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl @@ -0,0 +1,161 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec4; + var a : i32; + var i1 : i32; + var i2 : i32; + var i3 : i32; + var i4 : i32; + var i5 : i32; + var i6 : i32; + var i7 : i32; + var i8_1 : i32; + c = vec4(0.0, 0.0, 0.0, 1.0); + a = 0; + loop { + loop { + let x_46 : i32 = a; + c[x_46] = 1.0; + i1 = 0; + loop { + let x_52 : i32 = i1; + if ((x_52 < 1)) { + } else { + break; + } + i2 = 0; + loop { + let x_59 : i32 = i2; + if ((x_59 < 1)) { + } else { + break; + } + i3 = 0; + loop { + let x_66 : i32 = i3; + if ((x_66 < 1)) { + } else { + break; + } + i4 = 0; + loop { + let x_73 : i32 = i4; + if ((x_73 < 1)) { + } else { + break; + } + i5 = 0; + loop { + let x_80 : i32 = i5; + if ((x_80 < 1)) { + } else { + break; + } + i6 = 0; + loop { + let x_87 : i32 = i6; + if ((x_87 < 1)) { + } else { + break; + } + i7 = 0; + loop { + let x_94 : i32 = i7; + if ((x_94 < 1)) { + } else { + break; + } + i8_1 = 0; + loop { + let x_101 : i32 = i8_1; + if ((x_101 < 17)) { + } else { + break; + } + let x_104 : i32 = a; + a = (x_104 + 1); + + continuing { + let x_106 : i32 = i8_1; + i8_1 = (x_106 + 1); + } + } + + continuing { + let x_108 : i32 = i7; + i7 = (x_108 + 1); + } + } + + continuing { + let x_110 : i32 = i6; + i6 = (x_110 + 1); + } + } + + continuing { + let x_112 : i32 = i5; + i5 = (x_112 + 1); + } + } + + continuing { + let x_114 : i32 = i4; + i4 = (x_114 + 1); + } + } + + continuing { + let x_116 : i32 = i3; + i3 = (x_116 + 1); + } + } + + continuing { + let x_118 : i32 = i2; + i2 = (x_118 + 1); + } + } + + continuing { + let x_120 : i32 = i1; + i1 = (x_120 + 1); + } + } + + continuing { + let x_123 : f32 = gl_FragCoord.x; + if ((x_123 < -1.0)) { + } else { + break; + } + } + } + + continuing { + let x_126 : f32 = gl_FragCoord.y; + if ((x_126 < -1.0)) { + } else { + break; + } + } + } + let x_128 : vec4 = c; + x_GLF_color = x_128; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..400e058896 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.hlsl @@ -0,0 +1,102 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 c = float4(0.0f, 0.0f, 0.0f, 0.0f); + int a = 0; + int i1 = 0; + int i2 = 0; + int i3 = 0; + int i4 = 0; + int i5 = 0; + int i6 = 0; + int i7 = 0; + int i8_1 = 0; + c = float4(0.0f, 0.0f, 0.0f, 1.0f); + a = 0; + while (true) { + while (true) { + set_float4(c, a, 1.0f); + i1 = 0; + { + for(; (i1 < 1); i1 = (i1 + 1)) { + i2 = 0; + { + for(; (i2 < 1); i2 = (i2 + 1)) { + i3 = 0; + { + for(; (i3 < 1); i3 = (i3 + 1)) { + i4 = 0; + { + for(; (i4 < 1); i4 = (i4 + 1)) { + i5 = 0; + { + for(; (i5 < 1); i5 = (i5 + 1)) { + i6 = 0; + { + for(; (i6 < 1); i6 = (i6 + 1)) { + i7 = 0; + { + for(; (i7 < 1); i7 = (i7 + 1)) { + i8_1 = 0; + { + for(; (i8_1 < 17); i8_1 = (i8_1 + 1)) { + a = (a + 1); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + { + const float x_123 = gl_FragCoord.x; + if ((x_123 < -1.0f)) { + } else { + break; + } + } + } + { + const float x_126 = gl_FragCoord.y; + if ((x_126 < -1.0f)) { + } else { + break; + } + } + } + x_GLF_color = c; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..5e6ba535b3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.msl @@ -0,0 +1,156 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float4 c = 0.0f; + int a = 0; + int i1 = 0; + int i2 = 0; + int i3 = 0; + int i4 = 0; + int i5 = 0; + int i6 = 0; + int i7 = 0; + int i8_1 = 0; + c = float4(0.0f, 0.0f, 0.0f, 1.0f); + a = 0; + while (true) { + while (true) { + int const x_46 = a; + c[x_46] = 1.0f; + i1 = 0; + while (true) { + int const x_52 = i1; + if ((x_52 < 1)) { + } else { + break; + } + i2 = 0; + while (true) { + int const x_59 = i2; + if ((x_59 < 1)) { + } else { + break; + } + i3 = 0; + while (true) { + int const x_66 = i3; + if ((x_66 < 1)) { + } else { + break; + } + i4 = 0; + while (true) { + int const x_73 = i4; + if ((x_73 < 1)) { + } else { + break; + } + i5 = 0; + while (true) { + int const x_80 = i5; + if ((x_80 < 1)) { + } else { + break; + } + i6 = 0; + while (true) { + int const x_87 = i6; + if ((x_87 < 1)) { + } else { + break; + } + i7 = 0; + while (true) { + int const x_94 = i7; + if ((x_94 < 1)) { + } else { + break; + } + i8_1 = 0; + while (true) { + int const x_101 = i8_1; + if ((x_101 < 17)) { + } else { + break; + } + int const x_104 = a; + a = (x_104 + 1); + { + int const x_106 = i8_1; + i8_1 = (x_106 + 1); + } + } + { + int const x_108 = i7; + i7 = (x_108 + 1); + } + } + { + int const x_110 = i6; + i6 = (x_110 + 1); + } + } + { + int const x_112 = i5; + i5 = (x_112 + 1); + } + } + { + int const x_114 = i4; + i4 = (x_114 + 1); + } + } + { + int const x_116 = i3; + i3 = (x_116 + 1); + } + } + { + int const x_118 = i2; + i2 = (x_118 + 1); + } + } + { + int const x_120 = i1; + i1 = (x_120 + 1); + } + } + { + float const x_123 = (*(tint_symbol_5)).x; + if ((x_123 < -1.0f)) { + } else { + break; + } + } + } + { + float const x_126 = (*(tint_symbol_5)).y; + if ((x_126 < -1.0f)) { + } else { + break; + } + } + } + float4 const x_128 = c; + *(tint_symbol_6) = x_128; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..dde7eba97d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.spvasm @@ -0,0 +1,323 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 168 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %c "c" + OpName %a "a" + OpName %i1 "i1" + OpName %i2 "i2" + OpName %i3 "i3" + OpName %i4 "i4" + OpName %i5 "i5" + OpName %i6 "i6" + OpName %i7 "i7" + OpName %i8_1 "i8_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_17 = OpConstant %int 17 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_n1 = OpConstant %float -1 + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %155 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %c = OpVariable %_ptr_Function_v4float Function %5 + %a = OpVariable %_ptr_Function_int Function %20 + %i1 = OpVariable %_ptr_Function_int Function %20 + %i2 = OpVariable %_ptr_Function_int Function %20 + %i3 = OpVariable %_ptr_Function_int Function %20 + %i4 = OpVariable %_ptr_Function_int Function %20 + %i5 = OpVariable %_ptr_Function_int Function %20 + %i6 = OpVariable %_ptr_Function_int Function %20 + %i7 = OpVariable %_ptr_Function_int Function %20 + %i8_1 = OpVariable %_ptr_Function_int Function %20 + OpStore %c %31 + OpStore %a %int_0 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %int %a + %43 = OpAccessChain %_ptr_Function_float %c %41 + OpStore %43 %float_1 + OpStore %i1 %int_0 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i1 + %50 = OpSLessThan %bool %48 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %50 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %45 + %52 = OpLabel + OpStore %i2 %int_0 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %int %i2 + %60 = OpSLessThan %bool %59 %int_1 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %56 + %61 = OpLabel + OpStore %i3 %int_0 + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %int %i3 + %69 = OpSLessThan %bool %68 %int_1 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %65 + %70 = OpLabel + OpStore %i4 %int_0 + OpBranch %73 + %73 = OpLabel + OpLoopMerge %74 %75 None + OpBranch %76 + %76 = OpLabel + %77 = OpLoad %int %i4 + %78 = OpSLessThan %bool %77 %int_1 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %81 + %80 = OpLabel + OpBranch %79 + %81 = OpLabel + OpBranch %74 + %79 = OpLabel + OpStore %i5 %int_0 + OpBranch %82 + %82 = OpLabel + OpLoopMerge %83 %84 None + OpBranch %85 + %85 = OpLabel + %86 = OpLoad %int %i5 + %87 = OpSLessThan %bool %86 %int_1 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %90 + %89 = OpLabel + OpBranch %88 + %90 = OpLabel + OpBranch %83 + %88 = OpLabel + OpStore %i6 %int_0 + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %i6 + %96 = OpSLessThan %bool %95 %int_1 + OpSelectionMerge %97 None + OpBranchConditional %96 %98 %99 + %98 = OpLabel + OpBranch %97 + %99 = OpLabel + OpBranch %92 + %97 = OpLabel + OpStore %i7 %int_0 + OpBranch %100 + %100 = OpLabel + OpLoopMerge %101 %102 None + OpBranch %103 + %103 = OpLabel + %104 = OpLoad %int %i7 + %105 = OpSLessThan %bool %104 %int_1 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %108 + %107 = OpLabel + OpBranch %106 + %108 = OpLabel + OpBranch %101 + %106 = OpLabel + OpStore %i8_1 %int_0 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %110 %111 None + OpBranch %112 + %112 = OpLabel + %113 = OpLoad %int %i8_1 + %115 = OpSLessThan %bool %113 %int_17 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %118 + %117 = OpLabel + OpBranch %116 + %118 = OpLabel + OpBranch %110 + %116 = OpLabel + %119 = OpLoad %int %a + %120 = OpIAdd %int %119 %int_1 + OpStore %a %120 + OpBranch %111 + %111 = OpLabel + %121 = OpLoad %int %i8_1 + %122 = OpIAdd %int %121 %int_1 + OpStore %i8_1 %122 + OpBranch %109 + %110 = OpLabel + OpBranch %102 + %102 = OpLabel + %123 = OpLoad %int %i7 + %124 = OpIAdd %int %123 %int_1 + OpStore %i7 %124 + OpBranch %100 + %101 = OpLabel + OpBranch %93 + %93 = OpLabel + %125 = OpLoad %int %i6 + %126 = OpIAdd %int %125 %int_1 + OpStore %i6 %126 + OpBranch %91 + %92 = OpLabel + OpBranch %84 + %84 = OpLabel + %127 = OpLoad %int %i5 + %128 = OpIAdd %int %127 %int_1 + OpStore %i5 %128 + OpBranch %82 + %83 = OpLabel + OpBranch %75 + %75 = OpLabel + %129 = OpLoad %int %i4 + %130 = OpIAdd %int %129 %int_1 + OpStore %i4 %130 + OpBranch %73 + %74 = OpLabel + OpBranch %66 + %66 = OpLabel + %131 = OpLoad %int %i3 + %132 = OpIAdd %int %131 %int_1 + OpStore %i3 %132 + OpBranch %64 + %65 = OpLabel + OpBranch %57 + %57 = OpLabel + %133 = OpLoad %int %i2 + %134 = OpIAdd %int %133 %int_1 + OpStore %i2 %134 + OpBranch %55 + %56 = OpLabel + OpBranch %46 + %46 = OpLabel + %135 = OpLoad %int %i1 + %136 = OpIAdd %int %135 %int_1 + OpStore %i1 %136 + OpBranch %44 + %45 = OpLabel + OpBranch %39 + %39 = OpLabel + %140 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %141 = OpLoad %float %140 + %143 = OpFOrdLessThan %bool %141 %float_n1 + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %146 + %145 = OpLabel + OpBranch %144 + %146 = OpLabel + OpBranch %38 + %144 = OpLabel + OpBranch %37 + %38 = OpLabel + OpBranch %35 + %35 = OpLabel + %148 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %149 = OpLoad %float %148 + %150 = OpFOrdLessThan %bool %149 %float_n1 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %153 + %152 = OpLabel + OpBranch %151 + %153 = OpLabel + OpBranch %34 + %151 = OpLabel + OpBranch %33 + %34 = OpLabel + %154 = OpLoad %v4float %c + OpStore %x_GLF_color %154 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %155 +%tint_symbol_1 = OpFunctionParameter %main_out + %159 = OpLabel + %160 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %160 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %162 = OpLabel + %163 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %163 + %164 = OpFunctionCall %void %main_1 + %166 = OpLoad %v4float %x_GLF_color + %167 = OpCompositeConstruct %main_out %166 + %165 = OpFunctionCall %void %tint_symbol_3 %167 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 35[%35] is not post dominated by the back-edge block 151[%151] + %151 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..73515b97ab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-blockfrequency-several-for-loops/0-opt.wgsl.expected.wgsl @@ -0,0 +1,161 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec4; + var a : i32; + var i1 : i32; + var i2 : i32; + var i3 : i32; + var i4 : i32; + var i5 : i32; + var i6 : i32; + var i7 : i32; + var i8_1 : i32; + c = vec4(0.0, 0.0, 0.0, 1.0); + a = 0; + loop { + loop { + let x_46 : i32 = a; + c[x_46] = 1.0; + i1 = 0; + loop { + let x_52 : i32 = i1; + if ((x_52 < 1)) { + } else { + break; + } + i2 = 0; + loop { + let x_59 : i32 = i2; + if ((x_59 < 1)) { + } else { + break; + } + i3 = 0; + loop { + let x_66 : i32 = i3; + if ((x_66 < 1)) { + } else { + break; + } + i4 = 0; + loop { + let x_73 : i32 = i4; + if ((x_73 < 1)) { + } else { + break; + } + i5 = 0; + loop { + let x_80 : i32 = i5; + if ((x_80 < 1)) { + } else { + break; + } + i6 = 0; + loop { + let x_87 : i32 = i6; + if ((x_87 < 1)) { + } else { + break; + } + i7 = 0; + loop { + let x_94 : i32 = i7; + if ((x_94 < 1)) { + } else { + break; + } + i8_1 = 0; + loop { + let x_101 : i32 = i8_1; + if ((x_101 < 17)) { + } else { + break; + } + let x_104 : i32 = a; + a = (x_104 + 1); + + continuing { + let x_106 : i32 = i8_1; + i8_1 = (x_106 + 1); + } + } + + continuing { + let x_108 : i32 = i7; + i7 = (x_108 + 1); + } + } + + continuing { + let x_110 : i32 = i6; + i6 = (x_110 + 1); + } + } + + continuing { + let x_112 : i32 = i5; + i5 = (x_112 + 1); + } + } + + continuing { + let x_114 : i32 = i4; + i4 = (x_114 + 1); + } + } + + continuing { + let x_116 : i32 = i3; + i3 = (x_116 + 1); + } + } + + continuing { + let x_118 : i32 = i2; + i2 = (x_118 + 1); + } + } + + continuing { + let x_120 : i32 = i1; + i1 = (x_120 + 1); + } + } + + continuing { + let x_123 : f32 = gl_FragCoord.x; + if ((x_123 < -1.0)) { + } else { + break; + } + } + } + + continuing { + let x_126 : f32 = gl_FragCoord.y; + if ((x_126 < -1.0)) { + } else { + break; + } + } + } + let x_128 : vec4 = c; + x_GLF_color = x_128; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm new file mode 100644 index 0000000000..6808a31c0b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm @@ -0,0 +1,296 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %sums "sums" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %d "d" + OpName %indexable "indexable" + OpName %indexable_0 "indexable" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 RelaxedPrecision + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %16 RelaxedPrecision + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %18 RelaxedPrecision + OpDecorate %a RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %b RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %c RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %d RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %49 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + %void = OpTypeVoid + %55 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %55 + %82 = OpLabel + %sums = OpVariable %_ptr_Function__arr_float_uint_2 Function + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %c = OpVariable %_ptr_Function_int Function + %d = OpVariable %_ptr_Function_int Function + %indexable = OpVariable %_ptr_Function_mat2v2float Function +%indexable_0 = OpVariable %_ptr_Function_mat2v2float Function + %83 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %16 = OpLoad %int %83 + %84 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %85 = OpLoad %float %84 + %86 = OpFNegate %float %85 + %87 = OpAccessChain %_ptr_Function_float %sums %16 + OpStore %87 %86 + %88 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %18 = OpLoad %int %88 + %89 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %90 = OpLoad %float %89 + %91 = OpFNegate %float %90 + %92 = OpAccessChain %_ptr_Function_float %sums %18 + OpStore %92 %91 + %93 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %19 = OpLoad %int %93 + OpStore %a %19 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %95 %96 None + OpBranch %97 + %97 = OpLabel + %20 = OpLoad %int %a + %98 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %21 = OpLoad %int %98 + %99 = OpSLessThan %bool %20 %21 + OpBranchConditional %99 %100 %95 + %100 = OpLabel + %101 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %22 = OpLoad %int %101 + OpStore %b %22 + OpBranch %102 + %102 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %23 = OpLoad %int %b + %106 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %24 = OpLoad %int %106 + %107 = OpSLessThan %bool %23 %24 + OpBranchConditional %107 %108 %103 + %108 = OpLabel + %109 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %25 = OpLoad %int %109 + OpStore %c %25 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %26 = OpLoad %int %c + %27 = OpLoad %int %a + %114 = OpSLessThanEqual %bool %26 %27 + OpBranchConditional %114 %115 %111 + %115 = OpLabel + %116 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %28 = OpLoad %int %116 + OpStore %d %28 + OpBranch %117 + %117 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %29 = OpLoad %int %d + %121 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %30 = OpLoad %int %121 + %122 = OpSLessThan %bool %29 %30 + OpBranchConditional %122 %123 %118 + %123 = OpLabel + %31 = OpLoad %int %a + %124 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %32 = OpLoad %int %124 + %125 = OpConvertSToF %float %32 + %126 = OpCompositeConstruct %v2float %125 %float_0 + %127 = OpCompositeConstruct %v2float %float_0 %125 + %128 = OpCompositeConstruct %mat2v2float %126 %127 + %33 = OpLoad %int %c + %129 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %34 = OpLoad %int %129 + OpStore %indexable %128 + %130 = OpAccessChain %_ptr_Function_float %indexable %33 %34 + %131 = OpLoad %float %130 + %132 = OpAccessChain %_ptr_Function_float %sums %31 + OpStore %132 %131 + %35 = OpLoad %int %a + %133 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %36 = OpLoad %int %133 + %134 = OpConvertSToF %float %36 + %135 = OpCompositeConstruct %v2float %134 %float_0 + %136 = OpCompositeConstruct %v2float %float_0 %134 + %137 = OpCompositeConstruct %mat2v2float %135 %136 + %37 = OpLoad %int %c + %138 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %38 = OpLoad %int %138 + OpStore %indexable_0 %137 + %139 = OpAccessChain %_ptr_Function_float %indexable_0 %37 %38 + %140 = OpLoad %float %139 + %141 = OpAccessChain %_ptr_Function_float %sums %35 + %142 = OpLoad %float %141 + %143 = OpFAdd %float %142 %140 + %144 = OpAccessChain %_ptr_Function_float %sums %35 + OpStore %144 %143 + OpBranch %119 + %119 = OpLabel + %39 = OpLoad %int %d + %40 = OpIAdd %int %39 %int_1 + OpStore %d %40 + OpBranch %117 + %118 = OpLabel + OpBranch %112 + %112 = OpLabel + %41 = OpLoad %int %c + %42 = OpIAdd %int %41 %int_1 + OpStore %c %42 + OpBranch %110 + %111 = OpLabel + OpBranch %104 + %104 = OpLabel + %43 = OpLoad %int %b + %44 = OpIAdd %int %43 %int_1 + OpStore %b %44 + OpBranch %102 + %103 = OpLabel + OpBranch %96 + %96 = OpLabel + %45 = OpLoad %int %a + %46 = OpIAdd %int %45 %int_1 + OpStore %a %46 + OpBranch %94 + %95 = OpLabel + %145 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %47 = OpLoad %int %145 + %146 = OpAccessChain %_ptr_Function_float %sums %47 + %147 = OpLoad %float %146 + %148 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %149 = OpLoad %float %148 + %150 = OpFOrdEqual %bool %147 %149 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %151 + %152 = OpLabel + %153 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %48 = OpLoad %int %153 + %154 = OpAccessChain %_ptr_Function_float %sums %48 + %155 = OpLoad %float %154 + %156 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_2 + %157 = OpLoad %float %156 + %158 = OpFOrdEqual %bool %155 %157 + OpBranch %151 + %151 = OpLabel + %159 = OpPhi %bool %150 %95 %158 %152 + OpSelectionMerge %160 None + OpBranchConditional %159 %161 %162 + %161 = OpLabel + %163 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %49 = OpLoad %int %163 + %164 = OpConvertSToF %float %49 + %165 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %50 = OpLoad %int %165 + %166 = OpConvertSToF %float %50 + %167 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %51 = OpLoad %int %167 + %168 = OpConvertSToF %float %51 + %169 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %52 = OpLoad %int %169 + %170 = OpConvertSToF %float %52 + %171 = OpCompositeConstruct %v4float %164 %166 %168 %170 + OpStore %_GLF_color %171 + OpBranch %160 + %162 = OpLabel + %172 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %53 = OpLoad %int %172 + %173 = OpConvertSToF %float %53 + %174 = OpCompositeConstruct %v4float %173 %173 %173 %173 + OpStore %_GLF_color %174 + OpBranch %160 + %160 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2d3af226ec --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.hlsl @@ -0,0 +1,128 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float sums[2] = (float[2])0; + int a = 0; + int b = 0; + int c = 0; + int d = 0; + float2x2 indexable = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 indexable_1 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + bool x_158 = false; + bool x_159_phi = false; + const int x_16 = asint(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_85 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + sums[x_16] = -(x_85); + const int x_18 = asint(x_6[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_90 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + sums[x_18] = -(x_90); + const int x_19 = asint(x_6[1].x); + a = x_19; + while (true) { + const int x_20 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_21 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_20 < x_21)) { + } else { + break; + } + const int x_22 = asint(x_6[1].x); + b = x_22; + while (true) { + const int x_23 = b; + const int x_24 = asint(x_6[3].x); + if ((x_23 < x_24)) { + } else { + break; + } + const int x_25 = asint(x_6[1].x); + c = x_25; + { + for(; (c <= a); c = (c + 1)) { + const int x_28 = asint(x_6[1].x); + d = x_28; + while (true) { + const int x_29 = d; + const int x_30 = asint(x_6[3].x); + if ((x_29 < x_30)) { + } else { + break; + } + const int x_31 = a; + const int x_32 = asint(x_6[2].x); + const float x_125 = float(x_32); + const int x_33 = c; + const int x_34 = asint(x_6[2].x); + indexable = float2x2(float2(x_125, 0.0f), float2(0.0f, x_125)); + const float x_131 = indexable[x_33][x_34]; + sums[x_31] = x_131; + const int x_35 = a; + const int x_36 = asint(x_6[2].x); + const float x_134 = float(x_36); + const int x_37 = c; + const int x_38 = asint(x_6[2].x); + indexable_1 = float2x2(float2(x_134, 0.0f), float2(0.0f, x_134)); + const float x_140 = indexable_1[x_37][x_38]; + const float x_142 = sums[x_35]; + sums[x_35] = (x_142 + x_140); + { + d = (d + 1); + } + } + } + } + { + b = (b + 1); + } + } + { + a = (a + 1); + } + } + const int x_47 = asint(x_6[1].x); + const float x_147 = sums[x_47]; + const float x_149 = asfloat(x_8[1].x); + const bool x_150 = (x_147 == x_149); + x_159_phi = x_150; + if (x_150) { + const int x_48 = asint(x_6[2].x); + const float x_155 = sums[x_48]; + const float x_157 = asfloat(x_8[2].x); + x_158 = (x_155 == x_157); + x_159_phi = x_158; + } + if (x_159_phi) { + const int x_49 = asint(x_6[2].x); + const int x_50 = asint(x_6[1].x); + const int x_51 = asint(x_6[1].x); + const int x_52 = asint(x_6[2].x); + x_GLF_color = float4(float(x_49), float(x_50), float(x_51), float(x_52)); + } else { + const int x_53 = asint(x_6[1].x); + const float x_173 = float(x_53); + x_GLF_color = float4(x_173, x_173, x_173, x_173); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..ed07fe72f1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.msl @@ -0,0 +1,157 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + float arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_4) { + tint_array_wrapper_2 sums = {}; + int a = 0; + int b = 0; + int c = 0; + int d = 0; + float2x2 indexable = float2x2(0.0f); + float2x2 indexable_1 = float2x2(0.0f); + bool x_158 = false; + bool x_159_phi = false; + int const x_16 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_85 = x_8.x_GLF_uniform_float_values.arr[0].el; + sums.arr[x_16] = -(x_85); + int const x_18 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_90 = x_8.x_GLF_uniform_float_values.arr[0].el; + sums.arr[x_18] = -(x_90); + int const x_19 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_19; + while (true) { + int const x_20 = a; + int const x_21 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_20 < x_21)) { + } else { + break; + } + int const x_22 = x_6.x_GLF_uniform_int_values.arr[1].el; + b = x_22; + while (true) { + int const x_23 = b; + int const x_24 = x_6.x_GLF_uniform_int_values.arr[3].el; + if ((x_23 < x_24)) { + } else { + break; + } + int const x_25 = x_6.x_GLF_uniform_int_values.arr[1].el; + c = x_25; + while (true) { + int const x_26 = c; + int const x_27 = a; + if ((x_26 <= x_27)) { + } else { + break; + } + int const x_28 = x_6.x_GLF_uniform_int_values.arr[1].el; + d = x_28; + while (true) { + int const x_29 = d; + int const x_30 = x_6.x_GLF_uniform_int_values.arr[3].el; + if ((x_29 < x_30)) { + } else { + break; + } + int const x_31 = a; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_125 = float(x_32); + int const x_33 = c; + int const x_34 = x_6.x_GLF_uniform_int_values.arr[2].el; + indexable = float2x2(float2(x_125, 0.0f), float2(0.0f, x_125)); + float const x_131 = indexable[x_33][x_34]; + sums.arr[x_31] = x_131; + int const x_35 = a; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_134 = float(x_36); + int const x_37 = c; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[2].el; + indexable_1 = float2x2(float2(x_134, 0.0f), float2(0.0f, x_134)); + float const x_140 = indexable_1[x_37][x_38]; + float const x_142 = sums.arr[x_35]; + sums.arr[x_35] = (x_142 + x_140); + { + int const x_39 = d; + d = (x_39 + 1); + } + } + { + int const x_41 = c; + c = (x_41 + 1); + } + } + { + int const x_43 = b; + b = (x_43 + 1); + } + } + { + int const x_45 = a; + a = (x_45 + 1); + } + } + int const x_47 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_147 = sums.arr[x_47]; + float const x_149 = x_8.x_GLF_uniform_float_values.arr[1].el; + bool const x_150 = (x_147 == x_149); + x_159_phi = x_150; + if (x_150) { + int const x_48 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_155 = sums.arr[x_48]; + float const x_157 = x_8.x_GLF_uniform_float_values.arr[2].el; + x_158 = (x_155 == x_157); + x_159_phi = x_158; + } + bool const x_159 = x_159_phi; + if (x_159) { + int const x_49 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_49), float(x_50), float(x_51), float(x_52)); + } else { + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_173 = float(x_53); + *(tint_symbol_4) = float4(x_173, x_173, x_173, x_173); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..7c6e615cfa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.spvasm @@ -0,0 +1,320 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 205 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %sums "sums" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %d "d" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %x_158 "x_158" + OpName %x_159_phi "x_159_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %28 = OpConstantNull %_arr_float_uint_2 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %39 = OpConstantNull %mat2v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %44 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %193 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %sums = OpVariable %_ptr_Function__arr_float_uint_2 Function %28 + %a = OpVariable %_ptr_Function_int Function %31 + %b = OpVariable %_ptr_Function_int Function %31 + %c = OpVariable %_ptr_Function_int Function %31 + %d = OpVariable %_ptr_Function_int Function %31 + %indexable = OpVariable %_ptr_Function_mat2v2float Function %39 +%indexable_1 = OpVariable %_ptr_Function_mat2v2float Function %39 + %x_158 = OpVariable %_ptr_Function_bool Function %44 + %x_159_phi = OpVariable %_ptr_Function_bool Function %44 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %50 = OpLoad %int %49 + %53 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %54 = OpLoad %float %53 + %56 = OpAccessChain %_ptr_Function_float %sums %50 + %57 = OpFNegate %float %54 + OpStore %56 %57 + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Function_float %sums %60 + %64 = OpFNegate %float %62 + OpStore %63 %64 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + OpStore %a %66 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %a + %72 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %73 = OpLoad %int %72 + %74 = OpSLessThan %bool %71 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpBranch %75 + %77 = OpLabel + OpBranch %68 + %75 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %79 = OpLoad %int %78 + OpStore %b %79 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %int %b + %86 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %87 = OpLoad %int %86 + %88 = OpSLessThan %bool %84 %87 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %91 + %90 = OpLabel + OpBranch %89 + %91 = OpLabel + OpBranch %81 + %89 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %93 = OpLoad %int %92 + OpStore %c %93 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %95 %96 None + OpBranch %97 + %97 = OpLabel + %98 = OpLoad %int %c + %99 = OpLoad %int %a + %100 = OpSLessThanEqual %bool %98 %99 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %103 + %102 = OpLabel + OpBranch %101 + %103 = OpLabel + OpBranch %95 + %101 = OpLabel + %104 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %105 = OpLoad %int %104 + OpStore %d %105 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %110 = OpLoad %int %d + %111 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %112 = OpLoad %int %111 + %113 = OpSLessThan %bool %110 %112 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %116 + %115 = OpLabel + OpBranch %114 + %116 = OpLabel + OpBranch %107 + %114 = OpLabel + %117 = OpLoad %int %a + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %119 = OpLoad %int %118 + %120 = OpConvertSToF %float %119 + %121 = OpLoad %int %c + %122 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %123 = OpLoad %int %122 + %125 = OpCompositeConstruct %v2float %120 %float_0 + %126 = OpCompositeConstruct %v2float %float_0 %120 + %127 = OpCompositeConstruct %mat2v2float %125 %126 + OpStore %indexable %127 + %128 = OpAccessChain %_ptr_Function_float %indexable %121 %123 + %129 = OpLoad %float %128 + %130 = OpAccessChain %_ptr_Function_float %sums %117 + OpStore %130 %129 + %131 = OpLoad %int %a + %132 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %133 = OpLoad %int %132 + %134 = OpConvertSToF %float %133 + %135 = OpLoad %int %c + %136 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %137 = OpLoad %int %136 + %138 = OpCompositeConstruct %v2float %134 %float_0 + %139 = OpCompositeConstruct %v2float %float_0 %134 + %140 = OpCompositeConstruct %mat2v2float %138 %139 + OpStore %indexable_1 %140 + %141 = OpAccessChain %_ptr_Function_float %indexable_1 %135 %137 + %142 = OpLoad %float %141 + %143 = OpAccessChain %_ptr_Function_float %sums %131 + %144 = OpLoad %float %143 + %145 = OpAccessChain %_ptr_Function_float %sums %131 + %146 = OpFAdd %float %144 %142 + OpStore %145 %146 + OpBranch %108 + %108 = OpLabel + %147 = OpLoad %int %d + %148 = OpIAdd %int %147 %int_1 + OpStore %d %148 + OpBranch %106 + %107 = OpLabel + OpBranch %96 + %96 = OpLabel + %149 = OpLoad %int %c + %150 = OpIAdd %int %149 %int_1 + OpStore %c %150 + OpBranch %94 + %95 = OpLabel + OpBranch %82 + %82 = OpLabel + %151 = OpLoad %int %b + %152 = OpIAdd %int %151 %int_1 + OpStore %b %152 + OpBranch %80 + %81 = OpLabel + OpBranch %69 + %69 = OpLabel + %153 = OpLoad %int %a + %154 = OpIAdd %int %153 %int_1 + OpStore %a %154 + OpBranch %67 + %68 = OpLabel + %155 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %156 = OpLoad %int %155 + %157 = OpAccessChain %_ptr_Function_float %sums %156 + %158 = OpLoad %float %157 + %159 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %160 = OpLoad %float %159 + %161 = OpFOrdEqual %bool %158 %160 + OpStore %x_159_phi %161 + OpSelectionMerge %162 None + OpBranchConditional %161 %163 %162 + %163 = OpLabel + %164 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %165 = OpLoad %int %164 + %166 = OpAccessChain %_ptr_Function_float %sums %165 + %167 = OpLoad %float %166 + %168 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %169 = OpLoad %float %168 + %170 = OpFOrdEqual %bool %167 %169 + OpStore %x_158 %170 + %171 = OpLoad %bool %x_158 + OpStore %x_159_phi %171 + OpBranch %162 + %162 = OpLabel + %172 = OpLoad %bool %x_159_phi + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %175 + %174 = OpLabel + %176 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %177 = OpLoad %int %176 + %178 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %179 = OpLoad %int %178 + %180 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %181 = OpLoad %int %180 + %182 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %183 = OpLoad %int %182 + %184 = OpConvertSToF %float %177 + %185 = OpConvertSToF %float %179 + %186 = OpConvertSToF %float %181 + %187 = OpConvertSToF %float %183 + %188 = OpCompositeConstruct %v4float %184 %185 %186 %187 + OpStore %x_GLF_color %188 + OpBranch %173 + %175 = OpLabel + %189 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %190 = OpLoad %int %189 + %191 = OpConvertSToF %float %190 + %192 = OpCompositeConstruct %v4float %191 %191 %191 %191 + OpStore %x_GLF_color %192 + OpBranch %173 + %173 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %193 +%tint_symbol = OpFunctionParameter %main_out + %197 = OpLabel + %198 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %198 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %200 = OpLabel + %201 = OpFunctionCall %void %main_1 + %203 = OpLoad %v4float %x_GLF_color + %204 = OpCompositeConstruct %main_out %203 + %202 = OpFunctionCall %void %tint_symbol_2 %204 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..83081ec3d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.spvasm.expected.wgsl @@ -0,0 +1,150 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var sums : array; + var a : i32; + var b : i32; + var c : i32; + var d : i32; + var indexable : mat2x2; + var indexable_1 : mat2x2; + var x_158 : bool; + var x_159_phi : bool; + let x_16 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_85 : f32 = x_8.x_GLF_uniform_float_values[0]; + sums[x_16] = -(x_85); + let x_18 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_90 : f32 = x_8.x_GLF_uniform_float_values[0]; + sums[x_18] = -(x_90); + let x_19 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_19; + loop { + let x_20 : i32 = a; + let x_21 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_20 < x_21)) { + } else { + break; + } + let x_22 : i32 = x_6.x_GLF_uniform_int_values[1]; + b = x_22; + loop { + let x_23 : i32 = b; + let x_24 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_23 < x_24)) { + } else { + break; + } + let x_25 : i32 = x_6.x_GLF_uniform_int_values[1]; + c = x_25; + loop { + let x_26 : i32 = c; + let x_27 : i32 = a; + if ((x_26 <= x_27)) { + } else { + break; + } + let x_28 : i32 = x_6.x_GLF_uniform_int_values[1]; + d = x_28; + loop { + let x_29 : i32 = d; + let x_30 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_29 < x_30)) { + } else { + break; + } + let x_31 : i32 = a; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_125 : f32 = f32(x_32); + let x_33 : i32 = c; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[2]; + indexable = mat2x2(vec2(x_125, 0.0), vec2(0.0, x_125)); + let x_131 : f32 = indexable[x_33][x_34]; + sums[x_31] = x_131; + let x_35 : i32 = a; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_134 : f32 = f32(x_36); + let x_37 : i32 = c; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[2]; + indexable_1 = mat2x2(vec2(x_134, 0.0), vec2(0.0, x_134)); + let x_140 : f32 = indexable_1[x_37][x_38]; + let x_142 : f32 = sums[x_35]; + sums[x_35] = (x_142 + x_140); + + continuing { + let x_39 : i32 = d; + d = (x_39 + 1); + } + } + + continuing { + let x_41 : i32 = c; + c = (x_41 + 1); + } + } + + continuing { + let x_43 : i32 = b; + b = (x_43 + 1); + } + } + + continuing { + let x_45 : i32 = a; + a = (x_45 + 1); + } + } + let x_47 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_147 : f32 = sums[x_47]; + let x_149 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_150 : bool = (x_147 == x_149); + x_159_phi = x_150; + if (x_150) { + let x_48 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_155 : f32 = sums[x_48]; + let x_157 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_158 = (x_155 == x_157); + x_159_phi = x_158; + } + let x_159 : bool = x_159_phi; + if (x_159) { + let x_49 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_49), f32(x_50), f32(x_51), f32(x_52)); + } else { + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_173 : f32 = f32(x_53); + x_GLF_color = vec4(x_173, x_173, x_173, x_173); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl new file mode 100644 index 0000000000..83081ec3d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl @@ -0,0 +1,150 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var sums : array; + var a : i32; + var b : i32; + var c : i32; + var d : i32; + var indexable : mat2x2; + var indexable_1 : mat2x2; + var x_158 : bool; + var x_159_phi : bool; + let x_16 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_85 : f32 = x_8.x_GLF_uniform_float_values[0]; + sums[x_16] = -(x_85); + let x_18 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_90 : f32 = x_8.x_GLF_uniform_float_values[0]; + sums[x_18] = -(x_90); + let x_19 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_19; + loop { + let x_20 : i32 = a; + let x_21 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_20 < x_21)) { + } else { + break; + } + let x_22 : i32 = x_6.x_GLF_uniform_int_values[1]; + b = x_22; + loop { + let x_23 : i32 = b; + let x_24 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_23 < x_24)) { + } else { + break; + } + let x_25 : i32 = x_6.x_GLF_uniform_int_values[1]; + c = x_25; + loop { + let x_26 : i32 = c; + let x_27 : i32 = a; + if ((x_26 <= x_27)) { + } else { + break; + } + let x_28 : i32 = x_6.x_GLF_uniform_int_values[1]; + d = x_28; + loop { + let x_29 : i32 = d; + let x_30 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_29 < x_30)) { + } else { + break; + } + let x_31 : i32 = a; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_125 : f32 = f32(x_32); + let x_33 : i32 = c; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[2]; + indexable = mat2x2(vec2(x_125, 0.0), vec2(0.0, x_125)); + let x_131 : f32 = indexable[x_33][x_34]; + sums[x_31] = x_131; + let x_35 : i32 = a; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_134 : f32 = f32(x_36); + let x_37 : i32 = c; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[2]; + indexable_1 = mat2x2(vec2(x_134, 0.0), vec2(0.0, x_134)); + let x_140 : f32 = indexable_1[x_37][x_38]; + let x_142 : f32 = sums[x_35]; + sums[x_35] = (x_142 + x_140); + + continuing { + let x_39 : i32 = d; + d = (x_39 + 1); + } + } + + continuing { + let x_41 : i32 = c; + c = (x_41 + 1); + } + } + + continuing { + let x_43 : i32 = b; + b = (x_43 + 1); + } + } + + continuing { + let x_45 : i32 = a; + a = (x_45 + 1); + } + } + let x_47 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_147 : f32 = sums[x_47]; + let x_149 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_150 : bool = (x_147 == x_149); + x_159_phi = x_150; + if (x_150) { + let x_48 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_155 : f32 = sums[x_48]; + let x_157 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_158 = (x_155 == x_157); + x_159_phi = x_158; + } + let x_159 : bool = x_159_phi; + if (x_159) { + let x_49 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_49), f32(x_50), f32(x_51), f32(x_52)); + } else { + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_173 : f32 = f32(x_53); + x_GLF_color = vec4(x_173, x_173, x_173, x_173); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2d3af226ec --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.hlsl @@ -0,0 +1,128 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float sums[2] = (float[2])0; + int a = 0; + int b = 0; + int c = 0; + int d = 0; + float2x2 indexable = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 indexable_1 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + bool x_158 = false; + bool x_159_phi = false; + const int x_16 = asint(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_85 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + sums[x_16] = -(x_85); + const int x_18 = asint(x_6[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_90 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + sums[x_18] = -(x_90); + const int x_19 = asint(x_6[1].x); + a = x_19; + while (true) { + const int x_20 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_21 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_20 < x_21)) { + } else { + break; + } + const int x_22 = asint(x_6[1].x); + b = x_22; + while (true) { + const int x_23 = b; + const int x_24 = asint(x_6[3].x); + if ((x_23 < x_24)) { + } else { + break; + } + const int x_25 = asint(x_6[1].x); + c = x_25; + { + for(; (c <= a); c = (c + 1)) { + const int x_28 = asint(x_6[1].x); + d = x_28; + while (true) { + const int x_29 = d; + const int x_30 = asint(x_6[3].x); + if ((x_29 < x_30)) { + } else { + break; + } + const int x_31 = a; + const int x_32 = asint(x_6[2].x); + const float x_125 = float(x_32); + const int x_33 = c; + const int x_34 = asint(x_6[2].x); + indexable = float2x2(float2(x_125, 0.0f), float2(0.0f, x_125)); + const float x_131 = indexable[x_33][x_34]; + sums[x_31] = x_131; + const int x_35 = a; + const int x_36 = asint(x_6[2].x); + const float x_134 = float(x_36); + const int x_37 = c; + const int x_38 = asint(x_6[2].x); + indexable_1 = float2x2(float2(x_134, 0.0f), float2(0.0f, x_134)); + const float x_140 = indexable_1[x_37][x_38]; + const float x_142 = sums[x_35]; + sums[x_35] = (x_142 + x_140); + { + d = (d + 1); + } + } + } + } + { + b = (b + 1); + } + } + { + a = (a + 1); + } + } + const int x_47 = asint(x_6[1].x); + const float x_147 = sums[x_47]; + const float x_149 = asfloat(x_8[1].x); + const bool x_150 = (x_147 == x_149); + x_159_phi = x_150; + if (x_150) { + const int x_48 = asint(x_6[2].x); + const float x_155 = sums[x_48]; + const float x_157 = asfloat(x_8[2].x); + x_158 = (x_155 == x_157); + x_159_phi = x_158; + } + if (x_159_phi) { + const int x_49 = asint(x_6[2].x); + const int x_50 = asint(x_6[1].x); + const int x_51 = asint(x_6[1].x); + const int x_52 = asint(x_6[2].x); + x_GLF_color = float4(float(x_49), float(x_50), float(x_51), float(x_52)); + } else { + const int x_53 = asint(x_6[1].x); + const float x_173 = float(x_53); + x_GLF_color = float4(x_173, x_173, x_173, x_173); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..ed07fe72f1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.msl @@ -0,0 +1,157 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + float arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_4) { + tint_array_wrapper_2 sums = {}; + int a = 0; + int b = 0; + int c = 0; + int d = 0; + float2x2 indexable = float2x2(0.0f); + float2x2 indexable_1 = float2x2(0.0f); + bool x_158 = false; + bool x_159_phi = false; + int const x_16 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_85 = x_8.x_GLF_uniform_float_values.arr[0].el; + sums.arr[x_16] = -(x_85); + int const x_18 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_90 = x_8.x_GLF_uniform_float_values.arr[0].el; + sums.arr[x_18] = -(x_90); + int const x_19 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_19; + while (true) { + int const x_20 = a; + int const x_21 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_20 < x_21)) { + } else { + break; + } + int const x_22 = x_6.x_GLF_uniform_int_values.arr[1].el; + b = x_22; + while (true) { + int const x_23 = b; + int const x_24 = x_6.x_GLF_uniform_int_values.arr[3].el; + if ((x_23 < x_24)) { + } else { + break; + } + int const x_25 = x_6.x_GLF_uniform_int_values.arr[1].el; + c = x_25; + while (true) { + int const x_26 = c; + int const x_27 = a; + if ((x_26 <= x_27)) { + } else { + break; + } + int const x_28 = x_6.x_GLF_uniform_int_values.arr[1].el; + d = x_28; + while (true) { + int const x_29 = d; + int const x_30 = x_6.x_GLF_uniform_int_values.arr[3].el; + if ((x_29 < x_30)) { + } else { + break; + } + int const x_31 = a; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_125 = float(x_32); + int const x_33 = c; + int const x_34 = x_6.x_GLF_uniform_int_values.arr[2].el; + indexable = float2x2(float2(x_125, 0.0f), float2(0.0f, x_125)); + float const x_131 = indexable[x_33][x_34]; + sums.arr[x_31] = x_131; + int const x_35 = a; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_134 = float(x_36); + int const x_37 = c; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[2].el; + indexable_1 = float2x2(float2(x_134, 0.0f), float2(0.0f, x_134)); + float const x_140 = indexable_1[x_37][x_38]; + float const x_142 = sums.arr[x_35]; + sums.arr[x_35] = (x_142 + x_140); + { + int const x_39 = d; + d = (x_39 + 1); + } + } + { + int const x_41 = c; + c = (x_41 + 1); + } + } + { + int const x_43 = b; + b = (x_43 + 1); + } + } + { + int const x_45 = a; + a = (x_45 + 1); + } + } + int const x_47 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_147 = sums.arr[x_47]; + float const x_149 = x_8.x_GLF_uniform_float_values.arr[1].el; + bool const x_150 = (x_147 == x_149); + x_159_phi = x_150; + if (x_150) { + int const x_48 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_155 = sums.arr[x_48]; + float const x_157 = x_8.x_GLF_uniform_float_values.arr[2].el; + x_158 = (x_155 == x_157); + x_159_phi = x_158; + } + bool const x_159 = x_159_phi; + if (x_159) { + int const x_49 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_49), float(x_50), float(x_51), float(x_52)); + } else { + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_173 = float(x_53); + *(tint_symbol_4) = float4(x_173, x_173, x_173, x_173); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..7c6e615cfa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.spvasm @@ -0,0 +1,320 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 205 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %sums "sums" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %d "d" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %x_158 "x_158" + OpName %x_159_phi "x_159_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %28 = OpConstantNull %_arr_float_uint_2 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %39 = OpConstantNull %mat2v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %44 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %193 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %sums = OpVariable %_ptr_Function__arr_float_uint_2 Function %28 + %a = OpVariable %_ptr_Function_int Function %31 + %b = OpVariable %_ptr_Function_int Function %31 + %c = OpVariable %_ptr_Function_int Function %31 + %d = OpVariable %_ptr_Function_int Function %31 + %indexable = OpVariable %_ptr_Function_mat2v2float Function %39 +%indexable_1 = OpVariable %_ptr_Function_mat2v2float Function %39 + %x_158 = OpVariable %_ptr_Function_bool Function %44 + %x_159_phi = OpVariable %_ptr_Function_bool Function %44 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %50 = OpLoad %int %49 + %53 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %54 = OpLoad %float %53 + %56 = OpAccessChain %_ptr_Function_float %sums %50 + %57 = OpFNegate %float %54 + OpStore %56 %57 + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Function_float %sums %60 + %64 = OpFNegate %float %62 + OpStore %63 %64 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + OpStore %a %66 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %a + %72 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %73 = OpLoad %int %72 + %74 = OpSLessThan %bool %71 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpBranch %75 + %77 = OpLabel + OpBranch %68 + %75 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %79 = OpLoad %int %78 + OpStore %b %79 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %int %b + %86 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %87 = OpLoad %int %86 + %88 = OpSLessThan %bool %84 %87 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %91 + %90 = OpLabel + OpBranch %89 + %91 = OpLabel + OpBranch %81 + %89 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %93 = OpLoad %int %92 + OpStore %c %93 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %95 %96 None + OpBranch %97 + %97 = OpLabel + %98 = OpLoad %int %c + %99 = OpLoad %int %a + %100 = OpSLessThanEqual %bool %98 %99 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %103 + %102 = OpLabel + OpBranch %101 + %103 = OpLabel + OpBranch %95 + %101 = OpLabel + %104 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %105 = OpLoad %int %104 + OpStore %d %105 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %110 = OpLoad %int %d + %111 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %112 = OpLoad %int %111 + %113 = OpSLessThan %bool %110 %112 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %116 + %115 = OpLabel + OpBranch %114 + %116 = OpLabel + OpBranch %107 + %114 = OpLabel + %117 = OpLoad %int %a + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %119 = OpLoad %int %118 + %120 = OpConvertSToF %float %119 + %121 = OpLoad %int %c + %122 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %123 = OpLoad %int %122 + %125 = OpCompositeConstruct %v2float %120 %float_0 + %126 = OpCompositeConstruct %v2float %float_0 %120 + %127 = OpCompositeConstruct %mat2v2float %125 %126 + OpStore %indexable %127 + %128 = OpAccessChain %_ptr_Function_float %indexable %121 %123 + %129 = OpLoad %float %128 + %130 = OpAccessChain %_ptr_Function_float %sums %117 + OpStore %130 %129 + %131 = OpLoad %int %a + %132 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %133 = OpLoad %int %132 + %134 = OpConvertSToF %float %133 + %135 = OpLoad %int %c + %136 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %137 = OpLoad %int %136 + %138 = OpCompositeConstruct %v2float %134 %float_0 + %139 = OpCompositeConstruct %v2float %float_0 %134 + %140 = OpCompositeConstruct %mat2v2float %138 %139 + OpStore %indexable_1 %140 + %141 = OpAccessChain %_ptr_Function_float %indexable_1 %135 %137 + %142 = OpLoad %float %141 + %143 = OpAccessChain %_ptr_Function_float %sums %131 + %144 = OpLoad %float %143 + %145 = OpAccessChain %_ptr_Function_float %sums %131 + %146 = OpFAdd %float %144 %142 + OpStore %145 %146 + OpBranch %108 + %108 = OpLabel + %147 = OpLoad %int %d + %148 = OpIAdd %int %147 %int_1 + OpStore %d %148 + OpBranch %106 + %107 = OpLabel + OpBranch %96 + %96 = OpLabel + %149 = OpLoad %int %c + %150 = OpIAdd %int %149 %int_1 + OpStore %c %150 + OpBranch %94 + %95 = OpLabel + OpBranch %82 + %82 = OpLabel + %151 = OpLoad %int %b + %152 = OpIAdd %int %151 %int_1 + OpStore %b %152 + OpBranch %80 + %81 = OpLabel + OpBranch %69 + %69 = OpLabel + %153 = OpLoad %int %a + %154 = OpIAdd %int %153 %int_1 + OpStore %a %154 + OpBranch %67 + %68 = OpLabel + %155 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %156 = OpLoad %int %155 + %157 = OpAccessChain %_ptr_Function_float %sums %156 + %158 = OpLoad %float %157 + %159 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %160 = OpLoad %float %159 + %161 = OpFOrdEqual %bool %158 %160 + OpStore %x_159_phi %161 + OpSelectionMerge %162 None + OpBranchConditional %161 %163 %162 + %163 = OpLabel + %164 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %165 = OpLoad %int %164 + %166 = OpAccessChain %_ptr_Function_float %sums %165 + %167 = OpLoad %float %166 + %168 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %169 = OpLoad %float %168 + %170 = OpFOrdEqual %bool %167 %169 + OpStore %x_158 %170 + %171 = OpLoad %bool %x_158 + OpStore %x_159_phi %171 + OpBranch %162 + %162 = OpLabel + %172 = OpLoad %bool %x_159_phi + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %175 + %174 = OpLabel + %176 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %177 = OpLoad %int %176 + %178 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %179 = OpLoad %int %178 + %180 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %181 = OpLoad %int %180 + %182 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %183 = OpLoad %int %182 + %184 = OpConvertSToF %float %177 + %185 = OpConvertSToF %float %179 + %186 = OpConvertSToF %float %181 + %187 = OpConvertSToF %float %183 + %188 = OpCompositeConstruct %v4float %184 %185 %186 %187 + OpStore %x_GLF_color %188 + OpBranch %173 + %175 = OpLabel + %189 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %190 = OpLoad %int %189 + %191 = OpConvertSToF %float %190 + %192 = OpCompositeConstruct %v4float %191 %191 %191 %191 + OpStore %x_GLF_color %192 + OpBranch %173 + %173 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %193 +%tint_symbol = OpFunctionParameter %main_out + %197 = OpLabel + %198 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %198 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %200 = OpLabel + %201 = OpFunctionCall %void %main_1 + %203 = OpLoad %v4float %x_GLF_color + %204 = OpCompositeConstruct %main_out %203 + %202 = OpFunctionCall %void %tint_symbol_2 %204 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..83081ec3d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-branch-probability-identity-matrix/0-opt.wgsl.expected.wgsl @@ -0,0 +1,150 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var sums : array; + var a : i32; + var b : i32; + var c : i32; + var d : i32; + var indexable : mat2x2; + var indexable_1 : mat2x2; + var x_158 : bool; + var x_159_phi : bool; + let x_16 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_85 : f32 = x_8.x_GLF_uniform_float_values[0]; + sums[x_16] = -(x_85); + let x_18 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_90 : f32 = x_8.x_GLF_uniform_float_values[0]; + sums[x_18] = -(x_90); + let x_19 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_19; + loop { + let x_20 : i32 = a; + let x_21 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_20 < x_21)) { + } else { + break; + } + let x_22 : i32 = x_6.x_GLF_uniform_int_values[1]; + b = x_22; + loop { + let x_23 : i32 = b; + let x_24 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_23 < x_24)) { + } else { + break; + } + let x_25 : i32 = x_6.x_GLF_uniform_int_values[1]; + c = x_25; + loop { + let x_26 : i32 = c; + let x_27 : i32 = a; + if ((x_26 <= x_27)) { + } else { + break; + } + let x_28 : i32 = x_6.x_GLF_uniform_int_values[1]; + d = x_28; + loop { + let x_29 : i32 = d; + let x_30 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_29 < x_30)) { + } else { + break; + } + let x_31 : i32 = a; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_125 : f32 = f32(x_32); + let x_33 : i32 = c; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[2]; + indexable = mat2x2(vec2(x_125, 0.0), vec2(0.0, x_125)); + let x_131 : f32 = indexable[x_33][x_34]; + sums[x_31] = x_131; + let x_35 : i32 = a; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_134 : f32 = f32(x_36); + let x_37 : i32 = c; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[2]; + indexable_1 = mat2x2(vec2(x_134, 0.0), vec2(0.0, x_134)); + let x_140 : f32 = indexable_1[x_37][x_38]; + let x_142 : f32 = sums[x_35]; + sums[x_35] = (x_142 + x_140); + + continuing { + let x_39 : i32 = d; + d = (x_39 + 1); + } + } + + continuing { + let x_41 : i32 = c; + c = (x_41 + 1); + } + } + + continuing { + let x_43 : i32 = b; + b = (x_43 + 1); + } + } + + continuing { + let x_45 : i32 = a; + a = (x_45 + 1); + } + } + let x_47 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_147 : f32 = sums[x_47]; + let x_149 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_150 : bool = (x_147 == x_149); + x_159_phi = x_150; + if (x_150) { + let x_48 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_155 : f32 = sums[x_48]; + let x_157 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_158 = (x_155 == x_157); + x_159_phi = x_158; + } + let x_159 : bool = x_159_phi; + if (x_159) { + let x_49 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_49), f32(x_50), f32(x_51), f32(x_52)); + } else { + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_173 : f32 = f32(x_53); + x_GLF_color = vec4(x_173, x_173, x_173, x_173); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm new file mode 100644 index 0000000000..f91310be95 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm @@ -0,0 +1,74 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f "f" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_142_699997 = OpConstant %float 142.699997 + %int = OpTypeInt 32 1 + %float_100 = OpConstant %float 100 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %9 + %24 = OpLabel + %f = OpVariable %_ptr_Function_float Function + OpStore %f %float_142_699997 + %25 = OpLoad %float %f + %26 = OpConvertFToS %int %25 + %27 = OpConvertSToF %float %26 + %28 = OpFOrdGreaterThan %bool %27 %float_100 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %31 + %30 = OpLabel + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %33 = OpLoad %int %32 + %34 = OpConvertSToF %float %33 + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %36 = OpLoad %int %35 + %37 = OpConvertSToF %float %36 + %38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpConvertSToF %float %39 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpConvertSToF %float %42 + %44 = OpCompositeConstruct %v4float %34 %37 %40 %43 + OpStore %_GLF_color %44 + OpBranch %29 + %31 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpCompositeConstruct %v4float %47 %47 %47 %47 + OpStore %_GLF_color %48 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..77a66e879b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.hlsl @@ -0,0 +1,38 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; + +void main_1() { + float f = 0.0f; + f = 142.699996948f; + if ((float(int(f)) > 100.0f)) { + const int x_33 = asint(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_36 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_39 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_42 = asint(x_6[1].x); + x_GLF_color = float4(float(x_33), float(x_36), float(x_39), float(x_42)); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_46 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_47 = float(x_46); + x_GLF_color = float4(x_47, x_47, x_47, x_47); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..739634ab45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + f = 142.699996948f; + float const x_25 = f; + if ((float(int(x_25)) > 100.0f)) { + int const x_33 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_39 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_42 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_33), float(x_36), float(x_39), float(x_42)); + } else { + int const x_46 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_47 = float(x_46); + *(tint_symbol_4) = float4(x_47, x_47, x_47, x_47); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..7f8bc3029b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpConstantNull %float +%float_142_699997 = OpConstant %float 142.699997 + %float_100 = OpConstant %float 100 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %f = OpVariable %_ptr_Function_float Function %21 + OpStore %f %float_142_699997 + %23 = OpLoad %float %f + %25 = OpConvertFToS %int %23 + %24 = OpConvertSToF %float %25 + %27 = OpFOrdGreaterThan %bool %24 %float_100 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %36 = OpLoad %int %35 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %36 + %45 = OpConvertSToF %float %39 + %46 = OpConvertSToF %float %41 + %47 = OpConvertSToF %float %43 + %48 = OpCompositeConstruct %v4float %44 %45 %46 %47 + OpStore %x_GLF_color %48 + OpBranch %29 + %31 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpCompositeConstruct %v4float %51 %51 %51 %51 + OpStore %x_GLF_color %52 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %53 +%tint_symbol = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %60 = OpLabel + %61 = OpFunctionCall %void %main_1 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpCompositeConstruct %main_out %63 + %62 = OpFunctionCall %void %tint_symbol_2 %64 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f7217b176c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var f : f32; + f = 142.699996948; + let x_25 : f32 = f; + if ((f32(i32(x_25)) > 100.0)) { + let x_33 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_42 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_33), f32(x_36), f32(x_39), f32(x_42)); + } else { + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_47 : f32 = f32(x_46); + x_GLF_color = vec4(x_47, x_47, x_47, x_47); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl new file mode 100644 index 0000000000..f7217b176c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl @@ -0,0 +1,39 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var f : f32; + f = 142.699996948; + let x_25 : f32 = f; + if ((f32(i32(x_25)) > 100.0)) { + let x_33 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_42 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_33), f32(x_36), f32(x_39), f32(x_42)); + } else { + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_47 : f32 = f32(x_46); + x_GLF_color = vec4(x_47, x_47, x_47, x_47); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..77a66e879b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.hlsl @@ -0,0 +1,38 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; + +void main_1() { + float f = 0.0f; + f = 142.699996948f; + if ((float(int(f)) > 100.0f)) { + const int x_33 = asint(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_36 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_39 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_42 = asint(x_6[1].x); + x_GLF_color = float4(float(x_33), float(x_36), float(x_39), float(x_42)); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_46 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_47 = float(x_46); + x_GLF_color = float4(x_47, x_47, x_47, x_47); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..739634ab45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + f = 142.699996948f; + float const x_25 = f; + if ((float(int(x_25)) > 100.0f)) { + int const x_33 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_39 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_42 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_33), float(x_36), float(x_39), float(x_42)); + } else { + int const x_46 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_47 = float(x_46); + *(tint_symbol_4) = float4(x_47, x_47, x_47, x_47); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..7f8bc3029b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpConstantNull %float +%float_142_699997 = OpConstant %float 142.699997 + %float_100 = OpConstant %float 100 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %f = OpVariable %_ptr_Function_float Function %21 + OpStore %f %float_142_699997 + %23 = OpLoad %float %f + %25 = OpConvertFToS %int %23 + %24 = OpConvertSToF %float %25 + %27 = OpFOrdGreaterThan %bool %24 %float_100 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %36 = OpLoad %int %35 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %36 + %45 = OpConvertSToF %float %39 + %46 = OpConvertSToF %float %41 + %47 = OpConvertSToF %float %43 + %48 = OpCompositeConstruct %v4float %44 %45 %46 %47 + OpStore %x_GLF_color %48 + OpBranch %29 + %31 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpCompositeConstruct %v4float %51 %51 %51 %51 + OpStore %x_GLF_color %52 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %53 +%tint_symbol = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %60 = OpLabel + %61 = OpFunctionCall %void %main_1 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpCompositeConstruct %main_out %63 + %62 = OpFunctionCall %void %tint_symbol_2 %64 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f7217b176c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cast-float-to-int-and-back/0-opt.wgsl.expected.wgsl @@ -0,0 +1,39 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var f : f32; + f = 142.699996948; + let x_25 : f32 = f; + if ((f32(i32(x_25)) > 100.0)) { + let x_33 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_42 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_33), f32(x_36), f32(x_39), f32(x_42)); + } else { + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_47 : f32 = f32(x_46); + x_GLF_color = vec4(x_47, x_47, x_47, x_47); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm new file mode 100644 index 0000000000..c832ba49dc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm @@ -0,0 +1,148 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %sums "sums" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %indexable "indexable" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %38 = OpLabel + %sums = OpVariable %_ptr_Function__arr_float_uint_3 Function + %i = OpVariable %_ptr_Function_int Function + %indexable = OpVariable %_ptr_Function_mat2v4float Function + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpCompositeConstruct %_arr_float_uint_3 %40 %42 %44 + OpStore %sums %45 + OpStore %i %int_0 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %49 + %49 = OpLabel + %50 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpExtInst %int %1 SClamp %52 %54 %int_2 + %56 = OpSLessThan %bool %50 %55 + OpBranchConditional %56 %57 %47 + %57 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpCompositeConstruct %v4float %61 %float_0 %float_0 %float_0 + %63 = OpCompositeConstruct %v4float %float_0 %61 %float_0 %float_0 + %64 = OpCompositeConstruct %mat2v4float %62 %63 + %65 = OpLoad %int %i + %66 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %67 = OpLoad %int %66 + OpStore %indexable %64 + %68 = OpAccessChain %_ptr_Function_float %indexable %65 %67 + %69 = OpLoad %float %68 + %70 = OpAccessChain %_ptr_Function_float %sums %59 + %71 = OpLoad %float %70 + %72 = OpFAdd %float %71 %69 + %73 = OpAccessChain %_ptr_Function_float %sums %59 + OpStore %73 %72 + OpBranch %48 + %48 = OpLabel + %74 = OpLoad %int %i + %75 = OpIAdd %int %74 %int_1 + OpStore %i %75 + OpBranch %46 + %47 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Function_float %sums %77 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %81 = OpLoad %float %80 + %82 = OpFOrdEqual %bool %79 %81 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %87 = OpLoad %int %86 + %88 = OpConvertSToF %float %87 + %89 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpConvertSToF %float %90 + %92 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %93 = OpLoad %int %92 + %94 = OpConvertSToF %float %93 + %95 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %96 = OpLoad %int %95 + %97 = OpConvertSToF %float %96 + %98 = OpCompositeConstruct %v4float %88 %91 %94 %97 + OpStore %_GLF_color %98 + OpBranch %83 + %85 = OpLabel + %99 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %100 = OpLoad %int %99 + %101 = OpConvertSToF %float %100 + %102 = OpCompositeConstruct %v4float %101 %101 %101 %101 + OpStore %_GLF_color %102 + OpBranch %83 + %83 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..d99ee638d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.hlsl @@ -0,0 +1,76 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float sums[3] = (float[3])0; + int i = 0; + float2x4 indexable = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_42 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float tint_symbol_4[3] = {x_40, x_42, x_44}; + sums = tint_symbol_4; + i = 0; + while (true) { + const int x_50 = i; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_9[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_50 < clamp(x_52, x_54, 2))) { + } else { + break; + } + const int x_59 = asint(x_9[2].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_61 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_65 = i; + const int x_67 = asint(x_9[1].x); + indexable = float2x4(float4(x_61, 0.0f, 0.0f, 0.0f), float4(0.0f, x_61, 0.0f, 0.0f)); + const float x_69 = indexable[x_65][x_67]; + const float x_71 = sums[x_59]; + sums[x_59] = (x_71 + x_69); + { + i = (i + 1); + } + } + const int x_77 = asint(x_9[2].x); + const float x_79 = sums[x_77]; + const float x_81 = asfloat(x_6[1].x); + if ((x_79 == x_81)) { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_87 = asint(x_9[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const int x_90 = asint(x_9[1].x); + const int x_93 = asint(x_9[1].x); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_96 = asint(x_9[scalar_offset_7 / 4][scalar_offset_7 % 4]); + x_GLF_color = float4(float(x_87), float(x_90), float(x_93), float(x_96)); + } else { + const int x_100 = asint(x_9[1].x); + const float x_101 = float(x_100); + x_GLF_color = float4(x_101, x_101, x_101, x_101); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d993da94be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.msl @@ -0,0 +1,89 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5) { + tint_array_wrapper_2 sums = {}; + int i = 0; + float2x4 indexable = float2x4(0.0f); + float const x_40 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_40, x_42, x_44}}; + sums = tint_symbol_3; + i = 0; + while (true) { + int const x_50 = i; + int const x_52 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_54 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_50 < clamp(x_52, x_54, 2))) { + } else { + break; + } + int const x_59 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_61 = x_6.x_GLF_uniform_float_values.arr[0].el; + int const x_65 = i; + int const x_67 = x_9.x_GLF_uniform_int_values.arr[1].el; + indexable = float2x4(float4(x_61, 0.0f, 0.0f, 0.0f), float4(0.0f, x_61, 0.0f, 0.0f)); + float const x_69 = indexable[x_65][x_67]; + float const x_71 = sums.arr[x_59]; + sums.arr[x_59] = (x_71 + x_69); + { + int const x_74 = i; + i = (x_74 + 1); + } + } + int const x_77 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_79 = sums.arr[x_77]; + float const x_81 = x_6.x_GLF_uniform_float_values.arr[1].el; + if ((x_79 == x_81)) { + int const x_87 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_90 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_93 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_96 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_87), float(x_90), float(x_93), float(x_96)); + } else { + int const x_100 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_101 = float(x_100); + *(tint_symbol_5) = float4(x_101, x_101, x_101, x_101); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..9bb74649ef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.spvasm @@ -0,0 +1,190 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 123 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %sums "sums" + OpName %i "i" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 + %27 = OpConstantNull %_arr_float_uint_3 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int +%mat2v4float = OpTypeMatrix %v4float 2 +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float + %34 = OpConstantNull %mat2v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %111 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %sums = OpVariable %_ptr_Function__arr_float_uint_3 Function %27 + %i = OpVariable %_ptr_Function_int Function %30 + %indexable = OpVariable %_ptr_Function_mat2v4float Function %34 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %43 = OpLoad %float %42 + %44 = OpCompositeConstruct %_arr_float_uint_3 %39 %41 %43 + OpStore %sums %44 + OpStore %i %int_0 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpExtInst %int %56 SClamp %52 %54 %int_2 + %58 = OpSLessThan %bool %49 %55 + OpSelectionMerge %60 None + OpBranchConditional %58 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %46 + %60 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpLoad %int %i + %69 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %70 = OpLoad %int %69 + %72 = OpCompositeConstruct %v4float %66 %float_0 %float_0 %float_0 + %73 = OpCompositeConstruct %v4float %float_0 %66 %float_0 %float_0 + %74 = OpCompositeConstruct %mat2v4float %72 %73 + OpStore %indexable %74 + %76 = OpAccessChain %_ptr_Function_float %indexable %67 %70 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Function_float %sums %64 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Function_float %sums %64 + %81 = OpFAdd %float %79 %77 + OpStore %80 %81 + OpBranch %47 + %47 = OpLabel + %82 = OpLoad %int %i + %83 = OpIAdd %int %82 %int_1 + OpStore %i %83 + OpBranch %45 + %46 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Function_float %sums %85 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %89 = OpLoad %float %88 + %90 = OpFOrdEqual %bool %87 %89 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %93 + %92 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %95 = OpLoad %int %94 + %96 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %101 = OpLoad %int %100 + %102 = OpConvertSToF %float %95 + %103 = OpConvertSToF %float %97 + %104 = OpConvertSToF %float %99 + %105 = OpConvertSToF %float %101 + %106 = OpCompositeConstruct %v4float %102 %103 %104 %105 + OpStore %x_GLF_color %106 + OpBranch %91 + %93 = OpLabel + %107 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %108 = OpLoad %int %107 + %109 = OpConvertSToF %float %108 + %110 = OpCompositeConstruct %v4float %109 %109 %109 %109 + OpStore %x_GLF_color %110 + OpBranch %91 + %91 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %111 +%tint_symbol = OpFunctionParameter %main_out + %115 = OpLabel + %116 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %116 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %118 = OpLabel + %119 = OpFunctionCall %void %main_1 + %121 = OpLoad %v4float %x_GLF_color + %122 = OpCompositeConstruct %main_out %121 + %120 = OpFunctionCall %void %tint_symbol_2 %122 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..07d81cb7f5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.spvasm.expected.wgsl @@ -0,0 +1,78 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var sums : array; + var i : i32; + var indexable : mat2x4; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + sums = array(x_40, x_42, x_44); + i = 0; + loop { + let x_50 : i32 = i; + let x_52 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_54 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_50 < clamp(x_52, x_54, 2))) { + } else { + break; + } + let x_59 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_61 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_65 : i32 = i; + let x_67 : i32 = x_9.x_GLF_uniform_int_values[1]; + indexable = mat2x4(vec4(x_61, 0.0, 0.0, 0.0), vec4(0.0, x_61, 0.0, 0.0)); + let x_69 : f32 = indexable[x_65][x_67]; + let x_71 : f32 = sums[x_59]; + sums[x_59] = (x_71 + x_69); + + continuing { + let x_74 : i32 = i; + i = (x_74 + 1); + } + } + let x_77 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_79 : f32 = sums[x_77]; + let x_81 : f32 = x_6.x_GLF_uniform_float_values[1]; + if ((x_79 == x_81)) { + let x_87 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_90 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_93 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_96 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_87), f32(x_90), f32(x_93), f32(x_96)); + } else { + let x_100 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_101 : f32 = f32(x_100); + x_GLF_color = vec4(x_101, x_101, x_101, x_101); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl new file mode 100644 index 0000000000..07d81cb7f5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl @@ -0,0 +1,78 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var sums : array; + var i : i32; + var indexable : mat2x4; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + sums = array(x_40, x_42, x_44); + i = 0; + loop { + let x_50 : i32 = i; + let x_52 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_54 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_50 < clamp(x_52, x_54, 2))) { + } else { + break; + } + let x_59 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_61 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_65 : i32 = i; + let x_67 : i32 = x_9.x_GLF_uniform_int_values[1]; + indexable = mat2x4(vec4(x_61, 0.0, 0.0, 0.0), vec4(0.0, x_61, 0.0, 0.0)); + let x_69 : f32 = indexable[x_65][x_67]; + let x_71 : f32 = sums[x_59]; + sums[x_59] = (x_71 + x_69); + + continuing { + let x_74 : i32 = i; + i = (x_74 + 1); + } + } + let x_77 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_79 : f32 = sums[x_77]; + let x_81 : f32 = x_6.x_GLF_uniform_float_values[1]; + if ((x_79 == x_81)) { + let x_87 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_90 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_93 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_96 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_87), f32(x_90), f32(x_93), f32(x_96)); + } else { + let x_100 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_101 : f32 = f32(x_100); + x_GLF_color = vec4(x_101, x_101, x_101, x_101); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d99ee638d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.hlsl @@ -0,0 +1,76 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float sums[3] = (float[3])0; + int i = 0; + float2x4 indexable = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_42 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float tint_symbol_4[3] = {x_40, x_42, x_44}; + sums = tint_symbol_4; + i = 0; + while (true) { + const int x_50 = i; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_9[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_50 < clamp(x_52, x_54, 2))) { + } else { + break; + } + const int x_59 = asint(x_9[2].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_61 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_65 = i; + const int x_67 = asint(x_9[1].x); + indexable = float2x4(float4(x_61, 0.0f, 0.0f, 0.0f), float4(0.0f, x_61, 0.0f, 0.0f)); + const float x_69 = indexable[x_65][x_67]; + const float x_71 = sums[x_59]; + sums[x_59] = (x_71 + x_69); + { + i = (i + 1); + } + } + const int x_77 = asint(x_9[2].x); + const float x_79 = sums[x_77]; + const float x_81 = asfloat(x_6[1].x); + if ((x_79 == x_81)) { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_87 = asint(x_9[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const int x_90 = asint(x_9[1].x); + const int x_93 = asint(x_9[1].x); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_96 = asint(x_9[scalar_offset_7 / 4][scalar_offset_7 % 4]); + x_GLF_color = float4(float(x_87), float(x_90), float(x_93), float(x_96)); + } else { + const int x_100 = asint(x_9[1].x); + const float x_101 = float(x_100); + x_GLF_color = float4(x_101, x_101, x_101, x_101); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d993da94be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.msl @@ -0,0 +1,89 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5) { + tint_array_wrapper_2 sums = {}; + int i = 0; + float2x4 indexable = float2x4(0.0f); + float const x_40 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_40, x_42, x_44}}; + sums = tint_symbol_3; + i = 0; + while (true) { + int const x_50 = i; + int const x_52 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_54 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_50 < clamp(x_52, x_54, 2))) { + } else { + break; + } + int const x_59 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_61 = x_6.x_GLF_uniform_float_values.arr[0].el; + int const x_65 = i; + int const x_67 = x_9.x_GLF_uniform_int_values.arr[1].el; + indexable = float2x4(float4(x_61, 0.0f, 0.0f, 0.0f), float4(0.0f, x_61, 0.0f, 0.0f)); + float const x_69 = indexable[x_65][x_67]; + float const x_71 = sums.arr[x_59]; + sums.arr[x_59] = (x_71 + x_69); + { + int const x_74 = i; + i = (x_74 + 1); + } + } + int const x_77 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_79 = sums.arr[x_77]; + float const x_81 = x_6.x_GLF_uniform_float_values.arr[1].el; + if ((x_79 == x_81)) { + int const x_87 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_90 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_93 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_96 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_87), float(x_90), float(x_93), float(x_96)); + } else { + int const x_100 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_101 = float(x_100); + *(tint_symbol_5) = float4(x_101, x_101, x_101, x_101); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..9bb74649ef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.spvasm @@ -0,0 +1,190 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 123 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %sums "sums" + OpName %i "i" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 + %27 = OpConstantNull %_arr_float_uint_3 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int +%mat2v4float = OpTypeMatrix %v4float 2 +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float + %34 = OpConstantNull %mat2v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %111 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %sums = OpVariable %_ptr_Function__arr_float_uint_3 Function %27 + %i = OpVariable %_ptr_Function_int Function %30 + %indexable = OpVariable %_ptr_Function_mat2v4float Function %34 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %43 = OpLoad %float %42 + %44 = OpCompositeConstruct %_arr_float_uint_3 %39 %41 %43 + OpStore %sums %44 + OpStore %i %int_0 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpExtInst %int %56 SClamp %52 %54 %int_2 + %58 = OpSLessThan %bool %49 %55 + OpSelectionMerge %60 None + OpBranchConditional %58 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %46 + %60 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpLoad %int %i + %69 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %70 = OpLoad %int %69 + %72 = OpCompositeConstruct %v4float %66 %float_0 %float_0 %float_0 + %73 = OpCompositeConstruct %v4float %float_0 %66 %float_0 %float_0 + %74 = OpCompositeConstruct %mat2v4float %72 %73 + OpStore %indexable %74 + %76 = OpAccessChain %_ptr_Function_float %indexable %67 %70 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Function_float %sums %64 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Function_float %sums %64 + %81 = OpFAdd %float %79 %77 + OpStore %80 %81 + OpBranch %47 + %47 = OpLabel + %82 = OpLoad %int %i + %83 = OpIAdd %int %82 %int_1 + OpStore %i %83 + OpBranch %45 + %46 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Function_float %sums %85 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %89 = OpLoad %float %88 + %90 = OpFOrdEqual %bool %87 %89 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %93 + %92 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %95 = OpLoad %int %94 + %96 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %101 = OpLoad %int %100 + %102 = OpConvertSToF %float %95 + %103 = OpConvertSToF %float %97 + %104 = OpConvertSToF %float %99 + %105 = OpConvertSToF %float %101 + %106 = OpCompositeConstruct %v4float %102 %103 %104 %105 + OpStore %x_GLF_color %106 + OpBranch %91 + %93 = OpLabel + %107 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %108 = OpLoad %int %107 + %109 = OpConvertSToF %float %108 + %110 = OpCompositeConstruct %v4float %109 %109 %109 %109 + OpStore %x_GLF_color %110 + OpBranch %91 + %91 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %111 +%tint_symbol = OpFunctionParameter %main_out + %115 = OpLabel + %116 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %116 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %118 = OpLabel + %119 = OpFunctionCall %void %main_1 + %121 = OpLoad %v4float %x_GLF_color + %122 = OpCompositeConstruct %main_out %121 + %120 = OpFunctionCall %void %tint_symbol_2 %122 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..07d81cb7f5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-loop-limit-increment-float-array/0-opt.wgsl.expected.wgsl @@ -0,0 +1,78 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var sums : array; + var i : i32; + var indexable : mat2x4; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + sums = array(x_40, x_42, x_44); + i = 0; + loop { + let x_50 : i32 = i; + let x_52 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_54 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_50 < clamp(x_52, x_54, 2))) { + } else { + break; + } + let x_59 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_61 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_65 : i32 = i; + let x_67 : i32 = x_9.x_GLF_uniform_int_values[1]; + indexable = mat2x4(vec4(x_61, 0.0, 0.0, 0.0), vec4(0.0, x_61, 0.0, 0.0)); + let x_69 : f32 = indexable[x_65][x_67]; + let x_71 : f32 = sums[x_59]; + sums[x_59] = (x_71 + x_69); + + continuing { + let x_74 : i32 = i; + i = (x_74 + 1); + } + } + let x_77 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_79 : f32 = sums[x_77]; + let x_81 : f32 = x_6.x_GLF_uniform_float_values[1]; + if ((x_79 == x_81)) { + let x_87 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_90 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_93 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_96 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_87), f32(x_90), f32(x_93), f32(x_96)); + } else { + let x_100 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_101 : f32 = f32(x_100); + x_GLF_color = vec4(x_101, x_101, x_101, x_101); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm new file mode 100644 index 0000000000..3b37d9a9ff --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm @@ -0,0 +1,97 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %b "b" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %false = OpConstantFalse %bool + %float_0 = OpConstant %float 0 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %13 + %31 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %b = OpVariable %_ptr_Function_float Function + OpStore %a %float_1 + %32 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %33 = OpLoad %float %32 + %34 = OpLoad %float %a + %35 = OpSelect %float %false %34 %float_0 + %36 = OpExtInst %float %1 FClamp %33 %35 %float_1 + OpStore %b %36 + %37 = OpLoad %float %b + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %39 = OpLoad %float %38 + %40 = OpFOrdEqual %bool %37 %39 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %43 + %42 = OpLabel + %44 = OpLoad %float %b + %45 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %46 = OpLoad %float %45 + %47 = OpFMul %float %44 %46 + %48 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %49 + %51 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpCompositeConstruct %v4float %47 %50 %53 %56 + OpStore %_GLF_color %57 + OpBranch %41 + %43 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpCompositeConstruct %v4float %60 %60 %60 %60 + OpStore %_GLF_color %61 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9f5ecd9d88 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.hlsl @@ -0,0 +1,48 @@ +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; + +void main_1() { + float a = 0.0f; + float b = 0.0f; + a = 1.0f; + const float x_33 = asfloat(x_7[1].x); + b = clamp(x_33, (false ? a : 0.0f), 1.0f); + const float x_37 = b; + const float x_39 = asfloat(x_7[1].x); + if ((x_37 == x_39)) { + const float x_44 = b; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_46 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_55 = asint(x_9[1].x); + x_GLF_color = float4((x_44 * x_46), float(x_49), float(x_52), float(x_55)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_60 = float(x_59); + x_GLF_color = float4(x_60, x_60, x_60, x_60); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..526c96a2e0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.msl @@ -0,0 +1,62 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_9, thread float4* const tint_symbol_4) { + float a = 0.0f; + float b = 0.0f; + a = 1.0f; + float const x_33 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_34 = a; + b = clamp(x_33, select(0.0f, x_34, false), 1.0f); + float const x_37 = b; + float const x_39 = x_7.x_GLF_uniform_float_values.arr[1].el; + if ((x_37 == x_39)) { + float const x_44 = b; + float const x_46 = x_7.x_GLF_uniform_float_values.arr[0].el; + int const x_49 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_52 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_55 = x_9.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4((x_44 * x_46), float(x_49), float(x_52), float(x_55)); + } else { + int const x_59 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_60 = float(x_59); + *(tint_symbol_4) = float4(x_60, x_60, x_60, x_60); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..81d2e0958b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.spvasm @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %false = OpConstantFalse %bool + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %a = OpVariable %_ptr_Function_float Function %25 + %b = OpVariable %_ptr_Function_float Function %25 + OpStore %a %float_1 + %31 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %32 = OpLoad %float %31 + %33 = OpLoad %float %a + %36 = OpSelect %float %false %33 %float_0 + %34 = OpExtInst %float %35 NClamp %32 %36 %float_1 + OpStore %b %34 + %40 = OpLoad %float %b + %41 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %42 = OpLoad %float %41 + %43 = OpFOrdEqual %bool %40 %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %46 + %45 = OpLabel + %47 = OpLoad %float %b + %49 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpFMul %float %47 %50 + %59 = OpConvertSToF %float %53 + %60 = OpConvertSToF %float %55 + %61 = OpConvertSToF %float %57 + %62 = OpCompositeConstruct %v4float %58 %59 %60 %61 + OpStore %x_GLF_color %62 + OpBranch %44 + %46 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %65 %65 %65 %65 + OpStore %x_GLF_color %66 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..883179db7f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.spvasm.expected.wgsl @@ -0,0 +1,54 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var a : f32; + var b : f32; + a = 1.0; + let x_33 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_34 : f32 = a; + b = clamp(x_33, select(0.0, x_34, false), 1.0); + let x_37 : f32 = b; + let x_39 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_37 == x_39)) { + let x_44 : f32 = b; + let x_46 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_49 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_55 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4((x_44 * x_46), f32(x_49), f32(x_52), f32(x_55)); + } else { + let x_59 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_60 : f32 = f32(x_59); + x_GLF_color = vec4(x_60, x_60, x_60, x_60); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl new file mode 100644 index 0000000000..883179db7f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl @@ -0,0 +1,54 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var a : f32; + var b : f32; + a = 1.0; + let x_33 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_34 : f32 = a; + b = clamp(x_33, select(0.0, x_34, false), 1.0); + let x_37 : f32 = b; + let x_39 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_37 == x_39)) { + let x_44 : f32 = b; + let x_46 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_49 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_55 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4((x_44 * x_46), f32(x_49), f32(x_52), f32(x_55)); + } else { + let x_59 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_60 : f32 = f32(x_59); + x_GLF_color = vec4(x_60, x_60, x_60, x_60); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9f5ecd9d88 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.hlsl @@ -0,0 +1,48 @@ +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; + +void main_1() { + float a = 0.0f; + float b = 0.0f; + a = 1.0f; + const float x_33 = asfloat(x_7[1].x); + b = clamp(x_33, (false ? a : 0.0f), 1.0f); + const float x_37 = b; + const float x_39 = asfloat(x_7[1].x); + if ((x_37 == x_39)) { + const float x_44 = b; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_46 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_55 = asint(x_9[1].x); + x_GLF_color = float4((x_44 * x_46), float(x_49), float(x_52), float(x_55)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_60 = float(x_59); + x_GLF_color = float4(x_60, x_60, x_60, x_60); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..526c96a2e0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.msl @@ -0,0 +1,62 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_9, thread float4* const tint_symbol_4) { + float a = 0.0f; + float b = 0.0f; + a = 1.0f; + float const x_33 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_34 = a; + b = clamp(x_33, select(0.0f, x_34, false), 1.0f); + float const x_37 = b; + float const x_39 = x_7.x_GLF_uniform_float_values.arr[1].el; + if ((x_37 == x_39)) { + float const x_44 = b; + float const x_46 = x_7.x_GLF_uniform_float_values.arr[0].el; + int const x_49 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_52 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_55 = x_9.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4((x_44 * x_46), float(x_49), float(x_52), float(x_55)); + } else { + int const x_59 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_60 = float(x_59); + *(tint_symbol_4) = float4(x_60, x_60, x_60, x_60); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..81d2e0958b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.spvasm @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %false = OpConstantFalse %bool + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %a = OpVariable %_ptr_Function_float Function %25 + %b = OpVariable %_ptr_Function_float Function %25 + OpStore %a %float_1 + %31 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %32 = OpLoad %float %31 + %33 = OpLoad %float %a + %36 = OpSelect %float %false %33 %float_0 + %34 = OpExtInst %float %35 NClamp %32 %36 %float_1 + OpStore %b %34 + %40 = OpLoad %float %b + %41 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %42 = OpLoad %float %41 + %43 = OpFOrdEqual %bool %40 %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %46 + %45 = OpLabel + %47 = OpLoad %float %b + %49 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpFMul %float %47 %50 + %59 = OpConvertSToF %float %53 + %60 = OpConvertSToF %float %55 + %61 = OpConvertSToF %float %57 + %62 = OpCompositeConstruct %v4float %58 %59 %60 %61 + OpStore %x_GLF_color %62 + OpBranch %44 + %46 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %65 %65 %65 %65 + OpStore %x_GLF_color %66 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..883179db7f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-lower-limit-from-always-false/0-opt.wgsl.expected.wgsl @@ -0,0 +1,54 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var a : f32; + var b : f32; + a = 1.0; + let x_33 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_34 : f32 = a; + b = clamp(x_33, select(0.0, x_34, false), 1.0); + let x_37 : f32 = b; + let x_39 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_37 == x_39)) { + let x_44 : f32 = b; + let x_46 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_49 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_55 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4((x_44 * x_46), f32(x_49), f32(x_52), f32(x_55)); + } else { + let x_59 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_60 : f32 = f32(x_59); + x_GLF_color = vec4(x_60, x_60, x_60, x_60); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm new file mode 100644 index 0000000000..4885ce2b2e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm @@ -0,0 +1,184 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %v "v" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf1 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %int_4 = OpConstant %int 4 + %bool = OpTypeBool +%mat4v4float = OpTypeMatrix %v4float 4 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %v4bool = OpTypeVector %bool 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %13 + %38 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + %i = OpVariable %_ptr_Function_int Function + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %40 = OpLoad %int %39 + %41 = OpConvertSToF %float %40 + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %43 + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %49 + %51 = OpCompositeConstruct %v4float %41 %44 %47 %50 + OpStore %v %51 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %53 = OpLoad %int %52 + OpStore %i %53 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %int %i + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpSLessThan %bool %58 %60 + OpBranchConditional %61 %62 %55 + %62 = OpLabel + %63 = OpLoad %v4float %v + %64 = OpLoad %v4float %v + %65 = OpLoad %v4float %v + %66 = OpLoad %v4float %v + %67 = OpCompositeExtract %float %63 0 + %68 = OpCompositeExtract %float %63 1 + %69 = OpCompositeExtract %float %63 2 + %70 = OpCompositeExtract %float %63 3 + %71 = OpCompositeExtract %float %64 0 + %72 = OpCompositeExtract %float %64 1 + %73 = OpCompositeExtract %float %64 2 + %74 = OpCompositeExtract %float %64 3 + %75 = OpCompositeExtract %float %65 0 + %76 = OpCompositeExtract %float %65 1 + %77 = OpCompositeExtract %float %65 2 + %78 = OpCompositeExtract %float %65 3 + %79 = OpCompositeExtract %float %66 0 + %80 = OpCompositeExtract %float %66 1 + %81 = OpCompositeExtract %float %66 2 + %82 = OpCompositeExtract %float %66 3 + %83 = OpCompositeConstruct %v4float %67 %68 %69 %70 + %84 = OpCompositeConstruct %v4float %71 %72 %73 %74 + %85 = OpCompositeConstruct %v4float %75 %76 %77 %78 + %86 = OpCompositeConstruct %v4float %79 %80 %81 %82 + %87 = OpCompositeConstruct %mat4v4float %83 %84 %85 %86 + %88 = OpLoad %int %i + %89 = OpCompositeExtract %v4float %87 0 + %90 = OpVectorExtractDynamic %float %89 %88 + %91 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %92 = OpLoad %float %91 + %93 = OpFOrdGreaterThan %bool %90 %92 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %94 + %95 = OpLabel + %96 = OpLoad %int %i + %97 = OpLoad %v4float %v + %98 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %99 = OpLoad %float %98 + %100 = OpCompositeConstruct %v4float %99 %99 %99 %99 + %101 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %102 = OpLoad %float %101 + %103 = OpCompositeConstruct %v4float %102 %102 %102 %102 + %104 = OpExtInst %v4float %1 FClamp %97 %100 %103 + %105 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %106 = OpLoad %int %105 + %107 = OpVectorExtractDynamic %float %104 %106 + %108 = OpAccessChain %_ptr_Function_float %v %96 + OpStore %108 %107 + OpBranch %94 + %94 = OpLabel + OpBranch %56 + %56 = OpLabel + %109 = OpLoad %int %i + %110 = OpIAdd %int %109 %int_1 + OpStore %i %110 + OpBranch %54 + %55 = OpLabel + %111 = OpLoad %v4float %v + %112 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %113 = OpLoad %int %112 + %114 = OpConvertSToF %float %113 + %115 = OpCompositeConstruct %v4float %114 %114 %114 %114 + %116 = OpFOrdEqual %v4bool %111 %115 + %117 = OpAll %bool %116 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %120 + %119 = OpLabel + %121 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %122 = OpLoad %int %121 + %123 = OpConvertSToF %float %122 + %124 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %125 = OpLoad %int %124 + %126 = OpConvertSToF %float %125 + %127 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %128 = OpLoad %int %127 + %129 = OpConvertSToF %float %128 + %130 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %131 = OpLoad %int %130 + %132 = OpConvertSToF %float %131 + %133 = OpCompositeConstruct %v4float %123 %126 %129 %132 + OpStore %_GLF_color %133 + OpBranch %118 + %120 = OpLabel + %134 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %135 = OpLoad %int %134 + %136 = OpConvertSToF %float %135 + %137 = OpCompositeConstruct %v4float %136 %136 %136 %136 + OpStore %_GLF_color %137 + OpBranch %118 + %118 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2f20f12748 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.hlsl @@ -0,0 +1,81 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[5]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + const int x_40 = asint(x_6[1].x); + const int x_43 = asint(x_6[2].x); + const int x_46 = asint(x_6[3].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_49 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + v = float4(float(x_40), float(x_43), float(x_46), float(x_49)); + const int x_53 = asint(x_6[4].x); + i = x_53; + while (true) { + const int x_58 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_60 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_58 < x_60)) { + } else { + break; + } + const float4 x_63 = v; + const float4 x_64 = v; + const float4 x_65 = v; + const float4 x_66 = v; + const int x_88 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_92 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((float4x4(float4(x_63.x, x_63.y, x_63.z, x_63.w), float4(x_64.x, x_64.y, x_64.z, x_64.w), float4(x_65.x, x_65.y, x_65.z, x_65.w), float4(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) { + const int x_96 = i; + const float4 x_97 = v; + const float x_99 = asfloat(x_9[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_102 = asfloat(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_106 = asint(x_6[1].x); + set_float4(v, x_96, clamp(x_97, float4(x_99, x_99, x_99, x_99), float4(x_102, x_102, x_102, x_102))[x_106]); + } + { + i = (i + 1); + } + } + const float4 x_111 = v; + const int x_113 = asint(x_6[1].x); + const float x_114 = float(x_113); + if (all((x_111 == float4(x_114, x_114, x_114, x_114)))) { + const int x_122 = asint(x_6[1].x); + const int x_125 = asint(x_6[4].x); + const int x_128 = asint(x_6[4].x); + const int x_131 = asint(x_6[1].x); + x_GLF_color = float4(float(x_122), float(x_125), float(x_128), float(x_131)); + } else { + const int x_135 = asint(x_6[4].x); + const float x_136 = float(x_135); + x_GLF_color = float4(x_136, x_136, x_136, x_136); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..3c693a41cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + int i = 0; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_49 = x_6.x_GLF_uniform_int_values.arr[0].el; + v = float4(float(x_40), float(x_43), float(x_46), float(x_49)); + int const x_53 = x_6.x_GLF_uniform_int_values.arr[4].el; + i = x_53; + while (true) { + int const x_58 = i; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_58 < x_60)) { + } else { + break; + } + float4 const x_63 = v; + float4 const x_64 = v; + float4 const x_65 = v; + float4 const x_66 = v; + int const x_88 = i; + float const x_92 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((float4x4(float4(x_63.x, x_63.y, x_63.z, x_63.w), float4(x_64.x, x_64.y, x_64.z, x_64.w), float4(x_65.x, x_65.y, x_65.z, x_65.w), float4(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) { + int const x_96 = i; + float4 const x_97 = v; + float const x_99 = x_9.x_GLF_uniform_float_values.arr[1].el; + float const x_102 = x_9.x_GLF_uniform_float_values.arr[0].el; + int const x_106 = x_6.x_GLF_uniform_int_values.arr[1].el; + v[x_96] = clamp(x_97, float4(x_99, x_99, x_99, x_99), float4(x_102, x_102, x_102, x_102))[x_106]; + } + { + int const x_109 = i; + i = (x_109 + 1); + } + } + float4 const x_111 = v; + int const x_113 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_114 = float(x_113); + if (all((x_111 == float4(x_114, x_114, x_114, x_114)))) { + int const x_122 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_125 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_128 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_131 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_122), float(x_125), float(x_128), float(x_131)); + } else { + int const x_135 = x_6.x_GLF_uniform_int_values.arr[4].el; + float const x_136 = float(x_135); + *(tint_symbol_4) = float4(x_136, x_136, x_136, x_136); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..fa87ce8027 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.spvasm @@ -0,0 +1,222 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %109 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf1 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool +%_ptr_Uniform_float = OpTypePointer Uniform %float +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_float = OpTypePointer Function %float + %v4bool = OpTypeVector %bool 4 + %main_out = OpTypeStruct %v4float + %143 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %17 + %i = OpVariable %_ptr_Function_int Function %28 + %32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %33 = OpLoad %int %32 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %36 = OpLoad %int %35 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %39 = OpLoad %int %38 + %41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %42 = OpLoad %int %41 + %43 = OpConvertSToF %float %33 + %44 = OpConvertSToF %float %36 + %45 = OpConvertSToF %float %39 + %46 = OpConvertSToF %float %42 + %47 = OpCompositeConstruct %v4float %43 %44 %45 %46 + OpStore %v %47 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %50 = OpLoad %int %49 + OpStore %i %50 + OpBranch %51 + %51 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %int %i + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpSLessThan %bool %55 %57 + OpSelectionMerge %60 None + OpBranchConditional %58 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %52 + %60 = OpLabel + %63 = OpLoad %v4float %v + %64 = OpLoad %v4float %v + %65 = OpLoad %v4float %v + %66 = OpLoad %v4float %v + %67 = OpLoad %int %i + %69 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %70 = OpLoad %float %69 + %72 = OpCompositeExtract %float %63 0 + %73 = OpCompositeExtract %float %63 1 + %74 = OpCompositeExtract %float %63 2 + %75 = OpCompositeExtract %float %63 3 + %76 = OpCompositeConstruct %v4float %72 %73 %74 %75 + %77 = OpCompositeExtract %float %64 0 + %78 = OpCompositeExtract %float %64 1 + %79 = OpCompositeExtract %float %64 2 + %80 = OpCompositeExtract %float %64 3 + %81 = OpCompositeConstruct %v4float %77 %78 %79 %80 + %82 = OpCompositeExtract %float %65 0 + %83 = OpCompositeExtract %float %65 1 + %84 = OpCompositeExtract %float %65 2 + %85 = OpCompositeExtract %float %65 3 + %86 = OpCompositeConstruct %v4float %82 %83 %84 %85 + %87 = OpCompositeExtract %float %66 0 + %88 = OpCompositeExtract %float %66 1 + %89 = OpCompositeExtract %float %66 2 + %90 = OpCompositeExtract %float %66 3 + %91 = OpCompositeConstruct %v4float %87 %88 %89 %90 + %92 = OpCompositeConstruct %mat4v4float %76 %81 %86 %91 + %93 = OpCompositeExtract %v4float %92 0 + %94 = OpVectorExtractDynamic %float %93 %67 + %95 = OpFOrdGreaterThan %bool %94 %70 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %96 + %97 = OpLabel + %98 = OpLoad %int %i + %99 = OpLoad %v4float %v + %100 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %101 = OpLoad %float %100 + %102 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %105 = OpLoad %int %104 + %107 = OpAccessChain %_ptr_Function_float %v %98 + %110 = OpCompositeConstruct %v4float %101 %101 %101 %101 + %111 = OpCompositeConstruct %v4float %103 %103 %103 %103 + %108 = OpExtInst %v4float %109 NClamp %99 %110 %111 + %112 = OpVectorExtractDynamic %float %108 %105 + OpStore %107 %112 + OpBranch %96 + %96 = OpLabel + OpBranch %53 + %53 = OpLabel + %113 = OpLoad %int %i + %114 = OpIAdd %int %113 %int_1 + OpStore %i %114 + OpBranch %51 + %52 = OpLabel + %115 = OpLoad %v4float %v + %116 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %117 = OpLoad %int %116 + %118 = OpConvertSToF %float %117 + %120 = OpCompositeConstruct %v4float %118 %118 %118 %118 + %121 = OpFOrdEqual %v4bool %115 %120 + %119 = OpAll %bool %121 + OpSelectionMerge %123 None + OpBranchConditional %119 %124 %125 + %124 = OpLabel + %126 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %127 = OpLoad %int %126 + %128 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %129 = OpLoad %int %128 + %130 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %131 = OpLoad %int %130 + %132 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %133 = OpLoad %int %132 + %134 = OpConvertSToF %float %127 + %135 = OpConvertSToF %float %129 + %136 = OpConvertSToF %float %131 + %137 = OpConvertSToF %float %133 + %138 = OpCompositeConstruct %v4float %134 %135 %136 %137 + OpStore %x_GLF_color %138 + OpBranch %123 + %125 = OpLabel + %139 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %140 = OpLoad %int %139 + %141 = OpConvertSToF %float %140 + %142 = OpCompositeConstruct %v4float %141 %141 %141 %141 + OpStore %x_GLF_color %142 + OpBranch %123 + %123 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %143 +%tint_symbol = OpFunctionParameter %main_out + %147 = OpLabel + %148 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %148 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %150 = OpLabel + %151 = OpFunctionCall %void %main_1 + %153 = OpLoad %v4float %x_GLF_color + %154 = OpCompositeConstruct %main_out %153 + %152 = OpFunctionCall %void %tint_symbol_2 %154 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..667c5e6c2a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.spvasm.expected.wgsl @@ -0,0 +1,84 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var i : i32; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[0]; + v = vec4(f32(x_40), f32(x_43), f32(x_46), f32(x_49)); + let x_53 : i32 = x_6.x_GLF_uniform_int_values[4]; + i = x_53; + loop { + let x_58 : i32 = i; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_58 < x_60)) { + } else { + break; + } + let x_63 : vec4 = v; + let x_64 : vec4 = v; + let x_65 : vec4 = v; + let x_66 : vec4 = v; + let x_88 : i32 = i; + let x_92 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((mat4x4(vec4(x_63.x, x_63.y, x_63.z, x_63.w), vec4(x_64.x, x_64.y, x_64.z, x_64.w), vec4(x_65.x, x_65.y, x_65.z, x_65.w), vec4(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) { + let x_96 : i32 = i; + let x_97 : vec4 = v; + let x_99 : f32 = x_9.x_GLF_uniform_float_values[1]; + let x_102 : f32 = x_9.x_GLF_uniform_float_values[0]; + let x_106 : i32 = x_6.x_GLF_uniform_int_values[1]; + v[x_96] = clamp(x_97, vec4(x_99, x_99, x_99, x_99), vec4(x_102, x_102, x_102, x_102))[x_106]; + } + + continuing { + let x_109 : i32 = i; + i = (x_109 + 1); + } + } + let x_111 : vec4 = v; + let x_113 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_114 : f32 = f32(x_113); + if (all((x_111 == vec4(x_114, x_114, x_114, x_114)))) { + let x_122 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_125 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_128 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_131 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_122), f32(x_125), f32(x_128), f32(x_131)); + } else { + let x_135 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_136 : f32 = f32(x_135); + x_GLF_color = vec4(x_136, x_136, x_136, x_136); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl new file mode 100644 index 0000000000..667c5e6c2a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl @@ -0,0 +1,84 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var i : i32; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[0]; + v = vec4(f32(x_40), f32(x_43), f32(x_46), f32(x_49)); + let x_53 : i32 = x_6.x_GLF_uniform_int_values[4]; + i = x_53; + loop { + let x_58 : i32 = i; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_58 < x_60)) { + } else { + break; + } + let x_63 : vec4 = v; + let x_64 : vec4 = v; + let x_65 : vec4 = v; + let x_66 : vec4 = v; + let x_88 : i32 = i; + let x_92 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((mat4x4(vec4(x_63.x, x_63.y, x_63.z, x_63.w), vec4(x_64.x, x_64.y, x_64.z, x_64.w), vec4(x_65.x, x_65.y, x_65.z, x_65.w), vec4(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) { + let x_96 : i32 = i; + let x_97 : vec4 = v; + let x_99 : f32 = x_9.x_GLF_uniform_float_values[1]; + let x_102 : f32 = x_9.x_GLF_uniform_float_values[0]; + let x_106 : i32 = x_6.x_GLF_uniform_int_values[1]; + v[x_96] = clamp(x_97, vec4(x_99, x_99, x_99, x_99), vec4(x_102, x_102, x_102, x_102))[x_106]; + } + + continuing { + let x_109 : i32 = i; + i = (x_109 + 1); + } + } + let x_111 : vec4 = v; + let x_113 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_114 : f32 = f32(x_113); + if (all((x_111 == vec4(x_114, x_114, x_114, x_114)))) { + let x_122 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_125 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_128 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_131 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_122), f32(x_125), f32(x_128), f32(x_131)); + } else { + let x_135 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_136 : f32 = f32(x_135); + x_GLF_color = vec4(x_136, x_136, x_136, x_136); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2f20f12748 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.hlsl @@ -0,0 +1,81 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[5]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + const int x_40 = asint(x_6[1].x); + const int x_43 = asint(x_6[2].x); + const int x_46 = asint(x_6[3].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_49 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + v = float4(float(x_40), float(x_43), float(x_46), float(x_49)); + const int x_53 = asint(x_6[4].x); + i = x_53; + while (true) { + const int x_58 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_60 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_58 < x_60)) { + } else { + break; + } + const float4 x_63 = v; + const float4 x_64 = v; + const float4 x_65 = v; + const float4 x_66 = v; + const int x_88 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_92 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((float4x4(float4(x_63.x, x_63.y, x_63.z, x_63.w), float4(x_64.x, x_64.y, x_64.z, x_64.w), float4(x_65.x, x_65.y, x_65.z, x_65.w), float4(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) { + const int x_96 = i; + const float4 x_97 = v; + const float x_99 = asfloat(x_9[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_102 = asfloat(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_106 = asint(x_6[1].x); + set_float4(v, x_96, clamp(x_97, float4(x_99, x_99, x_99, x_99), float4(x_102, x_102, x_102, x_102))[x_106]); + } + { + i = (i + 1); + } + } + const float4 x_111 = v; + const int x_113 = asint(x_6[1].x); + const float x_114 = float(x_113); + if (all((x_111 == float4(x_114, x_114, x_114, x_114)))) { + const int x_122 = asint(x_6[1].x); + const int x_125 = asint(x_6[4].x); + const int x_128 = asint(x_6[4].x); + const int x_131 = asint(x_6[1].x); + x_GLF_color = float4(float(x_122), float(x_125), float(x_128), float(x_131)); + } else { + const int x_135 = asint(x_6[4].x); + const float x_136 = float(x_135); + x_GLF_color = float4(x_136, x_136, x_136, x_136); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..3c693a41cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + int i = 0; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_49 = x_6.x_GLF_uniform_int_values.arr[0].el; + v = float4(float(x_40), float(x_43), float(x_46), float(x_49)); + int const x_53 = x_6.x_GLF_uniform_int_values.arr[4].el; + i = x_53; + while (true) { + int const x_58 = i; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_58 < x_60)) { + } else { + break; + } + float4 const x_63 = v; + float4 const x_64 = v; + float4 const x_65 = v; + float4 const x_66 = v; + int const x_88 = i; + float const x_92 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((float4x4(float4(x_63.x, x_63.y, x_63.z, x_63.w), float4(x_64.x, x_64.y, x_64.z, x_64.w), float4(x_65.x, x_65.y, x_65.z, x_65.w), float4(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) { + int const x_96 = i; + float4 const x_97 = v; + float const x_99 = x_9.x_GLF_uniform_float_values.arr[1].el; + float const x_102 = x_9.x_GLF_uniform_float_values.arr[0].el; + int const x_106 = x_6.x_GLF_uniform_int_values.arr[1].el; + v[x_96] = clamp(x_97, float4(x_99, x_99, x_99, x_99), float4(x_102, x_102, x_102, x_102))[x_106]; + } + { + int const x_109 = i; + i = (x_109 + 1); + } + } + float4 const x_111 = v; + int const x_113 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_114 = float(x_113); + if (all((x_111 == float4(x_114, x_114, x_114, x_114)))) { + int const x_122 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_125 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_128 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_131 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_122), float(x_125), float(x_128), float(x_131)); + } else { + int const x_135 = x_6.x_GLF_uniform_int_values.arr[4].el; + float const x_136 = float(x_135); + *(tint_symbol_4) = float4(x_136, x_136, x_136, x_136); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..fa87ce8027 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.spvasm @@ -0,0 +1,222 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 155 +; Schema: 0 + OpCapability Shader + %109 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf1 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool +%_ptr_Uniform_float = OpTypePointer Uniform %float +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_float = OpTypePointer Function %float + %v4bool = OpTypeVector %bool 4 + %main_out = OpTypeStruct %v4float + %143 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %17 + %i = OpVariable %_ptr_Function_int Function %28 + %32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %33 = OpLoad %int %32 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %36 = OpLoad %int %35 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %39 = OpLoad %int %38 + %41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %42 = OpLoad %int %41 + %43 = OpConvertSToF %float %33 + %44 = OpConvertSToF %float %36 + %45 = OpConvertSToF %float %39 + %46 = OpConvertSToF %float %42 + %47 = OpCompositeConstruct %v4float %43 %44 %45 %46 + OpStore %v %47 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %50 = OpLoad %int %49 + OpStore %i %50 + OpBranch %51 + %51 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %int %i + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpSLessThan %bool %55 %57 + OpSelectionMerge %60 None + OpBranchConditional %58 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %52 + %60 = OpLabel + %63 = OpLoad %v4float %v + %64 = OpLoad %v4float %v + %65 = OpLoad %v4float %v + %66 = OpLoad %v4float %v + %67 = OpLoad %int %i + %69 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %70 = OpLoad %float %69 + %72 = OpCompositeExtract %float %63 0 + %73 = OpCompositeExtract %float %63 1 + %74 = OpCompositeExtract %float %63 2 + %75 = OpCompositeExtract %float %63 3 + %76 = OpCompositeConstruct %v4float %72 %73 %74 %75 + %77 = OpCompositeExtract %float %64 0 + %78 = OpCompositeExtract %float %64 1 + %79 = OpCompositeExtract %float %64 2 + %80 = OpCompositeExtract %float %64 3 + %81 = OpCompositeConstruct %v4float %77 %78 %79 %80 + %82 = OpCompositeExtract %float %65 0 + %83 = OpCompositeExtract %float %65 1 + %84 = OpCompositeExtract %float %65 2 + %85 = OpCompositeExtract %float %65 3 + %86 = OpCompositeConstruct %v4float %82 %83 %84 %85 + %87 = OpCompositeExtract %float %66 0 + %88 = OpCompositeExtract %float %66 1 + %89 = OpCompositeExtract %float %66 2 + %90 = OpCompositeExtract %float %66 3 + %91 = OpCompositeConstruct %v4float %87 %88 %89 %90 + %92 = OpCompositeConstruct %mat4v4float %76 %81 %86 %91 + %93 = OpCompositeExtract %v4float %92 0 + %94 = OpVectorExtractDynamic %float %93 %67 + %95 = OpFOrdGreaterThan %bool %94 %70 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %96 + %97 = OpLabel + %98 = OpLoad %int %i + %99 = OpLoad %v4float %v + %100 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %101 = OpLoad %float %100 + %102 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %105 = OpLoad %int %104 + %107 = OpAccessChain %_ptr_Function_float %v %98 + %110 = OpCompositeConstruct %v4float %101 %101 %101 %101 + %111 = OpCompositeConstruct %v4float %103 %103 %103 %103 + %108 = OpExtInst %v4float %109 NClamp %99 %110 %111 + %112 = OpVectorExtractDynamic %float %108 %105 + OpStore %107 %112 + OpBranch %96 + %96 = OpLabel + OpBranch %53 + %53 = OpLabel + %113 = OpLoad %int %i + %114 = OpIAdd %int %113 %int_1 + OpStore %i %114 + OpBranch %51 + %52 = OpLabel + %115 = OpLoad %v4float %v + %116 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %117 = OpLoad %int %116 + %118 = OpConvertSToF %float %117 + %120 = OpCompositeConstruct %v4float %118 %118 %118 %118 + %121 = OpFOrdEqual %v4bool %115 %120 + %119 = OpAll %bool %121 + OpSelectionMerge %123 None + OpBranchConditional %119 %124 %125 + %124 = OpLabel + %126 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %127 = OpLoad %int %126 + %128 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %129 = OpLoad %int %128 + %130 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %131 = OpLoad %int %130 + %132 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %133 = OpLoad %int %132 + %134 = OpConvertSToF %float %127 + %135 = OpConvertSToF %float %129 + %136 = OpConvertSToF %float %131 + %137 = OpConvertSToF %float %133 + %138 = OpCompositeConstruct %v4float %134 %135 %136 %137 + OpStore %x_GLF_color %138 + OpBranch %123 + %125 = OpLabel + %139 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %140 = OpLoad %int %139 + %141 = OpConvertSToF %float %140 + %142 = OpCompositeConstruct %v4float %141 %141 %141 %141 + OpStore %x_GLF_color %142 + OpBranch %123 + %123 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %143 +%tint_symbol = OpFunctionParameter %main_out + %147 = OpLabel + %148 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %148 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %150 = OpLabel + %151 = OpFunctionCall %void %main_1 + %153 = OpLoad %v4float %x_GLF_color + %154 = OpCompositeConstruct %main_out %153 + %152 = OpFunctionCall %void %tint_symbol_2 %154 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..667c5e6c2a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-component-condition-using-matrix/0-opt.wgsl.expected.wgsl @@ -0,0 +1,84 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var i : i32; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[0]; + v = vec4(f32(x_40), f32(x_43), f32(x_46), f32(x_49)); + let x_53 : i32 = x_6.x_GLF_uniform_int_values[4]; + i = x_53; + loop { + let x_58 : i32 = i; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_58 < x_60)) { + } else { + break; + } + let x_63 : vec4 = v; + let x_64 : vec4 = v; + let x_65 : vec4 = v; + let x_66 : vec4 = v; + let x_88 : i32 = i; + let x_92 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((mat4x4(vec4(x_63.x, x_63.y, x_63.z, x_63.w), vec4(x_64.x, x_64.y, x_64.z, x_64.w), vec4(x_65.x, x_65.y, x_65.z, x_65.w), vec4(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) { + let x_96 : i32 = i; + let x_97 : vec4 = v; + let x_99 : f32 = x_9.x_GLF_uniform_float_values[1]; + let x_102 : f32 = x_9.x_GLF_uniform_float_values[0]; + let x_106 : i32 = x_6.x_GLF_uniform_int_values[1]; + v[x_96] = clamp(x_97, vec4(x_99, x_99, x_99, x_99), vec4(x_102, x_102, x_102, x_102))[x_106]; + } + + continuing { + let x_109 : i32 = i; + i = (x_109 + 1); + } + } + let x_111 : vec4 = v; + let x_113 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_114 : f32 = f32(x_113); + if (all((x_111 == vec4(x_114, x_114, x_114, x_114)))) { + let x_122 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_125 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_128 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_131 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_122), f32(x_125), f32(x_128), f32(x_131)); + } else { + let x_135 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_136 : f32 = f32(x_135); + x_GLF_color = vec4(x_136, x_136, x_136, x_136); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm new file mode 100644 index 0000000000..b12b364c1c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm @@ -0,0 +1,106 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %v0 "v0" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %v1 "v1" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_n580_015015 = OpConstant %float -580.015015 + %float_100 = OpConstant %float 100 + %26 = OpConstantComposite %v2float %float_100 %float_100 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %13 + %34 = OpLabel + %v0 = OpVariable %_ptr_Function_v2float Function + %v1 = OpVariable %_ptr_Function_v2float Function + %35 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %36 = OpLoad %float %35 + %37 = OpCompositeConstruct %v2float %36 %float_n580_015015 + OpStore %v0 %37 + %38 = OpLoad %v2float %v0 + %39 = OpExtInst %v2float %1 Ceil %38 + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpFNegate %float %41 + %43 = OpCompositeConstruct %v2float %42 %42 + %44 = OpExtInst %v2float %1 FClamp %39 %43 %26 + OpStore %v1 %44 + %45 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %46 = OpLoad %float %45 + %47 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %48 = OpLoad %float %47 + %49 = OpFNegate %float %48 + %50 = OpFOrdEqual %bool %46 %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %61 + %63 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %56 %59 %62 %65 + OpStore %_GLF_color %66 + OpBranch %51 + %53 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %68 + %70 = OpCompositeConstruct %v4float %69 %69 %69 %69 + OpStore %_GLF_color %70 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..50ae4f32a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.hlsl @@ -0,0 +1,50 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; + +void main_1() { + float2 v0 = float2(0.0f, 0.0f); + float2 v1 = float2(0.0f, 0.0f); + const float x_36 = asfloat(x_6[1].x); + v0 = float2(x_36, -580.015014648f); + const float2 x_38 = v0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_42 = -(x_41); + v1 = clamp(ceil(x_38), float2(x_42, x_42), float2(100.0f, 100.0f)); + const float x_46 = v1.y; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_48 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_46 == -(x_48))) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_58 = asint(x_9[1].x); + const int x_61 = asint(x_9[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_64 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + const int x_68 = asint(x_9[1].x); + const float x_69 = float(x_68); + x_GLF_color = float4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..79fe600b8f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + float2 v0 = 0.0f; + float2 v1 = 0.0f; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[1].el; + v0 = float2(x_36, -580.015014648f); + float2 const x_38 = v0; + float const x_41 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_42 = -(x_41); + v1 = clamp(ceil(x_38), float2(x_42, x_42), float2(100.0f, 100.0f)); + float const x_46 = v1.y; + float const x_48 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_46 == -(x_48))) { + int const x_55 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_58 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + int const x_68 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_69 = float(x_68); + *(tint_symbol_4) = float4(x_69, x_69, x_69, x_69); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..5cf6c3e4e5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.spvasm @@ -0,0 +1,141 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 88 +; Schema: 0 + OpCapability Shader + %41 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v0 "v0" + OpName %v1 "v1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpConstantNull %v2float + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_n580_015015 = OpConstant %float -580.015015 + %int_0 = OpConstant %int 0 + %float_100 = OpConstant %float 100 + %45 = OpConstantComposite %v2float %float_100 %float_100 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %76 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %v0 = OpVariable %_ptr_Function_v2float Function %26 + %v1 = OpVariable %_ptr_Function_v2float Function %26 + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %32 = OpLoad %float %31 + %34 = OpCompositeConstruct %v2float %32 %float_n580_015015 + OpStore %v0 %34 + %35 = OpLoad %v2float %v0 + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpFNegate %float %38 + %42 = OpExtInst %v2float %41 Ceil %35 + %43 = OpCompositeConstruct %v2float %39 %39 + %40 = OpExtInst %v2float %41 NClamp %42 %43 %45 + OpStore %v1 %40 + %48 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %49 = OpLoad %float %48 + %50 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %51 = OpLoad %float %50 + %52 = OpFNegate %float %51 + %53 = OpFOrdEqual %bool %49 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %56 %57 + %56 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %60 + %68 = OpConvertSToF %float %62 + %69 = OpConvertSToF %float %64 + %70 = OpConvertSToF %float %66 + %71 = OpCompositeConstruct %v4float %67 %68 %69 %70 + OpStore %x_GLF_color %71 + OpBranch %55 + %57 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpConvertSToF %float %73 + %75 = OpCompositeConstruct %v4float %74 %74 %74 %74 + OpStore %x_GLF_color %75 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %76 +%tint_symbol = OpFunctionParameter %main_out + %80 = OpLabel + %81 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %81 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %83 = OpLabel + %84 = OpFunctionCall %void %main_1 + %86 = OpLoad %v4float %x_GLF_color + %87 = OpCompositeConstruct %main_out %86 + %85 = OpFunctionCall %void %tint_symbol_2 %87 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..bc87bc80ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.spvasm.expected.wgsl @@ -0,0 +1,55 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var v0 : vec2; + var v1 : vec2; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[1]; + v0 = vec2(x_36, -580.015014648); + let x_38 : vec2 = v0; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = -(x_41); + v1 = clamp(ceil(x_38), vec2(x_42, x_42), vec2(100.0, 100.0)); + let x_46 : f32 = v1.y; + let x_48 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_46 == -(x_48))) { + let x_55 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + } else { + let x_68 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_69 : f32 = f32(x_68); + x_GLF_color = vec4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl new file mode 100644 index 0000000000..bc87bc80ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl @@ -0,0 +1,55 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var v0 : vec2; + var v1 : vec2; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[1]; + v0 = vec2(x_36, -580.015014648); + let x_38 : vec2 = v0; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = -(x_41); + v1 = clamp(ceil(x_38), vec2(x_42, x_42), vec2(100.0, 100.0)); + let x_46 : f32 = v1.y; + let x_48 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_46 == -(x_48))) { + let x_55 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + } else { + let x_68 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_69 : f32 = f32(x_68); + x_GLF_color = vec4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..50ae4f32a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.hlsl @@ -0,0 +1,50 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; + +void main_1() { + float2 v0 = float2(0.0f, 0.0f); + float2 v1 = float2(0.0f, 0.0f); + const float x_36 = asfloat(x_6[1].x); + v0 = float2(x_36, -580.015014648f); + const float2 x_38 = v0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_42 = -(x_41); + v1 = clamp(ceil(x_38), float2(x_42, x_42), float2(100.0f, 100.0f)); + const float x_46 = v1.y; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_48 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_46 == -(x_48))) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_58 = asint(x_9[1].x); + const int x_61 = asint(x_9[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_64 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + const int x_68 = asint(x_9[1].x); + const float x_69 = float(x_68); + x_GLF_color = float4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..79fe600b8f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + float2 v0 = 0.0f; + float2 v1 = 0.0f; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[1].el; + v0 = float2(x_36, -580.015014648f); + float2 const x_38 = v0; + float const x_41 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_42 = -(x_41); + v1 = clamp(ceil(x_38), float2(x_42, x_42), float2(100.0f, 100.0f)); + float const x_46 = v1.y; + float const x_48 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_46 == -(x_48))) { + int const x_55 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_58 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + int const x_68 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_69 = float(x_68); + *(tint_symbol_4) = float4(x_69, x_69, x_69, x_69); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5cf6c3e4e5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.spvasm @@ -0,0 +1,141 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 88 +; Schema: 0 + OpCapability Shader + %41 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v0 "v0" + OpName %v1 "v1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpConstantNull %v2float + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_n580_015015 = OpConstant %float -580.015015 + %int_0 = OpConstant %int 0 + %float_100 = OpConstant %float 100 + %45 = OpConstantComposite %v2float %float_100 %float_100 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %76 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %v0 = OpVariable %_ptr_Function_v2float Function %26 + %v1 = OpVariable %_ptr_Function_v2float Function %26 + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %32 = OpLoad %float %31 + %34 = OpCompositeConstruct %v2float %32 %float_n580_015015 + OpStore %v0 %34 + %35 = OpLoad %v2float %v0 + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpFNegate %float %38 + %42 = OpExtInst %v2float %41 Ceil %35 + %43 = OpCompositeConstruct %v2float %39 %39 + %40 = OpExtInst %v2float %41 NClamp %42 %43 %45 + OpStore %v1 %40 + %48 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %49 = OpLoad %float %48 + %50 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %51 = OpLoad %float %50 + %52 = OpFNegate %float %51 + %53 = OpFOrdEqual %bool %49 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %56 %57 + %56 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %60 + %68 = OpConvertSToF %float %62 + %69 = OpConvertSToF %float %64 + %70 = OpConvertSToF %float %66 + %71 = OpCompositeConstruct %v4float %67 %68 %69 %70 + OpStore %x_GLF_color %71 + OpBranch %55 + %57 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpConvertSToF %float %73 + %75 = OpCompositeConstruct %v4float %74 %74 %74 %74 + OpStore %x_GLF_color %75 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %76 +%tint_symbol = OpFunctionParameter %main_out + %80 = OpLabel + %81 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %81 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %83 = OpLabel + %84 = OpFunctionCall %void %main_1 + %86 = OpLoad %v4float %x_GLF_color + %87 = OpCompositeConstruct %main_out %86 + %85 = OpFunctionCall %void %tint_symbol_2 %87 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc87bc80ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-element-ceil-negative/0-opt.wgsl.expected.wgsl @@ -0,0 +1,55 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var v0 : vec2; + var v1 : vec2; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[1]; + v0 = vec2(x_36, -580.015014648); + let x_38 : vec2 = v0; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = -(x_41); + v1 = clamp(ceil(x_38), vec2(x_42, x_42), vec2(100.0, 100.0)); + let x_46 : f32 = v1.y; + let x_48 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_46 == -(x_48))) { + let x_55 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + } else { + let x_68 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_69 : f32 = f32(x_68); + x_GLF_color = vec4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm new file mode 100644 index 0000000000..2f7516b04a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm @@ -0,0 +1,110 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %v0 "v0" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %v1 "v1" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_3_79999995 = OpConstant %float 3.79999995 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %13 + %35 = OpLabel + %v0 = OpVariable %_ptr_Function_v2float Function + %v1 = OpVariable %_ptr_Function_v2float Function + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %37 = OpLoad %float %36 + %38 = OpCompositeConstruct %v2float %37 %float_3_79999995 + OpStore %v0 %38 + %39 = OpLoad %v2float %v0 + %40 = OpCompositeConstruct %v2float %float_1 %float_1 + %41 = OpFSub %v2float %39 %40 + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %43 = OpLoad %float %42 + %44 = OpCompositeConstruct %v2float %float_0 %float_0 + %45 = OpCompositeConstruct %v2float %43 %43 + %46 = OpExtInst %v2float %1 FClamp %41 %44 %45 + OpStore %v1 %46 + %47 = OpLoad %v2float %v1 + %48 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %49 = OpLoad %float %48 + %50 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %51 = OpLoad %float %50 + %52 = OpCompositeConstruct %v2float %49 %51 + %53 = OpFOrdEqual %v2bool %47 %52 + %54 = OpAll %bool %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %68 + %70 = OpCompositeConstruct %v4float %60 %63 %66 %69 + OpStore %_GLF_color %70 + OpBranch %55 + %57 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %72 + %74 = OpCompositeConstruct %v4float %73 %73 %73 %73 + OpStore %_GLF_color %74 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..8f6279c8ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.hlsl @@ -0,0 +1,49 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; + +void main_1() { + float2 v0 = float2(0.0f, 0.0f); + float2 v1 = float2(0.0f, 0.0f); + const float x_37 = asfloat(x_6[2].x); + v0 = float2(x_37, 3.799999952f); + const float2 x_39 = v0; + const float x_43 = asfloat(x_6[1].x); + v1 = clamp((x_39 - float2(1.0f, 1.0f)), float2(0.0f, 0.0f), float2(x_43, x_43)); + const float2 x_47 = v1; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_49 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_51 = asfloat(x_6[1].x); + if (all((x_47 == float2(x_49, x_51)))) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_62 = asint(x_9[1].x); + const int x_65 = asint(x_9[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_68 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_59), float(x_62), float(x_65), float(x_68)); + } else { + const int x_72 = asint(x_9[1].x); + const float x_73 = float(x_72); + x_GLF_color = float4(x_73, x_73, x_73, x_73); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..154e81280e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + float2 v0 = 0.0f; + float2 v1 = 0.0f; + float const x_37 = x_6.x_GLF_uniform_float_values.arr[2].el; + v0 = float2(x_37, 3.799999952f); + float2 const x_39 = v0; + float const x_43 = x_6.x_GLF_uniform_float_values.arr[1].el; + v1 = clamp((x_39 - float2(1.0f, 1.0f)), float2(0.0f, 0.0f), float2(x_43, x_43)); + float2 const x_47 = v1; + float const x_49 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_51 = x_6.x_GLF_uniform_float_values.arr[1].el; + if (all((x_47 == float2(x_49, x_51)))) { + int const x_59 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_62 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_68 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_59), float(x_62), float(x_65), float(x_68)); + } else { + int const x_72 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_73 = float(x_72); + *(tint_symbol_4) = float4(x_73, x_73, x_73, x_73); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..758face89a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.spvasm @@ -0,0 +1,145 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + %41 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v0 "v0" + OpName %v1 "v1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %27 = OpConstantNull %v2float + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_3_79999995 = OpConstant %float 3.79999995 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %43 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %46 = OpConstantComposite %v2float %float_0 %float_0 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %v0 = OpVariable %_ptr_Function_v2float Function %27 + %v1 = OpVariable %_ptr_Function_v2float Function %27 + %32 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %33 = OpLoad %float %32 + %35 = OpCompositeConstruct %v2float %33 %float_3_79999995 + OpStore %v0 %35 + %36 = OpLoad %v2float %v0 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %39 = OpLoad %float %38 + %44 = OpFSub %v2float %36 %43 + %47 = OpCompositeConstruct %v2float %39 %39 + %40 = OpExtInst %v2float %41 NClamp %44 %46 %47 + OpStore %v1 %40 + %48 = OpLoad %v2float %v1 + %50 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %51 = OpLoad %float %50 + %52 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %53 = OpLoad %float %52 + %56 = OpCompositeConstruct %v2float %51 %53 + %57 = OpFOrdEqual %v2bool %48 %56 + %54 = OpAll %bool %57 + OpSelectionMerge %59 None + OpBranchConditional %54 %60 %61 + %60 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %64 + %72 = OpConvertSToF %float %66 + %73 = OpConvertSToF %float %68 + %74 = OpConvertSToF %float %70 + %75 = OpCompositeConstruct %v4float %71 %72 %73 %74 + OpStore %x_GLF_color %75 + OpBranch %59 + %61 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpCompositeConstruct %v4float %78 %78 %78 %78 + OpStore %x_GLF_color %79 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %80 +%tint_symbol = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %87 = OpLabel + %88 = OpFunctionCall %void %main_1 + %90 = OpLoad %v4float %x_GLF_color + %91 = OpCompositeConstruct %main_out %90 + %89 = OpFunctionCall %void %tint_symbol_2 %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..fa52af137d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.spvasm.expected.wgsl @@ -0,0 +1,55 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var v0 : vec2; + var v1 : vec2; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[2]; + v0 = vec2(x_37, 3.799999952); + let x_39 : vec2 = v0; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[1]; + v1 = clamp((x_39 - vec2(1.0, 1.0)), vec2(0.0, 0.0), vec2(x_43, x_43)); + let x_47 : vec2 = v1; + let x_49 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_51 : f32 = x_6.x_GLF_uniform_float_values[1]; + if (all((x_47 == vec2(x_49, x_51)))) { + let x_59 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_68 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_59), f32(x_62), f32(x_65), f32(x_68)); + } else { + let x_72 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_73 : f32 = f32(x_72); + x_GLF_color = vec4(x_73, x_73, x_73, x_73); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl new file mode 100644 index 0000000000..fa52af137d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl @@ -0,0 +1,55 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var v0 : vec2; + var v1 : vec2; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[2]; + v0 = vec2(x_37, 3.799999952); + let x_39 : vec2 = v0; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[1]; + v1 = clamp((x_39 - vec2(1.0, 1.0)), vec2(0.0, 0.0), vec2(x_43, x_43)); + let x_47 : vec2 = v1; + let x_49 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_51 : f32 = x_6.x_GLF_uniform_float_values[1]; + if (all((x_47 == vec2(x_49, x_51)))) { + let x_59 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_68 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_59), f32(x_62), f32(x_65), f32(x_68)); + } else { + let x_72 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_73 : f32 = f32(x_72); + x_GLF_color = vec4(x_73, x_73, x_73, x_73); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..8f6279c8ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.hlsl @@ -0,0 +1,49 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; + +void main_1() { + float2 v0 = float2(0.0f, 0.0f); + float2 v1 = float2(0.0f, 0.0f); + const float x_37 = asfloat(x_6[2].x); + v0 = float2(x_37, 3.799999952f); + const float2 x_39 = v0; + const float x_43 = asfloat(x_6[1].x); + v1 = clamp((x_39 - float2(1.0f, 1.0f)), float2(0.0f, 0.0f), float2(x_43, x_43)); + const float2 x_47 = v1; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_49 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_51 = asfloat(x_6[1].x); + if (all((x_47 == float2(x_49, x_51)))) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_62 = asint(x_9[1].x); + const int x_65 = asint(x_9[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_68 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_59), float(x_62), float(x_65), float(x_68)); + } else { + const int x_72 = asint(x_9[1].x); + const float x_73 = float(x_72); + x_GLF_color = float4(x_73, x_73, x_73, x_73); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..154e81280e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + float2 v0 = 0.0f; + float2 v1 = 0.0f; + float const x_37 = x_6.x_GLF_uniform_float_values.arr[2].el; + v0 = float2(x_37, 3.799999952f); + float2 const x_39 = v0; + float const x_43 = x_6.x_GLF_uniform_float_values.arr[1].el; + v1 = clamp((x_39 - float2(1.0f, 1.0f)), float2(0.0f, 0.0f), float2(x_43, x_43)); + float2 const x_47 = v1; + float const x_49 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_51 = x_6.x_GLF_uniform_float_values.arr[1].el; + if (all((x_47 == float2(x_49, x_51)))) { + int const x_59 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_62 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_68 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_59), float(x_62), float(x_65), float(x_68)); + } else { + int const x_72 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_73 = float(x_72); + *(tint_symbol_4) = float4(x_73, x_73, x_73, x_73); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..758face89a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.spvasm @@ -0,0 +1,145 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + %41 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v0 "v0" + OpName %v1 "v1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %27 = OpConstantNull %v2float + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_3_79999995 = OpConstant %float 3.79999995 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %43 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %46 = OpConstantComposite %v2float %float_0 %float_0 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %v0 = OpVariable %_ptr_Function_v2float Function %27 + %v1 = OpVariable %_ptr_Function_v2float Function %27 + %32 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %33 = OpLoad %float %32 + %35 = OpCompositeConstruct %v2float %33 %float_3_79999995 + OpStore %v0 %35 + %36 = OpLoad %v2float %v0 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %39 = OpLoad %float %38 + %44 = OpFSub %v2float %36 %43 + %47 = OpCompositeConstruct %v2float %39 %39 + %40 = OpExtInst %v2float %41 NClamp %44 %46 %47 + OpStore %v1 %40 + %48 = OpLoad %v2float %v1 + %50 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %51 = OpLoad %float %50 + %52 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %53 = OpLoad %float %52 + %56 = OpCompositeConstruct %v2float %51 %53 + %57 = OpFOrdEqual %v2bool %48 %56 + %54 = OpAll %bool %57 + OpSelectionMerge %59 None + OpBranchConditional %54 %60 %61 + %60 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %64 + %72 = OpConvertSToF %float %66 + %73 = OpConvertSToF %float %68 + %74 = OpConvertSToF %float %70 + %75 = OpCompositeConstruct %v4float %71 %72 %73 %74 + OpStore %x_GLF_color %75 + OpBranch %59 + %61 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpCompositeConstruct %v4float %78 %78 %78 %78 + OpStore %x_GLF_color %79 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %80 +%tint_symbol = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %87 = OpLabel + %88 = OpFunctionCall %void %main_1 + %90 = OpLoad %v4float %x_GLF_color + %91 = OpCompositeConstruct %main_out %90 + %89 = OpFunctionCall %void %tint_symbol_2 %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..fa52af137d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clamp-vector-variable-negative-offset/0-opt.wgsl.expected.wgsl @@ -0,0 +1,55 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var v0 : vec2; + var v1 : vec2; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[2]; + v0 = vec2(x_37, 3.799999952); + let x_39 : vec2 = v0; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[1]; + v1 = clamp((x_39 - vec2(1.0, 1.0)), vec2(0.0, 0.0), vec2(x_43, x_43)); + let x_47 : vec2 = v1; + let x_49 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_51 : f32 = x_6.x_GLF_uniform_float_values[1]; + if (all((x_47 == vec2(x_49, x_51)))) { + let x_59 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_68 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_59), f32(x_62), f32(x_65), f32(x_68)); + } else { + let x_72 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_73 : f32 = f32(x_72); + x_GLF_color = vec4(x_73, x_73, x_73, x_73); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm new file mode 100644 index 0000000000..197686fc37 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm @@ -0,0 +1,95 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %v0 "v0" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %v1 "v1" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "zero" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %buf1 = OpTypeStruct %float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %12 + %30 = OpLabel + %v0 = OpVariable %_ptr_Function_v2float Function + %v1 = OpVariable %_ptr_Function_v4float Function + %31 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %32 = OpLoad %float %31 + %33 = OpCompositeConstruct %v2float %32 %32 + OpStore %v0 %33 + %34 = OpAccessChain %_ptr_Function_float %v0 %uint_0 + %35 = OpLoad %float %34 + %36 = OpCompositeConstruct %v4float %35 %35 %35 %35 + OpStore %v1 %36 + %37 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpFUnordNotEqual %bool %38 %40 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %44 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 + %46 = OpLoad %float %45 + %47 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %48 = OpLoad %float %47 + %49 = OpFOrdEqual %bool %46 %48 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpReturn + %50 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %53 = OpLoad %float %52 + %54 = OpVectorShuffle %v2float %36 %36 1 2 + %55 = OpCompositeConstruct %v2float %53 %53 + %56 = OpFSub %v2float %54 %55 + %57 = OpVectorShuffle %v4float %36 %56 0 4 5 3 + OpStore %v1 %57 + OpBranch %42 + %44 = OpLabel + OpKill + %42 = OpLabel + OpStore %_GLF_color %57 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..011b17f930 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.hlsl @@ -0,0 +1,52 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v0 = float2(0.0f, 0.0f); + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_57 = float4(0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_32 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + v0 = float2(x_32, x_32); + const float x_35 = v0.x; + const float4 x_36 = float4(x_35, x_35, x_35, x_35); + v1 = x_36; + const float x_38 = asfloat(x_9[0].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if (!((x_38 == x_40))) { + const float x_46 = asfloat(x_9[0].x); + const float x_48 = asfloat(x_6[1].x); + if ((x_46 == x_48)) { + return; + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_53 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float2 x_56 = (float2(x_36.y, x_36.z) - float2(x_53, x_53)); + x_57 = float4(x_36.x, x_56.x, x_56.y, x_36.w); + v1 = x_57; + } else { + discard; + } + x_GLF_color = x_57; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..ef7e17ecf8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.msl @@ -0,0 +1,59 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct buf1 { + /* 0x0000 */ float zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + float2 v0 = 0.0f; + float4 v1 = 0.0f; + float4 x_57 = 0.0f; + float const x_32 = x_6.x_GLF_uniform_float_values.arr[0].el; + v0 = float2(x_32, x_32); + float const x_35 = v0.x; + float4 const x_36 = float4(x_35, x_35, x_35, x_35); + v1 = x_36; + float const x_38 = x_9.zero; + float const x_40 = x_6.x_GLF_uniform_float_values.arr[0].el; + if (!((x_38 == x_40))) { + float const x_46 = x_9.zero; + float const x_48 = x_6.x_GLF_uniform_float_values.arr[1].el; + if ((x_46 == x_48)) { + return; + } + float const x_53 = x_6.x_GLF_uniform_float_values.arr[0].el; + float2 const x_56 = (float2(x_36.y, x_36.z) - float2(x_53, x_53)); + x_57 = float4(x_36.x, x_56.x, x_56.y, x_36.w); + v1 = x_57; + } else { + discard_fragment(); + } + *(tint_symbol_4) = x_57; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2a2cc7ecb9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 83 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "zero" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v0 "v0" + OpName %v1 "v1" + OpName %x_57 "x_57" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %buf1 = OpTypeStruct %float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %14 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %14 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpConstantNull %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %71 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %17 + %20 = OpLabel + %v0 = OpVariable %_ptr_Function_v2float Function %24 + %v1 = OpVariable %_ptr_Function_v4float Function %14 + %x_57 = OpVariable %_ptr_Function_v4float Function %14 + %32 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %33 = OpLoad %float %32 + %34 = OpCompositeConstruct %v2float %33 %33 + OpStore %v0 %34 + %36 = OpAccessChain %_ptr_Function_float %v0 %uint_0 + %37 = OpLoad %float %36 + %38 = OpCompositeConstruct %v4float %37 %37 %37 %37 + OpStore %v1 %38 + %39 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %42 = OpLoad %float %41 + %44 = OpFOrdEqual %bool %40 %42 + %43 = OpLogicalNot %bool %44 + OpSelectionMerge %46 None + OpBranchConditional %43 %47 %48 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpFOrdEqual %bool %50 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + OpReturn + %55 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpCompositeExtract %float %38 1 + %60 = OpCompositeExtract %float %38 2 + %61 = OpCompositeConstruct %v2float %59 %60 + %62 = OpCompositeConstruct %v2float %58 %58 + %63 = OpFSub %v2float %61 %62 + %64 = OpCompositeExtract %float %38 0 + %65 = OpCompositeExtract %float %63 0 + %66 = OpCompositeExtract %float %63 1 + %67 = OpCompositeExtract %float %38 3 + %68 = OpCompositeConstruct %v4float %64 %65 %66 %67 + OpStore %x_57 %68 + %69 = OpLoad %v4float %x_57 + OpStore %v1 %69 + OpBranch %46 + %48 = OpLabel + OpKill + %46 = OpLabel + %70 = OpLoad %v4float %x_57 + OpStore %x_GLF_color %70 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %71 +%tint_symbol = OpFunctionParameter %main_out + %75 = OpLabel + %76 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %76 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %17 + %78 = OpLabel + %79 = OpFunctionCall %void %main_1 + %81 = OpLoad %v4float %x_GLF_color + %82 = OpCompositeConstruct %main_out %81 + %80 = OpFunctionCall %void %tint_symbol_2 %82 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..edebd913a2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.spvasm.expected.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf1 { + zero : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var v0 : vec2; + var v1 : vec4; + var x_57 : vec4; + let x_32 : f32 = x_6.x_GLF_uniform_float_values[0]; + v0 = vec2(x_32, x_32); + let x_35 : f32 = v0.x; + let x_36 : vec4 = vec4(x_35, x_35, x_35, x_35); + v1 = x_36; + let x_38 : f32 = x_9.zero; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + if (!((x_38 == x_40))) { + let x_46 : f32 = x_9.zero; + let x_48 : f32 = x_6.x_GLF_uniform_float_values[1]; + if ((x_46 == x_48)) { + return; + } + let x_53 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_56 : vec2 = (vec2(x_36.y, x_36.z) - vec2(x_53, x_53)); + x_57 = vec4(x_36.x, x_56.x, x_56.y, x_36.w); + v1 = x_57; + } else { + discard; + } + x_GLF_color = x_57; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl new file mode 100644 index 0000000000..edebd913a2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf1 { + zero : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var v0 : vec2; + var v1 : vec4; + var x_57 : vec4; + let x_32 : f32 = x_6.x_GLF_uniform_float_values[0]; + v0 = vec2(x_32, x_32); + let x_35 : f32 = v0.x; + let x_36 : vec4 = vec4(x_35, x_35, x_35, x_35); + v1 = x_36; + let x_38 : f32 = x_9.zero; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + if (!((x_38 == x_40))) { + let x_46 : f32 = x_9.zero; + let x_48 : f32 = x_6.x_GLF_uniform_float_values[1]; + if ((x_46 == x_48)) { + return; + } + let x_53 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_56 : vec2 = (vec2(x_36.y, x_36.z) - vec2(x_53, x_53)); + x_57 = vec4(x_36.x, x_56.x, x_56.y, x_36.w); + v1 = x_57; + } else { + discard; + } + x_GLF_color = x_57; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..011b17f930 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.hlsl @@ -0,0 +1,52 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v0 = float2(0.0f, 0.0f); + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_57 = float4(0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_32 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + v0 = float2(x_32, x_32); + const float x_35 = v0.x; + const float4 x_36 = float4(x_35, x_35, x_35, x_35); + v1 = x_36; + const float x_38 = asfloat(x_9[0].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if (!((x_38 == x_40))) { + const float x_46 = asfloat(x_9[0].x); + const float x_48 = asfloat(x_6[1].x); + if ((x_46 == x_48)) { + return; + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_53 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float2 x_56 = (float2(x_36.y, x_36.z) - float2(x_53, x_53)); + x_57 = float4(x_36.x, x_56.x, x_56.y, x_36.w); + v1 = x_57; + } else { + discard; + } + x_GLF_color = x_57; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..ef7e17ecf8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.msl @@ -0,0 +1,59 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct buf1 { + /* 0x0000 */ float zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + float2 v0 = 0.0f; + float4 v1 = 0.0f; + float4 x_57 = 0.0f; + float const x_32 = x_6.x_GLF_uniform_float_values.arr[0].el; + v0 = float2(x_32, x_32); + float const x_35 = v0.x; + float4 const x_36 = float4(x_35, x_35, x_35, x_35); + v1 = x_36; + float const x_38 = x_9.zero; + float const x_40 = x_6.x_GLF_uniform_float_values.arr[0].el; + if (!((x_38 == x_40))) { + float const x_46 = x_9.zero; + float const x_48 = x_6.x_GLF_uniform_float_values.arr[1].el; + if ((x_46 == x_48)) { + return; + } + float const x_53 = x_6.x_GLF_uniform_float_values.arr[0].el; + float2 const x_56 = (float2(x_36.y, x_36.z) - float2(x_53, x_53)); + x_57 = float4(x_36.x, x_56.x, x_56.y, x_36.w); + v1 = x_57; + } else { + discard_fragment(); + } + *(tint_symbol_4) = x_57; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2a2cc7ecb9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 83 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "zero" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v0 "v0" + OpName %v1 "v1" + OpName %x_57 "x_57" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %buf1 = OpTypeStruct %float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %14 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %14 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpConstantNull %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %71 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %17 + %20 = OpLabel + %v0 = OpVariable %_ptr_Function_v2float Function %24 + %v1 = OpVariable %_ptr_Function_v4float Function %14 + %x_57 = OpVariable %_ptr_Function_v4float Function %14 + %32 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %33 = OpLoad %float %32 + %34 = OpCompositeConstruct %v2float %33 %33 + OpStore %v0 %34 + %36 = OpAccessChain %_ptr_Function_float %v0 %uint_0 + %37 = OpLoad %float %36 + %38 = OpCompositeConstruct %v4float %37 %37 %37 %37 + OpStore %v1 %38 + %39 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %42 = OpLoad %float %41 + %44 = OpFOrdEqual %bool %40 %42 + %43 = OpLogicalNot %bool %44 + OpSelectionMerge %46 None + OpBranchConditional %43 %47 %48 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpFOrdEqual %bool %50 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + OpReturn + %55 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpCompositeExtract %float %38 1 + %60 = OpCompositeExtract %float %38 2 + %61 = OpCompositeConstruct %v2float %59 %60 + %62 = OpCompositeConstruct %v2float %58 %58 + %63 = OpFSub %v2float %61 %62 + %64 = OpCompositeExtract %float %38 0 + %65 = OpCompositeExtract %float %63 0 + %66 = OpCompositeExtract %float %63 1 + %67 = OpCompositeExtract %float %38 3 + %68 = OpCompositeConstruct %v4float %64 %65 %66 %67 + OpStore %x_57 %68 + %69 = OpLoad %v4float %x_57 + OpStore %v1 %69 + OpBranch %46 + %48 = OpLabel + OpKill + %46 = OpLabel + %70 = OpLoad %v4float %x_57 + OpStore %x_GLF_color %70 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %71 +%tint_symbol = OpFunctionParameter %main_out + %75 = OpLabel + %76 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %76 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %17 + %78 = OpLabel + %79 = OpFunctionCall %void %main_1 + %81 = OpLoad %v4float %x_GLF_color + %82 = OpCompositeConstruct %main_out %81 + %80 = OpFunctionCall %void %tint_symbol_2 %82 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..edebd913a2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-clear-yz-inside-condition/0-opt.wgsl.expected.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf1 { + zero : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var v0 : vec2; + var v1 : vec4; + var x_57 : vec4; + let x_32 : f32 = x_6.x_GLF_uniform_float_values[0]; + v0 = vec2(x_32, x_32); + let x_35 : f32 = v0.x; + let x_36 : vec4 = vec4(x_35, x_35, x_35, x_35); + v1 = x_36; + let x_38 : f32 = x_9.zero; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + if (!((x_38 == x_40))) { + let x_46 : f32 = x_9.zero; + let x_48 : f32 = x_6.x_GLF_uniform_float_values[1]; + if ((x_46 == x_48)) { + return; + } + let x_53 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_56 : vec2 = (vec2(x_36.y, x_36.z) - vec2(x_53, x_53)); + x_57 = vec4(x_36.x, x_56.x, x_56.y, x_36.w); + v1 = x_57; + } else { + discard; + } + x_GLF_color = x_57; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm new file mode 100644 index 0000000000..1fae8caf40 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm @@ -0,0 +1,243 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %func0_ "func0(" + OpName %func1_ "func1(" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %tmp "tmp" + OpName %_GLF_color "_GLF_color" + OpName %a "a" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %buf3 "buf3" + OpMemberName %buf3 0 "three" + OpName %__1 "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_uint_values" + OpName %__2 "" + OpName %a_0 "a" + OpName %i "i" + OpName %j "j" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 2 + OpMemberDecorate %buf3 0 Offset 0 + OpDecorate %buf3 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 3 + OpDecorate %_arr_uint_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__2 DescriptorSet 0 + OpDecorate %__2 Binding 0 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %26 = OpTypeFunction %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_int = OpTypePointer Function %int + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf2 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__0 = OpVariable %_ptr_Uniform_buf2 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %buf3 = OpTypeStruct %int +%_ptr_Uniform_buf3 = OpTypePointer Uniform %buf3 + %__1 = OpVariable %_ptr_Uniform_buf3 Uniform + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %buf0 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__2 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_5 = OpConstant %int 5 + %uint_2 = OpConstant %uint 2 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %24 + %54 = OpLabel + %a_0 = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %55 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %56 = OpLoad %float %55 + %57 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %58 = OpLoad %float %57 + %59 = OpFOrdGreaterThan %bool %56 %58 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %64 = OpLoad %float %63 + %65 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %70 = OpLoad %float %69 + %71 = OpCompositeConstruct %v4float %64 %66 %68 %70 + OpStore %_GLF_color %71 + OpBranch %60 + %62 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_uint %__2 %int_0 %int_0 + %73 = OpLoad %uint %72 + %74 = OpExtInst %v4float %1 UnpackSnorm4x8 %73 + OpStore %_GLF_color %74 + OpBranch %60 + %60 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %76 = OpLoad %int %75 + OpStore %a_0 %76 + OpStore %i %int_0 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %78 %79 None + OpBranch %80 + %80 = OpLabel + %81 = OpLoad %int %i + %82 = OpSLessThan %bool %81 %int_5 + OpBranchConditional %82 %83 %78 + %83 = OpLabel + OpStore %j %int_0 + OpBranch %84 + %84 = OpLabel + OpLoopMerge %85 %86 None + OpBranch %87 + %87 = OpLabel + %88 = OpLoad %int %j + %89 = OpSLessThan %bool %88 %int_2 + OpBranchConditional %89 %90 %85 + %90 = OpLabel + %91 = OpFunctionCall %int %func1_ + %92 = OpLoad %int %a_0 + %93 = OpIAdd %int %92 %91 + OpStore %a_0 %93 + OpBranch %86 + %86 = OpLabel + %94 = OpLoad %int %j + %95 = OpIAdd %int %94 %int_1 + OpStore %j %95 + OpBranch %84 + %85 = OpLabel + OpBranch %79 + %79 = OpLabel + %96 = OpLoad %int %i + %97 = OpIAdd %int %96 %int_1 + OpStore %i %97 + OpBranch %77 + %78 = OpLabel + %98 = OpLoad %int %a_0 + %99 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %100 = OpLoad %int %99 + %101 = OpIEqual %bool %98 %100 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + %104 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %105 = OpLoad %float %104 + %106 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_2 + %107 = OpLoad %float %106 + %108 = OpFSub %float %107 %105 + %109 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_2 + OpStore %109 %108 + OpBranch %102 + %102 = OpLabel + OpReturn + OpFunctionEnd + %func0_ = OpFunction %void None %24 + %110 = OpLabel + %tmp = OpVariable %_ptr_Function_v4float Function + %111 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %112 = OpLoad %float %111 + %113 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %114 = OpLoad %float %113 + %115 = OpFOrdGreaterThan %bool %112 %114 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + %118 = OpLoad %v4float %_GLF_color + OpStore %tmp %118 + OpBranch %116 + %116 = OpLabel + %119 = OpLoad %v4float %tmp + OpStore %_GLF_color %119 + OpReturn + OpFunctionEnd + %func1_ = OpFunction %int None %26 + %120 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %121 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %122 = OpLoad %int %121 + OpStore %a %122 + OpBranch %123 + %123 = OpLabel + OpLoopMerge %124 %125 None + OpBranch %126 + %126 = OpLabel + %127 = OpLoad %int %a + %128 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %129 = OpLoad %int %128 + %130 = OpSLessThan %bool %127 %129 + OpBranchConditional %130 %131 %124 + %131 = OpLabel + %132 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 + %133 = OpLoad %int %132 + %134 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %135 = OpLoad %int %134 + %136 = OpSGreaterThan %bool %133 %135 + OpSelectionMerge %137 None + OpBranchConditional %136 %138 %139 + %138 = OpLabel + %140 = OpFunctionCall %void %func0_ + %141 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %142 = OpLoad %int %141 + OpStore %a %142 + OpBranch %137 + %139 = OpLabel + %143 = OpFunctionCall %void %func0_ + OpBranch %137 + %137 = OpLabel + OpBranch %125 + %125 = OpLabel + OpBranch %123 + %124 = OpLabel + %144 = OpLoad %int %a + OpReturnValue %144 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9ea252ec7e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.hlsl @@ -0,0 +1,119 @@ +float4 tint_unpack4x8snorm(uint param_0) { + int j = int(param_0); + int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; + return clamp(float4(i) / 127.0, -1.0, 1.0); +} + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_12 : register(b2, space0) { + uint4 x_12[4]; +}; +cbuffer cbuffer_x_14 : register(b3, space0) { + uint4 x_14[1]; +}; +cbuffer cbuffer_x_16 : register(b0, space0) { + uint4 x_16[1]; +}; + +void func0_() { + float4 tmp = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_112 = gl_FragCoord.x; + const float x_114 = asfloat(x_8[1].x); + if ((x_112 > x_114)) { + tmp = x_GLF_color; + } + x_GLF_color = tmp; + return; +} + +int func1_() { + int a = 0; + const int x_122 = asint(x_12[1].x); + a = x_122; + while (true) { + const int x_127 = a; + const int x_129 = asint(x_12[3].x); + if ((x_127 < x_129)) { + } else { + break; + } + const int x_133 = asint(x_14[0].x); + const int x_135 = asint(x_12[1].x); + if ((x_133 > x_135)) { + func0_(); + const int x_142 = asint(x_12[3].x); + a = x_142; + } else { + func0_(); + } + } + return a; +} + +void main_1() { + int a_1 = 0; + int i = 0; + int j = 0; + const float x_56 = gl_FragCoord.x; + const float x_58 = asfloat(x_8[1].x); + if ((x_56 > x_58)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_64 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + const float x_66 = asfloat(x_8[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_68 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_70 = asfloat(x_8[2].x); + x_GLF_color = float4(x_64, x_66, x_68, x_70); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const uint x_73 = x_16[scalar_offset_2 / 4][scalar_offset_2 % 4]; + x_GLF_color = tint_unpack4x8snorm(x_73); + } + const int x_76 = asint(x_12[2].x); + a_1 = x_76; + i = 0; + { + for(; (i < 5); i = (i + 1)) { + j = 0; + { + for(; (j < 2); j = (j + 1)) { + const int x_91 = func1_(); + a_1 = (a_1 + x_91); + } + } + } + } + const int x_98 = a_1; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_100 = asint(x_12[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_98 == x_100)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_105 = asfloat(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_107 = x_GLF_color.z; + x_GLF_color.z = (x_107 - x_105); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..1cbfbfa0ac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.msl @@ -0,0 +1,146 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf2 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct buf3 { + /* 0x0000 */ int three; +}; +struct tint_padded_array_element_2 { + /* 0x0000 */ uint el; + /* 0x0004 */ int8_t tint_pad_2[12]; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ tint_padded_array_element_2 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_2 x_GLF_uniform_uint_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func0_(constant buf1& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float4 tmp = 0.0f; + float const x_112 = (*(tint_symbol_5)).x; + float const x_114 = x_8.x_GLF_uniform_float_values.arr[1].el; + if ((x_112 > x_114)) { + float4 const x_118 = *(tint_symbol_6); + tmp = x_118; + } + float4 const x_119 = tmp; + *(tint_symbol_6) = x_119; + return; +} + +int func1_(constant buf2& x_12, constant buf3& x_14, constant buf1& x_8, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + int a = 0; + int const x_122 = x_12.x_GLF_uniform_int_values.arr[1].el; + a = x_122; + while (true) { + int const x_127 = a; + int const x_129 = x_12.x_GLF_uniform_int_values.arr[3].el; + if ((x_127 < x_129)) { + } else { + break; + } + int const x_133 = x_14.three; + int const x_135 = x_12.x_GLF_uniform_int_values.arr[1].el; + if ((x_133 > x_135)) { + func0_(x_8, tint_symbol_7, tint_symbol_8); + int const x_142 = x_12.x_GLF_uniform_int_values.arr[3].el; + a = x_142; + } else { + func0_(x_8, tint_symbol_7, tint_symbol_8); + } + } + int const x_144 = a; + return x_144; +} + +void main_1(constant buf1& x_8, constant buf0& x_16, constant buf2& x_12, constant buf3& x_14, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + int a_1 = 0; + int i = 0; + int j = 0; + float const x_56 = (*(tint_symbol_9)).x; + float const x_58 = x_8.x_GLF_uniform_float_values.arr[1].el; + if ((x_56 > x_58)) { + float const x_64 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_66 = x_8.x_GLF_uniform_float_values.arr[1].el; + float const x_68 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_70 = x_8.x_GLF_uniform_float_values.arr[2].el; + *(tint_symbol_10) = float4(x_64, x_66, x_68, x_70); + } else { + uint const x_73 = x_16.x_GLF_uniform_uint_values.arr[0].el; + *(tint_symbol_10) = unpack_snorm4x8_to_float(x_73); + } + int const x_76 = x_12.x_GLF_uniform_int_values.arr[2].el; + a_1 = x_76; + i = 0; + while (true) { + int const x_81 = i; + if ((x_81 < 5)) { + } else { + break; + } + j = 0; + while (true) { + int const x_88 = j; + if ((x_88 < 2)) { + } else { + break; + } + int const x_91 = func1_(x_12, x_14, x_8, tint_symbol_9, tint_symbol_10); + int const x_92 = a_1; + a_1 = (x_92 + x_91); + { + int const x_94 = j; + j = (x_94 + 1); + } + } + { + int const x_96 = i; + i = (x_96 + 1); + } + } + int const x_98 = a_1; + int const x_100 = x_12.x_GLF_uniform_int_values.arr[0].el; + if ((x_98 == x_100)) { + float const x_105 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_107 = (*(tint_symbol_10)).z; + (*(tint_symbol_10)).z = (x_107 - x_105); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_8 [[buffer(1)]], constant buf0& x_16 [[buffer(0)]], constant buf2& x_12 [[buffer(2)]], constant buf3& x_14 [[buffer(3)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_8, x_16, x_12, x_14, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..aa2284f3d7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.spvasm @@ -0,0 +1,297 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 168 +; Schema: 0 + OpCapability Shader + %113 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "x_GLF_uniform_int_values" + OpName %x_12 "x_12" + OpName %buf3 "buf3" + OpMemberName %buf3 0 "three" + OpName %x_14 "x_14" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_uint_values" + OpName %x_16 "x_16" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func0_ "func0_" + OpName %tmp "tmp" + OpName %func1_ "func1_" + OpName %a "a" + OpName %main_1 "main_1" + OpName %a_1 "a_1" + OpName %i "i" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 2 + OpDecorate %buf3 Block + OpMemberDecorate %buf3 0 Offset 0 + OpDecorate %x_14 NonWritable + OpDecorate %x_14 DescriptorSet 0 + OpDecorate %x_14 Binding 3 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_uint_uint_1 ArrayStride 16 + OpDecorate %x_16 NonWritable + OpDecorate %x_16 DescriptorSet 0 + OpDecorate %x_16 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf2 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_12 = OpVariable %_ptr_Uniform_buf2 Uniform + %buf3 = OpTypeStruct %int +%_ptr_Uniform_buf3 = OpTypePointer Uniform %buf3 + %x_14 = OpVariable %_ptr_Uniform_buf3 Uniform + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %buf0 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_16 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %31 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %51 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %56 = OpConstantNull %int +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_5 = OpConstant %int 5 + %uint_2 = OpConstant %uint 2 + %main_out = OpTypeStruct %v4float + %155 = OpTypeFunction %void %main_out + %func0_ = OpFunction %void None %31 + %34 = OpLabel + %tmp = OpVariable %_ptr_Function_v4float Function %5 + %39 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %40 = OpLoad %float %39 + %43 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %44 = OpLoad %float %43 + %45 = OpFOrdGreaterThan %bool %40 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %48 %47 + %48 = OpLabel + %49 = OpLoad %v4float %x_GLF_color + OpStore %tmp %49 + OpBranch %47 + %47 = OpLabel + %50 = OpLoad %v4float %tmp + OpStore %x_GLF_color %50 + OpReturn + OpFunctionEnd + %func1_ = OpFunction %int None %51 + %53 = OpLabel + %a = OpVariable %_ptr_Function_int Function %56 + %58 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %59 = OpLoad %int %58 + OpStore %a %59 + OpBranch %60 + %60 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + %64 = OpLoad %int %a + %66 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_3 + %67 = OpLoad %int %66 + %68 = OpSLessThan %bool %64 %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + OpBranch %69 + %71 = OpLabel + OpBranch %61 + %69 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %x_14 %uint_0 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpSGreaterThan %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + %80 = OpFunctionCall %void %func0_ + %81 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_3 + %82 = OpLoad %int %81 + OpStore %a %82 + OpBranch %77 + %79 = OpLabel + %83 = OpFunctionCall %void %func0_ + OpBranch %77 + %77 = OpLabel + OpBranch %62 + %62 = OpLabel + OpBranch %60 + %61 = OpLabel + %84 = OpLoad %int %a + OpReturnValue %84 + OpFunctionEnd + %main_1 = OpFunction %void None %31 + %86 = OpLabel + %a_1 = OpVariable %_ptr_Function_int Function %56 + %i = OpVariable %_ptr_Function_int Function %56 + %j = OpVariable %_ptr_Function_int Function %56 + %90 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %93 = OpLoad %float %92 + %94 = OpFOrdGreaterThan %bool %91 %93 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %97 + %96 = OpLabel + %99 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %100 = OpLoad %float %99 + %101 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %102 = OpLoad %float %101 + %103 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %104 = OpLoad %float %103 + %106 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %107 = OpLoad %float %106 + %108 = OpCompositeConstruct %v4float %100 %102 %104 %107 + OpStore %x_GLF_color %108 + OpBranch %95 + %97 = OpLabel + %110 = OpAccessChain %_ptr_Uniform_uint %x_16 %uint_0 %int_0 + %111 = OpLoad %uint %110 + %112 = OpExtInst %v4float %113 UnpackSnorm4x8 %111 + OpStore %x_GLF_color %112 + OpBranch %95 + %95 = OpLabel + %114 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_2 + %115 = OpLoad %int %114 + OpStore %a_1 %115 + OpStore %i %int_0 + OpBranch %116 + %116 = OpLabel + OpLoopMerge %117 %118 None + OpBranch %119 + %119 = OpLabel + %120 = OpLoad %int %i + %122 = OpSLessThan %bool %120 %int_5 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %125 + %124 = OpLabel + OpBranch %123 + %125 = OpLabel + OpBranch %117 + %123 = OpLabel + OpStore %j %int_0 + OpBranch %126 + %126 = OpLabel + OpLoopMerge %127 %128 None + OpBranch %129 + %129 = OpLabel + %130 = OpLoad %int %j + %131 = OpSLessThan %bool %130 %int_2 + OpSelectionMerge %132 None + OpBranchConditional %131 %133 %134 + %133 = OpLabel + OpBranch %132 + %134 = OpLabel + OpBranch %127 + %132 = OpLabel + %135 = OpFunctionCall %int %func1_ + %136 = OpLoad %int %a_1 + %137 = OpIAdd %int %136 %135 + OpStore %a_1 %137 + OpBranch %128 + %128 = OpLabel + %138 = OpLoad %int %j + %139 = OpIAdd %int %138 %int_1 + OpStore %j %139 + OpBranch %126 + %127 = OpLabel + OpBranch %118 + %118 = OpLabel + %140 = OpLoad %int %i + %141 = OpIAdd %int %140 %int_1 + OpStore %i %141 + OpBranch %116 + %117 = OpLabel + %142 = OpLoad %int %a_1 + %143 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %144 = OpLoad %int %143 + %145 = OpIEqual %bool %142 %144 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %148 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %149 = OpLoad %float %148 + %151 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_2 + %152 = OpLoad %float %151 + %153 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_2 + %154 = OpFSub %float %152 %149 + OpStore %153 %154 + OpBranch %146 + %146 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %155 +%tint_symbol_1 = OpFunctionParameter %main_out + %159 = OpLabel + %160 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %160 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %31 + %162 = OpLabel + %163 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %163 + %164 = OpFunctionCall %void %main_1 + %166 = OpLoad %v4float %x_GLF_color + %167 = OpCompositeConstruct %main_out %166 + %165 = OpFunctionCall %void %tint_symbol_3 %167 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..771813e313 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.spvasm.expected.wgsl @@ -0,0 +1,144 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[block]] +struct buf3 { + three : i32; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_uint_values : Arr_2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(2)]] var x_12 : buf2; + +[[group(0), binding(3)]] var x_14 : buf3; + +[[group(0), binding(0)]] var x_16 : buf0; + +fn func0_() { + var tmp : vec4; + let x_112 : f32 = gl_FragCoord.x; + let x_114 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_112 > x_114)) { + let x_118 : vec4 = x_GLF_color; + tmp = x_118; + } + let x_119 : vec4 = tmp; + x_GLF_color = x_119; + return; +} + +fn func1_() -> i32 { + var a : i32; + let x_122 : i32 = x_12.x_GLF_uniform_int_values[1]; + a = x_122; + loop { + let x_127 : i32 = a; + let x_129 : i32 = x_12.x_GLF_uniform_int_values[3]; + if ((x_127 < x_129)) { + } else { + break; + } + let x_133 : i32 = x_14.three; + let x_135 : i32 = x_12.x_GLF_uniform_int_values[1]; + if ((x_133 > x_135)) { + func0_(); + let x_142 : i32 = x_12.x_GLF_uniform_int_values[3]; + a = x_142; + } else { + func0_(); + } + } + let x_144 : i32 = a; + return x_144; +} + +fn main_1() { + var a_1 : i32; + var i : i32; + var j : i32; + let x_56 : f32 = gl_FragCoord.x; + let x_58 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_56 > x_58)) { + let x_64 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_66 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_68 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_70 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_GLF_color = vec4(x_64, x_66, x_68, x_70); + } else { + let x_73 : u32 = x_16.x_GLF_uniform_uint_values[0]; + x_GLF_color = unpack4x8snorm(x_73); + } + let x_76 : i32 = x_12.x_GLF_uniform_int_values[2]; + a_1 = x_76; + i = 0; + loop { + let x_81 : i32 = i; + if ((x_81 < 5)) { + } else { + break; + } + j = 0; + loop { + let x_88 : i32 = j; + if ((x_88 < 2)) { + } else { + break; + } + let x_91 : i32 = func1_(); + let x_92 : i32 = a_1; + a_1 = (x_92 + x_91); + + continuing { + let x_94 : i32 = j; + j = (x_94 + 1); + } + } + + continuing { + let x_96 : i32 = i; + i = (x_96 + 1); + } + } + let x_98 : i32 = a_1; + let x_100 : i32 = x_12.x_GLF_uniform_int_values[0]; + if ((x_98 == x_100)) { + let x_105 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_107 : f32 = x_GLF_color.z; + x_GLF_color.z = (x_107 - x_105); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl new file mode 100644 index 0000000000..771813e313 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl @@ -0,0 +1,144 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[block]] +struct buf3 { + three : i32; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_uint_values : Arr_2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(2)]] var x_12 : buf2; + +[[group(0), binding(3)]] var x_14 : buf3; + +[[group(0), binding(0)]] var x_16 : buf0; + +fn func0_() { + var tmp : vec4; + let x_112 : f32 = gl_FragCoord.x; + let x_114 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_112 > x_114)) { + let x_118 : vec4 = x_GLF_color; + tmp = x_118; + } + let x_119 : vec4 = tmp; + x_GLF_color = x_119; + return; +} + +fn func1_() -> i32 { + var a : i32; + let x_122 : i32 = x_12.x_GLF_uniform_int_values[1]; + a = x_122; + loop { + let x_127 : i32 = a; + let x_129 : i32 = x_12.x_GLF_uniform_int_values[3]; + if ((x_127 < x_129)) { + } else { + break; + } + let x_133 : i32 = x_14.three; + let x_135 : i32 = x_12.x_GLF_uniform_int_values[1]; + if ((x_133 > x_135)) { + func0_(); + let x_142 : i32 = x_12.x_GLF_uniform_int_values[3]; + a = x_142; + } else { + func0_(); + } + } + let x_144 : i32 = a; + return x_144; +} + +fn main_1() { + var a_1 : i32; + var i : i32; + var j : i32; + let x_56 : f32 = gl_FragCoord.x; + let x_58 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_56 > x_58)) { + let x_64 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_66 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_68 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_70 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_GLF_color = vec4(x_64, x_66, x_68, x_70); + } else { + let x_73 : u32 = x_16.x_GLF_uniform_uint_values[0]; + x_GLF_color = unpack4x8snorm(x_73); + } + let x_76 : i32 = x_12.x_GLF_uniform_int_values[2]; + a_1 = x_76; + i = 0; + loop { + let x_81 : i32 = i; + if ((x_81 < 5)) { + } else { + break; + } + j = 0; + loop { + let x_88 : i32 = j; + if ((x_88 < 2)) { + } else { + break; + } + let x_91 : i32 = func1_(); + let x_92 : i32 = a_1; + a_1 = (x_92 + x_91); + + continuing { + let x_94 : i32 = j; + j = (x_94 + 1); + } + } + + continuing { + let x_96 : i32 = i; + i = (x_96 + 1); + } + } + let x_98 : i32 = a_1; + let x_100 : i32 = x_12.x_GLF_uniform_int_values[0]; + if ((x_98 == x_100)) { + let x_105 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_107 : f32 = x_GLF_color.z; + x_GLF_color.z = (x_107 - x_105); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9ea252ec7e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.hlsl @@ -0,0 +1,119 @@ +float4 tint_unpack4x8snorm(uint param_0) { + int j = int(param_0); + int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; + return clamp(float4(i) / 127.0, -1.0, 1.0); +} + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_12 : register(b2, space0) { + uint4 x_12[4]; +}; +cbuffer cbuffer_x_14 : register(b3, space0) { + uint4 x_14[1]; +}; +cbuffer cbuffer_x_16 : register(b0, space0) { + uint4 x_16[1]; +}; + +void func0_() { + float4 tmp = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_112 = gl_FragCoord.x; + const float x_114 = asfloat(x_8[1].x); + if ((x_112 > x_114)) { + tmp = x_GLF_color; + } + x_GLF_color = tmp; + return; +} + +int func1_() { + int a = 0; + const int x_122 = asint(x_12[1].x); + a = x_122; + while (true) { + const int x_127 = a; + const int x_129 = asint(x_12[3].x); + if ((x_127 < x_129)) { + } else { + break; + } + const int x_133 = asint(x_14[0].x); + const int x_135 = asint(x_12[1].x); + if ((x_133 > x_135)) { + func0_(); + const int x_142 = asint(x_12[3].x); + a = x_142; + } else { + func0_(); + } + } + return a; +} + +void main_1() { + int a_1 = 0; + int i = 0; + int j = 0; + const float x_56 = gl_FragCoord.x; + const float x_58 = asfloat(x_8[1].x); + if ((x_56 > x_58)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_64 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + const float x_66 = asfloat(x_8[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_68 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_70 = asfloat(x_8[2].x); + x_GLF_color = float4(x_64, x_66, x_68, x_70); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const uint x_73 = x_16[scalar_offset_2 / 4][scalar_offset_2 % 4]; + x_GLF_color = tint_unpack4x8snorm(x_73); + } + const int x_76 = asint(x_12[2].x); + a_1 = x_76; + i = 0; + { + for(; (i < 5); i = (i + 1)) { + j = 0; + { + for(; (j < 2); j = (j + 1)) { + const int x_91 = func1_(); + a_1 = (a_1 + x_91); + } + } + } + } + const int x_98 = a_1; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_100 = asint(x_12[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_98 == x_100)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_105 = asfloat(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_107 = x_GLF_color.z; + x_GLF_color.z = (x_107 - x_105); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..1cbfbfa0ac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.msl @@ -0,0 +1,146 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf2 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct buf3 { + /* 0x0000 */ int three; +}; +struct tint_padded_array_element_2 { + /* 0x0000 */ uint el; + /* 0x0004 */ int8_t tint_pad_2[12]; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ tint_padded_array_element_2 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_2 x_GLF_uniform_uint_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func0_(constant buf1& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float4 tmp = 0.0f; + float const x_112 = (*(tint_symbol_5)).x; + float const x_114 = x_8.x_GLF_uniform_float_values.arr[1].el; + if ((x_112 > x_114)) { + float4 const x_118 = *(tint_symbol_6); + tmp = x_118; + } + float4 const x_119 = tmp; + *(tint_symbol_6) = x_119; + return; +} + +int func1_(constant buf2& x_12, constant buf3& x_14, constant buf1& x_8, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + int a = 0; + int const x_122 = x_12.x_GLF_uniform_int_values.arr[1].el; + a = x_122; + while (true) { + int const x_127 = a; + int const x_129 = x_12.x_GLF_uniform_int_values.arr[3].el; + if ((x_127 < x_129)) { + } else { + break; + } + int const x_133 = x_14.three; + int const x_135 = x_12.x_GLF_uniform_int_values.arr[1].el; + if ((x_133 > x_135)) { + func0_(x_8, tint_symbol_7, tint_symbol_8); + int const x_142 = x_12.x_GLF_uniform_int_values.arr[3].el; + a = x_142; + } else { + func0_(x_8, tint_symbol_7, tint_symbol_8); + } + } + int const x_144 = a; + return x_144; +} + +void main_1(constant buf1& x_8, constant buf0& x_16, constant buf2& x_12, constant buf3& x_14, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + int a_1 = 0; + int i = 0; + int j = 0; + float const x_56 = (*(tint_symbol_9)).x; + float const x_58 = x_8.x_GLF_uniform_float_values.arr[1].el; + if ((x_56 > x_58)) { + float const x_64 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_66 = x_8.x_GLF_uniform_float_values.arr[1].el; + float const x_68 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_70 = x_8.x_GLF_uniform_float_values.arr[2].el; + *(tint_symbol_10) = float4(x_64, x_66, x_68, x_70); + } else { + uint const x_73 = x_16.x_GLF_uniform_uint_values.arr[0].el; + *(tint_symbol_10) = unpack_snorm4x8_to_float(x_73); + } + int const x_76 = x_12.x_GLF_uniform_int_values.arr[2].el; + a_1 = x_76; + i = 0; + while (true) { + int const x_81 = i; + if ((x_81 < 5)) { + } else { + break; + } + j = 0; + while (true) { + int const x_88 = j; + if ((x_88 < 2)) { + } else { + break; + } + int const x_91 = func1_(x_12, x_14, x_8, tint_symbol_9, tint_symbol_10); + int const x_92 = a_1; + a_1 = (x_92 + x_91); + { + int const x_94 = j; + j = (x_94 + 1); + } + } + { + int const x_96 = i; + i = (x_96 + 1); + } + } + int const x_98 = a_1; + int const x_100 = x_12.x_GLF_uniform_int_values.arr[0].el; + if ((x_98 == x_100)) { + float const x_105 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_107 = (*(tint_symbol_10)).z; + (*(tint_symbol_10)).z = (x_107 - x_105); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_8 [[buffer(1)]], constant buf0& x_16 [[buffer(0)]], constant buf2& x_12 [[buffer(2)]], constant buf3& x_14 [[buffer(3)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_8, x_16, x_12, x_14, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..aa2284f3d7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.spvasm @@ -0,0 +1,297 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 168 +; Schema: 0 + OpCapability Shader + %113 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "x_GLF_uniform_int_values" + OpName %x_12 "x_12" + OpName %buf3 "buf3" + OpMemberName %buf3 0 "three" + OpName %x_14 "x_14" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_uint_values" + OpName %x_16 "x_16" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func0_ "func0_" + OpName %tmp "tmp" + OpName %func1_ "func1_" + OpName %a "a" + OpName %main_1 "main_1" + OpName %a_1 "a_1" + OpName %i "i" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 2 + OpDecorate %buf3 Block + OpMemberDecorate %buf3 0 Offset 0 + OpDecorate %x_14 NonWritable + OpDecorate %x_14 DescriptorSet 0 + OpDecorate %x_14 Binding 3 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_uint_uint_1 ArrayStride 16 + OpDecorate %x_16 NonWritable + OpDecorate %x_16 DescriptorSet 0 + OpDecorate %x_16 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf2 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_12 = OpVariable %_ptr_Uniform_buf2 Uniform + %buf3 = OpTypeStruct %int +%_ptr_Uniform_buf3 = OpTypePointer Uniform %buf3 + %x_14 = OpVariable %_ptr_Uniform_buf3 Uniform + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %buf0 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_16 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %31 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %51 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %56 = OpConstantNull %int +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_5 = OpConstant %int 5 + %uint_2 = OpConstant %uint 2 + %main_out = OpTypeStruct %v4float + %155 = OpTypeFunction %void %main_out + %func0_ = OpFunction %void None %31 + %34 = OpLabel + %tmp = OpVariable %_ptr_Function_v4float Function %5 + %39 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %40 = OpLoad %float %39 + %43 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %44 = OpLoad %float %43 + %45 = OpFOrdGreaterThan %bool %40 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %48 %47 + %48 = OpLabel + %49 = OpLoad %v4float %x_GLF_color + OpStore %tmp %49 + OpBranch %47 + %47 = OpLabel + %50 = OpLoad %v4float %tmp + OpStore %x_GLF_color %50 + OpReturn + OpFunctionEnd + %func1_ = OpFunction %int None %51 + %53 = OpLabel + %a = OpVariable %_ptr_Function_int Function %56 + %58 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %59 = OpLoad %int %58 + OpStore %a %59 + OpBranch %60 + %60 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + %64 = OpLoad %int %a + %66 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_3 + %67 = OpLoad %int %66 + %68 = OpSLessThan %bool %64 %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + OpBranch %69 + %71 = OpLabel + OpBranch %61 + %69 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %x_14 %uint_0 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpSGreaterThan %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + %80 = OpFunctionCall %void %func0_ + %81 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_3 + %82 = OpLoad %int %81 + OpStore %a %82 + OpBranch %77 + %79 = OpLabel + %83 = OpFunctionCall %void %func0_ + OpBranch %77 + %77 = OpLabel + OpBranch %62 + %62 = OpLabel + OpBranch %60 + %61 = OpLabel + %84 = OpLoad %int %a + OpReturnValue %84 + OpFunctionEnd + %main_1 = OpFunction %void None %31 + %86 = OpLabel + %a_1 = OpVariable %_ptr_Function_int Function %56 + %i = OpVariable %_ptr_Function_int Function %56 + %j = OpVariable %_ptr_Function_int Function %56 + %90 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %93 = OpLoad %float %92 + %94 = OpFOrdGreaterThan %bool %91 %93 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %97 + %96 = OpLabel + %99 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %100 = OpLoad %float %99 + %101 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %102 = OpLoad %float %101 + %103 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %104 = OpLoad %float %103 + %106 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %107 = OpLoad %float %106 + %108 = OpCompositeConstruct %v4float %100 %102 %104 %107 + OpStore %x_GLF_color %108 + OpBranch %95 + %97 = OpLabel + %110 = OpAccessChain %_ptr_Uniform_uint %x_16 %uint_0 %int_0 + %111 = OpLoad %uint %110 + %112 = OpExtInst %v4float %113 UnpackSnorm4x8 %111 + OpStore %x_GLF_color %112 + OpBranch %95 + %95 = OpLabel + %114 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_2 + %115 = OpLoad %int %114 + OpStore %a_1 %115 + OpStore %i %int_0 + OpBranch %116 + %116 = OpLabel + OpLoopMerge %117 %118 None + OpBranch %119 + %119 = OpLabel + %120 = OpLoad %int %i + %122 = OpSLessThan %bool %120 %int_5 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %125 + %124 = OpLabel + OpBranch %123 + %125 = OpLabel + OpBranch %117 + %123 = OpLabel + OpStore %j %int_0 + OpBranch %126 + %126 = OpLabel + OpLoopMerge %127 %128 None + OpBranch %129 + %129 = OpLabel + %130 = OpLoad %int %j + %131 = OpSLessThan %bool %130 %int_2 + OpSelectionMerge %132 None + OpBranchConditional %131 %133 %134 + %133 = OpLabel + OpBranch %132 + %134 = OpLabel + OpBranch %127 + %132 = OpLabel + %135 = OpFunctionCall %int %func1_ + %136 = OpLoad %int %a_1 + %137 = OpIAdd %int %136 %135 + OpStore %a_1 %137 + OpBranch %128 + %128 = OpLabel + %138 = OpLoad %int %j + %139 = OpIAdd %int %138 %int_1 + OpStore %j %139 + OpBranch %126 + %127 = OpLabel + OpBranch %118 + %118 = OpLabel + %140 = OpLoad %int %i + %141 = OpIAdd %int %140 %int_1 + OpStore %i %141 + OpBranch %116 + %117 = OpLabel + %142 = OpLoad %int %a_1 + %143 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %144 = OpLoad %int %143 + %145 = OpIEqual %bool %142 %144 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %148 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %149 = OpLoad %float %148 + %151 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_2 + %152 = OpLoad %float %151 + %153 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_2 + %154 = OpFSub %float %152 %149 + OpStore %153 %154 + OpBranch %146 + %146 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %155 +%tint_symbol_1 = OpFunctionParameter %main_out + %159 = OpLabel + %160 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %160 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %31 + %162 = OpLabel + %163 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %163 + %164 = OpFunctionCall %void %main_1 + %166 = OpLoad %v4float %x_GLF_color + %167 = OpCompositeConstruct %main_out %166 + %165 = OpFunctionCall %void %tint_symbol_3 %167 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..771813e313 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-output-undefined-in-unexecuted-branch/0-opt.wgsl.expected.wgsl @@ -0,0 +1,144 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[block]] +struct buf3 { + three : i32; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_uint_values : Arr_2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(2)]] var x_12 : buf2; + +[[group(0), binding(3)]] var x_14 : buf3; + +[[group(0), binding(0)]] var x_16 : buf0; + +fn func0_() { + var tmp : vec4; + let x_112 : f32 = gl_FragCoord.x; + let x_114 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_112 > x_114)) { + let x_118 : vec4 = x_GLF_color; + tmp = x_118; + } + let x_119 : vec4 = tmp; + x_GLF_color = x_119; + return; +} + +fn func1_() -> i32 { + var a : i32; + let x_122 : i32 = x_12.x_GLF_uniform_int_values[1]; + a = x_122; + loop { + let x_127 : i32 = a; + let x_129 : i32 = x_12.x_GLF_uniform_int_values[3]; + if ((x_127 < x_129)) { + } else { + break; + } + let x_133 : i32 = x_14.three; + let x_135 : i32 = x_12.x_GLF_uniform_int_values[1]; + if ((x_133 > x_135)) { + func0_(); + let x_142 : i32 = x_12.x_GLF_uniform_int_values[3]; + a = x_142; + } else { + func0_(); + } + } + let x_144 : i32 = a; + return x_144; +} + +fn main_1() { + var a_1 : i32; + var i : i32; + var j : i32; + let x_56 : f32 = gl_FragCoord.x; + let x_58 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_56 > x_58)) { + let x_64 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_66 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_68 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_70 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_GLF_color = vec4(x_64, x_66, x_68, x_70); + } else { + let x_73 : u32 = x_16.x_GLF_uniform_uint_values[0]; + x_GLF_color = unpack4x8snorm(x_73); + } + let x_76 : i32 = x_12.x_GLF_uniform_int_values[2]; + a_1 = x_76; + i = 0; + loop { + let x_81 : i32 = i; + if ((x_81 < 5)) { + } else { + break; + } + j = 0; + loop { + let x_88 : i32 = j; + if ((x_88 < 2)) { + } else { + break; + } + let x_91 : i32 = func1_(); + let x_92 : i32 = a_1; + a_1 = (x_92 + x_91); + + continuing { + let x_94 : i32 = j; + j = (x_94 + 1); + } + } + + continuing { + let x_96 : i32 = i; + i = (x_96 + 1); + } + } + let x_98 : i32 = a_1; + let x_100 : i32 = x_12.x_GLF_uniform_int_values[0]; + if ((x_98 == x_100)) { + let x_105 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_107 : f32 = x_GLF_color.z; + x_GLF_color.z = (x_107 - x_105); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm new file mode 100644 index 0000000000..75c8e10a2b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm @@ -0,0 +1,93 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 + %buf0 = OpTypeStruct %_arr_float_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %float_10 = OpConstant %float 10 +%mat4v4float = OpTypeMatrix %v4float 4 + %float_0 = OpConstant %float 0 + %main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %33 = OpLoad %float %32 + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %35 = OpLoad %float %34 + %36 = OpFOrdGreaterThan %bool %33 %35 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %40 = OpLoad %float %39 + %41 = OpCompositeConstruct %v4float %40 %40 %40 %40 + OpStore %_GLF_color %41 + %42 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %43 = OpLoad %float %42 + %44 = OpFOrdGreaterThan %bool %43 %35 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_4 + %48 = OpLoad %float %47 + %49 = OpCompositeConstruct %v4float %48 %48 %48 %48 + OpStore %_GLF_color %49 + OpBranch %45 + %45 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %51 = OpLoad %float %50 + %52 = OpCompositeConstruct %v4float %51 %51 %51 %51 + OpStore %_GLF_color %52 + OpBranch %37 + %37 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %54 = OpLoad %float %53 + %55 = OpCompositeConstruct %v4float %35 %54 %54 %float_10 + OpStore %_GLF_color %55 + %56 = OpCompositeConstruct %v4float %35 %float_0 %float_0 %float_0 + %57 = OpCompositeConstruct %v4float %float_0 %35 %float_0 %float_0 + %58 = OpCompositeConstruct %v4float %float_0 %float_0 %35 %float_0 + %59 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %35 + %60 = OpCompositeConstruct %mat4v4float %56 %57 %58 %59 + %61 = OpLoad %v4float %_GLF_color + %62 = OpMatrixTimesVector %v4float %60 %61 + OpStore %_GLF_color %62 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..87a0b35312 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.hlsl @@ -0,0 +1,45 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_33 = gl_FragCoord.x; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_35 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_33 > x_35)) { + const float x_40 = asfloat(x_6[2].x); + x_GLF_color = float4(x_40, x_40, x_40, x_40); + const float x_43 = gl_FragCoord.y; + if ((x_43 > x_35)) { + const float x_48 = asfloat(x_6[4].x); + x_GLF_color = float4(x_48, x_48, x_48, x_48); + } + const float x_51 = asfloat(x_6[3].x); + x_GLF_color = float4(x_51, x_51, x_51, x_51); + } + const float x_54 = asfloat(x_6[1].x); + x_GLF_color = float4(x_35, x_54, x_54, 10.0f); + x_GLF_color = mul(x_GLF_color, float4x4(float4(x_35, 0.0f, 0.0f, 0.0f), float4(0.0f, x_35, 0.0f, 0.0f), float4(0.0f, 0.0f, x_35, 0.0f), float4(0.0f, 0.0f, 0.0f, x_35))); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.msl new file mode 100644 index 0000000000..1102160caf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.msl @@ -0,0 +1,51 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_33 = (*(tint_symbol_5)).x; + float const x_35 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_33 > x_35)) { + float const x_40 = x_6.x_GLF_uniform_float_values.arr[2].el; + *(tint_symbol_6) = float4(x_40, x_40, x_40, x_40); + float const x_43 = (*(tint_symbol_5)).y; + if ((x_43 > x_35)) { + float const x_48 = x_6.x_GLF_uniform_float_values.arr[4].el; + *(tint_symbol_6) = float4(x_48, x_48, x_48, x_48); + } + float const x_51 = x_6.x_GLF_uniform_float_values.arr[3].el; + *(tint_symbol_6) = float4(x_51, x_51, x_51, x_51); + } + float const x_54 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_6) = float4(x_35, x_54, x_54, 10.0f); + float4 const x_61 = *(tint_symbol_6); + *(tint_symbol_6) = (float4x4(float4(x_35, 0.0f, 0.0f, 0.0f), float4(0.0f, x_35, 0.0f, 0.0f), float4(0.0f, 0.0f, x_35, 0.0f), float4(0.0f, 0.0f, 0.0f, x_35)) * x_61); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..71352d20d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 + %buf0 = OpTypeStruct %_arr_float_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %float_10 = OpConstant %float 10 +%mat4v4float = OpTypeMatrix %v4float 4 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %66 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %17 + %20 = OpLabel + %23 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %24 = OpLoad %float %23 + %28 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %29 = OpLoad %float %28 + %30 = OpFOrdGreaterThan %bool %24 %29 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %32 + %33 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %36 = OpLoad %float %35 + %37 = OpCompositeConstruct %v4float %36 %36 %36 %36 + OpStore %x_GLF_color %37 + %39 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %40 = OpLoad %float %39 + %41 = OpFOrdGreaterThan %bool %40 %29 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_4 + %46 = OpLoad %float %45 + %47 = OpCompositeConstruct %v4float %46 %46 %46 %46 + OpStore %x_GLF_color %47 + OpBranch %42 + %42 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %50 = OpLoad %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %x_GLF_color %51 + OpBranch %32 + %32 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %54 = OpLoad %float %53 + %56 = OpCompositeConstruct %v4float %29 %54 %54 %float_10 + OpStore %x_GLF_color %56 + %57 = OpLoad %v4float %x_GLF_color + %60 = OpCompositeConstruct %v4float %29 %float_0 %float_0 %float_0 + %61 = OpCompositeConstruct %v4float %float_0 %29 %float_0 %float_0 + %62 = OpCompositeConstruct %v4float %float_0 %float_0 %29 %float_0 + %63 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %29 + %64 = OpCompositeConstruct %mat4v4float %60 %61 %62 %63 + %65 = OpMatrixTimesVector %v4float %64 %57 + OpStore %x_GLF_color %65 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %66 +%tint_symbol_1 = OpFunctionParameter %main_out + %70 = OpLabel + %71 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %71 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %17 + %73 = OpLabel + %74 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %74 + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_3 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..4b6e9c8899 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.spvasm.expected.wgsl @@ -0,0 +1,45 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_33 : f32 = gl_FragCoord.x; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_33 > x_35)) { + let x_40 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_GLF_color = vec4(x_40, x_40, x_40, x_40); + let x_43 : f32 = gl_FragCoord.y; + if ((x_43 > x_35)) { + let x_48 : f32 = x_6.x_GLF_uniform_float_values[4]; + x_GLF_color = vec4(x_48, x_48, x_48, x_48); + } + let x_51 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_GLF_color = vec4(x_51, x_51, x_51, x_51); + } + let x_54 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_35, x_54, x_54, 10.0); + let x_61 : vec4 = x_GLF_color; + x_GLF_color = (mat4x4(vec4(x_35, 0.0, 0.0, 0.0), vec4(0.0, x_35, 0.0, 0.0), vec4(0.0, 0.0, x_35, 0.0), vec4(0.0, 0.0, 0.0, x_35)) * x_61); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl new file mode 100644 index 0000000000..4b6e9c8899 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl @@ -0,0 +1,45 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_33 : f32 = gl_FragCoord.x; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_33 > x_35)) { + let x_40 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_GLF_color = vec4(x_40, x_40, x_40, x_40); + let x_43 : f32 = gl_FragCoord.y; + if ((x_43 > x_35)) { + let x_48 : f32 = x_6.x_GLF_uniform_float_values[4]; + x_GLF_color = vec4(x_48, x_48, x_48, x_48); + } + let x_51 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_GLF_color = vec4(x_51, x_51, x_51, x_51); + } + let x_54 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_35, x_54, x_54, 10.0); + let x_61 : vec4 = x_GLF_color; + x_GLF_color = (mat4x4(vec4(x_35, 0.0, 0.0, 0.0), vec4(0.0, x_35, 0.0, 0.0), vec4(0.0, 0.0, x_35, 0.0), vec4(0.0, 0.0, 0.0, x_35)) * x_61); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..87a0b35312 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.hlsl @@ -0,0 +1,45 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_33 = gl_FragCoord.x; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_35 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_33 > x_35)) { + const float x_40 = asfloat(x_6[2].x); + x_GLF_color = float4(x_40, x_40, x_40, x_40); + const float x_43 = gl_FragCoord.y; + if ((x_43 > x_35)) { + const float x_48 = asfloat(x_6[4].x); + x_GLF_color = float4(x_48, x_48, x_48, x_48); + } + const float x_51 = asfloat(x_6[3].x); + x_GLF_color = float4(x_51, x_51, x_51, x_51); + } + const float x_54 = asfloat(x_6[1].x); + x_GLF_color = float4(x_35, x_54, x_54, 10.0f); + x_GLF_color = mul(x_GLF_color, float4x4(float4(x_35, 0.0f, 0.0f, 0.0f), float4(0.0f, x_35, 0.0f, 0.0f), float4(0.0f, 0.0f, x_35, 0.0f), float4(0.0f, 0.0f, 0.0f, x_35))); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.msl new file mode 100644 index 0000000000..1102160caf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.msl @@ -0,0 +1,51 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_33 = (*(tint_symbol_5)).x; + float const x_35 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_33 > x_35)) { + float const x_40 = x_6.x_GLF_uniform_float_values.arr[2].el; + *(tint_symbol_6) = float4(x_40, x_40, x_40, x_40); + float const x_43 = (*(tint_symbol_5)).y; + if ((x_43 > x_35)) { + float const x_48 = x_6.x_GLF_uniform_float_values.arr[4].el; + *(tint_symbol_6) = float4(x_48, x_48, x_48, x_48); + } + float const x_51 = x_6.x_GLF_uniform_float_values.arr[3].el; + *(tint_symbol_6) = float4(x_51, x_51, x_51, x_51); + } + float const x_54 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_6) = float4(x_35, x_54, x_54, 10.0f); + float4 const x_61 = *(tint_symbol_6); + *(tint_symbol_6) = (float4x4(float4(x_35, 0.0f, 0.0f, 0.0f), float4(0.0f, x_35, 0.0f, 0.0f), float4(0.0f, 0.0f, x_35, 0.0f), float4(0.0f, 0.0f, 0.0f, x_35)) * x_61); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..71352d20d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 + %buf0 = OpTypeStruct %_arr_float_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %float_10 = OpConstant %float 10 +%mat4v4float = OpTypeMatrix %v4float 4 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %66 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %17 + %20 = OpLabel + %23 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %24 = OpLoad %float %23 + %28 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %29 = OpLoad %float %28 + %30 = OpFOrdGreaterThan %bool %24 %29 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %32 + %33 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %36 = OpLoad %float %35 + %37 = OpCompositeConstruct %v4float %36 %36 %36 %36 + OpStore %x_GLF_color %37 + %39 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %40 = OpLoad %float %39 + %41 = OpFOrdGreaterThan %bool %40 %29 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_4 + %46 = OpLoad %float %45 + %47 = OpCompositeConstruct %v4float %46 %46 %46 %46 + OpStore %x_GLF_color %47 + OpBranch %42 + %42 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %50 = OpLoad %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %x_GLF_color %51 + OpBranch %32 + %32 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %54 = OpLoad %float %53 + %56 = OpCompositeConstruct %v4float %29 %54 %54 %float_10 + OpStore %x_GLF_color %56 + %57 = OpLoad %v4float %x_GLF_color + %60 = OpCompositeConstruct %v4float %29 %float_0 %float_0 %float_0 + %61 = OpCompositeConstruct %v4float %float_0 %29 %float_0 %float_0 + %62 = OpCompositeConstruct %v4float %float_0 %float_0 %29 %float_0 + %63 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %29 + %64 = OpCompositeConstruct %mat4v4float %60 %61 %62 %63 + %65 = OpMatrixTimesVector %v4float %64 %57 + OpStore %x_GLF_color %65 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %66 +%tint_symbol_1 = OpFunctionParameter %main_out + %70 = OpLabel + %71 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %71 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %17 + %73 = OpLabel + %74 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %74 + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_3 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..4b6e9c8899 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-color-overwrite-identity-matrix-multiply/0.wgsl.expected.wgsl @@ -0,0 +1,45 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_33 : f32 = gl_FragCoord.x; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_33 > x_35)) { + let x_40 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_GLF_color = vec4(x_40, x_40, x_40, x_40); + let x_43 : f32 = gl_FragCoord.y; + if ((x_43 > x_35)) { + let x_48 : f32 = x_6.x_GLF_uniform_float_values[4]; + x_GLF_color = vec4(x_48, x_48, x_48, x_48); + } + let x_51 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_GLF_color = vec4(x_51, x_51, x_51, x_51); + } + let x_54 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_35, x_54, x_54, 10.0); + let x_61 : vec4 = x_GLF_color; + x_GLF_color = (mat4x4(vec4(x_35, 0.0, 0.0, 0.0), vec4(0.0, x_35, 0.0, 0.0), vec4(0.0, 0.0, x_35, 0.0), vec4(0.0, 0.0, 0.0, x_35)) * x_61); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm new file mode 100644 index 0000000000..6982d41876 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm @@ -0,0 +1,112 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %b "b" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + %void = OpTypeVoid + %16 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %false = OpConstantFalse %bool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %16 + %36 = OpLabel + %b = OpVariable %_ptr_Function_bool Function + OpStore %b %true + %37 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %40 = OpLoad %float %39 + %41 = OpFOrdGreaterThan %bool %38 %40 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %47 = OpLoad %float %46 + %48 = OpFOrdLessThan %bool %45 %47 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + OpStore %b %false + OpBranch %49 + %49 = OpLabel + OpBranch %42 + %42 = OpLabel + %51 = OpLoad %bool %b + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %10 = OpLoad %int %55 + %56 = OpConvertSToF %float %10 + %57 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %11 = OpLoad %int %57 + %58 = OpConvertSToF %float %11 + %59 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %12 = OpLoad %int %59 + %60 = OpConvertSToF %float %12 + %61 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %13 = OpLoad %int %61 + %62 = OpConvertSToF %float %13 + %63 = OpCompositeConstruct %v4float %56 %58 %60 %62 + OpStore %_GLF_color %63 + OpBranch %52 + %54 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %14 = OpLoad %int %64 + %65 = OpConvertSToF %float %14 + %66 = OpCompositeConstruct %v4float %65 %65 %65 %65 + OpStore %_GLF_color %66 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f628868a23 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.hlsl @@ -0,0 +1,49 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[2]; +}; + +void main_1() { + bool b = false; + b = true; + const float x_38 = asfloat(x_6[0].x); + const float x_40 = asfloat(x_6[0].y); + if ((x_38 > x_40)) { + const float x_45 = asfloat(x_6[0].x); + const float x_47 = asfloat(x_6[0].y); + if ((x_45 < x_47)) { + b = false; + } + } + if (b) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_10 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + const int x_11 = asint(x_8[1].x); + const int x_12 = asint(x_8[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_13 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_10), float(x_11), float(x_12), float(x_13)); + } else { + const int x_14 = asint(x_8[1].x); + const float x_65 = float(x_14); + x_GLF_color = float4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..944acdb205 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 v1; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_4) { + bool b = false; + b = true; + float const x_38 = x_6.v1.x; + float const x_40 = x_6.v1.y; + if ((x_38 > x_40)) { + float const x_45 = x_6.v1.x; + float const x_47 = x_6.v1.y; + if ((x_45 < x_47)) { + b = false; + } + } + bool const x_51 = b; + if (x_51) { + int const x_10 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_11 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_12 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_13 = x_8.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_10), float(x_11), float(x_12), float(x_13)); + } else { + int const x_14 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_65 = float(x_14); + *(tint_symbol_4) = float4(x_65, x_65, x_65, x_65); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f5af17d687 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.spvasm @@ -0,0 +1,139 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 82 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %26 = OpConstantNull %bool + %true = OpConstantTrue %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %false = OpConstantFalse %bool + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %70 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %b = OpVariable %_ptr_Function_bool Function %26 + OpStore %b %true + %30 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %31 = OpLoad %float %30 + %33 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %34 = OpLoad %float %33 + %35 = OpFOrdGreaterThan %bool %31 %34 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %36 + %37 = OpLabel + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %41 = OpLoad %float %40 + %42 = OpFOrdLessThan %bool %39 %41 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpStore %b %false + OpBranch %43 + %43 = OpLabel + OpBranch %36 + %36 = OpLabel + %46 = OpLoad %bool %b + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %53 = OpLoad %int %52 + %55 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %53 + %62 = OpConvertSToF %float %56 + %63 = OpConvertSToF %float %58 + %64 = OpConvertSToF %float %60 + %65 = OpCompositeConstruct %v4float %61 %62 %63 %64 + OpStore %x_GLF_color %65 + OpBranch %47 + %49 = OpLabel + %66 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %67 + %69 = OpCompositeConstruct %v4float %68 %68 %68 %68 + OpStore %x_GLF_color %69 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %70 +%tint_symbol = OpFunctionParameter %main_out + %74 = OpLabel + %75 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %75 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %77 = OpLabel + %78 = OpFunctionCall %void %main_1 + %80 = OpLoad %v4float %x_GLF_color + %81 = OpCompositeConstruct %main_out %80 + %79 = OpFunctionCall %void %tint_symbol_2 %81 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5cf4af4463 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.spvasm.expected.wgsl @@ -0,0 +1,55 @@ +[[block]] +struct buf1 { + v1 : vec2; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var b : bool; + b = true; + let x_38 : f32 = x_6.v1.x; + let x_40 : f32 = x_6.v1.y; + if ((x_38 > x_40)) { + let x_45 : f32 = x_6.v1.x; + let x_47 : f32 = x_6.v1.y; + if ((x_45 < x_47)) { + b = false; + } + } + let x_51 : bool = b; + if (x_51) { + let x_10 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_11 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_12 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_13 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_10), f32(x_11), f32(x_12), f32(x_13)); + } else { + let x_14 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_65 : f32 = f32(x_14); + x_GLF_color = vec4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl new file mode 100644 index 0000000000..5cf4af4463 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl @@ -0,0 +1,55 @@ +[[block]] +struct buf1 { + v1 : vec2; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var b : bool; + b = true; + let x_38 : f32 = x_6.v1.x; + let x_40 : f32 = x_6.v1.y; + if ((x_38 > x_40)) { + let x_45 : f32 = x_6.v1.x; + let x_47 : f32 = x_6.v1.y; + if ((x_45 < x_47)) { + b = false; + } + } + let x_51 : bool = b; + if (x_51) { + let x_10 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_11 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_12 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_13 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_10), f32(x_11), f32(x_12), f32(x_13)); + } else { + let x_14 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_65 : f32 = f32(x_14); + x_GLF_color = vec4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f628868a23 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.hlsl @@ -0,0 +1,49 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[2]; +}; + +void main_1() { + bool b = false; + b = true; + const float x_38 = asfloat(x_6[0].x); + const float x_40 = asfloat(x_6[0].y); + if ((x_38 > x_40)) { + const float x_45 = asfloat(x_6[0].x); + const float x_47 = asfloat(x_6[0].y); + if ((x_45 < x_47)) { + b = false; + } + } + if (b) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_10 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + const int x_11 = asint(x_8[1].x); + const int x_12 = asint(x_8[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_13 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_10), float(x_11), float(x_12), float(x_13)); + } else { + const int x_14 = asint(x_8[1].x); + const float x_65 = float(x_14); + x_GLF_color = float4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..944acdb205 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 v1; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_4) { + bool b = false; + b = true; + float const x_38 = x_6.v1.x; + float const x_40 = x_6.v1.y; + if ((x_38 > x_40)) { + float const x_45 = x_6.v1.x; + float const x_47 = x_6.v1.y; + if ((x_45 < x_47)) { + b = false; + } + } + bool const x_51 = b; + if (x_51) { + int const x_10 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_11 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_12 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_13 = x_8.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_10), float(x_11), float(x_12), float(x_13)); + } else { + int const x_14 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_65 = float(x_14); + *(tint_symbol_4) = float4(x_65, x_65, x_65, x_65); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f5af17d687 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.spvasm @@ -0,0 +1,139 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 82 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %26 = OpConstantNull %bool + %true = OpConstantTrue %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %false = OpConstantFalse %bool + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %70 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %b = OpVariable %_ptr_Function_bool Function %26 + OpStore %b %true + %30 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %31 = OpLoad %float %30 + %33 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %34 = OpLoad %float %33 + %35 = OpFOrdGreaterThan %bool %31 %34 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %36 + %37 = OpLabel + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %41 = OpLoad %float %40 + %42 = OpFOrdLessThan %bool %39 %41 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpStore %b %false + OpBranch %43 + %43 = OpLabel + OpBranch %36 + %36 = OpLabel + %46 = OpLoad %bool %b + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %53 = OpLoad %int %52 + %55 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %53 + %62 = OpConvertSToF %float %56 + %63 = OpConvertSToF %float %58 + %64 = OpConvertSToF %float %60 + %65 = OpCompositeConstruct %v4float %61 %62 %63 %64 + OpStore %x_GLF_color %65 + OpBranch %47 + %49 = OpLabel + %66 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %67 + %69 = OpCompositeConstruct %v4float %68 %68 %68 %68 + OpStore %x_GLF_color %69 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %70 +%tint_symbol = OpFunctionParameter %main_out + %74 = OpLabel + %75 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %75 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %77 = OpLabel + %78 = OpFunctionCall %void %main_1 + %80 = OpLoad %v4float %x_GLF_color + %81 = OpCompositeConstruct %main_out %80 + %79 = OpFunctionCall %void %tint_symbol_2 %81 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5cf4af4463 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-combine-and-or-xor-gt-lt/0-opt.wgsl.expected.wgsl @@ -0,0 +1,55 @@ +[[block]] +struct buf1 { + v1 : vec2; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var b : bool; + b = true; + let x_38 : f32 = x_6.v1.x; + let x_40 : f32 = x_6.v1.y; + if ((x_38 > x_40)) { + let x_45 : f32 = x_6.v1.x; + let x_47 : f32 = x_6.v1.y; + if ((x_45 < x_47)) { + b = false; + } + } + let x_51 : bool = b; + if (x_51) { + let x_10 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_11 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_12 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_13 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_10), f32(x_11), f32(x_12), f32(x_13)); + } else { + let x_14 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_65 : f32 = f32(x_14); + x_GLF_color = vec4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm new file mode 100644 index 0000000000..483ac64f64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm @@ -0,0 +1,109 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %24 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %25 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %26 = OpLoad %int %25 + OpStore %a %26 + %27 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %28 = OpLoad %int %27 + OpStore %i %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %i + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %35 = OpLoad %int %34 + %36 = OpSLessThan %bool %33 %35 + OpBranchConditional %36 %37 %30 + %37 = OpLabel + %38 = OpLoad %int %i + %39 = OpNot %int %38 + %40 = OpINotEqual %bool %39 %int_0 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + %43 = OpLoad %int %a + %44 = OpIAdd %int %43 %int_1 + OpStore %a %44 + OpBranch %41 + %41 = OpLabel + OpBranch %31 + %31 = OpLabel + %45 = OpLoad %int %i + %46 = OpIAdd %int %45 %int_1 + OpStore %i %46 + OpBranch %29 + %30 = OpLabel + %47 = OpLoad %int %a + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %49 = OpLoad %int %48 + %50 = OpIEqual %bool %47 %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %61 + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %56 %59 %62 %65 + OpStore %_GLF_color %66 + OpBranch %51 + %53 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %68 + %70 = OpCompositeConstruct %v4float %69 %69 %69 %69 + OpStore %_GLF_color %70 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..6d029f8be5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.hlsl @@ -0,0 +1,57 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const int x_26 = asint(x_6[1].x); + a = x_26; + const int x_28 = asint(x_6[1].x); + i = x_28; + while (true) { + const int x_33 = i; + const int x_35 = asint(x_6[2].x); + if ((x_33 < x_35)) { + } else { + break; + } + if ((~(i) != 0)) { + a = (a + 1); + } + { + i = (i + 1); + } + } + const int x_47 = a; + const int x_49 = asint(x_6[2].x); + if ((x_47 == x_49)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_58 = asint(x_6[1].x); + const int x_61 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_64 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + const int x_68 = asint(x_6[1].x); + const float x_69 = float(x_68); + x_GLF_color = float4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..374c16d126 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.msl @@ -0,0 +1,68 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int const x_26 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_26; + int const x_28 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_28; + while (true) { + int const x_33 = i; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_33 < x_35)) { + } else { + break; + } + int const x_38 = i; + if ((~(x_38) != 0)) { + int const x_43 = a; + a = (x_43 + 1); + } + { + int const x_45 = i; + i = (x_45 + 1); + } + } + int const x_47 = a; + int const x_49 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_47 == x_49)) { + int const x_55 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + int const x_68 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_69 = float(x_68); + *(tint_symbol_4) = float4(x_69, x_69, x_69, x_69); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2f722c48ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.spvasm @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + OpStore %a %27 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %29 = OpLoad %int %28 + OpStore %i %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %37 = OpLoad %int %36 + %38 = OpSLessThan %bool %34 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %31 + %40 = OpLabel + %43 = OpLoad %int %i + %44 = OpNot %int %43 + %46 = OpINotEqual %bool %44 %int_0 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + %49 = OpLoad %int %a + %50 = OpIAdd %int %49 %int_1 + OpStore %a %50 + OpBranch %47 + %47 = OpLabel + OpBranch %32 + %32 = OpLabel + %51 = OpLoad %int %i + %52 = OpIAdd %int %51 %int_1 + OpStore %i %52 + OpBranch %30 + %31 = OpLabel + %53 = OpLoad %int %a + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %55 = OpLoad %int %54 + %56 = OpIEqual %bool %53 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %61 + %69 = OpConvertSToF %float %63 + %70 = OpConvertSToF %float %65 + %71 = OpConvertSToF %float %67 + %72 = OpCompositeConstruct %v4float %68 %69 %70 %71 + OpStore %x_GLF_color %72 + OpBranch %57 + %59 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %x_GLF_color %76 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %77 +%tint_symbol = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %84 = OpLabel + %85 = OpFunctionCall %void %main_1 + %87 = OpLoad %v4float %x_GLF_color + %88 = OpCompositeConstruct %main_out %87 + %86 = OpFunctionCall %void %tint_symbol_2 %88 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..0900dc7ae3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.spvasm.expected.wgsl @@ -0,0 +1,62 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_26; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_28; + loop { + let x_33 : i32 = i; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_33 < x_35)) { + } else { + break; + } + let x_38 : i32 = i; + if ((~(x_38) != 0)) { + let x_43 : i32 = a; + a = (x_43 + 1); + } + + continuing { + let x_45 : i32 = i; + i = (x_45 + 1); + } + } + let x_47 : i32 = a; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_47 == x_49)) { + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + } else { + let x_68 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_69 : f32 = f32(x_68); + x_GLF_color = vec4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl new file mode 100644 index 0000000000..0900dc7ae3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl @@ -0,0 +1,62 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_26; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_28; + loop { + let x_33 : i32 = i; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_33 < x_35)) { + } else { + break; + } + let x_38 : i32 = i; + if ((~(x_38) != 0)) { + let x_43 : i32 = a; + a = (x_43 + 1); + } + + continuing { + let x_45 : i32 = i; + i = (x_45 + 1); + } + } + let x_47 : i32 = a; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_47 == x_49)) { + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + } else { + let x_68 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_69 : f32 = f32(x_68); + x_GLF_color = vec4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..6d029f8be5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.hlsl @@ -0,0 +1,57 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const int x_26 = asint(x_6[1].x); + a = x_26; + const int x_28 = asint(x_6[1].x); + i = x_28; + while (true) { + const int x_33 = i; + const int x_35 = asint(x_6[2].x); + if ((x_33 < x_35)) { + } else { + break; + } + if ((~(i) != 0)) { + a = (a + 1); + } + { + i = (i + 1); + } + } + const int x_47 = a; + const int x_49 = asint(x_6[2].x); + if ((x_47 == x_49)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_58 = asint(x_6[1].x); + const int x_61 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_64 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + const int x_68 = asint(x_6[1].x); + const float x_69 = float(x_68); + x_GLF_color = float4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..374c16d126 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.msl @@ -0,0 +1,68 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int const x_26 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_26; + int const x_28 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_28; + while (true) { + int const x_33 = i; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_33 < x_35)) { + } else { + break; + } + int const x_38 = i; + if ((~(x_38) != 0)) { + int const x_43 = a; + a = (x_43 + 1); + } + { + int const x_45 = i; + i = (x_45 + 1); + } + } + int const x_47 = a; + int const x_49 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_47 == x_49)) { + int const x_55 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + int const x_68 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_69 = float(x_68); + *(tint_symbol_4) = float4(x_69, x_69, x_69, x_69); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2f722c48ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.spvasm @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + OpStore %a %27 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %29 = OpLoad %int %28 + OpStore %i %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %37 = OpLoad %int %36 + %38 = OpSLessThan %bool %34 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %31 + %40 = OpLabel + %43 = OpLoad %int %i + %44 = OpNot %int %43 + %46 = OpINotEqual %bool %44 %int_0 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + %49 = OpLoad %int %a + %50 = OpIAdd %int %49 %int_1 + OpStore %a %50 + OpBranch %47 + %47 = OpLabel + OpBranch %32 + %32 = OpLabel + %51 = OpLoad %int %i + %52 = OpIAdd %int %51 %int_1 + OpStore %i %52 + OpBranch %30 + %31 = OpLabel + %53 = OpLoad %int %a + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %55 = OpLoad %int %54 + %56 = OpIEqual %bool %53 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %61 + %69 = OpConvertSToF %float %63 + %70 = OpConvertSToF %float %65 + %71 = OpConvertSToF %float %67 + %72 = OpCompositeConstruct %v4float %68 %69 %70 %71 + OpStore %x_GLF_color %72 + OpBranch %57 + %59 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %x_GLF_color %76 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %77 +%tint_symbol = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %84 = OpLabel + %85 = OpFunctionCall %void %main_1 + %87 = OpLoad %v4float %x_GLF_color + %88 = OpCompositeConstruct %main_out %87 + %86 = OpFunctionCall %void %tint_symbol_2 %88 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..0900dc7ae3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-condition-loop-index-bitwise-not/0-opt.wgsl.expected.wgsl @@ -0,0 +1,62 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_26; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_28; + loop { + let x_33 : i32 = i; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_33 < x_35)) { + } else { + break; + } + let x_38 : i32 = i; + if ((~(x_38) != 0)) { + let x_43 : i32 = a; + a = (x_43 + 1); + } + + continuing { + let x_45 : i32 = i; + i = (x_45 + 1); + } + } + let x_47 : i32 = a; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_47 == x_49)) { + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + } else { + let x_68 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_69 : f32 = f32(x_68); + x_GLF_color = vec4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm new file mode 100644 index 0000000000..92b329d8f5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm @@ -0,0 +1,126 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "injectionSwitch" + OpName %__0 "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__1 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 2 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 1 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__0 = OpVariable %_ptr_Uniform_buf2 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__1 = OpVariable %_ptr_Uniform_buf1 Uniform + %main = OpFunction %void None %15 + %36 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %a %int_1 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpConvertSToF %float %38 + %40 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %41 = OpLoad %int %40 + %42 = OpConvertSToF %float %41 + %43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpConvertSToF %float %44 + %46 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpConvertSToF %float %47 + %49 = OpCompositeConstruct %v4float %39 %42 %45 %48 + OpStore %_GLF_color %49 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %51 = OpLoad %int %50 + OpStore %i %51 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %i + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %58 = OpLoad %int %57 + %59 = OpSLessThan %bool %56 %58 + OpBranchConditional %59 %60 %53 + %60 = OpLabel + %61 = OpLoad %int %a + %62 = OpIAdd %int %61 %int_1 + OpStore %a %62 + %63 = OpSGreaterThan %bool %61 %int_3 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + OpBranch %53 + %64 = OpLabel + %66 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %67 = OpLoad %float %66 + %68 = OpAccessChain %_ptr_Uniform_float %__1 %int_0 %int_0 + %69 = OpLoad %float %68 + %70 = OpFOrdGreaterThan %bool %67 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + OpKill + %71 = OpLabel + OpBranch %54 + %54 = OpLabel + %73 = OpLoad %int %i + %74 = OpIAdd %int %73 %int_1 + OpStore %i %74 + OpBranch %52 + %53 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..8a9fa57bb7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,62 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_9 : register(b2, space0) { + uint4 x_9[1]; +}; +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[1]; +}; + +void main_1() { + int a = 0; + int i = 0; + a = 1; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_41 = asint(x_6[1].x); + const int x_44 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_38), float(x_41), float(x_44), float(x_47)); + const int x_51 = asint(x_6[1].x); + i = x_51; + while (true) { + const int x_56 = i; + const int x_58 = asint(x_6[2].x); + if ((x_56 < x_58)) { + } else { + break; + } + const int x_61 = a; + a = (x_61 + 1); + if ((x_61 > 3)) { + break; + } + const float x_67 = asfloat(x_9[0].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_69 = asfloat(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_67 > x_69)) { + discard; + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..51c456778d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,77 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct buf2 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf2& x_9, constant buf1& x_11, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + a = 1; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_41 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_44 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_47 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_38), float(x_41), float(x_44), float(x_47)); + int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_51; + while (true) { + int const x_56 = i; + int const x_58 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_56 < x_58)) { + } else { + break; + } + int const x_61 = a; + a = (x_61 + 1); + if ((x_61 > 3)) { + break; + } + float const x_67 = x_9.injectionSwitch.x; + float const x_69 = x_11.x_GLF_uniform_float_values.arr[0].el; + if ((x_67 > x_69)) { + discard_fragment(); + } + { + int const x_73 = i; + i = (x_73 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf2& x_9 [[buffer(2)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, x_11, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..978adb0fdf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,165 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_11 "x_11" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 2 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_9 = OpVariable %_ptr_Uniform_buf2 Uniform + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %24 + %27 = OpLabel + %a = OpVariable %_ptr_Function_int Function %30 + %i = OpVariable %_ptr_Function_int Function %30 + OpStore %a %int_1 + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %39 = OpLoad %int %38 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %37 + %45 = OpConvertSToF %float %39 + %46 = OpConvertSToF %float %41 + %47 = OpConvertSToF %float %43 + %48 = OpCompositeConstruct %v4float %44 %45 %46 %47 + OpStore %x_GLF_color %48 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %50 = OpLoad %int %49 + OpStore %i %50 + OpBranch %51 + %51 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %int %i + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %58 = OpLoad %int %57 + %59 = OpSLessThan %bool %55 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %52 + %61 = OpLabel + %64 = OpLoad %int %a + %65 = OpIAdd %int %64 %int_1 + OpStore %a %65 + %67 = OpSGreaterThan %bool %64 %int_3 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + OpBranch %52 + %68 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %74 = OpLoad %float %73 + %75 = OpFOrdGreaterThan %bool %72 %74 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %76 + %77 = OpLabel + OpKill + %76 = OpLabel + OpBranch %53 + %53 = OpLabel + %78 = OpLoad %int %i + %79 = OpIAdd %int %78 %int_1 + OpStore %i %79 + OpBranch %51 + %52 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %80 +%tint_symbol = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %24 + %87 = OpLabel + %88 = OpFunctionCall %void %main_1 + %90 = OpLoad %v4float %x_GLF_color + %91 = OpCompositeConstruct %main_out %90 + %89 = OpFunctionCall %void %tint_symbol_2 %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..aa0d3ab44e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,74 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[block]] +struct buf2 { + injectionSwitch : vec2; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(2)]] var x_9 : buf2; + +[[group(0), binding(1)]] var x_11 : buf1; + +fn main_1() { + var a : i32; + var i : i32; + a = 1; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_44 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_38), f32(x_41), f32(x_44), f32(x_47)); + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_51; + loop { + let x_56 : i32 = i; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_56 < x_58)) { + } else { + break; + } + let x_61 : i32 = a; + a = (x_61 + 1); + if ((x_61 > 3)) { + break; + } + let x_67 : f32 = x_9.injectionSwitch.x; + let x_69 : f32 = x_11.x_GLF_uniform_float_values[0]; + if ((x_67 > x_69)) { + discard; + } + + continuing { + let x_73 : i32 = i; + i = (x_73 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl new file mode 100644 index 0000000000..aa0d3ab44e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl @@ -0,0 +1,74 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[block]] +struct buf2 { + injectionSwitch : vec2; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(2)]] var x_9 : buf2; + +[[group(0), binding(1)]] var x_11 : buf1; + +fn main_1() { + var a : i32; + var i : i32; + a = 1; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_44 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_38), f32(x_41), f32(x_44), f32(x_47)); + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_51; + loop { + let x_56 : i32 = i; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_56 < x_58)) { + } else { + break; + } + let x_61 : i32 = a; + a = (x_61 + 1); + if ((x_61 > 3)) { + break; + } + let x_67 : f32 = x_9.injectionSwitch.x; + let x_69 : f32 = x_11.x_GLF_uniform_float_values[0]; + if ((x_67 > x_69)) { + discard; + } + + continuing { + let x_73 : i32 = i; + i = (x_73 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..8a9fa57bb7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,62 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_9 : register(b2, space0) { + uint4 x_9[1]; +}; +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[1]; +}; + +void main_1() { + int a = 0; + int i = 0; + a = 1; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_41 = asint(x_6[1].x); + const int x_44 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_38), float(x_41), float(x_44), float(x_47)); + const int x_51 = asint(x_6[1].x); + i = x_51; + while (true) { + const int x_56 = i; + const int x_58 = asint(x_6[2].x); + if ((x_56 < x_58)) { + } else { + break; + } + const int x_61 = a; + a = (x_61 + 1); + if ((x_61 > 3)) { + break; + } + const float x_67 = asfloat(x_9[0].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_69 = asfloat(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_67 > x_69)) { + discard; + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..51c456778d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,77 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct buf2 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf2& x_9, constant buf1& x_11, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + a = 1; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_41 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_44 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_47 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_38), float(x_41), float(x_44), float(x_47)); + int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_51; + while (true) { + int const x_56 = i; + int const x_58 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_56 < x_58)) { + } else { + break; + } + int const x_61 = a; + a = (x_61 + 1); + if ((x_61 > 3)) { + break; + } + float const x_67 = x_9.injectionSwitch.x; + float const x_69 = x_11.x_GLF_uniform_float_values.arr[0].el; + if ((x_67 > x_69)) { + discard_fragment(); + } + { + int const x_73 = i; + i = (x_73 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf2& x_9 [[buffer(2)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, x_11, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..978adb0fdf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,165 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_11 "x_11" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 2 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_9 = OpVariable %_ptr_Uniform_buf2 Uniform + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %24 + %27 = OpLabel + %a = OpVariable %_ptr_Function_int Function %30 + %i = OpVariable %_ptr_Function_int Function %30 + OpStore %a %int_1 + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %39 = OpLoad %int %38 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %37 + %45 = OpConvertSToF %float %39 + %46 = OpConvertSToF %float %41 + %47 = OpConvertSToF %float %43 + %48 = OpCompositeConstruct %v4float %44 %45 %46 %47 + OpStore %x_GLF_color %48 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %50 = OpLoad %int %49 + OpStore %i %50 + OpBranch %51 + %51 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %int %i + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %58 = OpLoad %int %57 + %59 = OpSLessThan %bool %55 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %52 + %61 = OpLabel + %64 = OpLoad %int %a + %65 = OpIAdd %int %64 %int_1 + OpStore %a %65 + %67 = OpSGreaterThan %bool %64 %int_3 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + OpBranch %52 + %68 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %74 = OpLoad %float %73 + %75 = OpFOrdGreaterThan %bool %72 %74 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %76 + %77 = OpLabel + OpKill + %76 = OpLabel + OpBranch %53 + %53 = OpLabel + %78 = OpLoad %int %i + %79 = OpIAdd %int %78 %int_1 + OpStore %i %79 + OpBranch %51 + %52 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %80 +%tint_symbol = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %24 + %87 = OpLabel + %88 = OpFunctionCall %void %main_1 + %90 = OpLoad %v4float %x_GLF_color + %91 = OpCompositeConstruct %main_out %90 + %89 = OpFunctionCall %void %tint_symbol_2 %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..aa0d3ab44e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-conditional-discard-inside-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,74 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[block]] +struct buf2 { + injectionSwitch : vec2; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(2)]] var x_9 : buf2; + +[[group(0), binding(1)]] var x_11 : buf1; + +fn main_1() { + var a : i32; + var i : i32; + a = 1; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_44 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_38), f32(x_41), f32(x_44), f32(x_47)); + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_51; + loop { + let x_56 : i32 = i; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_56 < x_58)) { + } else { + break; + } + let x_61 : i32 = a; + a = (x_61 + 1); + if ((x_61 > 3)) { + break; + } + let x_67 : f32 = x_9.injectionSwitch.x; + let x_69 : f32 = x_11.x_GLF_uniform_float_values[0]; + if ((x_67 > x_69)) { + discard; + } + + continuing { + let x_73 : i32 = i; + i = (x_73 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm new file mode 100644 index 0000000000..84990a83df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm @@ -0,0 +1,65 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v "v" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "quarter" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%float_424_113007 = OpConstant %float 424.113007 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_1_29999995 = OpConstant %float 1.29999995 +%float_19_6200008 = OpConstant %float 19.6200008 + %float_425 = OpConstant %float 425 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_20 = OpConstant %float 20 + %23 = OpConstantComposite %v4float %float_425 %float_1 %float_2 %float_20 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %28 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %29 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %30 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + %31 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %32 = OpLoad %float %31 + %33 = OpCompositeConstruct %v4float %float_424_113007 %32 %float_1_29999995 %float_19_6200008 + %34 = OpExtInst %v4float %1 Ceil %33 + OpStore %v %34 + %35 = OpLoad %v4float %v + %36 = OpFOrdEqual %v4bool %35 %23 + %37 = OpAll %bool %36 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %40 + %39 = OpLabel + OpStore %_GLF_color %28 + OpBranch %38 + %40 = OpLabel + OpStore %_GLF_color %29 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..1009de2ec6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.hlsl @@ -0,0 +1,30 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_32 = asfloat(x_6[0].x); + v = ceil(float4(424.113006592f, x_32, 1.299999952f, 19.620000839f)); + if (all((v == float4(425.0f, 1.0f, 2.0f, 20.0f)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..8e6db1d42d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float quarter; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + float const x_32 = x_6.quarter; + v = ceil(float4(424.113006592f, x_32, 1.299999952f, 19.620000839f)); + float4 const x_35 = v; + if (all((x_35 == float4(425.0f, 1.0f, 2.0f, 20.0f)))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..c4f9009a02 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "quarter" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_424_113007 = OpConstant %float 424.113007 +%float_1_29999995 = OpConstant %float 1.29999995 +%float_19_6200008 = OpConstant %float 19.6200008 + %bool = OpTypeBool + %float_425 = OpConstant %float 425 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_20 = OpConstant %float 20 + %35 = OpConstantComposite %v4float %float_425 %float_1 %float_2 %float_20 + %v4bool = OpTypeVector %bool 4 + %float_0 = OpConstant %float 0 + %42 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %8 + %20 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %21 = OpLoad %float %20 + %27 = OpCompositeConstruct %v4float %float_424_113007 %21 %float_1_29999995 %float_19_6200008 + %22 = OpExtInst %v4float %23 Ceil %27 + OpStore %v %22 + %28 = OpLoad %v4float %v + %36 = OpFOrdEqual %v4bool %28 %35 + %29 = OpAll %bool %36 + OpSelectionMerge %38 None + OpBranchConditional %29 %39 %40 + %39 = OpLabel + OpStore %x_GLF_color %42 + OpBranch %38 + %40 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %44 +%tint_symbol = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %51 = OpLabel + %52 = OpFunctionCall %void %main_1 + %54 = OpLoad %v4float %x_GLF_color + %55 = OpCompositeConstruct %main_out %54 + %53 = OpFunctionCall %void %tint_symbol_2 %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..cb4aa38714 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct buf0 { + quarter : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + let x_32 : f32 = x_6.quarter; + v = ceil(vec4(424.113006592, x_32, 1.299999952, 19.620000839)); + let x_35 : vec4 = v; + if (all((x_35 == vec4(425.0, 1.0, 2.0, 20.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl new file mode 100644 index 0000000000..cb4aa38714 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct buf0 { + quarter : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + let x_32 : f32 = x_6.quarter; + v = ceil(vec4(424.113006592, x_32, 1.299999952, 19.620000839)); + let x_35 : vec4 = v; + if (all((x_35 == vec4(425.0, 1.0, 2.0, 20.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..1009de2ec6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.hlsl @@ -0,0 +1,30 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_32 = asfloat(x_6[0].x); + v = ceil(float4(424.113006592f, x_32, 1.299999952f, 19.620000839f)); + if (all((v == float4(425.0f, 1.0f, 2.0f, 20.0f)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..8e6db1d42d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float quarter; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + float const x_32 = x_6.quarter; + v = ceil(float4(424.113006592f, x_32, 1.299999952f, 19.620000839f)); + float4 const x_35 = v; + if (all((x_35 == float4(425.0f, 1.0f, 2.0f, 20.0f)))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..c4f9009a02 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %23 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "quarter" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_424_113007 = OpConstant %float 424.113007 +%float_1_29999995 = OpConstant %float 1.29999995 +%float_19_6200008 = OpConstant %float 19.6200008 + %bool = OpTypeBool + %float_425 = OpConstant %float 425 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_20 = OpConstant %float 20 + %35 = OpConstantComposite %v4float %float_425 %float_1 %float_2 %float_20 + %v4bool = OpTypeVector %bool 4 + %float_0 = OpConstant %float 0 + %42 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %8 + %20 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %21 = OpLoad %float %20 + %27 = OpCompositeConstruct %v4float %float_424_113007 %21 %float_1_29999995 %float_19_6200008 + %22 = OpExtInst %v4float %23 Ceil %27 + OpStore %v %22 + %28 = OpLoad %v4float %v + %36 = OpFOrdEqual %v4bool %28 %35 + %29 = OpAll %bool %36 + OpSelectionMerge %38 None + OpBranchConditional %29 %39 %40 + %39 = OpLabel + OpStore %x_GLF_color %42 + OpBranch %38 + %40 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %44 +%tint_symbol = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %51 = OpLabel + %52 = OpFunctionCall %void %main_1 + %54 = OpLoad %v4float %x_GLF_color + %55 = OpCompositeConstruct %main_out %54 + %53 = OpFunctionCall %void %tint_symbol_2 %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..cb4aa38714 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-ceil-vec4/0-opt.wgsl.expected.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct buf0 { + quarter : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + let x_32 : f32 = x_6.quarter; + v = ceil(vec4(424.113006592, x_32, 1.299999952, 19.620000839)); + let x_35 : vec4 = v; + if (all((x_35 == vec4(425.0, 1.0, 2.0, 20.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm new file mode 100644 index 0000000000..12e9e7b3ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm @@ -0,0 +1,72 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %j "j" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_9 = OpConstant %int 9 + %bool = OpTypeBool + %int_10 = OpConstant %int 10 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %7 + %23 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpStore %j %int_1 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %i + %29 = OpLoad %int %j + %30 = OpExtInst %int %1 SClamp %29 %int_5 %int_9 + %31 = OpSLessThan %bool %28 %30 + OpBranchConditional %31 %32 %25 + %32 = OpLabel + %33 = OpLoad %int %i + %34 = OpIAdd %int %33 %int_1 + OpStore %i %34 + %35 = OpLoad %int %j + %36 = OpIAdd %int %35 %int_1 + OpStore %j %36 + OpBranch %26 + %26 = OpLabel + OpBranch %24 + %25 = OpLabel + %37 = OpLoad %int %i + %38 = OpIEqual %bool %37 %int_9 + %39 = OpLoad %int %j + %40 = OpIEqual %bool %39 %int_10 + %41 = OpLogicalAnd %bool %38 %40 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %44 + %43 = OpLabel + OpStore %_GLF_color %21 + OpBranch %42 + %44 = OpLabel + OpStore %_GLF_color %22 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..cef004d6c1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.hlsl @@ -0,0 +1,40 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int j = 0; + i = 0; + j = 1; + while (true) { + if ((i < clamp(j, 5, 9))) { + } else { + break; + } + i = (i + 1); + j = (j + 1); + } + bool tint_tmp = (i == 9); + if (tint_tmp) { + tint_tmp = (j == 10); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..35f0b9cecb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int i = 0; + int j = 0; + i = 0; + j = 1; + while (true) { + int const x_28 = i; + int const x_29 = j; + if ((x_28 < clamp(x_29, 5, 9))) { + } else { + break; + } + int const x_33 = i; + i = (x_33 + 1); + int const x_35 = j; + j = (x_35 + 1); + } + int const x_37 = i; + int const x_39 = j; + if (((x_37 == 9) && (x_39 == 10))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..99a8be5dc7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.spvasm @@ -0,0 +1,114 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + %26 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_9 = OpConstant %int 9 + %bool = OpTypeBool + %int_10 = OpConstant %int 10 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %51 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %52 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %i = OpVariable %_ptr_Function_int Function %15 + %j = OpVariable %_ptr_Function_int Function %15 + OpStore %i %int_0 + OpStore %j %int_1 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %23 = OpLoad %int %i + %24 = OpLoad %int %j + %25 = OpExtInst %int %26 SClamp %24 %int_5 %int_9 + %29 = OpSLessThan %bool %23 %25 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpBranch %20 + %31 = OpLabel + %34 = OpLoad %int %i + %35 = OpIAdd %int %34 %int_1 + OpStore %i %35 + %36 = OpLoad %int %j + %37 = OpIAdd %int %36 %int_1 + OpStore %j %37 + OpBranch %21 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + %38 = OpLoad %int %i + %39 = OpLoad %int %j + %40 = OpIEqual %bool %38 %int_9 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + %44 = OpIEqual %bool %39 %int_10 + OpBranch %41 + %41 = OpLabel + %45 = OpPhi %bool %40 %20 %44 %42 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpStore %x_GLF_color %51 + OpBranch %46 + %48 = OpLabel + OpStore %x_GLF_color %52 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %53 +%tint_symbol = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %60 = OpLabel + %61 = OpFunctionCall %void %main_1 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpCompositeConstruct %main_out %63 + %62 = OpFunctionCall %void %tint_symbol_2 %64 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..367bf4033d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var j : i32; + i = 0; + j = 1; + loop { + let x_28 : i32 = i; + let x_29 : i32 = j; + if ((x_28 < clamp(x_29, 5, 9))) { + } else { + break; + } + let x_33 : i32 = i; + i = (x_33 + 1); + let x_35 : i32 = j; + j = (x_35 + 1); + } + let x_37 : i32 = i; + let x_39 : i32 = j; + if (((x_37 == 9) && (x_39 == 10))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl new file mode 100644 index 0000000000..367bf4033d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl @@ -0,0 +1,39 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var j : i32; + i = 0; + j = 1; + loop { + let x_28 : i32 = i; + let x_29 : i32 = j; + if ((x_28 < clamp(x_29, 5, 9))) { + } else { + break; + } + let x_33 : i32 = i; + i = (x_33 + 1); + let x_35 : i32 = j; + j = (x_35 + 1); + } + let x_37 : i32 = i; + let x_39 : i32 = j; + if (((x_37 == 9) && (x_39 == 10))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..cef004d6c1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.hlsl @@ -0,0 +1,40 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int j = 0; + i = 0; + j = 1; + while (true) { + if ((i < clamp(j, 5, 9))) { + } else { + break; + } + i = (i + 1); + j = (j + 1); + } + bool tint_tmp = (i == 9); + if (tint_tmp) { + tint_tmp = (j == 10); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..35f0b9cecb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int i = 0; + int j = 0; + i = 0; + j = 1; + while (true) { + int const x_28 = i; + int const x_29 = j; + if ((x_28 < clamp(x_29, 5, 9))) { + } else { + break; + } + int const x_33 = i; + i = (x_33 + 1); + int const x_35 = j; + j = (x_35 + 1); + } + int const x_37 = i; + int const x_39 = j; + if (((x_37 == 9) && (x_39 == 10))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..99a8be5dc7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.spvasm @@ -0,0 +1,114 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + %26 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_9 = OpConstant %int 9 + %bool = OpTypeBool + %int_10 = OpConstant %int 10 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %51 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %52 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %i = OpVariable %_ptr_Function_int Function %15 + %j = OpVariable %_ptr_Function_int Function %15 + OpStore %i %int_0 + OpStore %j %int_1 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %23 = OpLoad %int %i + %24 = OpLoad %int %j + %25 = OpExtInst %int %26 SClamp %24 %int_5 %int_9 + %29 = OpSLessThan %bool %23 %25 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpBranch %20 + %31 = OpLabel + %34 = OpLoad %int %i + %35 = OpIAdd %int %34 %int_1 + OpStore %i %35 + %36 = OpLoad %int %j + %37 = OpIAdd %int %36 %int_1 + OpStore %j %37 + OpBranch %21 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + %38 = OpLoad %int %i + %39 = OpLoad %int %j + %40 = OpIEqual %bool %38 %int_9 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + %44 = OpIEqual %bool %39 %int_10 + OpBranch %41 + %41 = OpLabel + %45 = OpPhi %bool %40 %20 %44 %42 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpStore %x_GLF_color %51 + OpBranch %46 + %48 = OpLabel + OpStore %x_GLF_color %52 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %53 +%tint_symbol = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %60 = OpLabel + %61 = OpFunctionCall %void %main_1 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpCompositeConstruct %main_out %63 + %62 = OpFunctionCall %void %tint_symbol_2 %64 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..367bf4033d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-inside-while/0-opt.wgsl.expected.wgsl @@ -0,0 +1,39 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var j : i32; + i = 0; + j = 1; + loop { + let x_28 : i32 = i; + let x_29 : i32 = j; + if ((x_28 < clamp(x_29, 5, 9))) { + } else { + break; + } + let x_33 : i32 = i; + i = (x_33 + 1); + let x_35 : i32 = j; + j = (x_35 + 1); + } + let x_37 : i32 = i; + let x_39 : i32 = j; + if (((x_37 == 9) && (x_39 == 10))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm new file mode 100644 index 0000000000..8bcd480695 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm @@ -0,0 +1,58 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_2 = OpConstant %float 2 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %float_n1 = OpConstant %float -1 + %float_0 = OpConstant %float 0 + %v4float = OpTypeVector %float 4 + %18 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %7 + %23 = OpLabel + %24 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %25 = OpLoad %float %24 + %26 = OpExtInst %float %1 FClamp %float_2 %25 %float_1 + %27 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %28 = OpLoad %float %27 + %29 = OpExtInst %float %1 FClamp %float_n1 %float_0 %28 + %30 = OpCompositeConstruct %v4float %26 %29 %float_0 %float_1 + %31 = OpFOrdNotEqual %v4bool %30 %18 + %32 = OpAny %bool %31 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + OpStore %_GLF_color %22 + OpBranch %33 + %35 = OpLabel + OpStore %_GLF_color %18 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..94f03e4dd6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.hlsl @@ -0,0 +1,29 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_25 = asfloat(x_5[0].x); + const float x_28 = asfloat(x_5[0].x); + if (any((float4(clamp(2.0f, x_25, 1.0f), clamp(-1.0f, 0.0f, x_28), 0.0f, 1.0f) != float4(1.0f, 0.0f, 0.0f, 1.0f)))) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..53f9786c72 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.msl @@ -0,0 +1,32 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float const x_25 = x_5.zero; + float const x_28 = x_5.zero; + if (any((float4(clamp(2.0f, x_25, 1.0f), clamp(-1.0f, 0.0f, x_28), 0.0f, 1.0f) != float4(1.0f, 0.0f, 0.0f, 1.0f)))) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..694832d04a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %25 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %float_2 = OpConstant %float 2 + %float_1 = OpConstant %float 1 + %float_n1 = OpConstant %float -1 + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %v4bool = OpTypeVector %bool 4 + %38 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %39 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %19 = OpLoad %float %18 + %20 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %21 = OpLoad %float %20 + %24 = OpExtInst %float %25 NClamp %float_2 %19 %float_1 + %28 = OpExtInst %float %25 NClamp %float_n1 %float_0 %21 + %31 = OpCompositeConstruct %v4float %24 %28 %float_0 %float_1 + %33 = OpFOrdNotEqual %v4bool %31 %32 + %22 = OpAny %bool %33 + OpSelectionMerge %35 None + OpBranchConditional %22 %36 %37 + %36 = OpLabel + OpStore %x_GLF_color %38 + OpBranch %35 + %37 = OpLabel + OpStore %x_GLF_color %32 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %39 +%tint_symbol = OpFunctionParameter %main_out + %43 = OpLabel + %44 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %44 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %46 = OpLabel + %47 = OpFunctionCall %void %main_1 + %49 = OpLoad %v4float %x_GLF_color + %50 = OpCompositeConstruct %main_out %49 + %48 = OpFunctionCall %void %tint_symbol_2 %50 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ad25a068b3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.spvasm.expected.wgsl @@ -0,0 +1,30 @@ +[[block]] +struct buf0 { + zero : f32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_25 : f32 = x_5.zero; + let x_28 : f32 = x_5.zero; + if (any((vec4(clamp(2.0, x_25, 1.0), clamp(-1.0, 0.0, x_28), 0.0, 1.0) != vec4(1.0, 0.0, 0.0, 1.0)))) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl new file mode 100644 index 0000000000..ad25a068b3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl @@ -0,0 +1,30 @@ +[[block]] +struct buf0 { + zero : f32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_25 : f32 = x_5.zero; + let x_28 : f32 = x_5.zero; + if (any((vec4(clamp(2.0, x_25, 1.0), clamp(-1.0, 0.0, x_28), 0.0, 1.0) != vec4(1.0, 0.0, 0.0, 1.0)))) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..94f03e4dd6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.hlsl @@ -0,0 +1,29 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_25 = asfloat(x_5[0].x); + const float x_28 = asfloat(x_5[0].x); + if (any((float4(clamp(2.0f, x_25, 1.0f), clamp(-1.0f, 0.0f, x_28), 0.0f, 1.0f) != float4(1.0f, 0.0f, 0.0f, 1.0f)))) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..53f9786c72 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.msl @@ -0,0 +1,32 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float const x_25 = x_5.zero; + float const x_28 = x_5.zero; + if (any((float4(clamp(2.0f, x_25, 1.0f), clamp(-1.0f, 0.0f, x_28), 0.0f, 1.0f) != float4(1.0f, 0.0f, 0.0f, 1.0f)))) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..694832d04a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %25 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %float_2 = OpConstant %float 2 + %float_1 = OpConstant %float 1 + %float_n1 = OpConstant %float -1 + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %v4bool = OpTypeVector %bool 4 + %38 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %39 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %19 = OpLoad %float %18 + %20 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %21 = OpLoad %float %20 + %24 = OpExtInst %float %25 NClamp %float_2 %19 %float_1 + %28 = OpExtInst %float %25 NClamp %float_n1 %float_0 %21 + %31 = OpCompositeConstruct %v4float %24 %28 %float_0 %float_1 + %33 = OpFOrdNotEqual %v4bool %31 %32 + %22 = OpAny %bool %33 + OpSelectionMerge %35 None + OpBranchConditional %22 %36 %37 + %36 = OpLabel + OpStore %x_GLF_color %38 + OpBranch %35 + %37 = OpLabel + OpStore %x_GLF_color %32 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %39 +%tint_symbol = OpFunctionParameter %main_out + %43 = OpLabel + %44 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %44 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %46 = OpLabel + %47 = OpFunctionCall %void %main_1 + %49 = OpLoad %v4float %x_GLF_color + %50 = OpCompositeConstruct %main_out %49 + %48 = OpFunctionCall %void %tint_symbol_2 %50 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ad25a068b3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-min/0-opt.wgsl.expected.wgsl @@ -0,0 +1,30 @@ +[[block]] +struct buf0 { + zero : f32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_25 : f32 = x_5.zero; + let x_28 : f32 = x_5.zero; + if (any((vec4(clamp(2.0, x_25, 1.0), clamp(-1.0, 0.0, x_28), 0.0, 1.0) != vec4(1.0, 0.0, 0.0, 1.0)))) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm new file mode 100644 index 0000000000..148690aa35 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm @@ -0,0 +1,59 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %13 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Function_float = OpTypePointer Function %float + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %main = OpFunction %void None %8 + %21 = OpLabel + %f = OpVariable %_ptr_Function_float Function + OpStore %_GLF_color %13 + %22 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %23 = OpLoad %float %22 + %24 = OpExtInst %float %1 FClamp %23 %float_1 %float_1 + OpStore %f %24 + %25 = OpLoad %float %f + %26 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %27 = OpLoad %float %26 + %28 = OpFOrdGreaterThan %bool %25 %27 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %31 + %30 = OpLabel + OpStore %_GLF_color %13 + OpBranch %29 + %31 = OpLabel + %32 = OpLoad %float %f + %33 = OpCompositeConstruct %v4float %32 %float_0 %float_0 %float_1 + OpStore %_GLF_color %33 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..e17c5d1556 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.hlsl @@ -0,0 +1,33 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + float f = 0.0f; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_23 = asfloat(x_6[0].x); + f = clamp(x_23, 1.0f, 1.0f); + const float x_25 = f; + const float x_27 = asfloat(x_6[0].x); + if ((x_25 > x_27)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..8239923448 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + float const x_23 = x_6.one; + f = clamp(x_23, 1.0f, 1.0f); + float const x_25 = f; + float const x_27 = x_6.one; + if ((x_25 > x_27)) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + float const x_32 = f; + *(tint_symbol_4) = float4(x_32, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..fa00ca66d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %26 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %f = OpVariable %_ptr_Function_float Function %17 + OpStore %x_GLF_color %19 + %23 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %24 = OpLoad %float %23 + %25 = OpExtInst %float %26 NClamp %24 %float_1 %float_1 + OpStore %f %25 + %28 = OpLoad %float %f + %29 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %30 = OpLoad %float %29 + %31 = OpFOrdGreaterThan %bool %28 %30 + OpSelectionMerge %33 None + OpBranchConditional %31 %34 %35 + %34 = OpLabel + OpStore %x_GLF_color %19 + OpBranch %33 + %35 = OpLabel + %36 = OpLoad %float %f + %37 = OpCompositeConstruct %v4float %36 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %37 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %38 +%tint_symbol = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %45 = OpLabel + %46 = OpFunctionCall %void %main_1 + %48 = OpLoad %v4float %x_GLF_color + %49 = OpCompositeConstruct %main_out %48 + %47 = OpFunctionCall %void %tint_symbol_2 %49 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5b410384df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.spvasm.expected.wgsl @@ -0,0 +1,35 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var f : f32; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_23 : f32 = x_6.one; + f = clamp(x_23, 1.0, 1.0); + let x_25 : f32 = f; + let x_27 : f32 = x_6.one; + if ((x_25 > x_27)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + let x_32 : f32 = f; + x_GLF_color = vec4(x_32, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl new file mode 100644 index 0000000000..5b410384df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl @@ -0,0 +1,35 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var f : f32; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_23 : f32 = x_6.one; + f = clamp(x_23, 1.0, 1.0); + let x_25 : f32 = f; + let x_27 : f32 = x_6.one; + if ((x_25 > x_27)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + let x_32 : f32 = f; + x_GLF_color = vec4(x_32, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..e17c5d1556 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + float f = 0.0f; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_23 = asfloat(x_6[0].x); + f = clamp(x_23, 1.0f, 1.0f); + const float x_25 = f; + const float x_27 = asfloat(x_6[0].x); + if ((x_25 > x_27)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..8239923448 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + float const x_23 = x_6.one; + f = clamp(x_23, 1.0f, 1.0f); + float const x_25 = f; + float const x_27 = x_6.one; + if ((x_25 > x_27)) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + float const x_32 = f; + *(tint_symbol_4) = float4(x_32, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..fa00ca66d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.spvasm @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %26 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %f = OpVariable %_ptr_Function_float Function %17 + OpStore %x_GLF_color %19 + %23 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %24 = OpLoad %float %23 + %25 = OpExtInst %float %26 NClamp %24 %float_1 %float_1 + OpStore %f %25 + %28 = OpLoad %float %f + %29 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %30 = OpLoad %float %29 + %31 = OpFOrdGreaterThan %bool %28 %30 + OpSelectionMerge %33 None + OpBranchConditional %31 %34 %35 + %34 = OpLabel + OpStore %x_GLF_color %19 + OpBranch %33 + %35 = OpLabel + %36 = OpLoad %float %f + %37 = OpCompositeConstruct %v4float %36 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %37 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %38 +%tint_symbol = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %45 = OpLabel + %46 = OpFunctionCall %void %main_1 + %48 = OpLoad %v4float %x_GLF_color + %49 = OpCompositeConstruct %main_out %48 + %47 = OpFunctionCall %void %tint_symbol_2 %49 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5b410384df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp-vs-original/0-opt.wgsl.expected.wgsl @@ -0,0 +1,35 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var f : f32; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_23 : f32 = x_6.one; + f = clamp(x_23, 1.0, 1.0); + let x_25 : f32 = f; + let x_27 : f32 = x_6.one; + if ((x_25 > x_27)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + let x_32 : f32 = f; + x_GLF_color = vec4(x_32, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm new file mode 100644 index 0000000000..35ba5e2113 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm @@ -0,0 +1,66 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "fourtytwo" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_42 = OpConstant %float 42 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %20 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %7 + %21 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %23 = OpLoad %float %22 + %24 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %25 = OpLoad %float %24 + %26 = OpExtInst %float %1 FClamp %float_1 %23 %25 + %27 = OpFOrdGreaterThan %bool %26 %float_42 + %28 = OpLogicalNot %bool %27 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %29 + %30 = OpLabel + %31 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %32 = OpLoad %float %31 + %33 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %34 = OpLoad %float %33 + %35 = OpExtInst %float %1 FClamp %float_1 %32 %34 + %36 = OpFOrdLessThan %bool %35 %float_42 + OpBranch %29 + %29 = OpLabel + %37 = OpPhi %bool %27 %21 %36 %30 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %40 + %39 = OpLabel + OpStore %_GLF_color %19 + OpBranch %38 + %40 = OpLabel + OpStore %_GLF_color %20 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..88c13392cc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,39 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_36 = false; + bool x_37_phi = false; + const float x_23 = asfloat(x_5[0].x); + const float x_25 = asfloat(x_5[0].x); + const bool x_27 = (clamp(1.0f, x_23, x_25) > 42.0f); + x_37_phi = x_27; + if (!(x_27)) { + const float x_32 = asfloat(x_5[0].x); + const float x_34 = asfloat(x_5[0].x); + x_36 = (clamp(1.0f, x_32, x_34) < 42.0f); + x_37_phi = x_36; + } + if (x_37_phi) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d8002a70c0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float fourtytwo; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + bool x_36 = false; + bool x_37_phi = false; + float const x_23 = x_5.fourtytwo; + float const x_25 = x_5.fourtytwo; + bool const x_27 = (clamp(1.0f, x_23, x_25) > 42.0f); + x_37_phi = x_27; + if (!(x_27)) { + float const x_32 = x_5.fourtytwo; + float const x_34 = x_5.fourtytwo; + x_36 = (clamp(1.0f, x_32, x_34) < 42.0f); + x_37_phi = x_36; + } + bool const x_37 = x_37_phi; + if (x_37) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b6f79ebdbd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %28 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "fourtytwo" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_36 "x_36" + OpName %x_37_phi "x_37_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %18 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %float_42 = OpConstant %float 42 + %float_0 = OpConstant %float 0 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_36 = OpVariable %_ptr_Function_bool Function %18 + %x_37_phi = OpVariable %_ptr_Function_bool Function %18 + %23 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %24 = OpLoad %float %23 + %25 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %26 = OpLoad %float %25 + %27 = OpExtInst %float %28 NClamp %float_1 %24 %26 + %31 = OpFOrdGreaterThan %bool %27 %float_42 + OpStore %x_37_phi %31 + %32 = OpLogicalNot %bool %31 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %33 + %34 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %36 = OpLoad %float %35 + %37 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %38 = OpLoad %float %37 + %39 = OpExtInst %float %28 NClamp %float_1 %36 %38 + %40 = OpFOrdLessThan %bool %39 %float_42 + OpStore %x_36 %40 + %41 = OpLoad %bool %x_36 + OpStore %x_37_phi %41 + OpBranch %33 + %33 = OpLabel + %42 = OpLoad %bool %x_37_phi + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + OpStore %x_GLF_color %47 + OpBranch %43 + %45 = OpLabel + OpStore %x_GLF_color %48 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %49 +%tint_symbol = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %56 = OpLabel + %57 = OpFunctionCall %void %main_1 + %59 = OpLoad %v4float %x_GLF_color + %60 = OpCompositeConstruct %main_out %59 + %58 = OpFunctionCall %void %tint_symbol_2 %60 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..4969baac18 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,41 @@ +[[block]] +struct buf0 { + fourtytwo : f32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : bool; + var x_37_phi : bool; + let x_23 : f32 = x_5.fourtytwo; + let x_25 : f32 = x_5.fourtytwo; + let x_27 : bool = (clamp(1.0, x_23, x_25) > 42.0); + x_37_phi = x_27; + if (!(x_27)) { + let x_32 : f32 = x_5.fourtytwo; + let x_34 : f32 = x_5.fourtytwo; + x_36 = (clamp(1.0, x_32, x_34) < 42.0); + x_37_phi = x_36; + } + let x_37 : bool = x_37_phi; + if (x_37) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl new file mode 100644 index 0000000000..4969baac18 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl @@ -0,0 +1,41 @@ +[[block]] +struct buf0 { + fourtytwo : f32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : bool; + var x_37_phi : bool; + let x_23 : f32 = x_5.fourtytwo; + let x_25 : f32 = x_5.fourtytwo; + let x_27 : bool = (clamp(1.0, x_23, x_25) > 42.0); + x_37_phi = x_27; + if (!(x_27)) { + let x_32 : f32 = x_5.fourtytwo; + let x_34 : f32 = x_5.fourtytwo; + x_36 = (clamp(1.0, x_32, x_34) < 42.0); + x_37_phi = x_36; + } + let x_37 : bool = x_37_phi; + if (x_37) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..88c13392cc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,39 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_36 = false; + bool x_37_phi = false; + const float x_23 = asfloat(x_5[0].x); + const float x_25 = asfloat(x_5[0].x); + const bool x_27 = (clamp(1.0f, x_23, x_25) > 42.0f); + x_37_phi = x_27; + if (!(x_27)) { + const float x_32 = asfloat(x_5[0].x); + const float x_34 = asfloat(x_5[0].x); + x_36 = (clamp(1.0f, x_32, x_34) < 42.0f); + x_37_phi = x_36; + } + if (x_37_phi) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d8002a70c0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float fourtytwo; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + bool x_36 = false; + bool x_37_phi = false; + float const x_23 = x_5.fourtytwo; + float const x_25 = x_5.fourtytwo; + bool const x_27 = (clamp(1.0f, x_23, x_25) > 42.0f); + x_37_phi = x_27; + if (!(x_27)) { + float const x_32 = x_5.fourtytwo; + float const x_34 = x_5.fourtytwo; + x_36 = (clamp(1.0f, x_32, x_34) < 42.0f); + x_37_phi = x_36; + } + bool const x_37 = x_37_phi; + if (x_37) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b6f79ebdbd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %28 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "fourtytwo" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_36 "x_36" + OpName %x_37_phi "x_37_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %18 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %float_42 = OpConstant %float 42 + %float_0 = OpConstant %float 0 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_36 = OpVariable %_ptr_Function_bool Function %18 + %x_37_phi = OpVariable %_ptr_Function_bool Function %18 + %23 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %24 = OpLoad %float %23 + %25 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %26 = OpLoad %float %25 + %27 = OpExtInst %float %28 NClamp %float_1 %24 %26 + %31 = OpFOrdGreaterThan %bool %27 %float_42 + OpStore %x_37_phi %31 + %32 = OpLogicalNot %bool %31 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %33 + %34 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %36 = OpLoad %float %35 + %37 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %38 = OpLoad %float %37 + %39 = OpExtInst %float %28 NClamp %float_1 %36 %38 + %40 = OpFOrdLessThan %bool %39 %float_42 + OpStore %x_36 %40 + %41 = OpLoad %bool %x_36 + OpStore %x_37_phi %41 + OpBranch %33 + %33 = OpLabel + %42 = OpLoad %bool %x_37_phi + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + OpStore %x_GLF_color %47 + OpBranch %43 + %45 = OpLabel + OpStore %x_GLF_color %48 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %49 +%tint_symbol = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %56 = OpLabel + %57 = OpFunctionCall %void %main_1 + %59 = OpLoad %v4float %x_GLF_color + %60 = OpCompositeConstruct %main_out %59 + %58 = OpFunctionCall %void %tint_symbol_2 %60 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..4969baac18 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-clamp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,41 @@ +[[block]] +struct buf0 { + fourtytwo : f32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : bool; + var x_37_phi : bool; + let x_23 : f32 = x_5.fourtytwo; + let x_25 : f32 = x_5.fourtytwo; + let x_27 : bool = (clamp(1.0, x_23, x_25) > 42.0); + x_37_phi = x_27; + if (!(x_27)) { + let x_32 : f32 = x_5.fourtytwo; + let x_34 : f32 = x_5.fourtytwo; + x_36 = (clamp(1.0, x_32, x_34) < 42.0); + x_37_phi = x_36; + } + let x_37 : bool = x_37_phi; + if (x_37) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm new file mode 100644 index 0000000000..00630f96dd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %one "one" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %v2float = OpTypeVector %float 2 + %float_2 = OpConstant %float 2 + %12 = OpConstantComposite %v2float %float_2 %float_1 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_0 = OpConstant %float 0 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %6 + %20 = OpLabel + %one = OpVariable %_ptr_Function_float Function + OpStore %one %float_1 + %21 = OpLoad %float %one + %22 = OpSelect %float %true %float_0 %21 + %23 = OpCompositeConstruct %v2float %float_1 %22 + %24 = OpDot %float %12 %23 + %25 = OpFOrdNotEqual %bool %24 %float_2 + OpSelectionMerge %26 None + OpBranchConditional %25 %27 %28 + %27 = OpLabel + OpStore %_GLF_color %18 + OpBranch %26 + %28 = OpLabel + OpStore %_GLF_color %19 + OpBranch %26 + %26 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..5c12f10650 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.hlsl @@ -0,0 +1,26 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float one = 0.0f; + one = 1.0f; + if ((dot(float2(2.0f, 1.0f), float2(1.0f, (true ? 0.0f : one))) != 2.0f)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a096be9109 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float one = 0.0f; + one = 1.0f; + float const x_21 = one; + if ((dot(float2(2.0f, 1.0f), float2(1.0f, select(x_21, 0.0f, true))) != 2.0f)) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..0e37e00e86 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %one "one" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %14 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %v2float = OpTypeVector %float 2 + %float_2 = OpConstant %float 2 + %20 = OpConstantComposite %v2float %float_2 %float_1 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_0 = OpConstant %float 0 + %30 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %32 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %one = OpVariable %_ptr_Function_float Function %14 + OpStore %one %float_1 + %16 = OpLoad %float %one + %21 = OpSelect %float %true %float_0 %16 + %25 = OpCompositeConstruct %v2float %float_1 %21 + %17 = OpDot %float %20 %25 + %26 = OpFOrdNotEqual %bool %17 %float_2 + OpSelectionMerge %27 None + OpBranchConditional %26 %28 %29 + %28 = OpLabel + OpStore %x_GLF_color %30 + OpBranch %27 + %29 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %32 +%tint_symbol = OpFunctionParameter %main_out + %36 = OpLabel + %37 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %37 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %39 = OpLabel + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %x_GLF_color + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_2 %43 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..2617e9c1e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var one : f32; + one = 1.0; + let x_21 : f32 = one; + if ((dot(vec2(2.0, 1.0), vec2(1.0, select(x_21, 0.0, true))) != 2.0)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl new file mode 100644 index 0000000000..2617e9c1e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var one : f32; + one = 1.0; + let x_21 : f32 = one; + if ((dot(vec2(2.0, 1.0), vec2(1.0, select(x_21, 0.0, true))) != 2.0)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..5c12f10650 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float one = 0.0f; + one = 1.0f; + if ((dot(float2(2.0f, 1.0f), float2(1.0f, (true ? 0.0f : one))) != 2.0f)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a096be9109 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float one = 0.0f; + one = 1.0f; + float const x_21 = one; + if ((dot(float2(2.0f, 1.0f), float2(1.0f, select(x_21, 0.0f, true))) != 2.0f)) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..0e37e00e86 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %one "one" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %14 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %v2float = OpTypeVector %float 2 + %float_2 = OpConstant %float 2 + %20 = OpConstantComposite %v2float %float_2 %float_1 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_0 = OpConstant %float 0 + %30 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %32 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %one = OpVariable %_ptr_Function_float Function %14 + OpStore %one %float_1 + %16 = OpLoad %float %one + %21 = OpSelect %float %true %float_0 %16 + %25 = OpCompositeConstruct %v2float %float_1 %21 + %17 = OpDot %float %20 %25 + %26 = OpFOrdNotEqual %bool %17 %float_2 + OpSelectionMerge %27 None + OpBranchConditional %26 %28 %29 + %28 = OpLabel + OpStore %x_GLF_color %30 + OpBranch %27 + %29 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %32 +%tint_symbol = OpFunctionParameter %main_out + %36 = OpLabel + %37 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %37 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %39 = OpLabel + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %x_GLF_color + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_2 %43 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..2617e9c1e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-dot-condition-true/0-opt.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var one : f32; + one = 1.0; + let x_21 : f32 = one; + if ((dot(vec2(2.0, 1.0), vec2(1.0, select(x_21, 0.0, true))) != 2.0)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm new file mode 100644 index 0000000000..82fac2245b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm @@ -0,0 +1,62 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_3 = OpConstant %float 3 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %26 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %29 = OpLoad %float %28 + %30 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %31 = OpLoad %float %30 + %32 = OpFAdd %float %float_2 %31 + %33 = OpExtInst %float %1 FClamp %29 %float_1 %32 + %34 = OpFOrdGreaterThanEqual %bool %float_3 %33 + OpSelectionMerge %35 None + OpBranchConditional %34 %36 %37 + %36 = OpLabel + OpStore %_GLF_color %25 + OpBranch %35 + %37 = OpLabel + OpStore %_GLF_color %26 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..1ca0a6909c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.hlsl @@ -0,0 +1,35 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_29 = gl_FragCoord.x; + const float x_31 = asfloat(x_6[0].x); + if ((3.0f >= clamp(x_29, 1.0f, (2.0f + x_31)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.msl new file mode 100644 index 0000000000..6dd8555503 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_29 = (*(tint_symbol_5)).x; + float const x_31 = x_6.one; + if ((3.0f >= clamp(x_29, 1.0f, (2.0f + x_31)))) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..b16c6e25a1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %28 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_3 = OpConstant %float 3 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %40 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %21 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %22 = OpLoad %float %21 + %24 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %25 = OpLoad %float %24 + %31 = OpFAdd %float %float_2 %25 + %27 = OpExtInst %float %28 NClamp %22 %float_1 %31 + %32 = OpFOrdGreaterThanEqual %bool %float_3 %27 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + OpStore %x_GLF_color %38 + OpBranch %34 + %36 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %40 +%tint_symbol_1 = OpFunctionParameter %main_out + %44 = OpLabel + %45 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %45 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %47 = OpLabel + %48 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %48 + %49 = OpFunctionCall %void %main_1 + %51 = OpLoad %v4float %x_GLF_color + %52 = OpCompositeConstruct %main_out %51 + %50 = OpFunctionCall %void %tint_symbol_3 %52 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..12d7ca40e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.spvasm.expected.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_29 : f32 = gl_FragCoord.x; + let x_31 : f32 = x_6.one; + if ((3.0 >= clamp(x_29, 1.0, (2.0 + x_31)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl new file mode 100644 index 0000000000..12d7ca40e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_29 : f32 = gl_FragCoord.x; + let x_31 : f32 = x_6.one; + if ((3.0 >= clamp(x_29, 1.0, (2.0 + x_31)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..1ca0a6909c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_29 = gl_FragCoord.x; + const float x_31 = asfloat(x_6[0].x); + if ((3.0f >= clamp(x_29, 1.0f, (2.0f + x_31)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.msl new file mode 100644 index 0000000000..6dd8555503 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_29 = (*(tint_symbol_5)).x; + float const x_31 = x_6.one; + if ((3.0f >= clamp(x_29, 1.0f, (2.0f + x_31)))) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..b16c6e25a1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %28 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_3 = OpConstant %float 3 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %40 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %21 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %22 = OpLoad %float %21 + %24 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %25 = OpLoad %float %24 + %31 = OpFAdd %float %float_2 %25 + %27 = OpExtInst %float %28 NClamp %22 %float_1 %31 + %32 = OpFOrdGreaterThanEqual %bool %float_3 %27 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + OpStore %x_GLF_color %38 + OpBranch %34 + %36 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %40 +%tint_symbol_1 = OpFunctionParameter %main_out + %44 = OpLabel + %45 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %45 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %47 = OpLabel + %48 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %48 + %49 = OpFunctionCall %void %main_1 + %51 = OpLoad %v4float %x_GLF_color + %52 = OpCompositeConstruct %main_out %51 + %50 = OpFunctionCall %void %tint_symbol_3 %52 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..12d7ca40e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-gte-const-first/0.wgsl.expected.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_29 : f32 = gl_FragCoord.x; + let x_31 : f32 = x_6.one; + if ((3.0 >= clamp(x_29, 1.0, (2.0 + x_31)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm new file mode 100644 index 0000000000..a02f599686 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm @@ -0,0 +1,133 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %highSigned "highSigned" + OpName %highUnsigned "highUnsigned" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %data "data" + OpName %i_0 "i" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 + %uint_10 = OpConstant %uint 10 + %int_6 = OpConstant %int 6 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %35 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %36 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %12 + %37 = OpLabel + %highSigned = OpVariable %_ptr_Function_int Function +%highUnsigned = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_int Function + %data = OpVariable %_ptr_Function__arr_int_uint_2 Function + %i_0 = OpVariable %_ptr_Function_uint Function + OpStore %highSigned %int_1 + OpStore %highUnsigned %uint_2 + OpStore %i %int_0 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %int %i + %43 = OpLoad %int %highSigned + %44 = OpExtInst %int %1 SMin %int_10 %43 + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %46 = OpLoad %int %45 + %47 = OpIAdd %int %44 %46 + %48 = OpSLessThan %bool %42 %47 + OpBranchConditional %48 %49 %39 + %49 = OpLabel + %50 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Function_int %data %50 + OpStore %51 %int_5 + OpBranch %40 + %40 = OpLabel + %52 = OpLoad %int %i + %53 = OpIAdd %int %52 %int_1 + OpStore %i %53 + OpBranch %38 + %39 = OpLabel + OpStore %i_0 %uint_1 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %uint %i_0 + %59 = OpLoad %uint %highUnsigned + %60 = OpExtInst %uint %1 UMin %uint_10 %59 + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %62 = OpLoad %int %61 + %63 = OpBitcast %uint %62 + %64 = OpIAdd %uint %60 %63 + %65 = OpULessThan %bool %58 %64 + OpBranchConditional %65 %66 %55 + %66 = OpLabel + %67 = OpLoad %uint %i_0 + %68 = OpAccessChain %_ptr_Function_int %data %67 + OpStore %68 %int_6 + OpBranch %56 + %56 = OpLabel + %69 = OpLoad %uint %i_0 + %70 = OpIAdd %uint %69 %int_1 + OpStore %i_0 %70 + OpBranch %54 + %55 = OpLabel + %71 = OpAccessChain %_ptr_Function_int %data %int_0 + %72 = OpLoad %int %71 + %73 = OpIEqual %bool %72 %int_5 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %74 + %75 = OpLabel + %76 = OpAccessChain %_ptr_Function_int %data %int_1 + %77 = OpLoad %int %76 + %78 = OpIEqual %bool %77 %int_6 + OpBranch %74 + %74 = OpLabel + %79 = OpPhi %bool %73 %55 %78 %75 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + OpStore %_GLF_color %35 + OpBranch %80 + %82 = OpLabel + OpStore %_GLF_color %36 + OpBranch %80 + %80 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..fa2f46040e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.hlsl @@ -0,0 +1,72 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int highSigned = 0; + uint highUnsigned = 0u; + int i = 0; + int data[2] = (int[2])0; + uint i_1 = 0u; + bool x_78 = false; + bool x_79_phi = false; + highSigned = 1; + highUnsigned = 2u; + i = 0; + while (true) { + const int x_42 = i; + const int x_43 = highSigned; + const int x_46 = asint(x_8[0].x); + if ((x_42 < (min(10, x_43) + x_46))) { + } else { + break; + } + data[i] = 5; + { + i = (i + 1); + } + } + i_1 = 1u; + while (true) { + const uint x_58 = i_1; + const uint x_59 = highUnsigned; + const int x_62 = asint(x_8[0].x); + if ((x_58 < (min(10u, x_59) + asuint(x_62)))) { + } else { + break; + } + data[i_1] = 6; + { + i_1 = (i_1 + asuint(1)); + } + } + const int x_72 = data[0]; + const bool x_73 = (x_72 == 5); + x_79_phi = x_73; + if (x_73) { + const int x_77 = data[1]; + x_78 = (x_77 == 6); + x_79_phi = x_78; + } + if (x_79_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b29ecd097e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct tint_array_wrapper { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + int highSigned = 0; + uint highUnsigned = 0u; + int i = 0; + tint_array_wrapper data = {}; + uint i_1 = 0u; + bool x_78 = false; + bool x_79_phi = false; + highSigned = 1; + highUnsigned = 2u; + i = 0; + while (true) { + int const x_42 = i; + int const x_43 = highSigned; + int const x_46 = x_8.zero; + if ((x_42 < (min(10, x_43) + x_46))) { + } else { + break; + } + int const x_50 = i; + data.arr[x_50] = 5; + { + int const x_52 = i; + i = (x_52 + 1); + } + } + i_1 = 1u; + while (true) { + uint const x_58 = i_1; + uint const x_59 = highUnsigned; + int const x_62 = x_8.zero; + if ((x_58 < (min(10u, x_59) + as_type(x_62)))) { + } else { + break; + } + uint const x_67 = i_1; + data.arr[x_67] = 6; + { + uint const x_69 = i_1; + i_1 = (x_69 + as_type(1)); + } + } + int const x_72 = data.arr[0]; + bool const x_73 = (x_72 == 5); + x_79_phi = x_73; + if (x_73) { + int const x_77 = data.arr[1]; + x_78 = (x_77 == 6); + x_79_phi = x_78; + } + bool const x_79 = x_79_phi; + if (x_79) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..1144dfa548 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.spvasm @@ -0,0 +1,191 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + %48 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %highSigned "highSigned" + OpName %highUnsigned "highUnsigned" + OpName %i "i" + OpName %data "data" + OpName %i_1 "i_1" + OpName %x_78 "x_78" + OpName %x_79_phi "x_79_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %22 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %28 = OpConstantNull %_arr_int_uint_2 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %33 = OpConstantNull %bool + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_10 = OpConstant %int 10 + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 + %uint_10 = OpConstant %uint 10 + %int_6 = OpConstant %int 6 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %98 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %99 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %100 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %highSigned = OpVariable %_ptr_Function_int Function %18 +%highUnsigned = OpVariable %_ptr_Function_uint Function %22 + %i = OpVariable %_ptr_Function_int Function %18 + %data = OpVariable %_ptr_Function__arr_int_uint_2 Function %28 + %i_1 = OpVariable %_ptr_Function_uint Function %22 + %x_78 = OpVariable %_ptr_Function_bool Function %33 + %x_79_phi = OpVariable %_ptr_Function_bool Function %33 + OpStore %highSigned %int_1 + OpStore %highUnsigned %uint_2 + OpStore %i %int_0 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %int %i + %42 = OpLoad %int %highSigned + %45 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %46 = OpLoad %int %45 + %47 = OpExtInst %int %48 SMin %int_10 %42 + %50 = OpIAdd %int %47 %46 + %51 = OpSLessThan %bool %41 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %38 + %52 = OpLabel + %55 = OpLoad %int %i + %56 = OpAccessChain %_ptr_Function_int %data %55 + OpStore %56 %int_5 + OpBranch %39 + %39 = OpLabel + %58 = OpLoad %int %i + %59 = OpIAdd %int %58 %int_1 + OpStore %i %59 + OpBranch %37 + %38 = OpLabel + OpStore %i_1 %uint_1 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %uint %i_1 + %66 = OpLoad %uint %highUnsigned + %67 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %68 = OpLoad %int %67 + %69 = OpExtInst %uint %48 UMin %uint_10 %66 + %71 = OpBitcast %uint %68 + %72 = OpIAdd %uint %69 %71 + %73 = OpULessThan %bool %65 %72 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %74 + %76 = OpLabel + OpBranch %62 + %74 = OpLabel + %77 = OpLoad %uint %i_1 + %78 = OpAccessChain %_ptr_Function_int %data %77 + OpStore %78 %int_6 + OpBranch %63 + %63 = OpLabel + %80 = OpLoad %uint %i_1 + %81 = OpBitcast %uint %int_1 + %82 = OpIAdd %uint %80 %81 + OpStore %i_1 %82 + OpBranch %61 + %62 = OpLabel + %83 = OpAccessChain %_ptr_Function_int %data %int_0 + %84 = OpLoad %int %83 + %85 = OpIEqual %bool %84 %int_5 + OpStore %x_79_phi %85 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpAccessChain %_ptr_Function_int %data %int_1 + %89 = OpLoad %int %88 + %90 = OpIEqual %bool %89 %int_6 + OpStore %x_78 %90 + %91 = OpLoad %bool %x_78 + OpStore %x_79_phi %91 + OpBranch %86 + %86 = OpLabel + %92 = OpLoad %bool %x_79_phi + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + OpStore %x_GLF_color %98 + OpBranch %93 + %95 = OpLabel + OpStore %x_GLF_color %99 + OpBranch %93 + %93 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %100 +%tint_symbol = OpFunctionParameter %main_out + %104 = OpLabel + %105 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %105 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %107 = OpLabel + %108 = OpFunctionCall %void %main_1 + %110 = OpLoad %v4float %x_GLF_color + %111 = OpCompositeConstruct %main_out %110 + %109 = OpFunctionCall %void %tint_symbol_2 %111 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..1ba10ec2fc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.spvasm.expected.wgsl @@ -0,0 +1,80 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var highSigned : i32; + var highUnsigned : u32; + var i : i32; + var data : array; + var i_1 : u32; + var x_78 : bool; + var x_79_phi : bool; + highSigned = 1; + highUnsigned = 2u; + i = 0; + loop { + let x_42 : i32 = i; + let x_43 : i32 = highSigned; + let x_46 : i32 = x_8.zero; + if ((x_42 < (min(10, x_43) + x_46))) { + } else { + break; + } + let x_50 : i32 = i; + data[x_50] = 5; + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + i_1 = 1u; + loop { + let x_58 : u32 = i_1; + let x_59 : u32 = highUnsigned; + let x_62 : i32 = x_8.zero; + if ((x_58 < (min(10u, x_59) + bitcast(x_62)))) { + } else { + break; + } + let x_67 : u32 = i_1; + data[x_67] = 6; + + continuing { + let x_69 : u32 = i_1; + i_1 = (x_69 + bitcast(1)); + } + } + let x_72 : i32 = data[0]; + let x_73 : bool = (x_72 == 5); + x_79_phi = x_73; + if (x_73) { + let x_77 : i32 = data[1]; + x_78 = (x_77 == 6); + x_79_phi = x_78; + } + let x_79 : bool = x_79_phi; + if (x_79) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl new file mode 100644 index 0000000000..1ba10ec2fc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl @@ -0,0 +1,80 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var highSigned : i32; + var highUnsigned : u32; + var i : i32; + var data : array; + var i_1 : u32; + var x_78 : bool; + var x_79_phi : bool; + highSigned = 1; + highUnsigned = 2u; + i = 0; + loop { + let x_42 : i32 = i; + let x_43 : i32 = highSigned; + let x_46 : i32 = x_8.zero; + if ((x_42 < (min(10, x_43) + x_46))) { + } else { + break; + } + let x_50 : i32 = i; + data[x_50] = 5; + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + i_1 = 1u; + loop { + let x_58 : u32 = i_1; + let x_59 : u32 = highUnsigned; + let x_62 : i32 = x_8.zero; + if ((x_58 < (min(10u, x_59) + bitcast(x_62)))) { + } else { + break; + } + let x_67 : u32 = i_1; + data[x_67] = 6; + + continuing { + let x_69 : u32 = i_1; + i_1 = (x_69 + bitcast(1)); + } + } + let x_72 : i32 = data[0]; + let x_73 : bool = (x_72 == 5); + x_79_phi = x_73; + if (x_73) { + let x_77 : i32 = data[1]; + x_78 = (x_77 == 6); + x_79_phi = x_78; + } + let x_79 : bool = x_79_phi; + if (x_79) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..fa2f46040e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.hlsl @@ -0,0 +1,72 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int highSigned = 0; + uint highUnsigned = 0u; + int i = 0; + int data[2] = (int[2])0; + uint i_1 = 0u; + bool x_78 = false; + bool x_79_phi = false; + highSigned = 1; + highUnsigned = 2u; + i = 0; + while (true) { + const int x_42 = i; + const int x_43 = highSigned; + const int x_46 = asint(x_8[0].x); + if ((x_42 < (min(10, x_43) + x_46))) { + } else { + break; + } + data[i] = 5; + { + i = (i + 1); + } + } + i_1 = 1u; + while (true) { + const uint x_58 = i_1; + const uint x_59 = highUnsigned; + const int x_62 = asint(x_8[0].x); + if ((x_58 < (min(10u, x_59) + asuint(x_62)))) { + } else { + break; + } + data[i_1] = 6; + { + i_1 = (i_1 + asuint(1)); + } + } + const int x_72 = data[0]; + const bool x_73 = (x_72 == 5); + x_79_phi = x_73; + if (x_73) { + const int x_77 = data[1]; + x_78 = (x_77 == 6); + x_79_phi = x_78; + } + if (x_79_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b29ecd097e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct tint_array_wrapper { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + int highSigned = 0; + uint highUnsigned = 0u; + int i = 0; + tint_array_wrapper data = {}; + uint i_1 = 0u; + bool x_78 = false; + bool x_79_phi = false; + highSigned = 1; + highUnsigned = 2u; + i = 0; + while (true) { + int const x_42 = i; + int const x_43 = highSigned; + int const x_46 = x_8.zero; + if ((x_42 < (min(10, x_43) + x_46))) { + } else { + break; + } + int const x_50 = i; + data.arr[x_50] = 5; + { + int const x_52 = i; + i = (x_52 + 1); + } + } + i_1 = 1u; + while (true) { + uint const x_58 = i_1; + uint const x_59 = highUnsigned; + int const x_62 = x_8.zero; + if ((x_58 < (min(10u, x_59) + as_type(x_62)))) { + } else { + break; + } + uint const x_67 = i_1; + data.arr[x_67] = 6; + { + uint const x_69 = i_1; + i_1 = (x_69 + as_type(1)); + } + } + int const x_72 = data.arr[0]; + bool const x_73 = (x_72 == 5); + x_79_phi = x_73; + if (x_73) { + int const x_77 = data.arr[1]; + x_78 = (x_77 == 6); + x_79_phi = x_78; + } + bool const x_79 = x_79_phi; + if (x_79) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..1144dfa548 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.spvasm @@ -0,0 +1,191 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + %48 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %highSigned "highSigned" + OpName %highUnsigned "highUnsigned" + OpName %i "i" + OpName %data "data" + OpName %i_1 "i_1" + OpName %x_78 "x_78" + OpName %x_79_phi "x_79_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %22 = OpConstantNull %uint + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %28 = OpConstantNull %_arr_int_uint_2 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %33 = OpConstantNull %bool + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_10 = OpConstant %int 10 + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 + %uint_10 = OpConstant %uint 10 + %int_6 = OpConstant %int 6 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %98 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %99 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %100 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %highSigned = OpVariable %_ptr_Function_int Function %18 +%highUnsigned = OpVariable %_ptr_Function_uint Function %22 + %i = OpVariable %_ptr_Function_int Function %18 + %data = OpVariable %_ptr_Function__arr_int_uint_2 Function %28 + %i_1 = OpVariable %_ptr_Function_uint Function %22 + %x_78 = OpVariable %_ptr_Function_bool Function %33 + %x_79_phi = OpVariable %_ptr_Function_bool Function %33 + OpStore %highSigned %int_1 + OpStore %highUnsigned %uint_2 + OpStore %i %int_0 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %int %i + %42 = OpLoad %int %highSigned + %45 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %46 = OpLoad %int %45 + %47 = OpExtInst %int %48 SMin %int_10 %42 + %50 = OpIAdd %int %47 %46 + %51 = OpSLessThan %bool %41 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %38 + %52 = OpLabel + %55 = OpLoad %int %i + %56 = OpAccessChain %_ptr_Function_int %data %55 + OpStore %56 %int_5 + OpBranch %39 + %39 = OpLabel + %58 = OpLoad %int %i + %59 = OpIAdd %int %58 %int_1 + OpStore %i %59 + OpBranch %37 + %38 = OpLabel + OpStore %i_1 %uint_1 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %uint %i_1 + %66 = OpLoad %uint %highUnsigned + %67 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %68 = OpLoad %int %67 + %69 = OpExtInst %uint %48 UMin %uint_10 %66 + %71 = OpBitcast %uint %68 + %72 = OpIAdd %uint %69 %71 + %73 = OpULessThan %bool %65 %72 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %74 + %76 = OpLabel + OpBranch %62 + %74 = OpLabel + %77 = OpLoad %uint %i_1 + %78 = OpAccessChain %_ptr_Function_int %data %77 + OpStore %78 %int_6 + OpBranch %63 + %63 = OpLabel + %80 = OpLoad %uint %i_1 + %81 = OpBitcast %uint %int_1 + %82 = OpIAdd %uint %80 %81 + OpStore %i_1 %82 + OpBranch %61 + %62 = OpLabel + %83 = OpAccessChain %_ptr_Function_int %data %int_0 + %84 = OpLoad %int %83 + %85 = OpIEqual %bool %84 %int_5 + OpStore %x_79_phi %85 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpAccessChain %_ptr_Function_int %data %int_1 + %89 = OpLoad %int %88 + %90 = OpIEqual %bool %89 %int_6 + OpStore %x_78 %90 + %91 = OpLoad %bool %x_78 + OpStore %x_79_phi %91 + OpBranch %86 + %86 = OpLabel + %92 = OpLoad %bool %x_79_phi + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + OpStore %x_GLF_color %98 + OpBranch %93 + %95 = OpLabel + OpStore %x_GLF_color %99 + OpBranch %93 + %93 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %100 +%tint_symbol = OpFunctionParameter %main_out + %104 = OpLabel + %105 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %105 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %107 = OpLabel + %108 = OpFunctionCall %void %main_1 + %110 = OpLoad %v4float %x_GLF_color + %111 = OpCompositeConstruct %main_out %110 + %109 = OpFunctionCall %void %tint_symbol_2 %111 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..1ba10ec2fc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-min-as-loop-range/0-opt.wgsl.expected.wgsl @@ -0,0 +1,80 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var highSigned : i32; + var highUnsigned : u32; + var i : i32; + var data : array; + var i_1 : u32; + var x_78 : bool; + var x_79_phi : bool; + highSigned = 1; + highUnsigned = 2u; + i = 0; + loop { + let x_42 : i32 = i; + let x_43 : i32 = highSigned; + let x_46 : i32 = x_8.zero; + if ((x_42 < (min(10, x_43) + x_46))) { + } else { + break; + } + let x_50 : i32 = i; + data[x_50] = 5; + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + i_1 = 1u; + loop { + let x_58 : u32 = i_1; + let x_59 : u32 = highUnsigned; + let x_62 : i32 = x_8.zero; + if ((x_58 < (min(10u, x_59) + bitcast(x_62)))) { + } else { + break; + } + let x_67 : u32 = i_1; + data[x_67] = 6; + + continuing { + let x_69 : u32 = i_1; + i_1 = (x_69 + bitcast(1)); + } + } + let x_72 : i32 = data[0]; + let x_73 : bool = (x_72 == 5); + x_79_phi = x_73; + if (x_73) { + let x_77 : i32 = data[1]; + x_78 = (x_77 == 6); + x_79_phi = x_78; + } + let x_79 : bool = x_79_phi; + if (x_79) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm new file mode 100644 index 0000000000..ffceb4ba2e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm @@ -0,0 +1,65 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %8 + %22 = OpLabel + %23 = OpFMod %float %float_1 %float_1 + %24 = OpFOrdLessThanEqual %bool %23 %float_0_00999999978 + OpSelectionMerge %25 None + OpBranchConditional %24 %26 %27 + %26 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %29 = OpLoad %int %28 + %30 = OpConvertSToF %float %29 + %31 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %32 = OpLoad %int %31 + %33 = OpConvertSToF %float %32 + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %35 = OpLoad %int %34 + %36 = OpConvertSToF %float %35 + %37 = OpCompositeConstruct %v4float %float_1 %30 %33 %36 + OpStore %_GLF_color %37 + OpBranch %25 + %27 = OpLabel + %38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpConvertSToF %float %39 + %41 = OpCompositeConstruct %v4float %40 %40 %40 %40 + OpStore %_GLF_color %41 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..4cb3c1421e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.hlsl @@ -0,0 +1,35 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; + +void main_1() { + if (((1.0f % 1.0f) <= 0.01f)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_32 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_35 = asint(x_5[1].x); + x_GLF_color = float4(1.0f, float(x_29), float(x_32), float(x_35)); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_39 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_40 = float(x_39); + x_GLF_color = float4(x_40, x_40, x_40, x_40); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.msl new file mode 100755 index 0000000000..e2d1f94a1d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.msl @@ -0,0 +1,49 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + if (((1.0f % 1.0f) <= 0.01f)) { + int const x_29 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_32 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_35 = x_5.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(1.0f, float(x_29), float(x_32), float(x_35)); + } else { + int const x_39 = x_5.x_GLF_uniform_int_values.arr[0].el; + float const x_40 = float(x_39); + *(tint_symbol_4) = float4(x_40, x_40, x_40, x_40); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +T:\tmp\u8zg.0.metal:22:14: error: invalid operands to binary expression ('float' and 'float') + if (((1.0f % 1.0f) <= 0.01f)) { + ~~~~ ^ ~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..1f5950385c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %45 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %20 = OpFMod %float %float_1 %float_1 + %22 = OpFOrdLessThanEqual %bool %20 %float_0_00999999978 + OpSelectionMerge %24 None + OpBranchConditional %22 %25 %26 + %25 = OpLabel + %30 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %33 = OpLoad %int %32 + %35 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %36 = OpLoad %int %35 + %37 = OpConvertSToF %float %31 + %38 = OpConvertSToF %float %33 + %39 = OpConvertSToF %float %36 + %40 = OpCompositeConstruct %v4float %float_1 %37 %38 %39 + OpStore %x_GLF_color %40 + OpBranch %24 + %26 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %42 = OpLoad %int %41 + %43 = OpConvertSToF %float %42 + %44 = OpCompositeConstruct %v4float %43 %43 %43 %43 + OpStore %x_GLF_color %44 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %45 +%tint_symbol = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %52 = OpLabel + %53 = OpFunctionCall %void %main_1 + %55 = OpLoad %v4float %x_GLF_color + %56 = OpCompositeConstruct %main_out %55 + %54 = OpFunctionCall %void %tint_symbol_2 %56 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..020e0e9aa0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.spvasm.expected.wgsl @@ -0,0 +1,35 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + if (((1.0 % 1.0) <= 0.01)) { + let x_29 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_32 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_35 : i32 = x_5.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(1.0, f32(x_29), f32(x_32), f32(x_35)); + } else { + let x_39 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_40 : f32 = f32(x_39); + x_GLF_color = vec4(x_40, x_40, x_40, x_40); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl new file mode 100644 index 0000000000..020e0e9aa0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl @@ -0,0 +1,35 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + if (((1.0 % 1.0) <= 0.01)) { + let x_29 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_32 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_35 : i32 = x_5.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(1.0, f32(x_29), f32(x_32), f32(x_35)); + } else { + let x_39 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_40 : f32 = f32(x_39); + x_GLF_color = vec4(x_40, x_40, x_40, x_40); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..4cb3c1421e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; + +void main_1() { + if (((1.0f % 1.0f) <= 0.01f)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_32 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_35 = asint(x_5[1].x); + x_GLF_color = float4(1.0f, float(x_29), float(x_32), float(x_35)); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_39 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_40 = float(x_39); + x_GLF_color = float4(x_40, x_40, x_40, x_40); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.msl new file mode 100755 index 0000000000..5e4bde3d10 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.msl @@ -0,0 +1,49 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + if (((1.0f % 1.0f) <= 0.01f)) { + int const x_29 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_32 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_35 = x_5.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(1.0f, float(x_29), float(x_32), float(x_35)); + } else { + int const x_39 = x_5.x_GLF_uniform_int_values.arr[0].el; + float const x_40 = float(x_39); + *(tint_symbol_4) = float4(x_40, x_40, x_40, x_40); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +T:\tmp\u180.0.metal:22:14: error: invalid operands to binary expression ('float' and 'float') + if (((1.0f % 1.0f) <= 0.01f)) { + ~~~~ ^ ~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..1f5950385c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float_1 = OpConstant %float 1 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %45 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %20 = OpFMod %float %float_1 %float_1 + %22 = OpFOrdLessThanEqual %bool %20 %float_0_00999999978 + OpSelectionMerge %24 None + OpBranchConditional %22 %25 %26 + %25 = OpLabel + %30 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %33 = OpLoad %int %32 + %35 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %36 = OpLoad %int %35 + %37 = OpConvertSToF %float %31 + %38 = OpConvertSToF %float %33 + %39 = OpConvertSToF %float %36 + %40 = OpCompositeConstruct %v4float %float_1 %37 %38 %39 + OpStore %x_GLF_color %40 + OpBranch %24 + %26 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %42 = OpLoad %int %41 + %43 = OpConvertSToF %float %42 + %44 = OpCompositeConstruct %v4float %43 %43 %43 %43 + OpStore %x_GLF_color %44 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %45 +%tint_symbol = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %52 = OpLabel + %53 = OpFunctionCall %void %main_1 + %55 = OpLoad %v4float %x_GLF_color + %56 = OpCompositeConstruct %main_out %55 + %54 = OpFunctionCall %void %tint_symbol_2 %56 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..020e0e9aa0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-mod-one-one-lte/0-opt.wgsl.expected.wgsl @@ -0,0 +1,35 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + if (((1.0 % 1.0) <= 0.01)) { + let x_29 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_32 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_35 : i32 = x_5.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(1.0, f32(x_29), f32(x_32), f32(x_35)); + } else { + let x_39 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_40 : f32 = f32(x_39); + x_GLF_color = vec4(x_40, x_40, x_40, x_40); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm new file mode 100644 index 0000000000..78defc8414 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm @@ -0,0 +1,106 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_40_3300018 = OpConstant %float 40.3300018 + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %int_98980 = OpConstant %int 98980 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %12 + %31 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %32 = OpExtInst %float %1 Ldexp %float_1 %int_98980 + %33 = OpExtInst %float %1 Pow %float_40_3300018 %32 + OpStore %f %33 + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %35 = OpLoad %int %34 + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %39 = OpLoad %int %38 + %40 = OpIAdd %int %37 %39 + %41 = OpIEqual %bool %35 %40 + %42 = OpLogicalNot %bool %41 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + %45 = OpLoad %float %f + %46 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpFOrdGreaterThan %bool %45 %47 + OpBranch %43 + %43 = OpLabel + %49 = OpPhi %bool %41 %31 %48 %44 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %54 + %56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpConvertSToF %float %63 + %65 = OpCompositeConstruct %v4float %55 %58 %61 %64 + OpStore %_GLF_color %65 + OpBranch %50 + %52 = OpLabel + %66 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %67 + %69 = OpCompositeConstruct %v4float %68 %68 %68 %68 + OpStore %_GLF_color %69 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f6a50e2633 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,56 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + bool x_48 = false; + bool x_49_phi = false; + f = pow(40.330001831f, ldexp(1.0f, 98980)); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_35 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_37 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_39 = asint(x_6[1].x); + const bool x_41 = (x_35 == (x_37 + x_39)); + x_49_phi = x_41; + if (!(x_41)) { + const float x_45 = f; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_48 = (x_45 > x_47); + x_49_phi = x_48; + } + if (x_49_phi) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_57 = asint(x_6[1].x); + const int x_60 = asint(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_63 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_54), float(x_57), float(x_60), float(x_63)); + } else { + const int x_67 = asint(x_6[1].x); + const float x_68 = float(x_67); + x_GLF_color = float4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b0caa47c70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.msl @@ -0,0 +1,69 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float f = 0.0f; + bool x_48 = false; + bool x_49_phi = false; + f = pow(40.330001831f, ldexp(1.0f, 98980)); + int const x_35 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_39 = x_6.x_GLF_uniform_int_values.arr[1].el; + bool const x_41 = (x_35 == (x_37 + x_39)); + x_49_phi = x_41; + if (!(x_41)) { + float const x_45 = f; + float const x_47 = x_8.x_GLF_uniform_float_values.arr[0].el; + x_48 = (x_45 > x_47); + x_49_phi = x_48; + } + bool const x_49 = x_49_phi; + if (x_49) { + int const x_54 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_57 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_54), float(x_57), float(x_60), float(x_63)); + } else { + int const x_67 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_68 = float(x_67); + *(tint_symbol_4) = float4(x_68, x_68, x_68, x_68); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..fc4fc1945e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,151 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + %33 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %x_48 "x_48" + OpName %x_49_phi "x_49_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %30 = OpConstantNull %bool +%float_40_3300018 = OpConstant %float 40.3300018 + %float_1 = OpConstant %float 1 + %int_98980 = OpConstant %int 98980 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %f = OpVariable %_ptr_Function_float Function %26 + %x_48 = OpVariable %_ptr_Function_bool Function %30 + %x_49_phi = OpVariable %_ptr_Function_bool Function %30 + %35 = OpExtInst %float %33 Ldexp %float_1 %int_98980 + %32 = OpExtInst %float %33 Pow %float_40_3300018 %35 + OpStore %f %32 + %41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %42 = OpLoad %int %41 + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %44 = OpLoad %int %43 + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpIAdd %int %44 %47 + %49 = OpIEqual %bool %42 %48 + OpStore %x_49_phi %49 + %50 = OpLogicalNot %bool %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %53 = OpLoad %float %f + %55 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %56 = OpLoad %float %55 + %57 = OpFOrdGreaterThan %bool %53 %56 + OpStore %x_48 %57 + %58 = OpLoad %bool %x_48 + OpStore %x_49_phi %58 + OpBranch %51 + %51 = OpLabel + %59 = OpLoad %bool %x_49_phi + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %64 + %72 = OpConvertSToF %float %66 + %73 = OpConvertSToF %float %68 + %74 = OpConvertSToF %float %70 + %75 = OpCompositeConstruct %v4float %71 %72 %73 %74 + OpStore %x_GLF_color %75 + OpBranch %60 + %62 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpCompositeConstruct %v4float %78 %78 %78 %78 + OpStore %x_GLF_color %79 + OpBranch %60 + %60 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %80 +%tint_symbol = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %87 = OpLabel + %88 = OpFunctionCall %void %main_1 + %90 = OpLoad %v4float %x_GLF_color + %91 = OpCompositeConstruct %main_out %90 + %89 = OpFunctionCall %void %tint_symbol_2 %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5f17cf5ccd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,61 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var x_48 : bool; + var x_49_phi : bool; + f = pow(40.330001831, ldexp(1.0, 98980)); + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_41 : bool = (x_35 == (x_37 + x_39)); + x_49_phi = x_41; + if (!(x_41)) { + let x_45 : f32 = f; + let x_47 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_48 = (x_45 > x_47); + x_49_phi = x_48; + } + let x_49 : bool = x_49_phi; + if (x_49) { + let x_54 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_57 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_54), f32(x_57), f32(x_60), f32(x_63)); + } else { + let x_67 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_68 : f32 = f32(x_67); + x_GLF_color = vec4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl new file mode 100644 index 0000000000..5f17cf5ccd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl @@ -0,0 +1,61 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var x_48 : bool; + var x_49_phi : bool; + f = pow(40.330001831, ldexp(1.0, 98980)); + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_41 : bool = (x_35 == (x_37 + x_39)); + x_49_phi = x_41; + if (!(x_41)) { + let x_45 : f32 = f; + let x_47 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_48 = (x_45 > x_47); + x_49_phi = x_48; + } + let x_49 : bool = x_49_phi; + if (x_49) { + let x_54 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_57 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_54), f32(x_57), f32(x_60), f32(x_63)); + } else { + let x_67 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_68 : f32 = f32(x_67); + x_GLF_color = vec4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f6a50e2633 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,56 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + bool x_48 = false; + bool x_49_phi = false; + f = pow(40.330001831f, ldexp(1.0f, 98980)); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_35 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_37 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_39 = asint(x_6[1].x); + const bool x_41 = (x_35 == (x_37 + x_39)); + x_49_phi = x_41; + if (!(x_41)) { + const float x_45 = f; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_48 = (x_45 > x_47); + x_49_phi = x_48; + } + if (x_49_phi) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_57 = asint(x_6[1].x); + const int x_60 = asint(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_63 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_54), float(x_57), float(x_60), float(x_63)); + } else { + const int x_67 = asint(x_6[1].x); + const float x_68 = float(x_67); + x_GLF_color = float4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b0caa47c70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.msl @@ -0,0 +1,69 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float f = 0.0f; + bool x_48 = false; + bool x_49_phi = false; + f = pow(40.330001831f, ldexp(1.0f, 98980)); + int const x_35 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_39 = x_6.x_GLF_uniform_int_values.arr[1].el; + bool const x_41 = (x_35 == (x_37 + x_39)); + x_49_phi = x_41; + if (!(x_41)) { + float const x_45 = f; + float const x_47 = x_8.x_GLF_uniform_float_values.arr[0].el; + x_48 = (x_45 > x_47); + x_49_phi = x_48; + } + bool const x_49 = x_49_phi; + if (x_49) { + int const x_54 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_57 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_54), float(x_57), float(x_60), float(x_63)); + } else { + int const x_67 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_68 = float(x_67); + *(tint_symbol_4) = float4(x_68, x_68, x_68, x_68); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..fc4fc1945e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,151 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + %33 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %x_48 "x_48" + OpName %x_49_phi "x_49_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %30 = OpConstantNull %bool +%float_40_3300018 = OpConstant %float 40.3300018 + %float_1 = OpConstant %float 1 + %int_98980 = OpConstant %int 98980 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %f = OpVariable %_ptr_Function_float Function %26 + %x_48 = OpVariable %_ptr_Function_bool Function %30 + %x_49_phi = OpVariable %_ptr_Function_bool Function %30 + %35 = OpExtInst %float %33 Ldexp %float_1 %int_98980 + %32 = OpExtInst %float %33 Pow %float_40_3300018 %35 + OpStore %f %32 + %41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %42 = OpLoad %int %41 + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %44 = OpLoad %int %43 + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpIAdd %int %44 %47 + %49 = OpIEqual %bool %42 %48 + OpStore %x_49_phi %49 + %50 = OpLogicalNot %bool %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %53 = OpLoad %float %f + %55 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %56 = OpLoad %float %55 + %57 = OpFOrdGreaterThan %bool %53 %56 + OpStore %x_48 %57 + %58 = OpLoad %bool %x_48 + OpStore %x_49_phi %58 + OpBranch %51 + %51 = OpLabel + %59 = OpLoad %bool %x_49_phi + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %64 + %72 = OpConvertSToF %float %66 + %73 = OpConvertSToF %float %68 + %74 = OpConvertSToF %float %70 + %75 = OpCompositeConstruct %v4float %71 %72 %73 %74 + OpStore %x_GLF_color %75 + OpBranch %60 + %62 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpCompositeConstruct %v4float %78 %78 %78 %78 + OpStore %x_GLF_color %79 + OpBranch %60 + %60 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %80 +%tint_symbol = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %87 = OpLabel + %88 = OpFunctionCall %void %main_1 + %90 = OpLoad %v4float %x_GLF_color + %91 = OpCompositeConstruct %main_out %90 + %89 = OpFunctionCall %void %tint_symbol_2 %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5f17cf5ccd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-pow-large-exp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,61 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var x_48 : bool; + var x_49_phi : bool; + f = pow(40.330001831, ldexp(1.0, 98980)); + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_41 : bool = (x_35 == (x_37 + x_39)); + x_49_phi = x_41; + if (!(x_41)) { + let x_45 : f32 = f; + let x_47 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_48 = (x_45 > x_47); + x_49_phi = x_48; + } + let x_49 : bool = x_49_phi; + if (x_49) { + let x_54 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_57 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_54), f32(x_57), f32(x_60), f32(x_63)); + } else { + let x_67 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_68 : f32 = f32(x_67); + x_GLF_color = vec4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm new file mode 100644 index 0000000000..aa75585923 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm @@ -0,0 +1,83 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %bool = OpTypeBool + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %20 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %7 + %21 = OpLabel + OpStore %_GLF_color %12 + %22 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %23 = OpLoad %float %22 + %24 = OpFOrdLessThan %bool %23 %float_0 + %25 = OpLogicalNot %bool %24 + OpSelectionMerge %26 None + OpBranchConditional %25 %27 %26 + %27 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %29 = OpLoad %float %28 + %30 = OpFOrdLessThan %bool %29 %float_1 + OpBranch %26 + %26 = OpLabel + %31 = OpPhi %bool %24 %21 %30 %27 + OpSelectionMerge %32 None + OpBranchConditional %31 %33 %32 + %33 = OpLabel + OpReturn + %32 = OpLabel + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %35 = OpLoad %float %34 + %36 = OpFOrdLessThan %bool %35 %float_0 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %45 = OpLoad %float %44 + %46 = OpFOrdLessThan %bool %45 %float_0 + OpBranchConditional %46 %47 %41 + %47 = OpLabel + OpStore %_GLF_color %19 + OpBranch %41 + %42 = OpLabel + OpBranch %40 + %41 = OpLabel + OpBranch %37 + %39 = OpLabel + OpStore %_GLF_color %20 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..40ad3c75a3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.hlsl @@ -0,0 +1,50 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + bool x_30 = false; + bool x_31_phi = false; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_23 = asfloat(x_5[0].x); + const bool x_24 = (x_23 < 0.0f); + x_31_phi = x_24; + if (!(x_24)) { + const float x_29 = asfloat(x_5[0].x); + x_30 = (x_29 < 1.0f); + x_31_phi = x_30; + } + if (x_31_phi) { + return; + } + const float x_35 = asfloat(x_5[0].x); + if ((x_35 < 0.0f)) { + while (true) { + const float x_45 = asfloat(x_5[0].x); + if ((x_45 < 0.0f)) { + } else { + break; + } + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + break; + } + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..526a97587d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + bool x_30 = false; + bool x_31_phi = false; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + float const x_23 = x_5.one; + bool const x_24 = (x_23 < 0.0f); + x_31_phi = x_24; + if (!(x_24)) { + float const x_29 = x_5.one; + x_30 = (x_29 < 1.0f); + x_31_phi = x_30; + } + bool const x_31 = x_31_phi; + if (x_31) { + return; + } + float const x_35 = x_5.one; + if ((x_35 < 0.0f)) { + while (true) { + float const x_45 = x_5.one; + if ((x_45 < 0.0f)) { + } else { + break; + } + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + break; + } + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..ed5bd9f2b7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_30 "x_30" + OpName %x_31_phi "x_31_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %18 = OpConstantNull %bool + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %55 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %56 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %57 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_30 = OpVariable %_ptr_Function_bool Function %18 + %x_31_phi = OpVariable %_ptr_Function_bool Function %18 + OpStore %x_GLF_color %21 + %25 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %26 = OpLoad %float %25 + %27 = OpFOrdLessThan %bool %26 %float_0 + OpStore %x_31_phi %27 + %28 = OpLogicalNot %bool %27 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %29 + %30 = OpLabel + %31 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %32 = OpLoad %float %31 + %34 = OpFOrdLessThan %bool %32 %float_1 + OpStore %x_30 %34 + %35 = OpLoad %bool %x_30 + OpStore %x_31_phi %35 + OpBranch %29 + %29 = OpLabel + %36 = OpLoad %bool %x_31_phi + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + OpReturn + %37 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %40 = OpLoad %float %39 + %41 = OpFOrdLessThan %bool %40 %float_0 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %44 + %43 = OpLabel + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %50 = OpLoad %float %49 + %51 = OpFOrdLessThan %bool %50 %float_0 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %46 + %52 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %46 + %47 = OpLabel + OpBranch %45 + %46 = OpLabel + OpBranch %42 + %44 = OpLabel + OpStore %x_GLF_color %56 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %57 +%tint_symbol = OpFunctionParameter %main_out + %61 = OpLabel + %62 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %62 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %64 = OpLabel + %65 = OpFunctionCall %void %main_1 + %67 = OpLoad %v4float %x_GLF_color + %68 = OpCompositeConstruct %main_out %67 + %66 = OpFunctionCall %void %tint_symbol_2 %68 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c41a337005 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.spvasm.expected.wgsl @@ -0,0 +1,52 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_30 : bool; + var x_31_phi : bool; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_23 : f32 = x_5.one; + let x_24 : bool = (x_23 < 0.0); + x_31_phi = x_24; + if (!(x_24)) { + let x_29 : f32 = x_5.one; + x_30 = (x_29 < 1.0); + x_31_phi = x_30; + } + let x_31 : bool = x_31_phi; + if (x_31) { + return; + } + let x_35 : f32 = x_5.one; + if ((x_35 < 0.0)) { + loop { + let x_45 : f32 = x_5.one; + if ((x_45 < 0.0)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + break; + } + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl new file mode 100644 index 0000000000..c41a337005 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl @@ -0,0 +1,52 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_30 : bool; + var x_31_phi : bool; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_23 : f32 = x_5.one; + let x_24 : bool = (x_23 < 0.0); + x_31_phi = x_24; + if (!(x_24)) { + let x_29 : f32 = x_5.one; + x_30 = (x_29 < 1.0); + x_31_phi = x_30; + } + let x_31 : bool = x_31_phi; + if (x_31) { + return; + } + let x_35 : f32 = x_5.one; + if ((x_35 < 0.0)) { + loop { + let x_45 : f32 = x_5.one; + if ((x_45 < 0.0)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + break; + } + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..40ad3c75a3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.hlsl @@ -0,0 +1,50 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + bool x_30 = false; + bool x_31_phi = false; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_23 = asfloat(x_5[0].x); + const bool x_24 = (x_23 < 0.0f); + x_31_phi = x_24; + if (!(x_24)) { + const float x_29 = asfloat(x_5[0].x); + x_30 = (x_29 < 1.0f); + x_31_phi = x_30; + } + if (x_31_phi) { + return; + } + const float x_35 = asfloat(x_5[0].x); + if ((x_35 < 0.0f)) { + while (true) { + const float x_45 = asfloat(x_5[0].x); + if ((x_45 < 0.0f)) { + } else { + break; + } + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + break; + } + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..526a97587d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + bool x_30 = false; + bool x_31_phi = false; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + float const x_23 = x_5.one; + bool const x_24 = (x_23 < 0.0f); + x_31_phi = x_24; + if (!(x_24)) { + float const x_29 = x_5.one; + x_30 = (x_29 < 1.0f); + x_31_phi = x_30; + } + bool const x_31 = x_31_phi; + if (x_31) { + return; + } + float const x_35 = x_5.one; + if ((x_35 < 0.0f)) { + while (true) { + float const x_45 = x_5.one; + if ((x_45 < 0.0f)) { + } else { + break; + } + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + break; + } + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..ed5bd9f2b7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_30 "x_30" + OpName %x_31_phi "x_31_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %18 = OpConstantNull %bool + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %55 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %56 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %57 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_30 = OpVariable %_ptr_Function_bool Function %18 + %x_31_phi = OpVariable %_ptr_Function_bool Function %18 + OpStore %x_GLF_color %21 + %25 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %26 = OpLoad %float %25 + %27 = OpFOrdLessThan %bool %26 %float_0 + OpStore %x_31_phi %27 + %28 = OpLogicalNot %bool %27 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %29 + %30 = OpLabel + %31 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %32 = OpLoad %float %31 + %34 = OpFOrdLessThan %bool %32 %float_1 + OpStore %x_30 %34 + %35 = OpLoad %bool %x_30 + OpStore %x_31_phi %35 + OpBranch %29 + %29 = OpLabel + %36 = OpLoad %bool %x_31_phi + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + OpReturn + %37 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %40 = OpLoad %float %39 + %41 = OpFOrdLessThan %bool %40 %float_0 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %44 + %43 = OpLabel + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %50 = OpLoad %float %49 + %51 = OpFOrdLessThan %bool %50 %float_0 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %46 + %52 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %46 + %47 = OpLabel + OpBranch %45 + %46 = OpLabel + OpBranch %42 + %44 = OpLabel + OpStore %x_GLF_color %56 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %57 +%tint_symbol = OpFunctionParameter %main_out + %61 = OpLabel + %62 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %62 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %64 = OpLabel + %65 = OpFunctionCall %void %main_1 + %67 = OpLoad %v4float %x_GLF_color + %68 = OpCompositeConstruct %main_out %67 + %66 = OpFunctionCall %void %tint_symbol_2 %68 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c41a337005 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-same-condition/0-opt.wgsl.expected.wgsl @@ -0,0 +1,52 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_30 : bool; + var x_31_phi : bool; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_23 : f32 = x_5.one; + let x_24 : bool = (x_23 < 0.0); + x_31_phi = x_24; + if (!(x_24)) { + let x_29 : f32 = x_5.one; + x_30 = (x_29 < 1.0); + x_31_phi = x_30; + } + let x_31 : bool = x_31_phi; + if (x_31) { + return; + } + let x_35 : f32 = x_5.one; + if ((x_35 < 0.0)) { + loop { + let x_45 : f32 = x_5.one; + if ((x_45 < 0.0)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + break; + } + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm new file mode 100644 index 0000000000..7abb4131ed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm @@ -0,0 +1,70 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_724_322021 = OpConstant %float 724.322021 + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %26 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %27 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %28 = OpExtInst %float %1 Sinh %float_724_322021 + OpStore %f %28 + %29 = OpLoad %float %f + %30 = OpIsInf %bool %29 + %31 = OpLogicalNot %bool %30 + OpSelectionMerge %32 None + OpBranchConditional %31 %33 %32 + %33 = OpLabel + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %37 = OpLoad %float %36 + %38 = OpFOrdLessThan %bool %35 %37 + OpBranch %32 + %32 = OpLabel + %39 = OpPhi %bool %30 %27 %38 %33 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %42 + %41 = OpLabel + OpStore %_GLF_color %25 + OpBranch %40 + %42 = OpLabel + OpStore %_GLF_color %26 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3b7aff0930 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.hlsl @@ -0,0 +1,39 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + bool x_38 = false; + bool x_39_phi = false; + f = sinh(724.322021484f); + const bool x_30 = isinf(f); + x_39_phi = x_30; + if (!(x_30)) { + const float x_35 = asfloat(x_6[0].x); + const float x_37 = asfloat(x_6[0].y); + x_38 = (x_35 < x_37); + x_39_phi = x_38; + } + if (x_39_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..13962850a2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + bool x_38 = false; + bool x_39_phi = false; + f = sinh(724.322021484f); + float const x_29 = f; + bool const x_30 = isinf(x_29); + x_39_phi = x_30; + if (!(x_30)) { + float const x_35 = x_6.injectionSwitch.x; + float const x_37 = x_6.injectionSwitch.y; + x_38 = (x_35 < x_37); + x_39_phi = x_38; + } + bool const x_39 = x_39_phi; + if (x_39) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..78fda08c59 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.spvasm @@ -0,0 +1,111 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + %25 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %x_38 "x_38" + OpName %x_39_phi "x_39_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool +%float_724_322021 = OpConstant %float 724.322021 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %49 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %f = OpVariable %_ptr_Function_float Function %18 + %x_38 = OpVariable %_ptr_Function_bool Function %22 + %x_39_phi = OpVariable %_ptr_Function_bool Function %22 + %24 = OpExtInst %float %25 Sinh %float_724_322021 + OpStore %f %24 + %27 = OpLoad %float %f + %28 = OpIsInf %bool %27 + OpStore %x_39_phi %28 + %29 = OpLogicalNot %bool %28 + OpSelectionMerge %30 None + OpBranchConditional %29 %31 %30 + %31 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %36 = OpLoad %float %35 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %39 = OpLoad %float %38 + %40 = OpFOrdLessThan %bool %36 %39 + OpStore %x_38 %40 + %41 = OpLoad %bool %x_38 + OpStore %x_39_phi %41 + OpBranch %30 + %30 = OpLabel + %42 = OpLoad %bool %x_39_phi + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + OpStore %x_GLF_color %48 + OpBranch %43 + %45 = OpLabel + OpStore %x_GLF_color %49 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %50 +%tint_symbol = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %57 = OpLabel + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_2 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..39460bf208 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.spvasm.expected.wgsl @@ -0,0 +1,42 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var x_38 : bool; + var x_39_phi : bool; + f = sinh(724.322021484); + let x_29 : f32 = f; + let x_30 : bool = isInf(x_29); + x_39_phi = x_30; + if (!(x_30)) { + let x_35 : f32 = x_6.injectionSwitch.x; + let x_37 : f32 = x_6.injectionSwitch.y; + x_38 = (x_35 < x_37); + x_39_phi = x_38; + } + let x_39 : bool = x_39_phi; + if (x_39) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl new file mode 100644 index 0000000000..39460bf208 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl @@ -0,0 +1,42 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var x_38 : bool; + var x_39_phi : bool; + f = sinh(724.322021484); + let x_29 : f32 = f; + let x_30 : bool = isInf(x_29); + x_39_phi = x_30; + if (!(x_30)) { + let x_35 : f32 = x_6.injectionSwitch.x; + let x_37 : f32 = x_6.injectionSwitch.y; + x_38 = (x_35 < x_37); + x_39_phi = x_38; + } + let x_39 : bool = x_39_phi; + if (x_39) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3b7aff0930 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.hlsl @@ -0,0 +1,39 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + bool x_38 = false; + bool x_39_phi = false; + f = sinh(724.322021484f); + const bool x_30 = isinf(f); + x_39_phi = x_30; + if (!(x_30)) { + const float x_35 = asfloat(x_6[0].x); + const float x_37 = asfloat(x_6[0].y); + x_38 = (x_35 < x_37); + x_39_phi = x_38; + } + if (x_39_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..13962850a2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + bool x_38 = false; + bool x_39_phi = false; + f = sinh(724.322021484f); + float const x_29 = f; + bool const x_30 = isinf(x_29); + x_39_phi = x_30; + if (!(x_30)) { + float const x_35 = x_6.injectionSwitch.x; + float const x_37 = x_6.injectionSwitch.y; + x_38 = (x_35 < x_37); + x_39_phi = x_38; + } + bool const x_39 = x_39_phi; + if (x_39) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..78fda08c59 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.spvasm @@ -0,0 +1,111 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + %25 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %x_38 "x_38" + OpName %x_39_phi "x_39_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool +%float_724_322021 = OpConstant %float 724.322021 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %49 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %f = OpVariable %_ptr_Function_float Function %18 + %x_38 = OpVariable %_ptr_Function_bool Function %22 + %x_39_phi = OpVariable %_ptr_Function_bool Function %22 + %24 = OpExtInst %float %25 Sinh %float_724_322021 + OpStore %f %24 + %27 = OpLoad %float %f + %28 = OpIsInf %bool %27 + OpStore %x_39_phi %28 + %29 = OpLogicalNot %bool %28 + OpSelectionMerge %30 None + OpBranchConditional %29 %31 %30 + %31 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %36 = OpLoad %float %35 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %39 = OpLoad %float %38 + %40 = OpFOrdLessThan %bool %36 %39 + OpStore %x_38 %40 + %41 = OpLoad %bool %x_38 + OpStore %x_39_phi %41 + OpBranch %30 + %30 = OpLabel + %42 = OpLoad %bool %x_39_phi + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + OpStore %x_GLF_color %48 + OpBranch %43 + %45 = OpLabel + OpStore %x_GLF_color %49 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %50 +%tint_symbol = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %57 = OpLabel + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_2 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..39460bf208 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-sinh-inf/0-opt.wgsl.expected.wgsl @@ -0,0 +1,42 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var x_38 : bool; + var x_39_phi : bool; + f = sinh(724.322021484); + let x_29 : f32 = f; + let x_30 : bool = isInf(x_29); + x_39_phi = x_30; + if (!(x_30)) { + let x_35 : f32 = x_6.injectionSwitch.x; + let x_37 : f32 = x_6.injectionSwitch.y; + x_38 = (x_35 < x_37); + x_39_phi = x_38; + } + let x_39 : bool = x_39_phi; + if (x_39) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm new file mode 100644 index 0000000000..db63815c78 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm @@ -0,0 +1,68 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpDecorate %4 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %5 RelaxedPrecision + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_0 = OpConstant %float 0 + %15 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %v2float = OpTypeVector %float 2 + %int_1 = OpConstant %int 1 + %float_2 = OpConstant %float 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %22 = OpUndef %v2float + %23 = OpConstantNull %v4float + %main = OpFunction %void None %7 + %24 = OpLabel + OpBranch %25 + %25 = OpLabel + %26 = OpPhi %v2float %22 %24 %27 %28 + %5 = OpPhi %int %int_2 %24 %4 %28 + %29 = OpSLessThan %bool %5 %int_3 + OpLoopMerge %30 %28 None + OpBranchConditional %29 %28 %30 + %28 = OpLabel + %31 = OpConvertSToF %float %5 + %32 = OpCompositeConstruct %v2float %float_1 %31 + %27 = OpVectorShuffle %v2float %32 %23 0 1 + %4 = OpIAdd %int %5 %int_1 + OpBranch %25 + %30 = OpLabel + %33 = OpCompositeExtract %float %26 0 + %34 = OpFOrdNotEqual %bool %33 %float_1 + %35 = OpLogicalNot %bool %34 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %36 + %37 = OpLabel + %38 = OpCompositeExtract %float %26 1 + %39 = OpFOrdNotEqual %bool %38 %float_2 + OpBranch %36 + %36 = OpLabel + %40 = OpPhi %bool %34 %30 %39 %37 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %43 + %42 = OpLabel + OpStore %_GLF_color %15 + OpBranch %41 + %43 = OpLabel + OpStore %_GLF_color %21 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..527fc4b45f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.hlsl @@ -0,0 +1,54 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 x_26 = float2(0.0f, 0.0f); + bool x_39 = false; + float2 x_26_phi = float2(0.0f, 0.0f); + int x_5_phi = 0; + bool x_40_phi = false; + x_26_phi = float2(0.0f, 0.0f); + x_5_phi = 2; + while (true) { + float2 x_27 = float2(0.0f, 0.0f); + int x_4 = 0; + x_26 = x_26_phi; + const int x_5 = x_5_phi; + if ((x_5 < 3)) { + } else { + break; + } + { + const float2 x_32 = float2(1.0f, float(x_5)); + x_27 = float2(x_32.x, x_32.y); + x_4 = (x_5 + 1); + x_26_phi = x_27; + x_5_phi = x_4; + } + } + const bool x_34 = (x_26.x != 1.0f); + x_40_phi = x_34; + if (!(x_34)) { + x_39 = (x_26.y != 2.0f); + x_40_phi = x_39; + } + if (x_40_phi) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.msl new file mode 100644 index 0000000000..3a57b2877f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float2 x_26 = 0.0f; + bool x_39 = false; + float2 x_26_phi = 0.0f; + int x_5_phi = 0; + bool x_40_phi = false; + x_26_phi = float2(0.0f, 0.0f); + x_5_phi = 2; + while (true) { + float2 x_27 = 0.0f; + int x_4 = 0; + x_26 = x_26_phi; + int const x_5 = x_5_phi; + if ((x_5 < 3)) { + } else { + break; + } + { + float2 const x_32 = float2(1.0f, float(x_5)); + x_27 = float2(x_32.x, x_32.y); + x_4 = (x_5 + 1); + x_26_phi = x_27; + x_5_phi = x_4; + } + } + bool const x_34 = (x_26.x != 1.0f); + x_40_phi = x_34; + if (!(x_34)) { + x_39 = (x_26.y != 2.0f); + x_40_phi = x_39; + } + bool const x_40 = x_40_phi; + if (x_40) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..5d950f1561 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.spvasm @@ -0,0 +1,145 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_26 "x_26" + OpName %x_39 "x_39" + OpName %x_26_phi "x_26_phi" + OpName %x_5_phi "x_5_phi" + OpName %x_40_phi "x_40_phi" + OpName %x_27 "x_27" + OpName %x_4 "x_4" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %19 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v2float %float_0 %float_0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_2 = OpConstant %float 2 + %71 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %72 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %73 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %x_26 = OpVariable %_ptr_Function_v2float Function %15 + %x_39 = OpVariable %_ptr_Function_bool Function %19 + %x_26_phi = OpVariable %_ptr_Function_v2float Function %15 + %x_5_phi = OpVariable %_ptr_Function_int Function %24 + %x_40_phi = OpVariable %_ptr_Function_bool Function %19 + %x_27 = OpVariable %_ptr_Function_v2float Function %15 + %x_4 = OpVariable %_ptr_Function_int Function %24 + OpStore %x_26_phi %27 + OpStore %x_5_phi %int_2 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %35 = OpLoad %v2float %x_26_phi + OpStore %x_26 %35 + %36 = OpLoad %int %x_5_phi + %38 = OpSLessThan %bool %36 %int_3 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %30 + %39 = OpLabel + OpBranch %31 + %31 = OpLabel + %43 = OpConvertSToF %float %36 + %44 = OpCompositeConstruct %v2float %float_1 %43 + %45 = OpCompositeExtract %float %44 0 + %46 = OpCompositeExtract %float %44 1 + %47 = OpCompositeConstruct %v2float %45 %46 + OpStore %x_27 %47 + %49 = OpIAdd %int %36 %int_1 + OpStore %x_4 %49 + %50 = OpLoad %v2float %x_27 + OpStore %x_26_phi %50 + %51 = OpLoad %int %x_4 + OpStore %x_5_phi %51 + OpBranch %29 + %30 = OpLabel + %55 = OpAccessChain %_ptr_Function_float %x_26 %uint_0 + %56 = OpLoad %float %55 + %57 = OpFOrdNotEqual %bool %56 %float_1 + OpStore %x_40_phi %57 + %58 = OpLogicalNot %bool %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + %62 = OpAccessChain %_ptr_Function_float %x_26 %uint_1 + %63 = OpLoad %float %62 + %65 = OpFOrdNotEqual %bool %63 %float_2 + OpStore %x_39 %65 + %66 = OpLoad %bool %x_39 + OpStore %x_40_phi %66 + OpBranch %59 + %59 = OpLabel + %67 = OpLoad %bool %x_40_phi + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpStore %x_GLF_color %71 + OpBranch %68 + %70 = OpLabel + OpStore %x_GLF_color %72 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %73 +%tint_symbol = OpFunctionParameter %main_out + %77 = OpLabel + %78 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %78 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %80 = OpLabel + %81 = OpFunctionCall %void %main_1 + %83 = OpLoad %v4float %x_GLF_color + %84 = OpCompositeConstruct %main_out %83 + %82 = OpFunctionCall %void %tint_symbol_2 %84 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..2d4b64104b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.spvasm.expected.wgsl @@ -0,0 +1,53 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x_26 : vec2; + var x_39 : bool; + var x_26_phi : vec2; + var x_5_phi : i32; + var x_40_phi : bool; + x_26_phi = vec2(0.0, 0.0); + x_5_phi = 2; + loop { + var x_27 : vec2; + var x_4 : i32; + x_26 = x_26_phi; + let x_5 : i32 = x_5_phi; + if ((x_5 < 3)) { + } else { + break; + } + + continuing { + let x_32 : vec2 = vec2(1.0, f32(x_5)); + x_27 = vec2(x_32.x, x_32.y); + x_4 = (x_5 + 1); + x_26_phi = x_27; + x_5_phi = x_4; + } + } + let x_34 : bool = (x_26.x != 1.0); + x_40_phi = x_34; + if (!(x_34)) { + x_39 = (x_26.y != 2.0); + x_40_phi = x_39; + } + let x_40 : bool = x_40_phi; + if (x_40) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl new file mode 100644 index 0000000000..2d4b64104b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl @@ -0,0 +1,53 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x_26 : vec2; + var x_39 : bool; + var x_26_phi : vec2; + var x_5_phi : i32; + var x_40_phi : bool; + x_26_phi = vec2(0.0, 0.0); + x_5_phi = 2; + loop { + var x_27 : vec2; + var x_4 : i32; + x_26 = x_26_phi; + let x_5 : i32 = x_5_phi; + if ((x_5 < 3)) { + } else { + break; + } + + continuing { + let x_32 : vec2 = vec2(1.0, f32(x_5)); + x_27 = vec2(x_32.x, x_32.y); + x_4 = (x_5 + 1); + x_26_phi = x_27; + x_5_phi = x_4; + } + } + let x_34 : bool = (x_26.x != 1.0); + x_40_phi = x_34; + if (!(x_34)) { + x_39 = (x_26.y != 2.0); + x_40_phi = x_39; + } + let x_40 : bool = x_40_phi; + if (x_40) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..527fc4b45f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.hlsl @@ -0,0 +1,54 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 x_26 = float2(0.0f, 0.0f); + bool x_39 = false; + float2 x_26_phi = float2(0.0f, 0.0f); + int x_5_phi = 0; + bool x_40_phi = false; + x_26_phi = float2(0.0f, 0.0f); + x_5_phi = 2; + while (true) { + float2 x_27 = float2(0.0f, 0.0f); + int x_4 = 0; + x_26 = x_26_phi; + const int x_5 = x_5_phi; + if ((x_5 < 3)) { + } else { + break; + } + { + const float2 x_32 = float2(1.0f, float(x_5)); + x_27 = float2(x_32.x, x_32.y); + x_4 = (x_5 + 1); + x_26_phi = x_27; + x_5_phi = x_4; + } + } + const bool x_34 = (x_26.x != 1.0f); + x_40_phi = x_34; + if (!(x_34)) { + x_39 = (x_26.y != 2.0f); + x_40_phi = x_39; + } + if (x_40_phi) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.msl new file mode 100644 index 0000000000..3a57b2877f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float2 x_26 = 0.0f; + bool x_39 = false; + float2 x_26_phi = 0.0f; + int x_5_phi = 0; + bool x_40_phi = false; + x_26_phi = float2(0.0f, 0.0f); + x_5_phi = 2; + while (true) { + float2 x_27 = 0.0f; + int x_4 = 0; + x_26 = x_26_phi; + int const x_5 = x_5_phi; + if ((x_5 < 3)) { + } else { + break; + } + { + float2 const x_32 = float2(1.0f, float(x_5)); + x_27 = float2(x_32.x, x_32.y); + x_4 = (x_5 + 1); + x_26_phi = x_27; + x_5_phi = x_4; + } + } + bool const x_34 = (x_26.x != 1.0f); + x_40_phi = x_34; + if (!(x_34)) { + x_39 = (x_26.y != 2.0f); + x_40_phi = x_39; + } + bool const x_40 = x_40_phi; + if (x_40) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d950f1561 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.spvasm @@ -0,0 +1,145 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_26 "x_26" + OpName %x_39 "x_39" + OpName %x_26_phi "x_26_phi" + OpName %x_5_phi "x_5_phi" + OpName %x_40_phi "x_40_phi" + OpName %x_27 "x_27" + OpName %x_4 "x_4" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %19 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v2float %float_0 %float_0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_2 = OpConstant %float 2 + %71 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %72 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %73 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %x_26 = OpVariable %_ptr_Function_v2float Function %15 + %x_39 = OpVariable %_ptr_Function_bool Function %19 + %x_26_phi = OpVariable %_ptr_Function_v2float Function %15 + %x_5_phi = OpVariable %_ptr_Function_int Function %24 + %x_40_phi = OpVariable %_ptr_Function_bool Function %19 + %x_27 = OpVariable %_ptr_Function_v2float Function %15 + %x_4 = OpVariable %_ptr_Function_int Function %24 + OpStore %x_26_phi %27 + OpStore %x_5_phi %int_2 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %35 = OpLoad %v2float %x_26_phi + OpStore %x_26 %35 + %36 = OpLoad %int %x_5_phi + %38 = OpSLessThan %bool %36 %int_3 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %30 + %39 = OpLabel + OpBranch %31 + %31 = OpLabel + %43 = OpConvertSToF %float %36 + %44 = OpCompositeConstruct %v2float %float_1 %43 + %45 = OpCompositeExtract %float %44 0 + %46 = OpCompositeExtract %float %44 1 + %47 = OpCompositeConstruct %v2float %45 %46 + OpStore %x_27 %47 + %49 = OpIAdd %int %36 %int_1 + OpStore %x_4 %49 + %50 = OpLoad %v2float %x_27 + OpStore %x_26_phi %50 + %51 = OpLoad %int %x_4 + OpStore %x_5_phi %51 + OpBranch %29 + %30 = OpLabel + %55 = OpAccessChain %_ptr_Function_float %x_26 %uint_0 + %56 = OpLoad %float %55 + %57 = OpFOrdNotEqual %bool %56 %float_1 + OpStore %x_40_phi %57 + %58 = OpLogicalNot %bool %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + %62 = OpAccessChain %_ptr_Function_float %x_26 %uint_1 + %63 = OpLoad %float %62 + %65 = OpFOrdNotEqual %bool %63 %float_2 + OpStore %x_39 %65 + %66 = OpLoad %bool %x_39 + OpStore %x_40_phi %66 + OpBranch %59 + %59 = OpLabel + %67 = OpLoad %bool %x_40_phi + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpStore %x_GLF_color %71 + OpBranch %68 + %70 = OpLabel + OpStore %x_GLF_color %72 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %73 +%tint_symbol = OpFunctionParameter %main_out + %77 = OpLabel + %78 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %78 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %80 = OpLabel + %81 = OpFunctionCall %void %main_1 + %83 = OpLoad %v4float %x_GLF_color + %84 = OpCompositeConstruct %main_out %83 + %82 = OpFunctionCall %void %tint_symbol_2 %84 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..2d4b64104b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-const-folding-vector-shuffle/0.wgsl.expected.wgsl @@ -0,0 +1,53 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x_26 : vec2; + var x_39 : bool; + var x_26_phi : vec2; + var x_5_phi : i32; + var x_40_phi : bool; + x_26_phi = vec2(0.0, 0.0); + x_5_phi = 2; + loop { + var x_27 : vec2; + var x_4 : i32; + x_26 = x_26_phi; + let x_5 : i32 = x_5_phi; + if ((x_5 < 3)) { + } else { + break; + } + + continuing { + let x_32 : vec2 = vec2(1.0, f32(x_5)); + x_27 = vec2(x_32.x, x_32.y); + x_4 = (x_5 + 1); + x_26_phi = x_27; + x_5_phi = x_4; + } + } + let x_34 : bool = (x_26.x != 1.0); + x_40_phi = x_34; + if (!(x_34)) { + x_39 = (x_26.y != 2.0); + x_40_phi = x_39; + } + let x_40 : bool = x_40_phi; + if (x_40) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm new file mode 100644 index 0000000000..432d78bab1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f "f" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 +%float_0_910000026 = OpConstant %float 0.910000026 + %bool = OpTypeBool +%float_0_930000007 = OpConstant %float 0.930000007 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %16 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %17 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %6 + %18 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %19 = OpExtInst %float %1 Tanh %float_1 + %20 = OpExtInst %float %1 Atan2 %float_1 %19 + OpStore %f %20 + %21 = OpLoad %float %f + %22 = OpFOrdGreaterThan %bool %21 %float_0_910000026 + %23 = OpLoad %float %f + %24 = OpFOrdLessThan %bool %23 %float_0_930000007 + %25 = OpLogicalAnd %bool %22 %24 + OpSelectionMerge %26 None + OpBranchConditional %25 %27 %28 + %27 = OpLabel + OpStore %_GLF_color %16 + OpBranch %26 + %28 = OpLabel + OpStore %_GLF_color %17 + OpBranch %26 + %26 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..c627f2d98f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.hlsl @@ -0,0 +1,30 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + f = atan2(1.0f, tanh(1.0f)); + bool tint_tmp = (f > 0.910000026f); + if (tint_tmp) { + tint_tmp = (f < 0.930000007f); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..2bef8185d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float f = 0.0f; + f = atan2(1.0f, tanh(1.0f)); + float const x_21 = f; + float const x_23 = f; + if (((x_21 > 0.910000026f) && (x_23 < 0.930000007f))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b1523b53e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %14 = OpConstantNull %float + %float_1 = OpConstant %float 1 +%float_0_910000026 = OpConstant %float 0.910000026 + %bool = OpTypeBool +%float_0_930000007 = OpConstant %float 0.930000007 + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %35 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %f = OpVariable %_ptr_Function_float Function %14 + %18 = OpExtInst %float %16 Tanh %float_1 + %15 = OpExtInst %float %16 Atan2 %float_1 %18 + OpStore %f %15 + %19 = OpLoad %float %f + %20 = OpLoad %float %f + %22 = OpFOrdGreaterThan %bool %19 %float_0_910000026 + OpSelectionMerge %24 None + OpBranchConditional %22 %25 %24 + %25 = OpLabel + %27 = OpFOrdLessThan %bool %20 %float_0_930000007 + OpBranch %24 + %24 = OpLabel + %28 = OpPhi %bool %22 %11 %27 %25 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %31 + %30 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %29 + %31 = OpLabel + OpStore %x_GLF_color %34 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %35 +%tint_symbol = OpFunctionParameter %main_out + %39 = OpLabel + %40 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %40 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %42 = OpLabel + %43 = OpFunctionCall %void %main_1 + %45 = OpLoad %v4float %x_GLF_color + %46 = OpCompositeConstruct %main_out %45 + %44 = OpFunctionCall %void %tint_symbol_2 %46 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..aa699030db --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + f = atan2(1.0, tanh(1.0)); + let x_21 : f32 = f; + let x_23 : f32 = f; + if (((x_21 > 0.910000026) && (x_23 < 0.930000007))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl new file mode 100644 index 0000000000..aa699030db --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl @@ -0,0 +1,25 @@ +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + f = atan2(1.0, tanh(1.0)); + let x_21 : f32 = f; + let x_23 : f32 = f; + if (((x_21 > 0.910000026) && (x_23 < 0.930000007))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..c627f2d98f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.hlsl @@ -0,0 +1,30 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + f = atan2(1.0f, tanh(1.0f)); + bool tint_tmp = (f > 0.910000026f); + if (tint_tmp) { + tint_tmp = (f < 0.930000007f); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..2bef8185d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float f = 0.0f; + f = atan2(1.0f, tanh(1.0f)); + float const x_21 = f; + float const x_23 = f; + if (((x_21 > 0.910000026f) && (x_23 < 0.930000007f))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b1523b53e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %16 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %14 = OpConstantNull %float + %float_1 = OpConstant %float 1 +%float_0_910000026 = OpConstant %float 0.910000026 + %bool = OpTypeBool +%float_0_930000007 = OpConstant %float 0.930000007 + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %35 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %f = OpVariable %_ptr_Function_float Function %14 + %18 = OpExtInst %float %16 Tanh %float_1 + %15 = OpExtInst %float %16 Atan2 %float_1 %18 + OpStore %f %15 + %19 = OpLoad %float %f + %20 = OpLoad %float %f + %22 = OpFOrdGreaterThan %bool %19 %float_0_910000026 + OpSelectionMerge %24 None + OpBranchConditional %22 %25 %24 + %25 = OpLabel + %27 = OpFOrdLessThan %bool %20 %float_0_930000007 + OpBranch %24 + %24 = OpLabel + %28 = OpPhi %bool %22 %11 %27 %25 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %31 + %30 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %29 + %31 = OpLabel + OpStore %x_GLF_color %34 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %35 +%tint_symbol = OpFunctionParameter %main_out + %39 = OpLabel + %40 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %40 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %42 = OpLabel + %43 = OpFunctionCall %void %main_1 + %45 = OpLoad %v4float %x_GLF_color + %46 = OpCompositeConstruct %main_out %45 + %44 = OpFunctionCall %void %tint_symbol_2 %46 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..aa699030db --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constant-folding-atan-over-tanh/0-opt.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + f = atan2(1.0, tanh(1.0)); + let x_21 : f32 = f; + let x_23 : f32 = f; + if (((x_21 > 0.910000026) && (x_23 < 0.930000007))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm new file mode 100644 index 0000000000..69c274764a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm @@ -0,0 +1,154 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_f1_ "func(f1;" + OpName %f "f" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %b "b" + OpName %i "i" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 + %18 = OpTypeFunction %int %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 +%float_0_699999988 = OpConstant %float 0.699999988 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %33 = OpLabel + %param = OpVariable %_ptr_Function_float Function + OpStore %param %float_0_699999988 + %34 = OpFunctionCall %int %func_f1_ %param + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %36 = OpLoad %int %35 + %37 = OpIEqual %bool %34 %36 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %40 + %39 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpConvertSToF %float %42 + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %45 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %48 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %51 + %53 = OpCompositeConstruct %v4float %43 %46 %49 %52 + OpStore %_GLF_color %53 + OpBranch %38 + %40 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpCompositeConstruct %v4float %56 %56 %56 %56 + OpStore %_GLF_color %57 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd + %func_f1_ = OpFunction %int None %18 + %f = OpFunctionParameter %_ptr_Function_float + %58 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %60 = OpLoad %int %59 + OpStore %a %60 + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %62 = OpLoad %int %61 + OpStore %b %62 + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %64 = OpLoad %int %63 + OpStore %i %64 + OpBranch %65 + %65 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %69 = OpLoad %int %i + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %71 = OpLoad %int %70 + %72 = OpSLessThan %bool %69 %71 + OpBranchConditional %72 %73 %66 + %73 = OpLabel + %74 = OpLoad %int %a + %75 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %76 = OpLoad %int %75 + %77 = OpSGreaterThan %bool %74 %76 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %78 + %79 = OpLabel + OpBranch %66 + %78 = OpLabel + %80 = OpLoad %float %f + %81 = OpConvertFToS %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpSDiv %int %83 %int_2 + %85 = OpISub %int %81 %84 + %86 = OpLoad %int %i + %87 = OpIAdd %int %85 %86 + OpStore %a %87 + %88 = OpLoad %int %b + %89 = OpIAdd %int %88 %int_1 + OpStore %b %89 + OpBranch %67 + %67 = OpLabel + %90 = OpLoad %int %i + %91 = OpIAdd %int %90 %int_1 + OpStore %i %91 + OpBranch %65 + %66 = OpLabel + %92 = OpLoad %int %b + %93 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %94 = OpLoad %int %93 + %95 = OpIEqual %bool %92 %94 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %98 + %97 = OpLabel + %99 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %100 = OpLoad %int %99 + OpReturnValue %100 + %98 = OpLabel + %101 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %102 = OpLoad %int %101 + OpReturnValue %102 + %96 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..b8364d73ed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.hlsl @@ -0,0 +1,80 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_f1_(inout float f) { + int a = 0; + int b = 0; + int i = 0; + const int x_60 = asint(x_8[1].x); + a = x_60; + const int x_62 = asint(x_8[2].x); + b = x_62; + const int x_64 = asint(x_8[2].x); + i = x_64; + while (true) { + const int x_69 = i; + const int x_71 = asint(x_8[4].x); + if ((x_69 < x_71)) { + } else { + break; + } + const int x_74 = a; + const int x_76 = asint(x_8[3].x); + if ((x_74 > x_76)) { + break; + } + const float x_80 = f; + const int x_83 = asint(x_8[1].x); + a = ((int(x_80) - (x_83 / 2)) + i); + b = (b + 1); + { + i = (i + 1); + } + } + const int x_92 = b; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_94 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_92 == x_94)) { + const int x_100 = asint(x_8[1].x); + return x_100; + } else { + const int x_102 = asint(x_8[2].x); + return x_102; + } + return 0; +} + +void main_1() { + float param = 0.0f; + param = 0.699999988f; + const int x_34 = func_f1_(param); + const int x_36 = asint(x_8[1].x); + if ((x_34 == x_36)) { + const int x_42 = asint(x_8[1].x); + const int x_45 = asint(x_8[2].x); + const int x_48 = asint(x_8[2].x); + const int x_51 = asint(x_8[1].x); + x_GLF_color = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + } else { + const int x_55 = asint(x_8[2].x); + const float x_56 = float(x_55); + x_GLF_color = float4(x_56, x_56, x_56, x_56); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..e105e07dd1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.msl @@ -0,0 +1,92 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_f1_(constant buf0& x_8, thread float* const f) { + int a = 0; + int b = 0; + int i = 0; + int const x_60 = x_8.x_GLF_uniform_int_values.arr[1].el; + a = x_60; + int const x_62 = x_8.x_GLF_uniform_int_values.arr[2].el; + b = x_62; + int const x_64 = x_8.x_GLF_uniform_int_values.arr[2].el; + i = x_64; + while (true) { + int const x_69 = i; + int const x_71 = x_8.x_GLF_uniform_int_values.arr[4].el; + if ((x_69 < x_71)) { + } else { + break; + } + int const x_74 = a; + int const x_76 = x_8.x_GLF_uniform_int_values.arr[3].el; + if ((x_74 > x_76)) { + break; + } + float const x_80 = *(f); + int const x_83 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_86 = i; + a = ((int(x_80) - (x_83 / 2)) + x_86); + int const x_88 = b; + b = (x_88 + 1); + { + int const x_90 = i; + i = (x_90 + 1); + } + } + int const x_92 = b; + int const x_94 = x_8.x_GLF_uniform_int_values.arr[0].el; + if ((x_92 == x_94)) { + int const x_100 = x_8.x_GLF_uniform_int_values.arr[1].el; + return x_100; + } else { + int const x_102 = x_8.x_GLF_uniform_int_values.arr[2].el; + return x_102; + } + return 0; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + float param = 0.0f; + param = 0.699999988f; + int const x_34 = func_f1_(x_8, &(param)); + int const x_36 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_34 == x_36)) { + int const x_42 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_45 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_48 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_51 = x_8.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + } else { + int const x_55 = x_8.x_GLF_uniform_int_values.arr[2].el; + float const x_56 = float(x_55); + *(tint_symbol_4) = float4(x_56, x_56, x_56, x_56); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..769deeba61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.spvasm @@ -0,0 +1,193 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 124 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_f1_ "func_f1_" + OpName %f "f" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpTypeFunction %int %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %85 = OpConstantNull %float +%float_0_699999988 = OpConstant %float 0.699999988 + %main_out = OpTypeStruct %v4float + %112 = OpTypeFunction %void %main_out + %func_f1_ = OpFunction %int None %15 + %f = OpFunctionParameter %_ptr_Function_float + %19 = OpLabel + %a = OpVariable %_ptr_Function_int Function %22 + %b = OpVariable %_ptr_Function_int Function %22 + %i = OpVariable %_ptr_Function_int Function %22 + %28 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %29 = OpLoad %int %28 + OpStore %a %29 + %31 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %32 = OpLoad %int %31 + OpStore %b %32 + %33 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %34 = OpLoad %int %33 + OpStore %i %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %int %i + %41 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4 + %42 = OpLoad %int %41 + %43 = OpSLessThan %bool %39 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %36 + %45 = OpLabel + %48 = OpLoad %int %a + %50 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %51 = OpLoad %int %50 + %52 = OpSGreaterThan %bool %48 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + OpBranch %36 + %53 = OpLabel + %56 = OpLoad %float %f + %57 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpLoad %int %i + %60 = OpConvertFToS %int %56 + %61 = OpSDiv %int %58 %int_2 + %62 = OpISub %int %60 %61 + %63 = OpIAdd %int %62 %59 + OpStore %a %63 + %64 = OpLoad %int %b + %65 = OpIAdd %int %64 %int_1 + OpStore %b %65 + OpBranch %37 + %37 = OpLabel + %66 = OpLoad %int %i + %67 = OpIAdd %int %66 %int_1 + OpStore %i %67 + OpBranch %35 + %36 = OpLabel + %68 = OpLoad %int %b + %70 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %71 = OpLoad %int %70 + %72 = OpIEqual %bool %68 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %77 = OpLoad %int %76 + OpReturnValue %77 + %75 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %79 = OpLoad %int %78 + OpReturnValue %79 + %73 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %80 + %83 = OpLabel + %param = OpVariable %_ptr_Function_float Function %85 + OpStore %param %float_0_699999988 + %87 = OpFunctionCall %int %func_f1_ %param + %89 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpIEqual %bool %87 %90 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %94 + %93 = OpLabel + %95 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %102 = OpLoad %int %101 + %103 = OpConvertSToF %float %96 + %104 = OpConvertSToF %float %98 + %105 = OpConvertSToF %float %100 + %106 = OpConvertSToF %float %102 + %107 = OpCompositeConstruct %v4float %103 %104 %105 %106 + OpStore %x_GLF_color %107 + OpBranch %92 + %94 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %109 + %111 = OpCompositeConstruct %v4float %110 %110 %110 %110 + OpStore %x_GLF_color %111 + OpBranch %92 + %92 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %112 +%tint_symbol = OpFunctionParameter %main_out + %116 = OpLabel + %117 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %117 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %80 + %119 = OpLabel + %120 = OpFunctionCall %void %main_1 + %122 = OpLoad %v4float %x_GLF_color + %123 = OpCompositeConstruct %main_out %122 + %121 = OpFunctionCall %void %tint_symbol_2 %123 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..e697708d34 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.spvasm.expected.wgsl @@ -0,0 +1,86 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_f1_(f : ptr) -> i32 { + var a : i32; + var b : i32; + var i : i32; + let x_60 : i32 = x_8.x_GLF_uniform_int_values[1]; + a = x_60; + let x_62 : i32 = x_8.x_GLF_uniform_int_values[2]; + b = x_62; + let x_64 : i32 = x_8.x_GLF_uniform_int_values[2]; + i = x_64; + loop { + let x_69 : i32 = i; + let x_71 : i32 = x_8.x_GLF_uniform_int_values[4]; + if ((x_69 < x_71)) { + } else { + break; + } + let x_74 : i32 = a; + let x_76 : i32 = x_8.x_GLF_uniform_int_values[3]; + if ((x_74 > x_76)) { + break; + } + let x_80 : f32 = *(f); + let x_83 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_86 : i32 = i; + a = ((i32(x_80) - (x_83 / 2)) + x_86); + let x_88 : i32 = b; + b = (x_88 + 1); + + continuing { + let x_90 : i32 = i; + i = (x_90 + 1); + } + } + let x_92 : i32 = b; + let x_94 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_92 == x_94)) { + let x_100 : i32 = x_8.x_GLF_uniform_int_values[1]; + return x_100; + } else { + let x_102 : i32 = x_8.x_GLF_uniform_int_values[2]; + return x_102; + } + return 0; +} + +fn main_1() { + var param : f32; + param = 0.699999988; + let x_34 : i32 = func_f1_(&(param)); + let x_36 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_34 == x_36)) { + let x_42 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_48 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_42), f32(x_45), f32(x_48), f32(x_51)); + } else { + let x_55 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_56 : f32 = f32(x_55); + x_GLF_color = vec4(x_56, x_56, x_56, x_56); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl new file mode 100644 index 0000000000..e697708d34 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl @@ -0,0 +1,86 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_f1_(f : ptr) -> i32 { + var a : i32; + var b : i32; + var i : i32; + let x_60 : i32 = x_8.x_GLF_uniform_int_values[1]; + a = x_60; + let x_62 : i32 = x_8.x_GLF_uniform_int_values[2]; + b = x_62; + let x_64 : i32 = x_8.x_GLF_uniform_int_values[2]; + i = x_64; + loop { + let x_69 : i32 = i; + let x_71 : i32 = x_8.x_GLF_uniform_int_values[4]; + if ((x_69 < x_71)) { + } else { + break; + } + let x_74 : i32 = a; + let x_76 : i32 = x_8.x_GLF_uniform_int_values[3]; + if ((x_74 > x_76)) { + break; + } + let x_80 : f32 = *(f); + let x_83 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_86 : i32 = i; + a = ((i32(x_80) - (x_83 / 2)) + x_86); + let x_88 : i32 = b; + b = (x_88 + 1); + + continuing { + let x_90 : i32 = i; + i = (x_90 + 1); + } + } + let x_92 : i32 = b; + let x_94 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_92 == x_94)) { + let x_100 : i32 = x_8.x_GLF_uniform_int_values[1]; + return x_100; + } else { + let x_102 : i32 = x_8.x_GLF_uniform_int_values[2]; + return x_102; + } + return 0; +} + +fn main_1() { + var param : f32; + param = 0.699999988; + let x_34 : i32 = func_f1_(&(param)); + let x_36 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_34 == x_36)) { + let x_42 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_48 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_42), f32(x_45), f32(x_48), f32(x_51)); + } else { + let x_55 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_56 : f32 = f32(x_55); + x_GLF_color = vec4(x_56, x_56, x_56, x_56); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..b8364d73ed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.hlsl @@ -0,0 +1,80 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_f1_(inout float f) { + int a = 0; + int b = 0; + int i = 0; + const int x_60 = asint(x_8[1].x); + a = x_60; + const int x_62 = asint(x_8[2].x); + b = x_62; + const int x_64 = asint(x_8[2].x); + i = x_64; + while (true) { + const int x_69 = i; + const int x_71 = asint(x_8[4].x); + if ((x_69 < x_71)) { + } else { + break; + } + const int x_74 = a; + const int x_76 = asint(x_8[3].x); + if ((x_74 > x_76)) { + break; + } + const float x_80 = f; + const int x_83 = asint(x_8[1].x); + a = ((int(x_80) - (x_83 / 2)) + i); + b = (b + 1); + { + i = (i + 1); + } + } + const int x_92 = b; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_94 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_92 == x_94)) { + const int x_100 = asint(x_8[1].x); + return x_100; + } else { + const int x_102 = asint(x_8[2].x); + return x_102; + } + return 0; +} + +void main_1() { + float param = 0.0f; + param = 0.699999988f; + const int x_34 = func_f1_(param); + const int x_36 = asint(x_8[1].x); + if ((x_34 == x_36)) { + const int x_42 = asint(x_8[1].x); + const int x_45 = asint(x_8[2].x); + const int x_48 = asint(x_8[2].x); + const int x_51 = asint(x_8[1].x); + x_GLF_color = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + } else { + const int x_55 = asint(x_8[2].x); + const float x_56 = float(x_55); + x_GLF_color = float4(x_56, x_56, x_56, x_56); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..e105e07dd1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.msl @@ -0,0 +1,92 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_f1_(constant buf0& x_8, thread float* const f) { + int a = 0; + int b = 0; + int i = 0; + int const x_60 = x_8.x_GLF_uniform_int_values.arr[1].el; + a = x_60; + int const x_62 = x_8.x_GLF_uniform_int_values.arr[2].el; + b = x_62; + int const x_64 = x_8.x_GLF_uniform_int_values.arr[2].el; + i = x_64; + while (true) { + int const x_69 = i; + int const x_71 = x_8.x_GLF_uniform_int_values.arr[4].el; + if ((x_69 < x_71)) { + } else { + break; + } + int const x_74 = a; + int const x_76 = x_8.x_GLF_uniform_int_values.arr[3].el; + if ((x_74 > x_76)) { + break; + } + float const x_80 = *(f); + int const x_83 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_86 = i; + a = ((int(x_80) - (x_83 / 2)) + x_86); + int const x_88 = b; + b = (x_88 + 1); + { + int const x_90 = i; + i = (x_90 + 1); + } + } + int const x_92 = b; + int const x_94 = x_8.x_GLF_uniform_int_values.arr[0].el; + if ((x_92 == x_94)) { + int const x_100 = x_8.x_GLF_uniform_int_values.arr[1].el; + return x_100; + } else { + int const x_102 = x_8.x_GLF_uniform_int_values.arr[2].el; + return x_102; + } + return 0; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + float param = 0.0f; + param = 0.699999988f; + int const x_34 = func_f1_(x_8, &(param)); + int const x_36 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_34 == x_36)) { + int const x_42 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_45 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_48 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_51 = x_8.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + } else { + int const x_55 = x_8.x_GLF_uniform_int_values.arr[2].el; + float const x_56 = float(x_55); + *(tint_symbol_4) = float4(x_56, x_56, x_56, x_56); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..769deeba61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.spvasm @@ -0,0 +1,193 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 124 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_f1_ "func_f1_" + OpName %f "f" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpTypeFunction %int %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %85 = OpConstantNull %float +%float_0_699999988 = OpConstant %float 0.699999988 + %main_out = OpTypeStruct %v4float + %112 = OpTypeFunction %void %main_out + %func_f1_ = OpFunction %int None %15 + %f = OpFunctionParameter %_ptr_Function_float + %19 = OpLabel + %a = OpVariable %_ptr_Function_int Function %22 + %b = OpVariable %_ptr_Function_int Function %22 + %i = OpVariable %_ptr_Function_int Function %22 + %28 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %29 = OpLoad %int %28 + OpStore %a %29 + %31 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %32 = OpLoad %int %31 + OpStore %b %32 + %33 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %34 = OpLoad %int %33 + OpStore %i %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %int %i + %41 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4 + %42 = OpLoad %int %41 + %43 = OpSLessThan %bool %39 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %36 + %45 = OpLabel + %48 = OpLoad %int %a + %50 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %51 = OpLoad %int %50 + %52 = OpSGreaterThan %bool %48 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + OpBranch %36 + %53 = OpLabel + %56 = OpLoad %float %f + %57 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpLoad %int %i + %60 = OpConvertFToS %int %56 + %61 = OpSDiv %int %58 %int_2 + %62 = OpISub %int %60 %61 + %63 = OpIAdd %int %62 %59 + OpStore %a %63 + %64 = OpLoad %int %b + %65 = OpIAdd %int %64 %int_1 + OpStore %b %65 + OpBranch %37 + %37 = OpLabel + %66 = OpLoad %int %i + %67 = OpIAdd %int %66 %int_1 + OpStore %i %67 + OpBranch %35 + %36 = OpLabel + %68 = OpLoad %int %b + %70 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %71 = OpLoad %int %70 + %72 = OpIEqual %bool %68 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %77 = OpLoad %int %76 + OpReturnValue %77 + %75 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %79 = OpLoad %int %78 + OpReturnValue %79 + %73 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %80 + %83 = OpLabel + %param = OpVariable %_ptr_Function_float Function %85 + OpStore %param %float_0_699999988 + %87 = OpFunctionCall %int %func_f1_ %param + %89 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpIEqual %bool %87 %90 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %94 + %93 = OpLabel + %95 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %102 = OpLoad %int %101 + %103 = OpConvertSToF %float %96 + %104 = OpConvertSToF %float %98 + %105 = OpConvertSToF %float %100 + %106 = OpConvertSToF %float %102 + %107 = OpCompositeConstruct %v4float %103 %104 %105 %106 + OpStore %x_GLF_color %107 + OpBranch %92 + %94 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %109 + %111 = OpCompositeConstruct %v4float %110 %110 %110 %110 + OpStore %x_GLF_color %111 + OpBranch %92 + %92 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %112 +%tint_symbol = OpFunctionParameter %main_out + %116 = OpLabel + %117 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %117 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %80 + %119 = OpLabel + %120 = OpFunctionCall %void %main_1 + %122 = OpLoad %v4float %x_GLF_color + %123 = OpCompositeConstruct %main_out %122 + %121 = OpFunctionCall %void %tint_symbol_2 %123 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..e697708d34 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-combine-add-sub/0-opt.wgsl.expected.wgsl @@ -0,0 +1,86 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_f1_(f : ptr) -> i32 { + var a : i32; + var b : i32; + var i : i32; + let x_60 : i32 = x_8.x_GLF_uniform_int_values[1]; + a = x_60; + let x_62 : i32 = x_8.x_GLF_uniform_int_values[2]; + b = x_62; + let x_64 : i32 = x_8.x_GLF_uniform_int_values[2]; + i = x_64; + loop { + let x_69 : i32 = i; + let x_71 : i32 = x_8.x_GLF_uniform_int_values[4]; + if ((x_69 < x_71)) { + } else { + break; + } + let x_74 : i32 = a; + let x_76 : i32 = x_8.x_GLF_uniform_int_values[3]; + if ((x_74 > x_76)) { + break; + } + let x_80 : f32 = *(f); + let x_83 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_86 : i32 = i; + a = ((i32(x_80) - (x_83 / 2)) + x_86); + let x_88 : i32 = b; + b = (x_88 + 1); + + continuing { + let x_90 : i32 = i; + i = (x_90 + 1); + } + } + let x_92 : i32 = b; + let x_94 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_92 == x_94)) { + let x_100 : i32 = x_8.x_GLF_uniform_int_values[1]; + return x_100; + } else { + let x_102 : i32 = x_8.x_GLF_uniform_int_values[2]; + return x_102; + } + return 0; +} + +fn main_1() { + var param : f32; + param = 0.699999988; + let x_34 : i32 = func_f1_(&(param)); + let x_36 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_34 == x_36)) { + let x_42 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_48 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_42), f32(x_45), f32(x_48), f32(x_51)); + } else { + let x_55 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_56 : f32 = f32(x_55); + x_GLF_color = vec4(x_56, x_56, x_56, x_56); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm new file mode 100644 index 0000000000..f316c315c0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm @@ -0,0 +1,66 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %mixed "mixed" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 + %13 = OpConstantComposite %v2float %float_1 %float_1 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_0_5 = OpConstant %float 0.5 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %28 = OpLabel + %mixed = OpVariable %_ptr_Function_v2float Function + %29 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %30 = OpLoad %v2float %29 + %31 = OpCompositeConstruct %v2float %float_0_5 %float_0_5 + %32 = OpExtInst %v2float %1 FMix %13 %30 %31 + OpStore %mixed %32 + %33 = OpLoad %v2float %mixed + %34 = OpFOrdEqual %v2bool %33 %13 + %35 = OpAll %bool %34 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %38 + %37 = OpLabel + %39 = OpAccessChain %_ptr_Function_float %mixed %uint_0 + %40 = OpLoad %float %39 + %41 = OpCompositeConstruct %v4float %40 %float_0 %float_0 %float_1 + OpStore %_GLF_color %41 + OpBranch %36 + %38 = OpLabel + OpStore %_GLF_color %27 + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..e67d2bc795 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.hlsl @@ -0,0 +1,31 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 mixed = float2(0.0f, 0.0f); + const float2 x_30 = asfloat(x_6[0].xy); + mixed = lerp(float2(1.0f, 1.0f), x_30, float2(0.5f, 0.5f)); + if (all((mixed == float2(1.0f, 1.0f)))) { + const float x_40 = mixed.x; + x_GLF_color = float4(x_40, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b48da79378 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2 mixed = 0.0f; + float2 const x_30 = x_6.one; + mixed = mix(float2(1.0f, 1.0f), x_30, float2(0.5f, 0.5f)); + float2 const x_33 = mixed; + if (all((x_33 == float2(1.0f, 1.0f)))) { + float const x_40 = mixed.x; + *(tint_symbol_4) = float4(x_40, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..cfefd60abf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %25 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %mixed "mixed" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_1 = OpConstant %float 1 + %27 = OpConstantComposite %v2float %float_1 %float_1 + %float_0_5 = OpConstant %float 0.5 + %29 = OpConstantComposite %v2float %float_0_5 %float_0_5 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %mixed = OpVariable %_ptr_Function_v2float Function %18 + %22 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %23 = OpLoad %v2float %22 + %24 = OpExtInst %v2float %25 FMix %27 %23 %29 + OpStore %mixed %24 + %30 = OpLoad %v2float %mixed + %33 = OpFOrdEqual %v2bool %30 %27 + %31 = OpAll %bool %33 + OpSelectionMerge %35 None + OpBranchConditional %31 %36 %37 + %36 = OpLabel + %39 = OpAccessChain %_ptr_Function_float %mixed %uint_0 + %40 = OpLoad %float %39 + %42 = OpCompositeConstruct %v4float %40 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %42 + OpBranch %35 + %37 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %44 +%tint_symbol = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %51 = OpLabel + %52 = OpFunctionCall %void %main_1 + %54 = OpLoad %v4float %x_GLF_color + %55 = OpCompositeConstruct %main_out %54 + %53 = OpFunctionCall %void %tint_symbol_2 %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..04be2cdc67 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.spvasm.expected.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + one : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var mixed : vec2; + let x_30 : vec2 = x_6.one; + mixed = mix(vec2(1.0, 1.0), x_30, vec2(0.5, 0.5)); + let x_33 : vec2 = mixed; + if (all((x_33 == vec2(1.0, 1.0)))) { + let x_40 : f32 = mixed.x; + x_GLF_color = vec4(x_40, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl new file mode 100644 index 0000000000..04be2cdc67 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + one : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var mixed : vec2; + let x_30 : vec2 = x_6.one; + mixed = mix(vec2(1.0, 1.0), x_30, vec2(0.5, 0.5)); + let x_33 : vec2 = mixed; + if (all((x_33 == vec2(1.0, 1.0)))) { + let x_40 : f32 = mixed.x; + x_GLF_color = vec4(x_40, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..e67d2bc795 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 mixed = float2(0.0f, 0.0f); + const float2 x_30 = asfloat(x_6[0].xy); + mixed = lerp(float2(1.0f, 1.0f), x_30, float2(0.5f, 0.5f)); + if (all((mixed == float2(1.0f, 1.0f)))) { + const float x_40 = mixed.x; + x_GLF_color = float4(x_40, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b48da79378 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2 mixed = 0.0f; + float2 const x_30 = x_6.one; + mixed = mix(float2(1.0f, 1.0f), x_30, float2(0.5f, 0.5f)); + float2 const x_33 = mixed; + if (all((x_33 == float2(1.0f, 1.0f)))) { + float const x_40 = mixed.x; + *(tint_symbol_4) = float4(x_40, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..cfefd60abf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + %25 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %mixed "mixed" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_1 = OpConstant %float 1 + %27 = OpConstantComposite %v2float %float_1 %float_1 + %float_0_5 = OpConstant %float 0.5 + %29 = OpConstantComposite %v2float %float_0_5 %float_0_5 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %mixed = OpVariable %_ptr_Function_v2float Function %18 + %22 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %23 = OpLoad %v2float %22 + %24 = OpExtInst %v2float %25 FMix %27 %23 %29 + OpStore %mixed %24 + %30 = OpLoad %v2float %mixed + %33 = OpFOrdEqual %v2bool %30 %27 + %31 = OpAll %bool %33 + OpSelectionMerge %35 None + OpBranchConditional %31 %36 %37 + %36 = OpLabel + %39 = OpAccessChain %_ptr_Function_float %mixed %uint_0 + %40 = OpLoad %float %39 + %42 = OpCompositeConstruct %v4float %40 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %42 + OpBranch %35 + %37 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %44 +%tint_symbol = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %51 = OpLabel + %52 = OpFunctionCall %void %main_1 + %54 = OpLoad %v4float %x_GLF_color + %55 = OpCompositeConstruct %main_out %54 + %53 = OpFunctionCall %void %tint_symbol_2 %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..04be2cdc67 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-constants-mix-uniform/0-opt.wgsl.expected.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + one : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var mixed : vec2; + let x_30 : vec2 = x_6.one; + mixed = mix(vec2(1.0, 1.0), x_30, vec2(0.5, 0.5)); + let x_33 : vec2 = mixed; + if (all((x_33 == vec2(1.0, 1.0)))) { + let x_40 : f32 = mixed.x; + x_GLF_color = vec4(x_40, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm new file mode 100644 index 0000000000..89e69f35a8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm @@ -0,0 +1,109 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "zero" + OpName %__0 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %buf1 = OpTypeStruct %int +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %false = OpConstantFalse %bool + %main = OpFunction %void None %10 + %26 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %28 = OpLoad %int %27 + %29 = OpConvertSToF %float %28 + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %31 = OpLoad %int %30 + %32 = OpConvertSToF %float %31 + %33 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %34 = OpLoad %int %33 + %35 = OpConvertSToF %float %34 + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpConvertSToF %float %37 + %39 = OpCompositeConstruct %v4float %29 %32 %35 %38 + OpStore %_GLF_color %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpIEqual %bool %45 %47 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + OpBranch %42 + %49 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %54 = OpLoad %int %53 + %55 = OpIEqual %bool %52 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + OpBranch %41 + %56 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %61 = OpLoad %int %60 + %62 = OpIEqual %bool %59 %61 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + OpKill + %63 = OpLabel + OpReturn + %42 = OpLabel + OpBranchConditional %false %40 %41 + %41 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + %68 = OpCompositeConstruct %v4float %67 %67 %67 %67 + OpStore %_GLF_color %68 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ad30a5cbb2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,66 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[4]; +}; +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[1]; +}; + +void main_1() { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_28 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_31 = asint(x_5[1].x); + const int x_34 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_37 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_28), float(x_31), float(x_34), float(x_37)); + while (true) { + const int x_45 = asint(x_7[0].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_45 == x_47)) { + { + if (false) { + } else { + break; + } + } + continue; + } + const int x_52 = asint(x_7[0].x); + const int x_54 = asint(x_5[2].x); + if ((x_52 == x_54)) { + break; + } + const int x_59 = asint(x_7[0].x); + const int x_61 = asint(x_5[3].x); + if ((x_59 == x_61)) { + discard; + } + return; + { + if (false) { + } else { + break; + } + } + } + const int x_66 = asint(x_5[1].x); + const float x_67 = float(x_66); + x_GLF_color = float4(x_67, x_67, x_67, x_67); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..fc4bcb7025 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,73 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct buf1 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, constant buf1& x_7, thread float4* const tint_symbol_4) { + int const x_28 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_31 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_34 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_37 = x_5.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_28), float(x_31), float(x_34), float(x_37)); + while (true) { + int const x_45 = x_7.zero; + int const x_47 = x_5.x_GLF_uniform_int_values.arr[0].el; + if ((x_45 == x_47)) { + { + if (false) { + } else { + break; + } + } + continue; + } + int const x_52 = x_7.zero; + int const x_54 = x_5.x_GLF_uniform_int_values.arr[2].el; + if ((x_52 == x_54)) { + break; + } + int const x_59 = x_7.zero; + int const x_61 = x_5.x_GLF_uniform_int_values.arr[3].el; + if ((x_59 == x_61)) { + discard_fragment(); + } + return; + { + if (false) { + } else { + break; + } + } + } + int const x_66 = x_5.x_GLF_uniform_int_values.arr[1].el; + float const x_67 = float(x_66); + *(tint_symbol_4) = float4(x_67, x_67, x_67, x_67); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]], constant buf1& x_7 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4c0d3dcee5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,154 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "zero" + OpName %x_7 "x_7" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %buf1 = OpTypeStruct %int +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %75 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %25 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %26 = OpLoad %int %25 + %28 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %29 = OpLoad %int %28 + %30 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %31 = OpLoad %int %30 + %32 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %33 = OpLoad %int %32 + %34 = OpConvertSToF %float %26 + %35 = OpConvertSToF %float %29 + %36 = OpConvertSToF %float %31 + %37 = OpConvertSToF %float %33 + %38 = OpCompositeConstruct %v4float %34 %35 %36 %37 + OpStore %x_GLF_color %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %44 = OpLoad %int %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpIEqual %bool %44 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %49 + %50 = OpLabel + OpBranch %41 + %49 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %52 = OpLoad %int %51 + %54 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %55 = OpLoad %int %54 + %56 = OpIEqual %bool %52 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + OpBranch %40 + %57 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %60 = OpLoad %int %59 + %62 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_3 + %63 = OpLoad %int %62 + %64 = OpIEqual %bool %60 %63 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + OpKill + %65 = OpLabel + OpReturn + %41 = OpLabel + OpSelectionMerge %68 None + OpBranchConditional %false %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %40 + %68 = OpLabel + OpBranch %39 + %40 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %72 + %74 = OpCompositeConstruct %v4float %73 %73 %73 %73 + OpStore %x_GLF_color %74 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %75 +%tint_symbol = OpFunctionParameter %main_out + %79 = OpLabel + %80 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %80 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %82 = OpLabel + %83 = OpFunctionCall %void %main_1 + %85 = OpLoad %v4float %x_GLF_color + %86 = OpCompositeConstruct %main_out %85 + %84 = OpFunctionCall %void %tint_symbol_2 %86 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 41[%41] is not post dominated by the back-edge block 68[%68] + %68 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..8e2cdde4d2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[block]] +struct buf1 { + zero : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +[[group(0), binding(1)]] var x_7 : buf1; + +fn main_1() { + let x_28 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_31 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_34 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_37 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_28), f32(x_31), f32(x_34), f32(x_37)); + loop { + let x_45 : i32 = x_7.zero; + let x_47 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_45 == x_47)) { + continue; + } + let x_52 : i32 = x_7.zero; + let x_54 : i32 = x_5.x_GLF_uniform_int_values[2]; + if ((x_52 == x_54)) { + break; + } + let x_59 : i32 = x_7.zero; + let x_61 : i32 = x_5.x_GLF_uniform_int_values[3]; + if ((x_59 == x_61)) { + discard; + } + return; + + continuing { + if (false) { + } else { + break; + } + } + } + let x_66 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_67 : f32 = f32(x_66); + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl new file mode 100644 index 0000000000..8e2cdde4d2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[block]] +struct buf1 { + zero : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +[[group(0), binding(1)]] var x_7 : buf1; + +fn main_1() { + let x_28 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_31 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_34 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_37 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_28), f32(x_31), f32(x_34), f32(x_37)); + loop { + let x_45 : i32 = x_7.zero; + let x_47 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_45 == x_47)) { + continue; + } + let x_52 : i32 = x_7.zero; + let x_54 : i32 = x_5.x_GLF_uniform_int_values[2]; + if ((x_52 == x_54)) { + break; + } + let x_59 : i32 = x_7.zero; + let x_61 : i32 = x_5.x_GLF_uniform_int_values[3]; + if ((x_59 == x_61)) { + discard; + } + return; + + continuing { + if (false) { + } else { + break; + } + } + } + let x_66 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_67 : f32 = f32(x_66); + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..ad30a5cbb2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,66 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[4]; +}; +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[1]; +}; + +void main_1() { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_28 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_31 = asint(x_5[1].x); + const int x_34 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_37 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_28), float(x_31), float(x_34), float(x_37)); + while (true) { + const int x_45 = asint(x_7[0].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_45 == x_47)) { + { + if (false) { + } else { + break; + } + } + continue; + } + const int x_52 = asint(x_7[0].x); + const int x_54 = asint(x_5[2].x); + if ((x_52 == x_54)) { + break; + } + const int x_59 = asint(x_7[0].x); + const int x_61 = asint(x_5[3].x); + if ((x_59 == x_61)) { + discard; + } + return; + { + if (false) { + } else { + break; + } + } + } + const int x_66 = asint(x_5[1].x); + const float x_67 = float(x_66); + x_GLF_color = float4(x_67, x_67, x_67, x_67); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..fc4bcb7025 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,73 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct buf1 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, constant buf1& x_7, thread float4* const tint_symbol_4) { + int const x_28 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_31 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_34 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_37 = x_5.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_28), float(x_31), float(x_34), float(x_37)); + while (true) { + int const x_45 = x_7.zero; + int const x_47 = x_5.x_GLF_uniform_int_values.arr[0].el; + if ((x_45 == x_47)) { + { + if (false) { + } else { + break; + } + } + continue; + } + int const x_52 = x_7.zero; + int const x_54 = x_5.x_GLF_uniform_int_values.arr[2].el; + if ((x_52 == x_54)) { + break; + } + int const x_59 = x_7.zero; + int const x_61 = x_5.x_GLF_uniform_int_values.arr[3].el; + if ((x_59 == x_61)) { + discard_fragment(); + } + return; + { + if (false) { + } else { + break; + } + } + } + int const x_66 = x_5.x_GLF_uniform_int_values.arr[1].el; + float const x_67 = float(x_66); + *(tint_symbol_4) = float4(x_67, x_67, x_67, x_67); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]], constant buf1& x_7 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4c0d3dcee5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,154 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "zero" + OpName %x_7 "x_7" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %buf1 = OpTypeStruct %int +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %75 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %25 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %26 = OpLoad %int %25 + %28 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %29 = OpLoad %int %28 + %30 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %31 = OpLoad %int %30 + %32 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %33 = OpLoad %int %32 + %34 = OpConvertSToF %float %26 + %35 = OpConvertSToF %float %29 + %36 = OpConvertSToF %float %31 + %37 = OpConvertSToF %float %33 + %38 = OpCompositeConstruct %v4float %34 %35 %36 %37 + OpStore %x_GLF_color %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %44 = OpLoad %int %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpIEqual %bool %44 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %49 + %50 = OpLabel + OpBranch %41 + %49 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %52 = OpLoad %int %51 + %54 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %55 = OpLoad %int %54 + %56 = OpIEqual %bool %52 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + OpBranch %40 + %57 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %60 = OpLoad %int %59 + %62 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_3 + %63 = OpLoad %int %62 + %64 = OpIEqual %bool %60 %63 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + OpKill + %65 = OpLabel + OpReturn + %41 = OpLabel + OpSelectionMerge %68 None + OpBranchConditional %false %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %40 + %68 = OpLabel + OpBranch %39 + %40 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %72 + %74 = OpCompositeConstruct %v4float %73 %73 %73 %73 + OpStore %x_GLF_color %74 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %75 +%tint_symbol = OpFunctionParameter %main_out + %79 = OpLabel + %80 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %80 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %82 = OpLabel + %83 = OpFunctionCall %void %main_1 + %85 = OpLoad %v4float %x_GLF_color + %86 = OpCompositeConstruct %main_out %85 + %84 = OpFunctionCall %void %tint_symbol_2 %86 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 41[%41] is not post dominated by the back-edge block 68[%68] + %68 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e2cdde4d2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-continue-break-discard-return-in-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[block]] +struct buf1 { + zero : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +[[group(0), binding(1)]] var x_7 : buf1; + +fn main_1() { + let x_28 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_31 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_34 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_37 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_28), f32(x_31), f32(x_34), f32(x_37)); + loop { + let x_45 : i32 = x_7.zero; + let x_47 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_45 == x_47)) { + continue; + } + let x_52 : i32 = x_7.zero; + let x_54 : i32 = x_5.x_GLF_uniform_int_values[2]; + if ((x_52 == x_54)) { + break; + } + let x_59 : i32 = x_7.zero; + let x_61 : i32 = x_5.x_GLF_uniform_int_values[3]; + if ((x_59 == x_61)) { + discard; + } + return; + + continuing { + if (false) { + } else { + break; + } + } + } + let x_66 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_67 : f32 = f32(x_66); + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm new file mode 100644 index 0000000000..ce8174847d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm @@ -0,0 +1,173 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %Array "Array" + OpMemberName %Array 0 "values" + OpName %func_struct_Array_i1_2_1_ "func(struct-Array-i1[2]1;" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %Array 0 RelaxedPrecision + OpDecorate %func_struct_Array_i1_2_1_ RelaxedPrecision + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + %void = OpTypeVoid + %22 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %Array = OpTypeStruct %_arr_int_uint_2 +%_ptr_Function_Array = OpTypePointer Function %Array + %28 = OpTypeFunction %int %_ptr_Function_Array + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_0 = OpConstant %int 0 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %41 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %42 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %45 = OpUndef %Array + %46 = OpUndef %int + %47 = OpUndef %bool + %48 = OpConstantNull %_arr_int_uint_2 + %main = OpFunction %void None %22 + %49 = OpLabel + %50 = OpVariable %_ptr_Function_bool Function %false + %15 = OpVariable %_ptr_Function_int Function + %16 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_Array Function + OpStore %param %45 + OpStore %50 %false + OpBranch %51 + %51 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %17 = OpLoad %int %58 + %59 = OpAccessChain %_ptr_Function_int %param %int_0 %17 + %18 = OpLoad %int %59 + %60 = OpIEqual %bool %18 %int_1 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpStore %50 %true + OpStore %15 %int_1 + OpBranch %55 + %61 = OpLabel + OpBranch %55 + %56 = OpLabel + OpBranch %54 + %55 = OpLabel + %19 = OpPhi %int %int_1 %62 %46 %61 + %63 = OpPhi %bool %true %62 %false %61 + OpSelectionMerge %64 None + OpBranchConditional %63 %52 %64 + %64 = OpLabel + OpStore %50 %true + OpStore %15 %int_1 + OpBranch %52 + %53 = OpLabel + OpBranch %51 + %52 = OpLabel + %20 = OpPhi %int %19 %55 %int_1 %64 + OpStore %16 %20 + %65 = OpIEqual %bool %20 %int_1 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %68 = OpLabel + OpStore %_GLF_color %42 + OpBranch %66 + %67 = OpLabel + OpStore %_GLF_color %41 + OpBranch %66 + %66 = OpLabel + OpReturn + OpFunctionEnd +%func_struct_Array_i1_2_1_ = OpFunction %int None %28 + %a = OpFunctionParameter %_ptr_Function_Array + %69 = OpLabel + %70 = OpVariable %_ptr_Function_bool Function %false + %12 = OpVariable %_ptr_Function_int Function + OpBranch %71 + %71 = OpLabel + %72 = OpPhi %bool %false %69 %47 %73 + OpLoopMerge %74 %73 None + OpBranch %75 + %75 = OpLabel + OpBranch %76 + %76 = OpLabel + %77 = OpPhi %bool %72 %75 %47 %78 + OpLoopMerge %79 %78 None + OpBranch %80 + %80 = OpLabel + OpBranch %81 + %81 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %10 = OpLoad %int %82 + %83 = OpAccessChain %_ptr_Function_int %a %int_0 %10 + %11 = OpLoad %int %83 + %84 = OpIEqual %bool %11 %int_1 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + OpStore %70 %true + OpStore %12 %int_1 + OpBranch %79 + %85 = OpLabel + OpBranch %79 + %78 = OpLabel + OpBranch %76 + %79 = OpLabel + %13 = OpPhi %int %int_1 %86 %46 %85 + %87 = OpPhi %bool %true %86 %77 %85 + OpSelectionMerge %88 None + OpBranchConditional %87 %74 %88 + %88 = OpLabel + OpStore %70 %true + OpStore %12 %int_1 + OpBranch %74 + %73 = OpLabel + OpBranch %71 + %74 = OpLabel + %14 = OpPhi %int %13 %79 %int_1 %88 + OpReturnValue %14 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..fc32950322 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.hlsl @@ -0,0 +1,119 @@ +struct Array { + int values[2]; +}; + +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_50 = false; + int x_15 = 0; + int x_16 = 0; + Array param = (Array)0; + int x_19 = 0; + int x_20_phi = 0; + const int tint_symbol_3[2] = {0, 0}; + const Array tint_symbol_4 = {tint_symbol_3}; + param = tint_symbol_4; + x_50 = false; + while (true) { + int x_19_phi = 0; + bool x_63_phi = false; + while (true) { + const int x_17 = asint(x_8[0].x); + const int x_18 = param.values[x_17]; + if ((x_18 == 1)) { + x_50 = true; + x_15 = 1; + x_19_phi = 1; + x_63_phi = true; + break; + } + x_19_phi = 0; + x_63_phi = false; + break; + } + x_19 = x_19_phi; + const bool x_63 = x_63_phi; + x_20_phi = x_19; + if (x_63) { + break; + } + x_50 = true; + x_15 = 1; + x_20_phi = 1; + break; + } + const int x_20 = x_20_phi; + x_16 = x_20; + if ((x_20 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} + +int func_struct_Array_i1_2_1_(inout Array a) { + bool x_70 = false; + int x_12 = 0; + int x_13 = 0; + bool x_72_phi = false; + int x_14_phi = 0; + x_72_phi = false; + while (true) { + bool x_77 = false; + bool x_77_phi = false; + int x_13_phi = 0; + bool x_87_phi = false; + x_77_phi = x_72_phi; + while (true) { + x_77 = x_77_phi; + const int x_10 = asint(x_8[0].x); + const int x_11 = a.values[x_10]; + if ((x_11 == 1)) { + x_70 = true; + x_12 = 1; + x_13_phi = 1; + x_87_phi = true; + break; + } + x_13_phi = 0; + x_87_phi = x_77; + break; + { + x_77_phi = false; + } + } + x_13 = x_13_phi; + const bool x_87 = x_87_phi; + x_14_phi = x_13; + if (x_87) { + break; + } + x_70 = true; + x_12 = 1; + x_14_phi = 1; + break; + { + x_72_phi = false; + } + } + return x_14_phi; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a3005e8d0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.msl @@ -0,0 +1,126 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[2]; +}; +struct Array { + tint_array_wrapper values; +}; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_6) { + bool x_50 = false; + int x_15 = 0; + int x_16 = 0; + Array param = {}; + int x_19 = 0; + int x_20_phi = 0; + tint_array_wrapper const tint_symbol_3 = {.arr={0, 0}}; + Array const tint_symbol_4 = {.values=tint_symbol_3}; + param = tint_symbol_4; + x_50 = false; + while (true) { + int x_19_phi = 0; + bool x_63_phi = false; + while (true) { + int const x_17 = x_8.zero; + int const x_18 = param.values.arr[x_17]; + if ((x_18 == 1)) { + x_50 = true; + x_15 = 1; + x_19_phi = 1; + x_63_phi = true; + break; + } + x_19_phi = 0; + x_63_phi = false; + break; + } + x_19 = x_19_phi; + bool const x_63 = x_63_phi; + x_20_phi = x_19; + if (x_63) { + break; + } + x_50 = true; + x_15 = 1; + x_20_phi = 1; + break; + } + int const x_20 = x_20_phi; + x_16 = x_20; + if ((x_20 == 1)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + main_1(x_8, &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_5; +} + +int func_struct_Array_i1_2_1_(constant buf0& x_8, thread Array* const a) { + bool x_70 = false; + int x_12 = 0; + int x_13 = 0; + bool x_72_phi = false; + int x_14_phi = 0; + x_72_phi = false; + while (true) { + bool x_77 = false; + bool x_77_phi = false; + int x_13_phi = 0; + bool x_87_phi = false; + bool const x_72 = x_72_phi; + x_77_phi = x_72; + while (true) { + x_77 = x_77_phi; + int const x_10 = x_8.zero; + int const x_11 = (*(a)).values.arr[x_10]; + if ((x_11 == 1)) { + x_70 = true; + x_12 = 1; + x_13_phi = 1; + x_87_phi = true; + break; + } + x_13_phi = 0; + x_87_phi = x_77; + break; + { + x_77_phi = false; + } + } + x_13 = x_13_phi; + bool const x_87 = x_87_phi; + x_14_phi = x_13; + if (x_87) { + break; + } + x_70 = true; + x_12 = 1; + x_14_phi = 1; + break; + { + x_72_phi = false; + } + } + int const x_14 = x_14_phi; + return x_14; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b34c57907c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.spvasm @@ -0,0 +1,249 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 122 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_50 "x_50" + OpName %x_15 "x_15" + OpName %x_16 "x_16" + OpName %Array "Array" + OpMemberName %Array 0 "values" + OpName %param "param" + OpName %x_19 "x_19" + OpName %x_20_phi "x_20_phi" + OpName %x_19_phi "x_19_phi" + OpName %x_63_phi "x_63_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %func_struct_Array_i1_2_1_ "func_struct_Array_i1_2_1_" + OpName %a "a" + OpName %x_70 "x_70" + OpName %x_12 "x_12" + OpName %x_13 "x_13" + OpName %x_72_phi "x_72_phi" + OpName %x_14_phi "x_14_phi" + OpName %x_77 "x_77" + OpName %x_77_phi "x_77_phi" + OpName %x_13_phi "x_13_phi" + OpName %x_87_phi "x_87_phi" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %Array 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpConstantNull %bool +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %Array = OpTypeStruct %_arr_int_uint_2 +%_ptr_Function_Array = OpTypePointer Function %Array + %31 = OpConstantNull %Array + %int_0 = OpConstant %int 0 + %35 = OpConstantComposite %_arr_int_uint_2 %int_0 %int_0 + %36 = OpConstantComposite %Array %35 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %70 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %71 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %72 = OpTypeFunction %void %main_out + %84 = OpTypeFunction %int %_ptr_Function_Array + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_50 = OpVariable %_ptr_Function_bool Function %20 + %x_15 = OpVariable %_ptr_Function_int Function %23 + %x_16 = OpVariable %_ptr_Function_int Function %23 + %param = OpVariable %_ptr_Function_Array Function %31 + %x_19 = OpVariable %_ptr_Function_int Function %23 + %x_20_phi = OpVariable %_ptr_Function_int Function %23 + %x_19_phi = OpVariable %_ptr_Function_int Function %23 + %x_63_phi = OpVariable %_ptr_Function_bool Function %20 + OpStore %x_50 %false + OpStore %param %36 + OpStore %x_50 %false + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + OpBranch %43 + %43 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Function_int %param %uint_0 %50 + %52 = OpLoad %int %51 + %54 = OpIEqual %bool %52 %int_1 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + OpStore %x_50 %true + OpStore %x_15 %int_1 + OpStore %x_19_phi %int_1 + OpStore %x_63_phi %true + OpBranch %44 + %55 = OpLabel + OpStore %x_19_phi %int_0 + OpStore %x_63_phi %false + OpBranch %44 + %45 = OpLabel + OpBranch %43 + %44 = OpLabel + %58 = OpLoad %int %x_19_phi + OpStore %x_19 %58 + %59 = OpLoad %bool %x_63_phi + %60 = OpLoad %int %x_19 + OpStore %x_20_phi %60 + OpSelectionMerge %61 None + OpBranchConditional %59 %62 %61 + %62 = OpLabel + OpBranch %38 + %61 = OpLabel + OpStore %x_50 %true + OpStore %x_15 %int_1 + OpStore %x_20_phi %int_1 + OpBranch %38 + %39 = OpLabel + OpBranch %37 + %38 = OpLabel + %63 = OpLoad %int %x_20_phi + OpStore %x_16 %63 + %64 = OpIEqual %bool %63 %int_1 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %67 + %66 = OpLabel + OpStore %x_GLF_color %70 + OpBranch %65 + %67 = OpLabel + OpStore %x_GLF_color %71 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %72 +%tint_symbol = OpFunctionParameter %main_out + %76 = OpLabel + %77 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %77 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %79 = OpLabel + %80 = OpFunctionCall %void %main_1 + %82 = OpLoad %v4float %x_GLF_color + %83 = OpCompositeConstruct %main_out %82 + %81 = OpFunctionCall %void %tint_symbol_2 %83 + OpReturn + OpFunctionEnd +%func_struct_Array_i1_2_1_ = OpFunction %int None %84 + %a = OpFunctionParameter %_ptr_Function_Array + %87 = OpLabel + %x_70 = OpVariable %_ptr_Function_bool Function %20 + %x_12 = OpVariable %_ptr_Function_int Function %23 + %x_13 = OpVariable %_ptr_Function_int Function %23 + %x_72_phi = OpVariable %_ptr_Function_bool Function %20 + %x_14_phi = OpVariable %_ptr_Function_int Function %23 + %x_77 = OpVariable %_ptr_Function_bool Function %20 + %x_77_phi = OpVariable %_ptr_Function_bool Function %20 + %x_13_phi = OpVariable %_ptr_Function_int Function %23 + %x_87_phi = OpVariable %_ptr_Function_bool Function %20 + OpStore %x_70 %false + OpStore %x_72_phi %false + OpBranch %93 + %93 = OpLabel + OpLoopMerge %94 %95 None + OpBranch %96 + %96 = OpLabel + %101 = OpLoad %bool %x_72_phi + OpStore %x_77_phi %101 + OpBranch %102 + %102 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %bool %x_77_phi + OpStore %x_77 %106 + %107 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %108 = OpLoad %int %107 + %110 = OpAccessChain %_ptr_Function_int %a %uint_0 %108 + %111 = OpLoad %int %110 + %112 = OpIEqual %bool %111 %int_1 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + OpStore %x_70 %true + OpStore %x_12 %int_1 + OpStore %x_13_phi %int_1 + OpStore %x_87_phi %true + OpBranch %103 + %113 = OpLabel + OpStore %x_13_phi %int_0 + %115 = OpLoad %bool %x_77 + OpStore %x_87_phi %115 + OpBranch %103 + %104 = OpLabel + OpStore %x_77_phi %false + OpBranch %102 + %103 = OpLabel + %116 = OpLoad %int %x_13_phi + OpStore %x_13 %116 + %117 = OpLoad %bool %x_87_phi + %118 = OpLoad %int %x_13 + OpStore %x_14_phi %118 + OpSelectionMerge %119 None + OpBranchConditional %117 %120 %119 + %120 = OpLabel + OpBranch %94 + %119 = OpLabel + OpStore %x_70 %true + OpStore %x_12 %int_1 + OpStore %x_14_phi %int_1 + OpBranch %94 + %95 = OpLabel + OpStore %x_72_phi %false + OpBranch %93 + %94 = OpLabel + %121 = OpLoad %int %x_14_phi + OpReturnValue %121 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c3fe68b100 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.spvasm.expected.wgsl @@ -0,0 +1,122 @@ +struct Array { + values : array; +}; + +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_50 : bool = false; + var x_15 : i32; + var x_16 : i32; + var param : Array; + var x_19 : i32; + var x_20_phi : i32; + param = Array(array(0, 0)); + x_50 = false; + loop { + var x_19_phi : i32; + var x_63_phi : bool; + loop { + let x_17 : i32 = x_8.zero; + let x_18 : i32 = param.values[x_17]; + if ((x_18 == 1)) { + x_50 = true; + x_15 = 1; + x_19_phi = 1; + x_63_phi = true; + break; + } + x_19_phi = 0; + x_63_phi = false; + break; + } + x_19 = x_19_phi; + let x_63 : bool = x_63_phi; + x_20_phi = x_19; + if (x_63) { + break; + } + x_50 = true; + x_15 = 1; + x_20_phi = 1; + break; + } + let x_20 : i32 = x_20_phi; + x_16 = x_20; + if ((x_20 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_struct_Array_i1_2_1_(a : ptr) -> i32 { + var x_70 : bool = false; + var x_12 : i32; + var x_13 : i32; + var x_72_phi : bool; + var x_14_phi : i32; + x_72_phi = false; + loop { + var x_77 : bool; + var x_77_phi : bool; + var x_13_phi : i32; + var x_87_phi : bool; + let x_72 : bool = x_72_phi; + x_77_phi = x_72; + loop { + x_77 = x_77_phi; + let x_10 : i32 = x_8.zero; + let x_11 : i32 = (*(a)).values[x_10]; + if ((x_11 == 1)) { + x_70 = true; + x_12 = 1; + x_13_phi = 1; + x_87_phi = true; + break; + } + x_13_phi = 0; + x_87_phi = x_77; + break; + + continuing { + x_77_phi = false; + } + } + x_13 = x_13_phi; + let x_87 : bool = x_87_phi; + x_14_phi = x_13; + if (x_87) { + break; + } + x_70 = true; + x_12 = 1; + x_14_phi = 1; + break; + + continuing { + x_72_phi = false; + } + } + let x_14 : i32 = x_14_phi; + return x_14; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl new file mode 100644 index 0000000000..c3fe68b100 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl @@ -0,0 +1,122 @@ +struct Array { + values : array; +}; + +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_50 : bool = false; + var x_15 : i32; + var x_16 : i32; + var param : Array; + var x_19 : i32; + var x_20_phi : i32; + param = Array(array(0, 0)); + x_50 = false; + loop { + var x_19_phi : i32; + var x_63_phi : bool; + loop { + let x_17 : i32 = x_8.zero; + let x_18 : i32 = param.values[x_17]; + if ((x_18 == 1)) { + x_50 = true; + x_15 = 1; + x_19_phi = 1; + x_63_phi = true; + break; + } + x_19_phi = 0; + x_63_phi = false; + break; + } + x_19 = x_19_phi; + let x_63 : bool = x_63_phi; + x_20_phi = x_19; + if (x_63) { + break; + } + x_50 = true; + x_15 = 1; + x_20_phi = 1; + break; + } + let x_20 : i32 = x_20_phi; + x_16 = x_20; + if ((x_20 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_struct_Array_i1_2_1_(a : ptr) -> i32 { + var x_70 : bool = false; + var x_12 : i32; + var x_13 : i32; + var x_72_phi : bool; + var x_14_phi : i32; + x_72_phi = false; + loop { + var x_77 : bool; + var x_77_phi : bool; + var x_13_phi : i32; + var x_87_phi : bool; + let x_72 : bool = x_72_phi; + x_77_phi = x_72; + loop { + x_77 = x_77_phi; + let x_10 : i32 = x_8.zero; + let x_11 : i32 = (*(a)).values[x_10]; + if ((x_11 == 1)) { + x_70 = true; + x_12 = 1; + x_13_phi = 1; + x_87_phi = true; + break; + } + x_13_phi = 0; + x_87_phi = x_77; + break; + + continuing { + x_77_phi = false; + } + } + x_13 = x_13_phi; + let x_87 : bool = x_87_phi; + x_14_phi = x_13; + if (x_87) { + break; + } + x_70 = true; + x_12 = 1; + x_14_phi = 1; + break; + + continuing { + x_72_phi = false; + } + } + let x_14 : i32 = x_14_phi; + return x_14; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..fc32950322 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.hlsl @@ -0,0 +1,119 @@ +struct Array { + int values[2]; +}; + +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_50 = false; + int x_15 = 0; + int x_16 = 0; + Array param = (Array)0; + int x_19 = 0; + int x_20_phi = 0; + const int tint_symbol_3[2] = {0, 0}; + const Array tint_symbol_4 = {tint_symbol_3}; + param = tint_symbol_4; + x_50 = false; + while (true) { + int x_19_phi = 0; + bool x_63_phi = false; + while (true) { + const int x_17 = asint(x_8[0].x); + const int x_18 = param.values[x_17]; + if ((x_18 == 1)) { + x_50 = true; + x_15 = 1; + x_19_phi = 1; + x_63_phi = true; + break; + } + x_19_phi = 0; + x_63_phi = false; + break; + } + x_19 = x_19_phi; + const bool x_63 = x_63_phi; + x_20_phi = x_19; + if (x_63) { + break; + } + x_50 = true; + x_15 = 1; + x_20_phi = 1; + break; + } + const int x_20 = x_20_phi; + x_16 = x_20; + if ((x_20 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} + +int func_struct_Array_i1_2_1_(inout Array a) { + bool x_70 = false; + int x_12 = 0; + int x_13 = 0; + bool x_72_phi = false; + int x_14_phi = 0; + x_72_phi = false; + while (true) { + bool x_77 = false; + bool x_77_phi = false; + int x_13_phi = 0; + bool x_87_phi = false; + x_77_phi = x_72_phi; + while (true) { + x_77 = x_77_phi; + const int x_10 = asint(x_8[0].x); + const int x_11 = a.values[x_10]; + if ((x_11 == 1)) { + x_70 = true; + x_12 = 1; + x_13_phi = 1; + x_87_phi = true; + break; + } + x_13_phi = 0; + x_87_phi = x_77; + break; + { + x_77_phi = false; + } + } + x_13 = x_13_phi; + const bool x_87 = x_87_phi; + x_14_phi = x_13; + if (x_87) { + break; + } + x_70 = true; + x_12 = 1; + x_14_phi = 1; + break; + { + x_72_phi = false; + } + } + return x_14_phi; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a3005e8d0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.msl @@ -0,0 +1,126 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[2]; +}; +struct Array { + tint_array_wrapper values; +}; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_6) { + bool x_50 = false; + int x_15 = 0; + int x_16 = 0; + Array param = {}; + int x_19 = 0; + int x_20_phi = 0; + tint_array_wrapper const tint_symbol_3 = {.arr={0, 0}}; + Array const tint_symbol_4 = {.values=tint_symbol_3}; + param = tint_symbol_4; + x_50 = false; + while (true) { + int x_19_phi = 0; + bool x_63_phi = false; + while (true) { + int const x_17 = x_8.zero; + int const x_18 = param.values.arr[x_17]; + if ((x_18 == 1)) { + x_50 = true; + x_15 = 1; + x_19_phi = 1; + x_63_phi = true; + break; + } + x_19_phi = 0; + x_63_phi = false; + break; + } + x_19 = x_19_phi; + bool const x_63 = x_63_phi; + x_20_phi = x_19; + if (x_63) { + break; + } + x_50 = true; + x_15 = 1; + x_20_phi = 1; + break; + } + int const x_20 = x_20_phi; + x_16 = x_20; + if ((x_20 == 1)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + main_1(x_8, &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_5; +} + +int func_struct_Array_i1_2_1_(constant buf0& x_8, thread Array* const a) { + bool x_70 = false; + int x_12 = 0; + int x_13 = 0; + bool x_72_phi = false; + int x_14_phi = 0; + x_72_phi = false; + while (true) { + bool x_77 = false; + bool x_77_phi = false; + int x_13_phi = 0; + bool x_87_phi = false; + bool const x_72 = x_72_phi; + x_77_phi = x_72; + while (true) { + x_77 = x_77_phi; + int const x_10 = x_8.zero; + int const x_11 = (*(a)).values.arr[x_10]; + if ((x_11 == 1)) { + x_70 = true; + x_12 = 1; + x_13_phi = 1; + x_87_phi = true; + break; + } + x_13_phi = 0; + x_87_phi = x_77; + break; + { + x_77_phi = false; + } + } + x_13 = x_13_phi; + bool const x_87 = x_87_phi; + x_14_phi = x_13; + if (x_87) { + break; + } + x_70 = true; + x_12 = 1; + x_14_phi = 1; + break; + { + x_72_phi = false; + } + } + int const x_14 = x_14_phi; + return x_14; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b34c57907c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.spvasm @@ -0,0 +1,249 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 122 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_50 "x_50" + OpName %x_15 "x_15" + OpName %x_16 "x_16" + OpName %Array "Array" + OpMemberName %Array 0 "values" + OpName %param "param" + OpName %x_19 "x_19" + OpName %x_20_phi "x_20_phi" + OpName %x_19_phi "x_19_phi" + OpName %x_63_phi "x_63_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %func_struct_Array_i1_2_1_ "func_struct_Array_i1_2_1_" + OpName %a "a" + OpName %x_70 "x_70" + OpName %x_12 "x_12" + OpName %x_13 "x_13" + OpName %x_72_phi "x_72_phi" + OpName %x_14_phi "x_14_phi" + OpName %x_77 "x_77" + OpName %x_77_phi "x_77_phi" + OpName %x_13_phi "x_13_phi" + OpName %x_87_phi "x_87_phi" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %Array 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpConstantNull %bool +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %Array = OpTypeStruct %_arr_int_uint_2 +%_ptr_Function_Array = OpTypePointer Function %Array + %31 = OpConstantNull %Array + %int_0 = OpConstant %int 0 + %35 = OpConstantComposite %_arr_int_uint_2 %int_0 %int_0 + %36 = OpConstantComposite %Array %35 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %70 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %71 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %72 = OpTypeFunction %void %main_out + %84 = OpTypeFunction %int %_ptr_Function_Array + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_50 = OpVariable %_ptr_Function_bool Function %20 + %x_15 = OpVariable %_ptr_Function_int Function %23 + %x_16 = OpVariable %_ptr_Function_int Function %23 + %param = OpVariable %_ptr_Function_Array Function %31 + %x_19 = OpVariable %_ptr_Function_int Function %23 + %x_20_phi = OpVariable %_ptr_Function_int Function %23 + %x_19_phi = OpVariable %_ptr_Function_int Function %23 + %x_63_phi = OpVariable %_ptr_Function_bool Function %20 + OpStore %x_50 %false + OpStore %param %36 + OpStore %x_50 %false + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + OpBranch %43 + %43 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Function_int %param %uint_0 %50 + %52 = OpLoad %int %51 + %54 = OpIEqual %bool %52 %int_1 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + OpStore %x_50 %true + OpStore %x_15 %int_1 + OpStore %x_19_phi %int_1 + OpStore %x_63_phi %true + OpBranch %44 + %55 = OpLabel + OpStore %x_19_phi %int_0 + OpStore %x_63_phi %false + OpBranch %44 + %45 = OpLabel + OpBranch %43 + %44 = OpLabel + %58 = OpLoad %int %x_19_phi + OpStore %x_19 %58 + %59 = OpLoad %bool %x_63_phi + %60 = OpLoad %int %x_19 + OpStore %x_20_phi %60 + OpSelectionMerge %61 None + OpBranchConditional %59 %62 %61 + %62 = OpLabel + OpBranch %38 + %61 = OpLabel + OpStore %x_50 %true + OpStore %x_15 %int_1 + OpStore %x_20_phi %int_1 + OpBranch %38 + %39 = OpLabel + OpBranch %37 + %38 = OpLabel + %63 = OpLoad %int %x_20_phi + OpStore %x_16 %63 + %64 = OpIEqual %bool %63 %int_1 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %67 + %66 = OpLabel + OpStore %x_GLF_color %70 + OpBranch %65 + %67 = OpLabel + OpStore %x_GLF_color %71 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %72 +%tint_symbol = OpFunctionParameter %main_out + %76 = OpLabel + %77 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %77 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %79 = OpLabel + %80 = OpFunctionCall %void %main_1 + %82 = OpLoad %v4float %x_GLF_color + %83 = OpCompositeConstruct %main_out %82 + %81 = OpFunctionCall %void %tint_symbol_2 %83 + OpReturn + OpFunctionEnd +%func_struct_Array_i1_2_1_ = OpFunction %int None %84 + %a = OpFunctionParameter %_ptr_Function_Array + %87 = OpLabel + %x_70 = OpVariable %_ptr_Function_bool Function %20 + %x_12 = OpVariable %_ptr_Function_int Function %23 + %x_13 = OpVariable %_ptr_Function_int Function %23 + %x_72_phi = OpVariable %_ptr_Function_bool Function %20 + %x_14_phi = OpVariable %_ptr_Function_int Function %23 + %x_77 = OpVariable %_ptr_Function_bool Function %20 + %x_77_phi = OpVariable %_ptr_Function_bool Function %20 + %x_13_phi = OpVariable %_ptr_Function_int Function %23 + %x_87_phi = OpVariable %_ptr_Function_bool Function %20 + OpStore %x_70 %false + OpStore %x_72_phi %false + OpBranch %93 + %93 = OpLabel + OpLoopMerge %94 %95 None + OpBranch %96 + %96 = OpLabel + %101 = OpLoad %bool %x_72_phi + OpStore %x_77_phi %101 + OpBranch %102 + %102 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpLoad %bool %x_77_phi + OpStore %x_77 %106 + %107 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %108 = OpLoad %int %107 + %110 = OpAccessChain %_ptr_Function_int %a %uint_0 %108 + %111 = OpLoad %int %110 + %112 = OpIEqual %bool %111 %int_1 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + OpStore %x_70 %true + OpStore %x_12 %int_1 + OpStore %x_13_phi %int_1 + OpStore %x_87_phi %true + OpBranch %103 + %113 = OpLabel + OpStore %x_13_phi %int_0 + %115 = OpLoad %bool %x_77 + OpStore %x_87_phi %115 + OpBranch %103 + %104 = OpLabel + OpStore %x_77_phi %false + OpBranch %102 + %103 = OpLabel + %116 = OpLoad %int %x_13_phi + OpStore %x_13 %116 + %117 = OpLoad %bool %x_87_phi + %118 = OpLoad %int %x_13 + OpStore %x_14_phi %118 + OpSelectionMerge %119 None + OpBranchConditional %117 %120 %119 + %120 = OpLabel + OpBranch %94 + %119 = OpLabel + OpStore %x_70 %true + OpStore %x_12 %int_1 + OpStore %x_14_phi %int_1 + OpBranch %94 + %95 = OpLabel + OpStore %x_72_phi %false + OpBranch %93 + %94 = OpLabel + %121 = OpLoad %int %x_14_phi + OpReturnValue %121 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c3fe68b100 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-func-argument/0-opt.wgsl.expected.wgsl @@ -0,0 +1,122 @@ +struct Array { + values : array; +}; + +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_50 : bool = false; + var x_15 : i32; + var x_16 : i32; + var param : Array; + var x_19 : i32; + var x_20_phi : i32; + param = Array(array(0, 0)); + x_50 = false; + loop { + var x_19_phi : i32; + var x_63_phi : bool; + loop { + let x_17 : i32 = x_8.zero; + let x_18 : i32 = param.values[x_17]; + if ((x_18 == 1)) { + x_50 = true; + x_15 = 1; + x_19_phi = 1; + x_63_phi = true; + break; + } + x_19_phi = 0; + x_63_phi = false; + break; + } + x_19 = x_19_phi; + let x_63 : bool = x_63_phi; + x_20_phi = x_19; + if (x_63) { + break; + } + x_50 = true; + x_15 = 1; + x_20_phi = 1; + break; + } + let x_20 : i32 = x_20_phi; + x_16 = x_20; + if ((x_20 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_struct_Array_i1_2_1_(a : ptr) -> i32 { + var x_70 : bool = false; + var x_12 : i32; + var x_13 : i32; + var x_72_phi : bool; + var x_14_phi : i32; + x_72_phi = false; + loop { + var x_77 : bool; + var x_77_phi : bool; + var x_13_phi : i32; + var x_87_phi : bool; + let x_72 : bool = x_72_phi; + x_77_phi = x_72; + loop { + x_77 = x_77_phi; + let x_10 : i32 = x_8.zero; + let x_11 : i32 = (*(a)).values[x_10]; + if ((x_11 == 1)) { + x_70 = true; + x_12 = 1; + x_13_phi = 1; + x_87_phi = true; + break; + } + x_13_phi = 0; + x_87_phi = x_77; + break; + + continuing { + x_77_phi = false; + } + } + x_13 = x_13_phi; + let x_87 : bool = x_87_phi; + x_14_phi = x_13; + if (x_87) { + break; + } + x_70 = true; + x_12 = 1; + x_14_phi = 1; + break; + + continuing { + x_72_phi = false; + } + } + let x_14 : i32 = x_14_phi; + return x_14; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm new file mode 100644 index 0000000000..ba041ef09e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm @@ -0,0 +1,77 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %Array "Array" + OpMemberName %Array 0 "values" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %b "b" + OpName %one "one" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %Array 0 RelaxedPrecision + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %Array = OpTypeStruct %_arr_int_uint_2 +%_ptr_Function_Array = OpTypePointer Function %Array + %int_0 = OpConstant %int 0 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %32 = OpLabel + %a = OpVariable %_ptr_Function_Array Function + %b = OpVariable %_ptr_Function_Array Function + %one = OpVariable %_ptr_Function_float Function + %33 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %10 = OpLoad %int %33 + %34 = OpAccessChain %_ptr_Function_int %a %int_0 %10 + OpStore %34 %int_1 + %35 = OpLoad %Array %a + OpStore %b %35 + OpStore %one %float_0 + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %11 = OpLoad %int %36 + %37 = OpAccessChain %_ptr_Function_int %b %int_0 %11 + %12 = OpLoad %int %37 + %38 = OpIEqual %bool %12 %int_1 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %39 + %40 = OpLabel + OpStore %one %float_1 + OpBranch %39 + %39 = OpLabel + %41 = OpLoad %float %one + %42 = OpCompositeConstruct %v4float %41 %float_0 %float_0 %float_1 + OpStore %_GLF_color %42 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3be4868932 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.hlsl @@ -0,0 +1,39 @@ +struct Array { + int values[2]; +}; + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + Array a = (Array)0; + Array b = (Array)0; + float one = 0.0f; + const int x_10 = asint(x_7[0].x); + a.values[x_10] = 1; + b = a; + one = 0.0f; + const int x_11 = asint(x_7[0].x); + const int x_12 = b.values[x_11]; + if ((x_12 == 1)) { + one = 1.0f; + } + x_GLF_color = float4(one, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..92b1932fae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[2]; +}; +struct Array { + tint_array_wrapper values; +}; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + Array a = {}; + Array b = {}; + float one = 0.0f; + int const x_10 = x_7.zero; + a.values.arr[x_10] = 1; + Array const x_35 = a; + b = x_35; + one = 0.0f; + int const x_11 = x_7.zero; + int const x_12 = b.values.arr[x_11]; + if ((x_12 == 1)) { + one = 1.0f; + } + float const x_41 = one; + *(tint_symbol_4) = float4(x_41, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..71364d1190 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %Array "Array" + OpMemberName %Array 0 "values" + OpName %a "a" + OpName %b "b" + OpName %one "one" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %Array 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %Array = OpTypeStruct %_arr_int_uint_2 +%_ptr_Function_Array = OpTypePointer Function %Array + %22 = OpConstantNull %Array +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %47 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_Array Function %22 + %b = OpVariable %_ptr_Function_Array Function %22 + %one = OpVariable %_ptr_Function_float Function %26 + %29 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %30 = OpLoad %int %29 + %32 = OpAccessChain %_ptr_Function_int %a %uint_0 %30 + OpStore %32 %int_1 + %34 = OpLoad %Array %a + OpStore %b %34 + OpStore %one %float_0 + %36 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %37 = OpLoad %int %36 + %38 = OpAccessChain %_ptr_Function_int %b %uint_0 %37 + %39 = OpLoad %int %38 + %40 = OpIEqual %bool %39 %int_1 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %42 + %43 = OpLabel + OpStore %one %float_1 + OpBranch %42 + %42 = OpLabel + %45 = OpLoad %float %one + %46 = OpCompositeConstruct %v4float %45 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %46 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %47 +%tint_symbol = OpFunctionParameter %main_out + %51 = OpLabel + %52 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %52 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %54 = OpLabel + %55 = OpFunctionCall %void %main_1 + %57 = OpLoad %v4float %x_GLF_color + %58 = OpCompositeConstruct %main_out %57 + %56 = OpFunctionCall %void %tint_symbol_2 %58 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..6e13d32387 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.wgsl @@ -0,0 +1,42 @@ +struct Array { + values : array; +}; + +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : Array; + var b : Array; + var one : f32; + let x_10 : i32 = x_7.zero; + a.values[x_10] = 1; + let x_35 : Array = a; + b = x_35; + one = 0.0; + let x_11 : i32 = x_7.zero; + let x_12 : i32 = b.values[x_11]; + if ((x_12 == 1)) { + one = 1.0; + } + let x_41 : f32 = one; + x_GLF_color = vec4(x_41, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl new file mode 100644 index 0000000000..6e13d32387 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl @@ -0,0 +1,42 @@ +struct Array { + values : array; +}; + +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : Array; + var b : Array; + var one : f32; + let x_10 : i32 = x_7.zero; + a.values[x_10] = 1; + let x_35 : Array = a; + b = x_35; + one = 0.0; + let x_11 : i32 = x_7.zero; + let x_12 : i32 = b.values[x_11]; + if ((x_12 == 1)) { + one = 1.0; + } + let x_41 : f32 = one; + x_GLF_color = vec4(x_41, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3be4868932 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.hlsl @@ -0,0 +1,39 @@ +struct Array { + int values[2]; +}; + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + Array a = (Array)0; + Array b = (Array)0; + float one = 0.0f; + const int x_10 = asint(x_7[0].x); + a.values[x_10] = 1; + b = a; + one = 0.0f; + const int x_11 = asint(x_7[0].x); + const int x_12 = b.values[x_11]; + if ((x_12 == 1)) { + one = 1.0f; + } + x_GLF_color = float4(one, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..92b1932fae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[2]; +}; +struct Array { + tint_array_wrapper values; +}; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + Array a = {}; + Array b = {}; + float one = 0.0f; + int const x_10 = x_7.zero; + a.values.arr[x_10] = 1; + Array const x_35 = a; + b = x_35; + one = 0.0f; + int const x_11 = x_7.zero; + int const x_12 = b.values.arr[x_11]; + if ((x_12 == 1)) { + one = 1.0f; + } + float const x_41 = one; + *(tint_symbol_4) = float4(x_41, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..71364d1190 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %Array "Array" + OpMemberName %Array 0 "values" + OpName %a "a" + OpName %b "b" + OpName %one "one" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %Array 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %Array = OpTypeStruct %_arr_int_uint_2 +%_ptr_Function_Array = OpTypePointer Function %Array + %22 = OpConstantNull %Array +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %47 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_Array Function %22 + %b = OpVariable %_ptr_Function_Array Function %22 + %one = OpVariable %_ptr_Function_float Function %26 + %29 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %30 = OpLoad %int %29 + %32 = OpAccessChain %_ptr_Function_int %a %uint_0 %30 + OpStore %32 %int_1 + %34 = OpLoad %Array %a + OpStore %b %34 + OpStore %one %float_0 + %36 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %37 = OpLoad %int %36 + %38 = OpAccessChain %_ptr_Function_int %b %uint_0 %37 + %39 = OpLoad %int %38 + %40 = OpIEqual %bool %39 %int_1 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %42 + %43 = OpLabel + OpStore %one %float_1 + OpBranch %42 + %42 = OpLabel + %45 = OpLoad %float %one + %46 = OpCompositeConstruct %v4float %45 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %46 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %47 +%tint_symbol = OpFunctionParameter %main_out + %51 = OpLabel + %52 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %52 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %54 = OpLabel + %55 = OpFunctionCall %void %main_1 + %57 = OpLoad %v4float %x_GLF_color + %58 = OpCompositeConstruct %main_out %57 + %56 = OpFunctionCall %void %tint_symbol_2 %58 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..6e13d32387 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.wgsl @@ -0,0 +1,42 @@ +struct Array { + values : array; +}; + +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : Array; + var b : Array; + var one : f32; + let x_10 : i32 = x_7.zero; + a.values[x_10] = 1; + let x_35 : Array = a; + b = x_35; + one = 0.0; + let x_11 : i32 = x_7.zero; + let x_12 : i32 = b.values[x_11]; + if ((x_12 == 1)) { + one = 1.0; + } + let x_41 : f32 = one; + x_GLF_color = vec4(x_41, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm new file mode 100644 index 0000000000..68ef2bed43 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm @@ -0,0 +1,181 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %Array "Array" + OpMemberName %Array 0 "values" + OpName %func_struct_Array_i1_2_1_ "func(struct-Array-i1[2]1;" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %Array 0 RelaxedPrecision + OpDecorate %func_struct_Array_i1_2_1_ RelaxedPrecision + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + %void = OpTypeVoid + %25 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %Array = OpTypeStruct %_arr_int_uint_2 +%_ptr_Function_Array = OpTypePointer Function %Array + %31 = OpTypeFunction %int %_ptr_Function_Array + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_0 = OpConstant %int 0 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_42 = OpConstant %int 42 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %48 = OpUndef %int + %49 = OpUndef %bool +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %main = OpFunction %void None %25 + %51 = OpLabel + %52 = OpVariable %_ptr_Function_bool Function %false + %17 = OpVariable %_ptr_Function_int Function + %18 = OpVariable %_ptr_Function_int Function + %16 = OpVariable %_ptr_Function__arr_int_uint_2 Function + %param = OpVariable %_ptr_Function_Array Function + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %12 = OpLoad %int %53 + %22 = OpLoad %_arr_int_uint_2 %16 + %23 = OpCompositeInsert %_arr_int_uint_2 %12 %22 0 + OpStore %16 %23 + %54 = OpLoad %_arr_int_uint_2 %16 + %55 = OpCompositeConstruct %Array %54 + OpStore %param %55 + OpStore %52 %false + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpAccessChain %_ptr_Function_int %param %int_0 %12 + %19 = OpLoad %int %63 + %64 = OpIEqual %bool %19 %int_0 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + OpStore %52 %true + OpStore %17 %int_42 + OpBranch %60 + %65 = OpLabel + OpBranch %60 + %61 = OpLabel + OpBranch %59 + %60 = OpLabel + %20 = OpPhi %int %int_42 %66 %48 %65 + %67 = OpPhi %bool %true %66 %false %65 + OpSelectionMerge %68 None + OpBranchConditional %67 %57 %68 + %68 = OpLabel + OpStore %52 %true + OpStore %17 %int_42 + OpBranch %57 + %58 = OpLabel + OpBranch %56 + %57 = OpLabel + %21 = OpPhi %int %20 %60 %int_42 %68 + OpStore %18 %21 + %69 = OpIEqual %bool %21 %int_42 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %72 = OpLabel + OpStore %_GLF_color %45 + OpBranch %70 + %71 = OpLabel + OpStore %_GLF_color %44 + OpBranch %70 + %70 = OpLabel + OpReturn + OpFunctionEnd +%func_struct_Array_i1_2_1_ = OpFunction %int None %31 + %a = OpFunctionParameter %_ptr_Function_Array + %73 = OpLabel + %74 = OpVariable %_ptr_Function_bool Function %false + %13 = OpVariable %_ptr_Function_int Function + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %73 %49 %77 + OpLoopMerge %78 %77 None + OpBranch %79 + %79 = OpLabel + OpBranch %80 + %80 = OpLabel + %81 = OpPhi %bool %76 %79 %49 %82 + OpLoopMerge %83 %82 None + OpBranch %84 + %84 = OpLabel + OpBranch %85 + %85 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %10 = OpLoad %int %86 + %87 = OpAccessChain %_ptr_Function_int %a %int_0 %10 + %11 = OpLoad %int %87 + %88 = OpIEqual %bool %11 %int_0 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + OpStore %74 %true + OpStore %13 %int_42 + OpBranch %83 + %89 = OpLabel + OpBranch %83 + %82 = OpLabel + OpBranch %80 + %83 = OpLabel + %14 = OpPhi %int %int_42 %90 %48 %89 + %91 = OpPhi %bool %true %90 %81 %89 + OpSelectionMerge %92 None + OpBranchConditional %91 %78 %92 + %92 = OpLabel + OpStore %74 %true + OpStore %13 %int_42 + OpBranch %78 + %77 = OpLabel + OpBranch %75 + %78 = OpLabel + %15 = OpPhi %int %14 %83 %int_42 %92 + OpReturnValue %15 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..e7e6754715 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.hlsl @@ -0,0 +1,122 @@ +struct Array { + int values[2]; +}; + +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_52 = false; + int x_17 = 0; + int x_18 = 0; + int x_16[2] = (int[2])0; + Array param = (Array)0; + int x_20 = 0; + int x_21_phi = 0; + const int x_12 = asint(x_8[0].x); + int x_23_1[2] = x_16; + x_23_1[0u] = x_12; + x_16 = x_23_1; + const Array tint_symbol_3 = {x_16}; + param = tint_symbol_3; + x_52 = false; + while (true) { + int x_20_phi = 0; + bool x_67_phi = false; + while (true) { + const int x_19 = param.values[x_12]; + if ((x_19 == 0)) { + x_52 = true; + x_17 = 42; + x_20_phi = 42; + x_67_phi = true; + break; + } + x_20_phi = 0; + x_67_phi = false; + break; + } + x_20 = x_20_phi; + const bool x_67 = x_67_phi; + x_21_phi = x_20; + if (x_67) { + break; + } + x_52 = true; + x_17 = 42; + x_21_phi = 42; + break; + } + const int x_21 = x_21_phi; + x_18 = x_21; + if ((x_21 == 42)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} + +int func_struct_Array_i1_2_1_(inout Array a) { + bool x_74 = false; + int x_13 = 0; + int x_14 = 0; + bool x_76_phi = false; + int x_15_phi = 0; + x_76_phi = false; + while (true) { + bool x_81 = false; + bool x_81_phi = false; + int x_14_phi = 0; + bool x_91_phi = false; + x_81_phi = x_76_phi; + while (true) { + x_81 = x_81_phi; + const int x_10 = asint(x_8[0].x); + const int x_11 = a.values[x_10]; + if ((x_11 == 0)) { + x_74 = true; + x_13 = 42; + x_14_phi = 42; + x_91_phi = true; + break; + } + x_14_phi = 0; + x_91_phi = x_81; + break; + { + x_81_phi = false; + } + } + x_14 = x_14_phi; + const bool x_91 = x_91_phi; + x_15_phi = x_14; + if (x_91) { + break; + } + x_74 = true; + x_13 = 42; + x_15_phi = 42; + break; + { + x_76_phi = false; + } + } + return x_15_phi; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d77e25435d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.msl @@ -0,0 +1,132 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[2]; +}; +struct Array { + tint_array_wrapper values; +}; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5) { + bool x_52 = false; + int x_17 = 0; + int x_18 = 0; + tint_array_wrapper x_16 = {}; + Array param = {}; + int x_20 = 0; + int x_21_phi = 0; + int const x_12 = x_8.zero; + tint_array_wrapper const x_22 = x_16; + tint_array_wrapper x_23_1 = x_22; + x_23_1.arr[0u] = x_12; + tint_array_wrapper const x_23 = x_23_1; + x_16 = x_23; + tint_array_wrapper const x_54 = x_16; + Array const tint_symbol_3 = {.values=x_54}; + param = tint_symbol_3; + x_52 = false; + while (true) { + int x_20_phi = 0; + bool x_67_phi = false; + while (true) { + int const x_19 = param.values.arr[x_12]; + if ((x_19 == 0)) { + x_52 = true; + x_17 = 42; + x_20_phi = 42; + x_67_phi = true; + break; + } + x_20_phi = 0; + x_67_phi = false; + break; + } + x_20 = x_20_phi; + bool const x_67 = x_67_phi; + x_21_phi = x_20; + if (x_67) { + break; + } + x_52 = true; + x_17 = 42; + x_21_phi = 42; + break; + } + int const x_21 = x_21_phi; + x_18 = x_21; + if ((x_21 == 42)) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_8, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + +int func_struct_Array_i1_2_1_(constant buf0& x_8, thread Array* const a) { + bool x_74 = false; + int x_13 = 0; + int x_14 = 0; + bool x_76_phi = false; + int x_15_phi = 0; + x_76_phi = false; + while (true) { + bool x_81 = false; + bool x_81_phi = false; + int x_14_phi = 0; + bool x_91_phi = false; + bool const x_76 = x_76_phi; + x_81_phi = x_76; + while (true) { + x_81 = x_81_phi; + int const x_10 = x_8.zero; + int const x_11 = (*(a)).values.arr[x_10]; + if ((x_11 == 0)) { + x_74 = true; + x_13 = 42; + x_14_phi = 42; + x_91_phi = true; + break; + } + x_14_phi = 0; + x_91_phi = x_81; + break; + { + x_81_phi = false; + } + } + x_14 = x_14_phi; + bool const x_91 = x_91_phi; + x_15_phi = x_14; + if (x_91) { + break; + } + x_74 = true; + x_13 = 42; + x_15_phi = 42; + break; + { + x_76_phi = false; + } + } + int const x_15 = x_15_phi; + return x_15; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..83f6e268ae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.spvasm @@ -0,0 +1,261 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 129 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_52 "x_52" + OpName %x_17 "x_17" + OpName %x_18 "x_18" + OpName %x_16 "x_16" + OpName %Array "Array" + OpMemberName %Array 0 "values" + OpName %param "param" + OpName %x_20 "x_20" + OpName %x_21_phi "x_21_phi" + OpName %x_23_1 "x_23_1" + OpName %x_20_phi "x_20_phi" + OpName %x_67_phi "x_67_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %func_struct_Array_i1_2_1_ "func_struct_Array_i1_2_1_" + OpName %a "a" + OpName %x_74 "x_74" + OpName %x_13 "x_13" + OpName %x_14 "x_14" + OpName %x_76_phi "x_76_phi" + OpName %x_15_phi "x_15_phi" + OpName %x_81 "x_81" + OpName %x_81_phi "x_81_phi" + OpName %x_14_phi "x_14_phi" + OpName %x_91_phi "x_91_phi" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %Array 0 Offset 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpConstantNull %bool +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %30 = OpConstantNull %_arr_int_uint_2 + %Array = OpTypeStruct %_arr_int_uint_2 +%_ptr_Function_Array = OpTypePointer Function %Array + %34 = OpConstantNull %Array + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %true = OpConstantTrue %bool + %int_42 = OpConstant %int 42 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %77 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %78 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %79 = OpTypeFunction %void %main_out + %91 = OpTypeFunction %int %_ptr_Function_Array + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_52 = OpVariable %_ptr_Function_bool Function %20 + %x_17 = OpVariable %_ptr_Function_int Function %23 + %x_18 = OpVariable %_ptr_Function_int Function %23 + %x_16 = OpVariable %_ptr_Function__arr_int_uint_2 Function %30 + %param = OpVariable %_ptr_Function_Array Function %34 + %x_20 = OpVariable %_ptr_Function_int Function %23 + %x_21_phi = OpVariable %_ptr_Function_int Function %23 + %x_23_1 = OpVariable %_ptr_Function__arr_int_uint_2 Function %30 + %x_20_phi = OpVariable %_ptr_Function_int Function %23 + %x_67_phi = OpVariable %_ptr_Function_bool Function %20 + OpStore %x_52 %false + %39 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %40 = OpLoad %int %39 + %41 = OpLoad %_arr_int_uint_2 %x_16 + OpStore %x_23_1 %41 + %43 = OpAccessChain %_ptr_Function_int %x_23_1 %uint_0 + OpStore %43 %40 + %44 = OpLoad %_arr_int_uint_2 %x_23_1 + OpStore %x_16 %44 + %45 = OpLoad %_arr_int_uint_2 %x_16 + %46 = OpCompositeConstruct %Array %45 + OpStore %param %46 + OpStore %x_52 %false + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Function_int %param %uint_0 %40 + %58 = OpLoad %int %57 + %60 = OpIEqual %bool %58 %int_0 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpStore %x_52 %true + OpStore %x_17 %int_42 + OpStore %x_20_phi %int_42 + OpStore %x_67_phi %true + OpBranch %54 + %61 = OpLabel + OpStore %x_20_phi %int_0 + OpStore %x_67_phi %false + OpBranch %54 + %55 = OpLabel + OpBranch %53 + %54 = OpLabel + %65 = OpLoad %int %x_20_phi + OpStore %x_20 %65 + %66 = OpLoad %bool %x_67_phi + %67 = OpLoad %int %x_20 + OpStore %x_21_phi %67 + OpSelectionMerge %68 None + OpBranchConditional %66 %69 %68 + %69 = OpLabel + OpBranch %48 + %68 = OpLabel + OpStore %x_52 %true + OpStore %x_17 %int_42 + OpStore %x_21_phi %int_42 + OpBranch %48 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + %70 = OpLoad %int %x_21_phi + OpStore %x_18 %70 + %71 = OpIEqual %bool %70 %int_42 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %74 + %73 = OpLabel + OpStore %x_GLF_color %77 + OpBranch %72 + %74 = OpLabel + OpStore %x_GLF_color %78 + OpBranch %72 + %72 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %79 +%tint_symbol = OpFunctionParameter %main_out + %83 = OpLabel + %84 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %84 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %86 = OpLabel + %87 = OpFunctionCall %void %main_1 + %89 = OpLoad %v4float %x_GLF_color + %90 = OpCompositeConstruct %main_out %89 + %88 = OpFunctionCall %void %tint_symbol_2 %90 + OpReturn + OpFunctionEnd +%func_struct_Array_i1_2_1_ = OpFunction %int None %91 + %a = OpFunctionParameter %_ptr_Function_Array + %94 = OpLabel + %x_74 = OpVariable %_ptr_Function_bool Function %20 + %x_13 = OpVariable %_ptr_Function_int Function %23 + %x_14 = OpVariable %_ptr_Function_int Function %23 + %x_76_phi = OpVariable %_ptr_Function_bool Function %20 + %x_15_phi = OpVariable %_ptr_Function_int Function %23 + %x_81 = OpVariable %_ptr_Function_bool Function %20 + %x_81_phi = OpVariable %_ptr_Function_bool Function %20 + %x_14_phi = OpVariable %_ptr_Function_int Function %23 + %x_91_phi = OpVariable %_ptr_Function_bool Function %20 + OpStore %x_74 %false + OpStore %x_76_phi %false + OpBranch %100 + %100 = OpLabel + OpLoopMerge %101 %102 None + OpBranch %103 + %103 = OpLabel + %108 = OpLoad %bool %x_76_phi + OpStore %x_81_phi %108 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %110 %111 None + OpBranch %112 + %112 = OpLabel + %113 = OpLoad %bool %x_81_phi + OpStore %x_81 %113 + %114 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %115 = OpLoad %int %114 + %117 = OpAccessChain %_ptr_Function_int %a %uint_0 %115 + %118 = OpLoad %int %117 + %119 = OpIEqual %bool %118 %int_0 + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %120 + %121 = OpLabel + OpStore %x_74 %true + OpStore %x_13 %int_42 + OpStore %x_14_phi %int_42 + OpStore %x_91_phi %true + OpBranch %110 + %120 = OpLabel + OpStore %x_14_phi %int_0 + %122 = OpLoad %bool %x_81 + OpStore %x_91_phi %122 + OpBranch %110 + %111 = OpLabel + OpStore %x_81_phi %false + OpBranch %109 + %110 = OpLabel + %123 = OpLoad %int %x_14_phi + OpStore %x_14 %123 + %124 = OpLoad %bool %x_91_phi + %125 = OpLoad %int %x_14 + OpStore %x_15_phi %125 + OpSelectionMerge %126 None + OpBranchConditional %124 %127 %126 + %127 = OpLabel + OpBranch %101 + %126 = OpLabel + OpStore %x_74 %true + OpStore %x_13 %int_42 + OpStore %x_15_phi %int_42 + OpBranch %101 + %102 = OpLabel + OpStore %x_76_phi %false + OpBranch %100 + %101 = OpLabel + %128 = OpLoad %int %x_15_phi + OpReturnValue %128 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..29debc5176 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.spvasm.expected.wgsl @@ -0,0 +1,129 @@ +struct Array { + values : array; +}; + +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_52 : bool = false; + var x_17 : i32; + var x_18 : i32; + var x_16 : array; + var param : Array; + var x_20 : i32; + var x_21_phi : i32; + let x_12 : i32 = x_8.zero; + let x_22 : array = x_16; + var x_23_1 : array = x_22; + x_23_1[0u] = x_12; + let x_23 : array = x_23_1; + x_16 = x_23; + let x_54 : array = x_16; + param = Array(x_54); + x_52 = false; + loop { + var x_20_phi : i32; + var x_67_phi : bool; + loop { + let x_19 : i32 = param.values[x_12]; + if ((x_19 == 0)) { + x_52 = true; + x_17 = 42; + x_20_phi = 42; + x_67_phi = true; + break; + } + x_20_phi = 0; + x_67_phi = false; + break; + } + x_20 = x_20_phi; + let x_67 : bool = x_67_phi; + x_21_phi = x_20; + if (x_67) { + break; + } + x_52 = true; + x_17 = 42; + x_21_phi = 42; + break; + } + let x_21 : i32 = x_21_phi; + x_18 = x_21; + if ((x_21 == 42)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_struct_Array_i1_2_1_(a : ptr) -> i32 { + var x_74 : bool = false; + var x_13 : i32; + var x_14 : i32; + var x_76_phi : bool; + var x_15_phi : i32; + x_76_phi = false; + loop { + var x_81 : bool; + var x_81_phi : bool; + var x_14_phi : i32; + var x_91_phi : bool; + let x_76 : bool = x_76_phi; + x_81_phi = x_76; + loop { + x_81 = x_81_phi; + let x_10 : i32 = x_8.zero; + let x_11 : i32 = (*(a)).values[x_10]; + if ((x_11 == 0)) { + x_74 = true; + x_13 = 42; + x_14_phi = 42; + x_91_phi = true; + break; + } + x_14_phi = 0; + x_91_phi = x_81; + break; + + continuing { + x_81_phi = false; + } + } + x_14 = x_14_phi; + let x_91 : bool = x_91_phi; + x_15_phi = x_14; + if (x_91) { + break; + } + x_74 = true; + x_13 = 42; + x_15_phi = 42; + break; + + continuing { + x_76_phi = false; + } + } + let x_15 : i32 = x_15_phi; + return x_15; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl new file mode 100644 index 0000000000..29debc5176 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl @@ -0,0 +1,129 @@ +struct Array { + values : array; +}; + +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_52 : bool = false; + var x_17 : i32; + var x_18 : i32; + var x_16 : array; + var param : Array; + var x_20 : i32; + var x_21_phi : i32; + let x_12 : i32 = x_8.zero; + let x_22 : array = x_16; + var x_23_1 : array = x_22; + x_23_1[0u] = x_12; + let x_23 : array = x_23_1; + x_16 = x_23; + let x_54 : array = x_16; + param = Array(x_54); + x_52 = false; + loop { + var x_20_phi : i32; + var x_67_phi : bool; + loop { + let x_19 : i32 = param.values[x_12]; + if ((x_19 == 0)) { + x_52 = true; + x_17 = 42; + x_20_phi = 42; + x_67_phi = true; + break; + } + x_20_phi = 0; + x_67_phi = false; + break; + } + x_20 = x_20_phi; + let x_67 : bool = x_67_phi; + x_21_phi = x_20; + if (x_67) { + break; + } + x_52 = true; + x_17 = 42; + x_21_phi = 42; + break; + } + let x_21 : i32 = x_21_phi; + x_18 = x_21; + if ((x_21 == 42)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_struct_Array_i1_2_1_(a : ptr) -> i32 { + var x_74 : bool = false; + var x_13 : i32; + var x_14 : i32; + var x_76_phi : bool; + var x_15_phi : i32; + x_76_phi = false; + loop { + var x_81 : bool; + var x_81_phi : bool; + var x_14_phi : i32; + var x_91_phi : bool; + let x_76 : bool = x_76_phi; + x_81_phi = x_76; + loop { + x_81 = x_81_phi; + let x_10 : i32 = x_8.zero; + let x_11 : i32 = (*(a)).values[x_10]; + if ((x_11 == 0)) { + x_74 = true; + x_13 = 42; + x_14_phi = 42; + x_91_phi = true; + break; + } + x_14_phi = 0; + x_91_phi = x_81; + break; + + continuing { + x_81_phi = false; + } + } + x_14 = x_14_phi; + let x_91 : bool = x_91_phi; + x_15_phi = x_14; + if (x_91) { + break; + } + x_74 = true; + x_13 = 42; + x_15_phi = 42; + break; + + continuing { + x_76_phi = false; + } + } + let x_15 : i32 = x_15_phi; + return x_15; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..e7e6754715 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.hlsl @@ -0,0 +1,122 @@ +struct Array { + int values[2]; +}; + +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_52 = false; + int x_17 = 0; + int x_18 = 0; + int x_16[2] = (int[2])0; + Array param = (Array)0; + int x_20 = 0; + int x_21_phi = 0; + const int x_12 = asint(x_8[0].x); + int x_23_1[2] = x_16; + x_23_1[0u] = x_12; + x_16 = x_23_1; + const Array tint_symbol_3 = {x_16}; + param = tint_symbol_3; + x_52 = false; + while (true) { + int x_20_phi = 0; + bool x_67_phi = false; + while (true) { + const int x_19 = param.values[x_12]; + if ((x_19 == 0)) { + x_52 = true; + x_17 = 42; + x_20_phi = 42; + x_67_phi = true; + break; + } + x_20_phi = 0; + x_67_phi = false; + break; + } + x_20 = x_20_phi; + const bool x_67 = x_67_phi; + x_21_phi = x_20; + if (x_67) { + break; + } + x_52 = true; + x_17 = 42; + x_21_phi = 42; + break; + } + const int x_21 = x_21_phi; + x_18 = x_21; + if ((x_21 == 42)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} + +int func_struct_Array_i1_2_1_(inout Array a) { + bool x_74 = false; + int x_13 = 0; + int x_14 = 0; + bool x_76_phi = false; + int x_15_phi = 0; + x_76_phi = false; + while (true) { + bool x_81 = false; + bool x_81_phi = false; + int x_14_phi = 0; + bool x_91_phi = false; + x_81_phi = x_76_phi; + while (true) { + x_81 = x_81_phi; + const int x_10 = asint(x_8[0].x); + const int x_11 = a.values[x_10]; + if ((x_11 == 0)) { + x_74 = true; + x_13 = 42; + x_14_phi = 42; + x_91_phi = true; + break; + } + x_14_phi = 0; + x_91_phi = x_81; + break; + { + x_81_phi = false; + } + } + x_14 = x_14_phi; + const bool x_91 = x_91_phi; + x_15_phi = x_14; + if (x_91) { + break; + } + x_74 = true; + x_13 = 42; + x_15_phi = 42; + break; + { + x_76_phi = false; + } + } + return x_15_phi; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d77e25435d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.msl @@ -0,0 +1,132 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[2]; +}; +struct Array { + tint_array_wrapper values; +}; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5) { + bool x_52 = false; + int x_17 = 0; + int x_18 = 0; + tint_array_wrapper x_16 = {}; + Array param = {}; + int x_20 = 0; + int x_21_phi = 0; + int const x_12 = x_8.zero; + tint_array_wrapper const x_22 = x_16; + tint_array_wrapper x_23_1 = x_22; + x_23_1.arr[0u] = x_12; + tint_array_wrapper const x_23 = x_23_1; + x_16 = x_23; + tint_array_wrapper const x_54 = x_16; + Array const tint_symbol_3 = {.values=x_54}; + param = tint_symbol_3; + x_52 = false; + while (true) { + int x_20_phi = 0; + bool x_67_phi = false; + while (true) { + int const x_19 = param.values.arr[x_12]; + if ((x_19 == 0)) { + x_52 = true; + x_17 = 42; + x_20_phi = 42; + x_67_phi = true; + break; + } + x_20_phi = 0; + x_67_phi = false; + break; + } + x_20 = x_20_phi; + bool const x_67 = x_67_phi; + x_21_phi = x_20; + if (x_67) { + break; + } + x_52 = true; + x_17 = 42; + x_21_phi = 42; + break; + } + int const x_21 = x_21_phi; + x_18 = x_21; + if ((x_21 == 42)) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_8, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + +int func_struct_Array_i1_2_1_(constant buf0& x_8, thread Array* const a) { + bool x_74 = false; + int x_13 = 0; + int x_14 = 0; + bool x_76_phi = false; + int x_15_phi = 0; + x_76_phi = false; + while (true) { + bool x_81 = false; + bool x_81_phi = false; + int x_14_phi = 0; + bool x_91_phi = false; + bool const x_76 = x_76_phi; + x_81_phi = x_76; + while (true) { + x_81 = x_81_phi; + int const x_10 = x_8.zero; + int const x_11 = (*(a)).values.arr[x_10]; + if ((x_11 == 0)) { + x_74 = true; + x_13 = 42; + x_14_phi = 42; + x_91_phi = true; + break; + } + x_14_phi = 0; + x_91_phi = x_81; + break; + { + x_81_phi = false; + } + } + x_14 = x_14_phi; + bool const x_91 = x_91_phi; + x_15_phi = x_14; + if (x_91) { + break; + } + x_74 = true; + x_13 = 42; + x_15_phi = 42; + break; + { + x_76_phi = false; + } + } + int const x_15 = x_15_phi; + return x_15; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..83f6e268ae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.spvasm @@ -0,0 +1,261 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 129 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_52 "x_52" + OpName %x_17 "x_17" + OpName %x_18 "x_18" + OpName %x_16 "x_16" + OpName %Array "Array" + OpMemberName %Array 0 "values" + OpName %param "param" + OpName %x_20 "x_20" + OpName %x_21_phi "x_21_phi" + OpName %x_23_1 "x_23_1" + OpName %x_20_phi "x_20_phi" + OpName %x_67_phi "x_67_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %func_struct_Array_i1_2_1_ "func_struct_Array_i1_2_1_" + OpName %a "a" + OpName %x_74 "x_74" + OpName %x_13 "x_13" + OpName %x_14 "x_14" + OpName %x_76_phi "x_76_phi" + OpName %x_15_phi "x_15_phi" + OpName %x_81 "x_81" + OpName %x_81_phi "x_81_phi" + OpName %x_14_phi "x_14_phi" + OpName %x_91_phi "x_91_phi" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %Array 0 Offset 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpConstantNull %bool +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %30 = OpConstantNull %_arr_int_uint_2 + %Array = OpTypeStruct %_arr_int_uint_2 +%_ptr_Function_Array = OpTypePointer Function %Array + %34 = OpConstantNull %Array + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %true = OpConstantTrue %bool + %int_42 = OpConstant %int 42 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %77 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %78 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %79 = OpTypeFunction %void %main_out + %91 = OpTypeFunction %int %_ptr_Function_Array + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_52 = OpVariable %_ptr_Function_bool Function %20 + %x_17 = OpVariable %_ptr_Function_int Function %23 + %x_18 = OpVariable %_ptr_Function_int Function %23 + %x_16 = OpVariable %_ptr_Function__arr_int_uint_2 Function %30 + %param = OpVariable %_ptr_Function_Array Function %34 + %x_20 = OpVariable %_ptr_Function_int Function %23 + %x_21_phi = OpVariable %_ptr_Function_int Function %23 + %x_23_1 = OpVariable %_ptr_Function__arr_int_uint_2 Function %30 + %x_20_phi = OpVariable %_ptr_Function_int Function %23 + %x_67_phi = OpVariable %_ptr_Function_bool Function %20 + OpStore %x_52 %false + %39 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %40 = OpLoad %int %39 + %41 = OpLoad %_arr_int_uint_2 %x_16 + OpStore %x_23_1 %41 + %43 = OpAccessChain %_ptr_Function_int %x_23_1 %uint_0 + OpStore %43 %40 + %44 = OpLoad %_arr_int_uint_2 %x_23_1 + OpStore %x_16 %44 + %45 = OpLoad %_arr_int_uint_2 %x_16 + %46 = OpCompositeConstruct %Array %45 + OpStore %param %46 + OpStore %x_52 %false + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Function_int %param %uint_0 %40 + %58 = OpLoad %int %57 + %60 = OpIEqual %bool %58 %int_0 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpStore %x_52 %true + OpStore %x_17 %int_42 + OpStore %x_20_phi %int_42 + OpStore %x_67_phi %true + OpBranch %54 + %61 = OpLabel + OpStore %x_20_phi %int_0 + OpStore %x_67_phi %false + OpBranch %54 + %55 = OpLabel + OpBranch %53 + %54 = OpLabel + %65 = OpLoad %int %x_20_phi + OpStore %x_20 %65 + %66 = OpLoad %bool %x_67_phi + %67 = OpLoad %int %x_20 + OpStore %x_21_phi %67 + OpSelectionMerge %68 None + OpBranchConditional %66 %69 %68 + %69 = OpLabel + OpBranch %48 + %68 = OpLabel + OpStore %x_52 %true + OpStore %x_17 %int_42 + OpStore %x_21_phi %int_42 + OpBranch %48 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + %70 = OpLoad %int %x_21_phi + OpStore %x_18 %70 + %71 = OpIEqual %bool %70 %int_42 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %74 + %73 = OpLabel + OpStore %x_GLF_color %77 + OpBranch %72 + %74 = OpLabel + OpStore %x_GLF_color %78 + OpBranch %72 + %72 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %79 +%tint_symbol = OpFunctionParameter %main_out + %83 = OpLabel + %84 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %84 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %86 = OpLabel + %87 = OpFunctionCall %void %main_1 + %89 = OpLoad %v4float %x_GLF_color + %90 = OpCompositeConstruct %main_out %89 + %88 = OpFunctionCall %void %tint_symbol_2 %90 + OpReturn + OpFunctionEnd +%func_struct_Array_i1_2_1_ = OpFunction %int None %91 + %a = OpFunctionParameter %_ptr_Function_Array + %94 = OpLabel + %x_74 = OpVariable %_ptr_Function_bool Function %20 + %x_13 = OpVariable %_ptr_Function_int Function %23 + %x_14 = OpVariable %_ptr_Function_int Function %23 + %x_76_phi = OpVariable %_ptr_Function_bool Function %20 + %x_15_phi = OpVariable %_ptr_Function_int Function %23 + %x_81 = OpVariable %_ptr_Function_bool Function %20 + %x_81_phi = OpVariable %_ptr_Function_bool Function %20 + %x_14_phi = OpVariable %_ptr_Function_int Function %23 + %x_91_phi = OpVariable %_ptr_Function_bool Function %20 + OpStore %x_74 %false + OpStore %x_76_phi %false + OpBranch %100 + %100 = OpLabel + OpLoopMerge %101 %102 None + OpBranch %103 + %103 = OpLabel + %108 = OpLoad %bool %x_76_phi + OpStore %x_81_phi %108 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %110 %111 None + OpBranch %112 + %112 = OpLabel + %113 = OpLoad %bool %x_81_phi + OpStore %x_81 %113 + %114 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %115 = OpLoad %int %114 + %117 = OpAccessChain %_ptr_Function_int %a %uint_0 %115 + %118 = OpLoad %int %117 + %119 = OpIEqual %bool %118 %int_0 + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %120 + %121 = OpLabel + OpStore %x_74 %true + OpStore %x_13 %int_42 + OpStore %x_14_phi %int_42 + OpStore %x_91_phi %true + OpBranch %110 + %120 = OpLabel + OpStore %x_14_phi %int_0 + %122 = OpLoad %bool %x_81 + OpStore %x_91_phi %122 + OpBranch %110 + %111 = OpLabel + OpStore %x_81_phi %false + OpBranch %109 + %110 = OpLabel + %123 = OpLoad %int %x_14_phi + OpStore %x_14 %123 + %124 = OpLoad %bool %x_91_phi + %125 = OpLoad %int %x_14 + OpStore %x_15_phi %125 + OpSelectionMerge %126 None + OpBranchConditional %124 %127 %126 + %127 = OpLabel + OpBranch %101 + %126 = OpLabel + OpStore %x_74 %true + OpStore %x_13 %int_42 + OpStore %x_15_phi %int_42 + OpBranch %101 + %102 = OpLabel + OpStore %x_76_phi %false + OpBranch %100 + %101 = OpLabel + %128 = OpLoad %int %x_15_phi + OpReturnValue %128 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..29debc5176 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-param-uniform/0-opt.wgsl.expected.wgsl @@ -0,0 +1,129 @@ +struct Array { + values : array; +}; + +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_52 : bool = false; + var x_17 : i32; + var x_18 : i32; + var x_16 : array; + var param : Array; + var x_20 : i32; + var x_21_phi : i32; + let x_12 : i32 = x_8.zero; + let x_22 : array = x_16; + var x_23_1 : array = x_22; + x_23_1[0u] = x_12; + let x_23 : array = x_23_1; + x_16 = x_23; + let x_54 : array = x_16; + param = Array(x_54); + x_52 = false; + loop { + var x_20_phi : i32; + var x_67_phi : bool; + loop { + let x_19 : i32 = param.values[x_12]; + if ((x_19 == 0)) { + x_52 = true; + x_17 = 42; + x_20_phi = 42; + x_67_phi = true; + break; + } + x_20_phi = 0; + x_67_phi = false; + break; + } + x_20 = x_20_phi; + let x_67 : bool = x_67_phi; + x_21_phi = x_20; + if (x_67) { + break; + } + x_52 = true; + x_17 = 42; + x_21_phi = 42; + break; + } + let x_21 : i32 = x_21_phi; + x_18 = x_21; + if ((x_21 == 42)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_struct_Array_i1_2_1_(a : ptr) -> i32 { + var x_74 : bool = false; + var x_13 : i32; + var x_14 : i32; + var x_76_phi : bool; + var x_15_phi : i32; + x_76_phi = false; + loop { + var x_81 : bool; + var x_81_phi : bool; + var x_14_phi : i32; + var x_91_phi : bool; + let x_76 : bool = x_76_phi; + x_81_phi = x_76; + loop { + x_81 = x_81_phi; + let x_10 : i32 = x_8.zero; + let x_11 : i32 = (*(a)).values[x_10]; + if ((x_11 == 0)) { + x_74 = true; + x_13 = 42; + x_14_phi = 42; + x_91_phi = true; + break; + } + x_14_phi = 0; + x_91_phi = x_81; + break; + + continuing { + x_81_phi = false; + } + } + x_14 = x_14_phi; + let x_91 : bool = x_91_phi; + x_15_phi = x_14; + if (x_91) { + break; + } + x_74 = true; + x_13 = 42; + x_15_phi = 42; + break; + + continuing { + x_76_phi = false; + } + } + let x_15 : i32 = x_15_phi; + return x_15; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm new file mode 100644 index 0000000000..2fe322f5d7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm @@ -0,0 +1,76 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %v "v" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_1 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %buf1 = OpTypeStruct %_arr_int_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_2 = OpConstant %uint 2 + %main = OpFunction %void None %12 + %30 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + %31 = OpExtInst %v4float %1 Cosh %17 + %32 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %33 = OpLoad %float %32 + %34 = OpCompositeConstruct %v4float %33 %33 %33 %33 + %35 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1 + %36 = OpExtInst %v4float %1 FClamp %31 %34 %35 + OpStore %v %36 + %37 = OpAccessChain %_ptr_Function_float %v %uint_0 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %40 = OpLoad %int %39 + %41 = OpConvertSToF %float %40 + %42 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %43 + %45 = OpAccessChain %_ptr_Function_float %v %uint_2 + %46 = OpLoad %float %45 + %47 = OpCompositeConstruct %v4float %38 %41 %44 %46 + OpStore %_GLF_color %47 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..7223823836 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.hlsl @@ -0,0 +1,36 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_33 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + v = clamp(cosh(float4(1.0f, 1.0f, 1.0f, 1.0f)), float4(x_33, x_33, x_33, x_33), float4(1.0f, 1.0f, 1.0f, 1.0f)); + const float x_38 = v.x; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_43 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_46 = v.z; + x_GLF_color = float4(x_38, float(x_40), float(x_43), x_46); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..2b232fc036 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.msl @@ -0,0 +1,50 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + float const x_33 = x_6.x_GLF_uniform_float_values.arr[0].el; + v = clamp(cosh(float4(1.0f, 1.0f, 1.0f, 1.0f)), float4(x_33, x_33, x_33, x_33), float4(1.0f, 1.0f, 1.0f, 1.0f)); + float const x_38 = v.x; + int const x_40 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_43 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_46 = v.z; + *(tint_symbol_4) = float4(x_38, float(x_40), float(x_43), x_46); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e90552e21e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + %31 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %buf1 = OpTypeStruct %_arr_int_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %34 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_2 = OpConstant %uint 2 + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %11 + %28 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %29 = OpLoad %float %28 + %32 = OpExtInst %v4float %31 Cosh %34 + %35 = OpCompositeConstruct %v4float %29 %29 %29 %29 + %30 = OpExtInst %v4float %31 NClamp %32 %35 %34 + OpStore %v %30 + %37 = OpAccessChain %_ptr_Function_float %v %uint_0 + %38 = OpLoad %float %37 + %40 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %43 = OpLoad %int %42 + %45 = OpAccessChain %_ptr_Function_float %v %uint_2 + %46 = OpLoad %float %45 + %47 = OpConvertSToF %float %41 + %48 = OpConvertSToF %float %43 + %49 = OpCompositeConstruct %v4float %38 %47 %48 %46 + OpStore %x_GLF_color %49 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %50 +%tint_symbol = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %57 = OpLabel + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_2 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b0081f2215 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.spvasm.expected.wgsl @@ -0,0 +1,42 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var v : vec4; + let x_33 : f32 = x_6.x_GLF_uniform_float_values[0]; + v = clamp(cosh(vec4(1.0, 1.0, 1.0, 1.0)), vec4(x_33, x_33, x_33, x_33), vec4(1.0, 1.0, 1.0, 1.0)); + let x_38 : f32 = v.x; + let x_40 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_43 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_46 : f32 = v.z; + x_GLF_color = vec4(x_38, f32(x_40), f32(x_43), x_46); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl new file mode 100644 index 0000000000..b0081f2215 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl @@ -0,0 +1,42 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var v : vec4; + let x_33 : f32 = x_6.x_GLF_uniform_float_values[0]; + v = clamp(cosh(vec4(1.0, 1.0, 1.0, 1.0)), vec4(x_33, x_33, x_33, x_33), vec4(1.0, 1.0, 1.0, 1.0)); + let x_38 : f32 = v.x; + let x_40 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_43 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_46 : f32 = v.z; + x_GLF_color = vec4(x_38, f32(x_40), f32(x_43), x_46); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..7223823836 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_33 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + v = clamp(cosh(float4(1.0f, 1.0f, 1.0f, 1.0f)), float4(x_33, x_33, x_33, x_33), float4(1.0f, 1.0f, 1.0f, 1.0f)); + const float x_38 = v.x; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_43 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_46 = v.z; + x_GLF_color = float4(x_38, float(x_40), float(x_43), x_46); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..2b232fc036 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.msl @@ -0,0 +1,50 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + float const x_33 = x_6.x_GLF_uniform_float_values.arr[0].el; + v = clamp(cosh(float4(1.0f, 1.0f, 1.0f, 1.0f)), float4(x_33, x_33, x_33, x_33), float4(1.0f, 1.0f, 1.0f, 1.0f)); + float const x_38 = v.x; + int const x_40 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_43 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_46 = v.z; + *(tint_symbol_4) = float4(x_38, float(x_40), float(x_43), x_46); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e90552e21e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + %31 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %buf1 = OpTypeStruct %_arr_int_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %34 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_2 = OpConstant %uint 2 + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %11 + %28 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %29 = OpLoad %float %28 + %32 = OpExtInst %v4float %31 Cosh %34 + %35 = OpCompositeConstruct %v4float %29 %29 %29 %29 + %30 = OpExtInst %v4float %31 NClamp %32 %35 %34 + OpStore %v %30 + %37 = OpAccessChain %_ptr_Function_float %v %uint_0 + %38 = OpLoad %float %37 + %40 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %43 = OpLoad %int %42 + %45 = OpAccessChain %_ptr_Function_float %v %uint_2 + %46 = OpLoad %float %45 + %47 = OpConvertSToF %float %41 + %48 = OpConvertSToF %float %43 + %49 = OpCompositeConstruct %v4float %38 %47 %48 %46 + OpStore %x_GLF_color %49 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %50 +%tint_symbol = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %57 = OpLabel + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_2 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b0081f2215 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cosh-clamped-to-one/0-opt.wgsl.expected.wgsl @@ -0,0 +1,42 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var v : vec4; + let x_33 : f32 = x_6.x_GLF_uniform_float_values[0]; + v = clamp(cosh(vec4(1.0, 1.0, 1.0, 1.0)), vec4(x_33, x_33, x_33, x_33), vec4(1.0, 1.0, 1.0, 1.0)); + let x_38 : f32 = v.x; + let x_40 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_43 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_46 : f32 = v.z; + x_GLF_color = vec4(x_38, f32(x_40), f32(x_43), x_46); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm new file mode 100644 index 0000000000..1fa7ee6767 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm @@ -0,0 +1,181 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %b "b" + OpName %_GLF_color "_GLF_color" + OpName %i "i" + OpName %i_0 "i" + OpName %i_1 "i" + OpName %indexable "indexable" + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %int_4 = OpConstant %int 4 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %main = OpFunction %void None %14 + %34 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %indexable = OpVariable %_ptr_Function__arr_int_uint_2 Function + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %36 = OpLoad %int %35 + OpStore %a %36 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %38 = OpLoad %int %37 + OpStore %b %38 + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %40 = OpLoad %int %39 + %41 = OpConvertSToF %float %40 + %42 = OpCompositeConstruct %v4float %41 %41 %41 %41 + OpStore %_GLF_color %42 + %43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %44 = OpLoad %int %43 + OpStore %i %44 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %i + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpSLessThan %bool %49 %51 + OpBranchConditional %52 %53 %46 + %53 = OpLabel + %54 = OpLoad %int %i + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %56 = OpLoad %int %55 + %57 = OpSGreaterThan %bool %54 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + %60 = OpLoad %int %a + %61 = OpIAdd %int %60 %int_1 + OpStore %a %61 + OpSelectionMerge %62 None + OpBranchConditional %false %63 %62 + %63 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %65 = OpLoad %int %64 + OpStore %i_0 %65 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %70 = OpLoad %int %i_0 + %71 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %72 = OpLoad %int %71 + %73 = OpSLessThan %bool %70 %72 + OpBranchConditional %73 %74 %67 + %74 = OpLabel + OpReturn + %68 = OpLabel + OpBranch %66 + %67 = OpLabel + OpBranch %62 + %62 = OpLabel + OpBranch %58 + %58 = OpLabel + OpBranch %47 + %47 = OpLabel + %75 = OpLoad %int %i + %76 = OpIAdd %int %75 %int_1 + OpStore %i %76 + OpBranch %45 + %46 = OpLabel + %77 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %78 = OpLoad %int %77 + OpStore %i_1 %78 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %int %i_1 + %84 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpSLessThan %bool %83 %85 + OpBranchConditional %86 %87 %80 + %87 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %91 = OpLoad %int %90 + %92 = OpCompositeConstruct %_arr_int_uint_2 %89 %91 + %93 = OpLoad %int %b + OpStore %indexable %92 + %94 = OpAccessChain %_ptr_Function_int %indexable %93 + %95 = OpLoad %int %94 + %96 = OpLoad %int %a + %97 = OpIAdd %int %96 %95 + OpStore %a %97 + OpBranch %81 + %81 = OpLabel + %98 = OpLoad %int %i_1 + %99 = OpIAdd %int %98 %int_1 + OpStore %i_1 %99 + OpBranch %79 + %80 = OpLabel + %100 = OpLoad %int %a + %101 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %102 = OpLoad %int %101 + %103 = OpIEqual %bool %100 %102 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %107 = OpLoad %int %106 + %108 = OpConvertSToF %float %107 + %109 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %110 = OpLoad %int %109 + %111 = OpConvertSToF %float %110 + %112 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %113 = OpLoad %int %112 + %114 = OpConvertSToF %float %113 + %115 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %116 + %118 = OpCompositeConstruct %v4float %108 %111 %114 %117 + OpStore %_GLF_color %118 + OpBranch %104 + %104 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..773f4d43c8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.hlsl @@ -0,0 +1,98 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int b = 0; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int indexable[2] = (int[2])0; + const int x_36 = asint(x_6[2].x); + a = x_36; + const int x_38 = asint(x_6[3].x); + b = x_38; + const int x_40 = asint(x_6[2].x); + const float x_41 = float(x_40); + x_GLF_color = float4(x_41, x_41, x_41, x_41); + const int x_44 = asint(x_6[2].x); + i = x_44; + while (true) { + const int x_49 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_51 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_49 < x_51)) { + } else { + break; + } + const int x_54 = i; + const int x_56 = asint(x_6[3].x); + if ((x_54 > x_56)) { + a = (a + 1); + if (false) { + const int x_65 = asint(x_6[2].x); + i_1 = x_65; + while (true) { + const int x_70 = i_1; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_72 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_70 < x_72)) { + } else { + break; + } + return; + } + } + } + { + i = (i + 1); + } + } + const int x_78 = asint(x_6[2].x); + i_2 = x_78; + while (true) { + const int x_83 = i_2; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_85 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_83 < x_85)) { + } else { + break; + } + const int x_89 = asint(x_6[3].x); + const int x_91 = asint(x_6[4].x); + const int x_93 = b; + const int tint_symbol_3[2] = {x_89, x_91}; + indexable = tint_symbol_3; + const int x_95 = indexable[x_93]; + a = (a + x_95); + { + i_2 = (i_2 + 1); + } + } + const int x_100 = a; + const int x_102 = asint(x_6[1].x); + if ((x_100 == x_102)) { + const int x_107 = asint(x_6[3].x); + const int x_110 = asint(x_6[2].x); + const int x_113 = asint(x_6[2].x); + const int x_116 = asint(x_6[3].x); + x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..604ed912b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5) { + int a = 0; + int b = 0; + int i = 0; + int i_1 = 0; + int i_2 = 0; + tint_array_wrapper_1 indexable = {}; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[2].el; + a = x_36; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[3].el; + b = x_38; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_41 = float(x_40); + *(tint_symbol_5) = float4(x_41, x_41, x_41, x_41); + int const x_44 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_44; + while (true) { + int const x_49 = i; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_49 < x_51)) { + } else { + break; + } + int const x_54 = i; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[3].el; + if ((x_54 > x_56)) { + int const x_60 = a; + a = (x_60 + 1); + if (false) { + int const x_65 = x_6.x_GLF_uniform_int_values.arr[2].el; + i_1 = x_65; + while (true) { + int const x_70 = i_1; + int const x_72 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_70 < x_72)) { + } else { + break; + } + return; + } + } + } + { + int const x_75 = i; + i = (x_75 + 1); + } + } + int const x_78 = x_6.x_GLF_uniform_int_values.arr[2].el; + i_2 = x_78; + while (true) { + int const x_83 = i_2; + int const x_85 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_83 < x_85)) { + } else { + break; + } + int const x_89 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_91 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_93 = b; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_89, x_91}}; + indexable = tint_symbol_3; + int const x_95 = indexable.arr[x_93]; + int const x_96 = a; + a = (x_96 + x_95); + { + int const x_98 = i_2; + i_2 = (x_98 + 1); + } + } + int const x_100 = a; + int const x_102 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_100 == x_102)) { + int const x_107 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_110 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_113 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_116 = x_6.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_5) = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..fe39eb796c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.spvasm @@ -0,0 +1,231 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 142 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %30 = OpConstantNull %_arr_int_uint_2 + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %130 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %b = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %i_1 = OpVariable %_ptr_Function_int Function %21 + %i_2 = OpVariable %_ptr_Function_int Function %21 + %indexable = OpVariable %_ptr_Function__arr_int_uint_2 Function %30 + %34 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %35 = OpLoad %int %34 + OpStore %a %35 + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %38 = OpLoad %int %37 + OpStore %b %38 + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %40 = OpLoad %int %39 + %41 = OpConvertSToF %float %40 + %42 = OpCompositeConstruct %v4float %41 %41 %41 %41 + OpStore %x_GLF_color %42 + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %44 = OpLoad %int %43 + OpStore %i %44 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpSLessThan %bool %49 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %46 + %55 = OpLabel + %58 = OpLoad %int %i + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %60 = OpLoad %int %59 + %61 = OpSGreaterThan %bool %58 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpLoad %int %a + %66 = OpIAdd %int %64 %int_1 + OpStore %a %66 + OpSelectionMerge %68 None + OpBranchConditional %false %69 %68 + %69 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %71 = OpLoad %int %70 + OpStore %i_1 %71 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %int %i_1 + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %78 = OpLoad %int %77 + %79 = OpSLessThan %bool %76 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + OpBranch %80 + %82 = OpLabel + OpBranch %73 + %80 = OpLabel + OpReturn + %74 = OpLabel + OpBranch %72 + %73 = OpLabel + OpBranch %68 + %68 = OpLabel + OpBranch %62 + %62 = OpLabel + OpBranch %47 + %47 = OpLabel + %83 = OpLoad %int %i + %84 = OpIAdd %int %83 %int_1 + OpStore %i %84 + OpBranch %45 + %46 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %86 = OpLoad %int %85 + OpStore %i_2 %86 + OpBranch %87 + %87 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %int %i_2 + %92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %93 = OpLoad %int %92 + %94 = OpSLessThan %bool %91 %93 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %97 + %96 = OpLabel + OpBranch %95 + %97 = OpLabel + OpBranch %88 + %95 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %99 = OpLoad %int %98 + %101 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %102 = OpLoad %int %101 + %103 = OpLoad %int %b + %104 = OpCompositeConstruct %_arr_int_uint_2 %99 %102 + OpStore %indexable %104 + %105 = OpAccessChain %_ptr_Function_int %indexable %103 + %106 = OpLoad %int %105 + %107 = OpLoad %int %a + %108 = OpIAdd %int %107 %106 + OpStore %a %108 + OpBranch %89 + %89 = OpLabel + %109 = OpLoad %int %i_2 + %110 = OpIAdd %int %109 %int_1 + OpStore %i_2 %110 + OpBranch %87 + %88 = OpLabel + %111 = OpLoad %int %a + %112 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %113 = OpLoad %int %112 + %114 = OpIEqual %bool %111 %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %115 + %116 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %118 = OpLoad %int %117 + %119 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %120 = OpLoad %int %119 + %121 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %122 = OpLoad %int %121 + %123 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %124 = OpLoad %int %123 + %125 = OpConvertSToF %float %118 + %126 = OpConvertSToF %float %120 + %127 = OpConvertSToF %float %122 + %128 = OpConvertSToF %float %124 + %129 = OpCompositeConstruct %v4float %125 %126 %127 %128 + OpStore %x_GLF_color %129 + OpBranch %115 + %115 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %130 +%tint_symbol = OpFunctionParameter %main_out + %134 = OpLabel + %135 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %135 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %137 = OpLabel + %138 = OpFunctionCall %void %main_1 + %140 = OpLoad %v4float %x_GLF_color + %141 = OpCompositeConstruct %main_out %140 + %139 = OpFunctionCall %void %tint_symbol_2 %141 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..723c264b42 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.spvasm.expected.wgsl @@ -0,0 +1,103 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var indexable : array; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_36; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[3]; + b = x_38; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_41 : f32 = f32(x_40); + x_GLF_color = vec4(x_41, x_41, x_41, x_41); + let x_44 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_44; + loop { + let x_49 : i32 = i; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_49 < x_51)) { + } else { + break; + } + let x_54 : i32 = i; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_54 > x_56)) { + let x_60 : i32 = a; + a = (x_60 + 1); + if (false) { + let x_65 : i32 = x_6.x_GLF_uniform_int_values[2]; + i_1 = x_65; + loop { + let x_70 : i32 = i_1; + let x_72 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_70 < x_72)) { + } else { + break; + } + return; + } + } + } + + continuing { + let x_75 : i32 = i; + i = (x_75 + 1); + } + } + let x_78 : i32 = x_6.x_GLF_uniform_int_values[2]; + i_2 = x_78; + loop { + let x_83 : i32 = i_2; + let x_85 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_83 < x_85)) { + } else { + break; + } + let x_89 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_91 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_93 : i32 = b; + indexable = array(x_89, x_91); + let x_95 : i32 = indexable[x_93]; + let x_96 : i32 = a; + a = (x_96 + x_95); + + continuing { + let x_98 : i32 = i_2; + i_2 = (x_98 + 1); + } + } + let x_100 : i32 = a; + let x_102 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_100 == x_102)) { + let x_107 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_110 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_113 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_116 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl new file mode 100644 index 0000000000..723c264b42 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl @@ -0,0 +1,103 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var indexable : array; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_36; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[3]; + b = x_38; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_41 : f32 = f32(x_40); + x_GLF_color = vec4(x_41, x_41, x_41, x_41); + let x_44 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_44; + loop { + let x_49 : i32 = i; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_49 < x_51)) { + } else { + break; + } + let x_54 : i32 = i; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_54 > x_56)) { + let x_60 : i32 = a; + a = (x_60 + 1); + if (false) { + let x_65 : i32 = x_6.x_GLF_uniform_int_values[2]; + i_1 = x_65; + loop { + let x_70 : i32 = i_1; + let x_72 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_70 < x_72)) { + } else { + break; + } + return; + } + } + } + + continuing { + let x_75 : i32 = i; + i = (x_75 + 1); + } + } + let x_78 : i32 = x_6.x_GLF_uniform_int_values[2]; + i_2 = x_78; + loop { + let x_83 : i32 = i_2; + let x_85 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_83 < x_85)) { + } else { + break; + } + let x_89 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_91 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_93 : i32 = b; + indexable = array(x_89, x_91); + let x_95 : i32 = indexable[x_93]; + let x_96 : i32 = a; + a = (x_96 + x_95); + + continuing { + let x_98 : i32 = i_2; + i_2 = (x_98 + 1); + } + } + let x_100 : i32 = a; + let x_102 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_100 == x_102)) { + let x_107 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_110 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_113 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_116 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..773f4d43c8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.hlsl @@ -0,0 +1,98 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int b = 0; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int indexable[2] = (int[2])0; + const int x_36 = asint(x_6[2].x); + a = x_36; + const int x_38 = asint(x_6[3].x); + b = x_38; + const int x_40 = asint(x_6[2].x); + const float x_41 = float(x_40); + x_GLF_color = float4(x_41, x_41, x_41, x_41); + const int x_44 = asint(x_6[2].x); + i = x_44; + while (true) { + const int x_49 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_51 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_49 < x_51)) { + } else { + break; + } + const int x_54 = i; + const int x_56 = asint(x_6[3].x); + if ((x_54 > x_56)) { + a = (a + 1); + if (false) { + const int x_65 = asint(x_6[2].x); + i_1 = x_65; + while (true) { + const int x_70 = i_1; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_72 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_70 < x_72)) { + } else { + break; + } + return; + } + } + } + { + i = (i + 1); + } + } + const int x_78 = asint(x_6[2].x); + i_2 = x_78; + while (true) { + const int x_83 = i_2; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_85 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_83 < x_85)) { + } else { + break; + } + const int x_89 = asint(x_6[3].x); + const int x_91 = asint(x_6[4].x); + const int x_93 = b; + const int tint_symbol_3[2] = {x_89, x_91}; + indexable = tint_symbol_3; + const int x_95 = indexable[x_93]; + a = (a + x_95); + { + i_2 = (i_2 + 1); + } + } + const int x_100 = a; + const int x_102 = asint(x_6[1].x); + if ((x_100 == x_102)) { + const int x_107 = asint(x_6[3].x); + const int x_110 = asint(x_6[2].x); + const int x_113 = asint(x_6[2].x); + const int x_116 = asint(x_6[3].x); + x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..604ed912b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5) { + int a = 0; + int b = 0; + int i = 0; + int i_1 = 0; + int i_2 = 0; + tint_array_wrapper_1 indexable = {}; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[2].el; + a = x_36; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[3].el; + b = x_38; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_41 = float(x_40); + *(tint_symbol_5) = float4(x_41, x_41, x_41, x_41); + int const x_44 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_44; + while (true) { + int const x_49 = i; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_49 < x_51)) { + } else { + break; + } + int const x_54 = i; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[3].el; + if ((x_54 > x_56)) { + int const x_60 = a; + a = (x_60 + 1); + if (false) { + int const x_65 = x_6.x_GLF_uniform_int_values.arr[2].el; + i_1 = x_65; + while (true) { + int const x_70 = i_1; + int const x_72 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_70 < x_72)) { + } else { + break; + } + return; + } + } + } + { + int const x_75 = i; + i = (x_75 + 1); + } + } + int const x_78 = x_6.x_GLF_uniform_int_values.arr[2].el; + i_2 = x_78; + while (true) { + int const x_83 = i_2; + int const x_85 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_83 < x_85)) { + } else { + break; + } + int const x_89 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_91 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_93 = b; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_89, x_91}}; + indexable = tint_symbol_3; + int const x_95 = indexable.arr[x_93]; + int const x_96 = a; + a = (x_96 + x_95); + { + int const x_98 = i_2; + i_2 = (x_98 + 1); + } + } + int const x_100 = a; + int const x_102 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_100 == x_102)) { + int const x_107 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_110 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_113 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_116 = x_6.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_5) = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..fe39eb796c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.spvasm @@ -0,0 +1,231 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 142 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %30 = OpConstantNull %_arr_int_uint_2 + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %130 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %b = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %i_1 = OpVariable %_ptr_Function_int Function %21 + %i_2 = OpVariable %_ptr_Function_int Function %21 + %indexable = OpVariable %_ptr_Function__arr_int_uint_2 Function %30 + %34 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %35 = OpLoad %int %34 + OpStore %a %35 + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %38 = OpLoad %int %37 + OpStore %b %38 + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %40 = OpLoad %int %39 + %41 = OpConvertSToF %float %40 + %42 = OpCompositeConstruct %v4float %41 %41 %41 %41 + OpStore %x_GLF_color %42 + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %44 = OpLoad %int %43 + OpStore %i %44 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpSLessThan %bool %49 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %46 + %55 = OpLabel + %58 = OpLoad %int %i + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %60 = OpLoad %int %59 + %61 = OpSGreaterThan %bool %58 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpLoad %int %a + %66 = OpIAdd %int %64 %int_1 + OpStore %a %66 + OpSelectionMerge %68 None + OpBranchConditional %false %69 %68 + %69 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %71 = OpLoad %int %70 + OpStore %i_1 %71 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %int %i_1 + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %78 = OpLoad %int %77 + %79 = OpSLessThan %bool %76 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + OpBranch %80 + %82 = OpLabel + OpBranch %73 + %80 = OpLabel + OpReturn + %74 = OpLabel + OpBranch %72 + %73 = OpLabel + OpBranch %68 + %68 = OpLabel + OpBranch %62 + %62 = OpLabel + OpBranch %47 + %47 = OpLabel + %83 = OpLoad %int %i + %84 = OpIAdd %int %83 %int_1 + OpStore %i %84 + OpBranch %45 + %46 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %86 = OpLoad %int %85 + OpStore %i_2 %86 + OpBranch %87 + %87 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %int %i_2 + %92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %93 = OpLoad %int %92 + %94 = OpSLessThan %bool %91 %93 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %97 + %96 = OpLabel + OpBranch %95 + %97 = OpLabel + OpBranch %88 + %95 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %99 = OpLoad %int %98 + %101 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %102 = OpLoad %int %101 + %103 = OpLoad %int %b + %104 = OpCompositeConstruct %_arr_int_uint_2 %99 %102 + OpStore %indexable %104 + %105 = OpAccessChain %_ptr_Function_int %indexable %103 + %106 = OpLoad %int %105 + %107 = OpLoad %int %a + %108 = OpIAdd %int %107 %106 + OpStore %a %108 + OpBranch %89 + %89 = OpLabel + %109 = OpLoad %int %i_2 + %110 = OpIAdd %int %109 %int_1 + OpStore %i_2 %110 + OpBranch %87 + %88 = OpLabel + %111 = OpLoad %int %a + %112 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %113 = OpLoad %int %112 + %114 = OpIEqual %bool %111 %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %115 + %116 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %118 = OpLoad %int %117 + %119 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %120 = OpLoad %int %119 + %121 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %122 = OpLoad %int %121 + %123 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %124 = OpLoad %int %123 + %125 = OpConvertSToF %float %118 + %126 = OpConvertSToF %float %120 + %127 = OpConvertSToF %float %122 + %128 = OpConvertSToF %float %124 + %129 = OpCompositeConstruct %v4float %125 %126 %127 %128 + OpStore %x_GLF_color %129 + OpBranch %115 + %115 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %130 +%tint_symbol = OpFunctionParameter %main_out + %134 = OpLabel + %135 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %135 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %137 = OpLabel + %138 = OpFunctionCall %void %main_1 + %140 = OpLoad %v4float %x_GLF_color + %141 = OpCompositeConstruct %main_out %140 + %139 = OpFunctionCall %void %tint_symbol_2 %141 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..723c264b42 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/0-opt.wgsl.expected.wgsl @@ -0,0 +1,103 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var indexable : array; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_36; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[3]; + b = x_38; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_41 : f32 = f32(x_40); + x_GLF_color = vec4(x_41, x_41, x_41, x_41); + let x_44 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_44; + loop { + let x_49 : i32 = i; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_49 < x_51)) { + } else { + break; + } + let x_54 : i32 = i; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_54 > x_56)) { + let x_60 : i32 = a; + a = (x_60 + 1); + if (false) { + let x_65 : i32 = x_6.x_GLF_uniform_int_values[2]; + i_1 = x_65; + loop { + let x_70 : i32 = i_1; + let x_72 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_70 < x_72)) { + } else { + break; + } + return; + } + } + } + + continuing { + let x_75 : i32 = i; + i = (x_75 + 1); + } + } + let x_78 : i32 = x_6.x_GLF_uniform_int_values[2]; + i_2 = x_78; + loop { + let x_83 : i32 = i_2; + let x_85 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_83 < x_85)) { + } else { + break; + } + let x_89 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_91 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_93 : i32 = b; + indexable = array(x_89, x_91); + let x_95 : i32 = indexable[x_93]; + let x_96 : i32 = a; + a = (x_96 + x_95); + + continuing { + let x_98 : i32 = i_2; + i_2 = (x_98 + 1); + } + } + let x_100 : i32 = a; + let x_102 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_100 == x_102)) { + let x_107 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_110 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_113 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_116 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm new file mode 100644 index 0000000000..305dd5ce64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm @@ -0,0 +1,130 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %b "b" + OpName %_GLF_color "_GLF_color" + OpName %i "i" + OpName %i_0 "i" + OpName %i_1 "i" + OpName %indexable "indexable" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %20 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %int_2 = OpConstant %int 2 + %28 = OpConstantComposite %_arr_int_uint_2 %int_1 %int_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %int_28 = OpConstant %int 28 + %float_1 = OpConstant %float 1 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %11 + %33 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %indexable = OpVariable %_ptr_Function__arr_int_uint_2 Function + OpStore %a %int_0 + OpStore %b %int_1 + OpStore %_GLF_color %20 + OpStore %i %int_0 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %int %i + %39 = OpSLessThan %bool %38 %int_10 + OpBranchConditional %39 %40 %35 + %40 = OpLabel + %41 = OpLoad %int %i + %42 = OpSGreaterThan %bool %41 %int_1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + %45 = OpLoad %int %a + %46 = OpIAdd %int %45 %int_1 + OpStore %a %46 + OpSelectionMerge %47 None + OpBranchConditional %false %48 %47 + %48 = OpLabel + OpStore %i_0 %int_0 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %int %i_0 + %54 = OpSLessThan %bool %53 %int_10 + OpBranchConditional %54 %55 %50 + %55 = OpLabel + OpReturn + %51 = OpLabel + OpBranch %49 + %50 = OpLabel + OpBranch %47 + %47 = OpLabel + OpBranch %43 + %43 = OpLabel + OpBranch %36 + %36 = OpLabel + %56 = OpLoad %int %i + %57 = OpIAdd %int %56 %int_1 + OpStore %i %57 + OpBranch %34 + %35 = OpLabel + OpStore %i_1 %int_0 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %62 = OpLoad %int %i_1 + %63 = OpSLessThan %bool %62 %int_10 + OpBranchConditional %63 %64 %59 + %64 = OpLabel + %65 = OpLoad %int %b + OpStore %indexable %28 + %66 = OpAccessChain %_ptr_Function_int %indexable %65 + %67 = OpLoad %int %66 + %68 = OpLoad %int %a + %69 = OpIAdd %int %68 %67 + OpStore %a %69 + OpBranch %60 + %60 = OpLabel + %70 = OpLoad %int %i_1 + %71 = OpIAdd %int %70 %int_1 + OpStore %i_1 %71 + OpBranch %58 + %59 = OpLabel + %72 = OpLoad %int %a + %73 = OpIEqual %bool %72 %int_28 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %74 + %75 = OpLabel + OpStore %_GLF_color %32 + OpBranch %74 + %74 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..f8fc44b9b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.hlsl @@ -0,0 +1,59 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int b = 0; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int indexable[2] = (int[2])0; + a = 0; + b = 1; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + { + for(; (i < 10); i = (i + 1)) { + if ((i > 1)) { + a = (a + 1); + if (false) { + i_1 = 0; + while (true) { + if ((i_1 < 10)) { + } else { + break; + } + return; + } + } + } + } + } + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + const int x_65 = b; + const int tint_symbol_2[2] = {1, 2}; + indexable = tint_symbol_2; + const int x_67 = indexable[x_65]; + a = (a + x_67); + } + } + if ((a == 28)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.msl new file mode 100644 index 0000000000..030119e019 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.msl @@ -0,0 +1,84 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5) { + int a = 0; + int b = 0; + int i = 0; + int i_1 = 0; + int i_2 = 0; + tint_array_wrapper indexable = {}; + a = 0; + b = 1; + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + while (true) { + int const x_38 = i; + if ((x_38 < 10)) { + } else { + break; + } + int const x_41 = i; + if ((x_41 > 1)) { + int const x_45 = a; + a = (x_45 + 1); + if (false) { + i_1 = 0; + while (true) { + int const x_53 = i_1; + if ((x_53 < 10)) { + } else { + break; + } + return; + } + } + } + { + int const x_56 = i; + i = (x_56 + 1); + } + } + i_2 = 0; + while (true) { + int const x_62 = i_2; + if ((x_62 < 10)) { + } else { + break; + } + int const x_65 = b; + tint_array_wrapper const tint_symbol_3 = {.arr={1, 2}}; + indexable = tint_symbol_3; + int const x_67 = indexable.arr[x_65]; + int const x_68 = a; + a = (x_68 + x_67); + { + int const x_70 = i_2; + i_2 = (x_70 + 1); + } + } + int const x_72 = a; + if ((x_72 == 28)) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + main_1(&(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..cb6d107772 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.spvasm @@ -0,0 +1,178 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %25 = OpConstantNull %_arr_int_uint_2 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %int_2 = OpConstant %int 2 + %72 = OpConstantComposite %_arr_int_uint_2 %int_1 %int_2 + %int_28 = OpConstant %int 28 + %float_1 = OpConstant %float 1 + %85 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %86 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %a = OpVariable %_ptr_Function_int Function %15 + %b = OpVariable %_ptr_Function_int Function %15 + %i = OpVariable %_ptr_Function_int Function %15 + %i_1 = OpVariable %_ptr_Function_int Function %15 + %i_2 = OpVariable %_ptr_Function_int Function %15 + %indexable = OpVariable %_ptr_Function__arr_int_uint_2 Function %25 + OpStore %a %int_0 + OpStore %b %int_1 + OpStore %x_GLF_color %29 + OpStore %i %int_0 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %36 = OpSLessThan %bool %34 %int_10 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + OpBranch %38 + %40 = OpLabel + OpBranch %31 + %38 = OpLabel + %41 = OpLoad %int %i + %42 = OpSGreaterThan %bool %41 %int_1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + %45 = OpLoad %int %a + %46 = OpIAdd %int %45 %int_1 + OpStore %a %46 + OpSelectionMerge %48 None + OpBranchConditional %false %49 %48 + %49 = OpLabel + OpStore %i_1 %int_0 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %int %i_1 + %55 = OpSLessThan %bool %54 %int_10 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpBranch %56 + %58 = OpLabel + OpBranch %51 + %56 = OpLabel + OpReturn + %52 = OpLabel + OpBranch %50 + %51 = OpLabel + OpBranch %48 + %48 = OpLabel + OpBranch %43 + %43 = OpLabel + OpBranch %32 + %32 = OpLabel + %59 = OpLoad %int %i + %60 = OpIAdd %int %59 %int_1 + OpStore %i %60 + OpBranch %30 + %31 = OpLabel + OpStore %i_2 %int_0 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %int %i_2 + %66 = OpSLessThan %bool %65 %int_10 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %62 + %67 = OpLabel + %70 = OpLoad %int %b + OpStore %indexable %72 + %73 = OpAccessChain %_ptr_Function_int %indexable %70 + %74 = OpLoad %int %73 + %75 = OpLoad %int %a + %76 = OpIAdd %int %75 %74 + OpStore %a %76 + OpBranch %63 + %63 = OpLabel + %77 = OpLoad %int %i_2 + %78 = OpIAdd %int %77 %int_1 + OpStore %i_2 %78 + OpBranch %61 + %62 = OpLabel + %79 = OpLoad %int %a + %81 = OpIEqual %bool %79 %int_28 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %82 + %83 = OpLabel + OpStore %x_GLF_color %85 + OpBranch %82 + %82 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %86 +%tint_symbol = OpFunctionParameter %main_out + %90 = OpLabel + %91 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %91 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %93 = OpLabel + %94 = OpFunctionCall %void %main_1 + %96 = OpLoad %v4float %x_GLF_color + %97 = OpCompositeConstruct %main_out %96 + %95 = OpFunctionCall %void %tint_symbol_2 %97 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..c7c18d1e70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.spvasm.expected.wgsl @@ -0,0 +1,76 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var indexable : array; + a = 0; + b = 1; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + i = 0; + loop { + let x_38 : i32 = i; + if ((x_38 < 10)) { + } else { + break; + } + let x_41 : i32 = i; + if ((x_41 > 1)) { + let x_45 : i32 = a; + a = (x_45 + 1); + if (false) { + i_1 = 0; + loop { + let x_53 : i32 = i_1; + if ((x_53 < 10)) { + } else { + break; + } + return; + } + } + } + + continuing { + let x_56 : i32 = i; + i = (x_56 + 1); + } + } + i_2 = 0; + loop { + let x_62 : i32 = i_2; + if ((x_62 < 10)) { + } else { + break; + } + let x_65 : i32 = b; + indexable = array(1, 2); + let x_67 : i32 = indexable[x_65]; + let x_68 : i32 = a; + a = (x_68 + x_67); + + continuing { + let x_70 : i32 = i_2; + i_2 = (x_70 + 1); + } + } + let x_72 : i32 = a; + if ((x_72 == 28)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl new file mode 100644 index 0000000000..c7c18d1e70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl @@ -0,0 +1,76 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var indexable : array; + a = 0; + b = 1; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + i = 0; + loop { + let x_38 : i32 = i; + if ((x_38 < 10)) { + } else { + break; + } + let x_41 : i32 = i; + if ((x_41 > 1)) { + let x_45 : i32 = a; + a = (x_45 + 1); + if (false) { + i_1 = 0; + loop { + let x_53 : i32 = i_1; + if ((x_53 < 10)) { + } else { + break; + } + return; + } + } + } + + continuing { + let x_56 : i32 = i; + i = (x_56 + 1); + } + } + i_2 = 0; + loop { + let x_62 : i32 = i_2; + if ((x_62 < 10)) { + } else { + break; + } + let x_65 : i32 = b; + indexable = array(1, 2); + let x_67 : i32 = indexable[x_65]; + let x_68 : i32 = a; + a = (x_68 + x_67); + + continuing { + let x_70 : i32 = i_2; + i_2 = (x_70 + 1); + } + } + let x_72 : i32 = a; + if ((x_72 == 28)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..f8fc44b9b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.hlsl @@ -0,0 +1,59 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int b = 0; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int indexable[2] = (int[2])0; + a = 0; + b = 1; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + { + for(; (i < 10); i = (i + 1)) { + if ((i > 1)) { + a = (a + 1); + if (false) { + i_1 = 0; + while (true) { + if ((i_1 < 10)) { + } else { + break; + } + return; + } + } + } + } + } + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + const int x_65 = b; + const int tint_symbol_2[2] = {1, 2}; + indexable = tint_symbol_2; + const int x_67 = indexable[x_65]; + a = (a + x_67); + } + } + if ((a == 28)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.msl new file mode 100644 index 0000000000..030119e019 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.msl @@ -0,0 +1,84 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5) { + int a = 0; + int b = 0; + int i = 0; + int i_1 = 0; + int i_2 = 0; + tint_array_wrapper indexable = {}; + a = 0; + b = 1; + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + while (true) { + int const x_38 = i; + if ((x_38 < 10)) { + } else { + break; + } + int const x_41 = i; + if ((x_41 > 1)) { + int const x_45 = a; + a = (x_45 + 1); + if (false) { + i_1 = 0; + while (true) { + int const x_53 = i_1; + if ((x_53 < 10)) { + } else { + break; + } + return; + } + } + } + { + int const x_56 = i; + i = (x_56 + 1); + } + } + i_2 = 0; + while (true) { + int const x_62 = i_2; + if ((x_62 < 10)) { + } else { + break; + } + int const x_65 = b; + tint_array_wrapper const tint_symbol_3 = {.arr={1, 2}}; + indexable = tint_symbol_3; + int const x_67 = indexable.arr[x_65]; + int const x_68 = a; + a = (x_68 + x_67); + { + int const x_70 = i_2; + i_2 = (x_70 + 1); + } + } + int const x_72 = a; + if ((x_72 == 28)) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + main_1(&(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..cb6d107772 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.spvasm @@ -0,0 +1,178 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %25 = OpConstantNull %_arr_int_uint_2 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %int_2 = OpConstant %int 2 + %72 = OpConstantComposite %_arr_int_uint_2 %int_1 %int_2 + %int_28 = OpConstant %int 28 + %float_1 = OpConstant %float 1 + %85 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %86 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %a = OpVariable %_ptr_Function_int Function %15 + %b = OpVariable %_ptr_Function_int Function %15 + %i = OpVariable %_ptr_Function_int Function %15 + %i_1 = OpVariable %_ptr_Function_int Function %15 + %i_2 = OpVariable %_ptr_Function_int Function %15 + %indexable = OpVariable %_ptr_Function__arr_int_uint_2 Function %25 + OpStore %a %int_0 + OpStore %b %int_1 + OpStore %x_GLF_color %29 + OpStore %i %int_0 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %36 = OpSLessThan %bool %34 %int_10 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + OpBranch %38 + %40 = OpLabel + OpBranch %31 + %38 = OpLabel + %41 = OpLoad %int %i + %42 = OpSGreaterThan %bool %41 %int_1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + %45 = OpLoad %int %a + %46 = OpIAdd %int %45 %int_1 + OpStore %a %46 + OpSelectionMerge %48 None + OpBranchConditional %false %49 %48 + %49 = OpLabel + OpStore %i_1 %int_0 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %int %i_1 + %55 = OpSLessThan %bool %54 %int_10 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpBranch %56 + %58 = OpLabel + OpBranch %51 + %56 = OpLabel + OpReturn + %52 = OpLabel + OpBranch %50 + %51 = OpLabel + OpBranch %48 + %48 = OpLabel + OpBranch %43 + %43 = OpLabel + OpBranch %32 + %32 = OpLabel + %59 = OpLoad %int %i + %60 = OpIAdd %int %59 %int_1 + OpStore %i %60 + OpBranch %30 + %31 = OpLabel + OpStore %i_2 %int_0 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %int %i_2 + %66 = OpSLessThan %bool %65 %int_10 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %62 + %67 = OpLabel + %70 = OpLoad %int %b + OpStore %indexable %72 + %73 = OpAccessChain %_ptr_Function_int %indexable %70 + %74 = OpLoad %int %73 + %75 = OpLoad %int %a + %76 = OpIAdd %int %75 %74 + OpStore %a %76 + OpBranch %63 + %63 = OpLabel + %77 = OpLoad %int %i_2 + %78 = OpIAdd %int %77 %int_1 + OpStore %i_2 %78 + OpBranch %61 + %62 = OpLabel + %79 = OpLoad %int %a + %81 = OpIEqual %bool %79 %int_28 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %82 + %83 = OpLabel + OpStore %x_GLF_color %85 + OpBranch %82 + %82 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %86 +%tint_symbol = OpFunctionParameter %main_out + %90 = OpLabel + %91 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %91 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %93 = OpLabel + %94 = OpFunctionCall %void %main_1 + %96 = OpLoad %v4float %x_GLF_color + %97 = OpCompositeConstruct %main_out %96 + %95 = OpFunctionCall %void %tint_symbol_2 %97 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..c7c18d1e70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-cumulate-loops-unreachable/1.wgsl.expected.wgsl @@ -0,0 +1,76 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var indexable : array; + a = 0; + b = 1; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + i = 0; + loop { + let x_38 : i32 = i; + if ((x_38 < 10)) { + } else { + break; + } + let x_41 : i32 = i; + if ((x_41 > 1)) { + let x_45 : i32 = a; + a = (x_45 + 1); + if (false) { + i_1 = 0; + loop { + let x_53 : i32 = i_1; + if ((x_53 < 10)) { + } else { + break; + } + return; + } + } + } + + continuing { + let x_56 : i32 = i; + i = (x_56 + 1); + } + } + i_2 = 0; + loop { + let x_62 : i32 = i_2; + if ((x_62 < 10)) { + } else { + break; + } + let x_65 : i32 = b; + indexable = array(1, 2); + let x_67 : i32 = indexable[x_65]; + let x_68 : i32 = a; + a = (x_68 + x_67); + + continuing { + let x_70 : i32 = i_2; + i_2 = (x_70 + 1); + } + } + let x_72 : i32 = a; + if ((x_72 == 28)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm new file mode 100644 index 0000000000..2509f0f231 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm @@ -0,0 +1,146 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %A1 "A1" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %b "b" + OpName %c "c" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_3_0 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 +%_arr_float_uint_3_0 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3_0 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %15 + %35 = OpLabel + %A1 = OpVariable %_ptr_Function__arr_float_uint_3 Function + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_float Function + %c = OpVariable %_ptr_Function_bool Function + %36 = OpVariable %_ptr_Function_bool Function + %37 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %42 = OpLoad %float %41 + %43 = OpCompositeConstruct %_arr_float_uint_3 %38 %40 %42 + OpStore %A1 %43 + %44 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %49 = OpLoad %int %48 + %50 = OpExtInst %int %1 SClamp %45 %47 %49 + OpStore %a %50 + %51 = OpLoad %int %a + %52 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpExtInst %int %1 SClamp %51 %53 %55 + %57 = OpAccessChain %_ptr_Function_float %A1 %56 + %58 = OpLoad %float %57 + OpStore %b %58 + %59 = OpLoad %float %b + %60 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Function_float %A1 %61 + %63 = OpLoad %float %62 + %64 = OpFOrdLessThan %bool %59 %63 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %67 + %66 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %69 = OpLoad %float %68 + %70 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %71 = OpLoad %float %70 + %72 = OpFOrdGreaterThan %bool %69 %71 + OpStore %36 %72 + OpBranch %65 + %67 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %74 = OpLoad %float %73 + %75 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Function_float %A1 %76 + %78 = OpLoad %float %77 + %79 = OpFOrdLessThan %bool %74 %78 + OpStore %36 %79 + OpBranch %65 + %65 = OpLabel + %80 = OpLoad %bool %36 + OpStore %c %80 + %81 = OpLoad %bool %c + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %86 + %88 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %89 = OpLoad %int %88 + %90 = OpConvertSToF %float %89 + %91 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %92 + %94 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpCompositeConstruct %v4float %87 %90 %93 %96 + OpStore %_GLF_color %97 + OpBranch %82 + %84 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %99 = OpLoad %float %98 + %100 = OpCompositeConstruct %v4float %99 %99 %99 %99 + OpStore %_GLF_color %100 + OpBranch %82 + %82 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ee0a08b3c0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.hlsl @@ -0,0 +1,77 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float A1[3] = (float[3])0; + int a = 0; + float b = 0.0f; + bool c = false; + bool x_36 = false; + const float x_38 = asfloat(x_6[2].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_42 = asfloat(x_6[1].x); + const float tint_symbol_4[3] = {x_38, x_40, x_42}; + A1 = tint_symbol_4; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_49 = asint(x_9[1].x); + a = clamp(x_45, x_47, x_49); + const int x_51 = a; + const int x_53 = asint(x_9[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_58 = A1[clamp(x_51, x_53, x_55)]; + b = x_58; + const float x_59 = b; + const int x_61 = asint(x_9[1].x); + const float x_63 = A1[x_61]; + if ((x_59 < x_63)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_69 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_71 = asfloat(x_6[2].x); + x_36 = (x_69 > x_71); + } else { + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_74 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_76 = asint(x_9[2].x); + const float x_78 = A1[x_76]; + x_36 = (x_74 < x_78); + } + c = x_36; + if (c) { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_86 = asint(x_9[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const int x_89 = asint(x_9[1].x); + const int x_92 = asint(x_9[1].x); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_95 = asint(x_9[scalar_offset_7 / 4][scalar_offset_7 % 4]); + x_GLF_color = float4(float(x_86), float(x_89), float(x_92), float(x_95)); + } else { + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const float x_99 = asfloat(x_6[scalar_offset_8 / 4][scalar_offset_8 % 4]); + x_GLF_color = float4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..6b19b3695a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.msl @@ -0,0 +1,90 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_5) { + tint_array_wrapper_2 A1 = {}; + int a = 0; + float b = 0.0f; + bool c = false; + bool x_36 = false; + float const x_38 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_40 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[1].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_38, x_40, x_42}}; + A1 = tint_symbol_3; + int const x_45 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_47 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_49 = x_9.x_GLF_uniform_int_values.arr[1].el; + a = clamp(x_45, x_47, x_49); + int const x_51 = a; + int const x_53 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_55 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_58 = A1.arr[clamp(x_51, x_53, x_55)]; + b = x_58; + float const x_59 = b; + int const x_61 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_63 = A1.arr[x_61]; + if ((x_59 < x_63)) { + float const x_69 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_71 = x_6.x_GLF_uniform_float_values.arr[2].el; + x_36 = (x_69 > x_71); + } else { + float const x_74 = x_6.x_GLF_uniform_float_values.arr[0].el; + int const x_76 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_78 = A1.arr[x_76]; + x_36 = (x_74 < x_78); + } + bool const x_80 = x_36; + c = x_80; + bool const x_81 = c; + if (x_81) { + int const x_86 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_89 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_92 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_95 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_86), float(x_89), float(x_92), float(x_95)); + } else { + float const x_99 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_5) = float4(x_99, x_99, x_99, x_99); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..5e0a897a5e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.spvasm @@ -0,0 +1,186 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 121 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %A1 "A1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %x_36 "x_36" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_3_0 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_arr_float_uint_3_0 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3_0 = OpTypePointer Function %_arr_float_uint_3_0 + %26 = OpConstantNull %_arr_float_uint_3_0 +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %32 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %36 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %109 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %A1 = OpVariable %_ptr_Function__arr_float_uint_3_0 Function %26 + %a = OpVariable %_ptr_Function_int Function %29 + %b = OpVariable %_ptr_Function_float Function %32 + %c = OpVariable %_ptr_Function_bool Function %36 + %x_36 = OpVariable %_ptr_Function_bool Function %36 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %42 = OpLoad %float %41 + %44 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %45 = OpLoad %float %44 + %47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %48 = OpLoad %float %47 + %49 = OpCompositeConstruct %_arr_float_uint_3_0 %42 %45 %48 + OpStore %A1 %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpExtInst %int %58 SClamp %52 %54 %56 + OpStore %a %57 + %59 = OpLoad %int %a + %60 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpExtInst %int %58 SClamp %59 %61 %63 + %65 = OpAccessChain %_ptr_Function_float %A1 %64 + %66 = OpLoad %float %65 + OpStore %b %66 + %67 = OpLoad %float %b + %68 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Function_float %A1 %69 + %71 = OpLoad %float %70 + %72 = OpFOrdLessThan %bool %67 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %79 = OpLoad %float %78 + %80 = OpFOrdGreaterThan %bool %77 %79 + OpStore %x_36 %80 + OpBranch %73 + %75 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Function_float %A1 %84 + %86 = OpLoad %float %85 + %87 = OpFOrdLessThan %bool %82 %86 + OpStore %x_36 %87 + OpBranch %73 + %73 = OpLabel + %88 = OpLoad %bool %x_36 + OpStore %c %88 + %89 = OpLoad %bool %c + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 + %91 = OpLabel + %93 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %100 = OpLoad %int %99 + %101 = OpConvertSToF %float %94 + %102 = OpConvertSToF %float %96 + %103 = OpConvertSToF %float %98 + %104 = OpConvertSToF %float %100 + %105 = OpCompositeConstruct %v4float %101 %102 %103 %104 + OpStore %x_GLF_color %105 + OpBranch %90 + %92 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %107 = OpLoad %float %106 + %108 = OpCompositeConstruct %v4float %107 %107 %107 %107 + OpStore %x_GLF_color %108 + OpBranch %90 + %90 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %109 +%tint_symbol = OpFunctionParameter %main_out + %113 = OpLabel + %114 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %114 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %116 = OpLabel + %117 = OpFunctionCall %void %main_1 + %119 = OpLoad %v4float %x_GLF_color + %120 = OpCompositeConstruct %main_out %119 + %118 = OpFunctionCall %void %tint_symbol_2 %120 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f6f65a61f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.spvasm.expected.wgsl @@ -0,0 +1,78 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A1 : array; + var a : i32; + var b : f32; + var c : bool; + var x_36 : bool; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[1]; + A1 = array(x_38, x_40, x_42); + let x_45 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_47 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_49 : i32 = x_9.x_GLF_uniform_int_values[1]; + a = clamp(x_45, x_47, x_49); + let x_51 : i32 = a; + let x_53 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_55 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_58 : f32 = A1[clamp(x_51, x_53, x_55)]; + b = x_58; + let x_59 : f32 = b; + let x_61 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_63 : f32 = A1[x_61]; + if ((x_59 < x_63)) { + let x_69 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_71 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_36 = (x_69 > x_71); + } else { + let x_74 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_76 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_78 : f32 = A1[x_76]; + x_36 = (x_74 < x_78); + } + let x_80 : bool = x_36; + c = x_80; + let x_81 : bool = c; + if (x_81) { + let x_86 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_89 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_92 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_95 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_86), f32(x_89), f32(x_92), f32(x_95)); + } else { + let x_99 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl new file mode 100644 index 0000000000..f6f65a61f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl @@ -0,0 +1,78 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A1 : array; + var a : i32; + var b : f32; + var c : bool; + var x_36 : bool; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[1]; + A1 = array(x_38, x_40, x_42); + let x_45 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_47 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_49 : i32 = x_9.x_GLF_uniform_int_values[1]; + a = clamp(x_45, x_47, x_49); + let x_51 : i32 = a; + let x_53 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_55 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_58 : f32 = A1[clamp(x_51, x_53, x_55)]; + b = x_58; + let x_59 : f32 = b; + let x_61 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_63 : f32 = A1[x_61]; + if ((x_59 < x_63)) { + let x_69 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_71 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_36 = (x_69 > x_71); + } else { + let x_74 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_76 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_78 : f32 = A1[x_76]; + x_36 = (x_74 < x_78); + } + let x_80 : bool = x_36; + c = x_80; + let x_81 : bool = c; + if (x_81) { + let x_86 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_89 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_92 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_95 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_86), f32(x_89), f32(x_92), f32(x_95)); + } else { + let x_99 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..ee0a08b3c0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.hlsl @@ -0,0 +1,77 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float A1[3] = (float[3])0; + int a = 0; + float b = 0.0f; + bool c = false; + bool x_36 = false; + const float x_38 = asfloat(x_6[2].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_42 = asfloat(x_6[1].x); + const float tint_symbol_4[3] = {x_38, x_40, x_42}; + A1 = tint_symbol_4; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_49 = asint(x_9[1].x); + a = clamp(x_45, x_47, x_49); + const int x_51 = a; + const int x_53 = asint(x_9[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_58 = A1[clamp(x_51, x_53, x_55)]; + b = x_58; + const float x_59 = b; + const int x_61 = asint(x_9[1].x); + const float x_63 = A1[x_61]; + if ((x_59 < x_63)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_69 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_71 = asfloat(x_6[2].x); + x_36 = (x_69 > x_71); + } else { + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_74 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_76 = asint(x_9[2].x); + const float x_78 = A1[x_76]; + x_36 = (x_74 < x_78); + } + c = x_36; + if (c) { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_86 = asint(x_9[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const int x_89 = asint(x_9[1].x); + const int x_92 = asint(x_9[1].x); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_95 = asint(x_9[scalar_offset_7 / 4][scalar_offset_7 % 4]); + x_GLF_color = float4(float(x_86), float(x_89), float(x_92), float(x_95)); + } else { + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const float x_99 = asfloat(x_6[scalar_offset_8 / 4][scalar_offset_8 % 4]); + x_GLF_color = float4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..6b19b3695a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.msl @@ -0,0 +1,90 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_5) { + tint_array_wrapper_2 A1 = {}; + int a = 0; + float b = 0.0f; + bool c = false; + bool x_36 = false; + float const x_38 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_40 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[1].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_38, x_40, x_42}}; + A1 = tint_symbol_3; + int const x_45 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_47 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_49 = x_9.x_GLF_uniform_int_values.arr[1].el; + a = clamp(x_45, x_47, x_49); + int const x_51 = a; + int const x_53 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_55 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_58 = A1.arr[clamp(x_51, x_53, x_55)]; + b = x_58; + float const x_59 = b; + int const x_61 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_63 = A1.arr[x_61]; + if ((x_59 < x_63)) { + float const x_69 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_71 = x_6.x_GLF_uniform_float_values.arr[2].el; + x_36 = (x_69 > x_71); + } else { + float const x_74 = x_6.x_GLF_uniform_float_values.arr[0].el; + int const x_76 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_78 = A1.arr[x_76]; + x_36 = (x_74 < x_78); + } + bool const x_80 = x_36; + c = x_80; + bool const x_81 = c; + if (x_81) { + int const x_86 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_89 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_92 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_95 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_86), float(x_89), float(x_92), float(x_95)); + } else { + float const x_99 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_5) = float4(x_99, x_99, x_99, x_99); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5e0a897a5e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.spvasm @@ -0,0 +1,186 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 121 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %A1 "A1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %x_36 "x_36" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_3_0 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_arr_float_uint_3_0 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3_0 = OpTypePointer Function %_arr_float_uint_3_0 + %26 = OpConstantNull %_arr_float_uint_3_0 +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %32 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %36 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %109 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %A1 = OpVariable %_ptr_Function__arr_float_uint_3_0 Function %26 + %a = OpVariable %_ptr_Function_int Function %29 + %b = OpVariable %_ptr_Function_float Function %32 + %c = OpVariable %_ptr_Function_bool Function %36 + %x_36 = OpVariable %_ptr_Function_bool Function %36 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %42 = OpLoad %float %41 + %44 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %45 = OpLoad %float %44 + %47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %48 = OpLoad %float %47 + %49 = OpCompositeConstruct %_arr_float_uint_3_0 %42 %45 %48 + OpStore %A1 %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpExtInst %int %58 SClamp %52 %54 %56 + OpStore %a %57 + %59 = OpLoad %int %a + %60 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpExtInst %int %58 SClamp %59 %61 %63 + %65 = OpAccessChain %_ptr_Function_float %A1 %64 + %66 = OpLoad %float %65 + OpStore %b %66 + %67 = OpLoad %float %b + %68 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Function_float %A1 %69 + %71 = OpLoad %float %70 + %72 = OpFOrdLessThan %bool %67 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %79 = OpLoad %float %78 + %80 = OpFOrdGreaterThan %bool %77 %79 + OpStore %x_36 %80 + OpBranch %73 + %75 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Function_float %A1 %84 + %86 = OpLoad %float %85 + %87 = OpFOrdLessThan %bool %82 %86 + OpStore %x_36 %87 + OpBranch %73 + %73 = OpLabel + %88 = OpLoad %bool %x_36 + OpStore %c %88 + %89 = OpLoad %bool %c + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 + %91 = OpLabel + %93 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %100 = OpLoad %int %99 + %101 = OpConvertSToF %float %94 + %102 = OpConvertSToF %float %96 + %103 = OpConvertSToF %float %98 + %104 = OpConvertSToF %float %100 + %105 = OpCompositeConstruct %v4float %101 %102 %103 %104 + OpStore %x_GLF_color %105 + OpBranch %90 + %92 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %107 = OpLoad %float %106 + %108 = OpCompositeConstruct %v4float %107 %107 %107 %107 + OpStore %x_GLF_color %108 + OpBranch %90 + %90 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %109 +%tint_symbol = OpFunctionParameter %main_out + %113 = OpLabel + %114 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %114 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %116 = OpLabel + %117 = OpFunctionCall %void %main_1 + %119 = OpLoad %v4float %x_GLF_color + %120 = OpCompositeConstruct %main_out %119 + %118 = OpFunctionCall %void %tint_symbol_2 %120 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f6f65a61f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-clamp-undefined-access-array/0-opt.wgsl.expected.wgsl @@ -0,0 +1,78 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A1 : array; + var a : i32; + var b : f32; + var c : bool; + var x_36 : bool; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[1]; + A1 = array(x_38, x_40, x_42); + let x_45 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_47 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_49 : i32 = x_9.x_GLF_uniform_int_values[1]; + a = clamp(x_45, x_47, x_49); + let x_51 : i32 = a; + let x_53 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_55 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_58 : f32 = A1[clamp(x_51, x_53, x_55)]; + b = x_58; + let x_59 : f32 = b; + let x_61 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_63 : f32 = A1[x_61]; + if ((x_59 < x_63)) { + let x_69 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_71 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_36 = (x_69 > x_71); + } else { + let x_74 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_76 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_78 : f32 = A1[x_76]; + x_36 = (x_74 < x_78); + } + let x_80 : bool = x_36; + c = x_80; + let x_81 : bool = c; + if (x_81) { + let x_86 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_89 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_92 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_95 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_86), f32(x_89), f32(x_92), f32(x_95)); + } else { + let x_99 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm new file mode 100644 index 0000000000..0d7bd957ae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm @@ -0,0 +1,128 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v "v" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool + %v3float = OpTypeVector %float 3 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %v3uint = OpTypeVector %uint 3 + %28 = OpConstantComposite %v3uint %uint_0 %uint_1 %uint_2 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %v4bool = OpTypeVector %bool 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %34 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + %i = OpVariable %_ptr_Function_int Function + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %36 = OpLoad %int %35 + %37 = OpConvertSToF %float %36 + %38 = OpCompositeConstruct %v4float %37 %37 %37 %37 + OpStore %v %38 + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %40 = OpLoad %int %39 + OpStore %i %40 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %int %i + %46 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %47 = OpLoad %int %46 + %48 = OpSLessThan %bool %45 %47 + OpBranchConditional %48 %49 %42 + %49 = OpLabel + %50 = OpLoad %int %i + %51 = OpLoad %int %i + %52 = OpConvertSToF %float %51 + %53 = OpVectorExtractDynamic %uint %28 %50 + %54 = OpAccessChain %_ptr_Function_float %v %53 + OpStore %54 %52 + OpBranch %43 + %43 = OpLabel + %55 = OpLoad %int %i + %56 = OpIAdd %int %55 %int_1 + OpStore %i %56 + OpBranch %41 + %42 = OpLabel + %57 = OpLoad %v4float %v + %58 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %68 + %70 = OpCompositeConstruct %v4float %60 %63 %66 %69 + %71 = OpFOrdEqual %v4bool %57 %70 + %72 = OpAll %bool %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %80 + %82 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %83 = OpLoad %int %82 + %84 = OpConvertSToF %float %83 + %85 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %86 + %88 = OpCompositeConstruct %v4float %78 %81 %84 %87 + OpStore %_GLF_color %88 + OpBranch %73 + %75 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %90 = OpLoad %int %89 + %91 = OpConvertSToF %float %90 + %92 = OpCompositeConstruct %v4float %91 %91 %91 %91 + OpStore %_GLF_color %92 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..a8ef20d5a6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,66 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + const int x_36 = asint(x_6[3].x); + const float x_37 = float(x_36); + v = float4(x_37, x_37, x_37, x_37); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + i = x_40; + while (true) { + const int x_45 = i; + const int x_47 = asint(x_6[3].x); + if ((x_45 < x_47)) { + } else { + break; + } + set_float4(v, uint3(0u, 1u, 2u)[i], float(i)); + { + i = (i + 1); + } + } + const float4 x_57 = v; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_62 = asint(x_6[1].x); + const int x_65 = asint(x_6[2].x); + const int x_68 = asint(x_6[3].x); + if (all((x_57 == float4(float(x_59), float(x_62), float(x_65), float(x_68))))) { + const int x_77 = asint(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_80 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_83 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_86 = asint(x_6[1].x); + x_GLF_color = float4(float(x_77), float(x_80), float(x_83), float(x_86)); + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_90 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_91 = float(x_90); + x_GLF_color = float4(x_91, x_91, x_91, x_91); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..3d744a33ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,70 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + int i = 0; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[3].el; + float const x_37 = float(x_36); + v = float4(x_37, x_37, x_37, x_37); + int const x_40 = x_6.x_GLF_uniform_int_values.arr[0].el; + i = x_40; + while (true) { + int const x_45 = i; + int const x_47 = x_6.x_GLF_uniform_int_values.arr[3].el; + if ((x_45 < x_47)) { + } else { + break; + } + int const x_50 = i; + int const x_51 = i; + v[uint3(0u, 1u, 2u)[x_50]] = float(x_51); + { + int const x_55 = i; + i = (x_55 + 1); + } + } + float4 const x_57 = v; + int const x_59 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_68 = x_6.x_GLF_uniform_int_values.arr[3].el; + if (all((x_57 == float4(float(x_59), float(x_62), float(x_65), float(x_68))))) { + int const x_77 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_80 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_83 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_86 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_77), float(x_80), float(x_83), float(x_86)); + } else { + int const x_90 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_91 = float(x_90); + *(tint_symbol_4) = float4(x_91, x_91, x_91, x_91); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..72cbcba7ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,164 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 109 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %51 = OpConstantComposite %v3uint %uint_0 %uint_1 %uint_2 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %v4bool = OpTypeVector %bool 4 + %main_out = OpTypeStruct %v4float + %97 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %12 + %i = OpVariable %_ptr_Function_int Function %23 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %28 = OpLoad %int %27 + %29 = OpConvertSToF %float %28 + %30 = OpCompositeConstruct %v4float %29 %29 %29 %29 + OpStore %v %30 + %32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %33 = OpLoad %int %32 + OpStore %i %33 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %40 = OpLoad %int %39 + %41 = OpSLessThan %bool %38 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %35 + %43 = OpLabel + %46 = OpLoad %int %i + %47 = OpLoad %int %i + %52 = OpVectorExtractDynamic %uint %51 %46 + %54 = OpAccessChain %_ptr_Function_float %v %52 + %55 = OpConvertSToF %float %47 + OpStore %54 %55 + OpBranch %36 + %36 = OpLabel + %56 = OpLoad %int %i + %58 = OpIAdd %int %56 %int_1 + OpStore %i %58 + OpBranch %34 + %35 = OpLabel + %59 = OpLoad %v4float %v + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %63 = OpLoad %int %62 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %68 = OpLoad %int %67 + %70 = OpConvertSToF %float %61 + %71 = OpConvertSToF %float %63 + %72 = OpConvertSToF %float %66 + %73 = OpConvertSToF %float %68 + %74 = OpCompositeConstruct %v4float %70 %71 %72 %73 + %75 = OpFOrdEqual %v4bool %59 %74 + %69 = OpAll %bool %75 + OpSelectionMerge %77 None + OpBranchConditional %69 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpConvertSToF %float %81 + %89 = OpConvertSToF %float %83 + %90 = OpConvertSToF %float %85 + %91 = OpConvertSToF %float %87 + %92 = OpCompositeConstruct %v4float %88 %89 %90 %91 + OpStore %x_GLF_color %92 + OpBranch %77 + %79 = OpLabel + %93 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %94 = OpLoad %int %93 + %95 = OpConvertSToF %float %94 + %96 = OpCompositeConstruct %v4float %95 %95 %95 %95 + OpStore %x_GLF_color %96 + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %97 +%tint_symbol = OpFunctionParameter %main_out + %101 = OpLabel + %102 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %102 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %104 = OpLabel + %105 = OpFunctionCall %void %main_1 + %107 = OpLoad %v4float %x_GLF_color + %108 = OpCompositeConstruct %main_out %107 + %106 = OpFunctionCall %void %tint_symbol_2 %108 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f495ad7888 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,64 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var i : i32; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_37 : f32 = f32(x_36); + v = vec4(x_37, x_37, x_37, x_37); + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + i = x_40; + loop { + let x_45 : i32 = i; + let x_47 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_45 < x_47)) { + } else { + break; + } + let x_50 : i32 = i; + let x_51 : i32 = i; + v[vec3(0u, 1u, 2u)[x_50]] = f32(x_51); + + continuing { + let x_55 : i32 = i; + i = (x_55 + 1); + } + } + let x_57 : vec4 = v; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_68 : i32 = x_6.x_GLF_uniform_int_values[3]; + if (all((x_57 == vec4(f32(x_59), f32(x_62), f32(x_65), f32(x_68))))) { + let x_77 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_80 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_83 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_86 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_77), f32(x_80), f32(x_83), f32(x_86)); + } else { + let x_90 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_91 : f32 = f32(x_90); + x_GLF_color = vec4(x_91, x_91, x_91, x_91); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl new file mode 100644 index 0000000000..f495ad7888 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl @@ -0,0 +1,64 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var i : i32; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_37 : f32 = f32(x_36); + v = vec4(x_37, x_37, x_37, x_37); + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + i = x_40; + loop { + let x_45 : i32 = i; + let x_47 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_45 < x_47)) { + } else { + break; + } + let x_50 : i32 = i; + let x_51 : i32 = i; + v[vec3(0u, 1u, 2u)[x_50]] = f32(x_51); + + continuing { + let x_55 : i32 = i; + i = (x_55 + 1); + } + } + let x_57 : vec4 = v; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_68 : i32 = x_6.x_GLF_uniform_int_values[3]; + if (all((x_57 == vec4(f32(x_59), f32(x_62), f32(x_65), f32(x_68))))) { + let x_77 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_80 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_83 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_86 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_77), f32(x_80), f32(x_83), f32(x_86)); + } else { + let x_90 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_91 : f32 = f32(x_90); + x_GLF_color = vec4(x_91, x_91, x_91, x_91); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..a8ef20d5a6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,66 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + const int x_36 = asint(x_6[3].x); + const float x_37 = float(x_36); + v = float4(x_37, x_37, x_37, x_37); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + i = x_40; + while (true) { + const int x_45 = i; + const int x_47 = asint(x_6[3].x); + if ((x_45 < x_47)) { + } else { + break; + } + set_float4(v, uint3(0u, 1u, 2u)[i], float(i)); + { + i = (i + 1); + } + } + const float4 x_57 = v; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_62 = asint(x_6[1].x); + const int x_65 = asint(x_6[2].x); + const int x_68 = asint(x_6[3].x); + if (all((x_57 == float4(float(x_59), float(x_62), float(x_65), float(x_68))))) { + const int x_77 = asint(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_80 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_83 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_86 = asint(x_6[1].x); + x_GLF_color = float4(float(x_77), float(x_80), float(x_83), float(x_86)); + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_90 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_91 = float(x_90); + x_GLF_color = float4(x_91, x_91, x_91, x_91); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..3d744a33ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,70 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + int i = 0; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[3].el; + float const x_37 = float(x_36); + v = float4(x_37, x_37, x_37, x_37); + int const x_40 = x_6.x_GLF_uniform_int_values.arr[0].el; + i = x_40; + while (true) { + int const x_45 = i; + int const x_47 = x_6.x_GLF_uniform_int_values.arr[3].el; + if ((x_45 < x_47)) { + } else { + break; + } + int const x_50 = i; + int const x_51 = i; + v[uint3(0u, 1u, 2u)[x_50]] = float(x_51); + { + int const x_55 = i; + i = (x_55 + 1); + } + } + float4 const x_57 = v; + int const x_59 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_68 = x_6.x_GLF_uniform_int_values.arr[3].el; + if (all((x_57 == float4(float(x_59), float(x_62), float(x_65), float(x_68))))) { + int const x_77 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_80 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_83 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_86 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_77), float(x_80), float(x_83), float(x_86)); + } else { + int const x_90 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_91 = float(x_90); + *(tint_symbol_4) = float4(x_91, x_91, x_91, x_91); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..72cbcba7ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,164 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 109 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %51 = OpConstantComposite %v3uint %uint_0 %uint_1 %uint_2 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %v4bool = OpTypeVector %bool 4 + %main_out = OpTypeStruct %v4float + %97 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %12 + %i = OpVariable %_ptr_Function_int Function %23 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %28 = OpLoad %int %27 + %29 = OpConvertSToF %float %28 + %30 = OpCompositeConstruct %v4float %29 %29 %29 %29 + OpStore %v %30 + %32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %33 = OpLoad %int %32 + OpStore %i %33 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %40 = OpLoad %int %39 + %41 = OpSLessThan %bool %38 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %35 + %43 = OpLabel + %46 = OpLoad %int %i + %47 = OpLoad %int %i + %52 = OpVectorExtractDynamic %uint %51 %46 + %54 = OpAccessChain %_ptr_Function_float %v %52 + %55 = OpConvertSToF %float %47 + OpStore %54 %55 + OpBranch %36 + %36 = OpLabel + %56 = OpLoad %int %i + %58 = OpIAdd %int %56 %int_1 + OpStore %i %58 + OpBranch %34 + %35 = OpLabel + %59 = OpLoad %v4float %v + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %63 = OpLoad %int %62 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %68 = OpLoad %int %67 + %70 = OpConvertSToF %float %61 + %71 = OpConvertSToF %float %63 + %72 = OpConvertSToF %float %66 + %73 = OpConvertSToF %float %68 + %74 = OpCompositeConstruct %v4float %70 %71 %72 %73 + %75 = OpFOrdEqual %v4bool %59 %74 + %69 = OpAll %bool %75 + OpSelectionMerge %77 None + OpBranchConditional %69 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpConvertSToF %float %81 + %89 = OpConvertSToF %float %83 + %90 = OpConvertSToF %float %85 + %91 = OpConvertSToF %float %87 + %92 = OpCompositeConstruct %v4float %88 %89 %90 %91 + OpStore %x_GLF_color %92 + OpBranch %77 + %79 = OpLabel + %93 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %94 = OpLoad %int %93 + %95 = OpConvertSToF %float %94 + %96 = OpCompositeConstruct %v4float %95 %95 %95 %95 + OpStore %x_GLF_color %96 + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %97 +%tint_symbol = OpFunctionParameter %main_out + %101 = OpLabel + %102 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %102 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %104 = OpLabel + %105 = OpFunctionCall %void %main_1 + %107 = OpLoad %v4float %x_GLF_color + %108 = OpCompositeConstruct %main_out %107 + %106 = OpFunctionCall %void %tint_symbol_2 %108 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f495ad7888 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-combine-casts-legalize-vector-types-xyz-swizzle-for-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,64 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var i : i32; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_37 : f32 = f32(x_36); + v = vec4(x_37, x_37, x_37, x_37); + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + i = x_40; + loop { + let x_45 : i32 = i; + let x_47 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_45 < x_47)) { + } else { + break; + } + let x_50 : i32 = i; + let x_51 : i32 = i; + v[vec3(0u, 1u, 2u)[x_50]] = f32(x_51); + + continuing { + let x_55 : i32 = i; + i = (x_55 + 1); + } + } + let x_57 : vec4 = v; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_68 : i32 = x_6.x_GLF_uniform_int_values[3]; + if (all((x_57 == vec4(f32(x_59), f32(x_62), f32(x_65), f32(x_68))))) { + let x_77 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_80 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_83 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_86 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_77), f32(x_80), f32(x_83), f32(x_86)); + } else { + let x_90 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_91 : f32 = f32(x_90); + x_GLF_color = vec4(x_91, x_91, x_91, x_91); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm new file mode 100644 index 0000000000..2e8e153d6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm @@ -0,0 +1,163 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_f1_ "func(f1;" + OpName %b "b" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %a "a" + OpName %param "param" + OpName %param_0 "param" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + %void = OpTypeVoid + %21 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpTypeFunction %float %_ptr_Function_float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4bool = OpTypeVector %bool 4 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %21 + %42 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_float Function + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %44 = OpLoad %float %43 + OpStore %param %44 + %45 = OpFunctionCall %float %func_f1_ %param + OpStore %a %45 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %49 = OpLoad %float %48 + %50 = OpFAdd %float %47 %49 + OpStore %param_0 %50 + %51 = OpFunctionCall %float %func_f1_ %param_0 + %52 = OpLoad %float %a + %53 = OpFAdd %float %52 %51 + OpStore %a %53 + %54 = OpLoad %float %a + %55 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %56 = OpLoad %float %55 + %57 = OpFOrdEqual %bool %54 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + %60 = OpLoad %v4float %_GLF_color + %61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %64 = OpLoad %float %63 + %65 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpCompositeConstruct %v4float %62 %64 %66 %68 + %70 = OpFOrdEqual %v4bool %60 %69 + %71 = OpAll %bool %70 + OpBranch %58 + %58 = OpLabel + %72 = OpPhi %bool %57 %42 %71 %59 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %15 = OpLoad %int %76 + %77 = OpConvertSToF %float %15 + %78 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %16 = OpLoad %int %78 + %79 = OpConvertSToF %float %16 + %80 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %17 = OpLoad %int %80 + %81 = OpConvertSToF %float %17 + %82 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %18 = OpLoad %int %82 + %83 = OpConvertSToF %float %18 + %84 = OpCompositeConstruct %v4float %77 %79 %81 %83 + OpStore %_GLF_color %84 + OpBranch %73 + %75 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %19 = OpLoad %int %85 + %86 = OpConvertSToF %float %19 + %87 = OpCompositeConstruct %v4float %86 %86 %86 %86 + OpStore %_GLF_color %87 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd + %func_f1_ = OpFunction %float None %24 + %b = OpFunctionParameter %_ptr_Function_float + %88 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %92 = OpLoad %float %91 + %93 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %94 = OpLoad %float %93 + %95 = OpCompositeConstruct %v4float %90 %92 %94 %float_1 + OpStore %_GLF_color %95 + %96 = OpLoad %v4float %_GLF_color + OpStore %_GLF_color %96 + %97 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %98 = OpLoad %float %97 + %99 = OpLoad %float %b + %100 = OpFOrdGreaterThanEqual %bool %98 %99 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %104 = OpLoad %float %103 + OpReturnValue %104 + %101 = OpLabel + %105 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %106 = OpLoad %float %105 + OpReturnValue %106 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..4152b789fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.hlsl @@ -0,0 +1,91 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[4]; +}; +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[2]; +}; + +float func_f1_(inout float b) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_90 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_92 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_94 = asfloat(x_7[1].x); + x_GLF_color = float4(x_90, x_92, x_94, 1.0f); + x_GLF_color = x_GLF_color; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_98 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_99 = b; + if ((x_98 >= x_99)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_104 = asfloat(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + return x_104; + } + const float x_106 = asfloat(x_7[2].x); + return x_106; +} + +void main_1() { + float a = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + bool x_71 = false; + bool x_72_phi = false; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + param = x_44; + const float x_45 = func_f1_(param); + a = x_45; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const float x_49 = asfloat(x_7[scalar_offset_6 / 4][scalar_offset_6 % 4]); + param_1 = (x_47 + x_49); + const float x_51 = func_f1_(param_1); + a = (a + x_51); + const float x_54 = a; + const float x_56 = asfloat(x_7[3].x); + const bool x_57 = (x_54 == x_56); + x_72_phi = x_57; + if (x_57) { + const float4 x_60 = x_GLF_color; + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const float x_62 = asfloat(x_7[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const float x_64 = asfloat(x_7[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float x_66 = asfloat(x_7[1].x); + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const float x_68 = asfloat(x_7[scalar_offset_9 / 4][scalar_offset_9 % 4]); + x_71 = all((x_60 == float4(x_62, x_64, x_66, x_68))); + x_72_phi = x_71; + } + if (x_72_phi) { + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_15 = asint(x_12[scalar_offset_10 / 4][scalar_offset_10 % 4]); + const int x_16 = asint(x_12[1].x); + const int x_17 = asint(x_12[1].x); + const uint scalar_offset_11 = ((16u * uint(0))) / 4; + const int x_18 = asint(x_12[scalar_offset_11 / 4][scalar_offset_11 % 4]); + x_GLF_color = float4(float(x_15), float(x_16), float(x_17), float(x_18)); + } else { + const int x_19 = asint(x_12[1].x); + const float x_86 = float(x_19); + x_GLF_color = float4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..3242c118d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.msl @@ -0,0 +1,99 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_f1_(constant buf1& x_7, thread float* const b, thread float4* const tint_symbol_4) { + float const x_90 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_92 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_94 = x_7.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_90, x_92, x_94, 1.0f); + float4 const x_96 = *(tint_symbol_4); + *(tint_symbol_4) = x_96; + float const x_98 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_99 = *(b); + if ((x_98 >= x_99)) { + float const x_104 = x_7.x_GLF_uniform_float_values.arr[0].el; + return x_104; + } + float const x_106 = x_7.x_GLF_uniform_float_values.arr[2].el; + return x_106; +} + +void main_1(constant buf1& x_7, constant buf0& x_12, thread float4* const tint_symbol_5) { + float a = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + bool x_71 = false; + bool x_72_phi = false; + float const x_44 = x_7.x_GLF_uniform_float_values.arr[0].el; + param = x_44; + float const x_45 = func_f1_(x_7, &(param), tint_symbol_5); + a = x_45; + float const x_47 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_49 = x_7.x_GLF_uniform_float_values.arr[0].el; + param_1 = (x_47 + x_49); + float const x_51 = func_f1_(x_7, &(param_1), tint_symbol_5); + float const x_52 = a; + a = (x_52 + x_51); + float const x_54 = a; + float const x_56 = x_7.x_GLF_uniform_float_values.arr[3].el; + bool const x_57 = (x_54 == x_56); + x_72_phi = x_57; + if (x_57) { + float4 const x_60 = *(tint_symbol_5); + float const x_62 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_64 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_66 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_68 = x_7.x_GLF_uniform_float_values.arr[0].el; + x_71 = all((x_60 == float4(x_62, x_64, x_66, x_68))); + x_72_phi = x_71; + } + bool const x_72 = x_72_phi; + if (x_72) { + int const x_15 = x_12.x_GLF_uniform_int_values.arr[0].el; + int const x_16 = x_12.x_GLF_uniform_int_values.arr[1].el; + int const x_17 = x_12.x_GLF_uniform_int_values.arr[1].el; + int const x_18 = x_12.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_15), float(x_16), float(x_17), float(x_18)); + } else { + int const x_19 = x_12.x_GLF_uniform_int_values.arr[1].el; + float const x_86 = float(x_19); + *(tint_symbol_5) = float4(x_86, x_86, x_86, x_86); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_12 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, x_12, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..862ad1ad8a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.spvasm @@ -0,0 +1,201 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 131 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_12 "x_12" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_f1_ "func_f1_" + OpName %b "b" + OpName %main_1 "main_1" + OpName %a "a" + OpName %param "param" + OpName %param_1 "param_1" + OpName %x_71 "x_71" + OpName %x_72_phi "x_72_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %float %_ptr_Function_float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %void = OpTypeVoid + %51 = OpTypeFunction %void + %56 = OpConstantNull %float +%_ptr_Function_bool = OpTypePointer Function %bool + %61 = OpConstantNull %bool + %int_3 = OpConstant %int 3 + %v4bool = OpTypeVector %bool 4 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %119 = OpTypeFunction %void %main_out + %func_f1_ = OpFunction %float None %20 + %b = OpFunctionParameter %_ptr_Function_float + %24 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %29 = OpLoad %float %28 + %30 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %31 = OpLoad %float %30 + %33 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %34 = OpLoad %float %33 + %36 = OpCompositeConstruct %v4float %29 %31 %34 %float_1 + OpStore %x_GLF_color %36 + %37 = OpLoad %v4float %x_GLF_color + OpStore %x_GLF_color %37 + %38 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %39 = OpLoad %float %38 + %41 = OpLoad %float %b + %42 = OpFOrdGreaterThanEqual %bool %39 %41 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %44 + %45 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %47 = OpLoad %float %46 + OpReturnValue %47 + %44 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %50 = OpLoad %float %49 + OpReturnValue %50 + OpFunctionEnd + %main_1 = OpFunction %void None %51 + %54 = OpLabel + %a = OpVariable %_ptr_Function_float Function %56 + %param = OpVariable %_ptr_Function_float Function %56 + %param_1 = OpVariable %_ptr_Function_float Function %56 + %x_71 = OpVariable %_ptr_Function_bool Function %61 + %x_72_phi = OpVariable %_ptr_Function_bool Function %61 + %63 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %64 = OpLoad %float %63 + OpStore %param %64 + %65 = OpFunctionCall %float %func_f1_ %param + OpStore %a %65 + %67 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %70 = OpLoad %float %69 + %71 = OpFAdd %float %68 %70 + OpStore %param_1 %71 + %72 = OpFunctionCall %float %func_f1_ %param_1 + %74 = OpLoad %float %a + %75 = OpFAdd %float %74 %72 + OpStore %a %75 + %76 = OpLoad %float %a + %78 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3 + %79 = OpLoad %float %78 + %80 = OpFOrdEqual %bool %76 %79 + OpStore %x_72_phi %80 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + %83 = OpLoad %v4float %x_GLF_color + %84 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %89 = OpLoad %float %88 + %90 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %91 = OpLoad %float %90 + %93 = OpCompositeConstruct %v4float %85 %87 %89 %91 + %94 = OpFOrdEqual %v4bool %83 %93 + %92 = OpAll %bool %94 + OpStore %x_71 %92 + %96 = OpLoad %bool %x_71 + OpStore %x_72_phi %96 + OpBranch %81 + %81 = OpLabel + %97 = OpLoad %bool %x_72_phi + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %100 + %99 = OpLabel + %102 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %103 = OpLoad %int %102 + %104 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %103 + %111 = OpConvertSToF %float %105 + %112 = OpConvertSToF %float %107 + %113 = OpConvertSToF %float %109 + %114 = OpCompositeConstruct %v4float %110 %111 %112 %113 + OpStore %x_GLF_color %114 + OpBranch %98 + %100 = OpLabel + %115 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %116 + %118 = OpCompositeConstruct %v4float %117 %117 %117 %117 + OpStore %x_GLF_color %118 + OpBranch %98 + %98 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %119 +%tint_symbol = OpFunctionParameter %main_out + %123 = OpLabel + %124 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %124 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %51 + %126 = OpLabel + %127 = OpFunctionCall %void %main_1 + %129 = OpLoad %v4float %x_GLF_color + %130 = OpCompositeConstruct %main_out %129 + %128 = OpFunctionCall %void %tint_symbol_2 %130 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f0938fc8dd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.spvasm.expected.wgsl @@ -0,0 +1,91 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_12 : buf0; + +fn func_f1_(b : ptr) -> f32 { + let x_90 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_92 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_94 : f32 = x_7.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_90, x_92, x_94, 1.0); + let x_96 : vec4 = x_GLF_color; + x_GLF_color = x_96; + let x_98 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_99 : f32 = *(b); + if ((x_98 >= x_99)) { + let x_104 : f32 = x_7.x_GLF_uniform_float_values[0]; + return x_104; + } + let x_106 : f32 = x_7.x_GLF_uniform_float_values[2]; + return x_106; +} + +fn main_1() { + var a : f32; + var param : f32; + var param_1 : f32; + var x_71 : bool; + var x_72_phi : bool; + let x_44 : f32 = x_7.x_GLF_uniform_float_values[0]; + param = x_44; + let x_45 : f32 = func_f1_(&(param)); + a = x_45; + let x_47 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_49 : f32 = x_7.x_GLF_uniform_float_values[0]; + param_1 = (x_47 + x_49); + let x_51 : f32 = func_f1_(&(param_1)); + let x_52 : f32 = a; + a = (x_52 + x_51); + let x_54 : f32 = a; + let x_56 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_57 : bool = (x_54 == x_56); + x_72_phi = x_57; + if (x_57) { + let x_60 : vec4 = x_GLF_color; + let x_62 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_64 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_66 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_68 : f32 = x_7.x_GLF_uniform_float_values[0]; + x_71 = all((x_60 == vec4(x_62, x_64, x_66, x_68))); + x_72_phi = x_71; + } + let x_72 : bool = x_72_phi; + if (x_72) { + let x_15 : i32 = x_12.x_GLF_uniform_int_values[0]; + let x_16 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_17 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_18 : i32 = x_12.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_15), f32(x_16), f32(x_17), f32(x_18)); + } else { + let x_19 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_86 : f32 = f32(x_19); + x_GLF_color = vec4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl new file mode 100644 index 0000000000..f0938fc8dd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl @@ -0,0 +1,91 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_12 : buf0; + +fn func_f1_(b : ptr) -> f32 { + let x_90 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_92 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_94 : f32 = x_7.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_90, x_92, x_94, 1.0); + let x_96 : vec4 = x_GLF_color; + x_GLF_color = x_96; + let x_98 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_99 : f32 = *(b); + if ((x_98 >= x_99)) { + let x_104 : f32 = x_7.x_GLF_uniform_float_values[0]; + return x_104; + } + let x_106 : f32 = x_7.x_GLF_uniform_float_values[2]; + return x_106; +} + +fn main_1() { + var a : f32; + var param : f32; + var param_1 : f32; + var x_71 : bool; + var x_72_phi : bool; + let x_44 : f32 = x_7.x_GLF_uniform_float_values[0]; + param = x_44; + let x_45 : f32 = func_f1_(&(param)); + a = x_45; + let x_47 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_49 : f32 = x_7.x_GLF_uniform_float_values[0]; + param_1 = (x_47 + x_49); + let x_51 : f32 = func_f1_(&(param_1)); + let x_52 : f32 = a; + a = (x_52 + x_51); + let x_54 : f32 = a; + let x_56 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_57 : bool = (x_54 == x_56); + x_72_phi = x_57; + if (x_57) { + let x_60 : vec4 = x_GLF_color; + let x_62 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_64 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_66 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_68 : f32 = x_7.x_GLF_uniform_float_values[0]; + x_71 = all((x_60 == vec4(x_62, x_64, x_66, x_68))); + x_72_phi = x_71; + } + let x_72 : bool = x_72_phi; + if (x_72) { + let x_15 : i32 = x_12.x_GLF_uniform_int_values[0]; + let x_16 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_17 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_18 : i32 = x_12.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_15), f32(x_16), f32(x_17), f32(x_18)); + } else { + let x_19 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_86 : f32 = f32(x_19); + x_GLF_color = vec4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..4152b789fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.hlsl @@ -0,0 +1,91 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[4]; +}; +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[2]; +}; + +float func_f1_(inout float b) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_90 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_92 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_94 = asfloat(x_7[1].x); + x_GLF_color = float4(x_90, x_92, x_94, 1.0f); + x_GLF_color = x_GLF_color; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_98 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_99 = b; + if ((x_98 >= x_99)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_104 = asfloat(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + return x_104; + } + const float x_106 = asfloat(x_7[2].x); + return x_106; +} + +void main_1() { + float a = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + bool x_71 = false; + bool x_72_phi = false; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + param = x_44; + const float x_45 = func_f1_(param); + a = x_45; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const float x_49 = asfloat(x_7[scalar_offset_6 / 4][scalar_offset_6 % 4]); + param_1 = (x_47 + x_49); + const float x_51 = func_f1_(param_1); + a = (a + x_51); + const float x_54 = a; + const float x_56 = asfloat(x_7[3].x); + const bool x_57 = (x_54 == x_56); + x_72_phi = x_57; + if (x_57) { + const float4 x_60 = x_GLF_color; + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const float x_62 = asfloat(x_7[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const float x_64 = asfloat(x_7[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float x_66 = asfloat(x_7[1].x); + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const float x_68 = asfloat(x_7[scalar_offset_9 / 4][scalar_offset_9 % 4]); + x_71 = all((x_60 == float4(x_62, x_64, x_66, x_68))); + x_72_phi = x_71; + } + if (x_72_phi) { + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_15 = asint(x_12[scalar_offset_10 / 4][scalar_offset_10 % 4]); + const int x_16 = asint(x_12[1].x); + const int x_17 = asint(x_12[1].x); + const uint scalar_offset_11 = ((16u * uint(0))) / 4; + const int x_18 = asint(x_12[scalar_offset_11 / 4][scalar_offset_11 % 4]); + x_GLF_color = float4(float(x_15), float(x_16), float(x_17), float(x_18)); + } else { + const int x_19 = asint(x_12[1].x); + const float x_86 = float(x_19); + x_GLF_color = float4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..3242c118d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.msl @@ -0,0 +1,99 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_f1_(constant buf1& x_7, thread float* const b, thread float4* const tint_symbol_4) { + float const x_90 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_92 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_94 = x_7.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_90, x_92, x_94, 1.0f); + float4 const x_96 = *(tint_symbol_4); + *(tint_symbol_4) = x_96; + float const x_98 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_99 = *(b); + if ((x_98 >= x_99)) { + float const x_104 = x_7.x_GLF_uniform_float_values.arr[0].el; + return x_104; + } + float const x_106 = x_7.x_GLF_uniform_float_values.arr[2].el; + return x_106; +} + +void main_1(constant buf1& x_7, constant buf0& x_12, thread float4* const tint_symbol_5) { + float a = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + bool x_71 = false; + bool x_72_phi = false; + float const x_44 = x_7.x_GLF_uniform_float_values.arr[0].el; + param = x_44; + float const x_45 = func_f1_(x_7, &(param), tint_symbol_5); + a = x_45; + float const x_47 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_49 = x_7.x_GLF_uniform_float_values.arr[0].el; + param_1 = (x_47 + x_49); + float const x_51 = func_f1_(x_7, &(param_1), tint_symbol_5); + float const x_52 = a; + a = (x_52 + x_51); + float const x_54 = a; + float const x_56 = x_7.x_GLF_uniform_float_values.arr[3].el; + bool const x_57 = (x_54 == x_56); + x_72_phi = x_57; + if (x_57) { + float4 const x_60 = *(tint_symbol_5); + float const x_62 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_64 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_66 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_68 = x_7.x_GLF_uniform_float_values.arr[0].el; + x_71 = all((x_60 == float4(x_62, x_64, x_66, x_68))); + x_72_phi = x_71; + } + bool const x_72 = x_72_phi; + if (x_72) { + int const x_15 = x_12.x_GLF_uniform_int_values.arr[0].el; + int const x_16 = x_12.x_GLF_uniform_int_values.arr[1].el; + int const x_17 = x_12.x_GLF_uniform_int_values.arr[1].el; + int const x_18 = x_12.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_15), float(x_16), float(x_17), float(x_18)); + } else { + int const x_19 = x_12.x_GLF_uniform_int_values.arr[1].el; + float const x_86 = float(x_19); + *(tint_symbol_5) = float4(x_86, x_86, x_86, x_86); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_12 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, x_12, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..862ad1ad8a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.spvasm @@ -0,0 +1,201 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 131 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_12 "x_12" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_f1_ "func_f1_" + OpName %b "b" + OpName %main_1 "main_1" + OpName %a "a" + OpName %param "param" + OpName %param_1 "param_1" + OpName %x_71 "x_71" + OpName %x_72_phi "x_72_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %float %_ptr_Function_float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %void = OpTypeVoid + %51 = OpTypeFunction %void + %56 = OpConstantNull %float +%_ptr_Function_bool = OpTypePointer Function %bool + %61 = OpConstantNull %bool + %int_3 = OpConstant %int 3 + %v4bool = OpTypeVector %bool 4 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %119 = OpTypeFunction %void %main_out + %func_f1_ = OpFunction %float None %20 + %b = OpFunctionParameter %_ptr_Function_float + %24 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %29 = OpLoad %float %28 + %30 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %31 = OpLoad %float %30 + %33 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %34 = OpLoad %float %33 + %36 = OpCompositeConstruct %v4float %29 %31 %34 %float_1 + OpStore %x_GLF_color %36 + %37 = OpLoad %v4float %x_GLF_color + OpStore %x_GLF_color %37 + %38 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %39 = OpLoad %float %38 + %41 = OpLoad %float %b + %42 = OpFOrdGreaterThanEqual %bool %39 %41 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %44 + %45 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %47 = OpLoad %float %46 + OpReturnValue %47 + %44 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %50 = OpLoad %float %49 + OpReturnValue %50 + OpFunctionEnd + %main_1 = OpFunction %void None %51 + %54 = OpLabel + %a = OpVariable %_ptr_Function_float Function %56 + %param = OpVariable %_ptr_Function_float Function %56 + %param_1 = OpVariable %_ptr_Function_float Function %56 + %x_71 = OpVariable %_ptr_Function_bool Function %61 + %x_72_phi = OpVariable %_ptr_Function_bool Function %61 + %63 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %64 = OpLoad %float %63 + OpStore %param %64 + %65 = OpFunctionCall %float %func_f1_ %param + OpStore %a %65 + %67 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %70 = OpLoad %float %69 + %71 = OpFAdd %float %68 %70 + OpStore %param_1 %71 + %72 = OpFunctionCall %float %func_f1_ %param_1 + %74 = OpLoad %float %a + %75 = OpFAdd %float %74 %72 + OpStore %a %75 + %76 = OpLoad %float %a + %78 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3 + %79 = OpLoad %float %78 + %80 = OpFOrdEqual %bool %76 %79 + OpStore %x_72_phi %80 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + %83 = OpLoad %v4float %x_GLF_color + %84 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %89 = OpLoad %float %88 + %90 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %91 = OpLoad %float %90 + %93 = OpCompositeConstruct %v4float %85 %87 %89 %91 + %94 = OpFOrdEqual %v4bool %83 %93 + %92 = OpAll %bool %94 + OpStore %x_71 %92 + %96 = OpLoad %bool %x_71 + OpStore %x_72_phi %96 + OpBranch %81 + %81 = OpLabel + %97 = OpLoad %bool %x_72_phi + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %100 + %99 = OpLabel + %102 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %103 = OpLoad %int %102 + %104 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %103 + %111 = OpConvertSToF %float %105 + %112 = OpConvertSToF %float %107 + %113 = OpConvertSToF %float %109 + %114 = OpCompositeConstruct %v4float %110 %111 %112 %113 + OpStore %x_GLF_color %114 + OpBranch %98 + %100 = OpLabel + %115 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %116 + %118 = OpCompositeConstruct %v4float %117 %117 %117 %117 + OpStore %x_GLF_color %118 + OpBranch %98 + %98 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %119 +%tint_symbol = OpFunctionParameter %main_out + %123 = OpLabel + %124 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %124 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %51 + %126 = OpLabel + %127 = OpFunctionCall %void %main_1 + %129 = OpLoad %v4float %x_GLF_color + %130 = OpCompositeConstruct %main_out %129 + %128 = OpFunctionCall %void %tint_symbol_2 %130 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f0938fc8dd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-glf_color/0-opt.wgsl.expected.wgsl @@ -0,0 +1,91 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_12 : buf0; + +fn func_f1_(b : ptr) -> f32 { + let x_90 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_92 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_94 : f32 = x_7.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_90, x_92, x_94, 1.0); + let x_96 : vec4 = x_GLF_color; + x_GLF_color = x_96; + let x_98 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_99 : f32 = *(b); + if ((x_98 >= x_99)) { + let x_104 : f32 = x_7.x_GLF_uniform_float_values[0]; + return x_104; + } + let x_106 : f32 = x_7.x_GLF_uniform_float_values[2]; + return x_106; +} + +fn main_1() { + var a : f32; + var param : f32; + var param_1 : f32; + var x_71 : bool; + var x_72_phi : bool; + let x_44 : f32 = x_7.x_GLF_uniform_float_values[0]; + param = x_44; + let x_45 : f32 = func_f1_(&(param)); + a = x_45; + let x_47 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_49 : f32 = x_7.x_GLF_uniform_float_values[0]; + param_1 = (x_47 + x_49); + let x_51 : f32 = func_f1_(&(param_1)); + let x_52 : f32 = a; + a = (x_52 + x_51); + let x_54 : f32 = a; + let x_56 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_57 : bool = (x_54 == x_56); + x_72_phi = x_57; + if (x_57) { + let x_60 : vec4 = x_GLF_color; + let x_62 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_64 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_66 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_68 : f32 = x_7.x_GLF_uniform_float_values[0]; + x_71 = all((x_60 == vec4(x_62, x_64, x_66, x_68))); + x_72_phi = x_71; + } + let x_72 : bool = x_72_phi; + if (x_72) { + let x_15 : i32 = x_12.x_GLF_uniform_int_values[0]; + let x_16 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_17 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_18 : i32 = x_12.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_15), f32(x_16), f32(x_17), f32(x_18)); + } else { + let x_19 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_86 : f32 = f32(x_19); + x_GLF_color = vec4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm new file mode 100644 index 0000000000..296caae523 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm @@ -0,0 +1,90 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float + %int_2 = OpConstant %int 2 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %9 + %28 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %29 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %30 = OpLoad %float %29 + OpStore %a %30 + %31 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %32 = OpLoad %float %31 + %33 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %34 = OpLoad %float %33 + %35 = OpFOrdGreaterThan %bool %32 %34 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %36 + %37 = OpLabel + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpLoad %float %a + %41 = OpFAdd %float %40 %39 + OpStore %a %41 + %42 = OpLoad %float %a + %43 = OpCompositeConstruct %v4float %42 %42 %42 %42 + OpStore %_GLF_color %43 + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %47 = OpLoad %float %46 + %48 = OpFOrdGreaterThan %bool %45 %47 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + %51 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_0 + %52 = OpLoad %float %51 + %53 = OpLoad %float %a + %54 = OpFAdd %float %53 %52 + OpStore %a %54 + %55 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %56 = OpLoad %float %55 + %57 = OpCompositeConstruct %v4float %56 %56 %56 %56 + OpStore %_GLF_color %57 + OpBranch %49 + %49 = OpLabel + OpBranch %36 + %36 = OpLabel + %58 = OpLoad %float %a + %59 = OpCompositeConstruct %v4float %58 %float_0 %float_0 %float_1 + OpStore %_GLF_color %59 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..fdbd6e9f35 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.hlsl @@ -0,0 +1,44 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + const float x_30 = asfloat(x_6[1].x); + a = x_30; + const float x_32 = asfloat(x_6[3].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_34 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_32 > x_34)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_39 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + a = (a + x_39); + const float x_42 = a; + x_GLF_color = float4(x_42, x_42, x_42, x_42); + const float x_45 = asfloat(x_6[3].x); + const float x_47 = asfloat(x_6[1].x); + if ((x_45 > x_47)) { + const float x_52 = x_GLF_color.x; + a = (a + x_52); + const float x_56 = asfloat(x_6[2].x); + x_GLF_color = float4(x_56, x_56, x_56, x_56); + } + } + x_GLF_color = float4(a, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b989bf7a6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float a = 0.0f; + float const x_30 = x_6.x_GLF_uniform_float_values.arr[1].el; + a = x_30; + float const x_32 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_34 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_32 > x_34)) { + float const x_39 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_40 = a; + a = (x_40 + x_39); + float const x_42 = a; + *(tint_symbol_4) = float4(x_42, x_42, x_42, x_42); + float const x_45 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_47 = x_6.x_GLF_uniform_float_values.arr[1].el; + if ((x_45 > x_47)) { + float const x_52 = (*(tint_symbol_4)).x; + float const x_53 = a; + a = (x_53 + x_52); + float const x_56 = x_6.x_GLF_uniform_float_values.arr[2].el; + *(tint_symbol_4) = float4(x_56, x_56, x_56, x_56); + } + } + float const x_58 = a; + *(tint_symbol_4) = float4(x_58, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..57160b278b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.spvasm @@ -0,0 +1,122 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_float = OpTypePointer Private %float + %int_2 = OpConstant %int 2 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %63 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %a = OpVariable %_ptr_Function_float Function %20 + %25 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %26 = OpLoad %float %25 + OpStore %a %26 + %28 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %29 = OpLoad %float %28 + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %32 = OpLoad %float %31 + %33 = OpFOrdGreaterThan %bool %29 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpLoad %float %a + %40 = OpFAdd %float %39 %38 + OpStore %a %40 + %41 = OpLoad %float %a + %42 = OpCompositeConstruct %v4float %41 %41 %41 %41 + OpStore %x_GLF_color %42 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %44 = OpLoad %float %43 + %45 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %46 = OpLoad %float %45 + %47 = OpFOrdGreaterThan %bool %44 %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + %51 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %52 = OpLoad %float %51 + %53 = OpLoad %float %a + %54 = OpFAdd %float %53 %52 + OpStore %a %54 + %56 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %57 = OpLoad %float %56 + %58 = OpCompositeConstruct %v4float %57 %57 %57 %57 + OpStore %x_GLF_color %58 + OpBranch %48 + %48 = OpLabel + OpBranch %35 + %35 = OpLabel + %59 = OpLoad %float %a + %62 = OpCompositeConstruct %v4float %59 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %62 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %63 +%tint_symbol = OpFunctionParameter %main_out + %67 = OpLabel + %68 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %68 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %70 = OpLabel + %71 = OpFunctionCall %void %main_1 + %73 = OpLoad %v4float %x_GLF_color + %74 = OpCompositeConstruct %main_out %73 + %72 = OpFunctionCall %void %tint_symbol_2 %74 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..3598a777d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.spvasm.expected.wgsl @@ -0,0 +1,48 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + let x_30 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = x_30; + let x_32 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_32 > x_34)) { + let x_39 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_40 : f32 = a; + a = (x_40 + x_39); + let x_42 : f32 = a; + x_GLF_color = vec4(x_42, x_42, x_42, x_42); + let x_45 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[1]; + if ((x_45 > x_47)) { + let x_52 : f32 = x_GLF_color.x; + let x_53 : f32 = a; + a = (x_53 + x_52); + let x_56 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_GLF_color = vec4(x_56, x_56, x_56, x_56); + } + } + let x_58 : f32 = a; + x_GLF_color = vec4(x_58, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl new file mode 100644 index 0000000000..3598a777d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl @@ -0,0 +1,48 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + let x_30 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = x_30; + let x_32 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_32 > x_34)) { + let x_39 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_40 : f32 = a; + a = (x_40 + x_39); + let x_42 : f32 = a; + x_GLF_color = vec4(x_42, x_42, x_42, x_42); + let x_45 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[1]; + if ((x_45 > x_47)) { + let x_52 : f32 = x_GLF_color.x; + let x_53 : f32 = a; + a = (x_53 + x_52); + let x_56 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_GLF_color = vec4(x_56, x_56, x_56, x_56); + } + } + let x_58 : f32 = a; + x_GLF_color = vec4(x_58, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..fdbd6e9f35 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.hlsl @@ -0,0 +1,44 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + const float x_30 = asfloat(x_6[1].x); + a = x_30; + const float x_32 = asfloat(x_6[3].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_34 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_32 > x_34)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_39 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + a = (a + x_39); + const float x_42 = a; + x_GLF_color = float4(x_42, x_42, x_42, x_42); + const float x_45 = asfloat(x_6[3].x); + const float x_47 = asfloat(x_6[1].x); + if ((x_45 > x_47)) { + const float x_52 = x_GLF_color.x; + a = (a + x_52); + const float x_56 = asfloat(x_6[2].x); + x_GLF_color = float4(x_56, x_56, x_56, x_56); + } + } + x_GLF_color = float4(a, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b989bf7a6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float a = 0.0f; + float const x_30 = x_6.x_GLF_uniform_float_values.arr[1].el; + a = x_30; + float const x_32 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_34 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_32 > x_34)) { + float const x_39 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_40 = a; + a = (x_40 + x_39); + float const x_42 = a; + *(tint_symbol_4) = float4(x_42, x_42, x_42, x_42); + float const x_45 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_47 = x_6.x_GLF_uniform_float_values.arr[1].el; + if ((x_45 > x_47)) { + float const x_52 = (*(tint_symbol_4)).x; + float const x_53 = a; + a = (x_53 + x_52); + float const x_56 = x_6.x_GLF_uniform_float_values.arr[2].el; + *(tint_symbol_4) = float4(x_56, x_56, x_56, x_56); + } + } + float const x_58 = a; + *(tint_symbol_4) = float4(x_58, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..57160b278b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.spvasm @@ -0,0 +1,122 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_float = OpTypePointer Private %float + %int_2 = OpConstant %int 2 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %63 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %a = OpVariable %_ptr_Function_float Function %20 + %25 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %26 = OpLoad %float %25 + OpStore %a %26 + %28 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %29 = OpLoad %float %28 + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %32 = OpLoad %float %31 + %33 = OpFOrdGreaterThan %bool %29 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpLoad %float %a + %40 = OpFAdd %float %39 %38 + OpStore %a %40 + %41 = OpLoad %float %a + %42 = OpCompositeConstruct %v4float %41 %41 %41 %41 + OpStore %x_GLF_color %42 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %44 = OpLoad %float %43 + %45 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %46 = OpLoad %float %45 + %47 = OpFOrdGreaterThan %bool %44 %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + %51 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %52 = OpLoad %float %51 + %53 = OpLoad %float %a + %54 = OpFAdd %float %53 %52 + OpStore %a %54 + %56 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %57 = OpLoad %float %56 + %58 = OpCompositeConstruct %v4float %57 %57 %57 %57 + OpStore %x_GLF_color %58 + OpBranch %48 + %48 = OpLabel + OpBranch %35 + %35 = OpLabel + %59 = OpLoad %float %a + %62 = OpCompositeConstruct %v4float %59 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %62 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %63 +%tint_symbol = OpFunctionParameter %main_out + %67 = OpLabel + %68 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %68 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %70 = OpLabel + %71 = OpFunctionCall %void %main_1 + %73 = OpLoad %v4float %x_GLF_color + %74 = OpCompositeConstruct %main_out %73 + %72 = OpFunctionCall %void %tint_symbol_2 %74 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..3598a777d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-increment-color/0-opt.wgsl.expected.wgsl @@ -0,0 +1,48 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + let x_30 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = x_30; + let x_32 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_32 > x_34)) { + let x_39 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_40 : f32 = a; + a = (x_40 + x_39); + let x_42 : f32 = a; + x_GLF_color = vec4(x_42, x_42, x_42, x_42); + let x_45 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[1]; + if ((x_45 > x_47)) { + let x_52 : f32 = x_GLF_color.x; + let x_53 : f32 = a; + a = (x_53 + x_52); + let x_56 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_GLF_color = vec4(x_56, x_56, x_56, x_56); + } + } + let x_58 : f32 = a; + x_GLF_color = vec4(x_58, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm new file mode 100644 index 0000000000..8abfc5505a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm @@ -0,0 +1,103 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %25 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %26 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %27 = OpLoad %int %26 + OpStore %a %27 + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %29 = OpLoad %int %28 + %30 = OpSNegate %int %29 + OpStore %i %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %int %i + %36 = OpIAdd %int %35 %int_1 + OpStore %i %36 + %37 = OpBitReverse %int %36 + %38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %39 = OpLoad %int %38 + %40 = OpSLessThanEqual %bool %37 %39 + OpBranchConditional %40 %41 %32 + %41 = OpLabel + %42 = OpLoad %int %a + %43 = OpIAdd %int %42 %int_1 + OpStore %a %43 + OpBranch %33 + %33 = OpLabel + OpBranch %31 + %32 = OpLabel + %44 = OpLoad %int %a + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpIEqual %bool %44 %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %61 + %63 = OpCompositeConstruct %v4float %53 %56 %59 %62 + OpStore %_GLF_color %63 + OpBranch %48 + %50 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpCompositeConstruct %v4float %66 %66 %66 %66 + OpStore %_GLF_color %67 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..eacc3f8b53 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.hlsl @@ -0,0 +1,52 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const int x_27 = asint(x_6[1].x); + a = x_27; + const int x_29 = asint(x_6[3].x); + i = -(x_29); + while (true) { + const int x_36 = (i + 1); + i = x_36; + const int x_39 = asint(x_6[2].x); + if ((reversebits(x_36) <= x_39)) { + } else { + break; + } + a = (a + 1); + } + const int x_44 = a; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_46 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_44 == x_46)) { + const int x_52 = asint(x_6[2].x); + const int x_55 = asint(x_6[1].x); + const int x_58 = asint(x_6[1].x); + const int x_61 = asint(x_6[2].x); + x_GLF_color = float4(float(x_52), float(x_55), float(x_58), float(x_61)); + } else { + const int x_65 = asint(x_6[1].x); + const float x_66 = float(x_65); + x_GLF_color = float4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f8f6e267b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_27; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[3].el; + i = -(x_29); + while (true) { + int const x_35 = i; + int const x_36 = (x_35 + 1); + i = x_36; + int const x_39 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((reverse_bits(x_36) <= x_39)) { + } else { + break; + } + int const x_42 = a; + a = (x_42 + 1); + } + int const x_44 = a; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_44 == x_46)) { + int const x_52 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_55 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_52), float(x_55), float(x_58), float(x_61)); + } else { + int const x_65 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_66 = float(x_65); + *(tint_symbol_4) = float4(x_66, x_66, x_66, x_66); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..9d357a5c4a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.spvasm @@ -0,0 +1,141 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 86 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %74 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + OpStore %a %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %30 = OpLoad %int %29 + %31 = OpSNegate %int %30 + OpStore %i %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %37 = OpIAdd %int %36 %int_1 + OpStore %i %37 + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %40 = OpLoad %int %39 + %41 = OpBitReverse %int %37 + %42 = OpSLessThanEqual %bool %41 %40 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %33 + %44 = OpLabel + %47 = OpLoad %int %a + %48 = OpIAdd %int %47 %int_1 + OpStore %a %48 + OpBranch %34 + %34 = OpLabel + OpBranch %32 + %33 = OpLabel + %49 = OpLoad %int %a + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpIEqual %bool %49 %52 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %58 + %66 = OpConvertSToF %float %60 + %67 = OpConvertSToF %float %62 + %68 = OpConvertSToF %float %64 + %69 = OpCompositeConstruct %v4float %65 %66 %67 %68 + OpStore %x_GLF_color %69 + OpBranch %54 + %56 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %71 + %73 = OpCompositeConstruct %v4float %72 %72 %72 %72 + OpStore %x_GLF_color %73 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %74 +%tint_symbol = OpFunctionParameter %main_out + %78 = OpLabel + %79 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %79 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %81 = OpLabel + %82 = OpFunctionCall %void %main_1 + %84 = OpLoad %v4float %x_GLF_color + %85 = OpCompositeConstruct %main_out %84 + %83 = OpFunctionCall %void %tint_symbol_2 %85 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..e59401373b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.spvasm.expected.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_27; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[3]; + i = -(x_29); + loop { + let x_35 : i32 = i; + let x_36 : i32 = (x_35 + 1); + i = x_36; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((reverseBits(x_36) <= x_39)) { + } else { + break; + } + let x_42 : i32 = a; + a = (x_42 + 1); + } + let x_44 : i32 = a; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_44 == x_46)) { + let x_52 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_55 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_52), f32(x_55), f32(x_58), f32(x_61)); + } else { + let x_65 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : f32 = f32(x_65); + x_GLF_color = vec4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl new file mode 100644 index 0000000000..e59401373b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_27; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[3]; + i = -(x_29); + loop { + let x_35 : i32 = i; + let x_36 : i32 = (x_35 + 1); + i = x_36; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((reverseBits(x_36) <= x_39)) { + } else { + break; + } + let x_42 : i32 = a; + a = (x_42 + 1); + } + let x_44 : i32 = a; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_44 == x_46)) { + let x_52 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_55 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_52), f32(x_55), f32(x_58), f32(x_61)); + } else { + let x_65 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : f32 = f32(x_65); + x_GLF_color = vec4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..eacc3f8b53 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.hlsl @@ -0,0 +1,52 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const int x_27 = asint(x_6[1].x); + a = x_27; + const int x_29 = asint(x_6[3].x); + i = -(x_29); + while (true) { + const int x_36 = (i + 1); + i = x_36; + const int x_39 = asint(x_6[2].x); + if ((reversebits(x_36) <= x_39)) { + } else { + break; + } + a = (a + 1); + } + const int x_44 = a; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_46 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_44 == x_46)) { + const int x_52 = asint(x_6[2].x); + const int x_55 = asint(x_6[1].x); + const int x_58 = asint(x_6[1].x); + const int x_61 = asint(x_6[2].x); + x_GLF_color = float4(float(x_52), float(x_55), float(x_58), float(x_61)); + } else { + const int x_65 = asint(x_6[1].x); + const float x_66 = float(x_65); + x_GLF_color = float4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f8f6e267b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_27; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[3].el; + i = -(x_29); + while (true) { + int const x_35 = i; + int const x_36 = (x_35 + 1); + i = x_36; + int const x_39 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((reverse_bits(x_36) <= x_39)) { + } else { + break; + } + int const x_42 = a; + a = (x_42 + 1); + } + int const x_44 = a; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_44 == x_46)) { + int const x_52 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_55 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_52), float(x_55), float(x_58), float(x_61)); + } else { + int const x_65 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_66 = float(x_65); + *(tint_symbol_4) = float4(x_66, x_66, x_66, x_66); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..9d357a5c4a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.spvasm @@ -0,0 +1,141 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 86 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %74 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + OpStore %a %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %30 = OpLoad %int %29 + %31 = OpSNegate %int %30 + OpStore %i %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %37 = OpIAdd %int %36 %int_1 + OpStore %i %37 + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %40 = OpLoad %int %39 + %41 = OpBitReverse %int %37 + %42 = OpSLessThanEqual %bool %41 %40 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %33 + %44 = OpLabel + %47 = OpLoad %int %a + %48 = OpIAdd %int %47 %int_1 + OpStore %a %48 + OpBranch %34 + %34 = OpLabel + OpBranch %32 + %33 = OpLabel + %49 = OpLoad %int %a + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpIEqual %bool %49 %52 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %58 + %66 = OpConvertSToF %float %60 + %67 = OpConvertSToF %float %62 + %68 = OpConvertSToF %float %64 + %69 = OpCompositeConstruct %v4float %65 %66 %67 %68 + OpStore %x_GLF_color %69 + OpBranch %54 + %56 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %71 + %73 = OpCompositeConstruct %v4float %72 %72 %72 %72 + OpStore %x_GLF_color %73 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %74 +%tint_symbol = OpFunctionParameter %main_out + %78 = OpLabel + %79 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %79 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %81 = OpLabel + %82 = OpFunctionCall %void %main_1 + %84 = OpLoad %v4float %x_GLF_color + %85 = OpCompositeConstruct %main_out %84 + %83 = OpFunctionCall %void %tint_symbol_2 %85 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..e59401373b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-loop-bitfieldreverse/0-opt.wgsl.expected.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_27; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[3]; + i = -(x_29); + loop { + let x_35 : i32 = i; + let x_36 : i32 = (x_35 + 1); + i = x_36; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((reverseBits(x_36) <= x_39)) { + } else { + break; + } + let x_42 : i32 = a; + a = (x_42 + 1); + } + let x_44 : i32 = a; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_44 == x_46)) { + let x_52 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_55 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_52), f32(x_55), f32(x_58), f32(x_61)); + } else { + let x_65 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : f32 = f32(x_65); + x_GLF_color = vec4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm new file mode 100644 index 0000000000..b9e06f2e65 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm @@ -0,0 +1,106 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "ten" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "minusEight" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %buf1 = OpTypeStruct %int +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_5 = OpConstant %int 5 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %int_n4 = OpConstant %int -4 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %30 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %12 + %31 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + OpStore %b %int_0 + OpStore %i %int_0 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %38 = OpLoad %int %37 + %39 = OpSLessThan %bool %36 %38 + OpBranchConditional %39 %40 %33 + %40 = OpLabel + %41 = OpLoad %int %a + %42 = OpSGreaterThan %bool %41 %int_5 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpBranch %33 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 + %46 = OpLoad %int %45 + %47 = OpSDiv %int %46 %int_n4 + %48 = OpLoad %int %a + %49 = OpIAdd %int %48 %47 + OpStore %a %49 + %50 = OpLoad %int %b + %51 = OpIAdd %int %50 %int_1 + OpStore %b %51 + OpBranch %34 + %34 = OpLabel + %52 = OpLoad %int %i + %53 = OpIAdd %int %52 %int_1 + OpStore %i %53 + OpBranch %32 + %33 = OpLabel + %54 = OpLoad %int %b + %55 = OpIEqual %bool %54 %int_3 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpStore %_GLF_color %29 + OpBranch %56 + %58 = OpLabel + OpStore %_GLF_color %30 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..7c9249ea08 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.hlsl @@ -0,0 +1,53 @@ +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int b = 0; + int i = 0; + a = 0; + b = 0; + i = 0; + while (true) { + const int x_36 = i; + const int x_38 = asint(x_8[0].x); + if ((x_36 < x_38)) { + } else { + break; + } + if ((a > 5)) { + break; + } + const int x_46 = asint(x_10[0].x); + a = (a + (x_46 / -4)); + b = (b + 1); + { + i = (i + 1); + } + } + if ((b == 3)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..673c4787e0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ int ten; +}; +struct buf0 { + /* 0x0000 */ int minusEight; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_8, constant buf0& x_10, thread float4* const tint_symbol_4) { + int a = 0; + int b = 0; + int i = 0; + a = 0; + b = 0; + i = 0; + while (true) { + int const x_36 = i; + int const x_38 = x_8.ten; + if ((x_36 < x_38)) { + } else { + break; + } + int const x_41 = a; + if ((x_41 > 5)) { + break; + } + int const x_46 = x_10.minusEight; + int const x_48 = a; + a = (x_48 + (x_46 / -4)); + int const x_50 = b; + b = (x_50 + 1); + { + int const x_52 = i; + i = (x_52 + 1); + } + } + int const x_54 = b; + if ((x_54 == 3)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_8 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b50c13547b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.spvasm @@ -0,0 +1,146 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "ten" + OpName %x_8 "x_8" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "minusEight" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf1 = OpTypeStruct %int +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_5 = OpConstant %int 5 + %int_n4 = OpConstant %int -4 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %64 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %65 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %66 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %b = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + OpStore %a %int_0 + OpStore %b %int_0 + OpStore %i %int_0 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %34 = OpLoad %int %33 + %35 = OpSLessThan %bool %29 %34 + OpSelectionMerge %37 None + OpBranchConditional %35 %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + OpBranch %26 + %37 = OpLabel + %40 = OpLoad %int %a + %42 = OpSGreaterThan %bool %40 %int_5 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpBranch %26 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 + %46 = OpLoad %int %45 + %47 = OpLoad %int %a + %49 = OpSDiv %int %46 %int_n4 + %50 = OpIAdd %int %47 %49 + OpStore %a %50 + %51 = OpLoad %int %b + %53 = OpIAdd %int %51 %int_1 + OpStore %b %53 + OpBranch %27 + %27 = OpLabel + %54 = OpLoad %int %i + %55 = OpIAdd %int %54 %int_1 + OpStore %i %55 + OpBranch %25 + %26 = OpLabel + %56 = OpLoad %int %b + %58 = OpIEqual %bool %56 %int_3 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + OpStore %x_GLF_color %64 + OpBranch %59 + %61 = OpLabel + OpStore %x_GLF_color %65 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %66 +%tint_symbol = OpFunctionParameter %main_out + %70 = OpLabel + %71 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %71 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %73 = OpLabel + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_2 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..7a99cd9bd0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.spvasm.expected.wgsl @@ -0,0 +1,64 @@ +[[block]] +struct buf1 { + ten : i32; +}; + +[[block]] +struct buf0 { + minusEight : i32; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var i : i32; + a = 0; + b = 0; + i = 0; + loop { + let x_36 : i32 = i; + let x_38 : i32 = x_8.ten; + if ((x_36 < x_38)) { + } else { + break; + } + let x_41 : i32 = a; + if ((x_41 > 5)) { + break; + } + let x_46 : i32 = x_10.minusEight; + let x_48 : i32 = a; + a = (x_48 + (x_46 / -4)); + let x_50 : i32 = b; + b = (x_50 + 1); + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_54 : i32 = b; + if ((x_54 == 3)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl new file mode 100644 index 0000000000..7a99cd9bd0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl @@ -0,0 +1,64 @@ +[[block]] +struct buf1 { + ten : i32; +}; + +[[block]] +struct buf0 { + minusEight : i32; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var i : i32; + a = 0; + b = 0; + i = 0; + loop { + let x_36 : i32 = i; + let x_38 : i32 = x_8.ten; + if ((x_36 < x_38)) { + } else { + break; + } + let x_41 : i32 = a; + if ((x_41 > 5)) { + break; + } + let x_46 : i32 = x_10.minusEight; + let x_48 : i32 = a; + a = (x_48 + (x_46 / -4)); + let x_50 : i32 = b; + b = (x_50 + 1); + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_54 : i32 = b; + if ((x_54 == 3)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..7c9249ea08 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.hlsl @@ -0,0 +1,53 @@ +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int b = 0; + int i = 0; + a = 0; + b = 0; + i = 0; + while (true) { + const int x_36 = i; + const int x_38 = asint(x_8[0].x); + if ((x_36 < x_38)) { + } else { + break; + } + if ((a > 5)) { + break; + } + const int x_46 = asint(x_10[0].x); + a = (a + (x_46 / -4)); + b = (b + 1); + { + i = (i + 1); + } + } + if ((b == 3)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..673c4787e0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ int ten; +}; +struct buf0 { + /* 0x0000 */ int minusEight; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_8, constant buf0& x_10, thread float4* const tint_symbol_4) { + int a = 0; + int b = 0; + int i = 0; + a = 0; + b = 0; + i = 0; + while (true) { + int const x_36 = i; + int const x_38 = x_8.ten; + if ((x_36 < x_38)) { + } else { + break; + } + int const x_41 = a; + if ((x_41 > 5)) { + break; + } + int const x_46 = x_10.minusEight; + int const x_48 = a; + a = (x_48 + (x_46 / -4)); + int const x_50 = b; + b = (x_50 + 1); + { + int const x_52 = i; + i = (x_52 + 1); + } + } + int const x_54 = b; + if ((x_54 == 3)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_8 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b50c13547b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.spvasm @@ -0,0 +1,146 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "ten" + OpName %x_8 "x_8" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "minusEight" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf1 = OpTypeStruct %int +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_5 = OpConstant %int 5 + %int_n4 = OpConstant %int -4 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %64 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %65 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %66 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %b = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + OpStore %a %int_0 + OpStore %b %int_0 + OpStore %i %int_0 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %34 = OpLoad %int %33 + %35 = OpSLessThan %bool %29 %34 + OpSelectionMerge %37 None + OpBranchConditional %35 %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + OpBranch %26 + %37 = OpLabel + %40 = OpLoad %int %a + %42 = OpSGreaterThan %bool %40 %int_5 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpBranch %26 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 + %46 = OpLoad %int %45 + %47 = OpLoad %int %a + %49 = OpSDiv %int %46 %int_n4 + %50 = OpIAdd %int %47 %49 + OpStore %a %50 + %51 = OpLoad %int %b + %53 = OpIAdd %int %51 %int_1 + OpStore %b %53 + OpBranch %27 + %27 = OpLabel + %54 = OpLoad %int %i + %55 = OpIAdd %int %54 %int_1 + OpStore %i %55 + OpBranch %25 + %26 = OpLabel + %56 = OpLoad %int %b + %58 = OpIEqual %bool %56 %int_3 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + OpStore %x_GLF_color %64 + OpBranch %59 + %61 = OpLabel + OpStore %x_GLF_color %65 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %66 +%tint_symbol = OpFunctionParameter %main_out + %70 = OpLabel + %71 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %71 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %73 = OpLabel + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_2 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..7a99cd9bd0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-neg-div-pow2/0-opt.wgsl.expected.wgsl @@ -0,0 +1,64 @@ +[[block]] +struct buf1 { + ten : i32; +}; + +[[block]] +struct buf0 { + minusEight : i32; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var i : i32; + a = 0; + b = 0; + i = 0; + loop { + let x_36 : i32 = i; + let x_38 : i32 = x_8.ten; + if ((x_36 < x_38)) { + } else { + break; + } + let x_41 : i32 = a; + if ((x_41 > 5)) { + break; + } + let x_46 : i32 = x_10.minusEight; + let x_48 : i32 = a; + a = (x_48 + (x_46 / -4)); + let x_50 : i32 = b; + b = (x_50 + 1); + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_54 : i32 = b; + if ((x_54 == 3)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm new file mode 100644 index 0000000000..033c99e561 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm @@ -0,0 +1,144 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %i "i" + OpName %v "v" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %30 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %31 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %float_2 = OpConstant %float 2 + %uint_2 = OpConstant %uint 2 + %float_3 = OpConstant %float 3 + %uint_3 = OpConstant %uint 3 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %13 + %40 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %c = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %v = OpVariable %_ptr_Function_v3float Function + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %42 = OpLoad %float %41 + OpStore %f %42 + OpStore %a %int_1 + OpStore %b %int_0 + OpStore %c %int_1 + OpStore %i %int_0 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %47 = OpLoad %int %i + %48 = OpSLessThan %bool %47 %int_3 + OpBranchConditional %48 %49 %44 + %49 = OpLabel + %50 = OpLoad %int %i + %51 = OpLoad %float %f + %52 = OpLoad %int %i + %53 = OpConvertSToF %float %52 + %54 = OpFAdd %float %51 %53 + %55 = OpAccessChain %_ptr_Function_float %v %50 + OpStore %55 %54 + OpBranch %45 + %45 = OpLabel + %56 = OpLoad %int %i + %57 = OpIAdd %int %56 %int_1 + OpStore %i %57 + OpBranch %43 + %44 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %59 = OpLoad %float %58 + %60 = OpFOrdEqual %bool %59 %float_1 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpBranch %63 + %63 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + OpStore %_GLF_color %30 + OpBranch %65 + %65 = OpLabel + %67 = OpLoad %int %c + %68 = OpLoad %int %a + %69 = OpLoad %int %b + %70 = OpBitwiseOr %int %68 %69 + %71 = OpBitwiseAnd %int %67 %70 + %72 = OpIEqual %bool %71 %int_0 + OpBranchConditional %72 %63 %64 + %64 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %74 = OpLoad %float %73 + %75 = OpFOrdEqual %bool %74 %float_1 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %76 + %77 = OpLabel + OpStore %_GLF_color %31 + OpBranch %76 + %76 = OpLabel + OpBranch %61 + %61 = OpLabel + %78 = OpAccessChain %_ptr_Function_float %v %uint_0 + %79 = OpLoad %float %78 + %80 = OpFOrdEqual %bool %79 %float_1 + %81 = OpSelect %float %80 %float_1 %float_0 + %82 = OpAccessChain %_ptr_Function_float %v %uint_1 + %83 = OpLoad %float %82 + %84 = OpFOrdEqual %bool %83 %float_2 + %85 = OpSelect %float %84 %float_0 %float_1 + %86 = OpAccessChain %_ptr_Function_float %v %uint_2 + %87 = OpLoad %float %86 + %88 = OpFOrdEqual %bool %87 %float_3 + %89 = OpSelect %float %88 %float_0 %float_1 + %90 = OpCompositeConstruct %v3float %81 %85 %89 + %91 = OpLoad %v4float %_GLF_color + %92 = OpVectorShuffle %v4float %91 %90 4 5 6 3 + OpStore %_GLF_color %92 + %93 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_3 + OpStore %93 %float_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..173ce9c99a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.hlsl @@ -0,0 +1,65 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int a = 0; + int b = 0; + int c = 0; + int i = 0; + float3 v = float3(0.0f, 0.0f, 0.0f); + const float x_42 = asfloat(x_6[0].x); + f = x_42; + a = 1; + b = 0; + c = 1; + i = 0; + { + for(; (i < 3); i = (i + 1)) { + set_float3(v, i, (f + float(i))); + } + } + const float x_59 = asfloat(x_6[0].x); + if ((x_59 == 1.0f)) { + while (true) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + { + if (((c & (a | b)) == 0)) { + } else { + break; + } + } + } + const float x_74 = asfloat(x_6[0].x); + if ((x_74 == 1.0f)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + } + const float x_79 = v.x; + const float x_83 = v.y; + const float x_87 = v.z; + const float3 x_90 = float3(((x_79 == 1.0f) ? 1.0f : 0.0f), ((x_83 == 2.0f) ? 0.0f : 1.0f), ((x_87 == 3.0f) ? 0.0f : 1.0f)); + x_GLF_color = float4(x_90.x, x_90.y, x_90.z, x_GLF_color.w); + x_GLF_color.w = 1.0f; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..bab3597373 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.msl @@ -0,0 +1,78 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + int a = 0; + int b = 0; + int c = 0; + int i = 0; + float3 v = 0.0f; + float const x_42 = x_6.one; + f = x_42; + a = 1; + b = 0; + c = 1; + i = 0; + while (true) { + int const x_47 = i; + if ((x_47 < 3)) { + } else { + break; + } + int const x_50 = i; + float const x_51 = f; + int const x_52 = i; + v[x_50] = (x_51 + float(x_52)); + { + int const x_56 = i; + i = (x_56 + 1); + } + } + float const x_59 = x_6.one; + if ((x_59 == 1.0f)) { + while (true) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + { + int const x_67 = c; + int const x_68 = a; + int const x_69 = b; + if (((x_67 & (x_68 | x_69)) == 0)) { + } else { + break; + } + } + } + float const x_74 = x_6.one; + if ((x_74 == 1.0f)) { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + } + float const x_79 = v.x; + float const x_83 = v.y; + float const x_87 = v.z; + float3 const x_90 = float3(select(0.0f, 1.0f, (x_79 == 1.0f)), select(1.0f, 0.0f, (x_83 == 2.0f)), select(1.0f, 0.0f, (x_87 == 3.0f))); + float4 const x_91 = *(tint_symbol_4); + *(tint_symbol_4) = float4(x_90.x, x_90.y, x_90.z, x_91.w); + (*(tint_symbol_4)).w = 1.0f; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..597775c584 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.spvasm @@ -0,0 +1,199 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 120 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %i "i" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %28 = OpConstantNull %v3float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %66 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %81 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %uint_3 = OpConstant %uint 3 +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %108 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %f = OpVariable %_ptr_Function_float Function %17 + %a = OpVariable %_ptr_Function_int Function %21 + %b = OpVariable %_ptr_Function_int Function %21 + %c = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %v = OpVariable %_ptr_Function_v3float Function %28 + %32 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %33 = OpLoad %float %32 + OpStore %f %33 + OpStore %a %int_1 + OpStore %b %int_0 + OpStore %c %int_1 + OpStore %i %int_0 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %i + %42 = OpSLessThan %bool %40 %int_3 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %37 + %44 = OpLabel + %47 = OpLoad %int %i + %48 = OpLoad %float %f + %49 = OpLoad %int %i + %50 = OpAccessChain %_ptr_Function_float %v %47 + %51 = OpConvertSToF %float %49 + %52 = OpFAdd %float %48 %51 + OpStore %50 %52 + OpBranch %38 + %38 = OpLabel + %53 = OpLoad %int %i + %54 = OpIAdd %int %53 %int_1 + OpStore %i %54 + OpBranch %36 + %37 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %56 = OpLoad %float %55 + %58 = OpFOrdEqual %bool %56 %float_1 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + OpStore %x_GLF_color %66 + OpBranch %63 + %63 = OpLabel + %67 = OpLoad %int %c + %68 = OpLoad %int %a + %69 = OpLoad %int %b + %70 = OpBitwiseOr %int %68 %69 + %71 = OpBitwiseAnd %int %67 %70 + %72 = OpIEqual %bool %71 %int_0 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + OpBranch %73 + %75 = OpLabel + OpBranch %62 + %73 = OpLabel + OpBranch %61 + %62 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %77 = OpLoad %float %76 + %78 = OpFOrdEqual %bool %77 %float_1 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + OpStore %x_GLF_color %81 + OpBranch %79 + %79 = OpLabel + OpBranch %59 + %59 = OpLabel + %82 = OpAccessChain %_ptr_Function_float %v %uint_0 + %83 = OpLoad %float %82 + %85 = OpAccessChain %_ptr_Function_float %v %uint_1 + %86 = OpLoad %float %85 + %88 = OpAccessChain %_ptr_Function_float %v %uint_2 + %89 = OpLoad %float %88 + %91 = OpFOrdEqual %bool %83 %float_1 + %90 = OpSelect %float %91 %float_1 %float_0 + %94 = OpFOrdEqual %bool %86 %float_2 + %92 = OpSelect %float %94 %float_0 %float_1 + %97 = OpFOrdEqual %bool %89 %float_3 + %95 = OpSelect %float %97 %float_0 %float_1 + %98 = OpCompositeConstruct %v3float %90 %92 %95 + %99 = OpLoad %v4float %x_GLF_color + %100 = OpCompositeExtract %float %98 0 + %101 = OpCompositeExtract %float %98 1 + %102 = OpCompositeExtract %float %98 2 + %103 = OpCompositeExtract %float %99 3 + %104 = OpCompositeConstruct %v4float %100 %101 %102 %103 + OpStore %x_GLF_color %104 + %107 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_3 + OpStore %107 %float_1 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %108 +%tint_symbol = OpFunctionParameter %main_out + %112 = OpLabel + %113 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %113 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %115 = OpLabel + %116 = OpFunctionCall %void %main_1 + %118 = OpLoad %v4float %x_GLF_color + %119 = OpCompositeConstruct %main_out %118 + %117 = OpFunctionCall %void %tint_symbol_2 %119 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 63[%63] is not post dominated by the back-edge block 73[%73] + %73 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b06321e747 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.spvasm.expected.wgsl @@ -0,0 +1,78 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var a : i32; + var b : i32; + var c : i32; + var i : i32; + var v : vec3; + let x_42 : f32 = x_6.one; + f = x_42; + a = 1; + b = 0; + c = 1; + i = 0; + loop { + let x_47 : i32 = i; + if ((x_47 < 3)) { + } else { + break; + } + let x_50 : i32 = i; + let x_51 : f32 = f; + let x_52 : i32 = i; + v[x_50] = (x_51 + f32(x_52)); + + continuing { + let x_56 : i32 = i; + i = (x_56 + 1); + } + } + let x_59 : f32 = x_6.one; + if ((x_59 == 1.0)) { + loop { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + + continuing { + let x_67 : i32 = c; + let x_68 : i32 = a; + let x_69 : i32 = b; + if (((x_67 & (x_68 | x_69)) == 0)) { + } else { + break; + } + } + } + let x_74 : f32 = x_6.one; + if ((x_74 == 1.0)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + } + let x_79 : f32 = v.x; + let x_83 : f32 = v.y; + let x_87 : f32 = v.z; + let x_90 : vec3 = vec3(select(0.0, 1.0, (x_79 == 1.0)), select(1.0, 0.0, (x_83 == 2.0)), select(1.0, 0.0, (x_87 == 3.0))); + let x_91 : vec4 = x_GLF_color; + x_GLF_color = vec4(x_90.x, x_90.y, x_90.z, x_91.w); + x_GLF_color.w = 1.0; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl new file mode 100644 index 0000000000..b06321e747 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl @@ -0,0 +1,78 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var a : i32; + var b : i32; + var c : i32; + var i : i32; + var v : vec3; + let x_42 : f32 = x_6.one; + f = x_42; + a = 1; + b = 0; + c = 1; + i = 0; + loop { + let x_47 : i32 = i; + if ((x_47 < 3)) { + } else { + break; + } + let x_50 : i32 = i; + let x_51 : f32 = f; + let x_52 : i32 = i; + v[x_50] = (x_51 + f32(x_52)); + + continuing { + let x_56 : i32 = i; + i = (x_56 + 1); + } + } + let x_59 : f32 = x_6.one; + if ((x_59 == 1.0)) { + loop { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + + continuing { + let x_67 : i32 = c; + let x_68 : i32 = a; + let x_69 : i32 = b; + if (((x_67 & (x_68 | x_69)) == 0)) { + } else { + break; + } + } + } + let x_74 : f32 = x_6.one; + if ((x_74 == 1.0)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + } + let x_79 : f32 = v.x; + let x_83 : f32 = v.y; + let x_87 : f32 = v.z; + let x_90 : vec3 = vec3(select(0.0, 1.0, (x_79 == 1.0)), select(1.0, 0.0, (x_83 == 2.0)), select(1.0, 0.0, (x_87 == 3.0))); + let x_91 : vec4 = x_GLF_color; + x_GLF_color = vec4(x_90.x, x_90.y, x_90.z, x_91.w); + x_GLF_color.w = 1.0; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..173ce9c99a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.hlsl @@ -0,0 +1,65 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int a = 0; + int b = 0; + int c = 0; + int i = 0; + float3 v = float3(0.0f, 0.0f, 0.0f); + const float x_42 = asfloat(x_6[0].x); + f = x_42; + a = 1; + b = 0; + c = 1; + i = 0; + { + for(; (i < 3); i = (i + 1)) { + set_float3(v, i, (f + float(i))); + } + } + const float x_59 = asfloat(x_6[0].x); + if ((x_59 == 1.0f)) { + while (true) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + { + if (((c & (a | b)) == 0)) { + } else { + break; + } + } + } + const float x_74 = asfloat(x_6[0].x); + if ((x_74 == 1.0f)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + } + const float x_79 = v.x; + const float x_83 = v.y; + const float x_87 = v.z; + const float3 x_90 = float3(((x_79 == 1.0f) ? 1.0f : 0.0f), ((x_83 == 2.0f) ? 0.0f : 1.0f), ((x_87 == 3.0f) ? 0.0f : 1.0f)); + x_GLF_color = float4(x_90.x, x_90.y, x_90.z, x_GLF_color.w); + x_GLF_color.w = 1.0f; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..bab3597373 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.msl @@ -0,0 +1,78 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + int a = 0; + int b = 0; + int c = 0; + int i = 0; + float3 v = 0.0f; + float const x_42 = x_6.one; + f = x_42; + a = 1; + b = 0; + c = 1; + i = 0; + while (true) { + int const x_47 = i; + if ((x_47 < 3)) { + } else { + break; + } + int const x_50 = i; + float const x_51 = f; + int const x_52 = i; + v[x_50] = (x_51 + float(x_52)); + { + int const x_56 = i; + i = (x_56 + 1); + } + } + float const x_59 = x_6.one; + if ((x_59 == 1.0f)) { + while (true) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + { + int const x_67 = c; + int const x_68 = a; + int const x_69 = b; + if (((x_67 & (x_68 | x_69)) == 0)) { + } else { + break; + } + } + } + float const x_74 = x_6.one; + if ((x_74 == 1.0f)) { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + } + float const x_79 = v.x; + float const x_83 = v.y; + float const x_87 = v.z; + float3 const x_90 = float3(select(0.0f, 1.0f, (x_79 == 1.0f)), select(1.0f, 0.0f, (x_83 == 2.0f)), select(1.0f, 0.0f, (x_87 == 3.0f))); + float4 const x_91 = *(tint_symbol_4); + *(tint_symbol_4) = float4(x_90.x, x_90.y, x_90.z, x_91.w); + (*(tint_symbol_4)).w = 1.0f; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..597775c584 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.spvasm @@ -0,0 +1,199 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 120 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %i "i" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %28 = OpConstantNull %v3float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %66 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %81 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %uint_3 = OpConstant %uint 3 +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %108 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %f = OpVariable %_ptr_Function_float Function %17 + %a = OpVariable %_ptr_Function_int Function %21 + %b = OpVariable %_ptr_Function_int Function %21 + %c = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %v = OpVariable %_ptr_Function_v3float Function %28 + %32 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %33 = OpLoad %float %32 + OpStore %f %33 + OpStore %a %int_1 + OpStore %b %int_0 + OpStore %c %int_1 + OpStore %i %int_0 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %i + %42 = OpSLessThan %bool %40 %int_3 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %37 + %44 = OpLabel + %47 = OpLoad %int %i + %48 = OpLoad %float %f + %49 = OpLoad %int %i + %50 = OpAccessChain %_ptr_Function_float %v %47 + %51 = OpConvertSToF %float %49 + %52 = OpFAdd %float %48 %51 + OpStore %50 %52 + OpBranch %38 + %38 = OpLabel + %53 = OpLoad %int %i + %54 = OpIAdd %int %53 %int_1 + OpStore %i %54 + OpBranch %36 + %37 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %56 = OpLoad %float %55 + %58 = OpFOrdEqual %bool %56 %float_1 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + OpStore %x_GLF_color %66 + OpBranch %63 + %63 = OpLabel + %67 = OpLoad %int %c + %68 = OpLoad %int %a + %69 = OpLoad %int %b + %70 = OpBitwiseOr %int %68 %69 + %71 = OpBitwiseAnd %int %67 %70 + %72 = OpIEqual %bool %71 %int_0 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + OpBranch %73 + %75 = OpLabel + OpBranch %62 + %73 = OpLabel + OpBranch %61 + %62 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %77 = OpLoad %float %76 + %78 = OpFOrdEqual %bool %77 %float_1 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + OpStore %x_GLF_color %81 + OpBranch %79 + %79 = OpLabel + OpBranch %59 + %59 = OpLabel + %82 = OpAccessChain %_ptr_Function_float %v %uint_0 + %83 = OpLoad %float %82 + %85 = OpAccessChain %_ptr_Function_float %v %uint_1 + %86 = OpLoad %float %85 + %88 = OpAccessChain %_ptr_Function_float %v %uint_2 + %89 = OpLoad %float %88 + %91 = OpFOrdEqual %bool %83 %float_1 + %90 = OpSelect %float %91 %float_1 %float_0 + %94 = OpFOrdEqual %bool %86 %float_2 + %92 = OpSelect %float %94 %float_0 %float_1 + %97 = OpFOrdEqual %bool %89 %float_3 + %95 = OpSelect %float %97 %float_0 %float_1 + %98 = OpCompositeConstruct %v3float %90 %92 %95 + %99 = OpLoad %v4float %x_GLF_color + %100 = OpCompositeExtract %float %98 0 + %101 = OpCompositeExtract %float %98 1 + %102 = OpCompositeExtract %float %98 2 + %103 = OpCompositeExtract %float %99 3 + %104 = OpCompositeConstruct %v4float %100 %101 %102 %103 + OpStore %x_GLF_color %104 + %107 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_3 + OpStore %107 %float_1 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %108 +%tint_symbol = OpFunctionParameter %main_out + %112 = OpLabel + %113 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %113 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %115 = OpLabel + %116 = OpFunctionCall %void %main_1 + %118 = OpLoad %v4float %x_GLF_color + %119 = OpCompositeConstruct %main_out %118 + %117 = OpFunctionCall %void %tint_symbol_2 %119 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 63[%63] is not post dominated by the back-edge block 73[%73] + %73 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b06321e747 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dag-combiner-same-cond-nested/0-opt.wgsl.expected.wgsl @@ -0,0 +1,78 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var a : i32; + var b : i32; + var c : i32; + var i : i32; + var v : vec3; + let x_42 : f32 = x_6.one; + f = x_42; + a = 1; + b = 0; + c = 1; + i = 0; + loop { + let x_47 : i32 = i; + if ((x_47 < 3)) { + } else { + break; + } + let x_50 : i32 = i; + let x_51 : f32 = f; + let x_52 : i32 = i; + v[x_50] = (x_51 + f32(x_52)); + + continuing { + let x_56 : i32 = i; + i = (x_56 + 1); + } + } + let x_59 : f32 = x_6.one; + if ((x_59 == 1.0)) { + loop { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + + continuing { + let x_67 : i32 = c; + let x_68 : i32 = a; + let x_69 : i32 = b; + if (((x_67 & (x_68 | x_69)) == 0)) { + } else { + break; + } + } + } + let x_74 : f32 = x_6.one; + if ((x_74 == 1.0)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + } + let x_79 : f32 = v.x; + let x_83 : f32 = v.y; + let x_87 : f32 = v.z; + let x_90 : vec3 = vec3(select(0.0, 1.0, (x_79 == 1.0)), select(1.0, 0.0, (x_83 == 2.0)), select(1.0, 0.0, (x_87 == 3.0))); + let x_91 : vec4 = x_GLF_color; + x_GLF_color = vec4(x_90.x, x_90.y, x_90.z, x_91.w); + x_GLF_color.w = 1.0; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm new file mode 100644 index 0000000000..294733e908 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm @@ -0,0 +1,214 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_f1_ "func(f1;" + OpName %x "x" + OpName %a "a" + OpName %f "f" + OpName %i "i" + OpName %param "param" + OpName %param_0 "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpTypeFunction %float %_ptr_Function_float + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %float_6 = OpConstant %float 6 + %float_5 = OpConstant %float 5 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %24 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %main = OpFunction %void None %12 + %28 = OpLabel + %29 = OpVariable %_ptr_Function_bool Function %false + %30 = OpVariable %_ptr_Function_float Function + %31 = OpVariable %_ptr_Function_float Function + %32 = OpVariable %_ptr_Function_float Function + %33 = OpVariable %_ptr_Function_bool Function %false + %34 = OpVariable %_ptr_Function_float Function + %35 = OpVariable %_ptr_Function_float Function + %36 = OpVariable %_ptr_Function_float Function + %f = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_float Function + OpStore %f %float_0 + OpStore %i %float_0 + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %float %i + OpStore %param %38 + OpStore %33 %false + OpLoopMerge %39 %37 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %float %param + OpStore %35 %41 + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %float %35 + %49 = OpLoad %float %param + %50 = OpFOrdEqual %bool %48 %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %53 = OpLoad %float %35 + OpStore %33 %true + OpStore %34 %53 + OpBranch %45 + %51 = OpLabel + %54 = OpLoad %float %35 + %55 = OpFAdd %float %54 %float_1 + OpStore %35 %55 + OpBranch %46 + %46 = OpLabel + %56 = OpLoad %float %35 + %57 = OpLoad %float %param + %58 = OpFOrdLessThan %bool %56 %57 + OpBranchConditional %58 %44 %45 + %45 = OpLabel + %59 = OpLoad %bool %33 + OpSelectionMerge %60 None + OpBranchConditional %59 %42 %60 + %60 = OpLabel + OpStore %33 %true + OpStore %34 %float_0 + OpBranch %42 + %43 = OpLabel + OpBranch %40 + %42 = OpLabel + %61 = OpLoad %float %34 + OpStore %36 %61 + OpStore %f %61 + OpStore %param_0 %float_1 + OpStore %29 %false + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %float %param_0 + OpStore %31 %63 + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %70 = OpLoad %float %31 + %71 = OpLoad %float %param_0 + %72 = OpFOrdEqual %bool %70 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpLoad %float %31 + OpStore %29 %true + OpStore %30 %75 + OpBranch %67 + %73 = OpLabel + %76 = OpLoad %float %31 + %77 = OpFAdd %float %76 %float_1 + OpStore %31 %77 + OpBranch %68 + %68 = OpLabel + %78 = OpLoad %float %31 + %79 = OpLoad %float %param_0 + %80 = OpFOrdLessThan %bool %78 %79 + OpBranchConditional %80 %66 %67 + %67 = OpLabel + %81 = OpLoad %bool %29 + OpSelectionMerge %82 None + OpBranchConditional %81 %64 %82 + %82 = OpLabel + OpStore %29 %true + OpStore %30 %float_0 + OpBranch %64 + %65 = OpLabel + OpBranch %62 + %64 = OpLabel + %83 = OpLoad %float %30 + OpStore %32 %83 + %84 = OpLoad %float %i + %85 = OpFAdd %float %84 %83 + OpStore %i %85 + %86 = OpFOrdLessThan %bool %85 %float_6 + OpBranchConditional %86 %37 %39 + %39 = OpLabel + %87 = OpLoad %float %f + %88 = OpFOrdEqual %bool %87 %float_5 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %91 + %90 = OpLabel + OpStore %_GLF_color %23 + OpBranch %89 + %91 = OpLabel + OpStore %_GLF_color %24 + OpBranch %89 + %89 = OpLabel + OpReturn + OpFunctionEnd + %func_f1_ = OpFunction %float None %15 + %x = OpFunctionParameter %_ptr_Function_float + %92 = OpLabel + %93 = OpVariable %_ptr_Function_bool Function %false + %94 = OpVariable %_ptr_Function_float Function + %a = OpVariable %_ptr_Function_float Function + OpBranch %95 + %95 = OpLabel + %96 = OpLoad %float %x + OpStore %a %96 + OpLoopMerge %97 %98 None + OpBranch %99 + %99 = OpLabel + OpLoopMerge %100 %101 None + OpBranch %102 + %102 = OpLabel + %103 = OpLoad %float %a + %104 = OpLoad %float %x + %105 = OpFOrdEqual %bool %103 %104 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + %108 = OpLoad %float %a + OpStore %93 %true + OpStore %94 %108 + OpBranch %100 + %106 = OpLabel + %109 = OpLoad %float %a + %110 = OpFAdd %float %109 %float_1 + OpStore %a %110 + OpBranch %101 + %101 = OpLabel + %111 = OpLoad %float %a + %112 = OpLoad %float %x + %113 = OpFOrdLessThan %bool %111 %112 + OpBranchConditional %113 %99 %100 + %100 = OpLabel + %114 = OpLoad %bool %93 + OpSelectionMerge %115 None + OpBranchConditional %114 %97 %115 + %115 = OpLabel + OpStore %93 %true + OpStore %94 %float_0 + OpBranch %97 + %98 = OpLabel + OpBranch %95 + %97 = OpLabel + %116 = OpLoad %float %94 + OpReturnValue %116 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..0dbbaa933b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.hlsl @@ -0,0 +1,139 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_29 = false; + float x_30 = 0.0f; + float x_31 = 0.0f; + float x_32 = 0.0f; + bool x_33 = false; + float x_34 = 0.0f; + float x_35 = 0.0f; + float x_36 = 0.0f; + float f = 0.0f; + float i = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + f = 0.0f; + i = 0.0f; + while (true) { + param = i; + x_33 = false; + while (true) { + x_35 = param; + while (true) { + if ((x_35 == param)) { + const float x_53 = x_35; + x_33 = true; + x_34 = x_53; + break; + } + x_35 = (x_35 + 1.0f); + { + if ((x_35 < param)) { + } else { + break; + } + } + } + if (x_33) { + break; + } + x_33 = true; + x_34 = 0.0f; + break; + } + const float x_61 = x_34; + x_36 = x_61; + f = x_61; + param_1 = 1.0f; + x_29 = false; + while (true) { + x_31 = param_1; + while (true) { + if ((x_31 == param_1)) { + const float x_75 = x_31; + x_29 = true; + x_30 = x_75; + break; + } + x_31 = (x_31 + 1.0f); + { + if ((x_31 < param_1)) { + } else { + break; + } + } + } + if (x_29) { + break; + } + x_29 = true; + x_30 = 0.0f; + break; + } + const float x_83 = x_30; + x_32 = x_83; + const float x_85 = (i + x_83); + i = x_85; + if ((x_85 < 6.0f)) { + } else { + break; + } + } + if ((f == 5.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} + +float func_f1_(inout float x) { + bool x_93 = false; + float x_94 = 0.0f; + float a = 0.0f; + while (true) { + const float x_96 = x; + a = x_96; + while (true) { + const float x_103 = a; + const float x_104 = x; + if ((x_103 == x_104)) { + const float x_108 = a; + x_93 = true; + x_94 = x_108; + break; + } + a = (a + 1.0f); + { + const float x_111 = a; + const float x_112 = x; + if ((x_111 < x_112)) { + } else { + break; + } + } + } + if (x_93) { + break; + } + x_93 = true; + x_94 = 0.0f; + break; + } + return x_94; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..cf634301c1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.msl @@ -0,0 +1,162 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool x_29 = false; + float x_30 = 0.0f; + float x_31 = 0.0f; + float x_32 = 0.0f; + bool x_33 = false; + float x_34 = 0.0f; + float x_35 = 0.0f; + float x_36 = 0.0f; + float f = 0.0f; + float i = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + f = 0.0f; + i = 0.0f; + while (true) { + float const x_38 = i; + param = x_38; + x_33 = false; + while (true) { + float const x_41 = param; + x_35 = x_41; + while (true) { + float const x_48 = x_35; + float const x_49 = param; + if ((x_48 == x_49)) { + float const x_53 = x_35; + x_33 = true; + x_34 = x_53; + break; + } + float const x_54 = x_35; + x_35 = (x_54 + 1.0f); + { + float const x_56 = x_35; + float const x_57 = param; + if ((x_56 < x_57)) { + } else { + break; + } + } + } + bool const x_59 = x_33; + if (x_59) { + break; + } + x_33 = true; + x_34 = 0.0f; + break; + } + float const x_61 = x_34; + x_36 = x_61; + f = x_61; + param_1 = 1.0f; + x_29 = false; + while (true) { + float const x_63 = param_1; + x_31 = x_63; + while (true) { + float const x_70 = x_31; + float const x_71 = param_1; + if ((x_70 == x_71)) { + float const x_75 = x_31; + x_29 = true; + x_30 = x_75; + break; + } + float const x_76 = x_31; + x_31 = (x_76 + 1.0f); + { + float const x_78 = x_31; + float const x_79 = param_1; + if ((x_78 < x_79)) { + } else { + break; + } + } + } + bool const x_81 = x_29; + if (x_81) { + break; + } + x_29 = true; + x_30 = 0.0f; + break; + } + float const x_83 = x_30; + x_32 = x_83; + float const x_84 = i; + float const x_85 = (x_84 + x_83); + i = x_85; + if ((x_85 < 6.0f)) { + } else { + break; + } + } + float const x_87 = f; + if ((x_87 == 5.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +float func_f1_(thread float* const x) { + bool x_93 = false; + float x_94 = 0.0f; + float a = 0.0f; + while (true) { + float const x_96 = *(x); + a = x_96; + while (true) { + float const x_103 = a; + float const x_104 = *(x); + if ((x_103 == x_104)) { + float const x_108 = a; + x_93 = true; + x_94 = x_108; + break; + } + float const x_109 = a; + a = (x_109 + 1.0f); + { + float const x_111 = a; + float const x_112 = *(x); + if ((x_111 < x_112)) { + } else { + break; + } + } + } + bool const x_114 = x_93; + if (x_114) { + break; + } + x_93 = true; + x_94 = 0.0f; + break; + } + float const x_116 = x_94; + return x_116; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..278320df45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.spvasm @@ -0,0 +1,308 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_29 "x_29" + OpName %x_30 "x_30" + OpName %x_31 "x_31" + OpName %x_32 "x_32" + OpName %x_33 "x_33" + OpName %x_34 "x_34" + OpName %x_35 "x_35" + OpName %x_36 "x_36" + OpName %f "f" + OpName %i "i" + OpName %param "param" + OpName %param_1 "param_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %func_f1_ "func_f1_" + OpName %x "x" + OpName %x_93 "x_93" + OpName %x_94 "x_94" + OpName %a "a" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %16 = OpConstantNull %bool +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %float_6 = OpConstant %float 6 + %float_5 = OpConstant %float 5 + %105 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %106 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %107 = OpTypeFunction %void %main_out + %119 = OpTypeFunction %float %_ptr_Function_float + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %x_29 = OpVariable %_ptr_Function_bool Function %16 + %x_30 = OpVariable %_ptr_Function_float Function %19 + %x_31 = OpVariable %_ptr_Function_float Function %19 + %x_32 = OpVariable %_ptr_Function_float Function %19 + %x_33 = OpVariable %_ptr_Function_bool Function %16 + %x_34 = OpVariable %_ptr_Function_float Function %19 + %x_35 = OpVariable %_ptr_Function_float Function %19 + %x_36 = OpVariable %_ptr_Function_float Function %19 + %f = OpVariable %_ptr_Function_float Function %19 + %i = OpVariable %_ptr_Function_float Function %19 + %param = OpVariable %_ptr_Function_float Function %19 + %param_1 = OpVariable %_ptr_Function_float Function %19 + OpStore %x_29 %false + OpStore %x_33 %false + OpStore %f %float_0 + OpStore %i %float_0 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %float %i + OpStore %param %35 + OpStore %x_33 %false + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %float %param + OpStore %x_35 %40 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %float %x_35 + %46 = OpLoad %float %param + %47 = OpFOrdEqual %bool %45 %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + %50 = OpLoad %float %x_35 + OpStore %x_33 %true + OpStore %x_34 %50 + OpBranch %42 + %48 = OpLabel + %52 = OpLoad %float %x_35 + %54 = OpFAdd %float %52 %float_1 + OpStore %x_35 %54 + OpBranch %43 + %43 = OpLabel + %55 = OpLoad %float %x_35 + %56 = OpLoad %float %param + %57 = OpFOrdLessThan %bool %55 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %42 + %58 = OpLabel + OpBranch %41 + %42 = OpLabel + %61 = OpLoad %bool %x_33 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + OpBranch %37 + %62 = OpLabel + OpStore %x_33 %true + OpStore %x_34 %float_0 + OpBranch %37 + %38 = OpLabel + OpBranch %36 + %37 = OpLabel + %64 = OpLoad %float %x_34 + OpStore %x_36 %64 + OpStore %f %64 + OpStore %param_1 %float_1 + OpStore %x_29 %false + OpBranch %65 + %65 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %69 = OpLoad %float %param_1 + OpStore %x_31 %69 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %float %x_31 + %75 = OpLoad %float %param_1 + %76 = OpFOrdEqual %bool %74 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + %79 = OpLoad %float %x_31 + OpStore %x_29 %true + OpStore %x_30 %79 + OpBranch %71 + %77 = OpLabel + %80 = OpLoad %float %x_31 + %81 = OpFAdd %float %80 %float_1 + OpStore %x_31 %81 + OpBranch %72 + %72 = OpLabel + %82 = OpLoad %float %x_31 + %83 = OpLoad %float %param_1 + %84 = OpFOrdLessThan %bool %82 %83 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %87 + %86 = OpLabel + OpBranch %85 + %87 = OpLabel + OpBranch %71 + %85 = OpLabel + OpBranch %70 + %71 = OpLabel + %88 = OpLoad %bool %x_29 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + OpBranch %66 + %89 = OpLabel + OpStore %x_29 %true + OpStore %x_30 %float_0 + OpBranch %66 + %67 = OpLabel + OpBranch %65 + %66 = OpLabel + %91 = OpLoad %float %x_30 + OpStore %x_32 %91 + %92 = OpLoad %float %i + %93 = OpFAdd %float %92 %91 + OpStore %i %93 + %95 = OpFOrdLessThan %bool %93 %float_6 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %98 + %97 = OpLabel + OpBranch %96 + %98 = OpLabel + OpBranch %32 + %96 = OpLabel + OpBranch %33 + %33 = OpLabel + OpBranch %31 + %32 = OpLabel + %99 = OpLoad %float %f + %101 = OpFOrdEqual %bool %99 %float_5 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpStore %x_GLF_color %105 + OpBranch %102 + %104 = OpLabel + OpStore %x_GLF_color %106 + OpBranch %102 + %102 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %107 +%tint_symbol = OpFunctionParameter %main_out + %111 = OpLabel + %112 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %112 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %114 = OpLabel + %115 = OpFunctionCall %void %main_1 + %117 = OpLoad %v4float %x_GLF_color + %118 = OpCompositeConstruct %main_out %117 + %116 = OpFunctionCall %void %tint_symbol_2 %118 + OpReturn + OpFunctionEnd + %func_f1_ = OpFunction %float None %119 + %x = OpFunctionParameter %_ptr_Function_float + %122 = OpLabel + %x_93 = OpVariable %_ptr_Function_bool Function %16 + %x_94 = OpVariable %_ptr_Function_float Function %19 + %a = OpVariable %_ptr_Function_float Function %19 + OpStore %x_93 %false + OpBranch %126 + %126 = OpLabel + OpLoopMerge %127 %128 None + OpBranch %129 + %129 = OpLabel + %131 = OpLoad %float %x + OpStore %a %131 + OpBranch %132 + %132 = OpLabel + OpLoopMerge %133 %134 None + OpBranch %135 + %135 = OpLabel + %136 = OpLoad %float %a + %138 = OpLoad %float %x + %139 = OpFOrdEqual %bool %136 %138 + OpSelectionMerge %140 None + OpBranchConditional %139 %141 %140 + %141 = OpLabel + %142 = OpLoad %float %a + OpStore %x_93 %true + OpStore %x_94 %142 + OpBranch %133 + %140 = OpLabel + %143 = OpLoad %float %a + %144 = OpFAdd %float %143 %float_1 + OpStore %a %144 + OpBranch %134 + %134 = OpLabel + %145 = OpLoad %float %a + %147 = OpLoad %float %x + %148 = OpFOrdLessThan %bool %145 %147 + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %151 + %150 = OpLabel + OpBranch %149 + %151 = OpLabel + OpBranch %133 + %149 = OpLabel + OpBranch %132 + %133 = OpLabel + %152 = OpLoad %bool %x_93 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + OpBranch %127 + %153 = OpLabel + OpStore %x_93 %true + OpStore %x_94 %float_0 + OpBranch %127 + %128 = OpLabel + OpBranch %126 + %127 = OpLabel + %155 = OpLoad %float %x_94 + OpReturnValue %155 + OpFunctionEnd +1:1: The continue construct with the continue target 43[%43] is not post dominated by the back-edge block 58[%58] + %58 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..14ef8d3f17 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm.expected.wgsl @@ -0,0 +1,159 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x_29 : bool = false; + var x_30 : f32; + var x_31 : f32; + var x_32 : f32; + var x_33 : bool = false; + var x_34 : f32; + var x_35 : f32; + var x_36 : f32; + var f : f32; + var i : f32; + var param : f32; + var param_1 : f32; + f = 0.0; + i = 0.0; + loop { + let x_38 : f32 = i; + param = x_38; + x_33 = false; + loop { + let x_41 : f32 = param; + x_35 = x_41; + loop { + let x_48 : f32 = x_35; + let x_49 : f32 = param; + if ((x_48 == x_49)) { + let x_53 : f32 = x_35; + x_33 = true; + x_34 = x_53; + break; + } + let x_54 : f32 = x_35; + x_35 = (x_54 + 1.0); + + continuing { + let x_56 : f32 = x_35; + let x_57 : f32 = param; + if ((x_56 < x_57)) { + } else { + break; + } + } + } + let x_59 : bool = x_33; + if (x_59) { + break; + } + x_33 = true; + x_34 = 0.0; + break; + } + let x_61 : f32 = x_34; + x_36 = x_61; + f = x_61; + param_1 = 1.0; + x_29 = false; + loop { + let x_63 : f32 = param_1; + x_31 = x_63; + loop { + let x_70 : f32 = x_31; + let x_71 : f32 = param_1; + if ((x_70 == x_71)) { + let x_75 : f32 = x_31; + x_29 = true; + x_30 = x_75; + break; + } + let x_76 : f32 = x_31; + x_31 = (x_76 + 1.0); + + continuing { + let x_78 : f32 = x_31; + let x_79 : f32 = param_1; + if ((x_78 < x_79)) { + } else { + break; + } + } + } + let x_81 : bool = x_29; + if (x_81) { + break; + } + x_29 = true; + x_30 = 0.0; + break; + } + let x_83 : f32 = x_30; + x_32 = x_83; + let x_84 : f32 = i; + let x_85 : f32 = (x_84 + x_83); + i = x_85; + if ((x_85 < 6.0)) { + } else { + break; + } + } + let x_87 : f32 = f; + if ((x_87 == 5.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_f1_(x : ptr) -> f32 { + var x_93 : bool = false; + var x_94 : f32; + var a : f32; + loop { + let x_96 : f32 = *(x); + a = x_96; + loop { + let x_103 : f32 = a; + let x_104 : f32 = *(x); + if ((x_103 == x_104)) { + let x_108 : f32 = a; + x_93 = true; + x_94 = x_108; + break; + } + let x_109 : f32 = a; + a = (x_109 + 1.0); + + continuing { + let x_111 : f32 = a; + let x_112 : f32 = *(x); + if ((x_111 < x_112)) { + } else { + break; + } + } + } + let x_114 : bool = x_93; + if (x_114) { + break; + } + x_93 = true; + x_94 = 0.0; + break; + } + let x_116 : f32 = x_94; + return x_116; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl new file mode 100644 index 0000000000..14ef8d3f17 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl @@ -0,0 +1,159 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x_29 : bool = false; + var x_30 : f32; + var x_31 : f32; + var x_32 : f32; + var x_33 : bool = false; + var x_34 : f32; + var x_35 : f32; + var x_36 : f32; + var f : f32; + var i : f32; + var param : f32; + var param_1 : f32; + f = 0.0; + i = 0.0; + loop { + let x_38 : f32 = i; + param = x_38; + x_33 = false; + loop { + let x_41 : f32 = param; + x_35 = x_41; + loop { + let x_48 : f32 = x_35; + let x_49 : f32 = param; + if ((x_48 == x_49)) { + let x_53 : f32 = x_35; + x_33 = true; + x_34 = x_53; + break; + } + let x_54 : f32 = x_35; + x_35 = (x_54 + 1.0); + + continuing { + let x_56 : f32 = x_35; + let x_57 : f32 = param; + if ((x_56 < x_57)) { + } else { + break; + } + } + } + let x_59 : bool = x_33; + if (x_59) { + break; + } + x_33 = true; + x_34 = 0.0; + break; + } + let x_61 : f32 = x_34; + x_36 = x_61; + f = x_61; + param_1 = 1.0; + x_29 = false; + loop { + let x_63 : f32 = param_1; + x_31 = x_63; + loop { + let x_70 : f32 = x_31; + let x_71 : f32 = param_1; + if ((x_70 == x_71)) { + let x_75 : f32 = x_31; + x_29 = true; + x_30 = x_75; + break; + } + let x_76 : f32 = x_31; + x_31 = (x_76 + 1.0); + + continuing { + let x_78 : f32 = x_31; + let x_79 : f32 = param_1; + if ((x_78 < x_79)) { + } else { + break; + } + } + } + let x_81 : bool = x_29; + if (x_81) { + break; + } + x_29 = true; + x_30 = 0.0; + break; + } + let x_83 : f32 = x_30; + x_32 = x_83; + let x_84 : f32 = i; + let x_85 : f32 = (x_84 + x_83); + i = x_85; + if ((x_85 < 6.0)) { + } else { + break; + } + } + let x_87 : f32 = f; + if ((x_87 == 5.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_f1_(x : ptr) -> f32 { + var x_93 : bool = false; + var x_94 : f32; + var a : f32; + loop { + let x_96 : f32 = *(x); + a = x_96; + loop { + let x_103 : f32 = a; + let x_104 : f32 = *(x); + if ((x_103 == x_104)) { + let x_108 : f32 = a; + x_93 = true; + x_94 = x_108; + break; + } + let x_109 : f32 = a; + a = (x_109 + 1.0); + + continuing { + let x_111 : f32 = a; + let x_112 : f32 = *(x); + if ((x_111 < x_112)) { + } else { + break; + } + } + } + let x_114 : bool = x_93; + if (x_114) { + break; + } + x_93 = true; + x_94 = 0.0; + break; + } + let x_116 : f32 = x_94; + return x_116; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..0dbbaa933b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.hlsl @@ -0,0 +1,139 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_29 = false; + float x_30 = 0.0f; + float x_31 = 0.0f; + float x_32 = 0.0f; + bool x_33 = false; + float x_34 = 0.0f; + float x_35 = 0.0f; + float x_36 = 0.0f; + float f = 0.0f; + float i = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + f = 0.0f; + i = 0.0f; + while (true) { + param = i; + x_33 = false; + while (true) { + x_35 = param; + while (true) { + if ((x_35 == param)) { + const float x_53 = x_35; + x_33 = true; + x_34 = x_53; + break; + } + x_35 = (x_35 + 1.0f); + { + if ((x_35 < param)) { + } else { + break; + } + } + } + if (x_33) { + break; + } + x_33 = true; + x_34 = 0.0f; + break; + } + const float x_61 = x_34; + x_36 = x_61; + f = x_61; + param_1 = 1.0f; + x_29 = false; + while (true) { + x_31 = param_1; + while (true) { + if ((x_31 == param_1)) { + const float x_75 = x_31; + x_29 = true; + x_30 = x_75; + break; + } + x_31 = (x_31 + 1.0f); + { + if ((x_31 < param_1)) { + } else { + break; + } + } + } + if (x_29) { + break; + } + x_29 = true; + x_30 = 0.0f; + break; + } + const float x_83 = x_30; + x_32 = x_83; + const float x_85 = (i + x_83); + i = x_85; + if ((x_85 < 6.0f)) { + } else { + break; + } + } + if ((f == 5.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} + +float func_f1_(inout float x) { + bool x_93 = false; + float x_94 = 0.0f; + float a = 0.0f; + while (true) { + const float x_96 = x; + a = x_96; + while (true) { + const float x_103 = a; + const float x_104 = x; + if ((x_103 == x_104)) { + const float x_108 = a; + x_93 = true; + x_94 = x_108; + break; + } + a = (a + 1.0f); + { + const float x_111 = a; + const float x_112 = x; + if ((x_111 < x_112)) { + } else { + break; + } + } + } + if (x_93) { + break; + } + x_93 = true; + x_94 = 0.0f; + break; + } + return x_94; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..cf634301c1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.msl @@ -0,0 +1,162 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool x_29 = false; + float x_30 = 0.0f; + float x_31 = 0.0f; + float x_32 = 0.0f; + bool x_33 = false; + float x_34 = 0.0f; + float x_35 = 0.0f; + float x_36 = 0.0f; + float f = 0.0f; + float i = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + f = 0.0f; + i = 0.0f; + while (true) { + float const x_38 = i; + param = x_38; + x_33 = false; + while (true) { + float const x_41 = param; + x_35 = x_41; + while (true) { + float const x_48 = x_35; + float const x_49 = param; + if ((x_48 == x_49)) { + float const x_53 = x_35; + x_33 = true; + x_34 = x_53; + break; + } + float const x_54 = x_35; + x_35 = (x_54 + 1.0f); + { + float const x_56 = x_35; + float const x_57 = param; + if ((x_56 < x_57)) { + } else { + break; + } + } + } + bool const x_59 = x_33; + if (x_59) { + break; + } + x_33 = true; + x_34 = 0.0f; + break; + } + float const x_61 = x_34; + x_36 = x_61; + f = x_61; + param_1 = 1.0f; + x_29 = false; + while (true) { + float const x_63 = param_1; + x_31 = x_63; + while (true) { + float const x_70 = x_31; + float const x_71 = param_1; + if ((x_70 == x_71)) { + float const x_75 = x_31; + x_29 = true; + x_30 = x_75; + break; + } + float const x_76 = x_31; + x_31 = (x_76 + 1.0f); + { + float const x_78 = x_31; + float const x_79 = param_1; + if ((x_78 < x_79)) { + } else { + break; + } + } + } + bool const x_81 = x_29; + if (x_81) { + break; + } + x_29 = true; + x_30 = 0.0f; + break; + } + float const x_83 = x_30; + x_32 = x_83; + float const x_84 = i; + float const x_85 = (x_84 + x_83); + i = x_85; + if ((x_85 < 6.0f)) { + } else { + break; + } + } + float const x_87 = f; + if ((x_87 == 5.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +float func_f1_(thread float* const x) { + bool x_93 = false; + float x_94 = 0.0f; + float a = 0.0f; + while (true) { + float const x_96 = *(x); + a = x_96; + while (true) { + float const x_103 = a; + float const x_104 = *(x); + if ((x_103 == x_104)) { + float const x_108 = a; + x_93 = true; + x_94 = x_108; + break; + } + float const x_109 = a; + a = (x_109 + 1.0f); + { + float const x_111 = a; + float const x_112 = *(x); + if ((x_111 < x_112)) { + } else { + break; + } + } + } + bool const x_114 = x_93; + if (x_114) { + break; + } + x_93 = true; + x_94 = 0.0f; + break; + } + float const x_116 = x_94; + return x_116; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..278320df45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.spvasm @@ -0,0 +1,308 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 156 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_29 "x_29" + OpName %x_30 "x_30" + OpName %x_31 "x_31" + OpName %x_32 "x_32" + OpName %x_33 "x_33" + OpName %x_34 "x_34" + OpName %x_35 "x_35" + OpName %x_36 "x_36" + OpName %f "f" + OpName %i "i" + OpName %param "param" + OpName %param_1 "param_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %func_f1_ "func_f1_" + OpName %x "x" + OpName %x_93 "x_93" + OpName %x_94 "x_94" + OpName %a "a" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %16 = OpConstantNull %bool +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %float_6 = OpConstant %float 6 + %float_5 = OpConstant %float 5 + %105 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %106 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %107 = OpTypeFunction %void %main_out + %119 = OpTypeFunction %float %_ptr_Function_float + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %x_29 = OpVariable %_ptr_Function_bool Function %16 + %x_30 = OpVariable %_ptr_Function_float Function %19 + %x_31 = OpVariable %_ptr_Function_float Function %19 + %x_32 = OpVariable %_ptr_Function_float Function %19 + %x_33 = OpVariable %_ptr_Function_bool Function %16 + %x_34 = OpVariable %_ptr_Function_float Function %19 + %x_35 = OpVariable %_ptr_Function_float Function %19 + %x_36 = OpVariable %_ptr_Function_float Function %19 + %f = OpVariable %_ptr_Function_float Function %19 + %i = OpVariable %_ptr_Function_float Function %19 + %param = OpVariable %_ptr_Function_float Function %19 + %param_1 = OpVariable %_ptr_Function_float Function %19 + OpStore %x_29 %false + OpStore %x_33 %false + OpStore %f %float_0 + OpStore %i %float_0 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %float %i + OpStore %param %35 + OpStore %x_33 %false + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %float %param + OpStore %x_35 %40 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %float %x_35 + %46 = OpLoad %float %param + %47 = OpFOrdEqual %bool %45 %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + %50 = OpLoad %float %x_35 + OpStore %x_33 %true + OpStore %x_34 %50 + OpBranch %42 + %48 = OpLabel + %52 = OpLoad %float %x_35 + %54 = OpFAdd %float %52 %float_1 + OpStore %x_35 %54 + OpBranch %43 + %43 = OpLabel + %55 = OpLoad %float %x_35 + %56 = OpLoad %float %param + %57 = OpFOrdLessThan %bool %55 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %42 + %58 = OpLabel + OpBranch %41 + %42 = OpLabel + %61 = OpLoad %bool %x_33 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + OpBranch %37 + %62 = OpLabel + OpStore %x_33 %true + OpStore %x_34 %float_0 + OpBranch %37 + %38 = OpLabel + OpBranch %36 + %37 = OpLabel + %64 = OpLoad %float %x_34 + OpStore %x_36 %64 + OpStore %f %64 + OpStore %param_1 %float_1 + OpStore %x_29 %false + OpBranch %65 + %65 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %69 = OpLoad %float %param_1 + OpStore %x_31 %69 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %float %x_31 + %75 = OpLoad %float %param_1 + %76 = OpFOrdEqual %bool %74 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + %79 = OpLoad %float %x_31 + OpStore %x_29 %true + OpStore %x_30 %79 + OpBranch %71 + %77 = OpLabel + %80 = OpLoad %float %x_31 + %81 = OpFAdd %float %80 %float_1 + OpStore %x_31 %81 + OpBranch %72 + %72 = OpLabel + %82 = OpLoad %float %x_31 + %83 = OpLoad %float %param_1 + %84 = OpFOrdLessThan %bool %82 %83 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %87 + %86 = OpLabel + OpBranch %85 + %87 = OpLabel + OpBranch %71 + %85 = OpLabel + OpBranch %70 + %71 = OpLabel + %88 = OpLoad %bool %x_29 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + OpBranch %66 + %89 = OpLabel + OpStore %x_29 %true + OpStore %x_30 %float_0 + OpBranch %66 + %67 = OpLabel + OpBranch %65 + %66 = OpLabel + %91 = OpLoad %float %x_30 + OpStore %x_32 %91 + %92 = OpLoad %float %i + %93 = OpFAdd %float %92 %91 + OpStore %i %93 + %95 = OpFOrdLessThan %bool %93 %float_6 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %98 + %97 = OpLabel + OpBranch %96 + %98 = OpLabel + OpBranch %32 + %96 = OpLabel + OpBranch %33 + %33 = OpLabel + OpBranch %31 + %32 = OpLabel + %99 = OpLoad %float %f + %101 = OpFOrdEqual %bool %99 %float_5 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpStore %x_GLF_color %105 + OpBranch %102 + %104 = OpLabel + OpStore %x_GLF_color %106 + OpBranch %102 + %102 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %107 +%tint_symbol = OpFunctionParameter %main_out + %111 = OpLabel + %112 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %112 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %114 = OpLabel + %115 = OpFunctionCall %void %main_1 + %117 = OpLoad %v4float %x_GLF_color + %118 = OpCompositeConstruct %main_out %117 + %116 = OpFunctionCall %void %tint_symbol_2 %118 + OpReturn + OpFunctionEnd + %func_f1_ = OpFunction %float None %119 + %x = OpFunctionParameter %_ptr_Function_float + %122 = OpLabel + %x_93 = OpVariable %_ptr_Function_bool Function %16 + %x_94 = OpVariable %_ptr_Function_float Function %19 + %a = OpVariable %_ptr_Function_float Function %19 + OpStore %x_93 %false + OpBranch %126 + %126 = OpLabel + OpLoopMerge %127 %128 None + OpBranch %129 + %129 = OpLabel + %131 = OpLoad %float %x + OpStore %a %131 + OpBranch %132 + %132 = OpLabel + OpLoopMerge %133 %134 None + OpBranch %135 + %135 = OpLabel + %136 = OpLoad %float %a + %138 = OpLoad %float %x + %139 = OpFOrdEqual %bool %136 %138 + OpSelectionMerge %140 None + OpBranchConditional %139 %141 %140 + %141 = OpLabel + %142 = OpLoad %float %a + OpStore %x_93 %true + OpStore %x_94 %142 + OpBranch %133 + %140 = OpLabel + %143 = OpLoad %float %a + %144 = OpFAdd %float %143 %float_1 + OpStore %a %144 + OpBranch %134 + %134 = OpLabel + %145 = OpLoad %float %a + %147 = OpLoad %float %x + %148 = OpFOrdLessThan %bool %145 %147 + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %151 + %150 = OpLabel + OpBranch %149 + %151 = OpLabel + OpBranch %133 + %149 = OpLabel + OpBranch %132 + %133 = OpLabel + %152 = OpLoad %bool %x_93 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + OpBranch %127 + %153 = OpLabel + OpStore %x_93 %true + OpStore %x_94 %float_0 + OpBranch %127 + %128 = OpLabel + OpBranch %126 + %127 = OpLabel + %155 = OpLoad %float %x_94 + OpReturnValue %155 + OpFunctionEnd +1:1: The continue construct with the continue target 43[%43] is not post dominated by the back-edge block 58[%58] + %58 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..14ef8d3f17 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl.expected.wgsl @@ -0,0 +1,159 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x_29 : bool = false; + var x_30 : f32; + var x_31 : f32; + var x_32 : f32; + var x_33 : bool = false; + var x_34 : f32; + var x_35 : f32; + var x_36 : f32; + var f : f32; + var i : f32; + var param : f32; + var param_1 : f32; + f = 0.0; + i = 0.0; + loop { + let x_38 : f32 = i; + param = x_38; + x_33 = false; + loop { + let x_41 : f32 = param; + x_35 = x_41; + loop { + let x_48 : f32 = x_35; + let x_49 : f32 = param; + if ((x_48 == x_49)) { + let x_53 : f32 = x_35; + x_33 = true; + x_34 = x_53; + break; + } + let x_54 : f32 = x_35; + x_35 = (x_54 + 1.0); + + continuing { + let x_56 : f32 = x_35; + let x_57 : f32 = param; + if ((x_56 < x_57)) { + } else { + break; + } + } + } + let x_59 : bool = x_33; + if (x_59) { + break; + } + x_33 = true; + x_34 = 0.0; + break; + } + let x_61 : f32 = x_34; + x_36 = x_61; + f = x_61; + param_1 = 1.0; + x_29 = false; + loop { + let x_63 : f32 = param_1; + x_31 = x_63; + loop { + let x_70 : f32 = x_31; + let x_71 : f32 = param_1; + if ((x_70 == x_71)) { + let x_75 : f32 = x_31; + x_29 = true; + x_30 = x_75; + break; + } + let x_76 : f32 = x_31; + x_31 = (x_76 + 1.0); + + continuing { + let x_78 : f32 = x_31; + let x_79 : f32 = param_1; + if ((x_78 < x_79)) { + } else { + break; + } + } + } + let x_81 : bool = x_29; + if (x_81) { + break; + } + x_29 = true; + x_30 = 0.0; + break; + } + let x_83 : f32 = x_30; + x_32 = x_83; + let x_84 : f32 = i; + let x_85 : f32 = (x_84 + x_83); + i = x_85; + if ((x_85 < 6.0)) { + } else { + break; + } + } + let x_87 : f32 = f; + if ((x_87 == 5.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_f1_(x : ptr) -> f32 { + var x_93 : bool = false; + var x_94 : f32; + var a : f32; + loop { + let x_96 : f32 = *(x); + a = x_96; + loop { + let x_103 : f32 = a; + let x_104 : f32 = *(x); + if ((x_103 == x_104)) { + let x_108 : f32 = a; + x_93 = true; + x_94 = x_108; + break; + } + let x_109 : f32 = a; + a = (x_109 + 1.0); + + continuing { + let x_111 : f32 = a; + let x_112 : f32 = *(x); + if ((x_111 < x_112)) { + } else { + break; + } + } + } + let x_114 : bool = x_93; + if (x_114) { + break; + } + x_93 = true; + x_94 = 0.0; + break; + } + let x_116 : f32 = x_94; + return x_116; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm new file mode 100644 index 0000000000..3ccb8a94cc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm @@ -0,0 +1,154 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %q "q" + OpName %i "i" + OpName %gl_FragCoord "gl_FragCoord" + OpName %c "c" + OpName %array0 "array0" + OpName %array1 "array1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %q RelaxedPrecision + OpDecorate %i RelaxedPrecision + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %c RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %24 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + %void = OpTypeVoid + %28 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Private__arr_float_uint_3 = OpTypePointer Private %_arr_float_uint_3 + %array0 = OpVariable %_ptr_Private__arr_float_uint_3 Private + %float_0 = OpConstant %float 0 +%_ptr_Private_float = OpTypePointer Private %float + %array1 = OpVariable %_ptr_Private__arr_float_uint_3 Private + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_61 = OpConstant %int 61 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %28 + %53 = OpLabel + %q = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %c = OpVariable %_ptr_Function_int Function + OpStore %q %int_0 + %54 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %55 = OpLoad %float %54 + %12 = OpConvertFToS %int %55 + %13 = OpSMod %int %12 %int_3 + OpStore %i %13 + OpStore %c %int_0 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %14 = OpLoad %int %c + %60 = OpSLessThan %bool %14 %int_3 + OpBranchConditional %60 %61 %57 + %61 = OpLabel + %15 = OpLoad %int %c + %62 = OpAccessChain %_ptr_Private_float %array0 %15 + OpStore %62 %float_0 + %16 = OpLoad %int %c + %63 = OpAccessChain %_ptr_Private_float %array1 %16 + OpStore %63 %float_0 + %64 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %65 = OpLoad %float %64 + %17 = OpConvertFToS %int %65 + %18 = OpLoad %int %q + %19 = OpIAdd %int %17 %18 + OpSelectionMerge %66 None + OpSwitch %19 %66 0 %67 51 %68 61 %69 + %67 = OpLabel + OpStore %q %int_61 + OpBranch %66 + %68 = OpLabel + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + OpBranchConditional %true %74 %71 + %74 = OpLabel + OpBranch %72 + %72 = OpLabel + OpBranch %70 + %71 = OpLabel + %20 = OpLoad %int %c + %75 = OpAccessChain %_ptr_Private_float %array0 %20 + OpStore %75 %float_1 + OpBranch %69 + %69 = OpLabel + %76 = OpAccessChain %_ptr_Private_float %array1 %int_0 + OpStore %76 %float_1 + %21 = OpLoad %int %c + %77 = OpAccessChain %_ptr_Private_float %array1 %21 + OpStore %77 %float_1 + OpBranch %66 + %66 = OpLabel + OpBranch %58 + %58 = OpLabel + %22 = OpLoad %int %c + %23 = OpIAdd %int %22 %int_1 + OpStore %c %23 + OpBranch %56 + %57 = OpLabel + %24 = OpLoad %int %i + %78 = OpAccessChain %_ptr_Private_float %array1 %24 + %79 = OpLoad %float %78 + %25 = OpLoad %int %i + %80 = OpAccessChain %_ptr_Private_float %array0 %25 + %81 = OpLoad %float %80 + %26 = OpLoad %int %i + %82 = OpAccessChain %_ptr_Private_float %array0 %26 + %83 = OpLoad %float %82 + %84 = OpCompositeConstruct %v4float %79 %81 %83 %float_1 + OpStore %_GLF_color %84 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl new file mode 100755 index 0000000000..d17d70d26a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl @@ -0,0 +1,76 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float array0[3] = (float[3])0; +static float array1[3] = (float[3])0; +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int q = 0; + int i = 0; + int c = 0; + q = 0; + const float x_55 = gl_FragCoord.x; + i = (int(x_55) % 3); + c = 0; + { + for(; (c < 3); c = (c + 1)) { + array0[c] = 0.0f; + array1[c] = 0.0f; + const float x_65 = asfloat(x_11[0].x); + switch((int(x_65) + q)) { + case 51: { + while (true) { + if (true) { + } else { + break; + } + } + array0[c] = 1.0f; + /* fallthrough */ + } + case 61: { + array1[0] = 1.0f; + array1[c] = 1.0f; + break; + } + case 0: { + q = 61; + break; + } + default: { + break; + } + } + } + } + const float x_79 = array1[i]; + const float x_81 = array0[i]; + const float x_83 = array0[i]; + x_GLF_color = float4(x_79, x_81, x_83, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} +Internal compiler error: access violation. Attempted to read from address 0xFFFFFFFFFFFFFFE8 + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f9b0707e22 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.msl @@ -0,0 +1,89 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_11, thread float4* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6, thread tint_array_wrapper* const tint_symbol_7, thread float4* const tint_symbol_8) { + int q = 0; + int i = 0; + int c = 0; + q = 0; + float const x_55 = (*(tint_symbol_5)).x; + i = (int(x_55) % 3); + c = 0; + while (true) { + int const x_14 = c; + if ((x_14 < 3)) { + } else { + break; + } + int const x_15 = c; + (*(tint_symbol_6)).arr[x_15] = 0.0f; + int const x_16 = c; + (*(tint_symbol_7)).arr[x_16] = 0.0f; + float const x_65 = x_11.injectionSwitch.x; + int const x_18 = q; + switch((int(x_65) + x_18)) { + case 51: { + while (true) { + if (true) { + } else { + break; + } + } + int const x_20 = c; + (*(tint_symbol_6)).arr[x_20] = 1.0f; + /* fallthrough */ + } + case 61: { + (*(tint_symbol_7)).arr[0] = 1.0f; + int const x_21 = c; + (*(tint_symbol_7)).arr[x_21] = 1.0f; + break; + } + case 0: { + q = 61; + break; + } + default: { + break; + } + } + { + int const x_22 = c; + c = (x_22 + 1); + } + } + int const x_24 = i; + float const x_79 = (*(tint_symbol_7)).arr[x_24]; + int const x_25 = i; + float const x_81 = (*(tint_symbol_6)).arr[x_25]; + int const x_26 = i; + float const x_83 = (*(tint_symbol_6)).arr[x_26]; + *(tint_symbol_8) = float4(x_79, x_81, x_83, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread tint_array_wrapper tint_symbol_10 = {}; + thread tint_array_wrapper tint_symbol_11 = {}; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_11, &(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..eabbd52c1d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.spvasm @@ -0,0 +1,185 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 107 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %array0 "array0" + OpName %array1 "array1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %q "q" + OpName %i "i" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_float_uint_3 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Private__arr_float_uint_3 = OpTypePointer Private %_arr_float_uint_3 + %11 = OpConstantNull %_arr_float_uint_3 + %array0 = OpVariable %_ptr_Private__arr_float_uint_3 Private %11 + %array1 = OpVariable %_ptr_Private__arr_float_uint_3 Private %11 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %int_61 = OpConstant %int 61 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %94 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %q = OpVariable %_ptr_Function_int Function %29 + %i = OpVariable %_ptr_Function_int Function %29 + %c = OpVariable %_ptr_Function_int Function %29 + OpStore %q %int_0 + %35 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %36 = OpLoad %float %35 + %37 = OpConvertFToS %int %36 + %39 = OpSMod %int %37 %int_3 + OpStore %i %39 + OpStore %c %int_0 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %c + %45 = OpSLessThan %bool %44 %int_3 + OpSelectionMerge %47 None + OpBranchConditional %45 %48 %49 + %48 = OpLabel + OpBranch %47 + %49 = OpLabel + OpBranch %41 + %47 = OpLabel + %50 = OpLoad %int %c + %51 = OpAccessChain %_ptr_Private_float %array0 %50 + OpStore %51 %float_0 + %53 = OpLoad %int %c + %54 = OpAccessChain %_ptr_Private_float %array1 %53 + OpStore %54 %float_0 + %56 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_0 + %57 = OpLoad %float %56 + %58 = OpLoad %int %q + %60 = OpConvertFToS %int %57 + %61 = OpIAdd %int %60 %58 + OpSelectionMerge %59 None + OpSwitch %61 %62 51 %63 61 %64 0 %65 + %63 = OpLabel + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + OpSelectionMerge %71 None + OpBranchConditional %true %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %67 + %71 = OpLabel + OpBranch %68 + %68 = OpLabel + OpBranch %66 + %67 = OpLabel + %74 = OpLoad %int %c + %75 = OpAccessChain %_ptr_Private_float %array0 %74 + OpStore %75 %float_1 + OpBranch %64 + %64 = OpLabel + %77 = OpAccessChain %_ptr_Private_float %array1 %int_0 + OpStore %77 %float_1 + %78 = OpLoad %int %c + %79 = OpAccessChain %_ptr_Private_float %array1 %78 + OpStore %79 %float_1 + OpBranch %59 + %65 = OpLabel + OpStore %q %int_61 + OpBranch %59 + %62 = OpLabel + OpBranch %59 + %59 = OpLabel + OpBranch %42 + %42 = OpLabel + %81 = OpLoad %int %c + %83 = OpIAdd %int %81 %int_1 + OpStore %c %83 + OpBranch %40 + %41 = OpLabel + %84 = OpLoad %int %i + %85 = OpAccessChain %_ptr_Private_float %array1 %84 + %86 = OpLoad %float %85 + %87 = OpLoad %int %i + %88 = OpAccessChain %_ptr_Private_float %array0 %87 + %89 = OpLoad %float %88 + %90 = OpLoad %int %i + %91 = OpAccessChain %_ptr_Private_float %array0 %90 + %92 = OpLoad %float %91 + %93 = OpCompositeConstruct %v4float %86 %89 %92 %float_1 + OpStore %x_GLF_color %93 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %94 +%tint_symbol_1 = OpFunctionParameter %main_out + %98 = OpLabel + %99 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %99 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %101 = OpLabel + %102 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %102 + %103 = OpFunctionCall %void %main_1 + %105 = OpLoad %v4float %x_GLF_color + %106 = OpCompositeConstruct %main_out %105 + %104 = OpFunctionCall %void %tint_symbol_3 %106 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f6836ba09a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.wgsl @@ -0,0 +1,85 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +var array0 : array; + +var array1 : array; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var q : i32; + var i : i32; + var c : i32; + q = 0; + let x_55 : f32 = gl_FragCoord.x; + i = (i32(x_55) % 3); + c = 0; + loop { + let x_14 : i32 = c; + if ((x_14 < 3)) { + } else { + break; + } + let x_15 : i32 = c; + array0[x_15] = 0.0; + let x_16 : i32 = c; + array1[x_16] = 0.0; + let x_65 : f32 = x_11.injectionSwitch.x; + let x_18 : i32 = q; + switch((i32(x_65) + x_18)) { + case 51: { + loop { + if (true) { + } else { + break; + } + } + let x_20 : i32 = c; + array0[x_20] = 1.0; + fallthrough; + } + case 61: { + array1[0] = 1.0; + let x_21 : i32 = c; + array1[x_21] = 1.0; + } + case 0: { + q = 61; + } + default: { + } + } + + continuing { + let x_22 : i32 = c; + c = (x_22 + 1); + } + } + let x_24 : i32 = i; + let x_79 : f32 = array1[x_24]; + let x_25 : i32 = i; + let x_81 : f32 = array0[x_25]; + let x_26 : i32 = i; + let x_83 : f32 = array0[x_26]; + x_GLF_color = vec4(x_79, x_81, x_83, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl new file mode 100644 index 0000000000..f6836ba09a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl @@ -0,0 +1,85 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +var array0 : array; + +var array1 : array; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var q : i32; + var i : i32; + var c : i32; + q = 0; + let x_55 : f32 = gl_FragCoord.x; + i = (i32(x_55) % 3); + c = 0; + loop { + let x_14 : i32 = c; + if ((x_14 < 3)) { + } else { + break; + } + let x_15 : i32 = c; + array0[x_15] = 0.0; + let x_16 : i32 = c; + array1[x_16] = 0.0; + let x_65 : f32 = x_11.injectionSwitch.x; + let x_18 : i32 = q; + switch((i32(x_65) + x_18)) { + case 51: { + loop { + if (true) { + } else { + break; + } + } + let x_20 : i32 = c; + array0[x_20] = 1.0; + fallthrough; + } + case 61: { + array1[0] = 1.0; + let x_21 : i32 = c; + array1[x_21] = 1.0; + } + case 0: { + q = 61; + } + default: { + } + } + + continuing { + let x_22 : i32 = c; + c = (x_22 + 1); + } + } + let x_24 : i32 = i; + let x_79 : f32 = array1[x_24]; + let x_25 : i32 = i; + let x_81 : f32 = array0[x_25]; + let x_26 : i32 = i; + let x_83 : f32 = array0[x_26]; + x_GLF_color = vec4(x_79, x_81, x_83, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl new file mode 100755 index 0000000000..d17d70d26a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl @@ -0,0 +1,76 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float array0[3] = (float[3])0; +static float array1[3] = (float[3])0; +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int q = 0; + int i = 0; + int c = 0; + q = 0; + const float x_55 = gl_FragCoord.x; + i = (int(x_55) % 3); + c = 0; + { + for(; (c < 3); c = (c + 1)) { + array0[c] = 0.0f; + array1[c] = 0.0f; + const float x_65 = asfloat(x_11[0].x); + switch((int(x_65) + q)) { + case 51: { + while (true) { + if (true) { + } else { + break; + } + } + array0[c] = 1.0f; + /* fallthrough */ + } + case 61: { + array1[0] = 1.0f; + array1[c] = 1.0f; + break; + } + case 0: { + q = 61; + break; + } + default: { + break; + } + } + } + } + const float x_79 = array1[i]; + const float x_81 = array0[i]; + const float x_83 = array0[i]; + x_GLF_color = float4(x_79, x_81, x_83, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} +Internal compiler error: access violation. Attempted to read from address 0xFFFFFFFFFFFFFFE8 + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f9b0707e22 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.msl @@ -0,0 +1,89 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_11, thread float4* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6, thread tint_array_wrapper* const tint_symbol_7, thread float4* const tint_symbol_8) { + int q = 0; + int i = 0; + int c = 0; + q = 0; + float const x_55 = (*(tint_symbol_5)).x; + i = (int(x_55) % 3); + c = 0; + while (true) { + int const x_14 = c; + if ((x_14 < 3)) { + } else { + break; + } + int const x_15 = c; + (*(tint_symbol_6)).arr[x_15] = 0.0f; + int const x_16 = c; + (*(tint_symbol_7)).arr[x_16] = 0.0f; + float const x_65 = x_11.injectionSwitch.x; + int const x_18 = q; + switch((int(x_65) + x_18)) { + case 51: { + while (true) { + if (true) { + } else { + break; + } + } + int const x_20 = c; + (*(tint_symbol_6)).arr[x_20] = 1.0f; + /* fallthrough */ + } + case 61: { + (*(tint_symbol_7)).arr[0] = 1.0f; + int const x_21 = c; + (*(tint_symbol_7)).arr[x_21] = 1.0f; + break; + } + case 0: { + q = 61; + break; + } + default: { + break; + } + } + { + int const x_22 = c; + c = (x_22 + 1); + } + } + int const x_24 = i; + float const x_79 = (*(tint_symbol_7)).arr[x_24]; + int const x_25 = i; + float const x_81 = (*(tint_symbol_6)).arr[x_25]; + int const x_26 = i; + float const x_83 = (*(tint_symbol_6)).arr[x_26]; + *(tint_symbol_8) = float4(x_79, x_81, x_83, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread tint_array_wrapper tint_symbol_10 = {}; + thread tint_array_wrapper tint_symbol_11 = {}; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_11, &(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..eabbd52c1d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.spvasm @@ -0,0 +1,185 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 107 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %array0 "array0" + OpName %array1 "array1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %q "q" + OpName %i "i" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_float_uint_3 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Private__arr_float_uint_3 = OpTypePointer Private %_arr_float_uint_3 + %11 = OpConstantNull %_arr_float_uint_3 + %array0 = OpVariable %_ptr_Private__arr_float_uint_3 Private %11 + %array1 = OpVariable %_ptr_Private__arr_float_uint_3 Private %11 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %int_61 = OpConstant %int 61 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %94 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %q = OpVariable %_ptr_Function_int Function %29 + %i = OpVariable %_ptr_Function_int Function %29 + %c = OpVariable %_ptr_Function_int Function %29 + OpStore %q %int_0 + %35 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %36 = OpLoad %float %35 + %37 = OpConvertFToS %int %36 + %39 = OpSMod %int %37 %int_3 + OpStore %i %39 + OpStore %c %int_0 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %c + %45 = OpSLessThan %bool %44 %int_3 + OpSelectionMerge %47 None + OpBranchConditional %45 %48 %49 + %48 = OpLabel + OpBranch %47 + %49 = OpLabel + OpBranch %41 + %47 = OpLabel + %50 = OpLoad %int %c + %51 = OpAccessChain %_ptr_Private_float %array0 %50 + OpStore %51 %float_0 + %53 = OpLoad %int %c + %54 = OpAccessChain %_ptr_Private_float %array1 %53 + OpStore %54 %float_0 + %56 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_0 + %57 = OpLoad %float %56 + %58 = OpLoad %int %q + %60 = OpConvertFToS %int %57 + %61 = OpIAdd %int %60 %58 + OpSelectionMerge %59 None + OpSwitch %61 %62 51 %63 61 %64 0 %65 + %63 = OpLabel + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + OpSelectionMerge %71 None + OpBranchConditional %true %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %67 + %71 = OpLabel + OpBranch %68 + %68 = OpLabel + OpBranch %66 + %67 = OpLabel + %74 = OpLoad %int %c + %75 = OpAccessChain %_ptr_Private_float %array0 %74 + OpStore %75 %float_1 + OpBranch %64 + %64 = OpLabel + %77 = OpAccessChain %_ptr_Private_float %array1 %int_0 + OpStore %77 %float_1 + %78 = OpLoad %int %c + %79 = OpAccessChain %_ptr_Private_float %array1 %78 + OpStore %79 %float_1 + OpBranch %59 + %65 = OpLabel + OpStore %q %int_61 + OpBranch %59 + %62 = OpLabel + OpBranch %59 + %59 = OpLabel + OpBranch %42 + %42 = OpLabel + %81 = OpLoad %int %c + %83 = OpIAdd %int %81 %int_1 + OpStore %c %83 + OpBranch %40 + %41 = OpLabel + %84 = OpLoad %int %i + %85 = OpAccessChain %_ptr_Private_float %array1 %84 + %86 = OpLoad %float %85 + %87 = OpLoad %int %i + %88 = OpAccessChain %_ptr_Private_float %array0 %87 + %89 = OpLoad %float %88 + %90 = OpLoad %int %i + %91 = OpAccessChain %_ptr_Private_float %array0 %90 + %92 = OpLoad %float %91 + %93 = OpCompositeConstruct %v4float %86 %89 %92 %float_1 + OpStore %x_GLF_color %93 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %94 +%tint_symbol_1 = OpFunctionParameter %main_out + %98 = OpLabel + %99 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %99 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %101 = OpLabel + %102 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %102 + %103 = OpFunctionCall %void %main_1 + %105 = OpLoad %v4float %x_GLF_color + %106 = OpCompositeConstruct %main_out %105 + %104 = OpFunctionCall %void %tint_symbol_3 %106 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f6836ba09a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.wgsl @@ -0,0 +1,85 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +var array0 : array; + +var array1 : array; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var q : i32; + var i : i32; + var c : i32; + q = 0; + let x_55 : f32 = gl_FragCoord.x; + i = (i32(x_55) % 3); + c = 0; + loop { + let x_14 : i32 = c; + if ((x_14 < 3)) { + } else { + break; + } + let x_15 : i32 = c; + array0[x_15] = 0.0; + let x_16 : i32 = c; + array1[x_16] = 0.0; + let x_65 : f32 = x_11.injectionSwitch.x; + let x_18 : i32 = q; + switch((i32(x_65) + x_18)) { + case 51: { + loop { + if (true) { + } else { + break; + } + } + let x_20 : i32 = c; + array0[x_20] = 1.0; + fallthrough; + } + case 61: { + array1[0] = 1.0; + let x_21 : i32 = c; + array1[x_21] = 1.0; + } + case 0: { + q = 61; + } + default: { + } + } + + continuing { + let x_22 : i32 = c; + c = (x_22 + 1); + } + } + let x_24 : i32 = i; + let x_79 : f32 = array1[x_24]; + let x_25 : i32 = i; + let x_81 : f32 = array0[x_25]; + let x_26 : i32 = i; + let x_83 : f32 = array0[x_26]; + x_GLF_color = vec4(x_79, x_81, x_83, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm new file mode 100644 index 0000000000..a660e7abb9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm @@ -0,0 +1,162 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %_GLF_global_loop_count "_GLF_global_loop_count" + OpName %f "f" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %r "r" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "injectionSwitch" + OpName %__1 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 2 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int +%_GLF_global_loop_count = OpVariable %_ptr_Private_int Private + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__1 = OpVariable %_ptr_Uniform_buf2 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %uint_1 = OpConstant %uint 1 + %int_100 = OpConstant %int 100 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %16 + %40 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %r = OpVariable %_ptr_Function_int Function + OpStore %_GLF_global_loop_count %int_0 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %42 = OpLoad %float %41 + OpStore %f %42 + %43 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %44 = OpLoad %int %43 + OpStore %r %44 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %r + %50 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %51 = OpLoad %int %50 + %52 = OpSLessThan %bool %49 %51 + OpBranchConditional %52 %53 %46 + %53 = OpLabel + %54 = OpLoad %int %_GLF_global_loop_count + %55 = OpIAdd %int %54 %int_1 + OpStore %_GLF_global_loop_count %55 + %56 = OpAccessChain %_ptr_Uniform_v2float %__1 %int_0 + %57 = OpLoad %v2float %56 + %58 = OpDPdx %v2float %57 + %59 = OpCompositeExtract %float %58 1 + %60 = OpLoad %float %f + %61 = OpFAdd %float %60 %59 + OpStore %f %61 + OpBranch %47 + %47 = OpLabel + %62 = OpLoad %int %r + %63 = OpIAdd %int %62 %int_1 + OpStore %r %63 + OpBranch %45 + %46 = OpLabel + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %int %_GLF_global_loop_count + %69 = OpSLessThan %bool %68 %int_100 + OpBranchConditional %69 %70 %65 + %70 = OpLabel + %71 = OpLoad %int %_GLF_global_loop_count + %72 = OpIAdd %int %71 %int_1 + OpStore %_GLF_global_loop_count %72 + %73 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %74 = OpLoad %float %73 + %75 = OpLoad %float %f + %76 = OpFAdd %float %75 %74 + OpStore %f %76 + OpBranch %66 + %66 = OpLabel + OpBranch %64 + %65 = OpLabel + %77 = OpLoad %float %f + %78 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %79 = OpLoad %float %78 + %80 = OpFOrdEqual %bool %77 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %85 + %87 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %88 + %90 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %91 + %93 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %94 = OpLoad %int %93 + %95 = OpConvertSToF %float %94 + %96 = OpCompositeConstruct %v4float %86 %89 %92 %95 + OpStore %_GLF_color %96 + OpBranch %81 + %83 = OpLabel + %97 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %98 = OpLoad %int %97 + %99 = OpConvertSToF %float %98 + %100 = OpCompositeConstruct %v4float %99 %99 %99 %99 + OpStore %_GLF_color %100 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f469577c04 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.hlsl @@ -0,0 +1,76 @@ +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[3]; +}; +cbuffer cbuffer_x_12 : register(b2, space0) { + uint4 x_12[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int r = 0; + x_GLF_global_loop_count = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_42 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + f = x_42; + const int x_44 = asint(x_10[1].x); + r = x_44; + while (true) { + const int x_49 = r; + const int x_51 = asint(x_10[2].x); + if ((x_49 < x_51)) { + } else { + break; + } + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const float2 x_57 = asfloat(x_12[0].xy); + f = (f + ddx(x_57).y); + { + r = (r + 1); + } + } + while (true) { + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_74 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + f = (f + x_74); + } + const float x_77 = f; + const float x_79 = asfloat(x_7[1].x); + if ((x_77 == x_79)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_85 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_88 = asint(x_10[1].x); + const int x_91 = asint(x_10[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_94 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_85), float(x_88), float(x_91), float(x_94)); + } else { + const int x_98 = asint(x_10[1].x); + const float x_99 = float(x_98); + x_GLF_color = float4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..8361b24dac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.msl @@ -0,0 +1,95 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct buf2 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_10, constant buf2& x_12, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + float f = 0.0f; + int r = 0; + *(tint_symbol_4) = 0; + float const x_42 = x_7.x_GLF_uniform_float_values.arr[0].el; + f = x_42; + int const x_44 = x_10.x_GLF_uniform_int_values.arr[1].el; + r = x_44; + while (true) { + int const x_49 = r; + int const x_51 = x_10.x_GLF_uniform_int_values.arr[2].el; + if ((x_49 < x_51)) { + } else { + break; + } + int const x_54 = *(tint_symbol_4); + *(tint_symbol_4) = (x_54 + 1); + float2 const x_57 = x_12.injectionSwitch; + float const x_60 = f; + f = (x_60 + dfdx(x_57).y); + { + int const x_62 = r; + r = (x_62 + 1); + } + } + while (true) { + int const x_68 = *(tint_symbol_4); + if ((x_68 < 100)) { + } else { + break; + } + int const x_71 = *(tint_symbol_4); + *(tint_symbol_4) = (x_71 + 1); + float const x_74 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_75 = f; + f = (x_75 + x_74); + } + float const x_77 = f; + float const x_79 = x_7.x_GLF_uniform_float_values.arr[1].el; + if ((x_77 == x_79)) { + int const x_85 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_88 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_91 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_94 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_85), float(x_88), float(x_91), float(x_94)); + } else { + int const x_98 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_99 = float(x_98); + *(tint_symbol_5) = float4(x_99, x_99, x_99, x_99); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]], constant buf2& x_12 [[buffer(2)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_7, x_10, x_12, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..c81692904e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.spvasm @@ -0,0 +1,207 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 121 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "injectionSwitch" + OpName %x_12 "x_12" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %r "r" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 2 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_12 = OpVariable %_ptr_Uniform_buf2 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %24 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %24 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %33 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %int_100 = OpConstant %int 100 + %main_out = OpTypeStruct %v4float + %109 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %27 + %30 = OpLabel + %f = OpVariable %_ptr_Function_float Function %33 + %r = OpVariable %_ptr_Function_int Function %4 + OpStore %x_GLF_global_loop_count %int_0 + %39 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %40 = OpLoad %float %39 + OpStore %f %40 + %43 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %44 = OpLoad %int %43 + OpStore %r %44 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %r + %51 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %52 = OpLoad %int %51 + %53 = OpSLessThan %bool %49 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %46 + %55 = OpLabel + %58 = OpLoad %int %x_GLF_global_loop_count + %59 = OpIAdd %int %58 %int_1 + OpStore %x_GLF_global_loop_count %59 + %61 = OpAccessChain %_ptr_Uniform_v2float %x_12 %uint_0 + %62 = OpLoad %v2float %61 + %63 = OpLoad %float %f + %64 = OpDPdx %v2float %62 + %65 = OpCompositeExtract %float %64 1 + %66 = OpFAdd %float %63 %65 + OpStore %f %66 + OpBranch %47 + %47 = OpLabel + %67 = OpLoad %int %r + %68 = OpIAdd %int %67 %int_1 + OpStore %r %68 + OpBranch %45 + %46 = OpLabel + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %int %x_GLF_global_loop_count + %75 = OpSLessThan %bool %73 %int_100 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %78 + %77 = OpLabel + OpBranch %76 + %78 = OpLabel + OpBranch %70 + %76 = OpLabel + %79 = OpLoad %int %x_GLF_global_loop_count + %80 = OpIAdd %int %79 %int_1 + OpStore %x_GLF_global_loop_count %80 + %81 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %82 = OpLoad %float %81 + %83 = OpLoad %float %f + %84 = OpFAdd %float %83 %82 + OpStore %f %84 + OpBranch %71 + %71 = OpLabel + OpBranch %69 + %70 = OpLabel + %85 = OpLoad %float %f + %86 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %87 = OpLoad %float %86 + %88 = OpFOrdEqual %bool %85 %87 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %91 + %90 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %93 = OpLoad %int %92 + %94 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %95 = OpLoad %int %94 + %96 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %99 = OpLoad %int %98 + %100 = OpConvertSToF %float %93 + %101 = OpConvertSToF %float %95 + %102 = OpConvertSToF %float %97 + %103 = OpConvertSToF %float %99 + %104 = OpCompositeConstruct %v4float %100 %101 %102 %103 + OpStore %x_GLF_color %104 + OpBranch %89 + %91 = OpLabel + %105 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %106 = OpLoad %int %105 + %107 = OpConvertSToF %float %106 + %108 = OpCompositeConstruct %v4float %107 %107 %107 %107 + OpStore %x_GLF_color %108 + OpBranch %89 + %89 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %109 +%tint_symbol = OpFunctionParameter %main_out + %113 = OpLabel + %114 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %114 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %116 = OpLabel + %117 = OpFunctionCall %void %main_1 + %119 = OpLoad %v4float %x_GLF_color + %120 = OpCompositeConstruct %main_out %119 + %118 = OpFunctionCall %void %tint_symbol_2 %120 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..d3e05f8c75 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.spvasm.expected.wgsl @@ -0,0 +1,93 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[block]] +struct buf2 { + injectionSwitch : vec2; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +[[group(0), binding(2)]] var x_12 : buf2; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var r : i32; + x_GLF_global_loop_count = 0; + let x_42 : f32 = x_7.x_GLF_uniform_float_values[0]; + f = x_42; + let x_44 : i32 = x_10.x_GLF_uniform_int_values[1]; + r = x_44; + loop { + let x_49 : i32 = r; + let x_51 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_49 < x_51)) { + } else { + break; + } + let x_54 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_54 + 1); + let x_57 : vec2 = x_12.injectionSwitch; + let x_60 : f32 = f; + f = (x_60 + dpdx(x_57).y); + + continuing { + let x_62 : i32 = r; + r = (x_62 + 1); + } + } + loop { + let x_68 : i32 = x_GLF_global_loop_count; + if ((x_68 < 100)) { + } else { + break; + } + let x_71 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_71 + 1); + let x_74 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_75 : f32 = f; + f = (x_75 + x_74); + } + let x_77 : f32 = f; + let x_79 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_77 == x_79)) { + let x_85 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_88 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_91 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_94 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_85), f32(x_88), f32(x_91), f32(x_94)); + } else { + let x_98 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_99 : f32 = f32(x_98); + x_GLF_color = vec4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl new file mode 100644 index 0000000000..d3e05f8c75 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl @@ -0,0 +1,93 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[block]] +struct buf2 { + injectionSwitch : vec2; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +[[group(0), binding(2)]] var x_12 : buf2; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var r : i32; + x_GLF_global_loop_count = 0; + let x_42 : f32 = x_7.x_GLF_uniform_float_values[0]; + f = x_42; + let x_44 : i32 = x_10.x_GLF_uniform_int_values[1]; + r = x_44; + loop { + let x_49 : i32 = r; + let x_51 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_49 < x_51)) { + } else { + break; + } + let x_54 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_54 + 1); + let x_57 : vec2 = x_12.injectionSwitch; + let x_60 : f32 = f; + f = (x_60 + dpdx(x_57).y); + + continuing { + let x_62 : i32 = r; + r = (x_62 + 1); + } + } + loop { + let x_68 : i32 = x_GLF_global_loop_count; + if ((x_68 < 100)) { + } else { + break; + } + let x_71 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_71 + 1); + let x_74 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_75 : f32 = f; + f = (x_75 + x_74); + } + let x_77 : f32 = f; + let x_79 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_77 == x_79)) { + let x_85 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_88 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_91 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_94 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_85), f32(x_88), f32(x_91), f32(x_94)); + } else { + let x_98 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_99 : f32 = f32(x_98); + x_GLF_color = vec4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f469577c04 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.hlsl @@ -0,0 +1,76 @@ +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[3]; +}; +cbuffer cbuffer_x_12 : register(b2, space0) { + uint4 x_12[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int r = 0; + x_GLF_global_loop_count = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_42 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + f = x_42; + const int x_44 = asint(x_10[1].x); + r = x_44; + while (true) { + const int x_49 = r; + const int x_51 = asint(x_10[2].x); + if ((x_49 < x_51)) { + } else { + break; + } + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const float2 x_57 = asfloat(x_12[0].xy); + f = (f + ddx(x_57).y); + { + r = (r + 1); + } + } + while (true) { + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_74 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + f = (f + x_74); + } + const float x_77 = f; + const float x_79 = asfloat(x_7[1].x); + if ((x_77 == x_79)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_85 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_88 = asint(x_10[1].x); + const int x_91 = asint(x_10[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_94 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_85), float(x_88), float(x_91), float(x_94)); + } else { + const int x_98 = asint(x_10[1].x); + const float x_99 = float(x_98); + x_GLF_color = float4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..8361b24dac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.msl @@ -0,0 +1,95 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct buf2 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_10, constant buf2& x_12, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + float f = 0.0f; + int r = 0; + *(tint_symbol_4) = 0; + float const x_42 = x_7.x_GLF_uniform_float_values.arr[0].el; + f = x_42; + int const x_44 = x_10.x_GLF_uniform_int_values.arr[1].el; + r = x_44; + while (true) { + int const x_49 = r; + int const x_51 = x_10.x_GLF_uniform_int_values.arr[2].el; + if ((x_49 < x_51)) { + } else { + break; + } + int const x_54 = *(tint_symbol_4); + *(tint_symbol_4) = (x_54 + 1); + float2 const x_57 = x_12.injectionSwitch; + float const x_60 = f; + f = (x_60 + dfdx(x_57).y); + { + int const x_62 = r; + r = (x_62 + 1); + } + } + while (true) { + int const x_68 = *(tint_symbol_4); + if ((x_68 < 100)) { + } else { + break; + } + int const x_71 = *(tint_symbol_4); + *(tint_symbol_4) = (x_71 + 1); + float const x_74 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_75 = f; + f = (x_75 + x_74); + } + float const x_77 = f; + float const x_79 = x_7.x_GLF_uniform_float_values.arr[1].el; + if ((x_77 == x_79)) { + int const x_85 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_88 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_91 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_94 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_85), float(x_88), float(x_91), float(x_94)); + } else { + int const x_98 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_99 = float(x_98); + *(tint_symbol_5) = float4(x_99, x_99, x_99, x_99); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]], constant buf2& x_12 [[buffer(2)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_7, x_10, x_12, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..c81692904e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.spvasm @@ -0,0 +1,207 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 121 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "injectionSwitch" + OpName %x_12 "x_12" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %r "r" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 2 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_12 = OpVariable %_ptr_Uniform_buf2 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %24 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %24 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %33 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %int_100 = OpConstant %int 100 + %main_out = OpTypeStruct %v4float + %109 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %27 + %30 = OpLabel + %f = OpVariable %_ptr_Function_float Function %33 + %r = OpVariable %_ptr_Function_int Function %4 + OpStore %x_GLF_global_loop_count %int_0 + %39 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %40 = OpLoad %float %39 + OpStore %f %40 + %43 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %44 = OpLoad %int %43 + OpStore %r %44 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %r + %51 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %52 = OpLoad %int %51 + %53 = OpSLessThan %bool %49 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %46 + %55 = OpLabel + %58 = OpLoad %int %x_GLF_global_loop_count + %59 = OpIAdd %int %58 %int_1 + OpStore %x_GLF_global_loop_count %59 + %61 = OpAccessChain %_ptr_Uniform_v2float %x_12 %uint_0 + %62 = OpLoad %v2float %61 + %63 = OpLoad %float %f + %64 = OpDPdx %v2float %62 + %65 = OpCompositeExtract %float %64 1 + %66 = OpFAdd %float %63 %65 + OpStore %f %66 + OpBranch %47 + %47 = OpLabel + %67 = OpLoad %int %r + %68 = OpIAdd %int %67 %int_1 + OpStore %r %68 + OpBranch %45 + %46 = OpLabel + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %int %x_GLF_global_loop_count + %75 = OpSLessThan %bool %73 %int_100 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %78 + %77 = OpLabel + OpBranch %76 + %78 = OpLabel + OpBranch %70 + %76 = OpLabel + %79 = OpLoad %int %x_GLF_global_loop_count + %80 = OpIAdd %int %79 %int_1 + OpStore %x_GLF_global_loop_count %80 + %81 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %82 = OpLoad %float %81 + %83 = OpLoad %float %f + %84 = OpFAdd %float %83 %82 + OpStore %f %84 + OpBranch %71 + %71 = OpLabel + OpBranch %69 + %70 = OpLabel + %85 = OpLoad %float %f + %86 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %87 = OpLoad %float %86 + %88 = OpFOrdEqual %bool %85 %87 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %91 + %90 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %93 = OpLoad %int %92 + %94 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %95 = OpLoad %int %94 + %96 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %99 = OpLoad %int %98 + %100 = OpConvertSToF %float %93 + %101 = OpConvertSToF %float %95 + %102 = OpConvertSToF %float %97 + %103 = OpConvertSToF %float %99 + %104 = OpCompositeConstruct %v4float %100 %101 %102 %103 + OpStore %x_GLF_color %104 + OpBranch %89 + %91 = OpLabel + %105 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %106 = OpLoad %int %105 + %107 = OpConvertSToF %float %106 + %108 = OpCompositeConstruct %v4float %107 %107 %107 %107 + OpStore %x_GLF_color %108 + OpBranch %89 + %89 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %109 +%tint_symbol = OpFunctionParameter %main_out + %113 = OpLabel + %114 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %114 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %116 = OpLabel + %117 = OpFunctionCall %void %main_1 + %119 = OpLoad %v4float %x_GLF_color + %120 = OpCompositeConstruct %main_out %119 + %118 = OpFunctionCall %void %tint_symbol_2 %120 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..d3e05f8c75 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-derivative-uniform-vector-global-loop-count/0-opt.wgsl.expected.wgsl @@ -0,0 +1,93 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[block]] +struct buf2 { + injectionSwitch : vec2; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +[[group(0), binding(2)]] var x_12 : buf2; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var r : i32; + x_GLF_global_loop_count = 0; + let x_42 : f32 = x_7.x_GLF_uniform_float_values[0]; + f = x_42; + let x_44 : i32 = x_10.x_GLF_uniform_int_values[1]; + r = x_44; + loop { + let x_49 : i32 = r; + let x_51 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_49 < x_51)) { + } else { + break; + } + let x_54 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_54 + 1); + let x_57 : vec2 = x_12.injectionSwitch; + let x_60 : f32 = f; + f = (x_60 + dpdx(x_57).y); + + continuing { + let x_62 : i32 = r; + r = (x_62 + 1); + } + } + loop { + let x_68 : i32 = x_GLF_global_loop_count; + if ((x_68 < 100)) { + } else { + break; + } + let x_71 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_71 + 1); + let x_74 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_75 : f32 = f; + f = (x_75 + x_74); + } + let x_77 : f32 = f; + let x_79 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_77 == x_79)) { + let x_85 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_88 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_91 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_94 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_85), f32(x_88), f32(x_91), f32(x_94)); + } else { + let x_98 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_99 : f32 = f32(x_98); + x_GLF_color = vec4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm new file mode 100644 index 0000000000..4e0f99a413 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm @@ -0,0 +1,118 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_2 = OpConstant %int 2 + %34 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %14 + %35 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %a = OpVariable %_ptr_Function_float Function + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %37 = OpLoad %float %36 + OpStore %f %37 + %38 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %39 = OpLoad %int %38 + OpStore %i %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpSGreaterThan %bool %44 %46 + OpBranchConditional %47 %48 %41 + %48 = OpLabel + %49 = OpLoad %int %i + %50 = OpConvertSToF %float %49 + %51 = OpExtInst %float %1 FMax %float_1 %50 + %52 = OpFSub %float %float_1 %51 + OpStore %a %52 + %53 = OpLoad %float %a + %54 = OpExtInst %float %1 FMax %53 %float_0 + %55 = OpExtInst %float %1 FMin %54 %float_0 + OpStore %f %55 + OpBranch %42 + %42 = OpLabel + %56 = OpLoad %int %i + %57 = OpISub %int %56 %int_1 + OpStore %i %57 + OpBranch %40 + %41 = OpLabel + %58 = OpLoad %float %f + %59 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %60 = OpLoad %float %59 + %61 = OpFOrdEqual %bool %58 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %64 + %63 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + %68 = OpLoad %float %f + %69 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %70 + %72 = OpCompositeConstruct %v4float %67 %68 %71 %float_1 + OpStore %_GLF_color %72 + OpBranch %62 + %64 = OpLabel + OpStore %_GLF_color %34 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..d60898fd08 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int i = 0; + float a = 0.0f; + const float x_37 = asfloat(x_6[1].x); + f = x_37; + const int x_39 = asint(x_9[1].x); + i = x_39; + while (true) { + const int x_44 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_46 = asint(x_9[scalar_offset / 4][scalar_offset % 4]); + if ((x_44 > x_46)) { + } else { + break; + } + a = (1.0f - max(1.0f, float(i))); + f = min(max(a, 0.0f), 0.0f); + { + i = (i - 1); + } + } + const float x_58 = f; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_60 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_58 == x_60)) { + const int x_66 = asint(x_9[2].x); + const float x_68 = f; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_70 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_66), x_68, float(x_70), 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..c3d3e976b3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + float f = 0.0f; + int i = 0; + float a = 0.0f; + float const x_37 = x_6.x_GLF_uniform_float_values.arr[1].el; + f = x_37; + int const x_39 = x_9.x_GLF_uniform_int_values.arr[1].el; + i = x_39; + while (true) { + int const x_44 = i; + int const x_46 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_44 > x_46)) { + } else { + break; + } + int const x_49 = i; + a = (1.0f - fmax(1.0f, float(x_49))); + float const x_53 = a; + f = fmin(fmax(x_53, 0.0f), 0.0f); + { + int const x_56 = i; + i = (x_56 - 1); + } + } + float const x_58 = f; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_58 == x_60)) { + int const x_66 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_68 = f; + int const x_70 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_66), x_68, float(x_70), 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b1d5a29583 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.spvasm @@ -0,0 +1,159 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 93 +; Schema: 0 + OpCapability Shader + %55 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %i "i" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %80 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %81 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %f = OpVariable %_ptr_Function_float Function %26 + %i = OpVariable %_ptr_Function_int Function %29 + %a = OpVariable %_ptr_Function_float Function %26 + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %35 = OpLoad %float %34 + OpStore %f %35 + %37 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %38 = OpLoad %int %37 + OpStore %i %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpSGreaterThan %bool %43 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %40 + %49 = OpLabel + %52 = OpLoad %int %i + %56 = OpConvertSToF %float %52 + %54 = OpExtInst %float %55 NMax %float_1 %56 + %57 = OpFSub %float %float_1 %54 + OpStore %a %57 + %58 = OpLoad %float %a + %60 = OpExtInst %float %55 NMax %58 %float_0 + %59 = OpExtInst %float %55 NMin %60 %float_0 + OpStore %f %59 + OpBranch %41 + %41 = OpLabel + %62 = OpLoad %int %i + %63 = OpISub %int %62 %int_1 + OpStore %i %63 + OpBranch %39 + %40 = OpLabel + %64 = OpLoad %float %f + %65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpFOrdEqual %bool %64 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %73 = OpLoad %int %72 + %74 = OpLoad %float %f + %75 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %73 + %78 = OpConvertSToF %float %76 + %79 = OpCompositeConstruct %v4float %77 %74 %78 %float_1 + OpStore %x_GLF_color %79 + OpBranch %68 + %70 = OpLabel + OpStore %x_GLF_color %80 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %81 +%tint_symbol = OpFunctionParameter %main_out + %85 = OpLabel + %86 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %86 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %88 = OpLabel + %89 = OpFunctionCall %void %main_1 + %91 = OpLoad %v4float %x_GLF_color + %92 = OpCompositeConstruct %main_out %91 + %90 = OpFunctionCall %void %tint_symbol_2 %92 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..973feb9334 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.spvasm.expected.wgsl @@ -0,0 +1,68 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var i : i32; + var a : f32; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[1]; + f = x_37; + let x_39 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_39; + loop { + let x_44 : i32 = i; + let x_46 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_44 > x_46)) { + } else { + break; + } + let x_49 : i32 = i; + a = (1.0 - max(1.0, f32(x_49))); + let x_53 : f32 = a; + f = min(max(x_53, 0.0), 0.0); + + continuing { + let x_56 : i32 = i; + i = (x_56 - 1); + } + } + let x_58 : f32 = f; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_58 == x_60)) { + let x_66 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_68 : f32 = f; + let x_70 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_66), x_68, f32(x_70), 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl new file mode 100644 index 0000000000..973feb9334 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl @@ -0,0 +1,68 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var i : i32; + var a : f32; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[1]; + f = x_37; + let x_39 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_39; + loop { + let x_44 : i32 = i; + let x_46 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_44 > x_46)) { + } else { + break; + } + let x_49 : i32 = i; + a = (1.0 - max(1.0, f32(x_49))); + let x_53 : f32 = a; + f = min(max(x_53, 0.0), 0.0); + + continuing { + let x_56 : i32 = i; + i = (x_56 - 1); + } + } + let x_58 : f32 = f; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_58 == x_60)) { + let x_66 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_68 : f32 = f; + let x_70 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_66), x_68, f32(x_70), 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d60898fd08 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int i = 0; + float a = 0.0f; + const float x_37 = asfloat(x_6[1].x); + f = x_37; + const int x_39 = asint(x_9[1].x); + i = x_39; + while (true) { + const int x_44 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_46 = asint(x_9[scalar_offset / 4][scalar_offset % 4]); + if ((x_44 > x_46)) { + } else { + break; + } + a = (1.0f - max(1.0f, float(i))); + f = min(max(a, 0.0f), 0.0f); + { + i = (i - 1); + } + } + const float x_58 = f; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_60 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_58 == x_60)) { + const int x_66 = asint(x_9[2].x); + const float x_68 = f; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_70 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_66), x_68, float(x_70), 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..c3d3e976b3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + float f = 0.0f; + int i = 0; + float a = 0.0f; + float const x_37 = x_6.x_GLF_uniform_float_values.arr[1].el; + f = x_37; + int const x_39 = x_9.x_GLF_uniform_int_values.arr[1].el; + i = x_39; + while (true) { + int const x_44 = i; + int const x_46 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_44 > x_46)) { + } else { + break; + } + int const x_49 = i; + a = (1.0f - fmax(1.0f, float(x_49))); + float const x_53 = a; + f = fmin(fmax(x_53, 0.0f), 0.0f); + { + int const x_56 = i; + i = (x_56 - 1); + } + } + float const x_58 = f; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_58 == x_60)) { + int const x_66 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_68 = f; + int const x_70 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_66), x_68, float(x_70), 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b1d5a29583 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.spvasm @@ -0,0 +1,159 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 93 +; Schema: 0 + OpCapability Shader + %55 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %i "i" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %80 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %81 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %f = OpVariable %_ptr_Function_float Function %26 + %i = OpVariable %_ptr_Function_int Function %29 + %a = OpVariable %_ptr_Function_float Function %26 + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %35 = OpLoad %float %34 + OpStore %f %35 + %37 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %38 = OpLoad %int %37 + OpStore %i %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpSGreaterThan %bool %43 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %40 + %49 = OpLabel + %52 = OpLoad %int %i + %56 = OpConvertSToF %float %52 + %54 = OpExtInst %float %55 NMax %float_1 %56 + %57 = OpFSub %float %float_1 %54 + OpStore %a %57 + %58 = OpLoad %float %a + %60 = OpExtInst %float %55 NMax %58 %float_0 + %59 = OpExtInst %float %55 NMin %60 %float_0 + OpStore %f %59 + OpBranch %41 + %41 = OpLabel + %62 = OpLoad %int %i + %63 = OpISub %int %62 %int_1 + OpStore %i %63 + OpBranch %39 + %40 = OpLabel + %64 = OpLoad %float %f + %65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpFOrdEqual %bool %64 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %73 = OpLoad %int %72 + %74 = OpLoad %float %f + %75 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %73 + %78 = OpConvertSToF %float %76 + %79 = OpCompositeConstruct %v4float %77 %74 %78 %float_1 + OpStore %x_GLF_color %79 + OpBranch %68 + %70 = OpLabel + OpStore %x_GLF_color %80 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %81 +%tint_symbol = OpFunctionParameter %main_out + %85 = OpLabel + %86 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %86 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %88 = OpLabel + %89 = OpFunctionCall %void %main_1 + %91 = OpLoad %v4float %x_GLF_color + %92 = OpCompositeConstruct %main_out %91 + %90 = OpFunctionCall %void %tint_symbol_2 %92 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..973feb9334 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-descending-loop-min-max-always-zero/0-opt.wgsl.expected.wgsl @@ -0,0 +1,68 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var i : i32; + var a : f32; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[1]; + f = x_37; + let x_39 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_39; + loop { + let x_44 : i32 = i; + let x_46 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_44 > x_46)) { + } else { + break; + } + let x_49 : i32 = i; + a = (1.0 - max(1.0, f32(x_49))); + let x_53 : f32 = a; + f = min(max(x_53, 0.0), 0.0); + + continuing { + let x_56 : i32 = i; + i = (x_56 - 1); + } + } + let x_58 : f32 = f; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_58 == x_60)) { + let x_66 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_68 : f32 = f; + let x_70 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_66), x_68, f32(x_70), 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm new file mode 100644 index 0000000000..21004203c7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm @@ -0,0 +1,63 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %m "m" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %13 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %16 = OpConstantComposite %v2float %float_3 %float_4 + %17 = OpConstantComposite %mat2v2float %13 %16 + %float_0_5 = OpConstant %float 0.5 + %float_1_5 = OpConstant %float 1.5 + %20 = OpConstantComposite %v2float %float_0_5 %float_1_5 + %21 = OpConstantComposite %mat2v2float %20 %13 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %6 + %29 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2float Function + %30 = OpTranspose %mat2v2float %17 + %31 = OpFDiv %float %float_1 %float_2 + %32 = OpMatrixTimesScalar %mat2v2float %30 %31 + OpStore %m %32 + %33 = OpLoad %mat2v2float %m + %34 = OpCompositeExtract %v2float %33 0 + %35 = OpCompositeExtract %v2float %21 0 + %36 = OpFOrdEqual %v2bool %34 %35 + %37 = OpAll %bool %36 + %38 = OpCompositeExtract %v2float %33 1 + %39 = OpCompositeExtract %v2float %21 1 + %40 = OpFOrdEqual %v2bool %38 %39 + %41 = OpAll %bool %40 + %42 = OpLogicalAnd %bool %37 %41 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + OpStore %_GLF_color %27 + OpBranch %43 + %45 = OpLabel + OpStore %_GLF_color %28 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..c9c5e085f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.hlsl @@ -0,0 +1,31 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 m = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + m = (transpose(float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f))) * (1.0f / 2.0f)); + const float2x2 x_33 = m; + bool tint_tmp = all((x_33[0u] == float2x2(float2(0.5f, 1.5f), float2(1.0f, 2.0f))[0u])); + if (tint_tmp) { + tint_tmp = all((x_33[1u] == float2x2(float2(0.5f, 1.5f), float2(1.0f, 2.0f))[1u])); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..6ff0e4222e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float2x2 m = float2x2(0.0f); + m = (transpose(float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f))) * (1.0f / 2.0f)); + float2x2 const x_33 = m; + if ((all((x_33[0u] == float2x2(float2(0.5f, 1.5f), float2(1.0f, 2.0f))[0u])) && all((x_33[1u] == float2x2(float2(0.5f, 1.5f), float2(1.0f, 2.0f))[1u])))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e11c805e40 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %16 = OpConstantNull %mat2v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %20 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %23 = OpConstantComposite %v2float %float_3 %float_4 + %24 = OpConstantComposite %mat2v2float %20 %23 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %float_0_5 = OpConstant %float 0.5 + %float_1_5 = OpConstant %float 1.5 + %35 = OpConstantComposite %v2float %float_0_5 %float_1_5 + %36 = OpConstantComposite %mat2v2float %35 %20 + %v2bool = OpTypeVector %bool 2 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %52 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %53 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %54 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2float Function %16 + %17 = OpTranspose %mat2v2float %24 + %25 = OpFDiv %float %float_1 %float_2 + %26 = OpMatrixTimesScalar %mat2v2float %17 %25 + OpStore %m %26 + %27 = OpLoad %mat2v2float %m + %32 = OpCompositeExtract %v2float %27 0 + %37 = OpCompositeExtract %v2float %36 0 + %38 = OpFOrdEqual %v2bool %32 %37 + %28 = OpAll %bool %38 + OpSelectionMerge %40 None + OpBranchConditional %28 %41 %40 + %41 = OpLabel + %44 = OpCompositeExtract %v2float %27 1 + %45 = OpCompositeExtract %v2float %36 1 + %46 = OpFOrdEqual %v2bool %44 %45 + %42 = OpAll %bool %46 + OpBranch %40 + %40 = OpLabel + %47 = OpPhi %bool %28 %11 %42 %41 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + OpStore %x_GLF_color %52 + OpBranch %48 + %50 = OpLabel + OpStore %x_GLF_color %53 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %54 +%tint_symbol = OpFunctionParameter %main_out + %58 = OpLabel + %59 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %59 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %61 = OpLabel + %62 = OpFunctionCall %void %main_1 + %64 = OpLoad %v4float %x_GLF_color + %65 = OpCompositeConstruct %main_out %64 + %63 = OpFunctionCall %void %tint_symbol_2 %65 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..af5a1c139f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var m : mat2x2; + m = (transpose(mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0))) * (1.0 / 2.0)); + let x_33 : mat2x2 = m; + if ((all((x_33[0u] == mat2x2(vec2(0.5, 1.5), vec2(1.0, 2.0))[0u])) && all((x_33[1u] == mat2x2(vec2(0.5, 1.5), vec2(1.0, 2.0))[1u])))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl new file mode 100644 index 0000000000..af5a1c139f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var m : mat2x2; + m = (transpose(mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0))) * (1.0 / 2.0)); + let x_33 : mat2x2 = m; + if ((all((x_33[0u] == mat2x2(vec2(0.5, 1.5), vec2(1.0, 2.0))[0u])) && all((x_33[1u] == mat2x2(vec2(0.5, 1.5), vec2(1.0, 2.0))[1u])))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..c9c5e085f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 m = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + m = (transpose(float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f))) * (1.0f / 2.0f)); + const float2x2 x_33 = m; + bool tint_tmp = all((x_33[0u] == float2x2(float2(0.5f, 1.5f), float2(1.0f, 2.0f))[0u])); + if (tint_tmp) { + tint_tmp = all((x_33[1u] == float2x2(float2(0.5f, 1.5f), float2(1.0f, 2.0f))[1u])); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..6ff0e4222e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float2x2 m = float2x2(0.0f); + m = (transpose(float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f))) * (1.0f / 2.0f)); + float2x2 const x_33 = m; + if ((all((x_33[0u] == float2x2(float2(0.5f, 1.5f), float2(1.0f, 2.0f))[0u])) && all((x_33[1u] == float2x2(float2(0.5f, 1.5f), float2(1.0f, 2.0f))[1u])))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e11c805e40 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %16 = OpConstantNull %mat2v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %20 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %23 = OpConstantComposite %v2float %float_3 %float_4 + %24 = OpConstantComposite %mat2v2float %20 %23 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %float_0_5 = OpConstant %float 0.5 + %float_1_5 = OpConstant %float 1.5 + %35 = OpConstantComposite %v2float %float_0_5 %float_1_5 + %36 = OpConstantComposite %mat2v2float %35 %20 + %v2bool = OpTypeVector %bool 2 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %52 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %53 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %54 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2float Function %16 + %17 = OpTranspose %mat2v2float %24 + %25 = OpFDiv %float %float_1 %float_2 + %26 = OpMatrixTimesScalar %mat2v2float %17 %25 + OpStore %m %26 + %27 = OpLoad %mat2v2float %m + %32 = OpCompositeExtract %v2float %27 0 + %37 = OpCompositeExtract %v2float %36 0 + %38 = OpFOrdEqual %v2bool %32 %37 + %28 = OpAll %bool %38 + OpSelectionMerge %40 None + OpBranchConditional %28 %41 %40 + %41 = OpLabel + %44 = OpCompositeExtract %v2float %27 1 + %45 = OpCompositeExtract %v2float %36 1 + %46 = OpFOrdEqual %v2bool %44 %45 + %42 = OpAll %bool %46 + OpBranch %40 + %40 = OpLabel + %47 = OpPhi %bool %28 %11 %42 %41 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + OpStore %x_GLF_color %52 + OpBranch %48 + %50 = OpLabel + OpStore %x_GLF_color %53 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %54 +%tint_symbol = OpFunctionParameter %main_out + %58 = OpLabel + %59 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %59 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %61 = OpLabel + %62 = OpFunctionCall %void %main_1 + %64 = OpLoad %v4float %x_GLF_color + %65 = OpCompositeConstruct %main_out %64 + %63 = OpFunctionCall %void %tint_symbol_2 %65 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..af5a1c139f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-divide-matrix-transpose-by-constant/0-opt.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var m : mat2x2; + m = (transpose(mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0))) * (1.0 / 2.0)); + let x_33 : mat2x2 = m; + if ((all((x_33[0u] == mat2x2(vec2(0.5, 1.5), vec2(1.0, 2.0))[0u])) && all((x_33[1u] == mat2x2(vec2(0.5, 1.5), vec2(1.0, 2.0))[1u])))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm new file mode 100644 index 0000000000..809a678a75 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm @@ -0,0 +1,112 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %func_ "func(" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %12 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %26 = OpLabel + %27 = OpFunctionCall %int %func_ + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %29 = OpLoad %int %28 + %30 = OpIEqual %bool %27 %29 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %35 = OpLoad %int %34 + %36 = OpConvertSToF %float %35 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpConvertSToF %float %38 + %40 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpConvertSToF %float %41 + %43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %44 = OpLoad %int %43 + %45 = OpConvertSToF %float %44 + %46 = OpCompositeConstruct %v4float %36 %39 %42 %45 + OpStore %_GLF_color %46 + OpBranch %31 + %33 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %48 + %50 = OpCompositeConstruct %v4float %49 %49 %49 %49 + OpStore %_GLF_color %50 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %int None %12 + %51 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %53 = OpLoad %int %52 + OpStore %i %53 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %int %i + %59 = OpIAdd %int %58 %int_1 + OpStore %i %59 + OpSelectionMerge %60 None + OpBranchConditional %true %61 %60 + %61 = OpLabel + OpSelectionMerge %62 None + OpBranchConditional %true %63 %62 + %63 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %65 = OpLoad %int %64 + OpReturnValue %65 + %62 = OpLabel + OpBranch %60 + %60 = OpLabel + OpBranch %56 + %56 = OpLabel + %66 = OpLoad %int %i + %67 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %68 = OpLoad %int %67 + %69 = OpSLessThan %bool %66 %68 + OpBranchConditional %69 %54 %55 + %55 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %71 = OpLoad %int %70 + OpReturnValue %71 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..6878f83c37 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,65 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_() { + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_53 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + i = x_53; + while (true) { + i = (i + 1); + if (true) { + if (true) { + const int x_65 = asint(x_7[2].x); + return x_65; + } + } + { + const int x_66 = i; + const int x_68 = asint(x_7[1].x); + if ((x_66 < x_68)) { + } else { + break; + } + } + } + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_71 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + return x_71; +} + +void main_1() { + const int x_27 = func_(); + const int x_29 = asint(x_7[2].x); + if ((x_27 == x_29)) { + const int x_35 = asint(x_7[2].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_41 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_44 = asint(x_7[2].x); + x_GLF_color = float4(float(x_35), float(x_38), float(x_41), float(x_44)); + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_48 = asint(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_49 = float(x_48); + x_GLF_color = float4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..2f4c481edc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_(constant buf0& x_7) { + int i = 0; + int const x_53 = x_7.x_GLF_uniform_int_values.arr[0].el; + i = x_53; + while (true) { + int const x_58 = i; + i = (x_58 + 1); + if (true) { + if (true) { + int const x_65 = x_7.x_GLF_uniform_int_values.arr[2].el; + return x_65; + } + } + { + int const x_66 = i; + int const x_68 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_66 < x_68)) { + } else { + break; + } + } + } + int const x_71 = x_7.x_GLF_uniform_int_values.arr[0].el; + return x_71; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int const x_27 = func_(x_7); + int const x_29 = x_7.x_GLF_uniform_int_values.arr[2].el; + if ((x_27 == x_29)) { + int const x_35 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_38 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_41 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_44 = x_7.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_35), float(x_38), float(x_41), float(x_44)); + } else { + int const x_48 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_49 = float(x_48); + *(tint_symbol_4) = float4(x_49, x_49, x_49, x_49); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..ef74140ffc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,157 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 91 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %i "i" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %15 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %void = OpTypeVoid + %51 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %79 = OpTypeFunction %void %main_out + %func_ = OpFunction %int None %15 + %17 = OpLabel + %i = OpVariable %_ptr_Function_int Function %20 + %24 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %25 = OpLoad %int %24 + OpStore %i %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %i + %32 = OpIAdd %int %30 %int_1 + OpStore %i %32 + OpSelectionMerge %35 None + OpBranchConditional %true %36 %35 + %36 = OpLabel + OpSelectionMerge %37 None + OpBranchConditional %true %38 %37 + %38 = OpLabel + %40 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %41 = OpLoad %int %40 + OpReturnValue %41 + %37 = OpLabel + OpBranch %35 + %35 = OpLabel + OpBranch %28 + %28 = OpLabel + %42 = OpLoad %int %i + %43 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpSLessThan %bool %42 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %27 + %46 = OpLabel + OpBranch %26 + %27 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %50 = OpLoad %int %49 + OpReturnValue %50 + OpFunctionEnd + %main_1 = OpFunction %void None %51 + %54 = OpLabel + %55 = OpFunctionCall %int %func_ + %56 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %57 = OpLoad %int %56 + %58 = OpIEqual %bool %55 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %63 + %71 = OpConvertSToF %float %65 + %72 = OpConvertSToF %float %67 + %73 = OpConvertSToF %float %69 + %74 = OpCompositeConstruct %v4float %70 %71 %72 %73 + OpStore %x_GLF_color %74 + OpBranch %59 + %61 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %76 + %78 = OpCompositeConstruct %v4float %77 %77 %77 %77 + OpStore %x_GLF_color %78 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %79 +%tint_symbol = OpFunctionParameter %main_out + %83 = OpLabel + %84 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %84 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %51 + %86 = OpLabel + %87 = OpFunctionCall %void %main_1 + %89 = OpLoad %v4float %x_GLF_color + %90 = OpCompositeConstruct %main_out %89 + %88 = OpFunctionCall %void %tint_symbol_2 %90 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 28[%28] is not post dominated by the back-edge block 46[%46] + %46 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..cb4c4d40b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> i32 { + var i : i32; + let x_53 : i32 = x_7.x_GLF_uniform_int_values[0]; + i = x_53; + loop { + let x_58 : i32 = i; + i = (x_58 + 1); + if (true) { + if (true) { + let x_65 : i32 = x_7.x_GLF_uniform_int_values[2]; + return x_65; + } + } + + continuing { + let x_66 : i32 = i; + let x_68 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_66 < x_68)) { + } else { + break; + } + } + } + let x_71 : i32 = x_7.x_GLF_uniform_int_values[0]; + return x_71; +} + +fn main_1() { + let x_27 : i32 = func_(); + let x_29 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_27 == x_29)) { + let x_35 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_38 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_35), f32(x_38), f32(x_41), f32(x_44)); + } else { + let x_48 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_49 : f32 = f32(x_48); + x_GLF_color = vec4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl new file mode 100644 index 0000000000..cb4c4d40b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> i32 { + var i : i32; + let x_53 : i32 = x_7.x_GLF_uniform_int_values[0]; + i = x_53; + loop { + let x_58 : i32 = i; + i = (x_58 + 1); + if (true) { + if (true) { + let x_65 : i32 = x_7.x_GLF_uniform_int_values[2]; + return x_65; + } + } + + continuing { + let x_66 : i32 = i; + let x_68 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_66 < x_68)) { + } else { + break; + } + } + } + let x_71 : i32 = x_7.x_GLF_uniform_int_values[0]; + return x_71; +} + +fn main_1() { + let x_27 : i32 = func_(); + let x_29 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_27 == x_29)) { + let x_35 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_38 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_35), f32(x_38), f32(x_41), f32(x_44)); + } else { + let x_48 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_49 : f32 = f32(x_48); + x_GLF_color = vec4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..6878f83c37 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,65 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_() { + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_53 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + i = x_53; + while (true) { + i = (i + 1); + if (true) { + if (true) { + const int x_65 = asint(x_7[2].x); + return x_65; + } + } + { + const int x_66 = i; + const int x_68 = asint(x_7[1].x); + if ((x_66 < x_68)) { + } else { + break; + } + } + } + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_71 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + return x_71; +} + +void main_1() { + const int x_27 = func_(); + const int x_29 = asint(x_7[2].x); + if ((x_27 == x_29)) { + const int x_35 = asint(x_7[2].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_41 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_44 = asint(x_7[2].x); + x_GLF_color = float4(float(x_35), float(x_38), float(x_41), float(x_44)); + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_48 = asint(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_49 = float(x_48); + x_GLF_color = float4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..2f4c481edc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_(constant buf0& x_7) { + int i = 0; + int const x_53 = x_7.x_GLF_uniform_int_values.arr[0].el; + i = x_53; + while (true) { + int const x_58 = i; + i = (x_58 + 1); + if (true) { + if (true) { + int const x_65 = x_7.x_GLF_uniform_int_values.arr[2].el; + return x_65; + } + } + { + int const x_66 = i; + int const x_68 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_66 < x_68)) { + } else { + break; + } + } + } + int const x_71 = x_7.x_GLF_uniform_int_values.arr[0].el; + return x_71; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int const x_27 = func_(x_7); + int const x_29 = x_7.x_GLF_uniform_int_values.arr[2].el; + if ((x_27 == x_29)) { + int const x_35 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_38 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_41 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_44 = x_7.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_35), float(x_38), float(x_41), float(x_44)); + } else { + int const x_48 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_49 = float(x_48); + *(tint_symbol_4) = float4(x_49, x_49, x_49, x_49); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..ef74140ffc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,157 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 91 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %i "i" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %15 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %void = OpTypeVoid + %51 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %79 = OpTypeFunction %void %main_out + %func_ = OpFunction %int None %15 + %17 = OpLabel + %i = OpVariable %_ptr_Function_int Function %20 + %24 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %25 = OpLoad %int %24 + OpStore %i %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %i + %32 = OpIAdd %int %30 %int_1 + OpStore %i %32 + OpSelectionMerge %35 None + OpBranchConditional %true %36 %35 + %36 = OpLabel + OpSelectionMerge %37 None + OpBranchConditional %true %38 %37 + %38 = OpLabel + %40 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %41 = OpLoad %int %40 + OpReturnValue %41 + %37 = OpLabel + OpBranch %35 + %35 = OpLabel + OpBranch %28 + %28 = OpLabel + %42 = OpLoad %int %i + %43 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpSLessThan %bool %42 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %27 + %46 = OpLabel + OpBranch %26 + %27 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %50 = OpLoad %int %49 + OpReturnValue %50 + OpFunctionEnd + %main_1 = OpFunction %void None %51 + %54 = OpLabel + %55 = OpFunctionCall %int %func_ + %56 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %57 = OpLoad %int %56 + %58 = OpIEqual %bool %55 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %63 + %71 = OpConvertSToF %float %65 + %72 = OpConvertSToF %float %67 + %73 = OpConvertSToF %float %69 + %74 = OpCompositeConstruct %v4float %70 %71 %72 %73 + OpStore %x_GLF_color %74 + OpBranch %59 + %61 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %76 + %78 = OpCompositeConstruct %v4float %77 %77 %77 %77 + OpStore %x_GLF_color %78 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %79 +%tint_symbol = OpFunctionParameter %main_out + %83 = OpLabel + %84 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %84 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %51 + %86 = OpLabel + %87 = OpFunctionCall %void %main_1 + %89 = OpLoad %v4float %x_GLF_color + %90 = OpCompositeConstruct %main_out %89 + %88 = OpFunctionCall %void %tint_symbol_2 %90 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 28[%28] is not post dominated by the back-edge block 46[%46] + %46 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..cb4c4d40b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-double-if-true-in-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> i32 { + var i : i32; + let x_53 : i32 = x_7.x_GLF_uniform_int_values[0]; + i = x_53; + loop { + let x_58 : i32 = i; + i = (x_58 + 1); + if (true) { + if (true) { + let x_65 : i32 = x_7.x_GLF_uniform_int_values[2]; + return x_65; + } + } + + continuing { + let x_66 : i32 = i; + let x_68 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_66 < x_68)) { + } else { + break; + } + } + } + let x_71 : i32 = x_7.x_GLF_uniform_int_values[0]; + return x_71; +} + +fn main_1() { + let x_27 : i32 = func_(); + let x_29 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_27 == x_29)) { + let x_35 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_38 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_35), f32(x_38), f32(x_41), f32(x_44)); + } else { + let x_48 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_49 : f32 = f32(x_48); + x_GLF_color = vec4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm new file mode 100644 index 0000000000..091e8c04e7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm @@ -0,0 +1,148 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %arr "arr" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %27 = OpConstantComposite %_arr_int_uint_10 %int_1 %int_2 %int_3 %int_4 %int_5 %int_6 %int_7 %int_8 %int_9 %int_10 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_n1 = OpConstant %int -1 + %v2int = OpTypeVector %int 2 + %uint_1 = OpConstant %uint 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %11 + %40 = OpLabel + %arr = OpVariable %_ptr_Function__arr_int_uint_10 Function + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %arr %27 + OpStore %a %int_0 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpAccessChain %_ptr_Function_int %arr %42 + %44 = OpLoad %int %43 + %45 = OpIEqual %bool %44 %int_2 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %49 = OpLoad %int %48 + OpStore %i %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %int %i + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpSLessThan %bool %54 %56 + OpBranchConditional %57 %58 %51 + %58 = OpLabel + OpBranch %52 + %52 = OpLabel + %59 = OpLoad %int %i + %60 = OpIAdd %int %59 %int_1 + OpStore %i %60 + OpBranch %50 + %51 = OpLabel + %61 = OpLoad %int %a + %62 = OpIAdd %int %61 %int_1 + OpStore %a %62 + OpBranch %46 + %46 = OpLabel + %63 = OpLoad %int %a + %64 = OpSMod %int %int_n1 %63 + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpIEqual %bool %64 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpCompositeConstruct %v2int %71 %71 + %73 = OpCompositeExtract %int %72 1 + %74 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Function_int %arr %73 + OpStore %76 %75 + OpBranch %68 + %68 = OpLabel + %77 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Function_int %arr %78 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %82 = OpLoad %int %81 + %83 = OpIEqual %bool %80 %82 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %88 + %90 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %91 + %93 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %94 = OpLoad %int %93 + %95 = OpConvertSToF %float %94 + %96 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpConvertSToF %float %97 + %99 = OpCompositeConstruct %v4float %89 %92 %95 %98 + OpStore %_GLF_color %99 + OpBranch %84 + %86 = OpLabel + %100 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %101 = OpLoad %int %100 + %102 = OpConvertSToF %float %101 + %103 = OpCompositeConstruct %v4float %102 %102 %102 %102 + OpStore %_GLF_color %103 + OpBranch %84 + %84 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..642f1e69b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.hlsl @@ -0,0 +1,68 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int arr[10] = (int[10])0; + int a = 0; + int i = 0; + const int tint_symbol_3[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + arr = tint_symbol_3; + a = 0; + const int x_42 = asint(x_7[1].x); + const int x_44 = arr[x_42]; + if ((x_44 == 2)) { + const int x_49 = asint(x_7[2].x); + i = x_49; + while (true) { + const int x_54 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_56 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_54 < x_56)) { + } else { + break; + } + { + i = (i + 1); + } + } + a = (a + 1); + } + const int x_63 = a; + const int x_66 = asint(x_7[2].x); + if (((-1 % x_63) == x_66)) { + const int x_71 = asint(x_7[1].x); + const int x_75 = asint(x_7[2].x); + arr[int2(x_71, x_71).y] = x_75; + } + const int x_78 = asint(x_7[1].x); + const int x_80 = arr[x_78]; + const int x_82 = asint(x_7[2].x); + if ((x_80 == x_82)) { + const int x_88 = asint(x_7[1].x); + const int x_91 = asint(x_7[2].x); + const int x_94 = asint(x_7[2].x); + const int x_97 = asint(x_7[1].x); + x_GLF_color = float4(float(x_88), float(x_91), float(x_94), float(x_97)); + } else { + const int x_101 = asint(x_7[2].x); + const float x_102 = float(x_101); + x_GLF_color = float4(x_102, x_102, x_102, x_102); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..821d826db2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.msl @@ -0,0 +1,82 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5) { + tint_array_wrapper_1 arr = {}; + int a = 0; + int i = 0; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; + arr = tint_symbol_3; + a = 0; + int const x_42 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_44 = arr.arr[x_42]; + if ((x_44 == 2)) { + int const x_49 = x_7.x_GLF_uniform_int_values.arr[2].el; + i = x_49; + while (true) { + int const x_54 = i; + int const x_56 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_54 < x_56)) { + } else { + break; + } + { + int const x_59 = i; + i = (x_59 + 1); + } + } + int const x_61 = a; + a = (x_61 + 1); + } + int const x_63 = a; + int const x_66 = x_7.x_GLF_uniform_int_values.arr[2].el; + if (((-1 % x_63) == x_66)) { + int const x_71 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_75 = x_7.x_GLF_uniform_int_values.arr[2].el; + arr.arr[int2(x_71, x_71).y] = x_75; + } + int const x_78 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_80 = arr.arr[x_78]; + int const x_82 = x_7.x_GLF_uniform_int_values.arr[2].el; + if ((x_80 == x_82)) { + int const x_88 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_91 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_94 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_97 = x_7.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_5) = float4(float(x_88), float(x_91), float(x_94), float(x_97)); + } else { + int const x_101 = x_7.x_GLF_uniform_int_values.arr[2].el; + float const x_102 = float(x_101); + *(tint_symbol_5) = float4(x_102, x_102, x_102, x_102); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..57906338c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.spvasm @@ -0,0 +1,187 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 122 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %arr "arr" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %23 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %38 = OpConstantComposite %_arr_int_uint_10 %int_1 %int_2 %int_3 %int_4 %int_5 %int_6 %int_7 %int_8 %int_9 %int_10 + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_n1 = OpConstant %int -1 + %v2int = OpTypeVector %int 2 + %main_out = OpTypeStruct %v4float + %110 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %arr = OpVariable %_ptr_Function__arr_int_uint_10 Function %23 + %a = OpVariable %_ptr_Function_int Function %26 + %i = OpVariable %_ptr_Function_int Function %26 + OpStore %arr %38 + OpStore %a %int_0 + %42 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Function_int %arr %43 + %45 = OpLoad %int %44 + %46 = OpIEqual %bool %45 %int_2 + OpSelectionMerge %48 None + OpBranchConditional %46 %49 %48 + %49 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %51 = OpLoad %int %50 + OpStore %i %51 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %i + %57 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %58 = OpLoad %int %57 + %59 = OpSLessThan %bool %56 %58 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %53 + %60 = OpLabel + OpBranch %54 + %54 = OpLabel + %63 = OpLoad %int %i + %64 = OpIAdd %int %63 %int_1 + OpStore %i %64 + OpBranch %52 + %53 = OpLabel + %65 = OpLoad %int %a + %66 = OpIAdd %int %65 %int_1 + OpStore %a %66 + OpBranch %48 + %48 = OpLabel + %67 = OpLoad %int %a + %68 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %69 = OpLoad %int %68 + %71 = OpSMod %int %int_n1 %67 + %72 = OpIEqual %bool %71 %69 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %78 = OpLoad %int %77 + %80 = OpCompositeConstruct %v2int %76 %76 + %81 = OpCompositeExtract %int %80 1 + %82 = OpAccessChain %_ptr_Function_int %arr %81 + OpStore %82 %78 + OpBranch %73 + %73 = OpLabel + %83 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Function_int %arr %84 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %88 = OpLoad %int %87 + %89 = OpIEqual %bool %86 %88 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 + %91 = OpLabel + %93 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %100 = OpLoad %int %99 + %101 = OpConvertSToF %float %94 + %102 = OpConvertSToF %float %96 + %103 = OpConvertSToF %float %98 + %104 = OpConvertSToF %float %100 + %105 = OpCompositeConstruct %v4float %101 %102 %103 %104 + OpStore %x_GLF_color %105 + OpBranch %90 + %92 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %107 = OpLoad %int %106 + %108 = OpConvertSToF %float %107 + %109 = OpCompositeConstruct %v4float %108 %108 %108 %108 + OpStore %x_GLF_color %109 + OpBranch %90 + %90 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %110 +%tint_symbol = OpFunctionParameter %main_out + %114 = OpLabel + %115 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %115 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %117 = OpLabel + %118 = OpFunctionCall %void %main_1 + %120 = OpLoad %v4float %x_GLF_color + %121 = OpCompositeConstruct %main_out %120 + %119 = OpFunctionCall %void %tint_symbol_2 %121 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..6a47f1c116 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.spvasm.expected.wgsl @@ -0,0 +1,72 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var a : i32; + var i : i32; + arr = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + a = 0; + let x_42 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_44 : i32 = arr[x_42]; + if ((x_44 == 2)) { + let x_49 : i32 = x_7.x_GLF_uniform_int_values[2]; + i = x_49; + loop { + let x_54 : i32 = i; + let x_56 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_54 < x_56)) { + } else { + break; + } + + continuing { + let x_59 : i32 = i; + i = (x_59 + 1); + } + } + let x_61 : i32 = a; + a = (x_61 + 1); + } + let x_63 : i32 = a; + let x_66 : i32 = x_7.x_GLF_uniform_int_values[2]; + if (((-1 % x_63) == x_66)) { + let x_71 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_75 : i32 = x_7.x_GLF_uniform_int_values[2]; + arr[vec2(x_71, x_71).y] = x_75; + } + let x_78 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_80 : i32 = arr[x_78]; + let x_82 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_80 == x_82)) { + let x_88 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_91 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_94 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_97 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_88), f32(x_91), f32(x_94), f32(x_97)); + } else { + let x_101 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_102 : f32 = f32(x_101); + x_GLF_color = vec4(x_102, x_102, x_102, x_102); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl new file mode 100644 index 0000000000..6a47f1c116 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl @@ -0,0 +1,72 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var a : i32; + var i : i32; + arr = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + a = 0; + let x_42 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_44 : i32 = arr[x_42]; + if ((x_44 == 2)) { + let x_49 : i32 = x_7.x_GLF_uniform_int_values[2]; + i = x_49; + loop { + let x_54 : i32 = i; + let x_56 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_54 < x_56)) { + } else { + break; + } + + continuing { + let x_59 : i32 = i; + i = (x_59 + 1); + } + } + let x_61 : i32 = a; + a = (x_61 + 1); + } + let x_63 : i32 = a; + let x_66 : i32 = x_7.x_GLF_uniform_int_values[2]; + if (((-1 % x_63) == x_66)) { + let x_71 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_75 : i32 = x_7.x_GLF_uniform_int_values[2]; + arr[vec2(x_71, x_71).y] = x_75; + } + let x_78 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_80 : i32 = arr[x_78]; + let x_82 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_80 == x_82)) { + let x_88 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_91 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_94 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_97 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_88), f32(x_91), f32(x_94), f32(x_97)); + } else { + let x_101 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_102 : f32 = f32(x_101); + x_GLF_color = vec4(x_102, x_102, x_102, x_102); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..642f1e69b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.hlsl @@ -0,0 +1,68 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int arr[10] = (int[10])0; + int a = 0; + int i = 0; + const int tint_symbol_3[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + arr = tint_symbol_3; + a = 0; + const int x_42 = asint(x_7[1].x); + const int x_44 = arr[x_42]; + if ((x_44 == 2)) { + const int x_49 = asint(x_7[2].x); + i = x_49; + while (true) { + const int x_54 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_56 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_54 < x_56)) { + } else { + break; + } + { + i = (i + 1); + } + } + a = (a + 1); + } + const int x_63 = a; + const int x_66 = asint(x_7[2].x); + if (((-1 % x_63) == x_66)) { + const int x_71 = asint(x_7[1].x); + const int x_75 = asint(x_7[2].x); + arr[int2(x_71, x_71).y] = x_75; + } + const int x_78 = asint(x_7[1].x); + const int x_80 = arr[x_78]; + const int x_82 = asint(x_7[2].x); + if ((x_80 == x_82)) { + const int x_88 = asint(x_7[1].x); + const int x_91 = asint(x_7[2].x); + const int x_94 = asint(x_7[2].x); + const int x_97 = asint(x_7[1].x); + x_GLF_color = float4(float(x_88), float(x_91), float(x_94), float(x_97)); + } else { + const int x_101 = asint(x_7[2].x); + const float x_102 = float(x_101); + x_GLF_color = float4(x_102, x_102, x_102, x_102); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..821d826db2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.msl @@ -0,0 +1,82 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5) { + tint_array_wrapper_1 arr = {}; + int a = 0; + int i = 0; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; + arr = tint_symbol_3; + a = 0; + int const x_42 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_44 = arr.arr[x_42]; + if ((x_44 == 2)) { + int const x_49 = x_7.x_GLF_uniform_int_values.arr[2].el; + i = x_49; + while (true) { + int const x_54 = i; + int const x_56 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_54 < x_56)) { + } else { + break; + } + { + int const x_59 = i; + i = (x_59 + 1); + } + } + int const x_61 = a; + a = (x_61 + 1); + } + int const x_63 = a; + int const x_66 = x_7.x_GLF_uniform_int_values.arr[2].el; + if (((-1 % x_63) == x_66)) { + int const x_71 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_75 = x_7.x_GLF_uniform_int_values.arr[2].el; + arr.arr[int2(x_71, x_71).y] = x_75; + } + int const x_78 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_80 = arr.arr[x_78]; + int const x_82 = x_7.x_GLF_uniform_int_values.arr[2].el; + if ((x_80 == x_82)) { + int const x_88 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_91 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_94 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_97 = x_7.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_5) = float4(float(x_88), float(x_91), float(x_94), float(x_97)); + } else { + int const x_101 = x_7.x_GLF_uniform_int_values.arr[2].el; + float const x_102 = float(x_101); + *(tint_symbol_5) = float4(x_102, x_102, x_102, x_102); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..57906338c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.spvasm @@ -0,0 +1,187 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 122 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %arr "arr" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %23 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %38 = OpConstantComposite %_arr_int_uint_10 %int_1 %int_2 %int_3 %int_4 %int_5 %int_6 %int_7 %int_8 %int_9 %int_10 + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_n1 = OpConstant %int -1 + %v2int = OpTypeVector %int 2 + %main_out = OpTypeStruct %v4float + %110 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %arr = OpVariable %_ptr_Function__arr_int_uint_10 Function %23 + %a = OpVariable %_ptr_Function_int Function %26 + %i = OpVariable %_ptr_Function_int Function %26 + OpStore %arr %38 + OpStore %a %int_0 + %42 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Function_int %arr %43 + %45 = OpLoad %int %44 + %46 = OpIEqual %bool %45 %int_2 + OpSelectionMerge %48 None + OpBranchConditional %46 %49 %48 + %49 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %51 = OpLoad %int %50 + OpStore %i %51 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %i + %57 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %58 = OpLoad %int %57 + %59 = OpSLessThan %bool %56 %58 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %53 + %60 = OpLabel + OpBranch %54 + %54 = OpLabel + %63 = OpLoad %int %i + %64 = OpIAdd %int %63 %int_1 + OpStore %i %64 + OpBranch %52 + %53 = OpLabel + %65 = OpLoad %int %a + %66 = OpIAdd %int %65 %int_1 + OpStore %a %66 + OpBranch %48 + %48 = OpLabel + %67 = OpLoad %int %a + %68 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %69 = OpLoad %int %68 + %71 = OpSMod %int %int_n1 %67 + %72 = OpIEqual %bool %71 %69 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %78 = OpLoad %int %77 + %80 = OpCompositeConstruct %v2int %76 %76 + %81 = OpCompositeExtract %int %80 1 + %82 = OpAccessChain %_ptr_Function_int %arr %81 + OpStore %82 %78 + OpBranch %73 + %73 = OpLabel + %83 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Function_int %arr %84 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %88 = OpLoad %int %87 + %89 = OpIEqual %bool %86 %88 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 + %91 = OpLabel + %93 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %100 = OpLoad %int %99 + %101 = OpConvertSToF %float %94 + %102 = OpConvertSToF %float %96 + %103 = OpConvertSToF %float %98 + %104 = OpConvertSToF %float %100 + %105 = OpCompositeConstruct %v4float %101 %102 %103 %104 + OpStore %x_GLF_color %105 + OpBranch %90 + %92 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %107 = OpLoad %int %106 + %108 = OpConvertSToF %float %107 + %109 = OpCompositeConstruct %v4float %108 %108 %108 %108 + OpStore %x_GLF_color %109 + OpBranch %90 + %90 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %110 +%tint_symbol = OpFunctionParameter %main_out + %114 = OpLabel + %115 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %115 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %117 = OpLabel + %118 = OpFunctionCall %void %main_1 + %120 = OpLoad %v4float %x_GLF_color + %121 = OpCompositeConstruct %main_out %120 + %119 = OpFunctionCall %void %tint_symbol_2 %121 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..6a47f1c116 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-empty-loop-minus-one-modulo-variable-one/0-opt.wgsl.expected.wgsl @@ -0,0 +1,72 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var a : i32; + var i : i32; + arr = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + a = 0; + let x_42 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_44 : i32 = arr[x_42]; + if ((x_44 == 2)) { + let x_49 : i32 = x_7.x_GLF_uniform_int_values[2]; + i = x_49; + loop { + let x_54 : i32 = i; + let x_56 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_54 < x_56)) { + } else { + break; + } + + continuing { + let x_59 : i32 = i; + i = (x_59 + 1); + } + } + let x_61 : i32 = a; + a = (x_61 + 1); + } + let x_63 : i32 = a; + let x_66 : i32 = x_7.x_GLF_uniform_int_values[2]; + if (((-1 % x_63) == x_66)) { + let x_71 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_75 : i32 = x_7.x_GLF_uniform_int_values[2]; + arr[vec2(x_71, x_71).y] = x_75; + } + let x_78 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_80 : i32 = arr[x_78]; + let x_82 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_80 == x_82)) { + let x_88 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_91 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_94 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_97 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_88), f32(x_91), f32(x_94), f32(x_97)); + } else { + let x_101 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_102 : f32 = f32(x_101); + x_GLF_color = vec4(x_102, x_102, x_102, x_102); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm new file mode 100644 index 0000000000..b5100681cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm @@ -0,0 +1,42 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f "f" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_2 = OpConstant %float 2 + %float_4 = OpConstant %float 4 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %16 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %17 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %6 + %18 = OpLabel + %f = OpVariable %_ptr_Function_float Function + OpStore %f %float_2 + %19 = OpLoad %float %f + %20 = OpExtInst %float %1 Exp2 %19 + %21 = OpFOrdEqual %bool %20 %float_4 + OpSelectionMerge %22 None + OpBranchConditional %21 %23 %24 + %23 = OpLabel + OpStore %_GLF_color %16 + OpBranch %22 + %24 = OpLabel + OpStore %_GLF_color %17 + OpBranch %22 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9f1319b9ec --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.hlsl @@ -0,0 +1,26 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + f = 2.0f; + if ((exp2(f) == 4.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..387bc0b5ed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float f = 0.0f; + f = 2.0f; + float const x_19 = f; + if ((exp2(x_19) == 4.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e668d86225 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %14 = OpConstantNull %float + %float_2 = OpConstant %float 2 + %float_4 = OpConstant %float 4 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %29 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %f = OpVariable %_ptr_Function_float Function %14 + OpStore %f %float_2 + %16 = OpLoad %float %f + %17 = OpExtInst %float %18 Exp2 %16 + %20 = OpFOrdEqual %bool %17 %float_4 + OpSelectionMerge %22 None + OpBranchConditional %20 %23 %24 + %23 = OpLabel + OpStore %x_GLF_color %27 + OpBranch %22 + %24 = OpLabel + OpStore %x_GLF_color %28 + OpBranch %22 + %22 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %29 +%tint_symbol = OpFunctionParameter %main_out + %33 = OpLabel + %34 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %34 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %36 = OpLabel + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %x_GLF_color + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_2 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..620e1b8e6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + f = 2.0; + let x_19 : f32 = f; + if ((exp2(x_19) == 4.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl new file mode 100644 index 0000000000..620e1b8e6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + f = 2.0; + let x_19 : f32 = f; + if ((exp2(x_19) == 4.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9f1319b9ec --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + f = 2.0f; + if ((exp2(f) == 4.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..387bc0b5ed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float f = 0.0f; + f = 2.0f; + float const x_19 = f; + if ((exp2(x_19) == 4.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e668d86225 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %18 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %14 = OpConstantNull %float + %float_2 = OpConstant %float 2 + %float_4 = OpConstant %float 4 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %29 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %f = OpVariable %_ptr_Function_float Function %14 + OpStore %f %float_2 + %16 = OpLoad %float %f + %17 = OpExtInst %float %18 Exp2 %16 + %20 = OpFOrdEqual %bool %17 %float_4 + OpSelectionMerge %22 None + OpBranchConditional %20 %23 %24 + %23 = OpLabel + OpStore %x_GLF_color %27 + OpBranch %22 + %24 = OpLabel + OpStore %x_GLF_color %28 + OpBranch %22 + %22 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %29 +%tint_symbol = OpFunctionParameter %main_out + %33 = OpLabel + %34 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %34 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %36 = OpLabel + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %x_GLF_color + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_2 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..620e1b8e6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-exp2-two/0-opt.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + f = 2.0; + let x_19 : f32 = f; + if ((exp2(x_19) == 4.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm new file mode 100644 index 0000000000..42541f5f1b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm @@ -0,0 +1,122 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f "f" + OpName %arr "arr" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_2 = OpConstant %float 2 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_2 = OpConstant %int 2 + %main = OpFunction %void None %13 + %35 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %arr = OpVariable %_ptr_Function__arr_float_uint_10 Function + OpStore %f %float_2 + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %43 = OpLoad %float %42 + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %49 = OpLoad %float %48 + %50 = OpLoad %float %f + %51 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %52 = OpLoad %float %51 + %53 = OpExtInst %float %1 Pow %50 %52 + %54 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %57 = OpLoad %float %56 + %58 = OpCompositeConstruct %_arr_float_uint_10 %37 %39 %41 %43 %45 %47 %49 %53 %55 %57 + OpStore %arr %58 + %59 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Function_float %arr %60 + %62 = OpLoad %float %61 + %63 = OpConvertFToS %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %65 = OpLoad %int %64 + %66 = OpIEqual %bool %63 %65 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %69 + %68 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %71 + %73 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %80 + %82 = OpCompositeConstruct %v4float %72 %75 %78 %81 + OpStore %_GLF_color %82 + OpBranch %67 + %69 = OpLabel + %83 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %84 = OpLoad %int %83 + %85 = OpConvertSToF %float %84 + %86 = OpCompositeConstruct %v4float %85 %85 %85 %85 + OpStore %_GLF_color %86 + OpBranch %67 + %67 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..81e45982de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.hlsl @@ -0,0 +1,65 @@ +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + float arr[10] = (float[10])0; + f = 2.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_37 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_39 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_43 = asfloat(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const float x_49 = asfloat(x_7[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_50 = f; + const float x_52 = asfloat(x_7[1].x); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_7[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const float x_57 = asfloat(x_7[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float tint_symbol_4[10] = {x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57}; + arr = tint_symbol_4; + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_60 = asint(x_9[scalar_offset_9 / 4][scalar_offset_9 % 4]); + const float x_62 = arr[x_60]; + const int x_65 = asint(x_9[3].x); + if ((int(x_62) == x_65)) { + const int x_71 = asint(x_9[1].x); + const int x_74 = asint(x_9[2].x); + const int x_77 = asint(x_9[2].x); + const int x_80 = asint(x_9[1].x); + x_GLF_color = float4(float(x_71), float(x_74), float(x_77), float(x_80)); + } else { + const int x_84 = asint(x_9[2].x); + const float x_85 = float(x_84); + x_GLF_color = float4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..3eea4ecfcd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_9, thread float4* const tint_symbol_5) { + float f = 0.0f; + tint_array_wrapper_2 arr = {}; + f = 2.0f; + float const x_37 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_39 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_41 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_43 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_45 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_47 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_49 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_50 = f; + float const x_52 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_55 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_57 = x_7.x_GLF_uniform_float_values.arr[0].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57}}; + arr = tint_symbol_3; + int const x_60 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_62 = arr.arr[x_60]; + int const x_65 = x_9.x_GLF_uniform_int_values.arr[3].el; + if ((int(x_62) == x_65)) { + int const x_71 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_74 = x_9.x_GLF_uniform_int_values.arr[2].el; + int const x_77 = x_9.x_GLF_uniform_int_values.arr[2].el; + int const x_80 = x_9.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_5) = float4(float(x_71), float(x_74), float(x_77), float(x_80)); + } else { + int const x_84 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_85 = float(x_84); + *(tint_symbol_5) = float4(x_85, x_85, x_85, x_85); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..bb87b2028b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.spvasm @@ -0,0 +1,159 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 105 +; Schema: 0 + OpCapability Shader + %59 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %arr "arr" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %31 = OpConstantNull %_arr_float_uint_10 + %float_2 = OpConstant %float 2 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %93 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %f = OpVariable %_ptr_Function_float Function %26 + %arr = OpVariable %_ptr_Function__arr_float_uint_10 Function %31 + OpStore %f %float_2 + %36 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %43 = OpLoad %float %42 + %44 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %49 = OpLoad %float %48 + %50 = OpLoad %float %f + %52 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %57 = OpLoad %float %56 + %58 = OpExtInst %float %59 Pow %50 %53 + %60 = OpCompositeConstruct %_arr_float_uint_10 %37 %39 %41 %43 %45 %47 %49 %58 %55 %57 + OpStore %arr %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Function_float %arr %63 + %65 = OpLoad %float %64 + %67 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_3 + %68 = OpLoad %int %67 + %69 = OpConvertFToS %int %65 + %70 = OpIEqual %bool %69 %68 + OpSelectionMerge %72 None + OpBranchConditional %70 %73 %74 + %73 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %76 = OpLoad %int %75 + %78 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpConvertSToF %float %76 + %85 = OpConvertSToF %float %79 + %86 = OpConvertSToF %float %81 + %87 = OpConvertSToF %float %83 + %88 = OpCompositeConstruct %v4float %84 %85 %86 %87 + OpStore %x_GLF_color %88 + OpBranch %72 + %74 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %90 = OpLoad %int %89 + %91 = OpConvertSToF %float %90 + %92 = OpCompositeConstruct %v4float %91 %91 %91 %91 + OpStore %x_GLF_color %92 + OpBranch %72 + %72 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %93 +%tint_symbol = OpFunctionParameter %main_out + %97 = OpLabel + %98 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %98 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %100 = OpLabel + %101 = OpFunctionCall %void %main_1 + %103 = OpLoad %v4float %x_GLF_color + %104 = OpCompositeConstruct %main_out %103 + %102 = OpFunctionCall %void %tint_symbol_2 %104 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..0c41106446 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.spvasm.expected.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var arr : array; + f = 2.0; + let x_37 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_39 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_41 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_43 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_45 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_47 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_49 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_50 : f32 = f; + let x_52 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_55 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_57 : f32 = x_7.x_GLF_uniform_float_values[0]; + arr = array(x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57); + let x_60 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_62 : f32 = arr[x_60]; + let x_65 : i32 = x_9.x_GLF_uniform_int_values[3]; + if ((i32(x_62) == x_65)) { + let x_71 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_74 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_77 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_80 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_71), f32(x_74), f32(x_77), f32(x_80)); + } else { + let x_84 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_85 : f32 = f32(x_84); + x_GLF_color = vec4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl new file mode 100644 index 0000000000..0c41106446 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var arr : array; + f = 2.0; + let x_37 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_39 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_41 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_43 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_45 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_47 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_49 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_50 : f32 = f; + let x_52 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_55 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_57 : f32 = x_7.x_GLF_uniform_float_values[0]; + arr = array(x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57); + let x_60 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_62 : f32 = arr[x_60]; + let x_65 : i32 = x_9.x_GLF_uniform_int_values[3]; + if ((i32(x_62) == x_65)) { + let x_71 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_74 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_77 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_80 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_71), f32(x_74), f32(x_77), f32(x_80)); + } else { + let x_84 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_85 : f32 = f32(x_84); + x_GLF_color = vec4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..81e45982de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.hlsl @@ -0,0 +1,65 @@ +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + float arr[10] = (float[10])0; + f = 2.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_37 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_39 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_43 = asfloat(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const float x_49 = asfloat(x_7[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_50 = f; + const float x_52 = asfloat(x_7[1].x); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_7[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const float x_57 = asfloat(x_7[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float tint_symbol_4[10] = {x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57}; + arr = tint_symbol_4; + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_60 = asint(x_9[scalar_offset_9 / 4][scalar_offset_9 % 4]); + const float x_62 = arr[x_60]; + const int x_65 = asint(x_9[3].x); + if ((int(x_62) == x_65)) { + const int x_71 = asint(x_9[1].x); + const int x_74 = asint(x_9[2].x); + const int x_77 = asint(x_9[2].x); + const int x_80 = asint(x_9[1].x); + x_GLF_color = float4(float(x_71), float(x_74), float(x_77), float(x_80)); + } else { + const int x_84 = asint(x_9[2].x); + const float x_85 = float(x_84); + x_GLF_color = float4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..3eea4ecfcd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_9, thread float4* const tint_symbol_5) { + float f = 0.0f; + tint_array_wrapper_2 arr = {}; + f = 2.0f; + float const x_37 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_39 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_41 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_43 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_45 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_47 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_49 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_50 = f; + float const x_52 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_55 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_57 = x_7.x_GLF_uniform_float_values.arr[0].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57}}; + arr = tint_symbol_3; + int const x_60 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_62 = arr.arr[x_60]; + int const x_65 = x_9.x_GLF_uniform_int_values.arr[3].el; + if ((int(x_62) == x_65)) { + int const x_71 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_74 = x_9.x_GLF_uniform_int_values.arr[2].el; + int const x_77 = x_9.x_GLF_uniform_int_values.arr[2].el; + int const x_80 = x_9.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_5) = float4(float(x_71), float(x_74), float(x_77), float(x_80)); + } else { + int const x_84 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_85 = float(x_84); + *(tint_symbol_5) = float4(x_85, x_85, x_85, x_85); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..bb87b2028b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.spvasm @@ -0,0 +1,159 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 105 +; Schema: 0 + OpCapability Shader + %59 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %arr "arr" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %31 = OpConstantNull %_arr_float_uint_10 + %float_2 = OpConstant %float 2 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %93 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %f = OpVariable %_ptr_Function_float Function %26 + %arr = OpVariable %_ptr_Function__arr_float_uint_10 Function %31 + OpStore %f %float_2 + %36 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %43 = OpLoad %float %42 + %44 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %49 = OpLoad %float %48 + %50 = OpLoad %float %f + %52 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %57 = OpLoad %float %56 + %58 = OpExtInst %float %59 Pow %50 %53 + %60 = OpCompositeConstruct %_arr_float_uint_10 %37 %39 %41 %43 %45 %47 %49 %58 %55 %57 + OpStore %arr %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Function_float %arr %63 + %65 = OpLoad %float %64 + %67 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_3 + %68 = OpLoad %int %67 + %69 = OpConvertFToS %int %65 + %70 = OpIEqual %bool %69 %68 + OpSelectionMerge %72 None + OpBranchConditional %70 %73 %74 + %73 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %76 = OpLoad %int %75 + %78 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpConvertSToF %float %76 + %85 = OpConvertSToF %float %79 + %86 = OpConvertSToF %float %81 + %87 = OpConvertSToF %float %83 + %88 = OpCompositeConstruct %v4float %84 %85 %86 %87 + OpStore %x_GLF_color %88 + OpBranch %72 + %74 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %90 = OpLoad %int %89 + %91 = OpConvertSToF %float %90 + %92 = OpCompositeConstruct %v4float %91 %91 %91 %91 + OpStore %x_GLF_color %92 + OpBranch %72 + %72 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %93 +%tint_symbol = OpFunctionParameter %main_out + %97 = OpLabel + %98 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %98 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %100 = OpLabel + %101 = OpFunctionCall %void %main_1 + %103 = OpLoad %v4float %x_GLF_color + %104 = OpCompositeConstruct %main_out %103 + %102 = OpFunctionCall %void %tint_symbol_2 %104 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c41106446 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-float-array-init-pow/0-opt.wgsl.expected.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var arr : array; + f = 2.0; + let x_37 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_39 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_41 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_43 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_45 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_47 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_49 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_50 : f32 = f; + let x_52 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_55 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_57 : f32 = x_7.x_GLF_uniform_float_values[0]; + arr = array(x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57); + let x_60 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_62 : f32 = arr[x_60]; + let x_65 : i32 = x_9.x_GLF_uniform_int_values[3]; + if ((i32(x_62) == x_65)) { + let x_71 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_74 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_77 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_80 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_71), f32(x_74), f32(x_77), f32(x_80)); + } else { + let x_84 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_85 : f32 = f32(x_84); + x_GLF_color = vec4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm new file mode 100644 index 0000000000..f50e47e7c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm @@ -0,0 +1,88 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %ret "ret" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %12 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %27 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %10 + %28 = OpLabel + %29 = OpFunctionCall %int %func_ + %30 = OpIEqual %bool %29 %int_2 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + OpStore %_GLF_color %26 + OpBranch %31 + %33 = OpLabel + OpStore %_GLF_color %27 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %int None %12 + %34 = OpLabel + %ret = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %ret %int_0 + OpStore %i %int_3 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %int %i + %40 = OpLoad %int %i + %41 = OpBitwiseAnd %int %40 %int_1 + %42 = OpSGreaterThan %bool %39 %41 + OpBranchConditional %42 %43 %36 + %43 = OpLabel + %44 = OpLoad %int %ret + %45 = OpIAdd %int %44 %int_1 + OpStore %ret %45 + OpBranch %37 + %37 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %47 = OpLoad %int %46 + %48 = OpLoad %int %i + %49 = OpISub %int %48 %47 + OpStore %i %49 + OpBranch %35 + %36 = OpLabel + %50 = OpLoad %int %ret + OpReturnValue %50 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..757f40b3cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.hlsl @@ -0,0 +1,47 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_() { + int ret = 0; + int i = 0; + ret = 0; + i = 3; + while (true) { + if ((i > (i & 1))) { + } else { + break; + } + ret = (ret + 1); + { + const int x_47 = asint(x_8[0].x); + i = (i - x_47); + } + } + return ret; +} + +void main_1() { + const int x_29 = func_(); + if ((x_29 == 2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f57fd220e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_(constant buf0& x_8) { + int ret = 0; + int i = 0; + ret = 0; + i = 3; + while (true) { + int const x_39 = i; + int const x_40 = i; + if ((x_39 > (x_40 & 1))) { + } else { + break; + } + int const x_44 = ret; + ret = (x_44 + 1); + { + int const x_47 = x_8.one; + int const x_48 = i; + i = (x_48 - x_47); + } + } + int const x_50 = ret; + return x_50; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + int const x_29 = func_(x_8); + if ((x_29 == 2)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..6d8b1a203e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 70 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %ret "ret" + OpName %i "i" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %12 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %void = OpTypeVoid + %44 = OpTypeFunction %void + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %56 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %57 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %func_ = OpFunction %int None %12 + %14 = OpLabel + %ret = OpVariable %_ptr_Function_int Function %17 + %i = OpVariable %_ptr_Function_int Function %17 + OpStore %ret %int_0 + OpStore %i %int_3 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %int %i + %26 = OpLoad %int %i + %28 = OpBitwiseAnd %int %26 %int_1 + %29 = OpSGreaterThan %bool %25 %28 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpBranch %22 + %31 = OpLabel + %34 = OpLoad %int %ret + %35 = OpIAdd %int %34 %int_1 + OpStore %ret %35 + OpBranch %23 + %23 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %40 = OpLoad %int %39 + %41 = OpLoad %int %i + %42 = OpISub %int %41 %40 + OpStore %i %42 + OpBranch %21 + %22 = OpLabel + %43 = OpLoad %int %ret + OpReturnValue %43 + OpFunctionEnd + %main_1 = OpFunction %void None %44 + %47 = OpLabel + %48 = OpFunctionCall %int %func_ + %50 = OpIEqual %bool %48 %int_2 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpStore %x_GLF_color %56 + OpBranch %51 + %53 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %58 +%tint_symbol = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %44 + %65 = OpLabel + %66 = OpFunctionCall %void %main_1 + %68 = OpLoad %v4float %x_GLF_color + %69 = OpCompositeConstruct %main_out %68 + %67 = OpFunctionCall %void %tint_symbol_2 %69 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b8c3805b3a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.spvasm.expected.wgsl @@ -0,0 +1,54 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> i32 { + var ret : i32; + var i : i32; + ret = 0; + i = 3; + loop { + let x_39 : i32 = i; + let x_40 : i32 = i; + if ((x_39 > (x_40 & 1))) { + } else { + break; + } + let x_44 : i32 = ret; + ret = (x_44 + 1); + + continuing { + let x_47 : i32 = x_8.one; + let x_48 : i32 = i; + i = (x_48 - x_47); + } + } + let x_50 : i32 = ret; + return x_50; +} + +fn main_1() { + let x_29 : i32 = func_(); + if ((x_29 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl new file mode 100644 index 0000000000..b8c3805b3a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl @@ -0,0 +1,54 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> i32 { + var ret : i32; + var i : i32; + ret = 0; + i = 3; + loop { + let x_39 : i32 = i; + let x_40 : i32 = i; + if ((x_39 > (x_40 & 1))) { + } else { + break; + } + let x_44 : i32 = ret; + ret = (x_44 + 1); + + continuing { + let x_47 : i32 = x_8.one; + let x_48 : i32 = i; + i = (x_48 - x_47); + } + } + let x_50 : i32 = ret; + return x_50; +} + +fn main_1() { + let x_29 : i32 = func_(); + if ((x_29 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..757f40b3cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.hlsl @@ -0,0 +1,47 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_() { + int ret = 0; + int i = 0; + ret = 0; + i = 3; + while (true) { + if ((i > (i & 1))) { + } else { + break; + } + ret = (ret + 1); + { + const int x_47 = asint(x_8[0].x); + i = (i - x_47); + } + } + return ret; +} + +void main_1() { + const int x_29 = func_(); + if ((x_29 == 2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f57fd220e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_(constant buf0& x_8) { + int ret = 0; + int i = 0; + ret = 0; + i = 3; + while (true) { + int const x_39 = i; + int const x_40 = i; + if ((x_39 > (x_40 & 1))) { + } else { + break; + } + int const x_44 = ret; + ret = (x_44 + 1); + { + int const x_47 = x_8.one; + int const x_48 = i; + i = (x_48 - x_47); + } + } + int const x_50 = ret; + return x_50; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + int const x_29 = func_(x_8); + if ((x_29 == 2)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..6d8b1a203e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 70 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %ret "ret" + OpName %i "i" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %12 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %void = OpTypeVoid + %44 = OpTypeFunction %void + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %56 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %57 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %func_ = OpFunction %int None %12 + %14 = OpLabel + %ret = OpVariable %_ptr_Function_int Function %17 + %i = OpVariable %_ptr_Function_int Function %17 + OpStore %ret %int_0 + OpStore %i %int_3 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %int %i + %26 = OpLoad %int %i + %28 = OpBitwiseAnd %int %26 %int_1 + %29 = OpSGreaterThan %bool %25 %28 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpBranch %22 + %31 = OpLabel + %34 = OpLoad %int %ret + %35 = OpIAdd %int %34 %int_1 + OpStore %ret %35 + OpBranch %23 + %23 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %40 = OpLoad %int %39 + %41 = OpLoad %int %i + %42 = OpISub %int %41 %40 + OpStore %i %42 + OpBranch %21 + %22 = OpLabel + %43 = OpLoad %int %ret + OpReturnValue %43 + OpFunctionEnd + %main_1 = OpFunction %void None %44 + %47 = OpLabel + %48 = OpFunctionCall %int %func_ + %50 = OpIEqual %bool %48 %int_2 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpStore %x_GLF_color %56 + OpBranch %51 + %53 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %58 +%tint_symbol = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %44 + %65 = OpLabel + %66 = OpFunctionCall %void %main_1 + %68 = OpLoad %v4float %x_GLF_color + %69 = OpCompositeConstruct %main_out %68 + %67 = OpFunctionCall %void %tint_symbol_2 %69 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b8c3805b3a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-and-in-for-loop-range/0-opt.wgsl.expected.wgsl @@ -0,0 +1,54 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> i32 { + var ret : i32; + var i : i32; + ret = 0; + i = 3; + loop { + let x_39 : i32 = i; + let x_40 : i32 = i; + if ((x_39 > (x_40 & 1))) { + } else { + break; + } + let x_44 : i32 = ret; + ret = (x_44 + 1); + + continuing { + let x_47 : i32 = x_8.one; + let x_48 : i32 = i; + i = (x_48 - x_47); + } + } + let x_50 : i32 = ret; + return x_50; +} + +fn main_1() { + let x_29 : i32 = func_(); + if ((x_29 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm new file mode 100644 index 0000000000..6c35fbe812 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm @@ -0,0 +1,50 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %7 + %20 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %22 = OpLoad %int %21 + %23 = OpBitwiseAnd %int %22 %int_0 + %24 = OpIEqual %bool %23 %int_0 + OpSelectionMerge %25 None + OpBranchConditional %24 %26 %27 + %26 = OpLabel + OpStore %_GLF_color %18 + OpBranch %25 + %27 = OpLabel + OpStore %_GLF_color %19 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..34a3e6f681 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const int x_22 = asint(x_5[0].x); + if (((x_22 & 0) == 0)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.msl new file mode 100644 index 0000000000..fab551b93a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_22 = x_5.one; + if (((x_22 & 0) == 0)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..b79eb2a059 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %30 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %31 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %32 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %20 = OpLoad %int %19 + %22 = OpBitwiseAnd %int %20 %int_0 + %23 = OpIEqual %bool %22 %int_0 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %27 + %26 = OpLabel + OpStore %x_GLF_color %30 + OpBranch %25 + %27 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %32 +%tint_symbol = OpFunctionParameter %main_out + %36 = OpLabel + %37 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %37 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %x_GLF_color + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_2 %43 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..f8191ebf4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_22 : i32 = x_5.one; + if (((x_22 & 0) == 0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl new file mode 100644 index 0000000000..f8191ebf4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_22 : i32 = x_5.one; + if (((x_22 & 0) == 0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..34a3e6f681 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const int x_22 = asint(x_5[0].x); + if (((x_22 & 0) == 0)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.msl new file mode 100644 index 0000000000..fab551b93a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_22 = x_5.one; + if (((x_22 & 0) == 0)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..b79eb2a059 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %30 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %31 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %32 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %20 = OpLoad %int %19 + %22 = OpBitwiseAnd %int %20 %int_0 + %23 = OpIEqual %bool %22 %int_0 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %27 + %26 = OpLabel + OpStore %x_GLF_color %30 + OpBranch %25 + %27 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %32 +%tint_symbol = OpFunctionParameter %main_out + %36 = OpLabel + %37 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %37 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %x_GLF_color + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_2 %43 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..f8191ebf4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-and-zero/0.wgsl.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_22 : i32 = x_5.one; + if (((x_22 & 0) == 0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm new file mode 100644 index 0000000000..819e53a377 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm @@ -0,0 +1,51 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_n1 = OpConstant %int -1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %20 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %7 + %21 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %23 = OpLoad %int %22 + %24 = OpBitwiseOr %int %int_n1 %23 + %25 = OpIEqual %bool %24 %int_n1 + OpSelectionMerge %26 None + OpBranchConditional %25 %27 %28 + %27 = OpLabel + OpStore %_GLF_color %19 + OpBranch %26 + %28 = OpLabel + OpStore %_GLF_color %20 + OpBranch %26 + %26 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..9c6888077a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const int x_23 = asint(x_5[0].x); + if (((-1 | x_23) == -1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.msl new file mode 100644 index 0000000000..7b5a9e15e7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_23 = x_5.one; + if (((-1 | x_23) == -1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..5edb687468 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_n1 = OpConstant %int -1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %30 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %31 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %32 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %20 = OpLoad %int %19 + %22 = OpBitwiseOr %int %int_n1 %20 + %23 = OpIEqual %bool %22 %int_n1 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %27 + %26 = OpLabel + OpStore %x_GLF_color %30 + OpBranch %25 + %27 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %32 +%tint_symbol = OpFunctionParameter %main_out + %36 = OpLabel + %37 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %37 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %x_GLF_color + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_2 %43 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..6af6f72689 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_23 : i32 = x_5.one; + if (((-1 | x_23) == -1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl new file mode 100644 index 0000000000..6af6f72689 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_23 : i32 = x_5.one; + if (((-1 | x_23) == -1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..9c6888077a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const int x_23 = asint(x_5[0].x); + if (((-1 | x_23) == -1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.msl new file mode 100644 index 0000000000..7b5a9e15e7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_23 = x_5.one; + if (((-1 | x_23) == -1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..5edb687468 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_n1 = OpConstant %int -1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %30 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %31 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %32 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %20 = OpLoad %int %19 + %22 = OpBitwiseOr %int %int_n1 %20 + %23 = OpIEqual %bool %22 %int_n1 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %27 + %26 = OpLabel + OpStore %x_GLF_color %30 + OpBranch %25 + %27 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %32 +%tint_symbol = OpFunctionParameter %main_out + %36 = OpLabel + %37 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %37 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %x_GLF_color + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_2 %43 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..6af6f72689 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-or-full-mask/0.wgsl.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_23 : i32 = x_5.one; + if (((-1 | x_23) == -1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm new file mode 100644 index 0000000000..3c509913f8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm @@ -0,0 +1,53 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %b "b" + OpName %_GLF_color "_GLF_color" + OpDecorate %a RelaxedPrecision + OpDecorate %b RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_6 = OpConstant %int 6 + %int_5 = OpConstant %int 5 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %10 + %24 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + OpStore %a %int_6 + OpStore %b %int_5 + %6 = OpLoad %int %a + %7 = OpLoad %int %b + %8 = OpBitwiseXor %int %6 %7 + %25 = OpINotEqual %bool %8 %int_3 + OpSelectionMerge %26 None + OpBranchConditional %25 %27 %28 + %27 = OpLabel + OpStore %_GLF_color %21 + OpBranch %26 + %28 = OpLabel + OpStore %_GLF_color %23 + OpBranch %26 + %26 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f27c44b0b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int b = 0; + a = 6; + b = 5; + if (((a ^ b) != 3)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..5084cf3033 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int a = 0; + int b = 0; + a = 6; + b = 5; + int const x_6 = a; + int const x_7 = b; + if (((x_6 ^ x_7) != 3)) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..06710480fc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_6 = OpConstant %int 6 + %int_5 = OpConstant %int 5 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %32 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %a = OpVariable %_ptr_Function_int Function %15 + %b = OpVariable %_ptr_Function_int Function %15 + OpStore %a %int_6 + OpStore %b %int_5 + %19 = OpLoad %int %a + %20 = OpLoad %int %b + %21 = OpBitwiseXor %int %19 %20 + %23 = OpINotEqual %bool %21 %int_3 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %27 + %26 = OpLabel + OpStore %x_GLF_color %29 + OpBranch %25 + %27 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %32 +%tint_symbol = OpFunctionParameter %main_out + %36 = OpLabel + %37 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %37 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %39 = OpLabel + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %x_GLF_color + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_2 %43 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a475384cd6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.spvasm.expected.wgsl @@ -0,0 +1,27 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + a = 6; + b = 5; + let x_6 : i32 = a; + let x_7 : i32 = b; + if (((x_6 ^ x_7) != 3)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl new file mode 100644 index 0000000000..a475384cd6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl @@ -0,0 +1,27 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + a = 6; + b = 5; + let x_6 : i32 = a; + let x_7 : i32 = b; + if (((x_6 ^ x_7) != 3)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f27c44b0b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int b = 0; + a = 6; + b = 5; + if (((a ^ b) != 3)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..5084cf3033 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int a = 0; + int b = 0; + a = 6; + b = 5; + int const x_6 = a; + int const x_7 = b; + if (((x_6 ^ x_7) != 3)) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..06710480fc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_6 = OpConstant %int 6 + %int_5 = OpConstant %int 5 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %32 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %a = OpVariable %_ptr_Function_int Function %15 + %b = OpVariable %_ptr_Function_int Function %15 + OpStore %a %int_6 + OpStore %b %int_5 + %19 = OpLoad %int %a + %20 = OpLoad %int %b + %21 = OpBitwiseXor %int %19 %20 + %23 = OpINotEqual %bool %21 %int_3 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %27 + %26 = OpLabel + OpStore %x_GLF_color %29 + OpBranch %25 + %27 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %32 +%tint_symbol = OpFunctionParameter %main_out + %36 = OpLabel + %37 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %37 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %39 = OpLabel + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %x_GLF_color + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_2 %43 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a475384cd6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-bitwise-xor/0-opt.wgsl.expected.wgsl @@ -0,0 +1,27 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + a = 6; + b = 5; + let x_6 : i32 = a; + let x_7 : i32 = b; + if (((x_6 ^ x_7) != 3)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm new file mode 100644 index 0000000000..e20018327a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm @@ -0,0 +1,41 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %15 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %6 + %18 = OpLabel + %a = OpVariable %_ptr_Function_bool Function + OpStore %a %false + %19 = OpLoad %bool %a + %20 = OpLogicalAnd %bool %true %19 + OpSelectionMerge %21 None + OpBranchConditional %20 %22 %23 + %22 = OpLabel + OpStore %_GLF_color %15 + OpBranch %21 + %23 = OpLabel + OpStore %_GLF_color %17 + OpBranch %21 + %21 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..205d238134 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.hlsl @@ -0,0 +1,30 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool a = false; + a = false; + bool tint_tmp = true; + if (tint_tmp) { + tint_tmp = a; + } + if ((tint_tmp)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.msl new file mode 100644 index 0000000000..c5fe7c9ee7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool a = false; + a = false; + bool const x_19 = a; + if ((true && x_19)) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..ae7b276500 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %15 = OpConstantNull %bool + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %28 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %29 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %a = OpVariable %_ptr_Function_bool Function %15 + OpStore %a %false + %17 = OpLoad %bool %a + OpSelectionMerge %19 None + OpBranchConditional %true %20 %19 + %20 = OpLabel + OpBranch %19 + %19 = OpLabel + %21 = OpPhi %bool %true %11 %17 %20 + OpSelectionMerge %22 None + OpBranchConditional %21 %23 %24 + %23 = OpLabel + OpStore %x_GLF_color %26 + OpBranch %22 + %24 = OpLabel + OpStore %x_GLF_color %28 + OpBranch %22 + %22 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %29 +%tint_symbol = OpFunctionParameter %main_out + %33 = OpLabel + %34 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %34 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %36 = OpLabel + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %x_GLF_color + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_2 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..3d020482f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : bool; + a = false; + let x_19 : bool = a; + if ((true && x_19)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl new file mode 100644 index 0000000000..3d020482f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : bool; + a = false; + let x_19 : bool = a; + if ((true && x_19)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..205d238134 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.hlsl @@ -0,0 +1,30 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool a = false; + a = false; + bool tint_tmp = true; + if (tint_tmp) { + tint_tmp = a; + } + if ((tint_tmp)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.msl new file mode 100644 index 0000000000..c5fe7c9ee7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool a = false; + a = false; + bool const x_19 = a; + if ((true && x_19)) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..ae7b276500 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %15 = OpConstantNull %bool + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %28 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %29 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %a = OpVariable %_ptr_Function_bool Function %15 + OpStore %a %false + %17 = OpLoad %bool %a + OpSelectionMerge %19 None + OpBranchConditional %true %20 %19 + %20 = OpLabel + OpBranch %19 + %19 = OpLabel + %21 = OpPhi %bool %true %11 %17 %20 + OpSelectionMerge %22 None + OpBranchConditional %21 %23 %24 + %23 = OpLabel + OpStore %x_GLF_color %26 + OpBranch %22 + %24 = OpLabel + OpStore %x_GLF_color %28 + OpBranch %22 + %22 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %29 +%tint_symbol = OpFunctionParameter %main_out + %33 = OpLabel + %34 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %34 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %36 = OpLabel + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %x_GLF_color + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_2 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d020482f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-const-variable/0.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : bool; + a = false; + let x_19 : bool = a; + if ((true && x_19)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm new file mode 100644 index 0000000000..757b7ac30a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm @@ -0,0 +1,71 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %i RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %8 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %int_3 = OpConstant %int 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %10 + %29 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_2 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %6 = OpLoad %int %i + %7 = OpIAdd %int %6 %int_1 + OpStore %i %7 + OpBranch %32 + %32 = OpLabel + %34 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %35 = OpLoad %float %34 + %36 = OpFOrdGreaterThanEqual %bool %35 %float_0 + %37 = OpLogicalAnd %bool %36 %false + OpBranchConditional %37 %30 %31 + %31 = OpLabel + %8 = OpLoad %int %i + %38 = OpIEqual %bool %8 %int_3 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpStore %_GLF_color %27 + OpBranch %39 + %41 = OpLabel + OpStore %_GLF_color %28 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..52e6a55491 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.hlsl @@ -0,0 +1,46 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + i = 2; + while (true) { + i = (i + 1); + { + const float x_35 = gl_FragCoord.x; + bool tint_tmp = (x_35 >= 0.0f); + if (tint_tmp) { + tint_tmp = false; + } + if ((tint_tmp)) { + } else { + break; + } + } + } + if ((i == 3)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a3fb456737 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + i = 2; + while (true) { + int const x_6 = i; + i = (x_6 + 1); + { + float const x_35 = (*(tint_symbol_5)).x; + if (((x_35 >= 0.0f) && false)) { + } else { + break; + } + } + } + int const x_8 = i; + if ((x_8 == 3)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..5285dcf6a0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.spvasm @@ -0,0 +1,119 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %49 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %50 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %51 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %i = OpVariable %_ptr_Function_int Function %18 + OpStore %i %int_2 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %int %i + %26 = OpIAdd %int %24 %int_1 + OpStore %i %26 + OpBranch %22 + %22 = OpLabel + %30 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %31 = OpLoad %float %30 + %33 = OpFOrdGreaterThanEqual %bool %31 %float_0 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + OpBranch %35 + %35 = OpLabel + %38 = OpPhi %bool %33 %22 %false %36 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %21 + %39 = OpLabel + OpBranch %20 + %21 = OpLabel + %42 = OpLoad %int %i + %44 = OpIEqual %bool %42 %int_3 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + OpStore %x_GLF_color %49 + OpBranch %45 + %47 = OpLabel + OpStore %x_GLF_color %50 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %51 +%tint_symbol_1 = OpFunctionParameter %main_out + %55 = OpLabel + %56 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %56 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %58 = OpLabel + %59 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %59 + %60 = OpFunctionCall %void %main_1 + %62 = OpLoad %v4float %x_GLF_color + %63 = OpCompositeConstruct %main_out %62 + %61 = OpFunctionCall %void %tint_symbol_3 %63 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 22[%22] is not post dominated by the back-edge block 39[%39] + %39 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..4fa99014f0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + i = 2; + loop { + let x_6 : i32 = i; + i = (x_6 + 1); + + continuing { + let x_35 : f32 = gl_FragCoord.x; + if (((x_35 >= 0.0) && false)) { + } else { + break; + } + } + } + let x_8 : i32 = i; + if ((x_8 == 3)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl new file mode 100644 index 0000000000..4fa99014f0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl @@ -0,0 +1,39 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + i = 2; + loop { + let x_6 : i32 = i; + i = (x_6 + 1); + + continuing { + let x_35 : f32 = gl_FragCoord.x; + if (((x_35 >= 0.0) && false)) { + } else { + break; + } + } + } + let x_8 : i32 = i; + if ((x_8 == 3)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..52e6a55491 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + i = 2; + while (true) { + i = (i + 1); + { + const float x_35 = gl_FragCoord.x; + bool tint_tmp = (x_35 >= 0.0f); + if (tint_tmp) { + tint_tmp = false; + } + if ((tint_tmp)) { + } else { + break; + } + } + } + if ((i == 3)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a3fb456737 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + i = 2; + while (true) { + int const x_6 = i; + i = (x_6 + 1); + { + float const x_35 = (*(tint_symbol_5)).x; + if (((x_35 >= 0.0f) && false)) { + } else { + break; + } + } + } + int const x_8 = i; + if ((x_8 == 3)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5285dcf6a0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.spvasm @@ -0,0 +1,119 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %49 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %50 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %51 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %i = OpVariable %_ptr_Function_int Function %18 + OpStore %i %int_2 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %int %i + %26 = OpIAdd %int %24 %int_1 + OpStore %i %26 + OpBranch %22 + %22 = OpLabel + %30 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %31 = OpLoad %float %30 + %33 = OpFOrdGreaterThanEqual %bool %31 %float_0 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + OpBranch %35 + %35 = OpLabel + %38 = OpPhi %bool %33 %22 %false %36 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %21 + %39 = OpLabel + OpBranch %20 + %21 = OpLabel + %42 = OpLoad %int %i + %44 = OpIEqual %bool %42 %int_3 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + OpStore %x_GLF_color %49 + OpBranch %45 + %47 = OpLabel + OpStore %x_GLF_color %50 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %51 +%tint_symbol_1 = OpFunctionParameter %main_out + %55 = OpLabel + %56 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %56 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %58 = OpLabel + %59 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %59 + %60 = OpFunctionCall %void %main_1 + %62 = OpLoad %v4float %x_GLF_color + %63 = OpCompositeConstruct %main_out %62 + %61 = OpFunctionCall %void %tint_symbol_3 %63 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 22[%22] is not post dominated by the back-edge block 39[%39] + %39 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..4fa99014f0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-and-constant/0-opt.wgsl.expected.wgsl @@ -0,0 +1,39 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + i = 2; + loop { + let x_6 : i32 = i; + i = (x_6 + 1); + + continuing { + let x_35 : f32 = gl_FragCoord.x; + if (((x_35 >= 0.0) && false)) { + } else { + break; + } + } + } + let x_8 : i32 = i; + if ((x_8 == 3)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm new file mode 100644 index 0000000000..1155feca31 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm @@ -0,0 +1,45 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %6 + %20 = OpLabel + %21 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %22 = OpLoad %float %21 + %23 = OpFOrdLessThan %bool %22 %float_0 + %24 = OpLogicalOr %bool %23 %true + OpSelectionMerge %25 None + OpBranchConditional %24 %26 %27 + %26 = OpLabel + OpStore %_GLF_color %18 + OpBranch %25 + %27 = OpLabel + OpStore %_GLF_color %19 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..e1f6bdda11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.hlsl @@ -0,0 +1,35 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_22 = gl_FragCoord.x; + bool tint_tmp = (x_22 < 0.0f); + if (!tint_tmp) { + tint_tmp = true; + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.msl new file mode 100644 index 0000000000..c32c624fcc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_22 = (*(tint_symbol_5)).x; + if (((x_22 < 0.0f) || true)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..53bc076c77 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %32 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %33 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %19 = OpLoad %float %18 + %21 = OpFOrdLessThan %bool %19 %float_0 + OpSelectionMerge %23 None + OpBranchConditional %21 %23 %24 + %24 = OpLabel + OpBranch %23 + %23 = OpLabel + %26 = OpPhi %bool %21 %14 %true %24 + OpSelectionMerge %27 None + OpBranchConditional %26 %28 %29 + %28 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %27 + %29 = OpLabel + OpStore %x_GLF_color %32 + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %33 +%tint_symbol_1 = OpFunctionParameter %main_out + %37 = OpLabel + %38 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %38 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %40 = OpLabel + %41 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %41 + %42 = OpFunctionCall %void %main_1 + %44 = OpLoad %v4float %x_GLF_color + %45 = OpCompositeConstruct %main_out %44 + %43 = OpFunctionCall %void %tint_symbol_3 %45 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..56678abe49 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + let x_22 : f32 = gl_FragCoord.x; + if (((x_22 < 0.0) || true)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl new file mode 100644 index 0000000000..56678abe49 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl @@ -0,0 +1,25 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + let x_22 : f32 = gl_FragCoord.x; + if (((x_22 < 0.0) || true)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..e1f6bdda11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_22 = gl_FragCoord.x; + bool tint_tmp = (x_22 < 0.0f); + if (!tint_tmp) { + tint_tmp = true; + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.msl new file mode 100644 index 0000000000..c32c624fcc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_22 = (*(tint_symbol_5)).x; + if (((x_22 < 0.0f) || true)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..53bc076c77 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.spvasm @@ -0,0 +1,84 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %32 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %33 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %19 = OpLoad %float %18 + %21 = OpFOrdLessThan %bool %19 %float_0 + OpSelectionMerge %23 None + OpBranchConditional %21 %23 %24 + %24 = OpLabel + OpBranch %23 + %23 = OpLabel + %26 = OpPhi %bool %21 %14 %true %24 + OpSelectionMerge %27 None + OpBranchConditional %26 %28 %29 + %28 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %27 + %29 = OpLabel + OpStore %x_GLF_color %32 + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %33 +%tint_symbol_1 = OpFunctionParameter %main_out + %37 = OpLabel + %38 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %38 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %40 = OpLabel + %41 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %41 + %42 = OpFunctionCall %void %main_1 + %44 = OpLoad %v4float %x_GLF_color + %45 = OpCompositeConstruct %main_out %44 + %43 = OpFunctionCall %void %tint_symbol_3 %45 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..56678abe49 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-logical-or-constant/0.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + let x_22 : f32 = gl_FragCoord.x; + if (((x_22 < 0.0) || true)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm new file mode 100644 index 0000000000..9ddf7dc654 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm @@ -0,0 +1,62 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %minValue "minValue" + OpName %negMinValue "negMinValue" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "minusOne" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_n2147483648 = OpConstant %int -2147483648 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %23 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %24 = OpLabel + %minValue = OpVariable %_ptr_Function_int Function +%negMinValue = OpVariable %_ptr_Function_int Function + OpStore %minValue %int_n2147483648 + %25 = OpLoad %int %minValue + %26 = OpSNegate %int %25 + OpStore %negMinValue %26 + %27 = OpLoad %int %negMinValue + %28 = OpLoad %int %minValue + %29 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %30 = OpLoad %int %29 + %31 = OpIMul %int %28 %30 + %32 = OpIEqual %bool %27 %31 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + OpStore %_GLF_color %22 + OpBranch %33 + %35 = OpLabel + OpStore %_GLF_color %23 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9fa0010d4d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.hlsl @@ -0,0 +1,34 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int minValue = 0; + int negMinValue = 0; + minValue = -2147483648; + negMinValue = -(minValue); + const int x_27 = negMinValue; + const int x_28 = minValue; + const int x_30 = asint(x_7[0].x); + if ((x_27 == (x_28 * x_30))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..bc8e92f6d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int minusOne; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int minValue = 0; + int negMinValue = 0; + minValue = -2147483648; + int const x_25 = minValue; + negMinValue = -(x_25); + int const x_27 = negMinValue; + int const x_28 = minValue; + int const x_30 = x_7.minusOne; + if ((x_27 == (x_28 * x_30))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..3ae71bd12c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "minusOne" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %minValue "minValue" + OpName %negMinValue "negMinValue" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int +%int_n2147483648 = OpConstant %int -2147483648 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %40 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %minValue = OpVariable %_ptr_Function_int Function %18 +%negMinValue = OpVariable %_ptr_Function_int Function %18 + OpStore %minValue %int_n2147483648 + %21 = OpLoad %int %minValue + %22 = OpSNegate %int %21 + OpStore %negMinValue %22 + %23 = OpLoad %int %negMinValue + %24 = OpLoad %int %minValue + %28 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %29 = OpLoad %int %28 + %30 = OpIMul %int %24 %29 + %31 = OpIEqual %bool %23 %30 + OpSelectionMerge %33 None + OpBranchConditional %31 %34 %35 + %34 = OpLabel + OpStore %x_GLF_color %38 + OpBranch %33 + %35 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %40 +%tint_symbol = OpFunctionParameter %main_out + %44 = OpLabel + %45 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %45 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %47 = OpLabel + %48 = OpFunctionCall %void %main_1 + %50 = OpLoad %v4float %x_GLF_color + %51 = OpCompositeConstruct %main_out %50 + %49 = OpFunctionCall %void %tint_symbol_2 %51 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ae8dd8b9d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +[[block]] +struct buf0 { + minusOne : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var minValue : i32; + var negMinValue : i32; + minValue = -2147483648; + let x_25 : i32 = minValue; + negMinValue = -(x_25); + let x_27 : i32 = negMinValue; + let x_28 : i32 = minValue; + let x_30 : i32 = x_7.minusOne; + if ((x_27 == (x_28 * x_30))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl new file mode 100644 index 0000000000..ae8dd8b9d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl @@ -0,0 +1,36 @@ +[[block]] +struct buf0 { + minusOne : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var minValue : i32; + var negMinValue : i32; + minValue = -2147483648; + let x_25 : i32 = minValue; + negMinValue = -(x_25); + let x_27 : i32 = negMinValue; + let x_28 : i32 = minValue; + let x_30 : i32 = x_7.minusOne; + if ((x_27 == (x_28 * x_30))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9fa0010d4d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int minValue = 0; + int negMinValue = 0; + minValue = -2147483648; + negMinValue = -(minValue); + const int x_27 = negMinValue; + const int x_28 = minValue; + const int x_30 = asint(x_7[0].x); + if ((x_27 == (x_28 * x_30))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..bc8e92f6d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int minusOne; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int minValue = 0; + int negMinValue = 0; + minValue = -2147483648; + int const x_25 = minValue; + negMinValue = -(x_25); + int const x_27 = negMinValue; + int const x_28 = minValue; + int const x_30 = x_7.minusOne; + if ((x_27 == (x_28 * x_30))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..3ae71bd12c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "minusOne" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %minValue "minValue" + OpName %negMinValue "negMinValue" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int +%int_n2147483648 = OpConstant %int -2147483648 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %40 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %minValue = OpVariable %_ptr_Function_int Function %18 +%negMinValue = OpVariable %_ptr_Function_int Function %18 + OpStore %minValue %int_n2147483648 + %21 = OpLoad %int %minValue + %22 = OpSNegate %int %21 + OpStore %negMinValue %22 + %23 = OpLoad %int %negMinValue + %24 = OpLoad %int %minValue + %28 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %29 = OpLoad %int %28 + %30 = OpIMul %int %24 %29 + %31 = OpIEqual %bool %23 %30 + OpSelectionMerge %33 None + OpBranchConditional %31 %34 %35 + %34 = OpLabel + OpStore %x_GLF_color %38 + OpBranch %33 + %35 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %40 +%tint_symbol = OpFunctionParameter %main_out + %44 = OpLabel + %45 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %45 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %47 = OpLabel + %48 = OpFunctionCall %void %main_1 + %50 = OpLoad %v4float %x_GLF_color + %51 = OpCompositeConstruct %main_out %50 + %49 = OpFunctionCall %void %tint_symbol_2 %51 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ae8dd8b9d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-min-int-value/0-opt.wgsl.expected.wgsl @@ -0,0 +1,36 @@ +[[block]] +struct buf0 { + minusOne : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var minValue : i32; + var negMinValue : i32; + minValue = -2147483648; + let x_25 : i32 = minValue; + negMinValue = -(x_25); + let x_27 : i32 = negMinValue; + let x_28 : i32 = minValue; + let x_30 : i32 = x_7.minusOne; + if ((x_27 == (x_28 * x_30))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm new file mode 100644 index 0000000000..6b8e95c9d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %i RelaxedPrecision + OpDecorate %5 RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_3 = OpConstant %int 3 + %int_n4 = OpConstant %int -4 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %20 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %21 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_3 + %5 = OpLoad %int %i + %6 = OpNot %int %5 + %22 = OpIEqual %bool %6 %int_n4 + OpSelectionMerge %23 None + OpBranchConditional %22 %24 %25 + %24 = OpLabel + OpStore %_GLF_color %19 + OpBranch %23 + %25 = OpLabel + OpStore %_GLF_color %20 + OpBranch %23 + %23 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..200bb961a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.hlsl @@ -0,0 +1,26 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + i = 3; + if ((~(i) == -4)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.msl new file mode 100644 index 0000000000..cff2cd3a77 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int i = 0; + i = 3; + int const x_5 = i; + if ((~(x_5) == -4)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..358ea77e91 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_3 = OpConstant %int 3 + %int_n4 = OpConstant %int -4 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %29 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %i = OpVariable %_ptr_Function_int Function %15 + OpStore %i %int_3 + %17 = OpLoad %int %i + %18 = OpNot %int %17 + %20 = OpIEqual %bool %18 %int_n4 + OpSelectionMerge %22 None + OpBranchConditional %20 %23 %24 + %23 = OpLabel + OpStore %x_GLF_color %27 + OpBranch %22 + %24 = OpLabel + OpStore %x_GLF_color %28 + OpBranch %22 + %22 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %29 +%tint_symbol = OpFunctionParameter %main_out + %33 = OpLabel + %34 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %34 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %36 = OpLabel + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %x_GLF_color + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_2 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..ec3893d3b2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + i = 3; + let x_5 : i32 = i; + if ((~(x_5) == -4)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl new file mode 100644 index 0000000000..ec3893d3b2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + i = 3; + let x_5 : i32 = i; + if ((~(x_5) == -4)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..200bb961a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + i = 3; + if ((~(i) == -4)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.msl new file mode 100644 index 0000000000..cff2cd3a77 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int i = 0; + i = 3; + int const x_5 = i; + if ((~(x_5) == -4)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..358ea77e91 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_3 = OpConstant %int 3 + %int_n4 = OpConstant %int -4 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %29 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %i = OpVariable %_ptr_Function_int Function %15 + OpStore %i %int_3 + %17 = OpLoad %int %i + %18 = OpNot %int %17 + %20 = OpIEqual %bool %18 %int_n4 + OpSelectionMerge %22 None + OpBranchConditional %20 %23 %24 + %23 = OpLabel + OpStore %x_GLF_color %27 + OpBranch %22 + %24 = OpLabel + OpStore %x_GLF_color %28 + OpBranch %22 + %22 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %29 +%tint_symbol = OpFunctionParameter %main_out + %33 = OpLabel + %34 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %34 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %36 = OpLabel + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %x_GLF_color + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_2 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..ec3893d3b2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-negate-variable/0.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + i = 3; + let x_5 : i32 = i; + if ((~(x_5) == -4)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm new file mode 100644 index 0000000000..e4241f1756 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm @@ -0,0 +1,166 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %b "b" + OpName %c "c" + OpName %d "d" + OpName %e "e" + OpName %f "f" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_77 = OpConstant %uint 77 + %buf0 = OpTypeStruct %uint +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_32 = OpConstant %uint 32 + %uint_3243 = OpConstant %uint 3243 + %uint_33 = OpConstant %uint 33 + %uint_23 = OpConstant %uint 23 + %uint_345 = OpConstant %uint 345 + %uint_2395 = OpConstant %uint 2395 +%uint_290485 = OpConstant %uint 290485 + %uint_44321 = OpConstant %uint 44321 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %37 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %38 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %13 + %39 = OpLabel + %a = OpVariable %_ptr_Function_uint Function + %b = OpVariable %_ptr_Function_uint Function + %c = OpVariable %_ptr_Function_uint Function + %d = OpVariable %_ptr_Function_uint Function + %e = OpVariable %_ptr_Function_uint Function + %f = OpVariable %_ptr_Function_uint Function + %40 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %41 = OpLoad %uint %40 + %42 = OpIAdd %uint %uint_77 %41 + %43 = OpShiftRightLogical %uint %42 %uint_32 + OpStore %a %43 + %44 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %45 = OpLoad %uint %44 + %46 = OpIAdd %uint %uint_3243 %45 + %47 = OpShiftRightLogical %uint %46 %uint_33 + OpStore %b %47 + %48 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %49 = OpLoad %uint %48 + %50 = OpIAdd %uint %uint_23 %49 + %51 = OpShiftRightLogical %uint %50 %uint_345 + OpStore %c %51 + %52 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %53 = OpLoad %uint %52 + %54 = OpIAdd %uint %uint_2395 %53 + %55 = OpShiftLeftLogical %uint %54 %uint_32 + OpStore %d %55 + %56 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %57 = OpLoad %uint %56 + %58 = OpIAdd %uint %uint_290485 %57 + %59 = OpShiftLeftLogical %uint %58 %uint_33 + OpStore %e %59 + %60 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %61 = OpLoad %uint %60 + %62 = OpIAdd %uint %uint_44321 %61 + %63 = OpShiftLeftLogical %uint %62 %uint_345 + OpStore %f %63 + %64 = OpLoad %uint %a + %65 = OpINotEqual %bool %64 %uint_1 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %66 + %67 = OpLabel + OpStore %a %uint_1 + OpBranch %66 + %66 = OpLabel + %68 = OpLoad %uint %b + %69 = OpINotEqual %bool %68 %uint_0 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + OpStore %b %uint_0 + OpBranch %70 + %70 = OpLabel + %72 = OpLoad %uint %c + %73 = OpINotEqual %bool %72 %uint_1 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %74 + %75 = OpLabel + OpStore %c %uint_1 + OpBranch %74 + %74 = OpLabel + %76 = OpLoad %uint %d + %77 = OpINotEqual %bool %76 %uint_0 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %78 + %79 = OpLabel + OpStore %d %uint_0 + OpBranch %78 + %78 = OpLabel + %80 = OpLoad %uint %e + %81 = OpINotEqual %bool %80 %uint_1 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %82 + %83 = OpLabel + OpStore %e %uint_1 + OpBranch %82 + %82 = OpLabel + %84 = OpLoad %uint %f + %85 = OpINotEqual %bool %84 %uint_0 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + OpStore %f %uint_0 + OpBranch %86 + %86 = OpLabel + %88 = OpLoad %uint %a + %89 = OpIEqual %bool %88 %uint_1 + %90 = OpLoad %uint %b + %91 = OpIEqual %bool %90 %uint_0 + %92 = OpLogicalAnd %bool %89 %91 + %93 = OpLoad %uint %c + %94 = OpIEqual %bool %93 %uint_1 + %95 = OpLogicalAnd %bool %92 %94 + %96 = OpLoad %uint %d + %97 = OpIEqual %bool %96 %uint_0 + %98 = OpLogicalAnd %bool %95 %97 + %99 = OpLoad %uint %e + %100 = OpIEqual %bool %99 %uint_1 + %101 = OpLogicalAnd %bool %98 %100 + %102 = OpLoad %uint %f + %103 = OpIEqual %bool %102 %uint_0 + %104 = OpLogicalAnd %bool %101 %103 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %107 + %106 = OpLabel + OpStore %_GLF_color %37 + OpBranch %105 + %107 = OpLabel + OpStore %_GLF_color %38 + OpBranch %105 + %105 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..44f7ed6f08 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.hlsl @@ -0,0 +1,83 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + uint b = 0u; + uint c = 0u; + uint d = 0u; + uint e = 0u; + uint f = 0u; + const uint x_41 = x_6[0].x; + a = ((77u + x_41) >> 32u); + const uint x_45 = x_6[0].x; + b = ((3243u + x_45) >> 33u); + const uint x_49 = x_6[0].x; + c = ((23u + x_49) >> 345u); + const uint x_53 = x_6[0].x; + d = ((2395u + x_53) << 32u); + const uint x_57 = x_6[0].x; + e = ((290485u + x_57) << 33u); + const uint x_61 = x_6[0].x; + f = ((44321u + x_61) << 345u); + if ((a != 1u)) { + a = 1u; + } + if ((b != 0u)) { + b = 0u; + } + if ((c != 1u)) { + c = 1u; + } + if ((d != 0u)) { + d = 0u; + } + if ((e != 1u)) { + e = 1u; + } + if ((f != 0u)) { + f = 0u; + } + bool tint_tmp_4 = (a == 1u); + if (tint_tmp_4) { + tint_tmp_4 = (b == 0u); + } + bool tint_tmp_3 = (tint_tmp_4); + if (tint_tmp_3) { + tint_tmp_3 = (c == 1u); + } + bool tint_tmp_2 = (tint_tmp_3); + if (tint_tmp_2) { + tint_tmp_2 = (d == 0u); + } + bool tint_tmp_1 = (tint_tmp_2); + if (tint_tmp_1) { + tint_tmp_1 = (e == 1u); + } + bool tint_tmp = (tint_tmp_1); + if (tint_tmp) { + tint_tmp = (f == 0u); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.msl new file mode 100644 index 0000000000..5d8fa5422b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.msl @@ -0,0 +1,78 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ uint one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + uint a = 0u; + uint b = 0u; + uint c = 0u; + uint d = 0u; + uint e = 0u; + uint f = 0u; + uint const x_41 = x_6.one; + a = ((77u + x_41) >> 32u); + uint const x_45 = x_6.one; + b = ((3243u + x_45) >> 33u); + uint const x_49 = x_6.one; + c = ((23u + x_49) >> 345u); + uint const x_53 = x_6.one; + d = ((2395u + x_53) << 32u); + uint const x_57 = x_6.one; + e = ((290485u + x_57) << 33u); + uint const x_61 = x_6.one; + f = ((44321u + x_61) << 345u); + uint const x_64 = a; + if ((x_64 != 1u)) { + a = 1u; + } + uint const x_68 = b; + if ((x_68 != 0u)) { + b = 0u; + } + uint const x_72 = c; + if ((x_72 != 1u)) { + c = 1u; + } + uint const x_76 = d; + if ((x_76 != 0u)) { + d = 0u; + } + uint const x_80 = e; + if ((x_80 != 1u)) { + e = 1u; + } + uint const x_84 = f; + if ((x_84 != 0u)) { + f = 0u; + } + uint const x_88 = a; + uint const x_90 = b; + uint const x_93 = c; + uint const x_96 = d; + uint const x_99 = e; + uint const x_102 = f; + if (((((((x_88 == 1u) && (x_90 == 0u)) && (x_93 == 1u)) && (x_96 == 0u)) && (x_99 == 1u)) && (x_102 == 0u))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..8468b8060f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.spvasm @@ -0,0 +1,221 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 131 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %d "d" + OpName %e "e" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %uint = OpTypeInt 32 0 + %buf0 = OpTypeStruct %uint +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_77 = OpConstant %uint 77 + %uint_32 = OpConstant %uint 32 + %uint_3243 = OpConstant %uint 3243 + %uint_33 = OpConstant %uint 33 + %uint_23 = OpConstant %uint 23 + %uint_345 = OpConstant %uint 345 + %uint_2395 = OpConstant %uint 2395 +%uint_290485 = OpConstant %uint 290485 + %uint_44321 = OpConstant %uint 44321 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %117 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %118 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %119 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %18 + %b = OpVariable %_ptr_Function_uint Function %18 + %c = OpVariable %_ptr_Function_uint Function %18 + %d = OpVariable %_ptr_Function_uint Function %18 + %e = OpVariable %_ptr_Function_uint Function %18 + %f = OpVariable %_ptr_Function_uint Function %18 + %26 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %27 = OpLoad %uint %26 + %29 = OpIAdd %uint %uint_77 %27 + %31 = OpShiftRightLogical %uint %29 %uint_32 + OpStore %a %31 + %32 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %33 = OpLoad %uint %32 + %35 = OpIAdd %uint %uint_3243 %33 + %37 = OpShiftRightLogical %uint %35 %uint_33 + OpStore %b %37 + %38 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %39 = OpLoad %uint %38 + %41 = OpIAdd %uint %uint_23 %39 + %43 = OpShiftRightLogical %uint %41 %uint_345 + OpStore %c %43 + %44 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %45 = OpLoad %uint %44 + %47 = OpIAdd %uint %uint_2395 %45 + %48 = OpShiftLeftLogical %uint %47 %uint_32 + OpStore %d %48 + %49 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %50 = OpLoad %uint %49 + %52 = OpIAdd %uint %uint_290485 %50 + %53 = OpShiftLeftLogical %uint %52 %uint_33 + OpStore %e %53 + %54 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %55 = OpLoad %uint %54 + %57 = OpIAdd %uint %uint_44321 %55 + %58 = OpShiftLeftLogical %uint %57 %uint_345 + OpStore %f %58 + %59 = OpLoad %uint %a + %61 = OpINotEqual %bool %59 %uint_1 + OpSelectionMerge %63 None + OpBranchConditional %61 %64 %63 + %64 = OpLabel + OpStore %a %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpLoad %uint %b + %66 = OpINotEqual %bool %65 %uint_0 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %67 + %68 = OpLabel + OpStore %b %uint_0 + OpBranch %67 + %67 = OpLabel + %69 = OpLoad %uint %c + %70 = OpINotEqual %bool %69 %uint_1 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + OpStore %c %uint_1 + OpBranch %71 + %71 = OpLabel + %73 = OpLoad %uint %d + %74 = OpINotEqual %bool %73 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + OpStore %d %uint_0 + OpBranch %75 + %75 = OpLabel + %77 = OpLoad %uint %e + %78 = OpINotEqual %bool %77 %uint_1 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + OpStore %e %uint_1 + OpBranch %79 + %79 = OpLabel + %81 = OpLoad %uint %f + %82 = OpINotEqual %bool %81 %uint_0 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + OpStore %f %uint_0 + OpBranch %83 + %83 = OpLabel + %85 = OpLoad %uint %a + %86 = OpLoad %uint %b + %87 = OpLoad %uint %c + %88 = OpLoad %uint %d + %89 = OpLoad %uint %e + %90 = OpLoad %uint %f + %91 = OpIEqual %bool %85 %uint_1 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %92 + %93 = OpLabel + %94 = OpIEqual %bool %86 %uint_0 + OpBranch %92 + %92 = OpLabel + %95 = OpPhi %bool %91 %83 %94 %93 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %96 + %97 = OpLabel + %98 = OpIEqual %bool %87 %uint_1 + OpBranch %96 + %96 = OpLabel + %99 = OpPhi %bool %95 %92 %98 %97 + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %100 + %101 = OpLabel + %102 = OpIEqual %bool %88 %uint_0 + OpBranch %100 + %100 = OpLabel + %103 = OpPhi %bool %99 %96 %102 %101 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + %106 = OpIEqual %bool %89 %uint_1 + OpBranch %104 + %104 = OpLabel + %107 = OpPhi %bool %103 %100 %106 %105 + OpSelectionMerge %108 None + OpBranchConditional %107 %109 %108 + %109 = OpLabel + %110 = OpIEqual %bool %90 %uint_0 + OpBranch %108 + %108 = OpLabel + %111 = OpPhi %bool %107 %104 %110 %109 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %114 + %113 = OpLabel + OpStore %x_GLF_color %117 + OpBranch %112 + %114 = OpLabel + OpStore %x_GLF_color %118 + OpBranch %112 + %112 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %119 +%tint_symbol = OpFunctionParameter %main_out + %123 = OpLabel + %124 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %124 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %126 = OpLabel + %127 = OpFunctionCall %void %main_1 + %129 = OpLoad %v4float %x_GLF_color + %130 = OpCompositeConstruct %main_out %129 + %128 = OpFunctionCall %void %tint_symbol_2 %130 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..ec6d634e37 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.spvasm.expected.wgsl @@ -0,0 +1,76 @@ +[[block]] +struct buf0 { + one : u32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var b : u32; + var c : u32; + var d : u32; + var e : u32; + var f : u32; + let x_41 : u32 = x_6.one; + a = ((77u + x_41) >> 32u); + let x_45 : u32 = x_6.one; + b = ((3243u + x_45) >> 33u); + let x_49 : u32 = x_6.one; + c = ((23u + x_49) >> 345u); + let x_53 : u32 = x_6.one; + d = ((2395u + x_53) << 32u); + let x_57 : u32 = x_6.one; + e = ((290485u + x_57) << 33u); + let x_61 : u32 = x_6.one; + f = ((44321u + x_61) << 345u); + let x_64 : u32 = a; + if ((x_64 != 1u)) { + a = 1u; + } + let x_68 : u32 = b; + if ((x_68 != 0u)) { + b = 0u; + } + let x_72 : u32 = c; + if ((x_72 != 1u)) { + c = 1u; + } + let x_76 : u32 = d; + if ((x_76 != 0u)) { + d = 0u; + } + let x_80 : u32 = e; + if ((x_80 != 1u)) { + e = 1u; + } + let x_84 : u32 = f; + if ((x_84 != 0u)) { + f = 0u; + } + let x_88 : u32 = a; + let x_90 : u32 = b; + let x_93 : u32 = c; + let x_96 : u32 = d; + let x_99 : u32 = e; + let x_102 : u32 = f; + if (((((((x_88 == 1u) && (x_90 == 0u)) && (x_93 == 1u)) && (x_96 == 0u)) && (x_99 == 1u)) && (x_102 == 0u))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl new file mode 100644 index 0000000000..ec6d634e37 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl @@ -0,0 +1,76 @@ +[[block]] +struct buf0 { + one : u32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var b : u32; + var c : u32; + var d : u32; + var e : u32; + var f : u32; + let x_41 : u32 = x_6.one; + a = ((77u + x_41) >> 32u); + let x_45 : u32 = x_6.one; + b = ((3243u + x_45) >> 33u); + let x_49 : u32 = x_6.one; + c = ((23u + x_49) >> 345u); + let x_53 : u32 = x_6.one; + d = ((2395u + x_53) << 32u); + let x_57 : u32 = x_6.one; + e = ((290485u + x_57) << 33u); + let x_61 : u32 = x_6.one; + f = ((44321u + x_61) << 345u); + let x_64 : u32 = a; + if ((x_64 != 1u)) { + a = 1u; + } + let x_68 : u32 = b; + if ((x_68 != 0u)) { + b = 0u; + } + let x_72 : u32 = c; + if ((x_72 != 1u)) { + c = 1u; + } + let x_76 : u32 = d; + if ((x_76 != 0u)) { + d = 0u; + } + let x_80 : u32 = e; + if ((x_80 != 1u)) { + e = 1u; + } + let x_84 : u32 = f; + if ((x_84 != 0u)) { + f = 0u; + } + let x_88 : u32 = a; + let x_90 : u32 = b; + let x_93 : u32 = c; + let x_96 : u32 = d; + let x_99 : u32 = e; + let x_102 : u32 = f; + if (((((((x_88 == 1u) && (x_90 == 0u)) && (x_93 == 1u)) && (x_96 == 0u)) && (x_99 == 1u)) && (x_102 == 0u))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..44f7ed6f08 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.hlsl @@ -0,0 +1,83 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + uint b = 0u; + uint c = 0u; + uint d = 0u; + uint e = 0u; + uint f = 0u; + const uint x_41 = x_6[0].x; + a = ((77u + x_41) >> 32u); + const uint x_45 = x_6[0].x; + b = ((3243u + x_45) >> 33u); + const uint x_49 = x_6[0].x; + c = ((23u + x_49) >> 345u); + const uint x_53 = x_6[0].x; + d = ((2395u + x_53) << 32u); + const uint x_57 = x_6[0].x; + e = ((290485u + x_57) << 33u); + const uint x_61 = x_6[0].x; + f = ((44321u + x_61) << 345u); + if ((a != 1u)) { + a = 1u; + } + if ((b != 0u)) { + b = 0u; + } + if ((c != 1u)) { + c = 1u; + } + if ((d != 0u)) { + d = 0u; + } + if ((e != 1u)) { + e = 1u; + } + if ((f != 0u)) { + f = 0u; + } + bool tint_tmp_4 = (a == 1u); + if (tint_tmp_4) { + tint_tmp_4 = (b == 0u); + } + bool tint_tmp_3 = (tint_tmp_4); + if (tint_tmp_3) { + tint_tmp_3 = (c == 1u); + } + bool tint_tmp_2 = (tint_tmp_3); + if (tint_tmp_2) { + tint_tmp_2 = (d == 0u); + } + bool tint_tmp_1 = (tint_tmp_2); + if (tint_tmp_1) { + tint_tmp_1 = (e == 1u); + } + bool tint_tmp = (tint_tmp_1); + if (tint_tmp) { + tint_tmp = (f == 0u); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.msl new file mode 100644 index 0000000000..5d8fa5422b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.msl @@ -0,0 +1,78 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ uint one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + uint a = 0u; + uint b = 0u; + uint c = 0u; + uint d = 0u; + uint e = 0u; + uint f = 0u; + uint const x_41 = x_6.one; + a = ((77u + x_41) >> 32u); + uint const x_45 = x_6.one; + b = ((3243u + x_45) >> 33u); + uint const x_49 = x_6.one; + c = ((23u + x_49) >> 345u); + uint const x_53 = x_6.one; + d = ((2395u + x_53) << 32u); + uint const x_57 = x_6.one; + e = ((290485u + x_57) << 33u); + uint const x_61 = x_6.one; + f = ((44321u + x_61) << 345u); + uint const x_64 = a; + if ((x_64 != 1u)) { + a = 1u; + } + uint const x_68 = b; + if ((x_68 != 0u)) { + b = 0u; + } + uint const x_72 = c; + if ((x_72 != 1u)) { + c = 1u; + } + uint const x_76 = d; + if ((x_76 != 0u)) { + d = 0u; + } + uint const x_80 = e; + if ((x_80 != 1u)) { + e = 1u; + } + uint const x_84 = f; + if ((x_84 != 0u)) { + f = 0u; + } + uint const x_88 = a; + uint const x_90 = b; + uint const x_93 = c; + uint const x_96 = d; + uint const x_99 = e; + uint const x_102 = f; + if (((((((x_88 == 1u) && (x_90 == 0u)) && (x_93 == 1u)) && (x_96 == 0u)) && (x_99 == 1u)) && (x_102 == 0u))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..8468b8060f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.spvasm @@ -0,0 +1,221 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 131 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %d "d" + OpName %e "e" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %uint = OpTypeInt 32 0 + %buf0 = OpTypeStruct %uint +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_77 = OpConstant %uint 77 + %uint_32 = OpConstant %uint 32 + %uint_3243 = OpConstant %uint 3243 + %uint_33 = OpConstant %uint 33 + %uint_23 = OpConstant %uint 23 + %uint_345 = OpConstant %uint 345 + %uint_2395 = OpConstant %uint 2395 +%uint_290485 = OpConstant %uint 290485 + %uint_44321 = OpConstant %uint 44321 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %117 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %118 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %119 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %18 + %b = OpVariable %_ptr_Function_uint Function %18 + %c = OpVariable %_ptr_Function_uint Function %18 + %d = OpVariable %_ptr_Function_uint Function %18 + %e = OpVariable %_ptr_Function_uint Function %18 + %f = OpVariable %_ptr_Function_uint Function %18 + %26 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %27 = OpLoad %uint %26 + %29 = OpIAdd %uint %uint_77 %27 + %31 = OpShiftRightLogical %uint %29 %uint_32 + OpStore %a %31 + %32 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %33 = OpLoad %uint %32 + %35 = OpIAdd %uint %uint_3243 %33 + %37 = OpShiftRightLogical %uint %35 %uint_33 + OpStore %b %37 + %38 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %39 = OpLoad %uint %38 + %41 = OpIAdd %uint %uint_23 %39 + %43 = OpShiftRightLogical %uint %41 %uint_345 + OpStore %c %43 + %44 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %45 = OpLoad %uint %44 + %47 = OpIAdd %uint %uint_2395 %45 + %48 = OpShiftLeftLogical %uint %47 %uint_32 + OpStore %d %48 + %49 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %50 = OpLoad %uint %49 + %52 = OpIAdd %uint %uint_290485 %50 + %53 = OpShiftLeftLogical %uint %52 %uint_33 + OpStore %e %53 + %54 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %55 = OpLoad %uint %54 + %57 = OpIAdd %uint %uint_44321 %55 + %58 = OpShiftLeftLogical %uint %57 %uint_345 + OpStore %f %58 + %59 = OpLoad %uint %a + %61 = OpINotEqual %bool %59 %uint_1 + OpSelectionMerge %63 None + OpBranchConditional %61 %64 %63 + %64 = OpLabel + OpStore %a %uint_1 + OpBranch %63 + %63 = OpLabel + %65 = OpLoad %uint %b + %66 = OpINotEqual %bool %65 %uint_0 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %67 + %68 = OpLabel + OpStore %b %uint_0 + OpBranch %67 + %67 = OpLabel + %69 = OpLoad %uint %c + %70 = OpINotEqual %bool %69 %uint_1 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + OpStore %c %uint_1 + OpBranch %71 + %71 = OpLabel + %73 = OpLoad %uint %d + %74 = OpINotEqual %bool %73 %uint_0 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + OpStore %d %uint_0 + OpBranch %75 + %75 = OpLabel + %77 = OpLoad %uint %e + %78 = OpINotEqual %bool %77 %uint_1 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + OpStore %e %uint_1 + OpBranch %79 + %79 = OpLabel + %81 = OpLoad %uint %f + %82 = OpINotEqual %bool %81 %uint_0 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + OpStore %f %uint_0 + OpBranch %83 + %83 = OpLabel + %85 = OpLoad %uint %a + %86 = OpLoad %uint %b + %87 = OpLoad %uint %c + %88 = OpLoad %uint %d + %89 = OpLoad %uint %e + %90 = OpLoad %uint %f + %91 = OpIEqual %bool %85 %uint_1 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %92 + %93 = OpLabel + %94 = OpIEqual %bool %86 %uint_0 + OpBranch %92 + %92 = OpLabel + %95 = OpPhi %bool %91 %83 %94 %93 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %96 + %97 = OpLabel + %98 = OpIEqual %bool %87 %uint_1 + OpBranch %96 + %96 = OpLabel + %99 = OpPhi %bool %95 %92 %98 %97 + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %100 + %101 = OpLabel + %102 = OpIEqual %bool %88 %uint_0 + OpBranch %100 + %100 = OpLabel + %103 = OpPhi %bool %99 %96 %102 %101 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + %106 = OpIEqual %bool %89 %uint_1 + OpBranch %104 + %104 = OpLabel + %107 = OpPhi %bool %103 %100 %106 %105 + OpSelectionMerge %108 None + OpBranchConditional %107 %109 %108 + %109 = OpLabel + %110 = OpIEqual %bool %90 %uint_0 + OpBranch %108 + %108 = OpLabel + %111 = OpPhi %bool %107 %104 %110 %109 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %114 + %113 = OpLabel + OpStore %x_GLF_color %117 + OpBranch %112 + %114 = OpLabel + OpStore %x_GLF_color %118 + OpBranch %112 + %112 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %119 +%tint_symbol = OpFunctionParameter %main_out + %123 = OpLabel + %124 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %124 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %126 = OpLabel + %127 = OpFunctionCall %void %main_1 + %129 = OpLoad %v4float %x_GLF_color + %130 = OpCompositeConstruct %main_out %129 + %128 = OpFunctionCall %void %tint_symbol_2 %130 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..ec6d634e37 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-gte32/0.wgsl.expected.wgsl @@ -0,0 +1,76 @@ +[[block]] +struct buf0 { + one : u32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var b : u32; + var c : u32; + var d : u32; + var e : u32; + var f : u32; + let x_41 : u32 = x_6.one; + a = ((77u + x_41) >> 32u); + let x_45 : u32 = x_6.one; + b = ((3243u + x_45) >> 33u); + let x_49 : u32 = x_6.one; + c = ((23u + x_49) >> 345u); + let x_53 : u32 = x_6.one; + d = ((2395u + x_53) << 32u); + let x_57 : u32 = x_6.one; + e = ((290485u + x_57) << 33u); + let x_61 : u32 = x_6.one; + f = ((44321u + x_61) << 345u); + let x_64 : u32 = a; + if ((x_64 != 1u)) { + a = 1u; + } + let x_68 : u32 = b; + if ((x_68 != 0u)) { + b = 0u; + } + let x_72 : u32 = c; + if ((x_72 != 1u)) { + c = 1u; + } + let x_76 : u32 = d; + if ((x_76 != 0u)) { + d = 0u; + } + let x_80 : u32 = e; + if ((x_80 != 1u)) { + e = 1u; + } + let x_84 : u32 = f; + if ((x_84 != 0u)) { + f = 0u; + } + let x_88 : u32 = a; + let x_90 : u32 = b; + let x_93 : u32 = c; + let x_96 : u32 = d; + let x_99 : u32 = e; + let x_102 : u32 = f; + if (((((((x_88 == 1u) && (x_90 == 0u)) && (x_93 == 1u)) && (x_96 == 0u)) && (x_99 == 1u)) && (x_102 == 0u))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm new file mode 100644 index 0000000000..6e903ef85b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm @@ -0,0 +1,47 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %i RelaxedPrecision + OpDecorate %5 RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_5 = OpConstant %int 5 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %8 + %22 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_5 + %5 = OpLoad %int %i + %6 = OpShiftRightArithmetic %int %5 %int_1 + %23 = OpINotEqual %bool %6 %int_2 + OpSelectionMerge %24 None + OpBranchConditional %23 %25 %26 + %25 = OpLabel + OpStore %_GLF_color %19 + OpBranch %24 + %26 = OpLabel + OpStore %_GLF_color %21 + OpBranch %24 + %24 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..cc5e35257b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.hlsl @@ -0,0 +1,26 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + i = 5; + if (((i >> asuint(1)) != 2)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.msl new file mode 100644 index 0000000000..c31454528c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int i = 0; + i = 5; + int const x_5 = i; + if (((x_5 >> as_type(1)) != 2)) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..9f2db98c0b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_5 = OpConstant %int 5 + %uint = OpTypeInt 32 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %32 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %i = OpVariable %_ptr_Function_int Function %15 + OpStore %i %int_5 + %17 = OpLoad %int %i + %18 = OpBitcast %uint %int_1 + %21 = OpShiftRightArithmetic %int %17 %18 + %23 = OpINotEqual %bool %21 %int_2 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %27 + %26 = OpLabel + OpStore %x_GLF_color %29 + OpBranch %25 + %27 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %32 +%tint_symbol = OpFunctionParameter %main_out + %36 = OpLabel + %37 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %37 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %39 = OpLabel + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %x_GLF_color + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_2 %43 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..f04d8e215a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + i = 5; + let x_5 : i32 = i; + if (((x_5 >> bitcast(1)) != 2)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl new file mode 100644 index 0000000000..f04d8e215a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + i = 5; + let x_5 : i32 = i; + if (((x_5 >> bitcast(1)) != 2)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..cc5e35257b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + i = 5; + if (((i >> asuint(1)) != 2)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.msl new file mode 100644 index 0000000000..c31454528c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int i = 0; + i = 5; + int const x_5 = i; + if (((x_5 >> as_type(1)) != 2)) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..9f2db98c0b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_5 = OpConstant %int 5 + %uint = OpTypeInt 32 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %32 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %i = OpVariable %_ptr_Function_int Function %15 + OpStore %i %int_5 + %17 = OpLoad %int %i + %18 = OpBitcast %uint %int_1 + %21 = OpShiftRightArithmetic %int %17 %18 + %23 = OpINotEqual %bool %21 %int_2 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %27 + %26 = OpLabel + OpStore %x_GLF_color %29 + OpBranch %25 + %27 = OpLabel + OpStore %x_GLF_color %31 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %32 +%tint_symbol = OpFunctionParameter %main_out + %36 = OpLabel + %37 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %37 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %39 = OpLabel + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %x_GLF_color + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_2 %43 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..f04d8e215a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-shift-right-arithmetic/0.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + i = 5; + let x_5 : i32 = i; + if (((x_5 >> bitcast(1)) != 2)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm new file mode 100644 index 0000000000..8a5c45c4ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm @@ -0,0 +1,44 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpDecorate %a RelaxedPrecision + OpDecorate %5 RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %20 = OpLabel + %a = OpVariable %_ptr_Function_uint Function + OpStore %a %uint_4 + %5 = OpLoad %uint %a + %6 = OpUDiv %uint %5 %uint_2 + OpSelectionMerge %21 None + OpSwitch %6 %22 2 %23 + %22 = OpLabel + OpStore %_GLF_color %19 + OpBranch %21 + %23 = OpLabel + OpStore %_GLF_color %18 + OpBranch %21 + %21 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..2b46425601 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.hlsl @@ -0,0 +1,31 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + a = 4u; + switch((a / 2u)) { + case 2u: { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + default: { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + break; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.msl new file mode 100644 index 0000000000..a8ec9c9125 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + uint a = 0u; + a = 4u; + uint const x_5 = a; + switch((x_5 / 2u)) { + case 2u: { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + default: { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + break; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..541bbd0f4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %15 = OpConstantNull %uint + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %26 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %27 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %15 + OpStore %a %uint_4 + %17 = OpLoad %uint %a + %20 = OpUDiv %uint %17 %uint_2 + OpSelectionMerge %18 None + OpSwitch %20 %21 2 %22 + %22 = OpLabel + OpStore %x_GLF_color %25 + OpBranch %18 + %21 = OpLabel + OpStore %x_GLF_color %26 + OpBranch %18 + %18 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %27 +%tint_symbol = OpFunctionParameter %main_out + %31 = OpLabel + %32 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %32 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %34 = OpLabel + %35 = OpFunctionCall %void %main_1 + %37 = OpLoad %v4float %x_GLF_color + %38 = OpCompositeConstruct %main_out %37 + %36 = OpFunctionCall %void %tint_symbol_2 %38 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..be6fc47227 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.spvasm.expected.wgsl @@ -0,0 +1,27 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + a = 4u; + let x_5 : u32 = a; + switch((x_5 / 2u)) { + case 2u: { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + default: { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl new file mode 100644 index 0000000000..be6fc47227 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl @@ -0,0 +1,27 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + a = 4u; + let x_5 : u32 = a; + switch((x_5 / 2u)) { + case 2u: { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + default: { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..2b46425601 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + a = 4u; + switch((a / 2u)) { + case 2u: { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + default: { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + break; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.msl new file mode 100644 index 0000000000..a8ec9c9125 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + uint a = 0u; + a = 4u; + uint const x_5 = a; + switch((x_5 / 2u)) { + case 2u: { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + default: { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + break; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..541bbd0f4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %15 = OpConstantNull %uint + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %26 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %27 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %15 + OpStore %a %uint_4 + %17 = OpLoad %uint %a + %20 = OpUDiv %uint %17 %uint_2 + OpSelectionMerge %18 None + OpSwitch %20 %21 2 %22 + %22 = OpLabel + OpStore %x_GLF_color %25 + OpBranch %18 + %21 = OpLabel + OpStore %x_GLF_color %26 + OpBranch %18 + %18 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %27 +%tint_symbol = OpFunctionParameter %main_out + %31 = OpLabel + %32 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %32 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %34 = OpLabel + %35 = OpFunctionCall %void %main_1 + %37 = OpLoad %v4float %x_GLF_color + %38 = OpCompositeConstruct %main_out %37 + %36 = OpFunctionCall %void %tint_symbol_2 %38 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..be6fc47227 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fold-switch-udiv/0.wgsl.expected.wgsl @@ -0,0 +1,27 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + a = 4u; + let x_5 : u32 = a; + switch((x_5 / 2u)) { + case 2u: { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + default: { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm new file mode 100644 index 0000000000..ca6478b737 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm @@ -0,0 +1,75 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_10 = OpConstant %float 10 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %24 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %25 = OpLabel + %f = OpVariable %_ptr_Function_float Function + OpStore %f %float_1 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %31 = OpLoad %float %30 + %32 = OpLoad %float %f + %33 = OpFAdd %float %32 %31 + OpStore %f %33 + OpBranch %28 + %28 = OpLabel + %34 = OpLoad %float %f + %35 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %36 = OpLoad %float %35 + %37 = OpFAdd %float %float_9 %36 + %38 = OpExtInst %float %1 FClamp %34 %float_8 %37 + %39 = OpFOrdGreaterThan %bool %float_10 %38 + OpBranchConditional %39 %26 %27 + %27 = OpLabel + %40 = OpLoad %float %f + %41 = OpFOrdEqual %bool %40 %float_10 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %44 + %43 = OpLabel + OpStore %_GLF_color %23 + OpBranch %42 + %44 = OpLabel + OpStore %_GLF_color %24 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2553d12f79 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.hlsl @@ -0,0 +1,41 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + f = 1.0f; + while (true) { + const float x_31 = asfloat(x_6[0].x); + f = (f + x_31); + { + const float x_34 = f; + const float x_36 = asfloat(x_6[0].x); + if ((10.0f > clamp(x_34, 8.0f, (9.0f + x_36)))) { + } else { + break; + } + } + } + if ((f == 10.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..bc7a9d08f1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + f = 1.0f; + while (true) { + float const x_31 = x_6.one; + float const x_32 = f; + f = (x_32 + x_31); + { + float const x_34 = f; + float const x_36 = x_6.one; + if ((10.0f > clamp(x_34, 8.0f, (9.0f + x_36)))) { + } else { + break; + } + } + } + float const x_40 = f; + if ((x_40 == 10.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..9b5b3abd0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.spvasm @@ -0,0 +1,120 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_10 = OpConstant %float 10 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %50 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %51 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %52 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %f = OpVariable %_ptr_Function_float Function %17 + OpStore %f %float_1 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %26 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %27 = OpLoad %float %26 + %28 = OpLoad %float %f + %29 = OpFAdd %float %28 %27 + OpStore %f %29 + OpBranch %21 + %21 = OpLabel + %30 = OpLoad %float %f + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %32 = OpLoad %float %31 + %38 = OpFAdd %float %float_9 %32 + %34 = OpExtInst %float %35 NClamp %30 %float_8 %38 + %39 = OpFOrdGreaterThan %bool %float_10 %34 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %20 + %41 = OpLabel + OpBranch %19 + %20 = OpLabel + %44 = OpLoad %float %f + %45 = OpFOrdEqual %bool %44 %float_10 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpStore %x_GLF_color %50 + OpBranch %46 + %48 = OpLabel + OpStore %x_GLF_color %51 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %52 +%tint_symbol = OpFunctionParameter %main_out + %56 = OpLabel + %57 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %57 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %59 = OpLabel + %60 = OpFunctionCall %void %main_1 + %62 = OpLoad %v4float %x_GLF_color + %63 = OpCompositeConstruct %main_out %62 + %61 = OpFunctionCall %void %tint_symbol_2 %63 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 21[%21] is not post dominated by the back-edge block 41[%41] + %41 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..8478100865 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.spvasm.expected.wgsl @@ -0,0 +1,45 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + f = 1.0; + loop { + let x_31 : f32 = x_6.one; + let x_32 : f32 = f; + f = (x_32 + x_31); + + continuing { + let x_34 : f32 = f; + let x_36 : f32 = x_6.one; + if ((10.0 > clamp(x_34, 8.0, (9.0 + x_36)))) { + } else { + break; + } + } + } + let x_40 : f32 = f; + if ((x_40 == 10.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl new file mode 100644 index 0000000000..8478100865 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl @@ -0,0 +1,45 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + f = 1.0; + loop { + let x_31 : f32 = x_6.one; + let x_32 : f32 = f; + f = (x_32 + x_31); + + continuing { + let x_34 : f32 = f; + let x_36 : f32 = x_6.one; + if ((10.0 > clamp(x_34, 8.0, (9.0 + x_36)))) { + } else { + break; + } + } + } + let x_40 : f32 = f; + if ((x_40 == 10.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2553d12f79 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + f = 1.0f; + while (true) { + const float x_31 = asfloat(x_6[0].x); + f = (f + x_31); + { + const float x_34 = f; + const float x_36 = asfloat(x_6[0].x); + if ((10.0f > clamp(x_34, 8.0f, (9.0f + x_36)))) { + } else { + break; + } + } + } + if ((f == 10.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..bc7a9d08f1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + f = 1.0f; + while (true) { + float const x_31 = x_6.one; + float const x_32 = f; + f = (x_32 + x_31); + { + float const x_34 = f; + float const x_36 = x_6.one; + if ((10.0f > clamp(x_34, 8.0f, (9.0f + x_36)))) { + } else { + break; + } + } + } + float const x_40 = f; + if ((x_40 == 10.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..9b5b3abd0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.spvasm @@ -0,0 +1,120 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_10 = OpConstant %float 10 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %50 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %51 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %52 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %f = OpVariable %_ptr_Function_float Function %17 + OpStore %f %float_1 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %26 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %27 = OpLoad %float %26 + %28 = OpLoad %float %f + %29 = OpFAdd %float %28 %27 + OpStore %f %29 + OpBranch %21 + %21 = OpLabel + %30 = OpLoad %float %f + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %32 = OpLoad %float %31 + %38 = OpFAdd %float %float_9 %32 + %34 = OpExtInst %float %35 NClamp %30 %float_8 %38 + %39 = OpFOrdGreaterThan %bool %float_10 %34 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %20 + %41 = OpLabel + OpBranch %19 + %20 = OpLabel + %44 = OpLoad %float %f + %45 = OpFOrdEqual %bool %44 %float_10 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpStore %x_GLF_color %50 + OpBranch %46 + %48 = OpLabel + OpStore %x_GLF_color %51 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %52 +%tint_symbol = OpFunctionParameter %main_out + %56 = OpLabel + %57 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %57 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %59 = OpLabel + %60 = OpFunctionCall %void %main_1 + %62 = OpLoad %v4float %x_GLF_color + %63 = OpCompositeConstruct %main_out %62 + %61 = OpFunctionCall %void %tint_symbol_2 %63 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 21[%21] is not post dominated by the back-edge block 41[%41] + %41 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..8478100865 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-clamp-cmp-const-first/0-opt.wgsl.expected.wgsl @@ -0,0 +1,45 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + f = 1.0; + loop { + let x_31 : f32 = x_6.one; + let x_32 : f32 = f; + f = (x_32 + x_31); + + continuing { + let x_34 : f32 = f; + let x_36 : f32 = x_6.one; + if ((10.0 > clamp(x_34, 8.0, (9.0 + x_36)))) { + } else { + break; + } + } + } + let x_40 : f32 = f; + if ((x_40 == 10.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm new file mode 100644 index 0000000000..90e1cbb54e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm @@ -0,0 +1,53 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %20 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %7 + %22 = OpLabel + %23 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %24 = OpLoad %int %23 + %25 = OpISub %int %int_3 %24 + %26 = OpIAdd %int %int_1 %25 + %27 = OpIEqual %bool %26 %int_3 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %30 + %29 = OpLabel + OpStore %_GLF_color %20 + OpBranch %28 + %30 = OpLabel + OpStore %_GLF_color %21 + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..047beed0ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const int x_24 = asint(x_5[0].x); + if (((1 + (3 - x_24)) == 3)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b73cd87619 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_24 = x_5.one; + if (((1 + (3 - x_24)) == 3)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4b46ac22c0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %33 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %34 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %20 = OpLoad %int %19 + %23 = OpISub %int %int_3 %20 + %24 = OpIAdd %int %int_1 %23 + %25 = OpIEqual %bool %24 %int_3 + OpSelectionMerge %27 None + OpBranchConditional %25 %28 %29 + %28 = OpLabel + OpStore %x_GLF_color %32 + OpBranch %27 + %29 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %34 +%tint_symbol = OpFunctionParameter %main_out + %38 = OpLabel + %39 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %39 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %main_1 + %44 = OpLoad %v4float %x_GLF_color + %45 = OpCompositeConstruct %main_out %44 + %43 = OpFunctionCall %void %tint_symbol_2 %45 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ed615563da --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_24 : i32 = x_5.one; + if (((1 + (3 - x_24)) == 3)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl new file mode 100644 index 0000000000..ed615563da --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_24 : i32 = x_5.one; + if (((1 + (3 - x_24)) == 3)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..047beed0ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const int x_24 = asint(x_5[0].x); + if (((1 + (3 - x_24)) == 3)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b73cd87619 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_24 = x_5.one; + if (((1 + (3 - x_24)) == 3)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b46ac22c0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %33 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %34 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %20 = OpLoad %int %19 + %23 = OpISub %int %int_3 %20 + %24 = OpIAdd %int %int_1 %23 + %25 = OpIEqual %bool %24 %int_3 + OpSelectionMerge %27 None + OpBranchConditional %25 %28 %29 + %28 = OpLabel + OpStore %x_GLF_color %32 + OpBranch %27 + %29 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %34 +%tint_symbol = OpFunctionParameter %main_out + %38 = OpLabel + %39 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %39 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %main_1 + %44 = OpLoad %v4float %x_GLF_color + %45 = OpCompositeConstruct %main_out %44 + %43 = OpFunctionCall %void %tint_symbol_2 %45 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ed615563da --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-merge-add-sub-uniform/0-opt.wgsl.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_24 : i32 = x_5.one; + if (((1 + (3 - x_24)) == 3)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm new file mode 100644 index 0000000000..bf8546cd5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm @@ -0,0 +1,80 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "twoandthree" + OpName %_ "" + OpName %b "b" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %21 = OpConstantComposite %v2float %float_1 %float_1 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_2 = OpConstant %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %28 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %29 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %30 = OpLabel + %a = OpVariable %_ptr_Function_v2float Function + %b = OpVariable %_ptr_Function_v2float Function + %31 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %32 = OpLoad %v2float %31 + OpStore %a %32 + %33 = OpAccessChain %_ptr_Function_float %a %uint_0 + %34 = OpLoad %float %33 + %35 = OpLoad %v2float %a + %36 = OpExtInst %v2float %1 FClamp %35 %21 %21 + %37 = OpCompositeExtract %float %36 1 + %38 = OpCompositeConstruct %v2float %34 %37 + OpStore %b %38 + %39 = OpAccessChain %_ptr_Function_float %b %uint_0 + %40 = OpLoad %float %39 + %41 = OpFOrdEqual %bool %40 %float_2 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + %44 = OpAccessChain %_ptr_Function_float %b %uint_1 + %45 = OpLoad %float %44 + %46 = OpFOrdEqual %bool %45 %float_1 + OpBranch %42 + %42 = OpLabel + %47 = OpPhi %bool %41 %30 %46 %43 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + OpStore %_GLF_color %28 + OpBranch %48 + %50 = OpLabel + OpStore %_GLF_color %29 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3e0c589b7e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.hlsl @@ -0,0 +1,43 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 a = float2(0.0f, 0.0f); + float2 b = float2(0.0f, 0.0f); + bool x_46 = false; + bool x_47_phi = false; + const float2 x_32 = asfloat(x_6[0].xy); + a = x_32; + const float x_34 = a.x; + b = float2(x_34, clamp(a, float2(1.0f, 1.0f), float2(1.0f, 1.0f)).y); + const float x_40 = b.x; + const bool x_41 = (x_40 == 2.0f); + x_47_phi = x_41; + if (x_41) { + const float x_45 = b.y; + x_46 = (x_45 == 1.0f); + x_47_phi = x_46; + } + if (x_47_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4aa4b0c558 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 twoandthree; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2 a = 0.0f; + float2 b = 0.0f; + bool x_46 = false; + bool x_47_phi = false; + float2 const x_32 = x_6.twoandthree; + a = x_32; + float const x_34 = a.x; + float2 const x_35 = a; + b = float2(x_34, clamp(x_35, float2(1.0f, 1.0f), float2(1.0f, 1.0f)).y); + float const x_40 = b.x; + bool const x_41 = (x_40 == 2.0f); + x_47_phi = x_41; + if (x_41) { + float const x_45 = b.y; + x_46 = (x_45 == 1.0f); + x_47_phi = x_46; + } + bool const x_47 = x_47_phi; + if (x_47) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e0f212a788 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.spvasm @@ -0,0 +1,121 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 70 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "twoandthree" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %x_46 "x_46" + OpName %x_47_phi "x_47_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %37 = OpConstantComposite %v2float %float_1 %float_1 + %float_2 = OpConstant %float 2 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %56 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %57 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_v2float Function %18 + %b = OpVariable %_ptr_Function_v2float Function %18 + %x_46 = OpVariable %_ptr_Function_bool Function %23 + %x_47_phi = OpVariable %_ptr_Function_bool Function %23 + %28 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %29 = OpLoad %v2float %28 + OpStore %a %29 + %31 = OpAccessChain %_ptr_Function_float %a %uint_0 + %32 = OpLoad %float %31 + %33 = OpLoad %v2float %a + %34 = OpExtInst %v2float %35 NClamp %33 %37 %37 + %38 = OpCompositeExtract %float %34 1 + %39 = OpCompositeConstruct %v2float %32 %38 + OpStore %b %39 + %40 = OpAccessChain %_ptr_Function_float %b %uint_0 + %41 = OpLoad %float %40 + %43 = OpFOrdEqual %bool %41 %float_2 + OpStore %x_47_phi %43 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + %47 = OpAccessChain %_ptr_Function_float %b %uint_1 + %48 = OpLoad %float %47 + %49 = OpFOrdEqual %bool %48 %float_1 + OpStore %x_46 %49 + %50 = OpLoad %bool %x_46 + OpStore %x_47_phi %50 + OpBranch %44 + %44 = OpLabel + %51 = OpLoad %bool %x_47_phi + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpStore %x_GLF_color %56 + OpBranch %52 + %54 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %58 +%tint_symbol = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %65 = OpLabel + %66 = OpFunctionCall %void %main_1 + %68 = OpLoad %v4float %x_GLF_color + %69 = OpCompositeConstruct %main_out %68 + %67 = OpFunctionCall %void %tint_symbol_2 %69 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..dc6b0c48de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.spvasm.expected.wgsl @@ -0,0 +1,46 @@ +[[block]] +struct buf0 { + twoandthree : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : vec2; + var b : vec2; + var x_46 : bool; + var x_47_phi : bool; + let x_32 : vec2 = x_6.twoandthree; + a = x_32; + let x_34 : f32 = a.x; + let x_35 : vec2 = a; + b = vec2(x_34, clamp(x_35, vec2(1.0, 1.0), vec2(1.0, 1.0)).y); + let x_40 : f32 = b.x; + let x_41 : bool = (x_40 == 2.0); + x_47_phi = x_41; + if (x_41) { + let x_45 : f32 = b.y; + x_46 = (x_45 == 1.0); + x_47_phi = x_46; + } + let x_47 : bool = x_47_phi; + if (x_47) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl new file mode 100644 index 0000000000..dc6b0c48de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl @@ -0,0 +1,46 @@ +[[block]] +struct buf0 { + twoandthree : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : vec2; + var b : vec2; + var x_46 : bool; + var x_47_phi : bool; + let x_32 : vec2 = x_6.twoandthree; + a = x_32; + let x_34 : f32 = a.x; + let x_35 : vec2 = a; + b = vec2(x_34, clamp(x_35, vec2(1.0, 1.0), vec2(1.0, 1.0)).y); + let x_40 : f32 = b.x; + let x_41 : bool = (x_40 == 2.0); + x_47_phi = x_41; + if (x_41) { + let x_45 : f32 = b.y; + x_46 = (x_45 == 1.0); + x_47_phi = x_46; + } + let x_47 : bool = x_47_phi; + if (x_47) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3e0c589b7e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.hlsl @@ -0,0 +1,43 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 a = float2(0.0f, 0.0f); + float2 b = float2(0.0f, 0.0f); + bool x_46 = false; + bool x_47_phi = false; + const float2 x_32 = asfloat(x_6[0].xy); + a = x_32; + const float x_34 = a.x; + b = float2(x_34, clamp(a, float2(1.0f, 1.0f), float2(1.0f, 1.0f)).y); + const float x_40 = b.x; + const bool x_41 = (x_40 == 2.0f); + x_47_phi = x_41; + if (x_41) { + const float x_45 = b.y; + x_46 = (x_45 == 1.0f); + x_47_phi = x_46; + } + if (x_47_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4aa4b0c558 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 twoandthree; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2 a = 0.0f; + float2 b = 0.0f; + bool x_46 = false; + bool x_47_phi = false; + float2 const x_32 = x_6.twoandthree; + a = x_32; + float const x_34 = a.x; + float2 const x_35 = a; + b = float2(x_34, clamp(x_35, float2(1.0f, 1.0f), float2(1.0f, 1.0f)).y); + float const x_40 = b.x; + bool const x_41 = (x_40 == 2.0f); + x_47_phi = x_41; + if (x_41) { + float const x_45 = b.y; + x_46 = (x_45 == 1.0f); + x_47_phi = x_46; + } + bool const x_47 = x_47_phi; + if (x_47) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e0f212a788 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.spvasm @@ -0,0 +1,121 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 70 +; Schema: 0 + OpCapability Shader + %35 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "twoandthree" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %x_46 "x_46" + OpName %x_47_phi "x_47_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %37 = OpConstantComposite %v2float %float_1 %float_1 + %float_2 = OpConstant %float 2 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %56 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %57 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_v2float Function %18 + %b = OpVariable %_ptr_Function_v2float Function %18 + %x_46 = OpVariable %_ptr_Function_bool Function %23 + %x_47_phi = OpVariable %_ptr_Function_bool Function %23 + %28 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %29 = OpLoad %v2float %28 + OpStore %a %29 + %31 = OpAccessChain %_ptr_Function_float %a %uint_0 + %32 = OpLoad %float %31 + %33 = OpLoad %v2float %a + %34 = OpExtInst %v2float %35 NClamp %33 %37 %37 + %38 = OpCompositeExtract %float %34 1 + %39 = OpCompositeConstruct %v2float %32 %38 + OpStore %b %39 + %40 = OpAccessChain %_ptr_Function_float %b %uint_0 + %41 = OpLoad %float %40 + %43 = OpFOrdEqual %bool %41 %float_2 + OpStore %x_47_phi %43 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + %47 = OpAccessChain %_ptr_Function_float %b %uint_1 + %48 = OpLoad %float %47 + %49 = OpFOrdEqual %bool %48 %float_1 + OpStore %x_46 %49 + %50 = OpLoad %bool %x_46 + OpStore %x_47_phi %50 + OpBranch %44 + %44 = OpLabel + %51 = OpLoad %bool %x_47_phi + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpStore %x_GLF_color %56 + OpBranch %52 + %54 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %58 +%tint_symbol = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %65 = OpLabel + %66 = OpFunctionCall %void %main_1 + %68 = OpLoad %v4float %x_GLF_color + %69 = OpCompositeConstruct %main_out %68 + %67 = OpFunctionCall %void %tint_symbol_2 %69 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..dc6b0c48de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-construct-extract/0-opt.wgsl.expected.wgsl @@ -0,0 +1,46 @@ +[[block]] +struct buf0 { + twoandthree : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : vec2; + var b : vec2; + var x_46 : bool; + var x_47_phi : bool; + let x_32 : vec2 = x_6.twoandthree; + a = x_32; + let x_34 : f32 = a.x; + let x_35 : vec2 = a; + b = vec2(x_34, clamp(x_35, vec2(1.0, 1.0), vec2(1.0, 1.0)).y); + let x_40 : f32 = b.x; + let x_41 : bool = (x_40 == 2.0); + x_47_phi = x_41; + if (x_41) { + let x_45 : f32 = b.y; + x_46 = (x_45 == 1.0); + x_47_phi = x_46; + } + let x_47 : bool = x_47_phi; + if (x_47) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm new file mode 100644 index 0000000000..65d8735105 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm @@ -0,0 +1,54 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_4 = OpConstant %float 4 + %v4float = OpTypeVector %float 4 + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_0 + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %7 + %23 = OpLabel + %24 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %25 = OpLoad %float %24 + %26 = OpCompositeConstruct %v4float %float_1 %float_2 %25 %float_4 + %27 = OpDot %float %26 %18 + %28 = OpFOrdEqual %bool %27 %float_2 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %31 + %30 = OpLabel + OpStore %_GLF_color %21 + OpBranch %29 + %31 = OpLabel + OpStore %_GLF_color %22 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..d3f224d7ca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_25 = asfloat(x_5[0].x); + if ((dot(float4(1.0f, 2.0f, x_25, 4.0f), float4(0.0f, 1.0f, 0.0f, 0.0f)) == 2.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..86397232cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float const x_25 = x_5.three; + if ((dot(float4(1.0f, 2.0f, x_25, 4.0f), float4(0.0f, 1.0f, 0.0f, 0.0f)) == 2.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..d9bb8a7c26 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_4 = OpConstant %float 4 + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_0 + %bool = OpTypeBool + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %33 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %34 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %19 = OpLoad %float %18 + %24 = OpCompositeConstruct %v4float %float_1 %float_2 %19 %float_4 + %20 = OpDot %float %24 %26 + %27 = OpFOrdEqual %bool %20 %float_2 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpStore %x_GLF_color %32 + OpBranch %29 + %31 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %34 +%tint_symbol = OpFunctionParameter %main_out + %38 = OpLabel + %39 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %39 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %41 = OpLabel + %42 = OpFunctionCall %void %main_1 + %44 = OpLoad %v4float %x_GLF_color + %45 = OpCompositeConstruct %main_out %44 + %43 = OpFunctionCall %void %tint_symbol_2 %45 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..da33dc475d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + three : f32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_25 : f32 = x_5.three; + if ((dot(vec4(1.0, 2.0, x_25, 4.0), vec4(0.0, 1.0, 0.0, 0.0)) == 2.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl new file mode 100644 index 0000000000..da33dc475d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + three : f32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_25 : f32 = x_5.three; + if ((dot(vec4(1.0, 2.0, x_25, 4.0), vec4(0.0, 1.0, 0.0, 0.0)) == 2.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d3f224d7ca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_25 = asfloat(x_5[0].x); + if ((dot(float4(1.0f, 2.0f, x_25, 4.0f), float4(0.0f, 1.0f, 0.0f, 0.0f)) == 2.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..86397232cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float const x_25 = x_5.three; + if ((dot(float4(1.0f, 2.0f, x_25, 4.0f), float4(0.0f, 1.0f, 0.0f, 0.0f)) == 2.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..d9bb8a7c26 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_4 = OpConstant %float 4 + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_0 + %bool = OpTypeBool + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %33 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %34 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %19 = OpLoad %float %18 + %24 = OpCompositeConstruct %v4float %float_1 %float_2 %19 %float_4 + %20 = OpDot %float %24 %26 + %27 = OpFOrdEqual %bool %20 %float_2 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpStore %x_GLF_color %32 + OpBranch %29 + %31 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %34 +%tint_symbol = OpFunctionParameter %main_out + %38 = OpLabel + %39 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %39 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %41 = OpLabel + %42 = OpFunctionCall %void %main_1 + %44 = OpLoad %v4float %x_GLF_color + %45 = OpCompositeConstruct %main_out %44 + %43 = OpFunctionCall %void %tint_symbol_2 %45 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..da33dc475d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-extract/0-opt.wgsl.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + three : f32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_25 : f32 = x_5.three; + if ((dot(vec4(1.0, 2.0, x_25, 4.0), vec4(0.0, 1.0, 0.0, 0.0)) == 2.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm new file mode 100644 index 0000000000..eb9175002b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm @@ -0,0 +1,55 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_2 = OpConstant %float 2 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v2float = OpTypeVector %float 2 + %float_0 = OpConstant %float 0 + %16 = OpConstantComposite %v2float %float_0 %float_2 + %float_6 = OpConstant %float 6 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %23 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %7 + %24 = OpLabel + %25 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %26 = OpLoad %float %25 + %27 = OpCompositeConstruct %v2float %float_2 %26 + %28 = OpDot %float %27 %16 + %29 = OpFOrdEqual %bool %28 %float_6 + OpSelectionMerge %30 None + OpBranchConditional %29 %31 %32 + %31 = OpLabel + OpStore %_GLF_color %22 + OpBranch %30 + %32 = OpLabel + OpStore %_GLF_color %23 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..43f199034d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_26 = asfloat(x_5[0].x); + if ((dot(float2(2.0f, x_26), float2(0.0f, 2.0f)) == 6.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.msl new file mode 100644 index 0000000000..5f40f93f77 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float const x_26 = x_5.three; + if ((dot(float2(2.0f, x_26), float2(0.0f, 2.0f)) == 6.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..61c450fdb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v2float = OpTypeVector %float 2 + %float_2 = OpConstant %float 2 + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v2float %float_0 %float_2 + %float_6 = OpConstant %float 6 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %35 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %19 = OpLoad %float %18 + %23 = OpCompositeConstruct %v2float %float_2 %19 + %20 = OpDot %float %23 %25 + %27 = OpFOrdEqual %bool %20 %float_6 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %29 + %31 = OpLabel + OpStore %x_GLF_color %34 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %35 +%tint_symbol = OpFunctionParameter %main_out + %39 = OpLabel + %40 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %40 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %42 = OpLabel + %43 = OpFunctionCall %void %main_1 + %45 = OpLoad %v4float %x_GLF_color + %46 = OpCompositeConstruct %main_out %45 + %44 = OpFunctionCall %void %tint_symbol_2 %46 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..b9c222e0be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + three : f32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_26 : f32 = x_5.three; + if ((dot(vec2(2.0, x_26), vec2(0.0, 2.0)) == 6.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl new file mode 100644 index 0000000000..b9c222e0be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + three : f32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_26 : f32 = x_5.three; + if ((dot(vec2(2.0, x_26), vec2(0.0, 2.0)) == 6.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..43f199034d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_26 = asfloat(x_5[0].x); + if ((dot(float2(2.0f, x_26), float2(0.0f, 2.0f)) == 6.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.msl new file mode 100644 index 0000000000..5f40f93f77 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float const x_26 = x_5.three; + if ((dot(float2(2.0f, x_26), float2(0.0f, 2.0f)) == 6.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..61c450fdb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v2float = OpTypeVector %float 2 + %float_2 = OpConstant %float 2 + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v2float %float_0 %float_2 + %float_6 = OpConstant %float 6 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %35 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %19 = OpLoad %float %18 + %23 = OpCompositeConstruct %v2float %float_2 %19 + %20 = OpDot %float %23 %25 + %27 = OpFOrdEqual %bool %20 %float_6 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %29 + %31 = OpLabel + OpStore %x_GLF_color %34 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %35 +%tint_symbol = OpFunctionParameter %main_out + %39 = OpLabel + %40 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %40 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %42 = OpLabel + %43 = OpFunctionCall %void %main_1 + %45 = OpLoad %v4float %x_GLF_color + %46 = OpCompositeConstruct %main_out %45 + %44 = OpFunctionCall %void %tint_symbol_2 %46 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..b9c222e0be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-dot-no-extract/0.wgsl.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + three : f32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_26 : f32 = x_5.three; + if ((dot(vec2(2.0, x_26), vec2(0.0, 2.0)) == 6.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm new file mode 100644 index 0000000000..f868d4d383 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm @@ -0,0 +1,71 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %i RelaxedPrecision + OpDecorate %5 RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_5 = OpConstant %int 5 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %27 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %12 + %28 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_5 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %5 = OpLoad %int %i + %33 = OpSGreaterThanEqual %bool %5 %int_0 + OpBranchConditional %33 %34 %30 + %34 = OpLabel + %6 = OpLoad %int %i + %7 = OpISub %int %6 %int_3 + OpStore %i %7 + %8 = OpLoad %int %i + %9 = OpIAdd %int %8 %int_1 + OpStore %i %9 + OpBranch %31 + %31 = OpLabel + OpBranch %29 + %30 = OpLabel + %10 = OpLoad %int %i + %35 = OpIEqual %bool %10 %int_n1 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %38 + %37 = OpLabel + OpStore %_GLF_color %26 + OpBranch %36 + %38 = OpLabel + OpStore %_GLF_color %27 + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..c8380b42f6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.hlsl @@ -0,0 +1,34 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + i = 5; + while (true) { + if ((i >= 0)) { + } else { + break; + } + i = (i - 3); + i = (i + 1); + } + if ((i == -1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..921f5ead83 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int i = 0; + i = 5; + while (true) { + int const x_5 = i; + if ((x_5 >= 0)) { + } else { + break; + } + int const x_6 = i; + i = (x_6 - 3); + int const x_8 = i; + i = (x_8 + 1); + } + int const x_10 = i; + if ((x_10 == -1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..85eee57d4a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.spvasm @@ -0,0 +1,100 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_5 = OpConstant %int 5 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %42 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %i = OpVariable %_ptr_Function_int Function %15 + OpStore %i %int_5 + OpBranch %17 + %17 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %21 = OpLoad %int %i + %23 = OpSGreaterThanEqual %bool %21 %int_0 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %27 + %26 = OpLabel + OpBranch %25 + %27 = OpLabel + OpBranch %18 + %25 = OpLabel + %28 = OpLoad %int %i + %30 = OpISub %int %28 %int_3 + OpStore %i %30 + %31 = OpLoad %int %i + %33 = OpIAdd %int %31 %int_1 + OpStore %i %33 + OpBranch %19 + %19 = OpLabel + OpBranch %17 + %18 = OpLabel + %34 = OpLoad %int %i + %36 = OpIEqual %bool %34 %int_n1 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpStore %x_GLF_color %42 + OpBranch %37 + %39 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %44 +%tint_symbol = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %51 = OpLabel + %52 = OpFunctionCall %void %main_1 + %54 = OpLoad %v4float %x_GLF_color + %55 = OpCompositeConstruct %main_out %54 + %53 = OpFunctionCall %void %tint_symbol_2 %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..7c7b28a2ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.spvasm.expected.wgsl @@ -0,0 +1,35 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + i = 5; + loop { + let x_5 : i32 = i; + if ((x_5 >= 0)) { + } else { + break; + } + let x_6 : i32 = i; + i = (x_6 - 3); + let x_8 : i32 = i; + i = (x_8 + 1); + } + let x_10 : i32 = i; + if ((x_10 == -1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl new file mode 100644 index 0000000000..7c7b28a2ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl @@ -0,0 +1,35 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + i = 5; + loop { + let x_5 : i32 = i; + if ((x_5 >= 0)) { + } else { + break; + } + let x_6 : i32 = i; + i = (x_6 - 3); + let x_8 : i32 = i; + i = (x_8 + 1); + } + let x_10 : i32 = i; + if ((x_10 == -1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..c8380b42f6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + i = 5; + while (true) { + if ((i >= 0)) { + } else { + break; + } + i = (i - 3); + i = (i + 1); + } + if ((i == -1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..921f5ead83 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int i = 0; + i = 5; + while (true) { + int const x_5 = i; + if ((x_5 >= 0)) { + } else { + break; + } + int const x_6 = i; + i = (x_6 - 3); + int const x_8 = i; + i = (x_8 + 1); + } + int const x_10 = i; + if ((x_10 == -1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..85eee57d4a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.spvasm @@ -0,0 +1,100 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_5 = OpConstant %int 5 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %42 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %i = OpVariable %_ptr_Function_int Function %15 + OpStore %i %int_5 + OpBranch %17 + %17 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %21 = OpLoad %int %i + %23 = OpSGreaterThanEqual %bool %21 %int_0 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %27 + %26 = OpLabel + OpBranch %25 + %27 = OpLabel + OpBranch %18 + %25 = OpLabel + %28 = OpLoad %int %i + %30 = OpISub %int %28 %int_3 + OpStore %i %30 + %31 = OpLoad %int %i + %33 = OpIAdd %int %31 %int_1 + OpStore %i %33 + OpBranch %19 + %19 = OpLabel + OpBranch %17 + %18 = OpLabel + %34 = OpLoad %int %i + %36 = OpIEqual %bool %34 %int_n1 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpStore %x_GLF_color %42 + OpBranch %37 + %39 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %44 +%tint_symbol = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %51 = OpLabel + %52 = OpFunctionCall %void %main_1 + %54 = OpLoad %v4float %x_GLF_color + %55 = OpCompositeConstruct %main_out %54 + %53 = OpFunctionCall %void %tint_symbol_2 %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..7c7b28a2ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-add-sub/0-opt.wgsl.expected.wgsl @@ -0,0 +1,35 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + i = 5; + loop { + let x_5 : i32 = i; + if ((x_5 >= 0)) { + } else { + break; + } + let x_6 : i32 = i; + i = (x_6 - 3); + let x_8 : i32 = i; + i = (x_8 + 1); + } + let x_10 : i32 = i; + if ((x_10 == -1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm new file mode 100644 index 0000000000..ce10f86b69 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm @@ -0,0 +1,63 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_4 = OpConstant %float 4 + %float_2 = OpConstant %float 2 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_1_89999998 = OpConstant %float 1.89999998 + %bool = OpTypeBool +%float_2_0999999 = OpConstant %float 2.0999999 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %25 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %26 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %27 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %28 = OpLoad %float %27 + %29 = OpFMul %float %float_2 %28 + %30 = OpFDiv %float %float_4 %29 + OpStore %f %30 + %31 = OpLoad %float %f + %32 = OpFOrdGreaterThan %bool %31 %float_1_89999998 + %33 = OpLoad %float %f + %34 = OpFOrdLessThan %bool %33 %float_2_0999999 + %35 = OpLogicalAnd %bool %32 %34 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %38 + %37 = OpLabel + OpStore %_GLF_color %24 + OpBranch %36 + %38 = OpLabel + OpStore %_GLF_color %25 + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..d20ee0a79f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.hlsl @@ -0,0 +1,34 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + const float x_28 = asfloat(x_6[0].x); + f = (4.0f / (2.0f * x_28)); + bool tint_tmp = (f > 1.899999976f); + if (tint_tmp) { + tint_tmp = (f < 2.099999905f); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b807292e11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + float const x_28 = x_6.one; + f = (4.0f / (2.0f * x_28)); + float const x_31 = f; + float const x_33 = f; + if (((x_31 > 1.899999976f) && (x_33 < 2.099999905f))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..056fe41a11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.spvasm @@ -0,0 +1,100 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_4 = OpConstant %float 4 + %float_2 = OpConstant %float 2 +%float_1_89999998 = OpConstant %float 1.89999998 + %bool = OpTypeBool +%float_2_0999999 = OpConstant %float 2.0999999 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %42 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %f = OpVariable %_ptr_Function_float Function %17 + %21 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %22 = OpLoad %float %21 + %25 = OpFMul %float %float_2 %22 + %26 = OpFDiv %float %float_4 %25 + OpStore %f %26 + %27 = OpLoad %float %f + %28 = OpLoad %float %f + %30 = OpFOrdGreaterThan %bool %27 %float_1_89999998 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %32 + %33 = OpLabel + %35 = OpFOrdLessThan %bool %28 %float_2_0999999 + OpBranch %32 + %32 = OpLabel + %36 = OpPhi %bool %30 %14 %35 %33 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpStore %x_GLF_color %42 + OpBranch %37 + %39 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %44 +%tint_symbol = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %51 = OpLabel + %52 = OpFunctionCall %void %main_1 + %54 = OpLoad %v4float %x_GLF_color + %55 = OpCompositeConstruct %main_out %54 + %53 = OpFunctionCall %void %tint_symbol_2 %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5b77b483b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.spvasm.expected.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + let x_28 : f32 = x_6.one; + f = (4.0 / (2.0 * x_28)); + let x_31 : f32 = f; + let x_33 : f32 = f; + if (((x_31 > 1.899999976) && (x_33 < 2.099999905))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl new file mode 100644 index 0000000000..5b77b483b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + let x_28 : f32 = x_6.one; + f = (4.0 / (2.0 * x_28)); + let x_31 : f32 = f; + let x_33 : f32 = f; + if (((x_31 > 1.899999976) && (x_33 < 2.099999905))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d20ee0a79f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + const float x_28 = asfloat(x_6[0].x); + f = (4.0f / (2.0f * x_28)); + bool tint_tmp = (f > 1.899999976f); + if (tint_tmp) { + tint_tmp = (f < 2.099999905f); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b807292e11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + float const x_28 = x_6.one; + f = (4.0f / (2.0f * x_28)); + float const x_31 = f; + float const x_33 = f; + if (((x_31 > 1.899999976f) && (x_33 < 2.099999905f))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..056fe41a11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.spvasm @@ -0,0 +1,100 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_4 = OpConstant %float 4 + %float_2 = OpConstant %float 2 +%float_1_89999998 = OpConstant %float 1.89999998 + %bool = OpTypeBool +%float_2_0999999 = OpConstant %float 2.0999999 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %42 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %f = OpVariable %_ptr_Function_float Function %17 + %21 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %22 = OpLoad %float %21 + %25 = OpFMul %float %float_2 %22 + %26 = OpFDiv %float %float_4 %25 + OpStore %f %26 + %27 = OpLoad %float %f + %28 = OpLoad %float %f + %30 = OpFOrdGreaterThan %bool %27 %float_1_89999998 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %32 + %33 = OpLabel + %35 = OpFOrdLessThan %bool %28 %float_2_0999999 + OpBranch %32 + %32 = OpLabel + %36 = OpPhi %bool %30 %14 %35 %33 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpStore %x_GLF_color %42 + OpBranch %37 + %39 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %44 +%tint_symbol = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %51 = OpLabel + %52 = OpFunctionCall %void %main_1 + %54 = OpLoad %v4float %x_GLF_color + %55 = OpCompositeConstruct %main_out %54 + %53 = OpFunctionCall %void %tint_symbol_2 %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5b77b483b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-div-mul/0-opt.wgsl.expected.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + let x_28 : f32 = x_6.one; + f = (4.0 / (2.0 * x_28)); + let x_31 : f32 = f; + let x_33 : f32 = f; + if (((x_31 > 1.899999976) && (x_33 < 2.099999905))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm new file mode 100644 index 0000000000..d57d2f7957 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm @@ -0,0 +1,62 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "four" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_2 = OpConstant %float 2 + %float_1 = OpConstant %float 1 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_7_9000001 = OpConstant %float 7.9000001 + %bool = OpTypeBool +%float_8_10000038 = OpConstant %float 8.10000038 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %24 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %25 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %26 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %27 = OpLoad %float %26 + %28 = OpFDiv %float %float_1 %27 + %29 = OpFDiv %float %float_2 %28 + OpStore %a %29 + %30 = OpLoad %float %a + %31 = OpFOrdGreaterThan %bool %30 %float_7_9000001 + %32 = OpLoad %float %a + %33 = OpFOrdLessThan %bool %32 %float_8_10000038 + %34 = OpLogicalAnd %bool %31 %33 + OpSelectionMerge %35 None + OpBranchConditional %34 %36 %37 + %36 = OpLabel + OpStore %_GLF_color %23 + OpBranch %35 + %37 = OpLabel + OpStore %_GLF_color %24 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..1b0d83de99 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.hlsl @@ -0,0 +1,34 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + const float x_27 = asfloat(x_6[0].x); + a = (2.0f / (1.0f / x_27)); + bool tint_tmp = (a > 7.900000095f); + if (tint_tmp) { + tint_tmp = (a < 8.100000381f); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..21d1062174 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float four; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float a = 0.0f; + float const x_27 = x_6.four; + a = (2.0f / (1.0f / x_27)); + float const x_30 = a; + float const x_32 = a; + if (((x_30 > 7.900000095f) && (x_32 < 8.100000381f))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..595ed70cff --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.spvasm @@ -0,0 +1,99 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "four" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 + %float_1 = OpConstant %float 1 +%float_7_9000001 = OpConstant %float 7.9000001 + %bool = OpTypeBool +%float_8_10000038 = OpConstant %float 8.10000038 + %float_0 = OpConstant %float 0 + %41 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %42 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %43 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %a = OpVariable %_ptr_Function_float Function %17 + %21 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %22 = OpLoad %float %21 + %25 = OpFDiv %float %float_1 %22 + %26 = OpFDiv %float %float_2 %25 + OpStore %a %26 + %27 = OpLoad %float %a + %28 = OpLoad %float %a + %30 = OpFOrdGreaterThan %bool %27 %float_7_9000001 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %32 + %33 = OpLabel + %35 = OpFOrdLessThan %bool %28 %float_8_10000038 + OpBranch %32 + %32 = OpLabel + %36 = OpPhi %bool %30 %14 %35 %33 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpStore %x_GLF_color %41 + OpBranch %37 + %39 = OpLabel + OpStore %x_GLF_color %42 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %43 +%tint_symbol = OpFunctionParameter %main_out + %47 = OpLabel + %48 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %48 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %50 = OpLabel + %51 = OpFunctionCall %void %main_1 + %53 = OpLoad %v4float %x_GLF_color + %54 = OpCompositeConstruct %main_out %53 + %52 = OpFunctionCall %void %tint_symbol_2 %54 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..8900821a38 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.spvasm.expected.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + four : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + let x_27 : f32 = x_6.four; + a = (2.0 / (1.0 / x_27)); + let x_30 : f32 = a; + let x_32 : f32 = a; + if (((x_30 > 7.900000095) && (x_32 < 8.100000381))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl new file mode 100644 index 0000000000..8900821a38 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + four : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + let x_27 : f32 = x_6.four; + a = (2.0 / (1.0 / x_27)); + let x_30 : f32 = a; + let x_32 : f32 = a; + if (((x_30 > 7.900000095) && (x_32 < 8.100000381))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..1b0d83de99 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + const float x_27 = asfloat(x_6[0].x); + a = (2.0f / (1.0f / x_27)); + bool tint_tmp = (a > 7.900000095f); + if (tint_tmp) { + tint_tmp = (a < 8.100000381f); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..21d1062174 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float four; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float a = 0.0f; + float const x_27 = x_6.four; + a = (2.0f / (1.0f / x_27)); + float const x_30 = a; + float const x_32 = a; + if (((x_30 > 7.900000095f) && (x_32 < 8.100000381f))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..595ed70cff --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.spvasm @@ -0,0 +1,99 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "four" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 + %float_1 = OpConstant %float 1 +%float_7_9000001 = OpConstant %float 7.9000001 + %bool = OpTypeBool +%float_8_10000038 = OpConstant %float 8.10000038 + %float_0 = OpConstant %float 0 + %41 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %42 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %43 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %a = OpVariable %_ptr_Function_float Function %17 + %21 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %22 = OpLoad %float %21 + %25 = OpFDiv %float %float_1 %22 + %26 = OpFDiv %float %float_2 %25 + OpStore %a %26 + %27 = OpLoad %float %a + %28 = OpLoad %float %a + %30 = OpFOrdGreaterThan %bool %27 %float_7_9000001 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %32 + %33 = OpLabel + %35 = OpFOrdLessThan %bool %28 %float_8_10000038 + OpBranch %32 + %32 = OpLabel + %36 = OpPhi %bool %30 %14 %35 %33 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpStore %x_GLF_color %41 + OpBranch %37 + %39 = OpLabel + OpStore %x_GLF_color %42 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %43 +%tint_symbol = OpFunctionParameter %main_out + %47 = OpLabel + %48 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %48 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %50 = OpLabel + %51 = OpFunctionCall %void %main_1 + %53 = OpLoad %v4float %x_GLF_color + %54 = OpCompositeConstruct %main_out %53 + %52 = OpFunctionCall %void %tint_symbol_2 %54 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..8900821a38 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-divs/0-opt.wgsl.expected.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + four : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + let x_27 : f32 = x_6.four; + a = (2.0 / (1.0 / x_27)); + let x_30 : f32 = a; + let x_32 : f32 = a; + if (((x_30 > 7.900000095) && (x_32 < 8.100000381))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm new file mode 100644 index 0000000000..07d5959ace --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm @@ -0,0 +1,63 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_4 = OpConstant %float 4 + %float_2 = OpConstant %float 2 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_7_9000001 = OpConstant %float 7.9000001 + %bool = OpTypeBool +%float_8_10000038 = OpConstant %float 8.10000038 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %25 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %26 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %27 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %28 = OpLoad %float %27 + %29 = OpFDiv %float %float_2 %28 + %30 = OpFMul %float %float_4 %29 + OpStore %f %30 + %31 = OpLoad %float %f + %32 = OpFOrdGreaterThan %bool %31 %float_7_9000001 + %33 = OpLoad %float %f + %34 = OpFOrdLessThan %bool %33 %float_8_10000038 + %35 = OpLogicalAnd %bool %32 %34 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %38 + %37 = OpLabel + OpStore %_GLF_color %24 + OpBranch %36 + %38 = OpLabel + OpStore %_GLF_color %25 + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..33b44f018e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.hlsl @@ -0,0 +1,34 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + const float x_28 = asfloat(x_6[0].x); + f = (4.0f * (2.0f / x_28)); + bool tint_tmp = (f > 7.900000095f); + if (tint_tmp) { + tint_tmp = (f < 8.100000381f); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..8ca949d062 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + float const x_28 = x_6.one; + f = (4.0f * (2.0f / x_28)); + float const x_31 = f; + float const x_33 = f; + if (((x_31 > 7.900000095f) && (x_33 < 8.100000381f))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..a3e6ce2610 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.spvasm @@ -0,0 +1,100 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_4 = OpConstant %float 4 + %float_2 = OpConstant %float 2 +%float_7_9000001 = OpConstant %float 7.9000001 + %bool = OpTypeBool +%float_8_10000038 = OpConstant %float 8.10000038 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %42 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %f = OpVariable %_ptr_Function_float Function %17 + %21 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %22 = OpLoad %float %21 + %25 = OpFDiv %float %float_2 %22 + %26 = OpFMul %float %float_4 %25 + OpStore %f %26 + %27 = OpLoad %float %f + %28 = OpLoad %float %f + %30 = OpFOrdGreaterThan %bool %27 %float_7_9000001 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %32 + %33 = OpLabel + %35 = OpFOrdLessThan %bool %28 %float_8_10000038 + OpBranch %32 + %32 = OpLabel + %36 = OpPhi %bool %30 %14 %35 %33 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpStore %x_GLF_color %42 + OpBranch %37 + %39 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %44 +%tint_symbol = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %51 = OpLabel + %52 = OpFunctionCall %void %main_1 + %54 = OpLoad %v4float %x_GLF_color + %55 = OpCompositeConstruct %main_out %54 + %53 = OpFunctionCall %void %tint_symbol_2 %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..fd79096df9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.spvasm.expected.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + let x_28 : f32 = x_6.one; + f = (4.0 * (2.0 / x_28)); + let x_31 : f32 = f; + let x_33 : f32 = f; + if (((x_31 > 7.900000095) && (x_33 < 8.100000381))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl new file mode 100644 index 0000000000..fd79096df9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + let x_28 : f32 = x_6.one; + f = (4.0 * (2.0 / x_28)); + let x_31 : f32 = f; + let x_33 : f32 = f; + if (((x_31 > 7.900000095) && (x_33 < 8.100000381))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..33b44f018e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + const float x_28 = asfloat(x_6[0].x); + f = (4.0f * (2.0f / x_28)); + bool tint_tmp = (f > 7.900000095f); + if (tint_tmp) { + tint_tmp = (f < 8.100000381f); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..8ca949d062 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + float const x_28 = x_6.one; + f = (4.0f * (2.0f / x_28)); + float const x_31 = f; + float const x_33 = f; + if (((x_31 > 7.900000095f) && (x_33 < 8.100000381f))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..a3e6ce2610 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.spvasm @@ -0,0 +1,100 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_4 = OpConstant %float 4 + %float_2 = OpConstant %float 2 +%float_7_9000001 = OpConstant %float 7.9000001 + %bool = OpTypeBool +%float_8_10000038 = OpConstant %float 8.10000038 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %42 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %f = OpVariable %_ptr_Function_float Function %17 + %21 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %22 = OpLoad %float %21 + %25 = OpFDiv %float %float_2 %22 + %26 = OpFMul %float %float_4 %25 + OpStore %f %26 + %27 = OpLoad %float %f + %28 = OpLoad %float %f + %30 = OpFOrdGreaterThan %bool %27 %float_7_9000001 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %32 + %33 = OpLabel + %35 = OpFOrdLessThan %bool %28 %float_8_10000038 + OpBranch %32 + %32 = OpLabel + %36 = OpPhi %bool %30 %14 %35 %33 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpStore %x_GLF_color %42 + OpBranch %37 + %39 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %44 +%tint_symbol = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %51 = OpLabel + %52 = OpFunctionCall %void %main_1 + %54 = OpLoad %v4float %x_GLF_color + %55 = OpCompositeConstruct %main_out %54 + %53 = OpFunctionCall %void %tint_symbol_2 %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd79096df9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-mul-div/0-opt.wgsl.expected.wgsl @@ -0,0 +1,33 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + let x_28 : f32 = x_6.one; + f = (4.0 * (2.0 / x_28)); + let x_31 : f32 = f; + let x_33 : f32 = f; + if (((x_31 > 7.900000095) && (x_33 < 8.100000381))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm new file mode 100644 index 0000000000..d72bc85cbd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm @@ -0,0 +1,85 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %b "b" + OpName %i "i" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpDecorate %i RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %false = OpConstantFalse %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %28 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %29 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %12 + %30 = OpLabel + %b = OpVariable %_ptr_Function_bool Function + %i = OpVariable %_ptr_Function_int Function + %a = OpVariable %_ptr_Function_float Function + OpStore %b %false + OpStore %i %int_1 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %7 = OpLoad %int %i + %35 = OpSGreaterThan %bool %7 %int_0 + OpBranchConditional %35 %36 %32 + %36 = OpLabel + %8 = OpLoad %int %i + %37 = OpConvertSToF %float %8 + %38 = OpFAdd %float %float_1 %37 + OpStore %a %38 + %39 = OpLoad %float %a + %40 = OpFSub %float %float_2 %39 + %41 = OpFOrdEqual %bool %40 %float_0 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpStore %b %true + OpBranch %42 + %42 = OpLabel + OpBranch %33 + %33 = OpLabel + %9 = OpLoad %int %i + %10 = OpISub %int %9 %int_1 + OpStore %i %10 + OpBranch %31 + %32 = OpLabel + %44 = OpLoad %bool %b + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + OpStore %_GLF_color %28 + OpBranch %45 + %47 = OpLabel + OpStore %_GLF_color %29 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..e7186613a7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.hlsl @@ -0,0 +1,37 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool b = false; + int i = 0; + float a = 0.0f; + b = false; + i = 1; + { + for(; (i > 0); i = (i - 1)) { + a = (1.0f + float(i)); + if (((2.0f - a) == 0.0f)) { + b = true; + } + } + } + if (b) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..1392c3bd90 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.msl @@ -0,0 +1,50 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool b = false; + int i = 0; + float a = 0.0f; + b = false; + i = 1; + while (true) { + int const x_7 = i; + if ((x_7 > 0)) { + } else { + break; + } + int const x_8 = i; + a = (1.0f + float(x_8)); + float const x_39 = a; + if (((2.0f - x_39) == 0.0f)) { + b = true; + } + { + int const x_9 = i; + i = (x_9 - 1); + } + } + bool const x_44 = b; + if (x_44) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8756e128df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.spvasm @@ -0,0 +1,118 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %b "b" + OpName %i "i" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %15 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpConstantNull %float + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %53 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %54 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %b = OpVariable %_ptr_Function_bool Function %15 + %i = OpVariable %_ptr_Function_int Function %19 + %a = OpVariable %_ptr_Function_float Function %22 + OpStore %b %false + OpStore %i %int_1 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %int %i + %31 = OpSGreaterThan %bool %29 %int_0 + OpSelectionMerge %32 None + OpBranchConditional %31 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %26 + %32 = OpLabel + %35 = OpLoad %int %i + %37 = OpConvertSToF %float %35 + %38 = OpFAdd %float %float_1 %37 + OpStore %a %38 + %39 = OpLoad %float %a + %41 = OpFSub %float %float_2 %39 + %43 = OpFOrdEqual %bool %41 %float_0 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + OpStore %b %true + OpBranch %44 + %44 = OpLabel + OpBranch %27 + %27 = OpLabel + %47 = OpLoad %int %i + %48 = OpISub %int %47 %int_1 + OpStore %i %48 + OpBranch %25 + %26 = OpLabel + %49 = OpLoad %bool %b + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + OpStore %x_GLF_color %53 + OpBranch %50 + %52 = OpLabel + OpStore %x_GLF_color %54 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..99ec59af35 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.spvasm.expected.wgsl @@ -0,0 +1,45 @@ +var x_GLF_color : vec4; + +fn main_1() { + var b : bool; + var i : i32; + var a : f32; + b = false; + i = 1; + loop { + let x_7 : i32 = i; + if ((x_7 > 0)) { + } else { + break; + } + let x_8 : i32 = i; + a = (1.0 + f32(x_8)); + let x_39 : f32 = a; + if (((2.0 - x_39) == 0.0)) { + b = true; + } + + continuing { + let x_9 : i32 = i; + i = (x_9 - 1); + } + } + let x_44 : bool = b; + if (x_44) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl new file mode 100644 index 0000000000..99ec59af35 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl @@ -0,0 +1,45 @@ +var x_GLF_color : vec4; + +fn main_1() { + var b : bool; + var i : i32; + var a : f32; + b = false; + i = 1; + loop { + let x_7 : i32 = i; + if ((x_7 > 0)) { + } else { + break; + } + let x_8 : i32 = i; + a = (1.0 + f32(x_8)); + let x_39 : f32 = a; + if (((2.0 - x_39) == 0.0)) { + b = true; + } + + continuing { + let x_9 : i32 = i; + i = (x_9 - 1); + } + } + let x_44 : bool = b; + if (x_44) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..e7186613a7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool b = false; + int i = 0; + float a = 0.0f; + b = false; + i = 1; + { + for(; (i > 0); i = (i - 1)) { + a = (1.0f + float(i)); + if (((2.0f - a) == 0.0f)) { + b = true; + } + } + } + if (b) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..1392c3bd90 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.msl @@ -0,0 +1,50 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool b = false; + int i = 0; + float a = 0.0f; + b = false; + i = 1; + while (true) { + int const x_7 = i; + if ((x_7 > 0)) { + } else { + break; + } + int const x_8 = i; + a = (1.0f + float(x_8)); + float const x_39 = a; + if (((2.0f - x_39) == 0.0f)) { + b = true; + } + { + int const x_9 = i; + i = (x_9 - 1); + } + } + bool const x_44 = b; + if (x_44) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8756e128df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.spvasm @@ -0,0 +1,118 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %b "b" + OpName %i "i" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %15 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpConstantNull %float + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %53 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %54 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %b = OpVariable %_ptr_Function_bool Function %15 + %i = OpVariable %_ptr_Function_int Function %19 + %a = OpVariable %_ptr_Function_float Function %22 + OpStore %b %false + OpStore %i %int_1 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %int %i + %31 = OpSGreaterThan %bool %29 %int_0 + OpSelectionMerge %32 None + OpBranchConditional %31 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %26 + %32 = OpLabel + %35 = OpLoad %int %i + %37 = OpConvertSToF %float %35 + %38 = OpFAdd %float %float_1 %37 + OpStore %a %38 + %39 = OpLoad %float %a + %41 = OpFSub %float %float_2 %39 + %43 = OpFOrdEqual %bool %41 %float_0 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + OpStore %b %true + OpBranch %44 + %44 = OpLabel + OpBranch %27 + %27 = OpLabel + %47 = OpLoad %int %i + %48 = OpISub %int %47 %int_1 + OpStore %i %48 + OpBranch %25 + %26 = OpLabel + %49 = OpLoad %bool %b + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + OpStore %x_GLF_color %53 + OpBranch %50 + %52 = OpLabel + OpStore %x_GLF_color %54 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..99ec59af35 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-add/0-opt.wgsl.expected.wgsl @@ -0,0 +1,45 @@ +var x_GLF_color : vec4; + +fn main_1() { + var b : bool; + var i : i32; + var a : f32; + b = false; + i = 1; + loop { + let x_7 : i32 = i; + if ((x_7 > 0)) { + } else { + break; + } + let x_8 : i32 = i; + a = (1.0 + f32(x_8)); + let x_39 : f32 = a; + if (((2.0 - x_39) == 0.0)) { + b = true; + } + + continuing { + let x_9 : i32 = i; + i = (x_9 - 1); + } + } + let x_44 : bool = b; + if (x_44) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm new file mode 100644 index 0000000000..966e0fce2e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm @@ -0,0 +1,86 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %b "b" + OpName %i "i" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpDecorate %i RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %false = OpConstantFalse %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_3 = OpConstant %float 3 + %float_2 = OpConstant %float 2 + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %30 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %12 + %31 = OpLabel + %b = OpVariable %_ptr_Function_bool Function + %i = OpVariable %_ptr_Function_int Function + %a = OpVariable %_ptr_Function_float Function + OpStore %b %false + OpStore %i %int_1 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %7 = OpLoad %int %i + %36 = OpSGreaterThan %bool %7 %int_0 + OpBranchConditional %36 %37 %33 + %37 = OpLabel + %8 = OpLoad %int %i + %38 = OpConvertSToF %float %8 + %39 = OpFSub %float %float_3 %38 + OpStore %a %39 + %40 = OpLoad %float %a + %41 = OpFSub %float %float_2 %40 + %42 = OpFOrdEqual %bool %41 %float_0 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpStore %b %true + OpBranch %43 + %43 = OpLabel + OpBranch %34 + %34 = OpLabel + %9 = OpLoad %int %i + %10 = OpISub %int %9 %int_1 + OpStore %i %10 + OpBranch %32 + %33 = OpLabel + %45 = OpLoad %bool %b + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpStore %_GLF_color %29 + OpBranch %46 + %48 = OpLabel + OpStore %_GLF_color %30 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..a2804a20f3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.hlsl @@ -0,0 +1,37 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool b = false; + int i = 0; + float a = 0.0f; + b = false; + i = 1; + { + for(; (i > 0); i = (i - 1)) { + a = (3.0f - float(i)); + if (((2.0f - a) == 0.0f)) { + b = true; + } + } + } + if (b) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..c2559b697a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.msl @@ -0,0 +1,50 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool b = false; + int i = 0; + float a = 0.0f; + b = false; + i = 1; + while (true) { + int const x_7 = i; + if ((x_7 > 0)) { + } else { + break; + } + int const x_8 = i; + a = (3.0f - float(x_8)); + float const x_40 = a; + if (((2.0f - x_40) == 0.0f)) { + b = true; + } + { + int const x_9 = i; + i = (x_9 - 1); + } + } + bool const x_45 = b; + if (x_45) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2c915e907c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.spvasm @@ -0,0 +1,119 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %b "b" + OpName %i "i" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %15 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpConstantNull %float + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %float_3 = OpConstant %float 3 + %float_2 = OpConstant %float 2 + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %54 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %55 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %56 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %b = OpVariable %_ptr_Function_bool Function %15 + %i = OpVariable %_ptr_Function_int Function %19 + %a = OpVariable %_ptr_Function_float Function %22 + OpStore %b %false + OpStore %i %int_1 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %int %i + %31 = OpSGreaterThan %bool %29 %int_0 + OpSelectionMerge %32 None + OpBranchConditional %31 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %26 + %32 = OpLabel + %35 = OpLoad %int %i + %37 = OpConvertSToF %float %35 + %38 = OpFSub %float %float_3 %37 + OpStore %a %38 + %39 = OpLoad %float %a + %41 = OpFSub %float %float_2 %39 + %43 = OpFOrdEqual %bool %41 %float_0 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + OpStore %b %true + OpBranch %44 + %44 = OpLabel + OpBranch %27 + %27 = OpLabel + %47 = OpLoad %int %i + %48 = OpISub %int %47 %int_1 + OpStore %i %48 + OpBranch %25 + %26 = OpLabel + %49 = OpLoad %bool %b + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + OpStore %x_GLF_color %54 + OpBranch %50 + %52 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %56 +%tint_symbol = OpFunctionParameter %main_out + %60 = OpLabel + %61 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %61 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %63 = OpLabel + %64 = OpFunctionCall %void %main_1 + %66 = OpLoad %v4float %x_GLF_color + %67 = OpCompositeConstruct %main_out %66 + %65 = OpFunctionCall %void %tint_symbol_2 %67 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..44ac190709 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.spvasm.expected.wgsl @@ -0,0 +1,45 @@ +var x_GLF_color : vec4; + +fn main_1() { + var b : bool; + var i : i32; + var a : f32; + b = false; + i = 1; + loop { + let x_7 : i32 = i; + if ((x_7 > 0)) { + } else { + break; + } + let x_8 : i32 = i; + a = (3.0 - f32(x_8)); + let x_40 : f32 = a; + if (((2.0 - x_40) == 0.0)) { + b = true; + } + + continuing { + let x_9 : i32 = i; + i = (x_9 - 1); + } + } + let x_45 : bool = b; + if (x_45) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl new file mode 100644 index 0000000000..44ac190709 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl @@ -0,0 +1,45 @@ +var x_GLF_color : vec4; + +fn main_1() { + var b : bool; + var i : i32; + var a : f32; + b = false; + i = 1; + loop { + let x_7 : i32 = i; + if ((x_7 > 0)) { + } else { + break; + } + let x_8 : i32 = i; + a = (3.0 - f32(x_8)); + let x_40 : f32 = a; + if (((2.0 - x_40) == 0.0)) { + b = true; + } + + continuing { + let x_9 : i32 = i; + i = (x_9 - 1); + } + } + let x_45 : bool = b; + if (x_45) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..a2804a20f3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool b = false; + int i = 0; + float a = 0.0f; + b = false; + i = 1; + { + for(; (i > 0); i = (i - 1)) { + a = (3.0f - float(i)); + if (((2.0f - a) == 0.0f)) { + b = true; + } + } + } + if (b) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..c2559b697a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.msl @@ -0,0 +1,50 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool b = false; + int i = 0; + float a = 0.0f; + b = false; + i = 1; + while (true) { + int const x_7 = i; + if ((x_7 > 0)) { + } else { + break; + } + int const x_8 = i; + a = (3.0f - float(x_8)); + float const x_40 = a; + if (((2.0f - x_40) == 0.0f)) { + b = true; + } + { + int const x_9 = i; + i = (x_9 - 1); + } + } + bool const x_45 = b; + if (x_45) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c915e907c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.spvasm @@ -0,0 +1,119 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %b "b" + OpName %i "i" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %15 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpConstantNull %float + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %float_3 = OpConstant %float 3 + %float_2 = OpConstant %float 2 + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %54 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %55 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %56 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %b = OpVariable %_ptr_Function_bool Function %15 + %i = OpVariable %_ptr_Function_int Function %19 + %a = OpVariable %_ptr_Function_float Function %22 + OpStore %b %false + OpStore %i %int_1 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %int %i + %31 = OpSGreaterThan %bool %29 %int_0 + OpSelectionMerge %32 None + OpBranchConditional %31 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %26 + %32 = OpLabel + %35 = OpLoad %int %i + %37 = OpConvertSToF %float %35 + %38 = OpFSub %float %float_3 %37 + OpStore %a %38 + %39 = OpLoad %float %a + %41 = OpFSub %float %float_2 %39 + %43 = OpFOrdEqual %bool %41 %float_0 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + OpStore %b %true + OpBranch %44 + %44 = OpLabel + OpBranch %27 + %27 = OpLabel + %47 = OpLoad %int %i + %48 = OpISub %int %47 %int_1 + OpStore %i %48 + OpBranch %25 + %26 = OpLabel + %49 = OpLoad %bool %b + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + OpStore %x_GLF_color %54 + OpBranch %50 + %52 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %56 +%tint_symbol = OpFunctionParameter %main_out + %60 = OpLabel + %61 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %61 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %63 = OpLabel + %64 = OpFunctionCall %void %main_1 + %66 = OpLoad %v4float %x_GLF_color + %67 = OpCompositeConstruct %main_out %66 + %65 = OpFunctionCall %void %tint_symbol_2 %67 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..44ac190709 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-sub-sub/0-opt.wgsl.expected.wgsl @@ -0,0 +1,45 @@ +var x_GLF_color : vec4; + +fn main_1() { + var b : bool; + var i : i32; + var a : f32; + b = false; + i = 1; + loop { + let x_7 : i32 = i; + if ((x_7 > 0)) { + } else { + break; + } + let x_8 : i32 = i; + a = (3.0 - f32(x_8)); + let x_40 : f32 = a; + if (((2.0 - x_40) == 0.0)) { + b = true; + } + + continuing { + let x_9 : i32 = i; + i = (x_9 - 1); + } + } + let x_45 : bool = b; + if (x_45) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm new file mode 100644 index 0000000000..eebf568351 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm @@ -0,0 +1,75 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "five" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %23 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %24 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %25 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %26 = OpLoad %int %25 + OpStore %i %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %int %i + %32 = OpSGreaterThan %bool %31 %int_0 + OpBranchConditional %32 %33 %28 + %33 = OpLabel + %34 = OpLoad %int %i + %35 = OpISub %int %34 %int_1 + OpStore %i %35 + %36 = OpLoad %int %i + %37 = OpISub %int %36 %int_1 + OpStore %i %37 + OpBranch %29 + %29 = OpLabel + OpBranch %27 + %28 = OpLabel + %38 = OpLoad %int %i + %39 = OpIEqual %bool %38 %int_n1 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %42 + %41 = OpLabel + OpStore %_GLF_color %22 + OpBranch %40 + %42 = OpLabel + OpStore %_GLF_color %23 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..b852869532 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.hlsl @@ -0,0 +1,38 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + const int x_26 = asint(x_6[0].x); + i = x_26; + while (true) { + if ((i > 0)) { + } else { + break; + } + i = (i - 1); + i = (i - 1); + } + if ((i == -1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..9138eca65b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int five; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + int const x_26 = x_6.five; + i = x_26; + while (true) { + int const x_31 = i; + if ((x_31 > 0)) { + } else { + break; + } + int const x_34 = i; + i = (x_34 - 1); + int const x_36 = i; + i = (x_36 - 1); + } + int const x_38 = i; + if ((x_38 == -1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..30086d1673 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.spvasm @@ -0,0 +1,114 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "five" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %49 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %i = OpVariable %_ptr_Function_int Function %18 + %22 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %23 = OpLoad %int %22 + OpStore %i %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %i + %30 = OpSGreaterThan %bool %28 %int_0 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %25 + %32 = OpLabel + %35 = OpLoad %int %i + %37 = OpISub %int %35 %int_1 + OpStore %i %37 + %38 = OpLoad %int %i + %39 = OpISub %int %38 %int_1 + OpStore %i %39 + OpBranch %26 + %26 = OpLabel + OpBranch %24 + %25 = OpLabel + %40 = OpLoad %int %i + %42 = OpIEqual %bool %40 %int_n1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + OpStore %x_GLF_color %48 + OpBranch %43 + %45 = OpLabel + OpStore %x_GLF_color %49 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %50 +%tint_symbol = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %57 = OpLabel + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_2 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b7d98c8aae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.spvasm.expected.wgsl @@ -0,0 +1,43 @@ +[[block]] +struct buf0 { + five : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + let x_26 : i32 = x_6.five; + i = x_26; + loop { + let x_31 : i32 = i; + if ((x_31 > 0)) { + } else { + break; + } + let x_34 : i32 = i; + i = (x_34 - 1); + let x_36 : i32 = i; + i = (x_36 - 1); + } + let x_38 : i32 = i; + if ((x_38 == -1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl new file mode 100644 index 0000000000..b7d98c8aae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl @@ -0,0 +1,43 @@ +[[block]] +struct buf0 { + five : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + let x_26 : i32 = x_6.five; + i = x_26; + loop { + let x_31 : i32 = i; + if ((x_31 > 0)) { + } else { + break; + } + let x_34 : i32 = i; + i = (x_34 - 1); + let x_36 : i32 = i; + i = (x_36 - 1); + } + let x_38 : i32 = i; + if ((x_38 == -1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..b852869532 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.hlsl @@ -0,0 +1,38 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + const int x_26 = asint(x_6[0].x); + i = x_26; + while (true) { + if ((i > 0)) { + } else { + break; + } + i = (i - 1); + i = (i - 1); + } + if ((i == -1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..9138eca65b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.msl @@ -0,0 +1,45 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int five; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + int const x_26 = x_6.five; + i = x_26; + while (true) { + int const x_31 = i; + if ((x_31 > 0)) { + } else { + break; + } + int const x_34 = i; + i = (x_34 - 1); + int const x_36 = i; + i = (x_36 - 1); + } + int const x_38 = i; + if ((x_38 == -1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..30086d1673 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.spvasm @@ -0,0 +1,114 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "five" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %49 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %i = OpVariable %_ptr_Function_int Function %18 + %22 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %23 = OpLoad %int %22 + OpStore %i %23 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %i + %30 = OpSGreaterThan %bool %28 %int_0 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %25 + %32 = OpLabel + %35 = OpLoad %int %i + %37 = OpISub %int %35 %int_1 + OpStore %i %37 + %38 = OpLoad %int %i + %39 = OpISub %int %38 %int_1 + OpStore %i %39 + OpBranch %26 + %26 = OpLabel + OpBranch %24 + %25 = OpLabel + %40 = OpLoad %int %i + %42 = OpIEqual %bool %40 %int_n1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + OpStore %x_GLF_color %48 + OpBranch %43 + %45 = OpLabel + OpStore %x_GLF_color %49 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %50 +%tint_symbol = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %57 = OpLabel + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_2 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b7d98c8aae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-merge-var-sub/0-opt.wgsl.expected.wgsl @@ -0,0 +1,43 @@ +[[block]] +struct buf0 { + five : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + let x_26 : i32 = x_6.five; + i = x_26; + loop { + let x_31 : i32 = i; + if ((x_31 > 0)) { + } else { + break; + } + let x_34 : i32 = i; + i = (x_34 - 1); + let x_36 : i32 = i; + i = (x_36 - 1); + } + let x_38 : i32 = i; + if ((x_38 == -1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm new file mode 100644 index 0000000000..8bdc7b1bcc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm @@ -0,0 +1,75 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v "v" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %d "d" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_5 = OpConstant %float 5 + %float_8 = OpConstant %float 8 +%float_n12_1999998 = OpConstant %float -12.1999998 + %16 = OpConstantComposite %v3float %float_5 %float_8 %float_n12_1999998 + %float_1 = OpConstant %float 1 +%float_4_9000001 = OpConstant %float 4.9000001 +%float_n2_0999999 = OpConstant %float -2.0999999 + %20 = OpConstantComposite %v3float %float_1 %float_4_9000001 %float_n2_0999999 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float +%float_0_100000001 = OpConstant %float 0.100000001 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %34 = OpLabel + %v = OpVariable %_ptr_Function_v3float Function + %d = OpVariable %_ptr_Function_float Function + %35 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %36 = OpLoad %float %35 + %37 = OpCompositeConstruct %v3float %36 %36 %36 + %38 = OpExtInst %v3float %1 FMix %16 %20 %37 + OpStore %v %38 + %39 = OpLoad %v3float %v + %40 = OpExtInst %float %1 Distance %39 %20 + OpStore %d %40 + %41 = OpLoad %float %d + %42 = OpFOrdLessThan %bool %41 %float_0_100000001 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + %46 = OpAccessChain %_ptr_Function_float %v %uint_0 + %47 = OpLoad %float %46 + %48 = OpCompositeConstruct %v4float %47 %float_0 %float_0 %float_1 + OpStore %_GLF_color %48 + OpBranch %43 + %45 = OpLabel + OpStore %_GLF_color %33 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..7a3d498fa5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.hlsl @@ -0,0 +1,33 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3 v = float3(0.0f, 0.0f, 0.0f); + float d = 0.0f; + const float x_36 = asfloat(x_6[0].x); + v = lerp(float3(5.0f, 8.0f, -12.199999809f), float3(1.0f, 4.900000095f, -2.099999905f), float3(x_36, x_36, x_36)); + d = distance(v, float3(1.0f, 4.900000095f, -2.099999905f)); + if ((d < 0.100000001f)) { + const float x_47 = v.x; + x_GLF_color = float4(x_47, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..02ce4045d3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float3 v = 0.0f; + float d = 0.0f; + float const x_36 = x_6.one; + v = mix(float3(5.0f, 8.0f, -12.199999809f), float3(1.0f, 4.900000095f, -2.099999905f), float3(x_36, x_36, x_36)); + float3 const x_39 = v; + d = distance(x_39, float3(1.0f, 4.900000095f, -2.099999905f)); + float const x_41 = d; + if ((x_41 < 0.100000001f)) { + float const x_47 = v.x; + *(tint_symbol_4) = float4(x_47, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..0427ed3441 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %28 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %d "d" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_5 = OpConstant %float 5 + %float_8 = OpConstant %float 8 +%float_n12_1999998 = OpConstant %float -12.1999998 + %32 = OpConstantComposite %v3float %float_5 %float_8 %float_n12_1999998 + %float_1 = OpConstant %float 1 +%float_4_9000001 = OpConstant %float 4.9000001 +%float_n2_0999999 = OpConstant %float -2.0999999 + %36 = OpConstantComposite %v3float %float_1 %float_4_9000001 %float_n2_0999999 +%float_0_100000001 = OpConstant %float 0.100000001 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %51 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %52 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %v = OpVariable %_ptr_Function_v3float Function %18 + %d = OpVariable %_ptr_Function_float Function %21 + %25 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %26 = OpLoad %float %25 + %37 = OpCompositeConstruct %v3float %26 %26 %26 + %27 = OpExtInst %v3float %28 FMix %32 %36 %37 + OpStore %v %27 + %38 = OpLoad %v3float %v + %39 = OpExtInst %float %28 Distance %38 %36 + OpStore %d %39 + %40 = OpLoad %float %d + %42 = OpFOrdLessThan %bool %40 %float_0_100000001 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + %47 = OpAccessChain %_ptr_Function_float %v %uint_0 + %48 = OpLoad %float %47 + %50 = OpCompositeConstruct %v4float %48 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %50 + OpBranch %44 + %46 = OpLabel + OpStore %x_GLF_color %51 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %52 +%tint_symbol = OpFunctionParameter %main_out + %56 = OpLabel + %57 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %57 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %59 = OpLabel + %60 = OpFunctionCall %void %main_1 + %62 = OpLoad %v4float %x_GLF_color + %63 = OpCompositeConstruct %main_out %62 + %61 = OpFunctionCall %void %tint_symbol_2 %63 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..39b846dc78 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec3; + var d : f32; + let x_36 : f32 = x_6.one; + v = mix(vec3(5.0, 8.0, -12.199999809), vec3(1.0, 4.900000095, -2.099999905), vec3(x_36, x_36, x_36)); + let x_39 : vec3 = v; + d = distance(x_39, vec3(1.0, 4.900000095, -2.099999905)); + let x_41 : f32 = d; + if ((x_41 < 0.100000001)) { + let x_47 : f32 = v.x; + x_GLF_color = vec4(x_47, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl new file mode 100644 index 0000000000..39b846dc78 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl @@ -0,0 +1,36 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec3; + var d : f32; + let x_36 : f32 = x_6.one; + v = mix(vec3(5.0, 8.0, -12.199999809), vec3(1.0, 4.900000095, -2.099999905), vec3(x_36, x_36, x_36)); + let x_39 : vec3 = v; + d = distance(x_39, vec3(1.0, 4.900000095, -2.099999905)); + let x_41 : f32 = d; + if ((x_41 < 0.100000001)) { + let x_47 : f32 = v.x; + x_GLF_color = vec4(x_47, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..7a3d498fa5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3 v = float3(0.0f, 0.0f, 0.0f); + float d = 0.0f; + const float x_36 = asfloat(x_6[0].x); + v = lerp(float3(5.0f, 8.0f, -12.199999809f), float3(1.0f, 4.900000095f, -2.099999905f), float3(x_36, x_36, x_36)); + d = distance(v, float3(1.0f, 4.900000095f, -2.099999905f)); + if ((d < 0.100000001f)) { + const float x_47 = v.x; + x_GLF_color = float4(x_47, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..02ce4045d3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float3 v = 0.0f; + float d = 0.0f; + float const x_36 = x_6.one; + v = mix(float3(5.0f, 8.0f, -12.199999809f), float3(1.0f, 4.900000095f, -2.099999905f), float3(x_36, x_36, x_36)); + float3 const x_39 = v; + d = distance(x_39, float3(1.0f, 4.900000095f, -2.099999905f)); + float const x_41 = d; + if ((x_41 < 0.100000001f)) { + float const x_47 = v.x; + *(tint_symbol_4) = float4(x_47, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..0427ed3441 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %28 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %d "d" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_5 = OpConstant %float 5 + %float_8 = OpConstant %float 8 +%float_n12_1999998 = OpConstant %float -12.1999998 + %32 = OpConstantComposite %v3float %float_5 %float_8 %float_n12_1999998 + %float_1 = OpConstant %float 1 +%float_4_9000001 = OpConstant %float 4.9000001 +%float_n2_0999999 = OpConstant %float -2.0999999 + %36 = OpConstantComposite %v3float %float_1 %float_4_9000001 %float_n2_0999999 +%float_0_100000001 = OpConstant %float 0.100000001 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %51 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %52 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %v = OpVariable %_ptr_Function_v3float Function %18 + %d = OpVariable %_ptr_Function_float Function %21 + %25 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %26 = OpLoad %float %25 + %37 = OpCompositeConstruct %v3float %26 %26 %26 + %27 = OpExtInst %v3float %28 FMix %32 %36 %37 + OpStore %v %27 + %38 = OpLoad %v3float %v + %39 = OpExtInst %float %28 Distance %38 %36 + OpStore %d %39 + %40 = OpLoad %float %d + %42 = OpFOrdLessThan %bool %40 %float_0_100000001 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + %47 = OpAccessChain %_ptr_Function_float %v %uint_0 + %48 = OpLoad %float %47 + %50 = OpCompositeConstruct %v4float %48 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %50 + OpBranch %44 + %46 = OpLabel + OpStore %x_GLF_color %51 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %52 +%tint_symbol = OpFunctionParameter %main_out + %56 = OpLabel + %57 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %57 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %59 = OpLabel + %60 = OpFunctionCall %void %main_1 + %62 = OpLoad %v4float %x_GLF_color + %63 = OpCompositeConstruct %main_out %62 + %61 = OpFunctionCall %void %tint_symbol_2 %63 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..39b846dc78 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-mix-uniform-weight/0-opt.wgsl.expected.wgsl @@ -0,0 +1,36 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec3; + var d : f32; + let x_36 : f32 = x_6.one; + v = mix(vec3(5.0, 8.0, -12.199999809), vec3(1.0, 4.900000095, -2.099999905), vec3(x_36, x_36, x_36)); + let x_39 : vec3 = v; + d = distance(x_39, vec3(1.0, 4.900000095, -2.099999905)); + let x_41 : f32 = d; + if ((x_41 < 0.100000001)) { + let x_47 : f32 = v.x; + x_GLF_color = vec4(x_47, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm new file mode 100644 index 0000000000..3b256087f8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm @@ -0,0 +1,57 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "four" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_n2 = OpConstant %int -2 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %24 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %10 + %25 = OpLabel + %26 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %6 = OpLoad %int %26 + %7 = OpSDiv %int %6 %int_2 + %8 = OpSNegate %int %7 + %27 = OpIEqual %bool %8 %int_n2 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %30 + %29 = OpLabel + OpStore %_GLF_color %23 + OpBranch %28 + %30 = OpLabel + OpStore %_GLF_color %24 + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..400828d13a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const int x_6 = asint(x_5[0].x); + if ((-((x_6 / 2)) == -2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..342ee1d30d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int four; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_6 = x_5.four; + if ((-((x_6 / 2)) == -2)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..10f5bab729 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "four" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_n2 = OpConstant %int -2 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %33 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %34 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %20 = OpLoad %int %19 + %23 = OpSDiv %int %20 %int_2 + %21 = OpSNegate %int %23 + %25 = OpIEqual %bool %21 %int_n2 + OpSelectionMerge %27 None + OpBranchConditional %25 %28 %29 + %28 = OpLabel + OpStore %x_GLF_color %32 + OpBranch %27 + %29 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %34 +%tint_symbol = OpFunctionParameter %main_out + %38 = OpLabel + %39 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %39 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %main_1 + %44 = OpLoad %v4float %x_GLF_color + %45 = OpCompositeConstruct %main_out %44 + %43 = OpFunctionCall %void %tint_symbol_2 %45 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..31222ff7b2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + four : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_6 : i32 = x_5.four; + if ((-((x_6 / 2)) == -2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl new file mode 100644 index 0000000000..31222ff7b2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + four : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_6 : i32 = x_5.four; + if ((-((x_6 / 2)) == -2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..400828d13a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const int x_6 = asint(x_5[0].x); + if ((-((x_6 / 2)) == -2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..342ee1d30d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int four; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_6 = x_5.four; + if ((-((x_6 / 2)) == -2)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..10f5bab729 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "four" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_n2 = OpConstant %int -2 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %33 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %34 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %20 = OpLoad %int %19 + %23 = OpSDiv %int %20 %int_2 + %21 = OpSNegate %int %23 + %25 = OpIEqual %bool %21 %int_n2 + OpSelectionMerge %27 None + OpBranchConditional %25 %28 %29 + %28 = OpLabel + OpStore %x_GLF_color %32 + OpBranch %27 + %29 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %34 +%tint_symbol = OpFunctionParameter %main_out + %38 = OpLabel + %39 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %39 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %41 = OpLabel + %42 = OpFunctionCall %void %main_1 + %44 = OpLoad %v4float %x_GLF_color + %45 = OpCompositeConstruct %main_out %44 + %43 = OpFunctionCall %void %tint_symbol_2 %45 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..31222ff7b2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-div/0-opt.wgsl.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + four : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_6 : i32 = x_5.four; + if ((-((x_6 / 2)) == -2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm new file mode 100644 index 0000000000..a73279faaf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm @@ -0,0 +1,58 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %x "x" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_5 = OpConstant %int 5 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_n4 = OpConstant %int -4 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %23 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %24 = OpLabel + %x = OpVariable %_ptr_Function_int Function + %25 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %26 = OpLoad %int %25 + %27 = OpISub %int %int_5 %26 + %28 = OpSNegate %int %27 + OpStore %x %28 + %29 = OpLoad %int %x + %30 = OpIEqual %bool %29 %int_n4 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + OpStore %_GLF_color %22 + OpBranch %31 + %33 = OpLabel + OpStore %_GLF_color %23 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..abdc55d02c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.hlsl @@ -0,0 +1,30 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x = 0; + const int x_26 = asint(x_6[0].x); + x = -((5 - x_26)); + if ((x == -4)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..ba9466131b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int x = 0; + int const x_26 = x_6.one; + x = -((5 - x_26)); + int const x_29 = x; + if ((x_29 == -4)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..567ae13af1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x "x" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %int_n4 = OpConstant %int -4 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %37 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x = OpVariable %_ptr_Function_int Function %18 + %22 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %23 = OpLoad %int %22 + %26 = OpISub %int %int_5 %23 + %24 = OpSNegate %int %26 + OpStore %x %24 + %27 = OpLoad %int %x + %29 = OpIEqual %bool %27 %int_n4 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpStore %x_GLF_color %36 + OpBranch %31 + %33 = OpLabel + OpStore %x_GLF_color %37 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %38 +%tint_symbol = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %main_1 + %48 = OpLoad %v4float %x_GLF_color + %49 = OpCompositeConstruct %main_out %48 + %47 = OpFunctionCall %void %tint_symbol_2 %49 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..73f36ea176 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x : i32; + let x_26 : i32 = x_6.one; + x = -((5 - x_26)); + let x_29 : i32 = x; + if ((x_29 == -4)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl new file mode 100644 index 0000000000..73f36ea176 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x : i32; + let x_26 : i32 = x_6.one; + x = -((5 - x_26)); + let x_29 : i32 = x; + if ((x_29 == -4)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..abdc55d02c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.hlsl @@ -0,0 +1,30 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x = 0; + const int x_26 = asint(x_6[0].x); + x = -((5 - x_26)); + if ((x == -4)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..ba9466131b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int x = 0; + int const x_26 = x_6.one; + x = -((5 - x_26)); + int const x_29 = x; + if ((x_29 == -4)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..567ae13af1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x "x" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %int_n4 = OpConstant %int -4 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %37 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x = OpVariable %_ptr_Function_int Function %18 + %22 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %23 = OpLoad %int %22 + %26 = OpISub %int %int_5 %23 + %24 = OpSNegate %int %26 + OpStore %x %24 + %27 = OpLoad %int %x + %29 = OpIEqual %bool %27 %int_n4 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpStore %x_GLF_color %36 + OpBranch %31 + %33 = OpLabel + OpStore %x_GLF_color %37 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %38 +%tint_symbol = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %main_1 + %48 = OpLoad %v4float %x_GLF_color + %49 = OpCompositeConstruct %main_out %48 + %47 = OpFunctionCall %void %tint_symbol_2 %49 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..73f36ea176 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-negate-sub/0-opt.wgsl.expected.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x : i32; + let x_26 : i32 = x_6.one; + x = -((5 - x_26)); + let x_29 : i32 = x; + if ((x_29 == -4)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm new file mode 100644 index 0000000000..a280ffecef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm @@ -0,0 +1,56 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %17 = OpConstantComposite %v2float %float_0 %float_0 + %18 = OpConstantComposite %v2float %float_0 %float_1 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %24 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %7 + %25 = OpLabel + %26 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %27 = OpLoad %v2float %26 + %28 = OpExtInst %v2float %1 FMix %27 %15 %17 + %29 = OpFOrdEqual %v2bool %28 %18 + %30 = OpAll %bool %29 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + OpStore %_GLF_color %23 + OpBranch %31 + %33 = OpLabel + OpStore %_GLF_color %24 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..6aca1c8431 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float2 x_27 = asfloat(x_5[0].xy); + if (all((lerp(x_27, float2(1.0f, 1.0f), float2(0.0f, 0.0f)) == float2(0.0f, 1.0f)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..945cd53139 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float2 const x_27 = x_5.injectionSwitch; + if (all((mix(x_27, float2(1.0f, 1.0f), float2(0.0f, 0.0f)) == float2(0.0f, 1.0f)))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f1fcd904bc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %24 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %26 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %28 = OpConstantComposite %v2float %float_0 %float_0 + %29 = OpConstantComposite %v2float %float_0 %float_1 + %v2bool = OpTypeVector %bool 2 + %35 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %36 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %37 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_v2float %x_5 %uint_0 + %20 = OpLoad %v2float %19 + %23 = OpExtInst %v2float %24 FMix %20 %26 %28 + %30 = OpFOrdEqual %v2bool %23 %29 + %21 = OpAll %bool %30 + OpSelectionMerge %32 None + OpBranchConditional %21 %33 %34 + %33 = OpLabel + OpStore %x_GLF_color %35 + OpBranch %32 + %34 = OpLabel + OpStore %x_GLF_color %36 + OpBranch %32 + %32 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %37 +%tint_symbol = OpFunctionParameter %main_out + %41 = OpLabel + %42 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %42 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %44 = OpLabel + %45 = OpFunctionCall %void %main_1 + %47 = OpLoad %v4float %x_GLF_color + %48 = OpCompositeConstruct %main_out %47 + %46 = OpFunctionCall %void %tint_symbol_2 %48 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..fcf7c4aa82 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_27 : vec2 = x_5.injectionSwitch; + if (all((mix(x_27, vec2(1.0, 1.0), vec2(0.0, 0.0)) == vec2(0.0, 1.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl new file mode 100644 index 0000000000..fcf7c4aa82 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_27 : vec2 = x_5.injectionSwitch; + if (all((mix(x_27, vec2(1.0, 1.0), vec2(0.0, 0.0)) == vec2(0.0, 1.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..6aca1c8431 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float2 x_27 = asfloat(x_5[0].xy); + if (all((lerp(x_27, float2(1.0f, 1.0f), float2(0.0f, 0.0f)) == float2(0.0f, 1.0f)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..945cd53139 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float2 const x_27 = x_5.injectionSwitch; + if (all((mix(x_27, float2(1.0f, 1.0f), float2(0.0f, 0.0f)) == float2(0.0f, 1.0f)))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f1fcd904bc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %24 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %26 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %28 = OpConstantComposite %v2float %float_0 %float_0 + %29 = OpConstantComposite %v2float %float_0 %float_1 + %v2bool = OpTypeVector %bool 2 + %35 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %36 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %37 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_v2float %x_5 %uint_0 + %20 = OpLoad %v2float %19 + %23 = OpExtInst %v2float %24 FMix %20 %26 %28 + %30 = OpFOrdEqual %v2bool %23 %29 + %21 = OpAll %bool %30 + OpSelectionMerge %32 None + OpBranchConditional %21 %33 %34 + %33 = OpLabel + OpStore %x_GLF_color %35 + OpBranch %32 + %34 = OpLabel + OpStore %x_GLF_color %36 + OpBranch %32 + %32 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %37 +%tint_symbol = OpFunctionParameter %main_out + %41 = OpLabel + %42 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %42 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %44 = OpLabel + %45 = OpFunctionCall %void %main_1 + %47 = OpLoad %v4float %x_GLF_color + %48 = OpCompositeConstruct %main_out %47 + %46 = OpFunctionCall %void %tint_symbol_2 %48 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..fcf7c4aa82 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-redundant-mix/0-opt.wgsl.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_27 : vec2 = x_5.injectionSwitch; + if (all((mix(x_27, vec2(1.0, 1.0), vec2(0.0, 0.0)) == vec2(0.0, 1.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm new file mode 100644 index 0000000000..6e30025664 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm @@ -0,0 +1,58 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %false = OpConstantFalse %bool + %19 = OpConstantComposite %v2bool %false %false + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %float_0 = OpConstant %float 0 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %26 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %7 + %27 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %29 = OpLoad %v2float %28 + %30 = OpSelect %v2float %19 %15 %29 + %31 = OpCompositeExtract %float %30 0 + %32 = OpFOrdEqual %bool %31 %float_0 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + OpStore %_GLF_color %25 + OpBranch %33 + %35 = OpLabel + OpStore %_GLF_color %26 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..563318c26e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float2 x_29 = asfloat(x_5[0].xy); + if (((bool2(false, false) ? float2(1.0f, 1.0f) : x_29).x == 0.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..2d5c01d249 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float2 const x_29 = x_5.injectionSwitch; + if ((select(x_29, float2(1.0f, 1.0f), bool2(false, false)).x == 0.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4d948301b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %false = OpConstantFalse %bool + %25 = OpConstantComposite %v2bool %false %false + %float_1 = OpConstant %float 1 + %27 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %34 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %36 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_v2float %x_5 %uint_0 + %20 = OpLoad %v2float %19 + %21 = OpSelect %v2float %25 %27 %20 + %28 = OpCompositeExtract %float %21 0 + %30 = OpFOrdEqual %bool %28 %float_0 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + OpStore %x_GLF_color %34 + OpBranch %31 + %33 = OpLabel + OpStore %x_GLF_color %35 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %36 +%tint_symbol = OpFunctionParameter %main_out + %40 = OpLabel + %41 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %41 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %43 = OpLabel + %44 = OpFunctionCall %void %main_1 + %46 = OpLoad %v4float %x_GLF_color + %47 = OpCompositeConstruct %main_out %46 + %45 = OpFunctionCall %void %tint_symbol_2 %47 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..790f1a1068 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_29 : vec2 = x_5.injectionSwitch; + if ((select(x_29, vec2(1.0, 1.0), vec2(false, false)).x == 0.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl new file mode 100644 index 0000000000..790f1a1068 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_29 : vec2 = x_5.injectionSwitch; + if ((select(x_29, vec2(1.0, 1.0), vec2(false, false)).x == 0.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..563318c26e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float2 x_29 = asfloat(x_5[0].xy); + if (((bool2(false, false) ? float2(1.0f, 1.0f) : x_29).x == 0.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..2d5c01d249 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float2 const x_29 = x_5.injectionSwitch; + if ((select(x_29, float2(1.0f, 1.0f), bool2(false, false)).x == 0.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4d948301b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.spvasm @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %false = OpConstantFalse %bool + %25 = OpConstantComposite %v2bool %false %false + %float_1 = OpConstant %float 1 + %27 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %34 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %36 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_v2float %x_5 %uint_0 + %20 = OpLoad %v2float %19 + %21 = OpSelect %v2float %25 %27 %20 + %28 = OpCompositeExtract %float %21 0 + %30 = OpFOrdEqual %bool %28 %float_0 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + OpStore %x_GLF_color %34 + OpBranch %31 + %33 = OpLabel + OpStore %x_GLF_color %35 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %36 +%tint_symbol = OpFunctionParameter %main_out + %40 = OpLabel + %41 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %41 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %43 = OpLabel + %44 = OpFunctionCall %void %main_1 + %46 = OpLoad %v4float %x_GLF_color + %47 = OpCompositeConstruct %main_out %46 + %45 = OpFunctionCall %void %tint_symbol_2 %47 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..790f1a1068 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-extract/0-opt.wgsl.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_29 : vec2 = x_5.injectionSwitch; + if ((select(x_29, vec2(1.0, 1.0), vec2(false, false)).x == 0.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm new file mode 100644 index 0000000000..d0b8717ae9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm @@ -0,0 +1,76 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v "v" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "threeandfour" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %16 = OpConstantComposite %v4float %float_2 %float_3 %float_4 %float_5 + %v2float = OpTypeVector %float 2 + %float_6 = OpConstant %float 6 + %19 = OpConstantComposite %v2float %float_2 %float_6 + %float_1 = OpConstant %float 1 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %31 = OpConstantComposite %v2bool %true %false + %32 = OpConstantComposite %v4float %float_1 %float_6 %float_4 %float_5 + %v4bool = OpTypeVector %bool 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %37 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %38 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + OpStore %v %16 + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %40 = OpLoad %float %39 + %41 = OpCompositeConstruct %v2float %float_1 %40 + %42 = OpSelect %v2float %31 %41 %19 + %43 = OpLoad %v4float %v + %44 = OpVectorShuffle %v4float %43 %42 4 5 2 3 + OpStore %v %44 + %45 = OpLoad %v4float %v + %46 = OpFOrdEqual %v4bool %45 %32 + %47 = OpAll %bool %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + OpStore %_GLF_color %36 + OpBranch %48 + %50 = OpLabel + OpStore %_GLF_color %37 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f11d3d72c9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.hlsl @@ -0,0 +1,33 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + v = float4(2.0f, 3.0f, 4.0f, 5.0f); + const float x_40 = asfloat(x_6[0].y); + const float2 x_42 = (bool2(true, false) ? float2(1.0f, x_40) : float2(2.0f, 6.0f)); + const float4 x_43 = v; + v = float4(x_42.x, x_42.y, x_43.z, x_43.w); + if (all((v == float4(1.0f, 6.0f, 4.0f, 5.0f)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..11c69992f6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 threeandfour; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + v = float4(2.0f, 3.0f, 4.0f, 5.0f); + float const x_40 = x_6.threeandfour.y; + float2 const x_42 = select(float2(2.0f, 6.0f), float2(1.0f, x_40), bool2(true, false)); + float4 const x_43 = v; + v = float4(x_42.x, x_42.y, x_43.z, x_43.w); + float4 const x_45 = v; + if (all((x_45 == float4(1.0f, 6.0f, 4.0f, 5.0f)))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..86501a3265 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "threeandfour" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %22 = OpConstantComposite %v4float %float_2 %float_3 %float_4 %float_5 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %34 = OpConstantComposite %v2bool %true %false + %float_1 = OpConstant %float 1 + %float_6 = OpConstant %float 6 + %38 = OpConstantComposite %v2float %float_2 %float_6 + %47 = OpConstantComposite %v4float %float_1 %float_6 %float_4 %float_5 + %v4bool = OpTypeVector %bool 4 + %float_0 = OpConstant %float 0 + %54 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %55 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %56 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %9 + OpStore %v %22 + %27 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %28 = OpLoad %float %27 + %36 = OpCompositeConstruct %v2float %float_1 %28 + %29 = OpSelect %v2float %34 %36 %38 + %39 = OpLoad %v4float %v + %40 = OpCompositeExtract %float %29 0 + %41 = OpCompositeExtract %float %29 1 + %42 = OpCompositeExtract %float %39 2 + %43 = OpCompositeExtract %float %39 3 + %44 = OpCompositeConstruct %v4float %40 %41 %42 %43 + OpStore %v %44 + %45 = OpLoad %v4float %v + %48 = OpFOrdEqual %v4bool %45 %47 + %46 = OpAll %bool %48 + OpSelectionMerge %50 None + OpBranchConditional %46 %51 %52 + %51 = OpLabel + OpStore %x_GLF_color %54 + OpBranch %50 + %52 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %56 +%tint_symbol = OpFunctionParameter %main_out + %60 = OpLabel + %61 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %61 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %63 = OpLabel + %64 = OpFunctionCall %void %main_1 + %66 = OpLoad %v4float %x_GLF_color + %67 = OpCompositeConstruct %main_out %66 + %65 = OpFunctionCall %void %tint_symbol_2 %67 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..8168671f0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.spvasm.expected.wgsl @@ -0,0 +1,35 @@ +[[block]] +struct buf0 { + threeandfour : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + v = vec4(2.0, 3.0, 4.0, 5.0); + let x_40 : f32 = x_6.threeandfour.y; + let x_42 : vec2 = select(vec2(2.0, 6.0), vec2(1.0, x_40), vec2(true, false)); + let x_43 : vec4 = v; + v = vec4(x_42.x, x_42.y, x_43.z, x_43.w); + let x_45 : vec4 = v; + if (all((x_45 == vec4(1.0, 6.0, 4.0, 5.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl new file mode 100644 index 0000000000..8168671f0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl @@ -0,0 +1,35 @@ +[[block]] +struct buf0 { + threeandfour : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + v = vec4(2.0, 3.0, 4.0, 5.0); + let x_40 : f32 = x_6.threeandfour.y; + let x_42 : vec2 = select(vec2(2.0, 6.0), vec2(1.0, x_40), vec2(true, false)); + let x_43 : vec4 = v; + v = vec4(x_42.x, x_42.y, x_43.z, x_43.w); + let x_45 : vec4 = v; + if (all((x_45 == vec4(1.0, 6.0, 4.0, 5.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f11d3d72c9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + v = float4(2.0f, 3.0f, 4.0f, 5.0f); + const float x_40 = asfloat(x_6[0].y); + const float2 x_42 = (bool2(true, false) ? float2(1.0f, x_40) : float2(2.0f, 6.0f)); + const float4 x_43 = v; + v = float4(x_42.x, x_42.y, x_43.z, x_43.w); + if (all((v == float4(1.0f, 6.0f, 4.0f, 5.0f)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..11c69992f6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 threeandfour; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + v = float4(2.0f, 3.0f, 4.0f, 5.0f); + float const x_40 = x_6.threeandfour.y; + float2 const x_42 = select(float2(2.0f, 6.0f), float2(1.0f, x_40), bool2(true, false)); + float4 const x_43 = v; + v = float4(x_42.x, x_42.y, x_43.z, x_43.w); + float4 const x_45 = v; + if (all((x_45 == float4(1.0f, 6.0f, 4.0f, 5.0f)))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..86501a3265 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "threeandfour" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %22 = OpConstantComposite %v4float %float_2 %float_3 %float_4 %float_5 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %34 = OpConstantComposite %v2bool %true %false + %float_1 = OpConstant %float 1 + %float_6 = OpConstant %float 6 + %38 = OpConstantComposite %v2float %float_2 %float_6 + %47 = OpConstantComposite %v4float %float_1 %float_6 %float_4 %float_5 + %v4bool = OpTypeVector %bool 4 + %float_0 = OpConstant %float 0 + %54 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %55 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %56 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %9 + OpStore %v %22 + %27 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %28 = OpLoad %float %27 + %36 = OpCompositeConstruct %v2float %float_1 %28 + %29 = OpSelect %v2float %34 %36 %38 + %39 = OpLoad %v4float %v + %40 = OpCompositeExtract %float %29 0 + %41 = OpCompositeExtract %float %29 1 + %42 = OpCompositeExtract %float %39 2 + %43 = OpCompositeExtract %float %39 3 + %44 = OpCompositeConstruct %v4float %40 %41 %42 %43 + OpStore %v %44 + %45 = OpLoad %v4float %v + %48 = OpFOrdEqual %v4bool %45 %47 + %46 = OpAll %bool %48 + OpSelectionMerge %50 None + OpBranchConditional %46 %51 %52 + %51 = OpLabel + OpStore %x_GLF_color %54 + OpBranch %50 + %52 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %56 +%tint_symbol = OpFunctionParameter %main_out + %60 = OpLabel + %61 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %61 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %63 = OpLabel + %64 = OpFunctionCall %void %main_1 + %66 = OpLoad %v4float %x_GLF_color + %67 = OpCompositeConstruct %main_out %66 + %65 = OpFunctionCall %void %tint_symbol_2 %67 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..8168671f0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-shuffle-mix/0-opt.wgsl.expected.wgsl @@ -0,0 +1,35 @@ +[[block]] +struct buf0 { + threeandfour : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + v = vec4(2.0, 3.0, 4.0, 5.0); + let x_40 : f32 = x_6.threeandfour.y; + let x_42 : vec2 = select(vec2(2.0, 6.0), vec2(1.0, x_40), vec2(true, false)); + let x_43 : vec4 = v; + v = vec4(x_42.x, x_42.y, x_43.z, x_43.w); + let x_45 : vec4 = v; + if (all((x_45 == vec4(1.0, 6.0, 4.0, 5.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm new file mode 100644 index 0000000000..5c12018cc2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm @@ -0,0 +1,51 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v "v" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v2float %float_1 %float_1 + %float_2 = OpConstant %float 2 + %14 = OpConstantComposite %v2float %float_2 %float_2 + %15 = OpConstantComposite %v4float %float_1 %float_1 %float_2 %float_2 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %20 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %6 + %22 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + %23 = OpLoad %v4float %v + %24 = OpVectorShuffle %v4float %23 %12 4 5 2 3 + OpStore %v %24 + %25 = OpLoad %v4float %v + %26 = OpVectorShuffle %v4float %25 %14 0 1 4 5 + OpStore %v %26 + %27 = OpLoad %v4float %v + %28 = OpFOrdEqual %v4bool %27 %15 + %29 = OpAll %bool %28 + OpSelectionMerge %30 None + OpBranchConditional %29 %31 %32 + %31 = OpLabel + OpStore %_GLF_color %20 + OpBranch %30 + %32 = OpLabel + OpStore %_GLF_color %21 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..274014d47b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.hlsl @@ -0,0 +1,29 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float4 x_23 = v; + v = float4(float2(1.0f, 1.0f).x, float2(1.0f, 1.0f).y, x_23.z, x_23.w); + const float4 x_25 = v; + v = float4(x_25.x, x_25.y, float2(2.0f, 2.0f).x, float2(2.0f, 2.0f).y); + if (all((v == float4(1.0f, 1.0f, 2.0f, 2.0f)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..df1620dca3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float4 v = 0.0f; + float4 const x_23 = v; + v = float4(float2(1.0f, 1.0f).x, float2(1.0f, 1.0f).y, x_23.z, x_23.w); + float4 const x_25 = v; + v = float4(x_25.x, x_25.y, float2(2.0f, 2.0f).x, float2(2.0f, 2.0f).y); + float4 const x_27 = v; + if (all((x_27 == float4(1.0f, 1.0f, 2.0f, 2.0f)))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e87aa5bc2d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 + %float_2 = OpConstant %float 2 + %27 = OpConstantComposite %v2float %float_2 %float_2 + %bool = OpTypeBool + %34 = OpConstantComposite %v4float %float_1 %float_1 %float_2 %float_2 + %v4bool = OpTypeVector %bool 4 + %float_0 = OpConstant %float 0 + %41 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %42 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %43 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %5 + %14 = OpLoad %v4float %v + %18 = OpCompositeExtract %float %17 0 + %19 = OpCompositeExtract %float %17 1 + %20 = OpCompositeExtract %float %14 2 + %21 = OpCompositeExtract %float %14 3 + %22 = OpCompositeConstruct %v4float %18 %19 %20 %21 + OpStore %v %22 + %23 = OpLoad %v4float %v + %24 = OpCompositeExtract %float %23 0 + %25 = OpCompositeExtract %float %23 1 + %28 = OpCompositeExtract %float %27 0 + %29 = OpCompositeExtract %float %27 1 + %30 = OpCompositeConstruct %v4float %24 %25 %28 %29 + OpStore %v %30 + %31 = OpLoad %v4float %v + %35 = OpFOrdEqual %v4bool %31 %34 + %32 = OpAll %bool %35 + OpSelectionMerge %37 None + OpBranchConditional %32 %38 %39 + %38 = OpLabel + OpStore %x_GLF_color %41 + OpBranch %37 + %39 = OpLabel + OpStore %x_GLF_color %42 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %43 +%tint_symbol = OpFunctionParameter %main_out + %47 = OpLabel + %48 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %48 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %50 = OpLabel + %51 = OpFunctionCall %void %main_1 + %53 = OpLoad %v4float %x_GLF_color + %54 = OpCompositeConstruct %main_out %53 + %52 = OpFunctionCall %void %tint_symbol_2 %54 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..13ebbb0471 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.spvasm.expected.wgsl @@ -0,0 +1,27 @@ +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + let x_23 : vec4 = v; + v = vec4(vec2(1.0, 1.0).x, vec2(1.0, 1.0).y, x_23.z, x_23.w); + let x_25 : vec4 = v; + v = vec4(x_25.x, x_25.y, vec2(2.0, 2.0).x, vec2(2.0, 2.0).y); + let x_27 : vec4 = v; + if (all((x_27 == vec4(1.0, 1.0, 2.0, 2.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl new file mode 100644 index 0000000000..13ebbb0471 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl @@ -0,0 +1,27 @@ +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + let x_23 : vec4 = v; + v = vec4(vec2(1.0, 1.0).x, vec2(1.0, 1.0).y, x_23.z, x_23.w); + let x_25 : vec4 = v; + v = vec4(x_25.x, x_25.y, vec2(2.0, 2.0).x, vec2(2.0, 2.0).y); + let x_27 : vec4 = v; + if (all((x_27 == vec4(1.0, 1.0, 2.0, 2.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..274014d47b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.hlsl @@ -0,0 +1,29 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float4 x_23 = v; + v = float4(float2(1.0f, 1.0f).x, float2(1.0f, 1.0f).y, x_23.z, x_23.w); + const float4 x_25 = v; + v = float4(x_25.x, x_25.y, float2(2.0f, 2.0f).x, float2(2.0f, 2.0f).y); + if (all((v == float4(1.0f, 1.0f, 2.0f, 2.0f)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..df1620dca3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float4 v = 0.0f; + float4 const x_23 = v; + v = float4(float2(1.0f, 1.0f).x, float2(1.0f, 1.0f).y, x_23.z, x_23.w); + float4 const x_25 = v; + v = float4(x_25.x, x_25.y, float2(2.0f, 2.0f).x, float2(2.0f, 2.0f).y); + float4 const x_27 = v; + if (all((x_27 == float4(1.0f, 1.0f, 2.0f, 2.0f)))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e87aa5bc2d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v2float %float_1 %float_1 + %float_2 = OpConstant %float 2 + %27 = OpConstantComposite %v2float %float_2 %float_2 + %bool = OpTypeBool + %34 = OpConstantComposite %v4float %float_1 %float_1 %float_2 %float_2 + %v4bool = OpTypeVector %bool 4 + %float_0 = OpConstant %float 0 + %41 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %42 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %43 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %5 + %14 = OpLoad %v4float %v + %18 = OpCompositeExtract %float %17 0 + %19 = OpCompositeExtract %float %17 1 + %20 = OpCompositeExtract %float %14 2 + %21 = OpCompositeExtract %float %14 3 + %22 = OpCompositeConstruct %v4float %18 %19 %20 %21 + OpStore %v %22 + %23 = OpLoad %v4float %v + %24 = OpCompositeExtract %float %23 0 + %25 = OpCompositeExtract %float %23 1 + %28 = OpCompositeExtract %float %27 0 + %29 = OpCompositeExtract %float %27 1 + %30 = OpCompositeConstruct %v4float %24 %25 %28 %29 + OpStore %v %30 + %31 = OpLoad %v4float %v + %35 = OpFOrdEqual %v4bool %31 %34 + %32 = OpAll %bool %35 + OpSelectionMerge %37 None + OpBranchConditional %32 %38 %39 + %38 = OpLabel + OpStore %x_GLF_color %41 + OpBranch %37 + %39 = OpLabel + OpStore %x_GLF_color %42 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %43 +%tint_symbol = OpFunctionParameter %main_out + %47 = OpLabel + %48 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %48 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %50 = OpLabel + %51 = OpFunctionCall %void %main_1 + %53 = OpLoad %v4float %x_GLF_color + %54 = OpCompositeConstruct %main_out %53 + %52 = OpFunctionCall %void %tint_symbol_2 %54 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..13ebbb0471 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-split-vector-init/0-opt.wgsl.expected.wgsl @@ -0,0 +1,27 @@ +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + let x_23 : vec4 = v; + v = vec4(vec2(1.0, 1.0).x, vec2(1.0, 1.0).y, x_23.z, x_23.w); + let x_25 : vec4 = v; + v = vec4(x_25.x, x_25.y, vec2(2.0, 2.0).x, vec2(2.0, 2.0).y); + let x_27 : vec4 = v; + if (all((x_27 == vec4(1.0, 1.0, 2.0, 2.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm new file mode 100644 index 0000000000..8876c3559f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm @@ -0,0 +1,79 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v "v" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zeroOne" + OpName %_ "" + OpName %d "d" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %15 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %18 = OpConstantComposite %v2float %float_4 %float_5 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantComposite %v2float %float_2 %float_5 +%float_0_100000001 = OpConstant %float 0.100000001 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %34 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %35 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function + %d = OpVariable %_ptr_Function_float Function + %36 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %37 = OpLoad %v2float %36 + %38 = OpExtInst %v2float %1 FMix %15 %18 %37 + OpStore %v %38 + %39 = OpLoad %v2float %v + %40 = OpExtInst %float %1 Distance %39 %24 + OpStore %d %40 + %41 = OpLoad %float %d + %42 = OpFOrdLessThan %bool %41 %float_0_100000001 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + %46 = OpAccessChain %_ptr_Function_float %v %uint_0 + %47 = OpLoad %float %46 + %48 = OpFSub %float %47 %float_1 + %49 = OpAccessChain %_ptr_Function_float %v %uint_1 + %50 = OpLoad %float %49 + %51 = OpFSub %float %50 %float_5 + %52 = OpCompositeConstruct %v4float %48 %51 %float_0 %float_1 + OpStore %_GLF_color %52 + OpBranch %43 + %45 = OpLabel + OpStore %_GLF_color %34 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..037715d2a7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.hlsl @@ -0,0 +1,34 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v = float2(0.0f, 0.0f); + float d = 0.0f; + const float2 x_37 = asfloat(x_6[0].xy); + v = lerp(float2(2.0f, 3.0f), float2(4.0f, 5.0f), x_37); + d = distance(v, float2(2.0f, 5.0f)); + if ((d < 0.100000001f)) { + const float x_47 = v.x; + const float x_50 = v.y; + x_GLF_color = float4((x_47 - 1.0f), (x_50 - 5.0f), 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..bea0ac6f8d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 zeroOne; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2 v = 0.0f; + float d = 0.0f; + float2 const x_37 = x_6.zeroOne; + v = mix(float2(2.0f, 3.0f), float2(4.0f, 5.0f), x_37); + float2 const x_39 = v; + d = distance(x_39, float2(2.0f, 5.0f)); + float const x_41 = d; + if ((x_41 < 0.100000001f)) { + float const x_47 = v.x; + float const x_50 = v.y; + *(tint_symbol_4) = float4((x_47 - 1.0f), (x_50 - 5.0f), 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..311c2d4cdc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.spvasm @@ -0,0 +1,111 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %28 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zeroOne" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %d "d" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %31 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %34 = OpConstantComposite %v2float %float_4 %float_5 + %37 = OpConstantComposite %v2float %float_2 %float_5 +%float_0_100000001 = OpConstant %float 0.100000001 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %55 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %56 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %18 + %d = OpVariable %_ptr_Function_float Function %21 + %25 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %26 = OpLoad %v2float %25 + %27 = OpExtInst %v2float %28 FMix %31 %34 %26 + OpStore %v %27 + %35 = OpLoad %v2float %v + %36 = OpExtInst %float %28 Distance %35 %37 + OpStore %d %36 + %38 = OpLoad %float %d + %40 = OpFOrdLessThan %bool %38 %float_0_100000001 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %44 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Function_float %v %uint_0 + %46 = OpLoad %float %45 + %48 = OpAccessChain %_ptr_Function_float %v %uint_1 + %49 = OpLoad %float %48 + %51 = OpFSub %float %46 %float_1 + %52 = OpFSub %float %49 %float_5 + %54 = OpCompositeConstruct %v4float %51 %52 %float_0 %float_1 + OpStore %x_GLF_color %54 + OpBranch %42 + %44 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %56 +%tint_symbol = OpFunctionParameter %main_out + %60 = OpLabel + %61 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %61 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %63 = OpLabel + %64 = OpFunctionCall %void %main_1 + %66 = OpLoad %v4float %x_GLF_color + %67 = OpCompositeConstruct %main_out %66 + %65 = OpFunctionCall %void %tint_symbol_2 %67 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..d0d096b73f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.spvasm.expected.wgsl @@ -0,0 +1,37 @@ +[[block]] +struct buf0 { + zeroOne : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec2; + var d : f32; + let x_37 : vec2 = x_6.zeroOne; + v = mix(vec2(2.0, 3.0), vec2(4.0, 5.0), x_37); + let x_39 : vec2 = v; + d = distance(x_39, vec2(2.0, 5.0)); + let x_41 : f32 = d; + if ((x_41 < 0.100000001)) { + let x_47 : f32 = v.x; + let x_50 : f32 = v.y; + x_GLF_color = vec4((x_47 - 1.0), (x_50 - 5.0), 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl new file mode 100644 index 0000000000..d0d096b73f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl @@ -0,0 +1,37 @@ +[[block]] +struct buf0 { + zeroOne : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec2; + var d : f32; + let x_37 : vec2 = x_6.zeroOne; + v = mix(vec2(2.0, 3.0), vec2(4.0, 5.0), x_37); + let x_39 : vec2 = v; + d = distance(x_39, vec2(2.0, 5.0)); + let x_41 : f32 = d; + if ((x_41 < 0.100000001)) { + let x_47 : f32 = v.x; + let x_50 : f32 = v.y; + x_GLF_color = vec4((x_47 - 1.0), (x_50 - 5.0), 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..037715d2a7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v = float2(0.0f, 0.0f); + float d = 0.0f; + const float2 x_37 = asfloat(x_6[0].xy); + v = lerp(float2(2.0f, 3.0f), float2(4.0f, 5.0f), x_37); + d = distance(v, float2(2.0f, 5.0f)); + if ((d < 0.100000001f)) { + const float x_47 = v.x; + const float x_50 = v.y; + x_GLF_color = float4((x_47 - 1.0f), (x_50 - 5.0f), 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..bea0ac6f8d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 zeroOne; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2 v = 0.0f; + float d = 0.0f; + float2 const x_37 = x_6.zeroOne; + v = mix(float2(2.0f, 3.0f), float2(4.0f, 5.0f), x_37); + float2 const x_39 = v; + d = distance(x_39, float2(2.0f, 5.0f)); + float const x_41 = d; + if ((x_41 < 0.100000001f)) { + float const x_47 = v.x; + float const x_50 = v.y; + *(tint_symbol_4) = float4((x_47 - 1.0f), (x_50 - 5.0f), 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..311c2d4cdc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.spvasm @@ -0,0 +1,111 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %28 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zeroOne" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %d "d" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %31 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %34 = OpConstantComposite %v2float %float_4 %float_5 + %37 = OpConstantComposite %v2float %float_2 %float_5 +%float_0_100000001 = OpConstant %float 0.100000001 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %55 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %56 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %18 + %d = OpVariable %_ptr_Function_float Function %21 + %25 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %26 = OpLoad %v2float %25 + %27 = OpExtInst %v2float %28 FMix %31 %34 %26 + OpStore %v %27 + %35 = OpLoad %v2float %v + %36 = OpExtInst %float %28 Distance %35 %37 + OpStore %d %36 + %38 = OpLoad %float %d + %40 = OpFOrdLessThan %bool %38 %float_0_100000001 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %44 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Function_float %v %uint_0 + %46 = OpLoad %float %45 + %48 = OpAccessChain %_ptr_Function_float %v %uint_1 + %49 = OpLoad %float %48 + %51 = OpFSub %float %46 %float_1 + %52 = OpFSub %float %49 %float_5 + %54 = OpCompositeConstruct %v4float %51 %52 %float_0 %float_1 + OpStore %x_GLF_color %54 + OpBranch %42 + %44 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %56 +%tint_symbol = OpFunctionParameter %main_out + %60 = OpLabel + %61 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %61 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %63 = OpLabel + %64 = OpFunctionCall %void %main_1 + %66 = OpLoad %v4float %x_GLF_color + %67 = OpCompositeConstruct %main_out %66 + %65 = OpFunctionCall %void %tint_symbol_2 %67 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..d0d096b73f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-folding-rules-vec-mix-uniform/0-opt.wgsl.expected.wgsl @@ -0,0 +1,37 @@ +[[block]] +struct buf0 { + zeroOne : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec2; + var d : f32; + let x_37 : vec2 = x_6.zeroOne; + v = mix(vec2(2.0, 3.0), vec2(4.0, 5.0), x_37); + let x_39 : vec2 = v; + d = distance(x_39, vec2(2.0, 5.0)); + let x_41 : f32 = d; + if ((x_41 < 0.100000001)) { + let x_47 : f32 = v.x; + let x_50 : f32 = v.y; + x_GLF_color = vec4((x_47 - 1.0), (x_50 - 5.0), 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm new file mode 100644 index 0000000000..183b491ce1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm @@ -0,0 +1,100 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %v2int = OpTypeVector %int 2 + %uint_1 = OpConstant %uint 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %30 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %a = OpVariable %_ptr_Function__arr_int_uint_2 Function + %31 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %32 = OpLoad %int %31 + OpStore %i %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %i + %38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpSLessThan %bool %37 %39 + OpBranchConditional %40 %41 %34 + %41 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %46 = OpLoad %int %45 + %47 = OpCompositeConstruct %v2int %int_3 %46 + %48 = OpCompositeConstruct %v2int %44 %44 + %49 = OpSMod %v2int %48 %47 + %50 = OpCompositeExtract %int %49 1 + %51 = OpCompositeConstruct %_arr_int_uint_2 %43 %50 + OpStore %a %51 + OpBranch %35 + %35 = OpLabel + %52 = OpLoad %int %i + %53 = OpIAdd %int %52 %int_1 + OpStore %i %53 + OpBranch %33 + %34 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Function_int %a %55 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpConvertSToF %float %63 + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Function_int %a %66 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %68 + %70 = OpCompositeConstruct %v4float %58 %61 %64 %69 + OpStore %_GLF_color %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2d00ef0af2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.hlsl @@ -0,0 +1,50 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int a[2] = (int[2])0; + const int x_32 = asint(x_6[2].x); + i = x_32; + while (true) { + const int x_37 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_39 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_37 < x_39)) { + } else { + break; + } + const int x_43 = asint(x_6[1].x); + const int x_44 = i; + const int x_46 = asint(x_6[3].x); + const int tint_symbol_3[2] = {x_43, (int2(x_44, x_44) % int2(3, x_46)).y}; + a = tint_symbol_3; + { + i = (i + 1); + } + } + const int x_55 = asint(x_6[2].x); + const int x_57 = a[x_55]; + const int x_60 = asint(x_6[1].x); + const int x_63 = asint(x_6[1].x); + const int x_66 = asint(x_6[2].x); + const int x_68 = a[x_66]; + x_GLF_color = float4(float(x_57), float(x_60), float(x_63), float(x_68)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..e614cff779 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5) { + int i = 0; + tint_array_wrapper_1 a = {}; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_32; + while (true) { + int const x_37 = i; + int const x_39 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_37 < x_39)) { + } else { + break; + } + int const x_43 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_44 = i; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[3].el; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_43, ((int2(x_44, x_44) % int2(3, x_46))).y}}; + a = tint_symbol_3; + { + int const x_52 = i; + i = (x_52 + 1); + } + } + int const x_55 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_57 = a.arr[x_55]; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_68 = a.arr[x_66]; + *(tint_symbol_5) = float4(float(x_57), float(x_60), float(x_63), float(x_68)); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..0d3cc7fd57 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.spvasm @@ -0,0 +1,139 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %26 = OpConstantNull %_arr_int_uint_2 + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %v2int = OpTypeVector %int 2 + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %a = OpVariable %_ptr_Function__arr_int_uint_2 Function %26 + %30 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %31 = OpLoad %int %30 + OpStore %i %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpSLessThan %bool %36 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %44 + %43 = OpLabel + OpBranch %42 + %44 = OpLabel + OpBranch %33 + %42 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpLoad %int %i + %50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %51 = OpLoad %int %50 + %53 = OpCompositeConstruct %v2int %48 %48 + %54 = OpCompositeConstruct %v2int %int_3 %51 + %55 = OpSMod %v2int %53 %54 + %56 = OpCompositeExtract %int %55 1 + %57 = OpCompositeConstruct %_arr_int_uint_2 %47 %56 + OpStore %a %57 + OpBranch %34 + %34 = OpLabel + %58 = OpLoad %int %i + %59 = OpIAdd %int %58 %int_1 + OpStore %i %59 + OpBranch %32 + %33 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Function_int %a %61 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Function_int %a %69 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %63 + %73 = OpConvertSToF %float %65 + %74 = OpConvertSToF %float %67 + %75 = OpConvertSToF %float %71 + %76 = OpCompositeConstruct %v4float %72 %73 %74 %75 + OpStore %x_GLF_color %76 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %77 +%tint_symbol = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %84 = OpLabel + %85 = OpFunctionCall %void %main_1 + %87 = OpLoad %v4float %x_GLF_color + %88 = OpCompositeConstruct %main_out %87 + %86 = OpFunctionCall %void %tint_symbol_2 %88 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..d60c9692fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.spvasm.expected.wgsl @@ -0,0 +1,53 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var a : array; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_32; + loop { + let x_37 : i32 = i; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_37 < x_39)) { + } else { + break; + } + let x_43 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_44 : i32 = i; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[3]; + a = array(x_43, ((vec2(x_44, x_44) % vec2(3, x_46))).y); + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_55 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_57 : i32 = a[x_55]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_68 : i32 = a[x_66]; + x_GLF_color = vec4(f32(x_57), f32(x_60), f32(x_63), f32(x_68)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl new file mode 100644 index 0000000000..d60c9692fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl @@ -0,0 +1,53 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var a : array; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_32; + loop { + let x_37 : i32 = i; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_37 < x_39)) { + } else { + break; + } + let x_43 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_44 : i32 = i; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[3]; + a = array(x_43, ((vec2(x_44, x_44) % vec2(3, x_46))).y); + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_55 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_57 : i32 = a[x_55]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_68 : i32 = a[x_66]; + x_GLF_color = vec4(f32(x_57), f32(x_60), f32(x_63), f32(x_68)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2d00ef0af2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.hlsl @@ -0,0 +1,50 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int a[2] = (int[2])0; + const int x_32 = asint(x_6[2].x); + i = x_32; + while (true) { + const int x_37 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_39 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_37 < x_39)) { + } else { + break; + } + const int x_43 = asint(x_6[1].x); + const int x_44 = i; + const int x_46 = asint(x_6[3].x); + const int tint_symbol_3[2] = {x_43, (int2(x_44, x_44) % int2(3, x_46)).y}; + a = tint_symbol_3; + { + i = (i + 1); + } + } + const int x_55 = asint(x_6[2].x); + const int x_57 = a[x_55]; + const int x_60 = asint(x_6[1].x); + const int x_63 = asint(x_6[1].x); + const int x_66 = asint(x_6[2].x); + const int x_68 = a[x_66]; + x_GLF_color = float4(float(x_57), float(x_60), float(x_63), float(x_68)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..e614cff779 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5) { + int i = 0; + tint_array_wrapper_1 a = {}; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_32; + while (true) { + int const x_37 = i; + int const x_39 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_37 < x_39)) { + } else { + break; + } + int const x_43 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_44 = i; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[3].el; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_43, ((int2(x_44, x_44) % int2(3, x_46))).y}}; + a = tint_symbol_3; + { + int const x_52 = i; + i = (x_52 + 1); + } + } + int const x_55 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_57 = a.arr[x_55]; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_68 = a.arr[x_66]; + *(tint_symbol_5) = float4(float(x_57), float(x_60), float(x_63), float(x_68)); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..0d3cc7fd57 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.spvasm @@ -0,0 +1,139 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %26 = OpConstantNull %_arr_int_uint_2 + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %v2int = OpTypeVector %int 2 + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %a = OpVariable %_ptr_Function__arr_int_uint_2 Function %26 + %30 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %31 = OpLoad %int %30 + OpStore %i %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpSLessThan %bool %36 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %44 + %43 = OpLabel + OpBranch %42 + %44 = OpLabel + OpBranch %33 + %42 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpLoad %int %i + %50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %51 = OpLoad %int %50 + %53 = OpCompositeConstruct %v2int %48 %48 + %54 = OpCompositeConstruct %v2int %int_3 %51 + %55 = OpSMod %v2int %53 %54 + %56 = OpCompositeExtract %int %55 1 + %57 = OpCompositeConstruct %_arr_int_uint_2 %47 %56 + OpStore %a %57 + OpBranch %34 + %34 = OpLabel + %58 = OpLoad %int %i + %59 = OpIAdd %int %58 %int_1 + OpStore %i %59 + OpBranch %32 + %33 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Function_int %a %61 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Function_int %a %69 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %63 + %73 = OpConvertSToF %float %65 + %74 = OpConvertSToF %float %67 + %75 = OpConvertSToF %float %71 + %76 = OpCompositeConstruct %v4float %72 %73 %74 %75 + OpStore %x_GLF_color %76 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %77 +%tint_symbol = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %84 = OpLabel + %85 = OpFunctionCall %void %main_1 + %87 = OpLoad %v4float %x_GLF_color + %88 = OpCompositeConstruct %main_out %87 + %86 = OpFunctionCall %void %tint_symbol_2 %88 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..d60c9692fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-array-initializing-modulo/0-opt.wgsl.expected.wgsl @@ -0,0 +1,53 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var a : array; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_32; + loop { + let x_37 : i32 = i; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_37 < x_39)) { + } else { + break; + } + let x_43 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_44 : i32 = i; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[3]; + a = array(x_43, ((vec2(x_44, x_44) % vec2(3, x_46))).y); + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_55 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_57 : i32 = a[x_55]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_68 : i32 = a[x_66]; + x_GLF_color = vec4(f32(x_57), f32(x_60), f32(x_63), f32(x_68)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm new file mode 100644 index 0000000000..1ac870746c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm @@ -0,0 +1,132 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %arr "arr" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_int = OpTypePointer Function %int +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %13 + %34 = OpLabel + %arr = OpVariable %_ptr_Function__arr_float_uint_3 Function + %i = OpVariable %_ptr_Function_int Function + %35 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %36 = OpLoad %float %35 + %37 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %40 = OpLoad %float %39 + %41 = OpCompositeConstruct %_arr_float_uint_3 %36 %38 %40 + OpStore %arr %41 + OpStore %i %int_1 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %int %i + %47 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %48 = OpLoad %int %47 + %49 = OpExtInst %int %1 SMin %48 %int_3 + %50 = OpSLessThan %bool %46 %49 + OpBranchConditional %50 %51 %43 + %51 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpAccessChain %_ptr_Function_float %arr %53 + %57 = OpLoad %float %56 + %58 = OpFAdd %float %57 %55 + %59 = OpAccessChain %_ptr_Function_float %arr %53 + OpStore %59 %58 + OpBranch %44 + %44 = OpLabel + %60 = OpLoad %int %i + %61 = OpIAdd %int %60 %int_1 + OpStore %i %61 + OpBranch %42 + %43 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Function_float %arr %63 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %67 = OpLoad %float %66 + %68 = OpFOrdEqual %bool %65 %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpConvertSToF %float %73 + %75 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %76 + %78 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %79 = OpLoad %int %78 + %80 = OpConvertSToF %float %79 + %81 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpConvertSToF %float %82 + %84 = OpCompositeConstruct %v4float %74 %77 %80 %83 + OpStore %_GLF_color %84 + OpBranch %69 + %71 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %86 + %88 = OpCompositeConstruct %v4float %87 %87 %87 %87 + OpStore %_GLF_color %88 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..15bbbf8460 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.hlsl @@ -0,0 +1,67 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float arr[3] = (float[3])0; + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_38 = asfloat(x_6[1].x); + const float x_40 = asfloat(x_6[2].x); + const float tint_symbol_4[3] = {x_36, x_38, x_40}; + arr = tint_symbol_4; + i = 1; + while (true) { + const int x_46 = i; + const int x_48 = asint(x_9[2].x); + if ((x_46 < min(x_48, 3))) { + } else { + break; + } + const int x_53 = asint(x_9[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_57 = arr[x_53]; + arr[x_53] = (x_57 + x_55); + { + i = (i + 1); + } + } + const int x_63 = asint(x_9[2].x); + const float x_65 = arr[x_63]; + const float x_67 = asfloat(x_6[3].x); + if ((x_65 == x_67)) { + const int x_73 = asint(x_9[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_76 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_79 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_82 = asint(x_9[1].x); + x_GLF_color = float4(float(x_73), float(x_76), float(x_79), float(x_82)); + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_86 = asint(x_9[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_87 = float(x_86); + x_GLF_color = float4(x_87, x_87, x_87, x_87); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..cd5d0e3aa1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5) { + tint_array_wrapper_2 arr = {}; + int i = 0; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_38 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_40 = x_6.x_GLF_uniform_float_values.arr[2].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_36, x_38, x_40}}; + arr = tint_symbol_3; + i = 1; + while (true) { + int const x_46 = i; + int const x_48 = x_9.x_GLF_uniform_int_values.arr[2].el; + if ((x_46 < min(x_48, 3))) { + } else { + break; + } + int const x_53 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_55 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_57 = arr.arr[x_53]; + arr.arr[x_53] = (x_57 + x_55); + { + int const x_60 = i; + i = (x_60 + 1); + } + } + int const x_63 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_65 = arr.arr[x_63]; + float const x_67 = x_6.x_GLF_uniform_float_values.arr[3].el; + if ((x_65 == x_67)) { + int const x_73 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_76 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_79 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_82 = x_9.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_5) = float4(float(x_73), float(x_76), float(x_79), float(x_82)); + } else { + int const x_86 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_87 = float(x_86); + *(tint_symbol_5) = float4(x_87, x_87, x_87, x_87); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4323c1e0d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.spvasm @@ -0,0 +1,174 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 109 +; Schema: 0 + OpCapability Shader + %52 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %arr "arr" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 + %27 = OpConstantNull %_arr_float_uint_3 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %97 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %arr = OpVariable %_ptr_Function__arr_float_uint_3 Function %27 + %i = OpVariable %_ptr_Function_int Function %30 + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %35 = OpLoad %float %34 + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %38 = OpLoad %float %37 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %41 = OpLoad %float %40 + %42 = OpCompositeConstruct %_arr_float_uint_3 %35 %38 %41 + OpStore %arr %42 + OpStore %i %int_1 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %47 = OpLoad %int %i + %49 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %50 = OpLoad %int %49 + %51 = OpExtInst %int %52 SMin %50 %int_3 + %54 = OpSLessThan %bool %47 %51 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %58 + %57 = OpLabel + OpBranch %56 + %58 = OpLabel + OpBranch %44 + %56 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %62 = OpLoad %float %61 + %64 = OpAccessChain %_ptr_Function_float %arr %60 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Function_float %arr %60 + %67 = OpFAdd %float %65 %62 + OpStore %66 %67 + OpBranch %45 + %45 = OpLabel + %68 = OpLoad %int %i + %69 = OpIAdd %int %68 %int_1 + OpStore %i %69 + OpBranch %43 + %44 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Function_float %arr %71 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %75 = OpLoad %float %74 + %76 = OpFOrdEqual %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpConvertSToF %float %81 + %89 = OpConvertSToF %float %83 + %90 = OpConvertSToF %float %85 + %91 = OpConvertSToF %float %87 + %92 = OpCompositeConstruct %v4float %88 %89 %90 %91 + OpStore %x_GLF_color %92 + OpBranch %77 + %79 = OpLabel + %93 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %94 = OpLoad %int %93 + %95 = OpConvertSToF %float %94 + %96 = OpCompositeConstruct %v4float %95 %95 %95 %95 + OpStore %x_GLF_color %96 + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %97 +%tint_symbol = OpFunctionParameter %main_out + %101 = OpLabel + %102 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %102 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %104 = OpLabel + %105 = OpFunctionCall %void %main_1 + %107 = OpLoad %v4float %x_GLF_color + %108 = OpCompositeConstruct %main_out %107 + %106 = OpFunctionCall %void %tint_symbol_2 %108 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..acc05e52ff --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.spvasm.expected.wgsl @@ -0,0 +1,72 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var i : i32; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[2]; + arr = array(x_36, x_38, x_40); + i = 1; + loop { + let x_46 : i32 = i; + let x_48 : i32 = x_9.x_GLF_uniform_int_values[2]; + if ((x_46 < min(x_48, 3))) { + } else { + break; + } + let x_53 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_57 : f32 = arr[x_53]; + arr[x_53] = (x_57 + x_55); + + continuing { + let x_60 : i32 = i; + i = (x_60 + 1); + } + } + let x_63 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_65 : f32 = arr[x_63]; + let x_67 : f32 = x_6.x_GLF_uniform_float_values[3]; + if ((x_65 == x_67)) { + let x_73 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_76 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_79 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_82 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_73), f32(x_76), f32(x_79), f32(x_82)); + } else { + let x_86 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_87 : f32 = f32(x_86); + x_GLF_color = vec4(x_87, x_87, x_87, x_87); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl new file mode 100644 index 0000000000..acc05e52ff --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl @@ -0,0 +1,72 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var i : i32; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[2]; + arr = array(x_36, x_38, x_40); + i = 1; + loop { + let x_46 : i32 = i; + let x_48 : i32 = x_9.x_GLF_uniform_int_values[2]; + if ((x_46 < min(x_48, 3))) { + } else { + break; + } + let x_53 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_57 : f32 = arr[x_53]; + arr[x_53] = (x_57 + x_55); + + continuing { + let x_60 : i32 = i; + i = (x_60 + 1); + } + } + let x_63 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_65 : f32 = arr[x_63]; + let x_67 : f32 = x_6.x_GLF_uniform_float_values[3]; + if ((x_65 == x_67)) { + let x_73 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_76 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_79 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_82 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_73), f32(x_76), f32(x_79), f32(x_82)); + } else { + let x_86 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_87 : f32 = f32(x_86); + x_GLF_color = vec4(x_87, x_87, x_87, x_87); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..15bbbf8460 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.hlsl @@ -0,0 +1,67 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float arr[3] = (float[3])0; + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_38 = asfloat(x_6[1].x); + const float x_40 = asfloat(x_6[2].x); + const float tint_symbol_4[3] = {x_36, x_38, x_40}; + arr = tint_symbol_4; + i = 1; + while (true) { + const int x_46 = i; + const int x_48 = asint(x_9[2].x); + if ((x_46 < min(x_48, 3))) { + } else { + break; + } + const int x_53 = asint(x_9[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_57 = arr[x_53]; + arr[x_53] = (x_57 + x_55); + { + i = (i + 1); + } + } + const int x_63 = asint(x_9[2].x); + const float x_65 = arr[x_63]; + const float x_67 = asfloat(x_6[3].x); + if ((x_65 == x_67)) { + const int x_73 = asint(x_9[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_76 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_79 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_82 = asint(x_9[1].x); + x_GLF_color = float4(float(x_73), float(x_76), float(x_79), float(x_82)); + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_86 = asint(x_9[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_87 = float(x_86); + x_GLF_color = float4(x_87, x_87, x_87, x_87); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..cd5d0e3aa1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5) { + tint_array_wrapper_2 arr = {}; + int i = 0; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_38 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_40 = x_6.x_GLF_uniform_float_values.arr[2].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_36, x_38, x_40}}; + arr = tint_symbol_3; + i = 1; + while (true) { + int const x_46 = i; + int const x_48 = x_9.x_GLF_uniform_int_values.arr[2].el; + if ((x_46 < min(x_48, 3))) { + } else { + break; + } + int const x_53 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_55 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_57 = arr.arr[x_53]; + arr.arr[x_53] = (x_57 + x_55); + { + int const x_60 = i; + i = (x_60 + 1); + } + } + int const x_63 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_65 = arr.arr[x_63]; + float const x_67 = x_6.x_GLF_uniform_float_values.arr[3].el; + if ((x_65 == x_67)) { + int const x_73 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_76 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_79 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_82 = x_9.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_5) = float4(float(x_73), float(x_76), float(x_79), float(x_82)); + } else { + int const x_86 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_87 = float(x_86); + *(tint_symbol_5) = float4(x_87, x_87, x_87, x_87); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4323c1e0d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.spvasm @@ -0,0 +1,174 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 109 +; Schema: 0 + OpCapability Shader + %52 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %arr "arr" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 + %27 = OpConstantNull %_arr_float_uint_3 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %97 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %arr = OpVariable %_ptr_Function__arr_float_uint_3 Function %27 + %i = OpVariable %_ptr_Function_int Function %30 + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %35 = OpLoad %float %34 + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %38 = OpLoad %float %37 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %41 = OpLoad %float %40 + %42 = OpCompositeConstruct %_arr_float_uint_3 %35 %38 %41 + OpStore %arr %42 + OpStore %i %int_1 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %47 = OpLoad %int %i + %49 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %50 = OpLoad %int %49 + %51 = OpExtInst %int %52 SMin %50 %int_3 + %54 = OpSLessThan %bool %47 %51 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %58 + %57 = OpLabel + OpBranch %56 + %58 = OpLabel + OpBranch %44 + %56 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %62 = OpLoad %float %61 + %64 = OpAccessChain %_ptr_Function_float %arr %60 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Function_float %arr %60 + %67 = OpFAdd %float %65 %62 + OpStore %66 %67 + OpBranch %45 + %45 = OpLabel + %68 = OpLoad %int %i + %69 = OpIAdd %int %68 %int_1 + OpStore %i %69 + OpBranch %43 + %44 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Function_float %arr %71 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %75 = OpLoad %float %74 + %76 = OpFOrdEqual %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpConvertSToF %float %81 + %89 = OpConvertSToF %float %83 + %90 = OpConvertSToF %float %85 + %91 = OpConvertSToF %float %87 + %92 = OpCompositeConstruct %v4float %88 %89 %90 %91 + OpStore %x_GLF_color %92 + OpBranch %77 + %79 = OpLabel + %93 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %94 = OpLoad %int %93 + %95 = OpConvertSToF %float %94 + %96 = OpCompositeConstruct %v4float %95 %95 %95 %95 + OpStore %x_GLF_color %96 + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %97 +%tint_symbol = OpFunctionParameter %main_out + %101 = OpLabel + %102 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %102 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %104 = OpLabel + %105 = OpFunctionCall %void %main_1 + %107 = OpLoad %v4float %x_GLF_color + %108 = OpCompositeConstruct %main_out %107 + %106 = OpFunctionCall %void %tint_symbol_2 %108 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..acc05e52ff --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-loop-min-increment-array-element/0-opt.wgsl.expected.wgsl @@ -0,0 +1,72 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var i : i32; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[2]; + arr = array(x_36, x_38, x_40); + i = 1; + loop { + let x_46 : i32 = i; + let x_48 : i32 = x_9.x_GLF_uniform_int_values[2]; + if ((x_46 < min(x_48, 3))) { + } else { + break; + } + let x_53 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_57 : f32 = arr[x_53]; + arr[x_53] = (x_57 + x_55); + + continuing { + let x_60 : i32 = i; + i = (x_60 + 1); + } + } + let x_63 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_65 : f32 = arr[x_63]; + let x_67 : f32 = x_6.x_GLF_uniform_float_values[3]; + if ((x_65 == x_67)) { + let x_73 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_76 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_79 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_82 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_73), f32(x_76), f32(x_79), f32(x_82)); + } else { + let x_86 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_87 : f32 = f32(x_86); + x_GLF_color = vec4(x_87, x_87, x_87, x_87); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm new file mode 100644 index 0000000000..6a84984b22 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm @@ -0,0 +1,107 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %24 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %25 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %26 = OpLoad %int %25 + OpStore %a %26 + %27 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %28 = OpLoad %int %27 + OpStore %i %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %i + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %35 = OpLoad %int %34 + %36 = OpSLessThan %bool %33 %35 + OpBranchConditional %36 %37 %30 + %37 = OpLabel + %38 = OpLoad %int %i + OpSelectionMerge %39 None + OpSwitch %38 %39 -1 %40 0 %40 + %40 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %42 = OpLoad %int %41 + OpStore %a %42 + OpBranch %39 + %39 = OpLabel + OpBranch %31 + %31 = OpLabel + %43 = OpLoad %int %i + %44 = OpIAdd %int %43 %int_1 + OpStore %i %44 + OpBranch %29 + %30 = OpLabel + %45 = OpLoad %int %a + %46 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpIEqual %bool %45 %47 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %56 = OpLoad %int %55 + %57 = OpConvertSToF %float %56 + %58 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpCompositeConstruct %v4float %54 %57 %60 %63 + OpStore %_GLF_color %64 + OpBranch %49 + %51 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + %68 = OpCompositeConstruct %v4float %67 %67 %67 %67 + OpStore %_GLF_color %68 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..40b4b79f67 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.hlsl @@ -0,0 +1,64 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const int x_26 = asint(x_6[2].x); + a = x_26; + const int x_28 = asint(x_6[2].x); + i = x_28; + while (true) { + const int x_33 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_35 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_33 < x_35)) { + } else { + break; + } + switch(i) { + case 0: + case -1: { + const int x_42 = asint(x_6[1].x); + a = x_42; + break; + } + default: { + break; + } + } + { + i = (i + 1); + } + } + const int x_45 = a; + const int x_47 = asint(x_6[1].x); + if ((x_45 == x_47)) { + const int x_53 = asint(x_6[1].x); + const int x_56 = asint(x_6[2].x); + const int x_59 = asint(x_6[2].x); + const int x_62 = asint(x_6[1].x); + x_GLF_color = float4(float(x_53), float(x_56), float(x_59), float(x_62)); + } else { + const int x_66 = asint(x_6[2].x); + const float x_67 = float(x_66); + x_GLF_color = float4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..cb70f17c46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int const x_26 = x_6.x_GLF_uniform_int_values.arr[2].el; + a = x_26; + int const x_28 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_28; + while (true) { + int const x_33 = i; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_33 < x_35)) { + } else { + break; + } + int const x_38 = i; + switch(x_38) { + case 0: + case -1: { + int const x_42 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_42; + break; + } + default: { + break; + } + } + { + int const x_43 = i; + i = (x_43 + 1); + } + } + int const x_45 = a; + int const x_47 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_45 == x_47)) { + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_59 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_53), float(x_56), float(x_59), float(x_62)); + } else { + int const x_66 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_67 = float(x_66); + *(tint_symbol_4) = float4(x_67, x_67, x_67, x_67); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..89156fde4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.spvasm @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 88 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %76 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %27 = OpLoad %int %26 + OpStore %a %27 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %29 = OpLoad %int %28 + OpStore %i %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpSLessThan %bool %34 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %31 + %40 = OpLabel + %43 = OpLoad %int %i + OpSelectionMerge %44 None + OpSwitch %43 %45 0 %46 -1 %46 + %46 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %49 = OpLoad %int %48 + OpStore %a %49 + OpBranch %44 + %45 = OpLabel + OpBranch %44 + %44 = OpLabel + OpBranch %32 + %32 = OpLabel + %50 = OpLoad %int %i + %51 = OpIAdd %int %50 %int_1 + OpStore %i %51 + OpBranch %30 + %31 = OpLabel + %52 = OpLoad %int %a + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %54 = OpLoad %int %53 + %55 = OpIEqual %bool %52 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %60 + %68 = OpConvertSToF %float %62 + %69 = OpConvertSToF %float %64 + %70 = OpConvertSToF %float %66 + %71 = OpCompositeConstruct %v4float %67 %68 %69 %70 + OpStore %x_GLF_color %71 + OpBranch %56 + %58 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %73 = OpLoad %int %72 + %74 = OpConvertSToF %float %73 + %75 = OpCompositeConstruct %v4float %74 %74 %74 %74 + OpStore %x_GLF_color %75 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %76 +%tint_symbol = OpFunctionParameter %main_out + %80 = OpLabel + %81 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %81 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %83 = OpLabel + %84 = OpFunctionCall %void %main_1 + %86 = OpLoad %v4float %x_GLF_color + %87 = OpCompositeConstruct %main_out %86 + %85 = OpFunctionCall %void %tint_symbol_2 %87 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5bce8a995a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.spvasm.expected.wgsl @@ -0,0 +1,66 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_26; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_28; + loop { + let x_33 : i32 = i; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_33 < x_35)) { + } else { + break; + } + let x_38 : i32 = i; + switch(x_38) { + case 0, -1: { + let x_42 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_42; + } + default: { + } + } + + continuing { + let x_43 : i32 = i; + i = (x_43 + 1); + } + } + let x_45 : i32 = a; + let x_47 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_45 == x_47)) { + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_53), f32(x_56), f32(x_59), f32(x_62)); + } else { + let x_66 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_67 : f32 = f32(x_66); + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl new file mode 100644 index 0000000000..5bce8a995a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl @@ -0,0 +1,66 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_26; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_28; + loop { + let x_33 : i32 = i; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_33 < x_35)) { + } else { + break; + } + let x_38 : i32 = i; + switch(x_38) { + case 0, -1: { + let x_42 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_42; + } + default: { + } + } + + continuing { + let x_43 : i32 = i; + i = (x_43 + 1); + } + } + let x_45 : i32 = a; + let x_47 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_45 == x_47)) { + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_53), f32(x_56), f32(x_59), f32(x_62)); + } else { + let x_66 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_67 : f32 = f32(x_66); + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..40b4b79f67 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.hlsl @@ -0,0 +1,64 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const int x_26 = asint(x_6[2].x); + a = x_26; + const int x_28 = asint(x_6[2].x); + i = x_28; + while (true) { + const int x_33 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_35 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_33 < x_35)) { + } else { + break; + } + switch(i) { + case 0: + case -1: { + const int x_42 = asint(x_6[1].x); + a = x_42; + break; + } + default: { + break; + } + } + { + i = (i + 1); + } + } + const int x_45 = a; + const int x_47 = asint(x_6[1].x); + if ((x_45 == x_47)) { + const int x_53 = asint(x_6[1].x); + const int x_56 = asint(x_6[2].x); + const int x_59 = asint(x_6[2].x); + const int x_62 = asint(x_6[1].x); + x_GLF_color = float4(float(x_53), float(x_56), float(x_59), float(x_62)); + } else { + const int x_66 = asint(x_6[2].x); + const float x_67 = float(x_66); + x_GLF_color = float4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..cb70f17c46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int const x_26 = x_6.x_GLF_uniform_int_values.arr[2].el; + a = x_26; + int const x_28 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_28; + while (true) { + int const x_33 = i; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_33 < x_35)) { + } else { + break; + } + int const x_38 = i; + switch(x_38) { + case 0: + case -1: { + int const x_42 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_42; + break; + } + default: { + break; + } + } + { + int const x_43 = i; + i = (x_43 + 1); + } + } + int const x_45 = a; + int const x_47 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_45 == x_47)) { + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_59 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_53), float(x_56), float(x_59), float(x_62)); + } else { + int const x_66 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_67 = float(x_66); + *(tint_symbol_4) = float4(x_67, x_67, x_67, x_67); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..89156fde4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.spvasm @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 88 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %76 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %27 = OpLoad %int %26 + OpStore %a %27 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %29 = OpLoad %int %28 + OpStore %i %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpSLessThan %bool %34 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %31 + %40 = OpLabel + %43 = OpLoad %int %i + OpSelectionMerge %44 None + OpSwitch %43 %45 0 %46 -1 %46 + %46 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %49 = OpLoad %int %48 + OpStore %a %49 + OpBranch %44 + %45 = OpLabel + OpBranch %44 + %44 = OpLabel + OpBranch %32 + %32 = OpLabel + %50 = OpLoad %int %i + %51 = OpIAdd %int %50 %int_1 + OpStore %i %51 + OpBranch %30 + %31 = OpLabel + %52 = OpLoad %int %a + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %54 = OpLoad %int %53 + %55 = OpIEqual %bool %52 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %60 + %68 = OpConvertSToF %float %62 + %69 = OpConvertSToF %float %64 + %70 = OpConvertSToF %float %66 + %71 = OpCompositeConstruct %v4float %67 %68 %69 %70 + OpStore %x_GLF_color %71 + OpBranch %56 + %58 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %73 = OpLoad %int %72 + %74 = OpConvertSToF %float %73 + %75 = OpCompositeConstruct %v4float %74 %74 %74 %74 + OpStore %x_GLF_color %75 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %76 +%tint_symbol = OpFunctionParameter %main_out + %80 = OpLabel + %81 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %81 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %83 = OpLabel + %84 = OpFunctionCall %void %main_1 + %86 = OpLoad %v4float %x_GLF_color + %87 = OpCompositeConstruct %main_out %86 + %85 = OpFunctionCall %void %tint_symbol_2 %87 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5bce8a995a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-for-switch-fallthrough/0-opt.wgsl.expected.wgsl @@ -0,0 +1,66 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_26; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_28; + loop { + let x_33 : i32 = i; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_33 < x_35)) { + } else { + break; + } + let x_38 : i32 = i; + switch(x_38) { + case 0, -1: { + let x_42 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_42; + } + default: { + } + } + + continuing { + let x_43 : i32 = i; + i = (x_43 + 1); + } + } + let x_45 : i32 = a; + let x_47 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_45 == x_47)) { + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_53), f32(x_56), f32(x_59), f32(x_62)); + } else { + let x_66 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_67 : f32 = f32(x_66); + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm new file mode 100644 index 0000000000..b22a5e5c0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm @@ -0,0 +1,97 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f0 "f0" + OpName %f1 "f1" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %14 + %34 = OpLabel + %f0 = OpVariable %_ptr_Function_float Function + %f1 = OpVariable %_ptr_Function_float Function + OpStore %f0 %float_0x1_8p_128 + %35 = OpLoad %float %f0 + %36 = OpExtInst %float %1 Fract %35 + OpStore %f1 %36 + %37 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpFOrdGreaterThan %bool %38 %40 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %44 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %49 + %51 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpCompositeConstruct %v4float %47 %50 %53 %56 + OpStore %_GLF_color %57 + OpBranch %42 + %44 = OpLabel + %58 = OpLoad %float %f1 + %59 = OpCompositeConstruct %v4float %58 %58 %58 %58 + OpStore %_GLF_color %59 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..8f9bef0fe9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.hlsl @@ -0,0 +1,50 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[2]; +}; + +void main_1() { + float f0 = 0.0f; + float f1 = 0.0f; + f0 = asfloat(0x7fc00000u); + f1 = frac(f0); + const float x_38 = gl_FragCoord.x; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_38 > x_40)) { + const int x_46 = asint(x_10[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_55 = asint(x_10[1].x); + x_GLF_color = float4(float(x_46), float(x_49), float(x_52), float(x_55)); + } else { + const float x_58 = f1; + x_GLF_color = float4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..0fb34b5163 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, constant buf1& x_10, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float f0 = 0.0f; + float f1 = 0.0f; + f0 = NAN; + float const x_35 = f0; + f1 = fract(x_35); + float const x_38 = (*(tint_symbol_5)).x; + float const x_40 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_38 > x_40)) { + int const x_46 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_49 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_52 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_55 = x_10.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_6) = float4(float(x_46), float(x_49), float(x_52), float(x_55)); + } else { + float const x_58 = f1; + *(tint_symbol_6) = float4(x_58, x_58, x_58, x_58); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, x_10, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2097959002 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.spvasm @@ -0,0 +1,135 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + %34 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %f0 "f0" + OpName %f1 "f1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %f0 = OpVariable %_ptr_Function_float Function %29 + %f1 = OpVariable %_ptr_Function_float Function %29 + OpStore %f0 %float_0x1_8p_128 + %32 = OpLoad %float %f0 + %33 = OpExtInst %float %34 Fract %32 + OpStore %f1 %33 + %37 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + %41 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpFOrdGreaterThan %bool %38 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %51 + %59 = OpConvertSToF %float %53 + %60 = OpConvertSToF %float %55 + %61 = OpConvertSToF %float %57 + %62 = OpCompositeConstruct %v4float %58 %59 %60 %61 + OpStore %x_GLF_color %62 + OpBranch %45 + %47 = OpLabel + %63 = OpLoad %float %f1 + %64 = OpCompositeConstruct %v4float %63 %63 %63 %63 + OpStore %x_GLF_color %64 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %65 +%tint_symbol_1 = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %72 = OpLabel + %73 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %73 + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_3 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..4f8be8c6dc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.spvasm.expected.wgsl @@ -0,0 +1,54 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_10 : buf1; + +fn main_1() { + var f0 : f32; + var f1 : f32; + f0 = 0x1.8p+128; + let x_35 : f32 = f0; + f1 = fract(x_35); + let x_38 : f32 = gl_FragCoord.x; + let x_40 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_38 > x_40)) { + let x_46 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_49 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_55 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_46), f32(x_49), f32(x_52), f32(x_55)); + } else { + let x_58 : f32 = f1; + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl new file mode 100644 index 0000000000..4f8be8c6dc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl @@ -0,0 +1,54 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_10 : buf1; + +fn main_1() { + var f0 : f32; + var f1 : f32; + f0 = 0x1.8p+128; + let x_35 : f32 = f0; + f1 = fract(x_35); + let x_38 : f32 = gl_FragCoord.x; + let x_40 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_38 > x_40)) { + let x_46 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_49 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_55 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_46), f32(x_49), f32(x_52), f32(x_55)); + } else { + let x_58 : f32 = f1; + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..560771bd68 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.hlsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl:26:11 error: expected ';' for assignment statement + f0 = 0x1.8p+128; + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..560771bd68 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.msl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl:26:11 error: expected ';' for assignment statement + f0 = 0x1.8p+128; + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..560771bd68 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.spvasm @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl:26:11 error: expected ';' for assignment statement + f0 = 0x1.8p+128; + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..560771bd68 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-fract-asin-undefined-never-used/0-opt.wgsl:26:11 error: expected ';' for assignment statement + f0 = 0x1.8p+128; + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm new file mode 100644 index 0000000000..a985dd63bf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm @@ -0,0 +1,101 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v1 "v1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %b "b" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %23 = OpConstantComposite %v2float %float_1 %float_1 + %uint_0 = OpConstant %uint 0 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %bool = OpTypeBool + %main = OpFunction %void None %11 + %28 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function + %b = OpVariable %_ptr_Function_v2float Function + %a = OpVariable %_ptr_Function_float Function + %29 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %30 = OpLoad %float %29 + %31 = OpCompositeConstruct %v2float %30 %30 + OpStore %v1 %31 + %32 = OpLoad %v2float %v1 + %33 = OpExtInst %v2float %1 Fract %32 + OpStore %b %33 + %34 = OpLoad %v2float %b + %35 = OpExtInst %v2float %1 SmoothStep %23 %23 %34 + %36 = OpCompositeExtract %float %35 0 + OpStore %a %36 + %37 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpLoad %float %a + %40 = OpLoad %float %a + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpCompositeConstruct %v4float %38 %39 %40 %42 + OpStore %_GLF_color %43 + %44 = OpAccessChain %_ptr_Function_float %b %uint_0 + %45 = OpLoad %float %44 + %46 = OpFOrdLessThan %bool %45 %float_1 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + %49 = OpAccessChain %_ptr_Function_float %b %uint_1 + %50 = OpLoad %float %49 + %51 = OpFOrdLessThan %bool %50 %float_1 + OpBranch %47 + %47 = OpLabel + %52 = OpPhi %bool %46 %28 %51 %48 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %57 = OpLoad %float %56 + %58 = OpAccessChain %_ptr_Function_float %b %uint_0 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Function_float %b %uint_1 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpCompositeConstruct %v4float %57 %59 %61 %63 + OpStore %_GLF_color %64 + OpBranch %53 + %55 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpCompositeConstruct %v4float %66 %66 %66 %66 + OpStore %_GLF_color %67 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..e520d49327 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.hlsl @@ -0,0 +1,60 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v1 = float2(0.0f, 0.0f); + float2 b = float2(0.0f, 0.0f); + float a = 0.0f; + bool x_51 = false; + bool x_52_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_30 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + v1 = float2(x_30, x_30); + b = frac(v1); + a = smoothstep(float2(1.0f, 1.0f), float2(1.0f, 1.0f), b).x; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_38 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_39 = a; + const float x_40 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_42 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(x_38, x_39, x_40, x_42); + const float x_45 = b.x; + const bool x_46 = (x_45 < 1.0f); + x_52_phi = x_46; + if (x_46) { + const float x_50 = b.y; + x_51 = (x_50 < 1.0f); + x_52_phi = x_51; + } + if (x_52_phi) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_57 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_59 = b.x; + const float x_61 = b.y; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_63 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(x_57, x_59, x_61, x_63); + } else { + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_66 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..18c63cf680 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.msl @@ -0,0 +1,67 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2 v1 = 0.0f; + float2 b = 0.0f; + float a = 0.0f; + bool x_51 = false; + bool x_52_phi = false; + float const x_30 = x_6.x_GLF_uniform_float_values.arr[0].el; + v1 = float2(x_30, x_30); + float2 const x_32 = v1; + b = fract(x_32); + float2 const x_34 = b; + a = smoothstep(float2(1.0f, 1.0f), float2(1.0f, 1.0f), x_34).x; + float const x_38 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_39 = a; + float const x_40 = a; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_38, x_39, x_40, x_42); + float const x_45 = b.x; + bool const x_46 = (x_45 < 1.0f); + x_52_phi = x_46; + if (x_46) { + float const x_50 = b.y; + x_51 = (x_50 < 1.0f); + x_52_phi = x_51; + } + bool const x_52 = x_52_phi; + if (x_52) { + float const x_57 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_59 = b.x; + float const x_61 = b.y; + float const x_63 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_57, x_59, x_61, x_63); + } else { + float const x_66 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_66, x_66, x_66, x_66); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8371f6825f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.spvasm @@ -0,0 +1,145 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 90 +; Schema: 0 + OpCapability Shader + %40 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v1 "v1" + OpName %b "b" + OpName %a "a" + OpName %x_51 "x_51" + OpName %x_52_phi "x_52_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %29 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %44 = OpConstantComposite %v2float %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %78 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function %21 + %b = OpVariable %_ptr_Function_v2float Function %21 + %a = OpVariable %_ptr_Function_float Function %25 + %x_51 = OpVariable %_ptr_Function_bool Function %29 + %x_52_phi = OpVariable %_ptr_Function_bool Function %29 + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %36 = OpLoad %float %35 + %37 = OpCompositeConstruct %v2float %36 %36 + OpStore %v1 %37 + %38 = OpLoad %v2float %v1 + %39 = OpExtInst %v2float %40 Fract %38 + OpStore %b %39 + %41 = OpLoad %v2float %b + %42 = OpExtInst %v2float %40 SmoothStep %44 %44 %41 + %45 = OpCompositeExtract %float %42 0 + OpStore %a %45 + %46 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpLoad %float %a + %49 = OpLoad %float %a + %50 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %51 = OpLoad %float %50 + %52 = OpCompositeConstruct %v4float %47 %48 %49 %51 + OpStore %x_GLF_color %52 + %53 = OpAccessChain %_ptr_Function_float %b %uint_0 + %54 = OpLoad %float %53 + %55 = OpFOrdLessThan %bool %54 %float_1 + OpStore %x_52_phi %55 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + %58 = OpAccessChain %_ptr_Function_float %b %uint_1 + %59 = OpLoad %float %58 + %60 = OpFOrdLessThan %bool %59 %float_1 + OpStore %x_51 %60 + %61 = OpLoad %bool %x_51 + OpStore %x_52_phi %61 + OpBranch %56 + %56 = OpLabel + %62 = OpLoad %bool %x_52_phi + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + %66 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %67 = OpLoad %float %66 + %68 = OpAccessChain %_ptr_Function_float %b %uint_0 + %69 = OpLoad %float %68 + %70 = OpAccessChain %_ptr_Function_float %b %uint_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %73 = OpLoad %float %72 + %74 = OpCompositeConstruct %v4float %67 %69 %71 %73 + OpStore %x_GLF_color %74 + OpBranch %63 + %65 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %76 = OpLoad %float %75 + %77 = OpCompositeConstruct %v4float %76 %76 %76 %76 + OpStore %x_GLF_color %77 + OpBranch %63 + %63 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %78 +%tint_symbol = OpFunctionParameter %main_out + %82 = OpLabel + %83 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %83 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %85 = OpLabel + %86 = OpFunctionCall %void %main_1 + %88 = OpLoad %v4float %x_GLF_color + %89 = OpCompositeConstruct %main_out %88 + %87 = OpFunctionCall %void %tint_symbol_2 %89 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..14326d34cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.spvasm.expected.wgsl @@ -0,0 +1,60 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec2; + var b : vec2; + var a : f32; + var x_51 : bool; + var x_52_phi : bool; + let x_30 : f32 = x_6.x_GLF_uniform_float_values[0]; + v1 = vec2(x_30, x_30); + let x_32 : vec2 = v1; + b = fract(x_32); + let x_34 : vec2 = b; + a = smoothStep(vec2(1.0, 1.0), vec2(1.0, 1.0), x_34).x; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_39 : f32 = a; + let x_40 : f32 = a; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_38, x_39, x_40, x_42); + let x_45 : f32 = b.x; + let x_46 : bool = (x_45 < 1.0); + x_52_phi = x_46; + if (x_46) { + let x_50 : f32 = b.y; + x_51 = (x_50 < 1.0); + x_52_phi = x_51; + } + let x_52 : bool = x_52_phi; + if (x_52) { + let x_57 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_59 : f32 = b.x; + let x_61 : f32 = b.y; + let x_63 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_57, x_59, x_61, x_63); + } else { + let x_66 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl new file mode 100644 index 0000000000..14326d34cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl @@ -0,0 +1,60 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec2; + var b : vec2; + var a : f32; + var x_51 : bool; + var x_52_phi : bool; + let x_30 : f32 = x_6.x_GLF_uniform_float_values[0]; + v1 = vec2(x_30, x_30); + let x_32 : vec2 = v1; + b = fract(x_32); + let x_34 : vec2 = b; + a = smoothStep(vec2(1.0, 1.0), vec2(1.0, 1.0), x_34).x; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_39 : f32 = a; + let x_40 : f32 = a; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_38, x_39, x_40, x_42); + let x_45 : f32 = b.x; + let x_46 : bool = (x_45 < 1.0); + x_52_phi = x_46; + if (x_46) { + let x_50 : f32 = b.y; + x_51 = (x_50 < 1.0); + x_52_phi = x_51; + } + let x_52 : bool = x_52_phi; + if (x_52) { + let x_57 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_59 : f32 = b.x; + let x_61 : f32 = b.y; + let x_63 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_57, x_59, x_61, x_63); + } else { + let x_66 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..e520d49327 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.hlsl @@ -0,0 +1,60 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v1 = float2(0.0f, 0.0f); + float2 b = float2(0.0f, 0.0f); + float a = 0.0f; + bool x_51 = false; + bool x_52_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_30 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + v1 = float2(x_30, x_30); + b = frac(v1); + a = smoothstep(float2(1.0f, 1.0f), float2(1.0f, 1.0f), b).x; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_38 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_39 = a; + const float x_40 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_42 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(x_38, x_39, x_40, x_42); + const float x_45 = b.x; + const bool x_46 = (x_45 < 1.0f); + x_52_phi = x_46; + if (x_46) { + const float x_50 = b.y; + x_51 = (x_50 < 1.0f); + x_52_phi = x_51; + } + if (x_52_phi) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_57 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_59 = b.x; + const float x_61 = b.y; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_63 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(x_57, x_59, x_61, x_63); + } else { + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_66 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..18c63cf680 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.msl @@ -0,0 +1,67 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2 v1 = 0.0f; + float2 b = 0.0f; + float a = 0.0f; + bool x_51 = false; + bool x_52_phi = false; + float const x_30 = x_6.x_GLF_uniform_float_values.arr[0].el; + v1 = float2(x_30, x_30); + float2 const x_32 = v1; + b = fract(x_32); + float2 const x_34 = b; + a = smoothstep(float2(1.0f, 1.0f), float2(1.0f, 1.0f), x_34).x; + float const x_38 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_39 = a; + float const x_40 = a; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_38, x_39, x_40, x_42); + float const x_45 = b.x; + bool const x_46 = (x_45 < 1.0f); + x_52_phi = x_46; + if (x_46) { + float const x_50 = b.y; + x_51 = (x_50 < 1.0f); + x_52_phi = x_51; + } + bool const x_52 = x_52_phi; + if (x_52) { + float const x_57 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_59 = b.x; + float const x_61 = b.y; + float const x_63 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_57, x_59, x_61, x_63); + } else { + float const x_66 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_66, x_66, x_66, x_66); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8371f6825f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.spvasm @@ -0,0 +1,145 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 90 +; Schema: 0 + OpCapability Shader + %40 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v1 "v1" + OpName %b "b" + OpName %a "a" + OpName %x_51 "x_51" + OpName %x_52_phi "x_52_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %29 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %44 = OpConstantComposite %v2float %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %78 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function %21 + %b = OpVariable %_ptr_Function_v2float Function %21 + %a = OpVariable %_ptr_Function_float Function %25 + %x_51 = OpVariable %_ptr_Function_bool Function %29 + %x_52_phi = OpVariable %_ptr_Function_bool Function %29 + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %36 = OpLoad %float %35 + %37 = OpCompositeConstruct %v2float %36 %36 + OpStore %v1 %37 + %38 = OpLoad %v2float %v1 + %39 = OpExtInst %v2float %40 Fract %38 + OpStore %b %39 + %41 = OpLoad %v2float %b + %42 = OpExtInst %v2float %40 SmoothStep %44 %44 %41 + %45 = OpCompositeExtract %float %42 0 + OpStore %a %45 + %46 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpLoad %float %a + %49 = OpLoad %float %a + %50 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %51 = OpLoad %float %50 + %52 = OpCompositeConstruct %v4float %47 %48 %49 %51 + OpStore %x_GLF_color %52 + %53 = OpAccessChain %_ptr_Function_float %b %uint_0 + %54 = OpLoad %float %53 + %55 = OpFOrdLessThan %bool %54 %float_1 + OpStore %x_52_phi %55 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + %58 = OpAccessChain %_ptr_Function_float %b %uint_1 + %59 = OpLoad %float %58 + %60 = OpFOrdLessThan %bool %59 %float_1 + OpStore %x_51 %60 + %61 = OpLoad %bool %x_51 + OpStore %x_52_phi %61 + OpBranch %56 + %56 = OpLabel + %62 = OpLoad %bool %x_52_phi + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + %66 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %67 = OpLoad %float %66 + %68 = OpAccessChain %_ptr_Function_float %b %uint_0 + %69 = OpLoad %float %68 + %70 = OpAccessChain %_ptr_Function_float %b %uint_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %73 = OpLoad %float %72 + %74 = OpCompositeConstruct %v4float %67 %69 %71 %73 + OpStore %x_GLF_color %74 + OpBranch %63 + %65 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %76 = OpLoad %float %75 + %77 = OpCompositeConstruct %v4float %76 %76 %76 %76 + OpStore %x_GLF_color %77 + OpBranch %63 + %63 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %78 +%tint_symbol = OpFunctionParameter %main_out + %82 = OpLabel + %83 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %83 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %85 = OpLabel + %86 = OpFunctionCall %void %main_1 + %88 = OpLoad %v4float %x_GLF_color + %89 = OpCompositeConstruct %main_out %88 + %87 = OpFunctionCall %void %tint_symbol_2 %89 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..14326d34cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fract-smoothstep-undefined/0-opt.wgsl.expected.wgsl @@ -0,0 +1,60 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec2; + var b : vec2; + var a : f32; + var x_51 : bool; + var x_52_phi : bool; + let x_30 : f32 = x_6.x_GLF_uniform_float_values[0]; + v1 = vec2(x_30, x_30); + let x_32 : vec2 = v1; + b = fract(x_32); + let x_34 : vec2 = b; + a = smoothStep(vec2(1.0, 1.0), vec2(1.0, 1.0), x_34).x; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_39 : f32 = a; + let x_40 : f32 = a; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_38, x_39, x_40, x_42); + let x_45 : f32 = b.x; + let x_46 : bool = (x_45 < 1.0); + x_52_phi = x_46; + if (x_46) { + let x_50 : f32 = b.y; + x_51 = (x_50 < 1.0); + x_52_phi = x_51; + } + let x_52 : bool = x_52_phi; + if (x_52) { + let x_57 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_59 : f32 = b.x; + let x_61 : f32 = b.y; + let x_63 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_57, x_59, x_61, x_63); + } else { + let x_66 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_66, x_66, x_66, x_66); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm new file mode 100644 index 0000000000..7a15382f08 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm @@ -0,0 +1,92 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %26 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %27 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %28 = OpLoad %float %27 + %29 = OpConvertFToS %int %28 + OpStore %a %29 + %30 = OpLoad %int %a + %31 = OpNot %int %30 + %32 = OpSLessThan %bool %31 %int_0 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %33 + %34 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %36 = OpLoad %int %35 + OpStore %a %36 + OpBranch %33 + %33 = OpLabel + %37 = OpLoad %int %a + %38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %39 = OpLoad %int %38 + %40 = OpIEqual %bool %37 %39 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %43 + %42 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %45 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %48 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %51 + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %54 + %56 = OpCompositeConstruct %v4float %46 %49 %52 %55 + OpStore %_GLF_color %56 + OpBranch %41 + %43 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpCompositeConstruct %v4float %59 %59 %59 %59 + OpStore %_GLF_color %60 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..0bc8372317 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.hlsl @@ -0,0 +1,51 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const float x_28 = gl_FragCoord.x; + a = int(x_28); + if ((~(a) < 0)) { + const int x_36 = asint(x_7[1].x); + a = x_36; + } + const int x_37 = a; + const int x_39 = asint(x_7[1].x); + if ((x_37 == x_39)) { + const int x_45 = asint(x_7[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_48 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_51 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_54 = asint(x_7[1].x); + x_GLF_color = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_58 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_59 = float(x_58); + x_GLF_color = float4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..98f78298f6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int a = 0; + float const x_28 = (*(tint_symbol_5)).x; + a = int(x_28); + int const x_30 = a; + if ((~(x_30) < 0)) { + int const x_36 = x_7.x_GLF_uniform_int_values.arr[1].el; + a = x_36; + } + int const x_37 = a; + int const x_39 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_37 == x_39)) { + int const x_45 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_48 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_51 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_54 = x_7.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_6) = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + } else { + int const x_58 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_59 = float(x_58); + *(tint_symbol_6) = float4(x_59, x_59, x_59, x_59); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..698e085814 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %a = OpVariable %_ptr_Function_int Function %24 + %27 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %28 = OpLoad %float %27 + %29 = OpConvertFToS %int %28 + OpStore %a %29 + %30 = OpLoad %int %a + %31 = OpNot %int %30 + %33 = OpSLessThan %bool %31 %int_0 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %40 = OpLoad %int %39 + OpStore %a %40 + OpBranch %35 + %35 = OpLabel + %41 = OpLoad %int %a + %42 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpIEqual %bool %41 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %49 + %57 = OpConvertSToF %float %51 + %58 = OpConvertSToF %float %53 + %59 = OpConvertSToF %float %55 + %60 = OpCompositeConstruct %v4float %56 %57 %58 %59 + OpStore %x_GLF_color %60 + OpBranch %45 + %47 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpCompositeConstruct %v4float %63 %63 %63 %63 + OpStore %x_GLF_color %64 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %65 +%tint_symbol_1 = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %72 = OpLabel + %73 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %73 + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_3 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b258d3f634 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.spvasm.expected.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_28 : f32 = gl_FragCoord.x; + a = i32(x_28); + let x_30 : i32 = a; + if ((~(x_30) < 0)) { + let x_36 : i32 = x_7.x_GLF_uniform_int_values[1]; + a = x_36; + } + let x_37 : i32 = a; + let x_39 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_37 == x_39)) { + let x_45 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_48 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_51 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_45), f32(x_48), f32(x_51), f32(x_54)); + } else { + let x_58 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_59 : f32 = f32(x_58); + x_GLF_color = vec4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl new file mode 100644 index 0000000000..b258d3f634 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_28 : f32 = gl_FragCoord.x; + a = i32(x_28); + let x_30 : i32 = a; + if ((~(x_30) < 0)) { + let x_36 : i32 = x_7.x_GLF_uniform_int_values[1]; + a = x_36; + } + let x_37 : i32 = a; + let x_39 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_37 == x_39)) { + let x_45 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_48 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_51 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_45), f32(x_48), f32(x_51), f32(x_54)); + } else { + let x_58 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_59 : f32 = f32(x_58); + x_GLF_color = vec4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..0bc8372317 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.hlsl @@ -0,0 +1,51 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const float x_28 = gl_FragCoord.x; + a = int(x_28); + if ((~(a) < 0)) { + const int x_36 = asint(x_7[1].x); + a = x_36; + } + const int x_37 = a; + const int x_39 = asint(x_7[1].x); + if ((x_37 == x_39)) { + const int x_45 = asint(x_7[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_48 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_51 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_54 = asint(x_7[1].x); + x_GLF_color = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_58 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_59 = float(x_58); + x_GLF_color = float4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..98f78298f6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int a = 0; + float const x_28 = (*(tint_symbol_5)).x; + a = int(x_28); + int const x_30 = a; + if ((~(x_30) < 0)) { + int const x_36 = x_7.x_GLF_uniform_int_values.arr[1].el; + a = x_36; + } + int const x_37 = a; + int const x_39 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_37 == x_39)) { + int const x_45 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_48 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_51 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_54 = x_7.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_6) = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + } else { + int const x_58 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_59 = float(x_58); + *(tint_symbol_6) = float4(x_59, x_59, x_59, x_59); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..698e085814 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %a = OpVariable %_ptr_Function_int Function %24 + %27 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %28 = OpLoad %float %27 + %29 = OpConvertFToS %int %28 + OpStore %a %29 + %30 = OpLoad %int %a + %31 = OpNot %int %30 + %33 = OpSLessThan %bool %31 %int_0 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %40 = OpLoad %int %39 + OpStore %a %40 + OpBranch %35 + %35 = OpLabel + %41 = OpLoad %int %a + %42 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpIEqual %bool %41 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %49 + %57 = OpConvertSToF %float %51 + %58 = OpConvertSToF %float %53 + %59 = OpConvertSToF %float %55 + %60 = OpCompositeConstruct %v4float %56 %57 %58 %59 + OpStore %x_GLF_color %60 + OpBranch %45 + %47 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpCompositeConstruct %v4float %63 %63 %63 %63 + OpStore %x_GLF_color %64 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %65 +%tint_symbol_1 = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %72 = OpLabel + %73 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %73 + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_3 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b258d3f634 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-bitwise-not/0-opt.wgsl.expected.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_28 : f32 = gl_FragCoord.x; + a = i32(x_28); + let x_30 : i32 = a; + if ((~(x_30) < 0)) { + let x_36 : i32 = x_7.x_GLF_uniform_int_values[1]; + a = x_36; + } + let x_37 : i32 = a; + let x_39 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_37 == x_39)) { + let x_45 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_48 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_51 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_45), f32(x_48), f32(x_51), f32(x_54)); + } else { + let x_58 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_59 : f32 = f32(x_58); + x_GLF_color = vec4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm new file mode 100644 index 0000000000..10cf8c5c26 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm @@ -0,0 +1,180 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %data "data" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %b "b" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %y "y" + OpName %gl_FragCoord "gl_FragCoord" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_ptr_Function__arr_v4float_uint_2 = OpTypePointer Function %_arr_v4float_uint_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %16 + %40 = OpLabel + %data = OpVariable %_ptr_Function__arr_v4float_uint_2 Function + %b = OpVariable %_ptr_Function_int Function + %y = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpCompositeConstruct %v4float %42 %42 %42 %42 + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %45 = OpLoad %float %44 + %46 = OpCompositeConstruct %v4float %45 %45 %45 %45 + %47 = OpCompositeConstruct %_arr_v4float_uint_2 %43 %46 + OpStore %data %47 + %48 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %49 = OpLoad %int %48 + OpStore %b %49 + %50 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %51 = OpLoad %float %50 + %52 = OpConvertFToS %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %56 = OpLoad %float %55 + %57 = OpConvertFToS %int %56 + %58 = OpBitwiseOr %int %54 %57 + %59 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpExtInst %int %1 SClamp %52 %58 %60 + OpStore %y %61 + %62 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %63 = OpLoad %int %62 + OpStore %i %63 + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %int %i + %69 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpSLessThan %bool %68 %70 + OpBranchConditional %71 %72 %65 + %72 = OpLabel + %73 = OpLoad %int %b + %74 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpSGreaterThan %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + %79 = OpLoad %int %y + %80 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpSGreaterThan %bool %79 %81 + OpBranch %77 + %77 = OpLabel + %83 = OpPhi %bool %76 %72 %82 %78 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %84 + %85 = OpLabel + OpBranch %65 + %84 = OpLabel + %86 = OpLoad %int %b + %87 = OpIAdd %int %86 %int_1 + OpStore %b %87 + OpBranch %66 + %66 = OpLabel + %88 = OpLoad %int %i + %89 = OpIAdd %int %88 %int_1 + OpStore %i %89 + OpBranch %64 + %65 = OpLabel + %90 = OpLoad %int %b + %91 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %92 = OpLoad %int %91 + %93 = OpIEqual %bool %90 %92 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %94 + %95 = OpLabel + %96 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %97 = OpLoad %int %96 + %98 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %101 = OpLoad %int %100 + %102 = OpExtInst %int %1 SClamp %97 %99 %101 + %103 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %104 = OpLoad %int %103 + %105 = OpConvertSToF %float %104 + %106 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %107 = OpLoad %int %106 + %108 = OpConvertSToF %float %107 + %109 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %110 = OpLoad %int %109 + %111 = OpConvertSToF %float %110 + %112 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %113 = OpLoad %int %112 + %114 = OpConvertSToF %float %113 + %115 = OpCompositeConstruct %v4float %105 %108 %111 %114 + %116 = OpAccessChain %_ptr_Function_v4float %data %102 + OpStore %116 %115 + OpBranch %94 + %94 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %118 = OpLoad %int %117 + %119 = OpAccessChain %_ptr_Function_v4float %data %118 + %120 = OpLoad %v4float %119 + %121 = OpCompositeExtract %float %120 0 + %122 = OpCompositeExtract %float %120 1 + %123 = OpCompositeExtract %float %120 2 + %124 = OpCompositeExtract %float %120 3 + %125 = OpCompositeConstruct %v4float %121 %122 %123 %124 + OpStore %_GLF_color %125 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2ab5b03f2d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.hlsl @@ -0,0 +1,95 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 data[2] = (float4[2])0; + int b = 0; + int y = 0; + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_42 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float4 tint_symbol_6[2] = {float4(x_42, x_42, x_42, x_42), float4(x_45, x_45, x_45, x_45)}; + data = tint_symbol_6; + const int x_49 = asint(x_10[1].x); + b = x_49; + const float x_51 = gl_FragCoord.y; + const int x_54 = asint(x_10[1].x); + const float x_56 = gl_FragCoord.y; + const int x_60 = asint(x_10[1].x); + y = clamp(int(x_51), (x_54 | int(x_56)), x_60); + const int x_63 = asint(x_10[1].x); + i = x_63; + while (true) { + bool x_82 = false; + bool x_83_phi = false; + const int x_68 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_70 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_68 < x_70)) { + } else { + break; + } + const int x_73 = b; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_75 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const bool x_76 = (x_73 > x_75); + x_83_phi = x_76; + if (x_76) { + const int x_79 = y; + const int x_81 = asint(x_10[1].x); + x_82 = (x_79 > x_81); + x_83_phi = x_82; + } + if (x_83_phi) { + break; + } + b = (b + 1); + { + i = (i + 1); + } + } + const int x_90 = b; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_92 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_90 == x_92)) { + const int x_97 = asint(x_10[2].x); + const int x_99 = asint(x_10[1].x); + const int x_101 = asint(x_10[3].x); + const int x_104 = asint(x_10[1].x); + const int x_107 = asint(x_10[2].x); + const int x_110 = asint(x_10[2].x); + const int x_113 = asint(x_10[1].x); + data[clamp(x_97, x_99, x_101)] = float4(float(x_104), float(x_107), float(x_110), float(x_113)); + } + const int x_118 = asint(x_10[1].x); + const float4 x_120 = data[x_118]; + x_GLF_color = float4(x_120.x, x_120.y, x_120.z, x_120.w); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..18db7a4573 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.msl @@ -0,0 +1,109 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float4 arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_10, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper_2 data = {}; + int b = 0; + int y = 0; + int i = 0; + float const x_42 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_45 = x_7.x_GLF_uniform_float_values.arr[0].el; + tint_array_wrapper_2 const tint_symbol_4 = {.arr={float4(x_42, x_42, x_42, x_42), float4(x_45, x_45, x_45, x_45)}}; + data = tint_symbol_4; + int const x_49 = x_10.x_GLF_uniform_int_values.arr[1].el; + b = x_49; + float const x_51 = (*(tint_symbol_6)).y; + int const x_54 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_56 = (*(tint_symbol_6)).y; + int const x_60 = x_10.x_GLF_uniform_int_values.arr[1].el; + y = clamp(int(x_51), (x_54 | int(x_56)), x_60); + int const x_63 = x_10.x_GLF_uniform_int_values.arr[1].el; + i = x_63; + while (true) { + bool x_82 = false; + bool x_83_phi = false; + int const x_68 = i; + int const x_70 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_68 < x_70)) { + } else { + break; + } + int const x_73 = b; + int const x_75 = x_10.x_GLF_uniform_int_values.arr[0].el; + bool const x_76 = (x_73 > x_75); + x_83_phi = x_76; + if (x_76) { + int const x_79 = y; + int const x_81 = x_10.x_GLF_uniform_int_values.arr[1].el; + x_82 = (x_79 > x_81); + x_83_phi = x_82; + } + bool const x_83 = x_83_phi; + if (x_83) { + break; + } + int const x_86 = b; + b = (x_86 + 1); + { + int const x_88 = i; + i = (x_88 + 1); + } + } + int const x_90 = b; + int const x_92 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_90 == x_92)) { + int const x_97 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_99 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_101 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_104 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_107 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_110 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_113 = x_10.x_GLF_uniform_int_values.arr[1].el; + data.arr[clamp(x_97, x_99, x_101)] = float4(float(x_104), float(x_107), float(x_110), float(x_113)); + } + int const x_118 = x_10.x_GLF_uniform_int_values.arr[1].el; + float4 const x_120 = data.arr[x_118]; + *(tint_symbol_7) = float4(x_120.x, x_120.y, x_120.z, x_120.w); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_7, x_10, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..7fc19f93df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.spvasm @@ -0,0 +1,236 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 153 +; Schema: 0 + OpCapability Shader + %61 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %data "data" + OpName %b "b" + OpName %y "y" + OpName %i "i" + OpName %x_82 "x_82" + OpName %x_83_phi "x_83_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_ptr_Function__arr_v4float_uint_2 = OpTypePointer Function %_arr_v4float_uint_2 + %31 = OpConstantNull %_arr_v4float_uint_2 +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Private_float = OpTypePointer Private %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %74 = OpConstantNull %bool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %140 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %data = OpVariable %_ptr_Function__arr_v4float_uint_2 Function %31 + %b = OpVariable %_ptr_Function_int Function %34 + %y = OpVariable %_ptr_Function_int Function %34 + %i = OpVariable %_ptr_Function_int Function %34 + %x_82 = OpVariable %_ptr_Function_bool Function %74 + %x_83_phi = OpVariable %_ptr_Function_bool Function %74 + %40 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %43 = OpLoad %float %42 + %44 = OpCompositeConstruct %v4float %41 %41 %41 %41 + %45 = OpCompositeConstruct %v4float %43 %43 %43 %43 + %46 = OpCompositeConstruct %_arr_v4float_uint_2 %44 %45 + OpStore %data %46 + %49 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %50 = OpLoad %int %49 + OpStore %b %50 + %52 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %53 = OpLoad %float %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %57 = OpLoad %float %56 + %58 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %59 = OpLoad %int %58 + %62 = OpConvertFToS %int %53 + %63 = OpConvertFToS %int %57 + %64 = OpBitwiseOr %int %55 %63 + %60 = OpExtInst %int %61 SClamp %62 %64 %59 + OpStore %y %60 + %65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %66 = OpLoad %int %65 + OpStore %i %66 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %76 = OpLoad %int %i + %77 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %78 = OpLoad %int %77 + %79 = OpSLessThan %bool %76 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + OpBranch %80 + %82 = OpLabel + OpBranch %68 + %80 = OpLabel + %83 = OpLoad %int %b + %84 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpSGreaterThan %bool %83 %85 + OpStore %x_83_phi %86 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %87 + %88 = OpLabel + %89 = OpLoad %int %y + %90 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %91 = OpLoad %int %90 + %92 = OpSGreaterThan %bool %89 %91 + OpStore %x_82 %92 + %93 = OpLoad %bool %x_82 + OpStore %x_83_phi %93 + OpBranch %87 + %87 = OpLabel + %94 = OpLoad %bool %x_83_phi + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + OpBranch %68 + %95 = OpLabel + %97 = OpLoad %int %b + %98 = OpIAdd %int %97 %int_1 + OpStore %b %98 + OpBranch %69 + %69 = OpLabel + %99 = OpLoad %int %i + %100 = OpIAdd %int %99 %int_1 + OpStore %i %100 + OpBranch %67 + %68 = OpLabel + %101 = OpLoad %int %b + %102 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %103 = OpLoad %int %102 + %104 = OpIEqual %bool %101 %103 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %105 + %106 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %111 = OpLoad %int %110 + %113 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %114 = OpLoad %int %113 + %115 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %116 = OpLoad %int %115 + %117 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %118 = OpLoad %int %117 + %119 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %120 = OpLoad %int %119 + %121 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %122 = OpLoad %int %121 + %123 = OpExtInst %int %61 SClamp %109 %111 %114 + %125 = OpAccessChain %_ptr_Function_v4float %data %123 + %126 = OpConvertSToF %float %116 + %127 = OpConvertSToF %float %118 + %128 = OpConvertSToF %float %120 + %129 = OpConvertSToF %float %122 + %130 = OpCompositeConstruct %v4float %126 %127 %128 %129 + OpStore %125 %130 + OpBranch %105 + %105 = OpLabel + %131 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %132 = OpLoad %int %131 + %133 = OpAccessChain %_ptr_Function_v4float %data %132 + %134 = OpLoad %v4float %133 + %135 = OpCompositeExtract %float %134 0 + %136 = OpCompositeExtract %float %134 1 + %137 = OpCompositeExtract %float %134 2 + %138 = OpCompositeExtract %float %134 3 + %139 = OpCompositeConstruct %v4float %135 %136 %137 %138 + OpStore %x_GLF_color %139 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %140 +%tint_symbol_1 = OpFunctionParameter %main_out + %144 = OpLabel + %145 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %145 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %147 = OpLabel + %148 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %148 + %149 = OpFunctionCall %void %main_1 + %151 = OpLoad %v4float %x_GLF_color + %152 = OpCompositeConstruct %main_out %151 + %150 = OpFunctionCall %void %tint_symbol_3 %152 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5e2efc9c0f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.wgsl @@ -0,0 +1,99 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array, 2>; + var b : i32; + var y : i32; + var i : i32; + let x_42 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_45 : f32 = x_7.x_GLF_uniform_float_values[0]; + data = array, 2>(vec4(x_42, x_42, x_42, x_42), vec4(x_45, x_45, x_45, x_45)); + let x_49 : i32 = x_10.x_GLF_uniform_int_values[1]; + b = x_49; + let x_51 : f32 = gl_FragCoord.y; + let x_54 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_56 : f32 = gl_FragCoord.y; + let x_60 : i32 = x_10.x_GLF_uniform_int_values[1]; + y = clamp(i32(x_51), (x_54 | i32(x_56)), x_60); + let x_63 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_63; + loop { + var x_82 : bool; + var x_83_phi : bool; + let x_68 : i32 = i; + let x_70 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_68 < x_70)) { + } else { + break; + } + let x_73 : i32 = b; + let x_75 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_76 : bool = (x_73 > x_75); + x_83_phi = x_76; + if (x_76) { + let x_79 : i32 = y; + let x_81 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_82 = (x_79 > x_81); + x_83_phi = x_82; + } + let x_83 : bool = x_83_phi; + if (x_83) { + break; + } + let x_86 : i32 = b; + b = (x_86 + 1); + + continuing { + let x_88 : i32 = i; + i = (x_88 + 1); + } + } + let x_90 : i32 = b; + let x_92 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_90 == x_92)) { + let x_97 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_99 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_101 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_104 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_107 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_110 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_113 : i32 = x_10.x_GLF_uniform_int_values[1]; + data[clamp(x_97, x_99, x_101)] = vec4(f32(x_104), f32(x_107), f32(x_110), f32(x_113)); + } + let x_118 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_120 : vec4 = data[x_118]; + x_GLF_color = vec4(x_120.x, x_120.y, x_120.z, x_120.w); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl new file mode 100644 index 0000000000..5e2efc9c0f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl @@ -0,0 +1,99 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array, 2>; + var b : i32; + var y : i32; + var i : i32; + let x_42 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_45 : f32 = x_7.x_GLF_uniform_float_values[0]; + data = array, 2>(vec4(x_42, x_42, x_42, x_42), vec4(x_45, x_45, x_45, x_45)); + let x_49 : i32 = x_10.x_GLF_uniform_int_values[1]; + b = x_49; + let x_51 : f32 = gl_FragCoord.y; + let x_54 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_56 : f32 = gl_FragCoord.y; + let x_60 : i32 = x_10.x_GLF_uniform_int_values[1]; + y = clamp(i32(x_51), (x_54 | i32(x_56)), x_60); + let x_63 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_63; + loop { + var x_82 : bool; + var x_83_phi : bool; + let x_68 : i32 = i; + let x_70 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_68 < x_70)) { + } else { + break; + } + let x_73 : i32 = b; + let x_75 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_76 : bool = (x_73 > x_75); + x_83_phi = x_76; + if (x_76) { + let x_79 : i32 = y; + let x_81 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_82 = (x_79 > x_81); + x_83_phi = x_82; + } + let x_83 : bool = x_83_phi; + if (x_83) { + break; + } + let x_86 : i32 = b; + b = (x_86 + 1); + + continuing { + let x_88 : i32 = i; + i = (x_88 + 1); + } + } + let x_90 : i32 = b; + let x_92 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_90 == x_92)) { + let x_97 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_99 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_101 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_104 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_107 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_110 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_113 : i32 = x_10.x_GLF_uniform_int_values[1]; + data[clamp(x_97, x_99, x_101)] = vec4(f32(x_104), f32(x_107), f32(x_110), f32(x_113)); + } + let x_118 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_120 : vec4 = data[x_118]; + x_GLF_color = vec4(x_120.x, x_120.y, x_120.z, x_120.w); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2ab5b03f2d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.hlsl @@ -0,0 +1,95 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 data[2] = (float4[2])0; + int b = 0; + int y = 0; + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_42 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float4 tint_symbol_6[2] = {float4(x_42, x_42, x_42, x_42), float4(x_45, x_45, x_45, x_45)}; + data = tint_symbol_6; + const int x_49 = asint(x_10[1].x); + b = x_49; + const float x_51 = gl_FragCoord.y; + const int x_54 = asint(x_10[1].x); + const float x_56 = gl_FragCoord.y; + const int x_60 = asint(x_10[1].x); + y = clamp(int(x_51), (x_54 | int(x_56)), x_60); + const int x_63 = asint(x_10[1].x); + i = x_63; + while (true) { + bool x_82 = false; + bool x_83_phi = false; + const int x_68 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_70 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_68 < x_70)) { + } else { + break; + } + const int x_73 = b; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_75 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const bool x_76 = (x_73 > x_75); + x_83_phi = x_76; + if (x_76) { + const int x_79 = y; + const int x_81 = asint(x_10[1].x); + x_82 = (x_79 > x_81); + x_83_phi = x_82; + } + if (x_83_phi) { + break; + } + b = (b + 1); + { + i = (i + 1); + } + } + const int x_90 = b; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_92 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_90 == x_92)) { + const int x_97 = asint(x_10[2].x); + const int x_99 = asint(x_10[1].x); + const int x_101 = asint(x_10[3].x); + const int x_104 = asint(x_10[1].x); + const int x_107 = asint(x_10[2].x); + const int x_110 = asint(x_10[2].x); + const int x_113 = asint(x_10[1].x); + data[clamp(x_97, x_99, x_101)] = float4(float(x_104), float(x_107), float(x_110), float(x_113)); + } + const int x_118 = asint(x_10[1].x); + const float4 x_120 = data[x_118]; + x_GLF_color = float4(x_120.x, x_120.y, x_120.z, x_120.w); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..18db7a4573 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.msl @@ -0,0 +1,109 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float4 arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_10, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper_2 data = {}; + int b = 0; + int y = 0; + int i = 0; + float const x_42 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_45 = x_7.x_GLF_uniform_float_values.arr[0].el; + tint_array_wrapper_2 const tint_symbol_4 = {.arr={float4(x_42, x_42, x_42, x_42), float4(x_45, x_45, x_45, x_45)}}; + data = tint_symbol_4; + int const x_49 = x_10.x_GLF_uniform_int_values.arr[1].el; + b = x_49; + float const x_51 = (*(tint_symbol_6)).y; + int const x_54 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_56 = (*(tint_symbol_6)).y; + int const x_60 = x_10.x_GLF_uniform_int_values.arr[1].el; + y = clamp(int(x_51), (x_54 | int(x_56)), x_60); + int const x_63 = x_10.x_GLF_uniform_int_values.arr[1].el; + i = x_63; + while (true) { + bool x_82 = false; + bool x_83_phi = false; + int const x_68 = i; + int const x_70 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_68 < x_70)) { + } else { + break; + } + int const x_73 = b; + int const x_75 = x_10.x_GLF_uniform_int_values.arr[0].el; + bool const x_76 = (x_73 > x_75); + x_83_phi = x_76; + if (x_76) { + int const x_79 = y; + int const x_81 = x_10.x_GLF_uniform_int_values.arr[1].el; + x_82 = (x_79 > x_81); + x_83_phi = x_82; + } + bool const x_83 = x_83_phi; + if (x_83) { + break; + } + int const x_86 = b; + b = (x_86 + 1); + { + int const x_88 = i; + i = (x_88 + 1); + } + } + int const x_90 = b; + int const x_92 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_90 == x_92)) { + int const x_97 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_99 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_101 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_104 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_107 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_110 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_113 = x_10.x_GLF_uniform_int_values.arr[1].el; + data.arr[clamp(x_97, x_99, x_101)] = float4(float(x_104), float(x_107), float(x_110), float(x_113)); + } + int const x_118 = x_10.x_GLF_uniform_int_values.arr[1].el; + float4 const x_120 = data.arr[x_118]; + *(tint_symbol_7) = float4(x_120.x, x_120.y, x_120.z, x_120.w); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_7, x_10, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..7fc19f93df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.spvasm @@ -0,0 +1,236 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 153 +; Schema: 0 + OpCapability Shader + %61 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %data "data" + OpName %b "b" + OpName %y "y" + OpName %i "i" + OpName %x_82 "x_82" + OpName %x_83_phi "x_83_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_ptr_Function__arr_v4float_uint_2 = OpTypePointer Function %_arr_v4float_uint_2 + %31 = OpConstantNull %_arr_v4float_uint_2 +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Private_float = OpTypePointer Private %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %74 = OpConstantNull %bool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %140 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %data = OpVariable %_ptr_Function__arr_v4float_uint_2 Function %31 + %b = OpVariable %_ptr_Function_int Function %34 + %y = OpVariable %_ptr_Function_int Function %34 + %i = OpVariable %_ptr_Function_int Function %34 + %x_82 = OpVariable %_ptr_Function_bool Function %74 + %x_83_phi = OpVariable %_ptr_Function_bool Function %74 + %40 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %43 = OpLoad %float %42 + %44 = OpCompositeConstruct %v4float %41 %41 %41 %41 + %45 = OpCompositeConstruct %v4float %43 %43 %43 %43 + %46 = OpCompositeConstruct %_arr_v4float_uint_2 %44 %45 + OpStore %data %46 + %49 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %50 = OpLoad %int %49 + OpStore %b %50 + %52 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %53 = OpLoad %float %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %57 = OpLoad %float %56 + %58 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %59 = OpLoad %int %58 + %62 = OpConvertFToS %int %53 + %63 = OpConvertFToS %int %57 + %64 = OpBitwiseOr %int %55 %63 + %60 = OpExtInst %int %61 SClamp %62 %64 %59 + OpStore %y %60 + %65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %66 = OpLoad %int %65 + OpStore %i %66 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %76 = OpLoad %int %i + %77 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %78 = OpLoad %int %77 + %79 = OpSLessThan %bool %76 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + OpBranch %80 + %82 = OpLabel + OpBranch %68 + %80 = OpLabel + %83 = OpLoad %int %b + %84 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpSGreaterThan %bool %83 %85 + OpStore %x_83_phi %86 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %87 + %88 = OpLabel + %89 = OpLoad %int %y + %90 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %91 = OpLoad %int %90 + %92 = OpSGreaterThan %bool %89 %91 + OpStore %x_82 %92 + %93 = OpLoad %bool %x_82 + OpStore %x_83_phi %93 + OpBranch %87 + %87 = OpLabel + %94 = OpLoad %bool %x_83_phi + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + OpBranch %68 + %95 = OpLabel + %97 = OpLoad %int %b + %98 = OpIAdd %int %97 %int_1 + OpStore %b %98 + OpBranch %69 + %69 = OpLabel + %99 = OpLoad %int %i + %100 = OpIAdd %int %99 %int_1 + OpStore %i %100 + OpBranch %67 + %68 = OpLabel + %101 = OpLoad %int %b + %102 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %103 = OpLoad %int %102 + %104 = OpIEqual %bool %101 %103 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %105 + %106 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %111 = OpLoad %int %110 + %113 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %114 = OpLoad %int %113 + %115 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %116 = OpLoad %int %115 + %117 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %118 = OpLoad %int %117 + %119 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %120 = OpLoad %int %119 + %121 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %122 = OpLoad %int %121 + %123 = OpExtInst %int %61 SClamp %109 %111 %114 + %125 = OpAccessChain %_ptr_Function_v4float %data %123 + %126 = OpConvertSToF %float %116 + %127 = OpConvertSToF %float %118 + %128 = OpConvertSToF %float %120 + %129 = OpConvertSToF %float %122 + %130 = OpCompositeConstruct %v4float %126 %127 %128 %129 + OpStore %125 %130 + OpBranch %105 + %105 = OpLabel + %131 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %132 = OpLoad %int %131 + %133 = OpAccessChain %_ptr_Function_v4float %data %132 + %134 = OpLoad %v4float %133 + %135 = OpCompositeExtract %float %134 0 + %136 = OpCompositeExtract %float %134 1 + %137 = OpCompositeExtract %float %134 2 + %138 = OpCompositeExtract %float %134 3 + %139 = OpCompositeConstruct %v4float %135 %136 %137 %138 + OpStore %x_GLF_color %139 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %140 +%tint_symbol_1 = OpFunctionParameter %main_out + %144 = OpLabel + %145 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %145 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %147 = OpLabel + %148 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %148 + %149 = OpFunctionCall %void %main_1 + %151 = OpLoad %v4float %x_GLF_color + %152 = OpCompositeConstruct %main_out %151 + %150 = OpFunctionCall %void %tint_symbol_3 %152 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5e2efc9c0f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.wgsl @@ -0,0 +1,99 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array, 2>; + var b : i32; + var y : i32; + var i : i32; + let x_42 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_45 : f32 = x_7.x_GLF_uniform_float_values[0]; + data = array, 2>(vec4(x_42, x_42, x_42, x_42), vec4(x_45, x_45, x_45, x_45)); + let x_49 : i32 = x_10.x_GLF_uniform_int_values[1]; + b = x_49; + let x_51 : f32 = gl_FragCoord.y; + let x_54 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_56 : f32 = gl_FragCoord.y; + let x_60 : i32 = x_10.x_GLF_uniform_int_values[1]; + y = clamp(i32(x_51), (x_54 | i32(x_56)), x_60); + let x_63 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_63; + loop { + var x_82 : bool; + var x_83_phi : bool; + let x_68 : i32 = i; + let x_70 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_68 < x_70)) { + } else { + break; + } + let x_73 : i32 = b; + let x_75 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_76 : bool = (x_73 > x_75); + x_83_phi = x_76; + if (x_76) { + let x_79 : i32 = y; + let x_81 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_82 = (x_79 > x_81); + x_83_phi = x_82; + } + let x_83 : bool = x_83_phi; + if (x_83) { + break; + } + let x_86 : i32 = b; + b = (x_86 + 1); + + continuing { + let x_88 : i32 = i; + i = (x_88 + 1); + } + } + let x_90 : i32 = b; + let x_92 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_90 == x_92)) { + let x_97 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_99 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_101 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_104 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_107 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_110 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_113 : i32 = x_10.x_GLF_uniform_int_values[1]; + data[clamp(x_97, x_99, x_101)] = vec4(f32(x_104), f32(x_107), f32(x_110), f32(x_113)); + } + let x_118 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_120 : vec4 = data[x_118]; + x_GLF_color = vec4(x_120.x, x_120.y, x_120.z, x_120.w); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm new file mode 100644 index 0000000000..b71a3d0eb3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm @@ -0,0 +1,153 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %icoord "icoord" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %icoord_0 "icoord" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %v2float = OpTypeVector %float 2 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_3 = OpConstant %int 3 +%_ptr_Function_int = OpTypePointer Function %int + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %buf0 = OpTypeStruct %_arr_int_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %main = OpFunction %void None %14 + %39 = OpLabel + %icoord = OpVariable %_ptr_Function_v2int Function + %40 = OpVariable %_ptr_Function_float Function + %icoord_0 = OpVariable %_ptr_Function_v2int Function + %41 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %44 = OpLoad %float %43 + %45 = OpFMul %float %42 %44 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpFOrdGreaterThan %bool %45 %47 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + %52 = OpLoad %v4float %gl_FragCoord + %53 = OpVectorShuffle %v2float %52 %52 0 1 + %54 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %55 = OpLoad %float %54 + %56 = OpVectorTimesScalar %v2float %53 %55 + %57 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %60 = OpLoad %float %59 + %61 = OpCompositeConstruct %v2float %58 %60 + %62 = OpFSub %v2float %56 %61 + %63 = OpConvertFToS %v2int %62 + OpStore %icoord %63 + %64 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %67 = OpLoad %float %66 + %68 = OpAccessChain %_ptr_Function_int %icoord %uint_0 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Function_int %icoord %uint_1 + %71 = OpLoad %int %70 + %72 = OpIMul %int %69 %71 + %73 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %74 = OpLoad %int %73 + %75 = OpINotEqual %bool %72 %74 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %78 + %77 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %80 = OpLoad %float %79 + OpStore %40 %80 + OpBranch %76 + %78 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %82 = OpLoad %float %81 + OpStore %40 %82 + OpBranch %76 + %76 = OpLabel + %83 = OpLoad %float %40 + %84 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %85 + %87 = OpCompositeConstruct %v4float %65 %67 %83 %86 + OpStore %_GLF_color %87 + OpBranch %49 + %51 = OpLabel + %88 = OpLoad %v4float %gl_FragCoord + %89 = OpVectorShuffle %v2float %88 %88 0 1 + %90 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %91 = OpLoad %float %90 + %92 = OpVectorTimesScalar %v2float %89 %91 + %93 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %94 = OpLoad %float %93 + %95 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %96 = OpLoad %float %95 + %97 = OpCompositeConstruct %v2float %94 %96 + %98 = OpFSub %v2float %92 %97 + %99 = OpConvertFToS %v2int %98 + OpStore %icoord_0 %99 + %100 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %101 = OpLoad %float %100 + %102 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Function_int %icoord_0 %uint_0 + %105 = OpLoad %int %104 + %106 = OpConvertSToF %float %105 + %107 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %108 = OpLoad %float %107 + %109 = OpCompositeConstruct %v4float %101 %103 %106 %108 + OpStore %_GLF_color %109 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..8837bf0a53 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.hlsl @@ -0,0 +1,75 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; + +void main_1() { + int2 icoord = int2(0, 0); + float x_40 = 0.0f; + int2 icoord_1 = int2(0, 0); + const float x_42 = gl_FragCoord.x; + const float x_44 = asfloat(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + if (((x_42 * x_44) > x_47)) { + const float4 x_52 = gl_FragCoord; + const float x_55 = asfloat(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_58 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_60 = asfloat(x_6[2].x); + icoord = int2(((float2(x_52.x, x_52.y) * x_55) - float2(x_58, x_60))); + const float x_65 = asfloat(x_6[2].x); + const float x_67 = asfloat(x_6[3].x); + const int x_69 = icoord.x; + const int x_71 = icoord.y; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if (((x_69 * x_71) != x_74)) { + const float x_80 = asfloat(x_6[3].x); + x_40 = x_80; + } else { + const float x_82 = asfloat(x_6[2].x); + x_40 = x_82; + } + const float x_83 = x_40; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_85 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(x_65, x_67, x_83, float(x_85)); + } else { + const float4 x_88 = gl_FragCoord; + const float x_91 = asfloat(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_94 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_96 = asfloat(x_6[2].x); + icoord_1 = int2(((float2(x_88.x, x_88.y) * x_91) - float2(x_94, x_96))); + const float x_101 = asfloat(x_6[3].x); + const float x_103 = asfloat(x_6[3].x); + const int x_105 = icoord_1.x; + const float x_108 = asfloat(x_6[3].x); + x_GLF_color = float4(x_101, x_103, float(x_105), x_108); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..c57161c023 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int2 icoord = 0; + float x_40 = 0.0f; + int2 icoord_1 = 0; + float const x_42 = (*(tint_symbol_5)).x; + float const x_44 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_47 = x_6.x_GLF_uniform_float_values.arr[0].el; + if (((x_42 * x_44) > x_47)) { + float4 const x_52 = *(tint_symbol_5); + float const x_55 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_58 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[2].el; + icoord = int2(((float2(x_52.x, x_52.y) * x_55) - float2(x_58, x_60))); + float const x_65 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_67 = x_6.x_GLF_uniform_float_values.arr[3].el; + int const x_69 = icoord.x; + int const x_71 = icoord.y; + int const x_74 = x_9.x_GLF_uniform_int_values.arr[0].el; + if (((x_69 * x_71) != x_74)) { + float const x_80 = x_6.x_GLF_uniform_float_values.arr[3].el; + x_40 = x_80; + } else { + float const x_82 = x_6.x_GLF_uniform_float_values.arr[2].el; + x_40 = x_82; + } + float const x_83 = x_40; + int const x_85 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(x_65, x_67, x_83, float(x_85)); + } else { + float4 const x_88 = *(tint_symbol_5); + float const x_91 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_94 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_96 = x_6.x_GLF_uniform_float_values.arr[2].el; + icoord_1 = int2(((float2(x_88.x, x_88.y) * x_91) - float2(x_94, x_96))); + float const x_101 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_103 = x_6.x_GLF_uniform_float_values.arr[3].el; + int const x_105 = icoord_1.x; + float const x_108 = x_6.x_GLF_uniform_float_values.arr[3].el; + *(tint_symbol_6) = float4(x_101, x_103, float(x_105), x_108); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, x_9, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..76e8564851 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.spvasm @@ -0,0 +1,196 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 132 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %icoord "icoord" + OpName %x_40 "x_40" + OpName %icoord_1 "icoord_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_1 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %buf0 = OpTypeStruct %_arr_int_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %30 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %33 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %v2float = OpTypeVector %float 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %119 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %icoord = OpVariable %_ptr_Function_v2int Function %30 + %x_40 = OpVariable %_ptr_Function_float Function %33 + %icoord_1 = OpVariable %_ptr_Function_v2int Function %30 + %37 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %42 = OpLoad %float %41 + %44 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %45 = OpLoad %float %44 + %46 = OpFMul %float %38 %42 + %47 = OpFOrdGreaterThan %bool %46 %45 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %51 + %50 = OpLabel + %52 = OpLoad %v4float %gl_FragCoord + %53 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %54 = OpLoad %float %53 + %55 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %59 = OpLoad %float %58 + %62 = OpCompositeExtract %float %52 0 + %63 = OpCompositeExtract %float %52 1 + %64 = OpCompositeConstruct %v2float %62 %63 + %65 = OpVectorTimesScalar %v2float %64 %54 + %66 = OpCompositeConstruct %v2float %56 %59 + %67 = OpFSub %v2float %65 %66 + %60 = OpConvertFToS %v2int %67 + OpStore %icoord %60 + %68 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %69 = OpLoad %float %68 + %71 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %72 = OpLoad %float %71 + %74 = OpAccessChain %_ptr_Function_int %icoord %uint_0 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Function_int %icoord %uint_1 + %77 = OpLoad %int %76 + %79 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpIMul %int %75 %77 + %82 = OpINotEqual %bool %81 %80 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %87 = OpLoad %float %86 + OpStore %x_40 %87 + OpBranch %83 + %85 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %89 = OpLoad %float %88 + OpStore %x_40 %89 + OpBranch %83 + %83 = OpLabel + %90 = OpLoad %float %x_40 + %91 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %92 + %94 = OpCompositeConstruct %v4float %69 %72 %90 %93 + OpStore %x_GLF_color %94 + OpBranch %49 + %51 = OpLabel + %95 = OpLoad %v4float %gl_FragCoord + %96 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %97 = OpLoad %float %96 + %98 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %101 = OpLoad %float %100 + %103 = OpCompositeExtract %float %95 0 + %104 = OpCompositeExtract %float %95 1 + %105 = OpCompositeConstruct %v2float %103 %104 + %106 = OpVectorTimesScalar %v2float %105 %97 + %107 = OpCompositeConstruct %v2float %99 %101 + %108 = OpFSub %v2float %106 %107 + %102 = OpConvertFToS %v2int %108 + OpStore %icoord_1 %102 + %109 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %110 = OpLoad %float %109 + %111 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %112 = OpLoad %float %111 + %113 = OpAccessChain %_ptr_Function_int %icoord_1 %uint_0 + %114 = OpLoad %int %113 + %115 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %116 = OpLoad %float %115 + %117 = OpConvertSToF %float %114 + %118 = OpCompositeConstruct %v4float %110 %112 %117 %116 + OpStore %x_GLF_color %118 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %119 +%tint_symbol_1 = OpFunctionParameter %main_out + %123 = OpLabel + %124 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %124 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %126 = OpLabel + %127 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %127 + %128 = OpFunctionCall %void %main_1 + %130 = OpLoad %v4float %x_GLF_color + %131 = OpCompositeConstruct %main_out %130 + %129 = OpFunctionCall %void %tint_symbol_3 %131 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..8306f38dd0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.spvasm.expected.wgsl @@ -0,0 +1,76 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var icoord : vec2; + var x_40 : f32; + var icoord_1 : vec2; + let x_42 : f32 = gl_FragCoord.x; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[0]; + if (((x_42 * x_44) > x_47)) { + let x_52 : vec4 = gl_FragCoord; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[2]; + icoord = vec2(((vec2(x_52.x, x_52.y) * x_55) - vec2(x_58, x_60))); + let x_65 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_67 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_69 : i32 = icoord.x; + let x_71 : i32 = icoord.y; + let x_74 : i32 = x_9.x_GLF_uniform_int_values[0]; + if (((x_69 * x_71) != x_74)) { + let x_80 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_40 = x_80; + } else { + let x_82 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_40 = x_82; + } + let x_83 : f32 = x_40; + let x_85 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(x_65, x_67, x_83, f32(x_85)); + } else { + let x_88 : vec4 = gl_FragCoord; + let x_91 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_94 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_96 : f32 = x_6.x_GLF_uniform_float_values[2]; + icoord_1 = vec2(((vec2(x_88.x, x_88.y) * x_91) - vec2(x_94, x_96))); + let x_101 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_103 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_105 : i32 = icoord_1.x; + let x_108 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_GLF_color = vec4(x_101, x_103, f32(x_105), x_108); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl new file mode 100644 index 0000000000..8306f38dd0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl @@ -0,0 +1,76 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var icoord : vec2; + var x_40 : f32; + var icoord_1 : vec2; + let x_42 : f32 = gl_FragCoord.x; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[0]; + if (((x_42 * x_44) > x_47)) { + let x_52 : vec4 = gl_FragCoord; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[2]; + icoord = vec2(((vec2(x_52.x, x_52.y) * x_55) - vec2(x_58, x_60))); + let x_65 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_67 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_69 : i32 = icoord.x; + let x_71 : i32 = icoord.y; + let x_74 : i32 = x_9.x_GLF_uniform_int_values[0]; + if (((x_69 * x_71) != x_74)) { + let x_80 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_40 = x_80; + } else { + let x_82 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_40 = x_82; + } + let x_83 : f32 = x_40; + let x_85 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(x_65, x_67, x_83, f32(x_85)); + } else { + let x_88 : vec4 = gl_FragCoord; + let x_91 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_94 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_96 : f32 = x_6.x_GLF_uniform_float_values[2]; + icoord_1 = vec2(((vec2(x_88.x, x_88.y) * x_91) - vec2(x_94, x_96))); + let x_101 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_103 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_105 : i32 = icoord_1.x; + let x_108 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_GLF_color = vec4(x_101, x_103, f32(x_105), x_108); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..8837bf0a53 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.hlsl @@ -0,0 +1,75 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; + +void main_1() { + int2 icoord = int2(0, 0); + float x_40 = 0.0f; + int2 icoord_1 = int2(0, 0); + const float x_42 = gl_FragCoord.x; + const float x_44 = asfloat(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + if (((x_42 * x_44) > x_47)) { + const float4 x_52 = gl_FragCoord; + const float x_55 = asfloat(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_58 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_60 = asfloat(x_6[2].x); + icoord = int2(((float2(x_52.x, x_52.y) * x_55) - float2(x_58, x_60))); + const float x_65 = asfloat(x_6[2].x); + const float x_67 = asfloat(x_6[3].x); + const int x_69 = icoord.x; + const int x_71 = icoord.y; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if (((x_69 * x_71) != x_74)) { + const float x_80 = asfloat(x_6[3].x); + x_40 = x_80; + } else { + const float x_82 = asfloat(x_6[2].x); + x_40 = x_82; + } + const float x_83 = x_40; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_85 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(x_65, x_67, x_83, float(x_85)); + } else { + const float4 x_88 = gl_FragCoord; + const float x_91 = asfloat(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_94 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_96 = asfloat(x_6[2].x); + icoord_1 = int2(((float2(x_88.x, x_88.y) * x_91) - float2(x_94, x_96))); + const float x_101 = asfloat(x_6[3].x); + const float x_103 = asfloat(x_6[3].x); + const int x_105 = icoord_1.x; + const float x_108 = asfloat(x_6[3].x); + x_GLF_color = float4(x_101, x_103, float(x_105), x_108); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..c57161c023 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int2 icoord = 0; + float x_40 = 0.0f; + int2 icoord_1 = 0; + float const x_42 = (*(tint_symbol_5)).x; + float const x_44 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_47 = x_6.x_GLF_uniform_float_values.arr[0].el; + if (((x_42 * x_44) > x_47)) { + float4 const x_52 = *(tint_symbol_5); + float const x_55 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_58 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[2].el; + icoord = int2(((float2(x_52.x, x_52.y) * x_55) - float2(x_58, x_60))); + float const x_65 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_67 = x_6.x_GLF_uniform_float_values.arr[3].el; + int const x_69 = icoord.x; + int const x_71 = icoord.y; + int const x_74 = x_9.x_GLF_uniform_int_values.arr[0].el; + if (((x_69 * x_71) != x_74)) { + float const x_80 = x_6.x_GLF_uniform_float_values.arr[3].el; + x_40 = x_80; + } else { + float const x_82 = x_6.x_GLF_uniform_float_values.arr[2].el; + x_40 = x_82; + } + float const x_83 = x_40; + int const x_85 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(x_65, x_67, x_83, float(x_85)); + } else { + float4 const x_88 = *(tint_symbol_5); + float const x_91 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_94 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_96 = x_6.x_GLF_uniform_float_values.arr[2].el; + icoord_1 = int2(((float2(x_88.x, x_88.y) * x_91) - float2(x_94, x_96))); + float const x_101 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_103 = x_6.x_GLF_uniform_float_values.arr[3].el; + int const x_105 = icoord_1.x; + float const x_108 = x_6.x_GLF_uniform_float_values.arr[3].el; + *(tint_symbol_6) = float4(x_101, x_103, float(x_105), x_108); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, x_9, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..76e8564851 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.spvasm @@ -0,0 +1,196 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 132 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %icoord "icoord" + OpName %x_40 "x_40" + OpName %icoord_1 "icoord_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_1 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %buf0 = OpTypeStruct %_arr_int_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %30 = OpConstantNull %v2int +%_ptr_Function_float = OpTypePointer Function %float + %33 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %v2float = OpTypeVector %float 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %119 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %icoord = OpVariable %_ptr_Function_v2int Function %30 + %x_40 = OpVariable %_ptr_Function_float Function %33 + %icoord_1 = OpVariable %_ptr_Function_v2int Function %30 + %37 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %42 = OpLoad %float %41 + %44 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %45 = OpLoad %float %44 + %46 = OpFMul %float %38 %42 + %47 = OpFOrdGreaterThan %bool %46 %45 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %51 + %50 = OpLabel + %52 = OpLoad %v4float %gl_FragCoord + %53 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %54 = OpLoad %float %53 + %55 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %59 = OpLoad %float %58 + %62 = OpCompositeExtract %float %52 0 + %63 = OpCompositeExtract %float %52 1 + %64 = OpCompositeConstruct %v2float %62 %63 + %65 = OpVectorTimesScalar %v2float %64 %54 + %66 = OpCompositeConstruct %v2float %56 %59 + %67 = OpFSub %v2float %65 %66 + %60 = OpConvertFToS %v2int %67 + OpStore %icoord %60 + %68 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %69 = OpLoad %float %68 + %71 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %72 = OpLoad %float %71 + %74 = OpAccessChain %_ptr_Function_int %icoord %uint_0 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Function_int %icoord %uint_1 + %77 = OpLoad %int %76 + %79 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpIMul %int %75 %77 + %82 = OpINotEqual %bool %81 %80 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %87 = OpLoad %float %86 + OpStore %x_40 %87 + OpBranch %83 + %85 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %89 = OpLoad %float %88 + OpStore %x_40 %89 + OpBranch %83 + %83 = OpLabel + %90 = OpLoad %float %x_40 + %91 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %92 + %94 = OpCompositeConstruct %v4float %69 %72 %90 %93 + OpStore %x_GLF_color %94 + OpBranch %49 + %51 = OpLabel + %95 = OpLoad %v4float %gl_FragCoord + %96 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %97 = OpLoad %float %96 + %98 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %101 = OpLoad %float %100 + %103 = OpCompositeExtract %float %95 0 + %104 = OpCompositeExtract %float %95 1 + %105 = OpCompositeConstruct %v2float %103 %104 + %106 = OpVectorTimesScalar %v2float %105 %97 + %107 = OpCompositeConstruct %v2float %99 %101 + %108 = OpFSub %v2float %106 %107 + %102 = OpConvertFToS %v2int %108 + OpStore %icoord_1 %102 + %109 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %110 = OpLoad %float %109 + %111 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %112 = OpLoad %float %111 + %113 = OpAccessChain %_ptr_Function_int %icoord_1 %uint_0 + %114 = OpLoad %int %113 + %115 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %116 = OpLoad %float %115 + %117 = OpConvertSToF %float %114 + %118 = OpCompositeConstruct %v4float %110 %112 %117 %116 + OpStore %x_GLF_color %118 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %119 +%tint_symbol_1 = OpFunctionParameter %main_out + %123 = OpLabel + %124 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %124 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %126 = OpLabel + %127 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %127 + %128 = OpFunctionCall %void %main_1 + %130 = OpLoad %v4float %x_GLF_color + %131 = OpCompositeConstruct %main_out %130 + %129 = OpFunctionCall %void %tint_symbol_3 %131 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..8306f38dd0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-multiply/0-opt.wgsl.expected.wgsl @@ -0,0 +1,76 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var icoord : vec2; + var x_40 : f32; + var icoord_1 : vec2; + let x_42 : f32 = gl_FragCoord.x; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[0]; + if (((x_42 * x_44) > x_47)) { + let x_52 : vec4 = gl_FragCoord; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[2]; + icoord = vec2(((vec2(x_52.x, x_52.y) * x_55) - vec2(x_58, x_60))); + let x_65 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_67 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_69 : i32 = icoord.x; + let x_71 : i32 = icoord.y; + let x_74 : i32 = x_9.x_GLF_uniform_int_values[0]; + if (((x_69 * x_71) != x_74)) { + let x_80 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_40 = x_80; + } else { + let x_82 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_40 = x_82; + } + let x_83 : f32 = x_40; + let x_85 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(x_65, x_67, x_83, f32(x_85)); + } else { + let x_88 : vec4 = gl_FragCoord; + let x_91 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_94 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_96 : f32 = x_6.x_GLF_uniform_float_values[2]; + icoord_1 = vec2(((vec2(x_88.x, x_88.y) * x_91) - vec2(x_94, x_96))); + let x_101 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_103 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_105 : i32 = icoord_1.x; + let x_108 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_GLF_color = vec4(x_101, x_103, f32(x_105), x_108); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm new file mode 100644 index 0000000000..be0471eca6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm @@ -0,0 +1,168 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %func_f1_ "func(f1;" + OpName %x "x" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpTypeFunction %float %_ptr_Function_float + %bool = OpTypeBool + %true = OpConstantTrue %bool + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %15 + %39 = OpLabel + %param = OpVariable %_ptr_Function_float Function + %40 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %41 = OpLoad %float %40 + OpStore %param %41 + %42 = OpFunctionCall %float %func_f1_ %param + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %44 = OpLoad %float %43 + %45 = OpFOrdEqual %bool %42 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpConvertSToF %float %56 + %58 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpCompositeConstruct %v4float %51 %54 %57 %60 + OpStore %_GLF_color %61 + OpBranch %46 + %48 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpConvertSToF %float %63 + %65 = OpCompositeConstruct %v4float %64 %64 %64 %64 + OpStore %_GLF_color %65 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd + %func_f1_ = OpFunction %float None %18 + %x = OpFunctionParameter %_ptr_Function_float + %66 = OpLabel + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + OpBranchConditional %true %71 %68 + %71 = OpLabel + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %79 = OpLoad %float %78 + %80 = OpFOrdLessThan %bool %77 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + OpBranch %83 + %83 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + OpBranch %85 + %85 = OpLabel + %87 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %88 = OpLoad %float %87 + %89 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %90 = OpLoad %float %89 + %91 = OpFOrdLessThan %bool %88 %90 + OpBranchConditional %91 %83 %84 + %84 = OpLabel + OpBranch %81 + %81 = OpLabel + %92 = OpLoad %float %x + %93 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %94 = OpLoad %float %93 + %95 = OpFOrdLessThan %bool %92 %94 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %96 + %97 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %99 = OpLoad %float %98 + OpReturnValue %99 + %96 = OpLabel + OpBranch %74 + %74 = OpLabel + %100 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %101 = OpLoad %float %100 + %102 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %103 = OpLoad %float %102 + %104 = OpFOrdLessThan %bool %101 %103 + OpBranchConditional %104 %72 %73 + %73 = OpLabel + OpBranch %69 + %69 = OpLabel + OpBranch %67 + %68 = OpLabel + %105 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %106 = OpLoad %float %105 + OpReturnValue %106 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..44df57fec2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.hlsl @@ -0,0 +1,91 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[2]; +}; + +float func_f1_(inout float x) { + while (true) { + if (true) { + } else { + break; + } + while (true) { + const float x_77 = gl_FragCoord.y; + const float x_79 = asfloat(x_8[2].x); + if ((x_77 < x_79)) { + while (true) { + { + const float x_88 = gl_FragCoord.x; + const float x_90 = asfloat(x_8[2].x); + if ((x_88 < x_90)) { + } else { + break; + } + } + } + } + const float x_92 = x; + const float x_94 = asfloat(x_8[3].x); + if ((x_92 < x_94)) { + const float x_99 = asfloat(x_8[1].x); + return x_99; + } + { + const float x_101 = gl_FragCoord.y; + const float x_103 = asfloat(x_8[2].x); + if ((x_101 < x_103)) { + } else { + break; + } + } + } + } + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_106 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + return x_106; +} + +void main_1() { + float param = 0.0f; + const float x_41 = gl_FragCoord.x; + param = x_41; + const float x_42 = func_f1_(param); + const float x_44 = asfloat(x_8[1].x); + if ((x_42 == x_44)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_11[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_53 = asint(x_11[1].x); + const int x_56 = asint(x_11[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_50), float(x_53), float(x_56), float(x_59)); + } else { + const int x_63 = asint(x_11[1].x); + const float x_64 = float(x_63); + x_GLF_color = float4(x_64, x_64, x_64, x_64); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..bb3bd84896 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.msl @@ -0,0 +1,101 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_f1_(constant buf1& x_8, thread float* const x, thread float4* const tint_symbol_5) { + while (true) { + if (true) { + } else { + break; + } + while (true) { + float const x_77 = (*(tint_symbol_5)).y; + float const x_79 = x_8.x_GLF_uniform_float_values.arr[2].el; + if ((x_77 < x_79)) { + while (true) { + { + float const x_88 = (*(tint_symbol_5)).x; + float const x_90 = x_8.x_GLF_uniform_float_values.arr[2].el; + if ((x_88 < x_90)) { + } else { + break; + } + } + } + } + float const x_92 = *(x); + float const x_94 = x_8.x_GLF_uniform_float_values.arr[3].el; + if ((x_92 < x_94)) { + float const x_99 = x_8.x_GLF_uniform_float_values.arr[1].el; + return x_99; + } + { + float const x_101 = (*(tint_symbol_5)).y; + float const x_103 = x_8.x_GLF_uniform_float_values.arr[2].el; + if ((x_101 < x_103)) { + } else { + break; + } + } + } + } + float const x_106 = x_8.x_GLF_uniform_float_values.arr[0].el; + return x_106; +} + +void main_1(constant buf1& x_8, constant buf0& x_11, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float param = 0.0f; + float const x_41 = (*(tint_symbol_6)).x; + param = x_41; + float const x_42 = func_f1_(x_8, &(param), tint_symbol_6); + float const x_44 = x_8.x_GLF_uniform_float_values.arr[1].el; + if ((x_42 == x_44)) { + int const x_50 = x_11.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_59 = x_11.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_7) = float4(float(x_50), float(x_53), float(x_56), float(x_59)); + } else { + int const x_63 = x_11.x_GLF_uniform_int_values.arr[1].el; + float const x_64 = float(x_63); + *(tint_symbol_7) = float4(x_64, x_64, x_64, x_64); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_8 [[buffer(1)]], constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_8, x_11, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..855bbda0d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.spvasm @@ -0,0 +1,229 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 134 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_11 "x_11" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_f1_ "func_f1_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_float = OpTypePointer Function %float + %23 = OpTypeFunction %float %_ptr_Function_float + %bool = OpTypeBool + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %void = OpTypeVoid + %87 = OpTypeFunction %void + %92 = OpConstantNull %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %121 = OpTypeFunction %void %main_out + %func_f1_ = OpFunction %float None %23 + %x = OpFunctionParameter %_ptr_Function_float + %27 = OpLabel + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + OpSelectionMerge %34 None + OpBranchConditional %true %35 %36 + %35 = OpLabel + OpBranch %34 + %36 = OpLabel + OpBranch %29 + %34 = OpLabel + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %43 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %44 = OpLoad %float %43 + %48 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %49 = OpLoad %float %48 + %50 = OpFOrdLessThan %bool %44 %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + OpBranch %55 + %55 = OpLabel + %57 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %58 = OpLoad %float %57 + %59 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %60 = OpLoad %float %59 + %61 = OpFOrdLessThan %bool %58 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %64 + %63 = OpLabel + OpBranch %62 + %64 = OpLabel + OpBranch %54 + %62 = OpLabel + OpBranch %53 + %54 = OpLabel + OpBranch %51 + %51 = OpLabel + %66 = OpLoad %float %x + %68 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_3 + %69 = OpLoad %float %68 + %70 = OpFOrdLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %75 = OpLoad %float %74 + OpReturnValue %75 + %71 = OpLabel + OpBranch %39 + %39 = OpLabel + %76 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %79 = OpLoad %float %78 + %80 = OpFOrdLessThan %bool %77 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %38 + %81 = OpLabel + OpBranch %37 + %38 = OpLabel + OpBranch %30 + %30 = OpLabel + OpBranch %28 + %29 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %86 = OpLoad %float %85 + OpReturnValue %86 + OpFunctionEnd + %main_1 = OpFunction %void None %87 + %90 = OpLabel + %param = OpVariable %_ptr_Function_float Function %92 + %93 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %94 = OpLoad %float %93 + OpStore %param %94 + %95 = OpFunctionCall %float %func_f1_ %param + %97 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %98 = OpLoad %float %97 + %99 = OpFOrdEqual %bool %95 %98 + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %102 + %101 = OpLabel + %104 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %111 = OpLoad %int %110 + %112 = OpConvertSToF %float %105 + %113 = OpConvertSToF %float %107 + %114 = OpConvertSToF %float %109 + %115 = OpConvertSToF %float %111 + %116 = OpCompositeConstruct %v4float %112 %113 %114 %115 + OpStore %x_GLF_color %116 + OpBranch %100 + %102 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %118 = OpLoad %int %117 + %119 = OpConvertSToF %float %118 + %120 = OpCompositeConstruct %v4float %119 %119 %119 %119 + OpStore %x_GLF_color %120 + OpBranch %100 + %100 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %121 +%tint_symbol_1 = OpFunctionParameter %main_out + %125 = OpLabel + %126 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %126 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %87 + %128 = OpLabel + %129 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %129 + %130 = OpFunctionCall %void %main_1 + %132 = OpLoad %v4float %x_GLF_color + %133 = OpCompositeConstruct %main_out %132 + %131 = OpFunctionCall %void %tint_symbol_3 %133 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 39[%39] is not post dominated by the back-edge block 81[%81] + %81 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..36f0a6f129 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.spvasm.expected.wgsl @@ -0,0 +1,96 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_11 : buf0; + +fn func_f1_(x : ptr) -> f32 { + loop { + if (true) { + } else { + break; + } + loop { + let x_77 : f32 = gl_FragCoord.y; + let x_79 : f32 = x_8.x_GLF_uniform_float_values[2]; + if ((x_77 < x_79)) { + loop { + + continuing { + let x_88 : f32 = gl_FragCoord.x; + let x_90 : f32 = x_8.x_GLF_uniform_float_values[2]; + if ((x_88 < x_90)) { + } else { + break; + } + } + } + } + let x_92 : f32 = *(x); + let x_94 : f32 = x_8.x_GLF_uniform_float_values[3]; + if ((x_92 < x_94)) { + let x_99 : f32 = x_8.x_GLF_uniform_float_values[1]; + return x_99; + } + + continuing { + let x_101 : f32 = gl_FragCoord.y; + let x_103 : f32 = x_8.x_GLF_uniform_float_values[2]; + if ((x_101 < x_103)) { + } else { + break; + } + } + } + } + let x_106 : f32 = x_8.x_GLF_uniform_float_values[0]; + return x_106; +} + +fn main_1() { + var param : f32; + let x_41 : f32 = gl_FragCoord.x; + param = x_41; + let x_42 : f32 = func_f1_(&(param)); + let x_44 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_42 == x_44)) { + let x_50 : i32 = x_11.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_59 : i32 = x_11.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_50), f32(x_53), f32(x_56), f32(x_59)); + } else { + let x_63 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_64 : f32 = f32(x_63); + x_GLF_color = vec4(x_64, x_64, x_64, x_64); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl new file mode 100644 index 0000000000..36f0a6f129 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl @@ -0,0 +1,96 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_11 : buf0; + +fn func_f1_(x : ptr) -> f32 { + loop { + if (true) { + } else { + break; + } + loop { + let x_77 : f32 = gl_FragCoord.y; + let x_79 : f32 = x_8.x_GLF_uniform_float_values[2]; + if ((x_77 < x_79)) { + loop { + + continuing { + let x_88 : f32 = gl_FragCoord.x; + let x_90 : f32 = x_8.x_GLF_uniform_float_values[2]; + if ((x_88 < x_90)) { + } else { + break; + } + } + } + } + let x_92 : f32 = *(x); + let x_94 : f32 = x_8.x_GLF_uniform_float_values[3]; + if ((x_92 < x_94)) { + let x_99 : f32 = x_8.x_GLF_uniform_float_values[1]; + return x_99; + } + + continuing { + let x_101 : f32 = gl_FragCoord.y; + let x_103 : f32 = x_8.x_GLF_uniform_float_values[2]; + if ((x_101 < x_103)) { + } else { + break; + } + } + } + } + let x_106 : f32 = x_8.x_GLF_uniform_float_values[0]; + return x_106; +} + +fn main_1() { + var param : f32; + let x_41 : f32 = gl_FragCoord.x; + param = x_41; + let x_42 : f32 = func_f1_(&(param)); + let x_44 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_42 == x_44)) { + let x_50 : i32 = x_11.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_59 : i32 = x_11.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_50), f32(x_53), f32(x_56), f32(x_59)); + } else { + let x_63 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_64 : f32 = f32(x_63); + x_GLF_color = vec4(x_64, x_64, x_64, x_64); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..44df57fec2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.hlsl @@ -0,0 +1,91 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[2]; +}; + +float func_f1_(inout float x) { + while (true) { + if (true) { + } else { + break; + } + while (true) { + const float x_77 = gl_FragCoord.y; + const float x_79 = asfloat(x_8[2].x); + if ((x_77 < x_79)) { + while (true) { + { + const float x_88 = gl_FragCoord.x; + const float x_90 = asfloat(x_8[2].x); + if ((x_88 < x_90)) { + } else { + break; + } + } + } + } + const float x_92 = x; + const float x_94 = asfloat(x_8[3].x); + if ((x_92 < x_94)) { + const float x_99 = asfloat(x_8[1].x); + return x_99; + } + { + const float x_101 = gl_FragCoord.y; + const float x_103 = asfloat(x_8[2].x); + if ((x_101 < x_103)) { + } else { + break; + } + } + } + } + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_106 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + return x_106; +} + +void main_1() { + float param = 0.0f; + const float x_41 = gl_FragCoord.x; + param = x_41; + const float x_42 = func_f1_(param); + const float x_44 = asfloat(x_8[1].x); + if ((x_42 == x_44)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_11[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_53 = asint(x_11[1].x); + const int x_56 = asint(x_11[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_50), float(x_53), float(x_56), float(x_59)); + } else { + const int x_63 = asint(x_11[1].x); + const float x_64 = float(x_63); + x_GLF_color = float4(x_64, x_64, x_64, x_64); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..bb3bd84896 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.msl @@ -0,0 +1,101 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_f1_(constant buf1& x_8, thread float* const x, thread float4* const tint_symbol_5) { + while (true) { + if (true) { + } else { + break; + } + while (true) { + float const x_77 = (*(tint_symbol_5)).y; + float const x_79 = x_8.x_GLF_uniform_float_values.arr[2].el; + if ((x_77 < x_79)) { + while (true) { + { + float const x_88 = (*(tint_symbol_5)).x; + float const x_90 = x_8.x_GLF_uniform_float_values.arr[2].el; + if ((x_88 < x_90)) { + } else { + break; + } + } + } + } + float const x_92 = *(x); + float const x_94 = x_8.x_GLF_uniform_float_values.arr[3].el; + if ((x_92 < x_94)) { + float const x_99 = x_8.x_GLF_uniform_float_values.arr[1].el; + return x_99; + } + { + float const x_101 = (*(tint_symbol_5)).y; + float const x_103 = x_8.x_GLF_uniform_float_values.arr[2].el; + if ((x_101 < x_103)) { + } else { + break; + } + } + } + } + float const x_106 = x_8.x_GLF_uniform_float_values.arr[0].el; + return x_106; +} + +void main_1(constant buf1& x_8, constant buf0& x_11, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float param = 0.0f; + float const x_41 = (*(tint_symbol_6)).x; + param = x_41; + float const x_42 = func_f1_(x_8, &(param), tint_symbol_6); + float const x_44 = x_8.x_GLF_uniform_float_values.arr[1].el; + if ((x_42 == x_44)) { + int const x_50 = x_11.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_59 = x_11.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_7) = float4(float(x_50), float(x_53), float(x_56), float(x_59)); + } else { + int const x_63 = x_11.x_GLF_uniform_int_values.arr[1].el; + float const x_64 = float(x_63); + *(tint_symbol_7) = float4(x_64, x_64, x_64, x_64); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_8 [[buffer(1)]], constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_8, x_11, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..855bbda0d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.spvasm @@ -0,0 +1,229 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 134 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_11 "x_11" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_f1_ "func_f1_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_float = OpTypePointer Function %float + %23 = OpTypeFunction %float %_ptr_Function_float + %bool = OpTypeBool + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %void = OpTypeVoid + %87 = OpTypeFunction %void + %92 = OpConstantNull %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %121 = OpTypeFunction %void %main_out + %func_f1_ = OpFunction %float None %23 + %x = OpFunctionParameter %_ptr_Function_float + %27 = OpLabel + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + OpSelectionMerge %34 None + OpBranchConditional %true %35 %36 + %35 = OpLabel + OpBranch %34 + %36 = OpLabel + OpBranch %29 + %34 = OpLabel + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %43 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %44 = OpLoad %float %43 + %48 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %49 = OpLoad %float %48 + %50 = OpFOrdLessThan %bool %44 %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + OpBranch %55 + %55 = OpLabel + %57 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %58 = OpLoad %float %57 + %59 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %60 = OpLoad %float %59 + %61 = OpFOrdLessThan %bool %58 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %64 + %63 = OpLabel + OpBranch %62 + %64 = OpLabel + OpBranch %54 + %62 = OpLabel + OpBranch %53 + %54 = OpLabel + OpBranch %51 + %51 = OpLabel + %66 = OpLoad %float %x + %68 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_3 + %69 = OpLoad %float %68 + %70 = OpFOrdLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %75 = OpLoad %float %74 + OpReturnValue %75 + %71 = OpLabel + OpBranch %39 + %39 = OpLabel + %76 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %79 = OpLoad %float %78 + %80 = OpFOrdLessThan %bool %77 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %38 + %81 = OpLabel + OpBranch %37 + %38 = OpLabel + OpBranch %30 + %30 = OpLabel + OpBranch %28 + %29 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %86 = OpLoad %float %85 + OpReturnValue %86 + OpFunctionEnd + %main_1 = OpFunction %void None %87 + %90 = OpLabel + %param = OpVariable %_ptr_Function_float Function %92 + %93 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %94 = OpLoad %float %93 + OpStore %param %94 + %95 = OpFunctionCall %float %func_f1_ %param + %97 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %98 = OpLoad %float %97 + %99 = OpFOrdEqual %bool %95 %98 + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %102 + %101 = OpLabel + %104 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %111 = OpLoad %int %110 + %112 = OpConvertSToF %float %105 + %113 = OpConvertSToF %float %107 + %114 = OpConvertSToF %float %109 + %115 = OpConvertSToF %float %111 + %116 = OpCompositeConstruct %v4float %112 %113 %114 %115 + OpStore %x_GLF_color %116 + OpBranch %100 + %102 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %118 = OpLoad %int %117 + %119 = OpConvertSToF %float %118 + %120 = OpCompositeConstruct %v4float %119 %119 %119 %119 + OpStore %x_GLF_color %120 + OpBranch %100 + %100 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %121 +%tint_symbol_1 = OpFunctionParameter %main_out + %125 = OpLabel + %126 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %126 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %87 + %128 = OpLabel + %129 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %129 + %130 = OpFunctionCall %void %main_1 + %132 = OpLoad %v4float %x_GLF_color + %133 = OpCompositeConstruct %main_out %132 + %131 = OpFunctionCall %void %tint_symbol_3 %133 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 39[%39] is not post dominated by the back-edge block 81[%81] + %81 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..36f0a6f129 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-fragcoord-condition-always-return/0-opt.wgsl.expected.wgsl @@ -0,0 +1,96 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_11 : buf0; + +fn func_f1_(x : ptr) -> f32 { + loop { + if (true) { + } else { + break; + } + loop { + let x_77 : f32 = gl_FragCoord.y; + let x_79 : f32 = x_8.x_GLF_uniform_float_values[2]; + if ((x_77 < x_79)) { + loop { + + continuing { + let x_88 : f32 = gl_FragCoord.x; + let x_90 : f32 = x_8.x_GLF_uniform_float_values[2]; + if ((x_88 < x_90)) { + } else { + break; + } + } + } + } + let x_92 : f32 = *(x); + let x_94 : f32 = x_8.x_GLF_uniform_float_values[3]; + if ((x_92 < x_94)) { + let x_99 : f32 = x_8.x_GLF_uniform_float_values[1]; + return x_99; + } + + continuing { + let x_101 : f32 = gl_FragCoord.y; + let x_103 : f32 = x_8.x_GLF_uniform_float_values[2]; + if ((x_101 < x_103)) { + } else { + break; + } + } + } + } + let x_106 : f32 = x_8.x_GLF_uniform_float_values[0]; + return x_106; +} + +fn main_1() { + var param : f32; + let x_41 : f32 = gl_FragCoord.x; + param = x_41; + let x_42 : f32 = func_f1_(&(param)); + let x_44 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_42 == x_44)) { + let x_50 : i32 = x_11.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_59 : i32 = x_11.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_50), f32(x_53), f32(x_56), f32(x_59)); + } else { + let x_63 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_64 : f32 = f32(x_63); + x_GLF_color = vec4(x_64, x_64, x_64, x_64); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm new file mode 100644 index 0000000000..273ca9be7d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm @@ -0,0 +1,135 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %func_vf2_ "func(vf2;" + OpName %pos "pos" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zero" + OpName %__0 "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__1 "" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 2 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 0 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %bool = OpTypeBool + %22 = OpTypeFunction %bool %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %false = OpConstantFalse %bool + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__0 = OpVariable %_ptr_Uniform_buf2 Uniform + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__1 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %17 + %41 = OpLabel + %param = OpVariable %_ptr_Function_v2float Function + %42 = OpLoad %v4float %gl_FragCoord + %43 = OpVectorShuffle %v2float %42 %42 0 1 + OpStore %param %43 + %44 = OpFunctionCall %bool %func_vf2_ %param + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + OpKill + %45 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %48 + %50 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %51 + %53 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %54 + %56 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpCompositeConstruct %v4float %49 %52 %55 %58 + OpStore %_GLF_color %59 + OpReturn + OpFunctionEnd + %func_vf2_ = OpFunction %bool None %22 + %pos = OpFunctionParameter %_ptr_Function_v2float + %60 = OpLabel + %61 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %64 = OpLoad %float %63 + %65 = OpFOrdLessThan %bool %62 %64 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %66 + %67 = OpLabel + OpReturnValue %true + %66 = OpLabel + %68 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %69 = OpLoad %float %68 + %70 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %71 = OpLoad %float %70 + %72 = OpFOrdGreaterThan %bool %69 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + OpReturnValue %false + %73 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 + %76 = OpLoad %float %75 + %77 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %78 = OpLoad %float %77 + %79 = OpFOrdGreaterThan %bool %76 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %80 + %81 = OpLabel + OpReturnValue %true + %80 = OpLabel + OpReturnValue %true + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ca64df3ba9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.hlsl @@ -0,0 +1,69 @@ +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; +cbuffer cbuffer_x_10 : register(b2, space0) { + uint4 x_10[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[2]; +}; + +bool func_vf2_(inout float2 pos) { + const float x_62 = pos.x; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_64 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_62 < x_64)) { + return true; + } + const float x_69 = pos.y; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_71 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_69 > x_71)) { + return false; + } + const float x_76 = asfloat(x_10[0].x); + const float x_78 = asfloat(x_8[1].x); + if ((x_76 > x_78)) { + return true; + } + return true; +} + +void main_1() { + float2 param = float2(0.0f, 0.0f); + const float4 x_42 = gl_FragCoord; + param = float2(x_42.x, x_42.y); + const bool x_44 = func_vf2_(param); + if (x_44) { + discard; + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_48 = asint(x_13[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_51 = asint(x_13[1].x); + const int x_54 = asint(x_13[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_13[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_48), float(x_51), float(x_54), float(x_57)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d8dcfb969d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.msl @@ -0,0 +1,78 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ float zero; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +bool func_vf2_(constant buf1& x_8, constant buf2& x_10, thread float2* const pos) { + float const x_62 = (*(pos)).x; + float const x_64 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_62 < x_64)) { + return true; + } + float const x_69 = (*(pos)).y; + float const x_71 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_69 > x_71)) { + return false; + } + float const x_76 = x_10.zero; + float const x_78 = x_8.x_GLF_uniform_float_values.arr[1].el; + if ((x_76 > x_78)) { + return true; + } + return true; +} + +void main_1(constant buf1& x_8, constant buf2& x_10, constant buf0& x_13, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 param = 0.0f; + float4 const x_42 = *(tint_symbol_5); + param = float2(x_42.x, x_42.y); + bool const x_44 = func_vf2_(x_8, x_10, &(param)); + if (x_44) { + discard_fragment(); + } + int const x_48 = x_13.x_GLF_uniform_int_values.arr[0].el; + int const x_51 = x_13.x_GLF_uniform_int_values.arr[1].el; + int const x_54 = x_13.x_GLF_uniform_int_values.arr[1].el; + int const x_57 = x_13.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_48), float(x_51), float(x_54), float(x_57)); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_8 [[buffer(1)]], constant buf2& x_10 [[buffer(2)]], constant buf0& x_13 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, x_10, x_13, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..66c0a8ca61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.spvasm @@ -0,0 +1,175 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zero" + OpName %x_10 "x_10" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_13 "x_13" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_vf2_ "func_vf2_" + OpName %pos "pos" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_10 = OpVariable %_ptr_Uniform_buf2 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %14 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %14 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %14 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %14 + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %25 = OpTypeFunction %bool %_ptr_Function_v2float + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %63 = OpTypeFunction %void + %68 = OpConstantNull %v2float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %91 = OpTypeFunction %void %main_out + %func_vf2_ = OpFunction %bool None %25 + %pos = OpFunctionParameter %_ptr_Function_v2float + %31 = OpLabel + %35 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %36 = OpLoad %float %35 + %39 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpFOrdLessThan %bool %36 %40 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpReturnValue %true + %42 = OpLabel + %47 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %48 = OpLoad %float %47 + %49 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %50 = OpLoad %float %49 + %51 = OpFOrdGreaterThan %bool %48 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + OpReturnValue %false + %52 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %59 = OpLoad %float %58 + %60 = OpFOrdGreaterThan %bool %56 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpReturnValue %true + %61 = OpLabel + OpReturnValue %true + OpFunctionEnd + %main_1 = OpFunction %void None %63 + %66 = OpLabel + %param = OpVariable %_ptr_Function_v2float Function %68 + %69 = OpLoad %v4float %gl_FragCoord + %70 = OpCompositeExtract %float %69 0 + %71 = OpCompositeExtract %float %69 1 + %72 = OpCompositeConstruct %v2float %70 %71 + OpStore %param %72 + %73 = OpFunctionCall %bool %func_vf2_ %param + OpSelectionMerge %75 None + OpBranchConditional %73 %76 %75 + %76 = OpLabel + OpKill + %75 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_0 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %79 + %87 = OpConvertSToF %float %81 + %88 = OpConvertSToF %float %83 + %89 = OpConvertSToF %float %85 + %90 = OpCompositeConstruct %v4float %86 %87 %88 %89 + OpStore %x_GLF_color %90 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %91 +%tint_symbol_1 = OpFunctionParameter %main_out + %95 = OpLabel + %96 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %96 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %63 + %98 = OpLabel + %99 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %99 + %100 = OpFunctionCall %void %main_1 + %102 = OpLoad %v4float %x_GLF_color + %103 = OpCompositeConstruct %main_out %102 + %101 = OpFunctionCall %void %tint_symbol_3 %103 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..d35292308b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.spvasm.expected.wgsl @@ -0,0 +1,75 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + zero : f32; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(2)]] var x_10 : buf2; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_13 : buf0; + +fn func_vf2_(pos : ptr>) -> bool { + let x_62 : f32 = (*(pos)).x; + let x_64 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_62 < x_64)) { + return true; + } + let x_69 : f32 = (*(pos)).y; + let x_71 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_69 > x_71)) { + return false; + } + let x_76 : f32 = x_10.zero; + let x_78 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_76 > x_78)) { + return true; + } + return true; +} + +fn main_1() { + var param : vec2; + let x_42 : vec4 = gl_FragCoord; + param = vec2(x_42.x, x_42.y); + let x_44 : bool = func_vf2_(&(param)); + if (x_44) { + discard; + } + let x_48 : i32 = x_13.x_GLF_uniform_int_values[0]; + let x_51 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_54 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_57 : i32 = x_13.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_48), f32(x_51), f32(x_54), f32(x_57)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl new file mode 100644 index 0000000000..d35292308b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl @@ -0,0 +1,75 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + zero : f32; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(2)]] var x_10 : buf2; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_13 : buf0; + +fn func_vf2_(pos : ptr>) -> bool { + let x_62 : f32 = (*(pos)).x; + let x_64 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_62 < x_64)) { + return true; + } + let x_69 : f32 = (*(pos)).y; + let x_71 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_69 > x_71)) { + return false; + } + let x_76 : f32 = x_10.zero; + let x_78 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_76 > x_78)) { + return true; + } + return true; +} + +fn main_1() { + var param : vec2; + let x_42 : vec4 = gl_FragCoord; + param = vec2(x_42.x, x_42.y); + let x_44 : bool = func_vf2_(&(param)); + if (x_44) { + discard; + } + let x_48 : i32 = x_13.x_GLF_uniform_int_values[0]; + let x_51 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_54 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_57 : i32 = x_13.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_48), f32(x_51), f32(x_54), f32(x_57)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..ca64df3ba9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.hlsl @@ -0,0 +1,69 @@ +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; +cbuffer cbuffer_x_10 : register(b2, space0) { + uint4 x_10[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[2]; +}; + +bool func_vf2_(inout float2 pos) { + const float x_62 = pos.x; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_64 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_62 < x_64)) { + return true; + } + const float x_69 = pos.y; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_71 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_69 > x_71)) { + return false; + } + const float x_76 = asfloat(x_10[0].x); + const float x_78 = asfloat(x_8[1].x); + if ((x_76 > x_78)) { + return true; + } + return true; +} + +void main_1() { + float2 param = float2(0.0f, 0.0f); + const float4 x_42 = gl_FragCoord; + param = float2(x_42.x, x_42.y); + const bool x_44 = func_vf2_(param); + if (x_44) { + discard; + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_48 = asint(x_13[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_51 = asint(x_13[1].x); + const int x_54 = asint(x_13[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_13[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_48), float(x_51), float(x_54), float(x_57)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d8dcfb969d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.msl @@ -0,0 +1,78 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ float zero; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +bool func_vf2_(constant buf1& x_8, constant buf2& x_10, thread float2* const pos) { + float const x_62 = (*(pos)).x; + float const x_64 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_62 < x_64)) { + return true; + } + float const x_69 = (*(pos)).y; + float const x_71 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_69 > x_71)) { + return false; + } + float const x_76 = x_10.zero; + float const x_78 = x_8.x_GLF_uniform_float_values.arr[1].el; + if ((x_76 > x_78)) { + return true; + } + return true; +} + +void main_1(constant buf1& x_8, constant buf2& x_10, constant buf0& x_13, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 param = 0.0f; + float4 const x_42 = *(tint_symbol_5); + param = float2(x_42.x, x_42.y); + bool const x_44 = func_vf2_(x_8, x_10, &(param)); + if (x_44) { + discard_fragment(); + } + int const x_48 = x_13.x_GLF_uniform_int_values.arr[0].el; + int const x_51 = x_13.x_GLF_uniform_int_values.arr[1].el; + int const x_54 = x_13.x_GLF_uniform_int_values.arr[1].el; + int const x_57 = x_13.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_48), float(x_51), float(x_54), float(x_57)); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_8 [[buffer(1)]], constant buf2& x_10 [[buffer(2)]], constant buf0& x_13 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, x_10, x_13, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..66c0a8ca61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.spvasm @@ -0,0 +1,175 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zero" + OpName %x_10 "x_10" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_13 "x_13" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_vf2_ "func_vf2_" + OpName %pos "pos" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_10 = OpVariable %_ptr_Uniform_buf2 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %14 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %14 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %14 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %14 + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %25 = OpTypeFunction %bool %_ptr_Function_v2float + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %63 = OpTypeFunction %void + %68 = OpConstantNull %v2float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %91 = OpTypeFunction %void %main_out + %func_vf2_ = OpFunction %bool None %25 + %pos = OpFunctionParameter %_ptr_Function_v2float + %31 = OpLabel + %35 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %36 = OpLoad %float %35 + %39 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpFOrdLessThan %bool %36 %40 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpReturnValue %true + %42 = OpLabel + %47 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %48 = OpLoad %float %47 + %49 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %50 = OpLoad %float %49 + %51 = OpFOrdGreaterThan %bool %48 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + OpReturnValue %false + %52 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %59 = OpLoad %float %58 + %60 = OpFOrdGreaterThan %bool %56 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpReturnValue %true + %61 = OpLabel + OpReturnValue %true + OpFunctionEnd + %main_1 = OpFunction %void None %63 + %66 = OpLabel + %param = OpVariable %_ptr_Function_v2float Function %68 + %69 = OpLoad %v4float %gl_FragCoord + %70 = OpCompositeExtract %float %69 0 + %71 = OpCompositeExtract %float %69 1 + %72 = OpCompositeConstruct %v2float %70 %71 + OpStore %param %72 + %73 = OpFunctionCall %bool %func_vf2_ %param + OpSelectionMerge %75 None + OpBranchConditional %73 %76 %75 + %76 = OpLabel + OpKill + %75 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_0 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %79 + %87 = OpConvertSToF %float %81 + %88 = OpConvertSToF %float %83 + %89 = OpConvertSToF %float %85 + %90 = OpCompositeConstruct %v4float %86 %87 %88 %89 + OpStore %x_GLF_color %90 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %91 +%tint_symbol_1 = OpFunctionParameter %main_out + %95 = OpLabel + %96 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %96 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %63 + %98 = OpLabel + %99 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %99 + %100 = OpFunctionCall %void %main_1 + %102 = OpLoad %v4float %x_GLF_color + %103 = OpCompositeConstruct %main_out %102 + %101 = OpFunctionCall %void %tint_symbol_3 %103 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..d35292308b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-function-vec2-never-discard/0-opt.wgsl.expected.wgsl @@ -0,0 +1,75 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + zero : f32; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(2)]] var x_10 : buf2; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_13 : buf0; + +fn func_vf2_(pos : ptr>) -> bool { + let x_62 : f32 = (*(pos)).x; + let x_64 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_62 < x_64)) { + return true; + } + let x_69 : f32 = (*(pos)).y; + let x_71 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_69 > x_71)) { + return false; + } + let x_76 : f32 = x_10.zero; + let x_78 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_76 > x_78)) { + return true; + } + return true; +} + +fn main_1() { + var param : vec2; + let x_42 : vec4 = gl_FragCoord; + param = vec2(x_42.x, x_42.y); + let x_44 : bool = func_vf2_(&(param)); + if (x_44) { + discard; + } + let x_48 : i32 = x_13.x_GLF_uniform_int_values[0]; + let x_51 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_54 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_57 : i32 = x_13.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_48), f32(x_51), f32(x_54), f32(x_57)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm new file mode 100644 index 0000000000..20110aaa34 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm @@ -0,0 +1,113 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %_GLF_global_loop_count "_GLF_global_loop_count" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int +%_GLF_global_loop_count = OpVariable %_ptr_Private_int Private + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %main = OpFunction %void None %9 + %24 = OpLabel + OpStore %_GLF_global_loop_count %int_0 + %25 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %26 = OpLoad %int %25 + %27 = OpConvertSToF %float %26 + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %29 = OpLoad %int %28 + %30 = OpConvertSToF %float %29 + %31 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %32 = OpLoad %int %31 + %33 = OpConvertSToF %float %32 + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %35 = OpLoad %int %34 + %36 = OpConvertSToF %float %35 + %37 = OpCompositeConstruct %v4float %27 %30 %33 %36 + OpStore %_GLF_color %37 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %int %_GLF_global_loop_count + %43 = OpSLessThan %bool %42 %int_100 + OpBranchConditional %43 %44 %39 + %44 = OpLabel + %45 = OpLoad %int %_GLF_global_loop_count + %46 = OpIAdd %int %45 %int_1 + OpStore %_GLF_global_loop_count %46 + %47 = OpLogicalNot %bool %true + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpIEqual %bool %51 %53 + OpBranch %48 + %48 = OpLabel + %55 = OpPhi %bool %true %44 %54 %49 + %56 = OpLogicalNot %bool %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + OpBranch %39 + %57 = OpLabel + OpBranch %40 + %40 = OpLabel + OpBranch %38 + %39 = OpLabel + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %int %_GLF_global_loop_count + %64 = OpSLessThan %bool %63 %int_100 + OpBranchConditional %64 %65 %60 + %65 = OpLabel + %66 = OpLoad %int %_GLF_global_loop_count + %67 = OpIAdd %int %66 %int_1 + OpStore %_GLF_global_loop_count %67 + %68 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %69 + %71 = OpCompositeConstruct %v4float %70 %70 %70 %70 + OpStore %_GLF_color %71 + OpBranch %61 + %61 = OpLabel + OpBranch %59 + %60 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f3abef732a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.hlsl @@ -0,0 +1,62 @@ +static int x_GLF_global_loop_count = 0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; + +void main_1() { + x_GLF_global_loop_count = 0; + const int x_26 = asint(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_32 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_35 = asint(x_6[1].x); + x_GLF_color = float4(float(x_26), float(x_29), float(x_32), float(x_35)); + while (true) { + bool x_54 = false; + bool x_55_phi = false; + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + x_55_phi = true; + if (!(true)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_51 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_53 = asint(x_6[1].x); + x_54 = (x_51 == x_53); + x_55_phi = x_54; + } + if (!(x_55_phi)) { + break; + } + } + while (true) { + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_69 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_70 = float(x_69); + x_GLF_color = float4(x_70, x_70, x_70, x_70); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..80f3c6a5db --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.msl @@ -0,0 +1,73 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + *(tint_symbol_4) = 0; + int const x_26 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_5) = float4(float(x_26), float(x_29), float(x_32), float(x_35)); + while (true) { + bool x_54 = false; + bool x_55_phi = false; + int const x_42 = *(tint_symbol_4); + if ((x_42 < 100)) { + } else { + break; + } + int const x_45 = *(tint_symbol_4); + *(tint_symbol_4) = (x_45 + 1); + x_55_phi = true; + if (!(true)) { + int const x_51 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + x_54 = (x_51 == x_53); + x_55_phi = x_54; + } + bool const x_55 = x_55_phi; + if (!(x_55)) { + break; + } + } + while (true) { + int const x_63 = *(tint_symbol_4); + if ((x_63 < 100)) { + } else { + break; + } + int const x_66 = *(tint_symbol_4); + *(tint_symbol_4) = (x_66 + 1); + int const x_69 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_70 = float(x_69); + *(tint_symbol_5) = float4(x_70, x_70, x_70, x_70); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_6, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..d85fb18fe7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.spvasm @@ -0,0 +1,166 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 97 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_54 "x_54" + OpName %x_55_phi "x_55_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %46 = OpConstantNull %bool + %int_100 = OpConstant %int 100 + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %85 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %x_54 = OpVariable %_ptr_Function_bool Function %46 + %x_55_phi = OpVariable %_ptr_Function_bool Function %46 + OpStore %x_GLF_global_loop_count %int_0 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %29 = OpLoad %int %28 + %30 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %33 = OpLoad %int %32 + %34 = OpConvertSToF %float %27 + %35 = OpConvertSToF %float %29 + %36 = OpConvertSToF %float %31 + %37 = OpConvertSToF %float %33 + %38 = OpCompositeConstruct %v4float %34 %35 %36 %37 + OpStore %x_GLF_color %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %48 = OpLoad %int %x_GLF_global_loop_count + %50 = OpSLessThan %bool %48 %int_100 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpBranch %51 + %53 = OpLabel + OpBranch %40 + %51 = OpLabel + %54 = OpLoad %int %x_GLF_global_loop_count + %55 = OpIAdd %int %54 %int_1 + OpStore %x_GLF_global_loop_count %55 + OpStore %x_55_phi %true + %57 = OpLogicalNot %bool %true + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpIEqual %bool %61 %63 + OpStore %x_54 %64 + %65 = OpLoad %bool %x_54 + OpStore %x_55_phi %65 + OpBranch %58 + %58 = OpLabel + %66 = OpLoad %bool %x_55_phi + %67 = OpLogicalNot %bool %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + OpBranch %40 + %68 = OpLabel + OpBranch %41 + %41 = OpLabel + OpBranch %39 + %40 = OpLabel + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %int %x_GLF_global_loop_count + %75 = OpSLessThan %bool %74 %int_100 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %78 + %77 = OpLabel + OpBranch %76 + %78 = OpLabel + OpBranch %71 + %76 = OpLabel + %79 = OpLoad %int %x_GLF_global_loop_count + %80 = OpIAdd %int %79 %int_1 + OpStore %x_GLF_global_loop_count %80 + %81 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %82 = OpLoad %int %81 + %83 = OpConvertSToF %float %82 + %84 = OpCompositeConstruct %v4float %83 %83 %83 %83 + OpStore %x_GLF_color %84 + OpBranch %72 + %72 = OpLabel + OpBranch %70 + %71 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %85 +%tint_symbol = OpFunctionParameter %main_out + %89 = OpLabel + %90 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %90 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %92 = OpLabel + %93 = OpFunctionCall %void %main_1 + %95 = OpLoad %v4float %x_GLF_color + %96 = OpCompositeConstruct %main_out %95 + %94 = OpFunctionCall %void %tint_symbol_2 %96 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..1beed3d548 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.spvasm.expected.wgsl @@ -0,0 +1,67 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + x_GLF_global_loop_count = 0; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_26), f32(x_29), f32(x_32), f32(x_35)); + loop { + var x_54 : bool; + var x_55_phi : bool; + let x_42 : i32 = x_GLF_global_loop_count; + if ((x_42 < 100)) { + } else { + break; + } + let x_45 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_45 + 1); + x_55_phi = true; + if (!(true)) { + let x_51 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_54 = (x_51 == x_53); + x_55_phi = x_54; + } + let x_55 : bool = x_55_phi; + if (!(x_55)) { + break; + } + } + loop { + let x_63 : i32 = x_GLF_global_loop_count; + if ((x_63 < 100)) { + } else { + break; + } + let x_66 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_66 + 1); + let x_69 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_70 : f32 = f32(x_69); + x_GLF_color = vec4(x_70, x_70, x_70, x_70); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl new file mode 100644 index 0000000000..1beed3d548 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl @@ -0,0 +1,67 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + x_GLF_global_loop_count = 0; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_26), f32(x_29), f32(x_32), f32(x_35)); + loop { + var x_54 : bool; + var x_55_phi : bool; + let x_42 : i32 = x_GLF_global_loop_count; + if ((x_42 < 100)) { + } else { + break; + } + let x_45 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_45 + 1); + x_55_phi = true; + if (!(true)) { + let x_51 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_54 = (x_51 == x_53); + x_55_phi = x_54; + } + let x_55 : bool = x_55_phi; + if (!(x_55)) { + break; + } + } + loop { + let x_63 : i32 = x_GLF_global_loop_count; + if ((x_63 < 100)) { + } else { + break; + } + let x_66 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_66 + 1); + let x_69 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_70 : f32 = f32(x_69); + x_GLF_color = vec4(x_70, x_70, x_70, x_70); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f3abef732a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.hlsl @@ -0,0 +1,62 @@ +static int x_GLF_global_loop_count = 0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; + +void main_1() { + x_GLF_global_loop_count = 0; + const int x_26 = asint(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_32 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_35 = asint(x_6[1].x); + x_GLF_color = float4(float(x_26), float(x_29), float(x_32), float(x_35)); + while (true) { + bool x_54 = false; + bool x_55_phi = false; + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + x_55_phi = true; + if (!(true)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_51 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_53 = asint(x_6[1].x); + x_54 = (x_51 == x_53); + x_55_phi = x_54; + } + if (!(x_55_phi)) { + break; + } + } + while (true) { + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_69 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_70 = float(x_69); + x_GLF_color = float4(x_70, x_70, x_70, x_70); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..80f3c6a5db --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.msl @@ -0,0 +1,73 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + *(tint_symbol_4) = 0; + int const x_26 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_5) = float4(float(x_26), float(x_29), float(x_32), float(x_35)); + while (true) { + bool x_54 = false; + bool x_55_phi = false; + int const x_42 = *(tint_symbol_4); + if ((x_42 < 100)) { + } else { + break; + } + int const x_45 = *(tint_symbol_4); + *(tint_symbol_4) = (x_45 + 1); + x_55_phi = true; + if (!(true)) { + int const x_51 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + x_54 = (x_51 == x_53); + x_55_phi = x_54; + } + bool const x_55 = x_55_phi; + if (!(x_55)) { + break; + } + } + while (true) { + int const x_63 = *(tint_symbol_4); + if ((x_63 < 100)) { + } else { + break; + } + int const x_66 = *(tint_symbol_4); + *(tint_symbol_4) = (x_66 + 1); + int const x_69 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_70 = float(x_69); + *(tint_symbol_5) = float4(x_70, x_70, x_70, x_70); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_6, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..d85fb18fe7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.spvasm @@ -0,0 +1,166 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 97 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_54 "x_54" + OpName %x_55_phi "x_55_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %46 = OpConstantNull %bool + %int_100 = OpConstant %int 100 + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %85 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %x_54 = OpVariable %_ptr_Function_bool Function %46 + %x_55_phi = OpVariable %_ptr_Function_bool Function %46 + OpStore %x_GLF_global_loop_count %int_0 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %29 = OpLoad %int %28 + %30 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %33 = OpLoad %int %32 + %34 = OpConvertSToF %float %27 + %35 = OpConvertSToF %float %29 + %36 = OpConvertSToF %float %31 + %37 = OpConvertSToF %float %33 + %38 = OpCompositeConstruct %v4float %34 %35 %36 %37 + OpStore %x_GLF_color %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %48 = OpLoad %int %x_GLF_global_loop_count + %50 = OpSLessThan %bool %48 %int_100 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpBranch %51 + %53 = OpLabel + OpBranch %40 + %51 = OpLabel + %54 = OpLoad %int %x_GLF_global_loop_count + %55 = OpIAdd %int %54 %int_1 + OpStore %x_GLF_global_loop_count %55 + OpStore %x_55_phi %true + %57 = OpLogicalNot %bool %true + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpIEqual %bool %61 %63 + OpStore %x_54 %64 + %65 = OpLoad %bool %x_54 + OpStore %x_55_phi %65 + OpBranch %58 + %58 = OpLabel + %66 = OpLoad %bool %x_55_phi + %67 = OpLogicalNot %bool %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + OpBranch %40 + %68 = OpLabel + OpBranch %41 + %41 = OpLabel + OpBranch %39 + %40 = OpLabel + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %int %x_GLF_global_loop_count + %75 = OpSLessThan %bool %74 %int_100 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %78 + %77 = OpLabel + OpBranch %76 + %78 = OpLabel + OpBranch %71 + %76 = OpLabel + %79 = OpLoad %int %x_GLF_global_loop_count + %80 = OpIAdd %int %79 %int_1 + OpStore %x_GLF_global_loop_count %80 + %81 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %82 = OpLoad %int %81 + %83 = OpConvertSToF %float %82 + %84 = OpCompositeConstruct %v4float %83 %83 %83 %83 + OpStore %x_GLF_color %84 + OpBranch %72 + %72 = OpLabel + OpBranch %70 + %71 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %85 +%tint_symbol = OpFunctionParameter %main_out + %89 = OpLabel + %90 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %90 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %92 = OpLabel + %93 = OpFunctionCall %void %main_1 + %95 = OpLoad %v4float %x_GLF_color + %96 = OpCompositeConstruct %main_out %95 + %94 = OpFunctionCall %void %tint_symbol_2 %96 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..1beed3d548 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-bound-true-logical-or/0-opt.wgsl.expected.wgsl @@ -0,0 +1,67 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + x_GLF_global_loop_count = 0; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_26), f32(x_29), f32(x_32), f32(x_35)); + loop { + var x_54 : bool; + var x_55_phi : bool; + let x_42 : i32 = x_GLF_global_loop_count; + if ((x_42 < 100)) { + } else { + break; + } + let x_45 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_45 + 1); + x_55_phi = true; + if (!(true)) { + let x_51 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_54 = (x_51 == x_53); + x_55_phi = x_54; + } + let x_55 : bool = x_55_phi; + if (!(x_55)) { + break; + } + } + loop { + let x_63 : i32 = x_GLF_global_loop_count; + if ((x_63 < 100)) { + } else { + break; + } + let x_66 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_66 + 1); + let x_69 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_70 : f32 = f32(x_69); + x_GLF_color = vec4(x_70, x_70, x_70, x_70); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm new file mode 100644 index 0000000000..be0f8f340e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm @@ -0,0 +1,267 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %_GLF_global_loop_count "_GLF_global_loop_count" + OpName %m "m" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %v "v" + OpName %f "f" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %b "b" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "one" + OpName %__1 "" + OpName %zero "zero" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_18 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 2 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int +%_GLF_global_loop_count = OpVariable %_ptr_Private_int Private + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %uint = OpTypeInt 32 0 + %uint_18 = OpConstant %uint 18 +%_arr_float_uint_18 = OpTypeArray %float %uint_18 + %buf1 = OpTypeStruct %_arr_float_uint_18 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %int_11 = OpConstant %int 11 + %int_12 = OpConstant %int 12 + %int_13 = OpConstant %int 13 + %int_14 = OpConstant %int 14 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function_int = OpTypePointer Function %int + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %buf2 = OpTypeStruct %int +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__1 = OpVariable %_ptr_Uniform_buf2 Uniform + %int_17 = OpConstant %int 17 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %20 + %60 = OpLabel + %m = OpVariable %_ptr_Function_mat4v4float Function + %v = OpVariable %_ptr_Function_v4float Function + %f = OpVariable %_ptr_Function_float Function + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %zero = OpVariable %_ptr_Function_float Function + OpStore %_GLF_global_loop_count %int_0 + %61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %64 = OpLoad %float %63 + %65 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_4 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_5 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_6 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_7 + %74 = OpLoad %float %73 + %75 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_8 + %76 = OpLoad %float %75 + %77 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_9 + %78 = OpLoad %float %77 + %79 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_10 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_11 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_12 + %84 = OpLoad %float %83 + %85 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_13 + %86 = OpLoad %float %85 + %87 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_14 + %88 = OpLoad %float %87 + %89 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_15 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_16 + %92 = OpLoad %float %91 + %93 = OpCompositeConstruct %v4float %62 %64 %66 %68 + %94 = OpCompositeConstruct %v4float %70 %72 %74 %76 + %95 = OpCompositeConstruct %v4float %78 %80 %82 %84 + %96 = OpCompositeConstruct %v4float %86 %88 %90 %92 + %97 = OpCompositeConstruct %mat4v4float %93 %94 %95 %96 + OpStore %m %97 + %98 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %101 = OpLoad %float %100 + %102 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_4 + %105 = OpLoad %float %104 + %106 = OpCompositeConstruct %v4float %99 %101 %103 %105 + OpStore %v %106 + %107 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %108 = OpLoad %float %107 + OpStore %f %108 + %109 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %110 = OpLoad %int %109 + OpStore %a %110 + OpBranch %111 + %111 = OpLabel + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %115 = OpLoad %int %_GLF_global_loop_count + %116 = OpSLessThan %bool %115 %int_10 + OpBranchConditional %116 %117 %112 + %117 = OpLabel + %118 = OpLoad %int %_GLF_global_loop_count + %119 = OpIAdd %int %118 %int_1 + OpStore %_GLF_global_loop_count %119 + %120 = OpLoad %int %a + %121 = OpExtInst %int %1 SClamp %120 %int_0 %int_3 + %122 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %123 = OpLoad %float %122 + %124 = OpAccessChain %_ptr_Function_float %v %121 + %125 = OpLoad %float %124 + %126 = OpFAdd %float %125 %123 + %127 = OpAccessChain %_ptr_Function_float %v %121 + OpStore %127 %126 + %128 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %129 = OpLoad %int %128 + OpStore %b %129 + OpBranch %130 + %130 = OpLabel + OpLoopMerge %131 %132 None + OpBranch %133 + %133 = OpLabel + %134 = OpLoad %int %_GLF_global_loop_count + %135 = OpSLessThan %bool %134 %int_10 + OpBranchConditional %135 %136 %131 + %136 = OpLabel + %137 = OpLoad %int %_GLF_global_loop_count + %138 = OpIAdd %int %137 %int_1 + OpStore %_GLF_global_loop_count %138 + %139 = OpLoad %int %b + %140 = OpExtInst %int %1 SClamp %139 %int_0 %int_3 + %141 = OpAccessChain %_ptr_Function_float %v %140 + %142 = OpLoad %float %141 + %143 = OpLoad %int %b + %144 = OpExtInst %int %1 SClamp %143 %int_0 %int_3 + %145 = OpLoad %int %a + %146 = OpAccessChain %_ptr_Function_float %m %144 %145 + %147 = OpLoad %float %146 + %148 = OpFMul %float %142 %147 + %149 = OpLoad %float %f + %150 = OpFAdd %float %149 %148 + OpStore %f %150 + OpBranch %132 + %132 = OpLabel + %151 = OpLoad %int %b + %152 = OpISub %int %151 %int_1 + OpStore %b %152 + OpBranch %130 + %131 = OpLabel + %153 = OpLoad %int %a + %154 = OpExtInst %int %1 SClamp %153 %int_0 %int_3 + %155 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %156 = OpLoad %float %155 + %157 = OpAccessChain %_ptr_Function_float %m %int_1 %154 + OpStore %157 %156 + %158 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 + %159 = OpLoad %int %158 + %160 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %161 = OpLoad %int %160 + %162 = OpIEqual %bool %159 %161 + OpSelectionMerge %163 None + OpBranchConditional %162 %164 %163 + %164 = OpLabel + OpKill + %163 = OpLabel + %165 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 + %166 = OpLoad %int %165 + %167 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %168 = OpLoad %int %167 + %169 = OpIEqual %bool %166 %168 + OpSelectionMerge %170 None + OpBranchConditional %169 %171 %170 + %171 = OpLabel + OpKill + %170 = OpLabel + OpBranch %113 + %113 = OpLabel + %172 = OpLoad %int %a + %173 = OpIAdd %int %172 %int_1 + OpStore %a %173 + OpBranch %111 + %112 = OpLabel + %174 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %175 = OpLoad %float %174 + OpStore %zero %175 + %176 = OpLoad %float %f + %177 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_17 + %178 = OpLoad %float %177 + %179 = OpFUnordNotEqual %bool %176 %178 + OpSelectionMerge %180 None + OpBranchConditional %179 %181 %180 + %181 = OpLabel + %182 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %183 = OpLoad %float %182 + OpStore %zero %183 + OpBranch %180 + %180 = OpLabel + %184 = OpLoad %float %f + %185 = OpLoad %float %zero + %186 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %187 = OpLoad %int %186 + %188 = OpConvertSToF %float %187 + %189 = OpLoad %float %f + %190 = OpCompositeConstruct %v4float %184 %185 %188 %189 + OpStore %_GLF_color %190 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..1765c5c5aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.hlsl @@ -0,0 +1,114 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[18]; +}; +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[4]; +}; +cbuffer cbuffer_x_15 : register(b2, space0) { + uint4 x_15[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x4 m = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + float f = 0.0f; + int a = 0; + int b = 0; + float zero = 0.0f; + x_GLF_global_loop_count = 0; + const float x_62 = asfloat(x_7[1].x); + const float x_64 = asfloat(x_7[2].x); + const float x_66 = asfloat(x_7[3].x); + const float x_68 = asfloat(x_7[4].x); + const float x_70 = asfloat(x_7[5].x); + const float x_72 = asfloat(x_7[6].x); + const float x_74 = asfloat(x_7[7].x); + const float x_76 = asfloat(x_7[8].x); + const float x_78 = asfloat(x_7[9].x); + const float x_80 = asfloat(x_7[10].x); + const float x_82 = asfloat(x_7[11].x); + const float x_84 = asfloat(x_7[12].x); + const float x_86 = asfloat(x_7[13].x); + const float x_88 = asfloat(x_7[14].x); + const float x_90 = asfloat(x_7[15].x); + const float x_92 = asfloat(x_7[16].x); + m = float4x4(float4(x_62, x_64, x_66, x_68), float4(x_70, x_72, x_74, x_76), float4(x_78, x_80, x_82, x_84), float4(x_86, x_88, x_90, x_92)); + const float x_99 = asfloat(x_7[1].x); + const float x_101 = asfloat(x_7[2].x); + const float x_103 = asfloat(x_7[3].x); + const float x_105 = asfloat(x_7[4].x); + v = float4(x_99, x_101, x_103, x_105); + const float x_108 = asfloat(x_7[1].x); + f = x_108; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_110 = asint(x_12[scalar_offset / 4][scalar_offset % 4]); + a = x_110; + { + for(; (x_GLF_global_loop_count < 10); a = (a + 1)) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const int x_121 = clamp(a, 0, 3); + const float x_123 = asfloat(x_7[1].x); + const float x_125 = v[x_121]; + set_float4(v, x_121, (x_125 + x_123)); + const int x_129 = asint(x_12[2].x); + b = x_129; + { + for(; (x_GLF_global_loop_count < 10); b = (b - 1)) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const float x_142 = v[clamp(b, 0, 3)]; + const float x_147 = m[clamp(b, 0, 3)][a]; + f = (f + (x_142 * x_147)); + } + } + const int x_153 = a; + const float x_156 = asfloat(x_7[1].x); + set_float4(m[1], clamp(x_153, 0, 3), x_156); + const int x_159 = asint(x_15[0].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_161 = asint(x_12[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_159 == x_161)) { + discard; + } + const int x_166 = asint(x_15[0].x); + const int x_168 = asint(x_12[1].x); + if ((x_166 == x_168)) { + discard; + } + } + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_175 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + zero = x_175; + const float x_176 = f; + const float x_178 = asfloat(x_7[17].x); + if (!((x_176 == x_178))) { + const float x_183 = asfloat(x_7[1].x); + zero = x_183; + } + const float x_184 = f; + const float x_185 = zero; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_187 = asint(x_12[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(x_184, x_185, float(x_187), f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..68f79989e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.msl @@ -0,0 +1,145 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[18]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct buf2 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_12, constant buf2& x_15, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + float4x4 m = float4x4(0.0f); + float4 v = 0.0f; + float f = 0.0f; + int a = 0; + int b = 0; + float zero = 0.0f; + *(tint_symbol_4) = 0; + float const x_62 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_64 = x_7.x_GLF_uniform_float_values.arr[2].el; + float const x_66 = x_7.x_GLF_uniform_float_values.arr[3].el; + float const x_68 = x_7.x_GLF_uniform_float_values.arr[4].el; + float const x_70 = x_7.x_GLF_uniform_float_values.arr[5].el; + float const x_72 = x_7.x_GLF_uniform_float_values.arr[6].el; + float const x_74 = x_7.x_GLF_uniform_float_values.arr[7].el; + float const x_76 = x_7.x_GLF_uniform_float_values.arr[8].el; + float const x_78 = x_7.x_GLF_uniform_float_values.arr[9].el; + float const x_80 = x_7.x_GLF_uniform_float_values.arr[10].el; + float const x_82 = x_7.x_GLF_uniform_float_values.arr[11].el; + float const x_84 = x_7.x_GLF_uniform_float_values.arr[12].el; + float const x_86 = x_7.x_GLF_uniform_float_values.arr[13].el; + float const x_88 = x_7.x_GLF_uniform_float_values.arr[14].el; + float const x_90 = x_7.x_GLF_uniform_float_values.arr[15].el; + float const x_92 = x_7.x_GLF_uniform_float_values.arr[16].el; + m = float4x4(float4(x_62, x_64, x_66, x_68), float4(x_70, x_72, x_74, x_76), float4(x_78, x_80, x_82, x_84), float4(x_86, x_88, x_90, x_92)); + float const x_99 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_101 = x_7.x_GLF_uniform_float_values.arr[2].el; + float const x_103 = x_7.x_GLF_uniform_float_values.arr[3].el; + float const x_105 = x_7.x_GLF_uniform_float_values.arr[4].el; + v = float4(x_99, x_101, x_103, x_105); + float const x_108 = x_7.x_GLF_uniform_float_values.arr[1].el; + f = x_108; + int const x_110 = x_12.x_GLF_uniform_int_values.arr[0].el; + a = x_110; + while (true) { + int const x_115 = *(tint_symbol_4); + if ((x_115 < 10)) { + } else { + break; + } + int const x_118 = *(tint_symbol_4); + *(tint_symbol_4) = (x_118 + 1); + int const x_120 = a; + int const x_121 = clamp(x_120, 0, 3); + float const x_123 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_125 = v[x_121]; + v[x_121] = (x_125 + x_123); + int const x_129 = x_12.x_GLF_uniform_int_values.arr[2].el; + b = x_129; + while (true) { + int const x_134 = *(tint_symbol_4); + if ((x_134 < 10)) { + } else { + break; + } + int const x_137 = *(tint_symbol_4); + *(tint_symbol_4) = (x_137 + 1); + int const x_139 = b; + float const x_142 = v[clamp(x_139, 0, 3)]; + int const x_143 = b; + int const x_145 = a; + float const x_147 = m[clamp(x_143, 0, 3)][x_145]; + float const x_149 = f; + f = (x_149 + (x_142 * x_147)); + { + int const x_151 = b; + b = (x_151 - 1); + } + } + int const x_153 = a; + float const x_156 = x_7.x_GLF_uniform_float_values.arr[1].el; + m[1][clamp(x_153, 0, 3)] = x_156; + int const x_159 = x_15.one; + int const x_161 = x_12.x_GLF_uniform_int_values.arr[0].el; + if ((x_159 == x_161)) { + discard_fragment(); + } + int const x_166 = x_15.one; + int const x_168 = x_12.x_GLF_uniform_int_values.arr[1].el; + if ((x_166 == x_168)) { + discard_fragment(); + } + { + int const x_172 = a; + a = (x_172 + 1); + } + } + float const x_175 = x_7.x_GLF_uniform_float_values.arr[0].el; + zero = x_175; + float const x_176 = f; + float const x_178 = x_7.x_GLF_uniform_float_values.arr[17].el; + if (!((x_176 == x_178))) { + float const x_183 = x_7.x_GLF_uniform_float_values.arr[1].el; + zero = x_183; + } + float const x_184 = f; + float const x_185 = zero; + int const x_187 = x_12.x_GLF_uniform_int_values.arr[0].el; + float const x_189 = f; + *(tint_symbol_5) = float4(x_184, x_185, float(x_187), x_189); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_12 [[buffer(0)]], constant buf2& x_15 [[buffer(2)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_7, x_12, x_15, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f1de9d2bf8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.spvasm @@ -0,0 +1,314 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 213 +; Schema: 0 + OpCapability Shader + %127 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_12 "x_12" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "one" + OpName %x_15 "x_15" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %v "v" + OpName %f "f" + OpName %a "a" + OpName %b "b" + OpName %zero "zero" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_18 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_15 NonWritable + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 2 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_18 = OpConstant %uint 18 +%_arr_float_uint_18 = OpTypeArray %float %uint_18 + %buf1 = OpTypeStruct %_arr_float_uint_18 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform + %buf2 = OpTypeStruct %int +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_15 = OpVariable %_ptr_Uniform_buf2 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %23 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %23 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %23 + %void = OpTypeVoid + %26 = OpTypeFunction %void +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %33 = OpConstantNull %mat4v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %38 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %int_11 = OpConstant %int 11 + %int_12 = OpConstant %int 12 + %int_13 = OpConstant %int 13 + %int_14 = OpConstant %int 14 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_17 = OpConstant %int 17 + %main_out = OpTypeStruct %v4float + %201 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %26 + %29 = OpLabel + %m = OpVariable %_ptr_Function_mat4v4float Function %33 + %v = OpVariable %_ptr_Function_v4float Function %23 + %f = OpVariable %_ptr_Function_float Function %38 + %a = OpVariable %_ptr_Function_int Function %4 + %b = OpVariable %_ptr_Function_int Function %4 + %zero = OpVariable %_ptr_Function_float Function %38 + OpStore %x_GLF_global_loop_count %int_0 + %47 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %48 = OpLoad %float %47 + %50 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %51 = OpLoad %float %50 + %53 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3 + %54 = OpLoad %float %53 + %56 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_4 + %57 = OpLoad %float %56 + %59 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_5 + %60 = OpLoad %float %59 + %62 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_6 + %63 = OpLoad %float %62 + %65 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_7 + %66 = OpLoad %float %65 + %68 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_8 + %69 = OpLoad %float %68 + %71 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_9 + %72 = OpLoad %float %71 + %74 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_10 + %75 = OpLoad %float %74 + %77 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_11 + %78 = OpLoad %float %77 + %80 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_12 + %81 = OpLoad %float %80 + %83 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_13 + %84 = OpLoad %float %83 + %86 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_14 + %87 = OpLoad %float %86 + %89 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_15 + %90 = OpLoad %float %89 + %92 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_16 + %93 = OpLoad %float %92 + %94 = OpCompositeConstruct %v4float %48 %51 %54 %57 + %95 = OpCompositeConstruct %v4float %60 %63 %66 %69 + %96 = OpCompositeConstruct %v4float %72 %75 %78 %81 + %97 = OpCompositeConstruct %v4float %84 %87 %90 %93 + %98 = OpCompositeConstruct %mat4v4float %94 %95 %96 %97 + OpStore %m %98 + %99 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %100 = OpLoad %float %99 + %101 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %102 = OpLoad %float %101 + %103 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3 + %104 = OpLoad %float %103 + %105 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_4 + %106 = OpLoad %float %105 + %107 = OpCompositeConstruct %v4float %100 %102 %104 %106 + OpStore %v %107 + %108 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %109 = OpLoad %float %108 + OpStore %f %109 + %111 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %112 = OpLoad %int %111 + OpStore %a %112 + OpBranch %113 + %113 = OpLabel + OpLoopMerge %114 %115 None + OpBranch %116 + %116 = OpLabel + %117 = OpLoad %int %x_GLF_global_loop_count + %118 = OpSLessThan %bool %117 %int_10 + OpSelectionMerge %120 None + OpBranchConditional %118 %121 %122 + %121 = OpLabel + OpBranch %120 + %122 = OpLabel + OpBranch %114 + %120 = OpLabel + %123 = OpLoad %int %x_GLF_global_loop_count + %124 = OpIAdd %int %123 %int_1 + OpStore %x_GLF_global_loop_count %124 + %125 = OpLoad %int %a + %126 = OpExtInst %int %127 SClamp %125 %int_0 %int_3 + %128 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %129 = OpLoad %float %128 + %130 = OpAccessChain %_ptr_Function_float %v %126 + %131 = OpLoad %float %130 + %132 = OpAccessChain %_ptr_Function_float %v %126 + %133 = OpFAdd %float %131 %129 + OpStore %132 %133 + %134 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_2 + %135 = OpLoad %int %134 + OpStore %b %135 + OpBranch %136 + %136 = OpLabel + OpLoopMerge %137 %138 None + OpBranch %139 + %139 = OpLabel + %140 = OpLoad %int %x_GLF_global_loop_count + %141 = OpSLessThan %bool %140 %int_10 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %144 + %143 = OpLabel + OpBranch %142 + %144 = OpLabel + OpBranch %137 + %142 = OpLabel + %145 = OpLoad %int %x_GLF_global_loop_count + %146 = OpIAdd %int %145 %int_1 + OpStore %x_GLF_global_loop_count %146 + %147 = OpLoad %int %b + %148 = OpExtInst %int %127 SClamp %147 %int_0 %int_3 + %149 = OpAccessChain %_ptr_Function_float %v %148 + %150 = OpLoad %float %149 + %151 = OpLoad %int %b + %152 = OpLoad %int %a + %153 = OpExtInst %int %127 SClamp %151 %int_0 %int_3 + %154 = OpAccessChain %_ptr_Function_float %m %153 %152 + %155 = OpLoad %float %154 + %156 = OpLoad %float %f + %157 = OpFMul %float %150 %155 + %158 = OpFAdd %float %156 %157 + OpStore %f %158 + OpBranch %138 + %138 = OpLabel + %159 = OpLoad %int %b + %160 = OpISub %int %159 %int_1 + OpStore %b %160 + OpBranch %136 + %137 = OpLabel + %161 = OpLoad %int %a + %162 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %163 = OpLoad %float %162 + %164 = OpExtInst %int %127 SClamp %161 %int_0 %int_3 + %165 = OpAccessChain %_ptr_Function_float %m %int_1 %164 + OpStore %165 %163 + %166 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 + %167 = OpLoad %int %166 + %168 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %169 = OpLoad %int %168 + %170 = OpIEqual %bool %167 %169 + OpSelectionMerge %171 None + OpBranchConditional %170 %172 %171 + %172 = OpLabel + OpKill + %171 = OpLabel + %173 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 + %174 = OpLoad %int %173 + %175 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %176 = OpLoad %int %175 + %177 = OpIEqual %bool %174 %176 + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %178 + %179 = OpLabel + OpKill + %178 = OpLabel + OpBranch %115 + %115 = OpLabel + %180 = OpLoad %int %a + %181 = OpIAdd %int %180 %int_1 + OpStore %a %181 + OpBranch %113 + %114 = OpLabel + %182 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %183 = OpLoad %float %182 + OpStore %zero %183 + %184 = OpLoad %float %f + %186 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_17 + %187 = OpLoad %float %186 + %189 = OpFOrdEqual %bool %184 %187 + %188 = OpLogicalNot %bool %189 + OpSelectionMerge %190 None + OpBranchConditional %188 %191 %190 + %191 = OpLabel + %192 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %193 = OpLoad %float %192 + OpStore %zero %193 + OpBranch %190 + %190 = OpLabel + %194 = OpLoad %float %f + %195 = OpLoad %float %zero + %196 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %197 = OpLoad %int %196 + %198 = OpLoad %float %f + %199 = OpConvertSToF %float %197 + %200 = OpCompositeConstruct %v4float %194 %195 %199 %198 + OpStore %x_GLF_color %200 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %201 +%tint_symbol = OpFunctionParameter %main_out + %205 = OpLabel + %206 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %206 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %26 + %208 = OpLabel + %209 = OpFunctionCall %void %main_1 + %211 = OpLoad %v4float %x_GLF_color + %212 = OpCompositeConstruct %main_out %211 + %210 = OpFunctionCall %void %tint_symbol_2 %212 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..40aaeca119 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.spvasm.expected.wgsl @@ -0,0 +1,144 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[block]] +struct buf2 { + one : i32; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_12 : buf0; + +[[group(0), binding(2)]] var x_15 : buf2; + +var x_GLF_color : vec4; + +fn main_1() { + var m : mat4x4; + var v : vec4; + var f : f32; + var a : i32; + var b : i32; + var zero : f32; + x_GLF_global_loop_count = 0; + let x_62 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_64 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_66 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_68 : f32 = x_7.x_GLF_uniform_float_values[4]; + let x_70 : f32 = x_7.x_GLF_uniform_float_values[5]; + let x_72 : f32 = x_7.x_GLF_uniform_float_values[6]; + let x_74 : f32 = x_7.x_GLF_uniform_float_values[7]; + let x_76 : f32 = x_7.x_GLF_uniform_float_values[8]; + let x_78 : f32 = x_7.x_GLF_uniform_float_values[9]; + let x_80 : f32 = x_7.x_GLF_uniform_float_values[10]; + let x_82 : f32 = x_7.x_GLF_uniform_float_values[11]; + let x_84 : f32 = x_7.x_GLF_uniform_float_values[12]; + let x_86 : f32 = x_7.x_GLF_uniform_float_values[13]; + let x_88 : f32 = x_7.x_GLF_uniform_float_values[14]; + let x_90 : f32 = x_7.x_GLF_uniform_float_values[15]; + let x_92 : f32 = x_7.x_GLF_uniform_float_values[16]; + m = mat4x4(vec4(x_62, x_64, x_66, x_68), vec4(x_70, x_72, x_74, x_76), vec4(x_78, x_80, x_82, x_84), vec4(x_86, x_88, x_90, x_92)); + let x_99 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_101 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_103 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_105 : f32 = x_7.x_GLF_uniform_float_values[4]; + v = vec4(x_99, x_101, x_103, x_105); + let x_108 : f32 = x_7.x_GLF_uniform_float_values[1]; + f = x_108; + let x_110 : i32 = x_12.x_GLF_uniform_int_values[0]; + a = x_110; + loop { + let x_115 : i32 = x_GLF_global_loop_count; + if ((x_115 < 10)) { + } else { + break; + } + let x_118 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_118 + 1); + let x_120 : i32 = a; + let x_121 : i32 = clamp(x_120, 0, 3); + let x_123 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_125 : f32 = v[x_121]; + v[x_121] = (x_125 + x_123); + let x_129 : i32 = x_12.x_GLF_uniform_int_values[2]; + b = x_129; + loop { + let x_134 : i32 = x_GLF_global_loop_count; + if ((x_134 < 10)) { + } else { + break; + } + let x_137 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_137 + 1); + let x_139 : i32 = b; + let x_142 : f32 = v[clamp(x_139, 0, 3)]; + let x_143 : i32 = b; + let x_145 : i32 = a; + let x_147 : f32 = m[clamp(x_143, 0, 3)][x_145]; + let x_149 : f32 = f; + f = (x_149 + (x_142 * x_147)); + + continuing { + let x_151 : i32 = b; + b = (x_151 - 1); + } + } + let x_153 : i32 = a; + let x_156 : f32 = x_7.x_GLF_uniform_float_values[1]; + m[1][clamp(x_153, 0, 3)] = x_156; + let x_159 : i32 = x_15.one; + let x_161 : i32 = x_12.x_GLF_uniform_int_values[0]; + if ((x_159 == x_161)) { + discard; + } + let x_166 : i32 = x_15.one; + let x_168 : i32 = x_12.x_GLF_uniform_int_values[1]; + if ((x_166 == x_168)) { + discard; + } + + continuing { + let x_172 : i32 = a; + a = (x_172 + 1); + } + } + let x_175 : f32 = x_7.x_GLF_uniform_float_values[0]; + zero = x_175; + let x_176 : f32 = f; + let x_178 : f32 = x_7.x_GLF_uniform_float_values[17]; + if (!((x_176 == x_178))) { + let x_183 : f32 = x_7.x_GLF_uniform_float_values[1]; + zero = x_183; + } + let x_184 : f32 = f; + let x_185 : f32 = zero; + let x_187 : i32 = x_12.x_GLF_uniform_int_values[0]; + let x_189 : f32 = f; + x_GLF_color = vec4(x_184, x_185, f32(x_187), x_189); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl new file mode 100644 index 0000000000..40aaeca119 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl @@ -0,0 +1,144 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[block]] +struct buf2 { + one : i32; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_12 : buf0; + +[[group(0), binding(2)]] var x_15 : buf2; + +var x_GLF_color : vec4; + +fn main_1() { + var m : mat4x4; + var v : vec4; + var f : f32; + var a : i32; + var b : i32; + var zero : f32; + x_GLF_global_loop_count = 0; + let x_62 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_64 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_66 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_68 : f32 = x_7.x_GLF_uniform_float_values[4]; + let x_70 : f32 = x_7.x_GLF_uniform_float_values[5]; + let x_72 : f32 = x_7.x_GLF_uniform_float_values[6]; + let x_74 : f32 = x_7.x_GLF_uniform_float_values[7]; + let x_76 : f32 = x_7.x_GLF_uniform_float_values[8]; + let x_78 : f32 = x_7.x_GLF_uniform_float_values[9]; + let x_80 : f32 = x_7.x_GLF_uniform_float_values[10]; + let x_82 : f32 = x_7.x_GLF_uniform_float_values[11]; + let x_84 : f32 = x_7.x_GLF_uniform_float_values[12]; + let x_86 : f32 = x_7.x_GLF_uniform_float_values[13]; + let x_88 : f32 = x_7.x_GLF_uniform_float_values[14]; + let x_90 : f32 = x_7.x_GLF_uniform_float_values[15]; + let x_92 : f32 = x_7.x_GLF_uniform_float_values[16]; + m = mat4x4(vec4(x_62, x_64, x_66, x_68), vec4(x_70, x_72, x_74, x_76), vec4(x_78, x_80, x_82, x_84), vec4(x_86, x_88, x_90, x_92)); + let x_99 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_101 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_103 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_105 : f32 = x_7.x_GLF_uniform_float_values[4]; + v = vec4(x_99, x_101, x_103, x_105); + let x_108 : f32 = x_7.x_GLF_uniform_float_values[1]; + f = x_108; + let x_110 : i32 = x_12.x_GLF_uniform_int_values[0]; + a = x_110; + loop { + let x_115 : i32 = x_GLF_global_loop_count; + if ((x_115 < 10)) { + } else { + break; + } + let x_118 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_118 + 1); + let x_120 : i32 = a; + let x_121 : i32 = clamp(x_120, 0, 3); + let x_123 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_125 : f32 = v[x_121]; + v[x_121] = (x_125 + x_123); + let x_129 : i32 = x_12.x_GLF_uniform_int_values[2]; + b = x_129; + loop { + let x_134 : i32 = x_GLF_global_loop_count; + if ((x_134 < 10)) { + } else { + break; + } + let x_137 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_137 + 1); + let x_139 : i32 = b; + let x_142 : f32 = v[clamp(x_139, 0, 3)]; + let x_143 : i32 = b; + let x_145 : i32 = a; + let x_147 : f32 = m[clamp(x_143, 0, 3)][x_145]; + let x_149 : f32 = f; + f = (x_149 + (x_142 * x_147)); + + continuing { + let x_151 : i32 = b; + b = (x_151 - 1); + } + } + let x_153 : i32 = a; + let x_156 : f32 = x_7.x_GLF_uniform_float_values[1]; + m[1][clamp(x_153, 0, 3)] = x_156; + let x_159 : i32 = x_15.one; + let x_161 : i32 = x_12.x_GLF_uniform_int_values[0]; + if ((x_159 == x_161)) { + discard; + } + let x_166 : i32 = x_15.one; + let x_168 : i32 = x_12.x_GLF_uniform_int_values[1]; + if ((x_166 == x_168)) { + discard; + } + + continuing { + let x_172 : i32 = a; + a = (x_172 + 1); + } + } + let x_175 : f32 = x_7.x_GLF_uniform_float_values[0]; + zero = x_175; + let x_176 : f32 = f; + let x_178 : f32 = x_7.x_GLF_uniform_float_values[17]; + if (!((x_176 == x_178))) { + let x_183 : f32 = x_7.x_GLF_uniform_float_values[1]; + zero = x_183; + } + let x_184 : f32 = f; + let x_185 : f32 = zero; + let x_187 : i32 = x_12.x_GLF_uniform_int_values[0]; + let x_189 : f32 = f; + x_GLF_color = vec4(x_184, x_185, f32(x_187), x_189); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..1765c5c5aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.hlsl @@ -0,0 +1,114 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[18]; +}; +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[4]; +}; +cbuffer cbuffer_x_15 : register(b2, space0) { + uint4 x_15[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x4 m = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + float f = 0.0f; + int a = 0; + int b = 0; + float zero = 0.0f; + x_GLF_global_loop_count = 0; + const float x_62 = asfloat(x_7[1].x); + const float x_64 = asfloat(x_7[2].x); + const float x_66 = asfloat(x_7[3].x); + const float x_68 = asfloat(x_7[4].x); + const float x_70 = asfloat(x_7[5].x); + const float x_72 = asfloat(x_7[6].x); + const float x_74 = asfloat(x_7[7].x); + const float x_76 = asfloat(x_7[8].x); + const float x_78 = asfloat(x_7[9].x); + const float x_80 = asfloat(x_7[10].x); + const float x_82 = asfloat(x_7[11].x); + const float x_84 = asfloat(x_7[12].x); + const float x_86 = asfloat(x_7[13].x); + const float x_88 = asfloat(x_7[14].x); + const float x_90 = asfloat(x_7[15].x); + const float x_92 = asfloat(x_7[16].x); + m = float4x4(float4(x_62, x_64, x_66, x_68), float4(x_70, x_72, x_74, x_76), float4(x_78, x_80, x_82, x_84), float4(x_86, x_88, x_90, x_92)); + const float x_99 = asfloat(x_7[1].x); + const float x_101 = asfloat(x_7[2].x); + const float x_103 = asfloat(x_7[3].x); + const float x_105 = asfloat(x_7[4].x); + v = float4(x_99, x_101, x_103, x_105); + const float x_108 = asfloat(x_7[1].x); + f = x_108; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_110 = asint(x_12[scalar_offset / 4][scalar_offset % 4]); + a = x_110; + { + for(; (x_GLF_global_loop_count < 10); a = (a + 1)) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const int x_121 = clamp(a, 0, 3); + const float x_123 = asfloat(x_7[1].x); + const float x_125 = v[x_121]; + set_float4(v, x_121, (x_125 + x_123)); + const int x_129 = asint(x_12[2].x); + b = x_129; + { + for(; (x_GLF_global_loop_count < 10); b = (b - 1)) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const float x_142 = v[clamp(b, 0, 3)]; + const float x_147 = m[clamp(b, 0, 3)][a]; + f = (f + (x_142 * x_147)); + } + } + const int x_153 = a; + const float x_156 = asfloat(x_7[1].x); + set_float4(m[1], clamp(x_153, 0, 3), x_156); + const int x_159 = asint(x_15[0].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_161 = asint(x_12[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_159 == x_161)) { + discard; + } + const int x_166 = asint(x_15[0].x); + const int x_168 = asint(x_12[1].x); + if ((x_166 == x_168)) { + discard; + } + } + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_175 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + zero = x_175; + const float x_176 = f; + const float x_178 = asfloat(x_7[17].x); + if (!((x_176 == x_178))) { + const float x_183 = asfloat(x_7[1].x); + zero = x_183; + } + const float x_184 = f; + const float x_185 = zero; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_187 = asint(x_12[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(x_184, x_185, float(x_187), f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..68f79989e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.msl @@ -0,0 +1,145 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[18]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct buf2 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_12, constant buf2& x_15, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + float4x4 m = float4x4(0.0f); + float4 v = 0.0f; + float f = 0.0f; + int a = 0; + int b = 0; + float zero = 0.0f; + *(tint_symbol_4) = 0; + float const x_62 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_64 = x_7.x_GLF_uniform_float_values.arr[2].el; + float const x_66 = x_7.x_GLF_uniform_float_values.arr[3].el; + float const x_68 = x_7.x_GLF_uniform_float_values.arr[4].el; + float const x_70 = x_7.x_GLF_uniform_float_values.arr[5].el; + float const x_72 = x_7.x_GLF_uniform_float_values.arr[6].el; + float const x_74 = x_7.x_GLF_uniform_float_values.arr[7].el; + float const x_76 = x_7.x_GLF_uniform_float_values.arr[8].el; + float const x_78 = x_7.x_GLF_uniform_float_values.arr[9].el; + float const x_80 = x_7.x_GLF_uniform_float_values.arr[10].el; + float const x_82 = x_7.x_GLF_uniform_float_values.arr[11].el; + float const x_84 = x_7.x_GLF_uniform_float_values.arr[12].el; + float const x_86 = x_7.x_GLF_uniform_float_values.arr[13].el; + float const x_88 = x_7.x_GLF_uniform_float_values.arr[14].el; + float const x_90 = x_7.x_GLF_uniform_float_values.arr[15].el; + float const x_92 = x_7.x_GLF_uniform_float_values.arr[16].el; + m = float4x4(float4(x_62, x_64, x_66, x_68), float4(x_70, x_72, x_74, x_76), float4(x_78, x_80, x_82, x_84), float4(x_86, x_88, x_90, x_92)); + float const x_99 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_101 = x_7.x_GLF_uniform_float_values.arr[2].el; + float const x_103 = x_7.x_GLF_uniform_float_values.arr[3].el; + float const x_105 = x_7.x_GLF_uniform_float_values.arr[4].el; + v = float4(x_99, x_101, x_103, x_105); + float const x_108 = x_7.x_GLF_uniform_float_values.arr[1].el; + f = x_108; + int const x_110 = x_12.x_GLF_uniform_int_values.arr[0].el; + a = x_110; + while (true) { + int const x_115 = *(tint_symbol_4); + if ((x_115 < 10)) { + } else { + break; + } + int const x_118 = *(tint_symbol_4); + *(tint_symbol_4) = (x_118 + 1); + int const x_120 = a; + int const x_121 = clamp(x_120, 0, 3); + float const x_123 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_125 = v[x_121]; + v[x_121] = (x_125 + x_123); + int const x_129 = x_12.x_GLF_uniform_int_values.arr[2].el; + b = x_129; + while (true) { + int const x_134 = *(tint_symbol_4); + if ((x_134 < 10)) { + } else { + break; + } + int const x_137 = *(tint_symbol_4); + *(tint_symbol_4) = (x_137 + 1); + int const x_139 = b; + float const x_142 = v[clamp(x_139, 0, 3)]; + int const x_143 = b; + int const x_145 = a; + float const x_147 = m[clamp(x_143, 0, 3)][x_145]; + float const x_149 = f; + f = (x_149 + (x_142 * x_147)); + { + int const x_151 = b; + b = (x_151 - 1); + } + } + int const x_153 = a; + float const x_156 = x_7.x_GLF_uniform_float_values.arr[1].el; + m[1][clamp(x_153, 0, 3)] = x_156; + int const x_159 = x_15.one; + int const x_161 = x_12.x_GLF_uniform_int_values.arr[0].el; + if ((x_159 == x_161)) { + discard_fragment(); + } + int const x_166 = x_15.one; + int const x_168 = x_12.x_GLF_uniform_int_values.arr[1].el; + if ((x_166 == x_168)) { + discard_fragment(); + } + { + int const x_172 = a; + a = (x_172 + 1); + } + } + float const x_175 = x_7.x_GLF_uniform_float_values.arr[0].el; + zero = x_175; + float const x_176 = f; + float const x_178 = x_7.x_GLF_uniform_float_values.arr[17].el; + if (!((x_176 == x_178))) { + float const x_183 = x_7.x_GLF_uniform_float_values.arr[1].el; + zero = x_183; + } + float const x_184 = f; + float const x_185 = zero; + int const x_187 = x_12.x_GLF_uniform_int_values.arr[0].el; + float const x_189 = f; + *(tint_symbol_5) = float4(x_184, x_185, float(x_187), x_189); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_12 [[buffer(0)]], constant buf2& x_15 [[buffer(2)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_7, x_12, x_15, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f1de9d2bf8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.spvasm @@ -0,0 +1,314 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 213 +; Schema: 0 + OpCapability Shader + %127 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_12 "x_12" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "one" + OpName %x_15 "x_15" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %v "v" + OpName %f "f" + OpName %a "a" + OpName %b "b" + OpName %zero "zero" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_18 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_15 NonWritable + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 2 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_18 = OpConstant %uint 18 +%_arr_float_uint_18 = OpTypeArray %float %uint_18 + %buf1 = OpTypeStruct %_arr_float_uint_18 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform + %buf2 = OpTypeStruct %int +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_15 = OpVariable %_ptr_Uniform_buf2 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %23 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %23 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %23 + %void = OpTypeVoid + %26 = OpTypeFunction %void +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %33 = OpConstantNull %mat4v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %38 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %int_11 = OpConstant %int 11 + %int_12 = OpConstant %int 12 + %int_13 = OpConstant %int 13 + %int_14 = OpConstant %int 14 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_17 = OpConstant %int 17 + %main_out = OpTypeStruct %v4float + %201 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %26 + %29 = OpLabel + %m = OpVariable %_ptr_Function_mat4v4float Function %33 + %v = OpVariable %_ptr_Function_v4float Function %23 + %f = OpVariable %_ptr_Function_float Function %38 + %a = OpVariable %_ptr_Function_int Function %4 + %b = OpVariable %_ptr_Function_int Function %4 + %zero = OpVariable %_ptr_Function_float Function %38 + OpStore %x_GLF_global_loop_count %int_0 + %47 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %48 = OpLoad %float %47 + %50 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %51 = OpLoad %float %50 + %53 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3 + %54 = OpLoad %float %53 + %56 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_4 + %57 = OpLoad %float %56 + %59 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_5 + %60 = OpLoad %float %59 + %62 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_6 + %63 = OpLoad %float %62 + %65 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_7 + %66 = OpLoad %float %65 + %68 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_8 + %69 = OpLoad %float %68 + %71 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_9 + %72 = OpLoad %float %71 + %74 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_10 + %75 = OpLoad %float %74 + %77 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_11 + %78 = OpLoad %float %77 + %80 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_12 + %81 = OpLoad %float %80 + %83 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_13 + %84 = OpLoad %float %83 + %86 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_14 + %87 = OpLoad %float %86 + %89 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_15 + %90 = OpLoad %float %89 + %92 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_16 + %93 = OpLoad %float %92 + %94 = OpCompositeConstruct %v4float %48 %51 %54 %57 + %95 = OpCompositeConstruct %v4float %60 %63 %66 %69 + %96 = OpCompositeConstruct %v4float %72 %75 %78 %81 + %97 = OpCompositeConstruct %v4float %84 %87 %90 %93 + %98 = OpCompositeConstruct %mat4v4float %94 %95 %96 %97 + OpStore %m %98 + %99 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %100 = OpLoad %float %99 + %101 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %102 = OpLoad %float %101 + %103 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3 + %104 = OpLoad %float %103 + %105 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_4 + %106 = OpLoad %float %105 + %107 = OpCompositeConstruct %v4float %100 %102 %104 %106 + OpStore %v %107 + %108 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %109 = OpLoad %float %108 + OpStore %f %109 + %111 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %112 = OpLoad %int %111 + OpStore %a %112 + OpBranch %113 + %113 = OpLabel + OpLoopMerge %114 %115 None + OpBranch %116 + %116 = OpLabel + %117 = OpLoad %int %x_GLF_global_loop_count + %118 = OpSLessThan %bool %117 %int_10 + OpSelectionMerge %120 None + OpBranchConditional %118 %121 %122 + %121 = OpLabel + OpBranch %120 + %122 = OpLabel + OpBranch %114 + %120 = OpLabel + %123 = OpLoad %int %x_GLF_global_loop_count + %124 = OpIAdd %int %123 %int_1 + OpStore %x_GLF_global_loop_count %124 + %125 = OpLoad %int %a + %126 = OpExtInst %int %127 SClamp %125 %int_0 %int_3 + %128 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %129 = OpLoad %float %128 + %130 = OpAccessChain %_ptr_Function_float %v %126 + %131 = OpLoad %float %130 + %132 = OpAccessChain %_ptr_Function_float %v %126 + %133 = OpFAdd %float %131 %129 + OpStore %132 %133 + %134 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_2 + %135 = OpLoad %int %134 + OpStore %b %135 + OpBranch %136 + %136 = OpLabel + OpLoopMerge %137 %138 None + OpBranch %139 + %139 = OpLabel + %140 = OpLoad %int %x_GLF_global_loop_count + %141 = OpSLessThan %bool %140 %int_10 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %144 + %143 = OpLabel + OpBranch %142 + %144 = OpLabel + OpBranch %137 + %142 = OpLabel + %145 = OpLoad %int %x_GLF_global_loop_count + %146 = OpIAdd %int %145 %int_1 + OpStore %x_GLF_global_loop_count %146 + %147 = OpLoad %int %b + %148 = OpExtInst %int %127 SClamp %147 %int_0 %int_3 + %149 = OpAccessChain %_ptr_Function_float %v %148 + %150 = OpLoad %float %149 + %151 = OpLoad %int %b + %152 = OpLoad %int %a + %153 = OpExtInst %int %127 SClamp %151 %int_0 %int_3 + %154 = OpAccessChain %_ptr_Function_float %m %153 %152 + %155 = OpLoad %float %154 + %156 = OpLoad %float %f + %157 = OpFMul %float %150 %155 + %158 = OpFAdd %float %156 %157 + OpStore %f %158 + OpBranch %138 + %138 = OpLabel + %159 = OpLoad %int %b + %160 = OpISub %int %159 %int_1 + OpStore %b %160 + OpBranch %136 + %137 = OpLabel + %161 = OpLoad %int %a + %162 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %163 = OpLoad %float %162 + %164 = OpExtInst %int %127 SClamp %161 %int_0 %int_3 + %165 = OpAccessChain %_ptr_Function_float %m %int_1 %164 + OpStore %165 %163 + %166 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 + %167 = OpLoad %int %166 + %168 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %169 = OpLoad %int %168 + %170 = OpIEqual %bool %167 %169 + OpSelectionMerge %171 None + OpBranchConditional %170 %172 %171 + %172 = OpLabel + OpKill + %171 = OpLabel + %173 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 + %174 = OpLoad %int %173 + %175 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %176 = OpLoad %int %175 + %177 = OpIEqual %bool %174 %176 + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %178 + %179 = OpLabel + OpKill + %178 = OpLabel + OpBranch %115 + %115 = OpLabel + %180 = OpLoad %int %a + %181 = OpIAdd %int %180 %int_1 + OpStore %a %181 + OpBranch %113 + %114 = OpLabel + %182 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %183 = OpLoad %float %182 + OpStore %zero %183 + %184 = OpLoad %float %f + %186 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_17 + %187 = OpLoad %float %186 + %189 = OpFOrdEqual %bool %184 %187 + %188 = OpLogicalNot %bool %189 + OpSelectionMerge %190 None + OpBranchConditional %188 %191 %190 + %191 = OpLabel + %192 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %193 = OpLoad %float %192 + OpStore %zero %193 + OpBranch %190 + %190 = OpLabel + %194 = OpLoad %float %f + %195 = OpLoad %float %zero + %196 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %197 = OpLoad %int %196 + %198 = OpLoad %float %f + %199 = OpConvertSToF %float %197 + %200 = OpCompositeConstruct %v4float %194 %195 %199 %198 + OpStore %x_GLF_color %200 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %201 +%tint_symbol = OpFunctionParameter %main_out + %205 = OpLabel + %206 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %206 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %26 + %208 = OpLabel + %209 = OpFunctionCall %void %main_1 + %211 = OpLoad %v4float %x_GLF_color + %212 = OpCompositeConstruct %main_out %211 + %210 = OpFunctionCall %void %tint_symbol_2 %212 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..40aaeca119 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-float-accumulate-matrix/0-opt.wgsl.expected.wgsl @@ -0,0 +1,144 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[block]] +struct buf2 { + one : i32; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_12 : buf0; + +[[group(0), binding(2)]] var x_15 : buf2; + +var x_GLF_color : vec4; + +fn main_1() { + var m : mat4x4; + var v : vec4; + var f : f32; + var a : i32; + var b : i32; + var zero : f32; + x_GLF_global_loop_count = 0; + let x_62 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_64 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_66 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_68 : f32 = x_7.x_GLF_uniform_float_values[4]; + let x_70 : f32 = x_7.x_GLF_uniform_float_values[5]; + let x_72 : f32 = x_7.x_GLF_uniform_float_values[6]; + let x_74 : f32 = x_7.x_GLF_uniform_float_values[7]; + let x_76 : f32 = x_7.x_GLF_uniform_float_values[8]; + let x_78 : f32 = x_7.x_GLF_uniform_float_values[9]; + let x_80 : f32 = x_7.x_GLF_uniform_float_values[10]; + let x_82 : f32 = x_7.x_GLF_uniform_float_values[11]; + let x_84 : f32 = x_7.x_GLF_uniform_float_values[12]; + let x_86 : f32 = x_7.x_GLF_uniform_float_values[13]; + let x_88 : f32 = x_7.x_GLF_uniform_float_values[14]; + let x_90 : f32 = x_7.x_GLF_uniform_float_values[15]; + let x_92 : f32 = x_7.x_GLF_uniform_float_values[16]; + m = mat4x4(vec4(x_62, x_64, x_66, x_68), vec4(x_70, x_72, x_74, x_76), vec4(x_78, x_80, x_82, x_84), vec4(x_86, x_88, x_90, x_92)); + let x_99 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_101 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_103 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_105 : f32 = x_7.x_GLF_uniform_float_values[4]; + v = vec4(x_99, x_101, x_103, x_105); + let x_108 : f32 = x_7.x_GLF_uniform_float_values[1]; + f = x_108; + let x_110 : i32 = x_12.x_GLF_uniform_int_values[0]; + a = x_110; + loop { + let x_115 : i32 = x_GLF_global_loop_count; + if ((x_115 < 10)) { + } else { + break; + } + let x_118 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_118 + 1); + let x_120 : i32 = a; + let x_121 : i32 = clamp(x_120, 0, 3); + let x_123 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_125 : f32 = v[x_121]; + v[x_121] = (x_125 + x_123); + let x_129 : i32 = x_12.x_GLF_uniform_int_values[2]; + b = x_129; + loop { + let x_134 : i32 = x_GLF_global_loop_count; + if ((x_134 < 10)) { + } else { + break; + } + let x_137 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_137 + 1); + let x_139 : i32 = b; + let x_142 : f32 = v[clamp(x_139, 0, 3)]; + let x_143 : i32 = b; + let x_145 : i32 = a; + let x_147 : f32 = m[clamp(x_143, 0, 3)][x_145]; + let x_149 : f32 = f; + f = (x_149 + (x_142 * x_147)); + + continuing { + let x_151 : i32 = b; + b = (x_151 - 1); + } + } + let x_153 : i32 = a; + let x_156 : f32 = x_7.x_GLF_uniform_float_values[1]; + m[1][clamp(x_153, 0, 3)] = x_156; + let x_159 : i32 = x_15.one; + let x_161 : i32 = x_12.x_GLF_uniform_int_values[0]; + if ((x_159 == x_161)) { + discard; + } + let x_166 : i32 = x_15.one; + let x_168 : i32 = x_12.x_GLF_uniform_int_values[1]; + if ((x_166 == x_168)) { + discard; + } + + continuing { + let x_172 : i32 = a; + a = (x_172 + 1); + } + } + let x_175 : f32 = x_7.x_GLF_uniform_float_values[0]; + zero = x_175; + let x_176 : f32 = f; + let x_178 : f32 = x_7.x_GLF_uniform_float_values[17]; + if (!((x_176 == x_178))) { + let x_183 : f32 = x_7.x_GLF_uniform_float_values[1]; + zero = x_183; + } + let x_184 : f32 = f; + let x_185 : f32 = zero; + let x_187 : i32 = x_12.x_GLF_uniform_int_values[0]; + let x_189 : f32 = f; + x_GLF_color = vec4(x_184, x_185, f32(x_187), x_189); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm new file mode 100644 index 0000000000..ec9e316a57 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm @@ -0,0 +1,127 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %func_ "func(" + OpName %_GLF_global_loop_count "_GLF_global_loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %13 = OpTypeFunction %int +%_ptr_Private_int = OpTypePointer Private %int +%_GLF_global_loop_count = OpVariable %_ptr_Private_int Private + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %11 + %30 = OpLabel + %a = OpVariable %_ptr_Function_int Function + OpStore %_GLF_global_loop_count %int_0 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %int %_GLF_global_loop_count + %36 = OpIAdd %int %35 %int_1 + OpStore %_GLF_global_loop_count %36 + OpSelectionMerge %37 None + OpBranchConditional %false %38 %37 + %38 = OpLabel + OpReturn + %37 = OpLabel + OpBranch %33 + %33 = OpLabel + %39 = OpLoad %int %_GLF_global_loop_count + %40 = OpSLessThan %bool %39 %int_100 + %41 = OpLogicalAnd %bool %true %40 + OpBranchConditional %41 %31 %32 + %32 = OpLabel + %42 = OpFunctionCall %int %func_ + OpStore %a %42 + %43 = OpLoad %int %a + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %45 = OpLoad %int %44 + %46 = OpIEqual %bool %43 %45 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %51 + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %54 + %56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpCompositeConstruct %v4float %52 %55 %58 %61 + OpStore %_GLF_color %62 + OpBranch %47 + %49 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %65 %65 %65 %65 + OpStore %_GLF_color %66 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %int None %13 + %67 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %72 = OpLoad %int %_GLF_global_loop_count + %73 = OpSLessThan %bool %72 %int_100 + OpBranchConditional %73 %74 %69 + %74 = OpLabel + %75 = OpLoad %int %_GLF_global_loop_count + %76 = OpIAdd %int %75 %int_1 + OpStore %_GLF_global_loop_count %76 + %77 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %78 = OpLoad %int %77 + OpReturnValue %78 + %70 = OpLabel + OpBranch %68 + %69 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %80 = OpLoad %int %79 + OpReturnValue %80 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..d19bc36f4a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.hlsl @@ -0,0 +1,73 @@ +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_() { + while (true) { + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_78 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + return x_78; + } + const int x_80 = asint(x_7[2].x); + return x_80; +} + +void main_1() { + int a = 0; + x_GLF_global_loop_count = 0; + while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + if (false) { + return; + } + { + bool tint_tmp = true; + if (tint_tmp) { + tint_tmp = (x_GLF_global_loop_count < 100); + } + if ((tint_tmp)) { + } else { + break; + } + } + } + const int x_42 = func_(); + a = x_42; + const int x_43 = a; + const int x_45 = asint(x_7[2].x); + if ((x_43 == x_45)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_51 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_54 = asint(x_7[1].x); + const int x_57 = asint(x_7[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_60 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_51), float(x_54), float(x_57), float(x_60)); + } else { + const int x_64 = asint(x_7[1].x); + const float x_65 = float(x_64); + x_GLF_color = float4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..e3bf7ba177 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.msl @@ -0,0 +1,80 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_(constant buf0& x_7, thread int* const tint_symbol_4) { + while (true) { + int const x_72 = *(tint_symbol_4); + if ((x_72 < 100)) { + } else { + break; + } + int const x_75 = *(tint_symbol_4); + *(tint_symbol_4) = (x_75 + 1); + int const x_78 = x_7.x_GLF_uniform_int_values.arr[0].el; + return x_78; + } + int const x_80 = x_7.x_GLF_uniform_int_values.arr[2].el; + return x_80; +} + +void main_1(constant buf0& x_7, thread int* const tint_symbol_5, thread float4* const tint_symbol_6) { + int a = 0; + *(tint_symbol_5) = 0; + while (true) { + int const x_35 = *(tint_symbol_5); + *(tint_symbol_5) = (x_35 + 1); + if (false) { + return; + } + { + int const x_39 = *(tint_symbol_5); + if ((true && (x_39 < 100))) { + } else { + break; + } + } + } + int const x_42 = func_(x_7, tint_symbol_5); + a = x_42; + int const x_43 = a; + int const x_45 = x_7.x_GLF_uniform_int_values.arr[2].el; + if ((x_43 == x_45)) { + int const x_51 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_54 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_57 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_60 = x_7.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_51), float(x_54), float(x_57), float(x_60)); + } else { + int const x_64 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_65 = float(x_64); + *(tint_symbol_6) = float4(x_65, x_65, x_65, x_65); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread int tint_symbol_7 = 0; + thread float4 tint_symbol_8 = 0.0f; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e2beca5db3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.spvasm @@ -0,0 +1,182 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %15 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %15 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15 + %18 = OpTypeFunction %int + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %void = OpTypeVoid + %43 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %92 = OpTypeFunction %void %main_out + %func_ = OpFunction %int None %18 + %20 = OpLabel + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %int %x_GLF_global_loop_count + %27 = OpSLessThan %bool %25 %int_100 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpBranch %29 + %31 = OpLabel + OpBranch %22 + %29 = OpLabel + %32 = OpLoad %int %x_GLF_global_loop_count + %34 = OpIAdd %int %32 %int_1 + OpStore %x_GLF_global_loop_count %34 + %38 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %39 = OpLoad %int %38 + OpReturnValue %39 + %23 = OpLabel + OpBranch %21 + %22 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %42 = OpLoad %int %41 + OpReturnValue %42 + OpFunctionEnd + %main_1 = OpFunction %void None %43 + %46 = OpLabel + %a = OpVariable %_ptr_Function_int Function %4 + OpStore %x_GLF_global_loop_count %int_0 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %int %x_GLF_global_loop_count + %54 = OpIAdd %int %53 %int_1 + OpStore %x_GLF_global_loop_count %54 + OpSelectionMerge %56 None + OpBranchConditional %false %57 %56 + %57 = OpLabel + OpReturn + %56 = OpLabel + OpBranch %51 + %51 = OpLabel + %58 = OpLoad %int %x_GLF_global_loop_count + OpSelectionMerge %60 None + OpBranchConditional %true %61 %60 + %61 = OpLabel + %62 = OpSLessThan %bool %58 %int_100 + OpBranch %60 + %60 = OpLabel + %63 = OpPhi %bool %true %51 %62 %61 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %50 + %64 = OpLabel + OpBranch %49 + %50 = OpLabel + %67 = OpFunctionCall %int %func_ + OpStore %a %67 + %68 = OpLoad %int %a + %69 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %70 = OpLoad %int %69 + %71 = OpIEqual %bool %68 %70 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %74 + %73 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %82 = OpLoad %int %81 + %83 = OpConvertSToF %float %76 + %84 = OpConvertSToF %float %78 + %85 = OpConvertSToF %float %80 + %86 = OpConvertSToF %float %82 + %87 = OpCompositeConstruct %v4float %83 %84 %85 %86 + OpStore %x_GLF_color %87 + OpBranch %72 + %74 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %89 = OpLoad %int %88 + %90 = OpConvertSToF %float %89 + %91 = OpCompositeConstruct %v4float %90 %90 %90 %90 + OpStore %x_GLF_color %91 + OpBranch %72 + %72 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %92 +%tint_symbol = OpFunctionParameter %main_out + %96 = OpLabel + %97 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %97 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %43 + %99 = OpLabel + %100 = OpFunctionCall %void %main_1 + %102 = OpLoad %v4float %x_GLF_color + %103 = OpCompositeConstruct %main_out %102 + %101 = OpFunctionCall %void %tint_symbol_2 %103 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 51[%51] is not post dominated by the back-edge block 64[%64] + %64 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..96fb7f72e5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.spvasm.expected.wgsl @@ -0,0 +1,75 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> i32 { + loop { + let x_72 : i32 = x_GLF_global_loop_count; + if ((x_72 < 100)) { + } else { + break; + } + let x_75 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_75 + 1); + let x_78 : i32 = x_7.x_GLF_uniform_int_values[0]; + return x_78; + } + let x_80 : i32 = x_7.x_GLF_uniform_int_values[2]; + return x_80; +} + +fn main_1() { + var a : i32; + x_GLF_global_loop_count = 0; + loop { + let x_35 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_35 + 1); + if (false) { + return; + } + + continuing { + let x_39 : i32 = x_GLF_global_loop_count; + if ((true && (x_39 < 100))) { + } else { + break; + } + } + } + let x_42 : i32 = func_(); + a = x_42; + let x_43 : i32 = a; + let x_45 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_43 == x_45)) { + let x_51 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_57 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_60 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_51), f32(x_54), f32(x_57), f32(x_60)); + } else { + let x_64 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_65 : f32 = f32(x_64); + x_GLF_color = vec4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl new file mode 100644 index 0000000000..96fb7f72e5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl @@ -0,0 +1,75 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> i32 { + loop { + let x_72 : i32 = x_GLF_global_loop_count; + if ((x_72 < 100)) { + } else { + break; + } + let x_75 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_75 + 1); + let x_78 : i32 = x_7.x_GLF_uniform_int_values[0]; + return x_78; + } + let x_80 : i32 = x_7.x_GLF_uniform_int_values[2]; + return x_80; +} + +fn main_1() { + var a : i32; + x_GLF_global_loop_count = 0; + loop { + let x_35 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_35 + 1); + if (false) { + return; + } + + continuing { + let x_39 : i32 = x_GLF_global_loop_count; + if ((true && (x_39 < 100))) { + } else { + break; + } + } + } + let x_42 : i32 = func_(); + a = x_42; + let x_43 : i32 = a; + let x_45 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_43 == x_45)) { + let x_51 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_57 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_60 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_51), f32(x_54), f32(x_57), f32(x_60)); + } else { + let x_64 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_65 : f32 = f32(x_64); + x_GLF_color = vec4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d19bc36f4a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.hlsl @@ -0,0 +1,73 @@ +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_() { + while (true) { + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_78 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + return x_78; + } + const int x_80 = asint(x_7[2].x); + return x_80; +} + +void main_1() { + int a = 0; + x_GLF_global_loop_count = 0; + while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + if (false) { + return; + } + { + bool tint_tmp = true; + if (tint_tmp) { + tint_tmp = (x_GLF_global_loop_count < 100); + } + if ((tint_tmp)) { + } else { + break; + } + } + } + const int x_42 = func_(); + a = x_42; + const int x_43 = a; + const int x_45 = asint(x_7[2].x); + if ((x_43 == x_45)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_51 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_54 = asint(x_7[1].x); + const int x_57 = asint(x_7[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_60 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_51), float(x_54), float(x_57), float(x_60)); + } else { + const int x_64 = asint(x_7[1].x); + const float x_65 = float(x_64); + x_GLF_color = float4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..e3bf7ba177 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.msl @@ -0,0 +1,80 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_(constant buf0& x_7, thread int* const tint_symbol_4) { + while (true) { + int const x_72 = *(tint_symbol_4); + if ((x_72 < 100)) { + } else { + break; + } + int const x_75 = *(tint_symbol_4); + *(tint_symbol_4) = (x_75 + 1); + int const x_78 = x_7.x_GLF_uniform_int_values.arr[0].el; + return x_78; + } + int const x_80 = x_7.x_GLF_uniform_int_values.arr[2].el; + return x_80; +} + +void main_1(constant buf0& x_7, thread int* const tint_symbol_5, thread float4* const tint_symbol_6) { + int a = 0; + *(tint_symbol_5) = 0; + while (true) { + int const x_35 = *(tint_symbol_5); + *(tint_symbol_5) = (x_35 + 1); + if (false) { + return; + } + { + int const x_39 = *(tint_symbol_5); + if ((true && (x_39 < 100))) { + } else { + break; + } + } + } + int const x_42 = func_(x_7, tint_symbol_5); + a = x_42; + int const x_43 = a; + int const x_45 = x_7.x_GLF_uniform_int_values.arr[2].el; + if ((x_43 == x_45)) { + int const x_51 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_54 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_57 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_60 = x_7.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_51), float(x_54), float(x_57), float(x_60)); + } else { + int const x_64 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_65 = float(x_64); + *(tint_symbol_6) = float4(x_65, x_65, x_65, x_65); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread int tint_symbol_7 = 0; + thread float4 tint_symbol_8 = 0.0f; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e2beca5db3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.spvasm @@ -0,0 +1,182 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %15 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %15 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15 + %18 = OpTypeFunction %int + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %void = OpTypeVoid + %43 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %92 = OpTypeFunction %void %main_out + %func_ = OpFunction %int None %18 + %20 = OpLabel + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %int %x_GLF_global_loop_count + %27 = OpSLessThan %bool %25 %int_100 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpBranch %29 + %31 = OpLabel + OpBranch %22 + %29 = OpLabel + %32 = OpLoad %int %x_GLF_global_loop_count + %34 = OpIAdd %int %32 %int_1 + OpStore %x_GLF_global_loop_count %34 + %38 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %39 = OpLoad %int %38 + OpReturnValue %39 + %23 = OpLabel + OpBranch %21 + %22 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %42 = OpLoad %int %41 + OpReturnValue %42 + OpFunctionEnd + %main_1 = OpFunction %void None %43 + %46 = OpLabel + %a = OpVariable %_ptr_Function_int Function %4 + OpStore %x_GLF_global_loop_count %int_0 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %int %x_GLF_global_loop_count + %54 = OpIAdd %int %53 %int_1 + OpStore %x_GLF_global_loop_count %54 + OpSelectionMerge %56 None + OpBranchConditional %false %57 %56 + %57 = OpLabel + OpReturn + %56 = OpLabel + OpBranch %51 + %51 = OpLabel + %58 = OpLoad %int %x_GLF_global_loop_count + OpSelectionMerge %60 None + OpBranchConditional %true %61 %60 + %61 = OpLabel + %62 = OpSLessThan %bool %58 %int_100 + OpBranch %60 + %60 = OpLabel + %63 = OpPhi %bool %true %51 %62 %61 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %50 + %64 = OpLabel + OpBranch %49 + %50 = OpLabel + %67 = OpFunctionCall %int %func_ + OpStore %a %67 + %68 = OpLoad %int %a + %69 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %70 = OpLoad %int %69 + %71 = OpIEqual %bool %68 %70 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %74 + %73 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %82 = OpLoad %int %81 + %83 = OpConvertSToF %float %76 + %84 = OpConvertSToF %float %78 + %85 = OpConvertSToF %float %80 + %86 = OpConvertSToF %float %82 + %87 = OpCompositeConstruct %v4float %83 %84 %85 %86 + OpStore %x_GLF_color %87 + OpBranch %72 + %74 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %89 = OpLoad %int %88 + %90 = OpConvertSToF %float %89 + %91 = OpCompositeConstruct %v4float %90 %90 %90 %90 + OpStore %x_GLF_color %91 + OpBranch %72 + %72 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %92 +%tint_symbol = OpFunctionParameter %main_out + %96 = OpLabel + %97 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %97 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %43 + %99 = OpLabel + %100 = OpFunctionCall %void %main_1 + %102 = OpLoad %v4float %x_GLF_color + %103 = OpCompositeConstruct %main_out %102 + %101 = OpFunctionCall %void %tint_symbol_2 %103 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 51[%51] is not post dominated by the back-edge block 64[%64] + %64 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..96fb7f72e5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-main-function-call/0-opt.wgsl.expected.wgsl @@ -0,0 +1,75 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> i32 { + loop { + let x_72 : i32 = x_GLF_global_loop_count; + if ((x_72 < 100)) { + } else { + break; + } + let x_75 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_75 + 1); + let x_78 : i32 = x_7.x_GLF_uniform_int_values[0]; + return x_78; + } + let x_80 : i32 = x_7.x_GLF_uniform_int_values[2]; + return x_80; +} + +fn main_1() { + var a : i32; + x_GLF_global_loop_count = 0; + loop { + let x_35 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_35 + 1); + if (false) { + return; + } + + continuing { + let x_39 : i32 = x_GLF_global_loop_count; + if ((true && (x_39 < 100))) { + } else { + break; + } + } + } + let x_42 : i32 = func_(); + a = x_42; + let x_43 : i32 = a; + let x_45 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_43 == x_45)) { + let x_51 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_57 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_60 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_51), f32(x_54), f32(x_57), f32(x_60)); + } else { + let x_64 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_65 : f32 = f32(x_64); + x_GLF_color = vec4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm new file mode 100644 index 0000000000..56ca498799 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm @@ -0,0 +1,89 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_100 = OpConstant %int 100 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %8 + %21 = OpLabel + OpBranch %22 + %22 = OpLabel + %23 = OpPhi %int %int_0 %21 %24 %25 + %26 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %27 = OpLoad %int %26 + %28 = OpISub %int %int_100 %27 + %29 = OpSLessThan %bool %23 %28 + OpLoopMerge %30 %25 None + OpBranchConditional %29 %25 %30 + %25 = OpLabel + %24 = OpIAdd %int %23 %int_1 + OpBranch %22 + %30 = OpLabel + %31 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %32 = OpLoad %int %31 + %33 = OpIEqual %bool %32 %int_0 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + OpBranch %36 + %36 = OpLabel + %37 = OpPhi %int %int_1 %35 %38 %39 + %40 = OpPhi %int %23 %35 %41 %39 + %42 = OpSLessThan %bool %40 %int_100 + OpLoopMerge %43 %39 None + OpBranchConditional %42 %39 %43 + %39 = OpLabel + %41 = OpIAdd %int %40 %int_1 + %44 = OpISub %int %int_1 %37 + %38 = OpIMul %int %37 %44 + OpBranch %36 + %43 = OpLabel + OpBranch %34 + %34 = OpLabel + %45 = OpPhi %int %int_1 %30 %37 %43 + %46 = OpIEqual %bool %45 %32 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + %50 = OpConvertSToF %float %27 + %51 = OpConvertSToF %float %32 + %52 = OpCompositeConstruct %v4float %50 %51 %51 %50 + OpStore %_GLF_color %52 + OpBranch %47 + %49 = OpLabel + %53 = OpConvertSToF %float %32 + %54 = OpCompositeConstruct %v4float %53 %53 %53 %53 + OpStore %_GLF_color %54 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..6d2b86d38f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.hlsl @@ -0,0 +1,75 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_23 = 0; + int x_27 = 0; + int x_37 = 0; + int x_23_phi = 0; + int x_45_phi = 0; + x_23_phi = 0; + while (true) { + int x_24 = 0; + x_23 = x_23_phi; + x_27 = asint(x_5[1].x); + if ((x_23 < (100 - asint(x_27)))) { + } else { + break; + } + { + x_24 = asint((x_23 + asint(1))); + x_23_phi = x_24; + } + } + int x_37_phi = 0; + int x_40_phi = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_32 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + x_45_phi = 1; + if ((x_32 == 0)) { + x_37_phi = 1; + x_40_phi = x_23; + while (true) { + int x_41 = 0; + int x_38 = 0; + x_37 = x_37_phi; + const int x_40 = x_40_phi; + if ((x_40 < 100)) { + } else { + break; + } + { + x_41 = (x_40 + 1); + x_38 = asint((x_37 * asint((1 - asint(x_37))))); + x_37_phi = x_38; + x_40_phi = x_41; + } + } + x_45_phi = x_37; + } + if ((x_45_phi == x_32)) { + const float x_50 = float(x_27); + const float x_51 = float(x_32); + x_GLF_color = float4(x_50, x_51, x_51, x_50); + } else { + const float x_53 = float(x_32); + x_GLF_color = float4(x_53, x_53, x_53, x_53); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.msl new file mode 100644 index 0000000000..de0a7fc8c8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.msl @@ -0,0 +1,85 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int x_23 = 0; + int x_27 = 0; + int x_37 = 0; + int x_23_phi = 0; + int x_45_phi = 0; + x_23_phi = 0; + while (true) { + int x_24 = 0; + x_23 = x_23_phi; + x_27 = x_5.x_GLF_uniform_int_values.arr[1].el; + if ((x_23 < (100 - as_type(x_27)))) { + } else { + break; + } + { + x_24 = as_type((x_23 + as_type(1))); + x_23_phi = x_24; + } + } + int x_37_phi = 0; + int x_40_phi = 0; + int const x_32 = x_5.x_GLF_uniform_int_values.arr[0].el; + x_45_phi = 1; + if ((x_32 == 0)) { + x_37_phi = 1; + x_40_phi = x_23; + while (true) { + int x_41 = 0; + int x_38 = 0; + x_37 = x_37_phi; + int const x_40 = x_40_phi; + if ((x_40 < 100)) { + } else { + break; + } + { + x_41 = (x_40 + 1); + x_38 = as_type((x_37 * as_type((1 - as_type(x_37))))); + x_37_phi = x_38; + x_40_phi = x_41; + } + } + x_45_phi = x_37; + } + int const x_45 = x_45_phi; + if ((x_45 == x_32)) { + float const x_50 = float(x_27); + float const x_51 = float(x_32); + *(tint_symbol_4) = float4(x_50, x_51, x_51, x_50); + } else { + float const x_53 = float(x_32); + *(tint_symbol_4) = float4(x_53, x_53, x_53, x_53); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..5db6580747 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.spvasm @@ -0,0 +1,192 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 107 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_23 "x_23" + OpName %x_27 "x_27" + OpName %x_37 "x_37" + OpName %x_23_phi "x_23_phi" + OpName %x_45_phi "x_45_phi" + OpName %x_24 "x_24" + OpName %x_37_phi "x_37_phi" + OpName %x_40_phi "x_40_phi" + OpName %x_41 "x_41" + OpName %x_38 "x_38" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %95 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_23 = OpVariable %_ptr_Function_int Function %21 + %x_27 = OpVariable %_ptr_Function_int Function %21 + %x_37 = OpVariable %_ptr_Function_int Function %21 + %x_23_phi = OpVariable %_ptr_Function_int Function %21 + %x_45_phi = OpVariable %_ptr_Function_int Function %21 + %x_24 = OpVariable %_ptr_Function_int Function %21 + %x_37_phi = OpVariable %_ptr_Function_int Function %21 + %x_40_phi = OpVariable %_ptr_Function_int Function %21 + %x_41 = OpVariable %_ptr_Function_int Function %21 + %x_38 = OpVariable %_ptr_Function_int Function %21 + OpStore %x_23_phi %int_0 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %32 = OpLoad %int %x_23_phi + OpStore %x_23 %32 + %36 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %37 = OpLoad %int %36 + OpStore %x_27 %37 + %38 = OpLoad %int %x_23 + %41 = OpLoad %int %x_27 + %40 = OpCopyObject %int %41 + %42 = OpISub %int %int_100 %40 + %43 = OpSLessThan %bool %38 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %28 + %45 = OpLabel + OpBranch %29 + %29 = OpLabel + %49 = OpLoad %int %x_23 + %50 = OpCopyObject %int %int_1 + %51 = OpIAdd %int %49 %50 + %48 = OpCopyObject %int %51 + OpStore %x_24 %48 + %52 = OpLoad %int %x_24 + OpStore %x_23_phi %52 + OpBranch %27 + %28 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %56 = OpLoad %int %55 + OpStore %x_45_phi %int_1 + %57 = OpIEqual %bool %56 %int_0 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + OpStore %x_37_phi %int_1 + %60 = OpLoad %int %x_23 + OpStore %x_40_phi %60 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %67 = OpLoad %int %x_37_phi + OpStore %x_37 %67 + %68 = OpLoad %int %x_40_phi + %69 = OpSLessThan %bool %68 %int_100 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %62 + %70 = OpLabel + OpBranch %63 + %63 = OpLabel + %73 = OpIAdd %int %68 %int_1 + OpStore %x_41 %73 + %75 = OpLoad %int %x_37 + %78 = OpLoad %int %x_37 + %77 = OpCopyObject %int %78 + %79 = OpISub %int %int_1 %77 + %76 = OpCopyObject %int %79 + %80 = OpIMul %int %75 %76 + %74 = OpCopyObject %int %80 + OpStore %x_38 %74 + %81 = OpLoad %int %x_38 + OpStore %x_37_phi %81 + %82 = OpLoad %int %x_41 + OpStore %x_40_phi %82 + OpBranch %61 + %62 = OpLabel + %83 = OpLoad %int %x_37 + OpStore %x_45_phi %83 + OpBranch %58 + %58 = OpLabel + %84 = OpLoad %int %x_45_phi + %85 = OpIEqual %bool %84 %56 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + %90 = OpLoad %int %x_27 + %89 = OpConvertSToF %float %90 + %91 = OpConvertSToF %float %56 + %92 = OpCompositeConstruct %v4float %89 %91 %91 %89 + OpStore %x_GLF_color %92 + OpBranch %86 + %88 = OpLabel + %93 = OpConvertSToF %float %56 + %94 = OpCompositeConstruct %v4float %93 %93 %93 %93 + OpStore %x_GLF_color %94 + OpBranch %86 + %86 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %95 +%tint_symbol = OpFunctionParameter %main_out + %99 = OpLabel + %100 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %100 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %102 = OpLabel + %103 = OpFunctionCall %void %main_1 + %105 = OpLoad %v4float %x_GLF_color + %106 = OpCompositeConstruct %main_out %105 + %104 = OpFunctionCall %void %tint_symbol_2 %106 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..038864ad4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.spvasm.expected.wgsl @@ -0,0 +1,80 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_23 : i32; + var x_27 : i32; + var x_37 : i32; + var x_23_phi : i32; + var x_45_phi : i32; + x_23_phi = 0; + loop { + var x_24 : i32; + x_23 = x_23_phi; + x_27 = x_5.x_GLF_uniform_int_values[1]; + if ((x_23 < (100 - bitcast(x_27)))) { + } else { + break; + } + + continuing { + x_24 = bitcast((x_23 + bitcast(1))); + x_23_phi = x_24; + } + } + var x_37_phi : i32; + var x_40_phi : i32; + let x_32 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_45_phi = 1; + if ((x_32 == 0)) { + x_37_phi = 1; + x_40_phi = x_23; + loop { + var x_41 : i32; + var x_38 : i32; + x_37 = x_37_phi; + let x_40 : i32 = x_40_phi; + if ((x_40 < 100)) { + } else { + break; + } + + continuing { + x_41 = (x_40 + 1); + x_38 = bitcast((x_37 * bitcast((1 - bitcast(x_37))))); + x_37_phi = x_38; + x_40_phi = x_41; + } + } + x_45_phi = x_37; + } + let x_45 : i32 = x_45_phi; + if ((x_45 == x_32)) { + let x_50 : f32 = f32(x_27); + let x_51 : f32 = f32(x_32); + x_GLF_color = vec4(x_50, x_51, x_51, x_50); + } else { + let x_53 : f32 = f32(x_32); + x_GLF_color = vec4(x_53, x_53, x_53, x_53); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl new file mode 100644 index 0000000000..038864ad4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl @@ -0,0 +1,80 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_23 : i32; + var x_27 : i32; + var x_37 : i32; + var x_23_phi : i32; + var x_45_phi : i32; + x_23_phi = 0; + loop { + var x_24 : i32; + x_23 = x_23_phi; + x_27 = x_5.x_GLF_uniform_int_values[1]; + if ((x_23 < (100 - bitcast(x_27)))) { + } else { + break; + } + + continuing { + x_24 = bitcast((x_23 + bitcast(1))); + x_23_phi = x_24; + } + } + var x_37_phi : i32; + var x_40_phi : i32; + let x_32 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_45_phi = 1; + if ((x_32 == 0)) { + x_37_phi = 1; + x_40_phi = x_23; + loop { + var x_41 : i32; + var x_38 : i32; + x_37 = x_37_phi; + let x_40 : i32 = x_40_phi; + if ((x_40 < 100)) { + } else { + break; + } + + continuing { + x_41 = (x_40 + 1); + x_38 = bitcast((x_37 * bitcast((1 - bitcast(x_37))))); + x_37_phi = x_38; + x_40_phi = x_41; + } + } + x_45_phi = x_37; + } + let x_45 : i32 = x_45_phi; + if ((x_45 == x_32)) { + let x_50 : f32 = f32(x_27); + let x_51 : f32 = f32(x_32); + x_GLF_color = vec4(x_50, x_51, x_51, x_50); + } else { + let x_53 : f32 = f32(x_32); + x_GLF_color = vec4(x_53, x_53, x_53, x_53); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..6d2b86d38f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.hlsl @@ -0,0 +1,75 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_23 = 0; + int x_27 = 0; + int x_37 = 0; + int x_23_phi = 0; + int x_45_phi = 0; + x_23_phi = 0; + while (true) { + int x_24 = 0; + x_23 = x_23_phi; + x_27 = asint(x_5[1].x); + if ((x_23 < (100 - asint(x_27)))) { + } else { + break; + } + { + x_24 = asint((x_23 + asint(1))); + x_23_phi = x_24; + } + } + int x_37_phi = 0; + int x_40_phi = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_32 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + x_45_phi = 1; + if ((x_32 == 0)) { + x_37_phi = 1; + x_40_phi = x_23; + while (true) { + int x_41 = 0; + int x_38 = 0; + x_37 = x_37_phi; + const int x_40 = x_40_phi; + if ((x_40 < 100)) { + } else { + break; + } + { + x_41 = (x_40 + 1); + x_38 = asint((x_37 * asint((1 - asint(x_37))))); + x_37_phi = x_38; + x_40_phi = x_41; + } + } + x_45_phi = x_37; + } + if ((x_45_phi == x_32)) { + const float x_50 = float(x_27); + const float x_51 = float(x_32); + x_GLF_color = float4(x_50, x_51, x_51, x_50); + } else { + const float x_53 = float(x_32); + x_GLF_color = float4(x_53, x_53, x_53, x_53); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.msl new file mode 100644 index 0000000000..de0a7fc8c8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.msl @@ -0,0 +1,85 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int x_23 = 0; + int x_27 = 0; + int x_37 = 0; + int x_23_phi = 0; + int x_45_phi = 0; + x_23_phi = 0; + while (true) { + int x_24 = 0; + x_23 = x_23_phi; + x_27 = x_5.x_GLF_uniform_int_values.arr[1].el; + if ((x_23 < (100 - as_type(x_27)))) { + } else { + break; + } + { + x_24 = as_type((x_23 + as_type(1))); + x_23_phi = x_24; + } + } + int x_37_phi = 0; + int x_40_phi = 0; + int const x_32 = x_5.x_GLF_uniform_int_values.arr[0].el; + x_45_phi = 1; + if ((x_32 == 0)) { + x_37_phi = 1; + x_40_phi = x_23; + while (true) { + int x_41 = 0; + int x_38 = 0; + x_37 = x_37_phi; + int const x_40 = x_40_phi; + if ((x_40 < 100)) { + } else { + break; + } + { + x_41 = (x_40 + 1); + x_38 = as_type((x_37 * as_type((1 - as_type(x_37))))); + x_37_phi = x_38; + x_40_phi = x_41; + } + } + x_45_phi = x_37; + } + int const x_45 = x_45_phi; + if ((x_45 == x_32)) { + float const x_50 = float(x_27); + float const x_51 = float(x_32); + *(tint_symbol_4) = float4(x_50, x_51, x_51, x_50); + } else { + float const x_53 = float(x_32); + *(tint_symbol_4) = float4(x_53, x_53, x_53, x_53); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..5db6580747 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.spvasm @@ -0,0 +1,192 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 107 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_23 "x_23" + OpName %x_27 "x_27" + OpName %x_37 "x_37" + OpName %x_23_phi "x_23_phi" + OpName %x_45_phi "x_45_phi" + OpName %x_24 "x_24" + OpName %x_37_phi "x_37_phi" + OpName %x_40_phi "x_40_phi" + OpName %x_41 "x_41" + OpName %x_38 "x_38" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %95 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_23 = OpVariable %_ptr_Function_int Function %21 + %x_27 = OpVariable %_ptr_Function_int Function %21 + %x_37 = OpVariable %_ptr_Function_int Function %21 + %x_23_phi = OpVariable %_ptr_Function_int Function %21 + %x_45_phi = OpVariable %_ptr_Function_int Function %21 + %x_24 = OpVariable %_ptr_Function_int Function %21 + %x_37_phi = OpVariable %_ptr_Function_int Function %21 + %x_40_phi = OpVariable %_ptr_Function_int Function %21 + %x_41 = OpVariable %_ptr_Function_int Function %21 + %x_38 = OpVariable %_ptr_Function_int Function %21 + OpStore %x_23_phi %int_0 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %32 = OpLoad %int %x_23_phi + OpStore %x_23 %32 + %36 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %37 = OpLoad %int %36 + OpStore %x_27 %37 + %38 = OpLoad %int %x_23 + %41 = OpLoad %int %x_27 + %40 = OpCopyObject %int %41 + %42 = OpISub %int %int_100 %40 + %43 = OpSLessThan %bool %38 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %28 + %45 = OpLabel + OpBranch %29 + %29 = OpLabel + %49 = OpLoad %int %x_23 + %50 = OpCopyObject %int %int_1 + %51 = OpIAdd %int %49 %50 + %48 = OpCopyObject %int %51 + OpStore %x_24 %48 + %52 = OpLoad %int %x_24 + OpStore %x_23_phi %52 + OpBranch %27 + %28 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %56 = OpLoad %int %55 + OpStore %x_45_phi %int_1 + %57 = OpIEqual %bool %56 %int_0 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + OpStore %x_37_phi %int_1 + %60 = OpLoad %int %x_23 + OpStore %x_40_phi %60 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %67 = OpLoad %int %x_37_phi + OpStore %x_37 %67 + %68 = OpLoad %int %x_40_phi + %69 = OpSLessThan %bool %68 %int_100 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %62 + %70 = OpLabel + OpBranch %63 + %63 = OpLabel + %73 = OpIAdd %int %68 %int_1 + OpStore %x_41 %73 + %75 = OpLoad %int %x_37 + %78 = OpLoad %int %x_37 + %77 = OpCopyObject %int %78 + %79 = OpISub %int %int_1 %77 + %76 = OpCopyObject %int %79 + %80 = OpIMul %int %75 %76 + %74 = OpCopyObject %int %80 + OpStore %x_38 %74 + %81 = OpLoad %int %x_38 + OpStore %x_37_phi %81 + %82 = OpLoad %int %x_41 + OpStore %x_40_phi %82 + OpBranch %61 + %62 = OpLabel + %83 = OpLoad %int %x_37 + OpStore %x_45_phi %83 + OpBranch %58 + %58 = OpLabel + %84 = OpLoad %int %x_45_phi + %85 = OpIEqual %bool %84 %56 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + %90 = OpLoad %int %x_27 + %89 = OpConvertSToF %float %90 + %91 = OpConvertSToF %float %56 + %92 = OpCompositeConstruct %v4float %89 %91 %91 %89 + OpStore %x_GLF_color %92 + OpBranch %86 + %88 = OpLabel + %93 = OpConvertSToF %float %56 + %94 = OpCompositeConstruct %v4float %93 %93 %93 %93 + OpStore %x_GLF_color %94 + OpBranch %86 + %86 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %95 +%tint_symbol = OpFunctionParameter %main_out + %99 = OpLabel + %100 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %100 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %102 = OpLabel + %103 = OpFunctionCall %void %main_1 + %105 = OpLoad %v4float %x_GLF_color + %106 = OpCompositeConstruct %main_out %105 + %104 = OpFunctionCall %void %tint_symbol_2 %106 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..038864ad4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-multiply-one-minus/0.wgsl.expected.wgsl @@ -0,0 +1,80 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_23 : i32; + var x_27 : i32; + var x_37 : i32; + var x_23_phi : i32; + var x_45_phi : i32; + x_23_phi = 0; + loop { + var x_24 : i32; + x_23 = x_23_phi; + x_27 = x_5.x_GLF_uniform_int_values[1]; + if ((x_23 < (100 - bitcast(x_27)))) { + } else { + break; + } + + continuing { + x_24 = bitcast((x_23 + bitcast(1))); + x_23_phi = x_24; + } + } + var x_37_phi : i32; + var x_40_phi : i32; + let x_32 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_45_phi = 1; + if ((x_32 == 0)) { + x_37_phi = 1; + x_40_phi = x_23; + loop { + var x_41 : i32; + var x_38 : i32; + x_37 = x_37_phi; + let x_40 : i32 = x_40_phi; + if ((x_40 < 100)) { + } else { + break; + } + + continuing { + x_41 = (x_40 + 1); + x_38 = bitcast((x_37 * bitcast((1 - bitcast(x_37))))); + x_37_phi = x_38; + x_40_phi = x_41; + } + } + x_45_phi = x_37; + } + let x_45 : i32 = x_45_phi; + if ((x_45 == x_32)) { + let x_50 : f32 = f32(x_27); + let x_51 : f32 = f32(x_32); + x_GLF_color = vec4(x_50, x_51, x_51, x_50); + } else { + let x_53 : f32 = f32(x_32); + x_GLF_color = vec4(x_53, x_53, x_53, x_53); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm new file mode 100644 index 0000000000..e13f402111 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm @@ -0,0 +1,98 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %_GLF_global_loop_count "_GLF_global_loop_count" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int +%_GLF_global_loop_count = OpVariable %_ptr_Private_int Private + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %int_4 = OpConstant %int 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %9 + %25 = OpLabel + OpStore %_GLF_global_loop_count %int_0 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %_GLF_global_loop_count + %31 = OpSLessThan %bool %30 %int_100 + OpBranchConditional %31 %32 %27 + %32 = OpLabel + %33 = OpLoad %int %_GLF_global_loop_count + %34 = OpIAdd %int %33 %int_1 + OpStore %_GLF_global_loop_count %34 + %35 = OpLoad %int %_GLF_global_loop_count + %36 = OpLoad %int %_GLF_global_loop_count + %37 = OpIMul %int %35 %36 + %38 = OpSGreaterThan %bool %37 %int_10 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %39 + %40 = OpLabel + OpBranch %27 + %39 = OpLabel + OpBranch %28 + %28 = OpLabel + OpBranch %26 + %27 = OpLabel + %41 = OpLoad %int %_GLF_global_loop_count + %42 = OpIEqual %bool %41 %int_4 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpConvertSToF %float %47 + %49 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpConvertSToF %float %56 + %58 = OpCompositeConstruct %v4float %48 %51 %54 %57 + OpStore %_GLF_color %58 + OpBranch %43 + %45 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpCompositeConstruct %v4float %61 %61 %61 %61 + OpStore %_GLF_color %62 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..b176ae54f3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.hlsl @@ -0,0 +1,47 @@ +static int x_GLF_global_loop_count = 0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; + +void main_1() { + x_GLF_global_loop_count = 0; + while (true) { + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + if (((x_GLF_global_loop_count * x_GLF_global_loop_count) > 10)) { + break; + } + } + if ((x_GLF_global_loop_count == 4)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_47 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_50 = asint(x_6[1].x); + const int x_53 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_47), float(x_50), float(x_53), float(x_56)); + } else { + const int x_60 = asint(x_6[1].x); + const float x_61 = float(x_60); + x_GLF_color = float4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a7c34d0d23 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.msl @@ -0,0 +1,60 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + *(tint_symbol_4) = 0; + while (true) { + int const x_30 = *(tint_symbol_4); + if ((x_30 < 100)) { + } else { + break; + } + int const x_33 = *(tint_symbol_4); + *(tint_symbol_4) = (x_33 + 1); + int const x_35 = *(tint_symbol_4); + int const x_36 = *(tint_symbol_4); + if (((x_35 * x_36) > 10)) { + break; + } + } + int const x_41 = *(tint_symbol_4); + if ((x_41 == 4)) { + int const x_47 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_47), float(x_50), float(x_53), float(x_56)); + } else { + int const x_60 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_61 = float(x_60); + *(tint_symbol_5) = float4(x_61, x_61, x_61, x_61); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_6, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..6b9329734e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.spvasm @@ -0,0 +1,136 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 81 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %int_4 = OpConstant %int 4 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %69 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + OpStore %x_GLF_global_loop_count %int_0 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %27 = OpLoad %int %x_GLF_global_loop_count + %29 = OpSLessThan %bool %27 %int_100 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpBranch %24 + %31 = OpLabel + %34 = OpLoad %int %x_GLF_global_loop_count + %36 = OpIAdd %int %34 %int_1 + OpStore %x_GLF_global_loop_count %36 + %37 = OpLoad %int %x_GLF_global_loop_count + %38 = OpLoad %int %x_GLF_global_loop_count + %39 = OpIMul %int %37 %38 + %41 = OpSGreaterThan %bool %39 %int_10 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpBranch %24 + %42 = OpLabel + OpBranch %25 + %25 = OpLabel + OpBranch %23 + %24 = OpLabel + %44 = OpLoad %int %x_GLF_global_loop_count + %46 = OpIEqual %bool %44 %int_4 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %53 + %61 = OpConvertSToF %float %55 + %62 = OpConvertSToF %float %57 + %63 = OpConvertSToF %float %59 + %64 = OpCompositeConstruct %v4float %60 %61 %62 %63 + OpStore %x_GLF_color %64 + OpBranch %47 + %49 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + %68 = OpCompositeConstruct %v4float %67 %67 %67 %67 + OpStore %x_GLF_color %68 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %69 +%tint_symbol = OpFunctionParameter %main_out + %73 = OpLabel + %74 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %74 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %76 = OpLabel + %77 = OpFunctionCall %void %main_1 + %79 = OpLoad %v4float %x_GLF_color + %80 = OpCompositeConstruct %main_out %79 + %78 = OpFunctionCall %void %tint_symbol_2 %80 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..27cfa37314 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.spvasm.expected.wgsl @@ -0,0 +1,54 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + x_GLF_global_loop_count = 0; + loop { + let x_30 : i32 = x_GLF_global_loop_count; + if ((x_30 < 100)) { + } else { + break; + } + let x_33 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_33 + 1); + let x_35 : i32 = x_GLF_global_loop_count; + let x_36 : i32 = x_GLF_global_loop_count; + if (((x_35 * x_36) > 10)) { + break; + } + } + let x_41 : i32 = x_GLF_global_loop_count; + if ((x_41 == 4)) { + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_47), f32(x_50), f32(x_53), f32(x_56)); + } else { + let x_60 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_61 : f32 = f32(x_60); + x_GLF_color = vec4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl new file mode 100644 index 0000000000..27cfa37314 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl @@ -0,0 +1,54 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + x_GLF_global_loop_count = 0; + loop { + let x_30 : i32 = x_GLF_global_loop_count; + if ((x_30 < 100)) { + } else { + break; + } + let x_33 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_33 + 1); + let x_35 : i32 = x_GLF_global_loop_count; + let x_36 : i32 = x_GLF_global_loop_count; + if (((x_35 * x_36) > 10)) { + break; + } + } + let x_41 : i32 = x_GLF_global_loop_count; + if ((x_41 == 4)) { + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_47), f32(x_50), f32(x_53), f32(x_56)); + } else { + let x_60 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_61 : f32 = f32(x_60); + x_GLF_color = vec4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..b176ae54f3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.hlsl @@ -0,0 +1,47 @@ +static int x_GLF_global_loop_count = 0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; + +void main_1() { + x_GLF_global_loop_count = 0; + while (true) { + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + if (((x_GLF_global_loop_count * x_GLF_global_loop_count) > 10)) { + break; + } + } + if ((x_GLF_global_loop_count == 4)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_47 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_50 = asint(x_6[1].x); + const int x_53 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_47), float(x_50), float(x_53), float(x_56)); + } else { + const int x_60 = asint(x_6[1].x); + const float x_61 = float(x_60); + x_GLF_color = float4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a7c34d0d23 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.msl @@ -0,0 +1,60 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + *(tint_symbol_4) = 0; + while (true) { + int const x_30 = *(tint_symbol_4); + if ((x_30 < 100)) { + } else { + break; + } + int const x_33 = *(tint_symbol_4); + *(tint_symbol_4) = (x_33 + 1); + int const x_35 = *(tint_symbol_4); + int const x_36 = *(tint_symbol_4); + if (((x_35 * x_36) > 10)) { + break; + } + } + int const x_41 = *(tint_symbol_4); + if ((x_41 == 4)) { + int const x_47 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_47), float(x_50), float(x_53), float(x_56)); + } else { + int const x_60 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_61 = float(x_60); + *(tint_symbol_5) = float4(x_61, x_61, x_61, x_61); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_6, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b9329734e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.spvasm @@ -0,0 +1,136 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 81 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %int_4 = OpConstant %int 4 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %69 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + OpStore %x_GLF_global_loop_count %int_0 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %27 = OpLoad %int %x_GLF_global_loop_count + %29 = OpSLessThan %bool %27 %int_100 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpBranch %24 + %31 = OpLabel + %34 = OpLoad %int %x_GLF_global_loop_count + %36 = OpIAdd %int %34 %int_1 + OpStore %x_GLF_global_loop_count %36 + %37 = OpLoad %int %x_GLF_global_loop_count + %38 = OpLoad %int %x_GLF_global_loop_count + %39 = OpIMul %int %37 %38 + %41 = OpSGreaterThan %bool %39 %int_10 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpBranch %24 + %42 = OpLabel + OpBranch %25 + %25 = OpLabel + OpBranch %23 + %24 = OpLabel + %44 = OpLoad %int %x_GLF_global_loop_count + %46 = OpIEqual %bool %44 %int_4 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %53 + %61 = OpConvertSToF %float %55 + %62 = OpConvertSToF %float %57 + %63 = OpConvertSToF %float %59 + %64 = OpCompositeConstruct %v4float %60 %61 %62 %63 + OpStore %x_GLF_color %64 + OpBranch %47 + %49 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + %68 = OpCompositeConstruct %v4float %67 %67 %67 %67 + OpStore %x_GLF_color %68 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %69 +%tint_symbol = OpFunctionParameter %main_out + %73 = OpLabel + %74 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %74 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %76 = OpLabel + %77 = OpFunctionCall %void %main_1 + %79 = OpLoad %v4float %x_GLF_color + %80 = OpCompositeConstruct %main_out %79 + %78 = OpFunctionCall %void %tint_symbol_2 %80 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..27cfa37314 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-global-loop-counter-squared-comparison/0-opt.wgsl.expected.wgsl @@ -0,0 +1,54 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + x_GLF_global_loop_count = 0; + loop { + let x_30 : i32 = x_GLF_global_loop_count; + if ((x_30 < 100)) { + } else { + break; + } + let x_33 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_33 + 1); + let x_35 : i32 = x_GLF_global_loop_count; + let x_36 : i32 = x_GLF_global_loop_count; + if (((x_35 * x_36) > 10)) { + break; + } + } + let x_41 : i32 = x_GLF_global_loop_count; + if ((x_41 == 4)) { + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_47), f32(x_50), f32(x_53), f32(x_56)); + } else { + let x_60 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_61 : f32 = f32(x_60); + x_GLF_color = vec4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm new file mode 100644 index 0000000000..d4c4872e49 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm @@ -0,0 +1,70 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %23 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %24 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %25 = OpLoad %int %24 + OpStore %a %25 + %26 = OpLoad %int %a + %27 = OpIEqual %bool %26 %int_0 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %30 + %29 = OpLabel + %31 = OpLoad %int %a + %32 = OpIAdd %int %31 %int_1 + OpStore %a %32 + OpBranch %28 + %30 = OpLabel + %33 = OpLoad %int %a + %34 = OpIAdd %int %33 %int_1 + OpStore %a %34 + OpBranch %28 + %28 = OpLabel + %35 = OpLoad %int %a + %36 = OpIEqual %bool %35 %int_1 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpStore %_GLF_color %21 + OpBranch %37 + %39 = OpLabel + OpStore %_GLF_color %22 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..edc0a80f30 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.hlsl @@ -0,0 +1,35 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const int x_25 = asint(x_6[0].x); + a = x_25; + if ((a == 0)) { + a = (a + 1); + } else { + a = (a + 1); + } + if ((a == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..63f4fcd14c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int const x_25 = x_6.zero; + a = x_25; + int const x_26 = a; + if ((x_26 == 0)) { + int const x_31 = a; + a = (x_31 + 1); + } else { + int const x_33 = a; + a = (x_33 + 1); + } + int const x_35 = a; + if ((x_35 == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2016928dc9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %43 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %44 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %45 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %18 + %22 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %23 = OpLoad %int %22 + OpStore %a %23 + %24 = OpLoad %int %a + %26 = OpIEqual %bool %24 %int_0 + OpSelectionMerge %28 None + OpBranchConditional %26 %29 %30 + %29 = OpLabel + %31 = OpLoad %int %a + %33 = OpIAdd %int %31 %int_1 + OpStore %a %33 + OpBranch %28 + %30 = OpLabel + %34 = OpLoad %int %a + %35 = OpIAdd %int %34 %int_1 + OpStore %a %35 + OpBranch %28 + %28 = OpLabel + %36 = OpLoad %int %a + %37 = OpIEqual %bool %36 %int_1 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %40 + %39 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %38 + %40 = OpLabel + OpStore %x_GLF_color %44 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %45 +%tint_symbol = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %52 = OpLabel + %53 = OpFunctionCall %void %main_1 + %55 = OpLoad %v4float %x_GLF_color + %56 = OpCompositeConstruct %main_out %55 + %54 = OpFunctionCall %void %tint_symbol_2 %56 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a2c8423a54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.spvasm.expected.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_25 : i32 = x_6.zero; + a = x_25; + let x_26 : i32 = a; + if ((x_26 == 0)) { + let x_31 : i32 = a; + a = (x_31 + 1); + } else { + let x_33 : i32 = a; + a = (x_33 + 1); + } + let x_35 : i32 = a; + if ((x_35 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl new file mode 100644 index 0000000000..a2c8423a54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_25 : i32 = x_6.zero; + a = x_25; + let x_26 : i32 = a; + if ((x_26 == 0)) { + let x_31 : i32 = a; + a = (x_31 + 1); + } else { + let x_33 : i32 = a; + a = (x_33 + 1); + } + let x_35 : i32 = a; + if ((x_35 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..edc0a80f30 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const int x_25 = asint(x_6[0].x); + a = x_25; + if ((a == 0)) { + a = (a + 1); + } else { + a = (a + 1); + } + if ((a == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..63f4fcd14c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int const x_25 = x_6.zero; + a = x_25; + int const x_26 = a; + if ((x_26 == 0)) { + int const x_31 = a; + a = (x_31 + 1); + } else { + int const x_33 = a; + a = (x_33 + 1); + } + int const x_35 = a; + if ((x_35 == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2016928dc9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %43 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %44 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %45 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %18 + %22 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %23 = OpLoad %int %22 + OpStore %a %23 + %24 = OpLoad %int %a + %26 = OpIEqual %bool %24 %int_0 + OpSelectionMerge %28 None + OpBranchConditional %26 %29 %30 + %29 = OpLabel + %31 = OpLoad %int %a + %33 = OpIAdd %int %31 %int_1 + OpStore %a %33 + OpBranch %28 + %30 = OpLabel + %34 = OpLoad %int %a + %35 = OpIAdd %int %34 %int_1 + OpStore %a %35 + OpBranch %28 + %28 = OpLabel + %36 = OpLoad %int %a + %37 = OpIEqual %bool %36 %int_1 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %40 + %39 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %38 + %40 = OpLabel + OpStore %x_GLF_color %44 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %45 +%tint_symbol = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %52 = OpLabel + %53 = OpFunctionCall %void %main_1 + %55 = OpLoad %v4float %x_GLF_color + %56 = OpCompositeConstruct %main_out %55 + %54 = OpFunctionCall %void %tint_symbol_2 %56 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a2c8423a54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-conversion-identical-branches/0-opt.wgsl.expected.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_25 : i32 = x_6.zero; + a = x_25; + let x_26 : i32 = a; + if ((x_26 == 0)) { + let x_31 : i32 = a; + a = (x_31 + 1); + } else { + let x_33 : i32 = a; + a = (x_33 + 1); + } + let x_35 : i32 = a; + if ((x_35 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm new file mode 100644 index 0000000000..059c9b0f7e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm @@ -0,0 +1,96 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %bool = OpTypeBool +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %12 + %29 = OpLabel + %30 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %31 = OpLoad %float %30 + %32 = OpCompositeConstruct %v4float %31 %31 %31 %31 + OpStore %_GLF_color %32 + %33 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %34 = OpLoad %float %33 + %35 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %36 = OpLoad %float %35 + %37 = OpFOrdGreaterThanEqual %bool %34 %36 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %38 + %39 = OpLabel + %40 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %41 = OpLoad %int %40 + OpSelectionMerge %42 None + OpSwitch %41 %42 16 %43 0 %43 + %43 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %45 + %47 = OpConvertSToF %float %41 + %48 = OpCompositeConstruct %v4float %46 %47 %47 %46 + OpStore %_GLF_color %48 + OpBranch %42 + %42 = OpLabel + OpBranch %38 + %38 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpIEqual %bool %50 %52 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + %56 = OpCompositeConstruct %v4float %36 %36 %36 %36 + OpStore %_GLF_color %56 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..7837732df0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.hlsl @@ -0,0 +1,59 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; + +void main_1() { + const float x_31 = asfloat(x_6[1].x); + x_GLF_color = float4(x_31, x_31, x_31, x_31); + const float x_34 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_34 >= x_36)) { + const int x_41 = asint(x_8[1].x); + switch(x_41) { + case 0: + case 16: { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_46 = float(x_45); + const float x_47 = float(x_41); + x_GLF_color = float4(x_46, x_47, x_47, x_46); + break; + } + default: { + break; + } + } + } + const int x_50 = asint(x_8[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_50 == x_52)) { + x_GLF_color = float4(x_36, x_36, x_36, x_36); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.msl new file mode 100644 index 0000000000..2a9fb15b47 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.msl @@ -0,0 +1,69 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_31 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_5) = float4(x_31, x_31, x_31, x_31); + float const x_34 = (*(tint_symbol_6)).y; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_34 >= x_36)) { + int const x_41 = x_8.x_GLF_uniform_int_values.arr[1].el; + switch(x_41) { + case 0: + case 16: { + int const x_45 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_46 = float(x_45); + float const x_47 = float(x_41); + *(tint_symbol_5) = float4(x_46, x_47, x_47, x_46); + break; + } + default: { + break; + } + } + } + int const x_50 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_52 = x_8.x_GLF_uniform_int_values.arr[0].el; + if ((x_50 == x_52)) { + *(tint_symbol_5) = float4(x_36, x_36, x_36, x_36); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, x_8, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..69687bb841 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.spvasm @@ -0,0 +1,135 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %62 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %29 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %30 = OpLoad %float %29 + %31 = OpCompositeConstruct %v4float %30 %30 %30 %30 + OpStore %x_GLF_color %31 + %34 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %35 = OpLoad %float %34 + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpFOrdGreaterThanEqual %bool %35 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %41 + %42 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %45 = OpLoad %int %44 + OpSelectionMerge %46 None + OpSwitch %45 %47 0 %48 16 %48 + %48 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpConvertSToF %float %45 + %53 = OpCompositeConstruct %v4float %51 %52 %52 %51 + OpStore %x_GLF_color %53 + OpBranch %46 + %47 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %41 + %41 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpIEqual %bool %55 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + %61 = OpCompositeConstruct %v4float %38 %38 %38 %38 + OpStore %x_GLF_color %61 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %62 +%tint_symbol_1 = OpFunctionParameter %main_out + %66 = OpLabel + %67 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %67 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %69 = OpLabel + %70 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %70 + %71 = OpFunctionCall %void %main_1 + %73 = OpLoad %v4float %x_GLF_color + %74 = OpCompositeConstruct %main_out %73 + %72 = OpFunctionCall %void %tint_symbol_3 %74 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..8f12c6b2d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.spvasm.expected.wgsl @@ -0,0 +1,59 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + let x_31 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_31, x_31, x_31, x_31); + let x_34 : f32 = gl_FragCoord.y; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_34 >= x_36)) { + let x_41 : i32 = x_8.x_GLF_uniform_int_values[1]; + switch(x_41) { + case 0, 16: { + let x_45 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_46 : f32 = f32(x_45); + let x_47 : f32 = f32(x_41); + x_GLF_color = vec4(x_46, x_47, x_47, x_46); + } + default: { + } + } + } + let x_50 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_52 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_50 == x_52)) { + x_GLF_color = vec4(x_36, x_36, x_36, x_36); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl new file mode 100644 index 0000000000..8f12c6b2d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl @@ -0,0 +1,59 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + let x_31 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_31, x_31, x_31, x_31); + let x_34 : f32 = gl_FragCoord.y; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_34 >= x_36)) { + let x_41 : i32 = x_8.x_GLF_uniform_int_values[1]; + switch(x_41) { + case 0, 16: { + let x_45 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_46 : f32 = f32(x_45); + let x_47 : f32 = f32(x_41); + x_GLF_color = vec4(x_46, x_47, x_47, x_46); + } + default: { + } + } + } + let x_50 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_52 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_50 == x_52)) { + x_GLF_color = vec4(x_36, x_36, x_36, x_36); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..7837732df0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.hlsl @@ -0,0 +1,59 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; + +void main_1() { + const float x_31 = asfloat(x_6[1].x); + x_GLF_color = float4(x_31, x_31, x_31, x_31); + const float x_34 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_34 >= x_36)) { + const int x_41 = asint(x_8[1].x); + switch(x_41) { + case 0: + case 16: { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_46 = float(x_45); + const float x_47 = float(x_41); + x_GLF_color = float4(x_46, x_47, x_47, x_46); + break; + } + default: { + break; + } + } + } + const int x_50 = asint(x_8[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_50 == x_52)) { + x_GLF_color = float4(x_36, x_36, x_36, x_36); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.msl new file mode 100644 index 0000000000..2a9fb15b47 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.msl @@ -0,0 +1,69 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_31 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_5) = float4(x_31, x_31, x_31, x_31); + float const x_34 = (*(tint_symbol_6)).y; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_34 >= x_36)) { + int const x_41 = x_8.x_GLF_uniform_int_values.arr[1].el; + switch(x_41) { + case 0: + case 16: { + int const x_45 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_46 = float(x_45); + float const x_47 = float(x_41); + *(tint_symbol_5) = float4(x_46, x_47, x_47, x_46); + break; + } + default: { + break; + } + } + } + int const x_50 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_52 = x_8.x_GLF_uniform_int_values.arr[0].el; + if ((x_50 == x_52)) { + *(tint_symbol_5) = float4(x_36, x_36, x_36, x_36); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, x_8, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..69687bb841 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.spvasm @@ -0,0 +1,135 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %62 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %29 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %30 = OpLoad %float %29 + %31 = OpCompositeConstruct %v4float %30 %30 %30 %30 + OpStore %x_GLF_color %31 + %34 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %35 = OpLoad %float %34 + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpFOrdGreaterThanEqual %bool %35 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %41 + %42 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %45 = OpLoad %int %44 + OpSelectionMerge %46 None + OpSwitch %45 %47 0 %48 16 %48 + %48 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpConvertSToF %float %45 + %53 = OpCompositeConstruct %v4float %51 %52 %52 %51 + OpStore %x_GLF_color %53 + OpBranch %46 + %47 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %41 + %41 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpIEqual %bool %55 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + %61 = OpCompositeConstruct %v4float %38 %38 %38 %38 + OpStore %x_GLF_color %61 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %62 +%tint_symbol_1 = OpFunctionParameter %main_out + %66 = OpLabel + %67 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %67 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %69 = OpLabel + %70 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %70 + %71 = OpFunctionCall %void %main_1 + %73 = OpLoad %v4float %x_GLF_color + %74 = OpCompositeConstruct %main_out %73 + %72 = OpFunctionCall %void %tint_symbol_3 %74 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..8f12c6b2d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-switch-fallthrough/0.wgsl.expected.wgsl @@ -0,0 +1,59 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + let x_31 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_31, x_31, x_31, x_31); + let x_34 : f32 = gl_FragCoord.y; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_34 >= x_36)) { + let x_41 : i32 = x_8.x_GLF_uniform_int_values[1]; + switch(x_41) { + case 0, 16: { + let x_45 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_46 : f32 = f32(x_45); + let x_47 : f32 = f32(x_41); + x_GLF_color = vec4(x_46, x_47, x_47, x_46); + } + default: { + } + } + } + let x_50 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_52 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_50 == x_52)) { + x_GLF_color = vec4(x_36, x_36, x_36, x_36); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm new file mode 100644 index 0000000000..c201685818 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm @@ -0,0 +1,134 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %b "b" + OpName %c "c" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %11 + %27 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %c = OpVariable %_ptr_Function_int Function + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %29 = OpLoad %int %28 + OpStore %a %29 + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %31 = OpLoad %int %30 + OpStore %b %31 + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %33 = OpLoad %int %32 + OpStore %c %33 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %int %a + %39 = OpLoad %int %b + %40 = OpSLessThan %bool %38 %39 + OpBranchConditional %40 %41 %35 + %41 = OpLabel + %42 = OpLoad %int %a + %43 = OpIAdd %int %42 %int_1 + OpStore %a %43 + %44 = OpLoad %int %c + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %46 = OpLoad %int %45 + %47 = OpIEqual %bool %44 %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %52 = OpLoad %int %51 + %53 = OpLoad %int %c + %54 = OpIMul %int %53 %52 + OpStore %c %54 + OpBranch %48 + %50 = OpLabel + OpSelectionMerge %55 None + OpBranchConditional %true %56 %55 + %56 = OpLabel + OpBranch %36 + %55 = OpLabel + OpBranch %48 + %48 = OpLabel + OpBranch %36 + %36 = OpLabel + OpBranch %34 + %35 = OpLabel + %57 = OpLoad %int %a + %58 = OpLoad %int %b + %59 = OpIEqual %bool %57 %58 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %60 + %61 = OpLabel + %62 = OpLoad %int %c + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %64 = OpLoad %int %63 + %65 = OpIEqual %bool %62 %64 + OpBranch %60 + %60 = OpLabel + %66 = OpPhi %bool %59 %35 %65 %61 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %69 + %68 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %71 + %73 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %80 + %82 = OpCompositeConstruct %v4float %72 %75 %78 %81 + OpStore %_GLF_color %82 + OpBranch %67 + %69 = OpLabel + %83 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %84 = OpLoad %int %83 + %85 = OpConvertSToF %float %84 + %86 = OpCompositeConstruct %v4float %85 %85 %85 %85 + OpStore %_GLF_color %86 + OpBranch %67 + %67 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..1ee50e8c13 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.hlsl @@ -0,0 +1,73 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int b = 0; + int c = 0; + bool x_65 = false; + bool x_66_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + a = x_29; + const int x_31 = asint(x_6[1].x); + b = x_31; + const int x_33 = asint(x_6[2].x); + c = x_33; + while (true) { + if ((a < b)) { + } else { + break; + } + a = (a + 1); + const int x_44 = c; + const int x_46 = asint(x_6[2].x); + if ((x_44 == x_46)) { + const int x_52 = asint(x_6[3].x); + c = (c * x_52); + } else { + if (true) { + continue; + } + } + } + const bool x_59 = (a == b); + x_66_phi = x_59; + if (x_59) { + const int x_62 = c; + const int x_64 = asint(x_6[3].x); + x_65 = (x_62 == x_64); + x_66_phi = x_65; + } + if (x_66_phi) { + const int x_71 = asint(x_6[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_77 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_80 = asint(x_6[2].x); + x_GLF_color = float4(float(x_71), float(x_74), float(x_77), float(x_80)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_84 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_85 = float(x_84); + x_GLF_color = float4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b18bbf73a6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.msl @@ -0,0 +1,86 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int b = 0; + int c = 0; + bool x_65 = false; + bool x_66_phi = false; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = x_29; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[1].el; + b = x_31; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[2].el; + c = x_33; + while (true) { + int const x_38 = a; + int const x_39 = b; + if ((x_38 < x_39)) { + } else { + break; + } + int const x_42 = a; + a = (x_42 + 1); + int const x_44 = c; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_44 == x_46)) { + int const x_52 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_53 = c; + c = (x_53 * x_52); + } else { + if (true) { + continue; + } + } + } + int const x_57 = a; + int const x_58 = b; + bool const x_59 = (x_57 == x_58); + x_66_phi = x_59; + if (x_59) { + int const x_62 = c; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[3].el; + x_65 = (x_62 == x_64); + x_66_phi = x_65; + } + bool const x_66 = x_66_phi; + if (x_66) { + int const x_71 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_74 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_77 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_80 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_71), float(x_74), float(x_77), float(x_80)); + } else { + int const x_84 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_85 = float(x_84); + *(tint_symbol_4) = float4(x_85, x_85, x_85, x_85); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..a7e3461b98 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.spvasm @@ -0,0 +1,182 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 110 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %x_65 "x_65" + OpName %x_66_phi "x_66_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %98 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %b = OpVariable %_ptr_Function_int Function %21 + %c = OpVariable %_ptr_Function_int Function %21 + %x_65 = OpVariable %_ptr_Function_bool Function %27 + %x_66_phi = OpVariable %_ptr_Function_bool Function %27 + %32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %33 = OpLoad %int %32 + OpStore %a %33 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %36 = OpLoad %int %35 + OpStore %b %36 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %39 = OpLoad %int %38 + OpStore %c %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %a + %45 = OpLoad %int %b + %46 = OpSLessThan %bool %44 %45 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + OpBranch %47 + %49 = OpLabel + OpBranch %41 + %47 = OpLabel + %50 = OpLoad %int %a + %51 = OpIAdd %int %50 %int_1 + OpStore %a %51 + %52 = OpLoad %int %c + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %54 = OpLoad %int %53 + %55 = OpIEqual %bool %52 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %61 = OpLoad %int %60 + %62 = OpLoad %int %c + %63 = OpIMul %int %62 %61 + OpStore %c %63 + OpBranch %56 + %58 = OpLabel + OpSelectionMerge %65 None + OpBranchConditional %true %66 %65 + %66 = OpLabel + OpBranch %42 + %65 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %42 + %42 = OpLabel + OpBranch %40 + %41 = OpLabel + %67 = OpLoad %int %a + %68 = OpLoad %int %b + %69 = OpIEqual %bool %67 %68 + OpStore %x_66_phi %69 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpLoad %int %c + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %74 = OpLoad %int %73 + %75 = OpIEqual %bool %72 %74 + OpStore %x_65 %75 + %76 = OpLoad %bool %x_65 + OpStore %x_66_phi %76 + OpBranch %70 + %70 = OpLabel + %77 = OpLoad %bool %x_66_phi + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %82 + %90 = OpConvertSToF %float %84 + %91 = OpConvertSToF %float %86 + %92 = OpConvertSToF %float %88 + %93 = OpCompositeConstruct %v4float %89 %90 %91 %92 + OpStore %x_GLF_color %93 + OpBranch %78 + %80 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpCompositeConstruct %v4float %96 %96 %96 %96 + OpStore %x_GLF_color %97 + OpBranch %78 + %78 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %98 +%tint_symbol = OpFunctionParameter %main_out + %102 = OpLabel + %103 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %103 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %105 = OpLabel + %106 = OpFunctionCall %void %main_1 + %108 = OpLoad %v4float %x_GLF_color + %109 = OpCompositeConstruct %main_out %108 + %107 = OpFunctionCall %void %tint_symbol_2 %109 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..73577ebe2e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.spvasm.expected.wgsl @@ -0,0 +1,79 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var c : i32; + var x_65 : bool; + var x_66_phi : bool; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_29; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[1]; + b = x_31; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[2]; + c = x_33; + loop { + let x_38 : i32 = a; + let x_39 : i32 = b; + if ((x_38 < x_39)) { + } else { + break; + } + let x_42 : i32 = a; + a = (x_42 + 1); + let x_44 : i32 = c; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_44 == x_46)) { + let x_52 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_53 : i32 = c; + c = (x_53 * x_52); + } else { + if (true) { + continue; + } + } + } + let x_57 : i32 = a; + let x_58 : i32 = b; + let x_59 : bool = (x_57 == x_58); + x_66_phi = x_59; + if (x_59) { + let x_62 : i32 = c; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_65 = (x_62 == x_64); + x_66_phi = x_65; + } + let x_66 : bool = x_66_phi; + if (x_66) { + let x_71 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_74 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_80 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_71), f32(x_74), f32(x_77), f32(x_80)); + } else { + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_85 : f32 = f32(x_84); + x_GLF_color = vec4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl new file mode 100644 index 0000000000..73577ebe2e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl @@ -0,0 +1,79 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var c : i32; + var x_65 : bool; + var x_66_phi : bool; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_29; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[1]; + b = x_31; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[2]; + c = x_33; + loop { + let x_38 : i32 = a; + let x_39 : i32 = b; + if ((x_38 < x_39)) { + } else { + break; + } + let x_42 : i32 = a; + a = (x_42 + 1); + let x_44 : i32 = c; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_44 == x_46)) { + let x_52 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_53 : i32 = c; + c = (x_53 * x_52); + } else { + if (true) { + continue; + } + } + } + let x_57 : i32 = a; + let x_58 : i32 = b; + let x_59 : bool = (x_57 == x_58); + x_66_phi = x_59; + if (x_59) { + let x_62 : i32 = c; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_65 = (x_62 == x_64); + x_66_phi = x_65; + } + let x_66 : bool = x_66_phi; + if (x_66) { + let x_71 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_74 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_80 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_71), f32(x_74), f32(x_77), f32(x_80)); + } else { + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_85 : f32 = f32(x_84); + x_GLF_color = vec4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..1ee50e8c13 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.hlsl @@ -0,0 +1,73 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int b = 0; + int c = 0; + bool x_65 = false; + bool x_66_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + a = x_29; + const int x_31 = asint(x_6[1].x); + b = x_31; + const int x_33 = asint(x_6[2].x); + c = x_33; + while (true) { + if ((a < b)) { + } else { + break; + } + a = (a + 1); + const int x_44 = c; + const int x_46 = asint(x_6[2].x); + if ((x_44 == x_46)) { + const int x_52 = asint(x_6[3].x); + c = (c * x_52); + } else { + if (true) { + continue; + } + } + } + const bool x_59 = (a == b); + x_66_phi = x_59; + if (x_59) { + const int x_62 = c; + const int x_64 = asint(x_6[3].x); + x_65 = (x_62 == x_64); + x_66_phi = x_65; + } + if (x_66_phi) { + const int x_71 = asint(x_6[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_77 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_80 = asint(x_6[2].x); + x_GLF_color = float4(float(x_71), float(x_74), float(x_77), float(x_80)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_84 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_85 = float(x_84); + x_GLF_color = float4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b18bbf73a6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.msl @@ -0,0 +1,86 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int b = 0; + int c = 0; + bool x_65 = false; + bool x_66_phi = false; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = x_29; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[1].el; + b = x_31; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[2].el; + c = x_33; + while (true) { + int const x_38 = a; + int const x_39 = b; + if ((x_38 < x_39)) { + } else { + break; + } + int const x_42 = a; + a = (x_42 + 1); + int const x_44 = c; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_44 == x_46)) { + int const x_52 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_53 = c; + c = (x_53 * x_52); + } else { + if (true) { + continue; + } + } + } + int const x_57 = a; + int const x_58 = b; + bool const x_59 = (x_57 == x_58); + x_66_phi = x_59; + if (x_59) { + int const x_62 = c; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[3].el; + x_65 = (x_62 == x_64); + x_66_phi = x_65; + } + bool const x_66 = x_66_phi; + if (x_66) { + int const x_71 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_74 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_77 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_80 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_71), float(x_74), float(x_77), float(x_80)); + } else { + int const x_84 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_85 = float(x_84); + *(tint_symbol_4) = float4(x_85, x_85, x_85, x_85); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..a7e3461b98 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.spvasm @@ -0,0 +1,182 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 110 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %x_65 "x_65" + OpName %x_66_phi "x_66_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %98 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %b = OpVariable %_ptr_Function_int Function %21 + %c = OpVariable %_ptr_Function_int Function %21 + %x_65 = OpVariable %_ptr_Function_bool Function %27 + %x_66_phi = OpVariable %_ptr_Function_bool Function %27 + %32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %33 = OpLoad %int %32 + OpStore %a %33 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %36 = OpLoad %int %35 + OpStore %b %36 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %39 = OpLoad %int %38 + OpStore %c %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %a + %45 = OpLoad %int %b + %46 = OpSLessThan %bool %44 %45 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + OpBranch %47 + %49 = OpLabel + OpBranch %41 + %47 = OpLabel + %50 = OpLoad %int %a + %51 = OpIAdd %int %50 %int_1 + OpStore %a %51 + %52 = OpLoad %int %c + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %54 = OpLoad %int %53 + %55 = OpIEqual %bool %52 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %61 = OpLoad %int %60 + %62 = OpLoad %int %c + %63 = OpIMul %int %62 %61 + OpStore %c %63 + OpBranch %56 + %58 = OpLabel + OpSelectionMerge %65 None + OpBranchConditional %true %66 %65 + %66 = OpLabel + OpBranch %42 + %65 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %42 + %42 = OpLabel + OpBranch %40 + %41 = OpLabel + %67 = OpLoad %int %a + %68 = OpLoad %int %b + %69 = OpIEqual %bool %67 %68 + OpStore %x_66_phi %69 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpLoad %int %c + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %74 = OpLoad %int %73 + %75 = OpIEqual %bool %72 %74 + OpStore %x_65 %75 + %76 = OpLoad %bool %x_65 + OpStore %x_66_phi %76 + OpBranch %70 + %70 = OpLabel + %77 = OpLoad %bool %x_66_phi + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %82 + %90 = OpConvertSToF %float %84 + %91 = OpConvertSToF %float %86 + %92 = OpConvertSToF %float %88 + %93 = OpCompositeConstruct %v4float %89 %90 %91 %92 + OpStore %x_GLF_color %93 + OpBranch %78 + %80 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpCompositeConstruct %v4float %96 %96 %96 %96 + OpStore %x_GLF_color %97 + OpBranch %78 + %78 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %98 +%tint_symbol = OpFunctionParameter %main_out + %102 = OpLabel + %103 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %103 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %105 = OpLabel + %106 = OpFunctionCall %void %main_1 + %108 = OpLoad %v4float %x_GLF_color + %109 = OpCompositeConstruct %main_out %108 + %107 = OpFunctionCall %void %tint_symbol_2 %109 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..73577ebe2e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-continue/0-opt.wgsl.expected.wgsl @@ -0,0 +1,79 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var c : i32; + var x_65 : bool; + var x_66_phi : bool; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_29; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[1]; + b = x_31; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[2]; + c = x_33; + loop { + let x_38 : i32 = a; + let x_39 : i32 = b; + if ((x_38 < x_39)) { + } else { + break; + } + let x_42 : i32 = a; + a = (x_42 + 1); + let x_44 : i32 = c; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_44 == x_46)) { + let x_52 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_53 : i32 = c; + c = (x_53 * x_52); + } else { + if (true) { + continue; + } + } + } + let x_57 : i32 = a; + let x_58 : i32 = b; + let x_59 : bool = (x_57 == x_58); + x_66_phi = x_59; + if (x_59) { + let x_62 : i32 = c; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_65 = (x_62 == x_64); + x_66_phi = x_65; + } + let x_66 : bool = x_66_phi; + if (x_66) { + let x_71 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_74 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_80 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_71), f32(x_74), f32(x_77), f32(x_80)); + } else { + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_85 : f32 = f32(x_84); + x_GLF_color = vec4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm new file mode 100644 index 0000000000..61eabc3fd4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm @@ -0,0 +1,97 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %9 + %24 = OpLabel + %a = OpVariable %_ptr_Function_int Function + OpStore %a %int_1 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %int %a + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpSGreaterThanEqual %bool %29 %31 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %33 + %34 = OpLabel + OpBranch %26 + %33 = OpLabel + OpSelectionMerge %35 None + OpBranchConditional %true %36 %35 + %36 = OpLabel + OpKill + %35 = OpLabel + %37 = OpLoad %int %a + %38 = OpIAdd %int %37 %int_1 + OpStore %a %38 + OpBranch %27 + %27 = OpLabel + %39 = OpLoad %int %a + %40 = OpINotEqual %bool %39 %int_1 + OpBranchConditional %40 %25 %26 + %26 = OpLabel + %41 = OpLoad %int %a + %42 = OpIEqual %bool %41 %int_1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpConvertSToF %float %47 + %49 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpCompositeConstruct %v4float %float_1 %48 %51 %54 + OpStore %_GLF_color %55 + OpBranch %43 + %45 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpCompositeConstruct %v4float %58 %58 %58 %58 + OpStore %_GLF_color %59 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..5317e21905 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.hlsl @@ -0,0 +1,55 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + a = 1; + while (true) { + const int x_29 = a; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_31 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_29 >= x_31)) { + break; + } + if (true) { + discard; + } + a = (a + 1); + { + if ((a != 1)) { + } else { + break; + } + } + } + if ((a == 1)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_53 = asint(x_6[1].x); + x_GLF_color = float4(1.0f, float(x_47), float(x_50), float(x_53)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_58 = float(x_57); + x_GLF_color = float4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..6aa0157cef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.msl @@ -0,0 +1,64 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + a = 1; + while (true) { + int const x_29 = a; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_29 >= x_31)) { + break; + } + if (true) { + discard_fragment(); + } + int const x_37 = a; + a = (x_37 + 1); + { + int const x_39 = a; + if ((x_39 != 1)) { + } else { + break; + } + } + } + int const x_41 = a; + if ((x_41 == 1)) { + int const x_47 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(1.0f, float(x_47), float(x_50), float(x_53)); + } else { + int const x_57 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_58 = float(x_57); + *(tint_symbol_4) = float4(x_58, x_58, x_58, x_58); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..d01a3ec2b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.spvasm @@ -0,0 +1,142 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + OpStore %a %int_1 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %27 = OpLoad %int %a + %31 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %32 = OpLoad %int %31 + %33 = OpSGreaterThanEqual %bool %27 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + OpBranch %24 + %35 = OpLabel + OpSelectionMerge %38 None + OpBranchConditional %true %39 %38 + %39 = OpLabel + OpKill + %38 = OpLabel + %40 = OpLoad %int %a + %41 = OpIAdd %int %40 %int_1 + OpStore %a %41 + OpBranch %25 + %25 = OpLabel + %42 = OpLoad %int %a + %43 = OpINotEqual %bool %42 %int_1 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %24 + %44 = OpLabel + OpBranch %23 + %24 = OpLabel + %47 = OpLoad %int %a + %48 = OpIEqual %bool %47 %int_1 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %57 = OpLoad %int %56 + %59 = OpConvertSToF %float %53 + %60 = OpConvertSToF %float %55 + %61 = OpConvertSToF %float %57 + %62 = OpCompositeConstruct %v4float %float_1 %59 %60 %61 + OpStore %x_GLF_color %62 + OpBranch %49 + %51 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %65 %65 %65 %65 + OpStore %x_GLF_color %66 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 25[%25] is not post dominated by the back-edge block 44[%44] + %44 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..80683f19e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.spvasm.expected.wgsl @@ -0,0 +1,58 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + a = 1; + loop { + let x_29 : i32 = a; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_29 >= x_31)) { + break; + } + if (true) { + discard; + } + let x_37 : i32 = a; + a = (x_37 + 1); + + continuing { + let x_39 : i32 = a; + if ((x_39 != 1)) { + } else { + break; + } + } + } + let x_41 : i32 = a; + if ((x_41 == 1)) { + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(1.0, f32(x_47), f32(x_50), f32(x_53)); + } else { + let x_57 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl new file mode 100644 index 0000000000..80683f19e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl @@ -0,0 +1,58 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + a = 1; + loop { + let x_29 : i32 = a; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_29 >= x_31)) { + break; + } + if (true) { + discard; + } + let x_37 : i32 = a; + a = (x_37 + 1); + + continuing { + let x_39 : i32 = a; + if ((x_39 != 1)) { + } else { + break; + } + } + } + let x_41 : i32 = a; + if ((x_41 == 1)) { + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(1.0, f32(x_47), f32(x_50), f32(x_53)); + } else { + let x_57 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..5317e21905 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.hlsl @@ -0,0 +1,55 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + a = 1; + while (true) { + const int x_29 = a; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_31 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_29 >= x_31)) { + break; + } + if (true) { + discard; + } + a = (a + 1); + { + if ((a != 1)) { + } else { + break; + } + } + } + if ((a == 1)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_53 = asint(x_6[1].x); + x_GLF_color = float4(1.0f, float(x_47), float(x_50), float(x_53)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_58 = float(x_57); + x_GLF_color = float4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..6aa0157cef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.msl @@ -0,0 +1,64 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + a = 1; + while (true) { + int const x_29 = a; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_29 >= x_31)) { + break; + } + if (true) { + discard_fragment(); + } + int const x_37 = a; + a = (x_37 + 1); + { + int const x_39 = a; + if ((x_39 != 1)) { + } else { + break; + } + } + } + int const x_41 = a; + if ((x_41 == 1)) { + int const x_47 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(1.0f, float(x_47), float(x_50), float(x_53)); + } else { + int const x_57 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_58 = float(x_57); + *(tint_symbol_4) = float4(x_58, x_58, x_58, x_58); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..d01a3ec2b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.spvasm @@ -0,0 +1,142 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + OpStore %a %int_1 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %27 = OpLoad %int %a + %31 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %32 = OpLoad %int %31 + %33 = OpSGreaterThanEqual %bool %27 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + OpBranch %24 + %35 = OpLabel + OpSelectionMerge %38 None + OpBranchConditional %true %39 %38 + %39 = OpLabel + OpKill + %38 = OpLabel + %40 = OpLoad %int %a + %41 = OpIAdd %int %40 %int_1 + OpStore %a %41 + OpBranch %25 + %25 = OpLabel + %42 = OpLoad %int %a + %43 = OpINotEqual %bool %42 %int_1 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %24 + %44 = OpLabel + OpBranch %23 + %24 = OpLabel + %47 = OpLoad %int %a + %48 = OpIEqual %bool %47 %int_1 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %57 = OpLoad %int %56 + %59 = OpConvertSToF %float %53 + %60 = OpConvertSToF %float %55 + %61 = OpConvertSToF %float %57 + %62 = OpCompositeConstruct %v4float %float_1 %59 %60 %61 + OpStore %x_GLF_color %62 + OpBranch %49 + %51 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %65 %65 %65 %65 + OpStore %x_GLF_color %66 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 25[%25] is not post dominated by the back-edge block 44[%44] + %44 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..80683f19e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-if-true-discard-in-do-while-never-reached/0-opt.wgsl.expected.wgsl @@ -0,0 +1,58 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + a = 1; + loop { + let x_29 : i32 = a; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_29 >= x_31)) { + break; + } + if (true) { + discard; + } + let x_37 : i32 = a; + a = (x_37 + 1); + + continuing { + let x_39 : i32 = a; + if ((x_39 != 1)) { + } else { + break; + } + } + } + let x_41 : i32 = a; + if ((x_41 == 1)) { + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(1.0, f32(x_47), f32(x_50), f32(x_53)); + } else { + let x_57 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm new file mode 100644 index 0000000000..d7e3f855a5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm @@ -0,0 +1,86 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_7 = OpConstant %int 7 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %25 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %26 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %int %i + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %33 = OpLoad %int %32 + %34 = OpIAdd %int %int_7 %33 + %35 = OpSLessThan %bool %31 %34 + OpBranchConditional %35 %36 %28 + %36 = OpLabel + %37 = OpLoad %int %i + OpSelectionMerge %38 None + OpSwitch %37 %38 7 %39 8 %39 + %39 = OpLabel + %40 = OpLoad %int %a + %41 = OpIAdd %int %40 %int_1 + OpStore %a %41 + OpBranch %38 + %38 = OpLabel + OpBranch %29 + %29 = OpLabel + %42 = OpLoad %int %i + %43 = OpIAdd %int %42 %int_1 + OpStore %i %43 + OpBranch %27 + %28 = OpLabel + %44 = OpLoad %int %a + %45 = OpIEqual %bool %44 %int_2 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpStore %_GLF_color %24 + OpBranch %46 + %48 = OpLabel + OpStore %_GLF_color %25 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3ac8a37a76 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.hlsl @@ -0,0 +1,52 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + a = 0; + i = 0; + while (true) { + const int x_31 = i; + const int x_33 = asint(x_7[0].x); + if ((x_31 < (7 + x_33))) { + } else { + break; + } + switch(i) { + case 7: + case 8: { + a = (a + 1); + break; + } + default: { + break; + } + } + { + i = (i + 1); + } + } + if ((a == 2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b25d714923 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.msl @@ -0,0 +1,59 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + a = 0; + i = 0; + while (true) { + int const x_31 = i; + int const x_33 = x_7.three; + if ((x_31 < (7 + x_33))) { + } else { + break; + } + int const x_37 = i; + switch(x_37) { + case 7: + case 8: { + int const x_40 = a; + a = (x_40 + 1); + break; + } + default: { + break; + } + } + { + int const x_42 = i; + i = (x_42 + 1); + } + } + int const x_44 = a; + if ((x_44 == 2)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..5e511e0eef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_7 = OpConstant %int 7 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %55 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %56 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %57 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %18 + %i = OpVariable %_ptr_Function_int Function %18 + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %int %i + %29 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %30 = OpLoad %int %29 + %32 = OpIAdd %int %int_7 %30 + %33 = OpSLessThan %bool %25 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %37 + %36 = OpLabel + OpBranch %35 + %37 = OpLabel + OpBranch %22 + %35 = OpLabel + %38 = OpLoad %int %i + OpSelectionMerge %39 None + OpSwitch %38 %40 7 %41 8 %41 + %41 = OpLabel + %42 = OpLoad %int %a + %44 = OpIAdd %int %42 %int_1 + OpStore %a %44 + OpBranch %39 + %40 = OpLabel + OpBranch %39 + %39 = OpLabel + OpBranch %23 + %23 = OpLabel + %45 = OpLoad %int %i + %46 = OpIAdd %int %45 %int_1 + OpStore %i %46 + OpBranch %21 + %22 = OpLabel + %47 = OpLoad %int %a + %49 = OpIEqual %bool %47 %int_2 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %50 + %52 = OpLabel + OpStore %x_GLF_color %56 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %57 +%tint_symbol = OpFunctionParameter %main_out + %61 = OpLabel + %62 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %62 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %64 = OpLabel + %65 = OpFunctionCall %void %main_1 + %67 = OpLoad %v4float %x_GLF_color + %68 = OpCompositeConstruct %main_out %67 + %66 = OpFunctionCall %void %tint_symbol_2 %68 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..1a774f67b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.spvasm.expected.wgsl @@ -0,0 +1,55 @@ +[[block]] +struct buf0 { + three : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + a = 0; + i = 0; + loop { + let x_31 : i32 = i; + let x_33 : i32 = x_7.three; + if ((x_31 < (7 + x_33))) { + } else { + break; + } + let x_37 : i32 = i; + switch(x_37) { + case 7, 8: { + let x_40 : i32 = a; + a = (x_40 + 1); + } + default: { + } + } + + continuing { + let x_42 : i32 = i; + i = (x_42 + 1); + } + } + let x_44 : i32 = a; + if ((x_44 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl new file mode 100644 index 0000000000..1a774f67b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl @@ -0,0 +1,55 @@ +[[block]] +struct buf0 { + three : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + a = 0; + i = 0; + loop { + let x_31 : i32 = i; + let x_33 : i32 = x_7.three; + if ((x_31 < (7 + x_33))) { + } else { + break; + } + let x_37 : i32 = i; + switch(x_37) { + case 7, 8: { + let x_40 : i32 = a; + a = (x_40 + 1); + } + default: { + } + } + + continuing { + let x_42 : i32 = i; + i = (x_42 + 1); + } + } + let x_44 : i32 = a; + if ((x_44 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3ac8a37a76 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.hlsl @@ -0,0 +1,52 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + a = 0; + i = 0; + while (true) { + const int x_31 = i; + const int x_33 = asint(x_7[0].x); + if ((x_31 < (7 + x_33))) { + } else { + break; + } + switch(i) { + case 7: + case 8: { + a = (a + 1); + break; + } + default: { + break; + } + } + { + i = (i + 1); + } + } + if ((a == 2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b25d714923 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.msl @@ -0,0 +1,59 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + a = 0; + i = 0; + while (true) { + int const x_31 = i; + int const x_33 = x_7.three; + if ((x_31 < (7 + x_33))) { + } else { + break; + } + int const x_37 = i; + switch(x_37) { + case 7: + case 8: { + int const x_40 = a; + a = (x_40 + 1); + break; + } + default: { + break; + } + } + { + int const x_42 = i; + i = (x_42 + 1); + } + } + int const x_44 = a; + if ((x_44 == 2)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5e511e0eef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.spvasm @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_7 = OpConstant %int 7 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %55 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %56 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %57 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %18 + %i = OpVariable %_ptr_Function_int Function %18 + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %int %i + %29 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %30 = OpLoad %int %29 + %32 = OpIAdd %int %int_7 %30 + %33 = OpSLessThan %bool %25 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %37 + %36 = OpLabel + OpBranch %35 + %37 = OpLabel + OpBranch %22 + %35 = OpLabel + %38 = OpLoad %int %i + OpSelectionMerge %39 None + OpSwitch %38 %40 7 %41 8 %41 + %41 = OpLabel + %42 = OpLoad %int %a + %44 = OpIAdd %int %42 %int_1 + OpStore %a %44 + OpBranch %39 + %40 = OpLabel + OpBranch %39 + %39 = OpLabel + OpBranch %23 + %23 = OpLabel + %45 = OpLoad %int %i + %46 = OpIAdd %int %45 %int_1 + OpStore %i %46 + OpBranch %21 + %22 = OpLabel + %47 = OpLoad %int %a + %49 = OpIEqual %bool %47 %int_2 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %50 + %52 = OpLabel + OpStore %x_GLF_color %56 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %57 +%tint_symbol = OpFunctionParameter %main_out + %61 = OpLabel + %62 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %62 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %64 = OpLabel + %65 = OpFunctionCall %void %main_1 + %67 = OpLoad %v4float %x_GLF_color + %68 = OpCompositeConstruct %main_out %67 + %66 = OpFunctionCall %void %tint_symbol_2 %68 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..1a774f67b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inc-inside-switch-and-for/0-opt.wgsl.expected.wgsl @@ -0,0 +1,55 @@ +[[block]] +struct buf0 { + three : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + a = 0; + i = 0; + loop { + let x_31 : i32 = i; + let x_33 : i32 = x_7.three; + if ((x_31 < (7 + x_33))) { + } else { + break; + } + let x_37 : i32 = i; + switch(x_37) { + case 7, 8: { + let x_40 : i32 = a; + a = (x_40 + 1); + } + default: { + } + } + + continuing { + let x_42 : i32 = i; + i = (x_42 + 1); + } + } + let x_44 : i32 = a; + if ((x_44 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm new file mode 100644 index 0000000000..475f28012d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm @@ -0,0 +1,147 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %arr "arr" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_3_0 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 +%_arr_float_uint_3_0 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3_0 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 +%_ptr_Function_int = OpTypePointer Function %int +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %13 + %32 = OpLabel + %arr = OpVariable %_ptr_Function__arr_float_uint_3 Function + %a = OpVariable %_ptr_Function_int Function + %33 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %34 = OpLoad %float %33 + %35 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %36 = OpLoad %float %35 + %37 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %38 = OpLoad %float %37 + %39 = OpCompositeConstruct %_arr_float_uint_3 %34 %36 %38 + OpStore %arr %39 + OpStore %a %int_0 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %a + %45 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpSLessThanEqual %bool %44 %46 + OpBranchConditional %47 %48 %41 + %48 = OpLabel + %49 = OpLoad %int %a + %50 = OpIAdd %int %49 %int_1 + OpStore %a %50 + %51 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %52 = OpLoad %float %51 + %53 = OpAccessChain %_ptr_Function_float %arr %49 + OpStore %53 %52 + OpBranch %42 + %42 = OpLabel + OpBranch %40 + %41 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Function_float %arr %55 + %57 = OpLoad %float %56 + %58 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %59 = OpLoad %float %58 + %60 = OpFOrdEqual %bool %57 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Function_float %arr %64 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpFOrdEqual %bool %66 %68 + OpBranch %61 + %61 = OpLabel + %70 = OpPhi %bool %60 %41 %69 %62 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Function_float %arr %74 + %76 = OpLoad %float %75 + %77 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %78 = OpLoad %float %77 + %79 = OpFOrdEqual %bool %76 %78 + OpBranch %71 + %71 = OpLabel + %80 = OpPhi %bool %70 %61 %79 %72 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Function_float %arr %85 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %89 = OpLoad %float %88 + %90 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %93 = OpLoad %float %92 + %94 = OpCompositeConstruct %v4float %87 %89 %91 %93 + OpStore %_GLF_color %94 + OpBranch %81 + %83 = OpLabel + %95 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %96 = OpLoad %float %95 + %97 = OpCompositeConstruct %v4float %96 %96 %96 %96 + OpStore %_GLF_color %97 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9e41aaaa38 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,87 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float arr[3] = (float[3])0; + int a = 0; + bool x_69 = false; + bool x_79 = false; + bool x_70_phi = false; + bool x_80_phi = false; + const float x_34 = asfloat(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_38 = asfloat(x_6[2].x); + const float tint_symbol_4[3] = {x_34, x_36, x_38}; + arr = tint_symbol_4; + a = 0; + while (true) { + const int x_44 = a; + const int x_46 = asint(x_9[1].x); + if ((x_44 <= x_46)) { + } else { + break; + } + const int x_49 = a; + a = (x_49 + 1); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_52 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + arr[x_49] = x_52; + } + const int x_55 = asint(x_9[1].x); + const float x_57 = arr[x_55]; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_59 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const bool x_60 = (x_57 == x_59); + x_70_phi = x_60; + if (x_60) { + const int x_64 = asint(x_9[2].x); + const float x_66 = arr[x_64]; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_68 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_69 = (x_66 == x_68); + x_70_phi = x_69; + } + const bool x_70 = x_70_phi; + x_80_phi = x_70; + if (x_70) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_9[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_76 = arr[x_74]; + const float x_78 = asfloat(x_6[2].x); + x_79 = (x_76 == x_78); + x_80_phi = x_79; + } + if (x_80_phi) { + const int x_85 = asint(x_9[1].x); + const float x_87 = arr[x_85]; + const float x_89 = asfloat(x_6[1].x); + const float x_91 = asfloat(x_6[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_93 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(x_87, x_89, x_91, x_93); + } else { + const float x_96 = asfloat(x_6[1].x); + x_GLF_color = float4(x_96, x_96, x_96, x_96); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..28fc564faa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,102 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_5) { + tint_array_wrapper_2 arr = {}; + int a = 0; + bool x_69 = false; + bool x_79 = false; + bool x_70_phi = false; + bool x_80_phi = false; + float const x_34 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_38 = x_6.x_GLF_uniform_float_values.arr[2].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_34, x_36, x_38}}; + arr = tint_symbol_3; + a = 0; + while (true) { + int const x_44 = a; + int const x_46 = x_9.x_GLF_uniform_int_values.arr[1].el; + if ((x_44 <= x_46)) { + } else { + break; + } + int const x_49 = a; + a = (x_49 + 1); + float const x_52 = x_6.x_GLF_uniform_float_values.arr[0].el; + arr.arr[x_49] = x_52; + } + int const x_55 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_57 = arr.arr[x_55]; + float const x_59 = x_6.x_GLF_uniform_float_values.arr[0].el; + bool const x_60 = (x_57 == x_59); + x_70_phi = x_60; + if (x_60) { + int const x_64 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_66 = arr.arr[x_64]; + float const x_68 = x_6.x_GLF_uniform_float_values.arr[0].el; + x_69 = (x_66 == x_68); + x_70_phi = x_69; + } + bool const x_70 = x_70_phi; + x_80_phi = x_70; + if (x_70) { + int const x_74 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_76 = arr.arr[x_74]; + float const x_78 = x_6.x_GLF_uniform_float_values.arr[2].el; + x_79 = (x_76 == x_78); + x_80_phi = x_79; + } + bool const x_80 = x_80_phi; + if (x_80) { + int const x_85 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_87 = arr.arr[x_85]; + float const x_89 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_91 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_93 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_5) = float4(x_87, x_89, x_91, x_93); + } else { + float const x_96 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_5) = float4(x_96, x_96, x_96, x_96); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..9d4d51ab94 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,206 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 125 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %arr "arr" + OpName %a "a" + OpName %x_69 "x_69" + OpName %x_79 "x_79" + OpName %x_70_phi "x_70_phi" + OpName %x_80_phi "x_80_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_3_0 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_arr_float_uint_3_0 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3_0 = OpTypePointer Function %_arr_float_uint_3_0 + %26 = OpConstantNull %_arr_float_uint_3_0 +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %33 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %113 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %arr = OpVariable %_ptr_Function__arr_float_uint_3_0 Function %26 + %a = OpVariable %_ptr_Function_int Function %29 + %x_69 = OpVariable %_ptr_Function_bool Function %33 + %x_79 = OpVariable %_ptr_Function_bool Function %33 + %x_70_phi = OpVariable %_ptr_Function_bool Function %33 + %x_80_phi = OpVariable %_ptr_Function_bool Function %33 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %44 = OpLoad %float %43 + %46 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %47 = OpLoad %float %46 + %48 = OpCompositeConstruct %_arr_float_uint_3_0 %41 %44 %47 + OpStore %arr %48 + OpStore %a %int_0 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %int %a + %55 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpSLessThanEqual %bool %53 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %50 + %58 = OpLabel + %61 = OpLoad %int %a + %62 = OpIAdd %int %61 %int_1 + OpStore %a %62 + %63 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %64 = OpLoad %float %63 + %66 = OpAccessChain %_ptr_Function_float %arr %61 + OpStore %66 %64 + OpBranch %51 + %51 = OpLabel + OpBranch %49 + %50 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Function_float %arr %68 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %72 = OpLoad %float %71 + %73 = OpFOrdEqual %bool %70 %72 + OpStore %x_70_phi %73 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %74 + %75 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Function_float %arr %77 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %81 = OpLoad %float %80 + %82 = OpFOrdEqual %bool %79 %81 + OpStore %x_69 %82 + %83 = OpLoad %bool %x_69 + OpStore %x_70_phi %83 + OpBranch %74 + %74 = OpLabel + %84 = OpLoad %bool %x_70_phi + OpStore %x_80_phi %84 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Function_float %arr %88 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %92 = OpLoad %float %91 + %93 = OpFOrdEqual %bool %90 %92 + OpStore %x_79 %93 + %94 = OpLoad %bool %x_79 + OpStore %x_80_phi %94 + OpBranch %85 + %85 = OpLabel + %95 = OpLoad %bool %x_80_phi + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %98 + %97 = OpLabel + %99 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Function_float %arr %100 + %102 = OpLoad %float %101 + %103 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %104 = OpLoad %float %103 + %105 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %106 = OpLoad %float %105 + %107 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %108 = OpLoad %float %107 + %109 = OpCompositeConstruct %v4float %102 %104 %106 %108 + OpStore %x_GLF_color %109 + OpBranch %96 + %98 = OpLabel + %110 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %111 = OpLoad %float %110 + %112 = OpCompositeConstruct %v4float %111 %111 %111 %111 + OpStore %x_GLF_color %112 + OpBranch %96 + %96 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %113 +%tint_symbol = OpFunctionParameter %main_out + %117 = OpLabel + %118 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %118 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %120 = OpLabel + %121 = OpFunctionCall %void %main_1 + %123 = OpLoad %v4float %x_GLF_color + %124 = OpCompositeConstruct %main_out %123 + %122 = OpFunctionCall %void %tint_symbol_2 %124 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..dff82e24e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,90 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var a : i32; + var x_69 : bool; + var x_79 : bool; + var x_70_phi : bool; + var x_80_phi : bool; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[2]; + arr = array(x_34, x_36, x_38); + a = 0; + loop { + let x_44 : i32 = a; + let x_46 : i32 = x_9.x_GLF_uniform_int_values[1]; + if ((x_44 <= x_46)) { + } else { + break; + } + let x_49 : i32 = a; + a = (x_49 + 1); + let x_52 : f32 = x_6.x_GLF_uniform_float_values[0]; + arr[x_49] = x_52; + } + let x_55 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_57 : f32 = arr[x_55]; + let x_59 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_60 : bool = (x_57 == x_59); + x_70_phi = x_60; + if (x_60) { + let x_64 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_66 : f32 = arr[x_64]; + let x_68 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_69 = (x_66 == x_68); + x_70_phi = x_69; + } + let x_70 : bool = x_70_phi; + x_80_phi = x_70; + if (x_70) { + let x_74 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_76 : f32 = arr[x_74]; + let x_78 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_79 = (x_76 == x_78); + x_80_phi = x_79; + } + let x_80 : bool = x_80_phi; + if (x_80) { + let x_85 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_87 : f32 = arr[x_85]; + let x_89 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_91 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_93 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_87, x_89, x_91, x_93); + } else { + let x_96 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_96, x_96, x_96, x_96); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl new file mode 100644 index 0000000000..dff82e24e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl @@ -0,0 +1,90 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var a : i32; + var x_69 : bool; + var x_79 : bool; + var x_70_phi : bool; + var x_80_phi : bool; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[2]; + arr = array(x_34, x_36, x_38); + a = 0; + loop { + let x_44 : i32 = a; + let x_46 : i32 = x_9.x_GLF_uniform_int_values[1]; + if ((x_44 <= x_46)) { + } else { + break; + } + let x_49 : i32 = a; + a = (x_49 + 1); + let x_52 : f32 = x_6.x_GLF_uniform_float_values[0]; + arr[x_49] = x_52; + } + let x_55 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_57 : f32 = arr[x_55]; + let x_59 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_60 : bool = (x_57 == x_59); + x_70_phi = x_60; + if (x_60) { + let x_64 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_66 : f32 = arr[x_64]; + let x_68 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_69 = (x_66 == x_68); + x_70_phi = x_69; + } + let x_70 : bool = x_70_phi; + x_80_phi = x_70; + if (x_70) { + let x_74 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_76 : f32 = arr[x_74]; + let x_78 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_79 = (x_76 == x_78); + x_80_phi = x_79; + } + let x_80 : bool = x_80_phi; + if (x_80) { + let x_85 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_87 : f32 = arr[x_85]; + let x_89 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_91 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_93 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_87, x_89, x_91, x_93); + } else { + let x_96 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_96, x_96, x_96, x_96); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9e41aaaa38 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,87 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float arr[3] = (float[3])0; + int a = 0; + bool x_69 = false; + bool x_79 = false; + bool x_70_phi = false; + bool x_80_phi = false; + const float x_34 = asfloat(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_38 = asfloat(x_6[2].x); + const float tint_symbol_4[3] = {x_34, x_36, x_38}; + arr = tint_symbol_4; + a = 0; + while (true) { + const int x_44 = a; + const int x_46 = asint(x_9[1].x); + if ((x_44 <= x_46)) { + } else { + break; + } + const int x_49 = a; + a = (x_49 + 1); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_52 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + arr[x_49] = x_52; + } + const int x_55 = asint(x_9[1].x); + const float x_57 = arr[x_55]; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_59 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const bool x_60 = (x_57 == x_59); + x_70_phi = x_60; + if (x_60) { + const int x_64 = asint(x_9[2].x); + const float x_66 = arr[x_64]; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_68 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_69 = (x_66 == x_68); + x_70_phi = x_69; + } + const bool x_70 = x_70_phi; + x_80_phi = x_70; + if (x_70) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_9[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_76 = arr[x_74]; + const float x_78 = asfloat(x_6[2].x); + x_79 = (x_76 == x_78); + x_80_phi = x_79; + } + if (x_80_phi) { + const int x_85 = asint(x_9[1].x); + const float x_87 = arr[x_85]; + const float x_89 = asfloat(x_6[1].x); + const float x_91 = asfloat(x_6[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_93 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(x_87, x_89, x_91, x_93); + } else { + const float x_96 = asfloat(x_6[1].x); + x_GLF_color = float4(x_96, x_96, x_96, x_96); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..28fc564faa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,102 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_5) { + tint_array_wrapper_2 arr = {}; + int a = 0; + bool x_69 = false; + bool x_79 = false; + bool x_70_phi = false; + bool x_80_phi = false; + float const x_34 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_38 = x_6.x_GLF_uniform_float_values.arr[2].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_34, x_36, x_38}}; + arr = tint_symbol_3; + a = 0; + while (true) { + int const x_44 = a; + int const x_46 = x_9.x_GLF_uniform_int_values.arr[1].el; + if ((x_44 <= x_46)) { + } else { + break; + } + int const x_49 = a; + a = (x_49 + 1); + float const x_52 = x_6.x_GLF_uniform_float_values.arr[0].el; + arr.arr[x_49] = x_52; + } + int const x_55 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_57 = arr.arr[x_55]; + float const x_59 = x_6.x_GLF_uniform_float_values.arr[0].el; + bool const x_60 = (x_57 == x_59); + x_70_phi = x_60; + if (x_60) { + int const x_64 = x_9.x_GLF_uniform_int_values.arr[2].el; + float const x_66 = arr.arr[x_64]; + float const x_68 = x_6.x_GLF_uniform_float_values.arr[0].el; + x_69 = (x_66 == x_68); + x_70_phi = x_69; + } + bool const x_70 = x_70_phi; + x_80_phi = x_70; + if (x_70) { + int const x_74 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_76 = arr.arr[x_74]; + float const x_78 = x_6.x_GLF_uniform_float_values.arr[2].el; + x_79 = (x_76 == x_78); + x_80_phi = x_79; + } + bool const x_80 = x_80_phi; + if (x_80) { + int const x_85 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_87 = arr.arr[x_85]; + float const x_89 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_91 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_93 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_5) = float4(x_87, x_89, x_91, x_93); + } else { + float const x_96 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_5) = float4(x_96, x_96, x_96, x_96); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..9d4d51ab94 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,206 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 125 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %arr "arr" + OpName %a "a" + OpName %x_69 "x_69" + OpName %x_79 "x_79" + OpName %x_70_phi "x_70_phi" + OpName %x_80_phi "x_80_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_3_0 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_arr_float_uint_3_0 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3_0 = OpTypePointer Function %_arr_float_uint_3_0 + %26 = OpConstantNull %_arr_float_uint_3_0 +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %33 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %113 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %arr = OpVariable %_ptr_Function__arr_float_uint_3_0 Function %26 + %a = OpVariable %_ptr_Function_int Function %29 + %x_69 = OpVariable %_ptr_Function_bool Function %33 + %x_79 = OpVariable %_ptr_Function_bool Function %33 + %x_70_phi = OpVariable %_ptr_Function_bool Function %33 + %x_80_phi = OpVariable %_ptr_Function_bool Function %33 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %44 = OpLoad %float %43 + %46 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %47 = OpLoad %float %46 + %48 = OpCompositeConstruct %_arr_float_uint_3_0 %41 %44 %47 + OpStore %arr %48 + OpStore %a %int_0 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %int %a + %55 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpSLessThanEqual %bool %53 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %50 + %58 = OpLabel + %61 = OpLoad %int %a + %62 = OpIAdd %int %61 %int_1 + OpStore %a %62 + %63 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %64 = OpLoad %float %63 + %66 = OpAccessChain %_ptr_Function_float %arr %61 + OpStore %66 %64 + OpBranch %51 + %51 = OpLabel + OpBranch %49 + %50 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Function_float %arr %68 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %72 = OpLoad %float %71 + %73 = OpFOrdEqual %bool %70 %72 + OpStore %x_70_phi %73 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %74 + %75 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Function_float %arr %77 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %81 = OpLoad %float %80 + %82 = OpFOrdEqual %bool %79 %81 + OpStore %x_69 %82 + %83 = OpLoad %bool %x_69 + OpStore %x_70_phi %83 + OpBranch %74 + %74 = OpLabel + %84 = OpLoad %bool %x_70_phi + OpStore %x_80_phi %84 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Function_float %arr %88 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %92 = OpLoad %float %91 + %93 = OpFOrdEqual %bool %90 %92 + OpStore %x_79 %93 + %94 = OpLoad %bool %x_79 + OpStore %x_80_phi %94 + OpBranch %85 + %85 = OpLabel + %95 = OpLoad %bool %x_80_phi + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %98 + %97 = OpLabel + %99 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Function_float %arr %100 + %102 = OpLoad %float %101 + %103 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %104 = OpLoad %float %103 + %105 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %106 = OpLoad %float %105 + %107 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %108 = OpLoad %float %107 + %109 = OpCompositeConstruct %v4float %102 %104 %106 %108 + OpStore %x_GLF_color %109 + OpBranch %96 + %98 = OpLabel + %110 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %111 = OpLoad %float %110 + %112 = OpCompositeConstruct %v4float %111 %111 %111 %111 + OpStore %x_GLF_color %112 + OpBranch %96 + %96 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %113 +%tint_symbol = OpFunctionParameter %main_out + %117 = OpLabel + %118 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %118 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %120 = OpLabel + %121 = OpFunctionCall %void %main_1 + %123 = OpLoad %v4float %x_GLF_color + %124 = OpCompositeConstruct %main_out %123 + %122 = OpFunctionCall %void %tint_symbol_2 %124 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..dff82e24e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-array-element-in-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,90 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var a : i32; + var x_69 : bool; + var x_79 : bool; + var x_70_phi : bool; + var x_80_phi : bool; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[2]; + arr = array(x_34, x_36, x_38); + a = 0; + loop { + let x_44 : i32 = a; + let x_46 : i32 = x_9.x_GLF_uniform_int_values[1]; + if ((x_44 <= x_46)) { + } else { + break; + } + let x_49 : i32 = a; + a = (x_49 + 1); + let x_52 : f32 = x_6.x_GLF_uniform_float_values[0]; + arr[x_49] = x_52; + } + let x_55 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_57 : f32 = arr[x_55]; + let x_59 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_60 : bool = (x_57 == x_59); + x_70_phi = x_60; + if (x_60) { + let x_64 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_66 : f32 = arr[x_64]; + let x_68 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_69 = (x_66 == x_68); + x_70_phi = x_69; + } + let x_70 : bool = x_70_phi; + x_80_phi = x_70; + if (x_70) { + let x_74 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_76 : f32 = arr[x_74]; + let x_78 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_79 = (x_76 == x_78); + x_80_phi = x_79; + } + let x_80 : bool = x_80_phi; + if (x_80) { + let x_85 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_87 : f32 = arr[x_85]; + let x_89 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_91 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_93 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_87, x_89, x_91, x_93); + } else { + let x_96 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_96, x_96, x_96, x_96); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm new file mode 100644 index 0000000000..0bb66ca1ec --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm @@ -0,0 +1,134 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f0 "f0" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %f1 "f1" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool +%float_1_10000002 = OpConstant %float 1.10000002 + %int_2 = OpConstant %int 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %32 = OpLabel + %f0 = OpVariable %_ptr_Function_float Function + %f1 = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %33 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %34 = OpLoad %float %33 + OpStore %f0 %34 + %35 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %36 = OpLoad %float %35 + OpStore %f1 %36 + %37 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %38 = OpLoad %int %37 + OpStore %i %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i + %44 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpSLessThan %bool %43 %45 + OpBranchConditional %46 %47 %40 + %47 = OpLabel + %48 = OpLoad %float %f0 + %49 = OpFMul %float %float_1_10000002 %48 + %50 = OpExtInst %float %1 FAbs %49 + OpStore %f0 %50 + %51 = OpLoad %float %f0 + OpStore %f1 %51 + OpBranch %41 + %41 = OpLabel + %52 = OpLoad %int %i + %53 = OpIAdd %int %52 %int_1 + OpStore %i %53 + OpBranch %39 + %40 = OpLabel + %54 = OpLoad %float %f1 + %55 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %56 = OpLoad %float %55 + %57 = OpFOrdGreaterThan %bool %54 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + %60 = OpLoad %float %f1 + %61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %62 = OpLoad %float %61 + %63 = OpFOrdLessThan %bool %60 %62 + OpBranch %58 + %58 = OpLabel + %64 = OpPhi %bool %57 %40 %63 %59 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %67 + %66 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %69 + %71 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %72 + %74 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %78 = OpLoad %int %77 + %79 = OpConvertSToF %float %78 + %80 = OpCompositeConstruct %v4float %70 %73 %76 %79 + OpStore %_GLF_color %80 + OpBranch %65 + %67 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpConvertSToF %float %82 + %84 = OpCompositeConstruct %v4float %83 %83 %83 %83 + OpStore %_GLF_color %84 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..8d0ce84b85 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.hlsl @@ -0,0 +1,73 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f0 = 0.0f; + float f1 = 0.0f; + int i = 0; + bool x_63 = false; + bool x_64_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_34 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + f0 = x_34; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + f1 = x_36; + const int x_38 = asint(x_10[1].x); + i = x_38; + while (true) { + const int x_43 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_43 < x_45)) { + } else { + break; + } + f0 = abs((1.100000024f * f0)); + f1 = f0; + { + i = (i + 1); + } + } + const float x_54 = f1; + const float x_56 = asfloat(x_6[1].x); + const bool x_57 = (x_54 > x_56); + x_64_phi = x_57; + if (x_57) { + const float x_60 = f1; + const float x_62 = asfloat(x_6[2].x); + x_63 = (x_60 < x_62); + x_64_phi = x_63; + } + if (x_64_phi) { + const int x_69 = asint(x_10[2].x); + const int x_72 = asint(x_10[1].x); + const int x_75 = asint(x_10[1].x); + const int x_78 = asint(x_10[2].x); + x_GLF_color = float4(float(x_69), float(x_72), float(x_75), float(x_78)); + } else { + const int x_82 = asint(x_10[1].x); + const float x_83 = float(x_82); + x_GLF_color = float4(x_83, x_83, x_83, x_83); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..fa495164ac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_10, thread float4* const tint_symbol_4) { + float f0 = 0.0f; + float f1 = 0.0f; + int i = 0; + bool x_63 = false; + bool x_64_phi = false; + float const x_34 = x_6.x_GLF_uniform_float_values.arr[0].el; + f0 = x_34; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[0].el; + f1 = x_36; + int const x_38 = x_10.x_GLF_uniform_int_values.arr[1].el; + i = x_38; + while (true) { + int const x_43 = i; + int const x_45 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_43 < x_45)) { + } else { + break; + } + float const x_48 = f0; + f0 = fabs((1.100000024f * x_48)); + float const x_51 = f0; + f1 = x_51; + { + int const x_52 = i; + i = (x_52 + 1); + } + } + float const x_54 = f1; + float const x_56 = x_6.x_GLF_uniform_float_values.arr[1].el; + bool const x_57 = (x_54 > x_56); + x_64_phi = x_57; + if (x_57) { + float const x_60 = f1; + float const x_62 = x_6.x_GLF_uniform_float_values.arr[2].el; + x_63 = (x_60 < x_62); + x_64_phi = x_63; + } + bool const x_64 = x_64_phi; + if (x_64) { + int const x_69 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_72 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_75 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_10.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_69), float(x_72), float(x_75), float(x_78)); + } else { + int const x_82 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_83 = float(x_82); + *(tint_symbol_4) = float4(x_83, x_83, x_83, x_83); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2189bcd001 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.spvasm @@ -0,0 +1,185 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 110 +; Schema: 0 + OpCapability Shader + %59 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f0 "f0" + OpName %f1 "f1" + OpName %i "i" + OpName %x_63 "x_63" + OpName %x_64_phi "x_64_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %33 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%float_1_10000002 = OpConstant %float 1.10000002 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %98 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %f0 = OpVariable %_ptr_Function_float Function %25 + %f1 = OpVariable %_ptr_Function_float Function %25 + %i = OpVariable %_ptr_Function_int Function %29 + %x_63 = OpVariable %_ptr_Function_bool Function %33 + %x_64_phi = OpVariable %_ptr_Function_bool Function %33 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %39 = OpLoad %float %38 + OpStore %f0 %39 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %41 = OpLoad %float %40 + OpStore %f1 %41 + %44 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %45 = OpLoad %int %44 + OpStore %i %45 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %49 + %49 = OpLabel + %50 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpSLessThan %bool %50 %52 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + OpBranch %54 + %56 = OpLabel + OpBranch %47 + %54 = OpLabel + %57 = OpLoad %float %f0 + %61 = OpFMul %float %float_1_10000002 %57 + %58 = OpExtInst %float %59 FAbs %61 + OpStore %f0 %58 + %62 = OpLoad %float %f0 + OpStore %f1 %62 + OpBranch %48 + %48 = OpLabel + %63 = OpLoad %int %i + %64 = OpIAdd %int %63 %int_1 + OpStore %i %64 + OpBranch %46 + %47 = OpLabel + %65 = OpLoad %float %f1 + %66 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %67 = OpLoad %float %66 + %68 = OpFOrdGreaterThan %bool %65 %67 + OpStore %x_64_phi %68 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + %71 = OpLoad %float %f1 + %73 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %74 = OpLoad %float %73 + %75 = OpFOrdLessThan %bool %71 %74 + OpStore %x_63 %75 + %76 = OpLoad %bool %x_63 + OpStore %x_64_phi %76 + OpBranch %69 + %69 = OpLabel + %77 = OpLoad %bool %x_64_phi + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %82 + %90 = OpConvertSToF %float %84 + %91 = OpConvertSToF %float %86 + %92 = OpConvertSToF %float %88 + %93 = OpCompositeConstruct %v4float %89 %90 %91 %92 + OpStore %x_GLF_color %93 + OpBranch %78 + %80 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpCompositeConstruct %v4float %96 %96 %96 %96 + OpStore %x_GLF_color %97 + OpBranch %78 + %78 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %98 +%tint_symbol = OpFunctionParameter %main_out + %102 = OpLabel + %103 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %103 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %105 = OpLabel + %106 = OpFunctionCall %void %main_1 + %108 = OpLoad %v4float %x_GLF_color + %109 = OpCompositeConstruct %main_out %108 + %107 = OpFunctionCall %void %tint_symbol_2 %109 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..0fc19145e9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.spvasm.expected.wgsl @@ -0,0 +1,84 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f0 : f32; + var f1 : f32; + var i : i32; + var x_63 : bool; + var x_64_phi : bool; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[0]; + f0 = x_34; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + f1 = x_36; + let x_38 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_38; + loop { + let x_43 : i32 = i; + let x_45 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_43 < x_45)) { + } else { + break; + } + let x_48 : f32 = f0; + f0 = abs((1.100000024 * x_48)); + let x_51 : f32 = f0; + f1 = x_51; + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_54 : f32 = f1; + let x_56 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_57 : bool = (x_54 > x_56); + x_64_phi = x_57; + if (x_57) { + let x_60 : f32 = f1; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_63 = (x_60 < x_62); + x_64_phi = x_63; + } + let x_64 : bool = x_64_phi; + if (x_64) { + let x_69 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_72 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_75 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_10.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_69), f32(x_72), f32(x_75), f32(x_78)); + } else { + let x_82 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_83 : f32 = f32(x_82); + x_GLF_color = vec4(x_83, x_83, x_83, x_83); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl new file mode 100644 index 0000000000..0fc19145e9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl @@ -0,0 +1,84 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f0 : f32; + var f1 : f32; + var i : i32; + var x_63 : bool; + var x_64_phi : bool; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[0]; + f0 = x_34; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + f1 = x_36; + let x_38 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_38; + loop { + let x_43 : i32 = i; + let x_45 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_43 < x_45)) { + } else { + break; + } + let x_48 : f32 = f0; + f0 = abs((1.100000024 * x_48)); + let x_51 : f32 = f0; + f1 = x_51; + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_54 : f32 = f1; + let x_56 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_57 : bool = (x_54 > x_56); + x_64_phi = x_57; + if (x_57) { + let x_60 : f32 = f1; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_63 = (x_60 < x_62); + x_64_phi = x_63; + } + let x_64 : bool = x_64_phi; + if (x_64) { + let x_69 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_72 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_75 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_10.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_69), f32(x_72), f32(x_75), f32(x_78)); + } else { + let x_82 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_83 : f32 = f32(x_82); + x_GLF_color = vec4(x_83, x_83, x_83, x_83); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..8d0ce84b85 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.hlsl @@ -0,0 +1,73 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f0 = 0.0f; + float f1 = 0.0f; + int i = 0; + bool x_63 = false; + bool x_64_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_34 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + f0 = x_34; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + f1 = x_36; + const int x_38 = asint(x_10[1].x); + i = x_38; + while (true) { + const int x_43 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_43 < x_45)) { + } else { + break; + } + f0 = abs((1.100000024f * f0)); + f1 = f0; + { + i = (i + 1); + } + } + const float x_54 = f1; + const float x_56 = asfloat(x_6[1].x); + const bool x_57 = (x_54 > x_56); + x_64_phi = x_57; + if (x_57) { + const float x_60 = f1; + const float x_62 = asfloat(x_6[2].x); + x_63 = (x_60 < x_62); + x_64_phi = x_63; + } + if (x_64_phi) { + const int x_69 = asint(x_10[2].x); + const int x_72 = asint(x_10[1].x); + const int x_75 = asint(x_10[1].x); + const int x_78 = asint(x_10[2].x); + x_GLF_color = float4(float(x_69), float(x_72), float(x_75), float(x_78)); + } else { + const int x_82 = asint(x_10[1].x); + const float x_83 = float(x_82); + x_GLF_color = float4(x_83, x_83, x_83, x_83); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..fa495164ac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_10, thread float4* const tint_symbol_4) { + float f0 = 0.0f; + float f1 = 0.0f; + int i = 0; + bool x_63 = false; + bool x_64_phi = false; + float const x_34 = x_6.x_GLF_uniform_float_values.arr[0].el; + f0 = x_34; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[0].el; + f1 = x_36; + int const x_38 = x_10.x_GLF_uniform_int_values.arr[1].el; + i = x_38; + while (true) { + int const x_43 = i; + int const x_45 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_43 < x_45)) { + } else { + break; + } + float const x_48 = f0; + f0 = fabs((1.100000024f * x_48)); + float const x_51 = f0; + f1 = x_51; + { + int const x_52 = i; + i = (x_52 + 1); + } + } + float const x_54 = f1; + float const x_56 = x_6.x_GLF_uniform_float_values.arr[1].el; + bool const x_57 = (x_54 > x_56); + x_64_phi = x_57; + if (x_57) { + float const x_60 = f1; + float const x_62 = x_6.x_GLF_uniform_float_values.arr[2].el; + x_63 = (x_60 < x_62); + x_64_phi = x_63; + } + bool const x_64 = x_64_phi; + if (x_64) { + int const x_69 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_72 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_75 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_10.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_69), float(x_72), float(x_75), float(x_78)); + } else { + int const x_82 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_83 = float(x_82); + *(tint_symbol_4) = float4(x_83, x_83, x_83, x_83); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2189bcd001 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.spvasm @@ -0,0 +1,185 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 110 +; Schema: 0 + OpCapability Shader + %59 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f0 "f0" + OpName %f1 "f1" + OpName %i "i" + OpName %x_63 "x_63" + OpName %x_64_phi "x_64_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %33 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%float_1_10000002 = OpConstant %float 1.10000002 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %98 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %f0 = OpVariable %_ptr_Function_float Function %25 + %f1 = OpVariable %_ptr_Function_float Function %25 + %i = OpVariable %_ptr_Function_int Function %29 + %x_63 = OpVariable %_ptr_Function_bool Function %33 + %x_64_phi = OpVariable %_ptr_Function_bool Function %33 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %39 = OpLoad %float %38 + OpStore %f0 %39 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %41 = OpLoad %float %40 + OpStore %f1 %41 + %44 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %45 = OpLoad %int %44 + OpStore %i %45 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %49 + %49 = OpLabel + %50 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpSLessThan %bool %50 %52 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + OpBranch %54 + %56 = OpLabel + OpBranch %47 + %54 = OpLabel + %57 = OpLoad %float %f0 + %61 = OpFMul %float %float_1_10000002 %57 + %58 = OpExtInst %float %59 FAbs %61 + OpStore %f0 %58 + %62 = OpLoad %float %f0 + OpStore %f1 %62 + OpBranch %48 + %48 = OpLabel + %63 = OpLoad %int %i + %64 = OpIAdd %int %63 %int_1 + OpStore %i %64 + OpBranch %46 + %47 = OpLabel + %65 = OpLoad %float %f1 + %66 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %67 = OpLoad %float %66 + %68 = OpFOrdGreaterThan %bool %65 %67 + OpStore %x_64_phi %68 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + %71 = OpLoad %float %f1 + %73 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %74 = OpLoad %float %73 + %75 = OpFOrdLessThan %bool %71 %74 + OpStore %x_63 %75 + %76 = OpLoad %bool %x_63 + OpStore %x_64_phi %76 + OpBranch %69 + %69 = OpLabel + %77 = OpLoad %bool %x_64_phi + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %82 + %90 = OpConvertSToF %float %84 + %91 = OpConvertSToF %float %86 + %92 = OpConvertSToF %float %88 + %93 = OpCompositeConstruct %v4float %89 %90 %91 %92 + OpStore %x_GLF_color %93 + OpBranch %78 + %80 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpCompositeConstruct %v4float %96 %96 %96 %96 + OpStore %x_GLF_color %97 + OpBranch %78 + %78 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %98 +%tint_symbol = OpFunctionParameter %main_out + %102 = OpLabel + %103 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %103 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %105 = OpLabel + %106 = OpFunctionCall %void %main_1 + %108 = OpLoad %v4float %x_GLF_color + %109 = OpCompositeConstruct %main_out %108 + %107 = OpFunctionCall %void %tint_symbol_2 %109 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..0fc19145e9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-float-in-loop-abs/0-opt.wgsl.expected.wgsl @@ -0,0 +1,84 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f0 : f32; + var f1 : f32; + var i : i32; + var x_63 : bool; + var x_64_phi : bool; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[0]; + f0 = x_34; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + f1 = x_36; + let x_38 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_38; + loop { + let x_43 : i32 = i; + let x_45 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_43 < x_45)) { + } else { + break; + } + let x_48 : f32 = f0; + f0 = abs((1.100000024 * x_48)); + let x_51 : f32 = f0; + f1 = x_51; + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_54 : f32 = f1; + let x_56 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_57 : bool = (x_54 > x_56); + x_64_phi = x_57; + if (x_57) { + let x_60 : f32 = f1; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_63 = (x_60 < x_62); + x_64_phi = x_63; + } + let x_64 : bool = x_64_phi; + if (x_64) { + let x_69 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_72 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_75 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_10.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_69), f32(x_72), f32(x_75), f32(x_78)); + } else { + let x_82 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_83 : f32 = f32(x_82); + x_GLF_color = vec4(x_83, x_83, x_83, x_83); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm new file mode 100644 index 0000000000..cd158812de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm @@ -0,0 +1,124 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %func_ "func(" + OpName %_GLF_global_loop_count "_GLF_global_loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int +%_GLF_global_loop_count = OpVariable %_ptr_Private_int Private + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %int_10 = OpConstant %int 10 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %26 = OpLabel + OpStore %_GLF_global_loop_count %int_0 + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %_GLF_global_loop_count + %29 = OpSLessThan %bool %28 %int_10 + OpLoopMerge %30 %31 None + OpBranchConditional %29 %31 %30 + %31 = OpLabel + %32 = OpLoad %int %_GLF_global_loop_count + %33 = OpIAdd %int %32 %int_1 + OpStore %_GLF_global_loop_count %33 + %34 = OpFunctionCall %void %func_ + OpBranch %27 + %30 = OpLabel + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %_GLF_global_loop_count + %37 = OpSLessThan %bool %36 %int_10 + OpLoopMerge %38 %39 None + OpBranchConditional %37 %39 %38 + %39 = OpLabel + %40 = OpLoad %int %_GLF_global_loop_count + %41 = OpIAdd %int %40 %int_1 + OpStore %_GLF_global_loop_count %41 + OpBranch %35 + %38 = OpLabel + %42 = OpLoad %int %_GLF_global_loop_count + %43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %44 = OpLoad %int %43 + %45 = OpIEqual %bool %42 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpCompositeConstruct %v4float %51 %54 %54 %51 + OpStore %_GLF_color %55 + OpBranch %46 + %48 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpCompositeConstruct %v4float %58 %58 %58 %58 + OpStore %_GLF_color %59 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %void None %10 + %60 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %64 = OpLoad %int %63 + OpBranch %65 + %65 = OpLabel + %66 = OpPhi %int %64 %60 %67 %68 + %69 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %70 = OpLoad %int %69 + %71 = OpSLessThan %bool %66 %70 + OpLoopMerge %72 %68 None + OpBranchConditional %71 %68 %72 + %68 = OpLabel + %73 = OpLoad %int %_GLF_global_loop_count + %74 = OpIAdd %int %73 %int_1 + OpStore %_GLF_global_loop_count %74 + %67 = OpIAdd %int %66 %int_1 + OpBranch %65 + %72 = OpLabel + %75 = OpSLessThan %bool %62 %62 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %76 + %77 = OpLabel + OpReturn + %76 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..e89c902e2a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.hlsl @@ -0,0 +1,79 @@ +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_() { + int x_66_phi = 0; + const int x_62 = asint(x_7[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_64 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + x_66_phi = x_64; + while (true) { + int x_67 = 0; + const int x_66 = x_66_phi; + const int x_70 = asint(x_7[3].x); + if ((x_66 < x_70)) { + } else { + break; + } + { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + x_67 = (x_66 + 1); + x_66_phi = x_67; + } + } + if ((x_62 < x_62)) { + return; + } + return; +} + +void main_1() { + x_GLF_global_loop_count = 0; + while (true) { + if ((x_GLF_global_loop_count < 10)) { + } else { + break; + } + { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + func_(); + } + } + { + for(; (x_GLF_global_loop_count < 10); x_GLF_global_loop_count = (x_GLF_global_loop_count + 1)) { + } + } + const int x_42 = x_GLF_global_loop_count; + const int x_44 = asint(x_7[2].x); + if ((x_42 == x_44)) { + const int x_50 = asint(x_7[1].x); + const float x_51 = float(x_50); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_54 = float(x_53); + x_GLF_color = float4(x_51, x_54, x_54, x_51); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_58 = float(x_57); + x_GLF_color = float4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..9a18e812db --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.msl @@ -0,0 +1,96 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_(constant buf0& x_7, thread int* const tint_symbol_4) { + int x_66_phi = 0; + int const x_62 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_7.x_GLF_uniform_int_values.arr[0].el; + x_66_phi = x_64; + while (true) { + int x_67 = 0; + int const x_66 = x_66_phi; + int const x_70 = x_7.x_GLF_uniform_int_values.arr[3].el; + if ((x_66 < x_70)) { + } else { + break; + } + { + int const x_73 = *(tint_symbol_4); + *(tint_symbol_4) = (x_73 + 1); + x_67 = (x_66 + 1); + x_66_phi = x_67; + } + } + if ((x_62 < x_62)) { + return; + } + return; +} + +void main_1(constant buf0& x_7, thread int* const tint_symbol_5, thread float4* const tint_symbol_6) { + *(tint_symbol_5) = 0; + while (true) { + int const x_28 = *(tint_symbol_5); + if ((x_28 < 10)) { + } else { + break; + } + { + int const x_32 = *(tint_symbol_5); + *(tint_symbol_5) = (x_32 + 1); + func_(x_7, tint_symbol_5); + } + } + while (true) { + int const x_36 = *(tint_symbol_5); + if ((x_36 < 10)) { + } else { + break; + } + { + int const x_40 = *(tint_symbol_5); + *(tint_symbol_5) = (x_40 + 1); + } + } + int const x_42 = *(tint_symbol_5); + int const x_44 = x_7.x_GLF_uniform_int_values.arr[2].el; + if ((x_42 == x_44)) { + int const x_50 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_51 = float(x_50); + int const x_53 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_54 = float(x_53); + *(tint_symbol_6) = float4(x_51, x_54, x_54, x_51); + } else { + int const x_57 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_58 = float(x_57); + *(tint_symbol_6) = float4(x_58, x_58, x_58, x_58); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread int tint_symbol_7 = 0; + thread float4 tint_symbol_8 = 0.0f; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..209a878b45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.spvasm @@ -0,0 +1,193 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 110 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %x_66_phi "x_66_phi" + OpName %x_67 "x_67" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %15 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %15 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %int_10 = OpConstant %int 10 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %98 = OpTypeFunction %void %main_out + %func_ = OpFunction %void None %18 + %21 = OpLabel + %x_66_phi = OpVariable %_ptr_Function_int Function %4 + %x_67 = OpVariable %_ptr_Function_int Function %4 + %27 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %28 = OpLoad %int %27 + %30 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %31 = OpLoad %int %30 + OpStore %x_66_phi %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %37 = OpLoad %int %x_66_phi + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_3 + %40 = OpLoad %int %39 + %41 = OpSLessThan %bool %37 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %33 + %43 = OpLabel + OpBranch %34 + %34 = OpLabel + %46 = OpLoad %int %x_GLF_global_loop_count + %47 = OpIAdd %int %46 %int_1 + OpStore %x_GLF_global_loop_count %47 + %48 = OpIAdd %int %37 %int_1 + OpStore %x_67 %48 + %49 = OpLoad %int %x_67 + OpStore %x_66_phi %49 + OpBranch %32 + %33 = OpLabel + %50 = OpSLessThan %bool %28 %28 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + OpReturn + %51 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %18 + %54 = OpLabel + OpStore %x_GLF_global_loop_count %int_0 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %int %x_GLF_global_loop_count + %61 = OpSLessThan %bool %59 %int_10 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %64 + %63 = OpLabel + OpBranch %62 + %64 = OpLabel + OpBranch %56 + %62 = OpLabel + OpBranch %57 + %57 = OpLabel + %65 = OpLoad %int %x_GLF_global_loop_count + %66 = OpIAdd %int %65 %int_1 + OpStore %x_GLF_global_loop_count %66 + %67 = OpFunctionCall %void %func_ + OpBranch %55 + %56 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %72 = OpLoad %int %x_GLF_global_loop_count + %73 = OpSLessThan %bool %72 %int_10 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %74 + %76 = OpLabel + OpBranch %69 + %74 = OpLabel + OpBranch %70 + %70 = OpLabel + %77 = OpLoad %int %x_GLF_global_loop_count + %78 = OpIAdd %int %77 %int_1 + OpStore %x_GLF_global_loop_count %78 + OpBranch %68 + %69 = OpLabel + %79 = OpLoad %int %x_GLF_global_loop_count + %81 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %82 = OpLoad %int %81 + %83 = OpIEqual %bool %79 %82 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %88 + %90 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %91 + %93 = OpCompositeConstruct %v4float %89 %92 %92 %89 + OpStore %x_GLF_color %93 + OpBranch %84 + %86 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpCompositeConstruct %v4float %96 %96 %96 %96 + OpStore %x_GLF_color %97 + OpBranch %84 + %84 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %98 +%tint_symbol = OpFunctionParameter %main_out + %102 = OpLabel + %103 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %103 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %105 = OpLabel + %106 = OpFunctionCall %void %main_1 + %108 = OpLoad %v4float %x_GLF_color + %109 = OpCompositeConstruct %main_out %108 + %107 = OpFunctionCall %void %tint_symbol_2 %109 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..bb1a4df67d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.spvasm.expected.wgsl @@ -0,0 +1,93 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() { + var x_66_phi : i32; + let x_62 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_66_phi = x_64; + loop { + var x_67 : i32; + let x_66 : i32 = x_66_phi; + let x_70 : i32 = x_7.x_GLF_uniform_int_values[3]; + if ((x_66 < x_70)) { + } else { + break; + } + + continuing { + let x_73 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_73 + 1); + x_67 = (x_66 + 1); + x_66_phi = x_67; + } + } + if ((x_62 < x_62)) { + return; + } + return; +} + +fn main_1() { + x_GLF_global_loop_count = 0; + loop { + let x_28 : i32 = x_GLF_global_loop_count; + if ((x_28 < 10)) { + } else { + break; + } + + continuing { + let x_32 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_32 + 1); + func_(); + } + } + loop { + let x_36 : i32 = x_GLF_global_loop_count; + if ((x_36 < 10)) { + } else { + break; + } + + continuing { + let x_40 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_40 + 1); + } + } + let x_42 : i32 = x_GLF_global_loop_count; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_42 == x_44)) { + let x_50 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_51 : f32 = f32(x_50); + let x_53 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_54 : f32 = f32(x_53); + x_GLF_color = vec4(x_51, x_54, x_54, x_51); + } else { + let x_57 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl new file mode 100644 index 0000000000..bb1a4df67d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl @@ -0,0 +1,93 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() { + var x_66_phi : i32; + let x_62 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_66_phi = x_64; + loop { + var x_67 : i32; + let x_66 : i32 = x_66_phi; + let x_70 : i32 = x_7.x_GLF_uniform_int_values[3]; + if ((x_66 < x_70)) { + } else { + break; + } + + continuing { + let x_73 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_73 + 1); + x_67 = (x_66 + 1); + x_66_phi = x_67; + } + } + if ((x_62 < x_62)) { + return; + } + return; +} + +fn main_1() { + x_GLF_global_loop_count = 0; + loop { + let x_28 : i32 = x_GLF_global_loop_count; + if ((x_28 < 10)) { + } else { + break; + } + + continuing { + let x_32 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_32 + 1); + func_(); + } + } + loop { + let x_36 : i32 = x_GLF_global_loop_count; + if ((x_36 < 10)) { + } else { + break; + } + + continuing { + let x_40 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_40 + 1); + } + } + let x_42 : i32 = x_GLF_global_loop_count; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_42 == x_44)) { + let x_50 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_51 : f32 = f32(x_50); + let x_53 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_54 : f32 = f32(x_53); + x_GLF_color = vec4(x_51, x_54, x_54, x_51); + } else { + let x_57 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..e89c902e2a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.hlsl @@ -0,0 +1,79 @@ +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_() { + int x_66_phi = 0; + const int x_62 = asint(x_7[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_64 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + x_66_phi = x_64; + while (true) { + int x_67 = 0; + const int x_66 = x_66_phi; + const int x_70 = asint(x_7[3].x); + if ((x_66 < x_70)) { + } else { + break; + } + { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + x_67 = (x_66 + 1); + x_66_phi = x_67; + } + } + if ((x_62 < x_62)) { + return; + } + return; +} + +void main_1() { + x_GLF_global_loop_count = 0; + while (true) { + if ((x_GLF_global_loop_count < 10)) { + } else { + break; + } + { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + func_(); + } + } + { + for(; (x_GLF_global_loop_count < 10); x_GLF_global_loop_count = (x_GLF_global_loop_count + 1)) { + } + } + const int x_42 = x_GLF_global_loop_count; + const int x_44 = asint(x_7[2].x); + if ((x_42 == x_44)) { + const int x_50 = asint(x_7[1].x); + const float x_51 = float(x_50); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_54 = float(x_53); + x_GLF_color = float4(x_51, x_54, x_54, x_51); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_58 = float(x_57); + x_GLF_color = float4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..9a18e812db --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.msl @@ -0,0 +1,96 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_(constant buf0& x_7, thread int* const tint_symbol_4) { + int x_66_phi = 0; + int const x_62 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_7.x_GLF_uniform_int_values.arr[0].el; + x_66_phi = x_64; + while (true) { + int x_67 = 0; + int const x_66 = x_66_phi; + int const x_70 = x_7.x_GLF_uniform_int_values.arr[3].el; + if ((x_66 < x_70)) { + } else { + break; + } + { + int const x_73 = *(tint_symbol_4); + *(tint_symbol_4) = (x_73 + 1); + x_67 = (x_66 + 1); + x_66_phi = x_67; + } + } + if ((x_62 < x_62)) { + return; + } + return; +} + +void main_1(constant buf0& x_7, thread int* const tint_symbol_5, thread float4* const tint_symbol_6) { + *(tint_symbol_5) = 0; + while (true) { + int const x_28 = *(tint_symbol_5); + if ((x_28 < 10)) { + } else { + break; + } + { + int const x_32 = *(tint_symbol_5); + *(tint_symbol_5) = (x_32 + 1); + func_(x_7, tint_symbol_5); + } + } + while (true) { + int const x_36 = *(tint_symbol_5); + if ((x_36 < 10)) { + } else { + break; + } + { + int const x_40 = *(tint_symbol_5); + *(tint_symbol_5) = (x_40 + 1); + } + } + int const x_42 = *(tint_symbol_5); + int const x_44 = x_7.x_GLF_uniform_int_values.arr[2].el; + if ((x_42 == x_44)) { + int const x_50 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_51 = float(x_50); + int const x_53 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_54 = float(x_53); + *(tint_symbol_6) = float4(x_51, x_54, x_54, x_51); + } else { + int const x_57 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_58 = float(x_57); + *(tint_symbol_6) = float4(x_58, x_58, x_58, x_58); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread int tint_symbol_7 = 0; + thread float4 tint_symbol_8 = 0.0f; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..209a878b45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.spvasm @@ -0,0 +1,193 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 110 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %x_66_phi "x_66_phi" + OpName %x_67 "x_67" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %15 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %15 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %int_10 = OpConstant %int 10 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %98 = OpTypeFunction %void %main_out + %func_ = OpFunction %void None %18 + %21 = OpLabel + %x_66_phi = OpVariable %_ptr_Function_int Function %4 + %x_67 = OpVariable %_ptr_Function_int Function %4 + %27 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %28 = OpLoad %int %27 + %30 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %31 = OpLoad %int %30 + OpStore %x_66_phi %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %37 = OpLoad %int %x_66_phi + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_3 + %40 = OpLoad %int %39 + %41 = OpSLessThan %bool %37 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %33 + %43 = OpLabel + OpBranch %34 + %34 = OpLabel + %46 = OpLoad %int %x_GLF_global_loop_count + %47 = OpIAdd %int %46 %int_1 + OpStore %x_GLF_global_loop_count %47 + %48 = OpIAdd %int %37 %int_1 + OpStore %x_67 %48 + %49 = OpLoad %int %x_67 + OpStore %x_66_phi %49 + OpBranch %32 + %33 = OpLabel + %50 = OpSLessThan %bool %28 %28 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + OpReturn + %51 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %18 + %54 = OpLabel + OpStore %x_GLF_global_loop_count %int_0 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %int %x_GLF_global_loop_count + %61 = OpSLessThan %bool %59 %int_10 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %64 + %63 = OpLabel + OpBranch %62 + %64 = OpLabel + OpBranch %56 + %62 = OpLabel + OpBranch %57 + %57 = OpLabel + %65 = OpLoad %int %x_GLF_global_loop_count + %66 = OpIAdd %int %65 %int_1 + OpStore %x_GLF_global_loop_count %66 + %67 = OpFunctionCall %void %func_ + OpBranch %55 + %56 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %72 = OpLoad %int %x_GLF_global_loop_count + %73 = OpSLessThan %bool %72 %int_10 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %74 + %76 = OpLabel + OpBranch %69 + %74 = OpLabel + OpBranch %70 + %70 = OpLabel + %77 = OpLoad %int %x_GLF_global_loop_count + %78 = OpIAdd %int %77 %int_1 + OpStore %x_GLF_global_loop_count %78 + OpBranch %68 + %69 = OpLabel + %79 = OpLoad %int %x_GLF_global_loop_count + %81 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %82 = OpLoad %int %81 + %83 = OpIEqual %bool %79 %82 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %88 + %90 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %91 + %93 = OpCompositeConstruct %v4float %89 %92 %92 %89 + OpStore %x_GLF_color %93 + OpBranch %84 + %86 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpCompositeConstruct %v4float %96 %96 %96 %96 + OpStore %x_GLF_color %97 + OpBranch %84 + %84 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %98 +%tint_symbol = OpFunctionParameter %main_out + %102 = OpLabel + %103 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %103 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %105 = OpLabel + %106 = OpFunctionCall %void %main_1 + %108 = OpLoad %v4float %x_GLF_color + %109 = OpCompositeConstruct %main_out %108 + %107 = OpFunctionCall %void %tint_symbol_2 %109 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..bb1a4df67d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-global-counter-loop-function/0-opt.wgsl.expected.wgsl @@ -0,0 +1,93 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() { + var x_66_phi : i32; + let x_62 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_66_phi = x_64; + loop { + var x_67 : i32; + let x_66 : i32 = x_66_phi; + let x_70 : i32 = x_7.x_GLF_uniform_int_values[3]; + if ((x_66 < x_70)) { + } else { + break; + } + + continuing { + let x_73 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_73 + 1); + x_67 = (x_66 + 1); + x_66_phi = x_67; + } + } + if ((x_62 < x_62)) { + return; + } + return; +} + +fn main_1() { + x_GLF_global_loop_count = 0; + loop { + let x_28 : i32 = x_GLF_global_loop_count; + if ((x_28 < 10)) { + } else { + break; + } + + continuing { + let x_32 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_32 + 1); + func_(); + } + } + loop { + let x_36 : i32 = x_GLF_global_loop_count; + if ((x_36 < 10)) { + } else { + break; + } + + continuing { + let x_40 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_40 + 1); + } + } + let x_42 : i32 = x_GLF_global_loop_count; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_42 == x_44)) { + let x_50 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_51 : f32 = f32(x_50); + let x_53 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_54 : f32 = f32(x_53); + x_GLF_color = vec4(x_51, x_54, x_54, x_51); + } else { + let x_57 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm new file mode 100644 index 0000000000..52dd4a24d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm @@ -0,0 +1,96 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %29 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_0 + %int_4 = OpConstant %int 4 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %32 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %10 + %33 = OpLabel + %a = OpVariable %_ptr_Function__arr_int_uint_3 Function + %b = OpVariable %_ptr_Function_int Function + %c = OpVariable %_ptr_Function_int Function + %34 = OpAccessChain %_ptr_Function_int %a %int_0 + OpStore %34 %int_1 + %35 = OpAccessChain %_ptr_Function_int %a %int_1 + OpStore %35 %int_2 + %36 = OpAccessChain %_ptr_Function_int %a %int_2 + OpStore %36 %int_3 + OpStore %b %int_0 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %38 = OpLoad %int %37 + %39 = OpAccessChain %_ptr_Function_int %a %38 + %40 = OpLoad %int %39 + OpStore %c %40 + %41 = OpLoad %int %c + %42 = OpSGreaterThan %bool %41 %int_1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpStore %_GLF_color %29 + %45 = OpLoad %int %b + %46 = OpIAdd %int %45 %int_1 + OpStore %b %46 + OpBranch %43 + %43 = OpLabel + %47 = OpLoad %int %b + %48 = OpIAdd %int %47 %int_1 + OpStore %b %48 + %49 = OpExtInst %int %1 SClamp %48 %int_0 %int_2 + %50 = OpAccessChain %_ptr_Function_int %a %49 + %51 = OpLoad %int %50 + %52 = OpIAdd %int %51 %int_1 + OpStore %50 %52 + %53 = OpAccessChain %_ptr_Function_int %a %int_2 + %54 = OpLoad %int %53 + %55 = OpIEqual %bool %54 %int_4 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpStore %_GLF_color %31 + OpBranch %56 + %58 = OpLabel + OpStore %_GLF_color %32 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..a84f052a45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,47 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a[3] = (int[3])0; + int b = 0; + int c = 0; + a[0] = 1; + a[1] = 2; + a[2] = 3; + b = 0; + const int x_38 = asint(x_8[0].x); + const int x_40 = a[x_38]; + c = x_40; + if ((c > 1)) { + x_GLF_color = float4(0.0f, 1.0f, 1.0f, 0.0f); + b = (b + 1); + } + const int x_48 = (b + 1); + b = x_48; + const int x_50_save = clamp(x_48, 0, 2); + const int x_51 = a[x_50_save]; + a[x_50_save] = (x_51 + 1); + const int x_54 = a[2]; + if ((x_54 == 4)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..231e58aa32 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.msl @@ -0,0 +1,56 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct tint_array_wrapper { + int arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + tint_array_wrapper a = {}; + int b = 0; + int c = 0; + a.arr[0] = 1; + a.arr[1] = 2; + a.arr[2] = 3; + b = 0; + int const x_38 = x_8.one; + int const x_40 = a.arr[x_38]; + c = x_40; + int const x_41 = c; + if ((x_41 > 1)) { + *(tint_symbol_4) = float4(0.0f, 1.0f, 1.0f, 0.0f); + int const x_45 = b; + b = (x_45 + 1); + } + int const x_47 = b; + int const x_48 = (x_47 + 1); + b = x_48; + int const x_50_save = clamp(x_48, 0, 2); + int const x_51 = a.arr[x_50_save]; + a.arr[x_50_save] = (x_51 + 1); + int const x_54 = a.arr[2]; + if ((x_54 == 4)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..413b393b19 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,133 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + %52 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 + %21 = OpConstantNull %_arr_int_uint_3 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %46 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_0 + %int_4 = OpConstant %int 4 + %64 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %65 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %66 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function__arr_int_uint_3 Function %21 + %b = OpVariable %_ptr_Function_int Function %24 + %c = OpVariable %_ptr_Function_int Function %24 + %27 = OpAccessChain %_ptr_Function_int %a %int_0 + OpStore %27 %int_1 + %29 = OpAccessChain %_ptr_Function_int %a %int_1 + OpStore %29 %int_2 + %31 = OpAccessChain %_ptr_Function_int %a %int_2 + OpStore %31 %int_3 + OpStore %b %int_0 + %35 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %36 = OpLoad %int %35 + %37 = OpAccessChain %_ptr_Function_int %a %36 + %38 = OpLoad %int %37 + OpStore %c %38 + %39 = OpLoad %int %c + %40 = OpSGreaterThan %bool %39 %int_1 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %42 + %43 = OpLabel + OpStore %x_GLF_color %46 + %47 = OpLoad %int %b + %48 = OpIAdd %int %47 %int_1 + OpStore %b %48 + OpBranch %42 + %42 = OpLabel + %49 = OpLoad %int %b + %50 = OpIAdd %int %49 %int_1 + OpStore %b %50 + %51 = OpExtInst %int %52 SClamp %50 %int_0 %int_2 + %53 = OpAccessChain %_ptr_Function_int %a %51 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Function_int %a %51 + %56 = OpIAdd %int %54 %int_1 + OpStore %55 %56 + %57 = OpAccessChain %_ptr_Function_int %a %int_2 + %58 = OpLoad %int %57 + %60 = OpIEqual %bool %58 %int_4 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpStore %x_GLF_color %64 + OpBranch %61 + %63 = OpLabel + OpStore %x_GLF_color %65 + OpBranch %61 + %61 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %66 +%tint_symbol = OpFunctionParameter %main_out + %70 = OpLabel + %71 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %71 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %73 = OpLabel + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_2 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f70aa97537 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,51 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : array; + var b : i32; + var c : i32; + a[0] = 1; + a[1] = 2; + a[2] = 3; + b = 0; + let x_38 : i32 = x_8.one; + let x_40 : i32 = a[x_38]; + c = x_40; + let x_41 : i32 = c; + if ((x_41 > 1)) { + x_GLF_color = vec4(0.0, 1.0, 1.0, 0.0); + let x_45 : i32 = b; + b = (x_45 + 1); + } + let x_47 : i32 = b; + let x_48 : i32 = (x_47 + 1); + b = x_48; + let x_50 : ptr = &(a[clamp(x_48, 0, 2)]); + let x_51 : i32 = *(x_50); + *(x_50) = (x_51 + 1); + let x_54 : i32 = a[2]; + if ((x_54 == 4)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl new file mode 100644 index 0000000000..f70aa97537 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl @@ -0,0 +1,51 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : array; + var b : i32; + var c : i32; + a[0] = 1; + a[1] = 2; + a[2] = 3; + b = 0; + let x_38 : i32 = x_8.one; + let x_40 : i32 = a[x_38]; + c = x_40; + let x_41 : i32 = c; + if ((x_41 > 1)) { + x_GLF_color = vec4(0.0, 1.0, 1.0, 0.0); + let x_45 : i32 = b; + b = (x_45 + 1); + } + let x_47 : i32 = b; + let x_48 : i32 = (x_47 + 1); + b = x_48; + let x_50 : ptr = &(a[clamp(x_48, 0, 2)]); + let x_51 : i32 = *(x_50); + *(x_50) = (x_51 + 1); + let x_54 : i32 = a[2]; + if ((x_54 == 4)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..a84f052a45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,47 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a[3] = (int[3])0; + int b = 0; + int c = 0; + a[0] = 1; + a[1] = 2; + a[2] = 3; + b = 0; + const int x_38 = asint(x_8[0].x); + const int x_40 = a[x_38]; + c = x_40; + if ((c > 1)) { + x_GLF_color = float4(0.0f, 1.0f, 1.0f, 0.0f); + b = (b + 1); + } + const int x_48 = (b + 1); + b = x_48; + const int x_50_save = clamp(x_48, 0, 2); + const int x_51 = a[x_50_save]; + a[x_50_save] = (x_51 + 1); + const int x_54 = a[2]; + if ((x_54 == 4)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..231e58aa32 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.msl @@ -0,0 +1,56 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct tint_array_wrapper { + int arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + tint_array_wrapper a = {}; + int b = 0; + int c = 0; + a.arr[0] = 1; + a.arr[1] = 2; + a.arr[2] = 3; + b = 0; + int const x_38 = x_8.one; + int const x_40 = a.arr[x_38]; + c = x_40; + int const x_41 = c; + if ((x_41 > 1)) { + *(tint_symbol_4) = float4(0.0f, 1.0f, 1.0f, 0.0f); + int const x_45 = b; + b = (x_45 + 1); + } + int const x_47 = b; + int const x_48 = (x_47 + 1); + b = x_48; + int const x_50_save = clamp(x_48, 0, 2); + int const x_51 = a.arr[x_50_save]; + a.arr[x_50_save] = (x_51 + 1); + int const x_54 = a.arr[2]; + if ((x_54 == 4)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..413b393b19 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,133 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + %52 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 + %21 = OpConstantNull %_arr_int_uint_3 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %46 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_0 + %int_4 = OpConstant %int 4 + %64 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %65 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %66 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function__arr_int_uint_3 Function %21 + %b = OpVariable %_ptr_Function_int Function %24 + %c = OpVariable %_ptr_Function_int Function %24 + %27 = OpAccessChain %_ptr_Function_int %a %int_0 + OpStore %27 %int_1 + %29 = OpAccessChain %_ptr_Function_int %a %int_1 + OpStore %29 %int_2 + %31 = OpAccessChain %_ptr_Function_int %a %int_2 + OpStore %31 %int_3 + OpStore %b %int_0 + %35 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %36 = OpLoad %int %35 + %37 = OpAccessChain %_ptr_Function_int %a %36 + %38 = OpLoad %int %37 + OpStore %c %38 + %39 = OpLoad %int %c + %40 = OpSGreaterThan %bool %39 %int_1 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %42 + %43 = OpLabel + OpStore %x_GLF_color %46 + %47 = OpLoad %int %b + %48 = OpIAdd %int %47 %int_1 + OpStore %b %48 + OpBranch %42 + %42 = OpLabel + %49 = OpLoad %int %b + %50 = OpIAdd %int %49 %int_1 + OpStore %b %50 + %51 = OpExtInst %int %52 SClamp %50 %int_0 %int_2 + %53 = OpAccessChain %_ptr_Function_int %a %51 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Function_int %a %51 + %56 = OpIAdd %int %54 %int_1 + OpStore %55 %56 + %57 = OpAccessChain %_ptr_Function_int %a %int_2 + %58 = OpLoad %int %57 + %60 = OpIEqual %bool %58 %int_4 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpStore %x_GLF_color %64 + OpBranch %61 + %63 = OpLabel + OpStore %x_GLF_color %65 + OpBranch %61 + %61 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %66 +%tint_symbol = OpFunctionParameter %main_out + %70 = OpLabel + %71 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %71 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %73 = OpLabel + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_2 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f70aa97537 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-inside-clamp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,51 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : array; + var b : i32; + var c : i32; + a[0] = 1; + a[1] = 2; + a[2] = 3; + b = 0; + let x_38 : i32 = x_8.one; + let x_40 : i32 = a[x_38]; + c = x_40; + let x_41 : i32 = c; + if ((x_41 > 1)) { + x_GLF_color = vec4(0.0, 1.0, 1.0, 0.0); + let x_45 : i32 = b; + b = (x_45 + 1); + } + let x_47 : i32 = b; + let x_48 : i32 = (x_47 + 1); + b = x_48; + let x_50 : ptr = &(a[clamp(x_48, 0, 2)]); + let x_51 : i32 = *(x_50); + *(x_50) = (x_51 + 1); + let x_54 : i32 = a[2]; + if ((x_54 == 4)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm new file mode 100644 index 0000000000..6d83d1d785 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm @@ -0,0 +1,121 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %indexable "indexable" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %uint_9 = OpConstant %uint 9 +%_arr_int_uint_9 = OpTypeArray %int %uint_9 + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %31 = OpConstantComposite %_arr_int_uint_9 %int_1 %int_2 %int_3 %int_4 %int_5 %int_6 %int_7 %int_8 %int_9 +%_ptr_Function__arr_int_uint_9 = OpTypePointer Function %_arr_int_uint_9 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %11 + %36 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %indexable = OpVariable %_ptr_Function__arr_int_uint_9 Function + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %38 = OpLoad %int %37 + OpStore %a %38 + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %40 = OpLoad %int %39 + OpStore %i %40 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %int %i + %46 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpSLessThan %bool %45 %47 + OpBranchConditional %48 %49 %42 + %49 = OpLabel + %50 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %52 = OpLoad %int %51 + %53 = OpSMod %int %50 %52 + OpStore %indexable %31 + %54 = OpAccessChain %_ptr_Function_int %indexable %53 + %55 = OpLoad %int %54 + %56 = OpLoad %int %a + %57 = OpIAdd %int %56 %55 + OpStore %a %57 + OpBranch %43 + %43 = OpLabel + %58 = OpLoad %int %i + %59 = OpIAdd %int %58 %int_1 + OpStore %i %59 + OpBranch %41 + %42 = OpLabel + %60 = OpLoad %int %a + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpIEqual %bool %60 %62 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %66 + %65 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %68 + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %71 + %73 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpCompositeConstruct %v4float %69 %72 %75 %78 + OpStore %_GLF_color %79 + OpBranch %64 + %66 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %81 + %83 = OpCompositeConstruct %v4float %82 %82 %82 %82 + OpStore %_GLF_color %83 + OpBranch %64 + %64 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..7e2ef37dbc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.hlsl @@ -0,0 +1,60 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + int indexable[9] = (int[9])0; + const int x_38 = asint(x_6[2].x); + a = x_38; + const int x_40 = asint(x_6[3].x); + i = x_40; + while (true) { + const int x_45 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_47 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_45 < x_47)) { + } else { + break; + } + const int x_50 = i; + const int x_52 = asint(x_6[4].x); + const int tint_symbol_3[9] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; + indexable = tint_symbol_3; + const int x_55 = indexable[(x_50 % x_52)]; + a = (a + x_55); + { + i = (i + 1); + } + } + const int x_60 = a; + const int x_62 = asint(x_6[1].x); + if ((x_60 == x_62)) { + const int x_68 = asint(x_6[2].x); + const int x_71 = asint(x_6[3].x); + const int x_74 = asint(x_6[3].x); + const int x_77 = asint(x_6[2].x); + x_GLF_color = float4(float(x_68), float(x_71), float(x_74), float(x_77)); + } else { + const int x_81 = asint(x_6[3].x); + const float x_82 = float(x_81); + x_GLF_color = float4(x_82, x_82, x_82, x_82); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..8671edc22b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5) { + int a = 0; + int i = 0; + tint_array_wrapper_1 indexable = {}; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[2].el; + a = x_38; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[3].el; + i = x_40; + while (true) { + int const x_45 = i; + int const x_47 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_45 < x_47)) { + } else { + break; + } + int const x_50 = i; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[4].el; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={1, 2, 3, 4, 5, 6, 7, 8, 9}}; + indexable = tint_symbol_3; + int const x_55 = indexable.arr[(x_50 % x_52)]; + int const x_56 = a; + a = (x_56 + x_55); + { + int const x_58 = i; + i = (x_58 + 1); + } + } + int const x_60 = a; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_60 == x_62)) { + int const x_68 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_71 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_74 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_77 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_5) = float4(float(x_68), float(x_71), float(x_74), float(x_77)); + } else { + int const x_81 = x_6.x_GLF_uniform_int_values.arr[3].el; + float const x_82 = float(x_81); + *(tint_symbol_5) = float4(x_82, x_82, x_82, x_82); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..761bab9bae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.spvasm @@ -0,0 +1,161 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 103 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_9 = OpConstant %uint 9 +%_arr_int_uint_9 = OpTypeArray %int %uint_9 +%_ptr_Function__arr_int_uint_9 = OpTypePointer Function %_arr_int_uint_9 + %27 = OpConstantNull %_arr_int_uint_9 + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %59 = OpConstantComposite %_arr_int_uint_9 %int_1 %int_2 %int_3 %int_4 %int_5 %int_6 %int_7 %int_8 %int_9 + %main_out = OpTypeStruct %v4float + %91 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %indexable = OpVariable %_ptr_Function__arr_int_uint_9 Function %27 + %31 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %32 = OpLoad %int %31 + OpStore %a %32 + %34 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %35 = OpLoad %int %34 + OpStore %i %35 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpSLessThan %bool %40 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %37 + %46 = OpLabel + %49 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %52 = OpLoad %int %51 + OpStore %indexable %59 + %60 = OpSMod %int %49 %52 + %61 = OpAccessChain %_ptr_Function_int %indexable %60 + %62 = OpLoad %int %61 + %63 = OpLoad %int %a + %64 = OpIAdd %int %63 %62 + OpStore %a %64 + OpBranch %38 + %38 = OpLabel + %65 = OpLoad %int %i + %66 = OpIAdd %int %65 %int_1 + OpStore %i %66 + OpBranch %36 + %37 = OpLabel + %67 = OpLoad %int %a + %68 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpIEqual %bool %67 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %75 + %83 = OpConvertSToF %float %77 + %84 = OpConvertSToF %float %79 + %85 = OpConvertSToF %float %81 + %86 = OpCompositeConstruct %v4float %82 %83 %84 %85 + OpStore %x_GLF_color %86 + OpBranch %71 + %73 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %88 + %90 = OpCompositeConstruct %v4float %89 %89 %89 %89 + OpStore %x_GLF_color %90 + OpBranch %71 + %71 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %91 +%tint_symbol = OpFunctionParameter %main_out + %95 = OpLabel + %96 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %96 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %98 = OpLabel + %99 = OpFunctionCall %void %main_1 + %101 = OpLoad %v4float %x_GLF_color + %102 = OpCompositeConstruct %main_out %101 + %100 = OpFunctionCall %void %tint_symbol_2 %102 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..486246cde2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.spvasm.expected.wgsl @@ -0,0 +1,64 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + var indexable : array; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_38; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[3]; + i = x_40; + loop { + let x_45 : i32 = i; + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_45 < x_47)) { + } else { + break; + } + let x_50 : i32 = i; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[4]; + indexable = array(1, 2, 3, 4, 5, 6, 7, 8, 9); + let x_55 : i32 = indexable[(x_50 % x_52)]; + let x_56 : i32 = a; + a = (x_56 + x_55); + + continuing { + let x_58 : i32 = i; + i = (x_58 + 1); + } + } + let x_60 : i32 = a; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_60 == x_62)) { + let x_68 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_74 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_68), f32(x_71), f32(x_74), f32(x_77)); + } else { + let x_81 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_82 : f32 = f32(x_81); + x_GLF_color = vec4(x_82, x_82, x_82, x_82); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl new file mode 100644 index 0000000000..486246cde2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl @@ -0,0 +1,64 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + var indexable : array; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_38; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[3]; + i = x_40; + loop { + let x_45 : i32 = i; + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_45 < x_47)) { + } else { + break; + } + let x_50 : i32 = i; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[4]; + indexable = array(1, 2, 3, 4, 5, 6, 7, 8, 9); + let x_55 : i32 = indexable[(x_50 % x_52)]; + let x_56 : i32 = a; + a = (x_56 + x_55); + + continuing { + let x_58 : i32 = i; + i = (x_58 + 1); + } + } + let x_60 : i32 = a; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_60 == x_62)) { + let x_68 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_74 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_68), f32(x_71), f32(x_74), f32(x_77)); + } else { + let x_81 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_82 : f32 = f32(x_81); + x_GLF_color = vec4(x_82, x_82, x_82, x_82); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..7e2ef37dbc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.hlsl @@ -0,0 +1,60 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + int indexable[9] = (int[9])0; + const int x_38 = asint(x_6[2].x); + a = x_38; + const int x_40 = asint(x_6[3].x); + i = x_40; + while (true) { + const int x_45 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_47 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_45 < x_47)) { + } else { + break; + } + const int x_50 = i; + const int x_52 = asint(x_6[4].x); + const int tint_symbol_3[9] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; + indexable = tint_symbol_3; + const int x_55 = indexable[(x_50 % x_52)]; + a = (a + x_55); + { + i = (i + 1); + } + } + const int x_60 = a; + const int x_62 = asint(x_6[1].x); + if ((x_60 == x_62)) { + const int x_68 = asint(x_6[2].x); + const int x_71 = asint(x_6[3].x); + const int x_74 = asint(x_6[3].x); + const int x_77 = asint(x_6[2].x); + x_GLF_color = float4(float(x_68), float(x_71), float(x_74), float(x_77)); + } else { + const int x_81 = asint(x_6[3].x); + const float x_82 = float(x_81); + x_GLF_color = float4(x_82, x_82, x_82, x_82); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..8671edc22b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5) { + int a = 0; + int i = 0; + tint_array_wrapper_1 indexable = {}; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[2].el; + a = x_38; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[3].el; + i = x_40; + while (true) { + int const x_45 = i; + int const x_47 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_45 < x_47)) { + } else { + break; + } + int const x_50 = i; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[4].el; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={1, 2, 3, 4, 5, 6, 7, 8, 9}}; + indexable = tint_symbol_3; + int const x_55 = indexable.arr[(x_50 % x_52)]; + int const x_56 = a; + a = (x_56 + x_55); + { + int const x_58 = i; + i = (x_58 + 1); + } + } + int const x_60 = a; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_60 == x_62)) { + int const x_68 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_71 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_74 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_77 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_5) = float4(float(x_68), float(x_71), float(x_74), float(x_77)); + } else { + int const x_81 = x_6.x_GLF_uniform_int_values.arr[3].el; + float const x_82 = float(x_81); + *(tint_symbol_5) = float4(x_82, x_82, x_82, x_82); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..761bab9bae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.spvasm @@ -0,0 +1,161 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 103 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_9 = OpConstant %uint 9 +%_arr_int_uint_9 = OpTypeArray %int %uint_9 +%_ptr_Function__arr_int_uint_9 = OpTypePointer Function %_arr_int_uint_9 + %27 = OpConstantNull %_arr_int_uint_9 + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %59 = OpConstantComposite %_arr_int_uint_9 %int_1 %int_2 %int_3 %int_4 %int_5 %int_6 %int_7 %int_8 %int_9 + %main_out = OpTypeStruct %v4float + %91 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %indexable = OpVariable %_ptr_Function__arr_int_uint_9 Function %27 + %31 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %32 = OpLoad %int %31 + OpStore %a %32 + %34 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %35 = OpLoad %int %34 + OpStore %i %35 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpSLessThan %bool %40 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %37 + %46 = OpLabel + %49 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %52 = OpLoad %int %51 + OpStore %indexable %59 + %60 = OpSMod %int %49 %52 + %61 = OpAccessChain %_ptr_Function_int %indexable %60 + %62 = OpLoad %int %61 + %63 = OpLoad %int %a + %64 = OpIAdd %int %63 %62 + OpStore %a %64 + OpBranch %38 + %38 = OpLabel + %65 = OpLoad %int %i + %66 = OpIAdd %int %65 %int_1 + OpStore %i %66 + OpBranch %36 + %37 = OpLabel + %67 = OpLoad %int %a + %68 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpIEqual %bool %67 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %75 + %83 = OpConvertSToF %float %77 + %84 = OpConvertSToF %float %79 + %85 = OpConvertSToF %float %81 + %86 = OpCompositeConstruct %v4float %82 %83 %84 %85 + OpStore %x_GLF_color %86 + OpBranch %71 + %73 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %88 + %90 = OpCompositeConstruct %v4float %89 %89 %89 %89 + OpStore %x_GLF_color %90 + OpBranch %71 + %71 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %91 +%tint_symbol = OpFunctionParameter %main_out + %95 = OpLabel + %96 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %96 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %98 = OpLabel + %99 = OpFunctionCall %void %main_1 + %101 = OpLoad %v4float %x_GLF_color + %102 = OpCompositeConstruct %main_out %101 + %100 = OpFunctionCall %void %tint_symbol_2 %102 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..486246cde2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-int-loop-counter-mod-array/0-opt.wgsl.expected.wgsl @@ -0,0 +1,64 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + var indexable : array; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_38; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[3]; + i = x_40; + loop { + let x_45 : i32 = i; + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_45 < x_47)) { + } else { + break; + } + let x_50 : i32 = i; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[4]; + indexable = array(1, 2, 3, 4, 5, 6, 7, 8, 9); + let x_55 : i32 = indexable[(x_50 % x_52)]; + let x_56 : i32 = a; + a = (x_56 + x_55); + + continuing { + let x_58 : i32 = i; + i = (x_58 + 1); + } + } + let x_60 : i32 = a; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_60 == x_62)) { + let x_68 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_74 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_68), f32(x_71), f32(x_74), f32(x_77)); + } else { + let x_81 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_82 : f32 = f32(x_81); + x_GLF_color = vec4(x_82, x_82, x_82, x_82); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm new file mode 100644 index 0000000000..8524015cf0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm @@ -0,0 +1,159 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %b "b" + OpName %c "c" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_10 = OpConstant %int 10 + %int_5 = OpConstant %int 5 + %int_3 = OpConstant %int 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %11 + %29 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %c = OpVariable %_ptr_Function_int Function + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %31 = OpLoad %int %30 + OpStore %a %31 + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %33 = OpLoad %int %32 + OpStore %b %33 + OpStore %c %int_1 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %int %b + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %40 = OpLoad %int %39 + %41 = OpSLessThan %bool %38 %40 + %42 = OpLoad %int %a + %43 = OpSLessThan %bool %42 %int_10 + %44 = OpLogicalAnd %bool %41 %43 + OpBranchConditional %44 %45 %35 + %45 = OpLabel + %46 = OpLoad %int %c + %47 = OpSGreaterThan %bool %46 %int_5 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + OpBranch %35 + %48 = OpLabel + %50 = OpLoad %int %a + %51 = OpIAdd %int %50 %int_1 + OpStore %a %51 + %52 = OpLoad %int %c + %53 = OpIAdd %int %52 %int_1 + OpStore %c %53 + %54 = OpLoad %int %b + %55 = OpIAdd %int %54 %int_1 + OpStore %b %55 + OpBranch %36 + %36 = OpLabel + OpBranch %34 + %35 = OpLabel + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %int %a + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpSLessThan %bool %60 %62 + OpBranchConditional %63 %64 %57 + %64 = OpLabel + OpBranch %58 + %58 = OpLabel + %65 = OpLoad %int %a + %66 = OpIAdd %int %65 %int_1 + OpStore %a %66 + OpBranch %56 + %57 = OpLabel + %67 = OpLoad %int %a + %68 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpIEqual %bool %67 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %73 = OpLoad %int %b + %74 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %75 = OpLoad %int %74 + %76 = OpIEqual %bool %73 %75 + OpBranch %71 + %71 = OpLabel + %77 = OpPhi %bool %70 %57 %76 %72 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %78 + %79 = OpLabel + %80 = OpLoad %int %c + %81 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %82 = OpLoad %int %81 + %83 = OpIEqual %bool %80 %82 + OpBranch %78 + %78 = OpLabel + %84 = OpPhi %bool %77 %71 %83 %79 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %87 + %86 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %89 = OpLoad %int %88 + %90 = OpConvertSToF %float %89 + %91 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %92 + %94 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %98 = OpLoad %int %97 + %99 = OpConvertSToF %float %98 + %100 = OpCompositeConstruct %v4float %90 %93 %96 %99 + OpStore %_GLF_color %100 + OpBranch %85 + %87 = OpLabel + %101 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %102 = OpLoad %int %101 + %103 = OpConvertSToF %float %102 + %104 = OpCompositeConstruct %v4float %103 %103 %103 %103 + OpStore %_GLF_color %104 + OpBranch %85 + %85 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..1693e5c4ef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.hlsl @@ -0,0 +1,96 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int b = 0; + int c = 0; + bool x_76 = false; + bool x_83 = false; + bool x_77_phi = false; + bool x_84_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_31 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + a = x_31; + const int x_33 = asint(x_6[2].x); + b = x_33; + c = 1; + while (true) { + const int x_38 = b; + const int x_40 = asint(x_6[4].x); + bool tint_tmp = (x_38 < x_40); + if (tint_tmp) { + tint_tmp = (a < 10); + } + if ((tint_tmp)) { + } else { + break; + } + if ((c > 5)) { + break; + } + a = (a + 1); + c = (c + 1); + b = (b + 1); + } + while (true) { + const int x_60 = a; + const int x_62 = asint(x_6[1].x); + if ((x_60 < x_62)) { + } else { + break; + } + { + a = (a + 1); + } + } + const int x_67 = a; + const int x_69 = asint(x_6[1].x); + const bool x_70 = (x_67 == x_69); + x_77_phi = x_70; + if (x_70) { + const int x_73 = b; + const int x_75 = asint(x_6[3].x); + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + const bool x_77 = x_77_phi; + x_84_phi = x_77; + if (x_77) { + const int x_80 = c; + const int x_82 = asint(x_6[3].x); + x_83 = (x_80 == x_82); + x_84_phi = x_83; + } + if (x_84_phi) { + const int x_89 = asint(x_6[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_92 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_95 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_98 = asint(x_6[2].x); + x_GLF_color = float4(float(x_89), float(x_92), float(x_95), float(x_98)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_102 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_103 = float(x_102); + x_GLF_color = float4(x_103, x_103, x_103, x_103); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..2c946fea4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.msl @@ -0,0 +1,105 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int b = 0; + int c = 0; + bool x_76 = false; + bool x_83 = false; + bool x_77_phi = false; + bool x_84_phi = false; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = x_31; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[2].el; + b = x_33; + c = 1; + while (true) { + int const x_38 = b; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_42 = a; + if (((x_38 < x_40) && (x_42 < 10))) { + } else { + break; + } + int const x_46 = c; + if ((x_46 > 5)) { + break; + } + int const x_50 = a; + a = (x_50 + 1); + int const x_52 = c; + c = (x_52 + 1); + int const x_54 = b; + b = (x_54 + 1); + } + while (true) { + int const x_60 = a; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_60 < x_62)) { + } else { + break; + } + { + int const x_65 = a; + a = (x_65 + 1); + } + } + int const x_67 = a; + int const x_69 = x_6.x_GLF_uniform_int_values.arr[1].el; + bool const x_70 = (x_67 == x_69); + x_77_phi = x_70; + if (x_70) { + int const x_73 = b; + int const x_75 = x_6.x_GLF_uniform_int_values.arr[3].el; + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + bool const x_77 = x_77_phi; + x_84_phi = x_77; + if (x_77) { + int const x_80 = c; + int const x_82 = x_6.x_GLF_uniform_int_values.arr[3].el; + x_83 = (x_80 == x_82); + x_84_phi = x_83; + } + bool const x_84 = x_84_phi; + if (x_84) { + int const x_89 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_92 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_95 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_98 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_89), float(x_92), float(x_95), float(x_98)); + } else { + int const x_102 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_103 = float(x_102); + *(tint_symbol_4) = float4(x_103, x_103, x_103, x_103); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..94f92e8a66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.spvasm @@ -0,0 +1,225 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 135 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %x_76 "x_76" + OpName %x_83 "x_83" + OpName %x_77_phi "x_77_phi" + OpName %x_84_phi "x_84_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %int_10 = OpConstant %int 10 + %int_5 = OpConstant %int 5 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %123 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %b = OpVariable %_ptr_Function_int Function %21 + %c = OpVariable %_ptr_Function_int Function %21 + %x_76 = OpVariable %_ptr_Function_bool Function %27 + %x_83 = OpVariable %_ptr_Function_bool Function %27 + %x_77_phi = OpVariable %_ptr_Function_bool Function %27 + %x_84_phi = OpVariable %_ptr_Function_bool Function %27 + %34 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %35 = OpLoad %int %34 + OpStore %a %35 + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %38 = OpLoad %int %37 + OpStore %b %38 + OpStore %c %int_1 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %b + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %47 = OpLoad %int %46 + %48 = OpLoad %int %a + %49 = OpSLessThan %bool %44 %47 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + %53 = OpSLessThan %bool %48 %int_10 + OpBranch %50 + %50 = OpLabel + %54 = OpPhi %bool %49 %43 %53 %51 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %41 + %55 = OpLabel + %58 = OpLoad %int %c + %60 = OpSGreaterThan %bool %58 %int_5 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpBranch %41 + %61 = OpLabel + %63 = OpLoad %int %a + %64 = OpIAdd %int %63 %int_1 + OpStore %a %64 + %65 = OpLoad %int %c + %66 = OpIAdd %int %65 %int_1 + OpStore %c %66 + %67 = OpLoad %int %b + %68 = OpIAdd %int %67 %int_1 + OpStore %b %68 + OpBranch %42 + %42 = OpLabel + OpBranch %40 + %41 = OpLabel + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %int %a + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpSLessThan %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + OpBranch %77 + %79 = OpLabel + OpBranch %70 + %77 = OpLabel + OpBranch %71 + %71 = OpLabel + %80 = OpLoad %int %a + %81 = OpIAdd %int %80 %int_1 + OpStore %a %81 + OpBranch %69 + %70 = OpLabel + %82 = OpLoad %int %a + %83 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpIEqual %bool %82 %84 + OpStore %x_77_phi %85 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpLoad %int %b + %90 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %91 = OpLoad %int %90 + %92 = OpIEqual %bool %88 %91 + OpStore %x_76 %92 + %93 = OpLoad %bool %x_76 + OpStore %x_77_phi %93 + OpBranch %86 + %86 = OpLabel + %94 = OpLoad %bool %x_77_phi + OpStore %x_84_phi %94 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + %97 = OpLoad %int %c + %98 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %99 = OpLoad %int %98 + %100 = OpIEqual %bool %97 %99 + OpStore %x_83 %100 + %101 = OpLoad %bool %x_83 + OpStore %x_84_phi %101 + OpBranch %95 + %95 = OpLabel + %102 = OpLoad %bool %x_84_phi + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %111 = OpLoad %int %110 + %112 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %113 = OpLoad %int %112 + %114 = OpConvertSToF %float %107 + %115 = OpConvertSToF %float %109 + %116 = OpConvertSToF %float %111 + %117 = OpConvertSToF %float %113 + %118 = OpCompositeConstruct %v4float %114 %115 %116 %117 + OpStore %x_GLF_color %118 + OpBranch %103 + %105 = OpLabel + %119 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %120 = OpLoad %int %119 + %121 = OpConvertSToF %float %120 + %122 = OpCompositeConstruct %v4float %121 %121 %121 %121 + OpStore %x_GLF_color %122 + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %123 +%tint_symbol = OpFunctionParameter %main_out + %127 = OpLabel + %128 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %128 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %130 = OpLabel + %131 = OpFunctionCall %void %main_1 + %133 = OpLoad %v4float %x_GLF_color + %134 = OpCompositeConstruct %main_out %133 + %132 = OpFunctionCall %void %tint_symbol_2 %134 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5a769f42fd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.spvasm.expected.wgsl @@ -0,0 +1,99 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var c : i32; + var x_76 : bool; + var x_83 : bool; + var x_77_phi : bool; + var x_84_phi : bool; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_31; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[2]; + b = x_33; + c = 1; + loop { + let x_38 : i32 = b; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_42 : i32 = a; + if (((x_38 < x_40) && (x_42 < 10))) { + } else { + break; + } + let x_46 : i32 = c; + if ((x_46 > 5)) { + break; + } + let x_50 : i32 = a; + a = (x_50 + 1); + let x_52 : i32 = c; + c = (x_52 + 1); + let x_54 : i32 = b; + b = (x_54 + 1); + } + loop { + let x_60 : i32 = a; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_60 < x_62)) { + } else { + break; + } + + continuing { + let x_65 : i32 = a; + a = (x_65 + 1); + } + } + let x_67 : i32 = a; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_70 : bool = (x_67 == x_69); + x_77_phi = x_70; + if (x_70) { + let x_73 : i32 = b; + let x_75 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + let x_77 : bool = x_77_phi; + x_84_phi = x_77; + if (x_77) { + let x_80 : i32 = c; + let x_82 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_83 = (x_80 == x_82); + x_84_phi = x_83; + } + let x_84 : bool = x_84_phi; + if (x_84) { + let x_89 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_92 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_95 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_98 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_89), f32(x_92), f32(x_95), f32(x_98)); + } else { + let x_102 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_103 : f32 = f32(x_102); + x_GLF_color = vec4(x_103, x_103, x_103, x_103); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl new file mode 100644 index 0000000000..5a769f42fd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl @@ -0,0 +1,99 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var c : i32; + var x_76 : bool; + var x_83 : bool; + var x_77_phi : bool; + var x_84_phi : bool; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_31; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[2]; + b = x_33; + c = 1; + loop { + let x_38 : i32 = b; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_42 : i32 = a; + if (((x_38 < x_40) && (x_42 < 10))) { + } else { + break; + } + let x_46 : i32 = c; + if ((x_46 > 5)) { + break; + } + let x_50 : i32 = a; + a = (x_50 + 1); + let x_52 : i32 = c; + c = (x_52 + 1); + let x_54 : i32 = b; + b = (x_54 + 1); + } + loop { + let x_60 : i32 = a; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_60 < x_62)) { + } else { + break; + } + + continuing { + let x_65 : i32 = a; + a = (x_65 + 1); + } + } + let x_67 : i32 = a; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_70 : bool = (x_67 == x_69); + x_77_phi = x_70; + if (x_70) { + let x_73 : i32 = b; + let x_75 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + let x_77 : bool = x_77_phi; + x_84_phi = x_77; + if (x_77) { + let x_80 : i32 = c; + let x_82 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_83 = (x_80 == x_82); + x_84_phi = x_83; + } + let x_84 : bool = x_84_phi; + if (x_84) { + let x_89 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_92 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_95 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_98 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_89), f32(x_92), f32(x_95), f32(x_98)); + } else { + let x_102 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_103 : f32 = f32(x_102); + x_GLF_color = vec4(x_103, x_103, x_103, x_103); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..1693e5c4ef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.hlsl @@ -0,0 +1,96 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int b = 0; + int c = 0; + bool x_76 = false; + bool x_83 = false; + bool x_77_phi = false; + bool x_84_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_31 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + a = x_31; + const int x_33 = asint(x_6[2].x); + b = x_33; + c = 1; + while (true) { + const int x_38 = b; + const int x_40 = asint(x_6[4].x); + bool tint_tmp = (x_38 < x_40); + if (tint_tmp) { + tint_tmp = (a < 10); + } + if ((tint_tmp)) { + } else { + break; + } + if ((c > 5)) { + break; + } + a = (a + 1); + c = (c + 1); + b = (b + 1); + } + while (true) { + const int x_60 = a; + const int x_62 = asint(x_6[1].x); + if ((x_60 < x_62)) { + } else { + break; + } + { + a = (a + 1); + } + } + const int x_67 = a; + const int x_69 = asint(x_6[1].x); + const bool x_70 = (x_67 == x_69); + x_77_phi = x_70; + if (x_70) { + const int x_73 = b; + const int x_75 = asint(x_6[3].x); + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + const bool x_77 = x_77_phi; + x_84_phi = x_77; + if (x_77) { + const int x_80 = c; + const int x_82 = asint(x_6[3].x); + x_83 = (x_80 == x_82); + x_84_phi = x_83; + } + if (x_84_phi) { + const int x_89 = asint(x_6[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_92 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_95 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_98 = asint(x_6[2].x); + x_GLF_color = float4(float(x_89), float(x_92), float(x_95), float(x_98)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_102 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_103 = float(x_102); + x_GLF_color = float4(x_103, x_103, x_103, x_103); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..2c946fea4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.msl @@ -0,0 +1,105 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int b = 0; + int c = 0; + bool x_76 = false; + bool x_83 = false; + bool x_77_phi = false; + bool x_84_phi = false; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = x_31; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[2].el; + b = x_33; + c = 1; + while (true) { + int const x_38 = b; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_42 = a; + if (((x_38 < x_40) && (x_42 < 10))) { + } else { + break; + } + int const x_46 = c; + if ((x_46 > 5)) { + break; + } + int const x_50 = a; + a = (x_50 + 1); + int const x_52 = c; + c = (x_52 + 1); + int const x_54 = b; + b = (x_54 + 1); + } + while (true) { + int const x_60 = a; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_60 < x_62)) { + } else { + break; + } + { + int const x_65 = a; + a = (x_65 + 1); + } + } + int const x_67 = a; + int const x_69 = x_6.x_GLF_uniform_int_values.arr[1].el; + bool const x_70 = (x_67 == x_69); + x_77_phi = x_70; + if (x_70) { + int const x_73 = b; + int const x_75 = x_6.x_GLF_uniform_int_values.arr[3].el; + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + bool const x_77 = x_77_phi; + x_84_phi = x_77; + if (x_77) { + int const x_80 = c; + int const x_82 = x_6.x_GLF_uniform_int_values.arr[3].el; + x_83 = (x_80 == x_82); + x_84_phi = x_83; + } + bool const x_84 = x_84_phi; + if (x_84) { + int const x_89 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_92 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_95 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_98 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_89), float(x_92), float(x_95), float(x_98)); + } else { + int const x_102 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_103 = float(x_102); + *(tint_symbol_4) = float4(x_103, x_103, x_103, x_103); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..94f92e8a66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.spvasm @@ -0,0 +1,225 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 135 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %x_76 "x_76" + OpName %x_83 "x_83" + OpName %x_77_phi "x_77_phi" + OpName %x_84_phi "x_84_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %int_10 = OpConstant %int 10 + %int_5 = OpConstant %int 5 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %123 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %b = OpVariable %_ptr_Function_int Function %21 + %c = OpVariable %_ptr_Function_int Function %21 + %x_76 = OpVariable %_ptr_Function_bool Function %27 + %x_83 = OpVariable %_ptr_Function_bool Function %27 + %x_77_phi = OpVariable %_ptr_Function_bool Function %27 + %x_84_phi = OpVariable %_ptr_Function_bool Function %27 + %34 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %35 = OpLoad %int %34 + OpStore %a %35 + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %38 = OpLoad %int %37 + OpStore %b %38 + OpStore %c %int_1 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %b + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %47 = OpLoad %int %46 + %48 = OpLoad %int %a + %49 = OpSLessThan %bool %44 %47 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + %53 = OpSLessThan %bool %48 %int_10 + OpBranch %50 + %50 = OpLabel + %54 = OpPhi %bool %49 %43 %53 %51 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %41 + %55 = OpLabel + %58 = OpLoad %int %c + %60 = OpSGreaterThan %bool %58 %int_5 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpBranch %41 + %61 = OpLabel + %63 = OpLoad %int %a + %64 = OpIAdd %int %63 %int_1 + OpStore %a %64 + %65 = OpLoad %int %c + %66 = OpIAdd %int %65 %int_1 + OpStore %c %66 + %67 = OpLoad %int %b + %68 = OpIAdd %int %67 %int_1 + OpStore %b %68 + OpBranch %42 + %42 = OpLabel + OpBranch %40 + %41 = OpLabel + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %int %a + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpSLessThan %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + OpBranch %77 + %79 = OpLabel + OpBranch %70 + %77 = OpLabel + OpBranch %71 + %71 = OpLabel + %80 = OpLoad %int %a + %81 = OpIAdd %int %80 %int_1 + OpStore %a %81 + OpBranch %69 + %70 = OpLabel + %82 = OpLoad %int %a + %83 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpIEqual %bool %82 %84 + OpStore %x_77_phi %85 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpLoad %int %b + %90 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %91 = OpLoad %int %90 + %92 = OpIEqual %bool %88 %91 + OpStore %x_76 %92 + %93 = OpLoad %bool %x_76 + OpStore %x_77_phi %93 + OpBranch %86 + %86 = OpLabel + %94 = OpLoad %bool %x_77_phi + OpStore %x_84_phi %94 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + %97 = OpLoad %int %c + %98 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %99 = OpLoad %int %98 + %100 = OpIEqual %bool %97 %99 + OpStore %x_83 %100 + %101 = OpLoad %bool %x_83 + OpStore %x_84_phi %101 + OpBranch %95 + %95 = OpLabel + %102 = OpLoad %bool %x_84_phi + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %111 = OpLoad %int %110 + %112 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %113 = OpLoad %int %112 + %114 = OpConvertSToF %float %107 + %115 = OpConvertSToF %float %109 + %116 = OpConvertSToF %float %111 + %117 = OpConvertSToF %float %113 + %118 = OpCompositeConstruct %v4float %114 %115 %116 %117 + OpStore %x_GLF_color %118 + OpBranch %103 + %105 = OpLabel + %119 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %120 = OpLoad %int %119 + %121 = OpConvertSToF %float %120 + %122 = OpCompositeConstruct %v4float %121 %121 %121 %121 + OpStore %x_GLF_color %122 + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %123 +%tint_symbol = OpFunctionParameter %main_out + %127 = OpLabel + %128 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %128 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %130 = OpLabel + %131 = OpFunctionCall %void %main_1 + %133 = OpLoad %v4float %x_GLF_color + %134 = OpCompositeConstruct %main_out %133 + %132 = OpFunctionCall %void %tint_symbol_2 %134 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5a769f42fd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-multiple-integers/0-opt.wgsl.expected.wgsl @@ -0,0 +1,99 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var b : i32; + var c : i32; + var x_76 : bool; + var x_83 : bool; + var x_77_phi : bool; + var x_84_phi : bool; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_31; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[2]; + b = x_33; + c = 1; + loop { + let x_38 : i32 = b; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_42 : i32 = a; + if (((x_38 < x_40) && (x_42 < 10))) { + } else { + break; + } + let x_46 : i32 = c; + if ((x_46 > 5)) { + break; + } + let x_50 : i32 = a; + a = (x_50 + 1); + let x_52 : i32 = c; + c = (x_52 + 1); + let x_54 : i32 = b; + b = (x_54 + 1); + } + loop { + let x_60 : i32 = a; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_60 < x_62)) { + } else { + break; + } + + continuing { + let x_65 : i32 = a; + a = (x_65 + 1); + } + } + let x_67 : i32 = a; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_70 : bool = (x_67 == x_69); + x_77_phi = x_70; + if (x_70) { + let x_73 : i32 = b; + let x_75 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + let x_77 : bool = x_77_phi; + x_84_phi = x_77; + if (x_77) { + let x_80 : i32 = c; + let x_82 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_83 = (x_80 == x_82); + x_84_phi = x_83; + } + let x_84 : bool = x_84_phi; + if (x_84) { + let x_89 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_92 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_95 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_98 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_89), f32(x_92), f32(x_95), f32(x_98)); + } else { + let x_102 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_103 : f32 = f32(x_102); + x_GLF_color = vec4(x_103, x_103, x_103, x_103); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm new file mode 100644 index 0000000000..a5e67ea7c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm @@ -0,0 +1,145 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %m "m" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %a "a" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %arr "arr" + OpName %v "v" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float +%_arr_v3float_uint_2 = OpTypeArray %v3float %uint_2 +%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2 + %int_1 = OpConstant %int 1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_3 = OpConstant %int 3 + %main = OpFunction %void None %15 + %43 = OpLabel + %m = OpVariable %_ptr_Function_mat3v3float Function + %a = OpVariable %_ptr_Function_int Function + %arr = OpVariable %_ptr_Function__arr_v3float_uint_2 Function + %v = OpVariable %_ptr_Function_v3float Function + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %45 + %47 = OpCompositeConstruct %v3float %46 %float_0 %float_0 + %48 = OpCompositeConstruct %v3float %float_0 %46 %float_0 + %49 = OpCompositeConstruct %v3float %float_0 %float_0 %46 + %50 = OpCompositeConstruct %mat3v3float %47 %48 %49 + OpStore %m %50 + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %52 = OpLoad %int %51 + OpStore %a %52 + %53 = OpLoad %int %a + %54 = OpLoad %int %a + %55 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %56 = OpLoad %float %55 + %57 = OpAccessChain %_ptr_Function_float %m %53 %54 + OpStore %57 %56 + %58 = OpAccessChain %_ptr_Function_v3float %m %int_1 + %59 = OpLoad %v3float %58 + %60 = OpAccessChain %_ptr_Function_v3float %m %int_1 + %61 = OpLoad %v3float %60 + %62 = OpCompositeConstruct %_arr_v3float_uint_2 %59 %61 + OpStore %arr %62 + %63 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %64 = OpLoad %float %63 + %65 = OpCompositeConstruct %v3float %64 %64 %64 + OpStore %v %65 + %66 = OpLoad %int %a + %67 = OpAccessChain %_ptr_Function_v3float %arr %66 + %68 = OpLoad %v3float %67 + %69 = OpLoad %v3float %v + %70 = OpFAdd %v3float %69 %68 + OpStore %v %70 + %71 = OpLoad %v3float %v + %72 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpConvertSToF %float %73 + %75 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %76 + %78 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpConvertSToF %float %79 + %81 = OpCompositeConstruct %v3float %74 %77 %80 + %82 = OpFOrdEqual %v3bool %71 %81 + %83 = OpAll %bool %82 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %88 + %90 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %91 + %93 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %94 = OpLoad %int %93 + %95 = OpConvertSToF %float %94 + %96 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %97 = OpLoad %int %96 + %98 = OpConvertSToF %float %97 + %99 = OpCompositeConstruct %v4float %89 %92 %95 %98 + OpStore %_GLF_color %99 + OpBranch %84 + %86 = OpLabel + %100 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %101 = OpLoad %int %100 + %102 = OpConvertSToF %float %101 + %103 = OpCompositeConstruct %v4float %102 %102 %102 %102 + OpStore %_GLF_color %103 + OpBranch %84 + %84 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..1bc001a838 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.hlsl @@ -0,0 +1,70 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int a = 0; + float3 arr[2] = (float3[2])0; + float3 v = float3(0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_45 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_46 = float(x_45); + m = float3x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f), float3(0.0f, 0.0f, x_46)); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + a = x_52; + const int x_53 = a; + const int x_54 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_56 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + set_float3(m[x_53], x_54, x_56); + const float3 x_59 = m[1]; + const float3 x_61 = m[1]; + const float3 tint_symbol_4[2] = {x_59, x_61}; + arr = tint_symbol_4; + const float x_64 = asfloat(x_9[1].x); + v = float3(x_64, x_64, x_64); + const float3 x_68 = arr[a]; + v = (v + x_68); + const float3 x_71 = v; + const int x_73 = asint(x_6[1].x); + const int x_76 = asint(x_6[2].x); + const int x_79 = asint(x_6[1].x); + if (all((x_71 == float3(float(x_73), float(x_76), float(x_79))))) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_88 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_91 = asint(x_6[3].x); + const int x_94 = asint(x_6[3].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_97 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_88), float(x_91), float(x_94), float(x_97)); + } else { + const int x_101 = asint(x_6[3].x); + const float x_102 = float(x_101); + x_GLF_color = float4(x_102, x_102, x_102, x_102); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..384a32dc46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + float3 arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5) { + float3x3 m = float3x3(0.0f); + int a = 0; + tint_array_wrapper_2 arr = {}; + float3 v = 0.0f; + int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_46 = float(x_45); + m = float3x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f), float3(0.0f, 0.0f, x_46)); + int const x_52 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = x_52; + int const x_53 = a; + int const x_54 = a; + float const x_56 = x_9.x_GLF_uniform_float_values.arr[0].el; + m[x_53][x_54] = x_56; + float3 const x_59 = m[1]; + float3 const x_61 = m[1]; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_59, x_61}}; + arr = tint_symbol_3; + float const x_64 = x_9.x_GLF_uniform_float_values.arr[1].el; + v = float3(x_64, x_64, x_64); + int const x_66 = a; + float3 const x_68 = arr.arr[x_66]; + float3 const x_69 = v; + v = (x_69 + x_68); + float3 const x_71 = v; + int const x_73 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_76 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_79 = x_6.x_GLF_uniform_int_values.arr[1].el; + if (all((x_71 == float3(float(x_73), float(x_76), float(x_79))))) { + int const x_88 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_91 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_94 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_97 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_88), float(x_91), float(x_94), float(x_97)); + } else { + int const x_101 = x_6.x_GLF_uniform_int_values.arr[3].el; + float const x_102 = float(x_101); + *(tint_symbol_5) = float4(x_102, x_102, x_102, x_102); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..dcf9f7fc46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.spvasm @@ -0,0 +1,182 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 122 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %a "a" + OpName %arr "arr" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_v3float_uint_2 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %28 = OpConstantNull %mat3v3float +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int +%_arr_v3float_uint_2 = OpTypeArray %v3float %uint_2 +%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2 + %35 = OpConstantNull %_arr_v3float_uint_2 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %38 = OpConstantNull %v3float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float_0 = OpConstant %float 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %110 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %m = OpVariable %_ptr_Function_mat3v3float Function %28 + %a = OpVariable %_ptr_Function_int Function %31 + %arr = OpVariable %_ptr_Function__arr_v3float_uint_2 Function %35 + %v = OpVariable %_ptr_Function_v3float Function %38 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %43 + %46 = OpCompositeConstruct %v3float %44 %float_0 %float_0 + %47 = OpCompositeConstruct %v3float %float_0 %44 %float_0 + %48 = OpCompositeConstruct %v3float %float_0 %float_0 %44 + %49 = OpCompositeConstruct %mat3v3float %46 %47 %48 + OpStore %m %49 + %50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %51 = OpLoad %int %50 + OpStore %a %51 + %52 = OpLoad %int %a + %53 = OpLoad %int %a + %55 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Function_float %m %52 %53 + OpStore %58 %56 + %60 = OpAccessChain %_ptr_Function_v3float %m %int_1 + %61 = OpLoad %v3float %60 + %62 = OpAccessChain %_ptr_Function_v3float %m %int_1 + %63 = OpLoad %v3float %62 + %64 = OpCompositeConstruct %_arr_v3float_uint_2 %61 %63 + OpStore %arr %64 + %65 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %66 = OpLoad %float %65 + %67 = OpCompositeConstruct %v3float %66 %66 %66 + OpStore %v %67 + %68 = OpLoad %int %a + %69 = OpAccessChain %_ptr_Function_v3float %arr %68 + %70 = OpLoad %v3float %69 + %71 = OpLoad %v3float %v + %72 = OpFAdd %v3float %71 %70 + OpStore %v %72 + %73 = OpLoad %v3float %v + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %75 = OpLoad %int %74 + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %80 = OpLoad %int %79 + %83 = OpConvertSToF %float %75 + %84 = OpConvertSToF %float %78 + %85 = OpConvertSToF %float %80 + %86 = OpCompositeConstruct %v3float %83 %84 %85 + %87 = OpFOrdEqual %v3bool %73 %86 + %81 = OpAll %bool %87 + OpSelectionMerge %89 None + OpBranchConditional %81 %90 %91 + %90 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %93 = OpLoad %int %92 + %95 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %100 = OpLoad %int %99 + %101 = OpConvertSToF %float %93 + %102 = OpConvertSToF %float %96 + %103 = OpConvertSToF %float %98 + %104 = OpConvertSToF %float %100 + %105 = OpCompositeConstruct %v4float %101 %102 %103 %104 + OpStore %x_GLF_color %105 + OpBranch %89 + %91 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %107 = OpLoad %int %106 + %108 = OpConvertSToF %float %107 + %109 = OpCompositeConstruct %v4float %108 %108 %108 %108 + OpStore %x_GLF_color %109 + OpBranch %89 + %89 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %110 +%tint_symbol = OpFunctionParameter %main_out + %114 = OpLabel + %115 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %115 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %117 = OpLabel + %118 = OpFunctionCall %void %main_1 + %120 = OpLoad %v4float %x_GLF_color + %121 = OpCompositeConstruct %main_out %120 + %119 = OpFunctionCall %void %tint_symbol_2 %121 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..302eb53ae9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var m : mat3x3; + var a : i32; + var arr : array, 2>; + var v : vec3; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_46 : f32 = f32(x_45); + m = mat3x3(vec3(x_46, 0.0, 0.0), vec3(0.0, x_46, 0.0), vec3(0.0, 0.0, x_46)); + let x_52 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_52; + let x_53 : i32 = a; + let x_54 : i32 = a; + let x_56 : f32 = x_9.x_GLF_uniform_float_values[0]; + m[x_53][x_54] = x_56; + let x_59 : vec3 = m[1]; + let x_61 : vec3 = m[1]; + arr = array, 2>(x_59, x_61); + let x_64 : f32 = x_9.x_GLF_uniform_float_values[1]; + v = vec3(x_64, x_64, x_64); + let x_66 : i32 = a; + let x_68 : vec3 = arr[x_66]; + let x_69 : vec3 = v; + v = (x_69 + x_68); + let x_71 : vec3 = v; + let x_73 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_76 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_79 : i32 = x_6.x_GLF_uniform_int_values[1]; + if (all((x_71 == vec3(f32(x_73), f32(x_76), f32(x_79))))) { + let x_88 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_91 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_94 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_97 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_88), f32(x_91), f32(x_94), f32(x_97)); + } else { + let x_101 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_102 : f32 = f32(x_101); + x_GLF_color = vec4(x_102, x_102, x_102, x_102); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl new file mode 100644 index 0000000000..302eb53ae9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var m : mat3x3; + var a : i32; + var arr : array, 2>; + var v : vec3; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_46 : f32 = f32(x_45); + m = mat3x3(vec3(x_46, 0.0, 0.0), vec3(0.0, x_46, 0.0), vec3(0.0, 0.0, x_46)); + let x_52 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_52; + let x_53 : i32 = a; + let x_54 : i32 = a; + let x_56 : f32 = x_9.x_GLF_uniform_float_values[0]; + m[x_53][x_54] = x_56; + let x_59 : vec3 = m[1]; + let x_61 : vec3 = m[1]; + arr = array, 2>(x_59, x_61); + let x_64 : f32 = x_9.x_GLF_uniform_float_values[1]; + v = vec3(x_64, x_64, x_64); + let x_66 : i32 = a; + let x_68 : vec3 = arr[x_66]; + let x_69 : vec3 = v; + v = (x_69 + x_68); + let x_71 : vec3 = v; + let x_73 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_76 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_79 : i32 = x_6.x_GLF_uniform_int_values[1]; + if (all((x_71 == vec3(f32(x_73), f32(x_76), f32(x_79))))) { + let x_88 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_91 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_94 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_97 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_88), f32(x_91), f32(x_94), f32(x_97)); + } else { + let x_101 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_102 : f32 = f32(x_101); + x_GLF_color = vec4(x_102, x_102, x_102, x_102); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..1bc001a838 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.hlsl @@ -0,0 +1,70 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int a = 0; + float3 arr[2] = (float3[2])0; + float3 v = float3(0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_45 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_46 = float(x_45); + m = float3x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f), float3(0.0f, 0.0f, x_46)); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + a = x_52; + const int x_53 = a; + const int x_54 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_56 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + set_float3(m[x_53], x_54, x_56); + const float3 x_59 = m[1]; + const float3 x_61 = m[1]; + const float3 tint_symbol_4[2] = {x_59, x_61}; + arr = tint_symbol_4; + const float x_64 = asfloat(x_9[1].x); + v = float3(x_64, x_64, x_64); + const float3 x_68 = arr[a]; + v = (v + x_68); + const float3 x_71 = v; + const int x_73 = asint(x_6[1].x); + const int x_76 = asint(x_6[2].x); + const int x_79 = asint(x_6[1].x); + if (all((x_71 == float3(float(x_73), float(x_76), float(x_79))))) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_88 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_91 = asint(x_6[3].x); + const int x_94 = asint(x_6[3].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_97 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_88), float(x_91), float(x_94), float(x_97)); + } else { + const int x_101 = asint(x_6[3].x); + const float x_102 = float(x_101); + x_GLF_color = float4(x_102, x_102, x_102, x_102); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..384a32dc46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + float3 arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5) { + float3x3 m = float3x3(0.0f); + int a = 0; + tint_array_wrapper_2 arr = {}; + float3 v = 0.0f; + int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_46 = float(x_45); + m = float3x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f), float3(0.0f, 0.0f, x_46)); + int const x_52 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = x_52; + int const x_53 = a; + int const x_54 = a; + float const x_56 = x_9.x_GLF_uniform_float_values.arr[0].el; + m[x_53][x_54] = x_56; + float3 const x_59 = m[1]; + float3 const x_61 = m[1]; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_59, x_61}}; + arr = tint_symbol_3; + float const x_64 = x_9.x_GLF_uniform_float_values.arr[1].el; + v = float3(x_64, x_64, x_64); + int const x_66 = a; + float3 const x_68 = arr.arr[x_66]; + float3 const x_69 = v; + v = (x_69 + x_68); + float3 const x_71 = v; + int const x_73 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_76 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_79 = x_6.x_GLF_uniform_int_values.arr[1].el; + if (all((x_71 == float3(float(x_73), float(x_76), float(x_79))))) { + int const x_88 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_91 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_94 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_97 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_88), float(x_91), float(x_94), float(x_97)); + } else { + int const x_101 = x_6.x_GLF_uniform_int_values.arr[3].el; + float const x_102 = float(x_101); + *(tint_symbol_5) = float4(x_102, x_102, x_102, x_102); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..dcf9f7fc46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.spvasm @@ -0,0 +1,182 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 122 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %a "a" + OpName %arr "arr" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_v3float_uint_2 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %28 = OpConstantNull %mat3v3float +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int +%_arr_v3float_uint_2 = OpTypeArray %v3float %uint_2 +%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2 + %35 = OpConstantNull %_arr_v3float_uint_2 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %38 = OpConstantNull %v3float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float_0 = OpConstant %float 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %110 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %m = OpVariable %_ptr_Function_mat3v3float Function %28 + %a = OpVariable %_ptr_Function_int Function %31 + %arr = OpVariable %_ptr_Function__arr_v3float_uint_2 Function %35 + %v = OpVariable %_ptr_Function_v3float Function %38 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %43 + %46 = OpCompositeConstruct %v3float %44 %float_0 %float_0 + %47 = OpCompositeConstruct %v3float %float_0 %44 %float_0 + %48 = OpCompositeConstruct %v3float %float_0 %float_0 %44 + %49 = OpCompositeConstruct %mat3v3float %46 %47 %48 + OpStore %m %49 + %50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %51 = OpLoad %int %50 + OpStore %a %51 + %52 = OpLoad %int %a + %53 = OpLoad %int %a + %55 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Function_float %m %52 %53 + OpStore %58 %56 + %60 = OpAccessChain %_ptr_Function_v3float %m %int_1 + %61 = OpLoad %v3float %60 + %62 = OpAccessChain %_ptr_Function_v3float %m %int_1 + %63 = OpLoad %v3float %62 + %64 = OpCompositeConstruct %_arr_v3float_uint_2 %61 %63 + OpStore %arr %64 + %65 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %66 = OpLoad %float %65 + %67 = OpCompositeConstruct %v3float %66 %66 %66 + OpStore %v %67 + %68 = OpLoad %int %a + %69 = OpAccessChain %_ptr_Function_v3float %arr %68 + %70 = OpLoad %v3float %69 + %71 = OpLoad %v3float %v + %72 = OpFAdd %v3float %71 %70 + OpStore %v %72 + %73 = OpLoad %v3float %v + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %75 = OpLoad %int %74 + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %80 = OpLoad %int %79 + %83 = OpConvertSToF %float %75 + %84 = OpConvertSToF %float %78 + %85 = OpConvertSToF %float %80 + %86 = OpCompositeConstruct %v3float %83 %84 %85 + %87 = OpFOrdEqual %v3bool %73 %86 + %81 = OpAll %bool %87 + OpSelectionMerge %89 None + OpBranchConditional %81 %90 %91 + %90 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %93 = OpLoad %int %92 + %95 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %100 = OpLoad %int %99 + %101 = OpConvertSToF %float %93 + %102 = OpConvertSToF %float %96 + %103 = OpConvertSToF %float %98 + %104 = OpConvertSToF %float %100 + %105 = OpCompositeConstruct %v4float %101 %102 %103 %104 + OpStore %x_GLF_color %105 + OpBranch %89 + %91 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %107 = OpLoad %int %106 + %108 = OpConvertSToF %float %107 + %109 = OpCompositeConstruct %v4float %108 %108 %108 %108 + OpStore %x_GLF_color %109 + OpBranch %89 + %89 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %110 +%tint_symbol = OpFunctionParameter %main_out + %114 = OpLabel + %115 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %115 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %117 = OpLabel + %118 = OpFunctionCall %void %main_1 + %120 = OpLoad %v4float %x_GLF_color + %121 = OpCompositeConstruct %main_out %120 + %119 = OpFunctionCall %void %tint_symbol_2 %121 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..302eb53ae9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var m : mat3x3; + var a : i32; + var arr : array, 2>; + var v : vec3; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_46 : f32 = f32(x_45); + m = mat3x3(vec3(x_46, 0.0, 0.0), vec3(0.0, x_46, 0.0), vec3(0.0, 0.0, x_46)); + let x_52 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_52; + let x_53 : i32 = a; + let x_54 : i32 = a; + let x_56 : f32 = x_9.x_GLF_uniform_float_values[0]; + m[x_53][x_54] = x_56; + let x_59 : vec3 = m[1]; + let x_61 : vec3 = m[1]; + arr = array, 2>(x_59, x_61); + let x_64 : f32 = x_9.x_GLF_uniform_float_values[1]; + v = vec3(x_64, x_64, x_64); + let x_66 : i32 = a; + let x_68 : vec3 = arr[x_66]; + let x_69 : vec3 = v; + v = (x_69 + x_68); + let x_71 : vec3 = v; + let x_73 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_76 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_79 : i32 = x_6.x_GLF_uniform_int_values[1]; + if (all((x_71 == vec3(f32(x_73), f32(x_76), f32(x_79))))) { + let x_88 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_91 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_94 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_97 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_88), f32(x_91), f32(x_94), f32(x_97)); + } else { + let x_101 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_102 : f32 = f32(x_101); + x_GLF_color = vec4(x_102, x_102, x_102, x_102); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm new file mode 100644 index 0000000000..c366daced1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm @@ -0,0 +1,152 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %v "v" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %m "m" + OpName %indexable "indexable" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%mat3v4float = OpTypeMatrix %v4float 3 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_float = OpTypePointer Function %float +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %15 + %42 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %v = OpVariable %_ptr_Function_v4float Function + %m = OpVariable %_ptr_Function_mat3v4float Function + %indexable = OpVariable %_ptr_Function_mat4v4float Function + %43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %44 = OpLoad %int %43 + OpStore %a %44 + %45 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_2 + %46 = OpLoad %float %45 + %47 = OpCompositeConstruct %v4float %46 %46 %46 %46 + OpStore %v %47 + %48 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_3 + %49 = OpLoad %float %48 + %50 = OpCompositeConstruct %v4float %49 %float_0 %float_0 %float_0 + %51 = OpCompositeConstruct %v4float %float_0 %49 %float_0 %float_0 + %52 = OpCompositeConstruct %v4float %float_0 %float_0 %49 %float_0 + %53 = OpCompositeConstruct %mat3v4float %50 %51 %52 + OpStore %m %53 + %54 = OpLoad %int %a + %55 = OpLoad %int %a + %56 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %57 = OpLoad %float %56 + %58 = OpAccessChain %_ptr_Function_float %m %54 %55 + OpStore %58 %57 + %59 = OpLoad %int %a + %60 = OpLoad %mat3v4float %m + %61 = OpCompositeExtract %float %60 0 0 + %62 = OpCompositeExtract %float %60 0 1 + %63 = OpCompositeExtract %float %60 0 2 + %64 = OpCompositeExtract %float %60 0 3 + %65 = OpCompositeExtract %float %60 1 0 + %66 = OpCompositeExtract %float %60 1 1 + %67 = OpCompositeExtract %float %60 1 2 + %68 = OpCompositeExtract %float %60 1 3 + %69 = OpCompositeExtract %float %60 2 0 + %70 = OpCompositeExtract %float %60 2 1 + %71 = OpCompositeExtract %float %60 2 2 + %72 = OpCompositeExtract %float %60 2 3 + %73 = OpCompositeConstruct %v4float %61 %62 %63 %64 + %74 = OpCompositeConstruct %v4float %65 %66 %67 %68 + %75 = OpCompositeConstruct %v4float %69 %70 %71 %72 + %76 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %float_1 + %77 = OpCompositeConstruct %mat4v4float %73 %74 %75 %76 + %78 = OpLoad %int %a + %79 = OpLoad %int %a + OpStore %indexable %77 + %80 = OpAccessChain %_ptr_Function_float %indexable %78 %79 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Function_float %v %59 + %83 = OpLoad %float %82 + %84 = OpFAdd %float %83 %81 + %85 = OpAccessChain %_ptr_Function_float %v %59 + OpStore %85 %84 + %86 = OpAccessChain %_ptr_Function_float %v %uint_1 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %89 = OpLoad %float %88 + %90 = OpFOrdEqual %bool %87 %89 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %93 + %92 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %98 = OpLoad %int %97 + %99 = OpConvertSToF %float %98 + %100 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %101 = OpLoad %int %100 + %102 = OpConvertSToF %float %101 + %103 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %104 = OpLoad %int %103 + %105 = OpConvertSToF %float %104 + %106 = OpCompositeConstruct %v4float %96 %99 %102 %105 + OpStore %_GLF_color %106 + OpBranch %91 + %93 = OpLabel + %107 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %108 = OpLoad %int %107 + %109 = OpConvertSToF %float %108 + %110 = OpCompositeConstruct %v4float %109 %109 %109 %109 + OpStore %_GLF_color %110 + OpBranch %91 + %91 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..71686c8251 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.hlsl @@ -0,0 +1,68 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3x4 m = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x4 indexable = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_44 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + a = x_44; + const float x_46 = asfloat(x_9[2].x); + v = float4(x_46, x_46, x_46, x_46); + const float x_49 = asfloat(x_9[3].x); + m = float3x4(float4(x_49, 0.0f, 0.0f, 0.0f), float4(0.0f, x_49, 0.0f, 0.0f), float4(0.0f, 0.0f, x_49, 0.0f)); + const int x_54 = a; + const int x_55 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_57 = asfloat(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + set_float4(m[x_54], x_55, x_57); + const int x_59 = a; + const float3x4 x_60 = m; + const int x_78 = a; + const int x_79 = a; + indexable = float4x4(float4(x_60[0u].x, x_60[0u].y, x_60[0u].z, x_60[0u].w), float4(x_60[1u].x, x_60[1u].y, x_60[1u].z, x_60[1u].w), float4(x_60[2u].x, x_60[2u].y, x_60[2u].z, x_60[2u].w), float4(0.0f, 0.0f, 0.0f, 1.0f)); + const float x_81 = indexable[x_78][x_79]; + const float x_83 = v[x_59]; + set_float4(v, x_59, (x_83 + x_81)); + const float x_87 = v.y; + const float x_89 = asfloat(x_9[1].x); + if ((x_87 == x_89)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_95 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_98 = asint(x_6[1].x); + const int x_101 = asint(x_6[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_104 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_95), float(x_98), float(x_101), float(x_104)); + } else { + const int x_108 = asint(x_6[1].x); + const float x_109 = float(x_108); + x_GLF_color = float4(x_109, x_109, x_109, x_109); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..00f2b25e2d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.msl @@ -0,0 +1,77 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + int a = 0; + float4 v = 0.0f; + float3x4 m = float3x4(0.0f); + float4x4 indexable = float4x4(0.0f); + int const x_44 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = x_44; + float const x_46 = x_9.x_GLF_uniform_float_values.arr[2].el; + v = float4(x_46, x_46, x_46, x_46); + float const x_49 = x_9.x_GLF_uniform_float_values.arr[3].el; + m = float3x4(float4(x_49, 0.0f, 0.0f, 0.0f), float4(0.0f, x_49, 0.0f, 0.0f), float4(0.0f, 0.0f, x_49, 0.0f)); + int const x_54 = a; + int const x_55 = a; + float const x_57 = x_9.x_GLF_uniform_float_values.arr[0].el; + m[x_54][x_55] = x_57; + int const x_59 = a; + float3x4 const x_60 = m; + int const x_78 = a; + int const x_79 = a; + indexable = float4x4(float4(x_60[0u].x, x_60[0u].y, x_60[0u].z, x_60[0u].w), float4(x_60[1u].x, x_60[1u].y, x_60[1u].z, x_60[1u].w), float4(x_60[2u].x, x_60[2u].y, x_60[2u].z, x_60[2u].w), float4(0.0f, 0.0f, 0.0f, 1.0f)); + float const x_81 = indexable[x_78][x_79]; + float const x_83 = v[x_59]; + v[x_59] = (x_83 + x_81); + float const x_87 = v.y; + float const x_89 = x_9.x_GLF_uniform_float_values.arr[1].el; + if ((x_87 == x_89)) { + int const x_95 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_98 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_101 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_104 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_95), float(x_98), float(x_101), float(x_104)); + } else { + int const x_108 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_109 = float(x_108); + *(tint_symbol_4) = float4(x_109, x_109, x_109, x_109); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..03ce67168b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.spvasm @@ -0,0 +1,200 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 141 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %v "v" + OpName %m "m" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float +%mat3v4float = OpTypeMatrix %v4float 3 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %32 = OpConstantNull %mat3v4float +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %36 = OpConstantNull %mat4v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %float_0 = OpConstant %float 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %94 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %129 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_int Function %26 + %v = OpVariable %_ptr_Function_v4float Function %17 + %m = OpVariable %_ptr_Function_mat3v4float Function %32 + %indexable = OpVariable %_ptr_Function_mat4v4float Function %36 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %41 = OpLoad %int %40 + OpStore %a %41 + %44 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_2 + %45 = OpLoad %float %44 + %46 = OpCompositeConstruct %v4float %45 %45 %45 %45 + OpStore %v %46 + %48 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_3 + %49 = OpLoad %float %48 + %51 = OpCompositeConstruct %v4float %49 %float_0 %float_0 %float_0 + %52 = OpCompositeConstruct %v4float %float_0 %49 %float_0 %float_0 + %53 = OpCompositeConstruct %v4float %float_0 %float_0 %49 %float_0 + %54 = OpCompositeConstruct %mat3v4float %51 %52 %53 + OpStore %m %54 + %55 = OpLoad %int %a + %56 = OpLoad %int %a + %57 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %58 = OpLoad %float %57 + %60 = OpAccessChain %_ptr_Function_float %m %55 %56 + OpStore %60 %58 + %61 = OpLoad %int %a + %62 = OpLoad %mat3v4float %m + %63 = OpLoad %int %a + %64 = OpLoad %int %a + %65 = OpCompositeExtract %v4float %62 0 + %66 = OpCompositeExtract %float %65 0 + %67 = OpCompositeExtract %v4float %62 0 + %68 = OpCompositeExtract %float %67 1 + %69 = OpCompositeExtract %v4float %62 0 + %70 = OpCompositeExtract %float %69 2 + %71 = OpCompositeExtract %v4float %62 0 + %72 = OpCompositeExtract %float %71 3 + %73 = OpCompositeConstruct %v4float %66 %68 %70 %72 + %75 = OpCompositeExtract %v4float %62 1 + %76 = OpCompositeExtract %float %75 0 + %77 = OpCompositeExtract %v4float %62 1 + %78 = OpCompositeExtract %float %77 1 + %79 = OpCompositeExtract %v4float %62 1 + %80 = OpCompositeExtract %float %79 2 + %81 = OpCompositeExtract %v4float %62 1 + %82 = OpCompositeExtract %float %81 3 + %83 = OpCompositeConstruct %v4float %76 %78 %80 %82 + %84 = OpCompositeExtract %v4float %62 2 + %85 = OpCompositeExtract %float %84 0 + %86 = OpCompositeExtract %v4float %62 2 + %87 = OpCompositeExtract %float %86 1 + %88 = OpCompositeExtract %v4float %62 2 + %89 = OpCompositeExtract %float %88 2 + %90 = OpCompositeExtract %v4float %62 2 + %91 = OpCompositeExtract %float %90 3 + %92 = OpCompositeConstruct %v4float %85 %87 %89 %91 + %95 = OpCompositeConstruct %mat4v4float %73 %83 %92 %94 + OpStore %indexable %95 + %96 = OpAccessChain %_ptr_Function_float %indexable %63 %64 + %97 = OpLoad %float %96 + %98 = OpAccessChain %_ptr_Function_float %v %61 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Function_float %v %61 + %101 = OpFAdd %float %99 %97 + OpStore %100 %101 + %102 = OpAccessChain %_ptr_Function_float %v %uint_1 + %103 = OpLoad %float %102 + %105 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %106 = OpLoad %float %105 + %107 = OpFOrdEqual %bool %103 %106 + OpSelectionMerge %109 None + OpBranchConditional %107 %110 %111 + %110 = OpLabel + %112 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %115 = OpLoad %int %114 + %116 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %117 = OpLoad %int %116 + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %119 = OpLoad %int %118 + %120 = OpConvertSToF %float %113 + %121 = OpConvertSToF %float %115 + %122 = OpConvertSToF %float %117 + %123 = OpConvertSToF %float %119 + %124 = OpCompositeConstruct %v4float %120 %121 %122 %123 + OpStore %x_GLF_color %124 + OpBranch %109 + %111 = OpLabel + %125 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %126 = OpLoad %int %125 + %127 = OpConvertSToF %float %126 + %128 = OpCompositeConstruct %v4float %127 %127 %127 %127 + OpStore %x_GLF_color %128 + OpBranch %109 + %109 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %129 +%tint_symbol = OpFunctionParameter %main_out + %133 = OpLabel + %134 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %134 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %136 = OpLabel + %137 = OpFunctionCall %void %main_1 + %139 = OpLoad %v4float %x_GLF_color + %140 = OpCompositeConstruct %main_out %139 + %138 = OpFunctionCall %void %tint_symbol_2 %140 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ff8e0f06f2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.wgsl @@ -0,0 +1,69 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var v : vec4; + var m : mat3x4; + var indexable : mat4x4; + let x_44 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_44; + let x_46 : f32 = x_9.x_GLF_uniform_float_values[2]; + v = vec4(x_46, x_46, x_46, x_46); + let x_49 : f32 = x_9.x_GLF_uniform_float_values[3]; + m = mat3x4(vec4(x_49, 0.0, 0.0, 0.0), vec4(0.0, x_49, 0.0, 0.0), vec4(0.0, 0.0, x_49, 0.0)); + let x_54 : i32 = a; + let x_55 : i32 = a; + let x_57 : f32 = x_9.x_GLF_uniform_float_values[0]; + m[x_54][x_55] = x_57; + let x_59 : i32 = a; + let x_60 : mat3x4 = m; + let x_78 : i32 = a; + let x_79 : i32 = a; + indexable = mat4x4(vec4(x_60[0u].x, x_60[0u].y, x_60[0u].z, x_60[0u].w), vec4(x_60[1u].x, x_60[1u].y, x_60[1u].z, x_60[1u].w), vec4(x_60[2u].x, x_60[2u].y, x_60[2u].z, x_60[2u].w), vec4(0.0, 0.0, 0.0, 1.0)); + let x_81 : f32 = indexable[x_78][x_79]; + let x_83 : f32 = v[x_59]; + v[x_59] = (x_83 + x_81); + let x_87 : f32 = v.y; + let x_89 : f32 = x_9.x_GLF_uniform_float_values[1]; + if ((x_87 == x_89)) { + let x_95 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_98 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_101 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_104 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_95), f32(x_98), f32(x_101), f32(x_104)); + } else { + let x_108 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_109 : f32 = f32(x_108); + x_GLF_color = vec4(x_109, x_109, x_109, x_109); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl new file mode 100644 index 0000000000..ff8e0f06f2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl @@ -0,0 +1,69 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var v : vec4; + var m : mat3x4; + var indexable : mat4x4; + let x_44 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_44; + let x_46 : f32 = x_9.x_GLF_uniform_float_values[2]; + v = vec4(x_46, x_46, x_46, x_46); + let x_49 : f32 = x_9.x_GLF_uniform_float_values[3]; + m = mat3x4(vec4(x_49, 0.0, 0.0, 0.0), vec4(0.0, x_49, 0.0, 0.0), vec4(0.0, 0.0, x_49, 0.0)); + let x_54 : i32 = a; + let x_55 : i32 = a; + let x_57 : f32 = x_9.x_GLF_uniform_float_values[0]; + m[x_54][x_55] = x_57; + let x_59 : i32 = a; + let x_60 : mat3x4 = m; + let x_78 : i32 = a; + let x_79 : i32 = a; + indexable = mat4x4(vec4(x_60[0u].x, x_60[0u].y, x_60[0u].z, x_60[0u].w), vec4(x_60[1u].x, x_60[1u].y, x_60[1u].z, x_60[1u].w), vec4(x_60[2u].x, x_60[2u].y, x_60[2u].z, x_60[2u].w), vec4(0.0, 0.0, 0.0, 1.0)); + let x_81 : f32 = indexable[x_78][x_79]; + let x_83 : f32 = v[x_59]; + v[x_59] = (x_83 + x_81); + let x_87 : f32 = v.y; + let x_89 : f32 = x_9.x_GLF_uniform_float_values[1]; + if ((x_87 == x_89)) { + let x_95 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_98 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_101 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_104 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_95), f32(x_98), f32(x_101), f32(x_104)); + } else { + let x_108 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_109 : f32 = f32(x_108); + x_GLF_color = vec4(x_109, x_109, x_109, x_109); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..71686c8251 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.hlsl @@ -0,0 +1,68 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + float3x4 m = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x4 indexable = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_44 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + a = x_44; + const float x_46 = asfloat(x_9[2].x); + v = float4(x_46, x_46, x_46, x_46); + const float x_49 = asfloat(x_9[3].x); + m = float3x4(float4(x_49, 0.0f, 0.0f, 0.0f), float4(0.0f, x_49, 0.0f, 0.0f), float4(0.0f, 0.0f, x_49, 0.0f)); + const int x_54 = a; + const int x_55 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_57 = asfloat(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + set_float4(m[x_54], x_55, x_57); + const int x_59 = a; + const float3x4 x_60 = m; + const int x_78 = a; + const int x_79 = a; + indexable = float4x4(float4(x_60[0u].x, x_60[0u].y, x_60[0u].z, x_60[0u].w), float4(x_60[1u].x, x_60[1u].y, x_60[1u].z, x_60[1u].w), float4(x_60[2u].x, x_60[2u].y, x_60[2u].z, x_60[2u].w), float4(0.0f, 0.0f, 0.0f, 1.0f)); + const float x_81 = indexable[x_78][x_79]; + const float x_83 = v[x_59]; + set_float4(v, x_59, (x_83 + x_81)); + const float x_87 = v.y; + const float x_89 = asfloat(x_9[1].x); + if ((x_87 == x_89)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_95 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_98 = asint(x_6[1].x); + const int x_101 = asint(x_6[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_104 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_95), float(x_98), float(x_101), float(x_104)); + } else { + const int x_108 = asint(x_6[1].x); + const float x_109 = float(x_108); + x_GLF_color = float4(x_109, x_109, x_109, x_109); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..00f2b25e2d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.msl @@ -0,0 +1,77 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + int a = 0; + float4 v = 0.0f; + float3x4 m = float3x4(0.0f); + float4x4 indexable = float4x4(0.0f); + int const x_44 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = x_44; + float const x_46 = x_9.x_GLF_uniform_float_values.arr[2].el; + v = float4(x_46, x_46, x_46, x_46); + float const x_49 = x_9.x_GLF_uniform_float_values.arr[3].el; + m = float3x4(float4(x_49, 0.0f, 0.0f, 0.0f), float4(0.0f, x_49, 0.0f, 0.0f), float4(0.0f, 0.0f, x_49, 0.0f)); + int const x_54 = a; + int const x_55 = a; + float const x_57 = x_9.x_GLF_uniform_float_values.arr[0].el; + m[x_54][x_55] = x_57; + int const x_59 = a; + float3x4 const x_60 = m; + int const x_78 = a; + int const x_79 = a; + indexable = float4x4(float4(x_60[0u].x, x_60[0u].y, x_60[0u].z, x_60[0u].w), float4(x_60[1u].x, x_60[1u].y, x_60[1u].z, x_60[1u].w), float4(x_60[2u].x, x_60[2u].y, x_60[2u].z, x_60[2u].w), float4(0.0f, 0.0f, 0.0f, 1.0f)); + float const x_81 = indexable[x_78][x_79]; + float const x_83 = v[x_59]; + v[x_59] = (x_83 + x_81); + float const x_87 = v.y; + float const x_89 = x_9.x_GLF_uniform_float_values.arr[1].el; + if ((x_87 == x_89)) { + int const x_95 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_98 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_101 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_104 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_95), float(x_98), float(x_101), float(x_104)); + } else { + int const x_108 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_109 = float(x_108); + *(tint_symbol_4) = float4(x_109, x_109, x_109, x_109); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..03ce67168b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.spvasm @@ -0,0 +1,200 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 141 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %v "v" + OpName %m "m" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float +%mat3v4float = OpTypeMatrix %v4float 3 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %32 = OpConstantNull %mat3v4float +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %36 = OpConstantNull %mat4v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %float_0 = OpConstant %float 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %94 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %129 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_int Function %26 + %v = OpVariable %_ptr_Function_v4float Function %17 + %m = OpVariable %_ptr_Function_mat3v4float Function %32 + %indexable = OpVariable %_ptr_Function_mat4v4float Function %36 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %41 = OpLoad %int %40 + OpStore %a %41 + %44 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_2 + %45 = OpLoad %float %44 + %46 = OpCompositeConstruct %v4float %45 %45 %45 %45 + OpStore %v %46 + %48 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_3 + %49 = OpLoad %float %48 + %51 = OpCompositeConstruct %v4float %49 %float_0 %float_0 %float_0 + %52 = OpCompositeConstruct %v4float %float_0 %49 %float_0 %float_0 + %53 = OpCompositeConstruct %v4float %float_0 %float_0 %49 %float_0 + %54 = OpCompositeConstruct %mat3v4float %51 %52 %53 + OpStore %m %54 + %55 = OpLoad %int %a + %56 = OpLoad %int %a + %57 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %58 = OpLoad %float %57 + %60 = OpAccessChain %_ptr_Function_float %m %55 %56 + OpStore %60 %58 + %61 = OpLoad %int %a + %62 = OpLoad %mat3v4float %m + %63 = OpLoad %int %a + %64 = OpLoad %int %a + %65 = OpCompositeExtract %v4float %62 0 + %66 = OpCompositeExtract %float %65 0 + %67 = OpCompositeExtract %v4float %62 0 + %68 = OpCompositeExtract %float %67 1 + %69 = OpCompositeExtract %v4float %62 0 + %70 = OpCompositeExtract %float %69 2 + %71 = OpCompositeExtract %v4float %62 0 + %72 = OpCompositeExtract %float %71 3 + %73 = OpCompositeConstruct %v4float %66 %68 %70 %72 + %75 = OpCompositeExtract %v4float %62 1 + %76 = OpCompositeExtract %float %75 0 + %77 = OpCompositeExtract %v4float %62 1 + %78 = OpCompositeExtract %float %77 1 + %79 = OpCompositeExtract %v4float %62 1 + %80 = OpCompositeExtract %float %79 2 + %81 = OpCompositeExtract %v4float %62 1 + %82 = OpCompositeExtract %float %81 3 + %83 = OpCompositeConstruct %v4float %76 %78 %80 %82 + %84 = OpCompositeExtract %v4float %62 2 + %85 = OpCompositeExtract %float %84 0 + %86 = OpCompositeExtract %v4float %62 2 + %87 = OpCompositeExtract %float %86 1 + %88 = OpCompositeExtract %v4float %62 2 + %89 = OpCompositeExtract %float %88 2 + %90 = OpCompositeExtract %v4float %62 2 + %91 = OpCompositeExtract %float %90 3 + %92 = OpCompositeConstruct %v4float %85 %87 %89 %91 + %95 = OpCompositeConstruct %mat4v4float %73 %83 %92 %94 + OpStore %indexable %95 + %96 = OpAccessChain %_ptr_Function_float %indexable %63 %64 + %97 = OpLoad %float %96 + %98 = OpAccessChain %_ptr_Function_float %v %61 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Function_float %v %61 + %101 = OpFAdd %float %99 %97 + OpStore %100 %101 + %102 = OpAccessChain %_ptr_Function_float %v %uint_1 + %103 = OpLoad %float %102 + %105 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %106 = OpLoad %float %105 + %107 = OpFOrdEqual %bool %103 %106 + OpSelectionMerge %109 None + OpBranchConditional %107 %110 %111 + %110 = OpLabel + %112 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %115 = OpLoad %int %114 + %116 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %117 = OpLoad %int %116 + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %119 = OpLoad %int %118 + %120 = OpConvertSToF %float %113 + %121 = OpConvertSToF %float %115 + %122 = OpConvertSToF %float %117 + %123 = OpConvertSToF %float %119 + %124 = OpCompositeConstruct %v4float %120 %121 %122 %123 + OpStore %x_GLF_color %124 + OpBranch %109 + %111 = OpLabel + %125 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %126 = OpLoad %int %125 + %127 = OpConvertSToF %float %126 + %128 = OpCompositeConstruct %v4float %127 %127 %127 %127 + OpStore %x_GLF_color %128 + OpBranch %109 + %109 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %129 +%tint_symbol = OpFunctionParameter %main_out + %133 = OpLabel + %134 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %134 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %136 = OpLabel + %137 = OpFunctionCall %void %main_1 + %139 = OpLoad %v4float %x_GLF_color + %140 = OpCompositeConstruct %main_out %139 + %138 = OpFunctionCall %void %tint_symbol_2 %140 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ff8e0f06f2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.wgsl @@ -0,0 +1,69 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var v : vec4; + var m : mat3x4; + var indexable : mat4x4; + let x_44 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_44; + let x_46 : f32 = x_9.x_GLF_uniform_float_values[2]; + v = vec4(x_46, x_46, x_46, x_46); + let x_49 : f32 = x_9.x_GLF_uniform_float_values[3]; + m = mat3x4(vec4(x_49, 0.0, 0.0, 0.0), vec4(0.0, x_49, 0.0, 0.0), vec4(0.0, 0.0, x_49, 0.0)); + let x_54 : i32 = a; + let x_55 : i32 = a; + let x_57 : f32 = x_9.x_GLF_uniform_float_values[0]; + m[x_54][x_55] = x_57; + let x_59 : i32 = a; + let x_60 : mat3x4 = m; + let x_78 : i32 = a; + let x_79 : i32 = a; + indexable = mat4x4(vec4(x_60[0u].x, x_60[0u].y, x_60[0u].z, x_60[0u].w), vec4(x_60[1u].x, x_60[1u].y, x_60[1u].z, x_60[1u].w), vec4(x_60[2u].x, x_60[2u].y, x_60[2u].z, x_60[2u].w), vec4(0.0, 0.0, 0.0, 1.0)); + let x_81 : f32 = indexable[x_78][x_79]; + let x_83 : f32 = v[x_59]; + v[x_59] = (x_83 + x_81); + let x_87 : f32 = v.y; + let x_89 : f32 = x_9.x_GLF_uniform_float_values[1]; + if ((x_87 == x_89)) { + let x_95 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_98 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_101 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_104 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_95), f32(x_98), f32(x_101), f32(x_104)); + } else { + let x_108 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_109 : f32 = f32(x_108); + x_GLF_color = vec4(x_109, x_109, x_109, x_109); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm new file mode 100644 index 0000000000..c0dce99031 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm @@ -0,0 +1,61 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %x "x" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %11 = OpTypeFunction %v4float +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_0_5 = OpConstant %float 0.5 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %main = OpFunction %void None %8 + %24 = OpLabel + OpStore %_GLF_color %22 + OpBranch %25 + %25 = OpLabel + %26 = OpFunctionCall %v4float %func_ + OpStore %_GLF_color %26 + OpLoopMerge %27 %25 None + OpBranchConditional %false %25 %27 + %27 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %v4float None %11 + %28 = OpLabel + %x = OpVariable %_ptr_Function_float Function + OpStore %x %float_1 + %29 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %30 = OpLoad %float %29 + %31 = OpFOrdLessThan %bool %30 %float_0 + OpSelectionMerge %32 None + OpBranchConditional %31 %33 %32 + %33 = OpLabel + OpStore %x %float_0_5 + OpBranch %32 + %32 = OpLabel + %34 = OpLoad %float %x + %35 = OpCompositeConstruct %v4float %34 %float_0 %float_0 %float_1 + OpReturnValue %35 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9f9794579e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.hlsl @@ -0,0 +1,44 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float4 func_() { + float x = 0.0f; + x = 1.0f; + const float x_30 = gl_FragCoord.x; + if ((x_30 < 0.0f)) { + x = 0.5f; + } + return float4(x, 0.0f, 0.0f, 1.0f); +} + +void main_1() { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + while (true) { + const float4 x_26 = func_(); + x_GLF_color = x_26; + if (false) { + } else { + break; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..ab5b07e356 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float4 func_(thread float4* const tint_symbol_5) { + float x = 0.0f; + x = 1.0f; + float const x_30 = (*(tint_symbol_5)).x; + if ((x_30 < 0.0f)) { + x = 0.5f; + } + float const x_34 = x; + return float4(x_34, 0.0f, 0.0f, 1.0f); +} + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + while (true) { + float4 const x_26 = func_(tint_symbol_7); + *(tint_symbol_6) = x_26; + if (false) { + } else { + break; + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(&(tint_symbol_9), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..62468de7bc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_ "func_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %11 = OpTypeFunction %v4float +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_0_5 = OpConstant %float 0.5 + %void = OpTypeVoid + %31 = OpTypeFunction %void + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %45 = OpTypeFunction %void %main_out + %func_ = OpFunction %v4float None %11 + %13 = OpLabel + %x = OpVariable %_ptr_Function_float Function %16 + OpStore %x %float_1 + %21 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %22 = OpLoad %float %21 + %24 = OpFOrdLessThan %bool %22 %float_0 + OpSelectionMerge %26 None + OpBranchConditional %24 %27 %26 + %27 = OpLabel + OpStore %x %float_0_5 + OpBranch %26 + %26 = OpLabel + %29 = OpLoad %float %x + %30 = OpCompositeConstruct %v4float %29 %float_0 %float_0 %float_1 + OpReturnValue %30 + OpFunctionEnd + %main_1 = OpFunction %void None %31 + %34 = OpLabel + OpStore %x_GLF_color %35 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpFunctionCall %v4float %func_ + OpStore %x_GLF_color %40 + OpSelectionMerge %42 None + OpBranchConditional %false %43 %44 + %43 = OpLabel + OpBranch %42 + %44 = OpLabel + OpBranch %37 + %42 = OpLabel + OpBranch %38 + %38 = OpLabel + OpBranch %36 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %45 +%tint_symbol_1 = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %31 + %52 = OpLabel + %53 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %53 + %54 = OpFunctionCall %void %main_1 + %56 = OpLoad %v4float %x_GLF_color + %57 = OpCompositeConstruct %main_out %56 + %55 = OpFunctionCall %void %tint_symbol_3 %57 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..7d42f20fec --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn func_() -> vec4 { + var x : f32; + x = 1.0; + let x_30 : f32 = gl_FragCoord.x; + if ((x_30 < 0.0)) { + x = 0.5; + } + let x_34 : f32 = x; + return vec4(x_34, 0.0, 0.0, 1.0); +} + +fn main_1() { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + loop { + let x_26 : vec4 = func_(); + x_GLF_color = x_26; + if (false) { + } else { + break; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl new file mode 100644 index 0000000000..7d42f20fec --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl @@ -0,0 +1,39 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn func_() -> vec4 { + var x : f32; + x = 1.0; + let x_30 : f32 = gl_FragCoord.x; + if ((x_30 < 0.0)) { + x = 0.5; + } + let x_34 : f32 = x; + return vec4(x_34, 0.0, 0.0, 1.0); +} + +fn main_1() { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + loop { + let x_26 : vec4 = func_(); + x_GLF_color = x_26; + if (false) { + } else { + break; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9f9794579e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.hlsl @@ -0,0 +1,44 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float4 func_() { + float x = 0.0f; + x = 1.0f; + const float x_30 = gl_FragCoord.x; + if ((x_30 < 0.0f)) { + x = 0.5f; + } + return float4(x, 0.0f, 0.0f, 1.0f); +} + +void main_1() { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + while (true) { + const float4 x_26 = func_(); + x_GLF_color = x_26; + if (false) { + } else { + break; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..ab5b07e356 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float4 func_(thread float4* const tint_symbol_5) { + float x = 0.0f; + x = 1.0f; + float const x_30 = (*(tint_symbol_5)).x; + if ((x_30 < 0.0f)) { + x = 0.5f; + } + float const x_34 = x; + return float4(x_34, 0.0f, 0.0f, 1.0f); +} + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + while (true) { + float4 const x_26 = func_(tint_symbol_7); + *(tint_symbol_6) = x_26; + if (false) { + } else { + break; + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(&(tint_symbol_9), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..62468de7bc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_ "func_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %11 = OpTypeFunction %v4float +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_0_5 = OpConstant %float 0.5 + %void = OpTypeVoid + %31 = OpTypeFunction %void + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %45 = OpTypeFunction %void %main_out + %func_ = OpFunction %v4float None %11 + %13 = OpLabel + %x = OpVariable %_ptr_Function_float Function %16 + OpStore %x %float_1 + %21 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %22 = OpLoad %float %21 + %24 = OpFOrdLessThan %bool %22 %float_0 + OpSelectionMerge %26 None + OpBranchConditional %24 %27 %26 + %27 = OpLabel + OpStore %x %float_0_5 + OpBranch %26 + %26 = OpLabel + %29 = OpLoad %float %x + %30 = OpCompositeConstruct %v4float %29 %float_0 %float_0 %float_1 + OpReturnValue %30 + OpFunctionEnd + %main_1 = OpFunction %void None %31 + %34 = OpLabel + OpStore %x_GLF_color %35 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpFunctionCall %v4float %func_ + OpStore %x_GLF_color %40 + OpSelectionMerge %42 None + OpBranchConditional %false %43 %44 + %43 = OpLabel + OpBranch %42 + %44 = OpLabel + OpBranch %37 + %42 = OpLabel + OpBranch %38 + %38 = OpLabel + OpBranch %36 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %45 +%tint_symbol_1 = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %31 + %52 = OpLabel + %53 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %53 + %54 = OpFunctionCall %void %main_1 + %56 = OpLoad %v4float %x_GLF_color + %57 = OpCompositeConstruct %main_out %56 + %55 = OpFunctionCall %void %tint_symbol_3 %57 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..7d42f20fec --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-empty-block/0-opt.wgsl.expected.wgsl @@ -0,0 +1,39 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn func_() -> vec4 { + var x : f32; + x = 1.0; + let x_30 : f32 = gl_FragCoord.x; + if ((x_30 < 0.0)) { + x = 0.5; + } + let x_34 : f32 = x; + return vec4(x_34, 0.0, 0.0, 1.0); +} + +fn main_1() { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + loop { + let x_26 : vec4 = func_(); + x_GLF_color = x_26; + if (false) { + } else { + break; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm new file mode 100644 index 0000000000..7abcce908d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm @@ -0,0 +1,93 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %returnRed_ "returnRed(" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %11 = OpTypeFunction %v4float + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %20 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %26 = OpUndef %v4float + %27 = OpUndef %bool + %main = OpFunction %void None %8 + %28 = OpLabel + OpBranch %29 + %29 = OpLabel + %30 = OpFunctionCall %v4float %returnRed_ + OpStore %_GLF_color %30 + OpLoopMerge %31 %29 None + OpBranchConditional %false %29 %31 + %31 = OpLabel + OpReturn + OpFunctionEnd + %returnRed_ = OpFunction %v4float None %11 + %32 = OpLabel + %33 = OpVariable %_ptr_Function_bool Function %false + %34 = OpVariable %_ptr_Function_v4float Function + OpBranch %35 + %35 = OpLabel + %36 = OpPhi %bool %false %32 %27 %37 + OpLoopMerge %38 %37 None + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %44 = OpLoad %int %43 + %45 = OpIEqual %bool %44 %int_1 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + OpStore %33 %true + OpStore %34 %20 + OpBranch %40 + %46 = OpLabel + OpBranch %41 + %41 = OpLabel + OpBranchConditional %false %39 %40 + %40 = OpLabel + %48 = OpPhi %v4float %20 %47 %26 %41 + %49 = OpPhi %bool %true %47 %false %41 + OpSelectionMerge %50 None + OpBranchConditional %49 %38 %50 + %50 = OpLabel + OpStore %33 %true + OpStore %34 %20 + OpBranch %38 + %37 = OpLabel + OpBranch %35 + %38 = OpLabel + %51 = OpPhi %v4float %48 %40 %20 %50 + OpReturnValue %51 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..e3f6afa45a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.hlsl @@ -0,0 +1,76 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float4 returnRed_() { + bool x_33 = false; + float4 x_34 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_48 = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_36_phi = false; + float4 x_51_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_36_phi = false; + while (true) { + float4 x_48_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_49_phi = false; + const bool x_36 = x_36_phi; + while (true) { + const int x_44 = asint(x_6[0].x); + if ((x_44 == 1)) { + x_33 = true; + x_34 = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_48_phi = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_49_phi = true; + break; + } + { + x_48_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_49_phi = false; + if (false) { + } else { + break; + } + } + } + x_48 = x_48_phi; + const bool x_49 = x_49_phi; + x_51_phi = x_48; + if (x_49) { + break; + } + x_33 = true; + x_34 = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_51_phi = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + { + x_36_phi = false; + } + } + return x_51_phi; +} + +void main_1() { + while (true) { + const float4 x_30 = returnRed_(); + x_GLF_color = x_30; + if (false) { + } else { + break; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..241c4bb8b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.msl @@ -0,0 +1,80 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float4 returnRed_(constant buf0& x_6) { + bool x_33 = false; + float4 x_34 = 0.0f; + float4 x_48 = 0.0f; + bool x_36_phi = false; + float4 x_51_phi = 0.0f; + x_36_phi = false; + while (true) { + float4 x_48_phi = 0.0f; + bool x_49_phi = false; + bool const x_36 = x_36_phi; + while (true) { + int const x_44 = x_6.zero; + if ((x_44 == 1)) { + x_33 = true; + x_34 = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_48_phi = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_49_phi = true; + break; + } + { + x_48_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_49_phi = false; + if (false) { + } else { + break; + } + } + } + x_48 = x_48_phi; + bool const x_49 = x_49_phi; + x_51_phi = x_48; + if (x_49) { + break; + } + x_33 = true; + x_34 = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_51_phi = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + { + x_36_phi = false; + } + } + float4 const x_51 = x_51_phi; + return x_51; +} + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + while (true) { + float4 const x_30 = returnRed_(x_6); + *(tint_symbol_4) = x_30; + if (false) { + } else { + break; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..bc45980b6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.spvasm @@ -0,0 +1,175 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 83 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %returnRed_ "returnRed_" + OpName %x_33 "x_33" + OpName %x_34 "x_34" + OpName %x_48 "x_48" + OpName %x_36_phi "x_36_phi" + OpName %x_51_phi "x_51_phi" + OpName %x_48_phi "x_48_phi" + OpName %x_49_phi "x_49_phi" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %12 = OpTypeFunction %v4float + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %19 = OpConstantNull %bool +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %49 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %void = OpTypeVoid + %59 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %71 = OpTypeFunction %void %main_out + %returnRed_ = OpFunction %v4float None %12 + %14 = OpLabel + %x_33 = OpVariable %_ptr_Function_bool Function %19 + %x_34 = OpVariable %_ptr_Function_v4float Function %9 + %x_48 = OpVariable %_ptr_Function_v4float Function %9 + %x_36_phi = OpVariable %_ptr_Function_bool Function %19 + %x_51_phi = OpVariable %_ptr_Function_v4float Function %9 + %x_48_phi = OpVariable %_ptr_Function_v4float Function %9 + %x_49_phi = OpVariable %_ptr_Function_bool Function %19 + OpStore %x_33 %false + OpStore %x_36_phi %false + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %31 = OpLoad %bool %x_36_phi + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %40 = OpLoad %int %39 + %42 = OpIEqual %bool %40 %int_1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpStore %x_33 %true + OpStore %x_34 %48 + OpStore %x_48_phi %48 + OpStore %x_49_phi %true + OpBranch %33 + %43 = OpLabel + OpBranch %34 + %34 = OpLabel + OpStore %x_48_phi %49 + OpStore %x_49_phi %false + OpSelectionMerge %50 None + OpBranchConditional %false %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %33 + %50 = OpLabel + OpBranch %32 + %33 = OpLabel + %53 = OpLoad %v4float %x_48_phi + OpStore %x_48 %53 + %54 = OpLoad %bool %x_49_phi + %55 = OpLoad %v4float %x_48 + OpStore %x_51_phi %55 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + OpBranch %26 + %56 = OpLabel + OpStore %x_33 %true + OpStore %x_34 %48 + OpStore %x_51_phi %48 + OpBranch %26 + %27 = OpLabel + OpStore %x_36_phi %false + OpBranch %25 + %26 = OpLabel + %58 = OpLoad %v4float %x_51_phi + OpReturnValue %58 + OpFunctionEnd + %main_1 = OpFunction %void None %59 + %62 = OpLabel + OpBranch %63 + %63 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpFunctionCall %v4float %returnRed_ + OpStore %x_GLF_color %67 + OpSelectionMerge %68 None + OpBranchConditional %false %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %64 + %68 = OpLabel + OpBranch %65 + %65 = OpLabel + OpBranch %63 + %64 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %71 +%tint_symbol = OpFunctionParameter %main_out + %75 = OpLabel + %76 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %76 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %59 + %78 = OpLabel + %79 = OpFunctionCall %void %main_1 + %81 = OpLoad %v4float %x_GLF_color + %82 = OpCompositeConstruct %main_out %81 + %80 = OpFunctionCall %void %tint_symbol_2 %82 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 34[%34] is not post dominated by the back-edge block 50[%50] + %50 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c24e92c6ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.spvasm.expected.wgsl @@ -0,0 +1,80 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn returnRed_() -> vec4 { + var x_33 : bool = false; + var x_34 : vec4; + var x_48 : vec4; + var x_36_phi : bool; + var x_51_phi : vec4; + x_36_phi = false; + loop { + var x_48_phi : vec4; + var x_49_phi : bool; + let x_36 : bool = x_36_phi; + loop { + let x_44 : i32 = x_6.zero; + if ((x_44 == 1)) { + x_33 = true; + x_34 = vec4(1.0, 0.0, 0.0, 1.0); + x_48_phi = vec4(1.0, 0.0, 0.0, 1.0); + x_49_phi = true; + break; + } + + continuing { + x_48_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_49_phi = false; + if (false) { + } else { + break; + } + } + } + x_48 = x_48_phi; + let x_49 : bool = x_49_phi; + x_51_phi = x_48; + if (x_49) { + break; + } + x_33 = true; + x_34 = vec4(1.0, 0.0, 0.0, 1.0); + x_51_phi = vec4(1.0, 0.0, 0.0, 1.0); + break; + + continuing { + x_36_phi = false; + } + } + let x_51 : vec4 = x_51_phi; + return x_51; +} + +fn main_1() { + loop { + let x_30 : vec4 = returnRed_(); + x_GLF_color = x_30; + if (false) { + } else { + break; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl new file mode 100644 index 0000000000..c24e92c6ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl @@ -0,0 +1,80 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn returnRed_() -> vec4 { + var x_33 : bool = false; + var x_34 : vec4; + var x_48 : vec4; + var x_36_phi : bool; + var x_51_phi : vec4; + x_36_phi = false; + loop { + var x_48_phi : vec4; + var x_49_phi : bool; + let x_36 : bool = x_36_phi; + loop { + let x_44 : i32 = x_6.zero; + if ((x_44 == 1)) { + x_33 = true; + x_34 = vec4(1.0, 0.0, 0.0, 1.0); + x_48_phi = vec4(1.0, 0.0, 0.0, 1.0); + x_49_phi = true; + break; + } + + continuing { + x_48_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_49_phi = false; + if (false) { + } else { + break; + } + } + } + x_48 = x_48_phi; + let x_49 : bool = x_49_phi; + x_51_phi = x_48; + if (x_49) { + break; + } + x_33 = true; + x_34 = vec4(1.0, 0.0, 0.0, 1.0); + x_51_phi = vec4(1.0, 0.0, 0.0, 1.0); + break; + + continuing { + x_36_phi = false; + } + } + let x_51 : vec4 = x_51_phi; + return x_51; +} + +fn main_1() { + loop { + let x_30 : vec4 = returnRed_(); + x_GLF_color = x_30; + if (false) { + } else { + break; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..e3f6afa45a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.hlsl @@ -0,0 +1,76 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float4 returnRed_() { + bool x_33 = false; + float4 x_34 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_48 = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_36_phi = false; + float4 x_51_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_36_phi = false; + while (true) { + float4 x_48_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_49_phi = false; + const bool x_36 = x_36_phi; + while (true) { + const int x_44 = asint(x_6[0].x); + if ((x_44 == 1)) { + x_33 = true; + x_34 = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_48_phi = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_49_phi = true; + break; + } + { + x_48_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_49_phi = false; + if (false) { + } else { + break; + } + } + } + x_48 = x_48_phi; + const bool x_49 = x_49_phi; + x_51_phi = x_48; + if (x_49) { + break; + } + x_33 = true; + x_34 = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_51_phi = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + { + x_36_phi = false; + } + } + return x_51_phi; +} + +void main_1() { + while (true) { + const float4 x_30 = returnRed_(); + x_GLF_color = x_30; + if (false) { + } else { + break; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..241c4bb8b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.msl @@ -0,0 +1,80 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float4 returnRed_(constant buf0& x_6) { + bool x_33 = false; + float4 x_34 = 0.0f; + float4 x_48 = 0.0f; + bool x_36_phi = false; + float4 x_51_phi = 0.0f; + x_36_phi = false; + while (true) { + float4 x_48_phi = 0.0f; + bool x_49_phi = false; + bool const x_36 = x_36_phi; + while (true) { + int const x_44 = x_6.zero; + if ((x_44 == 1)) { + x_33 = true; + x_34 = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_48_phi = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_49_phi = true; + break; + } + { + x_48_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_49_phi = false; + if (false) { + } else { + break; + } + } + } + x_48 = x_48_phi; + bool const x_49 = x_49_phi; + x_51_phi = x_48; + if (x_49) { + break; + } + x_33 = true; + x_34 = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_51_phi = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + { + x_36_phi = false; + } + } + float4 const x_51 = x_51_phi; + return x_51; +} + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + while (true) { + float4 const x_30 = returnRed_(x_6); + *(tint_symbol_4) = x_30; + if (false) { + } else { + break; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc45980b6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.spvasm @@ -0,0 +1,175 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 83 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %returnRed_ "returnRed_" + OpName %x_33 "x_33" + OpName %x_34 "x_34" + OpName %x_48 "x_48" + OpName %x_36_phi "x_36_phi" + OpName %x_51_phi "x_51_phi" + OpName %x_48_phi "x_48_phi" + OpName %x_49_phi "x_49_phi" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %12 = OpTypeFunction %v4float + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %19 = OpConstantNull %bool +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %49 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %void = OpTypeVoid + %59 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %71 = OpTypeFunction %void %main_out + %returnRed_ = OpFunction %v4float None %12 + %14 = OpLabel + %x_33 = OpVariable %_ptr_Function_bool Function %19 + %x_34 = OpVariable %_ptr_Function_v4float Function %9 + %x_48 = OpVariable %_ptr_Function_v4float Function %9 + %x_36_phi = OpVariable %_ptr_Function_bool Function %19 + %x_51_phi = OpVariable %_ptr_Function_v4float Function %9 + %x_48_phi = OpVariable %_ptr_Function_v4float Function %9 + %x_49_phi = OpVariable %_ptr_Function_bool Function %19 + OpStore %x_33 %false + OpStore %x_36_phi %false + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %31 = OpLoad %bool %x_36_phi + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %40 = OpLoad %int %39 + %42 = OpIEqual %bool %40 %int_1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpStore %x_33 %true + OpStore %x_34 %48 + OpStore %x_48_phi %48 + OpStore %x_49_phi %true + OpBranch %33 + %43 = OpLabel + OpBranch %34 + %34 = OpLabel + OpStore %x_48_phi %49 + OpStore %x_49_phi %false + OpSelectionMerge %50 None + OpBranchConditional %false %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %33 + %50 = OpLabel + OpBranch %32 + %33 = OpLabel + %53 = OpLoad %v4float %x_48_phi + OpStore %x_48 %53 + %54 = OpLoad %bool %x_49_phi + %55 = OpLoad %v4float %x_48 + OpStore %x_51_phi %55 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + OpBranch %26 + %56 = OpLabel + OpStore %x_33 %true + OpStore %x_34 %48 + OpStore %x_51_phi %48 + OpBranch %26 + %27 = OpLabel + OpStore %x_36_phi %false + OpBranch %25 + %26 = OpLabel + %58 = OpLoad %v4float %x_51_phi + OpReturnValue %58 + OpFunctionEnd + %main_1 = OpFunction %void None %59 + %62 = OpLabel + OpBranch %63 + %63 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpFunctionCall %v4float %returnRed_ + OpStore %x_GLF_color %67 + OpSelectionMerge %68 None + OpBranchConditional %false %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %64 + %68 = OpLabel + OpBranch %65 + %65 = OpLabel + OpBranch %63 + %64 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %71 +%tint_symbol = OpFunctionParameter %main_out + %75 = OpLabel + %76 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %76 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %59 + %78 = OpLabel + %79 = OpFunctionCall %void %main_1 + %81 = OpLoad %v4float %x_GLF_color + %82 = OpCompositeConstruct %main_out %81 + %80 = OpFunctionCall %void %tint_symbol_2 %82 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 34[%34] is not post dominated by the back-edge block 50[%50] + %50 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c24e92c6ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-nested-loops/0-opt.wgsl.expected.wgsl @@ -0,0 +1,80 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn returnRed_() -> vec4 { + var x_33 : bool = false; + var x_34 : vec4; + var x_48 : vec4; + var x_36_phi : bool; + var x_51_phi : vec4; + x_36_phi = false; + loop { + var x_48_phi : vec4; + var x_49_phi : bool; + let x_36 : bool = x_36_phi; + loop { + let x_44 : i32 = x_6.zero; + if ((x_44 == 1)) { + x_33 = true; + x_34 = vec4(1.0, 0.0, 0.0, 1.0); + x_48_phi = vec4(1.0, 0.0, 0.0, 1.0); + x_49_phi = true; + break; + } + + continuing { + x_48_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_49_phi = false; + if (false) { + } else { + break; + } + } + } + x_48 = x_48_phi; + let x_49 : bool = x_49_phi; + x_51_phi = x_48; + if (x_49) { + break; + } + x_33 = true; + x_34 = vec4(1.0, 0.0, 0.0, 1.0); + x_51_phi = vec4(1.0, 0.0, 0.0, 1.0); + break; + + continuing { + x_36_phi = false; + } + } + let x_51 : vec4 = x_51_phi; + return x_51; +} + +fn main_1() { + loop { + let x_30 : vec4 = returnRed_(); + x_GLF_color = x_30; + if (false) { + } else { + break; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm new file mode 100644 index 0000000000..c218332657 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm @@ -0,0 +1,84 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %9 = OpTypeFunction %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_5 = OpConstant %int 5 + %int_1 = OpConstant %int 1 + %int_8 = OpConstant %int 8 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %false = OpConstantFalse %bool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %7 + %24 = OpLabel + OpSelectionMerge %25 None + OpBranchConditional %false %26 %27 + %26 = OpLabel + %28 = OpFunctionCall %float %func_ + %29 = OpCompositeConstruct %v4float %28 %28 %28 %28 + OpStore %_GLF_color %29 + OpBranch %25 + %27 = OpLabel + OpStore %_GLF_color %23 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %float None %9 + %30 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %int %i + %36 = OpSLessThan %bool %35 %int_10 + OpBranchConditional %36 %37 %32 + %37 = OpLabel + %38 = OpLoad %int %i + %39 = OpSGreaterThan %bool %38 %int_5 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + %42 = OpLoad %int %i + %43 = OpIAdd %int %42 %int_1 + OpStore %i %43 + OpBranch %40 + %40 = OpLabel + %44 = OpLoad %int %i + %45 = OpSGreaterThan %bool %44 %int_8 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + OpReturnValue %float_0 + %46 = OpLabel + OpBranch %33 + %33 = OpLabel + %48 = OpLoad %int %i + %49 = OpIAdd %int %48 %int_1 + OpStore %i %49 + OpBranch %31 + %32 = OpLabel + OpReturnValue %float_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..4dcae3d494 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,41 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_() { + int i = 0; + i = 0; + { + for(; (i < 10); i = (i + 1)) { + if ((i > 5)) { + i = (i + 1); + } + if ((i > 8)) { + return 0.0f; + } + } + } + return 1.0f; +} + +void main_1() { + if (false) { + const float x_28 = func_(); + x_GLF_color = float4(x_28, x_28, x_28, x_28); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..5b389f37c6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_() { + int i = 0; + i = 0; + while (true) { + int const x_35 = i; + if ((x_35 < 10)) { + } else { + break; + } + int const x_38 = i; + if ((x_38 > 5)) { + int const x_42 = i; + i = (x_42 + 1); + } + int const x_44 = i; + if ((x_44 > 8)) { + return 0.0f; + } + { + int const x_48 = i; + i = (x_48 + 1); + } + } + return 1.0f; +} + +void main_1(thread float4* const tint_symbol_4) { + if (false) { + float const x_28 = func_(); + *(tint_symbol_4) = float4(x_28, x_28, x_28, x_28); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f2a69e2277 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,120 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %i "i" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %8 = OpTypeFunction %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_5 = OpConstant %int 5 + %int_1 = OpConstant %int 1 + %int_8 = OpConstant %int 8 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %void = OpTypeVoid + %44 = OpTypeFunction %void + %false = OpConstantFalse %bool + %54 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %8 + %10 = OpLabel + %i = OpVariable %_ptr_Function_int Function %14 + OpStore %i %int_0 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %20 = OpLoad %int %i + %22 = OpSLessThan %bool %20 %int_10 + OpSelectionMerge %24 None + OpBranchConditional %22 %25 %26 + %25 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %17 + %24 = OpLabel + %27 = OpLoad %int %i + %29 = OpSGreaterThan %bool %27 %int_5 + OpSelectionMerge %30 None + OpBranchConditional %29 %31 %30 + %31 = OpLabel + %32 = OpLoad %int %i + %34 = OpIAdd %int %32 %int_1 + OpStore %i %34 + OpBranch %30 + %30 = OpLabel + %35 = OpLoad %int %i + %37 = OpSGreaterThan %bool %35 %int_8 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %38 + %39 = OpLabel + OpReturnValue %float_0 + %38 = OpLabel + OpBranch %18 + %18 = OpLabel + %41 = OpLoad %int %i + %42 = OpIAdd %int %41 %int_1 + OpStore %i %42 + OpBranch %16 + %17 = OpLabel + OpReturnValue %float_1 + OpFunctionEnd + %main_1 = OpFunction %void None %44 + %47 = OpLabel + OpSelectionMerge %49 None + OpBranchConditional %false %50 %51 + %50 = OpLabel + %52 = OpFunctionCall %float %func_ + %53 = OpCompositeConstruct %v4float %52 %52 %52 %52 + OpStore %x_GLF_color %53 + OpBranch %49 + %51 = OpLabel + OpStore %x_GLF_color %54 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %44 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c5a9a86a5f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,49 @@ +var x_GLF_color : vec4; + +fn func_() -> f32 { + var i : i32; + i = 0; + loop { + let x_35 : i32 = i; + if ((x_35 < 10)) { + } else { + break; + } + let x_38 : i32 = i; + if ((x_38 > 5)) { + let x_42 : i32 = i; + i = (x_42 + 1); + } + let x_44 : i32 = i; + if ((x_44 > 8)) { + return 0.0; + } + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + return 1.0; +} + +fn main_1() { + if (false) { + let x_28 : f32 = func_(); + x_GLF_color = vec4(x_28, x_28, x_28, x_28); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl new file mode 100644 index 0000000000..c5a9a86a5f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl @@ -0,0 +1,49 @@ +var x_GLF_color : vec4; + +fn func_() -> f32 { + var i : i32; + i = 0; + loop { + let x_35 : i32 = i; + if ((x_35 < 10)) { + } else { + break; + } + let x_38 : i32 = i; + if ((x_38 > 5)) { + let x_42 : i32 = i; + i = (x_42 + 1); + } + let x_44 : i32 = i; + if ((x_44 > 8)) { + return 0.0; + } + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + return 1.0; +} + +fn main_1() { + if (false) { + let x_28 : f32 = func_(); + x_GLF_color = vec4(x_28, x_28, x_28, x_28); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..4dcae3d494 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_() { + int i = 0; + i = 0; + { + for(; (i < 10); i = (i + 1)) { + if ((i > 5)) { + i = (i + 1); + } + if ((i > 8)) { + return 0.0f; + } + } + } + return 1.0f; +} + +void main_1() { + if (false) { + const float x_28 = func_(); + x_GLF_color = float4(x_28, x_28, x_28, x_28); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..5b389f37c6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_() { + int i = 0; + i = 0; + while (true) { + int const x_35 = i; + if ((x_35 < 10)) { + } else { + break; + } + int const x_38 = i; + if ((x_38 > 5)) { + int const x_42 = i; + i = (x_42 + 1); + } + int const x_44 = i; + if ((x_44 > 8)) { + return 0.0f; + } + { + int const x_48 = i; + i = (x_48 + 1); + } + } + return 1.0f; +} + +void main_1(thread float4* const tint_symbol_4) { + if (false) { + float const x_28 = func_(); + *(tint_symbol_4) = float4(x_28, x_28, x_28, x_28); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f2a69e2277 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,120 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %i "i" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %8 = OpTypeFunction %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_5 = OpConstant %int 5 + %int_1 = OpConstant %int 1 + %int_8 = OpConstant %int 8 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %void = OpTypeVoid + %44 = OpTypeFunction %void + %false = OpConstantFalse %bool + %54 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %8 + %10 = OpLabel + %i = OpVariable %_ptr_Function_int Function %14 + OpStore %i %int_0 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %20 = OpLoad %int %i + %22 = OpSLessThan %bool %20 %int_10 + OpSelectionMerge %24 None + OpBranchConditional %22 %25 %26 + %25 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %17 + %24 = OpLabel + %27 = OpLoad %int %i + %29 = OpSGreaterThan %bool %27 %int_5 + OpSelectionMerge %30 None + OpBranchConditional %29 %31 %30 + %31 = OpLabel + %32 = OpLoad %int %i + %34 = OpIAdd %int %32 %int_1 + OpStore %i %34 + OpBranch %30 + %30 = OpLabel + %35 = OpLoad %int %i + %37 = OpSGreaterThan %bool %35 %int_8 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %38 + %39 = OpLabel + OpReturnValue %float_0 + %38 = OpLabel + OpBranch %18 + %18 = OpLabel + %41 = OpLoad %int %i + %42 = OpIAdd %int %41 %int_1 + OpStore %i %42 + OpBranch %16 + %17 = OpLabel + OpReturnValue %float_1 + OpFunctionEnd + %main_1 = OpFunction %void None %44 + %47 = OpLabel + OpSelectionMerge %49 None + OpBranchConditional %false %50 %51 + %50 = OpLabel + %52 = OpFunctionCall %float %func_ + %53 = OpCompositeConstruct %v4float %52 %52 %52 %52 + OpStore %x_GLF_color %53 + OpBranch %49 + %51 = OpLabel + OpStore %x_GLF_color %54 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %44 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c5a9a86a5f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-return-in-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,49 @@ +var x_GLF_color : vec4; + +fn func_() -> f32 { + var i : i32; + i = 0; + loop { + let x_35 : i32 = i; + if ((x_35 < 10)) { + } else { + break; + } + let x_38 : i32 = i; + if ((x_38 > 5)) { + let x_42 : i32 = i; + i = (x_42 + 1); + } + let x_44 : i32 = i; + if ((x_44 > 8)) { + return 0.0; + } + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + return 1.0; +} + +fn main_1() { + if (false) { + let x_28 : f32 = func_(); + x_GLF_color = vec4(x_28, x_28, x_28, x_28); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm new file mode 100644 index 0000000000..7c4c7652c7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm @@ -0,0 +1,76 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %x "x" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %10 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %float_2 = OpConstant %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_12 = OpConstant %float 12 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %float_13 = OpConstant %float 13 + %float_1 = OpConstant %float 1 + %false = OpConstantFalse %bool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %8 + %27 = OpLabel + OpSelectionMerge %28 None + OpBranchConditional %false %29 %30 + %29 = OpLabel + %31 = OpFunctionCall %float %func_ + %32 = OpCompositeConstruct %v4float %31 %31 %31 %31 + OpStore %_GLF_color %32 + OpBranch %28 + %30 = OpLabel + OpStore %_GLF_color %26 + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %float None %10 + %33 = OpLabel + %x = OpVariable %_ptr_Function_float Function + OpStore %x %float_2 + %34 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %35 = OpLoad %float %34 + %36 = OpFOrdEqual %bool %35 %float_12 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %40 = OpLoad %float %39 + %41 = OpFOrdEqual %bool %40 %float_13 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + %44 = OpLoad %float %x + %45 = OpFAdd %float %44 %float_1 + OpStore %x %45 + OpBranch %42 + %42 = OpLabel + %46 = OpLoad %float %x + OpReturnValue %46 + %37 = OpLabel + OpReturnValue %float_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..e579458baa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.hlsl @@ -0,0 +1,45 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_() { + float x = 0.0f; + x = 2.0f; + const float x_35 = gl_FragCoord.x; + if ((x_35 == 12.0f)) { + const float x_40 = gl_FragCoord.y; + if ((x_40 == 13.0f)) { + x = (x + 1.0f); + } + return x; + } + return 1.0f; +} + +void main_1() { + if (false) { + const float x_31 = func_(); + x_GLF_color = float4(x_31, x_31, x_31, x_31); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..019020d7ef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_(thread float4* const tint_symbol_5) { + float x = 0.0f; + x = 2.0f; + float const x_35 = (*(tint_symbol_5)).x; + if ((x_35 == 12.0f)) { + float const x_40 = (*(tint_symbol_5)).y; + if ((x_40 == 13.0f)) { + float const x_44 = x; + x = (x_44 + 1.0f); + } + float const x_46 = x; + return x_46; + } + return 1.0f; +} + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + if (false) { + float const x_31 = func_(tint_symbol_6); + *(tint_symbol_7) = float4(x_31, x_31, x_31, x_31); + } else { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..eaaf4486cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.spvasm @@ -0,0 +1,111 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_ "func_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %11 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpConstantNull %float + %float_2 = OpConstant %float 2 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_12 = OpConstant %float 12 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %float_13 = OpConstant %float 13 + %float_1 = OpConstant %float 1 + %void = OpTypeVoid + %39 = OpTypeFunction %void + %false = OpConstantFalse %bool + %float_0 = OpConstant %float 0 + %50 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %51 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %11 + %13 = OpLabel + %x = OpVariable %_ptr_Function_float Function %16 + OpStore %x %float_2 + %21 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %22 = OpLoad %float %21 + %24 = OpFOrdEqual %bool %22 %float_12 + OpSelectionMerge %26 None + OpBranchConditional %24 %27 %26 + %27 = OpLabel + %29 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %30 = OpLoad %float %29 + %32 = OpFOrdEqual %bool %30 %float_13 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %33 + %34 = OpLabel + %35 = OpLoad %float %x + %37 = OpFAdd %float %35 %float_1 + OpStore %x %37 + OpBranch %33 + %33 = OpLabel + %38 = OpLoad %float %x + OpReturnValue %38 + %26 = OpLabel + OpReturnValue %float_1 + OpFunctionEnd + %main_1 = OpFunction %void None %39 + %42 = OpLabel + OpSelectionMerge %44 None + OpBranchConditional %false %45 %46 + %45 = OpLabel + %47 = OpFunctionCall %float %func_ + %48 = OpCompositeConstruct %v4float %47 %47 %47 %47 + OpStore %x_GLF_color %48 + OpBranch %44 + %46 = OpLabel + OpStore %x_GLF_color %50 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %51 +%tint_symbol_1 = OpFunctionParameter %main_out + %55 = OpLabel + %56 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %56 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %39 + %58 = OpLabel + %59 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %59 + %60 = OpFunctionCall %void %main_1 + %62 = OpLoad %v4float %x_GLF_color + %63 = OpCompositeConstruct %main_out %62 + %61 = OpFunctionCall %void %tint_symbol_3 %63 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..cf1481af0b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.spvasm.expected.wgsl @@ -0,0 +1,41 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var x : f32; + x = 2.0; + let x_35 : f32 = gl_FragCoord.x; + if ((x_35 == 12.0)) { + let x_40 : f32 = gl_FragCoord.y; + if ((x_40 == 13.0)) { + let x_44 : f32 = x; + x = (x_44 + 1.0); + } + let x_46 : f32 = x; + return x_46; + } + return 1.0; +} + +fn main_1() { + if (false) { + let x_31 : f32 = func_(); + x_GLF_color = vec4(x_31, x_31, x_31, x_31); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl new file mode 100644 index 0000000000..cf1481af0b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl @@ -0,0 +1,41 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var x : f32; + x = 2.0; + let x_35 : f32 = gl_FragCoord.x; + if ((x_35 == 12.0)) { + let x_40 : f32 = gl_FragCoord.y; + if ((x_40 == 13.0)) { + let x_44 : f32 = x; + x = (x_44 + 1.0); + } + let x_46 : f32 = x; + return x_46; + } + return 1.0; +} + +fn main_1() { + if (false) { + let x_31 : f32 = func_(); + x_GLF_color = vec4(x_31, x_31, x_31, x_31); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..e579458baa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.hlsl @@ -0,0 +1,45 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_() { + float x = 0.0f; + x = 2.0f; + const float x_35 = gl_FragCoord.x; + if ((x_35 == 12.0f)) { + const float x_40 = gl_FragCoord.y; + if ((x_40 == 13.0f)) { + x = (x + 1.0f); + } + return x; + } + return 1.0f; +} + +void main_1() { + if (false) { + const float x_31 = func_(); + x_GLF_color = float4(x_31, x_31, x_31, x_31); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..019020d7ef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_(thread float4* const tint_symbol_5) { + float x = 0.0f; + x = 2.0f; + float const x_35 = (*(tint_symbol_5)).x; + if ((x_35 == 12.0f)) { + float const x_40 = (*(tint_symbol_5)).y; + if ((x_40 == 13.0f)) { + float const x_44 = x; + x = (x_44 + 1.0f); + } + float const x_46 = x; + return x_46; + } + return 1.0f; +} + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + if (false) { + float const x_31 = func_(tint_symbol_6); + *(tint_symbol_7) = float4(x_31, x_31, x_31, x_31); + } else { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..eaaf4486cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.spvasm @@ -0,0 +1,111 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_ "func_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %11 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpConstantNull %float + %float_2 = OpConstant %float 2 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_12 = OpConstant %float 12 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %float_13 = OpConstant %float 13 + %float_1 = OpConstant %float 1 + %void = OpTypeVoid + %39 = OpTypeFunction %void + %false = OpConstantFalse %bool + %float_0 = OpConstant %float 0 + %50 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %51 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %11 + %13 = OpLabel + %x = OpVariable %_ptr_Function_float Function %16 + OpStore %x %float_2 + %21 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %22 = OpLoad %float %21 + %24 = OpFOrdEqual %bool %22 %float_12 + OpSelectionMerge %26 None + OpBranchConditional %24 %27 %26 + %27 = OpLabel + %29 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %30 = OpLoad %float %29 + %32 = OpFOrdEqual %bool %30 %float_13 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %33 + %34 = OpLabel + %35 = OpLoad %float %x + %37 = OpFAdd %float %35 %float_1 + OpStore %x %37 + OpBranch %33 + %33 = OpLabel + %38 = OpLoad %float %x + OpReturnValue %38 + %26 = OpLabel + OpReturnValue %float_1 + OpFunctionEnd + %main_1 = OpFunction %void None %39 + %42 = OpLabel + OpSelectionMerge %44 None + OpBranchConditional %false %45 %46 + %45 = OpLabel + %47 = OpFunctionCall %float %func_ + %48 = OpCompositeConstruct %v4float %47 %47 %47 %47 + OpStore %x_GLF_color %48 + OpBranch %44 + %46 = OpLabel + OpStore %x_GLF_color %50 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %51 +%tint_symbol_1 = OpFunctionParameter %main_out + %55 = OpLabel + %56 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %56 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %39 + %58 = OpLabel + %59 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %59 + %60 = OpFunctionCall %void %main_1 + %62 = OpLoad %v4float %x_GLF_color + %63 = OpCompositeConstruct %main_out %62 + %61 = OpFunctionCall %void %tint_symbol_3 %63 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..cf1481af0b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inline-pass-unreachable-func/0-opt.wgsl.expected.wgsl @@ -0,0 +1,41 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var x : f32; + x = 2.0; + let x_35 : f32 = gl_FragCoord.x; + if ((x_35 == 12.0)) { + let x_40 : f32 = gl_FragCoord.y; + if ((x_40 == 13.0)) { + let x_44 : f32 = x; + x = (x_44 + 1.0); + } + let x_46 : f32 = x; + return x_46; + } + return 1.0; +} + +fn main_1() { + if (false) { + let x_31 : f32 = func_(); + x_GLF_color = vec4(x_31, x_31, x_31, x_31); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm new file mode 100644 index 0000000000..fa863d8893 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm @@ -0,0 +1,152 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %arr "arr" + OpName %a "a" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %15 + %38 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %arr = OpVariable %_ptr_Function__arr_int_uint_2 Function + %a = OpVariable %_ptr_Function_int Function + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %40 = OpLoad %int %39 + OpStore %i %40 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %int %i + %46 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %47 = OpLoad %int %46 + %48 = OpSLessThan %bool %45 %47 + OpBranchConditional %48 %49 %42 + %49 = OpLabel + %50 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Function_int %arr %50 + OpStore %53 %52 + OpBranch %43 + %43 = OpLabel + %54 = OpLoad %int %i + %55 = OpIAdd %int %54 %int_1 + OpStore %i %55 + OpBranch %41 + %42 = OpLabel + OpStore %a %int_n1 + %56 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %57 = OpLoad %float %56 + %58 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %59 = OpLoad %float %58 + %60 = OpFOrdLessThan %bool %57 %59 + %61 = OpLogicalNot %bool %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpLoad %int %a + %65 = OpIAdd %int %64 %int_1 + OpStore %a %65 + %66 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Function_int %arr %65 + OpStore %68 %67 + OpBranch %62 + %62 = OpLabel + %69 = OpLoad %int %a + %70 = OpIAdd %int %69 %int_1 + OpStore %a %70 + %71 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Function_int %arr %70 + OpStore %73 %72 + %74 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Function_int %arr %75 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpIEqual %bool %77 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %84 = OpLoad %int %a + %85 = OpConvertSToF %float %84 + %86 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %87 = OpLoad %int %86 + %88 = OpConvertSToF %float %87 + %89 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %90 = OpLoad %int %89 + %91 = OpConvertSToF %float %90 + %92 = OpLoad %int %a + %93 = OpConvertSToF %float %92 + %94 = OpCompositeConstruct %v4float %85 %88 %91 %93 + OpStore %_GLF_color %94 + OpBranch %81 + %83 = OpLabel + %95 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %96 = OpLoad %int %95 + %97 = OpConvertSToF %float %96 + %98 = OpCompositeConstruct %v4float %97 %97 %97 %97 + OpStore %_GLF_color %98 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..489e5a1b66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.hlsl @@ -0,0 +1,83 @@ +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int arr[2] = (int[2])0; + int a = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_40 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + i = x_40; + while (true) { + const int x_45 = i; + const int x_47 = asint(x_7[2].x); + if ((x_45 < x_47)) { + } else { + break; + } + const int x_50 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + arr[x_50] = x_52; + { + i = (i + 1); + } + } + a = -1; + const float x_57 = gl_FragCoord.y; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_59 = asfloat(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if (!((x_57 < x_59))) { + const int x_65 = (a + 1); + a = x_65; + const int x_67 = asint(x_7[1].x); + arr[x_65] = x_67; + } + const int x_70 = (a + 1); + a = x_70; + const int x_72 = asint(x_7[2].x); + arr[x_70] = x_72; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_75 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_77 = arr[x_75]; + const int x_79 = asint(x_7[1].x); + if ((x_77 == x_79)) { + const int x_84 = a; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_87 = asint(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_90 = asint(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(float(x_84), float(x_87), float(x_90), float(a)); + } else { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_96 = asint(x_7[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_97 = float(x_96); + x_GLF_color = float4(x_97, x_97, x_97, x_97); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..26ba969070 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.msl @@ -0,0 +1,96 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_11, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + tint_array_wrapper_2 arr = {}; + int a = 0; + int const x_40 = x_7.x_GLF_uniform_int_values.arr[0].el; + i = x_40; + while (true) { + int const x_45 = i; + int const x_47 = x_7.x_GLF_uniform_int_values.arr[2].el; + if ((x_45 < x_47)) { + } else { + break; + } + int const x_50 = i; + int const x_52 = x_7.x_GLF_uniform_int_values.arr[0].el; + arr.arr[x_50] = x_52; + { + int const x_54 = i; + i = (x_54 + 1); + } + } + a = -1; + float const x_57 = (*(tint_symbol_5)).y; + float const x_59 = x_11.x_GLF_uniform_float_values.arr[0].el; + if (!((x_57 < x_59))) { + int const x_64 = a; + int const x_65 = (x_64 + 1); + a = x_65; + int const x_67 = x_7.x_GLF_uniform_int_values.arr[1].el; + arr.arr[x_65] = x_67; + } + int const x_69 = a; + int const x_70 = (x_69 + 1); + a = x_70; + int const x_72 = x_7.x_GLF_uniform_int_values.arr[2].el; + arr.arr[x_70] = x_72; + int const x_75 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_77 = arr.arr[x_75]; + int const x_79 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_77 == x_79)) { + int const x_84 = a; + int const x_87 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_90 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_92 = a; + *(tint_symbol_6) = float4(float(x_84), float(x_87), float(x_90), float(x_92)); + } else { + int const x_96 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_97 = float(x_96); + *(tint_symbol_6) = float4(x_97, x_97, x_97, x_97); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_7 [[buffer(1)]], constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_11, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e953d6b318 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.spvasm @@ -0,0 +1,197 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 120 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %arr "arr" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %34 = OpConstantNull %_arr_int_uint_2 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %107 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %i = OpVariable %_ptr_Function_int Function %29 + %arr = OpVariable %_ptr_Function__arr_int_uint_2 Function %34 + %a = OpVariable %_ptr_Function_int Function %29 + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %40 = OpLoad %int %39 + OpStore %i %40 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %int %i + %47 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %48 = OpLoad %int %47 + %49 = OpSLessThan %bool %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %52 %53 + %52 = OpLabel + OpBranch %51 + %53 = OpLabel + OpBranch %42 + %51 = OpLabel + %54 = OpLoad %int %i + %55 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpAccessChain %_ptr_Function_int %arr %54 + OpStore %57 %56 + OpBranch %43 + %43 = OpLabel + %58 = OpLoad %int %i + %60 = OpIAdd %int %58 %int_1 + OpStore %i %60 + OpBranch %41 + %42 = OpLabel + OpStore %a %int_n1 + %63 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %64 = OpLoad %float %63 + %66 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %67 = OpLoad %float %66 + %69 = OpFOrdLessThan %bool %64 %67 + %68 = OpLogicalNot %bool %69 + OpSelectionMerge %70 None + OpBranchConditional %68 %71 %70 + %71 = OpLabel + %72 = OpLoad %int %a + %73 = OpIAdd %int %72 %int_1 + OpStore %a %73 + %74 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Function_int %arr %73 + OpStore %76 %75 + OpBranch %70 + %70 = OpLabel + %77 = OpLoad %int %a + %78 = OpIAdd %int %77 %int_1 + OpStore %a %78 + %79 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Function_int %arr %78 + OpStore %81 %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Function_int %arr %83 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpIEqual %bool %85 %87 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %91 + %90 = OpLabel + %92 = OpLoad %int %a + %93 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %96 = OpLoad %int %95 + %97 = OpLoad %int %a + %98 = OpConvertSToF %float %92 + %99 = OpConvertSToF %float %94 + %100 = OpConvertSToF %float %96 + %101 = OpConvertSToF %float %97 + %102 = OpCompositeConstruct %v4float %98 %99 %100 %101 + OpStore %x_GLF_color %102 + OpBranch %89 + %91 = OpLabel + %103 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %104 = OpLoad %int %103 + %105 = OpConvertSToF %float %104 + %106 = OpCompositeConstruct %v4float %105 %105 %105 %105 + OpStore %x_GLF_color %106 + OpBranch %89 + %89 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %107 +%tint_symbol_1 = OpFunctionParameter %main_out + %111 = OpLabel + %112 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %112 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %114 = OpLabel + %115 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %115 + %116 = OpFunctionCall %void %main_1 + %118 = OpLoad %v4float %x_GLF_color + %119 = OpCompositeConstruct %main_out %118 + %117 = OpFunctionCall %void %tint_symbol_3 %119 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..afe4b0ef5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.spvasm.expected.wgsl @@ -0,0 +1,87 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var arr : array; + var a : i32; + let x_40 : i32 = x_7.x_GLF_uniform_int_values[0]; + i = x_40; + loop { + let x_45 : i32 = i; + let x_47 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_45 < x_47)) { + } else { + break; + } + let x_50 : i32 = i; + let x_52 : i32 = x_7.x_GLF_uniform_int_values[0]; + arr[x_50] = x_52; + + continuing { + let x_54 : i32 = i; + i = (x_54 + 1); + } + } + a = -1; + let x_57 : f32 = gl_FragCoord.y; + let x_59 : f32 = x_11.x_GLF_uniform_float_values[0]; + if (!((x_57 < x_59))) { + let x_64 : i32 = a; + let x_65 : i32 = (x_64 + 1); + a = x_65; + let x_67 : i32 = x_7.x_GLF_uniform_int_values[1]; + arr[x_65] = x_67; + } + let x_69 : i32 = a; + let x_70 : i32 = (x_69 + 1); + a = x_70; + let x_72 : i32 = x_7.x_GLF_uniform_int_values[2]; + arr[x_70] = x_72; + let x_75 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_77 : i32 = arr[x_75]; + let x_79 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_77 == x_79)) { + let x_84 : i32 = a; + let x_87 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_90 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_92 : i32 = a; + x_GLF_color = vec4(f32(x_84), f32(x_87), f32(x_90), f32(x_92)); + } else { + let x_96 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_97 : f32 = f32(x_96); + x_GLF_color = vec4(x_97, x_97, x_97, x_97); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl new file mode 100644 index 0000000000..afe4b0ef5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl @@ -0,0 +1,87 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var arr : array; + var a : i32; + let x_40 : i32 = x_7.x_GLF_uniform_int_values[0]; + i = x_40; + loop { + let x_45 : i32 = i; + let x_47 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_45 < x_47)) { + } else { + break; + } + let x_50 : i32 = i; + let x_52 : i32 = x_7.x_GLF_uniform_int_values[0]; + arr[x_50] = x_52; + + continuing { + let x_54 : i32 = i; + i = (x_54 + 1); + } + } + a = -1; + let x_57 : f32 = gl_FragCoord.y; + let x_59 : f32 = x_11.x_GLF_uniform_float_values[0]; + if (!((x_57 < x_59))) { + let x_64 : i32 = a; + let x_65 : i32 = (x_64 + 1); + a = x_65; + let x_67 : i32 = x_7.x_GLF_uniform_int_values[1]; + arr[x_65] = x_67; + } + let x_69 : i32 = a; + let x_70 : i32 = (x_69 + 1); + a = x_70; + let x_72 : i32 = x_7.x_GLF_uniform_int_values[2]; + arr[x_70] = x_72; + let x_75 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_77 : i32 = arr[x_75]; + let x_79 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_77 == x_79)) { + let x_84 : i32 = a; + let x_87 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_90 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_92 : i32 = a; + x_GLF_color = vec4(f32(x_84), f32(x_87), f32(x_90), f32(x_92)); + } else { + let x_96 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_97 : f32 = f32(x_96); + x_GLF_color = vec4(x_97, x_97, x_97, x_97); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..489e5a1b66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.hlsl @@ -0,0 +1,83 @@ +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int arr[2] = (int[2])0; + int a = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_40 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + i = x_40; + while (true) { + const int x_45 = i; + const int x_47 = asint(x_7[2].x); + if ((x_45 < x_47)) { + } else { + break; + } + const int x_50 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + arr[x_50] = x_52; + { + i = (i + 1); + } + } + a = -1; + const float x_57 = gl_FragCoord.y; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_59 = asfloat(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if (!((x_57 < x_59))) { + const int x_65 = (a + 1); + a = x_65; + const int x_67 = asint(x_7[1].x); + arr[x_65] = x_67; + } + const int x_70 = (a + 1); + a = x_70; + const int x_72 = asint(x_7[2].x); + arr[x_70] = x_72; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_75 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_77 = arr[x_75]; + const int x_79 = asint(x_7[1].x); + if ((x_77 == x_79)) { + const int x_84 = a; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_87 = asint(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_90 = asint(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(float(x_84), float(x_87), float(x_90), float(a)); + } else { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_96 = asint(x_7[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_97 = float(x_96); + x_GLF_color = float4(x_97, x_97, x_97, x_97); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..26ba969070 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.msl @@ -0,0 +1,96 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_11, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + tint_array_wrapper_2 arr = {}; + int a = 0; + int const x_40 = x_7.x_GLF_uniform_int_values.arr[0].el; + i = x_40; + while (true) { + int const x_45 = i; + int const x_47 = x_7.x_GLF_uniform_int_values.arr[2].el; + if ((x_45 < x_47)) { + } else { + break; + } + int const x_50 = i; + int const x_52 = x_7.x_GLF_uniform_int_values.arr[0].el; + arr.arr[x_50] = x_52; + { + int const x_54 = i; + i = (x_54 + 1); + } + } + a = -1; + float const x_57 = (*(tint_symbol_5)).y; + float const x_59 = x_11.x_GLF_uniform_float_values.arr[0].el; + if (!((x_57 < x_59))) { + int const x_64 = a; + int const x_65 = (x_64 + 1); + a = x_65; + int const x_67 = x_7.x_GLF_uniform_int_values.arr[1].el; + arr.arr[x_65] = x_67; + } + int const x_69 = a; + int const x_70 = (x_69 + 1); + a = x_70; + int const x_72 = x_7.x_GLF_uniform_int_values.arr[2].el; + arr.arr[x_70] = x_72; + int const x_75 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_77 = arr.arr[x_75]; + int const x_79 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_77 == x_79)) { + int const x_84 = a; + int const x_87 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_90 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_92 = a; + *(tint_symbol_6) = float4(float(x_84), float(x_87), float(x_90), float(x_92)); + } else { + int const x_96 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_97 = float(x_96); + *(tint_symbol_6) = float4(x_97, x_97, x_97, x_97); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_7 [[buffer(1)]], constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_11, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e953d6b318 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.spvasm @@ -0,0 +1,197 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 120 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %arr "arr" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %34 = OpConstantNull %_arr_int_uint_2 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %107 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %i = OpVariable %_ptr_Function_int Function %29 + %arr = OpVariable %_ptr_Function__arr_int_uint_2 Function %34 + %a = OpVariable %_ptr_Function_int Function %29 + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %40 = OpLoad %int %39 + OpStore %i %40 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %int %i + %47 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %48 = OpLoad %int %47 + %49 = OpSLessThan %bool %45 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %52 %53 + %52 = OpLabel + OpBranch %51 + %53 = OpLabel + OpBranch %42 + %51 = OpLabel + %54 = OpLoad %int %i + %55 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpAccessChain %_ptr_Function_int %arr %54 + OpStore %57 %56 + OpBranch %43 + %43 = OpLabel + %58 = OpLoad %int %i + %60 = OpIAdd %int %58 %int_1 + OpStore %i %60 + OpBranch %41 + %42 = OpLabel + OpStore %a %int_n1 + %63 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %64 = OpLoad %float %63 + %66 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %67 = OpLoad %float %66 + %69 = OpFOrdLessThan %bool %64 %67 + %68 = OpLogicalNot %bool %69 + OpSelectionMerge %70 None + OpBranchConditional %68 %71 %70 + %71 = OpLabel + %72 = OpLoad %int %a + %73 = OpIAdd %int %72 %int_1 + OpStore %a %73 + %74 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Function_int %arr %73 + OpStore %76 %75 + OpBranch %70 + %70 = OpLabel + %77 = OpLoad %int %a + %78 = OpIAdd %int %77 %int_1 + OpStore %a %78 + %79 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Function_int %arr %78 + OpStore %81 %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Function_int %arr %83 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpIEqual %bool %85 %87 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %91 + %90 = OpLabel + %92 = OpLoad %int %a + %93 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %96 = OpLoad %int %95 + %97 = OpLoad %int %a + %98 = OpConvertSToF %float %92 + %99 = OpConvertSToF %float %94 + %100 = OpConvertSToF %float %96 + %101 = OpConvertSToF %float %97 + %102 = OpCompositeConstruct %v4float %98 %99 %100 %101 + OpStore %x_GLF_color %102 + OpBranch %89 + %91 = OpLabel + %103 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %104 = OpLoad %int %103 + %105 = OpConvertSToF %float %104 + %106 = OpCompositeConstruct %v4float %105 %105 %105 %105 + OpStore %x_GLF_color %106 + OpBranch %89 + %89 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %107 +%tint_symbol_1 = OpFunctionParameter %main_out + %111 = OpLabel + %112 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %112 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %114 = OpLabel + %115 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %115 + %116 = OpFunctionCall %void %main_1 + %118 = OpLoad %v4float %x_GLF_color + %119 = OpCompositeConstruct %main_out %118 + %117 = OpFunctionCall %void %tint_symbol_3 %119 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..afe4b0ef5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-increase-negative/0-opt.wgsl.expected.wgsl @@ -0,0 +1,87 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var arr : array; + var a : i32; + let x_40 : i32 = x_7.x_GLF_uniform_int_values[0]; + i = x_40; + loop { + let x_45 : i32 = i; + let x_47 : i32 = x_7.x_GLF_uniform_int_values[2]; + if ((x_45 < x_47)) { + } else { + break; + } + let x_50 : i32 = i; + let x_52 : i32 = x_7.x_GLF_uniform_int_values[0]; + arr[x_50] = x_52; + + continuing { + let x_54 : i32 = i; + i = (x_54 + 1); + } + } + a = -1; + let x_57 : f32 = gl_FragCoord.y; + let x_59 : f32 = x_11.x_GLF_uniform_float_values[0]; + if (!((x_57 < x_59))) { + let x_64 : i32 = a; + let x_65 : i32 = (x_64 + 1); + a = x_65; + let x_67 : i32 = x_7.x_GLF_uniform_int_values[1]; + arr[x_65] = x_67; + } + let x_69 : i32 = a; + let x_70 : i32 = (x_69 + 1); + a = x_70; + let x_72 : i32 = x_7.x_GLF_uniform_int_values[2]; + arr[x_70] = x_72; + let x_75 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_77 : i32 = arr[x_75]; + let x_79 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_77 == x_79)) { + let x_84 : i32 = a; + let x_87 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_90 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_92 : i32 = a; + x_GLF_color = vec4(f32(x_84), f32(x_87), f32(x_90), f32(x_92)); + } else { + let x_96 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_97 : f32 = f32(x_96); + x_GLF_color = vec4(x_97, x_97, x_97, x_97); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm new file mode 100644 index 0000000000..cb6795312f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm @@ -0,0 +1,122 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %b "b" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_2 = OpConstant %int 2 + %main = OpFunction %void None %14 + %32 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_float Function + %33 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %34 = OpLoad %int %33 + OpStore %a %34 + %35 = OpLoad %int %a + %36 = OpIAdd %int %35 %int_1 + OpStore %a %36 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %38 = OpLoad %int %37 + OpStore %i %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpSLessThan %bool %43 %45 + OpBranchConditional %46 %47 %40 + %47 = OpLabel + %48 = OpLoad %int %i + %49 = OpConvertSToF %float %48 + %50 = OpLoad %int %a + %51 = OpSNegate %int %50 + %52 = OpExtInst %float %1 Ldexp %49 %51 + OpStore %b %52 + OpBranch %41 + %41 = OpLabel + %53 = OpLoad %int %i + %54 = OpIAdd %int %53 %int_1 + OpStore %i %54 + OpBranch %39 + %40 = OpLabel + %55 = OpLoad %float %b + %56 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %57 = OpLoad %float %56 + %58 = OpFOrdEqual %bool %55 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %63 = OpLoad %int %62 + %64 = OpConvertSToF %float %63 + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + %68 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %69 + %71 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %72 + %74 = OpCompositeConstruct %v4float %64 %67 %70 %73 + OpStore %_GLF_color %74 + OpBranch %59 + %61 = OpLabel + %75 = OpLoad %float %b + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %_GLF_color %76 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..18402b445e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,59 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + float b = 0.0f; + const int x_34 = asint(x_6[1].x); + a = x_34; + a = (a + 1); + const int x_38 = asint(x_6[1].x); + i = x_38; + while (true) { + const int x_43 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_45 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_43 < x_45)) { + } else { + break; + } + b = ldexp(float(i), -(a)); + { + i = (i + 1); + } + } + const float x_55 = b; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_57 = asfloat(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_55 == x_57)) { + const int x_63 = asint(x_6[2].x); + const int x_66 = asint(x_6[1].x); + const int x_69 = asint(x_6[1].x); + const int x_72 = asint(x_6[2].x); + x_GLF_color = float4(float(x_63), float(x_66), float(x_69), float(x_72)); + } else { + const float x_75 = b; + x_GLF_color = float4(x_75, x_75, x_75, x_75); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..bcdae401ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.msl @@ -0,0 +1,78 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_10, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + float b = 0.0f; + int const x_34 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_34; + int const x_35 = a; + a = (x_35 + 1); + int const x_38 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_38; + while (true) { + int const x_43 = i; + int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_43 < x_45)) { + } else { + break; + } + int const x_48 = i; + int const x_50 = a; + b = ldexp(float(x_48), -(x_50)); + { + int const x_53 = i; + i = (x_53 + 1); + } + } + float const x_55 = b; + float const x_57 = x_10.x_GLF_uniform_float_values.arr[0].el; + if ((x_55 == x_57)) { + int const x_63 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_69 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_72 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_63), float(x_66), float(x_69), float(x_72)); + } else { + float const x_75 = b; + *(tint_symbol_4) = float4(x_75, x_75, x_75, x_75); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..895c6ea9a8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,163 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 97 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %30 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %85 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_int Function %26 + %i = OpVariable %_ptr_Function_int Function %26 + %b = OpVariable %_ptr_Function_float Function %30 + %34 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %35 = OpLoad %int %34 + OpStore %a %35 + %36 = OpLoad %int %a + %37 = OpIAdd %int %36 %int_1 + OpStore %a %37 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %39 = OpLoad %int %38 + OpStore %i %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %i + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpSLessThan %bool %44 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %41 + %50 = OpLabel + %53 = OpLoad %int %i + %54 = OpLoad %int %a + %57 = OpConvertSToF %float %53 + %58 = OpSNegate %int %54 + %55 = OpExtInst %float %56 Ldexp %57 %58 + OpStore %b %55 + OpBranch %42 + %42 = OpLabel + %59 = OpLoad %int %i + %60 = OpIAdd %int %59 %int_1 + OpStore %i %60 + OpBranch %40 + %41 = OpLabel + %61 = OpLoad %float %b + %63 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %64 = OpLoad %float %63 + %65 = OpFOrdEqual %bool %61 %64 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %67 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %71 + %79 = OpConvertSToF %float %73 + %80 = OpConvertSToF %float %75 + %81 = OpConvertSToF %float %77 + %82 = OpCompositeConstruct %v4float %78 %79 %80 %81 + OpStore %x_GLF_color %82 + OpBranch %66 + %68 = OpLabel + %83 = OpLoad %float %b + %84 = OpCompositeConstruct %v4float %83 %83 %83 %83 + OpStore %x_GLF_color %84 + OpBranch %66 + %66 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %85 +%tint_symbol = OpFunctionParameter %main_out + %89 = OpLabel + %90 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %90 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %92 = OpLabel + %93 = OpFunctionCall %void %main_1 + %95 = OpLoad %v4float %x_GLF_color + %96 = OpCompositeConstruct %main_out %95 + %94 = OpFunctionCall %void %tint_symbol_2 %96 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..bb8ec9b284 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + var b : f32; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_34; + let x_35 : i32 = a; + a = (x_35 + 1); + let x_38 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_38; + loop { + let x_43 : i32 = i; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_43 < x_45)) { + } else { + break; + } + let x_48 : i32 = i; + let x_50 : i32 = a; + b = ldexp(f32(x_48), -(x_50)); + + continuing { + let x_53 : i32 = i; + i = (x_53 + 1); + } + } + let x_55 : f32 = b; + let x_57 : f32 = x_10.x_GLF_uniform_float_values[0]; + if ((x_55 == x_57)) { + let x_63 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_72 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_63), f32(x_66), f32(x_69), f32(x_72)); + } else { + let x_75 : f32 = b; + x_GLF_color = vec4(x_75, x_75, x_75, x_75); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl new file mode 100644 index 0000000000..bb8ec9b284 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + var b : f32; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_34; + let x_35 : i32 = a; + a = (x_35 + 1); + let x_38 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_38; + loop { + let x_43 : i32 = i; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_43 < x_45)) { + } else { + break; + } + let x_48 : i32 = i; + let x_50 : i32 = a; + b = ldexp(f32(x_48), -(x_50)); + + continuing { + let x_53 : i32 = i; + i = (x_53 + 1); + } + } + let x_55 : f32 = b; + let x_57 : f32 = x_10.x_GLF_uniform_float_values[0]; + if ((x_55 == x_57)) { + let x_63 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_72 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_63), f32(x_66), f32(x_69), f32(x_72)); + } else { + let x_75 : f32 = b; + x_GLF_color = vec4(x_75, x_75, x_75, x_75); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..18402b445e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,59 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + float b = 0.0f; + const int x_34 = asint(x_6[1].x); + a = x_34; + a = (a + 1); + const int x_38 = asint(x_6[1].x); + i = x_38; + while (true) { + const int x_43 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_45 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_43 < x_45)) { + } else { + break; + } + b = ldexp(float(i), -(a)); + { + i = (i + 1); + } + } + const float x_55 = b; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_57 = asfloat(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_55 == x_57)) { + const int x_63 = asint(x_6[2].x); + const int x_66 = asint(x_6[1].x); + const int x_69 = asint(x_6[1].x); + const int x_72 = asint(x_6[2].x); + x_GLF_color = float4(float(x_63), float(x_66), float(x_69), float(x_72)); + } else { + const float x_75 = b; + x_GLF_color = float4(x_75, x_75, x_75, x_75); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..bcdae401ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.msl @@ -0,0 +1,78 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_10, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + float b = 0.0f; + int const x_34 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_34; + int const x_35 = a; + a = (x_35 + 1); + int const x_38 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_38; + while (true) { + int const x_43 = i; + int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_43 < x_45)) { + } else { + break; + } + int const x_48 = i; + int const x_50 = a; + b = ldexp(float(x_48), -(x_50)); + { + int const x_53 = i; + i = (x_53 + 1); + } + } + float const x_55 = b; + float const x_57 = x_10.x_GLF_uniform_float_values.arr[0].el; + if ((x_55 == x_57)) { + int const x_63 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_69 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_72 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_63), float(x_66), float(x_69), float(x_72)); + } else { + float const x_75 = b; + *(tint_symbol_4) = float4(x_75, x_75, x_75, x_75); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..895c6ea9a8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,163 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 97 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %30 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %85 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_int Function %26 + %i = OpVariable %_ptr_Function_int Function %26 + %b = OpVariable %_ptr_Function_float Function %30 + %34 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %35 = OpLoad %int %34 + OpStore %a %35 + %36 = OpLoad %int %a + %37 = OpIAdd %int %36 %int_1 + OpStore %a %37 + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %39 = OpLoad %int %38 + OpStore %i %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %i + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpSLessThan %bool %44 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %41 + %50 = OpLabel + %53 = OpLoad %int %i + %54 = OpLoad %int %a + %57 = OpConvertSToF %float %53 + %58 = OpSNegate %int %54 + %55 = OpExtInst %float %56 Ldexp %57 %58 + OpStore %b %55 + OpBranch %42 + %42 = OpLabel + %59 = OpLoad %int %i + %60 = OpIAdd %int %59 %int_1 + OpStore %i %60 + OpBranch %40 + %41 = OpLabel + %61 = OpLoad %float %b + %63 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %64 = OpLoad %float %63 + %65 = OpFOrdEqual %bool %61 %64 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %67 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %71 + %79 = OpConvertSToF %float %73 + %80 = OpConvertSToF %float %75 + %81 = OpConvertSToF %float %77 + %82 = OpCompositeConstruct %v4float %78 %79 %80 %81 + OpStore %x_GLF_color %82 + OpBranch %66 + %68 = OpLabel + %83 = OpLoad %float %b + %84 = OpCompositeConstruct %v4float %83 %83 %83 %83 + OpStore %x_GLF_color %84 + OpBranch %66 + %66 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %85 +%tint_symbol = OpFunctionParameter %main_out + %89 = OpLabel + %90 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %90 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %92 = OpLabel + %93 = OpFunctionCall %void %main_1 + %95 = OpLoad %v4float %x_GLF_color + %96 = OpCompositeConstruct %main_out %95 + %94 = OpFunctionCall %void %tint_symbol_2 %96 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..bb8ec9b284 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-ldexp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + var b : f32; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_34; + let x_35 : i32 = a; + a = (x_35 + 1); + let x_38 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_38; + loop { + let x_43 : i32 = i; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_43 < x_45)) { + } else { + break; + } + let x_48 : i32 = i; + let x_50 : i32 = a; + b = ldexp(f32(x_48), -(x_50)); + + continuing { + let x_53 : i32 = i; + i = (x_53 + 1); + } + } + let x_55 : f32 = b; + let x_57 : f32 = x_10.x_GLF_uniform_float_values[0]; + if ((x_55 == x_57)) { + let x_63 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_72 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_63), f32(x_66), f32(x_69), f32(x_72)); + } else { + let x_75 : f32 = b; + x_GLF_color = vec4(x_75, x_75, x_75, x_75); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm new file mode 100644 index 0000000000..e6136d5808 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm @@ -0,0 +1,154 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_f1_ "func(f1;" + OpName %f "f" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %b "b" + OpName %i "i" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 + %18 = OpTypeFunction %int %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 +%float_0_699999988 = OpConstant %float 0.699999988 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %33 = OpLabel + %param = OpVariable %_ptr_Function_float Function + OpStore %param %float_0_699999988 + %34 = OpFunctionCall %int %func_f1_ %param + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %36 = OpLoad %int %35 + %37 = OpIEqual %bool %34 %36 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %40 + %39 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpConvertSToF %float %42 + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %45 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %48 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %51 + %53 = OpCompositeConstruct %v4float %43 %46 %49 %52 + OpStore %_GLF_color %53 + OpBranch %38 + %40 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpCompositeConstruct %v4float %56 %56 %56 %56 + OpStore %_GLF_color %57 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd + %func_f1_ = OpFunction %int None %18 + %f = OpFunctionParameter %_ptr_Function_float + %58 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %60 = OpLoad %int %59 + OpStore %a %60 + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %62 = OpLoad %int %61 + OpStore %b %62 + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %64 = OpLoad %int %63 + OpStore %i %64 + OpBranch %65 + %65 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %69 = OpLoad %int %i + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %71 = OpLoad %int %70 + %72 = OpSLessThan %bool %69 %71 + OpBranchConditional %72 %73 %66 + %73 = OpLabel + %74 = OpLoad %int %a + %75 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %76 = OpLoad %int %75 + %77 = OpSGreaterThan %bool %74 %76 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %78 + %79 = OpLabel + OpBranch %66 + %78 = OpLabel + %80 = OpLoad %float %f + %81 = OpConvertFToS %int %80 + %82 = OpISub %int %81 %int_1 + %83 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpISub %int %82 %84 + %86 = OpLoad %int %i + %87 = OpIAdd %int %85 %86 + OpStore %a %87 + %88 = OpLoad %int %b + %89 = OpIAdd %int %88 %int_1 + OpStore %b %89 + OpBranch %67 + %67 = OpLabel + %90 = OpLoad %int %i + %91 = OpIAdd %int %90 %int_1 + OpStore %i %91 + OpBranch %65 + %66 = OpLabel + %92 = OpLoad %int %b + %93 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %94 = OpLoad %int %93 + %95 = OpIEqual %bool %92 %94 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %98 + %97 = OpLabel + %99 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %100 = OpLoad %int %99 + OpReturnValue %100 + %98 = OpLabel + %101 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %102 = OpLoad %int %101 + OpReturnValue %102 + %96 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ae1cfdfbb0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.hlsl @@ -0,0 +1,80 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_f1_(inout float f) { + int a = 0; + int b = 0; + int i = 0; + const int x_60 = asint(x_8[1].x); + a = x_60; + const int x_62 = asint(x_8[2].x); + b = x_62; + const int x_64 = asint(x_8[2].x); + i = x_64; + while (true) { + const int x_69 = i; + const int x_71 = asint(x_8[4].x); + if ((x_69 < x_71)) { + } else { + break; + } + const int x_74 = a; + const int x_76 = asint(x_8[3].x); + if ((x_74 > x_76)) { + break; + } + const float x_80 = f; + const int x_84 = asint(x_8[1].x); + a = (((int(x_80) - 1) - x_84) + i); + b = (b + 1); + { + i = (i + 1); + } + } + const int x_92 = b; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_94 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_92 == x_94)) { + const int x_100 = asint(x_8[1].x); + return x_100; + } else { + const int x_102 = asint(x_8[2].x); + return x_102; + } + return 0; +} + +void main_1() { + float param = 0.0f; + param = 0.699999988f; + const int x_34 = func_f1_(param); + const int x_36 = asint(x_8[1].x); + if ((x_34 == x_36)) { + const int x_42 = asint(x_8[1].x); + const int x_45 = asint(x_8[2].x); + const int x_48 = asint(x_8[2].x); + const int x_51 = asint(x_8[1].x); + x_GLF_color = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + } else { + const int x_55 = asint(x_8[2].x); + const float x_56 = float(x_55); + x_GLF_color = float4(x_56, x_56, x_56, x_56); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..e2416d2339 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.msl @@ -0,0 +1,92 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_f1_(constant buf0& x_8, thread float* const f) { + int a = 0; + int b = 0; + int i = 0; + int const x_60 = x_8.x_GLF_uniform_int_values.arr[1].el; + a = x_60; + int const x_62 = x_8.x_GLF_uniform_int_values.arr[2].el; + b = x_62; + int const x_64 = x_8.x_GLF_uniform_int_values.arr[2].el; + i = x_64; + while (true) { + int const x_69 = i; + int const x_71 = x_8.x_GLF_uniform_int_values.arr[4].el; + if ((x_69 < x_71)) { + } else { + break; + } + int const x_74 = a; + int const x_76 = x_8.x_GLF_uniform_int_values.arr[3].el; + if ((x_74 > x_76)) { + break; + } + float const x_80 = *(f); + int const x_84 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_86 = i; + a = (((int(x_80) - 1) - x_84) + x_86); + int const x_88 = b; + b = (x_88 + 1); + { + int const x_90 = i; + i = (x_90 + 1); + } + } + int const x_92 = b; + int const x_94 = x_8.x_GLF_uniform_int_values.arr[0].el; + if ((x_92 == x_94)) { + int const x_100 = x_8.x_GLF_uniform_int_values.arr[1].el; + return x_100; + } else { + int const x_102 = x_8.x_GLF_uniform_int_values.arr[2].el; + return x_102; + } + return 0; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + float param = 0.0f; + param = 0.699999988f; + int const x_34 = func_f1_(x_8, &(param)); + int const x_36 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_34 == x_36)) { + int const x_42 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_45 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_48 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_51 = x_8.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + } else { + int const x_55 = x_8.x_GLF_uniform_int_values.arr[2].el; + float const x_56 = float(x_55); + *(tint_symbol_4) = float4(x_56, x_56, x_56, x_56); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..ef89a411d4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.spvasm @@ -0,0 +1,193 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 124 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_f1_ "func_f1_" + OpName %f "f" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpTypeFunction %int %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %85 = OpConstantNull %float +%float_0_699999988 = OpConstant %float 0.699999988 + %main_out = OpTypeStruct %v4float + %112 = OpTypeFunction %void %main_out + %func_f1_ = OpFunction %int None %15 + %f = OpFunctionParameter %_ptr_Function_float + %19 = OpLabel + %a = OpVariable %_ptr_Function_int Function %22 + %b = OpVariable %_ptr_Function_int Function %22 + %i = OpVariable %_ptr_Function_int Function %22 + %28 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %29 = OpLoad %int %28 + OpStore %a %29 + %31 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %32 = OpLoad %int %31 + OpStore %b %32 + %33 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %34 = OpLoad %int %33 + OpStore %i %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %int %i + %41 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4 + %42 = OpLoad %int %41 + %43 = OpSLessThan %bool %39 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %36 + %45 = OpLabel + %48 = OpLoad %int %a + %50 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %51 = OpLoad %int %50 + %52 = OpSGreaterThan %bool %48 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + OpBranch %36 + %53 = OpLabel + %56 = OpLoad %float %f + %57 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpLoad %int %i + %60 = OpConvertFToS %int %56 + %61 = OpISub %int %60 %int_1 + %62 = OpISub %int %61 %58 + %63 = OpIAdd %int %62 %59 + OpStore %a %63 + %64 = OpLoad %int %b + %65 = OpIAdd %int %64 %int_1 + OpStore %b %65 + OpBranch %37 + %37 = OpLabel + %66 = OpLoad %int %i + %67 = OpIAdd %int %66 %int_1 + OpStore %i %67 + OpBranch %35 + %36 = OpLabel + %68 = OpLoad %int %b + %70 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %71 = OpLoad %int %70 + %72 = OpIEqual %bool %68 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %77 = OpLoad %int %76 + OpReturnValue %77 + %75 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %79 = OpLoad %int %78 + OpReturnValue %79 + %73 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %80 + %83 = OpLabel + %param = OpVariable %_ptr_Function_float Function %85 + OpStore %param %float_0_699999988 + %87 = OpFunctionCall %int %func_f1_ %param + %89 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpIEqual %bool %87 %90 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %94 + %93 = OpLabel + %95 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %102 = OpLoad %int %101 + %103 = OpConvertSToF %float %96 + %104 = OpConvertSToF %float %98 + %105 = OpConvertSToF %float %100 + %106 = OpConvertSToF %float %102 + %107 = OpCompositeConstruct %v4float %103 %104 %105 %106 + OpStore %x_GLF_color %107 + OpBranch %92 + %94 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %109 + %111 = OpCompositeConstruct %v4float %110 %110 %110 %110 + OpStore %x_GLF_color %111 + OpBranch %92 + %92 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %112 +%tint_symbol = OpFunctionParameter %main_out + %116 = OpLabel + %117 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %117 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %80 + %119 = OpLabel + %120 = OpFunctionCall %void %main_1 + %122 = OpLoad %v4float %x_GLF_color + %123 = OpCompositeConstruct %main_out %122 + %121 = OpFunctionCall %void %tint_symbol_2 %123 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a15e3bc828 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.spvasm.expected.wgsl @@ -0,0 +1,86 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_f1_(f : ptr) -> i32 { + var a : i32; + var b : i32; + var i : i32; + let x_60 : i32 = x_8.x_GLF_uniform_int_values[1]; + a = x_60; + let x_62 : i32 = x_8.x_GLF_uniform_int_values[2]; + b = x_62; + let x_64 : i32 = x_8.x_GLF_uniform_int_values[2]; + i = x_64; + loop { + let x_69 : i32 = i; + let x_71 : i32 = x_8.x_GLF_uniform_int_values[4]; + if ((x_69 < x_71)) { + } else { + break; + } + let x_74 : i32 = a; + let x_76 : i32 = x_8.x_GLF_uniform_int_values[3]; + if ((x_74 > x_76)) { + break; + } + let x_80 : f32 = *(f); + let x_84 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_86 : i32 = i; + a = (((i32(x_80) - 1) - x_84) + x_86); + let x_88 : i32 = b; + b = (x_88 + 1); + + continuing { + let x_90 : i32 = i; + i = (x_90 + 1); + } + } + let x_92 : i32 = b; + let x_94 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_92 == x_94)) { + let x_100 : i32 = x_8.x_GLF_uniform_int_values[1]; + return x_100; + } else { + let x_102 : i32 = x_8.x_GLF_uniform_int_values[2]; + return x_102; + } + return 0; +} + +fn main_1() { + var param : f32; + param = 0.699999988; + let x_34 : i32 = func_f1_(&(param)); + let x_36 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_34 == x_36)) { + let x_42 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_48 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_42), f32(x_45), f32(x_48), f32(x_51)); + } else { + let x_55 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_56 : f32 = f32(x_55); + x_GLF_color = vec4(x_56, x_56, x_56, x_56); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl new file mode 100644 index 0000000000..a15e3bc828 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl @@ -0,0 +1,86 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_f1_(f : ptr) -> i32 { + var a : i32; + var b : i32; + var i : i32; + let x_60 : i32 = x_8.x_GLF_uniform_int_values[1]; + a = x_60; + let x_62 : i32 = x_8.x_GLF_uniform_int_values[2]; + b = x_62; + let x_64 : i32 = x_8.x_GLF_uniform_int_values[2]; + i = x_64; + loop { + let x_69 : i32 = i; + let x_71 : i32 = x_8.x_GLF_uniform_int_values[4]; + if ((x_69 < x_71)) { + } else { + break; + } + let x_74 : i32 = a; + let x_76 : i32 = x_8.x_GLF_uniform_int_values[3]; + if ((x_74 > x_76)) { + break; + } + let x_80 : f32 = *(f); + let x_84 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_86 : i32 = i; + a = (((i32(x_80) - 1) - x_84) + x_86); + let x_88 : i32 = b; + b = (x_88 + 1); + + continuing { + let x_90 : i32 = i; + i = (x_90 + 1); + } + } + let x_92 : i32 = b; + let x_94 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_92 == x_94)) { + let x_100 : i32 = x_8.x_GLF_uniform_int_values[1]; + return x_100; + } else { + let x_102 : i32 = x_8.x_GLF_uniform_int_values[2]; + return x_102; + } + return 0; +} + +fn main_1() { + var param : f32; + param = 0.699999988; + let x_34 : i32 = func_f1_(&(param)); + let x_36 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_34 == x_36)) { + let x_42 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_48 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_42), f32(x_45), f32(x_48), f32(x_51)); + } else { + let x_55 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_56 : f32 = f32(x_55); + x_GLF_color = vec4(x_56, x_56, x_56, x_56); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..ae1cfdfbb0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.hlsl @@ -0,0 +1,80 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_f1_(inout float f) { + int a = 0; + int b = 0; + int i = 0; + const int x_60 = asint(x_8[1].x); + a = x_60; + const int x_62 = asint(x_8[2].x); + b = x_62; + const int x_64 = asint(x_8[2].x); + i = x_64; + while (true) { + const int x_69 = i; + const int x_71 = asint(x_8[4].x); + if ((x_69 < x_71)) { + } else { + break; + } + const int x_74 = a; + const int x_76 = asint(x_8[3].x); + if ((x_74 > x_76)) { + break; + } + const float x_80 = f; + const int x_84 = asint(x_8[1].x); + a = (((int(x_80) - 1) - x_84) + i); + b = (b + 1); + { + i = (i + 1); + } + } + const int x_92 = b; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_94 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_92 == x_94)) { + const int x_100 = asint(x_8[1].x); + return x_100; + } else { + const int x_102 = asint(x_8[2].x); + return x_102; + } + return 0; +} + +void main_1() { + float param = 0.0f; + param = 0.699999988f; + const int x_34 = func_f1_(param); + const int x_36 = asint(x_8[1].x); + if ((x_34 == x_36)) { + const int x_42 = asint(x_8[1].x); + const int x_45 = asint(x_8[2].x); + const int x_48 = asint(x_8[2].x); + const int x_51 = asint(x_8[1].x); + x_GLF_color = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + } else { + const int x_55 = asint(x_8[2].x); + const float x_56 = float(x_55); + x_GLF_color = float4(x_56, x_56, x_56, x_56); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..e2416d2339 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.msl @@ -0,0 +1,92 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_f1_(constant buf0& x_8, thread float* const f) { + int a = 0; + int b = 0; + int i = 0; + int const x_60 = x_8.x_GLF_uniform_int_values.arr[1].el; + a = x_60; + int const x_62 = x_8.x_GLF_uniform_int_values.arr[2].el; + b = x_62; + int const x_64 = x_8.x_GLF_uniform_int_values.arr[2].el; + i = x_64; + while (true) { + int const x_69 = i; + int const x_71 = x_8.x_GLF_uniform_int_values.arr[4].el; + if ((x_69 < x_71)) { + } else { + break; + } + int const x_74 = a; + int const x_76 = x_8.x_GLF_uniform_int_values.arr[3].el; + if ((x_74 > x_76)) { + break; + } + float const x_80 = *(f); + int const x_84 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_86 = i; + a = (((int(x_80) - 1) - x_84) + x_86); + int const x_88 = b; + b = (x_88 + 1); + { + int const x_90 = i; + i = (x_90 + 1); + } + } + int const x_92 = b; + int const x_94 = x_8.x_GLF_uniform_int_values.arr[0].el; + if ((x_92 == x_94)) { + int const x_100 = x_8.x_GLF_uniform_int_values.arr[1].el; + return x_100; + } else { + int const x_102 = x_8.x_GLF_uniform_int_values.arr[2].el; + return x_102; + } + return 0; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + float param = 0.0f; + param = 0.699999988f; + int const x_34 = func_f1_(x_8, &(param)); + int const x_36 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_34 == x_36)) { + int const x_42 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_45 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_48 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_51 = x_8.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + } else { + int const x_55 = x_8.x_GLF_uniform_int_values.arr[2].el; + float const x_56 = float(x_55); + *(tint_symbol_4) = float4(x_56, x_56, x_56, x_56); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..ef89a411d4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.spvasm @@ -0,0 +1,193 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 124 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_f1_ "func_f1_" + OpName %f "f" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpTypeFunction %int %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %85 = OpConstantNull %float +%float_0_699999988 = OpConstant %float 0.699999988 + %main_out = OpTypeStruct %v4float + %112 = OpTypeFunction %void %main_out + %func_f1_ = OpFunction %int None %15 + %f = OpFunctionParameter %_ptr_Function_float + %19 = OpLabel + %a = OpVariable %_ptr_Function_int Function %22 + %b = OpVariable %_ptr_Function_int Function %22 + %i = OpVariable %_ptr_Function_int Function %22 + %28 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %29 = OpLoad %int %28 + OpStore %a %29 + %31 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %32 = OpLoad %int %31 + OpStore %b %32 + %33 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %34 = OpLoad %int %33 + OpStore %i %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %int %i + %41 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4 + %42 = OpLoad %int %41 + %43 = OpSLessThan %bool %39 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %36 + %45 = OpLabel + %48 = OpLoad %int %a + %50 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %51 = OpLoad %int %50 + %52 = OpSGreaterThan %bool %48 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + OpBranch %36 + %53 = OpLabel + %56 = OpLoad %float %f + %57 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpLoad %int %i + %60 = OpConvertFToS %int %56 + %61 = OpISub %int %60 %int_1 + %62 = OpISub %int %61 %58 + %63 = OpIAdd %int %62 %59 + OpStore %a %63 + %64 = OpLoad %int %b + %65 = OpIAdd %int %64 %int_1 + OpStore %b %65 + OpBranch %37 + %37 = OpLabel + %66 = OpLoad %int %i + %67 = OpIAdd %int %66 %int_1 + OpStore %i %67 + OpBranch %35 + %36 = OpLabel + %68 = OpLoad %int %b + %70 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %71 = OpLoad %int %70 + %72 = OpIEqual %bool %68 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %77 = OpLoad %int %76 + OpReturnValue %77 + %75 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %79 = OpLoad %int %78 + OpReturnValue %79 + %73 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %80 + %83 = OpLabel + %param = OpVariable %_ptr_Function_float Function %85 + OpStore %param %float_0_699999988 + %87 = OpFunctionCall %int %func_f1_ %param + %89 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpIEqual %bool %87 %90 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %94 + %93 = OpLabel + %95 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %102 = OpLoad %int %101 + %103 = OpConvertSToF %float %96 + %104 = OpConvertSToF %float %98 + %105 = OpConvertSToF %float %100 + %106 = OpConvertSToF %float %102 + %107 = OpCompositeConstruct %v4float %103 %104 %105 %106 + OpStore %x_GLF_color %107 + OpBranch %92 + %94 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %109 + %111 = OpCompositeConstruct %v4float %110 %110 %110 %110 + OpStore %x_GLF_color %111 + OpBranch %92 + %92 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %112 +%tint_symbol = OpFunctionParameter %main_out + %116 = OpLabel + %117 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %117 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %80 + %119 = OpLabel + %120 = OpFunctionCall %void %main_1 + %122 = OpLoad %v4float %x_GLF_color + %123 = OpCompositeConstruct %main_out %122 + %121 = OpFunctionCall %void %tint_symbol_2 %123 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a15e3bc828 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-neg-func-arg/0-opt.wgsl.expected.wgsl @@ -0,0 +1,86 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_f1_(f : ptr) -> i32 { + var a : i32; + var b : i32; + var i : i32; + let x_60 : i32 = x_8.x_GLF_uniform_int_values[1]; + a = x_60; + let x_62 : i32 = x_8.x_GLF_uniform_int_values[2]; + b = x_62; + let x_64 : i32 = x_8.x_GLF_uniform_int_values[2]; + i = x_64; + loop { + let x_69 : i32 = i; + let x_71 : i32 = x_8.x_GLF_uniform_int_values[4]; + if ((x_69 < x_71)) { + } else { + break; + } + let x_74 : i32 = a; + let x_76 : i32 = x_8.x_GLF_uniform_int_values[3]; + if ((x_74 > x_76)) { + break; + } + let x_80 : f32 = *(f); + let x_84 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_86 : i32 = i; + a = (((i32(x_80) - 1) - x_84) + x_86); + let x_88 : i32 = b; + b = (x_88 + 1); + + continuing { + let x_90 : i32 = i; + i = (x_90 + 1); + } + } + let x_92 : i32 = b; + let x_94 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_92 == x_94)) { + let x_100 : i32 = x_8.x_GLF_uniform_int_values[1]; + return x_100; + } else { + let x_102 : i32 = x_8.x_GLF_uniform_int_values[2]; + return x_102; + } + return 0; +} + +fn main_1() { + var param : f32; + param = 0.699999988; + let x_34 : i32 = func_f1_(&(param)); + let x_36 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_34 == x_36)) { + let x_42 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_48 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_42), f32(x_45), f32(x_48), f32(x_51)); + } else { + let x_55 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_56 : f32 = f32(x_55); + x_GLF_color = vec4(x_56, x_56, x_56, x_56); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm new file mode 100644 index 0000000000..384988876b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm @@ -0,0 +1,156 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f1_ "f1(" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %A "A" + OpName %a "a" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %i_0 "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %19 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %17 + %41 = OpLabel + %i_0 = OpVariable %_ptr_Function_int Function + %42 = OpFunctionCall %int %f1_ + OpStore %i_0 %42 + %43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpConvertSToF %float %44 + %46 = OpLoad %int %i_0 + %47 = OpConvertSToF %float %46 + %48 = OpLoad %int %i_0 + %49 = OpConvertSToF %float %48 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %51 + %53 = OpCompositeConstruct %v4float %45 %47 %49 %52 + OpStore %_GLF_color %53 + OpReturn + OpFunctionEnd + %f1_ = OpFunction %int None %19 + %54 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %A = OpVariable %_ptr_Function__arr_int_uint_10 Function + %a = OpVariable %_ptr_Function_int Function + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %56 = OpLoad %int %55 + OpStore %i %56 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %i + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpSLessThan %bool %61 %63 + OpBranchConditional %64 %65 %58 + %65 = OpLabel + %66 = OpLoad %int %i + %67 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Function_int %A %66 + OpStore %69 %68 + OpBranch %59 + %59 = OpLabel + %70 = OpLoad %int %i + %71 = OpIAdd %int %70 %int_1 + OpStore %i %71 + OpBranch %57 + %58 = OpLabel + OpStore %a %int_n1 + %72 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %75 = OpLoad %float %74 + %76 = OpFOrdGreaterThanEqual %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + %79 = OpLoad %int %a + %80 = OpIAdd %int %79 %int_1 + OpStore %a %80 + %81 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Function_int %A %80 + OpStore %83 %82 + OpBranch %77 + %77 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Function_int %A %85 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %89 = OpLoad %int %88 + %90 = OpIEqual %bool %87 %89 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %93 + %92 = OpLabel + %94 = OpLoad %int %a + %95 = OpIAdd %int %94 %int_1 + OpStore %a %95 + %96 = OpAccessChain %_ptr_Function_int %A %95 + %97 = OpLoad %int %96 + OpReturnValue %97 + %93 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %99 = OpLoad %int %98 + OpReturnValue %99 + %91 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..8a664a3d09 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.hlsl @@ -0,0 +1,85 @@ +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int f1_() { + int i = 0; + int A[10] = (int[10])0; + int a = 0; + const int x_56 = asint(x_8[2].x); + i = x_56; + while (true) { + const int x_61 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_63 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_61 < x_63)) { + } else { + break; + } + const int x_66 = i; + const int x_68 = asint(x_8[2].x); + A[x_66] = x_68; + { + i = (i + 1); + } + } + a = -1; + const float x_73 = gl_FragCoord.y; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_75 = asfloat(x_12[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_73 >= x_75)) { + const int x_80 = (a + 1); + a = x_80; + const int x_82 = asint(x_8[1].x); + A[x_80] = x_82; + } + const int x_85 = asint(x_8[2].x); + const int x_87 = A[x_85]; + const int x_89 = asint(x_8[1].x); + if ((x_87 == x_89)) { + const int x_95 = (a + 1); + a = x_95; + const int x_97 = A[x_95]; + return x_97; + } else { + const int x_99 = asint(x_8[1].x); + return x_99; + } + return 0; +} + +void main_1() { + int i_1 = 0; + const int x_42 = f1_(); + i_1 = x_42; + const int x_44 = asint(x_8[1].x); + const int x_46 = i_1; + const int x_48 = i_1; + const int x_51 = asint(x_8[1].x); + x_GLF_color = float4(float(x_44), float(x_46), float(x_48), float(x_51)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d0afc76e42 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.msl @@ -0,0 +1,102 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int f1_(constant buf1& x_8, constant buf0& x_12, thread float4* const tint_symbol_5) { + int i = 0; + tint_array_wrapper_2 A = {}; + int a = 0; + int const x_56 = x_8.x_GLF_uniform_int_values.arr[2].el; + i = x_56; + while (true) { + int const x_61 = i; + int const x_63 = x_8.x_GLF_uniform_int_values.arr[0].el; + if ((x_61 < x_63)) { + } else { + break; + } + int const x_66 = i; + int const x_68 = x_8.x_GLF_uniform_int_values.arr[2].el; + A.arr[x_66] = x_68; + { + int const x_70 = i; + i = (x_70 + 1); + } + } + a = -1; + float const x_73 = (*(tint_symbol_5)).y; + float const x_75 = x_12.x_GLF_uniform_float_values.arr[0].el; + if ((x_73 >= x_75)) { + int const x_79 = a; + int const x_80 = (x_79 + 1); + a = x_80; + int const x_82 = x_8.x_GLF_uniform_int_values.arr[1].el; + A.arr[x_80] = x_82; + } + int const x_85 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_87 = A.arr[x_85]; + int const x_89 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_87 == x_89)) { + int const x_94 = a; + int const x_95 = (x_94 + 1); + a = x_95; + int const x_97 = A.arr[x_95]; + return x_97; + } else { + int const x_99 = x_8.x_GLF_uniform_int_values.arr[1].el; + return x_99; + } + return 0; +} + +void main_1(constant buf1& x_8, constant buf0& x_12, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int i_1 = 0; + int const x_42 = f1_(x_8, x_12, tint_symbol_6); + i_1 = x_42; + int const x_44 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_46 = i_1; + int const x_48 = i_1; + int const x_51 = x_8.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_7) = float4(float(x_44), float(x_46), float(x_48), float(x_51)); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_8 [[buffer(1)]], constant buf0& x_12 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_8, x_12, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..ed58ead903 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.spvasm @@ -0,0 +1,201 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 121 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_12 "x_12" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %f1_ "f1_" + OpName %i "i" + OpName %A "A" + OpName %a "a" + OpName %main_1 "main_1" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %23 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %33 = OpConstantNull %_arr_int_uint_10 + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %void = OpTypeVoid + %91 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %108 = OpTypeFunction %void %main_out + %f1_ = OpFunction %int None %23 + %25 = OpLabel + %i = OpVariable %_ptr_Function_int Function %28 + %A = OpVariable %_ptr_Function__arr_int_uint_10 Function %33 + %a = OpVariable %_ptr_Function_int Function %28 + %38 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %39 = OpLoad %int %38 + OpStore %i %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %i + %46 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpSLessThan %bool %44 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %41 + %50 = OpLabel + %53 = OpLoad %int %i + %54 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Function_int %A %53 + OpStore %56 %55 + OpBranch %42 + %42 = OpLabel + %57 = OpLoad %int %i + %59 = OpIAdd %int %57 %int_1 + OpStore %i %59 + OpBranch %40 + %41 = OpLabel + OpStore %a %int_n1 + %62 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %63 = OpLoad %float %62 + %65 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpFOrdGreaterThanEqual %bool %63 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + %70 = OpLoad %int %a + %71 = OpIAdd %int %70 %int_1 + OpStore %a %71 + %72 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Function_int %A %71 + OpStore %74 %73 + OpBranch %68 + %68 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Function_int %A %76 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpIEqual %bool %78 %80 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + %85 = OpLoad %int %a + %86 = OpIAdd %int %85 %int_1 + OpStore %a %86 + %87 = OpAccessChain %_ptr_Function_int %A %86 + %88 = OpLoad %int %87 + OpReturnValue %88 + %84 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %90 = OpLoad %int %89 + OpReturnValue %90 + %82 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %91 + %94 = OpLabel + %i_1 = OpVariable %_ptr_Function_int Function %28 + %96 = OpFunctionCall %int %f1_ + OpStore %i_1 %96 + %97 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %98 = OpLoad %int %97 + %99 = OpLoad %int %i_1 + %100 = OpLoad %int %i_1 + %101 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %102 = OpLoad %int %101 + %103 = OpConvertSToF %float %98 + %104 = OpConvertSToF %float %99 + %105 = OpConvertSToF %float %100 + %106 = OpConvertSToF %float %102 + %107 = OpCompositeConstruct %v4float %103 %104 %105 %106 + OpStore %x_GLF_color %107 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %108 +%tint_symbol_1 = OpFunctionParameter %main_out + %112 = OpLabel + %113 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %113 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %91 + %115 = OpLabel + %116 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %116 + %117 = OpFunctionCall %void %main_1 + %119 = OpLoad %v4float %x_GLF_color + %120 = OpCompositeConstruct %main_out %119 + %118 = OpFunctionCall %void %tint_symbol_3 %120 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..4135af8971 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.spvasm.expected.wgsl @@ -0,0 +1,93 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_12 : buf0; + +var x_GLF_color : vec4; + +fn f1_() -> i32 { + var i : i32; + var A : array; + var a : i32; + let x_56 : i32 = x_8.x_GLF_uniform_int_values[2]; + i = x_56; + loop { + let x_61 : i32 = i; + let x_63 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_61 < x_63)) { + } else { + break; + } + let x_66 : i32 = i; + let x_68 : i32 = x_8.x_GLF_uniform_int_values[2]; + A[x_66] = x_68; + + continuing { + let x_70 : i32 = i; + i = (x_70 + 1); + } + } + a = -1; + let x_73 : f32 = gl_FragCoord.y; + let x_75 : f32 = x_12.x_GLF_uniform_float_values[0]; + if ((x_73 >= x_75)) { + let x_79 : i32 = a; + let x_80 : i32 = (x_79 + 1); + a = x_80; + let x_82 : i32 = x_8.x_GLF_uniform_int_values[1]; + A[x_80] = x_82; + } + let x_85 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_87 : i32 = A[x_85]; + let x_89 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_87 == x_89)) { + let x_94 : i32 = a; + let x_95 : i32 = (x_94 + 1); + a = x_95; + let x_97 : i32 = A[x_95]; + return x_97; + } else { + let x_99 : i32 = x_8.x_GLF_uniform_int_values[1]; + return x_99; + } + return 0; +} + +fn main_1() { + var i_1 : i32; + let x_42 : i32 = f1_(); + i_1 = x_42; + let x_44 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_46 : i32 = i_1; + let x_48 : i32 = i_1; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_44), f32(x_46), f32(x_48), f32(x_51)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl new file mode 100644 index 0000000000..4135af8971 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl @@ -0,0 +1,93 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_12 : buf0; + +var x_GLF_color : vec4; + +fn f1_() -> i32 { + var i : i32; + var A : array; + var a : i32; + let x_56 : i32 = x_8.x_GLF_uniform_int_values[2]; + i = x_56; + loop { + let x_61 : i32 = i; + let x_63 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_61 < x_63)) { + } else { + break; + } + let x_66 : i32 = i; + let x_68 : i32 = x_8.x_GLF_uniform_int_values[2]; + A[x_66] = x_68; + + continuing { + let x_70 : i32 = i; + i = (x_70 + 1); + } + } + a = -1; + let x_73 : f32 = gl_FragCoord.y; + let x_75 : f32 = x_12.x_GLF_uniform_float_values[0]; + if ((x_73 >= x_75)) { + let x_79 : i32 = a; + let x_80 : i32 = (x_79 + 1); + a = x_80; + let x_82 : i32 = x_8.x_GLF_uniform_int_values[1]; + A[x_80] = x_82; + } + let x_85 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_87 : i32 = A[x_85]; + let x_89 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_87 == x_89)) { + let x_94 : i32 = a; + let x_95 : i32 = (x_94 + 1); + a = x_95; + let x_97 : i32 = A[x_95]; + return x_97; + } else { + let x_99 : i32 = x_8.x_GLF_uniform_int_values[1]; + return x_99; + } + return 0; +} + +fn main_1() { + var i_1 : i32; + let x_42 : i32 = f1_(); + i_1 = x_42; + let x_44 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_46 : i32 = i_1; + let x_48 : i32 = i_1; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_44), f32(x_46), f32(x_48), f32(x_51)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..8a664a3d09 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.hlsl @@ -0,0 +1,85 @@ +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int f1_() { + int i = 0; + int A[10] = (int[10])0; + int a = 0; + const int x_56 = asint(x_8[2].x); + i = x_56; + while (true) { + const int x_61 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_63 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_61 < x_63)) { + } else { + break; + } + const int x_66 = i; + const int x_68 = asint(x_8[2].x); + A[x_66] = x_68; + { + i = (i + 1); + } + } + a = -1; + const float x_73 = gl_FragCoord.y; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_75 = asfloat(x_12[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_73 >= x_75)) { + const int x_80 = (a + 1); + a = x_80; + const int x_82 = asint(x_8[1].x); + A[x_80] = x_82; + } + const int x_85 = asint(x_8[2].x); + const int x_87 = A[x_85]; + const int x_89 = asint(x_8[1].x); + if ((x_87 == x_89)) { + const int x_95 = (a + 1); + a = x_95; + const int x_97 = A[x_95]; + return x_97; + } else { + const int x_99 = asint(x_8[1].x); + return x_99; + } + return 0; +} + +void main_1() { + int i_1 = 0; + const int x_42 = f1_(); + i_1 = x_42; + const int x_44 = asint(x_8[1].x); + const int x_46 = i_1; + const int x_48 = i_1; + const int x_51 = asint(x_8[1].x); + x_GLF_color = float4(float(x_44), float(x_46), float(x_48), float(x_51)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d0afc76e42 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.msl @@ -0,0 +1,102 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int f1_(constant buf1& x_8, constant buf0& x_12, thread float4* const tint_symbol_5) { + int i = 0; + tint_array_wrapper_2 A = {}; + int a = 0; + int const x_56 = x_8.x_GLF_uniform_int_values.arr[2].el; + i = x_56; + while (true) { + int const x_61 = i; + int const x_63 = x_8.x_GLF_uniform_int_values.arr[0].el; + if ((x_61 < x_63)) { + } else { + break; + } + int const x_66 = i; + int const x_68 = x_8.x_GLF_uniform_int_values.arr[2].el; + A.arr[x_66] = x_68; + { + int const x_70 = i; + i = (x_70 + 1); + } + } + a = -1; + float const x_73 = (*(tint_symbol_5)).y; + float const x_75 = x_12.x_GLF_uniform_float_values.arr[0].el; + if ((x_73 >= x_75)) { + int const x_79 = a; + int const x_80 = (x_79 + 1); + a = x_80; + int const x_82 = x_8.x_GLF_uniform_int_values.arr[1].el; + A.arr[x_80] = x_82; + } + int const x_85 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_87 = A.arr[x_85]; + int const x_89 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_87 == x_89)) { + int const x_94 = a; + int const x_95 = (x_94 + 1); + a = x_95; + int const x_97 = A.arr[x_95]; + return x_97; + } else { + int const x_99 = x_8.x_GLF_uniform_int_values.arr[1].el; + return x_99; + } + return 0; +} + +void main_1(constant buf1& x_8, constant buf0& x_12, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int i_1 = 0; + int const x_42 = f1_(x_8, x_12, tint_symbol_6); + i_1 = x_42; + int const x_44 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_46 = i_1; + int const x_48 = i_1; + int const x_51 = x_8.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_7) = float4(float(x_44), float(x_46), float(x_48), float(x_51)); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_8 [[buffer(1)]], constant buf0& x_12 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_8, x_12, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..ed58ead903 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.spvasm @@ -0,0 +1,201 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 121 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_12 "x_12" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %f1_ "f1_" + OpName %i "i" + OpName %A "A" + OpName %a "a" + OpName %main_1 "main_1" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %23 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %33 = OpConstantNull %_arr_int_uint_10 + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %void = OpTypeVoid + %91 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %108 = OpTypeFunction %void %main_out + %f1_ = OpFunction %int None %23 + %25 = OpLabel + %i = OpVariable %_ptr_Function_int Function %28 + %A = OpVariable %_ptr_Function__arr_int_uint_10 Function %33 + %a = OpVariable %_ptr_Function_int Function %28 + %38 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %39 = OpLoad %int %38 + OpStore %i %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %i + %46 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpSLessThan %bool %44 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %41 + %50 = OpLabel + %53 = OpLoad %int %i + %54 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Function_int %A %53 + OpStore %56 %55 + OpBranch %42 + %42 = OpLabel + %57 = OpLoad %int %i + %59 = OpIAdd %int %57 %int_1 + OpStore %i %59 + OpBranch %40 + %41 = OpLabel + OpStore %a %int_n1 + %62 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %63 = OpLoad %float %62 + %65 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpFOrdGreaterThanEqual %bool %63 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + %70 = OpLoad %int %a + %71 = OpIAdd %int %70 %int_1 + OpStore %a %71 + %72 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Function_int %A %71 + OpStore %74 %73 + OpBranch %68 + %68 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Function_int %A %76 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpIEqual %bool %78 %80 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + %85 = OpLoad %int %a + %86 = OpIAdd %int %85 %int_1 + OpStore %a %86 + %87 = OpAccessChain %_ptr_Function_int %A %86 + %88 = OpLoad %int %87 + OpReturnValue %88 + %84 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %90 = OpLoad %int %89 + OpReturnValue %90 + %82 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %91 + %94 = OpLabel + %i_1 = OpVariable %_ptr_Function_int Function %28 + %96 = OpFunctionCall %int %f1_ + OpStore %i_1 %96 + %97 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %98 = OpLoad %int %97 + %99 = OpLoad %int %i_1 + %100 = OpLoad %int %i_1 + %101 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %102 = OpLoad %int %101 + %103 = OpConvertSToF %float %98 + %104 = OpConvertSToF %float %99 + %105 = OpConvertSToF %float %100 + %106 = OpConvertSToF %float %102 + %107 = OpCompositeConstruct %v4float %103 %104 %105 %106 + OpStore %x_GLF_color %107 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %108 +%tint_symbol_1 = OpFunctionParameter %main_out + %112 = OpLabel + %113 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %113 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %91 + %115 = OpLabel + %116 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %116 + %117 = OpFunctionCall %void %main_1 + %119 = OpLoad %v4float %x_GLF_color + %120 = OpCompositeConstruct %main_out %119 + %118 = OpFunctionCall %void %tint_symbol_3 %120 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..4135af8971 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-add-sub-pre-increase/0-opt.wgsl.expected.wgsl @@ -0,0 +1,93 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_12 : buf0; + +var x_GLF_color : vec4; + +fn f1_() -> i32 { + var i : i32; + var A : array; + var a : i32; + let x_56 : i32 = x_8.x_GLF_uniform_int_values[2]; + i = x_56; + loop { + let x_61 : i32 = i; + let x_63 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_61 < x_63)) { + } else { + break; + } + let x_66 : i32 = i; + let x_68 : i32 = x_8.x_GLF_uniform_int_values[2]; + A[x_66] = x_68; + + continuing { + let x_70 : i32 = i; + i = (x_70 + 1); + } + } + a = -1; + let x_73 : f32 = gl_FragCoord.y; + let x_75 : f32 = x_12.x_GLF_uniform_float_values[0]; + if ((x_73 >= x_75)) { + let x_79 : i32 = a; + let x_80 : i32 = (x_79 + 1); + a = x_80; + let x_82 : i32 = x_8.x_GLF_uniform_int_values[1]; + A[x_80] = x_82; + } + let x_85 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_87 : i32 = A[x_85]; + let x_89 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_87 == x_89)) { + let x_94 : i32 = a; + let x_95 : i32 = (x_94 + 1); + a = x_95; + let x_97 : i32 = A[x_95]; + return x_97; + } else { + let x_99 : i32 = x_8.x_GLF_uniform_int_values[1]; + return x_99; + } + return 0; +} + +fn main_1() { + var i_1 : i32; + let x_42 : i32 = f1_(); + i_1 = x_42; + let x_44 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_46 : i32 = i_1; + let x_48 : i32 = i_1; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_44), f32(x_46), f32(x_48), f32(x_51)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm new file mode 100644 index 0000000000..8e160dec58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm @@ -0,0 +1,178 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %v1 "v1" + OpName %ref "ref" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float = OpTypeFloat 32 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %34 = OpLabel + %a = OpVariable %_ptr_Function_uint Function + %v1 = OpVariable %_ptr_Function_v4float Function + %ref = OpVariable %_ptr_Function_v4float Function + %35 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %36 = OpLoad %float %35 + %37 = OpCompositeConstruct %v4float %36 %36 %36 %36 + %38 = OpExtInst %uint %1 PackUnorm4x8 %37 + OpStore %a %38 + %39 = OpLoad %uint %a + %40 = OpExtInst %v4float %1 UnpackSnorm4x8 %39 + OpStore %v1 %40 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpFNegate %float %42 + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %45 = OpLoad %float %44 + %46 = OpFDiv %float %43 %45 + %47 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %48 = OpLoad %float %47 + %49 = OpFNegate %float %48 + %50 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %51 = OpLoad %float %50 + %52 = OpFDiv %float %49 %51 + %53 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %54 = OpLoad %float %53 + %55 = OpFNegate %float %54 + %56 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %57 = OpLoad %float %56 + %58 = OpFDiv %float %55 %57 + %59 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %60 = OpLoad %float %59 + %61 = OpFNegate %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %63 = OpLoad %float %62 + %64 = OpFDiv %float %61 %63 + %65 = OpCompositeConstruct %v4float %46 %52 %58 %64 + OpStore %ref %65 + %66 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Function_float %v1 %67 + %69 = OpLoad %float %68 + %70 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Function_float %ref %71 + %73 = OpLoad %float %72 + %74 = OpFOrdEqual %bool %69 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + %77 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Function_float %v1 %78 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Function_float %ref %82 + %84 = OpLoad %float %83 + %85 = OpFOrdEqual %bool %80 %84 + OpBranch %75 + %75 = OpLabel + %86 = OpPhi %bool %74 %34 %85 %76 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %87 + %88 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Function_float %v1 %90 + %92 = OpLoad %float %91 + %93 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Function_float %ref %94 + %96 = OpLoad %float %95 + %97 = OpFOrdEqual %bool %92 %96 + OpBranch %87 + %87 = OpLabel + %98 = OpPhi %bool %86 %75 %97 %88 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %99 + %100 = OpLabel + %101 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %102 = OpLoad %int %101 + %103 = OpAccessChain %_ptr_Function_float %v1 %102 + %104 = OpLoad %float %103 + %105 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %106 = OpLoad %int %105 + %107 = OpAccessChain %_ptr_Function_float %ref %106 + %108 = OpLoad %float %107 + %109 = OpFOrdEqual %bool %104 %108 + OpBranch %99 + %99 = OpLabel + %110 = OpPhi %bool %98 %87 %109 %100 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %113 + %112 = OpLabel + %114 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %115 = OpLoad %int %114 + %116 = OpConvertSToF %float %115 + %117 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %118 = OpLoad %int %117 + %119 = OpConvertSToF %float %118 + %120 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %121 = OpLoad %int %120 + %122 = OpConvertSToF %float %121 + %123 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %124 = OpLoad %int %123 + %125 = OpConvertSToF %float %124 + %126 = OpCompositeConstruct %v4float %116 %119 %122 %125 + OpStore %_GLF_color %126 + OpBranch %111 + %113 = OpLabel + %127 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Function_float %v1 %128 + %130 = OpLoad %float %129 + %131 = OpCompositeConstruct %v4float %130 %130 %130 %130 + OpStore %_GLF_color %131 + OpBranch %111 + %111 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..67cbab7911 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.hlsl @@ -0,0 +1,109 @@ +uint tint_pack4x8unorm(float4 param_0) { + uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0)); + return (i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +float4 tint_unpack4x8snorm(uint param_0) { + int j = int(param_0); + int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; + return clamp(float4(i) / 127.0, -1.0, 1.0); +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 ref = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_85 = false; + bool x_97 = false; + bool x_109 = false; + bool x_86_phi = false; + bool x_98_phi = false; + bool x_110_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + a = tint_pack4x8unorm(float4(x_36, x_36, x_36, x_36)); + v1 = tint_unpack4x8snorm(a); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_42 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_45 = asfloat(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_48 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_51 = asfloat(x_6[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_54 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_57 = asfloat(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_60 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_63 = asfloat(x_6[1].x); + ref = float4((-(x_42) / x_45), (-(x_48) / x_51), (-(x_54) / x_57), (-(x_60) / x_63)); + const int x_67 = asint(x_10[1].x); + const float x_69 = v1[x_67]; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_71 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const float x_73 = ref[x_71]; + const bool x_74 = (x_69 == x_73); + x_86_phi = x_74; + if (x_74) { + const int x_78 = asint(x_10[3].x); + const float x_80 = v1[x_78]; + const int x_82 = asint(x_10[2].x); + const float x_84 = ref[x_82]; + x_85 = (x_80 == x_84); + x_86_phi = x_85; + } + const bool x_86 = x_86_phi; + x_98_phi = x_86; + if (x_86) { + const int x_90 = asint(x_10[2].x); + const float x_92 = v1[x_90]; + const int x_94 = asint(x_10[3].x); + const float x_96 = ref[x_94]; + x_97 = (x_92 == x_96); + x_98_phi = x_97; + } + const bool x_98 = x_98_phi; + x_110_phi = x_98; + if (x_98) { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_102 = asint(x_10[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_104 = v1[x_102]; + const int x_106 = asint(x_10[1].x); + const float x_108 = ref[x_106]; + x_109 = (x_104 == x_108); + x_110_phi = x_109; + } + if (x_110_phi) { + const int x_115 = asint(x_10[3].x); + const int x_118 = asint(x_10[1].x); + const int x_121 = asint(x_10[1].x); + const int x_124 = asint(x_10[3].x); + x_GLF_color = float4(float(x_115), float(x_118), float(x_121), float(x_124)); + } else { + const int x_128 = asint(x_10[1].x); + const float x_130 = v1[x_128]; + x_GLF_color = float4(x_130, x_130, x_130, x_130); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d135092add --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.msl @@ -0,0 +1,110 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_10, thread float4* const tint_symbol_4) { + uint a = 0u; + float4 v1 = 0.0f; + float4 ref = 0.0f; + bool x_85 = false; + bool x_97 = false; + bool x_109 = false; + bool x_86_phi = false; + bool x_98_phi = false; + bool x_110_phi = false; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[0].el; + a = pack_float_to_unorm4x8(float4(x_36, x_36, x_36, x_36)); + uint const x_39 = a; + v1 = unpack_snorm4x8_to_float(x_39); + float const x_42 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_45 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_48 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_51 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_54 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_57 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_63 = x_6.x_GLF_uniform_float_values.arr[1].el; + ref = float4((-(x_42) / x_45), (-(x_48) / x_51), (-(x_54) / x_57), (-(x_60) / x_63)); + int const x_67 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_69 = v1[x_67]; + int const x_71 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_73 = ref[x_71]; + bool const x_74 = (x_69 == x_73); + x_86_phi = x_74; + if (x_74) { + int const x_78 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_80 = v1[x_78]; + int const x_82 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_84 = ref[x_82]; + x_85 = (x_80 == x_84); + x_86_phi = x_85; + } + bool const x_86 = x_86_phi; + x_98_phi = x_86; + if (x_86) { + int const x_90 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_92 = v1[x_90]; + int const x_94 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_96 = ref[x_94]; + x_97 = (x_92 == x_96); + x_98_phi = x_97; + } + bool const x_98 = x_98_phi; + x_110_phi = x_98; + if (x_98) { + int const x_102 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_104 = v1[x_102]; + int const x_106 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_108 = ref[x_106]; + x_109 = (x_104 == x_108); + x_110_phi = x_109; + } + bool const x_110 = x_110_phi; + if (x_110) { + int const x_115 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_118 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_121 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_124 = x_10.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_4) = float4(float(x_115), float(x_118), float(x_121), float(x_124)); + } else { + int const x_128 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_130 = v1[x_128]; + *(tint_symbol_4) = float4(x_130, x_130, x_130, x_130); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..a1804d07f9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.spvasm @@ -0,0 +1,239 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 160 +; Schema: 0 + OpCapability Shader + %45 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %v1 "v1" + OpName %ref "ref" + OpName %x_85 "x_85" + OpName %x_97 "x_97" + OpName %x_109 "x_109" + OpName %x_86_phi "x_86_phi" + OpName %x_98_phi "x_98_phi" + OpName %x_110_phi "x_110_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %26 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %33 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %148 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %26 + %v1 = OpVariable %_ptr_Function_v4float Function %17 + %ref = OpVariable %_ptr_Function_v4float Function %17 + %x_85 = OpVariable %_ptr_Function_bool Function %33 + %x_97 = OpVariable %_ptr_Function_bool Function %33 + %x_109 = OpVariable %_ptr_Function_bool Function %33 + %x_86_phi = OpVariable %_ptr_Function_bool Function %33 + %x_98_phi = OpVariable %_ptr_Function_bool Function %33 + %x_110_phi = OpVariable %_ptr_Function_bool Function %33 + %42 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %43 = OpLoad %float %42 + %46 = OpCompositeConstruct %v4float %43 %43 %43 %43 + %44 = OpExtInst %uint %45 PackUnorm4x8 %46 + OpStore %a %44 + %47 = OpLoad %uint %a + %48 = OpExtInst %v4float %45 UnpackSnorm4x8 %47 + OpStore %v1 %48 + %49 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %57 = OpLoad %float %56 + %58 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %65 = OpLoad %float %64 + %66 = OpFNegate %float %50 + %67 = OpFDiv %float %66 %53 + %68 = OpFNegate %float %55 + %69 = OpFDiv %float %68 %57 + %70 = OpFNegate %float %59 + %71 = OpFDiv %float %70 %61 + %72 = OpFNegate %float %63 + %73 = OpFDiv %float %72 %65 + %74 = OpCompositeConstruct %v4float %67 %69 %71 %73 + OpStore %ref %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %77 = OpLoad %int %76 + %79 = OpAccessChain %_ptr_Function_float %v1 %77 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Function_float %ref %82 + %84 = OpLoad %float %83 + %85 = OpFOrdEqual %bool %80 %84 + OpStore %x_86_phi %85 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Function_float %v1 %90 + %92 = OpLoad %float %91 + %94 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %95 = OpLoad %int %94 + %96 = OpAccessChain %_ptr_Function_float %ref %95 + %97 = OpLoad %float %96 + %98 = OpFOrdEqual %bool %92 %97 + OpStore %x_85 %98 + %99 = OpLoad %bool %x_85 + OpStore %x_86_phi %99 + OpBranch %86 + %86 = OpLabel + %100 = OpLoad %bool %x_86_phi + OpStore %x_98_phi %100 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %104 = OpLoad %int %103 + %105 = OpAccessChain %_ptr_Function_float %v1 %104 + %106 = OpLoad %float %105 + %107 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %108 = OpLoad %int %107 + %109 = OpAccessChain %_ptr_Function_float %ref %108 + %110 = OpLoad %float %109 + %111 = OpFOrdEqual %bool %106 %110 + OpStore %x_97 %111 + %112 = OpLoad %bool %x_97 + OpStore %x_98_phi %112 + OpBranch %101 + %101 = OpLabel + %113 = OpLoad %bool %x_98_phi + OpStore %x_110_phi %113 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %114 + %115 = OpLabel + %116 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %117 = OpLoad %int %116 + %118 = OpAccessChain %_ptr_Function_float %v1 %117 + %119 = OpLoad %float %118 + %120 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %121 = OpLoad %int %120 + %122 = OpAccessChain %_ptr_Function_float %ref %121 + %123 = OpLoad %float %122 + %124 = OpFOrdEqual %bool %119 %123 + OpStore %x_109 %124 + %125 = OpLoad %bool %x_109 + OpStore %x_110_phi %125 + OpBranch %114 + %114 = OpLabel + %126 = OpLoad %bool %x_110_phi + OpSelectionMerge %127 None + OpBranchConditional %126 %128 %129 + %128 = OpLabel + %130 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %131 = OpLoad %int %130 + %132 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %133 = OpLoad %int %132 + %134 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %135 = OpLoad %int %134 + %136 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %137 = OpLoad %int %136 + %138 = OpConvertSToF %float %131 + %139 = OpConvertSToF %float %133 + %140 = OpConvertSToF %float %135 + %141 = OpConvertSToF %float %137 + %142 = OpCompositeConstruct %v4float %138 %139 %140 %141 + OpStore %x_GLF_color %142 + OpBranch %127 + %129 = OpLabel + %143 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %144 = OpLoad %int %143 + %145 = OpAccessChain %_ptr_Function_float %v1 %144 + %146 = OpLoad %float %145 + %147 = OpCompositeConstruct %v4float %146 %146 %146 %146 + OpStore %x_GLF_color %147 + OpBranch %127 + %127 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %148 +%tint_symbol = OpFunctionParameter %main_out + %152 = OpLabel + %153 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %153 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %155 = OpLabel + %156 = OpFunctionCall %void %main_1 + %158 = OpLoad %v4float %x_GLF_color + %159 = OpCompositeConstruct %main_out %158 + %157 = OpFunctionCall %void %tint_symbol_2 %159 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..281628c817 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.spvasm.expected.wgsl @@ -0,0 +1,102 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var v1 : vec4; + var ref : vec4; + var x_85 : bool; + var x_97 : bool; + var x_109 : bool; + var x_86_phi : bool; + var x_98_phi : bool; + var x_110_phi : bool; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + a = pack4x8unorm(vec4(x_36, x_36, x_36, x_36)); + let x_39 : u32 = a; + v1 = unpack4x8snorm(x_39); + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_45 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_48 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_51 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_54 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_57 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_63 : f32 = x_6.x_GLF_uniform_float_values[1]; + ref = vec4((-(x_42) / x_45), (-(x_48) / x_51), (-(x_54) / x_57), (-(x_60) / x_63)); + let x_67 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_69 : f32 = v1[x_67]; + let x_71 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_73 : f32 = ref[x_71]; + let x_74 : bool = (x_69 == x_73); + x_86_phi = x_74; + if (x_74) { + let x_78 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_80 : f32 = v1[x_78]; + let x_82 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_84 : f32 = ref[x_82]; + x_85 = (x_80 == x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_98_phi = x_86; + if (x_86) { + let x_90 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_92 : f32 = v1[x_90]; + let x_94 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_96 : f32 = ref[x_94]; + x_97 = (x_92 == x_96); + x_98_phi = x_97; + } + let x_98 : bool = x_98_phi; + x_110_phi = x_98; + if (x_98) { + let x_102 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_104 : f32 = v1[x_102]; + let x_106 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_108 : f32 = ref[x_106]; + x_109 = (x_104 == x_108); + x_110_phi = x_109; + } + let x_110 : bool = x_110_phi; + if (x_110) { + let x_115 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_118 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_121 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_124 : i32 = x_10.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_115), f32(x_118), f32(x_121), f32(x_124)); + } else { + let x_128 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_130 : f32 = v1[x_128]; + x_GLF_color = vec4(x_130, x_130, x_130, x_130); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl new file mode 100644 index 0000000000..281628c817 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl @@ -0,0 +1,102 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var v1 : vec4; + var ref : vec4; + var x_85 : bool; + var x_97 : bool; + var x_109 : bool; + var x_86_phi : bool; + var x_98_phi : bool; + var x_110_phi : bool; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + a = pack4x8unorm(vec4(x_36, x_36, x_36, x_36)); + let x_39 : u32 = a; + v1 = unpack4x8snorm(x_39); + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_45 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_48 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_51 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_54 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_57 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_63 : f32 = x_6.x_GLF_uniform_float_values[1]; + ref = vec4((-(x_42) / x_45), (-(x_48) / x_51), (-(x_54) / x_57), (-(x_60) / x_63)); + let x_67 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_69 : f32 = v1[x_67]; + let x_71 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_73 : f32 = ref[x_71]; + let x_74 : bool = (x_69 == x_73); + x_86_phi = x_74; + if (x_74) { + let x_78 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_80 : f32 = v1[x_78]; + let x_82 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_84 : f32 = ref[x_82]; + x_85 = (x_80 == x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_98_phi = x_86; + if (x_86) { + let x_90 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_92 : f32 = v1[x_90]; + let x_94 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_96 : f32 = ref[x_94]; + x_97 = (x_92 == x_96); + x_98_phi = x_97; + } + let x_98 : bool = x_98_phi; + x_110_phi = x_98; + if (x_98) { + let x_102 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_104 : f32 = v1[x_102]; + let x_106 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_108 : f32 = ref[x_106]; + x_109 = (x_104 == x_108); + x_110_phi = x_109; + } + let x_110 : bool = x_110_phi; + if (x_110) { + let x_115 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_118 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_121 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_124 : i32 = x_10.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_115), f32(x_118), f32(x_121), f32(x_124)); + } else { + let x_128 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_130 : f32 = v1[x_128]; + x_GLF_color = vec4(x_130, x_130, x_130, x_130); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..67cbab7911 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.hlsl @@ -0,0 +1,109 @@ +uint tint_pack4x8unorm(float4 param_0) { + uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0)); + return (i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +float4 tint_unpack4x8snorm(uint param_0) { + int j = int(param_0); + int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; + return clamp(float4(i) / 127.0, -1.0, 1.0); +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 ref = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_85 = false; + bool x_97 = false; + bool x_109 = false; + bool x_86_phi = false; + bool x_98_phi = false; + bool x_110_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + a = tint_pack4x8unorm(float4(x_36, x_36, x_36, x_36)); + v1 = tint_unpack4x8snorm(a); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_42 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_45 = asfloat(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_48 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_51 = asfloat(x_6[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_54 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_57 = asfloat(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_60 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_63 = asfloat(x_6[1].x); + ref = float4((-(x_42) / x_45), (-(x_48) / x_51), (-(x_54) / x_57), (-(x_60) / x_63)); + const int x_67 = asint(x_10[1].x); + const float x_69 = v1[x_67]; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_71 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const float x_73 = ref[x_71]; + const bool x_74 = (x_69 == x_73); + x_86_phi = x_74; + if (x_74) { + const int x_78 = asint(x_10[3].x); + const float x_80 = v1[x_78]; + const int x_82 = asint(x_10[2].x); + const float x_84 = ref[x_82]; + x_85 = (x_80 == x_84); + x_86_phi = x_85; + } + const bool x_86 = x_86_phi; + x_98_phi = x_86; + if (x_86) { + const int x_90 = asint(x_10[2].x); + const float x_92 = v1[x_90]; + const int x_94 = asint(x_10[3].x); + const float x_96 = ref[x_94]; + x_97 = (x_92 == x_96); + x_98_phi = x_97; + } + const bool x_98 = x_98_phi; + x_110_phi = x_98; + if (x_98) { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_102 = asint(x_10[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_104 = v1[x_102]; + const int x_106 = asint(x_10[1].x); + const float x_108 = ref[x_106]; + x_109 = (x_104 == x_108); + x_110_phi = x_109; + } + if (x_110_phi) { + const int x_115 = asint(x_10[3].x); + const int x_118 = asint(x_10[1].x); + const int x_121 = asint(x_10[1].x); + const int x_124 = asint(x_10[3].x); + x_GLF_color = float4(float(x_115), float(x_118), float(x_121), float(x_124)); + } else { + const int x_128 = asint(x_10[1].x); + const float x_130 = v1[x_128]; + x_GLF_color = float4(x_130, x_130, x_130, x_130); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d135092add --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.msl @@ -0,0 +1,110 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_10, thread float4* const tint_symbol_4) { + uint a = 0u; + float4 v1 = 0.0f; + float4 ref = 0.0f; + bool x_85 = false; + bool x_97 = false; + bool x_109 = false; + bool x_86_phi = false; + bool x_98_phi = false; + bool x_110_phi = false; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[0].el; + a = pack_float_to_unorm4x8(float4(x_36, x_36, x_36, x_36)); + uint const x_39 = a; + v1 = unpack_snorm4x8_to_float(x_39); + float const x_42 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_45 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_48 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_51 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_54 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_57 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_63 = x_6.x_GLF_uniform_float_values.arr[1].el; + ref = float4((-(x_42) / x_45), (-(x_48) / x_51), (-(x_54) / x_57), (-(x_60) / x_63)); + int const x_67 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_69 = v1[x_67]; + int const x_71 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_73 = ref[x_71]; + bool const x_74 = (x_69 == x_73); + x_86_phi = x_74; + if (x_74) { + int const x_78 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_80 = v1[x_78]; + int const x_82 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_84 = ref[x_82]; + x_85 = (x_80 == x_84); + x_86_phi = x_85; + } + bool const x_86 = x_86_phi; + x_98_phi = x_86; + if (x_86) { + int const x_90 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_92 = v1[x_90]; + int const x_94 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_96 = ref[x_94]; + x_97 = (x_92 == x_96); + x_98_phi = x_97; + } + bool const x_98 = x_98_phi; + x_110_phi = x_98; + if (x_98) { + int const x_102 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_104 = v1[x_102]; + int const x_106 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_108 = ref[x_106]; + x_109 = (x_104 == x_108); + x_110_phi = x_109; + } + bool const x_110 = x_110_phi; + if (x_110) { + int const x_115 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_118 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_121 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_124 = x_10.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_4) = float4(float(x_115), float(x_118), float(x_121), float(x_124)); + } else { + int const x_128 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_130 = v1[x_128]; + *(tint_symbol_4) = float4(x_130, x_130, x_130, x_130); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..a1804d07f9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.spvasm @@ -0,0 +1,239 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 160 +; Schema: 0 + OpCapability Shader + %45 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %v1 "v1" + OpName %ref "ref" + OpName %x_85 "x_85" + OpName %x_97 "x_97" + OpName %x_109 "x_109" + OpName %x_86_phi "x_86_phi" + OpName %x_98_phi "x_98_phi" + OpName %x_110_phi "x_110_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %26 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %33 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %148 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %26 + %v1 = OpVariable %_ptr_Function_v4float Function %17 + %ref = OpVariable %_ptr_Function_v4float Function %17 + %x_85 = OpVariable %_ptr_Function_bool Function %33 + %x_97 = OpVariable %_ptr_Function_bool Function %33 + %x_109 = OpVariable %_ptr_Function_bool Function %33 + %x_86_phi = OpVariable %_ptr_Function_bool Function %33 + %x_98_phi = OpVariable %_ptr_Function_bool Function %33 + %x_110_phi = OpVariable %_ptr_Function_bool Function %33 + %42 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %43 = OpLoad %float %42 + %46 = OpCompositeConstruct %v4float %43 %43 %43 %43 + %44 = OpExtInst %uint %45 PackUnorm4x8 %46 + OpStore %a %44 + %47 = OpLoad %uint %a + %48 = OpExtInst %v4float %45 UnpackSnorm4x8 %47 + OpStore %v1 %48 + %49 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %57 = OpLoad %float %56 + %58 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %65 = OpLoad %float %64 + %66 = OpFNegate %float %50 + %67 = OpFDiv %float %66 %53 + %68 = OpFNegate %float %55 + %69 = OpFDiv %float %68 %57 + %70 = OpFNegate %float %59 + %71 = OpFDiv %float %70 %61 + %72 = OpFNegate %float %63 + %73 = OpFDiv %float %72 %65 + %74 = OpCompositeConstruct %v4float %67 %69 %71 %73 + OpStore %ref %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %77 = OpLoad %int %76 + %79 = OpAccessChain %_ptr_Function_float %v1 %77 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Function_float %ref %82 + %84 = OpLoad %float %83 + %85 = OpFOrdEqual %bool %80 %84 + OpStore %x_86_phi %85 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Function_float %v1 %90 + %92 = OpLoad %float %91 + %94 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %95 = OpLoad %int %94 + %96 = OpAccessChain %_ptr_Function_float %ref %95 + %97 = OpLoad %float %96 + %98 = OpFOrdEqual %bool %92 %97 + OpStore %x_85 %98 + %99 = OpLoad %bool %x_85 + OpStore %x_86_phi %99 + OpBranch %86 + %86 = OpLabel + %100 = OpLoad %bool %x_86_phi + OpStore %x_98_phi %100 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %104 = OpLoad %int %103 + %105 = OpAccessChain %_ptr_Function_float %v1 %104 + %106 = OpLoad %float %105 + %107 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %108 = OpLoad %int %107 + %109 = OpAccessChain %_ptr_Function_float %ref %108 + %110 = OpLoad %float %109 + %111 = OpFOrdEqual %bool %106 %110 + OpStore %x_97 %111 + %112 = OpLoad %bool %x_97 + OpStore %x_98_phi %112 + OpBranch %101 + %101 = OpLabel + %113 = OpLoad %bool %x_98_phi + OpStore %x_110_phi %113 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %114 + %115 = OpLabel + %116 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %117 = OpLoad %int %116 + %118 = OpAccessChain %_ptr_Function_float %v1 %117 + %119 = OpLoad %float %118 + %120 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %121 = OpLoad %int %120 + %122 = OpAccessChain %_ptr_Function_float %ref %121 + %123 = OpLoad %float %122 + %124 = OpFOrdEqual %bool %119 %123 + OpStore %x_109 %124 + %125 = OpLoad %bool %x_109 + OpStore %x_110_phi %125 + OpBranch %114 + %114 = OpLabel + %126 = OpLoad %bool %x_110_phi + OpSelectionMerge %127 None + OpBranchConditional %126 %128 %129 + %128 = OpLabel + %130 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %131 = OpLoad %int %130 + %132 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %133 = OpLoad %int %132 + %134 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %135 = OpLoad %int %134 + %136 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %137 = OpLoad %int %136 + %138 = OpConvertSToF %float %131 + %139 = OpConvertSToF %float %133 + %140 = OpConvertSToF %float %135 + %141 = OpConvertSToF %float %137 + %142 = OpCompositeConstruct %v4float %138 %139 %140 %141 + OpStore %x_GLF_color %142 + OpBranch %127 + %129 = OpLabel + %143 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %144 = OpLoad %int %143 + %145 = OpAccessChain %_ptr_Function_float %v1 %144 + %146 = OpLoad %float %145 + %147 = OpCompositeConstruct %v4float %146 %146 %146 %146 + OpStore %x_GLF_color %147 + OpBranch %127 + %127 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %148 +%tint_symbol = OpFunctionParameter %main_out + %152 = OpLabel + %153 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %153 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %155 = OpLabel + %156 = OpFunctionCall %void %main_1 + %158 = OpLoad %v4float %x_GLF_color + %159 = OpCompositeConstruct %main_out %158 + %157 = OpFunctionCall %void %tint_symbol_2 %159 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..281628c817 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-pack-unpack/0-opt.wgsl.expected.wgsl @@ -0,0 +1,102 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var v1 : vec4; + var ref : vec4; + var x_85 : bool; + var x_97 : bool; + var x_109 : bool; + var x_86_phi : bool; + var x_98_phi : bool; + var x_110_phi : bool; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + a = pack4x8unorm(vec4(x_36, x_36, x_36, x_36)); + let x_39 : u32 = a; + v1 = unpack4x8snorm(x_39); + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_45 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_48 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_51 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_54 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_57 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_63 : f32 = x_6.x_GLF_uniform_float_values[1]; + ref = vec4((-(x_42) / x_45), (-(x_48) / x_51), (-(x_54) / x_57), (-(x_60) / x_63)); + let x_67 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_69 : f32 = v1[x_67]; + let x_71 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_73 : f32 = ref[x_71]; + let x_74 : bool = (x_69 == x_73); + x_86_phi = x_74; + if (x_74) { + let x_78 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_80 : f32 = v1[x_78]; + let x_82 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_84 : f32 = ref[x_82]; + x_85 = (x_80 == x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_98_phi = x_86; + if (x_86) { + let x_90 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_92 : f32 = v1[x_90]; + let x_94 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_96 : f32 = ref[x_94]; + x_97 = (x_92 == x_96); + x_98_phi = x_97; + } + let x_98 : bool = x_98_phi; + x_110_phi = x_98; + if (x_98) { + let x_102 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_104 : f32 = v1[x_102]; + let x_106 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_108 : f32 = ref[x_106]; + x_109 = (x_104 == x_108); + x_110_phi = x_109; + } + let x_110 : bool = x_110_phi; + if (x_110) { + let x_115 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_118 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_121 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_124 : i32 = x_10.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_115), f32(x_118), f32(x_121), f32(x_124)); + } else { + let x_128 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_130 : f32 = v1[x_128]; + x_GLF_color = vec4(x_130, x_130, x_130, x_130); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm new file mode 100644 index 0000000000..07cab15f61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm @@ -0,0 +1,133 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %count0 "count0" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %count1 "count1" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_3 = OpConstant %int 3 + %main = OpFunction %void None %11 + %27 = OpLabel + %count0 = OpVariable %_ptr_Function_int Function + %count1 = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %29 = OpLoad %int %28 + OpStore %count0 %29 + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %31 = OpLoad %int %30 + OpStore %count1 %31 + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %33 = OpLoad %int %32 + OpStore %i %33 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %40 = OpLoad %int %39 + %41 = OpSLessThan %bool %38 %40 + OpBranchConditional %41 %42 %35 + %42 = OpLabel + %43 = OpLoad %int %i + OpSelectionMerge %44 None + OpSwitch %43 %44 0 %45 1 %45 3 %46 2 %46 + %45 = OpLabel + %47 = OpLoad %int %count0 + %48 = OpIAdd %int %47 %int_1 + OpStore %count0 %48 + OpBranch %46 + %46 = OpLabel + %49 = OpLoad %int %count1 + %50 = OpIAdd %int %49 %int_1 + OpStore %count1 %50 + OpBranch %44 + %44 = OpLabel + OpBranch %36 + %36 = OpLabel + %51 = OpLoad %int %i + %52 = OpIAdd %int %51 %int_1 + OpStore %i %52 + OpBranch %34 + %35 = OpLabel + %53 = OpLoad %int %count1 + %54 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpIEqual %bool %53 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %61 + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %67 + %69 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %70 + %72 = OpCompositeConstruct %v4float %62 %65 %68 %71 + OpStore %_GLF_color %72 + OpBranch %57 + %59 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %_GLF_color %76 + OpBranch %57 + %57 = OpLabel + %77 = OpLoad %int %count0 + %78 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpINotEqual %bool %77 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + %83 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %84 = OpLoad %int %83 + %85 = OpConvertSToF %float %84 + %86 = OpCompositeConstruct %v4float %85 %85 %85 %85 + OpStore %_GLF_color %86 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..bb5b30efd6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.hlsl @@ -0,0 +1,78 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int count0 = 0; + int count1 = 0; + int i = 0; + const int x_29 = asint(x_6[2].x); + count0 = x_29; + const int x_31 = asint(x_6[2].x); + count1 = x_31; + const int x_33 = asint(x_6[2].x); + i = x_33; + while (true) { + const int x_38 = i; + const int x_40 = asint(x_6[4].x); + if ((x_38 < x_40)) { + } else { + break; + } + switch(i) { + case 0: + case 1: { + count0 = (count0 + 1); + /* fallthrough */ + } + case 2: + case 3: { + count1 = (count1 + 1); + break; + } + default: { + break; + } + } + { + i = (i + 1); + } + } + const int x_53 = count1; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_53 == x_55)) { + const int x_61 = asint(x_6[3].x); + const int x_64 = asint(x_6[2].x); + const int x_67 = asint(x_6[2].x); + const int x_70 = asint(x_6[3].x); + x_GLF_color = float4(float(x_61), float(x_64), float(x_67), float(x_70)); + } else { + const int x_74 = asint(x_6[2].x); + const float x_75 = float(x_74); + x_GLF_color = float4(x_75, x_75, x_75, x_75); + } + const int x_77 = count0; + const int x_79 = asint(x_6[1].x); + if ((x_77 != x_79)) { + const int x_84 = asint(x_6[2].x); + const float x_85 = float(x_84); + x_GLF_color = float4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4f33cd7482 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int count0 = 0; + int count1 = 0; + int i = 0; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[2].el; + count0 = x_29; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[2].el; + count1 = x_31; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_33; + while (true) { + int const x_38 = i; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[4].el; + if ((x_38 < x_40)) { + } else { + break; + } + int const x_43 = i; + switch(x_43) { + case 0: + case 1: { + int const x_47 = count0; + count0 = (x_47 + 1); + /* fallthrough */ + } + case 2: + case 3: { + int const x_49 = count1; + count1 = (x_49 + 1); + break; + } + default: { + break; + } + } + { + int const x_51 = i; + i = (x_51 + 1); + } + } + int const x_53 = count1; + int const x_55 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_53 == x_55)) { + int const x_61 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_67 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_70 = x_6.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_4) = float4(float(x_61), float(x_64), float(x_67), float(x_70)); + } else { + int const x_74 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_75 = float(x_74); + *(tint_symbol_4) = float4(x_75, x_75, x_75, x_75); + } + int const x_77 = count0; + int const x_79 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_77 != x_79)) { + int const x_84 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_85 = float(x_84); + *(tint_symbol_4) = float4(x_85, x_85, x_85, x_85); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4075f23691 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.spvasm @@ -0,0 +1,173 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 106 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %count0 "count0" + OpName %count1 "count1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %94 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %count0 = OpVariable %_ptr_Function_int Function %21 + %count1 = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %28 = OpLoad %int %27 + OpStore %count0 %28 + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %30 = OpLoad %int %29 + OpStore %count1 %30 + %31 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %32 = OpLoad %int %31 + OpStore %i %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %40 = OpLoad %int %39 + %41 = OpSLessThan %bool %37 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %34 + %43 = OpLabel + %46 = OpLoad %int %i + OpSelectionMerge %47 None + OpSwitch %46 %48 0 %49 1 %49 2 %50 3 %50 + %49 = OpLabel + %51 = OpLoad %int %count0 + %53 = OpIAdd %int %51 %int_1 + OpStore %count0 %53 + OpBranch %50 + %50 = OpLabel + %54 = OpLoad %int %count1 + %55 = OpIAdd %int %54 %int_1 + OpStore %count1 %55 + OpBranch %47 + %48 = OpLabel + OpBranch %47 + %47 = OpLabel + OpBranch %35 + %35 = OpLabel + %56 = OpLoad %int %i + %57 = OpIAdd %int %56 %int_1 + OpStore %i %57 + OpBranch %33 + %34 = OpLabel + %58 = OpLoad %int %count1 + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpIEqual %bool %58 %61 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %70 = OpLoad %int %69 + %71 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %68 + %76 = OpConvertSToF %float %70 + %77 = OpConvertSToF %float %72 + %78 = OpConvertSToF %float %74 + %79 = OpCompositeConstruct %v4float %75 %76 %77 %78 + OpStore %x_GLF_color %79 + OpBranch %63 + %65 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %81 + %83 = OpCompositeConstruct %v4float %82 %82 %82 %82 + OpStore %x_GLF_color %83 + OpBranch %63 + %63 = OpLabel + %84 = OpLoad %int %count0 + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpINotEqual %bool %84 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %91 + %93 = OpCompositeConstruct %v4float %92 %92 %92 %92 + OpStore %x_GLF_color %93 + OpBranch %88 + %88 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %94 +%tint_symbol = OpFunctionParameter %main_out + %98 = OpLabel + %99 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %99 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %101 = OpLabel + %102 = OpFunctionCall %void %main_1 + %104 = OpLoad %v4float %x_GLF_color + %105 = OpCompositeConstruct %main_out %104 + %103 = OpFunctionCall %void %tint_symbol_2 %105 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c70fd114a7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.wgsl @@ -0,0 +1,81 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var count0 : i32; + var count1 : i32; + var i : i32; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[2]; + count0 = x_29; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[2]; + count1 = x_31; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_33; + loop { + let x_38 : i32 = i; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_38 < x_40)) { + } else { + break; + } + let x_43 : i32 = i; + switch(x_43) { + case 0, 1: { + let x_47 : i32 = count0; + count0 = (x_47 + 1); + fallthrough; + } + case 2, 3: { + let x_49 : i32 = count1; + count1 = (x_49 + 1); + } + default: { + } + } + + continuing { + let x_51 : i32 = i; + i = (x_51 + 1); + } + } + let x_53 : i32 = count1; + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_53 == x_55)) { + let x_61 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_70 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_61), f32(x_64), f32(x_67), f32(x_70)); + } else { + let x_74 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_75 : f32 = f32(x_74); + x_GLF_color = vec4(x_75, x_75, x_75, x_75); + } + let x_77 : i32 = count0; + let x_79 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_77 != x_79)) { + let x_84 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_85 : f32 = f32(x_84); + x_GLF_color = vec4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl new file mode 100644 index 0000000000..c70fd114a7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl @@ -0,0 +1,81 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var count0 : i32; + var count1 : i32; + var i : i32; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[2]; + count0 = x_29; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[2]; + count1 = x_31; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_33; + loop { + let x_38 : i32 = i; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_38 < x_40)) { + } else { + break; + } + let x_43 : i32 = i; + switch(x_43) { + case 0, 1: { + let x_47 : i32 = count0; + count0 = (x_47 + 1); + fallthrough; + } + case 2, 3: { + let x_49 : i32 = count1; + count1 = (x_49 + 1); + } + default: { + } + } + + continuing { + let x_51 : i32 = i; + i = (x_51 + 1); + } + } + let x_53 : i32 = count1; + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_53 == x_55)) { + let x_61 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_70 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_61), f32(x_64), f32(x_67), f32(x_70)); + } else { + let x_74 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_75 : f32 = f32(x_74); + x_GLF_color = vec4(x_75, x_75, x_75, x_75); + } + let x_77 : i32 = count0; + let x_79 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_77 != x_79)) { + let x_84 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_85 : f32 = f32(x_84); + x_GLF_color = vec4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..bb5b30efd6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.hlsl @@ -0,0 +1,78 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int count0 = 0; + int count1 = 0; + int i = 0; + const int x_29 = asint(x_6[2].x); + count0 = x_29; + const int x_31 = asint(x_6[2].x); + count1 = x_31; + const int x_33 = asint(x_6[2].x); + i = x_33; + while (true) { + const int x_38 = i; + const int x_40 = asint(x_6[4].x); + if ((x_38 < x_40)) { + } else { + break; + } + switch(i) { + case 0: + case 1: { + count0 = (count0 + 1); + /* fallthrough */ + } + case 2: + case 3: { + count1 = (count1 + 1); + break; + } + default: { + break; + } + } + { + i = (i + 1); + } + } + const int x_53 = count1; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_53 == x_55)) { + const int x_61 = asint(x_6[3].x); + const int x_64 = asint(x_6[2].x); + const int x_67 = asint(x_6[2].x); + const int x_70 = asint(x_6[3].x); + x_GLF_color = float4(float(x_61), float(x_64), float(x_67), float(x_70)); + } else { + const int x_74 = asint(x_6[2].x); + const float x_75 = float(x_74); + x_GLF_color = float4(x_75, x_75, x_75, x_75); + } + const int x_77 = count0; + const int x_79 = asint(x_6[1].x); + if ((x_77 != x_79)) { + const int x_84 = asint(x_6[2].x); + const float x_85 = float(x_84); + x_GLF_color = float4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4f33cd7482 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int count0 = 0; + int count1 = 0; + int i = 0; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[2].el; + count0 = x_29; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[2].el; + count1 = x_31; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_33; + while (true) { + int const x_38 = i; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[4].el; + if ((x_38 < x_40)) { + } else { + break; + } + int const x_43 = i; + switch(x_43) { + case 0: + case 1: { + int const x_47 = count0; + count0 = (x_47 + 1); + /* fallthrough */ + } + case 2: + case 3: { + int const x_49 = count1; + count1 = (x_49 + 1); + break; + } + default: { + break; + } + } + { + int const x_51 = i; + i = (x_51 + 1); + } + } + int const x_53 = count1; + int const x_55 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_53 == x_55)) { + int const x_61 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_67 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_70 = x_6.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_4) = float4(float(x_61), float(x_64), float(x_67), float(x_70)); + } else { + int const x_74 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_75 = float(x_74); + *(tint_symbol_4) = float4(x_75, x_75, x_75, x_75); + } + int const x_77 = count0; + int const x_79 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_77 != x_79)) { + int const x_84 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_85 = float(x_84); + *(tint_symbol_4) = float4(x_85, x_85, x_85, x_85); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4075f23691 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.spvasm @@ -0,0 +1,173 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 106 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %count0 "count0" + OpName %count1 "count1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %94 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %count0 = OpVariable %_ptr_Function_int Function %21 + %count1 = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %28 = OpLoad %int %27 + OpStore %count0 %28 + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %30 = OpLoad %int %29 + OpStore %count1 %30 + %31 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %32 = OpLoad %int %31 + OpStore %i %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %40 = OpLoad %int %39 + %41 = OpSLessThan %bool %37 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %34 + %43 = OpLabel + %46 = OpLoad %int %i + OpSelectionMerge %47 None + OpSwitch %46 %48 0 %49 1 %49 2 %50 3 %50 + %49 = OpLabel + %51 = OpLoad %int %count0 + %53 = OpIAdd %int %51 %int_1 + OpStore %count0 %53 + OpBranch %50 + %50 = OpLabel + %54 = OpLoad %int %count1 + %55 = OpIAdd %int %54 %int_1 + OpStore %count1 %55 + OpBranch %47 + %48 = OpLabel + OpBranch %47 + %47 = OpLabel + OpBranch %35 + %35 = OpLabel + %56 = OpLoad %int %i + %57 = OpIAdd %int %56 %int_1 + OpStore %i %57 + OpBranch %33 + %34 = OpLabel + %58 = OpLoad %int %count1 + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpIEqual %bool %58 %61 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %70 = OpLoad %int %69 + %71 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %68 + %76 = OpConvertSToF %float %70 + %77 = OpConvertSToF %float %72 + %78 = OpConvertSToF %float %74 + %79 = OpCompositeConstruct %v4float %75 %76 %77 %78 + OpStore %x_GLF_color %79 + OpBranch %63 + %65 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %81 + %83 = OpCompositeConstruct %v4float %82 %82 %82 %82 + OpStore %x_GLF_color %83 + OpBranch %63 + %63 = OpLabel + %84 = OpLoad %int %count0 + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpINotEqual %bool %84 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %91 + %93 = OpCompositeConstruct %v4float %92 %92 %92 %92 + OpStore %x_GLF_color %93 + OpBranch %88 + %88 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %94 +%tint_symbol = OpFunctionParameter %main_out + %98 = OpLabel + %99 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %99 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %101 = OpLabel + %102 = OpFunctionCall %void %main_1 + %104 = OpLoad %v4float %x_GLF_color + %105 = OpCompositeConstruct %main_out %104 + %103 = OpFunctionCall %void %tint_symbol_2 %105 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c70fd114a7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.wgsl @@ -0,0 +1,81 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var count0 : i32; + var count1 : i32; + var i : i32; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[2]; + count0 = x_29; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[2]; + count1 = x_31; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_33; + loop { + let x_38 : i32 = i; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_38 < x_40)) { + } else { + break; + } + let x_43 : i32 = i; + switch(x_43) { + case 0, 1: { + let x_47 : i32 = count0; + count0 = (x_47 + 1); + fallthrough; + } + case 2, 3: { + let x_49 : i32 = count1; + count1 = (x_49 + 1); + } + default: { + } + } + + continuing { + let x_51 : i32 = i; + i = (x_51 + 1); + } + } + let x_53 : i32 = count1; + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_53 == x_55)) { + let x_61 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_70 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_61), f32(x_64), f32(x_67), f32(x_70)); + } else { + let x_74 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_75 : f32 = f32(x_74); + x_GLF_color = vec4(x_75, x_75, x_75, x_75); + } + let x_77 : i32 = count0; + let x_79 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_77 != x_79)) { + let x_84 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_85 : f32 = f32(x_84); + x_GLF_color = vec4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm new file mode 100644 index 0000000000..5eb0519676 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm @@ -0,0 +1,103 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %data "data" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_float_uint_2_0 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_arr_float_uint_2_0 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2_0 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %13 + %31 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_2 Function + %a = OpVariable %_ptr_Function_float Function + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %33 = OpLoad %int %32 + %34 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Function_float %data %33 + OpStore %36 %35 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %38 = OpLoad %int %37 + %39 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Function_float %data %38 + OpStore %41 %40 + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpBitwiseAnd %int %43 %int_2 + %45 = OpBitwiseXor %int %int_1 %44 + %46 = OpAccessChain %_ptr_Function_float %data %45 + %47 = OpLoad %float %46 + OpStore %a %47 + %48 = OpLoad %float %a + %49 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %50 = OpLoad %float %49 + %51 = OpFOrdEqual %bool %48 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %56 = OpLoad %float %55 + %57 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %60 = OpLoad %float %59 + %61 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %62 = OpLoad %float %61 + %63 = OpCompositeConstruct %v4float %56 %58 %60 %62 + OpStore %_GLF_color %63 + OpBranch %52 + %54 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %65 = OpLoad %float %64 + %66 = OpCompositeConstruct %v4float %65 %65 %65 %65 + OpStore %_GLF_color %66 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..596a485322 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.hlsl @@ -0,0 +1,53 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float data[2] = (float[2])0; + float a = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_33 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_35 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + data[x_33] = x_35; + const int x_38 = asint(x_6[1].x); + const float x_40 = asfloat(x_8[1].x); + data[x_38] = x_40; + const int x_43 = asint(x_6[1].x); + const float x_47 = data[(1 ^ (x_43 & 2))]; + a = x_47; + const float x_48 = a; + const float x_50 = asfloat(x_8[1].x); + if ((x_48 == x_50)) { + const float x_56 = asfloat(x_8[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_58 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_60 = asfloat(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_62 = asfloat(x_8[1].x); + x_GLF_color = float4(x_56, x_58, x_60, x_62); + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_65 = asfloat(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4de038f886 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.msl @@ -0,0 +1,68 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + float arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + tint_array_wrapper_2 data = {}; + float a = 0.0f; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_35 = x_8.x_GLF_uniform_float_values.arr[0].el; + data.arr[x_33] = x_35; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_40 = x_8.x_GLF_uniform_float_values.arr[1].el; + data.arr[x_38] = x_40; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_47 = data.arr[(1 ^ (x_43 & 2))]; + a = x_47; + float const x_48 = a; + float const x_50 = x_8.x_GLF_uniform_float_values.arr[1].el; + if ((x_48 == x_50)) { + float const x_56 = x_8.x_GLF_uniform_float_values.arr[1].el; + float const x_58 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_60 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_62 = x_8.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_56, x_58, x_60, x_62); + } else { + float const x_65 = x_8.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_65, x_65, x_65, x_65); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2d8d7ba007 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.spvasm @@ -0,0 +1,139 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 84 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %data "data" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_2_0 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_arr_float_uint_2_0 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2_0 = OpTypePointer Function %_arr_float_uint_2_0 + %26 = OpConstantNull %_arr_float_uint_2_0 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %72 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_2_0 Function %26 + %a = OpVariable %_ptr_Function_float Function %29 + %33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %34 = OpLoad %int %33 + %36 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Function_float %data %34 + OpStore %38 %37 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %43 = OpLoad %float %42 + %44 = OpAccessChain %_ptr_Function_float %data %41 + OpStore %44 %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %46 = OpLoad %int %45 + %48 = OpBitwiseAnd %int %46 %int_2 + %49 = OpBitwiseXor %int %int_1 %48 + %50 = OpAccessChain %_ptr_Function_float %data %49 + %51 = OpLoad %float %50 + OpStore %a %51 + %52 = OpLoad %float %a + %53 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %54 = OpLoad %float %53 + %55 = OpFOrdEqual %bool %52 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %67 = OpLoad %float %66 + %68 = OpCompositeConstruct %v4float %61 %63 %65 %67 + OpStore %x_GLF_color %68 + OpBranch %57 + %59 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %70 = OpLoad %float %69 + %71 = OpCompositeConstruct %v4float %70 %70 %70 %70 + OpStore %x_GLF_color %71 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %72 +%tint_symbol = OpFunctionParameter %main_out + %76 = OpLabel + %77 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %77 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %79 = OpLabel + %80 = OpFunctionCall %void %main_1 + %82 = OpLoad %v4float %x_GLF_color + %83 = OpCompositeConstruct %main_out %82 + %81 = OpFunctionCall %void %tint_symbol_2 %83 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..e5869f4e38 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.spvasm.expected.wgsl @@ -0,0 +1,57 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var a : f32; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_35 : f32 = x_8.x_GLF_uniform_float_values[0]; + data[x_33] = x_35; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_40 : f32 = x_8.x_GLF_uniform_float_values[1]; + data[x_38] = x_40; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_47 : f32 = data[(1 ^ (x_43 & 2))]; + a = x_47; + let x_48 : f32 = a; + let x_50 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_48 == x_50)) { + let x_56 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_58 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_60 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_62 : f32 = x_8.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_56, x_58, x_60, x_62); + } else { + let x_65 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl new file mode 100644 index 0000000000..e5869f4e38 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl @@ -0,0 +1,57 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var a : f32; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_35 : f32 = x_8.x_GLF_uniform_float_values[0]; + data[x_33] = x_35; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_40 : f32 = x_8.x_GLF_uniform_float_values[1]; + data[x_38] = x_40; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_47 : f32 = data[(1 ^ (x_43 & 2))]; + a = x_47; + let x_48 : f32 = a; + let x_50 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_48 == x_50)) { + let x_56 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_58 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_60 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_62 : f32 = x_8.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_56, x_58, x_60, x_62); + } else { + let x_65 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..596a485322 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.hlsl @@ -0,0 +1,53 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float data[2] = (float[2])0; + float a = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_33 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_35 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + data[x_33] = x_35; + const int x_38 = asint(x_6[1].x); + const float x_40 = asfloat(x_8[1].x); + data[x_38] = x_40; + const int x_43 = asint(x_6[1].x); + const float x_47 = data[(1 ^ (x_43 & 2))]; + a = x_47; + const float x_48 = a; + const float x_50 = asfloat(x_8[1].x); + if ((x_48 == x_50)) { + const float x_56 = asfloat(x_8[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_58 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_60 = asfloat(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_62 = asfloat(x_8[1].x); + x_GLF_color = float4(x_56, x_58, x_60, x_62); + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_65 = asfloat(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4de038f886 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.msl @@ -0,0 +1,68 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + float arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + tint_array_wrapper_2 data = {}; + float a = 0.0f; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_35 = x_8.x_GLF_uniform_float_values.arr[0].el; + data.arr[x_33] = x_35; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_40 = x_8.x_GLF_uniform_float_values.arr[1].el; + data.arr[x_38] = x_40; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_47 = data.arr[(1 ^ (x_43 & 2))]; + a = x_47; + float const x_48 = a; + float const x_50 = x_8.x_GLF_uniform_float_values.arr[1].el; + if ((x_48 == x_50)) { + float const x_56 = x_8.x_GLF_uniform_float_values.arr[1].el; + float const x_58 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_60 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_62 = x_8.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_56, x_58, x_60, x_62); + } else { + float const x_65 = x_8.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_65, x_65, x_65, x_65); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2d8d7ba007 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.spvasm @@ -0,0 +1,139 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 84 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %data "data" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_2_0 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_arr_float_uint_2_0 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2_0 = OpTypePointer Function %_arr_float_uint_2_0 + %26 = OpConstantNull %_arr_float_uint_2_0 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %72 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_2_0 Function %26 + %a = OpVariable %_ptr_Function_float Function %29 + %33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %34 = OpLoad %int %33 + %36 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Function_float %data %34 + OpStore %38 %37 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %43 = OpLoad %float %42 + %44 = OpAccessChain %_ptr_Function_float %data %41 + OpStore %44 %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %46 = OpLoad %int %45 + %48 = OpBitwiseAnd %int %46 %int_2 + %49 = OpBitwiseXor %int %int_1 %48 + %50 = OpAccessChain %_ptr_Function_float %data %49 + %51 = OpLoad %float %50 + OpStore %a %51 + %52 = OpLoad %float %a + %53 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %54 = OpLoad %float %53 + %55 = OpFOrdEqual %bool %52 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %67 = OpLoad %float %66 + %68 = OpCompositeConstruct %v4float %61 %63 %65 %67 + OpStore %x_GLF_color %68 + OpBranch %57 + %59 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %70 = OpLoad %float %69 + %71 = OpCompositeConstruct %v4float %70 %70 %70 %70 + OpStore %x_GLF_color %71 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %72 +%tint_symbol = OpFunctionParameter %main_out + %76 = OpLabel + %77 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %77 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %79 = OpLabel + %80 = OpFunctionCall %void %main_1 + %82 = OpLoad %v4float %x_GLF_color + %83 = OpCompositeConstruct %main_out %82 + %81 = OpFunctionCall %void %tint_symbol_2 %83 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..e5869f4e38 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-xor-add/0-opt.wgsl.expected.wgsl @@ -0,0 +1,57 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var a : f32; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_35 : f32 = x_8.x_GLF_uniform_float_values[0]; + data[x_33] = x_35; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_40 : f32 = x_8.x_GLF_uniform_float_values[1]; + data[x_38] = x_40; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_47 : f32 = data[(1 ^ (x_43 & 2))]; + a = x_47; + let x_48 : f32 = a; + let x_50 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_48 == x_50)) { + let x_56 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_58 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_60 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_62 : f32 = x_8.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_56, x_58, x_60, x_62); + } else { + let x_65 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_65, x_65, x_65, x_65); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm new file mode 100644 index 0000000000..bb91929982 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm @@ -0,0 +1,73 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %main = OpFunction %void None %13 + %26 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %7 = OpLoad %int %27 + %28 = OpConvertSToF %float %7 + %29 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %8 = OpLoad %int %29 + %30 = OpConvertSToF %float %8 + %31 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %9 = OpLoad %int %31 + %32 = OpConvertSToF %float %9 + %33 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %10 = OpLoad %int %33 + %34 = OpConvertSToF %float %10 + %35 = OpCompositeConstruct %v4float %28 %30 %32 %34 + OpStore %_GLF_color %35 + %36 = OpLoad %v4float %_GLF_color + %37 = OpFNegate %v4float %36 + %38 = OpCompositeExtract %float %37 0 + %39 = OpIsNan %bool %38 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %11 = OpLoad %int %42 + %43 = OpConvertSToF %float %11 + %44 = OpCompositeConstruct %v4float %43 %43 %43 %43 + OpStore %_GLF_color %44 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9971bf0c7e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.hlsl @@ -0,0 +1,35 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; + +void main_1() { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_7 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_8 = asint(x_5[1].x); + const int x_9 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_10 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_7), float(x_8), float(x_9), float(x_10)); + if (isnan(-(x_GLF_color).x)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_11 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_43 = float(x_11); + x_GLF_color = float4(x_43, x_43, x_43, x_43); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..7211d613cc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_7 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_8 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_9 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_10 = x_5.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_7), float(x_8), float(x_9), float(x_10)); + float4 const x_36 = *(tint_symbol_4); + if (isnan((-(x_36)).x)) { + int const x_11 = x_5.x_GLF_uniform_int_values.arr[0].el; + float const x_43 = float(x_11); + *(tint_symbol_4) = float4(x_43, x_43, x_43, x_43); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2b4787337e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.spvasm @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %47 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %23 = OpLoad %int %22 + %25 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %26 = OpLoad %int %25 + %27 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %28 = OpLoad %int %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %30 = OpLoad %int %29 + %31 = OpConvertSToF %float %23 + %32 = OpConvertSToF %float %26 + %33 = OpConvertSToF %float %28 + %34 = OpConvertSToF %float %30 + %35 = OpCompositeConstruct %v4float %31 %32 %33 %34 + OpStore %x_GLF_color %35 + %36 = OpLoad %v4float %x_GLF_color + %39 = OpFNegate %v4float %36 + %40 = OpCompositeExtract %float %39 0 + %37 = OpIsNan %bool %40 + OpSelectionMerge %41 None + OpBranchConditional %37 %42 %41 + %42 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpConvertSToF %float %44 + %46 = OpCompositeConstruct %v4float %45 %45 %45 %45 + OpStore %x_GLF_color %46 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %47 +%tint_symbol = OpFunctionParameter %main_out + %51 = OpLabel + %52 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %52 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %main_1 + %57 = OpLoad %v4float %x_GLF_color + %58 = OpCompositeConstruct %main_out %57 + %56 = OpFunctionCall %void %tint_symbol_2 %58 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..9ee635ecdd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + let x_7 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_8 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_9 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_10 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_7), f32(x_8), f32(x_9), f32(x_10)); + let x_36 : vec4 = x_GLF_color; + if (isNan((-(x_36)).x)) { + let x_11 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_43 : f32 = f32(x_11); + x_GLF_color = vec4(x_43, x_43, x_43, x_43); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl new file mode 100644 index 0000000000..9ee635ecdd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl @@ -0,0 +1,36 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + let x_7 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_8 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_9 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_10 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_7), f32(x_8), f32(x_9), f32(x_10)); + let x_36 : vec4 = x_GLF_color; + if (isNan((-(x_36)).x)) { + let x_11 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_43 : f32 = f32(x_11); + x_GLF_color = vec4(x_43, x_43, x_43, x_43); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9971bf0c7e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; + +void main_1() { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_7 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_8 = asint(x_5[1].x); + const int x_9 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_10 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_7), float(x_8), float(x_9), float(x_10)); + if (isnan(-(x_GLF_color).x)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_11 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_43 = float(x_11); + x_GLF_color = float4(x_43, x_43, x_43, x_43); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..7211d613cc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_7 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_8 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_9 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_10 = x_5.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_7), float(x_8), float(x_9), float(x_10)); + float4 const x_36 = *(tint_symbol_4); + if (isnan((-(x_36)).x)) { + int const x_11 = x_5.x_GLF_uniform_int_values.arr[0].el; + float const x_43 = float(x_11); + *(tint_symbol_4) = float4(x_43, x_43, x_43, x_43); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2b4787337e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.spvasm @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %47 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %23 = OpLoad %int %22 + %25 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %26 = OpLoad %int %25 + %27 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %28 = OpLoad %int %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %30 = OpLoad %int %29 + %31 = OpConvertSToF %float %23 + %32 = OpConvertSToF %float %26 + %33 = OpConvertSToF %float %28 + %34 = OpConvertSToF %float %30 + %35 = OpCompositeConstruct %v4float %31 %32 %33 %34 + OpStore %x_GLF_color %35 + %36 = OpLoad %v4float %x_GLF_color + %39 = OpFNegate %v4float %36 + %40 = OpCompositeExtract %float %39 0 + %37 = OpIsNan %bool %40 + OpSelectionMerge %41 None + OpBranchConditional %37 %42 %41 + %42 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpConvertSToF %float %44 + %46 = OpCompositeConstruct %v4float %45 %45 %45 %45 + OpStore %x_GLF_color %46 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %47 +%tint_symbol = OpFunctionParameter %main_out + %51 = OpLabel + %52 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %52 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %54 = OpLabel + %55 = OpFunctionCall %void %main_1 + %57 = OpLoad %v4float %x_GLF_color + %58 = OpCompositeConstruct %main_out %57 + %56 = OpFunctionCall %void %tint_symbol_2 %58 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..9ee635ecdd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-isnan/0-opt.wgsl.expected.wgsl @@ -0,0 +1,36 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + let x_7 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_8 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_9 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_10 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_7), f32(x_8), f32(x_9), f32(x_10)); + let x_36 : vec4 = x_GLF_color; + if (isNan((-(x_36)).x)) { + let x_11 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_43 : f32 = f32(x_11); + x_GLF_color = vec4(x_43, x_43, x_43, x_43); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm new file mode 100644 index 0000000000..f80464d26a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm @@ -0,0 +1,94 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_10000 = OpConstant %int 10000 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %11 + %27 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %29 = OpLoad %float %28 + %30 = OpExtInst %float %1 Ldexp %29 %int_10000 + %31 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %32 = OpLoad %float %31 + %33 = OpFOrdEqual %bool %30 %32 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %36 + %35 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %38 = OpLoad %int %37 + %39 = OpConvertSToF %float %38 + %40 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpConvertSToF %float %41 + %43 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpConvertSToF %float %44 + %46 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpConvertSToF %float %47 + %49 = OpCompositeConstruct %v4float %39 %42 %45 %48 + OpStore %_GLF_color %49 + OpBranch %34 + %36 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %51 + %53 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %54 + %56 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpCompositeConstruct %v4float %52 %55 %58 %61 + OpStore %_GLF_color %62 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..410562b76c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,46 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; + +void main_1() { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_29 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_32 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((ldexp(x_29, 10000) == x_32)) { + const int x_38 = asint(x_7[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_41 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_44 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_47 = asint(x_7[1].x); + x_GLF_color = float4(float(x_38), float(x_41), float(x_44), float(x_47)); + } else { + const int x_51 = asint(x_7[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_60 = asint(x_7[1].x); + x_GLF_color = float4(float(x_51), float(x_54), float(x_57), float(x_60)); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..5eeaa35c02 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, constant buf1& x_7, thread float4* const tint_symbol_4) { + float const x_29 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_32 = x_5.x_GLF_uniform_float_values.arr[0].el; + if ((ldexp(x_29, 10000) == x_32)) { + int const x_38 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_41 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_44 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_47 = x_7.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_38), float(x_41), float(x_44), float(x_47)); + } else { + int const x_51 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_54 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_57 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_60 = x_7.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_51), float(x_54), float(x_57), float(x_60)); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]], constant buf1& x_7 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..6a92dec61e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %32 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_10000 = OpConstant %int 10000 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %28 = OpLoad %float %27 + %29 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %30 = OpLoad %float %29 + %31 = OpExtInst %float %32 Ldexp %28 %int_10000 + %34 = OpFOrdEqual %bool %31 %30 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %38 + %37 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %42 + %50 = OpConvertSToF %float %44 + %51 = OpConvertSToF %float %46 + %52 = OpConvertSToF %float %48 + %53 = OpCompositeConstruct %v4float %49 %50 %51 %52 + OpStore %x_GLF_color %53 + OpBranch %36 + %38 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %55 + %63 = OpConvertSToF %float %57 + %64 = OpConvertSToF %float %59 + %65 = OpConvertSToF %float %61 + %66 = OpCompositeConstruct %v4float %62 %63 %64 %65 + OpStore %x_GLF_color %66 + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..e029395aa6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +fn main_1() { + let x_29 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_32 : f32 = x_5.x_GLF_uniform_float_values[0]; + if ((ldexp(x_29, 10000) == x_32)) { + let x_38 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_41 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_47 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_38), f32(x_41), f32(x_44), f32(x_47)); + } else { + let x_51 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_57 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_51), f32(x_54), f32(x_57), f32(x_60)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl new file mode 100644 index 0000000000..e029395aa6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +fn main_1() { + let x_29 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_32 : f32 = x_5.x_GLF_uniform_float_values[0]; + if ((ldexp(x_29, 10000) == x_32)) { + let x_38 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_41 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_47 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_38), f32(x_41), f32(x_44), f32(x_47)); + } else { + let x_51 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_57 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_51), f32(x_54), f32(x_57), f32(x_60)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..410562b76c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; + +void main_1() { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_29 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_32 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((ldexp(x_29, 10000) == x_32)) { + const int x_38 = asint(x_7[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_41 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_44 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_47 = asint(x_7[1].x); + x_GLF_color = float4(float(x_38), float(x_41), float(x_44), float(x_47)); + } else { + const int x_51 = asint(x_7[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_60 = asint(x_7[1].x); + x_GLF_color = float4(float(x_51), float(x_54), float(x_57), float(x_60)); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..5eeaa35c02 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, constant buf1& x_7, thread float4* const tint_symbol_4) { + float const x_29 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_32 = x_5.x_GLF_uniform_float_values.arr[0].el; + if ((ldexp(x_29, 10000) == x_32)) { + int const x_38 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_41 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_44 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_47 = x_7.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_38), float(x_41), float(x_44), float(x_47)); + } else { + int const x_51 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_54 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_57 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_60 = x_7.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_51), float(x_54), float(x_57), float(x_60)); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]], constant buf1& x_7 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..6a92dec61e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %32 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_10000 = OpConstant %int 10000 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %28 = OpLoad %float %27 + %29 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %30 = OpLoad %float %29 + %31 = OpExtInst %float %32 Ldexp %28 %int_10000 + %34 = OpFOrdEqual %bool %31 %30 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %38 + %37 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %42 + %50 = OpConvertSToF %float %44 + %51 = OpConvertSToF %float %46 + %52 = OpConvertSToF %float %48 + %53 = OpCompositeConstruct %v4float %49 %50 %51 %52 + OpStore %x_GLF_color %53 + OpBranch %36 + %38 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %55 + %63 = OpConvertSToF %float %57 + %64 = OpConvertSToF %float %59 + %65 = OpConvertSToF %float %61 + %66 = OpCompositeConstruct %v4float %62 %63 %64 %65 + OpStore %x_GLF_color %66 + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..e029395aa6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ldexp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +fn main_1() { + let x_29 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_32 : f32 = x_5.x_GLF_uniform_float_values[0]; + if ((ldexp(x_29, 10000) == x_32)) { + let x_38 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_41 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_47 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_38), f32(x_41), f32(x_44), f32(x_47)); + } else { + let x_51 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_57 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_51), f32(x_54), f32(x_57), f32(x_60)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm new file mode 100644 index 0000000000..9f2839f47d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm @@ -0,0 +1,146 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f1_f1_ "f1(f1;" + OpName %a "a" + OpName %b "b" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %c "c" + OpName %a_0 "a" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpTypeFunction %float %_ptr_Function_float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_8 = OpConstant %int 8 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %18 + %41 = OpLabel + %a_0 = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_float Function + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %43 = OpLoad %float %42 + OpStore %param %43 + %44 = OpFunctionCall %float %f1_f1_ %param + OpStore %a_0 %44 + %45 = OpLoad %float %a_0 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %47 = OpLoad %float %46 + %48 = OpFOrdEqual %bool %45 %47 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpConvertSToF %float %56 + %58 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpCompositeConstruct %v4float %54 %57 %60 %63 + OpStore %_GLF_color %64 + OpBranch %49 + %51 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + %68 = OpCompositeConstruct %v4float %67 %67 %67 %67 + OpStore %_GLF_color %68 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd + %f1_f1_ = OpFunction %float None %21 + %a = OpFunctionParameter %_ptr_Function_float + %69 = OpLabel + %b = OpVariable %_ptr_Function_int Function + %c = OpVariable %_ptr_Function_float Function + OpStore %b %int_8 + %70 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %73 = OpLoad %float %72 + %74 = OpFOrdGreaterThanEqual %bool %71 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + %77 = OpLoad %int %b + %78 = OpIAdd %int %77 %int_1 + OpStore %b %78 + %79 = OpLoad %int %b + %80 = OpIAdd %int %79 %int_1 + OpStore %b %80 + OpBranch %75 + %75 = OpLabel + %81 = OpLoad %float %a + %82 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %83 = OpLoad %float %82 + %84 = OpFOrdLessThan %bool %81 %83 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %88 = OpLoad %float %87 + OpReturnValue %88 + %85 = OpLabel + %89 = OpLoad %int %b + %90 = OpExtInst %int %1 SClamp %89 %int_0 %int_2 + %91 = OpConvertSToF %float %90 + OpStore %c %91 + %92 = OpLoad %float %c + OpReturnValue %92 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..408d89c9ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,74 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_14 : register(b1, space0) { + uint4 x_14[2]; +}; + +float f1_f1_(inout float a) { + int b = 0; + float c = 0.0f; + b = 8; + const float x_71 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_73 = asfloat(x_9[scalar_offset / 4][scalar_offset % 4]); + if ((x_71 >= x_73)) { + b = (b + 1); + b = (b + 1); + } + const float x_81 = a; + const float x_83 = asfloat(x_9[1].x); + if ((x_81 < x_83)) { + const float x_88 = asfloat(x_9[1].x); + return x_88; + } + c = float(clamp(b, 0, 2)); + return c; +} + +void main_1() { + float a_1 = 0.0f; + float param = 0.0f; + const float x_43 = asfloat(x_9[1].x); + param = x_43; + const float x_44 = f1_f1_(param); + a_1 = x_44; + const float x_45 = a_1; + const float x_47 = asfloat(x_9[2].x); + if ((x_45 == x_47)) { + const int x_53 = asint(x_14[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_14[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_14[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_62 = asint(x_14[1].x); + x_GLF_color = float4(float(x_53), float(x_56), float(x_59), float(x_62)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_66 = asint(x_14[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_67 = float(x_66); + x_GLF_color = float4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b727426114 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.msl @@ -0,0 +1,87 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float f1_f1_(constant buf0& x_9, thread float* const a, thread float4* const tint_symbol_5) { + int b = 0; + float c = 0.0f; + b = 8; + float const x_71 = (*(tint_symbol_5)).y; + float const x_73 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_71 >= x_73)) { + int const x_77 = b; + b = (x_77 + 1); + int const x_79 = b; + b = (x_79 + 1); + } + float const x_81 = *(a); + float const x_83 = x_9.x_GLF_uniform_float_values.arr[1].el; + if ((x_81 < x_83)) { + float const x_88 = x_9.x_GLF_uniform_float_values.arr[1].el; + return x_88; + } + int const x_89 = b; + c = float(clamp(x_89, 0, 2)); + float const x_92 = c; + return x_92; +} + +void main_1(constant buf0& x_9, constant buf1& x_14, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float a_1 = 0.0f; + float param = 0.0f; + float const x_43 = x_9.x_GLF_uniform_float_values.arr[1].el; + param = x_43; + float const x_44 = f1_f1_(x_9, &(param), tint_symbol_6); + a_1 = x_44; + float const x_45 = a_1; + float const x_47 = x_9.x_GLF_uniform_float_values.arr[2].el; + if ((x_45 == x_47)) { + int const x_53 = x_14.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_14.x_GLF_uniform_int_values.arr[0].el; + int const x_59 = x_14.x_GLF_uniform_int_values.arr[0].el; + int const x_62 = x_14.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_7) = float4(float(x_53), float(x_56), float(x_59), float(x_62)); + } else { + int const x_66 = x_14.x_GLF_uniform_int_values.arr[0].el; + float const x_67 = float(x_66); + *(tint_symbol_7) = float4(x_67, x_67, x_67, x_67); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_9 [[buffer(0)]], constant buf1& x_14 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_9, x_14, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..3c4cb670a6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,186 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 115 +; Schema: 0 + OpCapability Shader + %64 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_14 "x_14" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %f1_f1_ "f1_f1_" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %main_1 "main_1" + OpName %a_1 "a_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_14 NonWritable + OpDecorate %x_14 DescriptorSet 0 + OpDecorate %x_14 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_14 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_float = OpTypePointer Function %float + %23 = OpTypeFunction %float %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %32 = OpConstantNull %float + %int_8 = OpConstant %int 8 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %void = OpTypeVoid + %67 = OpTypeFunction %void +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %102 = OpTypeFunction %void %main_out + %f1_f1_ = OpFunction %float None %23 + %a = OpFunctionParameter %_ptr_Function_float + %27 = OpLabel + %b = OpVariable %_ptr_Function_int Function %30 + %c = OpVariable %_ptr_Function_float Function %32 + OpStore %b %int_8 + %36 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %37 = OpLoad %float %36 + %41 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpFOrdGreaterThanEqual %bool %37 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %45 + %46 = OpLabel + %47 = OpLoad %int %b + %49 = OpIAdd %int %47 %int_1 + OpStore %b %49 + %50 = OpLoad %int %b + %51 = OpIAdd %int %50 %int_1 + OpStore %b %51 + OpBranch %45 + %45 = OpLabel + %53 = OpLoad %float %a + %54 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %55 = OpLoad %float %54 + %56 = OpFOrdLessThan %bool %53 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %60 = OpLoad %float %59 + OpReturnValue %60 + %57 = OpLabel + %61 = OpLoad %int %b + %63 = OpExtInst %int %64 SClamp %61 %int_0 %int_2 + %62 = OpConvertSToF %float %63 + OpStore %c %62 + %66 = OpLoad %float %c + OpReturnValue %66 + OpFunctionEnd + %main_1 = OpFunction %void None %67 + %70 = OpLabel + %a_1 = OpVariable %_ptr_Function_float Function %32 + %param = OpVariable %_ptr_Function_float Function %32 + %73 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %74 = OpLoad %float %73 + OpStore %param %74 + %75 = OpFunctionCall %float %f1_f1_ %param + OpStore %a_1 %75 + %77 = OpLoad %float %a_1 + %78 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_2 + %79 = OpLoad %float %78 + %80 = OpFOrdEqual %bool %77 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %x_14 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_14 %uint_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_14 %uint_0 %int_0 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Uniform_int %x_14 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %86 + %94 = OpConvertSToF %float %88 + %95 = OpConvertSToF %float %90 + %96 = OpConvertSToF %float %92 + %97 = OpCompositeConstruct %v4float %93 %94 %95 %96 + OpStore %x_GLF_color %97 + OpBranch %81 + %83 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_int %x_14 %uint_0 %int_0 + %99 = OpLoad %int %98 + %100 = OpConvertSToF %float %99 + %101 = OpCompositeConstruct %v4float %100 %100 %100 %100 + OpStore %x_GLF_color %101 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %102 +%tint_symbol_1 = OpFunctionParameter %main_out + %106 = OpLabel + %107 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %107 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %67 + %109 = OpLabel + %110 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %110 + %111 = OpFunctionCall %void %main_1 + %113 = OpLoad %v4float %x_GLF_color + %114 = OpCompositeConstruct %main_out %113 + %112 = OpFunctionCall %void %tint_symbol_3 %114 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..1a497da657 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,80 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_14 : buf1; + +fn f1_f1_(a : ptr) -> f32 { + var b : i32; + var c : f32; + b = 8; + let x_71 : f32 = gl_FragCoord.y; + let x_73 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_71 >= x_73)) { + let x_77 : i32 = b; + b = (x_77 + 1); + let x_79 : i32 = b; + b = (x_79 + 1); + } + let x_81 : f32 = *(a); + let x_83 : f32 = x_9.x_GLF_uniform_float_values[1]; + if ((x_81 < x_83)) { + let x_88 : f32 = x_9.x_GLF_uniform_float_values[1]; + return x_88; + } + let x_89 : i32 = b; + c = f32(clamp(x_89, 0, 2)); + let x_92 : f32 = c; + return x_92; +} + +fn main_1() { + var a_1 : f32; + var param : f32; + let x_43 : f32 = x_9.x_GLF_uniform_float_values[1]; + param = x_43; + let x_44 : f32 = f1_f1_(&(param)); + a_1 = x_44; + let x_45 : f32 = a_1; + let x_47 : f32 = x_9.x_GLF_uniform_float_values[2]; + if ((x_45 == x_47)) { + let x_53 : i32 = x_14.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_14.x_GLF_uniform_int_values[0]; + let x_59 : i32 = x_14.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_14.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_53), f32(x_56), f32(x_59), f32(x_62)); + } else { + let x_66 : i32 = x_14.x_GLF_uniform_int_values[0]; + let x_67 : f32 = f32(x_66); + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl new file mode 100644 index 0000000000..1a497da657 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl @@ -0,0 +1,80 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_14 : buf1; + +fn f1_f1_(a : ptr) -> f32 { + var b : i32; + var c : f32; + b = 8; + let x_71 : f32 = gl_FragCoord.y; + let x_73 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_71 >= x_73)) { + let x_77 : i32 = b; + b = (x_77 + 1); + let x_79 : i32 = b; + b = (x_79 + 1); + } + let x_81 : f32 = *(a); + let x_83 : f32 = x_9.x_GLF_uniform_float_values[1]; + if ((x_81 < x_83)) { + let x_88 : f32 = x_9.x_GLF_uniform_float_values[1]; + return x_88; + } + let x_89 : i32 = b; + c = f32(clamp(x_89, 0, 2)); + let x_92 : f32 = c; + return x_92; +} + +fn main_1() { + var a_1 : f32; + var param : f32; + let x_43 : f32 = x_9.x_GLF_uniform_float_values[1]; + param = x_43; + let x_44 : f32 = f1_f1_(&(param)); + a_1 = x_44; + let x_45 : f32 = a_1; + let x_47 : f32 = x_9.x_GLF_uniform_float_values[2]; + if ((x_45 == x_47)) { + let x_53 : i32 = x_14.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_14.x_GLF_uniform_int_values[0]; + let x_59 : i32 = x_14.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_14.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_53), f32(x_56), f32(x_59), f32(x_62)); + } else { + let x_66 : i32 = x_14.x_GLF_uniform_int_values[0]; + let x_67 : f32 = f32(x_66); + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..408d89c9ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,74 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_14 : register(b1, space0) { + uint4 x_14[2]; +}; + +float f1_f1_(inout float a) { + int b = 0; + float c = 0.0f; + b = 8; + const float x_71 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_73 = asfloat(x_9[scalar_offset / 4][scalar_offset % 4]); + if ((x_71 >= x_73)) { + b = (b + 1); + b = (b + 1); + } + const float x_81 = a; + const float x_83 = asfloat(x_9[1].x); + if ((x_81 < x_83)) { + const float x_88 = asfloat(x_9[1].x); + return x_88; + } + c = float(clamp(b, 0, 2)); + return c; +} + +void main_1() { + float a_1 = 0.0f; + float param = 0.0f; + const float x_43 = asfloat(x_9[1].x); + param = x_43; + const float x_44 = f1_f1_(param); + a_1 = x_44; + const float x_45 = a_1; + const float x_47 = asfloat(x_9[2].x); + if ((x_45 == x_47)) { + const int x_53 = asint(x_14[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_14[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_14[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_62 = asint(x_14[1].x); + x_GLF_color = float4(float(x_53), float(x_56), float(x_59), float(x_62)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_66 = asint(x_14[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_67 = float(x_66); + x_GLF_color = float4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b727426114 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.msl @@ -0,0 +1,87 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float f1_f1_(constant buf0& x_9, thread float* const a, thread float4* const tint_symbol_5) { + int b = 0; + float c = 0.0f; + b = 8; + float const x_71 = (*(tint_symbol_5)).y; + float const x_73 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_71 >= x_73)) { + int const x_77 = b; + b = (x_77 + 1); + int const x_79 = b; + b = (x_79 + 1); + } + float const x_81 = *(a); + float const x_83 = x_9.x_GLF_uniform_float_values.arr[1].el; + if ((x_81 < x_83)) { + float const x_88 = x_9.x_GLF_uniform_float_values.arr[1].el; + return x_88; + } + int const x_89 = b; + c = float(clamp(x_89, 0, 2)); + float const x_92 = c; + return x_92; +} + +void main_1(constant buf0& x_9, constant buf1& x_14, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float a_1 = 0.0f; + float param = 0.0f; + float const x_43 = x_9.x_GLF_uniform_float_values.arr[1].el; + param = x_43; + float const x_44 = f1_f1_(x_9, &(param), tint_symbol_6); + a_1 = x_44; + float const x_45 = a_1; + float const x_47 = x_9.x_GLF_uniform_float_values.arr[2].el; + if ((x_45 == x_47)) { + int const x_53 = x_14.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_14.x_GLF_uniform_int_values.arr[0].el; + int const x_59 = x_14.x_GLF_uniform_int_values.arr[0].el; + int const x_62 = x_14.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_7) = float4(float(x_53), float(x_56), float(x_59), float(x_62)); + } else { + int const x_66 = x_14.x_GLF_uniform_int_values.arr[0].el; + float const x_67 = float(x_66); + *(tint_symbol_7) = float4(x_67, x_67, x_67, x_67); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_9 [[buffer(0)]], constant buf1& x_14 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_9, x_14, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..3c4cb670a6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,186 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 115 +; Schema: 0 + OpCapability Shader + %64 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_14 "x_14" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %f1_f1_ "f1_f1_" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %main_1 "main_1" + OpName %a_1 "a_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_14 NonWritable + OpDecorate %x_14 DescriptorSet 0 + OpDecorate %x_14 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_14 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_float = OpTypePointer Function %float + %23 = OpTypeFunction %float %_ptr_Function_float +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %32 = OpConstantNull %float + %int_8 = OpConstant %int 8 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %void = OpTypeVoid + %67 = OpTypeFunction %void +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %102 = OpTypeFunction %void %main_out + %f1_f1_ = OpFunction %float None %23 + %a = OpFunctionParameter %_ptr_Function_float + %27 = OpLabel + %b = OpVariable %_ptr_Function_int Function %30 + %c = OpVariable %_ptr_Function_float Function %32 + OpStore %b %int_8 + %36 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %37 = OpLoad %float %36 + %41 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpFOrdGreaterThanEqual %bool %37 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %45 + %46 = OpLabel + %47 = OpLoad %int %b + %49 = OpIAdd %int %47 %int_1 + OpStore %b %49 + %50 = OpLoad %int %b + %51 = OpIAdd %int %50 %int_1 + OpStore %b %51 + OpBranch %45 + %45 = OpLabel + %53 = OpLoad %float %a + %54 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %55 = OpLoad %float %54 + %56 = OpFOrdLessThan %bool %53 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %60 = OpLoad %float %59 + OpReturnValue %60 + %57 = OpLabel + %61 = OpLoad %int %b + %63 = OpExtInst %int %64 SClamp %61 %int_0 %int_2 + %62 = OpConvertSToF %float %63 + OpStore %c %62 + %66 = OpLoad %float %c + OpReturnValue %66 + OpFunctionEnd + %main_1 = OpFunction %void None %67 + %70 = OpLabel + %a_1 = OpVariable %_ptr_Function_float Function %32 + %param = OpVariable %_ptr_Function_float Function %32 + %73 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %74 = OpLoad %float %73 + OpStore %param %74 + %75 = OpFunctionCall %float %f1_f1_ %param + OpStore %a_1 %75 + %77 = OpLoad %float %a_1 + %78 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_2 + %79 = OpLoad %float %78 + %80 = OpFOrdEqual %bool %77 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %x_14 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_14 %uint_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_14 %uint_0 %int_0 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Uniform_int %x_14 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %86 + %94 = OpConvertSToF %float %88 + %95 = OpConvertSToF %float %90 + %96 = OpConvertSToF %float %92 + %97 = OpCompositeConstruct %v4float %93 %94 %95 %96 + OpStore %x_GLF_color %97 + OpBranch %81 + %83 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_int %x_14 %uint_0 %int_0 + %99 = OpLoad %int %98 + %100 = OpConvertSToF %float %99 + %101 = OpCompositeConstruct %v4float %100 %100 %100 %100 + OpStore %x_GLF_color %101 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %102 +%tint_symbol_1 = OpFunctionParameter %main_out + %106 = OpLabel + %107 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %107 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %67 + %109 = OpLabel + %110 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %110 + %111 = OpFunctionCall %void %main_1 + %113 = OpLoad %v4float %x_GLF_color + %114 = OpCompositeConstruct %main_out %113 + %112 = OpFunctionCall %void %tint_symbol_3 %114 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..1a497da657 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-pre-increment-clamp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,80 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_14 : buf1; + +fn f1_f1_(a : ptr) -> f32 { + var b : i32; + var c : f32; + b = 8; + let x_71 : f32 = gl_FragCoord.y; + let x_73 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_71 >= x_73)) { + let x_77 : i32 = b; + b = (x_77 + 1); + let x_79 : i32 = b; + b = (x_79 + 1); + } + let x_81 : f32 = *(a); + let x_83 : f32 = x_9.x_GLF_uniform_float_values[1]; + if ((x_81 < x_83)) { + let x_88 : f32 = x_9.x_GLF_uniform_float_values[1]; + return x_88; + } + let x_89 : i32 = b; + c = f32(clamp(x_89, 0, 2)); + let x_92 : f32 = c; + return x_92; +} + +fn main_1() { + var a_1 : f32; + var param : f32; + let x_43 : f32 = x_9.x_GLF_uniform_float_values[1]; + param = x_43; + let x_44 : f32 = f1_f1_(&(param)); + a_1 = x_44; + let x_45 : f32 = a_1; + let x_47 : f32 = x_9.x_GLF_uniform_float_values[2]; + if ((x_45 == x_47)) { + let x_53 : i32 = x_14.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_14.x_GLF_uniform_int_values[0]; + let x_59 : i32 = x_14.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_14.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_53), f32(x_56), f32(x_59), f32(x_62)); + } else { + let x_66 : i32 = x_14.x_GLF_uniform_int_values[0]; + let x_67 : f32 = f32(x_66); + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm new file mode 100644 index 0000000000..97c8528df0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm @@ -0,0 +1,114 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %b "b" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %v3float = OpTypeVector %float 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %14 + %37 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_float Function + %38 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpFOrdGreaterThanEqual %bool %39 %41 + %43 = OpSelect %int %42 %int_0 %int_2 + OpStore %a %43 + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %47 = OpLoad %float %46 + %48 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %49 = OpLoad %float %48 + %50 = OpCompositeConstruct %v3float %45 %47 %49 + %51 = OpLoad %int %a + %52 = OpVectorExtractDynamic %float %50 %51 + OpStore %b %52 + %53 = OpLoad %float %b + %54 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %55 = OpLoad %float %54 + %56 = OpFOrdEqual %bool %53 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %61 + %63 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %67 + %69 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %70 + %72 = OpCompositeConstruct %v4float %62 %65 %68 %71 + OpStore %_GLF_color %72 + OpBranch %57 + %59 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %_GLF_color %76 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..1aa4c950e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.hlsl @@ -0,0 +1,57 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[2]; +}; + +void main_1() { + int a = 0; + float b = 0.0f; + const float x_39 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + a = ((x_39 >= x_41) ? 0 : 2); + const float x_45 = asfloat(x_7[1].x); + const float x_47 = asfloat(x_7[2].x); + const float x_49 = asfloat(x_7[3].x); + b = float3(x_45, x_47, x_49)[a]; + const float x_53 = b; + const float x_55 = asfloat(x_7[1].x); + if ((x_53 == x_55)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_61 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_64 = asint(x_10[1].x); + const int x_67 = asint(x_10[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_70 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_61), float(x_64), float(x_67), float(x_70)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_75 = float(x_74); + x_GLF_color = float4(x_75, x_75, x_75, x_75); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4dbabec88a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.msl @@ -0,0 +1,67 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_10, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int a = 0; + float b = 0.0f; + float const x_39 = (*(tint_symbol_5)).y; + float const x_41 = x_7.x_GLF_uniform_float_values.arr[0].el; + a = select(2, 0, (x_39 >= x_41)); + float const x_45 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_47 = x_7.x_GLF_uniform_float_values.arr[2].el; + float const x_49 = x_7.x_GLF_uniform_float_values.arr[3].el; + int const x_51 = a; + b = float3(x_45, x_47, x_49)[x_51]; + float const x_53 = b; + float const x_55 = x_7.x_GLF_uniform_float_values.arr[1].el; + if ((x_53 == x_55)) { + int const x_61 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_64 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_67 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_70 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_61), float(x_64), float(x_67), float(x_70)); + } else { + int const x_74 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_75 = float(x_74); + *(tint_symbol_6) = float4(x_75, x_75, x_75, x_75); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_10, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f6de72210f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.spvasm @@ -0,0 +1,153 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 96 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %32 = OpConstantNull %float + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %v3float = OpTypeVector %float 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %83 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %a = OpVariable %_ptr_Function_int Function %29 + %b = OpVariable %_ptr_Function_float Function %32 + %35 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %36 = OpLoad %float %35 + %40 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %41 = OpLoad %float %40 + %43 = OpFOrdGreaterThanEqual %bool %36 %41 + %42 = OpSelect %int %43 %int_0 %int_2 + OpStore %a %42 + %47 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %48 = OpLoad %float %47 + %49 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3 + %53 = OpLoad %float %52 + %54 = OpLoad %int %a + %56 = OpCompositeConstruct %v3float %48 %50 %53 + %57 = OpVectorExtractDynamic %float %56 %54 + OpStore %b %57 + %58 = OpLoad %float %b + %59 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %60 = OpLoad %float %59 + %61 = OpFOrdEqual %bool %58 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %64 + %63 = OpLabel + %66 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %73 = OpLoad %int %72 + %74 = OpConvertSToF %float %67 + %75 = OpConvertSToF %float %69 + %76 = OpConvertSToF %float %71 + %77 = OpConvertSToF %float %73 + %78 = OpCompositeConstruct %v4float %74 %75 %76 %77 + OpStore %x_GLF_color %78 + OpBranch %62 + %64 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %80 + %82 = OpCompositeConstruct %v4float %81 %81 %81 %81 + OpStore %x_GLF_color %82 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %83 +%tint_symbol_1 = OpFunctionParameter %main_out + %87 = OpLabel + %88 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %88 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %90 = OpLabel + %91 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %91 + %92 = OpFunctionCall %void %main_1 + %94 = OpLoad %v4float %x_GLF_color + %95 = OpCompositeConstruct %main_out %94 + %93 = OpFunctionCall %void %tint_symbol_3 %95 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..2e2a9f11da --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.spvasm.expected.wgsl @@ -0,0 +1,60 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_10 : buf1; + +fn main_1() { + var a : i32; + var b : f32; + let x_39 : f32 = gl_FragCoord.y; + let x_41 : f32 = x_7.x_GLF_uniform_float_values[0]; + a = select(2, 0, (x_39 >= x_41)); + let x_45 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_47 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_49 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_51 : i32 = a; + b = vec3(x_45, x_47, x_49)[x_51]; + let x_53 : f32 = b; + let x_55 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_53 == x_55)) { + let x_61 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_64 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_67 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_70 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_61), f32(x_64), f32(x_67), f32(x_70)); + } else { + let x_74 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_75 : f32 = f32(x_74); + x_GLF_color = vec4(x_75, x_75, x_75, x_75); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl new file mode 100644 index 0000000000..2e2a9f11da --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl @@ -0,0 +1,60 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_10 : buf1; + +fn main_1() { + var a : i32; + var b : f32; + let x_39 : f32 = gl_FragCoord.y; + let x_41 : f32 = x_7.x_GLF_uniform_float_values[0]; + a = select(2, 0, (x_39 >= x_41)); + let x_45 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_47 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_49 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_51 : i32 = a; + b = vec3(x_45, x_47, x_49)[x_51]; + let x_53 : f32 = b; + let x_55 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_53 == x_55)) { + let x_61 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_64 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_67 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_70 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_61), f32(x_64), f32(x_67), f32(x_70)); + } else { + let x_74 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_75 : f32 = f32(x_74); + x_GLF_color = vec4(x_75, x_75, x_75, x_75); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..1aa4c950e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.hlsl @@ -0,0 +1,57 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[2]; +}; + +void main_1() { + int a = 0; + float b = 0.0f; + const float x_39 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + a = ((x_39 >= x_41) ? 0 : 2); + const float x_45 = asfloat(x_7[1].x); + const float x_47 = asfloat(x_7[2].x); + const float x_49 = asfloat(x_7[3].x); + b = float3(x_45, x_47, x_49)[a]; + const float x_53 = b; + const float x_55 = asfloat(x_7[1].x); + if ((x_53 == x_55)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_61 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_64 = asint(x_10[1].x); + const int x_67 = asint(x_10[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_70 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_61), float(x_64), float(x_67), float(x_70)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_75 = float(x_74); + x_GLF_color = float4(x_75, x_75, x_75, x_75); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4dbabec88a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.msl @@ -0,0 +1,67 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_10, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int a = 0; + float b = 0.0f; + float const x_39 = (*(tint_symbol_5)).y; + float const x_41 = x_7.x_GLF_uniform_float_values.arr[0].el; + a = select(2, 0, (x_39 >= x_41)); + float const x_45 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_47 = x_7.x_GLF_uniform_float_values.arr[2].el; + float const x_49 = x_7.x_GLF_uniform_float_values.arr[3].el; + int const x_51 = a; + b = float3(x_45, x_47, x_49)[x_51]; + float const x_53 = b; + float const x_55 = x_7.x_GLF_uniform_float_values.arr[1].el; + if ((x_53 == x_55)) { + int const x_61 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_64 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_67 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_70 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_61), float(x_64), float(x_67), float(x_70)); + } else { + int const x_74 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_75 = float(x_74); + *(tint_symbol_6) = float4(x_75, x_75, x_75, x_75); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_10, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f6de72210f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.spvasm @@ -0,0 +1,153 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 96 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %32 = OpConstantNull %float + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %v3float = OpTypeVector %float 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %83 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %a = OpVariable %_ptr_Function_int Function %29 + %b = OpVariable %_ptr_Function_float Function %32 + %35 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %36 = OpLoad %float %35 + %40 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %41 = OpLoad %float %40 + %43 = OpFOrdGreaterThanEqual %bool %36 %41 + %42 = OpSelect %int %43 %int_0 %int_2 + OpStore %a %42 + %47 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %48 = OpLoad %float %47 + %49 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3 + %53 = OpLoad %float %52 + %54 = OpLoad %int %a + %56 = OpCompositeConstruct %v3float %48 %50 %53 + %57 = OpVectorExtractDynamic %float %56 %54 + OpStore %b %57 + %58 = OpLoad %float %b + %59 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %60 = OpLoad %float %59 + %61 = OpFOrdEqual %bool %58 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %64 + %63 = OpLabel + %66 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %73 = OpLoad %int %72 + %74 = OpConvertSToF %float %67 + %75 = OpConvertSToF %float %69 + %76 = OpConvertSToF %float %71 + %77 = OpConvertSToF %float %73 + %78 = OpCompositeConstruct %v4float %74 %75 %76 %77 + OpStore %x_GLF_color %78 + OpBranch %62 + %64 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %80 + %82 = OpCompositeConstruct %v4float %81 %81 %81 %81 + OpStore %x_GLF_color %82 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %83 +%tint_symbol_1 = OpFunctionParameter %main_out + %87 = OpLabel + %88 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %88 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %90 = OpLabel + %91 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %91 + %92 = OpFunctionCall %void %main_1 + %94 = OpLoad %v4float %x_GLF_color + %95 = OpCompositeConstruct %main_out %94 + %93 = OpFunctionCall %void %tint_symbol_3 %95 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..2e2a9f11da --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-ternary-vector-access/0-opt.wgsl.expected.wgsl @@ -0,0 +1,60 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_10 : buf1; + +fn main_1() { + var a : i32; + var b : f32; + let x_39 : f32 = gl_FragCoord.y; + let x_41 : f32 = x_7.x_GLF_uniform_float_values[0]; + a = select(2, 0, (x_39 >= x_41)); + let x_45 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_47 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_49 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_51 : i32 = a; + b = vec3(x_45, x_47, x_49)[x_51]; + let x_53 : f32 = b; + let x_55 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_53 == x_55)) { + let x_61 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_64 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_67 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_70 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_61), f32(x_64), f32(x_67), f32(x_70)); + } else { + let x_74 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_75 : f32 = f32(x_74); + x_GLF_color = vec4(x_75, x_75, x_75, x_75); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm new file mode 100644 index 0000000000..8401a534a5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm @@ -0,0 +1,101 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main = OpFunction %void None %12 + %30 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %31 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %32 = OpLoad %int %31 + OpStore %i %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %i + %38 = OpSGreaterThanEqual %bool %37 %int_0 + OpBranchConditional %38 %39 %34 + %39 = OpLabel + %40 = OpLoad %int %i + %41 = OpSMod %int %40 %int_2 + %42 = OpIEqual %bool %41 %int_0 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpConvertSToF %float %47 + %49 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpCompositeConstruct %v4float %float_1 %48 %51 %54 + OpStore %_GLF_color %55 + OpBranch %43 + %45 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %57 = OpLoad %float %56 + %58 = OpCompositeConstruct %v4float %57 %57 %57 %57 + OpStore %_GLF_color %58 + OpBranch %43 + %43 = OpLabel + %59 = OpLoad %int %i + %60 = OpISub %int %59 %int_1 + OpStore %i %60 + OpBranch %35 + %35 = OpLabel + OpBranch %33 + %34 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..32708a32d3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.hlsl @@ -0,0 +1,47 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; + +void main_1() { + int i = 0; + const int x_32 = asint(x_6[2].x); + i = x_32; + while (true) { + if ((i >= 0)) { + } else { + break; + } + if (((i % 2) == 0)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_47 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_53 = asint(x_6[1].x); + x_GLF_color = float4(1.0f, float(x_47), float(x_50), float(x_53)); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_57 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(x_57, x_57, x_57, x_57); + } + i = (i - 1); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..111c664b67 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.msl @@ -0,0 +1,64 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_4) { + int i = 0; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_32; + while (true) { + int const x_37 = i; + if ((x_37 >= 0)) { + } else { + break; + } + int const x_40 = i; + if (((x_40 % 2) == 0)) { + int const x_47 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(1.0f, float(x_47), float(x_50), float(x_53)); + } else { + float const x_57 = x_8.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_57, x_57, x_57, x_57); + } + int const x_59 = i; + i = (x_59 - 1); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..6651b2117f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %i = OpVariable %_ptr_Function_int Function %26 + %30 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %31 = OpLoad %int %30 + OpStore %i %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %38 = OpSGreaterThanEqual %bool %36 %int_0 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %33 + %40 = OpLabel + %43 = OpLoad %int %i + %44 = OpSMod %int %43 %int_2 + %45 = OpIEqual %bool %44 %int_0 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %52 = OpLoad %int %51 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %55 = OpLoad %int %54 + %57 = OpConvertSToF %float %50 + %58 = OpConvertSToF %float %52 + %59 = OpConvertSToF %float %55 + %60 = OpCompositeConstruct %v4float %float_1 %57 %58 %59 + OpStore %x_GLF_color %60 + OpBranch %46 + %48 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpCompositeConstruct %v4float %63 %63 %63 %63 + OpStore %x_GLF_color %64 + OpBranch %46 + %46 = OpLabel + %65 = OpLoad %int %i + %66 = OpISub %int %65 %int_1 + OpStore %i %66 + OpBranch %34 + %34 = OpLabel + OpBranch %32 + %33 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..7198d38586 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.spvasm.expected.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var i : i32; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_32; + loop { + let x_37 : i32 = i; + if ((x_37 >= 0)) { + } else { + break; + } + let x_40 : i32 = i; + if (((x_40 % 2) == 0)) { + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(1.0, f32(x_47), f32(x_50), f32(x_53)); + } else { + let x_57 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_57, x_57, x_57, x_57); + } + let x_59 : i32 = i; + i = (x_59 - 1); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl new file mode 100644 index 0000000000..7198d38586 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var i : i32; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_32; + loop { + let x_37 : i32 = i; + if ((x_37 >= 0)) { + } else { + break; + } + let x_40 : i32 = i; + if (((x_40 % 2) == 0)) { + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(1.0, f32(x_47), f32(x_50), f32(x_53)); + } else { + let x_57 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_57, x_57, x_57, x_57); + } + let x_59 : i32 = i; + i = (x_59 - 1); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..32708a32d3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.hlsl @@ -0,0 +1,47 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; + +void main_1() { + int i = 0; + const int x_32 = asint(x_6[2].x); + i = x_32; + while (true) { + if ((i >= 0)) { + } else { + break; + } + if (((i % 2) == 0)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_47 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_53 = asint(x_6[1].x); + x_GLF_color = float4(1.0f, float(x_47), float(x_50), float(x_53)); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_57 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(x_57, x_57, x_57, x_57); + } + i = (i - 1); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..111c664b67 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.msl @@ -0,0 +1,64 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_4) { + int i = 0; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_32; + while (true) { + int const x_37 = i; + if ((x_37 >= 0)) { + } else { + break; + } + int const x_40 = i; + if (((x_40 % 2) == 0)) { + int const x_47 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(1.0f, float(x_47), float(x_50), float(x_53)); + } else { + float const x_57 = x_8.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_57, x_57, x_57, x_57); + } + int const x_59 = i; + i = (x_59 - 1); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..6651b2117f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %i = OpVariable %_ptr_Function_int Function %26 + %30 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %31 = OpLoad %int %30 + OpStore %i %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %38 = OpSGreaterThanEqual %bool %36 %int_0 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %33 + %40 = OpLabel + %43 = OpLoad %int %i + %44 = OpSMod %int %43 %int_2 + %45 = OpIEqual %bool %44 %int_0 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %52 = OpLoad %int %51 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %55 = OpLoad %int %54 + %57 = OpConvertSToF %float %50 + %58 = OpConvertSToF %float %52 + %59 = OpConvertSToF %float %55 + %60 = OpCompositeConstruct %v4float %float_1 %57 %58 %59 + OpStore %x_GLF_color %60 + OpBranch %46 + %48 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpCompositeConstruct %v4float %63 %63 %63 %63 + OpStore %x_GLF_color %64 + OpBranch %46 + %46 = OpLabel + %65 = OpLoad %int %i + %66 = OpISub %int %65 %int_1 + OpStore %i %66 + OpBranch %34 + %34 = OpLabel + OpBranch %32 + %33 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..7198d38586 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-compares-while-modulo/0-opt.wgsl.expected.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var i : i32; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_32; + loop { + let x_37 : i32 = i; + if ((x_37 >= 0)) { + } else { + break; + } + let x_40 : i32 = i; + if (((x_40 % 2) == 0)) { + let x_47 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(1.0, f32(x_47), f32(x_50), f32(x_53)); + } else { + let x_57 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_57, x_57, x_57, x_57); + } + let x_59 : i32 = i; + i = (x_59 - 1); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm new file mode 100644 index 0000000000..e4220be5d0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm @@ -0,0 +1,152 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f1_f1_ "f1(f1;" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %v2 "v2" + OpName %a_0 "a" + OpName %param "param" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpTypeFunction %float %_ptr_Function_float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %v3float = OpTypeVector %float 3 + %main = OpFunction %void None %17 + %39 = OpLabel + %v2 = OpVariable %_ptr_Function_v4float Function + %a_0 = OpVariable %_ptr_Function_float Function + %40 = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_float Function + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %42 = OpLoad %int %41 + %43 = OpConvertSToF %float %42 + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %45 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %48 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %51 + %53 = OpCompositeConstruct %v4float %43 %46 %49 %52 + OpStore %_GLF_color %53 + %54 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %55 = OpLoad %float %54 + %56 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %57 = OpLoad %float %56 + %58 = OpFOrdLessThan %bool %55 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + %61 = OpAccessChain %_ptr_Function_float %v2 %uint_0 + %62 = OpLoad %float %61 + %63 = OpFOrdLessThan %bool %62 %float_1 + %64 = OpLogicalNot %bool %63 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %72 = OpLoad %float %71 + %73 = OpFOrdGreaterThan %bool %70 %72 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %77 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %78 = OpLoad %float %77 + OpStore %param %78 + %79 = OpFunctionCall %float %f1_f1_ %param + OpStore %40 %79 + OpBranch %74 + %76 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %81 = OpLoad %float %80 + OpStore %40 %81 + OpBranch %74 + %74 = OpLabel + %82 = OpLoad %float %40 + %83 = OpFDiv %float %68 %82 + OpStore %a_0 %83 + %84 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %85 = OpLoad %float %84 + %86 = OpCompositeConstruct %v3float %85 %85 %85 + %87 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %88 = OpLoad %float %87 + %89 = OpCompositeConstruct %v3float %88 %88 %88 + %90 = OpLoad %float %a_0 + %91 = OpCompositeConstruct %v3float %90 %90 %90 + %92 = OpExtInst %v3float %1 FMix %86 %89 %91 + %93 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %94 = OpLoad %float %93 + %95 = OpCompositeExtract %float %92 0 + %96 = OpCompositeExtract %float %92 1 + %97 = OpCompositeExtract %float %92 2 + %98 = OpCompositeConstruct %v4float %95 %96 %97 %94 + OpStore %_GLF_color %98 + OpBranch %65 + %65 = OpLabel + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd + %f1_f1_ = OpFunction %float None %20 + %a = OpFunctionParameter %_ptr_Function_float + %99 = OpLabel + %100 = OpLoad %float %a + %101 = OpDPdx %float %100 + OpReturnValue %101 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..b9e87ec1f2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.hlsl @@ -0,0 +1,78 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[2]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[2]; +}; + +float f1_f1_(inout float a) { + const float x_100 = a; + return ddx(x_100); +} + +void main_1() { + float4 v2 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float a_1 = 0.0f; + float x_40 = 0.0f; + float param = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_42 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + const int x_45 = asint(x_8[1].x); + const int x_48 = asint(x_8[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_51 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + const float x_55 = gl_FragCoord.x; + const float x_57 = asfloat(x_10[1].x); + if ((x_55 < x_57)) { + const float x_62 = v2.x; + if (!((x_62 < 1.0f))) { + const float x_68 = asfloat(x_10[1].x); + const float x_70 = asfloat(x_10[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_72 = asfloat(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_70 > x_72)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_78 = asfloat(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + param = x_78; + const float x_79 = f1_f1_(param); + x_40 = x_79; + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_81 = asfloat(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_40 = x_81; + } + a_1 = (x_68 / x_40); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_85 = asfloat(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const float x_88 = asfloat(x_10[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_90 = a_1; + const float3 x_92 = lerp(float3(x_85, x_85, x_85), float3(x_88, x_88, x_88), float3(x_90, x_90, x_90)); + const float x_94 = asfloat(x_10[1].x); + x_GLF_color = float4(x_92.x, x_92.y, x_92.z, x_94); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a3e74a594c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.msl @@ -0,0 +1,85 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float f1_f1_(thread float* const a) { + float const x_100 = *(a); + return dfdx(x_100); +} + +void main_1(constant buf0& x_8, constant buf1& x_10, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float4 v2 = 0.0f; + float a_1 = 0.0f; + float x_40 = 0.0f; + float param = 0.0f; + int const x_42 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_45 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_48 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_51 = x_8.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + float const x_55 = (*(tint_symbol_6)).x; + float const x_57 = x_10.x_GLF_uniform_float_values.arr[1].el; + if ((x_55 < x_57)) { + float const x_62 = v2.x; + if (!((x_62 < 1.0f))) { + float const x_68 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_70 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_72 = x_10.x_GLF_uniform_float_values.arr[0].el; + if ((x_70 > x_72)) { + float const x_78 = x_10.x_GLF_uniform_float_values.arr[0].el; + param = x_78; + float const x_79 = f1_f1_(&(param)); + x_40 = x_79; + } else { + float const x_81 = x_10.x_GLF_uniform_float_values.arr[0].el; + x_40 = x_81; + } + float const x_82 = x_40; + a_1 = (x_68 / x_82); + float const x_85 = x_10.x_GLF_uniform_float_values.arr[0].el; + float const x_88 = x_10.x_GLF_uniform_float_values.arr[0].el; + float const x_90 = a_1; + float3 const x_92 = mix(float3(x_85, x_85, x_85), float3(x_88, x_88, x_88), float3(x_90, x_90, x_90)); + float const x_94 = x_10.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_5) = float4(x_92.x, x_92.y, x_92.z, x_94); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, x_10, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..d38b160ef0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.spvasm @@ -0,0 +1,191 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 122 +; Schema: 0 + OpCapability Shader + %99 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %f1_f1_ "f1_f1_" + OpName %a "a" + OpName %main_1 "main_1" + OpName %v2 "v2" + OpName %a_1 "a_1" + OpName %x_40 "x_40" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %float %_ptr_Function_float + %void = OpTypeVoid + %30 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %37 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %v3float = OpTypeVector %float 3 + %main_out = OpTypeStruct %v4float + %109 = OpTypeFunction %void %main_out + %f1_f1_ = OpFunction %float None %22 + %a = OpFunctionParameter %_ptr_Function_float + %26 = OpLabel + %28 = OpLoad %float %a + %29 = OpDPdx %float %28 + OpReturnValue %29 + OpFunctionEnd + %main_1 = OpFunction %void None %30 + %33 = OpLabel + %v2 = OpVariable %_ptr_Function_v4float Function %5 + %a_1 = OpVariable %_ptr_Function_float Function %37 + %x_40 = OpVariable %_ptr_Function_float Function %37 + %param = OpVariable %_ptr_Function_float Function %37 + %43 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %44 = OpLoad %int %43 + %46 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %44 + %53 = OpConvertSToF %float %47 + %54 = OpConvertSToF %float %49 + %55 = OpConvertSToF %float %51 + %56 = OpCompositeConstruct %v4float %52 %53 %54 %55 + OpStore %x_GLF_color %56 + %58 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %59 = OpLoad %float %58 + %61 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %62 = OpLoad %float %61 + %63 = OpFOrdLessThan %bool %59 %62 + OpSelectionMerge %65 None + OpBranchConditional %63 %66 %65 + %66 = OpLabel + %67 = OpAccessChain %_ptr_Function_float %v2 %uint_0 + %68 = OpLoad %float %67 + %71 = OpFOrdLessThan %bool %68 %float_1 + %69 = OpLogicalNot %bool %71 + OpSelectionMerge %72 None + OpBranchConditional %69 %73 %72 + %73 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %79 = OpLoad %float %78 + %80 = OpFOrdGreaterThan %bool %77 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %85 = OpLoad %float %84 + OpStore %param %85 + %86 = OpFunctionCall %float %f1_f1_ %param + OpStore %x_40 %86 + OpBranch %81 + %83 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %89 = OpLoad %float %88 + OpStore %x_40 %89 + OpBranch %81 + %81 = OpLabel + %90 = OpLoad %float %x_40 + %91 = OpFDiv %float %75 %90 + OpStore %a_1 %91 + %92 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %93 = OpLoad %float %92 + %94 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %95 = OpLoad %float %94 + %96 = OpLoad %float %a_1 + %100 = OpCompositeConstruct %v3float %93 %93 %93 + %101 = OpCompositeConstruct %v3float %95 %95 %95 + %102 = OpCompositeConstruct %v3float %96 %96 %96 + %97 = OpExtInst %v3float %99 FMix %100 %101 %102 + %103 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %104 = OpLoad %float %103 + %105 = OpCompositeExtract %float %97 0 + %106 = OpCompositeExtract %float %97 1 + %107 = OpCompositeExtract %float %97 2 + %108 = OpCompositeConstruct %v4float %105 %106 %107 %104 + OpStore %x_GLF_color %108 + OpBranch %72 + %72 = OpLabel + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %109 +%tint_symbol_1 = OpFunctionParameter %main_out + %113 = OpLabel + %114 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %114 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %30 + %116 = OpLabel + %117 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %117 + %118 = OpFunctionCall %void %main_1 + %120 = OpLoad %v4float %x_GLF_color + %121 = OpCompositeConstruct %main_out %120 + %119 = OpFunctionCall %void %tint_symbol_3 %121 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a6defc786a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.spvasm.expected.wgsl @@ -0,0 +1,78 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_10 : buf1; + +fn f1_f1_(a : ptr) -> f32 { + let x_100 : f32 = *(a); + return dpdx(x_100); +} + +fn main_1() { + var v2 : vec4; + var a_1 : f32; + var x_40 : f32; + var param : f32; + let x_42 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_48 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_42), f32(x_45), f32(x_48), f32(x_51)); + let x_55 : f32 = gl_FragCoord.x; + let x_57 : f32 = x_10.x_GLF_uniform_float_values[1]; + if ((x_55 < x_57)) { + let x_62 : f32 = v2.x; + if (!((x_62 < 1.0))) { + let x_68 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_70 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_72 : f32 = x_10.x_GLF_uniform_float_values[0]; + if ((x_70 > x_72)) { + let x_78 : f32 = x_10.x_GLF_uniform_float_values[0]; + param = x_78; + let x_79 : f32 = f1_f1_(&(param)); + x_40 = x_79; + } else { + let x_81 : f32 = x_10.x_GLF_uniform_float_values[0]; + x_40 = x_81; + } + let x_82 : f32 = x_40; + a_1 = (x_68 / x_82); + let x_85 : f32 = x_10.x_GLF_uniform_float_values[0]; + let x_88 : f32 = x_10.x_GLF_uniform_float_values[0]; + let x_90 : f32 = a_1; + let x_92 : vec3 = mix(vec3(x_85, x_85, x_85), vec3(x_88, x_88, x_88), vec3(x_90, x_90, x_90)); + let x_94 : f32 = x_10.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_92.x, x_92.y, x_92.z, x_94); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl new file mode 100644 index 0000000000..a6defc786a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl @@ -0,0 +1,78 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_10 : buf1; + +fn f1_f1_(a : ptr) -> f32 { + let x_100 : f32 = *(a); + return dpdx(x_100); +} + +fn main_1() { + var v2 : vec4; + var a_1 : f32; + var x_40 : f32; + var param : f32; + let x_42 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_48 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_42), f32(x_45), f32(x_48), f32(x_51)); + let x_55 : f32 = gl_FragCoord.x; + let x_57 : f32 = x_10.x_GLF_uniform_float_values[1]; + if ((x_55 < x_57)) { + let x_62 : f32 = v2.x; + if (!((x_62 < 1.0))) { + let x_68 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_70 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_72 : f32 = x_10.x_GLF_uniform_float_values[0]; + if ((x_70 > x_72)) { + let x_78 : f32 = x_10.x_GLF_uniform_float_values[0]; + param = x_78; + let x_79 : f32 = f1_f1_(&(param)); + x_40 = x_79; + } else { + let x_81 : f32 = x_10.x_GLF_uniform_float_values[0]; + x_40 = x_81; + } + let x_82 : f32 = x_40; + a_1 = (x_68 / x_82); + let x_85 : f32 = x_10.x_GLF_uniform_float_values[0]; + let x_88 : f32 = x_10.x_GLF_uniform_float_values[0]; + let x_90 : f32 = a_1; + let x_92 : vec3 = mix(vec3(x_85, x_85, x_85), vec3(x_88, x_88, x_88), vec3(x_90, x_90, x_90)); + let x_94 : f32 = x_10.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_92.x, x_92.y, x_92.z, x_94); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..b9e87ec1f2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.hlsl @@ -0,0 +1,78 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[2]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[2]; +}; + +float f1_f1_(inout float a) { + const float x_100 = a; + return ddx(x_100); +} + +void main_1() { + float4 v2 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float a_1 = 0.0f; + float x_40 = 0.0f; + float param = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_42 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + const int x_45 = asint(x_8[1].x); + const int x_48 = asint(x_8[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_51 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + const float x_55 = gl_FragCoord.x; + const float x_57 = asfloat(x_10[1].x); + if ((x_55 < x_57)) { + const float x_62 = v2.x; + if (!((x_62 < 1.0f))) { + const float x_68 = asfloat(x_10[1].x); + const float x_70 = asfloat(x_10[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_72 = asfloat(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_70 > x_72)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_78 = asfloat(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + param = x_78; + const float x_79 = f1_f1_(param); + x_40 = x_79; + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_81 = asfloat(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_40 = x_81; + } + a_1 = (x_68 / x_40); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_85 = asfloat(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const float x_88 = asfloat(x_10[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_90 = a_1; + const float3 x_92 = lerp(float3(x_85, x_85, x_85), float3(x_88, x_88, x_88), float3(x_90, x_90, x_90)); + const float x_94 = asfloat(x_10[1].x); + x_GLF_color = float4(x_92.x, x_92.y, x_92.z, x_94); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a3e74a594c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.msl @@ -0,0 +1,85 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float f1_f1_(thread float* const a) { + float const x_100 = *(a); + return dfdx(x_100); +} + +void main_1(constant buf0& x_8, constant buf1& x_10, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float4 v2 = 0.0f; + float a_1 = 0.0f; + float x_40 = 0.0f; + float param = 0.0f; + int const x_42 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_45 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_48 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_51 = x_8.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + float const x_55 = (*(tint_symbol_6)).x; + float const x_57 = x_10.x_GLF_uniform_float_values.arr[1].el; + if ((x_55 < x_57)) { + float const x_62 = v2.x; + if (!((x_62 < 1.0f))) { + float const x_68 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_70 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_72 = x_10.x_GLF_uniform_float_values.arr[0].el; + if ((x_70 > x_72)) { + float const x_78 = x_10.x_GLF_uniform_float_values.arr[0].el; + param = x_78; + float const x_79 = f1_f1_(&(param)); + x_40 = x_79; + } else { + float const x_81 = x_10.x_GLF_uniform_float_values.arr[0].el; + x_40 = x_81; + } + float const x_82 = x_40; + a_1 = (x_68 / x_82); + float const x_85 = x_10.x_GLF_uniform_float_values.arr[0].el; + float const x_88 = x_10.x_GLF_uniform_float_values.arr[0].el; + float const x_90 = a_1; + float3 const x_92 = mix(float3(x_85, x_85, x_85), float3(x_88, x_88, x_88), float3(x_90, x_90, x_90)); + float const x_94 = x_10.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_5) = float4(x_92.x, x_92.y, x_92.z, x_94); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, x_10, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..d38b160ef0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.spvasm @@ -0,0 +1,191 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 122 +; Schema: 0 + OpCapability Shader + %99 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %f1_f1_ "f1_f1_" + OpName %a "a" + OpName %main_1 "main_1" + OpName %v2 "v2" + OpName %a_1 "a_1" + OpName %x_40 "x_40" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpTypeFunction %float %_ptr_Function_float + %void = OpTypeVoid + %30 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %37 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %v3float = OpTypeVector %float 3 + %main_out = OpTypeStruct %v4float + %109 = OpTypeFunction %void %main_out + %f1_f1_ = OpFunction %float None %22 + %a = OpFunctionParameter %_ptr_Function_float + %26 = OpLabel + %28 = OpLoad %float %a + %29 = OpDPdx %float %28 + OpReturnValue %29 + OpFunctionEnd + %main_1 = OpFunction %void None %30 + %33 = OpLabel + %v2 = OpVariable %_ptr_Function_v4float Function %5 + %a_1 = OpVariable %_ptr_Function_float Function %37 + %x_40 = OpVariable %_ptr_Function_float Function %37 + %param = OpVariable %_ptr_Function_float Function %37 + %43 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %44 = OpLoad %int %43 + %46 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %44 + %53 = OpConvertSToF %float %47 + %54 = OpConvertSToF %float %49 + %55 = OpConvertSToF %float %51 + %56 = OpCompositeConstruct %v4float %52 %53 %54 %55 + OpStore %x_GLF_color %56 + %58 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %59 = OpLoad %float %58 + %61 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %62 = OpLoad %float %61 + %63 = OpFOrdLessThan %bool %59 %62 + OpSelectionMerge %65 None + OpBranchConditional %63 %66 %65 + %66 = OpLabel + %67 = OpAccessChain %_ptr_Function_float %v2 %uint_0 + %68 = OpLoad %float %67 + %71 = OpFOrdLessThan %bool %68 %float_1 + %69 = OpLogicalNot %bool %71 + OpSelectionMerge %72 None + OpBranchConditional %69 %73 %72 + %73 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %79 = OpLoad %float %78 + %80 = OpFOrdGreaterThan %bool %77 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %85 = OpLoad %float %84 + OpStore %param %85 + %86 = OpFunctionCall %float %f1_f1_ %param + OpStore %x_40 %86 + OpBranch %81 + %83 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %89 = OpLoad %float %88 + OpStore %x_40 %89 + OpBranch %81 + %81 = OpLabel + %90 = OpLoad %float %x_40 + %91 = OpFDiv %float %75 %90 + OpStore %a_1 %91 + %92 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %93 = OpLoad %float %92 + %94 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %95 = OpLoad %float %94 + %96 = OpLoad %float %a_1 + %100 = OpCompositeConstruct %v3float %93 %93 %93 + %101 = OpCompositeConstruct %v3float %95 %95 %95 + %102 = OpCompositeConstruct %v3float %96 %96 %96 + %97 = OpExtInst %v3float %99 FMix %100 %101 %102 + %103 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %104 = OpLoad %float %103 + %105 = OpCompositeExtract %float %97 0 + %106 = OpCompositeExtract %float %97 1 + %107 = OpCompositeExtract %float %97 2 + %108 = OpCompositeConstruct %v4float %105 %106 %107 %104 + OpStore %x_GLF_color %108 + OpBranch %72 + %72 = OpLabel + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %109 +%tint_symbol_1 = OpFunctionParameter %main_out + %113 = OpLabel + %114 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %114 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %30 + %116 = OpLabel + %117 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %117 + %118 = OpFunctionCall %void %main_1 + %120 = OpLoad %v4float %x_GLF_color + %121 = OpCompositeConstruct %main_out %120 + %119 = OpFunctionCall %void %tint_symbol_3 %121 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6defc786a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-mul-div-rem-if-undefined-divide-mix/0-opt.wgsl.expected.wgsl @@ -0,0 +1,78 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_10 : buf1; + +fn f1_f1_(a : ptr) -> f32 { + let x_100 : f32 = *(a); + return dpdx(x_100); +} + +fn main_1() { + var v2 : vec4; + var a_1 : f32; + var x_40 : f32; + var param : f32; + let x_42 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_48 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_42), f32(x_45), f32(x_48), f32(x_51)); + let x_55 : f32 = gl_FragCoord.x; + let x_57 : f32 = x_10.x_GLF_uniform_float_values[1]; + if ((x_55 < x_57)) { + let x_62 : f32 = v2.x; + if (!((x_62 < 1.0))) { + let x_68 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_70 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_72 : f32 = x_10.x_GLF_uniform_float_values[0]; + if ((x_70 > x_72)) { + let x_78 : f32 = x_10.x_GLF_uniform_float_values[0]; + param = x_78; + let x_79 : f32 = f1_f1_(&(param)); + x_40 = x_79; + } else { + let x_81 : f32 = x_10.x_GLF_uniform_float_values[0]; + x_40 = x_81; + } + let x_82 : f32 = x_40; + a_1 = (x_68 / x_82); + let x_85 : f32 = x_10.x_GLF_uniform_float_values[0]; + let x_88 : f32 = x_10.x_GLF_uniform_float_values[0]; + let x_90 : f32 = a_1; + let x_92 : vec3 = mix(vec3(x_85, x_85, x_85), vec3(x_88, x_88, x_88), vec3(x_90, x_90, x_90)); + let x_94 : f32 = x_10.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_92.x, x_92.y, x_92.z, x_94); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm new file mode 100644 index 0000000000..65fb798b05 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm @@ -0,0 +1,176 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %v1 "v1" + OpName %E "E" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_7 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float = OpTypeFloat 32 + %uint_7 = OpConstant %uint 7 +%_arr_float_uint_7 = OpTypeArray %float %uint_7 + %buf1 = OpTypeStruct %_arr_float_uint_7 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float +%float_0_00999999978 = OpConstant %float 0.00999999978 + %bool = OpTypeBool + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %39 = OpLabel + %a = OpVariable %_ptr_Function_uint Function + %v1 = OpVariable %_ptr_Function_v4float Function + %E = OpVariable %_ptr_Function_float Function + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %43 = OpLoad %float %42 + %44 = OpCompositeConstruct %v2float %41 %43 + %45 = OpExtInst %uint %1 PackUnorm2x16 %44 + OpStore %a %45 + %46 = OpLoad %uint %a + %47 = OpExtInst %v4float %1 UnpackSnorm4x8 %46 + OpStore %v1 %47 + OpStore %E %float_0_00999999978 + %48 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_Function_float %v1 %49 + %51 = OpLoad %float %50 + %52 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %53 = OpLoad %float %52 + %54 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %55 = OpLoad %float %54 + %56 = OpFDiv %float %53 %55 + %57 = OpFSub %float %51 %56 + %58 = OpExtInst %float %1 FAbs %57 + %59 = OpLoad %float %E + %60 = OpFOrdLessThan %bool %58 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Function_float %v1 %64 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_4 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %70 = OpLoad %float %69 + %71 = OpFDiv %float %68 %70 + %72 = OpFSub %float %66 %71 + %73 = OpExtInst %float %1 FAbs %72 + %74 = OpLoad %float %E + %75 = OpFOrdLessThan %bool %73 %74 + OpBranch %61 + %61 = OpLabel + %76 = OpPhi %bool %60 %39 %75 %62 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Function_float %v1 %80 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_5 + %84 = OpLoad %float %83 + %85 = OpFNegate %float %84 + %86 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %87 = OpLoad %float %86 + %88 = OpFDiv %float %85 %87 + %89 = OpFSub %float %82 %88 + %90 = OpExtInst %float %1 FAbs %89 + %91 = OpLoad %float %E + %92 = OpFOrdLessThan %bool %90 %91 + OpBranch %77 + %77 = OpLabel + %93 = OpPhi %bool %76 %61 %92 %78 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %94 + %95 = OpLabel + %96 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %97 = OpLoad %int %96 + %98 = OpAccessChain %_ptr_Function_float %v1 %97 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_6 + %101 = OpLoad %float %100 + %102 = OpFNegate %float %101 + %103 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %104 = OpLoad %float %103 + %105 = OpFDiv %float %102 %104 + %106 = OpFSub %float %99 %105 + %107 = OpExtInst %float %1 FAbs %106 + %108 = OpLoad %float %E + %109 = OpFOrdLessThan %bool %107 %108 + OpBranch %94 + %94 = OpLabel + %110 = OpPhi %bool %93 %77 %109 %95 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %113 + %112 = OpLabel + %114 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %115 = OpLoad %int %114 + %116 = OpConvertSToF %float %115 + %117 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %118 = OpLoad %int %117 + %119 = OpConvertSToF %float %118 + %120 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %121 = OpLoad %int %120 + %122 = OpConvertSToF %float %121 + %123 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %124 = OpLoad %int %123 + %125 = OpConvertSToF %float %124 + %126 = OpCompositeConstruct %v4float %116 %119 %122 %125 + OpStore %_GLF_color %126 + OpBranch %111 + %113 = OpLabel + %127 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_5 + %128 = OpLoad %float %127 + %129 = OpCompositeConstruct %v4float %128 %128 %128 %128 + OpStore %_GLF_color %129 + OpBranch %111 + %111 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..c1507aed9e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.hlsl @@ -0,0 +1,96 @@ +uint tint_pack2x16unorm(float2 param_0) { + uint2 i = uint2(round(clamp(param_0, 0.0, 1.0) * 65535.0)); + return (i.x | i.y << 16); +} + +float4 tint_unpack4x8snorm(uint param_0) { + int j = int(param_0); + int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; + return clamp(float4(i) / 127.0, -1.0, 1.0); +} + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[7]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float E = 0.0f; + bool x_75 = false; + bool x_92 = false; + bool x_109 = false; + bool x_76_phi = false; + bool x_93_phi = false; + bool x_110_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_43 = asfloat(x_6[1].x); + a = tint_pack2x16unorm(float2(x_41, x_43)); + v1 = tint_unpack4x8snorm(a); + E = 0.01f; + const int x_49 = asint(x_10[2].x); + const float x_51 = v1[x_49]; + const float x_53 = asfloat(x_6[2].x); + const float x_55 = asfloat(x_6[3].x); + const bool x_60 = (abs((x_51 - (x_53 / x_55))) < E); + x_76_phi = x_60; + if (x_60) { + const int x_64 = asint(x_10[1].x); + const float x_66 = v1[x_64]; + const float x_68 = asfloat(x_6[4].x); + const float x_70 = asfloat(x_6[3].x); + x_75 = (abs((x_66 - (x_68 / x_70))) < E); + x_76_phi = x_75; + } + const bool x_76 = x_76_phi; + x_93_phi = x_76; + if (x_76) { + const int x_80 = asint(x_10[3].x); + const float x_82 = v1[x_80]; + const float x_84 = asfloat(x_6[5].x); + const float x_87 = asfloat(x_6[3].x); + x_92 = (abs((x_82 - (-(x_84) / x_87))) < E); + x_93_phi = x_92; + } + const bool x_93 = x_93_phi; + x_110_phi = x_93; + if (x_93) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_97 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_99 = v1[x_97]; + const float x_101 = asfloat(x_6[6].x); + const float x_104 = asfloat(x_6[3].x); + x_109 = (abs((x_99 - (-(x_101) / x_104))) < E); + x_110_phi = x_109; + } + if (x_110_phi) { + const int x_115 = asint(x_10[1].x); + const int x_118 = asint(x_10[2].x); + const int x_121 = asint(x_10[2].x); + const int x_124 = asint(x_10[1].x); + x_GLF_color = float4(float(x_115), float(x_118), float(x_121), float(x_124)); + } else { + const float x_128 = asfloat(x_6[5].x); + x_GLF_color = float4(x_128, x_128, x_128, x_128); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..77c6b6dbdc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.msl @@ -0,0 +1,106 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[7]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_10, thread float4* const tint_symbol_4) { + uint a = 0u; + float4 v1 = 0.0f; + float E = 0.0f; + bool x_75 = false; + bool x_92 = false; + bool x_109 = false; + bool x_76_phi = false; + bool x_93_phi = false; + bool x_110_phi = false; + float const x_41 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_43 = x_6.x_GLF_uniform_float_values.arr[1].el; + a = pack_float_to_unorm2x16(float2(x_41, x_43)); + uint const x_46 = a; + v1 = unpack_snorm4x8_to_float(x_46); + E = 0.01f; + int const x_49 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_51 = v1[x_49]; + float const x_53 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_55 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_59 = E; + bool const x_60 = (fabs((x_51 - (x_53 / x_55))) < x_59); + x_76_phi = x_60; + if (x_60) { + int const x_64 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_66 = v1[x_64]; + float const x_68 = x_6.x_GLF_uniform_float_values.arr[4].el; + float const x_70 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_74 = E; + x_75 = (fabs((x_66 - (x_68 / x_70))) < x_74); + x_76_phi = x_75; + } + bool const x_76 = x_76_phi; + x_93_phi = x_76; + if (x_76) { + int const x_80 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_82 = v1[x_80]; + float const x_84 = x_6.x_GLF_uniform_float_values.arr[5].el; + float const x_87 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_91 = E; + x_92 = (fabs((x_82 - (-(x_84) / x_87))) < x_91); + x_93_phi = x_92; + } + bool const x_93 = x_93_phi; + x_110_phi = x_93; + if (x_93) { + int const x_97 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_99 = v1[x_97]; + float const x_101 = x_6.x_GLF_uniform_float_values.arr[6].el; + float const x_104 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_108 = E; + x_109 = (fabs((x_99 - (-(x_101) / x_104))) < x_108); + x_110_phi = x_109; + } + bool const x_110 = x_110_phi; + if (x_110) { + int const x_115 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_118 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_121 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_124 = x_10.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_115), float(x_118), float(x_121), float(x_124)); + } else { + float const x_128 = x_6.x_GLF_uniform_float_values.arr[5].el; + *(tint_symbol_4) = float4(x_128, x_128, x_128, x_128); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..470393d9ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.spvasm @@ -0,0 +1,238 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 159 +; Schema: 0 + OpCapability Shader + %50 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %v1 "v1" + OpName %E "E" + OpName %x_75 "x_75" + OpName %x_92 "x_92" + OpName %x_109 "x_109" + OpName %x_76_phi "x_76_phi" + OpName %x_93_phi "x_93_phi" + OpName %x_110_phi "x_110_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_7 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_7 = OpConstant %uint 7 +%_arr_float_uint_7 = OpTypeArray %float %uint_7 + %buf1 = OpTypeStruct %_arr_float_uint_7 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %26 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %31 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %35 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %v2float = OpTypeVector %float 2 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %main_out = OpTypeStruct %v4float + %147 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %26 + %v1 = OpVariable %_ptr_Function_v4float Function %17 + %E = OpVariable %_ptr_Function_float Function %31 + %x_75 = OpVariable %_ptr_Function_bool Function %35 + %x_92 = OpVariable %_ptr_Function_bool Function %35 + %x_109 = OpVariable %_ptr_Function_bool Function %35 + %x_76_phi = OpVariable %_ptr_Function_bool Function %35 + %x_93_phi = OpVariable %_ptr_Function_bool Function %35 + %x_110_phi = OpVariable %_ptr_Function_bool Function %35 + %44 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %45 = OpLoad %float %44 + %47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %48 = OpLoad %float %47 + %52 = OpCompositeConstruct %v2float %45 %48 + %49 = OpExtInst %uint %50 PackUnorm2x16 %52 + OpStore %a %49 + %53 = OpLoad %uint %a + %54 = OpExtInst %v4float %50 UnpackSnorm4x8 %53 + OpStore %v1 %54 + OpStore %E %float_0_00999999978 + %58 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Function_float %v1 %59 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %63 = OpLoad %float %62 + %65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %66 = OpLoad %float %65 + %67 = OpLoad %float %E + %69 = OpFDiv %float %63 %66 + %70 = OpFSub %float %61 %69 + %68 = OpExtInst %float %50 FAbs %70 + %71 = OpFOrdLessThan %bool %68 %67 + OpStore %x_76_phi %71 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Function_float %v1 %75 + %77 = OpLoad %float %76 + %79 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_4 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %82 = OpLoad %float %81 + %83 = OpLoad %float %E + %85 = OpFDiv %float %80 %82 + %86 = OpFSub %float %77 %85 + %84 = OpExtInst %float %50 FAbs %86 + %87 = OpFOrdLessThan %bool %84 %83 + OpStore %x_75 %87 + %88 = OpLoad %bool %x_75 + OpStore %x_76_phi %88 + OpBranch %72 + %72 = OpLabel + %89 = OpLoad %bool %x_76_phi + OpStore %x_93_phi %89 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %93 = OpLoad %int %92 + %94 = OpAccessChain %_ptr_Function_float %v1 %93 + %95 = OpLoad %float %94 + %97 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_5 + %98 = OpLoad %float %97 + %99 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %100 = OpLoad %float %99 + %101 = OpLoad %float %E + %103 = OpFNegate %float %98 + %104 = OpFDiv %float %103 %100 + %105 = OpFSub %float %95 %104 + %102 = OpExtInst %float %50 FAbs %105 + %106 = OpFOrdLessThan %bool %102 %101 + OpStore %x_92 %106 + %107 = OpLoad %bool %x_92 + OpStore %x_93_phi %107 + OpBranch %90 + %90 = OpLabel + %108 = OpLoad %bool %x_93_phi + OpStore %x_110_phi %108 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %109 + %110 = OpLabel + %111 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %112 = OpLoad %int %111 + %113 = OpAccessChain %_ptr_Function_float %v1 %112 + %114 = OpLoad %float %113 + %116 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_6 + %117 = OpLoad %float %116 + %118 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %119 = OpLoad %float %118 + %120 = OpLoad %float %E + %122 = OpFNegate %float %117 + %123 = OpFDiv %float %122 %119 + %124 = OpFSub %float %114 %123 + %121 = OpExtInst %float %50 FAbs %124 + %125 = OpFOrdLessThan %bool %121 %120 + OpStore %x_109 %125 + %126 = OpLoad %bool %x_109 + OpStore %x_110_phi %126 + OpBranch %109 + %109 = OpLabel + %127 = OpLoad %bool %x_110_phi + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %130 + %129 = OpLabel + %131 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %132 = OpLoad %int %131 + %133 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %134 = OpLoad %int %133 + %135 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %136 = OpLoad %int %135 + %137 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %138 = OpLoad %int %137 + %139 = OpConvertSToF %float %132 + %140 = OpConvertSToF %float %134 + %141 = OpConvertSToF %float %136 + %142 = OpConvertSToF %float %138 + %143 = OpCompositeConstruct %v4float %139 %140 %141 %142 + OpStore %x_GLF_color %143 + OpBranch %128 + %130 = OpLabel + %144 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_5 + %145 = OpLoad %float %144 + %146 = OpCompositeConstruct %v4float %145 %145 %145 %145 + OpStore %x_GLF_color %146 + OpBranch %128 + %128 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %147 +%tint_symbol = OpFunctionParameter %main_out + %151 = OpLabel + %152 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %152 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %154 = OpLabel + %155 = OpFunctionCall %void %main_1 + %157 = OpLoad %v4float %x_GLF_color + %158 = OpCompositeConstruct %main_out %157 + %156 = OpFunctionCall %void %tint_symbol_2 %158 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..47774e76b7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.spvasm.expected.wgsl @@ -0,0 +1,98 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var v1 : vec4; + var E : f32; + var x_75 : bool; + var x_92 : bool; + var x_109 : bool; + var x_76_phi : bool; + var x_93_phi : bool; + var x_110_phi : bool; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = pack2x16unorm(vec2(x_41, x_43)); + let x_46 : u32 = a; + v1 = unpack4x8snorm(x_46); + E = 0.01; + let x_49 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_51 : f32 = v1[x_49]; + let x_53 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_59 : f32 = E; + let x_60 : bool = (abs((x_51 - (x_53 / x_55))) < x_59); + x_76_phi = x_60; + if (x_60) { + let x_64 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_66 : f32 = v1[x_64]; + let x_68 : f32 = x_6.x_GLF_uniform_float_values[4]; + let x_70 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_74 : f32 = E; + x_75 = (abs((x_66 - (x_68 / x_70))) < x_74); + x_76_phi = x_75; + } + let x_76 : bool = x_76_phi; + x_93_phi = x_76; + if (x_76) { + let x_80 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_82 : f32 = v1[x_80]; + let x_84 : f32 = x_6.x_GLF_uniform_float_values[5]; + let x_87 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_91 : f32 = E; + x_92 = (abs((x_82 - (-(x_84) / x_87))) < x_91); + x_93_phi = x_92; + } + let x_93 : bool = x_93_phi; + x_110_phi = x_93; + if (x_93) { + let x_97 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_99 : f32 = v1[x_97]; + let x_101 : f32 = x_6.x_GLF_uniform_float_values[6]; + let x_104 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_108 : f32 = E; + x_109 = (abs((x_99 - (-(x_101) / x_104))) < x_108); + x_110_phi = x_109; + } + let x_110 : bool = x_110_phi; + if (x_110) { + let x_115 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_118 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_121 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_124 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_115), f32(x_118), f32(x_121), f32(x_124)); + } else { + let x_128 : f32 = x_6.x_GLF_uniform_float_values[5]; + x_GLF_color = vec4(x_128, x_128, x_128, x_128); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl new file mode 100644 index 0000000000..47774e76b7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl @@ -0,0 +1,98 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var v1 : vec4; + var E : f32; + var x_75 : bool; + var x_92 : bool; + var x_109 : bool; + var x_76_phi : bool; + var x_93_phi : bool; + var x_110_phi : bool; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = pack2x16unorm(vec2(x_41, x_43)); + let x_46 : u32 = a; + v1 = unpack4x8snorm(x_46); + E = 0.01; + let x_49 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_51 : f32 = v1[x_49]; + let x_53 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_59 : f32 = E; + let x_60 : bool = (abs((x_51 - (x_53 / x_55))) < x_59); + x_76_phi = x_60; + if (x_60) { + let x_64 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_66 : f32 = v1[x_64]; + let x_68 : f32 = x_6.x_GLF_uniform_float_values[4]; + let x_70 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_74 : f32 = E; + x_75 = (abs((x_66 - (x_68 / x_70))) < x_74); + x_76_phi = x_75; + } + let x_76 : bool = x_76_phi; + x_93_phi = x_76; + if (x_76) { + let x_80 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_82 : f32 = v1[x_80]; + let x_84 : f32 = x_6.x_GLF_uniform_float_values[5]; + let x_87 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_91 : f32 = E; + x_92 = (abs((x_82 - (-(x_84) / x_87))) < x_91); + x_93_phi = x_92; + } + let x_93 : bool = x_93_phi; + x_110_phi = x_93; + if (x_93) { + let x_97 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_99 : f32 = v1[x_97]; + let x_101 : f32 = x_6.x_GLF_uniform_float_values[6]; + let x_104 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_108 : f32 = E; + x_109 = (abs((x_99 - (-(x_101) / x_104))) < x_108); + x_110_phi = x_109; + } + let x_110 : bool = x_110_phi; + if (x_110) { + let x_115 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_118 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_121 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_124 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_115), f32(x_118), f32(x_121), f32(x_124)); + } else { + let x_128 : f32 = x_6.x_GLF_uniform_float_values[5]; + x_GLF_color = vec4(x_128, x_128, x_128, x_128); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..c1507aed9e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.hlsl @@ -0,0 +1,96 @@ +uint tint_pack2x16unorm(float2 param_0) { + uint2 i = uint2(round(clamp(param_0, 0.0, 1.0) * 65535.0)); + return (i.x | i.y << 16); +} + +float4 tint_unpack4x8snorm(uint param_0) { + int j = int(param_0); + int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; + return clamp(float4(i) / 127.0, -1.0, 1.0); +} + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[7]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float E = 0.0f; + bool x_75 = false; + bool x_92 = false; + bool x_109 = false; + bool x_76_phi = false; + bool x_93_phi = false; + bool x_110_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_43 = asfloat(x_6[1].x); + a = tint_pack2x16unorm(float2(x_41, x_43)); + v1 = tint_unpack4x8snorm(a); + E = 0.01f; + const int x_49 = asint(x_10[2].x); + const float x_51 = v1[x_49]; + const float x_53 = asfloat(x_6[2].x); + const float x_55 = asfloat(x_6[3].x); + const bool x_60 = (abs((x_51 - (x_53 / x_55))) < E); + x_76_phi = x_60; + if (x_60) { + const int x_64 = asint(x_10[1].x); + const float x_66 = v1[x_64]; + const float x_68 = asfloat(x_6[4].x); + const float x_70 = asfloat(x_6[3].x); + x_75 = (abs((x_66 - (x_68 / x_70))) < E); + x_76_phi = x_75; + } + const bool x_76 = x_76_phi; + x_93_phi = x_76; + if (x_76) { + const int x_80 = asint(x_10[3].x); + const float x_82 = v1[x_80]; + const float x_84 = asfloat(x_6[5].x); + const float x_87 = asfloat(x_6[3].x); + x_92 = (abs((x_82 - (-(x_84) / x_87))) < E); + x_93_phi = x_92; + } + const bool x_93 = x_93_phi; + x_110_phi = x_93; + if (x_93) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_97 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_99 = v1[x_97]; + const float x_101 = asfloat(x_6[6].x); + const float x_104 = asfloat(x_6[3].x); + x_109 = (abs((x_99 - (-(x_101) / x_104))) < E); + x_110_phi = x_109; + } + if (x_110_phi) { + const int x_115 = asint(x_10[1].x); + const int x_118 = asint(x_10[2].x); + const int x_121 = asint(x_10[2].x); + const int x_124 = asint(x_10[1].x); + x_GLF_color = float4(float(x_115), float(x_118), float(x_121), float(x_124)); + } else { + const float x_128 = asfloat(x_6[5].x); + x_GLF_color = float4(x_128, x_128, x_128, x_128); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..77c6b6dbdc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.msl @@ -0,0 +1,106 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[7]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_10, thread float4* const tint_symbol_4) { + uint a = 0u; + float4 v1 = 0.0f; + float E = 0.0f; + bool x_75 = false; + bool x_92 = false; + bool x_109 = false; + bool x_76_phi = false; + bool x_93_phi = false; + bool x_110_phi = false; + float const x_41 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_43 = x_6.x_GLF_uniform_float_values.arr[1].el; + a = pack_float_to_unorm2x16(float2(x_41, x_43)); + uint const x_46 = a; + v1 = unpack_snorm4x8_to_float(x_46); + E = 0.01f; + int const x_49 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_51 = v1[x_49]; + float const x_53 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_55 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_59 = E; + bool const x_60 = (fabs((x_51 - (x_53 / x_55))) < x_59); + x_76_phi = x_60; + if (x_60) { + int const x_64 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_66 = v1[x_64]; + float const x_68 = x_6.x_GLF_uniform_float_values.arr[4].el; + float const x_70 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_74 = E; + x_75 = (fabs((x_66 - (x_68 / x_70))) < x_74); + x_76_phi = x_75; + } + bool const x_76 = x_76_phi; + x_93_phi = x_76; + if (x_76) { + int const x_80 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_82 = v1[x_80]; + float const x_84 = x_6.x_GLF_uniform_float_values.arr[5].el; + float const x_87 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_91 = E; + x_92 = (fabs((x_82 - (-(x_84) / x_87))) < x_91); + x_93_phi = x_92; + } + bool const x_93 = x_93_phi; + x_110_phi = x_93; + if (x_93) { + int const x_97 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_99 = v1[x_97]; + float const x_101 = x_6.x_GLF_uniform_float_values.arr[6].el; + float const x_104 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_108 = E; + x_109 = (fabs((x_99 - (-(x_101) / x_104))) < x_108); + x_110_phi = x_109; + } + bool const x_110 = x_110_phi; + if (x_110) { + int const x_115 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_118 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_121 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_124 = x_10.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_115), float(x_118), float(x_121), float(x_124)); + } else { + float const x_128 = x_6.x_GLF_uniform_float_values.arr[5].el; + *(tint_symbol_4) = float4(x_128, x_128, x_128, x_128); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..470393d9ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.spvasm @@ -0,0 +1,238 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 159 +; Schema: 0 + OpCapability Shader + %50 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %v1 "v1" + OpName %E "E" + OpName %x_75 "x_75" + OpName %x_92 "x_92" + OpName %x_109 "x_109" + OpName %x_76_phi "x_76_phi" + OpName %x_93_phi "x_93_phi" + OpName %x_110_phi "x_110_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_7 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_7 = OpConstant %uint 7 +%_arr_float_uint_7 = OpTypeArray %float %uint_7 + %buf1 = OpTypeStruct %_arr_float_uint_7 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %26 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %31 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %35 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %v2float = OpTypeVector %float 2 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %main_out = OpTypeStruct %v4float + %147 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %26 + %v1 = OpVariable %_ptr_Function_v4float Function %17 + %E = OpVariable %_ptr_Function_float Function %31 + %x_75 = OpVariable %_ptr_Function_bool Function %35 + %x_92 = OpVariable %_ptr_Function_bool Function %35 + %x_109 = OpVariable %_ptr_Function_bool Function %35 + %x_76_phi = OpVariable %_ptr_Function_bool Function %35 + %x_93_phi = OpVariable %_ptr_Function_bool Function %35 + %x_110_phi = OpVariable %_ptr_Function_bool Function %35 + %44 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %45 = OpLoad %float %44 + %47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %48 = OpLoad %float %47 + %52 = OpCompositeConstruct %v2float %45 %48 + %49 = OpExtInst %uint %50 PackUnorm2x16 %52 + OpStore %a %49 + %53 = OpLoad %uint %a + %54 = OpExtInst %v4float %50 UnpackSnorm4x8 %53 + OpStore %v1 %54 + OpStore %E %float_0_00999999978 + %58 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Function_float %v1 %59 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %63 = OpLoad %float %62 + %65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %66 = OpLoad %float %65 + %67 = OpLoad %float %E + %69 = OpFDiv %float %63 %66 + %70 = OpFSub %float %61 %69 + %68 = OpExtInst %float %50 FAbs %70 + %71 = OpFOrdLessThan %bool %68 %67 + OpStore %x_76_phi %71 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Function_float %v1 %75 + %77 = OpLoad %float %76 + %79 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_4 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %82 = OpLoad %float %81 + %83 = OpLoad %float %E + %85 = OpFDiv %float %80 %82 + %86 = OpFSub %float %77 %85 + %84 = OpExtInst %float %50 FAbs %86 + %87 = OpFOrdLessThan %bool %84 %83 + OpStore %x_75 %87 + %88 = OpLoad %bool %x_75 + OpStore %x_76_phi %88 + OpBranch %72 + %72 = OpLabel + %89 = OpLoad %bool %x_76_phi + OpStore %x_93_phi %89 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %93 = OpLoad %int %92 + %94 = OpAccessChain %_ptr_Function_float %v1 %93 + %95 = OpLoad %float %94 + %97 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_5 + %98 = OpLoad %float %97 + %99 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %100 = OpLoad %float %99 + %101 = OpLoad %float %E + %103 = OpFNegate %float %98 + %104 = OpFDiv %float %103 %100 + %105 = OpFSub %float %95 %104 + %102 = OpExtInst %float %50 FAbs %105 + %106 = OpFOrdLessThan %bool %102 %101 + OpStore %x_92 %106 + %107 = OpLoad %bool %x_92 + OpStore %x_93_phi %107 + OpBranch %90 + %90 = OpLabel + %108 = OpLoad %bool %x_93_phi + OpStore %x_110_phi %108 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %109 + %110 = OpLabel + %111 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %112 = OpLoad %int %111 + %113 = OpAccessChain %_ptr_Function_float %v1 %112 + %114 = OpLoad %float %113 + %116 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_6 + %117 = OpLoad %float %116 + %118 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %119 = OpLoad %float %118 + %120 = OpLoad %float %E + %122 = OpFNegate %float %117 + %123 = OpFDiv %float %122 %119 + %124 = OpFSub %float %114 %123 + %121 = OpExtInst %float %50 FAbs %124 + %125 = OpFOrdLessThan %bool %121 %120 + OpStore %x_109 %125 + %126 = OpLoad %bool %x_109 + OpStore %x_110_phi %126 + OpBranch %109 + %109 = OpLabel + %127 = OpLoad %bool %x_110_phi + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %130 + %129 = OpLabel + %131 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %132 = OpLoad %int %131 + %133 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %134 = OpLoad %int %133 + %135 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %136 = OpLoad %int %135 + %137 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %138 = OpLoad %int %137 + %139 = OpConvertSToF %float %132 + %140 = OpConvertSToF %float %134 + %141 = OpConvertSToF %float %136 + %142 = OpConvertSToF %float %138 + %143 = OpCompositeConstruct %v4float %139 %140 %141 %142 + OpStore %x_GLF_color %143 + OpBranch %128 + %130 = OpLabel + %144 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_5 + %145 = OpLoad %float %144 + %146 = OpCompositeConstruct %v4float %145 %145 %145 %145 + OpStore %x_GLF_color %146 + OpBranch %128 + %128 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %147 +%tint_symbol = OpFunctionParameter %main_out + %151 = OpLabel + %152 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %152 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %154 = OpLabel + %155 = OpFunctionCall %void %main_1 + %157 = OpLoad %v4float %x_GLF_color + %158 = OpCompositeConstruct %main_out %157 + %156 = OpFunctionCall %void %tint_symbol_2 %158 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..47774e76b7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-pack-unpack/0-opt.wgsl.expected.wgsl @@ -0,0 +1,98 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var v1 : vec4; + var E : f32; + var x_75 : bool; + var x_92 : bool; + var x_109 : bool; + var x_76_phi : bool; + var x_93_phi : bool; + var x_110_phi : bool; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = pack2x16unorm(vec2(x_41, x_43)); + let x_46 : u32 = a; + v1 = unpack4x8snorm(x_46); + E = 0.01; + let x_49 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_51 : f32 = v1[x_49]; + let x_53 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_59 : f32 = E; + let x_60 : bool = (abs((x_51 - (x_53 / x_55))) < x_59); + x_76_phi = x_60; + if (x_60) { + let x_64 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_66 : f32 = v1[x_64]; + let x_68 : f32 = x_6.x_GLF_uniform_float_values[4]; + let x_70 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_74 : f32 = E; + x_75 = (abs((x_66 - (x_68 / x_70))) < x_74); + x_76_phi = x_75; + } + let x_76 : bool = x_76_phi; + x_93_phi = x_76; + if (x_76) { + let x_80 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_82 : f32 = v1[x_80]; + let x_84 : f32 = x_6.x_GLF_uniform_float_values[5]; + let x_87 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_91 : f32 = E; + x_92 = (abs((x_82 - (-(x_84) / x_87))) < x_91); + x_93_phi = x_92; + } + let x_93 : bool = x_93_phi; + x_110_phi = x_93; + if (x_93) { + let x_97 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_99 : f32 = v1[x_97]; + let x_101 : f32 = x_6.x_GLF_uniform_float_values[6]; + let x_104 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_108 : f32 = E; + x_109 = (abs((x_99 - (-(x_101) / x_104))) < x_108); + x_110_phi = x_109; + } + let x_110 : bool = x_110_phi; + if (x_110) { + let x_115 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_118 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_121 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_124 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_115), f32(x_118), f32(x_121), f32(x_124)); + } else { + let x_128 : f32 = x_6.x_GLF_uniform_float_values[5]; + x_GLF_color = vec4(x_128, x_128, x_128, x_128); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm new file mode 100644 index 0000000000..e2e61a0d91 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm @@ -0,0 +1,116 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %main = OpFunction %void None %13 + %32 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %33 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %34 = OpLoad %int %33 + %35 = OpConvertSToF %float %34 + %36 = OpCompositeConstruct %v4float %35 %35 %35 %35 + OpStore %_GLF_color %36 + %37 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpFOrdGreaterThanEqual %bool %38 %40 + %42 = OpSelect %int %41 %int_2 %int_1 + %43 = OpShiftLeftLogical %int %int_1 %42 + OpStore %i %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %49 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpINotEqual %bool %48 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + %54 = OpLoad %int %i + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpSLessThan %bool %54 %56 + OpBranch %52 + %52 = OpLabel + %58 = OpPhi %bool %51 %47 %57 %53 + OpBranchConditional %58 %59 %45 + %59 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %61 + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %67 + %69 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %70 + %72 = OpCompositeConstruct %v4float %62 %65 %68 %71 + OpStore %_GLF_color %72 + OpBranch %46 + %46 = OpLabel + %73 = OpLoad %int %i + %74 = OpIAdd %int %73 %int_1 + OpStore %i %74 + OpBranch %44 + %45 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..0b645490c3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.hlsl @@ -0,0 +1,68 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[1]; +}; + +void main_1() { + int i = 0; + const int x_34 = asint(x_6[2].x); + const float x_35 = float(x_34); + x_GLF_color = float4(x_35, x_35, x_35, x_35); + const float x_38 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_9[scalar_offset / 4][scalar_offset % 4]); + i = (1 << asuint(((x_38 >= x_40) ? 2 : 1))); + while (true) { + bool x_57 = false; + bool x_58_phi = false; + const int x_48 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const bool x_51 = (x_48 != x_50); + x_58_phi = x_51; + if (x_51) { + const int x_54 = i; + const int x_56 = asint(x_6[1].x); + x_57 = (x_54 < x_56); + x_58_phi = x_57; + } + if (x_58_phi) { + } else { + break; + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_61 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_64 = asint(x_6[2].x); + const int x_67 = asint(x_6[2].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_70 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_61), float(x_64), float(x_67), float(x_70)); + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..752c12b1bb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + int const x_34 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_35 = float(x_34); + *(tint_symbol_5) = float4(x_35, x_35, x_35, x_35); + float const x_38 = (*(tint_symbol_6)).y; + float const x_40 = x_9.x_GLF_uniform_float_values.arr[0].el; + i = (1 << as_type(select(1, 2, (x_38 >= x_40)))); + while (true) { + bool x_57 = false; + bool x_58_phi = false; + int const x_48 = i; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[0].el; + bool const x_51 = (x_48 != x_50); + x_58_phi = x_51; + if (x_51) { + int const x_54 = i; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[1].el; + x_57 = (x_54 < x_56); + x_58_phi = x_57; + } + bool const x_58 = x_58_phi; + if (x_58) { + } else { + break; + } + int const x_61 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_67 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_70 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_61), float(x_64), float(x_67), float(x_70)); + { + int const x_73 = i; + i = (x_73 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, x_9, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..42db9320ac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.spvasm @@ -0,0 +1,170 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 101 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %x_57 "x_57" + OpName %x_58_phi "x_58_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Private_float = OpTypePointer Private %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %56 = OpConstantNull %bool + %main_out = OpTypeStruct %v4float + %88 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %i = OpVariable %_ptr_Function_int Function %29 + %x_57 = OpVariable %_ptr_Function_bool Function %56 + %x_58_phi = OpVariable %_ptr_Function_bool Function %56 + %33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %34 = OpLoad %int %33 + %35 = OpConvertSToF %float %34 + %36 = OpCompositeConstruct %v4float %35 %35 %35 %35 + OpStore %x_GLF_color %36 + %38 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %39 = OpLoad %float %38 + %42 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %43 = OpLoad %float %42 + %47 = OpFOrdGreaterThanEqual %bool %39 %43 + %46 = OpSelect %int %47 %int_2 %int_1 + %45 = OpBitcast %uint %46 + %49 = OpShiftLeftLogical %int %int_1 %45 + OpStore %i %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %58 = OpLoad %int %i + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpINotEqual %bool %58 %60 + OpStore %x_58_phi %61 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpSLessThan %bool %64 %66 + OpStore %x_57 %67 + %68 = OpLoad %bool %x_57 + OpStore %x_58_phi %68 + OpBranch %62 + %62 = OpLabel + %69 = OpLoad %bool %x_58_phi + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %51 + %70 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %74 + %82 = OpConvertSToF %float %76 + %83 = OpConvertSToF %float %78 + %84 = OpConvertSToF %float %80 + %85 = OpCompositeConstruct %v4float %81 %82 %83 %84 + OpStore %x_GLF_color %85 + OpBranch %52 + %52 = OpLabel + %86 = OpLoad %int %i + %87 = OpIAdd %int %86 %int_1 + OpStore %i %87 + OpBranch %50 + %51 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %88 +%tint_symbol_1 = OpFunctionParameter %main_out + %92 = OpLabel + %93 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %93 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %95 = OpLabel + %96 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %96 + %97 = OpFunctionCall %void %main_1 + %99 = OpLoad %v4float %x_GLF_color + %100 = OpCompositeConstruct %main_out %99 + %98 = OpFunctionCall %void %tint_symbol_3 %100 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ad9faee155 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.spvasm.expected.wgsl @@ -0,0 +1,73 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +fn main_1() { + var i : i32; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_35 : f32 = f32(x_34); + x_GLF_color = vec4(x_35, x_35, x_35, x_35); + let x_38 : f32 = gl_FragCoord.y; + let x_40 : f32 = x_9.x_GLF_uniform_float_values[0]; + i = (1 << bitcast(select(1, 2, (x_38 >= x_40)))); + loop { + var x_57 : bool; + var x_58_phi : bool; + let x_48 : i32 = i; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_51 : bool = (x_48 != x_50); + x_58_phi = x_51; + if (x_51) { + let x_54 : i32 = i; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_57 = (x_54 < x_56); + x_58_phi = x_57; + } + let x_58 : bool = x_58_phi; + if (x_58) { + } else { + break; + } + let x_61 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_70 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_61), f32(x_64), f32(x_67), f32(x_70)); + + continuing { + let x_73 : i32 = i; + i = (x_73 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl new file mode 100644 index 0000000000..ad9faee155 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl @@ -0,0 +1,73 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +fn main_1() { + var i : i32; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_35 : f32 = f32(x_34); + x_GLF_color = vec4(x_35, x_35, x_35, x_35); + let x_38 : f32 = gl_FragCoord.y; + let x_40 : f32 = x_9.x_GLF_uniform_float_values[0]; + i = (1 << bitcast(select(1, 2, (x_38 >= x_40)))); + loop { + var x_57 : bool; + var x_58_phi : bool; + let x_48 : i32 = i; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_51 : bool = (x_48 != x_50); + x_58_phi = x_51; + if (x_51) { + let x_54 : i32 = i; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_57 = (x_54 < x_56); + x_58_phi = x_57; + } + let x_58 : bool = x_58_phi; + if (x_58) { + } else { + break; + } + let x_61 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_70 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_61), f32(x_64), f32(x_67), f32(x_70)); + + continuing { + let x_73 : i32 = i; + i = (x_73 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..0b645490c3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.hlsl @@ -0,0 +1,68 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[1]; +}; + +void main_1() { + int i = 0; + const int x_34 = asint(x_6[2].x); + const float x_35 = float(x_34); + x_GLF_color = float4(x_35, x_35, x_35, x_35); + const float x_38 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_9[scalar_offset / 4][scalar_offset % 4]); + i = (1 << asuint(((x_38 >= x_40) ? 2 : 1))); + while (true) { + bool x_57 = false; + bool x_58_phi = false; + const int x_48 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const bool x_51 = (x_48 != x_50); + x_58_phi = x_51; + if (x_51) { + const int x_54 = i; + const int x_56 = asint(x_6[1].x); + x_57 = (x_54 < x_56); + x_58_phi = x_57; + } + if (x_58_phi) { + } else { + break; + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_61 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_64 = asint(x_6[2].x); + const int x_67 = asint(x_6[2].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_70 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_61), float(x_64), float(x_67), float(x_70)); + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..752c12b1bb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + int const x_34 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_35 = float(x_34); + *(tint_symbol_5) = float4(x_35, x_35, x_35, x_35); + float const x_38 = (*(tint_symbol_6)).y; + float const x_40 = x_9.x_GLF_uniform_float_values.arr[0].el; + i = (1 << as_type(select(1, 2, (x_38 >= x_40)))); + while (true) { + bool x_57 = false; + bool x_58_phi = false; + int const x_48 = i; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[0].el; + bool const x_51 = (x_48 != x_50); + x_58_phi = x_51; + if (x_51) { + int const x_54 = i; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[1].el; + x_57 = (x_54 < x_56); + x_58_phi = x_57; + } + bool const x_58 = x_58_phi; + if (x_58) { + } else { + break; + } + int const x_61 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_67 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_70 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_61), float(x_64), float(x_67), float(x_70)); + { + int const x_73 = i; + i = (x_73 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, x_9, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..42db9320ac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.spvasm @@ -0,0 +1,170 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 101 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %x_57 "x_57" + OpName %x_58_phi "x_58_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Private_float = OpTypePointer Private %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %56 = OpConstantNull %bool + %main_out = OpTypeStruct %v4float + %88 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %i = OpVariable %_ptr_Function_int Function %29 + %x_57 = OpVariable %_ptr_Function_bool Function %56 + %x_58_phi = OpVariable %_ptr_Function_bool Function %56 + %33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %34 = OpLoad %int %33 + %35 = OpConvertSToF %float %34 + %36 = OpCompositeConstruct %v4float %35 %35 %35 %35 + OpStore %x_GLF_color %36 + %38 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %39 = OpLoad %float %38 + %42 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %43 = OpLoad %float %42 + %47 = OpFOrdGreaterThanEqual %bool %39 %43 + %46 = OpSelect %int %47 %int_2 %int_1 + %45 = OpBitcast %uint %46 + %49 = OpShiftLeftLogical %int %int_1 %45 + OpStore %i %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %58 = OpLoad %int %i + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpINotEqual %bool %58 %60 + OpStore %x_58_phi %61 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpSLessThan %bool %64 %66 + OpStore %x_57 %67 + %68 = OpLoad %bool %x_57 + OpStore %x_58_phi %68 + OpBranch %62 + %62 = OpLabel + %69 = OpLoad %bool %x_58_phi + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %51 + %70 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %74 + %82 = OpConvertSToF %float %76 + %83 = OpConvertSToF %float %78 + %84 = OpConvertSToF %float %80 + %85 = OpCompositeConstruct %v4float %81 %82 %83 %84 + OpStore %x_GLF_color %85 + OpBranch %52 + %52 = OpLabel + %86 = OpLoad %int %i + %87 = OpIAdd %int %86 %int_1 + OpStore %i %87 + OpBranch %50 + %51 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %88 +%tint_symbol_1 = OpFunctionParameter %main_out + %92 = OpLabel + %93 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %93 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %95 = OpLabel + %96 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %96 + %97 = OpFunctionCall %void %main_1 + %99 = OpLoad %v4float %x_GLF_color + %100 = OpCompositeConstruct %main_out %99 + %98 = OpFunctionCall %void %tint_symbol_3 %100 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ad9faee155 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-left-shift-for/0-opt.wgsl.expected.wgsl @@ -0,0 +1,73 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +fn main_1() { + var i : i32; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_35 : f32 = f32(x_34); + x_GLF_color = vec4(x_35, x_35, x_35, x_35); + let x_38 : f32 = gl_FragCoord.y; + let x_40 : f32 = x_9.x_GLF_uniform_float_values[0]; + i = (1 << bitcast(select(1, 2, (x_38 >= x_40)))); + loop { + var x_57 : bool; + var x_58_phi : bool; + let x_48 : i32 = i; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_51 : bool = (x_48 != x_50); + x_58_phi = x_51; + if (x_51) { + let x_54 : i32 = i; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_57 = (x_54 < x_56); + x_58_phi = x_57; + } + let x_58 : bool = x_58_phi; + if (x_58) { + } else { + break; + } + let x_61 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_70 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_61), f32(x_64), f32(x_67), f32(x_70)); + + continuing { + let x_73 : i32 = i; + i = (x_73 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm new file mode 100644 index 0000000000..36e4d2979a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm @@ -0,0 +1,197 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %A "A" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %b "b" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float = OpTypeFloat 32 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %true = OpConstantTrue %bool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %40 = OpConstantComposite %v2bool %false %false + %uint_0 = OpConstant %uint 0 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %17 + %44 = OpLabel + %A = OpVariable %_ptr_Function__arr_int_uint_2 Function + %i = OpVariable %_ptr_Function_int Function + %a = OpVariable %_ptr_Function_int Function + %v1 = OpVariable %_ptr_Function_v2float Function + %v2 = OpVariable %_ptr_Function_v2float Function + %b = OpVariable %_ptr_Function_int Function + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Function_int %A %46 + OpStore %49 %48 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Function_int %A %51 + OpStore %54 %53 + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %56 = OpLoad %int %55 + OpStore %i %56 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %i + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %63 = OpLoad %int %62 + %64 = OpSGreaterThan %bool %61 %63 + OpBranchConditional %64 %65 %58 + %65 = OpLabel + %66 = OpLoad %int %i + %67 = OpISub %int %66 %int_1 + OpStore %i %67 + OpBranch %59 + %59 = OpLabel + OpBranch %57 + %58 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %69 = OpLoad %float %68 + %70 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %71 = OpLoad %float %70 + %72 = OpFOrdGreaterThanEqual %bool %69 %71 + %73 = OpLoad %int %i + %74 = OpSelect %int %72 %int_1 %73 + %75 = OpAccessChain %_ptr_Function_int %A %74 + %76 = OpLoad %int %75 + OpStore %a %76 + %77 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %78 = OpLoad %int %77 + %79 = OpConvertSToF %float %78 + %80 = OpLoad %int %a + %81 = OpConvertSToF %float %80 + %82 = OpCompositeConstruct %v2float %79 %81 + %83 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %84 = OpLoad %int %83 + %85 = OpConvertSToF %float %84 + %86 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %87 = OpLoad %int %86 + %88 = OpConvertSToF %float %87 + %89 = OpCompositeConstruct %v2float %85 %88 + %90 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %93 = OpLoad %float %92 + %94 = OpFOrdLessThan %bool %91 %93 + %95 = OpCompositeConstruct %v2bool %94 %true + %96 = OpSelect %v2float %95 %89 %82 + OpStore %v1 %96 + %97 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Function_float %v1 %98 + %100 = OpLoad %float %99 + %101 = OpCompositeConstruct %v2float %100 %100 + %102 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %103 = OpLoad %int %102 + %104 = OpAccessChain %_ptr_Function_float %v1 %103 + %105 = OpLoad %float %104 + %106 = OpCompositeConstruct %v2float %105 %105 + %107 = OpSelect %v2float %40 %106 %101 + OpStore %v2 %107 + %108 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %109 + %111 = OpCompositeConstruct %v2float %110 %110 + %112 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %113 = OpLoad %int %112 + %114 = OpConvertSToF %float %113 + %115 = OpCompositeConstruct %v2float %114 %114 + %116 = OpLoad %v2float %v2 + %117 = OpExtInst %v2float %1 FClamp %111 %115 %116 + %118 = OpCompositeExtract %float %117 0 + %119 = OpConvertFToS %int %118 + %120 = OpAccessChain %_ptr_Function_int %A %119 + %121 = OpLoad %int %120 + OpStore %b %121 + %122 = OpLoad %int %b + %123 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %124 = OpLoad %int %123 + %125 = OpIEqual %bool %122 %124 + OpSelectionMerge %126 None + OpBranchConditional %125 %127 %128 + %127 = OpLabel + %129 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %130 = OpLoad %int %129 + %131 = OpConvertSToF %float %130 + %132 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %133 = OpLoad %int %132 + %134 = OpConvertSToF %float %133 + %135 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %136 = OpLoad %int %135 + %137 = OpConvertSToF %float %136 + %138 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %139 = OpLoad %int %138 + %140 = OpConvertSToF %float %139 + %141 = OpCompositeConstruct %v4float %131 %134 %137 %140 + OpStore %_GLF_color %141 + OpBranch %126 + %128 = OpLabel + %142 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %143 = OpLoad %int %142 + %144 = OpConvertSToF %float %143 + %145 = OpCompositeConstruct %v4float %144 %144 %144 %144 + OpStore %_GLF_color %145 + OpBranch %126 + %126 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ff9156f3e5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,94 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int A[2] = (int[2])0; + int i = 0; + int a = 0; + float2 v1 = float2(0.0f, 0.0f); + float2 v2 = float2(0.0f, 0.0f); + int b = 0; + const int x_46 = asint(x_6[2].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_48 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + A[x_46] = x_48; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_51 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_53 = asint(x_6[1].x); + A[x_51] = x_53; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + i = x_56; + while (true) { + const int x_61 = i; + const int x_63 = asint(x_6[2].x); + if ((x_61 > x_63)) { + } else { + break; + } + i = (i - 1); + } + const float x_69 = asfloat(x_10[1].x); + const float x_71 = asfloat(x_10[1].x); + const int x_76 = A[((x_69 >= x_71) ? 1 : i)]; + a = x_76; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_78 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_80 = a; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_84 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_87 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const float x_91 = asfloat(x_10[1].x); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const float x_93 = asfloat(x_10[scalar_offset_6 / 4][scalar_offset_6 % 4]); + v1 = (bool2((x_91 < x_93), true) ? float2(float(x_84), float(x_87)) : float2(float(x_78), float(x_80))); + const int x_98 = asint(x_6[2].x); + const float x_100 = v1[x_98]; + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_103 = asint(x_6[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const float x_105 = v1[x_103]; + v2 = (bool2(false, false) ? float2(x_105, x_105) : float2(x_100, x_100)); + const int x_109 = asint(x_6[1].x); + const float x_110 = float(x_109); + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_113 = asint(x_6[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float x_114 = float(x_113); + const int x_121 = A[int(clamp(float2(x_110, x_110), float2(x_114, x_114), v2).x)]; + b = x_121; + const int x_122 = b; + const int x_124 = asint(x_6[1].x); + if ((x_122 == x_124)) { + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_130 = asint(x_6[scalar_offset_9 / 4][scalar_offset_9 % 4]); + const int x_133 = asint(x_6[2].x); + const int x_136 = asint(x_6[2].x); + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_139 = asint(x_6[scalar_offset_10 / 4][scalar_offset_10 % 4]); + x_GLF_color = float4(float(x_130), float(x_133), float(x_136), float(x_139)); + } else { + const int x_143 = asint(x_6[2].x); + const float x_144 = float(x_143); + x_GLF_color = float4(x_144, x_144, x_144, x_144); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..57d1bbaa65 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.msl @@ -0,0 +1,106 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_10, thread float4* const tint_symbol_4) { + tint_array_wrapper_2 A = {}; + int i = 0; + int a = 0; + float2 v1 = 0.0f; + float2 v2 = 0.0f; + int b = 0; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[0].el; + A.arr[x_46] = x_48; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + A.arr[x_51] = x_53; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[0].el; + i = x_56; + while (true) { + int const x_61 = i; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_61 > x_63)) { + } else { + break; + } + int const x_66 = i; + i = (x_66 - 1); + } + float const x_69 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_71 = x_10.x_GLF_uniform_float_values.arr[1].el; + int const x_73 = i; + int const x_76 = A.arr[select(x_73, 1, (x_69 >= x_71))]; + a = x_76; + int const x_78 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_80 = a; + int const x_84 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_87 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_91 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_93 = x_10.x_GLF_uniform_float_values.arr[0].el; + v1 = select(float2(float(x_78), float(x_80)), float2(float(x_84), float(x_87)), bool2((x_91 < x_93), true)); + int const x_98 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_100 = v1[x_98]; + int const x_103 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_105 = v1[x_103]; + v2 = select(float2(x_100, x_100), float2(x_105, x_105), bool2(false, false)); + int const x_109 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_110 = float(x_109); + int const x_113 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_114 = float(x_113); + float2 const x_116 = v2; + int const x_121 = A.arr[int(clamp(float2(x_110, x_110), float2(x_114, x_114), x_116).x)]; + b = x_121; + int const x_122 = b; + int const x_124 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_122 == x_124)) { + int const x_130 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_133 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_136 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_139 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_130), float(x_133), float(x_136), float(x_139)); + } else { + int const x_143 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_144 = float(x_143); + *(tint_symbol_4) = float4(x_144, x_144, x_144, x_144); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8b6f4d4206 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,239 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 166 +; Schema: 0 + OpCapability Shader + %124 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %A "A" + OpName %i "i" + OpName %a "a" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %27 = OpConstantNull %_arr_int_uint_2 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %35 = OpConstantNull %v2float + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %112 = OpConstantComposite %v2bool %false %false + %main_out = OpTypeStruct %v4float + %154 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %A = OpVariable %_ptr_Function__arr_int_uint_2 Function %27 + %i = OpVariable %_ptr_Function_int Function %30 + %a = OpVariable %_ptr_Function_int Function %30 + %v1 = OpVariable %_ptr_Function_v2float Function %35 + %v2 = OpVariable %_ptr_Function_v2float Function %35 + %b = OpVariable %_ptr_Function_int Function %30 + %41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %42 = OpLoad %int %41 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Function_int %A %42 + OpStore %46 %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %48 = OpLoad %int %47 + %50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Function_int %A %48 + OpStore %52 %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %54 = OpLoad %int %53 + OpStore %i %54 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %int %i + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %61 = OpLoad %int %60 + %62 = OpSGreaterThan %bool %59 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %56 + %64 = OpLabel + %67 = OpLoad %int %i + %68 = OpISub %int %67 %int_1 + OpStore %i %68 + OpBranch %57 + %57 = OpLabel + OpBranch %55 + %56 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %73 = OpLoad %float %72 + %74 = OpLoad %int %i + %76 = OpFOrdGreaterThanEqual %bool %71 %73 + %75 = OpSelect %int %76 %int_1 %74 + %77 = OpAccessChain %_ptr_Function_int %A %75 + %78 = OpLoad %int %77 + OpStore %a %78 + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpLoad %int %a + %82 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %89 = OpLoad %float %88 + %92 = OpFOrdLessThan %bool %87 %89 + %94 = OpCompositeConstruct %v2bool %92 %true + %95 = OpConvertSToF %float %83 + %96 = OpConvertSToF %float %85 + %97 = OpCompositeConstruct %v2float %95 %96 + %98 = OpConvertSToF %float %80 + %99 = OpConvertSToF %float %81 + %100 = OpCompositeConstruct %v2float %98 %99 + %90 = OpSelect %v2float %94 %97 %100 + OpStore %v1 %90 + %101 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %102 = OpLoad %int %101 + %104 = OpAccessChain %_ptr_Function_float %v1 %102 + %105 = OpLoad %float %104 + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Function_float %v1 %107 + %109 = OpLoad %float %108 + %113 = OpCompositeConstruct %v2float %109 %109 + %114 = OpCompositeConstruct %v2float %105 %105 + %110 = OpSelect %v2float %112 %113 %114 + OpStore %v2 %110 + %115 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %116 + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %119 = OpLoad %int %118 + %120 = OpConvertSToF %float %119 + %121 = OpLoad %v2float %v2 + %125 = OpCompositeConstruct %v2float %117 %117 + %126 = OpCompositeConstruct %v2float %120 %120 + %123 = OpExtInst %v2float %124 NClamp %125 %126 %121 + %127 = OpCompositeExtract %float %123 0 + %122 = OpConvertFToS %int %127 + %128 = OpAccessChain %_ptr_Function_int %A %122 + %129 = OpLoad %int %128 + OpStore %b %129 + %130 = OpLoad %int %b + %131 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %132 = OpLoad %int %131 + %133 = OpIEqual %bool %130 %132 + OpSelectionMerge %134 None + OpBranchConditional %133 %135 %136 + %135 = OpLabel + %137 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %138 = OpLoad %int %137 + %139 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %140 = OpLoad %int %139 + %141 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %142 = OpLoad %int %141 + %143 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %144 = OpLoad %int %143 + %145 = OpConvertSToF %float %138 + %146 = OpConvertSToF %float %140 + %147 = OpConvertSToF %float %142 + %148 = OpConvertSToF %float %144 + %149 = OpCompositeConstruct %v4float %145 %146 %147 %148 + OpStore %x_GLF_color %149 + OpBranch %134 + %136 = OpLabel + %150 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %151 = OpLoad %int %150 + %152 = OpConvertSToF %float %151 + %153 = OpCompositeConstruct %v4float %152 %152 %152 %152 + OpStore %x_GLF_color %153 + OpBranch %134 + %134 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %154 +%tint_symbol = OpFunctionParameter %main_out + %158 = OpLabel + %159 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %159 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %161 = OpLabel + %162 = OpFunctionCall %void %main_1 + %164 = OpLoad %v4float %x_GLF_color + %165 = OpCompositeConstruct %main_out %164 + %163 = OpFunctionCall %void %tint_symbol_2 %165 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..591926de33 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,95 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A : array; + var i : i32; + var a : i32; + var v1 : vec2; + var v2 : vec2; + var b : i32; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[0]; + A[x_46] = x_48; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + A[x_51] = x_53; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + i = x_56; + loop { + let x_61 : i32 = i; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_61 > x_63)) { + } else { + break; + } + let x_66 : i32 = i; + i = (x_66 - 1); + } + let x_69 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_71 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_73 : i32 = i; + let x_76 : i32 = A[select(x_73, 1, (x_69 >= x_71))]; + a = x_76; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_80 : i32 = a; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_87 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_91 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_93 : f32 = x_10.x_GLF_uniform_float_values[0]; + v1 = select(vec2(f32(x_78), f32(x_80)), vec2(f32(x_84), f32(x_87)), vec2((x_91 < x_93), true)); + let x_98 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_100 : f32 = v1[x_98]; + let x_103 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_105 : f32 = v1[x_103]; + v2 = select(vec2(x_100, x_100), vec2(x_105, x_105), vec2(false, false)); + let x_109 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_110 : f32 = f32(x_109); + let x_113 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_114 : f32 = f32(x_113); + let x_116 : vec2 = v2; + let x_121 : i32 = A[i32(clamp(vec2(x_110, x_110), vec2(x_114, x_114), x_116).x)]; + b = x_121; + let x_122 : i32 = b; + let x_124 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_122 == x_124)) { + let x_130 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_133 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_136 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_139 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_130), f32(x_133), f32(x_136), f32(x_139)); + } else { + let x_143 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_144 : f32 = f32(x_143); + x_GLF_color = vec4(x_144, x_144, x_144, x_144); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl new file mode 100644 index 0000000000..591926de33 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl @@ -0,0 +1,95 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A : array; + var i : i32; + var a : i32; + var v1 : vec2; + var v2 : vec2; + var b : i32; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[0]; + A[x_46] = x_48; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + A[x_51] = x_53; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + i = x_56; + loop { + let x_61 : i32 = i; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_61 > x_63)) { + } else { + break; + } + let x_66 : i32 = i; + i = (x_66 - 1); + } + let x_69 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_71 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_73 : i32 = i; + let x_76 : i32 = A[select(x_73, 1, (x_69 >= x_71))]; + a = x_76; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_80 : i32 = a; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_87 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_91 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_93 : f32 = x_10.x_GLF_uniform_float_values[0]; + v1 = select(vec2(f32(x_78), f32(x_80)), vec2(f32(x_84), f32(x_87)), vec2((x_91 < x_93), true)); + let x_98 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_100 : f32 = v1[x_98]; + let x_103 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_105 : f32 = v1[x_103]; + v2 = select(vec2(x_100, x_100), vec2(x_105, x_105), vec2(false, false)); + let x_109 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_110 : f32 = f32(x_109); + let x_113 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_114 : f32 = f32(x_113); + let x_116 : vec2 = v2; + let x_121 : i32 = A[i32(clamp(vec2(x_110, x_110), vec2(x_114, x_114), x_116).x)]; + b = x_121; + let x_122 : i32 = b; + let x_124 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_122 == x_124)) { + let x_130 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_133 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_136 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_139 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_130), f32(x_133), f32(x_136), f32(x_139)); + } else { + let x_143 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_144 : f32 = f32(x_143); + x_GLF_color = vec4(x_144, x_144, x_144, x_144); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..ff9156f3e5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,94 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int A[2] = (int[2])0; + int i = 0; + int a = 0; + float2 v1 = float2(0.0f, 0.0f); + float2 v2 = float2(0.0f, 0.0f); + int b = 0; + const int x_46 = asint(x_6[2].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_48 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + A[x_46] = x_48; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_51 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_53 = asint(x_6[1].x); + A[x_51] = x_53; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + i = x_56; + while (true) { + const int x_61 = i; + const int x_63 = asint(x_6[2].x); + if ((x_61 > x_63)) { + } else { + break; + } + i = (i - 1); + } + const float x_69 = asfloat(x_10[1].x); + const float x_71 = asfloat(x_10[1].x); + const int x_76 = A[((x_69 >= x_71) ? 1 : i)]; + a = x_76; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_78 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_80 = a; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_84 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_87 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const float x_91 = asfloat(x_10[1].x); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const float x_93 = asfloat(x_10[scalar_offset_6 / 4][scalar_offset_6 % 4]); + v1 = (bool2((x_91 < x_93), true) ? float2(float(x_84), float(x_87)) : float2(float(x_78), float(x_80))); + const int x_98 = asint(x_6[2].x); + const float x_100 = v1[x_98]; + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_103 = asint(x_6[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const float x_105 = v1[x_103]; + v2 = (bool2(false, false) ? float2(x_105, x_105) : float2(x_100, x_100)); + const int x_109 = asint(x_6[1].x); + const float x_110 = float(x_109); + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_113 = asint(x_6[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float x_114 = float(x_113); + const int x_121 = A[int(clamp(float2(x_110, x_110), float2(x_114, x_114), v2).x)]; + b = x_121; + const int x_122 = b; + const int x_124 = asint(x_6[1].x); + if ((x_122 == x_124)) { + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_130 = asint(x_6[scalar_offset_9 / 4][scalar_offset_9 % 4]); + const int x_133 = asint(x_6[2].x); + const int x_136 = asint(x_6[2].x); + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_139 = asint(x_6[scalar_offset_10 / 4][scalar_offset_10 % 4]); + x_GLF_color = float4(float(x_130), float(x_133), float(x_136), float(x_139)); + } else { + const int x_143 = asint(x_6[2].x); + const float x_144 = float(x_143); + x_GLF_color = float4(x_144, x_144, x_144, x_144); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..57d1bbaa65 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.msl @@ -0,0 +1,106 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_10, thread float4* const tint_symbol_4) { + tint_array_wrapper_2 A = {}; + int i = 0; + int a = 0; + float2 v1 = 0.0f; + float2 v2 = 0.0f; + int b = 0; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[0].el; + A.arr[x_46] = x_48; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + A.arr[x_51] = x_53; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[0].el; + i = x_56; + while (true) { + int const x_61 = i; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_61 > x_63)) { + } else { + break; + } + int const x_66 = i; + i = (x_66 - 1); + } + float const x_69 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_71 = x_10.x_GLF_uniform_float_values.arr[1].el; + int const x_73 = i; + int const x_76 = A.arr[select(x_73, 1, (x_69 >= x_71))]; + a = x_76; + int const x_78 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_80 = a; + int const x_84 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_87 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_91 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_93 = x_10.x_GLF_uniform_float_values.arr[0].el; + v1 = select(float2(float(x_78), float(x_80)), float2(float(x_84), float(x_87)), bool2((x_91 < x_93), true)); + int const x_98 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_100 = v1[x_98]; + int const x_103 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_105 = v1[x_103]; + v2 = select(float2(x_100, x_100), float2(x_105, x_105), bool2(false, false)); + int const x_109 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_110 = float(x_109); + int const x_113 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_114 = float(x_113); + float2 const x_116 = v2; + int const x_121 = A.arr[int(clamp(float2(x_110, x_110), float2(x_114, x_114), x_116).x)]; + b = x_121; + int const x_122 = b; + int const x_124 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_122 == x_124)) { + int const x_130 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_133 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_136 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_139 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_130), float(x_133), float(x_136), float(x_139)); + } else { + int const x_143 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_144 = float(x_143); + *(tint_symbol_4) = float4(x_144, x_144, x_144, x_144); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8b6f4d4206 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,239 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 166 +; Schema: 0 + OpCapability Shader + %124 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %A "A" + OpName %i "i" + OpName %a "a" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %27 = OpConstantNull %_arr_int_uint_2 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %35 = OpConstantNull %v2float + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %112 = OpConstantComposite %v2bool %false %false + %main_out = OpTypeStruct %v4float + %154 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %A = OpVariable %_ptr_Function__arr_int_uint_2 Function %27 + %i = OpVariable %_ptr_Function_int Function %30 + %a = OpVariable %_ptr_Function_int Function %30 + %v1 = OpVariable %_ptr_Function_v2float Function %35 + %v2 = OpVariable %_ptr_Function_v2float Function %35 + %b = OpVariable %_ptr_Function_int Function %30 + %41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %42 = OpLoad %int %41 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Function_int %A %42 + OpStore %46 %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %48 = OpLoad %int %47 + %50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Function_int %A %48 + OpStore %52 %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %54 = OpLoad %int %53 + OpStore %i %54 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %int %i + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %61 = OpLoad %int %60 + %62 = OpSGreaterThan %bool %59 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %56 + %64 = OpLabel + %67 = OpLoad %int %i + %68 = OpISub %int %67 %int_1 + OpStore %i %68 + OpBranch %57 + %57 = OpLabel + OpBranch %55 + %56 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %73 = OpLoad %float %72 + %74 = OpLoad %int %i + %76 = OpFOrdGreaterThanEqual %bool %71 %73 + %75 = OpSelect %int %76 %int_1 %74 + %77 = OpAccessChain %_ptr_Function_int %A %75 + %78 = OpLoad %int %77 + OpStore %a %78 + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpLoad %int %a + %82 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %89 = OpLoad %float %88 + %92 = OpFOrdLessThan %bool %87 %89 + %94 = OpCompositeConstruct %v2bool %92 %true + %95 = OpConvertSToF %float %83 + %96 = OpConvertSToF %float %85 + %97 = OpCompositeConstruct %v2float %95 %96 + %98 = OpConvertSToF %float %80 + %99 = OpConvertSToF %float %81 + %100 = OpCompositeConstruct %v2float %98 %99 + %90 = OpSelect %v2float %94 %97 %100 + OpStore %v1 %90 + %101 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %102 = OpLoad %int %101 + %104 = OpAccessChain %_ptr_Function_float %v1 %102 + %105 = OpLoad %float %104 + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Function_float %v1 %107 + %109 = OpLoad %float %108 + %113 = OpCompositeConstruct %v2float %109 %109 + %114 = OpCompositeConstruct %v2float %105 %105 + %110 = OpSelect %v2float %112 %113 %114 + OpStore %v2 %110 + %115 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %116 + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %119 = OpLoad %int %118 + %120 = OpConvertSToF %float %119 + %121 = OpLoad %v2float %v2 + %125 = OpCompositeConstruct %v2float %117 %117 + %126 = OpCompositeConstruct %v2float %120 %120 + %123 = OpExtInst %v2float %124 NClamp %125 %126 %121 + %127 = OpCompositeExtract %float %123 0 + %122 = OpConvertFToS %int %127 + %128 = OpAccessChain %_ptr_Function_int %A %122 + %129 = OpLoad %int %128 + OpStore %b %129 + %130 = OpLoad %int %b + %131 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %132 = OpLoad %int %131 + %133 = OpIEqual %bool %130 %132 + OpSelectionMerge %134 None + OpBranchConditional %133 %135 %136 + %135 = OpLabel + %137 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %138 = OpLoad %int %137 + %139 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %140 = OpLoad %int %139 + %141 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %142 = OpLoad %int %141 + %143 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %144 = OpLoad %int %143 + %145 = OpConvertSToF %float %138 + %146 = OpConvertSToF %float %140 + %147 = OpConvertSToF %float %142 + %148 = OpConvertSToF %float %144 + %149 = OpCompositeConstruct %v4float %145 %146 %147 %148 + OpStore %x_GLF_color %149 + OpBranch %134 + %136 = OpLabel + %150 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %151 = OpLoad %int %150 + %152 = OpConvertSToF %float %151 + %153 = OpCompositeConstruct %v4float %152 %152 %152 %152 + OpStore %x_GLF_color %153 + OpBranch %134 + %134 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %154 +%tint_symbol = OpFunctionParameter %main_out + %158 = OpLabel + %159 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %159 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %161 = OpLabel + %162 = OpFunctionCall %void %main_1 + %164 = OpLoad %v4float %x_GLF_color + %165 = OpCompositeConstruct %main_out %164 + %163 = OpFunctionCall %void %tint_symbol_2 %165 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..591926de33 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-shifts-mix-mix-clamp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,95 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A : array; + var i : i32; + var a : i32; + var v1 : vec2; + var v2 : vec2; + var b : i32; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[0]; + A[x_46] = x_48; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + A[x_51] = x_53; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + i = x_56; + loop { + let x_61 : i32 = i; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_61 > x_63)) { + } else { + break; + } + let x_66 : i32 = i; + i = (x_66 - 1); + } + let x_69 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_71 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_73 : i32 = i; + let x_76 : i32 = A[select(x_73, 1, (x_69 >= x_71))]; + a = x_76; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_80 : i32 = a; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_87 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_91 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_93 : f32 = x_10.x_GLF_uniform_float_values[0]; + v1 = select(vec2(f32(x_78), f32(x_80)), vec2(f32(x_84), f32(x_87)), vec2((x_91 < x_93), true)); + let x_98 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_100 : f32 = v1[x_98]; + let x_103 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_105 : f32 = v1[x_103]; + v2 = select(vec2(x_100, x_100), vec2(x_105, x_105), vec2(false, false)); + let x_109 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_110 : f32 = f32(x_109); + let x_113 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_114 : f32 = f32(x_113); + let x_116 : vec2 = v2; + let x_121 : i32 = A[i32(clamp(vec2(x_110, x_110), vec2(x_114, x_114), x_116).x)]; + b = x_121; + let x_122 : i32 = b; + let x_124 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_122 == x_124)) { + let x_130 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_133 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_136 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_139 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_130), f32(x_133), f32(x_136), f32(x_139)); + } else { + let x_143 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_144 : f32 = f32(x_143); + x_GLF_color = vec4(x_144, x_144, x_144, x_144); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm new file mode 100644 index 0000000000..bf2e7c3f9a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm @@ -0,0 +1,170 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %v1 "v1" + OpName %E "E" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v2float %float_1 %float_1 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float +%float_0_00999999978 = OpConstant %float 0.00999999978 + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %38 = OpLabel + %a = OpVariable %_ptr_Function_uint Function + %v1 = OpVariable %_ptr_Function_v4float Function + %E = OpVariable %_ptr_Function_float Function + %39 = OpExtInst %uint %1 PackHalf2x16 %20 + OpStore %a %39 + %40 = OpLoad %uint %a + %41 = OpExtInst %v4float %1 UnpackSnorm4x8 %40 + OpStore %v1 %41 + OpStore %E %float_0_00999999978 + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Function_float %v1 %43 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %49 = OpLoad %float %48 + %50 = OpFDiv %float %47 %49 + %51 = OpFSub %float %45 %50 + %52 = OpExtInst %float %1 FAbs %51 + %53 = OpLoad %float %E + %54 = OpFOrdLessThan %bool %52 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Function_float %v1 %58 + %60 = OpLoad %float %59 + %61 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_2 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %64 = OpLoad %float %63 + %65 = OpFDiv %float %62 %64 + %66 = OpFSub %float %60 %65 + %67 = OpExtInst %float %1 FAbs %66 + %68 = OpLoad %float %E + %69 = OpFOrdLessThan %bool %67 %68 + OpBranch %55 + %55 = OpLabel + %70 = OpPhi %bool %54 %38 %69 %56 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Function_float %v1 %74 + %76 = OpLoad %float %75 + %77 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %78 = OpLoad %float %77 + %79 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %80 = OpLoad %float %79 + %81 = OpFDiv %float %78 %80 + %82 = OpFSub %float %76 %81 + %83 = OpExtInst %float %1 FAbs %82 + %84 = OpLoad %float %E + %85 = OpFOrdLessThan %bool %83 %84 + OpBranch %71 + %71 = OpLabel + %86 = OpPhi %bool %70 %55 %85 %72 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %87 + %88 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Function_float %v1 %90 + %92 = OpLoad %float %91 + %93 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_2 + %94 = OpLoad %float %93 + %95 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %96 = OpLoad %float %95 + %97 = OpFDiv %float %94 %96 + %98 = OpFSub %float %92 %97 + %99 = OpExtInst %float %1 FAbs %98 + %100 = OpLoad %float %E + %101 = OpFOrdLessThan %bool %99 %100 + OpBranch %87 + %87 = OpLabel + %102 = OpPhi %bool %86 %71 %101 %88 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %107 = OpLoad %int %106 + %108 = OpConvertSToF %float %107 + %109 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %110 = OpLoad %int %109 + %111 = OpConvertSToF %float %110 + %112 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %113 = OpLoad %int %112 + %114 = OpConvertSToF %float %113 + %115 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %116 + %118 = OpCompositeConstruct %v4float %108 %111 %114 %117 + OpStore %_GLF_color %118 + OpBranch %103 + %105 = OpLabel + %119 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %120 = OpLoad %int %119 + %121 = OpAccessChain %_ptr_Function_float %v1 %120 + %122 = OpLoad %float %121 + %123 = OpCompositeConstruct %v4float %122 %122 %122 %122 + OpStore %_GLF_color %123 + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..43882135d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.hlsl @@ -0,0 +1,98 @@ +uint tint_pack2x16float(float2 param_0) { + uint2 i = f32tof16(param_0); + return i.x | (i.y << 16); +} + +float4 tint_unpack4x8snorm(uint param_0) { + int j = int(param_0); + int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; + return clamp(float4(i) / 127.0, -1.0, 1.0); +} + +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[4]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float E = 0.0f; + bool x_69 = false; + bool x_85 = false; + bool x_101 = false; + bool x_70_phi = false; + bool x_86_phi = false; + bool x_102_phi = false; + a = tint_pack2x16float(float2(1.0f, 1.0f)); + v1 = tint_unpack4x8snorm(a); + E = 0.01f; + const int x_43 = asint(x_8[1].x); + const float x_45 = v1[x_43]; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_10[scalar_offset / 4][scalar_offset % 4]); + const float x_49 = asfloat(x_10[1].x); + const bool x_54 = (abs((x_45 - (x_47 / x_49))) < E); + x_70_phi = x_54; + if (x_54) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_58 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_60 = v1[x_58]; + const float x_62 = asfloat(x_10[2].x); + const float x_64 = asfloat(x_10[1].x); + x_69 = (abs((x_60 - (x_62 / x_64))) < E); + x_70_phi = x_69; + } + const bool x_70 = x_70_phi; + x_86_phi = x_70; + if (x_70) { + const int x_74 = asint(x_8[2].x); + const float x_76 = v1[x_74]; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_78 = asfloat(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_80 = asfloat(x_10[1].x); + x_85 = (abs((x_76 - (x_78 / x_80))) < E); + x_86_phi = x_85; + } + const bool x_86 = x_86_phi; + x_102_phi = x_86; + if (x_86) { + const int x_90 = asint(x_8[3].x); + const float x_92 = v1[x_90]; + const float x_94 = asfloat(x_10[2].x); + const float x_96 = asfloat(x_10[1].x); + x_101 = (abs((x_92 - (x_94 / x_96))) < E); + x_102_phi = x_101; + } + if (x_102_phi) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_107 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_110 = asint(x_8[1].x); + const int x_113 = asint(x_8[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_116 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + const int x_120 = asint(x_8[1].x); + const float x_122 = v1[x_120]; + x_GLF_color = float4(x_122, x_122, x_122, x_122); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..e8a5aea792 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.msl @@ -0,0 +1,105 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_8, constant buf0& x_10, thread float4* const tint_symbol_4) { + uint a = 0u; + float4 v1 = 0.0f; + float E = 0.0f; + bool x_69 = false; + bool x_85 = false; + bool x_101 = false; + bool x_70_phi = false; + bool x_86_phi = false; + bool x_102_phi = false; + a = as_type(half2(float2(1.0f, 1.0f))); + uint const x_40 = a; + v1 = unpack_snorm4x8_to_float(x_40); + E = 0.01f; + int const x_43 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_45 = v1[x_43]; + float const x_47 = x_10.x_GLF_uniform_float_values.arr[0].el; + float const x_49 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_53 = E; + bool const x_54 = (fabs((x_45 - (x_47 / x_49))) < x_53); + x_70_phi = x_54; + if (x_54) { + int const x_58 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_60 = v1[x_58]; + float const x_62 = x_10.x_GLF_uniform_float_values.arr[2].el; + float const x_64 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_68 = E; + x_69 = (fabs((x_60 - (x_62 / x_64))) < x_68); + x_70_phi = x_69; + } + bool const x_70 = x_70_phi; + x_86_phi = x_70; + if (x_70) { + int const x_74 = x_8.x_GLF_uniform_int_values.arr[2].el; + float const x_76 = v1[x_74]; + float const x_78 = x_10.x_GLF_uniform_float_values.arr[0].el; + float const x_80 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_84 = E; + x_85 = (fabs((x_76 - (x_78 / x_80))) < x_84); + x_86_phi = x_85; + } + bool const x_86 = x_86_phi; + x_102_phi = x_86; + if (x_86) { + int const x_90 = x_8.x_GLF_uniform_int_values.arr[3].el; + float const x_92 = v1[x_90]; + float const x_94 = x_10.x_GLF_uniform_float_values.arr[2].el; + float const x_96 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_100 = E; + x_101 = (fabs((x_92 - (x_94 / x_96))) < x_100); + x_102_phi = x_101; + } + bool const x_102 = x_102_phi; + if (x_102) { + int const x_107 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_110 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_113 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_116 = x_8.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + int const x_120 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_122 = v1[x_120]; + *(tint_symbol_4) = float4(x_122, x_122, x_122, x_122); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_8 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..635a181bd1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.spvasm @@ -0,0 +1,232 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 153 +; Schema: 0 + OpCapability Shader + %42 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %v1 "v1" + OpName %E "E" + OpName %x_69 "x_69" + OpName %x_85 "x_85" + OpName %x_101 "x_101" + OpName %x_70_phi "x_70_phi" + OpName %x_86_phi "x_86_phi" + OpName %x_102_phi "x_102_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %26 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %31 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %35 = OpConstantNull %bool + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %45 = OpConstantComposite %v2float %float_1 %float_1 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %141 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %26 + %v1 = OpVariable %_ptr_Function_v4float Function %17 + %E = OpVariable %_ptr_Function_float Function %31 + %x_69 = OpVariable %_ptr_Function_bool Function %35 + %x_85 = OpVariable %_ptr_Function_bool Function %35 + %x_101 = OpVariable %_ptr_Function_bool Function %35 + %x_70_phi = OpVariable %_ptr_Function_bool Function %35 + %x_86_phi = OpVariable %_ptr_Function_bool Function %35 + %x_102_phi = OpVariable %_ptr_Function_bool Function %35 + %41 = OpExtInst %uint %42 PackHalf2x16 %45 + OpStore %a %41 + %46 = OpLoad %uint %a + %47 = OpExtInst %v4float %42 UnpackSnorm4x8 %46 + OpStore %v1 %47 + OpStore %E %float_0_00999999978 + %52 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Function_float %v1 %53 + %55 = OpLoad %float %54 + %58 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %61 = OpLoad %float %60 + %62 = OpLoad %float %E + %64 = OpFDiv %float %59 %61 + %65 = OpFSub %float %55 %64 + %63 = OpExtInst %float %42 FAbs %65 + %66 = OpFOrdLessThan %bool %63 %62 + OpStore %x_70_phi %66 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %67 + %68 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpAccessChain %_ptr_Function_float %v1 %70 + %72 = OpLoad %float %71 + %74 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_2 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %77 = OpLoad %float %76 + %78 = OpLoad %float %E + %80 = OpFDiv %float %75 %77 + %81 = OpFSub %float %72 %80 + %79 = OpExtInst %float %42 FAbs %81 + %82 = OpFOrdLessThan %bool %79 %78 + OpStore %x_69 %82 + %83 = OpLoad %bool %x_69 + OpStore %x_70_phi %83 + OpBranch %67 + %67 = OpLabel + %84 = OpLoad %bool %x_70_phi + OpStore %x_86_phi %84 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Function_float %v1 %88 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %92 = OpLoad %float %91 + %93 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %94 = OpLoad %float %93 + %95 = OpLoad %float %E + %97 = OpFDiv %float %92 %94 + %98 = OpFSub %float %90 %97 + %96 = OpExtInst %float %42 FAbs %98 + %99 = OpFOrdLessThan %bool %96 %95 + OpStore %x_85 %99 + %100 = OpLoad %bool %x_85 + OpStore %x_86_phi %100 + OpBranch %85 + %85 = OpLabel + %101 = OpLoad %bool %x_86_phi + OpStore %x_102_phi %101 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + %105 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %106 = OpLoad %int %105 + %107 = OpAccessChain %_ptr_Function_float %v1 %106 + %108 = OpLoad %float %107 + %109 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_2 + %110 = OpLoad %float %109 + %111 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %112 = OpLoad %float %111 + %113 = OpLoad %float %E + %115 = OpFDiv %float %110 %112 + %116 = OpFSub %float %108 %115 + %114 = OpExtInst %float %42 FAbs %116 + %117 = OpFOrdLessThan %bool %114 %113 + OpStore %x_101 %117 + %118 = OpLoad %bool %x_101 + OpStore %x_102_phi %118 + OpBranch %102 + %102 = OpLabel + %119 = OpLoad %bool %x_102_phi + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %124 = OpLoad %int %123 + %125 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %126 = OpLoad %int %125 + %127 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %130 = OpLoad %int %129 + %131 = OpConvertSToF %float %124 + %132 = OpConvertSToF %float %126 + %133 = OpConvertSToF %float %128 + %134 = OpConvertSToF %float %130 + %135 = OpCompositeConstruct %v4float %131 %132 %133 %134 + OpStore %x_GLF_color %135 + OpBranch %120 + %122 = OpLabel + %136 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %137 = OpLoad %int %136 + %138 = OpAccessChain %_ptr_Function_float %v1 %137 + %139 = OpLoad %float %138 + %140 = OpCompositeConstruct %v4float %139 %139 %139 %139 + OpStore %x_GLF_color %140 + OpBranch %120 + %120 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %141 +%tint_symbol = OpFunctionParameter %main_out + %145 = OpLabel + %146 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %146 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %148 = OpLabel + %149 = OpFunctionCall %void %main_1 + %151 = OpLoad %v4float %x_GLF_color + %152 = OpCompositeConstruct %main_out %151 + %150 = OpFunctionCall %void %tint_symbol_2 %152 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c893e134c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.spvasm.expected.wgsl @@ -0,0 +1,97 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var v1 : vec4; + var E : f32; + var x_69 : bool; + var x_85 : bool; + var x_101 : bool; + var x_70_phi : bool; + var x_86_phi : bool; + var x_102_phi : bool; + a = pack2x16float(vec2(1.0, 1.0)); + let x_40 : u32 = a; + v1 = unpack4x8snorm(x_40); + E = 0.01; + let x_43 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_45 : f32 = v1[x_43]; + let x_47 : f32 = x_10.x_GLF_uniform_float_values[0]; + let x_49 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_53 : f32 = E; + let x_54 : bool = (abs((x_45 - (x_47 / x_49))) < x_53); + x_70_phi = x_54; + if (x_54) { + let x_58 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_60 : f32 = v1[x_58]; + let x_62 : f32 = x_10.x_GLF_uniform_float_values[2]; + let x_64 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_68 : f32 = E; + x_69 = (abs((x_60 - (x_62 / x_64))) < x_68); + x_70_phi = x_69; + } + let x_70 : bool = x_70_phi; + x_86_phi = x_70; + if (x_70) { + let x_74 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_76 : f32 = v1[x_74]; + let x_78 : f32 = x_10.x_GLF_uniform_float_values[0]; + let x_80 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_84 : f32 = E; + x_85 = (abs((x_76 - (x_78 / x_80))) < x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_102_phi = x_86; + if (x_86) { + let x_90 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_92 : f32 = v1[x_90]; + let x_94 : f32 = x_10.x_GLF_uniform_float_values[2]; + let x_96 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_100 : f32 = E; + x_101 = (abs((x_92 - (x_94 / x_96))) < x_100); + x_102_phi = x_101; + } + let x_102 : bool = x_102_phi; + if (x_102) { + let x_107 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_110 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_113 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_116 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } else { + let x_120 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_122 : f32 = v1[x_120]; + x_GLF_color = vec4(x_122, x_122, x_122, x_122); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl new file mode 100644 index 0000000000..c893e134c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl @@ -0,0 +1,97 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var v1 : vec4; + var E : f32; + var x_69 : bool; + var x_85 : bool; + var x_101 : bool; + var x_70_phi : bool; + var x_86_phi : bool; + var x_102_phi : bool; + a = pack2x16float(vec2(1.0, 1.0)); + let x_40 : u32 = a; + v1 = unpack4x8snorm(x_40); + E = 0.01; + let x_43 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_45 : f32 = v1[x_43]; + let x_47 : f32 = x_10.x_GLF_uniform_float_values[0]; + let x_49 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_53 : f32 = E; + let x_54 : bool = (abs((x_45 - (x_47 / x_49))) < x_53); + x_70_phi = x_54; + if (x_54) { + let x_58 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_60 : f32 = v1[x_58]; + let x_62 : f32 = x_10.x_GLF_uniform_float_values[2]; + let x_64 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_68 : f32 = E; + x_69 = (abs((x_60 - (x_62 / x_64))) < x_68); + x_70_phi = x_69; + } + let x_70 : bool = x_70_phi; + x_86_phi = x_70; + if (x_70) { + let x_74 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_76 : f32 = v1[x_74]; + let x_78 : f32 = x_10.x_GLF_uniform_float_values[0]; + let x_80 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_84 : f32 = E; + x_85 = (abs((x_76 - (x_78 / x_80))) < x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_102_phi = x_86; + if (x_86) { + let x_90 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_92 : f32 = v1[x_90]; + let x_94 : f32 = x_10.x_GLF_uniform_float_values[2]; + let x_96 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_100 : f32 = E; + x_101 = (abs((x_92 - (x_94 / x_96))) < x_100); + x_102_phi = x_101; + } + let x_102 : bool = x_102_phi; + if (x_102) { + let x_107 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_110 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_113 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_116 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } else { + let x_120 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_122 : f32 = v1[x_120]; + x_GLF_color = vec4(x_122, x_122, x_122, x_122); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..43882135d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.hlsl @@ -0,0 +1,98 @@ +uint tint_pack2x16float(float2 param_0) { + uint2 i = f32tof16(param_0); + return i.x | (i.y << 16); +} + +float4 tint_unpack4x8snorm(uint param_0) { + int j = int(param_0); + int4 i = int4(j << 24, j << 16, j << 8, j) >> 24; + return clamp(float4(i) / 127.0, -1.0, 1.0); +} + +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[4]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float E = 0.0f; + bool x_69 = false; + bool x_85 = false; + bool x_101 = false; + bool x_70_phi = false; + bool x_86_phi = false; + bool x_102_phi = false; + a = tint_pack2x16float(float2(1.0f, 1.0f)); + v1 = tint_unpack4x8snorm(a); + E = 0.01f; + const int x_43 = asint(x_8[1].x); + const float x_45 = v1[x_43]; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_10[scalar_offset / 4][scalar_offset % 4]); + const float x_49 = asfloat(x_10[1].x); + const bool x_54 = (abs((x_45 - (x_47 / x_49))) < E); + x_70_phi = x_54; + if (x_54) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_58 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_60 = v1[x_58]; + const float x_62 = asfloat(x_10[2].x); + const float x_64 = asfloat(x_10[1].x); + x_69 = (abs((x_60 - (x_62 / x_64))) < E); + x_70_phi = x_69; + } + const bool x_70 = x_70_phi; + x_86_phi = x_70; + if (x_70) { + const int x_74 = asint(x_8[2].x); + const float x_76 = v1[x_74]; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_78 = asfloat(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_80 = asfloat(x_10[1].x); + x_85 = (abs((x_76 - (x_78 / x_80))) < E); + x_86_phi = x_85; + } + const bool x_86 = x_86_phi; + x_102_phi = x_86; + if (x_86) { + const int x_90 = asint(x_8[3].x); + const float x_92 = v1[x_90]; + const float x_94 = asfloat(x_10[2].x); + const float x_96 = asfloat(x_10[1].x); + x_101 = (abs((x_92 - (x_94 / x_96))) < E); + x_102_phi = x_101; + } + if (x_102_phi) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_107 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_110 = asint(x_8[1].x); + const int x_113 = asint(x_8[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_116 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + const int x_120 = asint(x_8[1].x); + const float x_122 = v1[x_120]; + x_GLF_color = float4(x_122, x_122, x_122, x_122); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..e8a5aea792 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.msl @@ -0,0 +1,105 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_8, constant buf0& x_10, thread float4* const tint_symbol_4) { + uint a = 0u; + float4 v1 = 0.0f; + float E = 0.0f; + bool x_69 = false; + bool x_85 = false; + bool x_101 = false; + bool x_70_phi = false; + bool x_86_phi = false; + bool x_102_phi = false; + a = as_type(half2(float2(1.0f, 1.0f))); + uint const x_40 = a; + v1 = unpack_snorm4x8_to_float(x_40); + E = 0.01f; + int const x_43 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_45 = v1[x_43]; + float const x_47 = x_10.x_GLF_uniform_float_values.arr[0].el; + float const x_49 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_53 = E; + bool const x_54 = (fabs((x_45 - (x_47 / x_49))) < x_53); + x_70_phi = x_54; + if (x_54) { + int const x_58 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_60 = v1[x_58]; + float const x_62 = x_10.x_GLF_uniform_float_values.arr[2].el; + float const x_64 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_68 = E; + x_69 = (fabs((x_60 - (x_62 / x_64))) < x_68); + x_70_phi = x_69; + } + bool const x_70 = x_70_phi; + x_86_phi = x_70; + if (x_70) { + int const x_74 = x_8.x_GLF_uniform_int_values.arr[2].el; + float const x_76 = v1[x_74]; + float const x_78 = x_10.x_GLF_uniform_float_values.arr[0].el; + float const x_80 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_84 = E; + x_85 = (fabs((x_76 - (x_78 / x_80))) < x_84); + x_86_phi = x_85; + } + bool const x_86 = x_86_phi; + x_102_phi = x_86; + if (x_86) { + int const x_90 = x_8.x_GLF_uniform_int_values.arr[3].el; + float const x_92 = v1[x_90]; + float const x_94 = x_10.x_GLF_uniform_float_values.arr[2].el; + float const x_96 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_100 = E; + x_101 = (fabs((x_92 - (x_94 / x_96))) < x_100); + x_102_phi = x_101; + } + bool const x_102 = x_102_phi; + if (x_102) { + int const x_107 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_110 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_113 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_116 = x_8.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + int const x_120 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_122 = v1[x_120]; + *(tint_symbol_4) = float4(x_122, x_122, x_122, x_122); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_8 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..635a181bd1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.spvasm @@ -0,0 +1,232 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 153 +; Schema: 0 + OpCapability Shader + %42 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %v1 "v1" + OpName %E "E" + OpName %x_69 "x_69" + OpName %x_85 "x_85" + OpName %x_101 "x_101" + OpName %x_70_phi "x_70_phi" + OpName %x_86_phi "x_86_phi" + OpName %x_102_phi "x_102_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %26 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %31 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %35 = OpConstantNull %bool + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %45 = OpConstantComposite %v2float %float_1 %float_1 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %141 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %26 + %v1 = OpVariable %_ptr_Function_v4float Function %17 + %E = OpVariable %_ptr_Function_float Function %31 + %x_69 = OpVariable %_ptr_Function_bool Function %35 + %x_85 = OpVariable %_ptr_Function_bool Function %35 + %x_101 = OpVariable %_ptr_Function_bool Function %35 + %x_70_phi = OpVariable %_ptr_Function_bool Function %35 + %x_86_phi = OpVariable %_ptr_Function_bool Function %35 + %x_102_phi = OpVariable %_ptr_Function_bool Function %35 + %41 = OpExtInst %uint %42 PackHalf2x16 %45 + OpStore %a %41 + %46 = OpLoad %uint %a + %47 = OpExtInst %v4float %42 UnpackSnorm4x8 %46 + OpStore %v1 %47 + OpStore %E %float_0_00999999978 + %52 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Function_float %v1 %53 + %55 = OpLoad %float %54 + %58 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %61 = OpLoad %float %60 + %62 = OpLoad %float %E + %64 = OpFDiv %float %59 %61 + %65 = OpFSub %float %55 %64 + %63 = OpExtInst %float %42 FAbs %65 + %66 = OpFOrdLessThan %bool %63 %62 + OpStore %x_70_phi %66 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %67 + %68 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpAccessChain %_ptr_Function_float %v1 %70 + %72 = OpLoad %float %71 + %74 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_2 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %77 = OpLoad %float %76 + %78 = OpLoad %float %E + %80 = OpFDiv %float %75 %77 + %81 = OpFSub %float %72 %80 + %79 = OpExtInst %float %42 FAbs %81 + %82 = OpFOrdLessThan %bool %79 %78 + OpStore %x_69 %82 + %83 = OpLoad %bool %x_69 + OpStore %x_70_phi %83 + OpBranch %67 + %67 = OpLabel + %84 = OpLoad %bool %x_70_phi + OpStore %x_86_phi %84 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Function_float %v1 %88 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %92 = OpLoad %float %91 + %93 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %94 = OpLoad %float %93 + %95 = OpLoad %float %E + %97 = OpFDiv %float %92 %94 + %98 = OpFSub %float %90 %97 + %96 = OpExtInst %float %42 FAbs %98 + %99 = OpFOrdLessThan %bool %96 %95 + OpStore %x_85 %99 + %100 = OpLoad %bool %x_85 + OpStore %x_86_phi %100 + OpBranch %85 + %85 = OpLabel + %101 = OpLoad %bool %x_86_phi + OpStore %x_102_phi %101 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + %105 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %106 = OpLoad %int %105 + %107 = OpAccessChain %_ptr_Function_float %v1 %106 + %108 = OpLoad %float %107 + %109 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_2 + %110 = OpLoad %float %109 + %111 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %112 = OpLoad %float %111 + %113 = OpLoad %float %E + %115 = OpFDiv %float %110 %112 + %116 = OpFSub %float %108 %115 + %114 = OpExtInst %float %42 FAbs %116 + %117 = OpFOrdLessThan %bool %114 %113 + OpStore %x_101 %117 + %118 = OpLoad %bool %x_101 + OpStore %x_102_phi %118 + OpBranch %102 + %102 = OpLabel + %119 = OpLoad %bool %x_102_phi + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %124 = OpLoad %int %123 + %125 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %126 = OpLoad %int %125 + %127 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %130 = OpLoad %int %129 + %131 = OpConvertSToF %float %124 + %132 = OpConvertSToF %float %126 + %133 = OpConvertSToF %float %128 + %134 = OpConvertSToF %float %130 + %135 = OpCompositeConstruct %v4float %131 %132 %133 %134 + OpStore %x_GLF_color %135 + OpBranch %120 + %122 = OpLabel + %136 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %137 = OpLoad %int %136 + %138 = OpAccessChain %_ptr_Function_float %v1 %137 + %139 = OpLoad %float %138 + %140 = OpCompositeConstruct %v4float %139 %139 %139 %139 + OpStore %x_GLF_color %140 + OpBranch %120 + %120 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %141 +%tint_symbol = OpFunctionParameter %main_out + %145 = OpLabel + %146 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %146 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %148 = OpLabel + %149 = OpFunctionCall %void %main_1 + %151 = OpLoad %v4float %x_GLF_color + %152 = OpCompositeConstruct %main_out %151 + %150 = OpFunctionCall %void %tint_symbol_2 %152 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c893e134c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-pack-unpack/0-opt.wgsl.expected.wgsl @@ -0,0 +1,97 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var v1 : vec4; + var E : f32; + var x_69 : bool; + var x_85 : bool; + var x_101 : bool; + var x_70_phi : bool; + var x_86_phi : bool; + var x_102_phi : bool; + a = pack2x16float(vec2(1.0, 1.0)); + let x_40 : u32 = a; + v1 = unpack4x8snorm(x_40); + E = 0.01; + let x_43 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_45 : f32 = v1[x_43]; + let x_47 : f32 = x_10.x_GLF_uniform_float_values[0]; + let x_49 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_53 : f32 = E; + let x_54 : bool = (abs((x_45 - (x_47 / x_49))) < x_53); + x_70_phi = x_54; + if (x_54) { + let x_58 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_60 : f32 = v1[x_58]; + let x_62 : f32 = x_10.x_GLF_uniform_float_values[2]; + let x_64 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_68 : f32 = E; + x_69 = (abs((x_60 - (x_62 / x_64))) < x_68); + x_70_phi = x_69; + } + let x_70 : bool = x_70_phi; + x_86_phi = x_70; + if (x_70) { + let x_74 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_76 : f32 = v1[x_74]; + let x_78 : f32 = x_10.x_GLF_uniform_float_values[0]; + let x_80 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_84 : f32 = E; + x_85 = (abs((x_76 - (x_78 / x_80))) < x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_102_phi = x_86; + if (x_86) { + let x_90 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_92 : f32 = v1[x_90]; + let x_94 : f32 = x_10.x_GLF_uniform_float_values[2]; + let x_96 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_100 : f32 = E; + x_101 = (abs((x_92 - (x_94 / x_96))) < x_100); + x_102_phi = x_101; + } + let x_102 : bool = x_102_phi; + if (x_102) { + let x_107 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_110 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_113 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_116 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } else { + let x_120 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_122 : f32 = v1[x_120]; + x_GLF_color = vec4(x_122, x_122, x_122, x_122); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm new file mode 100644 index 0000000000..476c935df1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm @@ -0,0 +1,169 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %v1 "v1" + OpName %E "E" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float = OpTypeFloat 32 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %33 = OpLabel + %a = OpVariable %_ptr_Function_uint Function + %v1 = OpVariable %_ptr_Function_v4float Function + %E = OpVariable %_ptr_Function_float Function + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %35 = OpLoad %float %34 + %36 = OpCompositeConstruct %v4float %35 %35 %35 %35 + %37 = OpExtInst %uint %1 PackSnorm4x8 %36 + OpStore %a %37 + %38 = OpLoad %uint %a + %39 = OpExtInst %v4float %1 UnpackUnorm4x8 %38 + OpStore %v1 %39 + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %41 = OpLoad %float %40 + OpStore %E %41 + %42 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Function_float %v1 %43 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %47 = OpLoad %float %46 + %48 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %49 = OpLoad %float %48 + %50 = OpFDiv %float %47 %49 + %51 = OpFSub %float %45 %50 + %52 = OpExtInst %float %1 FAbs %51 + %53 = OpLoad %float %E + %54 = OpFOrdLessThan %bool %52 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Function_float %v1 %58 + %60 = OpLoad %float %59 + %61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %64 = OpLoad %float %63 + %65 = OpFDiv %float %62 %64 + %66 = OpFSub %float %60 %65 + %67 = OpExtInst %float %1 FAbs %66 + %68 = OpLoad %float %E + %69 = OpFOrdLessThan %bool %67 %68 + OpBranch %55 + %55 = OpLabel + %70 = OpPhi %bool %54 %33 %69 %56 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Function_float %v1 %74 + %76 = OpLoad %float %75 + %77 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %78 = OpLoad %float %77 + %79 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %80 = OpLoad %float %79 + %81 = OpFDiv %float %78 %80 + %82 = OpFSub %float %76 %81 + %83 = OpExtInst %float %1 FAbs %82 + %84 = OpLoad %float %E + %85 = OpFOrdLessThan %bool %83 %84 + OpBranch %71 + %71 = OpLabel + %86 = OpPhi %bool %70 %55 %85 %72 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %87 + %88 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Function_float %v1 %90 + %92 = OpLoad %float %91 + %93 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %94 = OpLoad %float %93 + %95 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %96 = OpLoad %float %95 + %97 = OpFDiv %float %94 %96 + %98 = OpFSub %float %92 %97 + %99 = OpExtInst %float %1 FAbs %98 + %100 = OpLoad %float %E + %101 = OpFOrdLessThan %bool %99 %100 + OpBranch %87 + %87 = OpLabel + %102 = OpPhi %bool %86 %71 %101 %88 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %107 = OpLoad %int %106 + %108 = OpConvertSToF %float %107 + %109 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %110 = OpLoad %int %109 + %111 = OpConvertSToF %float %110 + %112 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %113 = OpLoad %int %112 + %114 = OpConvertSToF %float %113 + %115 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %116 + %118 = OpCompositeConstruct %v4float %108 %111 %114 %117 + OpStore %_GLF_color %118 + OpBranch %103 + %105 = OpLabel + %119 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %120 = OpLoad %int %119 + %121 = OpConvertSToF %float %120 + %122 = OpCompositeConstruct %v4float %121 %121 %121 %121 + OpStore %_GLF_color %122 + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3019c2bfa1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.hlsl @@ -0,0 +1,99 @@ +uint tint_pack4x8snorm(float4 param_0) { + int4 i = int4(round(clamp(param_0, -1.0, 1.0) * 127.0)) & 0xff; + return asuint(i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +float4 tint_unpack4x8unorm(uint param_0) { + uint j = param_0; + uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); + return float4(i) / 255.0; +} + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float E = 0.0f; + bool x_69 = false; + bool x_85 = false; + bool x_101 = false; + bool x_70_phi = false; + bool x_86_phi = false; + bool x_102_phi = false; + const float x_35 = asfloat(x_6[1].x); + a = tint_pack4x8snorm(float4(x_35, x_35, x_35, x_35)); + v1 = tint_unpack4x8unorm(a); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + E = x_41; + const int x_43 = asint(x_10[1].x); + const float x_45 = v1[x_43]; + const float x_47 = asfloat(x_6[2].x); + const float x_49 = asfloat(x_6[3].x); + const bool x_54 = (abs((x_45 - (x_47 / x_49))) < E); + x_70_phi = x_54; + if (x_54) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_58 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_60 = v1[x_58]; + const float x_62 = asfloat(x_6[2].x); + const float x_64 = asfloat(x_6[3].x); + x_69 = (abs((x_60 - (x_62 / x_64))) < E); + x_70_phi = x_69; + } + const bool x_70 = x_70_phi; + x_86_phi = x_70; + if (x_70) { + const int x_74 = asint(x_10[3].x); + const float x_76 = v1[x_74]; + const float x_78 = asfloat(x_6[2].x); + const float x_80 = asfloat(x_6[3].x); + x_85 = (abs((x_76 - (x_78 / x_80))) < E); + x_86_phi = x_85; + } + const bool x_86 = x_86_phi; + x_102_phi = x_86; + if (x_86) { + const int x_90 = asint(x_10[2].x); + const float x_92 = v1[x_90]; + const float x_94 = asfloat(x_6[2].x); + const float x_96 = asfloat(x_6[3].x); + x_101 = (abs((x_92 - (x_94 / x_96))) < E); + x_102_phi = x_101; + } + if (x_102_phi) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_107 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_110 = asint(x_10[1].x); + const int x_113 = asint(x_10[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_116 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + const int x_120 = asint(x_10[1].x); + const float x_121 = float(x_120); + x_GLF_color = float4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f9c669bf98 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.msl @@ -0,0 +1,107 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_10, thread float4* const tint_symbol_4) { + uint a = 0u; + float4 v1 = 0.0f; + float E = 0.0f; + bool x_69 = false; + bool x_85 = false; + bool x_101 = false; + bool x_70_phi = false; + bool x_86_phi = false; + bool x_102_phi = false; + float const x_35 = x_6.x_GLF_uniform_float_values.arr[1].el; + a = pack_float_to_snorm4x8(float4(x_35, x_35, x_35, x_35)); + uint const x_38 = a; + v1 = unpack_unorm4x8_to_float(x_38); + float const x_41 = x_6.x_GLF_uniform_float_values.arr[0].el; + E = x_41; + int const x_43 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_45 = v1[x_43]; + float const x_47 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_49 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_53 = E; + bool const x_54 = (fabs((x_45 - (x_47 / x_49))) < x_53); + x_70_phi = x_54; + if (x_54) { + int const x_58 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_60 = v1[x_58]; + float const x_62 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_64 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_68 = E; + x_69 = (fabs((x_60 - (x_62 / x_64))) < x_68); + x_70_phi = x_69; + } + bool const x_70 = x_70_phi; + x_86_phi = x_70; + if (x_70) { + int const x_74 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_76 = v1[x_74]; + float const x_78 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_80 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_84 = E; + x_85 = (fabs((x_76 - (x_78 / x_80))) < x_84); + x_86_phi = x_85; + } + bool const x_86 = x_86_phi; + x_102_phi = x_86; + if (x_86) { + int const x_90 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_92 = v1[x_90]; + float const x_94 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_96 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_100 = E; + x_101 = (fabs((x_92 - (x_94 / x_96))) < x_100); + x_102_phi = x_101; + } + bool const x_102 = x_102_phi; + if (x_102) { + int const x_107 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_110 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_113 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_116 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + int const x_120 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_121 = float(x_120); + *(tint_symbol_4) = float4(x_121, x_121, x_121, x_121); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..84dd174699 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.spvasm @@ -0,0 +1,231 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 152 +; Schema: 0 + OpCapability Shader + %46 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %v1 "v1" + OpName %E "E" + OpName %x_69 "x_69" + OpName %x_85 "x_85" + OpName %x_101 "x_101" + OpName %x_70_phi "x_70_phi" + OpName %x_86_phi "x_86_phi" + OpName %x_102_phi "x_102_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %25 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %30 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %34 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %140 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %25 + %v1 = OpVariable %_ptr_Function_v4float Function %16 + %E = OpVariable %_ptr_Function_float Function %30 + %x_69 = OpVariable %_ptr_Function_bool Function %34 + %x_85 = OpVariable %_ptr_Function_bool Function %34 + %x_101 = OpVariable %_ptr_Function_bool Function %34 + %x_70_phi = OpVariable %_ptr_Function_bool Function %34 + %x_86_phi = OpVariable %_ptr_Function_bool Function %34 + %x_102_phi = OpVariable %_ptr_Function_bool Function %34 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %44 = OpLoad %float %43 + %47 = OpCompositeConstruct %v4float %44 %44 %44 %44 + %45 = OpExtInst %uint %46 PackSnorm4x8 %47 + OpStore %a %45 + %48 = OpLoad %uint %a + %49 = OpExtInst %v4float %46 UnpackUnorm4x8 %48 + OpStore %v1 %49 + %51 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %52 = OpLoad %float %51 + OpStore %E %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Function_float %v1 %55 + %57 = OpLoad %float %56 + %59 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %60 = OpLoad %float %59 + %62 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %63 = OpLoad %float %62 + %64 = OpLoad %float %E + %66 = OpFDiv %float %60 %63 + %67 = OpFSub %float %57 %66 + %65 = OpExtInst %float %46 FAbs %67 + %68 = OpFOrdLessThan %bool %65 %64 + OpStore %x_70_phi %68 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Function_float %v1 %72 + %74 = OpLoad %float %73 + %75 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %76 = OpLoad %float %75 + %77 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %78 = OpLoad %float %77 + %79 = OpLoad %float %E + %81 = OpFDiv %float %76 %78 + %82 = OpFSub %float %74 %81 + %80 = OpExtInst %float %46 FAbs %82 + %83 = OpFOrdLessThan %bool %80 %79 + OpStore %x_69 %83 + %84 = OpLoad %bool %x_69 + OpStore %x_70_phi %84 + OpBranch %69 + %69 = OpLabel + %85 = OpLoad %bool %x_70_phi + OpStore %x_86_phi %85 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Function_float %v1 %89 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %93 = OpLoad %float %92 + %94 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %95 = OpLoad %float %94 + %96 = OpLoad %float %E + %98 = OpFDiv %float %93 %95 + %99 = OpFSub %float %91 %98 + %97 = OpExtInst %float %46 FAbs %99 + %100 = OpFOrdLessThan %bool %97 %96 + OpStore %x_85 %100 + %101 = OpLoad %bool %x_85 + OpStore %x_86_phi %101 + OpBranch %86 + %86 = OpLabel + %102 = OpLoad %bool %x_86_phi + OpStore %x_102_phi %102 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %103 + %104 = OpLabel + %105 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %106 = OpLoad %int %105 + %107 = OpAccessChain %_ptr_Function_float %v1 %106 + %108 = OpLoad %float %107 + %109 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %110 = OpLoad %float %109 + %111 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %112 = OpLoad %float %111 + %113 = OpLoad %float %E + %115 = OpFDiv %float %110 %112 + %116 = OpFSub %float %108 %115 + %114 = OpExtInst %float %46 FAbs %116 + %117 = OpFOrdLessThan %bool %114 %113 + OpStore %x_101 %117 + %118 = OpLoad %bool %x_101 + OpStore %x_102_phi %118 + OpBranch %103 + %103 = OpLabel + %119 = OpLoad %bool %x_102_phi + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %124 = OpLoad %int %123 + %125 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %126 = OpLoad %int %125 + %127 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %130 = OpLoad %int %129 + %131 = OpConvertSToF %float %124 + %132 = OpConvertSToF %float %126 + %133 = OpConvertSToF %float %128 + %134 = OpConvertSToF %float %130 + %135 = OpCompositeConstruct %v4float %131 %132 %133 %134 + OpStore %x_GLF_color %135 + OpBranch %120 + %122 = OpLabel + %136 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %137 = OpLoad %int %136 + %138 = OpConvertSToF %float %137 + %139 = OpCompositeConstruct %v4float %138 %138 %138 %138 + OpStore %x_GLF_color %139 + OpBranch %120 + %120 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %140 +%tint_symbol = OpFunctionParameter %main_out + %144 = OpLabel + %145 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %145 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %147 = OpLabel + %148 = OpFunctionCall %void %main_1 + %150 = OpLoad %v4float %x_GLF_color + %151 = OpCompositeConstruct %main_out %150 + %149 = OpFunctionCall %void %tint_symbol_2 %151 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ebc56378de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.spvasm.expected.wgsl @@ -0,0 +1,99 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var v1 : vec4; + var E : f32; + var x_69 : bool; + var x_85 : bool; + var x_101 : bool; + var x_70_phi : bool; + var x_86_phi : bool; + var x_102_phi : bool; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = pack4x8snorm(vec4(x_35, x_35, x_35, x_35)); + let x_38 : u32 = a; + v1 = unpack4x8unorm(x_38); + let x_41 : f32 = x_6.x_GLF_uniform_float_values[0]; + E = x_41; + let x_43 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_45 : f32 = v1[x_43]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_49 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_53 : f32 = E; + let x_54 : bool = (abs((x_45 - (x_47 / x_49))) < x_53); + x_70_phi = x_54; + if (x_54) { + let x_58 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_60 : f32 = v1[x_58]; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_64 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_68 : f32 = E; + x_69 = (abs((x_60 - (x_62 / x_64))) < x_68); + x_70_phi = x_69; + } + let x_70 : bool = x_70_phi; + x_86_phi = x_70; + if (x_70) { + let x_74 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_76 : f32 = v1[x_74]; + let x_78 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_80 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_84 : f32 = E; + x_85 = (abs((x_76 - (x_78 / x_80))) < x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_102_phi = x_86; + if (x_86) { + let x_90 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_92 : f32 = v1[x_90]; + let x_94 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_96 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_100 : f32 = E; + x_101 = (abs((x_92 - (x_94 / x_96))) < x_100); + x_102_phi = x_101; + } + let x_102 : bool = x_102_phi; + if (x_102) { + let x_107 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_110 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_113 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_116 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } else { + let x_120 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_121 : f32 = f32(x_120); + x_GLF_color = vec4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl new file mode 100644 index 0000000000..ebc56378de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl @@ -0,0 +1,99 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var v1 : vec4; + var E : f32; + var x_69 : bool; + var x_85 : bool; + var x_101 : bool; + var x_70_phi : bool; + var x_86_phi : bool; + var x_102_phi : bool; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = pack4x8snorm(vec4(x_35, x_35, x_35, x_35)); + let x_38 : u32 = a; + v1 = unpack4x8unorm(x_38); + let x_41 : f32 = x_6.x_GLF_uniform_float_values[0]; + E = x_41; + let x_43 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_45 : f32 = v1[x_43]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_49 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_53 : f32 = E; + let x_54 : bool = (abs((x_45 - (x_47 / x_49))) < x_53); + x_70_phi = x_54; + if (x_54) { + let x_58 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_60 : f32 = v1[x_58]; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_64 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_68 : f32 = E; + x_69 = (abs((x_60 - (x_62 / x_64))) < x_68); + x_70_phi = x_69; + } + let x_70 : bool = x_70_phi; + x_86_phi = x_70; + if (x_70) { + let x_74 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_76 : f32 = v1[x_74]; + let x_78 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_80 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_84 : f32 = E; + x_85 = (abs((x_76 - (x_78 / x_80))) < x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_102_phi = x_86; + if (x_86) { + let x_90 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_92 : f32 = v1[x_90]; + let x_94 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_96 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_100 : f32 = E; + x_101 = (abs((x_92 - (x_94 / x_96))) < x_100); + x_102_phi = x_101; + } + let x_102 : bool = x_102_phi; + if (x_102) { + let x_107 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_110 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_113 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_116 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } else { + let x_120 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_121 : f32 = f32(x_120); + x_GLF_color = vec4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3019c2bfa1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.hlsl @@ -0,0 +1,99 @@ +uint tint_pack4x8snorm(float4 param_0) { + int4 i = int4(round(clamp(param_0, -1.0, 1.0) * 127.0)) & 0xff; + return asuint(i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +float4 tint_unpack4x8unorm(uint param_0) { + uint j = param_0; + uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); + return float4(i) / 255.0; +} + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float E = 0.0f; + bool x_69 = false; + bool x_85 = false; + bool x_101 = false; + bool x_70_phi = false; + bool x_86_phi = false; + bool x_102_phi = false; + const float x_35 = asfloat(x_6[1].x); + a = tint_pack4x8snorm(float4(x_35, x_35, x_35, x_35)); + v1 = tint_unpack4x8unorm(a); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + E = x_41; + const int x_43 = asint(x_10[1].x); + const float x_45 = v1[x_43]; + const float x_47 = asfloat(x_6[2].x); + const float x_49 = asfloat(x_6[3].x); + const bool x_54 = (abs((x_45 - (x_47 / x_49))) < E); + x_70_phi = x_54; + if (x_54) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_58 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_60 = v1[x_58]; + const float x_62 = asfloat(x_6[2].x); + const float x_64 = asfloat(x_6[3].x); + x_69 = (abs((x_60 - (x_62 / x_64))) < E); + x_70_phi = x_69; + } + const bool x_70 = x_70_phi; + x_86_phi = x_70; + if (x_70) { + const int x_74 = asint(x_10[3].x); + const float x_76 = v1[x_74]; + const float x_78 = asfloat(x_6[2].x); + const float x_80 = asfloat(x_6[3].x); + x_85 = (abs((x_76 - (x_78 / x_80))) < E); + x_86_phi = x_85; + } + const bool x_86 = x_86_phi; + x_102_phi = x_86; + if (x_86) { + const int x_90 = asint(x_10[2].x); + const float x_92 = v1[x_90]; + const float x_94 = asfloat(x_6[2].x); + const float x_96 = asfloat(x_6[3].x); + x_101 = (abs((x_92 - (x_94 / x_96))) < E); + x_102_phi = x_101; + } + if (x_102_phi) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_107 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_110 = asint(x_10[1].x); + const int x_113 = asint(x_10[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_116 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + const int x_120 = asint(x_10[1].x); + const float x_121 = float(x_120); + x_GLF_color = float4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f9c669bf98 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.msl @@ -0,0 +1,107 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_10, thread float4* const tint_symbol_4) { + uint a = 0u; + float4 v1 = 0.0f; + float E = 0.0f; + bool x_69 = false; + bool x_85 = false; + bool x_101 = false; + bool x_70_phi = false; + bool x_86_phi = false; + bool x_102_phi = false; + float const x_35 = x_6.x_GLF_uniform_float_values.arr[1].el; + a = pack_float_to_snorm4x8(float4(x_35, x_35, x_35, x_35)); + uint const x_38 = a; + v1 = unpack_unorm4x8_to_float(x_38); + float const x_41 = x_6.x_GLF_uniform_float_values.arr[0].el; + E = x_41; + int const x_43 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_45 = v1[x_43]; + float const x_47 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_49 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_53 = E; + bool const x_54 = (fabs((x_45 - (x_47 / x_49))) < x_53); + x_70_phi = x_54; + if (x_54) { + int const x_58 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_60 = v1[x_58]; + float const x_62 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_64 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_68 = E; + x_69 = (fabs((x_60 - (x_62 / x_64))) < x_68); + x_70_phi = x_69; + } + bool const x_70 = x_70_phi; + x_86_phi = x_70; + if (x_70) { + int const x_74 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_76 = v1[x_74]; + float const x_78 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_80 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_84 = E; + x_85 = (fabs((x_76 - (x_78 / x_80))) < x_84); + x_86_phi = x_85; + } + bool const x_86 = x_86_phi; + x_102_phi = x_86; + if (x_86) { + int const x_90 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_92 = v1[x_90]; + float const x_94 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_96 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_100 = E; + x_101 = (fabs((x_92 - (x_94 / x_96))) < x_100); + x_102_phi = x_101; + } + bool const x_102 = x_102_phi; + if (x_102) { + int const x_107 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_110 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_113 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_116 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + int const x_120 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_121 = float(x_120); + *(tint_symbol_4) = float4(x_121, x_121, x_121, x_121); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..84dd174699 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.spvasm @@ -0,0 +1,231 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 152 +; Schema: 0 + OpCapability Shader + %46 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %v1 "v1" + OpName %E "E" + OpName %x_69 "x_69" + OpName %x_85 "x_85" + OpName %x_101 "x_101" + OpName %x_70_phi "x_70_phi" + OpName %x_86_phi "x_86_phi" + OpName %x_102_phi "x_102_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %25 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %30 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %34 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %140 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %25 + %v1 = OpVariable %_ptr_Function_v4float Function %16 + %E = OpVariable %_ptr_Function_float Function %30 + %x_69 = OpVariable %_ptr_Function_bool Function %34 + %x_85 = OpVariable %_ptr_Function_bool Function %34 + %x_101 = OpVariable %_ptr_Function_bool Function %34 + %x_70_phi = OpVariable %_ptr_Function_bool Function %34 + %x_86_phi = OpVariable %_ptr_Function_bool Function %34 + %x_102_phi = OpVariable %_ptr_Function_bool Function %34 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %44 = OpLoad %float %43 + %47 = OpCompositeConstruct %v4float %44 %44 %44 %44 + %45 = OpExtInst %uint %46 PackSnorm4x8 %47 + OpStore %a %45 + %48 = OpLoad %uint %a + %49 = OpExtInst %v4float %46 UnpackUnorm4x8 %48 + OpStore %v1 %49 + %51 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %52 = OpLoad %float %51 + OpStore %E %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Function_float %v1 %55 + %57 = OpLoad %float %56 + %59 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %60 = OpLoad %float %59 + %62 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %63 = OpLoad %float %62 + %64 = OpLoad %float %E + %66 = OpFDiv %float %60 %63 + %67 = OpFSub %float %57 %66 + %65 = OpExtInst %float %46 FAbs %67 + %68 = OpFOrdLessThan %bool %65 %64 + OpStore %x_70_phi %68 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Function_float %v1 %72 + %74 = OpLoad %float %73 + %75 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %76 = OpLoad %float %75 + %77 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %78 = OpLoad %float %77 + %79 = OpLoad %float %E + %81 = OpFDiv %float %76 %78 + %82 = OpFSub %float %74 %81 + %80 = OpExtInst %float %46 FAbs %82 + %83 = OpFOrdLessThan %bool %80 %79 + OpStore %x_69 %83 + %84 = OpLoad %bool %x_69 + OpStore %x_70_phi %84 + OpBranch %69 + %69 = OpLabel + %85 = OpLoad %bool %x_70_phi + OpStore %x_86_phi %85 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Function_float %v1 %89 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %93 = OpLoad %float %92 + %94 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %95 = OpLoad %float %94 + %96 = OpLoad %float %E + %98 = OpFDiv %float %93 %95 + %99 = OpFSub %float %91 %98 + %97 = OpExtInst %float %46 FAbs %99 + %100 = OpFOrdLessThan %bool %97 %96 + OpStore %x_85 %100 + %101 = OpLoad %bool %x_85 + OpStore %x_86_phi %101 + OpBranch %86 + %86 = OpLabel + %102 = OpLoad %bool %x_86_phi + OpStore %x_102_phi %102 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %103 + %104 = OpLabel + %105 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %106 = OpLoad %int %105 + %107 = OpAccessChain %_ptr_Function_float %v1 %106 + %108 = OpLoad %float %107 + %109 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %110 = OpLoad %float %109 + %111 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %112 = OpLoad %float %111 + %113 = OpLoad %float %E + %115 = OpFDiv %float %110 %112 + %116 = OpFSub %float %108 %115 + %114 = OpExtInst %float %46 FAbs %116 + %117 = OpFOrdLessThan %bool %114 %113 + OpStore %x_101 %117 + %118 = OpLoad %bool %x_101 + OpStore %x_102_phi %118 + OpBranch %103 + %103 = OpLabel + %119 = OpLoad %bool %x_102_phi + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %124 = OpLoad %int %123 + %125 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %126 = OpLoad %int %125 + %127 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %130 = OpLoad %int %129 + %131 = OpConvertSToF %float %124 + %132 = OpConvertSToF %float %126 + %133 = OpConvertSToF %float %128 + %134 = OpConvertSToF %float %130 + %135 = OpCompositeConstruct %v4float %131 %132 %133 %134 + OpStore %x_GLF_color %135 + OpBranch %120 + %122 = OpLabel + %136 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %137 = OpLoad %int %136 + %138 = OpConvertSToF %float %137 + %139 = OpCompositeConstruct %v4float %138 %138 %138 %138 + OpStore %x_GLF_color %139 + OpBranch %120 + %120 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %140 +%tint_symbol = OpFunctionParameter %main_out + %144 = OpLabel + %145 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %145 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %147 = OpLabel + %148 = OpFunctionCall %void %main_1 + %150 = OpLoad %v4float %x_GLF_color + %151 = OpCompositeConstruct %main_out %150 + %149 = OpFunctionCall %void %tint_symbol_2 %151 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ebc56378de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-packsnorm-unpackunorm/0-opt.wgsl.expected.wgsl @@ -0,0 +1,99 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var v1 : vec4; + var E : f32; + var x_69 : bool; + var x_85 : bool; + var x_101 : bool; + var x_70_phi : bool; + var x_86_phi : bool; + var x_102_phi : bool; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = pack4x8snorm(vec4(x_35, x_35, x_35, x_35)); + let x_38 : u32 = a; + v1 = unpack4x8unorm(x_38); + let x_41 : f32 = x_6.x_GLF_uniform_float_values[0]; + E = x_41; + let x_43 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_45 : f32 = v1[x_43]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_49 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_53 : f32 = E; + let x_54 : bool = (abs((x_45 - (x_47 / x_49))) < x_53); + x_70_phi = x_54; + if (x_54) { + let x_58 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_60 : f32 = v1[x_58]; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_64 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_68 : f32 = E; + x_69 = (abs((x_60 - (x_62 / x_64))) < x_68); + x_70_phi = x_69; + } + let x_70 : bool = x_70_phi; + x_86_phi = x_70; + if (x_70) { + let x_74 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_76 : f32 = v1[x_74]; + let x_78 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_80 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_84 : f32 = E; + x_85 = (abs((x_76 - (x_78 / x_80))) < x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_102_phi = x_86; + if (x_86) { + let x_90 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_92 : f32 = v1[x_90]; + let x_94 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_96 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_100 : f32 = E; + x_101 = (abs((x_92 - (x_94 / x_96))) < x_100); + x_102_phi = x_101; + } + let x_102 : bool = x_102_phi; + if (x_102) { + let x_107 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_110 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_113 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_116 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } else { + let x_120 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_121 : f32 = f32(x_120); + x_GLF_color = vec4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm new file mode 100644 index 0000000000..6088f4534a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm @@ -0,0 +1,81 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %color "color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %12 + %27 = OpLabel + %color = OpVariable %_ptr_Function_v4float Function + %28 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %29 = OpLoad %float %28 + %30 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %31 = OpLoad %float %30 + %32 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %33 = OpLoad %float %32 + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %35 = OpLoad %float %34 + %36 = OpCompositeConstruct %v4float %29 %31 %33 %35 + OpStore %color %36 + %37 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %38 = OpLoad %int %37 + %39 = OpBitwiseOr %int %int_1 %38 + %40 = OpBitwiseXor %int %39 %int_1 + OpSelectionMerge %41 None + OpSwitch %40 %41 0 %42 + %42 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %46 = OpLoad %float %45 + %47 = OpAccessChain %_ptr_Function_float %color %44 + OpStore %47 %46 + OpBranch %41 + %41 = OpLabel + %48 = OpLoad %v4float %color + OpStore %_GLF_color %48 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..35a88d445c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.hlsl @@ -0,0 +1,52 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_29 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_31 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_33 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_35 = asfloat(x_6[1].x); + color = float4(x_29, x_31, x_33, x_35); + const int x_38 = asint(x_8[1].x); + switch(((1 | x_38) ^ 1)) { + case 0: { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_44 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_46 = asfloat(x_6[1].x); + set_float4(color, x_44, x_46); + break; + } + default: { + break; + } + } + x_GLF_color = color; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..ec0f90fa46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.msl @@ -0,0 +1,62 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float4 color = 0.0f; + float const x_29 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_31 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_33 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_35 = x_6.x_GLF_uniform_float_values.arr[1].el; + color = float4(x_29, x_31, x_33, x_35); + int const x_38 = x_8.x_GLF_uniform_int_values.arr[1].el; + switch(((1 | x_38) ^ 1)) { + case 0: { + int const x_44 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_46 = x_6.x_GLF_uniform_float_values.arr[1].el; + color[x_44] = x_46; + break; + } + default: { + break; + } + } + float4 const x_48 = color; + *(tint_symbol_4) = x_48; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..63021666cf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.spvasm @@ -0,0 +1,116 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %color = OpVariable %_ptr_Function_v4float Function %16 + %28 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %29 = OpLoad %float %28 + %30 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %31 = OpLoad %float %30 + %32 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %36 = OpLoad %float %35 + %37 = OpCompositeConstruct %v4float %29 %31 %33 %36 + OpStore %color %37 + %39 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %40 = OpLoad %int %39 + %42 = OpBitwiseOr %int %int_1 %40 + %43 = OpBitwiseXor %int %42 %int_1 + OpSelectionMerge %41 None + OpSwitch %43 %44 0 %45 + %45 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %49 = OpLoad %float %48 + %51 = OpAccessChain %_ptr_Function_float %color %47 + OpStore %51 %49 + OpBranch %41 + %44 = OpLabel + OpBranch %41 + %41 = OpLabel + %52 = OpLoad %v4float %color + OpStore %x_GLF_color %52 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %53 +%tint_symbol = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %60 = OpLabel + %61 = OpFunctionCall %void %main_1 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpCompositeConstruct %main_out %63 + %62 = OpFunctionCall %void %tint_symbol_2 %64 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..22c3ac0112 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.spvasm.expected.wgsl @@ -0,0 +1,52 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var color : vec4; + let x_29 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_31 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_33 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[1]; + color = vec4(x_29, x_31, x_33, x_35); + let x_38 : i32 = x_8.x_GLF_uniform_int_values[1]; + switch(((1 | x_38) ^ 1)) { + case 0: { + let x_44 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_46 : f32 = x_6.x_GLF_uniform_float_values[1]; + color[x_44] = x_46; + } + default: { + } + } + let x_48 : vec4 = color; + x_GLF_color = x_48; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl new file mode 100644 index 0000000000..22c3ac0112 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl @@ -0,0 +1,52 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var color : vec4; + let x_29 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_31 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_33 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[1]; + color = vec4(x_29, x_31, x_33, x_35); + let x_38 : i32 = x_8.x_GLF_uniform_int_values[1]; + switch(((1 | x_38) ^ 1)) { + case 0: { + let x_44 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_46 : f32 = x_6.x_GLF_uniform_float_values[1]; + color[x_44] = x_46; + } + default: { + } + } + let x_48 : vec4 = color; + x_GLF_color = x_48; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..35a88d445c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.hlsl @@ -0,0 +1,52 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_29 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_31 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_33 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_35 = asfloat(x_6[1].x); + color = float4(x_29, x_31, x_33, x_35); + const int x_38 = asint(x_8[1].x); + switch(((1 | x_38) ^ 1)) { + case 0: { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_44 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_46 = asfloat(x_6[1].x); + set_float4(color, x_44, x_46); + break; + } + default: { + break; + } + } + x_GLF_color = color; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..ec0f90fa46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.msl @@ -0,0 +1,62 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float4 color = 0.0f; + float const x_29 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_31 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_33 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_35 = x_6.x_GLF_uniform_float_values.arr[1].el; + color = float4(x_29, x_31, x_33, x_35); + int const x_38 = x_8.x_GLF_uniform_int_values.arr[1].el; + switch(((1 | x_38) ^ 1)) { + case 0: { + int const x_44 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_46 = x_6.x_GLF_uniform_float_values.arr[1].el; + color[x_44] = x_46; + break; + } + default: { + break; + } + } + float4 const x_48 = color; + *(tint_symbol_4) = x_48; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..63021666cf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.spvasm @@ -0,0 +1,116 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %color = OpVariable %_ptr_Function_v4float Function %16 + %28 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %29 = OpLoad %float %28 + %30 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %31 = OpLoad %float %30 + %32 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %36 = OpLoad %float %35 + %37 = OpCompositeConstruct %v4float %29 %31 %33 %36 + OpStore %color %37 + %39 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %40 = OpLoad %int %39 + %42 = OpBitwiseOr %int %int_1 %40 + %43 = OpBitwiseXor %int %42 %int_1 + OpSelectionMerge %41 None + OpSwitch %43 %44 0 %45 + %45 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %49 = OpLoad %float %48 + %51 = OpAccessChain %_ptr_Function_float %color %47 + OpStore %51 %49 + OpBranch %41 + %44 = OpLabel + OpBranch %41 + %41 = OpLabel + %52 = OpLoad %v4float %color + OpStore %x_GLF_color %52 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %53 +%tint_symbol = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %60 = OpLabel + %61 = OpFunctionCall %void %main_1 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpCompositeConstruct %main_out %63 + %62 = OpFunctionCall %void %tint_symbol_2 %64 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..22c3ac0112 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-simplify-demanded-switch-or-xor/0-opt.wgsl.expected.wgsl @@ -0,0 +1,52 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var color : vec4; + let x_29 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_31 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_33 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[1]; + color = vec4(x_29, x_31, x_33, x_35); + let x_38 : i32 = x_8.x_GLF_uniform_int_values[1]; + switch(((1 | x_38) ^ 1)) { + case 0: { + let x_44 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_46 : f32 = x_6.x_GLF_uniform_float_values[1]; + color[x_44] = x_46; + } + default: { + } + } + let x_48 : vec4 = color; + x_GLF_color = x_48; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm new file mode 100644 index 0000000000..ea4e58cd31 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm @@ -0,0 +1,142 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %b "b" + OpName %c "c" + OpName %d "d" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %16 + %35 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_float Function + %c = OpVariable %_ptr_Function_float Function + %d = OpVariable %_ptr_Function_float Function + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %37 = OpLoad %float %36 + OpStore %a %37 + %38 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %39 = OpLoad %int %38 + OpStore %i %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpSLessThan %bool %44 %46 + OpBranchConditional %47 %48 %41 + %48 = OpLabel + %49 = OpLoad %float %a + OpStore %b %49 + %50 = OpLoad %float %b + OpStore %c %50 + %51 = OpLoad %float %c + %52 = OpExtInst %float %1 Asin %51 + OpStore %d %52 + %53 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %54 = OpLoad %float %53 + OpStore %c %54 + %55 = OpLoad %float %d + OpStore %a %55 + OpBranch %42 + %42 = OpLabel + %56 = OpLoad %int %i + %57 = OpIAdd %int %56 %int_1 + OpStore %i %57 + OpBranch %40 + %41 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %59 = OpLoad %float %58 + %60 = OpLoad %float %a + %61 = OpFOrdLessThan %bool %59 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpLoad %float %a + %65 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %66 = OpLoad %float %65 + %67 = OpFOrdLessThan %bool %64 %66 + OpBranch %62 + %62 = OpLabel + %68 = OpPhi %bool %61 %41 %67 %63 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %73 = OpLoad %int %72 + %74 = OpConvertSToF %float %73 + %75 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %76 + %78 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpConvertSToF %float %79 + %81 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %82 = OpLoad %int %81 + %83 = OpConvertSToF %float %82 + %84 = OpCompositeConstruct %v4float %74 %77 %80 %83 + OpStore %_GLF_color %84 + OpBranch %69 + %71 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %86 + %88 = OpCompositeConstruct %v4float %87 %87 %87 %87 + OpStore %_GLF_color %88 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..0df7ca0790 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.hlsl @@ -0,0 +1,75 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + int i = 0; + float b = 0.0f; + float c = 0.0f; + float d = 0.0f; + bool x_67 = false; + bool x_68_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_37 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + a = x_37; + const int x_39 = asint(x_9[1].x); + i = x_39; + while (true) { + const int x_44 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_46 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_44 < x_46)) { + } else { + break; + } + b = a; + c = b; + d = asin(c); + const float x_54 = asfloat(x_6[1].x); + c = x_54; + a = d; + { + i = (i + 1); + } + } + const float x_59 = asfloat(x_6[2].x); + const bool x_61 = (x_59 < a); + x_68_phi = x_61; + if (x_61) { + const float x_64 = a; + const float x_66 = asfloat(x_6[3].x); + x_67 = (x_64 < x_66); + x_68_phi = x_67; + } + if (x_68_phi) { + const int x_73 = asint(x_9[2].x); + const int x_76 = asint(x_9[1].x); + const int x_79 = asint(x_9[1].x); + const int x_82 = asint(x_9[2].x); + x_GLF_color = float4(float(x_73), float(x_76), float(x_79), float(x_82)); + } else { + const int x_86 = asint(x_9[1].x); + const float x_87 = float(x_86); + x_GLF_color = float4(x_87, x_87, x_87, x_87); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..ed3ad85e1a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.msl @@ -0,0 +1,97 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + float a = 0.0f; + int i = 0; + float b = 0.0f; + float c = 0.0f; + float d = 0.0f; + bool x_67 = false; + bool x_68_phi = false; + float const x_37 = x_6.x_GLF_uniform_float_values.arr[0].el; + a = x_37; + int const x_39 = x_9.x_GLF_uniform_int_values.arr[1].el; + i = x_39; + while (true) { + int const x_44 = i; + int const x_46 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_44 < x_46)) { + } else { + break; + } + float const x_49 = a; + b = x_49; + float const x_50 = b; + c = x_50; + float const x_51 = c; + d = asin(x_51); + float const x_54 = x_6.x_GLF_uniform_float_values.arr[1].el; + c = x_54; + float const x_55 = d; + a = x_55; + { + int const x_56 = i; + i = (x_56 + 1); + } + } + float const x_59 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_60 = a; + bool const x_61 = (x_59 < x_60); + x_68_phi = x_61; + if (x_61) { + float const x_64 = a; + float const x_66 = x_6.x_GLF_uniform_float_values.arr[3].el; + x_67 = (x_64 < x_66); + x_68_phi = x_67; + } + bool const x_68 = x_68_phi; + if (x_68) { + int const x_73 = x_9.x_GLF_uniform_int_values.arr[2].el; + int const x_76 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_79 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_82 = x_9.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_73), float(x_76), float(x_79), float(x_82)); + } else { + int const x_86 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_87 = float(x_86); + *(tint_symbol_4) = float4(x_87, x_87, x_87, x_87); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..9bb8ae6121 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.spvasm @@ -0,0 +1,193 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 114 +; Schema: 0 + OpCapability Shader + %62 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %b "b" + OpName %c "c" + OpName %d "d" + OpName %x_67 "x_67" + OpName %x_68_phi "x_68_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %36 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %102 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_float Function %26 + %i = OpVariable %_ptr_Function_int Function %29 + %b = OpVariable %_ptr_Function_float Function %26 + %c = OpVariable %_ptr_Function_float Function %26 + %d = OpVariable %_ptr_Function_float Function %26 + %x_67 = OpVariable %_ptr_Function_bool Function %36 + %x_68_phi = OpVariable %_ptr_Function_bool Function %36 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %42 = OpLoad %float %41 + OpStore %a %42 + %45 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %46 = OpLoad %int %45 + OpStore %i %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i + %52 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpSLessThan %bool %51 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %48 + %55 = OpLabel + %58 = OpLoad %float %a + OpStore %b %58 + %59 = OpLoad %float %b + OpStore %c %59 + %60 = OpLoad %float %c + %61 = OpExtInst %float %62 Asin %60 + OpStore %d %61 + %63 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %64 = OpLoad %float %63 + OpStore %c %64 + %65 = OpLoad %float %d + OpStore %a %65 + OpBranch %49 + %49 = OpLabel + %66 = OpLoad %int %i + %67 = OpIAdd %int %66 %int_1 + OpStore %i %67 + OpBranch %47 + %48 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %70 = OpLoad %float %69 + %71 = OpLoad %float %a + %72 = OpFOrdLessThan %bool %70 %71 + OpStore %x_68_phi %72 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpLoad %float %a + %77 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %78 = OpLoad %float %77 + %79 = OpFOrdLessThan %bool %75 %78 + OpStore %x_67 %79 + %80 = OpLoad %bool %x_67 + OpStore %x_68_phi %80 + OpBranch %73 + %73 = OpLabel + %81 = OpLoad %bool %x_68_phi + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %86 + %94 = OpConvertSToF %float %88 + %95 = OpConvertSToF %float %90 + %96 = OpConvertSToF %float %92 + %97 = OpCompositeConstruct %v4float %93 %94 %95 %96 + OpStore %x_GLF_color %97 + OpBranch %82 + %84 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %99 = OpLoad %int %98 + %100 = OpConvertSToF %float %99 + %101 = OpCompositeConstruct %v4float %100 %100 %100 %100 + OpStore %x_GLF_color %101 + OpBranch %82 + %82 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %102 +%tint_symbol = OpFunctionParameter %main_out + %106 = OpLabel + %107 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %107 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %109 = OpLabel + %110 = OpFunctionCall %void %main_1 + %112 = OpLoad %v4float %x_GLF_color + %113 = OpCompositeConstruct %main_out %112 + %111 = OpFunctionCall %void %tint_symbol_2 %113 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..d9201c6bc0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.spvasm.expected.wgsl @@ -0,0 +1,90 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var i : i32; + var b : f32; + var c : f32; + var d : f32; + var x_67 : bool; + var x_68_phi : bool; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[0]; + a = x_37; + let x_39 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_39; + loop { + let x_44 : i32 = i; + let x_46 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_44 < x_46)) { + } else { + break; + } + let x_49 : f32 = a; + b = x_49; + let x_50 : f32 = b; + c = x_50; + let x_51 : f32 = c; + d = asin(x_51); + let x_54 : f32 = x_6.x_GLF_uniform_float_values[1]; + c = x_54; + let x_55 : f32 = d; + a = x_55; + + continuing { + let x_56 : i32 = i; + i = (x_56 + 1); + } + } + let x_59 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_60 : f32 = a; + let x_61 : bool = (x_59 < x_60); + x_68_phi = x_61; + if (x_61) { + let x_64 : f32 = a; + let x_66 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_67 = (x_64 < x_66); + x_68_phi = x_67; + } + let x_68 : bool = x_68_phi; + if (x_68) { + let x_73 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_76 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_79 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_82 : i32 = x_9.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_73), f32(x_76), f32(x_79), f32(x_82)); + } else { + let x_86 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_87 : f32 = f32(x_86); + x_GLF_color = vec4(x_87, x_87, x_87, x_87); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl new file mode 100644 index 0000000000..d9201c6bc0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl @@ -0,0 +1,90 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var i : i32; + var b : f32; + var c : f32; + var d : f32; + var x_67 : bool; + var x_68_phi : bool; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[0]; + a = x_37; + let x_39 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_39; + loop { + let x_44 : i32 = i; + let x_46 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_44 < x_46)) { + } else { + break; + } + let x_49 : f32 = a; + b = x_49; + let x_50 : f32 = b; + c = x_50; + let x_51 : f32 = c; + d = asin(x_51); + let x_54 : f32 = x_6.x_GLF_uniform_float_values[1]; + c = x_54; + let x_55 : f32 = d; + a = x_55; + + continuing { + let x_56 : i32 = i; + i = (x_56 + 1); + } + } + let x_59 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_60 : f32 = a; + let x_61 : bool = (x_59 < x_60); + x_68_phi = x_61; + if (x_61) { + let x_64 : f32 = a; + let x_66 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_67 = (x_64 < x_66); + x_68_phi = x_67; + } + let x_68 : bool = x_68_phi; + if (x_68) { + let x_73 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_76 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_79 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_82 : i32 = x_9.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_73), f32(x_76), f32(x_79), f32(x_82)); + } else { + let x_86 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_87 : f32 = f32(x_86); + x_GLF_color = vec4(x_87, x_87, x_87, x_87); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..0df7ca0790 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.hlsl @@ -0,0 +1,75 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + int i = 0; + float b = 0.0f; + float c = 0.0f; + float d = 0.0f; + bool x_67 = false; + bool x_68_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_37 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + a = x_37; + const int x_39 = asint(x_9[1].x); + i = x_39; + while (true) { + const int x_44 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_46 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_44 < x_46)) { + } else { + break; + } + b = a; + c = b; + d = asin(c); + const float x_54 = asfloat(x_6[1].x); + c = x_54; + a = d; + { + i = (i + 1); + } + } + const float x_59 = asfloat(x_6[2].x); + const bool x_61 = (x_59 < a); + x_68_phi = x_61; + if (x_61) { + const float x_64 = a; + const float x_66 = asfloat(x_6[3].x); + x_67 = (x_64 < x_66); + x_68_phi = x_67; + } + if (x_68_phi) { + const int x_73 = asint(x_9[2].x); + const int x_76 = asint(x_9[1].x); + const int x_79 = asint(x_9[1].x); + const int x_82 = asint(x_9[2].x); + x_GLF_color = float4(float(x_73), float(x_76), float(x_79), float(x_82)); + } else { + const int x_86 = asint(x_9[1].x); + const float x_87 = float(x_86); + x_GLF_color = float4(x_87, x_87, x_87, x_87); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..ed3ad85e1a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.msl @@ -0,0 +1,97 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + float a = 0.0f; + int i = 0; + float b = 0.0f; + float c = 0.0f; + float d = 0.0f; + bool x_67 = false; + bool x_68_phi = false; + float const x_37 = x_6.x_GLF_uniform_float_values.arr[0].el; + a = x_37; + int const x_39 = x_9.x_GLF_uniform_int_values.arr[1].el; + i = x_39; + while (true) { + int const x_44 = i; + int const x_46 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_44 < x_46)) { + } else { + break; + } + float const x_49 = a; + b = x_49; + float const x_50 = b; + c = x_50; + float const x_51 = c; + d = asin(x_51); + float const x_54 = x_6.x_GLF_uniform_float_values.arr[1].el; + c = x_54; + float const x_55 = d; + a = x_55; + { + int const x_56 = i; + i = (x_56 + 1); + } + } + float const x_59 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_60 = a; + bool const x_61 = (x_59 < x_60); + x_68_phi = x_61; + if (x_61) { + float const x_64 = a; + float const x_66 = x_6.x_GLF_uniform_float_values.arr[3].el; + x_67 = (x_64 < x_66); + x_68_phi = x_67; + } + bool const x_68 = x_68_phi; + if (x_68) { + int const x_73 = x_9.x_GLF_uniform_int_values.arr[2].el; + int const x_76 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_79 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_82 = x_9.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_73), float(x_76), float(x_79), float(x_82)); + } else { + int const x_86 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_87 = float(x_86); + *(tint_symbol_4) = float4(x_87, x_87, x_87, x_87); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..9bb8ae6121 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.spvasm @@ -0,0 +1,193 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 114 +; Schema: 0 + OpCapability Shader + %62 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %b "b" + OpName %c "c" + OpName %d "d" + OpName %x_67 "x_67" + OpName %x_68_phi "x_68_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %36 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %102 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_float Function %26 + %i = OpVariable %_ptr_Function_int Function %29 + %b = OpVariable %_ptr_Function_float Function %26 + %c = OpVariable %_ptr_Function_float Function %26 + %d = OpVariable %_ptr_Function_float Function %26 + %x_67 = OpVariable %_ptr_Function_bool Function %36 + %x_68_phi = OpVariable %_ptr_Function_bool Function %36 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %42 = OpLoad %float %41 + OpStore %a %42 + %45 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %46 = OpLoad %int %45 + OpStore %i %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i + %52 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpSLessThan %bool %51 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %48 + %55 = OpLabel + %58 = OpLoad %float %a + OpStore %b %58 + %59 = OpLoad %float %b + OpStore %c %59 + %60 = OpLoad %float %c + %61 = OpExtInst %float %62 Asin %60 + OpStore %d %61 + %63 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %64 = OpLoad %float %63 + OpStore %c %64 + %65 = OpLoad %float %d + OpStore %a %65 + OpBranch %49 + %49 = OpLabel + %66 = OpLoad %int %i + %67 = OpIAdd %int %66 %int_1 + OpStore %i %67 + OpBranch %47 + %48 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %70 = OpLoad %float %69 + %71 = OpLoad %float %a + %72 = OpFOrdLessThan %bool %70 %71 + OpStore %x_68_phi %72 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpLoad %float %a + %77 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %78 = OpLoad %float %77 + %79 = OpFOrdLessThan %bool %75 %78 + OpStore %x_67 %79 + %80 = OpLoad %bool %x_67 + OpStore %x_68_phi %80 + OpBranch %73 + %73 = OpLabel + %81 = OpLoad %bool %x_68_phi + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %86 + %94 = OpConvertSToF %float %88 + %95 = OpConvertSToF %float %90 + %96 = OpConvertSToF %float %92 + %97 = OpCompositeConstruct %v4float %93 %94 %95 %96 + OpStore %x_GLF_color %97 + OpBranch %82 + %84 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %99 = OpLoad %int %98 + %100 = OpConvertSToF %float %99 + %101 = OpCompositeConstruct %v4float %100 %100 %100 %100 + OpStore %x_GLF_color %101 + OpBranch %82 + %82 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %102 +%tint_symbol = OpFunctionParameter %main_out + %106 = OpLabel + %107 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %107 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %109 = OpLabel + %110 = OpFunctionCall %void %main_1 + %112 = OpLoad %v4float %x_GLF_color + %113 = OpCompositeConstruct %main_out %112 + %111 = OpFunctionCall %void %tint_symbol_2 %113 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..d9201c6bc0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-vector-ops-asin/0-opt.wgsl.expected.wgsl @@ -0,0 +1,90 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var i : i32; + var b : f32; + var c : f32; + var d : f32; + var x_67 : bool; + var x_68_phi : bool; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[0]; + a = x_37; + let x_39 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_39; + loop { + let x_44 : i32 = i; + let x_46 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_44 < x_46)) { + } else { + break; + } + let x_49 : f32 = a; + b = x_49; + let x_50 : f32 = b; + c = x_50; + let x_51 : f32 = c; + d = asin(x_51); + let x_54 : f32 = x_6.x_GLF_uniform_float_values[1]; + c = x_54; + let x_55 : f32 = d; + a = x_55; + + continuing { + let x_56 : i32 = i; + i = (x_56 + 1); + } + } + let x_59 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_60 : f32 = a; + let x_61 : bool = (x_59 < x_60); + x_68_phi = x_61; + if (x_61) { + let x_64 : f32 = a; + let x_66 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_67 = (x_64 < x_66); + x_68_phi = x_67; + } + let x_68 : bool = x_68_phi; + if (x_68) { + let x_73 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_76 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_79 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_82 : i32 = x_9.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_73), f32(x_76), f32(x_79), f32(x_82)); + } else { + let x_86 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_87 : f32 = f32(x_86); + x_GLF_color = vec4(x_87, x_87, x_87, x_87); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm new file mode 100644 index 0000000000..ca1e5df259 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm @@ -0,0 +1,64 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_n1 = OpConstant %float -1 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %8 + %21 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %23 = OpLoad %float %22 + %24 = OpExtInst %float %1 InverseSqrt %23 + %25 = OpFOrdLessThan %bool %24 %float_n1 + OpSelectionMerge %26 None + OpBranchConditional %25 %27 %28 + %27 = OpLabel + %29 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %30 = OpLoad %float %29 + %31 = OpCompositeConstruct %v4float %30 %30 %30 %30 + OpStore %_GLF_color %31 + OpBranch %26 + %28 = OpLabel + %32 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %33 = OpLoad %float %32 + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %39 = OpLoad %float %38 + %40 = OpCompositeConstruct %v4float %33 %35 %37 %39 + OpStore %_GLF_color %40 + OpBranch %26 + %26 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..1f0d86f181 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.hlsl @@ -0,0 +1,36 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_23 = asfloat(x_5[1].x); + if ((rsqrt(x_23) < -1.0f)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_30 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + x_GLF_color = float4(x_30, x_30, x_30, x_30); + } else { + const float x_33 = asfloat(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_35 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_37 = asfloat(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_39 = asfloat(x_5[1].x); + x_GLF_color = float4(x_33, x_35, x_37, x_39); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..066a9d8c8f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float const x_23 = x_5.x_GLF_uniform_float_values.arr[1].el; + if ((rsqrt(x_23) < -1.0f)) { + float const x_30 = x_5.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_30, x_30, x_30, x_30); + } else { + float const x_33 = x_5.x_GLF_uniform_float_values.arr[1].el; + float const x_35 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_37 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_39 = x_5.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_33, x_35, x_37, x_39); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..91daf4a561 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + %25 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_n1 = OpConstant %float -1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %45 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %23 = OpLoad %float %22 + %24 = OpExtInst %float %25 InverseSqrt %23 + %27 = OpFOrdLessThan %bool %24 %float_n1 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + %33 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %34 = OpLoad %float %33 + %35 = OpCompositeConstruct %v4float %34 %34 %34 %34 + OpStore %x_GLF_color %35 + OpBranch %29 + %31 = OpLabel + %36 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %43 = OpLoad %float %42 + %44 = OpCompositeConstruct %v4float %37 %39 %41 %43 + OpStore %x_GLF_color %44 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %45 +%tint_symbol = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %52 = OpLabel + %53 = OpFunctionCall %void %main_1 + %55 = OpLoad %v4float %x_GLF_color + %56 = OpCompositeConstruct %main_out %55 + %54 = OpFunctionCall %void %tint_symbol_2 %56 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..239caf26d7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_23 : f32 = x_5.x_GLF_uniform_float_values[1]; + if ((inverseSqrt(x_23) < -1.0)) { + let x_30 : f32 = x_5.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_30, x_30, x_30, x_30); + } else { + let x_33 : f32 = x_5.x_GLF_uniform_float_values[1]; + let x_35 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_37 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_39 : f32 = x_5.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_33, x_35, x_37, x_39); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl new file mode 100644 index 0000000000..239caf26d7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl @@ -0,0 +1,36 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_23 : f32 = x_5.x_GLF_uniform_float_values[1]; + if ((inverseSqrt(x_23) < -1.0)) { + let x_30 : f32 = x_5.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_30, x_30, x_30, x_30); + } else { + let x_33 : f32 = x_5.x_GLF_uniform_float_values[1]; + let x_35 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_37 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_39 : f32 = x_5.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_33, x_35, x_37, x_39); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..1f0d86f181 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_23 = asfloat(x_5[1].x); + if ((rsqrt(x_23) < -1.0f)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_30 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + x_GLF_color = float4(x_30, x_30, x_30, x_30); + } else { + const float x_33 = asfloat(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_35 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_37 = asfloat(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_39 = asfloat(x_5[1].x); + x_GLF_color = float4(x_33, x_35, x_37, x_39); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..066a9d8c8f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float const x_23 = x_5.x_GLF_uniform_float_values.arr[1].el; + if ((rsqrt(x_23) < -1.0f)) { + float const x_30 = x_5.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_30, x_30, x_30, x_30); + } else { + float const x_33 = x_5.x_GLF_uniform_float_values.arr[1].el; + float const x_35 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_37 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_39 = x_5.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_33, x_35, x_37, x_39); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..91daf4a561 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + %25 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_n1 = OpConstant %float -1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %45 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %23 = OpLoad %float %22 + %24 = OpExtInst %float %25 InverseSqrt %23 + %27 = OpFOrdLessThan %bool %24 %float_n1 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + %33 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %34 = OpLoad %float %33 + %35 = OpCompositeConstruct %v4float %34 %34 %34 %34 + OpStore %x_GLF_color %35 + OpBranch %29 + %31 = OpLabel + %36 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %43 = OpLoad %float %42 + %44 = OpCompositeConstruct %v4float %37 %39 %41 %43 + OpStore %x_GLF_color %44 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %45 +%tint_symbol = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %52 = OpLabel + %53 = OpFunctionCall %void %main_1 + %55 = OpLoad %v4float %x_GLF_color + %56 = OpCompositeConstruct %main_out %55 + %54 = OpFunctionCall %void %tint_symbol_2 %56 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..239caf26d7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-value-tracking-inversesqrt/0-opt.wgsl.expected.wgsl @@ -0,0 +1,36 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_23 : f32 = x_5.x_GLF_uniform_float_values[1]; + if ((inverseSqrt(x_23) < -1.0)) { + let x_30 : f32 = x_5.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_30, x_30, x_30, x_30); + } else { + let x_33 : f32 = x_5.x_GLF_uniform_float_values[1]; + let x_35 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_37 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_39 : f32 = x_5.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_33, x_35, x_37, x_39); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm new file mode 100644 index 0000000000..bb7ac9576e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm @@ -0,0 +1,77 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %9 + %23 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %24 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %25 = OpLoad %int %24 + %26 = OpShiftLeftLogical %int %25 %int_5 + %27 = OpShiftRightArithmetic %int %int_1 %26 + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %29 = OpLoad %int %28 + %30 = OpShiftRightArithmetic %int %27 %29 + OpStore %a %30 + %31 = OpLoad %int %a + %32 = OpIEqual %bool %31 %int_1 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %37 = OpLoad %int %36 + %38 = OpConvertSToF %float %37 + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %40 = OpLoad %int %39 + %41 = OpConvertSToF %float %40 + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %43 + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpCompositeConstruct %v4float %38 %41 %44 %47 + OpStore %_GLF_color %48 + OpBranch %33 + %35 = OpLabel + %49 = OpLoad %int %a + %50 = OpConvertSToF %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %_GLF_color %51 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..04d7fae0ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.hlsl @@ -0,0 +1,40 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_25 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_29 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + a = ((1 >> asuint((x_25 << asuint(5)))) >> asuint(x_29)); + if ((a == 1)) { + const int x_37 = asint(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_43 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_46 = asint(x_6[1].x); + x_GLF_color = float4(float(x_37), float(x_40), float(x_43), float(x_46)); + } else { + const float x_50 = float(a); + x_GLF_color = float4(x_50, x_50, x_50, x_50); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..0e0fb17bca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = ((1 >> as_type((x_25 << as_type(5)))) >> as_type(x_29)); + int const x_31 = a; + if ((x_31 == 1)) { + int const x_37 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_37), float(x_40), float(x_43), float(x_46)); + } else { + int const x_49 = a; + float const x_50 = float(x_49); + *(tint_symbol_4) = float4(x_50, x_50, x_50, x_50); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..22f831d259 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.spvasm @@ -0,0 +1,113 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %59 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %26 = OpLoad %int %25 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %28 = OpLoad %int %27 + %31 = OpBitcast %uint %int_5 + %33 = OpShiftLeftLogical %int %26 %31 + %30 = OpBitcast %uint %33 + %34 = OpShiftRightArithmetic %int %int_1 %30 + %35 = OpBitcast %uint %28 + %36 = OpShiftRightArithmetic %int %34 %35 + OpStore %a %36 + %37 = OpLoad %int %a + %38 = OpIEqual %bool %37 %int_1 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %44 + %52 = OpConvertSToF %float %46 + %53 = OpConvertSToF %float %48 + %54 = OpConvertSToF %float %50 + %55 = OpCompositeConstruct %v4float %51 %52 %53 %54 + OpStore %x_GLF_color %55 + OpBranch %40 + %42 = OpLabel + %56 = OpLoad %int %a + %57 = OpConvertSToF %float %56 + %58 = OpCompositeConstruct %v4float %57 %57 %57 %57 + OpStore %x_GLF_color %58 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %59 +%tint_symbol = OpFunctionParameter %main_out + %63 = OpLabel + %64 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %64 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %66 = OpLabel + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_2 %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..32e102dac6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.spvasm.expected.wgsl @@ -0,0 +1,41 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = ((1 >> bitcast((x_25 << bitcast(5)))) >> bitcast(x_29)); + let x_31 : i32 = a; + if ((x_31 == 1)) { + let x_37 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_37), f32(x_40), f32(x_43), f32(x_46)); + } else { + let x_49 : i32 = a; + let x_50 : f32 = f32(x_49); + x_GLF_color = vec4(x_50, x_50, x_50, x_50); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl new file mode 100644 index 0000000000..32e102dac6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl @@ -0,0 +1,41 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = ((1 >> bitcast((x_25 << bitcast(5)))) >> bitcast(x_29)); + let x_31 : i32 = a; + if ((x_31 == 1)) { + let x_37 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_37), f32(x_40), f32(x_43), f32(x_46)); + } else { + let x_49 : i32 = a; + let x_50 : f32 = f32(x_49); + x_GLF_color = vec4(x_50, x_50, x_50, x_50); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..04d7fae0ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.hlsl @@ -0,0 +1,40 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_25 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_29 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + a = ((1 >> asuint((x_25 << asuint(5)))) >> asuint(x_29)); + if ((a == 1)) { + const int x_37 = asint(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_43 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_46 = asint(x_6[1].x); + x_GLF_color = float4(float(x_37), float(x_40), float(x_43), float(x_46)); + } else { + const float x_50 = float(a); + x_GLF_color = float4(x_50, x_50, x_50, x_50); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..0e0fb17bca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = ((1 >> as_type((x_25 << as_type(5)))) >> as_type(x_29)); + int const x_31 = a; + if ((x_31 == 1)) { + int const x_37 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_37), float(x_40), float(x_43), float(x_46)); + } else { + int const x_49 = a; + float const x_50 = float(x_49); + *(tint_symbol_4) = float4(x_50, x_50, x_50, x_50); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..22f831d259 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.spvasm @@ -0,0 +1,113 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %59 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %26 = OpLoad %int %25 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %28 = OpLoad %int %27 + %31 = OpBitcast %uint %int_5 + %33 = OpShiftLeftLogical %int %26 %31 + %30 = OpBitcast %uint %33 + %34 = OpShiftRightArithmetic %int %int_1 %30 + %35 = OpBitcast %uint %28 + %36 = OpShiftRightArithmetic %int %34 %35 + OpStore %a %36 + %37 = OpLoad %int %a + %38 = OpIEqual %bool %37 %int_1 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %44 + %52 = OpConvertSToF %float %46 + %53 = OpConvertSToF %float %48 + %54 = OpConvertSToF %float %50 + %55 = OpCompositeConstruct %v4float %51 %52 %53 %54 + OpStore %x_GLF_color %55 + OpBranch %40 + %42 = OpLabel + %56 = OpLoad %int %a + %57 = OpConvertSToF %float %56 + %58 = OpCompositeConstruct %v4float %57 %57 %57 %57 + OpStore %x_GLF_color %58 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %59 +%tint_symbol = OpFunctionParameter %main_out + %63 = OpLabel + %64 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %64 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %66 = OpLabel + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_2 %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..32e102dac6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-bit-shifting/0-opt.wgsl.expected.wgsl @@ -0,0 +1,41 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = ((1 >> bitcast((x_25 << bitcast(5)))) >> bitcast(x_29)); + let x_31 : i32 = a; + if ((x_31 == 1)) { + let x_37 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_37), f32(x_40), f32(x_43), f32(x_46)); + } else { + let x_49 : i32 = a; + let x_50 : f32 = f32(x_49); + x_GLF_color = vec4(x_50, x_50, x_50, x_50); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm new file mode 100644 index 0000000000..409dec006a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm @@ -0,0 +1,92 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %v2float = OpTypeVector %float 2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %12 + %29 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpConvertSToF %float %31 + %33 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %34 = OpLoad %int %33 + %35 = OpConvertSToF %float %34 + %36 = OpCompositeConstruct %v2float %32 %35 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpBitwiseOr %int %38 %int_1 + %40 = OpVectorExtractDynamic %float %36 %39 + OpStore %a %40 + %41 = OpLoad %float %a + %42 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %43 = OpLoad %float %42 + %44 = OpFOrdEqual %bool %41 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + %48 = OpLoad %float %a + %49 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpLoad %float %a + %56 = OpCompositeConstruct %v4float %48 %51 %54 %55 + OpStore %_GLF_color %56 + OpBranch %45 + %47 = OpLabel + %57 = OpLoad %float %a + %58 = OpCompositeConstruct %v4float %57 %57 %57 %57 + OpStore %_GLF_color %58 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f1391e1978 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.hlsl @@ -0,0 +1,46 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_31 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_34 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + a = float2(float(x_31), float(x_34))[(x_38 | 1)]; + const float x_41 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_43 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_41 == x_43)) { + const float x_48 = a; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(x_48, float(x_50), float(x_53), a); + } else { + const float x_57 = a; + x_GLF_color = float4(x_57, x_57, x_57, x_57); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a588885a4a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.msl @@ -0,0 +1,59 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float a = 0.0f; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_34 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = float2(float(x_31), float(x_34))[(x_38 | 1)]; + float const x_41 = a; + float const x_43 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_41 == x_43)) { + float const x_48 = a; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_55 = a; + *(tint_symbol_4) = float4(x_48, float(x_50), float(x_53), x_55); + } else { + float const x_57 = a; + *(tint_symbol_4) = float4(x_57, x_57, x_57, x_57); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..065f84178f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.spvasm @@ -0,0 +1,126 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %v2float = OpTypeVector %float 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %63 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_float Function %26 + %30 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %31 = OpLoad %int %30 + %33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %34 = OpLoad %int %33 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %36 = OpLoad %int %35 + %38 = OpConvertSToF %float %31 + %39 = OpConvertSToF %float %34 + %40 = OpCompositeConstruct %v2float %38 %39 + %41 = OpBitwiseOr %int %36 %int_1 + %42 = OpVectorExtractDynamic %float %40 %41 + OpStore %a %42 + %43 = OpLoad %float %a + %45 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %46 = OpLoad %float %45 + %47 = OpFOrdEqual %bool %43 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %51 + %50 = OpLabel + %52 = OpLoad %float %a + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpLoad %float %a + %58 = OpConvertSToF %float %54 + %59 = OpConvertSToF %float %56 + %60 = OpCompositeConstruct %v4float %52 %58 %59 %57 + OpStore %x_GLF_color %60 + OpBranch %49 + %51 = OpLabel + %61 = OpLoad %float %a + %62 = OpCompositeConstruct %v4float %61 %61 %61 %61 + OpStore %x_GLF_color %62 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %63 +%tint_symbol = OpFunctionParameter %main_out + %67 = OpLabel + %68 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %68 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %70 = OpLabel + %71 = OpFunctionCall %void %main_1 + %73 = OpLoad %v4float %x_GLF_color + %74 = OpCompositeConstruct %main_out %73 + %72 = OpFunctionCall %void %tint_symbol_2 %74 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..1210250558 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.spvasm.expected.wgsl @@ -0,0 +1,51 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = vec2(f32(x_31), f32(x_34))[(x_38 | 1)]; + let x_41 : f32 = a; + let x_43 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_41 == x_43)) { + let x_48 : f32 = a; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_55 : f32 = a; + x_GLF_color = vec4(x_48, f32(x_50), f32(x_53), x_55); + } else { + let x_57 : f32 = a; + x_GLF_color = vec4(x_57, x_57, x_57, x_57); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl new file mode 100644 index 0000000000..1210250558 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl @@ -0,0 +1,51 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = vec2(f32(x_31), f32(x_34))[(x_38 | 1)]; + let x_41 : f32 = a; + let x_43 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_41 == x_43)) { + let x_48 : f32 = a; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_55 : f32 = a; + x_GLF_color = vec4(x_48, f32(x_50), f32(x_53), x_55); + } else { + let x_57 : f32 = a; + x_GLF_color = vec4(x_57, x_57, x_57, x_57); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f1391e1978 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_31 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_34 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + a = float2(float(x_31), float(x_34))[(x_38 | 1)]; + const float x_41 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_43 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_41 == x_43)) { + const float x_48 = a; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(x_48, float(x_50), float(x_53), a); + } else { + const float x_57 = a; + x_GLF_color = float4(x_57, x_57, x_57, x_57); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a588885a4a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.msl @@ -0,0 +1,59 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float a = 0.0f; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_34 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = float2(float(x_31), float(x_34))[(x_38 | 1)]; + float const x_41 = a; + float const x_43 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_41 == x_43)) { + float const x_48 = a; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_55 = a; + *(tint_symbol_4) = float4(x_48, float(x_50), float(x_53), x_55); + } else { + float const x_57 = a; + *(tint_symbol_4) = float4(x_57, x_57, x_57, x_57); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..065f84178f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.spvasm @@ -0,0 +1,126 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %v2float = OpTypeVector %float 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %63 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_float Function %26 + %30 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %31 = OpLoad %int %30 + %33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %34 = OpLoad %int %33 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %36 = OpLoad %int %35 + %38 = OpConvertSToF %float %31 + %39 = OpConvertSToF %float %34 + %40 = OpCompositeConstruct %v2float %38 %39 + %41 = OpBitwiseOr %int %36 %int_1 + %42 = OpVectorExtractDynamic %float %40 %41 + OpStore %a %42 + %43 = OpLoad %float %a + %45 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %46 = OpLoad %float %45 + %47 = OpFOrdEqual %bool %43 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %51 + %50 = OpLabel + %52 = OpLoad %float %a + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpLoad %float %a + %58 = OpConvertSToF %float %54 + %59 = OpConvertSToF %float %56 + %60 = OpCompositeConstruct %v4float %52 %58 %59 %57 + OpStore %x_GLF_color %60 + OpBranch %49 + %51 = OpLabel + %61 = OpLoad %float %a + %62 = OpCompositeConstruct %v4float %61 %61 %61 %61 + OpStore %x_GLF_color %62 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %63 +%tint_symbol = OpFunctionParameter %main_out + %67 = OpLabel + %68 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %68 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %70 = OpLabel + %71 = OpFunctionCall %void %main_1 + %73 = OpLoad %v4float %x_GLF_color + %74 = OpCompositeConstruct %main_out %73 + %72 = OpFunctionCall %void %tint_symbol_2 %74 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..1210250558 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inclusive-or/0-opt.wgsl.expected.wgsl @@ -0,0 +1,51 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = vec2(f32(x_31), f32(x_34))[(x_38 | 1)]; + let x_41 : f32 = a; + let x_43 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_41 == x_43)) { + let x_48 : f32 = a; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_55 : f32 = a; + x_GLF_color = vec4(x_48, f32(x_50), f32(x_53), x_55); + } else { + let x_57 : f32 = a; + x_GLF_color = vec4(x_57, x_57, x_57, x_57); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm new file mode 100644 index 0000000000..6ac9b0c1f3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm @@ -0,0 +1,407 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f_i1_ "f(i1;" + OpName %a "a" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %ref "ref" + OpName %i_0 "i" + OpName %a_0 "a" + OpName %param "param" + OpName %param_0 "param" + OpName %i_1 "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %f_i1_ RelaxedPrecision + OpDecorate %a RelaxedPrecision + OpDecorate %i RelaxedPrecision + OpDecorate %_arr_int_uint_12 ArrayStride 16 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %ref RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %i_0 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %a_0 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + OpDecorate %59 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + OpDecorate %61 RelaxedPrecision + OpDecorate %62 RelaxedPrecision + OpDecorate %63 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %65 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %67 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %69 RelaxedPrecision + OpDecorate %70 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %74 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %77 RelaxedPrecision + OpDecorate %78 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + OpDecorate %i_1 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %82 RelaxedPrecision + OpDecorate %83 RelaxedPrecision + OpDecorate %84 RelaxedPrecision + OpDecorate %85 RelaxedPrecision + OpDecorate %86 RelaxedPrecision + OpDecorate %87 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %88 RelaxedPrecision + OpDecorate %89 RelaxedPrecision + OpDecorate %90 RelaxedPrecision + OpDecorate %91 RelaxedPrecision + OpDecorate %92 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %94 RelaxedPrecision + %void = OpTypeVoid + %96 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %99 = OpTypeFunction %int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_12 = OpConstant %uint 12 +%_arr_int_uint_12 = OpTypeArray %int %uint_12 + %buf0 = OpTypeStruct %_arr_int_uint_12 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_6 = OpConstant %int 6 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %int_11 = OpConstant %int 11 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %96 + %123 = OpLabel + %ref = OpVariable %_ptr_Function__arr_int_uint_10 Function + %i_0 = OpVariable %_ptr_Function_int Function + %a_0 = OpVariable %_ptr_Function__arr_int_uint_10 Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %124 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %25 = OpLoad %int %124 + %125 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %26 = OpLoad %int %125 + %126 = OpAccessChain %_ptr_Function_int %ref %25 + OpStore %126 %26 + %127 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_11 + %27 = OpLoad %int %127 + %128 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %28 = OpLoad %int %128 + %129 = OpAccessChain %_ptr_Function_int %ref %27 + OpStore %129 %28 + %130 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %29 = OpLoad %int %130 + %131 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %30 = OpLoad %int %131 + %132 = OpAccessChain %_ptr_Function_int %ref %29 + OpStore %132 %30 + %133 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %31 = OpLoad %int %133 + %134 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %32 = OpLoad %int %134 + %135 = OpAccessChain %_ptr_Function_int %ref %31 + OpStore %135 %32 + %136 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %33 = OpLoad %int %136 + %137 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %34 = OpLoad %int %137 + %138 = OpAccessChain %_ptr_Function_int %ref %33 + OpStore %138 %34 + %139 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %35 = OpLoad %int %139 + %140 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %36 = OpLoad %int %140 + %141 = OpAccessChain %_ptr_Function_int %ref %35 + OpStore %141 %36 + %142 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %37 = OpLoad %int %142 + %143 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_7 + %38 = OpLoad %int %143 + %144 = OpAccessChain %_ptr_Function_int %ref %37 + OpStore %144 %38 + %145 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %39 = OpLoad %int %145 + %146 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %40 = OpLoad %int %146 + %147 = OpAccessChain %_ptr_Function_int %ref %39 + OpStore %147 %40 + %148 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_9 + %41 = OpLoad %int %148 + %149 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_9 + %42 = OpLoad %int %149 + %150 = OpAccessChain %_ptr_Function_int %ref %41 + OpStore %150 %42 + %151 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_10 + %43 = OpLoad %int %151 + %152 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_10 + %44 = OpLoad %int %152 + %153 = OpAccessChain %_ptr_Function_int %ref %43 + OpStore %153 %44 + %154 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %45 = OpLoad %int %154 + OpStore %i_0 %45 + OpBranch %155 + %155 = OpLabel + OpLoopMerge %156 %157 None + OpBranch %158 + %158 = OpLabel + %46 = OpLoad %int %i_0 + %159 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %47 = OpLoad %int %159 + %160 = OpSLessThan %bool %46 %47 + OpBranchConditional %160 %161 %156 + %161 = OpLabel + %48 = OpLoad %int %i_0 + %49 = OpLoad %int %i_0 + %162 = OpAccessChain %_ptr_Function_int %a_0 %48 + OpStore %162 %49 + %50 = OpLoad %int %i_0 + %163 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %51 = OpLoad %int %163 + %164 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %52 = OpLoad %int %164 + %53 = OpSDiv %int %51 %52 + %165 = OpSLessThan %bool %50 %53 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %168 + %167 = OpLabel + %54 = OpLoad %int %i_0 + %55 = OpLoad %int %i_0 + %169 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %56 = OpLoad %int %169 + %57 = OpIAdd %int %55 %56 + %170 = OpAccessChain %_ptr_Function_int %a_0 %54 + OpStore %170 %57 + %58 = OpLoad %int %i_0 + %171 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %59 = OpLoad %int %171 + %172 = OpSLessThan %bool %58 %59 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %173 + %174 = OpLabel + OpBranch %157 + %173 = OpLabel + %60 = OpLoad %int %i_0 + %61 = OpLoad %int %i_0 + %175 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %62 = OpLoad %int %175 + %63 = OpIAdd %int %61 %62 + %176 = OpAccessChain %_ptr_Function_int %a_0 %60 + OpStore %176 %63 + %64 = OpLoad %int %i_0 + %177 = OpAccessChain %_ptr_Function_int %a_0 %64 + %65 = OpLoad %int %177 + OpStore %param %65 + %66 = OpFunctionCall %int %f_i1_ %param + %178 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %67 = OpLoad %int %178 + %179 = OpSLessThan %bool %66 %67 + OpSelectionMerge %180 None + OpBranchConditional %179 %181 %180 + %181 = OpLabel + %68 = OpLoad %int %i_0 + %182 = OpAccessChain %_ptr_Function_int %a_0 %68 + %69 = OpLoad %int %182 + %70 = OpISub %int %69 %int_1 + OpStore %182 %70 + OpBranch %180 + %180 = OpLabel + OpBranch %166 + %168 = OpLabel + %71 = OpLoad %int %i_0 + %183 = OpAccessChain %_ptr_Function_int %a_0 %71 + %72 = OpLoad %int %183 + OpStore %param_0 %72 + %73 = OpFunctionCall %int %f_i1_ %param_0 + %184 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %74 = OpLoad %int %184 + %185 = OpSLessThan %bool %73 %74 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %186 + %187 = OpLabel + %75 = OpLoad %int %i_0 + %188 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %76 = OpLoad %int %188 + %189 = OpAccessChain %_ptr_Function_int %a_0 %75 + %77 = OpLoad %int %189 + %78 = OpIAdd %int %77 %76 + %190 = OpAccessChain %_ptr_Function_int %a_0 %75 + OpStore %190 %78 + OpBranch %186 + %186 = OpLabel + OpBranch %166 + %166 = OpLabel + OpBranch %157 + %157 = OpLabel + %79 = OpLoad %int %i_0 + %80 = OpIAdd %int %79 %int_1 + OpStore %i_0 %80 + OpBranch %155 + %156 = OpLabel + %191 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %81 = OpLoad %int %191 + OpStore %i_1 %81 + OpBranch %192 + %192 = OpLabel + OpLoopMerge %193 %194 None + OpBranch %195 + %195 = OpLabel + %82 = OpLoad %int %i_1 + %196 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %83 = OpLoad %int %196 + %197 = OpSLessThan %bool %82 %83 + OpBranchConditional %197 %198 %193 + %198 = OpLabel + %84 = OpLoad %int %i_1 + %199 = OpAccessChain %_ptr_Function_int %a_0 %84 + %85 = OpLoad %int %199 + %86 = OpLoad %int %i_1 + %200 = OpAccessChain %_ptr_Function_int %ref %86 + %87 = OpLoad %int %200 + %201 = OpINotEqual %bool %85 %87 + OpSelectionMerge %202 None + OpBranchConditional %201 %203 %202 + %203 = OpLabel + %204 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %88 = OpLoad %int %204 + %205 = OpConvertSToF %float %88 + %206 = OpCompositeConstruct %v4float %205 %205 %205 %205 + OpStore %_GLF_color %206 + OpReturn + %202 = OpLabel + OpBranch %194 + %194 = OpLabel + %89 = OpLoad %int %i_1 + %90 = OpIAdd %int %89 %int_1 + OpStore %i_1 %90 + OpBranch %192 + %193 = OpLabel + %207 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_11 + %91 = OpLoad %int %207 + %208 = OpConvertSToF %float %91 + %209 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %92 = OpLoad %int %209 + %210 = OpConvertSToF %float %92 + %211 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %93 = OpLoad %int %211 + %212 = OpConvertSToF %float %93 + %213 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_11 + %94 = OpLoad %int %213 + %214 = OpConvertSToF %float %94 + %215 = OpCompositeConstruct %v4float %208 %210 %212 %214 + OpStore %_GLF_color %215 + OpReturn + OpFunctionEnd + %f_i1_ = OpFunction %int None %99 + %a = OpFunctionParameter %_ptr_Function_int + %216 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %217 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %16 = OpLoad %int %217 + OpStore %i %16 + OpBranch %218 + %218 = OpLabel + OpLoopMerge %219 %220 None + OpBranch %221 + %221 = OpLabel + %17 = OpLoad %int %i + %222 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %18 = OpLoad %int %222 + %223 = OpSLessThan %bool %17 %18 + OpBranchConditional %223 %224 %219 + %224 = OpLabel + %19 = OpLoad %int %i + %225 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %20 = OpLoad %int %225 + %226 = OpSGreaterThan %bool %19 %20 + OpSelectionMerge %227 None + OpBranchConditional %226 %228 %227 + %228 = OpLabel + %21 = OpLoad %int %a + OpReturnValue %21 + %227 = OpLabel + OpBranch %220 + %220 = OpLabel + %22 = OpLoad %int %i + %23 = OpIAdd %int %22 %int_1 + OpStore %i %23 + OpBranch %218 + %219 = OpLabel + %229 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %24 = OpLoad %int %229 + OpReturnValue %24 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..d5ea2b6e1f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.hlsl @@ -0,0 +1,172 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[12]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int f_i1_(inout int a) { + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_16 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + i = x_16; + while (true) { + const int x_17 = i; + const int x_18 = asint(x_8[6].x); + if ((x_17 < x_18)) { + } else { + break; + } + const int x_19 = i; + const int x_20 = asint(x_8[2].x); + if ((x_19 > x_20)) { + const int x_21 = a; + return x_21; + } + { + i = (i + 1); + } + } + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_24 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + return x_24; +} + +void main_1() { + int ref[10] = (int[10])0; + int i_1 = 0; + int a_1[10] = (int[10])0; + int param = 0; + int param_1 = 0; + int i_2 = 0; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_25 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_26 = asint(x_8[1].x); + ref[x_25] = x_26; + const int x_27 = asint(x_8[11].x); + const int x_28 = asint(x_8[2].x); + ref[x_27] = x_28; + const int x_29 = asint(x_8[1].x); + const int x_30 = asint(x_8[3].x); + ref[x_29] = x_30; + const int x_31 = asint(x_8[2].x); + const int x_32 = asint(x_8[4].x); + ref[x_31] = x_32; + const int x_33 = asint(x_8[3].x); + const int x_34 = asint(x_8[5].x); + ref[x_33] = x_34; + const int x_35 = asint(x_8[4].x); + const int x_36 = asint(x_8[6].x); + ref[x_35] = x_36; + const int x_37 = asint(x_8[5].x); + const int x_38 = asint(x_8[7].x); + ref[x_37] = x_38; + const int x_39 = asint(x_8[8].x); + const int x_40 = asint(x_8[8].x); + ref[x_39] = x_40; + const int x_41 = asint(x_8[9].x); + const int x_42 = asint(x_8[9].x); + ref[x_41] = x_42; + const int x_43 = asint(x_8[10].x); + const int x_44 = asint(x_8[10].x); + ref[x_43] = x_44; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + i_1 = x_45; + while (true) { + const int x_46 = i_1; + const int x_47 = asint(x_8[6].x); + if ((x_46 < x_47)) { + } else { + break; + } + a_1[i_1] = i_1; + const int x_50 = i_1; + const int x_51 = asint(x_8[6].x); + const int x_52 = asint(x_8[1].x); + if ((x_50 < (x_51 / x_52))) { + const int x_54 = i_1; + const int x_55 = i_1; + const int x_56 = asint(x_8[1].x); + a_1[x_54] = (x_55 + x_56); + const int x_58 = i_1; + const int x_59 = asint(x_8[6].x); + if ((x_58 < x_59)) { + { + i_1 = (i_1 + 1); + } + continue; + } + const int x_60 = i_1; + const int x_61 = i_1; + const int x_62 = asint(x_8[8].x); + a_1[x_60] = (x_61 + x_62); + const int x_65 = a_1[i_1]; + param = x_65; + const int x_66 = f_i1_(param); + const int x_67 = asint(x_8[8].x); + if ((x_66 < x_67)) { + const int x_182_save = i_1; + const int x_69 = a_1[x_182_save]; + a_1[x_182_save] = (x_69 - 1); + } + } else { + const int x_72 = a_1[i_1]; + param_1 = x_72; + const int x_73 = f_i1_(param_1); + const int x_74 = asint(x_8[8].x); + if ((x_73 < x_74)) { + const int x_75 = i_1; + const int x_76 = asint(x_8[4].x); + const int x_77 = a_1[x_75]; + a_1[x_75] = (x_77 + x_76); + } + } + { + i_1 = (i_1 + 1); + } + } + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_81 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + i_2 = x_81; + while (true) { + const int x_82 = i_2; + const int x_83 = asint(x_8[6].x); + if ((x_82 < x_83)) { + } else { + break; + } + const int x_85 = a_1[i_2]; + const int x_87 = ref[i_2]; + if ((x_85 != x_87)) { + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_88 = asint(x_8[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const float x_205 = float(x_88); + x_GLF_color = float4(x_205, x_205, x_205, x_205); + return; + } + { + i_2 = (i_2 + 1); + } + } + const int x_91 = asint(x_8[11].x); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_92 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_93 = asint(x_8[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const int x_94 = asint(x_8[11].x); + x_GLF_color = float4(float(x_91), float(x_92), float(x_93), float(x_94)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..6399b00769 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.msl @@ -0,0 +1,188 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[12]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int f_i1_(constant buf0& x_8, thread int* const a) { + int i = 0; + int const x_16 = x_8.x_GLF_uniform_int_values.arr[0].el; + i = x_16; + while (true) { + int const x_17 = i; + int const x_18 = x_8.x_GLF_uniform_int_values.arr[6].el; + if ((x_17 < x_18)) { + } else { + break; + } + int const x_19 = i; + int const x_20 = x_8.x_GLF_uniform_int_values.arr[2].el; + if ((x_19 > x_20)) { + int const x_21 = *(a); + return x_21; + } + { + int const x_22 = i; + i = (x_22 + 1); + } + } + int const x_24 = x_8.x_GLF_uniform_int_values.arr[0].el; + return x_24; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + tint_array_wrapper_1 ref = {}; + int i_1 = 0; + tint_array_wrapper_1 a_1 = {}; + int param = 0; + int param_1 = 0; + int i_2 = 0; + int const x_25 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_26 = x_8.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_25] = x_26; + int const x_27 = x_8.x_GLF_uniform_int_values.arr[11].el; + int const x_28 = x_8.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_27] = x_28; + int const x_29 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_30 = x_8.x_GLF_uniform_int_values.arr[3].el; + ref.arr[x_29] = x_30; + int const x_31 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_32 = x_8.x_GLF_uniform_int_values.arr[4].el; + ref.arr[x_31] = x_32; + int const x_33 = x_8.x_GLF_uniform_int_values.arr[3].el; + int const x_34 = x_8.x_GLF_uniform_int_values.arr[5].el; + ref.arr[x_33] = x_34; + int const x_35 = x_8.x_GLF_uniform_int_values.arr[4].el; + int const x_36 = x_8.x_GLF_uniform_int_values.arr[6].el; + ref.arr[x_35] = x_36; + int const x_37 = x_8.x_GLF_uniform_int_values.arr[5].el; + int const x_38 = x_8.x_GLF_uniform_int_values.arr[7].el; + ref.arr[x_37] = x_38; + int const x_39 = x_8.x_GLF_uniform_int_values.arr[8].el; + int const x_40 = x_8.x_GLF_uniform_int_values.arr[8].el; + ref.arr[x_39] = x_40; + int const x_41 = x_8.x_GLF_uniform_int_values.arr[9].el; + int const x_42 = x_8.x_GLF_uniform_int_values.arr[9].el; + ref.arr[x_41] = x_42; + int const x_43 = x_8.x_GLF_uniform_int_values.arr[10].el; + int const x_44 = x_8.x_GLF_uniform_int_values.arr[10].el; + ref.arr[x_43] = x_44; + int const x_45 = x_8.x_GLF_uniform_int_values.arr[0].el; + i_1 = x_45; + while (true) { + int const x_46 = i_1; + int const x_47 = x_8.x_GLF_uniform_int_values.arr[6].el; + if ((x_46 < x_47)) { + } else { + break; + } + int const x_48 = i_1; + int const x_49 = i_1; + a_1.arr[x_48] = x_49; + int const x_50 = i_1; + int const x_51 = x_8.x_GLF_uniform_int_values.arr[6].el; + int const x_52 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_50 < (x_51 / x_52))) { + int const x_54 = i_1; + int const x_55 = i_1; + int const x_56 = x_8.x_GLF_uniform_int_values.arr[1].el; + a_1.arr[x_54] = (x_55 + x_56); + int const x_58 = i_1; + int const x_59 = x_8.x_GLF_uniform_int_values.arr[6].el; + if ((x_58 < x_59)) { + { + int const x_79 = i_1; + i_1 = (x_79 + 1); + } + continue; + } + int const x_60 = i_1; + int const x_61 = i_1; + int const x_62 = x_8.x_GLF_uniform_int_values.arr[8].el; + a_1.arr[x_60] = (x_61 + x_62); + int const x_64 = i_1; + int const x_65 = a_1.arr[x_64]; + param = x_65; + int const x_66 = f_i1_(x_8, &(param)); + int const x_67 = x_8.x_GLF_uniform_int_values.arr[8].el; + if ((x_66 < x_67)) { + int const x_68 = i_1; + int const x_182_save = x_68; + int const x_69 = a_1.arr[x_182_save]; + a_1.arr[x_182_save] = (x_69 - 1); + } + } else { + int const x_71 = i_1; + int const x_72 = a_1.arr[x_71]; + param_1 = x_72; + int const x_73 = f_i1_(x_8, &(param_1)); + int const x_74 = x_8.x_GLF_uniform_int_values.arr[8].el; + if ((x_73 < x_74)) { + int const x_75 = i_1; + int const x_76 = x_8.x_GLF_uniform_int_values.arr[4].el; + int const x_77 = a_1.arr[x_75]; + a_1.arr[x_75] = (x_77 + x_76); + } + } + { + int const x_79 = i_1; + i_1 = (x_79 + 1); + } + } + int const x_81 = x_8.x_GLF_uniform_int_values.arr[0].el; + i_2 = x_81; + while (true) { + int const x_82 = i_2; + int const x_83 = x_8.x_GLF_uniform_int_values.arr[6].el; + if ((x_82 < x_83)) { + } else { + break; + } + int const x_84 = i_2; + int const x_85 = a_1.arr[x_84]; + int const x_86 = i_2; + int const x_87 = ref.arr[x_86]; + if ((x_85 != x_87)) { + int const x_88 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_205 = float(x_88); + *(tint_symbol_4) = float4(x_205, x_205, x_205, x_205); + return; + } + { + int const x_89 = i_2; + i_2 = (x_89 + 1); + } + } + int const x_91 = x_8.x_GLF_uniform_int_values.arr[11].el; + int const x_92 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_93 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_94 = x_8.x_GLF_uniform_int_values.arr[11].el; + *(tint_symbol_4) = float4(float(x_91), float(x_92), float(x_93), float(x_94)); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b54ea8d528 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.spvasm @@ -0,0 +1,371 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 257 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %f_i1_ "f_i1_" + OpName %a "a" + OpName %i "i" + OpName %main_1 "main_1" + OpName %ref "ref" + OpName %i_1 "i_1" + OpName %a_1 "a_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %i_2 "i_2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_12 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_12 = OpConstant %uint 12 +%_arr_int_uint_12 = OpTypeArray %int %uint_12 + %buf0 = OpTypeStruct %_arr_int_uint_12 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpTypeFunction %int %_ptr_Function_int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_6 = OpConstant %int 6 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %54 = OpTypeFunction %void + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %62 = OpConstantNull %_arr_int_uint_10 + %int_11 = OpConstant %int 11 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %main_out = OpTypeStruct %v4float + %245 = OpTypeFunction %void %main_out + %f_i1_ = OpFunction %int None %15 + %a = OpFunctionParameter %_ptr_Function_int + %19 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %26 = OpLoad %int %25 + OpStore %i %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_6 + %34 = OpLoad %int %33 + %35 = OpSLessThan %bool %31 %34 + OpSelectionMerge %37 None + OpBranchConditional %35 %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + OpBranch %28 + %37 = OpLabel + %40 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %43 = OpLoad %int %42 + %44 = OpSGreaterThan %bool %40 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + %48 = OpLoad %int %a + OpReturnValue %48 + %45 = OpLabel + OpBranch %29 + %29 = OpLabel + %49 = OpLoad %int %i + %51 = OpIAdd %int %49 %int_1 + OpStore %i %51 + OpBranch %27 + %28 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %53 = OpLoad %int %52 + OpReturnValue %53 + OpFunctionEnd + %main_1 = OpFunction %void None %54 + %57 = OpLabel + %ref = OpVariable %_ptr_Function__arr_int_uint_10 Function %62 + %i_1 = OpVariable %_ptr_Function_int Function %21 + %a_1 = OpVariable %_ptr_Function__arr_int_uint_10 Function %62 + %param = OpVariable %_ptr_Function_int Function %21 + %param_1 = OpVariable %_ptr_Function_int Function %21 + %i_2 = OpVariable %_ptr_Function_int Function %21 + %68 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Function_int %ref %69 + OpStore %72 %71 + %74 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_11 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Function_int %ref %75 + OpStore %78 %77 + %79 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %80 = OpLoad %int %79 + %82 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Function_int %ref %80 + OpStore %84 %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %86 = OpLoad %int %85 + %88 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Function_int %ref %86 + OpStore %90 %89 + %91 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %92 = OpLoad %int %91 + %94 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_5 + %95 = OpLoad %int %94 + %96 = OpAccessChain %_ptr_Function_int %ref %92 + OpStore %96 %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_6 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Function_int %ref %98 + OpStore %101 %100 + %102 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_5 + %103 = OpLoad %int %102 + %105 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_7 + %106 = OpLoad %int %105 + %107 = OpAccessChain %_ptr_Function_int %ref %103 + OpStore %107 %106 + %109 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_8 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_8 + %112 = OpLoad %int %111 + %113 = OpAccessChain %_ptr_Function_int %ref %110 + OpStore %113 %112 + %115 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_9 + %116 = OpLoad %int %115 + %117 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_9 + %118 = OpLoad %int %117 + %119 = OpAccessChain %_ptr_Function_int %ref %116 + OpStore %119 %118 + %121 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_10 + %122 = OpLoad %int %121 + %123 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_10 + %124 = OpLoad %int %123 + %125 = OpAccessChain %_ptr_Function_int %ref %122 + OpStore %125 %124 + %126 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %127 = OpLoad %int %126 + OpStore %i_1 %127 + OpBranch %128 + %128 = OpLabel + OpLoopMerge %129 %130 None + OpBranch %131 + %131 = OpLabel + %132 = OpLoad %int %i_1 + %133 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_6 + %134 = OpLoad %int %133 + %135 = OpSLessThan %bool %132 %134 + OpSelectionMerge %136 None + OpBranchConditional %135 %137 %138 + %137 = OpLabel + OpBranch %136 + %138 = OpLabel + OpBranch %129 + %136 = OpLabel + %139 = OpLoad %int %i_1 + %140 = OpLoad %int %i_1 + %141 = OpAccessChain %_ptr_Function_int %a_1 %139 + OpStore %141 %140 + %142 = OpLoad %int %i_1 + %143 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_6 + %144 = OpLoad %int %143 + %145 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %146 = OpLoad %int %145 + %147 = OpSDiv %int %144 %146 + %148 = OpSLessThan %bool %142 %147 + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %151 + %150 = OpLabel + %152 = OpLoad %int %i_1 + %153 = OpLoad %int %i_1 + %154 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %155 = OpLoad %int %154 + %156 = OpAccessChain %_ptr_Function_int %a_1 %152 + %157 = OpIAdd %int %153 %155 + OpStore %156 %157 + %158 = OpLoad %int %i_1 + %159 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_6 + %160 = OpLoad %int %159 + %161 = OpSLessThan %bool %158 %160 + OpSelectionMerge %162 None + OpBranchConditional %161 %163 %162 + %163 = OpLabel + OpBranch %130 + %162 = OpLabel + %164 = OpLoad %int %i_1 + %165 = OpLoad %int %i_1 + %166 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_8 + %167 = OpLoad %int %166 + %168 = OpAccessChain %_ptr_Function_int %a_1 %164 + %169 = OpIAdd %int %165 %167 + OpStore %168 %169 + %170 = OpLoad %int %i_1 + %171 = OpAccessChain %_ptr_Function_int %a_1 %170 + %172 = OpLoad %int %171 + OpStore %param %172 + %173 = OpFunctionCall %int %f_i1_ %param + %175 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_8 + %176 = OpLoad %int %175 + %177 = OpSLessThan %bool %173 %176 + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %178 + %179 = OpLabel + %180 = OpLoad %int %i_1 + %181 = OpAccessChain %_ptr_Function_int %a_1 %180 + %182 = OpLoad %int %181 + %183 = OpAccessChain %_ptr_Function_int %a_1 %180 + %184 = OpISub %int %182 %int_1 + OpStore %183 %184 + OpBranch %178 + %178 = OpLabel + OpBranch %149 + %151 = OpLabel + %185 = OpLoad %int %i_1 + %186 = OpAccessChain %_ptr_Function_int %a_1 %185 + %187 = OpLoad %int %186 + OpStore %param_1 %187 + %188 = OpFunctionCall %int %f_i1_ %param_1 + %190 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_8 + %191 = OpLoad %int %190 + %192 = OpSLessThan %bool %188 %191 + OpSelectionMerge %193 None + OpBranchConditional %192 %194 %193 + %194 = OpLabel + %195 = OpLoad %int %i_1 + %196 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4 + %197 = OpLoad %int %196 + %198 = OpAccessChain %_ptr_Function_int %a_1 %195 + %199 = OpLoad %int %198 + %200 = OpAccessChain %_ptr_Function_int %a_1 %195 + %201 = OpIAdd %int %199 %197 + OpStore %200 %201 + OpBranch %193 + %193 = OpLabel + OpBranch %149 + %149 = OpLabel + OpBranch %130 + %130 = OpLabel + %202 = OpLoad %int %i_1 + %203 = OpIAdd %int %202 %int_1 + OpStore %i_1 %203 + OpBranch %128 + %129 = OpLabel + %204 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %205 = OpLoad %int %204 + OpStore %i_2 %205 + OpBranch %206 + %206 = OpLabel + OpLoopMerge %207 %208 None + OpBranch %209 + %209 = OpLabel + %210 = OpLoad %int %i_2 + %211 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_6 + %212 = OpLoad %int %211 + %213 = OpSLessThan %bool %210 %212 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %207 + %214 = OpLabel + %217 = OpLoad %int %i_2 + %218 = OpAccessChain %_ptr_Function_int %a_1 %217 + %219 = OpLoad %int %218 + %220 = OpLoad %int %i_2 + %221 = OpAccessChain %_ptr_Function_int %ref %220 + %222 = OpLoad %int %221 + %223 = OpINotEqual %bool %219 %222 + OpSelectionMerge %224 None + OpBranchConditional %223 %225 %224 + %225 = OpLabel + %226 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %227 = OpLoad %int %226 + %228 = OpConvertSToF %float %227 + %229 = OpCompositeConstruct %v4float %228 %228 %228 %228 + OpStore %x_GLF_color %229 + OpReturn + %224 = OpLabel + OpBranch %208 + %208 = OpLabel + %230 = OpLoad %int %i_2 + %231 = OpIAdd %int %230 %int_1 + OpStore %i_2 %231 + OpBranch %206 + %207 = OpLabel + %232 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_11 + %233 = OpLoad %int %232 + %234 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %235 = OpLoad %int %234 + %236 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %237 = OpLoad %int %236 + %238 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_11 + %239 = OpLoad %int %238 + %240 = OpConvertSToF %float %233 + %241 = OpConvertSToF %float %235 + %242 = OpConvertSToF %float %237 + %243 = OpConvertSToF %float %239 + %244 = OpCompositeConstruct %v4float %240 %241 %242 %243 + OpStore %x_GLF_color %244 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %245 +%tint_symbol = OpFunctionParameter %main_out + %249 = OpLabel + %250 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %250 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %54 + %252 = OpLabel + %253 = OpFunctionCall %void %main_1 + %255 = OpLoad %v4float %x_GLF_color + %256 = OpCompositeConstruct %main_out %255 + %254 = OpFunctionCall %void %tint_symbol_2 %256 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..37cab95ad4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.spvasm.expected.wgsl @@ -0,0 +1,177 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn f_i1_(a : ptr) -> i32 { + var i : i32; + let x_16 : i32 = x_8.x_GLF_uniform_int_values[0]; + i = x_16; + loop { + let x_17 : i32 = i; + let x_18 : i32 = x_8.x_GLF_uniform_int_values[6]; + if ((x_17 < x_18)) { + } else { + break; + } + let x_19 : i32 = i; + let x_20 : i32 = x_8.x_GLF_uniform_int_values[2]; + if ((x_19 > x_20)) { + let x_21 : i32 = *(a); + return x_21; + } + + continuing { + let x_22 : i32 = i; + i = (x_22 + 1); + } + } + let x_24 : i32 = x_8.x_GLF_uniform_int_values[0]; + return x_24; +} + +fn main_1() { + var ref : array; + var i_1 : i32; + var a_1 : array; + var param : i32; + var param_1 : i32; + var i_2 : i32; + let x_25 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_26 : i32 = x_8.x_GLF_uniform_int_values[1]; + ref[x_25] = x_26; + let x_27 : i32 = x_8.x_GLF_uniform_int_values[11]; + let x_28 : i32 = x_8.x_GLF_uniform_int_values[2]; + ref[x_27] = x_28; + let x_29 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_30 : i32 = x_8.x_GLF_uniform_int_values[3]; + ref[x_29] = x_30; + let x_31 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_32 : i32 = x_8.x_GLF_uniform_int_values[4]; + ref[x_31] = x_32; + let x_33 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_34 : i32 = x_8.x_GLF_uniform_int_values[5]; + ref[x_33] = x_34; + let x_35 : i32 = x_8.x_GLF_uniform_int_values[4]; + let x_36 : i32 = x_8.x_GLF_uniform_int_values[6]; + ref[x_35] = x_36; + let x_37 : i32 = x_8.x_GLF_uniform_int_values[5]; + let x_38 : i32 = x_8.x_GLF_uniform_int_values[7]; + ref[x_37] = x_38; + let x_39 : i32 = x_8.x_GLF_uniform_int_values[8]; + let x_40 : i32 = x_8.x_GLF_uniform_int_values[8]; + ref[x_39] = x_40; + let x_41 : i32 = x_8.x_GLF_uniform_int_values[9]; + let x_42 : i32 = x_8.x_GLF_uniform_int_values[9]; + ref[x_41] = x_42; + let x_43 : i32 = x_8.x_GLF_uniform_int_values[10]; + let x_44 : i32 = x_8.x_GLF_uniform_int_values[10]; + ref[x_43] = x_44; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[0]; + i_1 = x_45; + loop { + let x_46 : i32 = i_1; + let x_47 : i32 = x_8.x_GLF_uniform_int_values[6]; + if ((x_46 < x_47)) { + } else { + break; + } + let x_48 : i32 = i_1; + let x_49 : i32 = i_1; + a_1[x_48] = x_49; + let x_50 : i32 = i_1; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[6]; + let x_52 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_50 < (x_51 / x_52))) { + let x_54 : i32 = i_1; + let x_55 : i32 = i_1; + let x_56 : i32 = x_8.x_GLF_uniform_int_values[1]; + a_1[x_54] = (x_55 + x_56); + let x_58 : i32 = i_1; + let x_59 : i32 = x_8.x_GLF_uniform_int_values[6]; + if ((x_58 < x_59)) { + continue; + } + let x_60 : i32 = i_1; + let x_61 : i32 = i_1; + let x_62 : i32 = x_8.x_GLF_uniform_int_values[8]; + a_1[x_60] = (x_61 + x_62); + let x_64 : i32 = i_1; + let x_65 : i32 = a_1[x_64]; + param = x_65; + let x_66 : i32 = f_i1_(&(param)); + let x_67 : i32 = x_8.x_GLF_uniform_int_values[8]; + if ((x_66 < x_67)) { + let x_68 : i32 = i_1; + let x_182 : ptr = &(a_1[x_68]); + let x_69 : i32 = *(x_182); + *(x_182) = (x_69 - 1); + } + } else { + let x_71 : i32 = i_1; + let x_72 : i32 = a_1[x_71]; + param_1 = x_72; + let x_73 : i32 = f_i1_(&(param_1)); + let x_74 : i32 = x_8.x_GLF_uniform_int_values[8]; + if ((x_73 < x_74)) { + let x_75 : i32 = i_1; + let x_76 : i32 = x_8.x_GLF_uniform_int_values[4]; + let x_77 : i32 = a_1[x_75]; + a_1[x_75] = (x_77 + x_76); + } + } + + continuing { + let x_79 : i32 = i_1; + i_1 = (x_79 + 1); + } + } + let x_81 : i32 = x_8.x_GLF_uniform_int_values[0]; + i_2 = x_81; + loop { + let x_82 : i32 = i_2; + let x_83 : i32 = x_8.x_GLF_uniform_int_values[6]; + if ((x_82 < x_83)) { + } else { + break; + } + let x_84 : i32 = i_2; + let x_85 : i32 = a_1[x_84]; + let x_86 : i32 = i_2; + let x_87 : i32 = ref[x_86]; + if ((x_85 != x_87)) { + let x_88 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_205 : f32 = f32(x_88); + x_GLF_color = vec4(x_205, x_205, x_205, x_205); + return; + } + + continuing { + let x_89 : i32 = i_2; + i_2 = (x_89 + 1); + } + } + let x_91 : i32 = x_8.x_GLF_uniform_int_values[11]; + let x_92 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_93 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_94 : i32 = x_8.x_GLF_uniform_int_values[11]; + x_GLF_color = vec4(f32(x_91), f32(x_92), f32(x_93), f32(x_94)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl new file mode 100644 index 0000000000..37cab95ad4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl @@ -0,0 +1,177 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn f_i1_(a : ptr) -> i32 { + var i : i32; + let x_16 : i32 = x_8.x_GLF_uniform_int_values[0]; + i = x_16; + loop { + let x_17 : i32 = i; + let x_18 : i32 = x_8.x_GLF_uniform_int_values[6]; + if ((x_17 < x_18)) { + } else { + break; + } + let x_19 : i32 = i; + let x_20 : i32 = x_8.x_GLF_uniform_int_values[2]; + if ((x_19 > x_20)) { + let x_21 : i32 = *(a); + return x_21; + } + + continuing { + let x_22 : i32 = i; + i = (x_22 + 1); + } + } + let x_24 : i32 = x_8.x_GLF_uniform_int_values[0]; + return x_24; +} + +fn main_1() { + var ref : array; + var i_1 : i32; + var a_1 : array; + var param : i32; + var param_1 : i32; + var i_2 : i32; + let x_25 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_26 : i32 = x_8.x_GLF_uniform_int_values[1]; + ref[x_25] = x_26; + let x_27 : i32 = x_8.x_GLF_uniform_int_values[11]; + let x_28 : i32 = x_8.x_GLF_uniform_int_values[2]; + ref[x_27] = x_28; + let x_29 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_30 : i32 = x_8.x_GLF_uniform_int_values[3]; + ref[x_29] = x_30; + let x_31 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_32 : i32 = x_8.x_GLF_uniform_int_values[4]; + ref[x_31] = x_32; + let x_33 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_34 : i32 = x_8.x_GLF_uniform_int_values[5]; + ref[x_33] = x_34; + let x_35 : i32 = x_8.x_GLF_uniform_int_values[4]; + let x_36 : i32 = x_8.x_GLF_uniform_int_values[6]; + ref[x_35] = x_36; + let x_37 : i32 = x_8.x_GLF_uniform_int_values[5]; + let x_38 : i32 = x_8.x_GLF_uniform_int_values[7]; + ref[x_37] = x_38; + let x_39 : i32 = x_8.x_GLF_uniform_int_values[8]; + let x_40 : i32 = x_8.x_GLF_uniform_int_values[8]; + ref[x_39] = x_40; + let x_41 : i32 = x_8.x_GLF_uniform_int_values[9]; + let x_42 : i32 = x_8.x_GLF_uniform_int_values[9]; + ref[x_41] = x_42; + let x_43 : i32 = x_8.x_GLF_uniform_int_values[10]; + let x_44 : i32 = x_8.x_GLF_uniform_int_values[10]; + ref[x_43] = x_44; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[0]; + i_1 = x_45; + loop { + let x_46 : i32 = i_1; + let x_47 : i32 = x_8.x_GLF_uniform_int_values[6]; + if ((x_46 < x_47)) { + } else { + break; + } + let x_48 : i32 = i_1; + let x_49 : i32 = i_1; + a_1[x_48] = x_49; + let x_50 : i32 = i_1; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[6]; + let x_52 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_50 < (x_51 / x_52))) { + let x_54 : i32 = i_1; + let x_55 : i32 = i_1; + let x_56 : i32 = x_8.x_GLF_uniform_int_values[1]; + a_1[x_54] = (x_55 + x_56); + let x_58 : i32 = i_1; + let x_59 : i32 = x_8.x_GLF_uniform_int_values[6]; + if ((x_58 < x_59)) { + continue; + } + let x_60 : i32 = i_1; + let x_61 : i32 = i_1; + let x_62 : i32 = x_8.x_GLF_uniform_int_values[8]; + a_1[x_60] = (x_61 + x_62); + let x_64 : i32 = i_1; + let x_65 : i32 = a_1[x_64]; + param = x_65; + let x_66 : i32 = f_i1_(&(param)); + let x_67 : i32 = x_8.x_GLF_uniform_int_values[8]; + if ((x_66 < x_67)) { + let x_68 : i32 = i_1; + let x_182 : ptr = &(a_1[x_68]); + let x_69 : i32 = *(x_182); + *(x_182) = (x_69 - 1); + } + } else { + let x_71 : i32 = i_1; + let x_72 : i32 = a_1[x_71]; + param_1 = x_72; + let x_73 : i32 = f_i1_(&(param_1)); + let x_74 : i32 = x_8.x_GLF_uniform_int_values[8]; + if ((x_73 < x_74)) { + let x_75 : i32 = i_1; + let x_76 : i32 = x_8.x_GLF_uniform_int_values[4]; + let x_77 : i32 = a_1[x_75]; + a_1[x_75] = (x_77 + x_76); + } + } + + continuing { + let x_79 : i32 = i_1; + i_1 = (x_79 + 1); + } + } + let x_81 : i32 = x_8.x_GLF_uniform_int_values[0]; + i_2 = x_81; + loop { + let x_82 : i32 = i_2; + let x_83 : i32 = x_8.x_GLF_uniform_int_values[6]; + if ((x_82 < x_83)) { + } else { + break; + } + let x_84 : i32 = i_2; + let x_85 : i32 = a_1[x_84]; + let x_86 : i32 = i_2; + let x_87 : i32 = ref[x_86]; + if ((x_85 != x_87)) { + let x_88 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_205 : f32 = f32(x_88); + x_GLF_color = vec4(x_205, x_205, x_205, x_205); + return; + } + + continuing { + let x_89 : i32 = i_2; + i_2 = (x_89 + 1); + } + } + let x_91 : i32 = x_8.x_GLF_uniform_int_values[11]; + let x_92 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_93 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_94 : i32 = x_8.x_GLF_uniform_int_values[11]; + x_GLF_color = vec4(f32(x_91), f32(x_92), f32(x_93), f32(x_94)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d5ea2b6e1f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.hlsl @@ -0,0 +1,172 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[12]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int f_i1_(inout int a) { + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_16 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + i = x_16; + while (true) { + const int x_17 = i; + const int x_18 = asint(x_8[6].x); + if ((x_17 < x_18)) { + } else { + break; + } + const int x_19 = i; + const int x_20 = asint(x_8[2].x); + if ((x_19 > x_20)) { + const int x_21 = a; + return x_21; + } + { + i = (i + 1); + } + } + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_24 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + return x_24; +} + +void main_1() { + int ref[10] = (int[10])0; + int i_1 = 0; + int a_1[10] = (int[10])0; + int param = 0; + int param_1 = 0; + int i_2 = 0; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_25 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_26 = asint(x_8[1].x); + ref[x_25] = x_26; + const int x_27 = asint(x_8[11].x); + const int x_28 = asint(x_8[2].x); + ref[x_27] = x_28; + const int x_29 = asint(x_8[1].x); + const int x_30 = asint(x_8[3].x); + ref[x_29] = x_30; + const int x_31 = asint(x_8[2].x); + const int x_32 = asint(x_8[4].x); + ref[x_31] = x_32; + const int x_33 = asint(x_8[3].x); + const int x_34 = asint(x_8[5].x); + ref[x_33] = x_34; + const int x_35 = asint(x_8[4].x); + const int x_36 = asint(x_8[6].x); + ref[x_35] = x_36; + const int x_37 = asint(x_8[5].x); + const int x_38 = asint(x_8[7].x); + ref[x_37] = x_38; + const int x_39 = asint(x_8[8].x); + const int x_40 = asint(x_8[8].x); + ref[x_39] = x_40; + const int x_41 = asint(x_8[9].x); + const int x_42 = asint(x_8[9].x); + ref[x_41] = x_42; + const int x_43 = asint(x_8[10].x); + const int x_44 = asint(x_8[10].x); + ref[x_43] = x_44; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + i_1 = x_45; + while (true) { + const int x_46 = i_1; + const int x_47 = asint(x_8[6].x); + if ((x_46 < x_47)) { + } else { + break; + } + a_1[i_1] = i_1; + const int x_50 = i_1; + const int x_51 = asint(x_8[6].x); + const int x_52 = asint(x_8[1].x); + if ((x_50 < (x_51 / x_52))) { + const int x_54 = i_1; + const int x_55 = i_1; + const int x_56 = asint(x_8[1].x); + a_1[x_54] = (x_55 + x_56); + const int x_58 = i_1; + const int x_59 = asint(x_8[6].x); + if ((x_58 < x_59)) { + { + i_1 = (i_1 + 1); + } + continue; + } + const int x_60 = i_1; + const int x_61 = i_1; + const int x_62 = asint(x_8[8].x); + a_1[x_60] = (x_61 + x_62); + const int x_65 = a_1[i_1]; + param = x_65; + const int x_66 = f_i1_(param); + const int x_67 = asint(x_8[8].x); + if ((x_66 < x_67)) { + const int x_182_save = i_1; + const int x_69 = a_1[x_182_save]; + a_1[x_182_save] = (x_69 - 1); + } + } else { + const int x_72 = a_1[i_1]; + param_1 = x_72; + const int x_73 = f_i1_(param_1); + const int x_74 = asint(x_8[8].x); + if ((x_73 < x_74)) { + const int x_75 = i_1; + const int x_76 = asint(x_8[4].x); + const int x_77 = a_1[x_75]; + a_1[x_75] = (x_77 + x_76); + } + } + { + i_1 = (i_1 + 1); + } + } + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_81 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + i_2 = x_81; + while (true) { + const int x_82 = i_2; + const int x_83 = asint(x_8[6].x); + if ((x_82 < x_83)) { + } else { + break; + } + const int x_85 = a_1[i_2]; + const int x_87 = ref[i_2]; + if ((x_85 != x_87)) { + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_88 = asint(x_8[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const float x_205 = float(x_88); + x_GLF_color = float4(x_205, x_205, x_205, x_205); + return; + } + { + i_2 = (i_2 + 1); + } + } + const int x_91 = asint(x_8[11].x); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_92 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_93 = asint(x_8[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const int x_94 = asint(x_8[11].x); + x_GLF_color = float4(float(x_91), float(x_92), float(x_93), float(x_94)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..6399b00769 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.msl @@ -0,0 +1,188 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[12]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int f_i1_(constant buf0& x_8, thread int* const a) { + int i = 0; + int const x_16 = x_8.x_GLF_uniform_int_values.arr[0].el; + i = x_16; + while (true) { + int const x_17 = i; + int const x_18 = x_8.x_GLF_uniform_int_values.arr[6].el; + if ((x_17 < x_18)) { + } else { + break; + } + int const x_19 = i; + int const x_20 = x_8.x_GLF_uniform_int_values.arr[2].el; + if ((x_19 > x_20)) { + int const x_21 = *(a); + return x_21; + } + { + int const x_22 = i; + i = (x_22 + 1); + } + } + int const x_24 = x_8.x_GLF_uniform_int_values.arr[0].el; + return x_24; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + tint_array_wrapper_1 ref = {}; + int i_1 = 0; + tint_array_wrapper_1 a_1 = {}; + int param = 0; + int param_1 = 0; + int i_2 = 0; + int const x_25 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_26 = x_8.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_25] = x_26; + int const x_27 = x_8.x_GLF_uniform_int_values.arr[11].el; + int const x_28 = x_8.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_27] = x_28; + int const x_29 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_30 = x_8.x_GLF_uniform_int_values.arr[3].el; + ref.arr[x_29] = x_30; + int const x_31 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_32 = x_8.x_GLF_uniform_int_values.arr[4].el; + ref.arr[x_31] = x_32; + int const x_33 = x_8.x_GLF_uniform_int_values.arr[3].el; + int const x_34 = x_8.x_GLF_uniform_int_values.arr[5].el; + ref.arr[x_33] = x_34; + int const x_35 = x_8.x_GLF_uniform_int_values.arr[4].el; + int const x_36 = x_8.x_GLF_uniform_int_values.arr[6].el; + ref.arr[x_35] = x_36; + int const x_37 = x_8.x_GLF_uniform_int_values.arr[5].el; + int const x_38 = x_8.x_GLF_uniform_int_values.arr[7].el; + ref.arr[x_37] = x_38; + int const x_39 = x_8.x_GLF_uniform_int_values.arr[8].el; + int const x_40 = x_8.x_GLF_uniform_int_values.arr[8].el; + ref.arr[x_39] = x_40; + int const x_41 = x_8.x_GLF_uniform_int_values.arr[9].el; + int const x_42 = x_8.x_GLF_uniform_int_values.arr[9].el; + ref.arr[x_41] = x_42; + int const x_43 = x_8.x_GLF_uniform_int_values.arr[10].el; + int const x_44 = x_8.x_GLF_uniform_int_values.arr[10].el; + ref.arr[x_43] = x_44; + int const x_45 = x_8.x_GLF_uniform_int_values.arr[0].el; + i_1 = x_45; + while (true) { + int const x_46 = i_1; + int const x_47 = x_8.x_GLF_uniform_int_values.arr[6].el; + if ((x_46 < x_47)) { + } else { + break; + } + int const x_48 = i_1; + int const x_49 = i_1; + a_1.arr[x_48] = x_49; + int const x_50 = i_1; + int const x_51 = x_8.x_GLF_uniform_int_values.arr[6].el; + int const x_52 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_50 < (x_51 / x_52))) { + int const x_54 = i_1; + int const x_55 = i_1; + int const x_56 = x_8.x_GLF_uniform_int_values.arr[1].el; + a_1.arr[x_54] = (x_55 + x_56); + int const x_58 = i_1; + int const x_59 = x_8.x_GLF_uniform_int_values.arr[6].el; + if ((x_58 < x_59)) { + { + int const x_79 = i_1; + i_1 = (x_79 + 1); + } + continue; + } + int const x_60 = i_1; + int const x_61 = i_1; + int const x_62 = x_8.x_GLF_uniform_int_values.arr[8].el; + a_1.arr[x_60] = (x_61 + x_62); + int const x_64 = i_1; + int const x_65 = a_1.arr[x_64]; + param = x_65; + int const x_66 = f_i1_(x_8, &(param)); + int const x_67 = x_8.x_GLF_uniform_int_values.arr[8].el; + if ((x_66 < x_67)) { + int const x_68 = i_1; + int const x_182_save = x_68; + int const x_69 = a_1.arr[x_182_save]; + a_1.arr[x_182_save] = (x_69 - 1); + } + } else { + int const x_71 = i_1; + int const x_72 = a_1.arr[x_71]; + param_1 = x_72; + int const x_73 = f_i1_(x_8, &(param_1)); + int const x_74 = x_8.x_GLF_uniform_int_values.arr[8].el; + if ((x_73 < x_74)) { + int const x_75 = i_1; + int const x_76 = x_8.x_GLF_uniform_int_values.arr[4].el; + int const x_77 = a_1.arr[x_75]; + a_1.arr[x_75] = (x_77 + x_76); + } + } + { + int const x_79 = i_1; + i_1 = (x_79 + 1); + } + } + int const x_81 = x_8.x_GLF_uniform_int_values.arr[0].el; + i_2 = x_81; + while (true) { + int const x_82 = i_2; + int const x_83 = x_8.x_GLF_uniform_int_values.arr[6].el; + if ((x_82 < x_83)) { + } else { + break; + } + int const x_84 = i_2; + int const x_85 = a_1.arr[x_84]; + int const x_86 = i_2; + int const x_87 = ref.arr[x_86]; + if ((x_85 != x_87)) { + int const x_88 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_205 = float(x_88); + *(tint_symbol_4) = float4(x_205, x_205, x_205, x_205); + return; + } + { + int const x_89 = i_2; + i_2 = (x_89 + 1); + } + } + int const x_91 = x_8.x_GLF_uniform_int_values.arr[11].el; + int const x_92 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_93 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_94 = x_8.x_GLF_uniform_int_values.arr[11].el; + *(tint_symbol_4) = float4(float(x_91), float(x_92), float(x_93), float(x_94)); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b54ea8d528 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.spvasm @@ -0,0 +1,371 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 257 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %f_i1_ "f_i1_" + OpName %a "a" + OpName %i "i" + OpName %main_1 "main_1" + OpName %ref "ref" + OpName %i_1 "i_1" + OpName %a_1 "a_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %i_2 "i_2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_12 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_12 = OpConstant %uint 12 +%_arr_int_uint_12 = OpTypeArray %int %uint_12 + %buf0 = OpTypeStruct %_arr_int_uint_12 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpTypeFunction %int %_ptr_Function_int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_6 = OpConstant %int 6 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %54 = OpTypeFunction %void + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %62 = OpConstantNull %_arr_int_uint_10 + %int_11 = OpConstant %int 11 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %main_out = OpTypeStruct %v4float + %245 = OpTypeFunction %void %main_out + %f_i1_ = OpFunction %int None %15 + %a = OpFunctionParameter %_ptr_Function_int + %19 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %26 = OpLoad %int %25 + OpStore %i %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %int %i + %33 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_6 + %34 = OpLoad %int %33 + %35 = OpSLessThan %bool %31 %34 + OpSelectionMerge %37 None + OpBranchConditional %35 %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + OpBranch %28 + %37 = OpLabel + %40 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %43 = OpLoad %int %42 + %44 = OpSGreaterThan %bool %40 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + %48 = OpLoad %int %a + OpReturnValue %48 + %45 = OpLabel + OpBranch %29 + %29 = OpLabel + %49 = OpLoad %int %i + %51 = OpIAdd %int %49 %int_1 + OpStore %i %51 + OpBranch %27 + %28 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %53 = OpLoad %int %52 + OpReturnValue %53 + OpFunctionEnd + %main_1 = OpFunction %void None %54 + %57 = OpLabel + %ref = OpVariable %_ptr_Function__arr_int_uint_10 Function %62 + %i_1 = OpVariable %_ptr_Function_int Function %21 + %a_1 = OpVariable %_ptr_Function__arr_int_uint_10 Function %62 + %param = OpVariable %_ptr_Function_int Function %21 + %param_1 = OpVariable %_ptr_Function_int Function %21 + %i_2 = OpVariable %_ptr_Function_int Function %21 + %68 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Function_int %ref %69 + OpStore %72 %71 + %74 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_11 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Function_int %ref %75 + OpStore %78 %77 + %79 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %80 = OpLoad %int %79 + %82 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Function_int %ref %80 + OpStore %84 %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %86 = OpLoad %int %85 + %88 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Function_int %ref %86 + OpStore %90 %89 + %91 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %92 = OpLoad %int %91 + %94 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_5 + %95 = OpLoad %int %94 + %96 = OpAccessChain %_ptr_Function_int %ref %92 + OpStore %96 %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_6 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Function_int %ref %98 + OpStore %101 %100 + %102 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_5 + %103 = OpLoad %int %102 + %105 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_7 + %106 = OpLoad %int %105 + %107 = OpAccessChain %_ptr_Function_int %ref %103 + OpStore %107 %106 + %109 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_8 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_8 + %112 = OpLoad %int %111 + %113 = OpAccessChain %_ptr_Function_int %ref %110 + OpStore %113 %112 + %115 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_9 + %116 = OpLoad %int %115 + %117 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_9 + %118 = OpLoad %int %117 + %119 = OpAccessChain %_ptr_Function_int %ref %116 + OpStore %119 %118 + %121 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_10 + %122 = OpLoad %int %121 + %123 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_10 + %124 = OpLoad %int %123 + %125 = OpAccessChain %_ptr_Function_int %ref %122 + OpStore %125 %124 + %126 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %127 = OpLoad %int %126 + OpStore %i_1 %127 + OpBranch %128 + %128 = OpLabel + OpLoopMerge %129 %130 None + OpBranch %131 + %131 = OpLabel + %132 = OpLoad %int %i_1 + %133 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_6 + %134 = OpLoad %int %133 + %135 = OpSLessThan %bool %132 %134 + OpSelectionMerge %136 None + OpBranchConditional %135 %137 %138 + %137 = OpLabel + OpBranch %136 + %138 = OpLabel + OpBranch %129 + %136 = OpLabel + %139 = OpLoad %int %i_1 + %140 = OpLoad %int %i_1 + %141 = OpAccessChain %_ptr_Function_int %a_1 %139 + OpStore %141 %140 + %142 = OpLoad %int %i_1 + %143 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_6 + %144 = OpLoad %int %143 + %145 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %146 = OpLoad %int %145 + %147 = OpSDiv %int %144 %146 + %148 = OpSLessThan %bool %142 %147 + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %151 + %150 = OpLabel + %152 = OpLoad %int %i_1 + %153 = OpLoad %int %i_1 + %154 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %155 = OpLoad %int %154 + %156 = OpAccessChain %_ptr_Function_int %a_1 %152 + %157 = OpIAdd %int %153 %155 + OpStore %156 %157 + %158 = OpLoad %int %i_1 + %159 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_6 + %160 = OpLoad %int %159 + %161 = OpSLessThan %bool %158 %160 + OpSelectionMerge %162 None + OpBranchConditional %161 %163 %162 + %163 = OpLabel + OpBranch %130 + %162 = OpLabel + %164 = OpLoad %int %i_1 + %165 = OpLoad %int %i_1 + %166 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_8 + %167 = OpLoad %int %166 + %168 = OpAccessChain %_ptr_Function_int %a_1 %164 + %169 = OpIAdd %int %165 %167 + OpStore %168 %169 + %170 = OpLoad %int %i_1 + %171 = OpAccessChain %_ptr_Function_int %a_1 %170 + %172 = OpLoad %int %171 + OpStore %param %172 + %173 = OpFunctionCall %int %f_i1_ %param + %175 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_8 + %176 = OpLoad %int %175 + %177 = OpSLessThan %bool %173 %176 + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %178 + %179 = OpLabel + %180 = OpLoad %int %i_1 + %181 = OpAccessChain %_ptr_Function_int %a_1 %180 + %182 = OpLoad %int %181 + %183 = OpAccessChain %_ptr_Function_int %a_1 %180 + %184 = OpISub %int %182 %int_1 + OpStore %183 %184 + OpBranch %178 + %178 = OpLabel + OpBranch %149 + %151 = OpLabel + %185 = OpLoad %int %i_1 + %186 = OpAccessChain %_ptr_Function_int %a_1 %185 + %187 = OpLoad %int %186 + OpStore %param_1 %187 + %188 = OpFunctionCall %int %f_i1_ %param_1 + %190 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_8 + %191 = OpLoad %int %190 + %192 = OpSLessThan %bool %188 %191 + OpSelectionMerge %193 None + OpBranchConditional %192 %194 %193 + %194 = OpLabel + %195 = OpLoad %int %i_1 + %196 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4 + %197 = OpLoad %int %196 + %198 = OpAccessChain %_ptr_Function_int %a_1 %195 + %199 = OpLoad %int %198 + %200 = OpAccessChain %_ptr_Function_int %a_1 %195 + %201 = OpIAdd %int %199 %197 + OpStore %200 %201 + OpBranch %193 + %193 = OpLabel + OpBranch %149 + %149 = OpLabel + OpBranch %130 + %130 = OpLabel + %202 = OpLoad %int %i_1 + %203 = OpIAdd %int %202 %int_1 + OpStore %i_1 %203 + OpBranch %128 + %129 = OpLabel + %204 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %205 = OpLoad %int %204 + OpStore %i_2 %205 + OpBranch %206 + %206 = OpLabel + OpLoopMerge %207 %208 None + OpBranch %209 + %209 = OpLabel + %210 = OpLoad %int %i_2 + %211 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_6 + %212 = OpLoad %int %211 + %213 = OpSLessThan %bool %210 %212 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %207 + %214 = OpLabel + %217 = OpLoad %int %i_2 + %218 = OpAccessChain %_ptr_Function_int %a_1 %217 + %219 = OpLoad %int %218 + %220 = OpLoad %int %i_2 + %221 = OpAccessChain %_ptr_Function_int %ref %220 + %222 = OpLoad %int %221 + %223 = OpINotEqual %bool %219 %222 + OpSelectionMerge %224 None + OpBranchConditional %223 %225 %224 + %225 = OpLabel + %226 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %227 = OpLoad %int %226 + %228 = OpConvertSToF %float %227 + %229 = OpCompositeConstruct %v4float %228 %228 %228 %228 + OpStore %x_GLF_color %229 + OpReturn + %224 = OpLabel + OpBranch %208 + %208 = OpLabel + %230 = OpLoad %int %i_2 + %231 = OpIAdd %int %230 %int_1 + OpStore %i_2 %231 + OpBranch %206 + %207 = OpLabel + %232 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_11 + %233 = OpLoad %int %232 + %234 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %235 = OpLoad %int %234 + %236 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %237 = OpLoad %int %236 + %238 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_11 + %239 = OpLoad %int %238 + %240 = OpConvertSToF %float %233 + %241 = OpConvertSToF %float %235 + %242 = OpConvertSToF %float %237 + %243 = OpConvertSToF %float %239 + %244 = OpCompositeConstruct %v4float %240 %241 %242 %243 + OpStore %x_GLF_color %244 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %245 +%tint_symbol = OpFunctionParameter %main_out + %249 = OpLabel + %250 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %250 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %54 + %252 = OpLabel + %253 = OpFunctionCall %void %main_1 + %255 = OpLoad %v4float %x_GLF_color + %256 = OpCompositeConstruct %main_out %255 + %254 = OpFunctionCall %void %tint_symbol_2 %256 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..37cab95ad4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-inst-combine-calls-for-compare-function-call-result/0-opt.wgsl.expected.wgsl @@ -0,0 +1,177 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn f_i1_(a : ptr) -> i32 { + var i : i32; + let x_16 : i32 = x_8.x_GLF_uniform_int_values[0]; + i = x_16; + loop { + let x_17 : i32 = i; + let x_18 : i32 = x_8.x_GLF_uniform_int_values[6]; + if ((x_17 < x_18)) { + } else { + break; + } + let x_19 : i32 = i; + let x_20 : i32 = x_8.x_GLF_uniform_int_values[2]; + if ((x_19 > x_20)) { + let x_21 : i32 = *(a); + return x_21; + } + + continuing { + let x_22 : i32 = i; + i = (x_22 + 1); + } + } + let x_24 : i32 = x_8.x_GLF_uniform_int_values[0]; + return x_24; +} + +fn main_1() { + var ref : array; + var i_1 : i32; + var a_1 : array; + var param : i32; + var param_1 : i32; + var i_2 : i32; + let x_25 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_26 : i32 = x_8.x_GLF_uniform_int_values[1]; + ref[x_25] = x_26; + let x_27 : i32 = x_8.x_GLF_uniform_int_values[11]; + let x_28 : i32 = x_8.x_GLF_uniform_int_values[2]; + ref[x_27] = x_28; + let x_29 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_30 : i32 = x_8.x_GLF_uniform_int_values[3]; + ref[x_29] = x_30; + let x_31 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_32 : i32 = x_8.x_GLF_uniform_int_values[4]; + ref[x_31] = x_32; + let x_33 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_34 : i32 = x_8.x_GLF_uniform_int_values[5]; + ref[x_33] = x_34; + let x_35 : i32 = x_8.x_GLF_uniform_int_values[4]; + let x_36 : i32 = x_8.x_GLF_uniform_int_values[6]; + ref[x_35] = x_36; + let x_37 : i32 = x_8.x_GLF_uniform_int_values[5]; + let x_38 : i32 = x_8.x_GLF_uniform_int_values[7]; + ref[x_37] = x_38; + let x_39 : i32 = x_8.x_GLF_uniform_int_values[8]; + let x_40 : i32 = x_8.x_GLF_uniform_int_values[8]; + ref[x_39] = x_40; + let x_41 : i32 = x_8.x_GLF_uniform_int_values[9]; + let x_42 : i32 = x_8.x_GLF_uniform_int_values[9]; + ref[x_41] = x_42; + let x_43 : i32 = x_8.x_GLF_uniform_int_values[10]; + let x_44 : i32 = x_8.x_GLF_uniform_int_values[10]; + ref[x_43] = x_44; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[0]; + i_1 = x_45; + loop { + let x_46 : i32 = i_1; + let x_47 : i32 = x_8.x_GLF_uniform_int_values[6]; + if ((x_46 < x_47)) { + } else { + break; + } + let x_48 : i32 = i_1; + let x_49 : i32 = i_1; + a_1[x_48] = x_49; + let x_50 : i32 = i_1; + let x_51 : i32 = x_8.x_GLF_uniform_int_values[6]; + let x_52 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_50 < (x_51 / x_52))) { + let x_54 : i32 = i_1; + let x_55 : i32 = i_1; + let x_56 : i32 = x_8.x_GLF_uniform_int_values[1]; + a_1[x_54] = (x_55 + x_56); + let x_58 : i32 = i_1; + let x_59 : i32 = x_8.x_GLF_uniform_int_values[6]; + if ((x_58 < x_59)) { + continue; + } + let x_60 : i32 = i_1; + let x_61 : i32 = i_1; + let x_62 : i32 = x_8.x_GLF_uniform_int_values[8]; + a_1[x_60] = (x_61 + x_62); + let x_64 : i32 = i_1; + let x_65 : i32 = a_1[x_64]; + param = x_65; + let x_66 : i32 = f_i1_(&(param)); + let x_67 : i32 = x_8.x_GLF_uniform_int_values[8]; + if ((x_66 < x_67)) { + let x_68 : i32 = i_1; + let x_182 : ptr = &(a_1[x_68]); + let x_69 : i32 = *(x_182); + *(x_182) = (x_69 - 1); + } + } else { + let x_71 : i32 = i_1; + let x_72 : i32 = a_1[x_71]; + param_1 = x_72; + let x_73 : i32 = f_i1_(&(param_1)); + let x_74 : i32 = x_8.x_GLF_uniform_int_values[8]; + if ((x_73 < x_74)) { + let x_75 : i32 = i_1; + let x_76 : i32 = x_8.x_GLF_uniform_int_values[4]; + let x_77 : i32 = a_1[x_75]; + a_1[x_75] = (x_77 + x_76); + } + } + + continuing { + let x_79 : i32 = i_1; + i_1 = (x_79 + 1); + } + } + let x_81 : i32 = x_8.x_GLF_uniform_int_values[0]; + i_2 = x_81; + loop { + let x_82 : i32 = i_2; + let x_83 : i32 = x_8.x_GLF_uniform_int_values[6]; + if ((x_82 < x_83)) { + } else { + break; + } + let x_84 : i32 = i_2; + let x_85 : i32 = a_1[x_84]; + let x_86 : i32 = i_2; + let x_87 : i32 = ref[x_86]; + if ((x_85 != x_87)) { + let x_88 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_205 : f32 = f32(x_88); + x_GLF_color = vec4(x_205, x_205, x_205, x_205); + return; + } + + continuing { + let x_89 : i32 = i_2; + i_2 = (x_89 + 1); + } + } + let x_91 : i32 = x_8.x_GLF_uniform_int_values[11]; + let x_92 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_93 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_94 : i32 = x_8.x_GLF_uniform_int_values[11]; + x_GLF_color = vec4(f32(x_91), f32(x_92), f32(x_93), f32(x_94)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm new file mode 100644 index 0000000000..7349452ca9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm @@ -0,0 +1,93 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %a "a" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %16 + %34 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %10 = OpLoad %int %35 + %36 = OpConvertSToF %float %10 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %11 = OpLoad %int %37 + %38 = OpConvertSToF %float %11 + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %12 = OpLoad %int %39 + %40 = OpConvertSToF %float %12 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %13 = OpLoad %int %41 + %42 = OpConvertSToF %float %13 + %43 = OpCompositeConstruct %v4float %36 %38 %40 %42 + OpStore %_GLF_color %43 + %44 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %45 = OpLoad %float %44 + %46 = OpFMod %float %45 %float_0x1_8p_128 + OpStore %a %46 + %47 = OpLoad %float %a + %48 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %49 = OpLoad %float %48 + %50 = OpFOrdNotEqual %bool %47 %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %54 = OpLoad %float %53 + %55 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_1 + OpStore %55 %54 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..67f50ffefd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.hlsl @@ -0,0 +1,43 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; + +void main_1() { + float a = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_10 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_11 = asint(x_5[1].x); + const int x_12 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_13 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_10), float(x_11), float(x_12), float(x_13)); + const float x_45 = asfloat(x_8[1].x); + a = (x_45 % asfloat(0x7fc00000u)); + const float x_47 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_49 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_47 != x_49)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_54 = asfloat(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color.y = x_54; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.msl new file mode 100755 index 0000000000..c3188c0f04 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.msl @@ -0,0 +1,63 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, constant buf1& x_8, thread float4* const tint_symbol_4) { + float a = 0.0f; + int const x_10 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_11 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_12 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_13 = x_5.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_10), float(x_11), float(x_12), float(x_13)); + float const x_45 = x_8.x_GLF_uniform_float_values.arr[1].el; + a = (x_45 % NAN); + float const x_47 = a; + float const x_49 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_47 != x_49)) { + float const x_54 = x_8.x_GLF_uniform_float_values.arr[0].el; + (*(tint_symbol_4)).y = x_54; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +T:\tmp\ubcg.0.metal:39:13: error: invalid operands to binary expression ('const float' and 'float') + a = (x_45 % NAN); + ~~~~ ^ ~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4c857a172d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.spvasm @@ -0,0 +1,122 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %60 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %a = OpVariable %_ptr_Function_float Function %25 + %29 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %30 = OpLoad %int %29 + %32 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %33 = OpLoad %int %32 + %34 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %35 = OpLoad %int %34 + %36 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpConvertSToF %float %30 + %39 = OpConvertSToF %float %33 + %40 = OpConvertSToF %float %35 + %41 = OpConvertSToF %float %37 + %42 = OpCompositeConstruct %v4float %38 %39 %40 %41 + OpStore %x_GLF_color %42 + %44 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %45 = OpLoad %float %44 + %47 = OpFMod %float %45 %float_0x1_8p_128 + OpStore %a %47 + %48 = OpLoad %float %a + %49 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %50 = OpLoad %float %49 + %51 = OpFOrdNotEqual %bool %48 %50 + OpSelectionMerge %53 None + OpBranchConditional %51 %54 %53 + %54 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %56 = OpLoad %float %55 + %59 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + OpStore %59 %56 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %60 +%tint_symbol = OpFunctionParameter %main_out + %64 = OpLabel + %65 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %65 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %67 = OpLabel + %68 = OpFunctionCall %void %main_1 + %70 = OpLoad %v4float %x_GLF_color + %71 = OpCompositeConstruct %main_out %70 + %69 = OpFunctionCall %void %tint_symbol_2 %71 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b317f987cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.spvasm.expected.wgsl @@ -0,0 +1,48 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var a : f32; + let x_10 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_11 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_12 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_13 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_10), f32(x_11), f32(x_12), f32(x_13)); + let x_45 : f32 = x_8.x_GLF_uniform_float_values[1]; + a = (x_45 % 0x1.8p+128); + let x_47 : f32 = a; + let x_49 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_47 != x_49)) { + let x_54 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color.y = x_54; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl new file mode 100644 index 0000000000..b317f987cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl @@ -0,0 +1,48 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var a : f32; + let x_10 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_11 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_12 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_13 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_10), f32(x_11), f32(x_12), f32(x_13)); + let x_45 : f32 = x_8.x_GLF_uniform_float_values[1]; + a = (x_45 % 0x1.8p+128); + let x_47 : f32 = a; + let x_49 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_47 != x_49)) { + let x_54 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color.y = x_54; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d8c4e9b431 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.hlsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl:29:18 error: expected ')' + a = (x_45 % 0x1.8p+128); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d8c4e9b431 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.msl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl:29:18 error: expected ')' + a = (x_45 % 0x1.8p+128); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..d8c4e9b431 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.spvasm @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl:29:18 error: expected ')' + a = (x_45 % 0x1.8p+128); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..d8c4e9b431 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-instruction-simplify-mod-acos-undefined/0-opt.wgsl:29:18 error: expected ')' + a = (x_45 % 0x1.8p+128); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm new file mode 100644 index 0000000000..4be551c61b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm @@ -0,0 +1,93 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %a "a" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float +%float_n0x1_8p_128 = OpConstant %float -0x1.8p+128 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %16 + %34 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %10 = OpLoad %int %35 + %36 = OpConvertSToF %float %10 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %11 = OpLoad %int %37 + %38 = OpConvertSToF %float %11 + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %12 = OpLoad %int %39 + %40 = OpConvertSToF %float %12 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %13 = OpLoad %int %41 + %42 = OpConvertSToF %float %13 + %43 = OpCompositeConstruct %v4float %36 %38 %40 %42 + OpStore %_GLF_color %43 + %44 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %45 = OpLoad %float %44 + %46 = OpFMod %float %float_n0x1_8p_128 %45 + OpStore %a %46 + %47 = OpLoad %float %a + %48 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %49 = OpLoad %float %48 + %50 = OpFOrdNotEqual %bool %47 %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %54 = OpLoad %float %53 + %55 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_1 + OpStore %55 %54 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..420ed9d26c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.hlsl @@ -0,0 +1,43 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; + +void main_1() { + float a = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_10 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_11 = asint(x_5[1].x); + const int x_12 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_13 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_10), float(x_11), float(x_12), float(x_13)); + const float x_45 = asfloat(x_8[1].x); + a = (asfloat(0x7fc00000u) % x_45); + const float x_47 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_49 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_47 != x_49)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_54 = asfloat(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color.y = x_54; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.msl new file mode 100755 index 0000000000..915b6d5e3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.msl @@ -0,0 +1,63 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, constant buf1& x_8, thread float4* const tint_symbol_4) { + float a = 0.0f; + int const x_10 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_11 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_12 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_13 = x_5.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_10), float(x_11), float(x_12), float(x_13)); + float const x_45 = x_8.x_GLF_uniform_float_values.arr[1].el; + a = (NAN % x_45); + float const x_47 = a; + float const x_49 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_47 != x_49)) { + float const x_54 = x_8.x_GLF_uniform_float_values.arr[0].el; + (*(tint_symbol_4)).y = x_54; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +T:\tmp\uc6w.0.metal:39:12: error: invalid operands to binary expression ('float' and 'const float') + a = (NAN % x_45); + ~~~ ^ ~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e69f89ad3f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.spvasm @@ -0,0 +1,122 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_n0x1_8p_128 = OpConstant %float -0x1.8p+128 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %60 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %a = OpVariable %_ptr_Function_float Function %25 + %29 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %30 = OpLoad %int %29 + %32 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %33 = OpLoad %int %32 + %34 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %35 = OpLoad %int %34 + %36 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpConvertSToF %float %30 + %39 = OpConvertSToF %float %33 + %40 = OpConvertSToF %float %35 + %41 = OpConvertSToF %float %37 + %42 = OpCompositeConstruct %v4float %38 %39 %40 %41 + OpStore %x_GLF_color %42 + %44 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %45 = OpLoad %float %44 + %47 = OpFMod %float %float_n0x1_8p_128 %45 + OpStore %a %47 + %48 = OpLoad %float %a + %49 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %50 = OpLoad %float %49 + %51 = OpFOrdNotEqual %bool %48 %50 + OpSelectionMerge %53 None + OpBranchConditional %51 %54 %53 + %54 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %56 = OpLoad %float %55 + %59 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + OpStore %59 %56 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %60 +%tint_symbol = OpFunctionParameter %main_out + %64 = OpLabel + %65 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %65 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %67 = OpLabel + %68 = OpFunctionCall %void %main_1 + %70 = OpLoad %v4float %x_GLF_color + %71 = OpCompositeConstruct %main_out %70 + %69 = OpFunctionCall %void %tint_symbol_2 %71 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..bf323a2bdd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.spvasm.expected.wgsl @@ -0,0 +1,48 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var a : f32; + let x_10 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_11 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_12 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_13 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_10), f32(x_11), f32(x_12), f32(x_13)); + let x_45 : f32 = x_8.x_GLF_uniform_float_values[1]; + a = (-0x1.8p+128 % x_45); + let x_47 : f32 = a; + let x_49 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_47 != x_49)) { + let x_54 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color.y = x_54; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl new file mode 100644 index 0000000000..bf323a2bdd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl @@ -0,0 +1,48 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var a : f32; + let x_10 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_11 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_12 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_13 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_10), f32(x_11), f32(x_12), f32(x_13)); + let x_45 : f32 = x_8.x_GLF_uniform_float_values[1]; + a = (-0x1.8p+128 % x_45); + let x_47 : f32 = a; + let x_49 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_47 != x_49)) { + let x_54 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color.y = x_54; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..4302ba9e45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.hlsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl:29:12 error: expected ')' + a = (-0x1.8p+128 % x_45); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4302ba9e45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.msl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl:29:12 error: expected ')' + a = (-0x1.8p+128 % x_45); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4302ba9e45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.spvasm @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl:29:12 error: expected ')' + a = (-0x1.8p+128 % x_45); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..4302ba9e45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-instruction-simplify-mod-sqrt-undefined/0-opt.wgsl:29:12 error: expected ')' + a = (-0x1.8p+128 % x_45); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm new file mode 100644 index 0000000000..f4245f8285 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm @@ -0,0 +1,80 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 RelaxedPrecision + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_n1 = OpConstant %float -1 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %14 + %29 = OpLabel + %30 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %31 = OpLoad %float %30 + %32 = OpExtInst %float %1 Sqrt %31 + %33 = OpFOrdLessThan %bool %32 %float_n1 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %36 + %35 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %10 = OpLoad %int %37 + %38 = OpConvertSToF %float %10 + %39 = OpCompositeConstruct %v4float %38 %38 %38 %38 + OpStore %_GLF_color %39 + OpBranch %34 + %36 = OpLabel + %40 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %11 = OpLoad %int %40 + %41 = OpConvertSToF %float %11 + %42 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %12 = OpLoad %int %42 + %43 = OpConvertSToF %float %12 + %44 = OpCompositeConstruct %v4float %41 %43 %43 %41 + OpStore %_GLF_color %44 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..633dded2ed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.hlsl @@ -0,0 +1,39 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; + +void main_1() { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_31 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + if ((sqrt(x_31) < -1.0f)) { + const int x_10 = asint(x_7[1].x); + const float x_38 = float(x_10); + x_GLF_color = float4(x_38, x_38, x_38, x_38); + } else { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_11 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_41 = float(x_11); + const int x_12 = asint(x_7[1].x); + const float x_43 = float(x_12); + x_GLF_color = float4(x_41, x_43, x_43, x_41); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.msl new file mode 100644 index 0000000000..b7aac08cda --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, constant buf1& x_7, thread float4* const tint_symbol_4) { + float const x_31 = x_5.x_GLF_uniform_float_values.arr[0].el; + if ((sqrt(x_31) < -1.0f)) { + int const x_10 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_38 = float(x_10); + *(tint_symbol_4) = float4(x_38, x_38, x_38, x_38); + } else { + int const x_11 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_41 = float(x_11); + int const x_12 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_43 = float(x_12); + *(tint_symbol_4) = float4(x_41, x_43, x_43, x_41); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]], constant buf1& x_7 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..c60208013e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %29 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_n1 = OpConstant %float -1 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %26 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %27 = OpLoad %float %26 + %28 = OpExtInst %float %29 Sqrt %27 + %31 = OpFOrdLessThan %bool %28 %float_n1 + OpSelectionMerge %33 None + OpBranchConditional %31 %34 %35 + %34 = OpLabel + %38 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %39 = OpLoad %int %38 + %40 = OpConvertSToF %float %39 + %41 = OpCompositeConstruct %v4float %40 %40 %40 %40 + OpStore %x_GLF_color %41 + OpBranch %33 + %35 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpCompositeConstruct %v4float %44 %47 %47 %44 + OpStore %x_GLF_color %48 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %49 +%tint_symbol = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %56 = OpLabel + %57 = OpFunctionCall %void %main_1 + %59 = OpLoad %v4float %x_GLF_color + %60 = OpCompositeConstruct %main_out %59 + %58 = OpFunctionCall %void %tint_symbol_2 %60 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..0deb2a8df5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.spvasm.expected.wgsl @@ -0,0 +1,46 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +fn main_1() { + let x_31 : f32 = x_5.x_GLF_uniform_float_values[0]; + if ((sqrt(x_31) < -1.0)) { + let x_10 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_38 : f32 = f32(x_10); + x_GLF_color = vec4(x_38, x_38, x_38, x_38); + } else { + let x_11 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_41 : f32 = f32(x_11); + let x_12 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_43 : f32 = f32(x_12); + x_GLF_color = vec4(x_41, x_43, x_43, x_41); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl new file mode 100644 index 0000000000..0deb2a8df5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl @@ -0,0 +1,46 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +fn main_1() { + let x_31 : f32 = x_5.x_GLF_uniform_float_values[0]; + if ((sqrt(x_31) < -1.0)) { + let x_10 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_38 : f32 = f32(x_10); + x_GLF_color = vec4(x_38, x_38, x_38, x_38); + } else { + let x_11 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_41 : f32 = f32(x_11); + let x_12 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_43 : f32 = f32(x_12); + x_GLF_color = vec4(x_41, x_43, x_43, x_41); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..633dded2ed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.hlsl @@ -0,0 +1,39 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; + +void main_1() { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_31 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + if ((sqrt(x_31) < -1.0f)) { + const int x_10 = asint(x_7[1].x); + const float x_38 = float(x_10); + x_GLF_color = float4(x_38, x_38, x_38, x_38); + } else { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_11 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_41 = float(x_11); + const int x_12 = asint(x_7[1].x); + const float x_43 = float(x_12); + x_GLF_color = float4(x_41, x_43, x_43, x_41); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.msl new file mode 100644 index 0000000000..b7aac08cda --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, constant buf1& x_7, thread float4* const tint_symbol_4) { + float const x_31 = x_5.x_GLF_uniform_float_values.arr[0].el; + if ((sqrt(x_31) < -1.0f)) { + int const x_10 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_38 = float(x_10); + *(tint_symbol_4) = float4(x_38, x_38, x_38, x_38); + } else { + int const x_11 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_41 = float(x_11); + int const x_12 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_43 = float(x_12); + *(tint_symbol_4) = float4(x_41, x_43, x_43, x_41); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]], constant buf1& x_7 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..c60208013e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %29 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_n1 = OpConstant %float -1 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %26 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %27 = OpLoad %float %26 + %28 = OpExtInst %float %29 Sqrt %27 + %31 = OpFOrdLessThan %bool %28 %float_n1 + OpSelectionMerge %33 None + OpBranchConditional %31 %34 %35 + %34 = OpLabel + %38 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %39 = OpLoad %int %38 + %40 = OpConvertSToF %float %39 + %41 = OpCompositeConstruct %v4float %40 %40 %40 %40 + OpStore %x_GLF_color %41 + OpBranch %33 + %35 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpCompositeConstruct %v4float %44 %47 %47 %44 + OpStore %x_GLF_color %48 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %49 +%tint_symbol = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %56 = OpLabel + %57 = OpFunctionCall %void %main_1 + %59 = OpLoad %v4float %x_GLF_color + %60 = OpCompositeConstruct %main_out %59 + %58 = OpFunctionCall %void %tint_symbol_2 %60 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..0deb2a8df5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instruction-simplify-sqrt/0.wgsl.expected.wgsl @@ -0,0 +1,46 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +fn main_1() { + let x_31 : f32 = x_5.x_GLF_uniform_float_values[0]; + if ((sqrt(x_31) < -1.0)) { + let x_10 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_38 : f32 = f32(x_10); + x_GLF_color = vec4(x_38, x_38, x_38, x_38); + } else { + let x_11 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_41 : f32 = f32(x_11); + let x_12 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_43 : f32 = f32(x_12); + x_GLF_color = vec4(x_41, x_43, x_43, x_41); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm new file mode 100644 index 0000000000..a7d1e76912 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm @@ -0,0 +1,263 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %S "S" + OpMemberName %S 0 "data" + OpName %func_struct_S_i11_ "func(struct-S-i11;" + OpName %s "s" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %i "i" + OpName %arr "arr" + OpName %i_0 "i" + OpName %param "param" + OpName %j "j" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int +%_ptr_Function_S = OpTypePointer Function %S + %21 = OpTypeFunction %void %_ptr_Function_S + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 + %uint_3 = OpConstant %uint 3 +%_arr_S_uint_3 = OpTypeArray %S %uint_3 +%_ptr_Function__arr_S_uint_3 = OpTypePointer Function %_arr_S_uint_3 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %18 + %44 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %arr = OpVariable %_ptr_Function__arr_S_uint_3 Function + %i_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_S Function + %j = OpVariable %_ptr_Function_int Function + %45 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %46 = OpLoad %int %45 + OpStore %i %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i + %52 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpSLessThan %bool %51 %53 + OpBranchConditional %54 %55 %48 + %55 = OpLabel + %56 = OpLoad %int %i + %57 = OpLoad %int %i + %58 = OpAccessChain %_ptr_Function_int %arr %56 %int_0 + OpStore %58 %57 + OpBranch %49 + %49 = OpLabel + %59 = OpLoad %int %i + %60 = OpIAdd %int %59 %int_1 + OpStore %i %60 + OpBranch %47 + %48 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %62 = OpLoad %int %61 + OpStore %i_0 %62 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpLoad %int %i_0 + %68 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %67 %69 + OpBranchConditional %70 %71 %64 + %71 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %75 = OpLoad %float %74 + %76 = OpFOrdGreaterThan %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + OpBranch %64 + %77 = OpLabel + %79 = OpLoad %int %i_0 + %80 = OpAccessChain %_ptr_Function_int %arr %79 %int_0 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %83 = OpLoad %int %82 + %84 = OpIEqual %bool %81 %83 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %87 + %86 = OpLabel + %88 = OpLoad %int %i_0 + %89 = OpAccessChain %_ptr_Function_S %arr %88 + %90 = OpLoad %S %89 + OpStore %param %90 + %91 = OpFunctionCall %void %func_struct_S_i11_ %param + %92 = OpLoad %S %param + %93 = OpAccessChain %_ptr_Function_S %arr %88 + OpStore %93 %92 + OpBranch %85 + %87 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %95 = OpLoad %int %94 + OpStore %j %95 + OpBranch %96 + %96 = OpLabel + OpLoopMerge %97 %98 None + OpBranch %99 + %99 = OpLabel + %100 = OpLoad %int %j + %101 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %102 = OpLoad %int %101 + %103 = OpSLessThan %bool %100 %102 + OpBranchConditional %103 %104 %97 + %104 = OpLabel + %105 = OpLoad %int %j + %106 = OpAccessChain %_ptr_Function_int %arr %105 %int_0 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_4 + %109 = OpLoad %int %108 + %110 = OpSGreaterThan %bool %107 %109 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %111 + %112 = OpLabel + OpKill + %111 = OpLabel + OpBranch %98 + %98 = OpLabel + %113 = OpLoad %int %j + %114 = OpIAdd %int %113 %int_1 + OpStore %j %114 + OpBranch %96 + %97 = OpLabel + OpBranch %85 + %85 = OpLabel + OpBranch %65 + %65 = OpLabel + %115 = OpLoad %int %i_0 + %116 = OpIAdd %int %115 %int_1 + OpStore %i_0 %116 + OpBranch %63 + %64 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %118 = OpLoad %int %117 + %119 = OpAccessChain %_ptr_Function_int %arr %118 %int_0 + %120 = OpLoad %int %119 + %121 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %122 = OpLoad %int %121 + %123 = OpIEqual %bool %120 %122 + OpSelectionMerge %124 None + OpBranchConditional %123 %125 %124 + %125 = OpLabel + %126 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %127 = OpLoad %int %126 + %128 = OpAccessChain %_ptr_Function_int %arr %127 %int_0 + %129 = OpLoad %int %128 + %130 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %131 = OpLoad %int %130 + %132 = OpIEqual %bool %129 %131 + OpBranch %124 + %124 = OpLabel + %133 = OpPhi %bool %123 %64 %132 %125 + OpSelectionMerge %134 None + OpBranchConditional %133 %135 %134 + %135 = OpLabel + %136 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %137 = OpLoad %int %136 + %138 = OpAccessChain %_ptr_Function_int %arr %137 %int_0 + %139 = OpLoad %int %138 + %140 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %141 = OpLoad %int %140 + %142 = OpIEqual %bool %139 %141 + OpBranch %134 + %134 = OpLabel + %143 = OpPhi %bool %133 %124 %142 %135 + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %146 + %145 = OpLabel + %147 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %148 = OpLoad %int %147 + %149 = OpConvertSToF %float %148 + %150 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %151 = OpLoad %int %150 + %152 = OpConvertSToF %float %151 + %153 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %154 = OpLoad %int %153 + %155 = OpConvertSToF %float %154 + %156 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %157 = OpLoad %int %156 + %158 = OpConvertSToF %float %157 + %159 = OpCompositeConstruct %v4float %149 %152 %155 %158 + OpStore %_GLF_color %159 + OpBranch %144 + %146 = OpLabel + %160 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %161 = OpLoad %int %160 + %162 = OpConvertSToF %float %161 + %163 = OpCompositeConstruct %v4float %162 %162 %162 %162 + OpStore %_GLF_color %163 + OpBranch %144 + %144 = OpLabel + OpReturn + OpFunctionEnd +%func_struct_S_i11_ = OpFunction %void None %21 + %s = OpFunctionParameter %_ptr_Function_S + %164 = OpLabel + %165 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %166 = OpLoad %float %165 + %167 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %168 = OpLoad %float %167 + %169 = OpFOrdGreaterThan %bool %166 %168 + OpSelectionMerge %170 None + OpBranchConditional %169 %171 %170 + %171 = OpLabel + OpReturn + %170 = OpLabel + %172 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %173 = OpLoad %int %172 + %174 = OpAccessChain %_ptr_Function_int %s %int_0 + OpStore %174 %173 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..d405088efa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.hlsl @@ -0,0 +1,146 @@ +struct S { + int data; +}; + +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_struct_S_i11_(inout S s) { + const float x_166 = asfloat(x_8[0].x); + const float x_168 = asfloat(x_8[0].y); + if ((x_166 > x_168)) { + return; + } + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_173 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + s.data = x_173; + return; +} + +void main_1() { + int i = 0; + S arr[3] = (S[3])0; + int i_1 = 0; + S param = (S)0; + int j = 0; + bool x_132 = false; + bool x_142 = false; + bool x_133_phi = false; + bool x_143_phi = false; + const int x_46 = asint(x_10[2].x); + i = x_46; + while (true) { + const int x_51 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_51 < x_53)) { + } else { + break; + } + arr[i].data = i; + { + i = (i + 1); + } + } + const int x_62 = asint(x_10[2].x); + i_1 = x_62; + while (true) { + const int x_67 = i_1; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_69 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_67 < x_69)) { + } else { + break; + } + const float x_73 = asfloat(x_8[0].x); + const float x_75 = asfloat(x_8[0].y); + if ((x_73 > x_75)) { + break; + } + const int x_81 = arr[i_1].data; + const int x_83 = asint(x_10[3].x); + if ((x_81 == x_83)) { + const int x_88 = i_1; + const S x_90 = arr[x_88]; + param = x_90; + func_struct_S_i11_(param); + arr[x_88] = param; + } else { + const int x_95 = asint(x_10[2].x); + j = x_95; + while (true) { + const int x_100 = j; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_102 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_100 < x_102)) { + } else { + break; + } + const int x_107 = arr[j].data; + const int x_109 = asint(x_10[4].x); + if ((x_107 > x_109)) { + discard; + } + { + j = (j + 1); + } + } + } + { + i_1 = (i_1 + 1); + } + } + const int x_118 = asint(x_10[2].x); + const int x_120 = arr[x_118].data; + const int x_122 = asint(x_10[2].x); + const bool x_123 = (x_120 == x_122); + x_133_phi = x_123; + if (x_123) { + const int x_127 = asint(x_10[3].x); + const int x_129 = arr[x_127].data; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_131 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_132 = (x_129 == x_131); + x_133_phi = x_132; + } + const bool x_133 = x_133_phi; + x_143_phi = x_133; + if (x_133) { + const int x_137 = asint(x_10[1].x); + const int x_139 = arr[x_137].data; + const int x_141 = asint(x_10[1].x); + x_142 = (x_139 == x_141); + x_143_phi = x_142; + } + if (x_143_phi) { + const int x_148 = asint(x_10[3].x); + const int x_151 = asint(x_10[2].x); + const int x_154 = asint(x_10[2].x); + const int x_157 = asint(x_10[3].x); + x_GLF_color = float4(float(x_148), float(x_151), float(x_154), float(x_157)); + } else { + const int x_161 = asint(x_10[2].x); + const float x_162 = float(x_161); + x_GLF_color = float4(x_162, x_162, x_162, x_162); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..df420d2be1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.msl @@ -0,0 +1,162 @@ +#include + +using namespace metal; +struct S { + int data; +}; +struct buf1 { + /* 0x0000 */ packed_float2 v1; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + S arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_struct_S_i11_(constant buf1& x_8, constant buf0& x_10, thread S* const s) { + float const x_166 = x_8.v1.x; + float const x_168 = x_8.v1.y; + if ((x_166 > x_168)) { + return; + } + int const x_173 = x_10.x_GLF_uniform_int_values.arr[0].el; + (*(s)).data = x_173; + return; +} + +void main_1(constant buf0& x_10, constant buf1& x_8, thread float4* const tint_symbol_4) { + int i = 0; + tint_array_wrapper_1 arr = {}; + int i_1 = 0; + S param = {}; + int j = 0; + bool x_132 = false; + bool x_142 = false; + bool x_133_phi = false; + bool x_143_phi = false; + int const x_46 = x_10.x_GLF_uniform_int_values.arr[2].el; + i = x_46; + while (true) { + int const x_51 = i; + int const x_53 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_51 < x_53)) { + } else { + break; + } + int const x_56 = i; + int const x_57 = i; + arr.arr[x_56].data = x_57; + { + int const x_59 = i; + i = (x_59 + 1); + } + } + int const x_62 = x_10.x_GLF_uniform_int_values.arr[2].el; + i_1 = x_62; + while (true) { + int const x_67 = i_1; + int const x_69 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_67 < x_69)) { + } else { + break; + } + float const x_73 = x_8.v1.x; + float const x_75 = x_8.v1.y; + if ((x_73 > x_75)) { + break; + } + int const x_79 = i_1; + int const x_81 = arr.arr[x_79].data; + int const x_83 = x_10.x_GLF_uniform_int_values.arr[3].el; + if ((x_81 == x_83)) { + int const x_88 = i_1; + S const x_90 = arr.arr[x_88]; + param = x_90; + func_struct_S_i11_(x_8, x_10, &(param)); + S const x_92 = param; + arr.arr[x_88] = x_92; + } else { + int const x_95 = x_10.x_GLF_uniform_int_values.arr[2].el; + j = x_95; + while (true) { + int const x_100 = j; + int const x_102 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_100 < x_102)) { + } else { + break; + } + int const x_105 = j; + int const x_107 = arr.arr[x_105].data; + int const x_109 = x_10.x_GLF_uniform_int_values.arr[4].el; + if ((x_107 > x_109)) { + discard_fragment(); + } + { + int const x_113 = j; + j = (x_113 + 1); + } + } + } + { + int const x_115 = i_1; + i_1 = (x_115 + 1); + } + } + int const x_118 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_120 = arr.arr[x_118].data; + int const x_122 = x_10.x_GLF_uniform_int_values.arr[2].el; + bool const x_123 = (x_120 == x_122); + x_133_phi = x_123; + if (x_123) { + int const x_127 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_129 = arr.arr[x_127].data; + int const x_131 = x_10.x_GLF_uniform_int_values.arr[0].el; + x_132 = (x_129 == x_131); + x_133_phi = x_132; + } + bool const x_133 = x_133_phi; + x_143_phi = x_133; + if (x_133) { + int const x_137 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_139 = arr.arr[x_137].data; + int const x_141 = x_10.x_GLF_uniform_int_values.arr[1].el; + x_142 = (x_139 == x_141); + x_143_phi = x_142; + } + bool const x_143 = x_143_phi; + if (x_143) { + int const x_148 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_151 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_154 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_157 = x_10.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_4) = float4(float(x_148), float(x_151), float(x_154), float(x_157)); + } else { + int const x_161 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_162 = float(x_161); + *(tint_symbol_4) = float4(x_162, x_162, x_162, x_162); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_10 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_10, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..0e185642af --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.spvasm @@ -0,0 +1,333 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 208 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %x_8 "x_8" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %S "S" + OpMemberName %S 0 "data" + OpName %func_struct_S_i11_ "func_struct_S_i11_" + OpName %s "s" + OpName %main_1 "main_1" + OpName %i "i" + OpName %arr "arr" + OpName %i_1 "i_1" + OpName %param "param" + OpName %j "j" + OpName %x_132 "x_132" + OpName %x_142 "x_142" + OpName %x_133_phi "x_133_phi" + OpName %x_143_phi "x_143_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_arr_S_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %S = OpTypeStruct %int +%_ptr_Function_S = OpTypePointer Function %S + %19 = OpTypeFunction %void %_ptr_Function_S + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %44 = OpTypeFunction %void + %48 = OpConstantNull %int + %uint_3 = OpConstant %uint 3 +%_arr_S_uint_3 = OpTypeArray %S %uint_3 +%_ptr_Function__arr_S_uint_3 = OpTypePointer Function %_arr_S_uint_3 + %53 = OpConstantNull %_arr_S_uint_3 + %56 = OpConstantNull %S +%_ptr_Function_bool = OpTypePointer Function %bool + %60 = OpConstantNull %bool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %196 = OpTypeFunction %void %main_out +%func_struct_S_i11_ = OpFunction %void None %19 + %s = OpFunctionParameter %_ptr_Function_S + %25 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %29 = OpLoad %float %28 + %31 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %32 = OpLoad %float %31 + %33 = OpFOrdGreaterThan %bool %29 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + OpReturn + %35 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %40 = OpLoad %int %39 + %43 = OpAccessChain %_ptr_Function_int %s %uint_0 + OpStore %43 %40 + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %44 + %46 = OpLabel + %i = OpVariable %_ptr_Function_int Function %48 + %arr = OpVariable %_ptr_Function__arr_S_uint_3 Function %53 + %i_1 = OpVariable %_ptr_Function_int Function %48 + %param = OpVariable %_ptr_Function_S Function %56 + %j = OpVariable %_ptr_Function_int Function %48 + %x_132 = OpVariable %_ptr_Function_bool Function %60 + %x_142 = OpVariable %_ptr_Function_bool Function %60 + %x_133_phi = OpVariable %_ptr_Function_bool Function %60 + %x_143_phi = OpVariable %_ptr_Function_bool Function %60 + %65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %66 = OpLoad %int %65 + OpStore %i %66 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %i + %72 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %73 = OpLoad %int %72 + %74 = OpSLessThan %bool %71 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpBranch %75 + %77 = OpLabel + OpBranch %68 + %75 = OpLabel + %78 = OpLoad %int %i + %79 = OpLoad %int %i + %80 = OpAccessChain %_ptr_Function_int %arr %78 %uint_0 + OpStore %80 %79 + OpBranch %69 + %69 = OpLabel + %81 = OpLoad %int %i + %83 = OpIAdd %int %81 %int_1 + OpStore %i %83 + OpBranch %67 + %68 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %85 = OpLoad %int %84 + OpStore %i_1 %85 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %87 %88 None + OpBranch %89 + %89 = OpLabel + %90 = OpLoad %int %i_1 + %91 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %92 = OpLoad %int %91 + %93 = OpSLessThan %bool %90 %92 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %96 + %95 = OpLabel + OpBranch %94 + %96 = OpLabel + OpBranch %87 + %94 = OpLabel + %97 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %98 = OpLoad %float %97 + %99 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %100 = OpLoad %float %99 + %101 = OpFOrdGreaterThan %bool %98 %100 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + OpBranch %87 + %102 = OpLabel + %104 = OpLoad %int %i_1 + %105 = OpAccessChain %_ptr_Function_int %arr %104 %uint_0 + %106 = OpLoad %int %105 + %108 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %109 = OpLoad %int %108 + %110 = OpIEqual %bool %106 %109 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %113 + %112 = OpLabel + %114 = OpLoad %int %i_1 + %115 = OpAccessChain %_ptr_Function_S %arr %114 + %116 = OpLoad %S %115 + OpStore %param %116 + %117 = OpFunctionCall %void %func_struct_S_i11_ %param + %119 = OpLoad %S %param + %120 = OpAccessChain %_ptr_Function_S %arr %114 + OpStore %120 %119 + OpBranch %111 + %113 = OpLabel + %121 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %122 = OpLoad %int %121 + OpStore %j %122 + OpBranch %123 + %123 = OpLabel + OpLoopMerge %124 %125 None + OpBranch %126 + %126 = OpLabel + %127 = OpLoad %int %j + %128 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %129 = OpLoad %int %128 + %130 = OpSLessThan %bool %127 %129 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %133 + %132 = OpLabel + OpBranch %131 + %133 = OpLabel + OpBranch %124 + %131 = OpLabel + %134 = OpLoad %int %j + %135 = OpAccessChain %_ptr_Function_int %arr %134 %uint_0 + %136 = OpLoad %int %135 + %138 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_4 + %139 = OpLoad %int %138 + %140 = OpSGreaterThan %bool %136 %139 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + OpKill + %141 = OpLabel + OpBranch %125 + %125 = OpLabel + %143 = OpLoad %int %j + %144 = OpIAdd %int %143 %int_1 + OpStore %j %144 + OpBranch %123 + %124 = OpLabel + OpBranch %111 + %111 = OpLabel + OpBranch %88 + %88 = OpLabel + %145 = OpLoad %int %i_1 + %146 = OpIAdd %int %145 %int_1 + OpStore %i_1 %146 + OpBranch %86 + %87 = OpLabel + %147 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %148 = OpLoad %int %147 + %149 = OpAccessChain %_ptr_Function_int %arr %148 %uint_0 + %150 = OpLoad %int %149 + %151 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %152 = OpLoad %int %151 + %153 = OpIEqual %bool %150 %152 + OpStore %x_133_phi %153 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %154 + %155 = OpLabel + %156 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %157 = OpLoad %int %156 + %158 = OpAccessChain %_ptr_Function_int %arr %157 %uint_0 + %159 = OpLoad %int %158 + %160 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %161 = OpLoad %int %160 + %162 = OpIEqual %bool %159 %161 + OpStore %x_132 %162 + %163 = OpLoad %bool %x_132 + OpStore %x_133_phi %163 + OpBranch %154 + %154 = OpLabel + %164 = OpLoad %bool %x_133_phi + OpStore %x_143_phi %164 + OpSelectionMerge %165 None + OpBranchConditional %164 %166 %165 + %166 = OpLabel + %167 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %168 = OpLoad %int %167 + %169 = OpAccessChain %_ptr_Function_int %arr %168 %uint_0 + %170 = OpLoad %int %169 + %171 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %172 = OpLoad %int %171 + %173 = OpIEqual %bool %170 %172 + OpStore %x_142 %173 + %174 = OpLoad %bool %x_142 + OpStore %x_143_phi %174 + OpBranch %165 + %165 = OpLabel + %175 = OpLoad %bool %x_143_phi + OpSelectionMerge %176 None + OpBranchConditional %175 %177 %178 + %177 = OpLabel + %179 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %180 = OpLoad %int %179 + %181 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %182 = OpLoad %int %181 + %183 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %184 = OpLoad %int %183 + %185 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %186 = OpLoad %int %185 + %187 = OpConvertSToF %float %180 + %188 = OpConvertSToF %float %182 + %189 = OpConvertSToF %float %184 + %190 = OpConvertSToF %float %186 + %191 = OpCompositeConstruct %v4float %187 %188 %189 %190 + OpStore %x_GLF_color %191 + OpBranch %176 + %178 = OpLabel + %192 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %193 = OpLoad %int %192 + %194 = OpConvertSToF %float %193 + %195 = OpCompositeConstruct %v4float %194 %194 %194 %194 + OpStore %x_GLF_color %195 + OpBranch %176 + %176 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %196 +%tint_symbol = OpFunctionParameter %main_out + %200 = OpLabel + %201 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %201 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %44 + %203 = OpLabel + %204 = OpFunctionCall %void %main_1 + %206 = OpLoad %v4float %x_GLF_color + %207 = OpCompositeConstruct %main_out %206 + %205 = OpFunctionCall %void %tint_symbol_2 %207 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..dedf3c2cc2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.spvasm.expected.wgsl @@ -0,0 +1,160 @@ +struct S { + data : i32; +}; + +[[block]] +struct buf1 { + v1 : vec2; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i11_(s : ptr) { + let x_166 : f32 = x_8.v1.x; + let x_168 : f32 = x_8.v1.y; + if ((x_166 > x_168)) { + return; + } + let x_173 : i32 = x_10.x_GLF_uniform_int_values[0]; + (*(s)).data = x_173; + return; +} + +fn main_1() { + var i : i32; + var arr : array; + var i_1 : i32; + var param : S; + var j : i32; + var x_132 : bool; + var x_142 : bool; + var x_133_phi : bool; + var x_143_phi : bool; + let x_46 : i32 = x_10.x_GLF_uniform_int_values[2]; + i = x_46; + loop { + let x_51 : i32 = i; + let x_53 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_51 < x_53)) { + } else { + break; + } + let x_56 : i32 = i; + let x_57 : i32 = i; + arr[x_56].data = x_57; + + continuing { + let x_59 : i32 = i; + i = (x_59 + 1); + } + } + let x_62 : i32 = x_10.x_GLF_uniform_int_values[2]; + i_1 = x_62; + loop { + let x_67 : i32 = i_1; + let x_69 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_67 < x_69)) { + } else { + break; + } + let x_73 : f32 = x_8.v1.x; + let x_75 : f32 = x_8.v1.y; + if ((x_73 > x_75)) { + break; + } + let x_79 : i32 = i_1; + let x_81 : i32 = arr[x_79].data; + let x_83 : i32 = x_10.x_GLF_uniform_int_values[3]; + if ((x_81 == x_83)) { + let x_88 : i32 = i_1; + let x_90 : S = arr[x_88]; + param = x_90; + func_struct_S_i11_(&(param)); + let x_92 : S = param; + arr[x_88] = x_92; + } else { + let x_95 : i32 = x_10.x_GLF_uniform_int_values[2]; + j = x_95; + loop { + let x_100 : i32 = j; + let x_102 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_100 < x_102)) { + } else { + break; + } + let x_105 : i32 = j; + let x_107 : i32 = arr[x_105].data; + let x_109 : i32 = x_10.x_GLF_uniform_int_values[4]; + if ((x_107 > x_109)) { + discard; + } + + continuing { + let x_113 : i32 = j; + j = (x_113 + 1); + } + } + } + + continuing { + let x_115 : i32 = i_1; + i_1 = (x_115 + 1); + } + } + let x_118 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_120 : i32 = arr[x_118].data; + let x_122 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_123 : bool = (x_120 == x_122); + x_133_phi = x_123; + if (x_123) { + let x_127 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_129 : i32 = arr[x_127].data; + let x_131 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_132 = (x_129 == x_131); + x_133_phi = x_132; + } + let x_133 : bool = x_133_phi; + x_143_phi = x_133; + if (x_133) { + let x_137 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_139 : i32 = arr[x_137].data; + let x_141 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_142 = (x_139 == x_141); + x_143_phi = x_142; + } + let x_143 : bool = x_143_phi; + if (x_143) { + let x_148 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_151 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_154 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_157 : i32 = x_10.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_148), f32(x_151), f32(x_154), f32(x_157)); + } else { + let x_161 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_162 : f32 = f32(x_161); + x_GLF_color = vec4(x_162, x_162, x_162, x_162); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl new file mode 100644 index 0000000000..dedf3c2cc2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl @@ -0,0 +1,160 @@ +struct S { + data : i32; +}; + +[[block]] +struct buf1 { + v1 : vec2; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i11_(s : ptr) { + let x_166 : f32 = x_8.v1.x; + let x_168 : f32 = x_8.v1.y; + if ((x_166 > x_168)) { + return; + } + let x_173 : i32 = x_10.x_GLF_uniform_int_values[0]; + (*(s)).data = x_173; + return; +} + +fn main_1() { + var i : i32; + var arr : array; + var i_1 : i32; + var param : S; + var j : i32; + var x_132 : bool; + var x_142 : bool; + var x_133_phi : bool; + var x_143_phi : bool; + let x_46 : i32 = x_10.x_GLF_uniform_int_values[2]; + i = x_46; + loop { + let x_51 : i32 = i; + let x_53 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_51 < x_53)) { + } else { + break; + } + let x_56 : i32 = i; + let x_57 : i32 = i; + arr[x_56].data = x_57; + + continuing { + let x_59 : i32 = i; + i = (x_59 + 1); + } + } + let x_62 : i32 = x_10.x_GLF_uniform_int_values[2]; + i_1 = x_62; + loop { + let x_67 : i32 = i_1; + let x_69 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_67 < x_69)) { + } else { + break; + } + let x_73 : f32 = x_8.v1.x; + let x_75 : f32 = x_8.v1.y; + if ((x_73 > x_75)) { + break; + } + let x_79 : i32 = i_1; + let x_81 : i32 = arr[x_79].data; + let x_83 : i32 = x_10.x_GLF_uniform_int_values[3]; + if ((x_81 == x_83)) { + let x_88 : i32 = i_1; + let x_90 : S = arr[x_88]; + param = x_90; + func_struct_S_i11_(&(param)); + let x_92 : S = param; + arr[x_88] = x_92; + } else { + let x_95 : i32 = x_10.x_GLF_uniform_int_values[2]; + j = x_95; + loop { + let x_100 : i32 = j; + let x_102 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_100 < x_102)) { + } else { + break; + } + let x_105 : i32 = j; + let x_107 : i32 = arr[x_105].data; + let x_109 : i32 = x_10.x_GLF_uniform_int_values[4]; + if ((x_107 > x_109)) { + discard; + } + + continuing { + let x_113 : i32 = j; + j = (x_113 + 1); + } + } + } + + continuing { + let x_115 : i32 = i_1; + i_1 = (x_115 + 1); + } + } + let x_118 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_120 : i32 = arr[x_118].data; + let x_122 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_123 : bool = (x_120 == x_122); + x_133_phi = x_123; + if (x_123) { + let x_127 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_129 : i32 = arr[x_127].data; + let x_131 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_132 = (x_129 == x_131); + x_133_phi = x_132; + } + let x_133 : bool = x_133_phi; + x_143_phi = x_133; + if (x_133) { + let x_137 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_139 : i32 = arr[x_137].data; + let x_141 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_142 = (x_139 == x_141); + x_143_phi = x_142; + } + let x_143 : bool = x_143_phi; + if (x_143) { + let x_148 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_151 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_154 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_157 : i32 = x_10.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_148), f32(x_151), f32(x_154), f32(x_157)); + } else { + let x_161 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_162 : f32 = f32(x_161); + x_GLF_color = vec4(x_162, x_162, x_162, x_162); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d405088efa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.hlsl @@ -0,0 +1,146 @@ +struct S { + int data; +}; + +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_struct_S_i11_(inout S s) { + const float x_166 = asfloat(x_8[0].x); + const float x_168 = asfloat(x_8[0].y); + if ((x_166 > x_168)) { + return; + } + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_173 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + s.data = x_173; + return; +} + +void main_1() { + int i = 0; + S arr[3] = (S[3])0; + int i_1 = 0; + S param = (S)0; + int j = 0; + bool x_132 = false; + bool x_142 = false; + bool x_133_phi = false; + bool x_143_phi = false; + const int x_46 = asint(x_10[2].x); + i = x_46; + while (true) { + const int x_51 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_51 < x_53)) { + } else { + break; + } + arr[i].data = i; + { + i = (i + 1); + } + } + const int x_62 = asint(x_10[2].x); + i_1 = x_62; + while (true) { + const int x_67 = i_1; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_69 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_67 < x_69)) { + } else { + break; + } + const float x_73 = asfloat(x_8[0].x); + const float x_75 = asfloat(x_8[0].y); + if ((x_73 > x_75)) { + break; + } + const int x_81 = arr[i_1].data; + const int x_83 = asint(x_10[3].x); + if ((x_81 == x_83)) { + const int x_88 = i_1; + const S x_90 = arr[x_88]; + param = x_90; + func_struct_S_i11_(param); + arr[x_88] = param; + } else { + const int x_95 = asint(x_10[2].x); + j = x_95; + while (true) { + const int x_100 = j; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_102 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_100 < x_102)) { + } else { + break; + } + const int x_107 = arr[j].data; + const int x_109 = asint(x_10[4].x); + if ((x_107 > x_109)) { + discard; + } + { + j = (j + 1); + } + } + } + { + i_1 = (i_1 + 1); + } + } + const int x_118 = asint(x_10[2].x); + const int x_120 = arr[x_118].data; + const int x_122 = asint(x_10[2].x); + const bool x_123 = (x_120 == x_122); + x_133_phi = x_123; + if (x_123) { + const int x_127 = asint(x_10[3].x); + const int x_129 = arr[x_127].data; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_131 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_132 = (x_129 == x_131); + x_133_phi = x_132; + } + const bool x_133 = x_133_phi; + x_143_phi = x_133; + if (x_133) { + const int x_137 = asint(x_10[1].x); + const int x_139 = arr[x_137].data; + const int x_141 = asint(x_10[1].x); + x_142 = (x_139 == x_141); + x_143_phi = x_142; + } + if (x_143_phi) { + const int x_148 = asint(x_10[3].x); + const int x_151 = asint(x_10[2].x); + const int x_154 = asint(x_10[2].x); + const int x_157 = asint(x_10[3].x); + x_GLF_color = float4(float(x_148), float(x_151), float(x_154), float(x_157)); + } else { + const int x_161 = asint(x_10[2].x); + const float x_162 = float(x_161); + x_GLF_color = float4(x_162, x_162, x_162, x_162); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..df420d2be1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.msl @@ -0,0 +1,162 @@ +#include + +using namespace metal; +struct S { + int data; +}; +struct buf1 { + /* 0x0000 */ packed_float2 v1; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + S arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_struct_S_i11_(constant buf1& x_8, constant buf0& x_10, thread S* const s) { + float const x_166 = x_8.v1.x; + float const x_168 = x_8.v1.y; + if ((x_166 > x_168)) { + return; + } + int const x_173 = x_10.x_GLF_uniform_int_values.arr[0].el; + (*(s)).data = x_173; + return; +} + +void main_1(constant buf0& x_10, constant buf1& x_8, thread float4* const tint_symbol_4) { + int i = 0; + tint_array_wrapper_1 arr = {}; + int i_1 = 0; + S param = {}; + int j = 0; + bool x_132 = false; + bool x_142 = false; + bool x_133_phi = false; + bool x_143_phi = false; + int const x_46 = x_10.x_GLF_uniform_int_values.arr[2].el; + i = x_46; + while (true) { + int const x_51 = i; + int const x_53 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_51 < x_53)) { + } else { + break; + } + int const x_56 = i; + int const x_57 = i; + arr.arr[x_56].data = x_57; + { + int const x_59 = i; + i = (x_59 + 1); + } + } + int const x_62 = x_10.x_GLF_uniform_int_values.arr[2].el; + i_1 = x_62; + while (true) { + int const x_67 = i_1; + int const x_69 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_67 < x_69)) { + } else { + break; + } + float const x_73 = x_8.v1.x; + float const x_75 = x_8.v1.y; + if ((x_73 > x_75)) { + break; + } + int const x_79 = i_1; + int const x_81 = arr.arr[x_79].data; + int const x_83 = x_10.x_GLF_uniform_int_values.arr[3].el; + if ((x_81 == x_83)) { + int const x_88 = i_1; + S const x_90 = arr.arr[x_88]; + param = x_90; + func_struct_S_i11_(x_8, x_10, &(param)); + S const x_92 = param; + arr.arr[x_88] = x_92; + } else { + int const x_95 = x_10.x_GLF_uniform_int_values.arr[2].el; + j = x_95; + while (true) { + int const x_100 = j; + int const x_102 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_100 < x_102)) { + } else { + break; + } + int const x_105 = j; + int const x_107 = arr.arr[x_105].data; + int const x_109 = x_10.x_GLF_uniform_int_values.arr[4].el; + if ((x_107 > x_109)) { + discard_fragment(); + } + { + int const x_113 = j; + j = (x_113 + 1); + } + } + } + { + int const x_115 = i_1; + i_1 = (x_115 + 1); + } + } + int const x_118 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_120 = arr.arr[x_118].data; + int const x_122 = x_10.x_GLF_uniform_int_values.arr[2].el; + bool const x_123 = (x_120 == x_122); + x_133_phi = x_123; + if (x_123) { + int const x_127 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_129 = arr.arr[x_127].data; + int const x_131 = x_10.x_GLF_uniform_int_values.arr[0].el; + x_132 = (x_129 == x_131); + x_133_phi = x_132; + } + bool const x_133 = x_133_phi; + x_143_phi = x_133; + if (x_133) { + int const x_137 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_139 = arr.arr[x_137].data; + int const x_141 = x_10.x_GLF_uniform_int_values.arr[1].el; + x_142 = (x_139 == x_141); + x_143_phi = x_142; + } + bool const x_143 = x_143_phi; + if (x_143) { + int const x_148 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_151 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_154 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_157 = x_10.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_4) = float4(float(x_148), float(x_151), float(x_154), float(x_157)); + } else { + int const x_161 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_162 = float(x_161); + *(tint_symbol_4) = float4(x_162, x_162, x_162, x_162); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_10 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_10, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..0e185642af --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.spvasm @@ -0,0 +1,333 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 208 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %x_8 "x_8" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %S "S" + OpMemberName %S 0 "data" + OpName %func_struct_S_i11_ "func_struct_S_i11_" + OpName %s "s" + OpName %main_1 "main_1" + OpName %i "i" + OpName %arr "arr" + OpName %i_1 "i_1" + OpName %param "param" + OpName %j "j" + OpName %x_132 "x_132" + OpName %x_142 "x_142" + OpName %x_133_phi "x_133_phi" + OpName %x_143_phi "x_143_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_arr_S_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %S = OpTypeStruct %int +%_ptr_Function_S = OpTypePointer Function %S + %19 = OpTypeFunction %void %_ptr_Function_S + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %44 = OpTypeFunction %void + %48 = OpConstantNull %int + %uint_3 = OpConstant %uint 3 +%_arr_S_uint_3 = OpTypeArray %S %uint_3 +%_ptr_Function__arr_S_uint_3 = OpTypePointer Function %_arr_S_uint_3 + %53 = OpConstantNull %_arr_S_uint_3 + %56 = OpConstantNull %S +%_ptr_Function_bool = OpTypePointer Function %bool + %60 = OpConstantNull %bool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %196 = OpTypeFunction %void %main_out +%func_struct_S_i11_ = OpFunction %void None %19 + %s = OpFunctionParameter %_ptr_Function_S + %25 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %29 = OpLoad %float %28 + %31 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %32 = OpLoad %float %31 + %33 = OpFOrdGreaterThan %bool %29 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + OpReturn + %35 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %40 = OpLoad %int %39 + %43 = OpAccessChain %_ptr_Function_int %s %uint_0 + OpStore %43 %40 + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %44 + %46 = OpLabel + %i = OpVariable %_ptr_Function_int Function %48 + %arr = OpVariable %_ptr_Function__arr_S_uint_3 Function %53 + %i_1 = OpVariable %_ptr_Function_int Function %48 + %param = OpVariable %_ptr_Function_S Function %56 + %j = OpVariable %_ptr_Function_int Function %48 + %x_132 = OpVariable %_ptr_Function_bool Function %60 + %x_142 = OpVariable %_ptr_Function_bool Function %60 + %x_133_phi = OpVariable %_ptr_Function_bool Function %60 + %x_143_phi = OpVariable %_ptr_Function_bool Function %60 + %65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %66 = OpLoad %int %65 + OpStore %i %66 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %i + %72 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %73 = OpLoad %int %72 + %74 = OpSLessThan %bool %71 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpBranch %75 + %77 = OpLabel + OpBranch %68 + %75 = OpLabel + %78 = OpLoad %int %i + %79 = OpLoad %int %i + %80 = OpAccessChain %_ptr_Function_int %arr %78 %uint_0 + OpStore %80 %79 + OpBranch %69 + %69 = OpLabel + %81 = OpLoad %int %i + %83 = OpIAdd %int %81 %int_1 + OpStore %i %83 + OpBranch %67 + %68 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %85 = OpLoad %int %84 + OpStore %i_1 %85 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %87 %88 None + OpBranch %89 + %89 = OpLabel + %90 = OpLoad %int %i_1 + %91 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %92 = OpLoad %int %91 + %93 = OpSLessThan %bool %90 %92 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %96 + %95 = OpLabel + OpBranch %94 + %96 = OpLabel + OpBranch %87 + %94 = OpLabel + %97 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %98 = OpLoad %float %97 + %99 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %100 = OpLoad %float %99 + %101 = OpFOrdGreaterThan %bool %98 %100 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + OpBranch %87 + %102 = OpLabel + %104 = OpLoad %int %i_1 + %105 = OpAccessChain %_ptr_Function_int %arr %104 %uint_0 + %106 = OpLoad %int %105 + %108 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %109 = OpLoad %int %108 + %110 = OpIEqual %bool %106 %109 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %113 + %112 = OpLabel + %114 = OpLoad %int %i_1 + %115 = OpAccessChain %_ptr_Function_S %arr %114 + %116 = OpLoad %S %115 + OpStore %param %116 + %117 = OpFunctionCall %void %func_struct_S_i11_ %param + %119 = OpLoad %S %param + %120 = OpAccessChain %_ptr_Function_S %arr %114 + OpStore %120 %119 + OpBranch %111 + %113 = OpLabel + %121 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %122 = OpLoad %int %121 + OpStore %j %122 + OpBranch %123 + %123 = OpLabel + OpLoopMerge %124 %125 None + OpBranch %126 + %126 = OpLabel + %127 = OpLoad %int %j + %128 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %129 = OpLoad %int %128 + %130 = OpSLessThan %bool %127 %129 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %133 + %132 = OpLabel + OpBranch %131 + %133 = OpLabel + OpBranch %124 + %131 = OpLabel + %134 = OpLoad %int %j + %135 = OpAccessChain %_ptr_Function_int %arr %134 %uint_0 + %136 = OpLoad %int %135 + %138 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_4 + %139 = OpLoad %int %138 + %140 = OpSGreaterThan %bool %136 %139 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + OpKill + %141 = OpLabel + OpBranch %125 + %125 = OpLabel + %143 = OpLoad %int %j + %144 = OpIAdd %int %143 %int_1 + OpStore %j %144 + OpBranch %123 + %124 = OpLabel + OpBranch %111 + %111 = OpLabel + OpBranch %88 + %88 = OpLabel + %145 = OpLoad %int %i_1 + %146 = OpIAdd %int %145 %int_1 + OpStore %i_1 %146 + OpBranch %86 + %87 = OpLabel + %147 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %148 = OpLoad %int %147 + %149 = OpAccessChain %_ptr_Function_int %arr %148 %uint_0 + %150 = OpLoad %int %149 + %151 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %152 = OpLoad %int %151 + %153 = OpIEqual %bool %150 %152 + OpStore %x_133_phi %153 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %154 + %155 = OpLabel + %156 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %157 = OpLoad %int %156 + %158 = OpAccessChain %_ptr_Function_int %arr %157 %uint_0 + %159 = OpLoad %int %158 + %160 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %161 = OpLoad %int %160 + %162 = OpIEqual %bool %159 %161 + OpStore %x_132 %162 + %163 = OpLoad %bool %x_132 + OpStore %x_133_phi %163 + OpBranch %154 + %154 = OpLabel + %164 = OpLoad %bool %x_133_phi + OpStore %x_143_phi %164 + OpSelectionMerge %165 None + OpBranchConditional %164 %166 %165 + %166 = OpLabel + %167 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %168 = OpLoad %int %167 + %169 = OpAccessChain %_ptr_Function_int %arr %168 %uint_0 + %170 = OpLoad %int %169 + %171 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %172 = OpLoad %int %171 + %173 = OpIEqual %bool %170 %172 + OpStore %x_142 %173 + %174 = OpLoad %bool %x_142 + OpStore %x_143_phi %174 + OpBranch %165 + %165 = OpLabel + %175 = OpLoad %bool %x_143_phi + OpSelectionMerge %176 None + OpBranchConditional %175 %177 %178 + %177 = OpLabel + %179 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %180 = OpLoad %int %179 + %181 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %182 = OpLoad %int %181 + %183 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %184 = OpLoad %int %183 + %185 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %186 = OpLoad %int %185 + %187 = OpConvertSToF %float %180 + %188 = OpConvertSToF %float %182 + %189 = OpConvertSToF %float %184 + %190 = OpConvertSToF %float %186 + %191 = OpCompositeConstruct %v4float %187 %188 %189 %190 + OpStore %x_GLF_color %191 + OpBranch %176 + %178 = OpLabel + %192 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %193 = OpLoad %int %192 + %194 = OpConvertSToF %float %193 + %195 = OpCompositeConstruct %v4float %194 %194 %194 %194 + OpStore %x_GLF_color %195 + OpBranch %176 + %176 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %196 +%tint_symbol = OpFunctionParameter %main_out + %200 = OpLabel + %201 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %201 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %44 + %203 = OpLabel + %204 = OpFunctionCall %void %main_1 + %206 = OpLoad %v4float %x_GLF_color + %207 = OpCompositeConstruct %main_out %206 + %205 = OpFunctionCall %void %tint_symbol_2 %207 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..dedf3c2cc2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-first-value-phi/0-opt.wgsl.expected.wgsl @@ -0,0 +1,160 @@ +struct S { + data : i32; +}; + +[[block]] +struct buf1 { + v1 : vec2; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i11_(s : ptr) { + let x_166 : f32 = x_8.v1.x; + let x_168 : f32 = x_8.v1.y; + if ((x_166 > x_168)) { + return; + } + let x_173 : i32 = x_10.x_GLF_uniform_int_values[0]; + (*(s)).data = x_173; + return; +} + +fn main_1() { + var i : i32; + var arr : array; + var i_1 : i32; + var param : S; + var j : i32; + var x_132 : bool; + var x_142 : bool; + var x_133_phi : bool; + var x_143_phi : bool; + let x_46 : i32 = x_10.x_GLF_uniform_int_values[2]; + i = x_46; + loop { + let x_51 : i32 = i; + let x_53 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_51 < x_53)) { + } else { + break; + } + let x_56 : i32 = i; + let x_57 : i32 = i; + arr[x_56].data = x_57; + + continuing { + let x_59 : i32 = i; + i = (x_59 + 1); + } + } + let x_62 : i32 = x_10.x_GLF_uniform_int_values[2]; + i_1 = x_62; + loop { + let x_67 : i32 = i_1; + let x_69 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_67 < x_69)) { + } else { + break; + } + let x_73 : f32 = x_8.v1.x; + let x_75 : f32 = x_8.v1.y; + if ((x_73 > x_75)) { + break; + } + let x_79 : i32 = i_1; + let x_81 : i32 = arr[x_79].data; + let x_83 : i32 = x_10.x_GLF_uniform_int_values[3]; + if ((x_81 == x_83)) { + let x_88 : i32 = i_1; + let x_90 : S = arr[x_88]; + param = x_90; + func_struct_S_i11_(&(param)); + let x_92 : S = param; + arr[x_88] = x_92; + } else { + let x_95 : i32 = x_10.x_GLF_uniform_int_values[2]; + j = x_95; + loop { + let x_100 : i32 = j; + let x_102 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_100 < x_102)) { + } else { + break; + } + let x_105 : i32 = j; + let x_107 : i32 = arr[x_105].data; + let x_109 : i32 = x_10.x_GLF_uniform_int_values[4]; + if ((x_107 > x_109)) { + discard; + } + + continuing { + let x_113 : i32 = j; + j = (x_113 + 1); + } + } + } + + continuing { + let x_115 : i32 = i_1; + i_1 = (x_115 + 1); + } + } + let x_118 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_120 : i32 = arr[x_118].data; + let x_122 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_123 : bool = (x_120 == x_122); + x_133_phi = x_123; + if (x_123) { + let x_127 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_129 : i32 = arr[x_127].data; + let x_131 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_132 = (x_129 == x_131); + x_133_phi = x_132; + } + let x_133 : bool = x_133_phi; + x_143_phi = x_133; + if (x_133) { + let x_137 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_139 : i32 = arr[x_137].data; + let x_141 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_142 = (x_139 == x_141); + x_143_phi = x_142; + } + let x_143 : bool = x_143_phi; + if (x_143) { + let x_148 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_151 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_154 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_157 : i32 = x_10.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_148), f32(x_151), f32(x_154), f32(x_157)); + } else { + let x_161 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_162 : f32 = f32(x_161); + x_GLF_color = vec4(x_162, x_162, x_162, x_162); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm new file mode 100644 index 0000000000..a6196b07f5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm @@ -0,0 +1,103 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main = OpFunction %void None %12 + %27 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %29 = OpLoad %int %28 + %30 = OpConvertSToF %float %29 + %31 = OpCompositeConstruct %v4float %30 %30 %30 %30 + OpStore %_GLF_color %31 + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %33 = OpLoad %int %32 + OpStore %i %33 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %40 = OpLoad %int %39 + %41 = OpSLessThan %bool %38 %40 + OpBranchConditional %41 %42 %35 + %42 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %44 = OpLoad %float %43 + %45 = OpLoad %int %i + %46 = OpConvertSToF %float %45 + %47 = OpFOrdLessThanEqual %bool %44 %46 + %48 = OpLogicalNot %bool %47 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %52 = OpLoad %float %51 + %53 = OpLoad %int %i + %54 = OpConvertSToF %float %53 + %55 = OpLoad %int %i + %56 = OpConvertSToF %float %55 + %57 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpCompositeConstruct %v4float %52 %54 %56 %58 + %60 = OpLoad %v4float %_GLF_color + %61 = OpFAdd %v4float %60 %59 + OpStore %_GLF_color %61 + OpBranch %49 + %49 = OpLabel + OpBranch %36 + %36 = OpLabel + %62 = OpLoad %int %i + %63 = OpIAdd %int %62 %int_1 + OpStore %i %63 + OpBranch %34 + %35 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..c4609c11b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.hlsl @@ -0,0 +1,54 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b1, space0) { + uint4 x_5[2]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[2]; +}; + +void main_1() { + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const float x_30 = float(x_29); + x_GLF_color = float4(x_30, x_30, x_30, x_30); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_33 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + i = x_33; + while (true) { + const int x_38 = i; + const int x_40 = asint(x_5[1].x); + if ((x_38 < x_40)) { + } else { + break; + } + const float x_44 = asfloat(x_8[1].x); + if (!((x_44 <= float(i)))) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_52 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_53 = i; + const int x_55 = i; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_58 = asfloat(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = (x_GLF_color + float4(x_52, float(x_53), float(x_55), x_58)); + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f3e2dd6808 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.msl @@ -0,0 +1,70 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_5, constant buf0& x_8, thread float4* const tint_symbol_4) { + int i = 0; + int const x_29 = x_5.x_GLF_uniform_int_values.arr[0].el; + float const x_30 = float(x_29); + *(tint_symbol_4) = float4(x_30, x_30, x_30, x_30); + int const x_33 = x_5.x_GLF_uniform_int_values.arr[0].el; + i = x_33; + while (true) { + int const x_38 = i; + int const x_40 = x_5.x_GLF_uniform_int_values.arr[1].el; + if ((x_38 < x_40)) { + } else { + break; + } + float const x_44 = x_8.x_GLF_uniform_float_values.arr[1].el; + int const x_45 = i; + if (!((x_44 <= float(x_45)))) { + float const x_52 = x_8.x_GLF_uniform_float_values.arr[0].el; + int const x_53 = i; + int const x_55 = i; + float const x_58 = x_8.x_GLF_uniform_float_values.arr[0].el; + float4 const x_60 = *(tint_symbol_4); + *(tint_symbol_4) = (x_60 + float4(x_52, float(x_53), float(x_55), x_58)); + } + { + int const x_62 = i; + i = (x_62 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_5 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4b3abccf94 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 82 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_5 = OpVariable %_ptr_Uniform_buf1 Uniform +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %70 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %i = OpVariable %_ptr_Function_int Function %25 + %29 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %30 = OpLoad %int %29 + %31 = OpConvertSToF %float %30 + %32 = OpCompositeConstruct %v4float %31 %31 %31 %31 + OpStore %x_GLF_color %32 + %33 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %34 = OpLoad %int %33 + OpStore %i %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %int %i + %41 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpSLessThan %bool %39 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %36 + %45 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %50 = OpLoad %float %49 + %51 = OpLoad %int %i + %53 = OpConvertSToF %float %51 + %54 = OpFOrdLessThanEqual %bool %50 %53 + %52 = OpLogicalNot %bool %54 + OpSelectionMerge %55 None + OpBranchConditional %52 %56 %55 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpLoad %int %i + %60 = OpLoad %int %i + %61 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %62 = OpLoad %float %61 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpConvertSToF %float %59 + %65 = OpConvertSToF %float %60 + %66 = OpCompositeConstruct %v4float %58 %64 %65 %62 + %67 = OpFAdd %v4float %63 %66 + OpStore %x_GLF_color %67 + OpBranch %55 + %55 = OpLabel + OpBranch %37 + %37 = OpLabel + %68 = OpLoad %int %i + %69 = OpIAdd %int %68 %int_1 + OpStore %i %69 + OpBranch %35 + %36 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %70 +%tint_symbol = OpFunctionParameter %main_out + %74 = OpLabel + %75 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %75 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %77 = OpLabel + %78 = OpFunctionCall %void %main_1 + %80 = OpLoad %v4float %x_GLF_color + %81 = OpCompositeConstruct %main_out %80 + %79 = OpFunctionCall %void %tint_symbol_2 %81 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5aa01a6b3f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.spvasm.expected.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_5 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var i : i32; + let x_29 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_30 : f32 = f32(x_29); + x_GLF_color = vec4(x_30, x_30, x_30, x_30); + let x_33 : i32 = x_5.x_GLF_uniform_int_values[0]; + i = x_33; + loop { + let x_38 : i32 = i; + let x_40 : i32 = x_5.x_GLF_uniform_int_values[1]; + if ((x_38 < x_40)) { + } else { + break; + } + let x_44 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_45 : i32 = i; + if (!((x_44 <= f32(x_45)))) { + let x_52 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_53 : i32 = i; + let x_55 : i32 = i; + let x_58 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_60 : vec4 = x_GLF_color; + x_GLF_color = (x_60 + vec4(x_52, f32(x_53), f32(x_55), x_58)); + } + + continuing { + let x_62 : i32 = i; + i = (x_62 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl new file mode 100644 index 0000000000..5aa01a6b3f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_5 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var i : i32; + let x_29 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_30 : f32 = f32(x_29); + x_GLF_color = vec4(x_30, x_30, x_30, x_30); + let x_33 : i32 = x_5.x_GLF_uniform_int_values[0]; + i = x_33; + loop { + let x_38 : i32 = i; + let x_40 : i32 = x_5.x_GLF_uniform_int_values[1]; + if ((x_38 < x_40)) { + } else { + break; + } + let x_44 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_45 : i32 = i; + if (!((x_44 <= f32(x_45)))) { + let x_52 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_53 : i32 = i; + let x_55 : i32 = i; + let x_58 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_60 : vec4 = x_GLF_color; + x_GLF_color = (x_60 + vec4(x_52, f32(x_53), f32(x_55), x_58)); + } + + continuing { + let x_62 : i32 = i; + i = (x_62 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..c4609c11b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.hlsl @@ -0,0 +1,54 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b1, space0) { + uint4 x_5[2]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[2]; +}; + +void main_1() { + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const float x_30 = float(x_29); + x_GLF_color = float4(x_30, x_30, x_30, x_30); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_33 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + i = x_33; + while (true) { + const int x_38 = i; + const int x_40 = asint(x_5[1].x); + if ((x_38 < x_40)) { + } else { + break; + } + const float x_44 = asfloat(x_8[1].x); + if (!((x_44 <= float(i)))) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_52 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_53 = i; + const int x_55 = i; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_58 = asfloat(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = (x_GLF_color + float4(x_52, float(x_53), float(x_55), x_58)); + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f3e2dd6808 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.msl @@ -0,0 +1,70 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_5, constant buf0& x_8, thread float4* const tint_symbol_4) { + int i = 0; + int const x_29 = x_5.x_GLF_uniform_int_values.arr[0].el; + float const x_30 = float(x_29); + *(tint_symbol_4) = float4(x_30, x_30, x_30, x_30); + int const x_33 = x_5.x_GLF_uniform_int_values.arr[0].el; + i = x_33; + while (true) { + int const x_38 = i; + int const x_40 = x_5.x_GLF_uniform_int_values.arr[1].el; + if ((x_38 < x_40)) { + } else { + break; + } + float const x_44 = x_8.x_GLF_uniform_float_values.arr[1].el; + int const x_45 = i; + if (!((x_44 <= float(x_45)))) { + float const x_52 = x_8.x_GLF_uniform_float_values.arr[0].el; + int const x_53 = i; + int const x_55 = i; + float const x_58 = x_8.x_GLF_uniform_float_values.arr[0].el; + float4 const x_60 = *(tint_symbol_4); + *(tint_symbol_4) = (x_60 + float4(x_52, float(x_53), float(x_55), x_58)); + } + { + int const x_62 = i; + i = (x_62 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_5 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4b3abccf94 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 82 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_5 = OpVariable %_ptr_Uniform_buf1 Uniform +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %70 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %i = OpVariable %_ptr_Function_int Function %25 + %29 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %30 = OpLoad %int %29 + %31 = OpConvertSToF %float %30 + %32 = OpCompositeConstruct %v4float %31 %31 %31 %31 + OpStore %x_GLF_color %32 + %33 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %34 = OpLoad %int %33 + OpStore %i %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %int %i + %41 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpSLessThan %bool %39 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %36 + %45 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %50 = OpLoad %float %49 + %51 = OpLoad %int %i + %53 = OpConvertSToF %float %51 + %54 = OpFOrdLessThanEqual %bool %50 %53 + %52 = OpLogicalNot %bool %54 + OpSelectionMerge %55 None + OpBranchConditional %52 %56 %55 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpLoad %int %i + %60 = OpLoad %int %i + %61 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %62 = OpLoad %float %61 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpConvertSToF %float %59 + %65 = OpConvertSToF %float %60 + %66 = OpCompositeConstruct %v4float %58 %64 %65 %62 + %67 = OpFAdd %v4float %63 %66 + OpStore %x_GLF_color %67 + OpBranch %55 + %55 = OpLabel + OpBranch %37 + %37 = OpLabel + %68 = OpLoad %int %i + %69 = OpIAdd %int %68 %int_1 + OpStore %i %69 + OpBranch %35 + %36 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %70 +%tint_symbol = OpFunctionParameter %main_out + %74 = OpLabel + %75 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %75 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %77 = OpLabel + %78 = OpFunctionCall %void %main_1 + %80 = OpLoad %v4float %x_GLF_color + %81 = OpCompositeConstruct %main_out %80 + %79 = OpFunctionCall %void %tint_symbol_2 %81 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5aa01a6b3f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-instructions-for-if-less-than-equal/0-opt.wgsl.expected.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_5 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var i : i32; + let x_29 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_30 : f32 = f32(x_29); + x_GLF_color = vec4(x_30, x_30, x_30, x_30); + let x_33 : i32 = x_5.x_GLF_uniform_int_values[0]; + i = x_33; + loop { + let x_38 : i32 = i; + let x_40 : i32 = x_5.x_GLF_uniform_int_values[1]; + if ((x_38 < x_40)) { + } else { + break; + } + let x_44 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_45 : i32 = i; + if (!((x_44 <= f32(x_45)))) { + let x_52 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_53 : i32 = i; + let x_55 : i32 = i; + let x_58 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_60 : vec4 = x_GLF_color; + x_GLF_color = (x_60 + vec4(x_52, f32(x_53), f32(x_55), x_58)); + } + + continuing { + let x_62 : i32 = i; + i = (x_62 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm new file mode 100644 index 0000000000..3d402359ed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm @@ -0,0 +1,84 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_63677 = OpConstant %int 63677 + %v2int = OpTypeVector %int 2 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %9 + %26 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %27 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %28 = OpLoad %int %27 + OpStore %a %28 + %29 = OpLoad %int %a + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %31 = OpLoad %int %30 + %32 = OpCompositeConstruct %v2int %31 %int_63677 + %33 = OpCompositeConstruct %v2int %29 %29 + %34 = OpSDiv %v2int %33 %32 + %35 = OpCompositeExtract %int %34 1 + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpIEqual %bool %35 %37 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %43 + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %49 + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpCompositeConstruct %v4float %44 %47 %50 %53 + OpStore %_GLF_color %54 + OpBranch %39 + %41 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpConvertSToF %float %56 + %58 = OpCompositeConstruct %v4float %57 %57 %57 %57 + OpStore %_GLF_color %58 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..092451a7c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.hlsl @@ -0,0 +1,43 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const int x_28 = asint(x_6[1].x); + a = x_28; + const int x_29 = a; + const int x_31 = asint(x_6[2].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_37 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if (((int2(x_29, x_29) / int2(x_31, 63677)).y == x_37)) { + const int x_43 = asint(x_6[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_46 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_52 = asint(x_6[2].x); + x_GLF_color = float4(float(x_43), float(x_46), float(x_49), float(x_52)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_57 = float(x_56); + x_GLF_color = float4(x_57, x_57, x_57, x_57); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d74fee4c22 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int const x_28 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_28; + int const x_29 = a; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((((int2(x_29, x_29) / int2(x_31, 63677))).y == x_37)) { + int const x_43 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_49 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_43), float(x_46), float(x_49), float(x_52)); + } else { + int const x_56 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_57 = float(x_56); + *(tint_symbol_4) = float4(x_57, x_57, x_57, x_57); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b2ec6d530d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.spvasm @@ -0,0 +1,116 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 74 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %v2int = OpTypeVector %int 2 + %int_63677 = OpConstant %int 63677 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %62 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %26 = OpLoad %int %25 + OpStore %a %26 + %27 = OpLoad %int %a + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %30 = OpLoad %int %29 + %32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %33 = OpLoad %int %32 + %35 = OpCompositeConstruct %v2int %27 %27 + %37 = OpCompositeConstruct %v2int %30 %int_63677 + %38 = OpSDiv %v2int %35 %37 + %39 = OpCompositeExtract %int %38 1 + %40 = OpIEqual %bool %39 %33 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %44 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %46 + %54 = OpConvertSToF %float %48 + %55 = OpConvertSToF %float %50 + %56 = OpConvertSToF %float %52 + %57 = OpCompositeConstruct %v4float %53 %54 %55 %56 + OpStore %x_GLF_color %57 + OpBranch %42 + %44 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpCompositeConstruct %v4float %60 %60 %60 %60 + OpStore %x_GLF_color %61 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %62 +%tint_symbol = OpFunctionParameter %main_out + %66 = OpLabel + %67 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %67 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %69 = OpLabel + %70 = OpFunctionCall %void %main_1 + %72 = OpLoad %v4float %x_GLF_color + %73 = OpCompositeConstruct %main_out %72 + %71 = OpFunctionCall %void %tint_symbol_2 %73 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c5c24bfd14 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.spvasm.expected.wgsl @@ -0,0 +1,42 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_28; + let x_29 : i32 = a; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((((vec2(x_29, x_29) / vec2(x_31, 63677))).y == x_37)) { + let x_43 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_43), f32(x_46), f32(x_49), f32(x_52)); + } else { + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_57 : f32 = f32(x_56); + x_GLF_color = vec4(x_57, x_57, x_57, x_57); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl new file mode 100644 index 0000000000..c5c24bfd14 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl @@ -0,0 +1,42 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_28; + let x_29 : i32 = a; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((((vec2(x_29, x_29) / vec2(x_31, 63677))).y == x_37)) { + let x_43 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_43), f32(x_46), f32(x_49), f32(x_52)); + } else { + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_57 : f32 = f32(x_56); + x_GLF_color = vec4(x_57, x_57, x_57, x_57); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..092451a7c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.hlsl @@ -0,0 +1,43 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const int x_28 = asint(x_6[1].x); + a = x_28; + const int x_29 = a; + const int x_31 = asint(x_6[2].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_37 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if (((int2(x_29, x_29) / int2(x_31, 63677)).y == x_37)) { + const int x_43 = asint(x_6[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_46 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_52 = asint(x_6[2].x); + x_GLF_color = float4(float(x_43), float(x_46), float(x_49), float(x_52)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_57 = float(x_56); + x_GLF_color = float4(x_57, x_57, x_57, x_57); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d74fee4c22 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int const x_28 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_28; + int const x_29 = a; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((((int2(x_29, x_29) / int2(x_31, 63677))).y == x_37)) { + int const x_43 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_49 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_43), float(x_46), float(x_49), float(x_52)); + } else { + int const x_56 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_57 = float(x_56); + *(tint_symbol_4) = float4(x_57, x_57, x_57, x_57); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b2ec6d530d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.spvasm @@ -0,0 +1,116 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 74 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %v2int = OpTypeVector %int 2 + %int_63677 = OpConstant %int 63677 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %62 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %26 = OpLoad %int %25 + OpStore %a %26 + %27 = OpLoad %int %a + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %30 = OpLoad %int %29 + %32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %33 = OpLoad %int %32 + %35 = OpCompositeConstruct %v2int %27 %27 + %37 = OpCompositeConstruct %v2int %30 %int_63677 + %38 = OpSDiv %v2int %35 %37 + %39 = OpCompositeExtract %int %38 1 + %40 = OpIEqual %bool %39 %33 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %44 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %46 + %54 = OpConvertSToF %float %48 + %55 = OpConvertSToF %float %50 + %56 = OpConvertSToF %float %52 + %57 = OpCompositeConstruct %v4float %53 %54 %55 %56 + OpStore %x_GLF_color %57 + OpBranch %42 + %44 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpCompositeConstruct %v4float %60 %60 %60 %60 + OpStore %x_GLF_color %61 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %62 +%tint_symbol = OpFunctionParameter %main_out + %66 = OpLabel + %67 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %67 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %69 = OpLabel + %70 = OpFunctionCall %void %main_1 + %72 = OpLoad %v4float %x_GLF_color + %73 = OpCompositeConstruct %main_out %72 + %71 = OpFunctionCall %void %tint_symbol_2 %73 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c5c24bfd14 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-div-round-to-zero/0-opt.wgsl.expected.wgsl @@ -0,0 +1,42 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_28; + let x_29 : i32 = a; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((((vec2(x_29, x_29) / vec2(x_31, 63677))).y == x_37)) { + let x_43 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_43), f32(x_46), f32(x_49), f32(x_52)); + } else { + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_57 : f32 = f32(x_56); + x_GLF_color = vec4(x_57, x_57, x_57, x_57); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm new file mode 100644 index 0000000000..8579b3cf57 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm @@ -0,0 +1,108 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_n1 = OpConstant %int -1 + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %11 + %30 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %31 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %32 = OpLoad %float %31 + %33 = OpConvertFToS %int %32 + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %35 = OpLoad %int %34 + %36 = OpSLessThan %bool %33 %35 + %37 = OpSelect %int %36 %int_0 %int_n1 + OpStore %a %37 + OpStore %i %int_0 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %int %i + %43 = OpSLessThan %bool %42 %int_5 + OpBranchConditional %43 %44 %39 + %44 = OpLabel + %45 = OpLoad %int %a + %46 = OpSDiv %int %45 %int_2 + OpStore %a %46 + OpBranch %40 + %40 = OpLabel + %47 = OpLoad %int %i + %48 = OpIAdd %int %47 %int_1 + OpStore %i %48 + OpBranch %38 + %39 = OpLabel + %49 = OpLoad %int %a + %50 = OpIEqual %bool %49 %int_0 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %61 + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %56 %59 %62 %65 + OpStore %_GLF_color %66 + OpBranch %51 + %53 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %68 + %70 = OpCompositeConstruct %v4float %69 %69 %69 %69 + OpStore %_GLF_color %70 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..42545afbe1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,52 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const float x_32 = gl_FragCoord.x; + const int x_35 = asint(x_7[1].x); + a = ((int(x_32) < x_35) ? 0 : -1); + i = 0; + { + for(; (i < 5); i = (i + 1)) { + a = (a / 2); + } + } + if ((a == 0)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_55 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const int x_58 = asint(x_7[1].x); + const int x_61 = asint(x_7[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_64 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + const int x_68 = asint(x_7[1].x); + const float x_69 = float(x_68); + x_GLF_color = float4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4b31f2bcdb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,65 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int a = 0; + int i = 0; + float const x_32 = (*(tint_symbol_5)).x; + int const x_35 = x_7.x_GLF_uniform_int_values.arr[1].el; + a = select(-1, 0, (int(x_32) < x_35)); + i = 0; + while (true) { + int const x_42 = i; + if ((x_42 < 5)) { + } else { + break; + } + int const x_45 = a; + a = (x_45 / 2); + { + int const x_47 = i; + i = (x_47 + 1); + } + } + int const x_49 = a; + if ((x_49 == 0)) { + int const x_55 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_58 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_7.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + int const x_68 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_69 = float(x_68); + *(tint_symbol_6) = float4(x_69, x_69, x_69, x_69); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..3b7284ce98 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,149 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 90 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_n1 = OpConstant %int -1 + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %a = OpVariable %_ptr_Function_int Function %24 + %i = OpVariable %_ptr_Function_int Function %24 + %28 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %29 = OpLoad %float %28 + %32 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %33 = OpLoad %int %32 + %35 = OpConvertFToS %int %29 + %36 = OpSLessThan %bool %35 %33 + %34 = OpSelect %int %36 %int_0 %int_n1 + OpStore %a %34 + OpStore %i %int_0 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %i + %46 = OpSLessThan %bool %44 %int_5 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + OpBranch %47 + %49 = OpLabel + OpBranch %41 + %47 = OpLabel + %50 = OpLoad %int %a + %52 = OpSDiv %int %50 %int_2 + OpStore %a %52 + OpBranch %42 + %42 = OpLabel + %53 = OpLoad %int %i + %54 = OpIAdd %int %53 %int_1 + OpStore %i %54 + OpBranch %40 + %41 = OpLabel + %55 = OpLoad %int %a + %56 = OpIEqual %bool %55 %int_0 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %61 + %69 = OpConvertSToF %float %63 + %70 = OpConvertSToF %float %65 + %71 = OpConvertSToF %float %67 + %72 = OpCompositeConstruct %v4float %68 %69 %70 %71 + OpStore %x_GLF_color %72 + OpBranch %57 + %59 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %x_GLF_color %76 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %77 +%tint_symbol_1 = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %84 = OpLabel + %85 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %85 + %86 = OpFunctionCall %void %main_1 + %88 = OpLoad %v4float %x_GLF_color + %89 = OpCompositeConstruct %main_out %88 + %87 = OpFunctionCall %void %tint_symbol_3 %89 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..15a377c596 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,60 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_32 : f32 = gl_FragCoord.x; + let x_35 : i32 = x_7.x_GLF_uniform_int_values[1]; + a = select(-1, 0, (i32(x_32) < x_35)); + i = 0; + loop { + let x_42 : i32 = i; + if ((x_42 < 5)) { + } else { + break; + } + let x_45 : i32 = a; + a = (x_45 / 2); + + continuing { + let x_47 : i32 = i; + i = (x_47 + 1); + } + } + let x_49 : i32 = a; + if ((x_49 == 0)) { + let x_55 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + } else { + let x_68 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_69 : f32 = f32(x_68); + x_GLF_color = vec4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl new file mode 100644 index 0000000000..15a377c596 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl @@ -0,0 +1,60 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_32 : f32 = gl_FragCoord.x; + let x_35 : i32 = x_7.x_GLF_uniform_int_values[1]; + a = select(-1, 0, (i32(x_32) < x_35)); + i = 0; + loop { + let x_42 : i32 = i; + if ((x_42 < 5)) { + } else { + break; + } + let x_45 : i32 = a; + a = (x_45 / 2); + + continuing { + let x_47 : i32 = i; + i = (x_47 + 1); + } + } + let x_49 : i32 = a; + if ((x_49 == 0)) { + let x_55 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + } else { + let x_68 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_69 : f32 = f32(x_68); + x_GLF_color = vec4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..42545afbe1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,52 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const float x_32 = gl_FragCoord.x; + const int x_35 = asint(x_7[1].x); + a = ((int(x_32) < x_35) ? 0 : -1); + i = 0; + { + for(; (i < 5); i = (i + 1)) { + a = (a / 2); + } + } + if ((a == 0)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_55 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const int x_58 = asint(x_7[1].x); + const int x_61 = asint(x_7[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_64 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + const int x_68 = asint(x_7[1].x); + const float x_69 = float(x_68); + x_GLF_color = float4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4b31f2bcdb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,65 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int a = 0; + int i = 0; + float const x_32 = (*(tint_symbol_5)).x; + int const x_35 = x_7.x_GLF_uniform_int_values.arr[1].el; + a = select(-1, 0, (int(x_32) < x_35)); + i = 0; + while (true) { + int const x_42 = i; + if ((x_42 < 5)) { + } else { + break; + } + int const x_45 = a; + a = (x_45 / 2); + { + int const x_47 = i; + i = (x_47 + 1); + } + } + int const x_49 = a; + if ((x_49 == 0)) { + int const x_55 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_58 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_7.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + int const x_68 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_69 = float(x_68); + *(tint_symbol_6) = float4(x_69, x_69, x_69, x_69); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..3b7284ce98 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,149 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 90 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_n1 = OpConstant %int -1 + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %a = OpVariable %_ptr_Function_int Function %24 + %i = OpVariable %_ptr_Function_int Function %24 + %28 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %29 = OpLoad %float %28 + %32 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %33 = OpLoad %int %32 + %35 = OpConvertFToS %int %29 + %36 = OpSLessThan %bool %35 %33 + %34 = OpSelect %int %36 %int_0 %int_n1 + OpStore %a %34 + OpStore %i %int_0 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %i + %46 = OpSLessThan %bool %44 %int_5 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + OpBranch %47 + %49 = OpLabel + OpBranch %41 + %47 = OpLabel + %50 = OpLoad %int %a + %52 = OpSDiv %int %50 %int_2 + OpStore %a %52 + OpBranch %42 + %42 = OpLabel + %53 = OpLoad %int %i + %54 = OpIAdd %int %53 %int_1 + OpStore %i %54 + OpBranch %40 + %41 = OpLabel + %55 = OpLoad %int %a + %56 = OpIEqual %bool %55 %int_0 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %61 + %69 = OpConvertSToF %float %63 + %70 = OpConvertSToF %float %65 + %71 = OpConvertSToF %float %67 + %72 = OpCompositeConstruct %v4float %68 %69 %70 %71 + OpStore %x_GLF_color %72 + OpBranch %57 + %59 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %x_GLF_color %76 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %77 +%tint_symbol_1 = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %84 = OpLabel + %85 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %85 + %86 = OpFunctionCall %void %main_1 + %88 = OpLoad %v4float %x_GLF_color + %89 = OpCompositeConstruct %main_out %88 + %87 = OpFunctionCall %void %tint_symbol_3 %89 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..15a377c596 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-int-full-bits-divide-by-two-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,60 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_32 : f32 = gl_FragCoord.x; + let x_35 : i32 = x_7.x_GLF_uniform_int_values[1]; + a = select(-1, 0, (i32(x_32) < x_35)); + i = 0; + loop { + let x_42 : i32 = i; + if ((x_42 < 5)) { + } else { + break; + } + let x_45 : i32 = a; + a = (x_45 / 2); + + continuing { + let x_47 : i32 = i; + i = (x_47 + 1); + } + } + let x_49 : i32 = a; + if ((x_49 == 0)) { + let x_55 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + } else { + let x_68 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_69 : f32 = f32(x_68); + x_GLF_color = vec4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm new file mode 100644 index 0000000000..ea1f789f96 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm @@ -0,0 +1,112 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %count "count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_n93448 = OpConstant %int -93448 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_2 = OpConstant %int 2 + %main = OpFunction %void None %10 + %25 = OpLabel + %count = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %26 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %27 = OpLoad %int %26 + OpStore %count %27 + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %29 = OpLoad %int %28 + OpStore %i %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %36 = OpLoad %int %35 + %37 = OpSLessThan %bool %34 %36 + OpBranchConditional %37 %38 %31 + %38 = OpLabel + %39 = OpLoad %int %count + %40 = OpSMod %int %39 %int_n93448 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpSGreaterThan %bool %40 %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + %46 = OpLoad %int %count + %47 = OpIAdd %int %46 %int_1 + OpStore %count %47 + OpBranch %44 + %44 = OpLabel + OpBranch %32 + %32 = OpLabel + %48 = OpLoad %int %i + %49 = OpIAdd %int %48 %int_1 + OpStore %i %49 + OpBranch %30 + %31 = OpLabel + %50 = OpLoad %int %count + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %52 = OpLoad %int %51 + %53 = OpIEqual %bool %50 %52 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %61 + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %67 + %69 = OpCompositeConstruct %v4float %59 %62 %65 %68 + OpStore %_GLF_color %69 + OpBranch %54 + %56 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %71 + %73 = OpCompositeConstruct %v4float %72 %72 %72 %72 + OpStore %_GLF_color %73 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..374a386f37 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int count = 0; + int i = 0; + const int x_27 = asint(x_6[1].x); + count = x_27; + const int x_29 = asint(x_6[1].x); + i = x_29; + while (true) { + const int x_34 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_36 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_34 < x_36)) { + } else { + break; + } + const int x_39 = count; + const int x_42 = asint(x_6[1].x); + if (((x_39 % -93448) > x_42)) { + count = (count + 1); + } + { + i = (i + 1); + } + } + const int x_50 = count; + const int x_52 = asint(x_6[1].x); + if ((x_50 == x_52)) { + const int x_58 = asint(x_6[2].x); + const int x_61 = asint(x_6[1].x); + const int x_64 = asint(x_6[1].x); + const int x_67 = asint(x_6[2].x); + x_GLF_color = float4(float(x_58), float(x_61), float(x_64), float(x_67)); + } else { + const int x_71 = asint(x_6[1].x); + const float x_72 = float(x_71); + x_GLF_color = float4(x_72, x_72, x_72, x_72); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..3ebe7f7285 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.msl @@ -0,0 +1,69 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int count = 0; + int i = 0; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[1].el; + count = x_27; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_29; + while (true) { + int const x_34 = i; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_34 < x_36)) { + } else { + break; + } + int const x_39 = count; + int const x_42 = x_6.x_GLF_uniform_int_values.arr[1].el; + if (((x_39 % -93448) > x_42)) { + int const x_46 = count; + count = (x_46 + 1); + } + { + int const x_48 = i; + i = (x_48 + 1); + } + } + int const x_50 = count; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_50 == x_52)) { + int const x_58 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_67 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_58), float(x_61), float(x_64), float(x_67)); + } else { + int const x_71 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_72 = float(x_71); + *(tint_symbol_4) = float4(x_72, x_72, x_72, x_72); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8a84a5fea5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %count "count" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_n93448 = OpConstant %int -93448 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %count = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + OpStore %count %27 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %29 = OpLoad %int %28 + OpStore %i %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpSLessThan %bool %34 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %31 + %40 = OpLabel + %43 = OpLoad %int %count + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %45 = OpLoad %int %44 + %47 = OpSMod %int %43 %int_n93448 + %48 = OpSGreaterThan %bool %47 %45 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + %51 = OpLoad %int %count + %52 = OpIAdd %int %51 %int_1 + OpStore %count %52 + OpBranch %49 + %49 = OpLabel + OpBranch %32 + %32 = OpLabel + %53 = OpLoad %int %i + %54 = OpIAdd %int %53 %int_1 + OpStore %i %54 + OpBranch %30 + %31 = OpLabel + %55 = OpLoad %int %count + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpIEqual %bool %55 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %64 + %72 = OpConvertSToF %float %66 + %73 = OpConvertSToF %float %68 + %74 = OpConvertSToF %float %70 + %75 = OpCompositeConstruct %v4float %71 %72 %73 %74 + OpStore %x_GLF_color %75 + OpBranch %59 + %61 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpCompositeConstruct %v4float %78 %78 %78 %78 + OpStore %x_GLF_color %79 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %80 +%tint_symbol = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %87 = OpLabel + %88 = OpFunctionCall %void %main_1 + %90 = OpLoad %v4float %x_GLF_color + %91 = OpCompositeConstruct %main_out %90 + %89 = OpFunctionCall %void %tint_symbol_2 %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c94e6de13e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.spvasm.expected.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var count : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[1]; + count = x_27; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_29; + loop { + let x_34 : i32 = i; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_34 < x_36)) { + } else { + break; + } + let x_39 : i32 = count; + let x_42 : i32 = x_6.x_GLF_uniform_int_values[1]; + if (((x_39 % -93448) > x_42)) { + let x_46 : i32 = count; + count = (x_46 + 1); + } + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_50 : i32 = count; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_50 == x_52)) { + let x_58 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_58), f32(x_61), f32(x_64), f32(x_67)); + } else { + let x_71 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_72 : f32 = f32(x_71); + x_GLF_color = vec4(x_72, x_72, x_72, x_72); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl new file mode 100644 index 0000000000..c94e6de13e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var count : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[1]; + count = x_27; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_29; + loop { + let x_34 : i32 = i; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_34 < x_36)) { + } else { + break; + } + let x_39 : i32 = count; + let x_42 : i32 = x_6.x_GLF_uniform_int_values[1]; + if (((x_39 % -93448) > x_42)) { + let x_46 : i32 = count; + count = (x_46 + 1); + } + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_50 : i32 = count; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_50 == x_52)) { + let x_58 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_58), f32(x_61), f32(x_64), f32(x_67)); + } else { + let x_71 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_72 : f32 = f32(x_71); + x_GLF_color = vec4(x_72, x_72, x_72, x_72); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..374a386f37 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int count = 0; + int i = 0; + const int x_27 = asint(x_6[1].x); + count = x_27; + const int x_29 = asint(x_6[1].x); + i = x_29; + while (true) { + const int x_34 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_36 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_34 < x_36)) { + } else { + break; + } + const int x_39 = count; + const int x_42 = asint(x_6[1].x); + if (((x_39 % -93448) > x_42)) { + count = (count + 1); + } + { + i = (i + 1); + } + } + const int x_50 = count; + const int x_52 = asint(x_6[1].x); + if ((x_50 == x_52)) { + const int x_58 = asint(x_6[2].x); + const int x_61 = asint(x_6[1].x); + const int x_64 = asint(x_6[1].x); + const int x_67 = asint(x_6[2].x); + x_GLF_color = float4(float(x_58), float(x_61), float(x_64), float(x_67)); + } else { + const int x_71 = asint(x_6[1].x); + const float x_72 = float(x_71); + x_GLF_color = float4(x_72, x_72, x_72, x_72); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..3ebe7f7285 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.msl @@ -0,0 +1,69 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int count = 0; + int i = 0; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[1].el; + count = x_27; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_29; + while (true) { + int const x_34 = i; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_34 < x_36)) { + } else { + break; + } + int const x_39 = count; + int const x_42 = x_6.x_GLF_uniform_int_values.arr[1].el; + if (((x_39 % -93448) > x_42)) { + int const x_46 = count; + count = (x_46 + 1); + } + { + int const x_48 = i; + i = (x_48 + 1); + } + } + int const x_50 = count; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_50 == x_52)) { + int const x_58 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_67 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_58), float(x_61), float(x_64), float(x_67)); + } else { + int const x_71 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_72 = float(x_71); + *(tint_symbol_4) = float4(x_72, x_72, x_72, x_72); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8a84a5fea5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %count "count" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_n93448 = OpConstant %int -93448 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %count = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + OpStore %count %27 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %29 = OpLoad %int %28 + OpStore %i %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpSLessThan %bool %34 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %31 + %40 = OpLabel + %43 = OpLoad %int %count + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %45 = OpLoad %int %44 + %47 = OpSMod %int %43 %int_n93448 + %48 = OpSGreaterThan %bool %47 %45 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + %51 = OpLoad %int %count + %52 = OpIAdd %int %51 %int_1 + OpStore %count %52 + OpBranch %49 + %49 = OpLabel + OpBranch %32 + %32 = OpLabel + %53 = OpLoad %int %i + %54 = OpIAdd %int %53 %int_1 + OpStore %i %54 + OpBranch %30 + %31 = OpLabel + %55 = OpLoad %int %count + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpIEqual %bool %55 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %64 + %72 = OpConvertSToF %float %66 + %73 = OpConvertSToF %float %68 + %74 = OpConvertSToF %float %70 + %75 = OpCompositeConstruct %v4float %71 %72 %73 %74 + OpStore %x_GLF_color %75 + OpBranch %59 + %61 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpCompositeConstruct %v4float %78 %78 %78 %78 + OpStore %x_GLF_color %79 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %80 +%tint_symbol = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %87 = OpLabel + %88 = OpFunctionCall %void %main_1 + %90 = OpLoad %v4float %x_GLF_color + %91 = OpCompositeConstruct %main_out %90 + %89 = OpFunctionCall %void %tint_symbol_2 %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c94e6de13e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-integer-modulo-negative/0-opt.wgsl.expected.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var count : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[1]; + count = x_27; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_29; + loop { + let x_34 : i32 = i; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_34 < x_36)) { + } else { + break; + } + let x_39 : i32 = count; + let x_42 : i32 = x_6.x_GLF_uniform_int_values[1]; + if (((x_39 % -93448) > x_42)) { + let x_46 : i32 = count; + count = (x_46 + 1); + } + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_50 : i32 = count; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_50 == x_52)) { + let x_58 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_58), f32(x_61), f32(x_64), f32(x_67)); + } else { + let x_71 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_72 : f32 = f32(x_71); + x_GLF_color = vec4(x_72, x_72, x_72, x_72); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm new file mode 100644 index 0000000000..7e17f3a354 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm @@ -0,0 +1,173 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %v "v" + OpName %i "i" + OpName %k "k" + OpName %j "j" + OpName %data "data" + OpName %j_0 "j" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %15 = OpTypeFunction %v3float + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v2float %float_1 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_4 = OpConstant %float 4 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %33 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %uint_2 = OpConstant %uint 2 +%_arr_v3float_uint_2 = OpTypeArray %v3float %uint_2 +%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int_4 = OpConstant %int 4 + %v3bool = OpTypeVector %bool 3 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %42 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %12 + %44 = OpLabel + %j = OpVariable %_ptr_Function_int Function + %data = OpVariable %_ptr_Function__arr_v3float_uint_2 Function + %j_0 = OpVariable %_ptr_Function_int Function + OpStore %j %int_0 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %j + %50 = OpSLessThan %bool %49 %int_1 + OpBranchConditional %50 %51 %46 + %51 = OpLabel + %52 = OpLoad %int %j + %53 = OpFunctionCall %v3float %func_ + %54 = OpAccessChain %_ptr_Function_v3float %data %52 + OpStore %54 %53 + OpBranch %47 + %47 = OpLabel + %55 = OpLoad %int %j + %56 = OpIAdd %int %55 %int_1 + OpStore %j %56 + OpBranch %45 + %46 = OpLabel + OpStore %j_0 %int_0 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %j_0 + %62 = OpSLessThan %bool %61 %int_1 + OpBranchConditional %62 %63 %58 + %63 = OpLabel + %64 = OpLoad %int %j_0 + %65 = OpIMul %int %int_4 %64 + %66 = OpIAdd %int %65 %int_1 + %67 = OpFunctionCall %v3float %func_ + %68 = OpAccessChain %_ptr_Function_v3float %data %66 + OpStore %68 %67 + OpBranch %59 + %59 = OpLabel + %69 = OpLoad %int %j_0 + %70 = OpIAdd %int %69 %int_1 + OpStore %j_0 %70 + OpBranch %57 + %58 = OpLabel + %71 = OpAccessChain %_ptr_Function_v3float %data %int_0 + %72 = OpLoad %v3float %71 + %73 = OpFOrdEqual %v3bool %72 %32 + %74 = OpAll %bool %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + %77 = OpAccessChain %_ptr_Function_v3float %data %int_1 + %78 = OpLoad %v3float %77 + %79 = OpFOrdEqual %v3bool %78 %32 + %80 = OpAll %bool %79 + OpBranch %75 + %75 = OpLabel + %81 = OpPhi %bool %74 %58 %80 %76 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + OpStore %_GLF_color %42 + OpBranch %82 + %84 = OpLabel + OpStore %_GLF_color %43 + OpBranch %82 + %82 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %v3float None %15 + %85 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function + %i = OpVariable %_ptr_Function_int Function + %k = OpVariable %_ptr_Function_int Function + OpStore %v %19 + OpStore %i %int_0 + OpStore %k %int_0 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %87 %88 None + OpBranch %89 + %89 = OpLabel + %90 = OpLoad %int %k + %91 = OpSLessThan %bool %90 %int_2 + OpBranchConditional %91 %92 %87 + %92 = OpLabel + %93 = OpAccessChain %_ptr_Function_float %v %uint_1 + %94 = OpLoad %float %93 + %95 = OpFAdd %float %94 %float_1 + %96 = OpFOrdGreaterThan %bool %95 %float_4 + OpSelectionMerge %97 None + OpBranchConditional %96 %98 %97 + %98 = OpLabel + OpBranch %87 + %97 = OpLabel + %99 = OpAccessChain %_ptr_Function_float %v %uint_1 + OpStore %99 %float_1 + %100 = OpLoad %int %i + %101 = OpIAdd %int %100 %int_1 + OpStore %i %101 + OpBranch %88 + %88 = OpLabel + %102 = OpLoad %int %k + %103 = OpIAdd %int %102 %int_1 + OpStore %k %103 + OpBranch %86 + %87 = OpLabel + %104 = OpLoad %int %i + %105 = OpSLessThan %bool %104 %int_10 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %108 + %107 = OpLabel + OpReturnValue %32 + %108 = OpLabel + OpReturnValue %33 + %106 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..bbf845ad63 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,78 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 func_() { + float2 v = float2(0.0f, 0.0f); + int i = 0; + int k = 0; + v = float2(1.0f, 1.0f); + i = 0; + k = 0; + { + for(; (k < 2); k = (k + 1)) { + const float x_94 = v.y; + if (((x_94 + 1.0f) > 4.0f)) { + break; + } + v.y = 1.0f; + i = (i + 1); + } + } + if ((i < 10)) { + return float3(1.0f, 0.0f, 0.0f); + } else { + return float3(0.0f, 0.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + int j = 0; + float3 data[2] = (float3[2])0; + int j_1 = 0; + bool x_80 = false; + bool x_81_phi = false; + j = 0; + { + for(; (j < 1); j = (j + 1)) { + const int x_52 = j; + const float3 x_53 = func_(); + data[x_52] = x_53; + } + } + j_1 = 0; + { + for(; (j_1 < 1); j_1 = (j_1 + 1)) { + const int x_64 = j_1; + const float3 x_67 = func_(); + data[((4 * x_64) + 1)] = x_67; + } + } + const float3 x_72 = data[0]; + const bool x_74 = all((x_72 == float3(1.0f, 0.0f, 0.0f))); + x_81_phi = x_74; + if (x_74) { + const float3 x_78 = data[1]; + x_80 = all((x_78 == float3(1.0f, 0.0f, 0.0f))); + x_81_phi = x_80; + } + if (x_81_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..06c165930d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + float3 arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 func_() { + float2 v = 0.0f; + int i = 0; + int k = 0; + v = float2(1.0f, 1.0f); + i = 0; + k = 0; + while (true) { + int const x_90 = k; + if ((x_90 < 2)) { + } else { + break; + } + float const x_94 = v.y; + if (((x_94 + 1.0f) > 4.0f)) { + break; + } + v.y = 1.0f; + int const x_100 = i; + i = (x_100 + 1); + { + int const x_102 = k; + k = (x_102 + 1); + } + } + int const x_104 = i; + if ((x_104 < 10)) { + return float3(1.0f, 0.0f, 0.0f); + } else { + return float3(0.0f, 0.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(thread float4* const tint_symbol_4) { + int j = 0; + tint_array_wrapper data = {}; + int j_1 = 0; + bool x_80 = false; + bool x_81_phi = false; + j = 0; + while (true) { + int const x_49 = j; + if ((x_49 < 1)) { + } else { + break; + } + int const x_52 = j; + float3 const x_53 = func_(); + data.arr[x_52] = x_53; + { + int const x_55 = j; + j = (x_55 + 1); + } + } + j_1 = 0; + while (true) { + int const x_61 = j_1; + if ((x_61 < 1)) { + } else { + break; + } + int const x_64 = j_1; + float3 const x_67 = func_(); + data.arr[((4 * x_64) + 1)] = x_67; + { + int const x_69 = j_1; + j_1 = (x_69 + 1); + } + } + float3 const x_72 = data.arr[0]; + bool const x_74 = all((x_72 == float3(1.0f, 0.0f, 0.0f))); + x_81_phi = x_74; + if (x_74) { + float3 const x_78 = data.arr[1]; + x_80 = all((x_78 == float3(1.0f, 0.0f, 0.0f))); + x_81_phi = x_80; + } + bool const x_81 = x_81_phi; + if (x_81) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..d944525bad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,233 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 138 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %v "v" + OpName %i "i" + OpName %k "k" + OpName %main_1 "main_1" + OpName %j "j" + OpName %data "data" + OpName %j_1 "j_1" + OpName %x_80 "x_80" + OpName %x_81_phi "x_81_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_v3float_uint_2 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %8 = OpTypeFunction %v3float + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v2float %float_1 %float_1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_4 = OpConstant %float 4 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %float_0 = OpConstant %float 0 + %58 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %59 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %60 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %61 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 +%_arr_v3float_uint_2 = OpTypeArray %v3float %uint_2 +%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2 + %70 = OpConstantNull %_arr_v3float_uint_2 +%_ptr_Function_bool = OpTypePointer Function %bool + %74 = OpConstantNull %bool +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int_4 = OpConstant %int 4 + %v3bool = OpTypeVector %bool 3 + %124 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %125 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %126 = OpTypeFunction %void %main_out + %func_ = OpFunction %v3float None %8 + %11 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %15 + %i = OpVariable %_ptr_Function_int Function %19 + %k = OpVariable %_ptr_Function_int Function %19 + OpStore %v %22 + OpStore %i %int_0 + OpStore %k %int_0 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %k + %30 = OpSLessThan %bool %28 %int_2 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %25 + %32 = OpLabel + %38 = OpAccessChain %_ptr_Function_float %v %uint_1 + %39 = OpLoad %float %38 + %40 = OpFAdd %float %39 %float_1 + %42 = OpFOrdGreaterThan %bool %40 %float_4 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpBranch %25 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Function_float %v %uint_1 + OpStore %45 %float_1 + %46 = OpLoad %int %i + %48 = OpIAdd %int %46 %int_1 + OpStore %i %48 + OpBranch %26 + %26 = OpLabel + %49 = OpLoad %int %k + %50 = OpIAdd %int %49 %int_1 + OpStore %k %50 + OpBranch %24 + %25 = OpLabel + %51 = OpLoad %int %i + %53 = OpSLessThan %bool %51 %int_10 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + OpReturnValue %58 + %56 = OpLabel + OpReturnValue %59 + %54 = OpLabel + OpReturnValue %60 + OpFunctionEnd + %main_1 = OpFunction %void None %61 + %64 = OpLabel + %j = OpVariable %_ptr_Function_int Function %19 + %data = OpVariable %_ptr_Function__arr_v3float_uint_2 Function %70 + %j_1 = OpVariable %_ptr_Function_int Function %19 + %x_80 = OpVariable %_ptr_Function_bool Function %74 + %x_81_phi = OpVariable %_ptr_Function_bool Function %74 + OpStore %j %int_0 + OpBranch %76 + %76 = OpLabel + OpLoopMerge %77 %78 None + OpBranch %79 + %79 = OpLabel + %80 = OpLoad %int %j + %81 = OpSLessThan %bool %80 %int_1 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + OpBranch %82 + %84 = OpLabel + OpBranch %77 + %82 = OpLabel + %85 = OpLoad %int %j + %86 = OpFunctionCall %v3float %func_ + %88 = OpAccessChain %_ptr_Function_v3float %data %85 + OpStore %88 %86 + OpBranch %78 + %78 = OpLabel + %89 = OpLoad %int %j + %90 = OpIAdd %int %89 %int_1 + OpStore %j %90 + OpBranch %76 + %77 = OpLabel + OpStore %j_1 %int_0 + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %j_1 + %96 = OpSLessThan %bool %95 %int_1 + OpSelectionMerge %97 None + OpBranchConditional %96 %98 %99 + %98 = OpLabel + OpBranch %97 + %99 = OpLabel + OpBranch %92 + %97 = OpLabel + %100 = OpLoad %int %j_1 + %101 = OpFunctionCall %v3float %func_ + %103 = OpIMul %int %int_4 %100 + %104 = OpIAdd %int %103 %int_1 + %105 = OpAccessChain %_ptr_Function_v3float %data %104 + OpStore %105 %101 + OpBranch %93 + %93 = OpLabel + %106 = OpLoad %int %j_1 + %107 = OpIAdd %int %106 %int_1 + OpStore %j_1 %107 + OpBranch %91 + %92 = OpLabel + %108 = OpAccessChain %_ptr_Function_v3float %data %int_0 + %109 = OpLoad %v3float %108 + %111 = OpFOrdEqual %v3bool %109 %58 + %110 = OpAll %bool %111 + OpStore %x_81_phi %110 + OpSelectionMerge %113 None + OpBranchConditional %110 %114 %113 + %114 = OpLabel + %115 = OpAccessChain %_ptr_Function_v3float %data %int_1 + %116 = OpLoad %v3float %115 + %118 = OpFOrdEqual %v3bool %116 %58 + %117 = OpAll %bool %118 + OpStore %x_80 %117 + %119 = OpLoad %bool %x_80 + OpStore %x_81_phi %119 + OpBranch %113 + %113 = OpLabel + %120 = OpLoad %bool %x_81_phi + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + OpStore %x_GLF_color %124 + OpBranch %121 + %123 = OpLabel + OpStore %x_GLF_color %125 + OpBranch %121 + %121 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %126 +%tint_symbol = OpFunctionParameter %main_out + %130 = OpLabel + %131 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %131 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %61 + %133 = OpLabel + %134 = OpFunctionCall %void %main_1 + %136 = OpLoad %v4float %x_GLF_color + %137 = OpCompositeConstruct %main_out %136 + %135 = OpFunctionCall %void %tint_symbol_2 %137 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a0443e6de5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,102 @@ +var x_GLF_color : vec4; + +fn func_() -> vec3 { + var v : vec2; + var i : i32; + var k : i32; + v = vec2(1.0, 1.0); + i = 0; + k = 0; + loop { + let x_90 : i32 = k; + if ((x_90 < 2)) { + } else { + break; + } + let x_94 : f32 = v.y; + if (((x_94 + 1.0) > 4.0)) { + break; + } + v.y = 1.0; + let x_100 : i32 = i; + i = (x_100 + 1); + + continuing { + let x_102 : i32 = k; + k = (x_102 + 1); + } + } + let x_104 : i32 = i; + if ((x_104 < 10)) { + return vec3(1.0, 0.0, 0.0); + } else { + return vec3(0.0, 0.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + var j : i32; + var data : array, 2>; + var j_1 : i32; + var x_80 : bool; + var x_81_phi : bool; + j = 0; + loop { + let x_49 : i32 = j; + if ((x_49 < 1)) { + } else { + break; + } + let x_52 : i32 = j; + let x_53 : vec3 = func_(); + data[x_52] = x_53; + + continuing { + let x_55 : i32 = j; + j = (x_55 + 1); + } + } + j_1 = 0; + loop { + let x_61 : i32 = j_1; + if ((x_61 < 1)) { + } else { + break; + } + let x_64 : i32 = j_1; + let x_67 : vec3 = func_(); + data[((4 * x_64) + 1)] = x_67; + + continuing { + let x_69 : i32 = j_1; + j_1 = (x_69 + 1); + } + } + let x_72 : vec3 = data[0]; + let x_74 : bool = all((x_72 == vec3(1.0, 0.0, 0.0))); + x_81_phi = x_74; + if (x_74) { + let x_78 : vec3 = data[1]; + x_80 = all((x_78 == vec3(1.0, 0.0, 0.0))); + x_81_phi = x_80; + } + let x_81 : bool = x_81_phi; + if (x_81) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl new file mode 100644 index 0000000000..a0443e6de5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl @@ -0,0 +1,102 @@ +var x_GLF_color : vec4; + +fn func_() -> vec3 { + var v : vec2; + var i : i32; + var k : i32; + v = vec2(1.0, 1.0); + i = 0; + k = 0; + loop { + let x_90 : i32 = k; + if ((x_90 < 2)) { + } else { + break; + } + let x_94 : f32 = v.y; + if (((x_94 + 1.0) > 4.0)) { + break; + } + v.y = 1.0; + let x_100 : i32 = i; + i = (x_100 + 1); + + continuing { + let x_102 : i32 = k; + k = (x_102 + 1); + } + } + let x_104 : i32 = i; + if ((x_104 < 10)) { + return vec3(1.0, 0.0, 0.0); + } else { + return vec3(0.0, 0.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + var j : i32; + var data : array, 2>; + var j_1 : i32; + var x_80 : bool; + var x_81_phi : bool; + j = 0; + loop { + let x_49 : i32 = j; + if ((x_49 < 1)) { + } else { + break; + } + let x_52 : i32 = j; + let x_53 : vec3 = func_(); + data[x_52] = x_53; + + continuing { + let x_55 : i32 = j; + j = (x_55 + 1); + } + } + j_1 = 0; + loop { + let x_61 : i32 = j_1; + if ((x_61 < 1)) { + } else { + break; + } + let x_64 : i32 = j_1; + let x_67 : vec3 = func_(); + data[((4 * x_64) + 1)] = x_67; + + continuing { + let x_69 : i32 = j_1; + j_1 = (x_69 + 1); + } + } + let x_72 : vec3 = data[0]; + let x_74 : bool = all((x_72 == vec3(1.0, 0.0, 0.0))); + x_81_phi = x_74; + if (x_74) { + let x_78 : vec3 = data[1]; + x_80 = all((x_78 == vec3(1.0, 0.0, 0.0))); + x_81_phi = x_80; + } + let x_81 : bool = x_81_phi; + if (x_81) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..bbf845ad63 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,78 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 func_() { + float2 v = float2(0.0f, 0.0f); + int i = 0; + int k = 0; + v = float2(1.0f, 1.0f); + i = 0; + k = 0; + { + for(; (k < 2); k = (k + 1)) { + const float x_94 = v.y; + if (((x_94 + 1.0f) > 4.0f)) { + break; + } + v.y = 1.0f; + i = (i + 1); + } + } + if ((i < 10)) { + return float3(1.0f, 0.0f, 0.0f); + } else { + return float3(0.0f, 0.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + int j = 0; + float3 data[2] = (float3[2])0; + int j_1 = 0; + bool x_80 = false; + bool x_81_phi = false; + j = 0; + { + for(; (j < 1); j = (j + 1)) { + const int x_52 = j; + const float3 x_53 = func_(); + data[x_52] = x_53; + } + } + j_1 = 0; + { + for(; (j_1 < 1); j_1 = (j_1 + 1)) { + const int x_64 = j_1; + const float3 x_67 = func_(); + data[((4 * x_64) + 1)] = x_67; + } + } + const float3 x_72 = data[0]; + const bool x_74 = all((x_72 == float3(1.0f, 0.0f, 0.0f))); + x_81_phi = x_74; + if (x_74) { + const float3 x_78 = data[1]; + x_80 = all((x_78 == float3(1.0f, 0.0f, 0.0f))); + x_81_phi = x_80; + } + if (x_81_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..06c165930d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + float3 arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 func_() { + float2 v = 0.0f; + int i = 0; + int k = 0; + v = float2(1.0f, 1.0f); + i = 0; + k = 0; + while (true) { + int const x_90 = k; + if ((x_90 < 2)) { + } else { + break; + } + float const x_94 = v.y; + if (((x_94 + 1.0f) > 4.0f)) { + break; + } + v.y = 1.0f; + int const x_100 = i; + i = (x_100 + 1); + { + int const x_102 = k; + k = (x_102 + 1); + } + } + int const x_104 = i; + if ((x_104 < 10)) { + return float3(1.0f, 0.0f, 0.0f); + } else { + return float3(0.0f, 0.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(thread float4* const tint_symbol_4) { + int j = 0; + tint_array_wrapper data = {}; + int j_1 = 0; + bool x_80 = false; + bool x_81_phi = false; + j = 0; + while (true) { + int const x_49 = j; + if ((x_49 < 1)) { + } else { + break; + } + int const x_52 = j; + float3 const x_53 = func_(); + data.arr[x_52] = x_53; + { + int const x_55 = j; + j = (x_55 + 1); + } + } + j_1 = 0; + while (true) { + int const x_61 = j_1; + if ((x_61 < 1)) { + } else { + break; + } + int const x_64 = j_1; + float3 const x_67 = func_(); + data.arr[((4 * x_64) + 1)] = x_67; + { + int const x_69 = j_1; + j_1 = (x_69 + 1); + } + } + float3 const x_72 = data.arr[0]; + bool const x_74 = all((x_72 == float3(1.0f, 0.0f, 0.0f))); + x_81_phi = x_74; + if (x_74) { + float3 const x_78 = data.arr[1]; + x_80 = all((x_78 == float3(1.0f, 0.0f, 0.0f))); + x_81_phi = x_80; + } + bool const x_81 = x_81_phi; + if (x_81) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..d944525bad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,233 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 138 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %v "v" + OpName %i "i" + OpName %k "k" + OpName %main_1 "main_1" + OpName %j "j" + OpName %data "data" + OpName %j_1 "j_1" + OpName %x_80 "x_80" + OpName %x_81_phi "x_81_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_v3float_uint_2 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %8 = OpTypeFunction %v3float + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v2float %float_1 %float_1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_4 = OpConstant %float 4 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %float_0 = OpConstant %float 0 + %58 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %59 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %60 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %61 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 +%_arr_v3float_uint_2 = OpTypeArray %v3float %uint_2 +%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2 + %70 = OpConstantNull %_arr_v3float_uint_2 +%_ptr_Function_bool = OpTypePointer Function %bool + %74 = OpConstantNull %bool +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int_4 = OpConstant %int 4 + %v3bool = OpTypeVector %bool 3 + %124 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %125 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %126 = OpTypeFunction %void %main_out + %func_ = OpFunction %v3float None %8 + %11 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %15 + %i = OpVariable %_ptr_Function_int Function %19 + %k = OpVariable %_ptr_Function_int Function %19 + OpStore %v %22 + OpStore %i %int_0 + OpStore %k %int_0 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %k + %30 = OpSLessThan %bool %28 %int_2 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %25 + %32 = OpLabel + %38 = OpAccessChain %_ptr_Function_float %v %uint_1 + %39 = OpLoad %float %38 + %40 = OpFAdd %float %39 %float_1 + %42 = OpFOrdGreaterThan %bool %40 %float_4 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpBranch %25 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Function_float %v %uint_1 + OpStore %45 %float_1 + %46 = OpLoad %int %i + %48 = OpIAdd %int %46 %int_1 + OpStore %i %48 + OpBranch %26 + %26 = OpLabel + %49 = OpLoad %int %k + %50 = OpIAdd %int %49 %int_1 + OpStore %k %50 + OpBranch %24 + %25 = OpLabel + %51 = OpLoad %int %i + %53 = OpSLessThan %bool %51 %int_10 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + OpReturnValue %58 + %56 = OpLabel + OpReturnValue %59 + %54 = OpLabel + OpReturnValue %60 + OpFunctionEnd + %main_1 = OpFunction %void None %61 + %64 = OpLabel + %j = OpVariable %_ptr_Function_int Function %19 + %data = OpVariable %_ptr_Function__arr_v3float_uint_2 Function %70 + %j_1 = OpVariable %_ptr_Function_int Function %19 + %x_80 = OpVariable %_ptr_Function_bool Function %74 + %x_81_phi = OpVariable %_ptr_Function_bool Function %74 + OpStore %j %int_0 + OpBranch %76 + %76 = OpLabel + OpLoopMerge %77 %78 None + OpBranch %79 + %79 = OpLabel + %80 = OpLoad %int %j + %81 = OpSLessThan %bool %80 %int_1 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + OpBranch %82 + %84 = OpLabel + OpBranch %77 + %82 = OpLabel + %85 = OpLoad %int %j + %86 = OpFunctionCall %v3float %func_ + %88 = OpAccessChain %_ptr_Function_v3float %data %85 + OpStore %88 %86 + OpBranch %78 + %78 = OpLabel + %89 = OpLoad %int %j + %90 = OpIAdd %int %89 %int_1 + OpStore %j %90 + OpBranch %76 + %77 = OpLabel + OpStore %j_1 %int_0 + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %j_1 + %96 = OpSLessThan %bool %95 %int_1 + OpSelectionMerge %97 None + OpBranchConditional %96 %98 %99 + %98 = OpLabel + OpBranch %97 + %99 = OpLabel + OpBranch %92 + %97 = OpLabel + %100 = OpLoad %int %j_1 + %101 = OpFunctionCall %v3float %func_ + %103 = OpIMul %int %int_4 %100 + %104 = OpIAdd %int %103 %int_1 + %105 = OpAccessChain %_ptr_Function_v3float %data %104 + OpStore %105 %101 + OpBranch %93 + %93 = OpLabel + %106 = OpLoad %int %j_1 + %107 = OpIAdd %int %106 %int_1 + OpStore %j_1 %107 + OpBranch %91 + %92 = OpLabel + %108 = OpAccessChain %_ptr_Function_v3float %data %int_0 + %109 = OpLoad %v3float %108 + %111 = OpFOrdEqual %v3bool %109 %58 + %110 = OpAll %bool %111 + OpStore %x_81_phi %110 + OpSelectionMerge %113 None + OpBranchConditional %110 %114 %113 + %114 = OpLabel + %115 = OpAccessChain %_ptr_Function_v3float %data %int_1 + %116 = OpLoad %v3float %115 + %118 = OpFOrdEqual %v3bool %116 %58 + %117 = OpAll %bool %118 + OpStore %x_80 %117 + %119 = OpLoad %bool %x_80 + OpStore %x_81_phi %119 + OpBranch %113 + %113 = OpLabel + %120 = OpLoad %bool %x_81_phi + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + OpStore %x_GLF_color %124 + OpBranch %121 + %123 = OpLabel + OpStore %x_GLF_color %125 + OpBranch %121 + %121 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %126 +%tint_symbol = OpFunctionParameter %main_out + %130 = OpLabel + %131 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %131 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %61 + %133 = OpLabel + %134 = OpFunctionCall %void %main_1 + %136 = OpLoad %v4float %x_GLF_color + %137 = OpCompositeConstruct %main_out %136 + %135 = OpFunctionCall %void %tint_symbol_2 %137 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a0443e6de5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-intervalmap-set-stop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,102 @@ +var x_GLF_color : vec4; + +fn func_() -> vec3 { + var v : vec2; + var i : i32; + var k : i32; + v = vec2(1.0, 1.0); + i = 0; + k = 0; + loop { + let x_90 : i32 = k; + if ((x_90 < 2)) { + } else { + break; + } + let x_94 : f32 = v.y; + if (((x_94 + 1.0) > 4.0)) { + break; + } + v.y = 1.0; + let x_100 : i32 = i; + i = (x_100 + 1); + + continuing { + let x_102 : i32 = k; + k = (x_102 + 1); + } + } + let x_104 : i32 = i; + if ((x_104 < 10)) { + return vec3(1.0, 0.0, 0.0); + } else { + return vec3(0.0, 0.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + var j : i32; + var data : array, 2>; + var j_1 : i32; + var x_80 : bool; + var x_81_phi : bool; + j = 0; + loop { + let x_49 : i32 = j; + if ((x_49 < 1)) { + } else { + break; + } + let x_52 : i32 = j; + let x_53 : vec3 = func_(); + data[x_52] = x_53; + + continuing { + let x_55 : i32 = j; + j = (x_55 + 1); + } + } + j_1 = 0; + loop { + let x_61 : i32 = j_1; + if ((x_61 < 1)) { + } else { + break; + } + let x_64 : i32 = j_1; + let x_67 : vec3 = func_(); + data[((4 * x_64) + 1)] = x_67; + + continuing { + let x_69 : i32 = j_1; + j_1 = (x_69 + 1); + } + } + let x_72 : vec3 = data[0]; + let x_74 : bool = all((x_72 == vec3(1.0, 0.0, 0.0))); + x_81_phi = x_74; + if (x_74) { + let x_78 : vec3 = data[1]; + x_80 = all((x_78 == vec3(1.0, 0.0, 0.0))); + x_81_phi = x_80; + } + let x_81 : bool = x_81_phi; + if (x_81) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm new file mode 100644 index 0000000000..da27419481 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm @@ -0,0 +1,96 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v1 "v1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %int_n256 = OpConstant %int -256 +%mat2v2float = OpTypeMatrix %v2float 2 + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %12 + %33 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %35 = OpLoad %float %34 + %36 = OpCompositeConstruct %v2float %35 %35 + OpStore %v1 %36 + %37 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %40 = OpLoad %float %39 + %41 = OpExtInst %float %1 Ldexp %40 %int_n256 + %42 = OpAccessChain %_ptr_Function_float %v1 %38 + OpStore %42 %41 + %43 = OpLoad %v2float %v1 + %44 = OpCompositeConstruct %v2float %35 %float_0 + %45 = OpCompositeConstruct %v2float %float_0 %35 + %46 = OpCompositeConstruct %mat2v2float %44 %45 + %47 = OpVectorTimesMatrix %v2float %43 %46 + %48 = OpCompositeExtract %float %47 0 + %49 = OpFOrdEqual %bool %48 %35 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + %53 = OpConvertSToF %float %38 + %54 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpCompositeConstruct %v4float %53 %56 %56 %53 + OpStore %_GLF_color %57 + OpBranch %50 + %52 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpCompositeConstruct %v4float %60 %60 %60 %60 + OpStore %_GLF_color %61 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..1ce3a68ab7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.hlsl @@ -0,0 +1,47 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v1 = float2(0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_35 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + v1 = float2(x_35, x_35); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_40 = v1.y; + set_float2(v1, x_38, ldexp(x_40, -256)); + if ((mul(float2x2(float2(x_35, 0.0f), float2(0.0f, x_35)), v1).x == x_35)) { + const float x_53 = float(x_38); + const int x_55 = asint(x_8[1].x); + const float x_56 = float(x_55); + x_GLF_color = float4(x_53, x_56, x_56, x_53); + } else { + const int x_59 = asint(x_8[1].x); + const float x_60 = float(x_59); + x_GLF_color = float4(x_60, x_60, x_60, x_60); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.msl new file mode 100644 index 0000000000..4b271a5b06 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.msl @@ -0,0 +1,59 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float2 v1 = 0.0f; + float const x_35 = x_6.x_GLF_uniform_float_values.arr[0].el; + v1 = float2(x_35, x_35); + int const x_38 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_40 = v1.y; + v1[x_38] = ldexp(x_40, -256); + float2 const x_43 = v1; + if ((((x_43 * float2x2(float2(x_35, 0.0f), float2(0.0f, x_35)))).x == x_35)) { + float const x_53 = float(x_38); + int const x_55 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_56 = float(x_55); + *(tint_symbol_4) = float4(x_53, x_56, x_56, x_53); + } else { + int const x_59 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_60 = float(x_59); + *(tint_symbol_4) = float4(x_60, x_60, x_60, x_60); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..779691cbe5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.spvasm @@ -0,0 +1,131 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %42 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v1 "v1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpConstantNull %v2float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %int_n256 = OpConstant %int -256 +%mat2v2float = OpTypeMatrix %v2float 2 + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function %26 + %30 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %31 = OpLoad %float %30 + %32 = OpCompositeConstruct %v2float %31 %31 + OpStore %v1 %32 + %34 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %35 = OpLoad %int %34 + %38 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Function_float %v1 %35 + %41 = OpExtInst %float %42 Ldexp %39 %int_n256 + OpStore %40 %41 + %44 = OpLoad %v2float %v1 + %47 = OpCompositeConstruct %v2float %31 %float_0 + %48 = OpCompositeConstruct %v2float %float_0 %31 + %49 = OpCompositeConstruct %mat2v2float %47 %48 + %50 = OpVectorTimesMatrix %v2float %44 %49 + %51 = OpCompositeExtract %float %50 0 + %52 = OpFOrdEqual %bool %51 %31 + OpSelectionMerge %54 None + OpBranchConditional %52 %55 %56 + %55 = OpLabel + %57 = OpConvertSToF %float %35 + %59 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpCompositeConstruct %v4float %57 %61 %61 %57 + OpStore %x_GLF_color %62 + OpBranch %54 + %56 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %65 %65 %65 %65 + OpStore %x_GLF_color %66 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..83090a7bfa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.spvasm.expected.wgsl @@ -0,0 +1,51 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec2; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[0]; + v1 = vec2(x_35, x_35); + let x_38 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_40 : f32 = v1.y; + v1[x_38] = ldexp(x_40, -256); + let x_43 : vec2 = v1; + if ((((x_43 * mat2x2(vec2(x_35, 0.0), vec2(0.0, x_35)))).x == x_35)) { + let x_53 : f32 = f32(x_38); + let x_55 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_56 : f32 = f32(x_55); + x_GLF_color = vec4(x_53, x_56, x_56, x_53); + } else { + let x_59 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_60 : f32 = f32(x_59); + x_GLF_color = vec4(x_60, x_60, x_60, x_60); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl new file mode 100644 index 0000000000..83090a7bfa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl @@ -0,0 +1,51 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec2; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[0]; + v1 = vec2(x_35, x_35); + let x_38 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_40 : f32 = v1.y; + v1[x_38] = ldexp(x_40, -256); + let x_43 : vec2 = v1; + if ((((x_43 * mat2x2(vec2(x_35, 0.0), vec2(0.0, x_35)))).x == x_35)) { + let x_53 : f32 = f32(x_38); + let x_55 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_56 : f32 = f32(x_55); + x_GLF_color = vec4(x_53, x_56, x_56, x_53); + } else { + let x_59 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_60 : f32 = f32(x_59); + x_GLF_color = vec4(x_60, x_60, x_60, x_60); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..1ce3a68ab7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.hlsl @@ -0,0 +1,47 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v1 = float2(0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_35 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + v1 = float2(x_35, x_35); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_40 = v1.y; + set_float2(v1, x_38, ldexp(x_40, -256)); + if ((mul(float2x2(float2(x_35, 0.0f), float2(0.0f, x_35)), v1).x == x_35)) { + const float x_53 = float(x_38); + const int x_55 = asint(x_8[1].x); + const float x_56 = float(x_55); + x_GLF_color = float4(x_53, x_56, x_56, x_53); + } else { + const int x_59 = asint(x_8[1].x); + const float x_60 = float(x_59); + x_GLF_color = float4(x_60, x_60, x_60, x_60); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.msl new file mode 100644 index 0000000000..4b271a5b06 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.msl @@ -0,0 +1,59 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float2 v1 = 0.0f; + float const x_35 = x_6.x_GLF_uniform_float_values.arr[0].el; + v1 = float2(x_35, x_35); + int const x_38 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_40 = v1.y; + v1[x_38] = ldexp(x_40, -256); + float2 const x_43 = v1; + if ((((x_43 * float2x2(float2(x_35, 0.0f), float2(0.0f, x_35)))).x == x_35)) { + float const x_53 = float(x_38); + int const x_55 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_56 = float(x_55); + *(tint_symbol_4) = float4(x_53, x_56, x_56, x_53); + } else { + int const x_59 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_60 = float(x_59); + *(tint_symbol_4) = float4(x_60, x_60, x_60, x_60); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..779691cbe5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.spvasm @@ -0,0 +1,131 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %42 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v1 "v1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpConstantNull %v2float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %int_n256 = OpConstant %int -256 +%mat2v2float = OpTypeMatrix %v2float 2 + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function %26 + %30 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %31 = OpLoad %float %30 + %32 = OpCompositeConstruct %v2float %31 %31 + OpStore %v1 %32 + %34 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %35 = OpLoad %int %34 + %38 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Function_float %v1 %35 + %41 = OpExtInst %float %42 Ldexp %39 %int_n256 + OpStore %40 %41 + %44 = OpLoad %v2float %v1 + %47 = OpCompositeConstruct %v2float %31 %float_0 + %48 = OpCompositeConstruct %v2float %float_0 %31 + %49 = OpCompositeConstruct %mat2v2float %47 %48 + %50 = OpVectorTimesMatrix %v2float %44 %49 + %51 = OpCompositeExtract %float %50 0 + %52 = OpFOrdEqual %bool %51 %31 + OpSelectionMerge %54 None + OpBranchConditional %52 %55 %56 + %55 = OpLabel + %57 = OpConvertSToF %float %35 + %59 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpCompositeConstruct %v4float %57 %61 %61 %57 + OpStore %x_GLF_color %62 + OpBranch %54 + %56 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %65 %65 %65 %65 + OpStore %x_GLF_color %66 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..83090a7bfa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ldexp-undefined-mat-vec-multiply/0.wgsl.expected.wgsl @@ -0,0 +1,51 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec2; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[0]; + v1 = vec2(x_35, x_35); + let x_38 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_40 : f32 = v1.y; + v1[x_38] = ldexp(x_40, -256); + let x_43 : vec2 = v1; + if ((((x_43 * mat2x2(vec2(x_35, 0.0), vec2(0.0, x_35)))).x == x_35)) { + let x_53 : f32 = f32(x_38); + let x_55 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_56 : f32 = f32(x_55); + x_GLF_color = vec4(x_53, x_56, x_56, x_53); + } else { + let x_59 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_60 : f32 = f32(x_59); + x_GLF_color = vec4(x_60, x_60, x_60, x_60); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm new file mode 100644 index 0000000000..4e6470566f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm @@ -0,0 +1,90 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %idx "idx" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %a "a" + OpName %indexable "indexable" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %11 + %25 = OpLabel + %idx = OpVariable %_ptr_Function_int Function + %a = OpVariable %_ptr_Function_int Function + %indexable = OpVariable %_ptr_Function__arr_int_uint_2 Function + %26 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %27 = OpLoad %int %26 + %28 = OpShiftLeftLogical %int %int_1 %27 + OpStore %idx %28 + %29 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %30 = OpLoad %int %29 + %31 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %32 = OpLoad %int %31 + %33 = OpCompositeConstruct %_arr_int_uint_2 %30 %32 + %34 = OpLoad %int %idx + OpStore %indexable %33 + %35 = OpAccessChain %_ptr_Function_int %indexable %34 + %36 = OpLoad %int %35 + OpStore %a %36 + %37 = OpLoad %int %a + %38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpIEqual %bool %37 %39 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %43 + %42 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %45 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %48 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %51 + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %54 + %56 = OpCompositeConstruct %v4float %46 %49 %52 %55 + OpStore %_GLF_color %56 + OpBranch %41 + %43 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpCompositeConstruct %v4float %59 %59 %59 %59 + OpStore %_GLF_color %60 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3169db61f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.hlsl @@ -0,0 +1,55 @@ +struct tint_padded_array_element { + int el; +}; + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int idx = 0; + int a = 0; + tint_padded_array_element indexable[2] = (tint_padded_array_element[2])0; + const int x_27 = asint(x_6[1].x); + idx = (1 << asuint(x_27)); + const int x_30 = asint(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_32 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_34 = idx; + const tint_padded_array_element tint_symbol_3[2] = {{x_30}, {x_32}}; + indexable = tint_symbol_3; + const int x_36 = indexable[x_34].el; + a = x_36; + const int x_37 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_39 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_37 == x_39)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_48 = asint(x_6[1].x); + const int x_51 = asint(x_6[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + } else { + const int x_58 = asint(x_6[1].x); + const float x_59 = float(x_58); + x_GLF_color = float4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..2ff0873e4c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, thread float4* const tint_symbol_5) { + int idx = 0; + int a = 0; + tint_array_wrapper indexable = {}; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[1].el; + idx = (1 << as_type(x_27)); + int const x_30 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_34 = idx; + tint_array_wrapper const tint_symbol_3 = {.arr={{.el=x_30}, {.el=x_32}}}; + indexable = tint_symbol_3; + int const x_36 = indexable.arr[x_34].el; + a = x_36; + int const x_37 = a; + int const x_39 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_37 == x_39)) { + int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_54 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + } else { + int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_59 = float(x_58); + *(tint_symbol_5) = float4(x_59, x_59, x_59, x_59); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..46246e778b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %idx "idx" + OpName %a "a" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %25 = OpConstantNull %_arr_int_uint_2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %idx = OpVariable %_ptr_Function_int Function %21 + %a = OpVariable %_ptr_Function_int Function %21 + %indexable = OpVariable %_ptr_Function__arr_int_uint_2 Function %25 + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %30 = OpLoad %int %29 + %31 = OpBitcast %uint %30 + %32 = OpShiftLeftLogical %int %int_1 %31 + OpStore %idx %32 + %33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %34 = OpLoad %int %33 + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpLoad %int %idx + %39 = OpCompositeConstruct %_arr_int_uint_2 %34 %37 + OpStore %indexable %39 + %40 = OpAccessChain %_ptr_Function_int %indexable %38 + %41 = OpLoad %int %40 + OpStore %a %41 + %42 = OpLoad %int %a + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpIEqual %bool %42 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %48 %49 + %48 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %51 + %59 = OpConvertSToF %float %53 + %60 = OpConvertSToF %float %55 + %61 = OpConvertSToF %float %57 + %62 = OpCompositeConstruct %v4float %58 %59 %60 %61 + OpStore %x_GLF_color %62 + OpBranch %47 + %49 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %65 %65 %65 %65 + OpStore %x_GLF_color %66 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a39da82a58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.spvasm.expected.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var idx : i32; + var a : i32; + var indexable : Arr; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[1]; + idx = (1 << bitcast(x_27)); + let x_30 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_34 : i32 = idx; + indexable = Arr(x_30, x_32); + let x_36 : i32 = indexable[x_34]; + a = x_36; + let x_37 : i32 = a; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_37 == x_39)) { + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_45), f32(x_48), f32(x_51), f32(x_54)); + } else { + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_59 : f32 = f32(x_58); + x_GLF_color = vec4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl new file mode 100644 index 0000000000..a39da82a58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var idx : i32; + var a : i32; + var indexable : Arr; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[1]; + idx = (1 << bitcast(x_27)); + let x_30 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_34 : i32 = idx; + indexable = Arr(x_30, x_32); + let x_36 : i32 = indexable[x_34]; + a = x_36; + let x_37 : i32 = a; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_37 == x_39)) { + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_45), f32(x_48), f32(x_51), f32(x_54)); + } else { + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_59 : f32 = f32(x_58); + x_GLF_color = vec4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3169db61f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.hlsl @@ -0,0 +1,55 @@ +struct tint_padded_array_element { + int el; +}; + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int idx = 0; + int a = 0; + tint_padded_array_element indexable[2] = (tint_padded_array_element[2])0; + const int x_27 = asint(x_6[1].x); + idx = (1 << asuint(x_27)); + const int x_30 = asint(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_32 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_34 = idx; + const tint_padded_array_element tint_symbol_3[2] = {{x_30}, {x_32}}; + indexable = tint_symbol_3; + const int x_36 = indexable[x_34].el; + a = x_36; + const int x_37 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_39 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_37 == x_39)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_48 = asint(x_6[1].x); + const int x_51 = asint(x_6[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + } else { + const int x_58 = asint(x_6[1].x); + const float x_59 = float(x_58); + x_GLF_color = float4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..2ff0873e4c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, thread float4* const tint_symbol_5) { + int idx = 0; + int a = 0; + tint_array_wrapper indexable = {}; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[1].el; + idx = (1 << as_type(x_27)); + int const x_30 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_32 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_34 = idx; + tint_array_wrapper const tint_symbol_3 = {.arr={{.el=x_30}, {.el=x_32}}}; + indexable = tint_symbol_3; + int const x_36 = indexable.arr[x_34].el; + a = x_36; + int const x_37 = a; + int const x_39 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_37 == x_39)) { + int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_54 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + } else { + int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_59 = float(x_58); + *(tint_symbol_5) = float4(x_59, x_59, x_59, x_59); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..46246e778b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %idx "idx" + OpName %a "a" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %25 = OpConstantNull %_arr_int_uint_2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %idx = OpVariable %_ptr_Function_int Function %21 + %a = OpVariable %_ptr_Function_int Function %21 + %indexable = OpVariable %_ptr_Function__arr_int_uint_2 Function %25 + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %30 = OpLoad %int %29 + %31 = OpBitcast %uint %30 + %32 = OpShiftLeftLogical %int %int_1 %31 + OpStore %idx %32 + %33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %34 = OpLoad %int %33 + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpLoad %int %idx + %39 = OpCompositeConstruct %_arr_int_uint_2 %34 %37 + OpStore %indexable %39 + %40 = OpAccessChain %_ptr_Function_int %indexable %38 + %41 = OpLoad %int %40 + OpStore %a %41 + %42 = OpLoad %int %a + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpIEqual %bool %42 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %48 %49 + %48 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %51 + %59 = OpConvertSToF %float %53 + %60 = OpConvertSToF %float %55 + %61 = OpConvertSToF %float %57 + %62 = OpCompositeConstruct %v4float %58 %59 %60 %61 + OpStore %x_GLF_color %62 + OpBranch %47 + %49 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %65 %65 %65 %65 + OpStore %x_GLF_color %66 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a39da82a58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-array-access/0-opt.wgsl.expected.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var idx : i32; + var a : i32; + var indexable : Arr; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[1]; + idx = (1 << bitcast(x_27)); + let x_30 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_32 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_34 : i32 = idx; + indexable = Arr(x_30, x_32); + let x_36 : i32 = indexable[x_34]; + a = x_36; + let x_37 : i32 = a; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_37 == x_39)) { + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_45), f32(x_48), f32(x_51), f32(x_54)); + } else { + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_59 : f32 = f32(x_58); + x_GLF_color = vec4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm new file mode 100644 index 0000000000..95ad9eced5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm @@ -0,0 +1,72 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main = OpFunction %void None %8 + %22 = OpLabel + %23 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %24 = OpLoad %int %23 + %25 = OpConvertSToF %float %24 + %26 = OpCompositeConstruct %v4float %25 %25 %25 %25 + OpStore %_GLF_color %26 + %27 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %28 = OpLoad %int %27 + %29 = OpShiftLeftLogical %int %28 %28 + %30 = OpShiftRightArithmetic %int %29 %int_1 + OpBranch %31 + %31 = OpLabel + %32 = OpPhi %int %24 %22 %33 %34 + %35 = OpSLessThan %bool %30 %int_10 + OpLoopMerge %36 %34 None + OpBranchConditional %35 %37 %36 + %37 = OpLabel + %33 = OpIAdd %int %32 %int_1 + %38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %39 = OpLoad %int %38 + %40 = OpIEqual %bool %33 %39 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + %43 = OpConvertSToF %float %28 + %44 = OpCompositeConstruct %v4float %43 %25 %25 %43 + OpStore %_GLF_color %44 + OpBranch %36 + %41 = OpLabel + OpBranch %34 + %34 = OpLabel + OpBranch %31 + %36 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..9531ab8c53 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.hlsl @@ -0,0 +1,48 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[3]; +}; + +void main_1() { + int x_32_phi = 0; + const int x_24 = asint(x_5[1].x); + const float x_25 = float(x_24); + x_GLF_color = float4(x_25, x_25, x_25, x_25); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_28 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_30 = ((x_28 << asuint(x_28)) >> asuint(1)); + x_32_phi = x_24; + while (true) { + const int x_32 = x_32_phi; + if ((x_30 < 10)) { + } else { + break; + } + int x_33 = 0; + x_33 = (x_32 + 1); + const int x_39 = asint(x_5[2].x); + if ((x_33 == asint(x_39))) { + const float x_43 = float(x_28); + x_GLF_color = float4(x_43, x_25, x_25, x_43); + break; + } + { + x_32_phi = x_33; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.msl new file mode 100644 index 0000000000..6500f1c113 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int x_32_phi = 0; + int const x_24 = x_5.x_GLF_uniform_int_values.arr[1].el; + float const x_25 = float(x_24); + *(tint_symbol_4) = float4(x_25, x_25, x_25, x_25); + int const x_28 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_30 = ((x_28 << as_type(x_28)) >> as_type(1)); + x_32_phi = x_24; + while (true) { + int const x_32 = x_32_phi; + if ((x_30 < 10)) { + } else { + break; + } + int x_33 = 0; + x_33 = (x_32 + 1); + int const x_39 = x_5.x_GLF_uniform_int_values.arr[2].el; + if ((x_33 == as_type(x_39))) { + float const x_43 = float(x_28); + *(tint_symbol_4) = float4(x_43, x_25, x_25, x_43); + break; + } + { + x_32_phi = x_33; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..4dab00bf42 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_32_phi "x_32_phi" + OpName %x_33 "x_33" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %60 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_32_phi = OpVariable %_ptr_Function_int Function %21 + %x_33 = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %26 = OpLoad %int %25 + %27 = OpConvertSToF %float %26 + %28 = OpCompositeConstruct %v4float %27 %27 %27 %27 + OpStore %x_GLF_color %28 + %30 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpBitcast %uint %31 + %33 = OpShiftLeftLogical %int %31 %32 + %34 = OpBitcast %uint %int_1 + %35 = OpShiftRightArithmetic %int %33 %34 + OpStore %x_32_phi %26 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %x_32_phi + %42 = OpSLessThan %bool %35 %int_10 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %37 + %44 = OpLabel + %48 = OpIAdd %int %40 %int_1 + OpStore %x_33 %48 + %50 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %51 = OpLoad %int %50 + %52 = OpLoad %int %x_33 + %53 = OpCopyObject %int %51 + %54 = OpIEqual %bool %52 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + %57 = OpConvertSToF %float %31 + %58 = OpCompositeConstruct %v4float %57 %27 %27 %57 + OpStore %x_GLF_color %58 + OpBranch %37 + %55 = OpLabel + OpBranch %38 + %38 = OpLabel + %59 = OpLoad %int %x_33 + OpStore %x_32_phi %59 + OpBranch %36 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %60 +%tint_symbol = OpFunctionParameter %main_out + %64 = OpLabel + %65 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %65 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %67 = OpLabel + %68 = OpFunctionCall %void %main_1 + %70 = OpLoad %v4float %x_GLF_color + %71 = OpCompositeConstruct %main_out %70 + %69 = OpFunctionCall %void %tint_symbol_2 %71 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..7ccdb81f89 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.spvasm.expected.wgsl @@ -0,0 +1,51 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_32_phi : i32; + let x_24 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_25 : f32 = f32(x_24); + x_GLF_color = vec4(x_25, x_25, x_25, x_25); + let x_28 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_30 : i32 = ((x_28 << bitcast(x_28)) >> bitcast(1)); + x_32_phi = x_24; + loop { + let x_32 : i32 = x_32_phi; + if ((x_30 < 10)) { + } else { + break; + } + var x_33 : i32; + x_33 = (x_32 + 1); + let x_39 : i32 = x_5.x_GLF_uniform_int_values[2]; + if ((x_33 == bitcast(x_39))) { + let x_43 : f32 = f32(x_28); + x_GLF_color = vec4(x_43, x_25, x_25, x_43); + break; + } + + continuing { + x_32_phi = x_33; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl new file mode 100644 index 0000000000..7ccdb81f89 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl @@ -0,0 +1,51 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_32_phi : i32; + let x_24 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_25 : f32 = f32(x_24); + x_GLF_color = vec4(x_25, x_25, x_25, x_25); + let x_28 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_30 : i32 = ((x_28 << bitcast(x_28)) >> bitcast(1)); + x_32_phi = x_24; + loop { + let x_32 : i32 = x_32_phi; + if ((x_30 < 10)) { + } else { + break; + } + var x_33 : i32; + x_33 = (x_32 + 1); + let x_39 : i32 = x_5.x_GLF_uniform_int_values[2]; + if ((x_33 == bitcast(x_39))) { + let x_43 : f32 = f32(x_28); + x_GLF_color = vec4(x_43, x_25, x_25, x_43); + break; + } + + continuing { + x_32_phi = x_33; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..9531ab8c53 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.hlsl @@ -0,0 +1,48 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[3]; +}; + +void main_1() { + int x_32_phi = 0; + const int x_24 = asint(x_5[1].x); + const float x_25 = float(x_24); + x_GLF_color = float4(x_25, x_25, x_25, x_25); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_28 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_30 = ((x_28 << asuint(x_28)) >> asuint(1)); + x_32_phi = x_24; + while (true) { + const int x_32 = x_32_phi; + if ((x_30 < 10)) { + } else { + break; + } + int x_33 = 0; + x_33 = (x_32 + 1); + const int x_39 = asint(x_5[2].x); + if ((x_33 == asint(x_39))) { + const float x_43 = float(x_28); + x_GLF_color = float4(x_43, x_25, x_25, x_43); + break; + } + { + x_32_phi = x_33; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.msl new file mode 100644 index 0000000000..6500f1c113 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int x_32_phi = 0; + int const x_24 = x_5.x_GLF_uniform_int_values.arr[1].el; + float const x_25 = float(x_24); + *(tint_symbol_4) = float4(x_25, x_25, x_25, x_25); + int const x_28 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_30 = ((x_28 << as_type(x_28)) >> as_type(1)); + x_32_phi = x_24; + while (true) { + int const x_32 = x_32_phi; + if ((x_30 < 10)) { + } else { + break; + } + int x_33 = 0; + x_33 = (x_32 + 1); + int const x_39 = x_5.x_GLF_uniform_int_values.arr[2].el; + if ((x_33 == as_type(x_39))) { + float const x_43 = float(x_28); + *(tint_symbol_4) = float4(x_43, x_25, x_25, x_43); + break; + } + { + x_32_phi = x_33; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..4dab00bf42 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_32_phi "x_32_phi" + OpName %x_33 "x_33" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %60 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_32_phi = OpVariable %_ptr_Function_int Function %21 + %x_33 = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %26 = OpLoad %int %25 + %27 = OpConvertSToF %float %26 + %28 = OpCompositeConstruct %v4float %27 %27 %27 %27 + OpStore %x_GLF_color %28 + %30 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpBitcast %uint %31 + %33 = OpShiftLeftLogical %int %31 %32 + %34 = OpBitcast %uint %int_1 + %35 = OpShiftRightArithmetic %int %33 %34 + OpStore %x_32_phi %26 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %x_32_phi + %42 = OpSLessThan %bool %35 %int_10 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %37 + %44 = OpLabel + %48 = OpIAdd %int %40 %int_1 + OpStore %x_33 %48 + %50 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %51 = OpLoad %int %50 + %52 = OpLoad %int %x_33 + %53 = OpCopyObject %int %51 + %54 = OpIEqual %bool %52 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + %57 = OpConvertSToF %float %31 + %58 = OpCompositeConstruct %v4float %57 %27 %27 %57 + OpStore %x_GLF_color %58 + OpBranch %37 + %55 = OpLabel + OpBranch %38 + %38 = OpLabel + %59 = OpLoad %int %x_33 + OpStore %x_32_phi %59 + OpBranch %36 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %60 +%tint_symbol = OpFunctionParameter %main_out + %64 = OpLabel + %65 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %65 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %67 = OpLabel + %68 = OpFunctionCall %void %main_1 + %70 = OpLoad %v4float %x_GLF_color + %71 = OpCompositeConstruct %main_out %70 + %69 = OpFunctionCall %void %tint_symbol_2 %71 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..7ccdb81f89 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-left-shift-right-shift-compare/0.wgsl.expected.wgsl @@ -0,0 +1,51 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_32_phi : i32; + let x_24 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_25 : f32 = f32(x_24); + x_GLF_color = vec4(x_25, x_25, x_25, x_25); + let x_28 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_30 : i32 = ((x_28 << bitcast(x_28)) >> bitcast(1)); + x_32_phi = x_24; + loop { + let x_32 : i32 = x_32_phi; + if ((x_30 < 10)) { + } else { + break; + } + var x_33 : i32; + x_33 = (x_32 + 1); + let x_39 : i32 = x_5.x_GLF_uniform_int_values[2]; + if ((x_33 == bitcast(x_39))) { + let x_43 : f32 = f32(x_28); + x_GLF_color = vec4(x_43, x_25, x_25, x_43); + break; + } + + continuing { + x_32_phi = x_33; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm new file mode 100644 index 0000000000..8b3747730f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm @@ -0,0 +1,154 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %v "v" + OpName %i "i" + OpName %k "k" + OpName %j "j" + OpName %data "data" + OpName %j_0 "j" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %15 = OpTypeFunction %v3float + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v2float %float_1 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_4 = OpConstant %float 4 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %33 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %uint_2 = OpConstant %uint 2 +%_arr_v3float_uint_2 = OpTypeArray %v3float %uint_2 +%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int_4 = OpConstant %int 4 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %12 + %41 = OpLabel + %j = OpVariable %_ptr_Function_int Function + %data = OpVariable %_ptr_Function__arr_v3float_uint_2 Function + %j_0 = OpVariable %_ptr_Function_int Function + OpStore %j %int_0 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %int %j + %47 = OpSLessThan %bool %46 %int_1 + OpBranchConditional %47 %48 %43 + %48 = OpLabel + %49 = OpLoad %int %j + %50 = OpFunctionCall %v3float %func_ + %51 = OpAccessChain %_ptr_Function_v3float %data %49 + OpStore %51 %50 + OpBranch %44 + %44 = OpLabel + %52 = OpLoad %int %j + %53 = OpIAdd %int %52 %int_1 + OpStore %j %53 + OpBranch %42 + %43 = OpLabel + OpStore %j_0 %int_0 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %int %j_0 + %59 = OpSLessThan %bool %58 %int_1 + OpBranchConditional %59 %60 %55 + %60 = OpLabel + %61 = OpLoad %int %j_0 + %62 = OpIMul %int %int_4 %61 + %63 = OpIAdd %int %62 %int_1 + %64 = OpFunctionCall %v3float %func_ + %65 = OpAccessChain %_ptr_Function_v3float %data %63 + OpStore %65 %64 + OpBranch %56 + %56 = OpLabel + %66 = OpLoad %int %j_0 + %67 = OpIAdd %int %66 %int_1 + OpStore %j_0 %67 + OpBranch %54 + %55 = OpLabel + %68 = OpAccessChain %_ptr_Function_v3float %data %int_0 + %69 = OpLoad %v3float %68 + %70 = OpCompositeExtract %float %69 0 + %71 = OpCompositeExtract %float %69 1 + %72 = OpCompositeExtract %float %69 2 + %73 = OpCompositeConstruct %v4float %70 %71 %72 %float_1 + OpStore %_GLF_color %73 + OpReturn + OpFunctionEnd + %func_ = OpFunction %v3float None %15 + %74 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function + %i = OpVariable %_ptr_Function_int Function + %k = OpVariable %_ptr_Function_int Function + OpStore %v %19 + OpStore %i %int_0 + OpStore %k %int_0 + OpBranch %75 + %75 = OpLabel + OpLoopMerge %76 %77 None + OpBranch %78 + %78 = OpLabel + %79 = OpLoad %int %k + %80 = OpSLessThan %bool %79 %int_2 + OpBranchConditional %80 %81 %76 + %81 = OpLabel + %82 = OpAccessChain %_ptr_Function_float %v %uint_1 + %83 = OpLoad %float %82 + %84 = OpFAdd %float %83 %float_1 + %85 = OpFOrdGreaterThan %bool %84 %float_4 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + OpBranch %76 + %86 = OpLabel + %88 = OpAccessChain %_ptr_Function_float %v %uint_1 + OpStore %88 %float_1 + %89 = OpLoad %int %i + %90 = OpIAdd %int %89 %int_1 + OpStore %i %90 + OpBranch %77 + %77 = OpLabel + %91 = OpLoad %int %k + %92 = OpIAdd %int %91 %int_1 + OpStore %k %92 + OpBranch %75 + %76 = OpLabel + %93 = OpLoad %int %i + %94 = OpSLessThan %bool %93 %int_10 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %97 + %96 = OpLabel + OpReturnValue %32 + %97 = OpLabel + OpReturnValue %33 + %95 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2cde1cb4fe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.hlsl @@ -0,0 +1,65 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 func_() { + float2 v = float2(0.0f, 0.0f); + int i = 0; + int k = 0; + v = float2(1.0f, 1.0f); + i = 0; + k = 0; + { + for(; (k < 2); k = (k + 1)) { + const float x_83 = v.y; + if (((x_83 + 1.0f) > 4.0f)) { + break; + } + v.y = 1.0f; + i = (i + 1); + } + } + if ((i < 10)) { + return float3(1.0f, 0.0f, 0.0f); + } else { + return float3(0.0f, 0.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + int j = 0; + float3 data[2] = (float3[2])0; + int j_1 = 0; + j = 0; + { + for(; (j < 1); j = (j + 1)) { + const int x_49 = j; + const float3 x_50 = func_(); + data[x_49] = x_50; + } + } + j_1 = 0; + { + for(; (j_1 < 1); j_1 = (j_1 + 1)) { + const int x_61 = j_1; + const float3 x_64 = func_(); + data[((4 * x_61) + 1)] = x_64; + } + } + const float3 x_69 = data[0]; + x_GLF_color = float4(x_69.x, x_69.y, x_69.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..0932150e20 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.msl @@ -0,0 +1,94 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + float3 arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 func_() { + float2 v = 0.0f; + int i = 0; + int k = 0; + v = float2(1.0f, 1.0f); + i = 0; + k = 0; + while (true) { + int const x_79 = k; + if ((x_79 < 2)) { + } else { + break; + } + float const x_83 = v.y; + if (((x_83 + 1.0f) > 4.0f)) { + break; + } + v.y = 1.0f; + int const x_89 = i; + i = (x_89 + 1); + { + int const x_91 = k; + k = (x_91 + 1); + } + } + int const x_93 = i; + if ((x_93 < 10)) { + return float3(1.0f, 0.0f, 0.0f); + } else { + return float3(0.0f, 0.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(thread float4* const tint_symbol_4) { + int j = 0; + tint_array_wrapper data = {}; + int j_1 = 0; + j = 0; + while (true) { + int const x_46 = j; + if ((x_46 < 1)) { + } else { + break; + } + int const x_49 = j; + float3 const x_50 = func_(); + data.arr[x_49] = x_50; + { + int const x_52 = j; + j = (x_52 + 1); + } + } + j_1 = 0; + while (true) { + int const x_58 = j_1; + if ((x_58 < 1)) { + } else { + break; + } + int const x_61 = j_1; + float3 const x_64 = func_(); + data.arr[((4 * x_61) + 1)] = x_64; + { + int const x_66 = j_1; + j_1 = (x_66 + 1); + } + } + float3 const x_69 = data.arr[0]; + *(tint_symbol_4) = float4(x_69.x, x_69.y, x_69.z, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..74c4d05419 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.spvasm @@ -0,0 +1,204 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 122 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %v "v" + OpName %i "i" + OpName %k "k" + OpName %main_1 "main_1" + OpName %j "j" + OpName %data "data" + OpName %j_1 "j_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_v3float_uint_2 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %8 = OpTypeFunction %v3float + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v2float %float_1 %float_1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_4 = OpConstant %float 4 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %float_0 = OpConstant %float 0 + %58 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %59 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %60 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %61 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 +%_arr_v3float_uint_2 = OpTypeArray %v3float %uint_2 +%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2 + %70 = OpConstantNull %_arr_v3float_uint_2 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %110 = OpTypeFunction %void %main_out + %func_ = OpFunction %v3float None %8 + %11 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %15 + %i = OpVariable %_ptr_Function_int Function %19 + %k = OpVariable %_ptr_Function_int Function %19 + OpStore %v %22 + OpStore %i %int_0 + OpStore %k %int_0 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %k + %30 = OpSLessThan %bool %28 %int_2 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %25 + %32 = OpLabel + %38 = OpAccessChain %_ptr_Function_float %v %uint_1 + %39 = OpLoad %float %38 + %40 = OpFAdd %float %39 %float_1 + %42 = OpFOrdGreaterThan %bool %40 %float_4 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpBranch %25 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Function_float %v %uint_1 + OpStore %45 %float_1 + %46 = OpLoad %int %i + %48 = OpIAdd %int %46 %int_1 + OpStore %i %48 + OpBranch %26 + %26 = OpLabel + %49 = OpLoad %int %k + %50 = OpIAdd %int %49 %int_1 + OpStore %k %50 + OpBranch %24 + %25 = OpLabel + %51 = OpLoad %int %i + %53 = OpSLessThan %bool %51 %int_10 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + OpReturnValue %58 + %56 = OpLabel + OpReturnValue %59 + %54 = OpLabel + OpReturnValue %60 + OpFunctionEnd + %main_1 = OpFunction %void None %61 + %64 = OpLabel + %j = OpVariable %_ptr_Function_int Function %19 + %data = OpVariable %_ptr_Function__arr_v3float_uint_2 Function %70 + %j_1 = OpVariable %_ptr_Function_int Function %19 + OpStore %j %int_0 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %int %j + %77 = OpSLessThan %bool %76 %int_1 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + OpBranch %78 + %80 = OpLabel + OpBranch %73 + %78 = OpLabel + %81 = OpLoad %int %j + %82 = OpFunctionCall %v3float %func_ + %84 = OpAccessChain %_ptr_Function_v3float %data %81 + OpStore %84 %82 + OpBranch %74 + %74 = OpLabel + %85 = OpLoad %int %j + %86 = OpIAdd %int %85 %int_1 + OpStore %j %86 + OpBranch %72 + %73 = OpLabel + OpStore %j_1 %int_0 + OpBranch %87 + %87 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %int %j_1 + %92 = OpSLessThan %bool %91 %int_1 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + OpBranch %93 + %95 = OpLabel + OpBranch %88 + %93 = OpLabel + %96 = OpLoad %int %j_1 + %97 = OpFunctionCall %v3float %func_ + %99 = OpIMul %int %int_4 %96 + %100 = OpIAdd %int %99 %int_1 + %101 = OpAccessChain %_ptr_Function_v3float %data %100 + OpStore %101 %97 + OpBranch %89 + %89 = OpLabel + %102 = OpLoad %int %j_1 + %103 = OpIAdd %int %102 %int_1 + OpStore %j_1 %103 + OpBranch %87 + %88 = OpLabel + %104 = OpAccessChain %_ptr_Function_v3float %data %int_0 + %105 = OpLoad %v3float %104 + %106 = OpCompositeExtract %float %105 0 + %107 = OpCompositeExtract %float %105 1 + %108 = OpCompositeExtract %float %105 2 + %109 = OpCompositeConstruct %v4float %106 %107 %108 %float_1 + OpStore %x_GLF_color %109 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %110 +%tint_symbol = OpFunctionParameter %main_out + %114 = OpLabel + %115 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %115 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %61 + %117 = OpLabel + %118 = OpFunctionCall %void %main_1 + %120 = OpLoad %v4float %x_GLF_color + %121 = OpCompositeConstruct %main_out %120 + %119 = OpFunctionCall %void %tint_symbol_2 %121 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..0a12739518 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.spvasm.expected.wgsl @@ -0,0 +1,88 @@ +var x_GLF_color : vec4; + +fn func_() -> vec3 { + var v : vec2; + var i : i32; + var k : i32; + v = vec2(1.0, 1.0); + i = 0; + k = 0; + loop { + let x_79 : i32 = k; + if ((x_79 < 2)) { + } else { + break; + } + let x_83 : f32 = v.y; + if (((x_83 + 1.0) > 4.0)) { + break; + } + v.y = 1.0; + let x_89 : i32 = i; + i = (x_89 + 1); + + continuing { + let x_91 : i32 = k; + k = (x_91 + 1); + } + } + let x_93 : i32 = i; + if ((x_93 < 10)) { + return vec3(1.0, 0.0, 0.0); + } else { + return vec3(0.0, 0.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + var j : i32; + var data : array, 2>; + var j_1 : i32; + j = 0; + loop { + let x_46 : i32 = j; + if ((x_46 < 1)) { + } else { + break; + } + let x_49 : i32 = j; + let x_50 : vec3 = func_(); + data[x_49] = x_50; + + continuing { + let x_52 : i32 = j; + j = (x_52 + 1); + } + } + j_1 = 0; + loop { + let x_58 : i32 = j_1; + if ((x_58 < 1)) { + } else { + break; + } + let x_61 : i32 = j_1; + let x_64 : vec3 = func_(); + data[((4 * x_61) + 1)] = x_64; + + continuing { + let x_66 : i32 = j_1; + j_1 = (x_66 + 1); + } + } + let x_69 : vec3 = data[0]; + x_GLF_color = vec4(x_69.x, x_69.y, x_69.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl new file mode 100644 index 0000000000..0a12739518 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl @@ -0,0 +1,88 @@ +var x_GLF_color : vec4; + +fn func_() -> vec3 { + var v : vec2; + var i : i32; + var k : i32; + v = vec2(1.0, 1.0); + i = 0; + k = 0; + loop { + let x_79 : i32 = k; + if ((x_79 < 2)) { + } else { + break; + } + let x_83 : f32 = v.y; + if (((x_83 + 1.0) > 4.0)) { + break; + } + v.y = 1.0; + let x_89 : i32 = i; + i = (x_89 + 1); + + continuing { + let x_91 : i32 = k; + k = (x_91 + 1); + } + } + let x_93 : i32 = i; + if ((x_93 < 10)) { + return vec3(1.0, 0.0, 0.0); + } else { + return vec3(0.0, 0.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + var j : i32; + var data : array, 2>; + var j_1 : i32; + j = 0; + loop { + let x_46 : i32 = j; + if ((x_46 < 1)) { + } else { + break; + } + let x_49 : i32 = j; + let x_50 : vec3 = func_(); + data[x_49] = x_50; + + continuing { + let x_52 : i32 = j; + j = (x_52 + 1); + } + } + j_1 = 0; + loop { + let x_58 : i32 = j_1; + if ((x_58 < 1)) { + } else { + break; + } + let x_61 : i32 = j_1; + let x_64 : vec3 = func_(); + data[((4 * x_61) + 1)] = x_64; + + continuing { + let x_66 : i32 = j_1; + j_1 = (x_66 + 1); + } + } + let x_69 : vec3 = data[0]; + x_GLF_color = vec4(x_69.x, x_69.y, x_69.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2cde1cb4fe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.hlsl @@ -0,0 +1,65 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 func_() { + float2 v = float2(0.0f, 0.0f); + int i = 0; + int k = 0; + v = float2(1.0f, 1.0f); + i = 0; + k = 0; + { + for(; (k < 2); k = (k + 1)) { + const float x_83 = v.y; + if (((x_83 + 1.0f) > 4.0f)) { + break; + } + v.y = 1.0f; + i = (i + 1); + } + } + if ((i < 10)) { + return float3(1.0f, 0.0f, 0.0f); + } else { + return float3(0.0f, 0.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + int j = 0; + float3 data[2] = (float3[2])0; + int j_1 = 0; + j = 0; + { + for(; (j < 1); j = (j + 1)) { + const int x_49 = j; + const float3 x_50 = func_(); + data[x_49] = x_50; + } + } + j_1 = 0; + { + for(; (j_1 < 1); j_1 = (j_1 + 1)) { + const int x_61 = j_1; + const float3 x_64 = func_(); + data[((4 * x_61) + 1)] = x_64; + } + } + const float3 x_69 = data[0]; + x_GLF_color = float4(x_69.x, x_69.y, x_69.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..0932150e20 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.msl @@ -0,0 +1,94 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + float3 arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 func_() { + float2 v = 0.0f; + int i = 0; + int k = 0; + v = float2(1.0f, 1.0f); + i = 0; + k = 0; + while (true) { + int const x_79 = k; + if ((x_79 < 2)) { + } else { + break; + } + float const x_83 = v.y; + if (((x_83 + 1.0f) > 4.0f)) { + break; + } + v.y = 1.0f; + int const x_89 = i; + i = (x_89 + 1); + { + int const x_91 = k; + k = (x_91 + 1); + } + } + int const x_93 = i; + if ((x_93 < 10)) { + return float3(1.0f, 0.0f, 0.0f); + } else { + return float3(0.0f, 0.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(thread float4* const tint_symbol_4) { + int j = 0; + tint_array_wrapper data = {}; + int j_1 = 0; + j = 0; + while (true) { + int const x_46 = j; + if ((x_46 < 1)) { + } else { + break; + } + int const x_49 = j; + float3 const x_50 = func_(); + data.arr[x_49] = x_50; + { + int const x_52 = j; + j = (x_52 + 1); + } + } + j_1 = 0; + while (true) { + int const x_58 = j_1; + if ((x_58 < 1)) { + } else { + break; + } + int const x_61 = j_1; + float3 const x_64 = func_(); + data.arr[((4 * x_61) + 1)] = x_64; + { + int const x_66 = j_1; + j_1 = (x_66 + 1); + } + } + float3 const x_69 = data.arr[0]; + *(tint_symbol_4) = float4(x_69.x, x_69.y, x_69.z, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..74c4d05419 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.spvasm @@ -0,0 +1,204 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 122 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %v "v" + OpName %i "i" + OpName %k "k" + OpName %main_1 "main_1" + OpName %j "j" + OpName %data "data" + OpName %j_1 "j_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_v3float_uint_2 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %8 = OpTypeFunction %v3float + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v2float %float_1 %float_1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_4 = OpConstant %float 4 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %float_0 = OpConstant %float 0 + %58 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %59 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %60 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %61 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 +%_arr_v3float_uint_2 = OpTypeArray %v3float %uint_2 +%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2 + %70 = OpConstantNull %_arr_v3float_uint_2 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %110 = OpTypeFunction %void %main_out + %func_ = OpFunction %v3float None %8 + %11 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %15 + %i = OpVariable %_ptr_Function_int Function %19 + %k = OpVariable %_ptr_Function_int Function %19 + OpStore %v %22 + OpStore %i %int_0 + OpStore %k %int_0 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %k + %30 = OpSLessThan %bool %28 %int_2 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %25 + %32 = OpLabel + %38 = OpAccessChain %_ptr_Function_float %v %uint_1 + %39 = OpLoad %float %38 + %40 = OpFAdd %float %39 %float_1 + %42 = OpFOrdGreaterThan %bool %40 %float_4 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpBranch %25 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Function_float %v %uint_1 + OpStore %45 %float_1 + %46 = OpLoad %int %i + %48 = OpIAdd %int %46 %int_1 + OpStore %i %48 + OpBranch %26 + %26 = OpLabel + %49 = OpLoad %int %k + %50 = OpIAdd %int %49 %int_1 + OpStore %k %50 + OpBranch %24 + %25 = OpLabel + %51 = OpLoad %int %i + %53 = OpSLessThan %bool %51 %int_10 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + OpReturnValue %58 + %56 = OpLabel + OpReturnValue %59 + %54 = OpLabel + OpReturnValue %60 + OpFunctionEnd + %main_1 = OpFunction %void None %61 + %64 = OpLabel + %j = OpVariable %_ptr_Function_int Function %19 + %data = OpVariable %_ptr_Function__arr_v3float_uint_2 Function %70 + %j_1 = OpVariable %_ptr_Function_int Function %19 + OpStore %j %int_0 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %int %j + %77 = OpSLessThan %bool %76 %int_1 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + OpBranch %78 + %80 = OpLabel + OpBranch %73 + %78 = OpLabel + %81 = OpLoad %int %j + %82 = OpFunctionCall %v3float %func_ + %84 = OpAccessChain %_ptr_Function_v3float %data %81 + OpStore %84 %82 + OpBranch %74 + %74 = OpLabel + %85 = OpLoad %int %j + %86 = OpIAdd %int %85 %int_1 + OpStore %j %86 + OpBranch %72 + %73 = OpLabel + OpStore %j_1 %int_0 + OpBranch %87 + %87 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %int %j_1 + %92 = OpSLessThan %bool %91 %int_1 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + OpBranch %93 + %95 = OpLabel + OpBranch %88 + %93 = OpLabel + %96 = OpLoad %int %j_1 + %97 = OpFunctionCall %v3float %func_ + %99 = OpIMul %int %int_4 %96 + %100 = OpIAdd %int %99 %int_1 + %101 = OpAccessChain %_ptr_Function_v3float %data %100 + OpStore %101 %97 + OpBranch %89 + %89 = OpLabel + %102 = OpLoad %int %j_1 + %103 = OpIAdd %int %102 %int_1 + OpStore %j_1 %103 + OpBranch %87 + %88 = OpLabel + %104 = OpAccessChain %_ptr_Function_v3float %data %int_0 + %105 = OpLoad %v3float %104 + %106 = OpCompositeExtract %float %105 0 + %107 = OpCompositeExtract %float %105 1 + %108 = OpCompositeExtract %float %105 2 + %109 = OpCompositeConstruct %v4float %106 %107 %108 %float_1 + OpStore %x_GLF_color %109 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %110 +%tint_symbol = OpFunctionParameter %main_out + %114 = OpLabel + %115 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %115 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %61 + %117 = OpLabel + %118 = OpFunctionCall %void %main_1 + %120 = OpLoad %v4float %x_GLF_color + %121 = OpCompositeConstruct %main_out %120 + %119 = OpFunctionCall %void %tint_symbol_2 %121 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..0a12739518 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-liveinterval-different-dest/0-opt.wgsl.expected.wgsl @@ -0,0 +1,88 @@ +var x_GLF_color : vec4; + +fn func_() -> vec3 { + var v : vec2; + var i : i32; + var k : i32; + v = vec2(1.0, 1.0); + i = 0; + k = 0; + loop { + let x_79 : i32 = k; + if ((x_79 < 2)) { + } else { + break; + } + let x_83 : f32 = v.y; + if (((x_83 + 1.0) > 4.0)) { + break; + } + v.y = 1.0; + let x_89 : i32 = i; + i = (x_89 + 1); + + continuing { + let x_91 : i32 = k; + k = (x_91 + 1); + } + } + let x_93 : i32 = i; + if ((x_93 < 10)) { + return vec3(1.0, 0.0, 0.0); + } else { + return vec3(0.0, 0.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + var j : i32; + var data : array, 2>; + var j_1 : i32; + j = 0; + loop { + let x_46 : i32 = j; + if ((x_46 < 1)) { + } else { + break; + } + let x_49 : i32 = j; + let x_50 : vec3 = func_(); + data[x_49] = x_50; + + continuing { + let x_52 : i32 = j; + j = (x_52 + 1); + } + } + j_1 = 0; + loop { + let x_58 : i32 = j_1; + if ((x_58 < 1)) { + } else { + break; + } + let x_61 : i32 = j_1; + let x_64 : vec3 = func_(); + data[((4 * x_61) + 1)] = x_64; + + continuing { + let x_66 : i32 = j_1; + j_1 = (x_66 + 1); + } + } + let x_69 : vec3 = data[0]; + x_GLF_color = vec4(x_69.x, x_69.y, x_69.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm new file mode 100644 index 0000000000..9b85a89037 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm @@ -0,0 +1,134 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %13 + %32 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %33 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %34 = OpLoad %float %33 + OpStore %f %34 + %35 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %36 = OpLoad %int %35 + OpStore %i %36 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpSLessThan %bool %41 %43 + OpBranchConditional %44 %45 %38 + %45 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %47 = OpLoad %float %46 + %48 = OpFNegate %float %47 + %49 = OpLoad %float %f + %50 = OpFMul %float %48 %49 + %51 = OpExtInst %float %1 FAbs %50 + %52 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %53 = OpLoad %float %52 + %54 = OpFAdd %float %51 %53 + OpStore %f %54 + OpBranch %39 + %39 = OpLabel + %55 = OpLoad %int %i + %56 = OpIAdd %int %55 %int_1 + OpStore %i %56 + OpBranch %37 + %38 = OpLabel + %57 = OpLoad %float %f + %58 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %59 = OpLoad %float %58 + %60 = OpFOrdGreaterThan %bool %57 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + %63 = OpLoad %float %f + %64 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %65 = OpLoad %float %64 + %66 = OpFOrdLessThan %bool %63 %65 + OpBranch %61 + %61 = OpLabel + %67 = OpPhi %bool %60 %38 %66 %62 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %72 + %74 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpConvertSToF %float %78 + %80 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %81 + %83 = OpCompositeConstruct %v4float %73 %76 %79 %82 + OpStore %_GLF_color %83 + OpBranch %68 + %70 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %85 + %87 = OpCompositeConstruct %v4float %86 %86 %86 %86 + OpStore %_GLF_color %87 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..98286fb198 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.hlsl @@ -0,0 +1,72 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int i = 0; + bool x_66 = false; + bool x_67_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_34 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + f = x_34; + const int x_36 = asint(x_9[1].x); + i = x_36; + while (true) { + const int x_41 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_43 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_41 < x_43)) { + } else { + break; + } + const float x_47 = asfloat(x_6[3].x); + const float x_49 = f; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_53 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + f = (abs((-(x_47) * x_49)) + x_53); + { + i = (i + 1); + } + } + const float x_57 = f; + const float x_59 = asfloat(x_6[1].x); + const bool x_60 = (x_57 > x_59); + x_67_phi = x_60; + if (x_60) { + const float x_63 = f; + const float x_65 = asfloat(x_6[2].x); + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + if (x_67_phi) { + const int x_72 = asint(x_9[2].x); + const int x_75 = asint(x_9[1].x); + const int x_78 = asint(x_9[1].x); + const int x_81 = asint(x_9[2].x); + x_GLF_color = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + } else { + const int x_85 = asint(x_9[1].x); + const float x_86 = float(x_85); + x_GLF_color = float4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d81e3ea915 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.msl @@ -0,0 +1,88 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + float f = 0.0f; + int i = 0; + bool x_66 = false; + bool x_67_phi = false; + float const x_34 = x_6.x_GLF_uniform_float_values.arr[0].el; + f = x_34; + int const x_36 = x_9.x_GLF_uniform_int_values.arr[1].el; + i = x_36; + while (true) { + int const x_41 = i; + int const x_43 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_41 < x_43)) { + } else { + break; + } + float const x_47 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_49 = f; + float const x_53 = x_6.x_GLF_uniform_float_values.arr[0].el; + f = (fabs((-(x_47) * x_49)) + x_53); + { + int const x_55 = i; + i = (x_55 + 1); + } + } + float const x_57 = f; + float const x_59 = x_6.x_GLF_uniform_float_values.arr[1].el; + bool const x_60 = (x_57 > x_59); + x_67_phi = x_60; + if (x_60) { + float const x_63 = f; + float const x_65 = x_6.x_GLF_uniform_float_values.arr[2].el; + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + bool const x_67 = x_67_phi; + if (x_67) { + int const x_72 = x_9.x_GLF_uniform_int_values.arr[2].el; + int const x_75 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_81 = x_9.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + } else { + int const x_85 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_86 = float(x_85); + *(tint_symbol_4) = float4(x_86, x_86, x_86, x_86); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e9a94b6b2b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.spvasm @@ -0,0 +1,185 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 113 +; Schema: 0 + OpCapability Shader + %62 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %i "i" + OpName %x_66 "x_66" + OpName %x_67_phi "x_67_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %33 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %101 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %f = OpVariable %_ptr_Function_float Function %26 + %i = OpVariable %_ptr_Function_int Function %29 + %x_66 = OpVariable %_ptr_Function_bool Function %33 + %x_67_phi = OpVariable %_ptr_Function_bool Function %33 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %39 = OpLoad %float %38 + OpStore %f %39 + %42 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %43 = OpLoad %int %42 + OpStore %i %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %49 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpSLessThan %bool %48 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %45 + %52 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %57 = OpLoad %float %56 + %58 = OpLoad %float %f + %59 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %60 = OpLoad %float %59 + %63 = OpFNegate %float %57 + %64 = OpFMul %float %63 %58 + %61 = OpExtInst %float %62 FAbs %64 + %65 = OpFAdd %float %61 %60 + OpStore %f %65 + OpBranch %46 + %46 = OpLabel + %66 = OpLoad %int %i + %67 = OpIAdd %int %66 %int_1 + OpStore %i %67 + OpBranch %44 + %45 = OpLabel + %68 = OpLoad %float %f + %69 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %70 = OpLoad %float %69 + %71 = OpFOrdGreaterThan %bool %68 %70 + OpStore %x_67_phi %71 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + %74 = OpLoad %float %f + %76 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %77 = OpLoad %float %76 + %78 = OpFOrdLessThan %bool %74 %77 + OpStore %x_66 %78 + %79 = OpLoad %bool %x_66 + OpStore %x_67_phi %79 + OpBranch %72 + %72 = OpLabel + %80 = OpLoad %bool %x_67_phi + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %85 + %93 = OpConvertSToF %float %87 + %94 = OpConvertSToF %float %89 + %95 = OpConvertSToF %float %91 + %96 = OpCompositeConstruct %v4float %92 %93 %94 %95 + OpStore %x_GLF_color %96 + OpBranch %81 + %83 = OpLabel + %97 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %98 = OpLoad %int %97 + %99 = OpConvertSToF %float %98 + %100 = OpCompositeConstruct %v4float %99 %99 %99 %99 + OpStore %x_GLF_color %100 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %101 +%tint_symbol = OpFunctionParameter %main_out + %105 = OpLabel + %106 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %106 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %108 = OpLabel + %109 = OpFunctionCall %void %main_1 + %111 = OpLoad %v4float %x_GLF_color + %112 = OpCompositeConstruct %main_out %111 + %110 = OpFunctionCall %void %tint_symbol_2 %112 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..098a4c9fa1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.spvasm.expected.wgsl @@ -0,0 +1,81 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var i : i32; + var x_66 : bool; + var x_67_phi : bool; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[0]; + f = x_34; + let x_36 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_36; + loop { + let x_41 : i32 = i; + let x_43 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_41 < x_43)) { + } else { + break; + } + let x_47 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_49 : f32 = f; + let x_53 : f32 = x_6.x_GLF_uniform_float_values[0]; + f = (abs((-(x_47) * x_49)) + x_53); + + continuing { + let x_55 : i32 = i; + i = (x_55 + 1); + } + } + let x_57 : f32 = f; + let x_59 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_60 : bool = (x_57 > x_59); + x_67_phi = x_60; + if (x_60) { + let x_63 : f32 = f; + let x_65 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + let x_67 : bool = x_67_phi; + if (x_67) { + let x_72 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_75 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_9.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_72), f32(x_75), f32(x_78), f32(x_81)); + } else { + let x_85 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_86 : f32 = f32(x_85); + x_GLF_color = vec4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl new file mode 100644 index 0000000000..098a4c9fa1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl @@ -0,0 +1,81 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var i : i32; + var x_66 : bool; + var x_67_phi : bool; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[0]; + f = x_34; + let x_36 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_36; + loop { + let x_41 : i32 = i; + let x_43 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_41 < x_43)) { + } else { + break; + } + let x_47 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_49 : f32 = f; + let x_53 : f32 = x_6.x_GLF_uniform_float_values[0]; + f = (abs((-(x_47) * x_49)) + x_53); + + continuing { + let x_55 : i32 = i; + i = (x_55 + 1); + } + } + let x_57 : f32 = f; + let x_59 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_60 : bool = (x_57 > x_59); + x_67_phi = x_60; + if (x_60) { + let x_63 : f32 = f; + let x_65 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + let x_67 : bool = x_67_phi; + if (x_67) { + let x_72 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_75 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_9.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_72), f32(x_75), f32(x_78), f32(x_81)); + } else { + let x_85 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_86 : f32 = f32(x_85); + x_GLF_color = vec4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..98286fb198 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.hlsl @@ -0,0 +1,72 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int i = 0; + bool x_66 = false; + bool x_67_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_34 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + f = x_34; + const int x_36 = asint(x_9[1].x); + i = x_36; + while (true) { + const int x_41 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_43 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_41 < x_43)) { + } else { + break; + } + const float x_47 = asfloat(x_6[3].x); + const float x_49 = f; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_53 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + f = (abs((-(x_47) * x_49)) + x_53); + { + i = (i + 1); + } + } + const float x_57 = f; + const float x_59 = asfloat(x_6[1].x); + const bool x_60 = (x_57 > x_59); + x_67_phi = x_60; + if (x_60) { + const float x_63 = f; + const float x_65 = asfloat(x_6[2].x); + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + if (x_67_phi) { + const int x_72 = asint(x_9[2].x); + const int x_75 = asint(x_9[1].x); + const int x_78 = asint(x_9[1].x); + const int x_81 = asint(x_9[2].x); + x_GLF_color = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + } else { + const int x_85 = asint(x_9[1].x); + const float x_86 = float(x_85); + x_GLF_color = float4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d81e3ea915 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.msl @@ -0,0 +1,88 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + float f = 0.0f; + int i = 0; + bool x_66 = false; + bool x_67_phi = false; + float const x_34 = x_6.x_GLF_uniform_float_values.arr[0].el; + f = x_34; + int const x_36 = x_9.x_GLF_uniform_int_values.arr[1].el; + i = x_36; + while (true) { + int const x_41 = i; + int const x_43 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_41 < x_43)) { + } else { + break; + } + float const x_47 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_49 = f; + float const x_53 = x_6.x_GLF_uniform_float_values.arr[0].el; + f = (fabs((-(x_47) * x_49)) + x_53); + { + int const x_55 = i; + i = (x_55 + 1); + } + } + float const x_57 = f; + float const x_59 = x_6.x_GLF_uniform_float_values.arr[1].el; + bool const x_60 = (x_57 > x_59); + x_67_phi = x_60; + if (x_60) { + float const x_63 = f; + float const x_65 = x_6.x_GLF_uniform_float_values.arr[2].el; + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + bool const x_67 = x_67_phi; + if (x_67) { + int const x_72 = x_9.x_GLF_uniform_int_values.arr[2].el; + int const x_75 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_81 = x_9.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + } else { + int const x_85 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_86 = float(x_85); + *(tint_symbol_4) = float4(x_86, x_86, x_86, x_86); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e9a94b6b2b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.spvasm @@ -0,0 +1,185 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 113 +; Schema: 0 + OpCapability Shader + %62 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %i "i" + OpName %x_66 "x_66" + OpName %x_67_phi "x_67_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %33 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %101 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %f = OpVariable %_ptr_Function_float Function %26 + %i = OpVariable %_ptr_Function_int Function %29 + %x_66 = OpVariable %_ptr_Function_bool Function %33 + %x_67_phi = OpVariable %_ptr_Function_bool Function %33 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %39 = OpLoad %float %38 + OpStore %f %39 + %42 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %43 = OpLoad %int %42 + OpStore %i %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %49 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpSLessThan %bool %48 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %45 + %52 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %57 = OpLoad %float %56 + %58 = OpLoad %float %f + %59 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %60 = OpLoad %float %59 + %63 = OpFNegate %float %57 + %64 = OpFMul %float %63 %58 + %61 = OpExtInst %float %62 FAbs %64 + %65 = OpFAdd %float %61 %60 + OpStore %f %65 + OpBranch %46 + %46 = OpLabel + %66 = OpLoad %int %i + %67 = OpIAdd %int %66 %int_1 + OpStore %i %67 + OpBranch %44 + %45 = OpLabel + %68 = OpLoad %float %f + %69 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %70 = OpLoad %float %69 + %71 = OpFOrdGreaterThan %bool %68 %70 + OpStore %x_67_phi %71 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + %74 = OpLoad %float %f + %76 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %77 = OpLoad %float %76 + %78 = OpFOrdLessThan %bool %74 %77 + OpStore %x_66 %78 + %79 = OpLoad %bool %x_66 + OpStore %x_67_phi %79 + OpBranch %72 + %72 = OpLabel + %80 = OpLoad %bool %x_67_phi + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %85 + %93 = OpConvertSToF %float %87 + %94 = OpConvertSToF %float %89 + %95 = OpConvertSToF %float %91 + %96 = OpCompositeConstruct %v4float %92 %93 %94 %95 + OpStore %x_GLF_color %96 + OpBranch %81 + %83 = OpLabel + %97 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %98 = OpLoad %int %97 + %99 = OpConvertSToF %float %98 + %100 = OpCompositeConstruct %v4float %99 %99 %99 %99 + OpStore %x_GLF_color %100 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %101 +%tint_symbol = OpFunctionParameter %main_out + %105 = OpLabel + %106 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %106 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %108 = OpLabel + %109 = OpFunctionCall %void %main_1 + %111 = OpLoad %v4float %x_GLF_color + %112 = OpCompositeConstruct %main_out %111 + %110 = OpFunctionCall %void %tint_symbol_2 %112 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..098a4c9fa1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-abs-multiply-offset/0-opt.wgsl.expected.wgsl @@ -0,0 +1,81 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var i : i32; + var x_66 : bool; + var x_67_phi : bool; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[0]; + f = x_34; + let x_36 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_36; + loop { + let x_41 : i32 = i; + let x_43 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_41 < x_43)) { + } else { + break; + } + let x_47 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_49 : f32 = f; + let x_53 : f32 = x_6.x_GLF_uniform_float_values[0]; + f = (abs((-(x_47) * x_49)) + x_53); + + continuing { + let x_55 : i32 = i; + i = (x_55 + 1); + } + } + let x_57 : f32 = f; + let x_59 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_60 : bool = (x_57 > x_59); + x_67_phi = x_60; + if (x_60) { + let x_63 : f32 = f; + let x_65 : f32 = x_6.x_GLF_uniform_float_values[2]; + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + let x_67 : bool = x_67_phi; + if (x_67) { + let x_72 : i32 = x_9.x_GLF_uniform_int_values[2]; + let x_75 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_9.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_72), f32(x_75), f32(x_78), f32(x_81)); + } else { + let x_85 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_86 : f32 = f32(x_85); + x_GLF_color = vec4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm new file mode 100644 index 0000000000..152dc38782 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm @@ -0,0 +1,95 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_5 = OpConstant %int 5 + %bool = OpTypeBool + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%int_n4194304 = OpConstant %int -4194304 + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %int_n1 = OpConstant %int -1 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %26 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %27 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %int %i + %33 = OpSLessThan %bool %32 %int_5 + OpBranchConditional %33 %34 %29 + %34 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %36 = OpLoad %int %35 + %37 = OpIEqual %bool %36 %int_0 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %38 + %39 = OpLabel + %40 = OpBitcast %float %int_n4194304 + %41 = OpExtInst %float %1 Floor %40 + %42 = OpFOrdGreaterThan %bool %41 %float_0 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpStore %a %int_n1 + OpBranch %29 + %43 = OpLabel + OpBranch %38 + %38 = OpLabel + %45 = OpLoad %int %a + %46 = OpIAdd %int %45 %int_1 + OpStore %a %46 + OpBranch %30 + %30 = OpLabel + %47 = OpLoad %int %i + %48 = OpIAdd %int %47 %int_1 + OpStore %i %48 + OpBranch %28 + %29 = OpLabel + %49 = OpLoad %int %a + %50 = OpIEqual %bool %49 %int_5 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpStore %_GLF_color %25 + OpBranch %51 + %53 = OpLabel + OpStore %_GLF_color %26 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..fc76837e8f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.hlsl @@ -0,0 +1,43 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + a = 0; + i = 0; + { + for(; (i < 5); i = (i + 1)) { + const int x_36 = asint(x_7[0].x); + if ((x_36 == 0)) { + if ((floor(asfloat(-4194304)) > 0.0f)) { + a = -1; + break; + } + } + a = (a + 1); + } + } + if ((a == 5)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a1922a94d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + a = 0; + i = 0; + while (true) { + int const x_32 = i; + if ((x_32 < 5)) { + } else { + break; + } + int const x_36 = x_7.one; + if ((x_36 == 0)) { + if ((floor(as_type(-4194304)) > 0.0f)) { + a = -1; + break; + } + } + int const x_45 = a; + a = (x_45 + 1); + { + int const x_47 = i; + i = (x_47 + 1); + } + } + int const x_49 = a; + if ((x_49 == 5)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e5c6e56f1a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.spvasm @@ -0,0 +1,135 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 74 +; Schema: 0 + OpCapability Shader + %41 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_5 = OpConstant %int 5 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%int_n4194304 = OpConstant %int -4194304 + %float_0 = OpConstant %float 0 + %int_n1 = OpConstant %int -1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %60 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %61 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %62 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %18 + %i = OpVariable %_ptr_Function_int Function %18 + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %int %i + %27 = OpSLessThan %bool %25 %int_5 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpBranch %29 + %31 = OpLabel + OpBranch %22 + %29 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %36 = OpLoad %int %35 + %37 = OpIEqual %bool %36 %int_0 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %38 + %39 = OpLabel + %42 = OpBitcast %float %int_n4194304 + %40 = OpExtInst %float %41 Floor %42 + %45 = OpFOrdGreaterThan %bool %40 %float_0 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + OpStore %a %int_n1 + OpBranch %22 + %46 = OpLabel + OpBranch %38 + %38 = OpLabel + %49 = OpLoad %int %a + %51 = OpIAdd %int %49 %int_1 + OpStore %a %51 + OpBranch %23 + %23 = OpLabel + %52 = OpLoad %int %i + %53 = OpIAdd %int %52 %int_1 + OpStore %i %53 + OpBranch %21 + %22 = OpLabel + %54 = OpLoad %int %a + %55 = OpIEqual %bool %54 %int_5 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpStore %x_GLF_color %60 + OpBranch %56 + %58 = OpLabel + OpStore %x_GLF_color %61 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %62 +%tint_symbol = OpFunctionParameter %main_out + %66 = OpLabel + %67 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %67 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %69 = OpLabel + %70 = OpFunctionCall %void %main_1 + %72 = OpLoad %v4float %x_GLF_color + %73 = OpCompositeConstruct %main_out %72 + %71 = OpFunctionCall %void %tint_symbol_2 %73 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..8de51a942e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.spvasm.expected.wgsl @@ -0,0 +1,54 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + a = 0; + i = 0; + loop { + let x_32 : i32 = i; + if ((x_32 < 5)) { + } else { + break; + } + let x_36 : i32 = x_7.one; + if ((x_36 == 0)) { + if ((floor(bitcast(-4194304)) > 0.0)) { + a = -1; + break; + } + } + let x_45 : i32 = a; + a = (x_45 + 1); + + continuing { + let x_47 : i32 = i; + i = (x_47 + 1); + } + } + let x_49 : i32 = a; + if ((x_49 == 5)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl new file mode 100644 index 0000000000..8de51a942e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl @@ -0,0 +1,54 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + a = 0; + i = 0; + loop { + let x_32 : i32 = i; + if ((x_32 < 5)) { + } else { + break; + } + let x_36 : i32 = x_7.one; + if ((x_36 == 0)) { + if ((floor(bitcast(-4194304)) > 0.0)) { + a = -1; + break; + } + } + let x_45 : i32 = a; + a = (x_45 + 1); + + continuing { + let x_47 : i32 = i; + i = (x_47 + 1); + } + } + let x_49 : i32 = a; + if ((x_49 == 5)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..fc76837e8f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.hlsl @@ -0,0 +1,43 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + a = 0; + i = 0; + { + for(; (i < 5); i = (i + 1)) { + const int x_36 = asint(x_7[0].x); + if ((x_36 == 0)) { + if ((floor(asfloat(-4194304)) > 0.0f)) { + a = -1; + break; + } + } + a = (a + 1); + } + } + if ((a == 5)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a1922a94d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + a = 0; + i = 0; + while (true) { + int const x_32 = i; + if ((x_32 < 5)) { + } else { + break; + } + int const x_36 = x_7.one; + if ((x_36 == 0)) { + if ((floor(as_type(-4194304)) > 0.0f)) { + a = -1; + break; + } + } + int const x_45 = a; + a = (x_45 + 1); + { + int const x_47 = i; + i = (x_47 + 1); + } + } + int const x_49 = a; + if ((x_49 == 5)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5c6e56f1a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.spvasm @@ -0,0 +1,135 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 74 +; Schema: 0 + OpCapability Shader + %41 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_5 = OpConstant %int 5 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%int_n4194304 = OpConstant %int -4194304 + %float_0 = OpConstant %float 0 + %int_n1 = OpConstant %int -1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %60 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %61 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %62 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %18 + %i = OpVariable %_ptr_Function_int Function %18 + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %int %i + %27 = OpSLessThan %bool %25 %int_5 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpBranch %29 + %31 = OpLabel + OpBranch %22 + %29 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %36 = OpLoad %int %35 + %37 = OpIEqual %bool %36 %int_0 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %38 + %39 = OpLabel + %42 = OpBitcast %float %int_n4194304 + %40 = OpExtInst %float %41 Floor %42 + %45 = OpFOrdGreaterThan %bool %40 %float_0 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + OpStore %a %int_n1 + OpBranch %22 + %46 = OpLabel + OpBranch %38 + %38 = OpLabel + %49 = OpLoad %int %a + %51 = OpIAdd %int %49 %int_1 + OpStore %a %51 + OpBranch %23 + %23 = OpLabel + %52 = OpLoad %int %i + %53 = OpIAdd %int %52 %int_1 + OpStore %i %53 + OpBranch %21 + %22 = OpLabel + %54 = OpLoad %int %a + %55 = OpIEqual %bool %54 %int_5 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpStore %x_GLF_color %60 + OpBranch %56 + %58 = OpLabel + OpStore %x_GLF_color %61 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %62 +%tint_symbol = OpFunctionParameter %main_out + %66 = OpLabel + %67 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %67 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %69 = OpLabel + %70 = OpFunctionCall %void %main_1 + %72 = OpLoad %v4float %x_GLF_color + %73 = OpCompositeConstruct %main_out %72 + %71 = OpFunctionCall %void %tint_symbol_2 %73 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..8de51a942e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-break-floor-nan-never-executed/0-opt.wgsl.expected.wgsl @@ -0,0 +1,54 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + a = 0; + i = 0; + loop { + let x_32 : i32 = i; + if ((x_32 < 5)) { + } else { + break; + } + let x_36 : i32 = x_7.one; + if ((x_36 == 0)) { + if ((floor(bitcast(-4194304)) > 0.0)) { + a = -1; + break; + } + } + let x_45 : i32 = a; + a = (x_45 + 1); + + continuing { + let x_47 : i32 = i; + i = (x_47 + 1); + } + } + let x_49 : i32 = a; + if ((x_49 == 5)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm new file mode 100644 index 0000000000..22dc573228 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm @@ -0,0 +1,137 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %_GLF_global_loop_count "_GLF_global_loop_count" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int +%_GLF_global_loop_count = OpVariable %_ptr_Private_int Private + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_100 = OpConstant %int 100 + %main = OpFunction %void None %14 + %34 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + OpStore %_GLF_global_loop_count %int_0 + %35 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %36 = OpLoad %float %35 + OpStore %f %36 + %37 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %38 = OpLoad %int %37 + OpStore %i %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i + %44 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %45 = OpLoad %int %44 + %46 = OpSLessThan %bool %43 %45 + OpBranchConditional %46 %47 %40 + %47 = OpLabel + %48 = OpLoad %float %f + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %50 = OpLoad %float %49 + %51 = OpFOrdGreaterThan %bool %48 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + OpBranch %52 + %52 = OpLabel + OpStore %f %float_1 + %54 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %55 = OpLoad %float %54 + %56 = OpLoad %float %f + %57 = OpExtInst %float %1 FClamp %55 %float_1 %56 + %58 = OpFSub %float %float_1 %57 + %59 = OpLoad %int %i + %60 = OpConvertSToF %float %59 + %61 = OpFAdd %float %58 %60 + OpStore %f %61 + OpBranch %41 + %41 = OpLabel + %62 = OpLoad %int %i + %63 = OpIAdd %int %62 %int_1 + OpStore %i %63 + OpBranch %39 + %40 = OpLabel + %64 = OpLoad %float %f + %65 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpFOrdEqual %bool %64 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %72 + %74 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpConvertSToF %float %78 + %80 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %81 + %83 = OpCompositeConstruct %v4float %73 %76 %79 %82 + OpStore %_GLF_color %83 + OpBranch %68 + %70 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %85 + %87 = OpCompositeConstruct %v4float %86 %86 %86 %86 + OpStore %_GLF_color %87 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..58eeb4f0ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.hlsl @@ -0,0 +1,67 @@ +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int i = 0; + x_GLF_global_loop_count = 0; + const float x_36 = asfloat(x_7[1].x); + f = x_36; + const int x_38 = asint(x_10[1].x); + i = x_38; + while (true) { + const int x_43 = i; + const int x_45 = asint(x_10[2].x); + if ((x_43 < x_45)) { + } else { + break; + } + const float x_48 = f; + const float x_50 = asfloat(x_7[1].x); + if ((x_48 > x_50)) { + } + f = 1.0f; + const float x_55 = asfloat(x_7[2].x); + f = ((1.0f - clamp(x_55, 1.0f, f)) + float(i)); + { + i = (i + 1); + } + } + const float x_64 = f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_66 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_64 == x_66)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_72 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_75 = asint(x_10[1].x); + const int x_78 = asint(x_10[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_81 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + } else { + const int x_85 = asint(x_10[1].x); + const float x_86 = float(x_85); + x_GLF_color = float4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..df997cd2c6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.msl @@ -0,0 +1,84 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_10, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + float f = 0.0f; + int i = 0; + *(tint_symbol_4) = 0; + float const x_36 = x_7.x_GLF_uniform_float_values.arr[1].el; + f = x_36; + int const x_38 = x_10.x_GLF_uniform_int_values.arr[1].el; + i = x_38; + while (true) { + int const x_43 = i; + int const x_45 = x_10.x_GLF_uniform_int_values.arr[2].el; + if ((x_43 < x_45)) { + } else { + break; + } + float const x_48 = f; + float const x_50 = x_7.x_GLF_uniform_float_values.arr[1].el; + if ((x_48 > x_50)) { + } + f = 1.0f; + float const x_55 = x_7.x_GLF_uniform_float_values.arr[2].el; + float const x_56 = f; + int const x_59 = i; + f = ((1.0f - clamp(x_55, 1.0f, x_56)) + float(x_59)); + { + int const x_62 = i; + i = (x_62 + 1); + } + } + float const x_64 = f; + float const x_66 = x_7.x_GLF_uniform_float_values.arr[0].el; + if ((x_64 == x_66)) { + int const x_72 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_75 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_81 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + } else { + int const x_85 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_86 = float(x_85); + *(tint_symbol_5) = float4(x_86, x_86, x_86, x_86); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_7, x_10, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8f44a3e694 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.spvasm @@ -0,0 +1,177 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 107 +; Schema: 0 + OpCapability Shader + %65 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %19 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %19 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %95 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %f = OpVariable %_ptr_Function_float Function %28 + %i = OpVariable %_ptr_Function_int Function %4 + OpStore %x_GLF_global_loop_count %int_0 + %35 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %36 = OpLoad %float %35 + OpStore %f %36 + %38 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %39 = OpLoad %int %38 + OpStore %i %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %i + %46 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %47 = OpLoad %int %46 + %48 = OpSLessThan %bool %44 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %41 + %50 = OpLabel + %53 = OpLoad %float %f + %54 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %55 = OpLoad %float %54 + %56 = OpFOrdGreaterThan %bool %53 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + OpBranch %57 + %57 = OpLabel + OpStore %f %float_1 + %60 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %61 = OpLoad %float %60 + %62 = OpLoad %float %f + %63 = OpLoad %int %i + %64 = OpExtInst %float %65 NClamp %61 %float_1 %62 + %66 = OpFSub %float %float_1 %64 + %67 = OpConvertSToF %float %63 + %68 = OpFAdd %float %66 %67 + OpStore %f %68 + OpBranch %42 + %42 = OpLabel + %69 = OpLoad %int %i + %70 = OpIAdd %int %69 %int_1 + OpStore %i %70 + OpBranch %40 + %41 = OpLabel + %71 = OpLoad %float %f + %72 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %73 = OpLoad %float %72 + %74 = OpFOrdEqual %bool %71 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %79 + %87 = OpConvertSToF %float %81 + %88 = OpConvertSToF %float %83 + %89 = OpConvertSToF %float %85 + %90 = OpCompositeConstruct %v4float %86 %87 %88 %89 + OpStore %x_GLF_color %90 + OpBranch %75 + %77 = OpLabel + %91 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %92 + %94 = OpCompositeConstruct %v4float %93 %93 %93 %93 + OpStore %x_GLF_color %94 + OpBranch %75 + %75 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %95 +%tint_symbol = OpFunctionParameter %main_out + %99 = OpLabel + %100 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %100 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %102 = OpLabel + %103 = OpFunctionCall %void %main_1 + %105 = OpLoad %v4float %x_GLF_color + %106 = OpCompositeConstruct %main_out %105 + %104 = OpFunctionCall %void %tint_symbol_2 %106 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f074ac2a23 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.spvasm.expected.wgsl @@ -0,0 +1,78 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var i : i32; + x_GLF_global_loop_count = 0; + let x_36 : f32 = x_7.x_GLF_uniform_float_values[1]; + f = x_36; + let x_38 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_38; + loop { + let x_43 : i32 = i; + let x_45 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_43 < x_45)) { + } else { + break; + } + let x_48 : f32 = f; + let x_50 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_48 > x_50)) { + } + f = 1.0; + let x_55 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_56 : f32 = f; + let x_59 : i32 = i; + f = ((1.0 - clamp(x_55, 1.0, x_56)) + f32(x_59)); + + continuing { + let x_62 : i32 = i; + i = (x_62 + 1); + } + } + let x_64 : f32 = f; + let x_66 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_64 == x_66)) { + let x_72 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_75 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_72), f32(x_75), f32(x_78), f32(x_81)); + } else { + let x_85 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_86 : f32 = f32(x_85); + x_GLF_color = vec4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl new file mode 100644 index 0000000000..f074ac2a23 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl @@ -0,0 +1,78 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var i : i32; + x_GLF_global_loop_count = 0; + let x_36 : f32 = x_7.x_GLF_uniform_float_values[1]; + f = x_36; + let x_38 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_38; + loop { + let x_43 : i32 = i; + let x_45 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_43 < x_45)) { + } else { + break; + } + let x_48 : f32 = f; + let x_50 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_48 > x_50)) { + } + f = 1.0; + let x_55 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_56 : f32 = f; + let x_59 : i32 = i; + f = ((1.0 - clamp(x_55, 1.0, x_56)) + f32(x_59)); + + continuing { + let x_62 : i32 = i; + i = (x_62 + 1); + } + } + let x_64 : f32 = f; + let x_66 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_64 == x_66)) { + let x_72 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_75 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_72), f32(x_75), f32(x_78), f32(x_81)); + } else { + let x_85 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_86 : f32 = f32(x_85); + x_GLF_color = vec4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..58eeb4f0ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.hlsl @@ -0,0 +1,67 @@ +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int i = 0; + x_GLF_global_loop_count = 0; + const float x_36 = asfloat(x_7[1].x); + f = x_36; + const int x_38 = asint(x_10[1].x); + i = x_38; + while (true) { + const int x_43 = i; + const int x_45 = asint(x_10[2].x); + if ((x_43 < x_45)) { + } else { + break; + } + const float x_48 = f; + const float x_50 = asfloat(x_7[1].x); + if ((x_48 > x_50)) { + } + f = 1.0f; + const float x_55 = asfloat(x_7[2].x); + f = ((1.0f - clamp(x_55, 1.0f, f)) + float(i)); + { + i = (i + 1); + } + } + const float x_64 = f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_66 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_64 == x_66)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_72 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_75 = asint(x_10[1].x); + const int x_78 = asint(x_10[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_81 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + } else { + const int x_85 = asint(x_10[1].x); + const float x_86 = float(x_85); + x_GLF_color = float4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..df997cd2c6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.msl @@ -0,0 +1,84 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_10, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + float f = 0.0f; + int i = 0; + *(tint_symbol_4) = 0; + float const x_36 = x_7.x_GLF_uniform_float_values.arr[1].el; + f = x_36; + int const x_38 = x_10.x_GLF_uniform_int_values.arr[1].el; + i = x_38; + while (true) { + int const x_43 = i; + int const x_45 = x_10.x_GLF_uniform_int_values.arr[2].el; + if ((x_43 < x_45)) { + } else { + break; + } + float const x_48 = f; + float const x_50 = x_7.x_GLF_uniform_float_values.arr[1].el; + if ((x_48 > x_50)) { + } + f = 1.0f; + float const x_55 = x_7.x_GLF_uniform_float_values.arr[2].el; + float const x_56 = f; + int const x_59 = i; + f = ((1.0f - clamp(x_55, 1.0f, x_56)) + float(x_59)); + { + int const x_62 = i; + i = (x_62 + 1); + } + } + float const x_64 = f; + float const x_66 = x_7.x_GLF_uniform_float_values.arr[0].el; + if ((x_64 == x_66)) { + int const x_72 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_75 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_81 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + } else { + int const x_85 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_86 = float(x_85); + *(tint_symbol_5) = float4(x_86, x_86, x_86, x_86); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_7, x_10, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8f44a3e694 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.spvasm @@ -0,0 +1,177 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 107 +; Schema: 0 + OpCapability Shader + %65 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %19 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %19 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %95 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %f = OpVariable %_ptr_Function_float Function %28 + %i = OpVariable %_ptr_Function_int Function %4 + OpStore %x_GLF_global_loop_count %int_0 + %35 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %36 = OpLoad %float %35 + OpStore %f %36 + %38 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %39 = OpLoad %int %38 + OpStore %i %39 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %i + %46 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %47 = OpLoad %int %46 + %48 = OpSLessThan %bool %44 %47 + OpSelectionMerge %50 None + OpBranchConditional %48 %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %41 + %50 = OpLabel + %53 = OpLoad %float %f + %54 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %55 = OpLoad %float %54 + %56 = OpFOrdGreaterThan %bool %53 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + OpBranch %57 + %57 = OpLabel + OpStore %f %float_1 + %60 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %61 = OpLoad %float %60 + %62 = OpLoad %float %f + %63 = OpLoad %int %i + %64 = OpExtInst %float %65 NClamp %61 %float_1 %62 + %66 = OpFSub %float %float_1 %64 + %67 = OpConvertSToF %float %63 + %68 = OpFAdd %float %66 %67 + OpStore %f %68 + OpBranch %42 + %42 = OpLabel + %69 = OpLoad %int %i + %70 = OpIAdd %int %69 %int_1 + OpStore %i %70 + OpBranch %40 + %41 = OpLabel + %71 = OpLoad %float %f + %72 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %73 = OpLoad %float %72 + %74 = OpFOrdEqual %bool %71 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %79 + %87 = OpConvertSToF %float %81 + %88 = OpConvertSToF %float %83 + %89 = OpConvertSToF %float %85 + %90 = OpCompositeConstruct %v4float %86 %87 %88 %89 + OpStore %x_GLF_color %90 + OpBranch %75 + %77 = OpLabel + %91 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %92 + %94 = OpCompositeConstruct %v4float %93 %93 %93 %93 + OpStore %x_GLF_color %94 + OpBranch %75 + %75 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %95 +%tint_symbol = OpFunctionParameter %main_out + %99 = OpLabel + %100 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %100 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %102 = OpLabel + %103 = OpFunctionCall %void %main_1 + %105 = OpLoad %v4float %x_GLF_color + %106 = OpCompositeConstruct %main_out %105 + %104 = OpFunctionCall %void %tint_symbol_2 %106 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f074ac2a23 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-clamp-to-one-empty-condition/0-opt.wgsl.expected.wgsl @@ -0,0 +1,78 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var i : i32; + x_GLF_global_loop_count = 0; + let x_36 : f32 = x_7.x_GLF_uniform_float_values[1]; + f = x_36; + let x_38 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_38; + loop { + let x_43 : i32 = i; + let x_45 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_43 < x_45)) { + } else { + break; + } + let x_48 : f32 = f; + let x_50 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_48 > x_50)) { + } + f = 1.0; + let x_55 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_56 : f32 = f; + let x_59 : i32 = i; + f = ((1.0 - clamp(x_55, 1.0, x_56)) + f32(x_59)); + + continuing { + let x_62 : i32 = i; + i = (x_62 + 1); + } + } + let x_64 : f32 = f; + let x_66 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_64 == x_66)) { + let x_72 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_75 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_72), f32(x_75), f32(x_78), f32(x_81)); + } else { + let x_85 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_86 : f32 = f32(x_85); + x_GLF_color = vec4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm new file mode 100644 index 0000000000..525f7ecbcc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm @@ -0,0 +1,152 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %arr "arr" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %index "index" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_6 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 + %uint_6 = OpConstant %uint 6 +%_arr_int_uint_6 = OpTypeArray %int %uint_6 + %buf0 = OpTypeStruct %_arr_int_uint_6 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_4 = OpConstant %int 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %31 = OpLabel + %arr = OpVariable %_ptr_Function__arr_int_uint_3 Function + %index = OpVariable %_ptr_Function_int Function + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %33 = OpLoad %int %32 + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %35 = OpLoad %int %34 + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %37 = OpLoad %int %36 + %38 = OpCompositeConstruct %_arr_int_uint_3 %33 %35 %37 + OpStore %arr %38 + OpStore %index %int_1 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + OpSelectionMerge %43 None + OpBranchConditional %true %44 %43 + %44 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpIEqual %bool %46 %int_1 + %48 = OpLoad %int %index + %49 = OpSLessThanEqual %bool %48 %int_1 + %50 = OpLogicalAnd %bool %47 %49 + %51 = OpLogicalNot %bool %50 + OpBranch %43 + %43 = OpLabel + %52 = OpPhi %bool %true %42 %51 %44 + %53 = OpLogicalNot %bool %52 + OpBranchConditional %53 %54 %40 + %54 = OpLabel + %55 = OpLoad %int %index + %56 = OpAccessChain %_ptr_Function_int %arr %55 + %57 = OpLoad %int %56 + %58 = OpIAdd %int %57 %int_1 + OpStore %56 %58 + %59 = OpLoad %int %index + %60 = OpIAdd %int %59 %int_1 + OpStore %index %60 + OpBranch %41 + %41 = OpLabel + OpBranch %39 + %40 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Function_int %arr %62 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %66 = OpLoad %int %65 + %67 = OpIEqual %bool %64 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Function_int %arr %71 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %75 = OpLoad %int %74 + %76 = OpIEqual %bool %73 %75 + OpBranch %68 + %68 = OpLabel + %77 = OpPhi %bool %67 %40 %76 %69 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %78 + %79 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Function_int %arr %81 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %85 = OpLoad %int %84 + %86 = OpIEqual %bool %83 %85 + OpBranch %78 + %78 = OpLabel + %87 = OpPhi %bool %77 %68 %86 %79 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %90 + %89 = OpLabel + %91 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %92 + %94 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %98 = OpLoad %int %97 + %99 = OpConvertSToF %float %98 + %100 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %101 = OpLoad %int %100 + %102 = OpConvertSToF %float %101 + %103 = OpCompositeConstruct %v4float %93 %96 %99 %102 + OpStore %_GLF_color %103 + OpBranch %88 + %90 = OpLabel + %104 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %105 = OpLoad %int %104 + %106 = OpConvertSToF %float %105 + %107 = OpCompositeConstruct %v4float %106 %106 %106 %106 + OpStore %_GLF_color %107 + OpBranch %88 + %88 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..b3077db9d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.hlsl @@ -0,0 +1,92 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[6]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int arr[3] = (int[3])0; + int index = 0; + bool x_76 = false; + bool x_86 = false; + bool x_77_phi = false; + bool x_87_phi = false; + const int x_33 = asint(x_6[3].x); + const int x_35 = asint(x_6[5].x); + const int x_37 = asint(x_6[2].x); + const int tint_symbol_3[3] = {x_33, x_35, x_37}; + arr = tint_symbol_3; + index = 1; + while (true) { + bool x_51 = false; + bool x_52_phi = false; + x_52_phi = true; + if (true) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_46 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + bool tint_tmp = (x_46 == 1); + if (tint_tmp) { + tint_tmp = (index <= 1); + } + x_51 = !((tint_tmp)); + x_52_phi = x_51; + } + if (!(x_52_phi)) { + } else { + break; + } + const int x_56_save = index; + const int x_57 = arr[x_56_save]; + arr[x_56_save] = (x_57 + 1); + index = (index + 1); + } + const int x_62 = asint(x_6[1].x); + const int x_64 = arr[x_62]; + const int x_66 = asint(x_6[3].x); + const bool x_67 = (x_64 == x_66); + x_77_phi = x_67; + if (x_67) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_71 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_73 = arr[x_71]; + const int x_75 = asint(x_6[4].x); + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + const bool x_77 = x_77_phi; + x_87_phi = x_77; + if (x_77) { + const int x_81 = asint(x_6[3].x); + const int x_83 = arr[x_81]; + const int x_85 = asint(x_6[2].x); + x_86 = (x_83 == x_85); + x_87_phi = x_86; + } + if (x_87_phi) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_92 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_95 = asint(x_6[1].x); + const int x_98 = asint(x_6[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_101 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_92), float(x_95), float(x_98), float(x_101)); + } else { + const int x_105 = asint(x_6[1].x); + const float x_106 = float(x_105); + x_GLF_color = float4(x_106, x_106, x_106, x_106); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..028ec7e42a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.msl @@ -0,0 +1,102 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[6]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5) { + tint_array_wrapper_1 arr = {}; + int index = 0; + bool x_76 = false; + bool x_86 = false; + bool x_77_phi = false; + bool x_87_phi = false; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[2].el; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_33, x_35, x_37}}; + arr = tint_symbol_3; + index = 1; + while (true) { + bool x_51 = false; + bool x_52_phi = false; + x_52_phi = true; + if (true) { + int const x_46 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_48 = index; + x_51 = !(((x_46 == 1) && (x_48 <= 1))); + x_52_phi = x_51; + } + bool const x_52 = x_52_phi; + if (!(x_52)) { + } else { + break; + } + int const x_55 = index; + int const x_56_save = x_55; + int const x_57 = arr.arr[x_56_save]; + arr.arr[x_56_save] = (x_57 + 1); + int const x_59 = index; + index = (x_59 + 1); + } + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = arr.arr[x_62]; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[3].el; + bool const x_67 = (x_64 == x_66); + x_77_phi = x_67; + if (x_67) { + int const x_71 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_73 = arr.arr[x_71]; + int const x_75 = x_6.x_GLF_uniform_int_values.arr[4].el; + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + bool const x_77 = x_77_phi; + x_87_phi = x_77; + if (x_77) { + int const x_81 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_83 = arr.arr[x_81]; + int const x_85 = x_6.x_GLF_uniform_int_values.arr[2].el; + x_86 = (x_83 == x_85); + x_87_phi = x_86; + } + bool const x_87 = x_87_phi; + if (x_87) { + int const x_92 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_95 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_98 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_101 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_92), float(x_95), float(x_98), float(x_101)); + } else { + int const x_105 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_106 = float(x_105); + *(tint_symbol_5) = float4(x_106, x_106, x_106, x_106); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..35f7480b04 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.spvasm @@ -0,0 +1,224 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 141 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %arr "arr" + OpName %index "index" + OpName %x_76 "x_76" + OpName %x_86 "x_86" + OpName %x_77_phi "x_77_phi" + OpName %x_87_phi "x_87_phi" + OpName %x_51 "x_51" + OpName %x_52_phi "x_52_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_6 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_6 = OpConstant %uint 6 +%_arr_int_uint_6 = OpTypeArray %int %uint_6 + %buf0 = OpTypeStruct %_arr_int_uint_6 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 + %23 = OpConstantNull %_arr_int_uint_3 +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %30 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %129 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %arr = OpVariable %_ptr_Function__arr_int_uint_3 Function %23 + %index = OpVariable %_ptr_Function_int Function %26 + %x_76 = OpVariable %_ptr_Function_bool Function %30 + %x_86 = OpVariable %_ptr_Function_bool Function %30 + %x_77_phi = OpVariable %_ptr_Function_bool Function %30 + %x_87_phi = OpVariable %_ptr_Function_bool Function %30 + %x_51 = OpVariable %_ptr_Function_bool Function %30 + %x_52_phi = OpVariable %_ptr_Function_bool Function %30 + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %38 = OpLoad %int %37 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %41 = OpLoad %int %40 + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %44 = OpLoad %int %43 + %45 = OpCompositeConstruct %_arr_int_uint_3 %38 %41 %44 + OpStore %arr %45 + OpStore %index %int_1 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + OpStore %x_52_phi %true + OpSelectionMerge %54 None + OpBranchConditional %true %55 %54 + %55 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %58 = OpLoad %int %57 + %59 = OpLoad %int %index + %61 = OpIEqual %bool %58 %int_1 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpSLessThanEqual %bool %59 %int_1 + OpBranch %62 + %62 = OpLabel + %65 = OpPhi %bool %61 %55 %64 %63 + %60 = OpLogicalNot %bool %65 + OpStore %x_51 %60 + %66 = OpLoad %bool %x_51 + OpStore %x_52_phi %66 + OpBranch %54 + %54 = OpLabel + %67 = OpLoad %bool %x_52_phi + %68 = OpLogicalNot %bool %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + OpBranch %69 + %71 = OpLabel + OpBranch %48 + %69 = OpLabel + %72 = OpLoad %int %index + %73 = OpAccessChain %_ptr_Function_int %arr %72 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Function_int %arr %72 + %76 = OpIAdd %int %74 %int_1 + OpStore %75 %76 + %77 = OpLoad %int %index + %78 = OpIAdd %int %77 %int_1 + OpStore %index %78 + OpBranch %49 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Function_int %arr %80 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %84 = OpLoad %int %83 + %85 = OpIEqual %bool %82 %84 + OpStore %x_77_phi %85 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Function_int %arr %89 + %91 = OpLoad %int %90 + %93 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %94 = OpLoad %int %93 + %95 = OpIEqual %bool %91 %94 + OpStore %x_76 %95 + %96 = OpLoad %bool %x_76 + OpStore %x_77_phi %96 + OpBranch %86 + %86 = OpLabel + %97 = OpLoad %bool %x_77_phi + OpStore %x_87_phi %97 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %101 = OpLoad %int %100 + %102 = OpAccessChain %_ptr_Function_int %arr %101 + %103 = OpLoad %int %102 + %104 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %105 = OpLoad %int %104 + %106 = OpIEqual %bool %103 %105 + OpStore %x_86 %106 + %107 = OpLoad %bool %x_86 + OpStore %x_87_phi %107 + OpBranch %98 + %98 = OpLabel + %108 = OpLoad %bool %x_87_phi + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %111 + %110 = OpLabel + %112 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %115 = OpLoad %int %114 + %116 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %117 = OpLoad %int %116 + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %119 = OpLoad %int %118 + %120 = OpConvertSToF %float %113 + %121 = OpConvertSToF %float %115 + %122 = OpConvertSToF %float %117 + %123 = OpConvertSToF %float %119 + %124 = OpCompositeConstruct %v4float %120 %121 %122 %123 + OpStore %x_GLF_color %124 + OpBranch %109 + %111 = OpLabel + %125 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %126 = OpLoad %int %125 + %127 = OpConvertSToF %float %126 + %128 = OpCompositeConstruct %v4float %127 %127 %127 %127 + OpStore %x_GLF_color %128 + OpBranch %109 + %109 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %129 +%tint_symbol = OpFunctionParameter %main_out + %133 = OpLabel + %134 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %134 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %136 = OpLabel + %137 = OpFunctionCall %void %main_1 + %139 = OpLoad %v4float %x_GLF_color + %140 = OpCompositeConstruct %main_out %139 + %138 = OpFunctionCall %void %tint_symbol_2 %140 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..3e3cb2157d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.spvasm.expected.wgsl @@ -0,0 +1,91 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var index : i32; + var x_76 : bool; + var x_86 : bool; + var x_77_phi : bool; + var x_87_phi : bool; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[2]; + arr = array(x_33, x_35, x_37); + index = 1; + loop { + var x_51 : bool; + var x_52_phi : bool; + x_52_phi = true; + if (true) { + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = index; + x_51 = !(((x_46 == 1) && (x_48 <= 1))); + x_52_phi = x_51; + } + let x_52 : bool = x_52_phi; + if (!(x_52)) { + } else { + break; + } + let x_55 : i32 = index; + let x_56 : ptr = &(arr[x_55]); + let x_57 : i32 = *(x_56); + *(x_56) = (x_57 + 1); + let x_59 : i32 = index; + index = (x_59 + 1); + } + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_64 : i32 = arr[x_62]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_67 : bool = (x_64 == x_66); + x_77_phi = x_67; + if (x_67) { + let x_71 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_73 : i32 = arr[x_71]; + let x_75 : i32 = x_6.x_GLF_uniform_int_values[4]; + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + let x_77 : bool = x_77_phi; + x_87_phi = x_77; + if (x_77) { + let x_81 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_83 : i32 = arr[x_81]; + let x_85 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_86 = (x_83 == x_85); + x_87_phi = x_86; + } + let x_87 : bool = x_87_phi; + if (x_87) { + let x_92 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_95 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_98 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_101 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_92), f32(x_95), f32(x_98), f32(x_101)); + } else { + let x_105 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_106 : f32 = f32(x_105); + x_GLF_color = vec4(x_106, x_106, x_106, x_106); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl new file mode 100644 index 0000000000..3e3cb2157d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl @@ -0,0 +1,91 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var index : i32; + var x_76 : bool; + var x_86 : bool; + var x_77_phi : bool; + var x_87_phi : bool; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[2]; + arr = array(x_33, x_35, x_37); + index = 1; + loop { + var x_51 : bool; + var x_52_phi : bool; + x_52_phi = true; + if (true) { + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = index; + x_51 = !(((x_46 == 1) && (x_48 <= 1))); + x_52_phi = x_51; + } + let x_52 : bool = x_52_phi; + if (!(x_52)) { + } else { + break; + } + let x_55 : i32 = index; + let x_56 : ptr = &(arr[x_55]); + let x_57 : i32 = *(x_56); + *(x_56) = (x_57 + 1); + let x_59 : i32 = index; + index = (x_59 + 1); + } + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_64 : i32 = arr[x_62]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_67 : bool = (x_64 == x_66); + x_77_phi = x_67; + if (x_67) { + let x_71 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_73 : i32 = arr[x_71]; + let x_75 : i32 = x_6.x_GLF_uniform_int_values[4]; + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + let x_77 : bool = x_77_phi; + x_87_phi = x_77; + if (x_77) { + let x_81 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_83 : i32 = arr[x_81]; + let x_85 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_86 = (x_83 == x_85); + x_87_phi = x_86; + } + let x_87 : bool = x_87_phi; + if (x_87) { + let x_92 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_95 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_98 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_101 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_92), f32(x_95), f32(x_98), f32(x_101)); + } else { + let x_105 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_106 : f32 = f32(x_105); + x_GLF_color = vec4(x_106, x_106, x_106, x_106); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..b3077db9d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.hlsl @@ -0,0 +1,92 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[6]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int arr[3] = (int[3])0; + int index = 0; + bool x_76 = false; + bool x_86 = false; + bool x_77_phi = false; + bool x_87_phi = false; + const int x_33 = asint(x_6[3].x); + const int x_35 = asint(x_6[5].x); + const int x_37 = asint(x_6[2].x); + const int tint_symbol_3[3] = {x_33, x_35, x_37}; + arr = tint_symbol_3; + index = 1; + while (true) { + bool x_51 = false; + bool x_52_phi = false; + x_52_phi = true; + if (true) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_46 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + bool tint_tmp = (x_46 == 1); + if (tint_tmp) { + tint_tmp = (index <= 1); + } + x_51 = !((tint_tmp)); + x_52_phi = x_51; + } + if (!(x_52_phi)) { + } else { + break; + } + const int x_56_save = index; + const int x_57 = arr[x_56_save]; + arr[x_56_save] = (x_57 + 1); + index = (index + 1); + } + const int x_62 = asint(x_6[1].x); + const int x_64 = arr[x_62]; + const int x_66 = asint(x_6[3].x); + const bool x_67 = (x_64 == x_66); + x_77_phi = x_67; + if (x_67) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_71 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_73 = arr[x_71]; + const int x_75 = asint(x_6[4].x); + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + const bool x_77 = x_77_phi; + x_87_phi = x_77; + if (x_77) { + const int x_81 = asint(x_6[3].x); + const int x_83 = arr[x_81]; + const int x_85 = asint(x_6[2].x); + x_86 = (x_83 == x_85); + x_87_phi = x_86; + } + if (x_87_phi) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_92 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_95 = asint(x_6[1].x); + const int x_98 = asint(x_6[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_101 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_92), float(x_95), float(x_98), float(x_101)); + } else { + const int x_105 = asint(x_6[1].x); + const float x_106 = float(x_105); + x_GLF_color = float4(x_106, x_106, x_106, x_106); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..028ec7e42a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.msl @@ -0,0 +1,102 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[6]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5) { + tint_array_wrapper_1 arr = {}; + int index = 0; + bool x_76 = false; + bool x_86 = false; + bool x_77_phi = false; + bool x_87_phi = false; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[2].el; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_33, x_35, x_37}}; + arr = tint_symbol_3; + index = 1; + while (true) { + bool x_51 = false; + bool x_52_phi = false; + x_52_phi = true; + if (true) { + int const x_46 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_48 = index; + x_51 = !(((x_46 == 1) && (x_48 <= 1))); + x_52_phi = x_51; + } + bool const x_52 = x_52_phi; + if (!(x_52)) { + } else { + break; + } + int const x_55 = index; + int const x_56_save = x_55; + int const x_57 = arr.arr[x_56_save]; + arr.arr[x_56_save] = (x_57 + 1); + int const x_59 = index; + index = (x_59 + 1); + } + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = arr.arr[x_62]; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[3].el; + bool const x_67 = (x_64 == x_66); + x_77_phi = x_67; + if (x_67) { + int const x_71 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_73 = arr.arr[x_71]; + int const x_75 = x_6.x_GLF_uniform_int_values.arr[4].el; + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + bool const x_77 = x_77_phi; + x_87_phi = x_77; + if (x_77) { + int const x_81 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_83 = arr.arr[x_81]; + int const x_85 = x_6.x_GLF_uniform_int_values.arr[2].el; + x_86 = (x_83 == x_85); + x_87_phi = x_86; + } + bool const x_87 = x_87_phi; + if (x_87) { + int const x_92 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_95 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_98 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_101 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_92), float(x_95), float(x_98), float(x_101)); + } else { + int const x_105 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_106 = float(x_105); + *(tint_symbol_5) = float4(x_106, x_106, x_106, x_106); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..35f7480b04 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.spvasm @@ -0,0 +1,224 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 141 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %arr "arr" + OpName %index "index" + OpName %x_76 "x_76" + OpName %x_86 "x_86" + OpName %x_77_phi "x_77_phi" + OpName %x_87_phi "x_87_phi" + OpName %x_51 "x_51" + OpName %x_52_phi "x_52_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_6 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_6 = OpConstant %uint 6 +%_arr_int_uint_6 = OpTypeArray %int %uint_6 + %buf0 = OpTypeStruct %_arr_int_uint_6 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 + %23 = OpConstantNull %_arr_int_uint_3 +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %30 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %129 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %arr = OpVariable %_ptr_Function__arr_int_uint_3 Function %23 + %index = OpVariable %_ptr_Function_int Function %26 + %x_76 = OpVariable %_ptr_Function_bool Function %30 + %x_86 = OpVariable %_ptr_Function_bool Function %30 + %x_77_phi = OpVariable %_ptr_Function_bool Function %30 + %x_87_phi = OpVariable %_ptr_Function_bool Function %30 + %x_51 = OpVariable %_ptr_Function_bool Function %30 + %x_52_phi = OpVariable %_ptr_Function_bool Function %30 + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %38 = OpLoad %int %37 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %41 = OpLoad %int %40 + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %44 = OpLoad %int %43 + %45 = OpCompositeConstruct %_arr_int_uint_3 %38 %41 %44 + OpStore %arr %45 + OpStore %index %int_1 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + OpStore %x_52_phi %true + OpSelectionMerge %54 None + OpBranchConditional %true %55 %54 + %55 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %58 = OpLoad %int %57 + %59 = OpLoad %int %index + %61 = OpIEqual %bool %58 %int_1 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpSLessThanEqual %bool %59 %int_1 + OpBranch %62 + %62 = OpLabel + %65 = OpPhi %bool %61 %55 %64 %63 + %60 = OpLogicalNot %bool %65 + OpStore %x_51 %60 + %66 = OpLoad %bool %x_51 + OpStore %x_52_phi %66 + OpBranch %54 + %54 = OpLabel + %67 = OpLoad %bool %x_52_phi + %68 = OpLogicalNot %bool %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + OpBranch %69 + %71 = OpLabel + OpBranch %48 + %69 = OpLabel + %72 = OpLoad %int %index + %73 = OpAccessChain %_ptr_Function_int %arr %72 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Function_int %arr %72 + %76 = OpIAdd %int %74 %int_1 + OpStore %75 %76 + %77 = OpLoad %int %index + %78 = OpIAdd %int %77 %int_1 + OpStore %index %78 + OpBranch %49 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Function_int %arr %80 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %84 = OpLoad %int %83 + %85 = OpIEqual %bool %82 %84 + OpStore %x_77_phi %85 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Function_int %arr %89 + %91 = OpLoad %int %90 + %93 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %94 = OpLoad %int %93 + %95 = OpIEqual %bool %91 %94 + OpStore %x_76 %95 + %96 = OpLoad %bool %x_76 + OpStore %x_77_phi %96 + OpBranch %86 + %86 = OpLabel + %97 = OpLoad %bool %x_77_phi + OpStore %x_87_phi %97 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %101 = OpLoad %int %100 + %102 = OpAccessChain %_ptr_Function_int %arr %101 + %103 = OpLoad %int %102 + %104 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %105 = OpLoad %int %104 + %106 = OpIEqual %bool %103 %105 + OpStore %x_86 %106 + %107 = OpLoad %bool %x_86 + OpStore %x_87_phi %107 + OpBranch %98 + %98 = OpLabel + %108 = OpLoad %bool %x_87_phi + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %111 + %110 = OpLabel + %112 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %115 = OpLoad %int %114 + %116 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %117 = OpLoad %int %116 + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %119 = OpLoad %int %118 + %120 = OpConvertSToF %float %113 + %121 = OpConvertSToF %float %115 + %122 = OpConvertSToF %float %117 + %123 = OpConvertSToF %float %119 + %124 = OpCompositeConstruct %v4float %120 %121 %122 %123 + OpStore %x_GLF_color %124 + OpBranch %109 + %111 = OpLabel + %125 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %126 = OpLoad %int %125 + %127 = OpConvertSToF %float %126 + %128 = OpCompositeConstruct %v4float %127 %127 %127 %127 + OpStore %x_GLF_color %128 + OpBranch %109 + %109 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %129 +%tint_symbol = OpFunctionParameter %main_out + %133 = OpLabel + %134 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %134 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %136 = OpLabel + %137 = OpFunctionCall %void %main_1 + %139 = OpLoad %v4float %x_GLF_color + %140 = OpCompositeConstruct %main_out %139 + %138 = OpFunctionCall %void %tint_symbol_2 %140 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e3cb2157d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-condition-double-negate/0-opt.wgsl.expected.wgsl @@ -0,0 +1,91 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var index : i32; + var x_76 : bool; + var x_86 : bool; + var x_77_phi : bool; + var x_87_phi : bool; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[2]; + arr = array(x_33, x_35, x_37); + index = 1; + loop { + var x_51 : bool; + var x_52_phi : bool; + x_52_phi = true; + if (true) { + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = index; + x_51 = !(((x_46 == 1) && (x_48 <= 1))); + x_52_phi = x_51; + } + let x_52 : bool = x_52_phi; + if (!(x_52)) { + } else { + break; + } + let x_55 : i32 = index; + let x_56 : ptr = &(arr[x_55]); + let x_57 : i32 = *(x_56); + *(x_56) = (x_57 + 1); + let x_59 : i32 = index; + index = (x_59 + 1); + } + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_64 : i32 = arr[x_62]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_67 : bool = (x_64 == x_66); + x_77_phi = x_67; + if (x_67) { + let x_71 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_73 : i32 = arr[x_71]; + let x_75 : i32 = x_6.x_GLF_uniform_int_values[4]; + x_76 = (x_73 == x_75); + x_77_phi = x_76; + } + let x_77 : bool = x_77_phi; + x_87_phi = x_77; + if (x_77) { + let x_81 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_83 : i32 = arr[x_81]; + let x_85 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_86 = (x_83 == x_85); + x_87_phi = x_86; + } + let x_87 : bool = x_87_phi; + if (x_87) { + let x_92 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_95 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_98 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_101 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_92), f32(x_95), f32(x_98), f32(x_101)); + } else { + let x_105 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_106 : f32 = f32(x_105); + x_GLF_color = vec4(x_106, x_106, x_106, x_106); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm new file mode 100644 index 0000000000..ecdf15a2ec --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm @@ -0,0 +1,145 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %b "b" + OpName %c "c" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %15 + %33 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %b = OpVariable %_ptr_Function_float Function + %c = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %35 = OpLoad %float %34 + OpStore %a %35 + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %37 = OpLoad %float %36 + OpStore %b %37 + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %39 = OpLoad %float %38 + OpStore %c %39 + %40 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %41 = OpLoad %int %40 + OpStore %i %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %int %i + %47 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpSLessThan %bool %46 %48 + OpBranchConditional %49 %50 %43 + %50 = OpLabel + %51 = OpLoad %int %i + %52 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %53 = OpLoad %int %52 + %54 = OpIEqual %bool %51 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + %57 = OpLoad %float %a + %58 = OpDPdx %float %57 + %59 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %60 = OpLoad %float %59 + %61 = OpFAdd %float %58 %60 + OpStore %b %61 + OpBranch %55 + %55 = OpLabel + %62 = OpLoad %float %a + %63 = OpDPdx %float %62 + OpStore %c %63 + %64 = OpLoad %float %c + %65 = OpLoad %float %b + %66 = OpFDiv %float %64 %65 + OpStore %a %66 + OpBranch %44 + %44 = OpLabel + %67 = OpLoad %int %i + %68 = OpIAdd %int %67 %int_1 + OpStore %i %68 + OpBranch %42 + %43 = OpLabel + %69 = OpLoad %float %a + %70 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %71 = OpLoad %float %70 + %72 = OpFOrdEqual %bool %69 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %80 + %82 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpConvertSToF %float %83 + %85 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %86 + %88 = OpCompositeConstruct %v4float %78 %81 %84 %87 + OpStore %_GLF_color %88 + OpBranch %73 + %75 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpConvertSToF %float %90 + %92 = OpCompositeConstruct %v4float %91 %91 %91 %91 + OpStore %_GLF_color %92 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9c06087533 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.hlsl @@ -0,0 +1,72 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + float b = 0.0f; + float c = 0.0f; + int i = 0; + const float x_35 = asfloat(x_6[1].x); + a = x_35; + const float x_37 = asfloat(x_6[1].x); + b = x_37; + const float x_39 = asfloat(x_6[1].x); + c = x_39; + const int x_41 = asint(x_11[1].x); + i = x_41; + while (true) { + const int x_46 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_48 = asint(x_11[scalar_offset / 4][scalar_offset % 4]); + if ((x_46 < x_48)) { + } else { + break; + } + const int x_51 = i; + const int x_53 = asint(x_11[2].x); + if ((x_51 == x_53)) { + const float x_57 = a; + const float x_60 = asfloat(x_6[1].x); + b = (ddx(x_57) + x_60); + } + c = ddx(a); + a = (c / b); + { + i = (i + 1); + } + } + const float x_69 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_71 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_69 == x_71)) { + const int x_77 = asint(x_11[2].x); + const int x_80 = asint(x_11[1].x); + const int x_83 = asint(x_11[1].x); + const int x_86 = asint(x_11[2].x); + x_GLF_color = float4(float(x_77), float(x_80), float(x_83), float(x_86)); + } else { + const int x_90 = asint(x_11[1].x); + const float x_91 = float(x_90); + x_GLF_color = float4(x_91, x_91, x_91, x_91); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..70485b36b3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_11, thread float4* const tint_symbol_4) { + float a = 0.0f; + float b = 0.0f; + float c = 0.0f; + int i = 0; + float const x_35 = x_6.x_GLF_uniform_float_values.arr[1].el; + a = x_35; + float const x_37 = x_6.x_GLF_uniform_float_values.arr[1].el; + b = x_37; + float const x_39 = x_6.x_GLF_uniform_float_values.arr[1].el; + c = x_39; + int const x_41 = x_11.x_GLF_uniform_int_values.arr[1].el; + i = x_41; + while (true) { + int const x_46 = i; + int const x_48 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_46 < x_48)) { + } else { + break; + } + int const x_51 = i; + int const x_53 = x_11.x_GLF_uniform_int_values.arr[2].el; + if ((x_51 == x_53)) { + float const x_57 = a; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[1].el; + b = (dfdx(x_57) + x_60); + } + float const x_62 = a; + c = dfdx(x_62); + float const x_64 = c; + float const x_65 = b; + a = (x_64 / x_65); + { + int const x_67 = i; + i = (x_67 + 1); + } + } + float const x_69 = a; + float const x_71 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_69 == x_71)) { + int const x_77 = x_11.x_GLF_uniform_int_values.arr[2].el; + int const x_80 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_83 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_86 = x_11.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_77), float(x_80), float(x_83), float(x_86)); + } else { + int const x_90 = x_11.x_GLF_uniform_int_values.arr[1].el; + float const x_91 = float(x_90); + *(tint_symbol_4) = float4(x_91, x_91, x_91, x_91); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_11, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4ba110f5de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.spvasm @@ -0,0 +1,185 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %100 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_float Function %26 + %b = OpVariable %_ptr_Function_float Function %26 + %c = OpVariable %_ptr_Function_float Function %26 + %i = OpVariable %_ptr_Function_int Function %31 + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %36 = OpLoad %float %35 + OpStore %a %36 + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %38 = OpLoad %float %37 + OpStore %b %38 + %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %40 = OpLoad %float %39 + OpStore %c %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %43 = OpLoad %int %42 + OpStore %i %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpSLessThan %bool %48 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %55 %56 + %55 = OpLabel + OpBranch %54 + %56 = OpLabel + OpBranch %45 + %54 = OpLabel + %57 = OpLoad %int %i + %59 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_2 + %60 = OpLoad %int %59 + %61 = OpIEqual %bool %57 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpLoad %float %a + %65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %66 = OpLoad %float %65 + %67 = OpDPdx %float %64 + %68 = OpFAdd %float %67 %66 + OpStore %b %68 + OpBranch %62 + %62 = OpLabel + %69 = OpLoad %float %a + %70 = OpDPdx %float %69 + OpStore %c %70 + %71 = OpLoad %float %c + %72 = OpLoad %float %b + %73 = OpFDiv %float %71 %72 + OpStore %a %73 + OpBranch %46 + %46 = OpLabel + %74 = OpLoad %int %i + %75 = OpIAdd %int %74 %int_1 + OpStore %i %75 + OpBranch %44 + %45 = OpLabel + %76 = OpLoad %float %a + %77 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %78 = OpLoad %float %77 + %79 = OpFOrdEqual %bool %76 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + %83 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_2 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_2 + %90 = OpLoad %int %89 + %91 = OpConvertSToF %float %84 + %92 = OpConvertSToF %float %86 + %93 = OpConvertSToF %float %88 + %94 = OpConvertSToF %float %90 + %95 = OpCompositeConstruct %v4float %91 %92 %93 %94 + OpStore %x_GLF_color %95 + OpBranch %80 + %82 = OpLabel + %96 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpConvertSToF %float %97 + %99 = OpCompositeConstruct %v4float %98 %98 %98 %98 + OpStore %x_GLF_color %99 + OpBranch %80 + %80 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %100 +%tint_symbol = OpFunctionParameter %main_out + %104 = OpLabel + %105 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %105 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %107 = OpLabel + %108 = OpFunctionCall %void %main_1 + %110 = OpLoad %v4float %x_GLF_color + %111 = OpCompositeConstruct %main_out %110 + %109 = OpFunctionCall %void %tint_symbol_2 %111 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..52eb93c944 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.spvasm.expected.wgsl @@ -0,0 +1,84 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var b : f32; + var c : f32; + var i : i32; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = x_35; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[1]; + b = x_37; + let x_39 : f32 = x_6.x_GLF_uniform_float_values[1]; + c = x_39; + let x_41 : i32 = x_11.x_GLF_uniform_int_values[1]; + i = x_41; + loop { + let x_46 : i32 = i; + let x_48 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_46 < x_48)) { + } else { + break; + } + let x_51 : i32 = i; + let x_53 : i32 = x_11.x_GLF_uniform_int_values[2]; + if ((x_51 == x_53)) { + let x_57 : f32 = a; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[1]; + b = (dpdx(x_57) + x_60); + } + let x_62 : f32 = a; + c = dpdx(x_62); + let x_64 : f32 = c; + let x_65 : f32 = b; + a = (x_64 / x_65); + + continuing { + let x_67 : i32 = i; + i = (x_67 + 1); + } + } + let x_69 : f32 = a; + let x_71 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_69 == x_71)) { + let x_77 : i32 = x_11.x_GLF_uniform_int_values[2]; + let x_80 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_83 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_86 : i32 = x_11.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_77), f32(x_80), f32(x_83), f32(x_86)); + } else { + let x_90 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_91 : f32 = f32(x_90); + x_GLF_color = vec4(x_91, x_91, x_91, x_91); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl new file mode 100644 index 0000000000..52eb93c944 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl @@ -0,0 +1,84 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var b : f32; + var c : f32; + var i : i32; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = x_35; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[1]; + b = x_37; + let x_39 : f32 = x_6.x_GLF_uniform_float_values[1]; + c = x_39; + let x_41 : i32 = x_11.x_GLF_uniform_int_values[1]; + i = x_41; + loop { + let x_46 : i32 = i; + let x_48 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_46 < x_48)) { + } else { + break; + } + let x_51 : i32 = i; + let x_53 : i32 = x_11.x_GLF_uniform_int_values[2]; + if ((x_51 == x_53)) { + let x_57 : f32 = a; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[1]; + b = (dpdx(x_57) + x_60); + } + let x_62 : f32 = a; + c = dpdx(x_62); + let x_64 : f32 = c; + let x_65 : f32 = b; + a = (x_64 / x_65); + + continuing { + let x_67 : i32 = i; + i = (x_67 + 1); + } + } + let x_69 : f32 = a; + let x_71 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_69 == x_71)) { + let x_77 : i32 = x_11.x_GLF_uniform_int_values[2]; + let x_80 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_83 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_86 : i32 = x_11.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_77), f32(x_80), f32(x_83), f32(x_86)); + } else { + let x_90 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_91 : f32 = f32(x_90); + x_GLF_color = vec4(x_91, x_91, x_91, x_91); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9c06087533 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.hlsl @@ -0,0 +1,72 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + float b = 0.0f; + float c = 0.0f; + int i = 0; + const float x_35 = asfloat(x_6[1].x); + a = x_35; + const float x_37 = asfloat(x_6[1].x); + b = x_37; + const float x_39 = asfloat(x_6[1].x); + c = x_39; + const int x_41 = asint(x_11[1].x); + i = x_41; + while (true) { + const int x_46 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_48 = asint(x_11[scalar_offset / 4][scalar_offset % 4]); + if ((x_46 < x_48)) { + } else { + break; + } + const int x_51 = i; + const int x_53 = asint(x_11[2].x); + if ((x_51 == x_53)) { + const float x_57 = a; + const float x_60 = asfloat(x_6[1].x); + b = (ddx(x_57) + x_60); + } + c = ddx(a); + a = (c / b); + { + i = (i + 1); + } + } + const float x_69 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_71 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_69 == x_71)) { + const int x_77 = asint(x_11[2].x); + const int x_80 = asint(x_11[1].x); + const int x_83 = asint(x_11[1].x); + const int x_86 = asint(x_11[2].x); + x_GLF_color = float4(float(x_77), float(x_80), float(x_83), float(x_86)); + } else { + const int x_90 = asint(x_11[1].x); + const float x_91 = float(x_90); + x_GLF_color = float4(x_91, x_91, x_91, x_91); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..70485b36b3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_11, thread float4* const tint_symbol_4) { + float a = 0.0f; + float b = 0.0f; + float c = 0.0f; + int i = 0; + float const x_35 = x_6.x_GLF_uniform_float_values.arr[1].el; + a = x_35; + float const x_37 = x_6.x_GLF_uniform_float_values.arr[1].el; + b = x_37; + float const x_39 = x_6.x_GLF_uniform_float_values.arr[1].el; + c = x_39; + int const x_41 = x_11.x_GLF_uniform_int_values.arr[1].el; + i = x_41; + while (true) { + int const x_46 = i; + int const x_48 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_46 < x_48)) { + } else { + break; + } + int const x_51 = i; + int const x_53 = x_11.x_GLF_uniform_int_values.arr[2].el; + if ((x_51 == x_53)) { + float const x_57 = a; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[1].el; + b = (dfdx(x_57) + x_60); + } + float const x_62 = a; + c = dfdx(x_62); + float const x_64 = c; + float const x_65 = b; + a = (x_64 / x_65); + { + int const x_67 = i; + i = (x_67 + 1); + } + } + float const x_69 = a; + float const x_71 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_69 == x_71)) { + int const x_77 = x_11.x_GLF_uniform_int_values.arr[2].el; + int const x_80 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_83 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_86 = x_11.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_77), float(x_80), float(x_83), float(x_86)); + } else { + int const x_90 = x_11.x_GLF_uniform_int_values.arr[1].el; + float const x_91 = float(x_90); + *(tint_symbol_4) = float4(x_91, x_91, x_91, x_91); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_11, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4ba110f5de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.spvasm @@ -0,0 +1,185 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %100 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_float Function %26 + %b = OpVariable %_ptr_Function_float Function %26 + %c = OpVariable %_ptr_Function_float Function %26 + %i = OpVariable %_ptr_Function_int Function %31 + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %36 = OpLoad %float %35 + OpStore %a %36 + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %38 = OpLoad %float %37 + OpStore %b %38 + %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %40 = OpLoad %float %39 + OpStore %c %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %43 = OpLoad %int %42 + OpStore %i %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpSLessThan %bool %48 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %55 %56 + %55 = OpLabel + OpBranch %54 + %56 = OpLabel + OpBranch %45 + %54 = OpLabel + %57 = OpLoad %int %i + %59 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_2 + %60 = OpLoad %int %59 + %61 = OpIEqual %bool %57 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpLoad %float %a + %65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %66 = OpLoad %float %65 + %67 = OpDPdx %float %64 + %68 = OpFAdd %float %67 %66 + OpStore %b %68 + OpBranch %62 + %62 = OpLabel + %69 = OpLoad %float %a + %70 = OpDPdx %float %69 + OpStore %c %70 + %71 = OpLoad %float %c + %72 = OpLoad %float %b + %73 = OpFDiv %float %71 %72 + OpStore %a %73 + OpBranch %46 + %46 = OpLabel + %74 = OpLoad %int %i + %75 = OpIAdd %int %74 %int_1 + OpStore %i %75 + OpBranch %44 + %45 = OpLabel + %76 = OpLoad %float %a + %77 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %78 = OpLoad %float %77 + %79 = OpFOrdEqual %bool %76 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + %83 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_2 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_2 + %90 = OpLoad %int %89 + %91 = OpConvertSToF %float %84 + %92 = OpConvertSToF %float %86 + %93 = OpConvertSToF %float %88 + %94 = OpConvertSToF %float %90 + %95 = OpCompositeConstruct %v4float %91 %92 %93 %94 + OpStore %x_GLF_color %95 + OpBranch %80 + %82 = OpLabel + %96 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpConvertSToF %float %97 + %99 = OpCompositeConstruct %v4float %98 %98 %98 %98 + OpStore %x_GLF_color %99 + OpBranch %80 + %80 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %100 +%tint_symbol = OpFunctionParameter %main_out + %104 = OpLabel + %105 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %105 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %107 = OpLabel + %108 = OpFunctionCall %void %main_1 + %110 = OpLoad %v4float %x_GLF_color + %111 = OpCompositeConstruct %main_out %110 + %109 = OpFunctionCall %void %tint_symbol_2 %111 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..52eb93c944 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-dfdx-constant-divide/0-opt.wgsl.expected.wgsl @@ -0,0 +1,84 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var b : f32; + var c : f32; + var i : i32; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = x_35; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[1]; + b = x_37; + let x_39 : f32 = x_6.x_GLF_uniform_float_values[1]; + c = x_39; + let x_41 : i32 = x_11.x_GLF_uniform_int_values[1]; + i = x_41; + loop { + let x_46 : i32 = i; + let x_48 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_46 < x_48)) { + } else { + break; + } + let x_51 : i32 = i; + let x_53 : i32 = x_11.x_GLF_uniform_int_values[2]; + if ((x_51 == x_53)) { + let x_57 : f32 = a; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[1]; + b = (dpdx(x_57) + x_60); + } + let x_62 : f32 = a; + c = dpdx(x_62); + let x_64 : f32 = c; + let x_65 : f32 = b; + a = (x_64 / x_65); + + continuing { + let x_67 : i32 = i; + i = (x_67 + 1); + } + } + let x_69 : f32 = a; + let x_71 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_69 == x_71)) { + let x_77 : i32 = x_11.x_GLF_uniform_int_values[2]; + let x_80 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_83 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_86 : i32 = x_11.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_77), f32(x_80), f32(x_83), f32(x_86)); + } else { + let x_90 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_91 : f32 = f32(x_90); + x_GLF_color = vec4(x_91, x_91, x_91, x_91); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm new file mode 100644 index 0000000000..fcb25ef776 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm @@ -0,0 +1,192 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %m23 "m23" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_int = OpTypePointer Function %int + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %true = OpConstantTrue %bool + %uint_0 = OpConstant %uint 0 + %v3bool = OpTypeVector %bool 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %44 = OpLabel + %m23 = OpVariable %_ptr_Function_mat2v3float Function + %i = OpVariable %_ptr_Function_int Function + %45 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %46 = OpLoad %float %45 + %47 = OpCompositeConstruct %v3float %46 %float_0 %float_0 + %48 = OpCompositeConstruct %v3float %float_0 %46 %float_0 + %49 = OpCompositeConstruct %mat2v3float %47 %48 + OpStore %m23 %49 + OpStore %i %int_1 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %int %i + %55 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %56 = OpLoad %int %55 + %57 = OpSLessThan %bool %54 %56 + OpBranchConditional %57 %58 %51 + %58 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %64 = OpLoad %float %63 + %65 = OpAccessChain %_ptr_Function_float %m23 %60 %62 + %66 = OpLoad %float %65 + %67 = OpFAdd %float %66 %64 + %68 = OpAccessChain %_ptr_Function_float %m23 %60 %62 + OpStore %68 %67 + %69 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %72 = OpLoad %float %71 + %73 = OpFOrdLessThan %bool %70 %72 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %74 + %75 = OpLabel + OpBranch %74 + %74 = OpLabel + OpSelectionMerge %76 None + OpBranchConditional %true %77 %76 + %77 = OpLabel + %78 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %79 = OpLoad %float %78 + %80 = OpFOrdLessThan %bool %79 %float_0 + OpBranch %76 + %76 = OpLabel + %81 = OpPhi %bool %true %74 %80 %77 + %82 = OpLogicalNot %bool %81 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + OpBranch %51 + %83 = OpLabel + OpBranch %52 + %52 = OpLabel + %85 = OpLoad %int %i + %86 = OpIAdd %int %85 %int_1 + OpStore %i %86 + OpBranch %50 + %51 = OpLabel + %87 = OpLoad %mat2v3float %m23 + %88 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %89 = OpLoad %int %88 + %90 = OpConvertSToF %float %89 + %91 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %92 + %94 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %98 = OpLoad %int %97 + %99 = OpConvertSToF %float %98 + %100 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %101 = OpLoad %int %100 + %102 = OpConvertSToF %float %101 + %103 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %104 = OpLoad %int %103 + %105 = OpConvertSToF %float %104 + %106 = OpCompositeConstruct %v3float %90 %93 %96 + %107 = OpCompositeConstruct %v3float %99 %102 %105 + %108 = OpCompositeConstruct %mat2v3float %106 %107 + %109 = OpCompositeExtract %v3float %87 0 + %110 = OpCompositeExtract %v3float %108 0 + %111 = OpFOrdEqual %v3bool %109 %110 + %112 = OpAll %bool %111 + %113 = OpCompositeExtract %v3float %87 1 + %114 = OpCompositeExtract %v3float %108 1 + %115 = OpFOrdEqual %v3bool %113 %114 + %116 = OpAll %bool %115 + %117 = OpLogicalAnd %bool %112 %116 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %120 + %119 = OpLabel + %121 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %122 = OpLoad %int %121 + %123 = OpConvertSToF %float %122 + %124 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %125 = OpLoad %int %124 + %126 = OpConvertSToF %float %125 + %127 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %128 = OpLoad %int %127 + %129 = OpConvertSToF %float %128 + %130 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %131 = OpLoad %int %130 + %132 = OpConvertSToF %float %131 + %133 = OpCompositeConstruct %v4float %123 %126 %129 %132 + OpStore %_GLF_color %133 + OpBranch %118 + %120 = OpLabel + %134 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %135 = OpLoad %int %134 + %136 = OpConvertSToF %float %135 + %137 = OpCompositeConstruct %v4float %136 %136 %136 %136 + OpStore %_GLF_color %137 + OpBranch %118 + %118 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..a507a03396 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.hlsl @@ -0,0 +1,100 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[4]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x3 m23 = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + const float x_46 = asfloat(x_7[1].x); + m23 = float2x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f)); + i = 1; + while (true) { + bool x_80 = false; + bool x_81_phi = false; + const int x_54 = i; + const int x_56 = asint(x_10[3].x); + if ((x_54 < x_56)) { + } else { + break; + } + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_60 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + const int x_62 = asint(x_10[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_64 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_66 = m23[x_60][x_62]; + set_float3(m23[x_60], x_62, (x_66 + x_64)); + const float x_70 = gl_FragCoord.y; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_72 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_70 < x_72)) { + } + x_81_phi = true; + if (true) { + const float x_79 = gl_FragCoord.x; + x_80 = (x_79 < 0.0f); + x_81_phi = x_80; + } + if (!(x_81_phi)) { + break; + } + { + i = (i + 1); + } + } + const float2x3 x_87 = m23; + const int x_89 = asint(x_10[1].x); + const int x_92 = asint(x_10[1].x); + const int x_95 = asint(x_10[1].x); + const int x_98 = asint(x_10[1].x); + const int x_101 = asint(x_10[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_104 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float2x3 x_108 = float2x3(float3(float(x_89), float(x_92), float(x_95)), float3(float(x_98), float(x_101), float(x_104))); + bool tint_tmp = all((x_87[0u] == x_108[0u])); + if (tint_tmp) { + tint_tmp = all((x_87[1u] == x_108[1u])); + } + if ((tint_tmp)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_122 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const int x_125 = asint(x_10[1].x); + const int x_128 = asint(x_10[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_131 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(float(x_122), float(x_125), float(x_128), float(x_131)); + } else { + const int x_135 = asint(x_10[1].x); + const float x_136 = float(x_135); + x_GLF_color = float4(x_136, x_136, x_136, x_136); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..6b34014f16 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.msl @@ -0,0 +1,101 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_10, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2x3 m23 = float2x3(0.0f); + int i = 0; + float const x_46 = x_7.x_GLF_uniform_float_values.arr[1].el; + m23 = float2x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f)); + i = 1; + while (true) { + bool x_80 = false; + bool x_81_phi = false; + int const x_54 = i; + int const x_56 = x_10.x_GLF_uniform_int_values.arr[3].el; + if ((x_54 < x_56)) { + } else { + break; + } + int const x_60 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_62 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_64 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_66 = m23[x_60][x_62]; + m23[x_60][x_62] = (x_66 + x_64); + float const x_70 = (*(tint_symbol_5)).y; + float const x_72 = x_7.x_GLF_uniform_float_values.arr[0].el; + if ((x_70 < x_72)) { + } + x_81_phi = true; + if (true) { + float const x_79 = (*(tint_symbol_5)).x; + x_80 = (x_79 < 0.0f); + x_81_phi = x_80; + } + bool const x_81 = x_81_phi; + if (!(x_81)) { + break; + } + { + int const x_85 = i; + i = (x_85 + 1); + } + } + float2x3 const x_87 = m23; + int const x_89 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_92 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_95 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_98 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_101 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_104 = x_10.x_GLF_uniform_int_values.arr[0].el; + float2x3 const x_108 = float2x3(float3(float(x_89), float(x_92), float(x_95)), float3(float(x_98), float(x_101), float(x_104))); + if ((all((x_87[0u] == x_108[0u])) && all((x_87[1u] == x_108[1u])))) { + int const x_122 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_125 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_128 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_131 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_122), float(x_125), float(x_128), float(x_131)); + } else { + int const x_135 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_136 = float(x_135); + *(tint_symbol_6) = float4(x_136, x_136, x_136, x_136); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_7 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_10, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..c421db83b7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.spvasm @@ -0,0 +1,249 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 164 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %m23 "m23" + OpName %i "i" + OpName %x_80 "x_80" + OpName %x_81_phi "x_81_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %31 = OpConstantNull %mat2v3float +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %51 = OpConstantNull %bool + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %true = OpConstantTrue %bool + %v3bool = OpTypeVector %bool 3 + %main_out = OpTypeStruct %v4float + %151 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %m23 = OpVariable %_ptr_Function_mat2v3float Function %31 + %i = OpVariable %_ptr_Function_int Function %34 + %x_80 = OpVariable %_ptr_Function_bool Function %51 + %x_81_phi = OpVariable %_ptr_Function_bool Function %51 + %38 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %39 = OpLoad %float %38 + %41 = OpCompositeConstruct %v3float %39 %float_0 %float_0 + %42 = OpCompositeConstruct %v3float %float_0 %39 %float_0 + %43 = OpCompositeConstruct %mat2v3float %41 %42 + OpStore %m23 %43 + OpStore %i %int_1 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %53 = OpLoad %int %i + %56 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %57 = OpLoad %int %56 + %58 = OpSLessThan %bool %53 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + OpBranch %59 + %61 = OpLabel + OpBranch %45 + %59 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %64 = OpLoad %int %63 + %66 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %69 = OpLoad %float %68 + %71 = OpAccessChain %_ptr_Function_float %m23 %64 %67 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Function_float %m23 %64 %67 + %74 = OpFAdd %float %72 %69 + OpStore %73 %74 + %77 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %78 = OpLoad %float %77 + %79 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %80 = OpLoad %float %79 + %81 = OpFOrdLessThan %bool %78 %80 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %82 + %83 = OpLabel + OpBranch %82 + %82 = OpLabel + OpStore %x_81_phi %true + OpSelectionMerge %85 None + OpBranchConditional %true %86 %85 + %86 = OpLabel + %87 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %88 = OpLoad %float %87 + %89 = OpFOrdLessThan %bool %88 %float_0 + OpStore %x_80 %89 + %90 = OpLoad %bool %x_80 + OpStore %x_81_phi %90 + OpBranch %85 + %85 = OpLabel + %91 = OpLoad %bool %x_81_phi + %92 = OpLogicalNot %bool %91 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + OpBranch %45 + %93 = OpLabel + OpBranch %46 + %46 = OpLabel + %95 = OpLoad %int %i + %96 = OpIAdd %int %95 %int_1 + OpStore %i %96 + OpBranch %44 + %45 = OpLabel + %97 = OpLoad %mat2v3float %m23 + %98 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %101 = OpLoad %int %100 + %102 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %103 = OpLoad %int %102 + %104 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %99 + %111 = OpConvertSToF %float %101 + %112 = OpConvertSToF %float %103 + %113 = OpCompositeConstruct %v3float %110 %111 %112 + %114 = OpConvertSToF %float %105 + %115 = OpConvertSToF %float %107 + %116 = OpConvertSToF %float %109 + %117 = OpCompositeConstruct %v3float %114 %115 %116 + %118 = OpCompositeConstruct %mat2v3float %113 %117 + %120 = OpCompositeExtract %v3float %97 0 + %121 = OpCompositeExtract %v3float %118 0 + %122 = OpFOrdEqual %v3bool %120 %121 + %119 = OpAll %bool %122 + OpSelectionMerge %124 None + OpBranchConditional %119 %125 %124 + %125 = OpLabel + %127 = OpCompositeExtract %v3float %97 1 + %128 = OpCompositeExtract %v3float %118 1 + %129 = OpFOrdEqual %v3bool %127 %128 + %126 = OpAll %bool %129 + OpBranch %124 + %124 = OpLabel + %130 = OpPhi %bool %119 %45 %126 %125 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %133 + %132 = OpLabel + %134 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %135 = OpLoad %int %134 + %136 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %137 = OpLoad %int %136 + %138 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %139 = OpLoad %int %138 + %140 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %141 = OpLoad %int %140 + %142 = OpConvertSToF %float %135 + %143 = OpConvertSToF %float %137 + %144 = OpConvertSToF %float %139 + %145 = OpConvertSToF %float %141 + %146 = OpCompositeConstruct %v4float %142 %143 %144 %145 + OpStore %x_GLF_color %146 + OpBranch %131 + %133 = OpLabel + %147 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %148 = OpLoad %int %147 + %149 = OpConvertSToF %float %148 + %150 = OpCompositeConstruct %v4float %149 %149 %149 %149 + OpStore %x_GLF_color %150 + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %151 +%tint_symbol_1 = OpFunctionParameter %main_out + %155 = OpLabel + %156 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %156 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %158 = OpLabel + %159 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %159 + %160 = OpFunctionCall %void %main_1 + %162 = OpLoad %v4float %x_GLF_color + %163 = OpCompositeConstruct %main_out %162 + %161 = OpFunctionCall %void %tint_symbol_3 %163 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b9b8a36473 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.wgsl @@ -0,0 +1,95 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var m23 : mat2x3; + var i : i32; + let x_46 : f32 = x_7.x_GLF_uniform_float_values[1]; + m23 = mat2x3(vec3(x_46, 0.0, 0.0), vec3(0.0, x_46, 0.0)); + i = 1; + loop { + var x_80 : bool; + var x_81_phi : bool; + let x_54 : i32 = i; + let x_56 : i32 = x_10.x_GLF_uniform_int_values[3]; + if ((x_54 < x_56)) { + } else { + break; + } + let x_60 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_64 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_66 : f32 = m23[x_60][x_62]; + m23[x_60][x_62] = (x_66 + x_64); + let x_70 : f32 = gl_FragCoord.y; + let x_72 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_70 < x_72)) { + } + x_81_phi = true; + if (true) { + let x_79 : f32 = gl_FragCoord.x; + x_80 = (x_79 < 0.0); + x_81_phi = x_80; + } + let x_81 : bool = x_81_phi; + if (!(x_81)) { + break; + } + + continuing { + let x_85 : i32 = i; + i = (x_85 + 1); + } + } + let x_87 : mat2x3 = m23; + let x_89 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_92 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_95 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_98 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_101 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_104 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_108 : mat2x3 = mat2x3(vec3(f32(x_89), f32(x_92), f32(x_95)), vec3(f32(x_98), f32(x_101), f32(x_104))); + if ((all((x_87[0u] == x_108[0u])) && all((x_87[1u] == x_108[1u])))) { + let x_122 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_125 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_128 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_131 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_122), f32(x_125), f32(x_128), f32(x_131)); + } else { + let x_135 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_136 : f32 = f32(x_135); + x_GLF_color = vec4(x_136, x_136, x_136, x_136); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl new file mode 100644 index 0000000000..b9b8a36473 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl @@ -0,0 +1,95 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var m23 : mat2x3; + var i : i32; + let x_46 : f32 = x_7.x_GLF_uniform_float_values[1]; + m23 = mat2x3(vec3(x_46, 0.0, 0.0), vec3(0.0, x_46, 0.0)); + i = 1; + loop { + var x_80 : bool; + var x_81_phi : bool; + let x_54 : i32 = i; + let x_56 : i32 = x_10.x_GLF_uniform_int_values[3]; + if ((x_54 < x_56)) { + } else { + break; + } + let x_60 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_64 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_66 : f32 = m23[x_60][x_62]; + m23[x_60][x_62] = (x_66 + x_64); + let x_70 : f32 = gl_FragCoord.y; + let x_72 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_70 < x_72)) { + } + x_81_phi = true; + if (true) { + let x_79 : f32 = gl_FragCoord.x; + x_80 = (x_79 < 0.0); + x_81_phi = x_80; + } + let x_81 : bool = x_81_phi; + if (!(x_81)) { + break; + } + + continuing { + let x_85 : i32 = i; + i = (x_85 + 1); + } + } + let x_87 : mat2x3 = m23; + let x_89 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_92 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_95 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_98 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_101 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_104 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_108 : mat2x3 = mat2x3(vec3(f32(x_89), f32(x_92), f32(x_95)), vec3(f32(x_98), f32(x_101), f32(x_104))); + if ((all((x_87[0u] == x_108[0u])) && all((x_87[1u] == x_108[1u])))) { + let x_122 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_125 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_128 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_131 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_122), f32(x_125), f32(x_128), f32(x_131)); + } else { + let x_135 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_136 : f32 = f32(x_135); + x_GLF_color = vec4(x_136, x_136, x_136, x_136); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..a507a03396 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.hlsl @@ -0,0 +1,100 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[4]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x3 m23 = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + const float x_46 = asfloat(x_7[1].x); + m23 = float2x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f)); + i = 1; + while (true) { + bool x_80 = false; + bool x_81_phi = false; + const int x_54 = i; + const int x_56 = asint(x_10[3].x); + if ((x_54 < x_56)) { + } else { + break; + } + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_60 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + const int x_62 = asint(x_10[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_64 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_66 = m23[x_60][x_62]; + set_float3(m23[x_60], x_62, (x_66 + x_64)); + const float x_70 = gl_FragCoord.y; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_72 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_70 < x_72)) { + } + x_81_phi = true; + if (true) { + const float x_79 = gl_FragCoord.x; + x_80 = (x_79 < 0.0f); + x_81_phi = x_80; + } + if (!(x_81_phi)) { + break; + } + { + i = (i + 1); + } + } + const float2x3 x_87 = m23; + const int x_89 = asint(x_10[1].x); + const int x_92 = asint(x_10[1].x); + const int x_95 = asint(x_10[1].x); + const int x_98 = asint(x_10[1].x); + const int x_101 = asint(x_10[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_104 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float2x3 x_108 = float2x3(float3(float(x_89), float(x_92), float(x_95)), float3(float(x_98), float(x_101), float(x_104))); + bool tint_tmp = all((x_87[0u] == x_108[0u])); + if (tint_tmp) { + tint_tmp = all((x_87[1u] == x_108[1u])); + } + if ((tint_tmp)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_122 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const int x_125 = asint(x_10[1].x); + const int x_128 = asint(x_10[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_131 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(float(x_122), float(x_125), float(x_128), float(x_131)); + } else { + const int x_135 = asint(x_10[1].x); + const float x_136 = float(x_135); + x_GLF_color = float4(x_136, x_136, x_136, x_136); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..6b34014f16 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.msl @@ -0,0 +1,101 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_10, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2x3 m23 = float2x3(0.0f); + int i = 0; + float const x_46 = x_7.x_GLF_uniform_float_values.arr[1].el; + m23 = float2x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f)); + i = 1; + while (true) { + bool x_80 = false; + bool x_81_phi = false; + int const x_54 = i; + int const x_56 = x_10.x_GLF_uniform_int_values.arr[3].el; + if ((x_54 < x_56)) { + } else { + break; + } + int const x_60 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_62 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_64 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_66 = m23[x_60][x_62]; + m23[x_60][x_62] = (x_66 + x_64); + float const x_70 = (*(tint_symbol_5)).y; + float const x_72 = x_7.x_GLF_uniform_float_values.arr[0].el; + if ((x_70 < x_72)) { + } + x_81_phi = true; + if (true) { + float const x_79 = (*(tint_symbol_5)).x; + x_80 = (x_79 < 0.0f); + x_81_phi = x_80; + } + bool const x_81 = x_81_phi; + if (!(x_81)) { + break; + } + { + int const x_85 = i; + i = (x_85 + 1); + } + } + float2x3 const x_87 = m23; + int const x_89 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_92 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_95 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_98 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_101 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_104 = x_10.x_GLF_uniform_int_values.arr[0].el; + float2x3 const x_108 = float2x3(float3(float(x_89), float(x_92), float(x_95)), float3(float(x_98), float(x_101), float(x_104))); + if ((all((x_87[0u] == x_108[0u])) && all((x_87[1u] == x_108[1u])))) { + int const x_122 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_125 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_128 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_131 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_122), float(x_125), float(x_128), float(x_131)); + } else { + int const x_135 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_136 = float(x_135); + *(tint_symbol_6) = float4(x_136, x_136, x_136, x_136); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_7 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_10, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..c421db83b7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.spvasm @@ -0,0 +1,249 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 164 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %m23 "m23" + OpName %i "i" + OpName %x_80 "x_80" + OpName %x_81_phi "x_81_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %31 = OpConstantNull %mat2v3float +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %51 = OpConstantNull %bool + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %true = OpConstantTrue %bool + %v3bool = OpTypeVector %bool 3 + %main_out = OpTypeStruct %v4float + %151 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %m23 = OpVariable %_ptr_Function_mat2v3float Function %31 + %i = OpVariable %_ptr_Function_int Function %34 + %x_80 = OpVariable %_ptr_Function_bool Function %51 + %x_81_phi = OpVariable %_ptr_Function_bool Function %51 + %38 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %39 = OpLoad %float %38 + %41 = OpCompositeConstruct %v3float %39 %float_0 %float_0 + %42 = OpCompositeConstruct %v3float %float_0 %39 %float_0 + %43 = OpCompositeConstruct %mat2v3float %41 %42 + OpStore %m23 %43 + OpStore %i %int_1 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %53 = OpLoad %int %i + %56 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %57 = OpLoad %int %56 + %58 = OpSLessThan %bool %53 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + OpBranch %59 + %61 = OpLabel + OpBranch %45 + %59 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %64 = OpLoad %int %63 + %66 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %69 = OpLoad %float %68 + %71 = OpAccessChain %_ptr_Function_float %m23 %64 %67 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Function_float %m23 %64 %67 + %74 = OpFAdd %float %72 %69 + OpStore %73 %74 + %77 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %78 = OpLoad %float %77 + %79 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %80 = OpLoad %float %79 + %81 = OpFOrdLessThan %bool %78 %80 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %82 + %83 = OpLabel + OpBranch %82 + %82 = OpLabel + OpStore %x_81_phi %true + OpSelectionMerge %85 None + OpBranchConditional %true %86 %85 + %86 = OpLabel + %87 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %88 = OpLoad %float %87 + %89 = OpFOrdLessThan %bool %88 %float_0 + OpStore %x_80 %89 + %90 = OpLoad %bool %x_80 + OpStore %x_81_phi %90 + OpBranch %85 + %85 = OpLabel + %91 = OpLoad %bool %x_81_phi + %92 = OpLogicalNot %bool %91 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + OpBranch %45 + %93 = OpLabel + OpBranch %46 + %46 = OpLabel + %95 = OpLoad %int %i + %96 = OpIAdd %int %95 %int_1 + OpStore %i %96 + OpBranch %44 + %45 = OpLabel + %97 = OpLoad %mat2v3float %m23 + %98 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %101 = OpLoad %int %100 + %102 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %103 = OpLoad %int %102 + %104 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %99 + %111 = OpConvertSToF %float %101 + %112 = OpConvertSToF %float %103 + %113 = OpCompositeConstruct %v3float %110 %111 %112 + %114 = OpConvertSToF %float %105 + %115 = OpConvertSToF %float %107 + %116 = OpConvertSToF %float %109 + %117 = OpCompositeConstruct %v3float %114 %115 %116 + %118 = OpCompositeConstruct %mat2v3float %113 %117 + %120 = OpCompositeExtract %v3float %97 0 + %121 = OpCompositeExtract %v3float %118 0 + %122 = OpFOrdEqual %v3bool %120 %121 + %119 = OpAll %bool %122 + OpSelectionMerge %124 None + OpBranchConditional %119 %125 %124 + %125 = OpLabel + %127 = OpCompositeExtract %v3float %97 1 + %128 = OpCompositeExtract %v3float %118 1 + %129 = OpFOrdEqual %v3bool %127 %128 + %126 = OpAll %bool %129 + OpBranch %124 + %124 = OpLabel + %130 = OpPhi %bool %119 %45 %126 %125 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %133 + %132 = OpLabel + %134 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %135 = OpLoad %int %134 + %136 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %137 = OpLoad %int %136 + %138 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %139 = OpLoad %int %138 + %140 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %141 = OpLoad %int %140 + %142 = OpConvertSToF %float %135 + %143 = OpConvertSToF %float %137 + %144 = OpConvertSToF %float %139 + %145 = OpConvertSToF %float %141 + %146 = OpCompositeConstruct %v4float %142 %143 %144 %145 + OpStore %x_GLF_color %146 + OpBranch %131 + %133 = OpLabel + %147 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %148 = OpLoad %int %147 + %149 = OpConvertSToF %float %148 + %150 = OpCompositeConstruct %v4float %149 %149 %149 %149 + OpStore %x_GLF_color %150 + OpBranch %131 + %131 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %151 +%tint_symbol_1 = OpFunctionParameter %main_out + %155 = OpLabel + %156 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %156 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %158 = OpLabel + %159 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %159 + %160 = OpFunctionCall %void %main_1 + %162 = OpLoad %v4float %x_GLF_color + %163 = OpCompositeConstruct %main_out %162 + %161 = OpFunctionCall %void %tint_symbol_3 %163 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b9b8a36473 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.wgsl @@ -0,0 +1,95 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var m23 : mat2x3; + var i : i32; + let x_46 : f32 = x_7.x_GLF_uniform_float_values[1]; + m23 = mat2x3(vec3(x_46, 0.0, 0.0), vec3(0.0, x_46, 0.0)); + i = 1; + loop { + var x_80 : bool; + var x_81_phi : bool; + let x_54 : i32 = i; + let x_56 : i32 = x_10.x_GLF_uniform_int_values[3]; + if ((x_54 < x_56)) { + } else { + break; + } + let x_60 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_64 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_66 : f32 = m23[x_60][x_62]; + m23[x_60][x_62] = (x_66 + x_64); + let x_70 : f32 = gl_FragCoord.y; + let x_72 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_70 < x_72)) { + } + x_81_phi = true; + if (true) { + let x_79 : f32 = gl_FragCoord.x; + x_80 = (x_79 < 0.0); + x_81_phi = x_80; + } + let x_81 : bool = x_81_phi; + if (!(x_81)) { + break; + } + + continuing { + let x_85 : i32 = i; + i = (x_85 + 1); + } + } + let x_87 : mat2x3 = m23; + let x_89 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_92 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_95 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_98 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_101 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_104 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_108 : mat2x3 = mat2x3(vec3(f32(x_89), f32(x_92), f32(x_95)), vec3(f32(x_98), f32(x_101), f32(x_104))); + if ((all((x_87[0u] == x_108[0u])) && all((x_87[1u] == x_108[1u])))) { + let x_122 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_125 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_128 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_131 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_122), f32(x_125), f32(x_128), f32(x_131)); + } else { + let x_135 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_136 : f32 = f32(x_135); + x_GLF_color = vec4(x_136, x_136, x_136, x_136); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm new file mode 100644 index 0000000000..5022161eb9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm @@ -0,0 +1,113 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %25 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %26 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %27 = OpLoad %int %26 + OpStore %a %27 + OpStore %i %int_0 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %int %i + %33 = OpSLessThan %bool %32 %int_3 + OpBranchConditional %33 %34 %29 + %34 = OpLabel + %35 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %37 = OpLoad %int %36 + %38 = OpIEqual %bool %35 %37 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + %42 = OpLoad %int %a + %43 = OpIAdd %int %42 %int_1 + OpStore %a %43 + OpBranch %39 + %41 = OpLabel + %44 = OpLoad %int %a + %45 = OpLoad %int %i + %46 = OpSDiv %int %44 %45 + OpStore %a %46 + OpBranch %39 + %39 = OpLabel + OpBranch %30 + %30 = OpLabel + %47 = OpLoad %int %i + %48 = OpIAdd %int %47 %int_1 + OpStore %i %48 + OpBranch %28 + %29 = OpLabel + %49 = OpLoad %int %a + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %51 = OpLoad %int %50 + %52 = OpIEqual %bool %49 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpConvertSToF %float %63 + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + %68 = OpCompositeConstruct %v4float %58 %61 %64 %67 + OpStore %_GLF_color %68 + OpBranch %53 + %55 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %70 + %72 = OpCompositeConstruct %v4float %71 %71 %71 %71 + OpStore %_GLF_color %72 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..000228a67c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.hlsl @@ -0,0 +1,53 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const int x_27 = asint(x_6[3].x); + a = x_27; + i = 0; + { + for(; (i < 3); i = (i + 1)) { + const int x_35 = i; + const int x_37 = asint(x_6[1].x); + if ((x_35 == x_37)) { + a = (a + 1); + } else { + a = (a / i); + } + } + } + const int x_49 = a; + const int x_51 = asint(x_6[2].x); + if ((x_49 == x_51)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_57 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_60 = asint(x_6[1].x); + const int x_63 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_66 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_57), float(x_60), float(x_63), float(x_66)); + } else { + const int x_70 = asint(x_6[1].x); + const float x_71 = float(x_70); + x_GLF_color = float4(x_71, x_71, x_71, x_71); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..20ea6374ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[3].el; + a = x_27; + i = 0; + while (true) { + int const x_32 = i; + if ((x_32 < 3)) { + } else { + break; + } + int const x_35 = i; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_35 == x_37)) { + int const x_42 = a; + a = (x_42 + 1); + } else { + int const x_44 = a; + int const x_45 = i; + a = (x_44 / x_45); + } + { + int const x_47 = i; + i = (x_47 + 1); + } + } + int const x_49 = a; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_49 == x_51)) { + int const x_57 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_57), float(x_60), float(x_63), float(x_66)); + } else { + int const x_70 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_71 = float(x_70); + *(tint_symbol_4) = float4(x_71, x_71, x_71, x_71); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2c80162b1c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.spvasm @@ -0,0 +1,151 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 91 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %79 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %27 = OpLoad %int %26 + OpStore %a %27 + OpStore %i %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %i + %34 = OpSLessThan %bool %33 %int_3 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %38 + %37 = OpLabel + OpBranch %36 + %38 = OpLabel + OpBranch %30 + %36 = OpLabel + %39 = OpLoad %int %i + %41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpIEqual %bool %39 %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %46 + %45 = OpLabel + %47 = OpLoad %int %a + %48 = OpIAdd %int %47 %int_1 + OpStore %a %48 + OpBranch %44 + %46 = OpLabel + %49 = OpLoad %int %a + %50 = OpLoad %int %i + %51 = OpSDiv %int %49 %50 + OpStore %a %51 + OpBranch %44 + %44 = OpLabel + OpBranch %31 + %31 = OpLabel + %52 = OpLoad %int %i + %53 = OpIAdd %int %52 %int_1 + OpStore %i %53 + OpBranch %29 + %30 = OpLabel + %54 = OpLoad %int %a + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %57 = OpLoad %int %56 + %58 = OpIEqual %bool %54 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %63 + %71 = OpConvertSToF %float %65 + %72 = OpConvertSToF %float %67 + %73 = OpConvertSToF %float %69 + %74 = OpCompositeConstruct %v4float %70 %71 %72 %73 + OpStore %x_GLF_color %74 + OpBranch %59 + %61 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %76 + %78 = OpCompositeConstruct %v4float %77 %77 %77 %77 + OpStore %x_GLF_color %78 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %79 +%tint_symbol = OpFunctionParameter %main_out + %83 = OpLabel + %84 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %84 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %86 = OpLabel + %87 = OpFunctionCall %void %main_1 + %89 = OpLoad %v4float %x_GLF_color + %90 = OpCompositeConstruct %main_out %89 + %88 = OpFunctionCall %void %tint_symbol_2 %90 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5615de99cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[3]; + a = x_27; + i = 0; + loop { + let x_32 : i32 = i; + if ((x_32 < 3)) { + } else { + break; + } + let x_35 : i32 = i; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_35 == x_37)) { + let x_42 : i32 = a; + a = (x_42 + 1); + } else { + let x_44 : i32 = a; + let x_45 : i32 = i; + a = (x_44 / x_45); + } + + continuing { + let x_47 : i32 = i; + i = (x_47 + 1); + } + } + let x_49 : i32 = a; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_49 == x_51)) { + let x_57 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_57), f32(x_60), f32(x_63), f32(x_66)); + } else { + let x_70 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_71 : f32 = f32(x_70); + x_GLF_color = vec4(x_71, x_71, x_71, x_71); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl new file mode 100644 index 0000000000..5615de99cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[3]; + a = x_27; + i = 0; + loop { + let x_32 : i32 = i; + if ((x_32 < 3)) { + } else { + break; + } + let x_35 : i32 = i; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_35 == x_37)) { + let x_42 : i32 = a; + a = (x_42 + 1); + } else { + let x_44 : i32 = a; + let x_45 : i32 = i; + a = (x_44 / x_45); + } + + continuing { + let x_47 : i32 = i; + i = (x_47 + 1); + } + } + let x_49 : i32 = a; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_49 == x_51)) { + let x_57 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_57), f32(x_60), f32(x_63), f32(x_66)); + } else { + let x_70 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_71 : f32 = f32(x_70); + x_GLF_color = vec4(x_71, x_71, x_71, x_71); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..000228a67c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.hlsl @@ -0,0 +1,53 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const int x_27 = asint(x_6[3].x); + a = x_27; + i = 0; + { + for(; (i < 3); i = (i + 1)) { + const int x_35 = i; + const int x_37 = asint(x_6[1].x); + if ((x_35 == x_37)) { + a = (a + 1); + } else { + a = (a / i); + } + } + } + const int x_49 = a; + const int x_51 = asint(x_6[2].x); + if ((x_49 == x_51)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_57 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_60 = asint(x_6[1].x); + const int x_63 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_66 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_57), float(x_60), float(x_63), float(x_66)); + } else { + const int x_70 = asint(x_6[1].x); + const float x_71 = float(x_70); + x_GLF_color = float4(x_71, x_71, x_71, x_71); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..20ea6374ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[3].el; + a = x_27; + i = 0; + while (true) { + int const x_32 = i; + if ((x_32 < 3)) { + } else { + break; + } + int const x_35 = i; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_35 == x_37)) { + int const x_42 = a; + a = (x_42 + 1); + } else { + int const x_44 = a; + int const x_45 = i; + a = (x_44 / x_45); + } + { + int const x_47 = i; + i = (x_47 + 1); + } + } + int const x_49 = a; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_49 == x_51)) { + int const x_57 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_57), float(x_60), float(x_63), float(x_66)); + } else { + int const x_70 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_71 = float(x_70); + *(tint_symbol_4) = float4(x_71, x_71, x_71, x_71); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c80162b1c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.spvasm @@ -0,0 +1,151 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 91 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %79 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %27 = OpLoad %int %26 + OpStore %a %27 + OpStore %i %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %i + %34 = OpSLessThan %bool %33 %int_3 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %38 + %37 = OpLabel + OpBranch %36 + %38 = OpLabel + OpBranch %30 + %36 = OpLabel + %39 = OpLoad %int %i + %41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpIEqual %bool %39 %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %46 + %45 = OpLabel + %47 = OpLoad %int %a + %48 = OpIAdd %int %47 %int_1 + OpStore %a %48 + OpBranch %44 + %46 = OpLabel + %49 = OpLoad %int %a + %50 = OpLoad %int %i + %51 = OpSDiv %int %49 %50 + OpStore %a %51 + OpBranch %44 + %44 = OpLabel + OpBranch %31 + %31 = OpLabel + %52 = OpLoad %int %i + %53 = OpIAdd %int %52 %int_1 + OpStore %i %53 + OpBranch %29 + %30 = OpLabel + %54 = OpLoad %int %a + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %57 = OpLoad %int %56 + %58 = OpIEqual %bool %54 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %63 + %71 = OpConvertSToF %float %65 + %72 = OpConvertSToF %float %67 + %73 = OpConvertSToF %float %69 + %74 = OpCompositeConstruct %v4float %70 %71 %72 %73 + OpStore %x_GLF_color %74 + OpBranch %59 + %61 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %76 + %78 = OpCompositeConstruct %v4float %77 %77 %77 %77 + OpStore %x_GLF_color %78 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %79 +%tint_symbol = OpFunctionParameter %main_out + %83 = OpLabel + %84 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %84 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %86 = OpLabel + %87 = OpFunctionCall %void %main_1 + %89 = OpLoad %v4float %x_GLF_color + %90 = OpCompositeConstruct %main_out %89 + %88 = OpFunctionCall %void %tint_symbol_2 %90 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5615de99cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[3]; + a = x_27; + i = 0; + loop { + let x_32 : i32 = i; + if ((x_32 < 3)) { + } else { + break; + } + let x_35 : i32 = i; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_35 == x_37)) { + let x_42 : i32 = a; + a = (x_42 + 1); + } else { + let x_44 : i32 = a; + let x_45 : i32 = i; + a = (x_44 / x_45); + } + + continuing { + let x_47 : i32 = i; + i = (x_47 + 1); + } + } + let x_49 : i32 = a; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_49 == x_51)) { + let x_57 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_57), f32(x_60), f32(x_63), f32(x_66)); + } else { + let x_70 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_71 : f32 = f32(x_70); + x_GLF_color = vec4(x_71, x_71, x_71, x_71); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm new file mode 100644 index 0000000000..848d96c890 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm @@ -0,0 +1,93 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %9 + %23 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %24 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %25 = OpLoad %int %24 + OpStore %a %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %a + %31 = OpSGreaterThanEqual %bool %30 %int_0 + OpBranchConditional %31 %32 %27 + %32 = OpLabel + %33 = OpLoad %int %a + %34 = OpSDiv %int %33 %int_2 + %35 = OpISub %int %34 %int_1 + OpStore %a %35 + OpBranch %28 + %28 = OpLabel + OpBranch %26 + %27 = OpLabel + %36 = OpLoad %int %a + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpSNegate %int %38 + %40 = OpIEqual %bool %36 %39 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %43 + %42 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %45 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %48 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %51 + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %54 + %56 = OpCompositeConstruct %v4float %46 %49 %52 %55 + OpStore %_GLF_color %56 + OpBranch %41 + %43 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpCompositeConstruct %v4float %59 %59 %59 %59 + OpStore %_GLF_color %60 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..b595c465df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.hlsl @@ -0,0 +1,48 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const int x_25 = asint(x_6[2].x); + a = x_25; + while (true) { + if ((a >= 0)) { + } else { + break; + } + a = ((a / 2) - 1); + } + const int x_36 = a; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_36 == -(x_38))) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_48 = asint(x_6[1].x); + const int x_51 = asint(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + } else { + const int x_58 = asint(x_6[1].x); + const float x_59 = float(x_58); + x_GLF_color = float4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..13329881b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[2].el; + a = x_25; + while (true) { + int const x_30 = a; + if ((x_30 >= 0)) { + } else { + break; + } + int const x_33 = a; + a = ((x_33 / 2) - 1); + } + int const x_36 = a; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_36 == -(x_38))) { + int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_54 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + } else { + int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_59 = float(x_58); + *(tint_symbol_4) = float4(x_59, x_59, x_59, x_59); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..af6b9c998b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.spvasm @@ -0,0 +1,131 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %26 = OpLoad %int %25 + OpStore %a %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %int %a + %33 = OpSGreaterThanEqual %bool %31 %int_0 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %37 + %36 = OpLabel + OpBranch %35 + %37 = OpLabel + OpBranch %28 + %35 = OpLabel + %38 = OpLoad %int %a + %39 = OpSDiv %int %38 %int_2 + %41 = OpISub %int %39 %int_1 + OpStore %a %41 + OpBranch %29 + %29 = OpLabel + OpBranch %27 + %28 = OpLabel + %42 = OpLoad %int %a + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpSNegate %int %44 + %46 = OpIEqual %bool %42 %45 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %51 + %59 = OpConvertSToF %float %53 + %60 = OpConvertSToF %float %55 + %61 = OpConvertSToF %float %57 + %62 = OpCompositeConstruct %v4float %58 %59 %60 %61 + OpStore %x_GLF_color %62 + OpBranch %47 + %49 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %65 %65 %65 %65 + OpStore %x_GLF_color %66 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5a6c993354 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.spvasm.expected.wgsl @@ -0,0 +1,50 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_25; + loop { + let x_30 : i32 = a; + if ((x_30 >= 0)) { + } else { + break; + } + let x_33 : i32 = a; + a = ((x_33 / 2) - 1); + } + let x_36 : i32 = a; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_36 == -(x_38))) { + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_45), f32(x_48), f32(x_51), f32(x_54)); + } else { + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_59 : f32 = f32(x_58); + x_GLF_color = vec4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl new file mode 100644 index 0000000000..5a6c993354 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl @@ -0,0 +1,50 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_25; + loop { + let x_30 : i32 = a; + if ((x_30 >= 0)) { + } else { + break; + } + let x_33 : i32 = a; + a = ((x_33 / 2) - 1); + } + let x_36 : i32 = a; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_36 == -(x_38))) { + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_45), f32(x_48), f32(x_51), f32(x_54)); + } else { + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_59 : f32 = f32(x_58); + x_GLF_color = vec4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..b595c465df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.hlsl @@ -0,0 +1,48 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const int x_25 = asint(x_6[2].x); + a = x_25; + while (true) { + if ((a >= 0)) { + } else { + break; + } + a = ((a / 2) - 1); + } + const int x_36 = a; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_36 == -(x_38))) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_48 = asint(x_6[1].x); + const int x_51 = asint(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + } else { + const int x_58 = asint(x_6[1].x); + const float x_59 = float(x_58); + x_GLF_color = float4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..13329881b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[2].el; + a = x_25; + while (true) { + int const x_30 = a; + if ((x_30 >= 0)) { + } else { + break; + } + int const x_33 = a; + a = ((x_33 / 2) - 1); + } + int const x_36 = a; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_36 == -(x_38))) { + int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_54 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + } else { + int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_59 = float(x_58); + *(tint_symbol_4) = float4(x_59, x_59, x_59, x_59); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..af6b9c998b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.spvasm @@ -0,0 +1,131 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %26 = OpLoad %int %25 + OpStore %a %26 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %int %a + %33 = OpSGreaterThanEqual %bool %31 %int_0 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %37 + %36 = OpLabel + OpBranch %35 + %37 = OpLabel + OpBranch %28 + %35 = OpLabel + %38 = OpLoad %int %a + %39 = OpSDiv %int %38 %int_2 + %41 = OpISub %int %39 %int_1 + OpStore %a %41 + OpBranch %29 + %29 = OpLabel + OpBranch %27 + %28 = OpLabel + %42 = OpLoad %int %a + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpSNegate %int %44 + %46 = OpIEqual %bool %42 %45 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %51 + %59 = OpConvertSToF %float %53 + %60 = OpConvertSToF %float %55 + %61 = OpConvertSToF %float %57 + %62 = OpCompositeConstruct %v4float %58 %59 %60 %61 + OpStore %x_GLF_color %62 + OpBranch %47 + %49 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %65 %65 %65 %65 + OpStore %x_GLF_color %66 + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5a6c993354 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-integer-half-minus-one/0-opt.wgsl.expected.wgsl @@ -0,0 +1,50 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_25; + loop { + let x_30 : i32 = a; + if ((x_30 >= 0)) { + } else { + break; + } + let x_33 : i32 = a; + a = ((x_33 / 2) - 1); + } + let x_36 : i32 = a; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_36 == -(x_38))) { + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_45), f32(x_48), f32(x_51), f32(x_54)); + } else { + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_59 : f32 = f32(x_58); + x_GLF_color = vec4(x_59, x_59, x_59, x_59); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm new file mode 100644 index 0000000000..5fdf9d621e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm @@ -0,0 +1,81 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %main = OpFunction %void None %9 + %24 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %25 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %26 = OpLoad %int %25 + OpStore %a %26 + %27 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %28 = OpLoad %int %27 + %29 = OpConvertSToF %float %28 + %30 = OpCompositeConstruct %v4float %29 %29 %29 %29 + OpStore %_GLF_color %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %36 = OpLoad %int %35 + %37 = OpLoad %int %a + %38 = OpIEqual %bool %36 %37 + %39 = OpLogicalNotEqual %bool %38 %true + OpBranchConditional %39 %40 %32 + %40 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %42 = OpLoad %int %41 + %43 = OpConvertSToF %float %42 + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %45 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %48 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %51 + %53 = OpCompositeConstruct %v4float %43 %46 %49 %52 + OpStore %_GLF_color %53 + OpBranch %32 + %33 = OpLabel + OpBranch %31 + %32 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..31c1ef2b02 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.hlsl @@ -0,0 +1,44 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_26 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + a = x_26; + const int x_28 = asint(x_6[1].x); + const float x_29 = float(x_28); + x_GLF_color = float4(x_29, x_29, x_29, x_29); + while (true) { + const int x_36 = asint(x_6[2].x); + if (((x_36 == a) != true)) { + } else { + break; + } + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_42 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_45 = asint(x_6[1].x); + const int x_48 = asint(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_51 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..ca01da7561 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.msl @@ -0,0 +1,52 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int const x_26 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = x_26; + int const x_28 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_29 = float(x_28); + *(tint_symbol_4) = float4(x_29, x_29, x_29, x_29); + while (true) { + int const x_36 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_37 = a; + if (((x_36 == x_37) != true)) { + } else { + break; + } + int const x_42 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_45 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + break; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f4f6126136 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.spvasm @@ -0,0 +1,119 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %60 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %26 = OpLoad %int %25 + OpStore %a %26 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %29 = OpLoad %int %28 + %30 = OpConvertSToF %float %29 + %31 = OpCompositeConstruct %v4float %30 %30 %30 %30 + OpStore %x_GLF_color %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %38 = OpLoad %int %37 + %39 = OpLoad %int %a + %40 = OpIEqual %bool %38 %39 + %43 = OpLogicalNotEqual %bool %40 %true + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %33 + %44 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %48 + %56 = OpConvertSToF %float %50 + %57 = OpConvertSToF %float %52 + %58 = OpConvertSToF %float %54 + %59 = OpCompositeConstruct %v4float %55 %56 %57 %58 + OpStore %x_GLF_color %59 + OpBranch %33 + %34 = OpLabel + OpBranch %32 + %33 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %60 +%tint_symbol = OpFunctionParameter %main_out + %64 = OpLabel + %65 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %65 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %67 = OpLabel + %68 = OpFunctionCall %void %main_1 + %70 = OpLoad %v4float %x_GLF_color + %71 = OpCompositeConstruct %main_out %70 + %69 = OpFunctionCall %void %tint_symbol_2 %71 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a11c846d70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.spvasm.expected.wgsl @@ -0,0 +1,45 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_26; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_29 : f32 = f32(x_28); + x_GLF_color = vec4(x_29, x_29, x_29, x_29); + loop { + let x_36 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_37 : i32 = a; + if (((x_36 == x_37) != true)) { + } else { + break; + } + let x_42 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_42), f32(x_45), f32(x_48), f32(x_51)); + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl new file mode 100644 index 0000000000..a11c846d70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl @@ -0,0 +1,45 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_26; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_29 : f32 = f32(x_28); + x_GLF_color = vec4(x_29, x_29, x_29, x_29); + loop { + let x_36 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_37 : i32 = a; + if (((x_36 == x_37) != true)) { + } else { + break; + } + let x_42 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_42), f32(x_45), f32(x_48), f32(x_51)); + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..31c1ef2b02 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.hlsl @@ -0,0 +1,44 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_26 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + a = x_26; + const int x_28 = asint(x_6[1].x); + const float x_29 = float(x_28); + x_GLF_color = float4(x_29, x_29, x_29, x_29); + while (true) { + const int x_36 = asint(x_6[2].x); + if (((x_36 == a) != true)) { + } else { + break; + } + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_42 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_45 = asint(x_6[1].x); + const int x_48 = asint(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_51 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..ca01da7561 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.msl @@ -0,0 +1,52 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int const x_26 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = x_26; + int const x_28 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_29 = float(x_28); + *(tint_symbol_4) = float4(x_29, x_29, x_29, x_29); + while (true) { + int const x_36 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_37 = a; + if (((x_36 == x_37) != true)) { + } else { + break; + } + int const x_42 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_45 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_42), float(x_45), float(x_48), float(x_51)); + break; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f4f6126136 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.spvasm @@ -0,0 +1,119 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %60 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %26 = OpLoad %int %25 + OpStore %a %26 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %29 = OpLoad %int %28 + %30 = OpConvertSToF %float %29 + %31 = OpCompositeConstruct %v4float %30 %30 %30 %30 + OpStore %x_GLF_color %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %38 = OpLoad %int %37 + %39 = OpLoad %int %a + %40 = OpIEqual %bool %38 %39 + %43 = OpLogicalNotEqual %bool %40 %true + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %33 + %44 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %48 + %56 = OpConvertSToF %float %50 + %57 = OpConvertSToF %float %52 + %58 = OpConvertSToF %float %54 + %59 = OpCompositeConstruct %v4float %55 %56 %57 %58 + OpStore %x_GLF_color %59 + OpBranch %33 + %34 = OpLabel + OpBranch %32 + %33 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %60 +%tint_symbol = OpFunctionParameter %main_out + %64 = OpLabel + %65 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %65 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %67 = OpLabel + %68 = OpFunctionCall %void %main_1 + %70 = OpLoad %v4float %x_GLF_color + %71 = OpCompositeConstruct %main_out %70 + %69 = OpFunctionCall %void %tint_symbol_2 %71 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a11c846d70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-logical-xor/0-opt.wgsl.expected.wgsl @@ -0,0 +1,45 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = x_26; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_29 : f32 = f32(x_28); + x_GLF_color = vec4(x_29, x_29, x_29, x_29); + loop { + let x_36 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_37 : i32 = a; + if (((x_36 == x_37) != true)) { + } else { + break; + } + let x_42 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_42), f32(x_45), f32(x_48), f32(x_51)); + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm new file mode 100644 index 0000000000..97d37447ef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm @@ -0,0 +1,117 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %_GLF_global_loop_count "_GLF_global_loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int +%_GLF_global_loop_count = OpVariable %_ptr_Private_int Private + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %int_100 = OpConstant %int 100 + %main = OpFunction %void None %9 + %25 = OpLabel + OpStore %_GLF_global_loop_count %int_0 + %26 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %27 = OpLoad %int %26 + OpSelectionMerge %28 None + OpSwitch %27 %28 0 %29 1 %30 + %29 = OpLabel + OpSelectionMerge %31 None + OpBranchConditional %true %32 %31 + %32 = OpLabel + %33 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %34 = OpLoad %int %33 + %35 = OpConvertSToF %float %34 + %36 = OpCompositeConstruct %v4float %35 %35 %35 %35 + OpStore %_GLF_color %36 + OpReturn + %31 = OpLabel + OpBranch %30 + %30 = OpLabel + OpSelectionMerge %37 None + OpBranchConditional %true %38 %37 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %40 = OpLoad %int %39 + %41 = OpConvertSToF %float %40 + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %43 + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %49 + %51 = OpCompositeConstruct %v4float %41 %44 %47 %50 + OpStore %_GLF_color %51 + OpSelectionMerge %52 None + OpBranchConditional %false %53 %52 + %53 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpCompositeConstruct %v4float %56 %56 %56 %56 + OpStore %_GLF_color %57 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %62 = OpLoad %int %_GLF_global_loop_count + %63 = OpIAdd %int %62 %int_1 + OpStore %_GLF_global_loop_count %63 + OpSelectionMerge %64 None + OpBranchConditional %false %65 %64 + %65 = OpLabel + OpReturn + %64 = OpLabel + OpSelectionMerge %66 None + OpBranchConditional %true %67 %66 + %67 = OpLabel + OpReturn + %66 = OpLabel + OpBranch %60 + %60 = OpLabel + %68 = OpLoad %int %_GLF_global_loop_count + %69 = OpSLessThan %bool %68 %int_100 + OpBranchConditional %69 %58 %59 + %59 = OpLabel + OpBranch %52 + %52 = OpLabel + OpBranch %37 + %37 = OpLabel + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f8db992083 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.hlsl @@ -0,0 +1,73 @@ +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + x_GLF_global_loop_count = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_27 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + switch(x_27) { + case 0: { + if (true) { + const int x_34 = asint(x_6[1].x); + const float x_35 = float(x_34); + x_GLF_color = float4(x_35, x_35, x_35, x_35); + return; + } + /* fallthrough */ + } + case 1: { + if (true) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_43 = asint(x_6[1].x); + const int x_46 = asint(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_40), float(x_43), float(x_46), float(x_49)); + if (false) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_56 = float(x_55); + x_GLF_color = float4(x_56, x_56, x_56, x_56); + while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + if (false) { + return; + } + if (true) { + return; + } + { + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + } + } + } + } + break; + } + default: { + break; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..886f813f32 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.msl @@ -0,0 +1,81 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + *(tint_symbol_4) = 0; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[0].el; + switch(x_27) { + case 0: { + if (true) { + int const x_34 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_35 = float(x_34); + *(tint_symbol_5) = float4(x_35, x_35, x_35, x_35); + return; + } + /* fallthrough */ + } + case 1: { + if (true) { + int const x_40 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_49 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_40), float(x_43), float(x_46), float(x_49)); + if (false) { + int const x_55 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_56 = float(x_55); + *(tint_symbol_5) = float4(x_56, x_56, x_56, x_56); + while (true) { + int const x_62 = *(tint_symbol_4); + *(tint_symbol_4) = (x_62 + 1); + if (false) { + return; + } + if (true) { + return; + } + { + int const x_68 = *(tint_symbol_4); + if ((x_68 < 100)) { + } else { + break; + } + } + } + } + } + break; + } + default: { + break; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_6, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..39748f22ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.spvasm @@ -0,0 +1,164 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 90 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %15 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %15 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %int_100 = OpConstant %int 100 + %main_out = OpTypeStruct %v4float + %78 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + OpStore %x_GLF_global_loop_count %int_0 + %25 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %26 = OpLoad %int %25 + OpSelectionMerge %27 None + OpSwitch %26 %28 0 %29 1 %30 + %29 = OpLabel + OpSelectionMerge %33 None + OpBranchConditional %true %34 %33 + %34 = OpLabel + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %37 = OpLoad %int %36 + %38 = OpConvertSToF %float %37 + %39 = OpCompositeConstruct %v4float %38 %38 %38 %38 + OpStore %x_GLF_color %39 + OpReturn + %33 = OpLabel + OpBranch %30 + %30 = OpLabel + OpSelectionMerge %40 None + OpBranchConditional %true %41 %40 + %41 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %43 + %51 = OpConvertSToF %float %45 + %52 = OpConvertSToF %float %47 + %53 = OpConvertSToF %float %49 + %54 = OpCompositeConstruct %v4float %50 %51 %52 %53 + OpStore %x_GLF_color %54 + OpSelectionMerge %56 None + OpBranchConditional %false %57 %56 + %57 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpCompositeConstruct %v4float %60 %60 %60 %60 + OpStore %x_GLF_color %61 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %66 = OpLoad %int %x_GLF_global_loop_count + %67 = OpIAdd %int %66 %int_1 + OpStore %x_GLF_global_loop_count %67 + OpSelectionMerge %68 None + OpBranchConditional %false %69 %68 + %69 = OpLabel + OpReturn + %68 = OpLabel + OpSelectionMerge %70 None + OpBranchConditional %true %71 %70 + %71 = OpLabel + OpReturn + %70 = OpLabel + OpBranch %64 + %64 = OpLabel + %72 = OpLoad %int %x_GLF_global_loop_count + %74 = OpSLessThan %bool %72 %int_100 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpBranch %75 + %77 = OpLabel + OpBranch %63 + %75 = OpLabel + OpBranch %62 + %63 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %40 + %40 = OpLabel + OpBranch %27 + %28 = OpLabel + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %78 +%tint_symbol = OpFunctionParameter %main_out + %82 = OpLabel + %83 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %83 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %85 = OpLabel + %86 = OpFunctionCall %void %main_1 + %88 = OpLoad %v4float %x_GLF_color + %89 = OpCompositeConstruct %main_out %88 + %87 = OpFunctionCall %void %tint_symbol_2 %89 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 64[%64] is not post dominated by the back-edge block 75[%75] + %75 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..7b901c6247 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.wgsl @@ -0,0 +1,74 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + x_GLF_global_loop_count = 0; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[0]; + switch(x_27) { + case 0: { + if (true) { + let x_34 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_35 : f32 = f32(x_34); + x_GLF_color = vec4(x_35, x_35, x_35, x_35); + return; + } + fallthrough; + } + case 1: { + if (true) { + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_40), f32(x_43), f32(x_46), f32(x_49)); + if (false) { + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_56 : f32 = f32(x_55); + x_GLF_color = vec4(x_56, x_56, x_56, x_56); + loop { + let x_62 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_62 + 1); + if (false) { + return; + } + if (true) { + return; + } + + continuing { + let x_68 : i32 = x_GLF_global_loop_count; + if ((x_68 < 100)) { + } else { + break; + } + } + } + } + } + } + default: { + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl new file mode 100644 index 0000000000..7b901c6247 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl @@ -0,0 +1,74 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + x_GLF_global_loop_count = 0; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[0]; + switch(x_27) { + case 0: { + if (true) { + let x_34 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_35 : f32 = f32(x_34); + x_GLF_color = vec4(x_35, x_35, x_35, x_35); + return; + } + fallthrough; + } + case 1: { + if (true) { + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_40), f32(x_43), f32(x_46), f32(x_49)); + if (false) { + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_56 : f32 = f32(x_55); + x_GLF_color = vec4(x_56, x_56, x_56, x_56); + loop { + let x_62 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_62 + 1); + if (false) { + return; + } + if (true) { + return; + } + + continuing { + let x_68 : i32 = x_GLF_global_loop_count; + if ((x_68 < 100)) { + } else { + break; + } + } + } + } + } + } + default: { + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f8db992083 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.hlsl @@ -0,0 +1,73 @@ +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + x_GLF_global_loop_count = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_27 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + switch(x_27) { + case 0: { + if (true) { + const int x_34 = asint(x_6[1].x); + const float x_35 = float(x_34); + x_GLF_color = float4(x_35, x_35, x_35, x_35); + return; + } + /* fallthrough */ + } + case 1: { + if (true) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_43 = asint(x_6[1].x); + const int x_46 = asint(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_40), float(x_43), float(x_46), float(x_49)); + if (false) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_56 = float(x_55); + x_GLF_color = float4(x_56, x_56, x_56, x_56); + while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + if (false) { + return; + } + if (true) { + return; + } + { + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + } + } + } + } + break; + } + default: { + break; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..886f813f32 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.msl @@ -0,0 +1,81 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + *(tint_symbol_4) = 0; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[0].el; + switch(x_27) { + case 0: { + if (true) { + int const x_34 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_35 = float(x_34); + *(tint_symbol_5) = float4(x_35, x_35, x_35, x_35); + return; + } + /* fallthrough */ + } + case 1: { + if (true) { + int const x_40 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_49 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_40), float(x_43), float(x_46), float(x_49)); + if (false) { + int const x_55 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_56 = float(x_55); + *(tint_symbol_5) = float4(x_56, x_56, x_56, x_56); + while (true) { + int const x_62 = *(tint_symbol_4); + *(tint_symbol_4) = (x_62 + 1); + if (false) { + return; + } + if (true) { + return; + } + { + int const x_68 = *(tint_symbol_4); + if ((x_68 < 100)) { + } else { + break; + } + } + } + } + } + break; + } + default: { + break; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_6, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..39748f22ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.spvasm @@ -0,0 +1,164 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 90 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %15 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %15 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %int_100 = OpConstant %int 100 + %main_out = OpTypeStruct %v4float + %78 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + OpStore %x_GLF_global_loop_count %int_0 + %25 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %26 = OpLoad %int %25 + OpSelectionMerge %27 None + OpSwitch %26 %28 0 %29 1 %30 + %29 = OpLabel + OpSelectionMerge %33 None + OpBranchConditional %true %34 %33 + %34 = OpLabel + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %37 = OpLoad %int %36 + %38 = OpConvertSToF %float %37 + %39 = OpCompositeConstruct %v4float %38 %38 %38 %38 + OpStore %x_GLF_color %39 + OpReturn + %33 = OpLabel + OpBranch %30 + %30 = OpLabel + OpSelectionMerge %40 None + OpBranchConditional %true %41 %40 + %41 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %43 + %51 = OpConvertSToF %float %45 + %52 = OpConvertSToF %float %47 + %53 = OpConvertSToF %float %49 + %54 = OpCompositeConstruct %v4float %50 %51 %52 %53 + OpStore %x_GLF_color %54 + OpSelectionMerge %56 None + OpBranchConditional %false %57 %56 + %57 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpCompositeConstruct %v4float %60 %60 %60 %60 + OpStore %x_GLF_color %61 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %66 = OpLoad %int %x_GLF_global_loop_count + %67 = OpIAdd %int %66 %int_1 + OpStore %x_GLF_global_loop_count %67 + OpSelectionMerge %68 None + OpBranchConditional %false %69 %68 + %69 = OpLabel + OpReturn + %68 = OpLabel + OpSelectionMerge %70 None + OpBranchConditional %true %71 %70 + %71 = OpLabel + OpReturn + %70 = OpLabel + OpBranch %64 + %64 = OpLabel + %72 = OpLoad %int %x_GLF_global_loop_count + %74 = OpSLessThan %bool %72 %int_100 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpBranch %75 + %77 = OpLabel + OpBranch %63 + %75 = OpLabel + OpBranch %62 + %63 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %40 + %40 = OpLabel + OpBranch %27 + %28 = OpLabel + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %78 +%tint_symbol = OpFunctionParameter %main_out + %82 = OpLabel + %83 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %83 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %85 = OpLabel + %86 = OpFunctionCall %void %main_1 + %88 = OpLoad %v4float %x_GLF_color + %89 = OpCompositeConstruct %main_out %88 + %87 = OpFunctionCall %void %tint_symbol_2 %89 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 64[%64] is not post dominated by the back-edge block 75[%75] + %75 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..7b901c6247 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.wgsl @@ -0,0 +1,74 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + x_GLF_global_loop_count = 0; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[0]; + switch(x_27) { + case 0: { + if (true) { + let x_34 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_35 : f32 = f32(x_34); + x_GLF_color = vec4(x_35, x_35, x_35, x_35); + return; + } + fallthrough; + } + case 1: { + if (true) { + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_40), f32(x_43), f32(x_46), f32(x_49)); + if (false) { + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_56 : f32 = f32(x_55); + x_GLF_color = vec4(x_56, x_56, x_56, x_56); + loop { + let x_62 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_62 + 1); + if (false) { + return; + } + if (true) { + return; + } + + continuing { + let x_68 : i32 = x_GLF_global_loop_count; + if ((x_68 < 100)) { + } else { + break; + } + } + } + } + } + } + default: { + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm new file mode 100644 index 0000000000..eb76d7ee74 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm @@ -0,0 +1,159 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %arr "arr" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %j "j" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 +%_ptr_Function__arr_float_uint_5 = OpTypePointer Function %_arr_float_uint_5 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_n1 = OpConstant %int -1 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_2 = OpConstant %float 2 + %main = OpFunction %void None %14 + %36 = OpLabel + %arr = OpVariable %_ptr_Function__arr_float_uint_5 Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %37 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %46 = OpLoad %float %45 + %47 = OpCompositeConstruct %_arr_float_uint_5 %38 %40 %42 %44 %46 + OpStore %arr %47 + %48 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %49 = OpLoad %int %48 + OpStore %i %49 + OpStore %j %int_0 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %int %i + %55 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpSLessThan %bool %54 %56 + OpBranchConditional %57 %58 %51 + %58 = OpLabel + %59 = OpLoad %int %j + %60 = OpSLessThan %bool %59 %int_n1 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpBranch %51 + %61 = OpLabel + %63 = OpLoad %int %j + %64 = OpAccessChain %_ptr_Function_float %arr %63 + %65 = OpLoad %float %64 + %66 = OpFAdd %float %65 %float_1 + %67 = OpAccessChain %_ptr_Function_float %arr %63 + OpStore %67 %66 + OpBranch %52 + %52 = OpLabel + %68 = OpLoad %int %i + %69 = OpIAdd %int %68 %int_1 + OpStore %i %69 + %70 = OpLoad %int %j + %71 = OpIAdd %int %70 %int_1 + OpStore %j %71 + OpBranch %50 + %51 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %79 = OpLoad %float %78 + %80 = OpCompositeConstruct %v4float %73 %75 %77 %79 + OpStore %_GLF_color %80 + %81 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %82 = OpLoad %int %81 + OpStore %i %82 + OpBranch %83 + %83 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + %87 = OpLoad %int %i + %88 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %89 = OpLoad %int %88 + %90 = OpSLessThan %bool %87 %89 + OpBranchConditional %90 %91 %84 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpAccessChain %_ptr_Function_float %arr %92 + %94 = OpLoad %float %93 + %95 = OpFUnordNotEqual %bool %94 %float_2 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %96 + %97 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %99 = OpLoad %float %98 + %100 = OpCompositeConstruct %v4float %99 %99 %99 %99 + OpStore %_GLF_color %100 + OpBranch %96 + %96 = OpLabel + OpBranch %85 + %85 = OpLabel + %101 = OpLoad %int %i + %102 = OpIAdd %int %101 %int_1 + OpStore %i %102 + OpBranch %83 + %84 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..073d5f23b4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.hlsl @@ -0,0 +1,88 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float arr[5] = (float[5])0; + int i = 0; + int j = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_38 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_42 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_46 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float tint_symbol_4[5] = {x_38, x_40, x_42, x_44, x_46}; + arr = tint_symbol_4; + const int x_49 = asint(x_9[1].x); + i = x_49; + j = 0; + while (true) { + const int x_54 = i; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_9[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_54 < x_56)) { + } else { + break; + } + if ((j < -1)) { + break; + } + const int x_63 = j; + const float x_65 = arr[x_63]; + arr[x_63] = (x_65 + 1.0f); + { + i = (i + 1); + j = (j + 1); + } + } + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const float x_73 = asfloat(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_75 = asfloat(x_6[1].x); + const float x_77 = asfloat(x_6[1].x); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const float x_79 = asfloat(x_6[scalar_offset_7 / 4][scalar_offset_7 % 4]); + x_GLF_color = float4(x_73, x_75, x_77, x_79); + const int x_82 = asint(x_9[1].x); + i = x_82; + while (true) { + const int x_87 = i; + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_89 = asint(x_9[scalar_offset_8 / 4][scalar_offset_8 % 4]); + if ((x_87 < x_89)) { + } else { + break; + } + const float x_94 = arr[i]; + if (!((x_94 == 2.0f))) { + const float x_99 = asfloat(x_6[1].x); + x_GLF_color = float4(x_99, x_99, x_99, x_99); + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..ec7cae1ee1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.msl @@ -0,0 +1,104 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[5]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5) { + tint_array_wrapper_2 arr = {}; + int i = 0; + int j = 0; + float const x_38 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_40 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_46 = x_6.x_GLF_uniform_float_values.arr[0].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_38, x_40, x_42, x_44, x_46}}; + arr = tint_symbol_3; + int const x_49 = x_9.x_GLF_uniform_int_values.arr[1].el; + i = x_49; + j = 0; + while (true) { + int const x_54 = i; + int const x_56 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_54 < x_56)) { + } else { + break; + } + int const x_59 = j; + if ((x_59 < -1)) { + break; + } + int const x_63 = j; + float const x_65 = arr.arr[x_63]; + arr.arr[x_63] = (x_65 + 1.0f); + { + int const x_68 = i; + i = (x_68 + 1); + int const x_70 = j; + j = (x_70 + 1); + } + } + float const x_73 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_75 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_77 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_79 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_5) = float4(x_73, x_75, x_77, x_79); + int const x_82 = x_9.x_GLF_uniform_int_values.arr[1].el; + i = x_82; + while (true) { + int const x_87 = i; + int const x_89 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_87 < x_89)) { + } else { + break; + } + int const x_92 = i; + float const x_94 = arr.arr[x_92]; + if (!((x_94 == 2.0f))) { + float const x_99 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_5) = float4(x_99, x_99, x_99, x_99); + } + { + int const x_101 = i; + i = (x_101 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..193f5f4386 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.spvasm @@ -0,0 +1,206 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 125 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %arr "arr" + OpName %i "i" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_5 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 +%_ptr_Function__arr_float_uint_5 = OpTypePointer Function %_arr_float_uint_5 + %27 = OpConstantNull %_arr_float_uint_5 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_n1 = OpConstant %int -1 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %main_out = OpTypeStruct %v4float + %113 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %arr = OpVariable %_ptr_Function__arr_float_uint_5 Function %27 + %i = OpVariable %_ptr_Function_int Function %30 + %j = OpVariable %_ptr_Function_int Function %30 + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %36 = OpLoad %float %35 + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpCompositeConstruct %_arr_float_uint_5 %36 %38 %40 %42 %44 + OpStore %arr %45 + %48 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %49 = OpLoad %int %48 + OpStore %i %49 + OpStore %j %int_0 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %int %i + %55 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpSLessThan %bool %54 %56 + OpSelectionMerge %59 None + OpBranchConditional %57 %60 %61 + %60 = OpLabel + OpBranch %59 + %61 = OpLabel + OpBranch %51 + %59 = OpLabel + %62 = OpLoad %int %j + %64 = OpSLessThan %bool %62 %int_n1 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + OpBranch %51 + %65 = OpLabel + %67 = OpLoad %int %j + %69 = OpAccessChain %_ptr_Function_float %arr %67 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Function_float %arr %67 + %73 = OpFAdd %float %70 %float_1 + OpStore %71 %73 + OpBranch %52 + %52 = OpLabel + %74 = OpLoad %int %i + %75 = OpIAdd %int %74 %int_1 + OpStore %i %75 + %76 = OpLoad %int %j + %77 = OpIAdd %int %76 %int_1 + OpStore %j %77 + OpBranch %50 + %51 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %83 = OpLoad %float %82 + %84 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %85 = OpLoad %float %84 + %86 = OpCompositeConstruct %v4float %79 %81 %83 %85 + OpStore %x_GLF_color %86 + %87 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %88 = OpLoad %int %87 + OpStore %i %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %90 %91 None + OpBranch %92 + %92 = OpLabel + %93 = OpLoad %int %i + %94 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %95 = OpLoad %int %94 + %96 = OpSLessThan %bool %93 %95 + OpSelectionMerge %97 None + OpBranchConditional %96 %98 %99 + %98 = OpLabel + OpBranch %97 + %99 = OpLabel + OpBranch %90 + %97 = OpLabel + %100 = OpLoad %int %i + %101 = OpAccessChain %_ptr_Function_float %arr %100 + %102 = OpLoad %float %101 + %105 = OpFOrdEqual %bool %102 %float_2 + %103 = OpLogicalNot %bool %105 + OpSelectionMerge %106 None + OpBranchConditional %103 %107 %106 + %107 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %109 = OpLoad %float %108 + %110 = OpCompositeConstruct %v4float %109 %109 %109 %109 + OpStore %x_GLF_color %110 + OpBranch %106 + %106 = OpLabel + OpBranch %91 + %91 = OpLabel + %111 = OpLoad %int %i + %112 = OpIAdd %int %111 %int_1 + OpStore %i %112 + OpBranch %89 + %90 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %113 +%tint_symbol = OpFunctionParameter %main_out + %117 = OpLabel + %118 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %118 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %120 = OpLabel + %121 = OpFunctionCall %void %main_1 + %123 = OpLoad %v4float %x_GLF_color + %124 = OpCompositeConstruct %main_out %123 + %122 = OpFunctionCall %void %tint_symbol_2 %124 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..9bd8ed5413 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.spvasm.expected.wgsl @@ -0,0 +1,94 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var i : i32; + var j : i32; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_46 : f32 = x_6.x_GLF_uniform_float_values[0]; + arr = array(x_38, x_40, x_42, x_44, x_46); + let x_49 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_49; + j = 0; + loop { + let x_54 : i32 = i; + let x_56 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_54 < x_56)) { + } else { + break; + } + let x_59 : i32 = j; + if ((x_59 < -1)) { + break; + } + let x_63 : i32 = j; + let x_65 : f32 = arr[x_63]; + arr[x_63] = (x_65 + 1.0); + + continuing { + let x_68 : i32 = i; + i = (x_68 + 1); + let x_70 : i32 = j; + j = (x_70 + 1); + } + } + let x_73 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_75 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_77 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_79 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_73, x_75, x_77, x_79); + let x_82 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_82; + loop { + let x_87 : i32 = i; + let x_89 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_87 < x_89)) { + } else { + break; + } + let x_92 : i32 = i; + let x_94 : f32 = arr[x_92]; + if (!((x_94 == 2.0))) { + let x_99 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_99, x_99, x_99, x_99); + } + + continuing { + let x_101 : i32 = i; + i = (x_101 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl new file mode 100644 index 0000000000..9bd8ed5413 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl @@ -0,0 +1,94 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var i : i32; + var j : i32; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_46 : f32 = x_6.x_GLF_uniform_float_values[0]; + arr = array(x_38, x_40, x_42, x_44, x_46); + let x_49 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_49; + j = 0; + loop { + let x_54 : i32 = i; + let x_56 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_54 < x_56)) { + } else { + break; + } + let x_59 : i32 = j; + if ((x_59 < -1)) { + break; + } + let x_63 : i32 = j; + let x_65 : f32 = arr[x_63]; + arr[x_63] = (x_65 + 1.0); + + continuing { + let x_68 : i32 = i; + i = (x_68 + 1); + let x_70 : i32 = j; + j = (x_70 + 1); + } + } + let x_73 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_75 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_77 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_79 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_73, x_75, x_77, x_79); + let x_82 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_82; + loop { + let x_87 : i32 = i; + let x_89 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_87 < x_89)) { + } else { + break; + } + let x_92 : i32 = i; + let x_94 : f32 = arr[x_92]; + if (!((x_94 == 2.0))) { + let x_99 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_99, x_99, x_99, x_99); + } + + continuing { + let x_101 : i32 = i; + i = (x_101 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..073d5f23b4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.hlsl @@ -0,0 +1,88 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float arr[5] = (float[5])0; + int i = 0; + int j = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_38 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_42 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_46 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float tint_symbol_4[5] = {x_38, x_40, x_42, x_44, x_46}; + arr = tint_symbol_4; + const int x_49 = asint(x_9[1].x); + i = x_49; + j = 0; + while (true) { + const int x_54 = i; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_9[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_54 < x_56)) { + } else { + break; + } + if ((j < -1)) { + break; + } + const int x_63 = j; + const float x_65 = arr[x_63]; + arr[x_63] = (x_65 + 1.0f); + { + i = (i + 1); + j = (j + 1); + } + } + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const float x_73 = asfloat(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_75 = asfloat(x_6[1].x); + const float x_77 = asfloat(x_6[1].x); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const float x_79 = asfloat(x_6[scalar_offset_7 / 4][scalar_offset_7 % 4]); + x_GLF_color = float4(x_73, x_75, x_77, x_79); + const int x_82 = asint(x_9[1].x); + i = x_82; + while (true) { + const int x_87 = i; + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_89 = asint(x_9[scalar_offset_8 / 4][scalar_offset_8 % 4]); + if ((x_87 < x_89)) { + } else { + break; + } + const float x_94 = arr[i]; + if (!((x_94 == 2.0f))) { + const float x_99 = asfloat(x_6[1].x); + x_GLF_color = float4(x_99, x_99, x_99, x_99); + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..ec7cae1ee1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.msl @@ -0,0 +1,104 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[5]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5) { + tint_array_wrapper_2 arr = {}; + int i = 0; + int j = 0; + float const x_38 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_40 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_46 = x_6.x_GLF_uniform_float_values.arr[0].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_38, x_40, x_42, x_44, x_46}}; + arr = tint_symbol_3; + int const x_49 = x_9.x_GLF_uniform_int_values.arr[1].el; + i = x_49; + j = 0; + while (true) { + int const x_54 = i; + int const x_56 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_54 < x_56)) { + } else { + break; + } + int const x_59 = j; + if ((x_59 < -1)) { + break; + } + int const x_63 = j; + float const x_65 = arr.arr[x_63]; + arr.arr[x_63] = (x_65 + 1.0f); + { + int const x_68 = i; + i = (x_68 + 1); + int const x_70 = j; + j = (x_70 + 1); + } + } + float const x_73 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_75 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_77 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_79 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_5) = float4(x_73, x_75, x_77, x_79); + int const x_82 = x_9.x_GLF_uniform_int_values.arr[1].el; + i = x_82; + while (true) { + int const x_87 = i; + int const x_89 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_87 < x_89)) { + } else { + break; + } + int const x_92 = i; + float const x_94 = arr.arr[x_92]; + if (!((x_94 == 2.0f))) { + float const x_99 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_5) = float4(x_99, x_99, x_99, x_99); + } + { + int const x_101 = i; + i = (x_101 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..193f5f4386 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.spvasm @@ -0,0 +1,206 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 125 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %arr "arr" + OpName %i "i" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_5 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 +%_ptr_Function__arr_float_uint_5 = OpTypePointer Function %_arr_float_uint_5 + %27 = OpConstantNull %_arr_float_uint_5 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_n1 = OpConstant %int -1 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %main_out = OpTypeStruct %v4float + %113 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %arr = OpVariable %_ptr_Function__arr_float_uint_5 Function %27 + %i = OpVariable %_ptr_Function_int Function %30 + %j = OpVariable %_ptr_Function_int Function %30 + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %36 = OpLoad %float %35 + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpCompositeConstruct %_arr_float_uint_5 %36 %38 %40 %42 %44 + OpStore %arr %45 + %48 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %49 = OpLoad %int %48 + OpStore %i %49 + OpStore %j %int_0 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %int %i + %55 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpSLessThan %bool %54 %56 + OpSelectionMerge %59 None + OpBranchConditional %57 %60 %61 + %60 = OpLabel + OpBranch %59 + %61 = OpLabel + OpBranch %51 + %59 = OpLabel + %62 = OpLoad %int %j + %64 = OpSLessThan %bool %62 %int_n1 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + OpBranch %51 + %65 = OpLabel + %67 = OpLoad %int %j + %69 = OpAccessChain %_ptr_Function_float %arr %67 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Function_float %arr %67 + %73 = OpFAdd %float %70 %float_1 + OpStore %71 %73 + OpBranch %52 + %52 = OpLabel + %74 = OpLoad %int %i + %75 = OpIAdd %int %74 %int_1 + OpStore %i %75 + %76 = OpLoad %int %j + %77 = OpIAdd %int %76 %int_1 + OpStore %j %77 + OpBranch %50 + %51 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %83 = OpLoad %float %82 + %84 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %85 = OpLoad %float %84 + %86 = OpCompositeConstruct %v4float %79 %81 %83 %85 + OpStore %x_GLF_color %86 + %87 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %88 = OpLoad %int %87 + OpStore %i %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %90 %91 None + OpBranch %92 + %92 = OpLabel + %93 = OpLoad %int %i + %94 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %95 = OpLoad %int %94 + %96 = OpSLessThan %bool %93 %95 + OpSelectionMerge %97 None + OpBranchConditional %96 %98 %99 + %98 = OpLabel + OpBranch %97 + %99 = OpLabel + OpBranch %90 + %97 = OpLabel + %100 = OpLoad %int %i + %101 = OpAccessChain %_ptr_Function_float %arr %100 + %102 = OpLoad %float %101 + %105 = OpFOrdEqual %bool %102 %float_2 + %103 = OpLogicalNot %bool %105 + OpSelectionMerge %106 None + OpBranchConditional %103 %107 %106 + %107 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %109 = OpLoad %float %108 + %110 = OpCompositeConstruct %v4float %109 %109 %109 %109 + OpStore %x_GLF_color %110 + OpBranch %106 + %106 = OpLabel + OpBranch %91 + %91 = OpLabel + %111 = OpLoad %int %i + %112 = OpIAdd %int %111 %int_1 + OpStore %i %112 + OpBranch %89 + %90 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %113 +%tint_symbol = OpFunctionParameter %main_out + %117 = OpLabel + %118 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %118 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %120 = OpLabel + %121 = OpFunctionCall %void %main_1 + %123 = OpLoad %v4float %x_GLF_color + %124 = OpCompositeConstruct %main_out %123 + %122 = OpFunctionCall %void %tint_symbol_2 %124 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..9bd8ed5413 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-with-two-integers/0-opt.wgsl.expected.wgsl @@ -0,0 +1,94 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var arr : array; + var i : i32; + var j : i32; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_46 : f32 = x_6.x_GLF_uniform_float_values[0]; + arr = array(x_38, x_40, x_42, x_44, x_46); + let x_49 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_49; + j = 0; + loop { + let x_54 : i32 = i; + let x_56 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_54 < x_56)) { + } else { + break; + } + let x_59 : i32 = j; + if ((x_59 < -1)) { + break; + } + let x_63 : i32 = j; + let x_65 : f32 = arr[x_63]; + arr[x_63] = (x_65 + 1.0); + + continuing { + let x_68 : i32 = i; + i = (x_68 + 1); + let x_70 : i32 = j; + j = (x_70 + 1); + } + } + let x_73 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_75 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_77 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_79 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_73, x_75, x_77, x_79); + let x_82 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_82; + loop { + let x_87 : i32 = i; + let x_89 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_87 < x_89)) { + } else { + break; + } + let x_92 : i32 = i; + let x_94 : f32 = arr[x_92]; + if (!((x_94 == 2.0))) { + let x_99 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_99, x_99, x_99, x_99); + } + + continuing { + let x_101 : i32 = i; + i = (x_101 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm new file mode 100644 index 0000000000..d31c1e4598 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm @@ -0,0 +1,223 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %data "data" + OpName %a "a" + OpName %i "i" + OpName %j "j" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %i_0 "i" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_6 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_6 = OpConstant %uint 6 +%_arr_int_uint_6 = OpTypeArray %int %uint_6 + %buf1 = OpTypeStruct %_arr_int_uint_6 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 +%_ptr_Function__arr_int_uint_5 = OpTypePointer Function %_arr_int_uint_5 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main = OpFunction %void None %17 + %43 = OpLabel + %data = OpVariable %_ptr_Function__arr_int_uint_5 Function + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %45 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %48 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %51 + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %54 + %56 = OpCompositeConstruct %v4float %46 %49 %52 %55 + OpStore %_GLF_color %56 + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpCompositeConstruct %_arr_int_uint_5 %58 %60 %62 %64 %66 + OpStore %data %67 + %68 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %69 = OpLoad %int %68 + OpStore %a %69 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %int %a + %75 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpSLessThan %bool %74 %76 + OpBranchConditional %77 %78 %71 + %78 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %80 = OpLoad %int %79 + OpStore %i %80 + OpBranch %81 + %81 = OpLabel + OpLoopMerge %82 %83 None + OpBranch %84 + %84 = OpLabel + %85 = OpLoad %int %i + %86 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpSLessThan %bool %85 %87 + OpBranchConditional %88 %89 %82 + %89 = OpLabel + %90 = OpLoad %int %i + OpStore %j %90 + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %j + %96 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpSLessThan %bool %95 %97 + OpBranchConditional %98 %99 %92 + %99 = OpLabel + %100 = OpLoad %int %i + %101 = OpAccessChain %_ptr_Function_int %data %100 + %102 = OpLoad %int %101 + %103 = OpLoad %int %j + %104 = OpAccessChain %_ptr_Function_int %data %103 + %105 = OpLoad %int %104 + %106 = OpSLessThan %bool %102 %105 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %107 + %108 = OpLabel + %109 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %110 = OpLoad %int %109 + %111 = OpConvertSToF %float %110 + %112 = OpCompositeConstruct %v4float %111 %111 %111 %111 + OpStore %_GLF_color %112 + OpBranch %107 + %107 = OpLabel + OpBranch %93 + %93 = OpLabel + %113 = OpLoad %int %j + %114 = OpIAdd %int %113 %int_1 + OpStore %j %114 + OpBranch %91 + %92 = OpLabel + OpBranch %83 + %83 = OpLabel + %115 = OpLoad %int %i + %116 = OpIAdd %int %115 %int_1 + OpStore %i %116 + OpBranch %81 + %82 = OpLabel + OpBranch %72 + %72 = OpLabel + %117 = OpLoad %int %a + %118 = OpIAdd %int %117 %int_1 + OpStore %a %118 + OpBranch %70 + %71 = OpLabel + OpBranch %119 + %119 = OpLabel + OpLoopMerge %120 %121 None + OpBranch %122 + %122 = OpLabel + %123 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %124 = OpLoad %float %123 + %125 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %126 = OpLoad %float %125 + %127 = OpFOrdLessThan %bool %124 %126 + OpBranchConditional %127 %128 %120 + %128 = OpLabel + %129 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %130 = OpLoad %int %129 + OpStore %i_0 %130 + OpBranch %131 + %131 = OpLabel + OpLoopMerge %132 %133 None + OpBranch %134 + %134 = OpLabel + %135 = OpLoad %int %i_0 + %136 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %137 = OpLoad %int %136 + %138 = OpSLessThan %bool %135 %137 + OpBranchConditional %138 %139 %132 + %139 = OpLabel + %140 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %141 = OpLoad %int %140 + %142 = OpConvertSToF %float %141 + %143 = OpCompositeConstruct %v4float %142 %142 %142 %142 + OpStore %_GLF_color %143 + OpBranch %133 + %133 = OpLabel + %144 = OpLoad %int %i_0 + %145 = OpIAdd %int %144 %int_1 + OpStore %i_0 %145 + OpBranch %131 + %132 = OpLabel + OpBranch %121 + %121 = OpLabel + OpBranch %119 + %120 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..e91ca1c9c9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.hlsl @@ -0,0 +1,123 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[6]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[1]; +}; + +void main_1() { + int data[5] = (int[5])0; + int a = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_45 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_48 = asint(x_6[5].x); + const int x_51 = asint(x_6[5].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + const int x_58 = asint(x_6[1].x); + const int x_60 = asint(x_6[2].x); + const int x_62 = asint(x_6[3].x); + const int x_64 = asint(x_6[4].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_66 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int tint_symbol_6[5] = {x_58, x_60, x_62, x_64, x_66}; + data = tint_symbol_6; + const int x_69 = asint(x_6[5].x); + a = x_69; + while (true) { + const int x_74 = a; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_76 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_74 < x_76)) { + } else { + break; + } + const int x_80 = asint(x_6[5].x); + i = x_80; + while (true) { + const int x_85 = i; + const int x_87 = asint(x_6[1].x); + if ((x_85 < x_87)) { + } else { + break; + } + j = i; + while (true) { + const int x_95 = j; + const int x_97 = asint(x_6[1].x); + if ((x_95 < x_97)) { + } else { + break; + } + const int x_102 = data[i]; + const int x_105 = data[j]; + if ((x_102 < x_105)) { + const int x_110 = asint(x_6[5].x); + const float x_111 = float(x_110); + x_GLF_color = float4(x_111, x_111, x_111, x_111); + } + { + j = (j + 1); + } + } + { + i = (i + 1); + } + } + { + a = (a + 1); + } + } + while (true) { + const float x_124 = gl_FragCoord.x; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_126 = asfloat(x_12[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_124 < x_126)) { + } else { + break; + } + const int x_130 = asint(x_6[5].x); + i_1 = x_130; + while (true) { + const int x_135 = i_1; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_137 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_135 < x_137)) { + } else { + break; + } + const int x_141 = asint(x_6[5].x); + const float x_142 = float(x_141); + x_GLF_color = float4(x_142, x_142, x_142, x_142); + { + i_1 = (i_1 + 1); + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..e35af4fbb1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.msl @@ -0,0 +1,140 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[6]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + int arr[5]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_12, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper_2 data = {}; + int a = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_54 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[0].el; + tint_array_wrapper_2 const tint_symbol_4 = {.arr={x_58, x_60, x_62, x_64, x_66}}; + data = tint_symbol_4; + int const x_69 = x_6.x_GLF_uniform_int_values.arr[5].el; + a = x_69; + while (true) { + int const x_74 = a; + int const x_76 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_74 < x_76)) { + } else { + break; + } + int const x_80 = x_6.x_GLF_uniform_int_values.arr[5].el; + i = x_80; + while (true) { + int const x_85 = i; + int const x_87 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_85 < x_87)) { + } else { + break; + } + int const x_90 = i; + j = x_90; + while (true) { + int const x_95 = j; + int const x_97 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_95 < x_97)) { + } else { + break; + } + int const x_100 = i; + int const x_102 = data.arr[x_100]; + int const x_103 = j; + int const x_105 = data.arr[x_103]; + if ((x_102 < x_105)) { + int const x_110 = x_6.x_GLF_uniform_int_values.arr[5].el; + float const x_111 = float(x_110); + *(tint_symbol_6) = float4(x_111, x_111, x_111, x_111); + } + { + int const x_113 = j; + j = (x_113 + 1); + } + } + { + int const x_115 = i; + i = (x_115 + 1); + } + } + { + int const x_117 = a; + a = (x_117 + 1); + } + } + while (true) { + float const x_124 = (*(tint_symbol_7)).x; + float const x_126 = x_12.x_GLF_uniform_float_values.arr[0].el; + if ((x_124 < x_126)) { + } else { + break; + } + int const x_130 = x_6.x_GLF_uniform_int_values.arr[5].el; + i_1 = x_130; + while (true) { + int const x_135 = i_1; + int const x_137 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_135 < x_137)) { + } else { + break; + } + int const x_141 = x_6.x_GLF_uniform_int_values.arr[5].el; + float const x_142 = float(x_141); + *(tint_symbol_6) = float4(x_142, x_142, x_142, x_142); + { + int const x_144 = i_1; + i_1 = (x_144 + 1); + } + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_6 [[buffer(1)]], constant buf0& x_12 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, x_12, &(tint_symbol_9), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8577b92915 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.spvasm @@ -0,0 +1,287 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 174 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_12 "x_12" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %data "data" + OpName %a "a" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_6 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_5 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_6 = OpConstant %uint 6 +%_arr_int_uint_6 = OpTypeArray %int %uint_6 + %buf1 = OpTypeStruct %_arr_int_uint_6 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 +%_ptr_Function__arr_int_uint_5 = OpTypePointer Function %_arr_int_uint_5 + %31 = OpConstantNull %_arr_int_uint_5 +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %161 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %data = OpVariable %_ptr_Function__arr_int_uint_5 Function %31 + %a = OpVariable %_ptr_Function_int Function %34 + %i = OpVariable %_ptr_Function_int Function %34 + %j = OpVariable %_ptr_Function_int Function %34 + %i_1 = OpVariable %_ptr_Function_int Function %34 + %41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %42 = OpLoad %int %41 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %42 + %51 = OpConvertSToF %float %45 + %52 = OpConvertSToF %float %47 + %53 = OpConvertSToF %float %49 + %54 = OpCompositeConstruct %v4float %50 %51 %52 %53 + OpStore %x_GLF_color %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %57 = OpLoad %int %56 + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %60 = OpLoad %int %59 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %63 = OpLoad %int %62 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpCompositeConstruct %_arr_int_uint_5 %57 %60 %63 %66 %68 + OpStore %data %69 + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %71 = OpLoad %int %70 + OpStore %a %71 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %int %a + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %78 = OpLoad %int %77 + %79 = OpSLessThan %bool %76 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %73 + %81 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %85 = OpLoad %int %84 + OpStore %i %85 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %87 %88 None + OpBranch %89 + %89 = OpLabel + %90 = OpLoad %int %i + %91 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpSLessThan %bool %90 %92 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %96 + %95 = OpLabel + OpBranch %94 + %96 = OpLabel + OpBranch %87 + %94 = OpLabel + %97 = OpLoad %int %i + OpStore %j %97 + OpBranch %98 + %98 = OpLabel + OpLoopMerge %99 %100 None + OpBranch %101 + %101 = OpLabel + %102 = OpLoad %int %j + %103 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %104 = OpLoad %int %103 + %105 = OpSLessThan %bool %102 %104 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %108 + %107 = OpLabel + OpBranch %106 + %108 = OpLabel + OpBranch %99 + %106 = OpLabel + %109 = OpLoad %int %i + %110 = OpAccessChain %_ptr_Function_int %data %109 + %111 = OpLoad %int %110 + %112 = OpLoad %int %j + %113 = OpAccessChain %_ptr_Function_int %data %112 + %114 = OpLoad %int %113 + %115 = OpSLessThan %bool %111 %114 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %119 = OpLoad %int %118 + %120 = OpConvertSToF %float %119 + %121 = OpCompositeConstruct %v4float %120 %120 %120 %120 + OpStore %x_GLF_color %121 + OpBranch %116 + %116 = OpLabel + OpBranch %100 + %100 = OpLabel + %122 = OpLoad %int %j + %123 = OpIAdd %int %122 %int_1 + OpStore %j %123 + OpBranch %98 + %99 = OpLabel + OpBranch %88 + %88 = OpLabel + %124 = OpLoad %int %i + %125 = OpIAdd %int %124 %int_1 + OpStore %i %125 + OpBranch %86 + %87 = OpLabel + OpBranch %74 + %74 = OpLabel + %126 = OpLoad %int %a + %127 = OpIAdd %int %126 %int_1 + OpStore %a %127 + OpBranch %72 + %73 = OpLabel + OpBranch %128 + %128 = OpLabel + OpLoopMerge %129 %130 None + OpBranch %131 + %131 = OpLabel + %133 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %134 = OpLoad %float %133 + %136 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0 + %137 = OpLoad %float %136 + %138 = OpFOrdLessThan %bool %134 %137 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpBranch %139 + %141 = OpLabel + OpBranch %129 + %139 = OpLabel + %142 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %143 = OpLoad %int %142 + OpStore %i_1 %143 + OpBranch %144 + %144 = OpLabel + OpLoopMerge %145 %146 None + OpBranch %147 + %147 = OpLabel + %148 = OpLoad %int %i_1 + %149 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %150 = OpLoad %int %149 + %151 = OpSLessThan %bool %148 %150 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %154 + %153 = OpLabel + OpBranch %152 + %154 = OpLabel + OpBranch %145 + %152 = OpLabel + %155 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %156 = OpLoad %int %155 + %157 = OpConvertSToF %float %156 + %158 = OpCompositeConstruct %v4float %157 %157 %157 %157 + OpStore %x_GLF_color %158 + OpBranch %146 + %146 = OpLabel + %159 = OpLoad %int %i_1 + %160 = OpIAdd %int %159 %int_1 + OpStore %i_1 %160 + OpBranch %144 + %145 = OpLabel + OpBranch %130 + %130 = OpLabel + OpBranch %128 + %129 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %161 +%tint_symbol_1 = OpFunctionParameter %main_out + %165 = OpLabel + %166 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %166 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %168 = OpLabel + %169 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %169 + %170 = OpFunctionCall %void %main_1 + %172 = OpLoad %v4float %x_GLF_color + %173 = OpCompositeConstruct %main_out %172 + %171 = OpFunctionCall %void %tint_symbol_3 %173 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b603ec3a1f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.spvasm.expected.wgsl @@ -0,0 +1,133 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_12 : buf0; + +fn main_1() { + var data : array; + var a : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_45), f32(x_48), f32(x_51), f32(x_54)); + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[0]; + data = array(x_58, x_60, x_62, x_64, x_66); + let x_69 : i32 = x_6.x_GLF_uniform_int_values[5]; + a = x_69; + loop { + let x_74 : i32 = a; + let x_76 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_74 < x_76)) { + } else { + break; + } + let x_80 : i32 = x_6.x_GLF_uniform_int_values[5]; + i = x_80; + loop { + let x_85 : i32 = i; + let x_87 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_85 < x_87)) { + } else { + break; + } + let x_90 : i32 = i; + j = x_90; + loop { + let x_95 : i32 = j; + let x_97 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_95 < x_97)) { + } else { + break; + } + let x_100 : i32 = i; + let x_102 : i32 = data[x_100]; + let x_103 : i32 = j; + let x_105 : i32 = data[x_103]; + if ((x_102 < x_105)) { + let x_110 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_111 : f32 = f32(x_110); + x_GLF_color = vec4(x_111, x_111, x_111, x_111); + } + + continuing { + let x_113 : i32 = j; + j = (x_113 + 1); + } + } + + continuing { + let x_115 : i32 = i; + i = (x_115 + 1); + } + } + + continuing { + let x_117 : i32 = a; + a = (x_117 + 1); + } + } + loop { + let x_124 : f32 = gl_FragCoord.x; + let x_126 : f32 = x_12.x_GLF_uniform_float_values[0]; + if ((x_124 < x_126)) { + } else { + break; + } + let x_130 : i32 = x_6.x_GLF_uniform_int_values[5]; + i_1 = x_130; + loop { + let x_135 : i32 = i_1; + let x_137 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_135 < x_137)) { + } else { + break; + } + let x_141 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_142 : f32 = f32(x_141); + x_GLF_color = vec4(x_142, x_142, x_142, x_142); + + continuing { + let x_144 : i32 = i_1; + i_1 = (x_144 + 1); + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl new file mode 100644 index 0000000000..b603ec3a1f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl @@ -0,0 +1,133 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_12 : buf0; + +fn main_1() { + var data : array; + var a : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_45), f32(x_48), f32(x_51), f32(x_54)); + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[0]; + data = array(x_58, x_60, x_62, x_64, x_66); + let x_69 : i32 = x_6.x_GLF_uniform_int_values[5]; + a = x_69; + loop { + let x_74 : i32 = a; + let x_76 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_74 < x_76)) { + } else { + break; + } + let x_80 : i32 = x_6.x_GLF_uniform_int_values[5]; + i = x_80; + loop { + let x_85 : i32 = i; + let x_87 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_85 < x_87)) { + } else { + break; + } + let x_90 : i32 = i; + j = x_90; + loop { + let x_95 : i32 = j; + let x_97 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_95 < x_97)) { + } else { + break; + } + let x_100 : i32 = i; + let x_102 : i32 = data[x_100]; + let x_103 : i32 = j; + let x_105 : i32 = data[x_103]; + if ((x_102 < x_105)) { + let x_110 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_111 : f32 = f32(x_110); + x_GLF_color = vec4(x_111, x_111, x_111, x_111); + } + + continuing { + let x_113 : i32 = j; + j = (x_113 + 1); + } + } + + continuing { + let x_115 : i32 = i; + i = (x_115 + 1); + } + } + + continuing { + let x_117 : i32 = a; + a = (x_117 + 1); + } + } + loop { + let x_124 : f32 = gl_FragCoord.x; + let x_126 : f32 = x_12.x_GLF_uniform_float_values[0]; + if ((x_124 < x_126)) { + } else { + break; + } + let x_130 : i32 = x_6.x_GLF_uniform_int_values[5]; + i_1 = x_130; + loop { + let x_135 : i32 = i_1; + let x_137 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_135 < x_137)) { + } else { + break; + } + let x_141 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_142 : f32 = f32(x_141); + x_GLF_color = vec4(x_142, x_142, x_142, x_142); + + continuing { + let x_144 : i32 = i_1; + i_1 = (x_144 + 1); + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..e91ca1c9c9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.hlsl @@ -0,0 +1,123 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[6]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[1]; +}; + +void main_1() { + int data[5] = (int[5])0; + int a = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_45 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_48 = asint(x_6[5].x); + const int x_51 = asint(x_6[5].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + const int x_58 = asint(x_6[1].x); + const int x_60 = asint(x_6[2].x); + const int x_62 = asint(x_6[3].x); + const int x_64 = asint(x_6[4].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_66 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int tint_symbol_6[5] = {x_58, x_60, x_62, x_64, x_66}; + data = tint_symbol_6; + const int x_69 = asint(x_6[5].x); + a = x_69; + while (true) { + const int x_74 = a; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_76 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_74 < x_76)) { + } else { + break; + } + const int x_80 = asint(x_6[5].x); + i = x_80; + while (true) { + const int x_85 = i; + const int x_87 = asint(x_6[1].x); + if ((x_85 < x_87)) { + } else { + break; + } + j = i; + while (true) { + const int x_95 = j; + const int x_97 = asint(x_6[1].x); + if ((x_95 < x_97)) { + } else { + break; + } + const int x_102 = data[i]; + const int x_105 = data[j]; + if ((x_102 < x_105)) { + const int x_110 = asint(x_6[5].x); + const float x_111 = float(x_110); + x_GLF_color = float4(x_111, x_111, x_111, x_111); + } + { + j = (j + 1); + } + } + { + i = (i + 1); + } + } + { + a = (a + 1); + } + } + while (true) { + const float x_124 = gl_FragCoord.x; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_126 = asfloat(x_12[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_124 < x_126)) { + } else { + break; + } + const int x_130 = asint(x_6[5].x); + i_1 = x_130; + while (true) { + const int x_135 = i_1; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_137 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_135 < x_137)) { + } else { + break; + } + const int x_141 = asint(x_6[5].x); + const float x_142 = float(x_141); + x_GLF_color = float4(x_142, x_142, x_142, x_142); + { + i_1 = (i_1 + 1); + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..e35af4fbb1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.msl @@ -0,0 +1,140 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[6]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + int arr[5]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_12, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper_2 data = {}; + int a = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_54 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_45), float(x_48), float(x_51), float(x_54)); + int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[0].el; + tint_array_wrapper_2 const tint_symbol_4 = {.arr={x_58, x_60, x_62, x_64, x_66}}; + data = tint_symbol_4; + int const x_69 = x_6.x_GLF_uniform_int_values.arr[5].el; + a = x_69; + while (true) { + int const x_74 = a; + int const x_76 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_74 < x_76)) { + } else { + break; + } + int const x_80 = x_6.x_GLF_uniform_int_values.arr[5].el; + i = x_80; + while (true) { + int const x_85 = i; + int const x_87 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_85 < x_87)) { + } else { + break; + } + int const x_90 = i; + j = x_90; + while (true) { + int const x_95 = j; + int const x_97 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_95 < x_97)) { + } else { + break; + } + int const x_100 = i; + int const x_102 = data.arr[x_100]; + int const x_103 = j; + int const x_105 = data.arr[x_103]; + if ((x_102 < x_105)) { + int const x_110 = x_6.x_GLF_uniform_int_values.arr[5].el; + float const x_111 = float(x_110); + *(tint_symbol_6) = float4(x_111, x_111, x_111, x_111); + } + { + int const x_113 = j; + j = (x_113 + 1); + } + } + { + int const x_115 = i; + i = (x_115 + 1); + } + } + { + int const x_117 = a; + a = (x_117 + 1); + } + } + while (true) { + float const x_124 = (*(tint_symbol_7)).x; + float const x_126 = x_12.x_GLF_uniform_float_values.arr[0].el; + if ((x_124 < x_126)) { + } else { + break; + } + int const x_130 = x_6.x_GLF_uniform_int_values.arr[5].el; + i_1 = x_130; + while (true) { + int const x_135 = i_1; + int const x_137 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_135 < x_137)) { + } else { + break; + } + int const x_141 = x_6.x_GLF_uniform_int_values.arr[5].el; + float const x_142 = float(x_141); + *(tint_symbol_6) = float4(x_142, x_142, x_142, x_142); + { + int const x_144 = i_1; + i_1 = (x_144 + 1); + } + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_6 [[buffer(1)]], constant buf0& x_12 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, x_12, &(tint_symbol_9), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8577b92915 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.spvasm @@ -0,0 +1,287 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 174 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_12 "x_12" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %data "data" + OpName %a "a" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_6 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_5 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_6 = OpConstant %uint 6 +%_arr_int_uint_6 = OpTypeArray %int %uint_6 + %buf1 = OpTypeStruct %_arr_int_uint_6 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 +%_ptr_Function__arr_int_uint_5 = OpTypePointer Function %_arr_int_uint_5 + %31 = OpConstantNull %_arr_int_uint_5 +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %161 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %data = OpVariable %_ptr_Function__arr_int_uint_5 Function %31 + %a = OpVariable %_ptr_Function_int Function %34 + %i = OpVariable %_ptr_Function_int Function %34 + %j = OpVariable %_ptr_Function_int Function %34 + %i_1 = OpVariable %_ptr_Function_int Function %34 + %41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %42 = OpLoad %int %41 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %42 + %51 = OpConvertSToF %float %45 + %52 = OpConvertSToF %float %47 + %53 = OpConvertSToF %float %49 + %54 = OpCompositeConstruct %v4float %50 %51 %52 %53 + OpStore %x_GLF_color %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %57 = OpLoad %int %56 + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %60 = OpLoad %int %59 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %63 = OpLoad %int %62 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpCompositeConstruct %_arr_int_uint_5 %57 %60 %63 %66 %68 + OpStore %data %69 + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %71 = OpLoad %int %70 + OpStore %a %71 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %int %a + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %78 = OpLoad %int %77 + %79 = OpSLessThan %bool %76 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %73 + %81 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %85 = OpLoad %int %84 + OpStore %i %85 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %87 %88 None + OpBranch %89 + %89 = OpLabel + %90 = OpLoad %int %i + %91 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpSLessThan %bool %90 %92 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %96 + %95 = OpLabel + OpBranch %94 + %96 = OpLabel + OpBranch %87 + %94 = OpLabel + %97 = OpLoad %int %i + OpStore %j %97 + OpBranch %98 + %98 = OpLabel + OpLoopMerge %99 %100 None + OpBranch %101 + %101 = OpLabel + %102 = OpLoad %int %j + %103 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %104 = OpLoad %int %103 + %105 = OpSLessThan %bool %102 %104 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %108 + %107 = OpLabel + OpBranch %106 + %108 = OpLabel + OpBranch %99 + %106 = OpLabel + %109 = OpLoad %int %i + %110 = OpAccessChain %_ptr_Function_int %data %109 + %111 = OpLoad %int %110 + %112 = OpLoad %int %j + %113 = OpAccessChain %_ptr_Function_int %data %112 + %114 = OpLoad %int %113 + %115 = OpSLessThan %bool %111 %114 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %119 = OpLoad %int %118 + %120 = OpConvertSToF %float %119 + %121 = OpCompositeConstruct %v4float %120 %120 %120 %120 + OpStore %x_GLF_color %121 + OpBranch %116 + %116 = OpLabel + OpBranch %100 + %100 = OpLabel + %122 = OpLoad %int %j + %123 = OpIAdd %int %122 %int_1 + OpStore %j %123 + OpBranch %98 + %99 = OpLabel + OpBranch %88 + %88 = OpLabel + %124 = OpLoad %int %i + %125 = OpIAdd %int %124 %int_1 + OpStore %i %125 + OpBranch %86 + %87 = OpLabel + OpBranch %74 + %74 = OpLabel + %126 = OpLoad %int %a + %127 = OpIAdd %int %126 %int_1 + OpStore %a %127 + OpBranch %72 + %73 = OpLabel + OpBranch %128 + %128 = OpLabel + OpLoopMerge %129 %130 None + OpBranch %131 + %131 = OpLabel + %133 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %134 = OpLoad %float %133 + %136 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0 + %137 = OpLoad %float %136 + %138 = OpFOrdLessThan %bool %134 %137 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpBranch %139 + %141 = OpLabel + OpBranch %129 + %139 = OpLabel + %142 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %143 = OpLoad %int %142 + OpStore %i_1 %143 + OpBranch %144 + %144 = OpLabel + OpLoopMerge %145 %146 None + OpBranch %147 + %147 = OpLabel + %148 = OpLoad %int %i_1 + %149 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %150 = OpLoad %int %149 + %151 = OpSLessThan %bool %148 %150 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %154 + %153 = OpLabel + OpBranch %152 + %154 = OpLabel + OpBranch %145 + %152 = OpLabel + %155 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %156 = OpLoad %int %155 + %157 = OpConvertSToF %float %156 + %158 = OpCompositeConstruct %v4float %157 %157 %157 %157 + OpStore %x_GLF_color %158 + OpBranch %146 + %146 = OpLabel + %159 = OpLoad %int %i_1 + %160 = OpIAdd %int %159 %int_1 + OpStore %i_1 %160 + OpBranch %144 + %145 = OpLabel + OpBranch %130 + %130 = OpLabel + OpBranch %128 + %129 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %161 +%tint_symbol_1 = OpFunctionParameter %main_out + %165 = OpLabel + %166 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %166 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %168 = OpLabel + %169 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %169 + %170 = OpFunctionCall %void %main_1 + %172 = OpLoad %v4float %x_GLF_color + %173 = OpCompositeConstruct %main_out %172 + %171 = OpFunctionCall %void %tint_symbol_3 %173 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b603ec3a1f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-basic-block-for-for-for-less-than/0-opt.wgsl.expected.wgsl @@ -0,0 +1,133 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_12 : buf0; + +fn main_1() { + var data : array; + var a : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_45), f32(x_48), f32(x_51), f32(x_54)); + let x_58 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[0]; + data = array(x_58, x_60, x_62, x_64, x_66); + let x_69 : i32 = x_6.x_GLF_uniform_int_values[5]; + a = x_69; + loop { + let x_74 : i32 = a; + let x_76 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_74 < x_76)) { + } else { + break; + } + let x_80 : i32 = x_6.x_GLF_uniform_int_values[5]; + i = x_80; + loop { + let x_85 : i32 = i; + let x_87 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_85 < x_87)) { + } else { + break; + } + let x_90 : i32 = i; + j = x_90; + loop { + let x_95 : i32 = j; + let x_97 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_95 < x_97)) { + } else { + break; + } + let x_100 : i32 = i; + let x_102 : i32 = data[x_100]; + let x_103 : i32 = j; + let x_105 : i32 = data[x_103]; + if ((x_102 < x_105)) { + let x_110 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_111 : f32 = f32(x_110); + x_GLF_color = vec4(x_111, x_111, x_111, x_111); + } + + continuing { + let x_113 : i32 = j; + j = (x_113 + 1); + } + } + + continuing { + let x_115 : i32 = i; + i = (x_115 + 1); + } + } + + continuing { + let x_117 : i32 = a; + a = (x_117 + 1); + } + } + loop { + let x_124 : f32 = gl_FragCoord.x; + let x_126 : f32 = x_12.x_GLF_uniform_float_values[0]; + if ((x_124 < x_126)) { + } else { + break; + } + let x_130 : i32 = x_6.x_GLF_uniform_int_values[5]; + i_1 = x_130; + loop { + let x_135 : i32 = i_1; + let x_137 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_135 < x_137)) { + } else { + break; + } + let x_141 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_142 : f32 = f32(x_141); + x_GLF_color = vec4(x_142, x_142, x_142, x_142); + + continuing { + let x_144 : i32 = i_1; + i_1 = (x_144 + 1); + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm new file mode 100644 index 0000000000..1632f14928 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm @@ -0,0 +1,182 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_v1 + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %uv "uv" + OpName %gl_FragCoord "gl_FragCoord" + OpName %v1 "v1" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %a "a" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_v1 "_GLF_v1" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %i RelaxedPrecision + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %_GLF_v1 Location 0 + OpDecorate %20 RelaxedPrecision + %void = OpTypeVoid + %22 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %uint_0 = OpConstant %uint 0 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 +%_ptr_Function_int = OpTypePointer Function %int +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_v1 = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %22 + %48 = OpLabel + %uv = OpVariable %_ptr_Function_v2float Function + %v1 = OpVariable %_ptr_Function_v4float Function + %a = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %49 = OpLoad %v4float %gl_FragCoord + %50 = OpVectorShuffle %v2float %49 %49 0 1 + OpStore %uv %50 + %51 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %52 = OpLoad %float %51 + %53 = OpCompositeConstruct %v4float %52 %52 %52 %52 + OpStore %v1 %53 + %54 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %55 = OpLoad %float %54 + %56 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %57 = OpLoad %float %56 + %58 = OpFOrdGreaterThanEqual %bool %55 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + OpStore %63 %62 + %64 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + OpStore %66 %65 + %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Function_float %v1 %uint_2 + OpStore %69 %68 + %70 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Function_float %v1 %uint_3 + OpStore %72 %71 + OpBranch %59 + %59 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %74 = OpLoad %float %73 + OpStore %a %74 + %75 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %15 = OpLoad %int %75 + OpStore %i %15 + OpBranch %76 + %76 = OpLabel + OpLoopMerge %77 %78 None + OpBranch %79 + %79 = OpLabel + %16 = OpLoad %int %i + %80 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %17 = OpLoad %int %80 + %81 = OpSLessThan %bool %16 %17 + OpBranchConditional %81 %82 %77 + %82 = OpLabel + %83 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %84 = OpLoad %float %83 + %85 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %86 = OpLoad %float %85 + %87 = OpFOrdLessThan %bool %84 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + OpKill + %88 = OpLabel + %90 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %93 = OpLoad %float %92 + %94 = OpFAdd %float %91 %93 + %95 = OpAccessChain %_ptr_Function_float %v1 %uint_2 + %96 = OpLoad %float %95 + %97 = OpFAdd %float %94 %96 + %98 = OpAccessChain %_ptr_Function_float %v1 %uint_3 + %99 = OpLoad %float %98 + %100 = OpFAdd %float %97 %99 + %101 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %102 = OpLoad %float %101 + %103 = OpExtInst %float %1 Pow %100 %102 + OpStore %a %103 + OpBranch %78 + %78 = OpLabel + %18 = OpLoad %int %i + %19 = OpIAdd %int %18 %int_1 + OpStore %i %19 + OpBranch %76 + %77 = OpLabel + %104 = OpLoad %float %a + %105 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %106 = OpLoad %float %105 + %107 = OpFOrdEqual %bool %104 %106 + OpSelectionMerge %108 None + OpBranchConditional %107 %109 %110 + %109 = OpLabel + %111 = OpLoad %v4float %v1 + OpStore %_GLF_v1 %111 + OpBranch %108 + %110 = OpLabel + %112 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %20 = OpLoad %int %112 + %113 = OpConvertSToF %float %20 + %114 = OpCompositeConstruct %v4float %113 %113 %113 %113 + OpStore %_GLF_v1 %114 + OpBranch %108 + %108 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..790ef732fd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.hlsl @@ -0,0 +1,92 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[4]; +}; +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[2]; +}; +static float4 x_GLF_v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 uv = float2(0.0f, 0.0f); + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float a = 0.0f; + int i = 0; + const float4 x_49 = gl_FragCoord; + uv = float2(x_49.x, x_49.y); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_52 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + v1 = float4(x_52, x_52, x_52, x_52); + const float x_55 = uv.y; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_57 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_55 >= x_57)) { + const float x_62 = asfloat(x_8[2].x); + v1.x = x_62; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_65 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + v1.y = x_65; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_68 = asfloat(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + v1.z = x_68; + const float x_71 = asfloat(x_8[2].x); + v1.w = x_71; + } + const float x_74 = asfloat(x_8[2].x); + a = x_74; + const int x_15 = asint(x_12[1].x); + i = x_15; + while (true) { + const int x_16 = i; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_17 = asint(x_12[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_16 < x_17)) { + } else { + break; + } + const float x_84 = asfloat(x_8[2].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_86 = asfloat(x_8[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_84 < x_86)) { + discard; + } + const float x_91 = v1.x; + const float x_93 = v1.y; + const float x_96 = v1.z; + const float x_99 = v1.w; + const float x_102 = asfloat(x_8[3].x); + a = pow((((x_91 + x_93) + x_96) + x_99), x_102); + { + i = (i + 1); + } + } + const float x_104 = a; + const float x_106 = asfloat(x_8[1].x); + if ((x_104 == x_106)) { + x_GLF_v1 = v1; + } else { + const int x_20 = asint(x_12[1].x); + const float x_113 = float(x_20); + x_GLF_v1 = float4(x_113, x_113, x_113, x_113); + } + return; +} + +struct main_out { + float4 x_GLF_v1_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_v1_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_v1}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_v1_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..efced0c880 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.msl @@ -0,0 +1,101 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_v1_1; +}; +struct tint_symbol_2 { + float4 x_GLF_v1_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_8, constant buf0& x_12, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 uv = 0.0f; + float4 v1 = 0.0f; + float a = 0.0f; + int i = 0; + float4 const x_49 = *(tint_symbol_5); + uv = float2(x_49.x, x_49.y); + float const x_52 = x_8.x_GLF_uniform_float_values.arr[0].el; + v1 = float4(x_52, x_52, x_52, x_52); + float const x_55 = uv.y; + float const x_57 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_55 >= x_57)) { + float const x_62 = x_8.x_GLF_uniform_float_values.arr[2].el; + v1.x = x_62; + float const x_65 = x_8.x_GLF_uniform_float_values.arr[0].el; + v1.y = x_65; + float const x_68 = x_8.x_GLF_uniform_float_values.arr[0].el; + v1.z = x_68; + float const x_71 = x_8.x_GLF_uniform_float_values.arr[2].el; + v1.w = x_71; + } + float const x_74 = x_8.x_GLF_uniform_float_values.arr[2].el; + a = x_74; + int const x_15 = x_12.x_GLF_uniform_int_values.arr[1].el; + i = x_15; + while (true) { + int const x_16 = i; + int const x_17 = x_12.x_GLF_uniform_int_values.arr[0].el; + if ((x_16 < x_17)) { + } else { + break; + } + float const x_84 = x_8.x_GLF_uniform_float_values.arr[2].el; + float const x_86 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_84 < x_86)) { + discard_fragment(); + } + float const x_91 = v1.x; + float const x_93 = v1.y; + float const x_96 = v1.z; + float const x_99 = v1.w; + float const x_102 = x_8.x_GLF_uniform_float_values.arr[3].el; + a = pow((((x_91 + x_93) + x_96) + x_99), x_102); + { + int const x_18 = i; + i = (x_18 + 1); + } + } + float const x_104 = a; + float const x_106 = x_8.x_GLF_uniform_float_values.arr[1].el; + if ((x_104 == x_106)) { + float4 const x_111 = v1; + *(tint_symbol_6) = x_111; + } else { + int const x_20 = x_12.x_GLF_uniform_int_values.arr[1].el; + float const x_113 = float(x_20); + *(tint_symbol_6) = float4(x_113, x_113, x_113, x_113); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_8 [[buffer(1)]], constant buf0& x_12 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, x_12, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_v1_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_v1_1=tint_symbol_3.x_GLF_v1_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..fd1fbff10b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.spvasm @@ -0,0 +1,221 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 139 +; Schema: 0 + OpCapability Shader + %108 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_12 "x_12" + OpName %x_GLF_v1 "x_GLF_v1" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %uv "uv" + OpName %v1 "v1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_v1_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform + %x_GLF_v1 = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %30 = OpConstantNull %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %35 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %38 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %uint_3 = OpConstant %uint 3 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %126 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %uv = OpVariable %_ptr_Function_v2float Function %30 + %v1 = OpVariable %_ptr_Function_v4float Function %5 + %a = OpVariable %_ptr_Function_float Function %35 + %i = OpVariable %_ptr_Function_int Function %38 + %39 = OpLoad %v4float %gl_FragCoord + %40 = OpCompositeExtract %float %39 0 + %41 = OpCompositeExtract %float %39 1 + %42 = OpCompositeConstruct %v2float %40 %41 + OpStore %uv %42 + %46 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpCompositeConstruct %v4float %47 %47 %47 %47 + OpStore %v1 %48 + %50 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %51 = OpLoad %float %50 + %52 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %53 = OpLoad %float %52 + %54 = OpFOrdGreaterThanEqual %bool %51 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %60 = OpLoad %float %59 + %61 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + OpStore %61 %60 + %62 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + OpStore %64 %63 + %65 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Function_float %v1 %uint_2 + OpStore %67 %66 + %68 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %69 = OpLoad %float %68 + %71 = OpAccessChain %_ptr_Function_float %v1 %uint_3 + OpStore %71 %69 + OpBranch %56 + %56 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %73 = OpLoad %float %72 + OpStore %a %73 + %76 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %77 = OpLoad %int %76 + OpStore %i %77 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %int %i + %83 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %84 = OpLoad %int %83 + %85 = OpSLessThan %bool %82 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + OpBranch %86 + %88 = OpLabel + OpBranch %79 + %86 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %92 = OpLoad %float %91 + %93 = OpFOrdLessThan %bool %90 %92 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %94 + %95 = OpLabel + OpKill + %94 = OpLabel + %96 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %97 = OpLoad %float %96 + %98 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Function_float %v1 %uint_2 + %101 = OpLoad %float %100 + %102 = OpAccessChain %_ptr_Function_float %v1 %uint_3 + %103 = OpLoad %float %102 + %105 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_3 + %106 = OpLoad %float %105 + %109 = OpFAdd %float %97 %99 + %110 = OpFAdd %float %109 %101 + %111 = OpFAdd %float %110 %103 + %107 = OpExtInst %float %108 Pow %111 %106 + OpStore %a %107 + OpBranch %80 + %80 = OpLabel + %112 = OpLoad %int %i + %113 = OpIAdd %int %112 %int_1 + OpStore %i %113 + OpBranch %78 + %79 = OpLabel + %114 = OpLoad %float %a + %115 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %116 = OpLoad %float %115 + %117 = OpFOrdEqual %bool %114 %116 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %120 + %119 = OpLabel + %121 = OpLoad %v4float %v1 + OpStore %x_GLF_v1 %121 + OpBranch %118 + %120 = OpLabel + %122 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %123 = OpLoad %int %122 + %124 = OpConvertSToF %float %123 + %125 = OpCompositeConstruct %v4float %124 %124 %124 %124 + OpStore %x_GLF_v1 %125 + OpBranch %118 + %118 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %126 +%tint_symbol_1 = OpFunctionParameter %main_out + %130 = OpLabel + %131 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %131 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %133 = OpLabel + %134 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %134 + %135 = OpFunctionCall %void %main_1 + %137 = OpLoad %v4float %x_GLF_v1 + %138 = OpCompositeConstruct %main_out %137 + %136 = OpFunctionCall %void %tint_symbol_3 %138 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c2a6296053 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.spvasm.expected.wgsl @@ -0,0 +1,95 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_12 : buf0; + +var x_GLF_v1 : vec4; + +fn main_1() { + var uv : vec2; + var v1 : vec4; + var a : f32; + var i : i32; + let x_49 : vec4 = gl_FragCoord; + uv = vec2(x_49.x, x_49.y); + let x_52 : f32 = x_8.x_GLF_uniform_float_values[0]; + v1 = vec4(x_52, x_52, x_52, x_52); + let x_55 : f32 = uv.y; + let x_57 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_55 >= x_57)) { + let x_62 : f32 = x_8.x_GLF_uniform_float_values[2]; + v1.x = x_62; + let x_65 : f32 = x_8.x_GLF_uniform_float_values[0]; + v1.y = x_65; + let x_68 : f32 = x_8.x_GLF_uniform_float_values[0]; + v1.z = x_68; + let x_71 : f32 = x_8.x_GLF_uniform_float_values[2]; + v1.w = x_71; + } + let x_74 : f32 = x_8.x_GLF_uniform_float_values[2]; + a = x_74; + let x_15 : i32 = x_12.x_GLF_uniform_int_values[1]; + i = x_15; + loop { + let x_16 : i32 = i; + let x_17 : i32 = x_12.x_GLF_uniform_int_values[0]; + if ((x_16 < x_17)) { + } else { + break; + } + let x_84 : f32 = x_8.x_GLF_uniform_float_values[2]; + let x_86 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_84 < x_86)) { + discard; + } + let x_91 : f32 = v1.x; + let x_93 : f32 = v1.y; + let x_96 : f32 = v1.z; + let x_99 : f32 = v1.w; + let x_102 : f32 = x_8.x_GLF_uniform_float_values[3]; + a = pow((((x_91 + x_93) + x_96) + x_99), x_102); + + continuing { + let x_18 : i32 = i; + i = (x_18 + 1); + } + } + let x_104 : f32 = a; + let x_106 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_104 == x_106)) { + let x_111 : vec4 = v1; + x_GLF_v1 = x_111; + } else { + let x_20 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_113 : f32 = f32(x_20); + x_GLF_v1 = vec4(x_113, x_113, x_113, x_113); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_v1_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_v1); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl new file mode 100644 index 0000000000..c2a6296053 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl @@ -0,0 +1,95 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_12 : buf0; + +var x_GLF_v1 : vec4; + +fn main_1() { + var uv : vec2; + var v1 : vec4; + var a : f32; + var i : i32; + let x_49 : vec4 = gl_FragCoord; + uv = vec2(x_49.x, x_49.y); + let x_52 : f32 = x_8.x_GLF_uniform_float_values[0]; + v1 = vec4(x_52, x_52, x_52, x_52); + let x_55 : f32 = uv.y; + let x_57 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_55 >= x_57)) { + let x_62 : f32 = x_8.x_GLF_uniform_float_values[2]; + v1.x = x_62; + let x_65 : f32 = x_8.x_GLF_uniform_float_values[0]; + v1.y = x_65; + let x_68 : f32 = x_8.x_GLF_uniform_float_values[0]; + v1.z = x_68; + let x_71 : f32 = x_8.x_GLF_uniform_float_values[2]; + v1.w = x_71; + } + let x_74 : f32 = x_8.x_GLF_uniform_float_values[2]; + a = x_74; + let x_15 : i32 = x_12.x_GLF_uniform_int_values[1]; + i = x_15; + loop { + let x_16 : i32 = i; + let x_17 : i32 = x_12.x_GLF_uniform_int_values[0]; + if ((x_16 < x_17)) { + } else { + break; + } + let x_84 : f32 = x_8.x_GLF_uniform_float_values[2]; + let x_86 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_84 < x_86)) { + discard; + } + let x_91 : f32 = v1.x; + let x_93 : f32 = v1.y; + let x_96 : f32 = v1.z; + let x_99 : f32 = v1.w; + let x_102 : f32 = x_8.x_GLF_uniform_float_values[3]; + a = pow((((x_91 + x_93) + x_96) + x_99), x_102); + + continuing { + let x_18 : i32 = i; + i = (x_18 + 1); + } + } + let x_104 : f32 = a; + let x_106 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_104 == x_106)) { + let x_111 : vec4 = v1; + x_GLF_v1 = x_111; + } else { + let x_20 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_113 : f32 = f32(x_20); + x_GLF_v1 = vec4(x_113, x_113, x_113, x_113); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_v1_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_v1); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..790ef732fd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.hlsl @@ -0,0 +1,92 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[4]; +}; +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[2]; +}; +static float4 x_GLF_v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 uv = float2(0.0f, 0.0f); + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float a = 0.0f; + int i = 0; + const float4 x_49 = gl_FragCoord; + uv = float2(x_49.x, x_49.y); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_52 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + v1 = float4(x_52, x_52, x_52, x_52); + const float x_55 = uv.y; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_57 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_55 >= x_57)) { + const float x_62 = asfloat(x_8[2].x); + v1.x = x_62; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_65 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + v1.y = x_65; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_68 = asfloat(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + v1.z = x_68; + const float x_71 = asfloat(x_8[2].x); + v1.w = x_71; + } + const float x_74 = asfloat(x_8[2].x); + a = x_74; + const int x_15 = asint(x_12[1].x); + i = x_15; + while (true) { + const int x_16 = i; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_17 = asint(x_12[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_16 < x_17)) { + } else { + break; + } + const float x_84 = asfloat(x_8[2].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_86 = asfloat(x_8[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_84 < x_86)) { + discard; + } + const float x_91 = v1.x; + const float x_93 = v1.y; + const float x_96 = v1.z; + const float x_99 = v1.w; + const float x_102 = asfloat(x_8[3].x); + a = pow((((x_91 + x_93) + x_96) + x_99), x_102); + { + i = (i + 1); + } + } + const float x_104 = a; + const float x_106 = asfloat(x_8[1].x); + if ((x_104 == x_106)) { + x_GLF_v1 = v1; + } else { + const int x_20 = asint(x_12[1].x); + const float x_113 = float(x_20); + x_GLF_v1 = float4(x_113, x_113, x_113, x_113); + } + return; +} + +struct main_out { + float4 x_GLF_v1_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_v1_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_v1}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_v1_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..efced0c880 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.msl @@ -0,0 +1,101 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_v1_1; +}; +struct tint_symbol_2 { + float4 x_GLF_v1_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_8, constant buf0& x_12, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 uv = 0.0f; + float4 v1 = 0.0f; + float a = 0.0f; + int i = 0; + float4 const x_49 = *(tint_symbol_5); + uv = float2(x_49.x, x_49.y); + float const x_52 = x_8.x_GLF_uniform_float_values.arr[0].el; + v1 = float4(x_52, x_52, x_52, x_52); + float const x_55 = uv.y; + float const x_57 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_55 >= x_57)) { + float const x_62 = x_8.x_GLF_uniform_float_values.arr[2].el; + v1.x = x_62; + float const x_65 = x_8.x_GLF_uniform_float_values.arr[0].el; + v1.y = x_65; + float const x_68 = x_8.x_GLF_uniform_float_values.arr[0].el; + v1.z = x_68; + float const x_71 = x_8.x_GLF_uniform_float_values.arr[2].el; + v1.w = x_71; + } + float const x_74 = x_8.x_GLF_uniform_float_values.arr[2].el; + a = x_74; + int const x_15 = x_12.x_GLF_uniform_int_values.arr[1].el; + i = x_15; + while (true) { + int const x_16 = i; + int const x_17 = x_12.x_GLF_uniform_int_values.arr[0].el; + if ((x_16 < x_17)) { + } else { + break; + } + float const x_84 = x_8.x_GLF_uniform_float_values.arr[2].el; + float const x_86 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_84 < x_86)) { + discard_fragment(); + } + float const x_91 = v1.x; + float const x_93 = v1.y; + float const x_96 = v1.z; + float const x_99 = v1.w; + float const x_102 = x_8.x_GLF_uniform_float_values.arr[3].el; + a = pow((((x_91 + x_93) + x_96) + x_99), x_102); + { + int const x_18 = i; + i = (x_18 + 1); + } + } + float const x_104 = a; + float const x_106 = x_8.x_GLF_uniform_float_values.arr[1].el; + if ((x_104 == x_106)) { + float4 const x_111 = v1; + *(tint_symbol_6) = x_111; + } else { + int const x_20 = x_12.x_GLF_uniform_int_values.arr[1].el; + float const x_113 = float(x_20); + *(tint_symbol_6) = float4(x_113, x_113, x_113, x_113); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_8 [[buffer(1)]], constant buf0& x_12 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, x_12, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_v1_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_v1_1=tint_symbol_3.x_GLF_v1_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd1fbff10b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.spvasm @@ -0,0 +1,221 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 139 +; Schema: 0 + OpCapability Shader + %108 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_12 "x_12" + OpName %x_GLF_v1 "x_GLF_v1" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %uv "uv" + OpName %v1 "v1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_v1_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform + %x_GLF_v1 = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %30 = OpConstantNull %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float + %35 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %38 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %uint_3 = OpConstant %uint 3 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %126 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %uv = OpVariable %_ptr_Function_v2float Function %30 + %v1 = OpVariable %_ptr_Function_v4float Function %5 + %a = OpVariable %_ptr_Function_float Function %35 + %i = OpVariable %_ptr_Function_int Function %38 + %39 = OpLoad %v4float %gl_FragCoord + %40 = OpCompositeExtract %float %39 0 + %41 = OpCompositeExtract %float %39 1 + %42 = OpCompositeConstruct %v2float %40 %41 + OpStore %uv %42 + %46 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpCompositeConstruct %v4float %47 %47 %47 %47 + OpStore %v1 %48 + %50 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %51 = OpLoad %float %50 + %52 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %53 = OpLoad %float %52 + %54 = OpFOrdGreaterThanEqual %bool %51 %53 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %60 = OpLoad %float %59 + %61 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + OpStore %61 %60 + %62 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + OpStore %64 %63 + %65 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Function_float %v1 %uint_2 + OpStore %67 %66 + %68 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %69 = OpLoad %float %68 + %71 = OpAccessChain %_ptr_Function_float %v1 %uint_3 + OpStore %71 %69 + OpBranch %56 + %56 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %73 = OpLoad %float %72 + OpStore %a %73 + %76 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %77 = OpLoad %int %76 + OpStore %i %77 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %int %i + %83 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %84 = OpLoad %int %83 + %85 = OpSLessThan %bool %82 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + OpBranch %86 + %88 = OpLabel + OpBranch %79 + %86 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %92 = OpLoad %float %91 + %93 = OpFOrdLessThan %bool %90 %92 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %94 + %95 = OpLabel + OpKill + %94 = OpLabel + %96 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %97 = OpLoad %float %96 + %98 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Function_float %v1 %uint_2 + %101 = OpLoad %float %100 + %102 = OpAccessChain %_ptr_Function_float %v1 %uint_3 + %103 = OpLoad %float %102 + %105 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_3 + %106 = OpLoad %float %105 + %109 = OpFAdd %float %97 %99 + %110 = OpFAdd %float %109 %101 + %111 = OpFAdd %float %110 %103 + %107 = OpExtInst %float %108 Pow %111 %106 + OpStore %a %107 + OpBranch %80 + %80 = OpLabel + %112 = OpLoad %int %i + %113 = OpIAdd %int %112 %int_1 + OpStore %i %113 + OpBranch %78 + %79 = OpLabel + %114 = OpLoad %float %a + %115 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %116 = OpLoad %float %115 + %117 = OpFOrdEqual %bool %114 %116 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %120 + %119 = OpLabel + %121 = OpLoad %v4float %v1 + OpStore %x_GLF_v1 %121 + OpBranch %118 + %120 = OpLabel + %122 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %123 = OpLoad %int %122 + %124 = OpConvertSToF %float %123 + %125 = OpCompositeConstruct %v4float %124 %124 %124 %124 + OpStore %x_GLF_v1 %125 + OpBranch %118 + %118 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %126 +%tint_symbol_1 = OpFunctionParameter %main_out + %130 = OpLabel + %131 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %131 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %133 = OpLabel + %134 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %134 + %135 = OpFunctionCall %void %main_1 + %137 = OpLoad %v4float %x_GLF_v1 + %138 = OpCompositeConstruct %main_out %137 + %136 = OpFunctionCall %void %tint_symbol_3 %138 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c2a6296053 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machine-scheduler-for-if-pow/0-opt.wgsl.expected.wgsl @@ -0,0 +1,95 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_12 : buf0; + +var x_GLF_v1 : vec4; + +fn main_1() { + var uv : vec2; + var v1 : vec4; + var a : f32; + var i : i32; + let x_49 : vec4 = gl_FragCoord; + uv = vec2(x_49.x, x_49.y); + let x_52 : f32 = x_8.x_GLF_uniform_float_values[0]; + v1 = vec4(x_52, x_52, x_52, x_52); + let x_55 : f32 = uv.y; + let x_57 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_55 >= x_57)) { + let x_62 : f32 = x_8.x_GLF_uniform_float_values[2]; + v1.x = x_62; + let x_65 : f32 = x_8.x_GLF_uniform_float_values[0]; + v1.y = x_65; + let x_68 : f32 = x_8.x_GLF_uniform_float_values[0]; + v1.z = x_68; + let x_71 : f32 = x_8.x_GLF_uniform_float_values[2]; + v1.w = x_71; + } + let x_74 : f32 = x_8.x_GLF_uniform_float_values[2]; + a = x_74; + let x_15 : i32 = x_12.x_GLF_uniform_int_values[1]; + i = x_15; + loop { + let x_16 : i32 = i; + let x_17 : i32 = x_12.x_GLF_uniform_int_values[0]; + if ((x_16 < x_17)) { + } else { + break; + } + let x_84 : f32 = x_8.x_GLF_uniform_float_values[2]; + let x_86 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_84 < x_86)) { + discard; + } + let x_91 : f32 = v1.x; + let x_93 : f32 = v1.y; + let x_96 : f32 = v1.z; + let x_99 : f32 = v1.w; + let x_102 : f32 = x_8.x_GLF_uniform_float_values[3]; + a = pow((((x_91 + x_93) + x_96) + x_99), x_102); + + continuing { + let x_18 : i32 = i; + i = (x_18 + 1); + } + } + let x_104 : f32 = a; + let x_106 : f32 = x_8.x_GLF_uniform_float_values[1]; + if ((x_104 == x_106)) { + let x_111 : vec4 = v1; + x_GLF_v1 = x_111; + } else { + let x_20 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_113 : f32 = f32(x_20); + x_GLF_v1 = vec4(x_113, x_113, x_113, x_113); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_v1_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_v1); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm new file mode 100644 index 0000000000..25ac71de9e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm @@ -0,0 +1,92 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %27 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %28 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %i + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %35 = OpLoad %float %34 + %36 = OpConvertFToS %int %35 + %37 = OpSLessThan %bool %33 %36 + OpBranchConditional %37 %38 %30 + %38 = OpLabel + %39 = OpLoad %int %a + %40 = OpSGreaterThan %bool %39 %int_0 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + OpBranch %30 + %41 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %44 = OpLoad %float %43 + %45 = OpConvertFToS %int %44 + %46 = OpIMul %int %45 %int_2 + %47 = OpSDiv %int %46 %int_2 + OpStore %a %47 + OpBranch %31 + %31 = OpLabel + %48 = OpLoad %int %i + %49 = OpIAdd %int %48 %int_1 + OpStore %i %49 + OpBranch %29 + %30 = OpLabel + %50 = OpLoad %int %a + %51 = OpIEqual %bool %50 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpStore %_GLF_color %26 + OpBranch %52 + %54 = OpLabel + OpStore %_GLF_color %27 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..13e0966390 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,47 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + a = 0; + i = 0; + while (true) { + const int x_33 = i; + const float x_35 = asfloat(x_7[0].y); + if ((x_33 < int(x_35))) { + } else { + break; + } + if ((a > 0)) { + break; + } + const float x_44 = asfloat(x_7[0].y); + a = ((int(x_44) * 2) / 2); + { + i = (i + 1); + } + } + if ((a == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..813f700c65 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,53 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + a = 0; + i = 0; + while (true) { + int const x_33 = i; + float const x_35 = x_7.injectionSwitch.y; + if ((x_33 < int(x_35))) { + } else { + break; + } + int const x_39 = a; + if ((x_39 > 0)) { + break; + } + float const x_44 = x_7.injectionSwitch.y; + a = ((int(x_44) * 2) / 2); + { + int const x_48 = i; + i = (x_48 + 1); + } + } + int const x_50 = a; + if ((x_50 == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..abd2c6bfa0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,130 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %59 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %60 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %61 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %19 + %i = OpVariable %_ptr_Function_int Function %19 + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %22 + %22 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %int %i + %31 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %32 = OpLoad %float %31 + %33 = OpConvertFToS %int %32 + %34 = OpSLessThan %bool %26 %33 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %38 + %37 = OpLabel + OpBranch %36 + %38 = OpLabel + OpBranch %23 + %36 = OpLabel + %39 = OpLoad %int %a + %40 = OpSGreaterThan %bool %39 %int_0 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + OpBranch %23 + %41 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %44 = OpLoad %float %43 + %45 = OpConvertFToS %int %44 + %47 = OpIMul %int %45 %int_2 + %48 = OpSDiv %int %47 %int_2 + OpStore %a %48 + OpBranch %24 + %24 = OpLabel + %49 = OpLoad %int %i + %51 = OpIAdd %int %49 %int_1 + OpStore %i %51 + OpBranch %22 + %23 = OpLabel + %52 = OpLoad %int %a + %53 = OpIEqual %bool %52 %int_1 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + OpStore %x_GLF_color %59 + OpBranch %54 + %56 = OpLabel + OpStore %x_GLF_color %60 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %61 +%tint_symbol = OpFunctionParameter %main_out + %65 = OpLabel + %66 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %66 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %68 = OpLabel + %69 = OpFunctionCall %void %main_1 + %71 = OpLoad %v4float %x_GLF_color + %72 = OpCompositeConstruct %main_out %71 + %70 = OpFunctionCall %void %tint_symbol_2 %72 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..238c476307 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,52 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + a = 0; + i = 0; + loop { + let x_33 : i32 = i; + let x_35 : f32 = x_7.injectionSwitch.y; + if ((x_33 < i32(x_35))) { + } else { + break; + } + let x_39 : i32 = a; + if ((x_39 > 0)) { + break; + } + let x_44 : f32 = x_7.injectionSwitch.y; + a = ((i32(x_44) * 2) / 2); + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_50 : i32 = a; + if ((x_50 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl new file mode 100644 index 0000000000..238c476307 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl @@ -0,0 +1,52 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + a = 0; + i = 0; + loop { + let x_33 : i32 = i; + let x_35 : f32 = x_7.injectionSwitch.y; + if ((x_33 < i32(x_35))) { + } else { + break; + } + let x_39 : i32 = a; + if ((x_39 > 0)) { + break; + } + let x_44 : f32 = x_7.injectionSwitch.y; + a = ((i32(x_44) * 2) / 2); + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_50 : i32 = a; + if ((x_50 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..13e0966390 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,47 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + a = 0; + i = 0; + while (true) { + const int x_33 = i; + const float x_35 = asfloat(x_7[0].y); + if ((x_33 < int(x_35))) { + } else { + break; + } + if ((a > 0)) { + break; + } + const float x_44 = asfloat(x_7[0].y); + a = ((int(x_44) * 2) / 2); + { + i = (i + 1); + } + } + if ((a == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..813f700c65 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,53 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + a = 0; + i = 0; + while (true) { + int const x_33 = i; + float const x_35 = x_7.injectionSwitch.y; + if ((x_33 < int(x_35))) { + } else { + break; + } + int const x_39 = a; + if ((x_39 > 0)) { + break; + } + float const x_44 = x_7.injectionSwitch.y; + a = ((int(x_44) * 2) / 2); + { + int const x_48 = i; + i = (x_48 + 1); + } + } + int const x_50 = a; + if ((x_50 == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..abd2c6bfa0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,130 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %59 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %60 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %61 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %19 + %i = OpVariable %_ptr_Function_int Function %19 + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %22 + %22 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %int %i + %31 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %32 = OpLoad %float %31 + %33 = OpConvertFToS %int %32 + %34 = OpSLessThan %bool %26 %33 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %38 + %37 = OpLabel + OpBranch %36 + %38 = OpLabel + OpBranch %23 + %36 = OpLabel + %39 = OpLoad %int %a + %40 = OpSGreaterThan %bool %39 %int_0 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + OpBranch %23 + %41 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %44 = OpLoad %float %43 + %45 = OpConvertFToS %int %44 + %47 = OpIMul %int %45 %int_2 + %48 = OpSDiv %int %47 %int_2 + OpStore %a %48 + OpBranch %24 + %24 = OpLabel + %49 = OpLoad %int %i + %51 = OpIAdd %int %49 %int_1 + OpStore %i %51 + OpBranch %22 + %23 = OpLabel + %52 = OpLoad %int %a + %53 = OpIEqual %bool %52 %int_1 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + OpStore %x_GLF_color %59 + OpBranch %54 + %56 = OpLabel + OpStore %x_GLF_color %60 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %61 +%tint_symbol = OpFunctionParameter %main_out + %65 = OpLabel + %66 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %66 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %68 = OpLabel + %69 = OpFunctionCall %void %main_1 + %71 = OpLoad %v4float %x_GLF_color + %72 = OpCompositeConstruct %main_out %71 + %70 = OpFunctionCall %void %tint_symbol_2 %72 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..238c476307 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-machinevaluetype-one-iter-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,52 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + a = 0; + i = 0; + loop { + let x_33 : i32 = i; + let x_35 : f32 = x_7.injectionSwitch.y; + if ((x_33 < i32(x_35))) { + } else { + break; + } + let x_39 : i32 = a; + if ((x_39 > 0)) { + break; + } + let x_44 : f32 = x_7.injectionSwitch.y; + a = ((i32(x_44) * 2) / 2); + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_50 : i32 = a; + if ((x_50 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm new file mode 100644 index 0000000000..363a862b5f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm @@ -0,0 +1,140 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %i "i" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 + %uint_0 = OpConstant %uint 0 + %main = OpFunction %void None %10 + %29 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpConvertSToF %float %31 + %33 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %34 = OpLoad %int %33 + %35 = OpConvertSToF %float %34 + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %37 = OpLoad %int %36 + %38 = OpConvertSToF %float %37 + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %40 = OpLoad %int %39 + %41 = OpConvertSToF %float %40 + %42 = OpCompositeConstruct %v4float %32 %35 %38 %41 + OpStore %_GLF_color %42 + %43 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %44 = OpLoad %float %43 + %45 = OpFOrdLessThan %bool %44 %float_0 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %_GLF_color %51 + OpBranch %46 + %46 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %53 = OpLoad %int %52 + OpStore %i %53 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %int %i + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %60 = OpLoad %int %59 + %61 = OpSLessThan %bool %58 %60 + OpBranchConditional %61 %62 %55 + %62 = OpLabel + %63 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %64 = OpLoad %float %63 + %65 = OpFOrdGreaterThan %bool %64 %float_0 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %66 + %67 = OpLabel + %68 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %69 = OpLoad %float %68 + %70 = OpFOrdLessThan %bool %69 %float_0 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %_GLF_color %76 + OpBranch %55 + %71 = OpLabel + OpBranch %66 + %66 = OpLabel + %77 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %78 = OpLoad %float %77 + %79 = OpFOrdGreaterThan %bool %78 %float_0 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %80 + %81 = OpLabel + %82 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %83 = OpLoad %float %82 + %84 = OpFOrdLessThan %bool %83 %float_0 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %88 + %90 = OpCompositeConstruct %v4float %89 %89 %89 %89 + OpStore %_GLF_color %90 + OpBranch %85 + %85 = OpLabel + OpBranch %80 + %80 = OpLabel + OpBranch %56 + %56 = OpLabel + %91 = OpLoad %int %i + %92 = OpIAdd %int %91 %int_1 + OpStore %i %92 + OpBranch %54 + %55 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f6e2d87667 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.hlsl @@ -0,0 +1,74 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_31 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_34 = asint(x_6[1].x); + const int x_37 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_31), float(x_34), float(x_37), float(x_40)); + const float x_44 = gl_FragCoord.y; + if ((x_44 < 0.0f)) { + const int x_49 = asint(x_6[1].x); + const float x_50 = float(x_49); + x_GLF_color = float4(x_50, x_50, x_50, x_50); + } + const int x_53 = asint(x_6[1].x); + i = x_53; + while (true) { + const int x_58 = i; + const int x_60 = asint(x_6[2].x); + if ((x_58 < x_60)) { + } else { + break; + } + const float x_64 = gl_FragCoord.x; + if ((x_64 > 0.0f)) { + const float x_69 = gl_FragCoord.y; + if ((x_69 < 0.0f)) { + const int x_74 = asint(x_6[1].x); + const float x_75 = float(x_74); + x_GLF_color = float4(x_75, x_75, x_75, x_75); + break; + } + } + const float x_78 = gl_FragCoord.x; + if ((x_78 > 0.0f)) { + const float x_83 = gl_FragCoord.y; + if ((x_83 < 0.0f)) { + const int x_88 = asint(x_6[1].x); + const float x_89 = float(x_88); + x_GLF_color = float4(x_89, x_89, x_89, x_89); + } + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..5d2d058329 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_34 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_31), float(x_34), float(x_37), float(x_40)); + float const x_44 = (*(tint_symbol_6)).y; + if ((x_44 < 0.0f)) { + int const x_49 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_50 = float(x_49); + *(tint_symbol_5) = float4(x_50, x_50, x_50, x_50); + } + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_53; + while (true) { + int const x_58 = i; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_58 < x_60)) { + } else { + break; + } + float const x_64 = (*(tint_symbol_6)).x; + if ((x_64 > 0.0f)) { + float const x_69 = (*(tint_symbol_6)).y; + if ((x_69 < 0.0f)) { + int const x_74 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_75 = float(x_74); + *(tint_symbol_5) = float4(x_75, x_75, x_75, x_75); + break; + } + } + float const x_78 = (*(tint_symbol_6)).x; + if ((x_78 > 0.0f)) { + float const x_83 = (*(tint_symbol_6)).y; + if ((x_83 < 0.0f)) { + int const x_88 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_89 = float(x_88); + *(tint_symbol_5) = float4(x_89, x_89, x_89, x_89); + } + } + { + int const x_91 = i; + i = (x_91 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..d46c0ee5f1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.spvasm @@ -0,0 +1,181 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %99 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %i = OpVariable %_ptr_Function_int Function %24 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %29 = OpLoad %int %28 + %31 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %32 = OpLoad %int %31 + %33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %34 = OpLoad %int %33 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %36 = OpLoad %int %35 + %37 = OpConvertSToF %float %29 + %38 = OpConvertSToF %float %32 + %39 = OpConvertSToF %float %34 + %40 = OpConvertSToF %float %36 + %41 = OpCompositeConstruct %v4float %37 %38 %39 %40 + OpStore %x_GLF_color %41 + %44 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %45 = OpLoad %float %44 + %47 = OpFOrdLessThan %bool %45 %float_0 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %49 + %50 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpCompositeConstruct %v4float %53 %53 %53 %53 + OpStore %x_GLF_color %54 + OpBranch %49 + %49 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %56 = OpLoad %int %55 + OpStore %i %56 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %i + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpSLessThan %bool %61 %64 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %67 = OpLabel + OpBranch %66 + %68 = OpLabel + OpBranch %58 + %66 = OpLabel + %69 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %70 = OpLoad %float %69 + %71 = OpFOrdGreaterThan %bool %70 %float_0 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + %74 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %75 = OpLoad %float %74 + %76 = OpFOrdLessThan %bool %75 %float_0 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %80 + %82 = OpCompositeConstruct %v4float %81 %81 %81 %81 + OpStore %x_GLF_color %82 + OpBranch %58 + %77 = OpLabel + OpBranch %72 + %72 = OpLabel + %83 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %84 = OpLoad %float %83 + %85 = OpFOrdGreaterThan %bool %84 %float_0 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %89 = OpLoad %float %88 + %90 = OpFOrdLessThan %bool %89 %float_0 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + %93 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %94 = OpLoad %int %93 + %95 = OpConvertSToF %float %94 + %96 = OpCompositeConstruct %v4float %95 %95 %95 %95 + OpStore %x_GLF_color %96 + OpBranch %91 + %91 = OpLabel + OpBranch %86 + %86 = OpLabel + OpBranch %59 + %59 = OpLabel + %97 = OpLoad %int %i + %98 = OpIAdd %int %97 %int_1 + OpStore %i %98 + OpBranch %57 + %58 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %99 +%tint_symbol_1 = OpFunctionParameter %main_out + %103 = OpLabel + %104 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %104 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %106 = OpLabel + %107 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %107 + %108 = OpFunctionCall %void %main_1 + %110 = OpLoad %v4float %x_GLF_color + %111 = OpCompositeConstruct %main_out %110 + %109 = OpFunctionCall %void %tint_symbol_3 %111 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..1eebdd96c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.spvasm.expected.wgsl @@ -0,0 +1,74 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +fn main_1() { + var i : i32; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_31), f32(x_34), f32(x_37), f32(x_40)); + let x_44 : f32 = gl_FragCoord.y; + if ((x_44 < 0.0)) { + let x_49 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_50 : f32 = f32(x_49); + x_GLF_color = vec4(x_50, x_50, x_50, x_50); + } + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_53; + loop { + let x_58 : i32 = i; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_58 < x_60)) { + } else { + break; + } + let x_64 : f32 = gl_FragCoord.x; + if ((x_64 > 0.0)) { + let x_69 : f32 = gl_FragCoord.y; + if ((x_69 < 0.0)) { + let x_74 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_75 : f32 = f32(x_74); + x_GLF_color = vec4(x_75, x_75, x_75, x_75); + break; + } + } + let x_78 : f32 = gl_FragCoord.x; + if ((x_78 > 0.0)) { + let x_83 : f32 = gl_FragCoord.y; + if ((x_83 < 0.0)) { + let x_88 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_89 : f32 = f32(x_88); + x_GLF_color = vec4(x_89, x_89, x_89, x_89); + } + } + + continuing { + let x_91 : i32 = i; + i = (x_91 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl new file mode 100644 index 0000000000..1eebdd96c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl @@ -0,0 +1,74 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +fn main_1() { + var i : i32; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_31), f32(x_34), f32(x_37), f32(x_40)); + let x_44 : f32 = gl_FragCoord.y; + if ((x_44 < 0.0)) { + let x_49 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_50 : f32 = f32(x_49); + x_GLF_color = vec4(x_50, x_50, x_50, x_50); + } + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_53; + loop { + let x_58 : i32 = i; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_58 < x_60)) { + } else { + break; + } + let x_64 : f32 = gl_FragCoord.x; + if ((x_64 > 0.0)) { + let x_69 : f32 = gl_FragCoord.y; + if ((x_69 < 0.0)) { + let x_74 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_75 : f32 = f32(x_74); + x_GLF_color = vec4(x_75, x_75, x_75, x_75); + break; + } + } + let x_78 : f32 = gl_FragCoord.x; + if ((x_78 > 0.0)) { + let x_83 : f32 = gl_FragCoord.y; + if ((x_83 < 0.0)) { + let x_88 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_89 : f32 = f32(x_88); + x_GLF_color = vec4(x_89, x_89, x_89, x_89); + } + } + + continuing { + let x_91 : i32 = i; + i = (x_91 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f6e2d87667 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.hlsl @@ -0,0 +1,74 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_31 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const int x_34 = asint(x_6[1].x); + const int x_37 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_31), float(x_34), float(x_37), float(x_40)); + const float x_44 = gl_FragCoord.y; + if ((x_44 < 0.0f)) { + const int x_49 = asint(x_6[1].x); + const float x_50 = float(x_49); + x_GLF_color = float4(x_50, x_50, x_50, x_50); + } + const int x_53 = asint(x_6[1].x); + i = x_53; + while (true) { + const int x_58 = i; + const int x_60 = asint(x_6[2].x); + if ((x_58 < x_60)) { + } else { + break; + } + const float x_64 = gl_FragCoord.x; + if ((x_64 > 0.0f)) { + const float x_69 = gl_FragCoord.y; + if ((x_69 < 0.0f)) { + const int x_74 = asint(x_6[1].x); + const float x_75 = float(x_74); + x_GLF_color = float4(x_75, x_75, x_75, x_75); + break; + } + } + const float x_78 = gl_FragCoord.x; + if ((x_78 > 0.0f)) { + const float x_83 = gl_FragCoord.y; + if ((x_83 < 0.0f)) { + const int x_88 = asint(x_6[1].x); + const float x_89 = float(x_88); + x_GLF_color = float4(x_89, x_89, x_89, x_89); + } + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..5d2d058329 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_34 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_31), float(x_34), float(x_37), float(x_40)); + float const x_44 = (*(tint_symbol_6)).y; + if ((x_44 < 0.0f)) { + int const x_49 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_50 = float(x_49); + *(tint_symbol_5) = float4(x_50, x_50, x_50, x_50); + } + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_53; + while (true) { + int const x_58 = i; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_58 < x_60)) { + } else { + break; + } + float const x_64 = (*(tint_symbol_6)).x; + if ((x_64 > 0.0f)) { + float const x_69 = (*(tint_symbol_6)).y; + if ((x_69 < 0.0f)) { + int const x_74 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_75 = float(x_74); + *(tint_symbol_5) = float4(x_75, x_75, x_75, x_75); + break; + } + } + float const x_78 = (*(tint_symbol_6)).x; + if ((x_78 > 0.0f)) { + float const x_83 = (*(tint_symbol_6)).y; + if ((x_83 < 0.0f)) { + int const x_88 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_89 = float(x_88); + *(tint_symbol_5) = float4(x_89, x_89, x_89, x_89); + } + } + { + int const x_91 = i; + i = (x_91 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..d46c0ee5f1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.spvasm @@ -0,0 +1,181 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %99 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %i = OpVariable %_ptr_Function_int Function %24 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %29 = OpLoad %int %28 + %31 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %32 = OpLoad %int %31 + %33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %34 = OpLoad %int %33 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %36 = OpLoad %int %35 + %37 = OpConvertSToF %float %29 + %38 = OpConvertSToF %float %32 + %39 = OpConvertSToF %float %34 + %40 = OpConvertSToF %float %36 + %41 = OpCompositeConstruct %v4float %37 %38 %39 %40 + OpStore %x_GLF_color %41 + %44 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %45 = OpLoad %float %44 + %47 = OpFOrdLessThan %bool %45 %float_0 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %49 + %50 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpCompositeConstruct %v4float %53 %53 %53 %53 + OpStore %x_GLF_color %54 + OpBranch %49 + %49 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %56 = OpLoad %int %55 + OpStore %i %56 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %i + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpSLessThan %bool %61 %64 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %67 = OpLabel + OpBranch %66 + %68 = OpLabel + OpBranch %58 + %66 = OpLabel + %69 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %70 = OpLoad %float %69 + %71 = OpFOrdGreaterThan %bool %70 %float_0 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + %74 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %75 = OpLoad %float %74 + %76 = OpFOrdLessThan %bool %75 %float_0 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %80 + %82 = OpCompositeConstruct %v4float %81 %81 %81 %81 + OpStore %x_GLF_color %82 + OpBranch %58 + %77 = OpLabel + OpBranch %72 + %72 = OpLabel + %83 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %84 = OpLoad %float %83 + %85 = OpFOrdGreaterThan %bool %84 %float_0 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %89 = OpLoad %float %88 + %90 = OpFOrdLessThan %bool %89 %float_0 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + %93 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %94 = OpLoad %int %93 + %95 = OpConvertSToF %float %94 + %96 = OpCompositeConstruct %v4float %95 %95 %95 %95 + OpStore %x_GLF_color %96 + OpBranch %91 + %91 = OpLabel + OpBranch %86 + %86 = OpLabel + OpBranch %59 + %59 = OpLabel + %97 = OpLoad %int %i + %98 = OpIAdd %int %97 %int_1 + OpStore %i %98 + OpBranch %57 + %58 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %99 +%tint_symbol_1 = OpFunctionParameter %main_out + %103 = OpLabel + %104 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %104 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %106 = OpLabel + %107 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %107 + %108 = OpFunctionCall %void %main_1 + %110 = OpLoad %v4float %x_GLF_color + %111 = OpCompositeConstruct %main_out %110 + %109 = OpFunctionCall %void %tint_symbol_3 %111 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..1eebdd96c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-conditions-break/0-opt.wgsl.expected.wgsl @@ -0,0 +1,74 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +fn main_1() { + var i : i32; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_31), f32(x_34), f32(x_37), f32(x_40)); + let x_44 : f32 = gl_FragCoord.y; + if ((x_44 < 0.0)) { + let x_49 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_50 : f32 = f32(x_49); + x_GLF_color = vec4(x_50, x_50, x_50, x_50); + } + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_53; + loop { + let x_58 : i32 = i; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_58 < x_60)) { + } else { + break; + } + let x_64 : f32 = gl_FragCoord.x; + if ((x_64 > 0.0)) { + let x_69 : f32 = gl_FragCoord.y; + if ((x_69 < 0.0)) { + let x_74 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_75 : f32 = f32(x_74); + x_GLF_color = vec4(x_75, x_75, x_75, x_75); + break; + } + } + let x_78 : f32 = gl_FragCoord.x; + if ((x_78 > 0.0)) { + let x_83 : f32 = gl_FragCoord.y; + if ((x_83 < 0.0)) { + let x_88 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_89 : f32 = f32(x_88); + x_GLF_color = vec4(x_89, x_89, x_89, x_89); + } + } + + continuing { + let x_91 : i32 = i; + i = (x_91 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm new file mode 100644 index 0000000000..4d16e49ce6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm @@ -0,0 +1,175 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %func_i1_ "func(i1;" + OpName %x "x" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %indexable "indexable" + OpName %a_0 "a" + OpName %param "param" + OpName %param_0 "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpTypeFunction %int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 +%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4 + %true = OpConstantTrue %bool + %int_4 = OpConstant %int 4 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %16 + %37 = OpLabel + %a_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %39 = OpLoad %int %38 + OpStore %param %39 + %40 = OpFunctionCall %int %func_i1_ %param + OpStore %a_0 %40 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %42 = OpLoad %int %41 + OpStore %param_0 %42 + %43 = OpFunctionCall %int %func_i1_ %param_0 + %44 = OpLoad %int %a_0 + %45 = OpIAdd %int %44 %43 + OpStore %a_0 %45 + %46 = OpLoad %int %a_0 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %48 = OpLoad %int %47 + %49 = OpIEqual %bool %46 %48 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %54 + %56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %63 = OpLoad %int %62 + %64 = OpConvertSToF %float %63 + %65 = OpCompositeConstruct %v4float %55 %58 %61 %64 + OpStore %_GLF_color %65 + OpBranch %50 + %52 = OpLabel + %66 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %67 + %69 = OpCompositeConstruct %v4float %68 %68 %68 %68 + OpStore %_GLF_color %69 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd + %func_i1_ = OpFunction %int None %19 + %x = OpFunctionParameter %_ptr_Function_int + %70 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %indexable = OpVariable %_ptr_Function__arr_int_uint_4 Function + %71 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %72 = OpLoad %int %71 + OpStore %a %72 + %73 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %74 = OpLoad %int %73 + OpStore %i %74 + OpBranch %75 + %75 = OpLabel + OpLoopMerge %76 %77 None + OpBranch %78 + %78 = OpLabel + %79 = OpLoad %int %i + %80 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpSLessThan %bool %79 %81 + OpBranchConditional %82 %83 %76 + %83 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %91 = OpLoad %int %90 + %92 = OpCompositeConstruct %_arr_int_uint_4 %85 %87 %89 %91 + %93 = OpLoad %int %a + OpStore %indexable %92 + %94 = OpAccessChain %_ptr_Function_int %indexable %93 + %95 = OpLoad %int %94 + %96 = OpLoad %int %x + %97 = OpSGreaterThan %bool %95 %96 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %100 + %99 = OpLabel + OpSelectionMerge %101 None + OpBranchConditional %true %102 %103 + %102 = OpLabel + %104 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %105 = OpLoad %int %104 + OpReturnValue %105 + %103 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %107 = OpLoad %int %106 + OpStore %a %107 + OpBranch %101 + %101 = OpLabel + OpBranch %98 + %100 = OpLabel + OpSelectionMerge %108 None + OpBranchConditional %true %109 %108 + %109 = OpLabel + %110 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %111 = OpLoad %int %110 + OpReturnValue %111 + %108 = OpLabel + OpBranch %98 + %98 = OpLabel + OpBranch %77 + %77 = OpLabel + %112 = OpLoad %int %i + %113 = OpIAdd %int %112 %int_1 + OpStore %i %113 + OpBranch %75 + %76 = OpLabel + %114 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %115 = OpLoad %int %114 + OpReturnValue %115 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..cf463e7a64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,99 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_i1_(inout int x) { + int a = 0; + int i = 0; + int indexable[4] = (int[4])0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_72 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + a = x_72; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + i = x_74; + while (true) { + const int x_79 = i; + const int x_81 = asint(x_8[1].x); + if ((x_79 < x_81)) { + } else { + break; + } + const int x_85 = asint(x_8[3].x); + const int x_87 = asint(x_8[3].x); + const int x_89 = asint(x_8[3].x); + const int x_91 = asint(x_8[3].x); + const int x_93 = a; + const int tint_symbol_3[4] = {x_85, x_87, x_89, x_91}; + indexable = tint_symbol_3; + const int x_95 = indexable[x_93]; + const int x_96 = x; + if ((x_95 > x_96)) { + if (true) { + const int x_105 = asint(x_8[3].x); + return x_105; + } else { + const int x_107 = asint(x_8[3].x); + a = x_107; + } + } else { + if (true) { + const int x_111 = asint(x_8[4].x); + return x_111; + } + } + { + i = (i + 1); + } + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_115 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + return x_115; +} + +void main_1() { + int a_1 = 0; + int param = 0; + int param_1 = 0; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_39 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + param = x_39; + const int x_40 = func_i1_(param); + a_1 = x_40; + const int x_42 = asint(x_8[3].x); + param_1 = x_42; + const int x_43 = func_i1_(param_1); + a_1 = (a_1 + x_43); + const int x_46 = a_1; + const int x_48 = asint(x_8[2].x); + if ((x_46 == x_48)) { + const int x_54 = asint(x_8[3].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_60 = asint(x_8[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_63 = asint(x_8[3].x); + x_GLF_color = float4(float(x_54), float(x_57), float(x_60), float(x_63)); + } else { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_67 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_68 = float(x_67); + x_GLF_color = float4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f72fd0ab9b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,107 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[4]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_i1_(constant buf0& x_8, thread int* const x) { + int a = 0; + int i = 0; + tint_array_wrapper_1 indexable = {}; + int const x_72 = x_8.x_GLF_uniform_int_values.arr[0].el; + a = x_72; + int const x_74 = x_8.x_GLF_uniform_int_values.arr[0].el; + i = x_74; + while (true) { + int const x_79 = i; + int const x_81 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_79 < x_81)) { + } else { + break; + } + int const x_85 = x_8.x_GLF_uniform_int_values.arr[3].el; + int const x_87 = x_8.x_GLF_uniform_int_values.arr[3].el; + int const x_89 = x_8.x_GLF_uniform_int_values.arr[3].el; + int const x_91 = x_8.x_GLF_uniform_int_values.arr[3].el; + int const x_93 = a; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_85, x_87, x_89, x_91}}; + indexable = tint_symbol_3; + int const x_95 = indexable.arr[x_93]; + int const x_96 = *(x); + if ((x_95 > x_96)) { + if (true) { + int const x_105 = x_8.x_GLF_uniform_int_values.arr[3].el; + return x_105; + } else { + int const x_107 = x_8.x_GLF_uniform_int_values.arr[3].el; + a = x_107; + } + } else { + if (true) { + int const x_111 = x_8.x_GLF_uniform_int_values.arr[4].el; + return x_111; + } + } + { + int const x_112 = i; + i = (x_112 + 1); + } + } + int const x_115 = x_8.x_GLF_uniform_int_values.arr[0].el; + return x_115; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5) { + int a_1 = 0; + int param = 0; + int param_1 = 0; + int const x_39 = x_8.x_GLF_uniform_int_values.arr[0].el; + param = x_39; + int const x_40 = func_i1_(x_8, &(param)); + a_1 = x_40; + int const x_42 = x_8.x_GLF_uniform_int_values.arr[3].el; + param_1 = x_42; + int const x_43 = func_i1_(x_8, &(param_1)); + int const x_44 = a_1; + a_1 = (x_44 + x_43); + int const x_46 = a_1; + int const x_48 = x_8.x_GLF_uniform_int_values.arr[2].el; + if ((x_46 == x_48)) { + int const x_54 = x_8.x_GLF_uniform_int_values.arr[3].el; + int const x_57 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_60 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_63 = x_8.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_5) = float4(float(x_54), float(x_57), float(x_60), float(x_63)); + } else { + int const x_67 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_68 = float(x_67); + *(tint_symbol_5) = float4(x_68, x_68, x_68, x_68); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_8, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..847dc61a64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,215 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 138 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_i1_ "func_i1_" + OpName %x "x" + OpName %a "a" + OpName %i "i" + OpName %indexable "indexable" + OpName %main_1 "main_1" + OpName %a_1 "a_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_4 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpTypeFunction %int %_ptr_Function_int + %21 = OpConstantNull %int + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 +%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4 + %27 = OpConstantNull %_arr_int_uint_4 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %true = OpConstantTrue %bool + %int_4 = OpConstant %int 4 + %void = OpTypeVoid + %84 = OpTypeFunction %void + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %126 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %int None %15 + %x = OpFunctionParameter %_ptr_Function_int + %19 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %indexable = OpVariable %_ptr_Function__arr_int_uint_4 Function %27 + %31 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %32 = OpLoad %int %31 + OpStore %a %32 + %33 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %34 = OpLoad %int %33 + OpStore %i %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %int %i + %41 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpSLessThan %bool %39 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %36 + %45 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %56 = OpLoad %int %55 + %57 = OpLoad %int %a + %58 = OpCompositeConstruct %_arr_int_uint_4 %50 %52 %54 %56 + OpStore %indexable %58 + %59 = OpAccessChain %_ptr_Function_int %indexable %57 + %60 = OpLoad %int %59 + %62 = OpLoad %int %x + %63 = OpSGreaterThan %bool %60 %62 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %66 + %65 = OpLabel + OpSelectionMerge %68 None + OpBranchConditional %true %69 %70 + %69 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %72 = OpLoad %int %71 + OpReturnValue %72 + %70 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %74 = OpLoad %int %73 + OpStore %a %74 + OpBranch %68 + %68 = OpLabel + OpBranch %64 + %66 = OpLabel + OpSelectionMerge %75 None + OpBranchConditional %true %76 %75 + %76 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4 + %79 = OpLoad %int %78 + OpReturnValue %79 + %75 = OpLabel + OpBranch %64 + %64 = OpLabel + OpBranch %37 + %37 = OpLabel + %80 = OpLoad %int %i + %81 = OpIAdd %int %80 %int_1 + OpStore %i %81 + OpBranch %35 + %36 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %83 = OpLoad %int %82 + OpReturnValue %83 + OpFunctionEnd + %main_1 = OpFunction %void None %84 + %87 = OpLabel + %a_1 = OpVariable %_ptr_Function_int Function %21 + %param = OpVariable %_ptr_Function_int Function %21 + %param_1 = OpVariable %_ptr_Function_int Function %21 + %91 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %92 = OpLoad %int %91 + OpStore %param %92 + %93 = OpFunctionCall %int %func_i1_ %param + OpStore %a_1 %93 + %95 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %96 = OpLoad %int %95 + OpStore %param_1 %96 + %97 = OpFunctionCall %int %func_i1_ %param_1 + %99 = OpLoad %int %a_1 + %100 = OpIAdd %int %99 %97 + OpStore %a_1 %100 + %101 = OpLoad %int %a_1 + %103 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %104 = OpLoad %int %103 + %105 = OpIEqual %bool %101 %104 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %108 + %107 = OpLabel + %109 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %112 = OpLoad %int %111 + %113 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %114 = OpLoad %int %113 + %115 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %110 + %118 = OpConvertSToF %float %112 + %119 = OpConvertSToF %float %114 + %120 = OpConvertSToF %float %116 + %121 = OpCompositeConstruct %v4float %117 %118 %119 %120 + OpStore %x_GLF_color %121 + OpBranch %106 + %108 = OpLabel + %122 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %123 = OpLoad %int %122 + %124 = OpConvertSToF %float %123 + %125 = OpCompositeConstruct %v4float %124 %124 %124 %124 + OpStore %x_GLF_color %125 + OpBranch %106 + %106 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %126 +%tint_symbol = OpFunctionParameter %main_out + %130 = OpLabel + %131 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %131 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %84 + %133 = OpLabel + %134 = OpFunctionCall %void %main_1 + %136 = OpLoad %v4float %x_GLF_color + %137 = OpCompositeConstruct %main_out %136 + %135 = OpFunctionCall %void %tint_symbol_2 %137 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..9e7764a1f8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,97 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) -> i32 { + var a : i32; + var i : i32; + var indexable : array; + let x_72 : i32 = x_8.x_GLF_uniform_int_values[0]; + a = x_72; + let x_74 : i32 = x_8.x_GLF_uniform_int_values[0]; + i = x_74; + loop { + let x_79 : i32 = i; + let x_81 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_79 < x_81)) { + } else { + break; + } + let x_85 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_87 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_89 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_91 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_93 : i32 = a; + indexable = array(x_85, x_87, x_89, x_91); + let x_95 : i32 = indexable[x_93]; + let x_96 : i32 = *(x); + if ((x_95 > x_96)) { + if (true) { + let x_105 : i32 = x_8.x_GLF_uniform_int_values[3]; + return x_105; + } else { + let x_107 : i32 = x_8.x_GLF_uniform_int_values[3]; + a = x_107; + } + } else { + if (true) { + let x_111 : i32 = x_8.x_GLF_uniform_int_values[4]; + return x_111; + } + } + + continuing { + let x_112 : i32 = i; + i = (x_112 + 1); + } + } + let x_115 : i32 = x_8.x_GLF_uniform_int_values[0]; + return x_115; +} + +fn main_1() { + var a_1 : i32; + var param : i32; + var param_1 : i32; + let x_39 : i32 = x_8.x_GLF_uniform_int_values[0]; + param = x_39; + let x_40 : i32 = func_i1_(&(param)); + a_1 = x_40; + let x_42 : i32 = x_8.x_GLF_uniform_int_values[3]; + param_1 = x_42; + let x_43 : i32 = func_i1_(&(param_1)); + let x_44 : i32 = a_1; + a_1 = (x_44 + x_43); + let x_46 : i32 = a_1; + let x_48 : i32 = x_8.x_GLF_uniform_int_values[2]; + if ((x_46 == x_48)) { + let x_54 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_57 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_63 : i32 = x_8.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_54), f32(x_57), f32(x_60), f32(x_63)); + } else { + let x_67 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_68 : f32 = f32(x_67); + x_GLF_color = vec4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl new file mode 100644 index 0000000000..9e7764a1f8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl @@ -0,0 +1,97 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) -> i32 { + var a : i32; + var i : i32; + var indexable : array; + let x_72 : i32 = x_8.x_GLF_uniform_int_values[0]; + a = x_72; + let x_74 : i32 = x_8.x_GLF_uniform_int_values[0]; + i = x_74; + loop { + let x_79 : i32 = i; + let x_81 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_79 < x_81)) { + } else { + break; + } + let x_85 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_87 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_89 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_91 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_93 : i32 = a; + indexable = array(x_85, x_87, x_89, x_91); + let x_95 : i32 = indexable[x_93]; + let x_96 : i32 = *(x); + if ((x_95 > x_96)) { + if (true) { + let x_105 : i32 = x_8.x_GLF_uniform_int_values[3]; + return x_105; + } else { + let x_107 : i32 = x_8.x_GLF_uniform_int_values[3]; + a = x_107; + } + } else { + if (true) { + let x_111 : i32 = x_8.x_GLF_uniform_int_values[4]; + return x_111; + } + } + + continuing { + let x_112 : i32 = i; + i = (x_112 + 1); + } + } + let x_115 : i32 = x_8.x_GLF_uniform_int_values[0]; + return x_115; +} + +fn main_1() { + var a_1 : i32; + var param : i32; + var param_1 : i32; + let x_39 : i32 = x_8.x_GLF_uniform_int_values[0]; + param = x_39; + let x_40 : i32 = func_i1_(&(param)); + a_1 = x_40; + let x_42 : i32 = x_8.x_GLF_uniform_int_values[3]; + param_1 = x_42; + let x_43 : i32 = func_i1_(&(param_1)); + let x_44 : i32 = a_1; + a_1 = (x_44 + x_43); + let x_46 : i32 = a_1; + let x_48 : i32 = x_8.x_GLF_uniform_int_values[2]; + if ((x_46 == x_48)) { + let x_54 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_57 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_63 : i32 = x_8.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_54), f32(x_57), f32(x_60), f32(x_63)); + } else { + let x_67 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_68 : f32 = f32(x_67); + x_GLF_color = vec4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..cf463e7a64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,99 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_i1_(inout int x) { + int a = 0; + int i = 0; + int indexable[4] = (int[4])0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_72 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + a = x_72; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + i = x_74; + while (true) { + const int x_79 = i; + const int x_81 = asint(x_8[1].x); + if ((x_79 < x_81)) { + } else { + break; + } + const int x_85 = asint(x_8[3].x); + const int x_87 = asint(x_8[3].x); + const int x_89 = asint(x_8[3].x); + const int x_91 = asint(x_8[3].x); + const int x_93 = a; + const int tint_symbol_3[4] = {x_85, x_87, x_89, x_91}; + indexable = tint_symbol_3; + const int x_95 = indexable[x_93]; + const int x_96 = x; + if ((x_95 > x_96)) { + if (true) { + const int x_105 = asint(x_8[3].x); + return x_105; + } else { + const int x_107 = asint(x_8[3].x); + a = x_107; + } + } else { + if (true) { + const int x_111 = asint(x_8[4].x); + return x_111; + } + } + { + i = (i + 1); + } + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_115 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + return x_115; +} + +void main_1() { + int a_1 = 0; + int param = 0; + int param_1 = 0; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_39 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + param = x_39; + const int x_40 = func_i1_(param); + a_1 = x_40; + const int x_42 = asint(x_8[3].x); + param_1 = x_42; + const int x_43 = func_i1_(param_1); + a_1 = (a_1 + x_43); + const int x_46 = a_1; + const int x_48 = asint(x_8[2].x); + if ((x_46 == x_48)) { + const int x_54 = asint(x_8[3].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_60 = asint(x_8[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_63 = asint(x_8[3].x); + x_GLF_color = float4(float(x_54), float(x_57), float(x_60), float(x_63)); + } else { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_67 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_68 = float(x_67); + x_GLF_color = float4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f72fd0ab9b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,107 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[4]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_i1_(constant buf0& x_8, thread int* const x) { + int a = 0; + int i = 0; + tint_array_wrapper_1 indexable = {}; + int const x_72 = x_8.x_GLF_uniform_int_values.arr[0].el; + a = x_72; + int const x_74 = x_8.x_GLF_uniform_int_values.arr[0].el; + i = x_74; + while (true) { + int const x_79 = i; + int const x_81 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_79 < x_81)) { + } else { + break; + } + int const x_85 = x_8.x_GLF_uniform_int_values.arr[3].el; + int const x_87 = x_8.x_GLF_uniform_int_values.arr[3].el; + int const x_89 = x_8.x_GLF_uniform_int_values.arr[3].el; + int const x_91 = x_8.x_GLF_uniform_int_values.arr[3].el; + int const x_93 = a; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_85, x_87, x_89, x_91}}; + indexable = tint_symbol_3; + int const x_95 = indexable.arr[x_93]; + int const x_96 = *(x); + if ((x_95 > x_96)) { + if (true) { + int const x_105 = x_8.x_GLF_uniform_int_values.arr[3].el; + return x_105; + } else { + int const x_107 = x_8.x_GLF_uniform_int_values.arr[3].el; + a = x_107; + } + } else { + if (true) { + int const x_111 = x_8.x_GLF_uniform_int_values.arr[4].el; + return x_111; + } + } + { + int const x_112 = i; + i = (x_112 + 1); + } + } + int const x_115 = x_8.x_GLF_uniform_int_values.arr[0].el; + return x_115; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5) { + int a_1 = 0; + int param = 0; + int param_1 = 0; + int const x_39 = x_8.x_GLF_uniform_int_values.arr[0].el; + param = x_39; + int const x_40 = func_i1_(x_8, &(param)); + a_1 = x_40; + int const x_42 = x_8.x_GLF_uniform_int_values.arr[3].el; + param_1 = x_42; + int const x_43 = func_i1_(x_8, &(param_1)); + int const x_44 = a_1; + a_1 = (x_44 + x_43); + int const x_46 = a_1; + int const x_48 = x_8.x_GLF_uniform_int_values.arr[2].el; + if ((x_46 == x_48)) { + int const x_54 = x_8.x_GLF_uniform_int_values.arr[3].el; + int const x_57 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_60 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_63 = x_8.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_5) = float4(float(x_54), float(x_57), float(x_60), float(x_63)); + } else { + int const x_67 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_68 = float(x_67); + *(tint_symbol_5) = float4(x_68, x_68, x_68, x_68); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_8, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..847dc61a64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,215 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 138 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_i1_ "func_i1_" + OpName %x "x" + OpName %a "a" + OpName %i "i" + OpName %indexable "indexable" + OpName %main_1 "main_1" + OpName %a_1 "a_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_4 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpTypeFunction %int %_ptr_Function_int + %21 = OpConstantNull %int + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 +%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4 + %27 = OpConstantNull %_arr_int_uint_4 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %true = OpConstantTrue %bool + %int_4 = OpConstant %int 4 + %void = OpTypeVoid + %84 = OpTypeFunction %void + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %126 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %int None %15 + %x = OpFunctionParameter %_ptr_Function_int + %19 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %indexable = OpVariable %_ptr_Function__arr_int_uint_4 Function %27 + %31 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %32 = OpLoad %int %31 + OpStore %a %32 + %33 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %34 = OpLoad %int %33 + OpStore %i %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %int %i + %41 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpSLessThan %bool %39 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %36 + %45 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %56 = OpLoad %int %55 + %57 = OpLoad %int %a + %58 = OpCompositeConstruct %_arr_int_uint_4 %50 %52 %54 %56 + OpStore %indexable %58 + %59 = OpAccessChain %_ptr_Function_int %indexable %57 + %60 = OpLoad %int %59 + %62 = OpLoad %int %x + %63 = OpSGreaterThan %bool %60 %62 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %66 + %65 = OpLabel + OpSelectionMerge %68 None + OpBranchConditional %true %69 %70 + %69 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %72 = OpLoad %int %71 + OpReturnValue %72 + %70 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %74 = OpLoad %int %73 + OpStore %a %74 + OpBranch %68 + %68 = OpLabel + OpBranch %64 + %66 = OpLabel + OpSelectionMerge %75 None + OpBranchConditional %true %76 %75 + %76 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4 + %79 = OpLoad %int %78 + OpReturnValue %79 + %75 = OpLabel + OpBranch %64 + %64 = OpLabel + OpBranch %37 + %37 = OpLabel + %80 = OpLoad %int %i + %81 = OpIAdd %int %80 %int_1 + OpStore %i %81 + OpBranch %35 + %36 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %83 = OpLoad %int %82 + OpReturnValue %83 + OpFunctionEnd + %main_1 = OpFunction %void None %84 + %87 = OpLabel + %a_1 = OpVariable %_ptr_Function_int Function %21 + %param = OpVariable %_ptr_Function_int Function %21 + %param_1 = OpVariable %_ptr_Function_int Function %21 + %91 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %92 = OpLoad %int %91 + OpStore %param %92 + %93 = OpFunctionCall %int %func_i1_ %param + OpStore %a_1 %93 + %95 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %96 = OpLoad %int %95 + OpStore %param_1 %96 + %97 = OpFunctionCall %int %func_i1_ %param_1 + %99 = OpLoad %int %a_1 + %100 = OpIAdd %int %99 %97 + OpStore %a_1 %100 + %101 = OpLoad %int %a_1 + %103 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %104 = OpLoad %int %103 + %105 = OpIEqual %bool %101 %104 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %108 + %107 = OpLabel + %109 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %112 = OpLoad %int %111 + %113 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %114 = OpLoad %int %113 + %115 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %110 + %118 = OpConvertSToF %float %112 + %119 = OpConvertSToF %float %114 + %120 = OpConvertSToF %float %116 + %121 = OpCompositeConstruct %v4float %117 %118 %119 %120 + OpStore %x_GLF_color %121 + OpBranch %106 + %108 = OpLabel + %122 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %123 = OpLoad %int %122 + %124 = OpConvertSToF %float %123 + %125 = OpCompositeConstruct %v4float %124 %124 %124 %124 + OpStore %x_GLF_color %125 + OpBranch %106 + %106 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %126 +%tint_symbol = OpFunctionParameter %main_out + %130 = OpLabel + %131 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %131 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %84 + %133 = OpLabel + %134 = OpFunctionCall %void %main_1 + %136 = OpLoad %v4float %x_GLF_color + %137 = OpCompositeConstruct %main_out %136 + %135 = OpFunctionCall %void %tint_symbol_2 %137 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..9e7764a1f8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matching-if-always-true-inside-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,97 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) -> i32 { + var a : i32; + var i : i32; + var indexable : array; + let x_72 : i32 = x_8.x_GLF_uniform_int_values[0]; + a = x_72; + let x_74 : i32 = x_8.x_GLF_uniform_int_values[0]; + i = x_74; + loop { + let x_79 : i32 = i; + let x_81 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_79 < x_81)) { + } else { + break; + } + let x_85 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_87 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_89 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_91 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_93 : i32 = a; + indexable = array(x_85, x_87, x_89, x_91); + let x_95 : i32 = indexable[x_93]; + let x_96 : i32 = *(x); + if ((x_95 > x_96)) { + if (true) { + let x_105 : i32 = x_8.x_GLF_uniform_int_values[3]; + return x_105; + } else { + let x_107 : i32 = x_8.x_GLF_uniform_int_values[3]; + a = x_107; + } + } else { + if (true) { + let x_111 : i32 = x_8.x_GLF_uniform_int_values[4]; + return x_111; + } + } + + continuing { + let x_112 : i32 = i; + i = (x_112 + 1); + } + } + let x_115 : i32 = x_8.x_GLF_uniform_int_values[0]; + return x_115; +} + +fn main_1() { + var a_1 : i32; + var param : i32; + var param_1 : i32; + let x_39 : i32 = x_8.x_GLF_uniform_int_values[0]; + param = x_39; + let x_40 : i32 = func_i1_(&(param)); + a_1 = x_40; + let x_42 : i32 = x_8.x_GLF_uniform_int_values[3]; + param_1 = x_42; + let x_43 : i32 = func_i1_(&(param_1)); + let x_44 : i32 = a_1; + a_1 = (x_44 + x_43); + let x_46 : i32 = a_1; + let x_48 : i32 = x_8.x_GLF_uniform_int_values[2]; + if ((x_46 == x_48)) { + let x_54 : i32 = x_8.x_GLF_uniform_int_values[3]; + let x_57 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_63 : i32 = x_8.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_54), f32(x_57), f32(x_60), f32(x_63)); + } else { + let x_67 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_68 : f32 = f32(x_67); + x_GLF_color = vec4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm new file mode 100644 index 0000000000..284fbe32e0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm @@ -0,0 +1,97 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %m "m" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %9 + %27 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2float Function + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %29 = OpLoad %int %28 + %30 = OpConvertSToF %float %29 + %31 = OpCompositeConstruct %v2float %30 %float_0 + %32 = OpCompositeConstruct %v2float %float_0 %30 + %33 = OpCompositeConstruct %mat2v2float %31 %32 + %34 = OpTranspose %mat2v2float %33 + %35 = OpTranspose %mat2v2float %34 + OpStore %m %35 + %36 = OpLoad %mat2v2float %m + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpConvertSToF %float %38 + %40 = OpCompositeConstruct %v2float %39 %float_0 + %41 = OpCompositeConstruct %v2float %float_0 %39 + %42 = OpCompositeConstruct %mat2v2float %40 %41 + %43 = OpCompositeExtract %v2float %36 0 + %44 = OpCompositeExtract %v2float %42 0 + %45 = OpFOrdEqual %v2bool %43 %44 + %46 = OpAll %bool %45 + %47 = OpCompositeExtract %v2float %36 1 + %48 = OpCompositeExtract %v2float %42 1 + %49 = OpFOrdEqual %v2bool %47 %48 + %50 = OpAll %bool %49 + %51 = OpLogicalAnd %bool %46 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpConvertSToF %float %56 + %58 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpCompositeConstruct %v4float %57 %60 %63 %66 + OpStore %_GLF_color %67 + OpBranch %52 + %54 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %69 + %71 = OpCompositeConstruct %v4float %70 %70 %70 %70 + OpStore %_GLF_color %71 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..7362602477 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.hlsl @@ -0,0 +1,49 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 m = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_30 = float(x_29); + m = transpose(transpose(float2x2(float2(x_30, 0.0f), float2(0.0f, x_30)))); + const float2x2 x_36 = m; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_39 = float(x_38); + const float2x2 x_42 = float2x2(float2(x_39, 0.0f), float2(0.0f, x_39)); + bool tint_tmp = all((x_36[0u] == x_42[0u])); + if (tint_tmp) { + tint_tmp = all((x_36[1u] == x_42[1u])); + } + if ((tint_tmp)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_59 = asint(x_6[1].x); + const int x_62 = asint(x_6[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_65 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_56), float(x_59), float(x_62), float(x_65)); + } else { + const int x_69 = asint(x_6[1].x); + const float x_70 = float(x_69); + x_GLF_color = float4(x_70, x_70, x_70, x_70); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4cfd1b7907 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.msl @@ -0,0 +1,51 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2x2 m = float2x2(0.0f); + int const x_29 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_30 = float(x_29); + m = transpose(transpose(float2x2(float2(x_30, 0.0f), float2(0.0f, x_30)))); + float2x2 const x_36 = m; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_39 = float(x_38); + float2x2 const x_42 = float2x2(float2(x_39, 0.0f), float2(0.0f, x_39)); + if ((all((x_36[0u] == x_42[0u])) && all((x_36[1u] == x_42[1u])))) { + int const x_56 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_59 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_56), float(x_59), float(x_62), float(x_65)); + } else { + int const x_69 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_70 = float(x_69); + *(tint_symbol_4) = float4(x_70, x_70, x_70, x_70); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b279bcfc5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.spvasm @@ -0,0 +1,135 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 90 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %23 = OpConstantNull %mat2v2float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %78 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2float Function %23 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %28 = OpLoad %int %27 + %29 = OpConvertSToF %float %28 + %33 = OpCompositeConstruct %v2float %29 %float_0 + %34 = OpCompositeConstruct %v2float %float_0 %29 + %35 = OpCompositeConstruct %mat2v2float %33 %34 + %31 = OpTranspose %mat2v2float %35 + %30 = OpTranspose %mat2v2float %31 + OpStore %m %30 + %36 = OpLoad %mat2v2float %m + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpConvertSToF %float %38 + %40 = OpCompositeConstruct %v2float %39 %float_0 + %41 = OpCompositeConstruct %v2float %float_0 %39 + %42 = OpCompositeConstruct %mat2v2float %40 %41 + %45 = OpCompositeExtract %v2float %36 0 + %46 = OpCompositeExtract %v2float %42 0 + %47 = OpFOrdEqual %v2bool %45 %46 + %43 = OpAll %bool %47 + OpSelectionMerge %49 None + OpBranchConditional %43 %50 %49 + %50 = OpLabel + %53 = OpCompositeExtract %v2float %36 1 + %54 = OpCompositeExtract %v2float %42 1 + %55 = OpFOrdEqual %v2bool %53 %54 + %51 = OpAll %bool %55 + OpBranch %49 + %49 = OpLabel + %56 = OpPhi %bool %43 %18 %51 %50 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %61 + %70 = OpConvertSToF %float %64 + %71 = OpConvertSToF %float %66 + %72 = OpConvertSToF %float %68 + %73 = OpCompositeConstruct %v4float %69 %70 %71 %72 + OpStore %x_GLF_color %73 + OpBranch %57 + %59 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpCompositeConstruct %v4float %76 %76 %76 %76 + OpStore %x_GLF_color %77 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %78 +%tint_symbol = OpFunctionParameter %main_out + %82 = OpLabel + %83 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %83 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %85 = OpLabel + %86 = OpFunctionCall %void %main_1 + %88 = OpLoad %v4float %x_GLF_color + %89 = OpCompositeConstruct %main_out %88 + %87 = OpFunctionCall %void %tint_symbol_2 %89 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..510e118328 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.spvasm.expected.wgsl @@ -0,0 +1,44 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m : mat2x2; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_30 : f32 = f32(x_29); + m = transpose(transpose(mat2x2(vec2(x_30, 0.0), vec2(0.0, x_30)))); + let x_36 : mat2x2 = m; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_39 : f32 = f32(x_38); + let x_42 : mat2x2 = mat2x2(vec2(x_39, 0.0), vec2(0.0, x_39)); + if ((all((x_36[0u] == x_42[0u])) && all((x_36[1u] == x_42[1u])))) { + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_56), f32(x_59), f32(x_62), f32(x_65)); + } else { + let x_69 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_70 : f32 = f32(x_69); + x_GLF_color = vec4(x_70, x_70, x_70, x_70); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl new file mode 100644 index 0000000000..510e118328 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl @@ -0,0 +1,44 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m : mat2x2; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_30 : f32 = f32(x_29); + m = transpose(transpose(mat2x2(vec2(x_30, 0.0), vec2(0.0, x_30)))); + let x_36 : mat2x2 = m; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_39 : f32 = f32(x_38); + let x_42 : mat2x2 = mat2x2(vec2(x_39, 0.0), vec2(0.0, x_39)); + if ((all((x_36[0u] == x_42[0u])) && all((x_36[1u] == x_42[1u])))) { + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_56), f32(x_59), f32(x_62), f32(x_65)); + } else { + let x_69 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_70 : f32 = f32(x_69); + x_GLF_color = vec4(x_70, x_70, x_70, x_70); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..7362602477 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.hlsl @@ -0,0 +1,49 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 m = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_30 = float(x_29); + m = transpose(transpose(float2x2(float2(x_30, 0.0f), float2(0.0f, x_30)))); + const float2x2 x_36 = m; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_39 = float(x_38); + const float2x2 x_42 = float2x2(float2(x_39, 0.0f), float2(0.0f, x_39)); + bool tint_tmp = all((x_36[0u] == x_42[0u])); + if (tint_tmp) { + tint_tmp = all((x_36[1u] == x_42[1u])); + } + if ((tint_tmp)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_59 = asint(x_6[1].x); + const int x_62 = asint(x_6[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_65 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_56), float(x_59), float(x_62), float(x_65)); + } else { + const int x_69 = asint(x_6[1].x); + const float x_70 = float(x_69); + x_GLF_color = float4(x_70, x_70, x_70, x_70); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4cfd1b7907 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.msl @@ -0,0 +1,51 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2x2 m = float2x2(0.0f); + int const x_29 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_30 = float(x_29); + m = transpose(transpose(float2x2(float2(x_30, 0.0f), float2(0.0f, x_30)))); + float2x2 const x_36 = m; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_39 = float(x_38); + float2x2 const x_42 = float2x2(float2(x_39, 0.0f), float2(0.0f, x_39)); + if ((all((x_36[0u] == x_42[0u])) && all((x_36[1u] == x_42[1u])))) { + int const x_56 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_59 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_56), float(x_59), float(x_62), float(x_65)); + } else { + int const x_69 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_70 = float(x_69); + *(tint_symbol_4) = float4(x_70, x_70, x_70, x_70); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b279bcfc5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.spvasm @@ -0,0 +1,135 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 90 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %23 = OpConstantNull %mat2v2float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %78 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2float Function %23 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %28 = OpLoad %int %27 + %29 = OpConvertSToF %float %28 + %33 = OpCompositeConstruct %v2float %29 %float_0 + %34 = OpCompositeConstruct %v2float %float_0 %29 + %35 = OpCompositeConstruct %mat2v2float %33 %34 + %31 = OpTranspose %mat2v2float %35 + %30 = OpTranspose %mat2v2float %31 + OpStore %m %30 + %36 = OpLoad %mat2v2float %m + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpConvertSToF %float %38 + %40 = OpCompositeConstruct %v2float %39 %float_0 + %41 = OpCompositeConstruct %v2float %float_0 %39 + %42 = OpCompositeConstruct %mat2v2float %40 %41 + %45 = OpCompositeExtract %v2float %36 0 + %46 = OpCompositeExtract %v2float %42 0 + %47 = OpFOrdEqual %v2bool %45 %46 + %43 = OpAll %bool %47 + OpSelectionMerge %49 None + OpBranchConditional %43 %50 %49 + %50 = OpLabel + %53 = OpCompositeExtract %v2float %36 1 + %54 = OpCompositeExtract %v2float %42 1 + %55 = OpFOrdEqual %v2bool %53 %54 + %51 = OpAll %bool %55 + OpBranch %49 + %49 = OpLabel + %56 = OpPhi %bool %43 %18 %51 %50 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %61 = OpLoad %int %60 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %61 + %70 = OpConvertSToF %float %64 + %71 = OpConvertSToF %float %66 + %72 = OpConvertSToF %float %68 + %73 = OpCompositeConstruct %v4float %69 %70 %71 %72 + OpStore %x_GLF_color %73 + OpBranch %57 + %59 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpCompositeConstruct %v4float %76 %76 %76 %76 + OpStore %x_GLF_color %77 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %78 +%tint_symbol = OpFunctionParameter %main_out + %82 = OpLabel + %83 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %83 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %85 = OpLabel + %86 = OpFunctionCall %void %main_1 + %88 = OpLoad %v4float %x_GLF_color + %89 = OpCompositeConstruct %main_out %88 + %87 = OpFunctionCall %void %tint_symbol_2 %89 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..510e118328 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-double-transpose/0-opt.wgsl.expected.wgsl @@ -0,0 +1,44 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m : mat2x2; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_30 : f32 = f32(x_29); + m = transpose(transpose(mat2x2(vec2(x_30, 0.0), vec2(0.0, x_30)))); + let x_36 : mat2x2 = m; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_39 : f32 = f32(x_38); + let x_42 : mat2x2 = mat2x2(vec2(x_39, 0.0), vec2(0.0, x_39)); + if ((all((x_36[0u] == x_42[0u])) && all((x_36[1u] == x_42[1u])))) { + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_56), f32(x_59), f32(x_62), f32(x_65)); + } else { + let x_69 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_70 : f32 = f32(x_69); + x_GLF_color = vec4(x_70, x_70, x_70, x_70); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm new file mode 100644 index 0000000000..2ebee33546 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm @@ -0,0 +1,98 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %m0 "m0" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %m1 "m1" + OpName %v "v" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_n0_540302277 = OpConstant %float -0.540302277 +%float_0_540302277 = OpConstant %float 0.540302277 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %11 + %33 = OpLabel + %m0 = OpVariable %_ptr_Function_mat2v2float Function + %m1 = OpVariable %_ptr_Function_mat2v2float Function + %v = OpVariable %_ptr_Function_v2float Function + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %37 = OpLoad %float %36 + %38 = OpCompositeConstruct %v2float %35 %float_n0_540302277 + %39 = OpCompositeConstruct %v2float %float_0_540302277 %37 + %40 = OpCompositeConstruct %mat2v2float %38 %39 + OpStore %m0 %40 + %41 = OpLoad %mat2v2float %m0 + %42 = OpLoad %mat2v2float %m0 + %43 = OpMatrixTimesMatrix %mat2v2float %41 %42 + OpStore %m1 %43 + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %45 = OpLoad %float %44 + %46 = OpCompositeConstruct %v2float %45 %45 + %47 = OpLoad %mat2v2float %m1 + %48 = OpVectorTimesMatrix %v2float %46 %47 + OpStore %v %48 + %49 = OpAccessChain %_ptr_Function_float %v %uint_0 + %50 = OpLoad %float %49 + %51 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %52 = OpLoad %float %51 + %53 = OpFOrdLessThan %bool %50 %52 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %60 = OpLoad %float %59 + %61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %64 = OpLoad %float %63 + %65 = OpCompositeConstruct %v4float %58 %60 %62 %64 + OpStore %_GLF_color %65 + OpBranch %54 + %56 = OpLabel + %66 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %67 = OpLoad %float %66 + %68 = OpCompositeConstruct %v4float %67 %67 %67 %67 + OpStore %_GLF_color %68 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..da225ef0df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.hlsl @@ -0,0 +1,49 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 m0 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 m1 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2 v = float2(0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_35 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_37 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + m0 = float2x2(float2(x_35, -0.540302277f), float2(0.540302277f, x_37)); + m1 = mul(m0, m0); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + v = mul(m1, float2(x_45, x_45)); + const float x_50 = v.x; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_52 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_50 < x_52)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_58 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_60 = asfloat(x_6[1].x); + const float x_62 = asfloat(x_6[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_64 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(x_58, x_60, x_62, x_64); + } else { + const float x_67 = asfloat(x_6[1].x); + x_GLF_color = float4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..ee86a7ce97 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.msl @@ -0,0 +1,56 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2x2 m0 = float2x2(0.0f); + float2x2 m1 = float2x2(0.0f); + float2 v = 0.0f; + float const x_35 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_37 = x_6.x_GLF_uniform_float_values.arr[0].el; + m0 = float2x2(float2(x_35, -0.540302277f), float2(0.540302277f, x_37)); + float2x2 const x_41 = m0; + float2x2 const x_42 = m0; + m1 = (x_41 * x_42); + float const x_45 = x_6.x_GLF_uniform_float_values.arr[0].el; + float2x2 const x_47 = m1; + v = (float2(x_45, x_45) * x_47); + float const x_50 = v.x; + float const x_52 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_50 < x_52)) { + float const x_58 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_62 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_64 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_58, x_60, x_62, x_64); + } else { + float const x_67 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_67, x_67, x_67, x_67); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..a34f0562ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 83 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m0 "m0" + OpName %m1 "m1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %22 = OpConstantNull %mat2v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpConstantNull %v2float + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_n0_540302277 = OpConstant %float -0.540302277 +%float_0_540302277 = OpConstant %float 0.540302277 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %71 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %m0 = OpVariable %_ptr_Function_mat2v2float Function %22 + %m1 = OpVariable %_ptr_Function_mat2v2float Function %22 + %v = OpVariable %_ptr_Function_v2float Function %26 + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %32 = OpLoad %float %31 + %33 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %34 = OpLoad %float %33 + %36 = OpCompositeConstruct %v2float %32 %float_n0_540302277 + %38 = OpCompositeConstruct %v2float %float_0_540302277 %34 + %39 = OpCompositeConstruct %mat2v2float %36 %38 + OpStore %m0 %39 + %40 = OpLoad %mat2v2float %m0 + %41 = OpLoad %mat2v2float %m0 + %42 = OpMatrixTimesMatrix %mat2v2float %40 %41 + OpStore %m1 %42 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpLoad %mat2v2float %m1 + %46 = OpCompositeConstruct %v2float %44 %44 + %47 = OpVectorTimesMatrix %v2float %46 %45 + OpStore %v %47 + %49 = OpAccessChain %_ptr_Function_float %v %uint_0 + %50 = OpLoad %float %49 + %51 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %52 = OpLoad %float %51 + %53 = OpFOrdLessThan %bool %50 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %56 %57 + %56 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %59 = OpLoad %float %58 + %61 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %64 = OpLoad %float %63 + %65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpCompositeConstruct %v4float %59 %62 %64 %66 + OpStore %x_GLF_color %67 + OpBranch %55 + %57 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %69 = OpLoad %float %68 + %70 = OpCompositeConstruct %v4float %69 %69 %69 %69 + OpStore %x_GLF_color %70 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %71 +%tint_symbol = OpFunctionParameter %main_out + %75 = OpLabel + %76 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %76 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %78 = OpLabel + %79 = OpFunctionCall %void %main_1 + %81 = OpLoad %v4float %x_GLF_color + %82 = OpCompositeConstruct %main_out %81 + %80 = OpFunctionCall %void %tint_symbol_2 %82 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..eff2ddf5b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.spvasm.expected.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m0 : mat2x2; + var m1 : mat2x2; + var v : vec2; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[0]; + m0 = mat2x2(vec2(x_35, -0.540302277), vec2(0.540302277, x_37)); + let x_41 : mat2x2 = m0; + let x_42 : mat2x2 = m0; + m1 = (x_41 * x_42); + let x_45 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_47 : mat2x2 = m1; + v = (vec2(x_45, x_45) * x_47); + let x_50 : f32 = v.x; + let x_52 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_50 < x_52)) { + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_64 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_58, x_60, x_62, x_64); + } else { + let x_67 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl new file mode 100644 index 0000000000..eff2ddf5b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m0 : mat2x2; + var m1 : mat2x2; + var v : vec2; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[0]; + m0 = mat2x2(vec2(x_35, -0.540302277), vec2(0.540302277, x_37)); + let x_41 : mat2x2 = m0; + let x_42 : mat2x2 = m0; + m1 = (x_41 * x_42); + let x_45 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_47 : mat2x2 = m1; + v = (vec2(x_45, x_45) * x_47); + let x_50 : f32 = v.x; + let x_52 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_50 < x_52)) { + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_64 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_58, x_60, x_62, x_64); + } else { + let x_67 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..da225ef0df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.hlsl @@ -0,0 +1,49 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 m0 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 m1 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2 v = float2(0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_35 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_37 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + m0 = float2x2(float2(x_35, -0.540302277f), float2(0.540302277f, x_37)); + m1 = mul(m0, m0); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + v = mul(m1, float2(x_45, x_45)); + const float x_50 = v.x; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_52 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_50 < x_52)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_58 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_60 = asfloat(x_6[1].x); + const float x_62 = asfloat(x_6[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_64 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(x_58, x_60, x_62, x_64); + } else { + const float x_67 = asfloat(x_6[1].x); + x_GLF_color = float4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..ee86a7ce97 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.msl @@ -0,0 +1,56 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2x2 m0 = float2x2(0.0f); + float2x2 m1 = float2x2(0.0f); + float2 v = 0.0f; + float const x_35 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_37 = x_6.x_GLF_uniform_float_values.arr[0].el; + m0 = float2x2(float2(x_35, -0.540302277f), float2(0.540302277f, x_37)); + float2x2 const x_41 = m0; + float2x2 const x_42 = m0; + m1 = (x_41 * x_42); + float const x_45 = x_6.x_GLF_uniform_float_values.arr[0].el; + float2x2 const x_47 = m1; + v = (float2(x_45, x_45) * x_47); + float const x_50 = v.x; + float const x_52 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_50 < x_52)) { + float const x_58 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_62 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_64 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_58, x_60, x_62, x_64); + } else { + float const x_67 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_67, x_67, x_67, x_67); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..a34f0562ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 83 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m0 "m0" + OpName %m1 "m1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %22 = OpConstantNull %mat2v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpConstantNull %v2float + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_n0_540302277 = OpConstant %float -0.540302277 +%float_0_540302277 = OpConstant %float 0.540302277 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %71 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %m0 = OpVariable %_ptr_Function_mat2v2float Function %22 + %m1 = OpVariable %_ptr_Function_mat2v2float Function %22 + %v = OpVariable %_ptr_Function_v2float Function %26 + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %32 = OpLoad %float %31 + %33 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %34 = OpLoad %float %33 + %36 = OpCompositeConstruct %v2float %32 %float_n0_540302277 + %38 = OpCompositeConstruct %v2float %float_0_540302277 %34 + %39 = OpCompositeConstruct %mat2v2float %36 %38 + OpStore %m0 %39 + %40 = OpLoad %mat2v2float %m0 + %41 = OpLoad %mat2v2float %m0 + %42 = OpMatrixTimesMatrix %mat2v2float %40 %41 + OpStore %m1 %42 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpLoad %mat2v2float %m1 + %46 = OpCompositeConstruct %v2float %44 %44 + %47 = OpVectorTimesMatrix %v2float %46 %45 + OpStore %v %47 + %49 = OpAccessChain %_ptr_Function_float %v %uint_0 + %50 = OpLoad %float %49 + %51 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %52 = OpLoad %float %51 + %53 = OpFOrdLessThan %bool %50 %52 + OpSelectionMerge %55 None + OpBranchConditional %53 %56 %57 + %56 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %59 = OpLoad %float %58 + %61 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %64 = OpLoad %float %63 + %65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpCompositeConstruct %v4float %59 %62 %64 %66 + OpStore %x_GLF_color %67 + OpBranch %55 + %57 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %69 = OpLoad %float %68 + %70 = OpCompositeConstruct %v4float %69 %69 %69 %69 + OpStore %x_GLF_color %70 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %71 +%tint_symbol = OpFunctionParameter %main_out + %75 = OpLabel + %76 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %76 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %78 = OpLabel + %79 = OpFunctionCall %void %main_1 + %81 = OpLoad %v4float %x_GLF_color + %82 = OpCompositeConstruct %main_out %81 + %80 = OpFunctionCall %void %tint_symbol_2 %82 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..eff2ddf5b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-matrix-square-mul-with-vector/0-opt.wgsl.expected.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m0 : mat2x2; + var m1 : mat2x2; + var v : vec2; + let x_35 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[0]; + m0 = mat2x2(vec2(x_35, -0.540302277), vec2(0.540302277, x_37)); + let x_41 : mat2x2 = m0; + let x_42 : mat2x2 = m0; + m1 = (x_41 * x_42); + let x_45 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_47 : mat2x2 = m1; + v = (vec2(x_45, x_45) * x_47); + let x_50 : f32 = v.x; + let x_52 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_50 < x_52)) { + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_64 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_58, x_60, x_62, x_64); + } else { + let x_67 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm new file mode 100644 index 0000000000..a933536474 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm @@ -0,0 +1,56 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %7 + %21 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %23 = OpLoad %int %22 + %24 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %25 = OpLoad %int %24 + %26 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %27 = OpLoad %int %26 + %28 = OpExtInst %int %1 SClamp %25 %27 %int_1 + %29 = OpExtInst %int %1 SMax %23 %28 + %30 = OpIEqual %bool %29 %int_1 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + OpStore %_GLF_color %19 + OpBranch %31 + %33 = OpLabel + OpStore %_GLF_color %20 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..60ded1e68d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.hlsl @@ -0,0 +1,30 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const int x_23 = asint(x_5[0].x); + const int x_25 = asint(x_5[0].x); + const int x_27 = asint(x_5[0].x); + if ((max(x_23, clamp(x_25, x_27, 1)) == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..dba1366002 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_23 = x_5.one; + int const x_25 = x_5.one; + int const x_27 = x_5.one; + if ((max(x_23, clamp(x_25, x_27, 1)) == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..329e139bbe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %26 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %37 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %20 = OpLoad %int %19 + %21 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %22 = OpLoad %int %21 + %23 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %24 = OpLoad %int %23 + %27 = OpExtInst %int %26 SClamp %22 %24 %int_1 + %25 = OpExtInst %int %26 SMax %20 %27 + %29 = OpIEqual %bool %25 %int_1 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpStore %x_GLF_color %36 + OpBranch %31 + %33 = OpLabel + OpStore %x_GLF_color %37 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %38 +%tint_symbol = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %main_1 + %48 = OpLoad %v4float %x_GLF_color + %49 = OpCompositeConstruct %main_out %48 + %47 = OpFunctionCall %void %tint_symbol_2 %49 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ae45234390 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.spvasm.expected.wgsl @@ -0,0 +1,31 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_23 : i32 = x_5.one; + let x_25 : i32 = x_5.one; + let x_27 : i32 = x_5.one; + if ((max(x_23, clamp(x_25, x_27, 1)) == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl new file mode 100644 index 0000000000..ae45234390 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl @@ -0,0 +1,31 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_23 : i32 = x_5.one; + let x_25 : i32 = x_5.one; + let x_27 : i32 = x_5.one; + if ((max(x_23, clamp(x_25, x_27, 1)) == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..60ded1e68d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.hlsl @@ -0,0 +1,30 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const int x_23 = asint(x_5[0].x); + const int x_25 = asint(x_5[0].x); + const int x_27 = asint(x_5[0].x); + if ((max(x_23, clamp(x_25, x_27, 1)) == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..dba1366002 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_23 = x_5.one; + int const x_25 = x_5.one; + int const x_27 = x_5.one; + if ((max(x_23, clamp(x_25, x_27, 1)) == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..329e139bbe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %26 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %37 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %20 = OpLoad %int %19 + %21 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %22 = OpLoad %int %21 + %23 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %24 = OpLoad %int %23 + %27 = OpExtInst %int %26 SClamp %22 %24 %int_1 + %25 = OpExtInst %int %26 SMax %20 %27 + %29 = OpIEqual %bool %25 %int_1 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpStore %x_GLF_color %36 + OpBranch %31 + %33 = OpLabel + OpStore %x_GLF_color %37 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %38 +%tint_symbol = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %main_1 + %48 = OpLoad %v4float %x_GLF_color + %49 = OpCompositeConstruct %main_out %48 + %47 = OpFunctionCall %void %tint_symbol_2 %49 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ae45234390 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-clamp-same-minval/0-opt.wgsl.expected.wgsl @@ -0,0 +1,31 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_23 : i32 = x_5.one; + let x_25 : i32 = x_5.one; + let x_27 : i32 = x_5.one; + if ((max(x_23, clamp(x_25, x_27, 1)) == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm new file mode 100644 index 0000000000..da3347fdcd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm @@ -0,0 +1,80 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %int_2 = OpConstant %int 2 + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %10 + %28 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %29 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %30 = OpLoad %float %29 + %31 = OpConvertFToS %int %30 + %32 = OpExtInst %int %1 SMin %int_1 %31 + %33 = OpExtInst %int %1 SMax %int_1 %32 + OpStore %a %33 + %34 = OpLoad %int %a + %35 = OpSLessThan %bool %34 %int_2 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %38 + %37 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %40 = OpLoad %int %39 + %41 = OpConvertSToF %float %40 + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %43 + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpCompositeConstruct %v4float %float_1 %41 %44 %47 + OpStore %_GLF_color %48 + OpBranch %36 + %38 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpCompositeConstruct %v4float %51 %51 %51 %51 + OpStore %_GLF_color %52 + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3ad7117c5c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.hlsl @@ -0,0 +1,43 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; + +void main_1() { + int a = 0; + const float x_30 = gl_FragCoord.x; + a = max(1, min(1, int(x_30))); + if ((a < 2)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_40 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_43 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_46 = asint(x_7[1].x); + x_GLF_color = float4(1.0f, float(x_40), float(x_43), float(x_46)); + } else { + const int x_50 = asint(x_7[1].x); + const float x_51 = float(x_50); + x_GLF_color = float4(x_51, x_51, x_51, x_51); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f106f7a5c0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int a = 0; + float const x_30 = (*(tint_symbol_5)).x; + a = max(1, min(1, int(x_30))); + int const x_34 = a; + if ((x_34 < 2)) { + int const x_40 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_43 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_46 = x_7.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_6) = float4(1.0f, float(x_40), float(x_43), float(x_46)); + } else { + int const x_50 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_51 = float(x_50); + *(tint_symbol_6) = float4(x_51, x_51, x_51, x_51); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..63a17ef2d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.spvasm @@ -0,0 +1,117 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %30 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %a = OpVariable %_ptr_Function_int Function %24 + %27 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %28 = OpLoad %float %27 + %33 = OpConvertFToS %int %28 + %32 = OpExtInst %int %30 SMin %int_1 %33 + %29 = OpExtInst %int %30 SMax %int_1 %32 + OpStore %a %29 + %34 = OpLoad %int %a + %36 = OpSLessThan %bool %34 %int_2 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %48 = OpLoad %int %47 + %50 = OpConvertSToF %float %44 + %51 = OpConvertSToF %float %46 + %52 = OpConvertSToF %float %48 + %53 = OpCompositeConstruct %v4float %float_1 %50 %51 %52 + OpStore %x_GLF_color %53 + OpBranch %38 + %40 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpCompositeConstruct %v4float %56 %56 %56 %56 + OpStore %x_GLF_color %57 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %58 +%tint_symbol_1 = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %65 = OpLabel + %66 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %66 + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_3 %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..24c75535a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.spvasm.expected.wgsl @@ -0,0 +1,42 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +fn main_1() { + var a : i32; + let x_30 : f32 = gl_FragCoord.x; + a = max(1, min(1, i32(x_30))); + let x_34 : i32 = a; + if ((x_34 < 2)) { + let x_40 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_43 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_46 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(1.0, f32(x_40), f32(x_43), f32(x_46)); + } else { + let x_50 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_51 : f32 = f32(x_50); + x_GLF_color = vec4(x_51, x_51, x_51, x_51); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl new file mode 100644 index 0000000000..24c75535a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl @@ -0,0 +1,42 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +fn main_1() { + var a : i32; + let x_30 : f32 = gl_FragCoord.x; + a = max(1, min(1, i32(x_30))); + let x_34 : i32 = a; + if ((x_34 < 2)) { + let x_40 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_43 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_46 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(1.0, f32(x_40), f32(x_43), f32(x_46)); + } else { + let x_50 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_51 : f32 = f32(x_50); + x_GLF_color = vec4(x_51, x_51, x_51, x_51); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3ad7117c5c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.hlsl @@ -0,0 +1,43 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; + +void main_1() { + int a = 0; + const float x_30 = gl_FragCoord.x; + a = max(1, min(1, int(x_30))); + if ((a < 2)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_40 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_43 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_46 = asint(x_7[1].x); + x_GLF_color = float4(1.0f, float(x_40), float(x_43), float(x_46)); + } else { + const int x_50 = asint(x_7[1].x); + const float x_51 = float(x_50); + x_GLF_color = float4(x_51, x_51, x_51, x_51); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f106f7a5c0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int a = 0; + float const x_30 = (*(tint_symbol_5)).x; + a = max(1, min(1, int(x_30))); + int const x_34 = a; + if ((x_34 < 2)) { + int const x_40 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_43 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_46 = x_7.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_6) = float4(1.0f, float(x_40), float(x_43), float(x_46)); + } else { + int const x_50 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_51 = float(x_50); + *(tint_symbol_6) = float4(x_51, x_51, x_51, x_51); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..63a17ef2d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.spvasm @@ -0,0 +1,117 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %30 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %a = OpVariable %_ptr_Function_int Function %24 + %27 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %28 = OpLoad %float %27 + %33 = OpConvertFToS %int %28 + %32 = OpExtInst %int %30 SMin %int_1 %33 + %29 = OpExtInst %int %30 SMax %int_1 %32 + OpStore %a %29 + %34 = OpLoad %int %a + %36 = OpSLessThan %bool %34 %int_2 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %48 = OpLoad %int %47 + %50 = OpConvertSToF %float %44 + %51 = OpConvertSToF %float %46 + %52 = OpConvertSToF %float %48 + %53 = OpCompositeConstruct %v4float %float_1 %50 %51 %52 + OpStore %x_GLF_color %53 + OpBranch %38 + %40 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpCompositeConstruct %v4float %56 %56 %56 %56 + OpStore %x_GLF_color %57 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %58 +%tint_symbol_1 = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %65 = OpLabel + %66 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %66 + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_3 %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..24c75535a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-max-min-less-than/0-opt.wgsl.expected.wgsl @@ -0,0 +1,42 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +fn main_1() { + var a : i32; + let x_30 : f32 = gl_FragCoord.x; + a = max(1, min(1, i32(x_30))); + let x_34 : i32 = a; + if ((x_34 < 2)) { + let x_40 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_43 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_46 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(1.0, f32(x_40), f32(x_43), f32(x_46)); + } else { + let x_50 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_51 : f32 = f32(x_50); + x_GLF_color = vec4(x_51, x_51, x_51, x_51); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm new file mode 100644 index 0000000000..5006192ab4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm @@ -0,0 +1,196 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %S "S" + OpMemberName %S 0 "a" + OpMemberName %S 1 "b" + OpMemberName %S 2 "c" + OpName %func_struct_S_i1_i1_i11_i1_ "func(struct-S-i1-i1-i11;i1;" + OpName %s "s" + OpName %x "x" + OpName %arr "arr" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %param "param" + OpName %param_0 "param" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int %int %int +%_ptr_Function_S = OpTypePointer Function %S +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpTypeFunction %int %_ptr_Function_S %_ptr_Function_int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %int_1 = OpConstant %int 1 + %int_7 = OpConstant %int 7 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_S_uint_2 = OpTypeArray %S %uint_2 +%_ptr_Function__arr_S_uint_2 = OpTypePointer Function %_arr_S_uint_2 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_12 = OpConstant %int 12 + %float_1 = OpConstant %float 1 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %main = OpFunction %void None %14 + %42 = OpLabel + %43 = OpVariable %_ptr_Function_int Function + %44 = OpVariable %_ptr_Function_bool Function %false + %arr = OpVariable %_ptr_Function__arr_S_uint_2 Function + %param = OpVariable %_ptr_Function_S Function + %param_0 = OpVariable %_ptr_Function_int Function + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Function_int %arr %50 %int_0 + OpStore %51 %int_2 + %52 = OpAccessChain %_ptr_Function_int %arr %int_1 %int_0 + %53 = OpLoad %int %52 + %54 = OpSLessThan %bool %53 %int_1 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpStore %_GLF_color %35 + OpStore %44 %true + OpBranch %46 + %57 = OpLabel + %58 = OpIAdd %int %int_2 %50 + %59 = OpAccessChain %_ptr_Function_S %arr %int_1 + %60 = OpLoad %S %59 + OpStore %param %60 + OpStore %param_0 %58 + %61 = OpLoad %int %param_0 + %62 = OpAccessChain %_ptr_Function_int %param %int_0 + %63 = OpLoad %S %param + %64 = OpCompositeInsert %S %61 %63 0 + OpStore %param %64 + %65 = OpLoad %S %param + %66 = OpCompositeExtract %int %65 0 + %67 = OpIEqual %bool %66 %int_2 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + %70 = OpLoad %S %param + %71 = OpCompositeInsert %S %int_9 %70 0 + OpStore %param %71 + OpBranch %68 + %68 = OpLabel + %72 = OpLoad %int %param_0 + %73 = OpIAdd %int %72 %int_1 + %74 = OpAccessChain %_ptr_Function_int %param %int_1 + %75 = OpLoad %S %param + %76 = OpCompositeInsert %S %73 %75 1 + OpStore %param %76 + %77 = OpLoad %int %param_0 + %78 = OpIAdd %int %77 %int_2 + %79 = OpAccessChain %_ptr_Function_int %param %int_2 + %80 = OpLoad %S %param + %81 = OpCompositeInsert %S %78 %80 2 + OpStore %param %81 + %82 = OpLoad %S %param + %83 = OpCompositeExtract %int %82 1 + %84 = OpIEqual %bool %83 %int_2 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + %87 = OpLoad %S %param + %88 = OpCompositeInsert %S %int_7 %87 1 + OpStore %param %88 + OpBranch %85 + %85 = OpLabel + %89 = OpLoad %S %param + %90 = OpCompositeExtract %int %89 0 + %91 = OpLoad %S %param + %92 = OpCompositeExtract %int %91 1 + %93 = OpIAdd %int %90 %92 + %94 = OpLoad %S %param + %95 = OpCompositeExtract %int %94 2 + %96 = OpIAdd %int %93 %95 + OpStore %43 %96 + %97 = OpLoad %int %43 + %98 = OpIEqual %bool %97 %int_12 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %101 + %100 = OpLabel + OpStore %_GLF_color %38 + OpBranch %99 + %101 = OpLabel + OpStore %_GLF_color %35 + OpBranch %99 + %99 = OpLabel + OpBranch %55 + %55 = OpLabel + OpStore %44 %true + OpBranch %46 + %47 = OpLabel + OpBranch %45 + %46 = OpLabel + OpReturn + OpFunctionEnd +%func_struct_S_i1_i1_i11_i1_ = OpFunction %int None %18 + %s = OpFunctionParameter %_ptr_Function_S + %x = OpFunctionParameter %_ptr_Function_int + %102 = OpLabel + %103 = OpLoad %int %x + %104 = OpAccessChain %_ptr_Function_int %s %int_0 + OpStore %104 %103 + %105 = OpLoad %int %104 + %106 = OpIEqual %bool %105 %int_2 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %107 + %108 = OpLabel + OpStore %104 %int_9 + OpBranch %107 + %107 = OpLabel + %109 = OpLoad %int %x + %110 = OpIAdd %int %109 %int_1 + %111 = OpAccessChain %_ptr_Function_int %s %int_1 + OpStore %111 %110 + %112 = OpLoad %int %x + %113 = OpIAdd %int %112 %int_2 + %114 = OpAccessChain %_ptr_Function_int %s %int_2 + OpStore %114 %113 + %115 = OpLoad %int %111 + %116 = OpIEqual %bool %115 %int_2 + OpSelectionMerge %117 None + OpBranchConditional %116 %118 %117 + %118 = OpLabel + OpStore %111 %int_7 + OpBranch %117 + %117 = OpLabel + %119 = OpLoad %int %104 + %120 = OpLoad %int %111 + %121 = OpIAdd %int %119 %120 + %122 = OpLoad %int %114 + %123 = OpIAdd %int %121 %122 + OpReturnValue %123 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9efb42d9f6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.hlsl @@ -0,0 +1,99 @@ +struct S { + int a; + int b; + int c; +}; + +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_43 = 0; + bool x_44 = false; + S arr[2] = (S[2])0; + S param = (S)0; + int param_1 = 0; + while (true) { + int x_50 = 0; + x_50 = asint(x_10[0].x); + arr[x_50].a = 2; + const int x_53 = arr[1].a; + if ((x_53 < 1)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_44 = true; + break; + } else { + const S x_60 = arr[1]; + param = x_60; + param_1 = (2 + asint(x_50)); + const int x_61 = param_1; + S x_64_1 = param; + x_64_1.a = x_61; + param = x_64_1; + if ((param.a == 2)) { + S x_71_1 = param; + x_71_1.a = 9; + param = x_71_1; + } + const int x_72 = param_1; + S x_76_1 = param; + x_76_1.b = (x_72 + 1); + param = x_76_1; + const int x_77 = param_1; + S x_81_1 = param; + x_81_1.c = (x_77 + 2); + param = x_81_1; + if ((param.b == 2)) { + S x_88_1 = param; + x_88_1.b = 7; + param = x_88_1; + } + x_43 = ((param.a + param.b) + param.c); + if ((x_43 == 12)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + } + x_44 = true; + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} + +int func_struct_S_i1_i1_i11_i1_(inout S s, inout int x) { + const int x_103 = x; + s.a = x_103; + const int x_105 = s.a; + if ((x_105 == 2)) { + s.a = 9; + } + const int x_109 = x; + s.b = (x_109 + 1); + const int x_112 = x; + s.c = (x_112 + 2); + const int x_115 = s.b; + if ((x_115 == 2)) { + s.b = 7; + } + const int x_119 = s.a; + const int x_120 = s.b; + const int x_122 = s.c; + return ((x_119 + x_120) + x_122); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..91c59aced0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.msl @@ -0,0 +1,120 @@ +#include + +using namespace metal; +struct S { + int a; + int b; + int c; +}; +struct buf0 { + /* 0x0000 */ int one; +}; +struct tint_array_wrapper { + S arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_10, thread float4* const tint_symbol_4) { + int x_43 = 0; + bool x_44 = false; + tint_array_wrapper arr = {}; + S param = {}; + int param_1 = 0; + while (true) { + int x_50 = 0; + x_50 = x_10.one; + arr.arr[x_50].a = 2; + int const x_53 = arr.arr[1].a; + if ((x_53 < 1)) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_44 = true; + break; + } else { + S const x_60 = arr.arr[1]; + param = x_60; + param_1 = (2 + as_type(x_50)); + int const x_61 = param_1; + S const x_63 = param; + S x_64_1 = x_63; + x_64_1.a = x_61; + S const x_64 = x_64_1; + param = x_64; + S const x_65 = param; + if ((x_65.a == 2)) { + S const x_70 = param; + S x_71_1 = x_70; + x_71_1.a = 9; + S const x_71 = x_71_1; + param = x_71; + } + int const x_72 = param_1; + S const x_75 = param; + S x_76_1 = x_75; + x_76_1.b = (x_72 + 1); + S const x_76 = x_76_1; + param = x_76; + int const x_77 = param_1; + S const x_80 = param; + S x_81_1 = x_80; + x_81_1.c = (x_77 + 2); + S const x_81 = x_81_1; + param = x_81; + S const x_82 = param; + if ((x_82.b == 2)) { + S const x_87 = param; + S x_88_1 = x_87; + x_88_1.b = 7; + S const x_88 = x_88_1; + param = x_88; + } + S const x_89 = param; + S const x_91 = param; + S const x_94 = param; + x_43 = ((x_89.a + x_91.b) + x_94.c); + int const x_97 = x_43; + if ((x_97 == 12)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + } + x_44 = true; + break; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +int func_struct_S_i1_i1_i11_i1_(thread S* const s, thread int* const x) { + int const x_103 = *(x); + (*(s)).a = x_103; + int const x_105 = (*(s)).a; + if ((x_105 == 2)) { + (*(s)).a = 9; + } + int const x_109 = *(x); + (*(s)).b = (x_109 + 1); + int const x_112 = *(x); + (*(s)).c = (x_112 + 2); + int const x_115 = (*(s)).b; + if ((x_115 == 2)) { + (*(s)).b = 7; + } + int const x_119 = (*(s)).a; + int const x_120 = (*(s)).b; + int const x_122 = (*(s)).c; + return ((x_119 + x_120) + x_122); +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..16fa1d72c3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.spvasm @@ -0,0 +1,274 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 174 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_43 "x_43" + OpName %x_44 "x_44" + OpName %S "S" + OpMemberName %S 0 "a" + OpMemberName %S 1 "b" + OpMemberName %S 2 "c" + OpName %arr "arr" + OpName %param "param" + OpName %param_1 "param_1" + OpName %x_50 "x_50" + OpName %x_64_1 "x_64_1" + OpName %x_71_1 "x_71_1" + OpName %x_76_1 "x_76_1" + OpName %x_81_1 "x_81_1" + OpName %x_88_1 "x_88_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %func_struct_S_i1_i1_i11_i1_ "func_struct_S_i1_i1_i11_i1_" + OpName %s "s" + OpName %x "x" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpMemberDecorate %S 2 Offset 8 + OpDecorate %_arr_S_uint_2 ArrayStride 12 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %S = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_S_uint_2 = OpTypeArray %S %uint_2 +%_ptr_Function__arr_S_uint_2 = OpTypePointer Function %_arr_S_uint_2 + %30 = OpConstantNull %_arr_S_uint_2 +%_ptr_Function_S = OpTypePointer Function %S + %33 = OpConstantNull %S + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %55 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %true = OpConstantTrue %bool + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 + %int_7 = OpConstant %int 7 + %int_12 = OpConstant %int 12 + %float_1 = OpConstant %float 1 + %115 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %116 = OpTypeFunction %void %main_out + %128 = OpTypeFunction %int %_ptr_Function_S %_ptr_Function_int + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_43 = OpVariable %_ptr_Function_int Function %18 + %x_44 = OpVariable %_ptr_Function_bool Function %23 + %arr = OpVariable %_ptr_Function__arr_S_uint_2 Function %30 + %param = OpVariable %_ptr_Function_S Function %33 + %param_1 = OpVariable %_ptr_Function_int Function %18 + %x_50 = OpVariable %_ptr_Function_int Function %18 + %x_64_1 = OpVariable %_ptr_Function_S Function %33 + %x_71_1 = OpVariable %_ptr_Function_S Function %33 + %x_76_1 = OpVariable %_ptr_Function_S Function %33 + %x_81_1 = OpVariable %_ptr_Function_S Function %33 + %x_88_1 = OpVariable %_ptr_Function_S Function %33 + OpStore %x_44 %false + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 + %43 = OpLoad %int %42 + OpStore %x_50 %43 + %44 = OpLoad %int %x_50 + %45 = OpAccessChain %_ptr_Function_int %arr %44 %uint_0 + OpStore %45 %int_2 + %48 = OpAccessChain %_ptr_Function_int %arr %int_1 %uint_0 + %49 = OpLoad %int %48 + %50 = OpSLessThan %bool %49 %int_1 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpStore %x_GLF_color %55 + OpStore %x_44 %true + OpBranch %36 + %53 = OpLabel + %57 = OpAccessChain %_ptr_Function_S %arr %int_1 + %58 = OpLoad %S %57 + OpStore %param %58 + %60 = OpLoad %int %x_50 + %59 = OpCopyObject %int %60 + %61 = OpIAdd %int %int_2 %59 + OpStore %param_1 %61 + %62 = OpLoad %int %param_1 + %63 = OpLoad %S %param + OpStore %x_64_1 %63 + %65 = OpAccessChain %_ptr_Function_int %x_64_1 %uint_0 + OpStore %65 %62 + %66 = OpLoad %S %x_64_1 + OpStore %param %66 + %67 = OpLoad %S %param + %68 = OpCompositeExtract %int %67 0 + %69 = OpIEqual %bool %68 %int_2 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpLoad %S %param + OpStore %x_71_1 %72 + %74 = OpAccessChain %_ptr_Function_int %x_71_1 %uint_0 + OpStore %74 %int_9 + %76 = OpLoad %S %x_71_1 + OpStore %param %76 + OpBranch %70 + %70 = OpLabel + %77 = OpLoad %int %param_1 + %78 = OpLoad %S %param + OpStore %x_76_1 %78 + %81 = OpAccessChain %_ptr_Function_int %x_76_1 %uint_1 + %82 = OpIAdd %int %77 %int_1 + OpStore %81 %82 + %83 = OpLoad %S %x_76_1 + OpStore %param %83 + %84 = OpLoad %int %param_1 + %85 = OpLoad %S %param + OpStore %x_81_1 %85 + %87 = OpAccessChain %_ptr_Function_int %x_81_1 %uint_2 + %88 = OpIAdd %int %84 %int_2 + OpStore %87 %88 + %89 = OpLoad %S %x_81_1 + OpStore %param %89 + %90 = OpLoad %S %param + %91 = OpCompositeExtract %int %90 1 + %92 = OpIEqual %bool %91 %int_2 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + %95 = OpLoad %S %param + OpStore %x_88_1 %95 + %97 = OpAccessChain %_ptr_Function_int %x_88_1 %uint_1 + OpStore %97 %int_7 + %99 = OpLoad %S %x_88_1 + OpStore %param %99 + OpBranch %93 + %93 = OpLabel + %100 = OpLoad %S %param + %101 = OpLoad %S %param + %102 = OpLoad %S %param + %103 = OpCompositeExtract %int %100 0 + %104 = OpCompositeExtract %int %101 1 + %105 = OpIAdd %int %103 %104 + %106 = OpCompositeExtract %int %102 2 + %107 = OpIAdd %int %105 %106 + OpStore %x_43 %107 + %108 = OpLoad %int %x_43 + %110 = OpIEqual %bool %108 %int_12 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %113 + %112 = OpLabel + OpStore %x_GLF_color %115 + OpBranch %111 + %113 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %111 + %111 = OpLabel + OpBranch %51 + %51 = OpLabel + OpStore %x_44 %true + OpBranch %36 + %37 = OpLabel + OpBranch %35 + %36 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %116 +%tint_symbol = OpFunctionParameter %main_out + %120 = OpLabel + %121 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %121 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %123 = OpLabel + %124 = OpFunctionCall %void %main_1 + %126 = OpLoad %v4float %x_GLF_color + %127 = OpCompositeConstruct %main_out %126 + %125 = OpFunctionCall %void %tint_symbol_2 %127 + OpReturn + OpFunctionEnd +%func_struct_S_i1_i1_i11_i1_ = OpFunction %int None %128 + %s = OpFunctionParameter %_ptr_Function_S + %x = OpFunctionParameter %_ptr_Function_int + %132 = OpLabel + %134 = OpLoad %int %x + %136 = OpAccessChain %_ptr_Function_int %s %uint_0 + OpStore %136 %134 + %138 = OpAccessChain %_ptr_Function_int %s %uint_0 + %139 = OpLoad %int %138 + %140 = OpIEqual %bool %139 %int_2 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + %144 = OpAccessChain %_ptr_Function_int %s %uint_0 + OpStore %144 %int_9 + OpBranch %141 + %141 = OpLabel + %146 = OpLoad %int %x + %148 = OpAccessChain %_ptr_Function_int %s %uint_1 + %149 = OpIAdd %int %146 %int_1 + OpStore %148 %149 + %151 = OpLoad %int %x + %153 = OpAccessChain %_ptr_Function_int %s %uint_2 + %154 = OpIAdd %int %151 %int_2 + OpStore %153 %154 + %156 = OpAccessChain %_ptr_Function_int %s %uint_1 + %157 = OpLoad %int %156 + %158 = OpIEqual %bool %157 %int_2 + OpSelectionMerge %159 None + OpBranchConditional %158 %160 %159 + %160 = OpLabel + %162 = OpAccessChain %_ptr_Function_int %s %uint_1 + OpStore %162 %int_7 + OpBranch %159 + %159 = OpLabel + %164 = OpAccessChain %_ptr_Function_int %s %uint_0 + %165 = OpLoad %int %164 + %167 = OpAccessChain %_ptr_Function_int %s %uint_1 + %168 = OpLoad %int %167 + %170 = OpAccessChain %_ptr_Function_int %s %uint_2 + %171 = OpLoad %int %170 + %172 = OpIAdd %int %165 %168 + %173 = OpIAdd %int %172 %171 + OpReturnValue %173 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..d664615411 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.spvasm.expected.wgsl @@ -0,0 +1,122 @@ +struct S { + a : i32; + b : i32; + c : i32; +}; + +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_43 : i32; + var x_44 : bool = false; + var arr : array; + var param : S; + var param_1 : i32; + loop { + var x_50 : i32; + x_50 = x_10.one; + arr[x_50].a = 2; + let x_53 : i32 = arr[1].a; + if ((x_53 < 1)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + x_44 = true; + break; + } else { + let x_60 : S = arr[1]; + param = x_60; + param_1 = (2 + bitcast(x_50)); + let x_61 : i32 = param_1; + let x_62 : ptr = &(param.a); + let x_63 : S = param; + var x_64_1 : S = x_63; + x_64_1.a = x_61; + let x_64 : S = x_64_1; + param = x_64; + let x_65 : S = param; + if ((x_65.a == 2)) { + let x_70 : S = param; + var x_71_1 : S = x_70; + x_71_1.a = 9; + let x_71 : S = x_71_1; + param = x_71; + } + let x_72 : i32 = param_1; + let x_74 : ptr = &(param.b); + let x_75 : S = param; + var x_76_1 : S = x_75; + x_76_1.b = (x_72 + 1); + let x_76 : S = x_76_1; + param = x_76; + let x_77 : i32 = param_1; + let x_79 : ptr = &(param.c); + let x_80 : S = param; + var x_81_1 : S = x_80; + x_81_1.c = (x_77 + 2); + let x_81 : S = x_81_1; + param = x_81; + let x_82 : S = param; + if ((x_82.b == 2)) { + let x_87 : S = param; + var x_88_1 : S = x_87; + x_88_1.b = 7; + let x_88 : S = x_88_1; + param = x_88; + } + let x_89 : S = param; + let x_91 : S = param; + let x_94 : S = param; + x_43 = ((x_89.a + x_91.b) + x_94.c); + let x_97 : i32 = x_43; + if ((x_97 == 12)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + } + x_44 = true; + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_struct_S_i1_i1_i11_i1_(s : ptr, x : ptr) -> i32 { + let x_103 : i32 = *(x); + let x_104 : ptr = &((*(s)).a); + *(x_104) = x_103; + let x_105 : i32 = *(x_104); + if ((x_105 == 2)) { + *(x_104) = 9; + } + let x_109 : i32 = *(x); + let x_111 : ptr = &((*(s)).b); + *(x_111) = (x_109 + 1); + let x_112 : i32 = *(x); + let x_114 : ptr = &((*(s)).c); + *(x_114) = (x_112 + 2); + let x_115 : i32 = *(x_111); + if ((x_115 == 2)) { + *(x_111) = 7; + } + let x_119 : i32 = *(x_104); + let x_120 : i32 = *(x_111); + let x_122 : i32 = *(x_114); + return ((x_119 + x_120) + x_122); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl new file mode 100644 index 0000000000..d664615411 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl @@ -0,0 +1,122 @@ +struct S { + a : i32; + b : i32; + c : i32; +}; + +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_43 : i32; + var x_44 : bool = false; + var arr : array; + var param : S; + var param_1 : i32; + loop { + var x_50 : i32; + x_50 = x_10.one; + arr[x_50].a = 2; + let x_53 : i32 = arr[1].a; + if ((x_53 < 1)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + x_44 = true; + break; + } else { + let x_60 : S = arr[1]; + param = x_60; + param_1 = (2 + bitcast(x_50)); + let x_61 : i32 = param_1; + let x_62 : ptr = &(param.a); + let x_63 : S = param; + var x_64_1 : S = x_63; + x_64_1.a = x_61; + let x_64 : S = x_64_1; + param = x_64; + let x_65 : S = param; + if ((x_65.a == 2)) { + let x_70 : S = param; + var x_71_1 : S = x_70; + x_71_1.a = 9; + let x_71 : S = x_71_1; + param = x_71; + } + let x_72 : i32 = param_1; + let x_74 : ptr = &(param.b); + let x_75 : S = param; + var x_76_1 : S = x_75; + x_76_1.b = (x_72 + 1); + let x_76 : S = x_76_1; + param = x_76; + let x_77 : i32 = param_1; + let x_79 : ptr = &(param.c); + let x_80 : S = param; + var x_81_1 : S = x_80; + x_81_1.c = (x_77 + 2); + let x_81 : S = x_81_1; + param = x_81; + let x_82 : S = param; + if ((x_82.b == 2)) { + let x_87 : S = param; + var x_88_1 : S = x_87; + x_88_1.b = 7; + let x_88 : S = x_88_1; + param = x_88; + } + let x_89 : S = param; + let x_91 : S = param; + let x_94 : S = param; + x_43 = ((x_89.a + x_91.b) + x_94.c); + let x_97 : i32 = x_43; + if ((x_97 == 12)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + } + x_44 = true; + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_struct_S_i1_i1_i11_i1_(s : ptr, x : ptr) -> i32 { + let x_103 : i32 = *(x); + let x_104 : ptr = &((*(s)).a); + *(x_104) = x_103; + let x_105 : i32 = *(x_104); + if ((x_105 == 2)) { + *(x_104) = 9; + } + let x_109 : i32 = *(x); + let x_111 : ptr = &((*(s)).b); + *(x_111) = (x_109 + 1); + let x_112 : i32 = *(x); + let x_114 : ptr = &((*(s)).c); + *(x_114) = (x_112 + 2); + let x_115 : i32 = *(x_111); + if ((x_115 == 2)) { + *(x_111) = 7; + } + let x_119 : i32 = *(x_104); + let x_120 : i32 = *(x_111); + let x_122 : i32 = *(x_114); + return ((x_119 + x_120) + x_122); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9efb42d9f6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.hlsl @@ -0,0 +1,99 @@ +struct S { + int a; + int b; + int c; +}; + +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_43 = 0; + bool x_44 = false; + S arr[2] = (S[2])0; + S param = (S)0; + int param_1 = 0; + while (true) { + int x_50 = 0; + x_50 = asint(x_10[0].x); + arr[x_50].a = 2; + const int x_53 = arr[1].a; + if ((x_53 < 1)) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_44 = true; + break; + } else { + const S x_60 = arr[1]; + param = x_60; + param_1 = (2 + asint(x_50)); + const int x_61 = param_1; + S x_64_1 = param; + x_64_1.a = x_61; + param = x_64_1; + if ((param.a == 2)) { + S x_71_1 = param; + x_71_1.a = 9; + param = x_71_1; + } + const int x_72 = param_1; + S x_76_1 = param; + x_76_1.b = (x_72 + 1); + param = x_76_1; + const int x_77 = param_1; + S x_81_1 = param; + x_81_1.c = (x_77 + 2); + param = x_81_1; + if ((param.b == 2)) { + S x_88_1 = param; + x_88_1.b = 7; + param = x_88_1; + } + x_43 = ((param.a + param.b) + param.c); + if ((x_43 == 12)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + } + x_44 = true; + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} + +int func_struct_S_i1_i1_i11_i1_(inout S s, inout int x) { + const int x_103 = x; + s.a = x_103; + const int x_105 = s.a; + if ((x_105 == 2)) { + s.a = 9; + } + const int x_109 = x; + s.b = (x_109 + 1); + const int x_112 = x; + s.c = (x_112 + 2); + const int x_115 = s.b; + if ((x_115 == 2)) { + s.b = 7; + } + const int x_119 = s.a; + const int x_120 = s.b; + const int x_122 = s.c; + return ((x_119 + x_120) + x_122); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..91c59aced0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.msl @@ -0,0 +1,120 @@ +#include + +using namespace metal; +struct S { + int a; + int b; + int c; +}; +struct buf0 { + /* 0x0000 */ int one; +}; +struct tint_array_wrapper { + S arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_10, thread float4* const tint_symbol_4) { + int x_43 = 0; + bool x_44 = false; + tint_array_wrapper arr = {}; + S param = {}; + int param_1 = 0; + while (true) { + int x_50 = 0; + x_50 = x_10.one; + arr.arr[x_50].a = 2; + int const x_53 = arr.arr[1].a; + if ((x_53 < 1)) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_44 = true; + break; + } else { + S const x_60 = arr.arr[1]; + param = x_60; + param_1 = (2 + as_type(x_50)); + int const x_61 = param_1; + S const x_63 = param; + S x_64_1 = x_63; + x_64_1.a = x_61; + S const x_64 = x_64_1; + param = x_64; + S const x_65 = param; + if ((x_65.a == 2)) { + S const x_70 = param; + S x_71_1 = x_70; + x_71_1.a = 9; + S const x_71 = x_71_1; + param = x_71; + } + int const x_72 = param_1; + S const x_75 = param; + S x_76_1 = x_75; + x_76_1.b = (x_72 + 1); + S const x_76 = x_76_1; + param = x_76; + int const x_77 = param_1; + S const x_80 = param; + S x_81_1 = x_80; + x_81_1.c = (x_77 + 2); + S const x_81 = x_81_1; + param = x_81; + S const x_82 = param; + if ((x_82.b == 2)) { + S const x_87 = param; + S x_88_1 = x_87; + x_88_1.b = 7; + S const x_88 = x_88_1; + param = x_88; + } + S const x_89 = param; + S const x_91 = param; + S const x_94 = param; + x_43 = ((x_89.a + x_91.b) + x_94.c); + int const x_97 = x_43; + if ((x_97 == 12)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + } + x_44 = true; + break; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +int func_struct_S_i1_i1_i11_i1_(thread S* const s, thread int* const x) { + int const x_103 = *(x); + (*(s)).a = x_103; + int const x_105 = (*(s)).a; + if ((x_105 == 2)) { + (*(s)).a = 9; + } + int const x_109 = *(x); + (*(s)).b = (x_109 + 1); + int const x_112 = *(x); + (*(s)).c = (x_112 + 2); + int const x_115 = (*(s)).b; + if ((x_115 == 2)) { + (*(s)).b = 7; + } + int const x_119 = (*(s)).a; + int const x_120 = (*(s)).b; + int const x_122 = (*(s)).c; + return ((x_119 + x_120) + x_122); +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..16fa1d72c3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.spvasm @@ -0,0 +1,274 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 174 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_43 "x_43" + OpName %x_44 "x_44" + OpName %S "S" + OpMemberName %S 0 "a" + OpMemberName %S 1 "b" + OpMemberName %S 2 "c" + OpName %arr "arr" + OpName %param "param" + OpName %param_1 "param_1" + OpName %x_50 "x_50" + OpName %x_64_1 "x_64_1" + OpName %x_71_1 "x_71_1" + OpName %x_76_1 "x_76_1" + OpName %x_81_1 "x_81_1" + OpName %x_88_1 "x_88_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %func_struct_S_i1_i1_i11_i1_ "func_struct_S_i1_i1_i11_i1_" + OpName %s "s" + OpName %x "x" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpMemberDecorate %S 2 Offset 8 + OpDecorate %_arr_S_uint_2 ArrayStride 12 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %23 = OpConstantNull %bool + %S = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_S_uint_2 = OpTypeArray %S %uint_2 +%_ptr_Function__arr_S_uint_2 = OpTypePointer Function %_arr_S_uint_2 + %30 = OpConstantNull %_arr_S_uint_2 +%_ptr_Function_S = OpTypePointer Function %S + %33 = OpConstantNull %S + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %55 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %true = OpConstantTrue %bool + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 + %int_7 = OpConstant %int 7 + %int_12 = OpConstant %int 12 + %float_1 = OpConstant %float 1 + %115 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %116 = OpTypeFunction %void %main_out + %128 = OpTypeFunction %int %_ptr_Function_S %_ptr_Function_int + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_43 = OpVariable %_ptr_Function_int Function %18 + %x_44 = OpVariable %_ptr_Function_bool Function %23 + %arr = OpVariable %_ptr_Function__arr_S_uint_2 Function %30 + %param = OpVariable %_ptr_Function_S Function %33 + %param_1 = OpVariable %_ptr_Function_int Function %18 + %x_50 = OpVariable %_ptr_Function_int Function %18 + %x_64_1 = OpVariable %_ptr_Function_S Function %33 + %x_71_1 = OpVariable %_ptr_Function_S Function %33 + %x_76_1 = OpVariable %_ptr_Function_S Function %33 + %x_81_1 = OpVariable %_ptr_Function_S Function %33 + %x_88_1 = OpVariable %_ptr_Function_S Function %33 + OpStore %x_44 %false + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 + %43 = OpLoad %int %42 + OpStore %x_50 %43 + %44 = OpLoad %int %x_50 + %45 = OpAccessChain %_ptr_Function_int %arr %44 %uint_0 + OpStore %45 %int_2 + %48 = OpAccessChain %_ptr_Function_int %arr %int_1 %uint_0 + %49 = OpLoad %int %48 + %50 = OpSLessThan %bool %49 %int_1 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpStore %x_GLF_color %55 + OpStore %x_44 %true + OpBranch %36 + %53 = OpLabel + %57 = OpAccessChain %_ptr_Function_S %arr %int_1 + %58 = OpLoad %S %57 + OpStore %param %58 + %60 = OpLoad %int %x_50 + %59 = OpCopyObject %int %60 + %61 = OpIAdd %int %int_2 %59 + OpStore %param_1 %61 + %62 = OpLoad %int %param_1 + %63 = OpLoad %S %param + OpStore %x_64_1 %63 + %65 = OpAccessChain %_ptr_Function_int %x_64_1 %uint_0 + OpStore %65 %62 + %66 = OpLoad %S %x_64_1 + OpStore %param %66 + %67 = OpLoad %S %param + %68 = OpCompositeExtract %int %67 0 + %69 = OpIEqual %bool %68 %int_2 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpLoad %S %param + OpStore %x_71_1 %72 + %74 = OpAccessChain %_ptr_Function_int %x_71_1 %uint_0 + OpStore %74 %int_9 + %76 = OpLoad %S %x_71_1 + OpStore %param %76 + OpBranch %70 + %70 = OpLabel + %77 = OpLoad %int %param_1 + %78 = OpLoad %S %param + OpStore %x_76_1 %78 + %81 = OpAccessChain %_ptr_Function_int %x_76_1 %uint_1 + %82 = OpIAdd %int %77 %int_1 + OpStore %81 %82 + %83 = OpLoad %S %x_76_1 + OpStore %param %83 + %84 = OpLoad %int %param_1 + %85 = OpLoad %S %param + OpStore %x_81_1 %85 + %87 = OpAccessChain %_ptr_Function_int %x_81_1 %uint_2 + %88 = OpIAdd %int %84 %int_2 + OpStore %87 %88 + %89 = OpLoad %S %x_81_1 + OpStore %param %89 + %90 = OpLoad %S %param + %91 = OpCompositeExtract %int %90 1 + %92 = OpIEqual %bool %91 %int_2 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + %95 = OpLoad %S %param + OpStore %x_88_1 %95 + %97 = OpAccessChain %_ptr_Function_int %x_88_1 %uint_1 + OpStore %97 %int_7 + %99 = OpLoad %S %x_88_1 + OpStore %param %99 + OpBranch %93 + %93 = OpLabel + %100 = OpLoad %S %param + %101 = OpLoad %S %param + %102 = OpLoad %S %param + %103 = OpCompositeExtract %int %100 0 + %104 = OpCompositeExtract %int %101 1 + %105 = OpIAdd %int %103 %104 + %106 = OpCompositeExtract %int %102 2 + %107 = OpIAdd %int %105 %106 + OpStore %x_43 %107 + %108 = OpLoad %int %x_43 + %110 = OpIEqual %bool %108 %int_12 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %113 + %112 = OpLabel + OpStore %x_GLF_color %115 + OpBranch %111 + %113 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %111 + %111 = OpLabel + OpBranch %51 + %51 = OpLabel + OpStore %x_44 %true + OpBranch %36 + %37 = OpLabel + OpBranch %35 + %36 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %116 +%tint_symbol = OpFunctionParameter %main_out + %120 = OpLabel + %121 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %121 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %123 = OpLabel + %124 = OpFunctionCall %void %main_1 + %126 = OpLoad %v4float %x_GLF_color + %127 = OpCompositeConstruct %main_out %126 + %125 = OpFunctionCall %void %tint_symbol_2 %127 + OpReturn + OpFunctionEnd +%func_struct_S_i1_i1_i11_i1_ = OpFunction %int None %128 + %s = OpFunctionParameter %_ptr_Function_S + %x = OpFunctionParameter %_ptr_Function_int + %132 = OpLabel + %134 = OpLoad %int %x + %136 = OpAccessChain %_ptr_Function_int %s %uint_0 + OpStore %136 %134 + %138 = OpAccessChain %_ptr_Function_int %s %uint_0 + %139 = OpLoad %int %138 + %140 = OpIEqual %bool %139 %int_2 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + %144 = OpAccessChain %_ptr_Function_int %s %uint_0 + OpStore %144 %int_9 + OpBranch %141 + %141 = OpLabel + %146 = OpLoad %int %x + %148 = OpAccessChain %_ptr_Function_int %s %uint_1 + %149 = OpIAdd %int %146 %int_1 + OpStore %148 %149 + %151 = OpLoad %int %x + %153 = OpAccessChain %_ptr_Function_int %s %uint_2 + %154 = OpIAdd %int %151 %int_2 + OpStore %153 %154 + %156 = OpAccessChain %_ptr_Function_int %s %uint_1 + %157 = OpLoad %int %156 + %158 = OpIEqual %bool %157 %int_2 + OpSelectionMerge %159 None + OpBranchConditional %158 %160 %159 + %160 = OpLabel + %162 = OpAccessChain %_ptr_Function_int %s %uint_1 + OpStore %162 %int_7 + OpBranch %159 + %159 = OpLabel + %164 = OpAccessChain %_ptr_Function_int %s %uint_0 + %165 = OpLoad %int %164 + %167 = OpAccessChain %_ptr_Function_int %s %uint_1 + %168 = OpLoad %int %167 + %170 = OpAccessChain %_ptr_Function_int %s %uint_2 + %171 = OpLoad %int %170 + %172 = OpIAdd %int %165 %168 + %173 = OpIAdd %int %172 %171 + OpReturnValue %173 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..d664615411 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-sum-struct-members/0-opt.wgsl.expected.wgsl @@ -0,0 +1,122 @@ +struct S { + a : i32; + b : i32; + c : i32; +}; + +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_43 : i32; + var x_44 : bool = false; + var arr : array; + var param : S; + var param_1 : i32; + loop { + var x_50 : i32; + x_50 = x_10.one; + arr[x_50].a = 2; + let x_53 : i32 = arr[1].a; + if ((x_53 < 1)) { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + x_44 = true; + break; + } else { + let x_60 : S = arr[1]; + param = x_60; + param_1 = (2 + bitcast(x_50)); + let x_61 : i32 = param_1; + let x_62 : ptr = &(param.a); + let x_63 : S = param; + var x_64_1 : S = x_63; + x_64_1.a = x_61; + let x_64 : S = x_64_1; + param = x_64; + let x_65 : S = param; + if ((x_65.a == 2)) { + let x_70 : S = param; + var x_71_1 : S = x_70; + x_71_1.a = 9; + let x_71 : S = x_71_1; + param = x_71; + } + let x_72 : i32 = param_1; + let x_74 : ptr = &(param.b); + let x_75 : S = param; + var x_76_1 : S = x_75; + x_76_1.b = (x_72 + 1); + let x_76 : S = x_76_1; + param = x_76; + let x_77 : i32 = param_1; + let x_79 : ptr = &(param.c); + let x_80 : S = param; + var x_81_1 : S = x_80; + x_81_1.c = (x_77 + 2); + let x_81 : S = x_81_1; + param = x_81; + let x_82 : S = param; + if ((x_82.b == 2)) { + let x_87 : S = param; + var x_88_1 : S = x_87; + x_88_1.b = 7; + let x_88 : S = x_88_1; + param = x_88; + } + let x_89 : S = param; + let x_91 : S = param; + let x_94 : S = param; + x_43 = ((x_89.a + x_91.b) + x_94.c); + let x_97 : i32 = x_43; + if ((x_97 == 12)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + } + x_44 = true; + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_struct_S_i1_i1_i11_i1_(s : ptr, x : ptr) -> i32 { + let x_103 : i32 = *(x); + let x_104 : ptr = &((*(s)).a); + *(x_104) = x_103; + let x_105 : i32 = *(x_104); + if ((x_105 == 2)) { + *(x_104) = 9; + } + let x_109 : i32 = *(x); + let x_111 : ptr = &((*(s)).b); + *(x_111) = (x_109 + 1); + let x_112 : i32 = *(x); + let x_114 : ptr = &((*(s)).c); + *(x_114) = (x_112 + 2); + let x_115 : i32 = *(x_111); + if ((x_115 == 2)) { + *(x_111) = 7; + } + let x_119 : i32 = *(x_104); + let x_120 : i32 = *(x_111); + let x_122 : i32 = *(x_114); + return ((x_119 + x_120) + x_122); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm new file mode 100644 index 0000000000..e02ce2339f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm @@ -0,0 +1,83 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_vf2_ "func(vf2;" + OpName %v "v" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %_ "" + OpName %f "f" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpTypeFunction %float %_ptr_Function_v2float + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_5 = OpConstant %float 5 + %27 = OpConstantComposite %v2float %float_1 %float_1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %32 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %11 + %33 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_v2float Function + OpStore %param %27 + %34 = OpFunctionCall %float %func_vf2_ %param + OpStore %f %34 + %35 = OpLoad %float %f + %36 = OpFOrdEqual %bool %35 %float_5 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpStore %_GLF_color %31 + OpBranch %37 + %39 = OpLabel + OpStore %_GLF_color %32 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd + %func_vf2_ = OpFunction %float None %15 + %v = OpFunctionParameter %_ptr_Function_v2float + %40 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Function_float %v %uint_0 + OpStore %43 %42 + %44 = OpAccessChain %_ptr_Function_float %v %uint_1 + %45 = OpLoad %float %44 + %46 = OpFOrdLessThan %bool %45 %float_1 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + OpReturnValue %float_1 + %47 = OpLabel + OpReturnValue %float_5 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..52a5683629 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.hlsl @@ -0,0 +1,42 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_vf2_(inout float2 v) { + const float x_42 = asfloat(x_7[0].x); + v.x = x_42; + const float x_45 = v.y; + if ((x_45 < 1.0f)) { + return 1.0f; + } + return 5.0f; +} + +void main_1() { + float f = 0.0f; + float2 param = float2(0.0f, 0.0f); + param = float2(1.0f, 1.0f); + const float x_34 = func_vf2_(param); + f = x_34; + if ((f == 5.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..84a3cf6f02 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float two; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_vf2_(constant buf0& x_7, thread float2* const v) { + float const x_42 = x_7.two; + (*(v)).x = x_42; + float const x_45 = (*(v)).y; + if ((x_45 < 1.0f)) { + return 1.0f; + } + return 5.0f; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + float f = 0.0f; + float2 param = 0.0f; + param = float2(1.0f, 1.0f); + float const x_34 = func_vf2_(x_7, &(param)); + f = x_34; + float const x_35 = f; + if ((x_35 == 5.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..0216afca35 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.spvasm @@ -0,0 +1,114 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_vf2_ "func_vf2_" + OpName %v "v" + OpName %main_1 "main_1" + OpName %f "f" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %11 = OpTypeFunction %float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_5 = OpConstant %float 5 + %void = OpTypeVoid + %35 = OpTypeFunction %void + %40 = OpConstantNull %float + %42 = OpConstantNull %v2float + %43 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %52 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %53 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %54 = OpTypeFunction %void %main_out + %func_vf2_ = OpFunction %float None %11 + %v = OpFunctionParameter %_ptr_Function_v2float + %16 = OpLabel + %20 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %21 = OpLoad %float %20 + %24 = OpAccessChain %_ptr_Function_float %v %uint_0 + OpStore %24 %21 + %27 = OpAccessChain %_ptr_Function_float %v %uint_1 + %28 = OpLoad %float %27 + %30 = OpFOrdLessThan %bool %28 %float_1 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %32 + %33 = OpLabel + OpReturnValue %float_1 + %32 = OpLabel + OpReturnValue %float_5 + OpFunctionEnd + %main_1 = OpFunction %void None %35 + %38 = OpLabel + %f = OpVariable %_ptr_Function_float Function %40 + %param = OpVariable %_ptr_Function_v2float Function %42 + OpStore %param %43 + %44 = OpFunctionCall %float %func_vf2_ %param + OpStore %f %44 + %46 = OpLoad %float %f + %47 = OpFOrdEqual %bool %46 %float_5 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + OpStore %x_GLF_color %52 + OpBranch %48 + %50 = OpLabel + OpStore %x_GLF_color %53 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %54 +%tint_symbol = OpFunctionParameter %main_out + %58 = OpLabel + %59 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %59 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %35 + %61 = OpLabel + %62 = OpFunctionCall %void %main_1 + %64 = OpLoad %v4float %x_GLF_color + %65 = OpCompositeConstruct %main_out %64 + %63 = OpFunctionCall %void %tint_symbol_2 %65 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f09a1ff43a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.spvasm.expected.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct buf0 { + two : f32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_vf2_(v : ptr>) -> f32 { + let x_42 : f32 = x_7.two; + (*(v)).x = x_42; + let x_45 : f32 = (*(v)).y; + if ((x_45 < 1.0)) { + return 1.0; + } + return 5.0; +} + +fn main_1() { + var f : f32; + var param : vec2; + param = vec2(1.0, 1.0); + let x_34 : f32 = func_vf2_(&(param)); + f = x_34; + let x_35 : f32 = f; + if ((x_35 == 5.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl new file mode 100644 index 0000000000..f09a1ff43a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct buf0 { + two : f32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_vf2_(v : ptr>) -> f32 { + let x_42 : f32 = x_7.two; + (*(v)).x = x_42; + let x_45 : f32 = (*(v)).y; + if ((x_45 < 1.0)) { + return 1.0; + } + return 5.0; +} + +fn main_1() { + var f : f32; + var param : vec2; + param = vec2(1.0, 1.0); + let x_34 : f32 = func_vf2_(&(param)); + f = x_34; + let x_35 : f32 = f; + if ((x_35 == 5.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..52a5683629 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.hlsl @@ -0,0 +1,42 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_vf2_(inout float2 v) { + const float x_42 = asfloat(x_7[0].x); + v.x = x_42; + const float x_45 = v.y; + if ((x_45 < 1.0f)) { + return 1.0f; + } + return 5.0f; +} + +void main_1() { + float f = 0.0f; + float2 param = float2(0.0f, 0.0f); + param = float2(1.0f, 1.0f); + const float x_34 = func_vf2_(param); + f = x_34; + if ((f == 5.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..84a3cf6f02 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float two; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_vf2_(constant buf0& x_7, thread float2* const v) { + float const x_42 = x_7.two; + (*(v)).x = x_42; + float const x_45 = (*(v)).y; + if ((x_45 < 1.0f)) { + return 1.0f; + } + return 5.0f; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + float f = 0.0f; + float2 param = 0.0f; + param = float2(1.0f, 1.0f); + float const x_34 = func_vf2_(x_7, &(param)); + f = x_34; + float const x_35 = f; + if ((x_35 == 5.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..0216afca35 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.spvasm @@ -0,0 +1,114 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_vf2_ "func_vf2_" + OpName %v "v" + OpName %main_1 "main_1" + OpName %f "f" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %11 = OpTypeFunction %float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_5 = OpConstant %float 5 + %void = OpTypeVoid + %35 = OpTypeFunction %void + %40 = OpConstantNull %float + %42 = OpConstantNull %v2float + %43 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %52 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %53 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %54 = OpTypeFunction %void %main_out + %func_vf2_ = OpFunction %float None %11 + %v = OpFunctionParameter %_ptr_Function_v2float + %16 = OpLabel + %20 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %21 = OpLoad %float %20 + %24 = OpAccessChain %_ptr_Function_float %v %uint_0 + OpStore %24 %21 + %27 = OpAccessChain %_ptr_Function_float %v %uint_1 + %28 = OpLoad %float %27 + %30 = OpFOrdLessThan %bool %28 %float_1 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %32 + %33 = OpLabel + OpReturnValue %float_1 + %32 = OpLabel + OpReturnValue %float_5 + OpFunctionEnd + %main_1 = OpFunction %void None %35 + %38 = OpLabel + %f = OpVariable %_ptr_Function_float Function %40 + %param = OpVariable %_ptr_Function_v2float Function %42 + OpStore %param %43 + %44 = OpFunctionCall %float %func_vf2_ %param + OpStore %f %44 + %46 = OpLoad %float %f + %47 = OpFOrdEqual %bool %46 %float_5 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + OpStore %x_GLF_color %52 + OpBranch %48 + %50 = OpLabel + OpStore %x_GLF_color %53 + OpBranch %48 + %48 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %54 +%tint_symbol = OpFunctionParameter %main_out + %58 = OpLabel + %59 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %59 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %35 + %61 = OpLabel + %62 = OpFunctionCall %void %main_1 + %64 = OpLoad %v4float %x_GLF_color + %65 = OpCompositeConstruct %main_out %64 + %63 = OpFunctionCall %void %tint_symbol_2 %65 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f09a1ff43a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mem-pass-unused-component/0-opt.wgsl.expected.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct buf0 { + two : f32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_vf2_(v : ptr>) -> f32 { + let x_42 : f32 = x_7.two; + (*(v)).x = x_42; + let x_45 : f32 = (*(v)).y; + if ((x_45 < 1.0)) { + return 1.0; + } + return 5.0; +} + +fn main_1() { + var f : f32; + var param : vec2; + param = vec2(1.0, 1.0); + let x_34 : f32 = func_vf2_(&(param)); + f = x_34; + let x_35 : f32 = f; + if ((x_35 == 5.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm new file mode 100644 index 0000000000..6b79715471 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm @@ -0,0 +1,88 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %b "b" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %11 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %float_2 = OpConstant %float 2 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %false = OpConstantFalse %bool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %25 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %26 = OpLabel + %27 = OpFunctionCall %float %func_ + %28 = OpFOrdEqual %bool %27 %float_1 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %31 + %30 = OpLabel + OpStore %_GLF_color %24 + OpBranch %29 + %31 = OpLabel + OpStore %_GLF_color %25 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %float None %11 + %32 = OpLabel + %b = OpVariable %_ptr_Function_float Function + OpStore %b %float_2 + OpBranch %33 + %33 = OpLabel + %34 = OpPhi %float %float_2 %32 %float_1 %35 + OpLoopMerge %36 %35 None + OpBranch %37 + %37 = OpLabel + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %39 = OpLoad %float %38 + %40 = OpFOrdEqual %bool %39 %float_0 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + OpBranch %36 + %41 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %44 = OpLoad %float %43 + %45 = OpFOrdEqual %bool %44 %float_0 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + OpReturnValue %float_1 + %46 = OpLabel + OpStore %b %float_1 + OpBranch %35 + %35 = OpLabel + OpBranchConditional %false %33 %36 + %36 = OpLabel + %48 = OpPhi %float %34 %42 %float_1 %35 + OpReturnValue %48 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..be4003a9e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.hlsl @@ -0,0 +1,59 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_() { + float b = 0.0f; + float x_34 = 0.0f; + float x_34_phi = 0.0f; + float x_48_phi = 0.0f; + b = 2.0f; + x_34_phi = 2.0f; + while (true) { + x_34 = x_34_phi; + const float x_39 = asfloat(x_7[0].x); + if ((x_39 == 0.0f)) { + x_48_phi = x_34; + break; + } + const float x_44 = asfloat(x_7[0].x); + if ((x_44 == 0.0f)) { + return 1.0f; + } + b = 1.0f; + { + x_34_phi = 1.0f; + x_48_phi = 1.0f; + if (false) { + } else { + break; + } + } + } + return x_48_phi; +} + +void main_1() { + const float x_27 = func_(); + if ((x_27 == 1.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..8114c84f35 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_(constant buf0& x_7) { + float b = 0.0f; + float x_34 = 0.0f; + float x_34_phi = 0.0f; + float x_48_phi = 0.0f; + b = 2.0f; + x_34_phi = 2.0f; + while (true) { + x_34 = x_34_phi; + float const x_39 = x_7.three; + if ((x_39 == 0.0f)) { + x_48_phi = x_34; + break; + } + float const x_44 = x_7.three; + if ((x_44 == 0.0f)) { + return 1.0f; + } + b = 1.0f; + { + x_34_phi = 1.0f; + x_48_phi = 1.0f; + if (false) { + } else { + break; + } + } + } + float const x_48 = x_48_phi; + return x_48; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + float const x_27 = func_(x_7); + if ((x_27 == 1.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..22d860b918 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.spvasm @@ -0,0 +1,144 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %b "b" + OpName %x_34 "x_34" + OpName %x_34_phi "x_34_phi" + OpName %x_48_phi "x_48_phi" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %11 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpConstantNull %float + %float_2 = OpConstant %float 2 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %false = OpConstantFalse %bool + %void = OpTypeVoid + %48 = OpTypeFunction %void + %57 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %58 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %59 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %11 + %13 = OpLabel + %b = OpVariable %_ptr_Function_float Function %16 + %x_34 = OpVariable %_ptr_Function_float Function %16 + %x_34_phi = OpVariable %_ptr_Function_float Function %16 + %x_48_phi = OpVariable %_ptr_Function_float Function %16 + OpStore %b %float_2 + OpStore %x_34_phi %float_2 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %float %x_34_phi + OpStore %x_34 %25 + %29 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %30 = OpLoad %float %29 + %32 = OpFOrdEqual %bool %30 %float_0 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %34 + %35 = OpLabel + %36 = OpLoad %float %x_34 + OpStore %x_48_phi %36 + OpBranch %22 + %34 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %38 = OpLoad %float %37 + %39 = OpFOrdEqual %bool %38 %float_0 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + OpReturnValue %float_1 + %40 = OpLabel + OpStore %b %float_1 + OpBranch %23 + %23 = OpLabel + OpStore %x_34_phi %float_1 + OpStore %x_48_phi %float_1 + OpSelectionMerge %44 None + OpBranchConditional %false %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %22 + %44 = OpLabel + OpBranch %21 + %22 = OpLabel + %47 = OpLoad %float %x_48_phi + OpReturnValue %47 + OpFunctionEnd + %main_1 = OpFunction %void None %48 + %51 = OpLabel + %52 = OpFunctionCall %float %func_ + %53 = OpFOrdEqual %bool %52 %float_1 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %54 + %56 = OpLabel + OpStore %x_GLF_color %58 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %59 +%tint_symbol = OpFunctionParameter %main_out + %63 = OpLabel + %64 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %64 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %48 + %66 = OpLabel + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_2 %70 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 23[%23] is not post dominated by the back-edge block 44[%44] + %44 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..6a9c3b712d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.spvasm.expected.wgsl @@ -0,0 +1,62 @@ +[[block]] +struct buf0 { + three : f32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var b : f32; + var x_34 : f32; + var x_34_phi : f32; + var x_48_phi : f32; + b = 2.0; + x_34_phi = 2.0; + loop { + x_34 = x_34_phi; + let x_39 : f32 = x_7.three; + if ((x_39 == 0.0)) { + x_48_phi = x_34; + break; + } + let x_44 : f32 = x_7.three; + if ((x_44 == 0.0)) { + return 1.0; + } + b = 1.0; + + continuing { + x_34_phi = 1.0; + x_48_phi = 1.0; + if (false) { + } else { + break; + } + } + } + let x_48 : f32 = x_48_phi; + return x_48; +} + +fn main_1() { + let x_27 : f32 = func_(); + if ((x_27 == 1.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl new file mode 100644 index 0000000000..6a9c3b712d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl @@ -0,0 +1,62 @@ +[[block]] +struct buf0 { + three : f32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var b : f32; + var x_34 : f32; + var x_34_phi : f32; + var x_48_phi : f32; + b = 2.0; + x_34_phi = 2.0; + loop { + x_34 = x_34_phi; + let x_39 : f32 = x_7.three; + if ((x_39 == 0.0)) { + x_48_phi = x_34; + break; + } + let x_44 : f32 = x_7.three; + if ((x_44 == 0.0)) { + return 1.0; + } + b = 1.0; + + continuing { + x_34_phi = 1.0; + x_48_phi = 1.0; + if (false) { + } else { + break; + } + } + } + let x_48 : f32 = x_48_phi; + return x_48; +} + +fn main_1() { + let x_27 : f32 = func_(); + if ((x_27 == 1.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..be4003a9e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.hlsl @@ -0,0 +1,59 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_() { + float b = 0.0f; + float x_34 = 0.0f; + float x_34_phi = 0.0f; + float x_48_phi = 0.0f; + b = 2.0f; + x_34_phi = 2.0f; + while (true) { + x_34 = x_34_phi; + const float x_39 = asfloat(x_7[0].x); + if ((x_39 == 0.0f)) { + x_48_phi = x_34; + break; + } + const float x_44 = asfloat(x_7[0].x); + if ((x_44 == 0.0f)) { + return 1.0f; + } + b = 1.0f; + { + x_34_phi = 1.0f; + x_48_phi = 1.0f; + if (false) { + } else { + break; + } + } + } + return x_48_phi; +} + +void main_1() { + const float x_27 = func_(); + if ((x_27 == 1.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..8114c84f35 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_(constant buf0& x_7) { + float b = 0.0f; + float x_34 = 0.0f; + float x_34_phi = 0.0f; + float x_48_phi = 0.0f; + b = 2.0f; + x_34_phi = 2.0f; + while (true) { + x_34 = x_34_phi; + float const x_39 = x_7.three; + if ((x_39 == 0.0f)) { + x_48_phi = x_34; + break; + } + float const x_44 = x_7.three; + if ((x_44 == 0.0f)) { + return 1.0f; + } + b = 1.0f; + { + x_34_phi = 1.0f; + x_48_phi = 1.0f; + if (false) { + } else { + break; + } + } + } + float const x_48 = x_48_phi; + return x_48; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + float const x_27 = func_(x_7); + if ((x_27 == 1.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..22d860b918 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %b "b" + OpName %x_34 "x_34" + OpName %x_34_phi "x_34_phi" + OpName %x_48_phi "x_48_phi" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %11 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpConstantNull %float + %float_2 = OpConstant %float 2 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %false = OpConstantFalse %bool + %void = OpTypeVoid + %48 = OpTypeFunction %void + %57 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %58 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %59 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %11 + %13 = OpLabel + %b = OpVariable %_ptr_Function_float Function %16 + %x_34 = OpVariable %_ptr_Function_float Function %16 + %x_34_phi = OpVariable %_ptr_Function_float Function %16 + %x_48_phi = OpVariable %_ptr_Function_float Function %16 + OpStore %b %float_2 + OpStore %x_34_phi %float_2 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %float %x_34_phi + OpStore %x_34 %25 + %29 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %30 = OpLoad %float %29 + %32 = OpFOrdEqual %bool %30 %float_0 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %34 + %35 = OpLabel + %36 = OpLoad %float %x_34 + OpStore %x_48_phi %36 + OpBranch %22 + %34 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %38 = OpLoad %float %37 + %39 = OpFOrdEqual %bool %38 %float_0 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + OpReturnValue %float_1 + %40 = OpLabel + OpStore %b %float_1 + OpBranch %23 + %23 = OpLabel + OpStore %x_34_phi %float_1 + OpStore %x_48_phi %float_1 + OpSelectionMerge %44 None + OpBranchConditional %false %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %22 + %44 = OpLabel + OpBranch %21 + %22 = OpLabel + %47 = OpLoad %float %x_48_phi + OpReturnValue %47 + OpFunctionEnd + %main_1 = OpFunction %void None %48 + %51 = OpLabel + %52 = OpFunctionCall %float %func_ + %53 = OpFOrdEqual %bool %52 %float_1 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %54 + %56 = OpLabel + OpStore %x_GLF_color %58 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %59 +%tint_symbol = OpFunctionParameter %main_out + %63 = OpLabel + %64 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %64 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %48 + %66 = OpLabel + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_2 %70 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 23[%23] is not post dominated by the back-edge block 44[%44] + %44 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..6a9c3b712d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-merge-return-condition-twice/0-opt.wgsl.expected.wgsl @@ -0,0 +1,62 @@ +[[block]] +struct buf0 { + three : f32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var b : f32; + var x_34 : f32; + var x_34_phi : f32; + var x_48_phi : f32; + b = 2.0; + x_34_phi = 2.0; + loop { + x_34 = x_34_phi; + let x_39 : f32 = x_7.three; + if ((x_39 == 0.0)) { + x_48_phi = x_34; + break; + } + let x_44 : f32 = x_7.three; + if ((x_44 == 0.0)) { + return 1.0; + } + b = 1.0; + + continuing { + x_34_phi = 1.0; + x_48_phi = 1.0; + if (false) { + } else { + break; + } + } + } + let x_48 : f32 = x_48_phi; + return x_48; +} + +fn main_1() { + let x_27 : f32 = func_(); + if ((x_27 == 1.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm new file mode 100644 index 0000000000..2682f3c62c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm @@ -0,0 +1,95 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f "f" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 + %int_n1 = OpConstant %int -1 + %float_1 = OpConstant %float 1 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %13 + %34 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %35 = OpBitcast %float %int_n1 + %36 = OpExtInst %float %1 FMin %35 %float_1 + OpStore %f %36 + %37 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpFOrdGreaterThan %bool %38 %40 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %44 + %43 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %49 + %51 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpCompositeConstruct %v4float %47 %50 %53 %56 + OpStore %_GLF_color %57 + OpBranch %42 + %44 = OpLabel + %58 = OpLoad %float %f + %59 = OpCompositeConstruct %v4float %58 %58 %58 %58 + OpStore %_GLF_color %59 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3c49b30da1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.hlsl @@ -0,0 +1,48 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[2]; +}; + +void main_1() { + float f = 0.0f; + f = min(asfloat(-1), 1.0f); + const float x_38 = gl_FragCoord.x; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_38 > x_40)) { + const int x_46 = asint(x_9[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_55 = asint(x_9[1].x); + x_GLF_color = float4(float(x_46), float(x_49), float(x_52), float(x_55)); + } else { + const float x_58 = f; + x_GLF_color = float4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..bae0285398 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float f = 0.0f; + f = fmin(as_type(-1), 1.0f); + float const x_38 = (*(tint_symbol_5)).x; + float const x_40 = x_7.x_GLF_uniform_float_values.arr[0].el; + if ((x_38 > x_40)) { + int const x_46 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_49 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_52 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_55 = x_9.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_6) = float4(float(x_46), float(x_49), float(x_52), float(x_55)); + } else { + float const x_58 = f; + *(tint_symbol_6) = float4(x_58, x_58, x_58, x_58); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_9, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b9c090d2eb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.spvasm @@ -0,0 +1,133 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + %31 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float + %int_n1 = OpConstant %int -1 + %float_1 = OpConstant %float 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %f = OpVariable %_ptr_Function_float Function %29 + %32 = OpBitcast %float %int_n1 + %30 = OpExtInst %float %31 NMin %32 %float_1 + OpStore %f %30 + %37 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + %41 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpFOrdGreaterThan %bool %38 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %51 + %59 = OpConvertSToF %float %53 + %60 = OpConvertSToF %float %55 + %61 = OpConvertSToF %float %57 + %62 = OpCompositeConstruct %v4float %58 %59 %60 %61 + OpStore %x_GLF_color %62 + OpBranch %45 + %47 = OpLabel + %63 = OpLoad %float %f + %64 = OpCompositeConstruct %v4float %63 %63 %63 %63 + OpStore %x_GLF_color %64 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %65 +%tint_symbol_1 = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %72 = OpLabel + %73 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %73 + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_3 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..089465d35f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.spvasm.expected.wgsl @@ -0,0 +1,51 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +fn main_1() { + var f : f32; + f = min(bitcast(-1), 1.0); + let x_38 : f32 = gl_FragCoord.x; + let x_40 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_38 > x_40)) { + let x_46 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_49 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_55 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_46), f32(x_49), f32(x_52), f32(x_55)); + } else { + let x_58 : f32 = f; + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl new file mode 100644 index 0000000000..089465d35f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl @@ -0,0 +1,51 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +fn main_1() { + var f : f32; + f = min(bitcast(-1), 1.0); + let x_38 : f32 = gl_FragCoord.x; + let x_40 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_38 > x_40)) { + let x_46 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_49 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_55 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_46), f32(x_49), f32(x_52), f32(x_55)); + } else { + let x_58 : f32 = f; + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3c49b30da1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.hlsl @@ -0,0 +1,48 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[2]; +}; + +void main_1() { + float f = 0.0f; + f = min(asfloat(-1), 1.0f); + const float x_38 = gl_FragCoord.x; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_38 > x_40)) { + const int x_46 = asint(x_9[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_55 = asint(x_9[1].x); + x_GLF_color = float4(float(x_46), float(x_49), float(x_52), float(x_55)); + } else { + const float x_58 = f; + x_GLF_color = float4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..bae0285398 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float f = 0.0f; + f = fmin(as_type(-1), 1.0f); + float const x_38 = (*(tint_symbol_5)).x; + float const x_40 = x_7.x_GLF_uniform_float_values.arr[0].el; + if ((x_38 > x_40)) { + int const x_46 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_49 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_52 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_55 = x_9.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_6) = float4(float(x_46), float(x_49), float(x_52), float(x_55)); + } else { + float const x_58 = f; + *(tint_symbol_6) = float4(x_58, x_58, x_58, x_58); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_9, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b9c090d2eb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.spvasm @@ -0,0 +1,133 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + %31 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float + %int_n1 = OpConstant %int -1 + %float_1 = OpConstant %float 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %f = OpVariable %_ptr_Function_float Function %29 + %32 = OpBitcast %float %int_n1 + %30 = OpExtInst %float %31 NMin %32 %float_1 + OpStore %f %30 + %37 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + %41 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpFOrdGreaterThan %bool %38 %42 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %51 + %59 = OpConvertSToF %float %53 + %60 = OpConvertSToF %float %55 + %61 = OpConvertSToF %float %57 + %62 = OpCompositeConstruct %v4float %58 %59 %60 %61 + OpStore %x_GLF_color %62 + OpBranch %45 + %47 = OpLabel + %63 = OpLoad %float %f + %64 = OpCompositeConstruct %v4float %63 %63 %63 %63 + OpStore %x_GLF_color %64 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %65 +%tint_symbol_1 = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %72 = OpLabel + %73 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %73 + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_3 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..089465d35f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-intbitstofloat-undefined-never-used/0-opt.wgsl.expected.wgsl @@ -0,0 +1,51 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +fn main_1() { + var f : f32; + f = min(bitcast(-1), 1.0); + let x_38 : f32 = gl_FragCoord.x; + let x_40 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_38 > x_40)) { + let x_46 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_49 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_55 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_46), f32(x_49), f32(x_52), f32(x_55)); + } else { + let x_58 : f32 = f; + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm new file mode 100644 index 0000000000..c4ae3001c1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm @@ -0,0 +1,47 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %_GLF_color Location 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0_00390625 = OpConstant %float 0.00390625 + %int = OpTypeInt 32 1 + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %6 + %18 = OpLabel + %19 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %20 = OpLoad %float %19 + %21 = OpFMul %float %20 %float_0_00390625 + %22 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %23 = OpLoad %float %22 + %24 = OpConvertFToS %int %23 + %25 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %26 = OpLoad %float %25 + %27 = OpConvertFToS %int %26 + %28 = OpBitwiseXor %int %24 %27 + %29 = OpConvertSToF %float %28 + %30 = OpFMul %float %29 %float_0_00390625 + %31 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %32 = OpLoad %float %31 + %33 = OpFMul %float %32 %float_0_00390625 + %34 = OpCompositeConstruct %v4float %21 %30 %33 %float_1 + OpStore %_GLF_color %34 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..5f95172bdf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.hlsl @@ -0,0 +1,30 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_20 = gl_FragCoord.x; + const float x_23 = gl_FragCoord.x; + const float x_26 = gl_FragCoord.y; + const float x_32 = gl_FragCoord.y; + x_GLF_color = float4((x_20 * 0.00390625f), (float((int(x_23) ^ int(x_26))) * 0.00390625f), (x_32 * 0.00390625f), 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..6aa5c6ad4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_20 = (*(tint_symbol_5)).x; + float const x_23 = (*(tint_symbol_5)).x; + float const x_26 = (*(tint_symbol_5)).y; + float const x_32 = (*(tint_symbol_5)).y; + *(tint_symbol_6) = float4((x_20 * 0.00390625f), (float((int(x_23) ^ int(x_26))) * 0.00390625f), (x_32 * 0.00390625f), 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..0a0f186c4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 +%float_0_00390625 = OpConstant %float 0.00390625 + %int = OpTypeInt 32 1 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %19 = OpLoad %float %18 + %20 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %21 = OpLoad %float %20 + %23 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %24 = OpLoad %float %23 + %25 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %26 = OpLoad %float %25 + %28 = OpFMul %float %19 %float_0_00390625 + %30 = OpConvertFToS %int %21 + %32 = OpConvertFToS %int %24 + %33 = OpBitwiseXor %int %30 %32 + %29 = OpConvertSToF %float %33 + %34 = OpFMul %float %29 %float_0_00390625 + %35 = OpFMul %float %26 %float_0_00390625 + %37 = OpCompositeConstruct %v4float %28 %34 %35 %float_1 + OpStore %x_GLF_color %37 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %38 +%tint_symbol_1 = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %45 = OpLabel + %46 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %46 + %47 = OpFunctionCall %void %main_1 + %49 = OpLoad %v4float %x_GLF_color + %50 = OpCompositeConstruct %main_out %49 + %48 = OpFunctionCall %void %tint_symbol_3 %50 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..6c6f442b13 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + let x_20 : f32 = gl_FragCoord.x; + let x_23 : f32 = gl_FragCoord.x; + let x_26 : f32 = gl_FragCoord.y; + let x_32 : f32 = gl_FragCoord.y; + x_GLF_color = vec4((x_20 * 0.00390625), (f32((i32(x_23) ^ i32(x_26))) * 0.00390625), (x_32 * 0.00390625), 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl new file mode 100644 index 0000000000..6c6f442b13 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + let x_20 : f32 = gl_FragCoord.x; + let x_23 : f32 = gl_FragCoord.x; + let x_26 : f32 = gl_FragCoord.y; + let x_32 : f32 = gl_FragCoord.y; + x_GLF_color = vec4((x_20 * 0.00390625), (f32((i32(x_23) ^ i32(x_26))) * 0.00390625), (x_32 * 0.00390625), 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..5f95172bdf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.hlsl @@ -0,0 +1,30 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_20 = gl_FragCoord.x; + const float x_23 = gl_FragCoord.x; + const float x_26 = gl_FragCoord.y; + const float x_32 = gl_FragCoord.y; + x_GLF_color = float4((x_20 * 0.00390625f), (float((int(x_23) ^ int(x_26))) * 0.00390625f), (x_32 * 0.00390625f), 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..6aa5c6ad4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.msl @@ -0,0 +1,29 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_20 = (*(tint_symbol_5)).x; + float const x_23 = (*(tint_symbol_5)).x; + float const x_26 = (*(tint_symbol_5)).y; + float const x_32 = (*(tint_symbol_5)).y; + *(tint_symbol_6) = float4((x_20 * 0.00390625f), (float((int(x_23) ^ int(x_26))) * 0.00390625f), (x_32 * 0.00390625f), 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..0a0f186c4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 +%float_0_00390625 = OpConstant %float 0.00390625 + %int = OpTypeInt 32 1 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %19 = OpLoad %float %18 + %20 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %21 = OpLoad %float %20 + %23 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %24 = OpLoad %float %23 + %25 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %26 = OpLoad %float %25 + %28 = OpFMul %float %19 %float_0_00390625 + %30 = OpConvertFToS %int %21 + %32 = OpConvertFToS %int %24 + %33 = OpBitwiseXor %int %30 %32 + %29 = OpConvertSToF %float %33 + %34 = OpFMul %float %29 %float_0_00390625 + %35 = OpFMul %float %26 %float_0_00390625 + %37 = OpCompositeConstruct %v4float %28 %34 %35 %float_1 + OpStore %x_GLF_color %37 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %38 +%tint_symbol_1 = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %45 = OpLabel + %46 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %46 + %47 = OpFunctionCall %void %main_1 + %49 = OpLoad %v4float %x_GLF_color + %50 = OpCompositeConstruct %main_out %49 + %48 = OpFunctionCall %void %tint_symbol_3 %50 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..6c6f442b13 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-min-nested-loop-same-value-for-variables/0-opt.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + let x_20 : f32 = gl_FragCoord.x; + let x_23 : f32 = gl_FragCoord.x; + let x_26 : f32 = gl_FragCoord.y; + let x_32 : f32 = gl_FragCoord.y; + x_GLF_color = vec4((x_20 * 0.00390625), (f32((i32(x_23) ^ i32(x_26))) * 0.00390625), (x_32 * 0.00390625), 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm new file mode 100644 index 0000000000..47315d3398 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm @@ -0,0 +1,111 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %func_ "func(" + OpName %v "v" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %15 = OpTypeFunction %float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %21 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %buf1 = OpTypeStruct %uint +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_2 = OpConstant %uint 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %buf0 = OpTypeStruct %_arr_int_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %13 + %36 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + OpStore %v %21 + %37 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %38 = OpLoad %float %37 + %39 = OpFOrdLessThan %bool %38 %float_0 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + %42 = OpFunctionCall %float %func_ + %43 = OpCompositeConstruct %v4float %42 %42 %42 %42 + OpStore %v %43 + OpBranch %40 + %40 = OpLabel + %44 = OpLoad %v4float %v + %45 = OpExtInst %uint %1 PackUnorm4x8 %44 + %46 = OpIEqual %bool %45 %uint_1 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + OpReturn + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %50 = OpLoad %uint %49 + %51 = OpShiftLeftLogical %uint %uint_1 %50 + %52 = OpIEqual %bool %51 %uint_2 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + OpStore %_GLF_color %33 + OpBranch %53 + %55 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpCompositeConstruct %v4float %58 %58 %58 %58 + OpStore %_GLF_color %59 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %float None %15 + %60 = OpLabel + OpSelectionMerge %61 None + OpSwitch %int_1 %61 0 %62 + %62 = OpLabel + OpReturnValue %float_1 + %61 = OpLabel + %63 = OpUndef %float + OpReturnValue %63 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..94cc273cfe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.hlsl @@ -0,0 +1,68 @@ +uint tint_pack4x8unorm(float4 param_0) { + uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0)); + return (i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; + +float func_() { + switch(1) { + case 0: { + return 1.0f; + break; + } + default: { + break; + } + } + return 0.0f; +} + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + v = float4(1.0f, 1.0f, 1.0f, 1.0f); + const float x_38 = gl_FragCoord.y; + if ((x_38 < 0.0f)) { + const float x_42 = func_(); + v = float4(x_42, x_42, x_42, x_42); + } + if ((tint_pack4x8unorm(v) == 1u)) { + return; + } + const uint x_50 = x_8[0].x; + if (((1u << x_50) == 2u)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_57 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + const float x_58 = float(x_57); + x_GLF_color = float4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..421d745950 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.msl @@ -0,0 +1,69 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ uint one; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_() { + switch(1) { + case 0: { + return 1.0f; + break; + } + default: { + break; + } + } + return 0.0f; +} + +void main_1(constant buf1& x_8, constant buf0& x_10, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float4 v = 0.0f; + v = float4(1.0f, 1.0f, 1.0f, 1.0f); + float const x_38 = (*(tint_symbol_5)).y; + if ((x_38 < 0.0f)) { + float const x_42 = func_(); + v = float4(x_42, x_42, x_42, x_42); + } + float4 const x_44 = v; + if ((pack_float_to_unorm4x8(x_44) == 1u)) { + return; + } + uint const x_50 = x_8.one; + if (((1u << x_50) == 2u)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + int const x_57 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_58 = float(x_57); + *(tint_symbol_6) = float4(x_58, x_58, x_58, x_58); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_8 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, x_10, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8cf95c0901 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 82 +; Schema: 0 + OpCapability Shader + %48 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "one" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_ "func_" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_1 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %buf1 = OpTypeStruct %uint +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %buf0 = OpTypeStruct %_arr_int_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %21 = OpTypeFunction %float + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %void = OpTypeVoid + %30 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %36 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Private_float = OpTypePointer Private %float + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_2 = OpConstant %uint 2 + %62 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %69 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %21 + %23 = OpLabel + OpSelectionMerge %24 None + OpSwitch %int_1 %26 0 %27 + %27 = OpLabel + OpReturnValue %float_1 + %26 = OpLabel + OpBranch %24 + %24 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + %main_1 = OpFunction %void None %30 + %33 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %5 + OpStore %v %36 + %38 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %39 = OpLoad %float %38 + %40 = OpFOrdLessThan %bool %39 %float_0 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %42 + %43 = OpLabel + %44 = OpFunctionCall %float %func_ + %45 = OpCompositeConstruct %v4float %44 %44 %44 %44 + OpStore %v %45 + OpBranch %42 + %42 = OpLabel + %46 = OpLoad %v4float %v + %47 = OpExtInst %uint %48 PackUnorm4x8 %46 + %49 = OpIEqual %bool %47 %uint_1 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpReturn + %50 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_uint %x_8 %uint_0 + %55 = OpLoad %uint %54 + %56 = OpShiftLeftLogical %uint %uint_1 %55 + %58 = OpIEqual %bool %56 %uint_2 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + OpStore %x_GLF_color %62 + OpBranch %59 + %61 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + %68 = OpCompositeConstruct %v4float %67 %67 %67 %67 + OpStore %x_GLF_color %68 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %69 +%tint_symbol_1 = OpFunctionParameter %main_out + %73 = OpLabel + %74 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %74 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %30 + %76 = OpLabel + %77 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %77 + %78 = OpFunctionCall %void %main_1 + %80 = OpLoad %v4float %x_GLF_color + %81 = OpCompositeConstruct %main_out %80 + %79 = OpFunctionCall %void %tint_symbol_3 %81 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..3db210a134 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.spvasm.expected.wgsl @@ -0,0 +1,65 @@ +[[block]] +struct buf1 { + one : u32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn func_() -> f32 { + switch(1) { + case 0: { + return 1.0; + } + default: { + } + } + return 0.0; +} + +fn main_1() { + var v : vec4; + v = vec4(1.0, 1.0, 1.0, 1.0); + let x_38 : f32 = gl_FragCoord.y; + if ((x_38 < 0.0)) { + let x_42 : f32 = func_(); + v = vec4(x_42, x_42, x_42, x_42); + } + let x_44 : vec4 = v; + if ((pack4x8unorm(x_44) == 1u)) { + return; + } + let x_50 : u32 = x_8.one; + if (((1u << x_50) == 2u)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + let x_57 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl new file mode 100644 index 0000000000..3db210a134 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl @@ -0,0 +1,65 @@ +[[block]] +struct buf1 { + one : u32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn func_() -> f32 { + switch(1) { + case 0: { + return 1.0; + } + default: { + } + } + return 0.0; +} + +fn main_1() { + var v : vec4; + v = vec4(1.0, 1.0, 1.0, 1.0); + let x_38 : f32 = gl_FragCoord.y; + if ((x_38 < 0.0)) { + let x_42 : f32 = func_(); + v = vec4(x_42, x_42, x_42, x_42); + } + let x_44 : vec4 = v; + if ((pack4x8unorm(x_44) == 1u)) { + return; + } + let x_50 : u32 = x_8.one; + if (((1u << x_50) == 2u)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + let x_57 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..94cc273cfe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.hlsl @@ -0,0 +1,68 @@ +uint tint_pack4x8unorm(float4 param_0) { + uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0)); + return (i.x | i.y << 8 | i.z << 16 | i.w << 24); +} + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; + +float func_() { + switch(1) { + case 0: { + return 1.0f; + break; + } + default: { + break; + } + } + return 0.0f; +} + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + v = float4(1.0f, 1.0f, 1.0f, 1.0f); + const float x_38 = gl_FragCoord.y; + if ((x_38 < 0.0f)) { + const float x_42 = func_(); + v = float4(x_42, x_42, x_42, x_42); + } + if ((tint_pack4x8unorm(v) == 1u)) { + return; + } + const uint x_50 = x_8[0].x; + if (((1u << x_50) == 2u)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_57 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + const float x_58 = float(x_57); + x_GLF_color = float4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..421d745950 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.msl @@ -0,0 +1,69 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ uint one; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_() { + switch(1) { + case 0: { + return 1.0f; + break; + } + default: { + break; + } + } + return 0.0f; +} + +void main_1(constant buf1& x_8, constant buf0& x_10, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float4 v = 0.0f; + v = float4(1.0f, 1.0f, 1.0f, 1.0f); + float const x_38 = (*(tint_symbol_5)).y; + if ((x_38 < 0.0f)) { + float const x_42 = func_(); + v = float4(x_42, x_42, x_42, x_42); + } + float4 const x_44 = v; + if ((pack_float_to_unorm4x8(x_44) == 1u)) { + return; + } + uint const x_50 = x_8.one; + if (((1u << x_50) == 2u)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + int const x_57 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_58 = float(x_57); + *(tint_symbol_6) = float4(x_58, x_58, x_58, x_58); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_8 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, x_10, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8cf95c0901 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 82 +; Schema: 0 + OpCapability Shader + %48 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "one" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_ "func_" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_1 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %buf1 = OpTypeStruct %uint +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %buf0 = OpTypeStruct %_arr_int_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %21 = OpTypeFunction %float + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %void = OpTypeVoid + %30 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %36 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Private_float = OpTypePointer Private %float + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_2 = OpConstant %uint 2 + %62 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %69 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %21 + %23 = OpLabel + OpSelectionMerge %24 None + OpSwitch %int_1 %26 0 %27 + %27 = OpLabel + OpReturnValue %float_1 + %26 = OpLabel + OpBranch %24 + %24 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + %main_1 = OpFunction %void None %30 + %33 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %5 + OpStore %v %36 + %38 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %39 = OpLoad %float %38 + %40 = OpFOrdLessThan %bool %39 %float_0 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %42 + %43 = OpLabel + %44 = OpFunctionCall %float %func_ + %45 = OpCompositeConstruct %v4float %44 %44 %44 %44 + OpStore %v %45 + OpBranch %42 + %42 = OpLabel + %46 = OpLoad %v4float %v + %47 = OpExtInst %uint %48 PackUnorm4x8 %46 + %49 = OpIEqual %bool %47 %uint_1 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpReturn + %50 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_uint %x_8 %uint_0 + %55 = OpLoad %uint %54 + %56 = OpShiftLeftLogical %uint %uint_1 %55 + %58 = OpIEqual %bool %56 %uint_2 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + OpStore %x_GLF_color %62 + OpBranch %59 + %61 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + %68 = OpCompositeConstruct %v4float %67 %67 %67 %67 + OpStore %x_GLF_color %68 + OpBranch %59 + %59 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %69 +%tint_symbol_1 = OpFunctionParameter %main_out + %73 = OpLabel + %74 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %74 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %30 + %76 = OpLabel + %77 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %77 + %78 = OpFunctionCall %void %main_1 + %80 = OpLoad %v4float %x_GLF_color + %81 = OpCompositeConstruct %main_out %80 + %79 = OpFunctionCall %void %tint_symbol_3 %81 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..3db210a134 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-missing-return-value-function-never-called/0-opt.wgsl.expected.wgsl @@ -0,0 +1,65 @@ +[[block]] +struct buf1 { + one : u32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn func_() -> f32 { + switch(1) { + case 0: { + return 1.0; + } + default: { + } + } + return 0.0; +} + +fn main_1() { + var v : vec4; + v = vec4(1.0, 1.0, 1.0, 1.0); + let x_38 : f32 = gl_FragCoord.y; + if ((x_38 < 0.0)) { + let x_42 : f32 = func_(); + v = vec4(x_42, x_42, x_42, x_42); + } + let x_44 : vec4 = v; + if ((pack4x8unorm(x_44) == 1u)) { + return; + } + let x_50 : u32 = x_8.one; + if (((1u << x_50) == 2u)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + let x_57 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm new file mode 100644 index 0000000000..1499e61e8e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm @@ -0,0 +1,70 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %main = OpFunction %void None %9 + %25 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %26 = OpBitcast %float %uint_1 + %27 = OpFMod %float %26 %float_1 + OpStore %a %27 + %28 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %29 = OpLoad %float %28 + %30 = OpCompositeConstruct %v4float %29 %29 %29 %29 + OpStore %_GLF_color %30 + %31 = OpLoad %float %a + %32 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %33 = OpLoad %float %32 + %34 = OpFOrdLessThan %bool %31 %33 + OpSelectionMerge %35 None + OpBranchConditional %34 %36 %35 + %36 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpCompositeConstruct %v4float %38 %40 %42 %44 + OpStore %_GLF_color %45 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..307332dcd0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.hlsl @@ -0,0 +1,37 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; + +void main_1() { + float a = 0.0f; + a = (asfloat(1u) % 1.0f); + const float x_29 = asfloat(x_6[1].x); + x_GLF_color = float4(x_29, x_29, x_29, x_29); + const float x_31 = a; + const float x_33 = asfloat(x_6[2].x); + if ((x_31 < x_33)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_38 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_40 = asfloat(x_6[1].x); + const float x_42 = asfloat(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(x_38, x_40, x_42, x_44); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.msl new file mode 100755 index 0000000000..6652116518 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.msl @@ -0,0 +1,52 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float a = 0.0f; + a = (as_type(1u) % 1.0f); + float const x_29 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_29, x_29, x_29, x_29); + float const x_31 = a; + float const x_33 = x_6.x_GLF_uniform_float_values.arr[2].el; + if ((x_31 < x_33)) { + float const x_38 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_40 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_38, x_40, x_42, x_44); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +T:\tmp\uf8c.0.metal:23:27: error: invalid operands to binary expression ('float' and 'float') + a = (as_type(1u) % 1.0f); + ~~~~~~~~~~~~~~~~~~ ^ ~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..5169c11e66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.spvasm @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpConstantNull %float + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %a = OpVariable %_ptr_Function_float Function %20 + %21 = OpBitcast %float %uint_1 + %24 = OpFMod %float %21 %float_1 + OpStore %a %24 + %29 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %30 = OpLoad %float %29 + %31 = OpCompositeConstruct %v4float %30 %30 %30 %30 + OpStore %x_GLF_color %31 + %32 = OpLoad %float %a + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %35 = OpLoad %float %34 + %36 = OpFOrdLessThan %bool %32 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %38 + %39 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %44 = OpLoad %float %43 + %45 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %46 = OpLoad %float %45 + %47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %48 = OpLoad %float %47 + %49 = OpCompositeConstruct %v4float %42 %44 %46 %48 + OpStore %x_GLF_color %49 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %50 +%tint_symbol = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %57 = OpLabel + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_2 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..8f1d93633a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.spvasm.expected.wgsl @@ -0,0 +1,38 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var a : f32; + a = (bitcast(1u) % 1.0); + let x_29 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_29, x_29, x_29, x_29); + let x_31 : f32 = a; + let x_33 : f32 = x_6.x_GLF_uniform_float_values[2]; + if ((x_31 < x_33)) { + let x_38 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_38, x_40, x_42, x_44); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl new file mode 100644 index 0000000000..8f1d93633a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl @@ -0,0 +1,38 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var a : f32; + a = (bitcast(1u) % 1.0); + let x_29 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_29, x_29, x_29, x_29); + let x_31 : f32 = a; + let x_33 : f32 = x_6.x_GLF_uniform_float_values[2]; + if ((x_31 < x_33)) { + let x_38 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_38, x_40, x_42, x_44); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..307332dcd0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; + +void main_1() { + float a = 0.0f; + a = (asfloat(1u) % 1.0f); + const float x_29 = asfloat(x_6[1].x); + x_GLF_color = float4(x_29, x_29, x_29, x_29); + const float x_31 = a; + const float x_33 = asfloat(x_6[2].x); + if ((x_31 < x_33)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_38 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const float x_40 = asfloat(x_6[1].x); + const float x_42 = asfloat(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(x_38, x_40, x_42, x_44); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.msl new file mode 100755 index 0000000000..da17ed9397 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.msl @@ -0,0 +1,52 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float a = 0.0f; + a = (as_type(1u) % 1.0f); + float const x_29 = x_6.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_29, x_29, x_29, x_29); + float const x_31 = a; + float const x_33 = x_6.x_GLF_uniform_float_values.arr[2].el; + if ((x_31 < x_33)) { + float const x_38 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_40 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_38, x_40, x_42, x_44); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +T:\tmp\ue28.0.metal:23:27: error: invalid operands to binary expression ('float' and 'float') + a = (as_type(1u) % 1.0f); + ~~~~~~~~~~~~~~~~~~ ^ ~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5169c11e66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.spvasm @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpConstantNull %float + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %a = OpVariable %_ptr_Function_float Function %20 + %21 = OpBitcast %float %uint_1 + %24 = OpFMod %float %21 %float_1 + OpStore %a %24 + %29 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %30 = OpLoad %float %29 + %31 = OpCompositeConstruct %v4float %30 %30 %30 %30 + OpStore %x_GLF_color %31 + %32 = OpLoad %float %a + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %35 = OpLoad %float %34 + %36 = OpFOrdLessThan %bool %32 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %38 + %39 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %44 = OpLoad %float %43 + %45 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %46 = OpLoad %float %45 + %47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %48 = OpLoad %float %47 + %49 = OpCompositeConstruct %v4float %42 %44 %46 %48 + OpStore %x_GLF_color %49 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %50 +%tint_symbol = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %57 = OpLabel + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_2 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..8f1d93633a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-mod-uint-bits-float/0-opt.wgsl.expected.wgsl @@ -0,0 +1,38 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var a : f32; + a = (bitcast(1u) % 1.0); + let x_29 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_29, x_29, x_29, x_29); + let x_31 : f32 = a; + let x_33 : f32 = x_6.x_GLF_uniform_float_values[2]; + if ((x_31 < x_33)) { + let x_38 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_38, x_40, x_42, x_44); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm new file mode 100644 index 0000000000..7ea2f77a27 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm @@ -0,0 +1,127 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %b "b" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_uint_values" + OpName %__1 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 2 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_arr_uint_uint_1 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf2 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %_ = OpVariable %_ptr_Uniform_buf2 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %buf1 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__1 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %17 + %39 = OpLabel + %a = OpVariable %_ptr_Function_uint Function + %b = OpVariable %_ptr_Function_int Function + OpStore %a %uint_0 + %40 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %41 = OpLoad %int %40 + OpStore %b %41 + %42 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %43 = OpLoad %float %42 + %44 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %45 = OpLoad %float %44 + %46 = OpFOrdLessThan %bool %43 %45 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_uint %__1 %int_0 %int_0 + %50 = OpLoad %uint %49 + %51 = OpLoad %uint %a + %52 = OpUMod %uint %50 %51 + %53 = OpBitcast %int %52 + OpStore %b %53 + OpBranch %47 + %47 = OpLabel + %54 = OpLoad %int %b + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpIEqual %bool %54 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %68 + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %71 + %73 = OpCompositeConstruct %v4float %63 %66 %69 %72 + OpStore %_GLF_color %73 + OpBranch %58 + %60 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpCompositeConstruct %v4float %76 %76 %76 %76 + OpStore %_GLF_color %77 + OpBranch %58 + %58 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..df48733a2d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.hlsl @@ -0,0 +1,63 @@ +cbuffer cbuffer_x_8 : register(b2, space0) { + uint4 x_8[2]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +cbuffer cbuffer_x_12 : register(b1, space0) { + uint4 x_12[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + int b = 0; + a = 0u; + const int x_41 = asint(x_8[1].x); + b = x_41; + const float x_43 = gl_FragCoord.x; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_10[scalar_offset / 4][scalar_offset % 4]); + if ((x_43 < x_45)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const uint x_50 = x_12[scalar_offset_1 / 4][scalar_offset_1 % 4]; + b = asint((x_50 % a)); + } + const int x_54 = b; + const int x_56 = asint(x_8[1].x); + if ((x_54 == x_56)) { + const int x_62 = asint(x_8[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_65 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_68 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_71 = asint(x_8[1].x); + x_GLF_color = float4(float(x_62), float(x_65), float(x_68), float(x_71)); + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_75 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_76 = float(x_75); + x_GLF_color = float4(x_76, x_76, x_76, x_76); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..2639d33c31 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf2 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_2 { + /* 0x0000 */ uint el; + /* 0x0004 */ int8_t tint_pad_2[12]; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ tint_padded_array_element_2 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_2 x_GLF_uniform_uint_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf2& x_8, constant buf0& x_10, constant buf1& x_12, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + uint a = 0u; + int b = 0; + a = 0u; + int const x_41 = x_8.x_GLF_uniform_int_values.arr[1].el; + b = x_41; + float const x_43 = (*(tint_symbol_5)).x; + float const x_45 = x_10.x_GLF_uniform_float_values.arr[0].el; + if ((x_43 < x_45)) { + uint const x_50 = x_12.x_GLF_uniform_uint_values.arr[0].el; + uint const x_51 = a; + b = as_type((x_50 % x_51)); + } + int const x_54 = b; + int const x_56 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_54 == x_56)) { + int const x_62 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_68 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_71 = x_8.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_6) = float4(float(x_62), float(x_65), float(x_68), float(x_71)); + } else { + int const x_75 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_76 = float(x_75); + *(tint_symbol_6) = float4(x_76, x_76, x_76, x_76); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf2& x_8 [[buffer(2)]], constant buf0& x_10 [[buffer(0)]], constant buf1& x_12 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, x_10, x_12, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..7ecd6230b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.spvasm @@ -0,0 +1,166 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 96 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf2 "buf2" + OpMemberName %buf2 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_uint_values" + OpName %x_12 "x_12" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_uint_uint_1 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf2 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_8 = OpVariable %_ptr_Uniform_buf2 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %buf1 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_12 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %33 = OpConstantNull %uint +%_ptr_Function_int = OpTypePointer Function %int + %36 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Private_float = OpTypePointer Private %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %main_out = OpTypeStruct %v4float + %83 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %27 + %30 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %33 + %b = OpVariable %_ptr_Function_int Function %36 + OpStore %a %uint_0 + %40 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %41 = OpLoad %int %40 + OpStore %b %41 + %43 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %44 = OpLoad %float %43 + %47 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %48 = OpLoad %float %47 + %49 = OpFOrdLessThan %bool %44 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %52 %51 + %52 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_uint %x_12 %uint_0 %int_0 + %55 = OpLoad %uint %54 + %56 = OpLoad %uint %a + %58 = OpUMod %uint %55 %56 + %57 = OpBitcast %int %58 + OpStore %b %57 + OpBranch %51 + %51 = OpLabel + %59 = OpLoad %int %b + %60 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpIEqual %bool %59 %61 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + %66 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpConvertSToF %float %67 + %75 = OpConvertSToF %float %69 + %76 = OpConvertSToF %float %71 + %77 = OpConvertSToF %float %73 + %78 = OpCompositeConstruct %v4float %74 %75 %76 %77 + OpStore %x_GLF_color %78 + OpBranch %63 + %65 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %80 + %82 = OpCompositeConstruct %v4float %81 %81 %81 %81 + OpStore %x_GLF_color %82 + OpBranch %63 + %63 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %83 +%tint_symbol_1 = OpFunctionParameter %main_out + %87 = OpLabel + %88 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %88 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %90 = OpLabel + %91 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %91 + %92 = OpFunctionCall %void %main_1 + %94 = OpLoad %v4float %x_GLF_color + %95 = OpCompositeConstruct %main_out %94 + %93 = OpFunctionCall %void %tint_symbol_3 %95 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5204e887fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_uint_values : Arr_2; +}; + +[[group(0), binding(2)]] var x_8 : buf2; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +[[group(0), binding(1)]] var x_12 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var b : i32; + a = 0u; + let x_41 : i32 = x_8.x_GLF_uniform_int_values[1]; + b = x_41; + let x_43 : f32 = gl_FragCoord.x; + let x_45 : f32 = x_10.x_GLF_uniform_float_values[0]; + if ((x_43 < x_45)) { + let x_50 : u32 = x_12.x_GLF_uniform_uint_values[0]; + let x_51 : u32 = a; + b = bitcast((x_50 % x_51)); + } + let x_54 : i32 = b; + let x_56 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_54 == x_56)) { + let x_62 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_68 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_71 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_62), f32(x_65), f32(x_68), f32(x_71)); + } else { + let x_75 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_76 : f32 = f32(x_75); + x_GLF_color = vec4(x_76, x_76, x_76, x_76); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl new file mode 100644 index 0000000000..5204e887fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_uint_values : Arr_2; +}; + +[[group(0), binding(2)]] var x_8 : buf2; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +[[group(0), binding(1)]] var x_12 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var b : i32; + a = 0u; + let x_41 : i32 = x_8.x_GLF_uniform_int_values[1]; + b = x_41; + let x_43 : f32 = gl_FragCoord.x; + let x_45 : f32 = x_10.x_GLF_uniform_float_values[0]; + if ((x_43 < x_45)) { + let x_50 : u32 = x_12.x_GLF_uniform_uint_values[0]; + let x_51 : u32 = a; + b = bitcast((x_50 % x_51)); + } + let x_54 : i32 = b; + let x_56 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_54 == x_56)) { + let x_62 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_68 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_71 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_62), f32(x_65), f32(x_68), f32(x_71)); + } else { + let x_75 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_76 : f32 = f32(x_75); + x_GLF_color = vec4(x_76, x_76, x_76, x_76); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..df48733a2d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.hlsl @@ -0,0 +1,63 @@ +cbuffer cbuffer_x_8 : register(b2, space0) { + uint4 x_8[2]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +cbuffer cbuffer_x_12 : register(b1, space0) { + uint4 x_12[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + int b = 0; + a = 0u; + const int x_41 = asint(x_8[1].x); + b = x_41; + const float x_43 = gl_FragCoord.x; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_10[scalar_offset / 4][scalar_offset % 4]); + if ((x_43 < x_45)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const uint x_50 = x_12[scalar_offset_1 / 4][scalar_offset_1 % 4]; + b = asint((x_50 % a)); + } + const int x_54 = b; + const int x_56 = asint(x_8[1].x); + if ((x_54 == x_56)) { + const int x_62 = asint(x_8[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_65 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_68 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_71 = asint(x_8[1].x); + x_GLF_color = float4(float(x_62), float(x_65), float(x_68), float(x_71)); + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_75 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_76 = float(x_75); + x_GLF_color = float4(x_76, x_76, x_76, x_76); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..2639d33c31 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf2 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_2 { + /* 0x0000 */ uint el; + /* 0x0004 */ int8_t tint_pad_2[12]; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ tint_padded_array_element_2 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_2 x_GLF_uniform_uint_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf2& x_8, constant buf0& x_10, constant buf1& x_12, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + uint a = 0u; + int b = 0; + a = 0u; + int const x_41 = x_8.x_GLF_uniform_int_values.arr[1].el; + b = x_41; + float const x_43 = (*(tint_symbol_5)).x; + float const x_45 = x_10.x_GLF_uniform_float_values.arr[0].el; + if ((x_43 < x_45)) { + uint const x_50 = x_12.x_GLF_uniform_uint_values.arr[0].el; + uint const x_51 = a; + b = as_type((x_50 % x_51)); + } + int const x_54 = b; + int const x_56 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_54 == x_56)) { + int const x_62 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_68 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_71 = x_8.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_6) = float4(float(x_62), float(x_65), float(x_68), float(x_71)); + } else { + int const x_75 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_76 = float(x_75); + *(tint_symbol_6) = float4(x_76, x_76, x_76, x_76); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf2& x_8 [[buffer(2)]], constant buf0& x_10 [[buffer(0)]], constant buf1& x_12 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, x_10, x_12, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..7ecd6230b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.spvasm @@ -0,0 +1,166 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 96 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf2 "buf2" + OpMemberName %buf2 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_uint_values" + OpName %x_12 "x_12" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_uint_uint_1 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf2 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_8 = OpVariable %_ptr_Uniform_buf2 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %buf1 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_12 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %33 = OpConstantNull %uint +%_ptr_Function_int = OpTypePointer Function %int + %36 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Private_float = OpTypePointer Private %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %main_out = OpTypeStruct %v4float + %83 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %27 + %30 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %33 + %b = OpVariable %_ptr_Function_int Function %36 + OpStore %a %uint_0 + %40 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %41 = OpLoad %int %40 + OpStore %b %41 + %43 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %44 = OpLoad %float %43 + %47 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %48 = OpLoad %float %47 + %49 = OpFOrdLessThan %bool %44 %48 + OpSelectionMerge %51 None + OpBranchConditional %49 %52 %51 + %52 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_uint %x_12 %uint_0 %int_0 + %55 = OpLoad %uint %54 + %56 = OpLoad %uint %a + %58 = OpUMod %uint %55 %56 + %57 = OpBitcast %int %58 + OpStore %b %57 + OpBranch %51 + %51 = OpLabel + %59 = OpLoad %int %b + %60 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpIEqual %bool %59 %61 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + %66 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpConvertSToF %float %67 + %75 = OpConvertSToF %float %69 + %76 = OpConvertSToF %float %71 + %77 = OpConvertSToF %float %73 + %78 = OpCompositeConstruct %v4float %74 %75 %76 %77 + OpStore %x_GLF_color %78 + OpBranch %63 + %65 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %80 + %82 = OpCompositeConstruct %v4float %81 %81 %81 %81 + OpStore %x_GLF_color %82 + OpBranch %63 + %63 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %83 +%tint_symbol_1 = OpFunctionParameter %main_out + %87 = OpLabel + %88 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %88 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %90 = OpLabel + %91 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %91 + %92 = OpFunctionCall %void %main_1 + %94 = OpLoad %v4float %x_GLF_color + %95 = OpCompositeConstruct %main_out %94 + %93 = OpFunctionCall %void %tint_symbol_3 %95 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5204e887fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_uint_values : Arr_2; +}; + +[[group(0), binding(2)]] var x_8 : buf2; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +[[group(0), binding(1)]] var x_12 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var b : i32; + a = 0u; + let x_41 : i32 = x_8.x_GLF_uniform_int_values[1]; + b = x_41; + let x_43 : f32 = gl_FragCoord.x; + let x_45 : f32 = x_10.x_GLF_uniform_float_values[0]; + if ((x_43 < x_45)) { + let x_50 : u32 = x_12.x_GLF_uniform_uint_values[0]; + let x_51 : u32 = a; + b = bitcast((x_50 % x_51)); + } + let x_54 : i32 = b; + let x_56 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_54 == x_56)) { + let x_62 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_68 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_71 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_62), f32(x_65), f32(x_68), f32(x_71)); + } else { + let x_75 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_76 : f32 = f32(x_75); + x_GLF_color = vec4(x_76, x_76, x_76, x_76); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm new file mode 100644 index 0000000000..e63a57ee20 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm @@ -0,0 +1,940 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %_GLF_global_loop_count "_GLF_global_loop_count" + OpName %m23 "m23" + OpName %m24 "m24" + OpName %m32 "m32" + OpName %m33 "m33" + OpName %m34 "m34" + OpName %m42 "m42" + OpName %m43 "m43" + OpName %m44 "m44" + OpName %i "i" + OpName %i_0 "i" + OpName %i_1 "i" + OpName %i_2 "i" + OpName %i_3 "i" + OpName %i_4 "i" + OpName %i_5 "i" + OpName %i_6 "i" + OpName %i_7 "i" + OpName %i_8 "i" + OpName %i_9 "i" + OpName %i_10 "i" + OpName %i_11 "i" + OpName %i_12 "i" + OpName %i_13 "i" + OpName %i_14 "i" + OpName %i_15 "i" + OpName %i_16 "i" + OpName %i_17 "i" + OpName %i_18 "i" + OpName %i_19 "i" + OpName %i_20 "i" + OpName %i_21 "i" + OpName %i_22 "i" + OpName %i_23 "i" + OpName %i_24 "i" + OpName %i_25 "i" + OpName %i_26 "i" + OpName %i_27 "i" + OpName %i_28 "i" + OpName %i_29 "i" + OpName %i_30 "i" + OpName %i_31 "i" + OpName %i_32 "i" + OpName %i_33 "i" + OpName %i_34 "i" + OpName %i_35 "i" + OpName %i_36 "i" + OpName %sum "sum" + OpName %r "r" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %54 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int +%_GLF_global_loop_count = OpVariable %_ptr_Private_int Private + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %float_0 = OpConstant %float 0 + %63 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %64 = OpConstantComposite %mat2v3float %63 %63 + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float + %68 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %69 = OpConstantComposite %mat2v4float %68 %68 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float + %73 = OpConstantComposite %v2float %float_0 %float_0 + %74 = OpConstantComposite %mat3v2float %73 %73 %73 +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %77 = OpConstantComposite %mat3v3float %63 %63 %63 +%mat3v4float = OpTypeMatrix %v4float 3 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %80 = OpConstantComposite %mat3v4float %68 %68 %68 +%mat4v2float = OpTypeMatrix %v2float 4 +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float + %83 = OpConstantComposite %mat4v2float %73 %73 %73 %73 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %86 = OpConstantComposite %mat4v3float %63 %63 %63 %63 +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %89 = OpConstantComposite %mat4v4float %68 %68 %68 %68 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_98 = OpConstant %int 98 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %int_100 = OpConstant %int 100 + %float_8 = OpConstant %float 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %99 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %54 + %100 = OpLabel + %m23 = OpVariable %_ptr_Function_mat2v3float Function + %m24 = OpVariable %_ptr_Function_mat2v4float Function + %m32 = OpVariable %_ptr_Function_mat3v2float Function + %m33 = OpVariable %_ptr_Function_mat3v3float Function + %m34 = OpVariable %_ptr_Function_mat3v4float Function + %m42 = OpVariable %_ptr_Function_mat4v2float Function + %m43 = OpVariable %_ptr_Function_mat4v3float Function + %m44 = OpVariable %_ptr_Function_mat4v4float Function + %i = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %i_2 = OpVariable %_ptr_Function_int Function + %i_3 = OpVariable %_ptr_Function_int Function + %i_4 = OpVariable %_ptr_Function_int Function + %i_5 = OpVariable %_ptr_Function_int Function + %i_6 = OpVariable %_ptr_Function_int Function + %i_7 = OpVariable %_ptr_Function_int Function + %i_8 = OpVariable %_ptr_Function_int Function + %i_9 = OpVariable %_ptr_Function_int Function + %i_10 = OpVariable %_ptr_Function_int Function + %i_11 = OpVariable %_ptr_Function_int Function + %i_12 = OpVariable %_ptr_Function_int Function + %i_13 = OpVariable %_ptr_Function_int Function + %i_14 = OpVariable %_ptr_Function_int Function + %i_15 = OpVariable %_ptr_Function_int Function + %i_16 = OpVariable %_ptr_Function_int Function + %i_17 = OpVariable %_ptr_Function_int Function + %i_18 = OpVariable %_ptr_Function_int Function + %i_19 = OpVariable %_ptr_Function_int Function + %i_20 = OpVariable %_ptr_Function_int Function + %i_21 = OpVariable %_ptr_Function_int Function + %i_22 = OpVariable %_ptr_Function_int Function + %i_23 = OpVariable %_ptr_Function_int Function + %i_24 = OpVariable %_ptr_Function_int Function + %i_25 = OpVariable %_ptr_Function_int Function + %i_26 = OpVariable %_ptr_Function_int Function + %i_27 = OpVariable %_ptr_Function_int Function + %i_28 = OpVariable %_ptr_Function_int Function + %i_29 = OpVariable %_ptr_Function_int Function + %i_30 = OpVariable %_ptr_Function_int Function + %i_31 = OpVariable %_ptr_Function_int Function + %i_32 = OpVariable %_ptr_Function_int Function + %i_33 = OpVariable %_ptr_Function_int Function + %i_34 = OpVariable %_ptr_Function_int Function + %i_35 = OpVariable %_ptr_Function_int Function + %i_36 = OpVariable %_ptr_Function_int Function + %sum = OpVariable %_ptr_Function_float Function + %r = OpVariable %_ptr_Function_int Function + OpStore %_GLF_global_loop_count %int_0 + OpStore %m23 %64 + OpStore %m24 %69 + OpStore %m32 %74 + OpStore %m33 %77 + OpStore %m34 %80 + OpStore %m42 %83 + OpStore %m43 %86 + OpStore %m44 %89 + OpStore %i %int_0 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %102 %103 None + OpBranch %104 + %104 = OpLabel + %105 = OpLoad %int %i + %106 = OpSLessThan %bool %105 %int_1 + OpBranchConditional %106 %107 %102 + %107 = OpLabel + OpStore %i_0 %int_0 + OpBranch %108 + %108 = OpLabel + OpLoopMerge %109 %110 None + OpBranch %111 + %111 = OpLabel + %112 = OpLoad %int %i_0 + %113 = OpSLessThan %bool %112 %int_1 + OpBranchConditional %113 %114 %109 + %114 = OpLabel + OpStore %i_1 %int_0 + OpBranch %115 + %115 = OpLabel + OpLoopMerge %116 %117 None + OpBranch %118 + %118 = OpLabel + %119 = OpLoad %int %i_1 + %120 = OpSLessThan %bool %119 %int_1 + OpBranchConditional %120 %121 %116 + %121 = OpLabel + OpStore %i_2 %int_0 + OpBranch %122 + %122 = OpLabel + OpLoopMerge %123 %124 None + OpBranch %125 + %125 = OpLabel + %126 = OpLoad %int %i_2 + %127 = OpSLessThan %bool %126 %int_1 + OpBranchConditional %127 %128 %123 + %128 = OpLabel + OpStore %i_3 %int_0 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %133 = OpLoad %int %i_3 + %134 = OpSLessThan %bool %133 %int_1 + OpBranchConditional %134 %135 %130 + %135 = OpLabel + OpStore %i_4 %int_0 + OpBranch %136 + %136 = OpLabel + OpLoopMerge %137 %138 None + OpBranch %139 + %139 = OpLabel + %140 = OpLoad %int %i_4 + %141 = OpSLessThan %bool %140 %int_1 + OpBranchConditional %141 %142 %137 + %142 = OpLabel + OpStore %i_5 %int_0 + OpBranch %143 + %143 = OpLabel + OpLoopMerge %144 %145 None + OpBranch %146 + %146 = OpLabel + %147 = OpLoad %int %i_5 + %148 = OpSLessThan %bool %147 %int_1 + OpBranchConditional %148 %149 %144 + %149 = OpLabel + OpStore %i_6 %int_0 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %154 = OpLoad %int %i_6 + %155 = OpSLessThan %bool %154 %int_1 + OpBranchConditional %155 %156 %151 + %156 = OpLabel + OpStore %i_7 %int_0 + OpBranch %157 + %157 = OpLabel + OpLoopMerge %158 %159 None + OpBranch %160 + %160 = OpLabel + %161 = OpLoad %int %i_7 + %162 = OpSLessThan %bool %161 %int_1 + OpBranchConditional %162 %163 %158 + %163 = OpLabel + OpStore %i_8 %int_0 + OpBranch %164 + %164 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %int %i_8 + %169 = OpSLessThan %bool %168 %int_1 + OpBranchConditional %169 %170 %165 + %170 = OpLabel + OpStore %i_9 %int_0 + OpBranch %171 + %171 = OpLabel + OpLoopMerge %172 %173 None + OpBranch %174 + %174 = OpLabel + %175 = OpLoad %int %i_9 + %176 = OpSLessThan %bool %175 %int_1 + OpBranchConditional %176 %177 %172 + %177 = OpLabel + OpStore %i_10 %int_0 + OpBranch %178 + %178 = OpLabel + OpLoopMerge %179 %180 None + OpBranch %181 + %181 = OpLabel + %182 = OpLoad %int %i_10 + %183 = OpSLessThan %bool %182 %int_1 + OpBranchConditional %183 %184 %179 + %184 = OpLabel + OpStore %i_11 %int_0 + OpBranch %185 + %185 = OpLabel + OpLoopMerge %186 %187 None + OpBranch %188 + %188 = OpLabel + %189 = OpLoad %int %i_11 + %190 = OpSLessThan %bool %189 %int_1 + OpBranchConditional %190 %191 %186 + %191 = OpLabel + OpStore %i_12 %int_0 + OpBranch %192 + %192 = OpLabel + OpLoopMerge %193 %194 None + OpBranch %195 + %195 = OpLabel + %196 = OpLoad %int %i_12 + %197 = OpSLessThan %bool %196 %int_1 + OpBranchConditional %197 %198 %193 + %198 = OpLabel + OpStore %i_13 %int_0 + OpBranch %199 + %199 = OpLabel + OpLoopMerge %200 %201 None + OpBranch %202 + %202 = OpLabel + %203 = OpLoad %int %i_13 + %204 = OpSLessThan %bool %203 %int_1 + OpBranchConditional %204 %205 %200 + %205 = OpLabel + OpStore %i_14 %int_0 + OpBranch %206 + %206 = OpLabel + OpLoopMerge %207 %208 None + OpBranch %209 + %209 = OpLabel + %210 = OpLoad %int %i_14 + %211 = OpSLessThan %bool %210 %int_1 + OpBranchConditional %211 %212 %207 + %212 = OpLabel + OpStore %i_15 %int_0 + OpBranch %213 + %213 = OpLabel + OpLoopMerge %214 %215 None + OpBranch %216 + %216 = OpLabel + %217 = OpLoad %int %i_15 + %218 = OpSLessThan %bool %217 %int_1 + OpBranchConditional %218 %219 %214 + %219 = OpLabel + OpStore %i_16 %int_0 + OpBranch %220 + %220 = OpLabel + OpLoopMerge %221 %222 None + OpBranch %223 + %223 = OpLabel + %224 = OpLoad %int %i_16 + %225 = OpSLessThan %bool %224 %int_1 + OpBranchConditional %225 %226 %221 + %226 = OpLabel + OpStore %i_17 %int_0 + OpBranch %227 + %227 = OpLabel + OpLoopMerge %228 %229 None + OpBranch %230 + %230 = OpLabel + %231 = OpLoad %int %i_17 + %232 = OpSLessThan %bool %231 %int_1 + OpBranchConditional %232 %233 %228 + %233 = OpLabel + OpStore %i_18 %int_0 + OpBranch %234 + %234 = OpLabel + OpLoopMerge %235 %236 None + OpBranch %237 + %237 = OpLabel + %238 = OpLoad %int %i_18 + %239 = OpSLessThan %bool %238 %int_1 + OpBranchConditional %239 %240 %235 + %240 = OpLabel + OpStore %i_19 %int_0 + OpBranch %241 + %241 = OpLabel + OpLoopMerge %242 %243 None + OpBranch %244 + %244 = OpLabel + %245 = OpLoad %int %i_19 + %246 = OpSLessThan %bool %245 %int_1 + OpBranchConditional %246 %247 %242 + %247 = OpLabel + OpStore %i_20 %int_0 + OpBranch %248 + %248 = OpLabel + OpLoopMerge %249 %250 None + OpBranch %251 + %251 = OpLabel + %252 = OpLoad %int %i_20 + %253 = OpSLessThan %bool %252 %int_1 + OpBranchConditional %253 %254 %249 + %254 = OpLabel + OpStore %i_21 %int_0 + OpBranch %255 + %255 = OpLabel + OpLoopMerge %256 %257 None + OpBranch %258 + %258 = OpLabel + %259 = OpLoad %int %i_21 + %260 = OpSLessThan %bool %259 %int_1 + OpBranchConditional %260 %261 %256 + %261 = OpLabel + OpStore %i_22 %int_0 + OpBranch %262 + %262 = OpLabel + OpLoopMerge %263 %264 None + OpBranch %265 + %265 = OpLabel + %266 = OpLoad %int %i_22 + %267 = OpSLessThan %bool %266 %int_1 + OpBranchConditional %267 %268 %263 + %268 = OpLabel + OpStore %i_23 %int_0 + OpBranch %269 + %269 = OpLabel + OpLoopMerge %270 %271 None + OpBranch %272 + %272 = OpLabel + %273 = OpLoad %int %i_23 + %274 = OpSLessThan %bool %273 %int_1 + OpBranchConditional %274 %275 %270 + %275 = OpLabel + OpStore %i_24 %int_0 + OpBranch %276 + %276 = OpLabel + OpLoopMerge %277 %278 None + OpBranch %279 + %279 = OpLabel + %280 = OpLoad %int %i_24 + %281 = OpSLessThan %bool %280 %int_1 + OpBranchConditional %281 %282 %277 + %282 = OpLabel + OpStore %i_25 %int_0 + OpBranch %283 + %283 = OpLabel + OpLoopMerge %284 %285 None + OpBranch %286 + %286 = OpLabel + %287 = OpLoad %int %i_25 + %288 = OpSLessThan %bool %287 %int_1 + OpBranchConditional %288 %289 %284 + %289 = OpLabel + OpStore %i_26 %int_0 + OpBranch %290 + %290 = OpLabel + OpLoopMerge %291 %292 None + OpBranch %293 + %293 = OpLabel + %294 = OpLoad %int %i_26 + %295 = OpSLessThan %bool %294 %int_1 + OpBranchConditional %295 %296 %291 + %296 = OpLabel + OpStore %i_27 %int_0 + OpBranch %297 + %297 = OpLabel + OpLoopMerge %298 %299 None + OpBranch %300 + %300 = OpLabel + %301 = OpLoad %int %i_27 + %302 = OpSLessThan %bool %301 %int_1 + OpBranchConditional %302 %303 %298 + %303 = OpLabel + OpStore %i_28 %int_0 + OpBranch %304 + %304 = OpLabel + OpLoopMerge %305 %306 None + OpBranch %307 + %307 = OpLabel + %308 = OpLoad %int %i_28 + %309 = OpSLessThan %bool %308 %int_1 + OpBranchConditional %309 %310 %305 + %310 = OpLabel + OpStore %i_29 %int_0 + OpBranch %311 + %311 = OpLabel + OpLoopMerge %312 %313 None + OpBranch %314 + %314 = OpLabel + %315 = OpLoad %int %i_29 + %316 = OpSLessThan %bool %315 %int_1 + OpBranchConditional %316 %317 %312 + %317 = OpLabel + OpStore %i_30 %int_0 + OpBranch %318 + %318 = OpLabel + OpLoopMerge %319 %320 None + OpBranch %321 + %321 = OpLabel + %322 = OpLoad %int %i_30 + %323 = OpSLessThan %bool %322 %int_1 + OpBranchConditional %323 %324 %319 + %324 = OpLabel + OpStore %i_31 %int_0 + OpBranch %325 + %325 = OpLabel + OpLoopMerge %326 %327 None + OpBranch %328 + %328 = OpLabel + %329 = OpLoad %int %i_31 + %330 = OpSLessThan %bool %329 %int_1 + OpBranchConditional %330 %331 %326 + %331 = OpLabel + OpStore %i_32 %int_0 + OpBranch %332 + %332 = OpLabel + OpLoopMerge %333 %334 None + OpBranch %335 + %335 = OpLabel + %336 = OpLoad %int %i_32 + %337 = OpSLessThan %bool %336 %int_1 + OpBranchConditional %337 %338 %333 + %338 = OpLabel + OpStore %i_33 %int_0 + OpBranch %339 + %339 = OpLabel + OpLoopMerge %340 %341 None + OpBranch %342 + %342 = OpLabel + %343 = OpLoad %int %i_33 + %344 = OpSLessThan %bool %343 %int_1 + OpBranchConditional %344 %345 %340 + %345 = OpLabel + OpStore %i_34 %int_0 + OpBranch %346 + %346 = OpLabel + OpLoopMerge %347 %348 None + OpBranch %349 + %349 = OpLabel + %350 = OpLoad %int %i_34 + %351 = OpSLessThan %bool %350 %int_1 + OpBranchConditional %351 %352 %347 + %352 = OpLabel + OpStore %i_35 %int_0 + OpBranch %353 + %353 = OpLabel + OpLoopMerge %354 %355 None + OpBranch %356 + %356 = OpLabel + %357 = OpLoad %int %i_35 + %358 = OpSLessThan %bool %357 %int_1 + OpBranchConditional %358 %359 %354 + %359 = OpLabel + OpStore %i_36 %int_0 + OpBranch %360 + %360 = OpLabel + OpLoopMerge %361 %362 None + OpBranch %363 + %363 = OpLabel + %364 = OpLoad %int %i_36 + %365 = OpSLessThan %bool %364 %int_1 + OpBranchConditional %365 %366 %361 + %366 = OpLabel + OpBranch %367 + %367 = OpLabel + OpLoopMerge %368 %369 None + OpBranch %370 + %370 = OpLabel + %371 = OpLoad %int %_GLF_global_loop_count + %372 = OpIAdd %int %371 %int_1 + OpStore %_GLF_global_loop_count %372 + OpBranch %369 + %369 = OpLabel + %373 = OpLoad %int %_GLF_global_loop_count + %374 = OpSLessThan %bool %373 %int_98 + OpBranchConditional %374 %367 %368 + %368 = OpLabel + %375 = OpLoad %int %i_36 + %376 = OpLoad %int %i_36 + %377 = OpAccessChain %_ptr_Function_float %m23 %375 %376 + OpStore %377 %float_1 + %378 = OpLoad %int %i_36 + %379 = OpLoad %int %i_36 + %380 = OpAccessChain %_ptr_Function_float %m24 %378 %379 + OpStore %380 %float_1 + %381 = OpLoad %int %i_36 + %382 = OpLoad %int %i_36 + %383 = OpAccessChain %_ptr_Function_float %m32 %381 %382 + OpStore %383 %float_1 + %384 = OpLoad %int %i_36 + %385 = OpLoad %int %i_36 + %386 = OpAccessChain %_ptr_Function_float %m33 %384 %385 + OpStore %386 %float_1 + %387 = OpLoad %int %i_36 + %388 = OpLoad %int %i_36 + %389 = OpAccessChain %_ptr_Function_float %m34 %387 %388 + OpStore %389 %float_1 + %390 = OpLoad %int %i_36 + %391 = OpLoad %int %i_36 + %392 = OpAccessChain %_ptr_Function_float %m42 %390 %391 + OpStore %392 %float_1 + %393 = OpLoad %int %i_36 + %394 = OpLoad %int %i_36 + %395 = OpAccessChain %_ptr_Function_float %m43 %393 %394 + OpStore %395 %float_1 + %396 = OpLoad %int %i_36 + %397 = OpLoad %int %i_36 + %398 = OpAccessChain %_ptr_Function_float %m44 %396 %397 + OpStore %398 %float_1 + OpBranch %362 + %362 = OpLabel + %399 = OpLoad %int %i_36 + %400 = OpIAdd %int %399 %int_1 + OpStore %i_36 %400 + OpBranch %360 + %361 = OpLabel + OpBranch %355 + %355 = OpLabel + %401 = OpLoad %int %i_35 + %402 = OpIAdd %int %401 %int_1 + OpStore %i_35 %402 + OpBranch %353 + %354 = OpLabel + OpBranch %348 + %348 = OpLabel + %403 = OpLoad %int %i_34 + %404 = OpIAdd %int %403 %int_1 + OpStore %i_34 %404 + OpBranch %346 + %347 = OpLabel + OpBranch %341 + %341 = OpLabel + %405 = OpLoad %int %i_33 + %406 = OpIAdd %int %405 %int_1 + OpStore %i_33 %406 + OpBranch %339 + %340 = OpLabel + OpBranch %334 + %334 = OpLabel + %407 = OpLoad %int %i_32 + %408 = OpIAdd %int %407 %int_1 + OpStore %i_32 %408 + OpBranch %332 + %333 = OpLabel + OpBranch %327 + %327 = OpLabel + %409 = OpLoad %int %i_31 + %410 = OpIAdd %int %409 %int_1 + OpStore %i_31 %410 + OpBranch %325 + %326 = OpLabel + OpBranch %320 + %320 = OpLabel + %411 = OpLoad %int %i_30 + %412 = OpIAdd %int %411 %int_1 + OpStore %i_30 %412 + OpBranch %318 + %319 = OpLabel + OpBranch %313 + %313 = OpLabel + %413 = OpLoad %int %i_29 + %414 = OpIAdd %int %413 %int_1 + OpStore %i_29 %414 + OpBranch %311 + %312 = OpLabel + OpBranch %306 + %306 = OpLabel + %415 = OpLoad %int %i_28 + %416 = OpIAdd %int %415 %int_1 + OpStore %i_28 %416 + OpBranch %304 + %305 = OpLabel + OpBranch %299 + %299 = OpLabel + %417 = OpLoad %int %i_27 + %418 = OpIAdd %int %417 %int_1 + OpStore %i_27 %418 + OpBranch %297 + %298 = OpLabel + OpBranch %292 + %292 = OpLabel + %419 = OpLoad %int %i_26 + %420 = OpIAdd %int %419 %int_1 + OpStore %i_26 %420 + OpBranch %290 + %291 = OpLabel + OpBranch %285 + %285 = OpLabel + %421 = OpLoad %int %i_25 + %422 = OpIAdd %int %421 %int_1 + OpStore %i_25 %422 + OpBranch %283 + %284 = OpLabel + OpBranch %278 + %278 = OpLabel + %423 = OpLoad %int %i_24 + %424 = OpIAdd %int %423 %int_1 + OpStore %i_24 %424 + OpBranch %276 + %277 = OpLabel + OpBranch %271 + %271 = OpLabel + %425 = OpLoad %int %i_23 + %426 = OpIAdd %int %425 %int_1 + OpStore %i_23 %426 + OpBranch %269 + %270 = OpLabel + OpBranch %264 + %264 = OpLabel + %427 = OpLoad %int %i_22 + %428 = OpIAdd %int %427 %int_1 + OpStore %i_22 %428 + OpBranch %262 + %263 = OpLabel + OpBranch %257 + %257 = OpLabel + %429 = OpLoad %int %i_21 + %430 = OpIAdd %int %429 %int_1 + OpStore %i_21 %430 + OpBranch %255 + %256 = OpLabel + OpBranch %250 + %250 = OpLabel + %431 = OpLoad %int %i_20 + %432 = OpIAdd %int %431 %int_1 + OpStore %i_20 %432 + OpBranch %248 + %249 = OpLabel + OpBranch %243 + %243 = OpLabel + %433 = OpLoad %int %i_19 + %434 = OpIAdd %int %433 %int_1 + OpStore %i_19 %434 + OpBranch %241 + %242 = OpLabel + OpBranch %236 + %236 = OpLabel + %435 = OpLoad %int %i_18 + %436 = OpIAdd %int %435 %int_1 + OpStore %i_18 %436 + OpBranch %234 + %235 = OpLabel + OpBranch %229 + %229 = OpLabel + %437 = OpLoad %int %i_17 + %438 = OpIAdd %int %437 %int_1 + OpStore %i_17 %438 + OpBranch %227 + %228 = OpLabel + OpBranch %222 + %222 = OpLabel + %439 = OpLoad %int %i_16 + %440 = OpIAdd %int %439 %int_1 + OpStore %i_16 %440 + OpBranch %220 + %221 = OpLabel + OpBranch %215 + %215 = OpLabel + %441 = OpLoad %int %i_15 + %442 = OpIAdd %int %441 %int_1 + OpStore %i_15 %442 + OpBranch %213 + %214 = OpLabel + OpBranch %208 + %208 = OpLabel + %443 = OpLoad %int %i_14 + %444 = OpIAdd %int %443 %int_1 + OpStore %i_14 %444 + OpBranch %206 + %207 = OpLabel + OpBranch %201 + %201 = OpLabel + %445 = OpLoad %int %i_13 + %446 = OpIAdd %int %445 %int_1 + OpStore %i_13 %446 + OpBranch %199 + %200 = OpLabel + OpBranch %194 + %194 = OpLabel + %447 = OpLoad %int %i_12 + %448 = OpIAdd %int %447 %int_1 + OpStore %i_12 %448 + OpBranch %192 + %193 = OpLabel + OpBranch %187 + %187 = OpLabel + %449 = OpLoad %int %i_11 + %450 = OpIAdd %int %449 %int_1 + OpStore %i_11 %450 + OpBranch %185 + %186 = OpLabel + OpBranch %180 + %180 = OpLabel + %451 = OpLoad %int %i_10 + %452 = OpIAdd %int %451 %int_1 + OpStore %i_10 %452 + OpBranch %178 + %179 = OpLabel + OpBranch %173 + %173 = OpLabel + %453 = OpLoad %int %i_9 + %454 = OpIAdd %int %453 %int_1 + OpStore %i_9 %454 + OpBranch %171 + %172 = OpLabel + OpBranch %166 + %166 = OpLabel + %455 = OpLoad %int %i_8 + %456 = OpIAdd %int %455 %int_1 + OpStore %i_8 %456 + OpBranch %164 + %165 = OpLabel + OpBranch %159 + %159 = OpLabel + %457 = OpLoad %int %i_7 + %458 = OpIAdd %int %457 %int_1 + OpStore %i_7 %458 + OpBranch %157 + %158 = OpLabel + OpBranch %152 + %152 = OpLabel + %459 = OpLoad %int %i_6 + %460 = OpIAdd %int %459 %int_1 + OpStore %i_6 %460 + OpBranch %150 + %151 = OpLabel + OpBranch %145 + %145 = OpLabel + %461 = OpLoad %int %i_5 + %462 = OpIAdd %int %461 %int_1 + OpStore %i_5 %462 + OpBranch %143 + %144 = OpLabel + OpBranch %138 + %138 = OpLabel + %463 = OpLoad %int %i_4 + %464 = OpIAdd %int %463 %int_1 + OpStore %i_4 %464 + OpBranch %136 + %137 = OpLabel + OpBranch %131 + %131 = OpLabel + %465 = OpLoad %int %i_3 + %466 = OpIAdd %int %465 %int_1 + OpStore %i_3 %466 + OpBranch %129 + %130 = OpLabel + OpBranch %124 + %124 = OpLabel + %467 = OpLoad %int %i_2 + %468 = OpIAdd %int %467 %int_1 + OpStore %i_2 %468 + OpBranch %122 + %123 = OpLabel + OpBranch %117 + %117 = OpLabel + %469 = OpLoad %int %i_1 + %470 = OpIAdd %int %469 %int_1 + OpStore %i_1 %470 + OpBranch %115 + %116 = OpLabel + OpBranch %110 + %110 = OpLabel + %471 = OpLoad %int %i_0 + %472 = OpIAdd %int %471 %int_1 + OpStore %i_0 %472 + OpBranch %108 + %109 = OpLabel + OpBranch %103 + %103 = OpLabel + %473 = OpLoad %int %i + %474 = OpIAdd %int %473 %int_1 + OpStore %i %474 + OpBranch %101 + %102 = OpLabel + OpStore %sum %float_0 + OpStore %r %int_0 + OpBranch %475 + %475 = OpLabel + OpLoopMerge %476 %477 None + OpBranch %478 + %478 = OpLabel + %479 = OpLoad %int %_GLF_global_loop_count + %480 = OpSLessThan %bool %479 %int_100 + OpBranchConditional %480 %481 %476 + %481 = OpLabel + %482 = OpLoad %int %_GLF_global_loop_count + %483 = OpIAdd %int %482 %int_1 + OpStore %_GLF_global_loop_count %483 + %484 = OpLoad %int %r + %485 = OpAccessChain %_ptr_Function_float %m23 %int_0 %484 + %486 = OpLoad %float %485 + %487 = OpLoad %float %sum + %488 = OpFAdd %float %487 %486 + OpStore %sum %488 + %489 = OpLoad %int %r + %490 = OpAccessChain %_ptr_Function_float %m24 %int_0 %489 + %491 = OpLoad %float %490 + %492 = OpLoad %float %sum + %493 = OpFAdd %float %492 %491 + OpStore %sum %493 + %494 = OpLoad %int %r + %495 = OpAccessChain %_ptr_Function_float %m32 %int_0 %494 + %496 = OpLoad %float %495 + %497 = OpLoad %float %sum + %498 = OpFAdd %float %497 %496 + OpStore %sum %498 + %499 = OpLoad %int %r + %500 = OpAccessChain %_ptr_Function_float %m33 %int_0 %499 + %501 = OpLoad %float %500 + %502 = OpLoad %float %sum + %503 = OpFAdd %float %502 %501 + OpStore %sum %503 + %504 = OpLoad %int %r + %505 = OpAccessChain %_ptr_Function_float %m34 %int_0 %504 + %506 = OpLoad %float %505 + %507 = OpLoad %float %sum + %508 = OpFAdd %float %507 %506 + OpStore %sum %508 + %509 = OpLoad %int %r + %510 = OpAccessChain %_ptr_Function_float %m42 %int_0 %509 + %511 = OpLoad %float %510 + %512 = OpLoad %float %sum + %513 = OpFAdd %float %512 %511 + OpStore %sum %513 + %514 = OpLoad %int %r + %515 = OpAccessChain %_ptr_Function_float %m43 %int_0 %514 + %516 = OpLoad %float %515 + %517 = OpLoad %float %sum + %518 = OpFAdd %float %517 %516 + OpStore %sum %518 + %519 = OpLoad %int %r + %520 = OpAccessChain %_ptr_Function_float %m44 %int_0 %519 + %521 = OpLoad %float %520 + %522 = OpLoad %float %sum + %523 = OpFAdd %float %522 %521 + OpStore %sum %523 + OpBranch %477 + %477 = OpLabel + %524 = OpLoad %int %r + %525 = OpIAdd %int %524 %int_1 + OpStore %r %525 + OpBranch %475 + %476 = OpLabel + %526 = OpLoad %float %sum + %527 = OpFOrdEqual %bool %526 %float_8 + OpSelectionMerge %528 None + OpBranchConditional %527 %529 %530 + %529 = OpLabel + OpStore %_GLF_color %99 + OpBranch %528 + %530 = OpLabel + OpStore %_GLF_color %68 + OpBranch %528 + %528 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..362d95239e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.hlsl @@ -0,0 +1,324 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +static int x_GLF_global_loop_count = 0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x3 m23 = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float2x4 m24 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x2 m32 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x3 m33 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x4 m34 = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x2 m42 = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x4 m44 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + int i_11 = 0; + int i_12 = 0; + int i_13 = 0; + int i_14 = 0; + int i_15 = 0; + int i_16 = 0; + int i_17 = 0; + int i_18 = 0; + int i_19 = 0; + int i_20 = 0; + int i_21 = 0; + int i_22 = 0; + int i_23 = 0; + int i_24 = 0; + int i_25 = 0; + int i_26 = 0; + int i_27 = 0; + int i_28 = 0; + int i_29 = 0; + int i_30 = 0; + int i_31 = 0; + int i_32 = 0; + int i_33 = 0; + int i_34 = 0; + int i_35 = 0; + int i_36 = 0; + int i_37 = 0; + float sum = 0.0f; + int r = 0; + x_GLF_global_loop_count = 0; + m23 = float2x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); + m24 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + m32 = float3x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + m33 = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); + m34 = float3x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + m42 = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + m43 = float4x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); + m44 = float4x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + i = 0; + { + for(; (i < 1); i = (i + 1)) { + i_1 = 0; + { + for(; (i_1 < 1); i_1 = (i_1 + 1)) { + i_2 = 0; + { + for(; (i_2 < 1); i_2 = (i_2 + 1)) { + i_3 = 0; + { + for(; (i_3 < 1); i_3 = (i_3 + 1)) { + i_4 = 0; + { + for(; (i_4 < 1); i_4 = (i_4 + 1)) { + i_5 = 0; + { + for(; (i_5 < 1); i_5 = (i_5 + 1)) { + i_6 = 0; + { + for(; (i_6 < 1); i_6 = (i_6 + 1)) { + i_7 = 0; + { + for(; (i_7 < 1); i_7 = (i_7 + 1)) { + i_8 = 0; + { + for(; (i_8 < 1); i_8 = (i_8 + 1)) { + i_9 = 0; + { + for(; (i_9 < 1); i_9 = (i_9 + 1)) { + i_10 = 0; + { + for(; (i_10 < 1); i_10 = (i_10 + 1)) { + i_11 = 0; + { + for(; (i_11 < 1); i_11 = (i_11 + 1)) { + i_12 = 0; + { + for(; (i_12 < 1); i_12 = (i_12 + 1)) { + i_13 = 0; + { + for(; (i_13 < 1); i_13 = (i_13 + 1)) { + i_14 = 0; + { + for(; (i_14 < 1); i_14 = (i_14 + 1)) { + i_15 = 0; + { + for(; (i_15 < 1); i_15 = (i_15 + 1)) { + i_16 = 0; + { + for(; (i_16 < 1); i_16 = (i_16 + 1)) { + i_17 = 0; + { + for(; (i_17 < 1); i_17 = (i_17 + 1)) { + i_18 = 0; + { + for(; (i_18 < 1); i_18 = (i_18 + 1)) { + i_19 = 0; + { + for(; (i_19 < 1); i_19 = (i_19 + 1)) { + i_20 = 0; + { + for(; (i_20 < 1); i_20 = (i_20 + 1)) { + i_21 = 0; + { + for(; (i_21 < 1); i_21 = (i_21 + 1)) { + i_22 = 0; + { + for(; (i_22 < 1); i_22 = (i_22 + 1)) { + i_23 = 0; + { + for(; (i_23 < 1); i_23 = (i_23 + 1)) { + i_24 = 0; + { + for(; (i_24 < 1); i_24 = (i_24 + 1)) { + i_25 = 0; + { + for(; (i_25 < 1); i_25 = (i_25 + 1)) { + i_26 = 0; + { + for(; (i_26 < 1); i_26 = (i_26 + 1)) { + i_27 = 0; + { + for(; (i_27 < 1); i_27 = (i_27 + 1)) { + i_28 = 0; + { + for(; (i_28 < 1); i_28 = (i_28 + 1)) { + i_29 = 0; + { + for(; (i_29 < 1); i_29 = (i_29 + 1)) { + i_30 = 0; + { + for(; (i_30 < 1); i_30 = (i_30 + 1)) { + i_31 = 0; + { + for(; (i_31 < 1); i_31 = (i_31 + 1)) { + i_32 = 0; + { + for(; (i_32 < 1); i_32 = (i_32 + 1)) { + i_33 = 0; + { + for(; (i_33 < 1); i_33 = (i_33 + 1)) { + i_34 = 0; + { + for(; (i_34 < 1); i_34 = (i_34 + 1)) { + i_35 = 0; + { + for(; (i_35 < 1); i_35 = (i_35 + 1)) { + i_36 = 0; + { + for(; (i_36 < 1); i_36 = (i_36 + 1)) { + i_37 = 0; + { + for(; (i_37 < 1); i_37 = (i_37 + 1)) { + while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + { + if ((x_GLF_global_loop_count < 98)) { + } else { + break; + } + } + } + set_float3(m23[i_37], i_37, 1.0f); + set_float4(m24[i_37], i_37, 1.0f); + set_float2(m32[i_37], i_37, 1.0f); + set_float3(m33[i_37], i_37, 1.0f); + set_float4(m34[i_37], i_37, 1.0f); + set_float2(m42[i_37], i_37, 1.0f); + set_float3(m43[i_37], i_37, 1.0f); + set_float4(m44[i_37], i_37, 1.0f); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + sum = 0.0f; + r = 0; + { + for(; (x_GLF_global_loop_count < 100); r = (r + 1)) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const float x_486 = m23[0][r]; + sum = (sum + x_486); + const float x_491 = m24[0][r]; + sum = (sum + x_491); + const float x_496 = m32[0][r]; + sum = (sum + x_496); + const float x_501 = m33[0][r]; + sum = (sum + x_501); + const float x_506 = m34[0][r]; + sum = (sum + x_506); + const float x_511 = m42[0][r]; + sum = (sum + x_511); + const float x_516 = m43[0][r]; + sum = (sum + x_516); + const float x_521 = m44[0][r]; + sum = (sum + x_521); + } + } + if ((sum == 8.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..0ab9beb3aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.msl @@ -0,0 +1,624 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + float2x3 m23 = float2x3(0.0f); + float2x4 m24 = float2x4(0.0f); + float3x2 m32 = float3x2(0.0f); + float3x3 m33 = float3x3(0.0f); + float3x4 m34 = float3x4(0.0f); + float4x2 m42 = float4x2(0.0f); + float4x3 m43 = float4x3(0.0f); + float4x4 m44 = float4x4(0.0f); + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + int i_11 = 0; + int i_12 = 0; + int i_13 = 0; + int i_14 = 0; + int i_15 = 0; + int i_16 = 0; + int i_17 = 0; + int i_18 = 0; + int i_19 = 0; + int i_20 = 0; + int i_21 = 0; + int i_22 = 0; + int i_23 = 0; + int i_24 = 0; + int i_25 = 0; + int i_26 = 0; + int i_27 = 0; + int i_28 = 0; + int i_29 = 0; + int i_30 = 0; + int i_31 = 0; + int i_32 = 0; + int i_33 = 0; + int i_34 = 0; + int i_35 = 0; + int i_36 = 0; + int i_37 = 0; + float sum = 0.0f; + int r = 0; + *(tint_symbol_4) = 0; + m23 = float2x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); + m24 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + m32 = float3x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + m33 = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); + m34 = float3x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + m42 = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + m43 = float4x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); + m44 = float4x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + i = 0; + while (true) { + int const x_105 = i; + if ((x_105 < 1)) { + } else { + break; + } + i_1 = 0; + while (true) { + int const x_112 = i_1; + if ((x_112 < 1)) { + } else { + break; + } + i_2 = 0; + while (true) { + int const x_119 = i_2; + if ((x_119 < 1)) { + } else { + break; + } + i_3 = 0; + while (true) { + int const x_126 = i_3; + if ((x_126 < 1)) { + } else { + break; + } + i_4 = 0; + while (true) { + int const x_133 = i_4; + if ((x_133 < 1)) { + } else { + break; + } + i_5 = 0; + while (true) { + int const x_140 = i_5; + if ((x_140 < 1)) { + } else { + break; + } + i_6 = 0; + while (true) { + int const x_147 = i_6; + if ((x_147 < 1)) { + } else { + break; + } + i_7 = 0; + while (true) { + int const x_154 = i_7; + if ((x_154 < 1)) { + } else { + break; + } + i_8 = 0; + while (true) { + int const x_161 = i_8; + if ((x_161 < 1)) { + } else { + break; + } + i_9 = 0; + while (true) { + int const x_168 = i_9; + if ((x_168 < 1)) { + } else { + break; + } + i_10 = 0; + while (true) { + int const x_175 = i_10; + if ((x_175 < 1)) { + } else { + break; + } + i_11 = 0; + while (true) { + int const x_182 = i_11; + if ((x_182 < 1)) { + } else { + break; + } + i_12 = 0; + while (true) { + int const x_189 = i_12; + if ((x_189 < 1)) { + } else { + break; + } + i_13 = 0; + while (true) { + int const x_196 = i_13; + if ((x_196 < 1)) { + } else { + break; + } + i_14 = 0; + while (true) { + int const x_203 = i_14; + if ((x_203 < 1)) { + } else { + break; + } + i_15 = 0; + while (true) { + int const x_210 = i_15; + if ((x_210 < 1)) { + } else { + break; + } + i_16 = 0; + while (true) { + int const x_217 = i_16; + if ((x_217 < 1)) { + } else { + break; + } + i_17 = 0; + while (true) { + int const x_224 = i_17; + if ((x_224 < 1)) { + } else { + break; + } + i_18 = 0; + while (true) { + int const x_231 = i_18; + if ((x_231 < 1)) { + } else { + break; + } + i_19 = 0; + while (true) { + int const x_238 = i_19; + if ((x_238 < 1)) { + } else { + break; + } + i_20 = 0; + while (true) { + int const x_245 = i_20; + if ((x_245 < 1)) { + } else { + break; + } + i_21 = 0; + while (true) { + int const x_252 = i_21; + if ((x_252 < 1)) { + } else { + break; + } + i_22 = 0; + while (true) { + int const x_259 = i_22; + if ((x_259 < 1)) { + } else { + break; + } + i_23 = 0; + while (true) { + int const x_266 = i_23; + if ((x_266 < 1)) { + } else { + break; + } + i_24 = 0; + while (true) { + int const x_273 = i_24; + if ((x_273 < 1)) { + } else { + break; + } + i_25 = 0; + while (true) { + int const x_280 = i_25; + if ((x_280 < 1)) { + } else { + break; + } + i_26 = 0; + while (true) { + int const x_287 = i_26; + if ((x_287 < 1)) { + } else { + break; + } + i_27 = 0; + while (true) { + int const x_294 = i_27; + if ((x_294 < 1)) { + } else { + break; + } + i_28 = 0; + while (true) { + int const x_301 = i_28; + if ((x_301 < 1)) { + } else { + break; + } + i_29 = 0; + while (true) { + int const x_308 = i_29; + if ((x_308 < 1)) { + } else { + break; + } + i_30 = 0; + while (true) { + int const x_315 = i_30; + if ((x_315 < 1)) { + } else { + break; + } + i_31 = 0; + while (true) { + int const x_322 = i_31; + if ((x_322 < 1)) { + } else { + break; + } + i_32 = 0; + while (true) { + int const x_329 = i_32; + if ((x_329 < 1)) { + } else { + break; + } + i_33 = 0; + while (true) { + int const x_336 = i_33; + if ((x_336 < 1)) { + } else { + break; + } + i_34 = 0; + while (true) { + int const x_343 = i_34; + if ((x_343 < 1)) { + } else { + break; + } + i_35 = 0; + while (true) { + int const x_350 = i_35; + if ((x_350 < 1)) { + } else { + break; + } + i_36 = 0; + while (true) { + int const x_357 = i_36; + if ((x_357 < 1)) { + } else { + break; + } + i_37 = 0; + while (true) { + int const x_364 = i_37; + if ((x_364 < 1)) { + } else { + break; + } + while (true) { + int const x_371 = *(tint_symbol_4); + *(tint_symbol_4) = (x_371 + 1); + { + int const x_373 = *(tint_symbol_4); + if ((x_373 < 98)) { + } else { + break; + } + } + } + int const x_375 = i_37; + int const x_376 = i_37; + m23[x_375][x_376] = 1.0f; + int const x_378 = i_37; + int const x_379 = i_37; + m24[x_378][x_379] = 1.0f; + int const x_381 = i_37; + int const x_382 = i_37; + m32[x_381][x_382] = 1.0f; + int const x_384 = i_37; + int const x_385 = i_37; + m33[x_384][x_385] = 1.0f; + int const x_387 = i_37; + int const x_388 = i_37; + m34[x_387][x_388] = 1.0f; + int const x_390 = i_37; + int const x_391 = i_37; + m42[x_390][x_391] = 1.0f; + int const x_393 = i_37; + int const x_394 = i_37; + m43[x_393][x_394] = 1.0f; + int const x_396 = i_37; + int const x_397 = i_37; + m44[x_396][x_397] = 1.0f; + { + int const x_399 = i_37; + i_37 = (x_399 + 1); + } + } + { + int const x_401 = i_36; + i_36 = (x_401 + 1); + } + } + { + int const x_403 = i_35; + i_35 = (x_403 + 1); + } + } + { + int const x_405 = i_34; + i_34 = (x_405 + 1); + } + } + { + int const x_407 = i_33; + i_33 = (x_407 + 1); + } + } + { + int const x_409 = i_32; + i_32 = (x_409 + 1); + } + } + { + int const x_411 = i_31; + i_31 = (x_411 + 1); + } + } + { + int const x_413 = i_30; + i_30 = (x_413 + 1); + } + } + { + int const x_415 = i_29; + i_29 = (x_415 + 1); + } + } + { + int const x_417 = i_28; + i_28 = (x_417 + 1); + } + } + { + int const x_419 = i_27; + i_27 = (x_419 + 1); + } + } + { + int const x_421 = i_26; + i_26 = (x_421 + 1); + } + } + { + int const x_423 = i_25; + i_25 = (x_423 + 1); + } + } + { + int const x_425 = i_24; + i_24 = (x_425 + 1); + } + } + { + int const x_427 = i_23; + i_23 = (x_427 + 1); + } + } + { + int const x_429 = i_22; + i_22 = (x_429 + 1); + } + } + { + int const x_431 = i_21; + i_21 = (x_431 + 1); + } + } + { + int const x_433 = i_20; + i_20 = (x_433 + 1); + } + } + { + int const x_435 = i_19; + i_19 = (x_435 + 1); + } + } + { + int const x_437 = i_18; + i_18 = (x_437 + 1); + } + } + { + int const x_439 = i_17; + i_17 = (x_439 + 1); + } + } + { + int const x_441 = i_16; + i_16 = (x_441 + 1); + } + } + { + int const x_443 = i_15; + i_15 = (x_443 + 1); + } + } + { + int const x_445 = i_14; + i_14 = (x_445 + 1); + } + } + { + int const x_447 = i_13; + i_13 = (x_447 + 1); + } + } + { + int const x_449 = i_12; + i_12 = (x_449 + 1); + } + } + { + int const x_451 = i_11; + i_11 = (x_451 + 1); + } + } + { + int const x_453 = i_10; + i_10 = (x_453 + 1); + } + } + { + int const x_455 = i_9; + i_9 = (x_455 + 1); + } + } + { + int const x_457 = i_8; + i_8 = (x_457 + 1); + } + } + { + int const x_459 = i_7; + i_7 = (x_459 + 1); + } + } + { + int const x_461 = i_6; + i_6 = (x_461 + 1); + } + } + { + int const x_463 = i_5; + i_5 = (x_463 + 1); + } + } + { + int const x_465 = i_4; + i_4 = (x_465 + 1); + } + } + { + int const x_467 = i_3; + i_3 = (x_467 + 1); + } + } + { + int const x_469 = i_2; + i_2 = (x_469 + 1); + } + } + { + int const x_471 = i_1; + i_1 = (x_471 + 1); + } + } + { + int const x_473 = i; + i = (x_473 + 1); + } + } + sum = 0.0f; + r = 0; + while (true) { + int const x_479 = *(tint_symbol_4); + if ((x_479 < 100)) { + } else { + break; + } + int const x_482 = *(tint_symbol_4); + *(tint_symbol_4) = (x_482 + 1); + int const x_484 = r; + float const x_486 = m23[0][x_484]; + float const x_487 = sum; + sum = (x_487 + x_486); + int const x_489 = r; + float const x_491 = m24[0][x_489]; + float const x_492 = sum; + sum = (x_492 + x_491); + int const x_494 = r; + float const x_496 = m32[0][x_494]; + float const x_497 = sum; + sum = (x_497 + x_496); + int const x_499 = r; + float const x_501 = m33[0][x_499]; + float const x_502 = sum; + sum = (x_502 + x_501); + int const x_504 = r; + float const x_506 = m34[0][x_504]; + float const x_507 = sum; + sum = (x_507 + x_506); + int const x_509 = r; + float const x_511 = m42[0][x_509]; + float const x_512 = sum; + sum = (x_512 + x_511); + int const x_514 = r; + float const x_516 = m43[0][x_514]; + float const x_517 = sum; + sum = (x_517 + x_516); + int const x_519 = r; + float const x_521 = m44[0][x_519]; + float const x_522 = sum; + sum = (x_522 + x_521); + { + int const x_524 = r; + r = (x_524 + 1); + } + } + float const x_526 = sum; + if ((x_526 == 8.0f)) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..eb0445442e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.spvasm @@ -0,0 +1,1187 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 636 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m23 "m23" + OpName %m24 "m24" + OpName %m32 "m32" + OpName %m33 "m33" + OpName %m34 "m34" + OpName %m42 "m42" + OpName %m43 "m43" + OpName %m44 "m44" + OpName %i "i" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %i_3 "i_3" + OpName %i_4 "i_4" + OpName %i_5 "i_5" + OpName %i_6 "i_6" + OpName %i_7 "i_7" + OpName %i_8 "i_8" + OpName %i_9 "i_9" + OpName %i_10 "i_10" + OpName %i_11 "i_11" + OpName %i_12 "i_12" + OpName %i_13 "i_13" + OpName %i_14 "i_14" + OpName %i_15 "i_15" + OpName %i_16 "i_16" + OpName %i_17 "i_17" + OpName %i_18 "i_18" + OpName %i_19 "i_19" + OpName %i_20 "i_20" + OpName %i_21 "i_21" + OpName %i_22 "i_22" + OpName %i_23 "i_23" + OpName %i_24 "i_24" + OpName %i_25 "i_25" + OpName %i_26 "i_26" + OpName %i_27 "i_27" + OpName %i_28 "i_28" + OpName %i_29 "i_29" + OpName %i_30 "i_30" + OpName %i_31 "i_31" + OpName %i_32 "i_32" + OpName %i_33 "i_33" + OpName %i_34 "i_34" + OpName %i_35 "i_35" + OpName %i_36 "i_36" + OpName %i_37 "i_37" + OpName %sum "sum" + OpName %r "r" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %20 = OpConstantNull %mat2v3float +%mat2v4float = OpTypeMatrix %v4float 2 +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float + %24 = OpConstantNull %mat2v4float + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float + %29 = OpConstantNull %mat3v2float +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %33 = OpConstantNull %mat3v3float +%mat3v4float = OpTypeMatrix %v4float 3 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %37 = OpConstantNull %mat3v4float +%mat4v2float = OpTypeMatrix %v2float 4 +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float + %41 = OpConstantNull %mat4v2float +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %45 = OpConstantNull %mat4v3float +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %49 = OpConstantNull %mat4v4float +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_float = OpTypePointer Function %float + %91 = OpConstantNull %float + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %95 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %96 = OpConstantComposite %mat2v3float %95 %95 + %97 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %98 = OpConstantComposite %mat2v4float %97 %97 + %99 = OpConstantComposite %v2float %float_0 %float_0 + %100 = OpConstantComposite %mat3v2float %99 %99 %99 + %101 = OpConstantComposite %mat3v3float %95 %95 %95 + %102 = OpConstantComposite %mat3v4float %97 %97 %97 + %103 = OpConstantComposite %mat4v2float %99 %99 %99 %99 + %104 = OpConstantComposite %mat4v3float %95 %95 %95 %95 + %105 = OpConstantComposite %mat4v4float %97 %97 %97 %97 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_98 = OpConstant %int 98 + %float_1 = OpConstant %float 1 + %int_100 = OpConstant %int 100 + %float_8 = OpConstant %float 8 + %623 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %624 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %m23 = OpVariable %_ptr_Function_mat2v3float Function %20 + %m24 = OpVariable %_ptr_Function_mat2v4float Function %24 + %m32 = OpVariable %_ptr_Function_mat3v2float Function %29 + %m33 = OpVariable %_ptr_Function_mat3v3float Function %33 + %m34 = OpVariable %_ptr_Function_mat3v4float Function %37 + %m42 = OpVariable %_ptr_Function_mat4v2float Function %41 + %m43 = OpVariable %_ptr_Function_mat4v3float Function %45 + %m44 = OpVariable %_ptr_Function_mat4v4float Function %49 + %i = OpVariable %_ptr_Function_int Function %4 + %i_1 = OpVariable %_ptr_Function_int Function %4 + %i_2 = OpVariable %_ptr_Function_int Function %4 + %i_3 = OpVariable %_ptr_Function_int Function %4 + %i_4 = OpVariable %_ptr_Function_int Function %4 + %i_5 = OpVariable %_ptr_Function_int Function %4 + %i_6 = OpVariable %_ptr_Function_int Function %4 + %i_7 = OpVariable %_ptr_Function_int Function %4 + %i_8 = OpVariable %_ptr_Function_int Function %4 + %i_9 = OpVariable %_ptr_Function_int Function %4 + %i_10 = OpVariable %_ptr_Function_int Function %4 + %i_11 = OpVariable %_ptr_Function_int Function %4 + %i_12 = OpVariable %_ptr_Function_int Function %4 + %i_13 = OpVariable %_ptr_Function_int Function %4 + %i_14 = OpVariable %_ptr_Function_int Function %4 + %i_15 = OpVariable %_ptr_Function_int Function %4 + %i_16 = OpVariable %_ptr_Function_int Function %4 + %i_17 = OpVariable %_ptr_Function_int Function %4 + %i_18 = OpVariable %_ptr_Function_int Function %4 + %i_19 = OpVariable %_ptr_Function_int Function %4 + %i_20 = OpVariable %_ptr_Function_int Function %4 + %i_21 = OpVariable %_ptr_Function_int Function %4 + %i_22 = OpVariable %_ptr_Function_int Function %4 + %i_23 = OpVariable %_ptr_Function_int Function %4 + %i_24 = OpVariable %_ptr_Function_int Function %4 + %i_25 = OpVariable %_ptr_Function_int Function %4 + %i_26 = OpVariable %_ptr_Function_int Function %4 + %i_27 = OpVariable %_ptr_Function_int Function %4 + %i_28 = OpVariable %_ptr_Function_int Function %4 + %i_29 = OpVariable %_ptr_Function_int Function %4 + %i_30 = OpVariable %_ptr_Function_int Function %4 + %i_31 = OpVariable %_ptr_Function_int Function %4 + %i_32 = OpVariable %_ptr_Function_int Function %4 + %i_33 = OpVariable %_ptr_Function_int Function %4 + %i_34 = OpVariable %_ptr_Function_int Function %4 + %i_35 = OpVariable %_ptr_Function_int Function %4 + %i_36 = OpVariable %_ptr_Function_int Function %4 + %i_37 = OpVariable %_ptr_Function_int Function %4 + %sum = OpVariable %_ptr_Function_float Function %91 + %r = OpVariable %_ptr_Function_int Function %4 + OpStore %x_GLF_global_loop_count %int_0 + OpStore %m23 %96 + OpStore %m24 %98 + OpStore %m32 %100 + OpStore %m33 %101 + OpStore %m34 %102 + OpStore %m42 %103 + OpStore %m43 %104 + OpStore %m44 %105 + OpStore %i %int_0 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %110 = OpLoad %int %i + %112 = OpSLessThan %bool %110 %int_1 + OpSelectionMerge %114 None + OpBranchConditional %112 %115 %116 + %115 = OpLabel + OpBranch %114 + %116 = OpLabel + OpBranch %107 + %114 = OpLabel + OpStore %i_1 %int_0 + OpBranch %117 + %117 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %121 = OpLoad %int %i_1 + %122 = OpSLessThan %bool %121 %int_1 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %125 + %124 = OpLabel + OpBranch %123 + %125 = OpLabel + OpBranch %118 + %123 = OpLabel + OpStore %i_2 %int_0 + OpBranch %126 + %126 = OpLabel + OpLoopMerge %127 %128 None + OpBranch %129 + %129 = OpLabel + %130 = OpLoad %int %i_2 + %131 = OpSLessThan %bool %130 %int_1 + OpSelectionMerge %132 None + OpBranchConditional %131 %133 %134 + %133 = OpLabel + OpBranch %132 + %134 = OpLabel + OpBranch %127 + %132 = OpLabel + OpStore %i_3 %int_0 + OpBranch %135 + %135 = OpLabel + OpLoopMerge %136 %137 None + OpBranch %138 + %138 = OpLabel + %139 = OpLoad %int %i_3 + %140 = OpSLessThan %bool %139 %int_1 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %143 + %142 = OpLabel + OpBranch %141 + %143 = OpLabel + OpBranch %136 + %141 = OpLabel + OpStore %i_4 %int_0 + OpBranch %144 + %144 = OpLabel + OpLoopMerge %145 %146 None + OpBranch %147 + %147 = OpLabel + %148 = OpLoad %int %i_4 + %149 = OpSLessThan %bool %148 %int_1 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %152 + %151 = OpLabel + OpBranch %150 + %152 = OpLabel + OpBranch %145 + %150 = OpLabel + OpStore %i_5 %int_0 + OpBranch %153 + %153 = OpLabel + OpLoopMerge %154 %155 None + OpBranch %156 + %156 = OpLabel + %157 = OpLoad %int %i_5 + %158 = OpSLessThan %bool %157 %int_1 + OpSelectionMerge %159 None + OpBranchConditional %158 %160 %161 + %160 = OpLabel + OpBranch %159 + %161 = OpLabel + OpBranch %154 + %159 = OpLabel + OpStore %i_6 %int_0 + OpBranch %162 + %162 = OpLabel + OpLoopMerge %163 %164 None + OpBranch %165 + %165 = OpLabel + %166 = OpLoad %int %i_6 + %167 = OpSLessThan %bool %166 %int_1 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %163 + %168 = OpLabel + OpStore %i_7 %int_0 + OpBranch %171 + %171 = OpLabel + OpLoopMerge %172 %173 None + OpBranch %174 + %174 = OpLabel + %175 = OpLoad %int %i_7 + %176 = OpSLessThan %bool %175 %int_1 + OpSelectionMerge %177 None + OpBranchConditional %176 %178 %179 + %178 = OpLabel + OpBranch %177 + %179 = OpLabel + OpBranch %172 + %177 = OpLabel + OpStore %i_8 %int_0 + OpBranch %180 + %180 = OpLabel + OpLoopMerge %181 %182 None + OpBranch %183 + %183 = OpLabel + %184 = OpLoad %int %i_8 + %185 = OpSLessThan %bool %184 %int_1 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + OpBranch %186 + %188 = OpLabel + OpBranch %181 + %186 = OpLabel + OpStore %i_9 %int_0 + OpBranch %189 + %189 = OpLabel + OpLoopMerge %190 %191 None + OpBranch %192 + %192 = OpLabel + %193 = OpLoad %int %i_9 + %194 = OpSLessThan %bool %193 %int_1 + OpSelectionMerge %195 None + OpBranchConditional %194 %196 %197 + %196 = OpLabel + OpBranch %195 + %197 = OpLabel + OpBranch %190 + %195 = OpLabel + OpStore %i_10 %int_0 + OpBranch %198 + %198 = OpLabel + OpLoopMerge %199 %200 None + OpBranch %201 + %201 = OpLabel + %202 = OpLoad %int %i_10 + %203 = OpSLessThan %bool %202 %int_1 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %206 + %205 = OpLabel + OpBranch %204 + %206 = OpLabel + OpBranch %199 + %204 = OpLabel + OpStore %i_11 %int_0 + OpBranch %207 + %207 = OpLabel + OpLoopMerge %208 %209 None + OpBranch %210 + %210 = OpLabel + %211 = OpLoad %int %i_11 + %212 = OpSLessThan %bool %211 %int_1 + OpSelectionMerge %213 None + OpBranchConditional %212 %214 %215 + %214 = OpLabel + OpBranch %213 + %215 = OpLabel + OpBranch %208 + %213 = OpLabel + OpStore %i_12 %int_0 + OpBranch %216 + %216 = OpLabel + OpLoopMerge %217 %218 None + OpBranch %219 + %219 = OpLabel + %220 = OpLoad %int %i_12 + %221 = OpSLessThan %bool %220 %int_1 + OpSelectionMerge %222 None + OpBranchConditional %221 %223 %224 + %223 = OpLabel + OpBranch %222 + %224 = OpLabel + OpBranch %217 + %222 = OpLabel + OpStore %i_13 %int_0 + OpBranch %225 + %225 = OpLabel + OpLoopMerge %226 %227 None + OpBranch %228 + %228 = OpLabel + %229 = OpLoad %int %i_13 + %230 = OpSLessThan %bool %229 %int_1 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %233 + %232 = OpLabel + OpBranch %231 + %233 = OpLabel + OpBranch %226 + %231 = OpLabel + OpStore %i_14 %int_0 + OpBranch %234 + %234 = OpLabel + OpLoopMerge %235 %236 None + OpBranch %237 + %237 = OpLabel + %238 = OpLoad %int %i_14 + %239 = OpSLessThan %bool %238 %int_1 + OpSelectionMerge %240 None + OpBranchConditional %239 %241 %242 + %241 = OpLabel + OpBranch %240 + %242 = OpLabel + OpBranch %235 + %240 = OpLabel + OpStore %i_15 %int_0 + OpBranch %243 + %243 = OpLabel + OpLoopMerge %244 %245 None + OpBranch %246 + %246 = OpLabel + %247 = OpLoad %int %i_15 + %248 = OpSLessThan %bool %247 %int_1 + OpSelectionMerge %249 None + OpBranchConditional %248 %250 %251 + %250 = OpLabel + OpBranch %249 + %251 = OpLabel + OpBranch %244 + %249 = OpLabel + OpStore %i_16 %int_0 + OpBranch %252 + %252 = OpLabel + OpLoopMerge %253 %254 None + OpBranch %255 + %255 = OpLabel + %256 = OpLoad %int %i_16 + %257 = OpSLessThan %bool %256 %int_1 + OpSelectionMerge %258 None + OpBranchConditional %257 %259 %260 + %259 = OpLabel + OpBranch %258 + %260 = OpLabel + OpBranch %253 + %258 = OpLabel + OpStore %i_17 %int_0 + OpBranch %261 + %261 = OpLabel + OpLoopMerge %262 %263 None + OpBranch %264 + %264 = OpLabel + %265 = OpLoad %int %i_17 + %266 = OpSLessThan %bool %265 %int_1 + OpSelectionMerge %267 None + OpBranchConditional %266 %268 %269 + %268 = OpLabel + OpBranch %267 + %269 = OpLabel + OpBranch %262 + %267 = OpLabel + OpStore %i_18 %int_0 + OpBranch %270 + %270 = OpLabel + OpLoopMerge %271 %272 None + OpBranch %273 + %273 = OpLabel + %274 = OpLoad %int %i_18 + %275 = OpSLessThan %bool %274 %int_1 + OpSelectionMerge %276 None + OpBranchConditional %275 %277 %278 + %277 = OpLabel + OpBranch %276 + %278 = OpLabel + OpBranch %271 + %276 = OpLabel + OpStore %i_19 %int_0 + OpBranch %279 + %279 = OpLabel + OpLoopMerge %280 %281 None + OpBranch %282 + %282 = OpLabel + %283 = OpLoad %int %i_19 + %284 = OpSLessThan %bool %283 %int_1 + OpSelectionMerge %285 None + OpBranchConditional %284 %286 %287 + %286 = OpLabel + OpBranch %285 + %287 = OpLabel + OpBranch %280 + %285 = OpLabel + OpStore %i_20 %int_0 + OpBranch %288 + %288 = OpLabel + OpLoopMerge %289 %290 None + OpBranch %291 + %291 = OpLabel + %292 = OpLoad %int %i_20 + %293 = OpSLessThan %bool %292 %int_1 + OpSelectionMerge %294 None + OpBranchConditional %293 %295 %296 + %295 = OpLabel + OpBranch %294 + %296 = OpLabel + OpBranch %289 + %294 = OpLabel + OpStore %i_21 %int_0 + OpBranch %297 + %297 = OpLabel + OpLoopMerge %298 %299 None + OpBranch %300 + %300 = OpLabel + %301 = OpLoad %int %i_21 + %302 = OpSLessThan %bool %301 %int_1 + OpSelectionMerge %303 None + OpBranchConditional %302 %304 %305 + %304 = OpLabel + OpBranch %303 + %305 = OpLabel + OpBranch %298 + %303 = OpLabel + OpStore %i_22 %int_0 + OpBranch %306 + %306 = OpLabel + OpLoopMerge %307 %308 None + OpBranch %309 + %309 = OpLabel + %310 = OpLoad %int %i_22 + %311 = OpSLessThan %bool %310 %int_1 + OpSelectionMerge %312 None + OpBranchConditional %311 %313 %314 + %313 = OpLabel + OpBranch %312 + %314 = OpLabel + OpBranch %307 + %312 = OpLabel + OpStore %i_23 %int_0 + OpBranch %315 + %315 = OpLabel + OpLoopMerge %316 %317 None + OpBranch %318 + %318 = OpLabel + %319 = OpLoad %int %i_23 + %320 = OpSLessThan %bool %319 %int_1 + OpSelectionMerge %321 None + OpBranchConditional %320 %322 %323 + %322 = OpLabel + OpBranch %321 + %323 = OpLabel + OpBranch %316 + %321 = OpLabel + OpStore %i_24 %int_0 + OpBranch %324 + %324 = OpLabel + OpLoopMerge %325 %326 None + OpBranch %327 + %327 = OpLabel + %328 = OpLoad %int %i_24 + %329 = OpSLessThan %bool %328 %int_1 + OpSelectionMerge %330 None + OpBranchConditional %329 %331 %332 + %331 = OpLabel + OpBranch %330 + %332 = OpLabel + OpBranch %325 + %330 = OpLabel + OpStore %i_25 %int_0 + OpBranch %333 + %333 = OpLabel + OpLoopMerge %334 %335 None + OpBranch %336 + %336 = OpLabel + %337 = OpLoad %int %i_25 + %338 = OpSLessThan %bool %337 %int_1 + OpSelectionMerge %339 None + OpBranchConditional %338 %340 %341 + %340 = OpLabel + OpBranch %339 + %341 = OpLabel + OpBranch %334 + %339 = OpLabel + OpStore %i_26 %int_0 + OpBranch %342 + %342 = OpLabel + OpLoopMerge %343 %344 None + OpBranch %345 + %345 = OpLabel + %346 = OpLoad %int %i_26 + %347 = OpSLessThan %bool %346 %int_1 + OpSelectionMerge %348 None + OpBranchConditional %347 %349 %350 + %349 = OpLabel + OpBranch %348 + %350 = OpLabel + OpBranch %343 + %348 = OpLabel + OpStore %i_27 %int_0 + OpBranch %351 + %351 = OpLabel + OpLoopMerge %352 %353 None + OpBranch %354 + %354 = OpLabel + %355 = OpLoad %int %i_27 + %356 = OpSLessThan %bool %355 %int_1 + OpSelectionMerge %357 None + OpBranchConditional %356 %358 %359 + %358 = OpLabel + OpBranch %357 + %359 = OpLabel + OpBranch %352 + %357 = OpLabel + OpStore %i_28 %int_0 + OpBranch %360 + %360 = OpLabel + OpLoopMerge %361 %362 None + OpBranch %363 + %363 = OpLabel + %364 = OpLoad %int %i_28 + %365 = OpSLessThan %bool %364 %int_1 + OpSelectionMerge %366 None + OpBranchConditional %365 %367 %368 + %367 = OpLabel + OpBranch %366 + %368 = OpLabel + OpBranch %361 + %366 = OpLabel + OpStore %i_29 %int_0 + OpBranch %369 + %369 = OpLabel + OpLoopMerge %370 %371 None + OpBranch %372 + %372 = OpLabel + %373 = OpLoad %int %i_29 + %374 = OpSLessThan %bool %373 %int_1 + OpSelectionMerge %375 None + OpBranchConditional %374 %376 %377 + %376 = OpLabel + OpBranch %375 + %377 = OpLabel + OpBranch %370 + %375 = OpLabel + OpStore %i_30 %int_0 + OpBranch %378 + %378 = OpLabel + OpLoopMerge %379 %380 None + OpBranch %381 + %381 = OpLabel + %382 = OpLoad %int %i_30 + %383 = OpSLessThan %bool %382 %int_1 + OpSelectionMerge %384 None + OpBranchConditional %383 %385 %386 + %385 = OpLabel + OpBranch %384 + %386 = OpLabel + OpBranch %379 + %384 = OpLabel + OpStore %i_31 %int_0 + OpBranch %387 + %387 = OpLabel + OpLoopMerge %388 %389 None + OpBranch %390 + %390 = OpLabel + %391 = OpLoad %int %i_31 + %392 = OpSLessThan %bool %391 %int_1 + OpSelectionMerge %393 None + OpBranchConditional %392 %394 %395 + %394 = OpLabel + OpBranch %393 + %395 = OpLabel + OpBranch %388 + %393 = OpLabel + OpStore %i_32 %int_0 + OpBranch %396 + %396 = OpLabel + OpLoopMerge %397 %398 None + OpBranch %399 + %399 = OpLabel + %400 = OpLoad %int %i_32 + %401 = OpSLessThan %bool %400 %int_1 + OpSelectionMerge %402 None + OpBranchConditional %401 %403 %404 + %403 = OpLabel + OpBranch %402 + %404 = OpLabel + OpBranch %397 + %402 = OpLabel + OpStore %i_33 %int_0 + OpBranch %405 + %405 = OpLabel + OpLoopMerge %406 %407 None + OpBranch %408 + %408 = OpLabel + %409 = OpLoad %int %i_33 + %410 = OpSLessThan %bool %409 %int_1 + OpSelectionMerge %411 None + OpBranchConditional %410 %412 %413 + %412 = OpLabel + OpBranch %411 + %413 = OpLabel + OpBranch %406 + %411 = OpLabel + OpStore %i_34 %int_0 + OpBranch %414 + %414 = OpLabel + OpLoopMerge %415 %416 None + OpBranch %417 + %417 = OpLabel + %418 = OpLoad %int %i_34 + %419 = OpSLessThan %bool %418 %int_1 + OpSelectionMerge %420 None + OpBranchConditional %419 %421 %422 + %421 = OpLabel + OpBranch %420 + %422 = OpLabel + OpBranch %415 + %420 = OpLabel + OpStore %i_35 %int_0 + OpBranch %423 + %423 = OpLabel + OpLoopMerge %424 %425 None + OpBranch %426 + %426 = OpLabel + %427 = OpLoad %int %i_35 + %428 = OpSLessThan %bool %427 %int_1 + OpSelectionMerge %429 None + OpBranchConditional %428 %430 %431 + %430 = OpLabel + OpBranch %429 + %431 = OpLabel + OpBranch %424 + %429 = OpLabel + OpStore %i_36 %int_0 + OpBranch %432 + %432 = OpLabel + OpLoopMerge %433 %434 None + OpBranch %435 + %435 = OpLabel + %436 = OpLoad %int %i_36 + %437 = OpSLessThan %bool %436 %int_1 + OpSelectionMerge %438 None + OpBranchConditional %437 %439 %440 + %439 = OpLabel + OpBranch %438 + %440 = OpLabel + OpBranch %433 + %438 = OpLabel + OpStore %i_37 %int_0 + OpBranch %441 + %441 = OpLabel + OpLoopMerge %442 %443 None + OpBranch %444 + %444 = OpLabel + %445 = OpLoad %int %i_37 + %446 = OpSLessThan %bool %445 %int_1 + OpSelectionMerge %447 None + OpBranchConditional %446 %448 %449 + %448 = OpLabel + OpBranch %447 + %449 = OpLabel + OpBranch %442 + %447 = OpLabel + OpBranch %450 + %450 = OpLabel + OpLoopMerge %451 %452 None + OpBranch %453 + %453 = OpLabel + %454 = OpLoad %int %x_GLF_global_loop_count + %455 = OpIAdd %int %454 %int_1 + OpStore %x_GLF_global_loop_count %455 + OpBranch %452 + %452 = OpLabel + %456 = OpLoad %int %x_GLF_global_loop_count + %458 = OpSLessThan %bool %456 %int_98 + OpSelectionMerge %459 None + OpBranchConditional %458 %460 %461 + %460 = OpLabel + OpBranch %459 + %461 = OpLabel + OpBranch %451 + %459 = OpLabel + OpBranch %450 + %451 = OpLabel + %462 = OpLoad %int %i_37 + %463 = OpLoad %int %i_37 + %464 = OpAccessChain %_ptr_Function_float %m23 %462 %463 + OpStore %464 %float_1 + %466 = OpLoad %int %i_37 + %467 = OpLoad %int %i_37 + %468 = OpAccessChain %_ptr_Function_float %m24 %466 %467 + OpStore %468 %float_1 + %469 = OpLoad %int %i_37 + %470 = OpLoad %int %i_37 + %471 = OpAccessChain %_ptr_Function_float %m32 %469 %470 + OpStore %471 %float_1 + %472 = OpLoad %int %i_37 + %473 = OpLoad %int %i_37 + %474 = OpAccessChain %_ptr_Function_float %m33 %472 %473 + OpStore %474 %float_1 + %475 = OpLoad %int %i_37 + %476 = OpLoad %int %i_37 + %477 = OpAccessChain %_ptr_Function_float %m34 %475 %476 + OpStore %477 %float_1 + %478 = OpLoad %int %i_37 + %479 = OpLoad %int %i_37 + %480 = OpAccessChain %_ptr_Function_float %m42 %478 %479 + OpStore %480 %float_1 + %481 = OpLoad %int %i_37 + %482 = OpLoad %int %i_37 + %483 = OpAccessChain %_ptr_Function_float %m43 %481 %482 + OpStore %483 %float_1 + %484 = OpLoad %int %i_37 + %485 = OpLoad %int %i_37 + %486 = OpAccessChain %_ptr_Function_float %m44 %484 %485 + OpStore %486 %float_1 + OpBranch %443 + %443 = OpLabel + %487 = OpLoad %int %i_37 + %488 = OpIAdd %int %487 %int_1 + OpStore %i_37 %488 + OpBranch %441 + %442 = OpLabel + OpBranch %434 + %434 = OpLabel + %489 = OpLoad %int %i_36 + %490 = OpIAdd %int %489 %int_1 + OpStore %i_36 %490 + OpBranch %432 + %433 = OpLabel + OpBranch %425 + %425 = OpLabel + %491 = OpLoad %int %i_35 + %492 = OpIAdd %int %491 %int_1 + OpStore %i_35 %492 + OpBranch %423 + %424 = OpLabel + OpBranch %416 + %416 = OpLabel + %493 = OpLoad %int %i_34 + %494 = OpIAdd %int %493 %int_1 + OpStore %i_34 %494 + OpBranch %414 + %415 = OpLabel + OpBranch %407 + %407 = OpLabel + %495 = OpLoad %int %i_33 + %496 = OpIAdd %int %495 %int_1 + OpStore %i_33 %496 + OpBranch %405 + %406 = OpLabel + OpBranch %398 + %398 = OpLabel + %497 = OpLoad %int %i_32 + %498 = OpIAdd %int %497 %int_1 + OpStore %i_32 %498 + OpBranch %396 + %397 = OpLabel + OpBranch %389 + %389 = OpLabel + %499 = OpLoad %int %i_31 + %500 = OpIAdd %int %499 %int_1 + OpStore %i_31 %500 + OpBranch %387 + %388 = OpLabel + OpBranch %380 + %380 = OpLabel + %501 = OpLoad %int %i_30 + %502 = OpIAdd %int %501 %int_1 + OpStore %i_30 %502 + OpBranch %378 + %379 = OpLabel + OpBranch %371 + %371 = OpLabel + %503 = OpLoad %int %i_29 + %504 = OpIAdd %int %503 %int_1 + OpStore %i_29 %504 + OpBranch %369 + %370 = OpLabel + OpBranch %362 + %362 = OpLabel + %505 = OpLoad %int %i_28 + %506 = OpIAdd %int %505 %int_1 + OpStore %i_28 %506 + OpBranch %360 + %361 = OpLabel + OpBranch %353 + %353 = OpLabel + %507 = OpLoad %int %i_27 + %508 = OpIAdd %int %507 %int_1 + OpStore %i_27 %508 + OpBranch %351 + %352 = OpLabel + OpBranch %344 + %344 = OpLabel + %509 = OpLoad %int %i_26 + %510 = OpIAdd %int %509 %int_1 + OpStore %i_26 %510 + OpBranch %342 + %343 = OpLabel + OpBranch %335 + %335 = OpLabel + %511 = OpLoad %int %i_25 + %512 = OpIAdd %int %511 %int_1 + OpStore %i_25 %512 + OpBranch %333 + %334 = OpLabel + OpBranch %326 + %326 = OpLabel + %513 = OpLoad %int %i_24 + %514 = OpIAdd %int %513 %int_1 + OpStore %i_24 %514 + OpBranch %324 + %325 = OpLabel + OpBranch %317 + %317 = OpLabel + %515 = OpLoad %int %i_23 + %516 = OpIAdd %int %515 %int_1 + OpStore %i_23 %516 + OpBranch %315 + %316 = OpLabel + OpBranch %308 + %308 = OpLabel + %517 = OpLoad %int %i_22 + %518 = OpIAdd %int %517 %int_1 + OpStore %i_22 %518 + OpBranch %306 + %307 = OpLabel + OpBranch %299 + %299 = OpLabel + %519 = OpLoad %int %i_21 + %520 = OpIAdd %int %519 %int_1 + OpStore %i_21 %520 + OpBranch %297 + %298 = OpLabel + OpBranch %290 + %290 = OpLabel + %521 = OpLoad %int %i_20 + %522 = OpIAdd %int %521 %int_1 + OpStore %i_20 %522 + OpBranch %288 + %289 = OpLabel + OpBranch %281 + %281 = OpLabel + %523 = OpLoad %int %i_19 + %524 = OpIAdd %int %523 %int_1 + OpStore %i_19 %524 + OpBranch %279 + %280 = OpLabel + OpBranch %272 + %272 = OpLabel + %525 = OpLoad %int %i_18 + %526 = OpIAdd %int %525 %int_1 + OpStore %i_18 %526 + OpBranch %270 + %271 = OpLabel + OpBranch %263 + %263 = OpLabel + %527 = OpLoad %int %i_17 + %528 = OpIAdd %int %527 %int_1 + OpStore %i_17 %528 + OpBranch %261 + %262 = OpLabel + OpBranch %254 + %254 = OpLabel + %529 = OpLoad %int %i_16 + %530 = OpIAdd %int %529 %int_1 + OpStore %i_16 %530 + OpBranch %252 + %253 = OpLabel + OpBranch %245 + %245 = OpLabel + %531 = OpLoad %int %i_15 + %532 = OpIAdd %int %531 %int_1 + OpStore %i_15 %532 + OpBranch %243 + %244 = OpLabel + OpBranch %236 + %236 = OpLabel + %533 = OpLoad %int %i_14 + %534 = OpIAdd %int %533 %int_1 + OpStore %i_14 %534 + OpBranch %234 + %235 = OpLabel + OpBranch %227 + %227 = OpLabel + %535 = OpLoad %int %i_13 + %536 = OpIAdd %int %535 %int_1 + OpStore %i_13 %536 + OpBranch %225 + %226 = OpLabel + OpBranch %218 + %218 = OpLabel + %537 = OpLoad %int %i_12 + %538 = OpIAdd %int %537 %int_1 + OpStore %i_12 %538 + OpBranch %216 + %217 = OpLabel + OpBranch %209 + %209 = OpLabel + %539 = OpLoad %int %i_11 + %540 = OpIAdd %int %539 %int_1 + OpStore %i_11 %540 + OpBranch %207 + %208 = OpLabel + OpBranch %200 + %200 = OpLabel + %541 = OpLoad %int %i_10 + %542 = OpIAdd %int %541 %int_1 + OpStore %i_10 %542 + OpBranch %198 + %199 = OpLabel + OpBranch %191 + %191 = OpLabel + %543 = OpLoad %int %i_9 + %544 = OpIAdd %int %543 %int_1 + OpStore %i_9 %544 + OpBranch %189 + %190 = OpLabel + OpBranch %182 + %182 = OpLabel + %545 = OpLoad %int %i_8 + %546 = OpIAdd %int %545 %int_1 + OpStore %i_8 %546 + OpBranch %180 + %181 = OpLabel + OpBranch %173 + %173 = OpLabel + %547 = OpLoad %int %i_7 + %548 = OpIAdd %int %547 %int_1 + OpStore %i_7 %548 + OpBranch %171 + %172 = OpLabel + OpBranch %164 + %164 = OpLabel + %549 = OpLoad %int %i_6 + %550 = OpIAdd %int %549 %int_1 + OpStore %i_6 %550 + OpBranch %162 + %163 = OpLabel + OpBranch %155 + %155 = OpLabel + %551 = OpLoad %int %i_5 + %552 = OpIAdd %int %551 %int_1 + OpStore %i_5 %552 + OpBranch %153 + %154 = OpLabel + OpBranch %146 + %146 = OpLabel + %553 = OpLoad %int %i_4 + %554 = OpIAdd %int %553 %int_1 + OpStore %i_4 %554 + OpBranch %144 + %145 = OpLabel + OpBranch %137 + %137 = OpLabel + %555 = OpLoad %int %i_3 + %556 = OpIAdd %int %555 %int_1 + OpStore %i_3 %556 + OpBranch %135 + %136 = OpLabel + OpBranch %128 + %128 = OpLabel + %557 = OpLoad %int %i_2 + %558 = OpIAdd %int %557 %int_1 + OpStore %i_2 %558 + OpBranch %126 + %127 = OpLabel + OpBranch %119 + %119 = OpLabel + %559 = OpLoad %int %i_1 + %560 = OpIAdd %int %559 %int_1 + OpStore %i_1 %560 + OpBranch %117 + %118 = OpLabel + OpBranch %108 + %108 = OpLabel + %561 = OpLoad %int %i + %562 = OpIAdd %int %561 %int_1 + OpStore %i %562 + OpBranch %106 + %107 = OpLabel + OpStore %sum %float_0 + OpStore %r %int_0 + OpBranch %563 + %563 = OpLabel + OpLoopMerge %564 %565 None + OpBranch %566 + %566 = OpLabel + %567 = OpLoad %int %x_GLF_global_loop_count + %569 = OpSLessThan %bool %567 %int_100 + OpSelectionMerge %570 None + OpBranchConditional %569 %571 %572 + %571 = OpLabel + OpBranch %570 + %572 = OpLabel + OpBranch %564 + %570 = OpLabel + %573 = OpLoad %int %x_GLF_global_loop_count + %574 = OpIAdd %int %573 %int_1 + OpStore %x_GLF_global_loop_count %574 + %575 = OpLoad %int %r + %576 = OpAccessChain %_ptr_Function_float %m23 %int_0 %575 + %577 = OpLoad %float %576 + %578 = OpLoad %float %sum + %579 = OpFAdd %float %578 %577 + OpStore %sum %579 + %580 = OpLoad %int %r + %581 = OpAccessChain %_ptr_Function_float %m24 %int_0 %580 + %582 = OpLoad %float %581 + %583 = OpLoad %float %sum + %584 = OpFAdd %float %583 %582 + OpStore %sum %584 + %585 = OpLoad %int %r + %586 = OpAccessChain %_ptr_Function_float %m32 %int_0 %585 + %587 = OpLoad %float %586 + %588 = OpLoad %float %sum + %589 = OpFAdd %float %588 %587 + OpStore %sum %589 + %590 = OpLoad %int %r + %591 = OpAccessChain %_ptr_Function_float %m33 %int_0 %590 + %592 = OpLoad %float %591 + %593 = OpLoad %float %sum + %594 = OpFAdd %float %593 %592 + OpStore %sum %594 + %595 = OpLoad %int %r + %596 = OpAccessChain %_ptr_Function_float %m34 %int_0 %595 + %597 = OpLoad %float %596 + %598 = OpLoad %float %sum + %599 = OpFAdd %float %598 %597 + OpStore %sum %599 + %600 = OpLoad %int %r + %601 = OpAccessChain %_ptr_Function_float %m42 %int_0 %600 + %602 = OpLoad %float %601 + %603 = OpLoad %float %sum + %604 = OpFAdd %float %603 %602 + OpStore %sum %604 + %605 = OpLoad %int %r + %606 = OpAccessChain %_ptr_Function_float %m43 %int_0 %605 + %607 = OpLoad %float %606 + %608 = OpLoad %float %sum + %609 = OpFAdd %float %608 %607 + OpStore %sum %609 + %610 = OpLoad %int %r + %611 = OpAccessChain %_ptr_Function_float %m44 %int_0 %610 + %612 = OpLoad %float %611 + %613 = OpLoad %float %sum + %614 = OpFAdd %float %613 %612 + OpStore %sum %614 + OpBranch %565 + %565 = OpLabel + %615 = OpLoad %int %r + %616 = OpIAdd %int %615 %int_1 + OpStore %r %616 + OpBranch %563 + %564 = OpLabel + %617 = OpLoad %float %sum + %619 = OpFOrdEqual %bool %617 %float_8 + OpSelectionMerge %620 None + OpBranchConditional %619 %621 %622 + %621 = OpLabel + OpStore %x_GLF_color %623 + OpBranch %620 + %622 = OpLabel + OpStore %x_GLF_color %97 + OpBranch %620 + %620 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %624 +%tint_symbol = OpFunctionParameter %main_out + %628 = OpLabel + %629 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %629 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %631 = OpLabel + %632 = OpFunctionCall %void %main_1 + %634 = OpLoad %v4float %x_GLF_color + %635 = OpCompositeConstruct %main_out %634 + %633 = OpFunctionCall %void %tint_symbol_2 %635 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 452[%452] is not post dominated by the back-edge block 459[%459] + %459 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..6dbe667a2a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.wgsl @@ -0,0 +1,659 @@ +var x_GLF_global_loop_count : i32; + +var x_GLF_color : vec4; + +fn main_1() { + var m23 : mat2x3; + var m24 : mat2x4; + var m32 : mat3x2; + var m33 : mat3x3; + var m34 : mat3x4; + var m42 : mat4x2; + var m43 : mat4x3; + var m44 : mat4x4; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var i_3 : i32; + var i_4 : i32; + var i_5 : i32; + var i_6 : i32; + var i_7 : i32; + var i_8 : i32; + var i_9 : i32; + var i_10 : i32; + var i_11 : i32; + var i_12 : i32; + var i_13 : i32; + var i_14 : i32; + var i_15 : i32; + var i_16 : i32; + var i_17 : i32; + var i_18 : i32; + var i_19 : i32; + var i_20 : i32; + var i_21 : i32; + var i_22 : i32; + var i_23 : i32; + var i_24 : i32; + var i_25 : i32; + var i_26 : i32; + var i_27 : i32; + var i_28 : i32; + var i_29 : i32; + var i_30 : i32; + var i_31 : i32; + var i_32 : i32; + var i_33 : i32; + var i_34 : i32; + var i_35 : i32; + var i_36 : i32; + var i_37 : i32; + var sum : f32; + var r : i32; + x_GLF_global_loop_count = 0; + m23 = mat2x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); + m24 = mat2x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + m32 = mat3x2(vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0)); + m33 = mat3x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); + m34 = mat3x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + m42 = mat4x2(vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0)); + m43 = mat4x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); + m44 = mat4x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + i = 0; + loop { + let x_105 : i32 = i; + if ((x_105 < 1)) { + } else { + break; + } + i_1 = 0; + loop { + let x_112 : i32 = i_1; + if ((x_112 < 1)) { + } else { + break; + } + i_2 = 0; + loop { + let x_119 : i32 = i_2; + if ((x_119 < 1)) { + } else { + break; + } + i_3 = 0; + loop { + let x_126 : i32 = i_3; + if ((x_126 < 1)) { + } else { + break; + } + i_4 = 0; + loop { + let x_133 : i32 = i_4; + if ((x_133 < 1)) { + } else { + break; + } + i_5 = 0; + loop { + let x_140 : i32 = i_5; + if ((x_140 < 1)) { + } else { + break; + } + i_6 = 0; + loop { + let x_147 : i32 = i_6; + if ((x_147 < 1)) { + } else { + break; + } + i_7 = 0; + loop { + let x_154 : i32 = i_7; + if ((x_154 < 1)) { + } else { + break; + } + i_8 = 0; + loop { + let x_161 : i32 = i_8; + if ((x_161 < 1)) { + } else { + break; + } + i_9 = 0; + loop { + let x_168 : i32 = i_9; + if ((x_168 < 1)) { + } else { + break; + } + i_10 = 0; + loop { + let x_175 : i32 = i_10; + if ((x_175 < 1)) { + } else { + break; + } + i_11 = 0; + loop { + let x_182 : i32 = i_11; + if ((x_182 < 1)) { + } else { + break; + } + i_12 = 0; + loop { + let x_189 : i32 = i_12; + if ((x_189 < 1)) { + } else { + break; + } + i_13 = 0; + loop { + let x_196 : i32 = i_13; + if ((x_196 < 1)) { + } else { + break; + } + i_14 = 0; + loop { + let x_203 : i32 = i_14; + if ((x_203 < 1)) { + } else { + break; + } + i_15 = 0; + loop { + let x_210 : i32 = i_15; + if ((x_210 < 1)) { + } else { + break; + } + i_16 = 0; + loop { + let x_217 : i32 = i_16; + if ((x_217 < 1)) { + } else { + break; + } + i_17 = 0; + loop { + let x_224 : i32 = i_17; + if ((x_224 < 1)) { + } else { + break; + } + i_18 = 0; + loop { + let x_231 : i32 = i_18; + if ((x_231 < 1)) { + } else { + break; + } + i_19 = 0; + loop { + let x_238 : i32 = i_19; + if ((x_238 < 1)) { + } else { + break; + } + i_20 = 0; + loop { + let x_245 : i32 = i_20; + if ((x_245 < 1)) { + } else { + break; + } + i_21 = 0; + loop { + let x_252 : i32 = i_21; + if ((x_252 < 1)) { + } else { + break; + } + i_22 = 0; + loop { + let x_259 : i32 = i_22; + if ((x_259 < 1)) { + } else { + break; + } + i_23 = 0; + loop { + let x_266 : i32 = i_23; + if ((x_266 < 1)) { + } else { + break; + } + i_24 = 0; + loop { + let x_273 : i32 = i_24; + if ((x_273 < 1)) { + } else { + break; + } + i_25 = 0; + loop { + let x_280 : i32 = i_25; + if ((x_280 < 1)) { + } else { + break; + } + i_26 = 0; + loop { + let x_287 : i32 = i_26; + if ((x_287 < 1)) { + } else { + break; + } + i_27 = 0; + loop { + let x_294 : i32 = i_27; + if ((x_294 < 1)) { + } else { + break; + } + i_28 = 0; + loop { + let x_301 : i32 = i_28; + if ((x_301 < 1)) { + } else { + break; + } + i_29 = 0; + loop { + let x_308 : i32 = i_29; + if ((x_308 < 1)) { + } else { + break; + } + i_30 = 0; + loop { + let x_315 : i32 = i_30; + if ((x_315 < 1)) { + } else { + break; + } + i_31 = 0; + loop { + let x_322 : i32 = i_31; + if ((x_322 < 1)) { + } else { + break; + } + i_32 = 0; + loop { + let x_329 : i32 = i_32; + if ((x_329 < 1)) { + } else { + break; + } + i_33 = 0; + loop { + let x_336 : i32 = i_33; + if ((x_336 < 1)) { + } else { + break; + } + i_34 = 0; + loop { + let x_343 : i32 = i_34; + if ((x_343 < 1)) { + } else { + break; + } + i_35 = 0; + loop { + let x_350 : i32 = i_35; + if ((x_350 < 1)) { + } else { + break; + } + i_36 = 0; + loop { + let x_357 : i32 = i_36; + if ((x_357 < 1)) { + } else { + break; + } + i_37 = 0; + loop { + let x_364 : i32 = i_37; + if ((x_364 < 1)) { + } else { + break; + } + loop { + let x_371 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_371 + 1); + + continuing { + let x_373 : i32 = x_GLF_global_loop_count; + if ((x_373 < 98)) { + } else { + break; + } + } + } + let x_375 : i32 = i_37; + let x_376 : i32 = i_37; + m23[x_375][x_376] = 1.0; + let x_378 : i32 = i_37; + let x_379 : i32 = i_37; + m24[x_378][x_379] = 1.0; + let x_381 : i32 = i_37; + let x_382 : i32 = i_37; + m32[x_381][x_382] = 1.0; + let x_384 : i32 = i_37; + let x_385 : i32 = i_37; + m33[x_384][x_385] = 1.0; + let x_387 : i32 = i_37; + let x_388 : i32 = i_37; + m34[x_387][x_388] = 1.0; + let x_390 : i32 = i_37; + let x_391 : i32 = i_37; + m42[x_390][x_391] = 1.0; + let x_393 : i32 = i_37; + let x_394 : i32 = i_37; + m43[x_393][x_394] = 1.0; + let x_396 : i32 = i_37; + let x_397 : i32 = i_37; + m44[x_396][x_397] = 1.0; + + continuing { + let x_399 : i32 = i_37; + i_37 = (x_399 + 1); + } + } + + continuing { + let x_401 : i32 = i_36; + i_36 = (x_401 + 1); + } + } + + continuing { + let x_403 : i32 = i_35; + i_35 = (x_403 + 1); + } + } + + continuing { + let x_405 : i32 = i_34; + i_34 = (x_405 + 1); + } + } + + continuing { + let x_407 : i32 = i_33; + i_33 = (x_407 + 1); + } + } + + continuing { + let x_409 : i32 = i_32; + i_32 = (x_409 + 1); + } + } + + continuing { + let x_411 : i32 = i_31; + i_31 = (x_411 + 1); + } + } + + continuing { + let x_413 : i32 = i_30; + i_30 = (x_413 + 1); + } + } + + continuing { + let x_415 : i32 = i_29; + i_29 = (x_415 + 1); + } + } + + continuing { + let x_417 : i32 = i_28; + i_28 = (x_417 + 1); + } + } + + continuing { + let x_419 : i32 = i_27; + i_27 = (x_419 + 1); + } + } + + continuing { + let x_421 : i32 = i_26; + i_26 = (x_421 + 1); + } + } + + continuing { + let x_423 : i32 = i_25; + i_25 = (x_423 + 1); + } + } + + continuing { + let x_425 : i32 = i_24; + i_24 = (x_425 + 1); + } + } + + continuing { + let x_427 : i32 = i_23; + i_23 = (x_427 + 1); + } + } + + continuing { + let x_429 : i32 = i_22; + i_22 = (x_429 + 1); + } + } + + continuing { + let x_431 : i32 = i_21; + i_21 = (x_431 + 1); + } + } + + continuing { + let x_433 : i32 = i_20; + i_20 = (x_433 + 1); + } + } + + continuing { + let x_435 : i32 = i_19; + i_19 = (x_435 + 1); + } + } + + continuing { + let x_437 : i32 = i_18; + i_18 = (x_437 + 1); + } + } + + continuing { + let x_439 : i32 = i_17; + i_17 = (x_439 + 1); + } + } + + continuing { + let x_441 : i32 = i_16; + i_16 = (x_441 + 1); + } + } + + continuing { + let x_443 : i32 = i_15; + i_15 = (x_443 + 1); + } + } + + continuing { + let x_445 : i32 = i_14; + i_14 = (x_445 + 1); + } + } + + continuing { + let x_447 : i32 = i_13; + i_13 = (x_447 + 1); + } + } + + continuing { + let x_449 : i32 = i_12; + i_12 = (x_449 + 1); + } + } + + continuing { + let x_451 : i32 = i_11; + i_11 = (x_451 + 1); + } + } + + continuing { + let x_453 : i32 = i_10; + i_10 = (x_453 + 1); + } + } + + continuing { + let x_455 : i32 = i_9; + i_9 = (x_455 + 1); + } + } + + continuing { + let x_457 : i32 = i_8; + i_8 = (x_457 + 1); + } + } + + continuing { + let x_459 : i32 = i_7; + i_7 = (x_459 + 1); + } + } + + continuing { + let x_461 : i32 = i_6; + i_6 = (x_461 + 1); + } + } + + continuing { + let x_463 : i32 = i_5; + i_5 = (x_463 + 1); + } + } + + continuing { + let x_465 : i32 = i_4; + i_4 = (x_465 + 1); + } + } + + continuing { + let x_467 : i32 = i_3; + i_3 = (x_467 + 1); + } + } + + continuing { + let x_469 : i32 = i_2; + i_2 = (x_469 + 1); + } + } + + continuing { + let x_471 : i32 = i_1; + i_1 = (x_471 + 1); + } + } + + continuing { + let x_473 : i32 = i; + i = (x_473 + 1); + } + } + sum = 0.0; + r = 0; + loop { + let x_479 : i32 = x_GLF_global_loop_count; + if ((x_479 < 100)) { + } else { + break; + } + let x_482 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_482 + 1); + let x_484 : i32 = r; + let x_486 : f32 = m23[0][x_484]; + let x_487 : f32 = sum; + sum = (x_487 + x_486); + let x_489 : i32 = r; + let x_491 : f32 = m24[0][x_489]; + let x_492 : f32 = sum; + sum = (x_492 + x_491); + let x_494 : i32 = r; + let x_496 : f32 = m32[0][x_494]; + let x_497 : f32 = sum; + sum = (x_497 + x_496); + let x_499 : i32 = r; + let x_501 : f32 = m33[0][x_499]; + let x_502 : f32 = sum; + sum = (x_502 + x_501); + let x_504 : i32 = r; + let x_506 : f32 = m34[0][x_504]; + let x_507 : f32 = sum; + sum = (x_507 + x_506); + let x_509 : i32 = r; + let x_511 : f32 = m42[0][x_509]; + let x_512 : f32 = sum; + sum = (x_512 + x_511); + let x_514 : i32 = r; + let x_516 : f32 = m43[0][x_514]; + let x_517 : f32 = sum; + sum = (x_517 + x_516); + let x_519 : i32 = r; + let x_521 : f32 = m44[0][x_519]; + let x_522 : f32 = sum; + sum = (x_522 + x_521); + + continuing { + let x_524 : i32 = r; + r = (x_524 + 1); + } + } + let x_526 : f32 = sum; + if ((x_526 == 8.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl new file mode 100644 index 0000000000..6dbe667a2a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl @@ -0,0 +1,659 @@ +var x_GLF_global_loop_count : i32; + +var x_GLF_color : vec4; + +fn main_1() { + var m23 : mat2x3; + var m24 : mat2x4; + var m32 : mat3x2; + var m33 : mat3x3; + var m34 : mat3x4; + var m42 : mat4x2; + var m43 : mat4x3; + var m44 : mat4x4; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var i_3 : i32; + var i_4 : i32; + var i_5 : i32; + var i_6 : i32; + var i_7 : i32; + var i_8 : i32; + var i_9 : i32; + var i_10 : i32; + var i_11 : i32; + var i_12 : i32; + var i_13 : i32; + var i_14 : i32; + var i_15 : i32; + var i_16 : i32; + var i_17 : i32; + var i_18 : i32; + var i_19 : i32; + var i_20 : i32; + var i_21 : i32; + var i_22 : i32; + var i_23 : i32; + var i_24 : i32; + var i_25 : i32; + var i_26 : i32; + var i_27 : i32; + var i_28 : i32; + var i_29 : i32; + var i_30 : i32; + var i_31 : i32; + var i_32 : i32; + var i_33 : i32; + var i_34 : i32; + var i_35 : i32; + var i_36 : i32; + var i_37 : i32; + var sum : f32; + var r : i32; + x_GLF_global_loop_count = 0; + m23 = mat2x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); + m24 = mat2x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + m32 = mat3x2(vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0)); + m33 = mat3x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); + m34 = mat3x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + m42 = mat4x2(vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0)); + m43 = mat4x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); + m44 = mat4x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + i = 0; + loop { + let x_105 : i32 = i; + if ((x_105 < 1)) { + } else { + break; + } + i_1 = 0; + loop { + let x_112 : i32 = i_1; + if ((x_112 < 1)) { + } else { + break; + } + i_2 = 0; + loop { + let x_119 : i32 = i_2; + if ((x_119 < 1)) { + } else { + break; + } + i_3 = 0; + loop { + let x_126 : i32 = i_3; + if ((x_126 < 1)) { + } else { + break; + } + i_4 = 0; + loop { + let x_133 : i32 = i_4; + if ((x_133 < 1)) { + } else { + break; + } + i_5 = 0; + loop { + let x_140 : i32 = i_5; + if ((x_140 < 1)) { + } else { + break; + } + i_6 = 0; + loop { + let x_147 : i32 = i_6; + if ((x_147 < 1)) { + } else { + break; + } + i_7 = 0; + loop { + let x_154 : i32 = i_7; + if ((x_154 < 1)) { + } else { + break; + } + i_8 = 0; + loop { + let x_161 : i32 = i_8; + if ((x_161 < 1)) { + } else { + break; + } + i_9 = 0; + loop { + let x_168 : i32 = i_9; + if ((x_168 < 1)) { + } else { + break; + } + i_10 = 0; + loop { + let x_175 : i32 = i_10; + if ((x_175 < 1)) { + } else { + break; + } + i_11 = 0; + loop { + let x_182 : i32 = i_11; + if ((x_182 < 1)) { + } else { + break; + } + i_12 = 0; + loop { + let x_189 : i32 = i_12; + if ((x_189 < 1)) { + } else { + break; + } + i_13 = 0; + loop { + let x_196 : i32 = i_13; + if ((x_196 < 1)) { + } else { + break; + } + i_14 = 0; + loop { + let x_203 : i32 = i_14; + if ((x_203 < 1)) { + } else { + break; + } + i_15 = 0; + loop { + let x_210 : i32 = i_15; + if ((x_210 < 1)) { + } else { + break; + } + i_16 = 0; + loop { + let x_217 : i32 = i_16; + if ((x_217 < 1)) { + } else { + break; + } + i_17 = 0; + loop { + let x_224 : i32 = i_17; + if ((x_224 < 1)) { + } else { + break; + } + i_18 = 0; + loop { + let x_231 : i32 = i_18; + if ((x_231 < 1)) { + } else { + break; + } + i_19 = 0; + loop { + let x_238 : i32 = i_19; + if ((x_238 < 1)) { + } else { + break; + } + i_20 = 0; + loop { + let x_245 : i32 = i_20; + if ((x_245 < 1)) { + } else { + break; + } + i_21 = 0; + loop { + let x_252 : i32 = i_21; + if ((x_252 < 1)) { + } else { + break; + } + i_22 = 0; + loop { + let x_259 : i32 = i_22; + if ((x_259 < 1)) { + } else { + break; + } + i_23 = 0; + loop { + let x_266 : i32 = i_23; + if ((x_266 < 1)) { + } else { + break; + } + i_24 = 0; + loop { + let x_273 : i32 = i_24; + if ((x_273 < 1)) { + } else { + break; + } + i_25 = 0; + loop { + let x_280 : i32 = i_25; + if ((x_280 < 1)) { + } else { + break; + } + i_26 = 0; + loop { + let x_287 : i32 = i_26; + if ((x_287 < 1)) { + } else { + break; + } + i_27 = 0; + loop { + let x_294 : i32 = i_27; + if ((x_294 < 1)) { + } else { + break; + } + i_28 = 0; + loop { + let x_301 : i32 = i_28; + if ((x_301 < 1)) { + } else { + break; + } + i_29 = 0; + loop { + let x_308 : i32 = i_29; + if ((x_308 < 1)) { + } else { + break; + } + i_30 = 0; + loop { + let x_315 : i32 = i_30; + if ((x_315 < 1)) { + } else { + break; + } + i_31 = 0; + loop { + let x_322 : i32 = i_31; + if ((x_322 < 1)) { + } else { + break; + } + i_32 = 0; + loop { + let x_329 : i32 = i_32; + if ((x_329 < 1)) { + } else { + break; + } + i_33 = 0; + loop { + let x_336 : i32 = i_33; + if ((x_336 < 1)) { + } else { + break; + } + i_34 = 0; + loop { + let x_343 : i32 = i_34; + if ((x_343 < 1)) { + } else { + break; + } + i_35 = 0; + loop { + let x_350 : i32 = i_35; + if ((x_350 < 1)) { + } else { + break; + } + i_36 = 0; + loop { + let x_357 : i32 = i_36; + if ((x_357 < 1)) { + } else { + break; + } + i_37 = 0; + loop { + let x_364 : i32 = i_37; + if ((x_364 < 1)) { + } else { + break; + } + loop { + let x_371 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_371 + 1); + + continuing { + let x_373 : i32 = x_GLF_global_loop_count; + if ((x_373 < 98)) { + } else { + break; + } + } + } + let x_375 : i32 = i_37; + let x_376 : i32 = i_37; + m23[x_375][x_376] = 1.0; + let x_378 : i32 = i_37; + let x_379 : i32 = i_37; + m24[x_378][x_379] = 1.0; + let x_381 : i32 = i_37; + let x_382 : i32 = i_37; + m32[x_381][x_382] = 1.0; + let x_384 : i32 = i_37; + let x_385 : i32 = i_37; + m33[x_384][x_385] = 1.0; + let x_387 : i32 = i_37; + let x_388 : i32 = i_37; + m34[x_387][x_388] = 1.0; + let x_390 : i32 = i_37; + let x_391 : i32 = i_37; + m42[x_390][x_391] = 1.0; + let x_393 : i32 = i_37; + let x_394 : i32 = i_37; + m43[x_393][x_394] = 1.0; + let x_396 : i32 = i_37; + let x_397 : i32 = i_37; + m44[x_396][x_397] = 1.0; + + continuing { + let x_399 : i32 = i_37; + i_37 = (x_399 + 1); + } + } + + continuing { + let x_401 : i32 = i_36; + i_36 = (x_401 + 1); + } + } + + continuing { + let x_403 : i32 = i_35; + i_35 = (x_403 + 1); + } + } + + continuing { + let x_405 : i32 = i_34; + i_34 = (x_405 + 1); + } + } + + continuing { + let x_407 : i32 = i_33; + i_33 = (x_407 + 1); + } + } + + continuing { + let x_409 : i32 = i_32; + i_32 = (x_409 + 1); + } + } + + continuing { + let x_411 : i32 = i_31; + i_31 = (x_411 + 1); + } + } + + continuing { + let x_413 : i32 = i_30; + i_30 = (x_413 + 1); + } + } + + continuing { + let x_415 : i32 = i_29; + i_29 = (x_415 + 1); + } + } + + continuing { + let x_417 : i32 = i_28; + i_28 = (x_417 + 1); + } + } + + continuing { + let x_419 : i32 = i_27; + i_27 = (x_419 + 1); + } + } + + continuing { + let x_421 : i32 = i_26; + i_26 = (x_421 + 1); + } + } + + continuing { + let x_423 : i32 = i_25; + i_25 = (x_423 + 1); + } + } + + continuing { + let x_425 : i32 = i_24; + i_24 = (x_425 + 1); + } + } + + continuing { + let x_427 : i32 = i_23; + i_23 = (x_427 + 1); + } + } + + continuing { + let x_429 : i32 = i_22; + i_22 = (x_429 + 1); + } + } + + continuing { + let x_431 : i32 = i_21; + i_21 = (x_431 + 1); + } + } + + continuing { + let x_433 : i32 = i_20; + i_20 = (x_433 + 1); + } + } + + continuing { + let x_435 : i32 = i_19; + i_19 = (x_435 + 1); + } + } + + continuing { + let x_437 : i32 = i_18; + i_18 = (x_437 + 1); + } + } + + continuing { + let x_439 : i32 = i_17; + i_17 = (x_439 + 1); + } + } + + continuing { + let x_441 : i32 = i_16; + i_16 = (x_441 + 1); + } + } + + continuing { + let x_443 : i32 = i_15; + i_15 = (x_443 + 1); + } + } + + continuing { + let x_445 : i32 = i_14; + i_14 = (x_445 + 1); + } + } + + continuing { + let x_447 : i32 = i_13; + i_13 = (x_447 + 1); + } + } + + continuing { + let x_449 : i32 = i_12; + i_12 = (x_449 + 1); + } + } + + continuing { + let x_451 : i32 = i_11; + i_11 = (x_451 + 1); + } + } + + continuing { + let x_453 : i32 = i_10; + i_10 = (x_453 + 1); + } + } + + continuing { + let x_455 : i32 = i_9; + i_9 = (x_455 + 1); + } + } + + continuing { + let x_457 : i32 = i_8; + i_8 = (x_457 + 1); + } + } + + continuing { + let x_459 : i32 = i_7; + i_7 = (x_459 + 1); + } + } + + continuing { + let x_461 : i32 = i_6; + i_6 = (x_461 + 1); + } + } + + continuing { + let x_463 : i32 = i_5; + i_5 = (x_463 + 1); + } + } + + continuing { + let x_465 : i32 = i_4; + i_4 = (x_465 + 1); + } + } + + continuing { + let x_467 : i32 = i_3; + i_3 = (x_467 + 1); + } + } + + continuing { + let x_469 : i32 = i_2; + i_2 = (x_469 + 1); + } + } + + continuing { + let x_471 : i32 = i_1; + i_1 = (x_471 + 1); + } + } + + continuing { + let x_473 : i32 = i; + i = (x_473 + 1); + } + } + sum = 0.0; + r = 0; + loop { + let x_479 : i32 = x_GLF_global_loop_count; + if ((x_479 < 100)) { + } else { + break; + } + let x_482 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_482 + 1); + let x_484 : i32 = r; + let x_486 : f32 = m23[0][x_484]; + let x_487 : f32 = sum; + sum = (x_487 + x_486); + let x_489 : i32 = r; + let x_491 : f32 = m24[0][x_489]; + let x_492 : f32 = sum; + sum = (x_492 + x_491); + let x_494 : i32 = r; + let x_496 : f32 = m32[0][x_494]; + let x_497 : f32 = sum; + sum = (x_497 + x_496); + let x_499 : i32 = r; + let x_501 : f32 = m33[0][x_499]; + let x_502 : f32 = sum; + sum = (x_502 + x_501); + let x_504 : i32 = r; + let x_506 : f32 = m34[0][x_504]; + let x_507 : f32 = sum; + sum = (x_507 + x_506); + let x_509 : i32 = r; + let x_511 : f32 = m42[0][x_509]; + let x_512 : f32 = sum; + sum = (x_512 + x_511); + let x_514 : i32 = r; + let x_516 : f32 = m43[0][x_514]; + let x_517 : f32 = sum; + sum = (x_517 + x_516); + let x_519 : i32 = r; + let x_521 : f32 = m44[0][x_519]; + let x_522 : f32 = sum; + sum = (x_522 + x_521); + + continuing { + let x_524 : i32 = r; + r = (x_524 + 1); + } + } + let x_526 : f32 = sum; + if ((x_526 == 8.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..362d95239e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.hlsl @@ -0,0 +1,324 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +static int x_GLF_global_loop_count = 0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x3 m23 = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float2x4 m24 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x2 m32 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x3 m33 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3x4 m34 = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x2 m42 = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x4 m44 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + int i_11 = 0; + int i_12 = 0; + int i_13 = 0; + int i_14 = 0; + int i_15 = 0; + int i_16 = 0; + int i_17 = 0; + int i_18 = 0; + int i_19 = 0; + int i_20 = 0; + int i_21 = 0; + int i_22 = 0; + int i_23 = 0; + int i_24 = 0; + int i_25 = 0; + int i_26 = 0; + int i_27 = 0; + int i_28 = 0; + int i_29 = 0; + int i_30 = 0; + int i_31 = 0; + int i_32 = 0; + int i_33 = 0; + int i_34 = 0; + int i_35 = 0; + int i_36 = 0; + int i_37 = 0; + float sum = 0.0f; + int r = 0; + x_GLF_global_loop_count = 0; + m23 = float2x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); + m24 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + m32 = float3x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + m33 = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); + m34 = float3x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + m42 = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + m43 = float4x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); + m44 = float4x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + i = 0; + { + for(; (i < 1); i = (i + 1)) { + i_1 = 0; + { + for(; (i_1 < 1); i_1 = (i_1 + 1)) { + i_2 = 0; + { + for(; (i_2 < 1); i_2 = (i_2 + 1)) { + i_3 = 0; + { + for(; (i_3 < 1); i_3 = (i_3 + 1)) { + i_4 = 0; + { + for(; (i_4 < 1); i_4 = (i_4 + 1)) { + i_5 = 0; + { + for(; (i_5 < 1); i_5 = (i_5 + 1)) { + i_6 = 0; + { + for(; (i_6 < 1); i_6 = (i_6 + 1)) { + i_7 = 0; + { + for(; (i_7 < 1); i_7 = (i_7 + 1)) { + i_8 = 0; + { + for(; (i_8 < 1); i_8 = (i_8 + 1)) { + i_9 = 0; + { + for(; (i_9 < 1); i_9 = (i_9 + 1)) { + i_10 = 0; + { + for(; (i_10 < 1); i_10 = (i_10 + 1)) { + i_11 = 0; + { + for(; (i_11 < 1); i_11 = (i_11 + 1)) { + i_12 = 0; + { + for(; (i_12 < 1); i_12 = (i_12 + 1)) { + i_13 = 0; + { + for(; (i_13 < 1); i_13 = (i_13 + 1)) { + i_14 = 0; + { + for(; (i_14 < 1); i_14 = (i_14 + 1)) { + i_15 = 0; + { + for(; (i_15 < 1); i_15 = (i_15 + 1)) { + i_16 = 0; + { + for(; (i_16 < 1); i_16 = (i_16 + 1)) { + i_17 = 0; + { + for(; (i_17 < 1); i_17 = (i_17 + 1)) { + i_18 = 0; + { + for(; (i_18 < 1); i_18 = (i_18 + 1)) { + i_19 = 0; + { + for(; (i_19 < 1); i_19 = (i_19 + 1)) { + i_20 = 0; + { + for(; (i_20 < 1); i_20 = (i_20 + 1)) { + i_21 = 0; + { + for(; (i_21 < 1); i_21 = (i_21 + 1)) { + i_22 = 0; + { + for(; (i_22 < 1); i_22 = (i_22 + 1)) { + i_23 = 0; + { + for(; (i_23 < 1); i_23 = (i_23 + 1)) { + i_24 = 0; + { + for(; (i_24 < 1); i_24 = (i_24 + 1)) { + i_25 = 0; + { + for(; (i_25 < 1); i_25 = (i_25 + 1)) { + i_26 = 0; + { + for(; (i_26 < 1); i_26 = (i_26 + 1)) { + i_27 = 0; + { + for(; (i_27 < 1); i_27 = (i_27 + 1)) { + i_28 = 0; + { + for(; (i_28 < 1); i_28 = (i_28 + 1)) { + i_29 = 0; + { + for(; (i_29 < 1); i_29 = (i_29 + 1)) { + i_30 = 0; + { + for(; (i_30 < 1); i_30 = (i_30 + 1)) { + i_31 = 0; + { + for(; (i_31 < 1); i_31 = (i_31 + 1)) { + i_32 = 0; + { + for(; (i_32 < 1); i_32 = (i_32 + 1)) { + i_33 = 0; + { + for(; (i_33 < 1); i_33 = (i_33 + 1)) { + i_34 = 0; + { + for(; (i_34 < 1); i_34 = (i_34 + 1)) { + i_35 = 0; + { + for(; (i_35 < 1); i_35 = (i_35 + 1)) { + i_36 = 0; + { + for(; (i_36 < 1); i_36 = (i_36 + 1)) { + i_37 = 0; + { + for(; (i_37 < 1); i_37 = (i_37 + 1)) { + while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + { + if ((x_GLF_global_loop_count < 98)) { + } else { + break; + } + } + } + set_float3(m23[i_37], i_37, 1.0f); + set_float4(m24[i_37], i_37, 1.0f); + set_float2(m32[i_37], i_37, 1.0f); + set_float3(m33[i_37], i_37, 1.0f); + set_float4(m34[i_37], i_37, 1.0f); + set_float2(m42[i_37], i_37, 1.0f); + set_float3(m43[i_37], i_37, 1.0f); + set_float4(m44[i_37], i_37, 1.0f); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + sum = 0.0f; + r = 0; + { + for(; (x_GLF_global_loop_count < 100); r = (r + 1)) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + const float x_486 = m23[0][r]; + sum = (sum + x_486); + const float x_491 = m24[0][r]; + sum = (sum + x_491); + const float x_496 = m32[0][r]; + sum = (sum + x_496); + const float x_501 = m33[0][r]; + sum = (sum + x_501); + const float x_506 = m34[0][r]; + sum = (sum + x_506); + const float x_511 = m42[0][r]; + sum = (sum + x_511); + const float x_516 = m43[0][r]; + sum = (sum + x_516); + const float x_521 = m44[0][r]; + sum = (sum + x_521); + } + } + if ((sum == 8.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..0ab9beb3aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.msl @@ -0,0 +1,624 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + float2x3 m23 = float2x3(0.0f); + float2x4 m24 = float2x4(0.0f); + float3x2 m32 = float3x2(0.0f); + float3x3 m33 = float3x3(0.0f); + float3x4 m34 = float3x4(0.0f); + float4x2 m42 = float4x2(0.0f); + float4x3 m43 = float4x3(0.0f); + float4x4 m44 = float4x4(0.0f); + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + int i_11 = 0; + int i_12 = 0; + int i_13 = 0; + int i_14 = 0; + int i_15 = 0; + int i_16 = 0; + int i_17 = 0; + int i_18 = 0; + int i_19 = 0; + int i_20 = 0; + int i_21 = 0; + int i_22 = 0; + int i_23 = 0; + int i_24 = 0; + int i_25 = 0; + int i_26 = 0; + int i_27 = 0; + int i_28 = 0; + int i_29 = 0; + int i_30 = 0; + int i_31 = 0; + int i_32 = 0; + int i_33 = 0; + int i_34 = 0; + int i_35 = 0; + int i_36 = 0; + int i_37 = 0; + float sum = 0.0f; + int r = 0; + *(tint_symbol_4) = 0; + m23 = float2x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); + m24 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + m32 = float3x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + m33 = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); + m34 = float3x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + m42 = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + m43 = float4x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); + m44 = float4x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + i = 0; + while (true) { + int const x_105 = i; + if ((x_105 < 1)) { + } else { + break; + } + i_1 = 0; + while (true) { + int const x_112 = i_1; + if ((x_112 < 1)) { + } else { + break; + } + i_2 = 0; + while (true) { + int const x_119 = i_2; + if ((x_119 < 1)) { + } else { + break; + } + i_3 = 0; + while (true) { + int const x_126 = i_3; + if ((x_126 < 1)) { + } else { + break; + } + i_4 = 0; + while (true) { + int const x_133 = i_4; + if ((x_133 < 1)) { + } else { + break; + } + i_5 = 0; + while (true) { + int const x_140 = i_5; + if ((x_140 < 1)) { + } else { + break; + } + i_6 = 0; + while (true) { + int const x_147 = i_6; + if ((x_147 < 1)) { + } else { + break; + } + i_7 = 0; + while (true) { + int const x_154 = i_7; + if ((x_154 < 1)) { + } else { + break; + } + i_8 = 0; + while (true) { + int const x_161 = i_8; + if ((x_161 < 1)) { + } else { + break; + } + i_9 = 0; + while (true) { + int const x_168 = i_9; + if ((x_168 < 1)) { + } else { + break; + } + i_10 = 0; + while (true) { + int const x_175 = i_10; + if ((x_175 < 1)) { + } else { + break; + } + i_11 = 0; + while (true) { + int const x_182 = i_11; + if ((x_182 < 1)) { + } else { + break; + } + i_12 = 0; + while (true) { + int const x_189 = i_12; + if ((x_189 < 1)) { + } else { + break; + } + i_13 = 0; + while (true) { + int const x_196 = i_13; + if ((x_196 < 1)) { + } else { + break; + } + i_14 = 0; + while (true) { + int const x_203 = i_14; + if ((x_203 < 1)) { + } else { + break; + } + i_15 = 0; + while (true) { + int const x_210 = i_15; + if ((x_210 < 1)) { + } else { + break; + } + i_16 = 0; + while (true) { + int const x_217 = i_16; + if ((x_217 < 1)) { + } else { + break; + } + i_17 = 0; + while (true) { + int const x_224 = i_17; + if ((x_224 < 1)) { + } else { + break; + } + i_18 = 0; + while (true) { + int const x_231 = i_18; + if ((x_231 < 1)) { + } else { + break; + } + i_19 = 0; + while (true) { + int const x_238 = i_19; + if ((x_238 < 1)) { + } else { + break; + } + i_20 = 0; + while (true) { + int const x_245 = i_20; + if ((x_245 < 1)) { + } else { + break; + } + i_21 = 0; + while (true) { + int const x_252 = i_21; + if ((x_252 < 1)) { + } else { + break; + } + i_22 = 0; + while (true) { + int const x_259 = i_22; + if ((x_259 < 1)) { + } else { + break; + } + i_23 = 0; + while (true) { + int const x_266 = i_23; + if ((x_266 < 1)) { + } else { + break; + } + i_24 = 0; + while (true) { + int const x_273 = i_24; + if ((x_273 < 1)) { + } else { + break; + } + i_25 = 0; + while (true) { + int const x_280 = i_25; + if ((x_280 < 1)) { + } else { + break; + } + i_26 = 0; + while (true) { + int const x_287 = i_26; + if ((x_287 < 1)) { + } else { + break; + } + i_27 = 0; + while (true) { + int const x_294 = i_27; + if ((x_294 < 1)) { + } else { + break; + } + i_28 = 0; + while (true) { + int const x_301 = i_28; + if ((x_301 < 1)) { + } else { + break; + } + i_29 = 0; + while (true) { + int const x_308 = i_29; + if ((x_308 < 1)) { + } else { + break; + } + i_30 = 0; + while (true) { + int const x_315 = i_30; + if ((x_315 < 1)) { + } else { + break; + } + i_31 = 0; + while (true) { + int const x_322 = i_31; + if ((x_322 < 1)) { + } else { + break; + } + i_32 = 0; + while (true) { + int const x_329 = i_32; + if ((x_329 < 1)) { + } else { + break; + } + i_33 = 0; + while (true) { + int const x_336 = i_33; + if ((x_336 < 1)) { + } else { + break; + } + i_34 = 0; + while (true) { + int const x_343 = i_34; + if ((x_343 < 1)) { + } else { + break; + } + i_35 = 0; + while (true) { + int const x_350 = i_35; + if ((x_350 < 1)) { + } else { + break; + } + i_36 = 0; + while (true) { + int const x_357 = i_36; + if ((x_357 < 1)) { + } else { + break; + } + i_37 = 0; + while (true) { + int const x_364 = i_37; + if ((x_364 < 1)) { + } else { + break; + } + while (true) { + int const x_371 = *(tint_symbol_4); + *(tint_symbol_4) = (x_371 + 1); + { + int const x_373 = *(tint_symbol_4); + if ((x_373 < 98)) { + } else { + break; + } + } + } + int const x_375 = i_37; + int const x_376 = i_37; + m23[x_375][x_376] = 1.0f; + int const x_378 = i_37; + int const x_379 = i_37; + m24[x_378][x_379] = 1.0f; + int const x_381 = i_37; + int const x_382 = i_37; + m32[x_381][x_382] = 1.0f; + int const x_384 = i_37; + int const x_385 = i_37; + m33[x_384][x_385] = 1.0f; + int const x_387 = i_37; + int const x_388 = i_37; + m34[x_387][x_388] = 1.0f; + int const x_390 = i_37; + int const x_391 = i_37; + m42[x_390][x_391] = 1.0f; + int const x_393 = i_37; + int const x_394 = i_37; + m43[x_393][x_394] = 1.0f; + int const x_396 = i_37; + int const x_397 = i_37; + m44[x_396][x_397] = 1.0f; + { + int const x_399 = i_37; + i_37 = (x_399 + 1); + } + } + { + int const x_401 = i_36; + i_36 = (x_401 + 1); + } + } + { + int const x_403 = i_35; + i_35 = (x_403 + 1); + } + } + { + int const x_405 = i_34; + i_34 = (x_405 + 1); + } + } + { + int const x_407 = i_33; + i_33 = (x_407 + 1); + } + } + { + int const x_409 = i_32; + i_32 = (x_409 + 1); + } + } + { + int const x_411 = i_31; + i_31 = (x_411 + 1); + } + } + { + int const x_413 = i_30; + i_30 = (x_413 + 1); + } + } + { + int const x_415 = i_29; + i_29 = (x_415 + 1); + } + } + { + int const x_417 = i_28; + i_28 = (x_417 + 1); + } + } + { + int const x_419 = i_27; + i_27 = (x_419 + 1); + } + } + { + int const x_421 = i_26; + i_26 = (x_421 + 1); + } + } + { + int const x_423 = i_25; + i_25 = (x_423 + 1); + } + } + { + int const x_425 = i_24; + i_24 = (x_425 + 1); + } + } + { + int const x_427 = i_23; + i_23 = (x_427 + 1); + } + } + { + int const x_429 = i_22; + i_22 = (x_429 + 1); + } + } + { + int const x_431 = i_21; + i_21 = (x_431 + 1); + } + } + { + int const x_433 = i_20; + i_20 = (x_433 + 1); + } + } + { + int const x_435 = i_19; + i_19 = (x_435 + 1); + } + } + { + int const x_437 = i_18; + i_18 = (x_437 + 1); + } + } + { + int const x_439 = i_17; + i_17 = (x_439 + 1); + } + } + { + int const x_441 = i_16; + i_16 = (x_441 + 1); + } + } + { + int const x_443 = i_15; + i_15 = (x_443 + 1); + } + } + { + int const x_445 = i_14; + i_14 = (x_445 + 1); + } + } + { + int const x_447 = i_13; + i_13 = (x_447 + 1); + } + } + { + int const x_449 = i_12; + i_12 = (x_449 + 1); + } + } + { + int const x_451 = i_11; + i_11 = (x_451 + 1); + } + } + { + int const x_453 = i_10; + i_10 = (x_453 + 1); + } + } + { + int const x_455 = i_9; + i_9 = (x_455 + 1); + } + } + { + int const x_457 = i_8; + i_8 = (x_457 + 1); + } + } + { + int const x_459 = i_7; + i_7 = (x_459 + 1); + } + } + { + int const x_461 = i_6; + i_6 = (x_461 + 1); + } + } + { + int const x_463 = i_5; + i_5 = (x_463 + 1); + } + } + { + int const x_465 = i_4; + i_4 = (x_465 + 1); + } + } + { + int const x_467 = i_3; + i_3 = (x_467 + 1); + } + } + { + int const x_469 = i_2; + i_2 = (x_469 + 1); + } + } + { + int const x_471 = i_1; + i_1 = (x_471 + 1); + } + } + { + int const x_473 = i; + i = (x_473 + 1); + } + } + sum = 0.0f; + r = 0; + while (true) { + int const x_479 = *(tint_symbol_4); + if ((x_479 < 100)) { + } else { + break; + } + int const x_482 = *(tint_symbol_4); + *(tint_symbol_4) = (x_482 + 1); + int const x_484 = r; + float const x_486 = m23[0][x_484]; + float const x_487 = sum; + sum = (x_487 + x_486); + int const x_489 = r; + float const x_491 = m24[0][x_489]; + float const x_492 = sum; + sum = (x_492 + x_491); + int const x_494 = r; + float const x_496 = m32[0][x_494]; + float const x_497 = sum; + sum = (x_497 + x_496); + int const x_499 = r; + float const x_501 = m33[0][x_499]; + float const x_502 = sum; + sum = (x_502 + x_501); + int const x_504 = r; + float const x_506 = m34[0][x_504]; + float const x_507 = sum; + sum = (x_507 + x_506); + int const x_509 = r; + float const x_511 = m42[0][x_509]; + float const x_512 = sum; + sum = (x_512 + x_511); + int const x_514 = r; + float const x_516 = m43[0][x_514]; + float const x_517 = sum; + sum = (x_517 + x_516); + int const x_519 = r; + float const x_521 = m44[0][x_519]; + float const x_522 = sum; + sum = (x_522 + x_521); + { + int const x_524 = r; + r = (x_524 + 1); + } + } + float const x_526 = sum; + if ((x_526 == 8.0f)) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..eb0445442e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.spvasm @@ -0,0 +1,1187 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 636 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m23 "m23" + OpName %m24 "m24" + OpName %m32 "m32" + OpName %m33 "m33" + OpName %m34 "m34" + OpName %m42 "m42" + OpName %m43 "m43" + OpName %m44 "m44" + OpName %i "i" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %i_3 "i_3" + OpName %i_4 "i_4" + OpName %i_5 "i_5" + OpName %i_6 "i_6" + OpName %i_7 "i_7" + OpName %i_8 "i_8" + OpName %i_9 "i_9" + OpName %i_10 "i_10" + OpName %i_11 "i_11" + OpName %i_12 "i_12" + OpName %i_13 "i_13" + OpName %i_14 "i_14" + OpName %i_15 "i_15" + OpName %i_16 "i_16" + OpName %i_17 "i_17" + OpName %i_18 "i_18" + OpName %i_19 "i_19" + OpName %i_20 "i_20" + OpName %i_21 "i_21" + OpName %i_22 "i_22" + OpName %i_23 "i_23" + OpName %i_24 "i_24" + OpName %i_25 "i_25" + OpName %i_26 "i_26" + OpName %i_27 "i_27" + OpName %i_28 "i_28" + OpName %i_29 "i_29" + OpName %i_30 "i_30" + OpName %i_31 "i_31" + OpName %i_32 "i_32" + OpName %i_33 "i_33" + OpName %i_34 "i_34" + OpName %i_35 "i_35" + OpName %i_36 "i_36" + OpName %i_37 "i_37" + OpName %sum "sum" + OpName %r "r" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %20 = OpConstantNull %mat2v3float +%mat2v4float = OpTypeMatrix %v4float 2 +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float + %24 = OpConstantNull %mat2v4float + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float + %29 = OpConstantNull %mat3v2float +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %33 = OpConstantNull %mat3v3float +%mat3v4float = OpTypeMatrix %v4float 3 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %37 = OpConstantNull %mat3v4float +%mat4v2float = OpTypeMatrix %v2float 4 +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float + %41 = OpConstantNull %mat4v2float +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %45 = OpConstantNull %mat4v3float +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %49 = OpConstantNull %mat4v4float +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_float = OpTypePointer Function %float + %91 = OpConstantNull %float + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %95 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %96 = OpConstantComposite %mat2v3float %95 %95 + %97 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %98 = OpConstantComposite %mat2v4float %97 %97 + %99 = OpConstantComposite %v2float %float_0 %float_0 + %100 = OpConstantComposite %mat3v2float %99 %99 %99 + %101 = OpConstantComposite %mat3v3float %95 %95 %95 + %102 = OpConstantComposite %mat3v4float %97 %97 %97 + %103 = OpConstantComposite %mat4v2float %99 %99 %99 %99 + %104 = OpConstantComposite %mat4v3float %95 %95 %95 %95 + %105 = OpConstantComposite %mat4v4float %97 %97 %97 %97 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_98 = OpConstant %int 98 + %float_1 = OpConstant %float 1 + %int_100 = OpConstant %int 100 + %float_8 = OpConstant %float 8 + %623 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %624 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %m23 = OpVariable %_ptr_Function_mat2v3float Function %20 + %m24 = OpVariable %_ptr_Function_mat2v4float Function %24 + %m32 = OpVariable %_ptr_Function_mat3v2float Function %29 + %m33 = OpVariable %_ptr_Function_mat3v3float Function %33 + %m34 = OpVariable %_ptr_Function_mat3v4float Function %37 + %m42 = OpVariable %_ptr_Function_mat4v2float Function %41 + %m43 = OpVariable %_ptr_Function_mat4v3float Function %45 + %m44 = OpVariable %_ptr_Function_mat4v4float Function %49 + %i = OpVariable %_ptr_Function_int Function %4 + %i_1 = OpVariable %_ptr_Function_int Function %4 + %i_2 = OpVariable %_ptr_Function_int Function %4 + %i_3 = OpVariable %_ptr_Function_int Function %4 + %i_4 = OpVariable %_ptr_Function_int Function %4 + %i_5 = OpVariable %_ptr_Function_int Function %4 + %i_6 = OpVariable %_ptr_Function_int Function %4 + %i_7 = OpVariable %_ptr_Function_int Function %4 + %i_8 = OpVariable %_ptr_Function_int Function %4 + %i_9 = OpVariable %_ptr_Function_int Function %4 + %i_10 = OpVariable %_ptr_Function_int Function %4 + %i_11 = OpVariable %_ptr_Function_int Function %4 + %i_12 = OpVariable %_ptr_Function_int Function %4 + %i_13 = OpVariable %_ptr_Function_int Function %4 + %i_14 = OpVariable %_ptr_Function_int Function %4 + %i_15 = OpVariable %_ptr_Function_int Function %4 + %i_16 = OpVariable %_ptr_Function_int Function %4 + %i_17 = OpVariable %_ptr_Function_int Function %4 + %i_18 = OpVariable %_ptr_Function_int Function %4 + %i_19 = OpVariable %_ptr_Function_int Function %4 + %i_20 = OpVariable %_ptr_Function_int Function %4 + %i_21 = OpVariable %_ptr_Function_int Function %4 + %i_22 = OpVariable %_ptr_Function_int Function %4 + %i_23 = OpVariable %_ptr_Function_int Function %4 + %i_24 = OpVariable %_ptr_Function_int Function %4 + %i_25 = OpVariable %_ptr_Function_int Function %4 + %i_26 = OpVariable %_ptr_Function_int Function %4 + %i_27 = OpVariable %_ptr_Function_int Function %4 + %i_28 = OpVariable %_ptr_Function_int Function %4 + %i_29 = OpVariable %_ptr_Function_int Function %4 + %i_30 = OpVariable %_ptr_Function_int Function %4 + %i_31 = OpVariable %_ptr_Function_int Function %4 + %i_32 = OpVariable %_ptr_Function_int Function %4 + %i_33 = OpVariable %_ptr_Function_int Function %4 + %i_34 = OpVariable %_ptr_Function_int Function %4 + %i_35 = OpVariable %_ptr_Function_int Function %4 + %i_36 = OpVariable %_ptr_Function_int Function %4 + %i_37 = OpVariable %_ptr_Function_int Function %4 + %sum = OpVariable %_ptr_Function_float Function %91 + %r = OpVariable %_ptr_Function_int Function %4 + OpStore %x_GLF_global_loop_count %int_0 + OpStore %m23 %96 + OpStore %m24 %98 + OpStore %m32 %100 + OpStore %m33 %101 + OpStore %m34 %102 + OpStore %m42 %103 + OpStore %m43 %104 + OpStore %m44 %105 + OpStore %i %int_0 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %110 = OpLoad %int %i + %112 = OpSLessThan %bool %110 %int_1 + OpSelectionMerge %114 None + OpBranchConditional %112 %115 %116 + %115 = OpLabel + OpBranch %114 + %116 = OpLabel + OpBranch %107 + %114 = OpLabel + OpStore %i_1 %int_0 + OpBranch %117 + %117 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %121 = OpLoad %int %i_1 + %122 = OpSLessThan %bool %121 %int_1 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %125 + %124 = OpLabel + OpBranch %123 + %125 = OpLabel + OpBranch %118 + %123 = OpLabel + OpStore %i_2 %int_0 + OpBranch %126 + %126 = OpLabel + OpLoopMerge %127 %128 None + OpBranch %129 + %129 = OpLabel + %130 = OpLoad %int %i_2 + %131 = OpSLessThan %bool %130 %int_1 + OpSelectionMerge %132 None + OpBranchConditional %131 %133 %134 + %133 = OpLabel + OpBranch %132 + %134 = OpLabel + OpBranch %127 + %132 = OpLabel + OpStore %i_3 %int_0 + OpBranch %135 + %135 = OpLabel + OpLoopMerge %136 %137 None + OpBranch %138 + %138 = OpLabel + %139 = OpLoad %int %i_3 + %140 = OpSLessThan %bool %139 %int_1 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %143 + %142 = OpLabel + OpBranch %141 + %143 = OpLabel + OpBranch %136 + %141 = OpLabel + OpStore %i_4 %int_0 + OpBranch %144 + %144 = OpLabel + OpLoopMerge %145 %146 None + OpBranch %147 + %147 = OpLabel + %148 = OpLoad %int %i_4 + %149 = OpSLessThan %bool %148 %int_1 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %152 + %151 = OpLabel + OpBranch %150 + %152 = OpLabel + OpBranch %145 + %150 = OpLabel + OpStore %i_5 %int_0 + OpBranch %153 + %153 = OpLabel + OpLoopMerge %154 %155 None + OpBranch %156 + %156 = OpLabel + %157 = OpLoad %int %i_5 + %158 = OpSLessThan %bool %157 %int_1 + OpSelectionMerge %159 None + OpBranchConditional %158 %160 %161 + %160 = OpLabel + OpBranch %159 + %161 = OpLabel + OpBranch %154 + %159 = OpLabel + OpStore %i_6 %int_0 + OpBranch %162 + %162 = OpLabel + OpLoopMerge %163 %164 None + OpBranch %165 + %165 = OpLabel + %166 = OpLoad %int %i_6 + %167 = OpSLessThan %bool %166 %int_1 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %163 + %168 = OpLabel + OpStore %i_7 %int_0 + OpBranch %171 + %171 = OpLabel + OpLoopMerge %172 %173 None + OpBranch %174 + %174 = OpLabel + %175 = OpLoad %int %i_7 + %176 = OpSLessThan %bool %175 %int_1 + OpSelectionMerge %177 None + OpBranchConditional %176 %178 %179 + %178 = OpLabel + OpBranch %177 + %179 = OpLabel + OpBranch %172 + %177 = OpLabel + OpStore %i_8 %int_0 + OpBranch %180 + %180 = OpLabel + OpLoopMerge %181 %182 None + OpBranch %183 + %183 = OpLabel + %184 = OpLoad %int %i_8 + %185 = OpSLessThan %bool %184 %int_1 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + OpBranch %186 + %188 = OpLabel + OpBranch %181 + %186 = OpLabel + OpStore %i_9 %int_0 + OpBranch %189 + %189 = OpLabel + OpLoopMerge %190 %191 None + OpBranch %192 + %192 = OpLabel + %193 = OpLoad %int %i_9 + %194 = OpSLessThan %bool %193 %int_1 + OpSelectionMerge %195 None + OpBranchConditional %194 %196 %197 + %196 = OpLabel + OpBranch %195 + %197 = OpLabel + OpBranch %190 + %195 = OpLabel + OpStore %i_10 %int_0 + OpBranch %198 + %198 = OpLabel + OpLoopMerge %199 %200 None + OpBranch %201 + %201 = OpLabel + %202 = OpLoad %int %i_10 + %203 = OpSLessThan %bool %202 %int_1 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %206 + %205 = OpLabel + OpBranch %204 + %206 = OpLabel + OpBranch %199 + %204 = OpLabel + OpStore %i_11 %int_0 + OpBranch %207 + %207 = OpLabel + OpLoopMerge %208 %209 None + OpBranch %210 + %210 = OpLabel + %211 = OpLoad %int %i_11 + %212 = OpSLessThan %bool %211 %int_1 + OpSelectionMerge %213 None + OpBranchConditional %212 %214 %215 + %214 = OpLabel + OpBranch %213 + %215 = OpLabel + OpBranch %208 + %213 = OpLabel + OpStore %i_12 %int_0 + OpBranch %216 + %216 = OpLabel + OpLoopMerge %217 %218 None + OpBranch %219 + %219 = OpLabel + %220 = OpLoad %int %i_12 + %221 = OpSLessThan %bool %220 %int_1 + OpSelectionMerge %222 None + OpBranchConditional %221 %223 %224 + %223 = OpLabel + OpBranch %222 + %224 = OpLabel + OpBranch %217 + %222 = OpLabel + OpStore %i_13 %int_0 + OpBranch %225 + %225 = OpLabel + OpLoopMerge %226 %227 None + OpBranch %228 + %228 = OpLabel + %229 = OpLoad %int %i_13 + %230 = OpSLessThan %bool %229 %int_1 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %233 + %232 = OpLabel + OpBranch %231 + %233 = OpLabel + OpBranch %226 + %231 = OpLabel + OpStore %i_14 %int_0 + OpBranch %234 + %234 = OpLabel + OpLoopMerge %235 %236 None + OpBranch %237 + %237 = OpLabel + %238 = OpLoad %int %i_14 + %239 = OpSLessThan %bool %238 %int_1 + OpSelectionMerge %240 None + OpBranchConditional %239 %241 %242 + %241 = OpLabel + OpBranch %240 + %242 = OpLabel + OpBranch %235 + %240 = OpLabel + OpStore %i_15 %int_0 + OpBranch %243 + %243 = OpLabel + OpLoopMerge %244 %245 None + OpBranch %246 + %246 = OpLabel + %247 = OpLoad %int %i_15 + %248 = OpSLessThan %bool %247 %int_1 + OpSelectionMerge %249 None + OpBranchConditional %248 %250 %251 + %250 = OpLabel + OpBranch %249 + %251 = OpLabel + OpBranch %244 + %249 = OpLabel + OpStore %i_16 %int_0 + OpBranch %252 + %252 = OpLabel + OpLoopMerge %253 %254 None + OpBranch %255 + %255 = OpLabel + %256 = OpLoad %int %i_16 + %257 = OpSLessThan %bool %256 %int_1 + OpSelectionMerge %258 None + OpBranchConditional %257 %259 %260 + %259 = OpLabel + OpBranch %258 + %260 = OpLabel + OpBranch %253 + %258 = OpLabel + OpStore %i_17 %int_0 + OpBranch %261 + %261 = OpLabel + OpLoopMerge %262 %263 None + OpBranch %264 + %264 = OpLabel + %265 = OpLoad %int %i_17 + %266 = OpSLessThan %bool %265 %int_1 + OpSelectionMerge %267 None + OpBranchConditional %266 %268 %269 + %268 = OpLabel + OpBranch %267 + %269 = OpLabel + OpBranch %262 + %267 = OpLabel + OpStore %i_18 %int_0 + OpBranch %270 + %270 = OpLabel + OpLoopMerge %271 %272 None + OpBranch %273 + %273 = OpLabel + %274 = OpLoad %int %i_18 + %275 = OpSLessThan %bool %274 %int_1 + OpSelectionMerge %276 None + OpBranchConditional %275 %277 %278 + %277 = OpLabel + OpBranch %276 + %278 = OpLabel + OpBranch %271 + %276 = OpLabel + OpStore %i_19 %int_0 + OpBranch %279 + %279 = OpLabel + OpLoopMerge %280 %281 None + OpBranch %282 + %282 = OpLabel + %283 = OpLoad %int %i_19 + %284 = OpSLessThan %bool %283 %int_1 + OpSelectionMerge %285 None + OpBranchConditional %284 %286 %287 + %286 = OpLabel + OpBranch %285 + %287 = OpLabel + OpBranch %280 + %285 = OpLabel + OpStore %i_20 %int_0 + OpBranch %288 + %288 = OpLabel + OpLoopMerge %289 %290 None + OpBranch %291 + %291 = OpLabel + %292 = OpLoad %int %i_20 + %293 = OpSLessThan %bool %292 %int_1 + OpSelectionMerge %294 None + OpBranchConditional %293 %295 %296 + %295 = OpLabel + OpBranch %294 + %296 = OpLabel + OpBranch %289 + %294 = OpLabel + OpStore %i_21 %int_0 + OpBranch %297 + %297 = OpLabel + OpLoopMerge %298 %299 None + OpBranch %300 + %300 = OpLabel + %301 = OpLoad %int %i_21 + %302 = OpSLessThan %bool %301 %int_1 + OpSelectionMerge %303 None + OpBranchConditional %302 %304 %305 + %304 = OpLabel + OpBranch %303 + %305 = OpLabel + OpBranch %298 + %303 = OpLabel + OpStore %i_22 %int_0 + OpBranch %306 + %306 = OpLabel + OpLoopMerge %307 %308 None + OpBranch %309 + %309 = OpLabel + %310 = OpLoad %int %i_22 + %311 = OpSLessThan %bool %310 %int_1 + OpSelectionMerge %312 None + OpBranchConditional %311 %313 %314 + %313 = OpLabel + OpBranch %312 + %314 = OpLabel + OpBranch %307 + %312 = OpLabel + OpStore %i_23 %int_0 + OpBranch %315 + %315 = OpLabel + OpLoopMerge %316 %317 None + OpBranch %318 + %318 = OpLabel + %319 = OpLoad %int %i_23 + %320 = OpSLessThan %bool %319 %int_1 + OpSelectionMerge %321 None + OpBranchConditional %320 %322 %323 + %322 = OpLabel + OpBranch %321 + %323 = OpLabel + OpBranch %316 + %321 = OpLabel + OpStore %i_24 %int_0 + OpBranch %324 + %324 = OpLabel + OpLoopMerge %325 %326 None + OpBranch %327 + %327 = OpLabel + %328 = OpLoad %int %i_24 + %329 = OpSLessThan %bool %328 %int_1 + OpSelectionMerge %330 None + OpBranchConditional %329 %331 %332 + %331 = OpLabel + OpBranch %330 + %332 = OpLabel + OpBranch %325 + %330 = OpLabel + OpStore %i_25 %int_0 + OpBranch %333 + %333 = OpLabel + OpLoopMerge %334 %335 None + OpBranch %336 + %336 = OpLabel + %337 = OpLoad %int %i_25 + %338 = OpSLessThan %bool %337 %int_1 + OpSelectionMerge %339 None + OpBranchConditional %338 %340 %341 + %340 = OpLabel + OpBranch %339 + %341 = OpLabel + OpBranch %334 + %339 = OpLabel + OpStore %i_26 %int_0 + OpBranch %342 + %342 = OpLabel + OpLoopMerge %343 %344 None + OpBranch %345 + %345 = OpLabel + %346 = OpLoad %int %i_26 + %347 = OpSLessThan %bool %346 %int_1 + OpSelectionMerge %348 None + OpBranchConditional %347 %349 %350 + %349 = OpLabel + OpBranch %348 + %350 = OpLabel + OpBranch %343 + %348 = OpLabel + OpStore %i_27 %int_0 + OpBranch %351 + %351 = OpLabel + OpLoopMerge %352 %353 None + OpBranch %354 + %354 = OpLabel + %355 = OpLoad %int %i_27 + %356 = OpSLessThan %bool %355 %int_1 + OpSelectionMerge %357 None + OpBranchConditional %356 %358 %359 + %358 = OpLabel + OpBranch %357 + %359 = OpLabel + OpBranch %352 + %357 = OpLabel + OpStore %i_28 %int_0 + OpBranch %360 + %360 = OpLabel + OpLoopMerge %361 %362 None + OpBranch %363 + %363 = OpLabel + %364 = OpLoad %int %i_28 + %365 = OpSLessThan %bool %364 %int_1 + OpSelectionMerge %366 None + OpBranchConditional %365 %367 %368 + %367 = OpLabel + OpBranch %366 + %368 = OpLabel + OpBranch %361 + %366 = OpLabel + OpStore %i_29 %int_0 + OpBranch %369 + %369 = OpLabel + OpLoopMerge %370 %371 None + OpBranch %372 + %372 = OpLabel + %373 = OpLoad %int %i_29 + %374 = OpSLessThan %bool %373 %int_1 + OpSelectionMerge %375 None + OpBranchConditional %374 %376 %377 + %376 = OpLabel + OpBranch %375 + %377 = OpLabel + OpBranch %370 + %375 = OpLabel + OpStore %i_30 %int_0 + OpBranch %378 + %378 = OpLabel + OpLoopMerge %379 %380 None + OpBranch %381 + %381 = OpLabel + %382 = OpLoad %int %i_30 + %383 = OpSLessThan %bool %382 %int_1 + OpSelectionMerge %384 None + OpBranchConditional %383 %385 %386 + %385 = OpLabel + OpBranch %384 + %386 = OpLabel + OpBranch %379 + %384 = OpLabel + OpStore %i_31 %int_0 + OpBranch %387 + %387 = OpLabel + OpLoopMerge %388 %389 None + OpBranch %390 + %390 = OpLabel + %391 = OpLoad %int %i_31 + %392 = OpSLessThan %bool %391 %int_1 + OpSelectionMerge %393 None + OpBranchConditional %392 %394 %395 + %394 = OpLabel + OpBranch %393 + %395 = OpLabel + OpBranch %388 + %393 = OpLabel + OpStore %i_32 %int_0 + OpBranch %396 + %396 = OpLabel + OpLoopMerge %397 %398 None + OpBranch %399 + %399 = OpLabel + %400 = OpLoad %int %i_32 + %401 = OpSLessThan %bool %400 %int_1 + OpSelectionMerge %402 None + OpBranchConditional %401 %403 %404 + %403 = OpLabel + OpBranch %402 + %404 = OpLabel + OpBranch %397 + %402 = OpLabel + OpStore %i_33 %int_0 + OpBranch %405 + %405 = OpLabel + OpLoopMerge %406 %407 None + OpBranch %408 + %408 = OpLabel + %409 = OpLoad %int %i_33 + %410 = OpSLessThan %bool %409 %int_1 + OpSelectionMerge %411 None + OpBranchConditional %410 %412 %413 + %412 = OpLabel + OpBranch %411 + %413 = OpLabel + OpBranch %406 + %411 = OpLabel + OpStore %i_34 %int_0 + OpBranch %414 + %414 = OpLabel + OpLoopMerge %415 %416 None + OpBranch %417 + %417 = OpLabel + %418 = OpLoad %int %i_34 + %419 = OpSLessThan %bool %418 %int_1 + OpSelectionMerge %420 None + OpBranchConditional %419 %421 %422 + %421 = OpLabel + OpBranch %420 + %422 = OpLabel + OpBranch %415 + %420 = OpLabel + OpStore %i_35 %int_0 + OpBranch %423 + %423 = OpLabel + OpLoopMerge %424 %425 None + OpBranch %426 + %426 = OpLabel + %427 = OpLoad %int %i_35 + %428 = OpSLessThan %bool %427 %int_1 + OpSelectionMerge %429 None + OpBranchConditional %428 %430 %431 + %430 = OpLabel + OpBranch %429 + %431 = OpLabel + OpBranch %424 + %429 = OpLabel + OpStore %i_36 %int_0 + OpBranch %432 + %432 = OpLabel + OpLoopMerge %433 %434 None + OpBranch %435 + %435 = OpLabel + %436 = OpLoad %int %i_36 + %437 = OpSLessThan %bool %436 %int_1 + OpSelectionMerge %438 None + OpBranchConditional %437 %439 %440 + %439 = OpLabel + OpBranch %438 + %440 = OpLabel + OpBranch %433 + %438 = OpLabel + OpStore %i_37 %int_0 + OpBranch %441 + %441 = OpLabel + OpLoopMerge %442 %443 None + OpBranch %444 + %444 = OpLabel + %445 = OpLoad %int %i_37 + %446 = OpSLessThan %bool %445 %int_1 + OpSelectionMerge %447 None + OpBranchConditional %446 %448 %449 + %448 = OpLabel + OpBranch %447 + %449 = OpLabel + OpBranch %442 + %447 = OpLabel + OpBranch %450 + %450 = OpLabel + OpLoopMerge %451 %452 None + OpBranch %453 + %453 = OpLabel + %454 = OpLoad %int %x_GLF_global_loop_count + %455 = OpIAdd %int %454 %int_1 + OpStore %x_GLF_global_loop_count %455 + OpBranch %452 + %452 = OpLabel + %456 = OpLoad %int %x_GLF_global_loop_count + %458 = OpSLessThan %bool %456 %int_98 + OpSelectionMerge %459 None + OpBranchConditional %458 %460 %461 + %460 = OpLabel + OpBranch %459 + %461 = OpLabel + OpBranch %451 + %459 = OpLabel + OpBranch %450 + %451 = OpLabel + %462 = OpLoad %int %i_37 + %463 = OpLoad %int %i_37 + %464 = OpAccessChain %_ptr_Function_float %m23 %462 %463 + OpStore %464 %float_1 + %466 = OpLoad %int %i_37 + %467 = OpLoad %int %i_37 + %468 = OpAccessChain %_ptr_Function_float %m24 %466 %467 + OpStore %468 %float_1 + %469 = OpLoad %int %i_37 + %470 = OpLoad %int %i_37 + %471 = OpAccessChain %_ptr_Function_float %m32 %469 %470 + OpStore %471 %float_1 + %472 = OpLoad %int %i_37 + %473 = OpLoad %int %i_37 + %474 = OpAccessChain %_ptr_Function_float %m33 %472 %473 + OpStore %474 %float_1 + %475 = OpLoad %int %i_37 + %476 = OpLoad %int %i_37 + %477 = OpAccessChain %_ptr_Function_float %m34 %475 %476 + OpStore %477 %float_1 + %478 = OpLoad %int %i_37 + %479 = OpLoad %int %i_37 + %480 = OpAccessChain %_ptr_Function_float %m42 %478 %479 + OpStore %480 %float_1 + %481 = OpLoad %int %i_37 + %482 = OpLoad %int %i_37 + %483 = OpAccessChain %_ptr_Function_float %m43 %481 %482 + OpStore %483 %float_1 + %484 = OpLoad %int %i_37 + %485 = OpLoad %int %i_37 + %486 = OpAccessChain %_ptr_Function_float %m44 %484 %485 + OpStore %486 %float_1 + OpBranch %443 + %443 = OpLabel + %487 = OpLoad %int %i_37 + %488 = OpIAdd %int %487 %int_1 + OpStore %i_37 %488 + OpBranch %441 + %442 = OpLabel + OpBranch %434 + %434 = OpLabel + %489 = OpLoad %int %i_36 + %490 = OpIAdd %int %489 %int_1 + OpStore %i_36 %490 + OpBranch %432 + %433 = OpLabel + OpBranch %425 + %425 = OpLabel + %491 = OpLoad %int %i_35 + %492 = OpIAdd %int %491 %int_1 + OpStore %i_35 %492 + OpBranch %423 + %424 = OpLabel + OpBranch %416 + %416 = OpLabel + %493 = OpLoad %int %i_34 + %494 = OpIAdd %int %493 %int_1 + OpStore %i_34 %494 + OpBranch %414 + %415 = OpLabel + OpBranch %407 + %407 = OpLabel + %495 = OpLoad %int %i_33 + %496 = OpIAdd %int %495 %int_1 + OpStore %i_33 %496 + OpBranch %405 + %406 = OpLabel + OpBranch %398 + %398 = OpLabel + %497 = OpLoad %int %i_32 + %498 = OpIAdd %int %497 %int_1 + OpStore %i_32 %498 + OpBranch %396 + %397 = OpLabel + OpBranch %389 + %389 = OpLabel + %499 = OpLoad %int %i_31 + %500 = OpIAdd %int %499 %int_1 + OpStore %i_31 %500 + OpBranch %387 + %388 = OpLabel + OpBranch %380 + %380 = OpLabel + %501 = OpLoad %int %i_30 + %502 = OpIAdd %int %501 %int_1 + OpStore %i_30 %502 + OpBranch %378 + %379 = OpLabel + OpBranch %371 + %371 = OpLabel + %503 = OpLoad %int %i_29 + %504 = OpIAdd %int %503 %int_1 + OpStore %i_29 %504 + OpBranch %369 + %370 = OpLabel + OpBranch %362 + %362 = OpLabel + %505 = OpLoad %int %i_28 + %506 = OpIAdd %int %505 %int_1 + OpStore %i_28 %506 + OpBranch %360 + %361 = OpLabel + OpBranch %353 + %353 = OpLabel + %507 = OpLoad %int %i_27 + %508 = OpIAdd %int %507 %int_1 + OpStore %i_27 %508 + OpBranch %351 + %352 = OpLabel + OpBranch %344 + %344 = OpLabel + %509 = OpLoad %int %i_26 + %510 = OpIAdd %int %509 %int_1 + OpStore %i_26 %510 + OpBranch %342 + %343 = OpLabel + OpBranch %335 + %335 = OpLabel + %511 = OpLoad %int %i_25 + %512 = OpIAdd %int %511 %int_1 + OpStore %i_25 %512 + OpBranch %333 + %334 = OpLabel + OpBranch %326 + %326 = OpLabel + %513 = OpLoad %int %i_24 + %514 = OpIAdd %int %513 %int_1 + OpStore %i_24 %514 + OpBranch %324 + %325 = OpLabel + OpBranch %317 + %317 = OpLabel + %515 = OpLoad %int %i_23 + %516 = OpIAdd %int %515 %int_1 + OpStore %i_23 %516 + OpBranch %315 + %316 = OpLabel + OpBranch %308 + %308 = OpLabel + %517 = OpLoad %int %i_22 + %518 = OpIAdd %int %517 %int_1 + OpStore %i_22 %518 + OpBranch %306 + %307 = OpLabel + OpBranch %299 + %299 = OpLabel + %519 = OpLoad %int %i_21 + %520 = OpIAdd %int %519 %int_1 + OpStore %i_21 %520 + OpBranch %297 + %298 = OpLabel + OpBranch %290 + %290 = OpLabel + %521 = OpLoad %int %i_20 + %522 = OpIAdd %int %521 %int_1 + OpStore %i_20 %522 + OpBranch %288 + %289 = OpLabel + OpBranch %281 + %281 = OpLabel + %523 = OpLoad %int %i_19 + %524 = OpIAdd %int %523 %int_1 + OpStore %i_19 %524 + OpBranch %279 + %280 = OpLabel + OpBranch %272 + %272 = OpLabel + %525 = OpLoad %int %i_18 + %526 = OpIAdd %int %525 %int_1 + OpStore %i_18 %526 + OpBranch %270 + %271 = OpLabel + OpBranch %263 + %263 = OpLabel + %527 = OpLoad %int %i_17 + %528 = OpIAdd %int %527 %int_1 + OpStore %i_17 %528 + OpBranch %261 + %262 = OpLabel + OpBranch %254 + %254 = OpLabel + %529 = OpLoad %int %i_16 + %530 = OpIAdd %int %529 %int_1 + OpStore %i_16 %530 + OpBranch %252 + %253 = OpLabel + OpBranch %245 + %245 = OpLabel + %531 = OpLoad %int %i_15 + %532 = OpIAdd %int %531 %int_1 + OpStore %i_15 %532 + OpBranch %243 + %244 = OpLabel + OpBranch %236 + %236 = OpLabel + %533 = OpLoad %int %i_14 + %534 = OpIAdd %int %533 %int_1 + OpStore %i_14 %534 + OpBranch %234 + %235 = OpLabel + OpBranch %227 + %227 = OpLabel + %535 = OpLoad %int %i_13 + %536 = OpIAdd %int %535 %int_1 + OpStore %i_13 %536 + OpBranch %225 + %226 = OpLabel + OpBranch %218 + %218 = OpLabel + %537 = OpLoad %int %i_12 + %538 = OpIAdd %int %537 %int_1 + OpStore %i_12 %538 + OpBranch %216 + %217 = OpLabel + OpBranch %209 + %209 = OpLabel + %539 = OpLoad %int %i_11 + %540 = OpIAdd %int %539 %int_1 + OpStore %i_11 %540 + OpBranch %207 + %208 = OpLabel + OpBranch %200 + %200 = OpLabel + %541 = OpLoad %int %i_10 + %542 = OpIAdd %int %541 %int_1 + OpStore %i_10 %542 + OpBranch %198 + %199 = OpLabel + OpBranch %191 + %191 = OpLabel + %543 = OpLoad %int %i_9 + %544 = OpIAdd %int %543 %int_1 + OpStore %i_9 %544 + OpBranch %189 + %190 = OpLabel + OpBranch %182 + %182 = OpLabel + %545 = OpLoad %int %i_8 + %546 = OpIAdd %int %545 %int_1 + OpStore %i_8 %546 + OpBranch %180 + %181 = OpLabel + OpBranch %173 + %173 = OpLabel + %547 = OpLoad %int %i_7 + %548 = OpIAdd %int %547 %int_1 + OpStore %i_7 %548 + OpBranch %171 + %172 = OpLabel + OpBranch %164 + %164 = OpLabel + %549 = OpLoad %int %i_6 + %550 = OpIAdd %int %549 %int_1 + OpStore %i_6 %550 + OpBranch %162 + %163 = OpLabel + OpBranch %155 + %155 = OpLabel + %551 = OpLoad %int %i_5 + %552 = OpIAdd %int %551 %int_1 + OpStore %i_5 %552 + OpBranch %153 + %154 = OpLabel + OpBranch %146 + %146 = OpLabel + %553 = OpLoad %int %i_4 + %554 = OpIAdd %int %553 %int_1 + OpStore %i_4 %554 + OpBranch %144 + %145 = OpLabel + OpBranch %137 + %137 = OpLabel + %555 = OpLoad %int %i_3 + %556 = OpIAdd %int %555 %int_1 + OpStore %i_3 %556 + OpBranch %135 + %136 = OpLabel + OpBranch %128 + %128 = OpLabel + %557 = OpLoad %int %i_2 + %558 = OpIAdd %int %557 %int_1 + OpStore %i_2 %558 + OpBranch %126 + %127 = OpLabel + OpBranch %119 + %119 = OpLabel + %559 = OpLoad %int %i_1 + %560 = OpIAdd %int %559 %int_1 + OpStore %i_1 %560 + OpBranch %117 + %118 = OpLabel + OpBranch %108 + %108 = OpLabel + %561 = OpLoad %int %i + %562 = OpIAdd %int %561 %int_1 + OpStore %i %562 + OpBranch %106 + %107 = OpLabel + OpStore %sum %float_0 + OpStore %r %int_0 + OpBranch %563 + %563 = OpLabel + OpLoopMerge %564 %565 None + OpBranch %566 + %566 = OpLabel + %567 = OpLoad %int %x_GLF_global_loop_count + %569 = OpSLessThan %bool %567 %int_100 + OpSelectionMerge %570 None + OpBranchConditional %569 %571 %572 + %571 = OpLabel + OpBranch %570 + %572 = OpLabel + OpBranch %564 + %570 = OpLabel + %573 = OpLoad %int %x_GLF_global_loop_count + %574 = OpIAdd %int %573 %int_1 + OpStore %x_GLF_global_loop_count %574 + %575 = OpLoad %int %r + %576 = OpAccessChain %_ptr_Function_float %m23 %int_0 %575 + %577 = OpLoad %float %576 + %578 = OpLoad %float %sum + %579 = OpFAdd %float %578 %577 + OpStore %sum %579 + %580 = OpLoad %int %r + %581 = OpAccessChain %_ptr_Function_float %m24 %int_0 %580 + %582 = OpLoad %float %581 + %583 = OpLoad %float %sum + %584 = OpFAdd %float %583 %582 + OpStore %sum %584 + %585 = OpLoad %int %r + %586 = OpAccessChain %_ptr_Function_float %m32 %int_0 %585 + %587 = OpLoad %float %586 + %588 = OpLoad %float %sum + %589 = OpFAdd %float %588 %587 + OpStore %sum %589 + %590 = OpLoad %int %r + %591 = OpAccessChain %_ptr_Function_float %m33 %int_0 %590 + %592 = OpLoad %float %591 + %593 = OpLoad %float %sum + %594 = OpFAdd %float %593 %592 + OpStore %sum %594 + %595 = OpLoad %int %r + %596 = OpAccessChain %_ptr_Function_float %m34 %int_0 %595 + %597 = OpLoad %float %596 + %598 = OpLoad %float %sum + %599 = OpFAdd %float %598 %597 + OpStore %sum %599 + %600 = OpLoad %int %r + %601 = OpAccessChain %_ptr_Function_float %m42 %int_0 %600 + %602 = OpLoad %float %601 + %603 = OpLoad %float %sum + %604 = OpFAdd %float %603 %602 + OpStore %sum %604 + %605 = OpLoad %int %r + %606 = OpAccessChain %_ptr_Function_float %m43 %int_0 %605 + %607 = OpLoad %float %606 + %608 = OpLoad %float %sum + %609 = OpFAdd %float %608 %607 + OpStore %sum %609 + %610 = OpLoad %int %r + %611 = OpAccessChain %_ptr_Function_float %m44 %int_0 %610 + %612 = OpLoad %float %611 + %613 = OpLoad %float %sum + %614 = OpFAdd %float %613 %612 + OpStore %sum %614 + OpBranch %565 + %565 = OpLabel + %615 = OpLoad %int %r + %616 = OpIAdd %int %615 %int_1 + OpStore %r %616 + OpBranch %563 + %564 = OpLabel + %617 = OpLoad %float %sum + %619 = OpFOrdEqual %bool %617 %float_8 + OpSelectionMerge %620 None + OpBranchConditional %619 %621 %622 + %621 = OpLabel + OpStore %x_GLF_color %623 + OpBranch %620 + %622 = OpLabel + OpStore %x_GLF_color %97 + OpBranch %620 + %620 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %624 +%tint_symbol = OpFunctionParameter %main_out + %628 = OpLabel + %629 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %629 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %631 = OpLabel + %632 = OpFunctionCall %void %main_1 + %634 = OpLoad %v4float %x_GLF_color + %635 = OpCompositeConstruct %main_out %634 + %633 = OpFunctionCall %void %tint_symbol_2 %635 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 452[%452] is not post dominated by the back-edge block 459[%459] + %459 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..6dbe667a2a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.wgsl @@ -0,0 +1,659 @@ +var x_GLF_global_loop_count : i32; + +var x_GLF_color : vec4; + +fn main_1() { + var m23 : mat2x3; + var m24 : mat2x4; + var m32 : mat3x2; + var m33 : mat3x3; + var m34 : mat3x4; + var m42 : mat4x2; + var m43 : mat4x3; + var m44 : mat4x4; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var i_3 : i32; + var i_4 : i32; + var i_5 : i32; + var i_6 : i32; + var i_7 : i32; + var i_8 : i32; + var i_9 : i32; + var i_10 : i32; + var i_11 : i32; + var i_12 : i32; + var i_13 : i32; + var i_14 : i32; + var i_15 : i32; + var i_16 : i32; + var i_17 : i32; + var i_18 : i32; + var i_19 : i32; + var i_20 : i32; + var i_21 : i32; + var i_22 : i32; + var i_23 : i32; + var i_24 : i32; + var i_25 : i32; + var i_26 : i32; + var i_27 : i32; + var i_28 : i32; + var i_29 : i32; + var i_30 : i32; + var i_31 : i32; + var i_32 : i32; + var i_33 : i32; + var i_34 : i32; + var i_35 : i32; + var i_36 : i32; + var i_37 : i32; + var sum : f32; + var r : i32; + x_GLF_global_loop_count = 0; + m23 = mat2x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); + m24 = mat2x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + m32 = mat3x2(vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0)); + m33 = mat3x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); + m34 = mat3x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + m42 = mat4x2(vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0)); + m43 = mat4x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); + m44 = mat4x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + i = 0; + loop { + let x_105 : i32 = i; + if ((x_105 < 1)) { + } else { + break; + } + i_1 = 0; + loop { + let x_112 : i32 = i_1; + if ((x_112 < 1)) { + } else { + break; + } + i_2 = 0; + loop { + let x_119 : i32 = i_2; + if ((x_119 < 1)) { + } else { + break; + } + i_3 = 0; + loop { + let x_126 : i32 = i_3; + if ((x_126 < 1)) { + } else { + break; + } + i_4 = 0; + loop { + let x_133 : i32 = i_4; + if ((x_133 < 1)) { + } else { + break; + } + i_5 = 0; + loop { + let x_140 : i32 = i_5; + if ((x_140 < 1)) { + } else { + break; + } + i_6 = 0; + loop { + let x_147 : i32 = i_6; + if ((x_147 < 1)) { + } else { + break; + } + i_7 = 0; + loop { + let x_154 : i32 = i_7; + if ((x_154 < 1)) { + } else { + break; + } + i_8 = 0; + loop { + let x_161 : i32 = i_8; + if ((x_161 < 1)) { + } else { + break; + } + i_9 = 0; + loop { + let x_168 : i32 = i_9; + if ((x_168 < 1)) { + } else { + break; + } + i_10 = 0; + loop { + let x_175 : i32 = i_10; + if ((x_175 < 1)) { + } else { + break; + } + i_11 = 0; + loop { + let x_182 : i32 = i_11; + if ((x_182 < 1)) { + } else { + break; + } + i_12 = 0; + loop { + let x_189 : i32 = i_12; + if ((x_189 < 1)) { + } else { + break; + } + i_13 = 0; + loop { + let x_196 : i32 = i_13; + if ((x_196 < 1)) { + } else { + break; + } + i_14 = 0; + loop { + let x_203 : i32 = i_14; + if ((x_203 < 1)) { + } else { + break; + } + i_15 = 0; + loop { + let x_210 : i32 = i_15; + if ((x_210 < 1)) { + } else { + break; + } + i_16 = 0; + loop { + let x_217 : i32 = i_16; + if ((x_217 < 1)) { + } else { + break; + } + i_17 = 0; + loop { + let x_224 : i32 = i_17; + if ((x_224 < 1)) { + } else { + break; + } + i_18 = 0; + loop { + let x_231 : i32 = i_18; + if ((x_231 < 1)) { + } else { + break; + } + i_19 = 0; + loop { + let x_238 : i32 = i_19; + if ((x_238 < 1)) { + } else { + break; + } + i_20 = 0; + loop { + let x_245 : i32 = i_20; + if ((x_245 < 1)) { + } else { + break; + } + i_21 = 0; + loop { + let x_252 : i32 = i_21; + if ((x_252 < 1)) { + } else { + break; + } + i_22 = 0; + loop { + let x_259 : i32 = i_22; + if ((x_259 < 1)) { + } else { + break; + } + i_23 = 0; + loop { + let x_266 : i32 = i_23; + if ((x_266 < 1)) { + } else { + break; + } + i_24 = 0; + loop { + let x_273 : i32 = i_24; + if ((x_273 < 1)) { + } else { + break; + } + i_25 = 0; + loop { + let x_280 : i32 = i_25; + if ((x_280 < 1)) { + } else { + break; + } + i_26 = 0; + loop { + let x_287 : i32 = i_26; + if ((x_287 < 1)) { + } else { + break; + } + i_27 = 0; + loop { + let x_294 : i32 = i_27; + if ((x_294 < 1)) { + } else { + break; + } + i_28 = 0; + loop { + let x_301 : i32 = i_28; + if ((x_301 < 1)) { + } else { + break; + } + i_29 = 0; + loop { + let x_308 : i32 = i_29; + if ((x_308 < 1)) { + } else { + break; + } + i_30 = 0; + loop { + let x_315 : i32 = i_30; + if ((x_315 < 1)) { + } else { + break; + } + i_31 = 0; + loop { + let x_322 : i32 = i_31; + if ((x_322 < 1)) { + } else { + break; + } + i_32 = 0; + loop { + let x_329 : i32 = i_32; + if ((x_329 < 1)) { + } else { + break; + } + i_33 = 0; + loop { + let x_336 : i32 = i_33; + if ((x_336 < 1)) { + } else { + break; + } + i_34 = 0; + loop { + let x_343 : i32 = i_34; + if ((x_343 < 1)) { + } else { + break; + } + i_35 = 0; + loop { + let x_350 : i32 = i_35; + if ((x_350 < 1)) { + } else { + break; + } + i_36 = 0; + loop { + let x_357 : i32 = i_36; + if ((x_357 < 1)) { + } else { + break; + } + i_37 = 0; + loop { + let x_364 : i32 = i_37; + if ((x_364 < 1)) { + } else { + break; + } + loop { + let x_371 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_371 + 1); + + continuing { + let x_373 : i32 = x_GLF_global_loop_count; + if ((x_373 < 98)) { + } else { + break; + } + } + } + let x_375 : i32 = i_37; + let x_376 : i32 = i_37; + m23[x_375][x_376] = 1.0; + let x_378 : i32 = i_37; + let x_379 : i32 = i_37; + m24[x_378][x_379] = 1.0; + let x_381 : i32 = i_37; + let x_382 : i32 = i_37; + m32[x_381][x_382] = 1.0; + let x_384 : i32 = i_37; + let x_385 : i32 = i_37; + m33[x_384][x_385] = 1.0; + let x_387 : i32 = i_37; + let x_388 : i32 = i_37; + m34[x_387][x_388] = 1.0; + let x_390 : i32 = i_37; + let x_391 : i32 = i_37; + m42[x_390][x_391] = 1.0; + let x_393 : i32 = i_37; + let x_394 : i32 = i_37; + m43[x_393][x_394] = 1.0; + let x_396 : i32 = i_37; + let x_397 : i32 = i_37; + m44[x_396][x_397] = 1.0; + + continuing { + let x_399 : i32 = i_37; + i_37 = (x_399 + 1); + } + } + + continuing { + let x_401 : i32 = i_36; + i_36 = (x_401 + 1); + } + } + + continuing { + let x_403 : i32 = i_35; + i_35 = (x_403 + 1); + } + } + + continuing { + let x_405 : i32 = i_34; + i_34 = (x_405 + 1); + } + } + + continuing { + let x_407 : i32 = i_33; + i_33 = (x_407 + 1); + } + } + + continuing { + let x_409 : i32 = i_32; + i_32 = (x_409 + 1); + } + } + + continuing { + let x_411 : i32 = i_31; + i_31 = (x_411 + 1); + } + } + + continuing { + let x_413 : i32 = i_30; + i_30 = (x_413 + 1); + } + } + + continuing { + let x_415 : i32 = i_29; + i_29 = (x_415 + 1); + } + } + + continuing { + let x_417 : i32 = i_28; + i_28 = (x_417 + 1); + } + } + + continuing { + let x_419 : i32 = i_27; + i_27 = (x_419 + 1); + } + } + + continuing { + let x_421 : i32 = i_26; + i_26 = (x_421 + 1); + } + } + + continuing { + let x_423 : i32 = i_25; + i_25 = (x_423 + 1); + } + } + + continuing { + let x_425 : i32 = i_24; + i_24 = (x_425 + 1); + } + } + + continuing { + let x_427 : i32 = i_23; + i_23 = (x_427 + 1); + } + } + + continuing { + let x_429 : i32 = i_22; + i_22 = (x_429 + 1); + } + } + + continuing { + let x_431 : i32 = i_21; + i_21 = (x_431 + 1); + } + } + + continuing { + let x_433 : i32 = i_20; + i_20 = (x_433 + 1); + } + } + + continuing { + let x_435 : i32 = i_19; + i_19 = (x_435 + 1); + } + } + + continuing { + let x_437 : i32 = i_18; + i_18 = (x_437 + 1); + } + } + + continuing { + let x_439 : i32 = i_17; + i_17 = (x_439 + 1); + } + } + + continuing { + let x_441 : i32 = i_16; + i_16 = (x_441 + 1); + } + } + + continuing { + let x_443 : i32 = i_15; + i_15 = (x_443 + 1); + } + } + + continuing { + let x_445 : i32 = i_14; + i_14 = (x_445 + 1); + } + } + + continuing { + let x_447 : i32 = i_13; + i_13 = (x_447 + 1); + } + } + + continuing { + let x_449 : i32 = i_12; + i_12 = (x_449 + 1); + } + } + + continuing { + let x_451 : i32 = i_11; + i_11 = (x_451 + 1); + } + } + + continuing { + let x_453 : i32 = i_10; + i_10 = (x_453 + 1); + } + } + + continuing { + let x_455 : i32 = i_9; + i_9 = (x_455 + 1); + } + } + + continuing { + let x_457 : i32 = i_8; + i_8 = (x_457 + 1); + } + } + + continuing { + let x_459 : i32 = i_7; + i_7 = (x_459 + 1); + } + } + + continuing { + let x_461 : i32 = i_6; + i_6 = (x_461 + 1); + } + } + + continuing { + let x_463 : i32 = i_5; + i_5 = (x_463 + 1); + } + } + + continuing { + let x_465 : i32 = i_4; + i_4 = (x_465 + 1); + } + } + + continuing { + let x_467 : i32 = i_3; + i_3 = (x_467 + 1); + } + } + + continuing { + let x_469 : i32 = i_2; + i_2 = (x_469 + 1); + } + } + + continuing { + let x_471 : i32 = i_1; + i_1 = (x_471 + 1); + } + } + + continuing { + let x_473 : i32 = i; + i = (x_473 + 1); + } + } + sum = 0.0; + r = 0; + loop { + let x_479 : i32 = x_GLF_global_loop_count; + if ((x_479 < 100)) { + } else { + break; + } + let x_482 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_482 + 1); + let x_484 : i32 = r; + let x_486 : f32 = m23[0][x_484]; + let x_487 : f32 = sum; + sum = (x_487 + x_486); + let x_489 : i32 = r; + let x_491 : f32 = m24[0][x_489]; + let x_492 : f32 = sum; + sum = (x_492 + x_491); + let x_494 : i32 = r; + let x_496 : f32 = m32[0][x_494]; + let x_497 : f32 = sum; + sum = (x_497 + x_496); + let x_499 : i32 = r; + let x_501 : f32 = m33[0][x_499]; + let x_502 : f32 = sum; + sum = (x_502 + x_501); + let x_504 : i32 = r; + let x_506 : f32 = m34[0][x_504]; + let x_507 : f32 = sum; + sum = (x_507 + x_506); + let x_509 : i32 = r; + let x_511 : f32 = m42[0][x_509]; + let x_512 : f32 = sum; + sum = (x_512 + x_511); + let x_514 : i32 = r; + let x_516 : f32 = m43[0][x_514]; + let x_517 : f32 = sum; + sum = (x_517 + x_516); + let x_519 : i32 = r; + let x_521 : f32 = m44[0][x_519]; + let x_522 : f32 = sum; + sum = (x_522 + x_521); + + continuing { + let x_524 : i32 = r; + r = (x_524 + 1); + } + } + let x_526 : f32 = sum; + if ((x_526 == 8.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm new file mode 100644 index 0000000000..948060c9ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm @@ -0,0 +1,246 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %func0_i1_ "func0(i1;" + OpName %x "x" + OpName %func1_ "func1(" + OpName %m "m" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "one" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %i "i" + OpName %gl_FragCoord "gl_FragCoord" + OpName %param "param" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__1 "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 2 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %m = OpVariable %_ptr_Private_mat4v2float Private + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v2float %float_0 %float_0 + %30 = OpConstantComposite %mat4v2float %29 %29 %29 %29 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %_ = OpVariable %_ptr_Uniform_buf2 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Private_float = OpTypePointer Private %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__1 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float_1 = OpConstant %float 1 + %v2bool = OpTypeVector %bool 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %20 + %51 = OpLabel + OpStore %m %30 + %52 = OpFunctionCall %void %func1_ + %53 = OpFunctionCall %void %func1_ + %54 = OpLoad %mat4v2float %m + %55 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpConvertSToF %float %56 + %58 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %68 + %70 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %71 + %73 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpCompositeConstruct %v2float %57 %60 + %80 = OpCompositeConstruct %v2float %63 %66 + %81 = OpCompositeConstruct %v2float %69 %72 + %82 = OpCompositeConstruct %v2float %75 %78 + %83 = OpCompositeConstruct %mat4v2float %79 %80 %81 %82 + %84 = OpCompositeExtract %v2float %54 0 + %85 = OpCompositeExtract %v2float %83 0 + %86 = OpFOrdEqual %v2bool %84 %85 + %87 = OpAll %bool %86 + %88 = OpCompositeExtract %v2float %54 1 + %89 = OpCompositeExtract %v2float %83 1 + %90 = OpFOrdEqual %v2bool %88 %89 + %91 = OpAll %bool %90 + %92 = OpLogicalAnd %bool %87 %91 + %93 = OpCompositeExtract %v2float %54 2 + %94 = OpCompositeExtract %v2float %83 2 + %95 = OpFOrdEqual %v2bool %93 %94 + %96 = OpAll %bool %95 + %97 = OpLogicalAnd %bool %92 %96 + %98 = OpCompositeExtract %v2float %54 3 + %99 = OpCompositeExtract %v2float %83 3 + %100 = OpFOrdEqual %v2bool %98 %99 + %101 = OpAll %bool %100 + %102 = OpLogicalAnd %bool %97 %101 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_3 + %107 = OpLoad %int %106 + %108 = OpConvertSToF %float %107 + %109 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %110 = OpLoad %int %109 + %111 = OpConvertSToF %float %110 + %112 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %113 = OpLoad %int %112 + %114 = OpConvertSToF %float %113 + %115 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_3 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %116 + %118 = OpCompositeConstruct %v4float %108 %111 %114 %117 + OpStore %_GLF_color %118 + OpBranch %103 + %105 = OpLabel + %119 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %120 = OpLoad %int %119 + %121 = OpConvertSToF %float %120 + %122 = OpCompositeConstruct %v4float %121 %121 %121 %121 + OpStore %_GLF_color %122 + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd + %func0_i1_ = OpFunction %void None %23 + %x = OpFunctionParameter %_ptr_Function_int + %123 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %124 = OpLoad %int %x + %125 = OpSLessThan %bool %124 %int_1 + %126 = OpLogicalNot %bool %125 + OpSelectionMerge %127 None + OpBranchConditional %126 %128 %127 + %128 = OpLabel + %129 = OpLoad %int %x + %130 = OpSGreaterThan %bool %129 %int_1 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %131 + %132 = OpLabel + %133 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %134 = OpLoad %float %133 + %135 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %136 = OpLoad %float %135 + %137 = OpFOrdGreaterThan %bool %134 %136 + OpBranch %131 + %131 = OpLabel + %138 = OpPhi %bool %130 %128 %137 %132 + OpBranch %127 + %127 = OpLabel + %139 = OpPhi %bool %125 %123 %138 %131 + OpSelectionMerge %140 None + OpBranchConditional %139 %141 %140 + %141 = OpLabel + OpReturn + %140 = OpLabel + %142 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %143 = OpLoad %float %142 + %144 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %145 = OpLoad %float %144 + %146 = OpFOrdEqual %bool %143 %145 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %147 + %148 = OpLabel + OpStore %i %int_0 + OpBranch %149 + %149 = OpLabel + %150 = OpLoad %int %i + %151 = OpSLessThan %bool %150 %int_2 + OpLoopMerge %152 %153 None + OpBranchConditional %151 %153 %152 + %153 = OpLabel + %154 = OpLoad %int %x + %155 = OpExtInst %int %1 SClamp %154 %int_0 %int_3 + %156 = OpLoad %int %i + %157 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %158 = OpLoad %float %157 + %159 = OpAccessChain %_ptr_Private_float %m %155 %156 + %160 = OpLoad %float %159 + %161 = OpFAdd %float %160 %158 + %162 = OpAccessChain %_ptr_Private_float %m %155 %156 + OpStore %162 %161 + %163 = OpLoad %int %i + %164 = OpIAdd %int %163 %int_1 + OpStore %i %164 + OpBranch %149 + %152 = OpLabel + OpBranch %147 + %147 = OpLabel + OpReturn + OpFunctionEnd + %func1_ = OpFunction %void None %20 + %165 = OpLabel + %param = OpVariable %_ptr_Function_int Function + %166 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %167 = OpLoad %float %166 + %168 = OpFOrdLessThan %bool %167 %float_0 + OpSelectionMerge %169 None + OpBranchConditional %168 %170 %169 + %170 = OpLabel + OpReturn + %169 = OpLabel + OpStore %param %int_1 + %171 = OpFunctionCall %void %func0_i1_ %param + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2327dda6de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.hlsl @@ -0,0 +1,146 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +static float4x2 m = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b2, space0) { + uint4 x_10[1]; +}; +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_16 : register(b1, space0) { + uint4 x_16[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func0_i1_(inout int x) { + int i = 0; + bool x_137 = false; + bool x_138 = false; + bool x_138_phi = false; + bool x_139_phi = false; + const int x_124 = x; + const bool x_125 = (x_124 < 1); + x_139_phi = x_125; + if (!(x_125)) { + const int x_129 = x; + const bool x_130 = (x_129 > 1); + x_138_phi = x_130; + if (x_130) { + const float x_134 = asfloat(x_10[0].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_136 = asfloat(x_12[scalar_offset / 4][scalar_offset % 4]); + x_137 = (x_134 > x_136); + x_138_phi = x_137; + } + x_138 = x_138_phi; + x_139_phi = x_138; + } + if (x_139_phi) { + return; + } + const float x_143 = asfloat(x_10[0].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_145 = asfloat(x_12[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_143 == x_145)) { + i = 0; + while (true) { + if ((i < 2)) { + } else { + break; + } + { + const int x_154 = x; + const int x_155 = clamp(x_154, 0, 3); + const int x_156 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_158 = asfloat(x_12[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_160 = m[x_155][x_156]; + set_float2(m[x_155], x_156, (x_160 + x_158)); + i = (i + 1); + } + } + } + return; +} + +void func1_() { + int param = 0; + const float x_167 = gl_FragCoord.y; + if ((x_167 < 0.0f)) { + return; + } + param = 1; + func0_i1_(param); + return; +} + +void main_1() { + m = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + func1_(); + func1_(); + const float4x2 x_54 = m; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_16[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_16[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const int x_62 = asint(x_16[1].x); + const int x_65 = asint(x_16[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_68 = asint(x_16[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_71 = asint(x_16[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_16[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_77 = asint(x_16[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float4x2 x_83 = float4x2(float2(float(x_56), float(x_59)), float2(float(x_62), float(x_65)), float2(float(x_68), float(x_71)), float2(float(x_74), float(x_77))); + bool tint_tmp_2 = all((x_54[0u] == x_83[0u])); + if (tint_tmp_2) { + tint_tmp_2 = all((x_54[1u] == x_83[1u])); + } + bool tint_tmp_1 = (tint_tmp_2); + if (tint_tmp_1) { + tint_tmp_1 = all((x_54[2u] == x_83[2u])); + } + bool tint_tmp = (tint_tmp_1); + if (tint_tmp) { + tint_tmp = all((x_54[3u] == x_83[3u])); + } + if ((tint_tmp)) { + const int x_107 = asint(x_16[3].x); + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_110 = asint(x_16[scalar_offset_9 / 4][scalar_offset_9 % 4]); + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_113 = asint(x_16[scalar_offset_10 / 4][scalar_offset_10 % 4]); + const int x_116 = asint(x_16[3].x); + x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + const uint scalar_offset_11 = ((16u * uint(0))) / 4; + const int x_120 = asint(x_16[scalar_offset_11 / 4][scalar_offset_11 % 4]); + const float x_121 = float(x_120); + x_GLF_color = float4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..5cd7a35c95 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.msl @@ -0,0 +1,134 @@ +#include + +using namespace metal; +struct buf2 { + /* 0x0000 */ float one; +}; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func0_i1_(constant buf2& x_10, constant buf0& x_12, thread int* const x, thread float4x2* const tint_symbol_5) { + int i = 0; + bool x_137 = false; + bool x_138 = false; + bool x_138_phi = false; + bool x_139_phi = false; + int const x_124 = *(x); + bool const x_125 = (x_124 < 1); + x_139_phi = x_125; + if (!(x_125)) { + int const x_129 = *(x); + bool const x_130 = (x_129 > 1); + x_138_phi = x_130; + if (x_130) { + float const x_134 = x_10.one; + float const x_136 = x_12.x_GLF_uniform_float_values.arr[0].el; + x_137 = (x_134 > x_136); + x_138_phi = x_137; + } + x_138 = x_138_phi; + x_139_phi = x_138; + } + bool const x_139 = x_139_phi; + if (x_139) { + return; + } + float const x_143 = x_10.one; + float const x_145 = x_12.x_GLF_uniform_float_values.arr[0].el; + if ((x_143 == x_145)) { + i = 0; + while (true) { + int const x_150 = i; + if ((x_150 < 2)) { + } else { + break; + } + { + int const x_154 = *(x); + int const x_155 = clamp(x_154, 0, 3); + int const x_156 = i; + float const x_158 = x_12.x_GLF_uniform_float_values.arr[0].el; + float const x_160 = (*(tint_symbol_5))[x_155][x_156]; + (*(tint_symbol_5))[x_155][x_156] = (x_160 + x_158); + int const x_163 = i; + i = (x_163 + 1); + } + } + } + return; +} + +void func1_(constant buf2& x_10, constant buf0& x_12, thread float4* const tint_symbol_6, thread float4x2* const tint_symbol_7) { + int param = 0; + float const x_167 = (*(tint_symbol_6)).y; + if ((x_167 < 0.0f)) { + return; + } + param = 1; + func0_i1_(x_10, x_12, &(param), tint_symbol_7); + return; +} + +void main_1(constant buf2& x_10, constant buf0& x_12, constant buf1& x_16, thread float4x2* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + *(tint_symbol_8) = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + func1_(x_10, x_12, tint_symbol_9, tint_symbol_8); + func1_(x_10, x_12, tint_symbol_9, tint_symbol_8); + float4x2 const x_54 = *(tint_symbol_8); + int const x_56 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_59 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_62 = x_16.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_16.x_GLF_uniform_int_values.arr[1].el; + int const x_68 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_71 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_74 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_77 = x_16.x_GLF_uniform_int_values.arr[0].el; + float4x2 const x_83 = float4x2(float2(float(x_56), float(x_59)), float2(float(x_62), float(x_65)), float2(float(x_68), float(x_71)), float2(float(x_74), float(x_77))); + if ((((all((x_54[0u] == x_83[0u])) && all((x_54[1u] == x_83[1u]))) && all((x_54[2u] == x_83[2u]))) && all((x_54[3u] == x_83[3u])))) { + int const x_107 = x_16.x_GLF_uniform_int_values.arr[3].el; + int const x_110 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_113 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_116 = x_16.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_10) = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + int const x_120 = x_16.x_GLF_uniform_int_values.arr[0].el; + float const x_121 = float(x_120); + *(tint_symbol_10) = float4(x_121, x_121, x_121, x_121); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf2& x_10 [[buffer(2)]], constant buf0& x_12 [[buffer(0)]], constant buf1& x_16 [[buffer(1)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4x2 tint_symbol_12 = float4x2(0.0f); + thread float4 tint_symbol_13 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_10, x_12, x_16, &(tint_symbol_12), &(tint_symbol_11), &(tint_symbol_13)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b4e8fcf260 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.spvasm @@ -0,0 +1,329 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 214 +; Schema: 0 + OpCapability Shader + %92 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %m "m" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "one" + OpName %x_10 "x_10" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_12 "x_12" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_16 "x_16" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func0_i1_ "func0_i1_" + OpName %x "x" + OpName %i "i" + OpName %x_137 "x_137" + OpName %x_138 "x_138" + OpName %x_138_phi "x_138_phi" + OpName %x_139_phi "x_139_phi" + OpName %func1_ "func1_" + OpName %param "param" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_16 NonWritable + OpDecorate %x_16 DescriptorSet 0 + OpDecorate %x_16 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %6 = OpConstantNull %mat4v2float + %m = OpVariable %_ptr_Private_mat4v2float Private %6 + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_10 = OpVariable %_ptr_Uniform_buf2 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %19 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %19 + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_16 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %19 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %19 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpTypeFunction %void %_ptr_Function_int + %38 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %42 = OpConstantNull %bool + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Private_float = OpTypePointer Private %float + %104 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %118 = OpConstantComposite %v2float %float_0 %float_0 + %119 = OpConstantComposite %mat4v2float %118 %118 %118 %118 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %v2bool = OpTypeVector %bool 2 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %main_out = OpTypeStruct %v4float + %201 = OpTypeFunction %void %main_out + %func0_i1_ = OpFunction %void None %31 + %x = OpFunctionParameter %_ptr_Function_int + %36 = OpLabel + %i = OpVariable %_ptr_Function_int Function %38 + %x_137 = OpVariable %_ptr_Function_bool Function %42 + %x_138 = OpVariable %_ptr_Function_bool Function %42 + %x_138_phi = OpVariable %_ptr_Function_bool Function %42 + %x_139_phi = OpVariable %_ptr_Function_bool Function %42 + %47 = OpLoad %int %x + %49 = OpSLessThan %bool %47 %int_1 + OpStore %x_139_phi %49 + %50 = OpLogicalNot %bool %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %54 = OpLoad %int %x + %55 = OpSGreaterThan %bool %54 %int_1 + OpStore %x_138_phi %55 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 + %61 = OpLoad %float %60 + %63 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0 + %64 = OpLoad %float %63 + %65 = OpFOrdGreaterThan %bool %61 %64 + OpStore %x_137 %65 + %66 = OpLoad %bool %x_137 + OpStore %x_138_phi %66 + OpBranch %56 + %56 = OpLabel + %67 = OpLoad %bool %x_138_phi + OpStore %x_138 %67 + %68 = OpLoad %bool %x_138 + OpStore %x_139_phi %68 + OpBranch %51 + %51 = OpLabel + %69 = OpLoad %bool %x_139_phi + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + OpReturn + %70 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0 + %75 = OpLoad %float %74 + %76 = OpFOrdEqual %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + OpStore %i %int_0 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %int %i + %85 = OpSLessThan %bool %83 %int_2 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + OpBranch %86 + %88 = OpLabel + OpBranch %80 + %86 = OpLabel + OpBranch %81 + %81 = OpLabel + %90 = OpLoad %int %x + %91 = OpExtInst %int %92 SClamp %90 %int_0 %int_3 + %94 = OpLoad %int %i + %95 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0 + %96 = OpLoad %float %95 + %98 = OpAccessChain %_ptr_Private_float %m %91 %94 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Private_float %m %91 %94 + %101 = OpFAdd %float %99 %96 + OpStore %100 %101 + %102 = OpLoad %int %i + %103 = OpIAdd %int %102 %int_1 + OpStore %i %103 + OpBranch %79 + %80 = OpLabel + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd + %func1_ = OpFunction %void None %104 + %106 = OpLabel + %param = OpVariable %_ptr_Function_int Function %38 + %108 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %109 = OpLoad %float %108 + %111 = OpFOrdLessThan %bool %109 %float_0 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %112 + %113 = OpLabel + OpReturn + %112 = OpLabel + OpStore %param %int_1 + %114 = OpFunctionCall %void %func0_i1_ %param + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %104 + %117 = OpLabel + OpStore %m %119 + %120 = OpFunctionCall %void %func1_ + %121 = OpFunctionCall %void %func1_ + %122 = OpLoad %mat4v2float %m + %124 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %125 = OpLoad %int %124 + %126 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %127 = OpLoad %int %126 + %128 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_1 + %129 = OpLoad %int %128 + %130 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_1 + %131 = OpLoad %int %130 + %132 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %133 = OpLoad %int %132 + %134 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %135 = OpLoad %int %134 + %136 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %137 = OpLoad %int %136 + %138 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %139 = OpLoad %int %138 + %140 = OpConvertSToF %float %125 + %141 = OpConvertSToF %float %127 + %142 = OpCompositeConstruct %v2float %140 %141 + %143 = OpConvertSToF %float %129 + %144 = OpConvertSToF %float %131 + %145 = OpCompositeConstruct %v2float %143 %144 + %146 = OpConvertSToF %float %133 + %147 = OpConvertSToF %float %135 + %148 = OpCompositeConstruct %v2float %146 %147 + %149 = OpConvertSToF %float %137 + %150 = OpConvertSToF %float %139 + %151 = OpCompositeConstruct %v2float %149 %150 + %152 = OpCompositeConstruct %mat4v2float %142 %145 %148 %151 + %154 = OpCompositeExtract %v2float %122 0 + %155 = OpCompositeExtract %v2float %152 0 + %156 = OpFOrdEqual %v2bool %154 %155 + %153 = OpAll %bool %156 + OpSelectionMerge %158 None + OpBranchConditional %153 %159 %158 + %159 = OpLabel + %161 = OpCompositeExtract %v2float %122 1 + %162 = OpCompositeExtract %v2float %152 1 + %163 = OpFOrdEqual %v2bool %161 %162 + %160 = OpAll %bool %163 + OpBranch %158 + %158 = OpLabel + %164 = OpPhi %bool %153 %117 %160 %159 + OpSelectionMerge %165 None + OpBranchConditional %164 %166 %165 + %166 = OpLabel + %169 = OpCompositeExtract %v2float %122 2 + %170 = OpCompositeExtract %v2float %152 2 + %171 = OpFOrdEqual %v2bool %169 %170 + %167 = OpAll %bool %171 + OpBranch %165 + %165 = OpLabel + %172 = OpPhi %bool %164 %158 %167 %166 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %173 + %174 = OpLabel + %177 = OpCompositeExtract %v2float %122 3 + %178 = OpCompositeExtract %v2float %152 3 + %179 = OpFOrdEqual %v2bool %177 %178 + %175 = OpAll %bool %179 + OpBranch %173 + %173 = OpLabel + %180 = OpPhi %bool %172 %165 %175 %174 + OpSelectionMerge %181 None + OpBranchConditional %180 %182 %183 + %182 = OpLabel + %184 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_3 + %185 = OpLoad %int %184 + %186 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %187 = OpLoad %int %186 + %188 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %189 = OpLoad %int %188 + %190 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_3 + %191 = OpLoad %int %190 + %192 = OpConvertSToF %float %185 + %193 = OpConvertSToF %float %187 + %194 = OpConvertSToF %float %189 + %195 = OpConvertSToF %float %191 + %196 = OpCompositeConstruct %v4float %192 %193 %194 %195 + OpStore %x_GLF_color %196 + OpBranch %181 + %183 = OpLabel + %197 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %198 = OpLoad %int %197 + %199 = OpConvertSToF %float %198 + %200 = OpCompositeConstruct %v4float %199 %199 %199 %199 + OpStore %x_GLF_color %200 + OpBranch %181 + %181 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %201 +%tint_symbol_1 = OpFunctionParameter %main_out + %205 = OpLabel + %206 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %206 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %104 + %208 = OpLabel + %209 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %209 + %210 = OpFunctionCall %void %main_1 + %212 = OpLoad %v4float %x_GLF_color + %213 = OpCompositeConstruct %main_out %212 + %211 = OpFunctionCall %void %tint_symbol_3 %213 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..7e9de86d93 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.spvasm.expected.wgsl @@ -0,0 +1,133 @@ +[[block]] +struct buf2 { + one : f32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var m : mat4x2; + +[[group(0), binding(2)]] var x_10 : buf2; + +[[group(0), binding(0)]] var x_12 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_16 : buf1; + +var x_GLF_color : vec4; + +fn func0_i1_(x : ptr) { + var i : i32; + var x_137 : bool; + var x_138 : bool; + var x_138_phi : bool; + var x_139_phi : bool; + let x_124 : i32 = *(x); + let x_125 : bool = (x_124 < 1); + x_139_phi = x_125; + if (!(x_125)) { + let x_129 : i32 = *(x); + let x_130 : bool = (x_129 > 1); + x_138_phi = x_130; + if (x_130) { + let x_134 : f32 = x_10.one; + let x_136 : f32 = x_12.x_GLF_uniform_float_values[0]; + x_137 = (x_134 > x_136); + x_138_phi = x_137; + } + x_138 = x_138_phi; + x_139_phi = x_138; + } + let x_139 : bool = x_139_phi; + if (x_139) { + return; + } + let x_143 : f32 = x_10.one; + let x_145 : f32 = x_12.x_GLF_uniform_float_values[0]; + if ((x_143 == x_145)) { + i = 0; + loop { + let x_150 : i32 = i; + if ((x_150 < 2)) { + } else { + break; + } + + continuing { + let x_154 : i32 = *(x); + let x_155 : i32 = clamp(x_154, 0, 3); + let x_156 : i32 = i; + let x_158 : f32 = x_12.x_GLF_uniform_float_values[0]; + let x_160 : f32 = m[x_155][x_156]; + m[x_155][x_156] = (x_160 + x_158); + let x_163 : i32 = i; + i = (x_163 + 1); + } + } + } + return; +} + +fn func1_() { + var param : i32; + let x_167 : f32 = gl_FragCoord.y; + if ((x_167 < 0.0)) { + return; + } + param = 1; + func0_i1_(&(param)); + return; +} + +fn main_1() { + m = mat4x2(vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0)); + func1_(); + func1_(); + let x_54 : mat4x2 = m; + let x_56 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_59 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_16.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_16.x_GLF_uniform_int_values[1]; + let x_68 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_71 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_74 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_77 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_83 : mat4x2 = mat4x2(vec2(f32(x_56), f32(x_59)), vec2(f32(x_62), f32(x_65)), vec2(f32(x_68), f32(x_71)), vec2(f32(x_74), f32(x_77))); + if ((((all((x_54[0u] == x_83[0u])) && all((x_54[1u] == x_83[1u]))) && all((x_54[2u] == x_83[2u]))) && all((x_54[3u] == x_83[3u])))) { + let x_107 : i32 = x_16.x_GLF_uniform_int_values[3]; + let x_110 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_113 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_116 : i32 = x_16.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } else { + let x_120 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_121 : f32 = f32(x_120); + x_GLF_color = vec4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl new file mode 100644 index 0000000000..7e9de86d93 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl @@ -0,0 +1,133 @@ +[[block]] +struct buf2 { + one : f32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var m : mat4x2; + +[[group(0), binding(2)]] var x_10 : buf2; + +[[group(0), binding(0)]] var x_12 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_16 : buf1; + +var x_GLF_color : vec4; + +fn func0_i1_(x : ptr) { + var i : i32; + var x_137 : bool; + var x_138 : bool; + var x_138_phi : bool; + var x_139_phi : bool; + let x_124 : i32 = *(x); + let x_125 : bool = (x_124 < 1); + x_139_phi = x_125; + if (!(x_125)) { + let x_129 : i32 = *(x); + let x_130 : bool = (x_129 > 1); + x_138_phi = x_130; + if (x_130) { + let x_134 : f32 = x_10.one; + let x_136 : f32 = x_12.x_GLF_uniform_float_values[0]; + x_137 = (x_134 > x_136); + x_138_phi = x_137; + } + x_138 = x_138_phi; + x_139_phi = x_138; + } + let x_139 : bool = x_139_phi; + if (x_139) { + return; + } + let x_143 : f32 = x_10.one; + let x_145 : f32 = x_12.x_GLF_uniform_float_values[0]; + if ((x_143 == x_145)) { + i = 0; + loop { + let x_150 : i32 = i; + if ((x_150 < 2)) { + } else { + break; + } + + continuing { + let x_154 : i32 = *(x); + let x_155 : i32 = clamp(x_154, 0, 3); + let x_156 : i32 = i; + let x_158 : f32 = x_12.x_GLF_uniform_float_values[0]; + let x_160 : f32 = m[x_155][x_156]; + m[x_155][x_156] = (x_160 + x_158); + let x_163 : i32 = i; + i = (x_163 + 1); + } + } + } + return; +} + +fn func1_() { + var param : i32; + let x_167 : f32 = gl_FragCoord.y; + if ((x_167 < 0.0)) { + return; + } + param = 1; + func0_i1_(&(param)); + return; +} + +fn main_1() { + m = mat4x2(vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0)); + func1_(); + func1_(); + let x_54 : mat4x2 = m; + let x_56 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_59 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_16.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_16.x_GLF_uniform_int_values[1]; + let x_68 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_71 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_74 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_77 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_83 : mat4x2 = mat4x2(vec2(f32(x_56), f32(x_59)), vec2(f32(x_62), f32(x_65)), vec2(f32(x_68), f32(x_71)), vec2(f32(x_74), f32(x_77))); + if ((((all((x_54[0u] == x_83[0u])) && all((x_54[1u] == x_83[1u]))) && all((x_54[2u] == x_83[2u]))) && all((x_54[3u] == x_83[3u])))) { + let x_107 : i32 = x_16.x_GLF_uniform_int_values[3]; + let x_110 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_113 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_116 : i32 = x_16.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } else { + let x_120 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_121 : f32 = f32(x_120); + x_GLF_color = vec4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2327dda6de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.hlsl @@ -0,0 +1,146 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +static float4x2 m = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b2, space0) { + uint4 x_10[1]; +}; +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_16 : register(b1, space0) { + uint4 x_16[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func0_i1_(inout int x) { + int i = 0; + bool x_137 = false; + bool x_138 = false; + bool x_138_phi = false; + bool x_139_phi = false; + const int x_124 = x; + const bool x_125 = (x_124 < 1); + x_139_phi = x_125; + if (!(x_125)) { + const int x_129 = x; + const bool x_130 = (x_129 > 1); + x_138_phi = x_130; + if (x_130) { + const float x_134 = asfloat(x_10[0].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_136 = asfloat(x_12[scalar_offset / 4][scalar_offset % 4]); + x_137 = (x_134 > x_136); + x_138_phi = x_137; + } + x_138 = x_138_phi; + x_139_phi = x_138; + } + if (x_139_phi) { + return; + } + const float x_143 = asfloat(x_10[0].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_145 = asfloat(x_12[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_143 == x_145)) { + i = 0; + while (true) { + if ((i < 2)) { + } else { + break; + } + { + const int x_154 = x; + const int x_155 = clamp(x_154, 0, 3); + const int x_156 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_158 = asfloat(x_12[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_160 = m[x_155][x_156]; + set_float2(m[x_155], x_156, (x_160 + x_158)); + i = (i + 1); + } + } + } + return; +} + +void func1_() { + int param = 0; + const float x_167 = gl_FragCoord.y; + if ((x_167 < 0.0f)) { + return; + } + param = 1; + func0_i1_(param); + return; +} + +void main_1() { + m = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + func1_(); + func1_(); + const float4x2 x_54 = m; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_16[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_16[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const int x_62 = asint(x_16[1].x); + const int x_65 = asint(x_16[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_68 = asint(x_16[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_71 = asint(x_16[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_16[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_77 = asint(x_16[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float4x2 x_83 = float4x2(float2(float(x_56), float(x_59)), float2(float(x_62), float(x_65)), float2(float(x_68), float(x_71)), float2(float(x_74), float(x_77))); + bool tint_tmp_2 = all((x_54[0u] == x_83[0u])); + if (tint_tmp_2) { + tint_tmp_2 = all((x_54[1u] == x_83[1u])); + } + bool tint_tmp_1 = (tint_tmp_2); + if (tint_tmp_1) { + tint_tmp_1 = all((x_54[2u] == x_83[2u])); + } + bool tint_tmp = (tint_tmp_1); + if (tint_tmp) { + tint_tmp = all((x_54[3u] == x_83[3u])); + } + if ((tint_tmp)) { + const int x_107 = asint(x_16[3].x); + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_110 = asint(x_16[scalar_offset_9 / 4][scalar_offset_9 % 4]); + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_113 = asint(x_16[scalar_offset_10 / 4][scalar_offset_10 % 4]); + const int x_116 = asint(x_16[3].x); + x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + const uint scalar_offset_11 = ((16u * uint(0))) / 4; + const int x_120 = asint(x_16[scalar_offset_11 / 4][scalar_offset_11 % 4]); + const float x_121 = float(x_120); + x_GLF_color = float4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..5cd7a35c95 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.msl @@ -0,0 +1,134 @@ +#include + +using namespace metal; +struct buf2 { + /* 0x0000 */ float one; +}; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func0_i1_(constant buf2& x_10, constant buf0& x_12, thread int* const x, thread float4x2* const tint_symbol_5) { + int i = 0; + bool x_137 = false; + bool x_138 = false; + bool x_138_phi = false; + bool x_139_phi = false; + int const x_124 = *(x); + bool const x_125 = (x_124 < 1); + x_139_phi = x_125; + if (!(x_125)) { + int const x_129 = *(x); + bool const x_130 = (x_129 > 1); + x_138_phi = x_130; + if (x_130) { + float const x_134 = x_10.one; + float const x_136 = x_12.x_GLF_uniform_float_values.arr[0].el; + x_137 = (x_134 > x_136); + x_138_phi = x_137; + } + x_138 = x_138_phi; + x_139_phi = x_138; + } + bool const x_139 = x_139_phi; + if (x_139) { + return; + } + float const x_143 = x_10.one; + float const x_145 = x_12.x_GLF_uniform_float_values.arr[0].el; + if ((x_143 == x_145)) { + i = 0; + while (true) { + int const x_150 = i; + if ((x_150 < 2)) { + } else { + break; + } + { + int const x_154 = *(x); + int const x_155 = clamp(x_154, 0, 3); + int const x_156 = i; + float const x_158 = x_12.x_GLF_uniform_float_values.arr[0].el; + float const x_160 = (*(tint_symbol_5))[x_155][x_156]; + (*(tint_symbol_5))[x_155][x_156] = (x_160 + x_158); + int const x_163 = i; + i = (x_163 + 1); + } + } + } + return; +} + +void func1_(constant buf2& x_10, constant buf0& x_12, thread float4* const tint_symbol_6, thread float4x2* const tint_symbol_7) { + int param = 0; + float const x_167 = (*(tint_symbol_6)).y; + if ((x_167 < 0.0f)) { + return; + } + param = 1; + func0_i1_(x_10, x_12, &(param), tint_symbol_7); + return; +} + +void main_1(constant buf2& x_10, constant buf0& x_12, constant buf1& x_16, thread float4x2* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + *(tint_symbol_8) = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + func1_(x_10, x_12, tint_symbol_9, tint_symbol_8); + func1_(x_10, x_12, tint_symbol_9, tint_symbol_8); + float4x2 const x_54 = *(tint_symbol_8); + int const x_56 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_59 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_62 = x_16.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_16.x_GLF_uniform_int_values.arr[1].el; + int const x_68 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_71 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_74 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_77 = x_16.x_GLF_uniform_int_values.arr[0].el; + float4x2 const x_83 = float4x2(float2(float(x_56), float(x_59)), float2(float(x_62), float(x_65)), float2(float(x_68), float(x_71)), float2(float(x_74), float(x_77))); + if ((((all((x_54[0u] == x_83[0u])) && all((x_54[1u] == x_83[1u]))) && all((x_54[2u] == x_83[2u]))) && all((x_54[3u] == x_83[3u])))) { + int const x_107 = x_16.x_GLF_uniform_int_values.arr[3].el; + int const x_110 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_113 = x_16.x_GLF_uniform_int_values.arr[0].el; + int const x_116 = x_16.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_10) = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + int const x_120 = x_16.x_GLF_uniform_int_values.arr[0].el; + float const x_121 = float(x_120); + *(tint_symbol_10) = float4(x_121, x_121, x_121, x_121); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf2& x_10 [[buffer(2)]], constant buf0& x_12 [[buffer(0)]], constant buf1& x_16 [[buffer(1)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4x2 tint_symbol_12 = float4x2(0.0f); + thread float4 tint_symbol_13 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_10, x_12, x_16, &(tint_symbol_12), &(tint_symbol_11), &(tint_symbol_13)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b4e8fcf260 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.spvasm @@ -0,0 +1,329 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 214 +; Schema: 0 + OpCapability Shader + %92 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %m "m" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "one" + OpName %x_10 "x_10" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_12 "x_12" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_16 "x_16" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func0_i1_ "func0_i1_" + OpName %x "x" + OpName %i "i" + OpName %x_137 "x_137" + OpName %x_138 "x_138" + OpName %x_138_phi "x_138_phi" + OpName %x_139_phi "x_139_phi" + OpName %func1_ "func1_" + OpName %param "param" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_16 NonWritable + OpDecorate %x_16 DescriptorSet 0 + OpDecorate %x_16 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %6 = OpConstantNull %mat4v2float + %m = OpVariable %_ptr_Private_mat4v2float Private %6 + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_10 = OpVariable %_ptr_Uniform_buf2 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %19 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %19 + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_16 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %19 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %19 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpTypeFunction %void %_ptr_Function_int + %38 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %42 = OpConstantNull %bool + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Private_float = OpTypePointer Private %float + %104 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %118 = OpConstantComposite %v2float %float_0 %float_0 + %119 = OpConstantComposite %mat4v2float %118 %118 %118 %118 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %v2bool = OpTypeVector %bool 2 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %main_out = OpTypeStruct %v4float + %201 = OpTypeFunction %void %main_out + %func0_i1_ = OpFunction %void None %31 + %x = OpFunctionParameter %_ptr_Function_int + %36 = OpLabel + %i = OpVariable %_ptr_Function_int Function %38 + %x_137 = OpVariable %_ptr_Function_bool Function %42 + %x_138 = OpVariable %_ptr_Function_bool Function %42 + %x_138_phi = OpVariable %_ptr_Function_bool Function %42 + %x_139_phi = OpVariable %_ptr_Function_bool Function %42 + %47 = OpLoad %int %x + %49 = OpSLessThan %bool %47 %int_1 + OpStore %x_139_phi %49 + %50 = OpLogicalNot %bool %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %54 = OpLoad %int %x + %55 = OpSGreaterThan %bool %54 %int_1 + OpStore %x_138_phi %55 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 + %61 = OpLoad %float %60 + %63 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0 + %64 = OpLoad %float %63 + %65 = OpFOrdGreaterThan %bool %61 %64 + OpStore %x_137 %65 + %66 = OpLoad %bool %x_137 + OpStore %x_138_phi %66 + OpBranch %56 + %56 = OpLabel + %67 = OpLoad %bool %x_138_phi + OpStore %x_138 %67 + %68 = OpLoad %bool %x_138 + OpStore %x_139_phi %68 + OpBranch %51 + %51 = OpLabel + %69 = OpLoad %bool %x_139_phi + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + OpReturn + %70 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0 + %75 = OpLoad %float %74 + %76 = OpFOrdEqual %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + OpStore %i %int_0 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %int %i + %85 = OpSLessThan %bool %83 %int_2 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + OpBranch %86 + %88 = OpLabel + OpBranch %80 + %86 = OpLabel + OpBranch %81 + %81 = OpLabel + %90 = OpLoad %int %x + %91 = OpExtInst %int %92 SClamp %90 %int_0 %int_3 + %94 = OpLoad %int %i + %95 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0 + %96 = OpLoad %float %95 + %98 = OpAccessChain %_ptr_Private_float %m %91 %94 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Private_float %m %91 %94 + %101 = OpFAdd %float %99 %96 + OpStore %100 %101 + %102 = OpLoad %int %i + %103 = OpIAdd %int %102 %int_1 + OpStore %i %103 + OpBranch %79 + %80 = OpLabel + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd + %func1_ = OpFunction %void None %104 + %106 = OpLabel + %param = OpVariable %_ptr_Function_int Function %38 + %108 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %109 = OpLoad %float %108 + %111 = OpFOrdLessThan %bool %109 %float_0 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %112 + %113 = OpLabel + OpReturn + %112 = OpLabel + OpStore %param %int_1 + %114 = OpFunctionCall %void %func0_i1_ %param + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %104 + %117 = OpLabel + OpStore %m %119 + %120 = OpFunctionCall %void %func1_ + %121 = OpFunctionCall %void %func1_ + %122 = OpLoad %mat4v2float %m + %124 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %125 = OpLoad %int %124 + %126 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %127 = OpLoad %int %126 + %128 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_1 + %129 = OpLoad %int %128 + %130 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_1 + %131 = OpLoad %int %130 + %132 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %133 = OpLoad %int %132 + %134 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %135 = OpLoad %int %134 + %136 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %137 = OpLoad %int %136 + %138 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %139 = OpLoad %int %138 + %140 = OpConvertSToF %float %125 + %141 = OpConvertSToF %float %127 + %142 = OpCompositeConstruct %v2float %140 %141 + %143 = OpConvertSToF %float %129 + %144 = OpConvertSToF %float %131 + %145 = OpCompositeConstruct %v2float %143 %144 + %146 = OpConvertSToF %float %133 + %147 = OpConvertSToF %float %135 + %148 = OpCompositeConstruct %v2float %146 %147 + %149 = OpConvertSToF %float %137 + %150 = OpConvertSToF %float %139 + %151 = OpCompositeConstruct %v2float %149 %150 + %152 = OpCompositeConstruct %mat4v2float %142 %145 %148 %151 + %154 = OpCompositeExtract %v2float %122 0 + %155 = OpCompositeExtract %v2float %152 0 + %156 = OpFOrdEqual %v2bool %154 %155 + %153 = OpAll %bool %156 + OpSelectionMerge %158 None + OpBranchConditional %153 %159 %158 + %159 = OpLabel + %161 = OpCompositeExtract %v2float %122 1 + %162 = OpCompositeExtract %v2float %152 1 + %163 = OpFOrdEqual %v2bool %161 %162 + %160 = OpAll %bool %163 + OpBranch %158 + %158 = OpLabel + %164 = OpPhi %bool %153 %117 %160 %159 + OpSelectionMerge %165 None + OpBranchConditional %164 %166 %165 + %166 = OpLabel + %169 = OpCompositeExtract %v2float %122 2 + %170 = OpCompositeExtract %v2float %152 2 + %171 = OpFOrdEqual %v2bool %169 %170 + %167 = OpAll %bool %171 + OpBranch %165 + %165 = OpLabel + %172 = OpPhi %bool %164 %158 %167 %166 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %173 + %174 = OpLabel + %177 = OpCompositeExtract %v2float %122 3 + %178 = OpCompositeExtract %v2float %152 3 + %179 = OpFOrdEqual %v2bool %177 %178 + %175 = OpAll %bool %179 + OpBranch %173 + %173 = OpLabel + %180 = OpPhi %bool %172 %165 %175 %174 + OpSelectionMerge %181 None + OpBranchConditional %180 %182 %183 + %182 = OpLabel + %184 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_3 + %185 = OpLoad %int %184 + %186 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %187 = OpLoad %int %186 + %188 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %189 = OpLoad %int %188 + %190 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_3 + %191 = OpLoad %int %190 + %192 = OpConvertSToF %float %185 + %193 = OpConvertSToF %float %187 + %194 = OpConvertSToF %float %189 + %195 = OpConvertSToF %float %191 + %196 = OpCompositeConstruct %v4float %192 %193 %194 %195 + OpStore %x_GLF_color %196 + OpBranch %181 + %183 = OpLabel + %197 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0 + %198 = OpLoad %int %197 + %199 = OpConvertSToF %float %198 + %200 = OpCompositeConstruct %v4float %199 %199 %199 %199 + OpStore %x_GLF_color %200 + OpBranch %181 + %181 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %201 +%tint_symbol_1 = OpFunctionParameter %main_out + %205 = OpLabel + %206 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %206 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %104 + %208 = OpLabel + %209 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %209 + %210 = OpFunctionCall %void %main_1 + %212 = OpLoad %v4float %x_GLF_color + %213 = OpCompositeConstruct %main_out %212 + %211 = OpFunctionCall %void %tint_symbol_3 %213 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..7e9de86d93 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-functions-accumulate-global-matrix/0-opt.wgsl.expected.wgsl @@ -0,0 +1,133 @@ +[[block]] +struct buf2 { + one : f32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var m : mat4x2; + +[[group(0), binding(2)]] var x_10 : buf2; + +[[group(0), binding(0)]] var x_12 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_16 : buf1; + +var x_GLF_color : vec4; + +fn func0_i1_(x : ptr) { + var i : i32; + var x_137 : bool; + var x_138 : bool; + var x_138_phi : bool; + var x_139_phi : bool; + let x_124 : i32 = *(x); + let x_125 : bool = (x_124 < 1); + x_139_phi = x_125; + if (!(x_125)) { + let x_129 : i32 = *(x); + let x_130 : bool = (x_129 > 1); + x_138_phi = x_130; + if (x_130) { + let x_134 : f32 = x_10.one; + let x_136 : f32 = x_12.x_GLF_uniform_float_values[0]; + x_137 = (x_134 > x_136); + x_138_phi = x_137; + } + x_138 = x_138_phi; + x_139_phi = x_138; + } + let x_139 : bool = x_139_phi; + if (x_139) { + return; + } + let x_143 : f32 = x_10.one; + let x_145 : f32 = x_12.x_GLF_uniform_float_values[0]; + if ((x_143 == x_145)) { + i = 0; + loop { + let x_150 : i32 = i; + if ((x_150 < 2)) { + } else { + break; + } + + continuing { + let x_154 : i32 = *(x); + let x_155 : i32 = clamp(x_154, 0, 3); + let x_156 : i32 = i; + let x_158 : f32 = x_12.x_GLF_uniform_float_values[0]; + let x_160 : f32 = m[x_155][x_156]; + m[x_155][x_156] = (x_160 + x_158); + let x_163 : i32 = i; + i = (x_163 + 1); + } + } + } + return; +} + +fn func1_() { + var param : i32; + let x_167 : f32 = gl_FragCoord.y; + if ((x_167 < 0.0)) { + return; + } + param = 1; + func0_i1_(&(param)); + return; +} + +fn main_1() { + m = mat4x2(vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(0.0, 0.0)); + func1_(); + func1_(); + let x_54 : mat4x2 = m; + let x_56 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_59 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_16.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_16.x_GLF_uniform_int_values[1]; + let x_68 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_71 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_74 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_77 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_83 : mat4x2 = mat4x2(vec2(f32(x_56), f32(x_59)), vec2(f32(x_62), f32(x_65)), vec2(f32(x_68), f32(x_71)), vec2(f32(x_74), f32(x_77))); + if ((((all((x_54[0u] == x_83[0u])) && all((x_54[1u] == x_83[1u]))) && all((x_54[2u] == x_83[2u]))) && all((x_54[3u] == x_83[3u])))) { + let x_107 : i32 = x_16.x_GLF_uniform_int_values[3]; + let x_110 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_113 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_116 : i32 = x_16.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } else { + let x_120 : i32 = x_16.x_GLF_uniform_int_values[0]; + let x_121 : f32 = f32(x_120); + x_GLF_color = vec4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm new file mode 100644 index 0000000000..ac20aee9e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm @@ -0,0 +1,183 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %v0 "v0" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %v1 "v1" + OpName %a "a" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %c "c" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %float_3 = OpConstant %float 3 + %float_1 = OpConstant %float 1 + %36 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %15 + %39 = OpLabel + %v0 = OpVariable %_ptr_Function_v4float Function + %v1 = OpVariable %_ptr_Function_v4float Function + %a = OpVariable %_ptr_Function_int Function + %c = OpVariable %_ptr_Function_int Function + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %41 = OpLoad %float %40 + %42 = OpCompositeConstruct %v4float %41 %41 %41 %41 + OpStore %v0 %42 + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpCompositeConstruct %v4float %44 %44 %44 %44 + OpStore %v1 %45 + %46 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %47 = OpLoad %int %46 + OpStore %a %47 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %int %a + %53 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpSLessThan %bool %52 %54 + OpBranchConditional %55 %56 %49 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %58 = OpLoad %int %57 + OpStore %c %58 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %int %c + %64 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %65 = OpLoad %int %64 + %66 = OpSLessThan %bool %63 %65 + OpBranchConditional %66 %67 %60 + %67 = OpLabel + %68 = OpLoad %int %c + %69 = OpExtInst %int %1 SClamp %68 %int_0 %int_3 + %70 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Function_float %v0 %69 + %73 = OpLoad %float %72 + %74 = OpFSub %float %73 %71 + %75 = OpAccessChain %_ptr_Function_float %v0 %69 + OpStore %75 %74 + %76 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %79 = OpLoad %int %78 + %80 = OpIEqual %bool %77 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + %83 = OpLoad %int %a + %84 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %89 = OpLoad %float %88 + %90 = OpCompositeConstruct %v4float %85 %87 %89 %float_3 + %91 = OpLoad %v4float %v0 + %92 = OpExtInst %v4float %1 SmoothStep %90 %36 %91 + %93 = OpLoad %int %a + %94 = OpVectorExtractDynamic %float %92 %93 + %95 = OpAccessChain %_ptr_Function_float %v1 %83 + OpStore %95 %94 + OpBranch %81 + %81 = OpLabel + OpBranch %61 + %61 = OpLabel + %96 = OpLoad %int %c + %97 = OpIAdd %int %96 %int_1 + OpStore %c %97 + OpBranch %59 + %60 = OpLabel + OpBranch %50 + %50 = OpLabel + %98 = OpLoad %int %a + %99 = OpIAdd %int %98 %int_1 + OpStore %a %99 + OpBranch %48 + %49 = OpLabel + %100 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %101 = OpLoad %float %100 + %102 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %103 = OpLoad %float %102 + %104 = OpFOrdEqual %bool %101 %103 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %107 + %106 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %109 + %111 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %112 = OpLoad %int %111 + %113 = OpConvertSToF %float %112 + %114 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %115 = OpLoad %int %114 + %116 = OpConvertSToF %float %115 + %117 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %118 = OpLoad %int %117 + %119 = OpConvertSToF %float %118 + %120 = OpCompositeConstruct %v4float %110 %113 %116 %119 + OpStore %_GLF_color %120 + OpBranch %105 + %107 = OpLabel + %121 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %122 = OpLoad %int %121 + %123 = OpConvertSToF %float %122 + %124 = OpCompositeConstruct %v4float %123 %123 %123 %123 + OpStore %_GLF_color %124 + OpBranch %105 + %105 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..5ae6c98063 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.hlsl @@ -0,0 +1,92 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v0 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int a = 0; + int c = 0; + const float x_41 = asfloat(x_6[1].x); + v0 = float4(x_41, x_41, x_41, x_41); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + v1 = float4(x_44, x_44, x_44, x_44); + const int x_47 = asint(x_10[1].x); + a = x_47; + while (true) { + const int x_52 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_52 < x_54)) { + } else { + break; + } + const int x_58 = asint(x_10[3].x); + c = x_58; + while (true) { + const int x_63 = c; + const int x_65 = asint(x_10[2].x); + if ((x_63 < x_65)) { + } else { + break; + } + const int x_69 = clamp(c, 0, 3); + const float x_71 = asfloat(x_6[1].x); + const float x_73 = v0[x_69]; + set_float4(v0, x_69, (x_73 - x_71)); + const int x_77 = asint(x_10[1].x); + const int x_79 = asint(x_10[3].x); + if ((x_77 == x_79)) { + const int x_83 = a; + const float x_85 = asfloat(x_6[1].x); + const float x_87 = asfloat(x_6[1].x); + const float x_89 = asfloat(x_6[1].x); + set_float4(v1, x_83, smoothstep(float4(x_85, x_87, x_89, 3.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), v0)[a]); + } + { + c = (c + 1); + } + } + { + a = (a + 1); + } + } + const float x_101 = v1.x; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_103 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_101 == x_103)) { + const int x_109 = asint(x_10[1].x); + const int x_112 = asint(x_10[3].x); + const int x_115 = asint(x_10[3].x); + const int x_118 = asint(x_10[1].x); + x_GLF_color = float4(float(x_109), float(x_112), float(x_115), float(x_118)); + } else { + const int x_122 = asint(x_10[3].x); + const float x_123 = float(x_122); + x_GLF_color = float4(x_123, x_123, x_123, x_123); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..ecc0d68b4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.msl @@ -0,0 +1,107 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_10, thread float4* const tint_symbol_4) { + float4 v0 = 0.0f; + float4 v1 = 0.0f; + int a = 0; + int c = 0; + float const x_41 = x_6.x_GLF_uniform_float_values.arr[1].el; + v0 = float4(x_41, x_41, x_41, x_41); + float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el; + v1 = float4(x_44, x_44, x_44, x_44); + int const x_47 = x_10.x_GLF_uniform_int_values.arr[1].el; + a = x_47; + while (true) { + int const x_52 = a; + int const x_54 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_52 < x_54)) { + } else { + break; + } + int const x_58 = x_10.x_GLF_uniform_int_values.arr[3].el; + c = x_58; + while (true) { + int const x_63 = c; + int const x_65 = x_10.x_GLF_uniform_int_values.arr[2].el; + if ((x_63 < x_65)) { + } else { + break; + } + int const x_68 = c; + int const x_69 = clamp(x_68, 0, 3); + float const x_71 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_73 = v0[x_69]; + v0[x_69] = (x_73 - x_71); + int const x_77 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_79 = x_10.x_GLF_uniform_int_values.arr[3].el; + if ((x_77 == x_79)) { + int const x_83 = a; + float const x_85 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_87 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_89 = x_6.x_GLF_uniform_float_values.arr[1].el; + float4 const x_91 = v0; + int const x_93 = a; + v1[x_83] = smoothstep(float4(x_85, x_87, x_89, 3.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), x_91)[x_93]; + } + { + int const x_96 = c; + c = (x_96 + 1); + } + } + { + int const x_98 = a; + a = (x_98 + 1); + } + } + float const x_101 = v1.x; + float const x_103 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_101 == x_103)) { + int const x_109 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_112 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_115 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_118 = x_10.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_109), float(x_112), float(x_115), float(x_118)); + } else { + int const x_122 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_123 = float(x_122); + *(tint_symbol_4) = float4(x_123, x_123, x_123, x_123); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..59b8fddd47 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.spvasm @@ -0,0 +1,227 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 145 +; Schema: 0 + OpCapability Shader + %73 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v0 "v0" + OpName %v1 "v1" + OpName %a "a" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %float_3 = OpConstant %float 3 + %float_1 = OpConstant %float 1 + %102 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %133 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %v0 = OpVariable %_ptr_Function_v4float Function %17 + %v1 = OpVariable %_ptr_Function_v4float Function %17 + %a = OpVariable %_ptr_Function_int Function %29 + %c = OpVariable %_ptr_Function_int Function %29 + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %35 = OpLoad %float %34 + %36 = OpCompositeConstruct %v4float %35 %35 %35 %35 + OpStore %v0 %36 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpCompositeConstruct %v4float %39 %39 %39 %39 + OpStore %v1 %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %43 = OpLoad %int %42 + OpStore %a %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %a + %49 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpSLessThan %bool %48 %50 + OpSelectionMerge %53 None + OpBranchConditional %51 %54 %55 + %54 = OpLabel + OpBranch %53 + %55 = OpLabel + OpBranch %45 + %53 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %58 = OpLoad %int %57 + OpStore %c %58 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %int %c + %65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpSLessThan %bool %63 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %60 + %68 = OpLabel + %71 = OpLoad %int %c + %72 = OpExtInst %int %73 SClamp %71 %int_0 %int_3 + %74 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %75 = OpLoad %float %74 + %77 = OpAccessChain %_ptr_Function_float %v0 %72 + %78 = OpLoad %float %77 + %79 = OpAccessChain %_ptr_Function_float %v0 %72 + %80 = OpFSub %float %78 %75 + OpStore %79 %80 + %81 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %84 = OpLoad %int %83 + %85 = OpIEqual %bool %82 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpLoad %int %a + %89 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %92 = OpLoad %float %91 + %93 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %94 = OpLoad %float %93 + %95 = OpLoad %v4float %v0 + %96 = OpLoad %int %a + %97 = OpAccessChain %_ptr_Function_float %v1 %88 + %100 = OpCompositeConstruct %v4float %90 %92 %94 %float_3 + %98 = OpExtInst %v4float %73 SmoothStep %100 %102 %95 + %103 = OpVectorExtractDynamic %float %98 %96 + OpStore %97 %103 + OpBranch %86 + %86 = OpLabel + OpBranch %61 + %61 = OpLabel + %104 = OpLoad %int %c + %105 = OpIAdd %int %104 %int_1 + OpStore %c %105 + OpBranch %59 + %60 = OpLabel + OpBranch %46 + %46 = OpLabel + %106 = OpLoad %int %a + %107 = OpIAdd %int %106 %int_1 + OpStore %a %107 + OpBranch %44 + %45 = OpLabel + %108 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %109 = OpLoad %float %108 + %110 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %111 = OpLoad %float %110 + %112 = OpFOrdEqual %bool %109 %111 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %115 + %114 = OpLabel + %116 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %117 = OpLoad %int %116 + %118 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %119 = OpLoad %int %118 + %120 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %121 = OpLoad %int %120 + %122 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %123 = OpLoad %int %122 + %124 = OpConvertSToF %float %117 + %125 = OpConvertSToF %float %119 + %126 = OpConvertSToF %float %121 + %127 = OpConvertSToF %float %123 + %128 = OpCompositeConstruct %v4float %124 %125 %126 %127 + OpStore %x_GLF_color %128 + OpBranch %113 + %115 = OpLabel + %129 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %130 = OpLoad %int %129 + %131 = OpConvertSToF %float %130 + %132 = OpCompositeConstruct %v4float %131 %131 %131 %131 + OpStore %x_GLF_color %132 + OpBranch %113 + %113 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %133 +%tint_symbol = OpFunctionParameter %main_out + %137 = OpLabel + %138 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %138 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %140 = OpLabel + %141 = OpFunctionCall %void %main_1 + %143 = OpLoad %v4float %x_GLF_color + %144 = OpCompositeConstruct %main_out %143 + %142 = OpFunctionCall %void %tint_symbol_2 %144 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..e3aa19501e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.spvasm.expected.wgsl @@ -0,0 +1,101 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var v0 : vec4; + var v1 : vec4; + var a : i32; + var c : i32; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[1]; + v0 = vec4(x_41, x_41, x_41, x_41); + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + v1 = vec4(x_44, x_44, x_44, x_44); + let x_47 : i32 = x_10.x_GLF_uniform_int_values[1]; + a = x_47; + loop { + let x_52 : i32 = a; + let x_54 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_52 < x_54)) { + } else { + break; + } + let x_58 : i32 = x_10.x_GLF_uniform_int_values[3]; + c = x_58; + loop { + let x_63 : i32 = c; + let x_65 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_63 < x_65)) { + } else { + break; + } + let x_68 : i32 = c; + let x_69 : i32 = clamp(x_68, 0, 3); + let x_71 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_73 : f32 = v0[x_69]; + v0[x_69] = (x_73 - x_71); + let x_77 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_79 : i32 = x_10.x_GLF_uniform_int_values[3]; + if ((x_77 == x_79)) { + let x_83 : i32 = a; + let x_85 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_87 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_89 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_91 : vec4 = v0; + let x_93 : i32 = a; + v1[x_83] = smoothStep(vec4(x_85, x_87, x_89, 3.0), vec4(1.0, 1.0, 1.0, 1.0), x_91)[x_93]; + } + + continuing { + let x_96 : i32 = c; + c = (x_96 + 1); + } + } + + continuing { + let x_98 : i32 = a; + a = (x_98 + 1); + } + } + let x_101 : f32 = v1.x; + let x_103 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_101 == x_103)) { + let x_109 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_112 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_115 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_118 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_109), f32(x_112), f32(x_115), f32(x_118)); + } else { + let x_122 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_123 : f32 = f32(x_122); + x_GLF_color = vec4(x_123, x_123, x_123, x_123); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl new file mode 100644 index 0000000000..e3aa19501e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl @@ -0,0 +1,101 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var v0 : vec4; + var v1 : vec4; + var a : i32; + var c : i32; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[1]; + v0 = vec4(x_41, x_41, x_41, x_41); + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + v1 = vec4(x_44, x_44, x_44, x_44); + let x_47 : i32 = x_10.x_GLF_uniform_int_values[1]; + a = x_47; + loop { + let x_52 : i32 = a; + let x_54 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_52 < x_54)) { + } else { + break; + } + let x_58 : i32 = x_10.x_GLF_uniform_int_values[3]; + c = x_58; + loop { + let x_63 : i32 = c; + let x_65 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_63 < x_65)) { + } else { + break; + } + let x_68 : i32 = c; + let x_69 : i32 = clamp(x_68, 0, 3); + let x_71 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_73 : f32 = v0[x_69]; + v0[x_69] = (x_73 - x_71); + let x_77 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_79 : i32 = x_10.x_GLF_uniform_int_values[3]; + if ((x_77 == x_79)) { + let x_83 : i32 = a; + let x_85 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_87 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_89 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_91 : vec4 = v0; + let x_93 : i32 = a; + v1[x_83] = smoothStep(vec4(x_85, x_87, x_89, 3.0), vec4(1.0, 1.0, 1.0, 1.0), x_91)[x_93]; + } + + continuing { + let x_96 : i32 = c; + c = (x_96 + 1); + } + } + + continuing { + let x_98 : i32 = a; + a = (x_98 + 1); + } + } + let x_101 : f32 = v1.x; + let x_103 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_101 == x_103)) { + let x_109 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_112 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_115 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_118 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_109), f32(x_112), f32(x_115), f32(x_118)); + } else { + let x_122 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_123 : f32 = f32(x_122); + x_GLF_color = vec4(x_123, x_123, x_123, x_123); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..5ae6c98063 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.hlsl @@ -0,0 +1,92 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v0 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int a = 0; + int c = 0; + const float x_41 = asfloat(x_6[1].x); + v0 = float4(x_41, x_41, x_41, x_41); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + v1 = float4(x_44, x_44, x_44, x_44); + const int x_47 = asint(x_10[1].x); + a = x_47; + while (true) { + const int x_52 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_54 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_52 < x_54)) { + } else { + break; + } + const int x_58 = asint(x_10[3].x); + c = x_58; + while (true) { + const int x_63 = c; + const int x_65 = asint(x_10[2].x); + if ((x_63 < x_65)) { + } else { + break; + } + const int x_69 = clamp(c, 0, 3); + const float x_71 = asfloat(x_6[1].x); + const float x_73 = v0[x_69]; + set_float4(v0, x_69, (x_73 - x_71)); + const int x_77 = asint(x_10[1].x); + const int x_79 = asint(x_10[3].x); + if ((x_77 == x_79)) { + const int x_83 = a; + const float x_85 = asfloat(x_6[1].x); + const float x_87 = asfloat(x_6[1].x); + const float x_89 = asfloat(x_6[1].x); + set_float4(v1, x_83, smoothstep(float4(x_85, x_87, x_89, 3.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), v0)[a]); + } + { + c = (c + 1); + } + } + { + a = (a + 1); + } + } + const float x_101 = v1.x; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_103 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_101 == x_103)) { + const int x_109 = asint(x_10[1].x); + const int x_112 = asint(x_10[3].x); + const int x_115 = asint(x_10[3].x); + const int x_118 = asint(x_10[1].x); + x_GLF_color = float4(float(x_109), float(x_112), float(x_115), float(x_118)); + } else { + const int x_122 = asint(x_10[3].x); + const float x_123 = float(x_122); + x_GLF_color = float4(x_123, x_123, x_123, x_123); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..ecc0d68b4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.msl @@ -0,0 +1,107 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_10, thread float4* const tint_symbol_4) { + float4 v0 = 0.0f; + float4 v1 = 0.0f; + int a = 0; + int c = 0; + float const x_41 = x_6.x_GLF_uniform_float_values.arr[1].el; + v0 = float4(x_41, x_41, x_41, x_41); + float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el; + v1 = float4(x_44, x_44, x_44, x_44); + int const x_47 = x_10.x_GLF_uniform_int_values.arr[1].el; + a = x_47; + while (true) { + int const x_52 = a; + int const x_54 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_52 < x_54)) { + } else { + break; + } + int const x_58 = x_10.x_GLF_uniform_int_values.arr[3].el; + c = x_58; + while (true) { + int const x_63 = c; + int const x_65 = x_10.x_GLF_uniform_int_values.arr[2].el; + if ((x_63 < x_65)) { + } else { + break; + } + int const x_68 = c; + int const x_69 = clamp(x_68, 0, 3); + float const x_71 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_73 = v0[x_69]; + v0[x_69] = (x_73 - x_71); + int const x_77 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_79 = x_10.x_GLF_uniform_int_values.arr[3].el; + if ((x_77 == x_79)) { + int const x_83 = a; + float const x_85 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_87 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_89 = x_6.x_GLF_uniform_float_values.arr[1].el; + float4 const x_91 = v0; + int const x_93 = a; + v1[x_83] = smoothstep(float4(x_85, x_87, x_89, 3.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), x_91)[x_93]; + } + { + int const x_96 = c; + c = (x_96 + 1); + } + } + { + int const x_98 = a; + a = (x_98 + 1); + } + } + float const x_101 = v1.x; + float const x_103 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_101 == x_103)) { + int const x_109 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_112 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_115 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_118 = x_10.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_109), float(x_112), float(x_115), float(x_118)); + } else { + int const x_122 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_123 = float(x_122); + *(tint_symbol_4) = float4(x_123, x_123, x_123, x_123); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..59b8fddd47 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.spvasm @@ -0,0 +1,227 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 145 +; Schema: 0 + OpCapability Shader + %73 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v0 "v0" + OpName %v1 "v1" + OpName %a "a" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %float_3 = OpConstant %float 3 + %float_1 = OpConstant %float 1 + %102 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %133 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %v0 = OpVariable %_ptr_Function_v4float Function %17 + %v1 = OpVariable %_ptr_Function_v4float Function %17 + %a = OpVariable %_ptr_Function_int Function %29 + %c = OpVariable %_ptr_Function_int Function %29 + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %35 = OpLoad %float %34 + %36 = OpCompositeConstruct %v4float %35 %35 %35 %35 + OpStore %v0 %36 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpCompositeConstruct %v4float %39 %39 %39 %39 + OpStore %v1 %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %43 = OpLoad %int %42 + OpStore %a %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %a + %49 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpSLessThan %bool %48 %50 + OpSelectionMerge %53 None + OpBranchConditional %51 %54 %55 + %54 = OpLabel + OpBranch %53 + %55 = OpLabel + OpBranch %45 + %53 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %58 = OpLoad %int %57 + OpStore %c %58 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %int %c + %65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpSLessThan %bool %63 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %60 + %68 = OpLabel + %71 = OpLoad %int %c + %72 = OpExtInst %int %73 SClamp %71 %int_0 %int_3 + %74 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %75 = OpLoad %float %74 + %77 = OpAccessChain %_ptr_Function_float %v0 %72 + %78 = OpLoad %float %77 + %79 = OpAccessChain %_ptr_Function_float %v0 %72 + %80 = OpFSub %float %78 %75 + OpStore %79 %80 + %81 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %84 = OpLoad %int %83 + %85 = OpIEqual %bool %82 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpLoad %int %a + %89 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %92 = OpLoad %float %91 + %93 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %94 = OpLoad %float %93 + %95 = OpLoad %v4float %v0 + %96 = OpLoad %int %a + %97 = OpAccessChain %_ptr_Function_float %v1 %88 + %100 = OpCompositeConstruct %v4float %90 %92 %94 %float_3 + %98 = OpExtInst %v4float %73 SmoothStep %100 %102 %95 + %103 = OpVectorExtractDynamic %float %98 %96 + OpStore %97 %103 + OpBranch %86 + %86 = OpLabel + OpBranch %61 + %61 = OpLabel + %104 = OpLoad %int %c + %105 = OpIAdd %int %104 %int_1 + OpStore %c %105 + OpBranch %59 + %60 = OpLabel + OpBranch %46 + %46 = OpLabel + %106 = OpLoad %int %a + %107 = OpIAdd %int %106 %int_1 + OpStore %a %107 + OpBranch %44 + %45 = OpLabel + %108 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %109 = OpLoad %float %108 + %110 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %111 = OpLoad %float %110 + %112 = OpFOrdEqual %bool %109 %111 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %115 + %114 = OpLabel + %116 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %117 = OpLoad %int %116 + %118 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %119 = OpLoad %int %118 + %120 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %121 = OpLoad %int %120 + %122 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %123 = OpLoad %int %122 + %124 = OpConvertSToF %float %117 + %125 = OpConvertSToF %float %119 + %126 = OpConvertSToF %float %121 + %127 = OpConvertSToF %float %123 + %128 = OpCompositeConstruct %v4float %124 %125 %126 %127 + OpStore %x_GLF_color %128 + OpBranch %113 + %115 = OpLabel + %129 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %130 = OpLoad %int %129 + %131 = OpConvertSToF %float %130 + %132 = OpCompositeConstruct %v4float %131 %131 %131 %131 + OpStore %x_GLF_color %132 + OpBranch %113 + %113 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %133 +%tint_symbol = OpFunctionParameter %main_out + %137 = OpLabel + %138 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %138 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %140 = OpLabel + %141 = OpFunctionCall %void %main_1 + %143 = OpLoad %v4float %x_GLF_color + %144 = OpCompositeConstruct %main_out %143 + %142 = OpFunctionCall %void %tint_symbol_2 %144 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..e3aa19501e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loop-undefined-smoothstep-never-executed/0-opt.wgsl.expected.wgsl @@ -0,0 +1,101 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var v0 : vec4; + var v1 : vec4; + var a : i32; + var c : i32; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[1]; + v0 = vec4(x_41, x_41, x_41, x_41); + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + v1 = vec4(x_44, x_44, x_44, x_44); + let x_47 : i32 = x_10.x_GLF_uniform_int_values[1]; + a = x_47; + loop { + let x_52 : i32 = a; + let x_54 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_52 < x_54)) { + } else { + break; + } + let x_58 : i32 = x_10.x_GLF_uniform_int_values[3]; + c = x_58; + loop { + let x_63 : i32 = c; + let x_65 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_63 < x_65)) { + } else { + break; + } + let x_68 : i32 = c; + let x_69 : i32 = clamp(x_68, 0, 3); + let x_71 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_73 : f32 = v0[x_69]; + v0[x_69] = (x_73 - x_71); + let x_77 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_79 : i32 = x_10.x_GLF_uniform_int_values[3]; + if ((x_77 == x_79)) { + let x_83 : i32 = a; + let x_85 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_87 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_89 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_91 : vec4 = v0; + let x_93 : i32 = a; + v1[x_83] = smoothStep(vec4(x_85, x_87, x_89, 3.0), vec4(1.0, 1.0, 1.0, 1.0), x_91)[x_93]; + } + + continuing { + let x_96 : i32 = c; + c = (x_96 + 1); + } + } + + continuing { + let x_98 : i32 = a; + a = (x_98 + 1); + } + } + let x_101 : f32 = v1.x; + let x_103 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_101 == x_103)) { + let x_109 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_112 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_115 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_118 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_109), f32(x_112), f32(x_115), f32(x_118)); + } else { + let x_122 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_123 : f32 = f32(x_122); + x_GLF_color = vec4(x_123, x_123, x_123, x_123); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm new file mode 100644 index 0000000000..99a2d490de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm @@ -0,0 +1,496 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %_GLF_global_loop_count "_GLF_global_loop_count" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %i_0 "i" + OpName %i_1 "i" + OpName %i_2 "i" + OpName %i_3 "i" + OpName %i_4 "i" + OpName %i_5 "i" + OpName %i_6 "i" + OpName %i_7 "i" + OpName %i_8 "i" + OpName %i_9 "i" + OpName %i_10 "i" + OpName %i_11 "i" + OpName %i_12 "i" + OpName %i_13 "i" + OpName %sum "sum" + OpName %r "r" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %30 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int +%_GLF_global_loop_count = OpVariable %_ptr_Private_int Private + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_100 = OpConstant %int 100 + %int_3 = OpConstant %int 3 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %30 + %51 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %i_2 = OpVariable %_ptr_Function_int Function + %i_3 = OpVariable %_ptr_Function_int Function + %i_4 = OpVariable %_ptr_Function_int Function + %i_5 = OpVariable %_ptr_Function_int Function + %i_6 = OpVariable %_ptr_Function_int Function + %i_7 = OpVariable %_ptr_Function_int Function + %i_8 = OpVariable %_ptr_Function_int Function + %i_9 = OpVariable %_ptr_Function_int Function + %i_10 = OpVariable %_ptr_Function_int Function + %i_11 = OpVariable %_ptr_Function_int Function + %i_12 = OpVariable %_ptr_Function_int Function + %i_13 = OpVariable %_ptr_Function_int Function + %sum = OpVariable %_ptr_Function_float Function + %r = OpVariable %_ptr_Function_int Function + OpStore %_GLF_global_loop_count %int_0 + %52 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %53 = OpLoad %float %52 + OpStore %f %53 + %54 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %55 = OpLoad %int %54 + OpStore %i %55 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %int %i + %61 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %62 = OpLoad %int %61 + %63 = OpSLessThan %bool %60 %62 + OpBranchConditional %63 %64 %57 + %64 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %66 = OpLoad %int %65 + OpStore %i_0 %66 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %i_0 + %72 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %73 = OpLoad %int %72 + %74 = OpSLessThan %bool %71 %73 + OpBranchConditional %74 %75 %68 + %75 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %77 = OpLoad %int %76 + OpStore %i_1 %77 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %int %i_1 + %83 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %84 = OpLoad %int %83 + %85 = OpSLessThan %bool %82 %84 + OpBranchConditional %85 %86 %79 + %86 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %88 = OpLoad %int %87 + OpStore %i_2 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %90 %91 None + OpBranch %92 + %92 = OpLabel + %93 = OpLoad %int %i_2 + %94 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %95 = OpLoad %int %94 + %96 = OpSLessThan %bool %93 %95 + OpBranchConditional %96 %97 %90 + %97 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %99 = OpLoad %int %98 + OpStore %i_3 %99 + OpBranch %100 + %100 = OpLabel + OpLoopMerge %101 %102 None + OpBranch %103 + %103 = OpLabel + %104 = OpLoad %int %i_3 + %105 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %106 = OpLoad %int %105 + %107 = OpSLessThan %bool %104 %106 + OpBranchConditional %107 %108 %101 + %108 = OpLabel + %109 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %110 = OpLoad %int %109 + OpStore %i_4 %110 + OpBranch %111 + %111 = OpLabel + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %115 = OpLoad %int %i_4 + %116 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %117 = OpLoad %int %116 + %118 = OpSLessThan %bool %115 %117 + OpBranchConditional %118 %119 %112 + %119 = OpLabel + %120 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %121 = OpLoad %int %120 + OpStore %i_5 %121 + OpBranch %122 + %122 = OpLabel + OpLoopMerge %123 %124 None + OpBranch %125 + %125 = OpLabel + %126 = OpLoad %int %i_5 + %127 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %128 = OpLoad %int %127 + %129 = OpSLessThan %bool %126 %128 + OpBranchConditional %129 %130 %123 + %130 = OpLabel + %131 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %132 = OpLoad %int %131 + OpStore %i_6 %132 + OpBranch %133 + %133 = OpLabel + OpLoopMerge %134 %135 None + OpBranch %136 + %136 = OpLabel + %137 = OpLoad %int %i_6 + %138 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %139 = OpLoad %int %138 + %140 = OpSLessThan %bool %137 %139 + OpBranchConditional %140 %141 %134 + %141 = OpLabel + %142 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %143 = OpLoad %int %142 + OpStore %i_7 %143 + OpBranch %144 + %144 = OpLabel + OpLoopMerge %145 %146 None + OpBranch %147 + %147 = OpLabel + %148 = OpLoad %int %i_7 + %149 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %150 = OpLoad %int %149 + %151 = OpSLessThan %bool %148 %150 + OpBranchConditional %151 %152 %145 + %152 = OpLabel + %153 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %154 = OpLoad %int %153 + OpStore %i_8 %154 + OpBranch %155 + %155 = OpLabel + OpLoopMerge %156 %157 None + OpBranch %158 + %158 = OpLabel + %159 = OpLoad %int %i_8 + %160 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %161 = OpLoad %int %160 + %162 = OpSLessThan %bool %159 %161 + OpBranchConditional %162 %163 %156 + %163 = OpLabel + %164 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %165 = OpLoad %int %164 + OpStore %i_9 %165 + OpBranch %166 + %166 = OpLabel + OpLoopMerge %167 %168 None + OpBranch %169 + %169 = OpLabel + %170 = OpLoad %int %i_9 + %171 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %172 = OpLoad %int %171 + %173 = OpSLessThan %bool %170 %172 + OpBranchConditional %173 %174 %167 + %174 = OpLabel + %175 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %176 = OpLoad %int %175 + OpStore %i_10 %176 + OpBranch %177 + %177 = OpLabel + OpLoopMerge %178 %179 None + OpBranch %180 + %180 = OpLabel + %181 = OpLoad %int %i_10 + %182 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %183 = OpLoad %int %182 + %184 = OpSLessThan %bool %181 %183 + OpBranchConditional %184 %185 %178 + %185 = OpLabel + %186 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %187 = OpLoad %int %186 + OpStore %i_11 %187 + OpBranch %188 + %188 = OpLabel + OpLoopMerge %189 %190 None + OpBranch %191 + %191 = OpLabel + %192 = OpLoad %int %i_11 + %193 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %194 = OpLoad %int %193 + %195 = OpSLessThan %bool %192 %194 + OpBranchConditional %195 %196 %189 + %196 = OpLabel + %197 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %198 = OpLoad %int %197 + OpStore %i_12 %198 + OpBranch %199 + %199 = OpLabel + OpLoopMerge %200 %201 None + OpBranch %202 + %202 = OpLabel + %203 = OpLoad %int %i_12 + %204 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %205 = OpLoad %int %204 + %206 = OpSLessThan %bool %203 %205 + OpBranchConditional %206 %207 %200 + %207 = OpLabel + %208 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %209 = OpLoad %int %208 + OpStore %i_13 %209 + OpBranch %210 + %210 = OpLabel + OpLoopMerge %211 %212 None + OpBranch %213 + %213 = OpLabel + %214 = OpLoad %int %i_13 + %215 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %216 = OpLoad %int %215 + %217 = OpSLessThan %bool %214 %216 + OpBranchConditional %217 %218 %211 + %218 = OpLabel + OpBranch %219 + %219 = OpLabel + OpLoopMerge %220 %221 None + OpBranch %222 + %222 = OpLabel + %223 = OpLoad %int %_GLF_global_loop_count + %224 = OpIAdd %int %223 %int_1 + OpStore %_GLF_global_loop_count %224 + OpBranch %221 + %221 = OpLabel + %225 = OpLoad %int %_GLF_global_loop_count + %226 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %227 = OpLoad %int %226 + %228 = OpISub %int %int_100 %227 + %229 = OpSLessThan %bool %225 %228 + OpBranchConditional %229 %219 %220 + %220 = OpLabel + %230 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %231 = OpLoad %float %230 + %232 = OpLoad %float %f + %233 = OpFAdd %float %232 %231 + OpStore %f %233 + OpBranch %212 + %212 = OpLabel + %234 = OpLoad %int %i_13 + %235 = OpIAdd %int %234 %int_1 + OpStore %i_13 %235 + OpBranch %210 + %211 = OpLabel + OpBranch %201 + %201 = OpLabel + %236 = OpLoad %int %i_12 + %237 = OpIAdd %int %236 %int_1 + OpStore %i_12 %237 + OpBranch %199 + %200 = OpLabel + OpBranch %190 + %190 = OpLabel + %238 = OpLoad %int %i_11 + %239 = OpIAdd %int %238 %int_1 + OpStore %i_11 %239 + OpBranch %188 + %189 = OpLabel + OpBranch %179 + %179 = OpLabel + %240 = OpLoad %int %i_10 + %241 = OpIAdd %int %240 %int_1 + OpStore %i_10 %241 + OpBranch %177 + %178 = OpLabel + OpBranch %168 + %168 = OpLabel + %242 = OpLoad %int %i_9 + %243 = OpIAdd %int %242 %int_1 + OpStore %i_9 %243 + OpBranch %166 + %167 = OpLabel + OpBranch %157 + %157 = OpLabel + %244 = OpLoad %int %i_8 + %245 = OpIAdd %int %244 %int_1 + OpStore %i_8 %245 + OpBranch %155 + %156 = OpLabel + OpBranch %146 + %146 = OpLabel + %246 = OpLoad %int %i_7 + %247 = OpIAdd %int %246 %int_1 + OpStore %i_7 %247 + OpBranch %144 + %145 = OpLabel + OpBranch %135 + %135 = OpLabel + %248 = OpLoad %int %i_6 + %249 = OpIAdd %int %248 %int_1 + OpStore %i_6 %249 + OpBranch %133 + %134 = OpLabel + OpBranch %124 + %124 = OpLabel + %250 = OpLoad %int %i_5 + %251 = OpIAdd %int %250 %int_1 + OpStore %i_5 %251 + OpBranch %122 + %123 = OpLabel + OpBranch %113 + %113 = OpLabel + %252 = OpLoad %int %i_4 + %253 = OpIAdd %int %252 %int_1 + OpStore %i_4 %253 + OpBranch %111 + %112 = OpLabel + OpBranch %102 + %102 = OpLabel + %254 = OpLoad %int %i_3 + %255 = OpIAdd %int %254 %int_1 + OpStore %i_3 %255 + OpBranch %100 + %101 = OpLabel + OpBranch %91 + %91 = OpLabel + %256 = OpLoad %int %i_2 + %257 = OpIAdd %int %256 %int_1 + OpStore %i_2 %257 + OpBranch %89 + %90 = OpLabel + OpBranch %80 + %80 = OpLabel + %258 = OpLoad %int %i_1 + %259 = OpIAdd %int %258 %int_1 + OpStore %i_1 %259 + OpBranch %78 + %79 = OpLabel + OpBranch %69 + %69 = OpLabel + %260 = OpLoad %int %i_0 + %261 = OpIAdd %int %260 %int_1 + OpStore %i_0 %261 + OpBranch %67 + %68 = OpLabel + OpBranch %58 + %58 = OpLabel + %262 = OpLoad %int %i + %263 = OpIAdd %int %262 %int_1 + OpStore %i %263 + OpBranch %56 + %57 = OpLabel + %264 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %265 = OpLoad %float %264 + OpStore %sum %265 + %266 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %267 = OpLoad %int %266 + OpStore %r %267 + OpBranch %268 + %268 = OpLabel + OpLoopMerge %269 %270 None + OpBranch %271 + %271 = OpLabel + %272 = OpLoad %int %_GLF_global_loop_count + %273 = OpSLessThan %bool %272 %int_100 + OpBranchConditional %273 %274 %269 + %274 = OpLabel + %275 = OpLoad %int %_GLF_global_loop_count + %276 = OpIAdd %int %275 %int_1 + OpStore %_GLF_global_loop_count %276 + %277 = OpLoad %float %f + %278 = OpLoad %float %sum + %279 = OpFAdd %float %278 %277 + OpStore %sum %279 + OpBranch %270 + %270 = OpLabel + %280 = OpLoad %int %r + %281 = OpIAdd %int %280 %int_1 + OpStore %r %281 + OpBranch %268 + %269 = OpLabel + %282 = OpLoad %float %sum + %283 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %284 = OpLoad %float %283 + %285 = OpFOrdEqual %bool %282 %284 + OpSelectionMerge %286 None + OpBranchConditional %285 %287 %288 + %287 = OpLabel + %289 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %290 = OpLoad %int %289 + %291 = OpConvertSToF %float %290 + %292 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %293 = OpLoad %int %292 + %294 = OpConvertSToF %float %293 + %295 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %296 = OpLoad %int %295 + %297 = OpConvertSToF %float %296 + %298 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %299 = OpLoad %int %298 + %300 = OpConvertSToF %float %299 + %301 = OpCompositeConstruct %v4float %291 %294 %297 %300 + OpStore %_GLF_color %301 + OpBranch %286 + %288 = OpLabel + %302 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %303 = OpLoad %int %302 + %304 = OpConvertSToF %float %303 + %305 = OpCompositeConstruct %v4float %304 %304 %304 %304 + OpStore %_GLF_color %305 + OpBranch %286 + %286 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..fb22331d6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.hlsl @@ -0,0 +1,294 @@ +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + int i_11 = 0; + int i_12 = 0; + int i_13 = 0; + int i_14 = 0; + float sum = 0.0f; + int r = 0; + x_GLF_global_loop_count = 0; + const float x_53 = asfloat(x_7[1].x); + f = x_53; + const int x_55 = asint(x_10[1].x); + i = x_55; + while (true) { + const int x_60 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_62 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + if ((x_60 < x_62)) { + } else { + break; + } + const int x_66 = asint(x_10[1].x); + i_1 = x_66; + while (true) { + const int x_71 = i_1; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_73 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_71 < x_73)) { + } else { + break; + } + const int x_77 = asint(x_10[1].x); + i_2 = x_77; + while (true) { + const int x_82 = i_2; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_84 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_82 < x_84)) { + } else { + break; + } + const int x_88 = asint(x_10[1].x); + i_3 = x_88; + while (true) { + const int x_93 = i_3; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_95 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_93 < x_95)) { + } else { + break; + } + const int x_99 = asint(x_10[1].x); + i_4 = x_99; + while (true) { + const int x_104 = i_4; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_106 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_104 < x_106)) { + } else { + break; + } + const int x_110 = asint(x_10[1].x); + i_5 = x_110; + while (true) { + const int x_115 = i_5; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_117 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_115 < x_117)) { + } else { + break; + } + const int x_121 = asint(x_10[1].x); + i_6 = x_121; + while (true) { + const int x_126 = i_6; + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_128 = asint(x_10[scalar_offset_6 / 4][scalar_offset_6 % 4]); + if ((x_126 < x_128)) { + } else { + break; + } + const int x_132 = asint(x_10[1].x); + i_7 = x_132; + while (true) { + const int x_137 = i_7; + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_139 = asint(x_10[scalar_offset_7 / 4][scalar_offset_7 % 4]); + if ((x_137 < x_139)) { + } else { + break; + } + const int x_143 = asint(x_10[1].x); + i_8 = x_143; + while (true) { + const int x_148 = i_8; + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_150 = asint(x_10[scalar_offset_8 / 4][scalar_offset_8 % 4]); + if ((x_148 < x_150)) { + } else { + break; + } + const int x_154 = asint(x_10[1].x); + i_9 = x_154; + while (true) { + const int x_159 = i_9; + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_161 = asint(x_10[scalar_offset_9 / 4][scalar_offset_9 % 4]); + if ((x_159 < x_161)) { + } else { + break; + } + const int x_165 = asint(x_10[1].x); + i_10 = x_165; + while (true) { + const int x_170 = i_10; + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_172 = asint(x_10[scalar_offset_10 / 4][scalar_offset_10 % 4]); + if ((x_170 < x_172)) { + } else { + break; + } + const int x_176 = asint(x_10[1].x); + i_11 = x_176; + while (true) { + const int x_181 = i_11; + const int x_183 = asint(x_10[2].x); + if ((x_181 < x_183)) { + } else { + break; + } + const int x_187 = asint(x_10[1].x); + i_12 = x_187; + while (true) { + const int x_192 = i_12; + const uint scalar_offset_11 = ((16u * uint(0))) / 4; + const int x_194 = asint(x_10[scalar_offset_11 / 4][scalar_offset_11 % 4]); + if ((x_192 < x_194)) { + } else { + break; + } + const int x_198 = asint(x_10[1].x); + i_13 = x_198; + while (true) { + const int x_203 = i_13; + const uint scalar_offset_12 = ((16u * uint(0))) / 4; + const int x_205 = asint(x_10[scalar_offset_12 / 4][scalar_offset_12 % 4]); + if ((x_203 < x_205)) { + } else { + break; + } + const int x_209 = asint(x_10[1].x); + i_14 = x_209; + while (true) { + const int x_214 = i_14; + const int x_216 = asint(x_10[2].x); + if ((x_214 < x_216)) { + } else { + break; + } + while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + { + const int x_225 = x_GLF_global_loop_count; + const int x_227 = asint(x_10[3].x); + if ((x_225 < (100 - x_227))) { + } else { + break; + } + } + } + const uint scalar_offset_13 = ((16u * uint(0))) / 4; + const float x_231 = asfloat(x_7[scalar_offset_13 / 4][scalar_offset_13 % 4]); + f = (f + x_231); + { + i_14 = (i_14 + 1); + } + } + { + i_13 = (i_13 + 1); + } + } + { + i_12 = (i_12 + 1); + } + } + { + i_11 = (i_11 + 1); + } + } + { + i_10 = (i_10 + 1); + } + } + { + i_9 = (i_9 + 1); + } + } + { + i_8 = (i_8 + 1); + } + } + { + i_7 = (i_7 + 1); + } + } + { + i_6 = (i_6 + 1); + } + } + { + i_5 = (i_5 + 1); + } + } + { + i_4 = (i_4 + 1); + } + } + { + i_3 = (i_3 + 1); + } + } + { + i_2 = (i_2 + 1); + } + } + { + i_1 = (i_1 + 1); + } + } + { + i = (i + 1); + } + } + const float x_265 = asfloat(x_7[1].x); + sum = x_265; + const int x_267 = asint(x_10[1].x); + r = x_267; + { + for(; (x_GLF_global_loop_count < 100); r = (r + 1)) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + sum = (sum + f); + } + } + const float x_282 = sum; + const float x_284 = asfloat(x_7[2].x); + if ((x_282 == x_284)) { + const uint scalar_offset_14 = ((16u * uint(0))) / 4; + const int x_290 = asint(x_10[scalar_offset_14 / 4][scalar_offset_14 % 4]); + const int x_293 = asint(x_10[1].x); + const int x_296 = asint(x_10[1].x); + const uint scalar_offset_15 = ((16u * uint(0))) / 4; + const int x_299 = asint(x_10[scalar_offset_15 / 4][scalar_offset_15 % 4]); + x_GLF_color = float4(float(x_290), float(x_293), float(x_296), float(x_299)); + } else { + const int x_303 = asint(x_10[1].x); + const float x_304 = float(x_303); + x_GLF_color = float4(x_304, x_304, x_304, x_304); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a589c96bb8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.msl @@ -0,0 +1,322 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_10, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + float f = 0.0f; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + int i_11 = 0; + int i_12 = 0; + int i_13 = 0; + int i_14 = 0; + float sum = 0.0f; + int r = 0; + *(tint_symbol_4) = 0; + float const x_53 = x_7.x_GLF_uniform_float_values.arr[1].el; + f = x_53; + int const x_55 = x_10.x_GLF_uniform_int_values.arr[1].el; + i = x_55; + while (true) { + int const x_60 = i; + int const x_62 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_60 < x_62)) { + } else { + break; + } + int const x_66 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_1 = x_66; + while (true) { + int const x_71 = i_1; + int const x_73 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_71 < x_73)) { + } else { + break; + } + int const x_77 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_2 = x_77; + while (true) { + int const x_82 = i_2; + int const x_84 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_82 < x_84)) { + } else { + break; + } + int const x_88 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_3 = x_88; + while (true) { + int const x_93 = i_3; + int const x_95 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_93 < x_95)) { + } else { + break; + } + int const x_99 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_4 = x_99; + while (true) { + int const x_104 = i_4; + int const x_106 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_104 < x_106)) { + } else { + break; + } + int const x_110 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_5 = x_110; + while (true) { + int const x_115 = i_5; + int const x_117 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_115 < x_117)) { + } else { + break; + } + int const x_121 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_6 = x_121; + while (true) { + int const x_126 = i_6; + int const x_128 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_126 < x_128)) { + } else { + break; + } + int const x_132 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_7 = x_132; + while (true) { + int const x_137 = i_7; + int const x_139 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_137 < x_139)) { + } else { + break; + } + int const x_143 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_8 = x_143; + while (true) { + int const x_148 = i_8; + int const x_150 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_148 < x_150)) { + } else { + break; + } + int const x_154 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_9 = x_154; + while (true) { + int const x_159 = i_9; + int const x_161 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_159 < x_161)) { + } else { + break; + } + int const x_165 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_10 = x_165; + while (true) { + int const x_170 = i_10; + int const x_172 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_170 < x_172)) { + } else { + break; + } + int const x_176 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_11 = x_176; + while (true) { + int const x_181 = i_11; + int const x_183 = x_10.x_GLF_uniform_int_values.arr[2].el; + if ((x_181 < x_183)) { + } else { + break; + } + int const x_187 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_12 = x_187; + while (true) { + int const x_192 = i_12; + int const x_194 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_192 < x_194)) { + } else { + break; + } + int const x_198 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_13 = x_198; + while (true) { + int const x_203 = i_13; + int const x_205 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_203 < x_205)) { + } else { + break; + } + int const x_209 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_14 = x_209; + while (true) { + int const x_214 = i_14; + int const x_216 = x_10.x_GLF_uniform_int_values.arr[2].el; + if ((x_214 < x_216)) { + } else { + break; + } + while (true) { + int const x_223 = *(tint_symbol_4); + *(tint_symbol_4) = (x_223 + 1); + { + int const x_225 = *(tint_symbol_4); + int const x_227 = x_10.x_GLF_uniform_int_values.arr[3].el; + if ((x_225 < (100 - x_227))) { + } else { + break; + } + } + } + float const x_231 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_232 = f; + f = (x_232 + x_231); + { + int const x_234 = i_14; + i_14 = (x_234 + 1); + } + } + { + int const x_236 = i_13; + i_13 = (x_236 + 1); + } + } + { + int const x_238 = i_12; + i_12 = (x_238 + 1); + } + } + { + int const x_240 = i_11; + i_11 = (x_240 + 1); + } + } + { + int const x_242 = i_10; + i_10 = (x_242 + 1); + } + } + { + int const x_244 = i_9; + i_9 = (x_244 + 1); + } + } + { + int const x_246 = i_8; + i_8 = (x_246 + 1); + } + } + { + int const x_248 = i_7; + i_7 = (x_248 + 1); + } + } + { + int const x_250 = i_6; + i_6 = (x_250 + 1); + } + } + { + int const x_252 = i_5; + i_5 = (x_252 + 1); + } + } + { + int const x_254 = i_4; + i_4 = (x_254 + 1); + } + } + { + int const x_256 = i_3; + i_3 = (x_256 + 1); + } + } + { + int const x_258 = i_2; + i_2 = (x_258 + 1); + } + } + { + int const x_260 = i_1; + i_1 = (x_260 + 1); + } + } + { + int const x_262 = i; + i = (x_262 + 1); + } + } + float const x_265 = x_7.x_GLF_uniform_float_values.arr[1].el; + sum = x_265; + int const x_267 = x_10.x_GLF_uniform_int_values.arr[1].el; + r = x_267; + while (true) { + int const x_272 = *(tint_symbol_4); + if ((x_272 < 100)) { + } else { + break; + } + int const x_275 = *(tint_symbol_4); + *(tint_symbol_4) = (x_275 + 1); + float const x_277 = f; + float const x_278 = sum; + sum = (x_278 + x_277); + { + int const x_280 = r; + r = (x_280 + 1); + } + } + float const x_282 = sum; + float const x_284 = x_7.x_GLF_uniform_float_values.arr[2].el; + if ((x_282 == x_284)) { + int const x_290 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_293 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_296 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_299 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_290), float(x_293), float(x_296), float(x_299)); + } else { + int const x_303 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_304 = float(x_303); + *(tint_symbol_5) = float4(x_304, x_304, x_304, x_304); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_7, x_10, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8003194ff8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.spvasm @@ -0,0 +1,623 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 358 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %i "i" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %i_3 "i_3" + OpName %i_4 "i_4" + OpName %i_5 "i_5" + OpName %i_6 "i_6" + OpName %i_7 "i_7" + OpName %i_8 "i_8" + OpName %i_9 "i_9" + OpName %i_10 "i_10" + OpName %i_11 "i_11" + OpName %i_12 "i_12" + OpName %i_13 "i_13" + OpName %i_14 "i_14" + OpName %sum "sum" + OpName %r "r" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %20 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %20 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_100 = OpConstant %int 100 + %main_out = OpTypeStruct %v4float + %346 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %f = OpVariable %_ptr_Function_float Function %29 + %i = OpVariable %_ptr_Function_int Function %4 + %i_1 = OpVariable %_ptr_Function_int Function %4 + %i_2 = OpVariable %_ptr_Function_int Function %4 + %i_3 = OpVariable %_ptr_Function_int Function %4 + %i_4 = OpVariable %_ptr_Function_int Function %4 + %i_5 = OpVariable %_ptr_Function_int Function %4 + %i_6 = OpVariable %_ptr_Function_int Function %4 + %i_7 = OpVariable %_ptr_Function_int Function %4 + %i_8 = OpVariable %_ptr_Function_int Function %4 + %i_9 = OpVariable %_ptr_Function_int Function %4 + %i_10 = OpVariable %_ptr_Function_int Function %4 + %i_11 = OpVariable %_ptr_Function_int Function %4 + %i_12 = OpVariable %_ptr_Function_int Function %4 + %i_13 = OpVariable %_ptr_Function_int Function %4 + %i_14 = OpVariable %_ptr_Function_int Function %4 + %sum = OpVariable %_ptr_Function_float Function %29 + %r = OpVariable %_ptr_Function_int Function %4 + OpStore %x_GLF_global_loop_count %int_0 + %52 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %53 = OpLoad %float %52 + OpStore %f %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %56 = OpLoad %int %55 + OpStore %i %56 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %i + %62 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpSLessThan %bool %61 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %67 %68 + %67 = OpLabel + OpBranch %66 + %68 = OpLabel + OpBranch %58 + %66 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %70 = OpLoad %int %69 + OpStore %i_1 %70 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %int %i_1 + %76 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %77 = OpLoad %int %76 + %78 = OpSLessThan %bool %75 %77 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %81 + %80 = OpLabel + OpBranch %79 + %81 = OpLabel + OpBranch %72 + %79 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %83 = OpLoad %int %82 + OpStore %i_2 %83 + OpBranch %84 + %84 = OpLabel + OpLoopMerge %85 %86 None + OpBranch %87 + %87 = OpLabel + %88 = OpLoad %int %i_2 + %89 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %90 = OpLoad %int %89 + %91 = OpSLessThan %bool %88 %90 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %94 + %93 = OpLabel + OpBranch %92 + %94 = OpLabel + OpBranch %85 + %92 = OpLabel + %95 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %96 = OpLoad %int %95 + OpStore %i_3 %96 + OpBranch %97 + %97 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %101 = OpLoad %int %i_3 + %102 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %103 = OpLoad %int %102 + %104 = OpSLessThan %bool %101 %103 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %107 + %106 = OpLabel + OpBranch %105 + %107 = OpLabel + OpBranch %98 + %105 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %109 = OpLoad %int %108 + OpStore %i_4 %109 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %int %i_4 + %115 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %116 = OpLoad %int %115 + %117 = OpSLessThan %bool %114 %116 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %120 + %119 = OpLabel + OpBranch %118 + %120 = OpLabel + OpBranch %111 + %118 = OpLabel + %121 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %122 = OpLoad %int %121 + OpStore %i_5 %122 + OpBranch %123 + %123 = OpLabel + OpLoopMerge %124 %125 None + OpBranch %126 + %126 = OpLabel + %127 = OpLoad %int %i_5 + %128 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %129 = OpLoad %int %128 + %130 = OpSLessThan %bool %127 %129 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %133 + %132 = OpLabel + OpBranch %131 + %133 = OpLabel + OpBranch %124 + %131 = OpLabel + %134 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %135 = OpLoad %int %134 + OpStore %i_6 %135 + OpBranch %136 + %136 = OpLabel + OpLoopMerge %137 %138 None + OpBranch %139 + %139 = OpLabel + %140 = OpLoad %int %i_6 + %141 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %142 = OpLoad %int %141 + %143 = OpSLessThan %bool %140 %142 + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %146 + %145 = OpLabel + OpBranch %144 + %146 = OpLabel + OpBranch %137 + %144 = OpLabel + %147 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %148 = OpLoad %int %147 + OpStore %i_7 %148 + OpBranch %149 + %149 = OpLabel + OpLoopMerge %150 %151 None + OpBranch %152 + %152 = OpLabel + %153 = OpLoad %int %i_7 + %154 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %155 = OpLoad %int %154 + %156 = OpSLessThan %bool %153 %155 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %159 + %158 = OpLabel + OpBranch %157 + %159 = OpLabel + OpBranch %150 + %157 = OpLabel + %160 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %161 = OpLoad %int %160 + OpStore %i_8 %161 + OpBranch %162 + %162 = OpLabel + OpLoopMerge %163 %164 None + OpBranch %165 + %165 = OpLabel + %166 = OpLoad %int %i_8 + %167 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %168 = OpLoad %int %167 + %169 = OpSLessThan %bool %166 %168 + OpSelectionMerge %170 None + OpBranchConditional %169 %171 %172 + %171 = OpLabel + OpBranch %170 + %172 = OpLabel + OpBranch %163 + %170 = OpLabel + %173 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %174 = OpLoad %int %173 + OpStore %i_9 %174 + OpBranch %175 + %175 = OpLabel + OpLoopMerge %176 %177 None + OpBranch %178 + %178 = OpLabel + %179 = OpLoad %int %i_9 + %180 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %181 = OpLoad %int %180 + %182 = OpSLessThan %bool %179 %181 + OpSelectionMerge %183 None + OpBranchConditional %182 %184 %185 + %184 = OpLabel + OpBranch %183 + %185 = OpLabel + OpBranch %176 + %183 = OpLabel + %186 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %187 = OpLoad %int %186 + OpStore %i_10 %187 + OpBranch %188 + %188 = OpLabel + OpLoopMerge %189 %190 None + OpBranch %191 + %191 = OpLabel + %192 = OpLoad %int %i_10 + %193 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %194 = OpLoad %int %193 + %195 = OpSLessThan %bool %192 %194 + OpSelectionMerge %196 None + OpBranchConditional %195 %197 %198 + %197 = OpLabel + OpBranch %196 + %198 = OpLabel + OpBranch %189 + %196 = OpLabel + %199 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %200 = OpLoad %int %199 + OpStore %i_11 %200 + OpBranch %201 + %201 = OpLabel + OpLoopMerge %202 %203 None + OpBranch %204 + %204 = OpLabel + %205 = OpLoad %int %i_11 + %207 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %208 = OpLoad %int %207 + %209 = OpSLessThan %bool %205 %208 + OpSelectionMerge %210 None + OpBranchConditional %209 %211 %212 + %211 = OpLabel + OpBranch %210 + %212 = OpLabel + OpBranch %202 + %210 = OpLabel + %213 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %214 = OpLoad %int %213 + OpStore %i_12 %214 + OpBranch %215 + %215 = OpLabel + OpLoopMerge %216 %217 None + OpBranch %218 + %218 = OpLabel + %219 = OpLoad %int %i_12 + %220 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %221 = OpLoad %int %220 + %222 = OpSLessThan %bool %219 %221 + OpSelectionMerge %223 None + OpBranchConditional %222 %224 %225 + %224 = OpLabel + OpBranch %223 + %225 = OpLabel + OpBranch %216 + %223 = OpLabel + %226 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %227 = OpLoad %int %226 + OpStore %i_13 %227 + OpBranch %228 + %228 = OpLabel + OpLoopMerge %229 %230 None + OpBranch %231 + %231 = OpLabel + %232 = OpLoad %int %i_13 + %233 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %234 = OpLoad %int %233 + %235 = OpSLessThan %bool %232 %234 + OpSelectionMerge %236 None + OpBranchConditional %235 %237 %238 + %237 = OpLabel + OpBranch %236 + %238 = OpLabel + OpBranch %229 + %236 = OpLabel + %239 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %240 = OpLoad %int %239 + OpStore %i_14 %240 + OpBranch %241 + %241 = OpLabel + OpLoopMerge %242 %243 None + OpBranch %244 + %244 = OpLabel + %245 = OpLoad %int %i_14 + %246 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %247 = OpLoad %int %246 + %248 = OpSLessThan %bool %245 %247 + OpSelectionMerge %249 None + OpBranchConditional %248 %250 %251 + %250 = OpLabel + OpBranch %249 + %251 = OpLabel + OpBranch %242 + %249 = OpLabel + OpBranch %252 + %252 = OpLabel + OpLoopMerge %253 %254 None + OpBranch %255 + %255 = OpLabel + %256 = OpLoad %int %x_GLF_global_loop_count + %257 = OpIAdd %int %256 %int_1 + OpStore %x_GLF_global_loop_count %257 + OpBranch %254 + %254 = OpLabel + %258 = OpLoad %int %x_GLF_global_loop_count + %260 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %261 = OpLoad %int %260 + %263 = OpISub %int %int_100 %261 + %264 = OpSLessThan %bool %258 %263 + OpSelectionMerge %265 None + OpBranchConditional %264 %266 %267 + %266 = OpLabel + OpBranch %265 + %267 = OpLabel + OpBranch %253 + %265 = OpLabel + OpBranch %252 + %253 = OpLabel + %268 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %269 = OpLoad %float %268 + %270 = OpLoad %float %f + %271 = OpFAdd %float %270 %269 + OpStore %f %271 + OpBranch %243 + %243 = OpLabel + %272 = OpLoad %int %i_14 + %273 = OpIAdd %int %272 %int_1 + OpStore %i_14 %273 + OpBranch %241 + %242 = OpLabel + OpBranch %230 + %230 = OpLabel + %274 = OpLoad %int %i_13 + %275 = OpIAdd %int %274 %int_1 + OpStore %i_13 %275 + OpBranch %228 + %229 = OpLabel + OpBranch %217 + %217 = OpLabel + %276 = OpLoad %int %i_12 + %277 = OpIAdd %int %276 %int_1 + OpStore %i_12 %277 + OpBranch %215 + %216 = OpLabel + OpBranch %203 + %203 = OpLabel + %278 = OpLoad %int %i_11 + %279 = OpIAdd %int %278 %int_1 + OpStore %i_11 %279 + OpBranch %201 + %202 = OpLabel + OpBranch %190 + %190 = OpLabel + %280 = OpLoad %int %i_10 + %281 = OpIAdd %int %280 %int_1 + OpStore %i_10 %281 + OpBranch %188 + %189 = OpLabel + OpBranch %177 + %177 = OpLabel + %282 = OpLoad %int %i_9 + %283 = OpIAdd %int %282 %int_1 + OpStore %i_9 %283 + OpBranch %175 + %176 = OpLabel + OpBranch %164 + %164 = OpLabel + %284 = OpLoad %int %i_8 + %285 = OpIAdd %int %284 %int_1 + OpStore %i_8 %285 + OpBranch %162 + %163 = OpLabel + OpBranch %151 + %151 = OpLabel + %286 = OpLoad %int %i_7 + %287 = OpIAdd %int %286 %int_1 + OpStore %i_7 %287 + OpBranch %149 + %150 = OpLabel + OpBranch %138 + %138 = OpLabel + %288 = OpLoad %int %i_6 + %289 = OpIAdd %int %288 %int_1 + OpStore %i_6 %289 + OpBranch %136 + %137 = OpLabel + OpBranch %125 + %125 = OpLabel + %290 = OpLoad %int %i_5 + %291 = OpIAdd %int %290 %int_1 + OpStore %i_5 %291 + OpBranch %123 + %124 = OpLabel + OpBranch %112 + %112 = OpLabel + %292 = OpLoad %int %i_4 + %293 = OpIAdd %int %292 %int_1 + OpStore %i_4 %293 + OpBranch %110 + %111 = OpLabel + OpBranch %99 + %99 = OpLabel + %294 = OpLoad %int %i_3 + %295 = OpIAdd %int %294 %int_1 + OpStore %i_3 %295 + OpBranch %97 + %98 = OpLabel + OpBranch %86 + %86 = OpLabel + %296 = OpLoad %int %i_2 + %297 = OpIAdd %int %296 %int_1 + OpStore %i_2 %297 + OpBranch %84 + %85 = OpLabel + OpBranch %73 + %73 = OpLabel + %298 = OpLoad %int %i_1 + %299 = OpIAdd %int %298 %int_1 + OpStore %i_1 %299 + OpBranch %71 + %72 = OpLabel + OpBranch %59 + %59 = OpLabel + %300 = OpLoad %int %i + %301 = OpIAdd %int %300 %int_1 + OpStore %i %301 + OpBranch %57 + %58 = OpLabel + %302 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %303 = OpLoad %float %302 + OpStore %sum %303 + %304 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %305 = OpLoad %int %304 + OpStore %r %305 + OpBranch %306 + %306 = OpLabel + OpLoopMerge %307 %308 None + OpBranch %309 + %309 = OpLabel + %310 = OpLoad %int %x_GLF_global_loop_count + %311 = OpSLessThan %bool %310 %int_100 + OpSelectionMerge %312 None + OpBranchConditional %311 %313 %314 + %313 = OpLabel + OpBranch %312 + %314 = OpLabel + OpBranch %307 + %312 = OpLabel + %315 = OpLoad %int %x_GLF_global_loop_count + %316 = OpIAdd %int %315 %int_1 + OpStore %x_GLF_global_loop_count %316 + %317 = OpLoad %float %f + %318 = OpLoad %float %sum + %319 = OpFAdd %float %318 %317 + OpStore %sum %319 + OpBranch %308 + %308 = OpLabel + %320 = OpLoad %int %r + %321 = OpIAdd %int %320 %int_1 + OpStore %r %321 + OpBranch %306 + %307 = OpLabel + %322 = OpLoad %float %sum + %323 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %324 = OpLoad %float %323 + %325 = OpFOrdEqual %bool %322 %324 + OpSelectionMerge %326 None + OpBranchConditional %325 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %330 = OpLoad %int %329 + %331 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %332 = OpLoad %int %331 + %333 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %334 = OpLoad %int %333 + %335 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %336 = OpLoad %int %335 + %337 = OpConvertSToF %float %330 + %338 = OpConvertSToF %float %332 + %339 = OpConvertSToF %float %334 + %340 = OpConvertSToF %float %336 + %341 = OpCompositeConstruct %v4float %337 %338 %339 %340 + OpStore %x_GLF_color %341 + OpBranch %326 + %328 = OpLabel + %342 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %343 = OpLoad %int %342 + %344 = OpConvertSToF %float %343 + %345 = OpCompositeConstruct %v4float %344 %344 %344 %344 + OpStore %x_GLF_color %345 + OpBranch %326 + %326 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %346 +%tint_symbol = OpFunctionParameter %main_out + %350 = OpLabel + %351 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %351 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %353 = OpLabel + %354 = OpFunctionCall %void %main_1 + %356 = OpLoad %v4float %x_GLF_color + %357 = OpCompositeConstruct %main_out %356 + %355 = OpFunctionCall %void %tint_symbol_2 %357 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 254[%254] is not post dominated by the back-edge block 265[%265] + %265 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ed88017ccf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.wgsl @@ -0,0 +1,332 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var i_3 : i32; + var i_4 : i32; + var i_5 : i32; + var i_6 : i32; + var i_7 : i32; + var i_8 : i32; + var i_9 : i32; + var i_10 : i32; + var i_11 : i32; + var i_12 : i32; + var i_13 : i32; + var i_14 : i32; + var sum : f32; + var r : i32; + x_GLF_global_loop_count = 0; + let x_53 : f32 = x_7.x_GLF_uniform_float_values[1]; + f = x_53; + let x_55 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_55; + loop { + let x_60 : i32 = i; + let x_62 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_60 < x_62)) { + } else { + break; + } + let x_66 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_1 = x_66; + loop { + let x_71 : i32 = i_1; + let x_73 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_71 < x_73)) { + } else { + break; + } + let x_77 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_2 = x_77; + loop { + let x_82 : i32 = i_2; + let x_84 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_82 < x_84)) { + } else { + break; + } + let x_88 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_3 = x_88; + loop { + let x_93 : i32 = i_3; + let x_95 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_93 < x_95)) { + } else { + break; + } + let x_99 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_4 = x_99; + loop { + let x_104 : i32 = i_4; + let x_106 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_104 < x_106)) { + } else { + break; + } + let x_110 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_5 = x_110; + loop { + let x_115 : i32 = i_5; + let x_117 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_115 < x_117)) { + } else { + break; + } + let x_121 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_6 = x_121; + loop { + let x_126 : i32 = i_6; + let x_128 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_126 < x_128)) { + } else { + break; + } + let x_132 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_7 = x_132; + loop { + let x_137 : i32 = i_7; + let x_139 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_137 < x_139)) { + } else { + break; + } + let x_143 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_8 = x_143; + loop { + let x_148 : i32 = i_8; + let x_150 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_148 < x_150)) { + } else { + break; + } + let x_154 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_9 = x_154; + loop { + let x_159 : i32 = i_9; + let x_161 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_159 < x_161)) { + } else { + break; + } + let x_165 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_10 = x_165; + loop { + let x_170 : i32 = i_10; + let x_172 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_170 < x_172)) { + } else { + break; + } + let x_176 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_11 = x_176; + loop { + let x_181 : i32 = i_11; + let x_183 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_181 < x_183)) { + } else { + break; + } + let x_187 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_12 = x_187; + loop { + let x_192 : i32 = i_12; + let x_194 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_192 < x_194)) { + } else { + break; + } + let x_198 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_13 = x_198; + loop { + let x_203 : i32 = i_13; + let x_205 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_203 < x_205)) { + } else { + break; + } + let x_209 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_14 = x_209; + loop { + let x_214 : i32 = i_14; + let x_216 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_214 < x_216)) { + } else { + break; + } + loop { + let x_223 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_223 + 1); + + continuing { + let x_225 : i32 = x_GLF_global_loop_count; + let x_227 : i32 = x_10.x_GLF_uniform_int_values[3]; + if ((x_225 < (100 - x_227))) { + } else { + break; + } + } + } + let x_231 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_232 : f32 = f; + f = (x_232 + x_231); + + continuing { + let x_234 : i32 = i_14; + i_14 = (x_234 + 1); + } + } + + continuing { + let x_236 : i32 = i_13; + i_13 = (x_236 + 1); + } + } + + continuing { + let x_238 : i32 = i_12; + i_12 = (x_238 + 1); + } + } + + continuing { + let x_240 : i32 = i_11; + i_11 = (x_240 + 1); + } + } + + continuing { + let x_242 : i32 = i_10; + i_10 = (x_242 + 1); + } + } + + continuing { + let x_244 : i32 = i_9; + i_9 = (x_244 + 1); + } + } + + continuing { + let x_246 : i32 = i_8; + i_8 = (x_246 + 1); + } + } + + continuing { + let x_248 : i32 = i_7; + i_7 = (x_248 + 1); + } + } + + continuing { + let x_250 : i32 = i_6; + i_6 = (x_250 + 1); + } + } + + continuing { + let x_252 : i32 = i_5; + i_5 = (x_252 + 1); + } + } + + continuing { + let x_254 : i32 = i_4; + i_4 = (x_254 + 1); + } + } + + continuing { + let x_256 : i32 = i_3; + i_3 = (x_256 + 1); + } + } + + continuing { + let x_258 : i32 = i_2; + i_2 = (x_258 + 1); + } + } + + continuing { + let x_260 : i32 = i_1; + i_1 = (x_260 + 1); + } + } + + continuing { + let x_262 : i32 = i; + i = (x_262 + 1); + } + } + let x_265 : f32 = x_7.x_GLF_uniform_float_values[1]; + sum = x_265; + let x_267 : i32 = x_10.x_GLF_uniform_int_values[1]; + r = x_267; + loop { + let x_272 : i32 = x_GLF_global_loop_count; + if ((x_272 < 100)) { + } else { + break; + } + let x_275 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_275 + 1); + let x_277 : f32 = f; + let x_278 : f32 = sum; + sum = (x_278 + x_277); + + continuing { + let x_280 : i32 = r; + r = (x_280 + 1); + } + } + let x_282 : f32 = sum; + let x_284 : f32 = x_7.x_GLF_uniform_float_values[2]; + if ((x_282 == x_284)) { + let x_290 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_293 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_296 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_299 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_290), f32(x_293), f32(x_296), f32(x_299)); + } else { + let x_303 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_304 : f32 = f32(x_303); + x_GLF_color = vec4(x_304, x_304, x_304, x_304); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl new file mode 100644 index 0000000000..ed88017ccf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl @@ -0,0 +1,332 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var i_3 : i32; + var i_4 : i32; + var i_5 : i32; + var i_6 : i32; + var i_7 : i32; + var i_8 : i32; + var i_9 : i32; + var i_10 : i32; + var i_11 : i32; + var i_12 : i32; + var i_13 : i32; + var i_14 : i32; + var sum : f32; + var r : i32; + x_GLF_global_loop_count = 0; + let x_53 : f32 = x_7.x_GLF_uniform_float_values[1]; + f = x_53; + let x_55 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_55; + loop { + let x_60 : i32 = i; + let x_62 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_60 < x_62)) { + } else { + break; + } + let x_66 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_1 = x_66; + loop { + let x_71 : i32 = i_1; + let x_73 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_71 < x_73)) { + } else { + break; + } + let x_77 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_2 = x_77; + loop { + let x_82 : i32 = i_2; + let x_84 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_82 < x_84)) { + } else { + break; + } + let x_88 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_3 = x_88; + loop { + let x_93 : i32 = i_3; + let x_95 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_93 < x_95)) { + } else { + break; + } + let x_99 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_4 = x_99; + loop { + let x_104 : i32 = i_4; + let x_106 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_104 < x_106)) { + } else { + break; + } + let x_110 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_5 = x_110; + loop { + let x_115 : i32 = i_5; + let x_117 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_115 < x_117)) { + } else { + break; + } + let x_121 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_6 = x_121; + loop { + let x_126 : i32 = i_6; + let x_128 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_126 < x_128)) { + } else { + break; + } + let x_132 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_7 = x_132; + loop { + let x_137 : i32 = i_7; + let x_139 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_137 < x_139)) { + } else { + break; + } + let x_143 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_8 = x_143; + loop { + let x_148 : i32 = i_8; + let x_150 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_148 < x_150)) { + } else { + break; + } + let x_154 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_9 = x_154; + loop { + let x_159 : i32 = i_9; + let x_161 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_159 < x_161)) { + } else { + break; + } + let x_165 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_10 = x_165; + loop { + let x_170 : i32 = i_10; + let x_172 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_170 < x_172)) { + } else { + break; + } + let x_176 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_11 = x_176; + loop { + let x_181 : i32 = i_11; + let x_183 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_181 < x_183)) { + } else { + break; + } + let x_187 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_12 = x_187; + loop { + let x_192 : i32 = i_12; + let x_194 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_192 < x_194)) { + } else { + break; + } + let x_198 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_13 = x_198; + loop { + let x_203 : i32 = i_13; + let x_205 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_203 < x_205)) { + } else { + break; + } + let x_209 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_14 = x_209; + loop { + let x_214 : i32 = i_14; + let x_216 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_214 < x_216)) { + } else { + break; + } + loop { + let x_223 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_223 + 1); + + continuing { + let x_225 : i32 = x_GLF_global_loop_count; + let x_227 : i32 = x_10.x_GLF_uniform_int_values[3]; + if ((x_225 < (100 - x_227))) { + } else { + break; + } + } + } + let x_231 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_232 : f32 = f; + f = (x_232 + x_231); + + continuing { + let x_234 : i32 = i_14; + i_14 = (x_234 + 1); + } + } + + continuing { + let x_236 : i32 = i_13; + i_13 = (x_236 + 1); + } + } + + continuing { + let x_238 : i32 = i_12; + i_12 = (x_238 + 1); + } + } + + continuing { + let x_240 : i32 = i_11; + i_11 = (x_240 + 1); + } + } + + continuing { + let x_242 : i32 = i_10; + i_10 = (x_242 + 1); + } + } + + continuing { + let x_244 : i32 = i_9; + i_9 = (x_244 + 1); + } + } + + continuing { + let x_246 : i32 = i_8; + i_8 = (x_246 + 1); + } + } + + continuing { + let x_248 : i32 = i_7; + i_7 = (x_248 + 1); + } + } + + continuing { + let x_250 : i32 = i_6; + i_6 = (x_250 + 1); + } + } + + continuing { + let x_252 : i32 = i_5; + i_5 = (x_252 + 1); + } + } + + continuing { + let x_254 : i32 = i_4; + i_4 = (x_254 + 1); + } + } + + continuing { + let x_256 : i32 = i_3; + i_3 = (x_256 + 1); + } + } + + continuing { + let x_258 : i32 = i_2; + i_2 = (x_258 + 1); + } + } + + continuing { + let x_260 : i32 = i_1; + i_1 = (x_260 + 1); + } + } + + continuing { + let x_262 : i32 = i; + i = (x_262 + 1); + } + } + let x_265 : f32 = x_7.x_GLF_uniform_float_values[1]; + sum = x_265; + let x_267 : i32 = x_10.x_GLF_uniform_int_values[1]; + r = x_267; + loop { + let x_272 : i32 = x_GLF_global_loop_count; + if ((x_272 < 100)) { + } else { + break; + } + let x_275 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_275 + 1); + let x_277 : f32 = f; + let x_278 : f32 = sum; + sum = (x_278 + x_277); + + continuing { + let x_280 : i32 = r; + r = (x_280 + 1); + } + } + let x_282 : f32 = sum; + let x_284 : f32 = x_7.x_GLF_uniform_float_values[2]; + if ((x_282 == x_284)) { + let x_290 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_293 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_296 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_299 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_290), f32(x_293), f32(x_296), f32(x_299)); + } else { + let x_303 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_304 : f32 = f32(x_303); + x_GLF_color = vec4(x_304, x_304, x_304, x_304); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..fb22331d6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.hlsl @@ -0,0 +1,294 @@ +static int x_GLF_global_loop_count = 0; +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[3]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + int i_11 = 0; + int i_12 = 0; + int i_13 = 0; + int i_14 = 0; + float sum = 0.0f; + int r = 0; + x_GLF_global_loop_count = 0; + const float x_53 = asfloat(x_7[1].x); + f = x_53; + const int x_55 = asint(x_10[1].x); + i = x_55; + while (true) { + const int x_60 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_62 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + if ((x_60 < x_62)) { + } else { + break; + } + const int x_66 = asint(x_10[1].x); + i_1 = x_66; + while (true) { + const int x_71 = i_1; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_73 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_71 < x_73)) { + } else { + break; + } + const int x_77 = asint(x_10[1].x); + i_2 = x_77; + while (true) { + const int x_82 = i_2; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_84 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_82 < x_84)) { + } else { + break; + } + const int x_88 = asint(x_10[1].x); + i_3 = x_88; + while (true) { + const int x_93 = i_3; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_95 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_93 < x_95)) { + } else { + break; + } + const int x_99 = asint(x_10[1].x); + i_4 = x_99; + while (true) { + const int x_104 = i_4; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_106 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_104 < x_106)) { + } else { + break; + } + const int x_110 = asint(x_10[1].x); + i_5 = x_110; + while (true) { + const int x_115 = i_5; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_117 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_115 < x_117)) { + } else { + break; + } + const int x_121 = asint(x_10[1].x); + i_6 = x_121; + while (true) { + const int x_126 = i_6; + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_128 = asint(x_10[scalar_offset_6 / 4][scalar_offset_6 % 4]); + if ((x_126 < x_128)) { + } else { + break; + } + const int x_132 = asint(x_10[1].x); + i_7 = x_132; + while (true) { + const int x_137 = i_7; + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_139 = asint(x_10[scalar_offset_7 / 4][scalar_offset_7 % 4]); + if ((x_137 < x_139)) { + } else { + break; + } + const int x_143 = asint(x_10[1].x); + i_8 = x_143; + while (true) { + const int x_148 = i_8; + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_150 = asint(x_10[scalar_offset_8 / 4][scalar_offset_8 % 4]); + if ((x_148 < x_150)) { + } else { + break; + } + const int x_154 = asint(x_10[1].x); + i_9 = x_154; + while (true) { + const int x_159 = i_9; + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_161 = asint(x_10[scalar_offset_9 / 4][scalar_offset_9 % 4]); + if ((x_159 < x_161)) { + } else { + break; + } + const int x_165 = asint(x_10[1].x); + i_10 = x_165; + while (true) { + const int x_170 = i_10; + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_172 = asint(x_10[scalar_offset_10 / 4][scalar_offset_10 % 4]); + if ((x_170 < x_172)) { + } else { + break; + } + const int x_176 = asint(x_10[1].x); + i_11 = x_176; + while (true) { + const int x_181 = i_11; + const int x_183 = asint(x_10[2].x); + if ((x_181 < x_183)) { + } else { + break; + } + const int x_187 = asint(x_10[1].x); + i_12 = x_187; + while (true) { + const int x_192 = i_12; + const uint scalar_offset_11 = ((16u * uint(0))) / 4; + const int x_194 = asint(x_10[scalar_offset_11 / 4][scalar_offset_11 % 4]); + if ((x_192 < x_194)) { + } else { + break; + } + const int x_198 = asint(x_10[1].x); + i_13 = x_198; + while (true) { + const int x_203 = i_13; + const uint scalar_offset_12 = ((16u * uint(0))) / 4; + const int x_205 = asint(x_10[scalar_offset_12 / 4][scalar_offset_12 % 4]); + if ((x_203 < x_205)) { + } else { + break; + } + const int x_209 = asint(x_10[1].x); + i_14 = x_209; + while (true) { + const int x_214 = i_14; + const int x_216 = asint(x_10[2].x); + if ((x_214 < x_216)) { + } else { + break; + } + while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + { + const int x_225 = x_GLF_global_loop_count; + const int x_227 = asint(x_10[3].x); + if ((x_225 < (100 - x_227))) { + } else { + break; + } + } + } + const uint scalar_offset_13 = ((16u * uint(0))) / 4; + const float x_231 = asfloat(x_7[scalar_offset_13 / 4][scalar_offset_13 % 4]); + f = (f + x_231); + { + i_14 = (i_14 + 1); + } + } + { + i_13 = (i_13 + 1); + } + } + { + i_12 = (i_12 + 1); + } + } + { + i_11 = (i_11 + 1); + } + } + { + i_10 = (i_10 + 1); + } + } + { + i_9 = (i_9 + 1); + } + } + { + i_8 = (i_8 + 1); + } + } + { + i_7 = (i_7 + 1); + } + } + { + i_6 = (i_6 + 1); + } + } + { + i_5 = (i_5 + 1); + } + } + { + i_4 = (i_4 + 1); + } + } + { + i_3 = (i_3 + 1); + } + } + { + i_2 = (i_2 + 1); + } + } + { + i_1 = (i_1 + 1); + } + } + { + i = (i + 1); + } + } + const float x_265 = asfloat(x_7[1].x); + sum = x_265; + const int x_267 = asint(x_10[1].x); + r = x_267; + { + for(; (x_GLF_global_loop_count < 100); r = (r + 1)) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + sum = (sum + f); + } + } + const float x_282 = sum; + const float x_284 = asfloat(x_7[2].x); + if ((x_282 == x_284)) { + const uint scalar_offset_14 = ((16u * uint(0))) / 4; + const int x_290 = asint(x_10[scalar_offset_14 / 4][scalar_offset_14 % 4]); + const int x_293 = asint(x_10[1].x); + const int x_296 = asint(x_10[1].x); + const uint scalar_offset_15 = ((16u * uint(0))) / 4; + const int x_299 = asint(x_10[scalar_offset_15 / 4][scalar_offset_15 % 4]); + x_GLF_color = float4(float(x_290), float(x_293), float(x_296), float(x_299)); + } else { + const int x_303 = asint(x_10[1].x); + const float x_304 = float(x_303); + x_GLF_color = float4(x_304, x_304, x_304, x_304); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a589c96bb8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.msl @@ -0,0 +1,322 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_10, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + float f = 0.0f; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + int i_11 = 0; + int i_12 = 0; + int i_13 = 0; + int i_14 = 0; + float sum = 0.0f; + int r = 0; + *(tint_symbol_4) = 0; + float const x_53 = x_7.x_GLF_uniform_float_values.arr[1].el; + f = x_53; + int const x_55 = x_10.x_GLF_uniform_int_values.arr[1].el; + i = x_55; + while (true) { + int const x_60 = i; + int const x_62 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_60 < x_62)) { + } else { + break; + } + int const x_66 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_1 = x_66; + while (true) { + int const x_71 = i_1; + int const x_73 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_71 < x_73)) { + } else { + break; + } + int const x_77 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_2 = x_77; + while (true) { + int const x_82 = i_2; + int const x_84 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_82 < x_84)) { + } else { + break; + } + int const x_88 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_3 = x_88; + while (true) { + int const x_93 = i_3; + int const x_95 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_93 < x_95)) { + } else { + break; + } + int const x_99 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_4 = x_99; + while (true) { + int const x_104 = i_4; + int const x_106 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_104 < x_106)) { + } else { + break; + } + int const x_110 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_5 = x_110; + while (true) { + int const x_115 = i_5; + int const x_117 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_115 < x_117)) { + } else { + break; + } + int const x_121 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_6 = x_121; + while (true) { + int const x_126 = i_6; + int const x_128 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_126 < x_128)) { + } else { + break; + } + int const x_132 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_7 = x_132; + while (true) { + int const x_137 = i_7; + int const x_139 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_137 < x_139)) { + } else { + break; + } + int const x_143 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_8 = x_143; + while (true) { + int const x_148 = i_8; + int const x_150 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_148 < x_150)) { + } else { + break; + } + int const x_154 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_9 = x_154; + while (true) { + int const x_159 = i_9; + int const x_161 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_159 < x_161)) { + } else { + break; + } + int const x_165 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_10 = x_165; + while (true) { + int const x_170 = i_10; + int const x_172 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_170 < x_172)) { + } else { + break; + } + int const x_176 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_11 = x_176; + while (true) { + int const x_181 = i_11; + int const x_183 = x_10.x_GLF_uniform_int_values.arr[2].el; + if ((x_181 < x_183)) { + } else { + break; + } + int const x_187 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_12 = x_187; + while (true) { + int const x_192 = i_12; + int const x_194 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_192 < x_194)) { + } else { + break; + } + int const x_198 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_13 = x_198; + while (true) { + int const x_203 = i_13; + int const x_205 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_203 < x_205)) { + } else { + break; + } + int const x_209 = x_10.x_GLF_uniform_int_values.arr[1].el; + i_14 = x_209; + while (true) { + int const x_214 = i_14; + int const x_216 = x_10.x_GLF_uniform_int_values.arr[2].el; + if ((x_214 < x_216)) { + } else { + break; + } + while (true) { + int const x_223 = *(tint_symbol_4); + *(tint_symbol_4) = (x_223 + 1); + { + int const x_225 = *(tint_symbol_4); + int const x_227 = x_10.x_GLF_uniform_int_values.arr[3].el; + if ((x_225 < (100 - x_227))) { + } else { + break; + } + } + } + float const x_231 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_232 = f; + f = (x_232 + x_231); + { + int const x_234 = i_14; + i_14 = (x_234 + 1); + } + } + { + int const x_236 = i_13; + i_13 = (x_236 + 1); + } + } + { + int const x_238 = i_12; + i_12 = (x_238 + 1); + } + } + { + int const x_240 = i_11; + i_11 = (x_240 + 1); + } + } + { + int const x_242 = i_10; + i_10 = (x_242 + 1); + } + } + { + int const x_244 = i_9; + i_9 = (x_244 + 1); + } + } + { + int const x_246 = i_8; + i_8 = (x_246 + 1); + } + } + { + int const x_248 = i_7; + i_7 = (x_248 + 1); + } + } + { + int const x_250 = i_6; + i_6 = (x_250 + 1); + } + } + { + int const x_252 = i_5; + i_5 = (x_252 + 1); + } + } + { + int const x_254 = i_4; + i_4 = (x_254 + 1); + } + } + { + int const x_256 = i_3; + i_3 = (x_256 + 1); + } + } + { + int const x_258 = i_2; + i_2 = (x_258 + 1); + } + } + { + int const x_260 = i_1; + i_1 = (x_260 + 1); + } + } + { + int const x_262 = i; + i = (x_262 + 1); + } + } + float const x_265 = x_7.x_GLF_uniform_float_values.arr[1].el; + sum = x_265; + int const x_267 = x_10.x_GLF_uniform_int_values.arr[1].el; + r = x_267; + while (true) { + int const x_272 = *(tint_symbol_4); + if ((x_272 < 100)) { + } else { + break; + } + int const x_275 = *(tint_symbol_4); + *(tint_symbol_4) = (x_275 + 1); + float const x_277 = f; + float const x_278 = sum; + sum = (x_278 + x_277); + { + int const x_280 = r; + r = (x_280 + 1); + } + } + float const x_282 = sum; + float const x_284 = x_7.x_GLF_uniform_float_values.arr[2].el; + if ((x_282 == x_284)) { + int const x_290 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_293 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_296 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_299 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_290), float(x_293), float(x_296), float(x_299)); + } else { + int const x_303 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_304 = float(x_303); + *(tint_symbol_5) = float4(x_304, x_304, x_304, x_304); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_7, x_10, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8003194ff8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.spvasm @@ -0,0 +1,623 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 358 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_global_loop_count "x_GLF_global_loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %i "i" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %i_3 "i_3" + OpName %i_4 "i_4" + OpName %i_5 "i_5" + OpName %i_6 "i_6" + OpName %i_7 "i_7" + OpName %i_8 "i_8" + OpName %i_9 "i_9" + OpName %i_10 "i_10" + OpName %i_11 "i_11" + OpName %i_12 "i_12" + OpName %i_13 "i_13" + OpName %i_14 "i_14" + OpName %sum "sum" + OpName %r "r" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int +%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf0 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %20 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %20 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_100 = OpConstant %int 100 + %main_out = OpTypeStruct %v4float + %346 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %f = OpVariable %_ptr_Function_float Function %29 + %i = OpVariable %_ptr_Function_int Function %4 + %i_1 = OpVariable %_ptr_Function_int Function %4 + %i_2 = OpVariable %_ptr_Function_int Function %4 + %i_3 = OpVariable %_ptr_Function_int Function %4 + %i_4 = OpVariable %_ptr_Function_int Function %4 + %i_5 = OpVariable %_ptr_Function_int Function %4 + %i_6 = OpVariable %_ptr_Function_int Function %4 + %i_7 = OpVariable %_ptr_Function_int Function %4 + %i_8 = OpVariable %_ptr_Function_int Function %4 + %i_9 = OpVariable %_ptr_Function_int Function %4 + %i_10 = OpVariable %_ptr_Function_int Function %4 + %i_11 = OpVariable %_ptr_Function_int Function %4 + %i_12 = OpVariable %_ptr_Function_int Function %4 + %i_13 = OpVariable %_ptr_Function_int Function %4 + %i_14 = OpVariable %_ptr_Function_int Function %4 + %sum = OpVariable %_ptr_Function_float Function %29 + %r = OpVariable %_ptr_Function_int Function %4 + OpStore %x_GLF_global_loop_count %int_0 + %52 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %53 = OpLoad %float %52 + OpStore %f %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %56 = OpLoad %int %55 + OpStore %i %56 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %i + %62 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpSLessThan %bool %61 %63 + OpSelectionMerge %66 None + OpBranchConditional %64 %67 %68 + %67 = OpLabel + OpBranch %66 + %68 = OpLabel + OpBranch %58 + %66 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %70 = OpLoad %int %69 + OpStore %i_1 %70 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %int %i_1 + %76 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %77 = OpLoad %int %76 + %78 = OpSLessThan %bool %75 %77 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %81 + %80 = OpLabel + OpBranch %79 + %81 = OpLabel + OpBranch %72 + %79 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %83 = OpLoad %int %82 + OpStore %i_2 %83 + OpBranch %84 + %84 = OpLabel + OpLoopMerge %85 %86 None + OpBranch %87 + %87 = OpLabel + %88 = OpLoad %int %i_2 + %89 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %90 = OpLoad %int %89 + %91 = OpSLessThan %bool %88 %90 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %94 + %93 = OpLabel + OpBranch %92 + %94 = OpLabel + OpBranch %85 + %92 = OpLabel + %95 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %96 = OpLoad %int %95 + OpStore %i_3 %96 + OpBranch %97 + %97 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %101 = OpLoad %int %i_3 + %102 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %103 = OpLoad %int %102 + %104 = OpSLessThan %bool %101 %103 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %107 + %106 = OpLabel + OpBranch %105 + %107 = OpLabel + OpBranch %98 + %105 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %109 = OpLoad %int %108 + OpStore %i_4 %109 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %int %i_4 + %115 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %116 = OpLoad %int %115 + %117 = OpSLessThan %bool %114 %116 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %120 + %119 = OpLabel + OpBranch %118 + %120 = OpLabel + OpBranch %111 + %118 = OpLabel + %121 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %122 = OpLoad %int %121 + OpStore %i_5 %122 + OpBranch %123 + %123 = OpLabel + OpLoopMerge %124 %125 None + OpBranch %126 + %126 = OpLabel + %127 = OpLoad %int %i_5 + %128 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %129 = OpLoad %int %128 + %130 = OpSLessThan %bool %127 %129 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %133 + %132 = OpLabel + OpBranch %131 + %133 = OpLabel + OpBranch %124 + %131 = OpLabel + %134 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %135 = OpLoad %int %134 + OpStore %i_6 %135 + OpBranch %136 + %136 = OpLabel + OpLoopMerge %137 %138 None + OpBranch %139 + %139 = OpLabel + %140 = OpLoad %int %i_6 + %141 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %142 = OpLoad %int %141 + %143 = OpSLessThan %bool %140 %142 + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %146 + %145 = OpLabel + OpBranch %144 + %146 = OpLabel + OpBranch %137 + %144 = OpLabel + %147 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %148 = OpLoad %int %147 + OpStore %i_7 %148 + OpBranch %149 + %149 = OpLabel + OpLoopMerge %150 %151 None + OpBranch %152 + %152 = OpLabel + %153 = OpLoad %int %i_7 + %154 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %155 = OpLoad %int %154 + %156 = OpSLessThan %bool %153 %155 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %159 + %158 = OpLabel + OpBranch %157 + %159 = OpLabel + OpBranch %150 + %157 = OpLabel + %160 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %161 = OpLoad %int %160 + OpStore %i_8 %161 + OpBranch %162 + %162 = OpLabel + OpLoopMerge %163 %164 None + OpBranch %165 + %165 = OpLabel + %166 = OpLoad %int %i_8 + %167 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %168 = OpLoad %int %167 + %169 = OpSLessThan %bool %166 %168 + OpSelectionMerge %170 None + OpBranchConditional %169 %171 %172 + %171 = OpLabel + OpBranch %170 + %172 = OpLabel + OpBranch %163 + %170 = OpLabel + %173 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %174 = OpLoad %int %173 + OpStore %i_9 %174 + OpBranch %175 + %175 = OpLabel + OpLoopMerge %176 %177 None + OpBranch %178 + %178 = OpLabel + %179 = OpLoad %int %i_9 + %180 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %181 = OpLoad %int %180 + %182 = OpSLessThan %bool %179 %181 + OpSelectionMerge %183 None + OpBranchConditional %182 %184 %185 + %184 = OpLabel + OpBranch %183 + %185 = OpLabel + OpBranch %176 + %183 = OpLabel + %186 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %187 = OpLoad %int %186 + OpStore %i_10 %187 + OpBranch %188 + %188 = OpLabel + OpLoopMerge %189 %190 None + OpBranch %191 + %191 = OpLabel + %192 = OpLoad %int %i_10 + %193 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %194 = OpLoad %int %193 + %195 = OpSLessThan %bool %192 %194 + OpSelectionMerge %196 None + OpBranchConditional %195 %197 %198 + %197 = OpLabel + OpBranch %196 + %198 = OpLabel + OpBranch %189 + %196 = OpLabel + %199 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %200 = OpLoad %int %199 + OpStore %i_11 %200 + OpBranch %201 + %201 = OpLabel + OpLoopMerge %202 %203 None + OpBranch %204 + %204 = OpLabel + %205 = OpLoad %int %i_11 + %207 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %208 = OpLoad %int %207 + %209 = OpSLessThan %bool %205 %208 + OpSelectionMerge %210 None + OpBranchConditional %209 %211 %212 + %211 = OpLabel + OpBranch %210 + %212 = OpLabel + OpBranch %202 + %210 = OpLabel + %213 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %214 = OpLoad %int %213 + OpStore %i_12 %214 + OpBranch %215 + %215 = OpLabel + OpLoopMerge %216 %217 None + OpBranch %218 + %218 = OpLabel + %219 = OpLoad %int %i_12 + %220 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %221 = OpLoad %int %220 + %222 = OpSLessThan %bool %219 %221 + OpSelectionMerge %223 None + OpBranchConditional %222 %224 %225 + %224 = OpLabel + OpBranch %223 + %225 = OpLabel + OpBranch %216 + %223 = OpLabel + %226 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %227 = OpLoad %int %226 + OpStore %i_13 %227 + OpBranch %228 + %228 = OpLabel + OpLoopMerge %229 %230 None + OpBranch %231 + %231 = OpLabel + %232 = OpLoad %int %i_13 + %233 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %234 = OpLoad %int %233 + %235 = OpSLessThan %bool %232 %234 + OpSelectionMerge %236 None + OpBranchConditional %235 %237 %238 + %237 = OpLabel + OpBranch %236 + %238 = OpLabel + OpBranch %229 + %236 = OpLabel + %239 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %240 = OpLoad %int %239 + OpStore %i_14 %240 + OpBranch %241 + %241 = OpLabel + OpLoopMerge %242 %243 None + OpBranch %244 + %244 = OpLabel + %245 = OpLoad %int %i_14 + %246 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %247 = OpLoad %int %246 + %248 = OpSLessThan %bool %245 %247 + OpSelectionMerge %249 None + OpBranchConditional %248 %250 %251 + %250 = OpLabel + OpBranch %249 + %251 = OpLabel + OpBranch %242 + %249 = OpLabel + OpBranch %252 + %252 = OpLabel + OpLoopMerge %253 %254 None + OpBranch %255 + %255 = OpLabel + %256 = OpLoad %int %x_GLF_global_loop_count + %257 = OpIAdd %int %256 %int_1 + OpStore %x_GLF_global_loop_count %257 + OpBranch %254 + %254 = OpLabel + %258 = OpLoad %int %x_GLF_global_loop_count + %260 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %261 = OpLoad %int %260 + %263 = OpISub %int %int_100 %261 + %264 = OpSLessThan %bool %258 %263 + OpSelectionMerge %265 None + OpBranchConditional %264 %266 %267 + %266 = OpLabel + OpBranch %265 + %267 = OpLabel + OpBranch %253 + %265 = OpLabel + OpBranch %252 + %253 = OpLabel + %268 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %269 = OpLoad %float %268 + %270 = OpLoad %float %f + %271 = OpFAdd %float %270 %269 + OpStore %f %271 + OpBranch %243 + %243 = OpLabel + %272 = OpLoad %int %i_14 + %273 = OpIAdd %int %272 %int_1 + OpStore %i_14 %273 + OpBranch %241 + %242 = OpLabel + OpBranch %230 + %230 = OpLabel + %274 = OpLoad %int %i_13 + %275 = OpIAdd %int %274 %int_1 + OpStore %i_13 %275 + OpBranch %228 + %229 = OpLabel + OpBranch %217 + %217 = OpLabel + %276 = OpLoad %int %i_12 + %277 = OpIAdd %int %276 %int_1 + OpStore %i_12 %277 + OpBranch %215 + %216 = OpLabel + OpBranch %203 + %203 = OpLabel + %278 = OpLoad %int %i_11 + %279 = OpIAdd %int %278 %int_1 + OpStore %i_11 %279 + OpBranch %201 + %202 = OpLabel + OpBranch %190 + %190 = OpLabel + %280 = OpLoad %int %i_10 + %281 = OpIAdd %int %280 %int_1 + OpStore %i_10 %281 + OpBranch %188 + %189 = OpLabel + OpBranch %177 + %177 = OpLabel + %282 = OpLoad %int %i_9 + %283 = OpIAdd %int %282 %int_1 + OpStore %i_9 %283 + OpBranch %175 + %176 = OpLabel + OpBranch %164 + %164 = OpLabel + %284 = OpLoad %int %i_8 + %285 = OpIAdd %int %284 %int_1 + OpStore %i_8 %285 + OpBranch %162 + %163 = OpLabel + OpBranch %151 + %151 = OpLabel + %286 = OpLoad %int %i_7 + %287 = OpIAdd %int %286 %int_1 + OpStore %i_7 %287 + OpBranch %149 + %150 = OpLabel + OpBranch %138 + %138 = OpLabel + %288 = OpLoad %int %i_6 + %289 = OpIAdd %int %288 %int_1 + OpStore %i_6 %289 + OpBranch %136 + %137 = OpLabel + OpBranch %125 + %125 = OpLabel + %290 = OpLoad %int %i_5 + %291 = OpIAdd %int %290 %int_1 + OpStore %i_5 %291 + OpBranch %123 + %124 = OpLabel + OpBranch %112 + %112 = OpLabel + %292 = OpLoad %int %i_4 + %293 = OpIAdd %int %292 %int_1 + OpStore %i_4 %293 + OpBranch %110 + %111 = OpLabel + OpBranch %99 + %99 = OpLabel + %294 = OpLoad %int %i_3 + %295 = OpIAdd %int %294 %int_1 + OpStore %i_3 %295 + OpBranch %97 + %98 = OpLabel + OpBranch %86 + %86 = OpLabel + %296 = OpLoad %int %i_2 + %297 = OpIAdd %int %296 %int_1 + OpStore %i_2 %297 + OpBranch %84 + %85 = OpLabel + OpBranch %73 + %73 = OpLabel + %298 = OpLoad %int %i_1 + %299 = OpIAdd %int %298 %int_1 + OpStore %i_1 %299 + OpBranch %71 + %72 = OpLabel + OpBranch %59 + %59 = OpLabel + %300 = OpLoad %int %i + %301 = OpIAdd %int %300 %int_1 + OpStore %i %301 + OpBranch %57 + %58 = OpLabel + %302 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %303 = OpLoad %float %302 + OpStore %sum %303 + %304 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %305 = OpLoad %int %304 + OpStore %r %305 + OpBranch %306 + %306 = OpLabel + OpLoopMerge %307 %308 None + OpBranch %309 + %309 = OpLabel + %310 = OpLoad %int %x_GLF_global_loop_count + %311 = OpSLessThan %bool %310 %int_100 + OpSelectionMerge %312 None + OpBranchConditional %311 %313 %314 + %313 = OpLabel + OpBranch %312 + %314 = OpLabel + OpBranch %307 + %312 = OpLabel + %315 = OpLoad %int %x_GLF_global_loop_count + %316 = OpIAdd %int %315 %int_1 + OpStore %x_GLF_global_loop_count %316 + %317 = OpLoad %float %f + %318 = OpLoad %float %sum + %319 = OpFAdd %float %318 %317 + OpStore %sum %319 + OpBranch %308 + %308 = OpLabel + %320 = OpLoad %int %r + %321 = OpIAdd %int %320 %int_1 + OpStore %r %321 + OpBranch %306 + %307 = OpLabel + %322 = OpLoad %float %sum + %323 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %324 = OpLoad %float %323 + %325 = OpFOrdEqual %bool %322 %324 + OpSelectionMerge %326 None + OpBranchConditional %325 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %330 = OpLoad %int %329 + %331 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %332 = OpLoad %int %331 + %333 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %334 = OpLoad %int %333 + %335 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %336 = OpLoad %int %335 + %337 = OpConvertSToF %float %330 + %338 = OpConvertSToF %float %332 + %339 = OpConvertSToF %float %334 + %340 = OpConvertSToF %float %336 + %341 = OpCompositeConstruct %v4float %337 %338 %339 %340 + OpStore %x_GLF_color %341 + OpBranch %326 + %328 = OpLabel + %342 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %343 = OpLoad %int %342 + %344 = OpConvertSToF %float %343 + %345 = OpCompositeConstruct %v4float %344 %344 %344 %344 + OpStore %x_GLF_color %345 + OpBranch %326 + %326 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %346 +%tint_symbol = OpFunctionParameter %main_out + %350 = OpLabel + %351 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %351 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %353 = OpLabel + %354 = OpFunctionCall %void %main_1 + %356 = OpLoad %v4float %x_GLF_color + %357 = OpCompositeConstruct %main_out %356 + %355 = OpFunctionCall %void %tint_symbol_2 %357 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 254[%254] is not post dominated by the back-edge block 265[%265] + %265 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ed88017ccf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.wgsl @@ -0,0 +1,332 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_global_loop_count : i32; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var i_3 : i32; + var i_4 : i32; + var i_5 : i32; + var i_6 : i32; + var i_7 : i32; + var i_8 : i32; + var i_9 : i32; + var i_10 : i32; + var i_11 : i32; + var i_12 : i32; + var i_13 : i32; + var i_14 : i32; + var sum : f32; + var r : i32; + x_GLF_global_loop_count = 0; + let x_53 : f32 = x_7.x_GLF_uniform_float_values[1]; + f = x_53; + let x_55 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_55; + loop { + let x_60 : i32 = i; + let x_62 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_60 < x_62)) { + } else { + break; + } + let x_66 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_1 = x_66; + loop { + let x_71 : i32 = i_1; + let x_73 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_71 < x_73)) { + } else { + break; + } + let x_77 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_2 = x_77; + loop { + let x_82 : i32 = i_2; + let x_84 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_82 < x_84)) { + } else { + break; + } + let x_88 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_3 = x_88; + loop { + let x_93 : i32 = i_3; + let x_95 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_93 < x_95)) { + } else { + break; + } + let x_99 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_4 = x_99; + loop { + let x_104 : i32 = i_4; + let x_106 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_104 < x_106)) { + } else { + break; + } + let x_110 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_5 = x_110; + loop { + let x_115 : i32 = i_5; + let x_117 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_115 < x_117)) { + } else { + break; + } + let x_121 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_6 = x_121; + loop { + let x_126 : i32 = i_6; + let x_128 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_126 < x_128)) { + } else { + break; + } + let x_132 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_7 = x_132; + loop { + let x_137 : i32 = i_7; + let x_139 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_137 < x_139)) { + } else { + break; + } + let x_143 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_8 = x_143; + loop { + let x_148 : i32 = i_8; + let x_150 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_148 < x_150)) { + } else { + break; + } + let x_154 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_9 = x_154; + loop { + let x_159 : i32 = i_9; + let x_161 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_159 < x_161)) { + } else { + break; + } + let x_165 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_10 = x_165; + loop { + let x_170 : i32 = i_10; + let x_172 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_170 < x_172)) { + } else { + break; + } + let x_176 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_11 = x_176; + loop { + let x_181 : i32 = i_11; + let x_183 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_181 < x_183)) { + } else { + break; + } + let x_187 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_12 = x_187; + loop { + let x_192 : i32 = i_12; + let x_194 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_192 < x_194)) { + } else { + break; + } + let x_198 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_13 = x_198; + loop { + let x_203 : i32 = i_13; + let x_205 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_203 < x_205)) { + } else { + break; + } + let x_209 : i32 = x_10.x_GLF_uniform_int_values[1]; + i_14 = x_209; + loop { + let x_214 : i32 = i_14; + let x_216 : i32 = x_10.x_GLF_uniform_int_values[2]; + if ((x_214 < x_216)) { + } else { + break; + } + loop { + let x_223 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_223 + 1); + + continuing { + let x_225 : i32 = x_GLF_global_loop_count; + let x_227 : i32 = x_10.x_GLF_uniform_int_values[3]; + if ((x_225 < (100 - x_227))) { + } else { + break; + } + } + } + let x_231 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_232 : f32 = f; + f = (x_232 + x_231); + + continuing { + let x_234 : i32 = i_14; + i_14 = (x_234 + 1); + } + } + + continuing { + let x_236 : i32 = i_13; + i_13 = (x_236 + 1); + } + } + + continuing { + let x_238 : i32 = i_12; + i_12 = (x_238 + 1); + } + } + + continuing { + let x_240 : i32 = i_11; + i_11 = (x_240 + 1); + } + } + + continuing { + let x_242 : i32 = i_10; + i_10 = (x_242 + 1); + } + } + + continuing { + let x_244 : i32 = i_9; + i_9 = (x_244 + 1); + } + } + + continuing { + let x_246 : i32 = i_8; + i_8 = (x_246 + 1); + } + } + + continuing { + let x_248 : i32 = i_7; + i_7 = (x_248 + 1); + } + } + + continuing { + let x_250 : i32 = i_6; + i_6 = (x_250 + 1); + } + } + + continuing { + let x_252 : i32 = i_5; + i_5 = (x_252 + 1); + } + } + + continuing { + let x_254 : i32 = i_4; + i_4 = (x_254 + 1); + } + } + + continuing { + let x_256 : i32 = i_3; + i_3 = (x_256 + 1); + } + } + + continuing { + let x_258 : i32 = i_2; + i_2 = (x_258 + 1); + } + } + + continuing { + let x_260 : i32 = i_1; + i_1 = (x_260 + 1); + } + } + + continuing { + let x_262 : i32 = i; + i = (x_262 + 1); + } + } + let x_265 : f32 = x_7.x_GLF_uniform_float_values[1]; + sum = x_265; + let x_267 : i32 = x_10.x_GLF_uniform_int_values[1]; + r = x_267; + loop { + let x_272 : i32 = x_GLF_global_loop_count; + if ((x_272 < 100)) { + } else { + break; + } + let x_275 : i32 = x_GLF_global_loop_count; + x_GLF_global_loop_count = (x_275 + 1); + let x_277 : f32 = f; + let x_278 : f32 = sum; + sum = (x_278 + x_277); + + continuing { + let x_280 : i32 = r; + r = (x_280 + 1); + } + } + let x_282 : f32 = sum; + let x_284 : f32 = x_7.x_GLF_uniform_float_values[2]; + if ((x_282 == x_284)) { + let x_290 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_293 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_296 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_299 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_290), f32(x_293), f32(x_296), f32(x_299)); + } else { + let x_303 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_304 : f32 = f32(x_303); + x_GLF_color = vec4(x_304, x_304, x_304, x_304); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm new file mode 100644 index 0000000000..3ea248113f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm @@ -0,0 +1,248 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %A "A" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %ref "ref" + OpName %a "a" + OpName %i "i" + OpName %ok "ok" + OpName %i_0 "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_19 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_17 = OpConstant %uint 17 +%_arr_int_uint_17 = OpTypeArray %int %uint_17 +%_ptr_Function__arr_int_uint_17 = OpTypePointer Function %_arr_int_uint_17 + %uint_19 = OpConstant %uint 19 +%_arr_int_uint_19 = OpTypeArray %int %uint_19 + %buf0 = OpTypeStruct %_arr_int_uint_19 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %int_11 = OpConstant %int 11 + %int_12 = OpConstant %int 12 + %int_13 = OpConstant %int 13 + %int_14 = OpConstant %int 14 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %int_17 = OpConstant %int 17 + %int_18 = OpConstant %int 18 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %50 = OpLabel + %A = OpVariable %_ptr_Function__arr_int_uint_17 Function + %ref = OpVariable %_ptr_Function__arr_int_uint_17 Function + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %ok = OpVariable %_ptr_Function_bool Function + %i_0 = OpVariable %_ptr_Function_int Function + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %56 = OpLoad %int %55 + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %70 = OpLoad %int %69 + %71 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %84 = OpLoad %int %83 + %85 = OpCompositeConstruct %_arr_int_uint_17 %52 %54 %56 %58 %60 %62 %64 %66 %68 %70 %72 %74 %76 %78 %80 %82 %84 + OpStore %A %85 + %86 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %91 = OpLoad %int %90 + %92 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %93 = OpLoad %int %92 + %94 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_7 + %95 = OpLoad %int %94 + %96 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %97 = OpLoad %int %96 + %98 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_9 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_10 + %101 = OpLoad %int %100 + %102 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_11 + %103 = OpLoad %int %102 + %104 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_12 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_13 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_14 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_15 + %111 = OpLoad %int %110 + %112 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_16 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_17 + %115 = OpLoad %int %114 + %116 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_18 + %117 = OpLoad %int %116 + %118 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %119 = OpLoad %int %118 + %120 = OpCompositeConstruct %_arr_int_uint_17 %87 %89 %91 %93 %95 %97 %99 %101 %103 %105 %107 %109 %111 %113 %115 %117 %119 + OpStore %ref %120 + %121 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %122 = OpLoad %int %121 + OpStore %a %122 + %123 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %124 = OpLoad %int %123 + OpStore %i %124 + OpBranch %125 + %125 = OpLabel + OpLoopMerge %126 %127 None + OpBranch %128 + %128 = OpLabel + %129 = OpLoad %int %i + %130 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %131 = OpLoad %int %130 + %132 = OpSLessThan %bool %129 %131 + OpBranchConditional %132 %133 %126 + %133 = OpLabel + %134 = OpLoad %int %i + %135 = OpLoad %int %a + %136 = OpISub %int %135 %int_1 + OpStore %a %136 + %137 = OpAccessChain %_ptr_Function_int %A %134 + OpStore %137 %135 + %138 = OpLoad %int %i + %139 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %140 = OpLoad %int %139 + %141 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_18 + %142 = OpLoad %int %141 + %143 = OpExtInst %int %1 SClamp %138 %140 %142 + %144 = OpLoad %int %i + %145 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %146 = OpLoad %int %145 + %147 = OpIAdd %int %144 %146 + %148 = OpAccessChain %_ptr_Function_int %A %143 + OpStore %148 %147 + OpBranch %127 + %127 = OpLabel + %149 = OpLoad %int %i + %150 = OpIAdd %int %149 %int_1 + OpStore %i %150 + OpBranch %125 + %126 = OpLabel + OpStore %ok %true + %151 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %152 = OpLoad %int %151 + OpStore %i_0 %152 + OpBranch %153 + %153 = OpLabel + OpLoopMerge %154 %155 None + OpBranch %156 + %156 = OpLabel + %157 = OpLoad %int %i_0 + %158 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %159 = OpLoad %int %158 + %160 = OpSLessThan %bool %157 %159 + OpBranchConditional %160 %161 %154 + %161 = OpLabel + %162 = OpLoad %int %i_0 + %163 = OpAccessChain %_ptr_Function_int %A %162 + %164 = OpLoad %int %163 + %165 = OpLoad %int %i_0 + %166 = OpAccessChain %_ptr_Function_int %ref %165 + %167 = OpLoad %int %166 + %168 = OpINotEqual %bool %164 %167 + OpSelectionMerge %169 None + OpBranchConditional %168 %170 %169 + %170 = OpLabel + OpStore %ok %false + OpBranch %169 + %169 = OpLabel + OpBranch %155 + %155 = OpLabel + %171 = OpLoad %int %i_0 + %172 = OpIAdd %int %171 %int_1 + OpStore %i_0 %172 + OpBranch %153 + %154 = OpLabel + %173 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %174 = OpLoad %int %173 + %175 = OpConvertSToF %float %174 + %176 = OpCompositeConstruct %v4float %175 %175 %175 %175 + OpStore %_GLF_color %176 + %177 = OpLoad %bool %ok + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %178 + %179 = OpLabel + %180 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %181 = OpLoad %int %180 + %182 = OpConvertSToF %float %181 + %183 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %184 = OpLoad %int %183 + %185 = OpConvertSToF %float %184 + %186 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %187 = OpLoad %int %186 + %188 = OpConvertSToF %float %187 + %189 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %190 = OpLoad %int %189 + %191 = OpConvertSToF %float %190 + %192 = OpCompositeConstruct %v4float %182 %185 %188 %191 + OpStore %_GLF_color %192 + OpBranch %178 + %178 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9e560db651 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.hlsl @@ -0,0 +1,120 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[19]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int A[17] = (int[17])0; + int ref[17] = (int[17])0; + int a = 0; + int i = 0; + bool ok = false; + int i_1 = 0; + const int x_52 = asint(x_6[2].x); + const int x_54 = asint(x_6[2].x); + const int x_56 = asint(x_6[2].x); + const int x_58 = asint(x_6[2].x); + const int x_60 = asint(x_6[2].x); + const int x_62 = asint(x_6[2].x); + const int x_64 = asint(x_6[2].x); + const int x_66 = asint(x_6[2].x); + const int x_68 = asint(x_6[2].x); + const int x_70 = asint(x_6[2].x); + const int x_72 = asint(x_6[2].x); + const int x_74 = asint(x_6[2].x); + const int x_76 = asint(x_6[2].x); + const int x_78 = asint(x_6[2].x); + const int x_80 = asint(x_6[2].x); + const int x_82 = asint(x_6[2].x); + const int x_84 = asint(x_6[2].x); + const int tint_symbol_3[17] = {x_52, x_54, x_56, x_58, x_60, x_62, x_64, x_66, x_68, x_70, x_72, x_74, x_76, x_78, x_80, x_82, x_84}; + A = tint_symbol_3; + const int x_87 = asint(x_6[3].x); + const int x_89 = asint(x_6[4].x); + const int x_91 = asint(x_6[5].x); + const int x_93 = asint(x_6[6].x); + const int x_95 = asint(x_6[7].x); + const int x_97 = asint(x_6[8].x); + const int x_99 = asint(x_6[9].x); + const int x_101 = asint(x_6[10].x); + const int x_103 = asint(x_6[11].x); + const int x_105 = asint(x_6[12].x); + const int x_107 = asint(x_6[13].x); + const int x_109 = asint(x_6[14].x); + const int x_111 = asint(x_6[15].x); + const int x_113 = asint(x_6[16].x); + const int x_115 = asint(x_6[17].x); + const int x_117 = asint(x_6[18].x); + const int x_119 = asint(x_6[1].x); + const int tint_symbol_4[17] = {x_87, x_89, x_91, x_93, x_95, x_97, x_99, x_101, x_103, x_105, x_107, x_109, x_111, x_113, x_115, x_117, x_119}; + ref = tint_symbol_4; + const int x_122 = asint(x_6[2].x); + a = x_122; + const int x_124 = asint(x_6[2].x); + i = x_124; + while (true) { + const int x_129 = i; + const int x_131 = asint(x_6[1].x); + if ((x_129 < x_131)) { + } else { + break; + } + const int x_134 = i; + const int x_135 = a; + a = (x_135 - 1); + A[x_134] = x_135; + const int x_138 = i; + const int x_140 = asint(x_6[2].x); + const int x_142 = asint(x_6[18].x); + const int x_144 = i; + const int x_146 = asint(x_6[3].x); + A[clamp(x_138, x_140, x_142)] = (x_144 + x_146); + { + i = (i + 1); + } + } + ok = true; + const int x_152 = asint(x_6[2].x); + i_1 = x_152; + while (true) { + const int x_157 = i_1; + const int x_159 = asint(x_6[1].x); + if ((x_157 < x_159)) { + } else { + break; + } + const int x_164 = A[i_1]; + const int x_167 = ref[i_1]; + if ((x_164 != x_167)) { + ok = false; + } + { + i_1 = (i_1 + 1); + } + } + const int x_174 = asint(x_6[2].x); + const float x_175 = float(x_174); + x_GLF_color = float4(x_175, x_175, x_175, x_175); + if (ok) { + const int x_181 = asint(x_6[3].x); + const int x_184 = asint(x_6[2].x); + const int x_187 = asint(x_6[2].x); + const int x_190 = asint(x_6[3].x); + x_GLF_color = float4(float(x_181), float(x_184), float(x_187), float(x_190)); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..5993503ba7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.msl @@ -0,0 +1,138 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[19]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[17]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6) { + tint_array_wrapper_1 A = {}; + tint_array_wrapper_1 ref = {}; + int a = 0; + int i = 0; + bool ok = false; + int i_1 = 0; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_54 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_58 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_68 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_70 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_72 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_74 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_76 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_78 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_80 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_82 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_84 = x_6.x_GLF_uniform_int_values.arr[2].el; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_52, x_54, x_56, x_58, x_60, x_62, x_64, x_66, x_68, x_70, x_72, x_74, x_76, x_78, x_80, x_82, x_84}}; + A = tint_symbol_3; + int const x_87 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_89 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_91 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_93 = x_6.x_GLF_uniform_int_values.arr[6].el; + int const x_95 = x_6.x_GLF_uniform_int_values.arr[7].el; + int const x_97 = x_6.x_GLF_uniform_int_values.arr[8].el; + int const x_99 = x_6.x_GLF_uniform_int_values.arr[9].el; + int const x_101 = x_6.x_GLF_uniform_int_values.arr[10].el; + int const x_103 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_105 = x_6.x_GLF_uniform_int_values.arr[12].el; + int const x_107 = x_6.x_GLF_uniform_int_values.arr[13].el; + int const x_109 = x_6.x_GLF_uniform_int_values.arr[14].el; + int const x_111 = x_6.x_GLF_uniform_int_values.arr[15].el; + int const x_113 = x_6.x_GLF_uniform_int_values.arr[16].el; + int const x_115 = x_6.x_GLF_uniform_int_values.arr[17].el; + int const x_117 = x_6.x_GLF_uniform_int_values.arr[18].el; + int const x_119 = x_6.x_GLF_uniform_int_values.arr[1].el; + tint_array_wrapper_1 const tint_symbol_4 = {.arr={x_87, x_89, x_91, x_93, x_95, x_97, x_99, x_101, x_103, x_105, x_107, x_109, x_111, x_113, x_115, x_117, x_119}}; + ref = tint_symbol_4; + int const x_122 = x_6.x_GLF_uniform_int_values.arr[2].el; + a = x_122; + int const x_124 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_124; + while (true) { + int const x_129 = i; + int const x_131 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_129 < x_131)) { + } else { + break; + } + int const x_134 = i; + int const x_135 = a; + a = (x_135 - 1); + A.arr[x_134] = x_135; + int const x_138 = i; + int const x_140 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_142 = x_6.x_GLF_uniform_int_values.arr[18].el; + int const x_144 = i; + int const x_146 = x_6.x_GLF_uniform_int_values.arr[3].el; + A.arr[clamp(x_138, x_140, x_142)] = (x_144 + x_146); + { + int const x_149 = i; + i = (x_149 + 1); + } + } + ok = true; + int const x_152 = x_6.x_GLF_uniform_int_values.arr[2].el; + i_1 = x_152; + while (true) { + int const x_157 = i_1; + int const x_159 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_157 < x_159)) { + } else { + break; + } + int const x_162 = i_1; + int const x_164 = A.arr[x_162]; + int const x_165 = i_1; + int const x_167 = ref.arr[x_165]; + if ((x_164 != x_167)) { + ok = false; + } + { + int const x_171 = i_1; + i_1 = (x_171 + 1); + } + } + int const x_174 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_175 = float(x_174); + *(tint_symbol_6) = float4(x_175, x_175, x_175, x_175); + bool const x_177 = ok; + if (x_177) { + int const x_181 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_184 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_187 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_190 = x_6.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_6) = float4(float(x_181), float(x_184), float(x_187), float(x_190)); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + main_1(x_6, &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..794d877e27 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.spvasm @@ -0,0 +1,294 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 215 +; Schema: 0 + OpCapability Shader + %152 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %A "A" + OpName %ref "ref" + OpName %a "a" + OpName %i "i" + OpName %ok "ok" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_19 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_17 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_19 = OpConstant %uint 19 +%_arr_int_uint_19 = OpTypeArray %int %uint_19 + %buf0 = OpTypeStruct %_arr_int_uint_19 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_17 = OpConstant %uint 17 +%_arr_int_uint_17 = OpTypeArray %int %uint_17 +%_ptr_Function__arr_int_uint_17 = OpTypePointer Function %_arr_int_uint_17 + %23 = OpConstantNull %_arr_int_uint_17 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %32 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %int_11 = OpConstant %int 11 + %int_12 = OpConstant %int 12 + %int_13 = OpConstant %int 13 + %int_14 = OpConstant %int 14 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %int_17 = OpConstant %int 17 + %int_18 = OpConstant %int 18 + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %203 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %A = OpVariable %_ptr_Function__arr_int_uint_17 Function %23 + %ref = OpVariable %_ptr_Function__arr_int_uint_17 Function %23 + %a = OpVariable %_ptr_Function_int Function %27 + %i = OpVariable %_ptr_Function_int Function %27 + %ok = OpVariable %_ptr_Function_bool Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %27 + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %38 = OpLoad %int %37 + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %40 = OpLoad %int %39 + %41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %42 = OpLoad %int %41 + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %44 = OpLoad %int %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %56 = OpLoad %int %55 + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %70 = OpLoad %int %69 + %71 = OpCompositeConstruct %_arr_int_uint_17 %38 %40 %42 %44 %46 %48 %50 %52 %54 %56 %58 %60 %62 %64 %66 %68 %70 + OpStore %A %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %74 = OpLoad %int %73 + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %77 = OpLoad %int %76 + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %80 = OpLoad %int %79 + %82 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %83 = OpLoad %int %82 + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_7 + %86 = OpLoad %int %85 + %88 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_8 + %89 = OpLoad %int %88 + %91 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %92 = OpLoad %int %91 + %94 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_10 + %95 = OpLoad %int %94 + %97 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %98 = OpLoad %int %97 + %100 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_12 + %101 = OpLoad %int %100 + %103 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_13 + %104 = OpLoad %int %103 + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_14 + %107 = OpLoad %int %106 + %109 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_15 + %110 = OpLoad %int %109 + %112 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_16 + %113 = OpLoad %int %112 + %115 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_17 + %116 = OpLoad %int %115 + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_18 + %119 = OpLoad %int %118 + %121 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %122 = OpLoad %int %121 + %123 = OpCompositeConstruct %_arr_int_uint_17 %74 %77 %80 %83 %86 %89 %92 %95 %98 %101 %104 %107 %110 %113 %116 %119 %122 + OpStore %ref %123 + %124 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %125 = OpLoad %int %124 + OpStore %a %125 + %126 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %127 = OpLoad %int %126 + OpStore %i %127 + OpBranch %128 + %128 = OpLabel + OpLoopMerge %129 %130 None + OpBranch %131 + %131 = OpLabel + %132 = OpLoad %int %i + %133 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %134 = OpLoad %int %133 + %135 = OpSLessThan %bool %132 %134 + OpSelectionMerge %136 None + OpBranchConditional %135 %137 %138 + %137 = OpLabel + OpBranch %136 + %138 = OpLabel + OpBranch %129 + %136 = OpLabel + %139 = OpLoad %int %i + %140 = OpLoad %int %a + %141 = OpISub %int %140 %int_1 + OpStore %a %141 + %142 = OpAccessChain %_ptr_Function_int %A %139 + OpStore %142 %140 + %143 = OpLoad %int %i + %144 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %145 = OpLoad %int %144 + %146 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_18 + %147 = OpLoad %int %146 + %148 = OpLoad %int %i + %149 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %150 = OpLoad %int %149 + %151 = OpExtInst %int %152 SClamp %143 %145 %147 + %153 = OpAccessChain %_ptr_Function_int %A %151 + %154 = OpIAdd %int %148 %150 + OpStore %153 %154 + OpBranch %130 + %130 = OpLabel + %155 = OpLoad %int %i + %156 = OpIAdd %int %155 %int_1 + OpStore %i %156 + OpBranch %128 + %129 = OpLabel + OpStore %ok %true + %158 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %159 = OpLoad %int %158 + OpStore %i_1 %159 + OpBranch %160 + %160 = OpLabel + OpLoopMerge %161 %162 None + OpBranch %163 + %163 = OpLabel + %164 = OpLoad %int %i_1 + %165 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %166 = OpLoad %int %165 + %167 = OpSLessThan %bool %164 %166 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %161 + %168 = OpLabel + %171 = OpLoad %int %i_1 + %172 = OpAccessChain %_ptr_Function_int %A %171 + %173 = OpLoad %int %172 + %174 = OpLoad %int %i_1 + %175 = OpAccessChain %_ptr_Function_int %ref %174 + %176 = OpLoad %int %175 + %177 = OpINotEqual %bool %173 %176 + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %178 + %179 = OpLabel + OpStore %ok %false + OpBranch %178 + %178 = OpLabel + OpBranch %162 + %162 = OpLabel + %181 = OpLoad %int %i_1 + %182 = OpIAdd %int %181 %int_1 + OpStore %i_1 %182 + OpBranch %160 + %161 = OpLabel + %183 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %184 = OpLoad %int %183 + %185 = OpConvertSToF %float %184 + %186 = OpCompositeConstruct %v4float %185 %185 %185 %185 + OpStore %x_GLF_color %186 + %187 = OpLoad %bool %ok + OpSelectionMerge %188 None + OpBranchConditional %187 %189 %188 + %189 = OpLabel + %190 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %191 = OpLoad %int %190 + %192 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %193 = OpLoad %int %192 + %194 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %195 = OpLoad %int %194 + %196 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %197 = OpLoad %int %196 + %198 = OpConvertSToF %float %191 + %199 = OpConvertSToF %float %193 + %200 = OpConvertSToF %float %195 + %201 = OpConvertSToF %float %197 + %202 = OpCompositeConstruct %v4float %198 %199 %200 %201 + OpStore %x_GLF_color %202 + OpBranch %188 + %188 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %203 +%tint_symbol = OpFunctionParameter %main_out + %207 = OpLabel + %208 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %208 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %210 = OpLabel + %211 = OpFunctionCall %void %main_1 + %213 = OpLoad %v4float %x_GLF_color + %214 = OpCompositeConstruct %main_out %213 + %212 = OpFunctionCall %void %tint_symbol_2 %214 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..464bdec16f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.spvasm.expected.wgsl @@ -0,0 +1,128 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A : array; + var ref : array; + var a : i32; + var i : i32; + var ok : bool; + var i_1 : i32; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_68 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_70 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_72 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_74 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_76 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_80 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_82 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[2]; + A = array(x_52, x_54, x_56, x_58, x_60, x_62, x_64, x_66, x_68, x_70, x_72, x_74, x_76, x_78, x_80, x_82, x_84); + let x_87 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_89 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_91 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_93 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_95 : i32 = x_6.x_GLF_uniform_int_values[7]; + let x_97 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_99 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_101 : i32 = x_6.x_GLF_uniform_int_values[10]; + let x_103 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_105 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_107 : i32 = x_6.x_GLF_uniform_int_values[13]; + let x_109 : i32 = x_6.x_GLF_uniform_int_values[14]; + let x_111 : i32 = x_6.x_GLF_uniform_int_values[15]; + let x_113 : i32 = x_6.x_GLF_uniform_int_values[16]; + let x_115 : i32 = x_6.x_GLF_uniform_int_values[17]; + let x_117 : i32 = x_6.x_GLF_uniform_int_values[18]; + let x_119 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref = array(x_87, x_89, x_91, x_93, x_95, x_97, x_99, x_101, x_103, x_105, x_107, x_109, x_111, x_113, x_115, x_117, x_119); + let x_122 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_122; + let x_124 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_124; + loop { + let x_129 : i32 = i; + let x_131 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_129 < x_131)) { + } else { + break; + } + let x_134 : i32 = i; + let x_135 : i32 = a; + a = (x_135 - 1); + A[x_134] = x_135; + let x_138 : i32 = i; + let x_140 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_142 : i32 = x_6.x_GLF_uniform_int_values[18]; + let x_144 : i32 = i; + let x_146 : i32 = x_6.x_GLF_uniform_int_values[3]; + A[clamp(x_138, x_140, x_142)] = (x_144 + x_146); + + continuing { + let x_149 : i32 = i; + i = (x_149 + 1); + } + } + ok = true; + let x_152 : i32 = x_6.x_GLF_uniform_int_values[2]; + i_1 = x_152; + loop { + let x_157 : i32 = i_1; + let x_159 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_157 < x_159)) { + } else { + break; + } + let x_162 : i32 = i_1; + let x_164 : i32 = A[x_162]; + let x_165 : i32 = i_1; + let x_167 : i32 = ref[x_165]; + if ((x_164 != x_167)) { + ok = false; + } + + continuing { + let x_171 : i32 = i_1; + i_1 = (x_171 + 1); + } + } + let x_174 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_175 : f32 = f32(x_174); + x_GLF_color = vec4(x_175, x_175, x_175, x_175); + let x_177 : bool = ok; + if (x_177) { + let x_181 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_184 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_187 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_190 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_181), f32(x_184), f32(x_187), f32(x_190)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl new file mode 100644 index 0000000000..464bdec16f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl @@ -0,0 +1,128 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A : array; + var ref : array; + var a : i32; + var i : i32; + var ok : bool; + var i_1 : i32; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_68 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_70 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_72 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_74 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_76 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_80 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_82 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[2]; + A = array(x_52, x_54, x_56, x_58, x_60, x_62, x_64, x_66, x_68, x_70, x_72, x_74, x_76, x_78, x_80, x_82, x_84); + let x_87 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_89 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_91 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_93 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_95 : i32 = x_6.x_GLF_uniform_int_values[7]; + let x_97 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_99 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_101 : i32 = x_6.x_GLF_uniform_int_values[10]; + let x_103 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_105 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_107 : i32 = x_6.x_GLF_uniform_int_values[13]; + let x_109 : i32 = x_6.x_GLF_uniform_int_values[14]; + let x_111 : i32 = x_6.x_GLF_uniform_int_values[15]; + let x_113 : i32 = x_6.x_GLF_uniform_int_values[16]; + let x_115 : i32 = x_6.x_GLF_uniform_int_values[17]; + let x_117 : i32 = x_6.x_GLF_uniform_int_values[18]; + let x_119 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref = array(x_87, x_89, x_91, x_93, x_95, x_97, x_99, x_101, x_103, x_105, x_107, x_109, x_111, x_113, x_115, x_117, x_119); + let x_122 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_122; + let x_124 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_124; + loop { + let x_129 : i32 = i; + let x_131 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_129 < x_131)) { + } else { + break; + } + let x_134 : i32 = i; + let x_135 : i32 = a; + a = (x_135 - 1); + A[x_134] = x_135; + let x_138 : i32 = i; + let x_140 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_142 : i32 = x_6.x_GLF_uniform_int_values[18]; + let x_144 : i32 = i; + let x_146 : i32 = x_6.x_GLF_uniform_int_values[3]; + A[clamp(x_138, x_140, x_142)] = (x_144 + x_146); + + continuing { + let x_149 : i32 = i; + i = (x_149 + 1); + } + } + ok = true; + let x_152 : i32 = x_6.x_GLF_uniform_int_values[2]; + i_1 = x_152; + loop { + let x_157 : i32 = i_1; + let x_159 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_157 < x_159)) { + } else { + break; + } + let x_162 : i32 = i_1; + let x_164 : i32 = A[x_162]; + let x_165 : i32 = i_1; + let x_167 : i32 = ref[x_165]; + if ((x_164 != x_167)) { + ok = false; + } + + continuing { + let x_171 : i32 = i_1; + i_1 = (x_171 + 1); + } + } + let x_174 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_175 : f32 = f32(x_174); + x_GLF_color = vec4(x_175, x_175, x_175, x_175); + let x_177 : bool = ok; + if (x_177) { + let x_181 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_184 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_187 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_190 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_181), f32(x_184), f32(x_187), f32(x_190)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9e560db651 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.hlsl @@ -0,0 +1,120 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[19]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int A[17] = (int[17])0; + int ref[17] = (int[17])0; + int a = 0; + int i = 0; + bool ok = false; + int i_1 = 0; + const int x_52 = asint(x_6[2].x); + const int x_54 = asint(x_6[2].x); + const int x_56 = asint(x_6[2].x); + const int x_58 = asint(x_6[2].x); + const int x_60 = asint(x_6[2].x); + const int x_62 = asint(x_6[2].x); + const int x_64 = asint(x_6[2].x); + const int x_66 = asint(x_6[2].x); + const int x_68 = asint(x_6[2].x); + const int x_70 = asint(x_6[2].x); + const int x_72 = asint(x_6[2].x); + const int x_74 = asint(x_6[2].x); + const int x_76 = asint(x_6[2].x); + const int x_78 = asint(x_6[2].x); + const int x_80 = asint(x_6[2].x); + const int x_82 = asint(x_6[2].x); + const int x_84 = asint(x_6[2].x); + const int tint_symbol_3[17] = {x_52, x_54, x_56, x_58, x_60, x_62, x_64, x_66, x_68, x_70, x_72, x_74, x_76, x_78, x_80, x_82, x_84}; + A = tint_symbol_3; + const int x_87 = asint(x_6[3].x); + const int x_89 = asint(x_6[4].x); + const int x_91 = asint(x_6[5].x); + const int x_93 = asint(x_6[6].x); + const int x_95 = asint(x_6[7].x); + const int x_97 = asint(x_6[8].x); + const int x_99 = asint(x_6[9].x); + const int x_101 = asint(x_6[10].x); + const int x_103 = asint(x_6[11].x); + const int x_105 = asint(x_6[12].x); + const int x_107 = asint(x_6[13].x); + const int x_109 = asint(x_6[14].x); + const int x_111 = asint(x_6[15].x); + const int x_113 = asint(x_6[16].x); + const int x_115 = asint(x_6[17].x); + const int x_117 = asint(x_6[18].x); + const int x_119 = asint(x_6[1].x); + const int tint_symbol_4[17] = {x_87, x_89, x_91, x_93, x_95, x_97, x_99, x_101, x_103, x_105, x_107, x_109, x_111, x_113, x_115, x_117, x_119}; + ref = tint_symbol_4; + const int x_122 = asint(x_6[2].x); + a = x_122; + const int x_124 = asint(x_6[2].x); + i = x_124; + while (true) { + const int x_129 = i; + const int x_131 = asint(x_6[1].x); + if ((x_129 < x_131)) { + } else { + break; + } + const int x_134 = i; + const int x_135 = a; + a = (x_135 - 1); + A[x_134] = x_135; + const int x_138 = i; + const int x_140 = asint(x_6[2].x); + const int x_142 = asint(x_6[18].x); + const int x_144 = i; + const int x_146 = asint(x_6[3].x); + A[clamp(x_138, x_140, x_142)] = (x_144 + x_146); + { + i = (i + 1); + } + } + ok = true; + const int x_152 = asint(x_6[2].x); + i_1 = x_152; + while (true) { + const int x_157 = i_1; + const int x_159 = asint(x_6[1].x); + if ((x_157 < x_159)) { + } else { + break; + } + const int x_164 = A[i_1]; + const int x_167 = ref[i_1]; + if ((x_164 != x_167)) { + ok = false; + } + { + i_1 = (i_1 + 1); + } + } + const int x_174 = asint(x_6[2].x); + const float x_175 = float(x_174); + x_GLF_color = float4(x_175, x_175, x_175, x_175); + if (ok) { + const int x_181 = asint(x_6[3].x); + const int x_184 = asint(x_6[2].x); + const int x_187 = asint(x_6[2].x); + const int x_190 = asint(x_6[3].x); + x_GLF_color = float4(float(x_181), float(x_184), float(x_187), float(x_190)); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..5993503ba7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.msl @@ -0,0 +1,138 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[19]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[17]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6) { + tint_array_wrapper_1 A = {}; + tint_array_wrapper_1 ref = {}; + int a = 0; + int i = 0; + bool ok = false; + int i_1 = 0; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_54 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_58 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_60 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_68 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_70 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_72 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_74 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_76 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_78 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_80 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_82 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_84 = x_6.x_GLF_uniform_int_values.arr[2].el; + tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_52, x_54, x_56, x_58, x_60, x_62, x_64, x_66, x_68, x_70, x_72, x_74, x_76, x_78, x_80, x_82, x_84}}; + A = tint_symbol_3; + int const x_87 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_89 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_91 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_93 = x_6.x_GLF_uniform_int_values.arr[6].el; + int const x_95 = x_6.x_GLF_uniform_int_values.arr[7].el; + int const x_97 = x_6.x_GLF_uniform_int_values.arr[8].el; + int const x_99 = x_6.x_GLF_uniform_int_values.arr[9].el; + int const x_101 = x_6.x_GLF_uniform_int_values.arr[10].el; + int const x_103 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_105 = x_6.x_GLF_uniform_int_values.arr[12].el; + int const x_107 = x_6.x_GLF_uniform_int_values.arr[13].el; + int const x_109 = x_6.x_GLF_uniform_int_values.arr[14].el; + int const x_111 = x_6.x_GLF_uniform_int_values.arr[15].el; + int const x_113 = x_6.x_GLF_uniform_int_values.arr[16].el; + int const x_115 = x_6.x_GLF_uniform_int_values.arr[17].el; + int const x_117 = x_6.x_GLF_uniform_int_values.arr[18].el; + int const x_119 = x_6.x_GLF_uniform_int_values.arr[1].el; + tint_array_wrapper_1 const tint_symbol_4 = {.arr={x_87, x_89, x_91, x_93, x_95, x_97, x_99, x_101, x_103, x_105, x_107, x_109, x_111, x_113, x_115, x_117, x_119}}; + ref = tint_symbol_4; + int const x_122 = x_6.x_GLF_uniform_int_values.arr[2].el; + a = x_122; + int const x_124 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_124; + while (true) { + int const x_129 = i; + int const x_131 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_129 < x_131)) { + } else { + break; + } + int const x_134 = i; + int const x_135 = a; + a = (x_135 - 1); + A.arr[x_134] = x_135; + int const x_138 = i; + int const x_140 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_142 = x_6.x_GLF_uniform_int_values.arr[18].el; + int const x_144 = i; + int const x_146 = x_6.x_GLF_uniform_int_values.arr[3].el; + A.arr[clamp(x_138, x_140, x_142)] = (x_144 + x_146); + { + int const x_149 = i; + i = (x_149 + 1); + } + } + ok = true; + int const x_152 = x_6.x_GLF_uniform_int_values.arr[2].el; + i_1 = x_152; + while (true) { + int const x_157 = i_1; + int const x_159 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_157 < x_159)) { + } else { + break; + } + int const x_162 = i_1; + int const x_164 = A.arr[x_162]; + int const x_165 = i_1; + int const x_167 = ref.arr[x_165]; + if ((x_164 != x_167)) { + ok = false; + } + { + int const x_171 = i_1; + i_1 = (x_171 + 1); + } + } + int const x_174 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_175 = float(x_174); + *(tint_symbol_6) = float4(x_175, x_175, x_175, x_175); + bool const x_177 = ok; + if (x_177) { + int const x_181 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_184 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_187 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_190 = x_6.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_6) = float4(float(x_181), float(x_184), float(x_187), float(x_190)); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + main_1(x_6, &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..794d877e27 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.spvasm @@ -0,0 +1,294 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 215 +; Schema: 0 + OpCapability Shader + %152 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %A "A" + OpName %ref "ref" + OpName %a "a" + OpName %i "i" + OpName %ok "ok" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_19 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_17 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_19 = OpConstant %uint 19 +%_arr_int_uint_19 = OpTypeArray %int %uint_19 + %buf0 = OpTypeStruct %_arr_int_uint_19 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_17 = OpConstant %uint 17 +%_arr_int_uint_17 = OpTypeArray %int %uint_17 +%_ptr_Function__arr_int_uint_17 = OpTypePointer Function %_arr_int_uint_17 + %23 = OpConstantNull %_arr_int_uint_17 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %32 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %int_11 = OpConstant %int 11 + %int_12 = OpConstant %int 12 + %int_13 = OpConstant %int 13 + %int_14 = OpConstant %int 14 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %int_17 = OpConstant %int 17 + %int_18 = OpConstant %int 18 + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %203 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %A = OpVariable %_ptr_Function__arr_int_uint_17 Function %23 + %ref = OpVariable %_ptr_Function__arr_int_uint_17 Function %23 + %a = OpVariable %_ptr_Function_int Function %27 + %i = OpVariable %_ptr_Function_int Function %27 + %ok = OpVariable %_ptr_Function_bool Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %27 + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %38 = OpLoad %int %37 + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %40 = OpLoad %int %39 + %41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %42 = OpLoad %int %41 + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %44 = OpLoad %int %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %56 = OpLoad %int %55 + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %70 = OpLoad %int %69 + %71 = OpCompositeConstruct %_arr_int_uint_17 %38 %40 %42 %44 %46 %48 %50 %52 %54 %56 %58 %60 %62 %64 %66 %68 %70 + OpStore %A %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %74 = OpLoad %int %73 + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %77 = OpLoad %int %76 + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %80 = OpLoad %int %79 + %82 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %83 = OpLoad %int %82 + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_7 + %86 = OpLoad %int %85 + %88 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_8 + %89 = OpLoad %int %88 + %91 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %92 = OpLoad %int %91 + %94 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_10 + %95 = OpLoad %int %94 + %97 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %98 = OpLoad %int %97 + %100 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_12 + %101 = OpLoad %int %100 + %103 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_13 + %104 = OpLoad %int %103 + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_14 + %107 = OpLoad %int %106 + %109 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_15 + %110 = OpLoad %int %109 + %112 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_16 + %113 = OpLoad %int %112 + %115 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_17 + %116 = OpLoad %int %115 + %118 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_18 + %119 = OpLoad %int %118 + %121 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %122 = OpLoad %int %121 + %123 = OpCompositeConstruct %_arr_int_uint_17 %74 %77 %80 %83 %86 %89 %92 %95 %98 %101 %104 %107 %110 %113 %116 %119 %122 + OpStore %ref %123 + %124 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %125 = OpLoad %int %124 + OpStore %a %125 + %126 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %127 = OpLoad %int %126 + OpStore %i %127 + OpBranch %128 + %128 = OpLabel + OpLoopMerge %129 %130 None + OpBranch %131 + %131 = OpLabel + %132 = OpLoad %int %i + %133 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %134 = OpLoad %int %133 + %135 = OpSLessThan %bool %132 %134 + OpSelectionMerge %136 None + OpBranchConditional %135 %137 %138 + %137 = OpLabel + OpBranch %136 + %138 = OpLabel + OpBranch %129 + %136 = OpLabel + %139 = OpLoad %int %i + %140 = OpLoad %int %a + %141 = OpISub %int %140 %int_1 + OpStore %a %141 + %142 = OpAccessChain %_ptr_Function_int %A %139 + OpStore %142 %140 + %143 = OpLoad %int %i + %144 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %145 = OpLoad %int %144 + %146 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_18 + %147 = OpLoad %int %146 + %148 = OpLoad %int %i + %149 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %150 = OpLoad %int %149 + %151 = OpExtInst %int %152 SClamp %143 %145 %147 + %153 = OpAccessChain %_ptr_Function_int %A %151 + %154 = OpIAdd %int %148 %150 + OpStore %153 %154 + OpBranch %130 + %130 = OpLabel + %155 = OpLoad %int %i + %156 = OpIAdd %int %155 %int_1 + OpStore %i %156 + OpBranch %128 + %129 = OpLabel + OpStore %ok %true + %158 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %159 = OpLoad %int %158 + OpStore %i_1 %159 + OpBranch %160 + %160 = OpLabel + OpLoopMerge %161 %162 None + OpBranch %163 + %163 = OpLabel + %164 = OpLoad %int %i_1 + %165 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %166 = OpLoad %int %165 + %167 = OpSLessThan %bool %164 %166 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %161 + %168 = OpLabel + %171 = OpLoad %int %i_1 + %172 = OpAccessChain %_ptr_Function_int %A %171 + %173 = OpLoad %int %172 + %174 = OpLoad %int %i_1 + %175 = OpAccessChain %_ptr_Function_int %ref %174 + %176 = OpLoad %int %175 + %177 = OpINotEqual %bool %173 %176 + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %178 + %179 = OpLabel + OpStore %ok %false + OpBranch %178 + %178 = OpLabel + OpBranch %162 + %162 = OpLabel + %181 = OpLoad %int %i_1 + %182 = OpIAdd %int %181 %int_1 + OpStore %i_1 %182 + OpBranch %160 + %161 = OpLabel + %183 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %184 = OpLoad %int %183 + %185 = OpConvertSToF %float %184 + %186 = OpCompositeConstruct %v4float %185 %185 %185 %185 + OpStore %x_GLF_color %186 + %187 = OpLoad %bool %ok + OpSelectionMerge %188 None + OpBranchConditional %187 %189 %188 + %189 = OpLabel + %190 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %191 = OpLoad %int %190 + %192 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %193 = OpLoad %int %192 + %194 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %195 = OpLoad %int %194 + %196 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %197 = OpLoad %int %196 + %198 = OpConvertSToF %float %191 + %199 = OpConvertSToF %float %193 + %200 = OpConvertSToF %float %195 + %201 = OpConvertSToF %float %197 + %202 = OpCompositeConstruct %v4float %198 %199 %200 %201 + OpStore %x_GLF_color %202 + OpBranch %188 + %188 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %203 +%tint_symbol = OpFunctionParameter %main_out + %207 = OpLabel + %208 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %208 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %210 = OpLabel + %211 = OpFunctionCall %void %main_1 + %213 = OpLoad %v4float %x_GLF_color + %214 = OpCompositeConstruct %main_out %213 + %212 = OpFunctionCall %void %tint_symbol_2 %214 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..464bdec16f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-array-access/0-opt.wgsl.expected.wgsl @@ -0,0 +1,128 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A : array; + var ref : array; + var a : i32; + var i : i32; + var ok : bool; + var i_1 : i32; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_60 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_68 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_70 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_72 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_74 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_76 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_80 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_82 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[2]; + A = array(x_52, x_54, x_56, x_58, x_60, x_62, x_64, x_66, x_68, x_70, x_72, x_74, x_76, x_78, x_80, x_82, x_84); + let x_87 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_89 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_91 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_93 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_95 : i32 = x_6.x_GLF_uniform_int_values[7]; + let x_97 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_99 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_101 : i32 = x_6.x_GLF_uniform_int_values[10]; + let x_103 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_105 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_107 : i32 = x_6.x_GLF_uniform_int_values[13]; + let x_109 : i32 = x_6.x_GLF_uniform_int_values[14]; + let x_111 : i32 = x_6.x_GLF_uniform_int_values[15]; + let x_113 : i32 = x_6.x_GLF_uniform_int_values[16]; + let x_115 : i32 = x_6.x_GLF_uniform_int_values[17]; + let x_117 : i32 = x_6.x_GLF_uniform_int_values[18]; + let x_119 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref = array(x_87, x_89, x_91, x_93, x_95, x_97, x_99, x_101, x_103, x_105, x_107, x_109, x_111, x_113, x_115, x_117, x_119); + let x_122 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_122; + let x_124 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_124; + loop { + let x_129 : i32 = i; + let x_131 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_129 < x_131)) { + } else { + break; + } + let x_134 : i32 = i; + let x_135 : i32 = a; + a = (x_135 - 1); + A[x_134] = x_135; + let x_138 : i32 = i; + let x_140 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_142 : i32 = x_6.x_GLF_uniform_int_values[18]; + let x_144 : i32 = i; + let x_146 : i32 = x_6.x_GLF_uniform_int_values[3]; + A[clamp(x_138, x_140, x_142)] = (x_144 + x_146); + + continuing { + let x_149 : i32 = i; + i = (x_149 + 1); + } + } + ok = true; + let x_152 : i32 = x_6.x_GLF_uniform_int_values[2]; + i_1 = x_152; + loop { + let x_157 : i32 = i_1; + let x_159 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_157 < x_159)) { + } else { + break; + } + let x_162 : i32 = i_1; + let x_164 : i32 = A[x_162]; + let x_165 : i32 = i_1; + let x_167 : i32 = ref[x_165]; + if ((x_164 != x_167)) { + ok = false; + } + + continuing { + let x_171 : i32 = i_1; + i_1 = (x_171 + 1); + } + } + let x_174 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_175 : f32 = f32(x_174); + x_GLF_color = vec4(x_175, x_175, x_175, x_175); + let x_177 : bool = ok; + if (x_177) { + let x_181 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_184 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_187 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_190 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_181), f32(x_184), f32(x_187), f32(x_190)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm new file mode 100644 index 0000000000..5d8225ee77 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm @@ -0,0 +1,136 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %v1 "v1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %a "a" + OpName %indexable "indexable" + OpName %indexable_0 "indexable" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_int = OpTypePointer Function %int + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 + %float_1 = OpConstant %float 1 + %34 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %37 = OpConstantComposite %_arr_v4float_uint_2 %34 %36 + %int_2 = OpConstant %int 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Function__arr_v4float_uint_2 = OpTypePointer Function %_arr_v4float_uint_2 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %16 + %43 = OpLabel + %v1 = OpVariable %_ptr_Function_v4float Function + %i = OpVariable %_ptr_Function_int Function + %a = OpVariable %_ptr_Function_int Function + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_2 Function +%indexable_0 = OpVariable %_ptr_Function__arr_v4float_uint_2 Function + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %45 = OpLoad %float %44 + %46 = OpCompositeConstruct %v4float %45 %45 %45 %45 + OpStore %v1 %46 + %47 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %48 = OpLoad %int %47 + OpStore %i %48 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %int %i + %54 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpSLessThan %bool %53 %55 + OpBranchConditional %56 %57 %50 + %57 = OpLabel + %58 = OpLoad %int %i + %59 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %62 = OpLoad %int %61 + %63 = OpExtInst %int %1 SClamp %58 %60 %62 + OpStore %indexable %37 + %64 = OpAccessChain %_ptr_Function_float %indexable %63 %uint_0 + %65 = OpLoad %float %64 + %66 = OpConvertFToS %int %65 + OpStore %a %66 + %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %74 = OpLoad %float %73 + %75 = OpCompositeConstruct %v4float %68 %70 %72 %74 + %76 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %83 = OpLoad %float %82 + %84 = OpCompositeConstruct %v4float %77 %79 %81 %83 + %85 = OpCompositeConstruct %_arr_v4float_uint_2 %75 %84 + %86 = OpLoad %int %a + OpStore %indexable_0 %85 + %87 = OpAccessChain %_ptr_Function_v4float %indexable_0 %86 + %88 = OpLoad %v4float %87 + OpStore %v1 %88 + OpBranch %51 + %51 = OpLabel + %89 = OpLoad %int %i + %90 = OpIAdd %int %89 %int_1 + OpStore %i %90 + OpBranch %49 + %50 = OpLabel + %91 = OpLoad %v4float %v1 + OpStore %_GLF_color %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..d7b62c4b86 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.hlsl @@ -0,0 +1,72 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + int a = 0; + float4 indexable[2] = (float4[2])0; + float4 indexable_1[2] = (float4[2])0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + v1 = float4(x_45, x_45, x_45, x_45); + const int x_48 = asint(x_9[1].x); + i = x_48; + while (true) { + const int x_53 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_53 < x_55)) { + } else { + break; + } + const int x_58 = i; + const int x_60 = asint(x_9[1].x); + const int x_62 = asint(x_9[2].x); + const float4 tint_symbol_4[2] = {float4(1.0f, 1.0f, 1.0f, 1.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + indexable = tint_symbol_4; + const float x_65 = indexable[clamp(x_58, x_60, x_62)].x; + a = int(x_65); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_68 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_70 = asfloat(x_6[1].x); + const float x_72 = asfloat(x_6[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_74 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_77 = asfloat(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_79 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_81 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const float x_83 = asfloat(x_6[1].x); + const int x_86 = a; + const float4 tint_symbol_5[2] = {float4(x_68, x_70, x_72, x_74), float4(x_77, x_79, x_81, x_83)}; + indexable_1 = tint_symbol_5; + const float4 x_88 = indexable_1[x_86]; + v1 = x_88; + { + i = (i + 1); + } + } + x_GLF_color = v1; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_6 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f8f8420d41 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.msl @@ -0,0 +1,88 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float4 arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_6) { + float4 v1 = 0.0f; + int i = 0; + int a = 0; + tint_array_wrapper_2 indexable = {}; + tint_array_wrapper_2 indexable_1 = {}; + float const x_45 = x_6.x_GLF_uniform_float_values.arr[0].el; + v1 = float4(x_45, x_45, x_45, x_45); + int const x_48 = x_9.x_GLF_uniform_int_values.arr[1].el; + i = x_48; + while (true) { + int const x_53 = i; + int const x_55 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_53 < x_55)) { + } else { + break; + } + int const x_58 = i; + int const x_60 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_62 = x_9.x_GLF_uniform_int_values.arr[2].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={float4(1.0f, 1.0f, 1.0f, 1.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + indexable = tint_symbol_3; + float const x_65 = indexable.arr[clamp(x_58, x_60, x_62)].x; + a = int(x_65); + float const x_68 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_70 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_72 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_74 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_77 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_79 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_81 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_83 = x_6.x_GLF_uniform_float_values.arr[1].el; + int const x_86 = a; + tint_array_wrapper_2 const tint_symbol_4 = {.arr={float4(x_68, x_70, x_72, x_74), float4(x_77, x_79, x_81, x_83)}}; + indexable_1 = tint_symbol_4; + float4 const x_88 = indexable_1.arr[x_86]; + v1 = x_88; + { + int const x_89 = i; + i = (x_89 + 1); + } + } + float4 const x_91 = v1; + *(tint_symbol_6) = x_91; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..6051176fa5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.spvasm @@ -0,0 +1,177 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 111 +; Schema: 0 + OpCapability Shader + %69 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v1 "v1" + OpName %i "i" + OpName %a "a" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_ptr_Function__arr_v4float_uint_2 = OpTypePointer Function %_arr_v4float_uint_2 + %33 = OpConstantNull %_arr_v4float_uint_2 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %64 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %66 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %67 = OpConstantComposite %_arr_v4float_uint_2 %64 %66 +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %99 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %v1 = OpVariable %_ptr_Function_v4float Function %17 + %i = OpVariable %_ptr_Function_int Function %28 + %a = OpVariable %_ptr_Function_int Function %28 + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_2 Function %33 +%indexable_1 = OpVariable %_ptr_Function__arr_v4float_uint_2 Function %33 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpCompositeConstruct %v4float %39 %39 %39 %39 + OpStore %v1 %40 + %43 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %44 = OpLoad %int %43 + OpStore %i %44 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %i + %50 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpSLessThan %bool %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %55 %56 + %55 = OpLabel + OpBranch %54 + %56 = OpLabel + OpBranch %46 + %54 = OpLabel + %57 = OpLoad %int %i + %58 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %59 = OpLoad %int %58 + %61 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %62 = OpLoad %int %61 + OpStore %indexable %67 + %68 = OpExtInst %int %69 SClamp %57 %59 %62 + %71 = OpAccessChain %_ptr_Function_float %indexable %68 %uint_0 + %72 = OpLoad %float %71 + %73 = OpConvertFToS %int %72 + OpStore %a %73 + %74 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %83 = OpLoad %float %82 + %84 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %89 = OpLoad %float %88 + %90 = OpLoad %int %a + %91 = OpCompositeConstruct %v4float %75 %77 %79 %81 + %92 = OpCompositeConstruct %v4float %83 %85 %87 %89 + %93 = OpCompositeConstruct %_arr_v4float_uint_2 %91 %92 + OpStore %indexable_1 %93 + %94 = OpAccessChain %_ptr_Function_v4float %indexable_1 %90 + %95 = OpLoad %v4float %94 + OpStore %v1 %95 + OpBranch %47 + %47 = OpLabel + %96 = OpLoad %int %i + %97 = OpIAdd %int %96 %int_1 + OpStore %i %97 + OpBranch %45 + %46 = OpLabel + %98 = OpLoad %v4float %v1 + OpStore %x_GLF_color %98 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %99 +%tint_symbol = OpFunctionParameter %main_out + %103 = OpLabel + %104 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %104 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %106 = OpLabel + %107 = OpFunctionCall %void %main_1 + %109 = OpLoad %v4float %x_GLF_color + %110 = OpCompositeConstruct %main_out %109 + %108 = OpFunctionCall %void %tint_symbol_2 %110 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..856399f392 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.spvasm.expected.wgsl @@ -0,0 +1,76 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec4; + var i : i32; + var a : i32; + var indexable : array, 2>; + var indexable_1 : array, 2>; + let x_45 : f32 = x_6.x_GLF_uniform_float_values[0]; + v1 = vec4(x_45, x_45, x_45, x_45); + let x_48 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_48; + loop { + let x_53 : i32 = i; + let x_55 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_53 < x_55)) { + } else { + break; + } + let x_58 : i32 = i; + let x_60 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_62 : i32 = x_9.x_GLF_uniform_int_values[2]; + indexable = array, 2>(vec4(1.0, 1.0, 1.0, 1.0), vec4(0.0, 0.0, 0.0, 0.0)); + let x_65 : f32 = indexable[clamp(x_58, x_60, x_62)].x; + a = i32(x_65); + let x_68 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_70 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_72 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_74 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_77 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_79 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_81 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_83 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_86 : i32 = a; + indexable_1 = array, 2>(vec4(x_68, x_70, x_72, x_74), vec4(x_77, x_79, x_81, x_83)); + let x_88 : vec4 = indexable_1[x_86]; + v1 = x_88; + + continuing { + let x_89 : i32 = i; + i = (x_89 + 1); + } + } + let x_91 : vec4 = v1; + x_GLF_color = x_91; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl new file mode 100644 index 0000000000..856399f392 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl @@ -0,0 +1,76 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec4; + var i : i32; + var a : i32; + var indexable : array, 2>; + var indexable_1 : array, 2>; + let x_45 : f32 = x_6.x_GLF_uniform_float_values[0]; + v1 = vec4(x_45, x_45, x_45, x_45); + let x_48 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_48; + loop { + let x_53 : i32 = i; + let x_55 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_53 < x_55)) { + } else { + break; + } + let x_58 : i32 = i; + let x_60 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_62 : i32 = x_9.x_GLF_uniform_int_values[2]; + indexable = array, 2>(vec4(1.0, 1.0, 1.0, 1.0), vec4(0.0, 0.0, 0.0, 0.0)); + let x_65 : f32 = indexable[clamp(x_58, x_60, x_62)].x; + a = i32(x_65); + let x_68 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_70 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_72 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_74 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_77 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_79 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_81 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_83 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_86 : i32 = a; + indexable_1 = array, 2>(vec4(x_68, x_70, x_72, x_74), vec4(x_77, x_79, x_81, x_83)); + let x_88 : vec4 = indexable_1[x_86]; + v1 = x_88; + + continuing { + let x_89 : i32 = i; + i = (x_89 + 1); + } + } + let x_91 : vec4 = v1; + x_GLF_color = x_91; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d7b62c4b86 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.hlsl @@ -0,0 +1,72 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + int a = 0; + float4 indexable[2] = (float4[2])0; + float4 indexable_1[2] = (float4[2])0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + v1 = float4(x_45, x_45, x_45, x_45); + const int x_48 = asint(x_9[1].x); + i = x_48; + while (true) { + const int x_53 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_53 < x_55)) { + } else { + break; + } + const int x_58 = i; + const int x_60 = asint(x_9[1].x); + const int x_62 = asint(x_9[2].x); + const float4 tint_symbol_4[2] = {float4(1.0f, 1.0f, 1.0f, 1.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + indexable = tint_symbol_4; + const float x_65 = indexable[clamp(x_58, x_60, x_62)].x; + a = int(x_65); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_68 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_70 = asfloat(x_6[1].x); + const float x_72 = asfloat(x_6[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_74 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_77 = asfloat(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_79 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_81 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const float x_83 = asfloat(x_6[1].x); + const int x_86 = a; + const float4 tint_symbol_5[2] = {float4(x_68, x_70, x_72, x_74), float4(x_77, x_79, x_81, x_83)}; + indexable_1 = tint_symbol_5; + const float4 x_88 = indexable_1[x_86]; + v1 = x_88; + { + i = (i + 1); + } + } + x_GLF_color = v1; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_6 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f8f8420d41 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.msl @@ -0,0 +1,88 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float4 arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_6) { + float4 v1 = 0.0f; + int i = 0; + int a = 0; + tint_array_wrapper_2 indexable = {}; + tint_array_wrapper_2 indexable_1 = {}; + float const x_45 = x_6.x_GLF_uniform_float_values.arr[0].el; + v1 = float4(x_45, x_45, x_45, x_45); + int const x_48 = x_9.x_GLF_uniform_int_values.arr[1].el; + i = x_48; + while (true) { + int const x_53 = i; + int const x_55 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_53 < x_55)) { + } else { + break; + } + int const x_58 = i; + int const x_60 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_62 = x_9.x_GLF_uniform_int_values.arr[2].el; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={float4(1.0f, 1.0f, 1.0f, 1.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + indexable = tint_symbol_3; + float const x_65 = indexable.arr[clamp(x_58, x_60, x_62)].x; + a = int(x_65); + float const x_68 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_70 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_72 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_74 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_77 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_79 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_81 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_83 = x_6.x_GLF_uniform_float_values.arr[1].el; + int const x_86 = a; + tint_array_wrapper_2 const tint_symbol_4 = {.arr={float4(x_68, x_70, x_72, x_74), float4(x_77, x_79, x_81, x_83)}}; + indexable_1 = tint_symbol_4; + float4 const x_88 = indexable_1.arr[x_86]; + v1 = x_88; + { + int const x_89 = i; + i = (x_89 + 1); + } + } + float4 const x_91 = v1; + *(tint_symbol_6) = x_91; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..6051176fa5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.spvasm @@ -0,0 +1,177 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 111 +; Schema: 0 + OpCapability Shader + %69 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v1 "v1" + OpName %i "i" + OpName %a "a" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_ptr_Function__arr_v4float_uint_2 = OpTypePointer Function %_arr_v4float_uint_2 + %33 = OpConstantNull %_arr_v4float_uint_2 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %64 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %66 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %67 = OpConstantComposite %_arr_v4float_uint_2 %64 %66 +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %99 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %v1 = OpVariable %_ptr_Function_v4float Function %17 + %i = OpVariable %_ptr_Function_int Function %28 + %a = OpVariable %_ptr_Function_int Function %28 + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_2 Function %33 +%indexable_1 = OpVariable %_ptr_Function__arr_v4float_uint_2 Function %33 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpCompositeConstruct %v4float %39 %39 %39 %39 + OpStore %v1 %40 + %43 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %44 = OpLoad %int %43 + OpStore %i %44 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %i + %50 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpSLessThan %bool %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %55 %56 + %55 = OpLabel + OpBranch %54 + %56 = OpLabel + OpBranch %46 + %54 = OpLabel + %57 = OpLoad %int %i + %58 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %59 = OpLoad %int %58 + %61 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %62 = OpLoad %int %61 + OpStore %indexable %67 + %68 = OpExtInst %int %69 SClamp %57 %59 %62 + %71 = OpAccessChain %_ptr_Function_float %indexable %68 %uint_0 + %72 = OpLoad %float %71 + %73 = OpConvertFToS %int %72 + OpStore %a %73 + %74 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %83 = OpLoad %float %82 + %84 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %89 = OpLoad %float %88 + %90 = OpLoad %int %a + %91 = OpCompositeConstruct %v4float %75 %77 %79 %81 + %92 = OpCompositeConstruct %v4float %83 %85 %87 %89 + %93 = OpCompositeConstruct %_arr_v4float_uint_2 %91 %92 + OpStore %indexable_1 %93 + %94 = OpAccessChain %_ptr_Function_v4float %indexable_1 %90 + %95 = OpLoad %v4float %94 + OpStore %v1 %95 + OpBranch %47 + %47 = OpLabel + %96 = OpLoad %int %i + %97 = OpIAdd %int %96 %int_1 + OpStore %i %97 + OpBranch %45 + %46 = OpLabel + %98 = OpLoad %v4float %v1 + OpStore %x_GLF_color %98 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %99 +%tint_symbol = OpFunctionParameter %main_out + %103 = OpLabel + %104 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %104 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %106 = OpLabel + %107 = OpFunctionCall %void %main_1 + %109 = OpLoad %v4float %x_GLF_color + %110 = OpCompositeConstruct %main_out %109 + %108 = OpFunctionCall %void %tint_symbol_2 %110 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..856399f392 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-large-constants-for-clamp-vector-access/0-opt.wgsl.expected.wgsl @@ -0,0 +1,76 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec4; + var i : i32; + var a : i32; + var indexable : array, 2>; + var indexable_1 : array, 2>; + let x_45 : f32 = x_6.x_GLF_uniform_float_values[0]; + v1 = vec4(x_45, x_45, x_45, x_45); + let x_48 : i32 = x_9.x_GLF_uniform_int_values[1]; + i = x_48; + loop { + let x_53 : i32 = i; + let x_55 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_53 < x_55)) { + } else { + break; + } + let x_58 : i32 = i; + let x_60 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_62 : i32 = x_9.x_GLF_uniform_int_values[2]; + indexable = array, 2>(vec4(1.0, 1.0, 1.0, 1.0), vec4(0.0, 0.0, 0.0, 0.0)); + let x_65 : f32 = indexable[clamp(x_58, x_60, x_62)].x; + a = i32(x_65); + let x_68 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_70 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_72 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_74 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_77 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_79 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_81 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_83 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_86 : i32 = a; + indexable_1 = array, 2>(vec4(x_68, x_70, x_72, x_74), vec4(x_77, x_79, x_81, x_83)); + let x_88 : vec4 = indexable_1[x_86]; + v1 = x_88; + + continuing { + let x_89 : i32 = i; + i = (x_89 + 1); + } + } + let x_91 : vec4 = v1; + x_GLF_color = x_91; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm new file mode 100644 index 0000000000..97aab232de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm @@ -0,0 +1,135 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %a "a" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float +%float_0_200000003 = OpConstant %float 0.200000003 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %12 + %29 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %30 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %31 = OpLoad %float %30 + %32 = OpCompositeConstruct %v4float %31 %31 %31 %31 + OpStore %_GLF_color %32 + %33 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %34 = OpLoad %float %33 + OpStore %a %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpFDiv %float %40 %float_0_200000003 + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %43 = OpLoad %float %42 + %44 = OpFOrdLessThan %bool %41 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + OpReturn + %45 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %48 = OpLoad %float %47 + %49 = OpFDiv %float %48 %float_0_200000003 + %50 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %51 = OpLoad %float %50 + %52 = OpFOrdLessThan %bool %49 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + OpReturn + %53 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %56 = OpLoad %float %55 + %57 = OpFDiv %float %56 %float_0_200000003 + %58 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %59 = OpLoad %float %58 + %60 = OpFOrdLessThan %bool %57 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpReturn + %61 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %64 = OpLoad %float %63 + %65 = OpFDiv %float %64 %float_0_200000003 + %66 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %67 = OpLoad %float %66 + %68 = OpFOrdLessThan %bool %65 %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + OpReturn + %71 = OpLabel + OpStore %a %float_0 + OpBranch %69 + %69 = OpLabel + OpBranch %37 + %37 = OpLabel + %72 = OpLoad %float %a + %73 = OpFUnordNotEqual %bool %72 %float_0 + OpBranchConditional %73 %35 %36 + %36 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %78 = OpLoad %int %77 + %79 = OpConvertSToF %float %78 + %80 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %81 + %83 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpConvertSToF %float %84 + %86 = OpCompositeConstruct %v4float %76 %79 %82 %85 + OpStore %_GLF_color %86 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ecfd0d5442 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.hlsl @@ -0,0 +1,76 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; + +void main_1() { + float a = 0.0f; + const float x_31 = asfloat(x_5[1].x); + x_GLF_color = float4(x_31, x_31, x_31, x_31); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_34 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + a = x_34; + while (true) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_43 = asfloat(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if (((x_40 / 0.200000003f) < x_43)) { + return; + } + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_48 = asfloat(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_51 = asfloat(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if (((x_48 / 0.200000003f) < x_51)) { + return; + } + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_56 = asfloat(x_5[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const float x_59 = asfloat(x_5[scalar_offset_6 / 4][scalar_offset_6 % 4]); + if (((x_56 / 0.200000003f) < x_59)) { + return; + } + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const float x_64 = asfloat(x_5[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const float x_67 = asfloat(x_5[scalar_offset_8 / 4][scalar_offset_8 % 4]); + if (((x_64 / 0.200000003f) < x_67)) { + return; + } else { + a = 0.0f; + } + { + if (!((a == 0.0f))) { + } else { + break; + } + } + } + const int x_75 = asint(x_8[1].x); + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_78 = asint(x_8[scalar_offset_9 / 4][scalar_offset_9 % 4]); + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_81 = asint(x_8[scalar_offset_10 / 4][scalar_offset_10 % 4]); + const int x_84 = asint(x_8[1].x); + x_GLF_color = float4(float(x_75), float(x_78), float(x_81), float(x_84)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..e8baf09008 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, constant buf1& x_8, thread float4* const tint_symbol_4) { + float a = 0.0f; + float const x_31 = x_5.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_31, x_31, x_31, x_31); + float const x_34 = x_5.x_GLF_uniform_float_values.arr[0].el; + a = x_34; + while (true) { + float const x_40 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_43 = x_5.x_GLF_uniform_float_values.arr[0].el; + if (((x_40 / 0.200000003f) < x_43)) { + return; + } + float const x_48 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_51 = x_5.x_GLF_uniform_float_values.arr[0].el; + if (((x_48 / 0.200000003f) < x_51)) { + return; + } + float const x_56 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_59 = x_5.x_GLF_uniform_float_values.arr[0].el; + if (((x_56 / 0.200000003f) < x_59)) { + return; + } + float const x_64 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_67 = x_5.x_GLF_uniform_float_values.arr[0].el; + if (((x_64 / 0.200000003f) < x_67)) { + return; + } else { + a = 0.0f; + } + { + float const x_72 = a; + if (!((x_72 == 0.0f))) { + } else { + break; + } + } + } + int const x_75 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_81 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_84 = x_8.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_75), float(x_78), float(x_81), float(x_84)); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..caa85e8876 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.spvasm @@ -0,0 +1,182 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 107 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_5 "x_5" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 +%float_0_200000003 = OpConstant %float 0.200000003 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %95 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %a = OpVariable %_ptr_Function_float Function %25 + %29 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %30 = OpLoad %float %29 + %31 = OpCompositeConstruct %v4float %30 %30 %30 %30 + OpStore %x_GLF_color %31 + %33 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %34 = OpLoad %float %33 + OpStore %a %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %42 = OpLoad %float %41 + %44 = OpFDiv %float %40 %float_0_200000003 + %45 = OpFOrdLessThan %bool %44 %42 + OpSelectionMerge %47 None + OpBranchConditional %45 %48 %47 + %48 = OpLabel + OpReturn + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %50 = OpLoad %float %49 + %51 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %52 = OpLoad %float %51 + %53 = OpFDiv %float %50 %float_0_200000003 + %54 = OpFOrdLessThan %bool %53 %52 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + OpReturn + %55 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %60 = OpLoad %float %59 + %61 = OpFDiv %float %58 %float_0_200000003 + %62 = OpFOrdLessThan %bool %61 %60 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + OpReturn + %63 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpFDiv %float %66 %float_0_200000003 + %70 = OpFOrdLessThan %bool %69 %68 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpReturn + %73 = OpLabel + OpStore %a %float_0 + OpBranch %71 + %71 = OpLabel + OpBranch %37 + %37 = OpLabel + %75 = OpLoad %float %a + %77 = OpFOrdEqual %bool %75 %float_0 + %76 = OpLogicalNot %bool %77 + OpSelectionMerge %78 None + OpBranchConditional %76 %79 %80 + %79 = OpLabel + OpBranch %78 + %80 = OpLabel + OpBranch %36 + %78 = OpLabel + OpBranch %35 + %36 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %89 = OpLoad %int %88 + %90 = OpConvertSToF %float %83 + %91 = OpConvertSToF %float %85 + %92 = OpConvertSToF %float %87 + %93 = OpConvertSToF %float %89 + %94 = OpCompositeConstruct %v4float %90 %91 %92 %93 + OpStore %x_GLF_color %94 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %95 +%tint_symbol = OpFunctionParameter %main_out + %99 = OpLabel + %100 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %100 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %102 = OpLabel + %103 = OpFunctionCall %void %main_1 + %105 = OpLoad %v4float %x_GLF_color + %106 = OpCompositeConstruct %main_out %105 + %104 = OpFunctionCall %void %tint_symbol_2 %106 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 37[%37] is not post dominated by the back-edge block 78[%78] + %78 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..84258b8b27 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.spvasm.expected.wgsl @@ -0,0 +1,76 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var a : f32; + let x_31 : f32 = x_5.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_31, x_31, x_31, x_31); + let x_34 : f32 = x_5.x_GLF_uniform_float_values[0]; + a = x_34; + loop { + let x_40 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_43 : f32 = x_5.x_GLF_uniform_float_values[0]; + if (((x_40 / 0.200000003) < x_43)) { + return; + } + let x_48 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_51 : f32 = x_5.x_GLF_uniform_float_values[0]; + if (((x_48 / 0.200000003) < x_51)) { + return; + } + let x_56 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_59 : f32 = x_5.x_GLF_uniform_float_values[0]; + if (((x_56 / 0.200000003) < x_59)) { + return; + } + let x_64 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_67 : f32 = x_5.x_GLF_uniform_float_values[0]; + if (((x_64 / 0.200000003) < x_67)) { + return; + } else { + a = 0.0; + } + + continuing { + let x_72 : f32 = a; + if (!((x_72 == 0.0))) { + } else { + break; + } + } + } + let x_75 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_81 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_84 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_75), f32(x_78), f32(x_81), f32(x_84)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl new file mode 100644 index 0000000000..84258b8b27 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl @@ -0,0 +1,76 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var a : f32; + let x_31 : f32 = x_5.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_31, x_31, x_31, x_31); + let x_34 : f32 = x_5.x_GLF_uniform_float_values[0]; + a = x_34; + loop { + let x_40 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_43 : f32 = x_5.x_GLF_uniform_float_values[0]; + if (((x_40 / 0.200000003) < x_43)) { + return; + } + let x_48 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_51 : f32 = x_5.x_GLF_uniform_float_values[0]; + if (((x_48 / 0.200000003) < x_51)) { + return; + } + let x_56 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_59 : f32 = x_5.x_GLF_uniform_float_values[0]; + if (((x_56 / 0.200000003) < x_59)) { + return; + } + let x_64 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_67 : f32 = x_5.x_GLF_uniform_float_values[0]; + if (((x_64 / 0.200000003) < x_67)) { + return; + } else { + a = 0.0; + } + + continuing { + let x_72 : f32 = a; + if (!((x_72 == 0.0))) { + } else { + break; + } + } + } + let x_75 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_81 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_84 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_75), f32(x_78), f32(x_81), f32(x_84)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..ecfd0d5442 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.hlsl @@ -0,0 +1,76 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; + +void main_1() { + float a = 0.0f; + const float x_31 = asfloat(x_5[1].x); + x_GLF_color = float4(x_31, x_31, x_31, x_31); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_34 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + a = x_34; + while (true) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_43 = asfloat(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if (((x_40 / 0.200000003f) < x_43)) { + return; + } + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_48 = asfloat(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_51 = asfloat(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if (((x_48 / 0.200000003f) < x_51)) { + return; + } + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_56 = asfloat(x_5[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const float x_59 = asfloat(x_5[scalar_offset_6 / 4][scalar_offset_6 % 4]); + if (((x_56 / 0.200000003f) < x_59)) { + return; + } + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const float x_64 = asfloat(x_5[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const float x_67 = asfloat(x_5[scalar_offset_8 / 4][scalar_offset_8 % 4]); + if (((x_64 / 0.200000003f) < x_67)) { + return; + } else { + a = 0.0f; + } + { + if (!((a == 0.0f))) { + } else { + break; + } + } + } + const int x_75 = asint(x_8[1].x); + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_78 = asint(x_8[scalar_offset_9 / 4][scalar_offset_9 % 4]); + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_81 = asint(x_8[scalar_offset_10 / 4][scalar_offset_10 % 4]); + const int x_84 = asint(x_8[1].x); + x_GLF_color = float4(float(x_75), float(x_78), float(x_81), float(x_84)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..e8baf09008 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, constant buf1& x_8, thread float4* const tint_symbol_4) { + float a = 0.0f; + float const x_31 = x_5.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_31, x_31, x_31, x_31); + float const x_34 = x_5.x_GLF_uniform_float_values.arr[0].el; + a = x_34; + while (true) { + float const x_40 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_43 = x_5.x_GLF_uniform_float_values.arr[0].el; + if (((x_40 / 0.200000003f) < x_43)) { + return; + } + float const x_48 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_51 = x_5.x_GLF_uniform_float_values.arr[0].el; + if (((x_48 / 0.200000003f) < x_51)) { + return; + } + float const x_56 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_59 = x_5.x_GLF_uniform_float_values.arr[0].el; + if (((x_56 / 0.200000003f) < x_59)) { + return; + } + float const x_64 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_67 = x_5.x_GLF_uniform_float_values.arr[0].el; + if (((x_64 / 0.200000003f) < x_67)) { + return; + } else { + a = 0.0f; + } + { + float const x_72 = a; + if (!((x_72 == 0.0f))) { + } else { + break; + } + } + } + int const x_75 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_81 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_84 = x_8.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_75), float(x_78), float(x_81), float(x_84)); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..caa85e8876 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.spvasm @@ -0,0 +1,182 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 107 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_5 "x_5" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 +%float_0_200000003 = OpConstant %float 0.200000003 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %95 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %a = OpVariable %_ptr_Function_float Function %25 + %29 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %30 = OpLoad %float %29 + %31 = OpCompositeConstruct %v4float %30 %30 %30 %30 + OpStore %x_GLF_color %31 + %33 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %34 = OpLoad %float %33 + OpStore %a %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %42 = OpLoad %float %41 + %44 = OpFDiv %float %40 %float_0_200000003 + %45 = OpFOrdLessThan %bool %44 %42 + OpSelectionMerge %47 None + OpBranchConditional %45 %48 %47 + %48 = OpLabel + OpReturn + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %50 = OpLoad %float %49 + %51 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %52 = OpLoad %float %51 + %53 = OpFDiv %float %50 %float_0_200000003 + %54 = OpFOrdLessThan %bool %53 %52 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + OpReturn + %55 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %60 = OpLoad %float %59 + %61 = OpFDiv %float %58 %float_0_200000003 + %62 = OpFOrdLessThan %bool %61 %60 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + OpReturn + %63 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpFDiv %float %66 %float_0_200000003 + %70 = OpFOrdLessThan %bool %69 %68 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpReturn + %73 = OpLabel + OpStore %a %float_0 + OpBranch %71 + %71 = OpLabel + OpBranch %37 + %37 = OpLabel + %75 = OpLoad %float %a + %77 = OpFOrdEqual %bool %75 %float_0 + %76 = OpLogicalNot %bool %77 + OpSelectionMerge %78 None + OpBranchConditional %76 %79 %80 + %79 = OpLabel + OpBranch %78 + %80 = OpLabel + OpBranch %36 + %78 = OpLabel + OpBranch %35 + %36 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %89 = OpLoad %int %88 + %90 = OpConvertSToF %float %83 + %91 = OpConvertSToF %float %85 + %92 = OpConvertSToF %float %87 + %93 = OpConvertSToF %float %89 + %94 = OpCompositeConstruct %v4float %90 %91 %92 %93 + OpStore %x_GLF_color %94 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %95 +%tint_symbol = OpFunctionParameter %main_out + %99 = OpLabel + %100 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %100 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %102 = OpLabel + %103 = OpFunctionCall %void %main_1 + %105 = OpLoad %v4float %x_GLF_color + %106 = OpCompositeConstruct %main_out %105 + %104 = OpFunctionCall %void %tint_symbol_2 %106 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 37[%37] is not post dominated by the back-edge block 78[%78] + %78 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..84258b8b27 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-nir-opt-loop-unroll-if-if-if-if-do-while/0-opt.wgsl.expected.wgsl @@ -0,0 +1,76 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var a : f32; + let x_31 : f32 = x_5.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_31, x_31, x_31, x_31); + let x_34 : f32 = x_5.x_GLF_uniform_float_values[0]; + a = x_34; + loop { + let x_40 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_43 : f32 = x_5.x_GLF_uniform_float_values[0]; + if (((x_40 / 0.200000003) < x_43)) { + return; + } + let x_48 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_51 : f32 = x_5.x_GLF_uniform_float_values[0]; + if (((x_48 / 0.200000003) < x_51)) { + return; + } + let x_56 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_59 : f32 = x_5.x_GLF_uniform_float_values[0]; + if (((x_56 / 0.200000003) < x_59)) { + return; + } + let x_64 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_67 : f32 = x_5.x_GLF_uniform_float_values[0]; + if (((x_64 / 0.200000003) < x_67)) { + return; + } else { + a = 0.0; + } + + continuing { + let x_72 : f32 = a; + if (!((x_72 == 0.0))) { + } else { + break; + } + } + } + let x_75 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_81 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_84 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_75), f32(x_78), f32(x_81), f32(x_84)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm new file mode 100644 index 0000000000..204785577d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm @@ -0,0 +1,144 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %M1 "M1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %a "a" + OpName %c "c" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 + %buf0 = OpTypeStruct %_arr_float_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function_int = OpTypePointer Function %int + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %39 = OpLabel + %M1 = OpVariable %_ptr_Function_mat2v2float Function + %a = OpVariable %_ptr_Function_float Function + %c = OpVariable %_ptr_Function_int Function + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %43 = OpLoad %float %42 + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_4 + %47 = OpLoad %float %46 + %48 = OpCompositeConstruct %v2float %41 %43 + %49 = OpCompositeConstruct %v2float %45 %47 + %50 = OpCompositeConstruct %mat2v2float %48 %49 + OpStore %M1 %50 + %51 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %52 = OpLoad %float %51 + OpStore %a %52 + %53 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %54 = OpLoad %int %53 + OpStore %c %54 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %int %c + %60 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpSLessThan %bool %59 %61 + OpBranchConditional %62 %63 %56 + %63 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %65 = OpLoad %int %64 + %66 = OpLoad %int %c + %67 = OpNot %int %66 + %68 = OpExtInst %int %1 SClamp %67 %int_0 %int_1 + %69 = OpAccessChain %_ptr_Function_float %M1 %65 %68 + %70 = OpLoad %float %69 + %71 = OpLoad %float %a + %72 = OpFAdd %float %71 %70 + OpStore %a %72 + OpBranch %57 + %57 = OpLabel + %73 = OpLoad %int %c + %74 = OpIAdd %int %73 %int_1 + OpStore %c %74 + OpBranch %55 + %56 = OpLabel + %75 = OpLoad %float %a + %76 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %77 = OpLoad %float %76 + %78 = OpFOrdEqual %bool %75 %77 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %81 + %80 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %83 = OpLoad %int %82 + %84 = OpConvertSToF %float %83 + %85 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %86 + %88 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %89 = OpLoad %int %88 + %90 = OpConvertSToF %float %89 + %91 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %92 = OpLoad %int %91 + %93 = OpConvertSToF %float %92 + %94 = OpCompositeConstruct %v4float %84 %87 %90 %93 + OpStore %_GLF_color %94 + OpBranch %79 + %81 = OpLabel + %95 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %96 = OpLoad %int %95 + %97 = OpConvertSToF %float %96 + %98 = OpCompositeConstruct %v4float %97 %97 %97 %97 + OpStore %_GLF_color %98 + OpBranch %79 + %79 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..e028935f35 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.hlsl @@ -0,0 +1,66 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 M1 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float a = 0.0f; + int c = 0; + const float x_41 = asfloat(x_6[1].x); + const float x_43 = asfloat(x_6[2].x); + const float x_45 = asfloat(x_6[3].x); + const float x_47 = asfloat(x_6[4].x); + M1 = float2x2(float2(x_41, x_43), float2(x_45, x_47)); + const float x_52 = asfloat(x_6[1].x); + a = x_52; + const int x_54 = asint(x_10[1].x); + c = x_54; + while (true) { + const int x_59 = c; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_61 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + if ((x_59 < x_61)) { + } else { + break; + } + const int x_65 = asint(x_10[2].x); + const float x_70 = M1[x_65][clamp(~(c), 0, 1)]; + a = (a + x_70); + { + c = (c + 1); + } + } + const float x_75 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_77 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_75 == x_77)) { + const int x_83 = asint(x_10[2].x); + const int x_86 = asint(x_10[1].x); + const int x_89 = asint(x_10[1].x); + const int x_92 = asint(x_10[2].x); + x_GLF_color = float4(float(x_83), float(x_86), float(x_89), float(x_92)); + } else { + const int x_96 = asint(x_10[2].x); + const float x_97 = float(x_96); + x_GLF_color = float4(x_97, x_97, x_97, x_97); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b6ec84f009 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.msl @@ -0,0 +1,84 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_10, thread float4* const tint_symbol_4) { + float2x2 M1 = float2x2(0.0f); + float a = 0.0f; + int c = 0; + float const x_41 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_43 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_45 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_47 = x_6.x_GLF_uniform_float_values.arr[4].el; + M1 = float2x2(float2(x_41, x_43), float2(x_45, x_47)); + float const x_52 = x_6.x_GLF_uniform_float_values.arr[1].el; + a = x_52; + int const x_54 = x_10.x_GLF_uniform_int_values.arr[1].el; + c = x_54; + while (true) { + int const x_59 = c; + int const x_61 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_59 < x_61)) { + } else { + break; + } + int const x_65 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_66 = c; + float const x_70 = M1[x_65][clamp(~(x_66), 0, 1)]; + float const x_71 = a; + a = (x_71 + x_70); + { + int const x_73 = c; + c = (x_73 + 1); + } + } + float const x_75 = a; + float const x_77 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_75 == x_77)) { + int const x_83 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_86 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_89 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_92 = x_10.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_83), float(x_86), float(x_89), float(x_92)); + } else { + int const x_96 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_97 = float(x_96); + *(tint_symbol_4) = float4(x_97, x_97, x_97, x_97); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..40682e798e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.spvasm @@ -0,0 +1,184 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 118 +; Schema: 0 + OpCapability Shader + %74 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %M1 "M1" + OpName %a "a" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 + %buf0 = OpTypeStruct %_arr_float_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %28 = OpConstantNull %mat2v2float +%_ptr_Function_float = OpTypePointer Function %float + %31 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %106 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %M1 = OpVariable %_ptr_Function_mat2v2float Function %28 + %a = OpVariable %_ptr_Function_float Function %31 + %c = OpVariable %_ptr_Function_int Function %34 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %39 = OpLoad %float %38 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %42 = OpLoad %float %41 + %44 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %45 = OpLoad %float %44 + %47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_4 + %48 = OpLoad %float %47 + %49 = OpCompositeConstruct %v2float %39 %42 + %50 = OpCompositeConstruct %v2float %45 %48 + %51 = OpCompositeConstruct %mat2v2float %49 %50 + OpStore %M1 %51 + %52 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %53 = OpLoad %float %52 + OpStore %a %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %56 = OpLoad %int %55 + OpStore %c %56 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %c + %63 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpSLessThan %bool %61 %64 + OpSelectionMerge %67 None + OpBranchConditional %65 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %58 + %67 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %71 = OpLoad %int %70 + %72 = OpLoad %int %c + %75 = OpNot %int %72 + %73 = OpExtInst %int %74 SClamp %75 %int_0 %int_1 + %76 = OpAccessChain %_ptr_Function_float %M1 %71 %73 + %77 = OpLoad %float %76 + %78 = OpLoad %float %a + %79 = OpFAdd %float %78 %77 + OpStore %a %79 + OpBranch %59 + %59 = OpLabel + %80 = OpLoad %int %c + %81 = OpIAdd %int %80 %int_1 + OpStore %c %81 + OpBranch %57 + %58 = OpLabel + %82 = OpLoad %float %a + %83 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %84 = OpLoad %float %83 + %85 = OpFOrdEqual %bool %82 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %96 = OpLoad %int %95 + %97 = OpConvertSToF %float %90 + %98 = OpConvertSToF %float %92 + %99 = OpConvertSToF %float %94 + %100 = OpConvertSToF %float %96 + %101 = OpCompositeConstruct %v4float %97 %98 %99 %100 + OpStore %x_GLF_color %101 + OpBranch %86 + %88 = OpLabel + %102 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %103 = OpLoad %int %102 + %104 = OpConvertSToF %float %103 + %105 = OpCompositeConstruct %v4float %104 %104 %104 %104 + OpStore %x_GLF_color %105 + OpBranch %86 + %86 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %106 +%tint_symbol = OpFunctionParameter %main_out + %110 = OpLabel + %111 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %111 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %113 = OpLabel + %114 = OpFunctionCall %void %main_1 + %116 = OpLoad %v4float %x_GLF_color + %117 = OpCompositeConstruct %main_out %116 + %115 = OpFunctionCall %void %tint_symbol_2 %117 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a1de151e82 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.spvasm.expected.wgsl @@ -0,0 +1,77 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var M1 : mat2x2; + var a : f32; + var c : i32; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_45 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[4]; + M1 = mat2x2(vec2(x_41, x_43), vec2(x_45, x_47)); + let x_52 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = x_52; + let x_54 : i32 = x_10.x_GLF_uniform_int_values[1]; + c = x_54; + loop { + let x_59 : i32 = c; + let x_61 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_59 < x_61)) { + } else { + break; + } + let x_65 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_66 : i32 = c; + let x_70 : f32 = M1[x_65][clamp(~(x_66), 0, 1)]; + let x_71 : f32 = a; + a = (x_71 + x_70); + + continuing { + let x_73 : i32 = c; + c = (x_73 + 1); + } + } + let x_75 : f32 = a; + let x_77 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_75 == x_77)) { + let x_83 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_86 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_89 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_92 : i32 = x_10.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_83), f32(x_86), f32(x_89), f32(x_92)); + } else { + let x_96 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_97 : f32 = f32(x_96); + x_GLF_color = vec4(x_97, x_97, x_97, x_97); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl new file mode 100644 index 0000000000..a1de151e82 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl @@ -0,0 +1,77 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var M1 : mat2x2; + var a : f32; + var c : i32; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_45 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[4]; + M1 = mat2x2(vec2(x_41, x_43), vec2(x_45, x_47)); + let x_52 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = x_52; + let x_54 : i32 = x_10.x_GLF_uniform_int_values[1]; + c = x_54; + loop { + let x_59 : i32 = c; + let x_61 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_59 < x_61)) { + } else { + break; + } + let x_65 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_66 : i32 = c; + let x_70 : f32 = M1[x_65][clamp(~(x_66), 0, 1)]; + let x_71 : f32 = a; + a = (x_71 + x_70); + + continuing { + let x_73 : i32 = c; + c = (x_73 + 1); + } + } + let x_75 : f32 = a; + let x_77 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_75 == x_77)) { + let x_83 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_86 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_89 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_92 : i32 = x_10.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_83), f32(x_86), f32(x_89), f32(x_92)); + } else { + let x_96 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_97 : f32 = f32(x_96); + x_GLF_color = vec4(x_97, x_97, x_97, x_97); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..e028935f35 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.hlsl @@ -0,0 +1,66 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 M1 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float a = 0.0f; + int c = 0; + const float x_41 = asfloat(x_6[1].x); + const float x_43 = asfloat(x_6[2].x); + const float x_45 = asfloat(x_6[3].x); + const float x_47 = asfloat(x_6[4].x); + M1 = float2x2(float2(x_41, x_43), float2(x_45, x_47)); + const float x_52 = asfloat(x_6[1].x); + a = x_52; + const int x_54 = asint(x_10[1].x); + c = x_54; + while (true) { + const int x_59 = c; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_61 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + if ((x_59 < x_61)) { + } else { + break; + } + const int x_65 = asint(x_10[2].x); + const float x_70 = M1[x_65][clamp(~(c), 0, 1)]; + a = (a + x_70); + { + c = (c + 1); + } + } + const float x_75 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_77 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_75 == x_77)) { + const int x_83 = asint(x_10[2].x); + const int x_86 = asint(x_10[1].x); + const int x_89 = asint(x_10[1].x); + const int x_92 = asint(x_10[2].x); + x_GLF_color = float4(float(x_83), float(x_86), float(x_89), float(x_92)); + } else { + const int x_96 = asint(x_10[2].x); + const float x_97 = float(x_96); + x_GLF_color = float4(x_97, x_97, x_97, x_97); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b6ec84f009 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.msl @@ -0,0 +1,84 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_10, thread float4* const tint_symbol_4) { + float2x2 M1 = float2x2(0.0f); + float a = 0.0f; + int c = 0; + float const x_41 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_43 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_45 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_47 = x_6.x_GLF_uniform_float_values.arr[4].el; + M1 = float2x2(float2(x_41, x_43), float2(x_45, x_47)); + float const x_52 = x_6.x_GLF_uniform_float_values.arr[1].el; + a = x_52; + int const x_54 = x_10.x_GLF_uniform_int_values.arr[1].el; + c = x_54; + while (true) { + int const x_59 = c; + int const x_61 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_59 < x_61)) { + } else { + break; + } + int const x_65 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_66 = c; + float const x_70 = M1[x_65][clamp(~(x_66), 0, 1)]; + float const x_71 = a; + a = (x_71 + x_70); + { + int const x_73 = c; + c = (x_73 + 1); + } + } + float const x_75 = a; + float const x_77 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_75 == x_77)) { + int const x_83 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_86 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_89 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_92 = x_10.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_83), float(x_86), float(x_89), float(x_92)); + } else { + int const x_96 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_97 = float(x_96); + *(tint_symbol_4) = float4(x_97, x_97, x_97, x_97); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..40682e798e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.spvasm @@ -0,0 +1,184 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 118 +; Schema: 0 + OpCapability Shader + %74 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %M1 "M1" + OpName %a "a" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 + %buf0 = OpTypeStruct %_arr_float_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %28 = OpConstantNull %mat2v2float +%_ptr_Function_float = OpTypePointer Function %float + %31 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %106 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %M1 = OpVariable %_ptr_Function_mat2v2float Function %28 + %a = OpVariable %_ptr_Function_float Function %31 + %c = OpVariable %_ptr_Function_int Function %34 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %39 = OpLoad %float %38 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %42 = OpLoad %float %41 + %44 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %45 = OpLoad %float %44 + %47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_4 + %48 = OpLoad %float %47 + %49 = OpCompositeConstruct %v2float %39 %42 + %50 = OpCompositeConstruct %v2float %45 %48 + %51 = OpCompositeConstruct %mat2v2float %49 %50 + OpStore %M1 %51 + %52 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %53 = OpLoad %float %52 + OpStore %a %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %56 = OpLoad %int %55 + OpStore %c %56 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %c + %63 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpSLessThan %bool %61 %64 + OpSelectionMerge %67 None + OpBranchConditional %65 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %58 + %67 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %71 = OpLoad %int %70 + %72 = OpLoad %int %c + %75 = OpNot %int %72 + %73 = OpExtInst %int %74 SClamp %75 %int_0 %int_1 + %76 = OpAccessChain %_ptr_Function_float %M1 %71 %73 + %77 = OpLoad %float %76 + %78 = OpLoad %float %a + %79 = OpFAdd %float %78 %77 + OpStore %a %79 + OpBranch %59 + %59 = OpLabel + %80 = OpLoad %int %c + %81 = OpIAdd %int %80 %int_1 + OpStore %c %81 + OpBranch %57 + %58 = OpLabel + %82 = OpLoad %float %a + %83 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %84 = OpLoad %float %83 + %85 = OpFOrdEqual %bool %82 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %96 = OpLoad %int %95 + %97 = OpConvertSToF %float %90 + %98 = OpConvertSToF %float %92 + %99 = OpConvertSToF %float %94 + %100 = OpConvertSToF %float %96 + %101 = OpCompositeConstruct %v4float %97 %98 %99 %100 + OpStore %x_GLF_color %101 + OpBranch %86 + %88 = OpLabel + %102 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %103 = OpLoad %int %102 + %104 = OpConvertSToF %float %103 + %105 = OpCompositeConstruct %v4float %104 %104 %104 %104 + OpStore %x_GLF_color %105 + OpBranch %86 + %86 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %106 +%tint_symbol = OpFunctionParameter %main_out + %110 = OpLabel + %111 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %111 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %113 = OpLabel + %114 = OpFunctionCall %void %main_1 + %116 = OpLoad %v4float %x_GLF_color + %117 = OpCompositeConstruct %main_out %116 + %115 = OpFunctionCall %void %tint_symbol_2 %117 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a1de151e82 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-not-clamp-matrix-access/0-opt.wgsl.expected.wgsl @@ -0,0 +1,77 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var M1 : mat2x2; + var a : f32; + var c : i32; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_45 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[4]; + M1 = mat2x2(vec2(x_41, x_43), vec2(x_45, x_47)); + let x_52 : f32 = x_6.x_GLF_uniform_float_values[1]; + a = x_52; + let x_54 : i32 = x_10.x_GLF_uniform_int_values[1]; + c = x_54; + loop { + let x_59 : i32 = c; + let x_61 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_59 < x_61)) { + } else { + break; + } + let x_65 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_66 : i32 = c; + let x_70 : f32 = M1[x_65][clamp(~(x_66), 0, 1)]; + let x_71 : f32 = a; + a = (x_71 + x_70); + + continuing { + let x_73 : i32 = c; + c = (x_73 + 1); + } + } + let x_75 : f32 = a; + let x_77 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_75 == x_77)) { + let x_83 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_86 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_89 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_92 : i32 = x_10.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_83), f32(x_86), f32(x_89), f32(x_92)); + } else { + let x_96 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_97 : f32 = f32(x_96); + x_GLF_color = vec4(x_97, x_97, x_97, x_97); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm new file mode 100644 index 0000000000..d7912069d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm @@ -0,0 +1,82 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f "f" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_2 = OpConstant %float 2 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %26 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %a = OpVariable %_ptr_Function_int Function + OpStore %f %float_2 + %27 = OpLoad %float %f + %28 = OpExtInst %float %1 FClamp %float_1 %float_1 %27 + %29 = OpFSub %float %float_1 %28 + %30 = OpConvertFToS %int %29 + OpStore %a %30 + %31 = OpLoad %int %a + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %33 = OpLoad %int %32 + %34 = OpIEqual %bool %31 %33 + OpSelectionMerge %35 None + OpBranchConditional %34 %36 %37 + %36 = OpLabel + %38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpConvertSToF %float %39 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpConvertSToF %float %42 + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %45 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %48 + %50 = OpCompositeConstruct %v4float %40 %43 %46 %49 + OpStore %_GLF_color %50 + OpBranch %35 + %37 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpCompositeConstruct %v4float %53 %53 %53 %53 + OpStore %_GLF_color %54 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..6710a76bd7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.hlsl @@ -0,0 +1,41 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int a = 0; + f = 2.0f; + a = int((1.0f - clamp(1.0f, 1.0f, f))); + const int x_31 = a; + const int x_33 = asint(x_7[1].x); + if ((x_31 == x_33)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_39 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const int x_42 = asint(x_7[1].x); + const int x_45 = asint(x_7[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_48 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_39), float(x_42), float(x_45), float(x_48)); + } else { + const int x_52 = asint(x_7[1].x); + const float x_53 = float(x_52); + x_GLF_color = float4(x_53, x_53, x_53, x_53); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..824e6dca64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.msl @@ -0,0 +1,50 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + float f = 0.0f; + int a = 0; + f = 2.0f; + float const x_27 = f; + a = int((1.0f - clamp(1.0f, 1.0f, x_27))); + int const x_31 = a; + int const x_33 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_31 == x_33)) { + int const x_39 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_42 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_45 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_48 = x_7.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_39), float(x_42), float(x_45), float(x_48)); + } else { + int const x_52 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_53 = float(x_52); + *(tint_symbol_4) = float4(x_53, x_53, x_53, x_53); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..3acf316910 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.spvasm @@ -0,0 +1,117 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %30 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %float_2 = OpConstant %float 2 + %float_1 = OpConstant %float 1 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %61 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %f = OpVariable %_ptr_Function_float Function %21 + %a = OpVariable %_ptr_Function_int Function %24 + OpStore %f %float_2 + %26 = OpLoad %float %f + %29 = OpExtInst %float %30 NClamp %float_1 %float_1 %26 + %31 = OpFSub %float %float_1 %29 + %27 = OpConvertFToS %int %31 + OpStore %a %27 + %32 = OpLoad %int %a + %36 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %37 = OpLoad %int %36 + %38 = OpIEqual %bool %32 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %45 + %53 = OpConvertSToF %float %47 + %54 = OpConvertSToF %float %49 + %55 = OpConvertSToF %float %51 + %56 = OpCompositeConstruct %v4float %52 %53 %54 %55 + OpStore %x_GLF_color %56 + OpBranch %40 + %42 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpCompositeConstruct %v4float %59 %59 %59 %59 + OpStore %x_GLF_color %60 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %61 +%tint_symbol = OpFunctionParameter %main_out + %65 = OpLabel + %66 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %66 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %68 = OpLabel + %69 = OpFunctionCall %void %main_1 + %71 = OpLoad %v4float %x_GLF_color + %72 = OpCompositeConstruct %main_out %71 + %70 = OpFunctionCall %void %tint_symbol_2 %72 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..fd31b1fcb0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.spvasm.expected.wgsl @@ -0,0 +1,43 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var a : i32; + f = 2.0; + let x_27 : f32 = f; + a = i32((1.0 - clamp(1.0, 1.0, x_27))); + let x_31 : i32 = a; + let x_33 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_31 == x_33)) { + let x_39 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_42 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_48 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_39), f32(x_42), f32(x_45), f32(x_48)); + } else { + let x_52 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_53 : f32 = f32(x_52); + x_GLF_color = vec4(x_53, x_53, x_53, x_53); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl new file mode 100644 index 0000000000..fd31b1fcb0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl @@ -0,0 +1,43 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var a : i32; + f = 2.0; + let x_27 : f32 = f; + a = i32((1.0 - clamp(1.0, 1.0, x_27))); + let x_31 : i32 = a; + let x_33 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_31 == x_33)) { + let x_39 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_42 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_48 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_39), f32(x_42), f32(x_45), f32(x_48)); + } else { + let x_52 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_53 : f32 = f32(x_52); + x_GLF_color = vec4(x_53, x_53, x_53, x_53); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..6710a76bd7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + int a = 0; + f = 2.0f; + a = int((1.0f - clamp(1.0f, 1.0f, f))); + const int x_31 = a; + const int x_33 = asint(x_7[1].x); + if ((x_31 == x_33)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_39 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const int x_42 = asint(x_7[1].x); + const int x_45 = asint(x_7[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_48 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_39), float(x_42), float(x_45), float(x_48)); + } else { + const int x_52 = asint(x_7[1].x); + const float x_53 = float(x_52); + x_GLF_color = float4(x_53, x_53, x_53, x_53); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..824e6dca64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.msl @@ -0,0 +1,50 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + float f = 0.0f; + int a = 0; + f = 2.0f; + float const x_27 = f; + a = int((1.0f - clamp(1.0f, 1.0f, x_27))); + int const x_31 = a; + int const x_33 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_31 == x_33)) { + int const x_39 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_42 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_45 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_48 = x_7.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_39), float(x_42), float(x_45), float(x_48)); + } else { + int const x_52 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_53 = float(x_52); + *(tint_symbol_4) = float4(x_53, x_53, x_53, x_53); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..3acf316910 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.spvasm @@ -0,0 +1,117 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + %30 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %float_2 = OpConstant %float 2 + %float_1 = OpConstant %float 1 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %61 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %f = OpVariable %_ptr_Function_float Function %21 + %a = OpVariable %_ptr_Function_int Function %24 + OpStore %f %float_2 + %26 = OpLoad %float %f + %29 = OpExtInst %float %30 NClamp %float_1 %float_1 %26 + %31 = OpFSub %float %float_1 %29 + %27 = OpConvertFToS %int %31 + OpStore %a %27 + %32 = OpLoad %int %a + %36 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %37 = OpLoad %int %36 + %38 = OpIEqual %bool %32 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpConvertSToF %float %45 + %53 = OpConvertSToF %float %47 + %54 = OpConvertSToF %float %49 + %55 = OpConvertSToF %float %51 + %56 = OpCompositeConstruct %v4float %52 %53 %54 %55 + OpStore %x_GLF_color %56 + OpBranch %40 + %42 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpCompositeConstruct %v4float %59 %59 %59 %59 + OpStore %x_GLF_color %60 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %61 +%tint_symbol = OpFunctionParameter %main_out + %65 = OpLabel + %66 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %66 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %68 = OpLabel + %69 = OpFunctionCall %void %main_1 + %71 = OpLoad %v4float %x_GLF_color + %72 = OpCompositeConstruct %main_out %71 + %70 = OpFunctionCall %void %tint_symbol_2 %72 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd31b1fcb0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-one-minus-clamp-always-one-cast-to-int/0-opt.wgsl.expected.wgsl @@ -0,0 +1,43 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var a : i32; + f = 2.0; + let x_27 : f32 = f; + a = i32((1.0 - clamp(1.0, 1.0, x_27))); + let x_31 : i32 = a; + let x_33 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_31 == x_33)) { + let x_39 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_42 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_48 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_39), f32(x_42), f32(x_45), f32(x_48)); + } else { + let x_52 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_53 : f32 = f32(x_52); + x_GLF_color = vec4(x_53, x_53, x_53, x_53); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm new file mode 100644 index 0000000000..58648bb74a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm @@ -0,0 +1,174 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %j "j" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %15 + %34 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %36 = OpLoad %int %35 + OpStore %a %36 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %38 = OpLoad %int %37 + OpStore %i %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpSLessThan %bool %43 %45 + OpBranchConditional %46 %47 %40 + %47 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %49 = OpLoad %int %48 + OpStore %j %49 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %int %j + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpSLessThan %bool %54 %56 + OpBranchConditional %57 %58 %51 + %58 = OpLabel + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %64 = OpLoad %int %63 + OpStore %a %64 + %65 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpFOrdLessThan %bool %66 %68 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + OpKill + %70 = OpLabel + OpBranch %61 + %61 = OpLabel + %72 = OpLoad %int %a + %73 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpSLessThan %bool %72 %74 + OpBranchConditional %75 %59 %60 + %60 = OpLabel + %76 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %79 = OpLoad %float %78 + %80 = OpFOrdLessThan %bool %77 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + OpBranch %51 + %81 = OpLabel + OpBranch %52 + %52 = OpLabel + %83 = OpLoad %int %j + %84 = OpIAdd %int %83 %int_1 + OpStore %j %84 + OpBranch %50 + %51 = OpLabel + OpBranch %41 + %41 = OpLabel + %85 = OpLoad %int %i + %86 = OpIAdd %int %85 %int_1 + OpStore %i %86 + OpBranch %39 + %40 = OpLabel + %87 = OpLoad %int %a + %88 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %89 = OpLoad %int %88 + %90 = OpIEqual %bool %87 %89 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %93 + %92 = OpLabel + %94 = OpLoad %int %a + %95 = OpConvertSToF %float %94 + %96 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %97 = OpLoad %int %96 + %98 = OpConvertSToF %float %97 + %99 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %100 = OpLoad %int %99 + %101 = OpConvertSToF %float %100 + %102 = OpLoad %int %a + %103 = OpConvertSToF %float %102 + %104 = OpCompositeConstruct %v4float %95 %98 %101 %103 + OpStore %_GLF_color %104 + OpBranch %91 + %93 = OpLabel + %105 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %106 = OpLoad %int %105 + %107 = OpConvertSToF %float %106 + %108 = OpCompositeConstruct %v4float %107 %107 %107 %107 + OpStore %_GLF_color %108 + OpBranch %91 + %91 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..400789ea8a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.hlsl @@ -0,0 +1,100 @@ +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + int j = 0; + const int x_36 = asint(x_7[2].x); + a = x_36; + const int x_38 = asint(x_7[2].x); + i = x_38; + while (true) { + const int x_43 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_45 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_43 < x_45)) { + } else { + break; + } + const int x_49 = asint(x_7[2].x); + j = x_49; + while (true) { + const int x_54 = j; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_54 < x_56)) { + } else { + break; + } + while (true) { + const int x_64 = asint(x_7[1].x); + a = x_64; + const float x_66 = gl_FragCoord.y; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_68 = asfloat(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_66 < x_68)) { + discard; + } + { + const int x_72 = a; + const int x_74 = asint(x_7[1].x); + if ((x_72 < x_74)) { + } else { + break; + } + } + } + const float x_77 = gl_FragCoord.y; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_79 = asfloat(x_11[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_77 < x_79)) { + break; + } + { + j = (j + 1); + } + } + { + i = (i + 1); + } + } + const int x_87 = a; + const int x_89 = asint(x_7[1].x); + if ((x_87 == x_89)) { + const int x_94 = a; + const int x_97 = asint(x_7[2].x); + const int x_100 = asint(x_7[2].x); + x_GLF_color = float4(float(x_94), float(x_97), float(x_100), float(a)); + } else { + const int x_106 = asint(x_7[2].x); + const float x_107 = float(x_106); + x_GLF_color = float4(x_107, x_107, x_107, x_107); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..e1218a1f2a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_11, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int a = 0; + int i = 0; + int j = 0; + int const x_36 = x_7.x_GLF_uniform_int_values.arr[2].el; + a = x_36; + int const x_38 = x_7.x_GLF_uniform_int_values.arr[2].el; + i = x_38; + while (true) { + int const x_43 = i; + int const x_45 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_43 < x_45)) { + } else { + break; + } + int const x_49 = x_7.x_GLF_uniform_int_values.arr[2].el; + j = x_49; + while (true) { + int const x_54 = j; + int const x_56 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_54 < x_56)) { + } else { + break; + } + while (true) { + int const x_64 = x_7.x_GLF_uniform_int_values.arr[1].el; + a = x_64; + float const x_66 = (*(tint_symbol_5)).y; + float const x_68 = x_11.x_GLF_uniform_float_values.arr[0].el; + if ((x_66 < x_68)) { + discard_fragment(); + } + { + int const x_72 = a; + int const x_74 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_72 < x_74)) { + } else { + break; + } + } + } + float const x_77 = (*(tint_symbol_5)).y; + float const x_79 = x_11.x_GLF_uniform_float_values.arr[0].el; + if ((x_77 < x_79)) { + break; + } + { + int const x_83 = j; + j = (x_83 + 1); + } + } + { + int const x_85 = i; + i = (x_85 + 1); + } + } + int const x_87 = a; + int const x_89 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_87 == x_89)) { + int const x_94 = a; + int const x_97 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_100 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_102 = a; + *(tint_symbol_6) = float4(float(x_94), float(x_97), float(x_100), float(x_102)); + } else { + int const x_106 = x_7.x_GLF_uniform_int_values.arr[2].el; + float const x_107 = float(x_106); + *(tint_symbol_6) = float4(x_107, x_107, x_107, x_107); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_7 [[buffer(1)]], constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_11, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..84ab7f4ddf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.spvasm @@ -0,0 +1,234 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 134 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %121 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %a = OpVariable %_ptr_Function_int Function %29 + %i = OpVariable %_ptr_Function_int Function %29 + %j = OpVariable %_ptr_Function_int Function %29 + %35 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %36 = OpLoad %int %35 + OpStore %a %36 + %37 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %38 = OpLoad %int %37 + OpStore %i %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpSLessThan %bool %43 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %40 + %49 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %53 = OpLoad %int %52 + OpStore %j %53 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %int %j + %59 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpSLessThan %bool %58 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %64 + %63 = OpLabel + OpBranch %62 + %64 = OpLabel + OpBranch %55 + %62 = OpLabel + OpBranch %65 + %65 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %71 = OpLoad %int %70 + OpStore %a %71 + %73 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %74 = OpLoad %float %73 + %76 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %77 = OpLoad %float %76 + %78 = OpFOrdLessThan %bool %74 %77 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + OpKill + %79 = OpLabel + OpBranch %67 + %67 = OpLabel + %81 = OpLoad %int %a + %82 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpSLessThan %bool %81 %83 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %87 + %86 = OpLabel + OpBranch %85 + %87 = OpLabel + OpBranch %66 + %85 = OpLabel + OpBranch %65 + %66 = OpLabel + %88 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %89 = OpLoad %float %88 + %90 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %91 = OpLoad %float %90 + %92 = OpFOrdLessThan %bool %89 %91 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + OpBranch %55 + %93 = OpLabel + OpBranch %56 + %56 = OpLabel + %95 = OpLoad %int %j + %96 = OpIAdd %int %95 %int_1 + OpStore %j %96 + OpBranch %54 + %55 = OpLabel + OpBranch %41 + %41 = OpLabel + %97 = OpLoad %int %i + %98 = OpIAdd %int %97 %int_1 + OpStore %i %98 + OpBranch %39 + %40 = OpLabel + %99 = OpLoad %int %a + %100 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %101 = OpLoad %int %100 + %102 = OpIEqual %bool %99 %101 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + %106 = OpLoad %int %a + %107 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %108 = OpLoad %int %107 + %109 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %110 = OpLoad %int %109 + %111 = OpLoad %int %a + %112 = OpConvertSToF %float %106 + %113 = OpConvertSToF %float %108 + %114 = OpConvertSToF %float %110 + %115 = OpConvertSToF %float %111 + %116 = OpCompositeConstruct %v4float %112 %113 %114 %115 + OpStore %x_GLF_color %116 + OpBranch %103 + %105 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %118 = OpLoad %int %117 + %119 = OpConvertSToF %float %118 + %120 = OpCompositeConstruct %v4float %119 %119 %119 %119 + OpStore %x_GLF_color %120 + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %121 +%tint_symbol_1 = OpFunctionParameter %main_out + %125 = OpLabel + %126 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %126 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %128 = OpLabel + %129 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %129 + %130 = OpFunctionCall %void %main_1 + %132 = OpLoad %v4float %x_GLF_color + %133 = OpCompositeConstruct %main_out %132 + %131 = OpFunctionCall %void %tint_symbol_3 %133 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 67[%67] is not post dominated by the back-edge block 85[%85] + %85 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..9373467bc4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.spvasm.expected.wgsl @@ -0,0 +1,108 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + var j : i32; + let x_36 : i32 = x_7.x_GLF_uniform_int_values[2]; + a = x_36; + let x_38 : i32 = x_7.x_GLF_uniform_int_values[2]; + i = x_38; + loop { + let x_43 : i32 = i; + let x_45 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_43 < x_45)) { + } else { + break; + } + let x_49 : i32 = x_7.x_GLF_uniform_int_values[2]; + j = x_49; + loop { + let x_54 : i32 = j; + let x_56 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_54 < x_56)) { + } else { + break; + } + loop { + let x_64 : i32 = x_7.x_GLF_uniform_int_values[1]; + a = x_64; + let x_66 : f32 = gl_FragCoord.y; + let x_68 : f32 = x_11.x_GLF_uniform_float_values[0]; + if ((x_66 < x_68)) { + discard; + } + + continuing { + let x_72 : i32 = a; + let x_74 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_72 < x_74)) { + } else { + break; + } + } + } + let x_77 : f32 = gl_FragCoord.y; + let x_79 : f32 = x_11.x_GLF_uniform_float_values[0]; + if ((x_77 < x_79)) { + break; + } + + continuing { + let x_83 : i32 = j; + j = (x_83 + 1); + } + } + + continuing { + let x_85 : i32 = i; + i = (x_85 + 1); + } + } + let x_87 : i32 = a; + let x_89 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_87 == x_89)) { + let x_94 : i32 = a; + let x_97 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_100 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_102 : i32 = a; + x_GLF_color = vec4(f32(x_94), f32(x_97), f32(x_100), f32(x_102)); + } else { + let x_106 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_107 : f32 = f32(x_106); + x_GLF_color = vec4(x_107, x_107, x_107, x_107); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl new file mode 100644 index 0000000000..9373467bc4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl @@ -0,0 +1,108 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + var j : i32; + let x_36 : i32 = x_7.x_GLF_uniform_int_values[2]; + a = x_36; + let x_38 : i32 = x_7.x_GLF_uniform_int_values[2]; + i = x_38; + loop { + let x_43 : i32 = i; + let x_45 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_43 < x_45)) { + } else { + break; + } + let x_49 : i32 = x_7.x_GLF_uniform_int_values[2]; + j = x_49; + loop { + let x_54 : i32 = j; + let x_56 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_54 < x_56)) { + } else { + break; + } + loop { + let x_64 : i32 = x_7.x_GLF_uniform_int_values[1]; + a = x_64; + let x_66 : f32 = gl_FragCoord.y; + let x_68 : f32 = x_11.x_GLF_uniform_float_values[0]; + if ((x_66 < x_68)) { + discard; + } + + continuing { + let x_72 : i32 = a; + let x_74 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_72 < x_74)) { + } else { + break; + } + } + } + let x_77 : f32 = gl_FragCoord.y; + let x_79 : f32 = x_11.x_GLF_uniform_float_values[0]; + if ((x_77 < x_79)) { + break; + } + + continuing { + let x_83 : i32 = j; + j = (x_83 + 1); + } + } + + continuing { + let x_85 : i32 = i; + i = (x_85 + 1); + } + } + let x_87 : i32 = a; + let x_89 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_87 == x_89)) { + let x_94 : i32 = a; + let x_97 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_100 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_102 : i32 = a; + x_GLF_color = vec4(f32(x_94), f32(x_97), f32(x_100), f32(x_102)); + } else { + let x_106 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_107 : f32 = f32(x_106); + x_GLF_color = vec4(x_107, x_107, x_107, x_107); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..400789ea8a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.hlsl @@ -0,0 +1,100 @@ +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + int j = 0; + const int x_36 = asint(x_7[2].x); + a = x_36; + const int x_38 = asint(x_7[2].x); + i = x_38; + while (true) { + const int x_43 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_45 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_43 < x_45)) { + } else { + break; + } + const int x_49 = asint(x_7[2].x); + j = x_49; + while (true) { + const int x_54 = j; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_54 < x_56)) { + } else { + break; + } + while (true) { + const int x_64 = asint(x_7[1].x); + a = x_64; + const float x_66 = gl_FragCoord.y; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_68 = asfloat(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_66 < x_68)) { + discard; + } + { + const int x_72 = a; + const int x_74 = asint(x_7[1].x); + if ((x_72 < x_74)) { + } else { + break; + } + } + } + const float x_77 = gl_FragCoord.y; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_79 = asfloat(x_11[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_77 < x_79)) { + break; + } + { + j = (j + 1); + } + } + { + i = (i + 1); + } + } + const int x_87 = a; + const int x_89 = asint(x_7[1].x); + if ((x_87 == x_89)) { + const int x_94 = a; + const int x_97 = asint(x_7[2].x); + const int x_100 = asint(x_7[2].x); + x_GLF_color = float4(float(x_94), float(x_97), float(x_100), float(a)); + } else { + const int x_106 = asint(x_7[2].x); + const float x_107 = float(x_106); + x_GLF_color = float4(x_107, x_107, x_107, x_107); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..e1218a1f2a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_11, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int a = 0; + int i = 0; + int j = 0; + int const x_36 = x_7.x_GLF_uniform_int_values.arr[2].el; + a = x_36; + int const x_38 = x_7.x_GLF_uniform_int_values.arr[2].el; + i = x_38; + while (true) { + int const x_43 = i; + int const x_45 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_43 < x_45)) { + } else { + break; + } + int const x_49 = x_7.x_GLF_uniform_int_values.arr[2].el; + j = x_49; + while (true) { + int const x_54 = j; + int const x_56 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_54 < x_56)) { + } else { + break; + } + while (true) { + int const x_64 = x_7.x_GLF_uniform_int_values.arr[1].el; + a = x_64; + float const x_66 = (*(tint_symbol_5)).y; + float const x_68 = x_11.x_GLF_uniform_float_values.arr[0].el; + if ((x_66 < x_68)) { + discard_fragment(); + } + { + int const x_72 = a; + int const x_74 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_72 < x_74)) { + } else { + break; + } + } + } + float const x_77 = (*(tint_symbol_5)).y; + float const x_79 = x_11.x_GLF_uniform_float_values.arr[0].el; + if ((x_77 < x_79)) { + break; + } + { + int const x_83 = j; + j = (x_83 + 1); + } + } + { + int const x_85 = i; + i = (x_85 + 1); + } + } + int const x_87 = a; + int const x_89 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_87 == x_89)) { + int const x_94 = a; + int const x_97 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_100 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_102 = a; + *(tint_symbol_6) = float4(float(x_94), float(x_97), float(x_100), float(x_102)); + } else { + int const x_106 = x_7.x_GLF_uniform_int_values.arr[2].el; + float const x_107 = float(x_106); + *(tint_symbol_6) = float4(x_107, x_107, x_107, x_107); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_7 [[buffer(1)]], constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_11, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..84ab7f4ddf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.spvasm @@ -0,0 +1,234 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 134 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main_out = OpTypeStruct %v4float + %121 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %a = OpVariable %_ptr_Function_int Function %29 + %i = OpVariable %_ptr_Function_int Function %29 + %j = OpVariable %_ptr_Function_int Function %29 + %35 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %36 = OpLoad %int %35 + OpStore %a %36 + %37 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %38 = OpLoad %int %37 + OpStore %i %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpSLessThan %bool %43 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %40 + %49 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %53 = OpLoad %int %52 + OpStore %j %53 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %int %j + %59 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpSLessThan %bool %58 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %64 + %63 = OpLabel + OpBranch %62 + %64 = OpLabel + OpBranch %55 + %62 = OpLabel + OpBranch %65 + %65 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %71 = OpLoad %int %70 + OpStore %a %71 + %73 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %74 = OpLoad %float %73 + %76 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %77 = OpLoad %float %76 + %78 = OpFOrdLessThan %bool %74 %77 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + OpKill + %79 = OpLabel + OpBranch %67 + %67 = OpLabel + %81 = OpLoad %int %a + %82 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpSLessThan %bool %81 %83 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %87 + %86 = OpLabel + OpBranch %85 + %87 = OpLabel + OpBranch %66 + %85 = OpLabel + OpBranch %65 + %66 = OpLabel + %88 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %89 = OpLoad %float %88 + %90 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %91 = OpLoad %float %90 + %92 = OpFOrdLessThan %bool %89 %91 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + OpBranch %55 + %93 = OpLabel + OpBranch %56 + %56 = OpLabel + %95 = OpLoad %int %j + %96 = OpIAdd %int %95 %int_1 + OpStore %j %96 + OpBranch %54 + %55 = OpLabel + OpBranch %41 + %41 = OpLabel + %97 = OpLoad %int %i + %98 = OpIAdd %int %97 %int_1 + OpStore %i %98 + OpBranch %39 + %40 = OpLabel + %99 = OpLoad %int %a + %100 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %101 = OpLoad %int %100 + %102 = OpIEqual %bool %99 %101 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + %106 = OpLoad %int %a + %107 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %108 = OpLoad %int %107 + %109 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %110 = OpLoad %int %109 + %111 = OpLoad %int %a + %112 = OpConvertSToF %float %106 + %113 = OpConvertSToF %float %108 + %114 = OpConvertSToF %float %110 + %115 = OpConvertSToF %float %111 + %116 = OpCompositeConstruct %v4float %112 %113 %114 %115 + OpStore %x_GLF_color %116 + OpBranch %103 + %105 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %118 = OpLoad %int %117 + %119 = OpConvertSToF %float %118 + %120 = OpCompositeConstruct %v4float %119 %119 %119 %119 + OpStore %x_GLF_color %120 + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %121 +%tint_symbol_1 = OpFunctionParameter %main_out + %125 = OpLabel + %126 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %126 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %128 = OpLabel + %129 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %129 + %130 = OpFunctionCall %void %main_1 + %132 = OpLoad %v4float %x_GLF_color + %133 = OpCompositeConstruct %main_out %132 + %131 = OpFunctionCall %void %tint_symbol_3 %133 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 67[%67] is not post dominated by the back-edge block 85[%85] + %85 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..9373467bc4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for-for-do-while-if-if/0-opt.wgsl.expected.wgsl @@ -0,0 +1,108 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + var j : i32; + let x_36 : i32 = x_7.x_GLF_uniform_int_values[2]; + a = x_36; + let x_38 : i32 = x_7.x_GLF_uniform_int_values[2]; + i = x_38; + loop { + let x_43 : i32 = i; + let x_45 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_43 < x_45)) { + } else { + break; + } + let x_49 : i32 = x_7.x_GLF_uniform_int_values[2]; + j = x_49; + loop { + let x_54 : i32 = j; + let x_56 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_54 < x_56)) { + } else { + break; + } + loop { + let x_64 : i32 = x_7.x_GLF_uniform_int_values[1]; + a = x_64; + let x_66 : f32 = gl_FragCoord.y; + let x_68 : f32 = x_11.x_GLF_uniform_float_values[0]; + if ((x_66 < x_68)) { + discard; + } + + continuing { + let x_72 : i32 = a; + let x_74 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_72 < x_74)) { + } else { + break; + } + } + } + let x_77 : f32 = gl_FragCoord.y; + let x_79 : f32 = x_11.x_GLF_uniform_float_values[0]; + if ((x_77 < x_79)) { + break; + } + + continuing { + let x_83 : i32 = j; + j = (x_83 + 1); + } + } + + continuing { + let x_85 : i32 = i; + i = (x_85 + 1); + } + } + let x_87 : i32 = a; + let x_89 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_87 == x_89)) { + let x_94 : i32 = a; + let x_97 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_100 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_102 : i32 = a; + x_GLF_color = vec4(f32(x_94), f32(x_97), f32(x_100), f32(x_102)); + } else { + let x_106 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_107 : f32 = f32(x_106); + x_GLF_color = vec4(x_107, x_107, x_107, x_107); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm new file mode 100644 index 0000000000..7e9bff0b4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm @@ -0,0 +1,414 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %b "b" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %i_0 "i" + OpName %i_1 "i" + OpName %i_2 "i" + OpName %i_3 "i" + OpName %i_4 "i" + OpName %i_5 "i" + OpName %i_6 "i" + OpName %i_7 "i" + OpName %i_8 "i" + OpName %i_9 "i" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %i RelaxedPrecision + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 RelaxedPrecision + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %24 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %i_0 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %i_1 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %i_2 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %i_3 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %i_4 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %i_5 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %i_6 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %i_7 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %i_8 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %i_9 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %57 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + OpDecorate %59 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + OpDecorate %61 RelaxedPrecision + OpDecorate %62 RelaxedPrecision + OpDecorate %63 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %65 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %67 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %69 RelaxedPrecision + OpDecorate %70 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %74 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %77 RelaxedPrecision + OpDecorate %78 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %80 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %80 + %102 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %b = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %i_2 = OpVariable %_ptr_Function_int Function + %i_3 = OpVariable %_ptr_Function_int Function + %i_4 = OpVariable %_ptr_Function_int Function + %i_5 = OpVariable %_ptr_Function_int Function + %i_6 = OpVariable %_ptr_Function_int Function + %i_7 = OpVariable %_ptr_Function_int Function + %i_8 = OpVariable %_ptr_Function_int Function + %i_9 = OpVariable %_ptr_Function_int Function + %103 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %104 = OpLoad %float %103 + OpStore %a %104 + %105 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %106 = OpLoad %float %105 + OpStore %b %106 + %107 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %24 = OpLoad %int %107 + OpStore %i %24 + OpBranch %108 + %108 = OpLabel + OpLoopMerge %109 %110 None + OpBranch %111 + %111 = OpLabel + %25 = OpLoad %int %i + %112 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %26 = OpLoad %int %112 + %113 = OpSLessThan %bool %25 %26 + OpBranchConditional %113 %114 %109 + %114 = OpLabel + %115 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %27 = OpLoad %int %115 + OpStore %i_0 %27 + OpBranch %116 + %116 = OpLabel + OpLoopMerge %117 %118 None + OpBranch %119 + %119 = OpLabel + %28 = OpLoad %int %i_0 + %120 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %29 = OpLoad %int %120 + %121 = OpSLessThan %bool %28 %29 + OpBranchConditional %121 %122 %117 + %122 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %30 = OpLoad %int %123 + OpStore %i_1 %30 + OpBranch %124 + %124 = OpLabel + OpLoopMerge %125 %126 None + OpBranch %127 + %127 = OpLabel + %31 = OpLoad %int %i_1 + %128 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %32 = OpLoad %int %128 + %129 = OpSLessThan %bool %31 %32 + OpBranchConditional %129 %130 %125 + %130 = OpLabel + %131 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %33 = OpLoad %int %131 + OpStore %i_2 %33 + OpBranch %132 + %132 = OpLabel + OpLoopMerge %133 %134 None + OpBranch %135 + %135 = OpLabel + %34 = OpLoad %int %i_2 + %136 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %35 = OpLoad %int %136 + %137 = OpSLessThan %bool %34 %35 + OpBranchConditional %137 %138 %133 + %138 = OpLabel + %139 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %36 = OpLoad %int %139 + OpStore %i_3 %36 + OpBranch %140 + %140 = OpLabel + OpLoopMerge %141 %142 None + OpBranch %143 + %143 = OpLabel + %37 = OpLoad %int %i_3 + %144 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %38 = OpLoad %int %144 + %145 = OpSLessThan %bool %37 %38 + OpBranchConditional %145 %146 %141 + %146 = OpLabel + %147 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %39 = OpLoad %int %147 + OpStore %i_4 %39 + OpBranch %148 + %148 = OpLabel + OpLoopMerge %149 %150 None + OpBranch %151 + %151 = OpLabel + %40 = OpLoad %int %i_4 + %152 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %41 = OpLoad %int %152 + %153 = OpSLessThan %bool %40 %41 + OpBranchConditional %153 %154 %149 + %154 = OpLabel + %155 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %42 = OpLoad %int %155 + OpStore %i_5 %42 + OpBranch %156 + %156 = OpLabel + OpLoopMerge %157 %158 None + OpBranch %159 + %159 = OpLabel + %43 = OpLoad %int %i_5 + %160 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %44 = OpLoad %int %160 + %161 = OpSLessThan %bool %43 %44 + OpBranchConditional %161 %162 %157 + %162 = OpLabel + %163 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %45 = OpLoad %int %163 + OpStore %i_6 %45 + OpBranch %164 + %164 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %46 = OpLoad %int %i_6 + %168 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %47 = OpLoad %int %168 + %169 = OpSLessThan %bool %46 %47 + OpBranchConditional %169 %170 %165 + %170 = OpLabel + %171 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %48 = OpLoad %int %171 + OpStore %i_7 %48 + OpBranch %172 + %172 = OpLabel + OpLoopMerge %173 %174 None + OpBranch %175 + %175 = OpLabel + %49 = OpLoad %int %i_7 + %176 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %50 = OpLoad %int %176 + %177 = OpSLessThan %bool %49 %50 + OpBranchConditional %177 %178 %173 + %178 = OpLabel + %179 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %51 = OpLoad %int %179 + OpStore %i_8 %51 + OpBranch %180 + %180 = OpLabel + OpLoopMerge %181 %182 None + OpBranch %183 + %183 = OpLabel + %52 = OpLoad %int %i_8 + %184 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %53 = OpLoad %int %184 + %185 = OpSLessThan %bool %52 %53 + OpBranchConditional %185 %186 %181 + %186 = OpLabel + %187 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %54 = OpLoad %int %187 + OpStore %i_9 %54 + OpBranch %188 + %188 = OpLabel + OpLoopMerge %189 %190 None + OpBranch %191 + %191 = OpLabel + %55 = OpLoad %int %i_9 + %192 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %56 = OpLoad %int %192 + %193 = OpSLessThan %bool %55 %56 + OpBranchConditional %193 %194 %189 + %194 = OpLabel + %195 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %196 = OpLoad %float %195 + OpStore %a %196 + %197 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %198 = OpLoad %float %197 + %199 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %200 = OpLoad %float %199 + %201 = OpFOrdGreaterThan %bool %198 %200 + OpSelectionMerge %202 None + OpBranchConditional %201 %203 %202 + %203 = OpLabel + OpBranch %189 + %202 = OpLabel + OpBranch %190 + %190 = OpLabel + %57 = OpLoad %int %i_9 + %58 = OpIAdd %int %57 %int_1 + OpStore %i_9 %58 + OpBranch %188 + %189 = OpLabel + OpBranch %182 + %182 = OpLabel + %59 = OpLoad %int %i_8 + %60 = OpIAdd %int %59 %int_1 + OpStore %i_8 %60 + OpBranch %180 + %181 = OpLabel + OpBranch %174 + %174 = OpLabel + %61 = OpLoad %int %i_7 + %62 = OpIAdd %int %61 %int_1 + OpStore %i_7 %62 + OpBranch %172 + %173 = OpLabel + OpBranch %166 + %166 = OpLabel + %63 = OpLoad %int %i_6 + %64 = OpIAdd %int %63 %int_1 + OpStore %i_6 %64 + OpBranch %164 + %165 = OpLabel + OpBranch %158 + %158 = OpLabel + %65 = OpLoad %int %i_5 + %66 = OpIAdd %int %65 %int_1 + OpStore %i_5 %66 + OpBranch %156 + %157 = OpLabel + OpBranch %150 + %150 = OpLabel + %67 = OpLoad %int %i_4 + %68 = OpIAdd %int %67 %int_1 + OpStore %i_4 %68 + OpBranch %148 + %149 = OpLabel + OpBranch %142 + %142 = OpLabel + %69 = OpLoad %int %i_3 + %70 = OpIAdd %int %69 %int_1 + OpStore %i_3 %70 + OpBranch %140 + %141 = OpLabel + OpBranch %134 + %134 = OpLabel + %71 = OpLoad %int %i_2 + %72 = OpIAdd %int %71 %int_1 + OpStore %i_2 %72 + OpBranch %132 + %133 = OpLabel + OpBranch %126 + %126 = OpLabel + %73 = OpLoad %int %i_1 + %74 = OpIAdd %int %73 %int_1 + OpStore %i_1 %74 + OpBranch %124 + %125 = OpLabel + OpBranch %118 + %118 = OpLabel + %75 = OpLoad %int %i_0 + %76 = OpIAdd %int %75 %int_1 + OpStore %i_0 %76 + OpBranch %116 + %117 = OpLabel + %204 = OpLoad %float %b + %205 = OpFAdd %float %204 %float_1 + OpStore %b %205 + OpBranch %110 + %110 = OpLabel + %77 = OpLoad %int %i + %78 = OpIAdd %int %77 %int_1 + OpStore %i %78 + OpBranch %108 + %109 = OpLabel + %206 = OpLoad %float %b + %207 = OpLoad %float %a + %208 = OpLoad %float %a + %209 = OpLoad %float %b + %210 = OpCompositeConstruct %v4float %206 %207 %208 %209 + OpStore %_GLF_color %210 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3345993992 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.hlsl @@ -0,0 +1,212 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + float b = 0.0f; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_104 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + a = x_104; + const float x_106 = asfloat(x_7[1].x); + b = x_106; + const int x_24 = asint(x_11[1].x); + i = x_24; + while (true) { + const int x_25 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_26 = asint(x_11[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_25 < x_26)) { + } else { + break; + } + const int x_27 = asint(x_11[1].x); + i_1 = x_27; + while (true) { + const int x_28 = i_1; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_29 = asint(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_28 < x_29)) { + } else { + break; + } + const int x_30 = asint(x_11[1].x); + i_2 = x_30; + while (true) { + const int x_31 = i_2; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_32 = asint(x_11[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_31 < x_32)) { + } else { + break; + } + const int x_33 = asint(x_11[2].x); + i_3 = x_33; + while (true) { + const int x_34 = i_3; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_35 = asint(x_11[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_34 < x_35)) { + } else { + break; + } + const int x_36 = asint(x_11[2].x); + i_4 = x_36; + while (true) { + const int x_37 = i_4; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_11[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_37 < x_38)) { + } else { + break; + } + const int x_39 = asint(x_11[1].x); + i_5 = x_39; + while (true) { + const int x_40 = i_5; + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_41 = asint(x_11[scalar_offset_6 / 4][scalar_offset_6 % 4]); + if ((x_40 < x_41)) { + } else { + break; + } + const int x_42 = asint(x_11[1].x); + i_6 = x_42; + while (true) { + const int x_43 = i_6; + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_44 = asint(x_11[scalar_offset_7 / 4][scalar_offset_7 % 4]); + if ((x_43 < x_44)) { + } else { + break; + } + const int x_45 = asint(x_11[1].x); + i_7 = x_45; + while (true) { + const int x_46 = i_7; + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_11[scalar_offset_8 / 4][scalar_offset_8 % 4]); + if ((x_46 < x_47)) { + } else { + break; + } + const int x_48 = asint(x_11[1].x); + i_8 = x_48; + while (true) { + const int x_49 = i_8; + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_11[scalar_offset_9 / 4][scalar_offset_9 % 4]); + if ((x_49 < x_50)) { + } else { + break; + } + const int x_51 = asint(x_11[1].x); + i_9 = x_51; + while (true) { + const int x_52 = i_9; + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_11[scalar_offset_10 / 4][scalar_offset_10 % 4]); + if ((x_52 < x_53)) { + } else { + break; + } + const int x_54 = asint(x_11[1].x); + i_10 = x_54; + while (true) { + const int x_55 = i_10; + const uint scalar_offset_11 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_11[scalar_offset_11 / 4][scalar_offset_11 % 4]); + if ((x_55 < x_56)) { + } else { + break; + } + const float x_196 = asfloat(x_7[1].x); + a = x_196; + const float x_198 = gl_FragCoord.y; + const float x_200 = asfloat(x_7[1].x); + if ((x_198 > x_200)) { + break; + } + { + i_10 = (i_10 + 1); + } + } + { + i_9 = (i_9 + 1); + } + } + { + i_8 = (i_8 + 1); + } + } + { + i_7 = (i_7 + 1); + } + } + { + i_6 = (i_6 + 1); + } + } + { + i_5 = (i_5 + 1); + } + } + { + i_4 = (i_4 + 1); + } + } + { + i_3 = (i_3 + 1); + } + } + { + i_2 = (i_2 + 1); + } + } + { + i_1 = (i_1 + 1); + } + } + b = (b + 1.0f); + { + i = (i + 1); + } + } + x_GLF_color = float4(b, a, a, b); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..8d410b0559 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.msl @@ -0,0 +1,229 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_11, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float a = 0.0f; + float b = 0.0f; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + float const x_104 = x_7.x_GLF_uniform_float_values.arr[0].el; + a = x_104; + float const x_106 = x_7.x_GLF_uniform_float_values.arr[1].el; + b = x_106; + int const x_24 = x_11.x_GLF_uniform_int_values.arr[1].el; + i = x_24; + while (true) { + int const x_25 = i; + int const x_26 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_25 < x_26)) { + } else { + break; + } + int const x_27 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_1 = x_27; + while (true) { + int const x_28 = i_1; + int const x_29 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_28 < x_29)) { + } else { + break; + } + int const x_30 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_2 = x_30; + while (true) { + int const x_31 = i_2; + int const x_32 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_31 < x_32)) { + } else { + break; + } + int const x_33 = x_11.x_GLF_uniform_int_values.arr[2].el; + i_3 = x_33; + while (true) { + int const x_34 = i_3; + int const x_35 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_34 < x_35)) { + } else { + break; + } + int const x_36 = x_11.x_GLF_uniform_int_values.arr[2].el; + i_4 = x_36; + while (true) { + int const x_37 = i_4; + int const x_38 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_37 < x_38)) { + } else { + break; + } + int const x_39 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_5 = x_39; + while (true) { + int const x_40 = i_5; + int const x_41 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_40 < x_41)) { + } else { + break; + } + int const x_42 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_6 = x_42; + while (true) { + int const x_43 = i_6; + int const x_44 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_43 < x_44)) { + } else { + break; + } + int const x_45 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_7 = x_45; + while (true) { + int const x_46 = i_7; + int const x_47 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_46 < x_47)) { + } else { + break; + } + int const x_48 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_8 = x_48; + while (true) { + int const x_49 = i_8; + int const x_50 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_49 < x_50)) { + } else { + break; + } + int const x_51 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_9 = x_51; + while (true) { + int const x_52 = i_9; + int const x_53 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_52 < x_53)) { + } else { + break; + } + int const x_54 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_10 = x_54; + while (true) { + int const x_55 = i_10; + int const x_56 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_55 < x_56)) { + } else { + break; + } + float const x_196 = x_7.x_GLF_uniform_float_values.arr[1].el; + a = x_196; + float const x_198 = (*(tint_symbol_5)).y; + float const x_200 = x_7.x_GLF_uniform_float_values.arr[1].el; + if ((x_198 > x_200)) { + break; + } + { + int const x_57 = i_10; + i_10 = (x_57 + 1); + } + } + { + int const x_59 = i_9; + i_9 = (x_59 + 1); + } + } + { + int const x_61 = i_8; + i_8 = (x_61 + 1); + } + } + { + int const x_63 = i_7; + i_7 = (x_63 + 1); + } + } + { + int const x_65 = i_6; + i_6 = (x_65 + 1); + } + } + { + int const x_67 = i_5; + i_5 = (x_67 + 1); + } + } + { + int const x_69 = i_4; + i_4 = (x_69 + 1); + } + } + { + int const x_71 = i_3; + i_3 = (x_71 + 1); + } + } + { + int const x_73 = i_2; + i_2 = (x_73 + 1); + } + } + { + int const x_75 = i_1; + i_1 = (x_75 + 1); + } + } + float const x_204 = b; + b = (x_204 + 1.0f); + { + int const x_77 = i; + i = (x_77 + 1); + } + } + float const x_206 = b; + float const x_207 = a; + float const x_208 = a; + float const x_209 = b; + *(tint_symbol_6) = float4(x_206, x_207, x_208, x_209); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_11, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2125db7570 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.spvasm @@ -0,0 +1,441 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 252 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_11 "x_11" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %i_3 "i_3" + OpName %i_4 "i_4" + OpName %i_5 "i_5" + OpName %i_6 "i_6" + OpName %i_7 "i_7" + OpName %i_8 "i_8" + OpName %i_9 "i_9" + OpName %i_10 "i_10" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %239 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %a = OpVariable %_ptr_Function_float Function %29 + %b = OpVariable %_ptr_Function_float Function %29 + %i = OpVariable %_ptr_Function_int Function %33 + %i_1 = OpVariable %_ptr_Function_int Function %33 + %i_2 = OpVariable %_ptr_Function_int Function %33 + %i_3 = OpVariable %_ptr_Function_int Function %33 + %i_4 = OpVariable %_ptr_Function_int Function %33 + %i_5 = OpVariable %_ptr_Function_int Function %33 + %i_6 = OpVariable %_ptr_Function_int Function %33 + %i_7 = OpVariable %_ptr_Function_int Function %33 + %i_8 = OpVariable %_ptr_Function_int Function %33 + %i_9 = OpVariable %_ptr_Function_int Function %33 + %i_10 = OpVariable %_ptr_Function_int Function %33 + %47 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %48 = OpLoad %float %47 + OpStore %a %48 + %50 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %51 = OpLoad %float %50 + OpStore %b %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %54 = OpLoad %int %53 + OpStore %i %54 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %int %i + %60 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpSLessThan %bool %59 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %56 + %64 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %68 = OpLoad %int %67 + OpStore %i_1 %68 + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %int %i_1 + %74 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpSLessThan %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + OpBranch %77 + %79 = OpLabel + OpBranch %70 + %77 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %81 = OpLoad %int %80 + OpStore %i_2 %81 + OpBranch %82 + %82 = OpLabel + OpLoopMerge %83 %84 None + OpBranch %85 + %85 = OpLabel + %86 = OpLoad %int %i_2 + %87 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpSLessThan %bool %86 %88 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 + %91 = OpLabel + OpBranch %90 + %92 = OpLabel + OpBranch %83 + %90 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_2 + %95 = OpLoad %int %94 + OpStore %i_3 %95 + OpBranch %96 + %96 = OpLabel + OpLoopMerge %97 %98 None + OpBranch %99 + %99 = OpLabel + %100 = OpLoad %int %i_3 + %101 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %102 = OpLoad %int %101 + %103 = OpSLessThan %bool %100 %102 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %106 + %105 = OpLabel + OpBranch %104 + %106 = OpLabel + OpBranch %97 + %104 = OpLabel + %107 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_2 + %108 = OpLoad %int %107 + OpStore %i_4 %108 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %110 %111 None + OpBranch %112 + %112 = OpLabel + %113 = OpLoad %int %i_4 + %114 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %115 = OpLoad %int %114 + %116 = OpSLessThan %bool %113 %115 + OpSelectionMerge %117 None + OpBranchConditional %116 %118 %119 + %118 = OpLabel + OpBranch %117 + %119 = OpLabel + OpBranch %110 + %117 = OpLabel + %120 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %121 = OpLoad %int %120 + OpStore %i_5 %121 + OpBranch %122 + %122 = OpLabel + OpLoopMerge %123 %124 None + OpBranch %125 + %125 = OpLabel + %126 = OpLoad %int %i_5 + %127 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %128 = OpLoad %int %127 + %129 = OpSLessThan %bool %126 %128 + OpSelectionMerge %130 None + OpBranchConditional %129 %131 %132 + %131 = OpLabel + OpBranch %130 + %132 = OpLabel + OpBranch %123 + %130 = OpLabel + %133 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %134 = OpLoad %int %133 + OpStore %i_6 %134 + OpBranch %135 + %135 = OpLabel + OpLoopMerge %136 %137 None + OpBranch %138 + %138 = OpLabel + %139 = OpLoad %int %i_6 + %140 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %141 = OpLoad %int %140 + %142 = OpSLessThan %bool %139 %141 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %145 + %144 = OpLabel + OpBranch %143 + %145 = OpLabel + OpBranch %136 + %143 = OpLabel + %146 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %147 = OpLoad %int %146 + OpStore %i_7 %147 + OpBranch %148 + %148 = OpLabel + OpLoopMerge %149 %150 None + OpBranch %151 + %151 = OpLabel + %152 = OpLoad %int %i_7 + %153 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %154 = OpLoad %int %153 + %155 = OpSLessThan %bool %152 %154 + OpSelectionMerge %156 None + OpBranchConditional %155 %157 %158 + %157 = OpLabel + OpBranch %156 + %158 = OpLabel + OpBranch %149 + %156 = OpLabel + %159 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %160 = OpLoad %int %159 + OpStore %i_8 %160 + OpBranch %161 + %161 = OpLabel + OpLoopMerge %162 %163 None + OpBranch %164 + %164 = OpLabel + %165 = OpLoad %int %i_8 + %166 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %167 = OpLoad %int %166 + %168 = OpSLessThan %bool %165 %167 + OpSelectionMerge %169 None + OpBranchConditional %168 %170 %171 + %170 = OpLabel + OpBranch %169 + %171 = OpLabel + OpBranch %162 + %169 = OpLabel + %172 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %173 = OpLoad %int %172 + OpStore %i_9 %173 + OpBranch %174 + %174 = OpLabel + OpLoopMerge %175 %176 None + OpBranch %177 + %177 = OpLabel + %178 = OpLoad %int %i_9 + %179 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %180 = OpLoad %int %179 + %181 = OpSLessThan %bool %178 %180 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %184 + %183 = OpLabel + OpBranch %182 + %184 = OpLabel + OpBranch %175 + %182 = OpLabel + %185 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %186 = OpLoad %int %185 + OpStore %i_10 %186 + OpBranch %187 + %187 = OpLabel + OpLoopMerge %188 %189 None + OpBranch %190 + %190 = OpLabel + %191 = OpLoad %int %i_10 + %192 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %193 = OpLoad %int %192 + %194 = OpSLessThan %bool %191 %193 + OpSelectionMerge %195 None + OpBranchConditional %194 %196 %197 + %196 = OpLabel + OpBranch %195 + %197 = OpLabel + OpBranch %188 + %195 = OpLabel + %198 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %199 = OpLoad %float %198 + OpStore %a %199 + %202 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %203 = OpLoad %float %202 + %204 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %205 = OpLoad %float %204 + %206 = OpFOrdGreaterThan %bool %203 %205 + OpSelectionMerge %207 None + OpBranchConditional %206 %208 %207 + %208 = OpLabel + OpBranch %188 + %207 = OpLabel + OpBranch %189 + %189 = OpLabel + %209 = OpLoad %int %i_10 + %210 = OpIAdd %int %209 %int_1 + OpStore %i_10 %210 + OpBranch %187 + %188 = OpLabel + OpBranch %176 + %176 = OpLabel + %211 = OpLoad %int %i_9 + %212 = OpIAdd %int %211 %int_1 + OpStore %i_9 %212 + OpBranch %174 + %175 = OpLabel + OpBranch %163 + %163 = OpLabel + %213 = OpLoad %int %i_8 + %214 = OpIAdd %int %213 %int_1 + OpStore %i_8 %214 + OpBranch %161 + %162 = OpLabel + OpBranch %150 + %150 = OpLabel + %215 = OpLoad %int %i_7 + %216 = OpIAdd %int %215 %int_1 + OpStore %i_7 %216 + OpBranch %148 + %149 = OpLabel + OpBranch %137 + %137 = OpLabel + %217 = OpLoad %int %i_6 + %218 = OpIAdd %int %217 %int_1 + OpStore %i_6 %218 + OpBranch %135 + %136 = OpLabel + OpBranch %124 + %124 = OpLabel + %219 = OpLoad %int %i_5 + %220 = OpIAdd %int %219 %int_1 + OpStore %i_5 %220 + OpBranch %122 + %123 = OpLabel + OpBranch %111 + %111 = OpLabel + %221 = OpLoad %int %i_4 + %222 = OpIAdd %int %221 %int_1 + OpStore %i_4 %222 + OpBranch %109 + %110 = OpLabel + OpBranch %98 + %98 = OpLabel + %223 = OpLoad %int %i_3 + %224 = OpIAdd %int %223 %int_1 + OpStore %i_3 %224 + OpBranch %96 + %97 = OpLabel + OpBranch %84 + %84 = OpLabel + %225 = OpLoad %int %i_2 + %226 = OpIAdd %int %225 %int_1 + OpStore %i_2 %226 + OpBranch %82 + %83 = OpLabel + OpBranch %71 + %71 = OpLabel + %227 = OpLoad %int %i_1 + %228 = OpIAdd %int %227 %int_1 + OpStore %i_1 %228 + OpBranch %69 + %70 = OpLabel + %229 = OpLoad %float %b + %231 = OpFAdd %float %229 %float_1 + OpStore %b %231 + OpBranch %57 + %57 = OpLabel + %232 = OpLoad %int %i + %233 = OpIAdd %int %232 %int_1 + OpStore %i %233 + OpBranch %55 + %56 = OpLabel + %234 = OpLoad %float %b + %235 = OpLoad %float %a + %236 = OpLoad %float %a + %237 = OpLoad %float %b + %238 = OpCompositeConstruct %v4float %234 %235 %236 %237 + OpStore %x_GLF_color %238 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %239 +%tint_symbol_1 = OpFunctionParameter %main_out + %243 = OpLabel + %244 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %244 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %246 = OpLabel + %247 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %247 + %248 = OpFunctionCall %void %main_1 + %250 = OpLoad %v4float %x_GLF_color + %251 = OpCompositeConstruct %main_out %250 + %249 = OpFunctionCall %void %tint_symbol_3 %251 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..6a32b2df3f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.spvasm.expected.wgsl @@ -0,0 +1,233 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_11 : buf1; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var b : f32; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var i_3 : i32; + var i_4 : i32; + var i_5 : i32; + var i_6 : i32; + var i_7 : i32; + var i_8 : i32; + var i_9 : i32; + var i_10 : i32; + let x_104 : f32 = x_7.x_GLF_uniform_float_values[0]; + a = x_104; + let x_106 : f32 = x_7.x_GLF_uniform_float_values[1]; + b = x_106; + let x_24 : i32 = x_11.x_GLF_uniform_int_values[1]; + i = x_24; + loop { + let x_25 : i32 = i; + let x_26 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_25 < x_26)) { + } else { + break; + } + let x_27 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_1 = x_27; + loop { + let x_28 : i32 = i_1; + let x_29 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_28 < x_29)) { + } else { + break; + } + let x_30 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_2 = x_30; + loop { + let x_31 : i32 = i_2; + let x_32 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_31 < x_32)) { + } else { + break; + } + let x_33 : i32 = x_11.x_GLF_uniform_int_values[2]; + i_3 = x_33; + loop { + let x_34 : i32 = i_3; + let x_35 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_34 < x_35)) { + } else { + break; + } + let x_36 : i32 = x_11.x_GLF_uniform_int_values[2]; + i_4 = x_36; + loop { + let x_37 : i32 = i_4; + let x_38 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_37 < x_38)) { + } else { + break; + } + let x_39 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_5 = x_39; + loop { + let x_40 : i32 = i_5; + let x_41 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_40 < x_41)) { + } else { + break; + } + let x_42 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_6 = x_42; + loop { + let x_43 : i32 = i_6; + let x_44 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_43 < x_44)) { + } else { + break; + } + let x_45 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_7 = x_45; + loop { + let x_46 : i32 = i_7; + let x_47 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_46 < x_47)) { + } else { + break; + } + let x_48 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_8 = x_48; + loop { + let x_49 : i32 = i_8; + let x_50 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_49 < x_50)) { + } else { + break; + } + let x_51 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_9 = x_51; + loop { + let x_52 : i32 = i_9; + let x_53 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_52 < x_53)) { + } else { + break; + } + let x_54 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_10 = x_54; + loop { + let x_55 : i32 = i_10; + let x_56 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_55 < x_56)) { + } else { + break; + } + let x_196 : f32 = x_7.x_GLF_uniform_float_values[1]; + a = x_196; + let x_198 : f32 = gl_FragCoord.y; + let x_200 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_198 > x_200)) { + break; + } + + continuing { + let x_57 : i32 = i_10; + i_10 = (x_57 + 1); + } + } + + continuing { + let x_59 : i32 = i_9; + i_9 = (x_59 + 1); + } + } + + continuing { + let x_61 : i32 = i_8; + i_8 = (x_61 + 1); + } + } + + continuing { + let x_63 : i32 = i_7; + i_7 = (x_63 + 1); + } + } + + continuing { + let x_65 : i32 = i_6; + i_6 = (x_65 + 1); + } + } + + continuing { + let x_67 : i32 = i_5; + i_5 = (x_67 + 1); + } + } + + continuing { + let x_69 : i32 = i_4; + i_4 = (x_69 + 1); + } + } + + continuing { + let x_71 : i32 = i_3; + i_3 = (x_71 + 1); + } + } + + continuing { + let x_73 : i32 = i_2; + i_2 = (x_73 + 1); + } + } + + continuing { + let x_75 : i32 = i_1; + i_1 = (x_75 + 1); + } + } + let x_204 : f32 = b; + b = (x_204 + 1.0); + + continuing { + let x_77 : i32 = i; + i = (x_77 + 1); + } + } + let x_206 : f32 = b; + let x_207 : f32 = a; + let x_208 : f32 = a; + let x_209 : f32 = b; + x_GLF_color = vec4(x_206, x_207, x_208, x_209); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl new file mode 100644 index 0000000000..6a32b2df3f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl @@ -0,0 +1,233 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_11 : buf1; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var b : f32; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var i_3 : i32; + var i_4 : i32; + var i_5 : i32; + var i_6 : i32; + var i_7 : i32; + var i_8 : i32; + var i_9 : i32; + var i_10 : i32; + let x_104 : f32 = x_7.x_GLF_uniform_float_values[0]; + a = x_104; + let x_106 : f32 = x_7.x_GLF_uniform_float_values[1]; + b = x_106; + let x_24 : i32 = x_11.x_GLF_uniform_int_values[1]; + i = x_24; + loop { + let x_25 : i32 = i; + let x_26 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_25 < x_26)) { + } else { + break; + } + let x_27 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_1 = x_27; + loop { + let x_28 : i32 = i_1; + let x_29 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_28 < x_29)) { + } else { + break; + } + let x_30 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_2 = x_30; + loop { + let x_31 : i32 = i_2; + let x_32 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_31 < x_32)) { + } else { + break; + } + let x_33 : i32 = x_11.x_GLF_uniform_int_values[2]; + i_3 = x_33; + loop { + let x_34 : i32 = i_3; + let x_35 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_34 < x_35)) { + } else { + break; + } + let x_36 : i32 = x_11.x_GLF_uniform_int_values[2]; + i_4 = x_36; + loop { + let x_37 : i32 = i_4; + let x_38 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_37 < x_38)) { + } else { + break; + } + let x_39 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_5 = x_39; + loop { + let x_40 : i32 = i_5; + let x_41 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_40 < x_41)) { + } else { + break; + } + let x_42 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_6 = x_42; + loop { + let x_43 : i32 = i_6; + let x_44 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_43 < x_44)) { + } else { + break; + } + let x_45 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_7 = x_45; + loop { + let x_46 : i32 = i_7; + let x_47 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_46 < x_47)) { + } else { + break; + } + let x_48 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_8 = x_48; + loop { + let x_49 : i32 = i_8; + let x_50 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_49 < x_50)) { + } else { + break; + } + let x_51 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_9 = x_51; + loop { + let x_52 : i32 = i_9; + let x_53 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_52 < x_53)) { + } else { + break; + } + let x_54 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_10 = x_54; + loop { + let x_55 : i32 = i_10; + let x_56 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_55 < x_56)) { + } else { + break; + } + let x_196 : f32 = x_7.x_GLF_uniform_float_values[1]; + a = x_196; + let x_198 : f32 = gl_FragCoord.y; + let x_200 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_198 > x_200)) { + break; + } + + continuing { + let x_57 : i32 = i_10; + i_10 = (x_57 + 1); + } + } + + continuing { + let x_59 : i32 = i_9; + i_9 = (x_59 + 1); + } + } + + continuing { + let x_61 : i32 = i_8; + i_8 = (x_61 + 1); + } + } + + continuing { + let x_63 : i32 = i_7; + i_7 = (x_63 + 1); + } + } + + continuing { + let x_65 : i32 = i_6; + i_6 = (x_65 + 1); + } + } + + continuing { + let x_67 : i32 = i_5; + i_5 = (x_67 + 1); + } + } + + continuing { + let x_69 : i32 = i_4; + i_4 = (x_69 + 1); + } + } + + continuing { + let x_71 : i32 = i_3; + i_3 = (x_71 + 1); + } + } + + continuing { + let x_73 : i32 = i_2; + i_2 = (x_73 + 1); + } + } + + continuing { + let x_75 : i32 = i_1; + i_1 = (x_75 + 1); + } + } + let x_204 : f32 = b; + b = (x_204 + 1.0); + + continuing { + let x_77 : i32 = i; + i = (x_77 + 1); + } + } + let x_206 : f32 = b; + let x_207 : f32 = a; + let x_208 : f32 = a; + let x_209 : f32 = b; + x_GLF_color = vec4(x_206, x_207, x_208, x_209); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3345993992 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.hlsl @@ -0,0 +1,212 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + float b = 0.0f; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_104 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + a = x_104; + const float x_106 = asfloat(x_7[1].x); + b = x_106; + const int x_24 = asint(x_11[1].x); + i = x_24; + while (true) { + const int x_25 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_26 = asint(x_11[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_25 < x_26)) { + } else { + break; + } + const int x_27 = asint(x_11[1].x); + i_1 = x_27; + while (true) { + const int x_28 = i_1; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_29 = asint(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_28 < x_29)) { + } else { + break; + } + const int x_30 = asint(x_11[1].x); + i_2 = x_30; + while (true) { + const int x_31 = i_2; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_32 = asint(x_11[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_31 < x_32)) { + } else { + break; + } + const int x_33 = asint(x_11[2].x); + i_3 = x_33; + while (true) { + const int x_34 = i_3; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_35 = asint(x_11[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_34 < x_35)) { + } else { + break; + } + const int x_36 = asint(x_11[2].x); + i_4 = x_36; + while (true) { + const int x_37 = i_4; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_11[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_37 < x_38)) { + } else { + break; + } + const int x_39 = asint(x_11[1].x); + i_5 = x_39; + while (true) { + const int x_40 = i_5; + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_41 = asint(x_11[scalar_offset_6 / 4][scalar_offset_6 % 4]); + if ((x_40 < x_41)) { + } else { + break; + } + const int x_42 = asint(x_11[1].x); + i_6 = x_42; + while (true) { + const int x_43 = i_6; + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_44 = asint(x_11[scalar_offset_7 / 4][scalar_offset_7 % 4]); + if ((x_43 < x_44)) { + } else { + break; + } + const int x_45 = asint(x_11[1].x); + i_7 = x_45; + while (true) { + const int x_46 = i_7; + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_11[scalar_offset_8 / 4][scalar_offset_8 % 4]); + if ((x_46 < x_47)) { + } else { + break; + } + const int x_48 = asint(x_11[1].x); + i_8 = x_48; + while (true) { + const int x_49 = i_8; + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_11[scalar_offset_9 / 4][scalar_offset_9 % 4]); + if ((x_49 < x_50)) { + } else { + break; + } + const int x_51 = asint(x_11[1].x); + i_9 = x_51; + while (true) { + const int x_52 = i_9; + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_11[scalar_offset_10 / 4][scalar_offset_10 % 4]); + if ((x_52 < x_53)) { + } else { + break; + } + const int x_54 = asint(x_11[1].x); + i_10 = x_54; + while (true) { + const int x_55 = i_10; + const uint scalar_offset_11 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_11[scalar_offset_11 / 4][scalar_offset_11 % 4]); + if ((x_55 < x_56)) { + } else { + break; + } + const float x_196 = asfloat(x_7[1].x); + a = x_196; + const float x_198 = gl_FragCoord.y; + const float x_200 = asfloat(x_7[1].x); + if ((x_198 > x_200)) { + break; + } + { + i_10 = (i_10 + 1); + } + } + { + i_9 = (i_9 + 1); + } + } + { + i_8 = (i_8 + 1); + } + } + { + i_7 = (i_7 + 1); + } + } + { + i_6 = (i_6 + 1); + } + } + { + i_5 = (i_5 + 1); + } + } + { + i_4 = (i_4 + 1); + } + } + { + i_3 = (i_3 + 1); + } + } + { + i_2 = (i_2 + 1); + } + } + { + i_1 = (i_1 + 1); + } + } + b = (b + 1.0f); + { + i = (i + 1); + } + } + x_GLF_color = float4(b, a, a, b); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..8d410b0559 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.msl @@ -0,0 +1,229 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_11, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float a = 0.0f; + float b = 0.0f; + int i = 0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + int i_7 = 0; + int i_8 = 0; + int i_9 = 0; + int i_10 = 0; + float const x_104 = x_7.x_GLF_uniform_float_values.arr[0].el; + a = x_104; + float const x_106 = x_7.x_GLF_uniform_float_values.arr[1].el; + b = x_106; + int const x_24 = x_11.x_GLF_uniform_int_values.arr[1].el; + i = x_24; + while (true) { + int const x_25 = i; + int const x_26 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_25 < x_26)) { + } else { + break; + } + int const x_27 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_1 = x_27; + while (true) { + int const x_28 = i_1; + int const x_29 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_28 < x_29)) { + } else { + break; + } + int const x_30 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_2 = x_30; + while (true) { + int const x_31 = i_2; + int const x_32 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_31 < x_32)) { + } else { + break; + } + int const x_33 = x_11.x_GLF_uniform_int_values.arr[2].el; + i_3 = x_33; + while (true) { + int const x_34 = i_3; + int const x_35 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_34 < x_35)) { + } else { + break; + } + int const x_36 = x_11.x_GLF_uniform_int_values.arr[2].el; + i_4 = x_36; + while (true) { + int const x_37 = i_4; + int const x_38 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_37 < x_38)) { + } else { + break; + } + int const x_39 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_5 = x_39; + while (true) { + int const x_40 = i_5; + int const x_41 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_40 < x_41)) { + } else { + break; + } + int const x_42 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_6 = x_42; + while (true) { + int const x_43 = i_6; + int const x_44 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_43 < x_44)) { + } else { + break; + } + int const x_45 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_7 = x_45; + while (true) { + int const x_46 = i_7; + int const x_47 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_46 < x_47)) { + } else { + break; + } + int const x_48 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_8 = x_48; + while (true) { + int const x_49 = i_8; + int const x_50 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_49 < x_50)) { + } else { + break; + } + int const x_51 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_9 = x_51; + while (true) { + int const x_52 = i_9; + int const x_53 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_52 < x_53)) { + } else { + break; + } + int const x_54 = x_11.x_GLF_uniform_int_values.arr[1].el; + i_10 = x_54; + while (true) { + int const x_55 = i_10; + int const x_56 = x_11.x_GLF_uniform_int_values.arr[0].el; + if ((x_55 < x_56)) { + } else { + break; + } + float const x_196 = x_7.x_GLF_uniform_float_values.arr[1].el; + a = x_196; + float const x_198 = (*(tint_symbol_5)).y; + float const x_200 = x_7.x_GLF_uniform_float_values.arr[1].el; + if ((x_198 > x_200)) { + break; + } + { + int const x_57 = i_10; + i_10 = (x_57 + 1); + } + } + { + int const x_59 = i_9; + i_9 = (x_59 + 1); + } + } + { + int const x_61 = i_8; + i_8 = (x_61 + 1); + } + } + { + int const x_63 = i_7; + i_7 = (x_63 + 1); + } + } + { + int const x_65 = i_6; + i_6 = (x_65 + 1); + } + } + { + int const x_67 = i_5; + i_5 = (x_67 + 1); + } + } + { + int const x_69 = i_4; + i_4 = (x_69 + 1); + } + } + { + int const x_71 = i_3; + i_3 = (x_71 + 1); + } + } + { + int const x_73 = i_2; + i_2 = (x_73 + 1); + } + } + { + int const x_75 = i_1; + i_1 = (x_75 + 1); + } + } + float const x_204 = b; + b = (x_204 + 1.0f); + { + int const x_77 = i; + i = (x_77 + 1); + } + } + float const x_206 = b; + float const x_207 = a; + float const x_208 = a; + float const x_209 = b; + *(tint_symbol_6) = float4(x_206, x_207, x_208, x_209); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_11, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2125db7570 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.spvasm @@ -0,0 +1,441 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 252 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_11 "x_11" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %i "i" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %i_3 "i_3" + OpName %i_4 "i_4" + OpName %i_5 "i_5" + OpName %i_6 "i_6" + OpName %i_7 "i_7" + OpName %i_8 "i_8" + OpName %i_9 "i_9" + OpName %i_10 "i_10" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %239 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %a = OpVariable %_ptr_Function_float Function %29 + %b = OpVariable %_ptr_Function_float Function %29 + %i = OpVariable %_ptr_Function_int Function %33 + %i_1 = OpVariable %_ptr_Function_int Function %33 + %i_2 = OpVariable %_ptr_Function_int Function %33 + %i_3 = OpVariable %_ptr_Function_int Function %33 + %i_4 = OpVariable %_ptr_Function_int Function %33 + %i_5 = OpVariable %_ptr_Function_int Function %33 + %i_6 = OpVariable %_ptr_Function_int Function %33 + %i_7 = OpVariable %_ptr_Function_int Function %33 + %i_8 = OpVariable %_ptr_Function_int Function %33 + %i_9 = OpVariable %_ptr_Function_int Function %33 + %i_10 = OpVariable %_ptr_Function_int Function %33 + %47 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %48 = OpLoad %float %47 + OpStore %a %48 + %50 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %51 = OpLoad %float %50 + OpStore %b %51 + %53 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %54 = OpLoad %int %53 + OpStore %i %54 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %int %i + %60 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpSLessThan %bool %59 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %56 + %64 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %68 = OpLoad %int %67 + OpStore %i_1 %68 + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %int %i_1 + %74 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpSLessThan %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + OpBranch %77 + %79 = OpLabel + OpBranch %70 + %77 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %81 = OpLoad %int %80 + OpStore %i_2 %81 + OpBranch %82 + %82 = OpLabel + OpLoopMerge %83 %84 None + OpBranch %85 + %85 = OpLabel + %86 = OpLoad %int %i_2 + %87 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpSLessThan %bool %86 %88 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 + %91 = OpLabel + OpBranch %90 + %92 = OpLabel + OpBranch %83 + %90 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_2 + %95 = OpLoad %int %94 + OpStore %i_3 %95 + OpBranch %96 + %96 = OpLabel + OpLoopMerge %97 %98 None + OpBranch %99 + %99 = OpLabel + %100 = OpLoad %int %i_3 + %101 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %102 = OpLoad %int %101 + %103 = OpSLessThan %bool %100 %102 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %106 + %105 = OpLabel + OpBranch %104 + %106 = OpLabel + OpBranch %97 + %104 = OpLabel + %107 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_2 + %108 = OpLoad %int %107 + OpStore %i_4 %108 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %110 %111 None + OpBranch %112 + %112 = OpLabel + %113 = OpLoad %int %i_4 + %114 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %115 = OpLoad %int %114 + %116 = OpSLessThan %bool %113 %115 + OpSelectionMerge %117 None + OpBranchConditional %116 %118 %119 + %118 = OpLabel + OpBranch %117 + %119 = OpLabel + OpBranch %110 + %117 = OpLabel + %120 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %121 = OpLoad %int %120 + OpStore %i_5 %121 + OpBranch %122 + %122 = OpLabel + OpLoopMerge %123 %124 None + OpBranch %125 + %125 = OpLabel + %126 = OpLoad %int %i_5 + %127 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %128 = OpLoad %int %127 + %129 = OpSLessThan %bool %126 %128 + OpSelectionMerge %130 None + OpBranchConditional %129 %131 %132 + %131 = OpLabel + OpBranch %130 + %132 = OpLabel + OpBranch %123 + %130 = OpLabel + %133 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %134 = OpLoad %int %133 + OpStore %i_6 %134 + OpBranch %135 + %135 = OpLabel + OpLoopMerge %136 %137 None + OpBranch %138 + %138 = OpLabel + %139 = OpLoad %int %i_6 + %140 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %141 = OpLoad %int %140 + %142 = OpSLessThan %bool %139 %141 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %145 + %144 = OpLabel + OpBranch %143 + %145 = OpLabel + OpBranch %136 + %143 = OpLabel + %146 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %147 = OpLoad %int %146 + OpStore %i_7 %147 + OpBranch %148 + %148 = OpLabel + OpLoopMerge %149 %150 None + OpBranch %151 + %151 = OpLabel + %152 = OpLoad %int %i_7 + %153 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %154 = OpLoad %int %153 + %155 = OpSLessThan %bool %152 %154 + OpSelectionMerge %156 None + OpBranchConditional %155 %157 %158 + %157 = OpLabel + OpBranch %156 + %158 = OpLabel + OpBranch %149 + %156 = OpLabel + %159 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %160 = OpLoad %int %159 + OpStore %i_8 %160 + OpBranch %161 + %161 = OpLabel + OpLoopMerge %162 %163 None + OpBranch %164 + %164 = OpLabel + %165 = OpLoad %int %i_8 + %166 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %167 = OpLoad %int %166 + %168 = OpSLessThan %bool %165 %167 + OpSelectionMerge %169 None + OpBranchConditional %168 %170 %171 + %170 = OpLabel + OpBranch %169 + %171 = OpLabel + OpBranch %162 + %169 = OpLabel + %172 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %173 = OpLoad %int %172 + OpStore %i_9 %173 + OpBranch %174 + %174 = OpLabel + OpLoopMerge %175 %176 None + OpBranch %177 + %177 = OpLabel + %178 = OpLoad %int %i_9 + %179 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %180 = OpLoad %int %179 + %181 = OpSLessThan %bool %178 %180 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %184 + %183 = OpLabel + OpBranch %182 + %184 = OpLabel + OpBranch %175 + %182 = OpLabel + %185 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %186 = OpLoad %int %185 + OpStore %i_10 %186 + OpBranch %187 + %187 = OpLabel + OpLoopMerge %188 %189 None + OpBranch %190 + %190 = OpLabel + %191 = OpLoad %int %i_10 + %192 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %193 = OpLoad %int %192 + %194 = OpSLessThan %bool %191 %193 + OpSelectionMerge %195 None + OpBranchConditional %194 %196 %197 + %196 = OpLabel + OpBranch %195 + %197 = OpLabel + OpBranch %188 + %195 = OpLabel + %198 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %199 = OpLoad %float %198 + OpStore %a %199 + %202 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %203 = OpLoad %float %202 + %204 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %205 = OpLoad %float %204 + %206 = OpFOrdGreaterThan %bool %203 %205 + OpSelectionMerge %207 None + OpBranchConditional %206 %208 %207 + %208 = OpLabel + OpBranch %188 + %207 = OpLabel + OpBranch %189 + %189 = OpLabel + %209 = OpLoad %int %i_10 + %210 = OpIAdd %int %209 %int_1 + OpStore %i_10 %210 + OpBranch %187 + %188 = OpLabel + OpBranch %176 + %176 = OpLabel + %211 = OpLoad %int %i_9 + %212 = OpIAdd %int %211 %int_1 + OpStore %i_9 %212 + OpBranch %174 + %175 = OpLabel + OpBranch %163 + %163 = OpLabel + %213 = OpLoad %int %i_8 + %214 = OpIAdd %int %213 %int_1 + OpStore %i_8 %214 + OpBranch %161 + %162 = OpLabel + OpBranch %150 + %150 = OpLabel + %215 = OpLoad %int %i_7 + %216 = OpIAdd %int %215 %int_1 + OpStore %i_7 %216 + OpBranch %148 + %149 = OpLabel + OpBranch %137 + %137 = OpLabel + %217 = OpLoad %int %i_6 + %218 = OpIAdd %int %217 %int_1 + OpStore %i_6 %218 + OpBranch %135 + %136 = OpLabel + OpBranch %124 + %124 = OpLabel + %219 = OpLoad %int %i_5 + %220 = OpIAdd %int %219 %int_1 + OpStore %i_5 %220 + OpBranch %122 + %123 = OpLabel + OpBranch %111 + %111 = OpLabel + %221 = OpLoad %int %i_4 + %222 = OpIAdd %int %221 %int_1 + OpStore %i_4 %222 + OpBranch %109 + %110 = OpLabel + OpBranch %98 + %98 = OpLabel + %223 = OpLoad %int %i_3 + %224 = OpIAdd %int %223 %int_1 + OpStore %i_3 %224 + OpBranch %96 + %97 = OpLabel + OpBranch %84 + %84 = OpLabel + %225 = OpLoad %int %i_2 + %226 = OpIAdd %int %225 %int_1 + OpStore %i_2 %226 + OpBranch %82 + %83 = OpLabel + OpBranch %71 + %71 = OpLabel + %227 = OpLoad %int %i_1 + %228 = OpIAdd %int %227 %int_1 + OpStore %i_1 %228 + OpBranch %69 + %70 = OpLabel + %229 = OpLoad %float %b + %231 = OpFAdd %float %229 %float_1 + OpStore %b %231 + OpBranch %57 + %57 = OpLabel + %232 = OpLoad %int %i + %233 = OpIAdd %int %232 %int_1 + OpStore %i %233 + OpBranch %55 + %56 = OpLabel + %234 = OpLoad %float %b + %235 = OpLoad %float %a + %236 = OpLoad %float %a + %237 = OpLoad %float %b + %238 = OpCompositeConstruct %v4float %234 %235 %236 %237 + OpStore %x_GLF_color %238 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %239 +%tint_symbol_1 = OpFunctionParameter %main_out + %243 = OpLabel + %244 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %244 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %246 = OpLabel + %247 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %247 + %248 = OpFunctionCall %void %main_1 + %250 = OpLoad %v4float %x_GLF_color + %251 = OpCompositeConstruct %main_out %250 + %249 = OpFunctionCall %void %tint_symbol_3 %251 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..6a32b2df3f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-optimize-phis-for/0-opt.wgsl.expected.wgsl @@ -0,0 +1,233 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_11 : buf1; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var b : f32; + var i : i32; + var i_1 : i32; + var i_2 : i32; + var i_3 : i32; + var i_4 : i32; + var i_5 : i32; + var i_6 : i32; + var i_7 : i32; + var i_8 : i32; + var i_9 : i32; + var i_10 : i32; + let x_104 : f32 = x_7.x_GLF_uniform_float_values[0]; + a = x_104; + let x_106 : f32 = x_7.x_GLF_uniform_float_values[1]; + b = x_106; + let x_24 : i32 = x_11.x_GLF_uniform_int_values[1]; + i = x_24; + loop { + let x_25 : i32 = i; + let x_26 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_25 < x_26)) { + } else { + break; + } + let x_27 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_1 = x_27; + loop { + let x_28 : i32 = i_1; + let x_29 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_28 < x_29)) { + } else { + break; + } + let x_30 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_2 = x_30; + loop { + let x_31 : i32 = i_2; + let x_32 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_31 < x_32)) { + } else { + break; + } + let x_33 : i32 = x_11.x_GLF_uniform_int_values[2]; + i_3 = x_33; + loop { + let x_34 : i32 = i_3; + let x_35 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_34 < x_35)) { + } else { + break; + } + let x_36 : i32 = x_11.x_GLF_uniform_int_values[2]; + i_4 = x_36; + loop { + let x_37 : i32 = i_4; + let x_38 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_37 < x_38)) { + } else { + break; + } + let x_39 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_5 = x_39; + loop { + let x_40 : i32 = i_5; + let x_41 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_40 < x_41)) { + } else { + break; + } + let x_42 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_6 = x_42; + loop { + let x_43 : i32 = i_6; + let x_44 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_43 < x_44)) { + } else { + break; + } + let x_45 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_7 = x_45; + loop { + let x_46 : i32 = i_7; + let x_47 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_46 < x_47)) { + } else { + break; + } + let x_48 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_8 = x_48; + loop { + let x_49 : i32 = i_8; + let x_50 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_49 < x_50)) { + } else { + break; + } + let x_51 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_9 = x_51; + loop { + let x_52 : i32 = i_9; + let x_53 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_52 < x_53)) { + } else { + break; + } + let x_54 : i32 = x_11.x_GLF_uniform_int_values[1]; + i_10 = x_54; + loop { + let x_55 : i32 = i_10; + let x_56 : i32 = x_11.x_GLF_uniform_int_values[0]; + if ((x_55 < x_56)) { + } else { + break; + } + let x_196 : f32 = x_7.x_GLF_uniform_float_values[1]; + a = x_196; + let x_198 : f32 = gl_FragCoord.y; + let x_200 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((x_198 > x_200)) { + break; + } + + continuing { + let x_57 : i32 = i_10; + i_10 = (x_57 + 1); + } + } + + continuing { + let x_59 : i32 = i_9; + i_9 = (x_59 + 1); + } + } + + continuing { + let x_61 : i32 = i_8; + i_8 = (x_61 + 1); + } + } + + continuing { + let x_63 : i32 = i_7; + i_7 = (x_63 + 1); + } + } + + continuing { + let x_65 : i32 = i_6; + i_6 = (x_65 + 1); + } + } + + continuing { + let x_67 : i32 = i_5; + i_5 = (x_67 + 1); + } + } + + continuing { + let x_69 : i32 = i_4; + i_4 = (x_69 + 1); + } + } + + continuing { + let x_71 : i32 = i_3; + i_3 = (x_71 + 1); + } + } + + continuing { + let x_73 : i32 = i_2; + i_2 = (x_73 + 1); + } + } + + continuing { + let x_75 : i32 = i_1; + i_1 = (x_75 + 1); + } + } + let x_204 : f32 = b; + b = (x_204 + 1.0); + + continuing { + let x_77 : i32 = i; + i = (x_77 + 1); + } + } + let x_206 : f32 = b; + let x_207 : f32 = a; + let x_208 : f32 = a; + let x_209 : f32 = b; + x_GLF_color = vec4(x_206, x_207, x_208, x_209); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm new file mode 100644 index 0000000000..c972cafeb0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm @@ -0,0 +1,185 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %values "values" + OpName %ref "ref" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v2float %float_1 %float_1 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %36 = OpLabel + %a = OpVariable %_ptr_Function_uint Function + %values = OpVariable %_ptr_Function_v4float Function + %ref = OpVariable %_ptr_Function_v4float Function + %37 = OpExtInst %uint %1 PackHalf2x16 %20 + OpStore %a %37 + %38 = OpLoad %uint %a + %39 = OpExtInst %v4float %1 UnpackUnorm4x8 %38 + OpStore %values %39 + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %43 = OpLoad %float %42 + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %45 = OpLoad %float %44 + %46 = OpFDiv %float %43 %45 + %47 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %48 = OpLoad %float %47 + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %50 = OpLoad %float %49 + %51 = OpFDiv %float %48 %50 + %52 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpFDiv %float %53 %55 + %57 = OpCompositeConstruct %v4float %41 %46 %51 %56 + OpStore %ref %57 + %58 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Function_float %values %59 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Function_float %ref %63 + %65 = OpLoad %float %64 + %66 = OpFSub %float %61 %65 + %67 = OpExtInst %float %1 FAbs %66 + %68 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %69 = OpLoad %float %68 + %70 = OpFOrdLessThan %bool %67 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Function_float %values %74 + %76 = OpLoad %float %75 + %77 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Function_float %ref %78 + %80 = OpLoad %float %79 + %81 = OpFSub %float %76 %80 + %82 = OpExtInst %float %1 FAbs %81 + %83 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %84 = OpLoad %float %83 + %85 = OpFOrdLessThan %bool %82 %84 + OpBranch %71 + %71 = OpLabel + %86 = OpPhi %bool %70 %36 %85 %72 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %87 + %88 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Function_float %values %90 + %92 = OpLoad %float %91 + %93 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Function_float %ref %94 + %96 = OpLoad %float %95 + %97 = OpFSub %float %92 %96 + %98 = OpExtInst %float %1 FAbs %97 + %99 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %100 = OpLoad %float %99 + %101 = OpFOrdLessThan %bool %98 %100 + OpBranch %87 + %87 = OpLabel + %102 = OpPhi %bool %86 %71 %101 %88 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %103 + %104 = OpLabel + %105 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %106 = OpLoad %int %105 + %107 = OpAccessChain %_ptr_Function_float %values %106 + %108 = OpLoad %float %107 + %109 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Function_float %ref %110 + %112 = OpLoad %float %111 + %113 = OpFSub %float %108 %112 + %114 = OpExtInst %float %1 FAbs %113 + %115 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %116 = OpLoad %float %115 + %117 = OpFOrdLessThan %bool %114 %116 + OpBranch %103 + %103 = OpLabel + %118 = OpPhi %bool %102 %87 %117 %104 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %121 + %120 = OpLabel + %122 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %123 = OpLoad %int %122 + %124 = OpConvertSToF %float %123 + %125 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %126 = OpLoad %int %125 + %127 = OpConvertSToF %float %126 + %128 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %129 = OpLoad %int %128 + %130 = OpConvertSToF %float %129 + %131 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %132 = OpLoad %int %131 + %133 = OpConvertSToF %float %132 + %134 = OpCompositeConstruct %v4float %124 %127 %130 %133 + OpStore %_GLF_color %134 + OpBranch %119 + %121 = OpLabel + %135 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %136 = OpLoad %int %135 + %137 = OpConvertSToF %float %136 + %138 = OpCompositeConstruct %v4float %137 %137 %137 %137 + OpStore %_GLF_color %138 + OpBranch %119 + %119 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f87712b04c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.hlsl @@ -0,0 +1,112 @@ +uint tint_pack2x16float(float2 param_0) { + uint2 i = f32tof16(param_0); + return i.x | (i.y << 16); +} + +float4 tint_unpack4x8unorm(uint param_0) { + uint j = param_0; + uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); + return float4(i) / 255.0; +} + +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[4]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + float4 values = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 ref = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_85 = false; + bool x_101 = false; + bool x_117 = false; + bool x_86_phi = false; + bool x_102_phi = false; + bool x_118_phi = false; + a = tint_pack2x16float(float2(1.0f, 1.0f)); + values = tint_unpack4x8unorm(a); + const float x_41 = asfloat(x_8[3].x); + const float x_43 = asfloat(x_8[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + const float x_48 = asfloat(x_8[3].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_50 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_53 = asfloat(x_8[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + ref = float4(x_41, (x_43 / x_45), (x_48 / x_50), (x_53 / x_55)); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_61 = values[x_59]; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_63 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_65 = ref[x_63]; + const float x_69 = asfloat(x_8[2].x); + const bool x_70 = (abs((x_61 - x_65)) < x_69); + x_86_phi = x_70; + if (x_70) { + const int x_74 = asint(x_10[1].x); + const float x_76 = values[x_74]; + const int x_78 = asint(x_10[1].x); + const float x_80 = ref[x_78]; + const float x_84 = asfloat(x_8[2].x); + x_85 = (abs((x_76 - x_80)) < x_84); + x_86_phi = x_85; + } + const bool x_86 = x_86_phi; + x_102_phi = x_86; + if (x_86) { + const int x_90 = asint(x_10[3].x); + const float x_92 = values[x_90]; + const int x_94 = asint(x_10[3].x); + const float x_96 = ref[x_94]; + const float x_100 = asfloat(x_8[2].x); + x_101 = (abs((x_92 - x_96)) < x_100); + x_102_phi = x_101; + } + const bool x_102 = x_102_phi; + x_118_phi = x_102; + if (x_102) { + const int x_106 = asint(x_10[2].x); + const float x_108 = values[x_106]; + const int x_110 = asint(x_10[2].x); + const float x_112 = ref[x_110]; + const float x_116 = asfloat(x_8[2].x); + x_117 = (abs((x_108 - x_112)) < x_116); + x_118_phi = x_117; + } + if (x_118_phi) { + const int x_123 = asint(x_10[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_126 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_129 = asint(x_10[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const int x_132 = asint(x_10[1].x); + x_GLF_color = float4(float(x_123), float(x_126), float(x_129), float(x_132)); + } else { + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_136 = asint(x_10[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const float x_137 = float(x_136); + x_GLF_color = float4(x_137, x_137, x_137, x_137); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..8e6d935995 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, constant buf1& x_10, thread float4* const tint_symbol_4) { + uint a = 0u; + float4 values = 0.0f; + float4 ref = 0.0f; + bool x_85 = false; + bool x_101 = false; + bool x_117 = false; + bool x_86_phi = false; + bool x_102_phi = false; + bool x_118_phi = false; + a = as_type(half2(float2(1.0f, 1.0f))); + uint const x_38 = a; + values = unpack_unorm4x8_to_float(x_38); + float const x_41 = x_8.x_GLF_uniform_float_values.arr[3].el; + float const x_43 = x_8.x_GLF_uniform_float_values.arr[1].el; + float const x_45 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_48 = x_8.x_GLF_uniform_float_values.arr[3].el; + float const x_50 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_53 = x_8.x_GLF_uniform_float_values.arr[1].el; + float const x_55 = x_8.x_GLF_uniform_float_values.arr[0].el; + ref = float4(x_41, (x_43 / x_45), (x_48 / x_50), (x_53 / x_55)); + int const x_59 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_61 = values[x_59]; + int const x_63 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_65 = ref[x_63]; + float const x_69 = x_8.x_GLF_uniform_float_values.arr[2].el; + bool const x_70 = (fabs((x_61 - x_65)) < x_69); + x_86_phi = x_70; + if (x_70) { + int const x_74 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_76 = values[x_74]; + int const x_78 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_80 = ref[x_78]; + float const x_84 = x_8.x_GLF_uniform_float_values.arr[2].el; + x_85 = (fabs((x_76 - x_80)) < x_84); + x_86_phi = x_85; + } + bool const x_86 = x_86_phi; + x_102_phi = x_86; + if (x_86) { + int const x_90 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_92 = values[x_90]; + int const x_94 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_96 = ref[x_94]; + float const x_100 = x_8.x_GLF_uniform_float_values.arr[2].el; + x_101 = (fabs((x_92 - x_96)) < x_100); + x_102_phi = x_101; + } + bool const x_102 = x_102_phi; + x_118_phi = x_102; + if (x_102) { + int const x_106 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_108 = values[x_106]; + int const x_110 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_112 = ref[x_110]; + float const x_116 = x_8.x_GLF_uniform_float_values.arr[2].el; + x_117 = (fabs((x_108 - x_112)) < x_116); + x_118_phi = x_117; + } + bool const x_118 = x_118_phi; + if (x_118) { + int const x_123 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_126 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_129 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_132 = x_10.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_123), float(x_126), float(x_129), float(x_132)); + } else { + int const x_136 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_137 = float(x_136); + *(tint_symbol_4) = float4(x_137, x_137, x_137, x_137); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..48890d899c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.spvasm @@ -0,0 +1,246 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 167 +; Schema: 0 + OpCapability Shader + %39 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %values "values" + OpName %ref "ref" + OpName %x_85 "x_85" + OpName %x_101 "x_101" + OpName %x_117 "x_117" + OpName %x_86_phi "x_86_phi" + OpName %x_102_phi "x_102_phi" + OpName %x_118_phi "x_118_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %25 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %32 = OpConstantNull %bool + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %42 = OpConstantComposite %v2float %float_1 %float_1 + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %155 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %25 + %values = OpVariable %_ptr_Function_v4float Function %16 + %ref = OpVariable %_ptr_Function_v4float Function %16 + %x_85 = OpVariable %_ptr_Function_bool Function %32 + %x_101 = OpVariable %_ptr_Function_bool Function %32 + %x_117 = OpVariable %_ptr_Function_bool Function %32 + %x_86_phi = OpVariable %_ptr_Function_bool Function %32 + %x_102_phi = OpVariable %_ptr_Function_bool Function %32 + %x_118_phi = OpVariable %_ptr_Function_bool Function %32 + %38 = OpExtInst %uint %39 PackHalf2x16 %42 + OpStore %a %38 + %43 = OpLoad %uint %a + %44 = OpExtInst %v4float %39 UnpackUnorm4x8 %43 + OpStore %values %44 + %48 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_3 + %49 = OpLoad %float %48 + %51 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %52 = OpLoad %float %51 + %54 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_3 + %57 = OpLoad %float %56 + %58 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpFDiv %float %52 %55 + %65 = OpFDiv %float %57 %59 + %66 = OpFDiv %float %61 %63 + %67 = OpCompositeConstruct %v4float %49 %64 %65 %66 + OpStore %ref %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %70 = OpLoad %int %69 + %72 = OpAccessChain %_ptr_Function_float %values %70 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Function_float %ref %75 + %77 = OpLoad %float %76 + %79 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %80 = OpLoad %float %79 + %82 = OpFSub %float %73 %77 + %81 = OpExtInst %float %39 FAbs %82 + %83 = OpFOrdLessThan %bool %81 %80 + OpStore %x_86_phi %83 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %84 + %85 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Function_float %values %87 + %89 = OpLoad %float %88 + %90 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %91 = OpLoad %int %90 + %92 = OpAccessChain %_ptr_Function_float %ref %91 + %93 = OpLoad %float %92 + %94 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %95 = OpLoad %float %94 + %97 = OpFSub %float %89 %93 + %96 = OpExtInst %float %39 FAbs %97 + %98 = OpFOrdLessThan %bool %96 %95 + OpStore %x_85 %98 + %99 = OpLoad %bool %x_85 + OpStore %x_86_phi %99 + OpBranch %84 + %84 = OpLabel + %100 = OpLoad %bool %x_86_phi + OpStore %x_102_phi %100 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %104 = OpLoad %int %103 + %105 = OpAccessChain %_ptr_Function_float %values %104 + %106 = OpLoad %float %105 + %107 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %108 = OpLoad %int %107 + %109 = OpAccessChain %_ptr_Function_float %ref %108 + %110 = OpLoad %float %109 + %111 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %112 = OpLoad %float %111 + %114 = OpFSub %float %106 %110 + %113 = OpExtInst %float %39 FAbs %114 + %115 = OpFOrdLessThan %bool %113 %112 + OpStore %x_101 %115 + %116 = OpLoad %bool %x_101 + OpStore %x_102_phi %116 + OpBranch %101 + %101 = OpLabel + %117 = OpLoad %bool %x_102_phi + OpStore %x_118_phi %117 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %120 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %121 = OpLoad %int %120 + %122 = OpAccessChain %_ptr_Function_float %values %121 + %123 = OpLoad %float %122 + %124 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %125 = OpLoad %int %124 + %126 = OpAccessChain %_ptr_Function_float %ref %125 + %127 = OpLoad %float %126 + %128 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %129 = OpLoad %float %128 + %131 = OpFSub %float %123 %127 + %130 = OpExtInst %float %39 FAbs %131 + %132 = OpFOrdLessThan %bool %130 %129 + OpStore %x_117 %132 + %133 = OpLoad %bool %x_117 + OpStore %x_118_phi %133 + OpBranch %118 + %118 = OpLabel + %134 = OpLoad %bool %x_118_phi + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 + %136 = OpLabel + %138 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %139 = OpLoad %int %138 + %140 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %141 = OpLoad %int %140 + %142 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %143 = OpLoad %int %142 + %144 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %145 = OpLoad %int %144 + %146 = OpConvertSToF %float %139 + %147 = OpConvertSToF %float %141 + %148 = OpConvertSToF %float %143 + %149 = OpConvertSToF %float %145 + %150 = OpCompositeConstruct %v4float %146 %147 %148 %149 + OpStore %x_GLF_color %150 + OpBranch %135 + %137 = OpLabel + %151 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %152 = OpLoad %int %151 + %153 = OpConvertSToF %float %152 + %154 = OpCompositeConstruct %v4float %153 %153 %153 %153 + OpStore %x_GLF_color %154 + OpBranch %135 + %135 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %155 +%tint_symbol = OpFunctionParameter %main_out + %159 = OpLabel + %160 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %160 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %162 = OpLabel + %163 = OpFunctionCall %void %main_1 + %165 = OpLoad %v4float %x_GLF_color + %166 = OpCompositeConstruct %main_out %165 + %164 = OpFunctionCall %void %tint_symbol_2 %166 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5220a98aea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.spvasm.expected.wgsl @@ -0,0 +1,104 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var values : vec4; + var ref : vec4; + var x_85 : bool; + var x_101 : bool; + var x_117 : bool; + var x_86_phi : bool; + var x_102_phi : bool; + var x_118_phi : bool; + a = pack2x16float(vec2(1.0, 1.0)); + let x_38 : u32 = a; + values = unpack4x8unorm(x_38); + let x_41 : f32 = x_8.x_GLF_uniform_float_values[3]; + let x_43 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_45 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_48 : f32 = x_8.x_GLF_uniform_float_values[3]; + let x_50 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_53 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_55 : f32 = x_8.x_GLF_uniform_float_values[0]; + ref = vec4(x_41, (x_43 / x_45), (x_48 / x_50), (x_53 / x_55)); + let x_59 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_61 : f32 = values[x_59]; + let x_63 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_65 : f32 = ref[x_63]; + let x_69 : f32 = x_8.x_GLF_uniform_float_values[2]; + let x_70 : bool = (abs((x_61 - x_65)) < x_69); + x_86_phi = x_70; + if (x_70) { + let x_74 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_76 : f32 = values[x_74]; + let x_78 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_80 : f32 = ref[x_78]; + let x_84 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_85 = (abs((x_76 - x_80)) < x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_102_phi = x_86; + if (x_86) { + let x_90 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_92 : f32 = values[x_90]; + let x_94 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_96 : f32 = ref[x_94]; + let x_100 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_101 = (abs((x_92 - x_96)) < x_100); + x_102_phi = x_101; + } + let x_102 : bool = x_102_phi; + x_118_phi = x_102; + if (x_102) { + let x_106 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_108 : f32 = values[x_106]; + let x_110 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_112 : f32 = ref[x_110]; + let x_116 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_117 = (abs((x_108 - x_112)) < x_116); + x_118_phi = x_117; + } + let x_118 : bool = x_118_phi; + if (x_118) { + let x_123 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_126 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_129 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_132 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_123), f32(x_126), f32(x_129), f32(x_132)); + } else { + let x_136 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_137 : f32 = f32(x_136); + x_GLF_color = vec4(x_137, x_137, x_137, x_137); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl new file mode 100644 index 0000000000..5220a98aea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl @@ -0,0 +1,104 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var values : vec4; + var ref : vec4; + var x_85 : bool; + var x_101 : bool; + var x_117 : bool; + var x_86_phi : bool; + var x_102_phi : bool; + var x_118_phi : bool; + a = pack2x16float(vec2(1.0, 1.0)); + let x_38 : u32 = a; + values = unpack4x8unorm(x_38); + let x_41 : f32 = x_8.x_GLF_uniform_float_values[3]; + let x_43 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_45 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_48 : f32 = x_8.x_GLF_uniform_float_values[3]; + let x_50 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_53 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_55 : f32 = x_8.x_GLF_uniform_float_values[0]; + ref = vec4(x_41, (x_43 / x_45), (x_48 / x_50), (x_53 / x_55)); + let x_59 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_61 : f32 = values[x_59]; + let x_63 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_65 : f32 = ref[x_63]; + let x_69 : f32 = x_8.x_GLF_uniform_float_values[2]; + let x_70 : bool = (abs((x_61 - x_65)) < x_69); + x_86_phi = x_70; + if (x_70) { + let x_74 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_76 : f32 = values[x_74]; + let x_78 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_80 : f32 = ref[x_78]; + let x_84 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_85 = (abs((x_76 - x_80)) < x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_102_phi = x_86; + if (x_86) { + let x_90 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_92 : f32 = values[x_90]; + let x_94 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_96 : f32 = ref[x_94]; + let x_100 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_101 = (abs((x_92 - x_96)) < x_100); + x_102_phi = x_101; + } + let x_102 : bool = x_102_phi; + x_118_phi = x_102; + if (x_102) { + let x_106 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_108 : f32 = values[x_106]; + let x_110 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_112 : f32 = ref[x_110]; + let x_116 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_117 = (abs((x_108 - x_112)) < x_116); + x_118_phi = x_117; + } + let x_118 : bool = x_118_phi; + if (x_118) { + let x_123 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_126 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_129 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_132 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_123), f32(x_126), f32(x_129), f32(x_132)); + } else { + let x_136 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_137 : f32 = f32(x_136); + x_GLF_color = vec4(x_137, x_137, x_137, x_137); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f87712b04c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.hlsl @@ -0,0 +1,112 @@ +uint tint_pack2x16float(float2 param_0) { + uint2 i = f32tof16(param_0); + return i.x | (i.y << 16); +} + +float4 tint_unpack4x8unorm(uint param_0) { + uint j = param_0; + uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); + return float4(i) / 255.0; +} + +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[4]; +}; +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + float4 values = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 ref = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_85 = false; + bool x_101 = false; + bool x_117 = false; + bool x_86_phi = false; + bool x_102_phi = false; + bool x_118_phi = false; + a = tint_pack2x16float(float2(1.0f, 1.0f)); + values = tint_unpack4x8unorm(a); + const float x_41 = asfloat(x_8[3].x); + const float x_43 = asfloat(x_8[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + const float x_48 = asfloat(x_8[3].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_50 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_53 = asfloat(x_8[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + ref = float4(x_41, (x_43 / x_45), (x_48 / x_50), (x_53 / x_55)); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_61 = values[x_59]; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_63 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_65 = ref[x_63]; + const float x_69 = asfloat(x_8[2].x); + const bool x_70 = (abs((x_61 - x_65)) < x_69); + x_86_phi = x_70; + if (x_70) { + const int x_74 = asint(x_10[1].x); + const float x_76 = values[x_74]; + const int x_78 = asint(x_10[1].x); + const float x_80 = ref[x_78]; + const float x_84 = asfloat(x_8[2].x); + x_85 = (abs((x_76 - x_80)) < x_84); + x_86_phi = x_85; + } + const bool x_86 = x_86_phi; + x_102_phi = x_86; + if (x_86) { + const int x_90 = asint(x_10[3].x); + const float x_92 = values[x_90]; + const int x_94 = asint(x_10[3].x); + const float x_96 = ref[x_94]; + const float x_100 = asfloat(x_8[2].x); + x_101 = (abs((x_92 - x_96)) < x_100); + x_102_phi = x_101; + } + const bool x_102 = x_102_phi; + x_118_phi = x_102; + if (x_102) { + const int x_106 = asint(x_10[2].x); + const float x_108 = values[x_106]; + const int x_110 = asint(x_10[2].x); + const float x_112 = ref[x_110]; + const float x_116 = asfloat(x_8[2].x); + x_117 = (abs((x_108 - x_112)) < x_116); + x_118_phi = x_117; + } + if (x_118_phi) { + const int x_123 = asint(x_10[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_126 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_129 = asint(x_10[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const int x_132 = asint(x_10[1].x); + x_GLF_color = float4(float(x_123), float(x_126), float(x_129), float(x_132)); + } else { + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_136 = asint(x_10[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const float x_137 = float(x_136); + x_GLF_color = float4(x_137, x_137, x_137, x_137); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..8e6d935995 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, constant buf1& x_10, thread float4* const tint_symbol_4) { + uint a = 0u; + float4 values = 0.0f; + float4 ref = 0.0f; + bool x_85 = false; + bool x_101 = false; + bool x_117 = false; + bool x_86_phi = false; + bool x_102_phi = false; + bool x_118_phi = false; + a = as_type(half2(float2(1.0f, 1.0f))); + uint const x_38 = a; + values = unpack_unorm4x8_to_float(x_38); + float const x_41 = x_8.x_GLF_uniform_float_values.arr[3].el; + float const x_43 = x_8.x_GLF_uniform_float_values.arr[1].el; + float const x_45 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_48 = x_8.x_GLF_uniform_float_values.arr[3].el; + float const x_50 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_53 = x_8.x_GLF_uniform_float_values.arr[1].el; + float const x_55 = x_8.x_GLF_uniform_float_values.arr[0].el; + ref = float4(x_41, (x_43 / x_45), (x_48 / x_50), (x_53 / x_55)); + int const x_59 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_61 = values[x_59]; + int const x_63 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_65 = ref[x_63]; + float const x_69 = x_8.x_GLF_uniform_float_values.arr[2].el; + bool const x_70 = (fabs((x_61 - x_65)) < x_69); + x_86_phi = x_70; + if (x_70) { + int const x_74 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_76 = values[x_74]; + int const x_78 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_80 = ref[x_78]; + float const x_84 = x_8.x_GLF_uniform_float_values.arr[2].el; + x_85 = (fabs((x_76 - x_80)) < x_84); + x_86_phi = x_85; + } + bool const x_86 = x_86_phi; + x_102_phi = x_86; + if (x_86) { + int const x_90 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_92 = values[x_90]; + int const x_94 = x_10.x_GLF_uniform_int_values.arr[3].el; + float const x_96 = ref[x_94]; + float const x_100 = x_8.x_GLF_uniform_float_values.arr[2].el; + x_101 = (fabs((x_92 - x_96)) < x_100); + x_102_phi = x_101; + } + bool const x_102 = x_102_phi; + x_118_phi = x_102; + if (x_102) { + int const x_106 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_108 = values[x_106]; + int const x_110 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_112 = ref[x_110]; + float const x_116 = x_8.x_GLF_uniform_float_values.arr[2].el; + x_117 = (fabs((x_108 - x_112)) < x_116); + x_118_phi = x_117; + } + bool const x_118 = x_118_phi; + if (x_118) { + int const x_123 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_126 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_129 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_132 = x_10.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_123), float(x_126), float(x_129), float(x_132)); + } else { + int const x_136 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_137 = float(x_136); + *(tint_symbol_4) = float4(x_137, x_137, x_137, x_137); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..48890d899c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.spvasm @@ -0,0 +1,246 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 167 +; Schema: 0 + OpCapability Shader + %39 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %values "values" + OpName %ref "ref" + OpName %x_85 "x_85" + OpName %x_101 "x_101" + OpName %x_117 "x_117" + OpName %x_86_phi "x_86_phi" + OpName %x_102_phi "x_102_phi" + OpName %x_118_phi "x_118_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf0 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %25 = OpConstantNull %uint +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %32 = OpConstantNull %bool + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %42 = OpConstantComposite %v2float %float_1 %float_1 + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %155 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %25 + %values = OpVariable %_ptr_Function_v4float Function %16 + %ref = OpVariable %_ptr_Function_v4float Function %16 + %x_85 = OpVariable %_ptr_Function_bool Function %32 + %x_101 = OpVariable %_ptr_Function_bool Function %32 + %x_117 = OpVariable %_ptr_Function_bool Function %32 + %x_86_phi = OpVariable %_ptr_Function_bool Function %32 + %x_102_phi = OpVariable %_ptr_Function_bool Function %32 + %x_118_phi = OpVariable %_ptr_Function_bool Function %32 + %38 = OpExtInst %uint %39 PackHalf2x16 %42 + OpStore %a %38 + %43 = OpLoad %uint %a + %44 = OpExtInst %v4float %39 UnpackUnorm4x8 %43 + OpStore %values %44 + %48 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_3 + %49 = OpLoad %float %48 + %51 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %52 = OpLoad %float %51 + %54 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_3 + %57 = OpLoad %float %56 + %58 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpFDiv %float %52 %55 + %65 = OpFDiv %float %57 %59 + %66 = OpFDiv %float %61 %63 + %67 = OpCompositeConstruct %v4float %49 %64 %65 %66 + OpStore %ref %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %70 = OpLoad %int %69 + %72 = OpAccessChain %_ptr_Function_float %values %70 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Function_float %ref %75 + %77 = OpLoad %float %76 + %79 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %80 = OpLoad %float %79 + %82 = OpFSub %float %73 %77 + %81 = OpExtInst %float %39 FAbs %82 + %83 = OpFOrdLessThan %bool %81 %80 + OpStore %x_86_phi %83 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %84 + %85 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Function_float %values %87 + %89 = OpLoad %float %88 + %90 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %91 = OpLoad %int %90 + %92 = OpAccessChain %_ptr_Function_float %ref %91 + %93 = OpLoad %float %92 + %94 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %95 = OpLoad %float %94 + %97 = OpFSub %float %89 %93 + %96 = OpExtInst %float %39 FAbs %97 + %98 = OpFOrdLessThan %bool %96 %95 + OpStore %x_85 %98 + %99 = OpLoad %bool %x_85 + OpStore %x_86_phi %99 + OpBranch %84 + %84 = OpLabel + %100 = OpLoad %bool %x_86_phi + OpStore %x_102_phi %100 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %104 = OpLoad %int %103 + %105 = OpAccessChain %_ptr_Function_float %values %104 + %106 = OpLoad %float %105 + %107 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %108 = OpLoad %int %107 + %109 = OpAccessChain %_ptr_Function_float %ref %108 + %110 = OpLoad %float %109 + %111 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %112 = OpLoad %float %111 + %114 = OpFSub %float %106 %110 + %113 = OpExtInst %float %39 FAbs %114 + %115 = OpFOrdLessThan %bool %113 %112 + OpStore %x_101 %115 + %116 = OpLoad %bool %x_101 + OpStore %x_102_phi %116 + OpBranch %101 + %101 = OpLabel + %117 = OpLoad %bool %x_102_phi + OpStore %x_118_phi %117 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %120 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %121 = OpLoad %int %120 + %122 = OpAccessChain %_ptr_Function_float %values %121 + %123 = OpLoad %float %122 + %124 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %125 = OpLoad %int %124 + %126 = OpAccessChain %_ptr_Function_float %ref %125 + %127 = OpLoad %float %126 + %128 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %129 = OpLoad %float %128 + %131 = OpFSub %float %123 %127 + %130 = OpExtInst %float %39 FAbs %131 + %132 = OpFOrdLessThan %bool %130 %129 + OpStore %x_117 %132 + %133 = OpLoad %bool %x_117 + OpStore %x_118_phi %133 + OpBranch %118 + %118 = OpLabel + %134 = OpLoad %bool %x_118_phi + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 + %136 = OpLabel + %138 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %139 = OpLoad %int %138 + %140 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %141 = OpLoad %int %140 + %142 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %143 = OpLoad %int %142 + %144 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %145 = OpLoad %int %144 + %146 = OpConvertSToF %float %139 + %147 = OpConvertSToF %float %141 + %148 = OpConvertSToF %float %143 + %149 = OpConvertSToF %float %145 + %150 = OpCompositeConstruct %v4float %146 %147 %148 %149 + OpStore %x_GLF_color %150 + OpBranch %135 + %137 = OpLabel + %151 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %152 = OpLoad %int %151 + %153 = OpConvertSToF %float %152 + %154 = OpCompositeConstruct %v4float %153 %153 %153 %153 + OpStore %x_GLF_color %154 + OpBranch %135 + %135 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %155 +%tint_symbol = OpFunctionParameter %main_out + %159 = OpLabel + %160 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %160 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %162 = OpLabel + %163 = OpFunctionCall %void %main_1 + %165 = OpLoad %v4float %x_GLF_color + %166 = OpCompositeConstruct %main_out %165 + %164 = OpFunctionCall %void %tint_symbol_2 %166 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5220a98aea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-packhalf-unpackunorm/0-opt.wgsl.expected.wgsl @@ -0,0 +1,104 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +[[group(0), binding(1)]] var x_10 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + var values : vec4; + var ref : vec4; + var x_85 : bool; + var x_101 : bool; + var x_117 : bool; + var x_86_phi : bool; + var x_102_phi : bool; + var x_118_phi : bool; + a = pack2x16float(vec2(1.0, 1.0)); + let x_38 : u32 = a; + values = unpack4x8unorm(x_38); + let x_41 : f32 = x_8.x_GLF_uniform_float_values[3]; + let x_43 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_45 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_48 : f32 = x_8.x_GLF_uniform_float_values[3]; + let x_50 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_53 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_55 : f32 = x_8.x_GLF_uniform_float_values[0]; + ref = vec4(x_41, (x_43 / x_45), (x_48 / x_50), (x_53 / x_55)); + let x_59 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_61 : f32 = values[x_59]; + let x_63 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_65 : f32 = ref[x_63]; + let x_69 : f32 = x_8.x_GLF_uniform_float_values[2]; + let x_70 : bool = (abs((x_61 - x_65)) < x_69); + x_86_phi = x_70; + if (x_70) { + let x_74 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_76 : f32 = values[x_74]; + let x_78 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_80 : f32 = ref[x_78]; + let x_84 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_85 = (abs((x_76 - x_80)) < x_84); + x_86_phi = x_85; + } + let x_86 : bool = x_86_phi; + x_102_phi = x_86; + if (x_86) { + let x_90 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_92 : f32 = values[x_90]; + let x_94 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_96 : f32 = ref[x_94]; + let x_100 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_101 = (abs((x_92 - x_96)) < x_100); + x_102_phi = x_101; + } + let x_102 : bool = x_102_phi; + x_118_phi = x_102; + if (x_102) { + let x_106 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_108 : f32 = values[x_106]; + let x_110 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_112 : f32 = ref[x_110]; + let x_116 : f32 = x_8.x_GLF_uniform_float_values[2]; + x_117 = (abs((x_108 - x_112)) < x_116); + x_118_phi = x_117; + } + let x_118 : bool = x_118_phi; + if (x_118) { + let x_123 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_126 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_129 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_132 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_123), f32(x_126), f32(x_129), f32(x_132)); + } else { + let x_136 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_137 : f32 = f32(x_136); + x_GLF_color = vec4(x_137, x_137, x_137, x_137); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm new file mode 100644 index 0000000000..f88da4188d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm @@ -0,0 +1,73 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_i1_ "func(i1;" + OpName %x "x" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %13 = OpTypeFunction %int %_ptr_Function_int + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_n1 = OpConstant %int -1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %26 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %10 + %27 = OpLabel + %param = OpVariable %_ptr_Function_int Function + OpStore %param %int_n1 + %28 = OpFunctionCall %int %func_i1_ %param + %29 = OpSLessThanEqual %bool %28 %int_0 + OpSelectionMerge %30 None + OpBranchConditional %29 %31 %32 + %31 = OpLabel + OpStore %_GLF_color %25 + OpBranch %30 + %32 = OpLabel + OpStore %_GLF_color %26 + OpBranch %30 + %30 = OpLabel + OpReturn + OpFunctionEnd + %func_i1_ = OpFunction %int None %13 + %x = OpFunctionParameter %_ptr_Function_int + %33 = OpLabel + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %35 = OpLoad %int %34 + %36 = OpIEqual %bool %35 %int_1 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + %39 = OpLoad %int %x + OpReturnValue %39 + %37 = OpLabel + %40 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %41 = OpLoad %int %40 + OpReturnValue %41 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..e0e17996e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.hlsl @@ -0,0 +1,40 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_i1_(inout int x) { + const int x_35 = asint(x_7[0].x); + if ((x_35 == 1)) { + const int x_39 = x; + return x_39; + } + const int x_41 = asint(x_7[0].x); + return x_41; +} + +void main_1() { + int param = 0; + param = -1; + const int x_28 = func_i1_(param); + if ((x_28 <= 0)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4c29280286 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_i1_(constant buf0& x_7, thread int* const x) { + int const x_35 = x_7.one; + if ((x_35 == 1)) { + int const x_39 = *(x); + return x_39; + } + int const x_41 = x_7.one; + return x_41; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int param = 0; + param = -1; + int const x_28 = func_i1_(x_7, &(param)); + if ((x_28 <= 0)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..3722ee6360 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_i1_ "func_i1_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpTypeFunction %int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %void = OpTypeVoid + %31 = OpTypeFunction %void + %36 = OpConstantNull %int + %int_n1 = OpConstant %int -1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %47 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %48 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %int None %12 + %x = OpFunctionParameter %_ptr_Function_int + %16 = OpLabel + %20 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %21 = OpLoad %int %20 + %23 = OpIEqual %bool %21 %int_1 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %25 + %26 = OpLabel + %28 = OpLoad %int %x + OpReturnValue %28 + %25 = OpLabel + %29 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %30 = OpLoad %int %29 + OpReturnValue %30 + OpFunctionEnd + %main_1 = OpFunction %void None %31 + %34 = OpLabel + %param = OpVariable %_ptr_Function_int Function %36 + OpStore %param %int_n1 + %38 = OpFunctionCall %int %func_i1_ %param + %41 = OpSLessThanEqual %bool %38 %int_0 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %44 + %43 = OpLabel + OpStore %x_GLF_color %47 + OpBranch %42 + %44 = OpLabel + OpStore %x_GLF_color %48 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %49 +%tint_symbol = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %31 + %56 = OpLabel + %57 = OpFunctionCall %void %main_1 + %59 = OpLoad %v4float %x_GLF_color + %60 = OpCompositeConstruct %main_out %59 + %58 = OpFunctionCall %void %tint_symbol_2 %60 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..06c350ada8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.spvasm.expected.wgsl @@ -0,0 +1,41 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) -> i32 { + let x_35 : i32 = x_7.one; + if ((x_35 == 1)) { + let x_39 : i32 = *(x); + return x_39; + } + let x_41 : i32 = x_7.one; + return x_41; +} + +fn main_1() { + var param : i32; + param = -1; + let x_28 : i32 = func_i1_(&(param)); + if ((x_28 <= 0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl new file mode 100644 index 0000000000..06c350ada8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl @@ -0,0 +1,41 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) -> i32 { + let x_35 : i32 = x_7.one; + if ((x_35 == 1)) { + let x_39 : i32 = *(x); + return x_39; + } + let x_41 : i32 = x_7.one; + return x_41; +} + +fn main_1() { + var param : i32; + param = -1; + let x_28 : i32 = func_i1_(&(param)); + if ((x_28 <= 0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..e0e17996e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.hlsl @@ -0,0 +1,40 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_i1_(inout int x) { + const int x_35 = asint(x_7[0].x); + if ((x_35 == 1)) { + const int x_39 = x; + return x_39; + } + const int x_41 = asint(x_7[0].x); + return x_41; +} + +void main_1() { + int param = 0; + param = -1; + const int x_28 = func_i1_(param); + if ((x_28 <= 0)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4c29280286 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_i1_(constant buf0& x_7, thread int* const x) { + int const x_35 = x_7.one; + if ((x_35 == 1)) { + int const x_39 = *(x); + return x_39; + } + int const x_41 = x_7.one; + return x_41; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int param = 0; + param = -1; + int const x_28 = func_i1_(x_7, &(param)); + if ((x_28 <= 0)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..3722ee6360 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.spvasm @@ -0,0 +1,107 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_i1_ "func_i1_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpTypeFunction %int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %void = OpTypeVoid + %31 = OpTypeFunction %void + %36 = OpConstantNull %int + %int_n1 = OpConstant %int -1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %47 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %48 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %int None %12 + %x = OpFunctionParameter %_ptr_Function_int + %16 = OpLabel + %20 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %21 = OpLoad %int %20 + %23 = OpIEqual %bool %21 %int_1 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %25 + %26 = OpLabel + %28 = OpLoad %int %x + OpReturnValue %28 + %25 = OpLabel + %29 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %30 = OpLoad %int %29 + OpReturnValue %30 + OpFunctionEnd + %main_1 = OpFunction %void None %31 + %34 = OpLabel + %param = OpVariable %_ptr_Function_int Function %36 + OpStore %param %int_n1 + %38 = OpFunctionCall %int %func_i1_ %param + %41 = OpSLessThanEqual %bool %38 %int_0 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %44 + %43 = OpLabel + OpStore %x_GLF_color %47 + OpBranch %42 + %44 = OpLabel + OpStore %x_GLF_color %48 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %49 +%tint_symbol = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %31 + %56 = OpLabel + %57 = OpFunctionCall %void %main_1 + %59 = OpLoad %v4float %x_GLF_color + %60 = OpCompositeConstruct %main_out %59 + %58 = OpFunctionCall %void %tint_symbol_2 %60 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..06c350ada8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-signum/0-opt.wgsl.expected.wgsl @@ -0,0 +1,41 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) -> i32 { + let x_35 : i32 = x_7.one; + if ((x_35 == 1)) { + let x_39 : i32 = *(x); + return x_39; + } + let x_41 : i32 = x_7.one; + return x_41; +} + +fn main_1() { + var param : i32; + param = -1; + let x_28 : i32 = func_i1_(&(param)); + if ((x_28 <= 0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm new file mode 100644 index 0000000000..5d5bb2d72a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm @@ -0,0 +1,54 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_10 = OpConstant %int 10 + %int_2 = OpConstant %int 2 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %7 + %23 = OpLabel + %24 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %25 = OpLoad %int %24 + %26 = OpBitwiseAnd %int %int_2 %25 + %27 = OpSDiv %int %int_10 %26 + %28 = OpIEqual %bool %27 %int_5 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %31 + %30 = OpLabel + OpStore %_GLF_color %21 + OpBranch %29 + %31 = OpLabel + OpStore %_GLF_color %22 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..564a67a8cc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const int x_25 = asint(x_5[0].x); + if (((10 / (2 & x_25)) == 5)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.msl new file mode 100644 index 0000000000..eab11e20bc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_25 = x_5.three; + if (((10 / (2 & x_25)) == 5)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..ed4d1eb18c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_10 = OpConstant %int 10 + %int_2 = OpConstant %int 2 + %int_5 = OpConstant %int 5 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %35 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %20 = OpLoad %int %19 + %23 = OpBitwiseAnd %int %int_2 %20 + %24 = OpSDiv %int %int_10 %23 + %26 = OpIEqual %bool %24 %int_5 + OpSelectionMerge %28 None + OpBranchConditional %26 %29 %30 + %29 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %28 + %30 = OpLabel + OpStore %x_GLF_color %34 + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %35 +%tint_symbol = OpFunctionParameter %main_out + %39 = OpLabel + %40 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %40 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %42 = OpLabel + %43 = OpFunctionCall %void %main_1 + %45 = OpLoad %v4float %x_GLF_color + %46 = OpCompositeConstruct %main_out %45 + %44 = OpFunctionCall %void %tint_symbol_2 %46 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..5354413b66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + three : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_25 : i32 = x_5.three; + if (((10 / (2 & x_25)) == 5)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl new file mode 100644 index 0000000000..5354413b66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + three : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_25 : i32 = x_5.three; + if (((10 / (2 & x_25)) == 5)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..564a67a8cc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const int x_25 = asint(x_5[0].x); + if (((10 / (2 & x_25)) == 5)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.msl new file mode 100644 index 0000000000..eab11e20bc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_25 = x_5.three; + if (((10 / (2 & x_25)) == 5)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..ed4d1eb18c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.spvasm @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_10 = OpConstant %int 10 + %int_2 = OpConstant %int 2 + %int_5 = OpConstant %int 5 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %35 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %20 = OpLoad %int %19 + %23 = OpBitwiseAnd %int %int_2 %20 + %24 = OpSDiv %int %int_10 %23 + %26 = OpIEqual %bool %24 %int_5 + OpSelectionMerge %28 None + OpBranchConditional %26 %29 %30 + %29 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %28 + %30 = OpLabel + OpStore %x_GLF_color %34 + OpBranch %28 + %28 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %35 +%tint_symbol = OpFunctionParameter %main_out + %39 = OpLabel + %40 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %40 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %42 = OpLabel + %43 = OpFunctionCall %void %main_1 + %45 = OpLoad %v4float %x_GLF_color + %46 = OpCompositeConstruct %main_out %45 + %44 = OpFunctionCall %void %tint_symbol_2 %46 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..5354413b66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pattern-match-single-bit/0.wgsl.expected.wgsl @@ -0,0 +1,29 @@ +[[block]] +struct buf0 { + three : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_25 : i32 = x_5.three; + if (((10 / (2 & x_25)) == 5)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm new file mode 100644 index 0000000000..1ead4f19ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm @@ -0,0 +1,152 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_0 = OpConstant %uint 0 + %float_0 = OpConstant %float 0 + %main = OpFunction %void None %13 + %35 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %37 = OpLoad %int %36 + %38 = OpConvertSToF %float %37 + %39 = OpCompositeConstruct %v4float %38 %38 %38 %38 + OpStore %_GLF_color %39 + %40 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %41 = OpLoad %int %40 + OpStore %i %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %int %i + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %48 = OpLoad %int %47 + %49 = OpSLessThan %bool %46 %48 + OpBranchConditional %49 %50 %43 + %50 = OpLabel + %51 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %52 = OpLoad %float %51 + %53 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %54 = OpLoad %float %53 + %55 = OpFOrdLessThan %bool %52 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + %58 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpFOrdLessThan %bool %59 %61 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + OpReturn + %63 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %68 = OpLoad %float %67 + %69 = OpFOrdGreaterThan %bool %66 %68 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + OpReturn + %70 = OpLabel + OpKill + %56 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %75 = OpLoad %float %74 + %76 = OpFOrdGreaterThan %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %80 + %82 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpConvertSToF %float %83 + %85 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %86 + %88 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %89 = OpLoad %int %88 + %90 = OpConvertSToF %float %89 + %91 = OpCompositeConstruct %v4float %81 %84 %87 %90 + OpStore %_GLF_color %91 + OpBranch %43 + %77 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %93 = OpLoad %float %92 + %94 = OpFOrdLessThan %bool %93 %float_0 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + OpKill + %95 = OpLabel + OpBranch %44 + %44 = OpLabel + %97 = OpLoad %int %i + %98 = OpIAdd %int %97 %int_1 + OpStore %i %98 + OpBranch %42 + %43 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..a06717cb25 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.hlsl @@ -0,0 +1,83 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[2]; +}; + +void main_1() { + int i = 0; + const int x_37 = asint(x_6[1].x); + const float x_38 = float(x_37); + x_GLF_color = float4(x_38, x_38, x_38, x_38); + const int x_41 = asint(x_6[1].x); + i = x_41; + while (true) { + const int x_46 = i; + const int x_48 = asint(x_6[2].x); + if ((x_46 < x_48)) { + } else { + break; + } + const float x_52 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_54 = asfloat(x_9[scalar_offset / 4][scalar_offset % 4]); + if ((x_52 < x_54)) { + const float x_59 = gl_FragCoord.x; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_61 = asfloat(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_59 < x_61)) { + return; + } + const float x_66 = asfloat(x_9[1].x); + const float x_68 = asfloat(x_9[1].x); + if ((x_66 > x_68)) { + return; + } + discard; + } + const float x_73 = asfloat(x_9[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_75 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_73 > x_75)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_80 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_83 = asint(x_6[1].x); + const int x_86 = asint(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_89 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_80), float(x_83), float(x_86), float(x_89)); + break; + } + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_93 = asfloat(x_9[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_93 < 0.0f)) { + discard; + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..301e8f0cfd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_38 = float(x_37); + *(tint_symbol_5) = float4(x_38, x_38, x_38, x_38); + int const x_41 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_41; + while (true) { + int const x_46 = i; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_46 < x_48)) { + } else { + break; + } + float const x_52 = (*(tint_symbol_6)).y; + float const x_54 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_52 < x_54)) { + float const x_59 = (*(tint_symbol_6)).x; + float const x_61 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_59 < x_61)) { + return; + } + float const x_66 = x_9.x_GLF_uniform_float_values.arr[1].el; + float const x_68 = x_9.x_GLF_uniform_float_values.arr[1].el; + if ((x_66 > x_68)) { + return; + } + discard_fragment(); + } + float const x_73 = x_9.x_GLF_uniform_float_values.arr[1].el; + float const x_75 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_73 > x_75)) { + int const x_80 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_83 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_86 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_89 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_80), float(x_83), float(x_86), float(x_89)); + break; + } + float const x_93 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_93 < 0.0f)) { + discard_fragment(); + } + { + int const x_97 = i; + i = (x_97 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, x_9, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..6e3a136327 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.spvasm @@ -0,0 +1,194 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 118 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %105 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %i = OpVariable %_ptr_Function_int Function %29 + %33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %34 = OpLoad %int %33 + %35 = OpConvertSToF %float %34 + %36 = OpCompositeConstruct %v4float %35 %35 %35 %35 + OpStore %x_GLF_color %36 + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %38 = OpLoad %int %37 + OpStore %i %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %46 = OpLoad %int %45 + %47 = OpSLessThan %bool %43 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %40 + %49 = OpLabel + %54 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %55 = OpLoad %float %54 + %58 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %59 = OpLoad %float %58 + %60 = OpFOrdLessThan %bool %55 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + %63 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %64 = OpLoad %float %63 + %65 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpFOrdLessThan %bool %64 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + OpReturn + %68 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %73 = OpLoad %float %72 + %74 = OpFOrdGreaterThan %bool %71 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + OpReturn + %75 = OpLabel + OpKill + %61 = OpLabel + %77 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %78 = OpLoad %float %77 + %79 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %80 = OpLoad %float %79 + %81 = OpFOrdGreaterThan %bool %78 %80 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %82 + %83 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %85 + %93 = OpConvertSToF %float %87 + %94 = OpConvertSToF %float %89 + %95 = OpConvertSToF %float %91 + %96 = OpCompositeConstruct %v4float %92 %93 %94 %95 + OpStore %x_GLF_color %96 + OpBranch %40 + %82 = OpLabel + %97 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %98 = OpLoad %float %97 + %100 = OpFOrdLessThan %bool %98 %float_0 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpKill + %101 = OpLabel + OpBranch %41 + %41 = OpLabel + %103 = OpLoad %int %i + %104 = OpIAdd %int %103 %int_1 + OpStore %i %104 + OpBranch %39 + %40 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %105 +%tint_symbol_1 = OpFunctionParameter %main_out + %109 = OpLabel + %110 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %110 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %112 = OpLabel + %113 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %113 + %114 = OpFunctionCall %void %main_1 + %116 = OpLoad %v4float %x_GLF_color + %117 = OpCompositeConstruct %main_out %116 + %115 = OpFunctionCall %void %tint_symbol_3 %117 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..70772f95af --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.spvasm.expected.wgsl @@ -0,0 +1,85 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +fn main_1() { + var i : i32; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_38 : f32 = f32(x_37); + x_GLF_color = vec4(x_38, x_38, x_38, x_38); + let x_41 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_41; + loop { + let x_46 : i32 = i; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_46 < x_48)) { + } else { + break; + } + let x_52 : f32 = gl_FragCoord.y; + let x_54 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_52 < x_54)) { + let x_59 : f32 = gl_FragCoord.x; + let x_61 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_59 < x_61)) { + return; + } + let x_66 : f32 = x_9.x_GLF_uniform_float_values[1]; + let x_68 : f32 = x_9.x_GLF_uniform_float_values[1]; + if ((x_66 > x_68)) { + return; + } + discard; + } + let x_73 : f32 = x_9.x_GLF_uniform_float_values[1]; + let x_75 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_73 > x_75)) { + let x_80 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_83 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_86 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_89 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_80), f32(x_83), f32(x_86), f32(x_89)); + break; + } + let x_93 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_93 < 0.0)) { + discard; + } + + continuing { + let x_97 : i32 = i; + i = (x_97 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl new file mode 100644 index 0000000000..70772f95af --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl @@ -0,0 +1,85 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +fn main_1() { + var i : i32; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_38 : f32 = f32(x_37); + x_GLF_color = vec4(x_38, x_38, x_38, x_38); + let x_41 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_41; + loop { + let x_46 : i32 = i; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_46 < x_48)) { + } else { + break; + } + let x_52 : f32 = gl_FragCoord.y; + let x_54 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_52 < x_54)) { + let x_59 : f32 = gl_FragCoord.x; + let x_61 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_59 < x_61)) { + return; + } + let x_66 : f32 = x_9.x_GLF_uniform_float_values[1]; + let x_68 : f32 = x_9.x_GLF_uniform_float_values[1]; + if ((x_66 > x_68)) { + return; + } + discard; + } + let x_73 : f32 = x_9.x_GLF_uniform_float_values[1]; + let x_75 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_73 > x_75)) { + let x_80 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_83 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_86 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_89 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_80), f32(x_83), f32(x_86), f32(x_89)); + break; + } + let x_93 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_93 < 0.0)) { + discard; + } + + continuing { + let x_97 : i32 = i; + i = (x_97 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..a06717cb25 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.hlsl @@ -0,0 +1,83 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[2]; +}; + +void main_1() { + int i = 0; + const int x_37 = asint(x_6[1].x); + const float x_38 = float(x_37); + x_GLF_color = float4(x_38, x_38, x_38, x_38); + const int x_41 = asint(x_6[1].x); + i = x_41; + while (true) { + const int x_46 = i; + const int x_48 = asint(x_6[2].x); + if ((x_46 < x_48)) { + } else { + break; + } + const float x_52 = gl_FragCoord.y; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_54 = asfloat(x_9[scalar_offset / 4][scalar_offset % 4]); + if ((x_52 < x_54)) { + const float x_59 = gl_FragCoord.x; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_61 = asfloat(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_59 < x_61)) { + return; + } + const float x_66 = asfloat(x_9[1].x); + const float x_68 = asfloat(x_9[1].x); + if ((x_66 > x_68)) { + return; + } + discard; + } + const float x_73 = asfloat(x_9[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_75 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_73 > x_75)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_80 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_83 = asint(x_6[1].x); + const int x_86 = asint(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_89 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_80), float(x_83), float(x_86), float(x_89)); + break; + } + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_93 = asfloat(x_9[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_93 < 0.0f)) { + discard; + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..301e8f0cfd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_38 = float(x_37); + *(tint_symbol_5) = float4(x_38, x_38, x_38, x_38); + int const x_41 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_41; + while (true) { + int const x_46 = i; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[2].el; + if ((x_46 < x_48)) { + } else { + break; + } + float const x_52 = (*(tint_symbol_6)).y; + float const x_54 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_52 < x_54)) { + float const x_59 = (*(tint_symbol_6)).x; + float const x_61 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_59 < x_61)) { + return; + } + float const x_66 = x_9.x_GLF_uniform_float_values.arr[1].el; + float const x_68 = x_9.x_GLF_uniform_float_values.arr[1].el; + if ((x_66 > x_68)) { + return; + } + discard_fragment(); + } + float const x_73 = x_9.x_GLF_uniform_float_values.arr[1].el; + float const x_75 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_73 > x_75)) { + int const x_80 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_83 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_86 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_89 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_80), float(x_83), float(x_86), float(x_89)); + break; + } + float const x_93 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_93 < 0.0f)) { + discard_fragment(); + } + { + int const x_97 = i; + i = (x_97 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, x_9, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..6e3a136327 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.spvasm @@ -0,0 +1,194 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 118 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %105 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %i = OpVariable %_ptr_Function_int Function %29 + %33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %34 = OpLoad %int %33 + %35 = OpConvertSToF %float %34 + %36 = OpCompositeConstruct %v4float %35 %35 %35 %35 + OpStore %x_GLF_color %36 + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %38 = OpLoad %int %37 + OpStore %i %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %46 = OpLoad %int %45 + %47 = OpSLessThan %bool %43 %46 + OpSelectionMerge %49 None + OpBranchConditional %47 %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %40 + %49 = OpLabel + %54 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %55 = OpLoad %float %54 + %58 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %59 = OpLoad %float %58 + %60 = OpFOrdLessThan %bool %55 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + %63 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %64 = OpLoad %float %63 + %65 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpFOrdLessThan %bool %64 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + OpReturn + %68 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %73 = OpLoad %float %72 + %74 = OpFOrdGreaterThan %bool %71 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + OpReturn + %75 = OpLabel + OpKill + %61 = OpLabel + %77 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %78 = OpLoad %float %77 + %79 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %80 = OpLoad %float %79 + %81 = OpFOrdGreaterThan %bool %78 %80 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %82 + %83 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %85 = OpLoad %int %84 + %86 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %85 + %93 = OpConvertSToF %float %87 + %94 = OpConvertSToF %float %89 + %95 = OpConvertSToF %float %91 + %96 = OpCompositeConstruct %v4float %92 %93 %94 %95 + OpStore %x_GLF_color %96 + OpBranch %40 + %82 = OpLabel + %97 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %98 = OpLoad %float %97 + %100 = OpFOrdLessThan %bool %98 %float_0 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpKill + %101 = OpLabel + OpBranch %41 + %41 = OpLabel + %103 = OpLoad %int %i + %104 = OpIAdd %int %103 %int_1 + OpStore %i %104 + OpBranch %39 + %40 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %105 +%tint_symbol_1 = OpFunctionParameter %main_out + %109 = OpLabel + %110 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %110 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %112 = OpLabel + %113 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %113 + %114 = OpFunctionCall %void %main_1 + %116 = OpLoad %v4float %x_GLF_color + %117 = OpCompositeConstruct %main_out %116 + %115 = OpFunctionCall %void %tint_symbol_3 %117 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..70772f95af --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-peephole-optimizer-target-instr-info-for-if-if-if/0-opt.wgsl.expected.wgsl @@ -0,0 +1,85 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +fn main_1() { + var i : i32; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_38 : f32 = f32(x_37); + x_GLF_color = vec4(x_38, x_38, x_38, x_38); + let x_41 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_41; + loop { + let x_46 : i32 = i; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[2]; + if ((x_46 < x_48)) { + } else { + break; + } + let x_52 : f32 = gl_FragCoord.y; + let x_54 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_52 < x_54)) { + let x_59 : f32 = gl_FragCoord.x; + let x_61 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_59 < x_61)) { + return; + } + let x_66 : f32 = x_9.x_GLF_uniform_float_values[1]; + let x_68 : f32 = x_9.x_GLF_uniform_float_values[1]; + if ((x_66 > x_68)) { + return; + } + discard; + } + let x_73 : f32 = x_9.x_GLF_uniform_float_values[1]; + let x_75 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_73 > x_75)) { + let x_80 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_83 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_86 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_89 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_80), f32(x_83), f32(x_86), f32(x_89)); + break; + } + let x_93 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_93 < 0.0)) { + discard; + } + + continuing { + let x_97 : i32 = i; + i = (x_97 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm new file mode 100644 index 0000000000..62bd197505 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm @@ -0,0 +1,127 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f0 "f0" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %f1 "f1" + OpName %f2 "f2" + OpName %f3 "f3" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "one" + OpName %__0 "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__1 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 2 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__0 = OpVariable %_ptr_Uniform_buf2 Uniform +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__1 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %17 + %34 = OpLabel + %f0 = OpVariable %_ptr_Function_float Function + %f1 = OpVariable %_ptr_Function_float Function + %f2 = OpVariable %_ptr_Function_float Function + %f3 = OpVariable %_ptr_Function_float Function + %35 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %36 = OpLoad %float %35 + OpStore %f0 %36 + %37 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %38 = OpLoad %float %37 + %39 = OpLoad %float %f0 + %40 = OpExtInst %float %1 Pow %39 %float_4 + %41 = OpFMul %float %38 %40 + OpStore %f1 %41 + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %43 = OpLoad %float %42 + %44 = OpLoad %float %f0 + %45 = OpExtInst %float %1 Pow %44 %float_4 + %46 = OpFMul %float %43 %45 + OpStore %f2 %46 + %47 = OpLoad %float %f1 + %48 = OpLoad %float %f2 + %49 = OpFSub %float %47 %48 + %50 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 + %51 = OpLoad %float %50 + %52 = OpFSub %float %49 %51 + %53 = OpLoad %float %f0 + %54 = OpFAdd %float %52 %53 + %55 = OpExtInst %float %1 Sqrt %54 + OpStore %f3 %55 + %56 = OpLoad %float %f3 + %57 = OpConvertFToS %int %56 + %58 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpIEqual %bool %57 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %68 + %70 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %71 + %73 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %66 %69 %72 %75 + OpStore %_GLF_color %76 + OpBranch %61 + %63 = OpLabel + %77 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpConvertSToF %float %78 + %80 = OpCompositeConstruct %v4float %79 %79 %79 %79 + OpStore %_GLF_color %80 + OpBranch %61 + %61 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f0bc792c4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.hlsl @@ -0,0 +1,59 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_11 : register(b2, space0) { + uint4 x_11[1]; +}; +cbuffer cbuffer_x_13 : register(b1, space0) { + uint4 x_13[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f0 = 0.0f; + float f1 = 0.0f; + float f2 = 0.0f; + float f3 = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + f0 = x_36; + const float x_38 = asfloat(x_6[1].x); + f1 = (x_38 * pow(f0, 4.0f)); + const float x_43 = asfloat(x_6[1].x); + f2 = (x_43 * pow(f0, 4.0f)); + const float x_47 = f1; + const float x_48 = f2; + const float x_51 = asfloat(x_11[0].x); + f3 = sqrt((((x_47 - x_48) - x_51) + f0)); + const float x_56 = f3; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_13[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((int(x_56) == x_59)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_65 = asint(x_13[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_68 = asint(x_13[1].x); + const int x_71 = asint(x_13[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_13[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_65), float(x_68), float(x_71), float(x_74)); + } else { + const int x_78 = asint(x_13[1].x); + const float x_79 = float(x_78); + x_GLF_color = float4(x_79, x_79, x_79, x_79); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..5e53c898c8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ float one; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf2& x_11, constant buf1& x_13, thread float4* const tint_symbol_4) { + float f0 = 0.0f; + float f1 = 0.0f; + float f2 = 0.0f; + float f3 = 0.0f; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[0].el; + f0 = x_36; + float const x_38 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_39 = f0; + f1 = (x_38 * pow(x_39, 4.0f)); + float const x_43 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_44 = f0; + f2 = (x_43 * pow(x_44, 4.0f)); + float const x_47 = f1; + float const x_48 = f2; + float const x_51 = x_11.one; + float const x_53 = f0; + f3 = sqrt((((x_47 - x_48) - x_51) + x_53)); + float const x_56 = f3; + int const x_59 = x_13.x_GLF_uniform_int_values.arr[0].el; + if ((int(x_56) == x_59)) { + int const x_65 = x_13.x_GLF_uniform_int_values.arr[0].el; + int const x_68 = x_13.x_GLF_uniform_int_values.arr[1].el; + int const x_71 = x_13.x_GLF_uniform_int_values.arr[1].el; + int const x_74 = x_13.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_65), float(x_68), float(x_71), float(x_74)); + } else { + int const x_78 = x_13.x_GLF_uniform_int_values.arr[1].el; + float const x_79 = float(x_78); + *(tint_symbol_4) = float4(x_79, x_79, x_79, x_79); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf2& x_11 [[buffer(2)]], constant buf1& x_13 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_11, x_13, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4a7d2854f3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.spvasm @@ -0,0 +1,163 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + %42 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "one" + OpName %x_11 "x_11" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_13 "x_13" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f0 "f0" + OpName %f1 "f1" + OpName %f2 "f2" + OpName %f3 "f3" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 2 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_11 = OpVariable %_ptr_Uniform_buf2 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_13 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %19 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %19 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %86 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %f0 = OpVariable %_ptr_Function_float Function %28 + %f1 = OpVariable %_ptr_Function_float Function %28 + %f2 = OpVariable %_ptr_Function_float Function %28 + %f3 = OpVariable %_ptr_Function_float Function %28 + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %36 = OpLoad %float %35 + OpStore %f0 %36 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %39 = OpLoad %float %38 + %40 = OpLoad %float %f0 + %41 = OpExtInst %float %42 Pow %40 %float_4 + %44 = OpFMul %float %39 %41 + OpStore %f1 %44 + %45 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %46 = OpLoad %float %45 + %47 = OpLoad %float %f0 + %48 = OpExtInst %float %42 Pow %47 %float_4 + %49 = OpFMul %float %46 %48 + OpStore %f2 %49 + %50 = OpLoad %float %f1 + %51 = OpLoad %float %f2 + %52 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 + %53 = OpLoad %float %52 + %54 = OpLoad %float %f0 + %56 = OpFSub %float %50 %51 + %57 = OpFSub %float %56 %53 + %58 = OpFAdd %float %57 %54 + %55 = OpExtInst %float %42 Sqrt %58 + OpStore %f3 %55 + %59 = OpLoad %float %f3 + %61 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_0 + %62 = OpLoad %int %61 + %63 = OpConvertFToS %int %59 + %64 = OpIEqual %bool %63 %62 + OpSelectionMerge %66 None + OpBranchConditional %64 %67 %68 + %67 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_1 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %70 + %78 = OpConvertSToF %float %72 + %79 = OpConvertSToF %float %74 + %80 = OpConvertSToF %float %76 + %81 = OpCompositeConstruct %v4float %77 %78 %79 %80 + OpStore %x_GLF_color %81 + OpBranch %66 + %68 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpConvertSToF %float %83 + %85 = OpCompositeConstruct %v4float %84 %84 %84 %84 + OpStore %x_GLF_color %85 + OpBranch %66 + %66 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %86 +%tint_symbol = OpFunctionParameter %main_out + %90 = OpLabel + %91 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %91 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %93 = OpLabel + %94 = OpFunctionCall %void %main_1 + %96 = OpLoad %v4float %x_GLF_color + %97 = OpCompositeConstruct %main_out %96 + %95 = OpFunctionCall %void %tint_symbol_2 %97 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..39bc58729d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.spvasm.expected.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + one : f32; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(2)]] var x_11 : buf2; + +[[group(0), binding(1)]] var x_13 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f0 : f32; + var f1 : f32; + var f2 : f32; + var f3 : f32; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + f0 = x_36; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_39 : f32 = f0; + f1 = (x_38 * pow(x_39, 4.0)); + let x_43 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_44 : f32 = f0; + f2 = (x_43 * pow(x_44, 4.0)); + let x_47 : f32 = f1; + let x_48 : f32 = f2; + let x_51 : f32 = x_11.one; + let x_53 : f32 = f0; + f3 = sqrt((((x_47 - x_48) - x_51) + x_53)); + let x_56 : f32 = f3; + let x_59 : i32 = x_13.x_GLF_uniform_int_values[0]; + if ((i32(x_56) == x_59)) { + let x_65 : i32 = x_13.x_GLF_uniform_int_values[0]; + let x_68 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_71 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_74 : i32 = x_13.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_65), f32(x_68), f32(x_71), f32(x_74)); + } else { + let x_78 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_79 : f32 = f32(x_78); + x_GLF_color = vec4(x_79, x_79, x_79, x_79); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl new file mode 100644 index 0000000000..39bc58729d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + one : f32; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(2)]] var x_11 : buf2; + +[[group(0), binding(1)]] var x_13 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f0 : f32; + var f1 : f32; + var f2 : f32; + var f3 : f32; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + f0 = x_36; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_39 : f32 = f0; + f1 = (x_38 * pow(x_39, 4.0)); + let x_43 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_44 : f32 = f0; + f2 = (x_43 * pow(x_44, 4.0)); + let x_47 : f32 = f1; + let x_48 : f32 = f2; + let x_51 : f32 = x_11.one; + let x_53 : f32 = f0; + f3 = sqrt((((x_47 - x_48) - x_51) + x_53)); + let x_56 : f32 = f3; + let x_59 : i32 = x_13.x_GLF_uniform_int_values[0]; + if ((i32(x_56) == x_59)) { + let x_65 : i32 = x_13.x_GLF_uniform_int_values[0]; + let x_68 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_71 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_74 : i32 = x_13.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_65), f32(x_68), f32(x_71), f32(x_74)); + } else { + let x_78 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_79 : f32 = f32(x_78); + x_GLF_color = vec4(x_79, x_79, x_79, x_79); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f0bc792c4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.hlsl @@ -0,0 +1,59 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_11 : register(b2, space0) { + uint4 x_11[1]; +}; +cbuffer cbuffer_x_13 : register(b1, space0) { + uint4 x_13[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f0 = 0.0f; + float f1 = 0.0f; + float f2 = 0.0f; + float f3 = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_36 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + f0 = x_36; + const float x_38 = asfloat(x_6[1].x); + f1 = (x_38 * pow(f0, 4.0f)); + const float x_43 = asfloat(x_6[1].x); + f2 = (x_43 * pow(f0, 4.0f)); + const float x_47 = f1; + const float x_48 = f2; + const float x_51 = asfloat(x_11[0].x); + f3 = sqrt((((x_47 - x_48) - x_51) + f0)); + const float x_56 = f3; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_13[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((int(x_56) == x_59)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_65 = asint(x_13[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_68 = asint(x_13[1].x); + const int x_71 = asint(x_13[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_13[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_65), float(x_68), float(x_71), float(x_74)); + } else { + const int x_78 = asint(x_13[1].x); + const float x_79 = float(x_78); + x_GLF_color = float4(x_79, x_79, x_79, x_79); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..5e53c898c8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ float one; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf2& x_11, constant buf1& x_13, thread float4* const tint_symbol_4) { + float f0 = 0.0f; + float f1 = 0.0f; + float f2 = 0.0f; + float f3 = 0.0f; + float const x_36 = x_6.x_GLF_uniform_float_values.arr[0].el; + f0 = x_36; + float const x_38 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_39 = f0; + f1 = (x_38 * pow(x_39, 4.0f)); + float const x_43 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_44 = f0; + f2 = (x_43 * pow(x_44, 4.0f)); + float const x_47 = f1; + float const x_48 = f2; + float const x_51 = x_11.one; + float const x_53 = f0; + f3 = sqrt((((x_47 - x_48) - x_51) + x_53)); + float const x_56 = f3; + int const x_59 = x_13.x_GLF_uniform_int_values.arr[0].el; + if ((int(x_56) == x_59)) { + int const x_65 = x_13.x_GLF_uniform_int_values.arr[0].el; + int const x_68 = x_13.x_GLF_uniform_int_values.arr[1].el; + int const x_71 = x_13.x_GLF_uniform_int_values.arr[1].el; + int const x_74 = x_13.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_65), float(x_68), float(x_71), float(x_74)); + } else { + int const x_78 = x_13.x_GLF_uniform_int_values.arr[1].el; + float const x_79 = float(x_78); + *(tint_symbol_4) = float4(x_79, x_79, x_79, x_79); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf2& x_11 [[buffer(2)]], constant buf1& x_13 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_11, x_13, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4a7d2854f3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.spvasm @@ -0,0 +1,163 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + %42 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "one" + OpName %x_11 "x_11" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_13 "x_13" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f0 "f0" + OpName %f1 "f1" + OpName %f2 "f2" + OpName %f3 "f3" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 2 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_11 = OpVariable %_ptr_Uniform_buf2 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_13 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %19 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %19 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %86 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %f0 = OpVariable %_ptr_Function_float Function %28 + %f1 = OpVariable %_ptr_Function_float Function %28 + %f2 = OpVariable %_ptr_Function_float Function %28 + %f3 = OpVariable %_ptr_Function_float Function %28 + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %36 = OpLoad %float %35 + OpStore %f0 %36 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %39 = OpLoad %float %38 + %40 = OpLoad %float %f0 + %41 = OpExtInst %float %42 Pow %40 %float_4 + %44 = OpFMul %float %39 %41 + OpStore %f1 %44 + %45 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %46 = OpLoad %float %45 + %47 = OpLoad %float %f0 + %48 = OpExtInst %float %42 Pow %47 %float_4 + %49 = OpFMul %float %46 %48 + OpStore %f2 %49 + %50 = OpLoad %float %f1 + %51 = OpLoad %float %f2 + %52 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 + %53 = OpLoad %float %52 + %54 = OpLoad %float %f0 + %56 = OpFSub %float %50 %51 + %57 = OpFSub %float %56 %53 + %58 = OpFAdd %float %57 %54 + %55 = OpExtInst %float %42 Sqrt %58 + OpStore %f3 %55 + %59 = OpLoad %float %f3 + %61 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_0 + %62 = OpLoad %int %61 + %63 = OpConvertFToS %int %59 + %64 = OpIEqual %bool %63 %62 + OpSelectionMerge %66 None + OpBranchConditional %64 %67 %68 + %67 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_1 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %70 + %78 = OpConvertSToF %float %72 + %79 = OpConvertSToF %float %74 + %80 = OpConvertSToF %float %76 + %81 = OpCompositeConstruct %v4float %77 %78 %79 %80 + OpStore %x_GLF_color %81 + OpBranch %66 + %68 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_int %x_13 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpConvertSToF %float %83 + %85 = OpCompositeConstruct %v4float %84 %84 %84 %84 + OpStore %x_GLF_color %85 + OpBranch %66 + %66 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %86 +%tint_symbol = OpFunctionParameter %main_out + %90 = OpLabel + %91 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %91 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %93 = OpLabel + %94 = OpFunctionCall %void %main_1 + %96 = OpLoad %v4float %x_GLF_color + %97 = OpCompositeConstruct %main_out %96 + %95 = OpFunctionCall %void %tint_symbol_2 %97 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..39bc58729d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-identical-value-sqrt/0-opt.wgsl.expected.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + one : f32; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(2)]] var x_11 : buf2; + +[[group(0), binding(1)]] var x_13 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var f0 : f32; + var f1 : f32; + var f2 : f32; + var f3 : f32; + let x_36 : f32 = x_6.x_GLF_uniform_float_values[0]; + f0 = x_36; + let x_38 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_39 : f32 = f0; + f1 = (x_38 * pow(x_39, 4.0)); + let x_43 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_44 : f32 = f0; + f2 = (x_43 * pow(x_44, 4.0)); + let x_47 : f32 = f1; + let x_48 : f32 = f2; + let x_51 : f32 = x_11.one; + let x_53 : f32 = f0; + f3 = sqrt((((x_47 - x_48) - x_51) + x_53)); + let x_56 : f32 = f3; + let x_59 : i32 = x_13.x_GLF_uniform_int_values[0]; + if ((i32(x_56) == x_59)) { + let x_65 : i32 = x_13.x_GLF_uniform_int_values[0]; + let x_68 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_71 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_74 : i32 = x_13.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_65), f32(x_68), f32(x_71), f32(x_74)); + } else { + let x_78 : i32 = x_13.x_GLF_uniform_int_values[1]; + let x_79 : f32 = f32(x_78); + x_GLF_color = vec4(x_79, x_79, x_79, x_79); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm new file mode 100644 index 0000000000..00b0784fdb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm @@ -0,0 +1,113 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f "f" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zero" + OpName %__0 "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__1 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 2 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %buf2 = OpTypeStruct %int +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__0 = OpVariable %_ptr_Uniform_buf2 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__1 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %31 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %32 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %33 = OpLoad %float %32 + %34 = OpFNegate %float %33 + %35 = OpExtInst %float %1 Sinh %float_1 + %36 = OpExtInst %float %1 Pow %34 %35 + OpStore %f %36 + %37 = OpLoad %float %f + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %39 = OpLoad %float %38 + %40 = OpFOrdEqual %bool %37 %39 + %41 = OpLogicalNot %bool %40 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpIEqual %bool %45 %47 + OpBranch %42 + %42 = OpLabel + %49 = OpPhi %bool %40 %31 %48 %43 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %54 = OpLoad %int %53 + %55 = OpConvertSToF %float %54 + %56 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpConvertSToF %float %63 + %65 = OpCompositeConstruct %v4float %55 %58 %61 %64 + OpStore %_GLF_color %65 + OpBranch %50 + %52 = OpLabel + %66 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %67 + %69 = OpCompositeConstruct %v4float %68 %68 %68 %68 + OpStore %_GLF_color %69 + OpBranch %50 + %50 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..fd122cb606 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.hlsl @@ -0,0 +1,59 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b2, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + bool x_48 = false; + bool x_49_phi = false; + const float x_33 = asfloat(x_6[1].x); + f = pow(-(x_33), sinh(1.0f)); + const float x_37 = f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_39 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const bool x_40 = (x_37 == x_39); + x_49_phi = x_40; + if (!(x_40)) { + const int x_45 = asint(x_8[0].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_48 = (x_45 == x_47); + x_49_phi = x_48; + } + if (x_49_phi) { + const int x_54 = asint(x_10[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_60 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_63 = asint(x_10[1].x); + x_GLF_color = float4(float(x_54), float(x_57), float(x_60), float(x_63)); + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_67 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_68 = float(x_67); + x_GLF_color = float4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..53c1f7d3f8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.msl @@ -0,0 +1,72 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ int zero; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf2& x_8, constant buf0& x_10, thread float4* const tint_symbol_4) { + float f = 0.0f; + bool x_48 = false; + bool x_49_phi = false; + float const x_33 = x_6.x_GLF_uniform_float_values.arr[1].el; + f = pow(-(x_33), sinh(1.0f)); + float const x_37 = f; + float const x_39 = x_6.x_GLF_uniform_float_values.arr[0].el; + bool const x_40 = (x_37 == x_39); + x_49_phi = x_40; + if (!(x_40)) { + int const x_45 = x_8.zero; + int const x_47 = x_10.x_GLF_uniform_int_values.arr[0].el; + x_48 = (x_45 == x_47); + x_49_phi = x_48; + } + bool const x_49 = x_49_phi; + if (x_49) { + int const x_54 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_57 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_60 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_63 = x_10.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_54), float(x_57), float(x_60), float(x_63)); + } else { + int const x_67 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_68 = float(x_67); + *(tint_symbol_4) = float4(x_68, x_68, x_68, x_68); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf2& x_8 [[buffer(2)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8e68666128 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.spvasm @@ -0,0 +1,159 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + %40 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zero" + OpName %x_8 "x_8" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %x_48 "x_48" + OpName %x_49_phi "x_49_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %buf2 = OpTypeStruct %int +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_8 = OpVariable %_ptr_Uniform_buf2 Uniform +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %19 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %19 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %32 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %f = OpVariable %_ptr_Function_float Function %28 + %x_48 = OpVariable %_ptr_Function_bool Function %32 + %x_49_phi = OpVariable %_ptr_Function_bool Function %32 + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %38 = OpLoad %float %37 + %41 = OpFNegate %float %38 + %42 = OpExtInst %float %40 Sinh %float_1 + %39 = OpExtInst %float %40 Pow %41 %42 + OpStore %f %39 + %44 = OpLoad %float %f + %46 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpFOrdEqual %bool %44 %47 + OpStore %x_49_phi %48 + %49 = OpLogicalNot %bool %48 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpIEqual %bool %54 %56 + OpStore %x_48 %57 + %58 = OpLoad %bool %x_48 + OpStore %x_49_phi %58 + OpBranch %50 + %50 = OpLabel + %59 = OpLoad %bool %x_49_phi + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %64 + %72 = OpConvertSToF %float %66 + %73 = OpConvertSToF %float %68 + %74 = OpConvertSToF %float %70 + %75 = OpCompositeConstruct %v4float %71 %72 %73 %74 + OpStore %x_GLF_color %75 + OpBranch %60 + %62 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpCompositeConstruct %v4float %78 %78 %78 %78 + OpStore %x_GLF_color %79 + OpBranch %60 + %60 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %80 +%tint_symbol = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %87 = OpLabel + %88 = OpFunctionCall %void %main_1 + %90 = OpLoad %v4float %x_GLF_color + %91 = OpCompositeConstruct %main_out %90 + %89 = OpFunctionCall %void %tint_symbol_2 %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b378e4c5c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.spvasm.expected.wgsl @@ -0,0 +1,68 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + zero : i32; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(2)]] var x_8 : buf2; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var x_48 : bool; + var x_49_phi : bool; + let x_33 : f32 = x_6.x_GLF_uniform_float_values[1]; + f = pow(-(x_33), sinh(1.0)); + let x_37 : f32 = f; + let x_39 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_40 : bool = (x_37 == x_39); + x_49_phi = x_40; + if (!(x_40)) { + let x_45 : i32 = x_8.zero; + let x_47 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_48 = (x_45 == x_47); + x_49_phi = x_48; + } + let x_49 : bool = x_49_phi; + if (x_49) { + let x_54 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_57 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_63 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_54), f32(x_57), f32(x_60), f32(x_63)); + } else { + let x_67 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_68 : f32 = f32(x_67); + x_GLF_color = vec4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl new file mode 100644 index 0000000000..b378e4c5c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl @@ -0,0 +1,68 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + zero : i32; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(2)]] var x_8 : buf2; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var x_48 : bool; + var x_49_phi : bool; + let x_33 : f32 = x_6.x_GLF_uniform_float_values[1]; + f = pow(-(x_33), sinh(1.0)); + let x_37 : f32 = f; + let x_39 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_40 : bool = (x_37 == x_39); + x_49_phi = x_40; + if (!(x_40)) { + let x_45 : i32 = x_8.zero; + let x_47 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_48 = (x_45 == x_47); + x_49_phi = x_48; + } + let x_49 : bool = x_49_phi; + if (x_49) { + let x_54 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_57 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_63 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_54), f32(x_57), f32(x_60), f32(x_63)); + } else { + let x_67 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_68 : f32 = f32(x_67); + x_GLF_color = vec4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..fd122cb606 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.hlsl @@ -0,0 +1,59 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b2, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + bool x_48 = false; + bool x_49_phi = false; + const float x_33 = asfloat(x_6[1].x); + f = pow(-(x_33), sinh(1.0f)); + const float x_37 = f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_39 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const bool x_40 = (x_37 == x_39); + x_49_phi = x_40; + if (!(x_40)) { + const int x_45 = asint(x_8[0].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_48 = (x_45 == x_47); + x_49_phi = x_48; + } + if (x_49_phi) { + const int x_54 = asint(x_10[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_60 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_63 = asint(x_10[1].x); + x_GLF_color = float4(float(x_54), float(x_57), float(x_60), float(x_63)); + } else { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_67 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_68 = float(x_67); + x_GLF_color = float4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..53c1f7d3f8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.msl @@ -0,0 +1,72 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ int zero; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf2& x_8, constant buf0& x_10, thread float4* const tint_symbol_4) { + float f = 0.0f; + bool x_48 = false; + bool x_49_phi = false; + float const x_33 = x_6.x_GLF_uniform_float_values.arr[1].el; + f = pow(-(x_33), sinh(1.0f)); + float const x_37 = f; + float const x_39 = x_6.x_GLF_uniform_float_values.arr[0].el; + bool const x_40 = (x_37 == x_39); + x_49_phi = x_40; + if (!(x_40)) { + int const x_45 = x_8.zero; + int const x_47 = x_10.x_GLF_uniform_int_values.arr[0].el; + x_48 = (x_45 == x_47); + x_49_phi = x_48; + } + bool const x_49 = x_49_phi; + if (x_49) { + int const x_54 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_57 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_60 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_63 = x_10.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_54), float(x_57), float(x_60), float(x_63)); + } else { + int const x_67 = x_10.x_GLF_uniform_int_values.arr[0].el; + float const x_68 = float(x_67); + *(tint_symbol_4) = float4(x_68, x_68, x_68, x_68); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf2& x_8 [[buffer(2)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e68666128 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.spvasm @@ -0,0 +1,159 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + %40 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zero" + OpName %x_8 "x_8" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %x_48 "x_48" + OpName %x_49_phi "x_49_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %buf2 = OpTypeStruct %int +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_8 = OpVariable %_ptr_Uniform_buf2 Uniform +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %19 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %19 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %32 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %f = OpVariable %_ptr_Function_float Function %28 + %x_48 = OpVariable %_ptr_Function_bool Function %32 + %x_49_phi = OpVariable %_ptr_Function_bool Function %32 + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %38 = OpLoad %float %37 + %41 = OpFNegate %float %38 + %42 = OpExtInst %float %40 Sinh %float_1 + %39 = OpExtInst %float %40 Pow %41 %42 + OpStore %f %39 + %44 = OpLoad %float %f + %46 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpFOrdEqual %bool %44 %47 + OpStore %x_49_phi %48 + %49 = OpLogicalNot %bool %48 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpIEqual %bool %54 %56 + OpStore %x_48 %57 + %58 = OpLoad %bool %x_48 + OpStore %x_49_phi %58 + OpBranch %50 + %50 = OpLabel + %59 = OpLoad %bool %x_49_phi + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %64 + %72 = OpConvertSToF %float %66 + %73 = OpConvertSToF %float %68 + %74 = OpConvertSToF %float %70 + %75 = OpCompositeConstruct %v4float %71 %72 %73 %74 + OpStore %x_GLF_color %75 + OpBranch %60 + %62 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpCompositeConstruct %v4float %78 %78 %78 %78 + OpStore %x_GLF_color %79 + OpBranch %60 + %60 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %80 +%tint_symbol = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %87 = OpLabel + %88 = OpFunctionCall %void %main_1 + %90 = OpLoad %v4float %x_GLF_color + %91 = OpCompositeConstruct %main_out %90 + %89 = OpFunctionCall %void %tint_symbol_2 %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b378e4c5c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined-result-condition-with-always-true/0-opt.wgsl.expected.wgsl @@ -0,0 +1,68 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + zero : i32; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(2)]] var x_8 : buf2; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var x_48 : bool; + var x_49_phi : bool; + let x_33 : f32 = x_6.x_GLF_uniform_float_values[1]; + f = pow(-(x_33), sinh(1.0)); + let x_37 : f32 = f; + let x_39 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_40 : bool = (x_37 == x_39); + x_49_phi = x_40; + if (!(x_40)) { + let x_45 : i32 = x_8.zero; + let x_47 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_48 = (x_45 == x_47); + x_49_phi = x_48; + } + let x_49 : bool = x_49_phi; + if (x_49) { + let x_54 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_57 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_60 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_63 : i32 = x_10.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_54), f32(x_57), f32(x_60), f32(x_63)); + } else { + let x_67 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_68 : f32 = f32(x_67); + x_GLF_color = vec4(x_68, x_68, x_68, x_68); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm new file mode 100644 index 0000000000..2726c753f0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm @@ -0,0 +1,82 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_n1 = OpConstant %float -1 +%float_1_70000005 = OpConstant %float 1.70000005 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %11 + %26 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %b = OpVariable %_ptr_Function_float Function + %c = OpVariable %_ptr_Function_float Function + OpStore %a %float_n1 + OpStore %b %float_1_70000005 + %27 = OpLoad %float %a + %28 = OpLoad %float %b + %29 = OpExtInst %float %1 Pow %27 %28 + OpStore %c %29 + %30 = OpLoad %float %c + %31 = OpCompositeConstruct %v4float %30 %30 %30 %30 + OpStore %_GLF_color %31 + %32 = OpLoad %float %a + %33 = OpFOrdEqual %bool %32 %float_n1 + %34 = OpLoad %float %b + %35 = OpFOrdEqual %bool %34 %float_1_70000005 + %36 = OpLogicalAnd %bool %33 %35 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %43 = OpLoad %float %42 + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpCompositeConstruct %v4float %41 %43 %45 %47 + OpStore %_GLF_color %48 + OpBranch %37 + %39 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %50 = OpLoad %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %_GLF_color %51 + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..132221e41e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.hlsl @@ -0,0 +1,47 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[2]; +}; + +void main_1() { + float a = 0.0f; + float b = 0.0f; + float c = 0.0f; + a = -1.0f; + b = 1.700000048f; + c = pow(a, b); + const float x_30 = c; + x_GLF_color = float4(x_30, x_30, x_30, x_30); + bool tint_tmp = (a == -1.0f); + if (tint_tmp) { + tint_tmp = (b == 1.700000048f); + } + if ((tint_tmp)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + const float x_43 = asfloat(x_8[1].x); + const float x_45 = asfloat(x_8[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(x_41, x_43, x_45, x_47); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_50 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(x_50, x_50, x_50, x_50); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..8000e84572 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + float a = 0.0f; + float b = 0.0f; + float c = 0.0f; + a = -1.0f; + b = 1.700000048f; + float const x_27 = a; + float const x_28 = b; + c = pow(x_27, x_28); + float const x_30 = c; + *(tint_symbol_4) = float4(x_30, x_30, x_30, x_30); + float const x_32 = a; + float const x_34 = b; + if (((x_32 == -1.0f) && (x_34 == 1.700000048f))) { + float const x_41 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_43 = x_8.x_GLF_uniform_float_values.arr[1].el; + float const x_45 = x_8.x_GLF_uniform_float_values.arr[1].el; + float const x_47 = x_8.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_41, x_43, x_45, x_47); + } else { + float const x_50 = x_8.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_50, x_50, x_50, x_50); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..60826bbd48 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.spvasm @@ -0,0 +1,121 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %28 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpConstantNull %float + %float_n1 = OpConstant %float -1 +%float_1_70000005 = OpConstant %float 1.70000005 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %59 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %a = OpVariable %_ptr_Function_float Function %20 + %b = OpVariable %_ptr_Function_float Function %20 + %c = OpVariable %_ptr_Function_float Function %20 + OpStore %a %float_n1 + OpStore %b %float_1_70000005 + %25 = OpLoad %float %a + %26 = OpLoad %float %b + %27 = OpExtInst %float %28 Pow %25 %26 + OpStore %c %27 + %29 = OpLoad %float %c + %30 = OpCompositeConstruct %v4float %29 %29 %29 %29 + OpStore %x_GLF_color %30 + %31 = OpLoad %float %a + %32 = OpLoad %float %b + %33 = OpFOrdEqual %bool %31 %float_n1 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + %37 = OpFOrdEqual %bool %32 %float_1_70000005 + OpBranch %35 + %35 = OpLabel + %38 = OpPhi %bool %33 %17 %37 %36 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %47 = OpLoad %float %46 + %49 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %50 = OpLoad %float %49 + %51 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %52 = OpLoad %float %51 + %53 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %54 = OpLoad %float %53 + %55 = OpCompositeConstruct %v4float %47 %50 %52 %54 + OpStore %x_GLF_color %55 + OpBranch %39 + %41 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %57 = OpLoad %float %56 + %58 = OpCompositeConstruct %v4float %57 %57 %57 %57 + OpStore %x_GLF_color %58 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %59 +%tint_symbol = OpFunctionParameter %main_out + %63 = OpLabel + %64 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %64 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %66 = OpLabel + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_2 %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..4be05e5326 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.spvasm.expected.wgsl @@ -0,0 +1,47 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var a : f32; + var b : f32; + var c : f32; + a = -1.0; + b = 1.700000048; + let x_27 : f32 = a; + let x_28 : f32 = b; + c = pow(x_27, x_28); + let x_30 : f32 = c; + x_GLF_color = vec4(x_30, x_30, x_30, x_30); + let x_32 : f32 = a; + let x_34 : f32 = b; + if (((x_32 == -1.0) && (x_34 == 1.700000048))) { + let x_41 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_43 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_45 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_47 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_41, x_43, x_45, x_47); + } else { + let x_50 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_50, x_50, x_50, x_50); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl new file mode 100644 index 0000000000..4be05e5326 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl @@ -0,0 +1,47 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var a : f32; + var b : f32; + var c : f32; + a = -1.0; + b = 1.700000048; + let x_27 : f32 = a; + let x_28 : f32 = b; + c = pow(x_27, x_28); + let x_30 : f32 = c; + x_GLF_color = vec4(x_30, x_30, x_30, x_30); + let x_32 : f32 = a; + let x_34 : f32 = b; + if (((x_32 == -1.0) && (x_34 == 1.700000048))) { + let x_41 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_43 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_45 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_47 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_41, x_43, x_45, x_47); + } else { + let x_50 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_50, x_50, x_50, x_50); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..132221e41e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.hlsl @@ -0,0 +1,47 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[2]; +}; + +void main_1() { + float a = 0.0f; + float b = 0.0f; + float c = 0.0f; + a = -1.0f; + b = 1.700000048f; + c = pow(a, b); + const float x_30 = c; + x_GLF_color = float4(x_30, x_30, x_30, x_30); + bool tint_tmp = (a == -1.0f); + if (tint_tmp) { + tint_tmp = (b == 1.700000048f); + } + if ((tint_tmp)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + const float x_43 = asfloat(x_8[1].x); + const float x_45 = asfloat(x_8[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(x_41, x_43, x_45, x_47); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_50 = asfloat(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(x_50, x_50, x_50, x_50); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..8000e84572 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + float a = 0.0f; + float b = 0.0f; + float c = 0.0f; + a = -1.0f; + b = 1.700000048f; + float const x_27 = a; + float const x_28 = b; + c = pow(x_27, x_28); + float const x_30 = c; + *(tint_symbol_4) = float4(x_30, x_30, x_30, x_30); + float const x_32 = a; + float const x_34 = b; + if (((x_32 == -1.0f) && (x_34 == 1.700000048f))) { + float const x_41 = x_8.x_GLF_uniform_float_values.arr[0].el; + float const x_43 = x_8.x_GLF_uniform_float_values.arr[1].el; + float const x_45 = x_8.x_GLF_uniform_float_values.arr[1].el; + float const x_47 = x_8.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_41, x_43, x_45, x_47); + } else { + float const x_50 = x_8.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_50, x_50, x_50, x_50); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..60826bbd48 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.spvasm @@ -0,0 +1,121 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %28 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpConstantNull %float + %float_n1 = OpConstant %float -1 +%float_1_70000005 = OpConstant %float 1.70000005 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %59 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %a = OpVariable %_ptr_Function_float Function %20 + %b = OpVariable %_ptr_Function_float Function %20 + %c = OpVariable %_ptr_Function_float Function %20 + OpStore %a %float_n1 + OpStore %b %float_1_70000005 + %25 = OpLoad %float %a + %26 = OpLoad %float %b + %27 = OpExtInst %float %28 Pow %25 %26 + OpStore %c %27 + %29 = OpLoad %float %c + %30 = OpCompositeConstruct %v4float %29 %29 %29 %29 + OpStore %x_GLF_color %30 + %31 = OpLoad %float %a + %32 = OpLoad %float %b + %33 = OpFOrdEqual %bool %31 %float_n1 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + %37 = OpFOrdEqual %bool %32 %float_1_70000005 + OpBranch %35 + %35 = OpLabel + %38 = OpPhi %bool %33 %17 %37 %36 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %47 = OpLoad %float %46 + %49 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %50 = OpLoad %float %49 + %51 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %52 = OpLoad %float %51 + %53 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %54 = OpLoad %float %53 + %55 = OpCompositeConstruct %v4float %47 %50 %52 %54 + OpStore %x_GLF_color %55 + OpBranch %39 + %41 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %57 = OpLoad %float %56 + %58 = OpCompositeConstruct %v4float %57 %57 %57 %57 + OpStore %x_GLF_color %58 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %59 +%tint_symbol = OpFunctionParameter %main_out + %63 = OpLabel + %64 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %64 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %66 = OpLabel + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_2 %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..4be05e5326 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-pow-undefined/0-opt.wgsl.expected.wgsl @@ -0,0 +1,47 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var a : f32; + var b : f32; + var c : f32; + a = -1.0; + b = 1.700000048; + let x_27 : f32 = a; + let x_28 : f32 = b; + c = pow(x_27, x_28); + let x_30 : f32 = c; + x_GLF_color = vec4(x_30, x_30, x_30, x_30); + let x_32 : f32 = a; + let x_34 : f32 = b; + if (((x_32 == -1.0) && (x_34 == 1.700000048))) { + let x_41 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_43 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_45 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_47 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_41, x_43, x_45, x_47); + } else { + let x_50 : f32 = x_8.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_50, x_50, x_50, x_50); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm new file mode 100644 index 0000000000..1638f7fed0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm @@ -0,0 +1,76 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_n7563 = OpConstant %int -7563 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %9 + %23 = OpLabel + %a = OpVariable %_ptr_Function_int Function + OpStore %a %int_n7563 + %24 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %25 = OpLoad %int %24 + %26 = OpLoad %int %a + %27 = OpSDiv %int %25 %26 + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %29 = OpLoad %int %28 + %30 = OpIEqual %bool %27 %29 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %35 = OpLoad %int %34 + %36 = OpConvertSToF %float %35 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpConvertSToF %float %38 + %40 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpConvertSToF %float %41 + %43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpConvertSToF %float %44 + %46 = OpCompositeConstruct %v4float %36 %39 %42 %45 + OpStore %_GLF_color %46 + OpBranch %31 + %33 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %48 + %50 = OpCompositeConstruct %v4float %49 %49 %49 %49 + OpStore %_GLF_color %50 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..89c814d635 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.hlsl @@ -0,0 +1,42 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + a = -7563; + const int x_25 = asint(x_6[1].x); + const int x_26 = a; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if (((x_25 / x_26) == x_29)) { + const int x_35 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_41 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_44 = asint(x_6[1].x); + x_GLF_color = float4(float(x_35), float(x_38), float(x_41), float(x_44)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_48 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_49 = float(x_48); + x_GLF_color = float4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d98099cc37 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + a = -7563; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_26 = a; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[0].el; + if (((x_25 / x_26) == x_29)) { + int const x_35 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_41 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_44 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_35), float(x_38), float(x_41), float(x_44)); + } else { + int const x_48 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_49 = float(x_48); + *(tint_symbol_4) = float4(x_49, x_49, x_49, x_49); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b52f8c5733 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.spvasm @@ -0,0 +1,109 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_n7563 = OpConstant %int -7563 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + OpStore %a %int_n7563 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + %28 = OpLoad %int %a + %30 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpSDiv %int %27 %28 + %33 = OpIEqual %bool %32 %31 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %37 + %36 = OpLabel + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %39 = OpLoad %int %38 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %39 + %47 = OpConvertSToF %float %41 + %48 = OpConvertSToF %float %43 + %49 = OpConvertSToF %float %45 + %50 = OpCompositeConstruct %v4float %46 %47 %48 %49 + OpStore %x_GLF_color %50 + OpBranch %35 + %37 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpCompositeConstruct %v4float %53 %53 %53 %53 + OpStore %x_GLF_color %54 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..39a800e03b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.spvasm.expected.wgsl @@ -0,0 +1,41 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + a = -7563; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_26 : i32 = a; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + if (((x_25 / x_26) == x_29)) { + let x_35 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_44 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_35), f32(x_38), f32(x_41), f32(x_44)); + } else { + let x_48 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_49 : f32 = f32(x_48); + x_GLF_color = vec4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl new file mode 100644 index 0000000000..39a800e03b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl @@ -0,0 +1,41 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + a = -7563; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_26 : i32 = a; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + if (((x_25 / x_26) == x_29)) { + let x_35 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_44 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_35), f32(x_38), f32(x_41), f32(x_44)); + } else { + let x_48 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_49 : f32 = f32(x_48); + x_GLF_color = vec4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..89c814d635 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.hlsl @@ -0,0 +1,42 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + a = -7563; + const int x_25 = asint(x_6[1].x); + const int x_26 = a; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if (((x_25 / x_26) == x_29)) { + const int x_35 = asint(x_6[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_41 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_44 = asint(x_6[1].x); + x_GLF_color = float4(float(x_35), float(x_38), float(x_41), float(x_44)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_48 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_49 = float(x_48); + x_GLF_color = float4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d98099cc37 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + a = -7563; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_26 = a; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[0].el; + if (((x_25 / x_26) == x_29)) { + int const x_35 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_41 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_44 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_35), float(x_38), float(x_41), float(x_44)); + } else { + int const x_48 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_49 = float(x_48); + *(tint_symbol_4) = float4(x_49, x_49, x_49, x_49); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b52f8c5733 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.spvasm @@ -0,0 +1,109 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_n7563 = OpConstant %int -7563 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + OpStore %a %int_n7563 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + %28 = OpLoad %int %a + %30 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpSDiv %int %27 %28 + %33 = OpIEqual %bool %32 %31 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %37 + %36 = OpLabel + %38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %39 = OpLoad %int %38 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %39 + %47 = OpConvertSToF %float %41 + %48 = OpConvertSToF %float %43 + %49 = OpConvertSToF %float %45 + %50 = OpCompositeConstruct %v4float %46 %47 %48 %49 + OpStore %x_GLF_color %50 + OpBranch %35 + %37 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpCompositeConstruct %v4float %53 %53 %53 %53 + OpStore %x_GLF_color %54 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..39a800e03b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-rcp-negative-int/0-opt.wgsl.expected.wgsl @@ -0,0 +1,41 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + a = -7563; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_26 : i32 = a; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[0]; + if (((x_25 / x_26) == x_29)) { + let x_35 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_44 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_35), f32(x_38), f32(x_41), f32(x_44)); + } else { + let x_48 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_49 : f32 = f32(x_48); + x_GLF_color = vec4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm new file mode 100644 index 0000000000..77a1f1132c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm @@ -0,0 +1,76 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_n1 = OpConstant %int -1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %9 + %23 = OpLabel + %a = OpVariable %_ptr_Function_int Function + OpStore %a %int_n1 + %24 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %25 = OpLoad %int %24 + %26 = OpLoad %int %a + %27 = OpSDiv %int %25 %26 + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %29 = OpLoad %int %28 + %30 = OpSLessThan %bool %27 %29 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %35 = OpLoad %int %34 + %36 = OpConvertSToF %float %35 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpConvertSToF %float %38 + %40 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpConvertSToF %float %41 + %43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpConvertSToF %float %44 + %46 = OpCompositeConstruct %v4float %36 %39 %42 %45 + OpStore %_GLF_color %46 + OpBranch %31 + %33 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %48 + %50 = OpCompositeConstruct %v4float %49 %49 %49 %49 + OpStore %_GLF_color %50 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..979542d35b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.hlsl @@ -0,0 +1,41 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + a = -1; + const int x_25 = asint(x_6[1].x); + const int x_26 = a; + const int x_29 = asint(x_6[1].x); + if (((x_25 / x_26) < x_29)) { + const int x_35 = asint(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_41 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_44 = asint(x_6[1].x); + x_GLF_color = float4(float(x_35), float(x_38), float(x_41), float(x_44)); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_48 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_49 = float(x_48); + x_GLF_color = float4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..7130ddf842 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + a = -1; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_26 = a; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[1].el; + if (((x_25 / x_26) < x_29)) { + int const x_35 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_41 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_44 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_35), float(x_38), float(x_41), float(x_44)); + } else { + int const x_48 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_49 = float(x_48); + *(tint_symbol_4) = float4(x_49, x_49, x_49, x_49); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..83487edc69 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.spvasm @@ -0,0 +1,109 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_n1 = OpConstant %int -1 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + OpStore %a %int_n1 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + %28 = OpLoad %int %a + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %30 = OpLoad %int %29 + %31 = OpSDiv %int %27 %28 + %32 = OpSLessThan %bool %31 %30 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %38 = OpLoad %int %37 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %38 + %47 = OpConvertSToF %float %41 + %48 = OpConvertSToF %float %43 + %49 = OpConvertSToF %float %45 + %50 = OpCompositeConstruct %v4float %46 %47 %48 %49 + OpStore %x_GLF_color %50 + OpBranch %34 + %36 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpCompositeConstruct %v4float %53 %53 %53 %53 + OpStore %x_GLF_color %54 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..6c4550f615 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.spvasm.expected.wgsl @@ -0,0 +1,41 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + a = -1; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_26 : i32 = a; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[1]; + if (((x_25 / x_26) < x_29)) { + let x_35 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_44 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_35), f32(x_38), f32(x_41), f32(x_44)); + } else { + let x_48 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_49 : f32 = f32(x_48); + x_GLF_color = vec4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl new file mode 100644 index 0000000000..6c4550f615 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl @@ -0,0 +1,41 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + a = -1; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_26 : i32 = a; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[1]; + if (((x_25 / x_26) < x_29)) { + let x_35 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_44 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_35), f32(x_38), f32(x_41), f32(x_44)); + } else { + let x_48 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_49 : f32 = f32(x_48); + x_GLF_color = vec4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..979542d35b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + a = -1; + const int x_25 = asint(x_6[1].x); + const int x_26 = a; + const int x_29 = asint(x_6[1].x); + if (((x_25 / x_26) < x_29)) { + const int x_35 = asint(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_41 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_44 = asint(x_6[1].x); + x_GLF_color = float4(float(x_35), float(x_38), float(x_41), float(x_44)); + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_48 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_49 = float(x_48); + x_GLF_color = float4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..7130ddf842 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + a = -1; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_26 = a; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[1].el; + if (((x_25 / x_26) < x_29)) { + int const x_35 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_41 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_44 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_35), float(x_38), float(x_41), float(x_44)); + } else { + int const x_48 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_49 = float(x_48); + *(tint_symbol_4) = float4(x_49, x_49, x_49, x_49); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..83487edc69 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.spvasm @@ -0,0 +1,109 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_n1 = OpConstant %int -1 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + OpStore %a %int_n1 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + %28 = OpLoad %int %a + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %30 = OpLoad %int %29 + %31 = OpSDiv %int %27 %28 + %32 = OpSLessThan %bool %31 %30 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %38 = OpLoad %int %37 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %38 + %47 = OpConvertSToF %float %41 + %48 = OpConvertSToF %float %43 + %49 = OpConvertSToF %float %45 + %50 = OpCompositeConstruct %v4float %46 %47 %48 %49 + OpStore %x_GLF_color %50 + OpBranch %34 + %36 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpCompositeConstruct %v4float %53 %53 %53 %53 + OpStore %x_GLF_color %54 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..6c4550f615 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reciprocal-var-minus-one/0-opt.wgsl.expected.wgsl @@ -0,0 +1,41 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + a = -1; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_26 : i32 = a; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[1]; + if (((x_25 / x_26) < x_29)) { + let x_35 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_44 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_35), f32(x_38), f32(x_41), f32(x_44)); + } else { + let x_48 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_49 : f32 = f32(x_48); + x_GLF_color = vec4(x_49, x_49, x_49, x_49); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm new file mode 100644 index 0000000000..f2c8e23544 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm @@ -0,0 +1,86 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_0 = OpConstant %int 0 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %30 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1 + %main = OpFunction %void None %12 + %32 = OpLabel + %9 = OpVariable %_ptr_Function__arr_int_uint_1 Function + %33 = OpLoad %_arr_int_uint_1 %9 + %6 = OpCompositeExtract %int %33 0 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + OpStore %_GLF_color %22 + %38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %7 = OpLoad %int %38 + %39 = OpAccessChain %_ptr_Function_int %9 %7 + %8 = OpLoad %int %39 + %40 = OpIEqual %bool %8 %6 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + OpBranch %35 + %41 = OpLabel + OpBranch %35 + %36 = OpLabel + OpBranch %34 + %35 = OpLabel + %10 = OpPhi %int %int_1 %42 %int_2 %41 + %43 = OpIEqual %bool %10 %int_1 + %44 = OpIEqual %bool %10 %int_2 + %45 = OpLogicalOr %bool %43 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %48 = OpLabel + OpStore %_GLF_color %22 + OpBranch %46 + %47 = OpLabel + OpStore %_GLF_color %30 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..2c7bb9e268 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.hlsl @@ -0,0 +1,46 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + int x_9[1] = (int[1])0; + int x_10_phi = 0; + const int x_6 = x_9[0u]; + while (true) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const int x_7 = asint(x_5[0].x); + const int x_8 = x_9[x_7]; + if ((x_8 == x_6)) { + x_10_phi = 1; + break; + } + x_10_phi = 2; + break; + } + const int x_10 = x_10_phi; + bool tint_tmp = (x_10 == 1); + if (!tint_tmp) { + tint_tmp = (x_10 == 2); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.msl new file mode 100644 index 0000000000..fc24e78cd9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct tint_array_wrapper { + int arr[1]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + tint_array_wrapper x_9 = {}; + int x_10_phi = 0; + tint_array_wrapper const x_33 = x_9; + int const x_6 = x_33.arr[0u]; + while (true) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + int const x_7 = x_5.zero; + int const x_8 = x_9.arr[x_7]; + if ((x_8 == x_6)) { + x_10_phi = 1; + break; + } + x_10_phi = 2; + break; + } + int const x_10 = x_10_phi; + if (((x_10 == 1) || (x_10 == 2))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..e24ad6d14a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.spvasm @@ -0,0 +1,124 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_9 "x_9" + OpName %x_10_phi "x_10_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_1 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 +%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1 + %21 = OpConstantNull %_arr_int_uint_1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %55 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %56 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_9 = OpVariable %_ptr_Function__arr_int_uint_1 Function %21 + %x_10_phi = OpVariable %_ptr_Function_int Function %24 + %25 = OpLoad %_arr_int_uint_1 %x_9 + %27 = OpCompositeExtract %int %25 0 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + OpStore %x_GLF_color %33 + %35 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %36 = OpLoad %int %35 + %37 = OpAccessChain %_ptr_Function_int %x_9 %36 + %38 = OpLoad %int %37 + %39 = OpIEqual %bool %38 %27 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %41 + %42 = OpLabel + OpStore %x_10_phi %int_1 + OpBranch %29 + %41 = OpLabel + OpStore %x_10_phi %int_2 + OpBranch %29 + %30 = OpLabel + OpBranch %28 + %29 = OpLabel + %45 = OpLoad %int %x_10_phi + %46 = OpIEqual %bool %45 %int_1 + OpSelectionMerge %47 None + OpBranchConditional %46 %47 %48 + %48 = OpLabel + %49 = OpIEqual %bool %45 %int_2 + OpBranch %47 + %47 = OpLabel + %50 = OpPhi %bool %46 %29 %49 %48 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %51 + %53 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %56 +%tint_symbol = OpFunctionParameter %main_out + %60 = OpLabel + %61 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %61 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %63 = OpLabel + %64 = OpFunctionCall %void %main_1 + %66 = OpLoad %v4float %x_GLF_color + %67 = OpCompositeConstruct %main_out %66 + %65 = OpFunctionCall %void %tint_symbol_2 %67 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..d5ebd09d92 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.spvasm.expected.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_9 : array; + var x_10_phi : i32; + let x_33 : array = x_9; + let x_6 : i32 = x_33[0u]; + loop { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_7 : i32 = x_5.zero; + let x_8 : i32 = x_9[x_7]; + if ((x_8 == x_6)) { + x_10_phi = 1; + break; + } + x_10_phi = 2; + break; + } + let x_10 : i32 = x_10_phi; + if (((x_10 == 1) || (x_10 == 2))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl new file mode 100644 index 0000000000..d5ebd09d92 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_9 : array; + var x_10_phi : i32; + let x_33 : array = x_9; + let x_6 : i32 = x_33[0u]; + loop { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_7 : i32 = x_5.zero; + let x_8 : i32 = x_9[x_7]; + if ((x_8 == x_6)) { + x_10_phi = 1; + break; + } + x_10_phi = 2; + break; + } + let x_10 : i32 = x_10_phi; + if (((x_10 == 1) || (x_10 == 2))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..2c7bb9e268 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + int x_9[1] = (int[1])0; + int x_10_phi = 0; + const int x_6 = x_9[0u]; + while (true) { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const int x_7 = asint(x_5[0].x); + const int x_8 = x_9[x_7]; + if ((x_8 == x_6)) { + x_10_phi = 1; + break; + } + x_10_phi = 2; + break; + } + const int x_10 = x_10_phi; + bool tint_tmp = (x_10 == 1); + if (!tint_tmp) { + tint_tmp = (x_10 == 2); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.msl new file mode 100644 index 0000000000..fc24e78cd9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct tint_array_wrapper { + int arr[1]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + tint_array_wrapper x_9 = {}; + int x_10_phi = 0; + tint_array_wrapper const x_33 = x_9; + int const x_6 = x_33.arr[0u]; + while (true) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + int const x_7 = x_5.zero; + int const x_8 = x_9.arr[x_7]; + if ((x_8 == x_6)) { + x_10_phi = 1; + break; + } + x_10_phi = 2; + break; + } + int const x_10 = x_10_phi; + if (((x_10 == 1) || (x_10 == 2))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..e24ad6d14a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.spvasm @@ -0,0 +1,124 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_9 "x_9" + OpName %x_10_phi "x_10_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_1 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 +%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1 + %21 = OpConstantNull %_arr_int_uint_1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %55 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %56 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_9 = OpVariable %_ptr_Function__arr_int_uint_1 Function %21 + %x_10_phi = OpVariable %_ptr_Function_int Function %24 + %25 = OpLoad %_arr_int_uint_1 %x_9 + %27 = OpCompositeExtract %int %25 0 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + OpStore %x_GLF_color %33 + %35 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %36 = OpLoad %int %35 + %37 = OpAccessChain %_ptr_Function_int %x_9 %36 + %38 = OpLoad %int %37 + %39 = OpIEqual %bool %38 %27 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %41 + %42 = OpLabel + OpStore %x_10_phi %int_1 + OpBranch %29 + %41 = OpLabel + OpStore %x_10_phi %int_2 + OpBranch %29 + %30 = OpLabel + OpBranch %28 + %29 = OpLabel + %45 = OpLoad %int %x_10_phi + %46 = OpIEqual %bool %45 %int_1 + OpSelectionMerge %47 None + OpBranchConditional %46 %47 %48 + %48 = OpLabel + %49 = OpIEqual %bool %45 %int_2 + OpBranch %47 + %47 = OpLabel + %50 = OpPhi %bool %46 %29 %49 %48 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpStore %x_GLF_color %55 + OpBranch %51 + %53 = OpLabel + OpStore %x_GLF_color %33 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %56 +%tint_symbol = OpFunctionParameter %main_out + %60 = OpLabel + %61 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %61 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %63 = OpLabel + %64 = OpFunctionCall %void %main_1 + %66 = OpLoad %v4float %x_GLF_color + %67 = OpCompositeConstruct %main_out %66 + %65 = OpFunctionCall %void %tint_symbol_2 %67 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..d5ebd09d92 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-array-replace-extract/0.wgsl.expected.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_9 : array; + var x_10_phi : i32; + let x_33 : array = x_9; + let x_6 : i32 = x_33[0u]; + loop { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_7 : i32 = x_5.zero; + let x_8 : i32 = x_9[x_7]; + if ((x_8 == x_6)) { + x_10_phi = 1; + break; + } + x_10_phi = 2; + break; + } + let x_10 : i32 = x_10_phi; + if (((x_10 == 1) || (x_10 == 2))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm new file mode 100644 index 0000000000..8767ee31f8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm @@ -0,0 +1,120 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %S "S" + OpMemberName %S 0 "x" + OpMemberName %S 1 "y" + OpName %func_struct_S_i1_i11_ "func(struct-S-i1-i11;" + OpName %arg "arg" + OpName %a "a" + OpName %b "b" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int %int +%_ptr_Function_S = OpTypePointer Function %S + %16 = OpTypeFunction %void %_ptr_Function_S + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_5 = OpConstant %float 5 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_S_uint_2 = OpTypeArray %S %uint_2 +%_ptr_Function__arr_S_uint_2 = OpTypePointer Function %_arr_S_uint_2 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %35 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %36 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %13 + %37 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %b = OpVariable %_ptr_Function__arr_S_uint_2 Function + %param = OpVariable %_ptr_Function_S Function + OpStore %a %float_5 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Function_int %b %43 %int_0 + OpStore %44 %int_1 + %45 = OpAccessChain %_ptr_Function_int %b %int_1 %int_0 + %46 = OpLoad %int %45 + %47 = OpIEqual %bool %46 %int_1 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %51 = OpLoad %int %50 + %52 = OpIEqual %bool %51 %int_1 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + OpBranch %39 + %53 = OpLabel + %55 = OpAccessChain %_ptr_Function_S %b %int_1 + %56 = OpLoad %S %55 + OpStore %param %56 + %57 = OpFunctionCall %void %func_struct_S_i1_i11_ %param + %58 = OpLoad %S %param + %59 = OpAccessChain %_ptr_Function_S %b %int_1 + OpStore %59 %58 + %60 = OpAccessChain %_ptr_Function_int %b %int_1 %int_1 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %61 + OpStore %a %62 + OpBranch %48 + %48 = OpLabel + OpStore %a %float_0 + OpBranch %40 + %40 = OpLabel + OpBranchConditional %false %38 %39 + %39 = OpLabel + %63 = OpLoad %float %a + %64 = OpFOrdEqual %bool %63 %float_5 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %67 + %66 = OpLabel + OpStore %_GLF_color %35 + OpBranch %65 + %67 = OpLabel + OpStore %_GLF_color %36 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +%func_struct_S_i1_i11_ = OpFunction %void None %16 + %arg = OpFunctionParameter %_ptr_Function_S + %68 = OpLabel + %69 = OpAccessChain %_ptr_Function_int %arg %int_1 + OpStore %69 %int_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..0adcd37916 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.hlsl @@ -0,0 +1,65 @@ +struct S { + int x; + int y; +}; + +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_struct_S_i1_i11_(inout S arg) { + arg.y = 1; + return; +} + +void main_1() { + float a = 0.0f; + S b[2] = (S[2])0; + S param = (S)0; + a = 5.0f; + while (true) { + const int x_43 = asint(x_10[0].x); + b[x_43].x = 1; + const int x_46 = b[1].x; + if ((x_46 == 1)) { + const int x_51 = asint(x_10[0].x); + if ((x_51 == 1)) { + break; + } + const S x_56 = b[1]; + param = x_56; + func_struct_S_i1_i11_(param); + b[1] = param; + const int x_61 = b[1].y; + a = float(x_61); + } + a = 0.0f; + { + if (false) { + } else { + break; + } + } + } + if ((a == 5.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a0d65d8387 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.msl @@ -0,0 +1,72 @@ +#include + +using namespace metal; +struct S { + int x; + int y; +}; +struct buf0 { + /* 0x0000 */ int one; +}; +struct tint_array_wrapper { + S arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_struct_S_i1_i11_(thread S* const arg) { + (*(arg)).y = 1; + return; +} + +void main_1(constant buf0& x_10, thread float4* const tint_symbol_4) { + float a = 0.0f; + tint_array_wrapper b = {}; + S param = {}; + a = 5.0f; + while (true) { + int const x_43 = x_10.one; + b.arr[x_43].x = 1; + int const x_46 = b.arr[1].x; + if ((x_46 == 1)) { + int const x_51 = x_10.one; + if ((x_51 == 1)) { + break; + } + S const x_56 = b.arr[1]; + param = x_56; + func_struct_S_i1_i11_(&(param)); + S const x_58 = param; + b.arr[1] = x_58; + int const x_61 = b.arr[1].y; + a = float(x_61); + } + a = 0.0f; + { + if (false) { + } else { + break; + } + } + } + float const x_63 = a; + if ((x_63 == 5.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..5969228bd2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.spvasm @@ -0,0 +1,170 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 93 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %S "S" + OpMemberName %S 0 "x" + OpMemberName %S 1 "y" + OpName %func_struct_S_i1_i11_ "func_struct_S_i1_i11_" + OpName %arg "arg" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpDecorate %_arr_S_uint_2 ArrayStride 8 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %S = OpTypeStruct %int %int +%_ptr_Function_S = OpTypePointer Function %S + %12 = OpTypeFunction %void %_ptr_Function_S + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %25 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %30 = OpConstantNull %float + %uint_2 = OpConstant %uint 2 +%_arr_S_uint_2 = OpTypeArray %S %uint_2 +%_ptr_Function__arr_S_uint_2 = OpTypePointer Function %_arr_S_uint_2 + %35 = OpConstantNull %_arr_S_uint_2 + %37 = OpConstantNull %S + %float_5 = OpConstant %float 5 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %float_1 = OpConstant %float 1 + %79 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %80 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %81 = OpTypeFunction %void %main_out +%func_struct_S_i1_i11_ = OpFunction %void None %12 + %arg = OpFunctionParameter %_ptr_Function_S + %18 = OpLabel + %23 = OpAccessChain %_ptr_Function_int %arg %uint_1 + OpStore %23 %int_1 + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %25 + %27 = OpLabel + %a = OpVariable %_ptr_Function_float Function %30 + %b = OpVariable %_ptr_Function__arr_S_uint_2 Function %35 + %param = OpVariable %_ptr_Function_S Function %37 + OpStore %a %float_5 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Function_int %b %46 %uint_0 + OpStore %47 %int_1 + %48 = OpAccessChain %_ptr_Function_int %b %int_1 %uint_0 + %49 = OpLoad %int %48 + %50 = OpIEqual %bool %49 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %50 %53 %52 + %53 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 + %55 = OpLoad %int %54 + %56 = OpIEqual %bool %55 %int_1 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + OpBranch %40 + %57 = OpLabel + %59 = OpAccessChain %_ptr_Function_S %b %int_1 + %60 = OpLoad %S %59 + OpStore %param %60 + %61 = OpFunctionCall %void %func_struct_S_i1_i11_ %param + %63 = OpLoad %S %param + %64 = OpAccessChain %_ptr_Function_S %b %int_1 + OpStore %64 %63 + %65 = OpAccessChain %_ptr_Function_int %b %int_1 %uint_1 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + OpStore %a %67 + OpBranch %52 + %52 = OpLabel + OpStore %a %float_0 + OpBranch %41 + %41 = OpLabel + OpSelectionMerge %70 None + OpBranchConditional %false %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %40 + %70 = OpLabel + OpBranch %39 + %40 = OpLabel + %73 = OpLoad %float %a + %74 = OpFOrdEqual %bool %73 %float_5 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpStore %x_GLF_color %79 + OpBranch %75 + %77 = OpLabel + OpStore %x_GLF_color %80 + OpBranch %75 + %75 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %81 +%tint_symbol = OpFunctionParameter %main_out + %85 = OpLabel + %86 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %86 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %25 + %88 = OpLabel + %89 = OpFunctionCall %void %main_1 + %91 = OpLoad %v4float %x_GLF_color + %92 = OpCompositeConstruct %main_out %91 + %90 = OpFunctionCall %void %tint_symbol_2 %92 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 41[%41] is not post dominated by the back-edge block 70[%70] + %70 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..779fafcc6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.spvasm.expected.wgsl @@ -0,0 +1,69 @@ +struct S { + x : i32; + y : i32; +}; + +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i1_i11_(arg : ptr) { + (*(arg)).y = 1; + return; +} + +fn main_1() { + var a : f32; + var b : array; + var param : S; + a = 5.0; + loop { + let x_43 : i32 = x_10.one; + b[x_43].x = 1; + let x_46 : i32 = b[1].x; + if ((x_46 == 1)) { + let x_51 : i32 = x_10.one; + if ((x_51 == 1)) { + break; + } + let x_56 : S = b[1]; + param = x_56; + func_struct_S_i1_i11_(&(param)); + let x_58 : S = param; + b[1] = x_58; + let x_61 : i32 = b[1].y; + a = f32(x_61); + } + a = 0.0; + + continuing { + if (false) { + } else { + break; + } + } + } + let x_63 : f32 = a; + if ((x_63 == 5.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl new file mode 100644 index 0000000000..779fafcc6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl @@ -0,0 +1,69 @@ +struct S { + x : i32; + y : i32; +}; + +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i1_i11_(arg : ptr) { + (*(arg)).y = 1; + return; +} + +fn main_1() { + var a : f32; + var b : array; + var param : S; + a = 5.0; + loop { + let x_43 : i32 = x_10.one; + b[x_43].x = 1; + let x_46 : i32 = b[1].x; + if ((x_46 == 1)) { + let x_51 : i32 = x_10.one; + if ((x_51 == 1)) { + break; + } + let x_56 : S = b[1]; + param = x_56; + func_struct_S_i1_i11_(&(param)); + let x_58 : S = param; + b[1] = x_58; + let x_61 : i32 = b[1].y; + a = f32(x_61); + } + a = 0.0; + + continuing { + if (false) { + } else { + break; + } + } + } + let x_63 : f32 = a; + if ((x_63 == 5.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..0adcd37916 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.hlsl @@ -0,0 +1,65 @@ +struct S { + int x; + int y; +}; + +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_struct_S_i1_i11_(inout S arg) { + arg.y = 1; + return; +} + +void main_1() { + float a = 0.0f; + S b[2] = (S[2])0; + S param = (S)0; + a = 5.0f; + while (true) { + const int x_43 = asint(x_10[0].x); + b[x_43].x = 1; + const int x_46 = b[1].x; + if ((x_46 == 1)) { + const int x_51 = asint(x_10[0].x); + if ((x_51 == 1)) { + break; + } + const S x_56 = b[1]; + param = x_56; + func_struct_S_i1_i11_(param); + b[1] = param; + const int x_61 = b[1].y; + a = float(x_61); + } + a = 0.0f; + { + if (false) { + } else { + break; + } + } + } + if ((a == 5.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a0d65d8387 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.msl @@ -0,0 +1,72 @@ +#include + +using namespace metal; +struct S { + int x; + int y; +}; +struct buf0 { + /* 0x0000 */ int one; +}; +struct tint_array_wrapper { + S arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_struct_S_i1_i11_(thread S* const arg) { + (*(arg)).y = 1; + return; +} + +void main_1(constant buf0& x_10, thread float4* const tint_symbol_4) { + float a = 0.0f; + tint_array_wrapper b = {}; + S param = {}; + a = 5.0f; + while (true) { + int const x_43 = x_10.one; + b.arr[x_43].x = 1; + int const x_46 = b.arr[1].x; + if ((x_46 == 1)) { + int const x_51 = x_10.one; + if ((x_51 == 1)) { + break; + } + S const x_56 = b.arr[1]; + param = x_56; + func_struct_S_i1_i11_(&(param)); + S const x_58 = param; + b.arr[1] = x_58; + int const x_61 = b.arr[1].y; + a = float(x_61); + } + a = 0.0f; + { + if (false) { + } else { + break; + } + } + } + float const x_63 = a; + if ((x_63 == 5.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5969228bd2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.spvasm @@ -0,0 +1,170 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 93 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %S "S" + OpMemberName %S 0 "x" + OpMemberName %S 1 "y" + OpName %func_struct_S_i1_i11_ "func_struct_S_i1_i11_" + OpName %arg "arg" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpDecorate %_arr_S_uint_2 ArrayStride 8 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %S = OpTypeStruct %int %int +%_ptr_Function_S = OpTypePointer Function %S + %12 = OpTypeFunction %void %_ptr_Function_S + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %25 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %30 = OpConstantNull %float + %uint_2 = OpConstant %uint 2 +%_arr_S_uint_2 = OpTypeArray %S %uint_2 +%_ptr_Function__arr_S_uint_2 = OpTypePointer Function %_arr_S_uint_2 + %35 = OpConstantNull %_arr_S_uint_2 + %37 = OpConstantNull %S + %float_5 = OpConstant %float 5 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %float_1 = OpConstant %float 1 + %79 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %80 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %81 = OpTypeFunction %void %main_out +%func_struct_S_i1_i11_ = OpFunction %void None %12 + %arg = OpFunctionParameter %_ptr_Function_S + %18 = OpLabel + %23 = OpAccessChain %_ptr_Function_int %arg %uint_1 + OpStore %23 %int_1 + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %25 + %27 = OpLabel + %a = OpVariable %_ptr_Function_float Function %30 + %b = OpVariable %_ptr_Function__arr_S_uint_2 Function %35 + %param = OpVariable %_ptr_Function_S Function %37 + OpStore %a %float_5 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Function_int %b %46 %uint_0 + OpStore %47 %int_1 + %48 = OpAccessChain %_ptr_Function_int %b %int_1 %uint_0 + %49 = OpLoad %int %48 + %50 = OpIEqual %bool %49 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %50 %53 %52 + %53 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 + %55 = OpLoad %int %54 + %56 = OpIEqual %bool %55 %int_1 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + OpBranch %40 + %57 = OpLabel + %59 = OpAccessChain %_ptr_Function_S %b %int_1 + %60 = OpLoad %S %59 + OpStore %param %60 + %61 = OpFunctionCall %void %func_struct_S_i1_i11_ %param + %63 = OpLoad %S %param + %64 = OpAccessChain %_ptr_Function_S %b %int_1 + OpStore %64 %63 + %65 = OpAccessChain %_ptr_Function_int %b %int_1 %uint_1 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + OpStore %a %67 + OpBranch %52 + %52 = OpLabel + OpStore %a %float_0 + OpBranch %41 + %41 = OpLabel + OpSelectionMerge %70 None + OpBranchConditional %false %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %40 + %70 = OpLabel + OpBranch %39 + %40 = OpLabel + %73 = OpLoad %float %a + %74 = OpFOrdEqual %bool %73 %float_5 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpStore %x_GLF_color %79 + OpBranch %75 + %77 = OpLabel + OpStore %x_GLF_color %80 + OpBranch %75 + %75 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %81 +%tint_symbol = OpFunctionParameter %main_out + %85 = OpLabel + %86 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %86 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %25 + %88 = OpLabel + %89 = OpFunctionCall %void %main_1 + %91 = OpLoad %v4float %x_GLF_color + %92 = OpCompositeConstruct %main_out %91 + %90 = OpFunctionCall %void %tint_symbol_2 %92 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 41[%41] is not post dominated by the back-edge block 70[%70] + %70 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..779fafcc6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reduce-load-replace-extract/0-opt.wgsl.expected.wgsl @@ -0,0 +1,69 @@ +struct S { + x : i32; + y : i32; +}; + +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i1_i11_(arg : ptr) { + (*(arg)).y = 1; + return; +} + +fn main_1() { + var a : f32; + var b : array; + var param : S; + a = 5.0; + loop { + let x_43 : i32 = x_10.one; + b[x_43].x = 1; + let x_46 : i32 = b[1].x; + if ((x_46 == 1)) { + let x_51 : i32 = x_10.one; + if ((x_51 == 1)) { + break; + } + let x_56 : S = b[1]; + param = x_56; + func_struct_S_i1_i11_(&(param)); + let x_58 : S = param; + b[1] = x_58; + let x_61 : i32 = b[1].y; + a = f32(x_61); + } + a = 0.0; + + continuing { + if (false) { + } else { + break; + } + } + } + let x_63 : f32 = a; + if ((x_63 == 5.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm new file mode 100644 index 0000000000..61ce7ed191 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm @@ -0,0 +1,140 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_v1 + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %j "j" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_v1 "_GLF_v1" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_v1 Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_v1 = OpVariable %_ptr_Output_v4float Output + %int_2 = OpConstant %int 2 + %main = OpFunction %void None %14 + %34 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %36 = OpLoad %int %35 + OpStore %i %36 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpSLessThan %bool %41 %43 + OpBranchConditional %44 %45 %38 + %45 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %49 = OpLoad %float %48 + %50 = OpFOrdGreaterThan %bool %47 %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + OpKill + %51 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %54 = OpLoad %int %53 + OpStore %j %54 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %int %j + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpSLessThan %bool %59 %61 + OpBranchConditional %62 %63 %56 + %63 = OpLabel + %64 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %67 = OpLoad %float %66 + %68 = OpFOrdLessThan %bool %65 %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + OpKill + %69 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %72 + %74 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpConvertSToF %float %78 + %80 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %81 + %83 = OpCompositeConstruct %v4float %73 %76 %79 %82 + OpStore %_GLF_v1 %83 + OpBranch %57 + %57 = OpLabel + %84 = OpLoad %int %j + %85 = OpIAdd %int %84 %int_1 + OpStore %j %85 + OpBranch %55 + %56 = OpLabel + OpBranch %39 + %39 = OpLabel + %86 = OpLoad %int %i + %87 = OpIAdd %int %86 %int_1 + OpStore %i %87 + OpBranch %37 + %38 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..59e50ef564 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.hlsl @@ -0,0 +1,78 @@ +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[3]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int j = 0; + const int x_36 = asint(x_7[1].x); + i = x_36; + while (true) { + const int x_41 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_43 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_41 < x_43)) { + } else { + break; + } + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_49 = asfloat(x_9[1].x); + if ((x_47 > x_49)) { + discard; + } + const int x_54 = asint(x_7[1].x); + j = x_54; + while (true) { + const int x_59 = j; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_61 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_59 < x_61)) { + } else { + break; + } + const float x_65 = gl_FragCoord.x; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_67 = asfloat(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_65 < x_67)) { + discard; + } + const int x_72 = asint(x_7[2].x); + const int x_75 = asint(x_7[1].x); + const int x_78 = asint(x_7[1].x); + const int x_81 = asint(x_7[2].x); + x_GLF_v1 = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + { + j = (j + 1); + } + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_v1_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_v1_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_v1}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_v1_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a59c60d6d2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.msl @@ -0,0 +1,89 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_v1_1; +}; +struct tint_symbol_2 { + float4 x_GLF_v1_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + int j = 0; + int const x_36 = x_7.x_GLF_uniform_int_values.arr[1].el; + i = x_36; + while (true) { + int const x_41 = i; + int const x_43 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_41 < x_43)) { + } else { + break; + } + float const x_47 = x_9.x_GLF_uniform_float_values.arr[0].el; + float const x_49 = x_9.x_GLF_uniform_float_values.arr[1].el; + if ((x_47 > x_49)) { + discard_fragment(); + } + int const x_54 = x_7.x_GLF_uniform_int_values.arr[1].el; + j = x_54; + while (true) { + int const x_59 = j; + int const x_61 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_59 < x_61)) { + } else { + break; + } + float const x_65 = (*(tint_symbol_5)).x; + float const x_67 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_65 < x_67)) { + discard_fragment(); + } + int const x_72 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_75 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_81 = x_7.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_6) = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + { + int const x_84 = j; + j = (x_84 + 1); + } + } + { + int const x_86 = i; + i = (x_86 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_9, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_v1_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_v1_1=tint_symbol_3.x_GLF_v1_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..7d4d31d33e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.spvasm @@ -0,0 +1,187 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 109 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_v1 "x_GLF_v1" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_v1_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 + %x_GLF_v1 = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_float = OpTypePointer Private %float + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %96 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %i = OpVariable %_ptr_Function_int Function %29 + %j = OpVariable %_ptr_Function_int Function %29 + %34 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %35 = OpLoad %int %34 + OpStore %i %35 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpSLessThan %bool %40 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %37 + %46 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %51 = OpLoad %float %50 + %52 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpFOrdGreaterThan %bool %51 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + OpKill + %55 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %58 = OpLoad %int %57 + OpStore %j %58 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %int %j + %64 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %65 = OpLoad %int %64 + %66 = OpSLessThan %bool %63 %65 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %60 + %67 = OpLabel + %71 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %74 = OpLoad %float %73 + %75 = OpFOrdLessThan %bool %72 %74 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %76 + %77 = OpLabel + OpKill + %76 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %80 + %88 = OpConvertSToF %float %82 + %89 = OpConvertSToF %float %84 + %90 = OpConvertSToF %float %86 + %91 = OpCompositeConstruct %v4float %87 %88 %89 %90 + OpStore %x_GLF_v1 %91 + OpBranch %61 + %61 = OpLabel + %92 = OpLoad %int %j + %93 = OpIAdd %int %92 %int_1 + OpStore %j %93 + OpBranch %59 + %60 = OpLabel + OpBranch %38 + %38 = OpLabel + %94 = OpLoad %int %i + %95 = OpIAdd %int %94 %int_1 + OpStore %i %95 + OpBranch %36 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %96 +%tint_symbol_1 = OpFunctionParameter %main_out + %100 = OpLabel + %101 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %101 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %103 = OpLabel + %104 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %104 + %105 = OpFunctionCall %void %main_1 + %107 = OpLoad %v4float %x_GLF_v1 + %108 = OpCompositeConstruct %main_out %107 + %106 = OpFunctionCall %void %tint_symbol_3 %108 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a5fd0d0a54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.spvasm.expected.wgsl @@ -0,0 +1,84 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_v1 : vec4; + +fn main_1() { + var i : i32; + var j : i32; + let x_36 : i32 = x_7.x_GLF_uniform_int_values[1]; + i = x_36; + loop { + let x_41 : i32 = i; + let x_43 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_41 < x_43)) { + } else { + break; + } + let x_47 : f32 = x_9.x_GLF_uniform_float_values[0]; + let x_49 : f32 = x_9.x_GLF_uniform_float_values[1]; + if ((x_47 > x_49)) { + discard; + } + let x_54 : i32 = x_7.x_GLF_uniform_int_values[1]; + j = x_54; + loop { + let x_59 : i32 = j; + let x_61 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_59 < x_61)) { + } else { + break; + } + let x_65 : f32 = gl_FragCoord.x; + let x_67 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_65 < x_67)) { + discard; + } + let x_72 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_75 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_7.x_GLF_uniform_int_values[2]; + x_GLF_v1 = vec4(f32(x_72), f32(x_75), f32(x_78), f32(x_81)); + + continuing { + let x_84 : i32 = j; + j = (x_84 + 1); + } + } + + continuing { + let x_86 : i32 = i; + i = (x_86 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_v1_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_v1); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl new file mode 100644 index 0000000000..a5fd0d0a54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl @@ -0,0 +1,84 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_v1 : vec4; + +fn main_1() { + var i : i32; + var j : i32; + let x_36 : i32 = x_7.x_GLF_uniform_int_values[1]; + i = x_36; + loop { + let x_41 : i32 = i; + let x_43 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_41 < x_43)) { + } else { + break; + } + let x_47 : f32 = x_9.x_GLF_uniform_float_values[0]; + let x_49 : f32 = x_9.x_GLF_uniform_float_values[1]; + if ((x_47 > x_49)) { + discard; + } + let x_54 : i32 = x_7.x_GLF_uniform_int_values[1]; + j = x_54; + loop { + let x_59 : i32 = j; + let x_61 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_59 < x_61)) { + } else { + break; + } + let x_65 : f32 = gl_FragCoord.x; + let x_67 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_65 < x_67)) { + discard; + } + let x_72 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_75 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_7.x_GLF_uniform_int_values[2]; + x_GLF_v1 = vec4(f32(x_72), f32(x_75), f32(x_78), f32(x_81)); + + continuing { + let x_84 : i32 = j; + j = (x_84 + 1); + } + } + + continuing { + let x_86 : i32 = i; + i = (x_86 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_v1_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_v1); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..59e50ef564 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.hlsl @@ -0,0 +1,78 @@ +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[3]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_v1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int j = 0; + const int x_36 = asint(x_7[1].x); + i = x_36; + while (true) { + const int x_41 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_43 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_41 < x_43)) { + } else { + break; + } + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_49 = asfloat(x_9[1].x); + if ((x_47 > x_49)) { + discard; + } + const int x_54 = asint(x_7[1].x); + j = x_54; + while (true) { + const int x_59 = j; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_61 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_59 < x_61)) { + } else { + break; + } + const float x_65 = gl_FragCoord.x; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_67 = asfloat(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_65 < x_67)) { + discard; + } + const int x_72 = asint(x_7[2].x); + const int x_75 = asint(x_7[1].x); + const int x_78 = asint(x_7[1].x); + const int x_81 = asint(x_7[2].x); + x_GLF_v1 = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + { + j = (j + 1); + } + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_v1_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_v1_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_v1}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_v1_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a59c60d6d2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.msl @@ -0,0 +1,89 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_v1_1; +}; +struct tint_symbol_2 { + float4 x_GLF_v1_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + int j = 0; + int const x_36 = x_7.x_GLF_uniform_int_values.arr[1].el; + i = x_36; + while (true) { + int const x_41 = i; + int const x_43 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_41 < x_43)) { + } else { + break; + } + float const x_47 = x_9.x_GLF_uniform_float_values.arr[0].el; + float const x_49 = x_9.x_GLF_uniform_float_values.arr[1].el; + if ((x_47 > x_49)) { + discard_fragment(); + } + int const x_54 = x_7.x_GLF_uniform_int_values.arr[1].el; + j = x_54; + while (true) { + int const x_59 = j; + int const x_61 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_59 < x_61)) { + } else { + break; + } + float const x_65 = (*(tint_symbol_5)).x; + float const x_67 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_65 < x_67)) { + discard_fragment(); + } + int const x_72 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_75 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_81 = x_7.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_6) = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + { + int const x_84 = j; + j = (x_84 + 1); + } + } + { + int const x_86 = i; + i = (x_86 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_9, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_v1_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_v1_1=tint_symbol_3.x_GLF_v1_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..7d4d31d33e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.spvasm @@ -0,0 +1,187 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 109 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_v1 "x_GLF_v1" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_v1_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf1 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 + %x_GLF_v1 = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_float = OpTypePointer Private %float + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %96 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %i = OpVariable %_ptr_Function_int Function %29 + %j = OpVariable %_ptr_Function_int Function %29 + %34 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %35 = OpLoad %int %34 + OpStore %i %35 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpSLessThan %bool %40 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %37 + %46 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %51 = OpLoad %float %50 + %52 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpFOrdGreaterThan %bool %51 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + OpKill + %55 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %58 = OpLoad %int %57 + OpStore %j %58 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %int %j + %64 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %65 = OpLoad %int %64 + %66 = OpSLessThan %bool %63 %65 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %60 + %67 = OpLabel + %71 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %74 = OpLoad %float %73 + %75 = OpFOrdLessThan %bool %72 %74 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %76 + %77 = OpLabel + OpKill + %76 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %80 + %88 = OpConvertSToF %float %82 + %89 = OpConvertSToF %float %84 + %90 = OpConvertSToF %float %86 + %91 = OpCompositeConstruct %v4float %87 %88 %89 %90 + OpStore %x_GLF_v1 %91 + OpBranch %61 + %61 = OpLabel + %92 = OpLoad %int %j + %93 = OpIAdd %int %92 %int_1 + OpStore %j %93 + OpBranch %59 + %60 = OpLabel + OpBranch %38 + %38 = OpLabel + %94 = OpLoad %int %i + %95 = OpIAdd %int %94 %int_1 + OpStore %i %95 + OpBranch %36 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %96 +%tint_symbol_1 = OpFunctionParameter %main_out + %100 = OpLabel + %101 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %101 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %103 = OpLabel + %104 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %104 + %105 = OpFunctionCall %void %main_1 + %107 = OpLoad %v4float %x_GLF_v1 + %108 = OpCompositeConstruct %main_out %107 + %106 = OpFunctionCall %void %tint_symbol_3 %108 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a5fd0d0a54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-register-coalescer-live-intervals-target-instr-info-for-discard-for-discard/0-opt.wgsl.expected.wgsl @@ -0,0 +1,84 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_v1 : vec4; + +fn main_1() { + var i : i32; + var j : i32; + let x_36 : i32 = x_7.x_GLF_uniform_int_values[1]; + i = x_36; + loop { + let x_41 : i32 = i; + let x_43 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_41 < x_43)) { + } else { + break; + } + let x_47 : f32 = x_9.x_GLF_uniform_float_values[0]; + let x_49 : f32 = x_9.x_GLF_uniform_float_values[1]; + if ((x_47 > x_49)) { + discard; + } + let x_54 : i32 = x_7.x_GLF_uniform_int_values[1]; + j = x_54; + loop { + let x_59 : i32 = j; + let x_61 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_59 < x_61)) { + } else { + break; + } + let x_65 : f32 = gl_FragCoord.x; + let x_67 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_65 < x_67)) { + discard; + } + let x_72 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_75 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_7.x_GLF_uniform_int_values[2]; + x_GLF_v1 = vec4(f32(x_72), f32(x_75), f32(x_78), f32(x_81)); + + continuing { + let x_84 : i32 = j; + j = (x_84 + 1); + } + } + + continuing { + let x_86 : i32 = i; + i = (x_86 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_v1_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_v1); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm new file mode 100644 index 0000000000..5fc35193c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm @@ -0,0 +1,173 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %m "m" + OpName %f "f" + OpName %i "i" + OpName %j "j" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v2bool = OpTypeVector %bool 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %12 + %34 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2float Function + %f = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %36 = OpLoad %int %35 + %37 = OpIEqual %bool %36 %int_1 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %38 + %39 = OpLabel + %40 = OpLoad %float %f + %41 = OpCompositeConstruct %v2float %40 %float_0 + %42 = OpCompositeConstruct %v2float %float_0 %40 + %43 = OpCompositeConstruct %mat2v2float %41 %42 + OpStore %m %43 + OpBranch %38 + %38 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %45 = OpLoad %int %44 + OpStore %i %45 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %49 + %49 = OpLabel + %50 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpSLessThan %bool %50 %52 + OpBranchConditional %53 %54 %47 + %54 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %56 = OpLoad %int %55 + OpStore %j %56 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %j + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpSLessThan %bool %61 %63 + OpBranchConditional %64 %65 %58 + %65 = OpLabel + %66 = OpLoad %int %i + %67 = OpLoad %int %j + %68 = OpLoad %int %i + %69 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpIMul %int %68 %70 + %72 = OpLoad %int %j + %73 = OpIAdd %int %71 %72 + %74 = OpConvertSToF %float %73 + %75 = OpAccessChain %_ptr_Function_float %m %66 %67 + OpStore %75 %74 + OpBranch %59 + %59 = OpLabel + %76 = OpLoad %int %j + %77 = OpIAdd %int %76 %int_1 + OpStore %j %77 + OpBranch %57 + %58 = OpLabel + OpBranch %48 + %48 = OpLabel + %78 = OpLoad %int %i + %79 = OpIAdd %int %78 %int_1 + OpStore %i %79 + OpBranch %46 + %47 = OpLabel + %80 = OpLoad %mat2v2float %m + %81 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpConvertSToF %float %82 + %84 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %85 + %87 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %88 + %90 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %91 + %93 = OpCompositeConstruct %v2float %83 %86 + %94 = OpCompositeConstruct %v2float %89 %92 + %95 = OpCompositeConstruct %mat2v2float %93 %94 + %96 = OpCompositeExtract %v2float %80 0 + %97 = OpCompositeExtract %v2float %95 0 + %98 = OpFOrdEqual %v2bool %96 %97 + %99 = OpAll %bool %98 + %100 = OpCompositeExtract %v2float %80 1 + %101 = OpCompositeExtract %v2float %95 1 + %102 = OpFOrdEqual %v2bool %100 %101 + %103 = OpAll %bool %102 + %104 = OpLogicalAnd %bool %99 %103 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %107 + %106 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %109 + %111 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %112 = OpLoad %int %111 + %113 = OpConvertSToF %float %112 + %114 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %115 = OpLoad %int %114 + %116 = OpConvertSToF %float %115 + %117 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %118 = OpLoad %int %117 + %119 = OpConvertSToF %float %118 + %120 = OpCompositeConstruct %v4float %110 %113 %116 %119 + OpStore %_GLF_color %120 + OpBranch %105 + %107 = OpLabel + %121 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %122 = OpLoad %int %121 + %123 = OpConvertSToF %float %122 + %124 = OpCompositeConstruct %v4float %123 %123 %123 %123 + OpStore %_GLF_color %124 + OpBranch %105 + %105 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..34889eead4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.hlsl @@ -0,0 +1,91 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 m = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float f = 0.0f; + int i = 0; + int j = 0; + const int x_36 = asint(x_5[1].x); + if ((x_36 == 1)) { + const float x_40 = f; + m = float2x2(float2(x_40, 0.0f), float2(0.0f, x_40)); + } + const int x_45 = asint(x_5[1].x); + i = x_45; + while (true) { + const int x_50 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_52 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + if ((x_50 < x_52)) { + } else { + break; + } + const int x_56 = asint(x_5[1].x); + j = x_56; + while (true) { + const int x_61 = j; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_63 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_61 < x_63)) { + } else { + break; + } + const int x_66 = i; + const int x_67 = j; + const int x_68 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_70 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + set_float2(m[x_66], x_67, float(((x_68 * x_70) + j))); + { + j = (j + 1); + } + } + { + i = (i + 1); + } + } + const float2x2 x_80 = m; + const int x_82 = asint(x_5[1].x); + const int x_85 = asint(x_5[2].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_88 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_91 = asint(x_5[3].x); + const float2x2 x_95 = float2x2(float2(float(x_82), float(x_85)), float2(float(x_88), float(x_91))); + bool tint_tmp = all((x_80[0u] == x_95[0u])); + if (tint_tmp) { + tint_tmp = all((x_80[1u] == x_95[1u])); + } + if ((tint_tmp)) { + const int x_109 = asint(x_5[2].x); + const int x_112 = asint(x_5[1].x); + const int x_115 = asint(x_5[1].x); + const int x_118 = asint(x_5[2].x); + x_GLF_color = float4(float(x_109), float(x_112), float(x_115), float(x_118)); + } else { + const int x_122 = asint(x_5[1].x); + const float x_123 = float(x_122); + x_GLF_color = float4(x_123, x_123, x_123, x_123); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d6a3fcf7f0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.msl @@ -0,0 +1,92 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float2x2 m = float2x2(0.0f); + float f = 0.0f; + int i = 0; + int j = 0; + int const x_36 = x_5.x_GLF_uniform_int_values.arr[1].el; + if ((x_36 == 1)) { + float const x_40 = f; + m = float2x2(float2(x_40, 0.0f), float2(0.0f, x_40)); + } + int const x_45 = x_5.x_GLF_uniform_int_values.arr[1].el; + i = x_45; + while (true) { + int const x_50 = i; + int const x_52 = x_5.x_GLF_uniform_int_values.arr[0].el; + if ((x_50 < x_52)) { + } else { + break; + } + int const x_56 = x_5.x_GLF_uniform_int_values.arr[1].el; + j = x_56; + while (true) { + int const x_61 = j; + int const x_63 = x_5.x_GLF_uniform_int_values.arr[0].el; + if ((x_61 < x_63)) { + } else { + break; + } + int const x_66 = i; + int const x_67 = j; + int const x_68 = i; + int const x_70 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_72 = j; + m[x_66][x_67] = float(((x_68 * x_70) + x_72)); + { + int const x_76 = j; + j = (x_76 + 1); + } + } + { + int const x_78 = i; + i = (x_78 + 1); + } + } + float2x2 const x_80 = m; + int const x_82 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_85 = x_5.x_GLF_uniform_int_values.arr[2].el; + int const x_88 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_91 = x_5.x_GLF_uniform_int_values.arr[3].el; + float2x2 const x_95 = float2x2(float2(float(x_82), float(x_85)), float2(float(x_88), float(x_91))); + if ((all((x_80[0u] == x_95[0u])) && all((x_80[1u] == x_95[1u])))) { + int const x_109 = x_5.x_GLF_uniform_int_values.arr[2].el; + int const x_112 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_115 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_118 = x_5.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_109), float(x_112), float(x_115), float(x_118)); + } else { + int const x_122 = x_5.x_GLF_uniform_int_values.arr[1].el; + float const x_123 = float(x_122); + *(tint_symbol_4) = float4(x_123, x_123, x_123, x_123); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2f12b21b02 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.spvasm @@ -0,0 +1,223 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 149 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %f "f" + OpName %i "i" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %23 = OpConstantNull %mat2v2float +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v2bool = OpTypeVector %bool 2 + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %137 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2float Function %23 + %f = OpVariable %_ptr_Function_float Function %26 + %i = OpVariable %_ptr_Function_int Function %29 + %j = OpVariable %_ptr_Function_int Function %29 + %34 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %35 = OpLoad %int %34 + %36 = OpIEqual %bool %35 %int_1 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %38 + %39 = OpLabel + %40 = OpLoad %float %f + %42 = OpCompositeConstruct %v2float %40 %float_0 + %43 = OpCompositeConstruct %v2float %float_0 %40 + %44 = OpCompositeConstruct %mat2v2float %42 %43 + OpStore %m %44 + OpBranch %38 + %38 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %46 = OpLoad %int %45 + OpStore %i %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i + %53 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpSLessThan %bool %51 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpBranch %56 + %58 = OpLabel + OpBranch %48 + %56 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %60 = OpLoad %int %59 + OpStore %j %60 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %int %j + %66 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpSLessThan %bool %65 %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + OpBranch %69 + %71 = OpLabel + OpBranch %62 + %69 = OpLabel + %72 = OpLoad %int %i + %73 = OpLoad %int %j + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpLoad %int %j + %78 = OpAccessChain %_ptr_Function_float %m %72 %73 + %80 = OpIMul %int %74 %76 + %81 = OpIAdd %int %80 %77 + %79 = OpConvertSToF %float %81 + OpStore %78 %79 + OpBranch %63 + %63 = OpLabel + %82 = OpLoad %int %j + %83 = OpIAdd %int %82 %int_1 + OpStore %j %83 + OpBranch %61 + %62 = OpLabel + OpBranch %49 + %49 = OpLabel + %84 = OpLoad %int %i + %85 = OpIAdd %int %84 %int_1 + OpStore %i %85 + OpBranch %47 + %48 = OpLabel + %86 = OpLoad %mat2v2float %m + %87 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %88 = OpLoad %int %87 + %90 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %91 = OpLoad %int %90 + %92 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %93 = OpLoad %int %92 + %95 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_3 + %96 = OpLoad %int %95 + %97 = OpConvertSToF %float %88 + %98 = OpConvertSToF %float %91 + %99 = OpCompositeConstruct %v2float %97 %98 + %100 = OpConvertSToF %float %93 + %101 = OpConvertSToF %float %96 + %102 = OpCompositeConstruct %v2float %100 %101 + %103 = OpCompositeConstruct %mat2v2float %99 %102 + %105 = OpCompositeExtract %v2float %86 0 + %106 = OpCompositeExtract %v2float %103 0 + %107 = OpFOrdEqual %v2bool %105 %106 + %104 = OpAll %bool %107 + OpSelectionMerge %109 None + OpBranchConditional %104 %110 %109 + %110 = OpLabel + %113 = OpCompositeExtract %v2float %86 1 + %114 = OpCompositeExtract %v2float %103 1 + %115 = OpFOrdEqual %v2bool %113 %114 + %111 = OpAll %bool %115 + OpBranch %109 + %109 = OpLabel + %116 = OpPhi %bool %104 %48 %111 %110 + OpSelectionMerge %117 None + OpBranchConditional %116 %118 %119 + %118 = OpLabel + %120 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %121 = OpLoad %int %120 + %122 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %123 = OpLoad %int %122 + %124 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %125 = OpLoad %int %124 + %126 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %127 = OpLoad %int %126 + %128 = OpConvertSToF %float %121 + %129 = OpConvertSToF %float %123 + %130 = OpConvertSToF %float %125 + %131 = OpConvertSToF %float %127 + %132 = OpCompositeConstruct %v4float %128 %129 %130 %131 + OpStore %x_GLF_color %132 + OpBranch %117 + %119 = OpLabel + %133 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %134 = OpLoad %int %133 + %135 = OpConvertSToF %float %134 + %136 = OpCompositeConstruct %v4float %135 %135 %135 %135 + OpStore %x_GLF_color %136 + OpBranch %117 + %117 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %137 +%tint_symbol = OpFunctionParameter %main_out + %141 = OpLabel + %142 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %142 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %144 = OpLabel + %145 = OpFunctionCall %void %main_1 + %147 = OpLoad %v4float %x_GLF_color + %148 = OpCompositeConstruct %main_out %147 + %146 = OpFunctionCall %void %tint_symbol_2 %148 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..3ad4f9be7d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.wgsl @@ -0,0 +1,87 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m : mat2x2; + var f : f32; + var i : i32; + var j : i32; + let x_36 : i32 = x_5.x_GLF_uniform_int_values[1]; + if ((x_36 == 1)) { + let x_40 : f32 = f; + m = mat2x2(vec2(x_40, 0.0), vec2(0.0, x_40)); + } + let x_45 : i32 = x_5.x_GLF_uniform_int_values[1]; + i = x_45; + loop { + let x_50 : i32 = i; + let x_52 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_50 < x_52)) { + } else { + break; + } + let x_56 : i32 = x_5.x_GLF_uniform_int_values[1]; + j = x_56; + loop { + let x_61 : i32 = j; + let x_63 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_61 < x_63)) { + } else { + break; + } + let x_66 : i32 = i; + let x_67 : i32 = j; + let x_68 : i32 = i; + let x_70 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_72 : i32 = j; + m[x_66][x_67] = f32(((x_68 * x_70) + x_72)); + + continuing { + let x_76 : i32 = j; + j = (x_76 + 1); + } + } + + continuing { + let x_78 : i32 = i; + i = (x_78 + 1); + } + } + let x_80 : mat2x2 = m; + let x_82 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_85 : i32 = x_5.x_GLF_uniform_int_values[2]; + let x_88 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_91 : i32 = x_5.x_GLF_uniform_int_values[3]; + let x_95 : mat2x2 = mat2x2(vec2(f32(x_82), f32(x_85)), vec2(f32(x_88), f32(x_91))); + if ((all((x_80[0u] == x_95[0u])) && all((x_80[1u] == x_95[1u])))) { + let x_109 : i32 = x_5.x_GLF_uniform_int_values[2]; + let x_112 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_115 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_118 : i32 = x_5.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_109), f32(x_112), f32(x_115), f32(x_118)); + } else { + let x_122 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_123 : f32 = f32(x_122); + x_GLF_color = vec4(x_123, x_123, x_123, x_123); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl new file mode 100644 index 0000000000..3ad4f9be7d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl @@ -0,0 +1,87 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m : mat2x2; + var f : f32; + var i : i32; + var j : i32; + let x_36 : i32 = x_5.x_GLF_uniform_int_values[1]; + if ((x_36 == 1)) { + let x_40 : f32 = f; + m = mat2x2(vec2(x_40, 0.0), vec2(0.0, x_40)); + } + let x_45 : i32 = x_5.x_GLF_uniform_int_values[1]; + i = x_45; + loop { + let x_50 : i32 = i; + let x_52 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_50 < x_52)) { + } else { + break; + } + let x_56 : i32 = x_5.x_GLF_uniform_int_values[1]; + j = x_56; + loop { + let x_61 : i32 = j; + let x_63 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_61 < x_63)) { + } else { + break; + } + let x_66 : i32 = i; + let x_67 : i32 = j; + let x_68 : i32 = i; + let x_70 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_72 : i32 = j; + m[x_66][x_67] = f32(((x_68 * x_70) + x_72)); + + continuing { + let x_76 : i32 = j; + j = (x_76 + 1); + } + } + + continuing { + let x_78 : i32 = i; + i = (x_78 + 1); + } + } + let x_80 : mat2x2 = m; + let x_82 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_85 : i32 = x_5.x_GLF_uniform_int_values[2]; + let x_88 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_91 : i32 = x_5.x_GLF_uniform_int_values[3]; + let x_95 : mat2x2 = mat2x2(vec2(f32(x_82), f32(x_85)), vec2(f32(x_88), f32(x_91))); + if ((all((x_80[0u] == x_95[0u])) && all((x_80[1u] == x_95[1u])))) { + let x_109 : i32 = x_5.x_GLF_uniform_int_values[2]; + let x_112 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_115 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_118 : i32 = x_5.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_109), f32(x_112), f32(x_115), f32(x_118)); + } else { + let x_122 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_123 : f32 = f32(x_122); + x_GLF_color = vec4(x_123, x_123, x_123, x_123); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..34889eead4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.hlsl @@ -0,0 +1,91 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 m = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float f = 0.0f; + int i = 0; + int j = 0; + const int x_36 = asint(x_5[1].x); + if ((x_36 == 1)) { + const float x_40 = f; + m = float2x2(float2(x_40, 0.0f), float2(0.0f, x_40)); + } + const int x_45 = asint(x_5[1].x); + i = x_45; + while (true) { + const int x_50 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_52 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + if ((x_50 < x_52)) { + } else { + break; + } + const int x_56 = asint(x_5[1].x); + j = x_56; + while (true) { + const int x_61 = j; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_63 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_61 < x_63)) { + } else { + break; + } + const int x_66 = i; + const int x_67 = j; + const int x_68 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_70 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + set_float2(m[x_66], x_67, float(((x_68 * x_70) + j))); + { + j = (j + 1); + } + } + { + i = (i + 1); + } + } + const float2x2 x_80 = m; + const int x_82 = asint(x_5[1].x); + const int x_85 = asint(x_5[2].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_88 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_91 = asint(x_5[3].x); + const float2x2 x_95 = float2x2(float2(float(x_82), float(x_85)), float2(float(x_88), float(x_91))); + bool tint_tmp = all((x_80[0u] == x_95[0u])); + if (tint_tmp) { + tint_tmp = all((x_80[1u] == x_95[1u])); + } + if ((tint_tmp)) { + const int x_109 = asint(x_5[2].x); + const int x_112 = asint(x_5[1].x); + const int x_115 = asint(x_5[1].x); + const int x_118 = asint(x_5[2].x); + x_GLF_color = float4(float(x_109), float(x_112), float(x_115), float(x_118)); + } else { + const int x_122 = asint(x_5[1].x); + const float x_123 = float(x_122); + x_GLF_color = float4(x_123, x_123, x_123, x_123); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d6a3fcf7f0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.msl @@ -0,0 +1,92 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float2x2 m = float2x2(0.0f); + float f = 0.0f; + int i = 0; + int j = 0; + int const x_36 = x_5.x_GLF_uniform_int_values.arr[1].el; + if ((x_36 == 1)) { + float const x_40 = f; + m = float2x2(float2(x_40, 0.0f), float2(0.0f, x_40)); + } + int const x_45 = x_5.x_GLF_uniform_int_values.arr[1].el; + i = x_45; + while (true) { + int const x_50 = i; + int const x_52 = x_5.x_GLF_uniform_int_values.arr[0].el; + if ((x_50 < x_52)) { + } else { + break; + } + int const x_56 = x_5.x_GLF_uniform_int_values.arr[1].el; + j = x_56; + while (true) { + int const x_61 = j; + int const x_63 = x_5.x_GLF_uniform_int_values.arr[0].el; + if ((x_61 < x_63)) { + } else { + break; + } + int const x_66 = i; + int const x_67 = j; + int const x_68 = i; + int const x_70 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_72 = j; + m[x_66][x_67] = float(((x_68 * x_70) + x_72)); + { + int const x_76 = j; + j = (x_76 + 1); + } + } + { + int const x_78 = i; + i = (x_78 + 1); + } + } + float2x2 const x_80 = m; + int const x_82 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_85 = x_5.x_GLF_uniform_int_values.arr[2].el; + int const x_88 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_91 = x_5.x_GLF_uniform_int_values.arr[3].el; + float2x2 const x_95 = float2x2(float2(float(x_82), float(x_85)), float2(float(x_88), float(x_91))); + if ((all((x_80[0u] == x_95[0u])) && all((x_80[1u] == x_95[1u])))) { + int const x_109 = x_5.x_GLF_uniform_int_values.arr[2].el; + int const x_112 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_115 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_118 = x_5.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_109), float(x_112), float(x_115), float(x_118)); + } else { + int const x_122 = x_5.x_GLF_uniform_int_values.arr[1].el; + float const x_123 = float(x_122); + *(tint_symbol_4) = float4(x_123, x_123, x_123, x_123); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2f12b21b02 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.spvasm @@ -0,0 +1,223 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 149 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %f "f" + OpName %i "i" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %23 = OpConstantNull %mat2v2float +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %v2bool = OpTypeVector %bool 2 + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %137 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2float Function %23 + %f = OpVariable %_ptr_Function_float Function %26 + %i = OpVariable %_ptr_Function_int Function %29 + %j = OpVariable %_ptr_Function_int Function %29 + %34 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %35 = OpLoad %int %34 + %36 = OpIEqual %bool %35 %int_1 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %38 + %39 = OpLabel + %40 = OpLoad %float %f + %42 = OpCompositeConstruct %v2float %40 %float_0 + %43 = OpCompositeConstruct %v2float %float_0 %40 + %44 = OpCompositeConstruct %mat2v2float %42 %43 + OpStore %m %44 + OpBranch %38 + %38 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %46 = OpLoad %int %45 + OpStore %i %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i + %53 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpSLessThan %bool %51 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpBranch %56 + %58 = OpLabel + OpBranch %48 + %56 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %60 = OpLoad %int %59 + OpStore %j %60 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %int %j + %66 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %67 = OpLoad %int %66 + %68 = OpSLessThan %bool %65 %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + OpBranch %69 + %71 = OpLabel + OpBranch %62 + %69 = OpLabel + %72 = OpLoad %int %i + %73 = OpLoad %int %j + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpLoad %int %j + %78 = OpAccessChain %_ptr_Function_float %m %72 %73 + %80 = OpIMul %int %74 %76 + %81 = OpIAdd %int %80 %77 + %79 = OpConvertSToF %float %81 + OpStore %78 %79 + OpBranch %63 + %63 = OpLabel + %82 = OpLoad %int %j + %83 = OpIAdd %int %82 %int_1 + OpStore %j %83 + OpBranch %61 + %62 = OpLabel + OpBranch %49 + %49 = OpLabel + %84 = OpLoad %int %i + %85 = OpIAdd %int %84 %int_1 + OpStore %i %85 + OpBranch %47 + %48 = OpLabel + %86 = OpLoad %mat2v2float %m + %87 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %88 = OpLoad %int %87 + %90 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %91 = OpLoad %int %90 + %92 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %93 = OpLoad %int %92 + %95 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_3 + %96 = OpLoad %int %95 + %97 = OpConvertSToF %float %88 + %98 = OpConvertSToF %float %91 + %99 = OpCompositeConstruct %v2float %97 %98 + %100 = OpConvertSToF %float %93 + %101 = OpConvertSToF %float %96 + %102 = OpCompositeConstruct %v2float %100 %101 + %103 = OpCompositeConstruct %mat2v2float %99 %102 + %105 = OpCompositeExtract %v2float %86 0 + %106 = OpCompositeExtract %v2float %103 0 + %107 = OpFOrdEqual %v2bool %105 %106 + %104 = OpAll %bool %107 + OpSelectionMerge %109 None + OpBranchConditional %104 %110 %109 + %110 = OpLabel + %113 = OpCompositeExtract %v2float %86 1 + %114 = OpCompositeExtract %v2float %103 1 + %115 = OpFOrdEqual %v2bool %113 %114 + %111 = OpAll %bool %115 + OpBranch %109 + %109 = OpLabel + %116 = OpPhi %bool %104 %48 %111 %110 + OpSelectionMerge %117 None + OpBranchConditional %116 %118 %119 + %118 = OpLabel + %120 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %121 = OpLoad %int %120 + %122 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %123 = OpLoad %int %122 + %124 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %125 = OpLoad %int %124 + %126 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %127 = OpLoad %int %126 + %128 = OpConvertSToF %float %121 + %129 = OpConvertSToF %float %123 + %130 = OpConvertSToF %float %125 + %131 = OpConvertSToF %float %127 + %132 = OpCompositeConstruct %v4float %128 %129 %130 %131 + OpStore %x_GLF_color %132 + OpBranch %117 + %119 = OpLabel + %133 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %134 = OpLoad %int %133 + %135 = OpConvertSToF %float %134 + %136 = OpCompositeConstruct %v4float %135 %135 %135 %135 + OpStore %x_GLF_color %136 + OpBranch %117 + %117 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %137 +%tint_symbol = OpFunctionParameter %main_out + %141 = OpLabel + %142 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %142 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %144 = OpLabel + %145 = OpFunctionCall %void %main_1 + %147 = OpLoad %v4float %x_GLF_color + %148 = OpCompositeConstruct %main_out %147 + %146 = OpFunctionCall %void %tint_symbol_2 %148 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..3ad4f9be7d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.wgsl @@ -0,0 +1,87 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m : mat2x2; + var f : f32; + var i : i32; + var j : i32; + let x_36 : i32 = x_5.x_GLF_uniform_int_values[1]; + if ((x_36 == 1)) { + let x_40 : f32 = f; + m = mat2x2(vec2(x_40, 0.0), vec2(0.0, x_40)); + } + let x_45 : i32 = x_5.x_GLF_uniform_int_values[1]; + i = x_45; + loop { + let x_50 : i32 = i; + let x_52 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_50 < x_52)) { + } else { + break; + } + let x_56 : i32 = x_5.x_GLF_uniform_int_values[1]; + j = x_56; + loop { + let x_61 : i32 = j; + let x_63 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_61 < x_63)) { + } else { + break; + } + let x_66 : i32 = i; + let x_67 : i32 = j; + let x_68 : i32 = i; + let x_70 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_72 : i32 = j; + m[x_66][x_67] = f32(((x_68 * x_70) + x_72)); + + continuing { + let x_76 : i32 = j; + j = (x_76 + 1); + } + } + + continuing { + let x_78 : i32 = i; + i = (x_78 + 1); + } + } + let x_80 : mat2x2 = m; + let x_82 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_85 : i32 = x_5.x_GLF_uniform_int_values[2]; + let x_88 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_91 : i32 = x_5.x_GLF_uniform_int_values[3]; + let x_95 : mat2x2 = mat2x2(vec2(f32(x_82), f32(x_85)), vec2(f32(x_88), f32(x_91))); + if ((all((x_80[0u] == x_95[0u])) && all((x_80[1u] == x_95[1u])))) { + let x_109 : i32 = x_5.x_GLF_uniform_int_values[2]; + let x_112 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_115 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_118 : i32 = x_5.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_109), f32(x_112), f32(x_115), f32(x_118)); + } else { + let x_122 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_123 : f32 = f32(x_122); + x_GLF_color = vec4(x_123, x_123, x_123, x_123); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm new file mode 100644 index 0000000000..cb7eca17dd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm @@ -0,0 +1,177 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %S "S" + OpMemberName %S 0 "data" + OpName %func_struct_S_i11_i1_ "func(struct-S-i11;i1;" + OpName %s "s" + OpName %x "x" + OpName %a "a" + OpName %arr "arr" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %i "i" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %S 0 RelaxedPrecision + OpDecorate %func_struct_S_i11_i1_ RelaxedPrecision + OpDecorate %x RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %a RelaxedPrecision + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %22 RelaxedPrecision + OpDecorate %i RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %35 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int +%_ptr_Function_S = OpTypePointer Function %S +%_ptr_Function_int = OpTypePointer Function %int + %39 = OpTypeFunction %int %_ptr_Function_S %_ptr_Function_int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_S_uint_1 = OpTypeArray %S %uint_1 +%_ptr_Function__arr_S_uint_1 = OpTypePointer Function %_arr_S_uint_1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %57 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %58 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %35 + %59 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %arr = OpVariable %_ptr_Function__arr_S_uint_1 Function + %i = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_S Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_S Function + %param_2 = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %22 = OpLoad %int %60 + %61 = OpAccessChain %_ptr_Function_int %arr %int_0 %int_0 + OpStore %61 %22 + OpStore %i %int_0 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %23 = OpLoad %int %i + %66 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %24 = OpLoad %int %66 + %25 = OpIAdd %int %int_5 %24 + %67 = OpSLessThan %bool %23 %25 + OpBranchConditional %67 %68 %63 + %68 = OpLabel + %26 = OpLoad %int %i + %27 = OpSMod %int %26 %int_2 + %69 = OpINotEqual %bool %27 %int_0 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + %73 = OpAccessChain %_ptr_Function_S %arr %int_0 + %74 = OpLoad %S %73 + OpStore %param %74 + %28 = OpLoad %int %i + OpStore %param_0 %28 + %29 = OpFunctionCall %int %func_struct_S_i11_i1_ %param %param_0 + %75 = OpLoad %S %param + %76 = OpAccessChain %_ptr_Function_S %arr %int_0 + OpStore %76 %75 + OpStore %a %29 + OpBranch %70 + %72 = OpLabel + %77 = OpAccessChain %_ptr_Function_S %arr %int_0 + %78 = OpLoad %S %77 + OpStore %param_1 %78 + OpStore %param_2 %int_1 + %30 = OpFunctionCall %int %func_struct_S_i11_i1_ %param_1 %param_2 + %79 = OpLoad %S %param_1 + %80 = OpAccessChain %_ptr_Function_S %arr %int_0 + OpStore %80 %79 + OpStore %a %30 + OpBranch %70 + %70 = OpLabel + OpBranch %64 + %64 = OpLabel + %31 = OpLoad %int %i + %32 = OpIAdd %int %31 %int_1 + OpStore %i %32 + OpBranch %62 + %63 = OpLabel + %33 = OpLoad %int %a + %81 = OpIEqual %bool %33 %int_6 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + OpStore %_GLF_color %57 + OpBranch %82 + %84 = OpLabel + OpStore %_GLF_color %58 + OpBranch %82 + %82 = OpLabel + OpReturn + OpFunctionEnd +%func_struct_S_i11_i1_ = OpFunction %int None %39 + %s = OpFunctionParameter %_ptr_Function_S + %x = OpFunctionParameter %_ptr_Function_int + %85 = OpLabel + %86 = OpAccessChain %_ptr_Function_int %s %int_0 + %17 = OpLoad %int %86 + %87 = OpIEqual %bool %17 %int_1 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %90 + %89 = OpLabel + %18 = OpLoad %int %x + %91 = OpAccessChain %_ptr_Function_int %s %int_0 + %19 = OpLoad %int %91 + %20 = OpIAdd %int %18 %19 + OpReturnValue %20 + %90 = OpLabel + %21 = OpLoad %int %x + OpReturnValue %21 + %88 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..c2266079a5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.hlsl @@ -0,0 +1,81 @@ +struct S { + int data; +}; + +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_struct_S_i11_i1_(inout S s, inout int x) { + const int x_17 = s.data; + if ((x_17 == 1)) { + const int x_18 = x; + const int x_19 = s.data; + return (x_18 + x_19); + } else { + const int x_21 = x; + return x_21; + } + return 0; +} + +void main_1() { + int a = 0; + S arr[1] = (S[1])0; + int i = 0; + S param = (S)0; + int param_1 = 0; + S param_2 = (S)0; + int param_3 = 0; + a = 0; + const int x_22 = asint(x_11[0].x); + arr[0].data = x_22; + i = 0; + while (true) { + const int x_23 = i; + const int x_24 = asint(x_11[0].x); + if ((x_23 < (5 + x_24))) { + } else { + break; + } + if (((i % 2) != 0)) { + const S x_74 = arr[0]; + param = x_74; + param_1 = i; + const int x_29 = func_struct_S_i11_i1_(param, param_1); + arr[0] = param; + a = x_29; + } else { + const S x_78 = arr[0]; + param_2 = x_78; + param_3 = 1; + const int x_30 = func_struct_S_i11_i1_(param_2, param_3); + arr[0] = param_2; + a = x_30; + } + { + i = (i + 1); + } + } + if ((a == 6)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..fc2142783a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.msl @@ -0,0 +1,92 @@ +#include + +using namespace metal; +struct S { + int data; +}; +struct buf0 { + /* 0x0000 */ int one; +}; +struct tint_array_wrapper { + S arr[1]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_struct_S_i11_i1_(thread S* const s, thread int* const x) { + int const x_17 = (*(s)).data; + if ((x_17 == 1)) { + int const x_18 = *(x); + int const x_19 = (*(s)).data; + return (x_18 + x_19); + } else { + int const x_21 = *(x); + return x_21; + } + return 0; +} + +void main_1(constant buf0& x_11, thread float4* const tint_symbol_4) { + int a = 0; + tint_array_wrapper arr = {}; + int i = 0; + S param = {}; + int param_1 = 0; + S param_2 = {}; + int param_3 = 0; + a = 0; + int const x_22 = x_11.one; + arr.arr[0].data = x_22; + i = 0; + while (true) { + int const x_23 = i; + int const x_24 = x_11.one; + if ((x_23 < (5 + x_24))) { + } else { + break; + } + int const x_26 = i; + if (((x_26 % 2) != 0)) { + S const x_74 = arr.arr[0]; + param = x_74; + int const x_28 = i; + param_1 = x_28; + int const x_29 = func_struct_S_i11_i1_(&(param), &(param_1)); + S const x_75 = param; + arr.arr[0] = x_75; + a = x_29; + } else { + S const x_78 = arr.arr[0]; + param_2 = x_78; + param_3 = 1; + int const x_30 = func_struct_S_i11_i1_(&(param_2), &(param_3)); + S const x_79 = param_2; + arr.arr[0] = x_79; + a = x_30; + } + { + int const x_31 = i; + i = (x_31 + 1); + } + } + int const x_33 = a; + if ((x_33 == 6)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_11, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..79aef8134b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.spvasm @@ -0,0 +1,196 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 120 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %S "S" + OpMemberName %S 0 "data" + OpName %func_struct_S_i11_i1_ "func_struct_S_i11_i1_" + OpName %s "s" + OpName %x "x" + OpName %main_1 "main_1" + OpName %a "a" + OpName %arr "arr" + OpName %i "i" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_arr_S_uint_1 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %S = OpTypeStruct %int +%_ptr_Function_S = OpTypePointer Function %S +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpTypeFunction %int %_ptr_Function_S %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %void = OpTypeVoid + %40 = OpTypeFunction %void + %45 = OpConstantNull %int + %uint_1 = OpConstant %uint 1 +%_arr_S_uint_1 = OpTypeArray %S %uint_1 +%_ptr_Function__arr_S_uint_1 = OpTypePointer Function %_arr_S_uint_1 + %50 = OpConstantNull %_arr_S_uint_1 + %53 = OpConstantNull %S +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %106 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %107 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %108 = OpTypeFunction %void %main_out +%func_struct_S_i11_i1_ = OpFunction %int None %12 + %s = OpFunctionParameter %_ptr_Function_S + %x = OpFunctionParameter %_ptr_Function_int + %19 = OpLabel + %23 = OpAccessChain %_ptr_Function_int %s %uint_0 + %24 = OpLoad %int %23 + %26 = OpIEqual %bool %24 %int_1 + OpSelectionMerge %28 None + OpBranchConditional %26 %29 %30 + %29 = OpLabel + %32 = OpLoad %int %x + %34 = OpAccessChain %_ptr_Function_int %s %uint_0 + %35 = OpLoad %int %34 + %36 = OpIAdd %int %32 %35 + OpReturnValue %36 + %30 = OpLabel + %38 = OpLoad %int %x + OpReturnValue %38 + %28 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %40 + %43 = OpLabel + %a = OpVariable %_ptr_Function_int Function %45 + %arr = OpVariable %_ptr_Function__arr_S_uint_1 Function %50 + %i = OpVariable %_ptr_Function_int Function %45 + %param = OpVariable %_ptr_Function_S Function %53 + %param_1 = OpVariable %_ptr_Function_int Function %45 + %param_2 = OpVariable %_ptr_Function_S Function %53 + %param_3 = OpVariable %_ptr_Function_int Function %45 + OpStore %a %int_0 + %58 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Function_int %arr %int_0 %uint_0 + OpStore %60 %59 + OpStore %i %int_0 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %int %i + %66 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 + %67 = OpLoad %int %66 + %69 = OpIAdd %int %int_5 %67 + %70 = OpSLessThan %bool %65 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %62 + %71 = OpLabel + %74 = OpLoad %int %i + %76 = OpSMod %int %74 %int_2 + %77 = OpINotEqual %bool %76 %int_0 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + %81 = OpAccessChain %_ptr_Function_S %arr %int_0 + %82 = OpLoad %S %81 + OpStore %param %82 + %83 = OpLoad %int %i + OpStore %param_1 %83 + %84 = OpFunctionCall %int %func_struct_S_i11_i1_ %param %param_1 + %87 = OpLoad %S %param + %88 = OpAccessChain %_ptr_Function_S %arr %int_0 + OpStore %88 %87 + OpStore %a %84 + OpBranch %78 + %80 = OpLabel + %89 = OpAccessChain %_ptr_Function_S %arr %int_0 + %90 = OpLoad %S %89 + OpStore %param_2 %90 + OpStore %param_3 %int_1 + %91 = OpFunctionCall %int %func_struct_S_i11_i1_ %param_2 %param_3 + %94 = OpLoad %S %param_2 + %95 = OpAccessChain %_ptr_Function_S %arr %int_0 + OpStore %95 %94 + OpStore %a %91 + OpBranch %78 + %78 = OpLabel + OpBranch %63 + %63 = OpLabel + %96 = OpLoad %int %i + %97 = OpIAdd %int %96 %int_1 + OpStore %i %97 + OpBranch %61 + %62 = OpLabel + %98 = OpLoad %int %a + %100 = OpIEqual %bool %98 %int_6 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %103 + %102 = OpLabel + OpStore %x_GLF_color %106 + OpBranch %101 + %103 = OpLabel + OpStore %x_GLF_color %107 + OpBranch %101 + %101 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %108 +%tint_symbol = OpFunctionParameter %main_out + %112 = OpLabel + %113 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %113 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %40 + %115 = OpLabel + %116 = OpFunctionCall %void %main_1 + %118 = OpLoad %v4float %x_GLF_color + %119 = OpCompositeConstruct %main_out %118 + %117 = OpFunctionCall %void %tint_symbol_2 %119 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..3eef414151 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.spvasm.expected.wgsl @@ -0,0 +1,89 @@ +struct S { + data : i32; +}; + +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i11_i1_(s : ptr, x : ptr) -> i32 { + let x_17 : i32 = (*(s)).data; + if ((x_17 == 1)) { + let x_18 : i32 = *(x); + let x_19 : i32 = (*(s)).data; + return (x_18 + x_19); + } else { + let x_21 : i32 = *(x); + return x_21; + } + return 0; +} + +fn main_1() { + var a : i32; + var arr : array; + var i : i32; + var param : S; + var param_1 : i32; + var param_2 : S; + var param_3 : i32; + a = 0; + let x_22 : i32 = x_11.one; + arr[0].data = x_22; + i = 0; + loop { + let x_23 : i32 = i; + let x_24 : i32 = x_11.one; + if ((x_23 < (5 + x_24))) { + } else { + break; + } + let x_26 : i32 = i; + if (((x_26 % 2) != 0)) { + let x_74 : S = arr[0]; + param = x_74; + let x_28 : i32 = i; + param_1 = x_28; + let x_29 : i32 = func_struct_S_i11_i1_(&(param), &(param_1)); + let x_75 : S = param; + arr[0] = x_75; + a = x_29; + } else { + let x_78 : S = arr[0]; + param_2 = x_78; + param_3 = 1; + let x_30 : i32 = func_struct_S_i11_i1_(&(param_2), &(param_3)); + let x_79 : S = param_2; + arr[0] = x_79; + a = x_30; + } + + continuing { + let x_31 : i32 = i; + i = (x_31 + 1); + } + } + let x_33 : i32 = a; + if ((x_33 == 6)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl new file mode 100644 index 0000000000..3eef414151 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl @@ -0,0 +1,89 @@ +struct S { + data : i32; +}; + +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i11_i1_(s : ptr, x : ptr) -> i32 { + let x_17 : i32 = (*(s)).data; + if ((x_17 == 1)) { + let x_18 : i32 = *(x); + let x_19 : i32 = (*(s)).data; + return (x_18 + x_19); + } else { + let x_21 : i32 = *(x); + return x_21; + } + return 0; +} + +fn main_1() { + var a : i32; + var arr : array; + var i : i32; + var param : S; + var param_1 : i32; + var param_2 : S; + var param_3 : i32; + a = 0; + let x_22 : i32 = x_11.one; + arr[0].data = x_22; + i = 0; + loop { + let x_23 : i32 = i; + let x_24 : i32 = x_11.one; + if ((x_23 < (5 + x_24))) { + } else { + break; + } + let x_26 : i32 = i; + if (((x_26 % 2) != 0)) { + let x_74 : S = arr[0]; + param = x_74; + let x_28 : i32 = i; + param_1 = x_28; + let x_29 : i32 = func_struct_S_i11_i1_(&(param), &(param_1)); + let x_75 : S = param; + arr[0] = x_75; + a = x_29; + } else { + let x_78 : S = arr[0]; + param_2 = x_78; + param_3 = 1; + let x_30 : i32 = func_struct_S_i11_i1_(&(param_2), &(param_3)); + let x_79 : S = param_2; + arr[0] = x_79; + a = x_30; + } + + continuing { + let x_31 : i32 = i; + i = (x_31 + 1); + } + } + let x_33 : i32 = a; + if ((x_33 == 6)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..c2266079a5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.hlsl @@ -0,0 +1,81 @@ +struct S { + int data; +}; + +cbuffer cbuffer_x_11 : register(b0, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_struct_S_i11_i1_(inout S s, inout int x) { + const int x_17 = s.data; + if ((x_17 == 1)) { + const int x_18 = x; + const int x_19 = s.data; + return (x_18 + x_19); + } else { + const int x_21 = x; + return x_21; + } + return 0; +} + +void main_1() { + int a = 0; + S arr[1] = (S[1])0; + int i = 0; + S param = (S)0; + int param_1 = 0; + S param_2 = (S)0; + int param_3 = 0; + a = 0; + const int x_22 = asint(x_11[0].x); + arr[0].data = x_22; + i = 0; + while (true) { + const int x_23 = i; + const int x_24 = asint(x_11[0].x); + if ((x_23 < (5 + x_24))) { + } else { + break; + } + if (((i % 2) != 0)) { + const S x_74 = arr[0]; + param = x_74; + param_1 = i; + const int x_29 = func_struct_S_i11_i1_(param, param_1); + arr[0] = param; + a = x_29; + } else { + const S x_78 = arr[0]; + param_2 = x_78; + param_3 = 1; + const int x_30 = func_struct_S_i11_i1_(param_2, param_3); + arr[0] = param_2; + a = x_30; + } + { + i = (i + 1); + } + } + if ((a == 6)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..fc2142783a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.msl @@ -0,0 +1,92 @@ +#include + +using namespace metal; +struct S { + int data; +}; +struct buf0 { + /* 0x0000 */ int one; +}; +struct tint_array_wrapper { + S arr[1]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_struct_S_i11_i1_(thread S* const s, thread int* const x) { + int const x_17 = (*(s)).data; + if ((x_17 == 1)) { + int const x_18 = *(x); + int const x_19 = (*(s)).data; + return (x_18 + x_19); + } else { + int const x_21 = *(x); + return x_21; + } + return 0; +} + +void main_1(constant buf0& x_11, thread float4* const tint_symbol_4) { + int a = 0; + tint_array_wrapper arr = {}; + int i = 0; + S param = {}; + int param_1 = 0; + S param_2 = {}; + int param_3 = 0; + a = 0; + int const x_22 = x_11.one; + arr.arr[0].data = x_22; + i = 0; + while (true) { + int const x_23 = i; + int const x_24 = x_11.one; + if ((x_23 < (5 + x_24))) { + } else { + break; + } + int const x_26 = i; + if (((x_26 % 2) != 0)) { + S const x_74 = arr.arr[0]; + param = x_74; + int const x_28 = i; + param_1 = x_28; + int const x_29 = func_struct_S_i11_i1_(&(param), &(param_1)); + S const x_75 = param; + arr.arr[0] = x_75; + a = x_29; + } else { + S const x_78 = arr.arr[0]; + param_2 = x_78; + param_3 = 1; + int const x_30 = func_struct_S_i11_i1_(&(param_2), &(param_3)); + S const x_79 = param_2; + arr.arr[0] = x_79; + a = x_30; + } + { + int const x_31 = i; + i = (x_31 + 1); + } + } + int const x_33 = a; + if ((x_33 == 6)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_11 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_11, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..79aef8134b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.spvasm @@ -0,0 +1,196 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 120 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %S "S" + OpMemberName %S 0 "data" + OpName %func_struct_S_i11_i1_ "func_struct_S_i11_i1_" + OpName %s "s" + OpName %x "x" + OpName %main_1 "main_1" + OpName %a "a" + OpName %arr "arr" + OpName %i "i" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_arr_S_uint_1 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_11 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %S = OpTypeStruct %int +%_ptr_Function_S = OpTypePointer Function %S +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpTypeFunction %int %_ptr_Function_S %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %void = OpTypeVoid + %40 = OpTypeFunction %void + %45 = OpConstantNull %int + %uint_1 = OpConstant %uint 1 +%_arr_S_uint_1 = OpTypeArray %S %uint_1 +%_ptr_Function__arr_S_uint_1 = OpTypePointer Function %_arr_S_uint_1 + %50 = OpConstantNull %_arr_S_uint_1 + %53 = OpConstantNull %S +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %106 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %107 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %108 = OpTypeFunction %void %main_out +%func_struct_S_i11_i1_ = OpFunction %int None %12 + %s = OpFunctionParameter %_ptr_Function_S + %x = OpFunctionParameter %_ptr_Function_int + %19 = OpLabel + %23 = OpAccessChain %_ptr_Function_int %s %uint_0 + %24 = OpLoad %int %23 + %26 = OpIEqual %bool %24 %int_1 + OpSelectionMerge %28 None + OpBranchConditional %26 %29 %30 + %29 = OpLabel + %32 = OpLoad %int %x + %34 = OpAccessChain %_ptr_Function_int %s %uint_0 + %35 = OpLoad %int %34 + %36 = OpIAdd %int %32 %35 + OpReturnValue %36 + %30 = OpLabel + %38 = OpLoad %int %x + OpReturnValue %38 + %28 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %40 + %43 = OpLabel + %a = OpVariable %_ptr_Function_int Function %45 + %arr = OpVariable %_ptr_Function__arr_S_uint_1 Function %50 + %i = OpVariable %_ptr_Function_int Function %45 + %param = OpVariable %_ptr_Function_S Function %53 + %param_1 = OpVariable %_ptr_Function_int Function %45 + %param_2 = OpVariable %_ptr_Function_S Function %53 + %param_3 = OpVariable %_ptr_Function_int Function %45 + OpStore %a %int_0 + %58 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Function_int %arr %int_0 %uint_0 + OpStore %60 %59 + OpStore %i %int_0 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %int %i + %66 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 + %67 = OpLoad %int %66 + %69 = OpIAdd %int %int_5 %67 + %70 = OpSLessThan %bool %65 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %62 + %71 = OpLabel + %74 = OpLoad %int %i + %76 = OpSMod %int %74 %int_2 + %77 = OpINotEqual %bool %76 %int_0 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + %81 = OpAccessChain %_ptr_Function_S %arr %int_0 + %82 = OpLoad %S %81 + OpStore %param %82 + %83 = OpLoad %int %i + OpStore %param_1 %83 + %84 = OpFunctionCall %int %func_struct_S_i11_i1_ %param %param_1 + %87 = OpLoad %S %param + %88 = OpAccessChain %_ptr_Function_S %arr %int_0 + OpStore %88 %87 + OpStore %a %84 + OpBranch %78 + %80 = OpLabel + %89 = OpAccessChain %_ptr_Function_S %arr %int_0 + %90 = OpLoad %S %89 + OpStore %param_2 %90 + OpStore %param_3 %int_1 + %91 = OpFunctionCall %int %func_struct_S_i11_i1_ %param_2 %param_3 + %94 = OpLoad %S %param_2 + %95 = OpAccessChain %_ptr_Function_S %arr %int_0 + OpStore %95 %94 + OpStore %a %91 + OpBranch %78 + %78 = OpLabel + OpBranch %63 + %63 = OpLabel + %96 = OpLoad %int %i + %97 = OpIAdd %int %96 %int_1 + OpStore %i %97 + OpBranch %61 + %62 = OpLabel + %98 = OpLoad %int %a + %100 = OpIEqual %bool %98 %int_6 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %103 + %102 = OpLabel + OpStore %x_GLF_color %106 + OpBranch %101 + %103 = OpLabel + OpStore %x_GLF_color %107 + OpBranch %101 + %101 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %108 +%tint_symbol = OpFunctionParameter %main_out + %112 = OpLabel + %113 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %113 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %40 + %115 = OpLabel + %116 = OpFunctionCall %void %main_1 + %118 = OpLoad %v4float %x_GLF_color + %119 = OpCompositeConstruct %main_out %118 + %117 = OpFunctionCall %void %tint_symbol_2 %119 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..3eef414151 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-replace-copy-object/0-opt.wgsl.expected.wgsl @@ -0,0 +1,89 @@ +struct S { + data : i32; +}; + +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_11 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i11_i1_(s : ptr, x : ptr) -> i32 { + let x_17 : i32 = (*(s)).data; + if ((x_17 == 1)) { + let x_18 : i32 = *(x); + let x_19 : i32 = (*(s)).data; + return (x_18 + x_19); + } else { + let x_21 : i32 = *(x); + return x_21; + } + return 0; +} + +fn main_1() { + var a : i32; + var arr : array; + var i : i32; + var param : S; + var param_1 : i32; + var param_2 : S; + var param_3 : i32; + a = 0; + let x_22 : i32 = x_11.one; + arr[0].data = x_22; + i = 0; + loop { + let x_23 : i32 = i; + let x_24 : i32 = x_11.one; + if ((x_23 < (5 + x_24))) { + } else { + break; + } + let x_26 : i32 = i; + if (((x_26 % 2) != 0)) { + let x_74 : S = arr[0]; + param = x_74; + let x_28 : i32 = i; + param_1 = x_28; + let x_29 : i32 = func_struct_S_i11_i1_(&(param), &(param_1)); + let x_75 : S = param; + arr[0] = x_75; + a = x_29; + } else { + let x_78 : S = arr[0]; + param_2 = x_78; + param_3 = 1; + let x_30 : i32 = func_struct_S_i11_i1_(&(param_2), &(param_3)); + let x_79 : S = param_2; + arr[0] = x_79; + a = x_30; + } + + continuing { + let x_31 : i32 = i; + i = (x_31 + 1); + } + } + let x_33 : i32 = a; + if ((x_33 == 6)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm new file mode 100644 index 0000000000..4d13774a96 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm @@ -0,0 +1,81 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main = OpFunction %void None %8 + %20 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %22 = OpLoad %int %21 + %23 = OpConvertSToF %float %22 + %24 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %25 = OpLoad %int %24 + %26 = OpConvertSToF %float %25 + %27 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %28 = OpLoad %int %27 + %29 = OpConvertSToF %float %28 + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpConvertSToF %float %31 + %33 = OpCompositeConstruct %v4float %23 %26 %29 %32 + OpStore %_GLF_color %33 + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %35 = OpLoad %int %34 + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpSGreaterThan %bool %35 %37 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %39 + %40 = OpLabel + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpCompositeConstruct %v4float %47 %47 %47 %47 + OpStore %_GLF_color %48 + OpBranch %43 + %43 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %52 = OpLoad %int %51 + %53 = OpSGreaterThan %bool %50 %52 + OpBranchConditional %53 %41 %42 + %42 = OpLabel + OpReturn + %39 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..55b3cc6b5f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.hlsl @@ -0,0 +1,50 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; + +void main_1() { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_22 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_25 = asint(x_5[1].x); + const int x_28 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_31 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_22), float(x_25), float(x_28), float(x_31)); + const int x_35 = asint(x_5[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_37 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_35 > x_37)) { + while (true) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_46 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_47 = float(x_46); + x_GLF_color = float4(x_47, x_47, x_47, x_47); + { + const int x_50 = asint(x_5[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_50 > x_52)) { + } else { + break; + } + } + } + return; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..1ade401eab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_5, thread float4* const tint_symbol_4) { + int const x_22 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_25 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_28 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_31 = x_5.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_22), float(x_25), float(x_28), float(x_31)); + int const x_35 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_37 = x_5.x_GLF_uniform_int_values.arr[0].el; + if ((x_35 > x_37)) { + while (true) { + int const x_46 = x_5.x_GLF_uniform_int_values.arr[0].el; + float const x_47 = float(x_46); + *(tint_symbol_4) = float4(x_47, x_47, x_47, x_47); + { + int const x_50 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_52 = x_5.x_GLF_uniform_int_values.arr[0].el; + if ((x_50 > x_52)) { + } else { + break; + } + } + } + return; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..fcf0562d62 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.spvasm @@ -0,0 +1,125 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_5 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %60 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %23 = OpLoad %int %22 + %25 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %26 = OpLoad %int %25 + %27 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %28 = OpLoad %int %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %30 = OpLoad %int %29 + %31 = OpConvertSToF %float %23 + %32 = OpConvertSToF %float %26 + %33 = OpConvertSToF %float %28 + %34 = OpConvertSToF %float %30 + %35 = OpCompositeConstruct %v4float %31 %32 %33 %34 + OpStore %x_GLF_color %35 + %36 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %37 = OpLoad %int %36 + %38 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpSGreaterThan %bool %37 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %42 + %43 = OpLabel + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %x_GLF_color %51 + OpBranch %46 + %46 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpSGreaterThan %bool %53 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + OpBranch %57 + %59 = OpLabel + OpBranch %45 + %57 = OpLabel + OpBranch %44 + %45 = OpLabel + OpReturn + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %60 +%tint_symbol = OpFunctionParameter %main_out + %64 = OpLabel + %65 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %65 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %67 = OpLabel + %68 = OpFunctionCall %void %main_1 + %70 = OpLoad %v4float %x_GLF_color + %71 = OpCompositeConstruct %main_out %70 + %69 = OpFunctionCall %void %tint_symbol_2 %71 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 46[%46] is not post dominated by the back-edge block 57[%57] + %57 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..34719588c3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf1; + +fn main_1() { + let x_22 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_25 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_28 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_31 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_22), f32(x_25), f32(x_28), f32(x_31)); + let x_35 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_37 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_35 > x_37)) { + loop { + let x_46 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_47 : f32 = f32(x_46); + x_GLF_color = vec4(x_47, x_47, x_47, x_47); + + continuing { + let x_50 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_52 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_50 > x_52)) { + } else { + break; + } + } + } + return; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl new file mode 100644 index 0000000000..34719588c3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf1; + +fn main_1() { + let x_22 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_25 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_28 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_31 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_22), f32(x_25), f32(x_28), f32(x_31)); + let x_35 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_37 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_35 > x_37)) { + loop { + let x_46 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_47 : f32 = f32(x_46); + x_GLF_color = vec4(x_47, x_47, x_47, x_47); + + continuing { + let x_50 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_52 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_50 > x_52)) { + } else { + break; + } + } + } + return; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..55b3cc6b5f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.hlsl @@ -0,0 +1,50 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; + +void main_1() { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_22 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_25 = asint(x_5[1].x); + const int x_28 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_31 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_22), float(x_25), float(x_28), float(x_31)); + const int x_35 = asint(x_5[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_37 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_35 > x_37)) { + while (true) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_46 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_47 = float(x_46); + x_GLF_color = float4(x_47, x_47, x_47, x_47); + { + const int x_50 = asint(x_5[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_50 > x_52)) { + } else { + break; + } + } + } + return; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..1ade401eab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_5, thread float4* const tint_symbol_4) { + int const x_22 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_25 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_28 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_31 = x_5.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_22), float(x_25), float(x_28), float(x_31)); + int const x_35 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_37 = x_5.x_GLF_uniform_int_values.arr[0].el; + if ((x_35 > x_37)) { + while (true) { + int const x_46 = x_5.x_GLF_uniform_int_values.arr[0].el; + float const x_47 = float(x_46); + *(tint_symbol_4) = float4(x_47, x_47, x_47, x_47); + { + int const x_50 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_52 = x_5.x_GLF_uniform_int_values.arr[0].el; + if ((x_50 > x_52)) { + } else { + break; + } + } + } + return; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..fcf0562d62 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.spvasm @@ -0,0 +1,125 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_5 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %60 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %23 = OpLoad %int %22 + %25 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %26 = OpLoad %int %25 + %27 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %28 = OpLoad %int %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %30 = OpLoad %int %29 + %31 = OpConvertSToF %float %23 + %32 = OpConvertSToF %float %26 + %33 = OpConvertSToF %float %28 + %34 = OpConvertSToF %float %30 + %35 = OpCompositeConstruct %v4float %31 %32 %33 %34 + OpStore %x_GLF_color %35 + %36 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %37 = OpLoad %int %36 + %38 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpSGreaterThan %bool %37 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %42 + %43 = OpLabel + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %x_GLF_color %51 + OpBranch %46 + %46 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpSGreaterThan %bool %53 %55 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + OpBranch %57 + %59 = OpLabel + OpBranch %45 + %57 = OpLabel + OpBranch %44 + %45 = OpLabel + OpReturn + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %60 +%tint_symbol = OpFunctionParameter %main_out + %64 = OpLabel + %65 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %65 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %67 = OpLabel + %68 = OpFunctionCall %void %main_1 + %70 = OpLoad %v4float %x_GLF_color + %71 = OpCompositeConstruct %main_out %70 + %69 = OpFunctionCall %void %tint_symbol_2 %71 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 46[%46] is not post dominated by the back-edge block 57[%57] + %57 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..34719588c3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf1; + +fn main_1() { + let x_22 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_25 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_28 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_31 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_22), f32(x_25), f32(x_28), f32(x_31)); + let x_35 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_37 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_35 > x_37)) { + loop { + let x_46 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_47 : f32 = f32(x_46); + x_GLF_color = vec4(x_47, x_47, x_47, x_47); + + continuing { + let x_50 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_52 : i32 = x_5.x_GLF_uniform_int_values[0]; + if ((x_50 > x_52)) { + } else { + break; + } + } + } + return; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm new file mode 100644 index 0000000000..aa7576262f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm @@ -0,0 +1,124 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %i "i" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "injectionSwitch" + OpName %__1 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 2 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v3float = OpTypeVector %float 3 + %37 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__1 = OpVariable %_ptr_Uniform_buf2 Uniform + %main = OpFunction %void None %15 + %40 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %21 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %42 = OpLoad %int %41 + OpStore %i %42 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %47 = OpLoad %int %i + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpSLessThan %bool %47 %49 + OpBranchConditional %50 %51 %44 + %51 = OpLabel + %52 = OpLoad %int %i + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %54 = OpLoad %int %53 + %55 = OpINotEqual %bool %52 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + OpReturn + %56 = OpLabel + OpBranch %45 + %45 = OpLabel + %58 = OpLoad %int %i + %59 = OpIAdd %int %58 %int_1 + OpStore %i %59 + OpBranch %43 + %44 = OpLabel + %60 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpFOrdLessThan %bool %61 %63 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + OpReturn + %65 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_float %__1 %int_0 %uint_1 + %68 = OpLoad %float %67 + %69 = OpCompositeExtract %float %37 0 + %70 = OpCompositeExtract %float %37 1 + %71 = OpCompositeExtract %float %37 2 + %72 = OpCompositeConstruct %v4float %69 %70 %71 %68 + OpStore %_GLF_color %72 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..02dc25f283 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.hlsl @@ -0,0 +1,63 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +cbuffer cbuffer_x_11 : register(b2, space0) { + uint4 x_11[1]; +}; + +void main_1() { + int i = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const int x_42 = asint(x_7[1].x); + i = x_42; + while (true) { + const int x_47 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_49 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_47 < x_49)) { + } else { + break; + } + const int x_52 = i; + const int x_54 = asint(x_7[1].x); + if ((x_52 != x_54)) { + return; + } + { + i = (i + 1); + } + } + const float x_61 = gl_FragCoord.y; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_63 = asfloat(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_61 < x_63)) { + return; + } + const float x_68 = asfloat(x_11[0].y); + x_GLF_color = float4(float3(1.0f, 1.0f, 1.0f).x, float3(1.0f, 1.0f, 1.0f).y, float3(1.0f, 1.0f, 1.0f).z, x_68); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4e920ba1a6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_9, constant buf2& x_11, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + int const x_42 = x_7.x_GLF_uniform_int_values.arr[1].el; + i = x_42; + while (true) { + int const x_47 = i; + int const x_49 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_47 < x_49)) { + } else { + break; + } + int const x_52 = i; + int const x_54 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_52 != x_54)) { + return; + } + { + int const x_58 = i; + i = (x_58 + 1); + } + } + float const x_61 = (*(tint_symbol_6)).y; + float const x_63 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_61 < x_63)) { + return; + } + float const x_68 = x_11.injectionSwitch.y; + *(tint_symbol_5) = float4(float3(1.0f, 1.0f, 1.0f).x, float3(1.0f, 1.0f, 1.0f).y, float3(1.0f, 1.0f, 1.0f).z, x_68); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]], constant buf2& x_11 [[buffer(2)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_9, x_11, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f165252dda --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.spvasm @@ -0,0 +1,168 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 93 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "injectionSwitch" + OpName %x_11 "x_11" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 2 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_11 = OpVariable %_ptr_Uniform_buf2 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v3float = OpTypeVector %float 3 + %75 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %27 + %30 = OpLabel + %i = OpVariable %_ptr_Function_int Function %33 + OpStore %x_GLF_color %36 + %40 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %41 = OpLoad %int %40 + OpStore %i %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %int %i + %48 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpSLessThan %bool %46 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %43 + %52 = OpLabel + %55 = OpLoad %int %i + %56 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpINotEqual %bool %55 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + OpReturn + %59 = OpLabel + OpBranch %44 + %44 = OpLabel + %61 = OpLoad %int %i + %62 = OpIAdd %int %61 %int_1 + OpStore %i %62 + OpBranch %42 + %43 = OpLabel + %64 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %65 = OpLoad %float %64 + %67 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpFOrdLessThan %bool %65 %68 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + OpReturn + %70 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_1 + %73 = OpLoad %float %72 + %76 = OpCompositeExtract %float %75 0 + %77 = OpCompositeExtract %float %75 1 + %78 = OpCompositeExtract %float %75 2 + %79 = OpCompositeConstruct %v4float %76 %77 %78 %73 + OpStore %x_GLF_color %79 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %80 +%tint_symbol_1 = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %87 = OpLabel + %88 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %88 + %89 = OpFunctionCall %void %main_1 + %91 = OpLoad %v4float %x_GLF_color + %92 = OpCompositeConstruct %main_out %91 + %90 = OpFunctionCall %void %tint_symbol_3 %92 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..444e50ac08 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.spvasm.expected.wgsl @@ -0,0 +1,73 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[block]] +struct buf2 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +[[group(0), binding(2)]] var x_11 : buf2; + +fn main_1() { + var i : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_42 : i32 = x_7.x_GLF_uniform_int_values[1]; + i = x_42; + loop { + let x_47 : i32 = i; + let x_49 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_47 < x_49)) { + } else { + break; + } + let x_52 : i32 = i; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_52 != x_54)) { + return; + } + + continuing { + let x_58 : i32 = i; + i = (x_58 + 1); + } + } + let x_61 : f32 = gl_FragCoord.y; + let x_63 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_61 < x_63)) { + return; + } + let x_68 : f32 = x_11.injectionSwitch.y; + x_GLF_color = vec4(vec3(1.0, 1.0, 1.0).x, vec3(1.0, 1.0, 1.0).y, vec3(1.0, 1.0, 1.0).z, x_68); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl new file mode 100644 index 0000000000..444e50ac08 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl @@ -0,0 +1,73 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[block]] +struct buf2 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +[[group(0), binding(2)]] var x_11 : buf2; + +fn main_1() { + var i : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_42 : i32 = x_7.x_GLF_uniform_int_values[1]; + i = x_42; + loop { + let x_47 : i32 = i; + let x_49 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_47 < x_49)) { + } else { + break; + } + let x_52 : i32 = i; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_52 != x_54)) { + return; + } + + continuing { + let x_58 : i32 = i; + i = (x_58 + 1); + } + } + let x_61 : f32 = gl_FragCoord.y; + let x_63 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_61 < x_63)) { + return; + } + let x_68 : f32 = x_11.injectionSwitch.y; + x_GLF_color = vec4(vec3(1.0, 1.0, 1.0).x, vec3(1.0, 1.0, 1.0).y, vec3(1.0, 1.0, 1.0).z, x_68); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..02dc25f283 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.hlsl @@ -0,0 +1,63 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +cbuffer cbuffer_x_11 : register(b2, space0) { + uint4 x_11[1]; +}; + +void main_1() { + int i = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const int x_42 = asint(x_7[1].x); + i = x_42; + while (true) { + const int x_47 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_49 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_47 < x_49)) { + } else { + break; + } + const int x_52 = i; + const int x_54 = asint(x_7[1].x); + if ((x_52 != x_54)) { + return; + } + { + i = (i + 1); + } + } + const float x_61 = gl_FragCoord.y; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_63 = asfloat(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_61 < x_63)) { + return; + } + const float x_68 = asfloat(x_11[0].y); + x_GLF_color = float4(float3(1.0f, 1.0f, 1.0f).x, float3(1.0f, 1.0f, 1.0f).y, float3(1.0f, 1.0f, 1.0f).z, x_68); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4e920ba1a6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_9, constant buf2& x_11, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + int const x_42 = x_7.x_GLF_uniform_int_values.arr[1].el; + i = x_42; + while (true) { + int const x_47 = i; + int const x_49 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_47 < x_49)) { + } else { + break; + } + int const x_52 = i; + int const x_54 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_52 != x_54)) { + return; + } + { + int const x_58 = i; + i = (x_58 + 1); + } + } + float const x_61 = (*(tint_symbol_6)).y; + float const x_63 = x_9.x_GLF_uniform_float_values.arr[0].el; + if ((x_61 < x_63)) { + return; + } + float const x_68 = x_11.injectionSwitch.y; + *(tint_symbol_5) = float4(float3(1.0f, 1.0f, 1.0f).x, float3(1.0f, 1.0f, 1.0f).y, float3(1.0f, 1.0f, 1.0f).z, x_68); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]], constant buf2& x_11 [[buffer(2)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_9, x_11, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f165252dda --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.spvasm @@ -0,0 +1,168 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 93 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_9 "x_9" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "injectionSwitch" + OpName %x_11 "x_11" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 2 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_11 = OpVariable %_ptr_Uniform_buf2 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v3float = OpTypeVector %float 3 + %75 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %27 + %30 = OpLabel + %i = OpVariable %_ptr_Function_int Function %33 + OpStore %x_GLF_color %36 + %40 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %41 = OpLoad %int %40 + OpStore %i %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %int %i + %48 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpSLessThan %bool %46 %49 + OpSelectionMerge %52 None + OpBranchConditional %50 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %43 + %52 = OpLabel + %55 = OpLoad %int %i + %56 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpINotEqual %bool %55 %57 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + OpReturn + %59 = OpLabel + OpBranch %44 + %44 = OpLabel + %61 = OpLoad %int %i + %62 = OpIAdd %int %61 %int_1 + OpStore %i %62 + OpBranch %42 + %43 = OpLabel + %64 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %65 = OpLoad %float %64 + %67 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpFOrdLessThan %bool %65 %68 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + OpReturn + %70 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_1 + %73 = OpLoad %float %72 + %76 = OpCompositeExtract %float %75 0 + %77 = OpCompositeExtract %float %75 1 + %78 = OpCompositeExtract %float %75 2 + %79 = OpCompositeConstruct %v4float %76 %77 %78 %73 + OpStore %x_GLF_color %79 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %80 +%tint_symbol_1 = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %87 = OpLabel + %88 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %88 + %89 = OpFunctionCall %void %main_1 + %91 = OpLoad %v4float %x_GLF_color + %92 = OpCompositeConstruct %main_out %91 + %90 = OpFunctionCall %void %tint_symbol_3 %92 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..444e50ac08 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-first-iteration/0-opt.wgsl.expected.wgsl @@ -0,0 +1,73 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[block]] +struct buf2 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +[[group(0), binding(2)]] var x_11 : buf2; + +fn main_1() { + var i : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_42 : i32 = x_7.x_GLF_uniform_int_values[1]; + i = x_42; + loop { + let x_47 : i32 = i; + let x_49 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_47 < x_49)) { + } else { + break; + } + let x_52 : i32 = i; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_52 != x_54)) { + return; + } + + continuing { + let x_58 : i32 = i; + i = (x_58 + 1); + } + } + let x_61 : f32 = gl_FragCoord.y; + let x_63 : f32 = x_9.x_GLF_uniform_float_values[0]; + if ((x_61 < x_63)) { + return; + } + let x_68 : f32 = x_11.injectionSwitch.y; + x_GLF_color = vec4(vec3(1.0, 1.0, 1.0).x, vec3(1.0, 1.0, 1.0).y, vec3(1.0, 1.0, 1.0).z, x_68); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm new file mode 100644 index 0000000000..b32d8659b4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm @@ -0,0 +1,120 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %func_ "func(" + OpName %v "v" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %a "a" + OpName %indexable "indexable" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %18 = OpTypeFunction %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %uint_3 = OpConstant %uint 3 +%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 +%_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %15 + %39 = OpLabel + %40 = OpFunctionCall %v2float %func_ + %41 = OpCompositeExtract %float %40 1 + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %43 = OpLoad %float %42 + %44 = OpFOrdEqual %bool %41 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpConvertSToF %float %49 + %51 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %52 = OpLoad %int %51 + %53 = OpConvertSToF %float %52 + %54 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpCompositeConstruct %v4float %50 %53 %56 %59 + OpStore %_GLF_color %60 + OpBranch %45 + %47 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpCompositeConstruct %v4float %63 %63 %63 %63 + OpStore %_GLF_color %64 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %v2float None %18 + %65 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function + %a = OpVariable %_ptr_Function_int Function + %indexable = OpVariable %_ptr_Function__arr_v2float_uint_3 Function + %66 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %67 = OpLoad %float %66 + %68 = OpAccessChain %_ptr_Function_float %v %uint_1 + OpStore %68 %67 + OpStore %a %int_2 + %69 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %70 = OpLoad %float %69 + %71 = OpCompositeConstruct %v2float %70 %70 + %72 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %73 = OpLoad %float %72 + %74 = OpCompositeConstruct %v2float %73 %73 + %75 = OpLoad %v2float %v + %76 = OpCompositeConstruct %_arr_v2float_uint_3 %71 %74 %75 + %77 = OpLoad %int %a + OpStore %indexable %76 + %78 = OpAccessChain %_ptr_Function_v2float %indexable %77 + %79 = OpLoad %v2float %78 + OpReturnValue %79 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..c33dd5cce6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[2]; +}; + +float2 func_() { + float2 v = float2(0.0f, 0.0f); + int a = 0; + float2 indexable[3] = (float2[3])0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_67 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + v.y = x_67; + a = 2; + const float x_70 = asfloat(x_7[1].x); + const float x_73 = asfloat(x_7[1].x); + const int x_77 = a; + const float2 tint_symbol_4[3] = {float2(x_70, x_70), float2(x_73, x_73), v}; + indexable = tint_symbol_4; + const float2 x_79 = indexable[x_77]; + return x_79; +} + +void main_1() { + const float2 x_40 = func_(); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_43 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_40.y == x_43)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_52 = asint(x_11[1].x); + const int x_55 = asint(x_11[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_58 = asint(x_11[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_49), float(x_52), float(x_55), float(x_58)); + } else { + const int x_62 = asint(x_11[1].x); + const float x_63 = float(x_62); + x_GLF_color = float4(x_63, x_63, x_63, x_63); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d54821f844 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float2 arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float2 func_(constant buf0& x_7) { + float2 v = 0.0f; + int a = 0; + tint_array_wrapper_2 indexable = {}; + float const x_67 = x_7.x_GLF_uniform_float_values.arr[0].el; + v.y = x_67; + a = 2; + float const x_70 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_73 = x_7.x_GLF_uniform_float_values.arr[1].el; + float2 const x_75 = v; + int const x_77 = a; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={float2(x_70, x_70), float2(x_73, x_73), x_75}}; + indexable = tint_symbol_3; + float2 const x_79 = indexable.arr[x_77]; + return x_79; +} + +void main_1(constant buf0& x_7, constant buf1& x_11, thread float4* const tint_symbol_5) { + float2 const x_40 = func_(x_7); + float const x_43 = x_7.x_GLF_uniform_float_values.arr[0].el; + if ((x_40.y == x_43)) { + int const x_49 = x_11.x_GLF_uniform_int_values.arr[0].el; + int const x_52 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_55 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_58 = x_11.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_49), float(x_52), float(x_55), float(x_58)); + } else { + int const x_62 = x_11.x_GLF_uniform_int_values.arr[1].el; + float const x_63 = float(x_62); + *(tint_symbol_5) = float4(x_63, x_63, x_63, x_63); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, x_11, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b6b2b5747d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.spvasm @@ -0,0 +1,157 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_11 "x_11" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %v "v" + OpName %a "a" + OpName %indexable "indexable" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_v2float_uint_3 ArrayStride 8 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %v2float = OpTypeVector %float 2 + %19 = OpTypeFunction %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %25 = OpConstantNull %v2float +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_3 = OpConstant %uint 3 +%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 +%_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3 + %33 = OpConstantNull %_arr_v2float_uint_3 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %55 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %86 = OpTypeFunction %void %main_out + %func_ = OpFunction %v2float None %19 + %22 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %25 + %a = OpVariable %_ptr_Function_int Function %28 + %indexable = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %33 + %37 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %38 = OpLoad %float %37 + %41 = OpAccessChain %_ptr_Function_float %v %uint_1 + OpStore %41 %38 + OpStore %a %int_2 + %44 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %47 = OpLoad %float %46 + %48 = OpLoad %v2float %v + %49 = OpLoad %int %a + %50 = OpCompositeConstruct %v2float %45 %45 + %51 = OpCompositeConstruct %v2float %47 %47 + %52 = OpCompositeConstruct %_arr_v2float_uint_3 %50 %51 %48 + OpStore %indexable %52 + %53 = OpAccessChain %_ptr_Function_v2float %indexable %49 + %54 = OpLoad %v2float %53 + OpReturnValue %54 + OpFunctionEnd + %main_1 = OpFunction %void None %55 + %58 = OpLabel + %59 = OpFunctionCall %v2float %func_ + %60 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpCompositeExtract %float %59 1 + %63 = OpFOrdEqual %bool %62 %61 + OpSelectionMerge %65 None + OpBranchConditional %63 %66 %67 + %66 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %70 + %78 = OpConvertSToF %float %72 + %79 = OpConvertSToF %float %74 + %80 = OpConvertSToF %float %76 + %81 = OpCompositeConstruct %v4float %77 %78 %79 %80 + OpStore %x_GLF_color %81 + OpBranch %65 + %67 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpConvertSToF %float %83 + %85 = OpCompositeConstruct %v4float %84 %84 %84 %84 + OpStore %x_GLF_color %85 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %86 +%tint_symbol = OpFunctionParameter %main_out + %90 = OpLabel + %91 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %91 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %55 + %93 = OpLabel + %94 = OpFunctionCall %void %main_1 + %96 = OpLoad %v4float %x_GLF_color + %97 = OpCompositeConstruct %main_out %96 + %95 = OpFunctionCall %void %tint_symbol_2 %97 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..6a66f390bb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.spvasm.expected.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_11 : buf1; + +fn func_() -> vec2 { + var v : vec2; + var a : i32; + var indexable : array, 3>; + let x_67 : f32 = x_7.x_GLF_uniform_float_values[0]; + v.y = x_67; + a = 2; + let x_70 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_73 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_75 : vec2 = v; + let x_77 : i32 = a; + indexable = array, 3>(vec2(x_70, x_70), vec2(x_73, x_73), x_75); + let x_79 : vec2 = indexable[x_77]; + return x_79; +} + +fn main_1() { + let x_40 : vec2 = func_(); + let x_43 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_40.y == x_43)) { + let x_49 : i32 = x_11.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_55 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_58 : i32 = x_11.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_49), f32(x_52), f32(x_55), f32(x_58)); + } else { + let x_62 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_63 : f32 = f32(x_62); + x_GLF_color = vec4(x_63, x_63, x_63, x_63); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl new file mode 100644 index 0000000000..6a66f390bb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_11 : buf1; + +fn func_() -> vec2 { + var v : vec2; + var a : i32; + var indexable : array, 3>; + let x_67 : f32 = x_7.x_GLF_uniform_float_values[0]; + v.y = x_67; + a = 2; + let x_70 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_73 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_75 : vec2 = v; + let x_77 : i32 = a; + indexable = array, 3>(vec2(x_70, x_70), vec2(x_73, x_73), x_75); + let x_79 : vec2 = indexable[x_77]; + return x_79; +} + +fn main_1() { + let x_40 : vec2 = func_(); + let x_43 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_40.y == x_43)) { + let x_49 : i32 = x_11.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_55 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_58 : i32 = x_11.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_49), f32(x_52), f32(x_55), f32(x_58)); + } else { + let x_62 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_63 : f32 = f32(x_62); + x_GLF_color = vec4(x_63, x_63, x_63, x_63); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..c33dd5cce6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[2]; +}; + +float2 func_() { + float2 v = float2(0.0f, 0.0f); + int a = 0; + float2 indexable[3] = (float2[3])0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_67 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + v.y = x_67; + a = 2; + const float x_70 = asfloat(x_7[1].x); + const float x_73 = asfloat(x_7[1].x); + const int x_77 = a; + const float2 tint_symbol_4[3] = {float2(x_70, x_70), float2(x_73, x_73), v}; + indexable = tint_symbol_4; + const float2 x_79 = indexable[x_77]; + return x_79; +} + +void main_1() { + const float2 x_40 = func_(); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_43 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_40.y == x_43)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_11[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_52 = asint(x_11[1].x); + const int x_55 = asint(x_11[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_58 = asint(x_11[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_49), float(x_52), float(x_55), float(x_58)); + } else { + const int x_62 = asint(x_11[1].x); + const float x_63 = float(x_62); + x_GLF_color = float4(x_63, x_63, x_63, x_63); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d54821f844 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float2 arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float2 func_(constant buf0& x_7) { + float2 v = 0.0f; + int a = 0; + tint_array_wrapper_2 indexable = {}; + float const x_67 = x_7.x_GLF_uniform_float_values.arr[0].el; + v.y = x_67; + a = 2; + float const x_70 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_73 = x_7.x_GLF_uniform_float_values.arr[1].el; + float2 const x_75 = v; + int const x_77 = a; + tint_array_wrapper_2 const tint_symbol_3 = {.arr={float2(x_70, x_70), float2(x_73, x_73), x_75}}; + indexable = tint_symbol_3; + float2 const x_79 = indexable.arr[x_77]; + return x_79; +} + +void main_1(constant buf0& x_7, constant buf1& x_11, thread float4* const tint_symbol_5) { + float2 const x_40 = func_(x_7); + float const x_43 = x_7.x_GLF_uniform_float_values.arr[0].el; + if ((x_40.y == x_43)) { + int const x_49 = x_11.x_GLF_uniform_int_values.arr[0].el; + int const x_52 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_55 = x_11.x_GLF_uniform_int_values.arr[1].el; + int const x_58 = x_11.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_49), float(x_52), float(x_55), float(x_58)); + } else { + int const x_62 = x_11.x_GLF_uniform_int_values.arr[1].el; + float const x_63 = float(x_62); + *(tint_symbol_5) = float4(x_63, x_63, x_63, x_63); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, x_11, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b6b2b5747d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.spvasm @@ -0,0 +1,157 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_11 "x_11" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %v "v" + OpName %a "a" + OpName %indexable "indexable" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_v2float_uint_3 ArrayStride 8 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %v2float = OpTypeVector %float 2 + %19 = OpTypeFunction %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %25 = OpConstantNull %v2float +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_3 = OpConstant %uint 3 +%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 +%_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3 + %33 = OpConstantNull %_arr_v2float_uint_3 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %55 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %86 = OpTypeFunction %void %main_out + %func_ = OpFunction %v2float None %19 + %22 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %25 + %a = OpVariable %_ptr_Function_int Function %28 + %indexable = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %33 + %37 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %38 = OpLoad %float %37 + %41 = OpAccessChain %_ptr_Function_float %v %uint_1 + OpStore %41 %38 + OpStore %a %int_2 + %44 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %47 = OpLoad %float %46 + %48 = OpLoad %v2float %v + %49 = OpLoad %int %a + %50 = OpCompositeConstruct %v2float %45 %45 + %51 = OpCompositeConstruct %v2float %47 %47 + %52 = OpCompositeConstruct %_arr_v2float_uint_3 %50 %51 %48 + OpStore %indexable %52 + %53 = OpAccessChain %_ptr_Function_v2float %indexable %49 + %54 = OpLoad %v2float %53 + OpReturnValue %54 + OpFunctionEnd + %main_1 = OpFunction %void None %55 + %58 = OpLabel + %59 = OpFunctionCall %v2float %func_ + %60 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpCompositeExtract %float %59 1 + %63 = OpFOrdEqual %bool %62 %61 + OpSelectionMerge %65 None + OpBranchConditional %63 %66 %67 + %66 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %70 + %78 = OpConvertSToF %float %72 + %79 = OpConvertSToF %float %74 + %80 = OpConvertSToF %float %76 + %81 = OpCompositeConstruct %v4float %77 %78 %79 %80 + OpStore %x_GLF_color %81 + OpBranch %65 + %67 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_int %x_11 %uint_0 %int_1 + %83 = OpLoad %int %82 + %84 = OpConvertSToF %float %83 + %85 = OpCompositeConstruct %v4float %84 %84 %84 %84 + OpStore %x_GLF_color %85 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %86 +%tint_symbol = OpFunctionParameter %main_out + %90 = OpLabel + %91 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %91 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %55 + %93 = OpLabel + %94 = OpFunctionCall %void %main_1 + %96 = OpLoad %v4float %x_GLF_color + %97 = OpCompositeConstruct %main_out %96 + %95 = OpFunctionCall %void %tint_symbol_2 %97 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..6a66f390bb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-return-partly-undefined-vector-from-array/0-opt.wgsl.expected.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_11 : buf1; + +fn func_() -> vec2 { + var v : vec2; + var a : i32; + var indexable : array, 3>; + let x_67 : f32 = x_7.x_GLF_uniform_float_values[0]; + v.y = x_67; + a = 2; + let x_70 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_73 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_75 : vec2 = v; + let x_77 : i32 = a; + indexable = array, 3>(vec2(x_70, x_70), vec2(x_73, x_73), x_75); + let x_79 : vec2 = indexable[x_77]; + return x_79; +} + +fn main_1() { + let x_40 : vec2 = func_(); + let x_43 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_40.y == x_43)) { + let x_49 : i32 = x_11.x_GLF_uniform_int_values[0]; + let x_52 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_55 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_58 : i32 = x_11.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_49), f32(x_52), f32(x_55), f32(x_58)); + } else { + let x_62 : i32 = x_11.x_GLF_uniform_int_values[1]; + let x_63 : f32 = f32(x_62); + x_GLF_color = vec4(x_63, x_63, x_63, x_63); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm new file mode 100644 index 0000000000..1437592347 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm @@ -0,0 +1,431 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %sums "sums" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %d "d" + OpName %e "e" + OpName %f "f" + OpName %g "g" + OpName %h "h" + OpName %i "i" + OpName %j "j" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_7 ArrayStride 16 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %20 RelaxedPrecision + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %22 RelaxedPrecision + OpDecorate %a RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %b RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %c RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %d RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %e RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %f RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %g RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %h RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %i RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %j RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %54 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + OpDecorate %59 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + OpDecorate %61 RelaxedPrecision + OpDecorate %62 RelaxedPrecision + OpDecorate %63 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %65 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %67 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %69 RelaxedPrecision + OpDecorate %70 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %74 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %76 RelaxedPrecision + OpDecorate %77 RelaxedPrecision + OpDecorate %78 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + %void = OpTypeVoid + %82 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %int = OpTypeInt 32 1 + %uint_7 = OpConstant %uint 7 +%_arr_int_uint_7 = OpTypeArray %int %uint_7 + %buf0 = OpTypeStruct %_arr_int_uint_7 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool + %int_5 = OpConstant %int 5 + %int_3 = OpConstant %int 3 + %int_6 = OpConstant %int 6 + %int_4 = OpConstant %int 4 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %82 + %107 = OpLabel + %sums = OpVariable %_ptr_Function__arr_float_uint_2 Function + %a = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_int Function + %c = OpVariable %_ptr_Function_int Function + %d = OpVariable %_ptr_Function_int Function + %e = OpVariable %_ptr_Function_int Function + %f = OpVariable %_ptr_Function_int Function + %g = OpVariable %_ptr_Function_int Function + %h = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %108 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %20 = OpLoad %int %108 + %109 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %110 = OpLoad %float %109 + %111 = OpAccessChain %_ptr_Function_float %sums %20 + OpStore %111 %110 + %112 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %22 = OpLoad %int %112 + %113 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %114 = OpLoad %float %113 + %115 = OpAccessChain %_ptr_Function_float %sums %22 + OpStore %115 %114 + %116 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %23 = OpLoad %int %116 + OpStore %a %23 + OpBranch %117 + %117 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %24 = OpLoad %int %a + %121 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %25 = OpLoad %int %121 + %122 = OpSLessThan %bool %24 %25 + OpBranchConditional %122 %123 %118 + %123 = OpLabel + %124 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %26 = OpLoad %int %124 + OpStore %b %26 + OpBranch %125 + %125 = OpLabel + OpLoopMerge %126 %127 None + OpBranch %128 + %128 = OpLabel + %27 = OpLoad %int %b + %129 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %28 = OpLoad %int %129 + %130 = OpSLessThan %bool %27 %28 + OpBranchConditional %130 %131 %126 + %131 = OpLabel + %132 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %29 = OpLoad %int %132 + OpStore %c %29 + OpBranch %133 + %133 = OpLabel + OpLoopMerge %134 %135 None + OpBranch %136 + %136 = OpLabel + %30 = OpLoad %int %c + %137 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %31 = OpLoad %int %137 + %138 = OpSLessThanEqual %bool %30 %31 + OpBranchConditional %138 %139 %134 + %139 = OpLabel + %140 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %32 = OpLoad %int %140 + OpStore %d %32 + OpBranch %141 + %141 = OpLabel + OpLoopMerge %142 %143 None + OpBranch %144 + %144 = OpLabel + %33 = OpLoad %int %d + %145 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %34 = OpLoad %int %145 + %146 = OpSLessThan %bool %33 %34 + OpBranchConditional %146 %147 %142 + %147 = OpLabel + %148 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %35 = OpLoad %int %148 + OpStore %e %35 + OpBranch %149 + %149 = OpLabel + OpLoopMerge %150 %151 None + OpBranch %152 + %152 = OpLabel + %36 = OpLoad %int %e + %153 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %37 = OpLoad %int %153 + %154 = OpSLessThanEqual %bool %36 %37 + OpBranchConditional %154 %155 %150 + %155 = OpLabel + %156 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %38 = OpLoad %int %156 + OpStore %f %38 + OpBranch %157 + %157 = OpLabel + OpLoopMerge %158 %159 None + OpBranch %160 + %160 = OpLabel + %39 = OpLoad %int %f + %161 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %40 = OpLoad %int %161 + %162 = OpSLessThan %bool %39 %40 + OpBranchConditional %162 %163 %158 + %163 = OpLabel + %164 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %41 = OpLoad %int %164 + OpStore %g %41 + OpBranch %165 + %165 = OpLabel + OpLoopMerge %166 %167 None + OpBranch %168 + %168 = OpLabel + %42 = OpLoad %int %g + %169 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %43 = OpLoad %int %169 + %170 = OpSLessThan %bool %42 %43 + OpBranchConditional %170 %171 %166 + %171 = OpLabel + %172 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %44 = OpLoad %int %172 + OpStore %h %44 + OpBranch %173 + %173 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %45 = OpLoad %int %h + %177 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %46 = OpLoad %int %177 + %178 = OpSLessThan %bool %45 %46 + OpBranchConditional %178 %179 %174 + %179 = OpLabel + %180 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %47 = OpLoad %int %180 + OpStore %i %47 + OpBranch %181 + %181 = OpLabel + OpLoopMerge %182 %183 None + OpBranch %184 + %184 = OpLabel + %48 = OpLoad %int %i + %185 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %49 = OpLoad %int %185 + %186 = OpSLessThan %bool %48 %49 + OpBranchConditional %186 %187 %182 + %187 = OpLabel + %188 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %50 = OpLoad %int %188 + OpStore %j %50 + OpBranch %189 + %189 = OpLabel + OpLoopMerge %190 %191 None + OpBranch %192 + %192 = OpLabel + %51 = OpLoad %int %j + %193 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %52 = OpLoad %int %193 + %194 = OpSGreaterThan %bool %51 %52 + OpBranchConditional %194 %195 %190 + %195 = OpLabel + %53 = OpLoad %int %a + %196 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_2 + %197 = OpLoad %float %196 + %198 = OpAccessChain %_ptr_Function_float %sums %53 + %199 = OpLoad %float %198 + %200 = OpFAdd %float %199 %197 + %201 = OpAccessChain %_ptr_Function_float %sums %53 + OpStore %201 %200 + OpBranch %191 + %191 = OpLabel + %54 = OpLoad %int %j + %55 = OpISub %int %54 %int_1 + OpStore %j %55 + OpBranch %189 + %190 = OpLabel + OpBranch %183 + %183 = OpLabel + %56 = OpLoad %int %i + %57 = OpIAdd %int %56 %int_1 + OpStore %i %57 + OpBranch %181 + %182 = OpLabel + OpBranch %175 + %175 = OpLabel + %58 = OpLoad %int %h + %59 = OpIAdd %int %58 %int_1 + OpStore %h %59 + OpBranch %173 + %174 = OpLabel + OpBranch %167 + %167 = OpLabel + %60 = OpLoad %int %g + %61 = OpIAdd %int %60 %int_1 + OpStore %g %61 + OpBranch %165 + %166 = OpLabel + OpBranch %159 + %159 = OpLabel + %62 = OpLoad %int %f + %63 = OpIAdd %int %62 %int_1 + OpStore %f %63 + OpBranch %157 + %158 = OpLabel + OpBranch %151 + %151 = OpLabel + %64 = OpLoad %int %e + %65 = OpIAdd %int %64 %int_1 + OpStore %e %65 + OpBranch %149 + %150 = OpLabel + OpBranch %143 + %143 = OpLabel + %66 = OpLoad %int %d + %67 = OpIAdd %int %66 %int_1 + OpStore %d %67 + OpBranch %141 + %142 = OpLabel + OpBranch %135 + %135 = OpLabel + %68 = OpLoad %int %c + %69 = OpIAdd %int %68 %int_1 + OpStore %c %69 + OpBranch %133 + %134 = OpLabel + OpBranch %127 + %127 = OpLabel + %70 = OpLoad %int %b + %71 = OpIAdd %int %70 %int_1 + OpStore %b %71 + OpBranch %125 + %126 = OpLabel + OpBranch %119 + %119 = OpLabel + %72 = OpLoad %int %a + %73 = OpIAdd %int %72 %int_1 + OpStore %a %73 + OpBranch %117 + %118 = OpLabel + %202 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %74 = OpLoad %int %202 + %203 = OpAccessChain %_ptr_Function_float %sums %74 + %204 = OpLoad %float %203 + %205 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %206 = OpLoad %float %205 + %207 = OpFOrdEqual %bool %204 %206 + OpSelectionMerge %208 None + OpBranchConditional %207 %209 %208 + %209 = OpLabel + %210 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %75 = OpLoad %int %210 + %211 = OpAccessChain %_ptr_Function_float %sums %75 + %212 = OpLoad %float %211 + %213 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %214 = OpLoad %float %213 + %215 = OpFOrdEqual %bool %212 %214 + OpBranch %208 + %208 = OpLabel + %216 = OpPhi %bool %207 %118 %215 %209 + OpSelectionMerge %217 None + OpBranchConditional %216 %218 %219 + %218 = OpLabel + %220 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %76 = OpLoad %int %220 + %221 = OpConvertSToF %float %76 + %222 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %77 = OpLoad %int %222 + %223 = OpConvertSToF %float %77 + %224 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %78 = OpLoad %int %224 + %225 = OpConvertSToF %float %78 + %226 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %79 = OpLoad %int %226 + %227 = OpConvertSToF %float %79 + %228 = OpCompositeConstruct %v4float %221 %223 %225 %227 + OpStore %_GLF_color %228 + OpBranch %217 + %219 = OpLabel + %229 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %80 = OpLoad %int %229 + %230 = OpConvertSToF %float %80 + %231 = OpCompositeConstruct %v4float %230 %230 %230 %230 + OpStore %_GLF_color %231 + OpBranch %217 + %217 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..5d63b9b65c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.hlsl @@ -0,0 +1,208 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[7]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float sums[2] = (float[2])0; + int a = 0; + int b = 0; + int c = 0; + int d = 0; + int e = 0; + int f = 0; + int g = 0; + int h = 0; + int i = 0; + int j = 0; + bool x_215 = false; + bool x_216_phi = false; + const int x_20 = asint(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_110 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + sums[x_20] = x_110; + const int x_22 = asint(x_6[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_114 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + sums[x_22] = x_114; + const int x_23 = asint(x_6[1].x); + a = x_23; + while (true) { + const int x_24 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_25 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_24 < x_25)) { + } else { + break; + } + const int x_26 = asint(x_6[5].x); + b = x_26; + while (true) { + const int x_27 = b; + const int x_28 = asint(x_6[3].x); + if ((x_27 < x_28)) { + } else { + break; + } + const int x_29 = asint(x_6[6].x); + c = x_29; + while (true) { + const int x_30 = c; + const int x_31 = asint(x_6[4].x); + if ((x_30 <= x_31)) { + } else { + break; + } + const int x_32 = asint(x_6[1].x); + d = x_32; + while (true) { + const int x_33 = d; + const int x_34 = asint(x_6[6].x); + if ((x_33 < x_34)) { + } else { + break; + } + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_35 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + e = x_35; + while (true) { + const int x_36 = e; + const int x_37 = asint(x_6[4].x); + if ((x_36 <= x_37)) { + } else { + break; + } + const int x_38 = asint(x_6[1].x); + f = x_38; + while (true) { + const int x_39 = f; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_39 < x_40)) { + } else { + break; + } + const int x_41 = asint(x_6[1].x); + g = x_41; + while (true) { + const int x_42 = g; + const int x_43 = asint(x_6[6].x); + if ((x_42 < x_43)) { + } else { + break; + } + const int x_44 = asint(x_6[1].x); + h = x_44; + while (true) { + const int x_45 = h; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_46 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_45 < x_46)) { + } else { + break; + } + const int x_47 = asint(x_6[1].x); + i = x_47; + while (true) { + const int x_48 = i; + const int x_49 = asint(x_6[4].x); + if ((x_48 < x_49)) { + } else { + break; + } + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); + j = x_50; + while (true) { + const int x_51 = j; + const int x_52 = asint(x_6[1].x); + if ((x_51 > x_52)) { + } else { + break; + } + const int x_53 = a; + const float x_197 = asfloat(x_8[2].x); + const float x_199 = sums[x_53]; + sums[x_53] = (x_199 + x_197); + { + j = (j - 1); + } + } + { + i = (i + 1); + } + } + { + h = (h + 1); + } + } + { + g = (g + 1); + } + } + { + f = (f + 1); + } + } + { + e = (e + 1); + } + } + { + d = (d + 1); + } + } + { + c = (c + 1); + } + } + { + b = (b + 1); + } + } + { + a = (a + 1); + } + } + const int x_74 = asint(x_6[1].x); + const float x_204 = sums[x_74]; + const float x_206 = asfloat(x_8[1].x); + const bool x_207 = (x_204 == x_206); + x_216_phi = x_207; + if (x_207) { + const int x_75 = asint(x_6[2].x); + const float x_212 = sums[x_75]; + const float x_214 = asfloat(x_8[1].x); + x_215 = (x_212 == x_214); + x_216_phi = x_215; + } + if (x_216_phi) { + const int x_76 = asint(x_6[2].x); + const int x_77 = asint(x_6[1].x); + const int x_78 = asint(x_6[1].x); + const int x_79 = asint(x_6[2].x); + x_GLF_color = float4(float(x_76), float(x_77), float(x_78), float(x_79)); + } else { + const int x_80 = asint(x_6[1].x); + const float x_230 = float(x_80); + x_GLF_color = float4(x_230, x_230, x_230, x_230); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..14a2550238 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.msl @@ -0,0 +1,232 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[7]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + float arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + tint_array_wrapper_2 sums = {}; + int a = 0; + int b = 0; + int c = 0; + int d = 0; + int e = 0; + int f = 0; + int g = 0; + int h = 0; + int i = 0; + int j = 0; + bool x_215 = false; + bool x_216_phi = false; + int const x_20 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_110 = x_8.x_GLF_uniform_float_values.arr[0].el; + sums.arr[x_20] = x_110; + int const x_22 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_114 = x_8.x_GLF_uniform_float_values.arr[0].el; + sums.arr[x_22] = x_114; + int const x_23 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_23; + while (true) { + int const x_24 = a; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_24 < x_25)) { + } else { + break; + } + int const x_26 = x_6.x_GLF_uniform_int_values.arr[5].el; + b = x_26; + while (true) { + int const x_27 = b; + int const x_28 = x_6.x_GLF_uniform_int_values.arr[3].el; + if ((x_27 < x_28)) { + } else { + break; + } + int const x_29 = x_6.x_GLF_uniform_int_values.arr[6].el; + c = x_29; + while (true) { + int const x_30 = c; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[4].el; + if ((x_30 <= x_31)) { + } else { + break; + } + int const x_32 = x_6.x_GLF_uniform_int_values.arr[1].el; + d = x_32; + while (true) { + int const x_33 = d; + int const x_34 = x_6.x_GLF_uniform_int_values.arr[6].el; + if ((x_33 < x_34)) { + } else { + break; + } + int const x_35 = x_6.x_GLF_uniform_int_values.arr[0].el; + e = x_35; + while (true) { + int const x_36 = e; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[4].el; + if ((x_36 <= x_37)) { + } else { + break; + } + int const x_38 = x_6.x_GLF_uniform_int_values.arr[1].el; + f = x_38; + while (true) { + int const x_39 = f; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_39 < x_40)) { + } else { + break; + } + int const x_41 = x_6.x_GLF_uniform_int_values.arr[1].el; + g = x_41; + while (true) { + int const x_42 = g; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[6].el; + if ((x_42 < x_43)) { + } else { + break; + } + int const x_44 = x_6.x_GLF_uniform_int_values.arr[1].el; + h = x_44; + while (true) { + int const x_45 = h; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_45 < x_46)) { + } else { + break; + } + int const x_47 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_47; + while (true) { + int const x_48 = i; + int const x_49 = x_6.x_GLF_uniform_int_values.arr[4].el; + if ((x_48 < x_49)) { + } else { + break; + } + int const x_50 = x_6.x_GLF_uniform_int_values.arr[0].el; + j = x_50; + while (true) { + int const x_51 = j; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_51 > x_52)) { + } else { + break; + } + int const x_53 = a; + float const x_197 = x_8.x_GLF_uniform_float_values.arr[2].el; + float const x_199 = sums.arr[x_53]; + sums.arr[x_53] = (x_199 + x_197); + { + int const x_54 = j; + j = (x_54 - 1); + } + } + { + int const x_56 = i; + i = (x_56 + 1); + } + } + { + int const x_58 = h; + h = (x_58 + 1); + } + } + { + int const x_60 = g; + g = (x_60 + 1); + } + } + { + int const x_62 = f; + f = (x_62 + 1); + } + } + { + int const x_64 = e; + e = (x_64 + 1); + } + } + { + int const x_66 = d; + d = (x_66 + 1); + } + } + { + int const x_68 = c; + c = (x_68 + 1); + } + } + { + int const x_70 = b; + b = (x_70 + 1); + } + } + { + int const x_72 = a; + a = (x_72 + 1); + } + } + int const x_74 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_204 = sums.arr[x_74]; + float const x_206 = x_8.x_GLF_uniform_float_values.arr[1].el; + bool const x_207 = (x_204 == x_206); + x_216_phi = x_207; + if (x_207) { + int const x_75 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_212 = sums.arr[x_75]; + float const x_214 = x_8.x_GLF_uniform_float_values.arr[1].el; + x_215 = (x_212 == x_214); + x_216_phi = x_215; + } + bool const x_216 = x_216_phi; + if (x_216) { + int const x_76 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_77 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_79 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_76), float(x_77), float(x_78), float(x_79)); + } else { + int const x_80 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_230 = float(x_80); + *(tint_symbol_4) = float4(x_230, x_230, x_230, x_230); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..504fead676 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.spvasm @@ -0,0 +1,456 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 274 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %sums "sums" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %d "d" + OpName %e "e" + OpName %f "f" + OpName %g "g" + OpName %h "h" + OpName %i "i" + OpName %j "j" + OpName %x_215 "x_215" + OpName %x_216_phi "x_216_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_7 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_7 = OpConstant %uint 7 +%_arr_int_uint_7 = OpTypeArray %int %uint_7 + %buf0 = OpTypeStruct %_arr_int_uint_7 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %28 = OpConstantNull %_arr_float_uint_2 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %44 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 + %int_5 = OpConstant %int 5 + %int_3 = OpConstant %int 3 + %int_6 = OpConstant %int 6 + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %262 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %sums = OpVariable %_ptr_Function__arr_float_uint_2 Function %28 + %a = OpVariable %_ptr_Function_int Function %31 + %b = OpVariable %_ptr_Function_int Function %31 + %c = OpVariable %_ptr_Function_int Function %31 + %d = OpVariable %_ptr_Function_int Function %31 + %e = OpVariable %_ptr_Function_int Function %31 + %f = OpVariable %_ptr_Function_int Function %31 + %g = OpVariable %_ptr_Function_int Function %31 + %h = OpVariable %_ptr_Function_int Function %31 + %i = OpVariable %_ptr_Function_int Function %31 + %j = OpVariable %_ptr_Function_int Function %31 + %x_215 = OpVariable %_ptr_Function_bool Function %44 + %x_216_phi = OpVariable %_ptr_Function_bool Function %44 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %50 = OpLoad %int %49 + %53 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %54 = OpLoad %float %53 + %56 = OpAccessChain %_ptr_Function_float %sums %50 + OpStore %56 %54 + %58 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Function_float %sums %59 + OpStore %62 %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %64 = OpLoad %int %63 + OpStore %a %64 + OpBranch %65 + %65 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %69 = OpLoad %int %a + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %71 = OpLoad %int %70 + %72 = OpSLessThan %bool %69 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + OpBranch %73 + %75 = OpLabel + OpBranch %66 + %73 = OpLabel + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %78 = OpLoad %int %77 + OpStore %b %78 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %int %b + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %86 = OpLoad %int %85 + %87 = OpSLessThan %bool %83 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %90 + %89 = OpLabel + OpBranch %88 + %90 = OpLabel + OpBranch %80 + %88 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %93 = OpLoad %int %92 + OpStore %c %93 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %95 %96 None + OpBranch %97 + %97 = OpLabel + %98 = OpLoad %int %c + %100 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %101 = OpLoad %int %100 + %102 = OpSLessThanEqual %bool %98 %101 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + OpBranch %103 + %105 = OpLabel + OpBranch %95 + %103 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %107 = OpLoad %int %106 + OpStore %d %107 + OpBranch %108 + %108 = OpLabel + OpLoopMerge %109 %110 None + OpBranch %111 + %111 = OpLabel + %112 = OpLoad %int %d + %113 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %114 = OpLoad %int %113 + %115 = OpSLessThan %bool %112 %114 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %118 + %117 = OpLabel + OpBranch %116 + %118 = OpLabel + OpBranch %109 + %116 = OpLabel + %119 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %120 = OpLoad %int %119 + OpStore %e %120 + OpBranch %121 + %121 = OpLabel + OpLoopMerge %122 %123 None + OpBranch %124 + %124 = OpLabel + %125 = OpLoad %int %e + %126 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %127 = OpLoad %int %126 + %128 = OpSLessThanEqual %bool %125 %127 + OpSelectionMerge %129 None + OpBranchConditional %128 %130 %131 + %130 = OpLabel + OpBranch %129 + %131 = OpLabel + OpBranch %122 + %129 = OpLabel + %132 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %133 = OpLoad %int %132 + OpStore %f %133 + OpBranch %134 + %134 = OpLabel + OpLoopMerge %135 %136 None + OpBranch %137 + %137 = OpLabel + %138 = OpLoad %int %f + %139 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %140 = OpLoad %int %139 + %141 = OpSLessThan %bool %138 %140 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %144 + %143 = OpLabel + OpBranch %142 + %144 = OpLabel + OpBranch %135 + %142 = OpLabel + %145 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %146 = OpLoad %int %145 + OpStore %g %146 + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %151 = OpLoad %int %g + %152 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %153 = OpLoad %int %152 + %154 = OpSLessThan %bool %151 %153 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %157 + %156 = OpLabel + OpBranch %155 + %157 = OpLabel + OpBranch %148 + %155 = OpLabel + %158 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %159 = OpLoad %int %158 + OpStore %h %159 + OpBranch %160 + %160 = OpLabel + OpLoopMerge %161 %162 None + OpBranch %163 + %163 = OpLabel + %164 = OpLoad %int %h + %165 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %166 = OpLoad %int %165 + %167 = OpSLessThan %bool %164 %166 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %161 + %168 = OpLabel + %171 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %172 = OpLoad %int %171 + OpStore %i %172 + OpBranch %173 + %173 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %int %i + %178 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %179 = OpLoad %int %178 + %180 = OpSLessThan %bool %177 %179 + OpSelectionMerge %181 None + OpBranchConditional %180 %182 %183 + %182 = OpLabel + OpBranch %181 + %183 = OpLabel + OpBranch %174 + %181 = OpLabel + %184 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %185 = OpLoad %int %184 + OpStore %j %185 + OpBranch %186 + %186 = OpLabel + OpLoopMerge %187 %188 None + OpBranch %189 + %189 = OpLabel + %190 = OpLoad %int %j + %191 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %192 = OpLoad %int %191 + %193 = OpSGreaterThan %bool %190 %192 + OpSelectionMerge %194 None + OpBranchConditional %193 %195 %196 + %195 = OpLabel + OpBranch %194 + %196 = OpLabel + OpBranch %187 + %194 = OpLabel + %197 = OpLoad %int %a + %198 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %199 = OpLoad %float %198 + %200 = OpAccessChain %_ptr_Function_float %sums %197 + %201 = OpLoad %float %200 + %202 = OpAccessChain %_ptr_Function_float %sums %197 + %203 = OpFAdd %float %201 %199 + OpStore %202 %203 + OpBranch %188 + %188 = OpLabel + %204 = OpLoad %int %j + %205 = OpISub %int %204 %int_1 + OpStore %j %205 + OpBranch %186 + %187 = OpLabel + OpBranch %175 + %175 = OpLabel + %206 = OpLoad %int %i + %207 = OpIAdd %int %206 %int_1 + OpStore %i %207 + OpBranch %173 + %174 = OpLabel + OpBranch %162 + %162 = OpLabel + %208 = OpLoad %int %h + %209 = OpIAdd %int %208 %int_1 + OpStore %h %209 + OpBranch %160 + %161 = OpLabel + OpBranch %149 + %149 = OpLabel + %210 = OpLoad %int %g + %211 = OpIAdd %int %210 %int_1 + OpStore %g %211 + OpBranch %147 + %148 = OpLabel + OpBranch %136 + %136 = OpLabel + %212 = OpLoad %int %f + %213 = OpIAdd %int %212 %int_1 + OpStore %f %213 + OpBranch %134 + %135 = OpLabel + OpBranch %123 + %123 = OpLabel + %214 = OpLoad %int %e + %215 = OpIAdd %int %214 %int_1 + OpStore %e %215 + OpBranch %121 + %122 = OpLabel + OpBranch %110 + %110 = OpLabel + %216 = OpLoad %int %d + %217 = OpIAdd %int %216 %int_1 + OpStore %d %217 + OpBranch %108 + %109 = OpLabel + OpBranch %96 + %96 = OpLabel + %218 = OpLoad %int %c + %219 = OpIAdd %int %218 %int_1 + OpStore %c %219 + OpBranch %94 + %95 = OpLabel + OpBranch %81 + %81 = OpLabel + %220 = OpLoad %int %b + %221 = OpIAdd %int %220 %int_1 + OpStore %b %221 + OpBranch %79 + %80 = OpLabel + OpBranch %67 + %67 = OpLabel + %222 = OpLoad %int %a + %223 = OpIAdd %int %222 %int_1 + OpStore %a %223 + OpBranch %65 + %66 = OpLabel + %224 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %225 = OpLoad %int %224 + %226 = OpAccessChain %_ptr_Function_float %sums %225 + %227 = OpLoad %float %226 + %228 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %229 = OpLoad %float %228 + %230 = OpFOrdEqual %bool %227 %229 + OpStore %x_216_phi %230 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %231 + %232 = OpLabel + %233 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %234 = OpLoad %int %233 + %235 = OpAccessChain %_ptr_Function_float %sums %234 + %236 = OpLoad %float %235 + %237 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %238 = OpLoad %float %237 + %239 = OpFOrdEqual %bool %236 %238 + OpStore %x_215 %239 + %240 = OpLoad %bool %x_215 + OpStore %x_216_phi %240 + OpBranch %231 + %231 = OpLabel + %241 = OpLoad %bool %x_216_phi + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %244 + %243 = OpLabel + %245 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %246 = OpLoad %int %245 + %247 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %248 = OpLoad %int %247 + %249 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %250 = OpLoad %int %249 + %251 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %252 = OpLoad %int %251 + %253 = OpConvertSToF %float %246 + %254 = OpConvertSToF %float %248 + %255 = OpConvertSToF %float %250 + %256 = OpConvertSToF %float %252 + %257 = OpCompositeConstruct %v4float %253 %254 %255 %256 + OpStore %x_GLF_color %257 + OpBranch %242 + %244 = OpLabel + %258 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %259 = OpLoad %int %258 + %260 = OpConvertSToF %float %259 + %261 = OpCompositeConstruct %v4float %260 %260 %260 %260 + OpStore %x_GLF_color %261 + OpBranch %242 + %242 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %262 +%tint_symbol = OpFunctionParameter %main_out + %266 = OpLabel + %267 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %267 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %269 = OpLabel + %270 = OpFunctionCall %void %main_1 + %272 = OpLoad %v4float %x_GLF_color + %273 = OpCompositeConstruct %main_out %272 + %271 = OpFunctionCall %void %tint_symbol_2 %273 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..3235625afb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.spvasm.expected.wgsl @@ -0,0 +1,231 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var sums : array; + var a : i32; + var b : i32; + var c : i32; + var d : i32; + var e : i32; + var f : i32; + var g : i32; + var h : i32; + var i : i32; + var j : i32; + var x_215 : bool; + var x_216_phi : bool; + let x_20 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_110 : f32 = x_8.x_GLF_uniform_float_values[0]; + sums[x_20] = x_110; + let x_22 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_114 : f32 = x_8.x_GLF_uniform_float_values[0]; + sums[x_22] = x_114; + let x_23 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_23; + loop { + let x_24 : i32 = a; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_24 < x_25)) { + } else { + break; + } + let x_26 : i32 = x_6.x_GLF_uniform_int_values[5]; + b = x_26; + loop { + let x_27 : i32 = b; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_27 < x_28)) { + } else { + break; + } + let x_29 : i32 = x_6.x_GLF_uniform_int_values[6]; + c = x_29; + loop { + let x_30 : i32 = c; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_30 <= x_31)) { + } else { + break; + } + let x_32 : i32 = x_6.x_GLF_uniform_int_values[1]; + d = x_32; + loop { + let x_33 : i32 = d; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[6]; + if ((x_33 < x_34)) { + } else { + break; + } + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + e = x_35; + loop { + let x_36 : i32 = e; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_36 <= x_37)) { + } else { + break; + } + let x_38 : i32 = x_6.x_GLF_uniform_int_values[1]; + f = x_38; + loop { + let x_39 : i32 = f; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_39 < x_40)) { + } else { + break; + } + let x_41 : i32 = x_6.x_GLF_uniform_int_values[1]; + g = x_41; + loop { + let x_42 : i32 = g; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[6]; + if ((x_42 < x_43)) { + } else { + break; + } + let x_44 : i32 = x_6.x_GLF_uniform_int_values[1]; + h = x_44; + loop { + let x_45 : i32 = h; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_45 < x_46)) { + } else { + break; + } + let x_47 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_47; + loop { + let x_48 : i32 = i; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_48 < x_49)) { + } else { + break; + } + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + j = x_50; + loop { + let x_51 : i32 = j; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_51 > x_52)) { + } else { + break; + } + let x_53 : i32 = a; + let x_197 : f32 = x_8.x_GLF_uniform_float_values[2]; + let x_199 : f32 = sums[x_53]; + sums[x_53] = (x_199 + x_197); + + continuing { + let x_54 : i32 = j; + j = (x_54 - 1); + } + } + + continuing { + let x_56 : i32 = i; + i = (x_56 + 1); + } + } + + continuing { + let x_58 : i32 = h; + h = (x_58 + 1); + } + } + + continuing { + let x_60 : i32 = g; + g = (x_60 + 1); + } + } + + continuing { + let x_62 : i32 = f; + f = (x_62 + 1); + } + } + + continuing { + let x_64 : i32 = e; + e = (x_64 + 1); + } + } + + continuing { + let x_66 : i32 = d; + d = (x_66 + 1); + } + } + + continuing { + let x_68 : i32 = c; + c = (x_68 + 1); + } + } + + continuing { + let x_70 : i32 = b; + b = (x_70 + 1); + } + } + + continuing { + let x_72 : i32 = a; + a = (x_72 + 1); + } + } + let x_74 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_204 : f32 = sums[x_74]; + let x_206 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_207 : bool = (x_204 == x_206); + x_216_phi = x_207; + if (x_207) { + let x_75 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_212 : f32 = sums[x_75]; + let x_214 : f32 = x_8.x_GLF_uniform_float_values[1]; + x_215 = (x_212 == x_214); + x_216_phi = x_215; + } + let x_216 : bool = x_216_phi; + if (x_216) { + let x_76 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_79 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_76), f32(x_77), f32(x_78), f32(x_79)); + } else { + let x_80 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_230 : f32 = f32(x_80); + x_GLF_color = vec4(x_230, x_230, x_230, x_230); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl new file mode 100644 index 0000000000..3235625afb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl @@ -0,0 +1,231 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var sums : array; + var a : i32; + var b : i32; + var c : i32; + var d : i32; + var e : i32; + var f : i32; + var g : i32; + var h : i32; + var i : i32; + var j : i32; + var x_215 : bool; + var x_216_phi : bool; + let x_20 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_110 : f32 = x_8.x_GLF_uniform_float_values[0]; + sums[x_20] = x_110; + let x_22 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_114 : f32 = x_8.x_GLF_uniform_float_values[0]; + sums[x_22] = x_114; + let x_23 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_23; + loop { + let x_24 : i32 = a; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_24 < x_25)) { + } else { + break; + } + let x_26 : i32 = x_6.x_GLF_uniform_int_values[5]; + b = x_26; + loop { + let x_27 : i32 = b; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_27 < x_28)) { + } else { + break; + } + let x_29 : i32 = x_6.x_GLF_uniform_int_values[6]; + c = x_29; + loop { + let x_30 : i32 = c; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_30 <= x_31)) { + } else { + break; + } + let x_32 : i32 = x_6.x_GLF_uniform_int_values[1]; + d = x_32; + loop { + let x_33 : i32 = d; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[6]; + if ((x_33 < x_34)) { + } else { + break; + } + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + e = x_35; + loop { + let x_36 : i32 = e; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_36 <= x_37)) { + } else { + break; + } + let x_38 : i32 = x_6.x_GLF_uniform_int_values[1]; + f = x_38; + loop { + let x_39 : i32 = f; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_39 < x_40)) { + } else { + break; + } + let x_41 : i32 = x_6.x_GLF_uniform_int_values[1]; + g = x_41; + loop { + let x_42 : i32 = g; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[6]; + if ((x_42 < x_43)) { + } else { + break; + } + let x_44 : i32 = x_6.x_GLF_uniform_int_values[1]; + h = x_44; + loop { + let x_45 : i32 = h; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_45 < x_46)) { + } else { + break; + } + let x_47 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_47; + loop { + let x_48 : i32 = i; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_48 < x_49)) { + } else { + break; + } + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + j = x_50; + loop { + let x_51 : i32 = j; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_51 > x_52)) { + } else { + break; + } + let x_53 : i32 = a; + let x_197 : f32 = x_8.x_GLF_uniform_float_values[2]; + let x_199 : f32 = sums[x_53]; + sums[x_53] = (x_199 + x_197); + + continuing { + let x_54 : i32 = j; + j = (x_54 - 1); + } + } + + continuing { + let x_56 : i32 = i; + i = (x_56 + 1); + } + } + + continuing { + let x_58 : i32 = h; + h = (x_58 + 1); + } + } + + continuing { + let x_60 : i32 = g; + g = (x_60 + 1); + } + } + + continuing { + let x_62 : i32 = f; + f = (x_62 + 1); + } + } + + continuing { + let x_64 : i32 = e; + e = (x_64 + 1); + } + } + + continuing { + let x_66 : i32 = d; + d = (x_66 + 1); + } + } + + continuing { + let x_68 : i32 = c; + c = (x_68 + 1); + } + } + + continuing { + let x_70 : i32 = b; + b = (x_70 + 1); + } + } + + continuing { + let x_72 : i32 = a; + a = (x_72 + 1); + } + } + let x_74 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_204 : f32 = sums[x_74]; + let x_206 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_207 : bool = (x_204 == x_206); + x_216_phi = x_207; + if (x_207) { + let x_75 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_212 : f32 = sums[x_75]; + let x_214 : f32 = x_8.x_GLF_uniform_float_values[1]; + x_215 = (x_212 == x_214); + x_216_phi = x_215; + } + let x_216 : bool = x_216_phi; + if (x_216) { + let x_76 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_79 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_76), f32(x_77), f32(x_78), f32(x_79)); + } else { + let x_80 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_230 : f32 = f32(x_80); + x_GLF_color = vec4(x_230, x_230, x_230, x_230); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..5d63b9b65c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.hlsl @@ -0,0 +1,208 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[7]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float sums[2] = (float[2])0; + int a = 0; + int b = 0; + int c = 0; + int d = 0; + int e = 0; + int f = 0; + int g = 0; + int h = 0; + int i = 0; + int j = 0; + bool x_215 = false; + bool x_216_phi = false; + const int x_20 = asint(x_6[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_110 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + sums[x_20] = x_110; + const int x_22 = asint(x_6[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_114 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + sums[x_22] = x_114; + const int x_23 = asint(x_6[1].x); + a = x_23; + while (true) { + const int x_24 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_25 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_24 < x_25)) { + } else { + break; + } + const int x_26 = asint(x_6[5].x); + b = x_26; + while (true) { + const int x_27 = b; + const int x_28 = asint(x_6[3].x); + if ((x_27 < x_28)) { + } else { + break; + } + const int x_29 = asint(x_6[6].x); + c = x_29; + while (true) { + const int x_30 = c; + const int x_31 = asint(x_6[4].x); + if ((x_30 <= x_31)) { + } else { + break; + } + const int x_32 = asint(x_6[1].x); + d = x_32; + while (true) { + const int x_33 = d; + const int x_34 = asint(x_6[6].x); + if ((x_33 < x_34)) { + } else { + break; + } + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_35 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + e = x_35; + while (true) { + const int x_36 = e; + const int x_37 = asint(x_6[4].x); + if ((x_36 <= x_37)) { + } else { + break; + } + const int x_38 = asint(x_6[1].x); + f = x_38; + while (true) { + const int x_39 = f; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_39 < x_40)) { + } else { + break; + } + const int x_41 = asint(x_6[1].x); + g = x_41; + while (true) { + const int x_42 = g; + const int x_43 = asint(x_6[6].x); + if ((x_42 < x_43)) { + } else { + break; + } + const int x_44 = asint(x_6[1].x); + h = x_44; + while (true) { + const int x_45 = h; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_46 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_45 < x_46)) { + } else { + break; + } + const int x_47 = asint(x_6[1].x); + i = x_47; + while (true) { + const int x_48 = i; + const int x_49 = asint(x_6[4].x); + if ((x_48 < x_49)) { + } else { + break; + } + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); + j = x_50; + while (true) { + const int x_51 = j; + const int x_52 = asint(x_6[1].x); + if ((x_51 > x_52)) { + } else { + break; + } + const int x_53 = a; + const float x_197 = asfloat(x_8[2].x); + const float x_199 = sums[x_53]; + sums[x_53] = (x_199 + x_197); + { + j = (j - 1); + } + } + { + i = (i + 1); + } + } + { + h = (h + 1); + } + } + { + g = (g + 1); + } + } + { + f = (f + 1); + } + } + { + e = (e + 1); + } + } + { + d = (d + 1); + } + } + { + c = (c + 1); + } + } + { + b = (b + 1); + } + } + { + a = (a + 1); + } + } + const int x_74 = asint(x_6[1].x); + const float x_204 = sums[x_74]; + const float x_206 = asfloat(x_8[1].x); + const bool x_207 = (x_204 == x_206); + x_216_phi = x_207; + if (x_207) { + const int x_75 = asint(x_6[2].x); + const float x_212 = sums[x_75]; + const float x_214 = asfloat(x_8[1].x); + x_215 = (x_212 == x_214); + x_216_phi = x_215; + } + if (x_216_phi) { + const int x_76 = asint(x_6[2].x); + const int x_77 = asint(x_6[1].x); + const int x_78 = asint(x_6[1].x); + const int x_79 = asint(x_6[2].x); + x_GLF_color = float4(float(x_76), float(x_77), float(x_78), float(x_79)); + } else { + const int x_80 = asint(x_6[1].x); + const float x_230 = float(x_80); + x_GLF_color = float4(x_230, x_230, x_230, x_230); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..14a2550238 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.msl @@ -0,0 +1,232 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[7]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_array_wrapper_2 { + float arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + tint_array_wrapper_2 sums = {}; + int a = 0; + int b = 0; + int c = 0; + int d = 0; + int e = 0; + int f = 0; + int g = 0; + int h = 0; + int i = 0; + int j = 0; + bool x_215 = false; + bool x_216_phi = false; + int const x_20 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_110 = x_8.x_GLF_uniform_float_values.arr[0].el; + sums.arr[x_20] = x_110; + int const x_22 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_114 = x_8.x_GLF_uniform_float_values.arr[0].el; + sums.arr[x_22] = x_114; + int const x_23 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_23; + while (true) { + int const x_24 = a; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_24 < x_25)) { + } else { + break; + } + int const x_26 = x_6.x_GLF_uniform_int_values.arr[5].el; + b = x_26; + while (true) { + int const x_27 = b; + int const x_28 = x_6.x_GLF_uniform_int_values.arr[3].el; + if ((x_27 < x_28)) { + } else { + break; + } + int const x_29 = x_6.x_GLF_uniform_int_values.arr[6].el; + c = x_29; + while (true) { + int const x_30 = c; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[4].el; + if ((x_30 <= x_31)) { + } else { + break; + } + int const x_32 = x_6.x_GLF_uniform_int_values.arr[1].el; + d = x_32; + while (true) { + int const x_33 = d; + int const x_34 = x_6.x_GLF_uniform_int_values.arr[6].el; + if ((x_33 < x_34)) { + } else { + break; + } + int const x_35 = x_6.x_GLF_uniform_int_values.arr[0].el; + e = x_35; + while (true) { + int const x_36 = e; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[4].el; + if ((x_36 <= x_37)) { + } else { + break; + } + int const x_38 = x_6.x_GLF_uniform_int_values.arr[1].el; + f = x_38; + while (true) { + int const x_39 = f; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_39 < x_40)) { + } else { + break; + } + int const x_41 = x_6.x_GLF_uniform_int_values.arr[1].el; + g = x_41; + while (true) { + int const x_42 = g; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[6].el; + if ((x_42 < x_43)) { + } else { + break; + } + int const x_44 = x_6.x_GLF_uniform_int_values.arr[1].el; + h = x_44; + while (true) { + int const x_45 = h; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_45 < x_46)) { + } else { + break; + } + int const x_47 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_47; + while (true) { + int const x_48 = i; + int const x_49 = x_6.x_GLF_uniform_int_values.arr[4].el; + if ((x_48 < x_49)) { + } else { + break; + } + int const x_50 = x_6.x_GLF_uniform_int_values.arr[0].el; + j = x_50; + while (true) { + int const x_51 = j; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_51 > x_52)) { + } else { + break; + } + int const x_53 = a; + float const x_197 = x_8.x_GLF_uniform_float_values.arr[2].el; + float const x_199 = sums.arr[x_53]; + sums.arr[x_53] = (x_199 + x_197); + { + int const x_54 = j; + j = (x_54 - 1); + } + } + { + int const x_56 = i; + i = (x_56 + 1); + } + } + { + int const x_58 = h; + h = (x_58 + 1); + } + } + { + int const x_60 = g; + g = (x_60 + 1); + } + } + { + int const x_62 = f; + f = (x_62 + 1); + } + } + { + int const x_64 = e; + e = (x_64 + 1); + } + } + { + int const x_66 = d; + d = (x_66 + 1); + } + } + { + int const x_68 = c; + c = (x_68 + 1); + } + } + { + int const x_70 = b; + b = (x_70 + 1); + } + } + { + int const x_72 = a; + a = (x_72 + 1); + } + } + int const x_74 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_204 = sums.arr[x_74]; + float const x_206 = x_8.x_GLF_uniform_float_values.arr[1].el; + bool const x_207 = (x_204 == x_206); + x_216_phi = x_207; + if (x_207) { + int const x_75 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_212 = sums.arr[x_75]; + float const x_214 = x_8.x_GLF_uniform_float_values.arr[1].el; + x_215 = (x_212 == x_214); + x_216_phi = x_215; + } + bool const x_216 = x_216_phi; + if (x_216) { + int const x_76 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_77 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_79 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_76), float(x_77), float(x_78), float(x_79)); + } else { + int const x_80 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_230 = float(x_80); + *(tint_symbol_4) = float4(x_230, x_230, x_230, x_230); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..504fead676 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.spvasm @@ -0,0 +1,456 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 274 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %sums "sums" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %d "d" + OpName %e "e" + OpName %f "f" + OpName %g "g" + OpName %h "h" + OpName %i "i" + OpName %j "j" + OpName %x_215 "x_215" + OpName %x_216_phi "x_216_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_7 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_7 = OpConstant %uint 7 +%_arr_int_uint_7 = OpTypeArray %int %uint_7 + %buf0 = OpTypeStruct %_arr_int_uint_7 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %28 = OpConstantNull %_arr_float_uint_2 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %44 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 + %int_5 = OpConstant %int 5 + %int_3 = OpConstant %int 3 + %int_6 = OpConstant %int 6 + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %262 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %sums = OpVariable %_ptr_Function__arr_float_uint_2 Function %28 + %a = OpVariable %_ptr_Function_int Function %31 + %b = OpVariable %_ptr_Function_int Function %31 + %c = OpVariable %_ptr_Function_int Function %31 + %d = OpVariable %_ptr_Function_int Function %31 + %e = OpVariable %_ptr_Function_int Function %31 + %f = OpVariable %_ptr_Function_int Function %31 + %g = OpVariable %_ptr_Function_int Function %31 + %h = OpVariable %_ptr_Function_int Function %31 + %i = OpVariable %_ptr_Function_int Function %31 + %j = OpVariable %_ptr_Function_int Function %31 + %x_215 = OpVariable %_ptr_Function_bool Function %44 + %x_216_phi = OpVariable %_ptr_Function_bool Function %44 + %49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %50 = OpLoad %int %49 + %53 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %54 = OpLoad %float %53 + %56 = OpAccessChain %_ptr_Function_float %sums %50 + OpStore %56 %54 + %58 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Function_float %sums %59 + OpStore %62 %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %64 = OpLoad %int %63 + OpStore %a %64 + OpBranch %65 + %65 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %69 = OpLoad %int %a + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %71 = OpLoad %int %70 + %72 = OpSLessThan %bool %69 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + OpBranch %73 + %75 = OpLabel + OpBranch %66 + %73 = OpLabel + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %78 = OpLoad %int %77 + OpStore %b %78 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %int %b + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %86 = OpLoad %int %85 + %87 = OpSLessThan %bool %83 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %90 + %89 = OpLabel + OpBranch %88 + %90 = OpLabel + OpBranch %80 + %88 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %93 = OpLoad %int %92 + OpStore %c %93 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %95 %96 None + OpBranch %97 + %97 = OpLabel + %98 = OpLoad %int %c + %100 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %101 = OpLoad %int %100 + %102 = OpSLessThanEqual %bool %98 %101 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + OpBranch %103 + %105 = OpLabel + OpBranch %95 + %103 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %107 = OpLoad %int %106 + OpStore %d %107 + OpBranch %108 + %108 = OpLabel + OpLoopMerge %109 %110 None + OpBranch %111 + %111 = OpLabel + %112 = OpLoad %int %d + %113 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %114 = OpLoad %int %113 + %115 = OpSLessThan %bool %112 %114 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %118 + %117 = OpLabel + OpBranch %116 + %118 = OpLabel + OpBranch %109 + %116 = OpLabel + %119 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %120 = OpLoad %int %119 + OpStore %e %120 + OpBranch %121 + %121 = OpLabel + OpLoopMerge %122 %123 None + OpBranch %124 + %124 = OpLabel + %125 = OpLoad %int %e + %126 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %127 = OpLoad %int %126 + %128 = OpSLessThanEqual %bool %125 %127 + OpSelectionMerge %129 None + OpBranchConditional %128 %130 %131 + %130 = OpLabel + OpBranch %129 + %131 = OpLabel + OpBranch %122 + %129 = OpLabel + %132 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %133 = OpLoad %int %132 + OpStore %f %133 + OpBranch %134 + %134 = OpLabel + OpLoopMerge %135 %136 None + OpBranch %137 + %137 = OpLabel + %138 = OpLoad %int %f + %139 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %140 = OpLoad %int %139 + %141 = OpSLessThan %bool %138 %140 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %144 + %143 = OpLabel + OpBranch %142 + %144 = OpLabel + OpBranch %135 + %142 = OpLabel + %145 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %146 = OpLoad %int %145 + OpStore %g %146 + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %151 = OpLoad %int %g + %152 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %153 = OpLoad %int %152 + %154 = OpSLessThan %bool %151 %153 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %157 + %156 = OpLabel + OpBranch %155 + %157 = OpLabel + OpBranch %148 + %155 = OpLabel + %158 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %159 = OpLoad %int %158 + OpStore %h %159 + OpBranch %160 + %160 = OpLabel + OpLoopMerge %161 %162 None + OpBranch %163 + %163 = OpLabel + %164 = OpLoad %int %h + %165 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %166 = OpLoad %int %165 + %167 = OpSLessThan %bool %164 %166 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %161 + %168 = OpLabel + %171 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %172 = OpLoad %int %171 + OpStore %i %172 + OpBranch %173 + %173 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %int %i + %178 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %179 = OpLoad %int %178 + %180 = OpSLessThan %bool %177 %179 + OpSelectionMerge %181 None + OpBranchConditional %180 %182 %183 + %182 = OpLabel + OpBranch %181 + %183 = OpLabel + OpBranch %174 + %181 = OpLabel + %184 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %185 = OpLoad %int %184 + OpStore %j %185 + OpBranch %186 + %186 = OpLabel + OpLoopMerge %187 %188 None + OpBranch %189 + %189 = OpLabel + %190 = OpLoad %int %j + %191 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %192 = OpLoad %int %191 + %193 = OpSGreaterThan %bool %190 %192 + OpSelectionMerge %194 None + OpBranchConditional %193 %195 %196 + %195 = OpLabel + OpBranch %194 + %196 = OpLabel + OpBranch %187 + %194 = OpLabel + %197 = OpLoad %int %a + %198 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_2 + %199 = OpLoad %float %198 + %200 = OpAccessChain %_ptr_Function_float %sums %197 + %201 = OpLoad %float %200 + %202 = OpAccessChain %_ptr_Function_float %sums %197 + %203 = OpFAdd %float %201 %199 + OpStore %202 %203 + OpBranch %188 + %188 = OpLabel + %204 = OpLoad %int %j + %205 = OpISub %int %204 %int_1 + OpStore %j %205 + OpBranch %186 + %187 = OpLabel + OpBranch %175 + %175 = OpLabel + %206 = OpLoad %int %i + %207 = OpIAdd %int %206 %int_1 + OpStore %i %207 + OpBranch %173 + %174 = OpLabel + OpBranch %162 + %162 = OpLabel + %208 = OpLoad %int %h + %209 = OpIAdd %int %208 %int_1 + OpStore %h %209 + OpBranch %160 + %161 = OpLabel + OpBranch %149 + %149 = OpLabel + %210 = OpLoad %int %g + %211 = OpIAdd %int %210 %int_1 + OpStore %g %211 + OpBranch %147 + %148 = OpLabel + OpBranch %136 + %136 = OpLabel + %212 = OpLoad %int %f + %213 = OpIAdd %int %212 %int_1 + OpStore %f %213 + OpBranch %134 + %135 = OpLabel + OpBranch %123 + %123 = OpLabel + %214 = OpLoad %int %e + %215 = OpIAdd %int %214 %int_1 + OpStore %e %215 + OpBranch %121 + %122 = OpLabel + OpBranch %110 + %110 = OpLabel + %216 = OpLoad %int %d + %217 = OpIAdd %int %216 %int_1 + OpStore %d %217 + OpBranch %108 + %109 = OpLabel + OpBranch %96 + %96 = OpLabel + %218 = OpLoad %int %c + %219 = OpIAdd %int %218 %int_1 + OpStore %c %219 + OpBranch %94 + %95 = OpLabel + OpBranch %81 + %81 = OpLabel + %220 = OpLoad %int %b + %221 = OpIAdd %int %220 %int_1 + OpStore %b %221 + OpBranch %79 + %80 = OpLabel + OpBranch %67 + %67 = OpLabel + %222 = OpLoad %int %a + %223 = OpIAdd %int %222 %int_1 + OpStore %a %223 + OpBranch %65 + %66 = OpLabel + %224 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %225 = OpLoad %int %224 + %226 = OpAccessChain %_ptr_Function_float %sums %225 + %227 = OpLoad %float %226 + %228 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %229 = OpLoad %float %228 + %230 = OpFOrdEqual %bool %227 %229 + OpStore %x_216_phi %230 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %231 + %232 = OpLabel + %233 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %234 = OpLoad %int %233 + %235 = OpAccessChain %_ptr_Function_float %sums %234 + %236 = OpLoad %float %235 + %237 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %238 = OpLoad %float %237 + %239 = OpFOrdEqual %bool %236 %238 + OpStore %x_215 %239 + %240 = OpLoad %bool %x_215 + OpStore %x_216_phi %240 + OpBranch %231 + %231 = OpLabel + %241 = OpLoad %bool %x_216_phi + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %244 + %243 = OpLabel + %245 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %246 = OpLoad %int %245 + %247 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %248 = OpLoad %int %247 + %249 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %250 = OpLoad %int %249 + %251 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %252 = OpLoad %int %251 + %253 = OpConvertSToF %float %246 + %254 = OpConvertSToF %float %248 + %255 = OpConvertSToF %float %250 + %256 = OpConvertSToF %float %252 + %257 = OpCompositeConstruct %v4float %253 %254 %255 %256 + OpStore %x_GLF_color %257 + OpBranch %242 + %244 = OpLabel + %258 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %259 = OpLoad %int %258 + %260 = OpConvertSToF %float %259 + %261 = OpCompositeConstruct %v4float %260 %260 %260 %260 + OpStore %x_GLF_color %261 + OpBranch %242 + %242 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %262 +%tint_symbol = OpFunctionParameter %main_out + %266 = OpLabel + %267 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %267 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %269 = OpLabel + %270 = OpFunctionCall %void %main_1 + %272 = OpLoad %v4float %x_GLF_color + %273 = OpCompositeConstruct %main_out %272 + %271 = OpFunctionCall %void %tint_symbol_2 %273 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..3235625afb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops-array-access/0-opt.wgsl.expected.wgsl @@ -0,0 +1,231 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var sums : array; + var a : i32; + var b : i32; + var c : i32; + var d : i32; + var e : i32; + var f : i32; + var g : i32; + var h : i32; + var i : i32; + var j : i32; + var x_215 : bool; + var x_216_phi : bool; + let x_20 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_110 : f32 = x_8.x_GLF_uniform_float_values[0]; + sums[x_20] = x_110; + let x_22 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_114 : f32 = x_8.x_GLF_uniform_float_values[0]; + sums[x_22] = x_114; + let x_23 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_23; + loop { + let x_24 : i32 = a; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_24 < x_25)) { + } else { + break; + } + let x_26 : i32 = x_6.x_GLF_uniform_int_values[5]; + b = x_26; + loop { + let x_27 : i32 = b; + let x_28 : i32 = x_6.x_GLF_uniform_int_values[3]; + if ((x_27 < x_28)) { + } else { + break; + } + let x_29 : i32 = x_6.x_GLF_uniform_int_values[6]; + c = x_29; + loop { + let x_30 : i32 = c; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_30 <= x_31)) { + } else { + break; + } + let x_32 : i32 = x_6.x_GLF_uniform_int_values[1]; + d = x_32; + loop { + let x_33 : i32 = d; + let x_34 : i32 = x_6.x_GLF_uniform_int_values[6]; + if ((x_33 < x_34)) { + } else { + break; + } + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + e = x_35; + loop { + let x_36 : i32 = e; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_36 <= x_37)) { + } else { + break; + } + let x_38 : i32 = x_6.x_GLF_uniform_int_values[1]; + f = x_38; + loop { + let x_39 : i32 = f; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_39 < x_40)) { + } else { + break; + } + let x_41 : i32 = x_6.x_GLF_uniform_int_values[1]; + g = x_41; + loop { + let x_42 : i32 = g; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[6]; + if ((x_42 < x_43)) { + } else { + break; + } + let x_44 : i32 = x_6.x_GLF_uniform_int_values[1]; + h = x_44; + loop { + let x_45 : i32 = h; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_45 < x_46)) { + } else { + break; + } + let x_47 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_47; + loop { + let x_48 : i32 = i; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_48 < x_49)) { + } else { + break; + } + let x_50 : i32 = x_6.x_GLF_uniform_int_values[0]; + j = x_50; + loop { + let x_51 : i32 = j; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_51 > x_52)) { + } else { + break; + } + let x_53 : i32 = a; + let x_197 : f32 = x_8.x_GLF_uniform_float_values[2]; + let x_199 : f32 = sums[x_53]; + sums[x_53] = (x_199 + x_197); + + continuing { + let x_54 : i32 = j; + j = (x_54 - 1); + } + } + + continuing { + let x_56 : i32 = i; + i = (x_56 + 1); + } + } + + continuing { + let x_58 : i32 = h; + h = (x_58 + 1); + } + } + + continuing { + let x_60 : i32 = g; + g = (x_60 + 1); + } + } + + continuing { + let x_62 : i32 = f; + f = (x_62 + 1); + } + } + + continuing { + let x_64 : i32 = e; + e = (x_64 + 1); + } + } + + continuing { + let x_66 : i32 = d; + d = (x_66 + 1); + } + } + + continuing { + let x_68 : i32 = c; + c = (x_68 + 1); + } + } + + continuing { + let x_70 : i32 = b; + b = (x_70 + 1); + } + } + + continuing { + let x_72 : i32 = a; + a = (x_72 + 1); + } + } + let x_74 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_204 : f32 = sums[x_74]; + let x_206 : f32 = x_8.x_GLF_uniform_float_values[1]; + let x_207 : bool = (x_204 == x_206); + x_216_phi = x_207; + if (x_207) { + let x_75 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_212 : f32 = sums[x_75]; + let x_214 : f32 = x_8.x_GLF_uniform_float_values[1]; + x_215 = (x_212 == x_214); + x_216_phi = x_215; + } + let x_216 : bool = x_216_phi; + if (x_216) { + let x_76 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_79 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_76), f32(x_77), f32(x_78), f32(x_79)); + } else { + let x_80 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_230 : f32 = f32(x_80); + x_GLF_color = vec4(x_230, x_230, x_230, x_230); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm new file mode 100644 index 0000000000..26b914cb72 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm @@ -0,0 +1,283 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %i0 "i0" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %i1 "i1" + OpName %i2 "i2" + OpName %i3 "i3" + OpName %i4 "i4" + OpName %i5 "i5" + OpName %i6 "i6" + OpName %i7 "i7" + OpName %i8 "i8" + OpName %i9 "i9" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %18 + %35 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i0 = OpVariable %_ptr_Function_int Function + %i1 = OpVariable %_ptr_Function_int Function + %i2 = OpVariable %_ptr_Function_int Function + %i3 = OpVariable %_ptr_Function_int Function + %i4 = OpVariable %_ptr_Function_int Function + %i5 = OpVariable %_ptr_Function_int Function + %i6 = OpVariable %_ptr_Function_int Function + %i7 = OpVariable %_ptr_Function_int Function + %i8 = OpVariable %_ptr_Function_int Function + %i9 = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + OpStore %i0 %int_0 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %i0 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %42 = OpLoad %int %41 + %43 = OpSLessThan %bool %40 %42 + OpBranchConditional %43 %44 %37 + %44 = OpLabel + OpStore %i1 %int_0 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %i1 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %51 = OpLoad %int %50 + %52 = OpSLessThan %bool %49 %51 + OpBranchConditional %52 %53 %46 + %53 = OpLabel + OpStore %i2 %int_0 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %int %i2 + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %60 = OpLoad %int %59 + %61 = OpSLessThan %bool %58 %60 + OpBranchConditional %61 %62 %55 + %62 = OpLabel + OpStore %i3 %int_0 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpLoad %int %i3 + %68 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %69 = OpLoad %int %68 + %70 = OpIAdd %int %69 %int_2 + %71 = OpSLessThan %bool %67 %70 + OpBranchConditional %71 %72 %64 + %72 = OpLabel + OpStore %i4 %int_0 + OpBranch %73 + %73 = OpLabel + OpLoopMerge %74 %75 None + OpBranch %76 + %76 = OpLabel + %77 = OpLoad %int %i4 + %78 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %79 = OpLoad %int %78 + %80 = OpSLessThan %bool %77 %79 + OpBranchConditional %80 %81 %74 + %81 = OpLabel + OpStore %i5 %int_0 + OpBranch %82 + %82 = OpLabel + OpLoopMerge %83 %84 None + OpBranch %85 + %85 = OpLabel + %86 = OpLoad %int %i5 + %87 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %88 = OpLoad %int %87 + %89 = OpSLessThan %bool %86 %88 + OpBranchConditional %89 %90 %83 + %90 = OpLabel + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %96 = OpLoad %int %95 + %97 = OpSGreaterThan %bool %96 %int_0 + OpBranchConditional %97 %98 %92 + %98 = OpLabel + OpStore %i6 %int_0 + OpBranch %99 + %99 = OpLabel + OpLoopMerge %100 %101 None + OpBranch %102 + %102 = OpLabel + %103 = OpLoad %int %i6 + %104 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %105 = OpLoad %int %104 + %106 = OpSLessThan %bool %103 %105 + OpBranchConditional %106 %107 %100 + %107 = OpLabel + OpStore %i7 %int_0 + OpBranch %108 + %108 = OpLabel + OpLoopMerge %109 %110 None + OpBranch %111 + %111 = OpLabel + %112 = OpLoad %int %i7 + %113 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %114 = OpLoad %int %113 + %115 = OpSLessThan %bool %112 %114 + OpBranchConditional %115 %116 %109 + %116 = OpLabel + OpStore %i8 %int_0 + OpBranch %117 + %117 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %121 = OpLoad %int %i8 + %122 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %123 = OpLoad %int %122 + %124 = OpSLessThan %bool %121 %123 + OpBranchConditional %124 %125 %118 + %125 = OpLabel + OpStore %i9 %int_0 + OpBranch %126 + %126 = OpLabel + OpLoopMerge %127 %128 None + OpBranch %129 + %129 = OpLabel + %130 = OpLoad %int %i9 + %131 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %132 = OpLoad %int %131 + %133 = OpSLessThan %bool %130 %132 + OpBranchConditional %133 %134 %127 + %134 = OpLabel + %135 = OpLoad %int %a + %136 = OpIAdd %int %135 %int_1 + OpStore %a %136 + OpBranch %128 + %128 = OpLabel + %137 = OpLoad %int %i9 + %138 = OpIAdd %int %137 %int_1 + OpStore %i9 %138 + OpBranch %126 + %127 = OpLabel + OpBranch %119 + %119 = OpLabel + %139 = OpLoad %int %i8 + %140 = OpIAdd %int %139 %int_1 + OpStore %i8 %140 + OpBranch %117 + %118 = OpLabel + OpBranch %110 + %110 = OpLabel + %141 = OpLoad %int %i7 + %142 = OpIAdd %int %141 %int_1 + OpStore %i7 %142 + OpBranch %108 + %109 = OpLabel + OpBranch %101 + %101 = OpLabel + %143 = OpLoad %int %i6 + %144 = OpIAdd %int %143 %int_1 + OpStore %i6 %144 + OpBranch %99 + %100 = OpLabel + OpBranch %92 + %93 = OpLabel + OpBranch %91 + %92 = OpLabel + OpBranch %84 + %84 = OpLabel + %145 = OpLoad %int %i5 + %146 = OpIAdd %int %145 %int_1 + OpStore %i5 %146 + OpBranch %82 + %83 = OpLabel + OpBranch %75 + %75 = OpLabel + %147 = OpLoad %int %i4 + %148 = OpIAdd %int %147 %int_1 + OpStore %i4 %148 + OpBranch %73 + %74 = OpLabel + OpBranch %65 + %65 = OpLabel + %149 = OpLoad %int %i3 + %150 = OpIAdd %int %149 %int_1 + OpStore %i3 %150 + OpBranch %63 + %64 = OpLabel + OpBranch %56 + %56 = OpLabel + %151 = OpLoad %int %i2 + %152 = OpIAdd %int %151 %int_1 + OpStore %i2 %152 + OpBranch %54 + %55 = OpLabel + OpBranch %47 + %47 = OpLabel + %153 = OpLoad %int %i1 + %154 = OpIAdd %int %153 %int_1 + OpStore %i1 %154 + OpBranch %45 + %46 = OpLabel + OpBranch %38 + %38 = OpLabel + %155 = OpLoad %int %i0 + %156 = OpIAdd %int %155 %int_1 + OpStore %i0 %156 + OpBranch %36 + %37 = OpLabel + %157 = OpLoad %int %a + %158 = OpIEqual %bool %157 %int_3 + OpSelectionMerge %159 None + OpBranchConditional %158 %160 %161 + %160 = OpLabel + OpStore %_GLF_color %33 + OpBranch %159 + %161 = OpLabel + OpStore %_GLF_color %34 + OpBranch %159 + %159 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9982cdee30 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.hlsl @@ -0,0 +1,168 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i0 = 0; + int i1 = 0; + int i2 = 0; + int i3 = 0; + int i4 = 0; + int i5 = 0; + int i6 = 0; + int i7 = 0; + int i8_1 = 0; + int i9 = 0; + a = 0; + i0 = 0; + while (true) { + const int x_40 = i0; + const int x_42 = asint(x_7[0].x); + if ((x_40 < x_42)) { + } else { + break; + } + i1 = 0; + while (true) { + const int x_49 = i1; + const int x_51 = asint(x_7[0].x); + if ((x_49 < x_51)) { + } else { + break; + } + i2 = 0; + while (true) { + const int x_58 = i2; + const int x_60 = asint(x_7[0].x); + if ((x_58 < x_60)) { + } else { + break; + } + i3 = 0; + while (true) { + const int x_67 = i3; + const int x_69 = asint(x_7[0].x); + if ((x_67 < (x_69 + 2))) { + } else { + break; + } + i4 = 0; + while (true) { + const int x_77 = i4; + const int x_79 = asint(x_7[0].x); + if ((x_77 < x_79)) { + } else { + break; + } + i5 = 0; + while (true) { + const int x_86 = i5; + const int x_88 = asint(x_7[0].x); + if ((x_86 < x_88)) { + } else { + break; + } + while (true) { + const int x_96 = asint(x_7[0].x); + if ((x_96 > 0)) { + } else { + break; + } + i6 = 0; + while (true) { + const int x_103 = i6; + const int x_105 = asint(x_7[0].x); + if ((x_103 < x_105)) { + } else { + break; + } + i7 = 0; + while (true) { + const int x_112 = i7; + const int x_114 = asint(x_7[0].x); + if ((x_112 < x_114)) { + } else { + break; + } + i8_1 = 0; + while (true) { + const int x_121 = i8_1; + const int x_123 = asint(x_7[0].x); + if ((x_121 < x_123)) { + } else { + break; + } + i9 = 0; + while (true) { + const int x_130 = i9; + const int x_132 = asint(x_7[0].x); + if ((x_130 < x_132)) { + } else { + break; + } + a = (a + 1); + { + i9 = (i9 + 1); + } + } + { + i8_1 = (i8_1 + 1); + } + } + { + i7 = (i7 + 1); + } + } + { + i6 = (i6 + 1); + } + } + break; + } + { + i5 = (i5 + 1); + } + } + { + i4 = (i4 + 1); + } + } + { + i3 = (i3 + 1); + } + } + { + i2 = (i2 + 1); + } + } + { + i1 = (i1 + 1); + } + } + { + i0 = (i0 + 1); + } + } + if ((a == 3)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..77cd3d14b7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.msl @@ -0,0 +1,183 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int a = 0; + int i0 = 0; + int i1 = 0; + int i2 = 0; + int i3 = 0; + int i4 = 0; + int i5 = 0; + int i6 = 0; + int i7 = 0; + int i8_1 = 0; + int i9 = 0; + a = 0; + i0 = 0; + while (true) { + int const x_40 = i0; + int const x_42 = x_7.one; + if ((x_40 < x_42)) { + } else { + break; + } + i1 = 0; + while (true) { + int const x_49 = i1; + int const x_51 = x_7.one; + if ((x_49 < x_51)) { + } else { + break; + } + i2 = 0; + while (true) { + int const x_58 = i2; + int const x_60 = x_7.one; + if ((x_58 < x_60)) { + } else { + break; + } + i3 = 0; + while (true) { + int const x_67 = i3; + int const x_69 = x_7.one; + if ((x_67 < (x_69 + 2))) { + } else { + break; + } + i4 = 0; + while (true) { + int const x_77 = i4; + int const x_79 = x_7.one; + if ((x_77 < x_79)) { + } else { + break; + } + i5 = 0; + while (true) { + int const x_86 = i5; + int const x_88 = x_7.one; + if ((x_86 < x_88)) { + } else { + break; + } + while (true) { + int const x_96 = x_7.one; + if ((x_96 > 0)) { + } else { + break; + } + i6 = 0; + while (true) { + int const x_103 = i6; + int const x_105 = x_7.one; + if ((x_103 < x_105)) { + } else { + break; + } + i7 = 0; + while (true) { + int const x_112 = i7; + int const x_114 = x_7.one; + if ((x_112 < x_114)) { + } else { + break; + } + i8_1 = 0; + while (true) { + int const x_121 = i8_1; + int const x_123 = x_7.one; + if ((x_121 < x_123)) { + } else { + break; + } + i9 = 0; + while (true) { + int const x_130 = i9; + int const x_132 = x_7.one; + if ((x_130 < x_132)) { + } else { + break; + } + int const x_135 = a; + a = (x_135 + 1); + { + int const x_137 = i9; + i9 = (x_137 + 1); + } + } + { + int const x_139 = i8_1; + i8_1 = (x_139 + 1); + } + } + { + int const x_141 = i7; + i7 = (x_141 + 1); + } + } + { + int const x_143 = i6; + i6 = (x_143 + 1); + } + } + break; + } + { + int const x_145 = i5; + i5 = (x_145 + 1); + } + } + { + int const x_147 = i4; + i4 = (x_147 + 1); + } + } + { + int const x_149 = i3; + i3 = (x_149 + 1); + } + } + { + int const x_151 = i2; + i2 = (x_151 + 1); + } + } + { + int const x_153 = i1; + i1 = (x_153 + 1); + } + } + { + int const x_155 = i0; + i0 = (x_155 + 1); + } + } + int const x_157 = a; + if ((x_157 == 3)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..854519d1cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.spvasm @@ -0,0 +1,372 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 201 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i0 "i0" + OpName %i1 "i1" + OpName %i2 "i2" + OpName %i3 "i3" + OpName %i4 "i4" + OpName %i5 "i5" + OpName %i6 "i6" + OpName %i7 "i7" + OpName %i8_1 "i8_1" + OpName %i9 "i9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %187 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %188 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %189 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %18 + %i0 = OpVariable %_ptr_Function_int Function %18 + %i1 = OpVariable %_ptr_Function_int Function %18 + %i2 = OpVariable %_ptr_Function_int Function %18 + %i3 = OpVariable %_ptr_Function_int Function %18 + %i4 = OpVariable %_ptr_Function_int Function %18 + %i5 = OpVariable %_ptr_Function_int Function %18 + %i6 = OpVariable %_ptr_Function_int Function %18 + %i7 = OpVariable %_ptr_Function_int Function %18 + %i8_1 = OpVariable %_ptr_Function_int Function %18 + %i9 = OpVariable %_ptr_Function_int Function %18 + OpStore %a %int_0 + OpStore %i0 %int_0 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i0 + %38 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %39 = OpLoad %int %38 + %40 = OpSLessThan %bool %34 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %44 + %43 = OpLabel + OpBranch %42 + %44 = OpLabel + OpBranch %31 + %42 = OpLabel + OpStore %i1 %int_0 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %i1 + %50 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %51 = OpLoad %int %50 + %52 = OpSLessThan %bool %49 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + OpBranch %53 + %55 = OpLabel + OpBranch %46 + %53 = OpLabel + OpStore %i2 %int_0 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %int %i2 + %61 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %62 = OpLoad %int %61 + %63 = OpSLessThan %bool %60 %62 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %57 + %64 = OpLabel + OpStore %i3 %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %i3 + %72 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %73 = OpLoad %int %72 + %75 = OpIAdd %int %73 %int_2 + %76 = OpSLessThan %bool %71 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + OpBranch %77 + %79 = OpLabel + OpBranch %68 + %77 = OpLabel + OpStore %i4 %int_0 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %int %i4 + %85 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %86 = OpLoad %int %85 + %87 = OpSLessThan %bool %84 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %90 + %89 = OpLabel + OpBranch %88 + %90 = OpLabel + OpBranch %81 + %88 = OpLabel + OpStore %i5 %int_0 + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %i5 + %96 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %97 = OpLoad %int %96 + %98 = OpSLessThan %bool %95 %97 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %101 + %100 = OpLabel + OpBranch %99 + %101 = OpLabel + OpBranch %92 + %99 = OpLabel + OpBranch %102 + %102 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %107 = OpLoad %int %106 + %108 = OpSGreaterThan %bool %107 %int_0 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %111 + %110 = OpLabel + OpBranch %109 + %111 = OpLabel + OpBranch %103 + %109 = OpLabel + OpStore %i6 %int_0 + OpBranch %112 + %112 = OpLabel + OpLoopMerge %113 %114 None + OpBranch %115 + %115 = OpLabel + %116 = OpLoad %int %i6 + %117 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %118 = OpLoad %int %117 + %119 = OpSLessThan %bool %116 %118 + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %122 + %121 = OpLabel + OpBranch %120 + %122 = OpLabel + OpBranch %113 + %120 = OpLabel + OpStore %i7 %int_0 + OpBranch %123 + %123 = OpLabel + OpLoopMerge %124 %125 None + OpBranch %126 + %126 = OpLabel + %127 = OpLoad %int %i7 + %128 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %129 = OpLoad %int %128 + %130 = OpSLessThan %bool %127 %129 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %133 + %132 = OpLabel + OpBranch %131 + %133 = OpLabel + OpBranch %124 + %131 = OpLabel + OpStore %i8_1 %int_0 + OpBranch %134 + %134 = OpLabel + OpLoopMerge %135 %136 None + OpBranch %137 + %137 = OpLabel + %138 = OpLoad %int %i8_1 + %139 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %140 = OpLoad %int %139 + %141 = OpSLessThan %bool %138 %140 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %144 + %143 = OpLabel + OpBranch %142 + %144 = OpLabel + OpBranch %135 + %142 = OpLabel + OpStore %i9 %int_0 + OpBranch %145 + %145 = OpLabel + OpLoopMerge %146 %147 None + OpBranch %148 + %148 = OpLabel + %149 = OpLoad %int %i9 + %150 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %151 = OpLoad %int %150 + %152 = OpSLessThan %bool %149 %151 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %155 + %154 = OpLabel + OpBranch %153 + %155 = OpLabel + OpBranch %146 + %153 = OpLabel + %156 = OpLoad %int %a + %158 = OpIAdd %int %156 %int_1 + OpStore %a %158 + OpBranch %147 + %147 = OpLabel + %159 = OpLoad %int %i9 + %160 = OpIAdd %int %159 %int_1 + OpStore %i9 %160 + OpBranch %145 + %146 = OpLabel + OpBranch %136 + %136 = OpLabel + %161 = OpLoad %int %i8_1 + %162 = OpIAdd %int %161 %int_1 + OpStore %i8_1 %162 + OpBranch %134 + %135 = OpLabel + OpBranch %125 + %125 = OpLabel + %163 = OpLoad %int %i7 + %164 = OpIAdd %int %163 %int_1 + OpStore %i7 %164 + OpBranch %123 + %124 = OpLabel + OpBranch %114 + %114 = OpLabel + %165 = OpLoad %int %i6 + %166 = OpIAdd %int %165 %int_1 + OpStore %i6 %166 + OpBranch %112 + %113 = OpLabel + OpBranch %103 + %104 = OpLabel + OpBranch %102 + %103 = OpLabel + OpBranch %93 + %93 = OpLabel + %167 = OpLoad %int %i5 + %168 = OpIAdd %int %167 %int_1 + OpStore %i5 %168 + OpBranch %91 + %92 = OpLabel + OpBranch %82 + %82 = OpLabel + %169 = OpLoad %int %i4 + %170 = OpIAdd %int %169 %int_1 + OpStore %i4 %170 + OpBranch %80 + %81 = OpLabel + OpBranch %69 + %69 = OpLabel + %171 = OpLoad %int %i3 + %172 = OpIAdd %int %171 %int_1 + OpStore %i3 %172 + OpBranch %67 + %68 = OpLabel + OpBranch %58 + %58 = OpLabel + %173 = OpLoad %int %i2 + %174 = OpIAdd %int %173 %int_1 + OpStore %i2 %174 + OpBranch %56 + %57 = OpLabel + OpBranch %47 + %47 = OpLabel + %175 = OpLoad %int %i1 + %176 = OpIAdd %int %175 %int_1 + OpStore %i1 %176 + OpBranch %45 + %46 = OpLabel + OpBranch %32 + %32 = OpLabel + %177 = OpLoad %int %i0 + %178 = OpIAdd %int %177 %int_1 + OpStore %i0 %178 + OpBranch %30 + %31 = OpLabel + %179 = OpLoad %int %a + %181 = OpIEqual %bool %179 %int_3 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %184 + %183 = OpLabel + OpStore %x_GLF_color %187 + OpBranch %182 + %184 = OpLabel + OpStore %x_GLF_color %188 + OpBranch %182 + %182 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %189 +%tint_symbol = OpFunctionParameter %main_out + %193 = OpLabel + %194 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %194 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %196 = OpLabel + %197 = OpFunctionCall %void %main_1 + %199 = OpLoad %v4float %x_GLF_color + %200 = OpCompositeConstruct %main_out %199 + %198 = OpFunctionCall %void %tint_symbol_2 %200 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..66f0852ab4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.spvasm.expected.wgsl @@ -0,0 +1,191 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i0 : i32; + var i1 : i32; + var i2 : i32; + var i3 : i32; + var i4 : i32; + var i5 : i32; + var i6 : i32; + var i7 : i32; + var i8_1 : i32; + var i9 : i32; + a = 0; + i0 = 0; + loop { + let x_40 : i32 = i0; + let x_42 : i32 = x_7.one; + if ((x_40 < x_42)) { + } else { + break; + } + i1 = 0; + loop { + let x_49 : i32 = i1; + let x_51 : i32 = x_7.one; + if ((x_49 < x_51)) { + } else { + break; + } + i2 = 0; + loop { + let x_58 : i32 = i2; + let x_60 : i32 = x_7.one; + if ((x_58 < x_60)) { + } else { + break; + } + i3 = 0; + loop { + let x_67 : i32 = i3; + let x_69 : i32 = x_7.one; + if ((x_67 < (x_69 + 2))) { + } else { + break; + } + i4 = 0; + loop { + let x_77 : i32 = i4; + let x_79 : i32 = x_7.one; + if ((x_77 < x_79)) { + } else { + break; + } + i5 = 0; + loop { + let x_86 : i32 = i5; + let x_88 : i32 = x_7.one; + if ((x_86 < x_88)) { + } else { + break; + } + loop { + let x_96 : i32 = x_7.one; + if ((x_96 > 0)) { + } else { + break; + } + i6 = 0; + loop { + let x_103 : i32 = i6; + let x_105 : i32 = x_7.one; + if ((x_103 < x_105)) { + } else { + break; + } + i7 = 0; + loop { + let x_112 : i32 = i7; + let x_114 : i32 = x_7.one; + if ((x_112 < x_114)) { + } else { + break; + } + i8_1 = 0; + loop { + let x_121 : i32 = i8_1; + let x_123 : i32 = x_7.one; + if ((x_121 < x_123)) { + } else { + break; + } + i9 = 0; + loop { + let x_130 : i32 = i9; + let x_132 : i32 = x_7.one; + if ((x_130 < x_132)) { + } else { + break; + } + let x_135 : i32 = a; + a = (x_135 + 1); + + continuing { + let x_137 : i32 = i9; + i9 = (x_137 + 1); + } + } + + continuing { + let x_139 : i32 = i8_1; + i8_1 = (x_139 + 1); + } + } + + continuing { + let x_141 : i32 = i7; + i7 = (x_141 + 1); + } + } + + continuing { + let x_143 : i32 = i6; + i6 = (x_143 + 1); + } + } + break; + } + + continuing { + let x_145 : i32 = i5; + i5 = (x_145 + 1); + } + } + + continuing { + let x_147 : i32 = i4; + i4 = (x_147 + 1); + } + } + + continuing { + let x_149 : i32 = i3; + i3 = (x_149 + 1); + } + } + + continuing { + let x_151 : i32 = i2; + i2 = (x_151 + 1); + } + } + + continuing { + let x_153 : i32 = i1; + i1 = (x_153 + 1); + } + } + + continuing { + let x_155 : i32 = i0; + i0 = (x_155 + 1); + } + } + let x_157 : i32 = a; + if ((x_157 == 3)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl new file mode 100644 index 0000000000..66f0852ab4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl @@ -0,0 +1,191 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i0 : i32; + var i1 : i32; + var i2 : i32; + var i3 : i32; + var i4 : i32; + var i5 : i32; + var i6 : i32; + var i7 : i32; + var i8_1 : i32; + var i9 : i32; + a = 0; + i0 = 0; + loop { + let x_40 : i32 = i0; + let x_42 : i32 = x_7.one; + if ((x_40 < x_42)) { + } else { + break; + } + i1 = 0; + loop { + let x_49 : i32 = i1; + let x_51 : i32 = x_7.one; + if ((x_49 < x_51)) { + } else { + break; + } + i2 = 0; + loop { + let x_58 : i32 = i2; + let x_60 : i32 = x_7.one; + if ((x_58 < x_60)) { + } else { + break; + } + i3 = 0; + loop { + let x_67 : i32 = i3; + let x_69 : i32 = x_7.one; + if ((x_67 < (x_69 + 2))) { + } else { + break; + } + i4 = 0; + loop { + let x_77 : i32 = i4; + let x_79 : i32 = x_7.one; + if ((x_77 < x_79)) { + } else { + break; + } + i5 = 0; + loop { + let x_86 : i32 = i5; + let x_88 : i32 = x_7.one; + if ((x_86 < x_88)) { + } else { + break; + } + loop { + let x_96 : i32 = x_7.one; + if ((x_96 > 0)) { + } else { + break; + } + i6 = 0; + loop { + let x_103 : i32 = i6; + let x_105 : i32 = x_7.one; + if ((x_103 < x_105)) { + } else { + break; + } + i7 = 0; + loop { + let x_112 : i32 = i7; + let x_114 : i32 = x_7.one; + if ((x_112 < x_114)) { + } else { + break; + } + i8_1 = 0; + loop { + let x_121 : i32 = i8_1; + let x_123 : i32 = x_7.one; + if ((x_121 < x_123)) { + } else { + break; + } + i9 = 0; + loop { + let x_130 : i32 = i9; + let x_132 : i32 = x_7.one; + if ((x_130 < x_132)) { + } else { + break; + } + let x_135 : i32 = a; + a = (x_135 + 1); + + continuing { + let x_137 : i32 = i9; + i9 = (x_137 + 1); + } + } + + continuing { + let x_139 : i32 = i8_1; + i8_1 = (x_139 + 1); + } + } + + continuing { + let x_141 : i32 = i7; + i7 = (x_141 + 1); + } + } + + continuing { + let x_143 : i32 = i6; + i6 = (x_143 + 1); + } + } + break; + } + + continuing { + let x_145 : i32 = i5; + i5 = (x_145 + 1); + } + } + + continuing { + let x_147 : i32 = i4; + i4 = (x_147 + 1); + } + } + + continuing { + let x_149 : i32 = i3; + i3 = (x_149 + 1); + } + } + + continuing { + let x_151 : i32 = i2; + i2 = (x_151 + 1); + } + } + + continuing { + let x_153 : i32 = i1; + i1 = (x_153 + 1); + } + } + + continuing { + let x_155 : i32 = i0; + i0 = (x_155 + 1); + } + } + let x_157 : i32 = a; + if ((x_157 == 3)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9982cdee30 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.hlsl @@ -0,0 +1,168 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i0 = 0; + int i1 = 0; + int i2 = 0; + int i3 = 0; + int i4 = 0; + int i5 = 0; + int i6 = 0; + int i7 = 0; + int i8_1 = 0; + int i9 = 0; + a = 0; + i0 = 0; + while (true) { + const int x_40 = i0; + const int x_42 = asint(x_7[0].x); + if ((x_40 < x_42)) { + } else { + break; + } + i1 = 0; + while (true) { + const int x_49 = i1; + const int x_51 = asint(x_7[0].x); + if ((x_49 < x_51)) { + } else { + break; + } + i2 = 0; + while (true) { + const int x_58 = i2; + const int x_60 = asint(x_7[0].x); + if ((x_58 < x_60)) { + } else { + break; + } + i3 = 0; + while (true) { + const int x_67 = i3; + const int x_69 = asint(x_7[0].x); + if ((x_67 < (x_69 + 2))) { + } else { + break; + } + i4 = 0; + while (true) { + const int x_77 = i4; + const int x_79 = asint(x_7[0].x); + if ((x_77 < x_79)) { + } else { + break; + } + i5 = 0; + while (true) { + const int x_86 = i5; + const int x_88 = asint(x_7[0].x); + if ((x_86 < x_88)) { + } else { + break; + } + while (true) { + const int x_96 = asint(x_7[0].x); + if ((x_96 > 0)) { + } else { + break; + } + i6 = 0; + while (true) { + const int x_103 = i6; + const int x_105 = asint(x_7[0].x); + if ((x_103 < x_105)) { + } else { + break; + } + i7 = 0; + while (true) { + const int x_112 = i7; + const int x_114 = asint(x_7[0].x); + if ((x_112 < x_114)) { + } else { + break; + } + i8_1 = 0; + while (true) { + const int x_121 = i8_1; + const int x_123 = asint(x_7[0].x); + if ((x_121 < x_123)) { + } else { + break; + } + i9 = 0; + while (true) { + const int x_130 = i9; + const int x_132 = asint(x_7[0].x); + if ((x_130 < x_132)) { + } else { + break; + } + a = (a + 1); + { + i9 = (i9 + 1); + } + } + { + i8_1 = (i8_1 + 1); + } + } + { + i7 = (i7 + 1); + } + } + { + i6 = (i6 + 1); + } + } + break; + } + { + i5 = (i5 + 1); + } + } + { + i4 = (i4 + 1); + } + } + { + i3 = (i3 + 1); + } + } + { + i2 = (i2 + 1); + } + } + { + i1 = (i1 + 1); + } + } + { + i0 = (i0 + 1); + } + } + if ((a == 3)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..77cd3d14b7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.msl @@ -0,0 +1,183 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int a = 0; + int i0 = 0; + int i1 = 0; + int i2 = 0; + int i3 = 0; + int i4 = 0; + int i5 = 0; + int i6 = 0; + int i7 = 0; + int i8_1 = 0; + int i9 = 0; + a = 0; + i0 = 0; + while (true) { + int const x_40 = i0; + int const x_42 = x_7.one; + if ((x_40 < x_42)) { + } else { + break; + } + i1 = 0; + while (true) { + int const x_49 = i1; + int const x_51 = x_7.one; + if ((x_49 < x_51)) { + } else { + break; + } + i2 = 0; + while (true) { + int const x_58 = i2; + int const x_60 = x_7.one; + if ((x_58 < x_60)) { + } else { + break; + } + i3 = 0; + while (true) { + int const x_67 = i3; + int const x_69 = x_7.one; + if ((x_67 < (x_69 + 2))) { + } else { + break; + } + i4 = 0; + while (true) { + int const x_77 = i4; + int const x_79 = x_7.one; + if ((x_77 < x_79)) { + } else { + break; + } + i5 = 0; + while (true) { + int const x_86 = i5; + int const x_88 = x_7.one; + if ((x_86 < x_88)) { + } else { + break; + } + while (true) { + int const x_96 = x_7.one; + if ((x_96 > 0)) { + } else { + break; + } + i6 = 0; + while (true) { + int const x_103 = i6; + int const x_105 = x_7.one; + if ((x_103 < x_105)) { + } else { + break; + } + i7 = 0; + while (true) { + int const x_112 = i7; + int const x_114 = x_7.one; + if ((x_112 < x_114)) { + } else { + break; + } + i8_1 = 0; + while (true) { + int const x_121 = i8_1; + int const x_123 = x_7.one; + if ((x_121 < x_123)) { + } else { + break; + } + i9 = 0; + while (true) { + int const x_130 = i9; + int const x_132 = x_7.one; + if ((x_130 < x_132)) { + } else { + break; + } + int const x_135 = a; + a = (x_135 + 1); + { + int const x_137 = i9; + i9 = (x_137 + 1); + } + } + { + int const x_139 = i8_1; + i8_1 = (x_139 + 1); + } + } + { + int const x_141 = i7; + i7 = (x_141 + 1); + } + } + { + int const x_143 = i6; + i6 = (x_143 + 1); + } + } + break; + } + { + int const x_145 = i5; + i5 = (x_145 + 1); + } + } + { + int const x_147 = i4; + i4 = (x_147 + 1); + } + } + { + int const x_149 = i3; + i3 = (x_149 + 1); + } + } + { + int const x_151 = i2; + i2 = (x_151 + 1); + } + } + { + int const x_153 = i1; + i1 = (x_153 + 1); + } + } + { + int const x_155 = i0; + i0 = (x_155 + 1); + } + } + int const x_157 = a; + if ((x_157 == 3)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..854519d1cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.spvasm @@ -0,0 +1,372 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 201 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i0 "i0" + OpName %i1 "i1" + OpName %i2 "i2" + OpName %i3 "i3" + OpName %i4 "i4" + OpName %i5 "i5" + OpName %i6 "i6" + OpName %i7 "i7" + OpName %i8_1 "i8_1" + OpName %i9 "i9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %187 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %188 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %189 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %18 + %i0 = OpVariable %_ptr_Function_int Function %18 + %i1 = OpVariable %_ptr_Function_int Function %18 + %i2 = OpVariable %_ptr_Function_int Function %18 + %i3 = OpVariable %_ptr_Function_int Function %18 + %i4 = OpVariable %_ptr_Function_int Function %18 + %i5 = OpVariable %_ptr_Function_int Function %18 + %i6 = OpVariable %_ptr_Function_int Function %18 + %i7 = OpVariable %_ptr_Function_int Function %18 + %i8_1 = OpVariable %_ptr_Function_int Function %18 + %i9 = OpVariable %_ptr_Function_int Function %18 + OpStore %a %int_0 + OpStore %i0 %int_0 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i0 + %38 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %39 = OpLoad %int %38 + %40 = OpSLessThan %bool %34 %39 + OpSelectionMerge %42 None + OpBranchConditional %40 %43 %44 + %43 = OpLabel + OpBranch %42 + %44 = OpLabel + OpBranch %31 + %42 = OpLabel + OpStore %i1 %int_0 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %i1 + %50 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %51 = OpLoad %int %50 + %52 = OpSLessThan %bool %49 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + OpBranch %53 + %55 = OpLabel + OpBranch %46 + %53 = OpLabel + OpStore %i2 %int_0 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %int %i2 + %61 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %62 = OpLoad %int %61 + %63 = OpSLessThan %bool %60 %62 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %57 + %64 = OpLabel + OpStore %i3 %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %i3 + %72 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %73 = OpLoad %int %72 + %75 = OpIAdd %int %73 %int_2 + %76 = OpSLessThan %bool %71 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + OpBranch %77 + %79 = OpLabel + OpBranch %68 + %77 = OpLabel + OpStore %i4 %int_0 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %int %i4 + %85 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %86 = OpLoad %int %85 + %87 = OpSLessThan %bool %84 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %90 + %89 = OpLabel + OpBranch %88 + %90 = OpLabel + OpBranch %81 + %88 = OpLabel + OpStore %i5 %int_0 + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %i5 + %96 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %97 = OpLoad %int %96 + %98 = OpSLessThan %bool %95 %97 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %101 + %100 = OpLabel + OpBranch %99 + %101 = OpLabel + OpBranch %92 + %99 = OpLabel + OpBranch %102 + %102 = OpLabel + OpLoopMerge %103 %104 None + OpBranch %105 + %105 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %107 = OpLoad %int %106 + %108 = OpSGreaterThan %bool %107 %int_0 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %111 + %110 = OpLabel + OpBranch %109 + %111 = OpLabel + OpBranch %103 + %109 = OpLabel + OpStore %i6 %int_0 + OpBranch %112 + %112 = OpLabel + OpLoopMerge %113 %114 None + OpBranch %115 + %115 = OpLabel + %116 = OpLoad %int %i6 + %117 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %118 = OpLoad %int %117 + %119 = OpSLessThan %bool %116 %118 + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %122 + %121 = OpLabel + OpBranch %120 + %122 = OpLabel + OpBranch %113 + %120 = OpLabel + OpStore %i7 %int_0 + OpBranch %123 + %123 = OpLabel + OpLoopMerge %124 %125 None + OpBranch %126 + %126 = OpLabel + %127 = OpLoad %int %i7 + %128 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %129 = OpLoad %int %128 + %130 = OpSLessThan %bool %127 %129 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %133 + %132 = OpLabel + OpBranch %131 + %133 = OpLabel + OpBranch %124 + %131 = OpLabel + OpStore %i8_1 %int_0 + OpBranch %134 + %134 = OpLabel + OpLoopMerge %135 %136 None + OpBranch %137 + %137 = OpLabel + %138 = OpLoad %int %i8_1 + %139 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %140 = OpLoad %int %139 + %141 = OpSLessThan %bool %138 %140 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %144 + %143 = OpLabel + OpBranch %142 + %144 = OpLabel + OpBranch %135 + %142 = OpLabel + OpStore %i9 %int_0 + OpBranch %145 + %145 = OpLabel + OpLoopMerge %146 %147 None + OpBranch %148 + %148 = OpLabel + %149 = OpLoad %int %i9 + %150 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %151 = OpLoad %int %150 + %152 = OpSLessThan %bool %149 %151 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %155 + %154 = OpLabel + OpBranch %153 + %155 = OpLabel + OpBranch %146 + %153 = OpLabel + %156 = OpLoad %int %a + %158 = OpIAdd %int %156 %int_1 + OpStore %a %158 + OpBranch %147 + %147 = OpLabel + %159 = OpLoad %int %i9 + %160 = OpIAdd %int %159 %int_1 + OpStore %i9 %160 + OpBranch %145 + %146 = OpLabel + OpBranch %136 + %136 = OpLabel + %161 = OpLoad %int %i8_1 + %162 = OpIAdd %int %161 %int_1 + OpStore %i8_1 %162 + OpBranch %134 + %135 = OpLabel + OpBranch %125 + %125 = OpLabel + %163 = OpLoad %int %i7 + %164 = OpIAdd %int %163 %int_1 + OpStore %i7 %164 + OpBranch %123 + %124 = OpLabel + OpBranch %114 + %114 = OpLabel + %165 = OpLoad %int %i6 + %166 = OpIAdd %int %165 %int_1 + OpStore %i6 %166 + OpBranch %112 + %113 = OpLabel + OpBranch %103 + %104 = OpLabel + OpBranch %102 + %103 = OpLabel + OpBranch %93 + %93 = OpLabel + %167 = OpLoad %int %i5 + %168 = OpIAdd %int %167 %int_1 + OpStore %i5 %168 + OpBranch %91 + %92 = OpLabel + OpBranch %82 + %82 = OpLabel + %169 = OpLoad %int %i4 + %170 = OpIAdd %int %169 %int_1 + OpStore %i4 %170 + OpBranch %80 + %81 = OpLabel + OpBranch %69 + %69 = OpLabel + %171 = OpLoad %int %i3 + %172 = OpIAdd %int %171 %int_1 + OpStore %i3 %172 + OpBranch %67 + %68 = OpLabel + OpBranch %58 + %58 = OpLabel + %173 = OpLoad %int %i2 + %174 = OpIAdd %int %173 %int_1 + OpStore %i2 %174 + OpBranch %56 + %57 = OpLabel + OpBranch %47 + %47 = OpLabel + %175 = OpLoad %int %i1 + %176 = OpIAdd %int %175 %int_1 + OpStore %i1 %176 + OpBranch %45 + %46 = OpLabel + OpBranch %32 + %32 = OpLabel + %177 = OpLoad %int %i0 + %178 = OpIAdd %int %177 %int_1 + OpStore %i0 %178 + OpBranch %30 + %31 = OpLabel + %179 = OpLoad %int %a + %181 = OpIEqual %bool %179 %int_3 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %184 + %183 = OpLabel + OpStore %x_GLF_color %187 + OpBranch %182 + %184 = OpLabel + OpStore %x_GLF_color %188 + OpBranch %182 + %182 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %189 +%tint_symbol = OpFunctionParameter %main_out + %193 = OpLabel + %194 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %194 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %196 = OpLabel + %197 = OpFunctionCall %void %main_1 + %199 = OpLoad %v4float %x_GLF_color + %200 = OpCompositeConstruct %main_out %199 + %198 = OpFunctionCall %void %tint_symbol_2 %200 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..66f0852ab4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-scaled-number-nested-loops/0-opt.wgsl.expected.wgsl @@ -0,0 +1,191 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i0 : i32; + var i1 : i32; + var i2 : i32; + var i3 : i32; + var i4 : i32; + var i5 : i32; + var i6 : i32; + var i7 : i32; + var i8_1 : i32; + var i9 : i32; + a = 0; + i0 = 0; + loop { + let x_40 : i32 = i0; + let x_42 : i32 = x_7.one; + if ((x_40 < x_42)) { + } else { + break; + } + i1 = 0; + loop { + let x_49 : i32 = i1; + let x_51 : i32 = x_7.one; + if ((x_49 < x_51)) { + } else { + break; + } + i2 = 0; + loop { + let x_58 : i32 = i2; + let x_60 : i32 = x_7.one; + if ((x_58 < x_60)) { + } else { + break; + } + i3 = 0; + loop { + let x_67 : i32 = i3; + let x_69 : i32 = x_7.one; + if ((x_67 < (x_69 + 2))) { + } else { + break; + } + i4 = 0; + loop { + let x_77 : i32 = i4; + let x_79 : i32 = x_7.one; + if ((x_77 < x_79)) { + } else { + break; + } + i5 = 0; + loop { + let x_86 : i32 = i5; + let x_88 : i32 = x_7.one; + if ((x_86 < x_88)) { + } else { + break; + } + loop { + let x_96 : i32 = x_7.one; + if ((x_96 > 0)) { + } else { + break; + } + i6 = 0; + loop { + let x_103 : i32 = i6; + let x_105 : i32 = x_7.one; + if ((x_103 < x_105)) { + } else { + break; + } + i7 = 0; + loop { + let x_112 : i32 = i7; + let x_114 : i32 = x_7.one; + if ((x_112 < x_114)) { + } else { + break; + } + i8_1 = 0; + loop { + let x_121 : i32 = i8_1; + let x_123 : i32 = x_7.one; + if ((x_121 < x_123)) { + } else { + break; + } + i9 = 0; + loop { + let x_130 : i32 = i9; + let x_132 : i32 = x_7.one; + if ((x_130 < x_132)) { + } else { + break; + } + let x_135 : i32 = a; + a = (x_135 + 1); + + continuing { + let x_137 : i32 = i9; + i9 = (x_137 + 1); + } + } + + continuing { + let x_139 : i32 = i8_1; + i8_1 = (x_139 + 1); + } + } + + continuing { + let x_141 : i32 = i7; + i7 = (x_141 + 1); + } + } + + continuing { + let x_143 : i32 = i6; + i6 = (x_143 + 1); + } + } + break; + } + + continuing { + let x_145 : i32 = i5; + i5 = (x_145 + 1); + } + } + + continuing { + let x_147 : i32 = i4; + i4 = (x_147 + 1); + } + } + + continuing { + let x_149 : i32 = i3; + i3 = (x_149 + 1); + } + } + + continuing { + let x_151 : i32 = i2; + i2 = (x_151 + 1); + } + } + + continuing { + let x_153 : i32 = i1; + i1 = (x_153 + 1); + } + } + + continuing { + let x_155 : i32 = i0; + i0 = (x_155 + 1); + } + } + let x_157 : i32 = a; + if ((x_157 == 3)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm new file mode 100644 index 0000000000..5c74e57b17 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm @@ -0,0 +1,93 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %b "b" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 + %buf0 = OpTypeStruct %_arr_float_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %main = OpFunction %void None %10 + %26 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %b = OpVariable %_ptr_Function_float Function + %27 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %28 = OpLoad %float %27 + %29 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %30 = OpLoad %float %29 + %31 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %32 = OpLoad %float %31 + %33 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %34 = OpLoad %float %33 + %35 = OpFOrdGreaterThan %bool %32 %34 + %36 = OpSelect %float %35 %30 %28 + OpStore %a %36 + %37 = OpLoad %float %a + %38 = OpExtInst %float %1 Log %37 + %39 = OpExtInst %float %1 Cos %38 + OpStore %b %39 + %40 = OpLoad %float %b + %41 = OpCompositeConstruct %v4float %40 %40 %40 %40 + OpStore %_GLF_color %41 + %42 = OpLoad %float %b + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpFOrdGreaterThan %bool %42 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + %48 = OpLoad %float %b + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %50 = OpLoad %float %49 + %51 = OpFOrdLessThan %bool %48 %50 + OpBranch %46 + %46 = OpLabel + %52 = OpPhi %bool %45 %26 %51 %47 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %56 = OpLoad %float %55 + %57 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_4 + %58 = OpLoad %float %57 + %59 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_4 + %60 = OpLoad %float %59 + %61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %62 = OpLoad %float %61 + %63 = OpCompositeConstruct %v4float %56 %58 %60 %62 + OpStore %_GLF_color %63 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..7fa995298f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.hlsl @@ -0,0 +1,52 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + float b = 0.0f; + bool x_51 = false; + bool x_52_phi = false; + const float x_28 = asfloat(x_6[2].x); + const float x_30 = asfloat(x_6[3].x); + const float x_32 = asfloat(x_6[3].x); + const float x_34 = asfloat(x_6[2].x); + a = ((x_32 > x_34) ? x_30 : x_28); + b = cos(log(a)); + const float x_40 = b; + x_GLF_color = float4(x_40, x_40, x_40, x_40); + const float x_42 = b; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const bool x_45 = (x_42 > x_44); + x_52_phi = x_45; + if (x_45) { + const float x_48 = b; + const float x_50 = asfloat(x_6[1].x); + x_51 = (x_48 < x_50); + x_52_phi = x_51; + } + if (x_52_phi) { + const float x_56 = asfloat(x_6[3].x); + const float x_58 = asfloat(x_6[4].x); + const float x_60 = asfloat(x_6[4].x); + const float x_62 = asfloat(x_6[3].x); + x_GLF_color = float4(x_56, x_58, x_60, x_62); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b2905ce5dc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float a = 0.0f; + float b = 0.0f; + bool x_51 = false; + bool x_52_phi = false; + float const x_28 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_30 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_32 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_34 = x_6.x_GLF_uniform_float_values.arr[2].el; + a = select(x_28, x_30, (x_32 > x_34)); + float const x_37 = a; + b = cos(log(x_37)); + float const x_40 = b; + *(tint_symbol_4) = float4(x_40, x_40, x_40, x_40); + float const x_42 = b; + float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el; + bool const x_45 = (x_42 > x_44); + x_52_phi = x_45; + if (x_45) { + float const x_48 = b; + float const x_50 = x_6.x_GLF_uniform_float_values.arr[1].el; + x_51 = (x_48 < x_50); + x_52_phi = x_51; + } + bool const x_52 = x_52_phi; + if (x_52) { + float const x_56 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_58 = x_6.x_GLF_uniform_float_values.arr[4].el; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[4].el; + float const x_62 = x_6.x_GLF_uniform_float_values.arr[3].el; + *(tint_symbol_4) = float4(x_56, x_58, x_60, x_62); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f34e73cec3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.spvasm @@ -0,0 +1,137 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 86 +; Schema: 0 + OpCapability Shader + %44 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %x_51 "x_51" + OpName %x_52_phi "x_52_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 + %buf0 = OpTypeStruct %_arr_float_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %25 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %74 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %a = OpVariable %_ptr_Function_float Function %20 + %b = OpVariable %_ptr_Function_float Function %20 + %x_51 = OpVariable %_ptr_Function_bool Function %25 + %x_52_phi = OpVariable %_ptr_Function_bool Function %25 + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %32 = OpLoad %float %31 + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %39 = OpLoad %float %38 + %41 = OpFOrdGreaterThan %bool %37 %39 + %40 = OpSelect %float %41 %35 %32 + OpStore %a %40 + %42 = OpLoad %float %a + %45 = OpExtInst %float %44 Log %42 + %43 = OpExtInst %float %44 Cos %45 + OpStore %b %43 + %46 = OpLoad %float %b + %47 = OpCompositeConstruct %v4float %46 %46 %46 %46 + OpStore %x_GLF_color %47 + %48 = OpLoad %float %b + %50 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %51 = OpLoad %float %50 + %52 = OpFOrdGreaterThan %bool %48 %51 + OpStore %x_52_phi %52 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + %55 = OpLoad %float %b + %57 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %58 = OpLoad %float %57 + %59 = OpFOrdLessThan %bool %55 %58 + OpStore %x_51 %59 + %60 = OpLoad %bool %x_51 + OpStore %x_52_phi %60 + OpBranch %53 + %53 = OpLabel + %61 = OpLoad %bool %x_52_phi + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %65 = OpLoad %float %64 + %67 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_4 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_4 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %72 = OpLoad %float %71 + %73 = OpCompositeConstruct %v4float %65 %68 %70 %72 + OpStore %x_GLF_color %73 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %74 +%tint_symbol = OpFunctionParameter %main_out + %78 = OpLabel + %79 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %79 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %81 = OpLabel + %82 = OpFunctionCall %void %main_1 + %84 = OpLoad %v4float %x_GLF_color + %85 = OpCompositeConstruct %main_out %84 + %83 = OpFunctionCall %void %tint_symbol_2 %85 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b6b2e8d893 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.spvasm.expected.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var b : f32; + var x_51 : bool; + var x_52_phi : bool; + let x_28 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_30 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_32 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[2]; + a = select(x_28, x_30, (x_32 > x_34)); + let x_37 : f32 = a; + b = cos(log(x_37)); + let x_40 : f32 = b; + x_GLF_color = vec4(x_40, x_40, x_40, x_40); + let x_42 : f32 = b; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_45 : bool = (x_42 > x_44); + x_52_phi = x_45; + if (x_45) { + let x_48 : f32 = b; + let x_50 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_51 = (x_48 < x_50); + x_52_phi = x_51; + } + let x_52 : bool = x_52_phi; + if (x_52) { + let x_56 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_58 : f32 = x_6.x_GLF_uniform_float_values[4]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[4]; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_GLF_color = vec4(x_56, x_58, x_60, x_62); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl new file mode 100644 index 0000000000..b6b2e8d893 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var b : f32; + var x_51 : bool; + var x_52_phi : bool; + let x_28 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_30 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_32 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[2]; + a = select(x_28, x_30, (x_32 > x_34)); + let x_37 : f32 = a; + b = cos(log(x_37)); + let x_40 : f32 = b; + x_GLF_color = vec4(x_40, x_40, x_40, x_40); + let x_42 : f32 = b; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_45 : bool = (x_42 > x_44); + x_52_phi = x_45; + if (x_45) { + let x_48 : f32 = b; + let x_50 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_51 = (x_48 < x_50); + x_52_phi = x_51; + } + let x_52 : bool = x_52_phi; + if (x_52) { + let x_56 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_58 : f32 = x_6.x_GLF_uniform_float_values[4]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[4]; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_GLF_color = vec4(x_56, x_58, x_60, x_62); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..7fa995298f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.hlsl @@ -0,0 +1,52 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + float b = 0.0f; + bool x_51 = false; + bool x_52_phi = false; + const float x_28 = asfloat(x_6[2].x); + const float x_30 = asfloat(x_6[3].x); + const float x_32 = asfloat(x_6[3].x); + const float x_34 = asfloat(x_6[2].x); + a = ((x_32 > x_34) ? x_30 : x_28); + b = cos(log(a)); + const float x_40 = b; + x_GLF_color = float4(x_40, x_40, x_40, x_40); + const float x_42 = b; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const bool x_45 = (x_42 > x_44); + x_52_phi = x_45; + if (x_45) { + const float x_48 = b; + const float x_50 = asfloat(x_6[1].x); + x_51 = (x_48 < x_50); + x_52_phi = x_51; + } + if (x_52_phi) { + const float x_56 = asfloat(x_6[3].x); + const float x_58 = asfloat(x_6[4].x); + const float x_60 = asfloat(x_6[4].x); + const float x_62 = asfloat(x_6[3].x); + x_GLF_color = float4(x_56, x_58, x_60, x_62); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b2905ce5dc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float a = 0.0f; + float b = 0.0f; + bool x_51 = false; + bool x_52_phi = false; + float const x_28 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_30 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_32 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_34 = x_6.x_GLF_uniform_float_values.arr[2].el; + a = select(x_28, x_30, (x_32 > x_34)); + float const x_37 = a; + b = cos(log(x_37)); + float const x_40 = b; + *(tint_symbol_4) = float4(x_40, x_40, x_40, x_40); + float const x_42 = b; + float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el; + bool const x_45 = (x_42 > x_44); + x_52_phi = x_45; + if (x_45) { + float const x_48 = b; + float const x_50 = x_6.x_GLF_uniform_float_values.arr[1].el; + x_51 = (x_48 < x_50); + x_52_phi = x_51; + } + bool const x_52 = x_52_phi; + if (x_52) { + float const x_56 = x_6.x_GLF_uniform_float_values.arr[3].el; + float const x_58 = x_6.x_GLF_uniform_float_values.arr[4].el; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[4].el; + float const x_62 = x_6.x_GLF_uniform_float_values.arr[3].el; + *(tint_symbol_4) = float4(x_56, x_58, x_60, x_62); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f34e73cec3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.spvasm @@ -0,0 +1,137 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 86 +; Schema: 0 + OpCapability Shader + %44 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %x_51 "x_51" + OpName %x_52_phi "x_52_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 + %buf0 = OpTypeStruct %_arr_float_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %25 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %74 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %a = OpVariable %_ptr_Function_float Function %20 + %b = OpVariable %_ptr_Function_float Function %20 + %x_51 = OpVariable %_ptr_Function_bool Function %25 + %x_52_phi = OpVariable %_ptr_Function_bool Function %25 + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %32 = OpLoad %float %31 + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %39 = OpLoad %float %38 + %41 = OpFOrdGreaterThan %bool %37 %39 + %40 = OpSelect %float %41 %35 %32 + OpStore %a %40 + %42 = OpLoad %float %a + %45 = OpExtInst %float %44 Log %42 + %43 = OpExtInst %float %44 Cos %45 + OpStore %b %43 + %46 = OpLoad %float %b + %47 = OpCompositeConstruct %v4float %46 %46 %46 %46 + OpStore %x_GLF_color %47 + %48 = OpLoad %float %b + %50 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %51 = OpLoad %float %50 + %52 = OpFOrdGreaterThan %bool %48 %51 + OpStore %x_52_phi %52 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + %55 = OpLoad %float %b + %57 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %58 = OpLoad %float %57 + %59 = OpFOrdLessThan %bool %55 %58 + OpStore %x_51 %59 + %60 = OpLoad %bool %x_51 + OpStore %x_52_phi %60 + OpBranch %53 + %53 = OpLabel + %61 = OpLoad %bool %x_52_phi + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %65 = OpLoad %float %64 + %67 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_4 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_4 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %72 = OpLoad %float %71 + %73 = OpCompositeConstruct %v4float %65 %68 %70 %72 + OpStore %x_GLF_color %73 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %74 +%tint_symbol = OpFunctionParameter %main_out + %78 = OpLabel + %79 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %79 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %81 = OpLabel + %82 = OpFunctionCall %void %main_1 + %84 = OpLoad %v4float %x_GLF_color + %85 = OpCompositeConstruct %main_out %84 + %83 = OpFunctionCall %void %tint_symbol_2 %85 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b6b2e8d893 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-schedule-dag-rrlist-mix-log-cos/0-opt.wgsl.expected.wgsl @@ -0,0 +1,56 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var b : f32; + var x_51 : bool; + var x_52_phi : bool; + let x_28 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_30 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_32 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[2]; + a = select(x_28, x_30, (x_32 > x_34)); + let x_37 : f32 = a; + b = cos(log(x_37)); + let x_40 : f32 = b; + x_GLF_color = vec4(x_40, x_40, x_40, x_40); + let x_42 : f32 = b; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_45 : bool = (x_42 > x_44); + x_52_phi = x_45; + if (x_45) { + let x_48 : f32 = b; + let x_50 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_51 = (x_48 < x_50); + x_52_phi = x_51; + } + let x_52 : bool = x_52_phi; + if (x_52) { + let x_56 : f32 = x_6.x_GLF_uniform_float_values[3]; + let x_58 : f32 = x_6.x_GLF_uniform_float_values[4]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[4]; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[3]; + x_GLF_color = vec4(x_56, x_58, x_60, x_62); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm new file mode 100644 index 0000000000..fc29c37b39 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm @@ -0,0 +1,61 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %v "v" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %23 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + %24 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %25 = OpLoad %int %24 + %26 = OpConvertSToF %float %25 + %27 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %28 = OpLoad %int %27 + %29 = OpConvertSToF %float %28 + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %31 = OpLoad %int %30 + %32 = OpConvertSToF %float %31 + %33 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %34 = OpLoad %int %33 + %35 = OpConvertSToF %float %34 + %36 = OpCompositeConstruct %v4float %26 %29 %32 %35 + OpStore %_GLF_color %36 + %37 = OpLoad %v4float %_GLF_color + OpStore %v %37 + OpStore %_GLF_color %22 + %38 = OpLoad %v4float %v + OpStore %_GLF_color %38 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..84a456702d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.hlsl @@ -0,0 +1,33 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_25 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_28 = asint(x_5[1].x); + const int x_31 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_34 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_25), float(x_28), float(x_31), float(x_34)); + v = x_GLF_color; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_GLF_color = v; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b5f5cc9b60 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + int const x_25 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_28 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_31 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_34 = x_5.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_25), float(x_28), float(x_31), float(x_34)); + float4 const x_37 = *(tint_symbol_4); + v = x_37; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 const x_38 = v; + *(tint_symbol_4) = x_38; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..47829d0b56 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.spvasm @@ -0,0 +1,93 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %40 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %42 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %5 + %24 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %25 = OpLoad %int %24 + %27 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %28 = OpLoad %int %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %30 = OpLoad %int %29 + %31 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %32 = OpLoad %int %31 + %33 = OpConvertSToF %float %25 + %34 = OpConvertSToF %float %28 + %35 = OpConvertSToF %float %30 + %36 = OpConvertSToF %float %32 + %37 = OpCompositeConstruct %v4float %33 %34 %35 %36 + OpStore %x_GLF_color %37 + %38 = OpLoad %v4float %x_GLF_color + OpStore %v %38 + OpStore %x_GLF_color %40 + %41 = OpLoad %v4float %v + OpStore %x_GLF_color %41 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %42 +%tint_symbol = OpFunctionParameter %main_out + %46 = OpLabel + %47 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %47 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %main_1 + %52 = OpLoad %v4float %x_GLF_color + %53 = OpCompositeConstruct %main_out %52 + %51 = OpFunctionCall %void %tint_symbol_2 %53 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..501fd608f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var v : vec4; + let x_25 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_28 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_31 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_34 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_25), f32(x_28), f32(x_31), f32(x_34)); + let x_37 : vec4 = x_GLF_color; + v = x_37; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_38 : vec4 = v; + x_GLF_color = x_38; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl new file mode 100644 index 0000000000..501fd608f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl @@ -0,0 +1,36 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var v : vec4; + let x_25 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_28 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_31 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_34 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_25), f32(x_28), f32(x_31), f32(x_34)); + let x_37 : vec4 = x_GLF_color; + v = x_37; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_38 : vec4 = v; + x_GLF_color = x_38; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..84a456702d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_25 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_28 = asint(x_5[1].x); + const int x_31 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_34 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_25), float(x_28), float(x_31), float(x_34)); + v = x_GLF_color; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_GLF_color = v; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b5f5cc9b60 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + int const x_25 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_28 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_31 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_34 = x_5.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_25), float(x_28), float(x_31), float(x_34)); + float4 const x_37 = *(tint_symbol_4); + v = x_37; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 const x_38 = v; + *(tint_symbol_4) = x_38; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..47829d0b56 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.spvasm @@ -0,0 +1,93 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %40 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %42 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %5 + %24 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %25 = OpLoad %int %24 + %27 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %28 = OpLoad %int %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %30 = OpLoad %int %29 + %31 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %32 = OpLoad %int %31 + %33 = OpConvertSToF %float %25 + %34 = OpConvertSToF %float %28 + %35 = OpConvertSToF %float %30 + %36 = OpConvertSToF %float %32 + %37 = OpCompositeConstruct %v4float %33 %34 %35 %36 + OpStore %x_GLF_color %37 + %38 = OpLoad %v4float %x_GLF_color + OpStore %v %38 + OpStore %x_GLF_color %40 + %41 = OpLoad %v4float %v + OpStore %x_GLF_color %41 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %42 +%tint_symbol = OpFunctionParameter %main_out + %46 = OpLabel + %47 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %47 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %49 = OpLabel + %50 = OpFunctionCall %void %main_1 + %52 = OpLoad %v4float %x_GLF_color + %53 = OpCompositeConstruct %main_out %52 + %51 = OpFunctionCall %void %tint_symbol_2 %53 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..501fd608f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-assign-back-and-forth/0-opt.wgsl.expected.wgsl @@ -0,0 +1,36 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var v : vec4; + let x_25 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_28 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_31 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_34 : i32 = x_5.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_25), f32(x_28), f32(x_31), f32(x_34)); + let x_37 : vec4 = x_GLF_color; + v = x_37; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_38 : vec4 = v; + x_GLF_color = x_38; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm new file mode 100644 index 0000000000..b72cddb551 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm @@ -0,0 +1,103 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %c "c" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %25 = OpLabel + %c = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %26 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %27 = OpLoad %int %26 + OpStore %c %27 + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %29 = OpLoad %int %28 + OpStore %i %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %36 = OpLoad %int %35 + %37 = OpSLessThan %bool %34 %36 + OpBranchConditional %37 %38 %31 + %38 = OpLabel + %39 = OpLoad %int %i + %40 = OpNot %int %39 + OpStore %c %40 + %41 = OpLoad %int %c + %42 = OpExtInst %int %1 SClamp %41 %int_0 %int_3 + OpStore %c %42 + OpBranch %32 + %32 = OpLabel + %43 = OpLoad %int %i + %44 = OpIAdd %int %43 %int_1 + OpStore %i %44 + OpBranch %30 + %31 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpCompositeConstruct %v4float %47 %47 %47 %47 + OpStore %_GLF_color %48 + %49 = OpLoad %int %c + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpIEqual %bool %49 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %56 = OpLoad %int %55 + %57 = OpConvertSToF %float %56 + %58 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpCompositeConstruct %v4float %57 %60 %63 %66 + OpStore %_GLF_color %67 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3011a24b54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,54 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int c = 0; + int i = 0; + const int x_27 = asint(x_6[2].x); + c = x_27; + const int x_29 = asint(x_6[2].x); + i = x_29; + while (true) { + const int x_34 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_36 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_34 < x_36)) { + } else { + break; + } + c = ~(i); + c = clamp(c, 0, 3); + { + i = (i + 1); + } + } + const int x_46 = asint(x_6[1].x); + const float x_47 = float(x_46); + x_GLF_color = float4(x_47, x_47, x_47, x_47); + const int x_49 = c; + const int x_51 = asint(x_6[1].x); + if ((x_49 == x_51)) { + const int x_56 = asint(x_6[2].x); + const int x_59 = asint(x_6[1].x); + const int x_62 = asint(x_6[1].x); + const int x_65 = asint(x_6[2].x); + x_GLF_color = float4(float(x_56), float(x_59), float(x_62), float(x_65)); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..99d436c731 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.msl @@ -0,0 +1,66 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int c = 0; + int i = 0; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[2].el; + c = x_27; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_29; + while (true) { + int const x_34 = i; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_34 < x_36)) { + } else { + break; + } + int const x_39 = i; + c = ~(x_39); + int const x_41 = c; + c = clamp(x_41, 0, 3); + { + int const x_43 = i; + i = (x_43 + 1); + } + } + int const x_46 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_47 = float(x_46); + *(tint_symbol_4) = float4(x_47, x_47, x_47, x_47); + int const x_49 = c; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_49 == x_51)) { + int const x_56 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_59 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_56), float(x_59), float(x_62), float(x_65)); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..a8d0f90150 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %c "c" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %75 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %c = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %27 = OpLoad %int %26 + OpStore %c %27 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %29 = OpLoad %int %28 + OpStore %i %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpSLessThan %bool %34 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %31 + %40 = OpLabel + %43 = OpLoad %int %i + %44 = OpNot %int %43 + OpStore %c %44 + %45 = OpLoad %int %c + %46 = OpExtInst %int %47 SClamp %45 %int_0 %int_3 + OpStore %c %46 + OpBranch %32 + %32 = OpLabel + %49 = OpLoad %int %i + %51 = OpIAdd %int %49 %int_1 + OpStore %i %51 + OpBranch %30 + %31 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpCompositeConstruct %v4float %54 %54 %54 %54 + OpStore %x_GLF_color %55 + %56 = OpLoad %int %c + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpIEqual %bool %56 %58 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %60 + %61 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %63 + %71 = OpConvertSToF %float %65 + %72 = OpConvertSToF %float %67 + %73 = OpConvertSToF %float %69 + %74 = OpCompositeConstruct %v4float %70 %71 %72 %73 + OpStore %x_GLF_color %74 + OpBranch %60 + %60 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %75 +%tint_symbol = OpFunctionParameter %main_out + %79 = OpLabel + %80 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %80 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %82 = OpLabel + %83 = OpFunctionCall %void %main_1 + %85 = OpLoad %v4float %x_GLF_color + %86 = OpCompositeConstruct %main_out %85 + %84 = OpFunctionCall %void %tint_symbol_2 %86 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..97a2a509b4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,60 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var c : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[2]; + c = x_27; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_29; + loop { + let x_34 : i32 = i; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_34 < x_36)) { + } else { + break; + } + let x_39 : i32 = i; + c = ~(x_39); + let x_41 : i32 = c; + c = clamp(x_41, 0, 3); + + continuing { + let x_43 : i32 = i; + i = (x_43 + 1); + } + } + let x_46 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_47 : f32 = f32(x_46); + x_GLF_color = vec4(x_47, x_47, x_47, x_47); + let x_49 : i32 = c; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_49 == x_51)) { + let x_56 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_56), f32(x_59), f32(x_62), f32(x_65)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl new file mode 100644 index 0000000000..97a2a509b4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl @@ -0,0 +1,60 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var c : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[2]; + c = x_27; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_29; + loop { + let x_34 : i32 = i; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_34 < x_36)) { + } else { + break; + } + let x_39 : i32 = i; + c = ~(x_39); + let x_41 : i32 = c; + c = clamp(x_41, 0, 3); + + continuing { + let x_43 : i32 = i; + i = (x_43 + 1); + } + } + let x_46 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_47 : f32 = f32(x_46); + x_GLF_color = vec4(x_47, x_47, x_47, x_47); + let x_49 : i32 = c; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_49 == x_51)) { + let x_56 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_56), f32(x_59), f32(x_62), f32(x_65)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3011a24b54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,54 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int c = 0; + int i = 0; + const int x_27 = asint(x_6[2].x); + c = x_27; + const int x_29 = asint(x_6[2].x); + i = x_29; + while (true) { + const int x_34 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_36 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_34 < x_36)) { + } else { + break; + } + c = ~(i); + c = clamp(c, 0, 3); + { + i = (i + 1); + } + } + const int x_46 = asint(x_6[1].x); + const float x_47 = float(x_46); + x_GLF_color = float4(x_47, x_47, x_47, x_47); + const int x_49 = c; + const int x_51 = asint(x_6[1].x); + if ((x_49 == x_51)) { + const int x_56 = asint(x_6[2].x); + const int x_59 = asint(x_6[1].x); + const int x_62 = asint(x_6[1].x); + const int x_65 = asint(x_6[2].x); + x_GLF_color = float4(float(x_56), float(x_59), float(x_62), float(x_65)); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..99d436c731 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.msl @@ -0,0 +1,66 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int c = 0; + int i = 0; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[2].el; + c = x_27; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[2].el; + i = x_29; + while (true) { + int const x_34 = i; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_34 < x_36)) { + } else { + break; + } + int const x_39 = i; + c = ~(x_39); + int const x_41 = c; + c = clamp(x_41, 0, 3); + { + int const x_43 = i; + i = (x_43 + 1); + } + } + int const x_46 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_47 = float(x_46); + *(tint_symbol_4) = float4(x_47, x_47, x_47, x_47); + int const x_49 = c; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_49 == x_51)) { + int const x_56 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_59 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_56), float(x_59), float(x_62), float(x_65)); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..a8d0f90150 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,142 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %c "c" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %75 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %c = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %27 = OpLoad %int %26 + OpStore %c %27 + %28 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %29 = OpLoad %int %28 + OpStore %i %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpSLessThan %bool %34 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %31 + %40 = OpLabel + %43 = OpLoad %int %i + %44 = OpNot %int %43 + OpStore %c %44 + %45 = OpLoad %int %c + %46 = OpExtInst %int %47 SClamp %45 %int_0 %int_3 + OpStore %c %46 + OpBranch %32 + %32 = OpLabel + %49 = OpLoad %int %i + %51 = OpIAdd %int %49 %int_1 + OpStore %i %51 + OpBranch %30 + %31 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpCompositeConstruct %v4float %54 %54 %54 %54 + OpStore %x_GLF_color %55 + %56 = OpLoad %int %c + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpIEqual %bool %56 %58 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %60 + %61 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %63 + %71 = OpConvertSToF %float %65 + %72 = OpConvertSToF %float %67 + %73 = OpConvertSToF %float %69 + %74 = OpCompositeConstruct %v4float %70 %71 %72 %73 + OpStore %x_GLF_color %74 + OpBranch %60 + %60 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %75 +%tint_symbol = OpFunctionParameter %main_out + %79 = OpLabel + %80 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %80 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %82 = OpLabel + %83 = OpFunctionCall %void %main_1 + %85 = OpLoad %v4float %x_GLF_color + %86 = OpCompositeConstruct %main_out %85 + %84 = OpFunctionCall %void %tint_symbol_2 %86 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..97a2a509b4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-inverse-clamp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,60 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var c : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[2]; + c = x_27; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[2]; + i = x_29; + loop { + let x_34 : i32 = i; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_34 < x_36)) { + } else { + break; + } + let x_39 : i32 = i; + c = ~(x_39); + let x_41 : i32 = c; + c = clamp(x_41, 0, 3); + + continuing { + let x_43 : i32 = i; + i = (x_43 + 1); + } + } + let x_46 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_47 : f32 = f32(x_46); + x_GLF_color = vec4(x_47, x_47, x_47, x_47); + let x_49 : i32 = c; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_49 == x_51)) { + let x_56 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_56), f32(x_59), f32(x_62), f32(x_65)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm new file mode 100644 index 0000000000..b43e23f474 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm @@ -0,0 +1,98 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %10 + %27 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %29 = OpLoad %float %28 + %30 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %31 = OpLoad %float %30 + %32 = OpFOrdLessThan %bool %29 %31 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + %36 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpConvertSToF %float %37 + %39 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %40 = OpLoad %int %39 + %41 = OpConvertSToF %float %40 + %42 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpConvertSToF %float %43 + %45 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpCompositeConstruct %v4float %38 %41 %44 %47 + OpStore %_GLF_color %48 + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %50 = OpLoad %float %49 + %51 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %52 = OpLoad %float %51 + %53 = OpFOrdGreaterThan %bool %50 %52 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpCompositeConstruct %v4float %58 %58 %58 %58 + OpStore %_GLF_color %59 + OpBranch %54 + %54 = OpLabel + OpReturn + %35 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %61 + %63 = OpCompositeConstruct %v4float %62 %62 %62 %62 + OpStore %_GLF_color %63 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3739a71d68 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.hlsl @@ -0,0 +1,49 @@ +cbuffer cbuffer_x_5 : register(b1, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; + +void main_1() { + const float x_29 = asfloat(x_5[0].x); + const float x_31 = asfloat(x_5[0].y); + if ((x_29 < x_31)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_37 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const int x_40 = asint(x_7[1].x); + const int x_43 = asint(x_7[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_46 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_37), float(x_40), float(x_43), float(x_46)); + const float x_50 = asfloat(x_5[0].x); + const float x_52 = asfloat(x_5[0].y); + if ((x_50 > x_52)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_58 = float(x_57); + x_GLF_color = float4(x_58, x_58, x_58, x_58); + } + return; + } else { + const int x_61 = asint(x_7[1].x); + const float x_62 = float(x_61); + x_GLF_color = float4(x_62, x_62, x_62, x_62); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..762e4db4e6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.msl @@ -0,0 +1,56 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 v1; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_5, constant buf0& x_7, thread float4* const tint_symbol_4) { + float const x_29 = x_5.v1.x; + float const x_31 = x_5.v1.y; + if ((x_29 < x_31)) { + int const x_37 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_40 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_43 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_46 = x_7.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_37), float(x_40), float(x_43), float(x_46)); + float const x_50 = x_5.v1.x; + float const x_52 = x_5.v1.y; + if ((x_50 > x_52)) { + int const x_57 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_58 = float(x_57); + *(tint_symbol_4) = float4(x_58, x_58, x_58, x_58); + } + return; + } else { + int const x_61 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_62 = float(x_61); + *(tint_symbol_4) = float4(x_62, x_62, x_62, x_62); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_5 [[buffer(1)]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..77d773fe32 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.spvasm @@ -0,0 +1,130 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_5 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %66 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %26 = OpLoad %float %25 + %28 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %29 = OpLoad %float %28 + %30 = OpFOrdLessThan %bool %26 %29 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %38 = OpLoad %int %37 + %40 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %38 + %47 = OpConvertSToF %float %41 + %48 = OpConvertSToF %float %43 + %49 = OpConvertSToF %float %45 + %50 = OpCompositeConstruct %v4float %46 %47 %48 %49 + OpStore %x_GLF_color %50 + %51 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %52 = OpLoad %float %51 + %53 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %54 = OpLoad %float %53 + %55 = OpFOrdGreaterThan %bool %52 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpCompositeConstruct %v4float %60 %60 %60 %60 + OpStore %x_GLF_color %61 + OpBranch %56 + %56 = OpLabel + OpReturn + %34 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpConvertSToF %float %63 + %65 = OpCompositeConstruct %v4float %64 %64 %64 %64 + OpStore %x_GLF_color %65 + OpBranch %32 + %32 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %66 +%tint_symbol = OpFunctionParameter %main_out + %70 = OpLabel + %71 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %71 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %73 = OpLabel + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_2 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..61503b5a42 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.spvasm.expected.wgsl @@ -0,0 +1,53 @@ +[[block]] +struct buf1 { + v1 : vec2; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_5 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +fn main_1() { + let x_29 : f32 = x_5.v1.x; + let x_31 : f32 = x_5.v1.y; + if ((x_29 < x_31)) { + let x_37 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_40 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_43 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_46 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_37), f32(x_40), f32(x_43), f32(x_46)); + let x_50 : f32 = x_5.v1.x; + let x_52 : f32 = x_5.v1.y; + if ((x_50 > x_52)) { + let x_57 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; + } else { + let x_61 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_62 : f32 = f32(x_61); + x_GLF_color = vec4(x_62, x_62, x_62, x_62); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl new file mode 100644 index 0000000000..61503b5a42 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl @@ -0,0 +1,53 @@ +[[block]] +struct buf1 { + v1 : vec2; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_5 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +fn main_1() { + let x_29 : f32 = x_5.v1.x; + let x_31 : f32 = x_5.v1.y; + if ((x_29 < x_31)) { + let x_37 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_40 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_43 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_46 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_37), f32(x_40), f32(x_43), f32(x_46)); + let x_50 : f32 = x_5.v1.x; + let x_52 : f32 = x_5.v1.y; + if ((x_50 > x_52)) { + let x_57 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; + } else { + let x_61 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_62 : f32 = f32(x_61); + x_GLF_color = vec4(x_62, x_62, x_62, x_62); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3739a71d68 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.hlsl @@ -0,0 +1,49 @@ +cbuffer cbuffer_x_5 : register(b1, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; + +void main_1() { + const float x_29 = asfloat(x_5[0].x); + const float x_31 = asfloat(x_5[0].y); + if ((x_29 < x_31)) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_37 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const int x_40 = asint(x_7[1].x); + const int x_43 = asint(x_7[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_46 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + x_GLF_color = float4(float(x_37), float(x_40), float(x_43), float(x_46)); + const float x_50 = asfloat(x_5[0].x); + const float x_52 = asfloat(x_5[0].y); + if ((x_50 > x_52)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_57 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_58 = float(x_57); + x_GLF_color = float4(x_58, x_58, x_58, x_58); + } + return; + } else { + const int x_61 = asint(x_7[1].x); + const float x_62 = float(x_61); + x_GLF_color = float4(x_62, x_62, x_62, x_62); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..762e4db4e6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.msl @@ -0,0 +1,56 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 v1; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_5, constant buf0& x_7, thread float4* const tint_symbol_4) { + float const x_29 = x_5.v1.x; + float const x_31 = x_5.v1.y; + if ((x_29 < x_31)) { + int const x_37 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_40 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_43 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_46 = x_7.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_37), float(x_40), float(x_43), float(x_46)); + float const x_50 = x_5.v1.x; + float const x_52 = x_5.v1.y; + if ((x_50 > x_52)) { + int const x_57 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_58 = float(x_57); + *(tint_symbol_4) = float4(x_58, x_58, x_58, x_58); + } + return; + } else { + int const x_61 = x_7.x_GLF_uniform_int_values.arr[1].el; + float const x_62 = float(x_61); + *(tint_symbol_4) = float4(x_62, x_62, x_62, x_62); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_5 [[buffer(1)]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..77d773fe32 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.spvasm @@ -0,0 +1,130 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_5 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %66 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %25 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %26 = OpLoad %float %25 + %28 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %29 = OpLoad %float %28 + %30 = OpFOrdLessThan %bool %26 %29 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %38 = OpLoad %int %37 + %40 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %38 + %47 = OpConvertSToF %float %41 + %48 = OpConvertSToF %float %43 + %49 = OpConvertSToF %float %45 + %50 = OpCompositeConstruct %v4float %46 %47 %48 %49 + OpStore %x_GLF_color %50 + %51 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %52 = OpLoad %float %51 + %53 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %54 = OpLoad %float %53 + %55 = OpFOrdGreaterThan %bool %52 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpCompositeConstruct %v4float %60 %60 %60 %60 + OpStore %x_GLF_color %61 + OpBranch %56 + %56 = OpLabel + OpReturn + %34 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpConvertSToF %float %63 + %65 = OpCompositeConstruct %v4float %64 %64 %64 %64 + OpStore %x_GLF_color %65 + OpBranch %32 + %32 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %66 +%tint_symbol = OpFunctionParameter %main_out + %70 = OpLabel + %71 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %71 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %73 = OpLabel + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_2 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..61503b5a42 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-lt-gt/0-opt.wgsl.expected.wgsl @@ -0,0 +1,53 @@ +[[block]] +struct buf1 { + v1 : vec2; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_5 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +fn main_1() { + let x_29 : f32 = x_5.v1.x; + let x_31 : f32 = x_5.v1.y; + if ((x_29 < x_31)) { + let x_37 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_40 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_43 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_46 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_37), f32(x_40), f32(x_43), f32(x_46)); + let x_50 : f32 = x_5.v1.x; + let x_52 : f32 = x_5.v1.y; + if ((x_50 > x_52)) { + let x_57 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + } + return; + } else { + let x_61 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_62 : f32 = f32(x_61); + x_GLF_color = vec4(x_62, x_62, x_62, x_62); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm new file mode 100644 index 0000000000..9586039921 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm @@ -0,0 +1,60 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %bool = OpTypeBool + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %20 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %7 + %21 = OpLabel + OpStore %_GLF_color %12 + %22 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %23 = OpLoad %float %22 + %24 = OpFOrdLessThan %bool %23 %float_0 + OpSelectionMerge %25 None + OpBranchConditional %24 %26 %25 + %26 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %28 = OpLoad %float %27 + %29 = OpFOrdLessThan %bool %28 %float_0 + OpBranch %25 + %25 = OpLabel + %30 = OpPhi %bool %24 %21 %29 %26 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + OpStore %_GLF_color %19 + OpBranch %31 + %33 = OpLabel + OpStore %_GLF_color %20 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..4208963773 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.hlsl @@ -0,0 +1,38 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + bool x_29 = false; + bool x_30_phi = false; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_23 = asfloat(x_5[0].x); + const bool x_24 = (x_23 < 0.0f); + x_30_phi = x_24; + if (x_24) { + const float x_28 = asfloat(x_5[0].x); + x_29 = (x_28 < 0.0f); + x_30_phi = x_29; + } + if (x_30_phi) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..747b26797e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + bool x_29 = false; + bool x_30_phi = false; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + float const x_23 = x_5.one; + bool const x_24 = (x_23 < 0.0f); + x_30_phi = x_24; + if (x_24) { + float const x_28 = x_5.one; + x_29 = (x_28 < 0.0f); + x_30_phi = x_29; + } + bool const x_30 = x_30_phi; + if (x_30) { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..7708f0f379 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_29 "x_29" + OpName %x_30_phi "x_30_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %18 = OpConstantNull %bool + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %39 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %40 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %41 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_29 = OpVariable %_ptr_Function_bool Function %18 + %x_30_phi = OpVariable %_ptr_Function_bool Function %18 + OpStore %x_GLF_color %21 + %25 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %26 = OpLoad %float %25 + %27 = OpFOrdLessThan %bool %26 %float_0 + OpStore %x_30_phi %27 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %28 + %29 = OpLabel + %30 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %31 = OpLoad %float %30 + %32 = OpFOrdLessThan %bool %31 %float_0 + OpStore %x_29 %32 + %33 = OpLoad %bool %x_29 + OpStore %x_30_phi %33 + OpBranch %28 + %28 = OpLabel + %34 = OpLoad %bool %x_30_phi + OpSelectionMerge %35 None + OpBranchConditional %34 %36 %37 + %36 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %35 + %37 = OpLabel + OpStore %x_GLF_color %40 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %41 +%tint_symbol = OpFunctionParameter %main_out + %45 = OpLabel + %46 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %46 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %48 = OpLabel + %49 = OpFunctionCall %void %main_1 + %51 = OpLoad %v4float %x_GLF_color + %52 = OpCompositeConstruct %main_out %51 + %50 = OpFunctionCall %void %tint_symbol_2 %52 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..cc257f42c5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.spvasm.expected.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_29 : bool; + var x_30_phi : bool; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_23 : f32 = x_5.one; + let x_24 : bool = (x_23 < 0.0); + x_30_phi = x_24; + if (x_24) { + let x_28 : f32 = x_5.one; + x_29 = (x_28 < 0.0); + x_30_phi = x_29; + } + let x_30 : bool = x_30_phi; + if (x_30) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl new file mode 100644 index 0000000000..cc257f42c5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_29 : bool; + var x_30_phi : bool; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_23 : f32 = x_5.one; + let x_24 : bool = (x_23 < 0.0); + x_30_phi = x_24; + if (x_24) { + let x_28 : f32 = x_5.one; + x_29 = (x_28 < 0.0); + x_30_phi = x_29; + } + let x_30 : bool = x_30_phi; + if (x_30) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..4208963773 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.hlsl @@ -0,0 +1,38 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + bool x_29 = false; + bool x_30_phi = false; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_23 = asfloat(x_5[0].x); + const bool x_24 = (x_23 < 0.0f); + x_30_phi = x_24; + if (x_24) { + const float x_28 = asfloat(x_5[0].x); + x_29 = (x_28 < 0.0f); + x_30_phi = x_29; + } + if (x_30_phi) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..747b26797e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + bool x_29 = false; + bool x_30_phi = false; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + float const x_23 = x_5.one; + bool const x_24 = (x_23 < 0.0f); + x_30_phi = x_24; + if (x_24) { + float const x_28 = x_5.one; + x_29 = (x_28 < 0.0f); + x_30_phi = x_29; + } + bool const x_30 = x_30_phi; + if (x_30) { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..7708f0f379 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_29 "x_29" + OpName %x_30_phi "x_30_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %18 = OpConstantNull %bool + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %39 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %40 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %41 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_29 = OpVariable %_ptr_Function_bool Function %18 + %x_30_phi = OpVariable %_ptr_Function_bool Function %18 + OpStore %x_GLF_color %21 + %25 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %26 = OpLoad %float %25 + %27 = OpFOrdLessThan %bool %26 %float_0 + OpStore %x_30_phi %27 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %28 + %29 = OpLabel + %30 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 + %31 = OpLoad %float %30 + %32 = OpFOrdLessThan %bool %31 %float_0 + OpStore %x_29 %32 + %33 = OpLoad %bool %x_29 + OpStore %x_30_phi %33 + OpBranch %28 + %28 = OpLabel + %34 = OpLoad %bool %x_30_phi + OpSelectionMerge %35 None + OpBranchConditional %34 %36 %37 + %36 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %35 + %37 = OpLabel + OpStore %x_GLF_color %40 + OpBranch %35 + %35 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %41 +%tint_symbol = OpFunctionParameter %main_out + %45 = OpLabel + %46 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %46 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %48 = OpLabel + %49 = OpFunctionCall %void %main_1 + %51 = OpLoad %v4float %x_GLF_color + %52 = OpCompositeConstruct %main_out %51 + %50 = OpFunctionCall %void %tint_symbol_2 %52 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..cc257f42c5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-selection-dag-same-cond-twice/0-opt.wgsl.expected.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_29 : bool; + var x_30_phi : bool; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_23 : f32 = x_5.one; + let x_24 : bool = (x_23 < 0.0); + x_30_phi = x_24; + if (x_24) { + let x_28 : f32 = x_5.one; + x_29 = (x_28 < 0.0); + x_30_phi = x_29; + } + let x_30 : bool = x_30_phi; + if (x_30) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm new file mode 100644 index 0000000000..157569f721 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm @@ -0,0 +1,126 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_6 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_6 = OpConstant %uint 6 +%_arr_int_uint_6 = OpTypeArray %int %uint_6 + %buf0 = OpTypeStruct %_arr_int_uint_6 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %v4bool = OpTypeVector %bool 4 + %int_5 = OpConstant %int 5 + %uint_0 = OpConstant %uint 0 + %26 = OpUndef %v4float + %main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %29 = OpLoad %int %28 + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %31 = OpLoad %int %30 + OpBranch %32 + %32 = OpLabel + %33 = OpPhi %v4float %26 %27 %34 %35 + %36 = OpPhi %int %29 %27 %37 %35 + %38 = OpPhi %int %31 %27 %39 %35 + %40 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %41 = OpLoad %int %40 + %42 = OpSLessThan %bool %38 %41 + OpLoopMerge %43 %35 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpSelectionMerge %45 None + OpSwitch %uint_0 %46 + %46 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %48 = OpLoad %int %47 + %49 = OpSGreaterThan %bool %38 %48 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpBranch %45 + %50 = OpLabel + OpBranch %52 + %52 = OpLabel + %53 = OpPhi %v4float %33 %50 %54 %55 + %56 = OpPhi %int %29 %50 %57 %55 + %58 = OpSLessThan %bool %56 %41 + OpLoopMerge %59 %55 None + OpBranchConditional %58 %55 %59 + %55 = OpLabel + %60 = OpIAdd %int %38 %56 + %61 = OpConvertSToF %float %60 + %54 = OpCompositeConstruct %v4float %61 %61 %61 %61 + %57 = OpIAdd %int %56 %int_1 + OpBranch %52 + %59 = OpLabel + OpStore %_GLF_color %53 + OpBranch %45 + %45 = OpLabel + %34 = OpPhi %v4float %33 %51 %53 %59 + %62 = OpPhi %int %int_2 %51 %31 %59 + %37 = OpIAdd %int %36 %62 + OpBranch %35 + %35 = OpLabel + %39 = OpIAdd %int %38 %int_1 + OpBranch %32 + %43 = OpLabel + %63 = OpLoad %v4float %_GLF_color + %64 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpCompositeConstruct %v4float %66 %66 %66 %66 + %68 = OpFOrdEqual %v4bool %63 %67 + %69 = OpAll %bool %68 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %73 = OpLoad %int %72 + %74 = OpIEqual %bool %36 %73 + OpBranch %70 + %70 = OpLabel + %75 = OpPhi %bool %69 %43 %74 %71 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %78 + %77 = OpLabel + %79 = OpConvertSToF %float %31 + %80 = OpConvertSToF %float %29 + %81 = OpCompositeConstruct %v4float %79 %80 %80 %79 + OpStore %_GLF_color %81 + OpBranch %76 + %78 = OpLabel + %82 = OpConvertSToF %float %29 + %83 = OpCompositeConstruct %v4float %82 %82 %82 %82 + OpStore %_GLF_color %83 + OpBranch %76 + %76 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..1fcb766692 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.hlsl @@ -0,0 +1,109 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[6]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_36 = 0; + bool x_74 = false; + float4 x_33_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_36_phi = 0; + int x_38_phi = 0; + bool x_75_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_31 = asint(x_5[1].x); + x_33_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_36_phi = x_29; + x_38_phi = x_31; + while (true) { + float4 x_53 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_39 = 0; + float4 x_34_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_62_phi = 0; + const float4 x_33 = x_33_phi; + x_36 = x_36_phi; + const int x_38 = x_38_phi; + const int x_41 = asint(x_5[4].x); + if ((x_38 < x_41)) { + } else { + break; + } + float4 x_53_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_56_phi = 0; + switch(0u) { + default: { + const int x_48 = asint(x_5[3].x); + if ((x_38 > x_48)) { + x_34_phi = x_33; + x_62_phi = 2; + break; + } + x_53_phi = x_33; + x_56_phi = x_29; + while (true) { + float4 x_54 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_57 = 0; + x_53 = x_53_phi; + const int x_56 = x_56_phi; + if ((x_56 < x_41)) { + } else { + break; + } + { + const float x_61 = float((x_38 + x_56)); + x_54 = float4(x_61, x_61, x_61, x_61); + x_57 = (x_56 + 1); + x_53_phi = x_54; + x_56_phi = x_57; + } + } + x_GLF_color = x_53; + x_34_phi = x_53; + x_62_phi = x_31; + break; + } + } + const float4 x_34 = x_34_phi; + const int x_62 = x_62_phi; + { + x_39 = (x_38 + 1); + x_33_phi = x_34; + x_36_phi = asint((x_36 + asint(x_62))); + x_38_phi = x_39; + } + } + const float4 x_63 = x_GLF_color; + const int x_65 = asint(x_5[2].x); + const float x_66 = float(x_65); + const bool x_69 = all((x_63 == float4(x_66, x_66, x_66, x_66))); + x_75_phi = x_69; + if (x_69) { + const int x_73 = asint(x_5[5].x); + x_74 = (x_36 == asint(x_73)); + x_75_phi = x_74; + } + if (x_75_phi) { + const float x_79 = float(x_31); + const float x_80 = float(x_29); + x_GLF_color = float4(x_79, x_80, x_80, x_79); + } else { + const float x_82 = float(x_29); + x_GLF_color = float4(x_82, x_82, x_82, x_82); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.msl new file mode 100644 index 0000000000..c5bf9c843c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.msl @@ -0,0 +1,119 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[6]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int x_36 = 0; + bool x_74 = false; + float4 x_33_phi = 0.0f; + int x_36_phi = 0; + int x_38_phi = 0; + bool x_75_phi = false; + int const x_29 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_31 = x_5.x_GLF_uniform_int_values.arr[1].el; + x_33_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_36_phi = x_29; + x_38_phi = x_31; + while (true) { + float4 x_53 = 0.0f; + int x_39 = 0; + float4 x_34_phi = 0.0f; + int x_62_phi = 0; + float4 const x_33 = x_33_phi; + x_36 = x_36_phi; + int const x_38 = x_38_phi; + int const x_41 = x_5.x_GLF_uniform_int_values.arr[4].el; + if ((x_38 < x_41)) { + } else { + break; + } + float4 x_53_phi = 0.0f; + int x_56_phi = 0; + switch(0u) { + default: { + int const x_48 = x_5.x_GLF_uniform_int_values.arr[3].el; + if ((x_38 > x_48)) { + x_34_phi = x_33; + x_62_phi = 2; + break; + } + x_53_phi = x_33; + x_56_phi = x_29; + while (true) { + float4 x_54 = 0.0f; + int x_57 = 0; + x_53 = x_53_phi; + int const x_56 = x_56_phi; + if ((x_56 < x_41)) { + } else { + break; + } + { + float const x_61 = float((x_38 + x_56)); + x_54 = float4(x_61, x_61, x_61, x_61); + x_57 = (x_56 + 1); + x_53_phi = x_54; + x_56_phi = x_57; + } + } + *(tint_symbol_4) = x_53; + x_34_phi = x_53; + x_62_phi = x_31; + break; + } + } + float4 const x_34 = x_34_phi; + int const x_62 = x_62_phi; + { + x_39 = (x_38 + 1); + x_33_phi = x_34; + x_36_phi = as_type((x_36 + as_type(x_62))); + x_38_phi = x_39; + } + } + float4 const x_63 = *(tint_symbol_4); + int const x_65 = x_5.x_GLF_uniform_int_values.arr[2].el; + float const x_66 = float(x_65); + bool const x_69 = all((x_63 == float4(x_66, x_66, x_66, x_66))); + x_75_phi = x_69; + if (x_69) { + int const x_73 = x_5.x_GLF_uniform_int_values.arr[5].el; + x_74 = (x_36 == as_type(x_73)); + x_75_phi = x_74; + } + bool const x_75 = x_75_phi; + if (x_75) { + float const x_79 = float(x_31); + float const x_80 = float(x_29); + *(tint_symbol_4) = float4(x_79, x_80, x_80, x_79); + } else { + float const x_82 = float(x_29); + *(tint_symbol_4) = float4(x_82, x_82, x_82, x_82); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..5769859e68 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.spvasm @@ -0,0 +1,240 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 136 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_36 "x_36" + OpName %x_74 "x_74" + OpName %x_33_phi "x_33_phi" + OpName %x_36_phi "x_36_phi" + OpName %x_38_phi "x_38_phi" + OpName %x_75_phi "x_75_phi" + OpName %x_53 "x_53" + OpName %x_39 "x_39" + OpName %x_34_phi "x_34_phi" + OpName %x_62_phi "x_62_phi" + OpName %x_53_phi "x_53_phi" + OpName %x_56_phi "x_56_phi" + OpName %x_54 "x_54" + OpName %x_57 "x_57" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_6 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_6 = OpConstant %uint 6 +%_arr_int_uint_6 = OpTypeArray %int %uint_6 + %buf0 = OpTypeStruct %_arr_int_uint_6 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %25 = OpConstantNull %bool +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %40 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %v4bool = OpTypeVector %bool 4 + %int_5 = OpConstant %int 5 + %main_out = OpTypeStruct %v4float + %124 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_36 = OpVariable %_ptr_Function_int Function %21 + %x_74 = OpVariable %_ptr_Function_bool Function %25 + %x_33_phi = OpVariable %_ptr_Function_v4float Function %12 + %x_36_phi = OpVariable %_ptr_Function_int Function %21 + %x_38_phi = OpVariable %_ptr_Function_int Function %21 + %x_75_phi = OpVariable %_ptr_Function_bool Function %25 + %x_53 = OpVariable %_ptr_Function_v4float Function %12 + %x_39 = OpVariable %_ptr_Function_int Function %21 + %x_34_phi = OpVariable %_ptr_Function_v4float Function %12 + %x_62_phi = OpVariable %_ptr_Function_int Function %21 + %x_53_phi = OpVariable %_ptr_Function_v4float Function %12 + %x_56_phi = OpVariable %_ptr_Function_int Function %21 + %x_54 = OpVariable %_ptr_Function_v4float Function %12 + %x_57 = OpVariable %_ptr_Function_int Function %21 + %34 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %35 = OpLoad %int %34 + %37 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %38 = OpLoad %int %37 + OpStore %x_33_phi %40 + OpStore %x_36_phi %35 + OpStore %x_38_phi %38 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %49 = OpLoad %v4float %x_33_phi + %50 = OpLoad %int %x_36_phi + OpStore %x_36 %50 + %51 = OpLoad %int %x_38_phi + %53 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_4 + %54 = OpLoad %int %53 + %55 = OpSLessThan %bool %51 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpBranch %56 + %58 = OpLabel + OpBranch %42 + %56 = OpLabel + OpSelectionMerge %61 None + OpSwitch %uint_0 %62 + %62 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_3 + %65 = OpLoad %int %64 + %66 = OpSGreaterThan %bool %51 %65 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %67 + %68 = OpLabel + OpStore %x_34_phi %49 + OpStore %x_62_phi %int_2 + OpBranch %61 + %67 = OpLabel + OpStore %x_53_phi %49 + OpStore %x_56_phi %35 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %76 = OpLoad %v4float %x_53_phi + OpStore %x_53 %76 + %77 = OpLoad %int %x_56_phi + %78 = OpSLessThan %bool %77 %54 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %81 + %80 = OpLabel + OpBranch %79 + %81 = OpLabel + OpBranch %71 + %79 = OpLabel + OpBranch %72 + %72 = OpLabel + %83 = OpIAdd %int %51 %77 + %82 = OpConvertSToF %float %83 + %84 = OpCompositeConstruct %v4float %82 %82 %82 %82 + OpStore %x_54 %84 + %85 = OpIAdd %int %77 %int_1 + OpStore %x_57 %85 + %86 = OpLoad %v4float %x_54 + OpStore %x_53_phi %86 + %87 = OpLoad %int %x_57 + OpStore %x_56_phi %87 + OpBranch %70 + %71 = OpLabel + %88 = OpLoad %v4float %x_53 + OpStore %x_GLF_color %88 + %89 = OpLoad %v4float %x_53 + OpStore %x_34_phi %89 + OpStore %x_62_phi %38 + OpBranch %61 + %61 = OpLabel + %90 = OpLoad %v4float %x_34_phi + %91 = OpLoad %int %x_62_phi + OpBranch %43 + %43 = OpLabel + %92 = OpIAdd %int %51 %int_1 + OpStore %x_39 %92 + OpStore %x_33_phi %90 + %94 = OpLoad %int %x_36 + %95 = OpCopyObject %int %91 + %96 = OpIAdd %int %94 %95 + %93 = OpCopyObject %int %96 + OpStore %x_36_phi %93 + %97 = OpLoad %int %x_39 + OpStore %x_38_phi %97 + OpBranch %41 + %42 = OpLabel + %98 = OpLoad %v4float %x_GLF_color + %99 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %100 = OpLoad %int %99 + %101 = OpConvertSToF %float %100 + %103 = OpCompositeConstruct %v4float %101 %101 %101 %101 + %104 = OpFOrdEqual %v4bool %98 %103 + %102 = OpAll %bool %104 + OpStore %x_75_phi %102 + OpSelectionMerge %106 None + OpBranchConditional %102 %107 %106 + %107 = OpLabel + %109 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_5 + %110 = OpLoad %int %109 + %111 = OpLoad %int %x_36 + %112 = OpCopyObject %int %110 + %113 = OpIEqual %bool %111 %112 + OpStore %x_74 %113 + %114 = OpLoad %bool %x_74 + OpStore %x_75_phi %114 + OpBranch %106 + %106 = OpLabel + %115 = OpLoad %bool %x_75_phi + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %118 + %117 = OpLabel + %119 = OpConvertSToF %float %38 + %120 = OpConvertSToF %float %35 + %121 = OpCompositeConstruct %v4float %119 %120 %120 %119 + OpStore %x_GLF_color %121 + OpBranch %116 + %118 = OpLabel + %122 = OpConvertSToF %float %35 + %123 = OpCompositeConstruct %v4float %122 %122 %122 %122 + OpStore %x_GLF_color %123 + OpBranch %116 + %116 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %124 +%tint_symbol = OpFunctionParameter %main_out + %128 = OpLabel + %129 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %129 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %131 = OpLabel + %132 = OpFunctionCall %void %main_1 + %134 = OpLoad %v4float %x_GLF_color + %135 = OpCompositeConstruct %main_out %134 + %133 = OpFunctionCall %void %tint_symbol_2 %135 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..295609c62e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.spvasm.expected.wgsl @@ -0,0 +1,113 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : i32; + var x_74 : bool; + var x_33_phi : vec4; + var x_36_phi : i32; + var x_38_phi : i32; + var x_75_phi : bool; + let x_29 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_31 : i32 = x_5.x_GLF_uniform_int_values[1]; + x_33_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_36_phi = x_29; + x_38_phi = x_31; + loop { + var x_53 : vec4; + var x_39 : i32; + var x_34_phi : vec4; + var x_62_phi : i32; + let x_33 : vec4 = x_33_phi; + x_36 = x_36_phi; + let x_38 : i32 = x_38_phi; + let x_41 : i32 = x_5.x_GLF_uniform_int_values[4]; + if ((x_38 < x_41)) { + } else { + break; + } + var x_53_phi : vec4; + var x_56_phi : i32; + switch(0u) { + default: { + let x_48 : i32 = x_5.x_GLF_uniform_int_values[3]; + if ((x_38 > x_48)) { + x_34_phi = x_33; + x_62_phi = 2; + break; + } + x_53_phi = x_33; + x_56_phi = x_29; + loop { + var x_54 : vec4; + var x_57 : i32; + x_53 = x_53_phi; + let x_56 : i32 = x_56_phi; + if ((x_56 < x_41)) { + } else { + break; + } + + continuing { + let x_61 : f32 = f32((x_38 + x_56)); + x_54 = vec4(x_61, x_61, x_61, x_61); + x_57 = (x_56 + 1); + x_53_phi = x_54; + x_56_phi = x_57; + } + } + x_GLF_color = x_53; + x_34_phi = x_53; + x_62_phi = x_31; + } + } + let x_34 : vec4 = x_34_phi; + let x_62 : i32 = x_62_phi; + + continuing { + x_39 = (x_38 + 1); + x_33_phi = x_34; + x_36_phi = bitcast((x_36 + bitcast(x_62))); + x_38_phi = x_39; + } + } + let x_63 : vec4 = x_GLF_color; + let x_65 : i32 = x_5.x_GLF_uniform_int_values[2]; + let x_66 : f32 = f32(x_65); + let x_69 : bool = all((x_63 == vec4(x_66, x_66, x_66, x_66))); + x_75_phi = x_69; + if (x_69) { + let x_73 : i32 = x_5.x_GLF_uniform_int_values[5]; + x_74 = (x_36 == bitcast(x_73)); + x_75_phi = x_74; + } + let x_75 : bool = x_75_phi; + if (x_75) { + let x_79 : f32 = f32(x_31); + let x_80 : f32 = f32(x_29); + x_GLF_color = vec4(x_79, x_80, x_80, x_79); + } else { + let x_82 : f32 = f32(x_29); + x_GLF_color = vec4(x_82, x_82, x_82, x_82); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl new file mode 100644 index 0000000000..295609c62e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl @@ -0,0 +1,113 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : i32; + var x_74 : bool; + var x_33_phi : vec4; + var x_36_phi : i32; + var x_38_phi : i32; + var x_75_phi : bool; + let x_29 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_31 : i32 = x_5.x_GLF_uniform_int_values[1]; + x_33_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_36_phi = x_29; + x_38_phi = x_31; + loop { + var x_53 : vec4; + var x_39 : i32; + var x_34_phi : vec4; + var x_62_phi : i32; + let x_33 : vec4 = x_33_phi; + x_36 = x_36_phi; + let x_38 : i32 = x_38_phi; + let x_41 : i32 = x_5.x_GLF_uniform_int_values[4]; + if ((x_38 < x_41)) { + } else { + break; + } + var x_53_phi : vec4; + var x_56_phi : i32; + switch(0u) { + default: { + let x_48 : i32 = x_5.x_GLF_uniform_int_values[3]; + if ((x_38 > x_48)) { + x_34_phi = x_33; + x_62_phi = 2; + break; + } + x_53_phi = x_33; + x_56_phi = x_29; + loop { + var x_54 : vec4; + var x_57 : i32; + x_53 = x_53_phi; + let x_56 : i32 = x_56_phi; + if ((x_56 < x_41)) { + } else { + break; + } + + continuing { + let x_61 : f32 = f32((x_38 + x_56)); + x_54 = vec4(x_61, x_61, x_61, x_61); + x_57 = (x_56 + 1); + x_53_phi = x_54; + x_56_phi = x_57; + } + } + x_GLF_color = x_53; + x_34_phi = x_53; + x_62_phi = x_31; + } + } + let x_34 : vec4 = x_34_phi; + let x_62 : i32 = x_62_phi; + + continuing { + x_39 = (x_38 + 1); + x_33_phi = x_34; + x_36_phi = bitcast((x_36 + bitcast(x_62))); + x_38_phi = x_39; + } + } + let x_63 : vec4 = x_GLF_color; + let x_65 : i32 = x_5.x_GLF_uniform_int_values[2]; + let x_66 : f32 = f32(x_65); + let x_69 : bool = all((x_63 == vec4(x_66, x_66, x_66, x_66))); + x_75_phi = x_69; + if (x_69) { + let x_73 : i32 = x_5.x_GLF_uniform_int_values[5]; + x_74 = (x_36 == bitcast(x_73)); + x_75_phi = x_74; + } + let x_75 : bool = x_75_phi; + if (x_75) { + let x_79 : f32 = f32(x_31); + let x_80 : f32 = f32(x_29); + x_GLF_color = vec4(x_79, x_80, x_80, x_79); + } else { + let x_82 : f32 = f32(x_29); + x_GLF_color = vec4(x_82, x_82, x_82, x_82); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..1fcb766692 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.hlsl @@ -0,0 +1,109 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[6]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_36 = 0; + bool x_74 = false; + float4 x_33_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_36_phi = 0; + int x_38_phi = 0; + bool x_75_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + const int x_31 = asint(x_5[1].x); + x_33_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_36_phi = x_29; + x_38_phi = x_31; + while (true) { + float4 x_53 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_39 = 0; + float4 x_34_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_62_phi = 0; + const float4 x_33 = x_33_phi; + x_36 = x_36_phi; + const int x_38 = x_38_phi; + const int x_41 = asint(x_5[4].x); + if ((x_38 < x_41)) { + } else { + break; + } + float4 x_53_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_56_phi = 0; + switch(0u) { + default: { + const int x_48 = asint(x_5[3].x); + if ((x_38 > x_48)) { + x_34_phi = x_33; + x_62_phi = 2; + break; + } + x_53_phi = x_33; + x_56_phi = x_29; + while (true) { + float4 x_54 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_57 = 0; + x_53 = x_53_phi; + const int x_56 = x_56_phi; + if ((x_56 < x_41)) { + } else { + break; + } + { + const float x_61 = float((x_38 + x_56)); + x_54 = float4(x_61, x_61, x_61, x_61); + x_57 = (x_56 + 1); + x_53_phi = x_54; + x_56_phi = x_57; + } + } + x_GLF_color = x_53; + x_34_phi = x_53; + x_62_phi = x_31; + break; + } + } + const float4 x_34 = x_34_phi; + const int x_62 = x_62_phi; + { + x_39 = (x_38 + 1); + x_33_phi = x_34; + x_36_phi = asint((x_36 + asint(x_62))); + x_38_phi = x_39; + } + } + const float4 x_63 = x_GLF_color; + const int x_65 = asint(x_5[2].x); + const float x_66 = float(x_65); + const bool x_69 = all((x_63 == float4(x_66, x_66, x_66, x_66))); + x_75_phi = x_69; + if (x_69) { + const int x_73 = asint(x_5[5].x); + x_74 = (x_36 == asint(x_73)); + x_75_phi = x_74; + } + if (x_75_phi) { + const float x_79 = float(x_31); + const float x_80 = float(x_29); + x_GLF_color = float4(x_79, x_80, x_80, x_79); + } else { + const float x_82 = float(x_29); + x_GLF_color = float4(x_82, x_82, x_82, x_82); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.msl new file mode 100644 index 0000000000..c5bf9c843c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.msl @@ -0,0 +1,119 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[6]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int x_36 = 0; + bool x_74 = false; + float4 x_33_phi = 0.0f; + int x_36_phi = 0; + int x_38_phi = 0; + bool x_75_phi = false; + int const x_29 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_31 = x_5.x_GLF_uniform_int_values.arr[1].el; + x_33_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_36_phi = x_29; + x_38_phi = x_31; + while (true) { + float4 x_53 = 0.0f; + int x_39 = 0; + float4 x_34_phi = 0.0f; + int x_62_phi = 0; + float4 const x_33 = x_33_phi; + x_36 = x_36_phi; + int const x_38 = x_38_phi; + int const x_41 = x_5.x_GLF_uniform_int_values.arr[4].el; + if ((x_38 < x_41)) { + } else { + break; + } + float4 x_53_phi = 0.0f; + int x_56_phi = 0; + switch(0u) { + default: { + int const x_48 = x_5.x_GLF_uniform_int_values.arr[3].el; + if ((x_38 > x_48)) { + x_34_phi = x_33; + x_62_phi = 2; + break; + } + x_53_phi = x_33; + x_56_phi = x_29; + while (true) { + float4 x_54 = 0.0f; + int x_57 = 0; + x_53 = x_53_phi; + int const x_56 = x_56_phi; + if ((x_56 < x_41)) { + } else { + break; + } + { + float const x_61 = float((x_38 + x_56)); + x_54 = float4(x_61, x_61, x_61, x_61); + x_57 = (x_56 + 1); + x_53_phi = x_54; + x_56_phi = x_57; + } + } + *(tint_symbol_4) = x_53; + x_34_phi = x_53; + x_62_phi = x_31; + break; + } + } + float4 const x_34 = x_34_phi; + int const x_62 = x_62_phi; + { + x_39 = (x_38 + 1); + x_33_phi = x_34; + x_36_phi = as_type((x_36 + as_type(x_62))); + x_38_phi = x_39; + } + } + float4 const x_63 = *(tint_symbol_4); + int const x_65 = x_5.x_GLF_uniform_int_values.arr[2].el; + float const x_66 = float(x_65); + bool const x_69 = all((x_63 == float4(x_66, x_66, x_66, x_66))); + x_75_phi = x_69; + if (x_69) { + int const x_73 = x_5.x_GLF_uniform_int_values.arr[5].el; + x_74 = (x_36 == as_type(x_73)); + x_75_phi = x_74; + } + bool const x_75 = x_75_phi; + if (x_75) { + float const x_79 = float(x_31); + float const x_80 = float(x_29); + *(tint_symbol_4) = float4(x_79, x_80, x_80, x_79); + } else { + float const x_82 = float(x_29); + *(tint_symbol_4) = float4(x_82, x_82, x_82, x_82); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..5769859e68 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.spvasm @@ -0,0 +1,240 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 136 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_36 "x_36" + OpName %x_74 "x_74" + OpName %x_33_phi "x_33_phi" + OpName %x_36_phi "x_36_phi" + OpName %x_38_phi "x_38_phi" + OpName %x_75_phi "x_75_phi" + OpName %x_53 "x_53" + OpName %x_39 "x_39" + OpName %x_34_phi "x_34_phi" + OpName %x_62_phi "x_62_phi" + OpName %x_53_phi "x_53_phi" + OpName %x_56_phi "x_56_phi" + OpName %x_54 "x_54" + OpName %x_57 "x_57" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_6 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_6 = OpConstant %uint 6 +%_arr_int_uint_6 = OpTypeArray %int %uint_6 + %buf0 = OpTypeStruct %_arr_int_uint_6 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %25 = OpConstantNull %bool +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %40 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %v4bool = OpTypeVector %bool 4 + %int_5 = OpConstant %int 5 + %main_out = OpTypeStruct %v4float + %124 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_36 = OpVariable %_ptr_Function_int Function %21 + %x_74 = OpVariable %_ptr_Function_bool Function %25 + %x_33_phi = OpVariable %_ptr_Function_v4float Function %12 + %x_36_phi = OpVariable %_ptr_Function_int Function %21 + %x_38_phi = OpVariable %_ptr_Function_int Function %21 + %x_75_phi = OpVariable %_ptr_Function_bool Function %25 + %x_53 = OpVariable %_ptr_Function_v4float Function %12 + %x_39 = OpVariable %_ptr_Function_int Function %21 + %x_34_phi = OpVariable %_ptr_Function_v4float Function %12 + %x_62_phi = OpVariable %_ptr_Function_int Function %21 + %x_53_phi = OpVariable %_ptr_Function_v4float Function %12 + %x_56_phi = OpVariable %_ptr_Function_int Function %21 + %x_54 = OpVariable %_ptr_Function_v4float Function %12 + %x_57 = OpVariable %_ptr_Function_int Function %21 + %34 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %35 = OpLoad %int %34 + %37 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %38 = OpLoad %int %37 + OpStore %x_33_phi %40 + OpStore %x_36_phi %35 + OpStore %x_38_phi %38 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %49 = OpLoad %v4float %x_33_phi + %50 = OpLoad %int %x_36_phi + OpStore %x_36 %50 + %51 = OpLoad %int %x_38_phi + %53 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_4 + %54 = OpLoad %int %53 + %55 = OpSLessThan %bool %51 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpBranch %56 + %58 = OpLabel + OpBranch %42 + %56 = OpLabel + OpSelectionMerge %61 None + OpSwitch %uint_0 %62 + %62 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_3 + %65 = OpLoad %int %64 + %66 = OpSGreaterThan %bool %51 %65 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %67 + %68 = OpLabel + OpStore %x_34_phi %49 + OpStore %x_62_phi %int_2 + OpBranch %61 + %67 = OpLabel + OpStore %x_53_phi %49 + OpStore %x_56_phi %35 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %76 = OpLoad %v4float %x_53_phi + OpStore %x_53 %76 + %77 = OpLoad %int %x_56_phi + %78 = OpSLessThan %bool %77 %54 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %81 + %80 = OpLabel + OpBranch %79 + %81 = OpLabel + OpBranch %71 + %79 = OpLabel + OpBranch %72 + %72 = OpLabel + %83 = OpIAdd %int %51 %77 + %82 = OpConvertSToF %float %83 + %84 = OpCompositeConstruct %v4float %82 %82 %82 %82 + OpStore %x_54 %84 + %85 = OpIAdd %int %77 %int_1 + OpStore %x_57 %85 + %86 = OpLoad %v4float %x_54 + OpStore %x_53_phi %86 + %87 = OpLoad %int %x_57 + OpStore %x_56_phi %87 + OpBranch %70 + %71 = OpLabel + %88 = OpLoad %v4float %x_53 + OpStore %x_GLF_color %88 + %89 = OpLoad %v4float %x_53 + OpStore %x_34_phi %89 + OpStore %x_62_phi %38 + OpBranch %61 + %61 = OpLabel + %90 = OpLoad %v4float %x_34_phi + %91 = OpLoad %int %x_62_phi + OpBranch %43 + %43 = OpLabel + %92 = OpIAdd %int %51 %int_1 + OpStore %x_39 %92 + OpStore %x_33_phi %90 + %94 = OpLoad %int %x_36 + %95 = OpCopyObject %int %91 + %96 = OpIAdd %int %94 %95 + %93 = OpCopyObject %int %96 + OpStore %x_36_phi %93 + %97 = OpLoad %int %x_39 + OpStore %x_38_phi %97 + OpBranch %41 + %42 = OpLabel + %98 = OpLoad %v4float %x_GLF_color + %99 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2 + %100 = OpLoad %int %99 + %101 = OpConvertSToF %float %100 + %103 = OpCompositeConstruct %v4float %101 %101 %101 %101 + %104 = OpFOrdEqual %v4bool %98 %103 + %102 = OpAll %bool %104 + OpStore %x_75_phi %102 + OpSelectionMerge %106 None + OpBranchConditional %102 %107 %106 + %107 = OpLabel + %109 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_5 + %110 = OpLoad %int %109 + %111 = OpLoad %int %x_36 + %112 = OpCopyObject %int %110 + %113 = OpIEqual %bool %111 %112 + OpStore %x_74 %113 + %114 = OpLoad %bool %x_74 + OpStore %x_75_phi %114 + OpBranch %106 + %106 = OpLabel + %115 = OpLoad %bool %x_75_phi + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %118 + %117 = OpLabel + %119 = OpConvertSToF %float %38 + %120 = OpConvertSToF %float %35 + %121 = OpCompositeConstruct %v4float %119 %120 %120 %119 + OpStore %x_GLF_color %121 + OpBranch %116 + %118 = OpLabel + %122 = OpConvertSToF %float %35 + %123 = OpCompositeConstruct %v4float %122 %122 %122 %122 + OpStore %x_GLF_color %123 + OpBranch %116 + %116 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %124 +%tint_symbol = OpFunctionParameter %main_out + %128 = OpLabel + %129 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %129 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %131 = OpLabel + %132 = OpFunctionCall %void %main_1 + %134 = OpLoad %v4float %x_GLF_color + %135 = OpCompositeConstruct %main_out %134 + %133 = OpFunctionCall %void %tint_symbol_2 %135 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..295609c62e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-output-color-function-call-nested-loop/0.wgsl.expected.wgsl @@ -0,0 +1,113 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : i32; + var x_74 : bool; + var x_33_phi : vec4; + var x_36_phi : i32; + var x_38_phi : i32; + var x_75_phi : bool; + let x_29 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_31 : i32 = x_5.x_GLF_uniform_int_values[1]; + x_33_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_36_phi = x_29; + x_38_phi = x_31; + loop { + var x_53 : vec4; + var x_39 : i32; + var x_34_phi : vec4; + var x_62_phi : i32; + let x_33 : vec4 = x_33_phi; + x_36 = x_36_phi; + let x_38 : i32 = x_38_phi; + let x_41 : i32 = x_5.x_GLF_uniform_int_values[4]; + if ((x_38 < x_41)) { + } else { + break; + } + var x_53_phi : vec4; + var x_56_phi : i32; + switch(0u) { + default: { + let x_48 : i32 = x_5.x_GLF_uniform_int_values[3]; + if ((x_38 > x_48)) { + x_34_phi = x_33; + x_62_phi = 2; + break; + } + x_53_phi = x_33; + x_56_phi = x_29; + loop { + var x_54 : vec4; + var x_57 : i32; + x_53 = x_53_phi; + let x_56 : i32 = x_56_phi; + if ((x_56 < x_41)) { + } else { + break; + } + + continuing { + let x_61 : f32 = f32((x_38 + x_56)); + x_54 = vec4(x_61, x_61, x_61, x_61); + x_57 = (x_56 + 1); + x_53_phi = x_54; + x_56_phi = x_57; + } + } + x_GLF_color = x_53; + x_34_phi = x_53; + x_62_phi = x_31; + } + } + let x_34 : vec4 = x_34_phi; + let x_62 : i32 = x_62_phi; + + continuing { + x_39 = (x_38 + 1); + x_33_phi = x_34; + x_36_phi = bitcast((x_36 + bitcast(x_62))); + x_38_phi = x_39; + } + } + let x_63 : vec4 = x_GLF_color; + let x_65 : i32 = x_5.x_GLF_uniform_int_values[2]; + let x_66 : f32 = f32(x_65); + let x_69 : bool = all((x_63 == vec4(x_66, x_66, x_66, x_66))); + x_75_phi = x_69; + if (x_69) { + let x_73 : i32 = x_5.x_GLF_uniform_int_values[5]; + x_74 = (x_36 == bitcast(x_73)); + x_75_phi = x_74; + } + let x_75 : bool = x_75_phi; + if (x_75) { + let x_79 : f32 = f32(x_31); + let x_80 : f32 = f32(x_29); + x_GLF_color = vec4(x_79, x_80, x_80, x_79); + } else { + let x_82 : f32 = f32(x_29); + x_GLF_color = vec4(x_82, x_82, x_82, x_82); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm new file mode 100644 index 0000000000..38ac12b0b2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm @@ -0,0 +1,174 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %b "b" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v2float %float_1 %float_1 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int = OpTypeInt 32 1 + %int_40 = OpConstant %int 40 + %bool = OpTypeBool +%float_0_100000001 = OpConstant %float 0.100000001 + %29 = OpConstantComposite %v3float %float_0_100000001 %float_0_100000001 %float_0_100000001 + %int_60 = OpConstant %int 60 +%float_0_200000003 = OpConstant %float 0.200000003 + %32 = OpConstantComposite %v3float %float_0_200000003 %float_0_200000003 %float_0_200000003 + %float_80 = OpConstant %float 80 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0_00999999978 = OpConstant %float 0.00999999978 + %int_100 = OpConstant %int 100 + %int_500 = OpConstant %int 500 +%float_0_540302277 = OpConstant %float 0.540302277 +%float_n0_99996084 = OpConstant %float -0.99996084 + %44 = OpConstantComposite %v3float %float_0_540302277 %float_0_540302277 %float_n0_99996084 +%float_1_01999998 = OpConstant %float 1.01999998 + %uint_2 = OpConstant %uint 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %49 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %10 + %50 = OpLabel + %a = OpVariable %_ptr_Function_v2float Function + %b = OpVariable %_ptr_Function_v3float Function + OpStore %a %15 + OpStore %b %19 + %51 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %52 = OpLoad %float %51 + %53 = OpConvertFToS %int %52 + %54 = OpSLessThan %bool %53 %int_40 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpStore %b %29 + OpBranch %55 + %57 = OpLabel + %58 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %59 = OpLoad %float %58 + %60 = OpConvertFToS %int %59 + %61 = OpSLessThan %bool %60 %int_60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %64 + %63 = OpLabel + OpStore %b %32 + OpBranch %62 + %64 = OpLabel + %65 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %66 = OpLoad %float %65 + %67 = OpFOrdLessThan %bool %66 %float_80 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %71 = OpAccessChain %_ptr_Function_float %a %uint_0 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %74 = OpLoad %float %73 + %75 = OpCompositeConstruct %v3float %74 %74 %74 + %76 = OpCompositeConstruct %v3float %72 %72 %72 + %77 = OpFAdd %v3float %76 %75 + %78 = OpExtInst %v3float %1 Cos %77 + %79 = OpCompositeConstruct %v3float %float_0_00999999978 %float_0_00999999978 %float_0_00999999978 + %80 = OpFAdd %v3float %78 %79 + OpStore %b %80 + OpBranch %68 + %70 = OpLabel + %81 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %82 = OpLoad %float %81 + %83 = OpConvertFToS %int %82 + %84 = OpSLessThan %bool %83 %int_100 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %87 + %86 = OpLabel + %88 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %89 = OpLoad %float %88 + %90 = OpCompositeConstruct %v3float %89 %89 %89 + %91 = OpExtInst %v3float %1 Cos %90 + OpStore %b %91 + OpBranch %85 + %87 = OpLabel + %92 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %93 = OpLoad %float %92 + %94 = OpConvertFToS %int %93 + %95 = OpSLessThan %bool %94 %int_500 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %96 + %97 = OpLabel + OpStore %b %44 + OpBranch %96 + %96 = OpLabel + OpBranch %85 + %85 = OpLabel + OpBranch %68 + %68 = OpLabel + OpBranch %62 + %62 = OpLabel + OpBranch %55 + %55 = OpLabel + %98 = OpAccessChain %_ptr_Function_float %b %uint_0 + %99 = OpLoad %float %98 + %100 = OpFOrdLessThan %bool %99 %float_1_01999998 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpAccessChain %_ptr_Function_float %b %uint_1 + %104 = OpLoad %float %103 + %105 = OpFOrdLessThan %bool %104 %float_1_01999998 + OpBranch %101 + %101 = OpLabel + %106 = OpPhi %bool %100 %55 %105 %102 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %107 + %108 = OpLabel + %109 = OpAccessChain %_ptr_Function_float %b %uint_2 + %110 = OpLoad %float %109 + %111 = OpFOrdLessThan %bool %110 %float_1_01999998 + OpBranch %107 + %107 = OpLabel + %112 = OpPhi %bool %106 %101 %111 %108 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %115 + %114 = OpLabel + OpStore %_GLF_color %48 + OpBranch %113 + %115 = OpLabel + OpStore %_GLF_color %49 + OpBranch %113 + %113 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2f55ee9683 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.hlsl @@ -0,0 +1,83 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 a = float2(0.0f, 0.0f); + float3 b = float3(0.0f, 0.0f, 0.0f); + bool x_105 = false; + bool x_111 = false; + bool x_106_phi = false; + bool x_112_phi = false; + a = float2(1.0f, 1.0f); + b = float3(0.0f, 0.0f, 0.0f); + const float x_52 = gl_FragCoord.y; + if ((int(x_52) < 40)) { + b = float3(0.100000001f, 0.100000001f, 0.100000001f); + } else { + const float x_59 = gl_FragCoord.y; + if ((int(x_59) < 60)) { + b = float3(0.200000003f, 0.200000003f, 0.200000003f); + } else { + const float x_66 = gl_FragCoord.y; + if ((x_66 < 80.0f)) { + const float x_72 = a.x; + const float x_74 = asfloat(x_8[0].x); + b = (cos((float3(x_72, x_72, x_72) + float3(x_74, x_74, x_74))) + float3(0.01f, 0.01f, 0.01f)); + } else { + const float x_82 = gl_FragCoord.y; + if ((int(x_82) < 100)) { + const float x_89 = asfloat(x_8[0].x); + b = cos(float3(x_89, x_89, x_89)); + } else { + const float x_93 = gl_FragCoord.y; + if ((int(x_93) < 500)) { + b = float3(0.540302277f, 0.540302277f, -0.99996084f); + } + } + } + } + } + const float x_99 = b.x; + const bool x_100 = (x_99 < 1.019999981f); + x_106_phi = x_100; + if (x_100) { + const float x_104 = b.y; + x_105 = (x_104 < 1.019999981f); + x_106_phi = x_105; + } + const bool x_106 = x_106_phi; + x_112_phi = x_106; + if (x_106) { + const float x_110 = b.z; + x_111 = (x_110 < 1.019999981f); + x_112_phi = x_111; + } + if (x_112_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a68c333ca0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 a = 0.0f; + float3 b = 0.0f; + bool x_105 = false; + bool x_111 = false; + bool x_106_phi = false; + bool x_112_phi = false; + a = float2(1.0f, 1.0f); + b = float3(0.0f, 0.0f, 0.0f); + float const x_52 = (*(tint_symbol_5)).y; + if ((int(x_52) < 40)) { + b = float3(0.100000001f, 0.100000001f, 0.100000001f); + } else { + float const x_59 = (*(tint_symbol_5)).y; + if ((int(x_59) < 60)) { + b = float3(0.200000003f, 0.200000003f, 0.200000003f); + } else { + float const x_66 = (*(tint_symbol_5)).y; + if ((x_66 < 80.0f)) { + float const x_72 = a.x; + float const x_74 = x_8.one; + b = (cos((float3(x_72, x_72, x_72) + float3(x_74, x_74, x_74))) + float3(0.01f, 0.01f, 0.01f)); + } else { + float const x_82 = (*(tint_symbol_5)).y; + if ((int(x_82) < 100)) { + float const x_89 = x_8.one; + b = cos(float3(x_89, x_89, x_89)); + } else { + float const x_93 = (*(tint_symbol_5)).y; + if ((int(x_93) < 500)) { + b = float3(0.540302277f, 0.540302277f, -0.99996084f); + } + } + } + } + } + float const x_99 = b.x; + bool const x_100 = (x_99 < 1.019999981f); + x_106_phi = x_100; + if (x_100) { + float const x_104 = b.y; + x_105 = (x_104 < 1.019999981f); + x_106_phi = x_105; + } + bool const x_106 = x_106_phi; + x_112_phi = x_106; + if (x_106) { + float const x_110 = b.z; + x_111 = (x_110 < 1.019999981f); + x_112_phi = x_111; + } + bool const x_112 = x_112_phi; + if (x_112) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f4d0f975ae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.spvasm @@ -0,0 +1,229 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 142 +; Schema: 0 + OpCapability Shader + %76 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %x_105 "x_105" + OpName %x_111 "x_111" + OpName %x_106_phi "x_106_phi" + OpName %x_112_phi "x_112_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %25 = OpConstantNull %v3float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %29 = OpConstantNull %bool + %float_1 = OpConstant %float 1 + %34 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int = OpTypeInt 32 1 + %int_40 = OpConstant %int 40 +%float_0_100000001 = OpConstant %float 0.100000001 + %50 = OpConstantComposite %v3float %float_0_100000001 %float_0_100000001 %float_0_100000001 + %int_60 = OpConstant %int 60 +%float_0_200000003 = OpConstant %float 0.200000003 + %60 = OpConstantComposite %v3float %float_0_200000003 %float_0_200000003 %float_0_200000003 + %float_80 = OpConstant %float 80 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0_00999999978 = OpConstant %float 0.00999999978 + %81 = OpConstantComposite %v3float %float_0_00999999978 %float_0_00999999978 %float_0_00999999978 + %int_100 = OpConstant %int 100 + %int_500 = OpConstant %int 500 +%float_0_540302277 = OpConstant %float 0.540302277 +%float_n0_99996084 = OpConstant %float -0.99996084 + %104 = OpConstantComposite %v3float %float_0_540302277 %float_0_540302277 %float_n0_99996084 +%float_1_01999998 = OpConstant %float 1.01999998 + %uint_2 = OpConstant %uint 2 + %127 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %128 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %129 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %a = OpVariable %_ptr_Function_v2float Function %21 + %b = OpVariable %_ptr_Function_v3float Function %25 + %x_105 = OpVariable %_ptr_Function_bool Function %29 + %x_111 = OpVariable %_ptr_Function_bool Function %29 + %x_106_phi = OpVariable %_ptr_Function_bool Function %29 + %x_112_phi = OpVariable %_ptr_Function_bool Function %29 + OpStore %a %34 + OpStore %b %36 + %40 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %41 = OpLoad %float %40 + %42 = OpConvertFToS %int %41 + %45 = OpSLessThan %bool %42 %int_40 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpStore %b %50 + OpBranch %46 + %48 = OpLabel + %51 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %52 = OpLoad %float %51 + %53 = OpConvertFToS %int %52 + %55 = OpSLessThan %bool %53 %int_60 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpStore %b %60 + OpBranch %56 + %58 = OpLabel + %61 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %62 = OpLoad %float %61 + %64 = OpFOrdLessThan %bool %62 %float_80 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %67 + %66 = OpLabel + %70 = OpAccessChain %_ptr_Function_float %a %uint_0 + %71 = OpLoad %float %70 + %73 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 + %74 = OpLoad %float %73 + %77 = OpCompositeConstruct %v3float %71 %71 %71 + %78 = OpCompositeConstruct %v3float %74 %74 %74 + %79 = OpFAdd %v3float %77 %78 + %75 = OpExtInst %v3float %76 Cos %79 + %82 = OpFAdd %v3float %75 %81 + OpStore %b %82 + OpBranch %65 + %67 = OpLabel + %83 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %84 = OpLoad %float %83 + %85 = OpConvertFToS %int %84 + %87 = OpSLessThan %bool %85 %int_100 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %90 + %89 = OpLabel + %91 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 + %92 = OpLoad %float %91 + %94 = OpCompositeConstruct %v3float %92 %92 %92 + %93 = OpExtInst %v3float %76 Cos %94 + OpStore %b %93 + OpBranch %88 + %90 = OpLabel + %95 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %96 = OpLoad %float %95 + %97 = OpConvertFToS %int %96 + %99 = OpSLessThan %bool %97 %int_500 + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %100 + %101 = OpLabel + OpStore %b %104 + OpBranch %100 + %100 = OpLabel + OpBranch %88 + %88 = OpLabel + OpBranch %65 + %65 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %46 + %46 = OpLabel + %105 = OpAccessChain %_ptr_Function_float %b %uint_0 + %106 = OpLoad %float %105 + %108 = OpFOrdLessThan %bool %106 %float_1_01999998 + OpStore %x_106_phi %108 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %109 + %110 = OpLabel + %111 = OpAccessChain %_ptr_Function_float %b %uint_1 + %112 = OpLoad %float %111 + %113 = OpFOrdLessThan %bool %112 %float_1_01999998 + OpStore %x_105 %113 + %114 = OpLoad %bool %x_105 + OpStore %x_106_phi %114 + OpBranch %109 + %109 = OpLabel + %115 = OpLoad %bool %x_106_phi + OpStore %x_112_phi %115 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + %119 = OpAccessChain %_ptr_Function_float %b %uint_2 + %120 = OpLoad %float %119 + %121 = OpFOrdLessThan %bool %120 %float_1_01999998 + OpStore %x_111 %121 + %122 = OpLoad %bool %x_111 + OpStore %x_112_phi %122 + OpBranch %116 + %116 = OpLabel + %123 = OpLoad %bool %x_112_phi + OpSelectionMerge %124 None + OpBranchConditional %123 %125 %126 + %125 = OpLabel + OpStore %x_GLF_color %127 + OpBranch %124 + %126 = OpLabel + OpStore %x_GLF_color %128 + OpBranch %124 + %124 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %129 +%tint_symbol_1 = OpFunctionParameter %main_out + %133 = OpLabel + %134 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %134 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %136 = OpLabel + %137 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %137 + %138 = OpFunctionCall %void %main_1 + %140 = OpLoad %v4float %x_GLF_color + %141 = OpCompositeConstruct %main_out %140 + %139 = OpFunctionCall %void %tint_symbol_3 %141 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..017a1d9fc9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.spvasm.expected.wgsl @@ -0,0 +1,82 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : vec2; + var b : vec3; + var x_105 : bool; + var x_111 : bool; + var x_106_phi : bool; + var x_112_phi : bool; + a = vec2(1.0, 1.0); + b = vec3(0.0, 0.0, 0.0); + let x_52 : f32 = gl_FragCoord.y; + if ((i32(x_52) < 40)) { + b = vec3(0.100000001, 0.100000001, 0.100000001); + } else { + let x_59 : f32 = gl_FragCoord.y; + if ((i32(x_59) < 60)) { + b = vec3(0.200000003, 0.200000003, 0.200000003); + } else { + let x_66 : f32 = gl_FragCoord.y; + if ((x_66 < 80.0)) { + let x_72 : f32 = a.x; + let x_74 : f32 = x_8.one; + b = (cos((vec3(x_72, x_72, x_72) + vec3(x_74, x_74, x_74))) + vec3(0.01, 0.01, 0.01)); + } else { + let x_82 : f32 = gl_FragCoord.y; + if ((i32(x_82) < 100)) { + let x_89 : f32 = x_8.one; + b = cos(vec3(x_89, x_89, x_89)); + } else { + let x_93 : f32 = gl_FragCoord.y; + if ((i32(x_93) < 500)) { + b = vec3(0.540302277, 0.540302277, -0.99996084); + } + } + } + } + } + let x_99 : f32 = b.x; + let x_100 : bool = (x_99 < 1.019999981); + x_106_phi = x_100; + if (x_100) { + let x_104 : f32 = b.y; + x_105 = (x_104 < 1.019999981); + x_106_phi = x_105; + } + let x_106 : bool = x_106_phi; + x_112_phi = x_106; + if (x_106) { + let x_110 : f32 = b.z; + x_111 = (x_110 < 1.019999981); + x_112_phi = x_111; + } + let x_112 : bool = x_112_phi; + if (x_112) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl new file mode 100644 index 0000000000..017a1d9fc9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl @@ -0,0 +1,82 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : vec2; + var b : vec3; + var x_105 : bool; + var x_111 : bool; + var x_106_phi : bool; + var x_112_phi : bool; + a = vec2(1.0, 1.0); + b = vec3(0.0, 0.0, 0.0); + let x_52 : f32 = gl_FragCoord.y; + if ((i32(x_52) < 40)) { + b = vec3(0.100000001, 0.100000001, 0.100000001); + } else { + let x_59 : f32 = gl_FragCoord.y; + if ((i32(x_59) < 60)) { + b = vec3(0.200000003, 0.200000003, 0.200000003); + } else { + let x_66 : f32 = gl_FragCoord.y; + if ((x_66 < 80.0)) { + let x_72 : f32 = a.x; + let x_74 : f32 = x_8.one; + b = (cos((vec3(x_72, x_72, x_72) + vec3(x_74, x_74, x_74))) + vec3(0.01, 0.01, 0.01)); + } else { + let x_82 : f32 = gl_FragCoord.y; + if ((i32(x_82) < 100)) { + let x_89 : f32 = x_8.one; + b = cos(vec3(x_89, x_89, x_89)); + } else { + let x_93 : f32 = gl_FragCoord.y; + if ((i32(x_93) < 500)) { + b = vec3(0.540302277, 0.540302277, -0.99996084); + } + } + } + } + } + let x_99 : f32 = b.x; + let x_100 : bool = (x_99 < 1.019999981); + x_106_phi = x_100; + if (x_100) { + let x_104 : f32 = b.y; + x_105 = (x_104 < 1.019999981); + x_106_phi = x_105; + } + let x_106 : bool = x_106_phi; + x_112_phi = x_106; + if (x_106) { + let x_110 : f32 = b.z; + x_111 = (x_110 < 1.019999981); + x_112_phi = x_111; + } + let x_112 : bool = x_112_phi; + if (x_112) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2f55ee9683 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.hlsl @@ -0,0 +1,83 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 a = float2(0.0f, 0.0f); + float3 b = float3(0.0f, 0.0f, 0.0f); + bool x_105 = false; + bool x_111 = false; + bool x_106_phi = false; + bool x_112_phi = false; + a = float2(1.0f, 1.0f); + b = float3(0.0f, 0.0f, 0.0f); + const float x_52 = gl_FragCoord.y; + if ((int(x_52) < 40)) { + b = float3(0.100000001f, 0.100000001f, 0.100000001f); + } else { + const float x_59 = gl_FragCoord.y; + if ((int(x_59) < 60)) { + b = float3(0.200000003f, 0.200000003f, 0.200000003f); + } else { + const float x_66 = gl_FragCoord.y; + if ((x_66 < 80.0f)) { + const float x_72 = a.x; + const float x_74 = asfloat(x_8[0].x); + b = (cos((float3(x_72, x_72, x_72) + float3(x_74, x_74, x_74))) + float3(0.01f, 0.01f, 0.01f)); + } else { + const float x_82 = gl_FragCoord.y; + if ((int(x_82) < 100)) { + const float x_89 = asfloat(x_8[0].x); + b = cos(float3(x_89, x_89, x_89)); + } else { + const float x_93 = gl_FragCoord.y; + if ((int(x_93) < 500)) { + b = float3(0.540302277f, 0.540302277f, -0.99996084f); + } + } + } + } + } + const float x_99 = b.x; + const bool x_100 = (x_99 < 1.019999981f); + x_106_phi = x_100; + if (x_100) { + const float x_104 = b.y; + x_105 = (x_104 < 1.019999981f); + x_106_phi = x_105; + } + const bool x_106 = x_106_phi; + x_112_phi = x_106; + if (x_106) { + const float x_110 = b.z; + x_111 = (x_110 < 1.019999981f); + x_112_phi = x_111; + } + if (x_112_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a68c333ca0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.msl @@ -0,0 +1,83 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 a = 0.0f; + float3 b = 0.0f; + bool x_105 = false; + bool x_111 = false; + bool x_106_phi = false; + bool x_112_phi = false; + a = float2(1.0f, 1.0f); + b = float3(0.0f, 0.0f, 0.0f); + float const x_52 = (*(tint_symbol_5)).y; + if ((int(x_52) < 40)) { + b = float3(0.100000001f, 0.100000001f, 0.100000001f); + } else { + float const x_59 = (*(tint_symbol_5)).y; + if ((int(x_59) < 60)) { + b = float3(0.200000003f, 0.200000003f, 0.200000003f); + } else { + float const x_66 = (*(tint_symbol_5)).y; + if ((x_66 < 80.0f)) { + float const x_72 = a.x; + float const x_74 = x_8.one; + b = (cos((float3(x_72, x_72, x_72) + float3(x_74, x_74, x_74))) + float3(0.01f, 0.01f, 0.01f)); + } else { + float const x_82 = (*(tint_symbol_5)).y; + if ((int(x_82) < 100)) { + float const x_89 = x_8.one; + b = cos(float3(x_89, x_89, x_89)); + } else { + float const x_93 = (*(tint_symbol_5)).y; + if ((int(x_93) < 500)) { + b = float3(0.540302277f, 0.540302277f, -0.99996084f); + } + } + } + } + } + float const x_99 = b.x; + bool const x_100 = (x_99 < 1.019999981f); + x_106_phi = x_100; + if (x_100) { + float const x_104 = b.y; + x_105 = (x_104 < 1.019999981f); + x_106_phi = x_105; + } + bool const x_106 = x_106_phi; + x_112_phi = x_106; + if (x_106) { + float const x_110 = b.z; + x_111 = (x_110 < 1.019999981f); + x_112_phi = x_111; + } + bool const x_112 = x_112_phi; + if (x_112) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f4d0f975ae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.spvasm @@ -0,0 +1,229 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 142 +; Schema: 0 + OpCapability Shader + %76 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %x_105 "x_105" + OpName %x_111 "x_111" + OpName %x_106_phi "x_106_phi" + OpName %x_112_phi "x_112_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %25 = OpConstantNull %v3float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %29 = OpConstantNull %bool + %float_1 = OpConstant %float 1 + %34 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int = OpTypeInt 32 1 + %int_40 = OpConstant %int 40 +%float_0_100000001 = OpConstant %float 0.100000001 + %50 = OpConstantComposite %v3float %float_0_100000001 %float_0_100000001 %float_0_100000001 + %int_60 = OpConstant %int 60 +%float_0_200000003 = OpConstant %float 0.200000003 + %60 = OpConstantComposite %v3float %float_0_200000003 %float_0_200000003 %float_0_200000003 + %float_80 = OpConstant %float 80 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0_00999999978 = OpConstant %float 0.00999999978 + %81 = OpConstantComposite %v3float %float_0_00999999978 %float_0_00999999978 %float_0_00999999978 + %int_100 = OpConstant %int 100 + %int_500 = OpConstant %int 500 +%float_0_540302277 = OpConstant %float 0.540302277 +%float_n0_99996084 = OpConstant %float -0.99996084 + %104 = OpConstantComposite %v3float %float_0_540302277 %float_0_540302277 %float_n0_99996084 +%float_1_01999998 = OpConstant %float 1.01999998 + %uint_2 = OpConstant %uint 2 + %127 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %128 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %129 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %a = OpVariable %_ptr_Function_v2float Function %21 + %b = OpVariable %_ptr_Function_v3float Function %25 + %x_105 = OpVariable %_ptr_Function_bool Function %29 + %x_111 = OpVariable %_ptr_Function_bool Function %29 + %x_106_phi = OpVariable %_ptr_Function_bool Function %29 + %x_112_phi = OpVariable %_ptr_Function_bool Function %29 + OpStore %a %34 + OpStore %b %36 + %40 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %41 = OpLoad %float %40 + %42 = OpConvertFToS %int %41 + %45 = OpSLessThan %bool %42 %int_40 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpStore %b %50 + OpBranch %46 + %48 = OpLabel + %51 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %52 = OpLoad %float %51 + %53 = OpConvertFToS %int %52 + %55 = OpSLessThan %bool %53 %int_60 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpStore %b %60 + OpBranch %56 + %58 = OpLabel + %61 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %62 = OpLoad %float %61 + %64 = OpFOrdLessThan %bool %62 %float_80 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %67 + %66 = OpLabel + %70 = OpAccessChain %_ptr_Function_float %a %uint_0 + %71 = OpLoad %float %70 + %73 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 + %74 = OpLoad %float %73 + %77 = OpCompositeConstruct %v3float %71 %71 %71 + %78 = OpCompositeConstruct %v3float %74 %74 %74 + %79 = OpFAdd %v3float %77 %78 + %75 = OpExtInst %v3float %76 Cos %79 + %82 = OpFAdd %v3float %75 %81 + OpStore %b %82 + OpBranch %65 + %67 = OpLabel + %83 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %84 = OpLoad %float %83 + %85 = OpConvertFToS %int %84 + %87 = OpSLessThan %bool %85 %int_100 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %90 + %89 = OpLabel + %91 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 + %92 = OpLoad %float %91 + %94 = OpCompositeConstruct %v3float %92 %92 %92 + %93 = OpExtInst %v3float %76 Cos %94 + OpStore %b %93 + OpBranch %88 + %90 = OpLabel + %95 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %96 = OpLoad %float %95 + %97 = OpConvertFToS %int %96 + %99 = OpSLessThan %bool %97 %int_500 + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %100 + %101 = OpLabel + OpStore %b %104 + OpBranch %100 + %100 = OpLabel + OpBranch %88 + %88 = OpLabel + OpBranch %65 + %65 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %46 + %46 = OpLabel + %105 = OpAccessChain %_ptr_Function_float %b %uint_0 + %106 = OpLoad %float %105 + %108 = OpFOrdLessThan %bool %106 %float_1_01999998 + OpStore %x_106_phi %108 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %109 + %110 = OpLabel + %111 = OpAccessChain %_ptr_Function_float %b %uint_1 + %112 = OpLoad %float %111 + %113 = OpFOrdLessThan %bool %112 %float_1_01999998 + OpStore %x_105 %113 + %114 = OpLoad %bool %x_105 + OpStore %x_106_phi %114 + OpBranch %109 + %109 = OpLabel + %115 = OpLoad %bool %x_106_phi + OpStore %x_112_phi %115 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + %119 = OpAccessChain %_ptr_Function_float %b %uint_2 + %120 = OpLoad %float %119 + %121 = OpFOrdLessThan %bool %120 %float_1_01999998 + OpStore %x_111 %121 + %122 = OpLoad %bool %x_111 + OpStore %x_112_phi %122 + OpBranch %116 + %116 = OpLabel + %123 = OpLoad %bool %x_112_phi + OpSelectionMerge %124 None + OpBranchConditional %123 %125 %126 + %125 = OpLabel + OpStore %x_GLF_color %127 + OpBranch %124 + %126 = OpLabel + OpStore %x_GLF_color %128 + OpBranch %124 + %124 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %129 +%tint_symbol_1 = OpFunctionParameter %main_out + %133 = OpLabel + %134 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %134 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %136 = OpLabel + %137 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %137 + %138 = OpFunctionCall %void %main_1 + %140 = OpLoad %v4float %x_GLF_color + %141 = OpCompositeConstruct %main_out %140 + %139 = OpFunctionCall %void %tint_symbol_3 %141 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..017a1d9fc9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-set-vector-cos-fragcoord/0-opt.wgsl.expected.wgsl @@ -0,0 +1,82 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : vec2; + var b : vec3; + var x_105 : bool; + var x_111 : bool; + var x_106_phi : bool; + var x_112_phi : bool; + a = vec2(1.0, 1.0); + b = vec3(0.0, 0.0, 0.0); + let x_52 : f32 = gl_FragCoord.y; + if ((i32(x_52) < 40)) { + b = vec3(0.100000001, 0.100000001, 0.100000001); + } else { + let x_59 : f32 = gl_FragCoord.y; + if ((i32(x_59) < 60)) { + b = vec3(0.200000003, 0.200000003, 0.200000003); + } else { + let x_66 : f32 = gl_FragCoord.y; + if ((x_66 < 80.0)) { + let x_72 : f32 = a.x; + let x_74 : f32 = x_8.one; + b = (cos((vec3(x_72, x_72, x_72) + vec3(x_74, x_74, x_74))) + vec3(0.01, 0.01, 0.01)); + } else { + let x_82 : f32 = gl_FragCoord.y; + if ((i32(x_82) < 100)) { + let x_89 : f32 = x_8.one; + b = cos(vec3(x_89, x_89, x_89)); + } else { + let x_93 : f32 = gl_FragCoord.y; + if ((i32(x_93) < 500)) { + b = vec3(0.540302277, 0.540302277, -0.99996084); + } + } + } + } + } + let x_99 : f32 = b.x; + let x_100 : bool = (x_99 < 1.019999981); + x_106_phi = x_100; + if (x_100) { + let x_104 : f32 = b.y; + x_105 = (x_104 < 1.019999981); + x_106_phi = x_105; + } + let x_106 : bool = x_106_phi; + x_112_phi = x_106; + if (x_106) { + let x_110 : f32 = b.z; + x_111 = (x_110 < 1.019999981); + x_112_phi = x_111; + } + let x_112 : bool = x_112_phi; + if (x_112) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm new file mode 100644 index 0000000000..0315e97bf7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm @@ -0,0 +1,180 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %S "S" + OpMemberName %S 0 "arr" + OpName %func_struct_S_i1_2_1_i1_ "func(struct-S-i1[2]1;i1;" + OpName %s "s" + OpName %x "x" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %a "a" + OpName %i "i" + OpName %j "j" + OpName %s_0 "s" + OpName %param "param" + OpName %param_0 "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %S 0 RelaxedPrecision + OpDecorate %func_struct_S_i1_2_1_i1_ RelaxedPrecision + OpDecorate %x RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %a RelaxedPrecision + OpDecorate %i RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %j RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %40 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %S = OpTypeStruct %_arr_int_uint_2 +%_ptr_Function_S = OpTypePointer Function %S +%_ptr_Function_int = OpTypePointer Function %int + %47 = OpTypeFunction %int %_ptr_Function_S %_ptr_Function_int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_n1 = OpConstant %int -1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_30 = OpConstant %int 30 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %62 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %63 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %40 + %64 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %s_0 = OpVariable %_ptr_Function_S Function + %param = OpVariable %_ptr_Function_S Function + %param_0 = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %65 + %65 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %22 = OpLoad %int %i + %69 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %23 = OpLoad %int %69 + %24 = OpIAdd %int %int_2 %23 + %70 = OpSLessThan %bool %22 %24 + OpBranchConditional %70 %71 %66 + %71 = OpLabel + OpStore %j %int_0 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %25 = OpLoad %int %j + %76 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %26 = OpLoad %int %76 + %27 = OpIAdd %int %int_3 %26 + %77 = OpSLessThan %bool %25 %27 + OpBranchConditional %77 %78 %73 + %78 = OpLabel + %28 = OpLoad %int %i + %29 = OpLoad %int %j + %30 = OpIAdd %int %28 %29 + %79 = OpLoad %S %s_0 + OpStore %param %79 + OpStore %param_0 %30 + %31 = OpFunctionCall %int %func_struct_S_i1_2_1_i1_ %param %param_0 + %32 = OpLoad %int %a + %33 = OpIAdd %int %32 %31 + OpStore %a %33 + OpBranch %74 + %74 = OpLabel + %34 = OpLoad %int %j + %35 = OpIAdd %int %34 %int_1 + OpStore %j %35 + OpBranch %72 + %73 = OpLabel + OpBranch %67 + %67 = OpLabel + %36 = OpLoad %int %i + %37 = OpIAdd %int %36 %int_1 + OpStore %i %37 + OpBranch %65 + %66 = OpLabel + %38 = OpLoad %int %a + %80 = OpIEqual %bool %38 %int_30 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + OpStore %_GLF_color %62 + OpBranch %81 + %83 = OpLabel + OpStore %_GLF_color %63 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd +%func_struct_S_i1_2_1_i1_ = OpFunction %int None %47 + %s = OpFunctionParameter %_ptr_Function_S + %x = OpFunctionParameter %_ptr_Function_int + %84 = OpLabel + %16 = OpLoad %int %x + %17 = OpIAdd %int %16 %int_1 + %85 = OpAccessChain %_ptr_Function_int %s %int_0 %int_1 + OpStore %85 %17 + %86 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %18 = OpLoad %int %86 + %87 = OpAccessChain %_ptr_Function_int %s %int_0 %18 + %19 = OpLoad %int %87 + %20 = OpLoad %int %x + %88 = OpIEqual %bool %19 %20 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + OpReturnValue %int_n1 + %89 = OpLabel + %21 = OpLoad %int %x + OpReturnValue %21 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..a739821490 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.hlsl @@ -0,0 +1,81 @@ +struct S { + int arr[2]; +}; + +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_struct_S_i1_2_1_i1_(inout S s, inout int x) { + const int x_16 = x; + s.arr[1] = (x_16 + 1); + const int x_18 = asint(x_9[0].x); + const int x_19 = s.arr[x_18]; + const int x_20 = x; + if ((x_19 == x_20)) { + return -1; + } + const int x_21 = x; + return x_21; +} + +void main_1() { + int a = 0; + int i = 0; + int j = 0; + S s_1 = (S)0; + S param = (S)0; + int param_1 = 0; + a = 0; + i = 0; + while (true) { + const int x_22 = i; + const int x_23 = asint(x_9[0].x); + if ((x_22 < (2 + x_23))) { + } else { + break; + } + j = 0; + while (true) { + const int x_25 = j; + const int x_26 = asint(x_9[0].x); + if ((x_25 < (3 + x_26))) { + } else { + break; + } + const int x_28 = i; + const int x_29 = j; + param = s_1; + param_1 = (x_28 + x_29); + const int x_31 = func_struct_S_i1_2_1_i1_(param, param_1); + a = (a + x_31); + { + j = (j + 1); + } + } + { + i = (i + 1); + } + } + if ((a == 30)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..5852dfa9bf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[2]; +}; +struct S { + tint_array_wrapper arr; +}; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_struct_S_i1_2_1_i1_(constant buf0& x_9, thread S* const s, thread int* const x) { + int const x_16 = *(x); + (*(s)).arr.arr[1] = (x_16 + 1); + int const x_18 = x_9.one; + int const x_19 = (*(s)).arr.arr[x_18]; + int const x_20 = *(x); + if ((x_19 == x_20)) { + return -1; + } + int const x_21 = *(x); + return x_21; +} + +void main_1(constant buf0& x_9, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int j = 0; + S s_1 = {}; + S param = {}; + int param_1 = 0; + a = 0; + i = 0; + while (true) { + int const x_22 = i; + int const x_23 = x_9.one; + if ((x_22 < (2 + x_23))) { + } else { + break; + } + j = 0; + while (true) { + int const x_25 = j; + int const x_26 = x_9.one; + if ((x_25 < (3 + x_26))) { + } else { + break; + } + int const x_28 = i; + int const x_29 = j; + S const x_79 = s_1; + param = x_79; + param_1 = (x_28 + x_29); + int const x_31 = func_struct_S_i1_2_1_i1_(x_9, &(param), &(param_1)); + int const x_32 = a; + a = (x_32 + x_31); + { + int const x_34 = j; + j = (x_34 + 1); + } + } + { + int const x_36 = i; + i = (x_36 + 1); + } + } + int const x_38 = a; + if ((x_38 == 30)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..7b4e7d47e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.spvasm @@ -0,0 +1,196 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 119 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %S "S" + OpMemberName %S 0 "arr" + OpName %func_struct_S_i1_2_1_i1_ "func_struct_S_i1_2_1_i1_" + OpName %s "s" + OpName %x "x" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %j "j" + OpName %s_1 "s_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %S = OpTypeStruct %_arr_int_uint_2 +%_ptr_Function_S = OpTypePointer Function %S +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpTypeFunction %int %_ptr_Function_S %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_n1 = OpConstant %int -1 + %void = OpTypeVoid + %45 = OpTypeFunction %void + %50 = OpConstantNull %int + %54 = OpConstantNull %S + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_30 = OpConstant %int 30 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %105 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %106 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %107 = OpTypeFunction %void %main_out +%func_struct_S_i1_2_1_i1_ = OpFunction %int None %12 + %s = OpFunctionParameter %_ptr_Function_S + %x = OpFunctionParameter %_ptr_Function_int + %22 = OpLabel + %24 = OpLoad %int %x + %28 = OpAccessChain %_ptr_Function_int %s %uint_0 %int_1 + %29 = OpIAdd %int %24 %int_1 + OpStore %28 %29 + %31 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %32 = OpLoad %int %31 + %34 = OpAccessChain %_ptr_Function_int %s %uint_0 %32 + %35 = OpLoad %int %34 + %37 = OpLoad %int %x + %38 = OpIEqual %bool %35 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %40 + %41 = OpLabel + OpReturnValue %int_n1 + %40 = OpLabel + %44 = OpLoad %int %x + OpReturnValue %44 + OpFunctionEnd + %main_1 = OpFunction %void None %45 + %48 = OpLabel + %a = OpVariable %_ptr_Function_int Function %50 + %i = OpVariable %_ptr_Function_int Function %50 + %j = OpVariable %_ptr_Function_int Function %50 + %s_1 = OpVariable %_ptr_Function_S Function %54 + %param = OpVariable %_ptr_Function_S Function %54 + %param_1 = OpVariable %_ptr_Function_int Function %50 + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %62 = OpLoad %int %i + %63 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %64 = OpLoad %int %63 + %66 = OpIAdd %int %int_2 %64 + %67 = OpSLessThan %bool %62 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %59 + %68 = OpLabel + OpStore %j %int_0 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %int %j + %76 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %77 = OpLoad %int %76 + %79 = OpIAdd %int %int_3 %77 + %80 = OpSLessThan %bool %75 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %72 + %81 = OpLabel + %84 = OpLoad %int %i + %85 = OpLoad %int %j + %86 = OpLoad %S %s_1 + OpStore %param %86 + %87 = OpIAdd %int %84 %85 + OpStore %param_1 %87 + %88 = OpFunctionCall %int %func_struct_S_i1_2_1_i1_ %param %param_1 + %91 = OpLoad %int %a + %92 = OpIAdd %int %91 %88 + OpStore %a %92 + OpBranch %73 + %73 = OpLabel + %93 = OpLoad %int %j + %94 = OpIAdd %int %93 %int_1 + OpStore %j %94 + OpBranch %71 + %72 = OpLabel + OpBranch %60 + %60 = OpLabel + %95 = OpLoad %int %i + %96 = OpIAdd %int %95 %int_1 + OpStore %i %96 + OpBranch %58 + %59 = OpLabel + %97 = OpLoad %int %a + %99 = OpIEqual %bool %97 %int_30 + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %102 + %101 = OpLabel + OpStore %x_GLF_color %105 + OpBranch %100 + %102 = OpLabel + OpStore %x_GLF_color %106 + OpBranch %100 + %100 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %107 +%tint_symbol = OpFunctionParameter %main_out + %111 = OpLabel + %112 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %112 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %45 + %114 = OpLabel + %115 = OpFunctionCall %void %main_1 + %117 = OpLoad %v4float %x_GLF_color + %118 = OpCompositeConstruct %main_out %117 + %116 = OpFunctionCall %void %tint_symbol_2 %118 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ddc01d1a68 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.spvasm.expected.wgsl @@ -0,0 +1,89 @@ +struct S { + arr : array; +}; + +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i1_2_1_i1_(s : ptr, x : ptr) -> i32 { + let x_16 : i32 = *(x); + (*(s)).arr[1] = (x_16 + 1); + let x_18 : i32 = x_9.one; + let x_19 : i32 = (*(s)).arr[x_18]; + let x_20 : i32 = *(x); + if ((x_19 == x_20)) { + return -1; + } + let x_21 : i32 = *(x); + return x_21; +} + +fn main_1() { + var a : i32; + var i : i32; + var j : i32; + var s_1 : S; + var param : S; + var param_1 : i32; + a = 0; + i = 0; + loop { + let x_22 : i32 = i; + let x_23 : i32 = x_9.one; + if ((x_22 < (2 + x_23))) { + } else { + break; + } + j = 0; + loop { + let x_25 : i32 = j; + let x_26 : i32 = x_9.one; + if ((x_25 < (3 + x_26))) { + } else { + break; + } + let x_28 : i32 = i; + let x_29 : i32 = j; + let x_79 : S = s_1; + param = x_79; + param_1 = (x_28 + x_29); + let x_31 : i32 = func_struct_S_i1_2_1_i1_(&(param), &(param_1)); + let x_32 : i32 = a; + a = (x_32 + x_31); + + continuing { + let x_34 : i32 = j; + j = (x_34 + 1); + } + } + + continuing { + let x_36 : i32 = i; + i = (x_36 + 1); + } + } + let x_38 : i32 = a; + if ((x_38 == 30)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl new file mode 100644 index 0000000000..ddc01d1a68 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl @@ -0,0 +1,89 @@ +struct S { + arr : array; +}; + +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i1_2_1_i1_(s : ptr, x : ptr) -> i32 { + let x_16 : i32 = *(x); + (*(s)).arr[1] = (x_16 + 1); + let x_18 : i32 = x_9.one; + let x_19 : i32 = (*(s)).arr[x_18]; + let x_20 : i32 = *(x); + if ((x_19 == x_20)) { + return -1; + } + let x_21 : i32 = *(x); + return x_21; +} + +fn main_1() { + var a : i32; + var i : i32; + var j : i32; + var s_1 : S; + var param : S; + var param_1 : i32; + a = 0; + i = 0; + loop { + let x_22 : i32 = i; + let x_23 : i32 = x_9.one; + if ((x_22 < (2 + x_23))) { + } else { + break; + } + j = 0; + loop { + let x_25 : i32 = j; + let x_26 : i32 = x_9.one; + if ((x_25 < (3 + x_26))) { + } else { + break; + } + let x_28 : i32 = i; + let x_29 : i32 = j; + let x_79 : S = s_1; + param = x_79; + param_1 = (x_28 + x_29); + let x_31 : i32 = func_struct_S_i1_2_1_i1_(&(param), &(param_1)); + let x_32 : i32 = a; + a = (x_32 + x_31); + + continuing { + let x_34 : i32 = j; + j = (x_34 + 1); + } + } + + continuing { + let x_36 : i32 = i; + i = (x_36 + 1); + } + } + let x_38 : i32 = a; + if ((x_38 == 30)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..a739821490 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.hlsl @@ -0,0 +1,81 @@ +struct S { + int arr[2]; +}; + +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_struct_S_i1_2_1_i1_(inout S s, inout int x) { + const int x_16 = x; + s.arr[1] = (x_16 + 1); + const int x_18 = asint(x_9[0].x); + const int x_19 = s.arr[x_18]; + const int x_20 = x; + if ((x_19 == x_20)) { + return -1; + } + const int x_21 = x; + return x_21; +} + +void main_1() { + int a = 0; + int i = 0; + int j = 0; + S s_1 = (S)0; + S param = (S)0; + int param_1 = 0; + a = 0; + i = 0; + while (true) { + const int x_22 = i; + const int x_23 = asint(x_9[0].x); + if ((x_22 < (2 + x_23))) { + } else { + break; + } + j = 0; + while (true) { + const int x_25 = j; + const int x_26 = asint(x_9[0].x); + if ((x_25 < (3 + x_26))) { + } else { + break; + } + const int x_28 = i; + const int x_29 = j; + param = s_1; + param_1 = (x_28 + x_29); + const int x_31 = func_struct_S_i1_2_1_i1_(param, param_1); + a = (a + x_31); + { + j = (j + 1); + } + } + { + i = (i + 1); + } + } + if ((a == 30)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..5852dfa9bf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[2]; +}; +struct S { + tint_array_wrapper arr; +}; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_struct_S_i1_2_1_i1_(constant buf0& x_9, thread S* const s, thread int* const x) { + int const x_16 = *(x); + (*(s)).arr.arr[1] = (x_16 + 1); + int const x_18 = x_9.one; + int const x_19 = (*(s)).arr.arr[x_18]; + int const x_20 = *(x); + if ((x_19 == x_20)) { + return -1; + } + int const x_21 = *(x); + return x_21; +} + +void main_1(constant buf0& x_9, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int j = 0; + S s_1 = {}; + S param = {}; + int param_1 = 0; + a = 0; + i = 0; + while (true) { + int const x_22 = i; + int const x_23 = x_9.one; + if ((x_22 < (2 + x_23))) { + } else { + break; + } + j = 0; + while (true) { + int const x_25 = j; + int const x_26 = x_9.one; + if ((x_25 < (3 + x_26))) { + } else { + break; + } + int const x_28 = i; + int const x_29 = j; + S const x_79 = s_1; + param = x_79; + param_1 = (x_28 + x_29); + int const x_31 = func_struct_S_i1_2_1_i1_(x_9, &(param), &(param_1)); + int const x_32 = a; + a = (x_32 + x_31); + { + int const x_34 = j; + j = (x_34 + 1); + } + } + { + int const x_36 = i; + i = (x_36 + 1); + } + } + int const x_38 = a; + if ((x_38 == 30)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..7b4e7d47e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.spvasm @@ -0,0 +1,196 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 119 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %S "S" + OpMemberName %S 0 "arr" + OpName %func_struct_S_i1_2_1_i1_ "func_struct_S_i1_2_1_i1_" + OpName %s "s" + OpName %x "x" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %j "j" + OpName %s_1 "s_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %S = OpTypeStruct %_arr_int_uint_2 +%_ptr_Function_S = OpTypePointer Function %S +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpTypeFunction %int %_ptr_Function_S %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_n1 = OpConstant %int -1 + %void = OpTypeVoid + %45 = OpTypeFunction %void + %50 = OpConstantNull %int + %54 = OpConstantNull %S + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_30 = OpConstant %int 30 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %105 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %106 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %107 = OpTypeFunction %void %main_out +%func_struct_S_i1_2_1_i1_ = OpFunction %int None %12 + %s = OpFunctionParameter %_ptr_Function_S + %x = OpFunctionParameter %_ptr_Function_int + %22 = OpLabel + %24 = OpLoad %int %x + %28 = OpAccessChain %_ptr_Function_int %s %uint_0 %int_1 + %29 = OpIAdd %int %24 %int_1 + OpStore %28 %29 + %31 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %32 = OpLoad %int %31 + %34 = OpAccessChain %_ptr_Function_int %s %uint_0 %32 + %35 = OpLoad %int %34 + %37 = OpLoad %int %x + %38 = OpIEqual %bool %35 %37 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %40 + %41 = OpLabel + OpReturnValue %int_n1 + %40 = OpLabel + %44 = OpLoad %int %x + OpReturnValue %44 + OpFunctionEnd + %main_1 = OpFunction %void None %45 + %48 = OpLabel + %a = OpVariable %_ptr_Function_int Function %50 + %i = OpVariable %_ptr_Function_int Function %50 + %j = OpVariable %_ptr_Function_int Function %50 + %s_1 = OpVariable %_ptr_Function_S Function %54 + %param = OpVariable %_ptr_Function_S Function %54 + %param_1 = OpVariable %_ptr_Function_int Function %50 + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %62 = OpLoad %int %i + %63 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %64 = OpLoad %int %63 + %66 = OpIAdd %int %int_2 %64 + %67 = OpSLessThan %bool %62 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %59 + %68 = OpLabel + OpStore %j %int_0 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %int %j + %76 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %77 = OpLoad %int %76 + %79 = OpIAdd %int %int_3 %77 + %80 = OpSLessThan %bool %75 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %72 + %81 = OpLabel + %84 = OpLoad %int %i + %85 = OpLoad %int %j + %86 = OpLoad %S %s_1 + OpStore %param %86 + %87 = OpIAdd %int %84 %85 + OpStore %param_1 %87 + %88 = OpFunctionCall %int %func_struct_S_i1_2_1_i1_ %param %param_1 + %91 = OpLoad %int %a + %92 = OpIAdd %int %91 %88 + OpStore %a %92 + OpBranch %73 + %73 = OpLabel + %93 = OpLoad %int %j + %94 = OpIAdd %int %93 %int_1 + OpStore %j %94 + OpBranch %71 + %72 = OpLabel + OpBranch %60 + %60 = OpLabel + %95 = OpLoad %int %i + %96 = OpIAdd %int %95 %int_1 + OpStore %i %96 + OpBranch %58 + %59 = OpLabel + %97 = OpLoad %int %a + %99 = OpIEqual %bool %97 %int_30 + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %102 + %101 = OpLabel + OpStore %x_GLF_color %105 + OpBranch %100 + %102 = OpLabel + OpStore %x_GLF_color %106 + OpBranch %100 + %100 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %107 +%tint_symbol = OpFunctionParameter %main_out + %111 = OpLabel + %112 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %112 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %45 + %114 = OpLabel + %115 = OpFunctionCall %void %main_1 + %117 = OpLoad %v4float %x_GLF_color + %118 = OpCompositeConstruct %main_out %117 + %116 = OpFunctionCall %void %tint_symbol_2 %118 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ddc01d1a68 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-unused-struct/0-opt.wgsl.expected.wgsl @@ -0,0 +1,89 @@ +struct S { + arr : array; +}; + +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i1_2_1_i1_(s : ptr, x : ptr) -> i32 { + let x_16 : i32 = *(x); + (*(s)).arr[1] = (x_16 + 1); + let x_18 : i32 = x_9.one; + let x_19 : i32 = (*(s)).arr[x_18]; + let x_20 : i32 = *(x); + if ((x_19 == x_20)) { + return -1; + } + let x_21 : i32 = *(x); + return x_21; +} + +fn main_1() { + var a : i32; + var i : i32; + var j : i32; + var s_1 : S; + var param : S; + var param_1 : i32; + a = 0; + i = 0; + loop { + let x_22 : i32 = i; + let x_23 : i32 = x_9.one; + if ((x_22 < (2 + x_23))) { + } else { + break; + } + j = 0; + loop { + let x_25 : i32 = j; + let x_26 : i32 = x_9.one; + if ((x_25 < (3 + x_26))) { + } else { + break; + } + let x_28 : i32 = i; + let x_29 : i32 = j; + let x_79 : S = s_1; + param = x_79; + param_1 = (x_28 + x_29); + let x_31 : i32 = func_struct_S_i1_2_1_i1_(&(param), &(param_1)); + let x_32 : i32 = a; + a = (x_32 + x_31); + + continuing { + let x_34 : i32 = j; + j = (x_34 + 1); + } + } + + continuing { + let x_36 : i32 = i; + i = (x_36 + 1); + } + } + let x_38 : i32 = a; + if ((x_38 == 30)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm new file mode 100644 index 0000000000..4e856bfe85 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm @@ -0,0 +1,106 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %v "v" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "zero" + OpName %__0 "" + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %16 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool +%_ptr_Function_v4float = OpTypePointer Function %v4float + %buf1 = OpTypeStruct %int +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %11 + %33 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %v = OpVariable %_ptr_Function_v4float Function + OpStore %_GLF_color %16 + OpStore %i %int_0 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %40 = OpLoad %int %39 + %41 = OpSLessThan %bool %38 %40 + OpBranchConditional %41 %42 %35 + %42 = OpLabel + OpBranch %43 + %43 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %48 = OpLoad %int %47 + %49 = OpIEqual %bool %48 %int_1 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpStore %_GLF_color %25 + OpBranch %50 + %50 = OpLabel + OpBranch %45 + %45 = OpLabel + OpBranchConditional %false %43 %44 + %44 = OpLabel + OpBranch %36 + %36 = OpLabel + %52 = OpLoad %int %i + %53 = OpIAdd %int %52 %int_1 + OpStore %i %53 + OpBranch %34 + %35 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpAccessChain %_ptr_Function_float %v %uint_1 + OpStore %57 %56 + %58 = OpAccessChain %_ptr_Function_float %v %uint_1 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_1 + OpStore %60 %59 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3cc04e2a57 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.hlsl @@ -0,0 +1,56 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[1]; +}; + +void main_1() { + int i = 0; + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + while (true) { + const int x_38 = i; + const int x_40 = asint(x_6[0].x); + if ((x_38 < x_40)) { + } else { + break; + } + while (true) { + const int x_48 = asint(x_6[0].x); + if ((x_48 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + { + if (false) { + } else { + break; + } + } + } + { + i = (i + 1); + } + } + const int x_55 = asint(x_9[0].x); + v.y = float(x_55); + const float x_59 = v.y; + x_GLF_color.y = x_59; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..5e8b3f948a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.msl @@ -0,0 +1,60 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct buf1 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + int i = 0; + float4 v = 0.0f; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + while (true) { + int const x_38 = i; + int const x_40 = x_6.one; + if ((x_38 < x_40)) { + } else { + break; + } + while (true) { + int const x_48 = x_6.one; + if ((x_48 == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + { + if (false) { + } else { + break; + } + } + } + { + int const x_52 = i; + i = (x_52 + 1); + } + } + int const x_55 = x_9.zero; + v.y = float(x_55); + float const x_59 = v.y; + (*(tint_symbol_4)).y = x_59; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..527ce2e994 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.spvasm @@ -0,0 +1,157 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 82 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "zero" + OpName %x_9 "x_9" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %buf1 = OpTypeStruct %int +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %53 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %70 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %v = OpVariable %_ptr_Function_v4float Function %5 + OpStore %x_GLF_color %25 + OpStore %i %int_0 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %int %i + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %36 = OpLoad %int %35 + %37 = OpSLessThan %bool %31 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %28 + %39 = OpLabel + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %47 = OpLoad %int %46 + %49 = OpIEqual %bool %47 %int_1 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpStore %x_GLF_color %53 + OpBranch %50 + %50 = OpLabel + OpBranch %44 + %44 = OpLabel + OpSelectionMerge %55 None + OpBranchConditional %false %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %43 + %55 = OpLabel + OpBranch %42 + %43 = OpLabel + OpBranch %29 + %29 = OpLabel + %58 = OpLoad %int %i + %59 = OpIAdd %int %58 %int_1 + OpStore %i %59 + OpBranch %27 + %28 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %61 = OpLoad %int %60 + %64 = OpAccessChain %_ptr_Function_float %v %uint_1 + %65 = OpConvertSToF %float %61 + OpStore %64 %65 + %66 = OpAccessChain %_ptr_Function_float %v %uint_1 + %67 = OpLoad %float %66 + %69 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + OpStore %69 %67 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %70 +%tint_symbol = OpFunctionParameter %main_out + %74 = OpLabel + %75 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %75 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %77 = OpLabel + %78 = OpFunctionCall %void %main_1 + %80 = OpLoad %v4float %x_GLF_color + %81 = OpCompositeConstruct %main_out %80 + %79 = OpFunctionCall %void %tint_symbol_2 %81 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 44[%44] is not post dominated by the back-edge block 55[%55] + %55 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..19c07806ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.spvasm.expected.wgsl @@ -0,0 +1,64 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[block]] +struct buf1 { + zero : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +fn main_1() { + var i : i32; + var v : vec4; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + i = 0; + loop { + let x_38 : i32 = i; + let x_40 : i32 = x_6.one; + if ((x_38 < x_40)) { + } else { + break; + } + loop { + let x_48 : i32 = x_6.one; + if ((x_48 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + + continuing { + if (false) { + } else { + break; + } + } + } + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_55 : i32 = x_9.zero; + v.y = f32(x_55); + let x_59 : f32 = v.y; + x_GLF_color.y = x_59; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl new file mode 100644 index 0000000000..19c07806ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl @@ -0,0 +1,64 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[block]] +struct buf1 { + zero : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +fn main_1() { + var i : i32; + var v : vec4; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + i = 0; + loop { + let x_38 : i32 = i; + let x_40 : i32 = x_6.one; + if ((x_38 < x_40)) { + } else { + break; + } + loop { + let x_48 : i32 = x_6.one; + if ((x_48 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + + continuing { + if (false) { + } else { + break; + } + } + } + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_55 : i32 = x_9.zero; + v.y = f32(x_55); + let x_59 : f32 = v.y; + x_GLF_color.y = x_59; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3cc04e2a57 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.hlsl @@ -0,0 +1,56 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[1]; +}; + +void main_1() { + int i = 0; + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + while (true) { + const int x_38 = i; + const int x_40 = asint(x_6[0].x); + if ((x_38 < x_40)) { + } else { + break; + } + while (true) { + const int x_48 = asint(x_6[0].x); + if ((x_48 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + { + if (false) { + } else { + break; + } + } + } + { + i = (i + 1); + } + } + const int x_55 = asint(x_9[0].x); + v.y = float(x_55); + const float x_59 = v.y; + x_GLF_color.y = x_59; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..5e8b3f948a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.msl @@ -0,0 +1,60 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct buf1 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_4) { + int i = 0; + float4 v = 0.0f; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + while (true) { + int const x_38 = i; + int const x_40 = x_6.one; + if ((x_38 < x_40)) { + } else { + break; + } + while (true) { + int const x_48 = x_6.one; + if ((x_48 == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + { + if (false) { + } else { + break; + } + } + } + { + int const x_52 = i; + i = (x_52 + 1); + } + } + int const x_55 = x_9.zero; + v.y = float(x_55); + float const x_59 = v.y; + (*(tint_symbol_4)).y = x_59; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..527ce2e994 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.spvasm @@ -0,0 +1,157 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 82 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "zero" + OpName %x_9 "x_9" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %buf1 = OpTypeStruct %int +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %53 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %70 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %v = OpVariable %_ptr_Function_v4float Function %5 + OpStore %x_GLF_color %25 + OpStore %i %int_0 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %int %i + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %36 = OpLoad %int %35 + %37 = OpSLessThan %bool %31 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %28 + %39 = OpLabel + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %47 = OpLoad %int %46 + %49 = OpIEqual %bool %47 %int_1 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpStore %x_GLF_color %53 + OpBranch %50 + %50 = OpLabel + OpBranch %44 + %44 = OpLabel + OpSelectionMerge %55 None + OpBranchConditional %false %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %43 + %55 = OpLabel + OpBranch %42 + %43 = OpLabel + OpBranch %29 + %29 = OpLabel + %58 = OpLoad %int %i + %59 = OpIAdd %int %58 %int_1 + OpStore %i %59 + OpBranch %27 + %28 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %61 = OpLoad %int %60 + %64 = OpAccessChain %_ptr_Function_float %v %uint_1 + %65 = OpConvertSToF %float %61 + OpStore %64 %65 + %66 = OpAccessChain %_ptr_Function_float %v %uint_1 + %67 = OpLoad %float %66 + %69 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + OpStore %69 %67 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %70 +%tint_symbol = OpFunctionParameter %main_out + %74 = OpLabel + %75 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %75 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %77 = OpLabel + %78 = OpFunctionCall %void %main_1 + %80 = OpLoad %v4float %x_GLF_color + %81 = OpCompositeConstruct %main_out %80 + %79 = OpFunctionCall %void %tint_symbol_2 %81 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 44[%44] is not post dominated by the back-edge block 55[%55] + %55 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..19c07806ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplification-while-inside-for/0-opt.wgsl.expected.wgsl @@ -0,0 +1,64 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[block]] +struct buf1 { + zero : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +fn main_1() { + var i : i32; + var v : vec4; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + i = 0; + loop { + let x_38 : i32 = i; + let x_40 : i32 = x_6.one; + if ((x_38 < x_40)) { + } else { + break; + } + loop { + let x_48 : i32 = x_6.one; + if ((x_48 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + + continuing { + if (false) { + } else { + break; + } + } + } + + continuing { + let x_52 : i32 = i; + i = (x_52 + 1); + } + } + let x_55 : i32 = x_9.zero; + v.y = f32(x_55); + let x_59 : f32 = v.y; + x_GLF_color.y = x_59; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm new file mode 100644 index 0000000000..2eb7b2e84a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm @@ -0,0 +1,121 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "sequence" + OpName %_ "" + OpName %sum "sum" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %int_0 = OpConstant %int 0 + %15 = OpConstantComposite %v4int %int_0 %int_0 %int_0 %int_0 +%_ptr_Function_int = OpTypePointer Function %int + %buf0 = OpTypeStruct %v4int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_10 = OpConstant %int 10 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %10 + %35 = OpLabel + %a = OpVariable %_ptr_Function_v4int Function + %i = OpVariable %_ptr_Function_int Function + %sum = OpVariable %_ptr_Function_int Function + OpStore %a %15 + OpStore %i %int_0 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %i + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %uint_3 + %42 = OpLoad %int %41 + %43 = OpIAdd %int %42 %int_1 + %44 = OpSLessThan %bool %40 %43 + OpBranchConditional %44 %45 %37 + %45 = OpLabel + %46 = OpLoad %int %i + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %uint_0 + %48 = OpLoad %int %47 + %49 = OpLoad %int %i + %50 = OpExtInst %int %1 SClamp %46 %48 %49 + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %50 + %52 = OpLoad %int %51 + %53 = OpIEqual %bool %52 %int_1 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + %57 = OpLoad %int %i + %58 = OpAccessChain %_ptr_Function_int %a %57 + OpStore %58 %int_5 + OpBranch %54 + %56 = OpLabel + %59 = OpLoad %int %i + %60 = OpLoad %int %i + %61 = OpAccessChain %_ptr_Function_int %a %59 + OpStore %61 %60 + OpBranch %54 + %54 = OpLabel + OpBranch %38 + %38 = OpLabel + %62 = OpLoad %int %i + %63 = OpIAdd %int %62 %int_1 + OpStore %i %63 + OpBranch %36 + %37 = OpLabel + %64 = OpAccessChain %_ptr_Function_int %a %uint_0 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Function_int %a %uint_1 + %67 = OpLoad %int %66 + %68 = OpIAdd %int %65 %67 + %69 = OpAccessChain %_ptr_Function_int %a %uint_2 + %70 = OpLoad %int %69 + %71 = OpIAdd %int %68 %70 + %72 = OpAccessChain %_ptr_Function_int %a %uint_3 + %73 = OpLoad %int %72 + %74 = OpIAdd %int %71 %73 + OpStore %sum %74 + %75 = OpLoad %int %sum + %76 = OpIEqual %bool %75 %int_10 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + OpStore %_GLF_color %33 + OpBranch %77 + %79 = OpLabel + OpStore %_GLF_color %34 + OpBranch %77 + %77 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2e58c08846 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.hlsl @@ -0,0 +1,61 @@ +void set_int4(inout int4 vec, int idx, int val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int4 a = int4(0, 0, 0, 0); + int i = 0; + int sum = 0; + a = int4(0, 0, 0, 0); + i = 0; + while (true) { + const int x_40 = i; + const int x_42 = asint(x_7[0].w); + if ((x_40 < (x_42 + 1))) { + } else { + break; + } + const int x_46 = i; + const int x_48 = asint(x_7[0].x); + const uint scalar_offset = ((4u * uint(clamp(x_46, x_48, i)))) / 4; + const int x_52 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_52 == 1)) { + set_int4(a, i, 5); + } else { + set_int4(a, i, i); + } + { + i = (i + 1); + } + } + const int x_65 = a.x; + const int x_67 = a.y; + const int x_70 = a.z; + const int x_73 = a.w; + sum = (((x_65 + x_67) + x_70) + x_73); + if ((sum == 10)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..beae1ddf4d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.msl @@ -0,0 +1,65 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_int4 sequence; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int4 a = 0; + int i = 0; + int sum = 0; + a = int4(0, 0, 0, 0); + i = 0; + while (true) { + int const x_40 = i; + int const x_42 = x_7.sequence.w; + if ((x_40 < (x_42 + 1))) { + } else { + break; + } + int const x_46 = i; + int const x_48 = x_7.sequence.x; + int const x_49 = i; + int const x_52 = x_7.sequence[clamp(x_46, x_48, x_49)]; + if ((x_52 == 1)) { + int const x_57 = i; + a[x_57] = 5; + } else { + int const x_59 = i; + int const x_60 = i; + a[x_59] = x_60; + } + { + int const x_62 = i; + i = (x_62 + 1); + } + } + int const x_65 = a.x; + int const x_67 = a.y; + int const x_70 = a.z; + int const x_73 = a.w; + sum = (((x_65 + x_67) + x_70) + x_73); + int const x_75 = sum; + if ((x_75 == 10)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..ff2c207a3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.spvasm @@ -0,0 +1,160 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + %49 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "sequence" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %sum "sum" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %buf0 = OpTypeStruct %v4int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %10 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %10 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %25 = OpConstantComposite %v4int %int_0 %int_0 %int_0 %int_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_3 = OpConstant %uint 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_10 = OpConstant %int 10 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %85 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %86 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %87 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + %a = OpVariable %_ptr_Function_v4int Function %19 + %i = OpVariable %_ptr_Function_int Function %22 + %sum = OpVariable %_ptr_Function_int Function %22 + OpStore %a %25 + OpStore %i %int_0 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %i + %35 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %uint_3 + %36 = OpLoad %int %35 + %38 = OpIAdd %int %36 %int_1 + %39 = OpSLessThan %bool %30 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %27 + %41 = OpLabel + %44 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %uint_0 + %46 = OpLoad %int %45 + %47 = OpLoad %int %i + %48 = OpExtInst %int %49 SClamp %44 %46 %47 + %50 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %48 + %51 = OpLoad %int %50 + %52 = OpIEqual %bool %51 %int_1 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + %56 = OpLoad %int %i + %57 = OpAccessChain %_ptr_Function_int %a %56 + OpStore %57 %int_5 + OpBranch %53 + %55 = OpLabel + %59 = OpLoad %int %i + %60 = OpLoad %int %i + %61 = OpAccessChain %_ptr_Function_int %a %59 + OpStore %61 %60 + OpBranch %53 + %53 = OpLabel + OpBranch %28 + %28 = OpLabel + %62 = OpLoad %int %i + %63 = OpIAdd %int %62 %int_1 + OpStore %i %63 + OpBranch %26 + %27 = OpLabel + %64 = OpAccessChain %_ptr_Function_int %a %uint_0 + %65 = OpLoad %int %64 + %67 = OpAccessChain %_ptr_Function_int %a %uint_1 + %68 = OpLoad %int %67 + %70 = OpAccessChain %_ptr_Function_int %a %uint_2 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Function_int %a %uint_3 + %73 = OpLoad %int %72 + %74 = OpIAdd %int %65 %68 + %75 = OpIAdd %int %74 %71 + %76 = OpIAdd %int %75 %73 + OpStore %sum %76 + %77 = OpLoad %int %sum + %79 = OpIEqual %bool %77 %int_10 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + OpStore %x_GLF_color %85 + OpBranch %80 + %82 = OpLabel + OpStore %x_GLF_color %86 + OpBranch %80 + %80 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %87 +%tint_symbol = OpFunctionParameter %main_out + %91 = OpLabel + %92 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %92 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %94 = OpLabel + %95 = OpFunctionCall %void %main_1 + %97 = OpLoad %v4float %x_GLF_color + %98 = OpCompositeConstruct %main_out %97 + %96 = OpFunctionCall %void %tint_symbol_2 %98 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..7e6bd6d8ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.spvasm.expected.wgsl @@ -0,0 +1,64 @@ +[[block]] +struct buf0 { + sequence : vec4; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : vec4; + var i : i32; + var sum : i32; + a = vec4(0, 0, 0, 0); + i = 0; + loop { + let x_40 : i32 = i; + let x_42 : i32 = x_7.sequence.w; + if ((x_40 < (x_42 + 1))) { + } else { + break; + } + let x_46 : i32 = i; + let x_48 : i32 = x_7.sequence.x; + let x_49 : i32 = i; + let x_52 : i32 = x_7.sequence[clamp(x_46, x_48, x_49)]; + if ((x_52 == 1)) { + let x_57 : i32 = i; + a[x_57] = 5; + } else { + let x_59 : i32 = i; + let x_60 : i32 = i; + a[x_59] = x_60; + } + + continuing { + let x_62 : i32 = i; + i = (x_62 + 1); + } + } + let x_65 : i32 = a.x; + let x_67 : i32 = a.y; + let x_70 : i32 = a.z; + let x_73 : i32 = a.w; + sum = (((x_65 + x_67) + x_70) + x_73); + let x_75 : i32 = sum; + if ((x_75 == 10)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl new file mode 100644 index 0000000000..7e6bd6d8ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl @@ -0,0 +1,64 @@ +[[block]] +struct buf0 { + sequence : vec4; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : vec4; + var i : i32; + var sum : i32; + a = vec4(0, 0, 0, 0); + i = 0; + loop { + let x_40 : i32 = i; + let x_42 : i32 = x_7.sequence.w; + if ((x_40 < (x_42 + 1))) { + } else { + break; + } + let x_46 : i32 = i; + let x_48 : i32 = x_7.sequence.x; + let x_49 : i32 = i; + let x_52 : i32 = x_7.sequence[clamp(x_46, x_48, x_49)]; + if ((x_52 == 1)) { + let x_57 : i32 = i; + a[x_57] = 5; + } else { + let x_59 : i32 = i; + let x_60 : i32 = i; + a[x_59] = x_60; + } + + continuing { + let x_62 : i32 = i; + i = (x_62 + 1); + } + } + let x_65 : i32 = a.x; + let x_67 : i32 = a.y; + let x_70 : i32 = a.z; + let x_73 : i32 = a.w; + sum = (((x_65 + x_67) + x_70) + x_73); + let x_75 : i32 = sum; + if ((x_75 == 10)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2e58c08846 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.hlsl @@ -0,0 +1,61 @@ +void set_int4(inout int4 vec, int idx, int val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int4 a = int4(0, 0, 0, 0); + int i = 0; + int sum = 0; + a = int4(0, 0, 0, 0); + i = 0; + while (true) { + const int x_40 = i; + const int x_42 = asint(x_7[0].w); + if ((x_40 < (x_42 + 1))) { + } else { + break; + } + const int x_46 = i; + const int x_48 = asint(x_7[0].x); + const uint scalar_offset = ((4u * uint(clamp(x_46, x_48, i)))) / 4; + const int x_52 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_52 == 1)) { + set_int4(a, i, 5); + } else { + set_int4(a, i, i); + } + { + i = (i + 1); + } + } + const int x_65 = a.x; + const int x_67 = a.y; + const int x_70 = a.z; + const int x_73 = a.w; + sum = (((x_65 + x_67) + x_70) + x_73); + if ((sum == 10)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..beae1ddf4d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.msl @@ -0,0 +1,65 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_int4 sequence; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int4 a = 0; + int i = 0; + int sum = 0; + a = int4(0, 0, 0, 0); + i = 0; + while (true) { + int const x_40 = i; + int const x_42 = x_7.sequence.w; + if ((x_40 < (x_42 + 1))) { + } else { + break; + } + int const x_46 = i; + int const x_48 = x_7.sequence.x; + int const x_49 = i; + int const x_52 = x_7.sequence[clamp(x_46, x_48, x_49)]; + if ((x_52 == 1)) { + int const x_57 = i; + a[x_57] = 5; + } else { + int const x_59 = i; + int const x_60 = i; + a[x_59] = x_60; + } + { + int const x_62 = i; + i = (x_62 + 1); + } + } + int const x_65 = a.x; + int const x_67 = a.y; + int const x_70 = a.z; + int const x_73 = a.w; + sum = (((x_65 + x_67) + x_70) + x_73); + int const x_75 = sum; + if ((x_75 == 10)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..ff2c207a3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.spvasm @@ -0,0 +1,160 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 99 +; Schema: 0 + OpCapability Shader + %49 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "sequence" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %sum "sum" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %buf0 = OpTypeStruct %v4int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %10 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %10 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%_ptr_Function_v4int = OpTypePointer Function %v4int + %19 = OpConstantNull %v4int +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %25 = OpConstantComposite %v4int %int_0 %int_0 %int_0 %int_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_3 = OpConstant %uint 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_10 = OpConstant %int 10 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %85 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %86 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %87 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + %a = OpVariable %_ptr_Function_v4int Function %19 + %i = OpVariable %_ptr_Function_int Function %22 + %sum = OpVariable %_ptr_Function_int Function %22 + OpStore %a %25 + OpStore %i %int_0 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %i + %35 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %uint_3 + %36 = OpLoad %int %35 + %38 = OpIAdd %int %36 %int_1 + %39 = OpSLessThan %bool %30 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %27 + %41 = OpLabel + %44 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %uint_0 + %46 = OpLoad %int %45 + %47 = OpLoad %int %i + %48 = OpExtInst %int %49 SClamp %44 %46 %47 + %50 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %48 + %51 = OpLoad %int %50 + %52 = OpIEqual %bool %51 %int_1 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + %56 = OpLoad %int %i + %57 = OpAccessChain %_ptr_Function_int %a %56 + OpStore %57 %int_5 + OpBranch %53 + %55 = OpLabel + %59 = OpLoad %int %i + %60 = OpLoad %int %i + %61 = OpAccessChain %_ptr_Function_int %a %59 + OpStore %61 %60 + OpBranch %53 + %53 = OpLabel + OpBranch %28 + %28 = OpLabel + %62 = OpLoad %int %i + %63 = OpIAdd %int %62 %int_1 + OpStore %i %63 + OpBranch %26 + %27 = OpLabel + %64 = OpAccessChain %_ptr_Function_int %a %uint_0 + %65 = OpLoad %int %64 + %67 = OpAccessChain %_ptr_Function_int %a %uint_1 + %68 = OpLoad %int %67 + %70 = OpAccessChain %_ptr_Function_int %a %uint_2 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Function_int %a %uint_3 + %73 = OpLoad %int %72 + %74 = OpIAdd %int %65 %68 + %75 = OpIAdd %int %74 %71 + %76 = OpIAdd %int %75 %73 + OpStore %sum %76 + %77 = OpLoad %int %sum + %79 = OpIEqual %bool %77 %int_10 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + OpStore %x_GLF_color %85 + OpBranch %80 + %82 = OpLabel + OpStore %x_GLF_color %86 + OpBranch %80 + %80 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %87 +%tint_symbol = OpFunctionParameter %main_out + %91 = OpLabel + %92 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %92 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %94 = OpLabel + %95 = OpFunctionCall %void %main_1 + %97 = OpLoad %v4float %x_GLF_color + %98 = OpCompositeConstruct %main_out %97 + %96 = OpFunctionCall %void %tint_symbol_2 %98 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..7e6bd6d8ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-clamp-max-itself/0-opt.wgsl.expected.wgsl @@ -0,0 +1,64 @@ +[[block]] +struct buf0 { + sequence : vec4; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : vec4; + var i : i32; + var sum : i32; + a = vec4(0, 0, 0, 0); + i = 0; + loop { + let x_40 : i32 = i; + let x_42 : i32 = x_7.sequence.w; + if ((x_40 < (x_42 + 1))) { + } else { + break; + } + let x_46 : i32 = i; + let x_48 : i32 = x_7.sequence.x; + let x_49 : i32 = i; + let x_52 : i32 = x_7.sequence[clamp(x_46, x_48, x_49)]; + if ((x_52 == 1)) { + let x_57 : i32 = i; + a[x_57] = 5; + } else { + let x_59 : i32 = i; + let x_60 : i32 = i; + a[x_59] = x_60; + } + + continuing { + let x_62 : i32 = i; + i = (x_62 + 1); + } + } + let x_65 : i32 = a.x; + let x_67 : i32 = a.y; + let x_70 : i32 = a.z; + let x_73 : i32 = a.w; + sum = (((x_65 + x_67) + x_70) + x_73); + let x_75 : i32 = sum; + if ((x_75 == 10)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm new file mode 100644 index 0000000000..b6ea806ff2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm @@ -0,0 +1,75 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %9 + %22 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %23 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %24 = OpLoad %int %23 + %25 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %26 = OpLoad %int %25 + %27 = OpExtInst %int %1 SMax %26 %int_1 + %28 = OpExtInst %int %1 SMax %24 %27 + OpStore %a %28 + %29 = OpLoad %int %a + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpIEqual %bool %29 %31 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + %36 = OpLoad %int %a + %37 = OpConvertSToF %float %36 + %38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %39 = OpLoad %int %38 + %40 = OpConvertSToF %float %39 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpConvertSToF %float %42 + %44 = OpLoad %int %a + %45 = OpConvertSToF %float %44 + %46 = OpCompositeConstruct %v4float %37 %40 %43 %45 + OpStore %_GLF_color %46 + OpBranch %33 + %35 = OpLabel + %47 = OpLoad %int %a + %48 = OpConvertSToF %float %47 + %49 = OpCompositeConstruct %v4float %48 %48 %48 %48 + OpStore %_GLF_color %49 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..0503ece41f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.hlsl @@ -0,0 +1,40 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_24 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_26 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + a = max(x_24, max(x_26, 1)); + const int x_29 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_31 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_29 == x_31)) { + const int x_36 = a; + const int x_39 = asint(x_6[1].x); + const int x_42 = asint(x_6[1].x); + x_GLF_color = float4(float(x_36), float(x_39), float(x_42), float(a)); + } else { + const float x_48 = float(a); + x_GLF_color = float4(x_48, x_48, x_48, x_48); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..aedac0ac9f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int const x_24 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_26 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = max(x_24, max(x_26, 1)); + int const x_29 = a; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_29 == x_31)) { + int const x_36 = a; + int const x_39 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_42 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_44 = a; + *(tint_symbol_4) = float4(float(x_36), float(x_39), float(x_42), float(x_44)); + } else { + int const x_47 = a; + float const x_48 = float(x_47); + *(tint_symbol_4) = float4(x_48, x_48, x_48, x_48); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..d91ccbe124 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.spvasm @@ -0,0 +1,109 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %30 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %26 = OpLoad %int %25 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %28 = OpLoad %int %27 + %31 = OpExtInst %int %30 SMax %28 %int_1 + %29 = OpExtInst %int %30 SMax %26 %31 + OpStore %a %29 + %33 = OpLoad %int %a + %34 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %35 = OpLoad %int %34 + %36 = OpIEqual %bool %33 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + %41 = OpLoad %int %a + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpLoad %int %a + %47 = OpConvertSToF %float %41 + %48 = OpConvertSToF %float %43 + %49 = OpConvertSToF %float %45 + %50 = OpConvertSToF %float %46 + %51 = OpCompositeConstruct %v4float %47 %48 %49 %50 + OpStore %x_GLF_color %51 + OpBranch %38 + %40 = OpLabel + %52 = OpLoad %int %a + %53 = OpConvertSToF %float %52 + %54 = OpCompositeConstruct %v4float %53 %53 %53 %53 + OpStore %x_GLF_color %54 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c54d32c735 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.spvasm.expected.wgsl @@ -0,0 +1,42 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_24 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = max(x_24, max(x_26, 1)); + let x_29 : i32 = a; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_29 == x_31)) { + let x_36 : i32 = a; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_42 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_44 : i32 = a; + x_GLF_color = vec4(f32(x_36), f32(x_39), f32(x_42), f32(x_44)); + } else { + let x_47 : i32 = a; + let x_48 : f32 = f32(x_47); + x_GLF_color = vec4(x_48, x_48, x_48, x_48); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl new file mode 100644 index 0000000000..c54d32c735 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl @@ -0,0 +1,42 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_24 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = max(x_24, max(x_26, 1)); + let x_29 : i32 = a; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_29 == x_31)) { + let x_36 : i32 = a; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_42 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_44 : i32 = a; + x_GLF_color = vec4(f32(x_36), f32(x_39), f32(x_42), f32(x_44)); + } else { + let x_47 : i32 = a; + let x_48 : f32 = f32(x_47); + x_GLF_color = vec4(x_48, x_48, x_48, x_48); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..0503ece41f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.hlsl @@ -0,0 +1,40 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_24 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_26 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + a = max(x_24, max(x_26, 1)); + const int x_29 = a; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_31 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_29 == x_31)) { + const int x_36 = a; + const int x_39 = asint(x_6[1].x); + const int x_42 = asint(x_6[1].x); + x_GLF_color = float4(float(x_36), float(x_39), float(x_42), float(a)); + } else { + const float x_48 = float(a); + x_GLF_color = float4(x_48, x_48, x_48, x_48); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..aedac0ac9f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int const x_24 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_26 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = max(x_24, max(x_26, 1)); + int const x_29 = a; + int const x_31 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_29 == x_31)) { + int const x_36 = a; + int const x_39 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_42 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_44 = a; + *(tint_symbol_4) = float4(float(x_36), float(x_39), float(x_42), float(x_44)); + } else { + int const x_47 = a; + float const x_48 = float(x_47); + *(tint_symbol_4) = float4(x_48, x_48, x_48, x_48); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..d91ccbe124 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.spvasm @@ -0,0 +1,109 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + %30 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %25 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %26 = OpLoad %int %25 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %28 = OpLoad %int %27 + %31 = OpExtInst %int %30 SMax %28 %int_1 + %29 = OpExtInst %int %30 SMax %26 %31 + OpStore %a %29 + %33 = OpLoad %int %a + %34 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %35 = OpLoad %int %34 + %36 = OpIEqual %bool %33 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + %41 = OpLoad %int %a + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpLoad %int %a + %47 = OpConvertSToF %float %41 + %48 = OpConvertSToF %float %43 + %49 = OpConvertSToF %float %45 + %50 = OpConvertSToF %float %46 + %51 = OpCompositeConstruct %v4float %47 %48 %49 %50 + OpStore %x_GLF_color %51 + OpBranch %38 + %40 = OpLabel + %52 = OpLoad %int %a + %53 = OpConvertSToF %float %52 + %54 = OpCompositeConstruct %v4float %53 %53 %53 %53 + OpStore %x_GLF_color %54 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c54d32c735 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-combine-compares-max-max-one/0-opt.wgsl.expected.wgsl @@ -0,0 +1,42 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + let x_24 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_26 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = max(x_24, max(x_26, 1)); + let x_29 : i32 = a; + let x_31 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_29 == x_31)) { + let x_36 : i32 = a; + let x_39 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_42 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_44 : i32 = a; + x_GLF_color = vec4(f32(x_36), f32(x_39), f32(x_42), f32(x_44)); + } else { + let x_47 : i32 = a; + let x_48 : f32 = f32(x_47); + x_GLF_color = vec4(x_48, x_48, x_48, x_48); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm new file mode 100644 index 0000000000..d27199d3c3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm @@ -0,0 +1,89 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %r "r" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %21 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4 + %int_10 = OpConstant %int 10 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %28 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %29 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %30 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %r = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpStore %r %int_0 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %int %r + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %37 = OpLoad %int %36 + %38 = OpIMul %int %37 %int_4 + %39 = OpSLessThan %bool %35 %38 + OpBranchConditional %39 %40 %32 + %40 = OpLabel + %41 = OpLoad %int %r + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %43 = OpLoad %int %42 + %44 = OpSDiv %int %41 %43 + %45 = OpVectorExtractDynamic %int %21 %44 + %46 = OpLoad %int %i + %47 = OpIAdd %int %46 %45 + OpStore %i %47 + OpBranch %33 + %33 = OpLabel + %48 = OpLoad %int %r + %49 = OpIAdd %int %48 %int_2 + OpStore %r %49 + OpBranch %31 + %32 = OpLabel + %50 = OpLoad %int %i + %51 = OpIEqual %bool %50 %int_10 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpStore %_GLF_color %28 + OpBranch %52 + %54 = OpLabel + OpStore %_GLF_color %29 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..db9236beba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.hlsl @@ -0,0 +1,45 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int r = 0; + i = 0; + r = 0; + while (true) { + const int x_35 = r; + const int x_37 = asint(x_7[0].x); + if ((x_35 < (x_37 * 4))) { + } else { + break; + } + const int x_41 = r; + const int x_43 = asint(x_7[0].x); + i = (i + int4(1, 2, 3, 4)[(x_41 / x_43)]); + { + r = (r + 2); + } + } + if ((i == 10)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b2f057cafa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.msl @@ -0,0 +1,51 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int two; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int i = 0; + int r = 0; + i = 0; + r = 0; + while (true) { + int const x_35 = r; + int const x_37 = x_7.two; + if ((x_35 < (x_37 * 4))) { + } else { + break; + } + int const x_41 = r; + int const x_43 = x_7.two; + int const x_46 = i; + i = (x_46 + int4(1, 2, 3, 4)[(x_41 / x_43)]); + { + int const x_48 = r; + r = (x_48 + 2); + } + } + int const x_50 = i; + if ((x_50 == 10)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e78b606326 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 74 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %r "r" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %46 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4 + %int_10 = OpConstant %int 10 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %60 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %61 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %62 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %i = OpVariable %_ptr_Function_int Function %18 + %r = OpVariable %_ptr_Function_int Function %18 + OpStore %i %int_0 + OpStore %r %int_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %int %r + %29 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %30 = OpLoad %int %29 + %32 = OpIMul %int %30 %int_4 + %33 = OpSLessThan %bool %25 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %37 + %36 = OpLabel + OpBranch %35 + %37 = OpLabel + OpBranch %22 + %35 = OpLabel + %38 = OpLoad %int %r + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %40 = OpLoad %int %39 + %41 = OpLoad %int %i + %47 = OpSDiv %int %38 %40 + %48 = OpVectorExtractDynamic %int %46 %47 + %49 = OpIAdd %int %41 %48 + OpStore %i %49 + OpBranch %23 + %23 = OpLabel + %50 = OpLoad %int %r + %51 = OpIAdd %int %50 %int_2 + OpStore %r %51 + OpBranch %21 + %22 = OpLabel + %52 = OpLoad %int %i + %54 = OpIEqual %bool %52 %int_10 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpStore %x_GLF_color %60 + OpBranch %55 + %57 = OpLabel + OpStore %x_GLF_color %61 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %62 +%tint_symbol = OpFunctionParameter %main_out + %66 = OpLabel + %67 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %67 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %69 = OpLabel + %70 = OpFunctionCall %void %main_1 + %72 = OpLoad %v4float %x_GLF_color + %73 = OpCompositeConstruct %main_out %72 + %71 = OpFunctionCall %void %tint_symbol_2 %73 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a3a1f468fe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.spvasm.expected.wgsl @@ -0,0 +1,50 @@ +[[block]] +struct buf0 { + two : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var r : i32; + i = 0; + r = 0; + loop { + let x_35 : i32 = r; + let x_37 : i32 = x_7.two; + if ((x_35 < (x_37 * 4))) { + } else { + break; + } + let x_41 : i32 = r; + let x_43 : i32 = x_7.two; + let x_46 : i32 = i; + i = (x_46 + vec4(1, 2, 3, 4)[(x_41 / x_43)]); + + continuing { + let x_48 : i32 = r; + r = (x_48 + 2); + } + } + let x_50 : i32 = i; + if ((x_50 == 10)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl new file mode 100644 index 0000000000..a3a1f468fe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl @@ -0,0 +1,50 @@ +[[block]] +struct buf0 { + two : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var r : i32; + i = 0; + r = 0; + loop { + let x_35 : i32 = r; + let x_37 : i32 = x_7.two; + if ((x_35 < (x_37 * 4))) { + } else { + break; + } + let x_41 : i32 = r; + let x_43 : i32 = x_7.two; + let x_46 : i32 = i; + i = (x_46 + vec4(1, 2, 3, 4)[(x_41 / x_43)]); + + continuing { + let x_48 : i32 = r; + r = (x_48 + 2); + } + } + let x_50 : i32 = i; + if ((x_50 == 10)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..db9236beba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.hlsl @@ -0,0 +1,45 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int r = 0; + i = 0; + r = 0; + while (true) { + const int x_35 = r; + const int x_37 = asint(x_7[0].x); + if ((x_35 < (x_37 * 4))) { + } else { + break; + } + const int x_41 = r; + const int x_43 = asint(x_7[0].x); + i = (i + int4(1, 2, 3, 4)[(x_41 / x_43)]); + { + r = (r + 2); + } + } + if ((i == 10)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..b2f057cafa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.msl @@ -0,0 +1,51 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int two; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int i = 0; + int r = 0; + i = 0; + r = 0; + while (true) { + int const x_35 = r; + int const x_37 = x_7.two; + if ((x_35 < (x_37 * 4))) { + } else { + break; + } + int const x_41 = r; + int const x_43 = x_7.two; + int const x_46 = i; + i = (x_46 + int4(1, 2, 3, 4)[(x_41 / x_43)]); + { + int const x_48 = r; + r = (x_48 + 2); + } + } + int const x_50 = i; + if ((x_50 == 10)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e78b606326 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 74 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %r "r" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %46 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4 + %int_10 = OpConstant %int 10 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %60 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %61 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %62 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %i = OpVariable %_ptr_Function_int Function %18 + %r = OpVariable %_ptr_Function_int Function %18 + OpStore %i %int_0 + OpStore %r %int_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %int %r + %29 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %30 = OpLoad %int %29 + %32 = OpIMul %int %30 %int_4 + %33 = OpSLessThan %bool %25 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %37 + %36 = OpLabel + OpBranch %35 + %37 = OpLabel + OpBranch %22 + %35 = OpLabel + %38 = OpLoad %int %r + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %40 = OpLoad %int %39 + %41 = OpLoad %int %i + %47 = OpSDiv %int %38 %40 + %48 = OpVectorExtractDynamic %int %46 %47 + %49 = OpIAdd %int %41 %48 + OpStore %i %49 + OpBranch %23 + %23 = OpLabel + %50 = OpLoad %int %r + %51 = OpIAdd %int %50 %int_2 + OpStore %r %51 + OpBranch %21 + %22 = OpLabel + %52 = OpLoad %int %i + %54 = OpIEqual %bool %52 %int_10 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpStore %x_GLF_color %60 + OpBranch %55 + %57 = OpLabel + OpStore %x_GLF_color %61 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %62 +%tint_symbol = OpFunctionParameter %main_out + %66 = OpLabel + %67 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %67 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %69 = OpLabel + %70 = OpFunctionCall %void %main_1 + %72 = OpLoad %v4float %x_GLF_color + %73 = OpCompositeConstruct %main_out %72 + %71 = OpFunctionCall %void %tint_symbol_2 %73 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a3a1f468fe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-component-uniform-idx/0-opt.wgsl.expected.wgsl @@ -0,0 +1,50 @@ +[[block]] +struct buf0 { + two : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var r : i32; + i = 0; + r = 0; + loop { + let x_35 : i32 = r; + let x_37 : i32 = x_7.two; + if ((x_35 < (x_37 * 4))) { + } else { + break; + } + let x_41 : i32 = r; + let x_43 : i32 = x_7.two; + let x_46 : i32 = i; + i = (x_46 + vec4(1, 2, 3, 4)[(x_41 / x_43)]); + + continuing { + let x_48 : i32 = r; + r = (x_48 + 2); + } + } + let x_50 : i32 = i; + if ((x_50 == 10)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm new file mode 100644 index 0000000000..e0b14a2020 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm @@ -0,0 +1,58 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %buf0 = OpTypeStruct %uint +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %24 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %25 = OpLabel + %a = OpVariable %_ptr_Function_uint Function + %26 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %27 = OpLoad %uint %26 + %28 = OpUDiv %uint %27 %uint_1 + OpStore %a %28 + %29 = OpLoad %uint %a + %30 = OpIEqual %bool %29 %uint_2 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + OpStore %_GLF_color %23 + OpBranch %31 + %33 = OpLabel + OpStore %_GLF_color %24 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ad4b4c8c2d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.hlsl @@ -0,0 +1,30 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + const uint x_27 = x_6[0].x; + a = (x_27 / 1u); + if ((a == 2u)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..34251dc0be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ uint two; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + uint a = 0u; + uint const x_27 = x_6.two; + a = (x_27 / 1u); + uint const x_29 = a; + if ((x_29 == 2u)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..68fb1d7ee9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %uint = OpTypeInt 32 0 + %buf0 = OpTypeStruct %uint +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %34 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %36 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %18 + %21 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %22 = OpLoad %uint %21 + %24 = OpUDiv %uint %22 %uint_1 + OpStore %a %24 + %25 = OpLoad %uint %a + %27 = OpIEqual %bool %25 %uint_2 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpStore %x_GLF_color %34 + OpBranch %29 + %31 = OpLabel + OpStore %x_GLF_color %35 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %36 +%tint_symbol = OpFunctionParameter %main_out + %40 = OpLabel + %41 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %41 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %43 = OpLabel + %44 = OpFunctionCall %void %main_1 + %46 = OpLoad %v4float %x_GLF_color + %47 = OpCompositeConstruct %main_out %46 + %45 = OpFunctionCall %void %tint_symbol_2 %47 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..50c6355fa9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct buf0 { + two : u32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + let x_27 : u32 = x_6.two; + a = (x_27 / 1u); + let x_29 : u32 = a; + if ((x_29 == 2u)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl new file mode 100644 index 0000000000..50c6355fa9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct buf0 { + two : u32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + let x_27 : u32 = x_6.two; + a = (x_27 / 1u); + let x_29 : u32 = a; + if ((x_29 == 2u)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..ad4b4c8c2d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.hlsl @@ -0,0 +1,30 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + uint a = 0u; + const uint x_27 = x_6[0].x; + a = (x_27 / 1u); + if ((a == 2u)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..34251dc0be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ uint two; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + uint a = 0u; + uint const x_27 = x_6.two; + a = (x_27 / 1u); + uint const x_29 = a; + if ((x_29 == 2u)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..68fb1d7ee9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.spvasm @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %uint = OpTypeInt 32 0 + %buf0 = OpTypeStruct %uint +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %18 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %34 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %36 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %18 + %21 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 + %22 = OpLoad %uint %21 + %24 = OpUDiv %uint %22 %uint_1 + OpStore %a %24 + %25 = OpLoad %uint %a + %27 = OpIEqual %bool %25 %uint_2 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpStore %x_GLF_color %34 + OpBranch %29 + %31 = OpLabel + OpStore %x_GLF_color %35 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %36 +%tint_symbol = OpFunctionParameter %main_out + %40 = OpLabel + %41 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %41 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %43 = OpLabel + %44 = OpFunctionCall %void %main_1 + %46 = OpLoad %v4float %x_GLF_color + %47 = OpCompositeConstruct %main_out %46 + %45 = OpFunctionCall %void %tint_symbol_2 %47 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..50c6355fa9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-div-by-uint-one/0-opt.wgsl.expected.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct buf0 { + two : u32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : u32; + let x_27 : u32 = x_6.two; + a = (x_27 / 1u); + let x_29 : u32 = a; + if ((x_29 == 2u)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm new file mode 100644 index 0000000000..00ef50c5b8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm @@ -0,0 +1,106 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %23 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %24 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %25 = OpLoad %int %24 + OpStore %a %25 + %26 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %27 = OpLoad %int %26 + %28 = OpSNegate %int %27 + OpStore %i %28 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %i + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %35 = OpLoad %int %34 + %36 = OpBitwiseOr %int %33 %35 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpSLessThan %bool %36 %38 + OpBranchConditional %39 %40 %30 + %40 = OpLabel + %41 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %43 = OpLoad %int %42 + %44 = OpIMul %int %41 %43 + OpStore %a %44 + OpBranch %31 + %31 = OpLabel + %45 = OpLoad %int %i + %46 = OpIAdd %int %45 %int_1 + OpStore %i %46 + OpBranch %29 + %30 = OpLabel + %47 = OpLoad %int %a + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpSNegate %int %49 + %51 = OpIEqual %bool %47 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpConvertSToF %float %56 + %58 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpCompositeConstruct %v4float %57 %60 %63 %66 + OpStore %_GLF_color %67 + OpBranch %52 + %54 = OpLabel + %68 = OpLoad %int %a + %69 = OpConvertSToF %float %68 + %70 = OpCompositeConstruct %v4float %69 %69 %69 %69 + OpStore %_GLF_color %70 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..910242d734 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.hlsl @@ -0,0 +1,62 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const int x_25 = asint(x_6[1].x); + a = x_25; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_27 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + i = -(x_27); + while (true) { + const int x_33 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_35 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if (((x_33 | x_35) < x_38)) { + } else { + break; + } + const int x_41 = i; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_43 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + a = (x_41 * x_43); + { + i = (i + 1); + } + } + const int x_47 = a; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_47 == -(x_49))) { + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_59 = asint(x_6[1].x); + const int x_62 = asint(x_6[1].x); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_65 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); + x_GLF_color = float4(float(x_56), float(x_59), float(x_62), float(x_65)); + } else { + const float x_69 = float(a); + x_GLF_color = float4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..1ec287cefd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.msl @@ -0,0 +1,67 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_25; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[0].el; + i = -(x_27); + while (true) { + int const x_33 = i; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + if (((x_33 | x_35) < x_38)) { + } else { + break; + } + int const x_41 = i; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = (x_41 * x_43); + { + int const x_45 = i; + i = (x_45 + 1); + } + } + int const x_47 = a; + int const x_49 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_47 == -(x_49))) { + int const x_56 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_59 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_56), float(x_59), float(x_62), float(x_65)); + } else { + int const x_68 = a; + float const x_69 = float(x_68); + *(tint_symbol_4) = float4(x_69, x_69, x_69, x_69); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..fb9d73a2da --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + OpStore %a %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %30 = OpLoad %int %29 + %31 = OpSNegate %int %30 + OpStore %i %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %40 = OpLoad %int %39 + %41 = OpBitwiseOr %int %36 %38 + %42 = OpSLessThan %bool %41 %40 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %33 + %44 = OpLabel + %47 = OpLoad %int %i + %48 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpIMul %int %47 %49 + OpStore %a %50 + OpBranch %34 + %34 = OpLabel + %51 = OpLoad %int %i + %52 = OpIAdd %int %51 %int_1 + OpStore %i %52 + OpBranch %32 + %33 = OpLabel + %53 = OpLoad %int %a + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpSNegate %int %55 + %57 = OpIEqual %bool %53 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %62 + %70 = OpConvertSToF %float %64 + %71 = OpConvertSToF %float %66 + %72 = OpConvertSToF %float %68 + %73 = OpCompositeConstruct %v4float %69 %70 %71 %72 + OpStore %x_GLF_color %73 + OpBranch %58 + %60 = OpLabel + %74 = OpLoad %int %a + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %x_GLF_color %76 + OpBranch %58 + %58 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %77 +%tint_symbol = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %84 = OpLabel + %85 = OpFunctionCall %void %main_1 + %87 = OpLoad %v4float %x_GLF_color + %88 = OpCompositeConstruct %main_out %87 + %86 = OpFunctionCall %void %tint_symbol_2 %88 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..0f3c2eb675 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.spvasm.expected.wgsl @@ -0,0 +1,61 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_25; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[0]; + i = -(x_27); + loop { + let x_33 : i32 = i; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + if (((x_33 | x_35) < x_38)) { + } else { + break; + } + let x_41 : i32 = i; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = (x_41 * x_43); + + continuing { + let x_45 : i32 = i; + i = (x_45 + 1); + } + } + let x_47 : i32 = a; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_47 == -(x_49))) { + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_56), f32(x_59), f32(x_62), f32(x_65)); + } else { + let x_68 : i32 = a; + let x_69 : f32 = f32(x_68); + x_GLF_color = vec4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl new file mode 100644 index 0000000000..0f3c2eb675 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl @@ -0,0 +1,61 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_25; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[0]; + i = -(x_27); + loop { + let x_33 : i32 = i; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + if (((x_33 | x_35) < x_38)) { + } else { + break; + } + let x_41 : i32 = i; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = (x_41 * x_43); + + continuing { + let x_45 : i32 = i; + i = (x_45 + 1); + } + } + let x_47 : i32 = a; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_47 == -(x_49))) { + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_56), f32(x_59), f32(x_62), f32(x_65)); + } else { + let x_68 : i32 = a; + let x_69 : f32 = f32(x_68); + x_GLF_color = vec4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..910242d734 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.hlsl @@ -0,0 +1,62 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const int x_25 = asint(x_6[1].x); + a = x_25; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_27 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + i = -(x_27); + while (true) { + const int x_33 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_35 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_38 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if (((x_33 | x_35) < x_38)) { + } else { + break; + } + const int x_41 = i; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_43 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + a = (x_41 * x_43); + { + i = (i + 1); + } + } + const int x_47 = a; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + if ((x_47 == -(x_49))) { + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_59 = asint(x_6[1].x); + const int x_62 = asint(x_6[1].x); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_65 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); + x_GLF_color = float4(float(x_56), float(x_59), float(x_62), float(x_65)); + } else { + const float x_69 = float(a); + x_GLF_color = float4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..1ec287cefd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.msl @@ -0,0 +1,67 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int const x_25 = x_6.x_GLF_uniform_int_values.arr[1].el; + a = x_25; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[0].el; + i = -(x_27); + while (true) { + int const x_33 = i; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_38 = x_6.x_GLF_uniform_int_values.arr[0].el; + if (((x_33 | x_35) < x_38)) { + } else { + break; + } + int const x_41 = i; + int const x_43 = x_6.x_GLF_uniform_int_values.arr[0].el; + a = (x_41 * x_43); + { + int const x_45 = i; + i = (x_45 + 1); + } + } + int const x_47 = a; + int const x_49 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_47 == -(x_49))) { + int const x_56 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_59 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_56), float(x_59), float(x_62), float(x_65)); + } else { + int const x_68 = a; + float const x_69 = float(x_68); + *(tint_symbol_4) = float4(x_69, x_69, x_69, x_69); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..fb9d73a2da --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %27 = OpLoad %int %26 + OpStore %a %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %30 = OpLoad %int %29 + %31 = OpSNegate %int %30 + OpStore %i %31 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %40 = OpLoad %int %39 + %41 = OpBitwiseOr %int %36 %38 + %42 = OpSLessThan %bool %41 %40 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %33 + %44 = OpLabel + %47 = OpLoad %int %i + %48 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %49 = OpLoad %int %48 + %50 = OpIMul %int %47 %49 + OpStore %a %50 + OpBranch %34 + %34 = OpLabel + %51 = OpLoad %int %i + %52 = OpIAdd %int %51 %int_1 + OpStore %i %52 + OpBranch %32 + %33 = OpLabel + %53 = OpLoad %int %a + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpSNegate %int %55 + %57 = OpIEqual %bool %53 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %62 + %70 = OpConvertSToF %float %64 + %71 = OpConvertSToF %float %66 + %72 = OpConvertSToF %float %68 + %73 = OpCompositeConstruct %v4float %69 %70 %71 %72 + OpStore %x_GLF_color %73 + OpBranch %58 + %60 = OpLabel + %74 = OpLoad %int %a + %75 = OpConvertSToF %float %74 + %76 = OpCompositeConstruct %v4float %75 %75 %75 %75 + OpStore %x_GLF_color %76 + OpBranch %58 + %58 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %77 +%tint_symbol = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %84 = OpLabel + %85 = OpFunctionCall %void %main_1 + %87 = OpLoad %v4float %x_GLF_color + %88 = OpCompositeConstruct %main_out %87 + %86 = OpFunctionCall %void %tint_symbol_2 %88 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..0f3c2eb675 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-for-bitwise-condition/0-opt.wgsl.expected.wgsl @@ -0,0 +1,61 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_25 : i32 = x_6.x_GLF_uniform_int_values[1]; + a = x_25; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[0]; + i = -(x_27); + loop { + let x_33 : i32 = i; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_38 : i32 = x_6.x_GLF_uniform_int_values[0]; + if (((x_33 | x_35) < x_38)) { + } else { + break; + } + let x_41 : i32 = i; + let x_43 : i32 = x_6.x_GLF_uniform_int_values[0]; + a = (x_41 * x_43); + + continuing { + let x_45 : i32 = i; + i = (x_45 + 1); + } + } + let x_47 : i32 = a; + let x_49 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_47 == -(x_49))) { + let x_56 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_59 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_56), f32(x_59), f32(x_62), f32(x_65)); + } else { + let x_68 : i32 = a; + let x_69 : f32 = f32(x_68); + x_GLF_color = vec4(x_69, x_69, x_69, x_69); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm new file mode 100644 index 0000000000..f283a14cd1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm @@ -0,0 +1,56 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f "f" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_3 = OpConstant %float 3 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %23 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %24 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %25 = OpLoad %float %24 + %26 = OpExtInst %float %1 Ldexp %25 %int_0 + OpStore %f %26 + %27 = OpLoad %float %f + %28 = OpFOrdEqual %bool %27 %float_3 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %31 + %30 = OpLabel + OpStore %_GLF_color %21 + OpBranch %29 + %31 = OpLabel + OpStore %_GLF_color %22 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f886474fd8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.hlsl @@ -0,0 +1,30 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + const float x_25 = asfloat(x_6[0].x); + f = ldexp(x_25, 0); + if ((f == 3.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..ab479ddd66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + float const x_25 = x_6.three; + f = ldexp(x_25, 0); + float const x_27 = f; + if ((x_27 == 3.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..d6a625f599 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %24 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_3 = OpConstant %float 3 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %37 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %f = OpVariable %_ptr_Function_float Function %17 + %21 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %22 = OpLoad %float %21 + %23 = OpExtInst %float %24 Ldexp %22 %int_0 + OpStore %f %23 + %27 = OpLoad %float %f + %29 = OpFOrdEqual %bool %27 %float_3 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpStore %x_GLF_color %36 + OpBranch %31 + %33 = OpLabel + OpStore %x_GLF_color %37 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %38 +%tint_symbol = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %45 = OpLabel + %46 = OpFunctionCall %void %main_1 + %48 = OpLoad %v4float %x_GLF_color + %49 = OpCompositeConstruct %main_out %48 + %47 = OpFunctionCall %void %tint_symbol_2 %49 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b5a9b3b06a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct buf0 { + three : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + let x_25 : f32 = x_6.three; + f = ldexp(x_25, 0); + let x_27 : f32 = f; + if ((x_27 == 3.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl new file mode 100644 index 0000000000..b5a9b3b06a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct buf0 { + three : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + let x_25 : f32 = x_6.three; + f = ldexp(x_25, 0); + let x_27 : f32 = f; + if ((x_27 == 3.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f886474fd8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.hlsl @@ -0,0 +1,30 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + const float x_25 = asfloat(x_6[0].x); + f = ldexp(x_25, 0); + if ((f == 3.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..ab479ddd66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float f = 0.0f; + float const x_25 = x_6.three; + f = ldexp(x_25, 0); + float const x_27 = f; + if ((x_27 == 3.0f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..d6a625f599 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %24 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_3 = OpConstant %float 3 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %37 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %f = OpVariable %_ptr_Function_float Function %17 + %21 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %22 = OpLoad %float %21 + %23 = OpExtInst %float %24 Ldexp %22 %int_0 + OpStore %f %23 + %27 = OpLoad %float %f + %29 = OpFOrdEqual %bool %27 %float_3 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpStore %x_GLF_color %36 + OpBranch %31 + %33 = OpLabel + OpStore %x_GLF_color %37 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %38 +%tint_symbol = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %45 = OpLabel + %46 = OpFunctionCall %void %main_1 + %48 = OpLoad %v4float %x_GLF_color + %49 = OpCompositeConstruct %main_out %48 + %47 = OpFunctionCall %void %tint_symbol_2 %49 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b5a9b3b06a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-ldexp-exponent-zero/0-opt.wgsl.expected.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct buf0 { + three : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + let x_25 : f32 = x_6.three; + f = ldexp(x_25, 0); + let x_27 : f32 = f; + if ((x_27 == 3.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm new file mode 100644 index 0000000000..b02dd2e695 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm @@ -0,0 +1,162 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %A "A" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 +%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %30 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %10 + %31 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %A = OpVariable %_ptr_Function__arr_int_uint_4 Function + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %33 = OpLoad %int %32 + OpStore %i %33 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %40 = OpLoad %int %39 + %41 = OpSLessThan %bool %38 %40 + OpBranchConditional %41 %42 %35 + %42 = OpLabel + %43 = OpLoad %int %i + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpAccessChain %_ptr_Function_int %A %43 + OpStore %46 %45 + %47 = OpLoad %int %i + %48 = OpIMul %int %int_2 %47 + %49 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %50 = OpLoad %int %49 + %51 = OpIMul %int %int_2 %50 + %52 = OpExtInst %int %1 SMax %48 %51 + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %54 = OpLoad %int %53 + %55 = OpIEqual %bool %52 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + %58 = OpLoad %int %i + %59 = OpAccessChain %_ptr_Function_int %A %58 + OpStore %59 %int_1 + OpBranch %56 + %56 = OpLabel + OpBranch %36 + %36 = OpLabel + %60 = OpLoad %int %i + %61 = OpIAdd %int %60 %int_1 + OpStore %i %61 + OpBranch %34 + %35 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Function_int %A %63 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %67 = OpLoad %int %66 + %68 = OpIEqual %bool %65 %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Function_int %A %72 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %76 = OpLoad %int %75 + %77 = OpIEqual %bool %74 %76 + OpBranch %69 + %69 = OpLabel + %78 = OpPhi %bool %68 %35 %77 %70 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Function_int %A %82 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %86 = OpLoad %int %85 + %87 = OpIEqual %bool %84 %86 + OpBranch %79 + %79 = OpLabel + %88 = OpPhi %bool %78 %69 %87 %80 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + %91 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %92 = OpLoad %int %91 + %93 = OpAccessChain %_ptr_Function_int %A %92 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %96 = OpLoad %int %95 + %97 = OpIEqual %bool %94 %96 + OpBranch %89 + %89 = OpLabel + %98 = OpPhi %bool %88 %79 %97 %90 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %101 + %100 = OpLabel + %102 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %103 = OpLoad %int %102 + %104 = OpConvertSToF %float %103 + %105 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %106 = OpLoad %int %105 + %107 = OpConvertSToF %float %106 + %108 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %109 + %111 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %112 = OpLoad %int %111 + %113 = OpConvertSToF %float %112 + %114 = OpCompositeConstruct %v4float %104 %107 %110 %113 + OpStore %_GLF_color %114 + OpBranch %99 + %101 = OpLabel + OpStore %_GLF_color %30 + OpBranch %99 + %99 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..b79d8c035b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.hlsl @@ -0,0 +1,98 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int A[4] = (int[4])0; + bool x_77 = false; + bool x_87 = false; + bool x_97 = false; + bool x_78_phi = false; + bool x_88_phi = false; + bool x_98_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_33 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + i = x_33; + while (true) { + const int x_38 = i; + const int x_40 = asint(x_6[4].x); + if ((x_38 < x_40)) { + } else { + break; + } + const int x_43 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + A[x_43] = x_45; + const int x_47 = i; + const int x_50 = asint(x_6[3].x); + const int x_54 = asint(x_6[1].x); + if ((max((2 * x_47), (2 * x_50)) == x_54)) { + A[i] = 1; + } + { + i = (i + 1); + } + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_63 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_65 = A[x_63]; + const int x_67 = asint(x_6[3].x); + const bool x_68 = (x_65 == x_67); + x_78_phi = x_68; + if (x_68) { + const int x_72 = asint(x_6[3].x); + const int x_74 = A[x_72]; + const int x_76 = asint(x_6[3].x); + x_77 = (x_74 == x_76); + x_78_phi = x_77; + } + const bool x_78 = x_78_phi; + x_88_phi = x_78; + if (x_78) { + const int x_82 = asint(x_6[1].x); + const int x_84 = A[x_82]; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_86 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_87 = (x_84 == x_86); + x_88_phi = x_87; + } + const bool x_88 = x_88_phi; + x_98_phi = x_88; + if (x_88) { + const int x_92 = asint(x_6[2].x); + const int x_94 = A[x_92]; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_96 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_97 = (x_94 == x_96); + x_98_phi = x_97; + } + if (x_98_phi) { + const int x_103 = asint(x_6[3].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_106 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_109 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const int x_112 = asint(x_6[3].x); + x_GLF_color = float4(float(x_103), float(x_106), float(x_109), float(x_112)); + } else { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a850e67b6b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.msl @@ -0,0 +1,107 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[4]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + tint_array_wrapper_1 A = {}; + bool x_77 = false; + bool x_87 = false; + bool x_97 = false; + bool x_78_phi = false; + bool x_88_phi = false; + bool x_98_phi = false; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[0].el; + i = x_33; + while (true) { + int const x_38 = i; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[4].el; + if ((x_38 < x_40)) { + } else { + break; + } + int const x_43 = i; + int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el; + A.arr[x_43] = x_45; + int const x_47 = i; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_54 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((max((2 * x_47), (2 * x_50)) == x_54)) { + int const x_58 = i; + A.arr[x_58] = 1; + } + { + int const x_60 = i; + i = (x_60 + 1); + } + } + int const x_63 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_65 = A.arr[x_63]; + int const x_67 = x_6.x_GLF_uniform_int_values.arr[3].el; + bool const x_68 = (x_65 == x_67); + x_78_phi = x_68; + if (x_68) { + int const x_72 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_74 = A.arr[x_72]; + int const x_76 = x_6.x_GLF_uniform_int_values.arr[3].el; + x_77 = (x_74 == x_76); + x_78_phi = x_77; + } + bool const x_78 = x_78_phi; + x_88_phi = x_78; + if (x_78) { + int const x_82 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_84 = A.arr[x_82]; + int const x_86 = x_6.x_GLF_uniform_int_values.arr[0].el; + x_87 = (x_84 == x_86); + x_88_phi = x_87; + } + bool const x_88 = x_88_phi; + x_98_phi = x_88; + if (x_88) { + int const x_92 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_94 = A.arr[x_92]; + int const x_96 = x_6.x_GLF_uniform_int_values.arr[0].el; + x_97 = (x_94 == x_96); + x_98_phi = x_97; + } + bool const x_98 = x_98_phi; + if (x_98) { + int const x_103 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_106 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_109 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_112 = x_6.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_4) = float4(float(x_103), float(x_106), float(x_109), float(x_112)); + } else { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..a003ea90b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.spvasm @@ -0,0 +1,229 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 146 +; Schema: 0 + OpCapability Shader + %65 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %A "A" + OpName %x_77 "x_77" + OpName %x_87 "x_87" + OpName %x_97 "x_97" + OpName %x_78_phi "x_78_phi" + OpName %x_88_phi "x_88_phi" + OpName %x_98_phi "x_98_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_4 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 +%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4 + %26 = OpConstantNull %_arr_int_uint_4 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %30 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %133 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %134 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %A = OpVariable %_ptr_Function__arr_int_uint_4 Function %26 + %x_77 = OpVariable %_ptr_Function_bool Function %30 + %x_87 = OpVariable %_ptr_Function_bool Function %30 + %x_97 = OpVariable %_ptr_Function_bool Function %30 + %x_78_phi = OpVariable %_ptr_Function_bool Function %30 + %x_88_phi = OpVariable %_ptr_Function_bool Function %30 + %x_98_phi = OpVariable %_ptr_Function_bool Function %30 + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %40 = OpLoad %int %39 + OpStore %i %40 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %int %i + %47 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %48 = OpLoad %int %47 + %49 = OpSLessThan %bool %45 %48 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %42 + %50 = OpLabel + %53 = OpLoad %int %i + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Function_int %A %53 + OpStore %56 %55 + %57 = OpLoad %int %i + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %60 = OpLoad %int %59 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %63 = OpLoad %int %62 + %67 = OpIMul %int %int_2 %57 + %68 = OpIMul %int %int_2 %60 + %64 = OpExtInst %int %65 SMax %67 %68 + %69 = OpIEqual %bool %64 %63 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpLoad %int %i + %73 = OpAccessChain %_ptr_Function_int %A %72 + OpStore %73 %int_1 + OpBranch %70 + %70 = OpLabel + OpBranch %43 + %43 = OpLabel + %74 = OpLoad %int %i + %75 = OpIAdd %int %74 %int_1 + OpStore %i %75 + OpBranch %41 + %42 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Function_int %A %77 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %81 = OpLoad %int %80 + %82 = OpIEqual %bool %79 %81 + OpStore %x_78_phi %82 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Function_int %A %86 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %90 = OpLoad %int %89 + %91 = OpIEqual %bool %88 %90 + OpStore %x_77 %91 + %92 = OpLoad %bool %x_77 + OpStore %x_78_phi %92 + OpBranch %83 + %83 = OpLabel + %93 = OpLoad %bool %x_78_phi + OpStore %x_88_phi %93 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %94 + %95 = OpLabel + %96 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpAccessChain %_ptr_Function_int %A %97 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %101 = OpLoad %int %100 + %102 = OpIEqual %bool %99 %101 + OpStore %x_87 %102 + %103 = OpLoad %bool %x_87 + OpStore %x_88_phi %103 + OpBranch %94 + %94 = OpLabel + %104 = OpLoad %bool %x_88_phi + OpStore %x_98_phi %104 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %105 + %106 = OpLabel + %107 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %108 = OpLoad %int %107 + %109 = OpAccessChain %_ptr_Function_int %A %108 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %112 = OpLoad %int %111 + %113 = OpIEqual %bool %110 %112 + OpStore %x_97 %113 + %114 = OpLoad %bool %x_97 + OpStore %x_98_phi %114 + OpBranch %105 + %105 = OpLabel + %115 = OpLoad %bool %x_98_phi + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %118 + %117 = OpLabel + %119 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %120 = OpLoad %int %119 + %121 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %122 = OpLoad %int %121 + %123 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %124 = OpLoad %int %123 + %125 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %126 = OpLoad %int %125 + %127 = OpConvertSToF %float %120 + %128 = OpConvertSToF %float %122 + %129 = OpConvertSToF %float %124 + %130 = OpConvertSToF %float %126 + %131 = OpCompositeConstruct %v4float %127 %128 %129 %130 + OpStore %x_GLF_color %131 + OpBranch %116 + %118 = OpLabel + OpStore %x_GLF_color %133 + OpBranch %116 + %116 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %134 +%tint_symbol = OpFunctionParameter %main_out + %138 = OpLabel + %139 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %139 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %141 = OpLabel + %142 = OpFunctionCall %void %main_1 + %144 = OpLoad %v4float %x_GLF_color + %145 = OpCompositeConstruct %main_out %144 + %143 = OpFunctionCall %void %tint_symbol_2 %145 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f4af7a14cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.spvasm.expected.wgsl @@ -0,0 +1,98 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var A : array; + var x_77 : bool; + var x_87 : bool; + var x_97 : bool; + var x_78_phi : bool; + var x_88_phi : bool; + var x_98_phi : bool; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[0]; + i = x_33; + loop { + let x_38 : i32 = i; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_38 < x_40)) { + } else { + break; + } + let x_43 : i32 = i; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + A[x_43] = x_45; + let x_47 : i32 = i; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((max((2 * x_47), (2 * x_50)) == x_54)) { + let x_58 : i32 = i; + A[x_58] = 1; + } + + continuing { + let x_60 : i32 = i; + i = (x_60 + 1); + } + } + let x_63 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_65 : i32 = A[x_63]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_68 : bool = (x_65 == x_67); + x_78_phi = x_68; + if (x_68) { + let x_72 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_74 : i32 = A[x_72]; + let x_76 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_77 = (x_74 == x_76); + x_78_phi = x_77; + } + let x_78 : bool = x_78_phi; + x_88_phi = x_78; + if (x_78) { + let x_82 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_84 : i32 = A[x_82]; + let x_86 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_87 = (x_84 == x_86); + x_88_phi = x_87; + } + let x_88 : bool = x_88_phi; + x_98_phi = x_88; + if (x_88) { + let x_92 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_94 : i32 = A[x_92]; + let x_96 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_97 = (x_94 == x_96); + x_98_phi = x_97; + } + let x_98 : bool = x_98_phi; + if (x_98) { + let x_103 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_106 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_109 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_112 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_103), f32(x_106), f32(x_109), f32(x_112)); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl new file mode 100644 index 0000000000..f4af7a14cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl @@ -0,0 +1,98 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var A : array; + var x_77 : bool; + var x_87 : bool; + var x_97 : bool; + var x_78_phi : bool; + var x_88_phi : bool; + var x_98_phi : bool; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[0]; + i = x_33; + loop { + let x_38 : i32 = i; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_38 < x_40)) { + } else { + break; + } + let x_43 : i32 = i; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + A[x_43] = x_45; + let x_47 : i32 = i; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((max((2 * x_47), (2 * x_50)) == x_54)) { + let x_58 : i32 = i; + A[x_58] = 1; + } + + continuing { + let x_60 : i32 = i; + i = (x_60 + 1); + } + } + let x_63 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_65 : i32 = A[x_63]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_68 : bool = (x_65 == x_67); + x_78_phi = x_68; + if (x_68) { + let x_72 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_74 : i32 = A[x_72]; + let x_76 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_77 = (x_74 == x_76); + x_78_phi = x_77; + } + let x_78 : bool = x_78_phi; + x_88_phi = x_78; + if (x_78) { + let x_82 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_84 : i32 = A[x_82]; + let x_86 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_87 = (x_84 == x_86); + x_88_phi = x_87; + } + let x_88 : bool = x_88_phi; + x_98_phi = x_88; + if (x_88) { + let x_92 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_94 : i32 = A[x_92]; + let x_96 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_97 = (x_94 == x_96); + x_98_phi = x_97; + } + let x_98 : bool = x_98_phi; + if (x_98) { + let x_103 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_106 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_109 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_112 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_103), f32(x_106), f32(x_109), f32(x_112)); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..b79d8c035b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.hlsl @@ -0,0 +1,98 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int A[4] = (int[4])0; + bool x_77 = false; + bool x_87 = false; + bool x_97 = false; + bool x_78_phi = false; + bool x_88_phi = false; + bool x_98_phi = false; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_33 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + i = x_33; + while (true) { + const int x_38 = i; + const int x_40 = asint(x_6[4].x); + if ((x_38 < x_40)) { + } else { + break; + } + const int x_43 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + A[x_43] = x_45; + const int x_47 = i; + const int x_50 = asint(x_6[3].x); + const int x_54 = asint(x_6[1].x); + if ((max((2 * x_47), (2 * x_50)) == x_54)) { + A[i] = 1; + } + { + i = (i + 1); + } + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_63 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_65 = A[x_63]; + const int x_67 = asint(x_6[3].x); + const bool x_68 = (x_65 == x_67); + x_78_phi = x_68; + if (x_68) { + const int x_72 = asint(x_6[3].x); + const int x_74 = A[x_72]; + const int x_76 = asint(x_6[3].x); + x_77 = (x_74 == x_76); + x_78_phi = x_77; + } + const bool x_78 = x_78_phi; + x_88_phi = x_78; + if (x_78) { + const int x_82 = asint(x_6[1].x); + const int x_84 = A[x_82]; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_86 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_87 = (x_84 == x_86); + x_88_phi = x_87; + } + const bool x_88 = x_88_phi; + x_98_phi = x_88; + if (x_88) { + const int x_92 = asint(x_6[2].x); + const int x_94 = A[x_92]; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_96 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_97 = (x_94 == x_96); + x_98_phi = x_97; + } + if (x_98_phi) { + const int x_103 = asint(x_6[3].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_106 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_109 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const int x_112 = asint(x_6[3].x); + x_GLF_color = float4(float(x_103), float(x_106), float(x_109), float(x_112)); + } else { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a850e67b6b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.msl @@ -0,0 +1,107 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[4]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + tint_array_wrapper_1 A = {}; + bool x_77 = false; + bool x_87 = false; + bool x_97 = false; + bool x_78_phi = false; + bool x_88_phi = false; + bool x_98_phi = false; + int const x_33 = x_6.x_GLF_uniform_int_values.arr[0].el; + i = x_33; + while (true) { + int const x_38 = i; + int const x_40 = x_6.x_GLF_uniform_int_values.arr[4].el; + if ((x_38 < x_40)) { + } else { + break; + } + int const x_43 = i; + int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el; + A.arr[x_43] = x_45; + int const x_47 = i; + int const x_50 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_54 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((max((2 * x_47), (2 * x_50)) == x_54)) { + int const x_58 = i; + A.arr[x_58] = 1; + } + { + int const x_60 = i; + i = (x_60 + 1); + } + } + int const x_63 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_65 = A.arr[x_63]; + int const x_67 = x_6.x_GLF_uniform_int_values.arr[3].el; + bool const x_68 = (x_65 == x_67); + x_78_phi = x_68; + if (x_68) { + int const x_72 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_74 = A.arr[x_72]; + int const x_76 = x_6.x_GLF_uniform_int_values.arr[3].el; + x_77 = (x_74 == x_76); + x_78_phi = x_77; + } + bool const x_78 = x_78_phi; + x_88_phi = x_78; + if (x_78) { + int const x_82 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_84 = A.arr[x_82]; + int const x_86 = x_6.x_GLF_uniform_int_values.arr[0].el; + x_87 = (x_84 == x_86); + x_88_phi = x_87; + } + bool const x_88 = x_88_phi; + x_98_phi = x_88; + if (x_88) { + int const x_92 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_94 = A.arr[x_92]; + int const x_96 = x_6.x_GLF_uniform_int_values.arr[0].el; + x_97 = (x_94 == x_96); + x_98_phi = x_97; + } + bool const x_98 = x_98_phi; + if (x_98) { + int const x_103 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_106 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_109 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_112 = x_6.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_4) = float4(float(x_103), float(x_106), float(x_109), float(x_112)); + } else { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..a003ea90b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.spvasm @@ -0,0 +1,229 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 146 +; Schema: 0 + OpCapability Shader + %65 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %A "A" + OpName %x_77 "x_77" + OpName %x_87 "x_87" + OpName %x_97 "x_97" + OpName %x_78_phi "x_78_phi" + OpName %x_88_phi "x_88_phi" + OpName %x_98_phi "x_98_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_4 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 +%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4 + %26 = OpConstantNull %_arr_int_uint_4 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %30 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %133 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %134 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %A = OpVariable %_ptr_Function__arr_int_uint_4 Function %26 + %x_77 = OpVariable %_ptr_Function_bool Function %30 + %x_87 = OpVariable %_ptr_Function_bool Function %30 + %x_97 = OpVariable %_ptr_Function_bool Function %30 + %x_78_phi = OpVariable %_ptr_Function_bool Function %30 + %x_88_phi = OpVariable %_ptr_Function_bool Function %30 + %x_98_phi = OpVariable %_ptr_Function_bool Function %30 + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %40 = OpLoad %int %39 + OpStore %i %40 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %int %i + %47 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %48 = OpLoad %int %47 + %49 = OpSLessThan %bool %45 %48 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %42 + %50 = OpLabel + %53 = OpLoad %int %i + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Function_int %A %53 + OpStore %56 %55 + %57 = OpLoad %int %i + %59 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %60 = OpLoad %int %59 + %62 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %63 = OpLoad %int %62 + %67 = OpIMul %int %int_2 %57 + %68 = OpIMul %int %int_2 %60 + %64 = OpExtInst %int %65 SMax %67 %68 + %69 = OpIEqual %bool %64 %63 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpLoad %int %i + %73 = OpAccessChain %_ptr_Function_int %A %72 + OpStore %73 %int_1 + OpBranch %70 + %70 = OpLabel + OpBranch %43 + %43 = OpLabel + %74 = OpLoad %int %i + %75 = OpIAdd %int %74 %int_1 + OpStore %i %75 + OpBranch %41 + %42 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Function_int %A %77 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %81 = OpLoad %int %80 + %82 = OpIEqual %bool %79 %81 + OpStore %x_78_phi %82 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Function_int %A %86 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %90 = OpLoad %int %89 + %91 = OpIEqual %bool %88 %90 + OpStore %x_77 %91 + %92 = OpLoad %bool %x_77 + OpStore %x_78_phi %92 + OpBranch %83 + %83 = OpLabel + %93 = OpLoad %bool %x_78_phi + OpStore %x_88_phi %93 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %94 + %95 = OpLabel + %96 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpAccessChain %_ptr_Function_int %A %97 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %101 = OpLoad %int %100 + %102 = OpIEqual %bool %99 %101 + OpStore %x_87 %102 + %103 = OpLoad %bool %x_87 + OpStore %x_88_phi %103 + OpBranch %94 + %94 = OpLabel + %104 = OpLoad %bool %x_88_phi + OpStore %x_98_phi %104 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %105 + %106 = OpLabel + %107 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %108 = OpLoad %int %107 + %109 = OpAccessChain %_ptr_Function_int %A %108 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %112 = OpLoad %int %111 + %113 = OpIEqual %bool %110 %112 + OpStore %x_97 %113 + %114 = OpLoad %bool %x_97 + OpStore %x_98_phi %114 + OpBranch %105 + %105 = OpLabel + %115 = OpLoad %bool %x_98_phi + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %118 + %117 = OpLabel + %119 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %120 = OpLoad %int %119 + %121 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %122 = OpLoad %int %121 + %123 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %124 = OpLoad %int %123 + %125 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %126 = OpLoad %int %125 + %127 = OpConvertSToF %float %120 + %128 = OpConvertSToF %float %122 + %129 = OpConvertSToF %float %124 + %130 = OpConvertSToF %float %126 + %131 = OpCompositeConstruct %v4float %127 %128 %129 %130 + OpStore %x_GLF_color %131 + OpBranch %116 + %118 = OpLabel + OpStore %x_GLF_color %133 + OpBranch %116 + %116 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %134 +%tint_symbol = OpFunctionParameter %main_out + %138 = OpLabel + %139 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %139 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %141 = OpLabel + %142 = OpFunctionCall %void %main_1 + %144 = OpLoad %v4float %x_GLF_color + %145 = OpCompositeConstruct %main_out %144 + %143 = OpFunctionCall %void %tint_symbol_2 %145 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f4af7a14cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-max-multiplied-values/0-opt.wgsl.expected.wgsl @@ -0,0 +1,98 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var A : array; + var x_77 : bool; + var x_87 : bool; + var x_97 : bool; + var x_78_phi : bool; + var x_88_phi : bool; + var x_98_phi : bool; + let x_33 : i32 = x_6.x_GLF_uniform_int_values[0]; + i = x_33; + loop { + let x_38 : i32 = i; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[4]; + if ((x_38 < x_40)) { + } else { + break; + } + let x_43 : i32 = i; + let x_45 : i32 = x_6.x_GLF_uniform_int_values[0]; + A[x_43] = x_45; + let x_47 : i32 = i; + let x_50 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_54 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((max((2 * x_47), (2 * x_50)) == x_54)) { + let x_58 : i32 = i; + A[x_58] = 1; + } + + continuing { + let x_60 : i32 = i; + i = (x_60 + 1); + } + } + let x_63 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_65 : i32 = A[x_63]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_68 : bool = (x_65 == x_67); + x_78_phi = x_68; + if (x_68) { + let x_72 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_74 : i32 = A[x_72]; + let x_76 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_77 = (x_74 == x_76); + x_78_phi = x_77; + } + let x_78 : bool = x_78_phi; + x_88_phi = x_78; + if (x_78) { + let x_82 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_84 : i32 = A[x_82]; + let x_86 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_87 = (x_84 == x_86); + x_88_phi = x_87; + } + let x_88 : bool = x_88_phi; + x_98_phi = x_88; + if (x_88) { + let x_92 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_94 : i32 = A[x_92]; + let x_96 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_97 = (x_94 == x_96); + x_98_phi = x_97; + } + let x_98 : bool = x_98_phi; + if (x_98) { + let x_103 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_106 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_109 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_112 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_103), f32(x_106), f32(x_109), f32(x_112)); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm new file mode 100644 index 0000000000..9e5dbf8e27 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm @@ -0,0 +1,83 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_1 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %buf1 = OpTypeStruct %_arr_int_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %12 + %28 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %29 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %30 = OpLoad %float %29 + %31 = OpFMod %float %30 %float_1 + OpStore %a %31 + %32 = OpLoad %float %a + %33 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %34 = OpLoad %float %33 + %35 = OpFOrdEqual %bool %32 %34 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %38 + %37 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %40 = OpLoad %int %39 + %41 = OpConvertSToF %float %40 + %42 = OpLoad %float %a + %43 = OpLoad %float %a + %44 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpConvertSToF %float %45 + %47 = OpCompositeConstruct %v4float %41 %42 %43 %46 + OpStore %_GLF_color %47 + OpBranch %36 + %38 = OpLabel + %48 = OpLoad %float %a + %49 = OpCompositeConstruct %v4float %48 %48 %48 %48 + OpStore %_GLF_color %49 + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2ae1a6e158 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.hlsl @@ -0,0 +1,44 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; + +void main_1() { + float a = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_30 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + a = (x_30 % 1.0f); + const float x_32 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_34 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_32 == x_34)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_42 = a; + const float x_43 = a; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_40), x_42, x_43, float(x_45)); + } else { + const float x_48 = a; + x_GLF_color = float4(x_48, x_48, x_48, x_48); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.msl new file mode 100755 index 0000000000..514ffa4f58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.msl @@ -0,0 +1,64 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float a = 0.0f; + float const x_30 = x_6.x_GLF_uniform_float_values.arr[0].el; + a = (x_30 % 1.0f); + float const x_32 = a; + float const x_34 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_32 == x_34)) { + int const x_40 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_42 = a; + float const x_43 = a; + int const x_45 = x_8.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_40), x_42, x_43, float(x_45)); + } else { + float const x_48 = a; + *(tint_symbol_4) = float4(x_48, x_48, x_48, x_48); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +T:\tmp\us0.0.metal:34:13: error: invalid operands to binary expression ('const float' and 'float') + a = (x_30 % 1.0f); + ~~~~ ^ ~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4f6ad2243f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.spvasm @@ -0,0 +1,117 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %buf1 = OpTypeStruct %_arr_int_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %54 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_float Function %26 + %30 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %31 = OpLoad %float %30 + %33 = OpFMod %float %31 %float_1 + OpStore %a %33 + %34 = OpLoad %float %a + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %36 = OpLoad %float %35 + %37 = OpFOrdEqual %bool %34 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpLoad %float %a + %46 = OpLoad %float %a + %47 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %44 + %50 = OpConvertSToF %float %48 + %51 = OpCompositeConstruct %v4float %49 %45 %46 %50 + OpStore %x_GLF_color %51 + OpBranch %39 + %41 = OpLabel + %52 = OpLoad %float %a + %53 = OpCompositeConstruct %v4float %52 %52 %52 %52 + OpStore %x_GLF_color %53 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %54 +%tint_symbol = OpFunctionParameter %main_out + %58 = OpLabel + %59 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %59 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %61 = OpLabel + %62 = OpFunctionCall %void %main_1 + %64 = OpLoad %v4float %x_GLF_color + %65 = OpCompositeConstruct %main_out %64 + %63 = OpFunctionCall %void %tint_symbol_2 %65 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..2690c8dc04 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.spvasm.expected.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var a : f32; + let x_30 : f32 = x_6.x_GLF_uniform_float_values[0]; + a = (x_30 % 1.0); + let x_32 : f32 = a; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_32 == x_34)) { + let x_40 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_42 : f32 = a; + let x_43 : f32 = a; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_40), x_42, x_43, f32(x_45)); + } else { + let x_48 : f32 = a; + x_GLF_color = vec4(x_48, x_48, x_48, x_48); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl new file mode 100644 index 0000000000..2690c8dc04 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var a : f32; + let x_30 : f32 = x_6.x_GLF_uniform_float_values[0]; + a = (x_30 % 1.0); + let x_32 : f32 = a; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_32 == x_34)) { + let x_40 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_42 : f32 = a; + let x_43 : f32 = a; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_40), x_42, x_43, f32(x_45)); + } else { + let x_48 : f32 = a; + x_GLF_color = vec4(x_48, x_48, x_48, x_48); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2ae1a6e158 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.hlsl @@ -0,0 +1,44 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; + +void main_1() { + float a = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_30 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + a = (x_30 % 1.0f); + const float x_32 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_34 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_32 == x_34)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_42 = a; + const float x_43 = a; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_40), x_42, x_43, float(x_45)); + } else { + const float x_48 = a; + x_GLF_color = float4(x_48, x_48, x_48, x_48); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.msl new file mode 100755 index 0000000000..7fbbeaa595 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.msl @@ -0,0 +1,64 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float a = 0.0f; + float const x_30 = x_6.x_GLF_uniform_float_values.arr[0].el; + a = (x_30 % 1.0f); + float const x_32 = a; + float const x_34 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_32 == x_34)) { + int const x_40 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_42 = a; + float const x_43 = a; + int const x_45 = x_8.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_40), x_42, x_43, float(x_45)); + } else { + float const x_48 = a; + *(tint_symbol_4) = float4(x_48, x_48, x_48, x_48); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +T:\tmp\u8k0.0.metal:34:13: error: invalid operands to binary expression ('const float' and 'float') + a = (x_30 % 1.0f); + ~~~~ ^ ~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4f6ad2243f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.spvasm @@ -0,0 +1,117 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %11 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %11 + %int = OpTypeInt 32 1 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 + %buf1 = OpTypeStruct %_arr_int_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %54 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %a = OpVariable %_ptr_Function_float Function %26 + %30 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %31 = OpLoad %float %30 + %33 = OpFMod %float %31 %float_1 + OpStore %a %33 + %34 = OpLoad %float %a + %35 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %36 = OpLoad %float %35 + %37 = OpFOrdEqual %bool %34 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %44 = OpLoad %int %43 + %45 = OpLoad %float %a + %46 = OpLoad %float %a + %47 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpConvertSToF %float %44 + %50 = OpConvertSToF %float %48 + %51 = OpCompositeConstruct %v4float %49 %45 %46 %50 + OpStore %x_GLF_color %51 + OpBranch %39 + %41 = OpLabel + %52 = OpLoad %float %a + %53 = OpCompositeConstruct %v4float %52 %52 %52 %52 + OpStore %x_GLF_color %53 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %54 +%tint_symbol = OpFunctionParameter %main_out + %58 = OpLabel + %59 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %59 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %61 = OpLabel + %62 = OpFunctionCall %void %main_1 + %64 = OpLoad %v4float %x_GLF_color + %65 = OpCompositeConstruct %main_out %64 + %63 = OpFunctionCall %void %tint_symbol_2 %65 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..2690c8dc04 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-modulo-1/0-opt.wgsl.expected.wgsl @@ -0,0 +1,49 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var a : f32; + let x_30 : f32 = x_6.x_GLF_uniform_float_values[0]; + a = (x_30 % 1.0); + let x_32 : f32 = a; + let x_34 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_32 == x_34)) { + let x_40 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_42 : f32 = a; + let x_43 : f32 = a; + let x_45 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_40), x_42, x_43, f32(x_45)); + } else { + let x_48 : f32 = a; + x_GLF_color = vec4(x_48, x_48, x_48, x_48); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm new file mode 100644 index 0000000000..26c6b3185f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm @@ -0,0 +1,72 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v "v" + OpName %res "res" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%float_8_39999962 = OpConstant %float 8.39999962 +%float_n864_664978 = OpConstant %float -864.664978 +%float_945_419983 = OpConstant %float 945.419983 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_8_39999962 %float_n864_664978 %float_945_419983 %float_1 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%mat4v4float = OpTypeMatrix %v4float 4 + %float_0 = OpConstant %float 0 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %29 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + %res = OpVariable %_ptr_Function_v4float Function + OpStore %v %17 + %30 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %31 = OpLoad %float %30 + %32 = OpCompositeConstruct %v4float %31 %float_0 %float_0 %float_0 + %33 = OpCompositeConstruct %v4float %float_0 %31 %float_0 %float_0 + %34 = OpCompositeConstruct %v4float %float_0 %float_0 %31 %float_0 + %35 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %31 + %36 = OpCompositeConstruct %mat4v4float %32 %33 %34 %35 + %37 = OpLoad %v4float %v + %38 = OpMatrixTimesVector %v4float %36 %37 + OpStore %res %38 + %39 = OpLoad %v4float %v + %40 = OpLoad %v4float %res + %41 = OpExtInst %float %1 Distance %39 %40 + %42 = OpFOrdLessThan %bool %41 %float_0_00999999978 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + OpStore %_GLF_color %27 + OpBranch %43 + %45 = OpLabel + OpStore %_GLF_color %28 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..322962c840 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.hlsl @@ -0,0 +1,32 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 res = float4(0.0f, 0.0f, 0.0f, 0.0f); + v = float4(8.399999619f, -864.664978027f, 945.41998291f, 1.0f); + const float x_31 = asfloat(x_7[0].x); + res = mul(v, float4x4(float4(x_31, 0.0f, 0.0f, 0.0f), float4(0.0f, x_31, 0.0f, 0.0f), float4(0.0f, 0.0f, x_31, 0.0f), float4(0.0f, 0.0f, 0.0f, x_31))); + if ((distance(v, res) < 0.01f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..6c24b25307 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + float4 res = 0.0f; + v = float4(8.399999619f, -864.664978027f, 945.41998291f, 1.0f); + float const x_31 = x_7.one; + float4 const x_37 = v; + res = (float4x4(float4(x_31, 0.0f, 0.0f, 0.0f), float4(0.0f, x_31, 0.0f, 0.0f), float4(0.0f, 0.0f, x_31, 0.0f), float4(0.0f, 0.0f, 0.0f, x_31)) * x_37); + float4 const x_39 = v; + float4 const x_40 = res; + if ((distance(x_39, x_40) < 0.01f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4cc918274c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %40 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %res "res" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%float_8_39999962 = OpConstant %float 8.39999962 +%float_n864_664978 = OpConstant %float -864.664978 +%float_945_419983 = OpConstant %float 945.419983 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_8_39999962 %float_n864_664978 %float_945_419983 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%mat4v4float = OpTypeMatrix %v4float 4 + %float_0 = OpConstant %float 0 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %bool = OpTypeBool + %47 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %48 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %8 + OpStore %v %22 + %26 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %27 = OpLoad %float %26 + %28 = OpLoad %v4float %v + %31 = OpCompositeConstruct %v4float %27 %float_0 %float_0 %float_0 + %32 = OpCompositeConstruct %v4float %float_0 %27 %float_0 %float_0 + %33 = OpCompositeConstruct %v4float %float_0 %float_0 %27 %float_0 + %34 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27 + %35 = OpCompositeConstruct %mat4v4float %31 %32 %33 %34 + %36 = OpMatrixTimesVector %v4float %35 %28 + OpStore %res %36 + %37 = OpLoad %v4float %v + %38 = OpLoad %v4float %res + %39 = OpExtInst %float %40 Distance %37 %38 + %42 = OpFOrdLessThan %bool %39 %float_0_00999999978 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpStore %x_GLF_color %47 + OpBranch %44 + %46 = OpLabel + OpStore %x_GLF_color %48 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %49 +%tint_symbol = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %56 = OpLabel + %57 = OpFunctionCall %void %main_1 + %59 = OpLoad %v4float %x_GLF_color + %60 = OpCompositeConstruct %main_out %59 + %58 = OpFunctionCall %void %tint_symbol_2 %60 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..acefefbb4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var res : vec4; + v = vec4(8.399999619, -864.664978027, 945.41998291, 1.0); + let x_31 : f32 = x_7.one; + let x_37 : vec4 = v; + res = (mat4x4(vec4(x_31, 0.0, 0.0, 0.0), vec4(0.0, x_31, 0.0, 0.0), vec4(0.0, 0.0, x_31, 0.0), vec4(0.0, 0.0, 0.0, x_31)) * x_37); + let x_39 : vec4 = v; + let x_40 : vec4 = res; + if ((distance(x_39, x_40) < 0.01)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl new file mode 100644 index 0000000000..acefefbb4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl @@ -0,0 +1,36 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var res : vec4; + v = vec4(8.399999619, -864.664978027, 945.41998291, 1.0); + let x_31 : f32 = x_7.one; + let x_37 : vec4 = v; + res = (mat4x4(vec4(x_31, 0.0, 0.0, 0.0), vec4(0.0, x_31, 0.0, 0.0), vec4(0.0, 0.0, x_31, 0.0), vec4(0.0, 0.0, 0.0, x_31)) * x_37); + let x_39 : vec4 = v; + let x_40 : vec4 = res; + if ((distance(x_39, x_40) < 0.01)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..322962c840 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 res = float4(0.0f, 0.0f, 0.0f, 0.0f); + v = float4(8.399999619f, -864.664978027f, 945.41998291f, 1.0f); + const float x_31 = asfloat(x_7[0].x); + res = mul(v, float4x4(float4(x_31, 0.0f, 0.0f, 0.0f), float4(0.0f, x_31, 0.0f, 0.0f), float4(0.0f, 0.0f, x_31, 0.0f), float4(0.0f, 0.0f, 0.0f, x_31))); + if ((distance(v, res) < 0.01f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..6c24b25307 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + float4 res = 0.0f; + v = float4(8.399999619f, -864.664978027f, 945.41998291f, 1.0f); + float const x_31 = x_7.one; + float4 const x_37 = v; + res = (float4x4(float4(x_31, 0.0f, 0.0f, 0.0f), float4(0.0f, x_31, 0.0f, 0.0f), float4(0.0f, 0.0f, x_31, 0.0f), float4(0.0f, 0.0f, 0.0f, x_31)) * x_37); + float4 const x_39 = v; + float4 const x_40 = res; + if ((distance(x_39, x_40) < 0.01f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4cc918274c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %40 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %res "res" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%float_8_39999962 = OpConstant %float 8.39999962 +%float_n864_664978 = OpConstant %float -864.664978 +%float_945_419983 = OpConstant %float 945.419983 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_8_39999962 %float_n864_664978 %float_945_419983 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%mat4v4float = OpTypeMatrix %v4float 4 + %float_0 = OpConstant %float 0 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %bool = OpTypeBool + %47 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %48 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %8 + %res = OpVariable %_ptr_Function_v4float Function %8 + OpStore %v %22 + %26 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %27 = OpLoad %float %26 + %28 = OpLoad %v4float %v + %31 = OpCompositeConstruct %v4float %27 %float_0 %float_0 %float_0 + %32 = OpCompositeConstruct %v4float %float_0 %27 %float_0 %float_0 + %33 = OpCompositeConstruct %v4float %float_0 %float_0 %27 %float_0 + %34 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27 + %35 = OpCompositeConstruct %mat4v4float %31 %32 %33 %34 + %36 = OpMatrixTimesVector %v4float %35 %28 + OpStore %res %36 + %37 = OpLoad %v4float %v + %38 = OpLoad %v4float %res + %39 = OpExtInst %float %40 Distance %37 %38 + %42 = OpFOrdLessThan %bool %39 %float_0_00999999978 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpStore %x_GLF_color %47 + OpBranch %44 + %46 = OpLabel + OpStore %x_GLF_color %48 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %49 +%tint_symbol = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %56 = OpLabel + %57 = OpFunctionCall %void %main_1 + %59 = OpLoad %v4float %x_GLF_color + %60 = OpCompositeConstruct %main_out %59 + %58 = OpFunctionCall %void %tint_symbol_2 %60 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..acefefbb4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-mul-identity/0-opt.wgsl.expected.wgsl @@ -0,0 +1,36 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + var res : vec4; + v = vec4(8.399999619, -864.664978027, 945.41998291, 1.0); + let x_31 : f32 = x_7.one; + let x_37 : vec4 = v; + res = (mat4x4(vec4(x_31, 0.0, 0.0, 0.0), vec4(0.0, x_31, 0.0, 0.0), vec4(0.0, 0.0, x_31, 0.0), vec4(0.0, 0.0, 0.0, x_31)) * x_37); + let x_39 : vec4 = v; + let x_40 : vec4 = res; + if ((distance(x_39, x_40) < 0.01)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm new file mode 100644 index 0000000000..cf65bd98eb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm @@ -0,0 +1,68 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %float_n5 = OpConstant %float -5 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %26 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %29 = OpLoad %int %28 + %30 = OpSGreaterThan %bool %29 %int_1 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %31 + %32 = OpLabel + %33 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %34 = OpLoad %float %33 + %35 = OpFOrdLessThan %bool %34 %float_n5 + %36 = OpLogicalNot %bool %35 + OpBranch %31 + %31 = OpLabel + %37 = OpPhi %bool %30 %27 %36 %32 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %40 + %39 = OpLabel + OpStore %_GLF_color %25 + OpBranch %38 + %40 = OpLabel + OpStore %_GLF_color %26 + OpBranch %38 + %38 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..791abae0b7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.hlsl @@ -0,0 +1,43 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_36 = false; + bool x_37_phi = false; + const int x_29 = asint(x_6[0].x); + const bool x_30 = (x_29 > 1); + x_37_phi = x_30; + if (x_30) { + const float x_34 = gl_FragCoord.y; + x_36 = !((x_34 < -5.0f)); + x_37_phi = x_36; + } + if (x_37_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.msl new file mode 100644 index 0000000000..051b40ed0c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + bool x_36 = false; + bool x_37_phi = false; + int const x_29 = x_6.three; + bool const x_30 = (x_29 > 1); + x_37_phi = x_30; + if (x_30) { + float const x_34 = (*(tint_symbol_5)).y; + x_36 = !((x_34 < -5.0f)); + x_37_phi = x_36; + } + bool const x_37 = x_37_phi; + if (x_37) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..843780c071 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.spvasm @@ -0,0 +1,113 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_36 "x_36" + OpName %x_37_phi "x_37_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_n5 = OpConstant %float -5 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %47 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %48 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_36 = OpVariable %_ptr_Function_bool Function %22 + %x_37_phi = OpVariable %_ptr_Function_bool Function %22 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %28 = OpLoad %int %27 + %30 = OpSGreaterThan %bool %28 %int_1 + OpStore %x_37_phi %30 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %31 + %32 = OpLabel + %35 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %36 = OpLoad %float %35 + %39 = OpFOrdLessThan %bool %36 %float_n5 + %37 = OpLogicalNot %bool %39 + OpStore %x_36 %37 + %40 = OpLoad %bool %x_36 + OpStore %x_37_phi %40 + OpBranch %31 + %31 = OpLabel + %41 = OpLoad %bool %x_37_phi + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %44 + %43 = OpLabel + OpStore %x_GLF_color %47 + OpBranch %42 + %44 = OpLabel + OpStore %x_GLF_color %48 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %49 +%tint_symbol_1 = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %56 = OpLabel + %57 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %57 + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_3 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..6bdc8123f3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.spvasm.expected.wgsl @@ -0,0 +1,42 @@ +[[block]] +struct buf0 { + three : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : bool; + var x_37_phi : bool; + let x_29 : i32 = x_6.three; + let x_30 : bool = (x_29 > 1); + x_37_phi = x_30; + if (x_30) { + let x_34 : f32 = gl_FragCoord.y; + x_36 = !((x_34 < -5.0)); + x_37_phi = x_36; + } + let x_37 : bool = x_37_phi; + if (x_37) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl new file mode 100644 index 0000000000..6bdc8123f3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl @@ -0,0 +1,42 @@ +[[block]] +struct buf0 { + three : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : bool; + var x_37_phi : bool; + let x_29 : i32 = x_6.three; + let x_30 : bool = (x_29 > 1); + x_37_phi = x_30; + if (x_30) { + let x_34 : f32 = gl_FragCoord.y; + x_36 = !((x_34 < -5.0)); + x_37_phi = x_36; + } + let x_37 : bool = x_37_phi; + if (x_37) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..791abae0b7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.hlsl @@ -0,0 +1,43 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_36 = false; + bool x_37_phi = false; + const int x_29 = asint(x_6[0].x); + const bool x_30 = (x_29 > 1); + x_37_phi = x_30; + if (x_30) { + const float x_34 = gl_FragCoord.y; + x_36 = !((x_34 < -5.0f)); + x_37_phi = x_36; + } + if (x_37_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.msl new file mode 100644 index 0000000000..051b40ed0c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int three; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + bool x_36 = false; + bool x_37_phi = false; + int const x_29 = x_6.three; + bool const x_30 = (x_29 > 1); + x_37_phi = x_30; + if (x_30) { + float const x_34 = (*(tint_symbol_5)).y; + x_36 = !((x_34 < -5.0f)); + x_37_phi = x_36; + } + bool const x_37 = x_37_phi; + if (x_37) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..843780c071 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.spvasm @@ -0,0 +1,113 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "three" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_36 "x_36" + OpName %x_37_phi "x_37_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_n5 = OpConstant %float -5 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %47 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %48 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_36 = OpVariable %_ptr_Function_bool Function %22 + %x_37_phi = OpVariable %_ptr_Function_bool Function %22 + %27 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %28 = OpLoad %int %27 + %30 = OpSGreaterThan %bool %28 %int_1 + OpStore %x_37_phi %30 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %31 + %32 = OpLabel + %35 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %36 = OpLoad %float %35 + %39 = OpFOrdLessThan %bool %36 %float_n5 + %37 = OpLogicalNot %bool %39 + OpStore %x_36 %37 + %40 = OpLoad %bool %x_36 + OpStore %x_37_phi %40 + OpBranch %31 + %31 = OpLabel + %41 = OpLoad %bool %x_37_phi + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %44 + %43 = OpLabel + OpStore %x_GLF_color %47 + OpBranch %42 + %44 = OpLabel + OpStore %x_GLF_color %48 + OpBranch %42 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %49 +%tint_symbol_1 = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %56 = OpLabel + %57 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %57 + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_3 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..6bdc8123f3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-not-less-than-neg/0.wgsl.expected.wgsl @@ -0,0 +1,42 @@ +[[block]] +struct buf0 { + three : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : bool; + var x_37_phi : bool; + let x_29 : i32 = x_6.three; + let x_30 : bool = (x_29 > 1); + x_37_phi = x_30; + if (x_30) { + let x_34 : f32 = gl_FragCoord.y; + x_36 = !((x_34 < -5.0)); + x_37_phi = x_36; + } + let x_37 : bool = x_37_phi; + if (x_37) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm new file mode 100644 index 0000000000..25063bf57d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm @@ -0,0 +1,68 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %8 + %20 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %22 = OpLoad %int %21 + %23 = OpShiftRightArithmetic %int %int_1 %22 + %24 = OpSGreaterThan %bool %23 %int_0 + OpSelectionMerge %25 None + OpBranchConditional %24 %26 %27 + %26 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %29 = OpLoad %int %28 + %30 = OpConvertSToF %float %29 + %31 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %32 = OpLoad %int %31 + %33 = OpConvertSToF %float %32 + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %35 = OpLoad %int %34 + %36 = OpConvertSToF %float %35 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %38 = OpLoad %int %37 + %39 = OpConvertSToF %float %38 + %40 = OpCompositeConstruct %v4float %30 %33 %36 %39 + OpStore %_GLF_color %40 + OpBranch %25 + %27 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %42 = OpLoad %int %41 + %43 = OpConvertSToF %float %42 + %44 = OpCompositeConstruct %v4float %43 %43 %43 %43 + OpStore %_GLF_color %44 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..cc1c58abab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.hlsl @@ -0,0 +1,38 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_22 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + if (((1 >> asuint(x_22)) > 0)) { + const int x_29 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_32 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_35 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_38 = asint(x_5[1].x); + x_GLF_color = float4(float(x_29), float(x_32), float(x_35), float(x_38)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_42 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_43 = float(x_42); + x_GLF_color = float4(x_43, x_43, x_43, x_43); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..1905aabf14 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_22 = x_5.x_GLF_uniform_int_values.arr[0].el; + if (((1 >> as_type(x_22)) > 0)) { + int const x_29 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_32 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_35 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_38 = x_5.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_29), float(x_32), float(x_35), float(x_38)); + } else { + int const x_42 = x_5.x_GLF_uniform_int_values.arr[0].el; + float const x_43 = float(x_42); + *(tint_symbol_4) = float4(x_43, x_43, x_43, x_43); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..599a2ed329 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %23 = OpLoad %int %22 + %25 = OpBitcast %uint %23 + %26 = OpShiftRightArithmetic %int %int_1 %25 + %27 = OpSGreaterThan %bool %26 %int_0 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + %32 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %33 = OpLoad %int %32 + %34 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %35 = OpLoad %int %34 + %36 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %39 = OpLoad %int %38 + %40 = OpConvertSToF %float %33 + %41 = OpConvertSToF %float %35 + %42 = OpConvertSToF %float %37 + %43 = OpConvertSToF %float %39 + %44 = OpCompositeConstruct %v4float %40 %41 %42 %43 + OpStore %x_GLF_color %44 + OpBranch %29 + %31 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpCompositeConstruct %v4float %47 %47 %47 %47 + OpStore %x_GLF_color %48 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %49 +%tint_symbol = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %56 = OpLabel + %57 = OpFunctionCall %void %main_1 + %59 = OpLoad %v4float %x_GLF_color + %60 = OpCompositeConstruct %main_out %59 + %58 = OpFunctionCall %void %tint_symbol_2 %60 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..24991caf58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.spvasm.expected.wgsl @@ -0,0 +1,37 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_22 : i32 = x_5.x_GLF_uniform_int_values[0]; + if (((1 >> bitcast(x_22)) > 0)) { + let x_29 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_32 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_35 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_38 : i32 = x_5.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_29), f32(x_32), f32(x_35), f32(x_38)); + } else { + let x_42 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_43 : f32 = f32(x_42); + x_GLF_color = vec4(x_43, x_43, x_43, x_43); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl new file mode 100644 index 0000000000..24991caf58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl @@ -0,0 +1,37 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_22 : i32 = x_5.x_GLF_uniform_int_values[0]; + if (((1 >> bitcast(x_22)) > 0)) { + let x_29 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_32 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_35 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_38 : i32 = x_5.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_29), f32(x_32), f32(x_35), f32(x_38)); + } else { + let x_42 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_43 : f32 = f32(x_42); + x_GLF_color = vec4(x_43, x_43, x_43, x_43); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..cc1c58abab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.hlsl @@ -0,0 +1,38 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_22 = asint(x_5[scalar_offset / 4][scalar_offset % 4]); + if (((1 >> asuint(x_22)) > 0)) { + const int x_29 = asint(x_5[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_32 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_35 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_38 = asint(x_5[1].x); + x_GLF_color = float4(float(x_29), float(x_32), float(x_35), float(x_38)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_42 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_43 = float(x_42); + x_GLF_color = float4(x_43, x_43, x_43, x_43); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..1905aabf14 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int const x_22 = x_5.x_GLF_uniform_int_values.arr[0].el; + if (((1 >> as_type(x_22)) > 0)) { + int const x_29 = x_5.x_GLF_uniform_int_values.arr[1].el; + int const x_32 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_35 = x_5.x_GLF_uniform_int_values.arr[0].el; + int const x_38 = x_5.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_29), float(x_32), float(x_35), float(x_38)); + } else { + int const x_42 = x_5.x_GLF_uniform_int_values.arr[0].el; + float const x_43 = float(x_42); + *(tint_symbol_4) = float4(x_43, x_43, x_43, x_43); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..599a2ed329 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %23 = OpLoad %int %22 + %25 = OpBitcast %uint %23 + %26 = OpShiftRightArithmetic %int %int_1 %25 + %27 = OpSGreaterThan %bool %26 %int_0 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + %32 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %33 = OpLoad %int %32 + %34 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %35 = OpLoad %int %34 + %36 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1 + %39 = OpLoad %int %38 + %40 = OpConvertSToF %float %33 + %41 = OpConvertSToF %float %35 + %42 = OpConvertSToF %float %37 + %43 = OpConvertSToF %float %39 + %44 = OpCompositeConstruct %v4float %40 %41 %42 %43 + OpStore %x_GLF_color %44 + OpBranch %29 + %31 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpConvertSToF %float %46 + %48 = OpCompositeConstruct %v4float %47 %47 %47 %47 + OpStore %x_GLF_color %48 + OpBranch %29 + %29 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %49 +%tint_symbol = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %56 = OpLabel + %57 = OpFunctionCall %void %main_1 + %59 = OpLoad %v4float %x_GLF_color + %60 = OpCompositeConstruct %main_out %59 + %58 = OpFunctionCall %void %tint_symbol_2 %60 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..24991caf58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-right-shift-greater-than-zero/0-opt.wgsl.expected.wgsl @@ -0,0 +1,37 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_22 : i32 = x_5.x_GLF_uniform_int_values[0]; + if (((1 >> bitcast(x_22)) > 0)) { + let x_29 : i32 = x_5.x_GLF_uniform_int_values[1]; + let x_32 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_35 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_38 : i32 = x_5.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_29), f32(x_32), f32(x_35), f32(x_38)); + } else { + let x_42 : i32 = x_5.x_GLF_uniform_int_values[0]; + let x_43 : f32 = f32(x_42); + x_GLF_color = vec4(x_43, x_43, x_43, x_43); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm new file mode 100644 index 0000000000..3b55d3ef17 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm @@ -0,0 +1,63 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %6 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool + %float = OpTypeFloat 32 + %float_709 = OpConstant %float 709 + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %8 + %23 = OpLabel + %24 = OpExtInst %float %1 Cosh %float_709 + %25 = OpExtInst %float %1 FSign %24 + %26 = OpFOrdEqual %bool %25 %float_1 + %27 = OpLogicalNot %bool %26 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %28 + %29 = OpLabel + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %6 = OpLoad %int %30 + %31 = OpIEqual %bool %6 %int_1 + OpBranch %28 + %28 = OpLabel + %32 = OpPhi %bool %26 %23 %31 %29 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + OpStore %_GLF_color %21 + OpBranch %33 + %35 = OpLabel + OpStore %_GLF_color %22 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..30526ab799 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.hlsl @@ -0,0 +1,36 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_31 = false; + bool x_32_phi = false; + const bool x_26 = (sign(cosh(709.0f)) == 1.0f); + x_32_phi = x_26; + if (!(x_26)) { + const int x_6 = asint(x_5[0].x); + x_31 = (x_6 == 1); + x_32_phi = x_31; + } + if (x_32_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.msl new file mode 100644 index 0000000000..97f9005b2b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + bool x_31 = false; + bool x_32_phi = false; + bool const x_26 = (sign(cosh(709.0f)) == 1.0f); + x_32_phi = x_26; + if (!(x_26)) { + int const x_6 = x_5.one; + x_31 = (x_6 == 1); + x_32_phi = x_31; + } + bool const x_32 = x_32_phi; + if (x_32) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..abf3dc12fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_31 "x_31" + OpName %x_32_phi "x_32_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %19 = OpConstantNull %bool + %float_709 = OpConstant %float 709 + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %43 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %44 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %45 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_31 = OpVariable %_ptr_Function_bool Function %19 + %x_32_phi = OpVariable %_ptr_Function_bool Function %19 + %23 = OpExtInst %float %22 Cosh %float_709 + %21 = OpExtInst %float %22 FSign %23 + %26 = OpFOrdEqual %bool %21 %float_1 + OpStore %x_32_phi %26 + %27 = OpLogicalNot %bool %26 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %28 + %29 = OpLabel + %33 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %34 = OpLoad %int %33 + %36 = OpIEqual %bool %34 %int_1 + OpStore %x_31 %36 + %37 = OpLoad %bool %x_31 + OpStore %x_32_phi %37 + OpBranch %28 + %28 = OpLabel + %38 = OpLoad %bool %x_32_phi + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %39 + %41 = OpLabel + OpStore %x_GLF_color %44 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %45 +%tint_symbol = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %52 = OpLabel + %53 = OpFunctionCall %void %main_1 + %55 = OpLoad %v4float %x_GLF_color + %56 = OpCompositeConstruct %main_out %55 + %54 = OpFunctionCall %void %tint_symbol_2 %56 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..b37e8cf10b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.spvasm.expected.wgsl @@ -0,0 +1,38 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_31 : bool; + var x_32_phi : bool; + let x_26 : bool = (sign(cosh(709.0)) == 1.0); + x_32_phi = x_26; + if (!(x_26)) { + let x_6 : i32 = x_5.one; + x_31 = (x_6 == 1); + x_32_phi = x_31; + } + let x_32 : bool = x_32_phi; + if (x_32) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl new file mode 100644 index 0000000000..b37e8cf10b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl @@ -0,0 +1,38 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_31 : bool; + var x_32_phi : bool; + let x_26 : bool = (sign(cosh(709.0)) == 1.0); + x_32_phi = x_26; + if (!(x_26)) { + let x_6 : i32 = x_5.one; + x_31 = (x_6 == 1); + x_32_phi = x_31; + } + let x_32 : bool = x_32_phi; + if (x_32) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..30526ab799 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_31 = false; + bool x_32_phi = false; + const bool x_26 = (sign(cosh(709.0f)) == 1.0f); + x_32_phi = x_26; + if (!(x_26)) { + const int x_6 = asint(x_5[0].x); + x_31 = (x_6 == 1); + x_32_phi = x_31; + } + if (x_32_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.msl new file mode 100644 index 0000000000..97f9005b2b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + bool x_31 = false; + bool x_32_phi = false; + bool const x_26 = (sign(cosh(709.0f)) == 1.0f); + x_32_phi = x_26; + if (!(x_26)) { + int const x_6 = x_5.one; + x_31 = (x_6 == 1); + x_32_phi = x_31; + } + bool const x_32 = x_32_phi; + if (x_32) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..abf3dc12fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_31 "x_31" + OpName %x_32_phi "x_32_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %19 = OpConstantNull %bool + %float_709 = OpConstant %float 709 + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %43 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %44 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %45 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_31 = OpVariable %_ptr_Function_bool Function %19 + %x_32_phi = OpVariable %_ptr_Function_bool Function %19 + %23 = OpExtInst %float %22 Cosh %float_709 + %21 = OpExtInst %float %22 FSign %23 + %26 = OpFOrdEqual %bool %21 %float_1 + OpStore %x_32_phi %26 + %27 = OpLogicalNot %bool %26 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %28 + %29 = OpLabel + %33 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %34 = OpLoad %int %33 + %36 = OpIEqual %bool %34 %int_1 + OpStore %x_31 %36 + %37 = OpLoad %bool %x_31 + OpStore %x_32_phi %37 + OpBranch %28 + %28 = OpLabel + %38 = OpLoad %bool %x_32_phi + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpStore %x_GLF_color %43 + OpBranch %39 + %41 = OpLabel + OpStore %x_GLF_color %44 + OpBranch %39 + %39 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %45 +%tint_symbol = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %52 = OpLabel + %53 = OpFunctionCall %void %main_1 + %55 = OpLoad %v4float %x_GLF_color + %56 = OpCompositeConstruct %main_out %55 + %54 = OpFunctionCall %void %tint_symbol_2 %56 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..b37e8cf10b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-sign-cosh/0.wgsl.expected.wgsl @@ -0,0 +1,38 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_31 : bool; + var x_32_phi : bool; + let x_26 : bool = (sign(cosh(709.0)) == 1.0); + x_32_phi = x_26; + if (!(x_26)) { + let x_6 : i32 = x_5.one; + x_31 = (x_6 == 1); + x_32_phi = x_31; + } + let x_32 : bool = x_32_phi; + if (x_32) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm new file mode 100644 index 0000000000..cd282a9f99 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm @@ -0,0 +1,96 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f "f" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_n0x1_8p_128 = OpConstant %float -0x1.8p+128 + %float_5 = OpConstant %float 5 + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %29 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %30 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %31 = OpLoad %float %30 + OpStore %f %31 + %32 = OpLoad %float %f + %33 = OpFAdd %float %32 %float_n0x1_8p_128 + OpStore %f %33 + %34 = OpLoad %float %f + %35 = OpFDiv %float %float_5 %34 + %36 = OpFOrdEqual %bool %35 %float_0 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + %39 = OpLoad %float %f + %40 = OpFAdd %float %39 %float_1 + OpStore %f %40 + OpBranch %37 + %37 = OpLabel + %41 = OpLoad %float %f + %42 = OpIsNan %bool %41 + %43 = OpLogicalNot %bool %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + %46 = OpLoad %float %f + %47 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %48 = OpLoad %float %47 + %49 = OpFOrdNotEqual %bool %46 %48 + OpBranch %44 + %44 = OpLabel + %50 = OpPhi %bool %42 %37 %49 %45 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + OpStore %f %float_0 + OpBranch %51 + %51 = OpLabel + %53 = OpLoad %float %f + %54 = OpFOrdEqual %bool %53 %float_0 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpStore %_GLF_color %27 + OpBranch %55 + %57 = OpLabel + OpStore %_GLF_color %28 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..25c78f5cfc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.hlsl @@ -0,0 +1,53 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float f = 0.0f; + bool x_49 = false; + bool x_50_phi = false; + const float x_31 = gl_FragCoord.x; + f = x_31; + f = (f + asfloat(0x7fc00000u)); + if (((5.0f / f) == 0.0f)) { + f = (f + 1.0f); + } + const bool x_42 = isnan(f); + x_50_phi = x_42; + if (!(x_42)) { + const float x_46 = f; + const float x_48 = asfloat(x_7[0].x); + x_49 = (x_46 != x_48); + x_50_phi = x_49; + } + if (x_50_phi) { + f = 0.0f; + } + if ((f == 0.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..b9e944931d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float f = 0.0f; + bool x_49 = false; + bool x_50_phi = false; + float const x_31 = (*(tint_symbol_5)).x; + f = x_31; + float const x_32 = f; + f = (x_32 + NAN); + float const x_34 = f; + if (((5.0f / x_34) == 0.0f)) { + float const x_39 = f; + f = (x_39 + 1.0f); + } + float const x_41 = f; + bool const x_42 = isnan(x_41); + x_50_phi = x_42; + if (!(x_42)) { + float const x_46 = f; + float const x_48 = x_7.zero; + x_49 = (x_46 != x_48); + x_50_phi = x_49; + } + bool const x_50 = x_50_phi; + if (x_50) { + f = 0.0f; + } + float const x_53 = f; + if ((x_53 == 0.0f)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..d020f59e91 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %f "f" + OpName %x_49 "x_49" + OpName %x_50_phi "x_50_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %24 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float +%float_n0x1_8p_128 = OpConstant %float -0x1.8p+128 + %float_5 = OpConstant %float 5 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %63 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %64 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %f = OpVariable %_ptr_Function_float Function %20 + %x_49 = OpVariable %_ptr_Function_bool Function %24 + %x_50_phi = OpVariable %_ptr_Function_bool Function %24 + %29 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %30 = OpLoad %float %29 + OpStore %f %30 + %31 = OpLoad %float %f + %33 = OpFAdd %float %31 %float_n0x1_8p_128 + OpStore %f %33 + %34 = OpLoad %float %f + %36 = OpFDiv %float %float_5 %34 + %38 = OpFOrdEqual %bool %36 %float_0 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %39 + %40 = OpLabel + %41 = OpLoad %float %f + %43 = OpFAdd %float %41 %float_1 + OpStore %f %43 + OpBranch %39 + %39 = OpLabel + %44 = OpLoad %float %f + %45 = OpIsNan %bool %44 + OpStore %x_50_phi %45 + %46 = OpLogicalNot %bool %45 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + %49 = OpLoad %float %f + %51 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %52 = OpLoad %float %51 + %53 = OpFOrdNotEqual %bool %49 %52 + OpStore %x_49 %53 + %54 = OpLoad %bool %x_49 + OpStore %x_50_phi %54 + OpBranch %47 + %47 = OpLabel + %55 = OpLoad %bool %x_50_phi + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + OpStore %f %float_0 + OpBranch %56 + %56 = OpLabel + %58 = OpLoad %float %f + %59 = OpFOrdEqual %bool %58 %float_0 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpStore %x_GLF_color %63 + OpBranch %60 + %62 = OpLabel + OpStore %x_GLF_color %64 + OpBranch %60 + %60 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %65 +%tint_symbol_1 = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %72 = OpLabel + %73 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %73 + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_3 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..6638485754 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.spvasm.expected.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + zero : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var x_49 : bool; + var x_50_phi : bool; + let x_31 : f32 = gl_FragCoord.x; + f = x_31; + let x_32 : f32 = f; + f = (x_32 + -0x1.8p+128); + let x_34 : f32 = f; + if (((5.0 / x_34) == 0.0)) { + let x_39 : f32 = f; + f = (x_39 + 1.0); + } + let x_41 : f32 = f; + let x_42 : bool = isNan(x_41); + x_50_phi = x_42; + if (!(x_42)) { + let x_46 : f32 = f; + let x_48 : f32 = x_7.zero; + x_49 = (x_46 != x_48); + x_50_phi = x_49; + } + let x_50 : bool = x_50_phi; + if (x_50) { + f = 0.0; + } + let x_53 : f32 = f; + if ((x_53 == 0.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl new file mode 100644 index 0000000000..6638485754 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + zero : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var f : f32; + var x_49 : bool; + var x_50_phi : bool; + let x_31 : f32 = gl_FragCoord.x; + f = x_31; + let x_32 : f32 = f; + f = (x_32 + -0x1.8p+128); + let x_34 : f32 = f; + if (((5.0 / x_34) == 0.0)) { + let x_39 : f32 = f; + f = (x_39 + 1.0); + } + let x_41 : f32 = f; + let x_42 : bool = isNan(x_41); + x_50_phi = x_42; + if (!(x_42)) { + let x_46 : f32 = f; + let x_48 : f32 = x_7.zero; + x_49 = (x_46 != x_48); + x_50_phi = x_49; + } + let x_50 : bool = x_50_phi; + if (x_50) { + f = 0.0; + } + let x_53 : f32 = f; + if ((x_53 == 0.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..20e17e7a46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.hlsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl:19:19 error: expected ')' + f = (x_32 + -0x1.8p+128); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..20e17e7a46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.msl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl:19:19 error: expected ')' + f = (x_32 + -0x1.8p+128); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..20e17e7a46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.spvasm @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl:19:19 error: expected ')' + f = (x_32 + -0x1.8p+128); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..20e17e7a46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-simplify-smoothstep-undef/0-opt.wgsl:19:19 error: expected ')' + f = (x_32 + -0x1.8p+128); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm new file mode 100644 index 0000000000..a89702b1a8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm @@ -0,0 +1,158 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f1_vf2_ "f1(vf2;" + OpName %v1 "v1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %m1 "m1" + OpName %m2 "m2" + OpName %v1_0 "v1" + OpName %a "a" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %23 = OpTypeFunction %int %_ptr_Function_v2float + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_int = OpTypePointer Function %int + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %18 + %43 = OpLabel + %m1 = OpVariable %_ptr_Function_mat2v2float Function + %m2 = OpVariable %_ptr_Function_mat2v2float Function + %v1_0 = OpVariable %_ptr_Function_v2float Function + %a = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_v2float Function + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %45 = OpLoad %float %44 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %47 = OpLoad %float %46 + %48 = OpFNegate %float %47 + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %50 = OpLoad %float %49 + %51 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %52 = OpLoad %float %51 + %53 = OpExtInst %float %1 Sin %52 + %54 = OpCompositeConstruct %v2float %45 %48 + %55 = OpCompositeConstruct %v2float %50 %53 + %56 = OpCompositeConstruct %mat2v2float %54 %55 + OpStore %m1 %56 + %57 = OpLoad %mat2v2float %m1 + %58 = OpLoad %mat2v2float %m1 + %59 = OpMatrixTimesMatrix %mat2v2float %57 %58 + OpStore %m2 %59 + %60 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpCompositeConstruct %v2float %61 %61 + %63 = OpLoad %mat2v2float %m2 + %64 = OpVectorTimesMatrix %v2float %62 %63 + OpStore %v1_0 %64 + %65 = OpLoad %v2float %v1_0 + OpStore %param %65 + %66 = OpFunctionCall %int %f1_vf2_ %param + OpStore %a %66 + %67 = OpLoad %int %a + %68 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpIEqual %bool %67 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %81 = OpLoad %float %80 + %82 = OpCompositeConstruct %v4float %75 %77 %79 %81 + OpStore %_GLF_color %82 + OpBranch %71 + %73 = OpLabel + %83 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpConvertSToF %float %84 + %86 = OpCompositeConstruct %v4float %85 %85 %85 %85 + OpStore %_GLF_color %86 + OpBranch %71 + %71 = OpLabel + OpReturn + OpFunctionEnd + %f1_vf2_ = OpFunction %int None %23 + %v1 = OpFunctionParameter %_ptr_Function_v2float + %87 = OpLabel + %88 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %89 = OpLoad %float %88 + %90 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %91 = OpLoad %float %90 + %92 = OpFOrdEqual %bool %89 %91 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + %95 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %96 = OpLoad %float %95 + %97 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %98 = OpLoad %float %97 + %99 = OpFOrdEqual %bool %96 %98 + OpBranch %93 + %93 = OpLabel + %100 = OpPhi %bool %92 %87 %99 %94 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %104 = OpLoad %int %103 + OpReturnValue %104 + %101 = OpLabel + %105 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %106 = OpLoad %int %105 + OpReturnValue %106 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..96a4bf3cee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.hlsl @@ -0,0 +1,81 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int f1_vf2_(inout float2 v1) { + bool x_99 = false; + bool x_100_phi = false; + const float x_89 = v1.x; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_91 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + const bool x_92 = (x_89 == x_91); + x_100_phi = x_92; + if (x_92) { + const float x_96 = v1.y; + const float x_98 = asfloat(x_7[1].x); + x_99 = (x_96 == x_98); + x_100_phi = x_99; + } + if (x_100_phi) { + const int x_104 = asint(x_9[1].x); + return x_104; + } + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_106 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + return x_106; +} + +void main_1() { + float2x2 m1 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 m2 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2 v1_1 = float2(0.0f, 0.0f); + int a = 0; + float2 param = float2(0.0f, 0.0f); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_47 = asfloat(x_7[1].x); + const float x_50 = asfloat(x_7[1].x); + const float x_52 = asfloat(x_7[1].x); + m1 = float2x2(float2(x_45, -(x_47)), float2(x_50, sin(x_52))); + m2 = mul(m1, m1); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_61 = asfloat(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + v1_1 = mul(m2, float2(x_61, x_61)); + param = v1_1; + const int x_66 = f1_vf2_(param); + a = x_66; + const int x_67 = a; + const int x_69 = asint(x_9[1].x); + if ((x_67 == x_69)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_75 = asfloat(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_77 = asfloat(x_7[1].x); + const float x_79 = asfloat(x_7[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_81 = asfloat(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(x_75, x_77, x_79, x_81); + } else { + const int x_84 = asint(x_9[1].x); + const float x_85 = float(x_84); + x_GLF_color = float4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..47967f74b3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.msl @@ -0,0 +1,97 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int f1_vf2_(constant buf0& x_7, constant buf1& x_9, thread float2* const v1) { + bool x_99 = false; + bool x_100_phi = false; + float const x_89 = (*(v1)).x; + float const x_91 = x_7.x_GLF_uniform_float_values.arr[0].el; + bool const x_92 = (x_89 == x_91); + x_100_phi = x_92; + if (x_92) { + float const x_96 = (*(v1)).y; + float const x_98 = x_7.x_GLF_uniform_float_values.arr[1].el; + x_99 = (x_96 == x_98); + x_100_phi = x_99; + } + bool const x_100 = x_100_phi; + if (x_100) { + int const x_104 = x_9.x_GLF_uniform_int_values.arr[1].el; + return x_104; + } + int const x_106 = x_9.x_GLF_uniform_int_values.arr[0].el; + return x_106; +} + +void main_1(constant buf0& x_7, constant buf1& x_9, thread float4* const tint_symbol_4) { + float2x2 m1 = float2x2(0.0f); + float2x2 m2 = float2x2(0.0f); + float2 v1_1 = 0.0f; + int a = 0; + float2 param = 0.0f; + float const x_45 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_47 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_50 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_52 = x_7.x_GLF_uniform_float_values.arr[1].el; + m1 = float2x2(float2(x_45, -(x_47)), float2(x_50, sin(x_52))); + float2x2 const x_57 = m1; + float2x2 const x_58 = m1; + m2 = (x_57 * x_58); + float const x_61 = x_7.x_GLF_uniform_float_values.arr[0].el; + float2x2 const x_63 = m2; + v1_1 = (float2(x_61, x_61) * x_63); + float2 const x_65 = v1_1; + param = x_65; + int const x_66 = f1_vf2_(x_7, x_9, &(param)); + a = x_66; + int const x_67 = a; + int const x_69 = x_9.x_GLF_uniform_int_values.arr[1].el; + if ((x_67 == x_69)) { + float const x_75 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_77 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_79 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_81 = x_7.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_75, x_77, x_79, x_81); + } else { + int const x_84 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_85 = float(x_84); + *(tint_symbol_4) = float4(x_85, x_85, x_85, x_85); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f217e599f4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.spvasm @@ -0,0 +1,202 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 131 +; Schema: 0 + OpCapability Shader + %85 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %f1_vf2_ "f1_vf2_" + OpName %v1 "v1" + OpName %x_99 "x_99" + OpName %x_100_phi "x_100_phi" + OpName %main_1 "main_1" + OpName %m1 "m1" + OpName %m2 "m2" + OpName %v1_1 "v1_1" + OpName %a "a" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %19 = OpTypeFunction %int %_ptr_Function_v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %28 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %void = OpTypeVoid + %59 = OpTypeFunction %void +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %66 = OpConstantNull %mat2v2float + %69 = OpConstantNull %v2float +%_ptr_Function_int = OpTypePointer Function %int + %72 = OpConstantNull %int + %main_out = OpTypeStruct %v4float + %119 = OpTypeFunction %void %main_out + %f1_vf2_ = OpFunction %int None %19 + %v1 = OpFunctionParameter %_ptr_Function_v2float + %24 = OpLabel + %x_99 = OpVariable %_ptr_Function_bool Function %28 + %x_100_phi = OpVariable %_ptr_Function_bool Function %28 + %33 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %34 = OpLoad %float %33 + %37 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpFOrdEqual %bool %34 %38 + OpStore %x_100_phi %39 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + %44 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %45 = OpLoad %float %44 + %47 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %48 = OpLoad %float %47 + %49 = OpFOrdEqual %bool %45 %48 + OpStore %x_99 %49 + %50 = OpLoad %bool %x_99 + OpStore %x_100_phi %50 + OpBranch %40 + %40 = OpLabel + %51 = OpLoad %bool %x_100_phi + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %56 = OpLoad %int %55 + OpReturnValue %56 + %52 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %58 = OpLoad %int %57 + OpReturnValue %58 + OpFunctionEnd + %main_1 = OpFunction %void None %59 + %62 = OpLabel + %m1 = OpVariable %_ptr_Function_mat2v2float Function %66 + %m2 = OpVariable %_ptr_Function_mat2v2float Function %66 + %v1_1 = OpVariable %_ptr_Function_v2float Function %69 + %a = OpVariable %_ptr_Function_int Function %72 + %param = OpVariable %_ptr_Function_v2float Function %69 + %74 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %81 = OpLoad %float %80 + %82 = OpFNegate %float %77 + %83 = OpCompositeConstruct %v2float %75 %82 + %84 = OpExtInst %float %85 Sin %81 + %86 = OpCompositeConstruct %v2float %79 %84 + %87 = OpCompositeConstruct %mat2v2float %83 %86 + OpStore %m1 %87 + %88 = OpLoad %mat2v2float %m1 + %89 = OpLoad %mat2v2float %m1 + %90 = OpMatrixTimesMatrix %mat2v2float %88 %89 + OpStore %m2 %90 + %91 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %92 = OpLoad %float %91 + %93 = OpLoad %mat2v2float %m2 + %94 = OpCompositeConstruct %v2float %92 %92 + %95 = OpVectorTimesMatrix %v2float %94 %93 + OpStore %v1_1 %95 + %96 = OpLoad %v2float %v1_1 + OpStore %param %96 + %97 = OpFunctionCall %int %f1_vf2_ %param + OpStore %a %97 + %99 = OpLoad %int %a + %100 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %101 = OpLoad %int %100 + %102 = OpIEqual %bool %99 %101 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %107 = OpLoad %float %106 + %108 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %109 = OpLoad %float %108 + %110 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %111 = OpLoad %float %110 + %112 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %113 = OpLoad %float %112 + %114 = OpCompositeConstruct %v4float %107 %109 %111 %113 + OpStore %x_GLF_color %114 + OpBranch %103 + %105 = OpLabel + %115 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %116 + %118 = OpCompositeConstruct %v4float %117 %117 %117 %117 + OpStore %x_GLF_color %118 + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %119 +%tint_symbol = OpFunctionParameter %main_out + %123 = OpLabel + %124 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %124 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %59 + %126 = OpLabel + %127 = OpFunctionCall %void %main_1 + %129 = OpLoad %v4float %x_GLF_color + %130 = OpCompositeConstruct %main_out %129 + %128 = OpFunctionCall %void %tint_symbol_2 %130 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c0a7f76ff6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.spvasm.expected.wgsl @@ -0,0 +1,89 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn f1_vf2_(v1 : ptr>) -> i32 { + var x_99 : bool; + var x_100_phi : bool; + let x_89 : f32 = (*(v1)).x; + let x_91 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_92 : bool = (x_89 == x_91); + x_100_phi = x_92; + if (x_92) { + let x_96 : f32 = (*(v1)).y; + let x_98 : f32 = x_7.x_GLF_uniform_float_values[1]; + x_99 = (x_96 == x_98); + x_100_phi = x_99; + } + let x_100 : bool = x_100_phi; + if (x_100) { + let x_104 : i32 = x_9.x_GLF_uniform_int_values[1]; + return x_104; + } + let x_106 : i32 = x_9.x_GLF_uniform_int_values[0]; + return x_106; +} + +fn main_1() { + var m1 : mat2x2; + var m2 : mat2x2; + var v1_1 : vec2; + var a : i32; + var param : vec2; + let x_45 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_47 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_50 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_52 : f32 = x_7.x_GLF_uniform_float_values[1]; + m1 = mat2x2(vec2(x_45, -(x_47)), vec2(x_50, sin(x_52))); + let x_57 : mat2x2 = m1; + let x_58 : mat2x2 = m1; + m2 = (x_57 * x_58); + let x_61 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_63 : mat2x2 = m2; + v1_1 = (vec2(x_61, x_61) * x_63); + let x_65 : vec2 = v1_1; + param = x_65; + let x_66 : i32 = f1_vf2_(&(param)); + a = x_66; + let x_67 : i32 = a; + let x_69 : i32 = x_9.x_GLF_uniform_int_values[1]; + if ((x_67 == x_69)) { + let x_75 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_77 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_79 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_81 : f32 = x_7.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_75, x_77, x_79, x_81); + } else { + let x_84 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_85 : f32 = f32(x_84); + x_GLF_color = vec4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl new file mode 100644 index 0000000000..c0a7f76ff6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl @@ -0,0 +1,89 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn f1_vf2_(v1 : ptr>) -> i32 { + var x_99 : bool; + var x_100_phi : bool; + let x_89 : f32 = (*(v1)).x; + let x_91 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_92 : bool = (x_89 == x_91); + x_100_phi = x_92; + if (x_92) { + let x_96 : f32 = (*(v1)).y; + let x_98 : f32 = x_7.x_GLF_uniform_float_values[1]; + x_99 = (x_96 == x_98); + x_100_phi = x_99; + } + let x_100 : bool = x_100_phi; + if (x_100) { + let x_104 : i32 = x_9.x_GLF_uniform_int_values[1]; + return x_104; + } + let x_106 : i32 = x_9.x_GLF_uniform_int_values[0]; + return x_106; +} + +fn main_1() { + var m1 : mat2x2; + var m2 : mat2x2; + var v1_1 : vec2; + var a : i32; + var param : vec2; + let x_45 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_47 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_50 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_52 : f32 = x_7.x_GLF_uniform_float_values[1]; + m1 = mat2x2(vec2(x_45, -(x_47)), vec2(x_50, sin(x_52))); + let x_57 : mat2x2 = m1; + let x_58 : mat2x2 = m1; + m2 = (x_57 * x_58); + let x_61 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_63 : mat2x2 = m2; + v1_1 = (vec2(x_61, x_61) * x_63); + let x_65 : vec2 = v1_1; + param = x_65; + let x_66 : i32 = f1_vf2_(&(param)); + a = x_66; + let x_67 : i32 = a; + let x_69 : i32 = x_9.x_GLF_uniform_int_values[1]; + if ((x_67 == x_69)) { + let x_75 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_77 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_79 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_81 : f32 = x_7.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_75, x_77, x_79, x_81); + } else { + let x_84 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_85 : f32 = f32(x_84); + x_GLF_color = vec4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..96a4bf3cee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.hlsl @@ -0,0 +1,81 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int f1_vf2_(inout float2 v1) { + bool x_99 = false; + bool x_100_phi = false; + const float x_89 = v1.x; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_91 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + const bool x_92 = (x_89 == x_91); + x_100_phi = x_92; + if (x_92) { + const float x_96 = v1.y; + const float x_98 = asfloat(x_7[1].x); + x_99 = (x_96 == x_98); + x_100_phi = x_99; + } + if (x_100_phi) { + const int x_104 = asint(x_9[1].x); + return x_104; + } + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_106 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + return x_106; +} + +void main_1() { + float2x2 m1 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 m2 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2 v1_1 = float2(0.0f, 0.0f); + int a = 0; + float2 param = float2(0.0f, 0.0f); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_45 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_47 = asfloat(x_7[1].x); + const float x_50 = asfloat(x_7[1].x); + const float x_52 = asfloat(x_7[1].x); + m1 = float2x2(float2(x_45, -(x_47)), float2(x_50, sin(x_52))); + m2 = mul(m1, m1); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_61 = asfloat(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + v1_1 = mul(m2, float2(x_61, x_61)); + param = v1_1; + const int x_66 = f1_vf2_(param); + a = x_66; + const int x_67 = a; + const int x_69 = asint(x_9[1].x); + if ((x_67 == x_69)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_75 = asfloat(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_77 = asfloat(x_7[1].x); + const float x_79 = asfloat(x_7[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_81 = asfloat(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(x_75, x_77, x_79, x_81); + } else { + const int x_84 = asint(x_9[1].x); + const float x_85 = float(x_84); + x_GLF_color = float4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..47967f74b3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.msl @@ -0,0 +1,97 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int f1_vf2_(constant buf0& x_7, constant buf1& x_9, thread float2* const v1) { + bool x_99 = false; + bool x_100_phi = false; + float const x_89 = (*(v1)).x; + float const x_91 = x_7.x_GLF_uniform_float_values.arr[0].el; + bool const x_92 = (x_89 == x_91); + x_100_phi = x_92; + if (x_92) { + float const x_96 = (*(v1)).y; + float const x_98 = x_7.x_GLF_uniform_float_values.arr[1].el; + x_99 = (x_96 == x_98); + x_100_phi = x_99; + } + bool const x_100 = x_100_phi; + if (x_100) { + int const x_104 = x_9.x_GLF_uniform_int_values.arr[1].el; + return x_104; + } + int const x_106 = x_9.x_GLF_uniform_int_values.arr[0].el; + return x_106; +} + +void main_1(constant buf0& x_7, constant buf1& x_9, thread float4* const tint_symbol_4) { + float2x2 m1 = float2x2(0.0f); + float2x2 m2 = float2x2(0.0f); + float2 v1_1 = 0.0f; + int a = 0; + float2 param = 0.0f; + float const x_45 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_47 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_50 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_52 = x_7.x_GLF_uniform_float_values.arr[1].el; + m1 = float2x2(float2(x_45, -(x_47)), float2(x_50, sin(x_52))); + float2x2 const x_57 = m1; + float2x2 const x_58 = m1; + m2 = (x_57 * x_58); + float const x_61 = x_7.x_GLF_uniform_float_values.arr[0].el; + float2x2 const x_63 = m2; + v1_1 = (float2(x_61, x_61) * x_63); + float2 const x_65 = v1_1; + param = x_65; + int const x_66 = f1_vf2_(x_7, x_9, &(param)); + a = x_66; + int const x_67 = a; + int const x_69 = x_9.x_GLF_uniform_int_values.arr[1].el; + if ((x_67 == x_69)) { + float const x_75 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_77 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_79 = x_7.x_GLF_uniform_float_values.arr[1].el; + float const x_81 = x_7.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_75, x_77, x_79, x_81); + } else { + int const x_84 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_85 = float(x_84); + *(tint_symbol_4) = float4(x_85, x_85, x_85, x_85); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f217e599f4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.spvasm @@ -0,0 +1,202 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 131 +; Schema: 0 + OpCapability Shader + %85 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %f1_vf2_ "f1_vf2_" + OpName %v1 "v1" + OpName %x_99 "x_99" + OpName %x_100_phi "x_100_phi" + OpName %main_1 "main_1" + OpName %m1 "m1" + OpName %m2 "m2" + OpName %v1_1 "v1_1" + OpName %a "a" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf0 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %19 = OpTypeFunction %int %_ptr_Function_v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %28 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %void = OpTypeVoid + %59 = OpTypeFunction %void +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %66 = OpConstantNull %mat2v2float + %69 = OpConstantNull %v2float +%_ptr_Function_int = OpTypePointer Function %int + %72 = OpConstantNull %int + %main_out = OpTypeStruct %v4float + %119 = OpTypeFunction %void %main_out + %f1_vf2_ = OpFunction %int None %19 + %v1 = OpFunctionParameter %_ptr_Function_v2float + %24 = OpLabel + %x_99 = OpVariable %_ptr_Function_bool Function %28 + %x_100_phi = OpVariable %_ptr_Function_bool Function %28 + %33 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %34 = OpLoad %float %33 + %37 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpFOrdEqual %bool %34 %38 + OpStore %x_100_phi %39 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + %44 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %45 = OpLoad %float %44 + %47 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %48 = OpLoad %float %47 + %49 = OpFOrdEqual %bool %45 %48 + OpStore %x_99 %49 + %50 = OpLoad %bool %x_99 + OpStore %x_100_phi %50 + OpBranch %40 + %40 = OpLabel + %51 = OpLoad %bool %x_100_phi + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %56 = OpLoad %int %55 + OpReturnValue %56 + %52 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %58 = OpLoad %int %57 + OpReturnValue %58 + OpFunctionEnd + %main_1 = OpFunction %void None %59 + %62 = OpLabel + %m1 = OpVariable %_ptr_Function_mat2v2float Function %66 + %m2 = OpVariable %_ptr_Function_mat2v2float Function %66 + %v1_1 = OpVariable %_ptr_Function_v2float Function %69 + %a = OpVariable %_ptr_Function_int Function %72 + %param = OpVariable %_ptr_Function_v2float Function %69 + %74 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %81 = OpLoad %float %80 + %82 = OpFNegate %float %77 + %83 = OpCompositeConstruct %v2float %75 %82 + %84 = OpExtInst %float %85 Sin %81 + %86 = OpCompositeConstruct %v2float %79 %84 + %87 = OpCompositeConstruct %mat2v2float %83 %86 + OpStore %m1 %87 + %88 = OpLoad %mat2v2float %m1 + %89 = OpLoad %mat2v2float %m1 + %90 = OpMatrixTimesMatrix %mat2v2float %88 %89 + OpStore %m2 %90 + %91 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %92 = OpLoad %float %91 + %93 = OpLoad %mat2v2float %m2 + %94 = OpCompositeConstruct %v2float %92 %92 + %95 = OpVectorTimesMatrix %v2float %94 %93 + OpStore %v1_1 %95 + %96 = OpLoad %v2float %v1_1 + OpStore %param %96 + %97 = OpFunctionCall %int %f1_vf2_ %param + OpStore %a %97 + %99 = OpLoad %int %a + %100 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %101 = OpLoad %int %100 + %102 = OpIEqual %bool %99 %101 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %107 = OpLoad %float %106 + %108 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %109 = OpLoad %float %108 + %110 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %111 = OpLoad %float %110 + %112 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %113 = OpLoad %float %112 + %114 = OpCompositeConstruct %v4float %107 %109 %111 %113 + OpStore %x_GLF_color %114 + OpBranch %103 + %105 = OpLabel + %115 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %116 + %118 = OpCompositeConstruct %v4float %117 %117 %117 %117 + OpStore %x_GLF_color %118 + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %119 +%tint_symbol = OpFunctionParameter %main_out + %123 = OpLabel + %124 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %124 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %59 + %126 = OpLabel + %127 = OpFunctionCall %void %main_1 + %129 = OpLoad %v4float %x_GLF_color + %130 = OpCompositeConstruct %main_out %129 + %128 = OpFunctionCall %void %tint_symbol_2 %130 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c0a7f76ff6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sin-mul-mat-mat-mul-vec-mat/0-opt.wgsl.expected.wgsl @@ -0,0 +1,89 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_9 : buf1; + +var x_GLF_color : vec4; + +fn f1_vf2_(v1 : ptr>) -> i32 { + var x_99 : bool; + var x_100_phi : bool; + let x_89 : f32 = (*(v1)).x; + let x_91 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_92 : bool = (x_89 == x_91); + x_100_phi = x_92; + if (x_92) { + let x_96 : f32 = (*(v1)).y; + let x_98 : f32 = x_7.x_GLF_uniform_float_values[1]; + x_99 = (x_96 == x_98); + x_100_phi = x_99; + } + let x_100 : bool = x_100_phi; + if (x_100) { + let x_104 : i32 = x_9.x_GLF_uniform_int_values[1]; + return x_104; + } + let x_106 : i32 = x_9.x_GLF_uniform_int_values[0]; + return x_106; +} + +fn main_1() { + var m1 : mat2x2; + var m2 : mat2x2; + var v1_1 : vec2; + var a : i32; + var param : vec2; + let x_45 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_47 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_50 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_52 : f32 = x_7.x_GLF_uniform_float_values[1]; + m1 = mat2x2(vec2(x_45, -(x_47)), vec2(x_50, sin(x_52))); + let x_57 : mat2x2 = m1; + let x_58 : mat2x2 = m1; + m2 = (x_57 * x_58); + let x_61 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_63 : mat2x2 = m2; + v1_1 = (vec2(x_61, x_61) * x_63); + let x_65 : vec2 = v1_1; + param = x_65; + let x_66 : i32 = f1_vf2_(&(param)); + a = x_66; + let x_67 : i32 = a; + let x_69 : i32 = x_9.x_GLF_uniform_int_values[1]; + if ((x_67 == x_69)) { + let x_75 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_77 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_79 : f32 = x_7.x_GLF_uniform_float_values[1]; + let x_81 : f32 = x_7.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_75, x_77, x_79, x_81); + } else { + let x_84 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_85 : f32 = f32(x_84); + x_GLF_color = vec4(x_85, x_85, x_85, x_85); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm new file mode 100644 index 0000000000..a0e6aa1066 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm @@ -0,0 +1,116 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %g "g" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpDecorate %g RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %a RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %g = OpVariable %_ptr_Private_int Private + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint_1 = OpConstant %uint 1 + %int_2 = OpConstant %int 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %18 + %40 = OpLabel + %a = OpVariable %_ptr_Function_int Function + OpStore %g %int_0 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %8 = OpLoad %int %g + %45 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %46 = OpLoad %float %45 + %47 = OpFAdd %float %46 %float_2 + %48 = OpConvertFToS %int %47 + %49 = OpSLessThan %bool %8 %48 + OpBranchConditional %49 %50 %42 + %50 = OpLabel + %9 = OpLoad %int %g + %10 = OpIAdd %int %9 %int_1 + OpStore %g %10 + OpBranch %43 + %43 = OpLabel + OpBranch %41 + %42 = OpLabel + %11 = OpLoad %int %g + OpStore %a %11 + OpBranch %51 + %51 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %12 = OpLoad %int %g + %55 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %56 = OpLoad %float %55 + %57 = OpConvertFToS %int %56 + %58 = OpSLessThan %bool %12 %57 + OpBranchConditional %58 %59 %52 + %59 = OpLabel + %13 = OpLoad %int %g + %14 = OpIAdd %int %13 %int_1 + OpStore %g %14 + OpBranch %53 + %53 = OpLabel + OpBranch %51 + %52 = OpLabel + %15 = OpLoad %int %a + OpStore %a %15 + %16 = OpLoad %int %a + %60 = OpIEqual %bool %16 %int_2 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpStore %_GLF_color %38 + OpBranch %61 + %63 = OpLabel + OpStore %_GLF_color %39 + OpBranch %61 + %61 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ca61b5224d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.hlsl @@ -0,0 +1,50 @@ +static int g = 0; +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + g = 0; + while (true) { + const int x_8 = g; + const float x_46 = asfloat(x_6[0].x); + if ((x_8 < int((x_46 + 2.0f)))) { + } else { + break; + } + g = (g + 1); + } + a = g; + while (true) { + const int x_12 = g; + const float x_56 = asfloat(x_6[0].y); + if ((x_12 < int(x_56))) { + } else { + break; + } + g = (g + 1); + } + a = a; + if ((a == 2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..0bb48330e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + int a = 0; + *(tint_symbol_4) = 0; + while (true) { + int const x_8 = *(tint_symbol_4); + float const x_46 = x_6.injectionSwitch.x; + if ((x_8 < int((x_46 + 2.0f)))) { + } else { + break; + } + int const x_9 = *(tint_symbol_4); + *(tint_symbol_4) = (x_9 + 1); + } + int const x_11 = *(tint_symbol_4); + a = x_11; + while (true) { + int const x_12 = *(tint_symbol_4); + float const x_56 = x_6.injectionSwitch.y; + if ((x_12 < int(x_56))) { + } else { + break; + } + int const x_13 = *(tint_symbol_4); + *(tint_symbol_4) = (x_13 + 1); + } + int const x_15 = a; + a = x_15; + int const x_16 = a; + if ((x_16 == 2)) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_6, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e43ed3bfa4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.spvasm @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 83 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %g "g" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %g = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %69 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %70 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %71 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %16 + %19 = OpLabel + %a = OpVariable %_ptr_Function_int Function %4 + OpStore %g %int_0 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %27 = OpLoad %int %g + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %32 = OpLoad %float %31 + %35 = OpFAdd %float %32 %float_2 + %33 = OpConvertFToS %int %35 + %36 = OpSLessThan %bool %27 %33 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + OpBranch %38 + %40 = OpLabel + OpBranch %24 + %38 = OpLabel + %41 = OpLoad %int %g + %43 = OpIAdd %int %41 %int_1 + OpStore %g %43 + OpBranch %25 + %25 = OpLabel + OpBranch %23 + %24 = OpLabel + %44 = OpLoad %int %g + OpStore %a %44 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %g + %51 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %52 = OpLoad %float %51 + %53 = OpConvertFToS %int %52 + %54 = OpSLessThan %bool %49 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %46 + %55 = OpLabel + %58 = OpLoad %int %g + %59 = OpIAdd %int %58 %int_1 + OpStore %g %59 + OpBranch %47 + %47 = OpLabel + OpBranch %45 + %46 = OpLabel + %60 = OpLoad %int %a + OpStore %a %60 + %61 = OpLoad %int %a + %63 = OpIEqual %bool %61 %int_2 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %66 + %65 = OpLabel + OpStore %x_GLF_color %69 + OpBranch %64 + %66 = OpLabel + OpStore %x_GLF_color %70 + OpBranch %64 + %64 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %71 +%tint_symbol = OpFunctionParameter %main_out + %75 = OpLabel + %76 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %76 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %16 + %78 = OpLabel + %79 = OpFunctionCall %void %main_1 + %81 = OpLoad %v4float %x_GLF_color + %82 = OpCompositeConstruct %main_out %81 + %80 = OpFunctionCall %void %tint_symbol_2 %82 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..8a01eaaa0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.spvasm.expected.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var g : i32; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + g = 0; + loop { + let x_8 : i32 = g; + let x_46 : f32 = x_6.injectionSwitch.x; + if ((x_8 < i32((x_46 + 2.0)))) { + } else { + break; + } + let x_9 : i32 = g; + g = (x_9 + 1); + } + let x_11 : i32 = g; + a = x_11; + loop { + let x_12 : i32 = g; + let x_56 : f32 = x_6.injectionSwitch.y; + if ((x_12 < i32(x_56))) { + } else { + break; + } + let x_13 : i32 = g; + g = (x_13 + 1); + } + let x_15 : i32 = a; + a = x_15; + let x_16 : i32 = a; + if ((x_16 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl new file mode 100644 index 0000000000..8a01eaaa0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var g : i32; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + g = 0; + loop { + let x_8 : i32 = g; + let x_46 : f32 = x_6.injectionSwitch.x; + if ((x_8 < i32((x_46 + 2.0)))) { + } else { + break; + } + let x_9 : i32 = g; + g = (x_9 + 1); + } + let x_11 : i32 = g; + a = x_11; + loop { + let x_12 : i32 = g; + let x_56 : f32 = x_6.injectionSwitch.y; + if ((x_12 < i32(x_56))) { + } else { + break; + } + let x_13 : i32 = g; + g = (x_13 + 1); + } + let x_15 : i32 = a; + a = x_15; + let x_16 : i32 = a; + if ((x_16 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..ca61b5224d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.hlsl @@ -0,0 +1,50 @@ +static int g = 0; +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + g = 0; + while (true) { + const int x_8 = g; + const float x_46 = asfloat(x_6[0].x); + if ((x_8 < int((x_46 + 2.0f)))) { + } else { + break; + } + g = (g + 1); + } + a = g; + while (true) { + const int x_12 = g; + const float x_56 = asfloat(x_6[0].y); + if ((x_12 < int(x_56))) { + } else { + break; + } + g = (g + 1); + } + a = a; + if ((a == 2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..0bb48330e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) { + int a = 0; + *(tint_symbol_4) = 0; + while (true) { + int const x_8 = *(tint_symbol_4); + float const x_46 = x_6.injectionSwitch.x; + if ((x_8 < int((x_46 + 2.0f)))) { + } else { + break; + } + int const x_9 = *(tint_symbol_4); + *(tint_symbol_4) = (x_9 + 1); + } + int const x_11 = *(tint_symbol_4); + a = x_11; + while (true) { + int const x_12 = *(tint_symbol_4); + float const x_56 = x_6.injectionSwitch.y; + if ((x_12 < int(x_56))) { + } else { + break; + } + int const x_13 = *(tint_symbol_4); + *(tint_symbol_4) = (x_13 + 1); + } + int const x_15 = a; + a = x_15; + int const x_16 = a; + if ((x_16 == 2)) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread int tint_symbol_6 = 0; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_6, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e43ed3bfa4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.spvasm @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 83 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %g "g" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %g = OpVariable %_ptr_Private_int Private %4 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %69 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %70 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %71 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %16 + %19 = OpLabel + %a = OpVariable %_ptr_Function_int Function %4 + OpStore %g %int_0 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %27 = OpLoad %int %g + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %32 = OpLoad %float %31 + %35 = OpFAdd %float %32 %float_2 + %33 = OpConvertFToS %int %35 + %36 = OpSLessThan %bool %27 %33 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + OpBranch %38 + %40 = OpLabel + OpBranch %24 + %38 = OpLabel + %41 = OpLoad %int %g + %43 = OpIAdd %int %41 %int_1 + OpStore %g %43 + OpBranch %25 + %25 = OpLabel + OpBranch %23 + %24 = OpLabel + %44 = OpLoad %int %g + OpStore %a %44 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %g + %51 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %52 = OpLoad %float %51 + %53 = OpConvertFToS %int %52 + %54 = OpSLessThan %bool %49 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %46 + %55 = OpLabel + %58 = OpLoad %int %g + %59 = OpIAdd %int %58 %int_1 + OpStore %g %59 + OpBranch %47 + %47 = OpLabel + OpBranch %45 + %46 = OpLabel + %60 = OpLoad %int %a + OpStore %a %60 + %61 = OpLoad %int %a + %63 = OpIEqual %bool %61 %int_2 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %66 + %65 = OpLabel + OpStore %x_GLF_color %69 + OpBranch %64 + %66 = OpLabel + OpStore %x_GLF_color %70 + OpBranch %64 + %64 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %71 +%tint_symbol = OpFunctionParameter %main_out + %75 = OpLabel + %76 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %76 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %16 + %78 = OpLabel + %79 = OpFunctionCall %void %main_1 + %81 = OpLoad %v4float %x_GLF_color + %82 = OpCompositeConstruct %main_out %81 + %80 = OpFunctionCall %void %tint_symbol_2 %82 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..8a01eaaa0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-single-block-elim-self-assign/0-opt.wgsl.expected.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var g : i32; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + g = 0; + loop { + let x_8 : i32 = g; + let x_46 : f32 = x_6.injectionSwitch.x; + if ((x_8 < i32((x_46 + 2.0)))) { + } else { + break; + } + let x_9 : i32 = g; + g = (x_9 + 1); + } + let x_11 : i32 = g; + a = x_11; + loop { + let x_12 : i32 = g; + let x_56 : f32 = x_6.injectionSwitch.y; + if ((x_12 < i32(x_56))) { + } else { + break; + } + let x_13 : i32 = g; + g = (x_13 + 1); + } + let x_15 : i32 = a; + a = x_15; + let x_16 : i32 = a; + if ((x_16 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm new file mode 100644 index 0000000000..84447e9b9e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm @@ -0,0 +1,129 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v1 "v1" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %v2 "v2" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %v3 "v3" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_n3000 = OpConstant %int -3000 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %14 + %39 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function + %v2 = OpVariable %_ptr_Function_v2int Function + %v3 = OpVariable %_ptr_Function_v2float Function + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %43 = OpLoad %float %42 + %44 = OpCompositeConstruct %v2float %41 %43 + %45 = OpExtInst %v2float %1 Sinh %44 + OpStore %v1 %45 + %46 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpCompositeConstruct %v2int %47 %int_n3000 + OpStore %v2 %48 + %49 = OpLoad %v2float %v1 + %50 = OpLoad %v2int %v2 + %51 = OpExtInst %v2float %1 Ldexp %49 %50 + OpStore %v3 %51 + %52 = OpAccessChain %_ptr_Function_float %v3 %uint_1 + %53 = OpLoad %float %52 + %54 = OpCompositeConstruct %v4float %53 %53 %53 %53 + OpStore %_GLF_color %54 + %55 = OpAccessChain %_ptr_Function_float %v3 %uint_0 + %56 = OpLoad %float %55 + %57 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpFOrdGreaterThan %bool %56 %58 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %60 + %61 = OpLabel + %62 = OpAccessChain %_ptr_Function_float %v3 %uint_0 + %63 = OpLoad %float %62 + %64 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %65 = OpLoad %float %64 + %66 = OpFOrdLessThan %bool %63 %65 + OpBranch %60 + %60 = OpLabel + %67 = OpPhi %bool %59 %39 %66 %61 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %72 + %74 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpConvertSToF %float %78 + %80 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %81 + %83 = OpCompositeConstruct %v4float %73 %76 %79 %82 + OpStore %_GLF_color %83 + OpBranch %68 + %70 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %85 + %87 = OpCompositeConstruct %v4float %86 %86 %86 %86 + OpStore %_GLF_color %87 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..0c6ec66bb0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,63 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v1 = float2(0.0f, 0.0f); + int2 v2 = int2(0, 0); + float2 v3 = float2(0.0f, 0.0f); + bool x_66 = false; + bool x_67_phi = false; + const float x_41 = asfloat(x_6[2].x); + const float x_43 = asfloat(x_6[3].x); + v1 = sinh(float2(x_41, x_43)); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_47 = asint(x_9[scalar_offset / 4][scalar_offset % 4]); + v2 = int2(x_47, -3000); + v3 = ldexp(v1, v2); + const float x_53 = v3.y; + x_GLF_color = float4(x_53, x_53, x_53, x_53); + const float x_56 = v3.x; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_58 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const bool x_59 = (x_56 > x_58); + x_67_phi = x_59; + if (x_59) { + const float x_63 = v3.x; + const float x_65 = asfloat(x_6[1].x); + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + if (x_67_phi) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_72 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_75 = asint(x_9[1].x); + const int x_78 = asint(x_9[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_81 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + } else { + const int x_85 = asint(x_9[1].x); + const float x_86 = float(x_85); + x_GLF_color = float4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..0439234349 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + float2 v1 = 0.0f; + int2 v2 = 0; + float2 v3 = 0.0f; + bool x_66 = false; + bool x_67_phi = false; + float const x_41 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_43 = x_6.x_GLF_uniform_float_values.arr[3].el; + v1 = sinh(float2(x_41, x_43)); + int const x_47 = x_9.x_GLF_uniform_int_values.arr[0].el; + v2 = int2(x_47, -3000); + float2 const x_49 = v1; + int2 const x_50 = v2; + v3 = ldexp(x_49, x_50); + float const x_53 = v3.y; + *(tint_symbol_4) = float4(x_53, x_53, x_53, x_53); + float const x_56 = v3.x; + float const x_58 = x_6.x_GLF_uniform_float_values.arr[0].el; + bool const x_59 = (x_56 > x_58); + x_67_phi = x_59; + if (x_59) { + float const x_63 = v3.x; + float const x_65 = x_6.x_GLF_uniform_float_values.arr[1].el; + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + bool const x_67 = x_67_phi; + if (x_67) { + int const x_72 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_75 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_81 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + } else { + int const x_85 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_86 = float(x_85); + *(tint_symbol_4) = float4(x_86, x_86, x_86, x_86); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..7cba6b7b12 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,174 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 110 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %x_66 "x_66" + OpName %x_67_phi "x_67_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %27 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %31 = OpConstantNull %v2int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %36 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_n3000 = OpConstant %int -3000 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %98 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function %27 + %v2 = OpVariable %_ptr_Function_v2int Function %31 + %v3 = OpVariable %_ptr_Function_v2float Function %27 + %x_66 = OpVariable %_ptr_Function_bool Function %36 + %x_67_phi = OpVariable %_ptr_Function_bool Function %36 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %42 = OpLoad %float %41 + %44 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %45 = OpLoad %float %44 + %48 = OpCompositeConstruct %v2float %42 %45 + %46 = OpExtInst %v2float %47 Sinh %48 + OpStore %v1 %46 + %51 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %52 = OpLoad %int %51 + %54 = OpCompositeConstruct %v2int %52 %int_n3000 + OpStore %v2 %54 + %55 = OpLoad %v2float %v1 + %56 = OpLoad %v2int %v2 + %57 = OpExtInst %v2float %47 Ldexp %55 %56 + OpStore %v3 %57 + %60 = OpAccessChain %_ptr_Function_float %v3 %uint_1 + %61 = OpLoad %float %60 + %62 = OpCompositeConstruct %v4float %61 %61 %61 %61 + OpStore %x_GLF_color %62 + %63 = OpAccessChain %_ptr_Function_float %v3 %uint_0 + %64 = OpLoad %float %63 + %65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpFOrdGreaterThan %bool %64 %66 + OpStore %x_67_phi %67 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + %70 = OpAccessChain %_ptr_Function_float %v3 %uint_0 + %71 = OpLoad %float %70 + %73 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %74 = OpLoad %float %73 + %75 = OpFOrdLessThan %bool %71 %74 + OpStore %x_66 %75 + %76 = OpLoad %bool %x_66 + OpStore %x_67_phi %76 + OpBranch %68 + %68 = OpLabel + %77 = OpLoad %bool %x_67_phi + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %82 + %90 = OpConvertSToF %float %84 + %91 = OpConvertSToF %float %86 + %92 = OpConvertSToF %float %88 + %93 = OpCompositeConstruct %v4float %89 %90 %91 %92 + OpStore %x_GLF_color %93 + OpBranch %78 + %80 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpCompositeConstruct %v4float %96 %96 %96 %96 + OpStore %x_GLF_color %97 + OpBranch %78 + %78 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %98 +%tint_symbol = OpFunctionParameter %main_out + %102 = OpLabel + %103 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %103 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %105 = OpLabel + %106 = OpFunctionCall %void %main_1 + %108 = OpLoad %v4float %x_GLF_color + %109 = OpCompositeConstruct %main_out %108 + %107 = OpFunctionCall %void %tint_symbol_2 %109 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..6c083f8055 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec2; + var v2 : vec2; + var v3 : vec2; + var x_66 : bool; + var x_67_phi : bool; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[3]; + v1 = sinh(vec2(x_41, x_43)); + let x_47 : i32 = x_9.x_GLF_uniform_int_values[0]; + v2 = vec2(x_47, -3000); + let x_49 : vec2 = v1; + let x_50 : vec2 = v2; + v3 = ldexp(x_49, x_50); + let x_53 : f32 = v3.y; + x_GLF_color = vec4(x_53, x_53, x_53, x_53); + let x_56 : f32 = v3.x; + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_59 : bool = (x_56 > x_58); + x_67_phi = x_59; + if (x_59) { + let x_63 : f32 = v3.x; + let x_65 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + let x_67 : bool = x_67_phi; + if (x_67) { + let x_72 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_75 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_72), f32(x_75), f32(x_78), f32(x_81)); + } else { + let x_85 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_86 : f32 = f32(x_85); + x_GLF_color = vec4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl new file mode 100644 index 0000000000..6c083f8055 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec2; + var v2 : vec2; + var v3 : vec2; + var x_66 : bool; + var x_67_phi : bool; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[3]; + v1 = sinh(vec2(x_41, x_43)); + let x_47 : i32 = x_9.x_GLF_uniform_int_values[0]; + v2 = vec2(x_47, -3000); + let x_49 : vec2 = v1; + let x_50 : vec2 = v2; + v3 = ldexp(x_49, x_50); + let x_53 : f32 = v3.y; + x_GLF_color = vec4(x_53, x_53, x_53, x_53); + let x_56 : f32 = v3.x; + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_59 : bool = (x_56 > x_58); + x_67_phi = x_59; + if (x_59) { + let x_63 : f32 = v3.x; + let x_65 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + let x_67 : bool = x_67_phi; + if (x_67) { + let x_72 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_75 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_72), f32(x_75), f32(x_78), f32(x_81)); + } else { + let x_85 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_86 : f32 = f32(x_85); + x_GLF_color = vec4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..0c6ec66bb0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,63 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v1 = float2(0.0f, 0.0f); + int2 v2 = int2(0, 0); + float2 v3 = float2(0.0f, 0.0f); + bool x_66 = false; + bool x_67_phi = false; + const float x_41 = asfloat(x_6[2].x); + const float x_43 = asfloat(x_6[3].x); + v1 = sinh(float2(x_41, x_43)); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_47 = asint(x_9[scalar_offset / 4][scalar_offset % 4]); + v2 = int2(x_47, -3000); + v3 = ldexp(v1, v2); + const float x_53 = v3.y; + x_GLF_color = float4(x_53, x_53, x_53, x_53); + const float x_56 = v3.x; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_58 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const bool x_59 = (x_56 > x_58); + x_67_phi = x_59; + if (x_59) { + const float x_63 = v3.x; + const float x_65 = asfloat(x_6[1].x); + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + if (x_67_phi) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_72 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_75 = asint(x_9[1].x); + const int x_78 = asint(x_9[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_81 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + } else { + const int x_85 = asint(x_9[1].x); + const float x_86 = float(x_85); + x_GLF_color = float4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..0439234349 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + float2 v1 = 0.0f; + int2 v2 = 0; + float2 v3 = 0.0f; + bool x_66 = false; + bool x_67_phi = false; + float const x_41 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_43 = x_6.x_GLF_uniform_float_values.arr[3].el; + v1 = sinh(float2(x_41, x_43)); + int const x_47 = x_9.x_GLF_uniform_int_values.arr[0].el; + v2 = int2(x_47, -3000); + float2 const x_49 = v1; + int2 const x_50 = v2; + v3 = ldexp(x_49, x_50); + float const x_53 = v3.y; + *(tint_symbol_4) = float4(x_53, x_53, x_53, x_53); + float const x_56 = v3.x; + float const x_58 = x_6.x_GLF_uniform_float_values.arr[0].el; + bool const x_59 = (x_56 > x_58); + x_67_phi = x_59; + if (x_59) { + float const x_63 = v3.x; + float const x_65 = x_6.x_GLF_uniform_float_values.arr[1].el; + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + bool const x_67 = x_67_phi; + if (x_67) { + int const x_72 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_75 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_78 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_81 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_72), float(x_75), float(x_78), float(x_81)); + } else { + int const x_85 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_86 = float(x_85); + *(tint_symbol_4) = float4(x_86, x_86, x_86, x_86); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..7cba6b7b12 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,174 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 110 +; Schema: 0 + OpCapability Shader + %47 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %x_66 "x_66" + OpName %x_67_phi "x_67_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %buf1 = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %27 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %31 = OpConstantNull %v2int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %36 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_n3000 = OpConstant %int -3000 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %98 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function %27 + %v2 = OpVariable %_ptr_Function_v2int Function %31 + %v3 = OpVariable %_ptr_Function_v2float Function %27 + %x_66 = OpVariable %_ptr_Function_bool Function %36 + %x_67_phi = OpVariable %_ptr_Function_bool Function %36 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %42 = OpLoad %float %41 + %44 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_3 + %45 = OpLoad %float %44 + %48 = OpCompositeConstruct %v2float %42 %45 + %46 = OpExtInst %v2float %47 Sinh %48 + OpStore %v1 %46 + %51 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %52 = OpLoad %int %51 + %54 = OpCompositeConstruct %v2int %52 %int_n3000 + OpStore %v2 %54 + %55 = OpLoad %v2float %v1 + %56 = OpLoad %v2int %v2 + %57 = OpExtInst %v2float %47 Ldexp %55 %56 + OpStore %v3 %57 + %60 = OpAccessChain %_ptr_Function_float %v3 %uint_1 + %61 = OpLoad %float %60 + %62 = OpCompositeConstruct %v4float %61 %61 %61 %61 + OpStore %x_GLF_color %62 + %63 = OpAccessChain %_ptr_Function_float %v3 %uint_0 + %64 = OpLoad %float %63 + %65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpFOrdGreaterThan %bool %64 %66 + OpStore %x_67_phi %67 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + %70 = OpAccessChain %_ptr_Function_float %v3 %uint_0 + %71 = OpLoad %float %70 + %73 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %74 = OpLoad %float %73 + %75 = OpFOrdLessThan %bool %71 %74 + OpStore %x_66 %75 + %76 = OpLoad %bool %x_66 + OpStore %x_67_phi %76 + OpBranch %68 + %68 = OpLabel + %77 = OpLoad %bool %x_67_phi + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %82 + %90 = OpConvertSToF %float %84 + %91 = OpConvertSToF %float %86 + %92 = OpConvertSToF %float %88 + %93 = OpCompositeConstruct %v4float %89 %90 %91 %92 + OpStore %x_GLF_color %93 + OpBranch %78 + %80 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %95 = OpLoad %int %94 + %96 = OpConvertSToF %float %95 + %97 = OpCompositeConstruct %v4float %96 %96 %96 %96 + OpStore %x_GLF_color %97 + OpBranch %78 + %78 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %98 +%tint_symbol = OpFunctionParameter %main_out + %102 = OpLabel + %103 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %103 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %105 = OpLabel + %106 = OpFunctionCall %void %main_1 + %108 = OpLoad %v4float %x_GLF_color + %109 = OpCompositeConstruct %main_out %108 + %107 = OpFunctionCall %void %tint_symbol_2 %109 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..6c083f8055 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sinh-ldexp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,71 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec2; + var v2 : vec2; + var v3 : vec2; + var x_66 : bool; + var x_67_phi : bool; + let x_41 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_43 : f32 = x_6.x_GLF_uniform_float_values[3]; + v1 = sinh(vec2(x_41, x_43)); + let x_47 : i32 = x_9.x_GLF_uniform_int_values[0]; + v2 = vec2(x_47, -3000); + let x_49 : vec2 = v1; + let x_50 : vec2 = v2; + v3 = ldexp(x_49, x_50); + let x_53 : f32 = v3.y; + x_GLF_color = vec4(x_53, x_53, x_53, x_53); + let x_56 : f32 = v3.x; + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_59 : bool = (x_56 > x_58); + x_67_phi = x_59; + if (x_59) { + let x_63 : f32 = v3.x; + let x_65 : f32 = x_6.x_GLF_uniform_float_values[1]; + x_66 = (x_63 < x_65); + x_67_phi = x_66; + } + let x_67 : bool = x_67_phi; + if (x_67) { + let x_72 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_75 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_78 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_81 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_72), f32(x_75), f32(x_78), f32(x_81)); + } else { + let x_85 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_86 : f32 = f32(x_85); + x_GLF_color = vec4(x_86, x_86, x_86, x_86); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm new file mode 100644 index 0000000000..5ef5478795 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm @@ -0,0 +1,92 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %i "i" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %12 = OpTypeFunction %v4float + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %9 + %28 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %22 + OpStore %i %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %i + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %35 = OpLoad %int %34 + %36 = OpSLessThanEqual %bool %33 %35 + OpBranchConditional %36 %37 %30 + %37 = OpLabel + %38 = OpLoad %int %i + OpSelectionMerge %39 None + OpSwitch %38 %40 1 %41 0 %40 + %40 = OpLabel + %42 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_1 + OpStore %42 %float_0 + OpBranch %39 + %41 = OpLabel + %43 = OpFunctionCall %v4float %func_ + OpStore %_GLF_color %43 + OpBranch %40 + %39 = OpLabel + OpBranch %31 + %31 = OpLabel + %44 = OpLoad %int %i + %45 = OpIAdd %int %44 %int_1 + OpStore %i %45 + OpBranch %29 + %30 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %v4float None %12 + %46 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %48 = OpLoad %int %47 + %49 = OpIEqual %bool %48 %int_1 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + OpReturnValue %21 + %52 = OpLabel + OpReturnValue %22 + %50 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..aea4365c1c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.hlsl @@ -0,0 +1,60 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float4 func_() { + const int x_48 = asint(x_6[0].x); + if ((x_48 == 1)) { + return float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + return float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return float4(0.0f, 0.0f, 0.0f, 0.0f); +} + +void main_1() { + int i = 0; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + while (true) { + const int x_33 = i; + const int x_35 = asint(x_6[0].x); + if ((x_33 <= x_35)) { + } else { + break; + } + switch(i) { + case 1: { + const float4 x_43 = func_(); + x_GLF_color = x_43; + /* fallthrough */ + } + default: { + /* fallthrough */ + } + case 0: { + x_GLF_color.y = 0.0f; + break; + } + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..6614fe80f0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.msl @@ -0,0 +1,65 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float4 func_(constant buf0& x_6) { + int const x_48 = x_6.one; + if ((x_48 == 1)) { + return float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + return float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return float4(0.0f, 0.0f, 0.0f, 0.0f); +} + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + while (true) { + int const x_33 = i; + int const x_35 = x_6.one; + if ((x_33 <= x_35)) { + } else { + break; + } + int const x_38 = i; + switch(x_38) { + case 1: { + float4 const x_43 = func_(x_6); + *(tint_symbol_4) = x_43; + /* fallthrough */ + } + default: { + /* fallthrough */ + } + case 0: { + (*(tint_symbol_4)).y = 0.0f; + break; + } + } + { + int const x_44 = i; + i = (x_44 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..c8ef50f82a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.spvasm @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %12 = OpTypeFunction %v4float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %28 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %29 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %void = OpTypeVoid + %30 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %36 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %60 = OpTypeFunction %void %main_out + %func_ = OpFunction %v4float None %12 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %19 = OpLoad %int %18 + %21 = OpIEqual %bool %19 %int_1 + OpSelectionMerge %23 None + OpBranchConditional %21 %24 %25 + %24 = OpLabel + OpReturnValue %28 + %25 = OpLabel + OpReturnValue %29 + %23 = OpLabel + OpReturnValue %29 + OpFunctionEnd + %main_1 = OpFunction %void None %30 + %33 = OpLabel + %i = OpVariable %_ptr_Function_int Function %36 + OpStore %x_GLF_color %29 + OpStore %i %int_0 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %int %i + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %44 = OpLoad %int %43 + %45 = OpSLessThanEqual %bool %42 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %39 + %46 = OpLabel + %49 = OpLoad %int %i + OpSelectionMerge %50 None + OpSwitch %49 %51 1 %52 0 %53 + %52 = OpLabel + %54 = OpFunctionCall %v4float %func_ + OpStore %x_GLF_color %54 + OpBranch %51 + %51 = OpLabel + OpBranch %53 + %53 = OpLabel + %57 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + OpStore %57 %float_0 + OpBranch %50 + %50 = OpLabel + OpBranch %40 + %40 = OpLabel + %58 = OpLoad %int %i + %59 = OpIAdd %int %58 %int_1 + OpStore %i %59 + OpBranch %38 + %39 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %60 +%tint_symbol = OpFunctionParameter %main_out + %64 = OpLabel + %65 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %65 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %30 + %67 = OpLabel + %68 = OpFunctionCall %void %main_1 + %70 = OpLoad %v4float %x_GLF_color + %71 = OpCompositeConstruct %main_out %70 + %69 = OpFunctionCall %void %tint_symbol_2 %71 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..1f005a5f0c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.wgsl @@ -0,0 +1,63 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> vec4 { + let x_48 : i32 = x_6.one; + if ((x_48 == 1)) { + return vec4(1.0, 0.0, 0.0, 1.0); + } else { + return vec4(0.0, 0.0, 0.0, 0.0); + } + return vec4(0.0, 0.0, 0.0, 0.0); +} + +fn main_1() { + var i : i32; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + i = 0; + loop { + let x_33 : i32 = i; + let x_35 : i32 = x_6.one; + if ((x_33 <= x_35)) { + } else { + break; + } + let x_38 : i32 = i; + switch(x_38) { + case 1: { + let x_43 : vec4 = func_(); + x_GLF_color = x_43; + fallthrough; + } + default: { + fallthrough; + } + case 0: { + x_GLF_color.y = 0.0; + } + } + + continuing { + let x_44 : i32 = i; + i = (x_44 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl new file mode 100644 index 0000000000..1f005a5f0c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl @@ -0,0 +1,63 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> vec4 { + let x_48 : i32 = x_6.one; + if ((x_48 == 1)) { + return vec4(1.0, 0.0, 0.0, 1.0); + } else { + return vec4(0.0, 0.0, 0.0, 0.0); + } + return vec4(0.0, 0.0, 0.0, 0.0); +} + +fn main_1() { + var i : i32; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + i = 0; + loop { + let x_33 : i32 = i; + let x_35 : i32 = x_6.one; + if ((x_33 <= x_35)) { + } else { + break; + } + let x_38 : i32 = i; + switch(x_38) { + case 1: { + let x_43 : vec4 = func_(); + x_GLF_color = x_43; + fallthrough; + } + default: { + fallthrough; + } + case 0: { + x_GLF_color.y = 0.0; + } + } + + continuing { + let x_44 : i32 = i; + i = (x_44 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..aea4365c1c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.hlsl @@ -0,0 +1,60 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float4 func_() { + const int x_48 = asint(x_6[0].x); + if ((x_48 == 1)) { + return float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + return float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return float4(0.0f, 0.0f, 0.0f, 0.0f); +} + +void main_1() { + int i = 0; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + while (true) { + const int x_33 = i; + const int x_35 = asint(x_6[0].x); + if ((x_33 <= x_35)) { + } else { + break; + } + switch(i) { + case 1: { + const float4 x_43 = func_(); + x_GLF_color = x_43; + /* fallthrough */ + } + default: { + /* fallthrough */ + } + case 0: { + x_GLF_color.y = 0.0f; + break; + } + } + { + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..6614fe80f0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.msl @@ -0,0 +1,65 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float4 func_(constant buf0& x_6) { + int const x_48 = x_6.one; + if ((x_48 == 1)) { + return float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + return float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return float4(0.0f, 0.0f, 0.0f, 0.0f); +} + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + while (true) { + int const x_33 = i; + int const x_35 = x_6.one; + if ((x_33 <= x_35)) { + } else { + break; + } + int const x_38 = i; + switch(x_38) { + case 1: { + float4 const x_43 = func_(x_6); + *(tint_symbol_4) = x_43; + /* fallthrough */ + } + default: { + /* fallthrough */ + } + case 0: { + (*(tint_symbol_4)).y = 0.0f; + break; + } + } + { + int const x_44 = i; + i = (x_44 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..c8ef50f82a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.spvasm @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %12 = OpTypeFunction %v4float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %28 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %29 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %void = OpTypeVoid + %30 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %36 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %60 = OpTypeFunction %void %main_out + %func_ = OpFunction %v4float None %12 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %19 = OpLoad %int %18 + %21 = OpIEqual %bool %19 %int_1 + OpSelectionMerge %23 None + OpBranchConditional %21 %24 %25 + %24 = OpLabel + OpReturnValue %28 + %25 = OpLabel + OpReturnValue %29 + %23 = OpLabel + OpReturnValue %29 + OpFunctionEnd + %main_1 = OpFunction %void None %30 + %33 = OpLabel + %i = OpVariable %_ptr_Function_int Function %36 + OpStore %x_GLF_color %29 + OpStore %i %int_0 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %int %i + %43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %44 = OpLoad %int %43 + %45 = OpSLessThanEqual %bool %42 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %39 + %46 = OpLabel + %49 = OpLoad %int %i + OpSelectionMerge %50 None + OpSwitch %49 %51 1 %52 0 %53 + %52 = OpLabel + %54 = OpFunctionCall %v4float %func_ + OpStore %x_GLF_color %54 + OpBranch %51 + %51 = OpLabel + OpBranch %53 + %53 = OpLabel + %57 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + OpStore %57 %float_0 + OpBranch %50 + %50 = OpLabel + OpBranch %40 + %40 = OpLabel + %58 = OpLoad %int %i + %59 = OpIAdd %int %58 %int_1 + OpStore %i %59 + OpBranch %38 + %39 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %60 +%tint_symbol = OpFunctionParameter %main_out + %64 = OpLabel + %65 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %65 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %30 + %67 = OpLabel + %68 = OpFunctionCall %void %main_1 + %70 = OpLoad %v4float %x_GLF_color + %71 = OpCompositeConstruct %main_out %70 + %69 = OpFunctionCall %void %tint_symbol_2 %71 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..1f005a5f0c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.wgsl @@ -0,0 +1,63 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> vec4 { + let x_48 : i32 = x_6.one; + if ((x_48 == 1)) { + return vec4(1.0, 0.0, 0.0, 1.0); + } else { + return vec4(0.0, 0.0, 0.0, 0.0); + } + return vec4(0.0, 0.0, 0.0, 0.0); +} + +fn main_1() { + var i : i32; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + i = 0; + loop { + let x_33 : i32 = i; + let x_35 : i32 = x_6.one; + if ((x_33 <= x_35)) { + } else { + break; + } + let x_38 : i32 = i; + switch(x_38) { + case 1: { + let x_43 : vec4 = func_(); + x_GLF_color = x_43; + fallthrough; + } + default: { + fallthrough; + } + case 0: { + x_GLF_color.y = 0.0; + } + } + + continuing { + let x_44 : i32 = i; + i = (x_44 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm new file mode 100644 index 0000000000..666b9b0cef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm @@ -0,0 +1,49 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 + %float_n1 = OpConstant %float -1 + %13 = OpConstantComposite %v2float %float_1 %float_n1 +%float_0_400000006 = OpConstant %float 0.400000006 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %7 + %21 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function + %v2 = OpVariable %_ptr_Function_v2float Function + OpStore %v1 %13 + %22 = OpLoad %v2float %v1 + %23 = OpExtInst %v2float %1 Sinh %22 + %24 = OpCompositeConstruct %v2float %float_0_400000006 %float_0_400000006 + %25 = OpExtInst %v2float %1 Step %24 %23 + OpStore %v2 %25 + %26 = OpAccessChain %_ptr_Function_float %v2 %uint_0 + %27 = OpLoad %float %26 + %28 = OpAccessChain %_ptr_Function_float %v2 %uint_1 + %29 = OpLoad %float %28 + %30 = OpAccessChain %_ptr_Function_float %v2 %uint_1 + %31 = OpLoad %float %30 + %32 = OpAccessChain %_ptr_Function_float %v2 %uint_0 + %33 = OpLoad %float %32 + %34 = OpCompositeConstruct %v4float %27 %29 %31 %33 + OpStore %_GLF_color %34 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..37bf795d15 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v1 = float2(0.0f, 0.0f); + float2 v2 = float2(0.0f, 0.0f); + v1 = float2(1.0f, -1.0f); + v2 = step(float2(0.400000006f, 0.400000006f), sinh(v1)); + const float x_27 = v2.x; + const float x_29 = v2.y; + const float x_31 = v2.y; + const float x_33 = v2.x; + x_GLF_color = float4(x_27, x_29, x_31, x_33); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..57eb0c01e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.msl @@ -0,0 +1,32 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float2 v1 = 0.0f; + float2 v2 = 0.0f; + v1 = float2(1.0f, -1.0f); + float2 const x_22 = v1; + v2 = step(float2(0.400000006f, 0.400000006f), sinh(x_22)); + float const x_27 = v2.x; + float const x_29 = v2.y; + float const x_31 = v2.y; + float const x_33 = v2.x; + *(tint_symbol_4) = float4(x_27, x_29, x_31, x_33); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..5661e19b3d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %float_n1 = OpConstant %float -1 + %19 = OpConstantComposite %v2float %float_1 %float_n1 +%float_0_400000006 = OpConstant %float 0.400000006 + %24 = OpConstantComposite %v2float %float_0_400000006 %float_0_400000006 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %39 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function %15 + %v2 = OpVariable %_ptr_Function_v2float Function %15 + OpStore %v1 %19 + %20 = OpLoad %v2float %v1 + %25 = OpExtInst %v2float %22 Sinh %20 + %21 = OpExtInst %v2float %22 Step %24 %25 + OpStore %v2 %21 + %29 = OpAccessChain %_ptr_Function_float %v2 %uint_0 + %30 = OpLoad %float %29 + %32 = OpAccessChain %_ptr_Function_float %v2 %uint_1 + %33 = OpLoad %float %32 + %34 = OpAccessChain %_ptr_Function_float %v2 %uint_1 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Function_float %v2 %uint_0 + %37 = OpLoad %float %36 + %38 = OpCompositeConstruct %v4float %30 %33 %35 %37 + OpStore %x_GLF_color %38 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %39 +%tint_symbol = OpFunctionParameter %main_out + %43 = OpLabel + %44 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %44 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %46 = OpLabel + %47 = OpFunctionCall %void %main_1 + %49 = OpLoad %v4float %x_GLF_color + %50 = OpCompositeConstruct %main_out %49 + %48 = OpFunctionCall %void %tint_symbol_2 %50 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a52a30ae80 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.spvasm.expected.wgsl @@ -0,0 +1,26 @@ +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec2; + var v2 : vec2; + v1 = vec2(1.0, -1.0); + let x_22 : vec2 = v1; + v2 = step(vec2(0.400000006, 0.400000006), sinh(x_22)); + let x_27 : f32 = v2.x; + let x_29 : f32 = v2.y; + let x_31 : f32 = v2.y; + let x_33 : f32 = v2.x; + x_GLF_color = vec4(x_27, x_29, x_31, x_33); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl new file mode 100644 index 0000000000..a52a30ae80 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl @@ -0,0 +1,26 @@ +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec2; + var v2 : vec2; + v1 = vec2(1.0, -1.0); + let x_22 : vec2 = v1; + v2 = step(vec2(0.400000006, 0.400000006), sinh(x_22)); + let x_27 : f32 = v2.x; + let x_29 : f32 = v2.y; + let x_31 : f32 = v2.y; + let x_33 : f32 = v2.x; + x_GLF_color = vec4(x_27, x_29, x_31, x_33); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..37bf795d15 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v1 = float2(0.0f, 0.0f); + float2 v2 = float2(0.0f, 0.0f); + v1 = float2(1.0f, -1.0f); + v2 = step(float2(0.400000006f, 0.400000006f), sinh(v1)); + const float x_27 = v2.x; + const float x_29 = v2.y; + const float x_31 = v2.y; + const float x_33 = v2.x; + x_GLF_color = float4(x_27, x_29, x_31, x_33); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..57eb0c01e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.msl @@ -0,0 +1,32 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float2 v1 = 0.0f; + float2 v2 = 0.0f; + v1 = float2(1.0f, -1.0f); + float2 const x_22 = v1; + v2 = step(float2(0.400000006f, 0.400000006f), sinh(x_22)); + float const x_27 = v2.x; + float const x_29 = v2.y; + float const x_31 = v2.y; + float const x_33 = v2.x; + *(tint_symbol_4) = float4(x_27, x_29, x_31, x_33); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5661e19b3d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %22 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %float_n1 = OpConstant %float -1 + %19 = OpConstantComposite %v2float %float_1 %float_n1 +%float_0_400000006 = OpConstant %float 0.400000006 + %24 = OpConstantComposite %v2float %float_0_400000006 %float_0_400000006 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %39 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function %15 + %v2 = OpVariable %_ptr_Function_v2float Function %15 + OpStore %v1 %19 + %20 = OpLoad %v2float %v1 + %25 = OpExtInst %v2float %22 Sinh %20 + %21 = OpExtInst %v2float %22 Step %24 %25 + OpStore %v2 %21 + %29 = OpAccessChain %_ptr_Function_float %v2 %uint_0 + %30 = OpLoad %float %29 + %32 = OpAccessChain %_ptr_Function_float %v2 %uint_1 + %33 = OpLoad %float %32 + %34 = OpAccessChain %_ptr_Function_float %v2 %uint_1 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Function_float %v2 %uint_0 + %37 = OpLoad %float %36 + %38 = OpCompositeConstruct %v4float %30 %33 %35 %37 + OpStore %x_GLF_color %38 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %39 +%tint_symbol = OpFunctionParameter %main_out + %43 = OpLabel + %44 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %44 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %46 = OpLabel + %47 = OpFunctionCall %void %main_1 + %49 = OpLoad %v4float %x_GLF_color + %50 = OpCompositeConstruct %main_out %49 + %48 = OpFunctionCall %void %tint_symbol_2 %50 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a52a30ae80 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-step-sinh/0-opt.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +var x_GLF_color : vec4; + +fn main_1() { + var v1 : vec2; + var v2 : vec2; + v1 = vec2(1.0, -1.0); + let x_22 : vec2 = v1; + v2 = step(vec2(0.400000006, 0.400000006), sinh(x_22)); + let x_27 : f32 = v2.x; + let x_29 : f32 = v2.y; + let x_31 : f32 = v2.y; + let x_33 : f32 = v2.x; + x_GLF_color = vec4(x_27, x_29, x_31, x_33); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm new file mode 100644 index 0000000000..55ad477abc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm @@ -0,0 +1,173 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %S "S" + OpMemberName %S 0 "numbers" + OpName %obj "obj" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zeroVec" + OpName %__0 "" + OpName %a "a" + OpName %buf3 "buf3" + OpMemberName %buf3 0 "oneVec" + OpName %__1 "" + OpName %b "b" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__2 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 2 + OpMemberDecorate %buf3 0 Offset 0 + OpDecorate %buf3 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 3 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__2 DescriptorSet 0 + OpDecorate %__2 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %S = OpTypeStruct %_arr_float_uint_3 +%_ptr_Function_S = OpTypePointer Function %S + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 + %buf1 = OpTypeStruct %_arr_float_uint_5 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__0 = OpVariable %_ptr_Uniform_buf2 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %buf3 = OpTypeStruct %v2float +%_ptr_Uniform_buf3 = OpTypePointer Uniform %buf3 + %__1 = OpVariable %_ptr_Uniform_buf3 Uniform + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__2 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %19 + %48 = OpLabel + %obj = OpVariable %_ptr_Function_S Function + %a = OpVariable %_ptr_Function_float Function + %49 = OpVariable %_ptr_Function_v2float Function + %b = OpVariable %_ptr_Function_float Function + %50 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3 + %51 = OpLoad %float %50 + %52 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %53 = OpLoad %float %52 + %54 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_4 + %55 = OpLoad %float %54 + %56 = OpCompositeConstruct %_arr_float_uint_3 %51 %53 %55 + %57 = OpCompositeConstruct %S %56 + OpStore %obj %57 + %58 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %59 = OpLoad %float %58 + %60 = OpConvertFToS %int %59 + %61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Function_float %obj %int_0 %60 + OpStore %63 %62 + %64 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %67 = OpLoad %float %66 + %68 = OpFOrdGreaterThan %bool %65 %67 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 + %73 = OpLoad %v2float %72 + OpStore %49 %73 + OpBranch %69 + %71 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_v2float %__1 %int_0 + %75 = OpLoad %v2float %74 + OpStore %49 %75 + OpBranch %69 + %69 = OpLabel + %76 = OpAccessChain %_ptr_Function_float %49 %uint_1 + %77 = OpLoad %float %76 + OpStore %a %77 + %78 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %79 = OpLoad %float %78 + %80 = OpLoad %float %a + %81 = OpAccessChain %_ptr_Uniform_int %__2 %int_0 %int_0 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Function_float %obj %int_0 %82 + %84 = OpLoad %float %83 + %85 = OpExtInst %float %1 FMix %79 %80 %84 + OpStore %b %85 + %86 = OpLoad %float %b + %87 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %88 = OpLoad %float %87 + %89 = OpExtInst %float %1 Distance %86 %88 + %90 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %91 = OpLoad %float %90 + %92 = OpFOrdLessThan %bool %89 %91 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + %96 = OpAccessChain %_ptr_Uniform_int %__2 %int_0 %int_0 + %97 = OpLoad %int %96 + %98 = OpConvertSToF %float %97 + %99 = OpAccessChain %_ptr_Uniform_int %__2 %int_0 %int_1 + %100 = OpLoad %int %99 + %101 = OpConvertSToF %float %100 + %102 = OpAccessChain %_ptr_Uniform_int %__2 %int_0 %int_1 + %103 = OpLoad %int %102 + %104 = OpConvertSToF %float %103 + %105 = OpAccessChain %_ptr_Uniform_int %__2 %int_0 %int_0 + %106 = OpLoad %int %105 + %107 = OpConvertSToF %float %106 + %108 = OpCompositeConstruct %v4float %98 %101 %104 %107 + OpStore %_GLF_color %108 + OpBranch %93 + %95 = OpLabel + %109 = OpAccessChain %_ptr_Uniform_int %__2 %int_0 %int_1 + %110 = OpLoad %int %109 + %111 = OpConvertSToF %float %110 + %112 = OpCompositeConstruct %v4float %111 %111 %111 %111 + OpStore %_GLF_color %112 + OpBranch %93 + %93 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..c182316735 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.hlsl @@ -0,0 +1,84 @@ +struct S { + float numbers[3]; +}; + +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[5]; +}; +cbuffer cbuffer_x_9 : register(b2, space0) { + uint4 x_9[1]; +}; +cbuffer cbuffer_x_12 : register(b3, space0) { + uint4 x_12[1]; +}; +cbuffer cbuffer_x_15 : register(b0, space0) { + uint4 x_15[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + S obj = (S)0; + float a = 0.0f; + float2 x_49 = float2(0.0f, 0.0f); + float b = 0.0f; + const float x_51 = asfloat(x_7[3].x); + const float x_53 = asfloat(x_7[2].x); + const float x_55 = asfloat(x_7[4].x); + const float tint_symbol_7[3] = {x_51, x_53, x_55}; + const S tint_symbol_8 = {tint_symbol_7}; + obj = tint_symbol_8; + const float x_59 = asfloat(x_9[0].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_62 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + obj.numbers[int(x_59)] = x_62; + const float x_65 = asfloat(x_9[0].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_67 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_65 > x_67)) { + const float2 x_73 = asfloat(x_9[0].xy); + x_49 = x_73; + } else { + const float2 x_75 = asfloat(x_12[0].xy); + x_49 = x_75; + } + const float x_77 = x_49.y; + a = x_77; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_79 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_80 = a; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_82 = asint(x_15[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_84 = obj.numbers[x_82]; + b = lerp(x_79, x_80, x_84); + const float x_86 = b; + const float x_88 = asfloat(x_7[2].x); + const float x_91 = asfloat(x_7[1].x); + if ((distance(x_86, x_88) < x_91)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_97 = asint(x_15[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const int x_100 = asint(x_15[1].x); + const int x_103 = asint(x_15[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_106 = asint(x_15[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(float(x_97), float(x_100), float(x_103), float(x_106)); + } else { + const int x_110 = asint(x_15[1].x); + const float x_111 = float(x_110); + x_GLF_color = float4(x_111, x_111, x_111, x_111); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_9 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.msl new file mode 100755 index 0000000000..649909a790 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.msl @@ -0,0 +1,122 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct tint_array_wrapper { + float arr[3]; +}; +struct S { + tint_array_wrapper numbers; +}; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ packed_float2 zeroVec; +}; +struct buf3 { + /* 0x0000 */ packed_float2 oneVec; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_2 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf2& x_9, constant buf3& x_12, constant buf0& x_15, thread float4* const tint_symbol_6) { + S obj = {}; + float a = 0.0f; + float2 x_49 = 0.0f; + float b = 0.0f; + float const x_51 = x_7.x_GLF_uniform_float_values.arr[3].el; + float const x_53 = x_7.x_GLF_uniform_float_values.arr[2].el; + float const x_55 = x_7.x_GLF_uniform_float_values.arr[4].el; + tint_array_wrapper const tint_symbol_3 = {.arr={x_51, x_53, x_55}}; + S const tint_symbol_4 = {.numbers=tint_symbol_3}; + obj = tint_symbol_4; + float const x_59 = x_9.zeroVec.x; + float const x_62 = x_7.x_GLF_uniform_float_values.arr[0].el; + obj.numbers.arr[int(x_59)] = x_62; + float const x_65 = x_9.zeroVec.x; + float const x_67 = x_7.x_GLF_uniform_float_values.arr[0].el; + if ((x_65 > x_67)) { + float2 const x_73 = x_9.zeroVec; + x_49 = x_73; + } else { + float2 const x_75 = x_12.oneVec; + x_49 = x_75; + } + float const x_77 = x_49.y; + a = x_77; + float const x_79 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_80 = a; + int const x_82 = x_15.x_GLF_uniform_int_values.arr[0].el; + float const x_84 = obj.numbers.arr[x_82]; + b = mix(x_79, x_80, x_84); + float const x_86 = b; + float const x_88 = x_7.x_GLF_uniform_float_values.arr[2].el; + float const x_91 = x_7.x_GLF_uniform_float_values.arr[1].el; + if ((distance(x_86, x_88) < x_91)) { + int const x_97 = x_15.x_GLF_uniform_int_values.arr[0].el; + int const x_100 = x_15.x_GLF_uniform_int_values.arr[1].el; + int const x_103 = x_15.x_GLF_uniform_int_values.arr[1].el; + int const x_106 = x_15.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_97), float(x_100), float(x_103), float(x_106)); + } else { + int const x_110 = x_15.x_GLF_uniform_int_values.arr[1].el; + float const x_111 = float(x_110); + *(tint_symbol_6) = float4(x_111, x_111, x_111, x_111); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf2& x_9 [[buffer(2)]], constant buf3& x_12 [[buffer(3)]], constant buf0& x_15 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + main_1(x_7, x_9, x_12, x_15, &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_5; +} + +T:\tmp\udoo.0.metal:76:8: error: call to 'distance' is ambiguous + if ((distance(x_86, x_88) < x_91)) { + ^~~~~~~~ +C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:481:17: note: candidate function +METAL_FUNC half distance(half2 x, half2 y) + ^ +C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:512:17: note: candidate function +METAL_FUNC half distance(half3 x, half3 y) + ^ +C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:543:17: note: candidate function +METAL_FUNC half distance(half4 x, half4 y) + ^ +C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:648:18: note: candidate function +METAL_FUNC float distance(float2 x, float2 y) + ^ +C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:691:18: note: candidate function +METAL_FUNC float distance(float3 x, float3 y) + ^ +C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:734:18: note: candidate function +METAL_FUNC float distance(float4 x, float4 y) + ^ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2af192ce4a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.spvasm @@ -0,0 +1,214 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 131 +; Schema: 0 + OpCapability Shader + %90 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zeroVec" + OpName %x_9 "x_9" + OpName %buf3 "buf3" + OpMemberName %buf3 0 "oneVec" + OpName %x_12 "x_12" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_15 "x_15" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %S "S" + OpMemberName %S 0 "numbers" + OpName %obj "obj" + OpName %a "a" + OpName %x_49 "x_49" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 2 + OpDecorate %buf3 Block + OpMemberDecorate %buf3 0 Offset 0 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 3 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_15 NonWritable + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 + %buf1 = OpTypeStruct %_arr_float_uint_5 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_9 = OpVariable %_ptr_Uniform_buf2 Uniform + %buf3 = OpTypeStruct %v2float +%_ptr_Uniform_buf3 = OpTypePointer Uniform %buf3 + %x_12 = OpVariable %_ptr_Uniform_buf3 Uniform + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_15 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %24 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %24 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %S = OpTypeStruct %_arr_float_uint_3 +%_ptr_Function_S = OpTypePointer Function %S + %36 = OpConstantNull %S +%_ptr_Function_float = OpTypePointer Function %float + %39 = OpConstantNull %float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %42 = OpConstantNull %v2float + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %119 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %27 + %30 = OpLabel + %obj = OpVariable %_ptr_Function_S Function %36 + %a = OpVariable %_ptr_Function_float Function %39 + %x_49 = OpVariable %_ptr_Function_v2float Function %42 + %b = OpVariable %_ptr_Function_float Function %39 + %47 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3 + %48 = OpLoad %float %47 + %50 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %51 = OpLoad %float %50 + %53 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_4 + %54 = OpLoad %float %53 + %55 = OpCompositeConstruct %_arr_float_uint_3 %48 %51 %54 + %56 = OpCompositeConstruct %S %55 + OpStore %obj %56 + %57 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %58 = OpLoad %float %57 + %60 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpConvertFToS %int %58 + %63 = OpAccessChain %_ptr_Function_float %obj %uint_0 %62 + OpStore %63 %61 + %64 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %67 = OpLoad %float %66 + %68 = OpFOrdGreaterThan %bool %65 %67 + OpSelectionMerge %70 None + OpBranchConditional %68 %71 %72 + %71 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_v2float %x_9 %uint_0 + %75 = OpLoad %v2float %74 + OpStore %x_49 %75 + OpBranch %70 + %72 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_v2float %x_12 %uint_0 + %77 = OpLoad %v2float %76 + OpStore %x_49 %77 + OpBranch %70 + %70 = OpLabel + %79 = OpAccessChain %_ptr_Function_float %x_49 %uint_1 + %80 = OpLoad %float %79 + OpStore %a %80 + %81 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %82 = OpLoad %float %81 + %83 = OpLoad %float %a + %85 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 %int_0 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Function_float %obj %uint_0 %86 + %88 = OpLoad %float %87 + %89 = OpExtInst %float %90 FMix %82 %83 %88 + OpStore %b %89 + %91 = OpLoad %float %b + %92 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %93 = OpLoad %float %92 + %95 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %96 = OpLoad %float %95 + %97 = OpExtInst %float %90 Distance %91 %93 + %98 = OpFOrdLessThan %bool %97 %96 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %101 + %100 = OpLabel + %102 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 %int_0 + %103 = OpLoad %int %102 + %104 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 %int_1 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 %int_1 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 %int_0 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %103 + %111 = OpConvertSToF %float %105 + %112 = OpConvertSToF %float %107 + %113 = OpConvertSToF %float %109 + %114 = OpCompositeConstruct %v4float %110 %111 %112 %113 + OpStore %x_GLF_color %114 + OpBranch %99 + %101 = OpLabel + %115 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 %int_1 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %116 + %118 = OpCompositeConstruct %v4float %117 %117 %117 %117 + OpStore %x_GLF_color %118 + OpBranch %99 + %99 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %119 +%tint_symbol = OpFunctionParameter %main_out + %123 = OpLabel + %124 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %124 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %126 = OpLabel + %127 = OpFunctionCall %void %main_1 + %129 = OpLoad %v4float %x_GLF_color + %130 = OpCompositeConstruct %main_out %129 + %128 = OpFunctionCall %void %tint_symbol_2 %130 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..57db95462f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.wgsl @@ -0,0 +1,93 @@ +struct S { + numbers : array; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + zeroVec : vec2; +}; + +[[block]] +struct buf3 { + oneVec : vec2; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(2)]] var x_9 : buf2; + +[[group(0), binding(3)]] var x_12 : buf3; + +[[group(0), binding(0)]] var x_15 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var obj : S; + var a : f32; + var x_49 : vec2; + var b : f32; + let x_51 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_53 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_55 : f32 = x_7.x_GLF_uniform_float_values[4]; + obj = S(array(x_51, x_53, x_55)); + let x_59 : f32 = x_9.zeroVec.x; + let x_62 : f32 = x_7.x_GLF_uniform_float_values[0]; + obj.numbers[i32(x_59)] = x_62; + let x_65 : f32 = x_9.zeroVec.x; + let x_67 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_65 > x_67)) { + let x_73 : vec2 = x_9.zeroVec; + x_49 = x_73; + } else { + let x_75 : vec2 = x_12.oneVec; + x_49 = x_75; + } + let x_77 : f32 = x_49.y; + a = x_77; + let x_79 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_80 : f32 = a; + let x_82 : i32 = x_15.x_GLF_uniform_int_values[0]; + let x_84 : f32 = obj.numbers[x_82]; + b = mix(x_79, x_80, x_84); + let x_86 : f32 = b; + let x_88 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_91 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((distance(x_86, x_88) < x_91)) { + let x_97 : i32 = x_15.x_GLF_uniform_int_values[0]; + let x_100 : i32 = x_15.x_GLF_uniform_int_values[1]; + let x_103 : i32 = x_15.x_GLF_uniform_int_values[1]; + let x_106 : i32 = x_15.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_97), f32(x_100), f32(x_103), f32(x_106)); + } else { + let x_110 : i32 = x_15.x_GLF_uniform_int_values[1]; + let x_111 : f32 = f32(x_110); + x_GLF_color = vec4(x_111, x_111, x_111, x_111); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl new file mode 100644 index 0000000000..57db95462f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl @@ -0,0 +1,93 @@ +struct S { + numbers : array; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + zeroVec : vec2; +}; + +[[block]] +struct buf3 { + oneVec : vec2; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(2)]] var x_9 : buf2; + +[[group(0), binding(3)]] var x_12 : buf3; + +[[group(0), binding(0)]] var x_15 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var obj : S; + var a : f32; + var x_49 : vec2; + var b : f32; + let x_51 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_53 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_55 : f32 = x_7.x_GLF_uniform_float_values[4]; + obj = S(array(x_51, x_53, x_55)); + let x_59 : f32 = x_9.zeroVec.x; + let x_62 : f32 = x_7.x_GLF_uniform_float_values[0]; + obj.numbers[i32(x_59)] = x_62; + let x_65 : f32 = x_9.zeroVec.x; + let x_67 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_65 > x_67)) { + let x_73 : vec2 = x_9.zeroVec; + x_49 = x_73; + } else { + let x_75 : vec2 = x_12.oneVec; + x_49 = x_75; + } + let x_77 : f32 = x_49.y; + a = x_77; + let x_79 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_80 : f32 = a; + let x_82 : i32 = x_15.x_GLF_uniform_int_values[0]; + let x_84 : f32 = obj.numbers[x_82]; + b = mix(x_79, x_80, x_84); + let x_86 : f32 = b; + let x_88 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_91 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((distance(x_86, x_88) < x_91)) { + let x_97 : i32 = x_15.x_GLF_uniform_int_values[0]; + let x_100 : i32 = x_15.x_GLF_uniform_int_values[1]; + let x_103 : i32 = x_15.x_GLF_uniform_int_values[1]; + let x_106 : i32 = x_15.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_97), f32(x_100), f32(x_103), f32(x_106)); + } else { + let x_110 : i32 = x_15.x_GLF_uniform_int_values[1]; + let x_111 : f32 = f32(x_110); + x_GLF_color = vec4(x_111, x_111, x_111, x_111); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..c182316735 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.hlsl @@ -0,0 +1,84 @@ +struct S { + float numbers[3]; +}; + +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[5]; +}; +cbuffer cbuffer_x_9 : register(b2, space0) { + uint4 x_9[1]; +}; +cbuffer cbuffer_x_12 : register(b3, space0) { + uint4 x_12[1]; +}; +cbuffer cbuffer_x_15 : register(b0, space0) { + uint4 x_15[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + S obj = (S)0; + float a = 0.0f; + float2 x_49 = float2(0.0f, 0.0f); + float b = 0.0f; + const float x_51 = asfloat(x_7[3].x); + const float x_53 = asfloat(x_7[2].x); + const float x_55 = asfloat(x_7[4].x); + const float tint_symbol_7[3] = {x_51, x_53, x_55}; + const S tint_symbol_8 = {tint_symbol_7}; + obj = tint_symbol_8; + const float x_59 = asfloat(x_9[0].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_62 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + obj.numbers[int(x_59)] = x_62; + const float x_65 = asfloat(x_9[0].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_67 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_65 > x_67)) { + const float2 x_73 = asfloat(x_9[0].xy); + x_49 = x_73; + } else { + const float2 x_75 = asfloat(x_12[0].xy); + x_49 = x_75; + } + const float x_77 = x_49.y; + a = x_77; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_79 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const float x_80 = a; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_82 = asint(x_15[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_84 = obj.numbers[x_82]; + b = lerp(x_79, x_80, x_84); + const float x_86 = b; + const float x_88 = asfloat(x_7[2].x); + const float x_91 = asfloat(x_7[1].x); + if ((distance(x_86, x_88) < x_91)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_97 = asint(x_15[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const int x_100 = asint(x_15[1].x); + const int x_103 = asint(x_15[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_106 = asint(x_15[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(float(x_97), float(x_100), float(x_103), float(x_106)); + } else { + const int x_110 = asint(x_15[1].x); + const float x_111 = float(x_110); + x_GLF_color = float4(x_111, x_111, x_111, x_111); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_9 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.msl new file mode 100755 index 0000000000..e8b297adfb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.msl @@ -0,0 +1,122 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct tint_array_wrapper { + float arr[3]; +}; +struct S { + tint_array_wrapper numbers; +}; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ packed_float2 zeroVec; +}; +struct buf3 { + /* 0x0000 */ packed_float2 oneVec; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_2 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf2& x_9, constant buf3& x_12, constant buf0& x_15, thread float4* const tint_symbol_6) { + S obj = {}; + float a = 0.0f; + float2 x_49 = 0.0f; + float b = 0.0f; + float const x_51 = x_7.x_GLF_uniform_float_values.arr[3].el; + float const x_53 = x_7.x_GLF_uniform_float_values.arr[2].el; + float const x_55 = x_7.x_GLF_uniform_float_values.arr[4].el; + tint_array_wrapper const tint_symbol_3 = {.arr={x_51, x_53, x_55}}; + S const tint_symbol_4 = {.numbers=tint_symbol_3}; + obj = tint_symbol_4; + float const x_59 = x_9.zeroVec.x; + float const x_62 = x_7.x_GLF_uniform_float_values.arr[0].el; + obj.numbers.arr[int(x_59)] = x_62; + float const x_65 = x_9.zeroVec.x; + float const x_67 = x_7.x_GLF_uniform_float_values.arr[0].el; + if ((x_65 > x_67)) { + float2 const x_73 = x_9.zeroVec; + x_49 = x_73; + } else { + float2 const x_75 = x_12.oneVec; + x_49 = x_75; + } + float const x_77 = x_49.y; + a = x_77; + float const x_79 = x_7.x_GLF_uniform_float_values.arr[0].el; + float const x_80 = a; + int const x_82 = x_15.x_GLF_uniform_int_values.arr[0].el; + float const x_84 = obj.numbers.arr[x_82]; + b = mix(x_79, x_80, x_84); + float const x_86 = b; + float const x_88 = x_7.x_GLF_uniform_float_values.arr[2].el; + float const x_91 = x_7.x_GLF_uniform_float_values.arr[1].el; + if ((distance(x_86, x_88) < x_91)) { + int const x_97 = x_15.x_GLF_uniform_int_values.arr[0].el; + int const x_100 = x_15.x_GLF_uniform_int_values.arr[1].el; + int const x_103 = x_15.x_GLF_uniform_int_values.arr[1].el; + int const x_106 = x_15.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_97), float(x_100), float(x_103), float(x_106)); + } else { + int const x_110 = x_15.x_GLF_uniform_int_values.arr[1].el; + float const x_111 = float(x_110); + *(tint_symbol_6) = float4(x_111, x_111, x_111, x_111); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf2& x_9 [[buffer(2)]], constant buf3& x_12 [[buffer(3)]], constant buf0& x_15 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + main_1(x_7, x_9, x_12, x_15, &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_5; +} + +T:\tmp\udr8.0.metal:76:8: error: call to 'distance' is ambiguous + if ((distance(x_86, x_88) < x_91)) { + ^~~~~~~~ +C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:481:17: note: candidate function +METAL_FUNC half distance(half2 x, half2 y) + ^ +C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:512:17: note: candidate function +METAL_FUNC half distance(half3 x, half3 y) + ^ +C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:543:17: note: candidate function +METAL_FUNC half distance(half4 x, half4 y) + ^ +C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:648:18: note: candidate function +METAL_FUNC float distance(float2 x, float2 y) + ^ +C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:691:18: note: candidate function +METAL_FUNC float distance(float3 x, float3 y) + ^ +C:\Program Files\Metal Developer Tools\macos\lib\clang\31001.138\include\metal\metal_geometric:734:18: note: candidate function +METAL_FUNC float distance(float4 x, float4 y) + ^ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2af192ce4a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.spvasm @@ -0,0 +1,214 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 131 +; Schema: 0 + OpCapability Shader + %90 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zeroVec" + OpName %x_9 "x_9" + OpName %buf3 "buf3" + OpMemberName %buf3 0 "oneVec" + OpName %x_12 "x_12" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_15 "x_15" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %S "S" + OpMemberName %S 0 "numbers" + OpName %obj "obj" + OpName %a "a" + OpName %x_49 "x_49" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 2 + OpDecorate %buf3 Block + OpMemberDecorate %buf3 0 Offset 0 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 3 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_15 NonWritable + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 + %buf1 = OpTypeStruct %_arr_float_uint_5 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_9 = OpVariable %_ptr_Uniform_buf2 Uniform + %buf3 = OpTypeStruct %v2float +%_ptr_Uniform_buf3 = OpTypePointer Uniform %buf3 + %x_12 = OpVariable %_ptr_Uniform_buf3 Uniform + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_15 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %24 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %24 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %S = OpTypeStruct %_arr_float_uint_3 +%_ptr_Function_S = OpTypePointer Function %S + %36 = OpConstantNull %S +%_ptr_Function_float = OpTypePointer Function %float + %39 = OpConstantNull %float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %42 = OpConstantNull %v2float + %uint_0 = OpConstant %uint 0 + %int_3 = OpConstant %int 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %119 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %27 + %30 = OpLabel + %obj = OpVariable %_ptr_Function_S Function %36 + %a = OpVariable %_ptr_Function_float Function %39 + %x_49 = OpVariable %_ptr_Function_v2float Function %42 + %b = OpVariable %_ptr_Function_float Function %39 + %47 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3 + %48 = OpLoad %float %47 + %50 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %51 = OpLoad %float %50 + %53 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_4 + %54 = OpLoad %float %53 + %55 = OpCompositeConstruct %_arr_float_uint_3 %48 %51 %54 + %56 = OpCompositeConstruct %S %55 + OpStore %obj %56 + %57 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %58 = OpLoad %float %57 + %60 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpConvertFToS %int %58 + %63 = OpAccessChain %_ptr_Function_float %obj %uint_0 %62 + OpStore %63 %61 + %64 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %67 = OpLoad %float %66 + %68 = OpFOrdGreaterThan %bool %65 %67 + OpSelectionMerge %70 None + OpBranchConditional %68 %71 %72 + %71 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_v2float %x_9 %uint_0 + %75 = OpLoad %v2float %74 + OpStore %x_49 %75 + OpBranch %70 + %72 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_v2float %x_12 %uint_0 + %77 = OpLoad %v2float %76 + OpStore %x_49 %77 + OpBranch %70 + %70 = OpLabel + %79 = OpAccessChain %_ptr_Function_float %x_49 %uint_1 + %80 = OpLoad %float %79 + OpStore %a %80 + %81 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %82 = OpLoad %float %81 + %83 = OpLoad %float %a + %85 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 %int_0 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Function_float %obj %uint_0 %86 + %88 = OpLoad %float %87 + %89 = OpExtInst %float %90 FMix %82 %83 %88 + OpStore %b %89 + %91 = OpLoad %float %b + %92 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2 + %93 = OpLoad %float %92 + %95 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %96 = OpLoad %float %95 + %97 = OpExtInst %float %90 Distance %91 %93 + %98 = OpFOrdLessThan %bool %97 %96 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %101 + %100 = OpLabel + %102 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 %int_0 + %103 = OpLoad %int %102 + %104 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 %int_1 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 %int_1 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 %int_0 + %109 = OpLoad %int %108 + %110 = OpConvertSToF %float %103 + %111 = OpConvertSToF %float %105 + %112 = OpConvertSToF %float %107 + %113 = OpConvertSToF %float %109 + %114 = OpCompositeConstruct %v4float %110 %111 %112 %113 + OpStore %x_GLF_color %114 + OpBranch %99 + %101 = OpLabel + %115 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0 %int_1 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %116 + %118 = OpCompositeConstruct %v4float %117 %117 %117 %117 + OpStore %x_GLF_color %118 + OpBranch %99 + %99 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %119 +%tint_symbol = OpFunctionParameter %main_out + %123 = OpLabel + %124 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %124 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %126 = OpLabel + %127 = OpFunctionCall %void %main_1 + %129 = OpLoad %v4float %x_GLF_color + %130 = OpCompositeConstruct %main_out %129 + %128 = OpFunctionCall %void %tint_symbol_2 %130 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..57db95462f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.wgsl @@ -0,0 +1,93 @@ +struct S { + numbers : array; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + zeroVec : vec2; +}; + +[[block]] +struct buf3 { + oneVec : vec2; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_7 : buf1; + +[[group(0), binding(2)]] var x_9 : buf2; + +[[group(0), binding(3)]] var x_12 : buf3; + +[[group(0), binding(0)]] var x_15 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var obj : S; + var a : f32; + var x_49 : vec2; + var b : f32; + let x_51 : f32 = x_7.x_GLF_uniform_float_values[3]; + let x_53 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_55 : f32 = x_7.x_GLF_uniform_float_values[4]; + obj = S(array(x_51, x_53, x_55)); + let x_59 : f32 = x_9.zeroVec.x; + let x_62 : f32 = x_7.x_GLF_uniform_float_values[0]; + obj.numbers[i32(x_59)] = x_62; + let x_65 : f32 = x_9.zeroVec.x; + let x_67 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_65 > x_67)) { + let x_73 : vec2 = x_9.zeroVec; + x_49 = x_73; + } else { + let x_75 : vec2 = x_12.oneVec; + x_49 = x_75; + } + let x_77 : f32 = x_49.y; + a = x_77; + let x_79 : f32 = x_7.x_GLF_uniform_float_values[0]; + let x_80 : f32 = a; + let x_82 : i32 = x_15.x_GLF_uniform_int_values[0]; + let x_84 : f32 = obj.numbers[x_82]; + b = mix(x_79, x_80, x_84); + let x_86 : f32 = b; + let x_88 : f32 = x_7.x_GLF_uniform_float_values[2]; + let x_91 : f32 = x_7.x_GLF_uniform_float_values[1]; + if ((distance(x_86, x_88) < x_91)) { + let x_97 : i32 = x_15.x_GLF_uniform_int_values[0]; + let x_100 : i32 = x_15.x_GLF_uniform_int_values[1]; + let x_103 : i32 = x_15.x_GLF_uniform_int_values[1]; + let x_106 : i32 = x_15.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_97), f32(x_100), f32(x_103), f32(x_106)); + } else { + let x_110 : i32 = x_15.x_GLF_uniform_int_values[1]; + let x_111 : f32 = f32(x_110); + x_GLF_color = vec4(x_111, x_111, x_111, x_111); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm new file mode 100644 index 0000000000..37786d3acb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm @@ -0,0 +1,115 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f "f" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "resolution" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__1 "" + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 2 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__0 = OpVariable %_ptr_Uniform_buf2 Uniform + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__1 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %14 + %35 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %39 = OpLoad %float %38 + %40 = OpFMul %float %37 %39 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %44 = OpLoad %float %43 + %45 = OpExtInst %float %1 Round %44 + %46 = OpFMul %float %42 %45 + %47 = OpFAdd %float %40 %46 + %48 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %49 = OpLoad %float %48 + %50 = OpFAdd %float %47 %49 + OpStore %f %50 + %51 = OpLoad %float %f + %52 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %53 = OpLoad %float %52 + %54 = OpFOrdEqual %bool %51 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %62 + %64 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %68 + %70 = OpCompositeConstruct %v4float %60 %63 %66 %69 + OpStore %_GLF_color %70 + OpBranch %55 + %57 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %72 + %74 = OpCompositeConstruct %v4float %73 %73 %73 %73 + OpStore %_GLF_color %74 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3d8d1c1622 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.hlsl @@ -0,0 +1,51 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_8 : register(b2, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; + +void main_1() { + float f = 0.0f; + const float x_37 = asfloat(x_6[1].x); + const float x_39 = asfloat(x_8[0].x); + const float x_42 = asfloat(x_6[2].x); + const float x_44 = asfloat(x_8[0].x); + const float x_49 = asfloat(x_8[0].y); + f = (((x_37 * x_39) + (x_42 * round(x_44))) + x_49); + const float x_51 = f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_53 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_51 == x_53)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_62 = asint(x_10[1].x); + const int x_65 = asint(x_10[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_68 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_59), float(x_62), float(x_65), float(x_68)); + } else { + const int x_72 = asint(x_10[1].x); + const float x_73 = float(x_72); + x_GLF_color = float4(x_73, x_73, x_73, x_73); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..16e16b0712 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.msl @@ -0,0 +1,65 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf2& x_8, constant buf0& x_10, thread float4* const tint_symbol_4) { + float f = 0.0f; + float const x_37 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_39 = x_8.resolution.x; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_44 = x_8.resolution.x; + float const x_49 = x_8.resolution.y; + f = (((x_37 * x_39) + (x_42 * rint(x_44))) + x_49); + float const x_51 = f; + float const x_53 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_51 == x_53)) { + int const x_59 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_62 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_68 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_59), float(x_62), float(x_65), float(x_68)); + } else { + int const x_72 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_73 = float(x_72); + *(tint_symbol_4) = float4(x_73, x_73, x_73, x_73); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf2& x_8 [[buffer(2)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..c5cc68e25e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 91 +; Schema: 0 + OpCapability Shader + %48 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "resolution" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_8 = OpVariable %_ptr_Uniform_buf2 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %15 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %15 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %30 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %79 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %24 + %27 = OpLabel + %f = OpVariable %_ptr_Function_float Function %30 + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %37 = OpLoad %float %36 + %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %42 = OpLoad %float %41 + %44 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %45 = OpLoad %float %44 + %46 = OpFMul %float %35 %37 + %47 = OpExtInst %float %48 RoundEven %42 + %49 = OpFMul %float %40 %47 + %50 = OpFAdd %float %46 %49 + %51 = OpFAdd %float %50 %45 + OpStore %f %51 + %52 = OpLoad %float %f + %54 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpFOrdEqual %bool %52 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %59 %60 + %59 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %63 + %71 = OpConvertSToF %float %65 + %72 = OpConvertSToF %float %67 + %73 = OpConvertSToF %float %69 + %74 = OpCompositeConstruct %v4float %70 %71 %72 %73 + OpStore %x_GLF_color %74 + OpBranch %58 + %60 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %76 + %78 = OpCompositeConstruct %v4float %77 %77 %77 %77 + OpStore %x_GLF_color %78 + OpBranch %58 + %58 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %79 +%tint_symbol = OpFunctionParameter %main_out + %83 = OpLabel + %84 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %84 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %24 + %86 = OpLabel + %87 = OpFunctionCall %void %main_1 + %89 = OpLoad %v4float %x_GLF_color + %90 = OpCompositeConstruct %main_out %89 + %88 = OpFunctionCall %void %tint_symbol_2 %90 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..9b46e47fde --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.spvasm.expected.wgsl @@ -0,0 +1,61 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + resolution : vec2; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(2)]] var x_8 : buf2; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn main_1() { + var f : f32; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_39 : f32 = x_8.resolution.x; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_44 : f32 = x_8.resolution.x; + let x_49 : f32 = x_8.resolution.y; + f = (((x_37 * x_39) + (x_42 * round(x_44))) + x_49); + let x_51 : f32 = f; + let x_53 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_51 == x_53)) { + let x_59 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_68 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_59), f32(x_62), f32(x_65), f32(x_68)); + } else { + let x_72 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_73 : f32 = f32(x_72); + x_GLF_color = vec4(x_73, x_73, x_73, x_73); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl new file mode 100644 index 0000000000..9b46e47fde --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl @@ -0,0 +1,61 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + resolution : vec2; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(2)]] var x_8 : buf2; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn main_1() { + var f : f32; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_39 : f32 = x_8.resolution.x; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_44 : f32 = x_8.resolution.x; + let x_49 : f32 = x_8.resolution.y; + f = (((x_37 * x_39) + (x_42 * round(x_44))) + x_49); + let x_51 : f32 = f; + let x_53 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_51 == x_53)) { + let x_59 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_68 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_59), f32(x_62), f32(x_65), f32(x_68)); + } else { + let x_72 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_73 : f32 = f32(x_72); + x_GLF_color = vec4(x_73, x_73, x_73, x_73); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3d8d1c1622 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.hlsl @@ -0,0 +1,51 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_8 : register(b2, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; + +void main_1() { + float f = 0.0f; + const float x_37 = asfloat(x_6[1].x); + const float x_39 = asfloat(x_8[0].x); + const float x_42 = asfloat(x_6[2].x); + const float x_44 = asfloat(x_8[0].x); + const float x_49 = asfloat(x_8[0].y); + f = (((x_37 * x_39) + (x_42 * round(x_44))) + x_49); + const float x_51 = f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_53 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_51 == x_53)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_62 = asint(x_10[1].x); + const int x_65 = asint(x_10[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_68 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_59), float(x_62), float(x_65), float(x_68)); + } else { + const int x_72 = asint(x_10[1].x); + const float x_73 = float(x_72); + x_GLF_color = float4(x_73, x_73, x_73, x_73); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..16e16b0712 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.msl @@ -0,0 +1,65 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf2& x_8, constant buf0& x_10, thread float4* const tint_symbol_4) { + float f = 0.0f; + float const x_37 = x_6.x_GLF_uniform_float_values.arr[1].el; + float const x_39 = x_8.resolution.x; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[2].el; + float const x_44 = x_8.resolution.x; + float const x_49 = x_8.resolution.y; + f = (((x_37 * x_39) + (x_42 * rint(x_44))) + x_49); + float const x_51 = f; + float const x_53 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_51 == x_53)) { + int const x_59 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_62 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_65 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_68 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_59), float(x_62), float(x_65), float(x_68)); + } else { + int const x_72 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_73 = float(x_72); + *(tint_symbol_4) = float4(x_73, x_73, x_73, x_73); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf2& x_8 [[buffer(2)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..c5cc68e25e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 91 +; Schema: 0 + OpCapability Shader + %48 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "resolution" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %v2float = OpTypeVector %float 2 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_8 = OpVariable %_ptr_Uniform_buf2 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %15 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %15 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %30 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %79 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %24 + %27 = OpLabel + %f = OpVariable %_ptr_Function_float Function %30 + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %37 = OpLoad %float %36 + %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %42 = OpLoad %float %41 + %44 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %45 = OpLoad %float %44 + %46 = OpFMul %float %35 %37 + %47 = OpExtInst %float %48 RoundEven %42 + %49 = OpFMul %float %40 %47 + %50 = OpFAdd %float %46 %49 + %51 = OpFAdd %float %50 %45 + OpStore %f %51 + %52 = OpLoad %float %f + %54 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpFOrdEqual %bool %52 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %59 %60 + %59 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %63 + %71 = OpConvertSToF %float %65 + %72 = OpConvertSToF %float %67 + %73 = OpConvertSToF %float %69 + %74 = OpCompositeConstruct %v4float %70 %71 %72 %73 + OpStore %x_GLF_color %74 + OpBranch %58 + %60 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %76 = OpLoad %int %75 + %77 = OpConvertSToF %float %76 + %78 = OpCompositeConstruct %v4float %77 %77 %77 %77 + OpStore %x_GLF_color %78 + OpBranch %58 + %58 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %79 +%tint_symbol = OpFunctionParameter %main_out + %83 = OpLabel + %84 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %84 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %24 + %86 = OpLabel + %87 = OpFunctionCall %void %main_1 + %89 = OpLoad %v4float %x_GLF_color + %90 = OpCompositeConstruct %main_out %89 + %88 = OpFunctionCall %void %tint_symbol_2 %90 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..9b46e47fde --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-sum-uniform-vector-components-round/0-opt.wgsl.expected.wgsl @@ -0,0 +1,61 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + resolution : vec2; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(2)]] var x_8 : buf2; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn main_1() { + var f : f32; + let x_37 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_39 : f32 = x_8.resolution.x; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[2]; + let x_44 : f32 = x_8.resolution.x; + let x_49 : f32 = x_8.resolution.y; + f = (((x_37 * x_39) + (x_42 * round(x_44))) + x_49); + let x_51 : f32 = f; + let x_53 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_51 == x_53)) { + let x_59 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_62 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_65 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_68 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_59), f32(x_62), f32(x_65), f32(x_68)); + } else { + let x_72 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_73 : f32 = f32(x_72); + x_GLF_color = vec4(x_73, x_73, x_73, x_73); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm new file mode 100644 index 0000000000..c742a255b8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm @@ -0,0 +1,152 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %color "color" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %j "j" + OpName %k "k" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %15 + %35 = OpLabel + %color = OpVariable %_ptr_Function_v4float Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %k = OpVariable %_ptr_Function_int Function + OpStore %color %20 + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %37 = OpLoad %int %36 + OpStore %i %37 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %int %i + %43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpSLessThan %bool %42 %44 + OpBranchConditional %45 %46 %39 + %46 = OpLabel + %47 = OpLoad %int %i + OpSelectionMerge %48 None + OpSwitch %47 %48 1 %49 2 %50 + %49 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %52 = OpLoad %int %51 + OpStore %j %52 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %int %i + %58 = OpLoad %int %i + %59 = OpSGreaterThan %bool %57 %58 + OpBranchConditional %59 %60 %54 + %60 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %62 = OpLoad %int %61 + OpStore %k %62 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpLoad %int %k + %68 = OpLoad %int %i + %69 = OpSLessThan %bool %67 %68 + OpBranchConditional %69 %70 %64 + %70 = OpLabel + %71 = OpLoad %int %k + %72 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Function_float %color %71 + OpStore %74 %73 + OpBranch %65 + %65 = OpLabel + %75 = OpLoad %int %k + %76 = OpIAdd %int %75 %int_1 + OpStore %k %76 + OpBranch %63 + %64 = OpLabel + OpBranch %55 + %55 = OpLabel + %77 = OpLoad %int %j + %78 = OpIAdd %int %77 %int_1 + OpStore %j %78 + OpBranch %53 + %54 = OpLabel + %79 = OpLoad %int %i + %80 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Function_float %color %79 + OpStore %82 %81 + OpBranch %48 + %50 = OpLabel + %83 = OpLoad %int %i + %84 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Function_float %color %83 + OpStore %86 %85 + OpBranch %48 + %48 = OpLabel + OpBranch %40 + %40 = OpLabel + %87 = OpLoad %int %i + %88 = OpIAdd %int %87 %int_1 + OpStore %i %88 + OpBranch %38 + %39 = OpLabel + %89 = OpLoad %v4float %color + OpStore %_GLF_color %89 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..8dae79cb12 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.hlsl @@ -0,0 +1,86 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + int j = 0; + int k = 0; + color = float4(1.0f, 1.0f, 1.0f, 1.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_37 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + i = x_37; + while (true) { + const int x_42 = i; + const int x_44 = asint(x_7[1].x); + if ((x_42 < x_44)) { + } else { + break; + } + switch(i) { + case 2: { + const int x_83 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_85 = asfloat(x_11[scalar_offset_1 / 4][scalar_offset_1 % 4]); + set_float4(color, x_83, x_85); + break; + } + case 1: { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + j = x_52; + { + for(; (i > i); j = (j + 1)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_62 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + k = x_62; + { + for(; (k < i); k = (k + 1)) { + const int x_71 = k; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_73 = asfloat(x_11[scalar_offset_4 / 4][scalar_offset_4 % 4]); + set_float4(color, x_71, x_73); + } + } + } + } + const int x_79 = i; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_81 = asfloat(x_11[scalar_offset_5 / 4][scalar_offset_5 % 4]); + set_float4(color, x_79, x_81); + break; + } + default: { + break; + } + } + { + i = (i + 1); + } + } + x_GLF_color = color; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..82cc6aed7a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_11, thread float4* const tint_symbol_4) { + float4 color = 0.0f; + int i = 0; + int j = 0; + int k = 0; + color = float4(1.0f, 1.0f, 1.0f, 1.0f); + int const x_37 = x_7.x_GLF_uniform_int_values.arr[0].el; + i = x_37; + while (true) { + int const x_42 = i; + int const x_44 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_42 < x_44)) { + } else { + break; + } + int const x_47 = i; + switch(x_47) { + case 2: { + int const x_83 = i; + float const x_85 = x_11.x_GLF_uniform_float_values.arr[0].el; + color[x_83] = x_85; + break; + } + case 1: { + int const x_52 = x_7.x_GLF_uniform_int_values.arr[0].el; + j = x_52; + while (true) { + int const x_57 = i; + int const x_58 = i; + if ((x_57 > x_58)) { + } else { + break; + } + int const x_62 = x_7.x_GLF_uniform_int_values.arr[0].el; + k = x_62; + while (true) { + int const x_67 = k; + int const x_68 = i; + if ((x_67 < x_68)) { + } else { + break; + } + int const x_71 = k; + float const x_73 = x_11.x_GLF_uniform_float_values.arr[0].el; + color[x_71] = x_73; + { + int const x_75 = k; + k = (x_75 + 1); + } + } + { + int const x_77 = j; + j = (x_77 + 1); + } + } + int const x_79 = i; + float const x_81 = x_11.x_GLF_uniform_float_values.arr[0].el; + color[x_79] = x_81; + break; + } + default: { + break; + } + } + { + int const x_87 = i; + i = (x_87 + 1); + } + } + float4 const x_89 = color; + *(tint_symbol_4) = x_89; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, x_11, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..3cdb9a4c33 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.spvasm @@ -0,0 +1,203 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 113 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %color "color" + OpName %i "i" + OpName %j "j" + OpName %k "k" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %32 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %101 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %color = OpVariable %_ptr_Function_v4float Function %17 + %i = OpVariable %_ptr_Function_int Function %28 + %j = OpVariable %_ptr_Function_int Function %28 + %k = OpVariable %_ptr_Function_int Function %28 + OpStore %color %32 + %36 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %37 = OpLoad %int %36 + OpStore %i %37 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %int %i + %44 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpSLessThan %bool %42 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %49 %50 + %49 = OpLabel + OpBranch %48 + %50 = OpLabel + OpBranch %39 + %48 = OpLabel + %51 = OpLoad %int %i + OpSelectionMerge %52 None + OpSwitch %51 %53 2 %54 1 %55 + %54 = OpLabel + %56 = OpLoad %int %i + %58 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %59 = OpLoad %float %58 + %61 = OpAccessChain %_ptr_Function_float %color %56 + OpStore %61 %59 + OpBranch %52 + %55 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %63 = OpLoad %int %62 + OpStore %j %63 + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %int %i + %69 = OpLoad %int %i + %70 = OpSGreaterThan %bool %68 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %65 + %71 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %75 = OpLoad %int %74 + OpStore %k %75 + OpBranch %76 + %76 = OpLabel + OpLoopMerge %77 %78 None + OpBranch %79 + %79 = OpLabel + %80 = OpLoad %int %k + %81 = OpLoad %int %i + %82 = OpSLessThan %bool %80 %81 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + OpBranch %83 + %85 = OpLabel + OpBranch %77 + %83 = OpLabel + %86 = OpLoad %int %k + %87 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %88 = OpLoad %float %87 + %89 = OpAccessChain %_ptr_Function_float %color %86 + OpStore %89 %88 + OpBranch %78 + %78 = OpLabel + %90 = OpLoad %int %k + %91 = OpIAdd %int %90 %int_1 + OpStore %k %91 + OpBranch %76 + %77 = OpLabel + OpBranch %66 + %66 = OpLabel + %92 = OpLoad %int %j + %93 = OpIAdd %int %92 %int_1 + OpStore %j %93 + OpBranch %64 + %65 = OpLabel + %94 = OpLoad %int %i + %95 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %96 = OpLoad %float %95 + %97 = OpAccessChain %_ptr_Function_float %color %94 + OpStore %97 %96 + OpBranch %52 + %53 = OpLabel + OpBranch %52 + %52 = OpLabel + OpBranch %40 + %40 = OpLabel + %98 = OpLoad %int %i + %99 = OpIAdd %int %98 %int_1 + OpStore %i %99 + OpBranch %38 + %39 = OpLabel + %100 = OpLoad %v4float %color + OpStore %x_GLF_color %100 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %101 +%tint_symbol = OpFunctionParameter %main_out + %105 = OpLabel + %106 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %106 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %108 = OpLabel + %109 = OpFunctionCall %void %main_1 + %111 = OpLoad %v4float %x_GLF_color + %112 = OpCompositeConstruct %main_out %111 + %110 = OpFunctionCall %void %tint_symbol_2 %112 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..69896d9167 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.spvasm.expected.wgsl @@ -0,0 +1,104 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var color : vec4; + var i : i32; + var j : i32; + var k : i32; + color = vec4(1.0, 1.0, 1.0, 1.0); + let x_37 : i32 = x_7.x_GLF_uniform_int_values[0]; + i = x_37; + loop { + let x_42 : i32 = i; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_42 < x_44)) { + } else { + break; + } + let x_47 : i32 = i; + switch(x_47) { + case 2: { + let x_83 : i32 = i; + let x_85 : f32 = x_11.x_GLF_uniform_float_values[0]; + color[x_83] = x_85; + } + case 1: { + let x_52 : i32 = x_7.x_GLF_uniform_int_values[0]; + j = x_52; + loop { + let x_57 : i32 = i; + let x_58 : i32 = i; + if ((x_57 > x_58)) { + } else { + break; + } + let x_62 : i32 = x_7.x_GLF_uniform_int_values[0]; + k = x_62; + loop { + let x_67 : i32 = k; + let x_68 : i32 = i; + if ((x_67 < x_68)) { + } else { + break; + } + let x_71 : i32 = k; + let x_73 : f32 = x_11.x_GLF_uniform_float_values[0]; + color[x_71] = x_73; + + continuing { + let x_75 : i32 = k; + k = (x_75 + 1); + } + } + + continuing { + let x_77 : i32 = j; + j = (x_77 + 1); + } + } + let x_79 : i32 = i; + let x_81 : f32 = x_11.x_GLF_uniform_float_values[0]; + color[x_79] = x_81; + } + default: { + } + } + + continuing { + let x_87 : i32 = i; + i = (x_87 + 1); + } + } + let x_89 : vec4 = color; + x_GLF_color = x_89; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl new file mode 100644 index 0000000000..69896d9167 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl @@ -0,0 +1,104 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var color : vec4; + var i : i32; + var j : i32; + var k : i32; + color = vec4(1.0, 1.0, 1.0, 1.0); + let x_37 : i32 = x_7.x_GLF_uniform_int_values[0]; + i = x_37; + loop { + let x_42 : i32 = i; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_42 < x_44)) { + } else { + break; + } + let x_47 : i32 = i; + switch(x_47) { + case 2: { + let x_83 : i32 = i; + let x_85 : f32 = x_11.x_GLF_uniform_float_values[0]; + color[x_83] = x_85; + } + case 1: { + let x_52 : i32 = x_7.x_GLF_uniform_int_values[0]; + j = x_52; + loop { + let x_57 : i32 = i; + let x_58 : i32 = i; + if ((x_57 > x_58)) { + } else { + break; + } + let x_62 : i32 = x_7.x_GLF_uniform_int_values[0]; + k = x_62; + loop { + let x_67 : i32 = k; + let x_68 : i32 = i; + if ((x_67 < x_68)) { + } else { + break; + } + let x_71 : i32 = k; + let x_73 : f32 = x_11.x_GLF_uniform_float_values[0]; + color[x_71] = x_73; + + continuing { + let x_75 : i32 = k; + k = (x_75 + 1); + } + } + + continuing { + let x_77 : i32 = j; + j = (x_77 + 1); + } + } + let x_79 : i32 = i; + let x_81 : f32 = x_11.x_GLF_uniform_float_values[0]; + color[x_79] = x_81; + } + default: { + } + } + + continuing { + let x_87 : i32 = i; + i = (x_87 + 1); + } + } + let x_89 : vec4 = color; + x_GLF_color = x_89; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..8dae79cb12 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.hlsl @@ -0,0 +1,86 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + int j = 0; + int k = 0; + color = float4(1.0f, 1.0f, 1.0f, 1.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_37 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + i = x_37; + while (true) { + const int x_42 = i; + const int x_44 = asint(x_7[1].x); + if ((x_42 < x_44)) { + } else { + break; + } + switch(i) { + case 2: { + const int x_83 = i; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_85 = asfloat(x_11[scalar_offset_1 / 4][scalar_offset_1 % 4]); + set_float4(color, x_83, x_85); + break; + } + case 1: { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_52 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + j = x_52; + { + for(; (i > i); j = (j + 1)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_62 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + k = x_62; + { + for(; (k < i); k = (k + 1)) { + const int x_71 = k; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_73 = asfloat(x_11[scalar_offset_4 / 4][scalar_offset_4 % 4]); + set_float4(color, x_71, x_73); + } + } + } + } + const int x_79 = i; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_81 = asfloat(x_11[scalar_offset_5 / 4][scalar_offset_5 % 4]); + set_float4(color, x_79, x_81); + break; + } + default: { + break; + } + } + { + i = (i + 1); + } + } + x_GLF_color = color; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..82cc6aed7a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, constant buf1& x_11, thread float4* const tint_symbol_4) { + float4 color = 0.0f; + int i = 0; + int j = 0; + int k = 0; + color = float4(1.0f, 1.0f, 1.0f, 1.0f); + int const x_37 = x_7.x_GLF_uniform_int_values.arr[0].el; + i = x_37; + while (true) { + int const x_42 = i; + int const x_44 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_42 < x_44)) { + } else { + break; + } + int const x_47 = i; + switch(x_47) { + case 2: { + int const x_83 = i; + float const x_85 = x_11.x_GLF_uniform_float_values.arr[0].el; + color[x_83] = x_85; + break; + } + case 1: { + int const x_52 = x_7.x_GLF_uniform_int_values.arr[0].el; + j = x_52; + while (true) { + int const x_57 = i; + int const x_58 = i; + if ((x_57 > x_58)) { + } else { + break; + } + int const x_62 = x_7.x_GLF_uniform_int_values.arr[0].el; + k = x_62; + while (true) { + int const x_67 = k; + int const x_68 = i; + if ((x_67 < x_68)) { + } else { + break; + } + int const x_71 = k; + float const x_73 = x_11.x_GLF_uniform_float_values.arr[0].el; + color[x_71] = x_73; + { + int const x_75 = k; + k = (x_75 + 1); + } + } + { + int const x_77 = j; + j = (x_77 + 1); + } + } + int const x_79 = i; + float const x_81 = x_11.x_GLF_uniform_float_values.arr[0].el; + color[x_79] = x_81; + break; + } + default: { + break; + } + } + { + int const x_87 = i; + i = (x_87 + 1); + } + } + float4 const x_89 = color; + *(tint_symbol_4) = x_89; + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, x_11, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..3cdb9a4c33 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.spvasm @@ -0,0 +1,203 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 113 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %color "color" + OpName %i "i" + OpName %j "j" + OpName %k "k" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %32 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %101 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %color = OpVariable %_ptr_Function_v4float Function %17 + %i = OpVariable %_ptr_Function_int Function %28 + %j = OpVariable %_ptr_Function_int Function %28 + %k = OpVariable %_ptr_Function_int Function %28 + OpStore %color %32 + %36 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %37 = OpLoad %int %36 + OpStore %i %37 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %42 = OpLoad %int %i + %44 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpSLessThan %bool %42 %45 + OpSelectionMerge %48 None + OpBranchConditional %46 %49 %50 + %49 = OpLabel + OpBranch %48 + %50 = OpLabel + OpBranch %39 + %48 = OpLabel + %51 = OpLoad %int %i + OpSelectionMerge %52 None + OpSwitch %51 %53 2 %54 1 %55 + %54 = OpLabel + %56 = OpLoad %int %i + %58 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %59 = OpLoad %float %58 + %61 = OpAccessChain %_ptr_Function_float %color %56 + OpStore %61 %59 + OpBranch %52 + %55 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %63 = OpLoad %int %62 + OpStore %j %63 + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %int %i + %69 = OpLoad %int %i + %70 = OpSGreaterThan %bool %68 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %65 + %71 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %75 = OpLoad %int %74 + OpStore %k %75 + OpBranch %76 + %76 = OpLabel + OpLoopMerge %77 %78 None + OpBranch %79 + %79 = OpLabel + %80 = OpLoad %int %k + %81 = OpLoad %int %i + %82 = OpSLessThan %bool %80 %81 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + OpBranch %83 + %85 = OpLabel + OpBranch %77 + %83 = OpLabel + %86 = OpLoad %int %k + %87 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %88 = OpLoad %float %87 + %89 = OpAccessChain %_ptr_Function_float %color %86 + OpStore %89 %88 + OpBranch %78 + %78 = OpLabel + %90 = OpLoad %int %k + %91 = OpIAdd %int %90 %int_1 + OpStore %k %91 + OpBranch %76 + %77 = OpLabel + OpBranch %66 + %66 = OpLabel + %92 = OpLoad %int %j + %93 = OpIAdd %int %92 %int_1 + OpStore %j %93 + OpBranch %64 + %65 = OpLabel + %94 = OpLoad %int %i + %95 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %int_0 + %96 = OpLoad %float %95 + %97 = OpAccessChain %_ptr_Function_float %color %94 + OpStore %97 %96 + OpBranch %52 + %53 = OpLabel + OpBranch %52 + %52 = OpLabel + OpBranch %40 + %40 = OpLabel + %98 = OpLoad %int %i + %99 = OpIAdd %int %98 %int_1 + OpStore %i %99 + OpBranch %38 + %39 = OpLabel + %100 = OpLoad %v4float %color + OpStore %x_GLF_color %100 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %101 +%tint_symbol = OpFunctionParameter %main_out + %105 = OpLabel + %106 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %106 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %108 = OpLabel + %109 = OpFunctionCall %void %main_1 + %111 = OpLoad %v4float %x_GLF_color + %112 = OpCompositeConstruct %main_out %111 + %110 = OpFunctionCall %void %tint_symbol_2 %112 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..69896d9167 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-for-for-for/0-opt.wgsl.expected.wgsl @@ -0,0 +1,104 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var color : vec4; + var i : i32; + var j : i32; + var k : i32; + color = vec4(1.0, 1.0, 1.0, 1.0); + let x_37 : i32 = x_7.x_GLF_uniform_int_values[0]; + i = x_37; + loop { + let x_42 : i32 = i; + let x_44 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_42 < x_44)) { + } else { + break; + } + let x_47 : i32 = i; + switch(x_47) { + case 2: { + let x_83 : i32 = i; + let x_85 : f32 = x_11.x_GLF_uniform_float_values[0]; + color[x_83] = x_85; + } + case 1: { + let x_52 : i32 = x_7.x_GLF_uniform_int_values[0]; + j = x_52; + loop { + let x_57 : i32 = i; + let x_58 : i32 = i; + if ((x_57 > x_58)) { + } else { + break; + } + let x_62 : i32 = x_7.x_GLF_uniform_int_values[0]; + k = x_62; + loop { + let x_67 : i32 = k; + let x_68 : i32 = i; + if ((x_67 < x_68)) { + } else { + break; + } + let x_71 : i32 = k; + let x_73 : f32 = x_11.x_GLF_uniform_float_values[0]; + color[x_71] = x_73; + + continuing { + let x_75 : i32 = k; + k = (x_75 + 1); + } + } + + continuing { + let x_77 : i32 = j; + j = (x_77 + 1); + } + } + let x_79 : i32 = i; + let x_81 : f32 = x_11.x_GLF_uniform_float_values[0]; + color[x_79] = x_81; + } + default: { + } + } + + continuing { + let x_87 : i32 = i; + i = (x_87 + 1); + } + } + let x_89 : vec4 = color; + x_GLF_color = x_89; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm new file mode 100644 index 0000000000..9adfcd15b8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm @@ -0,0 +1,157 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zero" + OpName %__0 "" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__1 "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 2 + OpDecorate %i RelaxedPrecision + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 0 + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + %void = OpTypeVoid + %19 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__0 = OpVariable %_ptr_Uniform_buf2 Uniform + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool +%_ptr_Function_int = OpTypePointer Function %int +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__1 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %19 + %36 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %37 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpCompositeConstruct %v4float %38 %38 %38 %38 + OpStore %_GLF_color %39 + %40 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %43 = OpLoad %float %42 + %44 = OpFOrdGreaterThan %bool %41 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpCompositeConstruct %v4float %53 %53 %53 %53 + OpStore %_GLF_color %54 + OpBranch %50 + %50 = OpLabel + OpBranchConditional %true %48 %49 + %49 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + OpBranchConditional %true %63 %60 + %63 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %13 = OpLoad %int %64 + OpStore %i %13 + OpBranch %65 + %65 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %14 = OpLoad %int %i + %69 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %15 = OpLoad %int %69 + %70 = OpSLessThan %bool %14 %15 + OpBranchConditional %70 %71 %66 + %71 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %79 = OpLoad %float %78 + %80 = OpCompositeConstruct %v4float %73 %75 %77 %79 + OpStore %_GLF_color %80 + OpBranch %67 + %67 = OpLabel + %16 = OpLoad %int %i + %17 = OpIAdd %int %16 %int_1 + OpStore %i %17 + OpBranch %65 + %66 = OpLabel + OpBranch %60 + %61 = OpLabel + OpBranch %59 + %60 = OpLabel + OpBranch %57 + %57 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %84 = OpLoad %float %83 + %85 = OpFOrdGreaterThan %bool %82 %84 + OpBranchConditional %85 %55 %56 + %56 = OpLabel + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.hlsl new file mode 100755 index 0000000000..1653b58822 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.hlsl @@ -0,0 +1,95 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b1, space0) { + uint4 x_5[2]; +}; +cbuffer cbuffer_x_7 : register(b2, space0) { + uint4 x_7[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; + +void main_1() { + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_38 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + x_GLF_color = float4(x_38, x_38, x_38, x_38); + const float x_41 = asfloat(x_7[0].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_43 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_41 > x_43)) { + while (true) { + const float x_53 = asfloat(x_5[1].x); + x_GLF_color = float4(x_53, x_53, x_53, x_53); + { + if (true) { + } else { + break; + } + } + } + } else { + while (true) { + while (true) { + if (true) { + } else { + break; + } + const int x_13 = asint(x_10[1].x); + i = x_13; + while (true) { + const int x_14 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_15 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_14 < x_15)) { + } else { + break; + } + const float x_73 = asfloat(x_5[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_75 = asfloat(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_77 = asfloat(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_79 = asfloat(x_5[1].x); + x_GLF_color = float4(x_73, x_75, x_77, x_79); + { + i = (i + 1); + } + } + break; + } + { + const float x_82 = asfloat(x_7[0].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_84 = asfloat(x_5[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_82 > x_84)) { + } else { + break; + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} +error: validation errors +T:\tmp\uf58.0:82: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..126ce9219a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.msl @@ -0,0 +1,99 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ float zero; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_5, constant buf2& x_7, constant buf0& x_10, thread float4* const tint_symbol_4) { + int i = 0; + float const x_38 = x_5.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_38, x_38, x_38, x_38); + float const x_41 = x_7.zero; + float const x_43 = x_5.x_GLF_uniform_float_values.arr[0].el; + if ((x_41 > x_43)) { + while (true) { + float const x_53 = x_5.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_53, x_53, x_53, x_53); + { + if (true) { + } else { + break; + } + } + } + } else { + while (true) { + while (true) { + if (true) { + } else { + break; + } + int const x_13 = x_10.x_GLF_uniform_int_values.arr[1].el; + i = x_13; + while (true) { + int const x_14 = i; + int const x_15 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_14 < x_15)) { + } else { + break; + } + float const x_73 = x_5.x_GLF_uniform_float_values.arr[1].el; + float const x_75 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_77 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_79 = x_5.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_73, x_75, x_77, x_79); + { + int const x_16 = i; + i = (x_16 + 1); + } + } + break; + } + { + float const x_82 = x_7.zero; + float const x_84 = x_5.x_GLF_uniform_float_values.arr[0].el; + if ((x_82 > x_84)) { + } else { + break; + } + } + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_5 [[buffer(1)]], constant buf2& x_7 [[buffer(2)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_7, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..cb7829cf61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.spvasm @@ -0,0 +1,214 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_5 "x_5" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zero" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_5 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_7 = OpVariable %_ptr_Uniform_buf2 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %100 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %i = OpVariable %_ptr_Function_int Function %28 + %32 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %33 = OpLoad %float %32 + %34 = OpCompositeConstruct %v4float %33 %33 %33 %33 + OpStore %x_GLF_color %34 + %35 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %36 = OpLoad %float %35 + %37 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpFOrdGreaterThan %bool %36 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %43 + %42 = OpLabel + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %50 = OpLoad %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %x_GLF_color %51 + OpBranch %46 + %46 = OpLabel + OpSelectionMerge %53 None + OpBranchConditional %true %54 %55 + %54 = OpLabel + OpBranch %53 + %55 = OpLabel + OpBranch %45 + %53 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + OpBranch %60 + %60 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + OpSelectionMerge %64 None + OpBranchConditional %true %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %61 + %64 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %69 = OpLoad %int %68 + OpStore %i %69 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpSLessThan %bool %74 %76 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + OpBranch %78 + %80 = OpLabel + OpBranch %71 + %78 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %84 = OpLoad %float %83 + %85 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %86 = OpLoad %float %85 + %87 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %88 = OpLoad %float %87 + %89 = OpCompositeConstruct %v4float %82 %84 %86 %88 + OpStore %x_GLF_color %89 + OpBranch %72 + %72 = OpLabel + %90 = OpLoad %int %i + %91 = OpIAdd %int %90 %int_1 + OpStore %i %91 + OpBranch %70 + %71 = OpLabel + OpBranch %61 + %62 = OpLabel + OpBranch %60 + %61 = OpLabel + OpBranch %58 + %58 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %93 = OpLoad %float %92 + %94 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %95 = OpLoad %float %94 + %96 = OpFOrdGreaterThan %bool %93 %95 + OpSelectionMerge %97 None + OpBranchConditional %96 %98 %99 + %98 = OpLabel + OpBranch %97 + %99 = OpLabel + OpBranch %57 + %97 = OpLabel + OpBranch %56 + %57 = OpLabel + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %100 +%tint_symbol = OpFunctionParameter %main_out + %104 = OpLabel + %105 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %105 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %107 = OpLabel + %108 = OpFunctionCall %void %main_1 + %110 = OpLoad %v4float %x_GLF_color + %111 = OpCompositeConstruct %main_out %110 + %109 = OpFunctionCall %void %tint_symbol_2 %111 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 46[%46] is not post dominated by the back-edge block 53[%53] + %53 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..4b28ce8bda --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.wgsl @@ -0,0 +1,98 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + zero : f32; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_5 : buf1; + +[[group(0), binding(2)]] var x_7 : buf2; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn main_1() { + var i : i32; + let x_38 : f32 = x_5.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_38, x_38, x_38, x_38); + let x_41 : f32 = x_7.zero; + let x_43 : f32 = x_5.x_GLF_uniform_float_values[0]; + if ((x_41 > x_43)) { + loop { + let x_53 : f32 = x_5.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_53, x_53, x_53, x_53); + + continuing { + if (true) { + } else { + break; + } + } + } + } else { + loop { + loop { + if (true) { + } else { + break; + } + let x_13 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_13; + loop { + let x_14 : i32 = i; + let x_15 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_14 < x_15)) { + } else { + break; + } + let x_73 : f32 = x_5.x_GLF_uniform_float_values[1]; + let x_75 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_77 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_79 : f32 = x_5.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_73, x_75, x_77, x_79); + + continuing { + let x_16 : i32 = i; + i = (x_16 + 1); + } + } + break; + } + + continuing { + let x_82 : f32 = x_7.zero; + let x_84 : f32 = x_5.x_GLF_uniform_float_values[0]; + if ((x_82 > x_84)) { + } else { + break; + } + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl new file mode 100644 index 0000000000..4b28ce8bda --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl @@ -0,0 +1,98 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + zero : f32; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_5 : buf1; + +[[group(0), binding(2)]] var x_7 : buf2; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn main_1() { + var i : i32; + let x_38 : f32 = x_5.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_38, x_38, x_38, x_38); + let x_41 : f32 = x_7.zero; + let x_43 : f32 = x_5.x_GLF_uniform_float_values[0]; + if ((x_41 > x_43)) { + loop { + let x_53 : f32 = x_5.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_53, x_53, x_53, x_53); + + continuing { + if (true) { + } else { + break; + } + } + } + } else { + loop { + loop { + if (true) { + } else { + break; + } + let x_13 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_13; + loop { + let x_14 : i32 = i; + let x_15 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_14 < x_15)) { + } else { + break; + } + let x_73 : f32 = x_5.x_GLF_uniform_float_values[1]; + let x_75 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_77 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_79 : f32 = x_5.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_73, x_75, x_77, x_79); + + continuing { + let x_16 : i32 = i; + i = (x_16 + 1); + } + } + break; + } + + continuing { + let x_82 : f32 = x_7.zero; + let x_84 : f32 = x_5.x_GLF_uniform_float_values[0]; + if ((x_82 > x_84)) { + } else { + break; + } + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.hlsl new file mode 100755 index 0000000000..94afa1ba8c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.hlsl @@ -0,0 +1,95 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b1, space0) { + uint4 x_5[2]; +}; +cbuffer cbuffer_x_7 : register(b2, space0) { + uint4 x_7[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; + +void main_1() { + int i = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_38 = asfloat(x_5[scalar_offset / 4][scalar_offset % 4]); + x_GLF_color = float4(x_38, x_38, x_38, x_38); + const float x_41 = asfloat(x_7[0].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_43 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_41 > x_43)) { + while (true) { + const float x_53 = asfloat(x_5[1].x); + x_GLF_color = float4(x_53, x_53, x_53, x_53); + { + if (true) { + } else { + break; + } + } + } + } else { + while (true) { + while (true) { + if (true) { + } else { + break; + } + const int x_13 = asint(x_10[1].x); + i = x_13; + while (true) { + const int x_14 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_15 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + if ((x_14 < x_15)) { + } else { + break; + } + const float x_73 = asfloat(x_5[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_75 = asfloat(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_77 = asfloat(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_79 = asfloat(x_5[1].x); + x_GLF_color = float4(x_73, x_75, x_77, x_79); + { + i = (i + 1); + } + } + break; + } + { + const float x_82 = asfloat(x_7[0].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_84 = asfloat(x_5[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_82 > x_84)) { + } else { + break; + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} +error: validation errors +T:\tmp\u4dc.0:82: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..126ce9219a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.msl @@ -0,0 +1,99 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct buf2 { + /* 0x0000 */ float zero; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_5, constant buf2& x_7, constant buf0& x_10, thread float4* const tint_symbol_4) { + int i = 0; + float const x_38 = x_5.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_38, x_38, x_38, x_38); + float const x_41 = x_7.zero; + float const x_43 = x_5.x_GLF_uniform_float_values.arr[0].el; + if ((x_41 > x_43)) { + while (true) { + float const x_53 = x_5.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_53, x_53, x_53, x_53); + { + if (true) { + } else { + break; + } + } + } + } else { + while (true) { + while (true) { + if (true) { + } else { + break; + } + int const x_13 = x_10.x_GLF_uniform_int_values.arr[1].el; + i = x_13; + while (true) { + int const x_14 = i; + int const x_15 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_14 < x_15)) { + } else { + break; + } + float const x_73 = x_5.x_GLF_uniform_float_values.arr[1].el; + float const x_75 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_77 = x_5.x_GLF_uniform_float_values.arr[0].el; + float const x_79 = x_5.x_GLF_uniform_float_values.arr[1].el; + *(tint_symbol_4) = float4(x_73, x_75, x_77, x_79); + { + int const x_16 = i; + i = (x_16 + 1); + } + } + break; + } + { + float const x_82 = x_7.zero; + float const x_84 = x_5.x_GLF_uniform_float_values.arr[0].el; + if ((x_82 > x_84)) { + } else { + break; + } + } + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_5 [[buffer(1)]], constant buf2& x_7 [[buffer(2)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, x_7, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..cb7829cf61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.spvasm @@ -0,0 +1,214 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_5 "x_5" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "zero" + OpName %x_7 "x_7" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_5 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf2 = OpTypeStruct %float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_7 = OpVariable %_ptr_Uniform_buf2 Uniform + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %100 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %i = OpVariable %_ptr_Function_int Function %28 + %32 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %33 = OpLoad %float %32 + %34 = OpCompositeConstruct %v4float %33 %33 %33 %33 + OpStore %x_GLF_color %34 + %35 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %36 = OpLoad %float %35 + %37 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpFOrdGreaterThan %bool %36 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %43 + %42 = OpLabel + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %50 = OpLoad %float %49 + %51 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %x_GLF_color %51 + OpBranch %46 + %46 = OpLabel + OpSelectionMerge %53 None + OpBranchConditional %true %54 %55 + %54 = OpLabel + OpBranch %53 + %55 = OpLabel + OpBranch %45 + %53 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + OpBranch %60 + %60 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + OpSelectionMerge %64 None + OpBranchConditional %true %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %61 + %64 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %69 = OpLoad %int %68 + OpStore %i %69 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %76 = OpLoad %int %75 + %77 = OpSLessThan %bool %74 %76 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + OpBranch %78 + %80 = OpLabel + OpBranch %71 + %78 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %84 = OpLoad %float %83 + %85 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %86 = OpLoad %float %85 + %87 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_1 + %88 = OpLoad %float %87 + %89 = OpCompositeConstruct %v4float %82 %84 %86 %88 + OpStore %x_GLF_color %89 + OpBranch %72 + %72 = OpLabel + %90 = OpLoad %int %i + %91 = OpIAdd %int %90 %int_1 + OpStore %i %91 + OpBranch %70 + %71 = OpLabel + OpBranch %61 + %62 = OpLabel + OpBranch %60 + %61 = OpLabel + OpBranch %58 + %58 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %93 = OpLoad %float %92 + %94 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %int_0 + %95 = OpLoad %float %94 + %96 = OpFOrdGreaterThan %bool %93 %95 + OpSelectionMerge %97 None + OpBranchConditional %96 %98 %99 + %98 = OpLabel + OpBranch %97 + %99 = OpLabel + OpBranch %57 + %97 = OpLabel + OpBranch %56 + %57 = OpLabel + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %100 +%tint_symbol = OpFunctionParameter %main_out + %104 = OpLabel + %105 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %105 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %107 = OpLabel + %108 = OpFunctionCall %void %main_1 + %110 = OpLoad %v4float %x_GLF_color + %111 = OpCompositeConstruct %main_out %110 + %109 = OpFunctionCall %void %tint_symbol_2 %111 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 46[%46] is not post dominated by the back-edge block 53[%53] + %53 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..4b28ce8bda --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.wgsl @@ -0,0 +1,98 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf2 { + zero : f32; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_5 : buf1; + +[[group(0), binding(2)]] var x_7 : buf2; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn main_1() { + var i : i32; + let x_38 : f32 = x_5.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_38, x_38, x_38, x_38); + let x_41 : f32 = x_7.zero; + let x_43 : f32 = x_5.x_GLF_uniform_float_values[0]; + if ((x_41 > x_43)) { + loop { + let x_53 : f32 = x_5.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_53, x_53, x_53, x_53); + + continuing { + if (true) { + } else { + break; + } + } + } + } else { + loop { + loop { + if (true) { + } else { + break; + } + let x_13 : i32 = x_10.x_GLF_uniform_int_values[1]; + i = x_13; + loop { + let x_14 : i32 = i; + let x_15 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_14 < x_15)) { + } else { + break; + } + let x_73 : f32 = x_5.x_GLF_uniform_float_values[1]; + let x_75 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_77 : f32 = x_5.x_GLF_uniform_float_values[0]; + let x_79 : f32 = x_5.x_GLF_uniform_float_values[1]; + x_GLF_color = vec4(x_73, x_75, x_77, x_79); + + continuing { + let x_16 : i32 = i; + i = (x_16 + 1); + } + } + break; + } + + continuing { + let x_82 : f32 = x_7.zero; + let x_84 : f32 = x_5.x_GLF_uniform_float_values[0]; + if ((x_82 > x_84)) { + } else { + break; + } + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm new file mode 100644 index 0000000000..661ac09417 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm @@ -0,0 +1,76 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %gl_FragCoord "gl_FragCoord" + OpName %b "b" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_2 = OpConstant %float 2 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_1_89999998 = OpConstant %float 1.89999998 + %bool = OpTypeBool +%float_2_0999999 = OpConstant %float 2.0999999 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %30 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %10 + %31 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %b = OpVariable %_ptr_Function_float Function + %32 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %33 = OpLoad %float %32 + %34 = OpExtInst %float %1 Cos %33 + %35 = OpDPdx %float %34 + OpStore %a %35 + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %37 = OpLoad %float %36 + %38 = OpLoad %float %a + %39 = OpExtInst %float %1 FMix %float_2 %37 %38 + OpStore %b %39 + %40 = OpLoad %float %b + %41 = OpFOrdGreaterThanEqual %bool %40 %float_1_89999998 + %42 = OpLoad %float %b + %43 = OpFOrdLessThanEqual %bool %42 %float_2_0999999 + %44 = OpLogicalAnd %bool %41 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + OpStore %_GLF_color %29 + OpBranch %45 + %47 = OpLabel + OpStore %_GLF_color %30 + OpBranch %45 + %45 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f5d4020ce1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.hlsl @@ -0,0 +1,43 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + float b = 0.0f; + const float x_33 = gl_FragCoord.x; + a = ddx(cos(x_33)); + const float x_37 = asfloat(x_8[0].x); + b = lerp(2.0f, x_37, a); + bool tint_tmp = (b >= 1.899999976f); + if (tint_tmp) { + tint_tmp = (b <= 2.099999905f); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..31f4571f93 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float two; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float a = 0.0f; + float b = 0.0f; + float const x_33 = (*(tint_symbol_5)).x; + a = dfdx(cos(x_33)); + float const x_37 = x_8.two; + float const x_38 = a; + b = mix(2.0f, x_37, x_38); + float const x_40 = b; + float const x_42 = b; + if (((x_40 >= 1.899999976f) && (x_42 <= 2.099999905f))) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..7858785af9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.spvasm @@ -0,0 +1,116 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 66 +; Schema: 0 + OpCapability Shader + %29 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 +%float_1_89999998 = OpConstant %float 1.89999998 + %bool = OpTypeBool +%float_2_0999999 = OpConstant %float 2.0999999 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %51 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %52 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %a = OpVariable %_ptr_Function_float Function %20 + %b = OpVariable %_ptr_Function_float Function %20 + %25 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %26 = OpLoad %float %25 + %28 = OpExtInst %float %29 Cos %26 + %27 = OpDPdx %float %28 + OpStore %a %27 + %31 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 + %32 = OpLoad %float %31 + %33 = OpLoad %float %a + %34 = OpExtInst %float %29 FMix %float_2 %32 %33 + OpStore %b %34 + %36 = OpLoad %float %b + %37 = OpLoad %float %b + %39 = OpFOrdGreaterThanEqual %bool %36 %float_1_89999998 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %41 + %42 = OpLabel + %44 = OpFOrdLessThanEqual %bool %37 %float_2_0999999 + OpBranch %41 + %41 = OpLabel + %45 = OpPhi %bool %39 %17 %44 %42 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpStore %x_GLF_color %51 + OpBranch %46 + %48 = OpLabel + OpStore %x_GLF_color %52 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %53 +%tint_symbol_1 = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %60 = OpLabel + %61 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %61 + %62 = OpFunctionCall %void %main_1 + %64 = OpLoad %v4float %x_GLF_color + %65 = OpCompositeConstruct %main_out %64 + %63 = OpFunctionCall %void %tint_symbol_3 %65 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..7165a357db --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.spvasm.expected.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + two : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var b : f32; + let x_33 : f32 = gl_FragCoord.x; + a = dpdx(cos(x_33)); + let x_37 : f32 = x_8.two; + let x_38 : f32 = a; + b = mix(2.0, x_37, x_38); + let x_40 : f32 = b; + let x_42 : f32 = b; + if (((x_40 >= 1.899999976) && (x_42 <= 2.099999905))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl new file mode 100644 index 0000000000..7165a357db --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + two : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var b : f32; + let x_33 : f32 = gl_FragCoord.x; + a = dpdx(cos(x_33)); + let x_37 : f32 = x_8.two; + let x_38 : f32 = a; + b = mix(2.0, x_37, x_38); + let x_40 : f32 = b; + let x_42 : f32 = b; + if (((x_40 >= 1.899999976) && (x_42 <= 2.099999905))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f5d4020ce1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.hlsl @@ -0,0 +1,43 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float a = 0.0f; + float b = 0.0f; + const float x_33 = gl_FragCoord.x; + a = ddx(cos(x_33)); + const float x_37 = asfloat(x_8[0].x); + b = lerp(2.0f, x_37, a); + bool tint_tmp = (b >= 1.899999976f); + if (tint_tmp) { + tint_tmp = (b <= 2.099999905f); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..31f4571f93 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float two; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float a = 0.0f; + float b = 0.0f; + float const x_33 = (*(tint_symbol_5)).x; + a = dfdx(cos(x_33)); + float const x_37 = x_8.two; + float const x_38 = a; + b = mix(2.0f, x_37, x_38); + float const x_40 = b; + float const x_42 = b; + if (((x_40 >= 1.899999976f) && (x_42 <= 2.099999905f))) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..7858785af9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.spvasm @@ -0,0 +1,116 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 66 +; Schema: 0 + OpCapability Shader + %29 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %20 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 +%float_1_89999998 = OpConstant %float 1.89999998 + %bool = OpTypeBool +%float_2_0999999 = OpConstant %float 2.0999999 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %51 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %52 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %a = OpVariable %_ptr_Function_float Function %20 + %b = OpVariable %_ptr_Function_float Function %20 + %25 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %26 = OpLoad %float %25 + %28 = OpExtInst %float %29 Cos %26 + %27 = OpDPdx %float %28 + OpStore %a %27 + %31 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 + %32 = OpLoad %float %31 + %33 = OpLoad %float %a + %34 = OpExtInst %float %29 FMix %float_2 %32 %33 + OpStore %b %34 + %36 = OpLoad %float %b + %37 = OpLoad %float %b + %39 = OpFOrdGreaterThanEqual %bool %36 %float_1_89999998 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %41 + %42 = OpLabel + %44 = OpFOrdLessThanEqual %bool %37 %float_2_0999999 + OpBranch %41 + %41 = OpLabel + %45 = OpPhi %bool %39 %17 %44 %42 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpStore %x_GLF_color %51 + OpBranch %46 + %48 = OpLabel + OpStore %x_GLF_color %52 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %53 +%tint_symbol_1 = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %60 = OpLabel + %61 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %61 + %62 = OpFunctionCall %void %main_1 + %64 = OpLoad %v4float %x_GLF_color + %65 = OpCompositeConstruct %main_out %64 + %63 = OpFunctionCall %void %tint_symbol_3 %65 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..7165a357db --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-dfdx-cos/0-opt.wgsl.expected.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + two : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : f32; + var b : f32; + let x_33 : f32 = gl_FragCoord.x; + a = dpdx(cos(x_33)); + let x_37 : f32 = x_8.two; + let x_38 : f32 = a; + b = mix(2.0, x_37, x_38); + let x_40 : f32 = b; + let x_42 : f32 = b; + if (((x_40 >= 1.899999976) && (x_42 <= 2.099999905))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm new file mode 100644 index 0000000000..14facbbe5f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm @@ -0,0 +1,274 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %S "S" + OpMemberName %S 0 "data" + OpName %func_struct_S_i11_ "func(struct-S-i11;" + OpName %s "s" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %i "i" + OpName %arr "arr" + OpName %i_0 "i" + OpName %param "param" + OpName %j "j" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int +%_ptr_Function_S = OpTypePointer Function %S + %21 = OpTypeFunction %void %_ptr_Function_S + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %uint_3 = OpConstant %uint 3 +%_arr_S_uint_3 = OpTypeArray %S %uint_3 +%_ptr_Function__arr_S_uint_3 = OpTypePointer Function %_arr_S_uint_3 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %18 + %44 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %arr = OpVariable %_ptr_Function__arr_S_uint_3 Function + %i_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_S Function + %j = OpVariable %_ptr_Function_int Function + %45 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %46 = OpLoad %int %45 + OpStore %i %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i + %52 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpSLessThan %bool %51 %53 + OpBranchConditional %54 %55 %48 + %55 = OpLabel + %56 = OpLoad %int %i + %57 = OpLoad %int %i + %58 = OpAccessChain %_ptr_Function_int %arr %56 %int_0 + OpStore %58 %57 + OpBranch %49 + %49 = OpLabel + %59 = OpLoad %int %i + %60 = OpIAdd %int %59 %int_1 + OpStore %i %60 + OpBranch %47 + %48 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %62 = OpLoad %int %61 + OpStore %i_0 %62 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpLoad %int %i_0 + %68 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %67 %69 + OpBranchConditional %70 %71 %64 + %71 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %75 = OpLoad %float %74 + %76 = OpFOrdGreaterThan %bool %73 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + OpBranch %64 + %77 = OpLabel + %79 = OpLoad %int %i_0 + %80 = OpAccessChain %_ptr_Function_int %arr %79 %int_0 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %83 = OpLoad %int %82 + %84 = OpIEqual %bool %81 %83 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %87 + %86 = OpLabel + %88 = OpLoad %int %i_0 + %89 = OpExtInst %int %1 SClamp %88 %int_0 %int_3 + %90 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %91 = OpLoad %int %90 + %92 = OpAccessChain %_ptr_Function_int %arr %89 %int_0 + OpStore %92 %91 + %93 = OpAccessChain %_ptr_Function_S %arr %int_2 + %94 = OpLoad %S %93 + OpStore %param %94 + %95 = OpFunctionCall %void %func_struct_S_i11_ %param + %96 = OpLoad %S %param + %97 = OpAccessChain %_ptr_Function_S %arr %int_2 + OpStore %97 %96 + OpBranch %85 + %87 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %99 = OpLoad %int %98 + OpStore %j %99 + OpBranch %100 + %100 = OpLabel + OpLoopMerge %101 %102 None + OpBranch %103 + %103 = OpLabel + %104 = OpLoad %int %j + %105 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %106 = OpLoad %int %105 + %107 = OpSLessThan %bool %104 %106 + OpBranchConditional %107 %108 %101 + %108 = OpLabel + %109 = OpLoad %int %j + %110 = OpAccessChain %_ptr_Function_int %arr %109 %int_0 + %111 = OpLoad %int %110 + %112 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_4 + %113 = OpLoad %int %112 + %114 = OpSGreaterThan %bool %111 %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %115 + %116 = OpLabel + OpKill + %115 = OpLabel + OpBranch %102 + %102 = OpLabel + %117 = OpLoad %int %j + %118 = OpIAdd %int %117 %int_1 + OpStore %j %118 + OpBranch %100 + %101 = OpLabel + OpBranch %85 + %85 = OpLabel + OpBranch %65 + %65 = OpLabel + %119 = OpLoad %int %i_0 + %120 = OpIAdd %int %119 %int_1 + OpStore %i_0 %120 + OpBranch %63 + %64 = OpLabel + %121 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %122 = OpLoad %int %121 + %123 = OpAccessChain %_ptr_Function_int %arr %122 %int_0 + %124 = OpLoad %int %123 + %125 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %126 = OpLoad %int %125 + %127 = OpIEqual %bool %124 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %128 + %129 = OpLabel + %130 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %131 = OpLoad %int %130 + %132 = OpAccessChain %_ptr_Function_int %arr %131 %int_0 + %133 = OpLoad %int %132 + %134 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %135 = OpLoad %int %134 + %136 = OpIEqual %bool %133 %135 + OpBranch %128 + %128 = OpLabel + %137 = OpPhi %bool %127 %64 %136 %129 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %138 + %139 = OpLabel + %140 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %141 = OpLoad %int %140 + %142 = OpAccessChain %_ptr_Function_int %arr %141 %int_0 + %143 = OpLoad %int %142 + %144 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %145 = OpLoad %int %144 + %146 = OpIEqual %bool %143 %145 + OpBranch %138 + %138 = OpLabel + %147 = OpPhi %bool %137 %128 %146 %139 + OpSelectionMerge %148 None + OpBranchConditional %147 %149 %150 + %149 = OpLabel + %151 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %152 = OpLoad %int %151 + %153 = OpConvertSToF %float %152 + %154 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %155 = OpLoad %int %154 + %156 = OpConvertSToF %float %155 + %157 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %158 = OpLoad %int %157 + %159 = OpConvertSToF %float %158 + %160 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %161 = OpLoad %int %160 + %162 = OpConvertSToF %float %161 + %163 = OpCompositeConstruct %v4float %153 %156 %159 %162 + OpStore %_GLF_color %163 + OpBranch %148 + %150 = OpLabel + %164 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %165 = OpLoad %int %164 + %166 = OpConvertSToF %float %165 + %167 = OpCompositeConstruct %v4float %166 %166 %166 %166 + OpStore %_GLF_color %167 + OpBranch %148 + %148 = OpLabel + OpReturn + OpFunctionEnd +%func_struct_S_i11_ = OpFunction %void None %21 + %s = OpFunctionParameter %_ptr_Function_S + %168 = OpLabel + OpBranch %169 + %169 = OpLabel + OpLoopMerge %170 %171 None + OpBranch %172 + %172 = OpLabel + %173 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %174 = OpLoad %float %173 + %175 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %176 = OpLoad %float %175 + %177 = OpFOrdGreaterThan %bool %174 %176 + OpBranchConditional %177 %178 %170 + %178 = OpLabel + OpReturn + %171 = OpLabel + OpBranch %169 + %170 = OpLabel + %179 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %180 = OpLoad %int %179 + %181 = OpAccessChain %_ptr_Function_int %s %int_0 + OpStore %181 %180 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..afea7c2e6c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.hlsl @@ -0,0 +1,153 @@ +struct S { + int data; +}; + +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_struct_S_i11_(inout S s) { + while (true) { + const float x_174 = asfloat(x_8[0].x); + const float x_176 = asfloat(x_8[0].y); + if ((x_174 > x_176)) { + } else { + break; + } + return; + } + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_180 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + s.data = x_180; + return; +} + +void main_1() { + int i = 0; + S arr[3] = (S[3])0; + int i_1 = 0; + S param = (S)0; + int j = 0; + bool x_136 = false; + bool x_146 = false; + bool x_137_phi = false; + bool x_147_phi = false; + const int x_46 = asint(x_10[2].x); + i = x_46; + while (true) { + const int x_51 = i; + const int x_53 = asint(x_10[1].x); + if ((x_51 < x_53)) { + } else { + break; + } + arr[i].data = i; + { + i = (i + 1); + } + } + const int x_62 = asint(x_10[2].x); + i_1 = x_62; + while (true) { + const int x_67 = i_1; + const int x_69 = asint(x_10[1].x); + if ((x_67 < x_69)) { + } else { + break; + } + const float x_73 = asfloat(x_8[0].x); + const float x_75 = asfloat(x_8[0].y); + if ((x_73 > x_75)) { + break; + } + const int x_81 = arr[i_1].data; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_83 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_81 == x_83)) { + const int x_88 = i_1; + const int x_91 = asint(x_10[3].x); + arr[clamp(x_88, 0, 3)].data = x_91; + const S x_94 = arr[2]; + param = x_94; + func_struct_S_i11_(param); + arr[2] = param; + } else { + const int x_99 = asint(x_10[2].x); + j = x_99; + while (true) { + const int x_104 = j; + const int x_106 = asint(x_10[1].x); + if ((x_104 < x_106)) { + } else { + break; + } + const int x_111 = arr[j].data; + const int x_113 = asint(x_10[4].x); + if ((x_111 > x_113)) { + discard; + } + { + j = (j + 1); + } + } + } + { + i_1 = (i_1 + 1); + } + } + const int x_122 = asint(x_10[2].x); + const int x_124 = arr[x_122].data; + const int x_126 = asint(x_10[2].x); + const bool x_127 = (x_124 == x_126); + x_137_phi = x_127; + if (x_127) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_131 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_133 = arr[x_131].data; + const int x_135 = asint(x_10[3].x); + x_136 = (x_133 == x_135); + x_137_phi = x_136; + } + const bool x_137 = x_137_phi; + x_147_phi = x_137; + if (x_137) { + const int x_141 = asint(x_10[3].x); + const int x_143 = arr[x_141].data; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_145 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_146 = (x_143 == x_145); + x_147_phi = x_146; + } + if (x_147_phi) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_152 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const int x_155 = asint(x_10[2].x); + const int x_158 = asint(x_10[2].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_161 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(float(x_152), float(x_155), float(x_158), float(x_161)); + } else { + const int x_165 = asint(x_10[2].x); + const float x_166 = float(x_165); + x_GLF_color = float4(x_166, x_166, x_166, x_166); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..e3b232ef13 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.msl @@ -0,0 +1,168 @@ +#include + +using namespace metal; +struct S { + int data; +}; +struct buf1 { + /* 0x0000 */ packed_float2 v1; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + S arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_struct_S_i11_(constant buf1& x_8, constant buf0& x_10, thread S* const s) { + while (true) { + float const x_174 = x_8.v1.x; + float const x_176 = x_8.v1.y; + if ((x_174 > x_176)) { + } else { + break; + } + return; + } + int const x_180 = x_10.x_GLF_uniform_int_values.arr[0].el; + (*(s)).data = x_180; + return; +} + +void main_1(constant buf0& x_10, constant buf1& x_8, thread float4* const tint_symbol_4) { + int i = 0; + tint_array_wrapper_1 arr = {}; + int i_1 = 0; + S param = {}; + int j = 0; + bool x_136 = false; + bool x_146 = false; + bool x_137_phi = false; + bool x_147_phi = false; + int const x_46 = x_10.x_GLF_uniform_int_values.arr[2].el; + i = x_46; + while (true) { + int const x_51 = i; + int const x_53 = x_10.x_GLF_uniform_int_values.arr[1].el; + if ((x_51 < x_53)) { + } else { + break; + } + int const x_56 = i; + int const x_57 = i; + arr.arr[x_56].data = x_57; + { + int const x_59 = i; + i = (x_59 + 1); + } + } + int const x_62 = x_10.x_GLF_uniform_int_values.arr[2].el; + i_1 = x_62; + while (true) { + int const x_67 = i_1; + int const x_69 = x_10.x_GLF_uniform_int_values.arr[1].el; + if ((x_67 < x_69)) { + } else { + break; + } + float const x_73 = x_8.v1.x; + float const x_75 = x_8.v1.y; + if ((x_73 > x_75)) { + break; + } + int const x_79 = i_1; + int const x_81 = arr.arr[x_79].data; + int const x_83 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_81 == x_83)) { + int const x_88 = i_1; + int const x_91 = x_10.x_GLF_uniform_int_values.arr[3].el; + arr.arr[clamp(x_88, 0, 3)].data = x_91; + S const x_94 = arr.arr[2]; + param = x_94; + func_struct_S_i11_(x_8, x_10, &(param)); + S const x_96 = param; + arr.arr[2] = x_96; + } else { + int const x_99 = x_10.x_GLF_uniform_int_values.arr[2].el; + j = x_99; + while (true) { + int const x_104 = j; + int const x_106 = x_10.x_GLF_uniform_int_values.arr[1].el; + if ((x_104 < x_106)) { + } else { + break; + } + int const x_109 = j; + int const x_111 = arr.arr[x_109].data; + int const x_113 = x_10.x_GLF_uniform_int_values.arr[4].el; + if ((x_111 > x_113)) { + discard_fragment(); + } + { + int const x_117 = j; + j = (x_117 + 1); + } + } + } + { + int const x_119 = i_1; + i_1 = (x_119 + 1); + } + } + int const x_122 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_124 = arr.arr[x_122].data; + int const x_126 = x_10.x_GLF_uniform_int_values.arr[2].el; + bool const x_127 = (x_124 == x_126); + x_137_phi = x_127; + if (x_127) { + int const x_131 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_133 = arr.arr[x_131].data; + int const x_135 = x_10.x_GLF_uniform_int_values.arr[3].el; + x_136 = (x_133 == x_135); + x_137_phi = x_136; + } + bool const x_137 = x_137_phi; + x_147_phi = x_137; + if (x_137) { + int const x_141 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_143 = arr.arr[x_141].data; + int const x_145 = x_10.x_GLF_uniform_int_values.arr[0].el; + x_146 = (x_143 == x_145); + x_147_phi = x_146; + } + bool const x_147 = x_147_phi; + if (x_147) { + int const x_152 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_155 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_158 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_161 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_152), float(x_155), float(x_158), float(x_161)); + } else { + int const x_165 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_166 = float(x_165); + *(tint_symbol_4) = float4(x_166, x_166, x_166, x_166); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_10 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_10, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f707389755 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.spvasm @@ -0,0 +1,350 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 218 +; Schema: 0 + OpCapability Shader + %123 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %x_8 "x_8" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %S "S" + OpMemberName %S 0 "data" + OpName %func_struct_S_i11_ "func_struct_S_i11_" + OpName %s "s" + OpName %main_1 "main_1" + OpName %i "i" + OpName %arr "arr" + OpName %i_1 "i_1" + OpName %param "param" + OpName %j "j" + OpName %x_136 "x_136" + OpName %x_146 "x_146" + OpName %x_137_phi "x_137_phi" + OpName %x_147_phi "x_147_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_arr_S_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %S = OpTypeStruct %int +%_ptr_Function_S = OpTypePointer Function %S + %19 = OpTypeFunction %void %_ptr_Function_S + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %49 = OpTypeFunction %void + %53 = OpConstantNull %int + %uint_3 = OpConstant %uint 3 +%_arr_S_uint_3 = OpTypeArray %S %uint_3 +%_ptr_Function__arr_S_uint_3 = OpTypePointer Function %_arr_S_uint_3 + %58 = OpConstantNull %_arr_S_uint_3 + %61 = OpConstantNull %S +%_ptr_Function_bool = OpTypePointer Function %bool + %65 = OpConstantNull %bool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %206 = OpTypeFunction %void %main_out +%func_struct_S_i11_ = OpFunction %void None %19 + %s = OpFunctionParameter %_ptr_Function_S + %25 = OpLabel + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %32 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %36 = OpLoad %float %35 + %37 = OpFOrdGreaterThan %bool %33 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %27 + %39 = OpLabel + OpReturn + %28 = OpLabel + OpBranch %26 + %27 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %45 = OpLoad %int %44 + %48 = OpAccessChain %_ptr_Function_int %s %uint_0 + OpStore %48 %45 + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %49 + %51 = OpLabel + %i = OpVariable %_ptr_Function_int Function %53 + %arr = OpVariable %_ptr_Function__arr_S_uint_3 Function %58 + %i_1 = OpVariable %_ptr_Function_int Function %53 + %param = OpVariable %_ptr_Function_S Function %61 + %j = OpVariable %_ptr_Function_int Function %53 + %x_136 = OpVariable %_ptr_Function_bool Function %65 + %x_146 = OpVariable %_ptr_Function_bool Function %65 + %x_137_phi = OpVariable %_ptr_Function_bool Function %65 + %x_147_phi = OpVariable %_ptr_Function_bool Function %65 + %70 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %71 = OpLoad %int %70 + OpStore %i %71 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %int %i + %78 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpSLessThan %bool %76 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %73 + %81 = OpLabel + %84 = OpLoad %int %i + %85 = OpLoad %int %i + %86 = OpAccessChain %_ptr_Function_int %arr %84 %uint_0 + OpStore %86 %85 + OpBranch %74 + %74 = OpLabel + %87 = OpLoad %int %i + %88 = OpIAdd %int %87 %int_1 + OpStore %i %88 + OpBranch %72 + %73 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %90 = OpLoad %int %89 + OpStore %i_1 %90 + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %i_1 + %96 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpSLessThan %bool %95 %97 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %101 + %100 = OpLabel + OpBranch %99 + %101 = OpLabel + OpBranch %92 + %99 = OpLabel + %102 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %105 = OpLoad %float %104 + %106 = OpFOrdGreaterThan %bool %103 %105 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %107 + %108 = OpLabel + OpBranch %92 + %107 = OpLabel + %109 = OpLoad %int %i_1 + %110 = OpAccessChain %_ptr_Function_int %arr %109 %uint_0 + %111 = OpLoad %int %110 + %112 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %113 = OpLoad %int %112 + %114 = OpIEqual %bool %111 %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %117 + %116 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %121 = OpLoad %int %120 + %122 = OpExtInst %int %123 SClamp %118 %int_0 %int_3 + %124 = OpAccessChain %_ptr_Function_int %arr %122 %uint_0 + OpStore %124 %121 + %125 = OpAccessChain %_ptr_Function_S %arr %int_2 + %126 = OpLoad %S %125 + OpStore %param %126 + %127 = OpFunctionCall %void %func_struct_S_i11_ %param + %129 = OpLoad %S %param + %130 = OpAccessChain %_ptr_Function_S %arr %int_2 + OpStore %130 %129 + OpBranch %115 + %117 = OpLabel + %131 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %132 = OpLoad %int %131 + OpStore %j %132 + OpBranch %133 + %133 = OpLabel + OpLoopMerge %134 %135 None + OpBranch %136 + %136 = OpLabel + %137 = OpLoad %int %j + %138 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %139 = OpLoad %int %138 + %140 = OpSLessThan %bool %137 %139 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %143 + %142 = OpLabel + OpBranch %141 + %143 = OpLabel + OpBranch %134 + %141 = OpLabel + %144 = OpLoad %int %j + %145 = OpAccessChain %_ptr_Function_int %arr %144 %uint_0 + %146 = OpLoad %int %145 + %148 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_4 + %149 = OpLoad %int %148 + %150 = OpSGreaterThan %bool %146 %149 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %151 + %152 = OpLabel + OpKill + %151 = OpLabel + OpBranch %135 + %135 = OpLabel + %153 = OpLoad %int %j + %154 = OpIAdd %int %153 %int_1 + OpStore %j %154 + OpBranch %133 + %134 = OpLabel + OpBranch %115 + %115 = OpLabel + OpBranch %93 + %93 = OpLabel + %155 = OpLoad %int %i_1 + %156 = OpIAdd %int %155 %int_1 + OpStore %i_1 %156 + OpBranch %91 + %92 = OpLabel + %157 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %158 = OpLoad %int %157 + %159 = OpAccessChain %_ptr_Function_int %arr %158 %uint_0 + %160 = OpLoad %int %159 + %161 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %162 = OpLoad %int %161 + %163 = OpIEqual %bool %160 %162 + OpStore %x_137_phi %163 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %164 + %165 = OpLabel + %166 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %167 = OpLoad %int %166 + %168 = OpAccessChain %_ptr_Function_int %arr %167 %uint_0 + %169 = OpLoad %int %168 + %170 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %171 = OpLoad %int %170 + %172 = OpIEqual %bool %169 %171 + OpStore %x_136 %172 + %173 = OpLoad %bool %x_136 + OpStore %x_137_phi %173 + OpBranch %164 + %164 = OpLabel + %174 = OpLoad %bool %x_137_phi + OpStore %x_147_phi %174 + OpSelectionMerge %175 None + OpBranchConditional %174 %176 %175 + %176 = OpLabel + %177 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %178 = OpLoad %int %177 + %179 = OpAccessChain %_ptr_Function_int %arr %178 %uint_0 + %180 = OpLoad %int %179 + %181 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %182 = OpLoad %int %181 + %183 = OpIEqual %bool %180 %182 + OpStore %x_146 %183 + %184 = OpLoad %bool %x_146 + OpStore %x_147_phi %184 + OpBranch %175 + %175 = OpLabel + %185 = OpLoad %bool %x_147_phi + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + %189 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %190 = OpLoad %int %189 + %191 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %192 = OpLoad %int %191 + %193 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %194 = OpLoad %int %193 + %195 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %196 = OpLoad %int %195 + %197 = OpConvertSToF %float %190 + %198 = OpConvertSToF %float %192 + %199 = OpConvertSToF %float %194 + %200 = OpConvertSToF %float %196 + %201 = OpCompositeConstruct %v4float %197 %198 %199 %200 + OpStore %x_GLF_color %201 + OpBranch %186 + %188 = OpLabel + %202 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %203 = OpLoad %int %202 + %204 = OpConvertSToF %float %203 + %205 = OpCompositeConstruct %v4float %204 %204 %204 %204 + OpStore %x_GLF_color %205 + OpBranch %186 + %186 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %206 +%tint_symbol = OpFunctionParameter %main_out + %210 = OpLabel + %211 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %211 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %49 + %213 = OpLabel + %214 = OpFunctionCall %void %main_1 + %216 = OpLoad %v4float %x_GLF_color + %217 = OpCompositeConstruct %main_out %216 + %215 = OpFunctionCall %void %tint_symbol_2 %217 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..68f76e2299 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.spvasm.expected.wgsl @@ -0,0 +1,166 @@ +struct S { + data : i32; +}; + +[[block]] +struct buf1 { + v1 : vec2; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i11_(s : ptr) { + loop { + let x_174 : f32 = x_8.v1.x; + let x_176 : f32 = x_8.v1.y; + if ((x_174 > x_176)) { + } else { + break; + } + return; + } + let x_180 : i32 = x_10.x_GLF_uniform_int_values[0]; + (*(s)).data = x_180; + return; +} + +fn main_1() { + var i : i32; + var arr : array; + var i_1 : i32; + var param : S; + var j : i32; + var x_136 : bool; + var x_146 : bool; + var x_137_phi : bool; + var x_147_phi : bool; + let x_46 : i32 = x_10.x_GLF_uniform_int_values[2]; + i = x_46; + loop { + let x_51 : i32 = i; + let x_53 : i32 = x_10.x_GLF_uniform_int_values[1]; + if ((x_51 < x_53)) { + } else { + break; + } + let x_56 : i32 = i; + let x_57 : i32 = i; + arr[x_56].data = x_57; + + continuing { + let x_59 : i32 = i; + i = (x_59 + 1); + } + } + let x_62 : i32 = x_10.x_GLF_uniform_int_values[2]; + i_1 = x_62; + loop { + let x_67 : i32 = i_1; + let x_69 : i32 = x_10.x_GLF_uniform_int_values[1]; + if ((x_67 < x_69)) { + } else { + break; + } + let x_73 : f32 = x_8.v1.x; + let x_75 : f32 = x_8.v1.y; + if ((x_73 > x_75)) { + break; + } + let x_79 : i32 = i_1; + let x_81 : i32 = arr[x_79].data; + let x_83 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_81 == x_83)) { + let x_88 : i32 = i_1; + let x_91 : i32 = x_10.x_GLF_uniform_int_values[3]; + arr[clamp(x_88, 0, 3)].data = x_91; + let x_94 : S = arr[2]; + param = x_94; + func_struct_S_i11_(&(param)); + let x_96 : S = param; + arr[2] = x_96; + } else { + let x_99 : i32 = x_10.x_GLF_uniform_int_values[2]; + j = x_99; + loop { + let x_104 : i32 = j; + let x_106 : i32 = x_10.x_GLF_uniform_int_values[1]; + if ((x_104 < x_106)) { + } else { + break; + } + let x_109 : i32 = j; + let x_111 : i32 = arr[x_109].data; + let x_113 : i32 = x_10.x_GLF_uniform_int_values[4]; + if ((x_111 > x_113)) { + discard; + } + + continuing { + let x_117 : i32 = j; + j = (x_117 + 1); + } + } + } + + continuing { + let x_119 : i32 = i_1; + i_1 = (x_119 + 1); + } + } + let x_122 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_124 : i32 = arr[x_122].data; + let x_126 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_127 : bool = (x_124 == x_126); + x_137_phi = x_127; + if (x_127) { + let x_131 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_133 : i32 = arr[x_131].data; + let x_135 : i32 = x_10.x_GLF_uniform_int_values[3]; + x_136 = (x_133 == x_135); + x_137_phi = x_136; + } + let x_137 : bool = x_137_phi; + x_147_phi = x_137; + if (x_137) { + let x_141 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_143 : i32 = arr[x_141].data; + let x_145 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_146 = (x_143 == x_145); + x_147_phi = x_146; + } + let x_147 : bool = x_147_phi; + if (x_147) { + let x_152 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_155 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_158 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_161 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_152), f32(x_155), f32(x_158), f32(x_161)); + } else { + let x_165 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_166 : f32 = f32(x_165); + x_GLF_color = vec4(x_166, x_166, x_166, x_166); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl new file mode 100644 index 0000000000..68f76e2299 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl @@ -0,0 +1,166 @@ +struct S { + data : i32; +}; + +[[block]] +struct buf1 { + v1 : vec2; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i11_(s : ptr) { + loop { + let x_174 : f32 = x_8.v1.x; + let x_176 : f32 = x_8.v1.y; + if ((x_174 > x_176)) { + } else { + break; + } + return; + } + let x_180 : i32 = x_10.x_GLF_uniform_int_values[0]; + (*(s)).data = x_180; + return; +} + +fn main_1() { + var i : i32; + var arr : array; + var i_1 : i32; + var param : S; + var j : i32; + var x_136 : bool; + var x_146 : bool; + var x_137_phi : bool; + var x_147_phi : bool; + let x_46 : i32 = x_10.x_GLF_uniform_int_values[2]; + i = x_46; + loop { + let x_51 : i32 = i; + let x_53 : i32 = x_10.x_GLF_uniform_int_values[1]; + if ((x_51 < x_53)) { + } else { + break; + } + let x_56 : i32 = i; + let x_57 : i32 = i; + arr[x_56].data = x_57; + + continuing { + let x_59 : i32 = i; + i = (x_59 + 1); + } + } + let x_62 : i32 = x_10.x_GLF_uniform_int_values[2]; + i_1 = x_62; + loop { + let x_67 : i32 = i_1; + let x_69 : i32 = x_10.x_GLF_uniform_int_values[1]; + if ((x_67 < x_69)) { + } else { + break; + } + let x_73 : f32 = x_8.v1.x; + let x_75 : f32 = x_8.v1.y; + if ((x_73 > x_75)) { + break; + } + let x_79 : i32 = i_1; + let x_81 : i32 = arr[x_79].data; + let x_83 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_81 == x_83)) { + let x_88 : i32 = i_1; + let x_91 : i32 = x_10.x_GLF_uniform_int_values[3]; + arr[clamp(x_88, 0, 3)].data = x_91; + let x_94 : S = arr[2]; + param = x_94; + func_struct_S_i11_(&(param)); + let x_96 : S = param; + arr[2] = x_96; + } else { + let x_99 : i32 = x_10.x_GLF_uniform_int_values[2]; + j = x_99; + loop { + let x_104 : i32 = j; + let x_106 : i32 = x_10.x_GLF_uniform_int_values[1]; + if ((x_104 < x_106)) { + } else { + break; + } + let x_109 : i32 = j; + let x_111 : i32 = arr[x_109].data; + let x_113 : i32 = x_10.x_GLF_uniform_int_values[4]; + if ((x_111 > x_113)) { + discard; + } + + continuing { + let x_117 : i32 = j; + j = (x_117 + 1); + } + } + } + + continuing { + let x_119 : i32 = i_1; + i_1 = (x_119 + 1); + } + } + let x_122 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_124 : i32 = arr[x_122].data; + let x_126 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_127 : bool = (x_124 == x_126); + x_137_phi = x_127; + if (x_127) { + let x_131 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_133 : i32 = arr[x_131].data; + let x_135 : i32 = x_10.x_GLF_uniform_int_values[3]; + x_136 = (x_133 == x_135); + x_137_phi = x_136; + } + let x_137 : bool = x_137_phi; + x_147_phi = x_137; + if (x_137) { + let x_141 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_143 : i32 = arr[x_141].data; + let x_145 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_146 = (x_143 == x_145); + x_147_phi = x_146; + } + let x_147 : bool = x_147_phi; + if (x_147) { + let x_152 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_155 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_158 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_161 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_152), f32(x_155), f32(x_158), f32(x_161)); + } else { + let x_165 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_166 : f32 = f32(x_165); + x_GLF_color = vec4(x_166, x_166, x_166, x_166); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..afea7c2e6c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.hlsl @@ -0,0 +1,153 @@ +struct S { + int data; +}; + +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[5]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_struct_S_i11_(inout S s) { + while (true) { + const float x_174 = asfloat(x_8[0].x); + const float x_176 = asfloat(x_8[0].y); + if ((x_174 > x_176)) { + } else { + break; + } + return; + } + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_180 = asint(x_10[scalar_offset / 4][scalar_offset % 4]); + s.data = x_180; + return; +} + +void main_1() { + int i = 0; + S arr[3] = (S[3])0; + int i_1 = 0; + S param = (S)0; + int j = 0; + bool x_136 = false; + bool x_146 = false; + bool x_137_phi = false; + bool x_147_phi = false; + const int x_46 = asint(x_10[2].x); + i = x_46; + while (true) { + const int x_51 = i; + const int x_53 = asint(x_10[1].x); + if ((x_51 < x_53)) { + } else { + break; + } + arr[i].data = i; + { + i = (i + 1); + } + } + const int x_62 = asint(x_10[2].x); + i_1 = x_62; + while (true) { + const int x_67 = i_1; + const int x_69 = asint(x_10[1].x); + if ((x_67 < x_69)) { + } else { + break; + } + const float x_73 = asfloat(x_8[0].x); + const float x_75 = asfloat(x_8[0].y); + if ((x_73 > x_75)) { + break; + } + const int x_81 = arr[i_1].data; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_83 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_81 == x_83)) { + const int x_88 = i_1; + const int x_91 = asint(x_10[3].x); + arr[clamp(x_88, 0, 3)].data = x_91; + const S x_94 = arr[2]; + param = x_94; + func_struct_S_i11_(param); + arr[2] = param; + } else { + const int x_99 = asint(x_10[2].x); + j = x_99; + while (true) { + const int x_104 = j; + const int x_106 = asint(x_10[1].x); + if ((x_104 < x_106)) { + } else { + break; + } + const int x_111 = arr[j].data; + const int x_113 = asint(x_10[4].x); + if ((x_111 > x_113)) { + discard; + } + { + j = (j + 1); + } + } + } + { + i_1 = (i_1 + 1); + } + } + const int x_122 = asint(x_10[2].x); + const int x_124 = arr[x_122].data; + const int x_126 = asint(x_10[2].x); + const bool x_127 = (x_124 == x_126); + x_137_phi = x_127; + if (x_127) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_131 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_133 = arr[x_131].data; + const int x_135 = asint(x_10[3].x); + x_136 = (x_133 == x_135); + x_137_phi = x_136; + } + const bool x_137 = x_137_phi; + x_147_phi = x_137; + if (x_137) { + const int x_141 = asint(x_10[3].x); + const int x_143 = arr[x_141].data; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_145 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_146 = (x_143 == x_145); + x_147_phi = x_146; + } + if (x_147_phi) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_152 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const int x_155 = asint(x_10[2].x); + const int x_158 = asint(x_10[2].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_161 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(float(x_152), float(x_155), float(x_158), float(x_161)); + } else { + const int x_165 = asint(x_10[2].x); + const float x_166 = float(x_165); + x_GLF_color = float4(x_166, x_166, x_166, x_166); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..e3b232ef13 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.msl @@ -0,0 +1,168 @@ +#include + +using namespace metal; +struct S { + int data; +}; +struct buf1 { + /* 0x0000 */ packed_float2 v1; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[5]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + S arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_struct_S_i11_(constant buf1& x_8, constant buf0& x_10, thread S* const s) { + while (true) { + float const x_174 = x_8.v1.x; + float const x_176 = x_8.v1.y; + if ((x_174 > x_176)) { + } else { + break; + } + return; + } + int const x_180 = x_10.x_GLF_uniform_int_values.arr[0].el; + (*(s)).data = x_180; + return; +} + +void main_1(constant buf0& x_10, constant buf1& x_8, thread float4* const tint_symbol_4) { + int i = 0; + tint_array_wrapper_1 arr = {}; + int i_1 = 0; + S param = {}; + int j = 0; + bool x_136 = false; + bool x_146 = false; + bool x_137_phi = false; + bool x_147_phi = false; + int const x_46 = x_10.x_GLF_uniform_int_values.arr[2].el; + i = x_46; + while (true) { + int const x_51 = i; + int const x_53 = x_10.x_GLF_uniform_int_values.arr[1].el; + if ((x_51 < x_53)) { + } else { + break; + } + int const x_56 = i; + int const x_57 = i; + arr.arr[x_56].data = x_57; + { + int const x_59 = i; + i = (x_59 + 1); + } + } + int const x_62 = x_10.x_GLF_uniform_int_values.arr[2].el; + i_1 = x_62; + while (true) { + int const x_67 = i_1; + int const x_69 = x_10.x_GLF_uniform_int_values.arr[1].el; + if ((x_67 < x_69)) { + } else { + break; + } + float const x_73 = x_8.v1.x; + float const x_75 = x_8.v1.y; + if ((x_73 > x_75)) { + break; + } + int const x_79 = i_1; + int const x_81 = arr.arr[x_79].data; + int const x_83 = x_10.x_GLF_uniform_int_values.arr[0].el; + if ((x_81 == x_83)) { + int const x_88 = i_1; + int const x_91 = x_10.x_GLF_uniform_int_values.arr[3].el; + arr.arr[clamp(x_88, 0, 3)].data = x_91; + S const x_94 = arr.arr[2]; + param = x_94; + func_struct_S_i11_(x_8, x_10, &(param)); + S const x_96 = param; + arr.arr[2] = x_96; + } else { + int const x_99 = x_10.x_GLF_uniform_int_values.arr[2].el; + j = x_99; + while (true) { + int const x_104 = j; + int const x_106 = x_10.x_GLF_uniform_int_values.arr[1].el; + if ((x_104 < x_106)) { + } else { + break; + } + int const x_109 = j; + int const x_111 = arr.arr[x_109].data; + int const x_113 = x_10.x_GLF_uniform_int_values.arr[4].el; + if ((x_111 > x_113)) { + discard_fragment(); + } + { + int const x_117 = j; + j = (x_117 + 1); + } + } + } + { + int const x_119 = i_1; + i_1 = (x_119 + 1); + } + } + int const x_122 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_124 = arr.arr[x_122].data; + int const x_126 = x_10.x_GLF_uniform_int_values.arr[2].el; + bool const x_127 = (x_124 == x_126); + x_137_phi = x_127; + if (x_127) { + int const x_131 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_133 = arr.arr[x_131].data; + int const x_135 = x_10.x_GLF_uniform_int_values.arr[3].el; + x_136 = (x_133 == x_135); + x_137_phi = x_136; + } + bool const x_137 = x_137_phi; + x_147_phi = x_137; + if (x_137) { + int const x_141 = x_10.x_GLF_uniform_int_values.arr[3].el; + int const x_143 = arr.arr[x_141].data; + int const x_145 = x_10.x_GLF_uniform_int_values.arr[0].el; + x_146 = (x_143 == x_145); + x_147_phi = x_146; + } + bool const x_147 = x_147_phi; + if (x_147) { + int const x_152 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_155 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_158 = x_10.x_GLF_uniform_int_values.arr[2].el; + int const x_161 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_152), float(x_155), float(x_158), float(x_161)); + } else { + int const x_165 = x_10.x_GLF_uniform_int_values.arr[2].el; + float const x_166 = float(x_165); + *(tint_symbol_4) = float4(x_166, x_166, x_166, x_166); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_10 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_10, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f707389755 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.spvasm @@ -0,0 +1,350 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 218 +; Schema: 0 + OpCapability Shader + %123 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %x_8 "x_8" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %S "S" + OpMemberName %S 0 "data" + OpName %func_struct_S_i11_ "func_struct_S_i11_" + OpName %s "s" + OpName %main_1 "main_1" + OpName %i "i" + OpName %arr "arr" + OpName %i_1 "i_1" + OpName %param "param" + OpName %j "j" + OpName %x_136 "x_136" + OpName %x_146 "x_146" + OpName %x_137_phi "x_137_phi" + OpName %x_147_phi "x_147_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_5 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_arr_S_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_int_uint_5 = OpTypeArray %int %uint_5 + %buf0 = OpTypeStruct %_arr_int_uint_5 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %S = OpTypeStruct %int +%_ptr_Function_S = OpTypePointer Function %S + %19 = OpTypeFunction %void %_ptr_Function_S + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %49 = OpTypeFunction %void + %53 = OpConstantNull %int + %uint_3 = OpConstant %uint 3 +%_arr_S_uint_3 = OpTypeArray %S %uint_3 +%_ptr_Function__arr_S_uint_3 = OpTypePointer Function %_arr_S_uint_3 + %58 = OpConstantNull %_arr_S_uint_3 + %61 = OpConstantNull %S +%_ptr_Function_bool = OpTypePointer Function %bool + %65 = OpConstantNull %bool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %main_out = OpTypeStruct %v4float + %206 = OpTypeFunction %void %main_out +%func_struct_S_i11_ = OpFunction %void None %19 + %s = OpFunctionParameter %_ptr_Function_S + %25 = OpLabel + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %32 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %36 = OpLoad %float %35 + %37 = OpFOrdGreaterThan %bool %33 %36 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %27 + %39 = OpLabel + OpReturn + %28 = OpLabel + OpBranch %26 + %27 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %45 = OpLoad %int %44 + %48 = OpAccessChain %_ptr_Function_int %s %uint_0 + OpStore %48 %45 + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %49 + %51 = OpLabel + %i = OpVariable %_ptr_Function_int Function %53 + %arr = OpVariable %_ptr_Function__arr_S_uint_3 Function %58 + %i_1 = OpVariable %_ptr_Function_int Function %53 + %param = OpVariable %_ptr_Function_S Function %61 + %j = OpVariable %_ptr_Function_int Function %53 + %x_136 = OpVariable %_ptr_Function_bool Function %65 + %x_146 = OpVariable %_ptr_Function_bool Function %65 + %x_137_phi = OpVariable %_ptr_Function_bool Function %65 + %x_147_phi = OpVariable %_ptr_Function_bool Function %65 + %70 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %71 = OpLoad %int %70 + OpStore %i %71 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %int %i + %78 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpSLessThan %bool %76 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %73 + %81 = OpLabel + %84 = OpLoad %int %i + %85 = OpLoad %int %i + %86 = OpAccessChain %_ptr_Function_int %arr %84 %uint_0 + OpStore %86 %85 + OpBranch %74 + %74 = OpLabel + %87 = OpLoad %int %i + %88 = OpIAdd %int %87 %int_1 + OpStore %i %88 + OpBranch %72 + %73 = OpLabel + %89 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %90 = OpLoad %int %89 + OpStore %i_1 %90 + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %i_1 + %96 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpSLessThan %bool %95 %97 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %101 + %100 = OpLabel + OpBranch %99 + %101 = OpLabel + OpBranch %92 + %99 = OpLabel + %102 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %105 = OpLoad %float %104 + %106 = OpFOrdGreaterThan %bool %103 %105 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %107 + %108 = OpLabel + OpBranch %92 + %107 = OpLabel + %109 = OpLoad %int %i_1 + %110 = OpAccessChain %_ptr_Function_int %arr %109 %uint_0 + %111 = OpLoad %int %110 + %112 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %113 = OpLoad %int %112 + %114 = OpIEqual %bool %111 %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %117 + %116 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %121 = OpLoad %int %120 + %122 = OpExtInst %int %123 SClamp %118 %int_0 %int_3 + %124 = OpAccessChain %_ptr_Function_int %arr %122 %uint_0 + OpStore %124 %121 + %125 = OpAccessChain %_ptr_Function_S %arr %int_2 + %126 = OpLoad %S %125 + OpStore %param %126 + %127 = OpFunctionCall %void %func_struct_S_i11_ %param + %129 = OpLoad %S %param + %130 = OpAccessChain %_ptr_Function_S %arr %int_2 + OpStore %130 %129 + OpBranch %115 + %117 = OpLabel + %131 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %132 = OpLoad %int %131 + OpStore %j %132 + OpBranch %133 + %133 = OpLabel + OpLoopMerge %134 %135 None + OpBranch %136 + %136 = OpLabel + %137 = OpLoad %int %j + %138 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %139 = OpLoad %int %138 + %140 = OpSLessThan %bool %137 %139 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %143 + %142 = OpLabel + OpBranch %141 + %143 = OpLabel + OpBranch %134 + %141 = OpLabel + %144 = OpLoad %int %j + %145 = OpAccessChain %_ptr_Function_int %arr %144 %uint_0 + %146 = OpLoad %int %145 + %148 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_4 + %149 = OpLoad %int %148 + %150 = OpSGreaterThan %bool %146 %149 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %151 + %152 = OpLabel + OpKill + %151 = OpLabel + OpBranch %135 + %135 = OpLabel + %153 = OpLoad %int %j + %154 = OpIAdd %int %153 %int_1 + OpStore %j %154 + OpBranch %133 + %134 = OpLabel + OpBranch %115 + %115 = OpLabel + OpBranch %93 + %93 = OpLabel + %155 = OpLoad %int %i_1 + %156 = OpIAdd %int %155 %int_1 + OpStore %i_1 %156 + OpBranch %91 + %92 = OpLabel + %157 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %158 = OpLoad %int %157 + %159 = OpAccessChain %_ptr_Function_int %arr %158 %uint_0 + %160 = OpLoad %int %159 + %161 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %162 = OpLoad %int %161 + %163 = OpIEqual %bool %160 %162 + OpStore %x_137_phi %163 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %164 + %165 = OpLabel + %166 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %167 = OpLoad %int %166 + %168 = OpAccessChain %_ptr_Function_int %arr %167 %uint_0 + %169 = OpLoad %int %168 + %170 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %171 = OpLoad %int %170 + %172 = OpIEqual %bool %169 %171 + OpStore %x_136 %172 + %173 = OpLoad %bool %x_136 + OpStore %x_137_phi %173 + OpBranch %164 + %164 = OpLabel + %174 = OpLoad %bool %x_137_phi + OpStore %x_147_phi %174 + OpSelectionMerge %175 None + OpBranchConditional %174 %176 %175 + %176 = OpLabel + %177 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3 + %178 = OpLoad %int %177 + %179 = OpAccessChain %_ptr_Function_int %arr %178 %uint_0 + %180 = OpLoad %int %179 + %181 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %182 = OpLoad %int %181 + %183 = OpIEqual %bool %180 %182 + OpStore %x_146 %183 + %184 = OpLoad %bool %x_146 + OpStore %x_147_phi %184 + OpBranch %175 + %175 = OpLabel + %185 = OpLoad %bool %x_147_phi + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + %189 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %190 = OpLoad %int %189 + %191 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %192 = OpLoad %int %191 + %193 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %194 = OpLoad %int %193 + %195 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %196 = OpLoad %int %195 + %197 = OpConvertSToF %float %190 + %198 = OpConvertSToF %float %192 + %199 = OpConvertSToF %float %194 + %200 = OpConvertSToF %float %196 + %201 = OpCompositeConstruct %v4float %197 %198 %199 %200 + OpStore %x_GLF_color %201 + OpBranch %186 + %188 = OpLabel + %202 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2 + %203 = OpLoad %int %202 + %204 = OpConvertSToF %float %203 + %205 = OpCompositeConstruct %v4float %204 %204 %204 %204 + OpStore %x_GLF_color %205 + OpBranch %186 + %186 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %206 +%tint_symbol = OpFunctionParameter %main_out + %210 = OpLabel + %211 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %211 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %49 + %213 = OpLabel + %214 = OpFunctionCall %void %main_1 + %216 = OpLoad %v4float %x_GLF_color + %217 = OpCompositeConstruct %main_out %216 + %215 = OpFunctionCall %void %tint_symbol_2 %217 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..68f76e2299 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-target-lowering-inst-combine-compares-struct-array-clamp-function-cal/0-opt.wgsl.expected.wgsl @@ -0,0 +1,166 @@ +struct S { + data : i32; +}; + +[[block]] +struct buf1 { + v1 : vec2; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i11_(s : ptr) { + loop { + let x_174 : f32 = x_8.v1.x; + let x_176 : f32 = x_8.v1.y; + if ((x_174 > x_176)) { + } else { + break; + } + return; + } + let x_180 : i32 = x_10.x_GLF_uniform_int_values[0]; + (*(s)).data = x_180; + return; +} + +fn main_1() { + var i : i32; + var arr : array; + var i_1 : i32; + var param : S; + var j : i32; + var x_136 : bool; + var x_146 : bool; + var x_137_phi : bool; + var x_147_phi : bool; + let x_46 : i32 = x_10.x_GLF_uniform_int_values[2]; + i = x_46; + loop { + let x_51 : i32 = i; + let x_53 : i32 = x_10.x_GLF_uniform_int_values[1]; + if ((x_51 < x_53)) { + } else { + break; + } + let x_56 : i32 = i; + let x_57 : i32 = i; + arr[x_56].data = x_57; + + continuing { + let x_59 : i32 = i; + i = (x_59 + 1); + } + } + let x_62 : i32 = x_10.x_GLF_uniform_int_values[2]; + i_1 = x_62; + loop { + let x_67 : i32 = i_1; + let x_69 : i32 = x_10.x_GLF_uniform_int_values[1]; + if ((x_67 < x_69)) { + } else { + break; + } + let x_73 : f32 = x_8.v1.x; + let x_75 : f32 = x_8.v1.y; + if ((x_73 > x_75)) { + break; + } + let x_79 : i32 = i_1; + let x_81 : i32 = arr[x_79].data; + let x_83 : i32 = x_10.x_GLF_uniform_int_values[0]; + if ((x_81 == x_83)) { + let x_88 : i32 = i_1; + let x_91 : i32 = x_10.x_GLF_uniform_int_values[3]; + arr[clamp(x_88, 0, 3)].data = x_91; + let x_94 : S = arr[2]; + param = x_94; + func_struct_S_i11_(&(param)); + let x_96 : S = param; + arr[2] = x_96; + } else { + let x_99 : i32 = x_10.x_GLF_uniform_int_values[2]; + j = x_99; + loop { + let x_104 : i32 = j; + let x_106 : i32 = x_10.x_GLF_uniform_int_values[1]; + if ((x_104 < x_106)) { + } else { + break; + } + let x_109 : i32 = j; + let x_111 : i32 = arr[x_109].data; + let x_113 : i32 = x_10.x_GLF_uniform_int_values[4]; + if ((x_111 > x_113)) { + discard; + } + + continuing { + let x_117 : i32 = j; + j = (x_117 + 1); + } + } + } + + continuing { + let x_119 : i32 = i_1; + i_1 = (x_119 + 1); + } + } + let x_122 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_124 : i32 = arr[x_122].data; + let x_126 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_127 : bool = (x_124 == x_126); + x_137_phi = x_127; + if (x_127) { + let x_131 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_133 : i32 = arr[x_131].data; + let x_135 : i32 = x_10.x_GLF_uniform_int_values[3]; + x_136 = (x_133 == x_135); + x_137_phi = x_136; + } + let x_137 : bool = x_137_phi; + x_147_phi = x_137; + if (x_137) { + let x_141 : i32 = x_10.x_GLF_uniform_int_values[3]; + let x_143 : i32 = arr[x_141].data; + let x_145 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_146 = (x_143 == x_145); + x_147_phi = x_146; + } + let x_147 : bool = x_147_phi; + if (x_147) { + let x_152 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_155 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_158 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_161 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_152), f32(x_155), f32(x_158), f32(x_161)); + } else { + let x_165 : i32 = x_10.x_GLF_uniform_int_values[2]; + let x_166 : f32 = f32(x_165); + x_GLF_color = vec4(x_166, x_166, x_166, x_166); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm new file mode 100644 index 0000000000..58bb735f8c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm @@ -0,0 +1,64 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %m "m" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %13 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %16 = OpConstantComposite %v2float %float_3 %float_4 + %17 = OpConstantComposite %mat2v2float %13 %16 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %24 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %6 + %25 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2float Function + OpStore %m %17 + %26 = OpLoad %mat2v2float %m + %27 = OpTranspose %mat2v2float %26 + %28 = OpLoad %mat2v2float %m + %29 = OpTranspose %mat2v2float %28 + %30 = OpMatrixTimesMatrix %mat2v2float %27 %29 + %31 = OpLoad %mat2v2float %m + %32 = OpLoad %mat2v2float %m + %33 = OpMatrixTimesMatrix %mat2v2float %31 %32 + %34 = OpTranspose %mat2v2float %33 + %35 = OpCompositeExtract %v2float %30 0 + %36 = OpCompositeExtract %v2float %34 0 + %37 = OpFOrdEqual %v2bool %35 %36 + %38 = OpAll %bool %37 + %39 = OpCompositeExtract %v2float %30 1 + %40 = OpCompositeExtract %v2float %34 1 + %41 = OpFOrdEqual %v2bool %39 %40 + %42 = OpAll %bool %41 + %43 = OpLogicalAnd %bool %38 %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %46 + %45 = OpLabel + OpStore %_GLF_color %23 + OpBranch %44 + %46 = OpLabel + OpStore %_GLF_color %24 + OpBranch %44 + %44 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..256b8ea3fd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.hlsl @@ -0,0 +1,32 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 m = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + m = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + const float2x2 x_30 = mul(transpose(m), transpose(m)); + const float2x2 x_34 = transpose(mul(m, m)); + bool tint_tmp = all((x_30[0u] == x_34[0u])); + if (tint_tmp) { + tint_tmp = all((x_30[1u] == x_34[1u])); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..452c4cf577 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float2x2 m = float2x2(0.0f); + m = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + float2x2 const x_26 = m; + float2x2 const x_28 = m; + float2x2 const x_30 = (transpose(x_26) * transpose(x_28)); + float2x2 const x_31 = m; + float2x2 const x_32 = m; + float2x2 const x_34 = transpose((x_31 * x_32)); + if ((all((x_30[0u] == x_34[0u])) && all((x_30[1u] == x_34[1u])))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b135837abb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.spvasm @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %16 = OpConstantNull %mat2v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %19 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %22 = OpConstantComposite %v2float %float_3 %float_4 + %23 = OpConstantComposite %mat2v2float %19 %22 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %v2bool = OpTypeVector %bool 2 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %53 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %54 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2float Function %16 + OpStore %m %23 + %24 = OpLoad %mat2v2float %m + %25 = OpLoad %mat2v2float %m + %26 = OpTranspose %mat2v2float %24 + %27 = OpTranspose %mat2v2float %25 + %28 = OpMatrixTimesMatrix %mat2v2float %26 %27 + %29 = OpLoad %mat2v2float %m + %30 = OpLoad %mat2v2float %m + %32 = OpMatrixTimesMatrix %mat2v2float %29 %30 + %31 = OpTranspose %mat2v2float %32 + %37 = OpCompositeExtract %v2float %28 0 + %38 = OpCompositeExtract %v2float %31 0 + %39 = OpFOrdEqual %v2bool %37 %38 + %33 = OpAll %bool %39 + OpSelectionMerge %41 None + OpBranchConditional %33 %42 %41 + %42 = OpLabel + %45 = OpCompositeExtract %v2float %28 1 + %46 = OpCompositeExtract %v2float %31 1 + %47 = OpFOrdEqual %v2bool %45 %46 + %43 = OpAll %bool %47 + OpBranch %41 + %41 = OpLabel + %48 = OpPhi %bool %33 %11 %43 %42 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + OpStore %x_GLF_color %53 + OpBranch %49 + %51 = OpLabel + OpStore %x_GLF_color %54 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..891a9135b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var x_GLF_color : vec4; + +fn main_1() { + var m : mat2x2; + m = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + let x_26 : mat2x2 = m; + let x_28 : mat2x2 = m; + let x_30 : mat2x2 = (transpose(x_26) * transpose(x_28)); + let x_31 : mat2x2 = m; + let x_32 : mat2x2 = m; + let x_34 : mat2x2 = transpose((x_31 * x_32)); + if ((all((x_30[0u] == x_34[0u])) && all((x_30[1u] == x_34[1u])))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl new file mode 100644 index 0000000000..891a9135b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl @@ -0,0 +1,29 @@ +var x_GLF_color : vec4; + +fn main_1() { + var m : mat2x2; + m = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + let x_26 : mat2x2 = m; + let x_28 : mat2x2 = m; + let x_30 : mat2x2 = (transpose(x_26) * transpose(x_28)); + let x_31 : mat2x2 = m; + let x_32 : mat2x2 = m; + let x_34 : mat2x2 = transpose((x_31 * x_32)); + if ((all((x_30[0u] == x_34[0u])) && all((x_30[1u] == x_34[1u])))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..256b8ea3fd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.hlsl @@ -0,0 +1,32 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 m = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + m = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + const float2x2 x_30 = mul(transpose(m), transpose(m)); + const float2x2 x_34 = transpose(mul(m, m)); + bool tint_tmp = all((x_30[0u] == x_34[0u])); + if (tint_tmp) { + tint_tmp = all((x_30[1u] == x_34[1u])); + } + if ((tint_tmp)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..452c4cf577 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float2x2 m = float2x2(0.0f); + m = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + float2x2 const x_26 = m; + float2x2 const x_28 = m; + float2x2 const x_30 = (transpose(x_26) * transpose(x_28)); + float2x2 const x_31 = m; + float2x2 const x_32 = m; + float2x2 const x_34 = transpose((x_31 * x_32)); + if ((all((x_30[0u] == x_34[0u])) && all((x_30[1u] == x_34[1u])))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b135837abb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.spvasm @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %16 = OpConstantNull %mat2v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %19 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %22 = OpConstantComposite %v2float %float_3 %float_4 + %23 = OpConstantComposite %mat2v2float %19 %22 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %v2bool = OpTypeVector %bool 2 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %53 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %54 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %m = OpVariable %_ptr_Function_mat2v2float Function %16 + OpStore %m %23 + %24 = OpLoad %mat2v2float %m + %25 = OpLoad %mat2v2float %m + %26 = OpTranspose %mat2v2float %24 + %27 = OpTranspose %mat2v2float %25 + %28 = OpMatrixTimesMatrix %mat2v2float %26 %27 + %29 = OpLoad %mat2v2float %m + %30 = OpLoad %mat2v2float %m + %32 = OpMatrixTimesMatrix %mat2v2float %29 %30 + %31 = OpTranspose %mat2v2float %32 + %37 = OpCompositeExtract %v2float %28 0 + %38 = OpCompositeExtract %v2float %31 0 + %39 = OpFOrdEqual %v2bool %37 %38 + %33 = OpAll %bool %39 + OpSelectionMerge %41 None + OpBranchConditional %33 %42 %41 + %42 = OpLabel + %45 = OpCompositeExtract %v2float %28 1 + %46 = OpCompositeExtract %v2float %31 1 + %47 = OpFOrdEqual %v2bool %45 %46 + %43 = OpAll %bool %47 + OpBranch %41 + %41 = OpLabel + %48 = OpPhi %bool %33 %11 %43 %42 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + OpStore %x_GLF_color %53 + OpBranch %49 + %51 = OpLabel + OpStore %x_GLF_color %54 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..891a9135b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-transpose-multiply/0-opt.wgsl.expected.wgsl @@ -0,0 +1,29 @@ +var x_GLF_color : vec4; + +fn main_1() { + var m : mat2x2; + m = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + let x_26 : mat2x2 = m; + let x_28 : mat2x2 = m; + let x_30 : mat2x2 = (transpose(x_26) * transpose(x_28)); + let x_31 : mat2x2 = m; + let x_32 : mat2x2 = m; + let x_34 : mat2x2 = transpose((x_31 * x_32)); + if ((all((x_30[0u] == x_34[0u])) && all((x_30[1u] == x_34[1u])))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm new file mode 100644 index 0000000000..88b241d686 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm @@ -0,0 +1,101 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %f "f" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%float_0_100000001 = OpConstant %float 0.100000001 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %13 + %33 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %34 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %37 = OpLoad %float %36 + %38 = OpFOrdLessThan %bool %35 %37 + %39 = OpSelect %float %38 %float_0_100000001 %float_1 + %40 = OpExtInst %float %1 Trunc %39 + %41 = OpExtInst %float %1 Fract %40 + OpStore %f %41 + %42 = OpLoad %float %f + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpFOrdEqual %bool %42 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpConvertSToF %float %56 + %58 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %59 = OpLoad %int %58 + %60 = OpConvertSToF %float %59 + %61 = OpCompositeConstruct %v4float %51 %54 %57 %60 + OpStore %_GLF_color %61 + OpBranch %46 + %48 = OpLabel + %62 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpConvertSToF %float %63 + %65 = OpCompositeConstruct %v4float %64 %64 %64 %64 + OpStore %_GLF_color %65 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..1f17f3de38 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.hlsl @@ -0,0 +1,51 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; + +void main_1() { + float f = 0.0f; + const float x_35 = gl_FragCoord.y; + const float x_37 = asfloat(x_7[1].x); + f = frac(trunc(((x_35 < x_37) ? 0.100000001f : 1.0f))); + const float x_42 = f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_42 == x_44)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_53 = asint(x_9[1].x); + const int x_56 = asint(x_9[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_50), float(x_53), float(x_56), float(x_59)); + } else { + const int x_63 = asint(x_9[1].x); + const float x_64 = float(x_63); + x_GLF_color = float4(x_64, x_64, x_64, x_64); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..268f0ccb80 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float f = 0.0f; + float const x_35 = (*(tint_symbol_5)).y; + float const x_37 = x_7.x_GLF_uniform_float_values.arr[1].el; + f = fract(trunc(select(1.0f, 0.100000001f, (x_35 < x_37)))); + float const x_42 = f; + float const x_44 = x_7.x_GLF_uniform_float_values.arr[0].el; + if ((x_42 == x_44)) { + int const x_50 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_59 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_50), float(x_53), float(x_56), float(x_59)); + } else { + int const x_63 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_64 = float(x_63); + *(tint_symbol_6) = float4(x_64, x_64, x_64, x_64); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_9, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..872fb577fe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %39 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpConstantNull %float + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%float_0_100000001 = OpConstant %float 0.100000001 + %float_1 = OpConstant %float 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %72 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %f = OpVariable %_ptr_Function_float Function %28 + %31 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %32 = OpLoad %float %31 + %36 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %37 = OpLoad %float %36 + %42 = OpFOrdLessThan %bool %32 %37 + %41 = OpSelect %float %42 %float_0_100000001 %float_1 + %40 = OpExtInst %float %39 Trunc %41 + %38 = OpExtInst %float %39 Fract %40 + OpStore %f %38 + %46 = OpLoad %float %f + %48 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %49 = OpLoad %float %48 + %50 = OpFOrdEqual %bool %46 %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %56 + %64 = OpConvertSToF %float %58 + %65 = OpConvertSToF %float %60 + %66 = OpConvertSToF %float %62 + %67 = OpCompositeConstruct %v4float %63 %64 %65 %66 + OpStore %x_GLF_color %67 + OpBranch %51 + %53 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %69 + %71 = OpCompositeConstruct %v4float %70 %70 %70 %70 + OpStore %x_GLF_color %71 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %72 +%tint_symbol_1 = OpFunctionParameter %main_out + %76 = OpLabel + %77 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %77 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %79 = OpLabel + %80 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %80 + %81 = OpFunctionCall %void %main_1 + %83 = OpLoad %v4float %x_GLF_color + %84 = OpCompositeConstruct %main_out %83 + %82 = OpFunctionCall %void %tint_symbol_3 %84 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..bba3d95fb1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.spvasm.expected.wgsl @@ -0,0 +1,54 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var f : f32; + let x_35 : f32 = gl_FragCoord.y; + let x_37 : f32 = x_7.x_GLF_uniform_float_values[1]; + f = fract(trunc(select(1.0, 0.100000001, (x_35 < x_37)))); + let x_42 : f32 = f; + let x_44 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_42 == x_44)) { + let x_50 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_59 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_50), f32(x_53), f32(x_56), f32(x_59)); + } else { + let x_63 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_64 : f32 = f32(x_63); + x_GLF_color = vec4(x_64, x_64, x_64, x_64); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl new file mode 100644 index 0000000000..bba3d95fb1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl @@ -0,0 +1,54 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var f : f32; + let x_35 : f32 = gl_FragCoord.y; + let x_37 : f32 = x_7.x_GLF_uniform_float_values[1]; + f = fract(trunc(select(1.0, 0.100000001, (x_35 < x_37)))); + let x_42 : f32 = f; + let x_44 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_42 == x_44)) { + let x_50 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_59 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_50), f32(x_53), f32(x_56), f32(x_59)); + } else { + let x_63 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_64 : f32 = f32(x_63); + x_GLF_color = vec4(x_64, x_64, x_64, x_64); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..1f17f3de38 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.hlsl @@ -0,0 +1,51 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b1, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[2]; +}; + +void main_1() { + float f = 0.0f; + const float x_35 = gl_FragCoord.y; + const float x_37 = asfloat(x_7[1].x); + f = frac(trunc(((x_35 < x_37) ? 0.100000001f : 1.0f))); + const float x_42 = f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_44 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]); + if ((x_42 == x_44)) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_53 = asint(x_9[1].x); + const int x_56 = asint(x_9[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_59 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_50), float(x_53), float(x_56), float(x_59)); + } else { + const int x_63 = asint(x_9[1].x); + const float x_64 = float(x_63); + x_GLF_color = float4(x_64, x_64, x_64, x_64); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..268f0ccb80 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_7, constant buf0& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float f = 0.0f; + float const x_35 = (*(tint_symbol_5)).y; + float const x_37 = x_7.x_GLF_uniform_float_values.arr[1].el; + f = fract(trunc(select(1.0f, 0.100000001f, (x_35 < x_37)))); + float const x_42 = f; + float const x_44 = x_7.x_GLF_uniform_float_values.arr[0].el; + if ((x_42 == x_44)) { + int const x_50 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_59 = x_9.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_50), float(x_53), float(x_56), float(x_59)); + } else { + int const x_63 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_64 = float(x_63); + *(tint_symbol_6) = float4(x_64, x_64, x_64, x_64); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, x_9, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..872fb577fe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %39 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_7 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpConstantNull %float + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%float_0_100000001 = OpConstant %float 0.100000001 + %float_1 = OpConstant %float 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main_out = OpTypeStruct %v4float + %72 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %f = OpVariable %_ptr_Function_float Function %28 + %31 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %32 = OpLoad %float %31 + %36 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1 + %37 = OpLoad %float %36 + %42 = OpFOrdLessThan %bool %32 %37 + %41 = OpSelect %float %42 %float_0_100000001 %float_1 + %40 = OpExtInst %float %39 Trunc %41 + %38 = OpExtInst %float %39 Fract %40 + OpStore %f %38 + %46 = OpLoad %float %f + %48 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0 + %49 = OpLoad %float %48 + %50 = OpFOrdEqual %bool %46 %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %62 = OpLoad %int %61 + %63 = OpConvertSToF %float %56 + %64 = OpConvertSToF %float %58 + %65 = OpConvertSToF %float %60 + %66 = OpConvertSToF %float %62 + %67 = OpCompositeConstruct %v4float %63 %64 %65 %66 + OpStore %x_GLF_color %67 + OpBranch %51 + %53 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %69 + %71 = OpCompositeConstruct %v4float %70 %70 %70 %70 + OpStore %x_GLF_color %71 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %72 +%tint_symbol_1 = OpFunctionParameter %main_out + %76 = OpLabel + %77 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %77 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %79 = OpLabel + %80 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %80 + %81 = OpFunctionCall %void %main_1 + %83 = OpLoad %v4float %x_GLF_color + %84 = OpCompositeConstruct %main_out %83 + %82 = OpFunctionCall %void %tint_symbol_3 %84 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..bba3d95fb1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-trunc-fract-always-zero/0-opt.wgsl.expected.wgsl @@ -0,0 +1,54 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_7 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_9 : buf0; + +fn main_1() { + var f : f32; + let x_35 : f32 = gl_FragCoord.y; + let x_37 : f32 = x_7.x_GLF_uniform_float_values[1]; + f = fract(trunc(select(1.0, 0.100000001, (x_35 < x_37)))); + let x_42 : f32 = f; + let x_44 : f32 = x_7.x_GLF_uniform_float_values[0]; + if ((x_42 == x_44)) { + let x_50 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_59 : i32 = x_9.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_50), f32(x_53), f32(x_56), f32(x_59)); + } else { + let x_63 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_64 : f32 = f32(x_63); + x_GLF_color = vec4(x_64, x_64, x_64, x_64); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm new file mode 100644 index 0000000000..d72e66ad7e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm @@ -0,0 +1,56 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %11 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %14 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %16 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main = OpFunction %void None %8 + %23 = OpLabel + %24 = OpVariable %_ptr_Function_v4float Function + OpStore %_GLF_color %16 + %25 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %26 = OpLoad %int %25 + %27 = OpIEqual %bool %26 %int_0 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %28 + %29 = OpLabel + OpReturn + %28 = OpLabel + OpStore %24 %14 + OpStore %_GLF_color %14 + OpReturn + OpFunctionEnd + %func_ = OpFunction %v4float None %11 + %30 = OpLabel + OpReturnValue %14 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..325bac825a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.hlsl @@ -0,0 +1,34 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + float4 x_24 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const int x_26 = asint(x_6[0].x); + if ((x_26 == 0)) { + return; + } + x_24 = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} + +float4 func_() { + return float4(1.0f, 0.0f, 0.0f, 1.0f); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..cf5d8b8390 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float4 x_24 = 0.0f; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + int const x_26 = x_6.one; + if ((x_26 == 0)) { + return; + } + x_24 = float4(1.0f, 0.0f, 0.0f, 1.0f); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +float4 func_() { + return float4(1.0f, 0.0f, 0.0f, 1.0f); +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..92c0d330ab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_24 "x_24" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %func_ "func_" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %32 = OpTypeFunction %void %main_out + %44 = OpTypeFunction %v4float + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_24 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %x_GLF_color %19 + %23 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %24 = OpLoad %int %23 + %26 = OpIEqual %bool %24 %int_0 + OpSelectionMerge %28 None + OpBranchConditional %26 %29 %28 + %29 = OpLabel + OpReturn + %28 = OpLabel + OpStore %x_24 %31 + OpStore %x_GLF_color %31 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %32 +%tint_symbol = OpFunctionParameter %main_out + %36 = OpLabel + %37 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %37 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %x_GLF_color + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_2 %43 + OpReturn + OpFunctionEnd + %func_ = OpFunction %v4float None %44 + %46 = OpLabel + OpReturnValue %31 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a354d57edc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.spvasm.expected.wgsl @@ -0,0 +1,35 @@ +[[block]] +struct buf0 { + one : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var x_24 : vec4; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_26 : i32 = x_6.one; + if ((x_26 == 0)) { + return; + } + x_24 = vec4(1.0, 0.0, 0.0, 1.0); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_() -> vec4 { + return vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl new file mode 100644 index 0000000000..a354d57edc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl @@ -0,0 +1,35 @@ +[[block]] +struct buf0 { + one : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var x_24 : vec4; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_26 : i32 = x_6.one; + if ((x_26 == 0)) { + return; + } + x_24 = vec4(1.0, 0.0, 0.0, 1.0); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_() -> vec4 { + return vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..325bac825a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + float4 x_24 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const int x_26 = asint(x_6[0].x); + if ((x_26 == 0)) { + return; + } + x_24 = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} + +float4 func_() { + return float4(1.0f, 0.0f, 0.0f, 1.0f); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..cf5d8b8390 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.msl @@ -0,0 +1,37 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float4 x_24 = 0.0f; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + int const x_26 = x_6.one; + if ((x_26 == 0)) { + return; + } + x_24 = float4(1.0f, 0.0f, 0.0f, 1.0f); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +float4 func_() { + return float4(1.0f, 0.0f, 0.0f, 1.0f); +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..92c0d330ab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 47 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_24 "x_24" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %func_ "func_" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %32 = OpTypeFunction %void %main_out + %44 = OpTypeFunction %v4float + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_24 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %x_GLF_color %19 + %23 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %24 = OpLoad %int %23 + %26 = OpIEqual %bool %24 %int_0 + OpSelectionMerge %28 None + OpBranchConditional %26 %29 %28 + %29 = OpLabel + OpReturn + %28 = OpLabel + OpStore %x_24 %31 + OpStore %x_GLF_color %31 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %32 +%tint_symbol = OpFunctionParameter %main_out + %36 = OpLabel + %37 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %37 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %39 = OpLabel + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %x_GLF_color + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_2 %43 + OpReturn + OpFunctionEnd + %func_ = OpFunction %v4float None %44 + %46 = OpLabel + OpReturnValue %31 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a354d57edc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-types-return-in-main-never-hit/0-opt.wgsl.expected.wgsl @@ -0,0 +1,35 @@ +[[block]] +struct buf0 { + one : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var x_24 : vec4; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_26 : i32 = x_6.one; + if ((x_26 == 0)) { + return; + } + x_24 = vec4(1.0, 0.0, 0.0, 1.0); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn func_() -> vec4 { + return vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm new file mode 100644 index 0000000000..763916fac1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm @@ -0,0 +1,114 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %m24 "m24" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %__0 "" + OpName %a "a" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %uint_0 = OpConstant %uint 0 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%float_n0x1_8p_128 = OpConstant %float -0x1.8p+128 + %32 = OpConstantComposite %v2float %float_n0x1_8p_128 %float_1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %bool = OpTypeBool + %36 = OpConstantComposite %v2float %float_0 %float_0 + %37 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %14 + %38 = OpLabel + %m24 = OpVariable %_ptr_Function_mat2v2float Function + %a = OpVariable %_ptr_Function_float Function + %v2 = OpVariable %_ptr_Function_v2float Function + %v3 = OpVariable %_ptr_Function_v2float Function + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %44 = OpLoad %float %43 + %45 = OpFMul %float %44 %float_1 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %47 = OpLoad %float %46 + %48 = OpCompositeConstruct %v2float %40 %42 + %49 = OpCompositeConstruct %v2float %45 %47 + %50 = OpCompositeConstruct %mat2v2float %48 %49 + OpStore %m24 %50 + %51 = OpLoad %mat2v2float %m24 + %52 = OpCompositeExtract %float %51 0 0 + OpStore %a %52 + OpStore %v2 %32 + %53 = OpLoad %v2float %v2 + %54 = OpLoad %float %a + %55 = OpCompositeConstruct %v2float %54 %float_1 + %56 = OpExtInst %v2float %1 Reflect %53 %55 + OpStore %v3 %56 + %57 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpLoad %v2float %v3 + %60 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpCompositeExtract %float %59 0 + %63 = OpCompositeExtract %float %59 1 + %64 = OpCompositeConstruct %v4float %58 %62 %63 %61 + OpStore %_GLF_color %64 + %65 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %68 = OpLoad %float %67 + %69 = OpFOrdEqual %bool %66 %68 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + %73 = OpLoad %v4float %_GLF_color + %74 = OpVectorShuffle %v4float %73 %36 0 4 5 3 + OpStore %_GLF_color %74 + OpBranch %70 + %72 = OpLabel + OpStore %_GLF_color %37 + OpBranch %70 + %70 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..a4a3ad2d7e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.hlsl @@ -0,0 +1,55 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 m24 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float a = 0.0f; + float2 v2 = float2(0.0f, 0.0f); + float2 v3 = float2(0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_42 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const float x_44 = asfloat(x_8[0].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_47 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + m24 = float2x2(float2(x_40, x_42), float2((x_44 * 1.0f), x_47)); + a = m24[0u].x; + v2 = float2(asfloat(0x7fc00000u), 1.0f); + v3 = reflect(v2, float2(a, 1.0f)); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_58 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float2 x_59 = v3; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_61 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(x_58, x_59.x, x_59.y, x_61); + const float x_66 = asfloat(x_8[0].y); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_68 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((x_66 == x_68)) { + const float4 x_73 = x_GLF_color; + x_GLF_color = float4(x_73.x, float2(0.0f, 0.0f).x, float2(0.0f, 0.0f).y, x_73.w); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..570e97afda --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.msl @@ -0,0 +1,62 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct buf1 { + /* 0x0000 */ packed_float2 v1; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float2x2 m24 = float2x2(0.0f); + float a = 0.0f; + float2 v2 = 0.0f; + float2 v3 = 0.0f; + float const x_40 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_44 = x_8.v1.x; + float const x_47 = x_6.x_GLF_uniform_float_values.arr[0].el; + m24 = float2x2(float2(x_40, x_42), float2((x_44 * 1.0f), x_47)); + float2x2 const x_51 = m24; + a = x_51[0u].x; + v2 = float2(NAN, 1.0f); + float2 const x_53 = v2; + float const x_54 = a; + v3 = reflect(x_53, float2(x_54, 1.0f)); + float const x_58 = x_6.x_GLF_uniform_float_values.arr[0].el; + float2 const x_59 = v3; + float const x_61 = x_6.x_GLF_uniform_float_values.arr[0].el; + *(tint_symbol_4) = float4(x_58, x_59.x, x_59.y, x_61); + float const x_66 = x_8.v1.y; + float const x_68 = x_6.x_GLF_uniform_float_values.arr[0].el; + if ((x_66 == x_68)) { + float4 const x_73 = *(tint_symbol_4); + *(tint_symbol_4) = float4(x_73.x, float2(0.0f, 0.0f).x, float2(0.0f, 0.0f).y, x_73.w); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..a0d50394a2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.spvasm @@ -0,0 +1,155 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "v1" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m24 "m24" + OpName %a "a" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %15 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %15 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %25 = OpConstantNull %mat2v2float +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpConstantNull %float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %31 = OpConstantNull %v2float + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 +%float_n0x1_8p_128 = OpConstant %float -0x1.8p+128 + %54 = OpConstantComposite %v2float %float_n0x1_8p_128 %float_1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %80 = OpConstantComposite %v2float %float_0 %float_0 + %85 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %86 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %m24 = OpVariable %_ptr_Function_mat2v2float Function %25 + %a = OpVariable %_ptr_Function_float Function %28 + %v2 = OpVariable %_ptr_Function_v2float Function %31 + %v3 = OpVariable %_ptr_Function_v2float Function %31 + %37 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %38 = OpLoad %float %37 + %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %44 = OpLoad %float %43 + %45 = OpCompositeConstruct %v2float %38 %40 + %47 = OpFMul %float %42 %float_1 + %48 = OpCompositeConstruct %v2float %47 %44 + %49 = OpCompositeConstruct %mat2v2float %45 %48 + OpStore %m24 %49 + %50 = OpLoad %mat2v2float %m24 + %51 = OpCompositeExtract %v2float %50 0 + %52 = OpCompositeExtract %float %51 0 + OpStore %a %52 + OpStore %v2 %54 + %55 = OpLoad %v2float %v2 + %56 = OpLoad %float %a + %59 = OpCompositeConstruct %v2float %56 %float_1 + %57 = OpExtInst %v2float %58 Reflect %55 %59 + OpStore %v3 %57 + %60 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpLoad %v2float %v3 + %63 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %64 = OpLoad %float %63 + %65 = OpCompositeExtract %float %62 0 + %66 = OpCompositeExtract %float %62 1 + %67 = OpCompositeConstruct %v4float %61 %65 %66 %64 + OpStore %x_GLF_color %67 + %68 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %69 = OpLoad %float %68 + %70 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %71 = OpLoad %float %70 + %72 = OpFOrdEqual %bool %69 %71 + OpSelectionMerge %74 None + OpBranchConditional %72 %75 %76 + %75 = OpLabel + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeExtract %float %77 0 + %81 = OpCompositeExtract %float %80 0 + %82 = OpCompositeExtract %float %80 1 + %83 = OpCompositeExtract %float %77 3 + %84 = OpCompositeConstruct %v4float %78 %81 %82 %83 + OpStore %x_GLF_color %84 + OpBranch %74 + %76 = OpLabel + OpStore %x_GLF_color %85 + OpBranch %74 + %74 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %86 +%tint_symbol = OpFunctionParameter %main_out + %90 = OpLabel + %91 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %91 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %93 = OpLabel + %94 = OpFunctionCall %void %main_1 + %96 = OpLoad %v4float %x_GLF_color + %97 = OpCompositeConstruct %main_out %96 + %95 = OpFunctionCall %void %tint_symbol_2 %97 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..1e71e59410 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.spvasm.expected.wgsl @@ -0,0 +1,59 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf1 { + v1 : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var m24 : mat2x2; + var a : f32; + var v2 : vec2; + var v3 : vec2; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_44 : f32 = x_8.v1.x; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[0]; + m24 = mat2x2(vec2(x_40, x_42), vec2((x_44 * 1.0), x_47)); + let x_51 : mat2x2 = m24; + a = x_51[0u].x; + v2 = vec2(-0x1.8p+128, 1.0); + let x_53 : vec2 = v2; + let x_54 : f32 = a; + v3 = reflect(x_53, vec2(x_54, 1.0)); + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_59 : vec2 = v3; + let x_61 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_58, x_59.x, x_59.y, x_61); + let x_66 : f32 = x_8.v1.y; + let x_68 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_66 == x_68)) { + let x_73 : vec4 = x_GLF_color; + x_GLF_color = vec4(x_73.x, vec2(0.0, 0.0).x, vec2(0.0, 0.0).y, x_73.w); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl new file mode 100644 index 0000000000..1e71e59410 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl @@ -0,0 +1,59 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr; +}; + +[[block]] +struct buf1 { + v1 : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +fn main_1() { + var m24 : mat2x2; + var a : f32; + var v2 : vec2; + var v3 : vec2; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_44 : f32 = x_8.v1.x; + let x_47 : f32 = x_6.x_GLF_uniform_float_values[0]; + m24 = mat2x2(vec2(x_40, x_42), vec2((x_44 * 1.0), x_47)); + let x_51 : mat2x2 = m24; + a = x_51[0u].x; + v2 = vec2(-0x1.8p+128, 1.0); + let x_53 : vec2 = v2; + let x_54 : f32 = a; + v3 = reflect(x_53, vec2(x_54, 1.0)); + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_59 : vec2 = v3; + let x_61 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_GLF_color = vec4(x_58, x_59.x, x_59.y, x_61); + let x_66 : f32 = x_8.v1.y; + let x_68 : f32 = x_6.x_GLF_uniform_float_values[0]; + if ((x_66 == x_68)) { + let x_73 : vec4 = x_GLF_color; + x_GLF_color = vec4(x_73.x, vec2(0.0, 0.0).x, vec2(0.0, 0.0).y, x_73.w); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..5dab88421d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.hlsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl:31:22 error: expected ')' for type constructor + v2 = vec2(-0x1.8p+128, 1.0); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..5dab88421d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.msl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl:31:22 error: expected ')' for type constructor + v2 = vec2(-0x1.8p+128, 1.0); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5dab88421d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.spvasm @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl:31:22 error: expected ')' for type constructor + v2 = vec2(-0x1.8p+128, 1.0); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5dab88421d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +SKIP: FAILED + +graphicsfuzz/cov-undefined-inversesqrt-reflect/0-opt.wgsl:31:22 error: expected ')' for type constructor + v2 = vec2(-0x1.8p+128, 1.0); + ^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm new file mode 100644 index 0000000000..71b28a0d66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm @@ -0,0 +1,171 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %S "S" + OpMemberName %S 0 "data" + OpName %func_struct_S_i11_i1_ "func(struct-S-i11;i1;" + OpName %s "s" + OpName %x "x" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %arr "arr" + OpName %index "index" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int +%_ptr_Function_S = OpTypePointer Function %S +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_S %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_10 = OpConstant %int 10 + %uint_10 = OpConstant %uint 10 +%_arr_S_uint_10 = OpTypeArray %S %uint_10 +%_ptr_Function__arr_S_uint_10 = OpTypePointer Function %_arr_S_uint_10 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %19 + %38 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %arr = OpVariable %_ptr_Function__arr_S_uint_10 Function + %index = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_S Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_S Function + %param_2 = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i + %44 = OpSLessThan %bool %43 %int_10 + OpBranchConditional %44 %45 %40 + %45 = OpLabel + %46 = OpLoad %int %i + %47 = OpAccessChain %_ptr_Function_int %arr %46 %int_0 + OpStore %47 %int_0 + OpBranch %41 + %41 = OpLabel + %48 = OpLoad %int %i + %49 = OpIAdd %int %48 %int_1 + OpStore %i %49 + OpBranch %39 + %40 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpIEqual %bool %51 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + %58 = OpLoad %int %index + %59 = OpAccessChain %_ptr_Function_S %arr %58 + %60 = OpLoad %S %59 + OpStore %param %60 + %61 = OpLoad %int %index + OpStore %param_0 %61 + %62 = OpFunctionCall %void %func_struct_S_i11_i1_ %param %param_0 + %63 = OpLoad %S %param + %64 = OpAccessChain %_ptr_Function_S %arr %58 + OpStore %64 %63 + OpBranch %55 + %57 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Function_S %arr %66 + %68 = OpLoad %S %67 + OpStore %param_1 %68 + %69 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %70 = OpLoad %int %69 + OpStore %param_2 %70 + %71 = OpFunctionCall %void %func_struct_S_i11_i1_ %param_1 %param_2 + %72 = OpLoad %S %param_1 + %73 = OpAccessChain %_ptr_Function_S %arr %66 + OpStore %73 %72 + OpBranch %55 + %55 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Function_int %arr %75 %int_0 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpIEqual %bool %77 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %84 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %85 = OpLoad %int %84 + %86 = OpConvertSToF %float %85 + %87 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpConvertSToF %float %88 + %90 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %91 = OpLoad %int %90 + %92 = OpConvertSToF %float %91 + %93 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %94 = OpLoad %int %93 + %95 = OpConvertSToF %float %94 + %96 = OpCompositeConstruct %v4float %86 %89 %92 %95 + OpStore %_GLF_color %96 + OpBranch %81 + %83 = OpLabel + %97 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %98 = OpLoad %int %97 + %99 = OpConvertSToF %float %98 + %100 = OpCompositeConstruct %v4float %99 %99 %99 %99 + OpStore %_GLF_color %100 + OpBranch %81 + %81 = OpLabel + OpReturn + OpFunctionEnd +%func_struct_S_i11_i1_ = OpFunction %void None %23 + %s = OpFunctionParameter %_ptr_Function_S + %x = OpFunctionParameter %_ptr_Function_int + %101 = OpLabel + %102 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %103 = OpLoad %int %102 + %104 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %105 = OpLoad %int %104 + %106 = OpIEqual %bool %103 %105 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %107 + %108 = OpLabel + OpReturn + %107 = OpLabel + %109 = OpLoad %int %x + %110 = OpAccessChain %_ptr_Function_int %s %int_0 + OpStore %110 %109 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ac091bde99 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.hlsl @@ -0,0 +1,89 @@ +struct S { + int data; +}; + +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_struct_S_i11_i1_(inout S s, inout int x) { + const int x_103 = asint(x_9[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_105 = asint(x_9[scalar_offset / 4][scalar_offset % 4]); + if ((x_103 == x_105)) { + return; + } + const int x_109 = x; + s.data = x_109; + return; +} + +void main_1() { + int i = 0; + S arr[10] = (S[10])0; + int index = 0; + S param = (S)0; + int param_1 = 0; + S param_2 = (S)0; + int param_3 = 0; + i = 0; + { + for(; (i < 10); i = (i + 1)) { + arr[i].data = 0; + } + } + const int x_51 = asint(x_9[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_51 == x_53)) { + const int x_58 = index; + const S x_60 = arr[x_58]; + param = x_60; + param_1 = index; + func_struct_S_i11_i1_(param, param_1); + arr[x_58] = param; + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_66 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const S x_68 = arr[x_66]; + param_2 = x_68; + const int x_70 = asint(x_9[1].x); + param_3 = x_70; + func_struct_S_i11_i1_(param_2, param_3); + arr[x_66] = param_2; + } + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_75 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_77 = arr[x_75].data; + const int x_79 = asint(x_9[1].x); + if ((x_77 == x_79)) { + const int x_85 = asint(x_9[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_88 = asint(x_9[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_91 = asint(x_9[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_94 = asint(x_9[1].x); + x_GLF_color = float4(float(x_85), float(x_88), float(x_91), float(x_94)); + } else { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_98 = asint(x_9[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_99 = float(x_98); + x_GLF_color = float4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..34d029d82a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.msl @@ -0,0 +1,105 @@ +#include + +using namespace metal; +struct S { + int data; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + S arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_struct_S_i11_i1_(constant buf0& x_9, thread S* const s, thread int* const x) { + int const x_103 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_105 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_103 == x_105)) { + return; + } + int const x_109 = *(x); + (*(s)).data = x_109; + return; +} + +void main_1(constant buf0& x_9, thread float4* const tint_symbol_4) { + int i = 0; + tint_array_wrapper_1 arr = {}; + int index = 0; + S param = {}; + int param_1 = 0; + S param_2 = {}; + int param_3 = 0; + i = 0; + while (true) { + int const x_43 = i; + if ((x_43 < 10)) { + } else { + break; + } + int const x_46 = i; + arr.arr[x_46].data = 0; + { + int const x_48 = i; + i = (x_48 + 1); + } + } + int const x_51 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_53 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_51 == x_53)) { + int const x_58 = index; + S const x_60 = arr.arr[x_58]; + param = x_60; + int const x_61 = index; + param_1 = x_61; + func_struct_S_i11_i1_(x_9, &(param), &(param_1)); + S const x_63 = param; + arr.arr[x_58] = x_63; + } else { + int const x_66 = x_9.x_GLF_uniform_int_values.arr[0].el; + S const x_68 = arr.arr[x_66]; + param_2 = x_68; + int const x_70 = x_9.x_GLF_uniform_int_values.arr[1].el; + param_3 = x_70; + func_struct_S_i11_i1_(x_9, &(param_2), &(param_3)); + S const x_72 = param_2; + arr.arr[x_66] = x_72; + } + int const x_75 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_77 = arr.arr[x_75].data; + int const x_79 = x_9.x_GLF_uniform_int_values.arr[1].el; + if ((x_77 == x_79)) { + int const x_85 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_88 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_91 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_94 = x_9.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_85), float(x_88), float(x_91), float(x_94)); + } else { + int const x_98 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_99 = float(x_98); + *(tint_symbol_4) = float4(x_99, x_99, x_99, x_99); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..85eaf66a10 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.spvasm @@ -0,0 +1,213 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 137 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %S "S" + OpMemberName %S 0 "data" + OpName %func_struct_S_i11_i1_ "func_struct_S_i11_i1_" + OpName %s "s" + OpName %x "x" + OpName %main_1 "main_1" + OpName %i "i" + OpName %arr "arr" + OpName %index "index" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_arr_S_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %S = OpTypeStruct %int +%_ptr_Function_S = OpTypePointer Function %S +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpTypeFunction %void %_ptr_Function_S %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %40 = OpTypeFunction %void + %44 = OpConstantNull %int + %uint_10 = OpConstant %uint 10 +%_arr_S_uint_10 = OpTypeArray %S %uint_10 +%_ptr_Function__arr_S_uint_10 = OpTypePointer Function %_arr_S_uint_10 + %49 = OpConstantNull %_arr_S_uint_10 + %52 = OpConstantNull %S + %int_10 = OpConstant %int 10 + %main_out = OpTypeStruct %v4float + %125 = OpTypeFunction %void %main_out +%func_struct_S_i11_i1_ = OpFunction %void None %15 + %s = OpFunctionParameter %_ptr_Function_S + %x = OpFunctionParameter %_ptr_Function_int + %23 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %28 = OpLoad %int %27 + %30 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpIEqual %bool %28 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %34 + %35 = OpLabel + OpReturn + %34 = OpLabel + %37 = OpLoad %int %x + %39 = OpAccessChain %_ptr_Function_int %s %uint_0 + OpStore %39 %37 + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %40 + %42 = OpLabel + %i = OpVariable %_ptr_Function_int Function %44 + %arr = OpVariable %_ptr_Function__arr_S_uint_10 Function %49 + %index = OpVariable %_ptr_Function_int Function %44 + %param = OpVariable %_ptr_Function_S Function %52 + %param_1 = OpVariable %_ptr_Function_int Function %44 + %param_2 = OpVariable %_ptr_Function_S Function %52 + %param_3 = OpVariable %_ptr_Function_int Function %44 + OpStore %i %int_0 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %int %i + %62 = OpSLessThan %bool %60 %int_10 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %57 + %63 = OpLabel + %66 = OpLoad %int %i + %67 = OpAccessChain %_ptr_Function_int %arr %66 %uint_0 + OpStore %67 %int_0 + OpBranch %58 + %58 = OpLabel + %68 = OpLoad %int %i + %69 = OpIAdd %int %68 %int_1 + OpStore %i %69 + OpBranch %56 + %57 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %73 = OpLoad %int %72 + %74 = OpIEqual %bool %71 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + %78 = OpLoad %int %index + %79 = OpAccessChain %_ptr_Function_S %arr %78 + %80 = OpLoad %S %79 + OpStore %param %80 + %81 = OpLoad %int %index + OpStore %param_1 %81 + %82 = OpFunctionCall %void %func_struct_S_i11_i1_ %param %param_1 + %85 = OpLoad %S %param + %86 = OpAccessChain %_ptr_Function_S %arr %78 + OpStore %86 %85 + OpBranch %75 + %77 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Function_S %arr %88 + %90 = OpLoad %S %89 + OpStore %param_2 %90 + %91 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %92 = OpLoad %int %91 + OpStore %param_3 %92 + %93 = OpFunctionCall %void %func_struct_S_i11_i1_ %param_2 %param_3 + %96 = OpLoad %S %param_2 + %97 = OpAccessChain %_ptr_Function_S %arr %88 + OpStore %97 %96 + OpBranch %75 + %75 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_Function_int %arr %99 %uint_0 + %101 = OpLoad %int %100 + %102 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %103 = OpLoad %int %102 + %104 = OpIEqual %bool %101 %103 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %107 + %106 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %111 = OpLoad %int %110 + %112 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %115 = OpLoad %int %114 + %116 = OpConvertSToF %float %109 + %117 = OpConvertSToF %float %111 + %118 = OpConvertSToF %float %113 + %119 = OpConvertSToF %float %115 + %120 = OpCompositeConstruct %v4float %116 %117 %118 %119 + OpStore %x_GLF_color %120 + OpBranch %105 + %107 = OpLabel + %121 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %122 = OpLoad %int %121 + %123 = OpConvertSToF %float %122 + %124 = OpCompositeConstruct %v4float %123 %123 %123 %123 + OpStore %x_GLF_color %124 + OpBranch %105 + %105 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %125 +%tint_symbol = OpFunctionParameter %main_out + %129 = OpLabel + %130 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %130 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %40 + %132 = OpLabel + %133 = OpFunctionCall %void %main_1 + %135 = OpLoad %v4float %x_GLF_color + %136 = OpCompositeConstruct %main_out %135 + %134 = OpFunctionCall %void %tint_symbol_2 %136 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b1a8e78bbf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.spvasm.expected.wgsl @@ -0,0 +1,97 @@ +struct S { + data : i32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i11_i1_(s : ptr, x : ptr) { + let x_103 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_105 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_103 == x_105)) { + return; + } + let x_109 : i32 = *(x); + (*(s)).data = x_109; + return; +} + +fn main_1() { + var i : i32; + var arr : array; + var index : i32; + var param : S; + var param_1 : i32; + var param_2 : S; + var param_3 : i32; + i = 0; + loop { + let x_43 : i32 = i; + if ((x_43 < 10)) { + } else { + break; + } + let x_46 : i32 = i; + arr[x_46].data = 0; + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_51 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_51 == x_53)) { + let x_58 : i32 = index; + let x_60 : S = arr[x_58]; + param = x_60; + let x_61 : i32 = index; + param_1 = x_61; + func_struct_S_i11_i1_(&(param), &(param_1)); + let x_63 : S = param; + arr[x_58] = x_63; + } else { + let x_66 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_68 : S = arr[x_66]; + param_2 = x_68; + let x_70 : i32 = x_9.x_GLF_uniform_int_values[1]; + param_3 = x_70; + func_struct_S_i11_i1_(&(param_2), &(param_3)); + let x_72 : S = param_2; + arr[x_66] = x_72; + } + let x_75 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_77 : i32 = arr[x_75].data; + let x_79 : i32 = x_9.x_GLF_uniform_int_values[1]; + if ((x_77 == x_79)) { + let x_85 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_88 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_91 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_94 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_85), f32(x_88), f32(x_91), f32(x_94)); + } else { + let x_98 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_99 : f32 = f32(x_98); + x_GLF_color = vec4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl new file mode 100644 index 0000000000..b1a8e78bbf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl @@ -0,0 +1,97 @@ +struct S { + data : i32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i11_i1_(s : ptr, x : ptr) { + let x_103 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_105 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_103 == x_105)) { + return; + } + let x_109 : i32 = *(x); + (*(s)).data = x_109; + return; +} + +fn main_1() { + var i : i32; + var arr : array; + var index : i32; + var param : S; + var param_1 : i32; + var param_2 : S; + var param_3 : i32; + i = 0; + loop { + let x_43 : i32 = i; + if ((x_43 < 10)) { + } else { + break; + } + let x_46 : i32 = i; + arr[x_46].data = 0; + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_51 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_51 == x_53)) { + let x_58 : i32 = index; + let x_60 : S = arr[x_58]; + param = x_60; + let x_61 : i32 = index; + param_1 = x_61; + func_struct_S_i11_i1_(&(param), &(param_1)); + let x_63 : S = param; + arr[x_58] = x_63; + } else { + let x_66 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_68 : S = arr[x_66]; + param_2 = x_68; + let x_70 : i32 = x_9.x_GLF_uniform_int_values[1]; + param_3 = x_70; + func_struct_S_i11_i1_(&(param_2), &(param_3)); + let x_72 : S = param_2; + arr[x_66] = x_72; + } + let x_75 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_77 : i32 = arr[x_75].data; + let x_79 : i32 = x_9.x_GLF_uniform_int_values[1]; + if ((x_77 == x_79)) { + let x_85 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_88 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_91 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_94 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_85), f32(x_88), f32(x_91), f32(x_94)); + } else { + let x_98 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_99 : f32 = f32(x_98); + x_GLF_color = vec4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..ac091bde99 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.hlsl @@ -0,0 +1,89 @@ +struct S { + int data; +}; + +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_struct_S_i11_i1_(inout S s, inout int x) { + const int x_103 = asint(x_9[1].x); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_105 = asint(x_9[scalar_offset / 4][scalar_offset % 4]); + if ((x_103 == x_105)) { + return; + } + const int x_109 = x; + s.data = x_109; + return; +} + +void main_1() { + int i = 0; + S arr[10] = (S[10])0; + int index = 0; + S param = (S)0; + int param_1 = 0; + S param_2 = (S)0; + int param_3 = 0; + i = 0; + { + for(; (i < 10); i = (i + 1)) { + arr[i].data = 0; + } + } + const int x_51 = asint(x_9[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_51 == x_53)) { + const int x_58 = index; + const S x_60 = arr[x_58]; + param = x_60; + param_1 = index; + func_struct_S_i11_i1_(param, param_1); + arr[x_58] = param; + } else { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_66 = asint(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const S x_68 = arr[x_66]; + param_2 = x_68; + const int x_70 = asint(x_9[1].x); + param_3 = x_70; + func_struct_S_i11_i1_(param_2, param_3); + arr[x_66] = param_2; + } + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_75 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_77 = arr[x_75].data; + const int x_79 = asint(x_9[1].x); + if ((x_77 == x_79)) { + const int x_85 = asint(x_9[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_88 = asint(x_9[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_91 = asint(x_9[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_94 = asint(x_9[1].x); + x_GLF_color = float4(float(x_85), float(x_88), float(x_91), float(x_94)); + } else { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_98 = asint(x_9[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_99 = float(x_98); + x_GLF_color = float4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..34d029d82a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.msl @@ -0,0 +1,105 @@ +#include + +using namespace metal; +struct S { + int data; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + S arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_struct_S_i11_i1_(constant buf0& x_9, thread S* const s, thread int* const x) { + int const x_103 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_105 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_103 == x_105)) { + return; + } + int const x_109 = *(x); + (*(s)).data = x_109; + return; +} + +void main_1(constant buf0& x_9, thread float4* const tint_symbol_4) { + int i = 0; + tint_array_wrapper_1 arr = {}; + int index = 0; + S param = {}; + int param_1 = 0; + S param_2 = {}; + int param_3 = 0; + i = 0; + while (true) { + int const x_43 = i; + if ((x_43 < 10)) { + } else { + break; + } + int const x_46 = i; + arr.arr[x_46].data = 0; + { + int const x_48 = i; + i = (x_48 + 1); + } + } + int const x_51 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_53 = x_9.x_GLF_uniform_int_values.arr[0].el; + if ((x_51 == x_53)) { + int const x_58 = index; + S const x_60 = arr.arr[x_58]; + param = x_60; + int const x_61 = index; + param_1 = x_61; + func_struct_S_i11_i1_(x_9, &(param), &(param_1)); + S const x_63 = param; + arr.arr[x_58] = x_63; + } else { + int const x_66 = x_9.x_GLF_uniform_int_values.arr[0].el; + S const x_68 = arr.arr[x_66]; + param_2 = x_68; + int const x_70 = x_9.x_GLF_uniform_int_values.arr[1].el; + param_3 = x_70; + func_struct_S_i11_i1_(x_9, &(param_2), &(param_3)); + S const x_72 = param_2; + arr.arr[x_66] = x_72; + } + int const x_75 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_77 = arr.arr[x_75].data; + int const x_79 = x_9.x_GLF_uniform_int_values.arr[1].el; + if ((x_77 == x_79)) { + int const x_85 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_88 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_91 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_94 = x_9.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_85), float(x_88), float(x_91), float(x_94)); + } else { + int const x_98 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_99 = float(x_98); + *(tint_symbol_4) = float4(x_99, x_99, x_99, x_99); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..85eaf66a10 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.spvasm @@ -0,0 +1,213 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 137 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %S "S" + OpMemberName %S 0 "data" + OpName %func_struct_S_i11_i1_ "func_struct_S_i11_i1_" + OpName %s "s" + OpName %x "x" + OpName %main_1 "main_1" + OpName %i "i" + OpName %arr "arr" + OpName %index "index" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_arr_S_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %S = OpTypeStruct %int +%_ptr_Function_S = OpTypePointer Function %S +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpTypeFunction %void %_ptr_Function_S %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %40 = OpTypeFunction %void + %44 = OpConstantNull %int + %uint_10 = OpConstant %uint 10 +%_arr_S_uint_10 = OpTypeArray %S %uint_10 +%_ptr_Function__arr_S_uint_10 = OpTypePointer Function %_arr_S_uint_10 + %49 = OpConstantNull %_arr_S_uint_10 + %52 = OpConstantNull %S + %int_10 = OpConstant %int 10 + %main_out = OpTypeStruct %v4float + %125 = OpTypeFunction %void %main_out +%func_struct_S_i11_i1_ = OpFunction %void None %15 + %s = OpFunctionParameter %_ptr_Function_S + %x = OpFunctionParameter %_ptr_Function_int + %23 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %28 = OpLoad %int %27 + %30 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %31 = OpLoad %int %30 + %32 = OpIEqual %bool %28 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %34 + %35 = OpLabel + OpReturn + %34 = OpLabel + %37 = OpLoad %int %x + %39 = OpAccessChain %_ptr_Function_int %s %uint_0 + OpStore %39 %37 + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %40 + %42 = OpLabel + %i = OpVariable %_ptr_Function_int Function %44 + %arr = OpVariable %_ptr_Function__arr_S_uint_10 Function %49 + %index = OpVariable %_ptr_Function_int Function %44 + %param = OpVariable %_ptr_Function_S Function %52 + %param_1 = OpVariable %_ptr_Function_int Function %44 + %param_2 = OpVariable %_ptr_Function_S Function %52 + %param_3 = OpVariable %_ptr_Function_int Function %44 + OpStore %i %int_0 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %int %i + %62 = OpSLessThan %bool %60 %int_10 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %57 + %63 = OpLabel + %66 = OpLoad %int %i + %67 = OpAccessChain %_ptr_Function_int %arr %66 %uint_0 + OpStore %67 %int_0 + OpBranch %58 + %58 = OpLabel + %68 = OpLoad %int %i + %69 = OpIAdd %int %68 %int_1 + OpStore %i %69 + OpBranch %56 + %57 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %73 = OpLoad %int %72 + %74 = OpIEqual %bool %71 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + %78 = OpLoad %int %index + %79 = OpAccessChain %_ptr_Function_S %arr %78 + %80 = OpLoad %S %79 + OpStore %param %80 + %81 = OpLoad %int %index + OpStore %param_1 %81 + %82 = OpFunctionCall %void %func_struct_S_i11_i1_ %param %param_1 + %85 = OpLoad %S %param + %86 = OpAccessChain %_ptr_Function_S %arr %78 + OpStore %86 %85 + OpBranch %75 + %77 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Function_S %arr %88 + %90 = OpLoad %S %89 + OpStore %param_2 %90 + %91 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %92 = OpLoad %int %91 + OpStore %param_3 %92 + %93 = OpFunctionCall %void %func_struct_S_i11_i1_ %param_2 %param_3 + %96 = OpLoad %S %param_2 + %97 = OpAccessChain %_ptr_Function_S %arr %88 + OpStore %97 %96 + OpBranch %75 + %75 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_Function_int %arr %99 %uint_0 + %101 = OpLoad %int %100 + %102 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %103 = OpLoad %int %102 + %104 = OpIEqual %bool %101 %103 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %107 + %106 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %111 = OpLoad %int %110 + %112 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %115 = OpLoad %int %114 + %116 = OpConvertSToF %float %109 + %117 = OpConvertSToF %float %111 + %118 = OpConvertSToF %float %113 + %119 = OpConvertSToF %float %115 + %120 = OpCompositeConstruct %v4float %116 %117 %118 %119 + OpStore %x_GLF_color %120 + OpBranch %105 + %107 = OpLabel + %121 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %122 = OpLoad %int %121 + %123 = OpConvertSToF %float %122 + %124 = OpCompositeConstruct %v4float %123 %123 %123 %123 + OpStore %x_GLF_color %124 + OpBranch %105 + %105 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %125 +%tint_symbol = OpFunctionParameter %main_out + %129 = OpLabel + %130 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %130 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %40 + %132 = OpLabel + %133 = OpFunctionCall %void %main_1 + %135 = OpLoad %v4float %x_GLF_color + %136 = OpCompositeConstruct %main_out %135 + %134 = OpFunctionCall %void %tint_symbol_2 %136 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b1a8e78bbf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-uninitialized-values-passed-to-function-never-executed/0-opt.wgsl.expected.wgsl @@ -0,0 +1,97 @@ +struct S { + data : i32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn func_struct_S_i11_i1_(s : ptr, x : ptr) { + let x_103 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_105 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_103 == x_105)) { + return; + } + let x_109 : i32 = *(x); + (*(s)).data = x_109; + return; +} + +fn main_1() { + var i : i32; + var arr : array; + var index : i32; + var param : S; + var param_1 : i32; + var param_2 : S; + var param_3 : i32; + i = 0; + loop { + let x_43 : i32 = i; + if ((x_43 < 10)) { + } else { + break; + } + let x_46 : i32 = i; + arr[x_46].data = 0; + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_51 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_9.x_GLF_uniform_int_values[0]; + if ((x_51 == x_53)) { + let x_58 : i32 = index; + let x_60 : S = arr[x_58]; + param = x_60; + let x_61 : i32 = index; + param_1 = x_61; + func_struct_S_i11_i1_(&(param), &(param_1)); + let x_63 : S = param; + arr[x_58] = x_63; + } else { + let x_66 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_68 : S = arr[x_66]; + param_2 = x_68; + let x_70 : i32 = x_9.x_GLF_uniform_int_values[1]; + param_3 = x_70; + func_struct_S_i11_i1_(&(param_2), &(param_3)); + let x_72 : S = param_2; + arr[x_66] = x_72; + } + let x_75 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_77 : i32 = arr[x_75].data; + let x_79 : i32 = x_9.x_GLF_uniform_int_values[1]; + if ((x_77 == x_79)) { + let x_85 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_88 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_91 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_94 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_85), f32(x_88), f32(x_91), f32(x_94)); + } else { + let x_98 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_99 : f32 = f32(x_98); + x_GLF_color = vec4(x_99, x_99, x_99, x_99); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm new file mode 100644 index 0000000000..0c0c766746 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm @@ -0,0 +1,126 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %v "v" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_uint_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "_GLF_uniform_float_values" + OpName %__1 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_uint_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 2 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %buf0 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_92382 = OpConstant %uint 92382 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf2 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__1 = OpVariable %_ptr_Uniform_buf2 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %15 + %37 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + %38 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %int_0 + %39 = OpLoad %uint %38 + %40 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %int_0 + %41 = OpLoad %uint %40 + %42 = OpSelect %uint %true %uint_92382 %41 + %43 = OpUDiv %uint %39 %42 + %44 = OpExtInst %v4float %1 UnpackUnorm4x8 %43 + OpStore %v %44 + %45 = OpLoad %v4float %v + %46 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpConvertSToF %float %47 + %49 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpAccessChain %_ptr_Uniform_float %__1 %int_0 %int_1 + %56 = OpLoad %float %55 + %57 = OpAccessChain %_ptr_Uniform_float %__1 %int_0 %int_2 + %58 = OpLoad %float %57 + %59 = OpFDiv %float %56 %58 + %60 = OpCompositeConstruct %v4float %48 %51 %54 %59 + %61 = OpExtInst %float %1 Distance %45 %60 + %62 = OpAccessChain %_ptr_Uniform_float %__1 %int_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpFOrdLessThan %bool %61 %63 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %67 + %66 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %69 + %71 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %72 + %74 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %75 + %77 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpConvertSToF %float %78 + %80 = OpCompositeConstruct %v4float %70 %73 %76 %79 + OpStore %_GLF_color %80 + OpBranch %65 + %67 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %82 = OpLoad %int %81 + %83 = OpConvertSToF %float %82 + %84 = OpCompositeConstruct %v4float %83 %83 %83 %83 + OpStore %_GLF_color %84 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3a0af57b26 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.hlsl @@ -0,0 +1,65 @@ +float4 tint_unpack4x8unorm(uint param_0) { + uint j = param_0; + uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); + return float4(i) / 255.0; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; +cbuffer cbuffer_x_10 : register(b2, space0) { + uint4 x_10[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const uint x_39 = x_6[scalar_offset / 4][scalar_offset % 4]; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const uint x_41 = x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]; + v = tint_unpack4x8unorm((x_39 / (true ? 92382u : x_41))); + const float4 x_45 = v; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_56 = asfloat(x_10[1].x); + const float x_58 = asfloat(x_10[2].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_63 = asfloat(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((distance(x_45, float4(float(x_47), float(x_50), float(x_53), (x_56 / x_58))) < x_63)) { + const int x_69 = asint(x_8[1].x); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_72 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_75 = asint(x_8[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const int x_78 = asint(x_8[1].x); + x_GLF_color = float4(float(x_69), float(x_72), float(x_75), float(x_78)); + } else { + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_82 = asint(x_8[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float x_83 = float(x_82); + x_GLF_color = float4(x_83, x_83, x_83, x_83); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..1f2929cce5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ uint el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_uint_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_2 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_2[12]; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ tint_padded_array_element_2 arr[3]; +}; +struct buf2 { + /* 0x0000 */ tint_array_wrapper_2 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, constant buf2& x_10, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + uint const x_39 = x_6.x_GLF_uniform_uint_values.arr[0].el; + uint const x_41 = x_6.x_GLF_uniform_uint_values.arr[0].el; + v = unpack_unorm4x8_to_float((x_39 / select(x_41, 92382u, true))); + float4 const x_45 = v; + int const x_47 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_50 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_56 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_58 = x_10.x_GLF_uniform_float_values.arr[2].el; + float const x_63 = x_10.x_GLF_uniform_float_values.arr[0].el; + if ((distance(x_45, float4(float(x_47), float(x_50), float(x_53), (x_56 / x_58))) < x_63)) { + int const x_69 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_72 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_75 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_78 = x_8.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_69), float(x_72), float(x_75), float(x_78)); + } else { + int const x_82 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_83 = float(x_82); + *(tint_symbol_4) = float4(x_83, x_83, x_83, x_83); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]], constant buf2& x_10 [[buffer(2)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..072754926b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.spvasm @@ -0,0 +1,161 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 101 +; Schema: 0 + OpCapability Shader + %39 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_uint_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_uint_uint_1 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 2 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %buf0 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf2 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_10 = OpVariable %_ptr_Uniform_buf2 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %22 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %22 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %22 + %void = OpTypeVoid + %25 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %true = OpConstantTrue %bool + %uint_92382 = OpConstant %uint 92382 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %89 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %25 + %28 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %22 + %34 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 %int_0 + %35 = OpLoad %uint %34 + %36 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 %int_0 + %37 = OpLoad %uint %36 + %40 = OpSelect %uint %true %uint_92382 %37 + %44 = OpUDiv %uint %35 %40 + %38 = OpExtInst %v4float %39 UnpackUnorm4x8 %44 + OpStore %v %38 + %45 = OpLoad %v4float %v + %47 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %52 = OpLoad %int %51 + %55 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_2 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %61 = OpLoad %float %60 + %63 = OpConvertSToF %float %48 + %64 = OpConvertSToF %float %50 + %65 = OpConvertSToF %float %52 + %66 = OpFDiv %float %56 %59 + %67 = OpCompositeConstruct %v4float %63 %64 %65 %66 + %62 = OpExtInst %float %39 Distance %45 %67 + %68 = OpFOrdLessThan %bool %62 %61 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpConvertSToF %float %73 + %81 = OpConvertSToF %float %75 + %82 = OpConvertSToF %float %77 + %83 = OpConvertSToF %float %79 + %84 = OpCompositeConstruct %v4float %80 %81 %82 %83 + OpStore %x_GLF_color %84 + OpBranch %69 + %71 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %86 + %88 = OpCompositeConstruct %v4float %87 %87 %87 %87 + OpStore %x_GLF_color %88 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %89 +%tint_symbol = OpFunctionParameter %main_out + %93 = OpLabel + %94 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %94 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %25 + %96 = OpLabel + %97 = OpFunctionCall %void %main_1 + %99 = OpLoad %v4float %x_GLF_color + %100 = OpCompositeConstruct %main_out %99 + %98 = OpFunctionCall %void %tint_symbol_2 %100 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b44947baa2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.spvasm.expected.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_uint_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_float_values : Arr_2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(2)]] var x_10 : buf2; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + let x_39 : u32 = x_6.x_GLF_uniform_uint_values[0]; + let x_41 : u32 = x_6.x_GLF_uniform_uint_values[0]; + v = unpack4x8unorm((x_39 / select(x_41, 92382u, true))); + let x_45 : vec4 = v; + let x_47 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_56 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_58 : f32 = x_10.x_GLF_uniform_float_values[2]; + let x_63 : f32 = x_10.x_GLF_uniform_float_values[0]; + if ((distance(x_45, vec4(f32(x_47), f32(x_50), f32(x_53), (x_56 / x_58))) < x_63)) { + let x_69 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_72 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_75 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_78 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_69), f32(x_72), f32(x_75), f32(x_78)); + } else { + let x_82 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_83 : f32 = f32(x_82); + x_GLF_color = vec4(x_83, x_83, x_83, x_83); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl new file mode 100644 index 0000000000..b44947baa2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_uint_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_float_values : Arr_2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(2)]] var x_10 : buf2; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + let x_39 : u32 = x_6.x_GLF_uniform_uint_values[0]; + let x_41 : u32 = x_6.x_GLF_uniform_uint_values[0]; + v = unpack4x8unorm((x_39 / select(x_41, 92382u, true))); + let x_45 : vec4 = v; + let x_47 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_56 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_58 : f32 = x_10.x_GLF_uniform_float_values[2]; + let x_63 : f32 = x_10.x_GLF_uniform_float_values[0]; + if ((distance(x_45, vec4(f32(x_47), f32(x_50), f32(x_53), (x_56 / x_58))) < x_63)) { + let x_69 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_72 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_75 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_78 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_69), f32(x_72), f32(x_75), f32(x_78)); + } else { + let x_82 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_83 : f32 = f32(x_82); + x_GLF_color = vec4(x_83, x_83, x_83, x_83); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3a0af57b26 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.hlsl @@ -0,0 +1,65 @@ +float4 tint_unpack4x8unorm(uint param_0) { + uint j = param_0; + uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24); + return float4(i) / 255.0; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[2]; +}; +cbuffer cbuffer_x_10 : register(b2, space0) { + uint4 x_10[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + const uint scalar_offset = ((16u * uint(0))) / 4; + const uint x_39 = x_6[scalar_offset / 4][scalar_offset % 4]; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const uint x_41 = x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]; + v = tint_unpack4x8unorm((x_39 / (true ? 92382u : x_41))); + const float4 x_45 = v; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_50 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const float x_56 = asfloat(x_10[1].x); + const float x_58 = asfloat(x_10[2].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_63 = asfloat(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]); + if ((distance(x_45, float4(float(x_47), float(x_50), float(x_53), (x_56 / x_58))) < x_63)) { + const int x_69 = asint(x_8[1].x); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_72 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_75 = asint(x_8[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const int x_78 = asint(x_8[1].x); + x_GLF_color = float4(float(x_69), float(x_72), float(x_75), float(x_78)); + } else { + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_82 = asint(x_8[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float x_83 = float(x_82); + x_GLF_color = float4(x_83, x_83, x_83, x_83); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..1f2929cce5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ uint el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_uint_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_2 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_2[12]; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ tint_padded_array_element_2 arr[3]; +}; +struct buf2 { + /* 0x0000 */ tint_array_wrapper_2 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, constant buf2& x_10, thread float4* const tint_symbol_4) { + float4 v = 0.0f; + uint const x_39 = x_6.x_GLF_uniform_uint_values.arr[0].el; + uint const x_41 = x_6.x_GLF_uniform_uint_values.arr[0].el; + v = unpack_unorm4x8_to_float((x_39 / select(x_41, 92382u, true))); + float4 const x_45 = v; + int const x_47 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_50 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_56 = x_10.x_GLF_uniform_float_values.arr[1].el; + float const x_58 = x_10.x_GLF_uniform_float_values.arr[2].el; + float const x_63 = x_10.x_GLF_uniform_float_values.arr[0].el; + if ((distance(x_45, float4(float(x_47), float(x_50), float(x_53), (x_56 / x_58))) < x_63)) { + int const x_69 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_72 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_75 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_78 = x_8.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_69), float(x_72), float(x_75), float(x_78)); + } else { + int const x_82 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_83 = float(x_82); + *(tint_symbol_4) = float4(x_83, x_83, x_83, x_83); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]], constant buf2& x_10 [[buffer(2)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..072754926b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.spvasm @@ -0,0 +1,161 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 101 +; Schema: 0 + OpCapability Shader + %39 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_uint_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_uint_uint_1 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 2 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %buf0 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf1 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf2 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_10 = OpVariable %_ptr_Uniform_buf2 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %22 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %22 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %22 + %void = OpTypeVoid + %25 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %true = OpConstantTrue %bool + %uint_92382 = OpConstant %uint 92382 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %89 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %25 + %28 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %22 + %34 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 %int_0 + %35 = OpLoad %uint %34 + %36 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 %int_0 + %37 = OpLoad %uint %36 + %40 = OpSelect %uint %true %uint_92382 %37 + %44 = OpUDiv %uint %35 %40 + %38 = OpExtInst %v4float %39 UnpackUnorm4x8 %44 + OpStore %v %38 + %45 = OpLoad %v4float %v + %47 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %52 = OpLoad %int %51 + %55 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_1 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_2 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %61 = OpLoad %float %60 + %63 = OpConvertSToF %float %48 + %64 = OpConvertSToF %float %50 + %65 = OpConvertSToF %float %52 + %66 = OpFDiv %float %56 %59 + %67 = OpCompositeConstruct %v4float %63 %64 %65 %66 + %62 = OpExtInst %float %39 Distance %45 %67 + %68 = OpFOrdLessThan %bool %62 %61 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpConvertSToF %float %73 + %81 = OpConvertSToF %float %75 + %82 = OpConvertSToF %float %77 + %83 = OpConvertSToF %float %79 + %84 = OpCompositeConstruct %v4float %80 %81 %82 %83 + OpStore %x_GLF_color %84 + OpBranch %69 + %71 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %86 + %88 = OpCompositeConstruct %v4float %87 %87 %87 %87 + OpStore %x_GLF_color %88 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %89 +%tint_symbol = OpFunctionParameter %main_out + %93 = OpLabel + %94 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %94 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %25 + %96 = OpLabel + %97 = OpFunctionCall %void %main_1 + %99 = OpLoad %v4float %x_GLF_color + %100 = OpCompositeConstruct %main_out %99 + %98 = OpFunctionCall %void %tint_symbol_2 %100 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b44947baa2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unpack-unorm-mix-always-one/0-opt.wgsl.expected.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_uint_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr_1; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_float_values : Arr_2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +[[group(0), binding(1)]] var x_8 : buf1; + +[[group(0), binding(2)]] var x_10 : buf2; + +var x_GLF_color : vec4; + +fn main_1() { + var v : vec4; + let x_39 : u32 = x_6.x_GLF_uniform_uint_values[0]; + let x_41 : u32 = x_6.x_GLF_uniform_uint_values[0]; + v = unpack4x8unorm((x_39 / select(x_41, 92382u, true))); + let x_45 : vec4 = v; + let x_47 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_56 : f32 = x_10.x_GLF_uniform_float_values[1]; + let x_58 : f32 = x_10.x_GLF_uniform_float_values[2]; + let x_63 : f32 = x_10.x_GLF_uniform_float_values[0]; + if ((distance(x_45, vec4(f32(x_47), f32(x_50), f32(x_53), (x_56 / x_58))) < x_63)) { + let x_69 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_72 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_75 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_78 : i32 = x_8.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_69), f32(x_72), f32(x_75), f32(x_78)); + } else { + let x_82 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_83 : f32 = f32(x_82); + x_GLF_color = vec4(x_83, x_83, x_83, x_83); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm new file mode 100644 index 0000000000..6b6223de10 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm @@ -0,0 +1,185 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %m43 "m43" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %sums "sums" + OpName %i "i" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 +%_ptr_Function_int = OpTypePointer Function %int + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_2 = OpConstant %int 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %41 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %main = OpFunction %void None %15 + %42 = OpLabel + %m43 = OpVariable %_ptr_Function_mat4v3float Function + %sums = OpVariable %_ptr_Function__arr_float_uint_3 Function + %i = OpVariable %_ptr_Function_int Function + %a = OpVariable %_ptr_Function_int Function + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %44 = OpLoad %float %43 + %45 = OpCompositeConstruct %v3float %44 %float_0 %float_0 + %46 = OpCompositeConstruct %v3float %float_0 %44 %float_0 + %47 = OpCompositeConstruct %v3float %float_0 %float_0 %44 + %48 = OpCompositeConstruct %v3float %float_0 %float_0 %float_0 + %49 = OpCompositeConstruct %mat4v3float %45 %46 %47 %41 + OpStore %m43 %49 + %50 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %55 = OpLoad %float %54 + %56 = OpAccessChain %_ptr_Function_float %m43 %51 %53 + OpStore %56 %55 + %57 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %58 = OpLoad %float %57 + %59 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %60 = OpLoad %float %59 + %61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %62 = OpLoad %float %61 + %63 = OpCompositeConstruct %_arr_float_uint_3 %58 %60 %62 + OpStore %sums %63 + %64 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %65 = OpLoad %int %64 + OpStore %i %65 + OpBranch %66 + %66 = OpLabel + %67 = OpPhi %int %65 %42 %68 %69 + OpLoopMerge %70 %69 None + OpBranch %71 + %71 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %73 = OpLoad %int %72 + %74 = OpSLessThan %bool %67 %73 + OpBranchConditional %74 %75 %70 + %75 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Function_float %m43 %67 %79 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Function_float %sums %77 + %83 = OpLoad %float %82 + %84 = OpFAdd %float %83 %81 + %85 = OpAccessChain %_ptr_Function_float %sums %77 + OpStore %85 %84 + OpBranch %69 + %69 = OpLabel + %68 = OpIAdd %int %67 %int_1 + OpStore %i %68 + OpBranch %66 + %70 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpIEqual %bool %87 %int_1 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + OpStore %a %int_4 + %91 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %92 = OpLoad %int %91 + %93 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Function_float %m43 %int_4 %94 + %96 = OpLoad %float %95 + %97 = OpAccessChain %_ptr_Function_float %sums %92 + %98 = OpLoad %float %97 + %99 = OpFAdd %float %98 %96 + %100 = OpAccessChain %_ptr_Function_float %sums %92 + OpStore %100 %99 + OpBranch %89 + %89 = OpLabel + %101 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %102 = OpLoad %int %101 + %103 = OpAccessChain %_ptr_Function_float %sums %102 + %104 = OpLoad %float %103 + %105 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %106 = OpLoad %int %105 + %107 = OpAccessChain %_ptr_Function_float %sums %106 + %108 = OpLoad %float %107 + %109 = OpFAdd %float %104 %108 + %110 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %111 = OpLoad %float %110 + %112 = OpFOrdEqual %bool %109 %111 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %115 + %114 = OpLabel + %116 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %117 = OpLoad %int %116 + %118 = OpConvertSToF %float %117 + %119 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %120 = OpLoad %int %119 + %121 = OpConvertSToF %float %120 + %122 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %123 = OpLoad %int %122 + %124 = OpConvertSToF %float %123 + %125 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %126 = OpLoad %int %125 + %127 = OpConvertSToF %float %126 + %128 = OpCompositeConstruct %v4float %118 %121 %124 %127 + OpStore %_GLF_color %128 + OpBranch %113 + %115 = OpLabel + %129 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %130 = OpLoad %int %129 + %131 = OpConvertSToF %float %130 + %132 = OpCompositeConstruct %v4float %131 %131 %131 %131 + OpStore %_GLF_color %132 + OpBranch %113 + %113 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..75c82eaf65 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.hlsl @@ -0,0 +1,109 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +struct tint_padded_array_element { + float el; +}; + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + tint_padded_array_element sums[3] = (tint_padded_array_element[3])0; + int i = 0; + int a = 0; + int x_67_phi = 0; + const float x_44 = asfloat(x_6[1].x); + const float3 x_48 = float3(0.0f, 0.0f, 0.0f); + m43 = float4x3(float3(x_44, 0.0f, 0.0f), float3(0.0f, x_44, 0.0f), float3(0.0f, 0.0f, x_44), float3(0.0f, 0.0f, 0.0f)); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_51 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + set_float3(m43[x_51], x_53, x_55); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_58 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_60 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_62 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const tint_padded_array_element tint_symbol_4[3] = {{x_58}, {x_60}, {x_62}}; + sums = tint_symbol_4; + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_65 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]); + i = x_65; + x_67_phi = x_65; + while (true) { + const int x_67 = x_67_phi; + const int x_73 = asint(x_8[3].x); + if ((x_67 < x_73)) { + } else { + break; + } + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_77 = asint(x_8[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_79 = asint(x_8[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float x_81 = m43[x_67][x_79]; + const float x_83 = sums[x_77].el; + sums[x_77].el = (x_83 + x_81); + { + const int x_68 = (x_67 + 1); + i = x_68; + x_67_phi = x_68; + } + } + const int x_87 = asint(x_8[1].x); + if ((x_87 == 1)) { + a = 4; + const int x_92 = asint(x_8[2].x); + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_94 = asint(x_8[scalar_offset_9 / 4][scalar_offset_9 % 4]); + const float x_96 = m43[4][x_94]; + const float x_98 = sums[x_92].el; + sums[x_92].el = (x_98 + x_96); + } + const int x_102 = asint(x_8[1].x); + const float x_104 = sums[x_102].el; + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_106 = asint(x_8[scalar_offset_10 / 4][scalar_offset_10 % 4]); + const float x_108 = sums[x_106].el; + const float x_111 = asfloat(x_6[2].x); + if (((x_104 + x_108) == x_111)) { + const uint scalar_offset_11 = ((16u * uint(0))) / 4; + const int x_117 = asint(x_8[scalar_offset_11 / 4][scalar_offset_11 % 4]); + const int x_120 = asint(x_8[1].x); + const int x_123 = asint(x_8[1].x); + const uint scalar_offset_12 = ((16u * uint(0))) / 4; + const int x_126 = asint(x_8[scalar_offset_12 / 4][scalar_offset_12 % 4]); + x_GLF_color = float4(float(x_117), float(x_120), float(x_123), float(x_126)); + } else { + const int x_130 = asint(x_8[1].x); + const float x_131 = float(x_130); + x_GLF_color = float4(x_131, x_131, x_131, x_131); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..3fc4376ec7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.msl @@ -0,0 +1,105 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_5) { + float4x3 m43 = float4x3(0.0f); + tint_array_wrapper sums = {}; + int i = 0; + int a = 0; + int x_67_phi = 0; + float const x_44 = x_6.x_GLF_uniform_float_values.arr[1].el; + float3 const x_48 = float3(0.0f, 0.0f, 0.0f); + m43 = float4x3(float3(x_44, 0.0f, 0.0f), float3(0.0f, x_44, 0.0f), float3(0.0f, 0.0f, x_44), float3(0.0f, 0.0f, 0.0f)); + int const x_51 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_55 = x_6.x_GLF_uniform_float_values.arr[0].el; + m43[x_51][x_53] = x_55; + float const x_58 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_62 = x_6.x_GLF_uniform_float_values.arr[0].el; + tint_array_wrapper const tint_symbol_3 = {.arr={{.el=x_58}, {.el=x_60}, {.el=x_62}}}; + sums = tint_symbol_3; + int const x_65 = x_8.x_GLF_uniform_int_values.arr[0].el; + i = x_65; + x_67_phi = x_65; + while (true) { + int const x_67 = x_67_phi; + int const x_73 = x_8.x_GLF_uniform_int_values.arr[3].el; + if ((x_67 < x_73)) { + } else { + break; + } + int const x_77 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_79 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_81 = m43[x_67][x_79]; + float const x_83 = sums.arr[x_77].el; + sums.arr[x_77].el = (x_83 + x_81); + { + int const x_68 = (x_67 + 1); + i = x_68; + x_67_phi = x_68; + } + } + int const x_87 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_87 == 1)) { + a = 4; + int const x_92 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_94 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_96 = m43[4][x_94]; + float const x_98 = sums.arr[x_92].el; + sums.arr[x_92].el = (x_98 + x_96); + } + int const x_102 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_104 = sums.arr[x_102].el; + int const x_106 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_108 = sums.arr[x_106].el; + float const x_111 = x_6.x_GLF_uniform_float_values.arr[2].el; + if (((x_104 + x_108) == x_111)) { + int const x_117 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_120 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_123 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_126 = x_8.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_117), float(x_120), float(x_123), float(x_126)); + } else { + int const x_130 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_131 = float(x_130); + *(tint_symbol_5) = float4(x_131, x_131, x_131, x_131); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..c63ce320cc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.spvasm @@ -0,0 +1,228 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 152 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m43 "m43" + OpName %sums "sums" + OpName %i "i" + OpName %a "a" + OpName %x_67_phi "x_67_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %28 = OpConstantNull %mat4v3float +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 + %31 = OpConstantNull %_arr_float_uint_3 +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %43 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %140 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %m43 = OpVariable %_ptr_Function_mat4v3float Function %28 + %sums = OpVariable %_ptr_Function__arr_float_uint_3 Function %31 + %i = OpVariable %_ptr_Function_int Function %34 + %a = OpVariable %_ptr_Function_int Function %34 + %x_67_phi = OpVariable %_ptr_Function_int Function %34 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %41 = OpLoad %float %40 + %44 = OpCompositeConstruct %v3float %41 %float_0 %float_0 + %45 = OpCompositeConstruct %v3float %float_0 %41 %float_0 + %46 = OpCompositeConstruct %v3float %float_0 %float_0 %41 + %47 = OpCompositeConstruct %mat4v3float %44 %45 %46 %43 + OpStore %m43 %47 + %50 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %55 = OpLoad %float %54 + %57 = OpAccessChain %_ptr_Function_float %m43 %51 %53 + OpStore %57 %55 + %58 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpCompositeConstruct %_arr_float_uint_3 %59 %61 %63 + OpStore %sums %64 + %65 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %66 = OpLoad %int %65 + OpStore %i %66 + OpStore %x_67_phi %66 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %x_67_phi + %73 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %74 = OpLoad %int %73 + %75 = OpSLessThan %bool %71 %74 + OpSelectionMerge %77 None + OpBranchConditional %75 %78 %79 + %78 = OpLabel + OpBranch %77 + %79 = OpLabel + OpBranch %68 + %77 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Function_float %m43 %71 %83 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Function_float %sums %81 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Function_float %sums %81 + %89 = OpFAdd %float %87 %85 + OpStore %88 %89 + OpBranch %69 + %69 = OpLabel + %90 = OpIAdd %int %71 %int_1 + OpStore %i %90 + OpStore %x_67_phi %90 + OpBranch %67 + %68 = OpLabel + %91 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpIEqual %bool %92 %int_1 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %94 + %95 = OpLabel + OpStore %a %int_4 + %98 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %101 = OpLoad %int %100 + %102 = OpAccessChain %_ptr_Function_float %m43 %int_4 %101 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Function_float %sums %99 + %105 = OpLoad %float %104 + %106 = OpAccessChain %_ptr_Function_float %sums %99 + %107 = OpFAdd %float %105 %103 + OpStore %106 %107 + OpBranch %94 + %94 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Function_float %sums %109 + %111 = OpLoad %float %110 + %112 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Function_float %sums %113 + %115 = OpLoad %float %114 + %116 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %117 = OpLoad %float %116 + %118 = OpFAdd %float %111 %115 + %119 = OpFOrdEqual %bool %118 %117 + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %124 = OpLoad %int %123 + %125 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %126 = OpLoad %int %125 + %127 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %130 = OpLoad %int %129 + %131 = OpConvertSToF %float %124 + %132 = OpConvertSToF %float %126 + %133 = OpConvertSToF %float %128 + %134 = OpConvertSToF %float %130 + %135 = OpCompositeConstruct %v4float %131 %132 %133 %134 + OpStore %x_GLF_color %135 + OpBranch %120 + %122 = OpLabel + %136 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %137 = OpLoad %int %136 + %138 = OpConvertSToF %float %137 + %139 = OpCompositeConstruct %v4float %138 %138 %138 %138 + OpStore %x_GLF_color %139 + OpBranch %120 + %120 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %140 +%tint_symbol = OpFunctionParameter %main_out + %144 = OpLabel + %145 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %145 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %147 = OpLabel + %148 = OpFunctionCall %void %main_1 + %150 = OpLoad %v4float %x_GLF_color + %151 = OpCompositeConstruct %main_out %150 + %149 = OpFunctionCall %void %tint_symbol_2 %151 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..7c1756e1a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.wgsl @@ -0,0 +1,97 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m43 : mat4x3; + var sums : Arr; + var i : i32; + var a : i32; + var x_67_phi : i32; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_48 : vec3 = vec3(0.0, 0.0, 0.0); + m43 = mat4x3(vec3(x_44, 0.0, 0.0), vec3(0.0, x_44, 0.0), vec3(0.0, 0.0, x_44), vec3(0.0, 0.0, 0.0)); + let x_51 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[0]; + m43[x_51][x_53] = x_55; + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[0]; + sums = Arr(x_58, x_60, x_62); + let x_65 : i32 = x_8.x_GLF_uniform_int_values[0]; + i = x_65; + x_67_phi = x_65; + loop { + let x_67 : i32 = x_67_phi; + let x_73 : i32 = x_8.x_GLF_uniform_int_values[3]; + if ((x_67 < x_73)) { + } else { + break; + } + let x_77 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_79 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_81 : f32 = m43[x_67][x_79]; + let x_83 : f32 = sums[x_77]; + sums[x_77] = (x_83 + x_81); + + continuing { + let x_68 : i32 = (x_67 + 1); + i = x_68; + x_67_phi = x_68; + } + } + let x_87 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_87 == 1)) { + a = 4; + let x_92 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_94 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_96 : f32 = m43[4][x_94]; + let x_98 : f32 = sums[x_92]; + sums[x_92] = (x_98 + x_96); + } + let x_102 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_104 : f32 = sums[x_102]; + let x_106 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_108 : f32 = sums[x_106]; + let x_111 : f32 = x_6.x_GLF_uniform_float_values[2]; + if (((x_104 + x_108) == x_111)) { + let x_117 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_120 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_123 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_126 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_117), f32(x_120), f32(x_123), f32(x_126)); + } else { + let x_130 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_131 : f32 = f32(x_130); + x_GLF_color = vec4(x_131, x_131, x_131, x_131); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl new file mode 100644 index 0000000000..7c1756e1a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl @@ -0,0 +1,97 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m43 : mat4x3; + var sums : Arr; + var i : i32; + var a : i32; + var x_67_phi : i32; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_48 : vec3 = vec3(0.0, 0.0, 0.0); + m43 = mat4x3(vec3(x_44, 0.0, 0.0), vec3(0.0, x_44, 0.0), vec3(0.0, 0.0, x_44), vec3(0.0, 0.0, 0.0)); + let x_51 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[0]; + m43[x_51][x_53] = x_55; + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[0]; + sums = Arr(x_58, x_60, x_62); + let x_65 : i32 = x_8.x_GLF_uniform_int_values[0]; + i = x_65; + x_67_phi = x_65; + loop { + let x_67 : i32 = x_67_phi; + let x_73 : i32 = x_8.x_GLF_uniform_int_values[3]; + if ((x_67 < x_73)) { + } else { + break; + } + let x_77 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_79 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_81 : f32 = m43[x_67][x_79]; + let x_83 : f32 = sums[x_77]; + sums[x_77] = (x_83 + x_81); + + continuing { + let x_68 : i32 = (x_67 + 1); + i = x_68; + x_67_phi = x_68; + } + } + let x_87 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_87 == 1)) { + a = 4; + let x_92 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_94 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_96 : f32 = m43[4][x_94]; + let x_98 : f32 = sums[x_92]; + sums[x_92] = (x_98 + x_96); + } + let x_102 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_104 : f32 = sums[x_102]; + let x_106 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_108 : f32 = sums[x_106]; + let x_111 : f32 = x_6.x_GLF_uniform_float_values[2]; + if (((x_104 + x_108) == x_111)) { + let x_117 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_120 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_123 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_126 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_117), f32(x_120), f32(x_123), f32(x_126)); + } else { + let x_130 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_131 : f32 = f32(x_130); + x_GLF_color = vec4(x_131, x_131, x_131, x_131); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..75c82eaf65 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.hlsl @@ -0,0 +1,109 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +struct tint_padded_array_element { + float el; +}; + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + tint_padded_array_element sums[3] = (tint_padded_array_element[3])0; + int i = 0; + int a = 0; + int x_67_phi = 0; + const float x_44 = asfloat(x_6[1].x); + const float3 x_48 = float3(0.0f, 0.0f, 0.0f); + m43 = float4x3(float3(x_44, 0.0f, 0.0f), float3(0.0f, x_44, 0.0f), float3(0.0f, 0.0f, x_44), float3(0.0f, 0.0f, 0.0f)); + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_51 = asint(x_8[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_53 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + set_float3(m43[x_51], x_53, x_55); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const float x_58 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_60 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_62 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const tint_padded_array_element tint_symbol_4[3] = {{x_58}, {x_60}, {x_62}}; + sums = tint_symbol_4; + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_65 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]); + i = x_65; + x_67_phi = x_65; + while (true) { + const int x_67 = x_67_phi; + const int x_73 = asint(x_8[3].x); + if ((x_67 < x_73)) { + } else { + break; + } + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_77 = asint(x_8[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const uint scalar_offset_8 = ((16u * uint(0))) / 4; + const int x_79 = asint(x_8[scalar_offset_8 / 4][scalar_offset_8 % 4]); + const float x_81 = m43[x_67][x_79]; + const float x_83 = sums[x_77].el; + sums[x_77].el = (x_83 + x_81); + { + const int x_68 = (x_67 + 1); + i = x_68; + x_67_phi = x_68; + } + } + const int x_87 = asint(x_8[1].x); + if ((x_87 == 1)) { + a = 4; + const int x_92 = asint(x_8[2].x); + const uint scalar_offset_9 = ((16u * uint(0))) / 4; + const int x_94 = asint(x_8[scalar_offset_9 / 4][scalar_offset_9 % 4]); + const float x_96 = m43[4][x_94]; + const float x_98 = sums[x_92].el; + sums[x_92].el = (x_98 + x_96); + } + const int x_102 = asint(x_8[1].x); + const float x_104 = sums[x_102].el; + const uint scalar_offset_10 = ((16u * uint(0))) / 4; + const int x_106 = asint(x_8[scalar_offset_10 / 4][scalar_offset_10 % 4]); + const float x_108 = sums[x_106].el; + const float x_111 = asfloat(x_6[2].x); + if (((x_104 + x_108) == x_111)) { + const uint scalar_offset_11 = ((16u * uint(0))) / 4; + const int x_117 = asint(x_8[scalar_offset_11 / 4][scalar_offset_11 % 4]); + const int x_120 = asint(x_8[1].x); + const int x_123 = asint(x_8[1].x); + const uint scalar_offset_12 = ((16u * uint(0))) / 4; + const int x_126 = asint(x_8[scalar_offset_12 / 4][scalar_offset_12 % 4]); + x_GLF_color = float4(float(x_117), float(x_120), float(x_123), float(x_126)); + } else { + const int x_130 = asint(x_8[1].x); + const float x_131 = float(x_130); + x_GLF_color = float4(x_131, x_131, x_131, x_131); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..3fc4376ec7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.msl @@ -0,0 +1,105 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_5) { + float4x3 m43 = float4x3(0.0f); + tint_array_wrapper sums = {}; + int i = 0; + int a = 0; + int x_67_phi = 0; + float const x_44 = x_6.x_GLF_uniform_float_values.arr[1].el; + float3 const x_48 = float3(0.0f, 0.0f, 0.0f); + m43 = float4x3(float3(x_44, 0.0f, 0.0f), float3(0.0f, x_44, 0.0f), float3(0.0f, 0.0f, x_44), float3(0.0f, 0.0f, 0.0f)); + int const x_51 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_53 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_55 = x_6.x_GLF_uniform_float_values.arr[0].el; + m43[x_51][x_53] = x_55; + float const x_58 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_60 = x_6.x_GLF_uniform_float_values.arr[0].el; + float const x_62 = x_6.x_GLF_uniform_float_values.arr[0].el; + tint_array_wrapper const tint_symbol_3 = {.arr={{.el=x_58}, {.el=x_60}, {.el=x_62}}}; + sums = tint_symbol_3; + int const x_65 = x_8.x_GLF_uniform_int_values.arr[0].el; + i = x_65; + x_67_phi = x_65; + while (true) { + int const x_67 = x_67_phi; + int const x_73 = x_8.x_GLF_uniform_int_values.arr[3].el; + if ((x_67 < x_73)) { + } else { + break; + } + int const x_77 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_79 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_81 = m43[x_67][x_79]; + float const x_83 = sums.arr[x_77].el; + sums.arr[x_77].el = (x_83 + x_81); + { + int const x_68 = (x_67 + 1); + i = x_68; + x_67_phi = x_68; + } + } + int const x_87 = x_8.x_GLF_uniform_int_values.arr[1].el; + if ((x_87 == 1)) { + a = 4; + int const x_92 = x_8.x_GLF_uniform_int_values.arr[2].el; + int const x_94 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_96 = m43[4][x_94]; + float const x_98 = sums.arr[x_92].el; + sums.arr[x_92].el = (x_98 + x_96); + } + int const x_102 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_104 = sums.arr[x_102].el; + int const x_106 = x_8.x_GLF_uniform_int_values.arr[0].el; + float const x_108 = sums.arr[x_106].el; + float const x_111 = x_6.x_GLF_uniform_float_values.arr[2].el; + if (((x_104 + x_108) == x_111)) { + int const x_117 = x_8.x_GLF_uniform_int_values.arr[0].el; + int const x_120 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_123 = x_8.x_GLF_uniform_int_values.arr[1].el; + int const x_126 = x_8.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_5) = float4(float(x_117), float(x_120), float(x_123), float(x_126)); + } else { + int const x_130 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_131 = float(x_130); + *(tint_symbol_5) = float4(x_131, x_131, x_131, x_131); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..c63ce320cc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.spvasm @@ -0,0 +1,228 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 152 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m43 "m43" + OpName %sums "sums" + OpName %i "i" + OpName %a "a" + OpName %x_67_phi "x_67_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %28 = OpConstantNull %mat4v3float +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 + %31 = OpConstantNull %_arr_float_uint_3 +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %43 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_float = OpTypePointer Function %float + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %140 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %m43 = OpVariable %_ptr_Function_mat4v3float Function %28 + %sums = OpVariable %_ptr_Function__arr_float_uint_3 Function %31 + %i = OpVariable %_ptr_Function_int Function %34 + %a = OpVariable %_ptr_Function_int Function %34 + %x_67_phi = OpVariable %_ptr_Function_int Function %34 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %41 = OpLoad %float %40 + %44 = OpCompositeConstruct %v3float %41 %float_0 %float_0 + %45 = OpCompositeConstruct %v3float %float_0 %41 %float_0 + %46 = OpCompositeConstruct %v3float %float_0 %float_0 %41 + %47 = OpCompositeConstruct %mat4v3float %44 %45 %46 %43 + OpStore %m43 %47 + %50 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %55 = OpLoad %float %54 + %57 = OpAccessChain %_ptr_Function_float %m43 %51 %53 + OpStore %57 %55 + %58 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %63 = OpLoad %float %62 + %64 = OpCompositeConstruct %_arr_float_uint_3 %59 %61 %63 + OpStore %sums %64 + %65 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %66 = OpLoad %int %65 + OpStore %i %66 + OpStore %x_67_phi %66 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %x_67_phi + %73 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3 + %74 = OpLoad %int %73 + %75 = OpSLessThan %bool %71 %74 + OpSelectionMerge %77 None + OpBranchConditional %75 %78 %79 + %78 = OpLabel + OpBranch %77 + %79 = OpLabel + OpBranch %68 + %77 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Function_float %m43 %71 %83 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Function_float %sums %81 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Function_float %sums %81 + %89 = OpFAdd %float %87 %85 + OpStore %88 %89 + OpBranch %69 + %69 = OpLabel + %90 = OpIAdd %int %71 %int_1 + OpStore %i %90 + OpStore %x_67_phi %90 + OpBranch %67 + %68 = OpLabel + %91 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpIEqual %bool %92 %int_1 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %94 + %95 = OpLabel + OpStore %a %int_4 + %98 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %101 = OpLoad %int %100 + %102 = OpAccessChain %_ptr_Function_float %m43 %int_4 %101 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Function_float %sums %99 + %105 = OpLoad %float %104 + %106 = OpAccessChain %_ptr_Function_float %sums %99 + %107 = OpFAdd %float %105 %103 + OpStore %106 %107 + OpBranch %94 + %94 = OpLabel + %108 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Function_float %sums %109 + %111 = OpLoad %float %110 + %112 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Function_float %sums %113 + %115 = OpLoad %float %114 + %116 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %117 = OpLoad %float %116 + %118 = OpFAdd %float %111 %115 + %119 = OpFOrdEqual %bool %118 %117 + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %124 = OpLoad %int %123 + %125 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %126 = OpLoad %int %125 + %127 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %130 = OpLoad %int %129 + %131 = OpConvertSToF %float %124 + %132 = OpConvertSToF %float %126 + %133 = OpConvertSToF %float %128 + %134 = OpConvertSToF %float %130 + %135 = OpCompositeConstruct %v4float %131 %132 %133 %134 + OpStore %x_GLF_color %135 + OpBranch %120 + %122 = OpLabel + %136 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %137 = OpLoad %int %136 + %138 = OpConvertSToF %float %137 + %139 = OpCompositeConstruct %v4float %138 %138 %138 %138 + OpStore %x_GLF_color %139 + OpBranch %120 + %120 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %140 +%tint_symbol = OpFunctionParameter %main_out + %144 = OpLabel + %145 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %145 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %147 = OpLabel + %148 = OpFunctionCall %void %main_1 + %150 = OpLoad %v4float %x_GLF_color + %151 = OpCompositeConstruct %main_out %150 + %149 = OpFunctionCall %void %tint_symbol_2 %151 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..7c1756e1a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.wgsl @@ -0,0 +1,97 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m43 : mat4x3; + var sums : Arr; + var i : i32; + var a : i32; + var x_67_phi : i32; + let x_44 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_48 : vec3 = vec3(0.0, 0.0, 0.0); + m43 = mat4x3(vec3(x_44, 0.0, 0.0), vec3(0.0, x_44, 0.0), vec3(0.0, 0.0, x_44), vec3(0.0, 0.0, 0.0)); + let x_51 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_53 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_55 : f32 = x_6.x_GLF_uniform_float_values[0]; + m43[x_51][x_53] = x_55; + let x_58 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_60 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_62 : f32 = x_6.x_GLF_uniform_float_values[0]; + sums = Arr(x_58, x_60, x_62); + let x_65 : i32 = x_8.x_GLF_uniform_int_values[0]; + i = x_65; + x_67_phi = x_65; + loop { + let x_67 : i32 = x_67_phi; + let x_73 : i32 = x_8.x_GLF_uniform_int_values[3]; + if ((x_67 < x_73)) { + } else { + break; + } + let x_77 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_79 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_81 : f32 = m43[x_67][x_79]; + let x_83 : f32 = sums[x_77]; + sums[x_77] = (x_83 + x_81); + + continuing { + let x_68 : i32 = (x_67 + 1); + i = x_68; + x_67_phi = x_68; + } + } + let x_87 : i32 = x_8.x_GLF_uniform_int_values[1]; + if ((x_87 == 1)) { + a = 4; + let x_92 : i32 = x_8.x_GLF_uniform_int_values[2]; + let x_94 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_96 : f32 = m43[4][x_94]; + let x_98 : f32 = sums[x_92]; + sums[x_92] = (x_98 + x_96); + } + let x_102 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_104 : f32 = sums[x_102]; + let x_106 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_108 : f32 = sums[x_106]; + let x_111 : f32 = x_6.x_GLF_uniform_float_values[2]; + if (((x_104 + x_108) == x_111)) { + let x_117 : i32 = x_8.x_GLF_uniform_int_values[0]; + let x_120 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_123 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_126 : i32 = x_8.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_117), f32(x_120), f32(x_123), f32(x_126)); + } else { + let x_130 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_131 : f32 = f32(x_130); + x_GLF_color = vec4(x_131, x_131, x_131, x_131); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm new file mode 100644 index 0000000000..a44e425957 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm @@ -0,0 +1,218 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %m0 "m0" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %c "c" + OpName %m1 "m1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %v4bool = OpTypeVector %bool 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %38 = OpLabel + %m0 = OpVariable %_ptr_Function_mat4v4float Function + %c = OpVariable %_ptr_Function_int Function + %m1 = OpVariable %_ptr_Function_mat4v4float Function + %39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %40 = OpLoad %int %39 + %41 = OpConvertSToF %float %40 + %42 = OpCompositeConstruct %v4float %41 %float_0 %float_0 %float_0 + %43 = OpCompositeConstruct %v4float %float_0 %41 %float_0 %float_0 + %44 = OpCompositeConstruct %v4float %float_0 %float_0 %41 %float_0 + %45 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %41 + %46 = OpCompositeConstruct %mat4v4float %42 %43 %44 %45 + OpStore %m0 %46 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %48 = OpLoad %int %47 + OpStore %c %48 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %int %c + %54 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpSLessThan %bool %53 %55 + OpBranchConditional %56 %57 %50 + %57 = OpLabel + %58 = OpLoad %mat4v4float %m0 + OpStore %m1 %58 + %59 = OpLoad %int %c + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %61 = OpLoad %int %60 + %62 = OpSMod %int %59 %61 + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %66 = OpLoad %float %65 + %67 = OpAccessChain %_ptr_Function_float %m1 %62 %64 + OpStore %67 %66 + %68 = OpLoad %int %c + %69 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %70 = OpLoad %int %69 + %71 = OpSMod %int %68 %70 + %72 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Function_float %m0 %71 %73 + OpStore %76 %75 + OpBranch %51 + %51 = OpLabel + %77 = OpLoad %int %c + %78 = OpIAdd %int %77 %int_1 + OpStore %c %78 + OpBranch %49 + %50 = OpLabel + %79 = OpLoad %mat4v4float %m0 + %80 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpConvertSToF %float %81 + %83 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %84 = OpLoad %int %83 + %85 = OpConvertSToF %float %84 + %86 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %87 = OpLoad %int %86 + %88 = OpConvertSToF %float %87 + %89 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpConvertSToF %float %90 + %92 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %93 = OpLoad %int %92 + %94 = OpConvertSToF %float %93 + %95 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %96 = OpLoad %int %95 + %97 = OpConvertSToF %float %96 + %98 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %99 = OpLoad %int %98 + %100 = OpConvertSToF %float %99 + %101 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %102 = OpLoad %int %101 + %103 = OpConvertSToF %float %102 + %104 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %105 = OpLoad %int %104 + %106 = OpConvertSToF %float %105 + %107 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %108 = OpLoad %int %107 + %109 = OpConvertSToF %float %108 + %110 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %111 = OpLoad %int %110 + %112 = OpConvertSToF %float %111 + %113 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %114 = OpLoad %int %113 + %115 = OpConvertSToF %float %114 + %116 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %117 = OpLoad %int %116 + %118 = OpConvertSToF %float %117 + %119 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %120 = OpLoad %int %119 + %121 = OpConvertSToF %float %120 + %122 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %123 = OpLoad %int %122 + %124 = OpConvertSToF %float %123 + %125 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %126 = OpLoad %int %125 + %127 = OpConvertSToF %float %126 + %128 = OpCompositeConstruct %v4float %82 %85 %88 %91 + %129 = OpCompositeConstruct %v4float %94 %97 %100 %103 + %130 = OpCompositeConstruct %v4float %106 %109 %112 %115 + %131 = OpCompositeConstruct %v4float %118 %121 %124 %127 + %132 = OpCompositeConstruct %mat4v4float %128 %129 %130 %131 + %133 = OpCompositeExtract %v4float %79 0 + %134 = OpCompositeExtract %v4float %132 0 + %135 = OpFOrdEqual %v4bool %133 %134 + %136 = OpAll %bool %135 + %137 = OpCompositeExtract %v4float %79 1 + %138 = OpCompositeExtract %v4float %132 1 + %139 = OpFOrdEqual %v4bool %137 %138 + %140 = OpAll %bool %139 + %141 = OpLogicalAnd %bool %136 %140 + %142 = OpCompositeExtract %v4float %79 2 + %143 = OpCompositeExtract %v4float %132 2 + %144 = OpFOrdEqual %v4bool %142 %143 + %145 = OpAll %bool %144 + %146 = OpLogicalAnd %bool %141 %145 + %147 = OpCompositeExtract %v4float %79 3 + %148 = OpCompositeExtract %v4float %132 3 + %149 = OpFOrdEqual %v4bool %147 %148 + %150 = OpAll %bool %149 + %151 = OpLogicalAnd %bool %146 %150 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %154 + %153 = OpLabel + %155 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %156 = OpLoad %int %155 + %157 = OpConvertSToF %float %156 + %158 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %159 = OpLoad %int %158 + %160 = OpConvertSToF %float %159 + %161 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %162 = OpLoad %int %161 + %163 = OpConvertSToF %float %162 + %164 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %165 = OpLoad %int %164 + %166 = OpConvertSToF %float %165 + %167 = OpCompositeConstruct %v4float %157 %160 %163 %166 + OpStore %_GLF_color %167 + OpBranch %152 + %154 = OpLabel + %168 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %169 = OpLoad %int %168 + %170 = OpConvertSToF %float %169 + %171 = OpCompositeConstruct %v4float %170 %170 %170 %170 + OpStore %_GLF_color %171 + OpBranch %152 + %152 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..258443f925 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,103 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x4 m0 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int c = 0; + float4x4 m1 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + const int x_40 = asint(x_6[1].x); + const float x_41 = float(x_40); + m0 = float4x4(float4(x_41, 0.0f, 0.0f, 0.0f), float4(0.0f, x_41, 0.0f, 0.0f), float4(0.0f, 0.0f, x_41, 0.0f), float4(0.0f, 0.0f, 0.0f, x_41)); + const int x_48 = asint(x_6[2].x); + c = x_48; + while (true) { + const int x_53 = c; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_53 < x_55)) { + } else { + break; + } + m1 = m0; + const int x_59 = c; + const int x_61 = asint(x_6[3].x); + const int x_64 = asint(x_6[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_66 = asfloat(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + set_float4(m1[(x_59 % x_61)], x_64, x_66); + const int x_68 = c; + const int x_70 = asint(x_6[3].x); + const int x_73 = asint(x_6[2].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_75 = asfloat(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + set_float4(m0[(x_68 % x_70)], x_73, x_75); + { + c = (c + 1); + } + } + const float4x4 x_79 = m0; + const int x_81 = asint(x_6[1].x); + const int x_84 = asint(x_6[2].x); + const int x_87 = asint(x_6[1].x); + const int x_90 = asint(x_6[1].x); + const int x_93 = asint(x_6[1].x); + const int x_96 = asint(x_6[2].x); + const int x_99 = asint(x_6[1].x); + const int x_102 = asint(x_6[1].x); + const int x_105 = asint(x_6[1].x); + const int x_108 = asint(x_6[2].x); + const int x_111 = asint(x_6[1].x); + const int x_114 = asint(x_6[1].x); + const int x_117 = asint(x_6[1].x); + const int x_120 = asint(x_6[2].x); + const int x_123 = asint(x_6[1].x); + const int x_126 = asint(x_6[1].x); + const float4x4 x_132 = float4x4(float4(float(x_81), float(x_84), float(x_87), float(x_90)), float4(float(x_93), float(x_96), float(x_99), float(x_102)), float4(float(x_105), float(x_108), float(x_111), float(x_114)), float4(float(x_117), float(x_120), float(x_123), float(x_126))); + bool tint_tmp_2 = all((x_79[0u] == x_132[0u])); + if (tint_tmp_2) { + tint_tmp_2 = all((x_79[1u] == x_132[1u])); + } + bool tint_tmp_1 = (tint_tmp_2); + if (tint_tmp_1) { + tint_tmp_1 = all((x_79[2u] == x_132[2u])); + } + bool tint_tmp = (tint_tmp_1); + if (tint_tmp) { + tint_tmp = all((x_79[3u] == x_132[3u])); + } + if ((tint_tmp)) { + const int x_156 = asint(x_6[2].x); + const int x_159 = asint(x_6[1].x); + const int x_162 = asint(x_6[1].x); + const int x_165 = asint(x_6[2].x); + x_GLF_color = float4(float(x_156), float(x_159), float(x_162), float(x_165)); + } else { + const int x_169 = asint(x_6[1].x); + const float x_170 = float(x_169); + x_GLF_color = float4(x_170, x_170, x_170, x_170); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..2e9eaea41a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,103 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_10, thread float4* const tint_symbol_4) { + float4x4 m0 = float4x4(0.0f); + int c = 0; + float4x4 m1 = float4x4(0.0f); + int const x_40 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_41 = float(x_40); + m0 = float4x4(float4(x_41, 0.0f, 0.0f, 0.0f), float4(0.0f, x_41, 0.0f, 0.0f), float4(0.0f, 0.0f, x_41, 0.0f), float4(0.0f, 0.0f, 0.0f, x_41)); + int const x_48 = x_6.x_GLF_uniform_int_values.arr[2].el; + c = x_48; + while (true) { + int const x_53 = c; + int const x_55 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_53 < x_55)) { + } else { + break; + } + float4x4 const x_58 = m0; + m1 = x_58; + int const x_59 = c; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_66 = x_10.x_GLF_uniform_float_values.arr[0].el; + m1[(x_59 % x_61)][x_64] = x_66; + int const x_68 = c; + int const x_70 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_73 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_75 = x_10.x_GLF_uniform_float_values.arr[0].el; + m0[(x_68 % x_70)][x_73] = x_75; + { + int const x_77 = c; + c = (x_77 + 1); + } + } + float4x4 const x_79 = m0; + int const x_81 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_84 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_87 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_90 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_93 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_96 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_99 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_102 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_105 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_108 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_111 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_114 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_117 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_120 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_123 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_126 = x_6.x_GLF_uniform_int_values.arr[1].el; + float4x4 const x_132 = float4x4(float4(float(x_81), float(x_84), float(x_87), float(x_90)), float4(float(x_93), float(x_96), float(x_99), float(x_102)), float4(float(x_105), float(x_108), float(x_111), float(x_114)), float4(float(x_117), float(x_120), float(x_123), float(x_126))); + if ((((all((x_79[0u] == x_132[0u])) && all((x_79[1u] == x_132[1u]))) && all((x_79[2u] == x_132[2u]))) && all((x_79[3u] == x_132[3u])))) { + int const x_156 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_159 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_162 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_165 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_156), float(x_159), float(x_162), float(x_165)); + } else { + int const x_169 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_170 = float(x_169); + *(tint_symbol_4) = float4(x_170, x_170, x_170, x_170); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..1bf7a3d24c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,274 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 198 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m0 "m0" + OpName %c "c" + OpName %m1 "m1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %27 = OpConstantNull %mat4v4float +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %v4bool = OpTypeVector %bool 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %main_out = OpTypeStruct %v4float + %186 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %m0 = OpVariable %_ptr_Function_mat4v4float Function %27 + %c = OpVariable %_ptr_Function_int Function %30 + %m1 = OpVariable %_ptr_Function_mat4v4float Function %27 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %36 = OpLoad %int %35 + %37 = OpConvertSToF %float %36 + %39 = OpCompositeConstruct %v4float %37 %float_0 %float_0 %float_0 + %40 = OpCompositeConstruct %v4float %float_0 %37 %float_0 %float_0 + %41 = OpCompositeConstruct %v4float %float_0 %float_0 %37 %float_0 + %42 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %37 + %43 = OpCompositeConstruct %mat4v4float %39 %40 %41 %42 + OpStore %m0 %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %46 = OpLoad %int %45 + OpStore %c %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %c + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpSLessThan %bool %51 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %58 %59 + %58 = OpLabel + OpBranch %57 + %59 = OpLabel + OpBranch %48 + %57 = OpLabel + %60 = OpLoad %mat4v4float %m0 + OpStore %m1 %60 + %61 = OpLoad %int %c + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %66 = OpLoad %int %65 + %68 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %69 = OpLoad %float %68 + %70 = OpSMod %int %61 %64 + %72 = OpAccessChain %_ptr_Function_float %m1 %70 %66 + OpStore %72 %69 + %73 = OpLoad %int %c + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %79 = OpLoad %float %78 + %80 = OpSMod %int %73 %75 + %81 = OpAccessChain %_ptr_Function_float %m0 %80 %77 + OpStore %81 %79 + OpBranch %49 + %49 = OpLabel + %82 = OpLoad %int %c + %83 = OpIAdd %int %82 %int_1 + OpStore %c %83 + OpBranch %47 + %48 = OpLabel + %84 = OpLoad %mat4v4float %m0 + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %102 = OpLoad %int %101 + %103 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %104 = OpLoad %int %103 + %105 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %106 = OpLoad %int %105 + %107 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %108 = OpLoad %int %107 + %109 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %112 = OpLoad %int %111 + %113 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %114 = OpLoad %int %113 + %115 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %86 + %118 = OpConvertSToF %float %88 + %119 = OpConvertSToF %float %90 + %120 = OpConvertSToF %float %92 + %121 = OpCompositeConstruct %v4float %117 %118 %119 %120 + %122 = OpConvertSToF %float %94 + %123 = OpConvertSToF %float %96 + %124 = OpConvertSToF %float %98 + %125 = OpConvertSToF %float %100 + %126 = OpCompositeConstruct %v4float %122 %123 %124 %125 + %127 = OpConvertSToF %float %102 + %128 = OpConvertSToF %float %104 + %129 = OpConvertSToF %float %106 + %130 = OpConvertSToF %float %108 + %131 = OpCompositeConstruct %v4float %127 %128 %129 %130 + %132 = OpConvertSToF %float %110 + %133 = OpConvertSToF %float %112 + %134 = OpConvertSToF %float %114 + %135 = OpConvertSToF %float %116 + %136 = OpCompositeConstruct %v4float %132 %133 %134 %135 + %137 = OpCompositeConstruct %mat4v4float %121 %126 %131 %136 + %139 = OpCompositeExtract %v4float %84 0 + %140 = OpCompositeExtract %v4float %137 0 + %141 = OpFOrdEqual %v4bool %139 %140 + %138 = OpAll %bool %141 + OpSelectionMerge %143 None + OpBranchConditional %138 %144 %143 + %144 = OpLabel + %146 = OpCompositeExtract %v4float %84 1 + %147 = OpCompositeExtract %v4float %137 1 + %148 = OpFOrdEqual %v4bool %146 %147 + %145 = OpAll %bool %148 + OpBranch %143 + %143 = OpLabel + %149 = OpPhi %bool %138 %48 %145 %144 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %150 + %151 = OpLabel + %154 = OpCompositeExtract %v4float %84 2 + %155 = OpCompositeExtract %v4float %137 2 + %156 = OpFOrdEqual %v4bool %154 %155 + %152 = OpAll %bool %156 + OpBranch %150 + %150 = OpLabel + %157 = OpPhi %bool %149 %143 %152 %151 + OpSelectionMerge %158 None + OpBranchConditional %157 %159 %158 + %159 = OpLabel + %162 = OpCompositeExtract %v4float %84 3 + %163 = OpCompositeExtract %v4float %137 3 + %164 = OpFOrdEqual %v4bool %162 %163 + %160 = OpAll %bool %164 + OpBranch %158 + %158 = OpLabel + %165 = OpPhi %bool %157 %150 %160 %159 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %168 + %167 = OpLabel + %169 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %170 = OpLoad %int %169 + %171 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %172 = OpLoad %int %171 + %173 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %174 = OpLoad %int %173 + %175 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %176 = OpLoad %int %175 + %177 = OpConvertSToF %float %170 + %178 = OpConvertSToF %float %172 + %179 = OpConvertSToF %float %174 + %180 = OpConvertSToF %float %176 + %181 = OpCompositeConstruct %v4float %177 %178 %179 %180 + OpStore %x_GLF_color %181 + OpBranch %166 + %168 = OpLabel + %182 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %183 = OpLoad %int %182 + %184 = OpConvertSToF %float %183 + %185 = OpCompositeConstruct %v4float %184 %184 %184 %184 + OpStore %x_GLF_color %185 + OpBranch %166 + %166 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %186 +%tint_symbol = OpFunctionParameter %main_out + %190 = OpLabel + %191 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %191 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %193 = OpLabel + %194 = OpFunctionCall %void %main_1 + %196 = OpLoad %v4float %x_GLF_color + %197 = OpCompositeConstruct %main_out %196 + %195 = OpFunctionCall %void %tint_symbol_2 %197 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..cd041985b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,96 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m0 : mat4x4; + var c : i32; + var m1 : mat4x4; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_41 : f32 = f32(x_40); + m0 = mat4x4(vec4(x_41, 0.0, 0.0, 0.0), vec4(0.0, x_41, 0.0, 0.0), vec4(0.0, 0.0, x_41, 0.0), vec4(0.0, 0.0, 0.0, x_41)); + let x_48 : i32 = x_6.x_GLF_uniform_int_values[2]; + c = x_48; + loop { + let x_53 : i32 = c; + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_53 < x_55)) { + } else { + break; + } + let x_58 : mat4x4 = m0; + m1 = x_58; + let x_59 : i32 = c; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_66 : f32 = x_10.x_GLF_uniform_float_values[0]; + m1[(x_59 % x_61)][x_64] = x_66; + let x_68 : i32 = c; + let x_70 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_73 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_75 : f32 = x_10.x_GLF_uniform_float_values[0]; + m0[(x_68 % x_70)][x_73] = x_75; + + continuing { + let x_77 : i32 = c; + c = (x_77 + 1); + } + } + let x_79 : mat4x4 = m0; + let x_81 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_87 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_90 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_93 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_96 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_99 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_102 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_105 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_108 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_111 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_114 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_117 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_120 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_123 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_126 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_132 : mat4x4 = mat4x4(vec4(f32(x_81), f32(x_84), f32(x_87), f32(x_90)), vec4(f32(x_93), f32(x_96), f32(x_99), f32(x_102)), vec4(f32(x_105), f32(x_108), f32(x_111), f32(x_114)), vec4(f32(x_117), f32(x_120), f32(x_123), f32(x_126))); + if ((((all((x_79[0u] == x_132[0u])) && all((x_79[1u] == x_132[1u]))) && all((x_79[2u] == x_132[2u]))) && all((x_79[3u] == x_132[3u])))) { + let x_156 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_159 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_162 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_165 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_156), f32(x_159), f32(x_162), f32(x_165)); + } else { + let x_169 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_170 : f32 = f32(x_169); + x_GLF_color = vec4(x_170, x_170, x_170, x_170); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl new file mode 100644 index 0000000000..cd041985b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl @@ -0,0 +1,96 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m0 : mat4x4; + var c : i32; + var m1 : mat4x4; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_41 : f32 = f32(x_40); + m0 = mat4x4(vec4(x_41, 0.0, 0.0, 0.0), vec4(0.0, x_41, 0.0, 0.0), vec4(0.0, 0.0, x_41, 0.0), vec4(0.0, 0.0, 0.0, x_41)); + let x_48 : i32 = x_6.x_GLF_uniform_int_values[2]; + c = x_48; + loop { + let x_53 : i32 = c; + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_53 < x_55)) { + } else { + break; + } + let x_58 : mat4x4 = m0; + m1 = x_58; + let x_59 : i32 = c; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_66 : f32 = x_10.x_GLF_uniform_float_values[0]; + m1[(x_59 % x_61)][x_64] = x_66; + let x_68 : i32 = c; + let x_70 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_73 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_75 : f32 = x_10.x_GLF_uniform_float_values[0]; + m0[(x_68 % x_70)][x_73] = x_75; + + continuing { + let x_77 : i32 = c; + c = (x_77 + 1); + } + } + let x_79 : mat4x4 = m0; + let x_81 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_87 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_90 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_93 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_96 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_99 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_102 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_105 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_108 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_111 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_114 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_117 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_120 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_123 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_126 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_132 : mat4x4 = mat4x4(vec4(f32(x_81), f32(x_84), f32(x_87), f32(x_90)), vec4(f32(x_93), f32(x_96), f32(x_99), f32(x_102)), vec4(f32(x_105), f32(x_108), f32(x_111), f32(x_114)), vec4(f32(x_117), f32(x_120), f32(x_123), f32(x_126))); + if ((((all((x_79[0u] == x_132[0u])) && all((x_79[1u] == x_132[1u]))) && all((x_79[2u] == x_132[2u]))) && all((x_79[3u] == x_132[3u])))) { + let x_156 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_159 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_162 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_165 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_156), f32(x_159), f32(x_162), f32(x_165)); + } else { + let x_169 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_170 : f32 = f32(x_169); + x_GLF_color = vec4(x_170, x_170, x_170, x_170); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..258443f925 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,103 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[4]; +}; +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x4 m0 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int c = 0; + float4x4 m1 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + const int x_40 = asint(x_6[1].x); + const float x_41 = float(x_40); + m0 = float4x4(float4(x_41, 0.0f, 0.0f, 0.0f), float4(0.0f, x_41, 0.0f, 0.0f), float4(0.0f, 0.0f, x_41, 0.0f), float4(0.0f, 0.0f, 0.0f, x_41)); + const int x_48 = asint(x_6[2].x); + c = x_48; + while (true) { + const int x_53 = c; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_53 < x_55)) { + } else { + break; + } + m1 = m0; + const int x_59 = c; + const int x_61 = asint(x_6[3].x); + const int x_64 = asint(x_6[2].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_66 = asfloat(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]); + set_float4(m1[(x_59 % x_61)], x_64, x_66); + const int x_68 = c; + const int x_70 = asint(x_6[3].x); + const int x_73 = asint(x_6[2].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_75 = asfloat(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + set_float4(m0[(x_68 % x_70)], x_73, x_75); + { + c = (c + 1); + } + } + const float4x4 x_79 = m0; + const int x_81 = asint(x_6[1].x); + const int x_84 = asint(x_6[2].x); + const int x_87 = asint(x_6[1].x); + const int x_90 = asint(x_6[1].x); + const int x_93 = asint(x_6[1].x); + const int x_96 = asint(x_6[2].x); + const int x_99 = asint(x_6[1].x); + const int x_102 = asint(x_6[1].x); + const int x_105 = asint(x_6[1].x); + const int x_108 = asint(x_6[2].x); + const int x_111 = asint(x_6[1].x); + const int x_114 = asint(x_6[1].x); + const int x_117 = asint(x_6[1].x); + const int x_120 = asint(x_6[2].x); + const int x_123 = asint(x_6[1].x); + const int x_126 = asint(x_6[1].x); + const float4x4 x_132 = float4x4(float4(float(x_81), float(x_84), float(x_87), float(x_90)), float4(float(x_93), float(x_96), float(x_99), float(x_102)), float4(float(x_105), float(x_108), float(x_111), float(x_114)), float4(float(x_117), float(x_120), float(x_123), float(x_126))); + bool tint_tmp_2 = all((x_79[0u] == x_132[0u])); + if (tint_tmp_2) { + tint_tmp_2 = all((x_79[1u] == x_132[1u])); + } + bool tint_tmp_1 = (tint_tmp_2); + if (tint_tmp_1) { + tint_tmp_1 = all((x_79[2u] == x_132[2u])); + } + bool tint_tmp = (tint_tmp_1); + if (tint_tmp) { + tint_tmp = all((x_79[3u] == x_132[3u])); + } + if ((tint_tmp)) { + const int x_156 = asint(x_6[2].x); + const int x_159 = asint(x_6[1].x); + const int x_162 = asint(x_6[1].x); + const int x_165 = asint(x_6[2].x); + x_GLF_color = float4(float(x_156), float(x_159), float(x_162), float(x_165)); + } else { + const int x_169 = asint(x_6[1].x); + const float x_170 = float(x_169); + x_GLF_color = float4(x_170, x_170, x_170, x_170); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..2e9eaea41a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,103 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_10, thread float4* const tint_symbol_4) { + float4x4 m0 = float4x4(0.0f); + int c = 0; + float4x4 m1 = float4x4(0.0f); + int const x_40 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_41 = float(x_40); + m0 = float4x4(float4(x_41, 0.0f, 0.0f, 0.0f), float4(0.0f, x_41, 0.0f, 0.0f), float4(0.0f, 0.0f, x_41, 0.0f), float4(0.0f, 0.0f, 0.0f, x_41)); + int const x_48 = x_6.x_GLF_uniform_int_values.arr[2].el; + c = x_48; + while (true) { + int const x_53 = c; + int const x_55 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_53 < x_55)) { + } else { + break; + } + float4x4 const x_58 = m0; + m1 = x_58; + int const x_59 = c; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_66 = x_10.x_GLF_uniform_float_values.arr[0].el; + m1[(x_59 % x_61)][x_64] = x_66; + int const x_68 = c; + int const x_70 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_73 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_75 = x_10.x_GLF_uniform_float_values.arr[0].el; + m0[(x_68 % x_70)][x_73] = x_75; + { + int const x_77 = c; + c = (x_77 + 1); + } + } + float4x4 const x_79 = m0; + int const x_81 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_84 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_87 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_90 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_93 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_96 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_99 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_102 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_105 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_108 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_111 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_114 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_117 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_120 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_123 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_126 = x_6.x_GLF_uniform_int_values.arr[1].el; + float4x4 const x_132 = float4x4(float4(float(x_81), float(x_84), float(x_87), float(x_90)), float4(float(x_93), float(x_96), float(x_99), float(x_102)), float4(float(x_105), float(x_108), float(x_111), float(x_114)), float4(float(x_117), float(x_120), float(x_123), float(x_126))); + if ((((all((x_79[0u] == x_132[0u])) && all((x_79[1u] == x_132[1u]))) && all((x_79[2u] == x_132[2u]))) && all((x_79[3u] == x_132[3u])))) { + int const x_156 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_159 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_162 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_165 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_156), float(x_159), float(x_162), float(x_165)); + } else { + int const x_169 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_170 = float(x_169); + *(tint_symbol_4) = float4(x_170, x_170, x_170, x_170); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..1bf7a3d24c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,274 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 198 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_float_values" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m0 "m0" + OpName %c "c" + OpName %m1 "m1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf1 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf0 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %27 = OpConstantNull %mat4v4float +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %v4bool = OpTypeVector %bool 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %main_out = OpTypeStruct %v4float + %186 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %m0 = OpVariable %_ptr_Function_mat4v4float Function %27 + %c = OpVariable %_ptr_Function_int Function %30 + %m1 = OpVariable %_ptr_Function_mat4v4float Function %27 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %36 = OpLoad %int %35 + %37 = OpConvertSToF %float %36 + %39 = OpCompositeConstruct %v4float %37 %float_0 %float_0 %float_0 + %40 = OpCompositeConstruct %v4float %float_0 %37 %float_0 %float_0 + %41 = OpCompositeConstruct %v4float %float_0 %float_0 %37 %float_0 + %42 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %37 + %43 = OpCompositeConstruct %mat4v4float %39 %40 %41 %42 + OpStore %m0 %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %46 = OpLoad %int %45 + OpStore %c %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %c + %53 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %54 = OpLoad %int %53 + %55 = OpSLessThan %bool %51 %54 + OpSelectionMerge %57 None + OpBranchConditional %55 %58 %59 + %58 = OpLabel + OpBranch %57 + %59 = OpLabel + OpBranch %48 + %57 = OpLabel + %60 = OpLoad %mat4v4float %m0 + OpStore %m1 %60 + %61 = OpLoad %int %c + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %66 = OpLoad %int %65 + %68 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %69 = OpLoad %float %68 + %70 = OpSMod %int %61 %64 + %72 = OpAccessChain %_ptr_Function_float %m1 %70 %66 + OpStore %72 %69 + %73 = OpLoad %int %c + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %75 = OpLoad %int %74 + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %int_0 + %79 = OpLoad %float %78 + %80 = OpSMod %int %73 %75 + %81 = OpAccessChain %_ptr_Function_float %m0 %80 %77 + OpStore %81 %79 + OpBranch %49 + %49 = OpLabel + %82 = OpLoad %int %c + %83 = OpIAdd %int %82 %int_1 + OpStore %c %83 + OpBranch %47 + %48 = OpLabel + %84 = OpLoad %mat4v4float %m0 + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %90 = OpLoad %int %89 + %91 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %92 = OpLoad %int %91 + %93 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %98 = OpLoad %int %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %102 = OpLoad %int %101 + %103 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %104 = OpLoad %int %103 + %105 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %106 = OpLoad %int %105 + %107 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %108 = OpLoad %int %107 + %109 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %112 = OpLoad %int %111 + %113 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %114 = OpLoad %int %113 + %115 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %86 + %118 = OpConvertSToF %float %88 + %119 = OpConvertSToF %float %90 + %120 = OpConvertSToF %float %92 + %121 = OpCompositeConstruct %v4float %117 %118 %119 %120 + %122 = OpConvertSToF %float %94 + %123 = OpConvertSToF %float %96 + %124 = OpConvertSToF %float %98 + %125 = OpConvertSToF %float %100 + %126 = OpCompositeConstruct %v4float %122 %123 %124 %125 + %127 = OpConvertSToF %float %102 + %128 = OpConvertSToF %float %104 + %129 = OpConvertSToF %float %106 + %130 = OpConvertSToF %float %108 + %131 = OpCompositeConstruct %v4float %127 %128 %129 %130 + %132 = OpConvertSToF %float %110 + %133 = OpConvertSToF %float %112 + %134 = OpConvertSToF %float %114 + %135 = OpConvertSToF %float %116 + %136 = OpCompositeConstruct %v4float %132 %133 %134 %135 + %137 = OpCompositeConstruct %mat4v4float %121 %126 %131 %136 + %139 = OpCompositeExtract %v4float %84 0 + %140 = OpCompositeExtract %v4float %137 0 + %141 = OpFOrdEqual %v4bool %139 %140 + %138 = OpAll %bool %141 + OpSelectionMerge %143 None + OpBranchConditional %138 %144 %143 + %144 = OpLabel + %146 = OpCompositeExtract %v4float %84 1 + %147 = OpCompositeExtract %v4float %137 1 + %148 = OpFOrdEqual %v4bool %146 %147 + %145 = OpAll %bool %148 + OpBranch %143 + %143 = OpLabel + %149 = OpPhi %bool %138 %48 %145 %144 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %150 + %151 = OpLabel + %154 = OpCompositeExtract %v4float %84 2 + %155 = OpCompositeExtract %v4float %137 2 + %156 = OpFOrdEqual %v4bool %154 %155 + %152 = OpAll %bool %156 + OpBranch %150 + %150 = OpLabel + %157 = OpPhi %bool %149 %143 %152 %151 + OpSelectionMerge %158 None + OpBranchConditional %157 %159 %158 + %159 = OpLabel + %162 = OpCompositeExtract %v4float %84 3 + %163 = OpCompositeExtract %v4float %137 3 + %164 = OpFOrdEqual %v4bool %162 %163 + %160 = OpAll %bool %164 + OpBranch %158 + %158 = OpLabel + %165 = OpPhi %bool %157 %150 %160 %159 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %168 + %167 = OpLabel + %169 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %170 = OpLoad %int %169 + %171 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %172 = OpLoad %int %171 + %173 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %174 = OpLoad %int %173 + %175 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %176 = OpLoad %int %175 + %177 = OpConvertSToF %float %170 + %178 = OpConvertSToF %float %172 + %179 = OpConvertSToF %float %174 + %180 = OpConvertSToF %float %176 + %181 = OpCompositeConstruct %v4float %177 %178 %179 %180 + OpStore %x_GLF_color %181 + OpBranch %166 + %168 = OpLabel + %182 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %183 = OpLoad %int %182 + %184 = OpConvertSToF %float %183 + %185 = OpCompositeConstruct %v4float %184 %184 %184 %184 + OpStore %x_GLF_color %185 + OpBranch %166 + %166 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %186 +%tint_symbol = OpFunctionParameter %main_out + %190 = OpLabel + %191 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %191 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %193 = OpLabel + %194 = OpFunctionCall %void %main_1 + %196 = OpLoad %v4float %x_GLF_color + %197 = OpCompositeConstruct %main_out %196 + %195 = OpFunctionCall %void %tint_symbol_2 %197 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..cd041985b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,96 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m0 : mat4x4; + var c : i32; + var m1 : mat4x4; + let x_40 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_41 : f32 = f32(x_40); + m0 = mat4x4(vec4(x_41, 0.0, 0.0, 0.0), vec4(0.0, x_41, 0.0, 0.0), vec4(0.0, 0.0, x_41, 0.0), vec4(0.0, 0.0, 0.0, x_41)); + let x_48 : i32 = x_6.x_GLF_uniform_int_values[2]; + c = x_48; + loop { + let x_53 : i32 = c; + let x_55 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_53 < x_55)) { + } else { + break; + } + let x_58 : mat4x4 = m0; + m1 = x_58; + let x_59 : i32 = c; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_66 : f32 = x_10.x_GLF_uniform_float_values[0]; + m1[(x_59 % x_61)][x_64] = x_66; + let x_68 : i32 = c; + let x_70 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_73 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_75 : f32 = x_10.x_GLF_uniform_float_values[0]; + m0[(x_68 % x_70)][x_73] = x_75; + + continuing { + let x_77 : i32 = c; + c = (x_77 + 1); + } + } + let x_79 : mat4x4 = m0; + let x_81 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_84 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_87 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_90 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_93 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_96 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_99 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_102 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_105 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_108 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_111 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_114 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_117 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_120 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_123 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_126 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_132 : mat4x4 = mat4x4(vec4(f32(x_81), f32(x_84), f32(x_87), f32(x_90)), vec4(f32(x_93), f32(x_96), f32(x_99), f32(x_102)), vec4(f32(x_105), f32(x_108), f32(x_111), f32(x_114)), vec4(f32(x_117), f32(x_120), f32(x_123), f32(x_126))); + if ((((all((x_79[0u] == x_132[0u])) && all((x_79[1u] == x_132[1u]))) && all((x_79[2u] == x_132[2u]))) && all((x_79[3u] == x_132[3u])))) { + let x_156 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_159 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_162 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_165 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_156), f32(x_159), f32(x_162), f32(x_165)); + } else { + let x_169 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_170 : f32 = f32(x_169); + x_GLF_color = vec4(x_170, x_170, x_170, x_170); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm new file mode 100644 index 0000000000..55916643d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm @@ -0,0 +1,67 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %23 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %8 + %24 = OpLabel + %a = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + %25 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %26 = OpLoad %int %25 + OpSelectionMerge %27 None + OpSwitch %26 %28 2 %29 3 %29 4 %30 + %28 = OpLabel + OpStore %a %int_2 + OpBranch %27 + %29 = OpLabel + OpStore %a %int_1 + OpBranch %30 + %30 = OpLabel + OpBranch %27 + %27 = OpLabel + %31 = OpLoad %int %a + %32 = OpIEqual %bool %31 %int_2 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + OpStore %_GLF_color %22 + OpBranch %33 + %35 = OpLabel + OpStore %_GLF_color %23 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..60bd73365b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.hlsl @@ -0,0 +1,44 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + a = 0; + const int x_26 = asint(x_6[0].x); + switch(x_26) { + case 2: + case 3: { + a = 1; + /* fallthrough */ + } + case 4: { + break; + } + default: { + a = 2; + break; + } + } + if ((a == 2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4c04e10633 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + a = 0; + int const x_26 = x_6.one; + switch(x_26) { + case 2: + case 3: { + a = 1; + /* fallthrough */ + } + case 4: { + break; + } + default: { + a = 2; + break; + } + } + int const x_31 = a; + if ((x_31 == 2)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b35e4cc14f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %39 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %40 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %41 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %18 + OpStore %a %int_0 + %23 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %24 = OpLoad %int %23 + OpSelectionMerge %25 None + OpSwitch %24 %26 2 %27 3 %27 4 %28 + %27 = OpLabel + OpStore %a %int_1 + OpBranch %28 + %28 = OpLabel + OpBranch %25 + %26 = OpLabel + OpStore %a %int_2 + OpBranch %25 + %25 = OpLabel + %31 = OpLoad %int %a + %32 = OpIEqual %bool %31 %int_2 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %34 + %36 = OpLabel + OpStore %x_GLF_color %40 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %41 +%tint_symbol = OpFunctionParameter %main_out + %45 = OpLabel + %46 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %46 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %main_1 + %51 = OpLoad %v4float %x_GLF_color + %52 = OpCompositeConstruct %main_out %51 + %50 = OpFunctionCall %void %tint_symbol_2 %52 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..7ac234c379 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.wgsl @@ -0,0 +1,43 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + a = 0; + let x_26 : i32 = x_6.one; + switch(x_26) { + case 2, 3: { + a = 1; + fallthrough; + } + case 4: { + } + default: { + a = 2; + } + } + let x_31 : i32 = a; + if ((x_31 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl new file mode 100644 index 0000000000..7ac234c379 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl @@ -0,0 +1,43 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + a = 0; + let x_26 : i32 = x_6.one; + switch(x_26) { + case 2, 3: { + a = 1; + fallthrough; + } + case 4: { + } + default: { + a = 2; + } + } + let x_31 : i32 = a; + if ((x_31 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..60bd73365b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.hlsl @@ -0,0 +1,44 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + a = 0; + const int x_26 = asint(x_6[0].x); + switch(x_26) { + case 2: + case 3: { + a = 1; + /* fallthrough */ + } + case 4: { + break; + } + default: { + a = 2; + break; + } + } + if ((a == 2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4c04e10633 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + a = 0; + int const x_26 = x_6.one; + switch(x_26) { + case 2: + case 3: { + a = 1; + /* fallthrough */ + } + case 4: { + break; + } + default: { + a = 2; + break; + } + } + int const x_31 = a; + if ((x_31 == 2)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b35e4cc14f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %39 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %40 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %41 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %18 + OpStore %a %int_0 + %23 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %24 = OpLoad %int %23 + OpSelectionMerge %25 None + OpSwitch %24 %26 2 %27 3 %27 4 %28 + %27 = OpLabel + OpStore %a %int_1 + OpBranch %28 + %28 = OpLabel + OpBranch %25 + %26 = OpLabel + OpStore %a %int_2 + OpBranch %25 + %25 = OpLabel + %31 = OpLoad %int %a + %32 = OpIEqual %bool %31 %int_2 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %34 + %36 = OpLabel + OpStore %x_GLF_color %40 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %41 +%tint_symbol = OpFunctionParameter %main_out + %45 = OpLabel + %46 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %46 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %48 = OpLabel + %49 = OpFunctionCall %void %main_1 + %51 = OpLoad %v4float %x_GLF_color + %52 = OpCompositeConstruct %main_out %51 + %50 = OpFunctionCall %void %tint_symbol_2 %52 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..7ac234c379 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.wgsl @@ -0,0 +1,43 @@ +[[block]] +struct buf0 { + one : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + a = 0; + let x_26 : i32 = x_6.one; + switch(x_26) { + case 2, 3: { + a = 1; + fallthrough; + } + case 4: { + } + default: { + a = 2; + } + } + let x_31 : i32 = a; + if ((x_31 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm new file mode 100644 index 0000000000..05282830d7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm @@ -0,0 +1,115 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %A "A" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %11 + %28 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %A = OpVariable %_ptr_Function__arr_int_uint_2 Function + %a = OpVariable %_ptr_Function_int Function + %29 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %30 = OpLoad %int %29 + OpStore %i %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpSLessThan %bool %35 %37 + OpBranchConditional %38 %39 %32 + %39 = OpLabel + %40 = OpLoad %int %i + %41 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Function_int %A %40 + OpStore %42 %41 + OpBranch %33 + %33 = OpLabel + %43 = OpLoad %int %i + %44 = OpIAdd %int %43 %int_1 + OpStore %i %44 + OpBranch %31 + %32 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Function_int %A %46 + %48 = OpLoad %int %47 + %49 = OpNot %int %48 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Function_int %A %51 + %53 = OpLoad %int %52 + %54 = OpNot %int %53 + %55 = OpExtInst %int %1 SMin %49 %54 + OpStore %a %55 + %56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %57 = OpLoad %int %56 + %58 = OpConvertSToF %float %57 + %59 = OpCompositeConstruct %v4float %58 %58 %58 %58 + OpStore %_GLF_color %59 + %60 = OpLoad %int %a + %61 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %62 = OpLoad %int %61 + %63 = OpSNegate %int %62 + %64 = OpIEqual %bool %60 %63 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %68 = OpLoad %int %67 + %69 = OpConvertSToF %float %68 + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %71 + %73 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpCompositeConstruct %v4float %69 %72 %75 %78 + OpStore %_GLF_color %79 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..b0be04f0a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int A[2] = (int[2])0; + int a = 0; + const int x_30 = asint(x_6[1].x); + i = x_30; + while (true) { + const int x_35 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_37 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_35 < x_37)) { + } else { + break; + } + A[i] = i; + { + i = (i + 1); + } + } + const int x_46 = asint(x_6[1].x); + const int x_48 = A[x_46]; + const int x_51 = asint(x_6[2].x); + const int x_53 = A[x_51]; + a = min(~(x_48), ~(x_53)); + const int x_57 = asint(x_6[1].x); + const float x_58 = float(x_57); + x_GLF_color = float4(x_58, x_58, x_58, x_58); + const int x_60 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_62 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_60 == -(x_62))) { + const int x_68 = asint(x_6[2].x); + const int x_71 = asint(x_6[1].x); + const int x_74 = asint(x_6[1].x); + const int x_77 = asint(x_6[2].x); + x_GLF_color = float4(float(x_68), float(x_71), float(x_74), float(x_77)); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4aaf44e23e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.msl @@ -0,0 +1,72 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + tint_array_wrapper_1 A = {}; + int a = 0; + int const x_30 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_30; + while (true) { + int const x_35 = i; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_35 < x_37)) { + } else { + break; + } + int const x_40 = i; + int const x_41 = i; + A.arr[x_40] = x_41; + { + int const x_43 = i; + i = (x_43 + 1); + } + } + int const x_46 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_48 = A.arr[x_46]; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_53 = A.arr[x_51]; + a = min(~(x_48), ~(x_53)); + int const x_57 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_58 = float(x_57); + *(tint_symbol_4) = float4(x_58, x_58, x_58, x_58); + int const x_60 = a; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_60 == -(x_62))) { + int const x_68 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_71 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_74 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_77 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_68), float(x_71), float(x_74), float(x_77)); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..35b828d483 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.spvasm @@ -0,0 +1,156 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + %61 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %A "A" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %26 = OpConstantNull %_arr_int_uint_2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %88 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %A = OpVariable %_ptr_Function__arr_int_uint_2 Function %26 + %a = OpVariable %_ptr_Function_int Function %21 + %31 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %32 = OpLoad %int %31 + OpStore %i %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %40 = OpLoad %int %39 + %41 = OpSLessThan %bool %37 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %34 + %43 = OpLabel + %46 = OpLoad %int %i + %47 = OpLoad %int %i + %48 = OpAccessChain %_ptr_Function_int %A %46 + OpStore %48 %47 + OpBranch %35 + %35 = OpLabel + %49 = OpLoad %int %i + %50 = OpIAdd %int %49 %int_1 + OpStore %i %50 + OpBranch %33 + %34 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Function_int %A %52 + %54 = OpLoad %int %53 + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %57 = OpLoad %int %56 + %58 = OpAccessChain %_ptr_Function_int %A %57 + %59 = OpLoad %int %58 + %62 = OpNot %int %54 + %63 = OpNot %int %59 + %60 = OpExtInst %int %61 SMin %62 %63 + OpStore %a %60 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpCompositeConstruct %v4float %66 %66 %66 %66 + OpStore %x_GLF_color %67 + %68 = OpLoad %int %a + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpSNegate %int %70 + %72 = OpIEqual %bool %68 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %82 = OpLoad %int %81 + %83 = OpConvertSToF %float %76 + %84 = OpConvertSToF %float %78 + %85 = OpConvertSToF %float %80 + %86 = OpConvertSToF %float %82 + %87 = OpCompositeConstruct %v4float %83 %84 %85 %86 + OpStore %x_GLF_color %87 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %88 +%tint_symbol = OpFunctionParameter %main_out + %92 = OpLabel + %93 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %93 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %95 = OpLabel + %96 = OpFunctionCall %void %main_1 + %98 = OpLoad %v4float %x_GLF_color + %99 = OpCompositeConstruct %main_out %98 + %97 = OpFunctionCall %void %tint_symbol_2 %99 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c17f0bbfd2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.spvasm.expected.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var A : array; + var a : i32; + let x_30 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_30; + loop { + let x_35 : i32 = i; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_35 < x_37)) { + } else { + break; + } + let x_40 : i32 = i; + let x_41 : i32 = i; + A[x_40] = x_41; + + continuing { + let x_43 : i32 = i; + i = (x_43 + 1); + } + } + let x_46 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_48 : i32 = A[x_46]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_53 : i32 = A[x_51]; + a = min(~(x_48), ~(x_53)); + let x_57 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + let x_60 : i32 = a; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_60 == -(x_62))) { + let x_68 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_74 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_68), f32(x_71), f32(x_74), f32(x_77)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl new file mode 100644 index 0000000000..c17f0bbfd2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var A : array; + var a : i32; + let x_30 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_30; + loop { + let x_35 : i32 = i; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_35 < x_37)) { + } else { + break; + } + let x_40 : i32 = i; + let x_41 : i32 = i; + A[x_40] = x_41; + + continuing { + let x_43 : i32 = i; + i = (x_43 + 1); + } + } + let x_46 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_48 : i32 = A[x_46]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_53 : i32 = A[x_51]; + a = min(~(x_48), ~(x_53)); + let x_57 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + let x_60 : i32 = a; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_60 == -(x_62))) { + let x_68 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_74 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_68), f32(x_71), f32(x_74), f32(x_77)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..b0be04f0a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int A[2] = (int[2])0; + int a = 0; + const int x_30 = asint(x_6[1].x); + i = x_30; + while (true) { + const int x_35 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_37 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_35 < x_37)) { + } else { + break; + } + A[i] = i; + { + i = (i + 1); + } + } + const int x_46 = asint(x_6[1].x); + const int x_48 = A[x_46]; + const int x_51 = asint(x_6[2].x); + const int x_53 = A[x_51]; + a = min(~(x_48), ~(x_53)); + const int x_57 = asint(x_6[1].x); + const float x_58 = float(x_57); + x_GLF_color = float4(x_58, x_58, x_58, x_58); + const int x_60 = a; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_62 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_60 == -(x_62))) { + const int x_68 = asint(x_6[2].x); + const int x_71 = asint(x_6[1].x); + const int x_74 = asint(x_6[1].x); + const int x_77 = asint(x_6[2].x); + x_GLF_color = float4(float(x_68), float(x_71), float(x_74), float(x_77)); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4aaf44e23e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.msl @@ -0,0 +1,72 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + tint_array_wrapper_1 A = {}; + int a = 0; + int const x_30 = x_6.x_GLF_uniform_int_values.arr[1].el; + i = x_30; + while (true) { + int const x_35 = i; + int const x_37 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_35 < x_37)) { + } else { + break; + } + int const x_40 = i; + int const x_41 = i; + A.arr[x_40] = x_41; + { + int const x_43 = i; + i = (x_43 + 1); + } + } + int const x_46 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_48 = A.arr[x_46]; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_53 = A.arr[x_51]; + a = min(~(x_48), ~(x_53)); + int const x_57 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_58 = float(x_57); + *(tint_symbol_4) = float4(x_58, x_58, x_58, x_58); + int const x_60 = a; + int const x_62 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_60 == -(x_62))) { + int const x_68 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_71 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_74 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_77 = x_6.x_GLF_uniform_int_values.arr[2].el; + *(tint_symbol_4) = float4(float(x_68), float(x_71), float(x_74), float(x_77)); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..35b828d483 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.spvasm @@ -0,0 +1,156 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + %61 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %A "A" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %26 = OpConstantNull %_arr_int_uint_2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %88 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %i = OpVariable %_ptr_Function_int Function %21 + %A = OpVariable %_ptr_Function__arr_int_uint_2 Function %26 + %a = OpVariable %_ptr_Function_int Function %21 + %31 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %32 = OpLoad %int %31 + OpStore %i %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %40 = OpLoad %int %39 + %41 = OpSLessThan %bool %37 %40 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %34 + %43 = OpLabel + %46 = OpLoad %int %i + %47 = OpLoad %int %i + %48 = OpAccessChain %_ptr_Function_int %A %46 + OpStore %48 %47 + OpBranch %35 + %35 = OpLabel + %49 = OpLoad %int %i + %50 = OpIAdd %int %49 %int_1 + OpStore %i %50 + OpBranch %33 + %34 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Function_int %A %52 + %54 = OpLoad %int %53 + %56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %57 = OpLoad %int %56 + %58 = OpAccessChain %_ptr_Function_int %A %57 + %59 = OpLoad %int %58 + %62 = OpNot %int %54 + %63 = OpNot %int %59 + %60 = OpExtInst %int %61 SMin %62 %63 + OpStore %a %60 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpCompositeConstruct %v4float %66 %66 %66 %66 + OpStore %x_GLF_color %67 + %68 = OpLoad %int %a + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpSNegate %int %70 + %72 = OpIEqual %bool %68 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %76 = OpLoad %int %75 + %77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %78 = OpLoad %int %77 + %79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %82 = OpLoad %int %81 + %83 = OpConvertSToF %float %76 + %84 = OpConvertSToF %float %78 + %85 = OpConvertSToF %float %80 + %86 = OpConvertSToF %float %82 + %87 = OpCompositeConstruct %v4float %83 %84 %85 %86 + OpStore %x_GLF_color %87 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %88 +%tint_symbol = OpFunctionParameter %main_out + %92 = OpLabel + %93 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %93 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %95 = OpLabel + %96 = OpFunctionCall %void %main_1 + %98 = OpLoad %v4float %x_GLF_color + %99 = OpCompositeConstruct %main_out %98 + %97 = OpFunctionCall %void %tint_symbol_2 %99 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c17f0bbfd2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-inst-combine-select-value-tracking-flip-bits/0-opt.wgsl.expected.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var A : array; + var a : i32; + let x_30 : i32 = x_6.x_GLF_uniform_int_values[1]; + i = x_30; + loop { + let x_35 : i32 = i; + let x_37 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_35 < x_37)) { + } else { + break; + } + let x_40 : i32 = i; + let x_41 : i32 = i; + A[x_40] = x_41; + + continuing { + let x_43 : i32 = i; + i = (x_43 + 1); + } + } + let x_46 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_48 : i32 = A[x_46]; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_53 : i32 = A[x_51]; + a = min(~(x_48), ~(x_53)); + let x_57 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_58 : f32 = f32(x_57); + x_GLF_color = vec4(x_58, x_58, x_58, x_58); + let x_60 : i32 = a; + let x_62 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_60 == -(x_62))) { + let x_68 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_74 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_77 : i32 = x_6.x_GLF_uniform_int_values[2]; + x_GLF_color = vec4(f32(x_68), f32(x_71), f32(x_74), f32(x_77)); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm new file mode 100644 index 0000000000..5730c8b5aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm @@ -0,0 +1,112 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %25 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %26 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %27 = OpLoad %int %26 + OpStore %a %27 + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %29 = OpLoad %int %28 + OpStore %i %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %36 = OpLoad %int %35 + %37 = OpSLessThan %bool %34 %36 + OpBranchConditional %37 %38 %31 + %38 = OpLabel + %39 = OpLoad %int %i + %40 = OpSMod %int %int_1 %39 + %41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %42 = OpLoad %int %41 + %43 = OpIEqual %bool %40 %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + OpBranch %32 + %44 = OpLabel + %46 = OpLoad %int %a + %47 = OpIAdd %int %46 %int_1 + OpStore %a %47 + OpBranch %32 + %32 = OpLabel + %48 = OpLoad %int %i + %49 = OpIAdd %int %48 %int_1 + OpStore %i %49 + OpBranch %30 + %31 = OpLabel + %50 = OpLoad %int %a + %51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %52 = OpLoad %int %51 + %53 = OpIEqual %bool %50 %52 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %56 + %55 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %61 + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %67 = OpLoad %int %66 + %68 = OpConvertSToF %float %67 + %69 = OpCompositeConstruct %v4float %59 %62 %65 %68 + OpStore %_GLF_color %69 + OpBranch %54 + %56 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %71 = OpLoad %int %70 + %72 = OpConvertSToF %float %71 + %73 = OpCompositeConstruct %v4float %72 %72 %72 %72 + OpStore %_GLF_color %73 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ad949e0ef3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.hlsl @@ -0,0 +1,62 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const int x_27 = asint(x_6[2].x); + a = x_27; + const int x_29 = asint(x_6[3].x); + i = x_29; + while (true) { + const int x_34 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_36 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_34 < x_36)) { + } else { + break; + } + const int x_39 = i; + const int x_42 = asint(x_6[2].x); + if (((1 % x_39) == x_42)) { + { + i = (i + 1); + } + continue; + } + a = (a + 1); + { + i = (i + 1); + } + } + const int x_50 = a; + const int x_52 = asint(x_6[1].x); + if ((x_50 == x_52)) { + const int x_58 = asint(x_6[3].x); + const int x_61 = asint(x_6[2].x); + const int x_64 = asint(x_6[2].x); + const int x_67 = asint(x_6[3].x); + x_GLF_color = float4(float(x_58), float(x_61), float(x_64), float(x_67)); + } else { + const int x_71 = asint(x_6[2].x); + const float x_72 = float(x_71); + x_GLF_color = float4(x_72, x_72, x_72, x_72); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..bd9b04a315 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[2].el; + a = x_27; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[3].el; + i = x_29; + while (true) { + int const x_34 = i; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_34 < x_36)) { + } else { + break; + } + int const x_39 = i; + int const x_42 = x_6.x_GLF_uniform_int_values.arr[2].el; + if (((1 % x_39) == x_42)) { + { + int const x_48 = i; + i = (x_48 + 1); + } + continue; + } + int const x_46 = a; + a = (x_46 + 1); + { + int const x_48 = i; + i = (x_48 + 1); + } + } + int const x_50 = a; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_50 == x_52)) { + int const x_58 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_67 = x_6.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_4) = float4(float(x_58), float(x_61), float(x_64), float(x_67)); + } else { + int const x_71 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_72 = float(x_71); + *(tint_symbol_4) = float4(x_72, x_72, x_72, x_72); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..815ee5867d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %27 = OpLoad %int %26 + OpStore %a %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %30 = OpLoad %int %29 + OpStore %i %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %int %i + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpSLessThan %bool %35 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %32 + %41 = OpLabel + %44 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %46 = OpLoad %int %45 + %48 = OpSMod %int %int_1 %44 + %49 = OpIEqual %bool %48 %46 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpBranch %33 + %50 = OpLabel + %52 = OpLoad %int %a + %53 = OpIAdd %int %52 %int_1 + OpStore %a %53 + OpBranch %33 + %33 = OpLabel + %54 = OpLoad %int %i + %55 = OpIAdd %int %54 %int_1 + OpStore %i %55 + OpBranch %31 + %32 = OpLabel + %56 = OpLoad %int %a + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpIEqual %bool %56 %58 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %64 + %72 = OpConvertSToF %float %66 + %73 = OpConvertSToF %float %68 + %74 = OpConvertSToF %float %70 + %75 = OpCompositeConstruct %v4float %71 %72 %73 %74 + OpStore %x_GLF_color %75 + OpBranch %60 + %62 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpCompositeConstruct %v4float %78 %78 %78 %78 + OpStore %x_GLF_color %79 + OpBranch %60 + %60 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %80 +%tint_symbol = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %87 = OpLabel + %88 = OpFunctionCall %void %main_1 + %90 = OpLoad %v4float %x_GLF_color + %91 = OpCompositeConstruct %main_out %90 + %89 = OpFunctionCall %void %tint_symbol_2 %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..d11bb08e81 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.spvasm.expected.wgsl @@ -0,0 +1,64 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_27; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[3]; + i = x_29; + loop { + let x_34 : i32 = i; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_34 < x_36)) { + } else { + break; + } + let x_39 : i32 = i; + let x_42 : i32 = x_6.x_GLF_uniform_int_values[2]; + if (((1 % x_39) == x_42)) { + continue; + } + let x_46 : i32 = a; + a = (x_46 + 1); + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_50 : i32 = a; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_50 == x_52)) { + let x_58 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_58), f32(x_61), f32(x_64), f32(x_67)); + } else { + let x_71 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_72 : f32 = f32(x_71); + x_GLF_color = vec4(x_72, x_72, x_72, x_72); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl new file mode 100644 index 0000000000..d11bb08e81 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl @@ -0,0 +1,64 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_27; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[3]; + i = x_29; + loop { + let x_34 : i32 = i; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_34 < x_36)) { + } else { + break; + } + let x_39 : i32 = i; + let x_42 : i32 = x_6.x_GLF_uniform_int_values[2]; + if (((1 % x_39) == x_42)) { + continue; + } + let x_46 : i32 = a; + a = (x_46 + 1); + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_50 : i32 = a; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_50 == x_52)) { + let x_58 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_58), f32(x_61), f32(x_64), f32(x_67)); + } else { + let x_71 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_72 : f32 = f32(x_71); + x_GLF_color = vec4(x_72, x_72, x_72, x_72); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..ad949e0ef3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.hlsl @@ -0,0 +1,62 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int i = 0; + const int x_27 = asint(x_6[2].x); + a = x_27; + const int x_29 = asint(x_6[3].x); + i = x_29; + while (true) { + const int x_34 = i; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_36 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + if ((x_34 < x_36)) { + } else { + break; + } + const int x_39 = i; + const int x_42 = asint(x_6[2].x); + if (((1 % x_39) == x_42)) { + { + i = (i + 1); + } + continue; + } + a = (a + 1); + { + i = (i + 1); + } + } + const int x_50 = a; + const int x_52 = asint(x_6[1].x); + if ((x_50 == x_52)) { + const int x_58 = asint(x_6[3].x); + const int x_61 = asint(x_6[2].x); + const int x_64 = asint(x_6[2].x); + const int x_67 = asint(x_6[3].x); + x_GLF_color = float4(float(x_58), float(x_61), float(x_64), float(x_67)); + } else { + const int x_71 = asint(x_6[2].x); + const float x_72 = float(x_71); + x_GLF_color = float4(x_72, x_72, x_72, x_72); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..bd9b04a315 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + int const x_27 = x_6.x_GLF_uniform_int_values.arr[2].el; + a = x_27; + int const x_29 = x_6.x_GLF_uniform_int_values.arr[3].el; + i = x_29; + while (true) { + int const x_34 = i; + int const x_36 = x_6.x_GLF_uniform_int_values.arr[0].el; + if ((x_34 < x_36)) { + } else { + break; + } + int const x_39 = i; + int const x_42 = x_6.x_GLF_uniform_int_values.arr[2].el; + if (((1 % x_39) == x_42)) { + { + int const x_48 = i; + i = (x_48 + 1); + } + continue; + } + int const x_46 = a; + a = (x_46 + 1); + { + int const x_48 = i; + i = (x_48 + 1); + } + } + int const x_50 = a; + int const x_52 = x_6.x_GLF_uniform_int_values.arr[1].el; + if ((x_50 == x_52)) { + int const x_58 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_64 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_67 = x_6.x_GLF_uniform_int_values.arr[3].el; + *(tint_symbol_4) = float4(float(x_58), float(x_61), float(x_64), float(x_67)); + } else { + int const x_71 = x_6.x_GLF_uniform_int_values.arr[2].el; + float const x_72 = float(x_71); + *(tint_symbol_4) = float4(x_72, x_72, x_72, x_72); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..815ee5867d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 92 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %80 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %27 = OpLoad %int %26 + OpStore %a %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %30 = OpLoad %int %29 + OpStore %i %30 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %int %i + %37 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %38 = OpLoad %int %37 + %39 = OpSLessThan %bool %35 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %32 + %41 = OpLabel + %44 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %46 = OpLoad %int %45 + %48 = OpSMod %int %int_1 %44 + %49 = OpIEqual %bool %48 %46 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpBranch %33 + %50 = OpLabel + %52 = OpLoad %int %a + %53 = OpIAdd %int %52 %int_1 + OpStore %a %53 + OpBranch %33 + %33 = OpLabel + %54 = OpLoad %int %i + %55 = OpIAdd %int %54 %int_1 + OpStore %i %55 + OpBranch %31 + %32 = OpLabel + %56 = OpLoad %int %a + %57 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpIEqual %bool %56 %58 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %70 = OpLoad %int %69 + %71 = OpConvertSToF %float %64 + %72 = OpConvertSToF %float %66 + %73 = OpConvertSToF %float %68 + %74 = OpConvertSToF %float %70 + %75 = OpCompositeConstruct %v4float %71 %72 %73 %74 + OpStore %x_GLF_color %75 + OpBranch %60 + %62 = OpLabel + %76 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpCompositeConstruct %v4float %78 %78 %78 %78 + OpStore %x_GLF_color %79 + OpBranch %60 + %60 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %80 +%tint_symbol = OpFunctionParameter %main_out + %84 = OpLabel + %85 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %85 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %87 = OpLabel + %88 = OpFunctionCall %void %main_1 + %90 = OpLoad %v4float %x_GLF_color + %91 = OpCompositeConstruct %main_out %90 + %89 = OpFunctionCall %void %tint_symbol_2 %91 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..d11bb08e81 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-apint-inst-combine-simplify-one-mod-loop-iterator/0-opt.wgsl.expected.wgsl @@ -0,0 +1,64 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var i : i32; + let x_27 : i32 = x_6.x_GLF_uniform_int_values[2]; + a = x_27; + let x_29 : i32 = x_6.x_GLF_uniform_int_values[3]; + i = x_29; + loop { + let x_34 : i32 = i; + let x_36 : i32 = x_6.x_GLF_uniform_int_values[0]; + if ((x_34 < x_36)) { + } else { + break; + } + let x_39 : i32 = i; + let x_42 : i32 = x_6.x_GLF_uniform_int_values[2]; + if (((1 % x_39) == x_42)) { + continue; + } + let x_46 : i32 = a; + a = (x_46 + 1); + + continuing { + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_50 : i32 = a; + let x_52 : i32 = x_6.x_GLF_uniform_int_values[1]; + if ((x_50 == x_52)) { + let x_58 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_64 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_67 : i32 = x_6.x_GLF_uniform_int_values[3]; + x_GLF_color = vec4(f32(x_58), f32(x_61), f32(x_64), f32(x_67)); + } else { + let x_71 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_72 : f32 = f32(x_71); + x_GLF_color = vec4(x_72, x_72, x_72, x_72); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm new file mode 100644 index 0000000000..c0e7096abe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm @@ -0,0 +1,77 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_n2 = OpConstant %int -2 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %23 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %main = OpFunction %void None %9 + %25 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %i + %31 = OpSLessThan %bool %30 %int_2 + OpBranchConditional %31 %32 %27 + %32 = OpLabel + %33 = OpLoad %int %i + %34 = OpBitwiseOr %int %33 %int_n2 + %35 = OpISub %int %34 %int_1 + OpStore %a %35 + OpBranch %28 + %28 = OpLabel + %36 = OpLoad %int %i + %37 = OpIAdd %int %36 %int_1 + OpStore %i %37 + OpBranch %26 + %27 = OpLabel + %38 = OpLoad %int %a + %39 = OpIEqual %bool %38 %int_n2 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %42 + %41 = OpLabel + OpStore %_GLF_color %22 + OpBranch %40 + %42 = OpLabel + OpStore %_GLF_color %23 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..cf1aef6979 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.hlsl @@ -0,0 +1,36 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; + +void main_1() { + int a = 0; + int i = 0; + a = 0; + i = 0; + { + for(; (i < 2); i = (i + 1)) { + a = ((i | -2) - 1); + } + } + if ((a == -2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f06e3b0e4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int two; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + a = 0; + i = 0; + while (true) { + int const x_30 = i; + if ((x_30 < 2)) { + } else { + break; + } + int const x_33 = i; + a = ((x_33 | -2) - 1); + { + int const x_36 = i; + i = (x_36 + 1); + } + } + int const x_38 = a; + if ((x_38 == -2)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..04cf0995cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.spvasm @@ -0,0 +1,114 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %x_7 "x_7" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_n2 = OpConstant %int -2 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %46 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %48 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %18 + %i = OpVariable %_ptr_Function_int Function %18 + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %int %i + %27 = OpSLessThan %bool %25 %int_2 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpBranch %29 + %31 = OpLabel + OpBranch %22 + %29 = OpLabel + %32 = OpLoad %int %i + %34 = OpBitwiseOr %int %32 %int_n2 + %36 = OpISub %int %34 %int_1 + OpStore %a %36 + OpBranch %23 + %23 = OpLabel + %37 = OpLoad %int %i + %38 = OpIAdd %int %37 %int_1 + OpStore %i %38 + OpBranch %21 + %22 = OpLabel + %39 = OpLoad %int %a + %40 = OpIEqual %bool %39 %int_n2 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %43 + %42 = OpLabel + OpStore %x_GLF_color %46 + OpBranch %41 + %43 = OpLabel + OpStore %x_GLF_color %47 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %48 +%tint_symbol = OpFunctionParameter %main_out + %52 = OpLabel + %53 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %53 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %55 = OpLabel + %56 = OpFunctionCall %void %main_1 + %58 = OpLoad %v4float %x_GLF_color + %59 = OpCompositeConstruct %main_out %58 + %57 = OpFunctionCall %void %tint_symbol_2 %59 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5aa3bbe224 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.spvasm.expected.wgsl @@ -0,0 +1,47 @@ +[[block]] +struct buf0 { + two : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +fn main_1() { + var a : i32; + var i : i32; + a = 0; + i = 0; + loop { + let x_30 : i32 = i; + if ((x_30 < 2)) { + } else { + break; + } + let x_33 : i32 = i; + a = ((x_33 | -2) - 1); + + continuing { + let x_36 : i32 = i; + i = (x_36 + 1); + } + } + let x_38 : i32 = a; + if ((x_38 == -2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl new file mode 100644 index 0000000000..5aa3bbe224 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl @@ -0,0 +1,47 @@ +[[block]] +struct buf0 { + two : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +fn main_1() { + var a : i32; + var i : i32; + a = 0; + i = 0; + loop { + let x_30 : i32 = i; + if ((x_30 < 2)) { + } else { + break; + } + let x_33 : i32 = i; + a = ((x_33 | -2) - 1); + + continuing { + let x_36 : i32 = i; + i = (x_36 + 1); + } + } + let x_38 : i32 = a; + if ((x_38 == -2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..cf1aef6979 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; + +void main_1() { + int a = 0; + int i = 0; + a = 0; + i = 0; + { + for(; (i < 2); i = (i + 1)) { + a = ((i | -2) - 1); + } + } + if ((a == -2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f06e3b0e4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int two; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int a = 0; + int i = 0; + a = 0; + i = 0; + while (true) { + int const x_30 = i; + if ((x_30 < 2)) { + } else { + break; + } + int const x_33 = i; + a = ((x_33 | -2) - 1); + { + int const x_36 = i; + i = (x_36 + 1); + } + } + int const x_38 = a; + if ((x_38 == -2)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..04cf0995cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.spvasm @@ -0,0 +1,114 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "two" + OpName %x_7 "x_7" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_n2 = OpConstant %int -2 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %46 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %48 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_int Function %18 + %i = OpVariable %_ptr_Function_int Function %18 + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %int %i + %27 = OpSLessThan %bool %25 %int_2 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpBranch %29 + %31 = OpLabel + OpBranch %22 + %29 = OpLabel + %32 = OpLoad %int %i + %34 = OpBitwiseOr %int %32 %int_n2 + %36 = OpISub %int %34 %int_1 + OpStore %a %36 + OpBranch %23 + %23 = OpLabel + %37 = OpLoad %int %i + %38 = OpIAdd %int %37 %int_1 + OpStore %i %38 + OpBranch %21 + %22 = OpLabel + %39 = OpLoad %int %a + %40 = OpIEqual %bool %39 %int_n2 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %43 + %42 = OpLabel + OpStore %x_GLF_color %46 + OpBranch %41 + %43 = OpLabel + OpStore %x_GLF_color %47 + OpBranch %41 + %41 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %48 +%tint_symbol = OpFunctionParameter %main_out + %52 = OpLabel + %53 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %53 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %55 = OpLabel + %56 = OpFunctionCall %void %main_1 + %58 = OpLoad %v4float %x_GLF_color + %59 = OpCompositeConstruct %main_out %58 + %57 = OpFunctionCall %void %tint_symbol_2 %59 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5aa3bbe224 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-inclusive-or/0-opt.wgsl.expected.wgsl @@ -0,0 +1,47 @@ +[[block]] +struct buf0 { + two : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +fn main_1() { + var a : i32; + var i : i32; + a = 0; + i = 0; + loop { + let x_30 : i32 = i; + if ((x_30 < 2)) { + } else { + break; + } + let x_33 : i32 = i; + a = ((x_33 | -2) - 1); + + continuing { + let x_36 : i32 = i; + i = (x_36 + 1); + } + } + let x_38 : i32 = a; + if ((x_38 == -2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm new file mode 100644 index 0000000000..924fb9e958 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm @@ -0,0 +1,117 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %sum "sum" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_65536 = OpConstant %int 65536 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %11 + %27 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %sum = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %a %int_65536 + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %29 = OpLoad %int %28 + OpStore %sum %29 + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %31 = OpLoad %int %30 + %32 = OpIEqual %bool %int_1 %31 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %33 + %34 = OpLabel + %35 = OpLoad %int %a + %36 = OpISub %int %35 %int_1 + OpStore %a %36 + OpBranch %33 + %33 = OpLabel + OpStore %i %int_0 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %int %i + %42 = OpLoad %int %a + %43 = OpSLessThan %bool %41 %42 + OpBranchConditional %43 %44 %38 + %44 = OpLabel + %45 = OpLoad %int %i + %46 = OpLoad %int %sum + %47 = OpIAdd %int %46 %45 + OpStore %sum %47 + OpBranch %39 + %39 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %49 = OpLoad %int %48 + %50 = OpLoad %int %i + %51 = OpIAdd %int %50 %49 + OpStore %i %51 + OpBranch %37 + %38 = OpLabel + %52 = OpLoad %int %sum + %53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %54 = OpLoad %int %53 + %55 = OpIEqual %bool %52 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %63 = OpLoad %int %62 + %64 = OpConvertSToF %float %63 + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + %68 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %69 + %71 = OpCompositeConstruct %v4float %61 %64 %67 %70 + OpStore %_GLF_color %71 + OpBranch %56 + %58 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %73 = OpLoad %int %72 + %74 = OpConvertSToF %float %73 + %75 = OpCompositeConstruct %v4float %74 %74 %74 %74 + OpStore %_GLF_color %75 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..08b57e06fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.hlsl @@ -0,0 +1,61 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int sum = 0; + int i = 0; + a = 65536; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + sum = x_29; + const int x_31 = asint(x_7[1].x); + if ((1 == x_31)) { + a = (a - 1); + } + i = 0; + while (true) { + if ((i < a)) { + } else { + break; + } + sum = (sum + i); + { + const int x_49 = asint(x_7[2].x); + i = (i + x_49); + } + } + const int x_52 = sum; + const int x_54 = asint(x_7[3].x); + if ((x_52 == x_54)) { + const int x_60 = asint(x_7[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_63 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_66 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_69 = asint(x_7[1].x); + x_GLF_color = float4(float(x_60), float(x_63), float(x_66), float(x_69)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_73 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_74 = float(x_73); + x_GLF_color = float4(x_74, x_74, x_74, x_74); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..aca4892519 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.msl @@ -0,0 +1,73 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int a = 0; + int sum = 0; + int i = 0; + a = 65536; + int const x_29 = x_7.x_GLF_uniform_int_values.arr[0].el; + sum = x_29; + int const x_31 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((1 == x_31)) { + int const x_35 = a; + a = (x_35 - 1); + } + i = 0; + while (true) { + int const x_41 = i; + int const x_42 = a; + if ((x_41 < x_42)) { + } else { + break; + } + int const x_45 = i; + int const x_46 = sum; + sum = (x_46 + x_45); + { + int const x_49 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_50 = i; + i = (x_50 + x_49); + } + } + int const x_52 = sum; + int const x_54 = x_7.x_GLF_uniform_int_values.arr[3].el; + if ((x_52 == x_54)) { + int const x_60 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_63 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_66 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_69 = x_7.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_60), float(x_63), float(x_66), float(x_69)); + } else { + int const x_73 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_74 = float(x_73); + *(tint_symbol_4) = float4(x_74, x_74, x_74, x_74); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..0d0815662d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.spvasm @@ -0,0 +1,155 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 94 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %sum "sum" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_65536 = OpConstant %int 65536 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %82 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %sum = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + OpStore %a %int_65536 + %28 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %29 = OpLoad %int %28 + OpStore %sum %29 + %31 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %32 = OpLoad %int %31 + %33 = OpIEqual %bool %int_1 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + %37 = OpLoad %int %a + %38 = OpISub %int %37 %int_1 + OpStore %a %38 + OpBranch %35 + %35 = OpLabel + OpStore %i %int_0 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i + %44 = OpLoad %int %a + %45 = OpSLessThan %bool %43 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %40 + %46 = OpLabel + %49 = OpLoad %int %i + %50 = OpLoad %int %sum + %51 = OpIAdd %int %50 %49 + OpStore %sum %51 + OpBranch %41 + %41 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %54 = OpLoad %int %53 + %55 = OpLoad %int %i + %56 = OpIAdd %int %55 %54 + OpStore %i %56 + OpBranch %39 + %40 = OpLabel + %57 = OpLoad %int %sum + %59 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_3 + %60 = OpLoad %int %59 + %61 = OpIEqual %bool %57 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %64 + %63 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %66 + %74 = OpConvertSToF %float %68 + %75 = OpConvertSToF %float %70 + %76 = OpConvertSToF %float %72 + %77 = OpCompositeConstruct %v4float %73 %74 %75 %76 + OpStore %x_GLF_color %77 + OpBranch %62 + %64 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %79 = OpLoad %int %78 + %80 = OpConvertSToF %float %79 + %81 = OpCompositeConstruct %v4float %80 %80 %80 %80 + OpStore %x_GLF_color %81 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %82 +%tint_symbol = OpFunctionParameter %main_out + %86 = OpLabel + %87 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %87 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %89 = OpLabel + %90 = OpFunctionCall %void %main_1 + %92 = OpLoad %v4float %x_GLF_color + %93 = OpCompositeConstruct %main_out %92 + %91 = OpFunctionCall %void %tint_symbol_2 %93 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c8d8cccc11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.spvasm.expected.wgsl @@ -0,0 +1,67 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var sum : i32; + var i : i32; + a = 65536; + let x_29 : i32 = x_7.x_GLF_uniform_int_values[0]; + sum = x_29; + let x_31 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((1 == x_31)) { + let x_35 : i32 = a; + a = (x_35 - 1); + } + i = 0; + loop { + let x_41 : i32 = i; + let x_42 : i32 = a; + if ((x_41 < x_42)) { + } else { + break; + } + let x_45 : i32 = i; + let x_46 : i32 = sum; + sum = (x_46 + x_45); + + continuing { + let x_49 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_50 : i32 = i; + i = (x_50 + x_49); + } + } + let x_52 : i32 = sum; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[3]; + if ((x_52 == x_54)) { + let x_60 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_66 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_69 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_60), f32(x_63), f32(x_66), f32(x_69)); + } else { + let x_73 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_74 : f32 = f32(x_73); + x_GLF_color = vec4(x_74, x_74, x_74, x_74); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl new file mode 100644 index 0000000000..c8d8cccc11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl @@ -0,0 +1,67 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var sum : i32; + var i : i32; + a = 65536; + let x_29 : i32 = x_7.x_GLF_uniform_int_values[0]; + sum = x_29; + let x_31 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((1 == x_31)) { + let x_35 : i32 = a; + a = (x_35 - 1); + } + i = 0; + loop { + let x_41 : i32 = i; + let x_42 : i32 = a; + if ((x_41 < x_42)) { + } else { + break; + } + let x_45 : i32 = i; + let x_46 : i32 = sum; + sum = (x_46 + x_45); + + continuing { + let x_49 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_50 : i32 = i; + i = (x_50 + x_49); + } + } + let x_52 : i32 = sum; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[3]; + if ((x_52 == x_54)) { + let x_60 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_66 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_69 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_60), f32(x_63), f32(x_66), f32(x_69)); + } else { + let x_73 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_74 : f32 = f32(x_73); + x_GLF_color = vec4(x_74, x_74, x_74, x_74); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..08b57e06fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.hlsl @@ -0,0 +1,61 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int a = 0; + int sum = 0; + int i = 0; + a = 65536; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_29 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + sum = x_29; + const int x_31 = asint(x_7[1].x); + if ((1 == x_31)) { + a = (a - 1); + } + i = 0; + while (true) { + if ((i < a)) { + } else { + break; + } + sum = (sum + i); + { + const int x_49 = asint(x_7[2].x); + i = (i + x_49); + } + } + const int x_52 = sum; + const int x_54 = asint(x_7[3].x); + if ((x_52 == x_54)) { + const int x_60 = asint(x_7[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_63 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_66 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_69 = asint(x_7[1].x); + x_GLF_color = float4(float(x_60), float(x_63), float(x_66), float(x_69)); + } else { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_73 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_74 = float(x_73); + x_GLF_color = float4(x_74, x_74, x_74, x_74); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..aca4892519 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.msl @@ -0,0 +1,73 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int a = 0; + int sum = 0; + int i = 0; + a = 65536; + int const x_29 = x_7.x_GLF_uniform_int_values.arr[0].el; + sum = x_29; + int const x_31 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((1 == x_31)) { + int const x_35 = a; + a = (x_35 - 1); + } + i = 0; + while (true) { + int const x_41 = i; + int const x_42 = a; + if ((x_41 < x_42)) { + } else { + break; + } + int const x_45 = i; + int const x_46 = sum; + sum = (x_46 + x_45); + { + int const x_49 = x_7.x_GLF_uniform_int_values.arr[2].el; + int const x_50 = i; + i = (x_50 + x_49); + } + } + int const x_52 = sum; + int const x_54 = x_7.x_GLF_uniform_int_values.arr[3].el; + if ((x_52 == x_54)) { + int const x_60 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_63 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_66 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_69 = x_7.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_60), float(x_63), float(x_66), float(x_69)); + } else { + int const x_73 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_74 = float(x_73); + *(tint_symbol_4) = float4(x_74, x_74, x_74, x_74); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..0d0815662d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.spvasm @@ -0,0 +1,155 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 94 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %sum "sum" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %21 = OpConstantNull %int + %int_65536 = OpConstant %int 65536 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %82 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %a = OpVariable %_ptr_Function_int Function %21 + %sum = OpVariable %_ptr_Function_int Function %21 + %i = OpVariable %_ptr_Function_int Function %21 + OpStore %a %int_65536 + %28 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %29 = OpLoad %int %28 + OpStore %sum %29 + %31 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %32 = OpLoad %int %31 + %33 = OpIEqual %bool %int_1 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + %37 = OpLoad %int %a + %38 = OpISub %int %37 %int_1 + OpStore %a %38 + OpBranch %35 + %35 = OpLabel + OpStore %i %int_0 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i + %44 = OpLoad %int %a + %45 = OpSLessThan %bool %43 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %40 + %46 = OpLabel + %49 = OpLoad %int %i + %50 = OpLoad %int %sum + %51 = OpIAdd %int %50 %49 + OpStore %sum %51 + OpBranch %41 + %41 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2 + %54 = OpLoad %int %53 + %55 = OpLoad %int %i + %56 = OpIAdd %int %55 %54 + OpStore %i %56 + OpBranch %39 + %40 = OpLabel + %57 = OpLoad %int %sum + %59 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_3 + %60 = OpLoad %int %59 + %61 = OpIEqual %bool %57 %60 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %64 + %63 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %72 = OpLoad %int %71 + %73 = OpConvertSToF %float %66 + %74 = OpConvertSToF %float %68 + %75 = OpConvertSToF %float %70 + %76 = OpConvertSToF %float %72 + %77 = OpCompositeConstruct %v4float %73 %74 %75 %76 + OpStore %x_GLF_color %77 + OpBranch %62 + %64 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %79 = OpLoad %int %78 + %80 = OpConvertSToF %float %79 + %81 = OpCompositeConstruct %v4float %80 %80 %80 %80 + OpStore %x_GLF_color %81 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %82 +%tint_symbol = OpFunctionParameter %main_out + %86 = OpLabel + %87 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %87 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %89 = OpLabel + %90 = OpFunctionCall %void %main_1 + %92 = OpLoad %v4float %x_GLF_color + %93 = OpCompositeConstruct %main_out %92 + %91 = OpFunctionCall %void %tint_symbol_2 %93 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c8d8cccc11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-known-nonzero/0-opt.wgsl.expected.wgsl @@ -0,0 +1,67 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : i32; + var sum : i32; + var i : i32; + a = 65536; + let x_29 : i32 = x_7.x_GLF_uniform_int_values[0]; + sum = x_29; + let x_31 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((1 == x_31)) { + let x_35 : i32 = a; + a = (x_35 - 1); + } + i = 0; + loop { + let x_41 : i32 = i; + let x_42 : i32 = a; + if ((x_41 < x_42)) { + } else { + break; + } + let x_45 : i32 = i; + let x_46 : i32 = sum; + sum = (x_46 + x_45); + + continuing { + let x_49 : i32 = x_7.x_GLF_uniform_int_values[2]; + let x_50 : i32 = i; + i = (x_50 + x_49); + } + } + let x_52 : i32 = sum; + let x_54 : i32 = x_7.x_GLF_uniform_int_values[3]; + if ((x_52 == x_54)) { + let x_60 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_63 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_66 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_69 : i32 = x_7.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_60), f32(x_63), f32(x_66), f32(x_69)); + } else { + let x_73 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_74 : f32 = f32(x_73); + x_GLF_color = vec4(x_74, x_74, x_74, x_74); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm new file mode 100644 index 0000000000..6ad3bbd7cf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm @@ -0,0 +1,104 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f "f" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "_GLF_uniform_uint_values" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__1 "" + OpDecorate %_arr_uint_uint_1 ArrayStride 16 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 2 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_100 = OpConstant %uint 100 + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %buf2 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %_ = OpVariable %_ptr_Uniform_buf2 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__1 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %15 + %34 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %35 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %int_0 + %36 = OpLoad %uint %35 + %37 = OpExtInst %uint %1 UMax %uint_100 %36 + %38 = OpBitcast %float %37 + OpStore %f %38 + %39 = OpLoad %float %f + %40 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %41 = OpLoad %float %40 + %42 = OpFOrdEqual %bool %39 %41 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %47 = OpLoad %int %46 + %48 = OpConvertSToF %float %47 + %49 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %50 = OpLoad %int %49 + %51 = OpConvertSToF %float %50 + %52 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpConvertSToF %float %53 + %55 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %56 = OpLoad %int %55 + %57 = OpConvertSToF %float %56 + %58 = OpCompositeConstruct %v4float %48 %51 %54 %57 + OpStore %_GLF_color %58 + OpBranch %43 + %45 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpCompositeConstruct %v4float %61 %61 %61 %61 + OpStore %_GLF_color %62 + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..d3a37e63b6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.hlsl @@ -0,0 +1,48 @@ +cbuffer cbuffer_x_6 : register(b2, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; + +void main_1() { + float f = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const uint x_36 = x_6[scalar_offset / 4][scalar_offset % 4]; + f = asfloat(max(100u, x_36)); + const float x_39 = f; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_39 == x_41)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_50 = asint(x_10[1].x); + const int x_53 = asint(x_10[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_47), float(x_50), float(x_53), float(x_56)); + } else { + const int x_60 = asint(x_10[1].x); + const float x_61 = float(x_60); + x_GLF_color = float4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..89ab95dace --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.msl @@ -0,0 +1,68 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ uint el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf2 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_uint_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_2 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_2[12]; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ tint_padded_array_element_2 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_2 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf2& x_6, constant buf1& x_8, constant buf0& x_10, thread float4* const tint_symbol_4) { + float f = 0.0f; + uint const x_36 = x_6.x_GLF_uniform_uint_values.arr[0].el; + f = as_type(max(100u, x_36)); + float const x_39 = f; + float const x_41 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_39 == x_41)) { + int const x_47 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_50 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_53 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_47), float(x_50), float(x_53), float(x_56)); + } else { + int const x_60 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_61 = float(x_60); + *(tint_symbol_4) = float4(x_61, x_61, x_61, x_61); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf2& x_6 [[buffer(2)]], constant buf1& x_8 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..1b834bbcf8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 80 +; Schema: 0 + OpCapability Shader + %38 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf2 "buf2" + OpMemberName %buf2 0 "x_GLF_uniform_uint_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %_arr_uint_uint_1 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 2 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %buf2 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_6 = OpVariable %_ptr_Uniform_buf2 Uniform + %float = OpTypeFloat 32 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %15 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %15 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %30 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_100 = OpConstant %uint 100 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %68 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %24 + %27 = OpLabel + %f = OpVariable %_ptr_Function_float Function %30 + %34 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 %int_0 + %35 = OpLoad %uint %34 + %37 = OpExtInst %uint %38 UMax %uint_100 %35 + %36 = OpBitcast %float %37 + OpStore %f %36 + %40 = OpLoad %float %f + %42 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %43 = OpLoad %float %42 + %44 = OpFOrdEqual %bool %40 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %48 + %47 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %51 = OpLoad %int %50 + %53 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %51 + %60 = OpConvertSToF %float %54 + %61 = OpConvertSToF %float %56 + %62 = OpConvertSToF %float %58 + %63 = OpCompositeConstruct %v4float %59 %60 %61 %62 + OpStore %x_GLF_color %63 + OpBranch %46 + %48 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpCompositeConstruct %v4float %66 %66 %66 %66 + OpStore %x_GLF_color %67 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %68 +%tint_symbol = OpFunctionParameter %main_out + %72 = OpLabel + %73 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %73 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %24 + %75 = OpLabel + %76 = OpFunctionCall %void %main_1 + %78 = OpLoad %v4float %x_GLF_color + %79 = OpCompositeConstruct %main_out %78 + %77 = OpFunctionCall %void %tint_symbol_2 %79 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..0bf1020ac4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.spvasm.expected.wgsl @@ -0,0 +1,59 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_uint_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_2; +}; + +[[group(0), binding(2)]] var x_6 : buf2; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn main_1() { + var f : f32; + let x_36 : u32 = x_6.x_GLF_uniform_uint_values[0]; + f = bitcast(max(100u, x_36)); + let x_39 : f32 = f; + let x_41 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_39 == x_41)) { + let x_47 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_47), f32(x_50), f32(x_53), f32(x_56)); + } else { + let x_60 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_61 : f32 = f32(x_60); + x_GLF_color = vec4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl new file mode 100644 index 0000000000..0bf1020ac4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl @@ -0,0 +1,59 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_uint_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_2; +}; + +[[group(0), binding(2)]] var x_6 : buf2; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn main_1() { + var f : f32; + let x_36 : u32 = x_6.x_GLF_uniform_uint_values[0]; + f = bitcast(max(100u, x_36)); + let x_39 : f32 = f; + let x_41 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_39 == x_41)) { + let x_47 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_47), f32(x_50), f32(x_53), f32(x_56)); + } else { + let x_60 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_61 : f32 = f32(x_60); + x_GLF_color = vec4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d3a37e63b6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.hlsl @@ -0,0 +1,48 @@ +cbuffer cbuffer_x_6 : register(b2, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_8 : register(b1, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[2]; +}; + +void main_1() { + float f = 0.0f; + const uint scalar_offset = ((16u * uint(0))) / 4; + const uint x_36 = x_6[scalar_offset / 4][scalar_offset % 4]; + f = asfloat(max(100u, x_36)); + const float x_39 = f; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_41 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_39 == x_41)) { + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_47 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_50 = asint(x_10[1].x); + const int x_53 = asint(x_10[1].x); + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]); + x_GLF_color = float4(float(x_47), float(x_50), float(x_53), float(x_56)); + } else { + const int x_60 = asint(x_10[1].x); + const float x_61 = float(x_60); + x_GLF_color = float4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..89ab95dace --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.msl @@ -0,0 +1,68 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ uint el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[1]; +}; +struct buf2 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_uint_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_2 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_2[12]; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ tint_padded_array_element_2 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_2 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf2& x_6, constant buf1& x_8, constant buf0& x_10, thread float4* const tint_symbol_4) { + float f = 0.0f; + uint const x_36 = x_6.x_GLF_uniform_uint_values.arr[0].el; + f = as_type(max(100u, x_36)); + float const x_39 = f; + float const x_41 = x_8.x_GLF_uniform_float_values.arr[0].el; + if ((x_39 == x_41)) { + int const x_47 = x_10.x_GLF_uniform_int_values.arr[0].el; + int const x_50 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_53 = x_10.x_GLF_uniform_int_values.arr[1].el; + int const x_56 = x_10.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_47), float(x_50), float(x_53), float(x_56)); + } else { + int const x_60 = x_10.x_GLF_uniform_int_values.arr[1].el; + float const x_61 = float(x_60); + *(tint_symbol_4) = float4(x_61, x_61, x_61, x_61); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf2& x_6 [[buffer(2)]], constant buf1& x_8 [[buffer(1)]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, x_10, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..1b834bbcf8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 80 +; Schema: 0 + OpCapability Shader + %38 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf2 "buf2" + OpMemberName %buf2 0 "x_GLF_uniform_uint_values" + OpName %x_6 "x_6" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_10 "x_10" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %f "f" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %_arr_uint_uint_1 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 2 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %buf2 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_6 = OpVariable %_ptr_Uniform_buf2 Uniform + %float = OpTypeFloat 32 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf1 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %15 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %15 + %int = OpTypeInt 32 1 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %30 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_100 = OpConstant %uint 100 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %68 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %24 + %27 = OpLabel + %f = OpVariable %_ptr_Function_float Function %30 + %34 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 %int_0 + %35 = OpLoad %uint %34 + %37 = OpExtInst %uint %38 UMax %uint_100 %35 + %36 = OpBitcast %float %37 + OpStore %f %36 + %40 = OpLoad %float %f + %42 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %43 = OpLoad %float %42 + %44 = OpFOrdEqual %bool %40 %43 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %48 + %47 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %51 = OpLoad %int %50 + %53 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %51 + %60 = OpConvertSToF %float %54 + %61 = OpConvertSToF %float %56 + %62 = OpConvertSToF %float %58 + %63 = OpCompositeConstruct %v4float %59 %60 %61 %62 + OpStore %x_GLF_color %63 + OpBranch %46 + %48 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1 + %65 = OpLoad %int %64 + %66 = OpConvertSToF %float %65 + %67 = OpCompositeConstruct %v4float %66 %66 %66 %66 + OpStore %x_GLF_color %67 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %68 +%tint_symbol = OpFunctionParameter %main_out + %72 = OpLabel + %73 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %73 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %24 + %75 = OpLabel + %76 = OpFunctionCall %void %main_1 + %78 = OpLoad %v4float %x_GLF_color + %79 = OpCompositeConstruct %main_out %78 + %77 = OpFunctionCall %void %tint_symbol_2 %79 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..0bf1020ac4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-max-uintbitstofloat/0-opt.wgsl.expected.wgsl @@ -0,0 +1,59 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_uint_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_2; +}; + +[[group(0), binding(2)]] var x_6 : buf2; + +[[group(0), binding(1)]] var x_8 : buf1; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +fn main_1() { + var f : f32; + let x_36 : u32 = x_6.x_GLF_uniform_uint_values[0]; + f = bitcast(max(100u, x_36)); + let x_39 : f32 = f; + let x_41 : f32 = x_8.x_GLF_uniform_float_values[0]; + if ((x_39 == x_41)) { + let x_47 : i32 = x_10.x_GLF_uniform_int_values[0]; + let x_50 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_56 : i32 = x_10.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_47), f32(x_50), f32(x_53), f32(x_56)); + } else { + let x_60 : i32 = x_10.x_GLF_uniform_int_values[1]; + let x_61 : f32 = f32(x_60); + x_GLF_color = vec4(x_61, x_61, x_61, x_61); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm new file mode 100644 index 0000000000..45abf52223 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm @@ -0,0 +1,305 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %ref "ref" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %i "i" + OpName %data "data" + OpName %i_0 "i" + OpName %i_1 "i" + OpName %i_2 "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_16 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_15 = OpConstant %uint 15 +%_arr_int_uint_15 = OpTypeArray %int %uint_15 +%_ptr_Function__arr_int_uint_15 = OpTypePointer Function %_arr_int_uint_15 + %uint_16 = OpConstant %uint 16 +%_arr_int_uint_16 = OpTypeArray %int %uint_16 + %buf0 = OpTypeStruct %_arr_int_uint_16 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %int_11 = OpConstant %int 11 + %int_6 = OpConstant %int 6 + %int_12 = OpConstant %int 12 + %int_13 = OpConstant %int 13 + %int_14 = OpConstant %int 14 + %int_15 = OpConstant %int 15 + %bool = OpTypeBool + %int_7 = OpConstant %int 7 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %44 = OpLabel + %ref = OpVariable %_ptr_Function__arr_int_uint_15 Function + %i = OpVariable %_ptr_Function_int Function + %data = OpVariable %_ptr_Function__arr_int_uint_15 Function + %i_0 = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %i_2 = OpVariable %_ptr_Function_int Function + %45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %48 = OpLoad %int %47 + %49 = OpAccessChain %_ptr_Function_int %ref %46 + OpStore %49 %48 + %50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Function_int %ref %51 + OpStore %54 %53 + %55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %56 = OpLoad %int %55 + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %58 = OpLoad %int %57 + %59 = OpAccessChain %_ptr_Function_int %ref %56 + OpStore %59 %58 + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3 + %63 = OpLoad %int %62 + %64 = OpAccessChain %_ptr_Function_int %ref %61 + OpStore %64 %63 + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4 + %68 = OpLoad %int %67 + %69 = OpAccessChain %_ptr_Function_int %ref %66 + OpStore %69 %68 + %70 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpSNegate %int %73 + %75 = OpAccessChain %_ptr_Function_int %ref %71 + OpStore %75 %74 + %76 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_8 + %77 = OpLoad %int %76 + %78 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %79 = OpLoad %int %78 + %80 = OpSNegate %int %79 + %81 = OpAccessChain %_ptr_Function_int %ref %77 + OpStore %81 %80 + %82 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_9 + %83 = OpLoad %int %82 + %84 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %85 = OpLoad %int %84 + %86 = OpSNegate %int %85 + %87 = OpAccessChain %_ptr_Function_int %ref %83 + OpStore %87 %86 + %88 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_10 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %91 = OpLoad %int %90 + %92 = OpSNegate %int %91 + %93 = OpAccessChain %_ptr_Function_int %ref %89 + OpStore %93 %92 + %94 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_11 + %95 = OpLoad %int %94 + %96 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %97 = OpLoad %int %96 + %98 = OpSNegate %int %97 + %99 = OpAccessChain %_ptr_Function_int %ref %95 + OpStore %99 %98 + %100 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %101 = OpLoad %int %100 + %102 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %103 = OpLoad %int %102 + %104 = OpSNegate %int %103 + %105 = OpAccessChain %_ptr_Function_int %ref %101 + OpStore %105 %104 + %106 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_12 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %109 = OpLoad %int %108 + %110 = OpSNegate %int %109 + %111 = OpAccessChain %_ptr_Function_int %ref %107 + OpStore %111 %110 + %112 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_13 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %115 = OpLoad %int %114 + %116 = OpSNegate %int %115 + %117 = OpAccessChain %_ptr_Function_int %ref %113 + OpStore %117 %116 + %118 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_14 + %119 = OpLoad %int %118 + %120 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %121 = OpLoad %int %120 + %122 = OpSNegate %int %121 + %123 = OpAccessChain %_ptr_Function_int %ref %119 + OpStore %123 %122 + %124 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_15 + %125 = OpLoad %int %124 + %126 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2 + %127 = OpLoad %int %126 + %128 = OpSNegate %int %127 + %129 = OpAccessChain %_ptr_Function_int %ref %125 + OpStore %129 %128 + OpStore %i %int_0 + OpBranch %130 + %130 = OpLabel + OpLoopMerge %131 %132 None + OpBranch %133 + %133 = OpLabel + %134 = OpLoad %int %i + %135 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %136 = OpLoad %int %135 + %137 = OpSLessThan %bool %134 %136 + OpBranchConditional %137 %138 %131 + %138 = OpLabel + %139 = OpLoad %int %i + %140 = OpLoad %int %i + %141 = OpNot %int %140 + %142 = OpLoad %int %i + %143 = OpNot %int %142 + %144 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %145 = OpLoad %int %144 + %146 = OpExtInst %int %1 SClamp %141 %143 %145 + %147 = OpNot %int %146 + %148 = OpAccessChain %_ptr_Function_int %data %139 + OpStore %148 %147 + OpBranch %132 + %132 = OpLabel + %149 = OpLoad %int %i + %150 = OpIAdd %int %149 %int_1 + OpStore %i %150 + OpBranch %130 + %131 = OpLabel + %151 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_5 + %152 = OpLoad %int %151 + OpStore %i_0 %152 + OpBranch %153 + %153 = OpLabel + OpLoopMerge %154 %155 None + OpBranch %156 + %156 = OpLabel + %157 = OpLoad %int %i_0 + %158 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %159 = OpLoad %int %158 + %160 = OpSLessThan %bool %157 %159 + OpBranchConditional %160 %161 %154 + %161 = OpLabel + %162 = OpLoad %int %i_0 + %163 = OpLoad %int %i_0 + %164 = OpNot %int %163 + %165 = OpExtInst %int %1 SClamp %164 %int_0 %int_1 + %166 = OpNot %int %165 + %167 = OpAccessChain %_ptr_Function_int %data %162 + OpStore %167 %166 + OpBranch %155 + %155 = OpLabel + %168 = OpLoad %int %i_0 + %169 = OpIAdd %int %168 %int_1 + OpStore %i_0 %169 + OpBranch %153 + %154 = OpLabel + %170 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_6 + %171 = OpLoad %int %170 + OpStore %i_1 %171 + OpBranch %172 + %172 = OpLabel + OpLoopMerge %173 %174 None + OpBranch %175 + %175 = OpLabel + %176 = OpLoad %int %i_1 + %177 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_7 + %178 = OpLoad %int %177 + %179 = OpSLessThan %bool %176 %178 + OpBranchConditional %179 %180 %173 + %180 = OpLabel + %181 = OpLoad %int %i_1 + %182 = OpLoad %int %i_1 + %183 = OpExtInst %int %1 SClamp %182 %int_0 %int_1 + %184 = OpNot %int %183 + %185 = OpAccessChain %_ptr_Function_int %data %181 + OpStore %185 %184 + OpBranch %174 + %174 = OpLabel + %186 = OpLoad %int %i_1 + %187 = OpIAdd %int %186 %int_1 + OpStore %i_1 %187 + OpBranch %172 + %173 = OpLabel + %188 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %189 = OpLoad %int %188 + OpStore %i_2 %189 + OpBranch %190 + %190 = OpLabel + OpLoopMerge %191 %192 None + OpBranch %193 + %193 = OpLabel + %194 = OpLoad %int %i_2 + %195 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_7 + %196 = OpLoad %int %195 + %197 = OpSLessThan %bool %194 %196 + OpBranchConditional %197 %198 %191 + %198 = OpLabel + %199 = OpLoad %int %i_2 + %200 = OpAccessChain %_ptr_Function_int %data %199 + %201 = OpLoad %int %200 + %202 = OpLoad %int %i_2 + %203 = OpAccessChain %_ptr_Function_int %ref %202 + %204 = OpLoad %int %203 + %205 = OpINotEqual %bool %201 %204 + OpSelectionMerge %206 None + OpBranchConditional %205 %207 %206 + %207 = OpLabel + %208 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %209 = OpLoad %int %208 + %210 = OpConvertSToF %float %209 + %211 = OpCompositeConstruct %v4float %210 %210 %210 %210 + OpStore %_GLF_color %211 + OpReturn + %206 = OpLabel + OpBranch %192 + %192 = OpLabel + %212 = OpLoad %int %i_2 + %213 = OpIAdd %int %212 %int_1 + OpStore %i_2 %213 + OpBranch %190 + %191 = OpLabel + %214 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %215 = OpLoad %int %214 + %216 = OpConvertSToF %float %215 + %217 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %218 = OpLoad %int %217 + %219 = OpConvertSToF %float %218 + %220 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %221 = OpLoad %int %220 + %222 = OpConvertSToF %float %221 + %223 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %224 = OpLoad %int %223 + %225 = OpConvertSToF %float %224 + %226 = OpCompositeConstruct %v4float %216 %219 %222 %225 + OpStore %_GLF_color %226 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..8b5cb0745f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,150 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[16]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int ref[15] = (int[15])0; + int i = 0; + int data[15] = (int[15])0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_46 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_48 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + ref[x_46] = x_48; + const int x_51 = asint(x_6[1].x); + const int x_53 = asint(x_6[1].x); + ref[x_51] = x_53; + const int x_56 = asint(x_6[2].x); + const int x_58 = asint(x_6[2].x); + ref[x_56] = x_58; + const int x_61 = asint(x_6[3].x); + const int x_63 = asint(x_6[3].x); + ref[x_61] = x_63; + const int x_66 = asint(x_6[4].x); + const int x_68 = asint(x_6[4].x); + ref[x_66] = x_68; + const int x_71 = asint(x_6[5].x); + const int x_73 = asint(x_6[1].x); + ref[x_71] = -(x_73); + const int x_77 = asint(x_6[8].x); + const int x_79 = asint(x_6[1].x); + ref[x_77] = -(x_79); + const int x_83 = asint(x_6[9].x); + const int x_85 = asint(x_6[1].x); + ref[x_83] = -(x_85); + const int x_89 = asint(x_6[10].x); + const int x_91 = asint(x_6[1].x); + ref[x_89] = -(x_91); + const int x_95 = asint(x_6[11].x); + const int x_97 = asint(x_6[1].x); + ref[x_95] = -(x_97); + const int x_101 = asint(x_6[6].x); + const int x_103 = asint(x_6[2].x); + ref[x_101] = -(x_103); + const int x_107 = asint(x_6[12].x); + const int x_109 = asint(x_6[2].x); + ref[x_107] = -(x_109); + const int x_113 = asint(x_6[13].x); + const int x_115 = asint(x_6[2].x); + ref[x_113] = -(x_115); + const int x_119 = asint(x_6[14].x); + const int x_121 = asint(x_6[2].x); + ref[x_119] = -(x_121); + const int x_125 = asint(x_6[15].x); + const int x_127 = asint(x_6[2].x); + ref[x_125] = -(x_127); + i = 0; + while (true) { + const int x_134 = i; + const int x_136 = asint(x_6[5].x); + if ((x_134 < x_136)) { + } else { + break; + } + const int x_139 = i; + const int x_140 = i; + const int x_142 = i; + const int x_145 = asint(x_6[1].x); + data[x_139] = ~(clamp(~(x_140), ~(x_142), x_145)); + { + i = (i + 1); + } + } + const int x_152 = asint(x_6[5].x); + i_1 = x_152; + while (true) { + const int x_157 = i_1; + const int x_159 = asint(x_6[6].x); + if ((x_157 < x_159)) { + } else { + break; + } + data[i_1] = ~(clamp(~(i_1), 0, 1)); + { + i_1 = (i_1 + 1); + } + } + const int x_171 = asint(x_6[6].x); + i_2 = x_171; + while (true) { + const int x_176 = i_2; + const int x_178 = asint(x_6[7].x); + if ((x_176 < x_178)) { + } else { + break; + } + data[i_2] = ~(clamp(i_2, 0, 1)); + { + i_2 = (i_2 + 1); + } + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_189 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + i_3 = x_189; + while (true) { + const int x_194 = i_3; + const int x_196 = asint(x_6[7].x); + if ((x_194 < x_196)) { + } else { + break; + } + const int x_201 = data[i_3]; + const int x_204 = ref[i_3]; + if ((x_201 != x_204)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_209 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_210 = float(x_209); + x_GLF_color = float4(x_210, x_210, x_210, x_210); + return; + } + { + i_3 = (i_3 + 1); + } + } + const int x_215 = asint(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_218 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_221 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_224 = asint(x_6[1].x); + x_GLF_color = float4(float(x_215), float(x_218), float(x_221), float(x_224)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..cceaae5a1d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,167 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[16]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[15]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + tint_array_wrapper_1 ref = {}; + int i = 0; + tint_array_wrapper_1 data = {}; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[0].el; + ref.arr[x_46] = x_48; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_51] = x_53; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_58 = x_6.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_56] = x_58; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[3].el; + ref.arr[x_61] = x_63; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_68 = x_6.x_GLF_uniform_int_values.arr[4].el; + ref.arr[x_66] = x_68; + int const x_71 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_73 = x_6.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_71] = -(x_73); + int const x_77 = x_6.x_GLF_uniform_int_values.arr[8].el; + int const x_79 = x_6.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_77] = -(x_79); + int const x_83 = x_6.x_GLF_uniform_int_values.arr[9].el; + int const x_85 = x_6.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_83] = -(x_85); + int const x_89 = x_6.x_GLF_uniform_int_values.arr[10].el; + int const x_91 = x_6.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_89] = -(x_91); + int const x_95 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_97 = x_6.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_95] = -(x_97); + int const x_101 = x_6.x_GLF_uniform_int_values.arr[6].el; + int const x_103 = x_6.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_101] = -(x_103); + int const x_107 = x_6.x_GLF_uniform_int_values.arr[12].el; + int const x_109 = x_6.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_107] = -(x_109); + int const x_113 = x_6.x_GLF_uniform_int_values.arr[13].el; + int const x_115 = x_6.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_113] = -(x_115); + int const x_119 = x_6.x_GLF_uniform_int_values.arr[14].el; + int const x_121 = x_6.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_119] = -(x_121); + int const x_125 = x_6.x_GLF_uniform_int_values.arr[15].el; + int const x_127 = x_6.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_125] = -(x_127); + i = 0; + while (true) { + int const x_134 = i; + int const x_136 = x_6.x_GLF_uniform_int_values.arr[5].el; + if ((x_134 < x_136)) { + } else { + break; + } + int const x_139 = i; + int const x_140 = i; + int const x_142 = i; + int const x_145 = x_6.x_GLF_uniform_int_values.arr[1].el; + data.arr[x_139] = ~(clamp(~(x_140), ~(x_142), x_145)); + { + int const x_149 = i; + i = (x_149 + 1); + } + } + int const x_152 = x_6.x_GLF_uniform_int_values.arr[5].el; + i_1 = x_152; + while (true) { + int const x_157 = i_1; + int const x_159 = x_6.x_GLF_uniform_int_values.arr[6].el; + if ((x_157 < x_159)) { + } else { + break; + } + int const x_162 = i_1; + int const x_163 = i_1; + data.arr[x_162] = ~(clamp(~(x_163), 0, 1)); + { + int const x_168 = i_1; + i_1 = (x_168 + 1); + } + } + int const x_171 = x_6.x_GLF_uniform_int_values.arr[6].el; + i_2 = x_171; + while (true) { + int const x_176 = i_2; + int const x_178 = x_6.x_GLF_uniform_int_values.arr[7].el; + if ((x_176 < x_178)) { + } else { + break; + } + int const x_181 = i_2; + int const x_182 = i_2; + data.arr[x_181] = ~(clamp(x_182, 0, 1)); + { + int const x_186 = i_2; + i_2 = (x_186 + 1); + } + } + int const x_189 = x_6.x_GLF_uniform_int_values.arr[0].el; + i_3 = x_189; + while (true) { + int const x_194 = i_3; + int const x_196 = x_6.x_GLF_uniform_int_values.arr[7].el; + if ((x_194 < x_196)) { + } else { + break; + } + int const x_199 = i_3; + int const x_201 = data.arr[x_199]; + int const x_202 = i_3; + int const x_204 = ref.arr[x_202]; + if ((x_201 != x_204)) { + int const x_209 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_210 = float(x_209); + *(tint_symbol_4) = float4(x_210, x_210, x_210, x_210); + return; + } + { + int const x_212 = i_3; + i_3 = (x_212 + 1); + } + } + int const x_215 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_218 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_221 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_224 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_215), float(x_218), float(x_221), float(x_224)); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..0879b72ab5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,361 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 253 +; Schema: 0 + OpCapability Shader + %153 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %ref "ref" + OpName %i "i" + OpName %data "data" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %i_3 "i_3" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_16 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_15 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_int_uint_16 = OpTypeArray %int %uint_16 + %buf0 = OpTypeStruct %_arr_int_uint_16 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_15 = OpConstant %uint 15 +%_arr_int_uint_15 = OpTypeArray %int %uint_15 +%_ptr_Function__arr_int_uint_15 = OpTypePointer Function %_arr_int_uint_15 + %23 = OpConstantNull %_arr_int_uint_15 +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %int_11 = OpConstant %int 11 + %int_6 = OpConstant %int 6 + %int_12 = OpConstant %int 12 + %int_13 = OpConstant %int 13 + %int_14 = OpConstant %int 14 + %int_15 = OpConstant %int 15 + %bool = OpTypeBool + %int_7 = OpConstant %int 7 + %main_out = OpTypeStruct %v4float + %241 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %ref = OpVariable %_ptr_Function__arr_int_uint_15 Function %23 + %i = OpVariable %_ptr_Function_int Function %26 + %data = OpVariable %_ptr_Function__arr_int_uint_15 Function %23 + %i_1 = OpVariable %_ptr_Function_int Function %26 + %i_2 = OpVariable %_ptr_Function_int Function %26 + %i_3 = OpVariable %_ptr_Function_int Function %26 + %34 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %35 = OpLoad %int %34 + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpAccessChain %_ptr_Function_int %ref %35 + OpStore %38 %37 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Function_int %ref %41 + OpStore %44 %43 + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_Function_int %ref %47 + OpStore %50 %49 + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Function_int %ref %53 + OpStore %56 %55 + %58 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Function_int %ref %59 + OpStore %62 %61 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Function_int %ref %65 + %69 = OpSNegate %int %67 + OpStore %68 %69 + %71 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_8 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Function_int %ref %72 + %76 = OpSNegate %int %74 + OpStore %75 %76 + %78 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Function_int %ref %79 + %83 = OpSNegate %int %81 + OpStore %82 %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_10 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Function_int %ref %86 + %90 = OpSNegate %int %88 + OpStore %89 %90 + %92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %93 = OpLoad %int %92 + %94 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %95 = OpLoad %int %94 + %96 = OpAccessChain %_ptr_Function_int %ref %93 + %97 = OpSNegate %int %95 + OpStore %96 %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %102 = OpLoad %int %101 + %103 = OpAccessChain %_ptr_Function_int %ref %100 + %104 = OpSNegate %int %102 + OpStore %103 %104 + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_12 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Function_int %ref %107 + %111 = OpSNegate %int %109 + OpStore %110 %111 + %113 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_13 + %114 = OpLoad %int %113 + %115 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %116 = OpLoad %int %115 + %117 = OpAccessChain %_ptr_Function_int %ref %114 + %118 = OpSNegate %int %116 + OpStore %117 %118 + %120 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_14 + %121 = OpLoad %int %120 + %122 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %123 = OpLoad %int %122 + %124 = OpAccessChain %_ptr_Function_int %ref %121 + %125 = OpSNegate %int %123 + OpStore %124 %125 + %127 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_15 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %130 = OpLoad %int %129 + %131 = OpAccessChain %_ptr_Function_int %ref %128 + %132 = OpSNegate %int %130 + OpStore %131 %132 + OpStore %i %int_0 + OpBranch %133 + %133 = OpLabel + OpLoopMerge %134 %135 None + OpBranch %136 + %136 = OpLabel + %137 = OpLoad %int %i + %138 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %139 = OpLoad %int %138 + %140 = OpSLessThan %bool %137 %139 + OpSelectionMerge %142 None + OpBranchConditional %140 %143 %144 + %143 = OpLabel + OpBranch %142 + %144 = OpLabel + OpBranch %134 + %142 = OpLabel + %145 = OpLoad %int %i + %146 = OpLoad %int %i + %147 = OpLoad %int %i + %148 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %149 = OpLoad %int %148 + %150 = OpAccessChain %_ptr_Function_int %data %145 + %154 = OpNot %int %146 + %155 = OpNot %int %147 + %152 = OpExtInst %int %153 SClamp %154 %155 %149 + %151 = OpNot %int %152 + OpStore %150 %151 + OpBranch %135 + %135 = OpLabel + %156 = OpLoad %int %i + %157 = OpIAdd %int %156 %int_1 + OpStore %i %157 + OpBranch %133 + %134 = OpLabel + %158 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %159 = OpLoad %int %158 + OpStore %i_1 %159 + OpBranch %160 + %160 = OpLabel + OpLoopMerge %161 %162 None + OpBranch %163 + %163 = OpLabel + %164 = OpLoad %int %i_1 + %165 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %166 = OpLoad %int %165 + %167 = OpSLessThan %bool %164 %166 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %161 + %168 = OpLabel + %171 = OpLoad %int %i_1 + %172 = OpLoad %int %i_1 + %173 = OpAccessChain %_ptr_Function_int %data %171 + %176 = OpNot %int %172 + %175 = OpExtInst %int %153 SClamp %176 %int_0 %int_1 + %174 = OpNot %int %175 + OpStore %173 %174 + OpBranch %162 + %162 = OpLabel + %177 = OpLoad %int %i_1 + %178 = OpIAdd %int %177 %int_1 + OpStore %i_1 %178 + OpBranch %160 + %161 = OpLabel + %179 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %180 = OpLoad %int %179 + OpStore %i_2 %180 + OpBranch %181 + %181 = OpLabel + OpLoopMerge %182 %183 None + OpBranch %184 + %184 = OpLabel + %185 = OpLoad %int %i_2 + %187 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_7 + %188 = OpLoad %int %187 + %189 = OpSLessThan %bool %185 %188 + OpSelectionMerge %190 None + OpBranchConditional %189 %191 %192 + %191 = OpLabel + OpBranch %190 + %192 = OpLabel + OpBranch %182 + %190 = OpLabel + %193 = OpLoad %int %i_2 + %194 = OpLoad %int %i_2 + %195 = OpAccessChain %_ptr_Function_int %data %193 + %197 = OpExtInst %int %153 SClamp %194 %int_0 %int_1 + %196 = OpNot %int %197 + OpStore %195 %196 + OpBranch %183 + %183 = OpLabel + %198 = OpLoad %int %i_2 + %199 = OpIAdd %int %198 %int_1 + OpStore %i_2 %199 + OpBranch %181 + %182 = OpLabel + %200 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %201 = OpLoad %int %200 + OpStore %i_3 %201 + OpBranch %202 + %202 = OpLabel + OpLoopMerge %203 %204 None + OpBranch %205 + %205 = OpLabel + %206 = OpLoad %int %i_3 + %207 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_7 + %208 = OpLoad %int %207 + %209 = OpSLessThan %bool %206 %208 + OpSelectionMerge %210 None + OpBranchConditional %209 %211 %212 + %211 = OpLabel + OpBranch %210 + %212 = OpLabel + OpBranch %203 + %210 = OpLabel + %213 = OpLoad %int %i_3 + %214 = OpAccessChain %_ptr_Function_int %data %213 + %215 = OpLoad %int %214 + %216 = OpLoad %int %i_3 + %217 = OpAccessChain %_ptr_Function_int %ref %216 + %218 = OpLoad %int %217 + %219 = OpINotEqual %bool %215 %218 + OpSelectionMerge %220 None + OpBranchConditional %219 %221 %220 + %221 = OpLabel + %222 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %223 = OpLoad %int %222 + %224 = OpConvertSToF %float %223 + %225 = OpCompositeConstruct %v4float %224 %224 %224 %224 + OpStore %x_GLF_color %225 + OpReturn + %220 = OpLabel + OpBranch %204 + %204 = OpLabel + %226 = OpLoad %int %i_3 + %227 = OpIAdd %int %226 %int_1 + OpStore %i_3 %227 + OpBranch %202 + %203 = OpLabel + %228 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %229 = OpLoad %int %228 + %230 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %231 = OpLoad %int %230 + %232 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %233 = OpLoad %int %232 + %234 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %235 = OpLoad %int %234 + %236 = OpConvertSToF %float %229 + %237 = OpConvertSToF %float %231 + %238 = OpConvertSToF %float %233 + %239 = OpConvertSToF %float %235 + %240 = OpCompositeConstruct %v4float %236 %237 %238 %239 + OpStore %x_GLF_color %240 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %241 +%tint_symbol = OpFunctionParameter %main_out + %245 = OpLabel + %246 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %246 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %248 = OpLabel + %249 = OpFunctionCall %void %main_1 + %251 = OpLoad %v4float %x_GLF_color + %252 = OpCompositeConstruct %main_out %251 + %250 = OpFunctionCall %void %tint_symbol_2 %252 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..2dc09e0bd3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,161 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var ref : array; + var i : i32; + var data : array; + var i_1 : i32; + var i_2 : i32; + var i_3 : i32; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[0]; + ref[x_46] = x_48; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_51] = x_53; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_56] = x_58; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[3]; + ref[x_61] = x_63; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_68 : i32 = x_6.x_GLF_uniform_int_values[4]; + ref[x_66] = x_68; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_73 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_71] = -(x_73); + let x_77 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_79 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_77] = -(x_79); + let x_83 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_85 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_83] = -(x_85); + let x_89 : i32 = x_6.x_GLF_uniform_int_values[10]; + let x_91 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_89] = -(x_91); + let x_95 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_97 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_95] = -(x_97); + let x_101 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_103 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_101] = -(x_103); + let x_107 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_109 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_107] = -(x_109); + let x_113 : i32 = x_6.x_GLF_uniform_int_values[13]; + let x_115 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_113] = -(x_115); + let x_119 : i32 = x_6.x_GLF_uniform_int_values[14]; + let x_121 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_119] = -(x_121); + let x_125 : i32 = x_6.x_GLF_uniform_int_values[15]; + let x_127 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_125] = -(x_127); + i = 0; + loop { + let x_134 : i32 = i; + let x_136 : i32 = x_6.x_GLF_uniform_int_values[5]; + if ((x_134 < x_136)) { + } else { + break; + } + let x_139 : i32 = i; + let x_140 : i32 = i; + let x_142 : i32 = i; + let x_145 : i32 = x_6.x_GLF_uniform_int_values[1]; + data[x_139] = ~(clamp(~(x_140), ~(x_142), x_145)); + + continuing { + let x_149 : i32 = i; + i = (x_149 + 1); + } + } + let x_152 : i32 = x_6.x_GLF_uniform_int_values[5]; + i_1 = x_152; + loop { + let x_157 : i32 = i_1; + let x_159 : i32 = x_6.x_GLF_uniform_int_values[6]; + if ((x_157 < x_159)) { + } else { + break; + } + let x_162 : i32 = i_1; + let x_163 : i32 = i_1; + data[x_162] = ~(clamp(~(x_163), 0, 1)); + + continuing { + let x_168 : i32 = i_1; + i_1 = (x_168 + 1); + } + } + let x_171 : i32 = x_6.x_GLF_uniform_int_values[6]; + i_2 = x_171; + loop { + let x_176 : i32 = i_2; + let x_178 : i32 = x_6.x_GLF_uniform_int_values[7]; + if ((x_176 < x_178)) { + } else { + break; + } + let x_181 : i32 = i_2; + let x_182 : i32 = i_2; + data[x_181] = ~(clamp(x_182, 0, 1)); + + continuing { + let x_186 : i32 = i_2; + i_2 = (x_186 + 1); + } + } + let x_189 : i32 = x_6.x_GLF_uniform_int_values[0]; + i_3 = x_189; + loop { + let x_194 : i32 = i_3; + let x_196 : i32 = x_6.x_GLF_uniform_int_values[7]; + if ((x_194 < x_196)) { + } else { + break; + } + let x_199 : i32 = i_3; + let x_201 : i32 = data[x_199]; + let x_202 : i32 = i_3; + let x_204 : i32 = ref[x_202]; + if ((x_201 != x_204)) { + let x_209 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_210 : f32 = f32(x_209); + x_GLF_color = vec4(x_210, x_210, x_210, x_210); + return; + } + + continuing { + let x_212 : i32 = i_3; + i_3 = (x_212 + 1); + } + } + let x_215 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_218 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_221 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_224 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_215), f32(x_218), f32(x_221), f32(x_224)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl new file mode 100644 index 0000000000..2dc09e0bd3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl @@ -0,0 +1,161 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var ref : array; + var i : i32; + var data : array; + var i_1 : i32; + var i_2 : i32; + var i_3 : i32; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[0]; + ref[x_46] = x_48; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_51] = x_53; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_56] = x_58; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[3]; + ref[x_61] = x_63; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_68 : i32 = x_6.x_GLF_uniform_int_values[4]; + ref[x_66] = x_68; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_73 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_71] = -(x_73); + let x_77 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_79 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_77] = -(x_79); + let x_83 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_85 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_83] = -(x_85); + let x_89 : i32 = x_6.x_GLF_uniform_int_values[10]; + let x_91 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_89] = -(x_91); + let x_95 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_97 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_95] = -(x_97); + let x_101 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_103 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_101] = -(x_103); + let x_107 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_109 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_107] = -(x_109); + let x_113 : i32 = x_6.x_GLF_uniform_int_values[13]; + let x_115 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_113] = -(x_115); + let x_119 : i32 = x_6.x_GLF_uniform_int_values[14]; + let x_121 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_119] = -(x_121); + let x_125 : i32 = x_6.x_GLF_uniform_int_values[15]; + let x_127 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_125] = -(x_127); + i = 0; + loop { + let x_134 : i32 = i; + let x_136 : i32 = x_6.x_GLF_uniform_int_values[5]; + if ((x_134 < x_136)) { + } else { + break; + } + let x_139 : i32 = i; + let x_140 : i32 = i; + let x_142 : i32 = i; + let x_145 : i32 = x_6.x_GLF_uniform_int_values[1]; + data[x_139] = ~(clamp(~(x_140), ~(x_142), x_145)); + + continuing { + let x_149 : i32 = i; + i = (x_149 + 1); + } + } + let x_152 : i32 = x_6.x_GLF_uniform_int_values[5]; + i_1 = x_152; + loop { + let x_157 : i32 = i_1; + let x_159 : i32 = x_6.x_GLF_uniform_int_values[6]; + if ((x_157 < x_159)) { + } else { + break; + } + let x_162 : i32 = i_1; + let x_163 : i32 = i_1; + data[x_162] = ~(clamp(~(x_163), 0, 1)); + + continuing { + let x_168 : i32 = i_1; + i_1 = (x_168 + 1); + } + } + let x_171 : i32 = x_6.x_GLF_uniform_int_values[6]; + i_2 = x_171; + loop { + let x_176 : i32 = i_2; + let x_178 : i32 = x_6.x_GLF_uniform_int_values[7]; + if ((x_176 < x_178)) { + } else { + break; + } + let x_181 : i32 = i_2; + let x_182 : i32 = i_2; + data[x_181] = ~(clamp(x_182, 0, 1)); + + continuing { + let x_186 : i32 = i_2; + i_2 = (x_186 + 1); + } + } + let x_189 : i32 = x_6.x_GLF_uniform_int_values[0]; + i_3 = x_189; + loop { + let x_194 : i32 = i_3; + let x_196 : i32 = x_6.x_GLF_uniform_int_values[7]; + if ((x_194 < x_196)) { + } else { + break; + } + let x_199 : i32 = i_3; + let x_201 : i32 = data[x_199]; + let x_202 : i32 = i_3; + let x_204 : i32 = ref[x_202]; + if ((x_201 != x_204)) { + let x_209 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_210 : f32 = f32(x_209); + x_GLF_color = vec4(x_210, x_210, x_210, x_210); + return; + } + + continuing { + let x_212 : i32 = i_3; + i_3 = (x_212 + 1); + } + } + let x_215 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_218 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_221 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_224 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_215), f32(x_218), f32(x_221), f32(x_224)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..8b5cb0745f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,150 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[16]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int ref[15] = (int[15])0; + int i = 0; + int data[15] = (int[15])0; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_46 = asint(x_6[scalar_offset / 4][scalar_offset % 4]); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_48 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + ref[x_46] = x_48; + const int x_51 = asint(x_6[1].x); + const int x_53 = asint(x_6[1].x); + ref[x_51] = x_53; + const int x_56 = asint(x_6[2].x); + const int x_58 = asint(x_6[2].x); + ref[x_56] = x_58; + const int x_61 = asint(x_6[3].x); + const int x_63 = asint(x_6[3].x); + ref[x_61] = x_63; + const int x_66 = asint(x_6[4].x); + const int x_68 = asint(x_6[4].x); + ref[x_66] = x_68; + const int x_71 = asint(x_6[5].x); + const int x_73 = asint(x_6[1].x); + ref[x_71] = -(x_73); + const int x_77 = asint(x_6[8].x); + const int x_79 = asint(x_6[1].x); + ref[x_77] = -(x_79); + const int x_83 = asint(x_6[9].x); + const int x_85 = asint(x_6[1].x); + ref[x_83] = -(x_85); + const int x_89 = asint(x_6[10].x); + const int x_91 = asint(x_6[1].x); + ref[x_89] = -(x_91); + const int x_95 = asint(x_6[11].x); + const int x_97 = asint(x_6[1].x); + ref[x_95] = -(x_97); + const int x_101 = asint(x_6[6].x); + const int x_103 = asint(x_6[2].x); + ref[x_101] = -(x_103); + const int x_107 = asint(x_6[12].x); + const int x_109 = asint(x_6[2].x); + ref[x_107] = -(x_109); + const int x_113 = asint(x_6[13].x); + const int x_115 = asint(x_6[2].x); + ref[x_113] = -(x_115); + const int x_119 = asint(x_6[14].x); + const int x_121 = asint(x_6[2].x); + ref[x_119] = -(x_121); + const int x_125 = asint(x_6[15].x); + const int x_127 = asint(x_6[2].x); + ref[x_125] = -(x_127); + i = 0; + while (true) { + const int x_134 = i; + const int x_136 = asint(x_6[5].x); + if ((x_134 < x_136)) { + } else { + break; + } + const int x_139 = i; + const int x_140 = i; + const int x_142 = i; + const int x_145 = asint(x_6[1].x); + data[x_139] = ~(clamp(~(x_140), ~(x_142), x_145)); + { + i = (i + 1); + } + } + const int x_152 = asint(x_6[5].x); + i_1 = x_152; + while (true) { + const int x_157 = i_1; + const int x_159 = asint(x_6[6].x); + if ((x_157 < x_159)) { + } else { + break; + } + data[i_1] = ~(clamp(~(i_1), 0, 1)); + { + i_1 = (i_1 + 1); + } + } + const int x_171 = asint(x_6[6].x); + i_2 = x_171; + while (true) { + const int x_176 = i_2; + const int x_178 = asint(x_6[7].x); + if ((x_176 < x_178)) { + } else { + break; + } + data[i_2] = ~(clamp(i_2, 0, 1)); + { + i_2 = (i_2 + 1); + } + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_189 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + i_3 = x_189; + while (true) { + const int x_194 = i_3; + const int x_196 = asint(x_6[7].x); + if ((x_194 < x_196)) { + } else { + break; + } + const int x_201 = data[i_3]; + const int x_204 = ref[i_3]; + if ((x_201 != x_204)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_209 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_210 = float(x_209); + x_GLF_color = float4(x_210, x_210, x_210, x_210); + return; + } + { + i_3 = (i_3 + 1); + } + } + const int x_215 = asint(x_6[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_218 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_221 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + const int x_224 = asint(x_6[1].x); + x_GLF_color = float4(float(x_215), float(x_218), float(x_221), float(x_224)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..cceaae5a1d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,167 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[16]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + int arr[15]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + tint_array_wrapper_1 ref = {}; + int i = 0; + tint_array_wrapper_1 data = {}; + int i_1 = 0; + int i_2 = 0; + int i_3 = 0; + int const x_46 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_48 = x_6.x_GLF_uniform_int_values.arr[0].el; + ref.arr[x_46] = x_48; + int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_53 = x_6.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_51] = x_53; + int const x_56 = x_6.x_GLF_uniform_int_values.arr[2].el; + int const x_58 = x_6.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_56] = x_58; + int const x_61 = x_6.x_GLF_uniform_int_values.arr[3].el; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[3].el; + ref.arr[x_61] = x_63; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[4].el; + int const x_68 = x_6.x_GLF_uniform_int_values.arr[4].el; + ref.arr[x_66] = x_68; + int const x_71 = x_6.x_GLF_uniform_int_values.arr[5].el; + int const x_73 = x_6.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_71] = -(x_73); + int const x_77 = x_6.x_GLF_uniform_int_values.arr[8].el; + int const x_79 = x_6.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_77] = -(x_79); + int const x_83 = x_6.x_GLF_uniform_int_values.arr[9].el; + int const x_85 = x_6.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_83] = -(x_85); + int const x_89 = x_6.x_GLF_uniform_int_values.arr[10].el; + int const x_91 = x_6.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_89] = -(x_91); + int const x_95 = x_6.x_GLF_uniform_int_values.arr[11].el; + int const x_97 = x_6.x_GLF_uniform_int_values.arr[1].el; + ref.arr[x_95] = -(x_97); + int const x_101 = x_6.x_GLF_uniform_int_values.arr[6].el; + int const x_103 = x_6.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_101] = -(x_103); + int const x_107 = x_6.x_GLF_uniform_int_values.arr[12].el; + int const x_109 = x_6.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_107] = -(x_109); + int const x_113 = x_6.x_GLF_uniform_int_values.arr[13].el; + int const x_115 = x_6.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_113] = -(x_115); + int const x_119 = x_6.x_GLF_uniform_int_values.arr[14].el; + int const x_121 = x_6.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_119] = -(x_121); + int const x_125 = x_6.x_GLF_uniform_int_values.arr[15].el; + int const x_127 = x_6.x_GLF_uniform_int_values.arr[2].el; + ref.arr[x_125] = -(x_127); + i = 0; + while (true) { + int const x_134 = i; + int const x_136 = x_6.x_GLF_uniform_int_values.arr[5].el; + if ((x_134 < x_136)) { + } else { + break; + } + int const x_139 = i; + int const x_140 = i; + int const x_142 = i; + int const x_145 = x_6.x_GLF_uniform_int_values.arr[1].el; + data.arr[x_139] = ~(clamp(~(x_140), ~(x_142), x_145)); + { + int const x_149 = i; + i = (x_149 + 1); + } + } + int const x_152 = x_6.x_GLF_uniform_int_values.arr[5].el; + i_1 = x_152; + while (true) { + int const x_157 = i_1; + int const x_159 = x_6.x_GLF_uniform_int_values.arr[6].el; + if ((x_157 < x_159)) { + } else { + break; + } + int const x_162 = i_1; + int const x_163 = i_1; + data.arr[x_162] = ~(clamp(~(x_163), 0, 1)); + { + int const x_168 = i_1; + i_1 = (x_168 + 1); + } + } + int const x_171 = x_6.x_GLF_uniform_int_values.arr[6].el; + i_2 = x_171; + while (true) { + int const x_176 = i_2; + int const x_178 = x_6.x_GLF_uniform_int_values.arr[7].el; + if ((x_176 < x_178)) { + } else { + break; + } + int const x_181 = i_2; + int const x_182 = i_2; + data.arr[x_181] = ~(clamp(x_182, 0, 1)); + { + int const x_186 = i_2; + i_2 = (x_186 + 1); + } + } + int const x_189 = x_6.x_GLF_uniform_int_values.arr[0].el; + i_3 = x_189; + while (true) { + int const x_194 = i_3; + int const x_196 = x_6.x_GLF_uniform_int_values.arr[7].el; + if ((x_194 < x_196)) { + } else { + break; + } + int const x_199 = i_3; + int const x_201 = data.arr[x_199]; + int const x_202 = i_3; + int const x_204 = ref.arr[x_202]; + if ((x_201 != x_204)) { + int const x_209 = x_6.x_GLF_uniform_int_values.arr[0].el; + float const x_210 = float(x_209); + *(tint_symbol_4) = float4(x_210, x_210, x_210, x_210); + return; + } + { + int const x_212 = i_3; + i_3 = (x_212 + 1); + } + } + int const x_215 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_218 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_221 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_224 = x_6.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_215), float(x_218), float(x_221), float(x_224)); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..0879b72ab5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,361 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 253 +; Schema: 0 + OpCapability Shader + %153 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %ref "ref" + OpName %i "i" + OpName %data "data" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %i_3 "i_3" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_16 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_15 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_int_uint_16 = OpTypeArray %int %uint_16 + %buf0 = OpTypeStruct %_arr_int_uint_16 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_15 = OpConstant %uint 15 +%_arr_int_uint_15 = OpTypeArray %int %uint_15 +%_ptr_Function__arr_int_uint_15 = OpTypePointer Function %_arr_int_uint_15 + %23 = OpConstantNull %_arr_int_uint_15 +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %int_11 = OpConstant %int 11 + %int_6 = OpConstant %int 6 + %int_12 = OpConstant %int 12 + %int_13 = OpConstant %int 13 + %int_14 = OpConstant %int 14 + %int_15 = OpConstant %int 15 + %bool = OpTypeBool + %int_7 = OpConstant %int 7 + %main_out = OpTypeStruct %v4float + %241 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %ref = OpVariable %_ptr_Function__arr_int_uint_15 Function %23 + %i = OpVariable %_ptr_Function_int Function %26 + %data = OpVariable %_ptr_Function__arr_int_uint_15 Function %23 + %i_1 = OpVariable %_ptr_Function_int Function %26 + %i_2 = OpVariable %_ptr_Function_int Function %26 + %i_3 = OpVariable %_ptr_Function_int Function %26 + %34 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %35 = OpLoad %int %34 + %36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %37 = OpLoad %int %36 + %38 = OpAccessChain %_ptr_Function_int %ref %35 + OpStore %38 %37 + %40 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Function_int %ref %41 + OpStore %44 %43 + %46 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %47 = OpLoad %int %46 + %48 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_Function_int %ref %47 + OpStore %50 %49 + %52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %53 = OpLoad %int %52 + %54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3 + %55 = OpLoad %int %54 + %56 = OpAccessChain %_ptr_Function_int %ref %53 + OpStore %56 %55 + %58 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Function_int %ref %59 + OpStore %62 %61 + %64 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %65 = OpLoad %int %64 + %66 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %67 = OpLoad %int %66 + %68 = OpAccessChain %_ptr_Function_int %ref %65 + %69 = OpSNegate %int %67 + OpStore %68 %69 + %71 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_8 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_Function_int %ref %72 + %76 = OpSNegate %int %74 + OpStore %75 %76 + %78 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_9 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %81 = OpLoad %int %80 + %82 = OpAccessChain %_ptr_Function_int %ref %79 + %83 = OpSNegate %int %81 + OpStore %82 %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_10 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %88 = OpLoad %int %87 + %89 = OpAccessChain %_ptr_Function_int %ref %86 + %90 = OpSNegate %int %88 + OpStore %89 %90 + %92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_11 + %93 = OpLoad %int %92 + %94 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %95 = OpLoad %int %94 + %96 = OpAccessChain %_ptr_Function_int %ref %93 + %97 = OpSNegate %int %95 + OpStore %96 %97 + %99 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %100 = OpLoad %int %99 + %101 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %102 = OpLoad %int %101 + %103 = OpAccessChain %_ptr_Function_int %ref %100 + %104 = OpSNegate %int %102 + OpStore %103 %104 + %106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_12 + %107 = OpLoad %int %106 + %108 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Function_int %ref %107 + %111 = OpSNegate %int %109 + OpStore %110 %111 + %113 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_13 + %114 = OpLoad %int %113 + %115 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %116 = OpLoad %int %115 + %117 = OpAccessChain %_ptr_Function_int %ref %114 + %118 = OpSNegate %int %116 + OpStore %117 %118 + %120 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_14 + %121 = OpLoad %int %120 + %122 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %123 = OpLoad %int %122 + %124 = OpAccessChain %_ptr_Function_int %ref %121 + %125 = OpSNegate %int %123 + OpStore %124 %125 + %127 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_15 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2 + %130 = OpLoad %int %129 + %131 = OpAccessChain %_ptr_Function_int %ref %128 + %132 = OpSNegate %int %130 + OpStore %131 %132 + OpStore %i %int_0 + OpBranch %133 + %133 = OpLabel + OpLoopMerge %134 %135 None + OpBranch %136 + %136 = OpLabel + %137 = OpLoad %int %i + %138 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %139 = OpLoad %int %138 + %140 = OpSLessThan %bool %137 %139 + OpSelectionMerge %142 None + OpBranchConditional %140 %143 %144 + %143 = OpLabel + OpBranch %142 + %144 = OpLabel + OpBranch %134 + %142 = OpLabel + %145 = OpLoad %int %i + %146 = OpLoad %int %i + %147 = OpLoad %int %i + %148 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %149 = OpLoad %int %148 + %150 = OpAccessChain %_ptr_Function_int %data %145 + %154 = OpNot %int %146 + %155 = OpNot %int %147 + %152 = OpExtInst %int %153 SClamp %154 %155 %149 + %151 = OpNot %int %152 + OpStore %150 %151 + OpBranch %135 + %135 = OpLabel + %156 = OpLoad %int %i + %157 = OpIAdd %int %156 %int_1 + OpStore %i %157 + OpBranch %133 + %134 = OpLabel + %158 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_5 + %159 = OpLoad %int %158 + OpStore %i_1 %159 + OpBranch %160 + %160 = OpLabel + OpLoopMerge %161 %162 None + OpBranch %163 + %163 = OpLabel + %164 = OpLoad %int %i_1 + %165 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %166 = OpLoad %int %165 + %167 = OpSLessThan %bool %164 %166 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %161 + %168 = OpLabel + %171 = OpLoad %int %i_1 + %172 = OpLoad %int %i_1 + %173 = OpAccessChain %_ptr_Function_int %data %171 + %176 = OpNot %int %172 + %175 = OpExtInst %int %153 SClamp %176 %int_0 %int_1 + %174 = OpNot %int %175 + OpStore %173 %174 + OpBranch %162 + %162 = OpLabel + %177 = OpLoad %int %i_1 + %178 = OpIAdd %int %177 %int_1 + OpStore %i_1 %178 + OpBranch %160 + %161 = OpLabel + %179 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_6 + %180 = OpLoad %int %179 + OpStore %i_2 %180 + OpBranch %181 + %181 = OpLabel + OpLoopMerge %182 %183 None + OpBranch %184 + %184 = OpLabel + %185 = OpLoad %int %i_2 + %187 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_7 + %188 = OpLoad %int %187 + %189 = OpSLessThan %bool %185 %188 + OpSelectionMerge %190 None + OpBranchConditional %189 %191 %192 + %191 = OpLabel + OpBranch %190 + %192 = OpLabel + OpBranch %182 + %190 = OpLabel + %193 = OpLoad %int %i_2 + %194 = OpLoad %int %i_2 + %195 = OpAccessChain %_ptr_Function_int %data %193 + %197 = OpExtInst %int %153 SClamp %194 %int_0 %int_1 + %196 = OpNot %int %197 + OpStore %195 %196 + OpBranch %183 + %183 = OpLabel + %198 = OpLoad %int %i_2 + %199 = OpIAdd %int %198 %int_1 + OpStore %i_2 %199 + OpBranch %181 + %182 = OpLabel + %200 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %201 = OpLoad %int %200 + OpStore %i_3 %201 + OpBranch %202 + %202 = OpLabel + OpLoopMerge %203 %204 None + OpBranch %205 + %205 = OpLabel + %206 = OpLoad %int %i_3 + %207 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_7 + %208 = OpLoad %int %207 + %209 = OpSLessThan %bool %206 %208 + OpSelectionMerge %210 None + OpBranchConditional %209 %211 %212 + %211 = OpLabel + OpBranch %210 + %212 = OpLabel + OpBranch %203 + %210 = OpLabel + %213 = OpLoad %int %i_3 + %214 = OpAccessChain %_ptr_Function_int %data %213 + %215 = OpLoad %int %214 + %216 = OpLoad %int %i_3 + %217 = OpAccessChain %_ptr_Function_int %ref %216 + %218 = OpLoad %int %217 + %219 = OpINotEqual %bool %215 %218 + OpSelectionMerge %220 None + OpBranchConditional %219 %221 %220 + %221 = OpLabel + %222 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %223 = OpLoad %int %222 + %224 = OpConvertSToF %float %223 + %225 = OpCompositeConstruct %v4float %224 %224 %224 %224 + OpStore %x_GLF_color %225 + OpReturn + %220 = OpLabel + OpBranch %204 + %204 = OpLabel + %226 = OpLoad %int %i_3 + %227 = OpIAdd %int %226 %int_1 + OpStore %i_3 %227 + OpBranch %202 + %203 = OpLabel + %228 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %229 = OpLoad %int %228 + %230 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %231 = OpLoad %int %230 + %232 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %233 = OpLoad %int %232 + %234 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %235 = OpLoad %int %234 + %236 = OpConvertSToF %float %229 + %237 = OpConvertSToF %float %231 + %238 = OpConvertSToF %float %233 + %239 = OpConvertSToF %float %235 + %240 = OpCompositeConstruct %v4float %236 %237 %238 %239 + OpStore %x_GLF_color %240 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %241 +%tint_symbol = OpFunctionParameter %main_out + %245 = OpLabel + %246 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %246 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %248 = OpLabel + %249 = OpFunctionCall %void %main_1 + %251 = OpLoad %v4float %x_GLF_color + %252 = OpCompositeConstruct %main_out %251 + %250 = OpFunctionCall %void %tint_symbol_2 %252 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..2dc09e0bd3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-selection-dag-negation-clamp-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,161 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var ref : array; + var i : i32; + var data : array; + var i_1 : i32; + var i_2 : i32; + var i_3 : i32; + let x_46 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_48 : i32 = x_6.x_GLF_uniform_int_values[0]; + ref[x_46] = x_48; + let x_51 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_53 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_51] = x_53; + let x_56 : i32 = x_6.x_GLF_uniform_int_values[2]; + let x_58 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_56] = x_58; + let x_61 : i32 = x_6.x_GLF_uniform_int_values[3]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[3]; + ref[x_61] = x_63; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[4]; + let x_68 : i32 = x_6.x_GLF_uniform_int_values[4]; + ref[x_66] = x_68; + let x_71 : i32 = x_6.x_GLF_uniform_int_values[5]; + let x_73 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_71] = -(x_73); + let x_77 : i32 = x_6.x_GLF_uniform_int_values[8]; + let x_79 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_77] = -(x_79); + let x_83 : i32 = x_6.x_GLF_uniform_int_values[9]; + let x_85 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_83] = -(x_85); + let x_89 : i32 = x_6.x_GLF_uniform_int_values[10]; + let x_91 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_89] = -(x_91); + let x_95 : i32 = x_6.x_GLF_uniform_int_values[11]; + let x_97 : i32 = x_6.x_GLF_uniform_int_values[1]; + ref[x_95] = -(x_97); + let x_101 : i32 = x_6.x_GLF_uniform_int_values[6]; + let x_103 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_101] = -(x_103); + let x_107 : i32 = x_6.x_GLF_uniform_int_values[12]; + let x_109 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_107] = -(x_109); + let x_113 : i32 = x_6.x_GLF_uniform_int_values[13]; + let x_115 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_113] = -(x_115); + let x_119 : i32 = x_6.x_GLF_uniform_int_values[14]; + let x_121 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_119] = -(x_121); + let x_125 : i32 = x_6.x_GLF_uniform_int_values[15]; + let x_127 : i32 = x_6.x_GLF_uniform_int_values[2]; + ref[x_125] = -(x_127); + i = 0; + loop { + let x_134 : i32 = i; + let x_136 : i32 = x_6.x_GLF_uniform_int_values[5]; + if ((x_134 < x_136)) { + } else { + break; + } + let x_139 : i32 = i; + let x_140 : i32 = i; + let x_142 : i32 = i; + let x_145 : i32 = x_6.x_GLF_uniform_int_values[1]; + data[x_139] = ~(clamp(~(x_140), ~(x_142), x_145)); + + continuing { + let x_149 : i32 = i; + i = (x_149 + 1); + } + } + let x_152 : i32 = x_6.x_GLF_uniform_int_values[5]; + i_1 = x_152; + loop { + let x_157 : i32 = i_1; + let x_159 : i32 = x_6.x_GLF_uniform_int_values[6]; + if ((x_157 < x_159)) { + } else { + break; + } + let x_162 : i32 = i_1; + let x_163 : i32 = i_1; + data[x_162] = ~(clamp(~(x_163), 0, 1)); + + continuing { + let x_168 : i32 = i_1; + i_1 = (x_168 + 1); + } + } + let x_171 : i32 = x_6.x_GLF_uniform_int_values[6]; + i_2 = x_171; + loop { + let x_176 : i32 = i_2; + let x_178 : i32 = x_6.x_GLF_uniform_int_values[7]; + if ((x_176 < x_178)) { + } else { + break; + } + let x_181 : i32 = i_2; + let x_182 : i32 = i_2; + data[x_181] = ~(clamp(x_182, 0, 1)); + + continuing { + let x_186 : i32 = i_2; + i_2 = (x_186 + 1); + } + } + let x_189 : i32 = x_6.x_GLF_uniform_int_values[0]; + i_3 = x_189; + loop { + let x_194 : i32 = i_3; + let x_196 : i32 = x_6.x_GLF_uniform_int_values[7]; + if ((x_194 < x_196)) { + } else { + break; + } + let x_199 : i32 = i_3; + let x_201 : i32 = data[x_199]; + let x_202 : i32 = i_3; + let x_204 : i32 = ref[x_202]; + if ((x_201 != x_204)) { + let x_209 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_210 : f32 = f32(x_209); + x_GLF_color = vec4(x_210, x_210, x_210, x_210); + return; + } + + continuing { + let x_212 : i32 = i_3; + i_3 = (x_212 + 1); + } + } + let x_215 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_218 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_221 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_224 : i32 = x_6.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_215), f32(x_218), f32(x_221), f32(x_224)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm new file mode 100644 index 0000000000..91ff6bc491 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm @@ -0,0 +1,86 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %N "N" + OpName %I "I" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "quarter" + OpName %_ "" + OpName %Nref "Nref" + OpName %v "v" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %19 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 +%float_87_5899963 = OpConstant %float 87.5899963 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_92_5100021 = OpConstant %float 92.5100021 +%float_17_0499992 = OpConstant %float 17.0499992 +%float_n6_0999999 = OpConstant %float -6.0999999 +%float_4329_37061 = OpConstant %float 4329.37061 +%float_2_70000005 = OpConstant %float 2.70000005 + %30 = OpConstantComposite %v4float %float_17_0499992 %float_n6_0999999 %float_4329_37061 %float_2_70000005 + %float_n1 = OpConstant %float -1 + %float_n2 = OpConstant %float -2 + %float_n3 = OpConstant %float -3 + %float_n4 = OpConstant %float -4 + %35 = OpConstantComposite %v4float %float_n1 %float_n2 %float_n3 %float_n4 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %40 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %41 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %11 + %42 = OpLabel + %N = OpVariable %_ptr_Function_v4float Function + %I = OpVariable %_ptr_Function_v4float Function + %Nref = OpVariable %_ptr_Function_v4float Function + %v = OpVariable %_ptr_Function_v4float Function + OpStore %N %19 + %43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %44 = OpLoad %float %43 + %45 = OpCompositeConstruct %v4float %float_4 %float_87_5899963 %44 %float_92_5100021 + OpStore %I %45 + OpStore %Nref %30 + %46 = OpLoad %v4float %N + %47 = OpLoad %v4float %I + %48 = OpLoad %v4float %Nref + %49 = OpExtInst %v4float %1 FaceForward %46 %47 %48 + OpStore %v %49 + %50 = OpLoad %v4float %v + %51 = OpFOrdEqual %v4bool %50 %35 + %52 = OpAll %bool %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + OpStore %_GLF_color %40 + OpBranch %53 + %55 = OpLabel + OpStore %_GLF_color %41 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..11fb504acc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.hlsl @@ -0,0 +1,36 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 N = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 I = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 Nref = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + N = float4(1.0f, 2.0f, 3.0f, 4.0f); + const float x_44 = asfloat(x_7[0].x); + I = float4(4.0f, 87.589996338f, x_44, 92.510002136f); + Nref = float4(17.049999237f, -6.099999905f, 4329.370605469f, 2.700000048f); + v = faceforward(N, I, Nref); + if (all((v == float4(-1.0f, -2.0f, -3.0f, -4.0f)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..0c883ed02d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float quarter; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + float4 N = 0.0f; + float4 I = 0.0f; + float4 Nref = 0.0f; + float4 v = 0.0f; + N = float4(1.0f, 2.0f, 3.0f, 4.0f); + float const x_44 = x_7.quarter; + I = float4(4.0f, 87.589996338f, x_44, 92.510002136f); + Nref = float4(17.049999237f, -6.099999905f, 4329.370605469f, 2.700000048f); + float4 const x_46 = N; + float4 const x_47 = I; + float4 const x_48 = Nref; + v = faceforward(x_46, x_47, x_48); + float4 const x_50 = v; + if (all((x_50 == float4(-1.0f, -2.0f, -3.0f, -4.0f)))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..bba0bd0bf3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.spvasm @@ -0,0 +1,118 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %42 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "quarter" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %N "N" + OpName %I "I" + OpName %Nref "Nref" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_87_5899963 = OpConstant %float 87.5899963 +%float_92_5100021 = OpConstant %float 92.5100021 +%float_17_0499992 = OpConstant %float 17.0499992 +%float_n6_0999999 = OpConstant %float -6.0999999 +%float_4329_37061 = OpConstant %float 4329.37061 +%float_2_70000005 = OpConstant %float 2.70000005 + %37 = OpConstantComposite %v4float %float_17_0499992 %float_n6_0999999 %float_4329_37061 %float_2_70000005 + %bool = OpTypeBool + %float_n1 = OpConstant %float -1 + %float_n2 = OpConstant %float -2 + %float_n3 = OpConstant %float -3 + %float_n4 = OpConstant %float -4 + %50 = OpConstantComposite %v4float %float_n1 %float_n2 %float_n3 %float_n4 + %v4bool = OpTypeVector %bool 4 + %float_0 = OpConstant %float 0 + %57 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %58 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %59 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %N = OpVariable %_ptr_Function_v4float Function %8 + %I = OpVariable %_ptr_Function_v4float Function %8 + %Nref = OpVariable %_ptr_Function_v4float Function %8 + %v = OpVariable %_ptr_Function_v4float Function %8 + OpStore %N %24 + %28 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %29 = OpLoad %float %28 + %32 = OpCompositeConstruct %v4float %float_4 %float_87_5899963 %29 %float_92_5100021 + OpStore %I %32 + OpStore %Nref %37 + %38 = OpLoad %v4float %N + %39 = OpLoad %v4float %I + %40 = OpLoad %v4float %Nref + %41 = OpExtInst %v4float %42 FaceForward %38 %39 %40 + OpStore %v %41 + %43 = OpLoad %v4float %v + %51 = OpFOrdEqual %v4bool %43 %50 + %44 = OpAll %bool %51 + OpSelectionMerge %53 None + OpBranchConditional %44 %54 %55 + %54 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %53 + %55 = OpLabel + OpStore %x_GLF_color %58 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %59 +%tint_symbol = OpFunctionParameter %main_out + %63 = OpLabel + %64 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %64 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %66 = OpLabel + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_2 %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..40281ef28c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.spvasm.expected.wgsl @@ -0,0 +1,41 @@ +[[block]] +struct buf0 { + quarter : f32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var N : vec4; + var I : vec4; + var Nref : vec4; + var v : vec4; + N = vec4(1.0, 2.0, 3.0, 4.0); + let x_44 : f32 = x_7.quarter; + I = vec4(4.0, 87.589996338, x_44, 92.510002136); + Nref = vec4(17.049999237, -6.099999905, 4329.370605469, 2.700000048); + let x_46 : vec4 = N; + let x_47 : vec4 = I; + let x_48 : vec4 = Nref; + v = faceForward(x_46, x_47, x_48); + let x_50 : vec4 = v; + if (all((x_50 == vec4(-1.0, -2.0, -3.0, -4.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl new file mode 100644 index 0000000000..40281ef28c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl @@ -0,0 +1,41 @@ +[[block]] +struct buf0 { + quarter : f32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var N : vec4; + var I : vec4; + var Nref : vec4; + var v : vec4; + N = vec4(1.0, 2.0, 3.0, 4.0); + let x_44 : f32 = x_7.quarter; + I = vec4(4.0, 87.589996338, x_44, 92.510002136); + Nref = vec4(17.049999237, -6.099999905, 4329.370605469, 2.700000048); + let x_46 : vec4 = N; + let x_47 : vec4 = I; + let x_48 : vec4 = Nref; + v = faceForward(x_46, x_47, x_48); + let x_50 : vec4 = v; + if (all((x_50 == vec4(-1.0, -2.0, -3.0, -4.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..11fb504acc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 N = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 I = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 Nref = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f); + N = float4(1.0f, 2.0f, 3.0f, 4.0f); + const float x_44 = asfloat(x_7[0].x); + I = float4(4.0f, 87.589996338f, x_44, 92.510002136f); + Nref = float4(17.049999237f, -6.099999905f, 4329.370605469f, 2.700000048f); + v = faceforward(N, I, Nref); + if (all((v == float4(-1.0f, -2.0f, -3.0f, -4.0f)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..0c883ed02d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.msl @@ -0,0 +1,43 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float quarter; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + float4 N = 0.0f; + float4 I = 0.0f; + float4 Nref = 0.0f; + float4 v = 0.0f; + N = float4(1.0f, 2.0f, 3.0f, 4.0f); + float const x_44 = x_7.quarter; + I = float4(4.0f, 87.589996338f, x_44, 92.510002136f); + Nref = float4(17.049999237f, -6.099999905f, 4329.370605469f, 2.700000048f); + float4 const x_46 = N; + float4 const x_47 = I; + float4 const x_48 = Nref; + v = faceforward(x_46, x_47, x_48); + float4 const x_50 = v; + if (all((x_50 == float4(-1.0f, -2.0f, -3.0f, -4.0f)))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..bba0bd0bf3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.spvasm @@ -0,0 +1,118 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %42 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "quarter" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %N "N" + OpName %I "I" + OpName %Nref "Nref" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_87_5899963 = OpConstant %float 87.5899963 +%float_92_5100021 = OpConstant %float 92.5100021 +%float_17_0499992 = OpConstant %float 17.0499992 +%float_n6_0999999 = OpConstant %float -6.0999999 +%float_4329_37061 = OpConstant %float 4329.37061 +%float_2_70000005 = OpConstant %float 2.70000005 + %37 = OpConstantComposite %v4float %float_17_0499992 %float_n6_0999999 %float_4329_37061 %float_2_70000005 + %bool = OpTypeBool + %float_n1 = OpConstant %float -1 + %float_n2 = OpConstant %float -2 + %float_n3 = OpConstant %float -3 + %float_n4 = OpConstant %float -4 + %50 = OpConstantComposite %v4float %float_n1 %float_n2 %float_n3 %float_n4 + %v4bool = OpTypeVector %bool 4 + %float_0 = OpConstant %float 0 + %57 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %58 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %59 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %N = OpVariable %_ptr_Function_v4float Function %8 + %I = OpVariable %_ptr_Function_v4float Function %8 + %Nref = OpVariable %_ptr_Function_v4float Function %8 + %v = OpVariable %_ptr_Function_v4float Function %8 + OpStore %N %24 + %28 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %29 = OpLoad %float %28 + %32 = OpCompositeConstruct %v4float %float_4 %float_87_5899963 %29 %float_92_5100021 + OpStore %I %32 + OpStore %Nref %37 + %38 = OpLoad %v4float %N + %39 = OpLoad %v4float %I + %40 = OpLoad %v4float %Nref + %41 = OpExtInst %v4float %42 FaceForward %38 %39 %40 + OpStore %v %41 + %43 = OpLoad %v4float %v + %51 = OpFOrdEqual %v4bool %43 %50 + %44 = OpAll %bool %51 + OpSelectionMerge %53 None + OpBranchConditional %44 %54 %55 + %54 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %53 + %55 = OpLabel + OpStore %x_GLF_color %58 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %59 +%tint_symbol = OpFunctionParameter %main_out + %63 = OpLabel + %64 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %64 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %66 = OpLabel + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_2 %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..40281ef28c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-value-tracking-uniform-incident/0-opt.wgsl.expected.wgsl @@ -0,0 +1,41 @@ +[[block]] +struct buf0 { + quarter : f32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var N : vec4; + var I : vec4; + var Nref : vec4; + var v : vec4; + N = vec4(1.0, 2.0, 3.0, 4.0); + let x_44 : f32 = x_7.quarter; + I = vec4(4.0, 87.589996338, x_44, 92.510002136); + Nref = vec4(17.049999237, -6.099999905, 4329.370605469, 2.700000048); + let x_46 : vec4 = N; + let x_47 : vec4 = I; + let x_48 : vec4 = Nref; + v = faceForward(x_46, x_47, x_48); + let x_50 : vec4 = v; + if (all((x_50 == vec4(-1.0, -2.0, -3.0, -4.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm new file mode 100644 index 0000000000..d1e03b7884 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm @@ -0,0 +1,86 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %b "b" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v2float %float_1 %float_1 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %27 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %29 = OpConstantComposite %v2float %float_3 %float_4 + %v2bool = OpTypeVector %bool 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %34 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %9 + %36 = OpLabel + %a = OpVariable %_ptr_Function_v2float Function + %b = OpVariable %_ptr_Function_v2float Function + OpStore %a %14 + %37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %38 = OpLoad %int %37 + %39 = OpIEqual %bool %38 %int_1 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + %42 = OpAccessChain %_ptr_Function_float %a %uint_0 + %43 = OpLoad %float %42 + %44 = OpFAdd %float %43 %float_1 + %45 = OpAccessChain %_ptr_Function_float %a %uint_0 + OpStore %45 %44 + OpBranch %40 + %40 = OpLabel + %46 = OpAccessChain %_ptr_Function_float %a %uint_1 + %47 = OpLoad %float %46 + %48 = OpCompositeConstruct %v2float %47 %47 + %49 = OpFAdd %v2float %48 %27 + OpStore %b %49 + %50 = OpLoad %v2float %b + %51 = OpFOrdEqual %v2bool %50 %29 + %52 = OpAll %bool %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + OpStore %_GLF_color %34 + OpBranch %53 + %55 = OpLabel + OpStore %_GLF_color %35 + OpBranch %53 + %53 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..d6dd5f85b7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,37 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 a = float2(0.0f, 0.0f); + float2 b = float2(0.0f, 0.0f); + a = float2(1.0f, 1.0f); + const int x_38 = asint(x_6[0].x); + if ((x_38 == 1)) { + const float x_43 = a.x; + a.x = (x_43 + 1.0f); + } + const float x_47 = a.y; + b = (float2(x_47, x_47) + float2(2.0f, 3.0f)); + if (all((b == float2(3.0f, 4.0f)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..9bf6ea8839 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2 a = 0.0f; + float2 b = 0.0f; + a = float2(1.0f, 1.0f); + int const x_38 = x_6.zero; + if ((x_38 == 1)) { + float const x_43 = a.x; + a.x = (x_43 + 1.0f); + } + float const x_47 = a.y; + b = (float2(x_47, x_47) + float2(2.0f, 3.0f)); + float2 const x_50 = b; + if (all((x_50 == float2(3.0f, 4.0f)))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..a8b0d8ccfc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,117 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 70 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %19 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v2float %float_1 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %44 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %49 = OpConstantComposite %v2float %float_3 %float_4 + %v2bool = OpTypeVector %bool 2 + %float_0 = OpConstant %float 0 + %56 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %57 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_v2float Function %19 + %b = OpVariable %_ptr_Function_v2float Function %19 + OpStore %a %22 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %27 = OpLoad %int %26 + %29 = OpIEqual %bool %27 %int_1 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %31 + %32 = OpLabel + %34 = OpAccessChain %_ptr_Function_float %a %uint_0 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Function_float %a %uint_0 + %37 = OpFAdd %float %35 %float_1 + OpStore %36 %37 + OpBranch %31 + %31 = OpLabel + %39 = OpAccessChain %_ptr_Function_float %a %uint_1 + %40 = OpLoad %float %39 + %41 = OpCompositeConstruct %v2float %40 %40 + %45 = OpFAdd %v2float %41 %44 + OpStore %b %45 + %46 = OpLoad %v2float %b + %50 = OpFOrdEqual %v2bool %46 %49 + %47 = OpAll %bool %50 + OpSelectionMerge %52 None + OpBranchConditional %47 %53 %54 + %53 = OpLabel + OpStore %x_GLF_color %56 + OpBranch %52 + %54 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %58 +%tint_symbol = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %65 = OpLabel + %66 = OpFunctionCall %void %main_1 + %68 = OpLoad %v4float %x_GLF_color + %69 = OpCompositeConstruct %main_out %68 + %67 = OpFunctionCall %void %tint_symbol_2 %69 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ef1ccfe834 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : vec2; + var b : vec2; + a = vec2(1.0, 1.0); + let x_38 : i32 = x_6.zero; + if ((x_38 == 1)) { + let x_43 : f32 = a.x; + a.x = (x_43 + 1.0); + } + let x_47 : f32 = a.y; + b = (vec2(x_47, x_47) + vec2(2.0, 3.0)); + let x_50 : vec2 = b; + if (all((x_50 == vec2(3.0, 4.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl new file mode 100644 index 0000000000..ef1ccfe834 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl @@ -0,0 +1,39 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : vec2; + var b : vec2; + a = vec2(1.0, 1.0); + let x_38 : i32 = x_6.zero; + if ((x_38 == 1)) { + let x_43 : f32 = a.x; + a.x = (x_43 + 1.0); + } + let x_47 : f32 = a.y; + b = (vec2(x_47, x_47) + vec2(2.0, 3.0)); + let x_50 : vec2 = b; + if (all((x_50 == vec2(3.0, 4.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d6dd5f85b7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 a = float2(0.0f, 0.0f); + float2 b = float2(0.0f, 0.0f); + a = float2(1.0f, 1.0f); + const int x_38 = asint(x_6[0].x); + if ((x_38 == 1)) { + const float x_43 = a.x; + a.x = (x_43 + 1.0f); + } + const float x_47 = a.y; + b = (float2(x_47, x_47) + float2(2.0f, 3.0f)); + if (all((b == float2(3.0f, 4.0f)))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..9bf6ea8839 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float2 a = 0.0f; + float2 b = 0.0f; + a = float2(1.0f, 1.0f); + int const x_38 = x_6.zero; + if ((x_38 == 1)) { + float const x_43 = a.x; + a.x = (x_43 + 1.0f); + } + float const x_47 = a.y; + b = (float2(x_47, x_47) + float2(2.0f, 3.0f)); + float2 const x_50 = b; + if (all((x_50 == float2(3.0f, 4.0f)))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..a8b0d8ccfc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,117 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 70 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %19 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v2float %float_1 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %44 = OpConstantComposite %v2float %float_2 %float_3 + %float_4 = OpConstant %float 4 + %49 = OpConstantComposite %v2float %float_3 %float_4 + %v2bool = OpTypeVector %bool 2 + %float_0 = OpConstant %float 0 + %56 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %57 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %a = OpVariable %_ptr_Function_v2float Function %19 + %b = OpVariable %_ptr_Function_v2float Function %19 + OpStore %a %22 + %26 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 + %27 = OpLoad %int %26 + %29 = OpIEqual %bool %27 %int_1 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %31 + %32 = OpLabel + %34 = OpAccessChain %_ptr_Function_float %a %uint_0 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Function_float %a %uint_0 + %37 = OpFAdd %float %35 %float_1 + OpStore %36 %37 + OpBranch %31 + %31 = OpLabel + %39 = OpAccessChain %_ptr_Function_float %a %uint_1 + %40 = OpLoad %float %39 + %41 = OpCompositeConstruct %v2float %40 %40 + %45 = OpFAdd %v2float %41 %44 + OpStore %b %45 + %46 = OpLoad %v2float %b + %50 = OpFOrdEqual %v2bool %46 %49 + %47 = OpAll %bool %50 + OpSelectionMerge %52 None + OpBranchConditional %47 %53 %54 + %53 = OpLabel + OpStore %x_GLF_color %56 + OpBranch %52 + %54 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %58 +%tint_symbol = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %65 = OpLabel + %66 = OpFunctionCall %void %main_1 + %68 = OpLoad %v4float %x_GLF_color + %69 = OpCompositeConstruct %main_out %68 + %67 = OpFunctionCall %void %tint_symbol_2 %69 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ef1ccfe834 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-inc-unused-comp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,39 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var a : vec2; + var b : vec2; + a = vec2(1.0, 1.0); + let x_38 : i32 = x_6.zero; + if ((x_38 == 1)) { + let x_43 : f32 = a.x; + a.x = (x_43 + 1.0); + } + let x_47 : f32 = a.y; + b = (vec2(x_47, x_47) + vec2(2.0, 3.0)); + let x_50 : vec2 = b; + if (all((x_50 == vec2(3.0, 4.0)))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm new file mode 100644 index 0000000000..746f3a7f47 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm @@ -0,0 +1,56 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %b "b" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v2float %float_1 %float_1 + %float_0_5 = OpConstant %float 0.5 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %7 + %23 = OpLabel + %a = OpVariable %_ptr_Function_v2float Function + %b = OpVariable %_ptr_Function_v2float Function + OpStore %a %12 + %24 = OpAccessChain %_ptr_Function_float %a %uint_0 + %25 = OpLoad %float %24 + %26 = OpFAdd %float %25 %float_0_5 + %27 = OpAccessChain %_ptr_Function_float %a %uint_0 + OpStore %27 %26 + %28 = OpLoad %v2float %a + %29 = OpExtInst %v2float %1 Fract %28 + OpStore %b %29 + %30 = OpAccessChain %_ptr_Function_float %b %uint_0 + %31 = OpLoad %float %30 + %32 = OpFOrdEqual %bool %31 %float_0_5 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + OpStore %_GLF_color %21 + OpBranch %33 + %35 = OpLabel + OpStore %_GLF_color %22 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..b0f9a87a01 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.hlsl @@ -0,0 +1,31 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 a = float2(0.0f, 0.0f); + float2 b = float2(0.0f, 0.0f); + a = float2(1.0f, 1.0f); + const float x_25 = a.x; + a.x = (x_25 + 0.5f); + b = frac(a); + const float x_31 = b.x; + if ((x_31 == 0.5f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f64ba57679 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float2 a = 0.0f; + float2 b = 0.0f; + a = float2(1.0f, 1.0f); + float const x_25 = a.x; + a.x = (x_25 + 0.5f); + float2 const x_28 = a; + b = fract(x_28); + float const x_31 = b.x; + if ((x_31 == 0.5f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..0722d669c1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %29 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v2float %float_1 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %40 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %a = OpVariable %_ptr_Function_v2float Function %15 + %b = OpVariable %_ptr_Function_v2float Function %15 + OpStore %a %18 + %22 = OpAccessChain %_ptr_Function_float %a %uint_0 + %23 = OpLoad %float %22 + %24 = OpAccessChain %_ptr_Function_float %a %uint_0 + %26 = OpFAdd %float %23 %float_0_5 + OpStore %24 %26 + %27 = OpLoad %v2float %a + %28 = OpExtInst %v2float %29 Fract %27 + OpStore %b %28 + %30 = OpAccessChain %_ptr_Function_float %b %uint_0 + %31 = OpLoad %float %30 + %32 = OpFOrdEqual %bool %31 %float_0_5 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + OpStore %x_GLF_color %38 + OpBranch %34 + %36 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %40 +%tint_symbol = OpFunctionParameter %main_out + %44 = OpLabel + %45 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %45 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %47 = OpLabel + %48 = OpFunctionCall %void %main_1 + %50 = OpLoad %v4float %x_GLF_color + %51 = OpCompositeConstruct %main_out %50 + %49 = OpFunctionCall %void %tint_symbol_2 %51 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5be733957f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : vec2; + var b : vec2; + a = vec2(1.0, 1.0); + let x_25 : f32 = a.x; + a.x = (x_25 + 0.5); + let x_28 : vec2 = a; + b = fract(x_28); + let x_31 : f32 = b.x; + if ((x_31 == 0.5)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl new file mode 100644 index 0000000000..5be733957f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl @@ -0,0 +1,29 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : vec2; + var b : vec2; + a = vec2(1.0, 1.0); + let x_25 : f32 = a.x; + a.x = (x_25 + 0.5); + let x_28 : vec2 = a; + b = fract(x_28); + let x_31 : f32 = b.x; + if ((x_31 == 0.5)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..b0f9a87a01 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 a = float2(0.0f, 0.0f); + float2 b = float2(0.0f, 0.0f); + a = float2(1.0f, 1.0f); + const float x_25 = a.x; + a.x = (x_25 + 0.5f); + b = frac(a); + const float x_31 = b.x; + if ((x_31 == 0.5f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f64ba57679 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float2 a = 0.0f; + float2 b = 0.0f; + a = float2(1.0f, 1.0f); + float const x_25 = a.x; + a.x = (x_25 + 0.5f); + float2 const x_28 = a; + b = fract(x_28); + float const x_31 = b.x; + if ((x_31 == 0.5f)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..0722d669c1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.spvasm @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %29 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v2float %float_1 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %40 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %a = OpVariable %_ptr_Function_v2float Function %15 + %b = OpVariable %_ptr_Function_v2float Function %15 + OpStore %a %18 + %22 = OpAccessChain %_ptr_Function_float %a %uint_0 + %23 = OpLoad %float %22 + %24 = OpAccessChain %_ptr_Function_float %a %uint_0 + %26 = OpFAdd %float %23 %float_0_5 + OpStore %24 %26 + %27 = OpLoad %v2float %a + %28 = OpExtInst %v2float %29 Fract %27 + OpStore %b %28 + %30 = OpAccessChain %_ptr_Function_float %b %uint_0 + %31 = OpLoad %float %30 + %32 = OpFOrdEqual %bool %31 %float_0_5 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + OpStore %x_GLF_color %38 + OpBranch %34 + %36 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %40 +%tint_symbol = OpFunctionParameter %main_out + %44 = OpLabel + %45 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %45 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %47 = OpLabel + %48 = OpFunctionCall %void %main_1 + %50 = OpLoad %v4float %x_GLF_color + %51 = OpCompositeConstruct %main_out %50 + %49 = OpFunctionCall %void %tint_symbol_2 %51 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5be733957f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-dce-unused-component/0-opt.wgsl.expected.wgsl @@ -0,0 +1,29 @@ +var x_GLF_color : vec4; + +fn main_1() { + var a : vec2; + var b : vec2; + a = vec2(1.0, 1.0); + let x_25 : f32 = a.x; + a.x = (x_25 + 0.5); + let x_28 : vec2 = a; + b = fract(x_28); + let x_31 : f32 = b.x; + if ((x_31 == 0.5)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm new file mode 100644 index 0000000000..b4a995ab61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm @@ -0,0 +1,51 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v "v" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 + %float_100 = OpConstant %float 100 + %12 = OpConstantComposite %v2float %float_1 %float_100 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %6 + %23 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function + %24 = OpExtInst %v2float %1 Cosh %12 + %25 = OpExtInst %v2float %1 Log2 %24 + OpStore %v %25 + %26 = OpAccessChain %_ptr_Function_float %v %uint_0 + %27 = OpLoad %float %26 + %28 = OpAccessChain %_ptr_Function_float %v %uint_1 + %29 = OpLoad %float %28 + %30 = OpFOrdLessThan %bool %27 %29 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + OpStore %_GLF_color %21 + OpBranch %31 + %33 = OpLabel + OpStore %_GLF_color %22 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..c513660e0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v = float2(0.0f, 0.0f); + v = log2(cosh(float2(1.0f, 100.0f))); + const float x_27 = v.x; + const float x_29 = v.y; + if ((x_27 < x_29)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d1585b5e07 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float2 v = 0.0f; + v = log2(cosh(float2(1.0f, 100.0f))); + float const x_27 = v.x; + float const x_29 = v.y; + if ((x_27 < x_29)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..77d618288e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %float_100 = OpConstant %float 100 + %21 = OpConstantComposite %v2float %float_1 %float_100 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %37 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %15 + %18 = OpExtInst %v2float %17 Cosh %21 + %16 = OpExtInst %v2float %17 Log2 %18 + OpStore %v %16 + %25 = OpAccessChain %_ptr_Function_float %v %uint_0 + %26 = OpLoad %float %25 + %28 = OpAccessChain %_ptr_Function_float %v %uint_1 + %29 = OpLoad %float %28 + %30 = OpFOrdLessThan %bool %26 %29 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpStore %x_GLF_color %36 + OpBranch %32 + %34 = OpLabel + OpStore %x_GLF_color %37 + OpBranch %32 + %32 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %38 +%tint_symbol = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %45 = OpLabel + %46 = OpFunctionCall %void %main_1 + %48 = OpLoad %v4float %x_GLF_color + %49 = OpCompositeConstruct %main_out %48 + %47 = OpFunctionCall %void %tint_symbol_2 %49 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..2cecb75f66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +var x_GLF_color : vec4; + +fn main_1() { + var v : vec2; + v = log2(cosh(vec2(1.0, 100.0))); + let x_27 : f32 = v.x; + let x_29 : f32 = v.y; + if ((x_27 < x_29)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl new file mode 100644 index 0000000000..2cecb75f66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl @@ -0,0 +1,25 @@ +var x_GLF_color : vec4; + +fn main_1() { + var v : vec2; + v = log2(cosh(vec2(1.0, 100.0))); + let x_27 : f32 = v.x; + let x_29 : f32 = v.y; + if ((x_27 < x_29)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..c513660e0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v = float2(0.0f, 0.0f); + v = log2(cosh(float2(1.0f, 100.0f))); + const float x_27 = v.x; + const float x_29 = v.y; + if ((x_27 < x_29)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d1585b5e07 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float2 v = 0.0f; + v = log2(cosh(float2(1.0f, 100.0f))); + float const x_27 = v.x; + float const x_29 = v.y; + if ((x_27 < x_29)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..77d618288e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %17 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v "v" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float + %float_1 = OpConstant %float 1 + %float_100 = OpConstant %float 100 + %21 = OpConstantComposite %v2float %float_1 %float_100 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %37 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %15 + %18 = OpExtInst %v2float %17 Cosh %21 + %16 = OpExtInst %v2float %17 Log2 %18 + OpStore %v %16 + %25 = OpAccessChain %_ptr_Function_float %v %uint_0 + %26 = OpLoad %float %25 + %28 = OpAccessChain %_ptr_Function_float %v %uint_1 + %29 = OpLoad %float %28 + %30 = OpFOrdLessThan %bool %26 %29 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpStore %x_GLF_color %36 + OpBranch %32 + %34 = OpLabel + OpStore %x_GLF_color %37 + OpBranch %32 + %32 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %38 +%tint_symbol = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %45 = OpLabel + %46 = OpFunctionCall %void %main_1 + %48 = OpLoad %v4float %x_GLF_color + %49 = OpCompositeConstruct %main_out %48 + %47 = OpFunctionCall %void %tint_symbol_2 %49 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..2cecb75f66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-vector-log2-cosh/0-opt.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +var x_GLF_color : vec4; + +fn main_1() { + var v : vec2; + v = log2(cosh(vec2(1.0, 100.0))); + let x_27 : f32 = v.x; + let x_29 : f32 = v.y; + if ((x_27 < x_29)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm new file mode 100644 index 0000000000..96a060dca1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm @@ -0,0 +1,91 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_i1_ "func(i1;" + OpName %x "x" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %i "i" + OpName %param "param" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpTypeFunction %void %_ptr_Function_int + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_8 = OpConstant %int 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %26 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %11 + %29 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %26 + OpStore %i %int_0 + OpBranch %30 + %30 = OpLabel + %31 = OpPhi %int %int_0 %29 %32 %33 + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %35 = OpLoad %int %34 + %36 = OpIAdd %int %int_10 %35 + %37 = OpSLessThan %bool %31 %36 + OpLoopMerge %38 %33 None + OpBranchConditional %37 %33 %38 + %33 = OpLabel + OpStore %param %31 + %39 = OpFunctionCall %void %func_i1_ %param + %32 = OpIAdd %int %31 %int_1 + OpStore %i %32 + OpBranch %30 + %38 = OpLabel + OpReturn + OpFunctionEnd + %func_i1_ = OpFunction %void None %14 + %x = OpFunctionParameter %_ptr_Function_int + %40 = OpLabel + %41 = OpLoad %int %x + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %43 = OpLoad %int %42 + %44 = OpSLessThan %bool %41 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + OpKill + %45 = OpLabel + %47 = OpLoad %int %x + %48 = OpSGreaterThan %bool %47 %int_8 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + OpStore %_GLF_color %25 + OpBranch %49 + %51 = OpLabel + OpStore %_GLF_color %26 + OpBranch %49 + %49 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..e223102301 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_i1_(inout int x) { + const int x_41 = x; + const int x_43 = asint(x_7[0].x); + if ((x_41 < x_43)) { + discard; + } + const int x_47 = x; + if ((x_47 > 8)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +void main_1() { + int i = 0; + int param = 0; + int x_31_phi = 0; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + x_31_phi = 0; + while (true) { + const int x_31 = x_31_phi; + const int x_35 = asint(x_7[0].x); + if ((x_31 < (10 + x_35))) { + } else { + break; + } + { + param = x_31; + func_i1_(param); + const int x_32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..2843739bc3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_i1_(constant buf0& x_7, thread int* const x, thread float4* const tint_symbol_4) { + int const x_41 = *(x); + int const x_43 = x_7.zero; + if ((x_41 < x_43)) { + discard_fragment(); + } + int const x_47 = *(x); + if ((x_47 > 8)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5) { + int i = 0; + int param = 0; + int x_31_phi = 0; + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + x_31_phi = 0; + while (true) { + int const x_31 = x_31_phi; + int const x_35 = x_7.zero; + if ((x_31 < (10 + x_35))) { + } else { + break; + } + { + param = x_31; + func_i1_(x_7, &(param), tint_symbol_5); + int const x_32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..faecfdff3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,138 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 77 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_i1_ "func_i1_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %i "i" + OpName %param "param" + OpName %x_31_phi "x_31_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpTypeFunction %void %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_8 = OpConstant %int 8 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %40 = OpTypeFunction %void + %44 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %void None %12 + %x = OpFunctionParameter %_ptr_Function_int + %17 = OpLabel + %19 = OpLoad %int %x + %23 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %24 = OpLoad %int %23 + %25 = OpSLessThan %bool %19 %24 + OpSelectionMerge %27 None + OpBranchConditional %25 %28 %27 + %28 = OpLabel + OpKill + %27 = OpLabel + %30 = OpLoad %int %x + %32 = OpSGreaterThan %bool %30 %int_8 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + OpStore %x_GLF_color %38 + OpBranch %33 + %35 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %40 + %42 = OpLabel + %i = OpVariable %_ptr_Function_int Function %44 + %param = OpVariable %_ptr_Function_int Function %44 + %x_31_phi = OpVariable %_ptr_Function_int Function %44 + OpStore %x_GLF_color %39 + OpStore %i %int_0 + OpStore %x_31_phi %int_0 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %int %x_31_phi + %53 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %54 = OpLoad %int %53 + %56 = OpIAdd %int %int_10 %54 + %57 = OpSLessThan %bool %52 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %49 + %58 = OpLabel + OpBranch %50 + %50 = OpLabel + OpStore %param %52 + %61 = OpFunctionCall %void %func_i1_ %param + %64 = OpIAdd %int %52 %int_1 + OpStore %i %64 + OpStore %x_31_phi %64 + OpBranch %48 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %65 +%tint_symbol = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %40 + %72 = OpLabel + %73 = OpFunctionCall %void %main_1 + %75 = OpLoad %v4float %x_GLF_color + %76 = OpCompositeConstruct %main_out %75 + %74 = OpFunctionCall %void %tint_symbol_2 %76 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f53a6361a3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,60 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) { + let x_41 : i32 = *(x); + let x_43 : i32 = x_7.zero; + if ((x_41 < x_43)) { + discard; + } + let x_47 : i32 = *(x); + if ((x_47 > 8)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +fn main_1() { + var i : i32; + var param : i32; + var x_31_phi : i32; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + i = 0; + x_31_phi = 0; + loop { + let x_31 : i32 = x_31_phi; + let x_35 : i32 = x_7.zero; + if ((x_31 < (10 + x_35))) { + } else { + break; + } + + continuing { + param = x_31; + func_i1_(&(param)); + let x_32 : i32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl new file mode 100644 index 0000000000..f53a6361a3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl @@ -0,0 +1,60 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) { + let x_41 : i32 = *(x); + let x_43 : i32 = x_7.zero; + if ((x_41 < x_43)) { + discard; + } + let x_47 : i32 = *(x); + if ((x_47 > 8)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +fn main_1() { + var i : i32; + var param : i32; + var x_31_phi : i32; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + i = 0; + x_31_phi = 0; + loop { + let x_31 : i32 = x_31_phi; + let x_35 : i32 = x_7.zero; + if ((x_31 < (10 + x_35))) { + } else { + break; + } + + continuing { + param = x_31; + func_i1_(&(param)); + let x_32 : i32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..e223102301 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,58 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void func_i1_(inout int x) { + const int x_41 = x; + const int x_43 = asint(x_7[0].x); + if ((x_41 < x_43)) { + discard; + } + const int x_47 = x; + if ((x_47 > 8)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +void main_1() { + int i = 0; + int param = 0; + int x_31_phi = 0; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + x_31_phi = 0; + while (true) { + const int x_31 = x_31_phi; + const int x_35 = asint(x_7[0].x); + if ((x_31 < (10 + x_35))) { + } else { + break; + } + { + param = x_31; + func_i1_(param); + const int x_32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..2843739bc3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void func_i1_(constant buf0& x_7, thread int* const x, thread float4* const tint_symbol_4) { + int const x_41 = *(x); + int const x_43 = x_7.zero; + if ((x_41 < x_43)) { + discard_fragment(); + } + int const x_47 = *(x); + if ((x_47 > 8)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5) { + int i = 0; + int param = 0; + int x_31_phi = 0; + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + i = 0; + x_31_phi = 0; + while (true) { + int const x_31 = x_31_phi; + int const x_35 = x_7.zero; + if ((x_31 < (10 + x_35))) { + } else { + break; + } + { + param = x_31; + func_i1_(x_7, &(param), tint_symbol_5); + int const x_32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..faecfdff3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,138 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 77 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_i1_ "func_i1_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %i "i" + OpName %param "param" + OpName %x_31_phi "x_31_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %12 = OpTypeFunction %void %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %int_8 = OpConstant %int 8 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %40 = OpTypeFunction %void + %44 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %func_i1_ = OpFunction %void None %12 + %x = OpFunctionParameter %_ptr_Function_int + %17 = OpLabel + %19 = OpLoad %int %x + %23 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %24 = OpLoad %int %23 + %25 = OpSLessThan %bool %19 %24 + OpSelectionMerge %27 None + OpBranchConditional %25 %28 %27 + %28 = OpLabel + OpKill + %27 = OpLabel + %30 = OpLoad %int %x + %32 = OpSGreaterThan %bool %30 %int_8 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + OpStore %x_GLF_color %38 + OpBranch %33 + %35 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %40 + %42 = OpLabel + %i = OpVariable %_ptr_Function_int Function %44 + %param = OpVariable %_ptr_Function_int Function %44 + %x_31_phi = OpVariable %_ptr_Function_int Function %44 + OpStore %x_GLF_color %39 + OpStore %i %int_0 + OpStore %x_31_phi %int_0 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %int %x_31_phi + %53 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 + %54 = OpLoad %int %53 + %56 = OpIAdd %int %int_10 %54 + %57 = OpSLessThan %bool %52 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %49 + %58 = OpLabel + OpBranch %50 + %50 = OpLabel + OpStore %param %52 + %61 = OpFunctionCall %void %func_i1_ %param + %64 = OpIAdd %int %52 %int_1 + OpStore %i %64 + OpStore %x_31_phi %64 + OpBranch %48 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %65 +%tint_symbol = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %40 + %72 = OpLabel + %73 = OpFunctionCall %void %main_1 + %75 = OpLoad %v4float %x_GLF_color + %76 = OpCompositeConstruct %main_out %75 + %74 = OpFunctionCall %void %tint_symbol_2 %76 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f53a6361a3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-for-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,60 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_i1_(x : ptr) { + let x_41 : i32 = *(x); + let x_43 : i32 = x_7.zero; + if ((x_41 < x_43)) { + discard; + } + let x_47 : i32 = *(x); + if ((x_47 > 8)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +fn main_1() { + var i : i32; + var param : i32; + var x_31_phi : i32; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + i = 0; + x_31_phi = 0; + loop { + let x_31 : i32 = x_31_phi; + let x_35 : i32 = x_7.zero; + if ((x_31 < (10 + x_35))) { + } else { + break; + } + + continuing { + param = x_31; + func_i1_(&(param)); + let x_32 : i32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm new file mode 100644 index 0000000000..fa125c09cf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm @@ -0,0 +1,123 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_f1_ "func(f1;" + OpName %x "x" + OpName %gl_FragCoord "gl_FragCoord" + OpName %f "f" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "five" + OpName %_ "" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpTypeFunction %float %_ptr_Function_float + %float_5 = OpConstant %float 5 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0_5 = OpConstant %float 0.5 + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %35 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %36 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %13 + %37 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_float Function + OpStore %f %float_0 + OpStore %i %int_0 + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %int %i + %40 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %41 = OpLoad %int %40 + %42 = OpSLessThan %bool %39 %41 + OpLoopMerge %43 %44 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + %45 = OpLoad %int %i + %46 = OpConvertSToF %float %45 + OpStore %param %46 + %47 = OpFunctionCall %float %func_f1_ %param + OpStore %f %47 + %48 = OpLoad %int %i + %49 = OpIAdd %int %48 %int_1 + OpStore %i %49 + OpBranch %38 + %43 = OpLabel + %50 = OpLoad %float %f + %51 = OpFOrdEqual %bool %50 %float_5 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpStore %_GLF_color %35 + OpBranch %52 + %54 = OpLabel + OpStore %_GLF_color %36 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd + %func_f1_ = OpFunction %float None %16 + %x = OpFunctionParameter %_ptr_Function_float + %55 = OpLabel + %56 = OpLoad %float %x + %57 = OpFOrdGreaterThan %bool %56 %float_5 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + %60 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %61 = OpLoad %float %60 + %62 = OpFOrdLessThan %bool %61 %float_0_5 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + OpKill + %65 = OpLabel + %66 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %67 = OpLoad %float %66 + %68 = OpFOrdLessThan %bool %67 %float_0_5 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + OpKill + %69 = OpLabel + OpBranch %63 + %63 = OpLabel + OpBranch %58 + %58 = OpLabel + %71 = OpLoad %float %x + %72 = OpFAdd %float %71 %float_1 + OpReturnValue %72 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..279a0dd7e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.hlsl @@ -0,0 +1,69 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_f1_(inout float x) { + const float x_56 = x; + if ((x_56 > 5.0f)) { + const float x_61 = gl_FragCoord.x; + if ((x_61 < 0.5f)) { + discard; + } else { + const float x_67 = gl_FragCoord.y; + if ((x_67 < 0.5f)) { + discard; + } + } + } + const float x_71 = x; + return (x_71 + 1.0f); +} + +void main_1() { + float f = 0.0f; + int i = 0; + float param = 0.0f; + f = 0.0f; + i = 0; + while (true) { + const int x_39 = i; + const int x_41 = asint(x_10[0].x); + if ((x_39 < x_41)) { + } else { + break; + } + { + param = float(i); + const float x_47 = func_f1_(param); + f = x_47; + i = (i + 1); + } + } + if ((f == 5.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..df17a9a354 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int five; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_f1_(thread float* const x, thread float4* const tint_symbol_5) { + float const x_56 = *(x); + if ((x_56 > 5.0f)) { + float const x_61 = (*(tint_symbol_5)).x; + if ((x_61 < 0.5f)) { + discard_fragment(); + } else { + float const x_67 = (*(tint_symbol_5)).y; + if ((x_67 < 0.5f)) { + discard_fragment(); + } + } + } + float const x_71 = *(x); + return (x_71 + 1.0f); +} + +void main_1(constant buf0& x_10, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float f = 0.0f; + int i = 0; + float param = 0.0f; + f = 0.0f; + i = 0; + while (true) { + int const x_39 = i; + int const x_41 = x_10.five; + if ((x_39 < x_41)) { + } else { + break; + } + { + int const x_45 = i; + param = float(x_45); + float const x_47 = func_f1_(&(param), tint_symbol_6); + f = x_47; + int const x_48 = i; + i = (x_48 + 1); + } + } + float const x_50 = f; + if ((x_50 == 5.0f)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_10, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b497a162c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.spvasm @@ -0,0 +1,169 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "five" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_f1_ "func_f1_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %f "f" + OpName %i "i" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpTypeFunction %float %_ptr_Function_float + %float_5 = OpConstant %float 5 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0_5 = OpConstant %float 0.5 + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %void = OpTypeVoid + %47 = OpTypeFunction %void + %52 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %55 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %83 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %84 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %85 = OpTypeFunction %void %main_out + %func_f1_ = OpFunction %float None %15 + %x = OpFunctionParameter %_ptr_Function_float + %19 = OpLabel + %21 = OpLoad %float %x + %23 = OpFOrdGreaterThan %bool %21 %float_5 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %25 + %26 = OpLabel + %30 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %31 = OpLoad %float %30 + %33 = OpFOrdLessThan %bool %31 %float_0_5 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %36 + %35 = OpLabel + OpKill + %36 = OpLabel + %38 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %39 = OpLoad %float %38 + %40 = OpFOrdLessThan %bool %39 %float_0_5 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + OpKill + %41 = OpLabel + OpBranch %34 + %34 = OpLabel + OpBranch %25 + %25 = OpLabel + %44 = OpLoad %float %x + %46 = OpFAdd %float %44 %float_1 + OpReturnValue %46 + OpFunctionEnd + %main_1 = OpFunction %void None %47 + %50 = OpLabel + %f = OpVariable %_ptr_Function_float Function %52 + %i = OpVariable %_ptr_Function_int Function %55 + %param = OpVariable %_ptr_Function_float Function %52 + OpStore %f %float_0 + OpStore %i %int_0 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 + %66 = OpLoad %int %65 + %67 = OpSLessThan %bool %63 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %60 + %68 = OpLabel + OpBranch %61 + %61 = OpLabel + %71 = OpLoad %int %i + %72 = OpConvertSToF %float %71 + OpStore %param %72 + %73 = OpFunctionCall %float %func_f1_ %param + OpStore %f %73 + %75 = OpLoad %int %i + %77 = OpIAdd %int %75 %int_1 + OpStore %i %77 + OpBranch %59 + %60 = OpLabel + %78 = OpLoad %float %f + %79 = OpFOrdEqual %bool %78 %float_5 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + OpStore %x_GLF_color %83 + OpBranch %80 + %82 = OpLabel + OpStore %x_GLF_color %84 + OpBranch %80 + %80 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %85 +%tint_symbol_1 = OpFunctionParameter %main_out + %89 = OpLabel + %90 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %90 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %47 + %92 = OpLabel + %93 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %93 + %94 = OpFunctionCall %void %main_1 + %96 = OpLoad %v4float %x_GLF_color + %97 = OpCompositeConstruct %main_out %96 + %95 = OpFunctionCall %void %tint_symbol_3 %97 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..d25c0e5a1b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.spvasm.expected.wgsl @@ -0,0 +1,71 @@ +[[block]] +struct buf0 { + five : i32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_f1_(x : ptr) -> f32 { + let x_56 : f32 = *(x); + if ((x_56 > 5.0)) { + let x_61 : f32 = gl_FragCoord.x; + if ((x_61 < 0.5)) { + discard; + } else { + let x_67 : f32 = gl_FragCoord.y; + if ((x_67 < 0.5)) { + discard; + } + } + } + let x_71 : f32 = *(x); + return (x_71 + 1.0); +} + +fn main_1() { + var f : f32; + var i : i32; + var param : f32; + f = 0.0; + i = 0; + loop { + let x_39 : i32 = i; + let x_41 : i32 = x_10.five; + if ((x_39 < x_41)) { + } else { + break; + } + + continuing { + let x_45 : i32 = i; + param = f32(x_45); + let x_47 : f32 = func_f1_(&(param)); + f = x_47; + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_50 : f32 = f; + if ((x_50 == 5.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl new file mode 100644 index 0000000000..d25c0e5a1b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl @@ -0,0 +1,71 @@ +[[block]] +struct buf0 { + five : i32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_f1_(x : ptr) -> f32 { + let x_56 : f32 = *(x); + if ((x_56 > 5.0)) { + let x_61 : f32 = gl_FragCoord.x; + if ((x_61 < 0.5)) { + discard; + } else { + let x_67 : f32 = gl_FragCoord.y; + if ((x_67 < 0.5)) { + discard; + } + } + } + let x_71 : f32 = *(x); + return (x_71 + 1.0); +} + +fn main_1() { + var f : f32; + var i : i32; + var param : f32; + f = 0.0; + i = 0; + loop { + let x_39 : i32 = i; + let x_41 : i32 = x_10.five; + if ((x_39 < x_41)) { + } else { + break; + } + + continuing { + let x_45 : i32 = i; + param = f32(x_45); + let x_47 : f32 = func_f1_(&(param)); + f = x_47; + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_50 : f32 = f; + if ((x_50 == 5.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..279a0dd7e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.hlsl @@ -0,0 +1,69 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_f1_(inout float x) { + const float x_56 = x; + if ((x_56 > 5.0f)) { + const float x_61 = gl_FragCoord.x; + if ((x_61 < 0.5f)) { + discard; + } else { + const float x_67 = gl_FragCoord.y; + if ((x_67 < 0.5f)) { + discard; + } + } + } + const float x_71 = x; + return (x_71 + 1.0f); +} + +void main_1() { + float f = 0.0f; + int i = 0; + float param = 0.0f; + f = 0.0f; + i = 0; + while (true) { + const int x_39 = i; + const int x_41 = asint(x_10[0].x); + if ((x_39 < x_41)) { + } else { + break; + } + { + param = float(i); + const float x_47 = func_f1_(param); + f = x_47; + i = (i + 1); + } + } + if ((f == 5.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..df17a9a354 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int five; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_f1_(thread float* const x, thread float4* const tint_symbol_5) { + float const x_56 = *(x); + if ((x_56 > 5.0f)) { + float const x_61 = (*(tint_symbol_5)).x; + if ((x_61 < 0.5f)) { + discard_fragment(); + } else { + float const x_67 = (*(tint_symbol_5)).y; + if ((x_67 < 0.5f)) { + discard_fragment(); + } + } + } + float const x_71 = *(x); + return (x_71 + 1.0f); +} + +void main_1(constant buf0& x_10, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float f = 0.0f; + int i = 0; + float param = 0.0f; + f = 0.0f; + i = 0; + while (true) { + int const x_39 = i; + int const x_41 = x_10.five; + if ((x_39 < x_41)) { + } else { + break; + } + { + int const x_45 = i; + param = float(x_45); + float const x_47 = func_f1_(&(param), tint_symbol_6); + f = x_47; + int const x_48 = i; + i = (x_48 + 1); + } + } + float const x_50 = f; + if ((x_50 == 5.0f)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_10, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b497a162c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.spvasm @@ -0,0 +1,169 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 98 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "five" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_f1_ "func_f1_" + OpName %x "x" + OpName %main_1 "main_1" + OpName %f "f" + OpName %i "i" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpTypeFunction %float %_ptr_Function_float + %float_5 = OpConstant %float 5 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0_5 = OpConstant %float 0.5 + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %void = OpTypeVoid + %47 = OpTypeFunction %void + %52 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %55 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %83 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %84 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %85 = OpTypeFunction %void %main_out + %func_f1_ = OpFunction %float None %15 + %x = OpFunctionParameter %_ptr_Function_float + %19 = OpLabel + %21 = OpLoad %float %x + %23 = OpFOrdGreaterThan %bool %21 %float_5 + OpSelectionMerge %25 None + OpBranchConditional %23 %26 %25 + %26 = OpLabel + %30 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %31 = OpLoad %float %30 + %33 = OpFOrdLessThan %bool %31 %float_0_5 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %36 + %35 = OpLabel + OpKill + %36 = OpLabel + %38 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %39 = OpLoad %float %38 + %40 = OpFOrdLessThan %bool %39 %float_0_5 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + OpKill + %41 = OpLabel + OpBranch %34 + %34 = OpLabel + OpBranch %25 + %25 = OpLabel + %44 = OpLoad %float %x + %46 = OpFAdd %float %44 %float_1 + OpReturnValue %46 + OpFunctionEnd + %main_1 = OpFunction %void None %47 + %50 = OpLabel + %f = OpVariable %_ptr_Function_float Function %52 + %i = OpVariable %_ptr_Function_int Function %55 + %param = OpVariable %_ptr_Function_float Function %52 + OpStore %f %float_0 + OpStore %i %int_0 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 + %66 = OpLoad %int %65 + %67 = OpSLessThan %bool %63 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %60 + %68 = OpLabel + OpBranch %61 + %61 = OpLabel + %71 = OpLoad %int %i + %72 = OpConvertSToF %float %71 + OpStore %param %72 + %73 = OpFunctionCall %float %func_f1_ %param + OpStore %f %73 + %75 = OpLoad %int %i + %77 = OpIAdd %int %75 %int_1 + OpStore %i %77 + OpBranch %59 + %60 = OpLabel + %78 = OpLoad %float %f + %79 = OpFOrdEqual %bool %78 %float_5 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + OpStore %x_GLF_color %83 + OpBranch %80 + %82 = OpLabel + OpStore %x_GLF_color %84 + OpBranch %80 + %80 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %85 +%tint_symbol_1 = OpFunctionParameter %main_out + %89 = OpLabel + %90 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %90 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %47 + %92 = OpLabel + %93 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %93 + %94 = OpFunctionCall %void %main_1 + %96 = OpLoad %v4float %x_GLF_color + %97 = OpCompositeConstruct %main_out %96 + %95 = OpFunctionCall %void %tint_symbol_3 %97 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..d25c0e5a1b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-wrap-op-kill-two-branches/0-opt.wgsl.expected.wgsl @@ -0,0 +1,71 @@ +[[block]] +struct buf0 { + five : i32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_f1_(x : ptr) -> f32 { + let x_56 : f32 = *(x); + if ((x_56 > 5.0)) { + let x_61 : f32 = gl_FragCoord.x; + if ((x_61 < 0.5)) { + discard; + } else { + let x_67 : f32 = gl_FragCoord.y; + if ((x_67 < 0.5)) { + discard; + } + } + } + let x_71 : f32 = *(x); + return (x_71 + 1.0); +} + +fn main_1() { + var f : f32; + var i : i32; + var param : f32; + f = 0.0; + i = 0; + loop { + let x_39 : i32 = i; + let x_41 : i32 = x_10.five; + if ((x_39 < x_41)) { + } else { + break; + } + + continuing { + let x_45 : i32 = i; + param = f32(x_45); + let x_47 : f32 = func_f1_(&(param)); + f = x_47; + let x_48 : i32 = i; + i = (x_48 + 1); + } + } + let x_50 : f32 = f; + if ((x_50 == 5.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm new file mode 100644 index 0000000000..97dd17734d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm @@ -0,0 +1,112 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %m32 "m32" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %sums "sums" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %int_3 = OpConstant %int 3 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 + %int_2 = OpConstant %int 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %37 = OpConstantComposite %v2float %float_0 %float_0 + %main = OpFunction %void None %13 + %38 = OpLabel + %m32 = OpVariable %_ptr_Function_mat3v2float Function + %sums = OpVariable %_ptr_Function__arr_float_uint_3 Function + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpCompositeConstruct %v2float %40 %float_0 + %42 = OpCompositeConstruct %v2float %float_0 %40 + %43 = OpCompositeConstruct %mat3v2float %41 %42 %37 + OpStore %m32 %43 + %44 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %45 = OpLoad %int %44 + %46 = OpIEqual %bool %45 %int_1 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + %49 = OpAccessChain %_ptr_Function_float %m32 %int_3 %45 + OpStore %49 %40 + OpBranch %47 + %47 = OpLabel + %50 = OpCompositeConstruct %_arr_float_uint_3 %40 %40 %40 + OpStore %sums %50 + OpBranch %51 + %51 = OpLabel + %52 = OpPhi %int %45 %47 %53 %54 + %55 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %56 = OpLoad %int %55 + %57 = OpSLessThan %bool %52 %56 + OpLoopMerge %58 %54 None + OpBranchConditional %57 %54 %58 + %54 = OpLabel + %59 = OpAccessChain %_ptr_Function_float %m32 %52 %45 + %60 = OpLoad %float %59 + %61 = OpAccessChain %_ptr_Function_float %sums %56 + %62 = OpLoad %float %61 + %63 = OpFAdd %float %62 %60 + OpStore %61 %63 + %53 = OpIAdd %int %52 %int_1 + OpBranch %51 + %58 = OpLabel + %64 = OpAccessChain %_ptr_Function_float %sums %45 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %67 = OpLoad %float %66 + %68 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Function_float %sums %69 + %71 = OpLoad %float %70 + %72 = OpCompositeConstruct %v4float %65 %67 %67 %71 + OpStore %_GLF_color %72 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.hlsl new file mode 100755 index 0000000000..db312d41f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.hlsl @@ -0,0 +1,72 @@ +SKIP: FAILED + +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3x2 m32 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float sums[3] = (float[3])0; + int x_52_phi = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + m32 = float3x2(float2(x_40, 0.0f), float2(0.0f, x_40), float2(0.0f, 0.0f)); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_45 == 1)) { + set_float2(m32[3], x_45, x_40); + } + const float tint_symbol_4[3] = {x_40, x_40, x_40}; + sums = tint_symbol_4; + x_52_phi = x_45; + while (true) { + int x_53 = 0; + const int x_52 = x_52_phi; + const int x_56 = asint(x_8[2].x); + if ((x_52 < x_56)) { + } else { + break; + } + { + const float x_60 = m32[x_52][x_45]; + const int x_61_save = x_56; + const float x_62 = sums[x_61_save]; + sums[x_61_save] = (x_62 + x_60); + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + const float x_65 = sums[x_45]; + const float x_67 = asfloat(x_6[1].x); + const int x_69 = asint(x_8[1].x); + const float x_71 = sums[x_69]; + x_GLF_color = float4(x_65, x_67, x_67, x_71); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} +T:\tmp\u93g.0:23:20: error: matrix row index '3' is out of bounds + set_float2(m32[3], x_45, x_40); + ^ + + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.msl new file mode 100644 index 0000000000..852c3288b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_5) { + float3x2 m32 = float3x2(0.0f); + tint_array_wrapper_2 sums = {}; + int x_52_phi = 0; + float const x_40 = x_6.x_GLF_uniform_float_values.arr[0].el; + m32 = float3x2(float2(x_40, 0.0f), float2(0.0f, x_40), float2(0.0f, 0.0f)); + int const x_45 = x_8.x_GLF_uniform_int_values.arr[0].el; + if ((x_45 == 1)) { + m32[3][x_45] = x_40; + } + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_40, x_40, x_40}}; + sums = tint_symbol_3; + x_52_phi = x_45; + while (true) { + int x_53 = 0; + int const x_52 = x_52_phi; + int const x_56 = x_8.x_GLF_uniform_int_values.arr[2].el; + if ((x_52 < x_56)) { + } else { + break; + } + { + float const x_60 = m32[x_52][x_45]; + int const x_61_save = x_56; + float const x_62 = sums.arr[x_61_save]; + sums.arr[x_61_save] = (x_62 + x_60); + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + float const x_65 = sums.arr[x_45]; + float const x_67 = x_6.x_GLF_uniform_float_values.arr[1].el; + int const x_69 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_71 = sums.arr[x_69]; + *(tint_symbol_5) = float4(x_65, x_67, x_67, x_71); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..47ebb6d397 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.spvasm @@ -0,0 +1,168 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m32 "m32" + OpName %sums "sums" + OpName %x_52_phi "x_52_phi" + OpName %x_53 "x_53" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float + %28 = OpConstantNull %mat3v2float +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 + %32 = OpConstantNull %_arr_float_uint_3 +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %44 = OpConstantComposite %v2float %float_0 %float_0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %88 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %m32 = OpVariable %_ptr_Function_mat3v2float Function %28 + %sums = OpVariable %_ptr_Function__arr_float_uint_3 Function %32 + %x_52_phi = OpVariable %_ptr_Function_int Function %35 + %x_53 = OpVariable %_ptr_Function_int Function %35 + %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %40 = OpLoad %float %39 + %42 = OpCompositeConstruct %v2float %40 %float_0 + %43 = OpCompositeConstruct %v2float %float_0 %40 + %45 = OpCompositeConstruct %mat3v2float %42 %43 %44 + OpStore %m32 %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %48 = OpLoad %int %47 + %50 = OpIEqual %bool %48 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %50 %53 %52 + %53 = OpLabel + %56 = OpAccessChain %_ptr_Function_float %m32 %int_3 %48 + OpStore %56 %40 + OpBranch %52 + %52 = OpLabel + %57 = OpCompositeConstruct %_arr_float_uint_3 %40 %40 %40 + OpStore %sums %57 + OpStore %x_52_phi %48 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %63 = OpLoad %int %x_52_phi + %65 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpSLessThan %bool %63 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %59 + %68 = OpLabel + OpBranch %60 + %60 = OpLabel + %71 = OpAccessChain %_ptr_Function_float %m32 %63 %48 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Function_float %sums %66 + %74 = OpLoad %float %73 + %75 = OpAccessChain %_ptr_Function_float %sums %66 + %76 = OpFAdd %float %74 %72 + OpStore %75 %76 + %77 = OpIAdd %int %63 %int_1 + OpStore %x_53 %77 + %78 = OpLoad %int %x_53 + OpStore %x_52_phi %78 + OpBranch %58 + %59 = OpLabel + %79 = OpAccessChain %_ptr_Function_float %sums %48 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Function_float %sums %84 + %86 = OpLoad %float %85 + %87 = OpCompositeConstruct %v4float %80 %82 %82 %86 + OpStore %x_GLF_color %87 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %88 +%tint_symbol = OpFunctionParameter %main_out + %92 = OpLabel + %93 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %93 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %95 = OpLabel + %96 = OpFunctionCall %void %main_1 + %98 = OpLoad %v4float %x_GLF_color + %99 = OpCompositeConstruct %main_out %98 + %97 = OpFunctionCall %void %tint_symbol_2 %99 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..712a69e275 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.wgsl @@ -0,0 +1,68 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m32 : mat3x2; + var sums : array; + var x_52_phi : i32; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + m32 = mat3x2(vec2(x_40, 0.0), vec2(0.0, x_40), vec2(0.0, 0.0)); + let x_45 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_45 == 1)) { + m32[3][x_45] = x_40; + } + sums = array(x_40, x_40, x_40); + x_52_phi = x_45; + loop { + var x_53 : i32; + let x_52 : i32 = x_52_phi; + let x_56 : i32 = x_8.x_GLF_uniform_int_values[2]; + if ((x_52 < x_56)) { + } else { + break; + } + + continuing { + let x_60 : f32 = m32[x_52][x_45]; + let x_61 : ptr = &(sums[x_56]); + let x_62 : f32 = *(x_61); + *(x_61) = (x_62 + x_60); + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + let x_65 : f32 = sums[x_45]; + let x_67 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_69 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_71 : f32 = sums[x_69]; + x_GLF_color = vec4(x_65, x_67, x_67, x_71); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl new file mode 100644 index 0000000000..712a69e275 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl @@ -0,0 +1,68 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m32 : mat3x2; + var sums : array; + var x_52_phi : i32; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + m32 = mat3x2(vec2(x_40, 0.0), vec2(0.0, x_40), vec2(0.0, 0.0)); + let x_45 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_45 == 1)) { + m32[3][x_45] = x_40; + } + sums = array(x_40, x_40, x_40); + x_52_phi = x_45; + loop { + var x_53 : i32; + let x_52 : i32 = x_52_phi; + let x_56 : i32 = x_8.x_GLF_uniform_int_values[2]; + if ((x_52 < x_56)) { + } else { + break; + } + + continuing { + let x_60 : f32 = m32[x_52][x_45]; + let x_61 : ptr = &(sums[x_56]); + let x_62 : f32 = *(x_61); + *(x_61) = (x_62 + x_60); + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + let x_65 : f32 = sums[x_45]; + let x_67 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_69 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_71 : f32 = sums[x_69]; + x_GLF_color = vec4(x_65, x_67, x_67, x_71); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.hlsl new file mode 100755 index 0000000000..3ba9bc4688 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.hlsl @@ -0,0 +1,72 @@ +SKIP: FAILED + +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[3]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3x2 m32 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float sums[3] = (float[3])0; + int x_52_phi = 0; + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]); + m32 = float3x2(float2(x_40, 0.0f), float2(0.0f, x_40), float2(0.0f, 0.0f)); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_45 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + if ((x_45 == 1)) { + set_float2(m32[3], x_45, x_40); + } + const float tint_symbol_4[3] = {x_40, x_40, x_40}; + sums = tint_symbol_4; + x_52_phi = x_45; + while (true) { + int x_53 = 0; + const int x_52 = x_52_phi; + const int x_56 = asint(x_8[2].x); + if ((x_52 < x_56)) { + } else { + break; + } + { + const float x_60 = m32[x_52][x_45]; + const int x_61_save = x_56; + const float x_62 = sums[x_61_save]; + sums[x_61_save] = (x_62 + x_60); + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + const float x_65 = sums[x_45]; + const float x_67 = asfloat(x_6[1].x); + const int x_69 = asint(x_8[1].x); + const float x_71 = sums[x_69]; + x_GLF_color = float4(x_65, x_67, x_67, x_71); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} +T:\tmp\uffo.0:23:20: error: matrix row index '3' is out of bounds + set_float2(m32[3], x_45, x_40); + ^ + + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.msl new file mode 100644 index 0000000000..852c3288b0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[3]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_8, thread float4* const tint_symbol_5) { + float3x2 m32 = float3x2(0.0f); + tint_array_wrapper_2 sums = {}; + int x_52_phi = 0; + float const x_40 = x_6.x_GLF_uniform_float_values.arr[0].el; + m32 = float3x2(float2(x_40, 0.0f), float2(0.0f, x_40), float2(0.0f, 0.0f)); + int const x_45 = x_8.x_GLF_uniform_int_values.arr[0].el; + if ((x_45 == 1)) { + m32[3][x_45] = x_40; + } + tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_40, x_40, x_40}}; + sums = tint_symbol_3; + x_52_phi = x_45; + while (true) { + int x_53 = 0; + int const x_52 = x_52_phi; + int const x_56 = x_8.x_GLF_uniform_int_values.arr[2].el; + if ((x_52 < x_56)) { + } else { + break; + } + { + float const x_60 = m32[x_52][x_45]; + int const x_61_save = x_56; + float const x_62 = sums.arr[x_61_save]; + sums.arr[x_61_save] = (x_62 + x_60); + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + float const x_65 = sums.arr[x_45]; + float const x_67 = x_6.x_GLF_uniform_float_values.arr[1].el; + int const x_69 = x_8.x_GLF_uniform_int_values.arr[1].el; + float const x_71 = sums.arr[x_69]; + *(tint_symbol_5) = float4(x_65, x_67, x_67, x_71); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..47ebb6d397 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.spvasm @@ -0,0 +1,168 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m32 "m32" + OpName %sums "sums" + OpName %x_52_phi "x_52_phi" + OpName %x_53 "x_53" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_3 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_3 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 + %buf0 = OpTypeStruct %_arr_int_uint_3 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float + %28 = OpConstantNull %mat3v2float +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3 + %32 = OpConstantNull %_arr_float_uint_3 +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %44 = OpConstantComposite %v2float %float_0 %float_0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %88 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %m32 = OpVariable %_ptr_Function_mat3v2float Function %28 + %sums = OpVariable %_ptr_Function__arr_float_uint_3 Function %32 + %x_52_phi = OpVariable %_ptr_Function_int Function %35 + %x_53 = OpVariable %_ptr_Function_int Function %35 + %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %40 = OpLoad %float %39 + %42 = OpCompositeConstruct %v2float %40 %float_0 + %43 = OpCompositeConstruct %v2float %float_0 %40 + %45 = OpCompositeConstruct %mat3v2float %42 %43 %44 + OpStore %m32 %45 + %47 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0 + %48 = OpLoad %int %47 + %50 = OpIEqual %bool %48 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %50 %53 %52 + %53 = OpLabel + %56 = OpAccessChain %_ptr_Function_float %m32 %int_3 %48 + OpStore %56 %40 + OpBranch %52 + %52 = OpLabel + %57 = OpCompositeConstruct %_arr_float_uint_3 %40 %40 %40 + OpStore %sums %57 + OpStore %x_52_phi %48 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %63 = OpLoad %int %x_52_phi + %65 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2 + %66 = OpLoad %int %65 + %67 = OpSLessThan %bool %63 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %59 + %68 = OpLabel + OpBranch %60 + %60 = OpLabel + %71 = OpAccessChain %_ptr_Function_float %m32 %63 %48 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Function_float %sums %66 + %74 = OpLoad %float %73 + %75 = OpAccessChain %_ptr_Function_float %sums %66 + %76 = OpFAdd %float %74 %72 + OpStore %75 %76 + %77 = OpIAdd %int %63 %int_1 + OpStore %x_53 %77 + %78 = OpLoad %int %x_53 + OpStore %x_52_phi %78 + OpBranch %58 + %59 = OpLabel + %79 = OpAccessChain %_ptr_Function_float %sums %48 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Function_float %sums %84 + %86 = OpLoad %float %85 + %87 = OpCompositeConstruct %v4float %80 %82 %82 %86 + OpStore %x_GLF_color %87 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %88 +%tint_symbol = OpFunctionParameter %main_out + %92 = OpLabel + %93 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %93 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %95 = OpLabel + %96 = OpFunctionCall %void %main_1 + %98 = OpLoad %v4float %x_GLF_color + %99 = OpCompositeConstruct %main_out %98 + %97 = OpFunctionCall %void %tint_symbol_2 %99 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..712a69e275 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.wgsl @@ -0,0 +1,68 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m32 : mat3x2; + var sums : array; + var x_52_phi : i32; + let x_40 : f32 = x_6.x_GLF_uniform_float_values[0]; + m32 = mat3x2(vec2(x_40, 0.0), vec2(0.0, x_40), vec2(0.0, 0.0)); + let x_45 : i32 = x_8.x_GLF_uniform_int_values[0]; + if ((x_45 == 1)) { + m32[3][x_45] = x_40; + } + sums = array(x_40, x_40, x_40); + x_52_phi = x_45; + loop { + var x_53 : i32; + let x_52 : i32 = x_52_phi; + let x_56 : i32 = x_8.x_GLF_uniform_int_values[2]; + if ((x_52 < x_56)) { + } else { + break; + } + + continuing { + let x_60 : f32 = m32[x_52][x_45]; + let x_61 : ptr = &(sums[x_56]); + let x_62 : f32 = *(x_61); + *(x_61) = (x_62 + x_60); + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + let x_65 : f32 = sums[x_45]; + let x_67 : f32 = x_6.x_GLF_uniform_float_values[1]; + let x_69 : i32 = x_8.x_GLF_uniform_int_values[1]; + let x_71 : f32 = sums[x_69]; + x_GLF_color = vec4(x_65, x_67, x_67, x_71); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm new file mode 100644 index 0000000000..a176ba55b6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm @@ -0,0 +1,113 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v1 "v1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %int_n1 = OpConstant %int -1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %v2int = OpTypeVector %int 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %12 + %33 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %35 = OpLoad %int %34 + %36 = OpCompositeConstruct %v2int %int_n1 %35 + %37 = OpBitcast %v2float %36 + %38 = OpExtInst %v2float %1 Cos %37 + %39 = OpExtInst %v2float %1 Cos %38 + OpStore %v1 %39 + %40 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %41 = OpLoad %float %40 + %42 = OpCompositeConstruct %v4float %41 %41 %41 %41 + OpStore %_GLF_color %42 + %43 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %44 = OpLoad %float %43 + %45 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %46 = OpLoad %float %45 + %47 = OpFOrdGreaterThan %bool %44 %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + %50 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %51 = OpLoad %float %50 + %52 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %53 = OpLoad %float %52 + %54 = OpFOrdLessThan %bool %51 %53 + OpBranch %48 + %48 = OpLabel + %55 = OpPhi %bool %47 %33 %54 %49 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %60 = OpLoad %int %59 + %61 = OpConvertSToF %float %60 + %62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %63 = OpLoad %int %62 + %64 = OpConvertSToF %float %63 + %65 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %66 + %68 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %69 = OpLoad %int %68 + %70 = OpConvertSToF %float %69 + %71 = OpCompositeConstruct %v4float %61 %64 %67 %70 + OpStore %_GLF_color %71 + OpBranch %56 + %58 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpConvertSToF %float %73 + %75 = OpCompositeConstruct %v4float %74 %74 %74 %74 + OpStore %_GLF_color %75 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..bb3eeafd26 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.hlsl @@ -0,0 +1,68 @@ +SKIP: FAILED + + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var v1 : vec2; + var x_54 : bool; + var x_55_phi : bool; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + v1 = cos(cos(bitcast>(vec2(-1, x_35)))); + let x_41 : f32 = v1.x; + x_GLF_color = vec4(x_41, x_41, x_41, x_41); + let x_44 : f32 = v1.y; + let x_46 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_47 : bool = (x_44 > x_46); + x_55_phi = x_47; + if (x_47) { + let x_51 : f32 = v1.y; + let x_53 : f32 = x_8.x_GLF_uniform_float_values[1]; + x_54 = (x_51 < x_53); + x_55_phi = x_54; + } + let x_55 : bool = x_55_phi; + if (x_55) { + let x_60 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_60), f32(x_63), f32(x_66), f32(x_69)); + } else { + let x_73 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_74 : f32 = f32(x_73); + x_GLF_color = vec4(x_74, x_74, x_74, x_74); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +Failed to generate: error: Unable to do bitcast to type __vec_2__f32 diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4ef589fb12 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float2 v1 = 0.0f; + bool x_54 = false; + bool x_55_phi = false; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[0].el; + v1 = cos(cos(as_type(int2(-1, x_35)))); + float const x_41 = v1.x; + *(tint_symbol_4) = float4(x_41, x_41, x_41, x_41); + float const x_44 = v1.y; + float const x_46 = x_8.x_GLF_uniform_float_values.arr[0].el; + bool const x_47 = (x_44 > x_46); + x_55_phi = x_47; + if (x_47) { + float const x_51 = v1.y; + float const x_53 = x_8.x_GLF_uniform_float_values.arr[1].el; + x_54 = (x_51 < x_53); + x_55_phi = x_54; + } + bool const x_55 = x_55_phi; + if (x_55) { + int const x_60 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_69 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_60), float(x_63), float(x_66), float(x_69)); + } else { + int const x_73 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_74 = float(x_73); + *(tint_symbol_4) = float4(x_74, x_74, x_74, x_74); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..43172e9f8e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.spvasm @@ -0,0 +1,157 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 97 +; Schema: 0 + OpCapability Shader + %38 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v1 "v1" + OpName %x_54 "x_54" + OpName %x_55_phi "x_55_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %30 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %v2int = OpTypeVector %int 2 + %int_n1 = OpConstant %int -1 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %85 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function %26 + %x_54 = OpVariable %_ptr_Function_bool Function %30 + %x_55_phi = OpVariable %_ptr_Function_bool Function %30 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %36 = OpLoad %int %35 + %43 = OpCompositeConstruct %v2int %int_n1 %36 + %40 = OpBitcast %v2float %43 + %39 = OpExtInst %v2float %38 Cos %40 + %37 = OpExtInst %v2float %38 Cos %39 + OpStore %v1 %37 + %45 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %46 = OpLoad %float %45 + %47 = OpCompositeConstruct %v4float %46 %46 %46 %46 + OpStore %x_GLF_color %47 + %49 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %53 = OpLoad %float %52 + %54 = OpFOrdGreaterThan %bool %50 %53 + OpStore %x_55_phi %54 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %58 = OpLoad %float %57 + %60 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %61 = OpLoad %float %60 + %62 = OpFOrdLessThan %bool %58 %61 + OpStore %x_54 %62 + %63 = OpLoad %bool %x_54 + OpStore %x_55_phi %63 + OpBranch %55 + %55 = OpLabel + %64 = OpLoad %bool %x_55_phi + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %67 + %66 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %69 + %77 = OpConvertSToF %float %71 + %78 = OpConvertSToF %float %73 + %79 = OpConvertSToF %float %75 + %80 = OpCompositeConstruct %v4float %76 %77 %78 %79 + OpStore %x_GLF_color %80 + OpBranch %65 + %67 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpConvertSToF %float %82 + %84 = OpCompositeConstruct %v4float %83 %83 %83 %83 + OpStore %x_GLF_color %84 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %85 +%tint_symbol = OpFunctionParameter %main_out + %89 = OpLabel + %90 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %90 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %92 = OpLabel + %93 = OpFunctionCall %void %main_1 + %95 = OpLoad %v4float %x_GLF_color + %96 = OpCompositeConstruct %main_out %95 + %94 = OpFunctionCall %void %tint_symbol_2 %96 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..5e5c2160f5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.spvasm.expected.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var v1 : vec2; + var x_54 : bool; + var x_55_phi : bool; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + v1 = cos(cos(bitcast>(vec2(-1, x_35)))); + let x_41 : f32 = v1.x; + x_GLF_color = vec4(x_41, x_41, x_41, x_41); + let x_44 : f32 = v1.y; + let x_46 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_47 : bool = (x_44 > x_46); + x_55_phi = x_47; + if (x_47) { + let x_51 : f32 = v1.y; + let x_53 : f32 = x_8.x_GLF_uniform_float_values[1]; + x_54 = (x_51 < x_53); + x_55_phi = x_54; + } + let x_55 : bool = x_55_phi; + if (x_55) { + let x_60 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_60), f32(x_63), f32(x_66), f32(x_69)); + } else { + let x_73 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_74 : f32 = f32(x_73); + x_GLF_color = vec4(x_74, x_74, x_74, x_74); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl new file mode 100644 index 0000000000..5e5c2160f5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var v1 : vec2; + var x_54 : bool; + var x_55_phi : bool; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + v1 = cos(cos(bitcast>(vec2(-1, x_35)))); + let x_41 : f32 = v1.x; + x_GLF_color = vec4(x_41, x_41, x_41, x_41); + let x_44 : f32 = v1.y; + let x_46 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_47 : bool = (x_44 > x_46); + x_55_phi = x_47; + if (x_47) { + let x_51 : f32 = v1.y; + let x_53 : f32 = x_8.x_GLF_uniform_float_values[1]; + x_54 = (x_51 < x_53); + x_55_phi = x_54; + } + let x_55 : bool = x_55_phi; + if (x_55) { + let x_60 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_60), f32(x_63), f32(x_66), f32(x_69)); + } else { + let x_73 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_74 : f32 = f32(x_73); + x_GLF_color = vec4(x_74, x_74, x_74, x_74); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..bb3eeafd26 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.hlsl @@ -0,0 +1,68 @@ +SKIP: FAILED + + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var v1 : vec2; + var x_54 : bool; + var x_55_phi : bool; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + v1 = cos(cos(bitcast>(vec2(-1, x_35)))); + let x_41 : f32 = v1.x; + x_GLF_color = vec4(x_41, x_41, x_41, x_41); + let x_44 : f32 = v1.y; + let x_46 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_47 : bool = (x_44 > x_46); + x_55_phi = x_47; + if (x_47) { + let x_51 : f32 = v1.y; + let x_53 : f32 = x_8.x_GLF_uniform_float_values[1]; + x_54 = (x_51 < x_53); + x_55_phi = x_54; + } + let x_55 : bool = x_55_phi; + if (x_55) { + let x_60 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_60), f32(x_63), f32(x_66), f32(x_69)); + } else { + let x_73 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_74 : f32 = f32(x_73); + x_GLF_color = vec4(x_74, x_74, x_74, x_74); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +Failed to generate: error: Unable to do bitcast to type __vec_2__f32 diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4ef589fb12 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, constant buf1& x_8, thread float4* const tint_symbol_4) { + float2 v1 = 0.0f; + bool x_54 = false; + bool x_55_phi = false; + int const x_35 = x_6.x_GLF_uniform_int_values.arr[0].el; + v1 = cos(cos(as_type(int2(-1, x_35)))); + float const x_41 = v1.x; + *(tint_symbol_4) = float4(x_41, x_41, x_41, x_41); + float const x_44 = v1.y; + float const x_46 = x_8.x_GLF_uniform_float_values.arr[0].el; + bool const x_47 = (x_44 > x_46); + x_55_phi = x_47; + if (x_47) { + float const x_51 = v1.y; + float const x_53 = x_8.x_GLF_uniform_float_values.arr[1].el; + x_54 = (x_51 < x_53); + x_55_phi = x_54; + } + bool const x_55 = x_55_phi; + if (x_55) { + int const x_60 = x_6.x_GLF_uniform_int_values.arr[0].el; + int const x_63 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_66 = x_6.x_GLF_uniform_int_values.arr[1].el; + int const x_69 = x_6.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_60), float(x_63), float(x_66), float(x_69)); + } else { + int const x_73 = x_6.x_GLF_uniform_int_values.arr[1].el; + float const x_74 = float(x_73); + *(tint_symbol_4) = float4(x_74, x_74, x_74, x_74); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_8 [[buffer(1)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..43172e9f8e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.spvasm @@ -0,0 +1,157 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 97 +; Schema: 0 + OpCapability Shader + %38 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %v1 "v1" + OpName %x_54 "x_54" + OpName %x_55_phi "x_55_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 1 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %buf1 = OpTypeStruct %_arr_float_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_8 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %30 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %v2int = OpTypeVector %int 2 + %int_n1 = OpConstant %int -1 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %85 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %19 + %22 = OpLabel + %v1 = OpVariable %_ptr_Function_v2float Function %26 + %x_54 = OpVariable %_ptr_Function_bool Function %30 + %x_55_phi = OpVariable %_ptr_Function_bool Function %30 + %35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %36 = OpLoad %int %35 + %43 = OpCompositeConstruct %v2int %int_n1 %36 + %40 = OpBitcast %v2float %43 + %39 = OpExtInst %v2float %38 Cos %40 + %37 = OpExtInst %v2float %38 Cos %39 + OpStore %v1 %37 + %45 = OpAccessChain %_ptr_Function_float %v1 %uint_0 + %46 = OpLoad %float %45 + %47 = OpCompositeConstruct %v4float %46 %46 %46 %46 + OpStore %x_GLF_color %47 + %49 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %53 = OpLoad %float %52 + %54 = OpFOrdGreaterThan %bool %50 %53 + OpStore %x_55_phi %54 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Function_float %v1 %uint_1 + %58 = OpLoad %float %57 + %60 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_1 + %61 = OpLoad %float %60 + %62 = OpFOrdLessThan %bool %58 %61 + OpStore %x_54 %62 + %63 = OpLoad %bool %x_54 + OpStore %x_55_phi %63 + OpBranch %55 + %55 = OpLabel + %64 = OpLoad %bool %x_55_phi + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %67 + %66 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %69 = OpLoad %int %68 + %70 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %71 = OpLoad %int %70 + %72 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %73 = OpLoad %int %72 + %74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0 + %75 = OpLoad %int %74 + %76 = OpConvertSToF %float %69 + %77 = OpConvertSToF %float %71 + %78 = OpConvertSToF %float %73 + %79 = OpConvertSToF %float %75 + %80 = OpCompositeConstruct %v4float %76 %77 %78 %79 + OpStore %x_GLF_color %80 + OpBranch %65 + %67 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpConvertSToF %float %82 + %84 = OpCompositeConstruct %v4float %83 %83 %83 %83 + OpStore %x_GLF_color %84 + OpBranch %65 + %65 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %85 +%tint_symbol = OpFunctionParameter %main_out + %89 = OpLabel + %90 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %90 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %19 + %92 = OpLabel + %93 = OpFunctionCall %void %main_1 + %95 = OpLoad %v4float %x_GLF_color + %96 = OpCompositeConstruct %main_out %95 + %94 = OpFunctionCall %void %tint_symbol_2 %96 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..5e5c2160f5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-apfloat-nan-cos-cos/0-opt.wgsl.expected.wgsl @@ -0,0 +1,63 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr_1; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_8 : buf1; + +fn main_1() { + var v1 : vec2; + var x_54 : bool; + var x_55_phi : bool; + let x_35 : i32 = x_6.x_GLF_uniform_int_values[0]; + v1 = cos(cos(bitcast>(vec2(-1, x_35)))); + let x_41 : f32 = v1.x; + x_GLF_color = vec4(x_41, x_41, x_41, x_41); + let x_44 : f32 = v1.y; + let x_46 : f32 = x_8.x_GLF_uniform_float_values[0]; + let x_47 : bool = (x_44 > x_46); + x_55_phi = x_47; + if (x_47) { + let x_51 : f32 = v1.y; + let x_53 : f32 = x_8.x_GLF_uniform_float_values[1]; + x_54 = (x_51 < x_53); + x_55_phi = x_54; + } + let x_55 : bool = x_55_phi; + if (x_55) { + let x_60 : i32 = x_6.x_GLF_uniform_int_values[0]; + let x_63 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_66 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_69 : i32 = x_6.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_60), f32(x_63), f32(x_66), f32(x_69)); + } else { + let x_73 : i32 = x_6.x_GLF_uniform_int_values[1]; + let x_74 : f32 = f32(x_73); + x_GLF_color = vec4(x_74, x_74, x_74, x_74); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm new file mode 100644 index 0000000000..29dcd71d84 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm @@ -0,0 +1,114 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_uint_values" + OpName %_ "" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "_GLF_uniform_float_values" + OpName %__0 "" + OpName %b "b" + OpName %c "c" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__1 "" + OpDecorate %_arr_uint_uint_2 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 2 + OpDecorate %_GLF_color Location 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 0 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_2 = OpConstant %uint 2 +%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 + %buf1 = OpTypeStruct %_arr_uint_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf2 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__0 = OpVariable %_ptr_Uniform_buf2 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__1 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %17 + %36 = OpLabel + %a = OpVariable %_ptr_Function_uint Function + %b = OpVariable %_ptr_Function_float Function + %c = OpVariable %_ptr_Function_uint Function + %37 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %int_0 + %38 = OpLoad %uint %37 + %39 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0 + %40 = OpLoad %float %39 + %41 = OpConvertFToU %uint %40 + %42 = OpShiftRightLogical %uint %38 %41 + OpStore %a %42 + %43 = OpLoad %uint %a + %44 = OpBitcast %float %43 + OpStore %b %44 + %45 = OpLoad %float %b + %46 = OpBitcast %uint %45 + OpStore %c %46 + %47 = OpLoad %uint %c + %48 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %int_0 + %49 = OpLoad %uint %48 + %50 = OpIEqual %bool %47 %49 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %55 = OpLoad %int %54 + %56 = OpConvertSToF %float %55 + %57 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpConvertSToF %float %58 + %60 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + %61 = OpLoad %int %60 + %62 = OpConvertSToF %float %61 + %63 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpConvertSToF %float %64 + %66 = OpCompositeConstruct %v4float %56 %59 %62 %65 + OpStore %_GLF_color %66 + OpBranch %51 + %53 = OpLabel + %67 = OpLoad %float %b + %68 = OpCompositeConstruct %v4float %67 %67 %67 %67 + OpStore %_GLF_color %68 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..a94b9b70d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.hlsl @@ -0,0 +1,53 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b2, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[2]; +}; + +void main_1() { + uint a = 0u; + float b = 0.0f; + uint c = 0u; + const uint scalar_offset = ((16u * uint(0))) / 4; + const uint x_38 = x_6[scalar_offset / 4][scalar_offset % 4]; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + a = (x_38 >> uint(x_40)); + b = asfloat(a); + c = asuint(b); + const uint x_47 = c; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const uint x_49 = x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]; + if ((x_47 == x_49)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_12[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_58 = asint(x_12[1].x); + const int x_61 = asint(x_12[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_64 = asint(x_12[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + const float x_67 = b; + x_GLF_color = float4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d120e270d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ uint el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_uint_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf2 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_2 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_2[12]; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ tint_padded_array_element_2 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_2 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf2& x_8, constant buf0& x_12, thread float4* const tint_symbol_4) { + uint a = 0u; + float b = 0.0f; + uint c = 0u; + uint const x_38 = x_6.x_GLF_uniform_uint_values.arr[0].el; + float const x_40 = x_8.x_GLF_uniform_float_values.arr[0].el; + a = (x_38 >> uint(x_40)); + uint const x_43 = a; + b = as_type(x_43); + float const x_45 = b; + c = as_type(x_45); + uint const x_47 = c; + uint const x_49 = x_6.x_GLF_uniform_uint_values.arr[0].el; + if ((x_47 == x_49)) { + int const x_55 = x_12.x_GLF_uniform_int_values.arr[0].el; + int const x_58 = x_12.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_12.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_12.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + float const x_67 = b; + *(tint_symbol_4) = float4(x_67, x_67, x_67, x_67); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf2& x_8 [[buffer(2)]], constant buf0& x_12 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, x_12, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8b2693b4ed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 86 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_uint_values" + OpName %x_6 "x_6" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_12 "x_12" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_uint_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 + %buf1 = OpTypeStruct %_arr_uint_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf2 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_8 = OpVariable %_ptr_Uniform_buf2 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %30 = OpConstantNull %uint +%_ptr_Function_float = OpTypePointer Function %float + %33 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %74 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %24 + %27 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %30 + %b = OpVariable %_ptr_Function_float Function %33 + %c = OpVariable %_ptr_Function_uint Function %30 + %38 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 %int_0 + %39 = OpLoad %uint %38 + %41 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpConvertFToU %uint %42 + %44 = OpShiftRightLogical %uint %39 %43 + OpStore %a %44 + %45 = OpLoad %uint %a + %46 = OpBitcast %float %45 + OpStore %b %46 + %47 = OpLoad %float %b + %48 = OpBitcast %uint %47 + OpStore %c %48 + %49 = OpLoad %uint %c + %50 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 %int_0 + %51 = OpLoad %uint %50 + %52 = OpIEqual %bool %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %55 %56 + %55 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %59 = OpLoad %int %58 + %61 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %59 + %68 = OpConvertSToF %float %62 + %69 = OpConvertSToF %float %64 + %70 = OpConvertSToF %float %66 + %71 = OpCompositeConstruct %v4float %67 %68 %69 %70 + OpStore %x_GLF_color %71 + OpBranch %54 + %56 = OpLabel + %72 = OpLoad %float %b + %73 = OpCompositeConstruct %v4float %72 %72 %72 %72 + OpStore %x_GLF_color %73 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %74 +%tint_symbol = OpFunctionParameter %main_out + %78 = OpLabel + %79 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %79 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %24 + %81 = OpLabel + %82 = OpFunctionCall %void %main_1 + %84 = OpLoad %v4float %x_GLF_color + %85 = OpCompositeConstruct %main_out %84 + %83 = OpFunctionCall %void %tint_symbol_2 %85 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..79c6767f64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.spvasm.expected.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_uint_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_float_values : Arr_1; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_2; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(2)]] var x_8 : buf2; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_12 : buf0; + +fn main_1() { + var a : u32; + var b : f32; + var c : u32; + let x_38 : u32 = x_6.x_GLF_uniform_uint_values[0]; + let x_40 : f32 = x_8.x_GLF_uniform_float_values[0]; + a = (x_38 >> u32(x_40)); + let x_43 : u32 = a; + b = bitcast(x_43); + let x_45 : f32 = b; + c = bitcast(x_45); + let x_47 : u32 = c; + let x_49 : u32 = x_6.x_GLF_uniform_uint_values[0]; + if ((x_47 == x_49)) { + let x_55 : i32 = x_12.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_12.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + } else { + let x_67 : f32 = b; + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl new file mode 100644 index 0000000000..79c6767f64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_uint_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_float_values : Arr_1; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_2; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(2)]] var x_8 : buf2; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_12 : buf0; + +fn main_1() { + var a : u32; + var b : f32; + var c : u32; + let x_38 : u32 = x_6.x_GLF_uniform_uint_values[0]; + let x_40 : f32 = x_8.x_GLF_uniform_float_values[0]; + a = (x_38 >> u32(x_40)); + let x_43 : u32 = a; + b = bitcast(x_43); + let x_45 : f32 = b; + c = bitcast(x_45); + let x_47 : u32 = c; + let x_49 : u32 = x_6.x_GLF_uniform_uint_values[0]; + if ((x_47 == x_49)) { + let x_55 : i32 = x_12.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_12.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + } else { + let x_67 : f32 = b; + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..a94b9b70d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.hlsl @@ -0,0 +1,53 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[2]; +}; +cbuffer cbuffer_x_8 : register(b2, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_12 : register(b0, space0) { + uint4 x_12[2]; +}; + +void main_1() { + uint a = 0u; + float b = 0.0f; + uint c = 0u; + const uint scalar_offset = ((16u * uint(0))) / 4; + const uint x_38 = x_6[scalar_offset / 4][scalar_offset % 4]; + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const float x_40 = asfloat(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]); + a = (x_38 >> uint(x_40)); + b = asfloat(a); + c = asuint(b); + const uint x_47 = c; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const uint x_49 = x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]; + if ((x_47 == x_49)) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_12[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const int x_58 = asint(x_12[1].x); + const int x_61 = asint(x_12[1].x); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_64 = asint(x_12[scalar_offset_4 / 4][scalar_offset_4 % 4]); + x_GLF_color = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + const float x_67 = b; + x_GLF_color = float4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d120e270d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ uint el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_uint_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[1]; +}; +struct buf2 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_2 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_2[12]; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ tint_padded_array_element_2 arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_2 x_GLF_uniform_int_values; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf2& x_8, constant buf0& x_12, thread float4* const tint_symbol_4) { + uint a = 0u; + float b = 0.0f; + uint c = 0u; + uint const x_38 = x_6.x_GLF_uniform_uint_values.arr[0].el; + float const x_40 = x_8.x_GLF_uniform_float_values.arr[0].el; + a = (x_38 >> uint(x_40)); + uint const x_43 = a; + b = as_type(x_43); + float const x_45 = b; + c = as_type(x_45); + uint const x_47 = c; + uint const x_49 = x_6.x_GLF_uniform_uint_values.arr[0].el; + if ((x_47 == x_49)) { + int const x_55 = x_12.x_GLF_uniform_int_values.arr[0].el; + int const x_58 = x_12.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_12.x_GLF_uniform_int_values.arr[1].el; + int const x_64 = x_12.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_4) = float4(float(x_55), float(x_58), float(x_61), float(x_64)); + } else { + float const x_67 = b; + *(tint_symbol_4) = float4(x_67, x_67, x_67, x_67); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf2& x_8 [[buffer(2)]], constant buf0& x_12 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_8, x_12, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8b2693b4ed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.spvasm @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 86 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_uint_values" + OpName %x_6 "x_6" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "x_GLF_uniform_float_values" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_12 "x_12" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_uint_uint_2 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %_arr_float_uint_1 ArrayStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_12 NonWritable + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 + %buf1 = OpTypeStruct %_arr_uint_uint_2 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %float = OpTypeFloat 32 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %buf2 = OpTypeStruct %_arr_float_uint_1 +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_8 = OpVariable %_ptr_Uniform_buf2 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %16 + %int = OpTypeInt 32 1 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_12 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %30 = OpConstantNull %uint +%_ptr_Function_float = OpTypePointer Function %float + %33 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %74 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %24 + %27 = OpLabel + %a = OpVariable %_ptr_Function_uint Function %30 + %b = OpVariable %_ptr_Function_float Function %33 + %c = OpVariable %_ptr_Function_uint Function %30 + %38 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 %int_0 + %39 = OpLoad %uint %38 + %41 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 + %42 = OpLoad %float %41 + %43 = OpConvertFToU %uint %42 + %44 = OpShiftRightLogical %uint %39 %43 + OpStore %a %44 + %45 = OpLoad %uint %a + %46 = OpBitcast %float %45 + OpStore %b %46 + %47 = OpLoad %float %b + %48 = OpBitcast %uint %47 + OpStore %c %48 + %49 = OpLoad %uint %c + %50 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 %int_0 + %51 = OpLoad %uint %50 + %52 = OpIEqual %bool %49 %51 + OpSelectionMerge %54 None + OpBranchConditional %52 %55 %56 + %55 = OpLabel + %58 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %59 = OpLoad %int %58 + %61 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0 + %66 = OpLoad %int %65 + %67 = OpConvertSToF %float %59 + %68 = OpConvertSToF %float %62 + %69 = OpConvertSToF %float %64 + %70 = OpConvertSToF %float %66 + %71 = OpCompositeConstruct %v4float %67 %68 %69 %70 + OpStore %x_GLF_color %71 + OpBranch %54 + %56 = OpLabel + %72 = OpLoad %float %b + %73 = OpCompositeConstruct %v4float %72 %72 %72 %72 + OpStore %x_GLF_color %73 + OpBranch %54 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %74 +%tint_symbol = OpFunctionParameter %main_out + %78 = OpLabel + %79 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %79 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %24 + %81 = OpLabel + %82 = OpFunctionCall %void %main_1 + %84 = OpLoad %v4float %x_GLF_color + %85 = OpCompositeConstruct %main_out %84 + %83 = OpFunctionCall %void %tint_symbol_2 %85 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..79c6767f64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-machine-value-type-uint-to-float/0-opt.wgsl.expected.wgsl @@ -0,0 +1,65 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_uint_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf2 { + x_GLF_uniform_float_values : Arr_1; +}; + +type Arr_2 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_2; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(2)]] var x_8 : buf2; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_12 : buf0; + +fn main_1() { + var a : u32; + var b : f32; + var c : u32; + let x_38 : u32 = x_6.x_GLF_uniform_uint_values[0]; + let x_40 : f32 = x_8.x_GLF_uniform_float_values[0]; + a = (x_38 >> u32(x_40)); + let x_43 : u32 = a; + b = bitcast(x_43); + let x_45 : f32 = b; + c = bitcast(x_45); + let x_47 : u32 = c; + let x_49 : u32 = x_6.x_GLF_uniform_uint_values[0]; + if ((x_47 == x_49)) { + let x_55 : i32 = x_12.x_GLF_uniform_int_values[0]; + let x_58 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_12.x_GLF_uniform_int_values[1]; + let x_64 : i32 = x_12.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_55), f32(x_58), f32(x_61), f32(x_64)); + } else { + let x_67 : f32 = b; + x_GLF_color = vec4(x_67, x_67, x_67, x_67); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm new file mode 100644 index 0000000000..3fb84ced5e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm @@ -0,0 +1,187 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %A "A" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "_GLF_uniform_float_values" + OpName %_ "" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %__0 "" + OpName %j "j" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function_int = OpTypePointer Function %int + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 +%int_n2147483648 = OpConstant %int -2147483648 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %37 = OpLabel + %A = OpVariable %_ptr_Function__arr_float_uint_2 Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Function_float %A %int_0 + OpStore %40 %39 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %42 = OpLoad %float %41 + %43 = OpAccessChain %_ptr_Function_float %A %int_1 + OpStore %43 %42 + %44 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %45 = OpLoad %int %44 + OpStore %i %45 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %49 + %49 = OpLabel + %50 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3 + %52 = OpLoad %int %51 + %53 = OpSLessThan %bool %50 %52 + OpBranchConditional %53 %54 %47 + %54 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %56 = OpLoad %int %55 + OpStore %j %56 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %j + %62 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2 + %63 = OpLoad %int %62 + %64 = OpSLessThan %bool %61 %63 + OpBranchConditional %64 %65 %58 + %65 = OpLabel + %66 = OpLoad %int %j + OpSelectionMerge %67 None + OpSwitch %66 %67 0 %68 1 %69 + %68 = OpLabel + %70 = OpLoad %int %i + %71 = OpSLessThan %bool %int_n2147483648 %70 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + OpBranch %59 + %72 = OpLabel + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 + %76 = OpLoad %float %75 + %77 = OpAccessChain %_ptr_Function_float %A %74 + OpStore %77 %76 + OpBranch %67 + %69 = OpLabel + %78 = OpLoad %int %i + %79 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Function_float %A %78 + OpStore %81 %80 + OpBranch %67 + %67 = OpLabel + OpBranch %59 + %59 = OpLabel + %82 = OpLoad %int %j + %83 = OpIAdd %int %82 %int_1 + OpStore %j %83 + OpBranch %57 + %58 = OpLabel + OpBranch %48 + %48 = OpLabel + %84 = OpLoad %int %i + %85 = OpIAdd %int %84 %int_1 + OpStore %i %85 + OpBranch %46 + %47 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Function_float %A %87 + %89 = OpLoad %float %88 + %90 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %91 = OpLoad %float %90 + %92 = OpFOrdEqual %bool %89 %91 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + %95 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %96 = OpLoad %int %95 + %97 = OpAccessChain %_ptr_Function_float %A %96 + %98 = OpLoad %float %97 + %99 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %100 = OpLoad %float %99 + %101 = OpFOrdEqual %bool %98 %100 + OpBranch %93 + %93 = OpLabel + %102 = OpPhi %bool %92 %47 %101 %94 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %107 = OpLoad %int %106 + %108 = OpConvertSToF %float %107 + %109 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %110 = OpLoad %int %109 + %111 = OpConvertSToF %float %110 + %112 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0 + %113 = OpLoad %int %112 + %114 = OpConvertSToF %float %113 + %115 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %116 = OpLoad %int %115 + %117 = OpConvertSToF %float %116 + %118 = OpCompositeConstruct %v4float %108 %111 %114 %117 + OpStore %_GLF_color %118 + OpBranch %103 + %105 = OpLabel + %119 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1 + %120 = OpLoad %int %119 + %121 = OpConvertSToF %float %120 + %122 = OpCompositeConstruct %v4float %121 %121 %121 %121 + OpStore %_GLF_color %122 + OpBranch %103 + %103 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..d2685c795b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.hlsl @@ -0,0 +1,114 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float A[2] = (float[2])0; + int i = 0; + int j = 0; + bool x_101 = false; + bool x_102_phi = false; + const float x_39 = asfloat(x_6[1].x); + A[0] = x_39; + const float x_42 = asfloat(x_6[1].x); + A[1] = x_42; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_45 = asint(x_9[scalar_offset / 4][scalar_offset % 4]); + i = x_45; + while (true) { + const int x_50 = i; + const int x_52 = asint(x_9[3].x); + if ((x_50 < x_52)) { + } else { + break; + } + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + j = x_56; + while (true) { + const int x_61 = j; + const int x_63 = asint(x_9[2].x); + if ((x_61 < x_63)) { + } else { + break; + } + switch(j) { + case 1: { + const int x_78 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_80 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + A[x_78] = x_80; + break; + } + case 0: { + if ((-2147483648 < i)) { + { + j = (j + 1); + } + continue; + } + const int x_74 = i; + const float x_76 = asfloat(x_6[2].x); + A[x_74] = x_76; + break; + } + default: { + break; + } + } + { + j = (j + 1); + } + } + { + i = (i + 1); + } + } + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_87 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_89 = A[x_87]; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_91 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const bool x_92 = (x_89 == x_91); + x_102_phi = x_92; + if (x_92) { + const int x_96 = asint(x_9[1].x); + const float x_98 = A[x_96]; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_100 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_101 = (x_98 == x_100); + x_102_phi = x_101; + } + if (x_102_phi) { + const int x_107 = asint(x_9[1].x); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_110 = asint(x_9[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_113 = asint(x_9[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const int x_116 = asint(x_9[1].x); + x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + const int x_120 = asint(x_9[1].x); + const float x_121 = float(x_120); + x_GLF_color = float4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a7a8dbb87d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.msl @@ -0,0 +1,132 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + tint_array_wrapper_2 A = {}; + int i = 0; + int j = 0; + bool x_101 = false; + bool x_102_phi = false; + float const x_39 = x_6.x_GLF_uniform_float_values.arr[1].el; + A.arr[0] = x_39; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[1].el; + A.arr[1] = x_42; + int const x_45 = x_9.x_GLF_uniform_int_values.arr[0].el; + i = x_45; + while (true) { + int const x_50 = i; + int const x_52 = x_9.x_GLF_uniform_int_values.arr[3].el; + if ((x_50 < x_52)) { + } else { + break; + } + int const x_56 = x_9.x_GLF_uniform_int_values.arr[0].el; + j = x_56; + while (true) { + int const x_61 = j; + int const x_63 = x_9.x_GLF_uniform_int_values.arr[2].el; + if ((x_61 < x_63)) { + } else { + break; + } + int const x_66 = j; + switch(x_66) { + case 1: { + int const x_78 = i; + float const x_80 = x_6.x_GLF_uniform_float_values.arr[0].el; + A.arr[x_78] = x_80; + break; + } + case 0: { + int const x_70 = i; + if ((-2147483648 < x_70)) { + { + int const x_82 = j; + j = (x_82 + 1); + } + continue; + } + int const x_74 = i; + float const x_76 = x_6.x_GLF_uniform_float_values.arr[2].el; + A.arr[x_74] = x_76; + break; + } + default: { + break; + } + } + { + int const x_82 = j; + j = (x_82 + 1); + } + } + { + int const x_84 = i; + i = (x_84 + 1); + } + } + int const x_87 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_89 = A.arr[x_87]; + float const x_91 = x_6.x_GLF_uniform_float_values.arr[0].el; + bool const x_92 = (x_89 == x_91); + x_102_phi = x_92; + if (x_92) { + int const x_96 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_98 = A.arr[x_96]; + float const x_100 = x_6.x_GLF_uniform_float_values.arr[0].el; + x_101 = (x_98 == x_100); + x_102_phi = x_101; + } + bool const x_102 = x_102_phi; + if (x_102) { + int const x_107 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_110 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_113 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_116 = x_9.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + int const x_120 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_121 = float(x_120); + *(tint_symbol_4) = float4(x_121, x_121, x_121, x_121); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..9acf823e49 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.spvasm @@ -0,0 +1,245 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 150 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %A "A" + OpName %i "i" + OpName %j "j" + OpName %x_101 "x_101" + OpName %x_102_phi "x_102_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %28 = OpConstantNull %_arr_float_uint_2 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %36 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 +%int_n2147483648 = OpConstant %int -2147483648 + %main_out = OpTypeStruct %v4float + %138 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %A = OpVariable %_ptr_Function__arr_float_uint_2 Function %28 + %i = OpVariable %_ptr_Function_int Function %31 + %j = OpVariable %_ptr_Function_int Function %31 + %x_101 = OpVariable %_ptr_Function_bool Function %36 + %x_102_phi = OpVariable %_ptr_Function_bool Function %36 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %42 = OpLoad %float %41 + %45 = OpAccessChain %_ptr_Function_float %A %int_0 + OpStore %45 %42 + %46 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %47 = OpLoad %float %46 + %48 = OpAccessChain %_ptr_Function_float %A %int_1 + OpStore %48 %47 + %50 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %51 = OpLoad %int %50 + OpStore %i %51 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %i + %58 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_3 + %59 = OpLoad %int %58 + %60 = OpSLessThan %bool %56 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %53 + %61 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %65 = OpLoad %int %64 + OpStore %j %65 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %70 = OpLoad %int %j + %72 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %73 = OpLoad %int %72 + %74 = OpSLessThan %bool %70 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpBranch %75 + %77 = OpLabel + OpBranch %67 + %75 = OpLabel + %78 = OpLoad %int %j + OpSelectionMerge %79 None + OpSwitch %78 %80 1 %81 0 %82 + %81 = OpLabel + %83 = OpLoad %int %i + %84 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Function_float %A %83 + OpStore %86 %85 + OpBranch %79 + %82 = OpLabel + %87 = OpLoad %int %i + %89 = OpSLessThan %bool %int_n2147483648 %87 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + OpBranch %68 + %90 = OpLabel + %92 = OpLoad %int %i + %93 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %94 = OpLoad %float %93 + %95 = OpAccessChain %_ptr_Function_float %A %92 + OpStore %95 %94 + OpBranch %79 + %80 = OpLabel + OpBranch %79 + %79 = OpLabel + OpBranch %68 + %68 = OpLabel + %96 = OpLoad %int %j + %97 = OpIAdd %int %96 %int_1 + OpStore %j %97 + OpBranch %66 + %67 = OpLabel + OpBranch %54 + %54 = OpLabel + %98 = OpLoad %int %i + %99 = OpIAdd %int %98 %int_1 + OpStore %i %99 + OpBranch %52 + %53 = OpLabel + %100 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %101 = OpLoad %int %100 + %102 = OpAccessChain %_ptr_Function_float %A %101 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %105 = OpLoad %float %104 + %106 = OpFOrdEqual %bool %103 %105 + OpStore %x_102_phi %106 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %107 + %108 = OpLabel + %109 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Function_float %A %110 + %112 = OpLoad %float %111 + %113 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %114 = OpLoad %float %113 + %115 = OpFOrdEqual %bool %112 %114 + OpStore %x_101 %115 + %116 = OpLoad %bool %x_101 + OpStore %x_102_phi %116 + OpBranch %107 + %107 = OpLabel + %117 = OpLoad %bool %x_102_phi + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %120 + %119 = OpLabel + %121 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %122 = OpLoad %int %121 + %123 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %124 = OpLoad %int %123 + %125 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %126 = OpLoad %int %125 + %127 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %128 = OpLoad %int %127 + %129 = OpConvertSToF %float %122 + %130 = OpConvertSToF %float %124 + %131 = OpConvertSToF %float %126 + %132 = OpConvertSToF %float %128 + %133 = OpCompositeConstruct %v4float %129 %130 %131 %132 + OpStore %x_GLF_color %133 + OpBranch %118 + %120 = OpLabel + %134 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %135 = OpLoad %int %134 + %136 = OpConvertSToF %float %135 + %137 = OpCompositeConstruct %v4float %136 %136 %136 %136 + OpStore %x_GLF_color %137 + OpBranch %118 + %118 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %138 +%tint_symbol = OpFunctionParameter %main_out + %142 = OpLabel + %143 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %143 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %145 = OpLabel + %146 = OpFunctionCall %void %main_1 + %148 = OpLoad %v4float %x_GLF_color + %149 = OpCompositeConstruct %main_out %148 + %147 = OpFunctionCall %void %tint_symbol_2 %149 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..e999646185 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.wgsl @@ -0,0 +1,116 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A : array; + var i : i32; + var j : i32; + var x_101 : bool; + var x_102_phi : bool; + let x_39 : f32 = x_6.x_GLF_uniform_float_values[1]; + A[0] = x_39; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[1]; + A[1] = x_42; + let x_45 : i32 = x_9.x_GLF_uniform_int_values[0]; + i = x_45; + loop { + let x_50 : i32 = i; + let x_52 : i32 = x_9.x_GLF_uniform_int_values[3]; + if ((x_50 < x_52)) { + } else { + break; + } + let x_56 : i32 = x_9.x_GLF_uniform_int_values[0]; + j = x_56; + loop { + let x_61 : i32 = j; + let x_63 : i32 = x_9.x_GLF_uniform_int_values[2]; + if ((x_61 < x_63)) { + } else { + break; + } + let x_66 : i32 = j; + switch(x_66) { + case 1: { + let x_78 : i32 = i; + let x_80 : f32 = x_6.x_GLF_uniform_float_values[0]; + A[x_78] = x_80; + } + case 0: { + let x_70 : i32 = i; + if ((-2147483648 < x_70)) { + continue; + } + let x_74 : i32 = i; + let x_76 : f32 = x_6.x_GLF_uniform_float_values[2]; + A[x_74] = x_76; + } + default: { + } + } + + continuing { + let x_82 : i32 = j; + j = (x_82 + 1); + } + } + + continuing { + let x_84 : i32 = i; + i = (x_84 + 1); + } + } + let x_87 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_89 : f32 = A[x_87]; + let x_91 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_92 : bool = (x_89 == x_91); + x_102_phi = x_92; + if (x_92) { + let x_96 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_98 : f32 = A[x_96]; + let x_100 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_101 = (x_98 == x_100); + x_102_phi = x_101; + } + let x_102 : bool = x_102_phi; + if (x_102) { + let x_107 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_110 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_113 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_116 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } else { + let x_120 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_121 : f32 = f32(x_120); + x_GLF_color = vec4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl new file mode 100644 index 0000000000..e999646185 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl @@ -0,0 +1,116 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A : array; + var i : i32; + var j : i32; + var x_101 : bool; + var x_102_phi : bool; + let x_39 : f32 = x_6.x_GLF_uniform_float_values[1]; + A[0] = x_39; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[1]; + A[1] = x_42; + let x_45 : i32 = x_9.x_GLF_uniform_int_values[0]; + i = x_45; + loop { + let x_50 : i32 = i; + let x_52 : i32 = x_9.x_GLF_uniform_int_values[3]; + if ((x_50 < x_52)) { + } else { + break; + } + let x_56 : i32 = x_9.x_GLF_uniform_int_values[0]; + j = x_56; + loop { + let x_61 : i32 = j; + let x_63 : i32 = x_9.x_GLF_uniform_int_values[2]; + if ((x_61 < x_63)) { + } else { + break; + } + let x_66 : i32 = j; + switch(x_66) { + case 1: { + let x_78 : i32 = i; + let x_80 : f32 = x_6.x_GLF_uniform_float_values[0]; + A[x_78] = x_80; + } + case 0: { + let x_70 : i32 = i; + if ((-2147483648 < x_70)) { + continue; + } + let x_74 : i32 = i; + let x_76 : f32 = x_6.x_GLF_uniform_float_values[2]; + A[x_74] = x_76; + } + default: { + } + } + + continuing { + let x_82 : i32 = j; + j = (x_82 + 1); + } + } + + continuing { + let x_84 : i32 = i; + i = (x_84 + 1); + } + } + let x_87 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_89 : f32 = A[x_87]; + let x_91 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_92 : bool = (x_89 == x_91); + x_102_phi = x_92; + if (x_92) { + let x_96 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_98 : f32 = A[x_96]; + let x_100 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_101 = (x_98 == x_100); + x_102_phi = x_101; + } + let x_102 : bool = x_102_phi; + if (x_102) { + let x_107 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_110 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_113 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_116 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } else { + let x_120 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_121 : f32 = f32(x_120); + x_GLF_color = vec4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d2685c795b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.hlsl @@ -0,0 +1,114 @@ +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[3]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float A[2] = (float[2])0; + int i = 0; + int j = 0; + bool x_101 = false; + bool x_102_phi = false; + const float x_39 = asfloat(x_6[1].x); + A[0] = x_39; + const float x_42 = asfloat(x_6[1].x); + A[1] = x_42; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_45 = asint(x_9[scalar_offset / 4][scalar_offset % 4]); + i = x_45; + while (true) { + const int x_50 = i; + const int x_52 = asint(x_9[3].x); + if ((x_50 < x_52)) { + } else { + break; + } + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_56 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]); + j = x_56; + while (true) { + const int x_61 = j; + const int x_63 = asint(x_9[2].x); + if ((x_61 < x_63)) { + } else { + break; + } + switch(j) { + case 1: { + const int x_78 = i; + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const float x_80 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + A[x_78] = x_80; + break; + } + case 0: { + if ((-2147483648 < i)) { + { + j = (j + 1); + } + continue; + } + const int x_74 = i; + const float x_76 = asfloat(x_6[2].x); + A[x_74] = x_76; + break; + } + default: { + break; + } + } + { + j = (j + 1); + } + } + { + i = (i + 1); + } + } + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_87 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_89 = A[x_87]; + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const float x_91 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const bool x_92 = (x_89 == x_91); + x_102_phi = x_92; + if (x_92) { + const int x_96 = asint(x_9[1].x); + const float x_98 = A[x_96]; + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const float x_100 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_101 = (x_98 == x_100); + x_102_phi = x_101; + } + if (x_102_phi) { + const int x_107 = asint(x_9[1].x); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_110 = asint(x_9[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const uint scalar_offset_7 = ((16u * uint(0))) / 4; + const int x_113 = asint(x_9[scalar_offset_7 / 4][scalar_offset_7 % 4]); + const int x_116 = asint(x_9[1].x); + x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + const int x_120 = asint(x_9[1].x); + const float x_121 = float(x_120); + x_GLF_color = float4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a7a8dbb87d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.msl @@ -0,0 +1,132 @@ +#include + +using namespace metal; +struct tint_padded_array_element { + /* 0x0000 */ float el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[3]; +}; +struct buf1 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values; +}; +struct tint_padded_array_element_1 { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad_1[12]; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ tint_padded_array_element_1 arr[4]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_2 { + float arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) { + tint_array_wrapper_2 A = {}; + int i = 0; + int j = 0; + bool x_101 = false; + bool x_102_phi = false; + float const x_39 = x_6.x_GLF_uniform_float_values.arr[1].el; + A.arr[0] = x_39; + float const x_42 = x_6.x_GLF_uniform_float_values.arr[1].el; + A.arr[1] = x_42; + int const x_45 = x_9.x_GLF_uniform_int_values.arr[0].el; + i = x_45; + while (true) { + int const x_50 = i; + int const x_52 = x_9.x_GLF_uniform_int_values.arr[3].el; + if ((x_50 < x_52)) { + } else { + break; + } + int const x_56 = x_9.x_GLF_uniform_int_values.arr[0].el; + j = x_56; + while (true) { + int const x_61 = j; + int const x_63 = x_9.x_GLF_uniform_int_values.arr[2].el; + if ((x_61 < x_63)) { + } else { + break; + } + int const x_66 = j; + switch(x_66) { + case 1: { + int const x_78 = i; + float const x_80 = x_6.x_GLF_uniform_float_values.arr[0].el; + A.arr[x_78] = x_80; + break; + } + case 0: { + int const x_70 = i; + if ((-2147483648 < x_70)) { + { + int const x_82 = j; + j = (x_82 + 1); + } + continue; + } + int const x_74 = i; + float const x_76 = x_6.x_GLF_uniform_float_values.arr[2].el; + A.arr[x_74] = x_76; + break; + } + default: { + break; + } + } + { + int const x_82 = j; + j = (x_82 + 1); + } + } + { + int const x_84 = i; + i = (x_84 + 1); + } + } + int const x_87 = x_9.x_GLF_uniform_int_values.arr[0].el; + float const x_89 = A.arr[x_87]; + float const x_91 = x_6.x_GLF_uniform_float_values.arr[0].el; + bool const x_92 = (x_89 == x_91); + x_102_phi = x_92; + if (x_92) { + int const x_96 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_98 = A.arr[x_96]; + float const x_100 = x_6.x_GLF_uniform_float_values.arr[0].el; + x_101 = (x_98 == x_100); + x_102_phi = x_101; + } + bool const x_102 = x_102_phi; + if (x_102) { + int const x_107 = x_9.x_GLF_uniform_int_values.arr[1].el; + int const x_110 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_113 = x_9.x_GLF_uniform_int_values.arr[0].el; + int const x_116 = x_9.x_GLF_uniform_int_values.arr[1].el; + *(tint_symbol_4) = float4(float(x_107), float(x_110), float(x_113), float(x_116)); + } else { + int const x_120 = x_9.x_GLF_uniform_int_values.arr[1].el; + float const x_121 = float(x_120); + *(tint_symbol_4) = float4(x_121, x_121, x_121, x_121); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..9acf823e49 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.spvasm @@ -0,0 +1,245 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 150 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "x_GLF_uniform_float_values" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %A "A" + OpName %i "i" + OpName %j "j" + OpName %x_101 "x_101" + OpName %x_102_phi "x_102_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %_arr_float_uint_3 ArrayStride 16 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_4 ArrayStride 16 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %buf1 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %buf0 = OpTypeStruct %_arr_int_uint_4 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %28 = OpConstantNull %_arr_float_uint_2 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %36 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 +%int_n2147483648 = OpConstant %int -2147483648 + %main_out = OpTypeStruct %v4float + %138 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %A = OpVariable %_ptr_Function__arr_float_uint_2 Function %28 + %i = OpVariable %_ptr_Function_int Function %31 + %j = OpVariable %_ptr_Function_int Function %31 + %x_101 = OpVariable %_ptr_Function_bool Function %36 + %x_102_phi = OpVariable %_ptr_Function_bool Function %36 + %41 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %42 = OpLoad %float %41 + %45 = OpAccessChain %_ptr_Function_float %A %int_0 + OpStore %45 %42 + %46 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1 + %47 = OpLoad %float %46 + %48 = OpAccessChain %_ptr_Function_float %A %int_1 + OpStore %48 %47 + %50 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %51 = OpLoad %int %50 + OpStore %i %51 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %i + %58 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_3 + %59 = OpLoad %int %58 + %60 = OpSLessThan %bool %56 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %53 + %61 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %65 = OpLoad %int %64 + OpStore %j %65 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %70 = OpLoad %int %j + %72 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2 + %73 = OpLoad %int %72 + %74 = OpSLessThan %bool %70 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpBranch %75 + %77 = OpLabel + OpBranch %67 + %75 = OpLabel + %78 = OpLoad %int %j + OpSelectionMerge %79 None + OpSwitch %78 %80 1 %81 0 %82 + %81 = OpLabel + %83 = OpLoad %int %i + %84 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Function_float %A %83 + OpStore %86 %85 + OpBranch %79 + %82 = OpLabel + %87 = OpLoad %int %i + %89 = OpSLessThan %bool %int_n2147483648 %87 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + OpBranch %68 + %90 = OpLabel + %92 = OpLoad %int %i + %93 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_2 + %94 = OpLoad %float %93 + %95 = OpAccessChain %_ptr_Function_float %A %92 + OpStore %95 %94 + OpBranch %79 + %80 = OpLabel + OpBranch %79 + %79 = OpLabel + OpBranch %68 + %68 = OpLabel + %96 = OpLoad %int %j + %97 = OpIAdd %int %96 %int_1 + OpStore %j %97 + OpBranch %66 + %67 = OpLabel + OpBranch %54 + %54 = OpLabel + %98 = OpLoad %int %i + %99 = OpIAdd %int %98 %int_1 + OpStore %i %99 + OpBranch %52 + %53 = OpLabel + %100 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %101 = OpLoad %int %100 + %102 = OpAccessChain %_ptr_Function_float %A %101 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %105 = OpLoad %float %104 + %106 = OpFOrdEqual %bool %103 %105 + OpStore %x_102_phi %106 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %107 + %108 = OpLabel + %109 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Function_float %A %110 + %112 = OpLoad %float %111 + %113 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0 + %114 = OpLoad %float %113 + %115 = OpFOrdEqual %bool %112 %114 + OpStore %x_101 %115 + %116 = OpLoad %bool %x_101 + OpStore %x_102_phi %116 + OpBranch %107 + %107 = OpLabel + %117 = OpLoad %bool %x_102_phi + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %120 + %119 = OpLabel + %121 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %122 = OpLoad %int %121 + %123 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %124 = OpLoad %int %123 + %125 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0 + %126 = OpLoad %int %125 + %127 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %128 = OpLoad %int %127 + %129 = OpConvertSToF %float %122 + %130 = OpConvertSToF %float %124 + %131 = OpConvertSToF %float %126 + %132 = OpConvertSToF %float %128 + %133 = OpCompositeConstruct %v4float %129 %130 %131 %132 + OpStore %x_GLF_color %133 + OpBranch %118 + %120 = OpLabel + %134 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1 + %135 = OpLoad %int %134 + %136 = OpConvertSToF %float %135 + %137 = OpCompositeConstruct %v4float %136 %136 %136 %136 + OpStore %x_GLF_color %137 + OpBranch %118 + %118 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %138 +%tint_symbol = OpFunctionParameter %main_out + %142 = OpLabel + %143 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %143 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %145 = OpLabel + %146 = OpFunctionCall %void %main_1 + %148 = OpLoad %v4float %x_GLF_color + %149 = OpCompositeConstruct %main_out %148 + %147 = OpFunctionCall %void %tint_symbol_2 %149 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..e999646185 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.wgsl @@ -0,0 +1,116 @@ +type Arr = [[stride(16)]] array; + +[[block]] +struct buf1 { + x_GLF_uniform_float_values : Arr; +}; + +type Arr_1 = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr_1; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A : array; + var i : i32; + var j : i32; + var x_101 : bool; + var x_102_phi : bool; + let x_39 : f32 = x_6.x_GLF_uniform_float_values[1]; + A[0] = x_39; + let x_42 : f32 = x_6.x_GLF_uniform_float_values[1]; + A[1] = x_42; + let x_45 : i32 = x_9.x_GLF_uniform_int_values[0]; + i = x_45; + loop { + let x_50 : i32 = i; + let x_52 : i32 = x_9.x_GLF_uniform_int_values[3]; + if ((x_50 < x_52)) { + } else { + break; + } + let x_56 : i32 = x_9.x_GLF_uniform_int_values[0]; + j = x_56; + loop { + let x_61 : i32 = j; + let x_63 : i32 = x_9.x_GLF_uniform_int_values[2]; + if ((x_61 < x_63)) { + } else { + break; + } + let x_66 : i32 = j; + switch(x_66) { + case 1: { + let x_78 : i32 = i; + let x_80 : f32 = x_6.x_GLF_uniform_float_values[0]; + A[x_78] = x_80; + } + case 0: { + let x_70 : i32 = i; + if ((-2147483648 < x_70)) { + continue; + } + let x_74 : i32 = i; + let x_76 : f32 = x_6.x_GLF_uniform_float_values[2]; + A[x_74] = x_76; + } + default: { + } + } + + continuing { + let x_82 : i32 = j; + j = (x_82 + 1); + } + } + + continuing { + let x_84 : i32 = i; + i = (x_84 + 1); + } + } + let x_87 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_89 : f32 = A[x_87]; + let x_91 : f32 = x_6.x_GLF_uniform_float_values[0]; + let x_92 : bool = (x_89 == x_91); + x_102_phi = x_92; + if (x_92) { + let x_96 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_98 : f32 = A[x_96]; + let x_100 : f32 = x_6.x_GLF_uniform_float_values[0]; + x_101 = (x_98 == x_100); + x_102_phi = x_101; + } + let x_102 : bool = x_102_phi; + if (x_102) { + let x_107 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_110 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_113 : i32 = x_9.x_GLF_uniform_int_values[0]; + let x_116 : i32 = x_9.x_GLF_uniform_int_values[1]; + x_GLF_color = vec4(f32(x_107), f32(x_110), f32(x_113), f32(x_116)); + } else { + let x_120 : i32 = x_9.x_GLF_uniform_int_values[1]; + let x_121 : f32 = f32(x_120); + x_GLF_color = vec4(x_121, x_121, x_121, x_121); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm new file mode 100644 index 0000000000..3b3dec792d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm @@ -0,0 +1,124 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %S "S" + OpMemberName %S 0 "a" + OpMemberName %S 1 "b" + OpMemberName %S 2 "c" + OpName %A "A" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "_GLF_uniform_int_values" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_S_uint_2 = OpTypeArray %S %uint_2 +%_ptr_Function__arr_S_uint_2 = OpTypePointer Function %_arr_S_uint_2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_S = OpTypePointer Function %S +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %10 + %27 = OpLabel + %A = OpVariable %_ptr_Function__arr_S_uint_2 Function + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %29 = OpLoad %int %28 + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %31 = OpLoad %int %30 + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %33 = OpLoad %int %32 + %34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %35 = OpLoad %int %34 + %36 = OpCompositeConstruct %S %31 %33 %35 + %37 = OpAccessChain %_ptr_Function_S %A %29 + OpStore %37 %36 + %38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %39 = OpLoad %int %38 + %40 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %41 = OpLoad %int %40 + %42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %45 = OpLoad %int %44 + %46 = OpCompositeConstruct %S %41 %43 %45 + %47 = OpAccessChain %_ptr_Function_S %A %39 + OpStore %47 %46 + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_Function_int %A %49 %int_1 + %51 = OpLoad %int %50 + %52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %53 = OpLoad %int %52 + %54 = OpIEqual %bool %51 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %58 = OpLoad %int %57 + %59 = OpExtInst %int %1 SClamp %58 %int_1 %int_2 + %60 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %61 = OpLoad %int %60 + %62 = OpAccessChain %_ptr_Function_int %A %59 %int_1 + OpStore %62 %61 + OpBranch %55 + %55 = OpLabel + %63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpAccessChain %_ptr_Function_int %A %64 %int_1 + %66 = OpLoad %int %65 + %67 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %68 = OpLoad %int %67 + %69 = OpIEqual %bool %66 %68 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %74 = OpLoad %int %73 + %75 = OpConvertSToF %float %74 + %76 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %77 = OpLoad %int %76 + %78 = OpConvertSToF %float %77 + %79 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1 + %80 = OpLoad %int %79 + %81 = OpConvertSToF %float %80 + %82 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %83 = OpLoad %int %82 + %84 = OpConvertSToF %float %83 + %85 = OpCompositeConstruct %v4float %75 %78 %81 %84 + OpStore %_GLF_color %85 + OpBranch %70 + %72 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0 + %87 = OpLoad %int %86 + %88 = OpConvertSToF %float %87 + %89 = OpCompositeConstruct %v4float %88 %88 %88 %88 + OpStore %_GLF_color %89 + OpBranch %70 + %70 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9591e381d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.hlsl @@ -0,0 +1,70 @@ +struct S { + int a; + int b; + int c; +}; + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + S A[2] = (S[2])0; + const int x_29 = asint(x_7[1].x); + const int x_31 = asint(x_7[1].x); + const int x_33 = asint(x_7[1].x); + const int x_35 = asint(x_7[1].x); + const S tint_symbol_3 = {x_31, x_33, x_35}; + A[x_29] = tint_symbol_3; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_39 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const int x_41 = asint(x_7[1].x); + const int x_43 = asint(x_7[1].x); + const int x_45 = asint(x_7[1].x); + const S tint_symbol_4 = {x_41, x_43, x_45}; + A[x_39] = tint_symbol_4; + const int x_49 = asint(x_7[1].x); + const int x_51 = A[x_49].b; + const int x_53 = asint(x_7[1].x); + if ((x_51 == x_53)) { + const int x_58 = asint(x_7[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_61 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + A[clamp(x_58, 1, 2)].b = x_61; + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_64 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_66 = A[x_64].b; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_68 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_66 == x_68)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const int x_77 = asint(x_7[1].x); + const int x_80 = asint(x_7[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_83 = asint(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(float(x_74), float(x_77), float(x_80), float(x_83)); + } else { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_87 = asint(x_7[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_88 = float(x_87); + x_GLF_color = float4(x_88, x_88, x_88, x_88); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..69de413b40 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct S { + int a; + int b; + int c; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + S arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_6) { + tint_array_wrapper_1 A = {}; + int const x_29 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_31 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_33 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_35 = x_7.x_GLF_uniform_int_values.arr[1].el; + S const tint_symbol_3 = {.a=x_31, .b=x_33, .c=x_35}; + A.arr[x_29] = tint_symbol_3; + int const x_39 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_41 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_43 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_45 = x_7.x_GLF_uniform_int_values.arr[1].el; + S const tint_symbol_4 = {.a=x_41, .b=x_43, .c=x_45}; + A.arr[x_39] = tint_symbol_4; + int const x_49 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_51 = A.arr[x_49].b; + int const x_53 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_51 == x_53)) { + int const x_58 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_7.x_GLF_uniform_int_values.arr[0].el; + A.arr[clamp(x_58, 1, 2)].b = x_61; + } + int const x_64 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_66 = A.arr[x_64].b; + int const x_68 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_66 == x_68)) { + int const x_74 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_77 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_80 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_83 = x_7.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_74), float(x_77), float(x_80), float(x_83)); + } else { + int const x_87 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_88 = float(x_87); + *(tint_symbol_6) = float4(x_88, x_88, x_88, x_88); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + main_1(x_7, &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..d53643b70b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.spvasm @@ -0,0 +1,163 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 108 +; Schema: 0 + OpCapability Shader + %66 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %S "S" + OpMemberName %S 0 "a" + OpMemberName %S 1 "b" + OpMemberName %S 2 "c" + OpName %A "A" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpMemberDecorate %S 2 Offset 8 + OpDecorate %_arr_S_uint_2 ArrayStride 12 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %S = OpTypeStruct %int %int %int +%_arr_S_uint_2 = OpTypeArray %S %uint_2 +%_ptr_Function__arr_S_uint_2 = OpTypePointer Function %_arr_S_uint_2 + %23 = OpConstantNull %_arr_S_uint_2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_S = OpTypePointer Function %S + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %96 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %A = OpVariable %_ptr_Function__arr_S_uint_2 Function %23 + %27 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %28 = OpLoad %int %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %30 = OpLoad %int %29 + %31 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %32 = OpLoad %int %31 + %33 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %34 = OpLoad %int %33 + %36 = OpAccessChain %_ptr_Function_S %A %28 + %37 = OpCompositeConstruct %S %30 %32 %34 + OpStore %36 %37 + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %40 = OpLoad %int %39 + %41 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Function_S %A %40 + %48 = OpCompositeConstruct %S %42 %44 %46 + OpStore %47 %48 + %49 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %50 = OpLoad %int %49 + %53 = OpAccessChain %_ptr_Function_int %A %50 %uint_1 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpIEqual %bool %54 %56 + OpSelectionMerge %59 None + OpBranchConditional %57 %60 %59 + %60 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpExtInst %int %66 SClamp %62 %int_1 %int_2 + %68 = OpAccessChain %_ptr_Function_int %A %65 %uint_1 + OpStore %68 %64 + OpBranch %59 + %59 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpAccessChain %_ptr_Function_int %A %70 %uint_1 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %74 = OpLoad %int %73 + %75 = OpIEqual %bool %72 %74 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %78 + %77 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %80 + %88 = OpConvertSToF %float %82 + %89 = OpConvertSToF %float %84 + %90 = OpConvertSToF %float %86 + %91 = OpCompositeConstruct %v4float %87 %88 %89 %90 + OpStore %x_GLF_color %91 + OpBranch %76 + %78 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %93 = OpLoad %int %92 + %94 = OpConvertSToF %float %93 + %95 = OpCompositeConstruct %v4float %94 %94 %94 %94 + OpStore %x_GLF_color %95 + OpBranch %76 + %76 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %96 +%tint_symbol = OpFunctionParameter %main_out + %100 = OpLabel + %101 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %101 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %103 = OpLabel + %104 = OpFunctionCall %void %main_1 + %106 = OpLoad %v4float %x_GLF_color + %107 = OpCompositeConstruct %main_out %106 + %105 = OpFunctionCall %void %tint_symbol_2 %107 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..af4102ca9f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.spvasm.expected.wgsl @@ -0,0 +1,64 @@ +struct S { + a : i32; + b : i32; + c : i32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A : array; + let x_29 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_31 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_33 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_35 : i32 = x_7.x_GLF_uniform_int_values[1]; + A[x_29] = S(x_31, x_33, x_35); + let x_39 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_43 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_7.x_GLF_uniform_int_values[1]; + A[x_39] = S(x_41, x_43, x_45); + let x_49 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_51 : i32 = A[x_49].b; + let x_53 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_51 == x_53)) { + let x_58 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_7.x_GLF_uniform_int_values[0]; + A[clamp(x_58, 1, 2)].b = x_61; + } + let x_64 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_66 : i32 = A[x_64].b; + let x_68 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_66 == x_68)) { + let x_74 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_77 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_80 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_83 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_74), f32(x_77), f32(x_80), f32(x_83)); + } else { + let x_87 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_88 : f32 = f32(x_87); + x_GLF_color = vec4(x_88, x_88, x_88, x_88); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl new file mode 100644 index 0000000000..af4102ca9f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl @@ -0,0 +1,64 @@ +struct S { + a : i32; + b : i32; + c : i32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A : array; + let x_29 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_31 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_33 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_35 : i32 = x_7.x_GLF_uniform_int_values[1]; + A[x_29] = S(x_31, x_33, x_35); + let x_39 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_43 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_7.x_GLF_uniform_int_values[1]; + A[x_39] = S(x_41, x_43, x_45); + let x_49 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_51 : i32 = A[x_49].b; + let x_53 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_51 == x_53)) { + let x_58 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_7.x_GLF_uniform_int_values[0]; + A[clamp(x_58, 1, 2)].b = x_61; + } + let x_64 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_66 : i32 = A[x_64].b; + let x_68 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_66 == x_68)) { + let x_74 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_77 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_80 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_83 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_74), f32(x_77), f32(x_80), f32(x_83)); + } else { + let x_87 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_88 : f32 = f32(x_87); + x_GLF_color = vec4(x_88, x_88, x_88, x_88); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9591e381d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.hlsl @@ -0,0 +1,70 @@ +struct S { + int a; + int b; + int c; +}; + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[2]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + S A[2] = (S[2])0; + const int x_29 = asint(x_7[1].x); + const int x_31 = asint(x_7[1].x); + const int x_33 = asint(x_7[1].x); + const int x_35 = asint(x_7[1].x); + const S tint_symbol_3 = {x_31, x_33, x_35}; + A[x_29] = tint_symbol_3; + const uint scalar_offset = ((16u * uint(0))) / 4; + const int x_39 = asint(x_7[scalar_offset / 4][scalar_offset % 4]); + const int x_41 = asint(x_7[1].x); + const int x_43 = asint(x_7[1].x); + const int x_45 = asint(x_7[1].x); + const S tint_symbol_4 = {x_41, x_43, x_45}; + A[x_39] = tint_symbol_4; + const int x_49 = asint(x_7[1].x); + const int x_51 = A[x_49].b; + const int x_53 = asint(x_7[1].x); + if ((x_51 == x_53)) { + const int x_58 = asint(x_7[1].x); + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_61 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]); + A[clamp(x_58, 1, 2)].b = x_61; + } + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_64 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const int x_66 = A[x_64].b; + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_68 = asint(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]); + if ((x_66 == x_68)) { + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_74 = asint(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]); + const int x_77 = asint(x_7[1].x); + const int x_80 = asint(x_7[1].x); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_83 = asint(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]); + x_GLF_color = float4(float(x_74), float(x_77), float(x_80), float(x_83)); + } else { + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_87 = asint(x_7[scalar_offset_6 / 4][scalar_offset_6 % 4]); + const float x_88 = float(x_87); + x_GLF_color = float4(x_88, x_88, x_88, x_88); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..69de413b40 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct S { + int a; + int b; + int c; +}; +struct tint_padded_array_element { + /* 0x0000 */ int el; + /* 0x0004 */ int8_t tint_pad[12]; +}; +struct tint_array_wrapper { + /* 0x0000 */ tint_padded_array_element arr[2]; +}; +struct buf0 { + /* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values; +}; +struct tint_array_wrapper_1 { + S arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_6) { + tint_array_wrapper_1 A = {}; + int const x_29 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_31 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_33 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_35 = x_7.x_GLF_uniform_int_values.arr[1].el; + S const tint_symbol_3 = {.a=x_31, .b=x_33, .c=x_35}; + A.arr[x_29] = tint_symbol_3; + int const x_39 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_41 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_43 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_45 = x_7.x_GLF_uniform_int_values.arr[1].el; + S const tint_symbol_4 = {.a=x_41, .b=x_43, .c=x_45}; + A.arr[x_39] = tint_symbol_4; + int const x_49 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_51 = A.arr[x_49].b; + int const x_53 = x_7.x_GLF_uniform_int_values.arr[1].el; + if ((x_51 == x_53)) { + int const x_58 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_61 = x_7.x_GLF_uniform_int_values.arr[0].el; + A.arr[clamp(x_58, 1, 2)].b = x_61; + } + int const x_64 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_66 = A.arr[x_64].b; + int const x_68 = x_7.x_GLF_uniform_int_values.arr[0].el; + if ((x_66 == x_68)) { + int const x_74 = x_7.x_GLF_uniform_int_values.arr[0].el; + int const x_77 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_80 = x_7.x_GLF_uniform_int_values.arr[1].el; + int const x_83 = x_7.x_GLF_uniform_int_values.arr[0].el; + *(tint_symbol_6) = float4(float(x_74), float(x_77), float(x_80), float(x_83)); + } else { + int const x_87 = x_7.x_GLF_uniform_int_values.arr[0].el; + float const x_88 = float(x_87); + *(tint_symbol_6) = float4(x_88, x_88, x_88, x_88); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + main_1(x_7, &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..d53643b70b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.spvasm @@ -0,0 +1,163 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 108 +; Schema: 0 + OpCapability Shader + %66 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "x_GLF_uniform_int_values" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %S "S" + OpMemberName %S 0 "a" + OpMemberName %S 1 "b" + OpMemberName %S 2 "c" + OpName %A "A" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %_arr_int_uint_2 ArrayStride 16 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpMemberDecorate %S 2 Offset 8 + OpDecorate %_arr_S_uint_2 ArrayStride 12 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 + %buf0 = OpTypeStruct %_arr_int_uint_2 +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %S = OpTypeStruct %int %int %int +%_arr_S_uint_2 = OpTypeArray %S %uint_2 +%_ptr_Function__arr_S_uint_2 = OpTypePointer Function %_arr_S_uint_2 + %23 = OpConstantNull %_arr_S_uint_2 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Function_S = OpTypePointer Function %S + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %main_out = OpTypeStruct %v4float + %96 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %A = OpVariable %_ptr_Function__arr_S_uint_2 Function %23 + %27 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %28 = OpLoad %int %27 + %29 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %30 = OpLoad %int %29 + %31 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %32 = OpLoad %int %31 + %33 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %34 = OpLoad %int %33 + %36 = OpAccessChain %_ptr_Function_S %A %28 + %37 = OpCompositeConstruct %S %30 %32 %34 + OpStore %36 %37 + %39 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %40 = OpLoad %int %39 + %41 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %42 = OpLoad %int %41 + %43 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %44 = OpLoad %int %43 + %45 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Function_S %A %40 + %48 = OpCompositeConstruct %S %42 %44 %46 + OpStore %47 %48 + %49 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %50 = OpLoad %int %49 + %53 = OpAccessChain %_ptr_Function_int %A %50 %uint_1 + %54 = OpLoad %int %53 + %55 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %56 = OpLoad %int %55 + %57 = OpIEqual %bool %54 %56 + OpSelectionMerge %59 None + OpBranchConditional %57 %60 %59 + %60 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %64 = OpLoad %int %63 + %65 = OpExtInst %int %66 SClamp %62 %int_1 %int_2 + %68 = OpAccessChain %_ptr_Function_int %A %65 %uint_1 + OpStore %68 %64 + OpBranch %59 + %59 = OpLabel + %69 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %70 = OpLoad %int %69 + %71 = OpAccessChain %_ptr_Function_int %A %70 %uint_1 + %72 = OpLoad %int %71 + %73 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %74 = OpLoad %int %73 + %75 = OpIEqual %bool %72 %74 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %78 + %77 = OpLabel + %79 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %80 = OpLoad %int %79 + %81 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %86 = OpLoad %int %85 + %87 = OpConvertSToF %float %80 + %88 = OpConvertSToF %float %82 + %89 = OpConvertSToF %float %84 + %90 = OpConvertSToF %float %86 + %91 = OpCompositeConstruct %v4float %87 %88 %89 %90 + OpStore %x_GLF_color %91 + OpBranch %76 + %78 = OpLabel + %92 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0 + %93 = OpLoad %int %92 + %94 = OpConvertSToF %float %93 + %95 = OpCompositeConstruct %v4float %94 %94 %94 %94 + OpStore %x_GLF_color %95 + OpBranch %76 + %76 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %96 +%tint_symbol = OpFunctionParameter %main_out + %100 = OpLabel + %101 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %101 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %103 = OpLabel + %104 = OpFunctionCall %void %main_1 + %106 = OpLoad %v4float %x_GLF_color + %107 = OpCompositeConstruct %main_out %106 + %105 = OpFunctionCall %void %tint_symbol_2 %107 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..af4102ca9f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-selection-dag-struct-array-clamp-index/0-opt.wgsl.expected.wgsl @@ -0,0 +1,64 @@ +struct S { + a : i32; + b : i32; + c : i32; +}; + +type Arr = [[stride(16)]] array; + +[[block]] +struct buf0 { + x_GLF_uniform_int_values : Arr; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var A : array; + let x_29 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_31 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_33 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_35 : i32 = x_7.x_GLF_uniform_int_values[1]; + A[x_29] = S(x_31, x_33, x_35); + let x_39 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_41 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_43 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_45 : i32 = x_7.x_GLF_uniform_int_values[1]; + A[x_39] = S(x_41, x_43, x_45); + let x_49 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_51 : i32 = A[x_49].b; + let x_53 : i32 = x_7.x_GLF_uniform_int_values[1]; + if ((x_51 == x_53)) { + let x_58 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_61 : i32 = x_7.x_GLF_uniform_int_values[0]; + A[clamp(x_58, 1, 2)].b = x_61; + } + let x_64 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_66 : i32 = A[x_64].b; + let x_68 : i32 = x_7.x_GLF_uniform_int_values[0]; + if ((x_66 == x_68)) { + let x_74 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_77 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_80 : i32 = x_7.x_GLF_uniform_int_values[1]; + let x_83 : i32 = x_7.x_GLF_uniform_int_values[0]; + x_GLF_color = vec4(f32(x_74), f32(x_77), f32(x_80), f32(x_83)); + } else { + let x_87 : i32 = x_7.x_GLF_uniform_int_values[0]; + let x_88 : f32 = f32(x_87); + x_GLF_color = vec4(x_88, x_88, x_88, x_88); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm new file mode 100644 index 0000000000..2c268fb63e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm @@ -0,0 +1,174 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v "v" + OpName %floats "floats" + OpName %one "one" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %i "i" + OpName %alwaysFalse "alwaysFalse" + OpName %_GLF_color "_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v2float %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function_int = OpTypePointer Function %int + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %uint_0 = OpConstant %uint 0 + %float_1 = OpConstant %float 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %37 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %38 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %41 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %42 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main = OpFunction %void None %13 + %43 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function + %floats = OpVariable %_ptr_Function__arr_float_uint_9 Function + %one = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function +%alwaysFalse = OpVariable %_ptr_Function_bool Function + OpStore %v %18 + %44 = OpAccessChain %_ptr_Function_float %floats %int_1 + OpStore %44 %float_0 + %45 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %46 = OpLoad %float %45 + %47 = OpConvertFToS %int %46 + OpStore %one %47 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + OpStore %i %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %i + %57 = OpLoad %int %one + %58 = OpSLessThan %bool %56 %57 + OpBranchConditional %58 %59 %53 + %59 = OpLabel + %60 = OpLoad %int %i + %61 = OpIEqual %bool %60 %int_0 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %65 = OpLoad %float %64 + %66 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %67 = OpLoad %float %66 + %68 = OpFOrdGreaterThan %bool %65 %67 + OpStore %alwaysFalse %68 + %69 = OpLoad %bool %alwaysFalse + %70 = OpLogicalNot %bool %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %73 = OpLoad %int %one + %74 = OpAccessChain %_ptr_Function_float %floats %73 + OpStore %74 %float_1 + OpStore %_GLF_color %37 + OpBranch %71 + %71 = OpLabel + %75 = OpLoad %int %one + %76 = OpAccessChain %_ptr_Function_float %v %75 + OpStore %76 %float_1 + %77 = OpLoad %bool %alwaysFalse + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %78 + %79 = OpLabel + OpKill + %78 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %81 = OpLoad %float %80 + %82 = OpFOrdLessThan %bool %81 %float_0 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + OpStore %_GLF_color %38 + OpBranch %83 + %83 = OpLabel + OpBranch %62 + %62 = OpLabel + OpBranch %54 + %54 = OpLabel + %85 = OpLoad %int %i + %86 = OpIAdd %int %85 %int_1 + OpStore %i %86 + OpBranch %52 + %53 = OpLabel + OpBranch %50 + %50 = OpLabel + %87 = OpLoad %int %one + %88 = OpSLessThan %bool %87 %int_0 + OpBranchConditional %88 %48 %49 + %49 = OpLabel + %89 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %90 = OpLoad %float %89 + %91 = OpFOrdGreaterThanEqual %bool %90 %float_0 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %94 + %93 = OpLabel + %95 = OpAccessChain %_ptr_Function_float %v %uint_1 + %96 = OpLoad %float %95 + %97 = OpFOrdEqual %bool %96 %float_1 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpAccessChain %_ptr_Function_float %floats %int_1 + %101 = OpLoad %float %100 + %102 = OpFOrdEqual %bool %101 %float_1 + OpBranch %98 + %98 = OpLabel + %103 = OpPhi %bool %97 %93 %102 %99 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + OpStore %_GLF_color %41 + OpBranch %104 + %104 = OpLabel + OpBranch %92 + %94 = OpLabel + OpStore %_GLF_color %42 + OpBranch %92 + %92 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..6f9a2b722e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,89 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v = float2(0.0f, 0.0f); + float floats[9] = (float[9])0; + int one = 0; + int i = 0; + bool alwaysFalse = false; + v = float2(0.0f, 0.0f); + floats[1] = 0.0f; + const float x_46 = asfloat(x_9[0].y); + one = int(x_46); + while (true) { + i = 0; + { + for(; (i < one); i = (i + 1)) { + if ((i == 0)) { + const float x_65 = asfloat(x_9[0].x); + const float x_67 = asfloat(x_9[0].y); + alwaysFalse = (x_65 > x_67); + if (!(alwaysFalse)) { + floats[one] = 1.0f; + x_GLF_color = float4(1.0f, 1.0f, 0.0f, 1.0f); + } + set_float2(v, one, 1.0f); + if (alwaysFalse) { + discard; + } + const float x_81 = asfloat(x_9[0].y); + if ((x_81 < 0.0f)) { + x_GLF_color = float4(0.0f, 1.0f, 0.0f, 1.0f); + } + } + } + } + { + if ((one < 0)) { + } else { + break; + } + } + } + bool x_102 = false; + bool x_103_phi = false; + const float x_90 = gl_FragCoord.y; + if ((x_90 >= 0.0f)) { + const float x_96 = v.y; + const bool x_97 = (x_96 == 1.0f); + x_103_phi = x_97; + if (x_97) { + const float x_101 = floats[1]; + x_102 = (x_101 == 1.0f); + x_103_phi = x_102; + } + if (x_103_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..bea4a4bc27 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,102 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 v = 0.0f; + tint_array_wrapper floats = {}; + int one = 0; + int i = 0; + bool alwaysFalse = false; + v = float2(0.0f, 0.0f); + floats.arr[1] = 0.0f; + float const x_46 = x_9.injectionSwitch.y; + one = int(x_46); + while (true) { + i = 0; + while (true) { + int const x_56 = i; + int const x_57 = one; + if ((x_56 < x_57)) { + } else { + break; + } + int const x_60 = i; + if ((x_60 == 0)) { + float const x_65 = x_9.injectionSwitch.x; + float const x_67 = x_9.injectionSwitch.y; + alwaysFalse = (x_65 > x_67); + bool const x_69 = alwaysFalse; + if (!(x_69)) { + int const x_73 = one; + floats.arr[x_73] = 1.0f; + *(tint_symbol_5) = float4(1.0f, 1.0f, 0.0f, 1.0f); + } + int const x_75 = one; + v[x_75] = 1.0f; + bool const x_77 = alwaysFalse; + if (x_77) { + discard_fragment(); + } + float const x_81 = x_9.injectionSwitch.y; + if ((x_81 < 0.0f)) { + *(tint_symbol_5) = float4(0.0f, 1.0f, 0.0f, 1.0f); + } + } + { + int const x_85 = i; + i = (x_85 + 1); + } + } + { + int const x_87 = one; + if ((x_87 < 0)) { + } else { + break; + } + } + } + bool x_102 = false; + bool x_103_phi = false; + float const x_90 = (*(tint_symbol_6)).y; + if ((x_90 >= 0.0f)) { + float const x_96 = v.y; + bool const x_97 = (x_96 == 1.0f); + x_103_phi = x_97; + if (x_97) { + float const x_101 = floats.arr[1]; + x_102 = (x_101 == 1.0f); + x_103_phi = x_102; + } + bool const x_103 = x_103_phi; + if (x_103) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } else { + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_9, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f3b9a3acca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,239 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 134 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %v "v" + OpName %floats "floats" + OpName %one "one" + OpName %i "i" + OpName %alwaysFalse "alwaysFalse" + OpName %x_102 "x_102" + OpName %x_103_phi "x_103_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpConstantNull %v2float + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %27 = OpConstantNull %_arr_float_uint_9 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %36 = OpConstantNull %bool + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v2float %float_0 %float_0 + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %79 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %90 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 +%_ptr_Private_float = OpTypePointer Private %float + %119 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %120 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %121 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %21 + %floats = OpVariable %_ptr_Function__arr_float_uint_9 Function %27 + %one = OpVariable %_ptr_Function_int Function %31 + %i = OpVariable %_ptr_Function_int Function %31 +%alwaysFalse = OpVariable %_ptr_Function_bool Function %36 + %x_102 = OpVariable %_ptr_Function_bool Function %36 + %x_103_phi = OpVariable %_ptr_Function_bool Function %36 + OpStore %v %38 + %41 = OpAccessChain %_ptr_Function_float %floats %int_1 + OpStore %41 %float_0 + %45 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %46 = OpLoad %float %45 + %47 = OpConvertFToS %int %46 + OpStore %one %47 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + OpStore %i %int_0 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %int %i + %58 = OpLoad %int %one + %59 = OpSLessThan %bool %57 %58 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %54 + %60 = OpLabel + %63 = OpLoad %int %i + %64 = OpIEqual %bool %63 %int_0 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %70 = OpLoad %float %69 + %71 = OpFOrdGreaterThan %bool %68 %70 + OpStore %alwaysFalse %71 + %72 = OpLoad %bool %alwaysFalse + %73 = OpLogicalNot %bool %72 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %74 + %75 = OpLabel + %76 = OpLoad %int %one + %77 = OpAccessChain %_ptr_Function_float %floats %76 + OpStore %77 %float_1 + OpStore %x_GLF_color %79 + OpBranch %74 + %74 = OpLabel + %80 = OpLoad %int %one + %81 = OpAccessChain %_ptr_Function_float %v %80 + OpStore %81 %float_1 + %82 = OpLoad %bool %alwaysFalse + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + OpKill + %83 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %86 = OpLoad %float %85 + %87 = OpFOrdLessThan %bool %86 %float_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + OpStore %x_GLF_color %90 + OpBranch %88 + %88 = OpLabel + OpBranch %65 + %65 = OpLabel + OpBranch %55 + %55 = OpLabel + %91 = OpLoad %int %i + %92 = OpIAdd %int %91 %int_1 + OpStore %i %92 + OpBranch %53 + %54 = OpLabel + OpBranch %50 + %50 = OpLabel + %93 = OpLoad %int %one + %94 = OpSLessThan %bool %93 %int_0 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %97 + %96 = OpLabel + OpBranch %95 + %97 = OpLabel + OpBranch %49 + %95 = OpLabel + OpBranch %48 + %49 = OpLabel + %101 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %102 = OpLoad %float %101 + %103 = OpFOrdGreaterThanEqual %bool %102 %float_0 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %106 + %105 = OpLabel + %107 = OpAccessChain %_ptr_Function_float %v %uint_1 + %108 = OpLoad %float %107 + %109 = OpFOrdEqual %bool %108 %float_1 + OpStore %x_103_phi %109 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpAccessChain %_ptr_Function_float %floats %int_1 + %113 = OpLoad %float %112 + %114 = OpFOrdEqual %bool %113 %float_1 + OpStore %x_102 %114 + %115 = OpLoad %bool %x_102 + OpStore %x_103_phi %115 + OpBranch %110 + %110 = OpLabel + %116 = OpLoad %bool %x_103_phi + OpSelectionMerge %117 None + OpBranchConditional %116 %118 %117 + %118 = OpLabel + OpStore %x_GLF_color %119 + OpBranch %117 + %117 = OpLabel + OpBranch %104 + %106 = OpLabel + OpStore %x_GLF_color %120 + OpBranch %104 + %104 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %121 +%tint_symbol_1 = OpFunctionParameter %main_out + %125 = OpLabel + %126 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %126 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %128 = OpLabel + %129 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %129 + %130 = OpFunctionCall %void %main_1 + %132 = OpLoad %v4float %x_GLF_color + %133 = OpCompositeConstruct %main_out %132 + %131 = OpFunctionCall %void %tint_symbol_3 %133 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 50[%50] is not post dominated by the back-edge block 95[%95] + %95 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..6d6d467703 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,100 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var v : vec2; + var floats : array; + var one : i32; + var i : i32; + var alwaysFalse : bool; + v = vec2(0.0, 0.0); + floats[1] = 0.0; + let x_46 : f32 = x_9.injectionSwitch.y; + one = i32(x_46); + loop { + i = 0; + loop { + let x_56 : i32 = i; + let x_57 : i32 = one; + if ((x_56 < x_57)) { + } else { + break; + } + let x_60 : i32 = i; + if ((x_60 == 0)) { + let x_65 : f32 = x_9.injectionSwitch.x; + let x_67 : f32 = x_9.injectionSwitch.y; + alwaysFalse = (x_65 > x_67); + let x_69 : bool = alwaysFalse; + if (!(x_69)) { + let x_73 : i32 = one; + floats[x_73] = 1.0; + x_GLF_color = vec4(1.0, 1.0, 0.0, 1.0); + } + let x_75 : i32 = one; + v[x_75] = 1.0; + let x_77 : bool = alwaysFalse; + if (x_77) { + discard; + } + let x_81 : f32 = x_9.injectionSwitch.y; + if ((x_81 < 0.0)) { + x_GLF_color = vec4(0.0, 1.0, 0.0, 1.0); + } + } + + continuing { + let x_85 : i32 = i; + i = (x_85 + 1); + } + } + + continuing { + let x_87 : i32 = one; + if ((x_87 < 0)) { + } else { + break; + } + } + } + var x_102 : bool; + var x_103_phi : bool; + let x_90 : f32 = gl_FragCoord.y; + if ((x_90 >= 0.0)) { + let x_96 : f32 = v.y; + let x_97 : bool = (x_96 == 1.0); + x_103_phi = x_97; + if (x_97) { + let x_101 : f32 = floats[1]; + x_102 = (x_101 == 1.0); + x_103_phi = x_102; + } + let x_103 : bool = x_103_phi; + if (x_103) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl new file mode 100644 index 0000000000..6d6d467703 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl @@ -0,0 +1,100 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var v : vec2; + var floats : array; + var one : i32; + var i : i32; + var alwaysFalse : bool; + v = vec2(0.0, 0.0); + floats[1] = 0.0; + let x_46 : f32 = x_9.injectionSwitch.y; + one = i32(x_46); + loop { + i = 0; + loop { + let x_56 : i32 = i; + let x_57 : i32 = one; + if ((x_56 < x_57)) { + } else { + break; + } + let x_60 : i32 = i; + if ((x_60 == 0)) { + let x_65 : f32 = x_9.injectionSwitch.x; + let x_67 : f32 = x_9.injectionSwitch.y; + alwaysFalse = (x_65 > x_67); + let x_69 : bool = alwaysFalse; + if (!(x_69)) { + let x_73 : i32 = one; + floats[x_73] = 1.0; + x_GLF_color = vec4(1.0, 1.0, 0.0, 1.0); + } + let x_75 : i32 = one; + v[x_75] = 1.0; + let x_77 : bool = alwaysFalse; + if (x_77) { + discard; + } + let x_81 : f32 = x_9.injectionSwitch.y; + if ((x_81 < 0.0)) { + x_GLF_color = vec4(0.0, 1.0, 0.0, 1.0); + } + } + + continuing { + let x_85 : i32 = i; + i = (x_85 + 1); + } + } + + continuing { + let x_87 : i32 = one; + if ((x_87 < 0)) { + } else { + break; + } + } + } + var x_102 : bool; + var x_103_phi : bool; + let x_90 : f32 = gl_FragCoord.y; + if ((x_90 >= 0.0)) { + let x_96 : f32 = v.y; + let x_97 : bool = (x_96 == 1.0); + x_103_phi = x_97; + if (x_97) { + let x_101 : f32 = floats[1]; + x_102 = (x_101 == 1.0); + x_103_phi = x_102; + } + let x_103 : bool = x_103_phi; + if (x_103) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..6f9a2b722e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,89 @@ +void set_float2(inout float2 vec, int idx, float val) { + vec = (idx.xx == int2(0, 1)) ? val.xx : vec; +} + +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 v = float2(0.0f, 0.0f); + float floats[9] = (float[9])0; + int one = 0; + int i = 0; + bool alwaysFalse = false; + v = float2(0.0f, 0.0f); + floats[1] = 0.0f; + const float x_46 = asfloat(x_9[0].y); + one = int(x_46); + while (true) { + i = 0; + { + for(; (i < one); i = (i + 1)) { + if ((i == 0)) { + const float x_65 = asfloat(x_9[0].x); + const float x_67 = asfloat(x_9[0].y); + alwaysFalse = (x_65 > x_67); + if (!(alwaysFalse)) { + floats[one] = 1.0f; + x_GLF_color = float4(1.0f, 1.0f, 0.0f, 1.0f); + } + set_float2(v, one, 1.0f); + if (alwaysFalse) { + discard; + } + const float x_81 = asfloat(x_9[0].y); + if ((x_81 < 0.0f)) { + x_GLF_color = float4(0.0f, 1.0f, 0.0f, 1.0f); + } + } + } + } + { + if ((one < 0)) { + } else { + break; + } + } + } + bool x_102 = false; + bool x_103_phi = false; + const float x_90 = gl_FragCoord.y; + if ((x_90 >= 0.0f)) { + const float x_96 = v.y; + const bool x_97 = (x_96 == 1.0f); + x_103_phi = x_97; + if (x_97) { + const float x_101 = floats[1]; + x_102 = (x_101 == 1.0f); + x_103_phi = x_102; + } + if (x_103_phi) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..bea4a4bc27 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,102 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 v = 0.0f; + tint_array_wrapper floats = {}; + int one = 0; + int i = 0; + bool alwaysFalse = false; + v = float2(0.0f, 0.0f); + floats.arr[1] = 0.0f; + float const x_46 = x_9.injectionSwitch.y; + one = int(x_46); + while (true) { + i = 0; + while (true) { + int const x_56 = i; + int const x_57 = one; + if ((x_56 < x_57)) { + } else { + break; + } + int const x_60 = i; + if ((x_60 == 0)) { + float const x_65 = x_9.injectionSwitch.x; + float const x_67 = x_9.injectionSwitch.y; + alwaysFalse = (x_65 > x_67); + bool const x_69 = alwaysFalse; + if (!(x_69)) { + int const x_73 = one; + floats.arr[x_73] = 1.0f; + *(tint_symbol_5) = float4(1.0f, 1.0f, 0.0f, 1.0f); + } + int const x_75 = one; + v[x_75] = 1.0f; + bool const x_77 = alwaysFalse; + if (x_77) { + discard_fragment(); + } + float const x_81 = x_9.injectionSwitch.y; + if ((x_81 < 0.0f)) { + *(tint_symbol_5) = float4(0.0f, 1.0f, 0.0f, 1.0f); + } + } + { + int const x_85 = i; + i = (x_85 + 1); + } + } + { + int const x_87 = one; + if ((x_87 < 0)) { + } else { + break; + } + } + } + bool x_102 = false; + bool x_103_phi = false; + float const x_90 = (*(tint_symbol_6)).y; + if ((x_90 >= 0.0f)) { + float const x_96 = v.y; + bool const x_97 = (x_96 == 1.0f); + x_103_phi = x_97; + if (x_97) { + float const x_101 = floats.arr[1]; + x_102 = (x_101 == 1.0f); + x_103_phi = x_102; + } + bool const x_103 = x_103_phi; + if (x_103) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } else { + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_9, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f3b9a3acca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,239 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 134 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %v "v" + OpName %floats "floats" + OpName %one "one" + OpName %i "i" + OpName %alwaysFalse "alwaysFalse" + OpName %x_102 "x_102" + OpName %x_103_phi "x_103_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %21 = OpConstantNull %v2float + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %27 = OpConstantNull %_arr_float_uint_9 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %36 = OpConstantNull %bool + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v2float %float_0 %float_0 + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %79 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %90 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 +%_ptr_Private_float = OpTypePointer Private %float + %119 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %120 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %121 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %21 + %floats = OpVariable %_ptr_Function__arr_float_uint_9 Function %27 + %one = OpVariable %_ptr_Function_int Function %31 + %i = OpVariable %_ptr_Function_int Function %31 +%alwaysFalse = OpVariable %_ptr_Function_bool Function %36 + %x_102 = OpVariable %_ptr_Function_bool Function %36 + %x_103_phi = OpVariable %_ptr_Function_bool Function %36 + OpStore %v %38 + %41 = OpAccessChain %_ptr_Function_float %floats %int_1 + OpStore %41 %float_0 + %45 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %46 = OpLoad %float %45 + %47 = OpConvertFToS %int %46 + OpStore %one %47 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + OpStore %i %int_0 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %int %i + %58 = OpLoad %int %one + %59 = OpSLessThan %bool %57 %58 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %54 + %60 = OpLabel + %63 = OpLoad %int %i + %64 = OpIEqual %bool %63 %int_0 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + %67 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %70 = OpLoad %float %69 + %71 = OpFOrdGreaterThan %bool %68 %70 + OpStore %alwaysFalse %71 + %72 = OpLoad %bool %alwaysFalse + %73 = OpLogicalNot %bool %72 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %74 + %75 = OpLabel + %76 = OpLoad %int %one + %77 = OpAccessChain %_ptr_Function_float %floats %76 + OpStore %77 %float_1 + OpStore %x_GLF_color %79 + OpBranch %74 + %74 = OpLabel + %80 = OpLoad %int %one + %81 = OpAccessChain %_ptr_Function_float %v %80 + OpStore %81 %float_1 + %82 = OpLoad %bool %alwaysFalse + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + OpKill + %83 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %86 = OpLoad %float %85 + %87 = OpFOrdLessThan %bool %86 %float_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + OpStore %x_GLF_color %90 + OpBranch %88 + %88 = OpLabel + OpBranch %65 + %65 = OpLabel + OpBranch %55 + %55 = OpLabel + %91 = OpLoad %int %i + %92 = OpIAdd %int %91 %int_1 + OpStore %i %92 + OpBranch %53 + %54 = OpLabel + OpBranch %50 + %50 = OpLabel + %93 = OpLoad %int %one + %94 = OpSLessThan %bool %93 %int_0 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %97 + %96 = OpLabel + OpBranch %95 + %97 = OpLabel + OpBranch %49 + %95 = OpLabel + OpBranch %48 + %49 = OpLabel + %101 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %102 = OpLoad %float %101 + %103 = OpFOrdGreaterThanEqual %bool %102 %float_0 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %106 + %105 = OpLabel + %107 = OpAccessChain %_ptr_Function_float %v %uint_1 + %108 = OpLoad %float %107 + %109 = OpFOrdEqual %bool %108 %float_1 + OpStore %x_103_phi %109 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpAccessChain %_ptr_Function_float %floats %int_1 + %113 = OpLoad %float %112 + %114 = OpFOrdEqual %bool %113 %float_1 + OpStore %x_102 %114 + %115 = OpLoad %bool %x_102 + OpStore %x_103_phi %115 + OpBranch %110 + %110 = OpLabel + %116 = OpLoad %bool %x_103_phi + OpSelectionMerge %117 None + OpBranchConditional %116 %118 %117 + %118 = OpLabel + OpStore %x_GLF_color %119 + OpBranch %117 + %117 = OpLabel + OpBranch %104 + %106 = OpLabel + OpStore %x_GLF_color %120 + OpBranch %104 + %104 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %121 +%tint_symbol_1 = OpFunctionParameter %main_out + %125 = OpLabel + %126 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %126 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %128 = OpLabel + %129 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %129 + %130 = OpFunctionCall %void %main_1 + %132 = OpLoad %v4float %x_GLF_color + %133 = OpCompositeConstruct %main_out %132 + %131 = OpFunctionCall %void %tint_symbol_3 %133 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 50[%50] is not post dominated by the back-edge block 95[%95] + %95 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..6d6d467703 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/create-color-in-do-while-for-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,100 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var v : vec2; + var floats : array; + var one : i32; + var i : i32; + var alwaysFalse : bool; + v = vec2(0.0, 0.0); + floats[1] = 0.0; + let x_46 : f32 = x_9.injectionSwitch.y; + one = i32(x_46); + loop { + i = 0; + loop { + let x_56 : i32 = i; + let x_57 : i32 = one; + if ((x_56 < x_57)) { + } else { + break; + } + let x_60 : i32 = i; + if ((x_60 == 0)) { + let x_65 : f32 = x_9.injectionSwitch.x; + let x_67 : f32 = x_9.injectionSwitch.y; + alwaysFalse = (x_65 > x_67); + let x_69 : bool = alwaysFalse; + if (!(x_69)) { + let x_73 : i32 = one; + floats[x_73] = 1.0; + x_GLF_color = vec4(1.0, 1.0, 0.0, 1.0); + } + let x_75 : i32 = one; + v[x_75] = 1.0; + let x_77 : bool = alwaysFalse; + if (x_77) { + discard; + } + let x_81 : f32 = x_9.injectionSwitch.y; + if ((x_81 < 0.0)) { + x_GLF_color = vec4(0.0, 1.0, 0.0, 1.0); + } + } + + continuing { + let x_85 : i32 = i; + i = (x_85 + 1); + } + } + + continuing { + let x_87 : i32 = one; + if ((x_87 < 0)) { + } else { + break; + } + } + } + var x_102 : bool; + var x_103_phi : bool; + let x_90 : f32 = gl_FragCoord.y; + if ((x_90 >= 0.0)) { + let x_96 : f32 = v.y; + let x_97 : bool = (x_96 == 1.0); + x_103_phi = x_97; + if (x_97) { + let x_101 : f32 = floats[1]; + x_102 = (x_101 == 1.0); + x_103_phi = x_102; + } + let x_103 : bool = x_103_phi; + if (x_103) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm new file mode 100644 index 0000000000..a59ed0e4ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm @@ -0,0 +1,196 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource ESSL 310 + OpName %main "main" + OpName %theSSBO "theSSBO" + OpMemberName %theSSBO 0 "out_data" + OpName %_ "" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %__0 "" + OpName %i "i" + OpName %GLF_live3s "GLF_live3s" + OpName %i_0 "i" + OpName %z "z" + OpMemberDecorate %theSSBO 0 Offset 0 + OpDecorate %theSSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %theSSBO = OpTypeStruct %int +%_ptr_Uniform_theSSBO = OpTypePointer Uniform %theSSBO + %_ = OpVariable %_ptr_Uniform_theSSBO Uniform + %int_0 = OpConstant %int 0 + %int_42 = OpConstant %int 42 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %12 + %34 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %GLF_live3s = OpVariable %_ptr_Function_float Function + %i_0 = OpVariable %_ptr_Function_int Function + %z = OpVariable %_ptr_Function_int Function + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + OpStore %35 %int_42 + %36 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %39 = OpLoad %float %38 + %40 = OpFOrdGreaterThan %bool %37 %39 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %41 + %41 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %44 = OpLoad %float %43 + %45 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %46 = OpLoad %float %45 + %47 = OpFOrdGreaterThan %bool %44 %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %48 + %48 = OpLabel + %50 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %51 = OpLoad %float %50 + %52 = OpConvertFToS %int %51 + OpStore %i %52 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %int %i + %58 = OpSGreaterThan %bool %57 %int_0 + OpBranchConditional %58 %59 %54 + %59 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %55 + %55 = OpLabel + %60 = OpLoad %int %i + %61 = OpISub %int %60 %int_1 + OpStore %i %61 + OpBranch %53 + %54 = OpLabel + OpStore %GLF_live3s %float_0 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + OpStore %i_0 %int_1 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %70 = OpLoad %int %i_0 + %71 = OpSLessThan %bool %70 %int_2 + OpBranchConditional %71 %72 %67 + %72 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %74 = OpLoad %float %73 + %75 = OpFOrdGreaterThan %bool %74 %float_1 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %76 + %77 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %76 + %76 = OpLabel + %78 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %81 = OpLoad %float %80 + %82 = OpFOrdGreaterThan %bool %79 %81 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %83 + %83 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %86 = OpLoad %float %85 + %87 = OpConvertFToS %int %86 + OpStore %z %87 + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %z + %93 = OpSGreaterThan %bool %92 %int_0 + OpBranchConditional %93 %94 %89 + %94 = OpLabel + %95 = OpLoad %float %GLF_live3s + %96 = OpFAdd %float %95 %float_1 + OpStore %GLF_live3s %96 + OpBranch %90 + %90 = OpLabel + %97 = OpLoad %int %z + %98 = OpISub %int %97 %int_1 + OpStore %z %98 + OpBranch %88 + %89 = OpLabel + %99 = OpLoad %int %i_0 + %100 = OpSGreaterThanEqual %bool %99 %int_1 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %104 = OpLoad %float %103 + %105 = OpFOrdGreaterThan %bool %104 %float_1 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %106 + %106 = OpLabel + OpBranch %101 + %101 = OpLabel + OpBranch %68 + %68 = OpLabel + %108 = OpLoad %int %i_0 + %109 = OpIAdd %int %108 %int_1 + OpStore %i_0 %109 + OpBranch %66 + %67 = OpLabel + OpBranch %64 + %64 = OpLabel + %110 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %111 = OpLoad %float %110 + %112 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %113 = OpLoad %float %112 + %114 = OpFOrdGreaterThan %bool %111 %113 + OpBranchConditional %114 %62 %63 + %63 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..a18cdf6fbd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.hlsl @@ -0,0 +1,74 @@ +RWByteAddressBuffer x_4 : register(u0, space0); +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[1]; +}; + +void main_1() { + int i = 0; + float GLF_live3s = 0.0f; + int i_1 = 0; + int z = 0; + x_4.Store(0u, asuint(42)); + const float x_37 = asfloat(x_6[0].x); + const float x_39 = asfloat(x_6[0].y); + if ((x_37 > x_39)) { + GroupMemoryBarrierWithGroupSync(); + } + const float x_44 = asfloat(x_6[0].x); + const float x_46 = asfloat(x_6[0].y); + if ((x_44 > x_46)) { + GroupMemoryBarrierWithGroupSync(); + } + const float x_51 = asfloat(x_6[0].y); + i = int(x_51); + { + for(; (i > 0); i = (i - 1)) { + GroupMemoryBarrierWithGroupSync(); + } + } + GLF_live3s = 0.0f; + while (true) { + i_1 = 1; + { + for(; (i_1 < 2); i_1 = (i_1 + 1)) { + const float x_74 = asfloat(x_6[0].x); + if ((x_74 > 1.0f)) { + GroupMemoryBarrierWithGroupSync(); + } + const float x_79 = asfloat(x_6[0].x); + const float x_81 = asfloat(x_6[0].y); + if ((x_79 > x_81)) { + GroupMemoryBarrierWithGroupSync(); + } + const float x_86 = asfloat(x_6[0].y); + z = int(x_86); + { + for(; (z > 0); z = (z - 1)) { + GLF_live3s = (GLF_live3s + 1.0f); + } + } + if ((i_1 >= 1)) { + const float x_104 = asfloat(x_6[0].x); + if ((x_104 > 1.0f)) { + GroupMemoryBarrierWithGroupSync(); + } + } + } + } + { + const float x_111 = asfloat(x_6[0].x); + const float x_113 = asfloat(x_6[0].y); + if ((x_111 > x_113)) { + } else { + break; + } + } + } + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..3fa3858546 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.msl @@ -0,0 +1,102 @@ +#include + +using namespace metal; +struct theSSBO { + /* 0x0000 */ int out_data; +}; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; + +void main_1(constant buf1& x_6, device theSSBO& x_4) { + int i = 0; + float GLF_live3s = 0.0f; + int i_1 = 0; + int z = 0; + x_4.out_data = 42; + float const x_37 = x_6.injectionSwitch.x; + float const x_39 = x_6.injectionSwitch.y; + if ((x_37 > x_39)) { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + float const x_44 = x_6.injectionSwitch.x; + float const x_46 = x_6.injectionSwitch.y; + if ((x_44 > x_46)) { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + float const x_51 = x_6.injectionSwitch.y; + i = int(x_51); + while (true) { + int const x_57 = i; + if ((x_57 > 0)) { + } else { + break; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + { + int const x_60 = i; + i = (x_60 - 1); + } + } + GLF_live3s = 0.0f; + while (true) { + i_1 = 1; + while (true) { + int const x_70 = i_1; + if ((x_70 < 2)) { + } else { + break; + } + float const x_74 = x_6.injectionSwitch.x; + if ((x_74 > 1.0f)) { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + float const x_79 = x_6.injectionSwitch.x; + float const x_81 = x_6.injectionSwitch.y; + if ((x_79 > x_81)) { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + float const x_86 = x_6.injectionSwitch.y; + z = int(x_86); + while (true) { + int const x_92 = z; + if ((x_92 > 0)) { + } else { + break; + } + float const x_95 = GLF_live3s; + GLF_live3s = (x_95 + 1.0f); + { + int const x_97 = z; + z = (x_97 - 1); + } + } + int const x_99 = i_1; + if ((x_99 >= 1)) { + float const x_104 = x_6.injectionSwitch.x; + if ((x_104 > 1.0f)) { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + } + { + int const x_108 = i_1; + i_1 = (x_108 + 1); + } + } + { + float const x_111 = x_6.injectionSwitch.x; + float const x_113 = x_6.injectionSwitch.y; + if ((x_111 > x_113)) { + } else { + break; + } + } + } + return; +} + +kernel void tint_symbol(constant buf1& x_6 [[buffer(1)]], device theSSBO& x_4 [[buffer(0)]]) { + main_1(x_6, x_4); + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..62ce97121c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.spvasm @@ -0,0 +1,235 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 134 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %theSSBO "theSSBO" + OpMemberName %theSSBO 0 "out_data" + OpName %x_4 "x_4" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %main_1 "main_1" + OpName %i "i" + OpName %GLF_live3s "GLF_live3s" + OpName %i_1 "i_1" + OpName %z "z" + OpName %main "main" + OpDecorate %theSSBO Block + OpMemberDecorate %theSSBO 0 Offset 0 + OpDecorate %x_4 DescriptorSet 0 + OpDecorate %x_4 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + %int = OpTypeInt 32 1 + %theSSBO = OpTypeStruct %int +%_ptr_StorageBuffer_theSSBO = OpTypePointer StorageBuffer %theSSBO + %x_4 = OpVariable %_ptr_StorageBuffer_theSSBO StorageBuffer + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %void = OpTypeVoid + %10 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %16 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_42 = OpConstant %int 42 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %main_1 = OpFunction %void None %10 + %13 = OpLabel + %i = OpVariable %_ptr_Function_int Function %16 + %GLF_live3s = OpVariable %_ptr_Function_float Function %19 + %i_1 = OpVariable %_ptr_Function_int Function %16 + %z = OpVariable %_ptr_Function_int Function %16 + %25 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_0 + OpStore %25 %int_42 + %28 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %29 = OpLoad %float %28 + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %32 = OpLoad %float %31 + %33 = OpFOrdGreaterThan %bool %29 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %35 + %35 = OpLabel + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %43 = OpLoad %float %42 + %44 = OpFOrdGreaterThan %bool %41 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %45 + %45 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %49 = OpLoad %float %48 + %50 = OpConvertFToS %int %49 + OpStore %i %50 + OpBranch %51 + %51 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %int %i + %57 = OpSGreaterThan %bool %55 %int_0 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %52 + %58 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %53 + %53 = OpLabel + %62 = OpLoad %int %i + %64 = OpISub %int %62 %int_1 + OpStore %i %64 + OpBranch %51 + %52 = OpLabel + OpStore %GLF_live3s %float_0 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + OpStore %i_1 %int_1 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %int %i_1 + %76 = OpSLessThan %bool %74 %int_2 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + OpBranch %77 + %79 = OpLabel + OpBranch %71 + %77 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %81 = OpLoad %float %80 + %83 = OpFOrdGreaterThan %bool %81 %float_1 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %84 + %85 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %84 + %84 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %88 = OpLoad %float %87 + %89 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %90 = OpLoad %float %89 + %91 = OpFOrdGreaterThan %bool %88 %90 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %92 + %93 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %92 + %92 = OpLabel + %95 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %96 = OpLoad %float %95 + %97 = OpConvertFToS %int %96 + OpStore %z %97 + OpBranch %98 + %98 = OpLabel + OpLoopMerge %99 %100 None + OpBranch %101 + %101 = OpLabel + %102 = OpLoad %int %z + %103 = OpSGreaterThan %bool %102 %int_0 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %106 + %105 = OpLabel + OpBranch %104 + %106 = OpLabel + OpBranch %99 + %104 = OpLabel + %107 = OpLoad %float %GLF_live3s + %108 = OpFAdd %float %107 %float_1 + OpStore %GLF_live3s %108 + OpBranch %100 + %100 = OpLabel + %109 = OpLoad %int %z + %110 = OpISub %int %109 %int_1 + OpStore %z %110 + OpBranch %98 + %99 = OpLabel + %111 = OpLoad %int %i_1 + %112 = OpSGreaterThanEqual %bool %111 %int_1 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + %115 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %116 = OpLoad %float %115 + %117 = OpFOrdGreaterThan %bool %116 %float_1 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %118 + %118 = OpLabel + OpBranch %113 + %113 = OpLabel + OpBranch %72 + %72 = OpLabel + %121 = OpLoad %int %i_1 + %122 = OpIAdd %int %121 %int_1 + OpStore %i_1 %122 + OpBranch %70 + %71 = OpLabel + OpBranch %68 + %68 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %124 = OpLoad %float %123 + %125 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %126 = OpLoad %float %125 + %127 = OpFOrdGreaterThan %bool %124 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %130 + %129 = OpLabel + OpBranch %128 + %130 = OpLabel + OpBranch %67 + %128 = OpLabel + OpBranch %66 + %67 = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %10 + %132 = OpLabel + %133 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 68[%68] is not post dominated by the back-edge block 128[%128] + %128 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..899baacdb5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.spvasm.expected.wgsl @@ -0,0 +1,109 @@ +[[block]] +struct theSSBO { + out_data : i32; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_4 : theSSBO; + +[[group(0), binding(1)]] var x_6 : buf1; + +fn main_1() { + var i : i32; + var GLF_live3s : f32; + var i_1 : i32; + var z : i32; + x_4.out_data = 42; + let x_37 : f32 = x_6.injectionSwitch.x; + let x_39 : f32 = x_6.injectionSwitch.y; + if ((x_37 > x_39)) { + workgroupBarrier(); + } + let x_44 : f32 = x_6.injectionSwitch.x; + let x_46 : f32 = x_6.injectionSwitch.y; + if ((x_44 > x_46)) { + workgroupBarrier(); + } + let x_51 : f32 = x_6.injectionSwitch.y; + i = i32(x_51); + loop { + let x_57 : i32 = i; + if ((x_57 > 0)) { + } else { + break; + } + workgroupBarrier(); + + continuing { + let x_60 : i32 = i; + i = (x_60 - 1); + } + } + GLF_live3s = 0.0; + loop { + i_1 = 1; + loop { + let x_70 : i32 = i_1; + if ((x_70 < 2)) { + } else { + break; + } + let x_74 : f32 = x_6.injectionSwitch.x; + if ((x_74 > 1.0)) { + workgroupBarrier(); + } + let x_79 : f32 = x_6.injectionSwitch.x; + let x_81 : f32 = x_6.injectionSwitch.y; + if ((x_79 > x_81)) { + workgroupBarrier(); + } + let x_86 : f32 = x_6.injectionSwitch.y; + z = i32(x_86); + loop { + let x_92 : i32 = z; + if ((x_92 > 0)) { + } else { + break; + } + let x_95 : f32 = GLF_live3s; + GLF_live3s = (x_95 + 1.0); + + continuing { + let x_97 : i32 = z; + z = (x_97 - 1); + } + } + let x_99 : i32 = i_1; + if ((x_99 >= 1)) { + let x_104 : f32 = x_6.injectionSwitch.x; + if ((x_104 > 1.0)) { + workgroupBarrier(); + } + } + + continuing { + let x_108 : i32 = i_1; + i_1 = (x_108 + 1); + } + } + + continuing { + let x_111 : f32 = x_6.injectionSwitch.x; + let x_113 : f32 = x_6.injectionSwitch.y; + if ((x_111 > x_113)) { + } else { + break; + } + } + } + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl new file mode 100644 index 0000000000..899baacdb5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl @@ -0,0 +1,109 @@ +[[block]] +struct theSSBO { + out_data : i32; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_4 : theSSBO; + +[[group(0), binding(1)]] var x_6 : buf1; + +fn main_1() { + var i : i32; + var GLF_live3s : f32; + var i_1 : i32; + var z : i32; + x_4.out_data = 42; + let x_37 : f32 = x_6.injectionSwitch.x; + let x_39 : f32 = x_6.injectionSwitch.y; + if ((x_37 > x_39)) { + workgroupBarrier(); + } + let x_44 : f32 = x_6.injectionSwitch.x; + let x_46 : f32 = x_6.injectionSwitch.y; + if ((x_44 > x_46)) { + workgroupBarrier(); + } + let x_51 : f32 = x_6.injectionSwitch.y; + i = i32(x_51); + loop { + let x_57 : i32 = i; + if ((x_57 > 0)) { + } else { + break; + } + workgroupBarrier(); + + continuing { + let x_60 : i32 = i; + i = (x_60 - 1); + } + } + GLF_live3s = 0.0; + loop { + i_1 = 1; + loop { + let x_70 : i32 = i_1; + if ((x_70 < 2)) { + } else { + break; + } + let x_74 : f32 = x_6.injectionSwitch.x; + if ((x_74 > 1.0)) { + workgroupBarrier(); + } + let x_79 : f32 = x_6.injectionSwitch.x; + let x_81 : f32 = x_6.injectionSwitch.y; + if ((x_79 > x_81)) { + workgroupBarrier(); + } + let x_86 : f32 = x_6.injectionSwitch.y; + z = i32(x_86); + loop { + let x_92 : i32 = z; + if ((x_92 > 0)) { + } else { + break; + } + let x_95 : f32 = GLF_live3s; + GLF_live3s = (x_95 + 1.0); + + continuing { + let x_97 : i32 = z; + z = (x_97 - 1); + } + } + let x_99 : i32 = i_1; + if ((x_99 >= 1)) { + let x_104 : f32 = x_6.injectionSwitch.x; + if ((x_104 > 1.0)) { + workgroupBarrier(); + } + } + + continuing { + let x_108 : i32 = i_1; + i_1 = (x_108 + 1); + } + } + + continuing { + let x_111 : f32 = x_6.injectionSwitch.x; + let x_113 : f32 = x_6.injectionSwitch.y; + if ((x_111 > x_113)) { + } else { + break; + } + } + } + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..a18cdf6fbd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.hlsl @@ -0,0 +1,74 @@ +RWByteAddressBuffer x_4 : register(u0, space0); +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[1]; +}; + +void main_1() { + int i = 0; + float GLF_live3s = 0.0f; + int i_1 = 0; + int z = 0; + x_4.Store(0u, asuint(42)); + const float x_37 = asfloat(x_6[0].x); + const float x_39 = asfloat(x_6[0].y); + if ((x_37 > x_39)) { + GroupMemoryBarrierWithGroupSync(); + } + const float x_44 = asfloat(x_6[0].x); + const float x_46 = asfloat(x_6[0].y); + if ((x_44 > x_46)) { + GroupMemoryBarrierWithGroupSync(); + } + const float x_51 = asfloat(x_6[0].y); + i = int(x_51); + { + for(; (i > 0); i = (i - 1)) { + GroupMemoryBarrierWithGroupSync(); + } + } + GLF_live3s = 0.0f; + while (true) { + i_1 = 1; + { + for(; (i_1 < 2); i_1 = (i_1 + 1)) { + const float x_74 = asfloat(x_6[0].x); + if ((x_74 > 1.0f)) { + GroupMemoryBarrierWithGroupSync(); + } + const float x_79 = asfloat(x_6[0].x); + const float x_81 = asfloat(x_6[0].y); + if ((x_79 > x_81)) { + GroupMemoryBarrierWithGroupSync(); + } + const float x_86 = asfloat(x_6[0].y); + z = int(x_86); + { + for(; (z > 0); z = (z - 1)) { + GLF_live3s = (GLF_live3s + 1.0f); + } + } + if ((i_1 >= 1)) { + const float x_104 = asfloat(x_6[0].x); + if ((x_104 > 1.0f)) { + GroupMemoryBarrierWithGroupSync(); + } + } + } + } + { + const float x_111 = asfloat(x_6[0].x); + const float x_113 = asfloat(x_6[0].y); + if ((x_111 > x_113)) { + } else { + break; + } + } + } + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..3fa3858546 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.msl @@ -0,0 +1,102 @@ +#include + +using namespace metal; +struct theSSBO { + /* 0x0000 */ int out_data; +}; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; + +void main_1(constant buf1& x_6, device theSSBO& x_4) { + int i = 0; + float GLF_live3s = 0.0f; + int i_1 = 0; + int z = 0; + x_4.out_data = 42; + float const x_37 = x_6.injectionSwitch.x; + float const x_39 = x_6.injectionSwitch.y; + if ((x_37 > x_39)) { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + float const x_44 = x_6.injectionSwitch.x; + float const x_46 = x_6.injectionSwitch.y; + if ((x_44 > x_46)) { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + float const x_51 = x_6.injectionSwitch.y; + i = int(x_51); + while (true) { + int const x_57 = i; + if ((x_57 > 0)) { + } else { + break; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + { + int const x_60 = i; + i = (x_60 - 1); + } + } + GLF_live3s = 0.0f; + while (true) { + i_1 = 1; + while (true) { + int const x_70 = i_1; + if ((x_70 < 2)) { + } else { + break; + } + float const x_74 = x_6.injectionSwitch.x; + if ((x_74 > 1.0f)) { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + float const x_79 = x_6.injectionSwitch.x; + float const x_81 = x_6.injectionSwitch.y; + if ((x_79 > x_81)) { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + float const x_86 = x_6.injectionSwitch.y; + z = int(x_86); + while (true) { + int const x_92 = z; + if ((x_92 > 0)) { + } else { + break; + } + float const x_95 = GLF_live3s; + GLF_live3s = (x_95 + 1.0f); + { + int const x_97 = z; + z = (x_97 - 1); + } + } + int const x_99 = i_1; + if ((x_99 >= 1)) { + float const x_104 = x_6.injectionSwitch.x; + if ((x_104 > 1.0f)) { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + } + { + int const x_108 = i_1; + i_1 = (x_108 + 1); + } + } + { + float const x_111 = x_6.injectionSwitch.x; + float const x_113 = x_6.injectionSwitch.y; + if ((x_111 > x_113)) { + } else { + break; + } + } + } + return; +} + +kernel void tint_symbol(constant buf1& x_6 [[buffer(1)]], device theSSBO& x_4 [[buffer(0)]]) { + main_1(x_6, x_4); + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..62ce97121c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.spvasm @@ -0,0 +1,235 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 134 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %theSSBO "theSSBO" + OpMemberName %theSSBO 0 "out_data" + OpName %x_4 "x_4" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %main_1 "main_1" + OpName %i "i" + OpName %GLF_live3s "GLF_live3s" + OpName %i_1 "i_1" + OpName %z "z" + OpName %main "main" + OpDecorate %theSSBO Block + OpMemberDecorate %theSSBO 0 Offset 0 + OpDecorate %x_4 DescriptorSet 0 + OpDecorate %x_4 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + %int = OpTypeInt 32 1 + %theSSBO = OpTypeStruct %int +%_ptr_StorageBuffer_theSSBO = OpTypePointer StorageBuffer %theSSBO + %x_4 = OpVariable %_ptr_StorageBuffer_theSSBO StorageBuffer + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %void = OpTypeVoid + %10 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %16 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_42 = OpConstant %int 42 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %main_1 = OpFunction %void None %10 + %13 = OpLabel + %i = OpVariable %_ptr_Function_int Function %16 + %GLF_live3s = OpVariable %_ptr_Function_float Function %19 + %i_1 = OpVariable %_ptr_Function_int Function %16 + %z = OpVariable %_ptr_Function_int Function %16 + %25 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_0 + OpStore %25 %int_42 + %28 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %29 = OpLoad %float %28 + %31 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %32 = OpLoad %float %31 + %33 = OpFOrdGreaterThan %bool %29 %32 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %35 + %35 = OpLabel + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %41 = OpLoad %float %40 + %42 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %43 = OpLoad %float %42 + %44 = OpFOrdGreaterThan %bool %41 %43 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %45 + %45 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %49 = OpLoad %float %48 + %50 = OpConvertFToS %int %49 + OpStore %i %50 + OpBranch %51 + %51 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %int %i + %57 = OpSGreaterThan %bool %55 %int_0 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %52 + %58 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %53 + %53 = OpLabel + %62 = OpLoad %int %i + %64 = OpISub %int %62 %int_1 + OpStore %i %64 + OpBranch %51 + %52 = OpLabel + OpStore %GLF_live3s %float_0 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + OpStore %i_1 %int_1 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %74 = OpLoad %int %i_1 + %76 = OpSLessThan %bool %74 %int_2 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + OpBranch %77 + %79 = OpLabel + OpBranch %71 + %77 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %81 = OpLoad %float %80 + %83 = OpFOrdGreaterThan %bool %81 %float_1 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %84 + %85 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %84 + %84 = OpLabel + %87 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %88 = OpLoad %float %87 + %89 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %90 = OpLoad %float %89 + %91 = OpFOrdGreaterThan %bool %88 %90 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %92 + %93 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %92 + %92 = OpLabel + %95 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %96 = OpLoad %float %95 + %97 = OpConvertFToS %int %96 + OpStore %z %97 + OpBranch %98 + %98 = OpLabel + OpLoopMerge %99 %100 None + OpBranch %101 + %101 = OpLabel + %102 = OpLoad %int %z + %103 = OpSGreaterThan %bool %102 %int_0 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %106 + %105 = OpLabel + OpBranch %104 + %106 = OpLabel + OpBranch %99 + %104 = OpLabel + %107 = OpLoad %float %GLF_live3s + %108 = OpFAdd %float %107 %float_1 + OpStore %GLF_live3s %108 + OpBranch %100 + %100 = OpLabel + %109 = OpLoad %int %z + %110 = OpISub %int %109 %int_1 + OpStore %z %110 + OpBranch %98 + %99 = OpLabel + %111 = OpLoad %int %i_1 + %112 = OpSGreaterThanEqual %bool %111 %int_1 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + %115 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %116 = OpLoad %float %115 + %117 = OpFOrdGreaterThan %bool %116 %float_1 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %118 + %118 = OpLabel + OpBranch %113 + %113 = OpLabel + OpBranch %72 + %72 = OpLabel + %121 = OpLoad %int %i_1 + %122 = OpIAdd %int %121 %int_1 + OpStore %i_1 %122 + OpBranch %70 + %71 = OpLabel + OpBranch %68 + %68 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %124 = OpLoad %float %123 + %125 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %126 = OpLoad %float %125 + %127 = OpFOrdGreaterThan %bool %124 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %130 + %129 = OpLabel + OpBranch %128 + %130 = OpLabel + OpBranch %67 + %128 = OpLabel + OpBranch %66 + %67 = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %10 + %132 = OpLabel + %133 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 68[%68] is not post dominated by the back-edge block 128[%128] + %128 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..899baacdb5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/dead-barriers-in-loops/0-opt.wgsl.expected.wgsl @@ -0,0 +1,109 @@ +[[block]] +struct theSSBO { + out_data : i32; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_4 : theSSBO; + +[[group(0), binding(1)]] var x_6 : buf1; + +fn main_1() { + var i : i32; + var GLF_live3s : f32; + var i_1 : i32; + var z : i32; + x_4.out_data = 42; + let x_37 : f32 = x_6.injectionSwitch.x; + let x_39 : f32 = x_6.injectionSwitch.y; + if ((x_37 > x_39)) { + workgroupBarrier(); + } + let x_44 : f32 = x_6.injectionSwitch.x; + let x_46 : f32 = x_6.injectionSwitch.y; + if ((x_44 > x_46)) { + workgroupBarrier(); + } + let x_51 : f32 = x_6.injectionSwitch.y; + i = i32(x_51); + loop { + let x_57 : i32 = i; + if ((x_57 > 0)) { + } else { + break; + } + workgroupBarrier(); + + continuing { + let x_60 : i32 = i; + i = (x_60 - 1); + } + } + GLF_live3s = 0.0; + loop { + i_1 = 1; + loop { + let x_70 : i32 = i_1; + if ((x_70 < 2)) { + } else { + break; + } + let x_74 : f32 = x_6.injectionSwitch.x; + if ((x_74 > 1.0)) { + workgroupBarrier(); + } + let x_79 : f32 = x_6.injectionSwitch.x; + let x_81 : f32 = x_6.injectionSwitch.y; + if ((x_79 > x_81)) { + workgroupBarrier(); + } + let x_86 : f32 = x_6.injectionSwitch.y; + z = i32(x_86); + loop { + let x_92 : i32 = z; + if ((x_92 > 0)) { + } else { + break; + } + let x_95 : f32 = GLF_live3s; + GLF_live3s = (x_95 + 1.0); + + continuing { + let x_97 : i32 = z; + z = (x_97 - 1); + } + } + let x_99 : i32 = i_1; + if ((x_99 >= 1)) { + let x_104 : f32 = x_6.injectionSwitch.x; + if ((x_104 > 1.0)) { + workgroupBarrier(); + } + } + + continuing { + let x_108 : i32 = i_1; + i_1 = (x_108 + 1); + } + } + + continuing { + let x_111 : f32 = x_6.injectionSwitch.x; + let x_113 : f32 = x_6.injectionSwitch.y; + if ((x_111 > x_113)) { + } else { + break; + } + } + } + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm new file mode 100644 index 0000000000..7aefe46ca4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm @@ -0,0 +1,103 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %false = OpConstantFalse %bool + %main = OpFunction %void None %7 + %25 = OpLabel + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpPhi %bool %false %26 %31 %32 + OpLoopMerge %33 %32 None + OpBranch %34 + %34 = OpLabel + %35 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %36 = OpLoad %float %35 + %37 = OpFOrdGreaterThan %bool %36 %float_0 + OpLoopMerge %38 %39 None + OpBranchConditional %37 %40 %38 + %40 = OpLabel + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %46 = OpLoad %float %45 + %47 = OpFOrdGreaterThan %bool %46 %float_0 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + %50 = OpFunctionCall %void %51 + %52 = OpUndef %v4float + OpBranch %42 + %48 = OpLabel + %53 = OpCompositeConstruct %v4float %46 %46 %46 %46 + %54 = OpFAdd %v4float %20 %53 + OpBranch %42 + %43 = OpLabel + OpBranch %41 + %42 = OpLabel + %55 = OpPhi %v4float %52 %49 %54 %48 + OpStore %_GLF_color %55 + OpBranch %38 + %39 = OpLabel + OpBranch %34 + %38 = OpLabel + %31 = OpPhi %bool %30 %34 %true %42 + OpSelectionMerge %56 None + OpBranchConditional %31 %33 %32 + %56 = OpLabel + OpBranch %32 + %32 = OpLabel + OpBranch %29 + %33 = OpLabel + OpSelectionMerge %57 None + OpBranchConditional %31 %27 %57 + %57 = OpLabel + OpBranch %27 + %28 = OpLabel + OpBranch %26 + %27 = OpLabel + OpReturn + OpFunctionEnd + %51 = OpFunction %void None %7 + %58 = OpLabel + OpKill + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..43d7f1d537 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,77 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void x_51() { + discard; +} + +void main_1() { + while (true) { + bool x_31 = false; + bool x_30_phi = false; + x_30_phi = false; + while (true) { + bool x_31_phi = false; + const bool x_30 = x_30_phi; + while (true) { + float4 x_52 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_54 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_55_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_36 = asfloat(x_5[0].y); + x_31_phi = x_30; + if ((x_36 > 0.0f)) { + } else { + break; + } + while (true) { + const float x_46 = asfloat(x_5[0].x); + if ((x_46 > 0.0f)) { + x_51(); + x_52 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_55_phi = x_52; + break; + } + x_54 = (float4(1.0f, 0.0f, 0.0f, 1.0f) + float4(x_46, x_46, x_46, x_46)); + x_55_phi = x_54; + break; + } + x_GLF_color = x_55_phi; + x_31_phi = true; + break; + } + x_31 = x_31_phi; + if (x_31) { + break; + } else { + { + x_30_phi = x_31; + } + continue; + } + { + x_30_phi = x_31; + } + } + if (x_31) { + break; + } + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..41639ebaf1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,81 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void x_51() { + discard_fragment(); +} + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + while (true) { + bool x_31 = false; + bool x_30_phi = false; + x_30_phi = false; + while (true) { + bool x_31_phi = false; + bool const x_30 = x_30_phi; + while (true) { + float4 x_52 = 0.0f; + float4 x_54 = 0.0f; + float4 x_55_phi = 0.0f; + float const x_36 = x_5.injectionSwitch.y; + x_31_phi = x_30; + if ((x_36 > 0.0f)) { + } else { + break; + } + while (true) { + float const x_46 = x_5.injectionSwitch.x; + if ((x_46 > 0.0f)) { + x_51(); + x_52 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_55_phi = x_52; + break; + } + x_54 = (float4(1.0f, 0.0f, 0.0f, 1.0f) + float4(x_46, x_46, x_46, x_46)); + x_55_phi = x_54; + break; + } + float4 const x_55 = x_55_phi; + *(tint_symbol_4) = x_55; + x_31_phi = true; + break; + } + x_31 = x_31_phi; + if (x_31) { + break; + } else { + { + x_30_phi = x_31; + } + continue; + } + { + x_30_phi = x_31; + } + } + if (x_31) { + break; + } + break; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..6e670112b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,179 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 93 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %x_51 "x_51" + OpName %main_1 "main_1" + OpName %x_31 "x_31" + OpName %x_30_phi "x_30_phi" + OpName %x_31_phi "x_31_phi" + OpName %x_52 "x_52" + OpName %x_54 "x_54" + OpName %x_55_phi "x_55_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %25 = OpConstantNull %bool + %false = OpConstantFalse %bool +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %63 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %66 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %81 = OpTypeFunction %void %main_out + %x_51 = OpFunction %void None %12 + %15 = OpLabel + OpKill + OpFunctionEnd + %main_1 = OpFunction %void None %12 + %17 = OpLabel + %x_31 = OpVariable %_ptr_Function_bool Function %25 + %x_30_phi = OpVariable %_ptr_Function_bool Function %25 + %x_31_phi = OpVariable %_ptr_Function_bool Function %25 + %x_52 = OpVariable %_ptr_Function_v4float Function %9 + %x_54 = OpVariable %_ptr_Function_v4float Function %9 + %x_55_phi = OpVariable %_ptr_Function_v4float Function %9 + OpBranch %18 + %18 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + OpStore %x_30_phi %false + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %33 = OpLoad %bool %x_30_phi + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %47 = OpLoad %float %46 + OpStore %x_31_phi %33 + %49 = OpFOrdGreaterThan %bool %47 %float_0 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %35 + %50 = OpLabel + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %58 = OpLoad %float %57 + %59 = OpFOrdGreaterThan %bool %58 %float_0 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %60 + %61 = OpLabel + %62 = OpFunctionCall %void %x_51 + OpStore %x_52 %63 + %64 = OpLoad %v4float %x_52 + OpStore %x_55_phi %64 + OpBranch %54 + %60 = OpLabel + %67 = OpCompositeConstruct %v4float %58 %58 %58 %58 + %68 = OpFAdd %v4float %66 %67 + OpStore %x_54 %68 + %69 = OpLoad %v4float %x_54 + OpStore %x_55_phi %69 + OpBranch %54 + %55 = OpLabel + OpBranch %53 + %54 = OpLabel + %70 = OpLoad %v4float %x_55_phi + OpStore %x_GLF_color %70 + OpStore %x_31_phi %true + OpBranch %35 + %36 = OpLabel + OpBranch %34 + %35 = OpLabel + %72 = OpLoad %bool %x_31_phi + OpStore %x_31 %72 + %73 = OpLoad %bool %x_31 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %29 + %76 = OpLabel + OpBranch %30 + %74 = OpLabel + OpBranch %30 + %30 = OpLabel + %77 = OpLoad %bool %x_31 + OpStore %x_30_phi %77 + OpBranch %28 + %29 = OpLabel + %78 = OpLoad %bool %x_31 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + OpBranch %19 + %79 = OpLabel + OpBranch %19 + %20 = OpLabel + OpBranch %18 + %19 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %81 +%tint_symbol = OpFunctionParameter %main_out + %85 = OpLabel + %86 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %86 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %88 = OpLabel + %89 = OpFunctionCall %void %main_1 + %91 = OpLoad %v4float %x_GLF_color + %92 = OpCompositeConstruct %main_out %91 + %90 = OpFunctionCall %void %tint_symbol_2 %92 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..96cc10ebd4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,77 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn x_51() { + discard; +} + +fn main_1() { + loop { + var x_31 : bool; + var x_30_phi : bool; + x_30_phi = false; + loop { + var x_31_phi : bool; + let x_30 : bool = x_30_phi; + loop { + var x_52 : vec4; + var x_54 : vec4; + var x_55_phi : vec4; + let x_36 : f32 = x_5.injectionSwitch.y; + x_31_phi = x_30; + if ((x_36 > 0.0)) { + } else { + break; + } + loop { + let x_46 : f32 = x_5.injectionSwitch.x; + if ((x_46 > 0.0)) { + x_51(); + x_52 = vec4(0.0, 0.0, 0.0, 0.0); + x_55_phi = x_52; + break; + } + x_54 = (vec4(1.0, 0.0, 0.0, 1.0) + vec4(x_46, x_46, x_46, x_46)); + x_55_phi = x_54; + break; + } + let x_55 : vec4 = x_55_phi; + x_GLF_color = x_55; + x_31_phi = true; + break; + } + x_31 = x_31_phi; + if (x_31) { + break; + } else { + continue; + } + + continuing { + x_30_phi = x_31; + } + } + if (x_31) { + break; + } + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl new file mode 100644 index 0000000000..96cc10ebd4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl @@ -0,0 +1,77 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn x_51() { + discard; +} + +fn main_1() { + loop { + var x_31 : bool; + var x_30_phi : bool; + x_30_phi = false; + loop { + var x_31_phi : bool; + let x_30 : bool = x_30_phi; + loop { + var x_52 : vec4; + var x_54 : vec4; + var x_55_phi : vec4; + let x_36 : f32 = x_5.injectionSwitch.y; + x_31_phi = x_30; + if ((x_36 > 0.0)) { + } else { + break; + } + loop { + let x_46 : f32 = x_5.injectionSwitch.x; + if ((x_46 > 0.0)) { + x_51(); + x_52 = vec4(0.0, 0.0, 0.0, 0.0); + x_55_phi = x_52; + break; + } + x_54 = (vec4(1.0, 0.0, 0.0, 1.0) + vec4(x_46, x_46, x_46, x_46)); + x_55_phi = x_54; + break; + } + let x_55 : vec4 = x_55_phi; + x_GLF_color = x_55; + x_31_phi = true; + break; + } + x_31 = x_31_phi; + if (x_31) { + break; + } else { + continue; + } + + continuing { + x_30_phi = x_31; + } + } + if (x_31) { + break; + } + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..43d7f1d537 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,77 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void x_51() { + discard; +} + +void main_1() { + while (true) { + bool x_31 = false; + bool x_30_phi = false; + x_30_phi = false; + while (true) { + bool x_31_phi = false; + const bool x_30 = x_30_phi; + while (true) { + float4 x_52 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_54 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_55_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_36 = asfloat(x_5[0].y); + x_31_phi = x_30; + if ((x_36 > 0.0f)) { + } else { + break; + } + while (true) { + const float x_46 = asfloat(x_5[0].x); + if ((x_46 > 0.0f)) { + x_51(); + x_52 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_55_phi = x_52; + break; + } + x_54 = (float4(1.0f, 0.0f, 0.0f, 1.0f) + float4(x_46, x_46, x_46, x_46)); + x_55_phi = x_54; + break; + } + x_GLF_color = x_55_phi; + x_31_phi = true; + break; + } + x_31 = x_31_phi; + if (x_31) { + break; + } else { + { + x_30_phi = x_31; + } + continue; + } + { + x_30_phi = x_31; + } + } + if (x_31) { + break; + } + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..41639ebaf1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,81 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void x_51() { + discard_fragment(); +} + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + while (true) { + bool x_31 = false; + bool x_30_phi = false; + x_30_phi = false; + while (true) { + bool x_31_phi = false; + bool const x_30 = x_30_phi; + while (true) { + float4 x_52 = 0.0f; + float4 x_54 = 0.0f; + float4 x_55_phi = 0.0f; + float const x_36 = x_5.injectionSwitch.y; + x_31_phi = x_30; + if ((x_36 > 0.0f)) { + } else { + break; + } + while (true) { + float const x_46 = x_5.injectionSwitch.x; + if ((x_46 > 0.0f)) { + x_51(); + x_52 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_55_phi = x_52; + break; + } + x_54 = (float4(1.0f, 0.0f, 0.0f, 1.0f) + float4(x_46, x_46, x_46, x_46)); + x_55_phi = x_54; + break; + } + float4 const x_55 = x_55_phi; + *(tint_symbol_4) = x_55; + x_31_phi = true; + break; + } + x_31 = x_31_phi; + if (x_31) { + break; + } else { + { + x_30_phi = x_31; + } + continue; + } + { + x_30_phi = x_31; + } + } + if (x_31) { + break; + } + break; + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..6e670112b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,179 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 93 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %x_51 "x_51" + OpName %main_1 "main_1" + OpName %x_31 "x_31" + OpName %x_30_phi "x_30_phi" + OpName %x_31_phi "x_31_phi" + OpName %x_52 "x_52" + OpName %x_54 "x_54" + OpName %x_55_phi "x_55_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %25 = OpConstantNull %bool + %false = OpConstantFalse %bool +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %63 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %66 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %81 = OpTypeFunction %void %main_out + %x_51 = OpFunction %void None %12 + %15 = OpLabel + OpKill + OpFunctionEnd + %main_1 = OpFunction %void None %12 + %17 = OpLabel + %x_31 = OpVariable %_ptr_Function_bool Function %25 + %x_30_phi = OpVariable %_ptr_Function_bool Function %25 + %x_31_phi = OpVariable %_ptr_Function_bool Function %25 + %x_52 = OpVariable %_ptr_Function_v4float Function %9 + %x_54 = OpVariable %_ptr_Function_v4float Function %9 + %x_55_phi = OpVariable %_ptr_Function_v4float Function %9 + OpBranch %18 + %18 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + OpStore %x_30_phi %false + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %33 = OpLoad %bool %x_30_phi + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %47 = OpLoad %float %46 + OpStore %x_31_phi %33 + %49 = OpFOrdGreaterThan %bool %47 %float_0 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + OpBranch %50 + %52 = OpLabel + OpBranch %35 + %50 = OpLabel + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %58 = OpLoad %float %57 + %59 = OpFOrdGreaterThan %bool %58 %float_0 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %60 + %61 = OpLabel + %62 = OpFunctionCall %void %x_51 + OpStore %x_52 %63 + %64 = OpLoad %v4float %x_52 + OpStore %x_55_phi %64 + OpBranch %54 + %60 = OpLabel + %67 = OpCompositeConstruct %v4float %58 %58 %58 %58 + %68 = OpFAdd %v4float %66 %67 + OpStore %x_54 %68 + %69 = OpLoad %v4float %x_54 + OpStore %x_55_phi %69 + OpBranch %54 + %55 = OpLabel + OpBranch %53 + %54 = OpLabel + %70 = OpLoad %v4float %x_55_phi + OpStore %x_GLF_color %70 + OpStore %x_31_phi %true + OpBranch %35 + %36 = OpLabel + OpBranch %34 + %35 = OpLabel + %72 = OpLoad %bool %x_31_phi + OpStore %x_31 %72 + %73 = OpLoad %bool %x_31 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %29 + %76 = OpLabel + OpBranch %30 + %74 = OpLabel + OpBranch %30 + %30 = OpLabel + %77 = OpLoad %bool %x_31 + OpStore %x_30_phi %77 + OpBranch %28 + %29 = OpLabel + %78 = OpLoad %bool %x_31 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + OpBranch %19 + %79 = OpLabel + OpBranch %19 + %20 = OpLabel + OpBranch %18 + %19 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %81 +%tint_symbol = OpFunctionParameter %main_out + %85 = OpLabel + %86 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %86 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %88 = OpLabel + %89 = OpFunctionCall %void %main_1 + %91 = OpLoad %v4float %x_GLF_color + %92 = OpCompositeConstruct %main_out %91 + %90 = OpFunctionCall %void %tint_symbol_2 %92 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..96cc10ebd4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/disc-and-add-in-func-in-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,77 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn x_51() { + discard; +} + +fn main_1() { + loop { + var x_31 : bool; + var x_30_phi : bool; + x_30_phi = false; + loop { + var x_31_phi : bool; + let x_30 : bool = x_30_phi; + loop { + var x_52 : vec4; + var x_54 : vec4; + var x_55_phi : vec4; + let x_36 : f32 = x_5.injectionSwitch.y; + x_31_phi = x_30; + if ((x_36 > 0.0)) { + } else { + break; + } + loop { + let x_46 : f32 = x_5.injectionSwitch.x; + if ((x_46 > 0.0)) { + x_51(); + x_52 = vec4(0.0, 0.0, 0.0, 0.0); + x_55_phi = x_52; + break; + } + x_54 = (vec4(1.0, 0.0, 0.0, 1.0) + vec4(x_46, x_46, x_46, x_46)); + x_55_phi = x_54; + break; + } + let x_55 : vec4 = x_55_phi; + x_GLF_color = x_55; + x_31_phi = true; + break; + } + x_31 = x_31_phi; + if (x_31) { + break; + } else { + continue; + } + + continuing { + x_30_phi = x_31; + } + } + if (x_31) { + break; + } + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm new file mode 100644 index 0000000000..0891e97cc0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm @@ -0,0 +1,84 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %false = OpConstantFalse %bool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %26 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %true = OpConstantTrue %bool + %main = OpFunction %void None %8 + %28 = OpLabel + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %37 = OpLoad %float %36 + %38 = OpFOrdLessThan %bool %37 %float_0 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %39 + %40 = OpLabel + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %42 = OpLoad %float %41 + %43 = OpFOrdGreaterThan %bool %float_1 %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %34 + %45 = OpLabel + OpKill + %44 = OpLabel + OpBranch %34 + %34 = OpLabel + OpBranchConditional %false %32 %33 + %39 = OpLabel + OpBranch %33 + %33 = OpLabel + %46 = OpPhi %bool %true %39 %false %34 + OpSelectionMerge %47 None + OpBranchConditional %46 %30 %47 + %47 = OpLabel + OpBranch %30 + %31 = OpLabel + OpBranch %29 + %30 = OpLabel + OpStore %_GLF_color %26 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..4dda860d4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.hlsl @@ -0,0 +1,71 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + while (true) { + bool x_46_phi = false; + while (true) { + const float x_37 = gl_FragCoord.x; + if ((x_37 < 0.0f)) { + const float x_42 = asfloat(x_6[0].y); + if ((1.0f > x_42)) { + discard; + } else { + { + x_46_phi = false; + if (false) { + } else { + break; + } + } + continue; + } + { + x_46_phi = false; + if (false) { + } else { + break; + } + } + continue; + } + x_46_phi = true; + break; + { + x_46_phi = false; + if (false) { + } else { + break; + } + } + } + if (x_46_phi) { + break; + } + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..28d4e206da --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + while (true) { + bool x_46_phi = false; + while (true) { + float const x_37 = (*(tint_symbol_5)).x; + if ((x_37 < 0.0f)) { + float const x_42 = x_6.injectionSwitch.y; + if ((1.0f > x_42)) { + discard_fragment(); + } else { + { + x_46_phi = false; + if (false) { + } else { + break; + } + } + continue; + } + { + x_46_phi = false; + if (false) { + } else { + break; + } + } + continue; + } + x_46_phi = true; + break; + { + x_46_phi = false; + if (false) { + } else { + break; + } + } + } + bool const x_46 = x_46_phi; + if (x_46) { + break; + } + break; + } + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..67f484df66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.spvasm @@ -0,0 +1,141 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_46_phi "x_46_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %26 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %57 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_46_phi = OpVariable %_ptr_Function_bool Function %26 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %34 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %35 = OpLoad %float %34 + %37 = OpFOrdLessThan %bool %35 %float_0 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %38 + %39 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %43 = OpLoad %float %42 + %45 = OpFOrdGreaterThan %bool %float_1 %43 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpKill + %48 = OpLabel + OpBranch %29 + %46 = OpLabel + OpBranch %29 + %38 = OpLabel + OpStore %x_46_phi %true + OpBranch %28 + %29 = OpLabel + OpStore %x_46_phi %false + OpSelectionMerge %51 None + OpBranchConditional %false %52 %53 + %52 = OpLabel + OpBranch %51 + %53 = OpLabel + OpBranch %28 + %51 = OpLabel + OpBranch %27 + %28 = OpLabel + %54 = OpLoad %bool %x_46_phi + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + OpBranch %20 + %55 = OpLabel + OpBranch %20 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + OpStore %x_GLF_color %57 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %58 +%tint_symbol_1 = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %65 = OpLabel + %66 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %66 + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_3 %70 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 29[%29] is not post dominated by the back-edge block 51[%51] + %51 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..2da08c5c84 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.spvasm.expected.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + loop { + var x_46_phi : bool; + loop { + let x_37 : f32 = gl_FragCoord.x; + if ((x_37 < 0.0)) { + let x_42 : f32 = x_6.injectionSwitch.y; + if ((1.0 > x_42)) { + discard; + } else { + continue; + } + continue; + } + x_46_phi = true; + break; + + continuing { + x_46_phi = false; + if (false) { + } else { + break; + } + } + } + let x_46 : bool = x_46_phi; + if (x_46) { + break; + } + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl new file mode 100644 index 0000000000..2da08c5c84 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + loop { + var x_46_phi : bool; + loop { + let x_37 : f32 = gl_FragCoord.x; + if ((x_37 < 0.0)) { + let x_42 : f32 = x_6.injectionSwitch.y; + if ((1.0 > x_42)) { + discard; + } else { + continue; + } + continue; + } + x_46_phi = true; + break; + + continuing { + x_46_phi = false; + if (false) { + } else { + break; + } + } + } + let x_46 : bool = x_46_phi; + if (x_46) { + break; + } + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..4dda860d4b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.hlsl @@ -0,0 +1,71 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + while (true) { + bool x_46_phi = false; + while (true) { + const float x_37 = gl_FragCoord.x; + if ((x_37 < 0.0f)) { + const float x_42 = asfloat(x_6[0].y); + if ((1.0f > x_42)) { + discard; + } else { + { + x_46_phi = false; + if (false) { + } else { + break; + } + } + continue; + } + { + x_46_phi = false; + if (false) { + } else { + break; + } + } + continue; + } + x_46_phi = true; + break; + { + x_46_phi = false; + if (false) { + } else { + break; + } + } + } + if (x_46_phi) { + break; + } + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..28d4e206da --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + while (true) { + bool x_46_phi = false; + while (true) { + float const x_37 = (*(tint_symbol_5)).x; + if ((x_37 < 0.0f)) { + float const x_42 = x_6.injectionSwitch.y; + if ((1.0f > x_42)) { + discard_fragment(); + } else { + { + x_46_phi = false; + if (false) { + } else { + break; + } + } + continue; + } + { + x_46_phi = false; + if (false) { + } else { + break; + } + } + continue; + } + x_46_phi = true; + break; + { + x_46_phi = false; + if (false) { + } else { + break; + } + } + } + bool const x_46 = x_46_phi; + if (x_46) { + break; + } + break; + } + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..67f484df66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.spvasm @@ -0,0 +1,141 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_46_phi "x_46_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %26 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %57 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_46_phi = OpVariable %_ptr_Function_bool Function %26 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %34 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %35 = OpLoad %float %34 + %37 = OpFOrdLessThan %bool %35 %float_0 + OpSelectionMerge %38 None + OpBranchConditional %37 %39 %38 + %39 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %43 = OpLoad %float %42 + %45 = OpFOrdGreaterThan %bool %float_1 %43 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpKill + %48 = OpLabel + OpBranch %29 + %46 = OpLabel + OpBranch %29 + %38 = OpLabel + OpStore %x_46_phi %true + OpBranch %28 + %29 = OpLabel + OpStore %x_46_phi %false + OpSelectionMerge %51 None + OpBranchConditional %false %52 %53 + %52 = OpLabel + OpBranch %51 + %53 = OpLabel + OpBranch %28 + %51 = OpLabel + OpBranch %27 + %28 = OpLabel + %54 = OpLoad %bool %x_46_phi + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + OpBranch %20 + %55 = OpLabel + OpBranch %20 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + OpStore %x_GLF_color %57 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %58 +%tint_symbol_1 = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %65 = OpLabel + %66 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %66 + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_3 %70 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 29[%29] is not post dominated by the back-edge block 51[%51] + %51 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..2da08c5c84 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-continue-return/0-opt.wgsl.expected.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + loop { + var x_46_phi : bool; + loop { + let x_37 : f32 = gl_FragCoord.x; + if ((x_37 < 0.0)) { + let x_42 : f32 = x_6.injectionSwitch.y; + if ((1.0 > x_42)) { + discard; + } else { + continue; + } + continue; + } + x_46_phi = true; + break; + + continuing { + x_46_phi = false; + if (false) { + } else { + break; + } + } + } + let x_46 : bool = x_46_phi; + if (x_46) { + break; + } + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm new file mode 100644 index 0000000000..cb630a6619 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm @@ -0,0 +1,92 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %data "data" + OpName %i "i" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %i RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_200000003 = OpConstant %float 0.200000003 +%float_0_300000012 = OpConstant %float 0.300000012 +%float_0_400000006 = OpConstant %float 0.400000006 + %float_0_5 = OpConstant %float 0.5 +%float_0_600000024 = OpConstant %float 0.600000024 +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_800000012 = OpConstant %float 0.800000012 +%float_0_899999976 = OpConstant %float 0.899999976 + %float_1 = OpConstant %float 1 + %28 = OpConstantComposite %_arr_float_uint_10 %float_0_100000001 %float_0_200000003 %float_0_300000012 %float_0_400000006 %float_0_5 %float_0_600000024 %float_0_699999988 %float_0_800000012 %float_0_899999976 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %12 + %42 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function + %i = OpVariable %_ptr_Function_int Function + OpStore %data %28 + OpStore %i %int_0 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %7 = OpLoad %int %i + %47 = OpSLessThan %bool %7 %int_10 + OpBranchConditional %47 %48 %44 + %48 = OpLabel + %49 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %50 = OpLoad %float %49 + %51 = OpFOrdLessThan %bool %50 %float_0 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + OpKill + %52 = OpLabel + %8 = OpLoad %int %i + %54 = OpAccessChain %_ptr_Function_float %data %8 + %55 = OpLoad %float %54 + %56 = OpAccessChain %_ptr_Function_float %data %int_0 + OpStore %56 %55 + OpBranch %45 + %45 = OpLabel + %9 = OpLoad %int %i + %10 = OpIAdd %int %9 %int_1 + OpStore %i %10 + OpBranch %43 + %44 = OpLabel + %57 = OpAccessChain %_ptr_Function_float %data %int_0 + %58 = OpLoad %float %57 + %59 = OpCompositeConstruct %v4float %58 %float_0 %float_0 %float_1 + OpStore %_GLF_color %59 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..669e1a238d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,42 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float data[10] = (float[10])0; + int i = 0; + const float tint_symbol_4[10] = {0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f, 0.5f, 0.600000024f, 0.699999988f, 0.800000012f, 0.899999976f, 1.0f}; + data = tint_symbol_4; + i = 0; + { + for(; (i < 10); i = (i + 1)) { + const float x_50 = gl_FragCoord.x; + if ((x_50 < 0.0f)) { + discard; + } + const float x_55 = data[i]; + data[0] = x_55; + } + } + const float x_58 = data[0]; + x_GLF_color = float4(x_58, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..08b8b280a1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,52 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + float arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper data = {}; + int i = 0; + tint_array_wrapper const tint_symbol_4 = {.arr={0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f, 0.5f, 0.600000024f, 0.699999988f, 0.800000012f, 0.899999976f, 1.0f}}; + data = tint_symbol_4; + i = 0; + while (true) { + int const x_7 = i; + if ((x_7 < 10)) { + } else { + break; + } + float const x_50 = (*(tint_symbol_6)).x; + if ((x_50 < 0.0f)) { + discard_fragment(); + } + int const x_8 = i; + float const x_55 = data.arr[x_8]; + data.arr[0] = x_55; + { + int const x_9 = i; + i = (x_9 + 1); + } + } + float const x_58 = data.arr[0]; + *(tint_symbol_7) = float4(x_58, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..ca3016a54e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 80 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %data "data" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %20 = OpConstantNull %_arr_float_uint_10 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_200000003 = OpConstant %float 0.200000003 +%float_0_300000012 = OpConstant %float 0.300000012 +%float_0_400000006 = OpConstant %float 0.400000006 + %float_0_5 = OpConstant %float 0.5 +%float_0_600000024 = OpConstant %float 0.600000024 +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_800000012 = OpConstant %float 0.800000012 +%float_0_899999976 = OpConstant %float 0.899999976 + %float_1 = OpConstant %float 1 + %35 = OpConstantComposite %_arr_float_uint_10 %float_0_100000001 %float_0_200000003 %float_0_300000012 %float_0_400000006 %float_0_5 %float_0_600000024 %float_0_699999988 %float_0_800000012 %float_0_899999976 %float_1 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function %20 + %i = OpVariable %_ptr_Function_int Function %24 + OpStore %data %35 + OpStore %i %int_0 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %int %i + %43 = OpSLessThan %bool %41 %int_10 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %38 + %45 = OpLabel + %50 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %51 = OpLoad %float %50 + %53 = OpFOrdLessThan %bool %51 %float_0 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + OpKill + %54 = OpLabel + %56 = OpLoad %int %i + %58 = OpAccessChain %_ptr_Function_float %data %56 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Function_float %data %int_0 + OpStore %60 %59 + OpBranch %39 + %39 = OpLabel + %61 = OpLoad %int %i + %63 = OpIAdd %int %61 %int_1 + OpStore %i %63 + OpBranch %37 + %38 = OpLabel + %64 = OpAccessChain %_ptr_Function_float %data %int_0 + %65 = OpLoad %float %64 + %66 = OpCompositeConstruct %v4float %65 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %66 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %67 +%tint_symbol_1 = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %74 = OpLabel + %75 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %75 + %76 = OpFunctionCall %void %main_1 + %78 = OpLoad %v4float %x_GLF_color + %79 = OpCompositeConstruct %main_out %78 + %77 = OpFunctionCall %void %tint_symbol_3 %79 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..6981641f24 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,44 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var i : i32; + data = array(0.100000001, 0.200000003, 0.300000012, 0.400000006, 0.5, 0.600000024, 0.699999988, 0.800000012, 0.899999976, 1.0); + i = 0; + loop { + let x_7 : i32 = i; + if ((x_7 < 10)) { + } else { + break; + } + let x_50 : f32 = gl_FragCoord.x; + if ((x_50 < 0.0)) { + discard; + } + let x_8 : i32 = i; + let x_55 : f32 = data[x_8]; + data[0] = x_55; + + continuing { + let x_9 : i32 = i; + i = (x_9 + 1); + } + } + let x_58 : f32 = data[0]; + x_GLF_color = vec4(x_58, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl new file mode 100644 index 0000000000..6981641f24 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl @@ -0,0 +1,44 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var i : i32; + data = array(0.100000001, 0.200000003, 0.300000012, 0.400000006, 0.5, 0.600000024, 0.699999988, 0.800000012, 0.899999976, 1.0); + i = 0; + loop { + let x_7 : i32 = i; + if ((x_7 < 10)) { + } else { + break; + } + let x_50 : f32 = gl_FragCoord.x; + if ((x_50 < 0.0)) { + discard; + } + let x_8 : i32 = i; + let x_55 : f32 = data[x_8]; + data[0] = x_55; + + continuing { + let x_9 : i32 = i; + i = (x_9 + 1); + } + } + let x_58 : f32 = data[0]; + x_GLF_color = vec4(x_58, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..669e1a238d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,42 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float data[10] = (float[10])0; + int i = 0; + const float tint_symbol_4[10] = {0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f, 0.5f, 0.600000024f, 0.699999988f, 0.800000012f, 0.899999976f, 1.0f}; + data = tint_symbol_4; + i = 0; + { + for(; (i < 10); i = (i + 1)) { + const float x_50 = gl_FragCoord.x; + if ((x_50 < 0.0f)) { + discard; + } + const float x_55 = data[i]; + data[0] = x_55; + } + } + const float x_58 = data[0]; + x_GLF_color = float4(x_58, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..08b8b280a1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,52 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + float arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper data = {}; + int i = 0; + tint_array_wrapper const tint_symbol_4 = {.arr={0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f, 0.5f, 0.600000024f, 0.699999988f, 0.800000012f, 0.899999976f, 1.0f}}; + data = tint_symbol_4; + i = 0; + while (true) { + int const x_7 = i; + if ((x_7 < 10)) { + } else { + break; + } + float const x_50 = (*(tint_symbol_6)).x; + if ((x_50 < 0.0f)) { + discard_fragment(); + } + int const x_8 = i; + float const x_55 = data.arr[x_8]; + data.arr[0] = x_55; + { + int const x_9 = i; + i = (x_9 + 1); + } + } + float const x_58 = data.arr[0]; + *(tint_symbol_7) = float4(x_58, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..ca3016a54e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,129 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 80 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %data "data" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %20 = OpConstantNull %_arr_float_uint_10 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_200000003 = OpConstant %float 0.200000003 +%float_0_300000012 = OpConstant %float 0.300000012 +%float_0_400000006 = OpConstant %float 0.400000006 + %float_0_5 = OpConstant %float 0.5 +%float_0_600000024 = OpConstant %float 0.600000024 +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_800000012 = OpConstant %float 0.800000012 +%float_0_899999976 = OpConstant %float 0.899999976 + %float_1 = OpConstant %float 1 + %35 = OpConstantComposite %_arr_float_uint_10 %float_0_100000001 %float_0_200000003 %float_0_300000012 %float_0_400000006 %float_0_5 %float_0_600000024 %float_0_699999988 %float_0_800000012 %float_0_899999976 %float_1 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function %20 + %i = OpVariable %_ptr_Function_int Function %24 + OpStore %data %35 + OpStore %i %int_0 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %int %i + %43 = OpSLessThan %bool %41 %int_10 + OpSelectionMerge %45 None + OpBranchConditional %43 %46 %47 + %46 = OpLabel + OpBranch %45 + %47 = OpLabel + OpBranch %38 + %45 = OpLabel + %50 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %51 = OpLoad %float %50 + %53 = OpFOrdLessThan %bool %51 %float_0 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + OpKill + %54 = OpLabel + %56 = OpLoad %int %i + %58 = OpAccessChain %_ptr_Function_float %data %56 + %59 = OpLoad %float %58 + %60 = OpAccessChain %_ptr_Function_float %data %int_0 + OpStore %60 %59 + OpBranch %39 + %39 = OpLabel + %61 = OpLoad %int %i + %63 = OpIAdd %int %61 %int_1 + OpStore %i %63 + OpBranch %37 + %38 = OpLabel + %64 = OpAccessChain %_ptr_Function_float %data %int_0 + %65 = OpLoad %float %64 + %66 = OpCompositeConstruct %v4float %65 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %66 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %67 +%tint_symbol_1 = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %74 = OpLabel + %75 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %75 + %76 = OpFunctionCall %void %main_1 + %78 = OpLoad %v4float %x_GLF_color + %79 = OpCompositeConstruct %main_out %78 + %77 = OpFunctionCall %void %tint_symbol_3 %79 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..6981641f24 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-array-manipulating-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,44 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var i : i32; + data = array(0.100000001, 0.200000003, 0.300000012, 0.400000006, 0.5, 0.600000024, 0.699999988, 0.800000012, 0.899999976, 1.0); + i = 0; + loop { + let x_7 : i32 = i; + if ((x_7 < 10)) { + } else { + break; + } + let x_50 : f32 = gl_FragCoord.x; + if ((x_50 < 0.0)) { + discard; + } + let x_8 : i32 = i; + let x_55 : f32 = data[x_8]; + data[0] = x_55; + + continuing { + let x_9 : i32 = i; + i = (x_9 + 1); + } + } + let x_58 : f32 = data[0]; + x_GLF_color = vec4(x_58, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm new file mode 100644 index 0000000000..3159420711 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm @@ -0,0 +1,77 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f_ "f(" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %26 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %9 + %27 = OpLabel + %28 = OpFunctionCall %void %f_ + OpStore %_GLF_color %26 + OpReturn + OpFunctionEnd + %f_ = OpFunction %void None %9 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %35 = OpLoad %float %34 + %36 = OpFOrdGreaterThan %bool %float_1 %35 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %40 = OpLoad %float %39 + %41 = OpFOrdLessThan %bool %40 %float_0 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %32 + %43 = OpLabel + OpBranch %32 + %42 = OpLabel + OpBranch %32 + %32 = OpLabel + OpBranchConditional %false %30 %31 + %37 = OpLabel + OpKill + %31 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..bc52353dc7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.hlsl @@ -0,0 +1,71 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void f_() { + while (true) { + const float x_35 = asfloat(x_7[0].y); + if ((1.0f > x_35)) { + const float x_40 = gl_FragCoord.y; + if ((x_40 < 0.0f)) { + { + if (false) { + } else { + break; + } + } + continue; + } else { + { + if (false) { + } else { + break; + } + } + continue; + } + { + if (false) { + } else { + break; + } + } + continue; + } + discard; + { + if (false) { + } else { + break; + } + } + } + return; +} + +void main_1() { + f_(); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d61e94e8aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.msl @@ -0,0 +1,70 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void f_(constant buf0& x_7, thread float4* const tint_symbol_5) { + while (true) { + float const x_35 = x_7.injectionSwitch.y; + if ((1.0f > x_35)) { + float const x_40 = (*(tint_symbol_5)).y; + if ((x_40 < 0.0f)) { + { + if (false) { + } else { + break; + } + } + continue; + } else { + { + if (false) { + } else { + break; + } + } + continue; + } + { + if (false) { + } else { + break; + } + } + continue; + } + discard_fragment(); + { + if (false) { + } else { + break; + } + } + } + return; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + f_(x_7, tint_symbol_6); + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..79cac682df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.spvasm @@ -0,0 +1,125 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %f_ "f_" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %49 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out + %f_ = OpFunction %void None %15 + %18 = OpLabel + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %28 = OpLoad %float %27 + %30 = OpFOrdGreaterThan %bool %float_1 %28 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %32 + %33 = OpLabel + %35 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %36 = OpLoad %float %35 + %38 = OpFOrdLessThan %bool %36 %float_0 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpBranch %21 + %41 = OpLabel + OpBranch %21 + %39 = OpLabel + OpBranch %21 + %32 = OpLabel + OpKill + %21 = OpLabel + OpSelectionMerge %43 None + OpBranchConditional %false %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %20 + %43 = OpLabel + OpBranch %19 + %20 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %f_ + OpStore %x_GLF_color %49 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %50 +%tint_symbol_1 = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %58 + %59 = OpFunctionCall %void %main_1 + %61 = OpLoad %v4float %x_GLF_color + %62 = OpCompositeConstruct %main_out %61 + %60 = OpFunctionCall %void %tint_symbol_3 %62 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 21[%21] is not post dominated by the back-edge block 43[%43] + %43 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..bf03fdc754 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.spvasm.expected.wgsl @@ -0,0 +1,52 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn f_() { + loop { + let x_35 : f32 = x_7.injectionSwitch.y; + if ((1.0 > x_35)) { + let x_40 : f32 = gl_FragCoord.y; + if ((x_40 < 0.0)) { + continue; + } else { + continue; + } + continue; + } + discard; + + continuing { + if (false) { + } else { + break; + } + } + } + return; +} + +fn main_1() { + f_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl new file mode 100644 index 0000000000..bf03fdc754 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl @@ -0,0 +1,52 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn f_() { + loop { + let x_35 : f32 = x_7.injectionSwitch.y; + if ((1.0 > x_35)) { + let x_40 : f32 = gl_FragCoord.y; + if ((x_40 < 0.0)) { + continue; + } else { + continue; + } + continue; + } + discard; + + continuing { + if (false) { + } else { + break; + } + } + } + return; +} + +fn main_1() { + f_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..bc52353dc7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.hlsl @@ -0,0 +1,71 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void f_() { + while (true) { + const float x_35 = asfloat(x_7[0].y); + if ((1.0f > x_35)) { + const float x_40 = gl_FragCoord.y; + if ((x_40 < 0.0f)) { + { + if (false) { + } else { + break; + } + } + continue; + } else { + { + if (false) { + } else { + break; + } + } + continue; + } + { + if (false) { + } else { + break; + } + } + continue; + } + discard; + { + if (false) { + } else { + break; + } + } + } + return; +} + +void main_1() { + f_(); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d61e94e8aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.msl @@ -0,0 +1,70 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void f_(constant buf0& x_7, thread float4* const tint_symbol_5) { + while (true) { + float const x_35 = x_7.injectionSwitch.y; + if ((1.0f > x_35)) { + float const x_40 = (*(tint_symbol_5)).y; + if ((x_40 < 0.0f)) { + { + if (false) { + } else { + break; + } + } + continue; + } else { + { + if (false) { + } else { + break; + } + } + continue; + } + { + if (false) { + } else { + break; + } + } + continue; + } + discard_fragment(); + { + if (false) { + } else { + break; + } + } + } + return; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + f_(x_7, tint_symbol_6); + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..79cac682df --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.spvasm @@ -0,0 +1,125 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %f_ "f_" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %49 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out + %f_ = OpFunction %void None %15 + %18 = OpLabel + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %28 = OpLoad %float %27 + %30 = OpFOrdGreaterThan %bool %float_1 %28 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %32 + %33 = OpLabel + %35 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %36 = OpLoad %float %35 + %38 = OpFOrdLessThan %bool %36 %float_0 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpBranch %21 + %41 = OpLabel + OpBranch %21 + %39 = OpLabel + OpBranch %21 + %32 = OpLabel + OpKill + %21 = OpLabel + OpSelectionMerge %43 None + OpBranchConditional %false %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %20 + %43 = OpLabel + OpBranch %19 + %20 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %15 + %47 = OpLabel + %48 = OpFunctionCall %void %f_ + OpStore %x_GLF_color %49 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %50 +%tint_symbol_1 = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %57 = OpLabel + %58 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %58 + %59 = OpFunctionCall %void %main_1 + %61 = OpLoad %v4float %x_GLF_color + %62 = OpCompositeConstruct %main_out %61 + %60 = OpFunctionCall %void %tint_symbol_3 %62 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 21[%21] is not post dominated by the back-edge block 43[%43] + %43 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..bf03fdc754 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop-in-function/0-opt.wgsl.expected.wgsl @@ -0,0 +1,52 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn f_() { + loop { + let x_35 : f32 = x_7.injectionSwitch.y; + if ((1.0 > x_35)) { + let x_40 : f32 = gl_FragCoord.y; + if ((x_40 < 0.0)) { + continue; + } else { + continue; + } + continue; + } + discard; + + continuing { + if (false) { + } else { + break; + } + } + } + return; +} + +fn main_1() { + f_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm new file mode 100644 index 0000000000..3c039593f9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm @@ -0,0 +1,82 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %main = OpFunction %void None %6 + %25 = OpLabel + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpPhi %int %int_0 %26 %31 %32 + %33 = OpSLessThan %bool %30 %int_10 + OpLoopMerge %34 %32 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + %36 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %37 = OpLoad %float %36 + %38 = OpFOrdLessThan %bool %37 %float_0 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %39 + %40 = OpLabel + %41 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %42 = OpLoad %float %41 + %43 = OpFOrdLessThan %bool %42 %float_0 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %32 + %45 = OpLabel + OpBranch %34 + %44 = OpLabel + OpBranch %32 + %32 = OpLabel + %31 = OpIAdd %int %30 %int_1 + OpBranch %29 + %39 = OpLabel + %46 = OpFunctionCall %void %47 + OpBranch %34 + %34 = OpLabel + %48 = OpPhi %bool %false %29 %false %45 %true %39 + OpSelectionMerge %49 None + OpBranchConditional %48 %27 %49 + %49 = OpLabel + OpStore %_GLF_color %22 + OpBranch %27 + %28 = OpLabel + OpBranch %26 + %27 = OpLabel + OpReturn + OpFunctionEnd + %47 = OpFunction %void None %6 + %50 = OpLabel + OpKill + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..a01424a8dd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,74 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void x_47() { + discard; +} + +void main_1() { + while (true) { + int x_30_phi = 0; + bool x_48_phi = false; + x_30_phi = 0; + while (true) { + int x_31 = 0; + const int x_30 = x_30_phi; + x_48_phi = false; + if ((x_30 < 10)) { + } else { + break; + } + const float x_37 = gl_FragCoord.y; + if ((x_37 < 0.0f)) { + const float x_42 = gl_FragCoord.x; + if ((x_42 < 0.0f)) { + x_48_phi = false; + break; + } else { + { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + continue; + } + { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + continue; + } + x_47(); + x_48_phi = true; + break; + { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + } + if (x_48_phi) { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..9e3108ac86 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void x_47() { + discard_fragment(); +} + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + while (true) { + int x_30_phi = 0; + bool x_48_phi = false; + x_30_phi = 0; + while (true) { + int x_31 = 0; + int const x_30 = x_30_phi; + x_48_phi = false; + if ((x_30 < 10)) { + } else { + break; + } + float const x_37 = (*(tint_symbol_5)).y; + if ((x_37 < 0.0f)) { + float const x_42 = (*(tint_symbol_5)).x; + if ((x_42 < 0.0f)) { + x_48_phi = false; + break; + } else { + { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + continue; + } + { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + continue; + } + x_47(); + x_48_phi = true; + break; + { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + } + bool const x_48 = x_48_phi; + if (x_48) { + break; + } + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..fb9fd81553 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 81 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %x_47 "x_47" + OpName %main_1 "main_1" + OpName %x_30_phi "x_30_phi" + OpName %x_48_phi "x_48_phi" + OpName %x_31 "x_31" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %28 = OpConstantNull %bool + %int_0 = OpConstant %int 0 + %false = OpConstantFalse %bool + %int_10 = OpConstant %int 10 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %uint_0 = OpConstant %uint 0 + %true = OpConstantTrue %bool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %67 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %68 = OpTypeFunction %void %main_out + %x_47 = OpFunction %void None %11 + %14 = OpLabel + OpKill + OpFunctionEnd + %main_1 = OpFunction %void None %11 + %16 = OpLabel + %x_30_phi = OpVariable %_ptr_Function_int Function %24 + %x_48_phi = OpVariable %_ptr_Function_bool Function %28 + %x_31 = OpVariable %_ptr_Function_int Function %24 + OpBranch %17 + %17 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + OpStore %x_30_phi %int_0 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %35 = OpLoad %int %x_30_phi + OpStore %x_48_phi %false + %38 = OpSLessThan %bool %35 %int_10 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %31 + %39 = OpLabel + %45 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %46 = OpLoad %float %45 + %48 = OpFOrdLessThan %bool %46 %float_0 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + %52 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %53 = OpLoad %float %52 + %54 = OpFOrdLessThan %bool %53 %float_0 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpStore %x_48_phi %false + OpBranch %31 + %57 = OpLabel + OpBranch %32 + %55 = OpLabel + OpBranch %32 + %49 = OpLabel + %58 = OpFunctionCall %void %x_47 + OpStore %x_48_phi %true + OpBranch %31 + %32 = OpLabel + %61 = OpIAdd %int %35 %int_1 + OpStore %x_31 %61 + %62 = OpLoad %int %x_31 + OpStore %x_30_phi %62 + OpBranch %30 + %31 = OpLabel + %63 = OpLoad %bool %x_48_phi + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + OpBranch %18 + %64 = OpLabel + OpStore %x_GLF_color %67 + OpBranch %18 + %19 = OpLabel + OpBranch %17 + %18 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %68 +%tint_symbol_1 = OpFunctionParameter %main_out + %72 = OpLabel + %73 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %73 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %75 = OpLabel + %76 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %76 + %77 = OpFunctionCall %void %main_1 + %79 = OpLoad %v4float %x_GLF_color + %80 = OpCompositeConstruct %main_out %79 + %78 = OpFunctionCall %void %tint_symbol_3 %80 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..83948cea44 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,62 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn x_47() { + discard; +} + +fn main_1() { + loop { + var x_30_phi : i32; + var x_48_phi : bool; + x_30_phi = 0; + loop { + var x_31 : i32; + let x_30 : i32 = x_30_phi; + x_48_phi = false; + if ((x_30 < 10)) { + } else { + break; + } + let x_37 : f32 = gl_FragCoord.y; + if ((x_37 < 0.0)) { + let x_42 : f32 = gl_FragCoord.x; + if ((x_42 < 0.0)) { + x_48_phi = false; + break; + } else { + continue; + } + continue; + } + x_47(); + x_48_phi = true; + break; + + continuing { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + } + let x_48 : bool = x_48_phi; + if (x_48) { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl new file mode 100644 index 0000000000..83948cea44 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl @@ -0,0 +1,62 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn x_47() { + discard; +} + +fn main_1() { + loop { + var x_30_phi : i32; + var x_48_phi : bool; + x_30_phi = 0; + loop { + var x_31 : i32; + let x_30 : i32 = x_30_phi; + x_48_phi = false; + if ((x_30 < 10)) { + } else { + break; + } + let x_37 : f32 = gl_FragCoord.y; + if ((x_37 < 0.0)) { + let x_42 : f32 = gl_FragCoord.x; + if ((x_42 < 0.0)) { + x_48_phi = false; + break; + } else { + continue; + } + continue; + } + x_47(); + x_48_phi = true; + break; + + continuing { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + } + let x_48 : bool = x_48_phi; + if (x_48) { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..a01424a8dd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,74 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void x_47() { + discard; +} + +void main_1() { + while (true) { + int x_30_phi = 0; + bool x_48_phi = false; + x_30_phi = 0; + while (true) { + int x_31 = 0; + const int x_30 = x_30_phi; + x_48_phi = false; + if ((x_30 < 10)) { + } else { + break; + } + const float x_37 = gl_FragCoord.y; + if ((x_37 < 0.0f)) { + const float x_42 = gl_FragCoord.x; + if ((x_42 < 0.0f)) { + x_48_phi = false; + break; + } else { + { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + continue; + } + { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + continue; + } + x_47(); + x_48_phi = true; + break; + { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + } + if (x_48_phi) { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..9e3108ac86 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,74 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void x_47() { + discard_fragment(); +} + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + while (true) { + int x_30_phi = 0; + bool x_48_phi = false; + x_30_phi = 0; + while (true) { + int x_31 = 0; + int const x_30 = x_30_phi; + x_48_phi = false; + if ((x_30 < 10)) { + } else { + break; + } + float const x_37 = (*(tint_symbol_5)).y; + if ((x_37 < 0.0f)) { + float const x_42 = (*(tint_symbol_5)).x; + if ((x_42 < 0.0f)) { + x_48_phi = false; + break; + } else { + { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + continue; + } + { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + continue; + } + x_47(); + x_48_phi = true; + break; + { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + } + bool const x_48 = x_48_phi; + if (x_48) { + break; + } + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..fb9fd81553 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 81 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %x_47 "x_47" + OpName %main_1 "main_1" + OpName %x_30_phi "x_30_phi" + OpName %x_48_phi "x_48_phi" + OpName %x_31 "x_31" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %28 = OpConstantNull %bool + %int_0 = OpConstant %int 0 + %false = OpConstantFalse %bool + %int_10 = OpConstant %int 10 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %uint_0 = OpConstant %uint 0 + %true = OpConstantTrue %bool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %67 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %68 = OpTypeFunction %void %main_out + %x_47 = OpFunction %void None %11 + %14 = OpLabel + OpKill + OpFunctionEnd + %main_1 = OpFunction %void None %11 + %16 = OpLabel + %x_30_phi = OpVariable %_ptr_Function_int Function %24 + %x_48_phi = OpVariable %_ptr_Function_bool Function %28 + %x_31 = OpVariable %_ptr_Function_int Function %24 + OpBranch %17 + %17 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + OpStore %x_30_phi %int_0 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %35 = OpLoad %int %x_30_phi + OpStore %x_48_phi %false + %38 = OpSLessThan %bool %35 %int_10 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %31 + %39 = OpLabel + %45 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %46 = OpLoad %float %45 + %48 = OpFOrdLessThan %bool %46 %float_0 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + %52 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %53 = OpLoad %float %52 + %54 = OpFOrdLessThan %bool %53 %float_0 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpStore %x_48_phi %false + OpBranch %31 + %57 = OpLabel + OpBranch %32 + %55 = OpLabel + OpBranch %32 + %49 = OpLabel + %58 = OpFunctionCall %void %x_47 + OpStore %x_48_phi %true + OpBranch %31 + %32 = OpLabel + %61 = OpIAdd %int %35 %int_1 + OpStore %x_31 %61 + %62 = OpLoad %int %x_31 + OpStore %x_30_phi %62 + OpBranch %30 + %31 = OpLabel + %63 = OpLoad %bool %x_48_phi + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + OpBranch %18 + %64 = OpLabel + OpStore %x_GLF_color %67 + OpBranch %18 + %19 = OpLabel + OpBranch %17 + %18 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %68 +%tint_symbol_1 = OpFunctionParameter %main_out + %72 = OpLabel + %73 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %73 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %75 = OpLabel + %76 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %76 + %77 = OpFunctionCall %void %main_1 + %79 = OpLoad %v4float %x_GLF_color + %80 = OpCompositeConstruct %main_out %79 + %78 = OpFunctionCall %void %tint_symbol_3 %80 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..83948cea44 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discard-in-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,62 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn x_47() { + discard; +} + +fn main_1() { + loop { + var x_30_phi : i32; + var x_48_phi : bool; + x_30_phi = 0; + loop { + var x_31 : i32; + let x_30 : i32 = x_30_phi; + x_48_phi = false; + if ((x_30 < 10)) { + } else { + break; + } + let x_37 : f32 = gl_FragCoord.y; + if ((x_37 < 0.0)) { + let x_42 : f32 = gl_FragCoord.x; + if ((x_42 < 0.0)) { + x_48_phi = false; + break; + } else { + continue; + } + continue; + } + x_47(); + x_48_phi = true; + break; + + continuing { + x_31 = (x_30 + 1); + x_30_phi = x_31; + } + } + let x_48 : bool = x_48_phi; + if (x_48) { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm new file mode 100644 index 0000000000..6911deebc0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm @@ -0,0 +1,91 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %ll "ll" + OpDecorate %_GLF_color Location 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %ll RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %16 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %int = OpTypeInt 32 1 + %int_2000 = OpConstant %int 2000 + %bool = OpTypeBool +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_5 = OpConstant %int 5 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %10 + %28 = OpLabel + %ll = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %16 + %29 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %30 = OpLoad %float %29 + %31 = OpConvertFToS %int %30 + %32 = OpSLessThan %bool %31 %int_2000 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + OpBranch %33 + %35 = OpLabel + OpStore %ll %int_0 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %41 = OpLoad %float %40 + %42 = OpFOrdLessThan %bool %41 %float_0 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpKill + %43 = OpLabel + %6 = OpLoad %int %ll + %45 = OpSGreaterThanEqual %bool %6 %int_5 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + OpBranch %37 + %46 = OpLabel + OpBranch %38 + %38 = OpLabel + %7 = OpLoad %int %ll + %8 = OpIAdd %int %7 %int_1 + OpStore %ll %8 + OpBranch %36 + %37 = OpLabel + %48 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %49 = OpLoad %float %48 + %50 = OpConvertFToS %int %49 + %51 = OpSGreaterThanEqual %bool %50 %int_2000 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + OpKill + %52 = OpLabel + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..7a88372cf3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.hlsl @@ -0,0 +1,48 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int ll = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_30 = gl_FragCoord.x; + if ((int(x_30) < 2000)) { + } else { + ll = 0; + while (true) { + const float x_41 = gl_FragCoord.x; + if ((x_41 < 0.0f)) { + discard; + } + if ((ll >= 5)) { + break; + } + { + ll = (ll + 1); + } + } + const float x_49 = gl_FragCoord.x; + if ((int(x_49) >= 2000)) { + discard; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f11683a884 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int ll = 0; + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + float const x_30 = (*(tint_symbol_6)).x; + if ((int(x_30) < 2000)) { + } else { + ll = 0; + while (true) { + float const x_41 = (*(tint_symbol_6)).x; + if ((x_41 < 0.0f)) { + discard_fragment(); + } + int const x_6 = ll; + if ((x_6 >= 5)) { + break; + } + { + int const x_7 = ll; + ll = (x_7 + 1); + } + } + float const x_49 = (*(tint_symbol_6)).x; + if ((int(x_49) >= 2000)) { + discard_fragment(); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..1a87cf4a5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.spvasm @@ -0,0 +1,122 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %ll "ll" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_2000 = OpConstant %int 2000 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_5 = OpConstant %int 5 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %ll = OpVariable %_ptr_Function_int Function %18 + OpStore %x_GLF_color %21 + %25 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %26 = OpLoad %float %25 + %27 = OpConvertFToS %int %26 + %29 = OpSLessThan %bool %27 %int_2000 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpStore %ll %int_0 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %40 = OpLoad %float %39 + %41 = OpFOrdLessThan %bool %40 %float_0 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpKill + %42 = OpLabel + %44 = OpLoad %int %ll + %46 = OpSGreaterThanEqual %bool %44 %int_5 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + OpBranch %36 + %47 = OpLabel + OpBranch %37 + %37 = OpLabel + %49 = OpLoad %int %ll + %51 = OpIAdd %int %49 %int_1 + OpStore %ll %51 + OpBranch %35 + %36 = OpLabel + %52 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %53 = OpLoad %float %52 + %54 = OpConvertFToS %int %53 + %55 = OpSGreaterThanEqual %bool %54 %int_2000 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + OpKill + %56 = OpLabel + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %58 +%tint_symbol_1 = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %65 = OpLabel + %66 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %66 + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_3 %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..926c2733d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.spvasm.expected.wgsl @@ -0,0 +1,45 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var ll : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_30 : f32 = gl_FragCoord.x; + if ((i32(x_30) < 2000)) { + } else { + ll = 0; + loop { + let x_41 : f32 = gl_FragCoord.x; + if ((x_41 < 0.0)) { + discard; + } + let x_6 : i32 = ll; + if ((x_6 >= 5)) { + break; + } + + continuing { + let x_7 : i32 = ll; + ll = (x_7 + 1); + } + } + let x_49 : f32 = gl_FragCoord.x; + if ((i32(x_49) >= 2000)) { + discard; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl new file mode 100644 index 0000000000..926c2733d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl @@ -0,0 +1,45 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var ll : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_30 : f32 = gl_FragCoord.x; + if ((i32(x_30) < 2000)) { + } else { + ll = 0; + loop { + let x_41 : f32 = gl_FragCoord.x; + if ((x_41 < 0.0)) { + discard; + } + let x_6 : i32 = ll; + if ((x_6 >= 5)) { + break; + } + + continuing { + let x_7 : i32 = ll; + ll = (x_7 + 1); + } + } + let x_49 : f32 = gl_FragCoord.x; + if ((i32(x_49) >= 2000)) { + discard; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..7a88372cf3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.hlsl @@ -0,0 +1,48 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int ll = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_30 = gl_FragCoord.x; + if ((int(x_30) < 2000)) { + } else { + ll = 0; + while (true) { + const float x_41 = gl_FragCoord.x; + if ((x_41 < 0.0f)) { + discard; + } + if ((ll >= 5)) { + break; + } + { + ll = (ll + 1); + } + } + const float x_49 = gl_FragCoord.x; + if ((int(x_49) >= 2000)) { + discard; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f11683a884 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int ll = 0; + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + float const x_30 = (*(tint_symbol_6)).x; + if ((int(x_30) < 2000)) { + } else { + ll = 0; + while (true) { + float const x_41 = (*(tint_symbol_6)).x; + if ((x_41 < 0.0f)) { + discard_fragment(); + } + int const x_6 = ll; + if ((x_6 >= 5)) { + break; + } + { + int const x_7 = ll; + ll = (x_7 + 1); + } + } + float const x_49 = (*(tint_symbol_6)).x; + if ((int(x_49) >= 2000)) { + discard_fragment(); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..1a87cf4a5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.spvasm @@ -0,0 +1,122 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %ll "ll" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_2000 = OpConstant %int 2000 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_5 = OpConstant %int 5 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %ll = OpVariable %_ptr_Function_int Function %18 + OpStore %x_GLF_color %21 + %25 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %26 = OpLoad %float %25 + %27 = OpConvertFToS %int %26 + %29 = OpSLessThan %bool %27 %int_2000 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpStore %ll %int_0 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %40 = OpLoad %float %39 + %41 = OpFOrdLessThan %bool %40 %float_0 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpKill + %42 = OpLabel + %44 = OpLoad %int %ll + %46 = OpSGreaterThanEqual %bool %44 %int_5 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + OpBranch %36 + %47 = OpLabel + OpBranch %37 + %37 = OpLabel + %49 = OpLoad %int %ll + %51 = OpIAdd %int %49 %int_1 + OpStore %ll %51 + OpBranch %35 + %36 = OpLabel + %52 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %53 = OpLoad %float %52 + %54 = OpConvertFToS %int %53 + %55 = OpSGreaterThanEqual %bool %54 %int_2000 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + OpKill + %56 = OpLabel + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %58 +%tint_symbol_1 = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %65 = OpLabel + %66 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %66 + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %v4float %x_GLF_color + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_3 %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..926c2733d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/discards-in-control-flow/0-opt.wgsl.expected.wgsl @@ -0,0 +1,45 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var ll : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_30 : f32 = gl_FragCoord.x; + if ((i32(x_30) < 2000)) { + } else { + ll = 0; + loop { + let x_41 : f32 = gl_FragCoord.x; + if ((x_41 < 0.0)) { + discard; + } + let x_6 : i32 = ll; + if ((x_6 >= 5)) { + break; + } + + continuing { + let x_7 : i32 = ll; + ll = (x_7 + 1); + } + } + let x_49 : f32 = gl_FragCoord.x; + if ((i32(x_49) >= 2000)) { + discard; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm new file mode 100644 index 0000000000..9931daec97 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm @@ -0,0 +1,113 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f_ "f(" + OpName %iteration "iteration" + OpName %k "k" + OpName %_GLF_color "_GLF_color" + OpDecorate %iteration RelaxedPrecision + OpDecorate %k RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %21 = OpTypeFunction %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %30 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %false = OpConstantFalse %bool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %18 + %34 = OpLabel + %35 = OpFunctionCall %v3float %f_ + %36 = OpCompositeExtract %float %35 0 + %37 = OpCompositeExtract %float %35 1 + %38 = OpCompositeExtract %float %35 2 + %39 = OpCompositeConstruct %v4float %36 %37 %38 %float_1 + OpStore %_GLF_color %39 + OpReturn + OpFunctionEnd + %f_ = OpFunction %v3float None %21 + %40 = OpLabel + %iteration = OpVariable %_ptr_Function_int Function + %k = OpVariable %_ptr_Function_int Function + OpStore %iteration %int_0 + OpStore %k %int_0 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %7 = OpLoad %int %k + %45 = OpSLessThan %bool %7 %int_100 + OpBranchConditional %45 %46 %42 + %46 = OpLabel + %8 = OpLoad %int %iteration + %9 = OpIAdd %int %8 %int_1 + OpStore %iteration %9 + OpBranch %43 + %43 = OpLabel + %10 = OpLoad %int %k + %11 = OpIAdd %int %10 %int_1 + OpStore %k %11 + OpBranch %41 + %42 = OpLabel + %12 = OpLoad %int %iteration + %47 = OpSLessThan %bool %12 %int_100 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + %13 = OpLoad %int %iteration + %14 = OpISub %int %13 %int_1 + %51 = OpConvertSToF %float %14 + %15 = OpLoad %int %iteration + %16 = OpISub %int %15 %int_1 + %52 = OpConvertSToF %float %16 + %53 = OpCompositeConstruct %v3float %float_1 %51 %52 + OpReturnValue %53 + %50 = OpLabel + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + OpBranch %58 + %58 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + OpReturnValue %30 + %60 = OpLabel + OpBranch %58 + %59 = OpLabel + OpUnreachable + %56 = OpLabel + OpBranch %54 + %55 = OpLabel + OpUnreachable + %48 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f128d4c786 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.hlsl @@ -0,0 +1,45 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 f_() { + int iteration = 0; + int k = 0; + iteration = 0; + k = 0; + { + for(; (k < 100); k = (k + 1)) { + iteration = (iteration + 1); + } + } + if ((iteration < 100)) { + return float3(1.0f, float((iteration - 1)), float((iteration - 1))); + } else { + while (true) { + while (true) { + return float3(1.0f, 0.0f, 0.0f); + } + return float3(0.0f, 0.0f, 0.0f); + } + return float3(0.0f, 0.0f, 0.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + const float3 x_35 = f_(); + x_GLF_color = float4(x_35.x, x_35.y, x_35.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..428b891c8d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.msl @@ -0,0 +1,59 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 f_() { + int iteration = 0; + int k = 0; + iteration = 0; + k = 0; + while (true) { + int const x_7 = k; + if ((x_7 < 100)) { + } else { + break; + } + int const x_8 = iteration; + iteration = (x_8 + 1); + { + int const x_10 = k; + k = (x_10 + 1); + } + } + int const x_12 = iteration; + if ((x_12 < 100)) { + int const x_13 = iteration; + int const x_15 = iteration; + return float3(1.0f, float((x_13 - 1)), float((x_15 - 1))); + } else { + while (true) { + while (true) { + return float3(1.0f, 0.0f, 0.0f); + } + return float3(0.0f, 0.0f, 0.0f); + } + return float3(0.0f, 0.0f, 0.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(thread float4* const tint_symbol_4) { + float3 const x_35 = f_(); + *(tint_symbol_4) = float4(x_35.x, x_35.y, x_35.z, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2c77aec8e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.spvasm @@ -0,0 +1,137 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %f_ "f_" + OpName %iteration "iteration" + OpName %k "k" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %8 = OpTypeFunction %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %56 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %57 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %58 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %f_ = OpFunction %v3float None %8 + %11 = OpLabel + %iteration = OpVariable %_ptr_Function_int Function %15 + %k = OpVariable %_ptr_Function_int Function %15 + OpStore %iteration %int_0 + OpStore %k %int_0 + OpBranch %18 + %18 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + %22 = OpLoad %int %k + %24 = OpSLessThan %bool %22 %int_100 + OpSelectionMerge %26 None + OpBranchConditional %24 %27 %28 + %27 = OpLabel + OpBranch %26 + %28 = OpLabel + OpBranch %19 + %26 = OpLabel + %29 = OpLoad %int %iteration + %31 = OpIAdd %int %29 %int_1 + OpStore %iteration %31 + OpBranch %20 + %20 = OpLabel + %32 = OpLoad %int %k + %33 = OpIAdd %int %32 %int_1 + OpStore %k %33 + OpBranch %18 + %19 = OpLabel + %34 = OpLoad %int %iteration + %35 = OpSLessThan %bool %34 %int_100 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %38 + %37 = OpLabel + %39 = OpLoad %int %iteration + %40 = OpLoad %int %iteration + %43 = OpISub %int %39 %int_1 + %42 = OpConvertSToF %float %43 + %45 = OpISub %int %40 %int_1 + %44 = OpConvertSToF %float %45 + %46 = OpCompositeConstruct %v3float %float_1 %42 %44 + OpReturnValue %46 + %38 = OpLabel + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + OpBranch %51 + %51 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + OpReturnValue %56 + %53 = OpLabel + OpBranch %51 + %52 = OpLabel + OpReturnValue %57 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + OpReturnValue %57 + %36 = OpLabel + OpReturnValue %57 + OpFunctionEnd + %main_1 = OpFunction %void None %58 + %61 = OpLabel + %62 = OpFunctionCall %v3float %f_ + %63 = OpCompositeExtract %float %62 0 + %64 = OpCompositeExtract %float %62 1 + %65 = OpCompositeExtract %float %62 2 + %66 = OpCompositeConstruct %v4float %63 %64 %65 %float_1 + OpStore %x_GLF_color %66 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %58 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c2fa551b12 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.spvasm.expected.wgsl @@ -0,0 +1,54 @@ +var x_GLF_color : vec4; + +fn f_() -> vec3 { + var iteration : i32; + var k : i32; + iteration = 0; + k = 0; + loop { + let x_7 : i32 = k; + if ((x_7 < 100)) { + } else { + break; + } + let x_8 : i32 = iteration; + iteration = (x_8 + 1); + + continuing { + let x_10 : i32 = k; + k = (x_10 + 1); + } + } + let x_12 : i32 = iteration; + if ((x_12 < 100)) { + let x_13 : i32 = iteration; + let x_15 : i32 = iteration; + return vec3(1.0, f32((x_13 - 1)), f32((x_15 - 1))); + } else { + loop { + loop { + return vec3(1.0, 0.0, 0.0); + } + return vec3(0.0, 0.0, 0.0); + } + return vec3(0.0, 0.0, 0.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + let x_35 : vec3 = f_(); + x_GLF_color = vec4(x_35.x, x_35.y, x_35.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl new file mode 100644 index 0000000000..c2fa551b12 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl @@ -0,0 +1,54 @@ +var x_GLF_color : vec4; + +fn f_() -> vec3 { + var iteration : i32; + var k : i32; + iteration = 0; + k = 0; + loop { + let x_7 : i32 = k; + if ((x_7 < 100)) { + } else { + break; + } + let x_8 : i32 = iteration; + iteration = (x_8 + 1); + + continuing { + let x_10 : i32 = k; + k = (x_10 + 1); + } + } + let x_12 : i32 = iteration; + if ((x_12 < 100)) { + let x_13 : i32 = iteration; + let x_15 : i32 = iteration; + return vec3(1.0, f32((x_13 - 1)), f32((x_15 - 1))); + } else { + loop { + loop { + return vec3(1.0, 0.0, 0.0); + } + return vec3(0.0, 0.0, 0.0); + } + return vec3(0.0, 0.0, 0.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + let x_35 : vec3 = f_(); + x_GLF_color = vec4(x_35.x, x_35.y, x_35.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f128d4c786 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.hlsl @@ -0,0 +1,45 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 f_() { + int iteration = 0; + int k = 0; + iteration = 0; + k = 0; + { + for(; (k < 100); k = (k + 1)) { + iteration = (iteration + 1); + } + } + if ((iteration < 100)) { + return float3(1.0f, float((iteration - 1)), float((iteration - 1))); + } else { + while (true) { + while (true) { + return float3(1.0f, 0.0f, 0.0f); + } + return float3(0.0f, 0.0f, 0.0f); + } + return float3(0.0f, 0.0f, 0.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + const float3 x_35 = f_(); + x_GLF_color = float4(x_35.x, x_35.y, x_35.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..428b891c8d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.msl @@ -0,0 +1,59 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 f_() { + int iteration = 0; + int k = 0; + iteration = 0; + k = 0; + while (true) { + int const x_7 = k; + if ((x_7 < 100)) { + } else { + break; + } + int const x_8 = iteration; + iteration = (x_8 + 1); + { + int const x_10 = k; + k = (x_10 + 1); + } + } + int const x_12 = iteration; + if ((x_12 < 100)) { + int const x_13 = iteration; + int const x_15 = iteration; + return float3(1.0f, float((x_13 - 1)), float((x_15 - 1))); + } else { + while (true) { + while (true) { + return float3(1.0f, 0.0f, 0.0f); + } + return float3(0.0f, 0.0f, 0.0f); + } + return float3(0.0f, 0.0f, 0.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(thread float4* const tint_symbol_4) { + float3 const x_35 = f_(); + *(tint_symbol_4) = float4(x_35.x, x_35.y, x_35.z, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c77aec8e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.spvasm @@ -0,0 +1,137 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %f_ "f_" + OpName %iteration "iteration" + OpName %k "k" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %8 = OpTypeFunction %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %56 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %57 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %58 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %f_ = OpFunction %v3float None %8 + %11 = OpLabel + %iteration = OpVariable %_ptr_Function_int Function %15 + %k = OpVariable %_ptr_Function_int Function %15 + OpStore %iteration %int_0 + OpStore %k %int_0 + OpBranch %18 + %18 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + %22 = OpLoad %int %k + %24 = OpSLessThan %bool %22 %int_100 + OpSelectionMerge %26 None + OpBranchConditional %24 %27 %28 + %27 = OpLabel + OpBranch %26 + %28 = OpLabel + OpBranch %19 + %26 = OpLabel + %29 = OpLoad %int %iteration + %31 = OpIAdd %int %29 %int_1 + OpStore %iteration %31 + OpBranch %20 + %20 = OpLabel + %32 = OpLoad %int %k + %33 = OpIAdd %int %32 %int_1 + OpStore %k %33 + OpBranch %18 + %19 = OpLabel + %34 = OpLoad %int %iteration + %35 = OpSLessThan %bool %34 %int_100 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %38 + %37 = OpLabel + %39 = OpLoad %int %iteration + %40 = OpLoad %int %iteration + %43 = OpISub %int %39 %int_1 + %42 = OpConvertSToF %float %43 + %45 = OpISub %int %40 %int_1 + %44 = OpConvertSToF %float %45 + %46 = OpCompositeConstruct %v3float %float_1 %42 %44 + OpReturnValue %46 + %38 = OpLabel + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + OpBranch %51 + %51 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + OpReturnValue %56 + %53 = OpLabel + OpBranch %51 + %52 = OpLabel + OpReturnValue %57 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + OpReturnValue %57 + %36 = OpLabel + OpReturnValue %57 + OpFunctionEnd + %main_1 = OpFunction %void None %58 + %61 = OpLabel + %62 = OpFunctionCall %v3float %f_ + %63 = OpCompositeExtract %float %62 0 + %64 = OpCompositeExtract %float %62 1 + %65 = OpCompositeExtract %float %62 2 + %66 = OpCompositeConstruct %v4float %63 %64 %65 %float_1 + OpStore %x_GLF_color %66 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %58 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c2fa551b12 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-false-loops/0-opt.wgsl.expected.wgsl @@ -0,0 +1,54 @@ +var x_GLF_color : vec4; + +fn f_() -> vec3 { + var iteration : i32; + var k : i32; + iteration = 0; + k = 0; + loop { + let x_7 : i32 = k; + if ((x_7 < 100)) { + } else { + break; + } + let x_8 : i32 = iteration; + iteration = (x_8 + 1); + + continuing { + let x_10 : i32 = k; + k = (x_10 + 1); + } + } + let x_12 : i32 = iteration; + if ((x_12 < 100)) { + let x_13 : i32 = iteration; + let x_15 : i32 = iteration; + return vec3(1.0, f32((x_13 - 1)), f32((x_15 - 1))); + } else { + loop { + loop { + return vec3(1.0, 0.0, 0.0); + } + return vec3(0.0, 0.0, 0.0); + } + return vec3(0.0, 0.0, 0.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + let x_35 : vec3 = f_(); + x_GLF_color = vec4(x_35.x, x_35.y, x_35.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm new file mode 100644 index 0000000000..1ead4dfd77 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm @@ -0,0 +1,110 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %func_ "func(" + OpName %loop_count "loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %11 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %int_100 = OpConstant %int 100 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %28 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %29 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %int %func_ + %32 = OpIEqual %bool %31 %int_1 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + OpStore %_GLF_color %28 + OpBranch %33 + %35 = OpLabel + OpStore %_GLF_color %29 + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %int None %11 + %36 = OpLabel + %loop_count = OpVariable %_ptr_Function_int Function + OpStore %loop_count %int_0 + OpBranch %37 + %37 = OpLabel + %38 = OpPhi %int %int_0 %36 %39 %40 + OpLoopMerge %41 %40 None + OpBranch %42 + %42 = OpLabel + %43 = OpIAdd %int %38 %int_1 + OpStore %loop_count %43 + OpBranch %44 + %44 = OpLabel + %45 = OpPhi %int %43 %42 %39 %46 + OpLoopMerge %47 %46 None + OpBranch %48 + %48 = OpLabel + %39 = OpIAdd %int %45 %int_1 + OpStore %loop_count %39 + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %50 = OpLoad %float %49 + %51 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %52 = OpLoad %float %51 + %53 = OpFOrdLessThan %bool %50 %52 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + OpReturnValue %int_1 + %54 = OpLabel + %56 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %57 = OpLoad %float %56 + %58 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %59 = OpLoad %float %58 + %60 = OpFOrdLessThan %bool %57 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpBranch %47 + %61 = OpLabel + OpBranch %46 + %46 = OpLabel + %63 = OpSLessThan %bool %39 %int_100 + OpBranchConditional %63 %44 %47 + %47 = OpLabel + OpBranch %40 + %40 = OpLabel + %64 = OpSLessThan %bool %39 %int_100 + OpBranchConditional %64 %37 %41 + %41 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..db404f6b1a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.hlsl @@ -0,0 +1,71 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_() { + int loop_count = 0; + int x_38_phi = 0; + loop_count = 0; + x_38_phi = 0; + while (true) { + int x_39 = 0; + int x_45_phi = 0; + const int x_43 = (x_38_phi + 1); + loop_count = x_43; + x_45_phi = x_43; + while (true) { + x_39 = (x_45_phi + 1); + loop_count = x_39; + const float x_50 = asfloat(x_7[0].x); + const float x_52 = asfloat(x_7[0].y); + if ((x_50 < x_52)) { + return 1; + } + const float x_57 = asfloat(x_7[0].x); + const float x_59 = asfloat(x_7[0].y); + if ((x_57 < x_59)) { + break; + } + { + x_45_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + { + x_38_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + return 0; +} + +void main_1() { + const int x_31 = func_(); + if ((x_31 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a19b54d776 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.msl @@ -0,0 +1,76 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_(constant buf0& x_7) { + int loop_count = 0; + int x_38_phi = 0; + loop_count = 0; + x_38_phi = 0; + while (true) { + int x_39 = 0; + int x_45_phi = 0; + int const x_38 = x_38_phi; + int const x_43 = (x_38 + 1); + loop_count = x_43; + x_45_phi = x_43; + while (true) { + int const x_45 = x_45_phi; + x_39 = (x_45 + 1); + loop_count = x_39; + float const x_50 = x_7.injectionSwitch.x; + float const x_52 = x_7.injectionSwitch.y; + if ((x_50 < x_52)) { + return 1; + } + float const x_57 = x_7.injectionSwitch.x; + float const x_59 = x_7.injectionSwitch.y; + if ((x_57 < x_59)) { + break; + } + { + x_45_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + { + x_38_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + return 0; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int const x_31 = func_(x_7); + if ((x_31 == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..389213475d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.spvasm @@ -0,0 +1,177 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 94 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %loop_count "loop_count" + OpName %x_38_phi "x_38_phi" + OpName %x_39 "x_39" + OpName %x_45_phi "x_45_phi" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %int = OpTypeInt 32 1 + %12 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %int_100 = OpConstant %int 100 + %void = OpTypeVoid + %69 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %80 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %81 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %82 = OpTypeFunction %void %main_out + %func_ = OpFunction %int None %12 + %15 = OpLabel + %loop_count = OpVariable %_ptr_Function_int Function %18 + %x_38_phi = OpVariable %_ptr_Function_int Function %18 + %x_39 = OpVariable %_ptr_Function_int Function %18 + %x_45_phi = OpVariable %_ptr_Function_int Function %18 + OpStore %loop_count %int_0 + OpStore %x_38_phi %int_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %27 = OpLoad %int %x_38_phi + %29 = OpIAdd %int %27 %int_1 + OpStore %loop_count %29 + OpStore %x_45_phi %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %x_45_phi + %35 = OpIAdd %int %34 %int_1 + OpStore %x_39 %35 + %36 = OpLoad %int %x_39 + OpStore %loop_count %36 + %40 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %44 = OpLoad %float %43 + %45 = OpFOrdLessThan %bool %41 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %48 %47 + %48 = OpLabel + OpReturnValue %int_1 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %50 = OpLoad %float %49 + %51 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %52 = OpLoad %float %51 + %53 = OpFOrdLessThan %bool %50 %52 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + OpBranch %31 + %54 = OpLabel + OpBranch %32 + %32 = OpLabel + %56 = OpLoad %int %x_39 + OpStore %x_45_phi %56 + %57 = OpLoad %int %x_39 + %59 = OpSLessThan %bool %57 %int_100 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %31 + %60 = OpLabel + OpBranch %30 + %31 = OpLabel + OpBranch %23 + %23 = OpLabel + %63 = OpLoad %int %x_39 + OpStore %x_38_phi %63 + %64 = OpLoad %int %x_39 + %65 = OpSLessThan %bool %64 %int_100 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %67 = OpLabel + OpBranch %66 + %68 = OpLabel + OpBranch %22 + %66 = OpLabel + OpBranch %21 + %22 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %69 + %72 = OpLabel + %73 = OpFunctionCall %int %func_ + %74 = OpIEqual %bool %73 %int_1 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpStore %x_GLF_color %80 + OpBranch %75 + %77 = OpLabel + OpStore %x_GLF_color %81 + OpBranch %75 + %75 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %82 +%tint_symbol = OpFunctionParameter %main_out + %86 = OpLabel + %87 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %87 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %69 + %89 = OpLabel + %90 = OpFunctionCall %void %main_1 + %92 = OpLoad %v4float %x_GLF_color + %93 = OpCompositeConstruct %main_out %92 + %91 = OpFunctionCall %void %tint_symbol_2 %93 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 23[%23] is not post dominated by the back-edge block 66[%66] + %66 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..43fb691e54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.spvasm.expected.wgsl @@ -0,0 +1,76 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> i32 { + var loop_count : i32; + var x_38_phi : i32; + loop_count = 0; + x_38_phi = 0; + loop { + var x_39 : i32; + var x_45_phi : i32; + let x_38 : i32 = x_38_phi; + let x_43 : i32 = (x_38 + 1); + loop_count = x_43; + x_45_phi = x_43; + loop { + let x_45 : i32 = x_45_phi; + x_39 = (x_45 + 1); + loop_count = x_39; + let x_50 : f32 = x_7.injectionSwitch.x; + let x_52 : f32 = x_7.injectionSwitch.y; + if ((x_50 < x_52)) { + return 1; + } + let x_57 : f32 = x_7.injectionSwitch.x; + let x_59 : f32 = x_7.injectionSwitch.y; + if ((x_57 < x_59)) { + break; + } + + continuing { + x_45_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + + continuing { + x_38_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + return 0; +} + +fn main_1() { + let x_31 : i32 = func_(); + if ((x_31 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl new file mode 100644 index 0000000000..43fb691e54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl @@ -0,0 +1,76 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> i32 { + var loop_count : i32; + var x_38_phi : i32; + loop_count = 0; + x_38_phi = 0; + loop { + var x_39 : i32; + var x_45_phi : i32; + let x_38 : i32 = x_38_phi; + let x_43 : i32 = (x_38 + 1); + loop_count = x_43; + x_45_phi = x_43; + loop { + let x_45 : i32 = x_45_phi; + x_39 = (x_45 + 1); + loop_count = x_39; + let x_50 : f32 = x_7.injectionSwitch.x; + let x_52 : f32 = x_7.injectionSwitch.y; + if ((x_50 < x_52)) { + return 1; + } + let x_57 : f32 = x_7.injectionSwitch.x; + let x_59 : f32 = x_7.injectionSwitch.y; + if ((x_57 < x_59)) { + break; + } + + continuing { + x_45_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + + continuing { + x_38_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + return 0; +} + +fn main_1() { + let x_31 : i32 = func_(); + if ((x_31 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..db404f6b1a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.hlsl @@ -0,0 +1,71 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_() { + int loop_count = 0; + int x_38_phi = 0; + loop_count = 0; + x_38_phi = 0; + while (true) { + int x_39 = 0; + int x_45_phi = 0; + const int x_43 = (x_38_phi + 1); + loop_count = x_43; + x_45_phi = x_43; + while (true) { + x_39 = (x_45_phi + 1); + loop_count = x_39; + const float x_50 = asfloat(x_7[0].x); + const float x_52 = asfloat(x_7[0].y); + if ((x_50 < x_52)) { + return 1; + } + const float x_57 = asfloat(x_7[0].x); + const float x_59 = asfloat(x_7[0].y); + if ((x_57 < x_59)) { + break; + } + { + x_45_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + { + x_38_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + return 0; +} + +void main_1() { + const int x_31 = func_(); + if ((x_31 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a19b54d776 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.msl @@ -0,0 +1,76 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_(constant buf0& x_7) { + int loop_count = 0; + int x_38_phi = 0; + loop_count = 0; + x_38_phi = 0; + while (true) { + int x_39 = 0; + int x_45_phi = 0; + int const x_38 = x_38_phi; + int const x_43 = (x_38 + 1); + loop_count = x_43; + x_45_phi = x_43; + while (true) { + int const x_45 = x_45_phi; + x_39 = (x_45 + 1); + loop_count = x_39; + float const x_50 = x_7.injectionSwitch.x; + float const x_52 = x_7.injectionSwitch.y; + if ((x_50 < x_52)) { + return 1; + } + float const x_57 = x_7.injectionSwitch.x; + float const x_59 = x_7.injectionSwitch.y; + if ((x_57 < x_59)) { + break; + } + { + x_45_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + { + x_38_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + return 0; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int const x_31 = func_(x_7); + if ((x_31 == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..389213475d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.spvasm @@ -0,0 +1,177 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 94 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %loop_count "loop_count" + OpName %x_38_phi "x_38_phi" + OpName %x_39 "x_39" + OpName %x_45_phi "x_45_phi" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %int = OpTypeInt 32 1 + %12 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %int_100 = OpConstant %int 100 + %void = OpTypeVoid + %69 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %80 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %81 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %82 = OpTypeFunction %void %main_out + %func_ = OpFunction %int None %12 + %15 = OpLabel + %loop_count = OpVariable %_ptr_Function_int Function %18 + %x_38_phi = OpVariable %_ptr_Function_int Function %18 + %x_39 = OpVariable %_ptr_Function_int Function %18 + %x_45_phi = OpVariable %_ptr_Function_int Function %18 + OpStore %loop_count %int_0 + OpStore %x_38_phi %int_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %27 = OpLoad %int %x_38_phi + %29 = OpIAdd %int %27 %int_1 + OpStore %loop_count %29 + OpStore %x_45_phi %29 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %x_45_phi + %35 = OpIAdd %int %34 %int_1 + OpStore %x_39 %35 + %36 = OpLoad %int %x_39 + OpStore %loop_count %36 + %40 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %44 = OpLoad %float %43 + %45 = OpFOrdLessThan %bool %41 %44 + OpSelectionMerge %47 None + OpBranchConditional %45 %48 %47 + %48 = OpLabel + OpReturnValue %int_1 + %47 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %50 = OpLoad %float %49 + %51 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %52 = OpLoad %float %51 + %53 = OpFOrdLessThan %bool %50 %52 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + OpBranch %31 + %54 = OpLabel + OpBranch %32 + %32 = OpLabel + %56 = OpLoad %int %x_39 + OpStore %x_45_phi %56 + %57 = OpLoad %int %x_39 + %59 = OpSLessThan %bool %57 %int_100 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %31 + %60 = OpLabel + OpBranch %30 + %31 = OpLabel + OpBranch %23 + %23 = OpLabel + %63 = OpLoad %int %x_39 + OpStore %x_38_phi %63 + %64 = OpLoad %int %x_39 + %65 = OpSLessThan %bool %64 %int_100 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %67 = OpLabel + OpBranch %66 + %68 = OpLabel + OpBranch %22 + %66 = OpLabel + OpBranch %21 + %22 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %69 + %72 = OpLabel + %73 = OpFunctionCall %int %func_ + %74 = OpIEqual %bool %73 %int_1 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpStore %x_GLF_color %80 + OpBranch %75 + %77 = OpLabel + OpStore %x_GLF_color %81 + OpBranch %75 + %75 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %82 +%tint_symbol = OpFunctionParameter %main_out + %86 = OpLabel + %87 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %87 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %69 + %89 = OpLabel + %90 = OpFunctionCall %void %main_1 + %92 = OpLoad %v4float %x_GLF_color + %93 = OpCompositeConstruct %main_out %92 + %91 = OpFunctionCall %void %tint_symbol_2 %93 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 23[%23] is not post dominated by the back-edge block 66[%66] + %66 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..43fb691e54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-if-return/0-opt.wgsl.expected.wgsl @@ -0,0 +1,76 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> i32 { + var loop_count : i32; + var x_38_phi : i32; + loop_count = 0; + x_38_phi = 0; + loop { + var x_39 : i32; + var x_45_phi : i32; + let x_38 : i32 = x_38_phi; + let x_43 : i32 = (x_38 + 1); + loop_count = x_43; + x_45_phi = x_43; + loop { + let x_45 : i32 = x_45_phi; + x_39 = (x_45 + 1); + loop_count = x_39; + let x_50 : f32 = x_7.injectionSwitch.x; + let x_52 : f32 = x_7.injectionSwitch.y; + if ((x_50 < x_52)) { + return 1; + } + let x_57 : f32 = x_7.injectionSwitch.x; + let x_59 : f32 = x_7.injectionSwitch.y; + if ((x_57 < x_59)) { + break; + } + + continuing { + x_45_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + + continuing { + x_38_phi = x_39; + if ((x_39 < 100)) { + } else { + break; + } + } + } + return 0; +} + +fn main_1() { + let x_31 : i32 = func_(); + if ((x_31 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm new file mode 100644 index 0000000000..ad3300ec9b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm @@ -0,0 +1,58 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %_GLF_color Location 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %main = OpFunction %void None %6 + %19 = OpLabel + OpStore %_GLF_color %12 + OpSelectionMerge %20 None + OpBranchConditional %true %21 %20 + %21 = OpLabel + %22 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %23 = OpLoad %float %22 + %24 = OpFOrdLessThan %bool %23 %float_0 + OpSelectionMerge %25 None + OpBranchConditional %24 %26 %25 + %26 = OpLabel + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + OpStore %_GLF_color %12 + OpBranch %29 + %29 = OpLabel + %31 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %32 = OpLoad %float %31 + %33 = OpFOrdLessThan %bool %32 %float_0 + OpBranchConditional %33 %27 %28 + %28 = OpLabel + OpBranch %25 + %25 = OpLabel + OpBranch %20 + %20 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..d23c22a69e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.hlsl @@ -0,0 +1,41 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + if (true) { + const float x_23 = gl_FragCoord.x; + if ((x_23 < 0.0f)) { + while (true) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + { + const float x_32 = gl_FragCoord.x; + if ((x_32 < 0.0f)) { + } else { + break; + } + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..84c6e5e751 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + if (true) { + float const x_23 = (*(tint_symbol_6)).x; + if ((x_23 < 0.0f)) { + while (true) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + { + float const x_32 = (*(tint_symbol_6)).x; + if ((x_32 < 0.0f)) { + } else { + break; + } + } + } + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..1de795fa34 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.spvasm @@ -0,0 +1,104 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %17 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %40 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + OpStore %x_GLF_color %17 + OpSelectionMerge %20 None + OpBranchConditional %true %21 %20 + %21 = OpLabel + %25 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %26 = OpLoad %float %25 + %27 = OpFOrdLessThan %bool %26 %float_0 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %28 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + OpStore %x_GLF_color %17 + OpBranch %32 + %32 = OpLabel + %34 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %35 = OpLoad %float %34 + %36 = OpFOrdLessThan %bool %35 %float_0 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + OpBranch %31 + %37 = OpLabel + OpBranch %30 + %31 = OpLabel + OpBranch %28 + %28 = OpLabel + OpBranch %20 + %20 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %40 +%tint_symbol_1 = OpFunctionParameter %main_out + %44 = OpLabel + %45 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %45 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %47 = OpLabel + %48 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %48 + %49 = OpFunctionCall %void %main_1 + %51 = OpLoad %v4float %x_GLF_color + %52 = OpCompositeConstruct %main_out %51 + %50 = OpFunctionCall %void %tint_symbol_3 %52 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 32[%32] is not post dominated by the back-edge block 37[%37] + %37 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..2c077a3f5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + if (true) { + let x_23 : f32 = gl_FragCoord.x; + if ((x_23 < 0.0)) { + loop { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + + continuing { + let x_32 : f32 = gl_FragCoord.x; + if ((x_32 < 0.0)) { + } else { + break; + } + } + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl new file mode 100644 index 0000000000..2c077a3f5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl @@ -0,0 +1,36 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + if (true) { + let x_23 : f32 = gl_FragCoord.x; + if ((x_23 < 0.0)) { + loop { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + + continuing { + let x_32 : f32 = gl_FragCoord.x; + if ((x_32 < 0.0)) { + } else { + break; + } + } + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d23c22a69e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + if (true) { + const float x_23 = gl_FragCoord.x; + if ((x_23 < 0.0f)) { + while (true) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + { + const float x_32 = gl_FragCoord.x; + if ((x_32 < 0.0f)) { + } else { + break; + } + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..84c6e5e751 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + if (true) { + float const x_23 = (*(tint_symbol_6)).x; + if ((x_23 < 0.0f)) { + while (true) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + { + float const x_32 = (*(tint_symbol_6)).x; + if ((x_32 < 0.0f)) { + } else { + break; + } + } + } + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..1de795fa34 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %17 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %40 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + OpStore %x_GLF_color %17 + OpSelectionMerge %20 None + OpBranchConditional %true %21 %20 + %21 = OpLabel + %25 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %26 = OpLoad %float %25 + %27 = OpFOrdLessThan %bool %26 %float_0 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %28 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + OpStore %x_GLF_color %17 + OpBranch %32 + %32 = OpLabel + %34 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %35 = OpLoad %float %34 + %36 = OpFOrdLessThan %bool %35 %float_0 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + OpBranch %31 + %37 = OpLabel + OpBranch %30 + %31 = OpLabel + OpBranch %28 + %28 = OpLabel + OpBranch %20 + %20 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %40 +%tint_symbol_1 = OpFunctionParameter %main_out + %44 = OpLabel + %45 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %45 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %47 = OpLabel + %48 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %48 + %49 = OpFunctionCall %void %main_1 + %51 = OpLoad %v4float %x_GLF_color + %52 = OpCompositeConstruct %main_out %51 + %50 = OpFunctionCall %void %tint_symbol_3 %52 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 32[%32] is not post dominated by the back-edge block 37[%37] + %37 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..2c077a3f5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/do-while-loop-in-conditionals/0-opt.wgsl.expected.wgsl @@ -0,0 +1,36 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + if (true) { + let x_23 : f32 = gl_FragCoord.x; + if ((x_23 < 0.0)) { + loop { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + + continuing { + let x_32 : f32 = gl_FragCoord.x; + if ((x_32 < 0.0)) { + } else { + break; + } + } + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm new file mode 100644 index 0000000000..bd48a95d64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm @@ -0,0 +1,78 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource ESSL 310 + OpName %main "main" + OpName %theSSBO "theSSBO" + OpMemberName %theSSBO 0 "out_data" + OpName %_ "" + OpMemberDecorate %theSSBO 0 Offset 0 + OpDecorate %theSSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %int = OpTypeInt 32 1 + %theSSBO = OpTypeStruct %int +%_ptr_Uniform_theSSBO = OpTypePointer Uniform %theSSBO + %_ = OpVariable %_ptr_Uniform_theSSBO Uniform + %int_0 = OpConstant %int 0 + %int_42 = OpConstant %int 42 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%mat2v2float = OpTypeMatrix %v2float 2 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v2float %float_1 %float_0 + %23 = OpConstantComposite %v2float %float_0 %float_1 + %24 = OpConstantComposite %mat2v2float %22 %23 + %25 = OpConstantComposite %v2float %float_1 %float_1 + %26 = OpUndef %mat2v2float + %main = OpFunction %void None %6 + %27 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + OpStore %28 %int_42 + OpBranch %29 + %29 = OpLabel + %30 = OpPhi %mat2v2float %26 %27 %24 %31 + %32 = OpPhi %int %int_1 %27 %33 %31 + %34 = OpSGreaterThan %bool %32 %int_0 + OpLoopMerge %35 %31 None + OpBranchConditional %34 %31 %35 + %31 = OpLabel + %33 = OpISub %int %32 %int_1 + OpBranch %29 + %35 = OpLabel + %36 = OpCompositeExtract %v2float %30 0 + %37 = OpFSub %v2float %36 %22 + %38 = OpCompositeExtract %v2float %30 1 + %39 = OpFSub %v2float %38 %23 + %40 = OpCompositeConstruct %mat2v2float %37 %39 + %41 = OpVectorTimesMatrix %v2float %25 %40 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpCompositeExtract %float %41 0 + %47 = OpFOrdLessThan %bool %float_1 %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + OpBranch %43 + %48 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %43 + %44 = OpLabel + OpBranch %42 + %43 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..7909f45ebb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.hlsl @@ -0,0 +1,39 @@ +RWByteAddressBuffer x_4 : register(u0, space0); + +void main_1() { + float2x2 x_30 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 x_30_phi = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + int x_32_phi = 0; + x_4.Store(0u, asuint(42)); + x_30_phi = float2x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + x_32_phi = 1; + while (true) { + int x_33 = 0; + x_30 = x_30_phi; + const int x_32 = x_32_phi; + if ((x_32 > 0)) { + } else { + break; + } + { + x_33 = (x_32 - 1); + x_30_phi = float2x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f)); + x_32_phi = x_33; + } + } + const float2 x_41 = mul(float2x2((x_30[0u] - float2(1.0f, 0.0f)), (x_30[1u] - float2(0.0f, 1.0f))), float2(1.0f, 1.0f)); + while (true) { + if ((1.0f < x_41.x)) { + break; + } + GroupMemoryBarrierWithGroupSync(); + break; + } + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.msl new file mode 100644 index 0000000000..d4c94f7a45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; +struct theSSBO { + /* 0x0000 */ int out_data; +}; + +void main_1(device theSSBO& x_4) { + float2x2 x_30 = float2x2(0.0f); + float2x2 x_30_phi = float2x2(0.0f); + int x_32_phi = 0; + x_4.out_data = 42; + x_30_phi = float2x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + x_32_phi = 1; + while (true) { + int x_33 = 0; + x_30 = x_30_phi; + int const x_32 = x_32_phi; + if ((x_32 > 0)) { + } else { + break; + } + { + x_33 = (x_32 - 1); + x_30_phi = float2x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f)); + x_32_phi = x_33; + } + } + float2 const x_41 = (float2(1.0f, 1.0f) * float2x2((x_30[0u] - float2(1.0f, 0.0f)), (x_30[1u] - float2(0.0f, 1.0f)))); + while (true) { + if ((1.0f < x_41.x)) { + break; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + break; + } + return; +} + +kernel void tint_symbol(device theSSBO& x_4 [[buffer(0)]]) { + main_1(x_4); + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..a2f71c5c95 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.spvasm @@ -0,0 +1,121 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %theSSBO "theSSBO" + OpMemberName %theSSBO 0 "out_data" + OpName %x_4 "x_4" + OpName %main_1 "main_1" + OpName %x_30 "x_30" + OpName %x_30_phi "x_30_phi" + OpName %x_32_phi "x_32_phi" + OpName %x_33 "x_33" + OpName %main "main" + OpDecorate %theSSBO Block + OpMemberDecorate %theSSBO 0 Offset 0 + OpDecorate %x_4 DescriptorSet 0 + OpDecorate %x_4 Binding 0 + %int = OpTypeInt 32 1 + %theSSBO = OpTypeStruct %int +%_ptr_StorageBuffer_theSSBO = OpTypePointer StorageBuffer %theSSBO + %x_4 = OpVariable %_ptr_StorageBuffer_theSSBO StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %14 = OpConstantNull %mat2v2float +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_42 = OpConstant %int 42 + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v2float %float_0 %float_0 + %26 = OpConstantComposite %mat2v2float %25 %25 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %43 = OpConstantComposite %v2float %float_1 %float_0 + %44 = OpConstantComposite %v2float %float_0 %float_1 + %45 = OpConstantComposite %mat2v2float %43 %44 + %47 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %main_1 = OpFunction %void None %5 + %8 = OpLabel + %x_30 = OpVariable %_ptr_Function_mat2v2float Function %14 + %x_30_phi = OpVariable %_ptr_Function_mat2v2float Function %14 + %x_32_phi = OpVariable %_ptr_Function_int Function %18 + %x_33 = OpVariable %_ptr_Function_int Function %18 + %22 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_0 + OpStore %22 %int_42 + OpStore %x_30_phi %26 + OpStore %x_32_phi %int_1 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %33 = OpLoad %mat2v2float %x_30_phi + OpStore %x_30 %33 + %34 = OpLoad %int %x_32_phi + %36 = OpSGreaterThan %bool %34 %int_0 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + OpBranch %38 + %40 = OpLabel + OpBranch %29 + %38 = OpLabel + OpBranch %30 + %30 = OpLabel + %41 = OpISub %int %34 %int_1 + OpStore %x_33 %41 + OpStore %x_30_phi %45 + %46 = OpLoad %int %x_33 + OpStore %x_32_phi %46 + OpBranch %28 + %29 = OpLabel + %49 = OpAccessChain %_ptr_Function_v2float %x_30 %uint_0 + %50 = OpLoad %v2float %49 + %51 = OpFSub %v2float %50 %43 + %53 = OpAccessChain %_ptr_Function_v2float %x_30 %uint_1 + %54 = OpLoad %v2float %53 + %55 = OpFSub %v2float %54 %44 + %56 = OpCompositeConstruct %mat2v2float %51 %55 + %57 = OpVectorTimesMatrix %v2float %47 %56 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %62 = OpCompositeExtract %float %57 0 + %63 = OpFOrdLessThan %bool %float_1 %62 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + OpBranch %59 + %64 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %59 + %60 = OpLabel + OpBranch %58 + %59 = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %5 + %70 = OpLabel + %71 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..7eaea5b8f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.spvasm.expected.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct theSSBO { + out_data : i32; +}; + +[[group(0), binding(0)]] var x_4 : theSSBO; + +fn main_1() { + var x_30 : mat2x2; + var x_30_phi : mat2x2; + var x_32_phi : i32; + x_4.out_data = 42; + x_30_phi = mat2x2(vec2(0.0, 0.0), vec2(0.0, 0.0)); + x_32_phi = 1; + loop { + var x_33 : i32; + x_30 = x_30_phi; + let x_32 : i32 = x_32_phi; + if ((x_32 > 0)) { + } else { + break; + } + + continuing { + x_33 = (x_32 - 1); + x_30_phi = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); + x_32_phi = x_33; + } + } + let x_41 : vec2 = (vec2(1.0, 1.0) * mat2x2((x_30[0u] - vec2(1.0, 0.0)), (x_30[1u] - vec2(0.0, 1.0)))); + loop { + if ((1.0 < x_41.x)) { + break; + } + workgroupBarrier(); + break; + } + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl new file mode 100644 index 0000000000..7eaea5b8f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct theSSBO { + out_data : i32; +}; + +[[group(0), binding(0)]] var x_4 : theSSBO; + +fn main_1() { + var x_30 : mat2x2; + var x_30_phi : mat2x2; + var x_32_phi : i32; + x_4.out_data = 42; + x_30_phi = mat2x2(vec2(0.0, 0.0), vec2(0.0, 0.0)); + x_32_phi = 1; + loop { + var x_33 : i32; + x_30 = x_30_phi; + let x_32 : i32 = x_32_phi; + if ((x_32 > 0)) { + } else { + break; + } + + continuing { + x_33 = (x_32 - 1); + x_30_phi = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); + x_32_phi = x_33; + } + } + let x_41 : vec2 = (vec2(1.0, 1.0) * mat2x2((x_30[0u] - vec2(1.0, 0.0)), (x_30[1u] - vec2(0.0, 1.0)))); + loop { + if ((1.0 < x_41.x)) { + break; + } + workgroupBarrier(); + break; + } + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..7909f45ebb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.hlsl @@ -0,0 +1,39 @@ +RWByteAddressBuffer x_4 : register(u0, space0); + +void main_1() { + float2x2 x_30 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 x_30_phi = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + int x_32_phi = 0; + x_4.Store(0u, asuint(42)); + x_30_phi = float2x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + x_32_phi = 1; + while (true) { + int x_33 = 0; + x_30 = x_30_phi; + const int x_32 = x_32_phi; + if ((x_32 > 0)) { + } else { + break; + } + { + x_33 = (x_32 - 1); + x_30_phi = float2x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f)); + x_32_phi = x_33; + } + } + const float2 x_41 = mul(float2x2((x_30[0u] - float2(1.0f, 0.0f)), (x_30[1u] - float2(0.0f, 1.0f))), float2(1.0f, 1.0f)); + while (true) { + if ((1.0f < x_41.x)) { + break; + } + GroupMemoryBarrierWithGroupSync(); + break; + } + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.msl new file mode 100644 index 0000000000..d4c94f7a45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.msl @@ -0,0 +1,44 @@ +#include + +using namespace metal; +struct theSSBO { + /* 0x0000 */ int out_data; +}; + +void main_1(device theSSBO& x_4) { + float2x2 x_30 = float2x2(0.0f); + float2x2 x_30_phi = float2x2(0.0f); + int x_32_phi = 0; + x_4.out_data = 42; + x_30_phi = float2x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + x_32_phi = 1; + while (true) { + int x_33 = 0; + x_30 = x_30_phi; + int const x_32 = x_32_phi; + if ((x_32 > 0)) { + } else { + break; + } + { + x_33 = (x_32 - 1); + x_30_phi = float2x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f)); + x_32_phi = x_33; + } + } + float2 const x_41 = (float2(1.0f, 1.0f) * float2x2((x_30[0u] - float2(1.0f, 0.0f)), (x_30[1u] - float2(0.0f, 1.0f)))); + while (true) { + if ((1.0f < x_41.x)) { + break; + } + threadgroup_barrier(mem_flags::mem_threadgroup); + break; + } + return; +} + +kernel void tint_symbol(device theSSBO& x_4 [[buffer(0)]]) { + main_1(x_4); + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..a2f71c5c95 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.spvasm @@ -0,0 +1,121 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %theSSBO "theSSBO" + OpMemberName %theSSBO 0 "out_data" + OpName %x_4 "x_4" + OpName %main_1 "main_1" + OpName %x_30 "x_30" + OpName %x_30_phi "x_30_phi" + OpName %x_32_phi "x_32_phi" + OpName %x_33 "x_33" + OpName %main "main" + OpDecorate %theSSBO Block + OpMemberDecorate %theSSBO 0 Offset 0 + OpDecorate %x_4 DescriptorSet 0 + OpDecorate %x_4 Binding 0 + %int = OpTypeInt 32 1 + %theSSBO = OpTypeStruct %int +%_ptr_StorageBuffer_theSSBO = OpTypePointer StorageBuffer %theSSBO + %x_4 = OpVariable %_ptr_StorageBuffer_theSSBO StorageBuffer + %void = OpTypeVoid + %5 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %14 = OpConstantNull %mat2v2float +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_42 = OpConstant %int 42 + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v2float %float_0 %float_0 + %26 = OpConstantComposite %mat2v2float %25 %25 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %43 = OpConstantComposite %v2float %float_1 %float_0 + %44 = OpConstantComposite %v2float %float_0 %float_1 + %45 = OpConstantComposite %mat2v2float %43 %44 + %47 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %main_1 = OpFunction %void None %5 + %8 = OpLabel + %x_30 = OpVariable %_ptr_Function_mat2v2float Function %14 + %x_30_phi = OpVariable %_ptr_Function_mat2v2float Function %14 + %x_32_phi = OpVariable %_ptr_Function_int Function %18 + %x_33 = OpVariable %_ptr_Function_int Function %18 + %22 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_0 + OpStore %22 %int_42 + OpStore %x_30_phi %26 + OpStore %x_32_phi %int_1 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %33 = OpLoad %mat2v2float %x_30_phi + OpStore %x_30 %33 + %34 = OpLoad %int %x_32_phi + %36 = OpSGreaterThan %bool %34 %int_0 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + OpBranch %38 + %40 = OpLabel + OpBranch %29 + %38 = OpLabel + OpBranch %30 + %30 = OpLabel + %41 = OpISub %int %34 %int_1 + OpStore %x_33 %41 + OpStore %x_30_phi %45 + %46 = OpLoad %int %x_33 + OpStore %x_32_phi %46 + OpBranch %28 + %29 = OpLabel + %49 = OpAccessChain %_ptr_Function_v2float %x_30 %uint_0 + %50 = OpLoad %v2float %49 + %51 = OpFSub %v2float %50 %43 + %53 = OpAccessChain %_ptr_Function_v2float %x_30 %uint_1 + %54 = OpLoad %v2float %53 + %55 = OpFSub %v2float %54 %44 + %56 = OpCompositeConstruct %mat2v2float %51 %55 + %57 = OpVectorTimesMatrix %v2float %47 %56 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %62 = OpCompositeExtract %float %57 0 + %63 = OpFOrdLessThan %bool %float_1 %62 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + OpBranch %59 + %64 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %59 + %60 = OpLabel + OpBranch %58 + %59 = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %5 + %70 = OpLabel + %71 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..7eaea5b8f7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/early-return-and-barrier/0.wgsl.expected.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct theSSBO { + out_data : i32; +}; + +[[group(0), binding(0)]] var x_4 : theSSBO; + +fn main_1() { + var x_30 : mat2x2; + var x_30_phi : mat2x2; + var x_32_phi : i32; + x_4.out_data = 42; + x_30_phi = mat2x2(vec2(0.0, 0.0), vec2(0.0, 0.0)); + x_32_phi = 1; + loop { + var x_33 : i32; + x_30 = x_30_phi; + let x_32 : i32 = x_32_phi; + if ((x_32 > 0)) { + } else { + break; + } + + continuing { + x_33 = (x_32 - 1); + x_30_phi = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); + x_32_phi = x_33; + } + } + let x_41 : vec2 = (vec2(1.0, 1.0) * mat2x2((x_30[0u] - vec2(1.0, 0.0)), (x_30[1u] - vec2(0.0, 1.0)))); + loop { + if ((1.0 < x_41.x)) { + break; + } + workgroupBarrier(); + break; + } + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm new file mode 100644 index 0000000000..5bc78c6409 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm @@ -0,0 +1,139 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %loop_count "loop_count" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %int_100 = OpConstant %int 100 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %28 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %9 + %31 = OpLabel + %loop_count = OpVariable %_ptr_Function_int Function + OpStore %loop_count %int_0 + %32 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %33 = OpLoad %float %32 + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %35 = OpLoad %float %34 + %36 = OpFOrdGreaterThan %bool %33 %35 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + OpReturn + %37 = OpLabel + %39 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %40 = OpLoad %float %39 + %41 = OpFOrdLessThan %bool %40 %float_0 + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %loop_count + %44 = OpSLessThan %bool %43 %int_100 + OpLoopMerge %45 %46 None + OpBranchConditional %44 %47 %45 + %47 = OpLabel + OpSelectionMerge %48 None + OpBranchConditional %36 %49 %48 + %49 = OpLabel + OpBranch %45 + %48 = OpLabel + OpSelectionMerge %50 None + OpBranchConditional %36 %51 %52 + %51 = OpLabel + OpStore %_GLF_color %28 + OpBranch %50 + %52 = OpLabel + OpSelectionMerge %53 None + OpBranchConditional %41 %54 %53 + %54 = OpLabel + OpReturn + %53 = OpLabel + OpBranch %50 + %50 = OpLabel + OpSelectionMerge %55 None + OpBranchConditional %36 %56 %57 + %56 = OpLabel + OpStore %_GLF_color %28 + OpBranch %55 + %57 = OpLabel + OpStore %_GLF_color %29 + OpBranch %55 + %55 = OpLabel + OpSelectionMerge %58 None + OpBranchConditional %36 %59 %58 + %59 = OpLabel + OpReturn + %58 = OpLabel + OpSelectionMerge %60 None + OpBranchConditional %41 %61 %60 + %61 = OpLabel + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %int %loop_count + %64 = OpSLessThan %bool %63 %int_100 + OpLoopMerge %65 %66 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + %67 = OpLoad %int %loop_count + %68 = OpIAdd %int %67 %int_1 + OpStore %loop_count %68 + OpBranch %62 + %65 = OpLabel + OpBranch %60 + %60 = OpLabel + OpBranch %46 + %46 = OpLabel + %69 = OpLoad %int %loop_count + %70 = OpIAdd %int %69 %int_1 + OpStore %loop_count %70 + OpBranch %42 + %45 = OpLabel + %71 = OpLoad %int %loop_count + %72 = OpSGreaterThanEqual %bool %71 %int_100 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + OpStore %_GLF_color %29 + OpBranch %73 + %75 = OpLabel + OpStore %_GLF_color %28 + OpBranch %73 + %73 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..6da05031d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.hlsl @@ -0,0 +1,71 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int loop_count = 0; + loop_count = 0; + const float x_33 = asfloat(x_7[0].x); + const float x_35 = asfloat(x_7[0].y); + const bool x_36 = (x_33 > x_35); + if (x_36) { + return; + } + const float x_40 = gl_FragCoord.x; + const bool x_41 = (x_40 < 0.0f); + { + for(; (loop_count < 100); loop_count = (loop_count + 1)) { + if (x_36) { + break; + } + if (x_36) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } else { + if (x_41) { + return; + } + } + if (x_36) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + if (x_36) { + return; + } + if (x_41) { + { + for(; (loop_count < 100); loop_count = (loop_count + 1)) { + } + } + } + } + } + if ((loop_count >= 100)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..763a5d8fa0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.msl @@ -0,0 +1,85 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int loop_count = 0; + loop_count = 0; + float const x_33 = x_7.injectionSwitch.x; + float const x_35 = x_7.injectionSwitch.y; + bool const x_36 = (x_33 > x_35); + if (x_36) { + return; + } + float const x_40 = (*(tint_symbol_5)).x; + bool const x_41 = (x_40 < 0.0f); + while (true) { + int const x_43 = loop_count; + if ((x_43 < 100)) { + } else { + break; + } + if (x_36) { + break; + } + if (x_36) { + *(tint_symbol_6) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } else { + if (x_41) { + return; + } + } + if (x_36) { + *(tint_symbol_6) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + if (x_36) { + return; + } + if (x_41) { + while (true) { + int const x_63 = loop_count; + if ((x_63 < 100)) { + } else { + break; + } + { + int const x_67 = loop_count; + loop_count = (x_67 + 1); + } + } + } + { + int const x_69 = loop_count; + loop_count = (x_69 + 1); + } + } + int const x_71 = loop_count; + if ((x_71 >= 100)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..ddaaf9279a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.spvasm @@ -0,0 +1,191 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %loop_count "loop_count" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %int_100 = OpConstant %int 100 + %float_1 = OpConstant %float 1 + %57 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %63 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %87 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %loop_count = OpVariable %_ptr_Function_int Function %22 + OpStore %loop_count %int_0 + %27 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %28 = OpLoad %float %27 + %30 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %31 = OpLoad %float %30 + %32 = OpFOrdGreaterThan %bool %28 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %34 + %35 = OpLabel + OpReturn + %34 = OpLabel + %37 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + %40 = OpFOrdLessThan %bool %38 %float_0 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %int %loop_count + %47 = OpSLessThan %bool %45 %int_100 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + OpBranch %48 + %50 = OpLabel + OpBranch %42 + %48 = OpLabel + OpSelectionMerge %51 None + OpBranchConditional %32 %52 %51 + %52 = OpLabel + OpBranch %42 + %51 = OpLabel + OpSelectionMerge %53 None + OpBranchConditional %32 %54 %55 + %54 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %53 + %55 = OpLabel + OpSelectionMerge %58 None + OpBranchConditional %40 %59 %58 + %59 = OpLabel + OpReturn + %58 = OpLabel + OpBranch %53 + %53 = OpLabel + OpSelectionMerge %60 None + OpBranchConditional %32 %61 %62 + %61 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %60 + %62 = OpLabel + OpStore %x_GLF_color %63 + OpBranch %60 + %60 = OpLabel + OpSelectionMerge %64 None + OpBranchConditional %32 %65 %64 + %65 = OpLabel + OpReturn + %64 = OpLabel + OpSelectionMerge %66 None + OpBranchConditional %40 %67 %66 + %67 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %72 = OpLoad %int %loop_count + %73 = OpSLessThan %bool %72 %int_100 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %74 + %76 = OpLabel + OpBranch %69 + %74 = OpLabel + OpBranch %70 + %70 = OpLabel + %77 = OpLoad %int %loop_count + %79 = OpIAdd %int %77 %int_1 + OpStore %loop_count %79 + OpBranch %68 + %69 = OpLabel + OpBranch %66 + %66 = OpLabel + OpBranch %43 + %43 = OpLabel + %80 = OpLoad %int %loop_count + %81 = OpIAdd %int %80 %int_1 + OpStore %loop_count %81 + OpBranch %41 + %42 = OpLabel + %82 = OpLoad %int %loop_count + %83 = OpSGreaterThanEqual %bool %82 %int_100 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + OpStore %x_GLF_color %63 + OpBranch %84 + %86 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %84 + %84 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %87 +%tint_symbol_1 = OpFunctionParameter %main_out + %91 = OpLabel + %92 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %92 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %94 = OpLabel + %95 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %95 + %96 = OpFunctionCall %void %main_1 + %98 = OpLoad %v4float %x_GLF_color + %99 = OpCompositeConstruct %main_out %98 + %97 = OpFunctionCall %void %tint_symbol_3 %99 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..08be511167 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.spvasm.expected.wgsl @@ -0,0 +1,86 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var loop_count : i32; + loop_count = 0; + let x_33 : f32 = x_7.injectionSwitch.x; + let x_35 : f32 = x_7.injectionSwitch.y; + let x_36 : bool = (x_33 > x_35); + if (x_36) { + return; + } + let x_40 : f32 = gl_FragCoord.x; + let x_41 : bool = (x_40 < 0.0); + loop { + let x_43 : i32 = loop_count; + if ((x_43 < 100)) { + } else { + break; + } + if (x_36) { + break; + } + if (x_36) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } else { + if (x_41) { + return; + } + } + if (x_36) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + if (x_36) { + return; + } + if (x_41) { + loop { + let x_63 : i32 = loop_count; + if ((x_63 < 100)) { + } else { + break; + } + + continuing { + let x_67 : i32 = loop_count; + loop_count = (x_67 + 1); + } + } + } + + continuing { + let x_69 : i32 = loop_count; + loop_count = (x_69 + 1); + } + } + let x_71 : i32 = loop_count; + if ((x_71 >= 100)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl new file mode 100644 index 0000000000..08be511167 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl @@ -0,0 +1,86 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var loop_count : i32; + loop_count = 0; + let x_33 : f32 = x_7.injectionSwitch.x; + let x_35 : f32 = x_7.injectionSwitch.y; + let x_36 : bool = (x_33 > x_35); + if (x_36) { + return; + } + let x_40 : f32 = gl_FragCoord.x; + let x_41 : bool = (x_40 < 0.0); + loop { + let x_43 : i32 = loop_count; + if ((x_43 < 100)) { + } else { + break; + } + if (x_36) { + break; + } + if (x_36) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } else { + if (x_41) { + return; + } + } + if (x_36) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + if (x_36) { + return; + } + if (x_41) { + loop { + let x_63 : i32 = loop_count; + if ((x_63 < 100)) { + } else { + break; + } + + continuing { + let x_67 : i32 = loop_count; + loop_count = (x_67 + 1); + } + } + } + + continuing { + let x_69 : i32 = loop_count; + loop_count = (x_69 + 1); + } + } + let x_71 : i32 = loop_count; + if ((x_71 >= 100)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..6da05031d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.hlsl @@ -0,0 +1,71 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int loop_count = 0; + loop_count = 0; + const float x_33 = asfloat(x_7[0].x); + const float x_35 = asfloat(x_7[0].y); + const bool x_36 = (x_33 > x_35); + if (x_36) { + return; + } + const float x_40 = gl_FragCoord.x; + const bool x_41 = (x_40 < 0.0f); + { + for(; (loop_count < 100); loop_count = (loop_count + 1)) { + if (x_36) { + break; + } + if (x_36) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } else { + if (x_41) { + return; + } + } + if (x_36) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + if (x_36) { + return; + } + if (x_41) { + { + for(; (loop_count < 100); loop_count = (loop_count + 1)) { + } + } + } + } + } + if ((loop_count >= 100)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..763a5d8fa0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.msl @@ -0,0 +1,85 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int loop_count = 0; + loop_count = 0; + float const x_33 = x_7.injectionSwitch.x; + float const x_35 = x_7.injectionSwitch.y; + bool const x_36 = (x_33 > x_35); + if (x_36) { + return; + } + float const x_40 = (*(tint_symbol_5)).x; + bool const x_41 = (x_40 < 0.0f); + while (true) { + int const x_43 = loop_count; + if ((x_43 < 100)) { + } else { + break; + } + if (x_36) { + break; + } + if (x_36) { + *(tint_symbol_6) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } else { + if (x_41) { + return; + } + } + if (x_36) { + *(tint_symbol_6) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + if (x_36) { + return; + } + if (x_41) { + while (true) { + int const x_63 = loop_count; + if ((x_63 < 100)) { + } else { + break; + } + { + int const x_67 = loop_count; + loop_count = (x_67 + 1); + } + } + } + { + int const x_69 = loop_count; + loop_count = (x_69 + 1); + } + } + int const x_71 = loop_count; + if ((x_71 >= 100)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..ddaaf9279a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.spvasm @@ -0,0 +1,191 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 100 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %loop_count "loop_count" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %int_100 = OpConstant %int 100 + %float_1 = OpConstant %float 1 + %57 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %63 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %87 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %loop_count = OpVariable %_ptr_Function_int Function %22 + OpStore %loop_count %int_0 + %27 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %28 = OpLoad %float %27 + %30 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %31 = OpLoad %float %30 + %32 = OpFOrdGreaterThan %bool %28 %31 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %34 + %35 = OpLabel + OpReturn + %34 = OpLabel + %37 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + %40 = OpFOrdLessThan %bool %38 %float_0 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %int %loop_count + %47 = OpSLessThan %bool %45 %int_100 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + OpBranch %48 + %50 = OpLabel + OpBranch %42 + %48 = OpLabel + OpSelectionMerge %51 None + OpBranchConditional %32 %52 %51 + %52 = OpLabel + OpBranch %42 + %51 = OpLabel + OpSelectionMerge %53 None + OpBranchConditional %32 %54 %55 + %54 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %53 + %55 = OpLabel + OpSelectionMerge %58 None + OpBranchConditional %40 %59 %58 + %59 = OpLabel + OpReturn + %58 = OpLabel + OpBranch %53 + %53 = OpLabel + OpSelectionMerge %60 None + OpBranchConditional %32 %61 %62 + %61 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %60 + %62 = OpLabel + OpStore %x_GLF_color %63 + OpBranch %60 + %60 = OpLabel + OpSelectionMerge %64 None + OpBranchConditional %32 %65 %64 + %65 = OpLabel + OpReturn + %64 = OpLabel + OpSelectionMerge %66 None + OpBranchConditional %40 %67 %66 + %67 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %72 = OpLoad %int %loop_count + %73 = OpSLessThan %bool %72 %int_100 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %74 + %76 = OpLabel + OpBranch %69 + %74 = OpLabel + OpBranch %70 + %70 = OpLabel + %77 = OpLoad %int %loop_count + %79 = OpIAdd %int %77 %int_1 + OpStore %loop_count %79 + OpBranch %68 + %69 = OpLabel + OpBranch %66 + %66 = OpLabel + OpBranch %43 + %43 = OpLabel + %80 = OpLoad %int %loop_count + %81 = OpIAdd %int %80 %int_1 + OpStore %loop_count %81 + OpBranch %41 + %42 = OpLabel + %82 = OpLoad %int %loop_count + %83 = OpSGreaterThanEqual %bool %82 %int_100 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + OpStore %x_GLF_color %63 + OpBranch %84 + %86 = OpLabel + OpStore %x_GLF_color %57 + OpBranch %84 + %84 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %87 +%tint_symbol_1 = OpFunctionParameter %main_out + %91 = OpLabel + %92 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %92 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %94 = OpLabel + %95 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %95 + %96 = OpFunctionCall %void %main_1 + %98 = OpLoad %v4float %x_GLF_color + %99 = OpCompositeConstruct %main_out %98 + %97 = OpFunctionCall %void %tint_symbol_3 %99 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..08be511167 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/flag-always-false-if/0-opt.wgsl.expected.wgsl @@ -0,0 +1,86 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var loop_count : i32; + loop_count = 0; + let x_33 : f32 = x_7.injectionSwitch.x; + let x_35 : f32 = x_7.injectionSwitch.y; + let x_36 : bool = (x_33 > x_35); + if (x_36) { + return; + } + let x_40 : f32 = gl_FragCoord.x; + let x_41 : bool = (x_40 < 0.0); + loop { + let x_43 : i32 = loop_count; + if ((x_43 < 100)) { + } else { + break; + } + if (x_36) { + break; + } + if (x_36) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } else { + if (x_41) { + return; + } + } + if (x_36) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + if (x_36) { + return; + } + if (x_41) { + loop { + let x_63 : i32 = loop_count; + if ((x_63 < 100)) { + } else { + break; + } + + continuing { + let x_67 : i32 = loop_count; + loop_count = (x_67 + 1); + } + } + } + + continuing { + let x_69 : i32 = loop_count; + loop_count = (x_69 + 1); + } + } + let x_71 : i32 = loop_count; + if ((x_71 >= 100)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm new file mode 100644 index 0000000000..d28f656181 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm @@ -0,0 +1,62 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %drawShape_vf2_ "drawShape(vf2;" + OpName %pos "pos" + OpName %c3 "c3" + OpName %param "param" + OpName %color "color" + OpDecorate %color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v3float = OpTypeVector %float 3 + %14 = OpTypeFunction %v3float %_ptr_Function_v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %21 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %22 = OpConstantComposite %v2float %float_1 %float_1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %27 = OpUndef %bool + %main = OpFunction %void None %9 + %28 = OpLabel + %param = OpVariable %_ptr_Function_v2float Function + OpStore %param %22 + %29 = OpFunctionCall %v3float %drawShape_vf2_ %param + OpStore %color %26 + OpReturn + OpFunctionEnd +%drawShape_vf2_ = OpFunction %v3float None %14 + %pos = OpFunctionParameter %_ptr_Function_v2float + %30 = OpLabel + %c3 = OpVariable %_ptr_Function_bool Function + %31 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %32 = OpLoad %float %31 + %33 = OpFOrdLessThan %bool %32 %float_1 + OpStore %c3 %33 + OpBranch %34 + %34 = OpLabel + %35 = OpPhi %bool %33 %30 %27 %36 + OpLoopMerge %37 %36 None + OpBranchConditional %35 %38 %37 + %38 = OpLabel + OpReturnValue %21 + %36 = OpLabel + OpBranch %34 + %37 = OpLabel + OpReturnValue %21 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..658f19ba85 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + + +var color : vec4; + +fn drawShape_vf2_(pos : ptr>) -> vec3 { + var c3 : bool; + var x_35_phi : bool; + let x_32 : f32 = (*(pos)).y; + let x_33 : bool = (x_32 < 1.0); + c3 = x_33; + x_35_phi = x_33; + loop { + let x_35 : bool = x_35_phi; + if (x_35) { + } else { + break; + } + return vec3(1.0, 1.0, 1.0); + + continuing { + x_35_phi = false; + } + } + return vec3(1.0, 1.0, 1.0); +} + +fn main_1() { + var param : vec2; + param = vec2(1.0, 1.0); + let x_29 : vec3 = drawShape_vf2_(&(param)); + color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color); +} + +Failed to generate: error: for-loop condition must be bool, got bool diff --git a/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..876f990a70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.msl @@ -0,0 +1,47 @@ +#include + +using namespace metal; +struct main_out { + float4 color_1; +}; +struct tint_symbol_1 { + float4 color_1 [[color(0)]]; +}; + +float3 drawShape_vf2_(thread float2* const pos) { + bool c3 = false; + bool x_35_phi = false; + float const x_32 = (*(pos)).y; + bool const x_33 = (x_32 < 1.0f); + c3 = x_33; + x_35_phi = x_33; + while (true) { + bool const x_35 = x_35_phi; + if (x_35) { + } else { + break; + } + return float3(1.0f, 1.0f, 1.0f); + { + x_35_phi = false; + } + } + return float3(1.0f, 1.0f, 1.0f); +} + +void main_1(thread float4* const tint_symbol_4) { + float2 param = 0.0f; + param = float2(1.0f, 1.0f); + float3 const x_29 = drawShape_vf2_(&(param)); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.color_1=tint_symbol_2.color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..945adf2197 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.spvasm @@ -0,0 +1,105 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %color "color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %drawShape_vf2_ "drawShape_vf2_" + OpName %pos "pos" + OpName %c3 "c3" + OpName %x_35_phi "x_35_phi" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %8 = OpTypeFunction %v3float %_ptr_Function_v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %18 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %36 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %false = OpConstantFalse %bool + %void = OpTypeVoid + %38 = OpTypeFunction %void + %43 = OpConstantNull %v2float + %44 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out +%drawShape_vf2_ = OpFunction %v3float None %8 + %pos = OpFunctionParameter %_ptr_Function_v2float + %14 = OpLabel + %c3 = OpVariable %_ptr_Function_bool Function %18 + %x_35_phi = OpVariable %_ptr_Function_bool Function %18 + %24 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %25 = OpLoad %float %24 + %27 = OpFOrdLessThan %bool %25 %float_1 + OpStore %c3 %27 + OpStore %x_35_phi %27 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %bool %x_35_phi + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + OpBranch %33 + %35 = OpLabel + OpBranch %29 + %33 = OpLabel + OpReturnValue %36 + %30 = OpLabel + OpStore %x_35_phi %false + OpBranch %28 + %29 = OpLabel + OpReturnValue %36 + OpFunctionEnd + %main_1 = OpFunction %void None %38 + %41 = OpLabel + %param = OpVariable %_ptr_Function_v2float Function %43 + OpStore %param %44 + %45 = OpFunctionCall %v3float %drawShape_vf2_ %param + OpStore %color %48 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %49 +%tint_symbol = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %38 + %56 = OpLabel + %57 = OpFunctionCall %void %main_1 + %59 = OpLoad %v4float %color + %60 = OpCompositeConstruct %main_out %59 + %58 = OpFunctionCall %void %tint_symbol_2 %60 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..3817d55940 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.spvasm.expected.wgsl @@ -0,0 +1,42 @@ +var color : vec4; + +fn drawShape_vf2_(pos : ptr>) -> vec3 { + var c3 : bool; + var x_35_phi : bool; + let x_32 : f32 = (*(pos)).y; + let x_33 : bool = (x_32 < 1.0); + c3 = x_33; + x_35_phi = x_33; + loop { + let x_35 : bool = x_35_phi; + if (x_35) { + } else { + break; + } + return vec3(1.0, 1.0, 1.0); + + continuing { + x_35_phi = false; + } + } + return vec3(1.0, 1.0, 1.0); +} + +fn main_1() { + var param : vec2; + param = vec2(1.0, 1.0); + let x_29 : vec3 = drawShape_vf2_(&(param)); + color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl new file mode 100644 index 0000000000..3817d55940 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl @@ -0,0 +1,42 @@ +var color : vec4; + +fn drawShape_vf2_(pos : ptr>) -> vec3 { + var c3 : bool; + var x_35_phi : bool; + let x_32 : f32 = (*(pos)).y; + let x_33 : bool = (x_32 < 1.0); + c3 = x_33; + x_35_phi = x_33; + loop { + let x_35 : bool = x_35_phi; + if (x_35) { + } else { + break; + } + return vec3(1.0, 1.0, 1.0); + + continuing { + x_35_phi = false; + } + } + return vec3(1.0, 1.0, 1.0); +} + +fn main_1() { + var param : vec2; + param = vec2(1.0, 1.0); + let x_29 : vec3 = drawShape_vf2_(&(param)); + color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..028dc34fad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.hlsl @@ -0,0 +1,50 @@ +SKIP: FAILED + + +var color : vec4; + +fn drawShape_vf2_(pos : ptr>) -> vec3 { + var c3 : bool; + var x_35_phi : bool; + let x_32 : f32 = (*(pos)).y; + let x_33 : bool = (x_32 < 1.0); + c3 = x_33; + x_35_phi = x_33; + loop { + let x_35 : bool = x_35_phi; + if (x_35) { + } else { + break; + } + return vec3(1.0, 1.0, 1.0); + + continuing { + x_35_phi = false; + } + } + return vec3(1.0, 1.0, 1.0); +} + +fn main_1() { + var param : vec2; + param = vec2(1.0, 1.0); + let x_29 : vec3 = drawShape_vf2_(&(param)); + color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color); +} + +Failed to generate: graphicsfuzz/for-condition-always-false/0-opt.wgsl:11:23 error: for-loop condition must be bool, got bool + let x_35 : bool = x_35_phi; + ^^^^^^^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..876f990a70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.msl @@ -0,0 +1,47 @@ +#include + +using namespace metal; +struct main_out { + float4 color_1; +}; +struct tint_symbol_1 { + float4 color_1 [[color(0)]]; +}; + +float3 drawShape_vf2_(thread float2* const pos) { + bool c3 = false; + bool x_35_phi = false; + float const x_32 = (*(pos)).y; + bool const x_33 = (x_32 < 1.0f); + c3 = x_33; + x_35_phi = x_33; + while (true) { + bool const x_35 = x_35_phi; + if (x_35) { + } else { + break; + } + return float3(1.0f, 1.0f, 1.0f); + { + x_35_phi = false; + } + } + return float3(1.0f, 1.0f, 1.0f); +} + +void main_1(thread float4* const tint_symbol_4) { + float2 param = 0.0f; + param = float2(1.0f, 1.0f); + float3 const x_29 = drawShape_vf2_(&(param)); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.color_1=tint_symbol_2.color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..945adf2197 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.spvasm @@ -0,0 +1,105 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 61 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %color "color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %drawShape_vf2_ "drawShape_vf2_" + OpName %pos "pos" + OpName %c3 "c3" + OpName %x_35_phi "x_35_phi" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %8 = OpTypeFunction %v3float %_ptr_Function_v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %18 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %36 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %false = OpConstantFalse %bool + %void = OpTypeVoid + %38 = OpTypeFunction %void + %43 = OpConstantNull %v2float + %44 = OpConstantComposite %v2float %float_1 %float_1 + %float_0 = OpConstant %float 0 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %49 = OpTypeFunction %void %main_out +%drawShape_vf2_ = OpFunction %v3float None %8 + %pos = OpFunctionParameter %_ptr_Function_v2float + %14 = OpLabel + %c3 = OpVariable %_ptr_Function_bool Function %18 + %x_35_phi = OpVariable %_ptr_Function_bool Function %18 + %24 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %25 = OpLoad %float %24 + %27 = OpFOrdLessThan %bool %25 %float_1 + OpStore %c3 %27 + OpStore %x_35_phi %27 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %bool %x_35_phi + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + OpBranch %33 + %35 = OpLabel + OpBranch %29 + %33 = OpLabel + OpReturnValue %36 + %30 = OpLabel + OpStore %x_35_phi %false + OpBranch %28 + %29 = OpLabel + OpReturnValue %36 + OpFunctionEnd + %main_1 = OpFunction %void None %38 + %41 = OpLabel + %param = OpVariable %_ptr_Function_v2float Function %43 + OpStore %param %44 + %45 = OpFunctionCall %v3float %drawShape_vf2_ %param + OpStore %color %48 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %49 +%tint_symbol = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %38 + %56 = OpLabel + %57 = OpFunctionCall %void %main_1 + %59 = OpLoad %v4float %color + %60 = OpCompositeConstruct %main_out %59 + %58 = OpFunctionCall %void %tint_symbol_2 %60 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..3817d55940 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-condition-always-false/0-opt.wgsl.expected.wgsl @@ -0,0 +1,42 @@ +var color : vec4; + +fn drawShape_vf2_(pos : ptr>) -> vec3 { + var c3 : bool; + var x_35_phi : bool; + let x_32 : f32 = (*(pos)).y; + let x_33 : bool = (x_32 < 1.0); + c3 = x_33; + x_35_phi = x_33; + loop { + let x_35 : bool = x_35_phi; + if (x_35) { + } else { + break; + } + return vec3(1.0, 1.0, 1.0); + + continuing { + x_35_phi = false; + } + } + return vec3(1.0, 1.0, 1.0); +} + +fn main_1() { + var param : vec2; + param = vec2(1.0, 1.0); + let x_29 : vec3 = drawShape_vf2_(&(param)); + color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm new file mode 100644 index 0000000000..f11e6d995f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm @@ -0,0 +1,50 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %mand_ "mand(" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %9 = OpTypeFunction %v3float + %float_1 = OpConstant %float 1 + %11 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %15 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %6 + %16 = OpLabel + %17 = OpFunctionCall %v3float %mand_ + OpBranch %18 + %18 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + OpStore %_GLF_color %15 + OpReturn + %20 = OpLabel + OpBranch %18 + %19 = OpLabel + OpUnreachable + OpFunctionEnd + %mand_ = OpFunction %v3float None %9 + %22 = OpLabel + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + OpReturnValue %11 + %25 = OpLabel + OpBranch %23 + %24 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..71965c18ef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.hlsl @@ -0,0 +1,31 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 mand_() { + while (true) { + return float3(1.0f, 1.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + const float3 x_17 = mand_(); + while (true) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.msl new file mode 100644 index 0000000000..5b8b71891c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 mand_() { + while (true) { + return float3(1.0f, 1.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(thread float4* const tint_symbol_4) { + float3 const x_17 = mand_(); + while (true) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..3e359630d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %mand_ "mand_" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %8 = OpTypeFunction %v3float + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %30 = OpTypeFunction %void %main_out + %mand_ = OpFunction %v3float None %8 + %11 = OpLabel + OpBranch %12 + %12 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + OpReturnValue %17 + %14 = OpLabel + OpBranch %12 + %13 = OpLabel + OpReturnValue %19 + OpFunctionEnd + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %24 = OpFunctionCall %v3float %mand_ + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + OpStore %x_GLF_color %29 + OpReturn + %27 = OpLabel + OpBranch %25 + %26 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %30 +%tint_symbol = OpFunctionParameter %main_out + %34 = OpLabel + %35 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %35 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %37 = OpLabel + %38 = OpFunctionCall %void %main_1 + %40 = OpLoad %v4float %x_GLF_color + %41 = OpCompositeConstruct %main_out %40 + %39 = OpFunctionCall %void %tint_symbol_2 %41 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..1478c3bd3b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +var x_GLF_color : vec4; + +fn mand_() -> vec3 { + loop { + return vec3(1.0, 1.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + let x_17 : vec3 = mand_(); + loop { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl new file mode 100644 index 0000000000..1478c3bd3b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl @@ -0,0 +1,28 @@ +var x_GLF_color : vec4; + +fn mand_() -> vec3 { + loop { + return vec3(1.0, 1.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + let x_17 : vec3 = mand_(); + loop { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..71965c18ef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 mand_() { + while (true) { + return float3(1.0f, 1.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + const float3 x_17 = mand_(); + while (true) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.msl new file mode 100644 index 0000000000..5b8b71891c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 mand_() { + while (true) { + return float3(1.0f, 1.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(thread float4* const tint_symbol_4) { + float3 const x_17 = mand_(); + while (true) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..3e359630d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %mand_ "mand_" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %8 = OpTypeFunction %v3float + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %30 = OpTypeFunction %void %main_out + %mand_ = OpFunction %v3float None %8 + %11 = OpLabel + OpBranch %12 + %12 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + OpReturnValue %17 + %14 = OpLabel + OpBranch %12 + %13 = OpLabel + OpReturnValue %19 + OpFunctionEnd + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %24 = OpFunctionCall %v3float %mand_ + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + OpStore %x_GLF_color %29 + OpReturn + %27 = OpLabel + OpBranch %25 + %26 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %30 +%tint_symbol = OpFunctionParameter %main_out + %34 = OpLabel + %35 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %35 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %37 = OpLabel + %38 = OpFunctionCall %void %main_1 + %40 = OpLoad %v4float %x_GLF_color + %41 = OpCompositeConstruct %main_out %40 + %39 = OpFunctionCall %void %tint_symbol_2 %41 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..1478c3bd3b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-loop-with-return/0.wgsl.expected.wgsl @@ -0,0 +1,28 @@ +var x_GLF_color : vec4; + +fn mand_() -> vec3 { + loop { + return vec3(1.0, 1.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + let x_17 : vec3 = mand_(); + loop { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm new file mode 100644 index 0000000000..59f0b30d22 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm @@ -0,0 +1,78 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %i "i" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %_GLF_color Location 0 + OpDecorate %i RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %16 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %uint_0 = OpConstant %uint 0 +%float_226_695999 = OpConstant %float 226.695999 + %28 = OpConstantComposite %v4float %float_226_695999 %float_1 %float_1 %float_1 + %main = OpFunction %void None %10 + %29 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %16 + OpStore %i %int_1 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %6 = OpLoad %int %i + %34 = OpSLessThan %bool %6 %int_2 + OpBranchConditional %34 %35 %31 + %35 = OpLabel + %36 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %37 = OpLoad %float %36 + %38 = OpFOrdLessThan %bool %37 %float_0 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %39 + %40 = OpLabel + %41 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %42 = OpLoad %float %41 + %43 = OpFOrdLessThan %bool %42 %float_0 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + OpStore %_GLF_color %28 + OpBranch %44 + %44 = OpLabel + OpBranch %32 + %39 = OpLabel + OpReturn + %32 = OpLabel + %7 = OpLoad %int %i + %8 = OpIAdd %int %7 %int_1 + OpStore %i %8 + OpBranch %30 + %31 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2d3183d477 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.hlsl @@ -0,0 +1,41 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 1; + { + for(; (i < 2); i = (i + 1)) { + const float x_37 = gl_FragCoord.y; + if ((x_37 < 0.0f)) { + const float x_42 = gl_FragCoord.x; + if ((x_42 < 0.0f)) { + x_GLF_color = float4(226.695999146f, 1.0f, 1.0f, 1.0f); + } + continue; + } + return; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d32227c0dd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.msl @@ -0,0 +1,51 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 1; + while (true) { + int const x_6 = i; + if ((x_6 < 2)) { + } else { + break; + } + float const x_37 = (*(tint_symbol_6)).y; + if ((x_37 < 0.0f)) { + float const x_42 = (*(tint_symbol_6)).x; + if ((x_42 < 0.0f)) { + *(tint_symbol_5) = float4(226.695999146f, 1.0f, 1.0f, 1.0f); + } + { + int const x_7 = i; + i = (x_7 + 1); + } + continue; + } + return; + { + int const x_7 = i; + i = (x_7 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..42a7dcde1e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.spvasm @@ -0,0 +1,114 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 +%float_226_695999 = OpConstant %float 226.695999 + %49 = OpConstantComposite %v4float %float_226_695999 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %52 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %i = OpVariable %_ptr_Function_int Function %18 + OpStore %x_GLF_color %21 + OpStore %i %int_1 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %27 = OpLoad %int %i + %29 = OpSLessThan %bool %27 %int_2 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpBranch %24 + %31 = OpLabel + %37 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %38 = OpLoad %float %37 + %39 = OpFOrdLessThan %bool %38 %float_0 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + %43 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %44 = OpLoad %float %43 + %45 = OpFOrdLessThan %bool %44 %float_0 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + OpStore %x_GLF_color %49 + OpBranch %46 + %46 = OpLabel + OpBranch %25 + %40 = OpLabel + OpReturn + %25 = OpLabel + %50 = OpLoad %int %i + %51 = OpIAdd %int %50 %int_1 + OpStore %i %51 + OpBranch %23 + %24 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %52 +%tint_symbol_1 = OpFunctionParameter %main_out + %56 = OpLabel + %57 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %57 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %59 = OpLabel + %60 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %60 + %61 = OpFunctionCall %void %main_1 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpCompositeConstruct %main_out %63 + %62 = OpFunctionCall %void %tint_symbol_3 %64 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..869d8a9365 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.spvasm.expected.wgsl @@ -0,0 +1,43 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var i : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 1; + loop { + let x_6 : i32 = i; + if ((x_6 < 2)) { + } else { + break; + } + let x_37 : f32 = gl_FragCoord.y; + if ((x_37 < 0.0)) { + let x_42 : f32 = gl_FragCoord.x; + if ((x_42 < 0.0)) { + x_GLF_color = vec4(226.695999146, 1.0, 1.0, 1.0); + } + continue; + } + return; + + continuing { + let x_7 : i32 = i; + i = (x_7 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl new file mode 100644 index 0000000000..869d8a9365 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl @@ -0,0 +1,43 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var i : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 1; + loop { + let x_6 : i32 = i; + if ((x_6 < 2)) { + } else { + break; + } + let x_37 : f32 = gl_FragCoord.y; + if ((x_37 < 0.0)) { + let x_42 : f32 = gl_FragCoord.x; + if ((x_42 < 0.0)) { + x_GLF_color = vec4(226.695999146, 1.0, 1.0, 1.0); + } + continue; + } + return; + + continuing { + let x_7 : i32 = i; + i = (x_7 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2d3183d477 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.hlsl @@ -0,0 +1,41 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 1; + { + for(; (i < 2); i = (i + 1)) { + const float x_37 = gl_FragCoord.y; + if ((x_37 < 0.0f)) { + const float x_42 = gl_FragCoord.x; + if ((x_42 < 0.0f)) { + x_GLF_color = float4(226.695999146f, 1.0f, 1.0f, 1.0f); + } + continue; + } + return; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d32227c0dd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.msl @@ -0,0 +1,51 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 1; + while (true) { + int const x_6 = i; + if ((x_6 < 2)) { + } else { + break; + } + float const x_37 = (*(tint_symbol_6)).y; + if ((x_37 < 0.0f)) { + float const x_42 = (*(tint_symbol_6)).x; + if ((x_42 < 0.0f)) { + *(tint_symbol_5) = float4(226.695999146f, 1.0f, 1.0f, 1.0f); + } + { + int const x_7 = i; + i = (x_7 + 1); + } + continue; + } + return; + { + int const x_7 = i; + i = (x_7 + 1); + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..42a7dcde1e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.spvasm @@ -0,0 +1,114 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 +%float_226_695999 = OpConstant %float 226.695999 + %49 = OpConstantComposite %v4float %float_226_695999 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %52 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %i = OpVariable %_ptr_Function_int Function %18 + OpStore %x_GLF_color %21 + OpStore %i %int_1 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %27 = OpLoad %int %i + %29 = OpSLessThan %bool %27 %int_2 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpBranch %24 + %31 = OpLabel + %37 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %38 = OpLoad %float %37 + %39 = OpFOrdLessThan %bool %38 %float_0 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + %43 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %44 = OpLoad %float %43 + %45 = OpFOrdLessThan %bool %44 %float_0 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + OpStore %x_GLF_color %49 + OpBranch %46 + %46 = OpLabel + OpBranch %25 + %40 = OpLabel + OpReturn + %25 = OpLabel + %50 = OpLoad %int %i + %51 = OpIAdd %int %50 %int_1 + OpStore %i %51 + OpBranch %23 + %24 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %52 +%tint_symbol_1 = OpFunctionParameter %main_out + %56 = OpLabel + %57 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %57 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %59 = OpLabel + %60 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %60 + %61 = OpFunctionCall %void %main_1 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpCompositeConstruct %main_out %63 + %62 = OpFunctionCall %void %tint_symbol_3 %64 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..869d8a9365 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/for-with-ifs-and-return/0-opt.wgsl.expected.wgsl @@ -0,0 +1,43 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var i : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 1; + loop { + let x_6 : i32 = i; + if ((x_6 < 2)) { + } else { + break; + } + let x_37 : f32 = gl_FragCoord.y; + if ((x_37 < 0.0)) { + let x_42 : f32 = gl_FragCoord.x; + if ((x_42 < 0.0)) { + x_GLF_color = vec4(226.695999146, 1.0, 1.0, 1.0); + } + continue; + } + return; + + continuing { + let x_7 : i32 = i; + i = (x_7 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm new file mode 100644 index 0000000000..64350346a0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm @@ -0,0 +1,206 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %alwaysZero_vf2_ "alwaysZero(vf2;" + OpName %coord "coord" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %b "b" + OpName %gl_FragCoord "gl_FragCoord" + OpName %zero "zero" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpName %temp "temp" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %20 = OpTypeFunction %int %_ptr_Function_v2float +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %float_50 = OpConstant %float 50 + %bool = OpTypeBool + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %37 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float + %uint_2 = OpConstant %uint 2 + %false = OpConstantFalse %bool + %main = OpFunction %void None %15 + %42 = OpLabel + %43 = OpVariable %_ptr_Function_float Function + %44 = OpVariable %_ptr_Function_float Function + %45 = OpVariable %_ptr_Function_float Function + %46 = OpVariable %_ptr_Function_int Function + %zero = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_v2float Function + %temp = OpVariable %_ptr_Function_v2float Function + %47 = OpLoad %v4float %gl_FragCoord + %48 = OpVectorShuffle %v2float %47 %47 0 1 + OpStore %param %48 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpAccessChain %_ptr_Function_float %param %uint_1 + %54 = OpLoad %float %53 + %55 = OpFOrdLessThan %bool %54 %float_50 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %60 = OpLoad %float %59 + OpStore %44 %60 + OpBranch %56 + %58 = OpLabel + OpStore %44 %float_0 + OpBranch %56 + %56 = OpLabel + %61 = OpLoad %float %44 + OpStore %43 %61 + %62 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %63 = OpLoad %float %62 + %64 = OpFOrdLessThan %bool %63 %float_50 + %65 = OpSelect %float %64 %float_1 %float_0 + OpStore %45 %65 + %66 = OpFSub %float %61 %65 + %67 = OpFOrdLessThan %bool %66 %float_1 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + OpStore %46 %int_0 + OpBranch %50 + %68 = OpLabel + OpStore %46 %int_1 + OpBranch %50 + %51 = OpLabel + OpBranchConditional %false %49 %50 + %50 = OpLabel + %70 = OpLoad %int %46 + OpStore %zero %70 + %71 = OpIEqual %bool %70 %int_1 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + OpReturn + %72 = OpLabel + OpStore %_GLF_color %37 + %74 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %77 = OpLoad %float %76 + %78 = OpFOrdGreaterThanEqual %bool %75 %77 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + %81 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %82 = OpLoad %float %81 + %83 = OpFOrdGreaterThanEqual %bool %82 %float_0 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %84 + %85 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_0 + OpStore %88 %87 + OpBranch %84 + %84 = OpLabel + OpBranch %79 + %79 = OpLabel + %89 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %90 = OpLoad %float %89 + %91 = OpFOrdGreaterThanEqual %bool %90 %float_0 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %92 + %93 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %95 = OpLoad %float %94 + %96 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_1 + OpStore %96 %95 + OpBranch %92 + %92 = OpLabel + %97 = OpLoad %v4float %gl_FragCoord + %98 = OpVectorShuffle %v2float %97 %97 0 1 + %99 = OpCompositeExtract %float %98 0 + %100 = OpCompositeExtract %float %98 1 + %101 = OpCompositeConstruct %v2float %99 %100 + OpStore %temp %101 + %102 = OpCompositeExtract %float %101 1 + %103 = OpFOrdGreaterThanEqual %bool %102 %float_0 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %107 = OpLoad %float %106 + %108 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_2 + OpStore %108 %107 + OpBranch %104 + %104 = OpLabel + OpReturn + OpFunctionEnd +%alwaysZero_vf2_ = OpFunction %int None %20 + %coord = OpFunctionParameter %_ptr_Function_v2float + %109 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %110 = OpVariable %_ptr_Function_float Function + %b = OpVariable %_ptr_Function_float Function + %111 = OpAccessChain %_ptr_Function_float %coord %uint_1 + %112 = OpLoad %float %111 + %113 = OpFOrdLessThan %bool %112 %float_50 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %116 + %115 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %118 = OpLoad %float %117 + OpStore %110 %118 + OpBranch %114 + %116 = OpLabel + OpStore %110 %float_0 + OpBranch %114 + %114 = OpLabel + %119 = OpLoad %float %110 + OpStore %a %119 + %120 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %121 = OpLoad %float %120 + %122 = OpFOrdLessThan %bool %121 %float_50 + %123 = OpSelect %float %122 %float_1 %float_0 + OpStore %b %123 + %124 = OpFSub %float %119 %123 + %125 = OpFOrdLessThan %bool %124 %float_1 + OpSelectionMerge %126 None + OpBranchConditional %125 %127 %126 + %127 = OpLabel + OpReturnValue %int_0 + %126 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3bb430f9a1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.hlsl @@ -0,0 +1,113 @@ +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float x_43 = 0.0f; + float x_44 = 0.0f; + float x_45 = 0.0f; + int x_46 = 0; + int zero = 0; + float2 param = float2(0.0f, 0.0f); + float2 temp = float2(0.0f, 0.0f); + const float4 x_47 = gl_FragCoord; + param = float2(x_47.x, x_47.y); + while (true) { + const float x_54 = param.y; + if ((x_54 < 50.0f)) { + const float x_60 = asfloat(x_9[0].y); + x_44 = x_60; + } else { + x_44 = 0.0f; + } + const float x_61 = x_44; + x_43 = x_61; + const float x_63 = gl_FragCoord.y; + const float x_65 = ((x_63 < 50.0f) ? 1.0f : 0.0f); + x_45 = x_65; + if (((x_61 - x_65) < 1.0f)) { + x_46 = 0; + break; + } + x_46 = 1; + break; + { + if (false) { + } else { + break; + } + } + } + const int x_70 = x_46; + zero = x_70; + if ((x_70 == 1)) { + return; + } + x_GLF_color = float4(0.0f, 1.0f, 1.0f, 1.0f); + const float x_75 = gl_FragCoord.x; + const float x_77 = asfloat(x_9[0].x); + if ((x_75 >= x_77)) { + const float x_82 = gl_FragCoord.y; + if ((x_82 >= 0.0f)) { + const float x_87 = asfloat(x_9[0].y); + x_GLF_color.x = x_87; + } + } + const float x_90 = gl_FragCoord.y; + if ((x_90 >= 0.0f)) { + const float x_95 = asfloat(x_9[0].x); + x_GLF_color.y = x_95; + } + const float4 x_97 = gl_FragCoord; + const float2 x_98 = float2(x_97.x, x_97.y); + const float2 x_101 = float2(x_98.x, x_98.y); + temp = x_101; + if ((x_101.y >= 0.0f)) { + const float x_107 = asfloat(x_9[0].x); + x_GLF_color.z = x_107; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + +int alwaysZero_vf2_(inout float2 coord) { + float a = 0.0f; + float x_110 = 0.0f; + float b = 0.0f; + const float x_112 = coord.y; + if ((x_112 < 50.0f)) { + const float x_118 = asfloat(x_9[0].y); + x_110 = x_118; + } else { + x_110 = 0.0f; + } + const float x_119 = x_110; + a = x_119; + const float x_121 = gl_FragCoord.y; + const float x_123 = ((x_121 < 50.0f) ? 1.0f : 0.0f); + b = x_123; + if (((x_119 - x_123) < 1.0f)) { + return 0; + } + return 1; +} diff --git a/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..01561c4427 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float x_43 = 0.0f; + float x_44 = 0.0f; + float x_45 = 0.0f; + int x_46 = 0; + int zero = 0; + float2 param = 0.0f; + float2 temp = 0.0f; + float4 const x_47 = *(tint_symbol_5); + param = float2(x_47.x, x_47.y); + while (true) { + float const x_54 = param.y; + if ((x_54 < 50.0f)) { + float const x_60 = x_9.injectionSwitch.y; + x_44 = x_60; + } else { + x_44 = 0.0f; + } + float const x_61 = x_44; + x_43 = x_61; + float const x_63 = (*(tint_symbol_5)).y; + float const x_65 = select(0.0f, 1.0f, (x_63 < 50.0f)); + x_45 = x_65; + if (((x_61 - x_65) < 1.0f)) { + x_46 = 0; + break; + } + x_46 = 1; + break; + { + if (false) { + } else { + break; + } + } + } + int const x_70 = x_46; + zero = x_70; + if ((x_70 == 1)) { + return; + } + *(tint_symbol_6) = float4(0.0f, 1.0f, 1.0f, 1.0f); + float const x_75 = (*(tint_symbol_5)).x; + float const x_77 = x_9.injectionSwitch.x; + if ((x_75 >= x_77)) { + float const x_82 = (*(tint_symbol_5)).y; + if ((x_82 >= 0.0f)) { + float const x_87 = x_9.injectionSwitch.y; + (*(tint_symbol_6)).x = x_87; + } + } + float const x_90 = (*(tint_symbol_5)).y; + if ((x_90 >= 0.0f)) { + float const x_95 = x_9.injectionSwitch.x; + (*(tint_symbol_6)).y = x_95; + } + float4 const x_97 = *(tint_symbol_5); + float2 const x_98 = float2(x_97.x, x_97.y); + float2 const x_101 = float2(x_98.x, x_98.y); + temp = x_101; + if ((x_101.y >= 0.0f)) { + float const x_107 = x_9.injectionSwitch.x; + (*(tint_symbol_6)).z = x_107; + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_9, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +int alwaysZero_vf2_(constant buf0& x_9, thread float2* const coord, thread float4* const tint_symbol_9) { + float a = 0.0f; + float x_110 = 0.0f; + float b = 0.0f; + float const x_112 = (*(coord)).y; + if ((x_112 < 50.0f)) { + float const x_118 = x_9.injectionSwitch.y; + x_110 = x_118; + } else { + x_110 = 0.0f; + } + float const x_119 = x_110; + a = x_119; + float const x_121 = (*(tint_symbol_9)).y; + float const x_123 = select(0.0f, 1.0f, (x_121 < 50.0f)); + b = x_123; + if (((x_119 - x_123) < 1.0f)) { + return 0; + } + return 1; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..7cdda6c7d3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.spvasm @@ -0,0 +1,259 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 154 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_43 "x_43" + OpName %x_44 "x_44" + OpName %x_45 "x_45" + OpName %x_46 "x_46" + OpName %zero "zero" + OpName %param "param" + OpName %temp "temp" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpName %alwaysZero_vf2_ "alwaysZero_vf2_" + OpName %coord "coord" + OpName %a "a" + OpName %x_110 "x_110" + OpName %b "b" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int +%_ptr_Function_v2float = OpTypePointer Function %v2float + %31 = OpConstantNull %v2float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %float_50 = OpConstant %float 50 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_1 = OpConstant %float 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %77 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %uint_2 = OpConstant %uint 2 + %main_out = OpTypeStruct %v4float + %116 = OpTypeFunction %void %main_out + %129 = OpTypeFunction %int %_ptr_Function_v2float + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_43 = OpVariable %_ptr_Function_float Function %21 + %x_44 = OpVariable %_ptr_Function_float Function %21 + %x_45 = OpVariable %_ptr_Function_float Function %21 + %x_46 = OpVariable %_ptr_Function_int Function %27 + %zero = OpVariable %_ptr_Function_int Function %27 + %param = OpVariable %_ptr_Function_v2float Function %31 + %temp = OpVariable %_ptr_Function_v2float Function %31 + %33 = OpLoad %v4float %gl_FragCoord + %34 = OpCompositeExtract %float %33 0 + %35 = OpCompositeExtract %float %33 1 + %36 = OpCompositeConstruct %v2float %34 %35 + OpStore %param %36 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %43 = OpAccessChain %_ptr_Function_float %param %uint_1 + %44 = OpLoad %float %43 + %46 = OpFOrdLessThan %bool %44 %float_50 + OpSelectionMerge %48 None + OpBranchConditional %46 %49 %50 + %49 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %54 = OpLoad %float %53 + OpStore %x_44 %54 + OpBranch %48 + %50 = OpLabel + OpStore %x_44 %float_0 + OpBranch %48 + %48 = OpLabel + %56 = OpLoad %float %x_44 + OpStore %x_43 %56 + %58 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %59 = OpLoad %float %58 + %61 = OpFOrdLessThan %bool %59 %float_50 + %60 = OpSelect %float %61 %float_1 %float_0 + OpStore %x_45 %60 + %63 = OpFSub %float %56 %60 + %64 = OpFOrdLessThan %bool %63 %float_1 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + OpStore %x_46 %int_0 + OpBranch %38 + %65 = OpLabel + OpStore %x_46 %int_1 + OpBranch %38 + %39 = OpLabel + OpSelectionMerge %70 None + OpBranchConditional %false %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %38 + %70 = OpLabel + OpBranch %37 + %38 = OpLabel + %73 = OpLoad %int %x_46 + OpStore %zero %73 + %74 = OpIEqual %bool %73 %int_1 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + OpReturn + %75 = OpLabel + OpStore %x_GLF_color %77 + %78 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %81 = OpLoad %float %80 + %82 = OpFOrdGreaterThanEqual %bool %79 %81 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + %85 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %86 = OpLoad %float %85 + %87 = OpFOrdGreaterThanEqual %bool %86 %float_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + OpStore %92 %91 + OpBranch %88 + %88 = OpLabel + OpBranch %83 + %83 = OpLabel + %93 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %94 = OpLoad %float %93 + %95 = OpFOrdGreaterThanEqual %bool %94 %float_0 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %96 + %97 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + OpStore %100 %99 + OpBranch %96 + %96 = OpLabel + %101 = OpLoad %v4float %gl_FragCoord + %102 = OpCompositeExtract %float %101 0 + %103 = OpCompositeExtract %float %101 1 + %104 = OpCompositeConstruct %v2float %102 %103 + %105 = OpCompositeExtract %float %104 0 + %106 = OpCompositeExtract %float %104 1 + %107 = OpCompositeConstruct %v2float %105 %106 + OpStore %temp %107 + %108 = OpCompositeExtract %float %107 1 + %109 = OpFOrdGreaterThanEqual %bool %108 %float_0 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %113 = OpLoad %float %112 + %115 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_2 + OpStore %115 %113 + OpBranch %110 + %110 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %116 +%tint_symbol_1 = OpFunctionParameter %main_out + %120 = OpLabel + %121 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %121 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %123 = OpLabel + %124 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %124 + %125 = OpFunctionCall %void %main_1 + %127 = OpLoad %v4float %x_GLF_color + %128 = OpCompositeConstruct %main_out %127 + %126 = OpFunctionCall %void %tint_symbol_3 %128 + OpReturn + OpFunctionEnd +%alwaysZero_vf2_ = OpFunction %int None %129 + %coord = OpFunctionParameter %_ptr_Function_v2float + %132 = OpLabel + %a = OpVariable %_ptr_Function_float Function %21 + %x_110 = OpVariable %_ptr_Function_float Function %21 + %b = OpVariable %_ptr_Function_float Function %21 + %137 = OpAccessChain %_ptr_Function_float %coord %uint_1 + %138 = OpLoad %float %137 + %139 = OpFOrdLessThan %bool %138 %float_50 + OpSelectionMerge %140 None + OpBranchConditional %139 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %144 = OpLoad %float %143 + OpStore %x_110 %144 + OpBranch %140 + %142 = OpLabel + OpStore %x_110 %float_0 + OpBranch %140 + %140 = OpLabel + %145 = OpLoad %float %x_110 + OpStore %a %145 + %146 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %147 = OpLoad %float %146 + %149 = OpFOrdLessThan %bool %147 %float_50 + %148 = OpSelect %float %149 %float_1 %float_0 + OpStore %b %148 + %150 = OpFSub %float %145 %148 + %151 = OpFOrdLessThan %bool %150 %float_1 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %152 + %153 = OpLabel + OpReturnValue %int_0 + %152 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f94238da58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.spvasm.expected.wgsl @@ -0,0 +1,112 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var x_43 : f32; + var x_44 : f32; + var x_45 : f32; + var x_46 : i32; + var zero : i32; + var param : vec2; + var temp : vec2; + let x_47 : vec4 = gl_FragCoord; + param = vec2(x_47.x, x_47.y); + loop { + let x_54 : f32 = param.y; + if ((x_54 < 50.0)) { + let x_60 : f32 = x_9.injectionSwitch.y; + x_44 = x_60; + } else { + x_44 = 0.0; + } + let x_61 : f32 = x_44; + x_43 = x_61; + let x_63 : f32 = gl_FragCoord.y; + let x_65 : f32 = select(0.0, 1.0, (x_63 < 50.0)); + x_45 = x_65; + if (((x_61 - x_65) < 1.0)) { + x_46 = 0; + break; + } + x_46 = 1; + break; + + continuing { + if (false) { + } else { + break; + } + } + } + let x_70 : i32 = x_46; + zero = x_70; + if ((x_70 == 1)) { + return; + } + x_GLF_color = vec4(0.0, 1.0, 1.0, 1.0); + let x_75 : f32 = gl_FragCoord.x; + let x_77 : f32 = x_9.injectionSwitch.x; + if ((x_75 >= x_77)) { + let x_82 : f32 = gl_FragCoord.y; + if ((x_82 >= 0.0)) { + let x_87 : f32 = x_9.injectionSwitch.y; + x_GLF_color.x = x_87; + } + } + let x_90 : f32 = gl_FragCoord.y; + if ((x_90 >= 0.0)) { + let x_95 : f32 = x_9.injectionSwitch.x; + x_GLF_color.y = x_95; + } + let x_97 : vec4 = gl_FragCoord; + let x_98 : vec2 = vec2(x_97.x, x_97.y); + let x_101 : vec2 = vec2(x_98.x, x_98.y); + temp = x_101; + if ((x_101.y >= 0.0)) { + let x_107 : f32 = x_9.injectionSwitch.x; + x_GLF_color.z = x_107; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} + +fn alwaysZero_vf2_(coord : ptr>) -> i32 { + var a : f32; + var x_110 : f32; + var b : f32; + let x_112 : f32 = (*(coord)).y; + if ((x_112 < 50.0)) { + let x_118 : f32 = x_9.injectionSwitch.y; + x_110 = x_118; + } else { + x_110 = 0.0; + } + let x_119 : f32 = x_110; + a = x_119; + let x_121 : f32 = gl_FragCoord.y; + let x_123 : f32 = select(0.0, 1.0, (x_121 < 50.0)); + b = x_123; + if (((x_119 - x_123) < 1.0)) { + return 0; + } + return 1; +} diff --git a/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl new file mode 100644 index 0000000000..f94238da58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl @@ -0,0 +1,112 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var x_43 : f32; + var x_44 : f32; + var x_45 : f32; + var x_46 : i32; + var zero : i32; + var param : vec2; + var temp : vec2; + let x_47 : vec4 = gl_FragCoord; + param = vec2(x_47.x, x_47.y); + loop { + let x_54 : f32 = param.y; + if ((x_54 < 50.0)) { + let x_60 : f32 = x_9.injectionSwitch.y; + x_44 = x_60; + } else { + x_44 = 0.0; + } + let x_61 : f32 = x_44; + x_43 = x_61; + let x_63 : f32 = gl_FragCoord.y; + let x_65 : f32 = select(0.0, 1.0, (x_63 < 50.0)); + x_45 = x_65; + if (((x_61 - x_65) < 1.0)) { + x_46 = 0; + break; + } + x_46 = 1; + break; + + continuing { + if (false) { + } else { + break; + } + } + } + let x_70 : i32 = x_46; + zero = x_70; + if ((x_70 == 1)) { + return; + } + x_GLF_color = vec4(0.0, 1.0, 1.0, 1.0); + let x_75 : f32 = gl_FragCoord.x; + let x_77 : f32 = x_9.injectionSwitch.x; + if ((x_75 >= x_77)) { + let x_82 : f32 = gl_FragCoord.y; + if ((x_82 >= 0.0)) { + let x_87 : f32 = x_9.injectionSwitch.y; + x_GLF_color.x = x_87; + } + } + let x_90 : f32 = gl_FragCoord.y; + if ((x_90 >= 0.0)) { + let x_95 : f32 = x_9.injectionSwitch.x; + x_GLF_color.y = x_95; + } + let x_97 : vec4 = gl_FragCoord; + let x_98 : vec2 = vec2(x_97.x, x_97.y); + let x_101 : vec2 = vec2(x_98.x, x_98.y); + temp = x_101; + if ((x_101.y >= 0.0)) { + let x_107 : f32 = x_9.injectionSwitch.x; + x_GLF_color.z = x_107; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} + +fn alwaysZero_vf2_(coord : ptr>) -> i32 { + var a : f32; + var x_110 : f32; + var b : f32; + let x_112 : f32 = (*(coord)).y; + if ((x_112 < 50.0)) { + let x_118 : f32 = x_9.injectionSwitch.y; + x_110 = x_118; + } else { + x_110 = 0.0; + } + let x_119 : f32 = x_110; + a = x_119; + let x_121 : f32 = gl_FragCoord.y; + let x_123 : f32 = select(0.0, 1.0, (x_121 < 50.0)); + b = x_123; + if (((x_119 - x_123) < 1.0)) { + return 0; + } + return 1; +} diff --git a/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3bb430f9a1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.hlsl @@ -0,0 +1,113 @@ +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float x_43 = 0.0f; + float x_44 = 0.0f; + float x_45 = 0.0f; + int x_46 = 0; + int zero = 0; + float2 param = float2(0.0f, 0.0f); + float2 temp = float2(0.0f, 0.0f); + const float4 x_47 = gl_FragCoord; + param = float2(x_47.x, x_47.y); + while (true) { + const float x_54 = param.y; + if ((x_54 < 50.0f)) { + const float x_60 = asfloat(x_9[0].y); + x_44 = x_60; + } else { + x_44 = 0.0f; + } + const float x_61 = x_44; + x_43 = x_61; + const float x_63 = gl_FragCoord.y; + const float x_65 = ((x_63 < 50.0f) ? 1.0f : 0.0f); + x_45 = x_65; + if (((x_61 - x_65) < 1.0f)) { + x_46 = 0; + break; + } + x_46 = 1; + break; + { + if (false) { + } else { + break; + } + } + } + const int x_70 = x_46; + zero = x_70; + if ((x_70 == 1)) { + return; + } + x_GLF_color = float4(0.0f, 1.0f, 1.0f, 1.0f); + const float x_75 = gl_FragCoord.x; + const float x_77 = asfloat(x_9[0].x); + if ((x_75 >= x_77)) { + const float x_82 = gl_FragCoord.y; + if ((x_82 >= 0.0f)) { + const float x_87 = asfloat(x_9[0].y); + x_GLF_color.x = x_87; + } + } + const float x_90 = gl_FragCoord.y; + if ((x_90 >= 0.0f)) { + const float x_95 = asfloat(x_9[0].x); + x_GLF_color.y = x_95; + } + const float4 x_97 = gl_FragCoord; + const float2 x_98 = float2(x_97.x, x_97.y); + const float2 x_101 = float2(x_98.x, x_98.y); + temp = x_101; + if ((x_101.y >= 0.0f)) { + const float x_107 = asfloat(x_9[0].x); + x_GLF_color.z = x_107; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + +int alwaysZero_vf2_(inout float2 coord) { + float a = 0.0f; + float x_110 = 0.0f; + float b = 0.0f; + const float x_112 = coord.y; + if ((x_112 < 50.0f)) { + const float x_118 = asfloat(x_9[0].y); + x_110 = x_118; + } else { + x_110 = 0.0f; + } + const float x_119 = x_110; + a = x_119; + const float x_121 = gl_FragCoord.y; + const float x_123 = ((x_121 < 50.0f) ? 1.0f : 0.0f); + b = x_123; + if (((x_119 - x_123) < 1.0f)) { + return 0; + } + return 1; +} diff --git a/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..01561c4427 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_9, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float x_43 = 0.0f; + float x_44 = 0.0f; + float x_45 = 0.0f; + int x_46 = 0; + int zero = 0; + float2 param = 0.0f; + float2 temp = 0.0f; + float4 const x_47 = *(tint_symbol_5); + param = float2(x_47.x, x_47.y); + while (true) { + float const x_54 = param.y; + if ((x_54 < 50.0f)) { + float const x_60 = x_9.injectionSwitch.y; + x_44 = x_60; + } else { + x_44 = 0.0f; + } + float const x_61 = x_44; + x_43 = x_61; + float const x_63 = (*(tint_symbol_5)).y; + float const x_65 = select(0.0f, 1.0f, (x_63 < 50.0f)); + x_45 = x_65; + if (((x_61 - x_65) < 1.0f)) { + x_46 = 0; + break; + } + x_46 = 1; + break; + { + if (false) { + } else { + break; + } + } + } + int const x_70 = x_46; + zero = x_70; + if ((x_70 == 1)) { + return; + } + *(tint_symbol_6) = float4(0.0f, 1.0f, 1.0f, 1.0f); + float const x_75 = (*(tint_symbol_5)).x; + float const x_77 = x_9.injectionSwitch.x; + if ((x_75 >= x_77)) { + float const x_82 = (*(tint_symbol_5)).y; + if ((x_82 >= 0.0f)) { + float const x_87 = x_9.injectionSwitch.y; + (*(tint_symbol_6)).x = x_87; + } + } + float const x_90 = (*(tint_symbol_5)).y; + if ((x_90 >= 0.0f)) { + float const x_95 = x_9.injectionSwitch.x; + (*(tint_symbol_6)).y = x_95; + } + float4 const x_97 = *(tint_symbol_5); + float2 const x_98 = float2(x_97.x, x_97.y); + float2 const x_101 = float2(x_98.x, x_98.y); + temp = x_101; + if ((x_101.y >= 0.0f)) { + float const x_107 = x_9.injectionSwitch.x; + (*(tint_symbol_6)).z = x_107; + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_9, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +int alwaysZero_vf2_(constant buf0& x_9, thread float2* const coord, thread float4* const tint_symbol_9) { + float a = 0.0f; + float x_110 = 0.0f; + float b = 0.0f; + float const x_112 = (*(coord)).y; + if ((x_112 < 50.0f)) { + float const x_118 = x_9.injectionSwitch.y; + x_110 = x_118; + } else { + x_110 = 0.0f; + } + float const x_119 = x_110; + a = x_119; + float const x_121 = (*(tint_symbol_9)).y; + float const x_123 = select(0.0f, 1.0f, (x_121 < 50.0f)); + b = x_123; + if (((x_119 - x_123) < 1.0f)) { + return 0; + } + return 1; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..7cdda6c7d3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.spvasm @@ -0,0 +1,259 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 154 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_43 "x_43" + OpName %x_44 "x_44" + OpName %x_45 "x_45" + OpName %x_46 "x_46" + OpName %zero "zero" + OpName %param "param" + OpName %temp "temp" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpName %alwaysZero_vf2_ "alwaysZero_vf2_" + OpName %coord "coord" + OpName %a "a" + OpName %x_110 "x_110" + OpName %b "b" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int +%_ptr_Function_v2float = OpTypePointer Function %v2float + %31 = OpConstantNull %v2float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %float_50 = OpConstant %float 50 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_1 = OpConstant %float 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %77 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %uint_2 = OpConstant %uint 2 + %main_out = OpTypeStruct %v4float + %116 = OpTypeFunction %void %main_out + %129 = OpTypeFunction %int %_ptr_Function_v2float + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_43 = OpVariable %_ptr_Function_float Function %21 + %x_44 = OpVariable %_ptr_Function_float Function %21 + %x_45 = OpVariable %_ptr_Function_float Function %21 + %x_46 = OpVariable %_ptr_Function_int Function %27 + %zero = OpVariable %_ptr_Function_int Function %27 + %param = OpVariable %_ptr_Function_v2float Function %31 + %temp = OpVariable %_ptr_Function_v2float Function %31 + %33 = OpLoad %v4float %gl_FragCoord + %34 = OpCompositeExtract %float %33 0 + %35 = OpCompositeExtract %float %33 1 + %36 = OpCompositeConstruct %v2float %34 %35 + OpStore %param %36 + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %43 = OpAccessChain %_ptr_Function_float %param %uint_1 + %44 = OpLoad %float %43 + %46 = OpFOrdLessThan %bool %44 %float_50 + OpSelectionMerge %48 None + OpBranchConditional %46 %49 %50 + %49 = OpLabel + %53 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %54 = OpLoad %float %53 + OpStore %x_44 %54 + OpBranch %48 + %50 = OpLabel + OpStore %x_44 %float_0 + OpBranch %48 + %48 = OpLabel + %56 = OpLoad %float %x_44 + OpStore %x_43 %56 + %58 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %59 = OpLoad %float %58 + %61 = OpFOrdLessThan %bool %59 %float_50 + %60 = OpSelect %float %61 %float_1 %float_0 + OpStore %x_45 %60 + %63 = OpFSub %float %56 %60 + %64 = OpFOrdLessThan %bool %63 %float_1 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + OpStore %x_46 %int_0 + OpBranch %38 + %65 = OpLabel + OpStore %x_46 %int_1 + OpBranch %38 + %39 = OpLabel + OpSelectionMerge %70 None + OpBranchConditional %false %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %38 + %70 = OpLabel + OpBranch %37 + %38 = OpLabel + %73 = OpLoad %int %x_46 + OpStore %zero %73 + %74 = OpIEqual %bool %73 %int_1 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + OpReturn + %75 = OpLabel + OpStore %x_GLF_color %77 + %78 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %81 = OpLoad %float %80 + %82 = OpFOrdGreaterThanEqual %bool %79 %81 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + %85 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %86 = OpLoad %float %85 + %87 = OpFOrdGreaterThanEqual %bool %86 %float_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + OpStore %92 %91 + OpBranch %88 + %88 = OpLabel + OpBranch %83 + %83 = OpLabel + %93 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %94 = OpLoad %float %93 + %95 = OpFOrdGreaterThanEqual %bool %94 %float_0 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %96 + %97 = OpLabel + %98 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_1 + OpStore %100 %99 + OpBranch %96 + %96 = OpLabel + %101 = OpLoad %v4float %gl_FragCoord + %102 = OpCompositeExtract %float %101 0 + %103 = OpCompositeExtract %float %101 1 + %104 = OpCompositeConstruct %v2float %102 %103 + %105 = OpCompositeExtract %float %104 0 + %106 = OpCompositeExtract %float %104 1 + %107 = OpCompositeConstruct %v2float %105 %106 + OpStore %temp %107 + %108 = OpCompositeExtract %float %107 1 + %109 = OpFOrdGreaterThanEqual %bool %108 %float_0 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %113 = OpLoad %float %112 + %115 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_2 + OpStore %115 %113 + OpBranch %110 + %110 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %116 +%tint_symbol_1 = OpFunctionParameter %main_out + %120 = OpLabel + %121 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %121 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %123 = OpLabel + %124 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %124 + %125 = OpFunctionCall %void %main_1 + %127 = OpLoad %v4float %x_GLF_color + %128 = OpCompositeConstruct %main_out %127 + %126 = OpFunctionCall %void %tint_symbol_3 %128 + OpReturn + OpFunctionEnd +%alwaysZero_vf2_ = OpFunction %int None %129 + %coord = OpFunctionParameter %_ptr_Function_v2float + %132 = OpLabel + %a = OpVariable %_ptr_Function_float Function %21 + %x_110 = OpVariable %_ptr_Function_float Function %21 + %b = OpVariable %_ptr_Function_float Function %21 + %137 = OpAccessChain %_ptr_Function_float %coord %uint_1 + %138 = OpLoad %float %137 + %139 = OpFOrdLessThan %bool %138 %float_50 + OpSelectionMerge %140 None + OpBranchConditional %139 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %144 = OpLoad %float %143 + OpStore %x_110 %144 + OpBranch %140 + %142 = OpLabel + OpStore %x_110 %float_0 + OpBranch %140 + %140 = OpLabel + %145 = OpLoad %float %x_110 + OpStore %a %145 + %146 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %147 = OpLoad %float %146 + %149 = OpFOrdLessThan %bool %147 %float_50 + %148 = OpSelect %float %149 %float_1 %float_0 + OpStore %b %148 + %150 = OpFSub %float %145 %148 + %151 = OpFOrdLessThan %bool %150 %float_1 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %152 + %153 = OpLabel + OpReturnValue %int_0 + %152 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f94238da58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/frag-coord-func-call-and-ifs/0-opt.wgsl.expected.wgsl @@ -0,0 +1,112 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var x_43 : f32; + var x_44 : f32; + var x_45 : f32; + var x_46 : i32; + var zero : i32; + var param : vec2; + var temp : vec2; + let x_47 : vec4 = gl_FragCoord; + param = vec2(x_47.x, x_47.y); + loop { + let x_54 : f32 = param.y; + if ((x_54 < 50.0)) { + let x_60 : f32 = x_9.injectionSwitch.y; + x_44 = x_60; + } else { + x_44 = 0.0; + } + let x_61 : f32 = x_44; + x_43 = x_61; + let x_63 : f32 = gl_FragCoord.y; + let x_65 : f32 = select(0.0, 1.0, (x_63 < 50.0)); + x_45 = x_65; + if (((x_61 - x_65) < 1.0)) { + x_46 = 0; + break; + } + x_46 = 1; + break; + + continuing { + if (false) { + } else { + break; + } + } + } + let x_70 : i32 = x_46; + zero = x_70; + if ((x_70 == 1)) { + return; + } + x_GLF_color = vec4(0.0, 1.0, 1.0, 1.0); + let x_75 : f32 = gl_FragCoord.x; + let x_77 : f32 = x_9.injectionSwitch.x; + if ((x_75 >= x_77)) { + let x_82 : f32 = gl_FragCoord.y; + if ((x_82 >= 0.0)) { + let x_87 : f32 = x_9.injectionSwitch.y; + x_GLF_color.x = x_87; + } + } + let x_90 : f32 = gl_FragCoord.y; + if ((x_90 >= 0.0)) { + let x_95 : f32 = x_9.injectionSwitch.x; + x_GLF_color.y = x_95; + } + let x_97 : vec4 = gl_FragCoord; + let x_98 : vec2 = vec2(x_97.x, x_97.y); + let x_101 : vec2 = vec2(x_98.x, x_98.y); + temp = x_101; + if ((x_101.y >= 0.0)) { + let x_107 : f32 = x_9.injectionSwitch.x; + x_GLF_color.z = x_107; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} + +fn alwaysZero_vf2_(coord : ptr>) -> i32 { + var a : f32; + var x_110 : f32; + var b : f32; + let x_112 : f32 = (*(coord)).y; + if ((x_112 < 50.0)) { + let x_118 : f32 = x_9.injectionSwitch.y; + x_110 = x_118; + } else { + x_110 = 0.0; + } + let x_119 : f32 = x_110; + a = x_119; + let x_121 : f32 = gl_FragCoord.y; + let x_123 : f32 = select(0.0, 1.0, (x_121 < 50.0)); + b = x_123; + if (((x_119 - x_123) < 1.0)) { + return 0; + } + return 1; +} diff --git a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm new file mode 100644 index 0000000000..496c8d3243 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm @@ -0,0 +1,108 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %fx_ "fx(" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %x2 "x2" + OpName %B "B" + OpName %k0 "k0" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %14 = OpTypeFunction %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %30 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_float = OpTypePointer Function %float + %float_2 = OpConstant %float 2 + %main = OpFunction %void None %12 + %33 = OpLabel + %x2 = OpVariable %_ptr_Function_float Function + %B = OpVariable %_ptr_Function_float Function + %k0 = OpVariable %_ptr_Function_float Function + OpStore %x2 %float_1 + OpStore %B %float_1 + %34 = OpFunctionCall %float %fx_ + %35 = OpCompositeConstruct %v4float %34 %float_0 %float_0 %float_1 + OpStore %_GLF_color %35 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %float %x2 + %41 = OpFOrdGreaterThan %bool %40 %float_2 + OpBranchConditional %41 %42 %37 + %42 = OpLabel + %43 = OpFunctionCall %float %fx_ + %44 = OpFunctionCall %float %fx_ + %45 = OpFSub %float %43 %44 + OpStore %k0 %45 + %46 = OpLoad %float %k0 + OpStore %B %46 + %47 = OpLoad %float %B + OpStore %x2 %47 + OpBranch %38 + %38 = OpLabel + OpBranch %36 + %37 = OpLabel + OpReturn + OpFunctionEnd + %fx_ = OpFunction %float None %14 + %48 = OpLabel + %49 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %50 = OpLoad %float %49 + %51 = OpFOrdGreaterThanEqual %bool %50 %float_0 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %55 = OpLoad %float %54 + OpReturnValue %55 + %52 = OpLabel + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + OpBranchConditional %true %60 %57 + %60 = OpLabel + OpStore %_GLF_color %30 + OpBranch %58 + %58 = OpLabel + OpBranch %56 + %57 = OpLabel + %61 = OpUndef %float + OpReturnValue %61 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.hlsl new file mode 100755 index 0000000000..4b3e3a82d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.hlsl @@ -0,0 +1,70 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float fx_() { + const float x_50 = gl_FragCoord.y; + if ((x_50 >= 0.0f)) { + const float x_55 = asfloat(x_7[0].y); + return x_55; + } + while (true) { + if (true) { + } else { + break; + } + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return 0.0f; +} + +void main_1() { + float x2 = 0.0f; + float B = 0.0f; + float k0 = 0.0f; + x2 = 1.0f; + B = 1.0f; + const float x_34 = fx_(); + x_GLF_color = float4(x_34, 0.0f, 0.0f, 1.0f); + while (true) { + if ((x2 > 2.0f)) { + } else { + break; + } + const float x_43 = fx_(); + const float x_44 = fx_(); + k0 = (x_43 - x_44); + B = k0; + x2 = B; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} +error: validation errors +T:\tmp\u9kk.0:55: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..53d236b1ab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.msl @@ -0,0 +1,64 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float fx_(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_50 = (*(tint_symbol_5)).y; + if ((x_50 >= 0.0f)) { + float const x_55 = x_7.injectionSwitch.y; + return x_55; + } + while (true) { + if (true) { + } else { + break; + } + *(tint_symbol_6) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return 0.0f; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + float x2 = 0.0f; + float B = 0.0f; + float k0 = 0.0f; + x2 = 1.0f; + B = 1.0f; + float const x_34 = fx_(x_7, tint_symbol_7, tint_symbol_8); + *(tint_symbol_8) = float4(x_34, 0.0f, 0.0f, 1.0f); + while (true) { + float const x_40 = x2; + if ((x_40 > 2.0f)) { + } else { + break; + } + float const x_43 = fx_(x_7, tint_symbol_7, tint_symbol_8); + float const x_44 = fx_(x_7, tint_symbol_7, tint_symbol_8); + k0 = (x_43 - x_44); + float const x_46 = k0; + B = x_46; + float const x_47 = B; + x2 = x_47; + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..3606a344e6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.spvasm @@ -0,0 +1,152 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 81 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %fx_ "fx_" + OpName %main_1 "main_1" + OpName %x2 "x2" + OpName %B "B" + OpName %k0 "k0" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %15 = OpTypeFunction %float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %41 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %void = OpTypeVoid + %42 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %48 = OpConstantNull %float + %float_2 = OpConstant %float 2 + %main_out = OpTypeStruct %v4float + %68 = OpTypeFunction %void %main_out + %fx_ = OpFunction %float None %15 + %17 = OpLabel + %21 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %22 = OpLoad %float %21 + %24 = OpFOrdGreaterThanEqual %bool %22 %float_0 + OpSelectionMerge %26 None + OpBranchConditional %24 %27 %26 + %27 = OpLabel + %30 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %31 = OpLoad %float %30 + OpReturnValue %31 + %26 = OpLabel + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + OpSelectionMerge %37 None + OpBranchConditional %true %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + OpBranch %33 + %37 = OpLabel + OpStore %x_GLF_color %41 + OpBranch %34 + %34 = OpLabel + OpBranch %32 + %33 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + %main_1 = OpFunction %void None %42 + %45 = OpLabel + %x2 = OpVariable %_ptr_Function_float Function %48 + %B = OpVariable %_ptr_Function_float Function %48 + %k0 = OpVariable %_ptr_Function_float Function %48 + OpStore %x2 %float_1 + OpStore %B %float_1 + %51 = OpFunctionCall %float %fx_ + %52 = OpCompositeConstruct %v4float %51 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %52 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %float %x2 + %59 = OpFOrdGreaterThan %bool %57 %float_2 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %54 + %60 = OpLabel + %63 = OpFunctionCall %float %fx_ + %64 = OpFunctionCall %float %fx_ + %65 = OpFSub %float %63 %64 + OpStore %k0 %65 + %66 = OpLoad %float %k0 + OpStore %B %66 + %67 = OpLoad %float %B + OpStore %x2 %67 + OpBranch %55 + %55 = OpLabel + OpBranch %53 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %68 +%tint_symbol_1 = OpFunctionParameter %main_out + %72 = OpLabel + %73 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %73 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %42 + %75 = OpLabel + %76 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %76 + %77 = OpFunctionCall %void %main_1 + %79 = OpLoad %v4float %x_GLF_color + %80 = OpCompositeConstruct %main_out %79 + %78 = OpFunctionCall %void %tint_symbol_3 %80 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ad60ab7bad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.wgsl @@ -0,0 +1,63 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn fx_() -> f32 { + let x_50 : f32 = gl_FragCoord.y; + if ((x_50 >= 0.0)) { + let x_55 : f32 = x_7.injectionSwitch.y; + return x_55; + } + loop { + if (true) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return 0.0; +} + +fn main_1() { + var x2 : f32; + var B : f32; + var k0 : f32; + x2 = 1.0; + B = 1.0; + let x_34 : f32 = fx_(); + x_GLF_color = vec4(x_34, 0.0, 0.0, 1.0); + loop { + let x_40 : f32 = x2; + if ((x_40 > 2.0)) { + } else { + break; + } + let x_43 : f32 = fx_(); + let x_44 : f32 = fx_(); + k0 = (x_43 - x_44); + let x_46 : f32 = k0; + B = x_46; + let x_47 : f32 = B; + x2 = x_47; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl new file mode 100644 index 0000000000..ad60ab7bad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl @@ -0,0 +1,63 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn fx_() -> f32 { + let x_50 : f32 = gl_FragCoord.y; + if ((x_50 >= 0.0)) { + let x_55 : f32 = x_7.injectionSwitch.y; + return x_55; + } + loop { + if (true) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return 0.0; +} + +fn main_1() { + var x2 : f32; + var B : f32; + var k0 : f32; + x2 = 1.0; + B = 1.0; + let x_34 : f32 = fx_(); + x_GLF_color = vec4(x_34, 0.0, 0.0, 1.0); + loop { + let x_40 : f32 = x2; + if ((x_40 > 2.0)) { + } else { + break; + } + let x_43 : f32 = fx_(); + let x_44 : f32 = fx_(); + k0 = (x_43 - x_44); + let x_46 : f32 = k0; + B = x_46; + let x_47 : f32 = B; + x2 = x_47; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.hlsl new file mode 100755 index 0000000000..e4b794307a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.hlsl @@ -0,0 +1,70 @@ +SKIP: FAILED + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float fx_() { + const float x_50 = gl_FragCoord.y; + if ((x_50 >= 0.0f)) { + const float x_55 = asfloat(x_7[0].y); + return x_55; + } + while (true) { + if (true) { + } else { + break; + } + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return 0.0f; +} + +void main_1() { + float x2 = 0.0f; + float B = 0.0f; + float k0 = 0.0f; + x2 = 1.0f; + B = 1.0f; + const float x_34 = fx_(); + x_GLF_color = float4(x_34, 0.0f, 0.0f, 1.0f); + while (true) { + if ((x2 > 2.0f)) { + } else { + break; + } + const float x_43 = fx_(); + const float x_44 = fx_(); + k0 = (x_43 - x_44); + B = k0; + x2 = B; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} +error: validation errors +T:\tmp\udf0.0:55: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..53d236b1ab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.msl @@ -0,0 +1,64 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float fx_(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_50 = (*(tint_symbol_5)).y; + if ((x_50 >= 0.0f)) { + float const x_55 = x_7.injectionSwitch.y; + return x_55; + } + while (true) { + if (true) { + } else { + break; + } + *(tint_symbol_6) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return 0.0f; +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + float x2 = 0.0f; + float B = 0.0f; + float k0 = 0.0f; + x2 = 1.0f; + B = 1.0f; + float const x_34 = fx_(x_7, tint_symbol_7, tint_symbol_8); + *(tint_symbol_8) = float4(x_34, 0.0f, 0.0f, 1.0f); + while (true) { + float const x_40 = x2; + if ((x_40 > 2.0f)) { + } else { + break; + } + float const x_43 = fx_(x_7, tint_symbol_7, tint_symbol_8); + float const x_44 = fx_(x_7, tint_symbol_7, tint_symbol_8); + k0 = (x_43 - x_44); + float const x_46 = k0; + B = x_46; + float const x_47 = B; + x2 = x_47; + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..3606a344e6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.spvasm @@ -0,0 +1,152 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 81 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %fx_ "fx_" + OpName %main_1 "main_1" + OpName %x2 "x2" + OpName %B "B" + OpName %k0 "k0" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %15 = OpTypeFunction %float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %41 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %void = OpTypeVoid + %42 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %48 = OpConstantNull %float + %float_2 = OpConstant %float 2 + %main_out = OpTypeStruct %v4float + %68 = OpTypeFunction %void %main_out + %fx_ = OpFunction %float None %15 + %17 = OpLabel + %21 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %22 = OpLoad %float %21 + %24 = OpFOrdGreaterThanEqual %bool %22 %float_0 + OpSelectionMerge %26 None + OpBranchConditional %24 %27 %26 + %27 = OpLabel + %30 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %31 = OpLoad %float %30 + OpReturnValue %31 + %26 = OpLabel + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + OpSelectionMerge %37 None + OpBranchConditional %true %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + OpBranch %33 + %37 = OpLabel + OpStore %x_GLF_color %41 + OpBranch %34 + %34 = OpLabel + OpBranch %32 + %33 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + %main_1 = OpFunction %void None %42 + %45 = OpLabel + %x2 = OpVariable %_ptr_Function_float Function %48 + %B = OpVariable %_ptr_Function_float Function %48 + %k0 = OpVariable %_ptr_Function_float Function %48 + OpStore %x2 %float_1 + OpStore %B %float_1 + %51 = OpFunctionCall %float %fx_ + %52 = OpCompositeConstruct %v4float %51 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %52 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %float %x2 + %59 = OpFOrdGreaterThan %bool %57 %float_2 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %54 + %60 = OpLabel + %63 = OpFunctionCall %float %fx_ + %64 = OpFunctionCall %float %fx_ + %65 = OpFSub %float %63 %64 + OpStore %k0 %65 + %66 = OpLoad %float %k0 + OpStore %B %66 + %67 = OpLoad %float %B + OpStore %x2 %67 + OpBranch %55 + %55 = OpLabel + OpBranch %53 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %68 +%tint_symbol_1 = OpFunctionParameter %main_out + %72 = OpLabel + %73 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %73 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %42 + %75 = OpLabel + %76 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %76 + %77 = OpFunctionCall %void %main_1 + %79 = OpLoad %v4float %x_GLF_color + %80 = OpCompositeConstruct %main_out %79 + %78 = OpFunctionCall %void %tint_symbol_3 %80 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ad60ab7bad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.wgsl @@ -0,0 +1,63 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn fx_() -> f32 { + let x_50 : f32 = gl_FragCoord.y; + if ((x_50 >= 0.0)) { + let x_55 : f32 = x_7.injectionSwitch.y; + return x_55; + } + loop { + if (true) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return 0.0; +} + +fn main_1() { + var x2 : f32; + var B : f32; + var k0 : f32; + x2 = 1.0; + B = 1.0; + let x_34 : f32 = fx_(); + x_GLF_color = vec4(x_34, 0.0, 0.0, 1.0); + loop { + let x_40 : f32 = x2; + if ((x_40 > 2.0)) { + } else { + break; + } + let x_43 : f32 = fx_(); + let x_44 : f32 = fx_(); + k0 = (x_43 - x_44); + let x_46 : f32 = k0; + B = x_46; + let x_47 : f32 = B; + x2 = x_47; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm new file mode 100644 index 0000000000..263c389aeb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm @@ -0,0 +1,257 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %yieldsZero_ "yieldsZero(" + OpName %globalNumbers "globalNumbers" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %acc "acc" + OpName %i_0 "i" + OpName %localNumbers "localNumbers" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %yieldsZero_ RelaxedPrecision + OpDecorate %globalNumbers RelaxedPrecision + OpDecorate %i RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %acc RelaxedPrecision + OpDecorate %i_0 RelaxedPrecision + OpDecorate %localNumbers RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + %void = OpTypeVoid + %36 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %39 = OpTypeFunction %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %59 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %60 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %65 = OpUndef %int + %66 = OpUndef %bool + %main = OpFunction %void None %36 + %67 = OpLabel + %68 = OpVariable %_ptr_Function_bool Function %false + %29 = OpVariable %_ptr_Function_int Function + %30 = OpVariable %_ptr_Function_int Function + %31 = OpVariable %_ptr_Function_int Function +%globalNumbers = OpVariable %_ptr_Function__arr_int_uint_10 Function + %17 = OpVariable %_ptr_Function_int Function + %acc = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function +%localNumbers = OpVariable %_ptr_Function__arr_int_uint_2 Function + %param = OpVariable %_ptr_Function_int Function + OpStore %acc %int_0 + OpStore %i_0 %int_0 + OpBranch %69 + %69 = OpLabel + %24 = OpPhi %int %int_0 %67 %15 %70 + %23 = OpPhi %int %int_0 %67 %16 %70 + OpLoopMerge %71 %70 None + OpBranch %72 + %72 = OpLabel + %73 = OpSLessThan %bool %23 %int_4 + OpBranchConditional %73 %74 %71 + %74 = OpLabel + OpStore %68 %false + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %bool %false %74 %66 %77 + OpLoopMerge %78 %77 None + OpBranch %79 + %79 = OpLabel + OpStore %30 %int_0 + OpBranch %80 + %80 = OpLabel + %81 = OpPhi %bool %76 %79 %66 %82 + %32 = OpPhi %int %int_0 %79 %65 %82 + OpLoopMerge %83 %82 None + OpBranch %84 + %84 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %86 = OpLoad %float %85 + %87 = OpConvertFToS %int %86 + %88 = OpSLessThan %bool %32 %87 + OpBranchConditional %88 %89 %83 + %89 = OpLabel + OpStore %68 %true + OpStore %29 %32 + OpBranch %83 + %82 = OpLabel + OpBranch %80 + %83 = OpLabel + %33 = OpPhi %int %65 %84 %32 %89 + %90 = OpPhi %bool %81 %84 %true %89 + OpSelectionMerge %91 None + OpBranchConditional %90 %78 %91 + %91 = OpLabel + %92 = OpUndef %int + OpStore %68 %true + OpStore %29 %92 + OpBranch %78 + %77 = OpLabel + OpBranch %75 + %78 = OpLabel + %34 = OpPhi %int %33 %83 %92 %91 + OpStore %31 %34 + %93 = OpLoad %int %31 + %21 = OpLoad %_arr_int_uint_2 %localNumbers + %22 = OpCompositeInsert %_arr_int_uint_2 %93 %21 1 + OpStore %localNumbers %22 + %94 = OpAccessChain %_ptr_Function_int %globalNumbers %int_0 + OpStore %94 %int_0 + %95 = OpAccessChain %_ptr_Function_int %localNumbers %int_1 + %13 = OpCompositeExtract %int %22 1 + OpStore %param %13 + OpStore %17 %int_0 + OpBranch %96 + %96 = OpLabel + %25 = OpPhi %int %int_0 %78 %19 %97 + OpLoopMerge %98 %97 None + OpBranch %99 + %99 = OpLabel + %100 = OpSLessThanEqual %bool %25 %13 + OpBranchConditional %100 %101 %98 + %101 = OpLabel + %102 = OpAccessChain %_ptr_Function_int %globalNumbers %13 + %18 = OpLoad %int %102 + %103 = OpSLessThanEqual %bool %18 %int_1 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + OpStore %102 %int_1 + OpBranch %104 + %104 = OpLabel + OpBranch %97 + %97 = OpLabel + %19 = OpIAdd %int %25 %int_1 + OpStore %17 %19 + OpBranch %96 + %98 = OpLabel + %106 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %107 = OpLoad %float %106 + %108 = OpConvertFToS %int %107 + %109 = OpISub %int %108 %int_1 + %110 = OpAccessChain %_ptr_Function_int %globalNumbers %109 + %14 = OpLoad %int %110 + %15 = OpIAdd %int %24 %14 + OpStore %acc %15 + OpBranch %70 + %70 = OpLabel + %16 = OpIAdd %int %23 %int_1 + OpStore %i_0 %16 + OpBranch %69 + %71 = OpLabel + %111 = OpIEqual %bool %24 %int_4 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %114 + %113 = OpLabel + OpStore %_GLF_color %59 + OpBranch %112 + %114 = OpLabel + OpStore %_GLF_color %60 + OpBranch %112 + %112 = OpLabel + OpReturn + OpFunctionEnd +%yieldsZero_ = OpFunction %int None %39 + %115 = OpLabel + %116 = OpVariable %_ptr_Function_bool Function %false + %20 = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %bool %false %115 %66 %119 + OpLoopMerge %120 %119 None + OpBranch %121 + %121 = OpLabel + OpStore %i %int_0 + OpBranch %122 + %122 = OpLabel + %123 = OpPhi %bool %118 %121 %66 %124 + %28 = OpPhi %int %int_0 %121 %65 %124 + OpLoopMerge %125 %124 None + OpBranch %126 + %126 = OpLabel + %127 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %128 = OpLoad %float %127 + %129 = OpConvertFToS %int %128 + %130 = OpSLessThan %bool %28 %129 + OpBranchConditional %130 %131 %125 + %131 = OpLabel + OpStore %116 %true + OpStore %20 %28 + OpBranch %125 + %124 = OpLabel + OpBranch %122 + %125 = OpLabel + %26 = OpPhi %int %65 %126 %28 %131 + %132 = OpPhi %bool %123 %126 %true %131 + OpSelectionMerge %133 None + OpBranchConditional %132 %120 %133 + %133 = OpLabel + %134 = OpUndef %int + OpStore %116 %true + OpStore %20 %134 + OpBranch %120 + %119 = OpLabel + OpBranch %117 + %120 = OpLabel + %27 = OpPhi %int %26 %125 %134 %133 + OpReturnValue %27 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..adb4b1357c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.hlsl @@ -0,0 +1,201 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_68 = false; + int x_29 = 0; + int x_30 = 0; + int x_31 = 0; + int globalNumbers[10] = (int[10])0; + int x_17 = 0; + int acc = 0; + int i_1 = 0; + int localNumbers[2] = (int[2])0; + int param = 0; + int x_24 = 0; + int x_24_phi = 0; + int x_23_phi = 0; + acc = 0; + i_1 = 0; + x_24_phi = 0; + x_23_phi = 0; + while (true) { + int x_33 = 0; + int x_92 = 0; + bool x_76_phi = false; + int x_34_phi = 0; + int x_25_phi = 0; + x_24 = x_24_phi; + const int x_23 = x_23_phi; + if ((x_23 < 4)) { + } else { + break; + } + x_68 = false; + x_76_phi = false; + while (true) { + bool x_81 = false; + int x_32 = 0; + bool x_81_phi = false; + int x_32_phi = 0; + int x_33_phi = 0; + bool x_90_phi = false; + const bool x_76 = x_76_phi; + x_30 = 0; + x_81_phi = x_76; + x_32_phi = 0; + while (true) { + x_81 = x_81_phi; + x_32 = x_32_phi; + const float x_86 = asfloat(x_8[0].x); + x_33_phi = 0; + x_90_phi = x_81; + if ((x_32 < int(x_86))) { + } else { + break; + } + x_68 = true; + x_29 = x_32; + x_33_phi = x_32; + x_90_phi = true; + break; + { + x_81_phi = false; + x_32_phi = 0; + } + } + x_33 = x_33_phi; + const bool x_90 = x_90_phi; + x_34_phi = x_33; + if (x_90) { + break; + } + x_92 = 0; + x_68 = true; + x_29 = x_92; + x_34_phi = x_92; + break; + { + x_76_phi = false; + } + } + x_31 = x_34_phi; + const int x_93 = x_31; + int x_22_1[2] = localNumbers; + x_22_1[1u] = x_93; + const int x_22[2] = x_22_1; + localNumbers = x_22; + globalNumbers[0] = 0; + const int x_13 = x_22[1u]; + param = x_13; + x_17 = 0; + x_25_phi = 0; + while (true) { + const int x_25 = x_25_phi; + if ((x_25 <= x_13)) { + } else { + break; + } + const int x_102_save = x_13; + const int x_18 = globalNumbers[x_102_save]; + if ((x_18 <= 1)) { + globalNumbers[x_102_save] = 1; + } + { + const int x_19 = (x_25 + 1); + x_17 = x_19; + x_25_phi = x_19; + } + } + const float x_107 = asfloat(x_8[0].x); + const int x_14 = globalNumbers[(int(x_107) - 1)]; + const int x_15 = asint((x_24 + asint(x_14))); + acc = x_15; + { + const int x_16 = (x_23 + 1); + i_1 = x_16; + x_24_phi = x_15; + x_23_phi = x_16; + } + } + if ((x_24 == asint(4))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} + +int yieldsZero_() { + bool x_116 = false; + int x_20 = 0; + int i = 0; + int x_26 = 0; + int x_134 = 0; + bool x_118_phi = false; + int x_27_phi = 0; + x_118_phi = false; + while (true) { + bool x_123 = false; + int x_28 = 0; + bool x_123_phi = false; + int x_28_phi = 0; + int x_26_phi = 0; + bool x_132_phi = false; + const bool x_118 = x_118_phi; + i = 0; + x_123_phi = x_118; + x_28_phi = 0; + while (true) { + x_123 = x_123_phi; + x_28 = x_28_phi; + const float x_128 = asfloat(x_8[0].x); + x_26_phi = 0; + x_132_phi = x_123; + if ((x_28 < int(x_128))) { + } else { + break; + } + x_116 = true; + x_20 = x_28; + x_26_phi = x_28; + x_132_phi = true; + break; + { + x_123_phi = false; + x_28_phi = 0; + } + } + x_26 = x_26_phi; + const bool x_132 = x_132_phi; + x_27_phi = x_26; + if (x_132) { + break; + } + x_134 = 0; + x_116 = true; + x_20 = x_134; + x_27_phi = x_134; + break; + { + x_118_phi = false; + } + } + return x_27_phi; +} diff --git a/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..7d54d73fd2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.msl @@ -0,0 +1,213 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct tint_array_wrapper_1 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + bool x_68 = false; + int x_29 = 0; + int x_30 = 0; + int x_31 = 0; + tint_array_wrapper globalNumbers = {}; + int x_17 = 0; + int acc = 0; + int i_1 = 0; + tint_array_wrapper_1 localNumbers = {}; + int param = 0; + int x_24 = 0; + int x_24_phi = 0; + int x_23_phi = 0; + acc = 0; + i_1 = 0; + x_24_phi = 0; + x_23_phi = 0; + while (true) { + int x_33 = 0; + int x_92 = 0; + bool x_76_phi = false; + int x_34_phi = 0; + int x_25_phi = 0; + x_24 = x_24_phi; + int const x_23 = x_23_phi; + if ((x_23 < 4)) { + } else { + break; + } + x_68 = false; + x_76_phi = false; + while (true) { + bool x_81 = false; + int x_32 = 0; + bool x_81_phi = false; + int x_32_phi = 0; + int x_33_phi = 0; + bool x_90_phi = false; + bool const x_76 = x_76_phi; + x_30 = 0; + x_81_phi = x_76; + x_32_phi = 0; + while (true) { + x_81 = x_81_phi; + x_32 = x_32_phi; + float const x_86 = x_8.one; + x_33_phi = 0; + x_90_phi = x_81; + if ((x_32 < int(x_86))) { + } else { + break; + } + x_68 = true; + x_29 = x_32; + x_33_phi = x_32; + x_90_phi = true; + break; + { + x_81_phi = false; + x_32_phi = 0; + } + } + x_33 = x_33_phi; + bool const x_90 = x_90_phi; + x_34_phi = x_33; + if (x_90) { + break; + } + x_92 = 0; + x_68 = true; + x_29 = x_92; + x_34_phi = x_92; + break; + { + x_76_phi = false; + } + } + int const x_34 = x_34_phi; + x_31 = x_34; + int const x_93 = x_31; + tint_array_wrapper_1 const x_21 = localNumbers; + tint_array_wrapper_1 x_22_1 = x_21; + x_22_1.arr[1u] = x_93; + tint_array_wrapper_1 const x_22 = x_22_1; + localNumbers = x_22; + globalNumbers.arr[0] = 0; + int const x_13 = x_22.arr[1u]; + param = x_13; + x_17 = 0; + x_25_phi = 0; + while (true) { + int const x_25 = x_25_phi; + if ((x_25 <= x_13)) { + } else { + break; + } + int const x_102_save = x_13; + int const x_18 = globalNumbers.arr[x_102_save]; + if ((x_18 <= 1)) { + globalNumbers.arr[x_102_save] = 1; + } + { + int const x_19 = (x_25 + 1); + x_17 = x_19; + x_25_phi = x_19; + } + } + float const x_107 = x_8.one; + int const x_14 = globalNumbers.arr[(int(x_107) - 1)]; + int const x_15 = as_type((x_24 + as_type(x_14))); + acc = x_15; + { + int const x_16 = (x_23 + 1); + i_1 = x_16; + x_24_phi = x_15; + x_23_phi = x_16; + } + } + if ((x_24 == as_type(4))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +int yieldsZero_(constant buf0& x_8) { + bool x_116 = false; + int x_20 = 0; + int i = 0; + int x_26 = 0; + int x_134 = 0; + bool x_118_phi = false; + int x_27_phi = 0; + x_118_phi = false; + while (true) { + bool x_123 = false; + int x_28 = 0; + bool x_123_phi = false; + int x_28_phi = 0; + int x_26_phi = 0; + bool x_132_phi = false; + bool const x_118 = x_118_phi; + i = 0; + x_123_phi = x_118; + x_28_phi = 0; + while (true) { + x_123 = x_123_phi; + x_28 = x_28_phi; + float const x_128 = x_8.one; + x_26_phi = 0; + x_132_phi = x_123; + if ((x_28 < int(x_128))) { + } else { + break; + } + x_116 = true; + x_20 = x_28; + x_26_phi = x_28; + x_132_phi = true; + break; + { + x_123_phi = false; + x_28_phi = 0; + } + } + x_26 = x_26_phi; + bool const x_132 = x_132_phi; + x_27_phi = x_26; + if (x_132) { + break; + } + x_134 = 0; + x_116 = true; + x_20 = x_134; + x_27_phi = x_134; + break; + { + x_118_phi = false; + } + } + int const x_27 = x_27_phi; + return x_27; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..02fd4f3558 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.spvasm @@ -0,0 +1,406 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 204 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_68 "x_68" + OpName %x_29 "x_29" + OpName %x_30 "x_30" + OpName %x_31 "x_31" + OpName %globalNumbers "globalNumbers" + OpName %x_17 "x_17" + OpName %acc "acc" + OpName %i_1 "i_1" + OpName %localNumbers "localNumbers" + OpName %param "param" + OpName %x_24 "x_24" + OpName %x_24_phi "x_24_phi" + OpName %x_23_phi "x_23_phi" + OpName %x_33 "x_33" + OpName %x_92 "x_92" + OpName %x_76_phi "x_76_phi" + OpName %x_34_phi "x_34_phi" + OpName %x_25_phi "x_25_phi" + OpName %x_81 "x_81" + OpName %x_32 "x_32" + OpName %x_81_phi "x_81_phi" + OpName %x_32_phi "x_32_phi" + OpName %x_33_phi "x_33_phi" + OpName %x_90_phi "x_90_phi" + OpName %x_22_1 "x_22_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %yieldsZero_ "yieldsZero_" + OpName %x_116 "x_116" + OpName %x_20 "x_20" + OpName %i "i" + OpName %x_26 "x_26" + OpName %x_134 "x_134" + OpName %x_118_phi "x_118_phi" + OpName %x_27_phi "x_27_phi" + OpName %x_123 "x_123" + OpName %x_28 "x_28" + OpName %x_123_phi "x_123_phi" + OpName %x_28_phi "x_28_phi" + OpName %x_26_phi "x_26_phi" + OpName %x_132_phi "x_132_phi" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %19 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %31 = OpConstantNull %_arr_int_uint_10 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %39 = OpConstantNull %_arr_int_uint_2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %144 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %145 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %146 = OpTypeFunction %void %main_out + %158 = OpTypeFunction %int + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_68 = OpVariable %_ptr_Function_bool Function %19 + %x_29 = OpVariable %_ptr_Function_int Function %23 + %x_30 = OpVariable %_ptr_Function_int Function %23 + %x_31 = OpVariable %_ptr_Function_int Function %23 +%globalNumbers = OpVariable %_ptr_Function__arr_int_uint_10 Function %31 + %x_17 = OpVariable %_ptr_Function_int Function %23 + %acc = OpVariable %_ptr_Function_int Function %23 + %i_1 = OpVariable %_ptr_Function_int Function %23 +%localNumbers = OpVariable %_ptr_Function__arr_int_uint_2 Function %39 + %param = OpVariable %_ptr_Function_int Function %23 + %x_24 = OpVariable %_ptr_Function_int Function %23 + %x_24_phi = OpVariable %_ptr_Function_int Function %23 + %x_23_phi = OpVariable %_ptr_Function_int Function %23 + %x_33 = OpVariable %_ptr_Function_int Function %23 + %x_92 = OpVariable %_ptr_Function_int Function %23 + %x_76_phi = OpVariable %_ptr_Function_bool Function %19 + %x_34_phi = OpVariable %_ptr_Function_int Function %23 + %x_25_phi = OpVariable %_ptr_Function_int Function %23 + %x_81 = OpVariable %_ptr_Function_bool Function %19 + %x_32 = OpVariable %_ptr_Function_int Function %23 + %x_81_phi = OpVariable %_ptr_Function_bool Function %19 + %x_32_phi = OpVariable %_ptr_Function_int Function %23 + %x_33_phi = OpVariable %_ptr_Function_int Function %23 + %x_90_phi = OpVariable %_ptr_Function_bool Function %19 + %x_22_1 = OpVariable %_ptr_Function__arr_int_uint_2 Function %39 + OpStore %x_68 %false + OpStore %acc %int_0 + OpStore %i_1 %int_0 + OpStore %x_24_phi %int_0 + OpStore %x_23_phi %int_0 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %54 = OpLoad %int %x_24_phi + OpStore %x_24 %54 + %55 = OpLoad %int %x_23_phi + %57 = OpSLessThan %bool %55 %int_4 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %46 + %58 = OpLabel + OpStore %x_68 %false + OpStore %x_76_phi %false + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %71 = OpLoad %bool %x_76_phi + OpStore %x_30 %int_0 + OpStore %x_81_phi %71 + OpStore %x_32_phi %int_0 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %bool %x_81_phi + OpStore %x_81 %76 + %77 = OpLoad %int %x_32_phi + OpStore %x_32 %77 + %80 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 + %81 = OpLoad %float %80 + OpStore %x_33_phi %int_0 + %82 = OpLoad %bool %x_81 + OpStore %x_90_phi %82 + %83 = OpLoad %int %x_32 + %84 = OpConvertFToS %int %81 + %85 = OpSLessThan %bool %83 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + OpBranch %86 + %88 = OpLabel + OpBranch %73 + %86 = OpLabel + OpStore %x_68 %true + %90 = OpLoad %int %x_32 + OpStore %x_29 %90 + %91 = OpLoad %int %x_32 + OpStore %x_33_phi %91 + OpStore %x_90_phi %true + OpBranch %73 + %74 = OpLabel + OpStore %x_81_phi %false + OpStore %x_32_phi %int_0 + OpBranch %72 + %73 = OpLabel + %92 = OpLoad %int %x_33_phi + OpStore %x_33 %92 + %93 = OpLoad %bool %x_90_phi + %94 = OpLoad %int %x_33 + OpStore %x_34_phi %94 + OpSelectionMerge %95 None + OpBranchConditional %93 %96 %95 + %96 = OpLabel + OpBranch %62 + %95 = OpLabel + OpStore %x_92 %int_0 + OpStore %x_68 %true + %97 = OpLoad %int %x_92 + OpStore %x_29 %97 + %98 = OpLoad %int %x_92 + OpStore %x_34_phi %98 + OpBranch %62 + %63 = OpLabel + OpStore %x_76_phi %false + OpBranch %61 + %62 = OpLabel + %99 = OpLoad %int %x_34_phi + OpStore %x_31 %99 + %100 = OpLoad %int %x_31 + %101 = OpLoad %_arr_int_uint_2 %localNumbers + OpStore %x_22_1 %101 + %104 = OpAccessChain %_ptr_Function_int %x_22_1 %uint_1 + OpStore %104 %100 + %105 = OpLoad %_arr_int_uint_2 %x_22_1 + OpStore %localNumbers %105 + %106 = OpAccessChain %_ptr_Function_int %globalNumbers %int_0 + OpStore %106 %int_0 + %107 = OpCompositeExtract %int %105 1 + OpStore %param %107 + OpStore %x_17 %int_0 + OpStore %x_25_phi %int_0 + OpBranch %108 + %108 = OpLabel + OpLoopMerge %109 %110 None + OpBranch %111 + %111 = OpLabel + %112 = OpLoad %int %x_25_phi + %113 = OpSLessThanEqual %bool %112 %107 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %116 + %115 = OpLabel + OpBranch %114 + %116 = OpLabel + OpBranch %109 + %114 = OpLabel + %117 = OpAccessChain %_ptr_Function_int %globalNumbers %107 + %118 = OpLoad %int %117 + %120 = OpSLessThanEqual %bool %118 %int_1 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %121 + %122 = OpLabel + %123 = OpAccessChain %_ptr_Function_int %globalNumbers %107 + OpStore %123 %int_1 + OpBranch %121 + %121 = OpLabel + OpBranch %110 + %110 = OpLabel + %124 = OpIAdd %int %112 %int_1 + OpStore %x_17 %124 + OpStore %x_25_phi %124 + OpBranch %108 + %109 = OpLabel + %125 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 + %126 = OpLoad %float %125 + %127 = OpConvertFToS %int %126 + %128 = OpISub %int %127 %int_1 + %129 = OpAccessChain %_ptr_Function_int %globalNumbers %128 + %130 = OpLoad %int %129 + %132 = OpLoad %int %x_24 + %133 = OpCopyObject %int %130 + %134 = OpIAdd %int %132 %133 + %131 = OpCopyObject %int %134 + OpStore %acc %131 + OpBranch %47 + %47 = OpLabel + %135 = OpIAdd %int %55 %int_1 + OpStore %i_1 %135 + OpStore %x_24_phi %131 + OpStore %x_23_phi %135 + OpBranch %45 + %46 = OpLabel + %136 = OpLoad %int %x_24 + %137 = OpCopyObject %int %int_4 + %138 = OpIEqual %bool %136 %137 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpStore %x_GLF_color %144 + OpBranch %139 + %141 = OpLabel + OpStore %x_GLF_color %145 + OpBranch %139 + %139 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %146 +%tint_symbol = OpFunctionParameter %main_out + %150 = OpLabel + %151 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %151 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %153 = OpLabel + %154 = OpFunctionCall %void %main_1 + %156 = OpLoad %v4float %x_GLF_color + %157 = OpCompositeConstruct %main_out %156 + %155 = OpFunctionCall %void %tint_symbol_2 %157 + OpReturn + OpFunctionEnd +%yieldsZero_ = OpFunction %int None %158 + %160 = OpLabel + %x_116 = OpVariable %_ptr_Function_bool Function %19 + %x_20 = OpVariable %_ptr_Function_int Function %23 + %i = OpVariable %_ptr_Function_int Function %23 + %x_26 = OpVariable %_ptr_Function_int Function %23 + %x_134 = OpVariable %_ptr_Function_int Function %23 + %x_118_phi = OpVariable %_ptr_Function_bool Function %19 + %x_27_phi = OpVariable %_ptr_Function_int Function %23 + %x_123 = OpVariable %_ptr_Function_bool Function %19 + %x_28 = OpVariable %_ptr_Function_int Function %23 + %x_123_phi = OpVariable %_ptr_Function_bool Function %19 + %x_28_phi = OpVariable %_ptr_Function_int Function %23 + %x_26_phi = OpVariable %_ptr_Function_int Function %23 + %x_132_phi = OpVariable %_ptr_Function_bool Function %19 + OpStore %x_116 %false + OpStore %x_118_phi %false + OpBranch %168 + %168 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %178 = OpLoad %bool %x_118_phi + OpStore %i %int_0 + OpStore %x_123_phi %178 + OpStore %x_28_phi %int_0 + OpBranch %179 + %179 = OpLabel + OpLoopMerge %180 %181 None + OpBranch %182 + %182 = OpLabel + %183 = OpLoad %bool %x_123_phi + OpStore %x_123 %183 + %184 = OpLoad %int %x_28_phi + OpStore %x_28 %184 + %185 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 + %186 = OpLoad %float %185 + OpStore %x_26_phi %int_0 + %187 = OpLoad %bool %x_123 + OpStore %x_132_phi %187 + %188 = OpLoad %int %x_28 + %189 = OpConvertFToS %int %186 + %190 = OpSLessThan %bool %188 %189 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %193 + %192 = OpLabel + OpBranch %191 + %193 = OpLabel + OpBranch %180 + %191 = OpLabel + OpStore %x_116 %true + %194 = OpLoad %int %x_28 + OpStore %x_20 %194 + %195 = OpLoad %int %x_28 + OpStore %x_26_phi %195 + OpStore %x_132_phi %true + OpBranch %180 + %181 = OpLabel + OpStore %x_123_phi %false + OpStore %x_28_phi %int_0 + OpBranch %179 + %180 = OpLabel + %196 = OpLoad %int %x_26_phi + OpStore %x_26 %196 + %197 = OpLoad %bool %x_132_phi + %198 = OpLoad %int %x_26 + OpStore %x_27_phi %198 + OpSelectionMerge %199 None + OpBranchConditional %197 %200 %199 + %200 = OpLabel + OpBranch %169 + %199 = OpLabel + OpStore %x_134 %int_0 + OpStore %x_116 %true + %201 = OpLoad %int %x_134 + OpStore %x_20 %201 + %202 = OpLoad %int %x_134 + OpStore %x_27_phi %202 + OpBranch %169 + %170 = OpLabel + OpStore %x_118_phi %false + OpBranch %168 + %169 = OpLabel + %203 = OpLoad %int %x_27_phi + OpReturnValue %203 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..68df8e308b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.spvasm.expected.wgsl @@ -0,0 +1,212 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_68 : bool = false; + var x_29 : i32; + var x_30 : i32; + var x_31 : i32; + var globalNumbers : array; + var x_17 : i32; + var acc : i32; + var i_1 : i32; + var localNumbers : array; + var param : i32; + var x_24 : i32; + var x_24_phi : i32; + var x_23_phi : i32; + acc = 0; + i_1 = 0; + x_24_phi = 0; + x_23_phi = 0; + loop { + var x_33 : i32; + var x_92 : i32; + var x_76_phi : bool; + var x_34_phi : i32; + var x_25_phi : i32; + x_24 = x_24_phi; + let x_23 : i32 = x_23_phi; + if ((x_23 < 4)) { + } else { + break; + } + x_68 = false; + x_76_phi = false; + loop { + var x_81 : bool; + var x_32 : i32; + var x_81_phi : bool; + var x_32_phi : i32; + var x_33_phi : i32; + var x_90_phi : bool; + let x_76 : bool = x_76_phi; + x_30 = 0; + x_81_phi = x_76; + x_32_phi = 0; + loop { + x_81 = x_81_phi; + x_32 = x_32_phi; + let x_86 : f32 = x_8.one; + x_33_phi = 0; + x_90_phi = x_81; + if ((x_32 < i32(x_86))) { + } else { + break; + } + x_68 = true; + x_29 = x_32; + x_33_phi = x_32; + x_90_phi = true; + break; + + continuing { + x_81_phi = false; + x_32_phi = 0; + } + } + x_33 = x_33_phi; + let x_90 : bool = x_90_phi; + x_34_phi = x_33; + if (x_90) { + break; + } + x_92 = 0; + x_68 = true; + x_29 = x_92; + x_34_phi = x_92; + break; + + continuing { + x_76_phi = false; + } + } + let x_34 : i32 = x_34_phi; + x_31 = x_34; + let x_93 : i32 = x_31; + let x_21 : array = localNumbers; + var x_22_1 : array = x_21; + x_22_1[1u] = x_93; + let x_22 : array = x_22_1; + localNumbers = x_22; + globalNumbers[0] = 0; + let x_95 : ptr = &(localNumbers[1]); + let x_13 : i32 = x_22[1u]; + param = x_13; + x_17 = 0; + x_25_phi = 0; + loop { + let x_25 : i32 = x_25_phi; + if ((x_25 <= x_13)) { + } else { + break; + } + let x_102 : ptr = &(globalNumbers[x_13]); + let x_18 : i32 = *(x_102); + if ((x_18 <= 1)) { + *(x_102) = 1; + } + + continuing { + let x_19 : i32 = (x_25 + 1); + x_17 = x_19; + x_25_phi = x_19; + } + } + let x_107 : f32 = x_8.one; + let x_14 : i32 = globalNumbers[(i32(x_107) - 1)]; + let x_15 : i32 = bitcast((x_24 + bitcast(x_14))); + acc = x_15; + + continuing { + let x_16 : i32 = (x_23 + 1); + i_1 = x_16; + x_24_phi = x_15; + x_23_phi = x_16; + } + } + if ((x_24 == bitcast(4))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn yieldsZero_() -> i32 { + var x_116 : bool = false; + var x_20 : i32; + var i : i32; + var x_26 : i32; + var x_134 : i32; + var x_118_phi : bool; + var x_27_phi : i32; + x_118_phi = false; + loop { + var x_123 : bool; + var x_28 : i32; + var x_123_phi : bool; + var x_28_phi : i32; + var x_26_phi : i32; + var x_132_phi : bool; + let x_118 : bool = x_118_phi; + i = 0; + x_123_phi = x_118; + x_28_phi = 0; + loop { + x_123 = x_123_phi; + x_28 = x_28_phi; + let x_128 : f32 = x_8.one; + x_26_phi = 0; + x_132_phi = x_123; + if ((x_28 < i32(x_128))) { + } else { + break; + } + x_116 = true; + x_20 = x_28; + x_26_phi = x_28; + x_132_phi = true; + break; + + continuing { + x_123_phi = false; + x_28_phi = 0; + } + } + x_26 = x_26_phi; + let x_132 : bool = x_132_phi; + x_27_phi = x_26; + if (x_132) { + break; + } + x_134 = 0; + x_116 = true; + x_20 = x_134; + x_27_phi = x_134; + break; + + continuing { + x_118_phi = false; + } + } + let x_27 : i32 = x_27_phi; + return x_27; +} diff --git a/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl new file mode 100644 index 0000000000..68df8e308b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl @@ -0,0 +1,212 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_68 : bool = false; + var x_29 : i32; + var x_30 : i32; + var x_31 : i32; + var globalNumbers : array; + var x_17 : i32; + var acc : i32; + var i_1 : i32; + var localNumbers : array; + var param : i32; + var x_24 : i32; + var x_24_phi : i32; + var x_23_phi : i32; + acc = 0; + i_1 = 0; + x_24_phi = 0; + x_23_phi = 0; + loop { + var x_33 : i32; + var x_92 : i32; + var x_76_phi : bool; + var x_34_phi : i32; + var x_25_phi : i32; + x_24 = x_24_phi; + let x_23 : i32 = x_23_phi; + if ((x_23 < 4)) { + } else { + break; + } + x_68 = false; + x_76_phi = false; + loop { + var x_81 : bool; + var x_32 : i32; + var x_81_phi : bool; + var x_32_phi : i32; + var x_33_phi : i32; + var x_90_phi : bool; + let x_76 : bool = x_76_phi; + x_30 = 0; + x_81_phi = x_76; + x_32_phi = 0; + loop { + x_81 = x_81_phi; + x_32 = x_32_phi; + let x_86 : f32 = x_8.one; + x_33_phi = 0; + x_90_phi = x_81; + if ((x_32 < i32(x_86))) { + } else { + break; + } + x_68 = true; + x_29 = x_32; + x_33_phi = x_32; + x_90_phi = true; + break; + + continuing { + x_81_phi = false; + x_32_phi = 0; + } + } + x_33 = x_33_phi; + let x_90 : bool = x_90_phi; + x_34_phi = x_33; + if (x_90) { + break; + } + x_92 = 0; + x_68 = true; + x_29 = x_92; + x_34_phi = x_92; + break; + + continuing { + x_76_phi = false; + } + } + let x_34 : i32 = x_34_phi; + x_31 = x_34; + let x_93 : i32 = x_31; + let x_21 : array = localNumbers; + var x_22_1 : array = x_21; + x_22_1[1u] = x_93; + let x_22 : array = x_22_1; + localNumbers = x_22; + globalNumbers[0] = 0; + let x_95 : ptr = &(localNumbers[1]); + let x_13 : i32 = x_22[1u]; + param = x_13; + x_17 = 0; + x_25_phi = 0; + loop { + let x_25 : i32 = x_25_phi; + if ((x_25 <= x_13)) { + } else { + break; + } + let x_102 : ptr = &(globalNumbers[x_13]); + let x_18 : i32 = *(x_102); + if ((x_18 <= 1)) { + *(x_102) = 1; + } + + continuing { + let x_19 : i32 = (x_25 + 1); + x_17 = x_19; + x_25_phi = x_19; + } + } + let x_107 : f32 = x_8.one; + let x_14 : i32 = globalNumbers[(i32(x_107) - 1)]; + let x_15 : i32 = bitcast((x_24 + bitcast(x_14))); + acc = x_15; + + continuing { + let x_16 : i32 = (x_23 + 1); + i_1 = x_16; + x_24_phi = x_15; + x_23_phi = x_16; + } + } + if ((x_24 == bitcast(4))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn yieldsZero_() -> i32 { + var x_116 : bool = false; + var x_20 : i32; + var i : i32; + var x_26 : i32; + var x_134 : i32; + var x_118_phi : bool; + var x_27_phi : i32; + x_118_phi = false; + loop { + var x_123 : bool; + var x_28 : i32; + var x_123_phi : bool; + var x_28_phi : i32; + var x_26_phi : i32; + var x_132_phi : bool; + let x_118 : bool = x_118_phi; + i = 0; + x_123_phi = x_118; + x_28_phi = 0; + loop { + x_123 = x_123_phi; + x_28 = x_28_phi; + let x_128 : f32 = x_8.one; + x_26_phi = 0; + x_132_phi = x_123; + if ((x_28 < i32(x_128))) { + } else { + break; + } + x_116 = true; + x_20 = x_28; + x_26_phi = x_28; + x_132_phi = true; + break; + + continuing { + x_123_phi = false; + x_28_phi = 0; + } + } + x_26 = x_26_phi; + let x_132 : bool = x_132_phi; + x_27_phi = x_26; + if (x_132) { + break; + } + x_134 = 0; + x_116 = true; + x_20 = x_134; + x_27_phi = x_134; + break; + + continuing { + x_118_phi = false; + } + } + let x_27 : i32 = x_27_phi; + return x_27; +} diff --git a/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..adb4b1357c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.hlsl @@ -0,0 +1,201 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_68 = false; + int x_29 = 0; + int x_30 = 0; + int x_31 = 0; + int globalNumbers[10] = (int[10])0; + int x_17 = 0; + int acc = 0; + int i_1 = 0; + int localNumbers[2] = (int[2])0; + int param = 0; + int x_24 = 0; + int x_24_phi = 0; + int x_23_phi = 0; + acc = 0; + i_1 = 0; + x_24_phi = 0; + x_23_phi = 0; + while (true) { + int x_33 = 0; + int x_92 = 0; + bool x_76_phi = false; + int x_34_phi = 0; + int x_25_phi = 0; + x_24 = x_24_phi; + const int x_23 = x_23_phi; + if ((x_23 < 4)) { + } else { + break; + } + x_68 = false; + x_76_phi = false; + while (true) { + bool x_81 = false; + int x_32 = 0; + bool x_81_phi = false; + int x_32_phi = 0; + int x_33_phi = 0; + bool x_90_phi = false; + const bool x_76 = x_76_phi; + x_30 = 0; + x_81_phi = x_76; + x_32_phi = 0; + while (true) { + x_81 = x_81_phi; + x_32 = x_32_phi; + const float x_86 = asfloat(x_8[0].x); + x_33_phi = 0; + x_90_phi = x_81; + if ((x_32 < int(x_86))) { + } else { + break; + } + x_68 = true; + x_29 = x_32; + x_33_phi = x_32; + x_90_phi = true; + break; + { + x_81_phi = false; + x_32_phi = 0; + } + } + x_33 = x_33_phi; + const bool x_90 = x_90_phi; + x_34_phi = x_33; + if (x_90) { + break; + } + x_92 = 0; + x_68 = true; + x_29 = x_92; + x_34_phi = x_92; + break; + { + x_76_phi = false; + } + } + x_31 = x_34_phi; + const int x_93 = x_31; + int x_22_1[2] = localNumbers; + x_22_1[1u] = x_93; + const int x_22[2] = x_22_1; + localNumbers = x_22; + globalNumbers[0] = 0; + const int x_13 = x_22[1u]; + param = x_13; + x_17 = 0; + x_25_phi = 0; + while (true) { + const int x_25 = x_25_phi; + if ((x_25 <= x_13)) { + } else { + break; + } + const int x_102_save = x_13; + const int x_18 = globalNumbers[x_102_save]; + if ((x_18 <= 1)) { + globalNumbers[x_102_save] = 1; + } + { + const int x_19 = (x_25 + 1); + x_17 = x_19; + x_25_phi = x_19; + } + } + const float x_107 = asfloat(x_8[0].x); + const int x_14 = globalNumbers[(int(x_107) - 1)]; + const int x_15 = asint((x_24 + asint(x_14))); + acc = x_15; + { + const int x_16 = (x_23 + 1); + i_1 = x_16; + x_24_phi = x_15; + x_23_phi = x_16; + } + } + if ((x_24 == asint(4))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} + +int yieldsZero_() { + bool x_116 = false; + int x_20 = 0; + int i = 0; + int x_26 = 0; + int x_134 = 0; + bool x_118_phi = false; + int x_27_phi = 0; + x_118_phi = false; + while (true) { + bool x_123 = false; + int x_28 = 0; + bool x_123_phi = false; + int x_28_phi = 0; + int x_26_phi = 0; + bool x_132_phi = false; + const bool x_118 = x_118_phi; + i = 0; + x_123_phi = x_118; + x_28_phi = 0; + while (true) { + x_123 = x_123_phi; + x_28 = x_28_phi; + const float x_128 = asfloat(x_8[0].x); + x_26_phi = 0; + x_132_phi = x_123; + if ((x_28 < int(x_128))) { + } else { + break; + } + x_116 = true; + x_20 = x_28; + x_26_phi = x_28; + x_132_phi = true; + break; + { + x_123_phi = false; + x_28_phi = 0; + } + } + x_26 = x_26_phi; + const bool x_132 = x_132_phi; + x_27_phi = x_26; + if (x_132) { + break; + } + x_134 = 0; + x_116 = true; + x_20 = x_134; + x_27_phi = x_134; + break; + { + x_118_phi = false; + } + } + return x_27_phi; +} diff --git a/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..7d54d73fd2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.msl @@ -0,0 +1,213 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct tint_array_wrapper_1 { + int arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + bool x_68 = false; + int x_29 = 0; + int x_30 = 0; + int x_31 = 0; + tint_array_wrapper globalNumbers = {}; + int x_17 = 0; + int acc = 0; + int i_1 = 0; + tint_array_wrapper_1 localNumbers = {}; + int param = 0; + int x_24 = 0; + int x_24_phi = 0; + int x_23_phi = 0; + acc = 0; + i_1 = 0; + x_24_phi = 0; + x_23_phi = 0; + while (true) { + int x_33 = 0; + int x_92 = 0; + bool x_76_phi = false; + int x_34_phi = 0; + int x_25_phi = 0; + x_24 = x_24_phi; + int const x_23 = x_23_phi; + if ((x_23 < 4)) { + } else { + break; + } + x_68 = false; + x_76_phi = false; + while (true) { + bool x_81 = false; + int x_32 = 0; + bool x_81_phi = false; + int x_32_phi = 0; + int x_33_phi = 0; + bool x_90_phi = false; + bool const x_76 = x_76_phi; + x_30 = 0; + x_81_phi = x_76; + x_32_phi = 0; + while (true) { + x_81 = x_81_phi; + x_32 = x_32_phi; + float const x_86 = x_8.one; + x_33_phi = 0; + x_90_phi = x_81; + if ((x_32 < int(x_86))) { + } else { + break; + } + x_68 = true; + x_29 = x_32; + x_33_phi = x_32; + x_90_phi = true; + break; + { + x_81_phi = false; + x_32_phi = 0; + } + } + x_33 = x_33_phi; + bool const x_90 = x_90_phi; + x_34_phi = x_33; + if (x_90) { + break; + } + x_92 = 0; + x_68 = true; + x_29 = x_92; + x_34_phi = x_92; + break; + { + x_76_phi = false; + } + } + int const x_34 = x_34_phi; + x_31 = x_34; + int const x_93 = x_31; + tint_array_wrapper_1 const x_21 = localNumbers; + tint_array_wrapper_1 x_22_1 = x_21; + x_22_1.arr[1u] = x_93; + tint_array_wrapper_1 const x_22 = x_22_1; + localNumbers = x_22; + globalNumbers.arr[0] = 0; + int const x_13 = x_22.arr[1u]; + param = x_13; + x_17 = 0; + x_25_phi = 0; + while (true) { + int const x_25 = x_25_phi; + if ((x_25 <= x_13)) { + } else { + break; + } + int const x_102_save = x_13; + int const x_18 = globalNumbers.arr[x_102_save]; + if ((x_18 <= 1)) { + globalNumbers.arr[x_102_save] = 1; + } + { + int const x_19 = (x_25 + 1); + x_17 = x_19; + x_25_phi = x_19; + } + } + float const x_107 = x_8.one; + int const x_14 = globalNumbers.arr[(int(x_107) - 1)]; + int const x_15 = as_type((x_24 + as_type(x_14))); + acc = x_15; + { + int const x_16 = (x_23 + 1); + i_1 = x_16; + x_24_phi = x_15; + x_23_phi = x_16; + } + } + if ((x_24 == as_type(4))) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +int yieldsZero_(constant buf0& x_8) { + bool x_116 = false; + int x_20 = 0; + int i = 0; + int x_26 = 0; + int x_134 = 0; + bool x_118_phi = false; + int x_27_phi = 0; + x_118_phi = false; + while (true) { + bool x_123 = false; + int x_28 = 0; + bool x_123_phi = false; + int x_28_phi = 0; + int x_26_phi = 0; + bool x_132_phi = false; + bool const x_118 = x_118_phi; + i = 0; + x_123_phi = x_118; + x_28_phi = 0; + while (true) { + x_123 = x_123_phi; + x_28 = x_28_phi; + float const x_128 = x_8.one; + x_26_phi = 0; + x_132_phi = x_123; + if ((x_28 < int(x_128))) { + } else { + break; + } + x_116 = true; + x_20 = x_28; + x_26_phi = x_28; + x_132_phi = true; + break; + { + x_123_phi = false; + x_28_phi = 0; + } + } + x_26 = x_26_phi; + bool const x_132 = x_132_phi; + x_27_phi = x_26; + if (x_132) { + break; + } + x_134 = 0; + x_116 = true; + x_20 = x_134; + x_27_phi = x_134; + break; + { + x_118_phi = false; + } + } + int const x_27 = x_27_phi; + return x_27; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..02fd4f3558 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.spvasm @@ -0,0 +1,406 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 204 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_68 "x_68" + OpName %x_29 "x_29" + OpName %x_30 "x_30" + OpName %x_31 "x_31" + OpName %globalNumbers "globalNumbers" + OpName %x_17 "x_17" + OpName %acc "acc" + OpName %i_1 "i_1" + OpName %localNumbers "localNumbers" + OpName %param "param" + OpName %x_24 "x_24" + OpName %x_24_phi "x_24_phi" + OpName %x_23_phi "x_23_phi" + OpName %x_33 "x_33" + OpName %x_92 "x_92" + OpName %x_76_phi "x_76_phi" + OpName %x_34_phi "x_34_phi" + OpName %x_25_phi "x_25_phi" + OpName %x_81 "x_81" + OpName %x_32 "x_32" + OpName %x_81_phi "x_81_phi" + OpName %x_32_phi "x_32_phi" + OpName %x_33_phi "x_33_phi" + OpName %x_90_phi "x_90_phi" + OpName %x_22_1 "x_22_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %yieldsZero_ "yieldsZero_" + OpName %x_116 "x_116" + OpName %x_20 "x_20" + OpName %i "i" + OpName %x_26 "x_26" + OpName %x_134 "x_134" + OpName %x_118_phi "x_118_phi" + OpName %x_27_phi "x_27_phi" + OpName %x_123 "x_123" + OpName %x_28 "x_28" + OpName %x_123_phi "x_123_phi" + OpName %x_28_phi "x_28_phi" + OpName %x_26_phi "x_26_phi" + OpName %x_132_phi "x_132_phi" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %_arr_int_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %19 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %31 = OpConstantNull %_arr_int_uint_10 + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %39 = OpConstantNull %_arr_int_uint_2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %144 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %145 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %146 = OpTypeFunction %void %main_out + %158 = OpTypeFunction %int + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_68 = OpVariable %_ptr_Function_bool Function %19 + %x_29 = OpVariable %_ptr_Function_int Function %23 + %x_30 = OpVariable %_ptr_Function_int Function %23 + %x_31 = OpVariable %_ptr_Function_int Function %23 +%globalNumbers = OpVariable %_ptr_Function__arr_int_uint_10 Function %31 + %x_17 = OpVariable %_ptr_Function_int Function %23 + %acc = OpVariable %_ptr_Function_int Function %23 + %i_1 = OpVariable %_ptr_Function_int Function %23 +%localNumbers = OpVariable %_ptr_Function__arr_int_uint_2 Function %39 + %param = OpVariable %_ptr_Function_int Function %23 + %x_24 = OpVariable %_ptr_Function_int Function %23 + %x_24_phi = OpVariable %_ptr_Function_int Function %23 + %x_23_phi = OpVariable %_ptr_Function_int Function %23 + %x_33 = OpVariable %_ptr_Function_int Function %23 + %x_92 = OpVariable %_ptr_Function_int Function %23 + %x_76_phi = OpVariable %_ptr_Function_bool Function %19 + %x_34_phi = OpVariable %_ptr_Function_int Function %23 + %x_25_phi = OpVariable %_ptr_Function_int Function %23 + %x_81 = OpVariable %_ptr_Function_bool Function %19 + %x_32 = OpVariable %_ptr_Function_int Function %23 + %x_81_phi = OpVariable %_ptr_Function_bool Function %19 + %x_32_phi = OpVariable %_ptr_Function_int Function %23 + %x_33_phi = OpVariable %_ptr_Function_int Function %23 + %x_90_phi = OpVariable %_ptr_Function_bool Function %19 + %x_22_1 = OpVariable %_ptr_Function__arr_int_uint_2 Function %39 + OpStore %x_68 %false + OpStore %acc %int_0 + OpStore %i_1 %int_0 + OpStore %x_24_phi %int_0 + OpStore %x_23_phi %int_0 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %54 = OpLoad %int %x_24_phi + OpStore %x_24 %54 + %55 = OpLoad %int %x_23_phi + %57 = OpSLessThan %bool %55 %int_4 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %46 + %58 = OpLabel + OpStore %x_68 %false + OpStore %x_76_phi %false + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %71 = OpLoad %bool %x_76_phi + OpStore %x_30 %int_0 + OpStore %x_81_phi %71 + OpStore %x_32_phi %int_0 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %bool %x_81_phi + OpStore %x_81 %76 + %77 = OpLoad %int %x_32_phi + OpStore %x_32 %77 + %80 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 + %81 = OpLoad %float %80 + OpStore %x_33_phi %int_0 + %82 = OpLoad %bool %x_81 + OpStore %x_90_phi %82 + %83 = OpLoad %int %x_32 + %84 = OpConvertFToS %int %81 + %85 = OpSLessThan %bool %83 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + OpBranch %86 + %88 = OpLabel + OpBranch %73 + %86 = OpLabel + OpStore %x_68 %true + %90 = OpLoad %int %x_32 + OpStore %x_29 %90 + %91 = OpLoad %int %x_32 + OpStore %x_33_phi %91 + OpStore %x_90_phi %true + OpBranch %73 + %74 = OpLabel + OpStore %x_81_phi %false + OpStore %x_32_phi %int_0 + OpBranch %72 + %73 = OpLabel + %92 = OpLoad %int %x_33_phi + OpStore %x_33 %92 + %93 = OpLoad %bool %x_90_phi + %94 = OpLoad %int %x_33 + OpStore %x_34_phi %94 + OpSelectionMerge %95 None + OpBranchConditional %93 %96 %95 + %96 = OpLabel + OpBranch %62 + %95 = OpLabel + OpStore %x_92 %int_0 + OpStore %x_68 %true + %97 = OpLoad %int %x_92 + OpStore %x_29 %97 + %98 = OpLoad %int %x_92 + OpStore %x_34_phi %98 + OpBranch %62 + %63 = OpLabel + OpStore %x_76_phi %false + OpBranch %61 + %62 = OpLabel + %99 = OpLoad %int %x_34_phi + OpStore %x_31 %99 + %100 = OpLoad %int %x_31 + %101 = OpLoad %_arr_int_uint_2 %localNumbers + OpStore %x_22_1 %101 + %104 = OpAccessChain %_ptr_Function_int %x_22_1 %uint_1 + OpStore %104 %100 + %105 = OpLoad %_arr_int_uint_2 %x_22_1 + OpStore %localNumbers %105 + %106 = OpAccessChain %_ptr_Function_int %globalNumbers %int_0 + OpStore %106 %int_0 + %107 = OpCompositeExtract %int %105 1 + OpStore %param %107 + OpStore %x_17 %int_0 + OpStore %x_25_phi %int_0 + OpBranch %108 + %108 = OpLabel + OpLoopMerge %109 %110 None + OpBranch %111 + %111 = OpLabel + %112 = OpLoad %int %x_25_phi + %113 = OpSLessThanEqual %bool %112 %107 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %116 + %115 = OpLabel + OpBranch %114 + %116 = OpLabel + OpBranch %109 + %114 = OpLabel + %117 = OpAccessChain %_ptr_Function_int %globalNumbers %107 + %118 = OpLoad %int %117 + %120 = OpSLessThanEqual %bool %118 %int_1 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %121 + %122 = OpLabel + %123 = OpAccessChain %_ptr_Function_int %globalNumbers %107 + OpStore %123 %int_1 + OpBranch %121 + %121 = OpLabel + OpBranch %110 + %110 = OpLabel + %124 = OpIAdd %int %112 %int_1 + OpStore %x_17 %124 + OpStore %x_25_phi %124 + OpBranch %108 + %109 = OpLabel + %125 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 + %126 = OpLoad %float %125 + %127 = OpConvertFToS %int %126 + %128 = OpISub %int %127 %int_1 + %129 = OpAccessChain %_ptr_Function_int %globalNumbers %128 + %130 = OpLoad %int %129 + %132 = OpLoad %int %x_24 + %133 = OpCopyObject %int %130 + %134 = OpIAdd %int %132 %133 + %131 = OpCopyObject %int %134 + OpStore %acc %131 + OpBranch %47 + %47 = OpLabel + %135 = OpIAdd %int %55 %int_1 + OpStore %i_1 %135 + OpStore %x_24_phi %131 + OpStore %x_23_phi %135 + OpBranch %45 + %46 = OpLabel + %136 = OpLoad %int %x_24 + %137 = OpCopyObject %int %int_4 + %138 = OpIEqual %bool %136 %137 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpStore %x_GLF_color %144 + OpBranch %139 + %141 = OpLabel + OpStore %x_GLF_color %145 + OpBranch %139 + %139 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %146 +%tint_symbol = OpFunctionParameter %main_out + %150 = OpLabel + %151 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %151 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %153 = OpLabel + %154 = OpFunctionCall %void %main_1 + %156 = OpLoad %v4float %x_GLF_color + %157 = OpCompositeConstruct %main_out %156 + %155 = OpFunctionCall %void %tint_symbol_2 %157 + OpReturn + OpFunctionEnd +%yieldsZero_ = OpFunction %int None %158 + %160 = OpLabel + %x_116 = OpVariable %_ptr_Function_bool Function %19 + %x_20 = OpVariable %_ptr_Function_int Function %23 + %i = OpVariable %_ptr_Function_int Function %23 + %x_26 = OpVariable %_ptr_Function_int Function %23 + %x_134 = OpVariable %_ptr_Function_int Function %23 + %x_118_phi = OpVariable %_ptr_Function_bool Function %19 + %x_27_phi = OpVariable %_ptr_Function_int Function %23 + %x_123 = OpVariable %_ptr_Function_bool Function %19 + %x_28 = OpVariable %_ptr_Function_int Function %23 + %x_123_phi = OpVariable %_ptr_Function_bool Function %19 + %x_28_phi = OpVariable %_ptr_Function_int Function %23 + %x_26_phi = OpVariable %_ptr_Function_int Function %23 + %x_132_phi = OpVariable %_ptr_Function_bool Function %19 + OpStore %x_116 %false + OpStore %x_118_phi %false + OpBranch %168 + %168 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %178 = OpLoad %bool %x_118_phi + OpStore %i %int_0 + OpStore %x_123_phi %178 + OpStore %x_28_phi %int_0 + OpBranch %179 + %179 = OpLabel + OpLoopMerge %180 %181 None + OpBranch %182 + %182 = OpLabel + %183 = OpLoad %bool %x_123_phi + OpStore %x_123 %183 + %184 = OpLoad %int %x_28_phi + OpStore %x_28 %184 + %185 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 + %186 = OpLoad %float %185 + OpStore %x_26_phi %int_0 + %187 = OpLoad %bool %x_123 + OpStore %x_132_phi %187 + %188 = OpLoad %int %x_28 + %189 = OpConvertFToS %int %186 + %190 = OpSLessThan %bool %188 %189 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %193 + %192 = OpLabel + OpBranch %191 + %193 = OpLabel + OpBranch %180 + %191 = OpLabel + OpStore %x_116 %true + %194 = OpLoad %int %x_28 + OpStore %x_20 %194 + %195 = OpLoad %int %x_28 + OpStore %x_26_phi %195 + OpStore %x_132_phi %true + OpBranch %180 + %181 = OpLabel + OpStore %x_123_phi %false + OpStore %x_28_phi %int_0 + OpBranch %179 + %180 = OpLabel + %196 = OpLoad %int %x_26_phi + OpStore %x_26 %196 + %197 = OpLoad %bool %x_132_phi + %198 = OpLoad %int %x_26 + OpStore %x_27_phi %198 + OpSelectionMerge %199 None + OpBranchConditional %197 %200 %199 + %200 = OpLabel + OpBranch %169 + %199 = OpLabel + OpStore %x_134 %int_0 + OpStore %x_116 %true + %201 = OpLoad %int %x_134 + OpStore %x_20 %201 + %202 = OpLoad %int %x_134 + OpStore %x_27_phi %202 + OpBranch %169 + %170 = OpLabel + OpStore %x_118_phi %false + OpBranch %168 + %169 = OpLabel + %203 = OpLoad %int %x_27_phi + OpReturnValue %203 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..68df8e308b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/global-array-loops/0-opt.wgsl.expected.wgsl @@ -0,0 +1,212 @@ +[[block]] +struct buf0 { + one : f32; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_68 : bool = false; + var x_29 : i32; + var x_30 : i32; + var x_31 : i32; + var globalNumbers : array; + var x_17 : i32; + var acc : i32; + var i_1 : i32; + var localNumbers : array; + var param : i32; + var x_24 : i32; + var x_24_phi : i32; + var x_23_phi : i32; + acc = 0; + i_1 = 0; + x_24_phi = 0; + x_23_phi = 0; + loop { + var x_33 : i32; + var x_92 : i32; + var x_76_phi : bool; + var x_34_phi : i32; + var x_25_phi : i32; + x_24 = x_24_phi; + let x_23 : i32 = x_23_phi; + if ((x_23 < 4)) { + } else { + break; + } + x_68 = false; + x_76_phi = false; + loop { + var x_81 : bool; + var x_32 : i32; + var x_81_phi : bool; + var x_32_phi : i32; + var x_33_phi : i32; + var x_90_phi : bool; + let x_76 : bool = x_76_phi; + x_30 = 0; + x_81_phi = x_76; + x_32_phi = 0; + loop { + x_81 = x_81_phi; + x_32 = x_32_phi; + let x_86 : f32 = x_8.one; + x_33_phi = 0; + x_90_phi = x_81; + if ((x_32 < i32(x_86))) { + } else { + break; + } + x_68 = true; + x_29 = x_32; + x_33_phi = x_32; + x_90_phi = true; + break; + + continuing { + x_81_phi = false; + x_32_phi = 0; + } + } + x_33 = x_33_phi; + let x_90 : bool = x_90_phi; + x_34_phi = x_33; + if (x_90) { + break; + } + x_92 = 0; + x_68 = true; + x_29 = x_92; + x_34_phi = x_92; + break; + + continuing { + x_76_phi = false; + } + } + let x_34 : i32 = x_34_phi; + x_31 = x_34; + let x_93 : i32 = x_31; + let x_21 : array = localNumbers; + var x_22_1 : array = x_21; + x_22_1[1u] = x_93; + let x_22 : array = x_22_1; + localNumbers = x_22; + globalNumbers[0] = 0; + let x_95 : ptr = &(localNumbers[1]); + let x_13 : i32 = x_22[1u]; + param = x_13; + x_17 = 0; + x_25_phi = 0; + loop { + let x_25 : i32 = x_25_phi; + if ((x_25 <= x_13)) { + } else { + break; + } + let x_102 : ptr = &(globalNumbers[x_13]); + let x_18 : i32 = *(x_102); + if ((x_18 <= 1)) { + *(x_102) = 1; + } + + continuing { + let x_19 : i32 = (x_25 + 1); + x_17 = x_19; + x_25_phi = x_19; + } + } + let x_107 : f32 = x_8.one; + let x_14 : i32 = globalNumbers[(i32(x_107) - 1)]; + let x_15 : i32 = bitcast((x_24 + bitcast(x_14))); + acc = x_15; + + continuing { + let x_16 : i32 = (x_23 + 1); + i_1 = x_16; + x_24_phi = x_15; + x_23_phi = x_16; + } + } + if ((x_24 == bitcast(4))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn yieldsZero_() -> i32 { + var x_116 : bool = false; + var x_20 : i32; + var i : i32; + var x_26 : i32; + var x_134 : i32; + var x_118_phi : bool; + var x_27_phi : i32; + x_118_phi = false; + loop { + var x_123 : bool; + var x_28 : i32; + var x_123_phi : bool; + var x_28_phi : i32; + var x_26_phi : i32; + var x_132_phi : bool; + let x_118 : bool = x_118_phi; + i = 0; + x_123_phi = x_118; + x_28_phi = 0; + loop { + x_123 = x_123_phi; + x_28 = x_28_phi; + let x_128 : f32 = x_8.one; + x_26_phi = 0; + x_132_phi = x_123; + if ((x_28 < i32(x_128))) { + } else { + break; + } + x_116 = true; + x_20 = x_28; + x_26_phi = x_28; + x_132_phi = true; + break; + + continuing { + x_123_phi = false; + x_28_phi = 0; + } + } + x_26 = x_26_phi; + let x_132 : bool = x_132_phi; + x_27_phi = x_26; + if (x_132) { + break; + } + x_134 = 0; + x_116 = true; + x_20 = x_134; + x_27_phi = x_134; + break; + + continuing { + x_118_phi = false; + } + } + let x_27 : i32 = x_27_phi; + return x_27; +} diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm new file mode 100644 index 0000000000..28e20bd1e5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm @@ -0,0 +1,74 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %data "data" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %bool = OpTypeBool + %28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %29 = OpUndef %float + %main = OpFunction %void None %8 + %30 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_2 Function + %31 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %32 = OpLoad %float %31 + %33 = OpAccessChain %_ptr_Function_float %data %int_0 + OpStore %33 %32 + %34 = OpAccessChain %_ptr_Function_float %data %int_1 + OpStore %34 %32 + OpStore %_GLF_color %26 + %35 = OpLoad %float %34 + %36 = OpFOrdGreaterThan %bool %35 %float_1 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + %39 = OpConvertFToS %int %32 + OpSelectionMerge %40 None + OpSwitch %39 %40 0 %41 1 %42 + %40 = OpLabel + OpBranch %37 + %41 = OpLabel + OpBranch %42 + %42 = OpLabel + %43 = OpPhi %float %29 %38 %float_1 %41 + %44 = OpAccessChain %_ptr_Function_float %data %39 + OpStore %44 %43 + OpStore %_GLF_color %28 + OpBranch %40 + %37 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..583cd9775f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.hlsl @@ -0,0 +1,48 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float data[2] = (float[2])0; + float x_32 = 0.0f; + x_32 = asfloat(x_6[0].x); + data[0] = x_32; + data[1] = x_32; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_35 = data[1]; + if ((x_35 > 1.0f)) { + float x_43_phi = 0.0f; + const int x_39 = int(x_32); + x_43_phi = 0.0f; + switch(x_39) { + case 0: { + x_43_phi = 1.0f; + /* fallthrough */ + } + case 1: { + data[x_39] = x_43_phi; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + break; + } + default: { + break; + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.msl new file mode 100644 index 0000000000..b4c618f954 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + tint_array_wrapper data = {}; + float x_32 = 0.0f; + x_32 = x_6.injectionSwitch.x; + data.arr[0] = x_32; + data.arr[1] = x_32; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + float const x_35 = data.arr[1]; + if ((x_35 > 1.0f)) { + float x_43_phi = 0.0f; + int const x_39 = int(x_32); + x_43_phi = 0.0f; + switch(x_39) { + case 0: { + x_43_phi = 1.0f; + /* fallthrough */ + } + case 1: { + float const x_43 = x_43_phi; + data.arr[x_39] = x_43; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + break; + } + default: { + break; + } + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..a5e407def1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.spvasm @@ -0,0 +1,120 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %data "data" + OpName %x_32 "x_32" + OpName %x_43_phi "x_43_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %21 = OpConstantNull %_arr_float_uint_2 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %bool = OpTypeBool + %54 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_2 Function %21 + %x_32 = OpVariable %_ptr_Function_float Function %24 + %x_43_phi = OpVariable %_ptr_Function_float Function %24 + %27 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %28 = OpLoad %float %27 + OpStore %x_32 %28 + %31 = OpAccessChain %_ptr_Function_float %data %int_0 + %32 = OpLoad %float %x_32 + OpStore %31 %32 + %34 = OpAccessChain %_ptr_Function_float %data %int_1 + %35 = OpLoad %float %x_32 + OpStore %34 %35 + OpStore %x_GLF_color %38 + %39 = OpAccessChain %_ptr_Function_float %data %int_1 + %40 = OpLoad %float %39 + %41 = OpFOrdGreaterThan %bool %40 %float_1 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %43 + %44 = OpLabel + %47 = OpLoad %float %x_32 + %46 = OpConvertFToS %int %47 + OpStore %x_43_phi %float_0 + OpSelectionMerge %48 None + OpSwitch %46 %49 0 %50 1 %51 + %50 = OpLabel + OpStore %x_43_phi %float_1 + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %float %x_43_phi + %53 = OpAccessChain %_ptr_Function_float %data %46 + OpStore %53 %52 + OpStore %x_GLF_color %54 + OpBranch %48 + %49 = OpLabel + OpBranch %48 + %48 = OpLabel + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..71828f630a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.wgsl @@ -0,0 +1,49 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var x_32 : f32; + x_32 = x_6.injectionSwitch.x; + data[0] = x_32; + let x_34 : ptr = &(data[1]); + *(x_34) = x_32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_35 : f32 = *(x_34); + if ((x_35 > 1.0)) { + var x_43_phi : f32; + let x_39 : i32 = i32(x_32); + x_43_phi = 0.0; + switch(x_39) { + case 0: { + x_43_phi = 1.0; + fallthrough; + } + case 1: { + let x_43 : f32 = x_43_phi; + data[x_39] = x_43; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + default: { + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl new file mode 100644 index 0000000000..71828f630a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl @@ -0,0 +1,49 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var x_32 : f32; + x_32 = x_6.injectionSwitch.x; + data[0] = x_32; + let x_34 : ptr = &(data[1]); + *(x_34) = x_32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_35 : f32 = *(x_34); + if ((x_35 > 1.0)) { + var x_43_phi : f32; + let x_39 : i32 = i32(x_32); + x_43_phi = 0.0; + switch(x_39) { + case 0: { + x_43_phi = 1.0; + fallthrough; + } + case 1: { + let x_43 : f32 = x_43_phi; + data[x_39] = x_43; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + default: { + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..583cd9775f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.hlsl @@ -0,0 +1,48 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float data[2] = (float[2])0; + float x_32 = 0.0f; + x_32 = asfloat(x_6[0].x); + data[0] = x_32; + data[1] = x_32; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_35 = data[1]; + if ((x_35 > 1.0f)) { + float x_43_phi = 0.0f; + const int x_39 = int(x_32); + x_43_phi = 0.0f; + switch(x_39) { + case 0: { + x_43_phi = 1.0f; + /* fallthrough */ + } + case 1: { + data[x_39] = x_43_phi; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + break; + } + default: { + break; + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.msl new file mode 100644 index 0000000000..b4c618f954 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[2]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + tint_array_wrapper data = {}; + float x_32 = 0.0f; + x_32 = x_6.injectionSwitch.x; + data.arr[0] = x_32; + data.arr[1] = x_32; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + float const x_35 = data.arr[1]; + if ((x_35 > 1.0f)) { + float x_43_phi = 0.0f; + int const x_39 = int(x_32); + x_43_phi = 0.0f; + switch(x_39) { + case 0: { + x_43_phi = 1.0f; + /* fallthrough */ + } + case 1: { + float const x_43 = x_43_phi; + data.arr[x_39] = x_43; + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + break; + } + default: { + break; + } + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..a5e407def1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.spvasm @@ -0,0 +1,120 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %data "data" + OpName %x_32 "x_32" + OpName %x_43_phi "x_43_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 + %21 = OpConstantNull %_arr_float_uint_2 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %bool = OpTypeBool + %54 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_2 Function %21 + %x_32 = OpVariable %_ptr_Function_float Function %24 + %x_43_phi = OpVariable %_ptr_Function_float Function %24 + %27 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %28 = OpLoad %float %27 + OpStore %x_32 %28 + %31 = OpAccessChain %_ptr_Function_float %data %int_0 + %32 = OpLoad %float %x_32 + OpStore %31 %32 + %34 = OpAccessChain %_ptr_Function_float %data %int_1 + %35 = OpLoad %float %x_32 + OpStore %34 %35 + OpStore %x_GLF_color %38 + %39 = OpAccessChain %_ptr_Function_float %data %int_1 + %40 = OpLoad %float %39 + %41 = OpFOrdGreaterThan %bool %40 %float_1 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %43 + %44 = OpLabel + %47 = OpLoad %float %x_32 + %46 = OpConvertFToS %int %47 + OpStore %x_43_phi %float_0 + OpSelectionMerge %48 None + OpSwitch %46 %49 0 %50 1 %51 + %50 = OpLabel + OpStore %x_43_phi %float_1 + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %float %x_43_phi + %53 = OpAccessChain %_ptr_Function_float %data %46 + OpStore %53 %52 + OpStore %x_GLF_color %54 + OpBranch %48 + %49 = OpLabel + OpBranch %48 + %48 = OpLabel + OpBranch %43 + %43 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..71828f630a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.wgsl @@ -0,0 +1,49 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var x_32 : f32; + x_32 = x_6.injectionSwitch.x; + data[0] = x_32; + let x_34 : ptr = &(data[1]); + *(x_34) = x_32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_35 : f32 = *(x_34); + if ((x_35 > 1.0)) { + var x_43_phi : f32; + let x_39 : i32 = i32(x_32); + x_43_phi = 0.0; + switch(x_39) { + case 0: { + x_43_phi = 1.0; + fallthrough; + } + case 1: { + let x_43 : f32 = x_43_phi; + data[x_39] = x_43; + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + default: { + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm new file mode 100644 index 0000000000..e90127693a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm @@ -0,0 +1,275 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_n1 = OpConstant %float -1 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %int_4 = OpConstant %int 4 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %33 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %36 = OpUndef %int + %main = OpFunction %void None %8 + %37 = OpLabel + OpBranch %38 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %40 = OpLoad %float %39 + %41 = OpFOrdLessThan %bool %40 %float_n1 + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpPhi %bool %false %38 %46 %47 + %48 = OpPhi %int %int_0 %38 %49 %47 + %50 = OpPhi %int %36 %38 %51 %47 + %52 = OpPhi %int %int_0 %38 %53 %47 + %54 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %55 = OpLoad %float %54 + %56 = OpFOrdGreaterThan %bool %55 %float_n1 + %57 = OpSelect %int %56 %int_10 %int_100 + %58 = OpSLessThan %bool %52 %57 + OpLoopMerge %59 %47 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + OpBranch %61 + %61 = OpLabel + %62 = OpPhi %int %48 %60 %63 %64 + %65 = OpPhi %int %50 %60 %66 %64 + %67 = OpPhi %int %int_0 %60 %68 %64 + %69 = OpSLessThan %bool %67 %int_2 + OpLoopMerge %70 %64 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %77 = OpLoad %float %76 + %78 = OpFOrdLessThan %bool %77 %float_n1 + %79 = OpFOrdLessThan %bool %40 %float_0 + %80 = OpLogicalNot %bool %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + OpSelectionMerge %83 None + OpBranchConditional %78 %84 %83 + %84 = OpLabel + OpBranch %73 + %83 = OpLabel + OpBranch %85 + %85 = OpLabel + %86 = OpPhi %int %int_1 %83 %87 %88 + %89 = OpSLessThan %bool %86 %int_3 + OpLoopMerge %90 %88 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + OpSelectionMerge %92 None + OpBranchConditional %78 %93 %92 + %93 = OpLabel + OpBranch %88 + %92 = OpLabel + %94 = OpSGreaterThan %bool %86 %int_0 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + OpBranch %90 + %95 = OpLabel + OpBranch %88 + %88 = OpLabel + %87 = OpIAdd %int %86 %int_1 + OpBranch %85 + %90 = OpLabel + %97 = OpPhi %int %65 %85 %int_1 %96 + %98 = OpPhi %bool %false %85 %true %96 + OpSelectionMerge %99 None + OpBranchConditional %98 %73 %99 + %99 = OpLabel + OpBranch %81 + %81 = OpLabel + OpBranch %73 + %74 = OpLabel + OpBranch %72 + %73 = OpLabel + %66 = OpPhi %int %int_0 %84 %97 %90 %int_0 %81 + %63 = OpIAdd %int %62 %66 + OpSelectionMerge %100 None + OpBranchConditional %41 %101 %100 + %101 = OpLabel + OpBranch %102 + %102 = OpLabel + OpLoopMerge %103 %104 None + OpBranchConditional %41 %104 %103 + %104 = OpLabel + %105 = OpConvertSToF %float %52 + %106 = OpCompositeConstruct %v4float %105 %105 %105 %105 + OpStore %_GLF_color %106 + OpBranch %102 + %103 = OpLabel + OpBranch %70 + %100 = OpLabel + OpBranch %64 + %64 = OpLabel + %68 = OpIAdd %int %67 %int_1 + OpBranch %61 + %70 = OpLabel + %51 = OpPhi %int %65 %61 %66 %103 + %49 = OpPhi %int %62 %61 %63 %103 + %46 = OpPhi %bool %45 %61 %true %103 + OpSelectionMerge %107 None + OpBranchConditional %46 %59 %107 + %107 = OpLabel + %108 = OpLogicalNot %bool %41 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %109 + %110 = OpLabel + OpBranch %59 + %109 = OpLabel + OpBranch %47 + %47 = OpLabel + %53 = OpIAdd %int %52 %int_1 + OpBranch %44 + %59 = OpLabel + %111 = OpPhi %int %48 %44 %49 %70 %49 %110 + %112 = OpPhi %bool %45 %44 %46 %70 %46 %110 + OpSelectionMerge %113 None + OpBranchConditional %112 %42 %113 + %113 = OpLabel + OpBranch %114 + %114 = OpLabel + %115 = OpPhi %int %111 %113 %116 %117 + %118 = OpPhi %int %36 %113 %119 %117 + %120 = OpPhi %int %int_0 %113 %121 %117 + %122 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %123 = OpLoad %float %122 + %124 = OpFAdd %float %123 %float_1 + %125 = OpConvertFToS %int %124 + %126 = OpSLessThan %bool %120 %125 + OpLoopMerge %127 %117 None + OpBranchConditional %126 %128 %127 + %128 = OpLabel + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %133 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %134 = OpLoad %float %133 + %135 = OpFOrdLessThan %bool %134 %float_n1 + %136 = OpFOrdLessThan %bool %40 %float_0 + %137 = OpLogicalNot %bool %136 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %138 + %139 = OpLabel + OpSelectionMerge %140 None + OpBranchConditional %135 %141 %140 + %141 = OpLabel + OpBranch %130 + %140 = OpLabel + OpBranch %142 + %142 = OpLabel + %143 = OpPhi %int %int_1 %140 %144 %145 + %146 = OpSLessThan %bool %143 %int_3 + OpLoopMerge %147 %145 None + OpBranchConditional %146 %148 %147 + %148 = OpLabel + OpSelectionMerge %149 None + OpBranchConditional %135 %150 %149 + %150 = OpLabel + OpBranch %145 + %149 = OpLabel + %151 = OpSGreaterThan %bool %143 %int_0 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %152 + %153 = OpLabel + OpBranch %147 + %152 = OpLabel + OpBranch %145 + %145 = OpLabel + %144 = OpIAdd %int %143 %int_1 + OpBranch %142 + %147 = OpLabel + %154 = OpPhi %int %118 %142 %int_1 %153 + %155 = OpPhi %bool %false %142 %true %153 + OpSelectionMerge %156 None + OpBranchConditional %155 %130 %156 + %156 = OpLabel + OpBranch %138 + %138 = OpLabel + OpBranch %130 + %131 = OpLabel + OpBranch %129 + %130 = OpLabel + %119 = OpPhi %int %int_0 %141 %154 %147 %int_0 %138 + %116 = OpIAdd %int %115 %119 + %157 = OpLogicalNot %bool %41 + %158 = OpSelect %bool %157 %false %41 + OpSelectionMerge %159 None + OpBranchConditional %158 %160 %159 + %160 = OpLabel + OpBranch %127 + %159 = OpLabel + OpBranch %117 + %117 = OpLabel + %121 = OpIAdd %int %120 %int_1 + OpBranch %114 + %127 = OpLabel + %161 = OpPhi %int %115 %114 %116 %160 + %162 = OpIEqual %bool %161 %int_4 + OpSelectionMerge %163 None + OpBranchConditional %162 %164 %165 + %165 = OpLabel + OpStore %_GLF_color %33 + OpBranch %163 + %164 = OpLabel + OpStore %_GLF_color %32 + OpBranch %163 + %163 = OpLabel + OpBranch %42 + %43 = OpLabel + OpBranch %38 + %42 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..f57ad42d75 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.hlsl @@ -0,0 +1,276 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + while (true) { + bool x_45 = false; + int x_48 = 0; + int x_49 = 0; + bool x_46 = false; + int x_115 = 0; + int x_116 = 0; + bool x_45_phi = false; + int x_48_phi = 0; + int x_50_phi = 0; + int x_52_phi = 0; + int x_111_phi = 0; + bool x_112_phi = false; + int x_115_phi = 0; + int x_118_phi = 0; + int x_120_phi = 0; + int x_161_phi = 0; + const float x_40 = asfloat(x_6[0].x); + const bool x_41 = (x_40 < -1.0f); + x_45_phi = false; + x_48_phi = 0; + x_50_phi = 0; + x_52_phi = 0; + while (true) { + int x_62 = 0; + int x_65 = 0; + int x_66 = 0; + int x_63 = 0; + int x_53 = 0; + int x_62_phi = 0; + int x_65_phi = 0; + int x_67_phi = 0; + int x_51_phi = 0; + int x_49_phi = 0; + bool x_46_phi = false; + x_45 = x_45_phi; + x_48 = x_48_phi; + const int x_50 = x_50_phi; + const int x_52 = x_52_phi; + const float x_55 = gl_FragCoord.y; + x_111_phi = x_48; + x_112_phi = x_45; + if ((x_52 < ((x_55 > -1.0f) ? 10 : 100))) { + } else { + break; + } + x_62_phi = x_48; + x_65_phi = x_50; + x_67_phi = 0; + while (true) { + int x_97 = 0; + int x_68 = 0; + int x_66_phi = 0; + x_62 = x_62_phi; + x_65 = x_65_phi; + const int x_67 = x_67_phi; + x_51_phi = x_65; + x_49_phi = x_62; + x_46_phi = x_45; + if ((x_67 < 2)) { + } else { + break; + } + while (true) { + bool x_78 = false; + int x_86_phi = 0; + int x_97_phi = 0; + bool x_98_phi = false; + const float x_77 = gl_FragCoord.x; + x_78 = (x_77 < -1.0f); + if (!((x_40 < 0.0f))) { + if (x_78) { + x_66_phi = 0; + break; + } + x_86_phi = 1; + while (true) { + int x_87 = 0; + const int x_86 = x_86_phi; + x_97_phi = x_65; + x_98_phi = false; + if ((x_86 < 3)) { + } else { + break; + } + if (x_78) { + { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + continue; + } + if ((x_86 > 0)) { + x_97_phi = 1; + x_98_phi = true; + break; + } + { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + } + x_97 = x_97_phi; + const bool x_98 = x_98_phi; + x_66_phi = x_97; + if (x_98) { + break; + } + } + x_66_phi = 0; + break; + } + x_66 = x_66_phi; + x_63 = asint((x_62 + x_66)); + if (x_41) { + while (true) { + if (x_41) { + } else { + break; + } + { + const float x_105 = float(x_52); + x_GLF_color = float4(x_105, x_105, x_105, x_105); + } + } + x_51_phi = x_66; + x_49_phi = x_63; + x_46_phi = true; + break; + } + { + x_68 = (x_67 + 1); + x_62_phi = x_63; + x_65_phi = x_66; + x_67_phi = x_68; + } + } + const int x_51 = x_51_phi; + x_49 = x_49_phi; + x_46 = x_46_phi; + x_111_phi = x_49; + x_112_phi = x_46; + if (x_46) { + break; + } + if (!(x_41)) { + x_111_phi = x_49; + x_112_phi = x_46; + break; + } + { + x_53 = (x_52 + 1); + x_45_phi = x_46; + x_48_phi = x_49; + x_50_phi = x_51; + x_52_phi = x_53; + } + } + const int x_111 = x_111_phi; + if (x_112_phi) { + break; + } + x_115_phi = x_111; + x_118_phi = 0; + x_120_phi = 0; + while (true) { + int x_154 = 0; + int x_121 = 0; + int x_119_phi = 0; + x_115 = x_115_phi; + const int x_118 = x_118_phi; + const int x_120 = x_120_phi; + const float x_123 = asfloat(x_6[0].y); + x_161_phi = x_115; + if ((x_120 < int((x_123 + 1.0f)))) { + } else { + break; + } + while (true) { + bool x_135 = false; + int x_143_phi = 0; + int x_154_phi = 0; + bool x_155_phi = false; + const float x_134 = gl_FragCoord.x; + x_135 = (x_134 < -1.0f); + if (!((x_40 < 0.0f))) { + if (x_135) { + x_119_phi = 0; + break; + } + x_143_phi = 1; + while (true) { + int x_144 = 0; + const int x_143 = x_143_phi; + x_154_phi = x_118; + x_155_phi = false; + if ((x_143 < 3)) { + } else { + break; + } + if (x_135) { + { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + continue; + } + if ((x_143 > 0)) { + x_154_phi = 1; + x_155_phi = true; + break; + } + { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + } + x_154 = x_154_phi; + const bool x_155 = x_155_phi; + x_119_phi = x_154; + if (x_155) { + break; + } + } + x_119_phi = 0; + break; + } + int x_119 = 0; + x_119 = x_119_phi; + x_116 = asint((x_115 + x_119)); + if ((!(x_41) ? false : x_41)) { + x_161_phi = x_116; + break; + } + { + x_121 = (x_120 + 1); + x_115_phi = x_116; + x_118_phi = x_119; + x_120_phi = x_121; + } + } + if ((x_161_phi == 4)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.msl new file mode 100644 index 0000000000..f21f0fac8d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.msl @@ -0,0 +1,277 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + while (true) { + bool x_45 = false; + int x_48 = 0; + int x_49 = 0; + bool x_46 = false; + int x_115 = 0; + int x_116 = 0; + bool x_45_phi = false; + int x_48_phi = 0; + int x_50_phi = 0; + int x_52_phi = 0; + int x_111_phi = 0; + bool x_112_phi = false; + int x_115_phi = 0; + int x_118_phi = 0; + int x_120_phi = 0; + int x_161_phi = 0; + float const x_40 = x_6.injectionSwitch.x; + bool const x_41 = (x_40 < -1.0f); + x_45_phi = false; + x_48_phi = 0; + x_50_phi = 0; + x_52_phi = 0; + while (true) { + int x_62 = 0; + int x_65 = 0; + int x_66 = 0; + int x_63 = 0; + int x_53 = 0; + int x_62_phi = 0; + int x_65_phi = 0; + int x_67_phi = 0; + int x_51_phi = 0; + int x_49_phi = 0; + bool x_46_phi = false; + x_45 = x_45_phi; + x_48 = x_48_phi; + int const x_50 = x_50_phi; + int const x_52 = x_52_phi; + float const x_55 = (*(tint_symbol_5)).y; + x_111_phi = x_48; + x_112_phi = x_45; + if ((x_52 < select(100, 10, (x_55 > -1.0f)))) { + } else { + break; + } + x_62_phi = x_48; + x_65_phi = x_50; + x_67_phi = 0; + while (true) { + int x_97 = 0; + int x_68 = 0; + int x_66_phi = 0; + x_62 = x_62_phi; + x_65 = x_65_phi; + int const x_67 = x_67_phi; + x_51_phi = x_65; + x_49_phi = x_62; + x_46_phi = x_45; + if ((x_67 < 2)) { + } else { + break; + } + while (true) { + bool x_78 = false; + int x_86_phi = 0; + int x_97_phi = 0; + bool x_98_phi = false; + float const x_77 = (*(tint_symbol_5)).x; + x_78 = (x_77 < -1.0f); + if (!((x_40 < 0.0f))) { + if (x_78) { + x_66_phi = 0; + break; + } + x_86_phi = 1; + while (true) { + int x_87 = 0; + int const x_86 = x_86_phi; + x_97_phi = x_65; + x_98_phi = false; + if ((x_86 < 3)) { + } else { + break; + } + if (x_78) { + { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + continue; + } + if ((x_86 > 0)) { + x_97_phi = 1; + x_98_phi = true; + break; + } + { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + } + x_97 = x_97_phi; + bool const x_98 = x_98_phi; + x_66_phi = x_97; + if (x_98) { + break; + } + } + x_66_phi = 0; + break; + } + x_66 = x_66_phi; + x_63 = as_type((x_62 + x_66)); + if (x_41) { + while (true) { + if (x_41) { + } else { + break; + } + { + float const x_105 = float(x_52); + *(tint_symbol_6) = float4(x_105, x_105, x_105, x_105); + } + } + x_51_phi = x_66; + x_49_phi = x_63; + x_46_phi = true; + break; + } + { + x_68 = (x_67 + 1); + x_62_phi = x_63; + x_65_phi = x_66; + x_67_phi = x_68; + } + } + int const x_51 = x_51_phi; + x_49 = x_49_phi; + x_46 = x_46_phi; + x_111_phi = x_49; + x_112_phi = x_46; + if (x_46) { + break; + } + if (!(x_41)) { + x_111_phi = x_49; + x_112_phi = x_46; + break; + } + { + x_53 = (x_52 + 1); + x_45_phi = x_46; + x_48_phi = x_49; + x_50_phi = x_51; + x_52_phi = x_53; + } + } + int const x_111 = x_111_phi; + bool const x_112 = x_112_phi; + if (x_112) { + break; + } + x_115_phi = x_111; + x_118_phi = 0; + x_120_phi = 0; + while (true) { + int x_154 = 0; + int x_121 = 0; + int x_119_phi = 0; + x_115 = x_115_phi; + int const x_118 = x_118_phi; + int const x_120 = x_120_phi; + float const x_123 = x_6.injectionSwitch.y; + x_161_phi = x_115; + if ((x_120 < int((x_123 + 1.0f)))) { + } else { + break; + } + while (true) { + bool x_135 = false; + int x_143_phi = 0; + int x_154_phi = 0; + bool x_155_phi = false; + float const x_134 = (*(tint_symbol_5)).x; + x_135 = (x_134 < -1.0f); + if (!((x_40 < 0.0f))) { + if (x_135) { + x_119_phi = 0; + break; + } + x_143_phi = 1; + while (true) { + int x_144 = 0; + int const x_143 = x_143_phi; + x_154_phi = x_118; + x_155_phi = false; + if ((x_143 < 3)) { + } else { + break; + } + if (x_135) { + { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + continue; + } + if ((x_143 > 0)) { + x_154_phi = 1; + x_155_phi = true; + break; + } + { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + } + x_154 = x_154_phi; + bool const x_155 = x_155_phi; + x_119_phi = x_154; + if (x_155) { + break; + } + } + x_119_phi = 0; + break; + } + int x_119 = 0; + x_119 = x_119_phi; + x_116 = as_type((x_115 + x_119)); + if (select(x_41, false, !(x_41))) { + x_161_phi = x_116; + break; + } + { + x_121 = (x_120 + 1); + x_115_phi = x_116; + x_118_phi = x_119; + x_120_phi = x_121; + } + } + int const x_161 = x_161_phi; + if ((x_161 == 4)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + break; + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..5bea6cccc3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.spvasm @@ -0,0 +1,566 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 292 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_45 "x_45" + OpName %x_48 "x_48" + OpName %x_49 "x_49" + OpName %x_46 "x_46" + OpName %x_115 "x_115" + OpName %x_116 "x_116" + OpName %x_45_phi "x_45_phi" + OpName %x_48_phi "x_48_phi" + OpName %x_50_phi "x_50_phi" + OpName %x_52_phi "x_52_phi" + OpName %x_111_phi "x_111_phi" + OpName %x_112_phi "x_112_phi" + OpName %x_115_phi "x_115_phi" + OpName %x_118_phi "x_118_phi" + OpName %x_120_phi "x_120_phi" + OpName %x_161_phi "x_161_phi" + OpName %x_62 "x_62" + OpName %x_65 "x_65" + OpName %x_66 "x_66" + OpName %x_63 "x_63" + OpName %x_53 "x_53" + OpName %x_62_phi "x_62_phi" + OpName %x_65_phi "x_65_phi" + OpName %x_67_phi "x_67_phi" + OpName %x_51_phi "x_51_phi" + OpName %x_49_phi "x_49_phi" + OpName %x_46_phi "x_46_phi" + OpName %x_97 "x_97" + OpName %x_68 "x_68" + OpName %x_66_phi "x_66_phi" + OpName %x_78 "x_78" + OpName %x_86_phi "x_86_phi" + OpName %x_97_phi "x_97_phi" + OpName %x_98_phi "x_98_phi" + OpName %x_87 "x_87" + OpName %x_154 "x_154" + OpName %x_121 "x_121" + OpName %x_119_phi "x_119_phi" + OpName %x_135 "x_135" + OpName %x_143_phi "x_143_phi" + OpName %x_154_phi "x_154_phi" + OpName %x_155_phi "x_155_phi" + OpName %x_144 "x_144" + OpName %x_119 "x_119" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %26 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_n1 = OpConstant %float -1 + %false = OpConstantFalse %bool + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %int_2 = OpConstant %int 2 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %int_4 = OpConstant %int 4 + %277 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %278 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %279 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_45 = OpVariable %_ptr_Function_bool Function %26 + %x_48 = OpVariable %_ptr_Function_int Function %30 + %x_49 = OpVariable %_ptr_Function_int Function %30 + %x_46 = OpVariable %_ptr_Function_bool Function %26 + %x_115 = OpVariable %_ptr_Function_int Function %30 + %x_116 = OpVariable %_ptr_Function_int Function %30 + %x_45_phi = OpVariable %_ptr_Function_bool Function %26 + %x_48_phi = OpVariable %_ptr_Function_int Function %30 + %x_50_phi = OpVariable %_ptr_Function_int Function %30 + %x_52_phi = OpVariable %_ptr_Function_int Function %30 + %x_111_phi = OpVariable %_ptr_Function_int Function %30 + %x_112_phi = OpVariable %_ptr_Function_bool Function %26 + %x_115_phi = OpVariable %_ptr_Function_int Function %30 + %x_118_phi = OpVariable %_ptr_Function_int Function %30 + %x_120_phi = OpVariable %_ptr_Function_int Function %30 + %x_161_phi = OpVariable %_ptr_Function_int Function %30 + %x_62 = OpVariable %_ptr_Function_int Function %30 + %x_65 = OpVariable %_ptr_Function_int Function %30 + %x_66 = OpVariable %_ptr_Function_int Function %30 + %x_63 = OpVariable %_ptr_Function_int Function %30 + %x_53 = OpVariable %_ptr_Function_int Function %30 + %x_62_phi = OpVariable %_ptr_Function_int Function %30 + %x_65_phi = OpVariable %_ptr_Function_int Function %30 + %x_67_phi = OpVariable %_ptr_Function_int Function %30 + %x_51_phi = OpVariable %_ptr_Function_int Function %30 + %x_49_phi = OpVariable %_ptr_Function_int Function %30 + %x_46_phi = OpVariable %_ptr_Function_bool Function %26 + %x_97 = OpVariable %_ptr_Function_int Function %30 + %x_68 = OpVariable %_ptr_Function_int Function %30 + %x_66_phi = OpVariable %_ptr_Function_int Function %30 + %x_78 = OpVariable %_ptr_Function_bool Function %26 + %x_86_phi = OpVariable %_ptr_Function_int Function %30 + %x_97_phi = OpVariable %_ptr_Function_int Function %30 + %x_98_phi = OpVariable %_ptr_Function_bool Function %26 + %x_87 = OpVariable %_ptr_Function_int Function %30 + %x_154 = OpVariable %_ptr_Function_int Function %30 + %x_121 = OpVariable %_ptr_Function_int Function %30 + %x_119_phi = OpVariable %_ptr_Function_int Function %30 + %x_135 = OpVariable %_ptr_Function_bool Function %26 + %x_143_phi = OpVariable %_ptr_Function_int Function %30 + %x_154_phi = OpVariable %_ptr_Function_int Function %30 + %x_155_phi = OpVariable %_ptr_Function_bool Function %26 + %x_144 = OpVariable %_ptr_Function_int Function %30 + %x_119 = OpVariable %_ptr_Function_int Function %30 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %49 = OpLoad %float %48 + %51 = OpFOrdLessThan %bool %49 %float_n1 + OpStore %x_45_phi %false + OpStore %x_48_phi %int_0 + OpStore %x_50_phi %int_0 + OpStore %x_52_phi %int_0 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %69 = OpLoad %bool %x_45_phi + OpStore %x_45 %69 + %70 = OpLoad %int %x_48_phi + OpStore %x_48 %70 + %71 = OpLoad %int %x_50_phi + %72 = OpLoad %int %x_52_phi + %75 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %76 = OpLoad %float %75 + %77 = OpLoad %int %x_48 + OpStore %x_111_phi %77 + %78 = OpLoad %bool %x_45 + OpStore %x_112_phi %78 + %80 = OpFOrdGreaterThan %bool %76 %float_n1 + %79 = OpSelect %int %80 %int_10 %int_100 + %83 = OpSLessThan %bool %72 %79 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + OpBranch %84 + %86 = OpLabel + OpBranch %55 + %84 = OpLabel + %87 = OpLoad %int %x_48 + OpStore %x_62_phi %87 + OpStore %x_65_phi %71 + OpStore %x_67_phi %int_0 + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %95 = OpLoad %int %x_62_phi + OpStore %x_62 %95 + %96 = OpLoad %int %x_65_phi + OpStore %x_65 %96 + %97 = OpLoad %int %x_67_phi + %98 = OpLoad %int %x_65 + OpStore %x_51_phi %98 + %99 = OpLoad %int %x_62 + OpStore %x_49_phi %99 + %100 = OpLoad %bool %x_45 + OpStore %x_46_phi %100 + %102 = OpSLessThan %bool %97 %int_2 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + OpBranch %103 + %105 = OpLabel + OpBranch %89 + %103 = OpLabel + OpBranch %106 + %106 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %114 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %115 = OpLoad %float %114 + %116 = OpFOrdLessThan %bool %115 %float_n1 + OpStore %x_78 %116 + %119 = OpFOrdLessThan %bool %49 %float_0 + %117 = OpLogicalNot %bool %119 + OpSelectionMerge %120 None + OpBranchConditional %117 %121 %120 + %121 = OpLabel + %122 = OpLoad %bool %x_78 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %123 + %124 = OpLabel + OpStore %x_66_phi %int_0 + OpBranch %107 + %123 = OpLabel + OpStore %x_86_phi %int_1 + OpBranch %126 + %126 = OpLabel + OpLoopMerge %127 %128 None + OpBranch %129 + %129 = OpLabel + %131 = OpLoad %int %x_86_phi + %132 = OpLoad %int %x_65 + OpStore %x_97_phi %132 + OpStore %x_98_phi %false + %134 = OpSLessThan %bool %131 %int_3 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 + %136 = OpLabel + OpBranch %135 + %137 = OpLabel + OpBranch %127 + %135 = OpLabel + %138 = OpLoad %bool %x_78 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + OpBranch %128 + %139 = OpLabel + %141 = OpSGreaterThan %bool %131 %int_0 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %142 + %143 = OpLabel + OpStore %x_97_phi %int_1 + OpStore %x_98_phi %true + OpBranch %127 + %142 = OpLabel + OpBranch %128 + %128 = OpLabel + %145 = OpIAdd %int %131 %int_1 + OpStore %x_87 %145 + %146 = OpLoad %int %x_87 + OpStore %x_86_phi %146 + OpBranch %126 + %127 = OpLabel + %147 = OpLoad %int %x_97_phi + OpStore %x_97 %147 + %148 = OpLoad %bool %x_98_phi + %149 = OpLoad %int %x_97 + OpStore %x_66_phi %149 + OpSelectionMerge %150 None + OpBranchConditional %148 %151 %150 + %151 = OpLabel + OpBranch %107 + %150 = OpLabel + OpBranch %120 + %120 = OpLabel + OpStore %x_66_phi %int_0 + OpBranch %107 + %108 = OpLabel + OpBranch %106 + %107 = OpLabel + %152 = OpLoad %int %x_66_phi + OpStore %x_66 %152 + %154 = OpLoad %int %x_62 + %155 = OpLoad %int %x_66 + %156 = OpIAdd %int %154 %155 + %153 = OpCopyObject %int %156 + OpStore %x_63 %153 + OpSelectionMerge %157 None + OpBranchConditional %51 %158 %157 + %158 = OpLabel + OpBranch %159 + %159 = OpLabel + OpLoopMerge %160 %161 None + OpBranch %162 + %162 = OpLabel + OpSelectionMerge %163 None + OpBranchConditional %51 %164 %165 + %164 = OpLabel + OpBranch %163 + %165 = OpLabel + OpBranch %160 + %163 = OpLabel + OpBranch %161 + %161 = OpLabel + %166 = OpConvertSToF %float %72 + %167 = OpCompositeConstruct %v4float %166 %166 %166 %166 + OpStore %x_GLF_color %167 + OpBranch %159 + %160 = OpLabel + %168 = OpLoad %int %x_66 + OpStore %x_51_phi %168 + %169 = OpLoad %int %x_63 + OpStore %x_49_phi %169 + OpStore %x_46_phi %true + OpBranch %89 + %157 = OpLabel + OpBranch %90 + %90 = OpLabel + %170 = OpIAdd %int %97 %int_1 + OpStore %x_68 %170 + %171 = OpLoad %int %x_63 + OpStore %x_62_phi %171 + %172 = OpLoad %int %x_66 + OpStore %x_65_phi %172 + %173 = OpLoad %int %x_68 + OpStore %x_67_phi %173 + OpBranch %88 + %89 = OpLabel + %174 = OpLoad %int %x_51_phi + %175 = OpLoad %int %x_49_phi + OpStore %x_49 %175 + %176 = OpLoad %bool %x_46_phi + OpStore %x_46 %176 + %177 = OpLoad %int %x_49 + OpStore %x_111_phi %177 + %178 = OpLoad %bool %x_46 + OpStore %x_112_phi %178 + %179 = OpLoad %bool %x_46 + OpSelectionMerge %180 None + OpBranchConditional %179 %181 %180 + %181 = OpLabel + OpBranch %55 + %180 = OpLabel + %182 = OpLogicalNot %bool %51 + OpSelectionMerge %183 None + OpBranchConditional %182 %184 %183 + %184 = OpLabel + %185 = OpLoad %int %x_49 + OpStore %x_111_phi %185 + %186 = OpLoad %bool %x_46 + OpStore %x_112_phi %186 + OpBranch %55 + %183 = OpLabel + OpBranch %56 + %56 = OpLabel + %187 = OpIAdd %int %72 %int_1 + OpStore %x_53 %187 + %188 = OpLoad %bool %x_46 + OpStore %x_45_phi %188 + %189 = OpLoad %int %x_49 + OpStore %x_48_phi %189 + OpStore %x_50_phi %174 + %190 = OpLoad %int %x_53 + OpStore %x_52_phi %190 + OpBranch %54 + %55 = OpLabel + %191 = OpLoad %int %x_111_phi + %192 = OpLoad %bool %x_112_phi + OpSelectionMerge %193 None + OpBranchConditional %192 %194 %193 + %194 = OpLabel + OpBranch %20 + %193 = OpLabel + OpStore %x_115_phi %191 + OpStore %x_118_phi %int_0 + OpStore %x_120_phi %int_0 + OpBranch %195 + %195 = OpLabel + OpLoopMerge %196 %197 None + OpBranch %198 + %198 = OpLabel + %202 = OpLoad %int %x_115_phi + OpStore %x_115 %202 + %203 = OpLoad %int %x_118_phi + %204 = OpLoad %int %x_120_phi + %205 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %206 = OpLoad %float %205 + %207 = OpLoad %int %x_115 + OpStore %x_161_phi %207 + %210 = OpFAdd %float %206 %float_1 + %208 = OpConvertFToS %int %210 + %211 = OpSLessThan %bool %204 %208 + OpSelectionMerge %212 None + OpBranchConditional %211 %213 %214 + %213 = OpLabel + OpBranch %212 + %214 = OpLabel + OpBranch %196 + %212 = OpLabel + OpBranch %215 + %215 = OpLabel + OpLoopMerge %216 %217 None + OpBranch %218 + %218 = OpLabel + %223 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %224 = OpLoad %float %223 + %225 = OpFOrdLessThan %bool %224 %float_n1 + OpStore %x_135 %225 + %227 = OpFOrdLessThan %bool %49 %float_0 + %226 = OpLogicalNot %bool %227 + OpSelectionMerge %228 None + OpBranchConditional %226 %229 %228 + %229 = OpLabel + %230 = OpLoad %bool %x_135 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %231 + %232 = OpLabel + OpStore %x_119_phi %int_0 + OpBranch %216 + %231 = OpLabel + OpStore %x_143_phi %int_1 + OpBranch %233 + %233 = OpLabel + OpLoopMerge %234 %235 None + OpBranch %236 + %236 = OpLabel + %238 = OpLoad %int %x_143_phi + OpStore %x_154_phi %203 + OpStore %x_155_phi %false + %239 = OpSLessThan %bool %238 %int_3 + OpSelectionMerge %240 None + OpBranchConditional %239 %241 %242 + %241 = OpLabel + OpBranch %240 + %242 = OpLabel + OpBranch %234 + %240 = OpLabel + %243 = OpLoad %bool %x_135 + OpSelectionMerge %244 None + OpBranchConditional %243 %245 %244 + %245 = OpLabel + OpBranch %235 + %244 = OpLabel + %246 = OpSGreaterThan %bool %238 %int_0 + OpSelectionMerge %247 None + OpBranchConditional %246 %248 %247 + %248 = OpLabel + OpStore %x_154_phi %int_1 + OpStore %x_155_phi %true + OpBranch %234 + %247 = OpLabel + OpBranch %235 + %235 = OpLabel + %249 = OpIAdd %int %238 %int_1 + OpStore %x_144 %249 + %250 = OpLoad %int %x_144 + OpStore %x_143_phi %250 + OpBranch %233 + %234 = OpLabel + %251 = OpLoad %int %x_154_phi + OpStore %x_154 %251 + %252 = OpLoad %bool %x_155_phi + %253 = OpLoad %int %x_154 + OpStore %x_119_phi %253 + OpSelectionMerge %254 None + OpBranchConditional %252 %255 %254 + %255 = OpLabel + OpBranch %216 + %254 = OpLabel + OpBranch %228 + %228 = OpLabel + OpStore %x_119_phi %int_0 + OpBranch %216 + %217 = OpLabel + OpBranch %215 + %216 = OpLabel + %257 = OpLoad %int %x_119_phi + OpStore %x_119 %257 + %259 = OpLoad %int %x_115 + %260 = OpLoad %int %x_119 + %261 = OpIAdd %int %259 %260 + %258 = OpCopyObject %int %261 + OpStore %x_116 %258 + %263 = OpLogicalNot %bool %51 + %262 = OpSelect %bool %263 %false %51 + OpSelectionMerge %264 None + OpBranchConditional %262 %265 %264 + %265 = OpLabel + %266 = OpLoad %int %x_116 + OpStore %x_161_phi %266 + OpBranch %196 + %264 = OpLabel + OpBranch %197 + %197 = OpLabel + %267 = OpIAdd %int %204 %int_1 + OpStore %x_121 %267 + %268 = OpLoad %int %x_116 + OpStore %x_115_phi %268 + %269 = OpLoad %int %x_119 + OpStore %x_118_phi %269 + %270 = OpLoad %int %x_121 + OpStore %x_120_phi %270 + OpBranch %195 + %196 = OpLabel + %271 = OpLoad %int %x_161_phi + %273 = OpIEqual %bool %271 %int_4 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %276 + %275 = OpLabel + OpStore %x_GLF_color %277 + OpBranch %274 + %276 = OpLabel + OpStore %x_GLF_color %278 + OpBranch %274 + %274 = OpLabel + OpBranch %20 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %279 +%tint_symbol_1 = OpFunctionParameter %main_out + %283 = OpLabel + %284 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %284 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %286 = OpLabel + %287 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %287 + %288 = OpFunctionCall %void %main_1 + %290 = OpLoad %v4float %x_GLF_color + %291 = OpCompositeConstruct %main_out %290 + %289 = OpFunctionCall %void %tint_symbol_3 %291 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..7b1d98075e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.wgsl @@ -0,0 +1,274 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + loop { + var x_45 : bool; + var x_48 : i32; + var x_49 : i32; + var x_46 : bool; + var x_115 : i32; + var x_116 : i32; + var x_45_phi : bool; + var x_48_phi : i32; + var x_50_phi : i32; + var x_52_phi : i32; + var x_111_phi : i32; + var x_112_phi : bool; + var x_115_phi : i32; + var x_118_phi : i32; + var x_120_phi : i32; + var x_161_phi : i32; + let x_40 : f32 = x_6.injectionSwitch.x; + let x_41 : bool = (x_40 < -1.0); + x_45_phi = false; + x_48_phi = 0; + x_50_phi = 0; + x_52_phi = 0; + loop { + var x_62 : i32; + var x_65 : i32; + var x_66 : i32; + var x_63 : i32; + var x_53 : i32; + var x_62_phi : i32; + var x_65_phi : i32; + var x_67_phi : i32; + var x_51_phi : i32; + var x_49_phi : i32; + var x_46_phi : bool; + x_45 = x_45_phi; + x_48 = x_48_phi; + let x_50 : i32 = x_50_phi; + let x_52 : i32 = x_52_phi; + let x_55 : f32 = gl_FragCoord.y; + x_111_phi = x_48; + x_112_phi = x_45; + if ((x_52 < select(100, 10, (x_55 > -1.0)))) { + } else { + break; + } + x_62_phi = x_48; + x_65_phi = x_50; + x_67_phi = 0; + loop { + var x_97 : i32; + var x_68 : i32; + var x_66_phi : i32; + x_62 = x_62_phi; + x_65 = x_65_phi; + let x_67 : i32 = x_67_phi; + x_51_phi = x_65; + x_49_phi = x_62; + x_46_phi = x_45; + if ((x_67 < 2)) { + } else { + break; + } + loop { + var x_78 : bool; + var x_86_phi : i32; + var x_97_phi : i32; + var x_98_phi : bool; + let x_77 : f32 = gl_FragCoord.x; + x_78 = (x_77 < -1.0); + if (!((x_40 < 0.0))) { + if (x_78) { + x_66_phi = 0; + break; + } + x_86_phi = 1; + loop { + var x_87 : i32; + let x_86 : i32 = x_86_phi; + x_97_phi = x_65; + x_98_phi = false; + if ((x_86 < 3)) { + } else { + break; + } + if (x_78) { + continue; + } + if ((x_86 > 0)) { + x_97_phi = 1; + x_98_phi = true; + break; + } + + continuing { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + } + x_97 = x_97_phi; + let x_98 : bool = x_98_phi; + x_66_phi = x_97; + if (x_98) { + break; + } + } + x_66_phi = 0; + break; + } + x_66 = x_66_phi; + x_63 = bitcast((x_62 + x_66)); + if (x_41) { + loop { + if (x_41) { + } else { + break; + } + + continuing { + let x_105 : f32 = f32(x_52); + x_GLF_color = vec4(x_105, x_105, x_105, x_105); + } + } + x_51_phi = x_66; + x_49_phi = x_63; + x_46_phi = true; + break; + } + + continuing { + x_68 = (x_67 + 1); + x_62_phi = x_63; + x_65_phi = x_66; + x_67_phi = x_68; + } + } + let x_51 : i32 = x_51_phi; + x_49 = x_49_phi; + x_46 = x_46_phi; + x_111_phi = x_49; + x_112_phi = x_46; + if (x_46) { + break; + } + if (!(x_41)) { + x_111_phi = x_49; + x_112_phi = x_46; + break; + } + + continuing { + x_53 = (x_52 + 1); + x_45_phi = x_46; + x_48_phi = x_49; + x_50_phi = x_51; + x_52_phi = x_53; + } + } + let x_111 : i32 = x_111_phi; + let x_112 : bool = x_112_phi; + if (x_112) { + break; + } + x_115_phi = x_111; + x_118_phi = 0; + x_120_phi = 0; + loop { + var x_154 : i32; + var x_121 : i32; + var x_119_phi : i32; + x_115 = x_115_phi; + let x_118 : i32 = x_118_phi; + let x_120 : i32 = x_120_phi; + let x_123 : f32 = x_6.injectionSwitch.y; + x_161_phi = x_115; + if ((x_120 < i32((x_123 + 1.0)))) { + } else { + break; + } + loop { + var x_135 : bool; + var x_143_phi : i32; + var x_154_phi : i32; + var x_155_phi : bool; + let x_134 : f32 = gl_FragCoord.x; + x_135 = (x_134 < -1.0); + if (!((x_40 < 0.0))) { + if (x_135) { + x_119_phi = 0; + break; + } + x_143_phi = 1; + loop { + var x_144 : i32; + let x_143 : i32 = x_143_phi; + x_154_phi = x_118; + x_155_phi = false; + if ((x_143 < 3)) { + } else { + break; + } + if (x_135) { + continue; + } + if ((x_143 > 0)) { + x_154_phi = 1; + x_155_phi = true; + break; + } + + continuing { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + } + x_154 = x_154_phi; + let x_155 : bool = x_155_phi; + x_119_phi = x_154; + if (x_155) { + break; + } + } + x_119_phi = 0; + break; + } + var x_119 : i32; + x_119 = x_119_phi; + x_116 = bitcast((x_115 + x_119)); + if (select(x_41, false, !(x_41))) { + x_161_phi = x_116; + break; + } + + continuing { + x_121 = (x_120 + 1); + x_115_phi = x_116; + x_118_phi = x_119; + x_120_phi = x_121; + } + } + let x_161 : i32 = x_161_phi; + if ((x_161 == 4)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl new file mode 100644 index 0000000000..7b1d98075e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl @@ -0,0 +1,274 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + loop { + var x_45 : bool; + var x_48 : i32; + var x_49 : i32; + var x_46 : bool; + var x_115 : i32; + var x_116 : i32; + var x_45_phi : bool; + var x_48_phi : i32; + var x_50_phi : i32; + var x_52_phi : i32; + var x_111_phi : i32; + var x_112_phi : bool; + var x_115_phi : i32; + var x_118_phi : i32; + var x_120_phi : i32; + var x_161_phi : i32; + let x_40 : f32 = x_6.injectionSwitch.x; + let x_41 : bool = (x_40 < -1.0); + x_45_phi = false; + x_48_phi = 0; + x_50_phi = 0; + x_52_phi = 0; + loop { + var x_62 : i32; + var x_65 : i32; + var x_66 : i32; + var x_63 : i32; + var x_53 : i32; + var x_62_phi : i32; + var x_65_phi : i32; + var x_67_phi : i32; + var x_51_phi : i32; + var x_49_phi : i32; + var x_46_phi : bool; + x_45 = x_45_phi; + x_48 = x_48_phi; + let x_50 : i32 = x_50_phi; + let x_52 : i32 = x_52_phi; + let x_55 : f32 = gl_FragCoord.y; + x_111_phi = x_48; + x_112_phi = x_45; + if ((x_52 < select(100, 10, (x_55 > -1.0)))) { + } else { + break; + } + x_62_phi = x_48; + x_65_phi = x_50; + x_67_phi = 0; + loop { + var x_97 : i32; + var x_68 : i32; + var x_66_phi : i32; + x_62 = x_62_phi; + x_65 = x_65_phi; + let x_67 : i32 = x_67_phi; + x_51_phi = x_65; + x_49_phi = x_62; + x_46_phi = x_45; + if ((x_67 < 2)) { + } else { + break; + } + loop { + var x_78 : bool; + var x_86_phi : i32; + var x_97_phi : i32; + var x_98_phi : bool; + let x_77 : f32 = gl_FragCoord.x; + x_78 = (x_77 < -1.0); + if (!((x_40 < 0.0))) { + if (x_78) { + x_66_phi = 0; + break; + } + x_86_phi = 1; + loop { + var x_87 : i32; + let x_86 : i32 = x_86_phi; + x_97_phi = x_65; + x_98_phi = false; + if ((x_86 < 3)) { + } else { + break; + } + if (x_78) { + continue; + } + if ((x_86 > 0)) { + x_97_phi = 1; + x_98_phi = true; + break; + } + + continuing { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + } + x_97 = x_97_phi; + let x_98 : bool = x_98_phi; + x_66_phi = x_97; + if (x_98) { + break; + } + } + x_66_phi = 0; + break; + } + x_66 = x_66_phi; + x_63 = bitcast((x_62 + x_66)); + if (x_41) { + loop { + if (x_41) { + } else { + break; + } + + continuing { + let x_105 : f32 = f32(x_52); + x_GLF_color = vec4(x_105, x_105, x_105, x_105); + } + } + x_51_phi = x_66; + x_49_phi = x_63; + x_46_phi = true; + break; + } + + continuing { + x_68 = (x_67 + 1); + x_62_phi = x_63; + x_65_phi = x_66; + x_67_phi = x_68; + } + } + let x_51 : i32 = x_51_phi; + x_49 = x_49_phi; + x_46 = x_46_phi; + x_111_phi = x_49; + x_112_phi = x_46; + if (x_46) { + break; + } + if (!(x_41)) { + x_111_phi = x_49; + x_112_phi = x_46; + break; + } + + continuing { + x_53 = (x_52 + 1); + x_45_phi = x_46; + x_48_phi = x_49; + x_50_phi = x_51; + x_52_phi = x_53; + } + } + let x_111 : i32 = x_111_phi; + let x_112 : bool = x_112_phi; + if (x_112) { + break; + } + x_115_phi = x_111; + x_118_phi = 0; + x_120_phi = 0; + loop { + var x_154 : i32; + var x_121 : i32; + var x_119_phi : i32; + x_115 = x_115_phi; + let x_118 : i32 = x_118_phi; + let x_120 : i32 = x_120_phi; + let x_123 : f32 = x_6.injectionSwitch.y; + x_161_phi = x_115; + if ((x_120 < i32((x_123 + 1.0)))) { + } else { + break; + } + loop { + var x_135 : bool; + var x_143_phi : i32; + var x_154_phi : i32; + var x_155_phi : bool; + let x_134 : f32 = gl_FragCoord.x; + x_135 = (x_134 < -1.0); + if (!((x_40 < 0.0))) { + if (x_135) { + x_119_phi = 0; + break; + } + x_143_phi = 1; + loop { + var x_144 : i32; + let x_143 : i32 = x_143_phi; + x_154_phi = x_118; + x_155_phi = false; + if ((x_143 < 3)) { + } else { + break; + } + if (x_135) { + continue; + } + if ((x_143 > 0)) { + x_154_phi = 1; + x_155_phi = true; + break; + } + + continuing { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + } + x_154 = x_154_phi; + let x_155 : bool = x_155_phi; + x_119_phi = x_154; + if (x_155) { + break; + } + } + x_119_phi = 0; + break; + } + var x_119 : i32; + x_119 = x_119_phi; + x_116 = bitcast((x_115 + x_119)); + if (select(x_41, false, !(x_41))) { + x_161_phi = x_116; + break; + } + + continuing { + x_121 = (x_120 + 1); + x_115_phi = x_116; + x_118_phi = x_119; + x_120_phi = x_121; + } + } + let x_161 : i32 = x_161_phi; + if ((x_161 == 4)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..f57ad42d75 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.hlsl @@ -0,0 +1,276 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + while (true) { + bool x_45 = false; + int x_48 = 0; + int x_49 = 0; + bool x_46 = false; + int x_115 = 0; + int x_116 = 0; + bool x_45_phi = false; + int x_48_phi = 0; + int x_50_phi = 0; + int x_52_phi = 0; + int x_111_phi = 0; + bool x_112_phi = false; + int x_115_phi = 0; + int x_118_phi = 0; + int x_120_phi = 0; + int x_161_phi = 0; + const float x_40 = asfloat(x_6[0].x); + const bool x_41 = (x_40 < -1.0f); + x_45_phi = false; + x_48_phi = 0; + x_50_phi = 0; + x_52_phi = 0; + while (true) { + int x_62 = 0; + int x_65 = 0; + int x_66 = 0; + int x_63 = 0; + int x_53 = 0; + int x_62_phi = 0; + int x_65_phi = 0; + int x_67_phi = 0; + int x_51_phi = 0; + int x_49_phi = 0; + bool x_46_phi = false; + x_45 = x_45_phi; + x_48 = x_48_phi; + const int x_50 = x_50_phi; + const int x_52 = x_52_phi; + const float x_55 = gl_FragCoord.y; + x_111_phi = x_48; + x_112_phi = x_45; + if ((x_52 < ((x_55 > -1.0f) ? 10 : 100))) { + } else { + break; + } + x_62_phi = x_48; + x_65_phi = x_50; + x_67_phi = 0; + while (true) { + int x_97 = 0; + int x_68 = 0; + int x_66_phi = 0; + x_62 = x_62_phi; + x_65 = x_65_phi; + const int x_67 = x_67_phi; + x_51_phi = x_65; + x_49_phi = x_62; + x_46_phi = x_45; + if ((x_67 < 2)) { + } else { + break; + } + while (true) { + bool x_78 = false; + int x_86_phi = 0; + int x_97_phi = 0; + bool x_98_phi = false; + const float x_77 = gl_FragCoord.x; + x_78 = (x_77 < -1.0f); + if (!((x_40 < 0.0f))) { + if (x_78) { + x_66_phi = 0; + break; + } + x_86_phi = 1; + while (true) { + int x_87 = 0; + const int x_86 = x_86_phi; + x_97_phi = x_65; + x_98_phi = false; + if ((x_86 < 3)) { + } else { + break; + } + if (x_78) { + { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + continue; + } + if ((x_86 > 0)) { + x_97_phi = 1; + x_98_phi = true; + break; + } + { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + } + x_97 = x_97_phi; + const bool x_98 = x_98_phi; + x_66_phi = x_97; + if (x_98) { + break; + } + } + x_66_phi = 0; + break; + } + x_66 = x_66_phi; + x_63 = asint((x_62 + x_66)); + if (x_41) { + while (true) { + if (x_41) { + } else { + break; + } + { + const float x_105 = float(x_52); + x_GLF_color = float4(x_105, x_105, x_105, x_105); + } + } + x_51_phi = x_66; + x_49_phi = x_63; + x_46_phi = true; + break; + } + { + x_68 = (x_67 + 1); + x_62_phi = x_63; + x_65_phi = x_66; + x_67_phi = x_68; + } + } + const int x_51 = x_51_phi; + x_49 = x_49_phi; + x_46 = x_46_phi; + x_111_phi = x_49; + x_112_phi = x_46; + if (x_46) { + break; + } + if (!(x_41)) { + x_111_phi = x_49; + x_112_phi = x_46; + break; + } + { + x_53 = (x_52 + 1); + x_45_phi = x_46; + x_48_phi = x_49; + x_50_phi = x_51; + x_52_phi = x_53; + } + } + const int x_111 = x_111_phi; + if (x_112_phi) { + break; + } + x_115_phi = x_111; + x_118_phi = 0; + x_120_phi = 0; + while (true) { + int x_154 = 0; + int x_121 = 0; + int x_119_phi = 0; + x_115 = x_115_phi; + const int x_118 = x_118_phi; + const int x_120 = x_120_phi; + const float x_123 = asfloat(x_6[0].y); + x_161_phi = x_115; + if ((x_120 < int((x_123 + 1.0f)))) { + } else { + break; + } + while (true) { + bool x_135 = false; + int x_143_phi = 0; + int x_154_phi = 0; + bool x_155_phi = false; + const float x_134 = gl_FragCoord.x; + x_135 = (x_134 < -1.0f); + if (!((x_40 < 0.0f))) { + if (x_135) { + x_119_phi = 0; + break; + } + x_143_phi = 1; + while (true) { + int x_144 = 0; + const int x_143 = x_143_phi; + x_154_phi = x_118; + x_155_phi = false; + if ((x_143 < 3)) { + } else { + break; + } + if (x_135) { + { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + continue; + } + if ((x_143 > 0)) { + x_154_phi = 1; + x_155_phi = true; + break; + } + { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + } + x_154 = x_154_phi; + const bool x_155 = x_155_phi; + x_119_phi = x_154; + if (x_155) { + break; + } + } + x_119_phi = 0; + break; + } + int x_119 = 0; + x_119 = x_119_phi; + x_116 = asint((x_115 + x_119)); + if ((!(x_41) ? false : x_41)) { + x_161_phi = x_116; + break; + } + { + x_121 = (x_120 + 1); + x_115_phi = x_116; + x_118_phi = x_119; + x_120_phi = x_121; + } + } + if ((x_161_phi == 4)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.msl new file mode 100644 index 0000000000..f21f0fac8d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.msl @@ -0,0 +1,277 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + while (true) { + bool x_45 = false; + int x_48 = 0; + int x_49 = 0; + bool x_46 = false; + int x_115 = 0; + int x_116 = 0; + bool x_45_phi = false; + int x_48_phi = 0; + int x_50_phi = 0; + int x_52_phi = 0; + int x_111_phi = 0; + bool x_112_phi = false; + int x_115_phi = 0; + int x_118_phi = 0; + int x_120_phi = 0; + int x_161_phi = 0; + float const x_40 = x_6.injectionSwitch.x; + bool const x_41 = (x_40 < -1.0f); + x_45_phi = false; + x_48_phi = 0; + x_50_phi = 0; + x_52_phi = 0; + while (true) { + int x_62 = 0; + int x_65 = 0; + int x_66 = 0; + int x_63 = 0; + int x_53 = 0; + int x_62_phi = 0; + int x_65_phi = 0; + int x_67_phi = 0; + int x_51_phi = 0; + int x_49_phi = 0; + bool x_46_phi = false; + x_45 = x_45_phi; + x_48 = x_48_phi; + int const x_50 = x_50_phi; + int const x_52 = x_52_phi; + float const x_55 = (*(tint_symbol_5)).y; + x_111_phi = x_48; + x_112_phi = x_45; + if ((x_52 < select(100, 10, (x_55 > -1.0f)))) { + } else { + break; + } + x_62_phi = x_48; + x_65_phi = x_50; + x_67_phi = 0; + while (true) { + int x_97 = 0; + int x_68 = 0; + int x_66_phi = 0; + x_62 = x_62_phi; + x_65 = x_65_phi; + int const x_67 = x_67_phi; + x_51_phi = x_65; + x_49_phi = x_62; + x_46_phi = x_45; + if ((x_67 < 2)) { + } else { + break; + } + while (true) { + bool x_78 = false; + int x_86_phi = 0; + int x_97_phi = 0; + bool x_98_phi = false; + float const x_77 = (*(tint_symbol_5)).x; + x_78 = (x_77 < -1.0f); + if (!((x_40 < 0.0f))) { + if (x_78) { + x_66_phi = 0; + break; + } + x_86_phi = 1; + while (true) { + int x_87 = 0; + int const x_86 = x_86_phi; + x_97_phi = x_65; + x_98_phi = false; + if ((x_86 < 3)) { + } else { + break; + } + if (x_78) { + { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + continue; + } + if ((x_86 > 0)) { + x_97_phi = 1; + x_98_phi = true; + break; + } + { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + } + x_97 = x_97_phi; + bool const x_98 = x_98_phi; + x_66_phi = x_97; + if (x_98) { + break; + } + } + x_66_phi = 0; + break; + } + x_66 = x_66_phi; + x_63 = as_type((x_62 + x_66)); + if (x_41) { + while (true) { + if (x_41) { + } else { + break; + } + { + float const x_105 = float(x_52); + *(tint_symbol_6) = float4(x_105, x_105, x_105, x_105); + } + } + x_51_phi = x_66; + x_49_phi = x_63; + x_46_phi = true; + break; + } + { + x_68 = (x_67 + 1); + x_62_phi = x_63; + x_65_phi = x_66; + x_67_phi = x_68; + } + } + int const x_51 = x_51_phi; + x_49 = x_49_phi; + x_46 = x_46_phi; + x_111_phi = x_49; + x_112_phi = x_46; + if (x_46) { + break; + } + if (!(x_41)) { + x_111_phi = x_49; + x_112_phi = x_46; + break; + } + { + x_53 = (x_52 + 1); + x_45_phi = x_46; + x_48_phi = x_49; + x_50_phi = x_51; + x_52_phi = x_53; + } + } + int const x_111 = x_111_phi; + bool const x_112 = x_112_phi; + if (x_112) { + break; + } + x_115_phi = x_111; + x_118_phi = 0; + x_120_phi = 0; + while (true) { + int x_154 = 0; + int x_121 = 0; + int x_119_phi = 0; + x_115 = x_115_phi; + int const x_118 = x_118_phi; + int const x_120 = x_120_phi; + float const x_123 = x_6.injectionSwitch.y; + x_161_phi = x_115; + if ((x_120 < int((x_123 + 1.0f)))) { + } else { + break; + } + while (true) { + bool x_135 = false; + int x_143_phi = 0; + int x_154_phi = 0; + bool x_155_phi = false; + float const x_134 = (*(tint_symbol_5)).x; + x_135 = (x_134 < -1.0f); + if (!((x_40 < 0.0f))) { + if (x_135) { + x_119_phi = 0; + break; + } + x_143_phi = 1; + while (true) { + int x_144 = 0; + int const x_143 = x_143_phi; + x_154_phi = x_118; + x_155_phi = false; + if ((x_143 < 3)) { + } else { + break; + } + if (x_135) { + { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + continue; + } + if ((x_143 > 0)) { + x_154_phi = 1; + x_155_phi = true; + break; + } + { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + } + x_154 = x_154_phi; + bool const x_155 = x_155_phi; + x_119_phi = x_154; + if (x_155) { + break; + } + } + x_119_phi = 0; + break; + } + int x_119 = 0; + x_119 = x_119_phi; + x_116 = as_type((x_115 + x_119)); + if (select(x_41, false, !(x_41))) { + x_161_phi = x_116; + break; + } + { + x_121 = (x_120 + 1); + x_115_phi = x_116; + x_118_phi = x_119; + x_120_phi = x_121; + } + } + int const x_161 = x_161_phi; + if ((x_161 == 4)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + break; + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..5bea6cccc3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.spvasm @@ -0,0 +1,566 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 292 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_45 "x_45" + OpName %x_48 "x_48" + OpName %x_49 "x_49" + OpName %x_46 "x_46" + OpName %x_115 "x_115" + OpName %x_116 "x_116" + OpName %x_45_phi "x_45_phi" + OpName %x_48_phi "x_48_phi" + OpName %x_50_phi "x_50_phi" + OpName %x_52_phi "x_52_phi" + OpName %x_111_phi "x_111_phi" + OpName %x_112_phi "x_112_phi" + OpName %x_115_phi "x_115_phi" + OpName %x_118_phi "x_118_phi" + OpName %x_120_phi "x_120_phi" + OpName %x_161_phi "x_161_phi" + OpName %x_62 "x_62" + OpName %x_65 "x_65" + OpName %x_66 "x_66" + OpName %x_63 "x_63" + OpName %x_53 "x_53" + OpName %x_62_phi "x_62_phi" + OpName %x_65_phi "x_65_phi" + OpName %x_67_phi "x_67_phi" + OpName %x_51_phi "x_51_phi" + OpName %x_49_phi "x_49_phi" + OpName %x_46_phi "x_46_phi" + OpName %x_97 "x_97" + OpName %x_68 "x_68" + OpName %x_66_phi "x_66_phi" + OpName %x_78 "x_78" + OpName %x_86_phi "x_86_phi" + OpName %x_97_phi "x_97_phi" + OpName %x_98_phi "x_98_phi" + OpName %x_87 "x_87" + OpName %x_154 "x_154" + OpName %x_121 "x_121" + OpName %x_119_phi "x_119_phi" + OpName %x_135 "x_135" + OpName %x_143_phi "x_143_phi" + OpName %x_154_phi "x_154_phi" + OpName %x_155_phi "x_155_phi" + OpName %x_144 "x_144" + OpName %x_119 "x_119" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %26 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_n1 = OpConstant %float -1 + %false = OpConstantFalse %bool + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %int_2 = OpConstant %int 2 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %int_4 = OpConstant %int 4 + %277 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %278 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %279 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_45 = OpVariable %_ptr_Function_bool Function %26 + %x_48 = OpVariable %_ptr_Function_int Function %30 + %x_49 = OpVariable %_ptr_Function_int Function %30 + %x_46 = OpVariable %_ptr_Function_bool Function %26 + %x_115 = OpVariable %_ptr_Function_int Function %30 + %x_116 = OpVariable %_ptr_Function_int Function %30 + %x_45_phi = OpVariable %_ptr_Function_bool Function %26 + %x_48_phi = OpVariable %_ptr_Function_int Function %30 + %x_50_phi = OpVariable %_ptr_Function_int Function %30 + %x_52_phi = OpVariable %_ptr_Function_int Function %30 + %x_111_phi = OpVariable %_ptr_Function_int Function %30 + %x_112_phi = OpVariable %_ptr_Function_bool Function %26 + %x_115_phi = OpVariable %_ptr_Function_int Function %30 + %x_118_phi = OpVariable %_ptr_Function_int Function %30 + %x_120_phi = OpVariable %_ptr_Function_int Function %30 + %x_161_phi = OpVariable %_ptr_Function_int Function %30 + %x_62 = OpVariable %_ptr_Function_int Function %30 + %x_65 = OpVariable %_ptr_Function_int Function %30 + %x_66 = OpVariable %_ptr_Function_int Function %30 + %x_63 = OpVariable %_ptr_Function_int Function %30 + %x_53 = OpVariable %_ptr_Function_int Function %30 + %x_62_phi = OpVariable %_ptr_Function_int Function %30 + %x_65_phi = OpVariable %_ptr_Function_int Function %30 + %x_67_phi = OpVariable %_ptr_Function_int Function %30 + %x_51_phi = OpVariable %_ptr_Function_int Function %30 + %x_49_phi = OpVariable %_ptr_Function_int Function %30 + %x_46_phi = OpVariable %_ptr_Function_bool Function %26 + %x_97 = OpVariable %_ptr_Function_int Function %30 + %x_68 = OpVariable %_ptr_Function_int Function %30 + %x_66_phi = OpVariable %_ptr_Function_int Function %30 + %x_78 = OpVariable %_ptr_Function_bool Function %26 + %x_86_phi = OpVariable %_ptr_Function_int Function %30 + %x_97_phi = OpVariable %_ptr_Function_int Function %30 + %x_98_phi = OpVariable %_ptr_Function_bool Function %26 + %x_87 = OpVariable %_ptr_Function_int Function %30 + %x_154 = OpVariable %_ptr_Function_int Function %30 + %x_121 = OpVariable %_ptr_Function_int Function %30 + %x_119_phi = OpVariable %_ptr_Function_int Function %30 + %x_135 = OpVariable %_ptr_Function_bool Function %26 + %x_143_phi = OpVariable %_ptr_Function_int Function %30 + %x_154_phi = OpVariable %_ptr_Function_int Function %30 + %x_155_phi = OpVariable %_ptr_Function_bool Function %26 + %x_144 = OpVariable %_ptr_Function_int Function %30 + %x_119 = OpVariable %_ptr_Function_int Function %30 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %49 = OpLoad %float %48 + %51 = OpFOrdLessThan %bool %49 %float_n1 + OpStore %x_45_phi %false + OpStore %x_48_phi %int_0 + OpStore %x_50_phi %int_0 + OpStore %x_52_phi %int_0 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %69 = OpLoad %bool %x_45_phi + OpStore %x_45 %69 + %70 = OpLoad %int %x_48_phi + OpStore %x_48 %70 + %71 = OpLoad %int %x_50_phi + %72 = OpLoad %int %x_52_phi + %75 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %76 = OpLoad %float %75 + %77 = OpLoad %int %x_48 + OpStore %x_111_phi %77 + %78 = OpLoad %bool %x_45 + OpStore %x_112_phi %78 + %80 = OpFOrdGreaterThan %bool %76 %float_n1 + %79 = OpSelect %int %80 %int_10 %int_100 + %83 = OpSLessThan %bool %72 %79 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + OpBranch %84 + %86 = OpLabel + OpBranch %55 + %84 = OpLabel + %87 = OpLoad %int %x_48 + OpStore %x_62_phi %87 + OpStore %x_65_phi %71 + OpStore %x_67_phi %int_0 + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %95 = OpLoad %int %x_62_phi + OpStore %x_62 %95 + %96 = OpLoad %int %x_65_phi + OpStore %x_65 %96 + %97 = OpLoad %int %x_67_phi + %98 = OpLoad %int %x_65 + OpStore %x_51_phi %98 + %99 = OpLoad %int %x_62 + OpStore %x_49_phi %99 + %100 = OpLoad %bool %x_45 + OpStore %x_46_phi %100 + %102 = OpSLessThan %bool %97 %int_2 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + OpBranch %103 + %105 = OpLabel + OpBranch %89 + %103 = OpLabel + OpBranch %106 + %106 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %114 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %115 = OpLoad %float %114 + %116 = OpFOrdLessThan %bool %115 %float_n1 + OpStore %x_78 %116 + %119 = OpFOrdLessThan %bool %49 %float_0 + %117 = OpLogicalNot %bool %119 + OpSelectionMerge %120 None + OpBranchConditional %117 %121 %120 + %121 = OpLabel + %122 = OpLoad %bool %x_78 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %123 + %124 = OpLabel + OpStore %x_66_phi %int_0 + OpBranch %107 + %123 = OpLabel + OpStore %x_86_phi %int_1 + OpBranch %126 + %126 = OpLabel + OpLoopMerge %127 %128 None + OpBranch %129 + %129 = OpLabel + %131 = OpLoad %int %x_86_phi + %132 = OpLoad %int %x_65 + OpStore %x_97_phi %132 + OpStore %x_98_phi %false + %134 = OpSLessThan %bool %131 %int_3 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 + %136 = OpLabel + OpBranch %135 + %137 = OpLabel + OpBranch %127 + %135 = OpLabel + %138 = OpLoad %bool %x_78 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + OpBranch %128 + %139 = OpLabel + %141 = OpSGreaterThan %bool %131 %int_0 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %142 + %143 = OpLabel + OpStore %x_97_phi %int_1 + OpStore %x_98_phi %true + OpBranch %127 + %142 = OpLabel + OpBranch %128 + %128 = OpLabel + %145 = OpIAdd %int %131 %int_1 + OpStore %x_87 %145 + %146 = OpLoad %int %x_87 + OpStore %x_86_phi %146 + OpBranch %126 + %127 = OpLabel + %147 = OpLoad %int %x_97_phi + OpStore %x_97 %147 + %148 = OpLoad %bool %x_98_phi + %149 = OpLoad %int %x_97 + OpStore %x_66_phi %149 + OpSelectionMerge %150 None + OpBranchConditional %148 %151 %150 + %151 = OpLabel + OpBranch %107 + %150 = OpLabel + OpBranch %120 + %120 = OpLabel + OpStore %x_66_phi %int_0 + OpBranch %107 + %108 = OpLabel + OpBranch %106 + %107 = OpLabel + %152 = OpLoad %int %x_66_phi + OpStore %x_66 %152 + %154 = OpLoad %int %x_62 + %155 = OpLoad %int %x_66 + %156 = OpIAdd %int %154 %155 + %153 = OpCopyObject %int %156 + OpStore %x_63 %153 + OpSelectionMerge %157 None + OpBranchConditional %51 %158 %157 + %158 = OpLabel + OpBranch %159 + %159 = OpLabel + OpLoopMerge %160 %161 None + OpBranch %162 + %162 = OpLabel + OpSelectionMerge %163 None + OpBranchConditional %51 %164 %165 + %164 = OpLabel + OpBranch %163 + %165 = OpLabel + OpBranch %160 + %163 = OpLabel + OpBranch %161 + %161 = OpLabel + %166 = OpConvertSToF %float %72 + %167 = OpCompositeConstruct %v4float %166 %166 %166 %166 + OpStore %x_GLF_color %167 + OpBranch %159 + %160 = OpLabel + %168 = OpLoad %int %x_66 + OpStore %x_51_phi %168 + %169 = OpLoad %int %x_63 + OpStore %x_49_phi %169 + OpStore %x_46_phi %true + OpBranch %89 + %157 = OpLabel + OpBranch %90 + %90 = OpLabel + %170 = OpIAdd %int %97 %int_1 + OpStore %x_68 %170 + %171 = OpLoad %int %x_63 + OpStore %x_62_phi %171 + %172 = OpLoad %int %x_66 + OpStore %x_65_phi %172 + %173 = OpLoad %int %x_68 + OpStore %x_67_phi %173 + OpBranch %88 + %89 = OpLabel + %174 = OpLoad %int %x_51_phi + %175 = OpLoad %int %x_49_phi + OpStore %x_49 %175 + %176 = OpLoad %bool %x_46_phi + OpStore %x_46 %176 + %177 = OpLoad %int %x_49 + OpStore %x_111_phi %177 + %178 = OpLoad %bool %x_46 + OpStore %x_112_phi %178 + %179 = OpLoad %bool %x_46 + OpSelectionMerge %180 None + OpBranchConditional %179 %181 %180 + %181 = OpLabel + OpBranch %55 + %180 = OpLabel + %182 = OpLogicalNot %bool %51 + OpSelectionMerge %183 None + OpBranchConditional %182 %184 %183 + %184 = OpLabel + %185 = OpLoad %int %x_49 + OpStore %x_111_phi %185 + %186 = OpLoad %bool %x_46 + OpStore %x_112_phi %186 + OpBranch %55 + %183 = OpLabel + OpBranch %56 + %56 = OpLabel + %187 = OpIAdd %int %72 %int_1 + OpStore %x_53 %187 + %188 = OpLoad %bool %x_46 + OpStore %x_45_phi %188 + %189 = OpLoad %int %x_49 + OpStore %x_48_phi %189 + OpStore %x_50_phi %174 + %190 = OpLoad %int %x_53 + OpStore %x_52_phi %190 + OpBranch %54 + %55 = OpLabel + %191 = OpLoad %int %x_111_phi + %192 = OpLoad %bool %x_112_phi + OpSelectionMerge %193 None + OpBranchConditional %192 %194 %193 + %194 = OpLabel + OpBranch %20 + %193 = OpLabel + OpStore %x_115_phi %191 + OpStore %x_118_phi %int_0 + OpStore %x_120_phi %int_0 + OpBranch %195 + %195 = OpLabel + OpLoopMerge %196 %197 None + OpBranch %198 + %198 = OpLabel + %202 = OpLoad %int %x_115_phi + OpStore %x_115 %202 + %203 = OpLoad %int %x_118_phi + %204 = OpLoad %int %x_120_phi + %205 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %206 = OpLoad %float %205 + %207 = OpLoad %int %x_115 + OpStore %x_161_phi %207 + %210 = OpFAdd %float %206 %float_1 + %208 = OpConvertFToS %int %210 + %211 = OpSLessThan %bool %204 %208 + OpSelectionMerge %212 None + OpBranchConditional %211 %213 %214 + %213 = OpLabel + OpBranch %212 + %214 = OpLabel + OpBranch %196 + %212 = OpLabel + OpBranch %215 + %215 = OpLabel + OpLoopMerge %216 %217 None + OpBranch %218 + %218 = OpLabel + %223 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %224 = OpLoad %float %223 + %225 = OpFOrdLessThan %bool %224 %float_n1 + OpStore %x_135 %225 + %227 = OpFOrdLessThan %bool %49 %float_0 + %226 = OpLogicalNot %bool %227 + OpSelectionMerge %228 None + OpBranchConditional %226 %229 %228 + %229 = OpLabel + %230 = OpLoad %bool %x_135 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %231 + %232 = OpLabel + OpStore %x_119_phi %int_0 + OpBranch %216 + %231 = OpLabel + OpStore %x_143_phi %int_1 + OpBranch %233 + %233 = OpLabel + OpLoopMerge %234 %235 None + OpBranch %236 + %236 = OpLabel + %238 = OpLoad %int %x_143_phi + OpStore %x_154_phi %203 + OpStore %x_155_phi %false + %239 = OpSLessThan %bool %238 %int_3 + OpSelectionMerge %240 None + OpBranchConditional %239 %241 %242 + %241 = OpLabel + OpBranch %240 + %242 = OpLabel + OpBranch %234 + %240 = OpLabel + %243 = OpLoad %bool %x_135 + OpSelectionMerge %244 None + OpBranchConditional %243 %245 %244 + %245 = OpLabel + OpBranch %235 + %244 = OpLabel + %246 = OpSGreaterThan %bool %238 %int_0 + OpSelectionMerge %247 None + OpBranchConditional %246 %248 %247 + %248 = OpLabel + OpStore %x_154_phi %int_1 + OpStore %x_155_phi %true + OpBranch %234 + %247 = OpLabel + OpBranch %235 + %235 = OpLabel + %249 = OpIAdd %int %238 %int_1 + OpStore %x_144 %249 + %250 = OpLoad %int %x_144 + OpStore %x_143_phi %250 + OpBranch %233 + %234 = OpLabel + %251 = OpLoad %int %x_154_phi + OpStore %x_154 %251 + %252 = OpLoad %bool %x_155_phi + %253 = OpLoad %int %x_154 + OpStore %x_119_phi %253 + OpSelectionMerge %254 None + OpBranchConditional %252 %255 %254 + %255 = OpLabel + OpBranch %216 + %254 = OpLabel + OpBranch %228 + %228 = OpLabel + OpStore %x_119_phi %int_0 + OpBranch %216 + %217 = OpLabel + OpBranch %215 + %216 = OpLabel + %257 = OpLoad %int %x_119_phi + OpStore %x_119 %257 + %259 = OpLoad %int %x_115 + %260 = OpLoad %int %x_119 + %261 = OpIAdd %int %259 %260 + %258 = OpCopyObject %int %261 + OpStore %x_116 %258 + %263 = OpLogicalNot %bool %51 + %262 = OpSelect %bool %263 %false %51 + OpSelectionMerge %264 None + OpBranchConditional %262 %265 %264 + %265 = OpLabel + %266 = OpLoad %int %x_116 + OpStore %x_161_phi %266 + OpBranch %196 + %264 = OpLabel + OpBranch %197 + %197 = OpLabel + %267 = OpIAdd %int %204 %int_1 + OpStore %x_121 %267 + %268 = OpLoad %int %x_116 + OpStore %x_115_phi %268 + %269 = OpLoad %int %x_119 + OpStore %x_118_phi %269 + %270 = OpLoad %int %x_121 + OpStore %x_120_phi %270 + OpBranch %195 + %196 = OpLabel + %271 = OpLoad %int %x_161_phi + %273 = OpIEqual %bool %271 %int_4 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %276 + %275 = OpLabel + OpStore %x_GLF_color %277 + OpBranch %274 + %276 = OpLabel + OpStore %x_GLF_color %278 + OpBranch %274 + %274 = OpLabel + OpBranch %20 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %279 +%tint_symbol_1 = OpFunctionParameter %main_out + %283 = OpLabel + %284 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %284 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %286 = OpLabel + %287 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %287 + %288 = OpFunctionCall %void %main_1 + %290 = OpLoad %v4float %x_GLF_color + %291 = OpCompositeConstruct %main_out %290 + %289 = OpFunctionCall %void %tint_symbol_3 %291 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..7b1d98075e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.wgsl @@ -0,0 +1,274 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + loop { + var x_45 : bool; + var x_48 : i32; + var x_49 : i32; + var x_46 : bool; + var x_115 : i32; + var x_116 : i32; + var x_45_phi : bool; + var x_48_phi : i32; + var x_50_phi : i32; + var x_52_phi : i32; + var x_111_phi : i32; + var x_112_phi : bool; + var x_115_phi : i32; + var x_118_phi : i32; + var x_120_phi : i32; + var x_161_phi : i32; + let x_40 : f32 = x_6.injectionSwitch.x; + let x_41 : bool = (x_40 < -1.0); + x_45_phi = false; + x_48_phi = 0; + x_50_phi = 0; + x_52_phi = 0; + loop { + var x_62 : i32; + var x_65 : i32; + var x_66 : i32; + var x_63 : i32; + var x_53 : i32; + var x_62_phi : i32; + var x_65_phi : i32; + var x_67_phi : i32; + var x_51_phi : i32; + var x_49_phi : i32; + var x_46_phi : bool; + x_45 = x_45_phi; + x_48 = x_48_phi; + let x_50 : i32 = x_50_phi; + let x_52 : i32 = x_52_phi; + let x_55 : f32 = gl_FragCoord.y; + x_111_phi = x_48; + x_112_phi = x_45; + if ((x_52 < select(100, 10, (x_55 > -1.0)))) { + } else { + break; + } + x_62_phi = x_48; + x_65_phi = x_50; + x_67_phi = 0; + loop { + var x_97 : i32; + var x_68 : i32; + var x_66_phi : i32; + x_62 = x_62_phi; + x_65 = x_65_phi; + let x_67 : i32 = x_67_phi; + x_51_phi = x_65; + x_49_phi = x_62; + x_46_phi = x_45; + if ((x_67 < 2)) { + } else { + break; + } + loop { + var x_78 : bool; + var x_86_phi : i32; + var x_97_phi : i32; + var x_98_phi : bool; + let x_77 : f32 = gl_FragCoord.x; + x_78 = (x_77 < -1.0); + if (!((x_40 < 0.0))) { + if (x_78) { + x_66_phi = 0; + break; + } + x_86_phi = 1; + loop { + var x_87 : i32; + let x_86 : i32 = x_86_phi; + x_97_phi = x_65; + x_98_phi = false; + if ((x_86 < 3)) { + } else { + break; + } + if (x_78) { + continue; + } + if ((x_86 > 0)) { + x_97_phi = 1; + x_98_phi = true; + break; + } + + continuing { + x_87 = (x_86 + 1); + x_86_phi = x_87; + } + } + x_97 = x_97_phi; + let x_98 : bool = x_98_phi; + x_66_phi = x_97; + if (x_98) { + break; + } + } + x_66_phi = 0; + break; + } + x_66 = x_66_phi; + x_63 = bitcast((x_62 + x_66)); + if (x_41) { + loop { + if (x_41) { + } else { + break; + } + + continuing { + let x_105 : f32 = f32(x_52); + x_GLF_color = vec4(x_105, x_105, x_105, x_105); + } + } + x_51_phi = x_66; + x_49_phi = x_63; + x_46_phi = true; + break; + } + + continuing { + x_68 = (x_67 + 1); + x_62_phi = x_63; + x_65_phi = x_66; + x_67_phi = x_68; + } + } + let x_51 : i32 = x_51_phi; + x_49 = x_49_phi; + x_46 = x_46_phi; + x_111_phi = x_49; + x_112_phi = x_46; + if (x_46) { + break; + } + if (!(x_41)) { + x_111_phi = x_49; + x_112_phi = x_46; + break; + } + + continuing { + x_53 = (x_52 + 1); + x_45_phi = x_46; + x_48_phi = x_49; + x_50_phi = x_51; + x_52_phi = x_53; + } + } + let x_111 : i32 = x_111_phi; + let x_112 : bool = x_112_phi; + if (x_112) { + break; + } + x_115_phi = x_111; + x_118_phi = 0; + x_120_phi = 0; + loop { + var x_154 : i32; + var x_121 : i32; + var x_119_phi : i32; + x_115 = x_115_phi; + let x_118 : i32 = x_118_phi; + let x_120 : i32 = x_120_phi; + let x_123 : f32 = x_6.injectionSwitch.y; + x_161_phi = x_115; + if ((x_120 < i32((x_123 + 1.0)))) { + } else { + break; + } + loop { + var x_135 : bool; + var x_143_phi : i32; + var x_154_phi : i32; + var x_155_phi : bool; + let x_134 : f32 = gl_FragCoord.x; + x_135 = (x_134 < -1.0); + if (!((x_40 < 0.0))) { + if (x_135) { + x_119_phi = 0; + break; + } + x_143_phi = 1; + loop { + var x_144 : i32; + let x_143 : i32 = x_143_phi; + x_154_phi = x_118; + x_155_phi = false; + if ((x_143 < 3)) { + } else { + break; + } + if (x_135) { + continue; + } + if ((x_143 > 0)) { + x_154_phi = 1; + x_155_phi = true; + break; + } + + continuing { + x_144 = (x_143 + 1); + x_143_phi = x_144; + } + } + x_154 = x_154_phi; + let x_155 : bool = x_155_phi; + x_119_phi = x_154; + if (x_155) { + break; + } + } + x_119_phi = 0; + break; + } + var x_119 : i32; + x_119 = x_119_phi; + x_116 = bitcast((x_115 + x_119)); + if (select(x_41, false, !(x_41))) { + x_161_phi = x_116; + break; + } + + continuing { + x_121 = (x_120 + 1); + x_115_phi = x_116; + x_118_phi = x_119; + x_120_phi = x_121; + } + } + let x_161 : i32 = x_161_phi; + if ((x_161 == 4)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm new file mode 100644 index 0000000000..de646e8146 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm @@ -0,0 +1,106 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %makeFrame_ "makeFrame(" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %7 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 + %13 = OpTypeFunction %float + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %30 = OpUndef %float + %31 = OpUndef %bool + %32 = OpUndef %int + %main = OpFunction %void None %11 + %33 = OpLabel + %34 = OpFunctionCall %float %makeFrame_ + OpStore %_GLF_color %27 + OpReturn + OpFunctionEnd + %makeFrame_ = OpFunction %float None %13 + %35 = OpLabel + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + OpBranch %40 + %40 = OpLabel + %41 = OpPhi %bool %false %39 %42 %43 + %8 = OpPhi %int %int_0 %39 %7 %43 + %44 = OpPhi %float %30 %39 %45 %43 + %46 = OpSLessThan %bool %8 %int_1 + OpLoopMerge %47 %43 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + OpBranch %49 + %49 = OpLabel + %50 = OpPhi %float %44 %48 %30 %51 + %9 = OpPhi %int %8 %48 %32 %51 + %52 = OpPhi %bool %41 %48 %31 %51 + %53 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %54 = OpLoad %float %53 + %55 = OpConvertFToS %int %54 + %56 = OpSLessThan %bool %int_1 %55 + OpLoopMerge %57 %51 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + OpBranch %57 + %51 = OpLabel + OpBranch %49 + %57 = OpLabel + %45 = OpPhi %float %50 %49 %float_1 %58 + %42 = OpPhi %bool %52 %49 %true %58 + OpSelectionMerge %59 None + OpBranchConditional %42 %47 %59 + %59 = OpLabel + OpBranch %43 + %43 = OpLabel + %7 = OpIAdd %int %9 %int_1 + OpBranch %40 + %47 = OpLabel + %60 = OpPhi %float %44 %40 %45 %57 + %61 = OpPhi %bool %41 %40 %42 %57 + OpSelectionMerge %62 None + OpBranchConditional %61 %37 %62 + %62 = OpLabel + OpBranch %37 + %38 = OpLabel + OpBranch %36 + %37 = OpLabel + %63 = OpPhi %float %60 %47 %float_1 %62 + OpReturnValue %63 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..569cc6aea8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.hlsl @@ -0,0 +1,108 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float makeFrame_() { + float x_60 = 0.0f; + float x_63_phi = 0.0f; + while (true) { + bool x_41 = false; + float x_44 = 0.0f; + float x_45 = 0.0f; + bool x_42 = false; + bool x_41_phi = false; + int x_8_phi = 0; + float x_44_phi = 0.0f; + float x_60_phi = 0.0f; + bool x_61_phi = false; + x_41_phi = false; + x_8_phi = 0; + x_44_phi = 0.0f; + while (true) { + float x_50 = 0.0f; + int x_9 = 0; + bool x_52 = false; + int x_7 = 0; + float x_50_phi = 0.0f; + int x_9_phi = 0; + bool x_52_phi = false; + float x_45_phi = 0.0f; + bool x_42_phi = false; + x_41 = x_41_phi; + const int x_8 = x_8_phi; + x_44 = x_44_phi; + x_60_phi = x_44; + x_61_phi = x_41; + if ((x_8 < 1)) { + } else { + break; + } + x_50_phi = x_44; + x_9_phi = x_8; + x_52_phi = x_41; + while (true) { + x_50 = x_50_phi; + x_9 = x_9_phi; + x_52 = x_52_phi; + const float x_54 = asfloat(x_6[0].y); + x_45_phi = x_50; + x_42_phi = x_52; + if ((1 < int(x_54))) { + } else { + break; + } + x_45_phi = 1.0f; + x_42_phi = true; + break; + { + x_50_phi = 0.0f; + x_9_phi = 0; + x_52_phi = false; + } + } + x_45 = x_45_phi; + x_42 = x_42_phi; + x_60_phi = x_45; + x_61_phi = x_42; + if (x_42) { + break; + } + { + x_7 = asint((x_9 + asint(1))); + x_41_phi = x_42; + x_8_phi = x_7; + x_44_phi = x_45; + } + } + x_60 = x_60_phi; + const bool x_61 = x_61_phi; + x_63_phi = x_60; + if (x_61) { + break; + } + x_63_phi = 1.0f; + break; + } + return x_63_phi; +} + +void main_1() { + const float x_34 = makeFrame_(); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.msl new file mode 100644 index 0000000000..c1f76729d2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float makeFrame_(constant buf0& x_6) { + float x_60 = 0.0f; + float x_63_phi = 0.0f; + while (true) { + bool x_41 = false; + float x_44 = 0.0f; + float x_45 = 0.0f; + bool x_42 = false; + bool x_41_phi = false; + int x_8_phi = 0; + float x_44_phi = 0.0f; + float x_60_phi = 0.0f; + bool x_61_phi = false; + x_41_phi = false; + x_8_phi = 0; + x_44_phi = 0.0f; + while (true) { + float x_50 = 0.0f; + int x_9 = 0; + bool x_52 = false; + int x_7 = 0; + float x_50_phi = 0.0f; + int x_9_phi = 0; + bool x_52_phi = false; + float x_45_phi = 0.0f; + bool x_42_phi = false; + x_41 = x_41_phi; + int const x_8 = x_8_phi; + x_44 = x_44_phi; + x_60_phi = x_44; + x_61_phi = x_41; + if ((x_8 < 1)) { + } else { + break; + } + x_50_phi = x_44; + x_9_phi = x_8; + x_52_phi = x_41; + while (true) { + x_50 = x_50_phi; + x_9 = x_9_phi; + x_52 = x_52_phi; + float const x_54 = x_6.injectionSwitch.y; + x_45_phi = x_50; + x_42_phi = x_52; + if ((1 < int(x_54))) { + } else { + break; + } + x_45_phi = 1.0f; + x_42_phi = true; + break; + { + x_50_phi = 0.0f; + x_9_phi = 0; + x_52_phi = false; + } + } + x_45 = x_45_phi; + x_42 = x_42_phi; + x_60_phi = x_45; + x_61_phi = x_42; + if (x_42) { + break; + } + { + x_7 = as_type((x_9 + as_type(1))); + x_41_phi = x_42; + x_8_phi = x_7; + x_44_phi = x_45; + } + } + x_60 = x_60_phi; + bool const x_61 = x_61_phi; + x_63_phi = x_60; + if (x_61) { + break; + } + x_63_phi = 1.0f; + break; + } + float const x_63 = x_63_phi; + return x_63; +} + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float const x_34 = makeFrame_(x_6); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..ecb08614c6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.spvasm @@ -0,0 +1,243 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 126 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %makeFrame_ "makeFrame_" + OpName %x_60 "x_60" + OpName %x_63_phi "x_63_phi" + OpName %x_41 "x_41" + OpName %x_44 "x_44" + OpName %x_45 "x_45" + OpName %x_42 "x_42" + OpName %x_41_phi "x_41_phi" + OpName %x_8_phi "x_8_phi" + OpName %x_44_phi "x_44_phi" + OpName %x_60_phi "x_60_phi" + OpName %x_61_phi "x_61_phi" + OpName %x_50 "x_50" + OpName %x_9 "x_9" + OpName %x_52 "x_52" + OpName %x_7 "x_7" + OpName %x_50_phi "x_50_phi" + OpName %x_9_phi "x_9_phi" + OpName %x_52_phi "x_52_phi" + OpName %x_45_phi "x_45_phi" + OpName %x_42_phi "x_42_phi" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %12 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %26 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %false = OpConstantFalse %bool + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %true = OpConstantTrue %bool + %void = OpTypeVoid + %108 = OpTypeFunction %void + %113 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %114 = OpTypeFunction %void %main_out + %makeFrame_ = OpFunction %float None %12 + %14 = OpLabel + %x_60 = OpVariable %_ptr_Function_float Function %17 + %x_63_phi = OpVariable %_ptr_Function_float Function %17 + %x_41 = OpVariable %_ptr_Function_bool Function %26 + %x_44 = OpVariable %_ptr_Function_float Function %17 + %x_45 = OpVariable %_ptr_Function_float Function %17 + %x_42 = OpVariable %_ptr_Function_bool Function %26 + %x_41_phi = OpVariable %_ptr_Function_bool Function %26 + %x_8_phi = OpVariable %_ptr_Function_int Function %34 + %x_44_phi = OpVariable %_ptr_Function_float Function %17 + %x_60_phi = OpVariable %_ptr_Function_float Function %17 + %x_61_phi = OpVariable %_ptr_Function_bool Function %26 + %x_50 = OpVariable %_ptr_Function_float Function %17 + %x_9 = OpVariable %_ptr_Function_int Function %34 + %x_52 = OpVariable %_ptr_Function_bool Function %26 + %x_7 = OpVariable %_ptr_Function_int Function %34 + %x_50_phi = OpVariable %_ptr_Function_float Function %17 + %x_9_phi = OpVariable %_ptr_Function_int Function %34 + %x_52_phi = OpVariable %_ptr_Function_bool Function %26 + %x_45_phi = OpVariable %_ptr_Function_float Function %17 + %x_42_phi = OpVariable %_ptr_Function_bool Function %26 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + OpStore %x_41_phi %false + OpStore %x_8_phi %int_0 + OpStore %x_44_phi %float_0 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %54 = OpLoad %bool %x_41_phi + OpStore %x_41 %54 + %55 = OpLoad %int %x_8_phi + %56 = OpLoad %float %x_44_phi + OpStore %x_44 %56 + %57 = OpLoad %float %x_44 + OpStore %x_60_phi %57 + %58 = OpLoad %bool %x_41 + OpStore %x_61_phi %58 + %60 = OpSLessThan %bool %55 %int_1 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %42 + %61 = OpLabel + %64 = OpLoad %float %x_44 + OpStore %x_50_phi %64 + OpStore %x_9_phi %55 + %65 = OpLoad %bool %x_41 + OpStore %x_52_phi %65 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %70 = OpLoad %float %x_50_phi + OpStore %x_50 %70 + %71 = OpLoad %int %x_9_phi + OpStore %x_9 %71 + %72 = OpLoad %bool %x_52_phi + OpStore %x_52 %72 + %77 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %78 = OpLoad %float %77 + %79 = OpLoad %float %x_50 + OpStore %x_45_phi %79 + %80 = OpLoad %bool %x_52 + OpStore %x_42_phi %80 + %81 = OpConvertFToS %int %78 + %82 = OpSLessThan %bool %int_1 %81 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + OpBranch %83 + %85 = OpLabel + OpBranch %67 + %83 = OpLabel + OpStore %x_45_phi %float_1 + OpStore %x_42_phi %true + OpBranch %67 + %68 = OpLabel + OpStore %x_50_phi %float_0 + OpStore %x_9_phi %int_0 + OpStore %x_52_phi %false + OpBranch %66 + %67 = OpLabel + %88 = OpLoad %float %x_45_phi + OpStore %x_45 %88 + %89 = OpLoad %bool %x_42_phi + OpStore %x_42 %89 + %90 = OpLoad %float %x_45 + OpStore %x_60_phi %90 + %91 = OpLoad %bool %x_42 + OpStore %x_61_phi %91 + %92 = OpLoad %bool %x_42 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + OpBranch %42 + %93 = OpLabel + OpBranch %43 + %43 = OpLabel + %96 = OpLoad %int %x_9 + %97 = OpCopyObject %int %int_1 + %98 = OpIAdd %int %96 %97 + %95 = OpCopyObject %int %98 + OpStore %x_7 %95 + %99 = OpLoad %bool %x_42 + OpStore %x_41_phi %99 + %100 = OpLoad %int %x_7 + OpStore %x_8_phi %100 + %101 = OpLoad %float %x_45 + OpStore %x_44_phi %101 + OpBranch %41 + %42 = OpLabel + %102 = OpLoad %float %x_60_phi + OpStore %x_60 %102 + %103 = OpLoad %bool %x_61_phi + %104 = OpLoad %float %x_60 + OpStore %x_63_phi %104 + OpSelectionMerge %105 None + OpBranchConditional %103 %106 %105 + %106 = OpLabel + OpBranch %20 + %105 = OpLabel + OpStore %x_63_phi %float_1 + OpBranch %20 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + %107 = OpLoad %float %x_63_phi + OpReturnValue %107 + OpFunctionEnd + %main_1 = OpFunction %void None %108 + %111 = OpLabel + %112 = OpFunctionCall %float %makeFrame_ + OpStore %x_GLF_color %113 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %114 +%tint_symbol = OpFunctionParameter %main_out + %118 = OpLabel + %119 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %119 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %108 + %121 = OpLabel + %122 = OpFunctionCall %void %main_1 + %124 = OpLoad %v4float %x_GLF_color + %125 = OpCompositeConstruct %main_out %124 + %123 = OpFunctionCall %void %tint_symbol_2 %125 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..d594596ab1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.spvasm.expected.wgsl @@ -0,0 +1,112 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn makeFrame_() -> f32 { + var x_60 : f32; + var x_63_phi : f32; + loop { + var x_41 : bool; + var x_44 : f32; + var x_45 : f32; + var x_42 : bool; + var x_41_phi : bool; + var x_8_phi : i32; + var x_44_phi : f32; + var x_60_phi : f32; + var x_61_phi : bool; + x_41_phi = false; + x_8_phi = 0; + x_44_phi = 0.0; + loop { + var x_50 : f32; + var x_9 : i32; + var x_52 : bool; + var x_7 : i32; + var x_50_phi : f32; + var x_9_phi : i32; + var x_52_phi : bool; + var x_45_phi : f32; + var x_42_phi : bool; + x_41 = x_41_phi; + let x_8 : i32 = x_8_phi; + x_44 = x_44_phi; + x_60_phi = x_44; + x_61_phi = x_41; + if ((x_8 < 1)) { + } else { + break; + } + x_50_phi = x_44; + x_9_phi = x_8; + x_52_phi = x_41; + loop { + x_50 = x_50_phi; + x_9 = x_9_phi; + x_52 = x_52_phi; + let x_54 : f32 = x_6.injectionSwitch.y; + x_45_phi = x_50; + x_42_phi = x_52; + if ((1 < i32(x_54))) { + } else { + break; + } + x_45_phi = 1.0; + x_42_phi = true; + break; + + continuing { + x_50_phi = 0.0; + x_9_phi = 0; + x_52_phi = false; + } + } + x_45 = x_45_phi; + x_42 = x_42_phi; + x_60_phi = x_45; + x_61_phi = x_42; + if (x_42) { + break; + } + + continuing { + x_7 = bitcast((x_9 + bitcast(1))); + x_41_phi = x_42; + x_8_phi = x_7; + x_44_phi = x_45; + } + } + x_60 = x_60_phi; + let x_61 : bool = x_61_phi; + x_63_phi = x_60; + if (x_61) { + break; + } + x_63_phi = 1.0; + break; + } + let x_63 : f32 = x_63_phi; + return x_63; +} + +fn main_1() { + let x_34 : f32 = makeFrame_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl new file mode 100644 index 0000000000..d594596ab1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl @@ -0,0 +1,112 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn makeFrame_() -> f32 { + var x_60 : f32; + var x_63_phi : f32; + loop { + var x_41 : bool; + var x_44 : f32; + var x_45 : f32; + var x_42 : bool; + var x_41_phi : bool; + var x_8_phi : i32; + var x_44_phi : f32; + var x_60_phi : f32; + var x_61_phi : bool; + x_41_phi = false; + x_8_phi = 0; + x_44_phi = 0.0; + loop { + var x_50 : f32; + var x_9 : i32; + var x_52 : bool; + var x_7 : i32; + var x_50_phi : f32; + var x_9_phi : i32; + var x_52_phi : bool; + var x_45_phi : f32; + var x_42_phi : bool; + x_41 = x_41_phi; + let x_8 : i32 = x_8_phi; + x_44 = x_44_phi; + x_60_phi = x_44; + x_61_phi = x_41; + if ((x_8 < 1)) { + } else { + break; + } + x_50_phi = x_44; + x_9_phi = x_8; + x_52_phi = x_41; + loop { + x_50 = x_50_phi; + x_9 = x_9_phi; + x_52 = x_52_phi; + let x_54 : f32 = x_6.injectionSwitch.y; + x_45_phi = x_50; + x_42_phi = x_52; + if ((1 < i32(x_54))) { + } else { + break; + } + x_45_phi = 1.0; + x_42_phi = true; + break; + + continuing { + x_50_phi = 0.0; + x_9_phi = 0; + x_52_phi = false; + } + } + x_45 = x_45_phi; + x_42 = x_42_phi; + x_60_phi = x_45; + x_61_phi = x_42; + if (x_42) { + break; + } + + continuing { + x_7 = bitcast((x_9 + bitcast(1))); + x_41_phi = x_42; + x_8_phi = x_7; + x_44_phi = x_45; + } + } + x_60 = x_60_phi; + let x_61 : bool = x_61_phi; + x_63_phi = x_60; + if (x_61) { + break; + } + x_63_phi = 1.0; + break; + } + let x_63 : f32 = x_63_phi; + return x_63; +} + +fn main_1() { + let x_34 : f32 = makeFrame_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..569cc6aea8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.hlsl @@ -0,0 +1,108 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float makeFrame_() { + float x_60 = 0.0f; + float x_63_phi = 0.0f; + while (true) { + bool x_41 = false; + float x_44 = 0.0f; + float x_45 = 0.0f; + bool x_42 = false; + bool x_41_phi = false; + int x_8_phi = 0; + float x_44_phi = 0.0f; + float x_60_phi = 0.0f; + bool x_61_phi = false; + x_41_phi = false; + x_8_phi = 0; + x_44_phi = 0.0f; + while (true) { + float x_50 = 0.0f; + int x_9 = 0; + bool x_52 = false; + int x_7 = 0; + float x_50_phi = 0.0f; + int x_9_phi = 0; + bool x_52_phi = false; + float x_45_phi = 0.0f; + bool x_42_phi = false; + x_41 = x_41_phi; + const int x_8 = x_8_phi; + x_44 = x_44_phi; + x_60_phi = x_44; + x_61_phi = x_41; + if ((x_8 < 1)) { + } else { + break; + } + x_50_phi = x_44; + x_9_phi = x_8; + x_52_phi = x_41; + while (true) { + x_50 = x_50_phi; + x_9 = x_9_phi; + x_52 = x_52_phi; + const float x_54 = asfloat(x_6[0].y); + x_45_phi = x_50; + x_42_phi = x_52; + if ((1 < int(x_54))) { + } else { + break; + } + x_45_phi = 1.0f; + x_42_phi = true; + break; + { + x_50_phi = 0.0f; + x_9_phi = 0; + x_52_phi = false; + } + } + x_45 = x_45_phi; + x_42 = x_42_phi; + x_60_phi = x_45; + x_61_phi = x_42; + if (x_42) { + break; + } + { + x_7 = asint((x_9 + asint(1))); + x_41_phi = x_42; + x_8_phi = x_7; + x_44_phi = x_45; + } + } + x_60 = x_60_phi; + const bool x_61 = x_61_phi; + x_63_phi = x_60; + if (x_61) { + break; + } + x_63_phi = 1.0f; + break; + } + return x_63_phi; +} + +void main_1() { + const float x_34 = makeFrame_(); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.msl new file mode 100644 index 0000000000..c1f76729d2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float makeFrame_(constant buf0& x_6) { + float x_60 = 0.0f; + float x_63_phi = 0.0f; + while (true) { + bool x_41 = false; + float x_44 = 0.0f; + float x_45 = 0.0f; + bool x_42 = false; + bool x_41_phi = false; + int x_8_phi = 0; + float x_44_phi = 0.0f; + float x_60_phi = 0.0f; + bool x_61_phi = false; + x_41_phi = false; + x_8_phi = 0; + x_44_phi = 0.0f; + while (true) { + float x_50 = 0.0f; + int x_9 = 0; + bool x_52 = false; + int x_7 = 0; + float x_50_phi = 0.0f; + int x_9_phi = 0; + bool x_52_phi = false; + float x_45_phi = 0.0f; + bool x_42_phi = false; + x_41 = x_41_phi; + int const x_8 = x_8_phi; + x_44 = x_44_phi; + x_60_phi = x_44; + x_61_phi = x_41; + if ((x_8 < 1)) { + } else { + break; + } + x_50_phi = x_44; + x_9_phi = x_8; + x_52_phi = x_41; + while (true) { + x_50 = x_50_phi; + x_9 = x_9_phi; + x_52 = x_52_phi; + float const x_54 = x_6.injectionSwitch.y; + x_45_phi = x_50; + x_42_phi = x_52; + if ((1 < int(x_54))) { + } else { + break; + } + x_45_phi = 1.0f; + x_42_phi = true; + break; + { + x_50_phi = 0.0f; + x_9_phi = 0; + x_52_phi = false; + } + } + x_45 = x_45_phi; + x_42 = x_42_phi; + x_60_phi = x_45; + x_61_phi = x_42; + if (x_42) { + break; + } + { + x_7 = as_type((x_9 + as_type(1))); + x_41_phi = x_42; + x_8_phi = x_7; + x_44_phi = x_45; + } + } + x_60 = x_60_phi; + bool const x_61 = x_61_phi; + x_63_phi = x_60; + if (x_61) { + break; + } + x_63_phi = 1.0f; + break; + } + float const x_63 = x_63_phi; + return x_63; +} + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float const x_34 = makeFrame_(x_6); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..ecb08614c6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.spvasm @@ -0,0 +1,243 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 126 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %makeFrame_ "makeFrame_" + OpName %x_60 "x_60" + OpName %x_63_phi "x_63_phi" + OpName %x_41 "x_41" + OpName %x_44 "x_44" + OpName %x_45 "x_45" + OpName %x_42 "x_42" + OpName %x_41_phi "x_41_phi" + OpName %x_8_phi "x_8_phi" + OpName %x_44_phi "x_44_phi" + OpName %x_60_phi "x_60_phi" + OpName %x_61_phi "x_61_phi" + OpName %x_50 "x_50" + OpName %x_9 "x_9" + OpName %x_52 "x_52" + OpName %x_7 "x_7" + OpName %x_50_phi "x_50_phi" + OpName %x_9_phi "x_9_phi" + OpName %x_52_phi "x_52_phi" + OpName %x_45_phi "x_45_phi" + OpName %x_42_phi "x_42_phi" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %12 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %26 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %false = OpConstantFalse %bool + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %true = OpConstantTrue %bool + %void = OpTypeVoid + %108 = OpTypeFunction %void + %113 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %114 = OpTypeFunction %void %main_out + %makeFrame_ = OpFunction %float None %12 + %14 = OpLabel + %x_60 = OpVariable %_ptr_Function_float Function %17 + %x_63_phi = OpVariable %_ptr_Function_float Function %17 + %x_41 = OpVariable %_ptr_Function_bool Function %26 + %x_44 = OpVariable %_ptr_Function_float Function %17 + %x_45 = OpVariable %_ptr_Function_float Function %17 + %x_42 = OpVariable %_ptr_Function_bool Function %26 + %x_41_phi = OpVariable %_ptr_Function_bool Function %26 + %x_8_phi = OpVariable %_ptr_Function_int Function %34 + %x_44_phi = OpVariable %_ptr_Function_float Function %17 + %x_60_phi = OpVariable %_ptr_Function_float Function %17 + %x_61_phi = OpVariable %_ptr_Function_bool Function %26 + %x_50 = OpVariable %_ptr_Function_float Function %17 + %x_9 = OpVariable %_ptr_Function_int Function %34 + %x_52 = OpVariable %_ptr_Function_bool Function %26 + %x_7 = OpVariable %_ptr_Function_int Function %34 + %x_50_phi = OpVariable %_ptr_Function_float Function %17 + %x_9_phi = OpVariable %_ptr_Function_int Function %34 + %x_52_phi = OpVariable %_ptr_Function_bool Function %26 + %x_45_phi = OpVariable %_ptr_Function_float Function %17 + %x_42_phi = OpVariable %_ptr_Function_bool Function %26 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + OpStore %x_41_phi %false + OpStore %x_8_phi %int_0 + OpStore %x_44_phi %float_0 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %54 = OpLoad %bool %x_41_phi + OpStore %x_41 %54 + %55 = OpLoad %int %x_8_phi + %56 = OpLoad %float %x_44_phi + OpStore %x_44 %56 + %57 = OpLoad %float %x_44 + OpStore %x_60_phi %57 + %58 = OpLoad %bool %x_41 + OpStore %x_61_phi %58 + %60 = OpSLessThan %bool %55 %int_1 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %42 + %61 = OpLabel + %64 = OpLoad %float %x_44 + OpStore %x_50_phi %64 + OpStore %x_9_phi %55 + %65 = OpLoad %bool %x_41 + OpStore %x_52_phi %65 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %70 = OpLoad %float %x_50_phi + OpStore %x_50 %70 + %71 = OpLoad %int %x_9_phi + OpStore %x_9 %71 + %72 = OpLoad %bool %x_52_phi + OpStore %x_52 %72 + %77 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %78 = OpLoad %float %77 + %79 = OpLoad %float %x_50 + OpStore %x_45_phi %79 + %80 = OpLoad %bool %x_52 + OpStore %x_42_phi %80 + %81 = OpConvertFToS %int %78 + %82 = OpSLessThan %bool %int_1 %81 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + OpBranch %83 + %85 = OpLabel + OpBranch %67 + %83 = OpLabel + OpStore %x_45_phi %float_1 + OpStore %x_42_phi %true + OpBranch %67 + %68 = OpLabel + OpStore %x_50_phi %float_0 + OpStore %x_9_phi %int_0 + OpStore %x_52_phi %false + OpBranch %66 + %67 = OpLabel + %88 = OpLoad %float %x_45_phi + OpStore %x_45 %88 + %89 = OpLoad %bool %x_42_phi + OpStore %x_42 %89 + %90 = OpLoad %float %x_45 + OpStore %x_60_phi %90 + %91 = OpLoad %bool %x_42 + OpStore %x_61_phi %91 + %92 = OpLoad %bool %x_42 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + OpBranch %42 + %93 = OpLabel + OpBranch %43 + %43 = OpLabel + %96 = OpLoad %int %x_9 + %97 = OpCopyObject %int %int_1 + %98 = OpIAdd %int %96 %97 + %95 = OpCopyObject %int %98 + OpStore %x_7 %95 + %99 = OpLoad %bool %x_42 + OpStore %x_41_phi %99 + %100 = OpLoad %int %x_7 + OpStore %x_8_phi %100 + %101 = OpLoad %float %x_45 + OpStore %x_44_phi %101 + OpBranch %41 + %42 = OpLabel + %102 = OpLoad %float %x_60_phi + OpStore %x_60 %102 + %103 = OpLoad %bool %x_61_phi + %104 = OpLoad %float %x_60 + OpStore %x_63_phi %104 + OpSelectionMerge %105 None + OpBranchConditional %103 %106 %105 + %106 = OpLabel + OpBranch %20 + %105 = OpLabel + OpStore %x_63_phi %float_1 + OpBranch %20 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + %107 = OpLoad %float %x_63_phi + OpReturnValue %107 + OpFunctionEnd + %main_1 = OpFunction %void None %108 + %111 = OpLabel + %112 = OpFunctionCall %float %makeFrame_ + OpStore %x_GLF_color %113 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %114 +%tint_symbol = OpFunctionParameter %main_out + %118 = OpLabel + %119 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %119 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %108 + %121 = OpLabel + %122 = OpFunctionCall %void %main_1 + %124 = OpLoad %v4float %x_GLF_color + %125 = OpCompositeConstruct %main_out %124 + %123 = OpFunctionCall %void %tint_symbol_2 %125 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..d594596ab1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/injection-switch-as-comparison/0.wgsl.expected.wgsl @@ -0,0 +1,112 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn makeFrame_() -> f32 { + var x_60 : f32; + var x_63_phi : f32; + loop { + var x_41 : bool; + var x_44 : f32; + var x_45 : f32; + var x_42 : bool; + var x_41_phi : bool; + var x_8_phi : i32; + var x_44_phi : f32; + var x_60_phi : f32; + var x_61_phi : bool; + x_41_phi = false; + x_8_phi = 0; + x_44_phi = 0.0; + loop { + var x_50 : f32; + var x_9 : i32; + var x_52 : bool; + var x_7 : i32; + var x_50_phi : f32; + var x_9_phi : i32; + var x_52_phi : bool; + var x_45_phi : f32; + var x_42_phi : bool; + x_41 = x_41_phi; + let x_8 : i32 = x_8_phi; + x_44 = x_44_phi; + x_60_phi = x_44; + x_61_phi = x_41; + if ((x_8 < 1)) { + } else { + break; + } + x_50_phi = x_44; + x_9_phi = x_8; + x_52_phi = x_41; + loop { + x_50 = x_50_phi; + x_9 = x_9_phi; + x_52 = x_52_phi; + let x_54 : f32 = x_6.injectionSwitch.y; + x_45_phi = x_50; + x_42_phi = x_52; + if ((1 < i32(x_54))) { + } else { + break; + } + x_45_phi = 1.0; + x_42_phi = true; + break; + + continuing { + x_50_phi = 0.0; + x_9_phi = 0; + x_52_phi = false; + } + } + x_45 = x_45_phi; + x_42 = x_42_phi; + x_60_phi = x_45; + x_61_phi = x_42; + if (x_42) { + break; + } + + continuing { + x_7 = bitcast((x_9 + bitcast(1))); + x_41_phi = x_42; + x_8_phi = x_7; + x_44_phi = x_45; + } + } + x_60 = x_60_phi; + let x_61 : bool = x_61_phi; + x_63_phi = x_60; + if (x_61) { + break; + } + x_63_phi = 1.0; + break; + } + let x_63 : f32 = x_63_phi; + return x_63; +} + +fn main_1() { + let x_34 : f32 = makeFrame_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm new file mode 100644 index 0000000000..9ec352e87f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm @@ -0,0 +1,96 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %S "S" + OpMemberName %S 0 "f1" + OpMemberName %S 1 "f2" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %S 0 RelaxedPrecision + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + OpDecorate %6 RelaxedPrecision + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %S = OpTypeStruct %int %mat2v2float +%_ptr_Function_S = OpTypePointer Function %S + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %25 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %28 = OpConstantComposite %v2float %float_3 %float_4 + %29 = OpConstantComposite %mat2v2float %25 %28 + %float_0_5 = OpConstant %float 0.5 + %float_n0_5 = OpConstant %float -0.5 + %32 = OpConstantComposite %v2float %float_0_5 %float_n0_5 + %33 = OpConstantComposite %v2float %float_n0_5 %float_0_5 + %34 = OpConstantComposite %mat2v2float %32 %33 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %8 + %40 = OpLabel + %41 = OpVariable %_ptr_Function_mat2v2float Function + %6 = OpVariable %_ptr_Function_int Function + %42 = OpVariable %_ptr_Function_mat2v2float Function + %43 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %44 = OpLoad %float %43 + %45 = OpFOrdLessThan %bool %44 %float_0 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpStore %42 %29 + OpBranch %46 + %48 = OpLabel + OpStore %42 %34 + OpBranch %46 + %46 = OpLabel + %49 = OpPhi %mat2v2float %29 %47 %34 %48 + %50 = OpTranspose %mat2v2float %49 + %51 = OpCompositeConstruct %S %int_1 %50 + %52 = OpCompositeExtract %int %51 0 + OpStore %6 %52 + %53 = OpCompositeExtract %mat2v2float %51 1 + OpStore %41 %53 + %54 = OpConvertSToF %float %52 + %55 = OpAccessChain %_ptr_Function_float %41 %int_0 %uint_0 + %56 = OpLoad %mat2v2float %41 + %57 = OpCompositeExtract %float %56 0 0 + %58 = OpAccessChain %_ptr_Function_float %41 %int_1 %uint_0 + %59 = OpLoad %mat2v2float %41 + %60 = OpCompositeExtract %float %59 1 0 + %61 = OpFAdd %float %57 %60 + %62 = OpAccessChain %_ptr_Function_float %41 %int_0 %uint_1 + %63 = OpLoad %mat2v2float %41 + %64 = OpCompositeExtract %float %63 0 1 + %65 = OpAccessChain %_ptr_Function_float %41 %int_1 %uint_1 + %66 = OpLoad %mat2v2float %41 + %67 = OpCompositeExtract %float %66 1 1 + %68 = OpFAdd %float %64 %67 + %69 = OpConvertSToF %float %52 + %70 = OpCompositeConstruct %v4float %54 %61 %68 %69 + OpStore %_GLF_color %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..c0d5468a3a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.hlsl @@ -0,0 +1,50 @@ +struct S { + int f1; + float2x2 f2; +}; + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 x_41 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + int x_6 = 0; + float2x2 x_42 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 x_49_phi = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + const float x_44 = gl_FragCoord.x; + if ((x_44 < 0.0f)) { + x_42 = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + x_49_phi = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + } else { + x_42 = float2x2(float2(0.5f, -0.5f), float2(-0.5f, 0.5f)); + x_49_phi = float2x2(float2(0.5f, -0.5f), float2(-0.5f, 0.5f)); + } + const S x_51 = {1, transpose(x_49_phi)}; + const int x_52 = x_51.f1; + x_6 = x_52; + x_41 = x_51.f2; + const float2x2 x_56 = x_41; + const float2x2 x_59 = x_41; + const float2x2 x_63 = x_41; + x_GLF_color = float4(float(x_52), (x_56[0u].x + x_59[1u].x), (x_63[0u].y + x_41[1u].y), float(x_52)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..256e64b85c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.msl @@ -0,0 +1,50 @@ +#include + +using namespace metal; +struct S { + int f1; + float2x2 f2; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2x2 x_41 = float2x2(0.0f); + int x_6 = 0; + float2x2 x_42 = float2x2(0.0f); + float2x2 x_49_phi = float2x2(0.0f); + float const x_44 = (*(tint_symbol_5)).x; + if ((x_44 < 0.0f)) { + x_42 = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + x_49_phi = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + } else { + x_42 = float2x2(float2(0.5f, -0.5f), float2(-0.5f, 0.5f)); + x_49_phi = float2x2(float2(0.5f, -0.5f), float2(-0.5f, 0.5f)); + } + float2x2 const x_49 = x_49_phi; + S const x_51 = {.f1=1, .f2=transpose(x_49)}; + int const x_52 = x_51.f1; + x_6 = x_52; + x_41 = x_51.f2; + float2x2 const x_56 = x_41; + float2x2 const x_59 = x_41; + float2x2 const x_63 = x_41; + float2x2 const x_66 = x_41; + *(tint_symbol_6) = float4(float(x_52), (x_56[0u].x + x_59[1u].x), (x_63[0u].y + x_66[1u].y), float(x_52)); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..5706393380 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.spvasm @@ -0,0 +1,138 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_41 "x_41" + OpName %x_6 "x_6" + OpName %x_42 "x_42" + OpName %x_49_phi "x_49_phi" + OpName %S "S" + OpMemberName %S 0 "f1" + OpMemberName %S 1 "f2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 8 + OpMemberDecorate %S 1 ColMajor + OpMemberDecorate %S 1 MatrixStride 8 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %19 = OpConstantNull %mat2v2float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %39 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %42 = OpConstantComposite %v2float %float_3 %float_4 + %43 = OpConstantComposite %mat2v2float %39 %42 + %float_0_5 = OpConstant %float 0.5 + %float_n0_5 = OpConstant %float -0.5 + %46 = OpConstantComposite %v2float %float_0_5 %float_n0_5 + %47 = OpConstantComposite %v2float %float_n0_5 %float_0_5 + %48 = OpConstantComposite %mat2v2float %46 %47 + %S = OpTypeStruct %int %mat2v2float + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %74 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_41 = OpVariable %_ptr_Function_mat2v2float Function %19 + %x_6 = OpVariable %_ptr_Function_int Function %23 + %x_42 = OpVariable %_ptr_Function_mat2v2float Function %19 + %x_49_phi = OpVariable %_ptr_Function_mat2v2float Function %19 + %29 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %30 = OpLoad %float %29 + %32 = OpFOrdLessThan %bool %30 %float_0 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + OpStore %x_42 %43 + OpStore %x_49_phi %43 + OpBranch %34 + %36 = OpLabel + OpStore %x_42 %48 + OpStore %x_49_phi %48 + OpBranch %34 + %34 = OpLabel + %49 = OpLoad %mat2v2float %x_49_phi + %52 = OpTranspose %mat2v2float %49 + %53 = OpCompositeConstruct %S %int_1 %52 + %54 = OpCompositeExtract %int %53 0 + OpStore %x_6 %54 + %55 = OpCompositeExtract %mat2v2float %53 1 + OpStore %x_41 %55 + %56 = OpLoad %mat2v2float %x_41 + %57 = OpLoad %mat2v2float %x_41 + %58 = OpLoad %mat2v2float %x_41 + %59 = OpLoad %mat2v2float %x_41 + %60 = OpConvertSToF %float %54 + %61 = OpCompositeExtract %v2float %56 0 + %62 = OpCompositeExtract %float %61 0 + %64 = OpCompositeExtract %v2float %57 1 + %65 = OpCompositeExtract %float %64 0 + %66 = OpFAdd %float %62 %65 + %67 = OpCompositeExtract %v2float %58 0 + %68 = OpCompositeExtract %float %67 1 + %69 = OpCompositeExtract %v2float %59 1 + %70 = OpCompositeExtract %float %69 1 + %71 = OpFAdd %float %68 %70 + %72 = OpConvertSToF %float %54 + %73 = OpCompositeConstruct %v4float %60 %66 %71 %72 + OpStore %x_GLF_color %73 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %74 +%tint_symbol_1 = OpFunctionParameter %main_out + %78 = OpLabel + %79 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %79 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %81 = OpLabel + %82 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %82 + %83 = OpFunctionCall %void %main_1 + %85 = OpLoad %v4float %x_GLF_color + %86 = OpCompositeConstruct %main_out %85 + %84 = OpFunctionCall %void %tint_symbol_3 %86 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..4df9f94d7d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.spvasm.expected.wgsl @@ -0,0 +1,50 @@ +struct S { + f1 : i32; + f2 : mat2x2; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var x_41 : mat2x2; + var x_6 : i32; + var x_42 : mat2x2; + var x_49_phi : mat2x2; + let x_44 : f32 = gl_FragCoord.x; + if ((x_44 < 0.0)) { + x_42 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + x_49_phi = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + } else { + x_42 = mat2x2(vec2(0.5, -0.5), vec2(-0.5, 0.5)); + x_49_phi = mat2x2(vec2(0.5, -0.5), vec2(-0.5, 0.5)); + } + let x_49 : mat2x2 = x_49_phi; + let x_51 : S = S(1, transpose(x_49)); + let x_52 : i32 = x_51.f1; + x_6 = x_52; + x_41 = x_51.f2; + let x_55 : ptr = &(x_41[0].x); + let x_56 : mat2x2 = x_41; + let x_58 : ptr = &(x_41[1].x); + let x_59 : mat2x2 = x_41; + let x_62 : ptr = &(x_41[0].y); + let x_63 : mat2x2 = x_41; + let x_65 : ptr = &(x_41[1].y); + let x_66 : mat2x2 = x_41; + x_GLF_color = vec4(f32(x_52), (x_56[0u].x + x_59[1u].x), (x_63[0u].y + x_66[1u].y), f32(x_52)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl new file mode 100644 index 0000000000..4df9f94d7d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl @@ -0,0 +1,50 @@ +struct S { + f1 : i32; + f2 : mat2x2; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var x_41 : mat2x2; + var x_6 : i32; + var x_42 : mat2x2; + var x_49_phi : mat2x2; + let x_44 : f32 = gl_FragCoord.x; + if ((x_44 < 0.0)) { + x_42 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + x_49_phi = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + } else { + x_42 = mat2x2(vec2(0.5, -0.5), vec2(-0.5, 0.5)); + x_49_phi = mat2x2(vec2(0.5, -0.5), vec2(-0.5, 0.5)); + } + let x_49 : mat2x2 = x_49_phi; + let x_51 : S = S(1, transpose(x_49)); + let x_52 : i32 = x_51.f1; + x_6 = x_52; + x_41 = x_51.f2; + let x_55 : ptr = &(x_41[0].x); + let x_56 : mat2x2 = x_41; + let x_58 : ptr = &(x_41[1].x); + let x_59 : mat2x2 = x_41; + let x_62 : ptr = &(x_41[0].y); + let x_63 : mat2x2 = x_41; + let x_65 : ptr = &(x_41[1].y); + let x_66 : mat2x2 = x_41; + x_GLF_color = vec4(f32(x_52), (x_56[0u].x + x_59[1u].x), (x_63[0u].y + x_66[1u].y), f32(x_52)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..c0d5468a3a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.hlsl @@ -0,0 +1,50 @@ +struct S { + int f1; + float2x2 f2; +}; + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2x2 x_41 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + int x_6 = 0; + float2x2 x_42 = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 x_49_phi = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + const float x_44 = gl_FragCoord.x; + if ((x_44 < 0.0f)) { + x_42 = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + x_49_phi = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + } else { + x_42 = float2x2(float2(0.5f, -0.5f), float2(-0.5f, 0.5f)); + x_49_phi = float2x2(float2(0.5f, -0.5f), float2(-0.5f, 0.5f)); + } + const S x_51 = {1, transpose(x_49_phi)}; + const int x_52 = x_51.f1; + x_6 = x_52; + x_41 = x_51.f2; + const float2x2 x_56 = x_41; + const float2x2 x_59 = x_41; + const float2x2 x_63 = x_41; + x_GLF_color = float4(float(x_52), (x_56[0u].x + x_59[1u].x), (x_63[0u].y + x_41[1u].y), float(x_52)); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..256e64b85c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.msl @@ -0,0 +1,50 @@ +#include + +using namespace metal; +struct S { + int f1; + float2x2 f2; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2x2 x_41 = float2x2(0.0f); + int x_6 = 0; + float2x2 x_42 = float2x2(0.0f); + float2x2 x_49_phi = float2x2(0.0f); + float const x_44 = (*(tint_symbol_5)).x; + if ((x_44 < 0.0f)) { + x_42 = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + x_49_phi = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + } else { + x_42 = float2x2(float2(0.5f, -0.5f), float2(-0.5f, 0.5f)); + x_49_phi = float2x2(float2(0.5f, -0.5f), float2(-0.5f, 0.5f)); + } + float2x2 const x_49 = x_49_phi; + S const x_51 = {.f1=1, .f2=transpose(x_49)}; + int const x_52 = x_51.f1; + x_6 = x_52; + x_41 = x_51.f2; + float2x2 const x_56 = x_41; + float2x2 const x_59 = x_41; + float2x2 const x_63 = x_41; + float2x2 const x_66 = x_41; + *(tint_symbol_6) = float4(float(x_52), (x_56[0u].x + x_59[1u].x), (x_63[0u].y + x_66[1u].y), float(x_52)); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5706393380 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.spvasm @@ -0,0 +1,138 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_41 "x_41" + OpName %x_6 "x_6" + OpName %x_42 "x_42" + OpName %x_49_phi "x_49_phi" + OpName %S "S" + OpMemberName %S 0 "f1" + OpMemberName %S 1 "f2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 8 + OpMemberDecorate %S 1 ColMajor + OpMemberDecorate %S 1 MatrixStride 8 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %19 = OpConstantNull %mat2v2float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %39 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %42 = OpConstantComposite %v2float %float_3 %float_4 + %43 = OpConstantComposite %mat2v2float %39 %42 + %float_0_5 = OpConstant %float 0.5 + %float_n0_5 = OpConstant %float -0.5 + %46 = OpConstantComposite %v2float %float_0_5 %float_n0_5 + %47 = OpConstantComposite %v2float %float_n0_5 %float_0_5 + %48 = OpConstantComposite %mat2v2float %46 %47 + %S = OpTypeStruct %int %mat2v2float + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %74 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_41 = OpVariable %_ptr_Function_mat2v2float Function %19 + %x_6 = OpVariable %_ptr_Function_int Function %23 + %x_42 = OpVariable %_ptr_Function_mat2v2float Function %19 + %x_49_phi = OpVariable %_ptr_Function_mat2v2float Function %19 + %29 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %30 = OpLoad %float %29 + %32 = OpFOrdLessThan %bool %30 %float_0 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + OpStore %x_42 %43 + OpStore %x_49_phi %43 + OpBranch %34 + %36 = OpLabel + OpStore %x_42 %48 + OpStore %x_49_phi %48 + OpBranch %34 + %34 = OpLabel + %49 = OpLoad %mat2v2float %x_49_phi + %52 = OpTranspose %mat2v2float %49 + %53 = OpCompositeConstruct %S %int_1 %52 + %54 = OpCompositeExtract %int %53 0 + OpStore %x_6 %54 + %55 = OpCompositeExtract %mat2v2float %53 1 + OpStore %x_41 %55 + %56 = OpLoad %mat2v2float %x_41 + %57 = OpLoad %mat2v2float %x_41 + %58 = OpLoad %mat2v2float %x_41 + %59 = OpLoad %mat2v2float %x_41 + %60 = OpConvertSToF %float %54 + %61 = OpCompositeExtract %v2float %56 0 + %62 = OpCompositeExtract %float %61 0 + %64 = OpCompositeExtract %v2float %57 1 + %65 = OpCompositeExtract %float %64 0 + %66 = OpFAdd %float %62 %65 + %67 = OpCompositeExtract %v2float %58 0 + %68 = OpCompositeExtract %float %67 1 + %69 = OpCompositeExtract %v2float %59 1 + %70 = OpCompositeExtract %float %69 1 + %71 = OpFAdd %float %68 %70 + %72 = OpConvertSToF %float %54 + %73 = OpCompositeConstruct %v4float %60 %66 %71 %72 + OpStore %x_GLF_color %73 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %74 +%tint_symbol_1 = OpFunctionParameter %main_out + %78 = OpLabel + %79 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %79 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %81 = OpLabel + %82 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %82 + %83 = OpFunctionCall %void %main_1 + %85 = OpLoad %v4float %x_GLF_color + %86 = OpCompositeConstruct %main_out %85 + %84 = OpFunctionCall %void %tint_symbol_3 %86 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..4df9f94d7d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/int-mat2-struct/0-opt.wgsl.expected.wgsl @@ -0,0 +1,50 @@ +struct S { + f1 : i32; + f2 : mat2x2; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var x_41 : mat2x2; + var x_6 : i32; + var x_42 : mat2x2; + var x_49_phi : mat2x2; + let x_44 : f32 = gl_FragCoord.x; + if ((x_44 < 0.0)) { + x_42 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + x_49_phi = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + } else { + x_42 = mat2x2(vec2(0.5, -0.5), vec2(-0.5, 0.5)); + x_49_phi = mat2x2(vec2(0.5, -0.5), vec2(-0.5, 0.5)); + } + let x_49 : mat2x2 = x_49_phi; + let x_51 : S = S(1, transpose(x_49)); + let x_52 : i32 = x_51.f1; + x_6 = x_52; + x_41 = x_51.f2; + let x_55 : ptr = &(x_41[0].x); + let x_56 : mat2x2 = x_41; + let x_58 : ptr = &(x_41[1].x); + let x_59 : mat2x2 = x_41; + let x_62 : ptr = &(x_41[0].y); + let x_63 : mat2x2 = x_41; + let x_65 : ptr = &(x_41[1].y); + let x_66 : mat2x2 = x_41; + x_GLF_color = vec4(f32(x_52), (x_56[0u].x + x_59[1u].x), (x_63[0u].y + x_66[1u].y), f32(x_52)); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm new file mode 100644 index 0000000000..d758ac5673 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm @@ -0,0 +1,168 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %k "k" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %GLF_dead0j "GLF_dead0j" + OpName %donor_replacementGLF_dead0stack "donor_replacementGLF_dead0stack" + OpName %donor_replacementGLF_dead0top "donor_replacementGLF_dead0top" + OpName %matrix_b "matrix_b" + OpName %b "b" + OpName %_GLF_color "_GLF_color" + OpDecorate %k RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %GLF_dead0j RelaxedPrecision + OpDecorate %donor_replacementGLF_dead0stack RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %donor_replacementGLF_dead0top RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %b RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %27 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %int_9 = OpConstant %int 9 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_3 = OpConstant %int 3 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %52 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %27 + %53 = OpLabel + %k = OpVariable %_ptr_Function_int Function + %GLF_dead0j = OpVariable %_ptr_Function_int Function +%donor_replacementGLF_dead0stack = OpVariable %_ptr_Function__arr_int_uint_10 Function +%donor_replacementGLF_dead0top = OpVariable %_ptr_Function_int Function + %54 = OpVariable %_ptr_Function_int Function + %matrix_b = OpVariable %_ptr_Function_v4float Function + %b = OpVariable %_ptr_Function_int Function + OpStore %k %int_0 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %12 = OpLoad %int %k + %59 = OpSLessThan %bool %12 %int_4 + OpBranchConditional %59 %60 %56 + %60 = OpLabel + %61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %62 = OpLoad %float %61 + %63 = OpFOrdGreaterThan %bool %float_0 %62 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + OpStore %GLF_dead0j %int_1 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %70 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead0stack %int_0 + %13 = OpLoad %int %70 + %71 = OpSLessThanEqual %bool %int_1 %13 + OpBranchConditional %71 %72 %67 + %72 = OpLabel + OpBranch %68 + %68 = OpLabel + OpBranch %66 + %67 = OpLabel + %14 = OpLoad %int %donor_replacementGLF_dead0top + %73 = OpSGreaterThanEqual %bool %14 %int_0 + %15 = OpLoad %int %donor_replacementGLF_dead0top + %74 = OpSLessThan %bool %15 %int_9 + %75 = OpLogicalAnd %bool %73 %74 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %78 + %77 = OpLabel + %16 = OpLoad %int %donor_replacementGLF_dead0top + %17 = OpIAdd %int %16 %int_1 + OpStore %donor_replacementGLF_dead0top %17 + OpStore %54 %17 + OpBranch %76 + %78 = OpLabel + OpStore %54 %int_0 + OpBranch %76 + %76 = OpLabel + %18 = OpLoad %int %54 + %79 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead0stack %18 + OpStore %79 %int_1 + OpBranch %64 + %64 = OpLabel + OpStore %matrix_b %47 + OpStore %b %int_3 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %19 = OpLoad %int %b + %84 = OpSGreaterThanEqual %bool %19 %int_0 + OpBranchConditional %84 %85 %81 + %85 = OpLabel + %20 = OpLoad %int %b + %21 = OpLoad %int %b + %86 = OpAccessChain %_ptr_Function_float %matrix_b %21 + %87 = OpLoad %float %86 + %88 = OpFSub %float %87 %float_1 + %89 = OpAccessChain %_ptr_Function_float %matrix_b %20 + OpStore %89 %88 + OpBranch %82 + %82 = OpLabel + %22 = OpLoad %int %b + %23 = OpISub %int %22 %int_1 + OpStore %b %23 + OpBranch %80 + %81 = OpLabel + OpBranch %57 + %57 = OpLabel + %24 = OpLoad %int %k + %25 = OpIAdd %int %24 %int_1 + OpStore %k %25 + OpBranch %55 + %56 = OpLabel + OpStore %_GLF_color %52 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f1268b0bd8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,71 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int k = 0; + int GLF_dead0j = 0; + int donor_replacementGLF_dead0stack[10] = (int[10])0; + int donor_replacementGLF_dead0top = 0; + int x_54 = 0; + float4 matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f); + int b = 0; + k = 0; + { + for(; (k < 4); k = (k + 1)) { + const float x_62 = asfloat(x_6[0].y); + if ((0.0f > x_62)) { + GLF_dead0j = 1; + while (true) { + const int x_13 = donor_replacementGLF_dead0stack[0]; + if ((1 <= x_13)) { + } else { + break; + } + } + bool tint_tmp = (donor_replacementGLF_dead0top >= 0); + if (tint_tmp) { + tint_tmp = (donor_replacementGLF_dead0top < 9); + } + if ((tint_tmp)) { + const int x_17 = (donor_replacementGLF_dead0top + 1); + donor_replacementGLF_dead0top = x_17; + x_54 = x_17; + } else { + x_54 = 0; + } + donor_replacementGLF_dead0stack[x_54] = 1; + } + matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f); + b = 3; + { + for(; (b >= 0); b = (b - 1)) { + const int x_20 = b; + const float x_87 = matrix_b[b]; + set_float4(matrix_b, x_20, (x_87 - 1.0f)); + } + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..837b916059 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,88 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int k = 0; + int GLF_dead0j = 0; + tint_array_wrapper donor_replacementGLF_dead0stack = {}; + int donor_replacementGLF_dead0top = 0; + int x_54 = 0; + float4 matrix_b = 0.0f; + int b = 0; + k = 0; + while (true) { + int const x_12 = k; + if ((x_12 < 4)) { + } else { + break; + } + float const x_62 = x_6.injectionSwitch.y; + if ((0.0f > x_62)) { + GLF_dead0j = 1; + while (true) { + int const x_13 = donor_replacementGLF_dead0stack.arr[0]; + if ((1 <= x_13)) { + } else { + break; + } + } + int const x_14 = donor_replacementGLF_dead0top; + int const x_15 = donor_replacementGLF_dead0top; + if (((x_14 >= 0) && (x_15 < 9))) { + int const x_16 = donor_replacementGLF_dead0top; + int const x_17 = (x_16 + 1); + donor_replacementGLF_dead0top = x_17; + x_54 = x_17; + } else { + x_54 = 0; + } + int const x_18 = x_54; + donor_replacementGLF_dead0stack.arr[x_18] = 1; + } + matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f); + b = 3; + while (true) { + int const x_19 = b; + if ((x_19 >= 0)) { + } else { + break; + } + int const x_20 = b; + int const x_21 = b; + float const x_87 = matrix_b[x_21]; + matrix_b[x_20] = (x_87 - 1.0f); + { + int const x_22 = b; + b = (x_22 - 1); + } + } + { + int const x_24 = k; + k = (x_24 + 1); + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..de2d980fb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,205 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 115 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %k "k" + OpName %GLF_dead0j "GLF_dead0j" + OpName %donor_replacementGLF_dead0stack "donor_replacementGLF_dead0stack" + OpName %donor_replacementGLF_dead0top "donor_replacementGLF_dead0top" + OpName %x_54 "x_54" + OpName %matrix_b "matrix_b" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %26 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 + %79 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_3 = OpConstant %int 3 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %102 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %103 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %k = OpVariable %_ptr_Function_int Function %19 + %GLF_dead0j = OpVariable %_ptr_Function_int Function %19 +%donor_replacementGLF_dead0stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %26 +%donor_replacementGLF_dead0top = OpVariable %_ptr_Function_int Function %19 + %x_54 = OpVariable %_ptr_Function_int Function %19 + %matrix_b = OpVariable %_ptr_Function_v4float Function %9 + %b = OpVariable %_ptr_Function_int Function %19 + OpStore %k %int_0 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %k + %39 = OpSLessThan %bool %37 %int_4 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %34 + %41 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %48 = OpLoad %float %47 + %50 = OpFOrdGreaterThan %bool %float_0 %48 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + OpStore %GLF_dead0j %int_1 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead0stack %int_0 + %59 = OpLoad %int %58 + %60 = OpSLessThanEqual %bool %int_1 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %55 + %61 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %54 + %55 = OpLabel + %64 = OpLoad %int %donor_replacementGLF_dead0top + %65 = OpLoad %int %donor_replacementGLF_dead0top + %66 = OpSGreaterThanEqual %bool %64 %int_0 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %67 + %68 = OpLabel + %70 = OpSLessThan %bool %65 %int_9 + OpBranch %67 + %67 = OpLabel + %71 = OpPhi %bool %66 %55 %70 %68 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %74 + %73 = OpLabel + %75 = OpLoad %int %donor_replacementGLF_dead0top + %76 = OpIAdd %int %75 %int_1 + OpStore %donor_replacementGLF_dead0top %76 + OpStore %x_54 %76 + OpBranch %72 + %74 = OpLabel + OpStore %x_54 %int_0 + OpBranch %72 + %72 = OpLabel + %77 = OpLoad %int %x_54 + %78 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead0stack %77 + OpStore %78 %int_1 + OpBranch %51 + %51 = OpLabel + OpStore %matrix_b %79 + OpStore %b %int_3 + OpBranch %81 + %81 = OpLabel + OpLoopMerge %82 %83 None + OpBranch %84 + %84 = OpLabel + %85 = OpLoad %int %b + %86 = OpSGreaterThanEqual %bool %85 %int_0 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %89 + %88 = OpLabel + OpBranch %87 + %89 = OpLabel + OpBranch %82 + %87 = OpLabel + %90 = OpLoad %int %b + %91 = OpLoad %int %b + %93 = OpAccessChain %_ptr_Function_float %matrix_b %91 + %94 = OpLoad %float %93 + %95 = OpAccessChain %_ptr_Function_float %matrix_b %90 + %97 = OpFSub %float %94 %float_1 + OpStore %95 %97 + OpBranch %83 + %83 = OpLabel + %98 = OpLoad %int %b + %99 = OpISub %int %98 %int_1 + OpStore %b %99 + OpBranch %81 + %82 = OpLabel + OpBranch %35 + %35 = OpLabel + %100 = OpLoad %int %k + %101 = OpIAdd %int %100 %int_1 + OpStore %k %101 + OpBranch %33 + %34 = OpLabel + OpStore %x_GLF_color %102 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %103 +%tint_symbol = OpFunctionParameter %main_out + %107 = OpLabel + %108 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %108 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %110 = OpLabel + %111 = OpFunctionCall %void %main_1 + %113 = OpLoad %v4float %x_GLF_color + %114 = OpCompositeConstruct %main_out %113 + %112 = OpFunctionCall %void %tint_symbol_2 %114 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..26a8a10cfe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,85 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var k : i32; + var GLF_dead0j : i32; + var donor_replacementGLF_dead0stack : array; + var donor_replacementGLF_dead0top : i32; + var x_54 : i32; + var matrix_b : vec4; + var b : i32; + k = 0; + loop { + let x_12 : i32 = k; + if ((x_12 < 4)) { + } else { + break; + } + let x_62 : f32 = x_6.injectionSwitch.y; + if ((0.0 > x_62)) { + GLF_dead0j = 1; + loop { + let x_13 : i32 = donor_replacementGLF_dead0stack[0]; + if ((1 <= x_13)) { + } else { + break; + } + } + let x_14 : i32 = donor_replacementGLF_dead0top; + let x_15 : i32 = donor_replacementGLF_dead0top; + if (((x_14 >= 0) && (x_15 < 9))) { + let x_16 : i32 = donor_replacementGLF_dead0top; + let x_17 : i32 = (x_16 + 1); + donor_replacementGLF_dead0top = x_17; + x_54 = x_17; + } else { + x_54 = 0; + } + let x_18 : i32 = x_54; + donor_replacementGLF_dead0stack[x_18] = 1; + } + matrix_b = vec4(0.0, 0.0, 0.0, 0.0); + b = 3; + loop { + let x_19 : i32 = b; + if ((x_19 >= 0)) { + } else { + break; + } + let x_20 : i32 = b; + let x_21 : i32 = b; + let x_87 : f32 = matrix_b[x_21]; + matrix_b[x_20] = (x_87 - 1.0); + + continuing { + let x_22 : i32 = b; + b = (x_22 - 1); + } + } + + continuing { + let x_24 : i32 = k; + k = (x_24 + 1); + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl new file mode 100644 index 0000000000..26a8a10cfe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl @@ -0,0 +1,85 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var k : i32; + var GLF_dead0j : i32; + var donor_replacementGLF_dead0stack : array; + var donor_replacementGLF_dead0top : i32; + var x_54 : i32; + var matrix_b : vec4; + var b : i32; + k = 0; + loop { + let x_12 : i32 = k; + if ((x_12 < 4)) { + } else { + break; + } + let x_62 : f32 = x_6.injectionSwitch.y; + if ((0.0 > x_62)) { + GLF_dead0j = 1; + loop { + let x_13 : i32 = donor_replacementGLF_dead0stack[0]; + if ((1 <= x_13)) { + } else { + break; + } + } + let x_14 : i32 = donor_replacementGLF_dead0top; + let x_15 : i32 = donor_replacementGLF_dead0top; + if (((x_14 >= 0) && (x_15 < 9))) { + let x_16 : i32 = donor_replacementGLF_dead0top; + let x_17 : i32 = (x_16 + 1); + donor_replacementGLF_dead0top = x_17; + x_54 = x_17; + } else { + x_54 = 0; + } + let x_18 : i32 = x_54; + donor_replacementGLF_dead0stack[x_18] = 1; + } + matrix_b = vec4(0.0, 0.0, 0.0, 0.0); + b = 3; + loop { + let x_19 : i32 = b; + if ((x_19 >= 0)) { + } else { + break; + } + let x_20 : i32 = b; + let x_21 : i32 = b; + let x_87 : f32 = matrix_b[x_21]; + matrix_b[x_20] = (x_87 - 1.0); + + continuing { + let x_22 : i32 = b; + b = (x_22 - 1); + } + } + + continuing { + let x_24 : i32 = k; + k = (x_24 + 1); + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f1268b0bd8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,71 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int k = 0; + int GLF_dead0j = 0; + int donor_replacementGLF_dead0stack[10] = (int[10])0; + int donor_replacementGLF_dead0top = 0; + int x_54 = 0; + float4 matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f); + int b = 0; + k = 0; + { + for(; (k < 4); k = (k + 1)) { + const float x_62 = asfloat(x_6[0].y); + if ((0.0f > x_62)) { + GLF_dead0j = 1; + while (true) { + const int x_13 = donor_replacementGLF_dead0stack[0]; + if ((1 <= x_13)) { + } else { + break; + } + } + bool tint_tmp = (donor_replacementGLF_dead0top >= 0); + if (tint_tmp) { + tint_tmp = (donor_replacementGLF_dead0top < 9); + } + if ((tint_tmp)) { + const int x_17 = (donor_replacementGLF_dead0top + 1); + donor_replacementGLF_dead0top = x_17; + x_54 = x_17; + } else { + x_54 = 0; + } + donor_replacementGLF_dead0stack[x_54] = 1; + } + matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f); + b = 3; + { + for(; (b >= 0); b = (b - 1)) { + const int x_20 = b; + const float x_87 = matrix_b[b]; + set_float4(matrix_b, x_20, (x_87 - 1.0f)); + } + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..837b916059 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,88 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int k = 0; + int GLF_dead0j = 0; + tint_array_wrapper donor_replacementGLF_dead0stack = {}; + int donor_replacementGLF_dead0top = 0; + int x_54 = 0; + float4 matrix_b = 0.0f; + int b = 0; + k = 0; + while (true) { + int const x_12 = k; + if ((x_12 < 4)) { + } else { + break; + } + float const x_62 = x_6.injectionSwitch.y; + if ((0.0f > x_62)) { + GLF_dead0j = 1; + while (true) { + int const x_13 = donor_replacementGLF_dead0stack.arr[0]; + if ((1 <= x_13)) { + } else { + break; + } + } + int const x_14 = donor_replacementGLF_dead0top; + int const x_15 = donor_replacementGLF_dead0top; + if (((x_14 >= 0) && (x_15 < 9))) { + int const x_16 = donor_replacementGLF_dead0top; + int const x_17 = (x_16 + 1); + donor_replacementGLF_dead0top = x_17; + x_54 = x_17; + } else { + x_54 = 0; + } + int const x_18 = x_54; + donor_replacementGLF_dead0stack.arr[x_18] = 1; + } + matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f); + b = 3; + while (true) { + int const x_19 = b; + if ((x_19 >= 0)) { + } else { + break; + } + int const x_20 = b; + int const x_21 = b; + float const x_87 = matrix_b[x_21]; + matrix_b[x_20] = (x_87 - 1.0f); + { + int const x_22 = b; + b = (x_22 - 1); + } + } + { + int const x_24 = k; + k = (x_24 + 1); + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..de2d980fb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,205 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 115 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %k "k" + OpName %GLF_dead0j "GLF_dead0j" + OpName %donor_replacementGLF_dead0stack "donor_replacementGLF_dead0stack" + OpName %donor_replacementGLF_dead0top "donor_replacementGLF_dead0top" + OpName %x_54 "x_54" + OpName %matrix_b "matrix_b" + OpName %b "b" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %26 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 + %79 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_3 = OpConstant %int 3 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %102 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %103 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %k = OpVariable %_ptr_Function_int Function %19 + %GLF_dead0j = OpVariable %_ptr_Function_int Function %19 +%donor_replacementGLF_dead0stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %26 +%donor_replacementGLF_dead0top = OpVariable %_ptr_Function_int Function %19 + %x_54 = OpVariable %_ptr_Function_int Function %19 + %matrix_b = OpVariable %_ptr_Function_v4float Function %9 + %b = OpVariable %_ptr_Function_int Function %19 + OpStore %k %int_0 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %k + %39 = OpSLessThan %bool %37 %int_4 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %34 + %41 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %48 = OpLoad %float %47 + %50 = OpFOrdGreaterThan %bool %float_0 %48 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + OpStore %GLF_dead0j %int_1 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead0stack %int_0 + %59 = OpLoad %int %58 + %60 = OpSLessThanEqual %bool %int_1 %59 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %55 + %61 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %54 + %55 = OpLabel + %64 = OpLoad %int %donor_replacementGLF_dead0top + %65 = OpLoad %int %donor_replacementGLF_dead0top + %66 = OpSGreaterThanEqual %bool %64 %int_0 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %67 + %68 = OpLabel + %70 = OpSLessThan %bool %65 %int_9 + OpBranch %67 + %67 = OpLabel + %71 = OpPhi %bool %66 %55 %70 %68 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %74 + %73 = OpLabel + %75 = OpLoad %int %donor_replacementGLF_dead0top + %76 = OpIAdd %int %75 %int_1 + OpStore %donor_replacementGLF_dead0top %76 + OpStore %x_54 %76 + OpBranch %72 + %74 = OpLabel + OpStore %x_54 %int_0 + OpBranch %72 + %72 = OpLabel + %77 = OpLoad %int %x_54 + %78 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead0stack %77 + OpStore %78 %int_1 + OpBranch %51 + %51 = OpLabel + OpStore %matrix_b %79 + OpStore %b %int_3 + OpBranch %81 + %81 = OpLabel + OpLoopMerge %82 %83 None + OpBranch %84 + %84 = OpLabel + %85 = OpLoad %int %b + %86 = OpSGreaterThanEqual %bool %85 %int_0 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %89 + %88 = OpLabel + OpBranch %87 + %89 = OpLabel + OpBranch %82 + %87 = OpLabel + %90 = OpLoad %int %b + %91 = OpLoad %int %b + %93 = OpAccessChain %_ptr_Function_float %matrix_b %91 + %94 = OpLoad %float %93 + %95 = OpAccessChain %_ptr_Function_float %matrix_b %90 + %97 = OpFSub %float %94 %float_1 + OpStore %95 %97 + OpBranch %83 + %83 = OpLabel + %98 = OpLoad %int %b + %99 = OpISub %int %98 %int_1 + OpStore %b %99 + OpBranch %81 + %82 = OpLabel + OpBranch %35 + %35 = OpLabel + %100 = OpLoad %int %k + %101 = OpIAdd %int %100 %int_1 + OpStore %k %101 + OpBranch %33 + %34 = OpLabel + OpStore %x_GLF_color %102 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %103 +%tint_symbol = OpFunctionParameter %main_out + %107 = OpLabel + %108 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %108 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %110 = OpLabel + %111 = OpFunctionCall %void %main_1 + %113 = OpLoad %v4float %x_GLF_color + %114 = OpCompositeConstruct %main_out %113 + %112 = OpFunctionCall %void %tint_symbol_2 %114 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..26a8a10cfe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-dead-if-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,85 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var k : i32; + var GLF_dead0j : i32; + var donor_replacementGLF_dead0stack : array; + var donor_replacementGLF_dead0top : i32; + var x_54 : i32; + var matrix_b : vec4; + var b : i32; + k = 0; + loop { + let x_12 : i32 = k; + if ((x_12 < 4)) { + } else { + break; + } + let x_62 : f32 = x_6.injectionSwitch.y; + if ((0.0 > x_62)) { + GLF_dead0j = 1; + loop { + let x_13 : i32 = donor_replacementGLF_dead0stack[0]; + if ((1 <= x_13)) { + } else { + break; + } + } + let x_14 : i32 = donor_replacementGLF_dead0top; + let x_15 : i32 = donor_replacementGLF_dead0top; + if (((x_14 >= 0) && (x_15 < 9))) { + let x_16 : i32 = donor_replacementGLF_dead0top; + let x_17 : i32 = (x_16 + 1); + donor_replacementGLF_dead0top = x_17; + x_54 = x_17; + } else { + x_54 = 0; + } + let x_18 : i32 = x_54; + donor_replacementGLF_dead0stack[x_18] = 1; + } + matrix_b = vec4(0.0, 0.0, 0.0, 0.0); + b = 3; + loop { + let x_19 : i32 = b; + if ((x_19 >= 0)) { + } else { + break; + } + let x_20 : i32 = b; + let x_21 : i32 = b; + let x_87 : f32 = matrix_b[x_21]; + matrix_b[x_20] = (x_87 - 1.0); + + continuing { + let x_22 : i32 = b; + b = (x_22 - 1); + } + } + + continuing { + let x_24 : i32 = k; + k = (x_24 + 1); + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm new file mode 100644 index 0000000000..90e4996b19 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm @@ -0,0 +1,101 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %j "j" + OpName %_GLF_color "_GLF_color" + OpName %a "a" + OpDecorate %j RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Function_float = OpTypePointer Function %float + %main = OpFunction %void None %14 + %34 = OpLabel + %j = OpVariable %_ptr_Function_int Function + %a = OpVariable %_ptr_Function_float Function + OpStore %j %int_0 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %6 = OpLoad %int %j + %39 = OpSLessThan %bool %6 %int_2 + OpBranchConditional %39 %40 %36 + %40 = OpLabel + %7 = OpLoad %int %j + %41 = OpSLessThan %bool %7 %int_1 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpStore %_GLF_color %26 + OpBranch %42 + %42 = OpLabel + %8 = OpLoad %int %j + %44 = OpINotEqual %bool %8 %int_3 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + %9 = OpLoad %int %j + %47 = OpINotEqual %bool %9 %int_4 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + %10 = OpLoad %int %j + %50 = OpIEqual %bool %10 %int_5 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + %54 = OpExtInst %float %1 Ldexp %float_1 %int_2 + %55 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_0 + OpStore %55 %54 + OpBranch %51 + %53 = OpLabel + %56 = OpExtInst %float %1 Ldexp %float_1 %int_2 + OpStore %a %56 + OpStore %_GLF_color %26 + OpBranch %51 + %51 = OpLabel + OpBranch %48 + %48 = OpLabel + OpBranch %45 + %45 = OpLabel + OpBranch %37 + %37 = OpLabel + %11 = OpLoad %int %j + %12 = OpIAdd %int %11 %int_1 + OpStore %j %12 + OpBranch %35 + %36 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9862ea70e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.hlsl @@ -0,0 +1,39 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int j = 0; + float a = 0.0f; + j = 0; + { + for(; (j < 2); j = (j + 1)) { + if ((j < 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + if ((j != 3)) { + if ((j != 4)) { + if ((j == 5)) { + x_GLF_color.x = ldexp(1.0f, 2); + } else { + a = ldexp(1.0f, 2); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..447bbeb4a5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.msl @@ -0,0 +1,53 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int j = 0; + float a = 0.0f; + j = 0; + while (true) { + int const x_6 = j; + if ((x_6 < 2)) { + } else { + break; + } + int const x_7 = j; + if ((x_7 < 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + int const x_8 = j; + if ((x_8 != 3)) { + int const x_9 = j; + if ((x_9 != 4)) { + int const x_10 = j; + if ((x_10 == 5)) { + (*(tint_symbol_4)).x = ldexp(1.0f, 2); + } else { + a = ldexp(1.0f, 2); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } + } + { + int const x_11 = j; + j = (x_11 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2978632b71 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.spvasm @@ -0,0 +1,131 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 76 +; Schema: 0 + OpCapability Shader + %60 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %j "j" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpConstantNull %float + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %64 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %j = OpVariable %_ptr_Function_int Function %15 + %a = OpVariable %_ptr_Function_float Function %18 + OpStore %j %int_0 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %int %j + %26 = OpSLessThan %bool %24 %int_2 + OpSelectionMerge %28 None + OpBranchConditional %26 %29 %30 + %29 = OpLabel + OpBranch %28 + %30 = OpLabel + OpBranch %21 + %28 = OpLabel + %31 = OpLoad %int %j + %33 = OpSLessThan %bool %31 %int_1 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + OpStore %x_GLF_color %38 + OpBranch %34 + %34 = OpLabel + %39 = OpLoad %int %j + %41 = OpINotEqual %bool %39 %int_3 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + %44 = OpLoad %int %j + %46 = OpINotEqual %bool %44 %int_4 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + %49 = OpLoad %int %j + %51 = OpIEqual %bool %49 %int_5 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + %58 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %59 = OpExtInst %float %60 Ldexp %float_1 %int_2 + OpStore %58 %59 + OpBranch %52 + %54 = OpLabel + %61 = OpExtInst %float %60 Ldexp %float_1 %int_2 + OpStore %a %61 + OpStore %x_GLF_color %38 + OpBranch %52 + %52 = OpLabel + OpBranch %47 + %47 = OpLabel + OpBranch %42 + %42 = OpLabel + OpBranch %22 + %22 = OpLabel + %62 = OpLoad %int %j + %63 = OpIAdd %int %62 %int_1 + OpStore %j %63 + OpBranch %20 + %21 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %64 +%tint_symbol = OpFunctionParameter %main_out + %68 = OpLabel + %69 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %69 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %71 = OpLabel + %72 = OpFunctionCall %void %main_1 + %74 = OpLoad %v4float %x_GLF_color + %75 = OpCompositeConstruct %main_out %74 + %73 = OpFunctionCall %void %tint_symbol_2 %75 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b8234b51c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.spvasm.expected.wgsl @@ -0,0 +1,48 @@ +var x_GLF_color : vec4; + +fn main_1() { + var j : i32; + var a : f32; + j = 0; + loop { + let x_6 : i32 = j; + if ((x_6 < 2)) { + } else { + break; + } + let x_7 : i32 = j; + if ((x_7 < 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + let x_8 : i32 = j; + if ((x_8 != 3)) { + let x_9 : i32 = j; + if ((x_9 != 4)) { + let x_10 : i32 = j; + if ((x_10 == 5)) { + x_GLF_color.x = ldexp(1.0, 2); + } else { + a = ldexp(1.0, 2); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + } + } + + continuing { + let x_11 : i32 = j; + j = (x_11 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl new file mode 100644 index 0000000000..b8234b51c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl @@ -0,0 +1,48 @@ +var x_GLF_color : vec4; + +fn main_1() { + var j : i32; + var a : f32; + j = 0; + loop { + let x_6 : i32 = j; + if ((x_6 < 2)) { + } else { + break; + } + let x_7 : i32 = j; + if ((x_7 < 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + let x_8 : i32 = j; + if ((x_8 != 3)) { + let x_9 : i32 = j; + if ((x_9 != 4)) { + let x_10 : i32 = j; + if ((x_10 == 5)) { + x_GLF_color.x = ldexp(1.0, 2); + } else { + a = ldexp(1.0, 2); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + } + } + + continuing { + let x_11 : i32 = j; + j = (x_11 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9862ea70e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.hlsl @@ -0,0 +1,39 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int j = 0; + float a = 0.0f; + j = 0; + { + for(; (j < 2); j = (j + 1)) { + if ((j < 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + if ((j != 3)) { + if ((j != 4)) { + if ((j == 5)) { + x_GLF_color.x = ldexp(1.0f, 2); + } else { + a = ldexp(1.0f, 2); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..447bbeb4a5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.msl @@ -0,0 +1,53 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int j = 0; + float a = 0.0f; + j = 0; + while (true) { + int const x_6 = j; + if ((x_6 < 2)) { + } else { + break; + } + int const x_7 = j; + if ((x_7 < 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + int const x_8 = j; + if ((x_8 != 3)) { + int const x_9 = j; + if ((x_9 != 4)) { + int const x_10 = j; + if ((x_10 == 5)) { + (*(tint_symbol_4)).x = ldexp(1.0f, 2); + } else { + a = ldexp(1.0f, 2); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } + } + { + int const x_11 = j; + j = (x_11 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2978632b71 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.spvasm @@ -0,0 +1,131 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 76 +; Schema: 0 + OpCapability Shader + %60 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %j "j" + OpName %a "a" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpConstantNull %float + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %main_out = OpTypeStruct %v4float + %64 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %j = OpVariable %_ptr_Function_int Function %15 + %a = OpVariable %_ptr_Function_float Function %18 + OpStore %j %int_0 + OpBranch %20 + %20 = OpLabel + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %24 = OpLoad %int %j + %26 = OpSLessThan %bool %24 %int_2 + OpSelectionMerge %28 None + OpBranchConditional %26 %29 %30 + %29 = OpLabel + OpBranch %28 + %30 = OpLabel + OpBranch %21 + %28 = OpLabel + %31 = OpLoad %int %j + %33 = OpSLessThan %bool %31 %int_1 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + OpStore %x_GLF_color %38 + OpBranch %34 + %34 = OpLabel + %39 = OpLoad %int %j + %41 = OpINotEqual %bool %39 %int_3 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + %44 = OpLoad %int %j + %46 = OpINotEqual %bool %44 %int_4 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %47 + %48 = OpLabel + %49 = OpLoad %int %j + %51 = OpIEqual %bool %49 %int_5 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + %58 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %59 = OpExtInst %float %60 Ldexp %float_1 %int_2 + OpStore %58 %59 + OpBranch %52 + %54 = OpLabel + %61 = OpExtInst %float %60 Ldexp %float_1 %int_2 + OpStore %a %61 + OpStore %x_GLF_color %38 + OpBranch %52 + %52 = OpLabel + OpBranch %47 + %47 = OpLabel + OpBranch %42 + %42 = OpLabel + OpBranch %22 + %22 = OpLabel + %62 = OpLoad %int %j + %63 = OpIAdd %int %62 %int_1 + OpStore %j %63 + OpBranch %20 + %21 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %64 +%tint_symbol = OpFunctionParameter %main_out + %68 = OpLabel + %69 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %69 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %71 = OpLabel + %72 = OpFunctionCall %void %main_1 + %74 = OpLoad %v4float %x_GLF_color + %75 = OpCompositeConstruct %main_out %74 + %73 = OpFunctionCall %void %tint_symbol_2 %75 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b8234b51c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loop-nested-ifs/0-opt.wgsl.expected.wgsl @@ -0,0 +1,48 @@ +var x_GLF_color : vec4; + +fn main_1() { + var j : i32; + var a : f32; + j = 0; + loop { + let x_6 : i32 = j; + if ((x_6 < 2)) { + } else { + break; + } + let x_7 : i32 = j; + if ((x_7 < 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + let x_8 : i32 = j; + if ((x_8 != 3)) { + let x_9 : i32 = j; + if ((x_9 != 4)) { + let x_10 : i32 = j; + if ((x_10 == 5)) { + x_GLF_color.x = ldexp(1.0, 2); + } else { + a = ldexp(1.0, 2); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + } + } + + continuing { + let x_11 : i32 = j; + j = (x_11 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm new file mode 100644 index 0000000000..d37a387dc3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm @@ -0,0 +1,181 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %BinarySearchObject "BinarySearchObject" + OpMemberName %BinarySearchObject 0 "prime_numbers" + OpName %binarySearch_struct_BinarySearchObject_i1_10_1_ "binarySearch(struct-BinarySearchObject-i1[10]1;" + OpName %obj "obj" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %m "m" + OpName %i "i" + OpName %obj_0 "obj" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %BinarySearchObject 0 RelaxedPrecision + OpDecorate %binarySearch_struct_BinarySearchObject_i1_10_1_ RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %m RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %i RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %28 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%BinarySearchObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Function_BinarySearchObject = OpTypePointer Function %BinarySearchObject + %34 = OpTypeFunction %int %_ptr_Function_BinarySearchObject + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %float_0 = OpConstant %float 0 + %uint_1 = OpConstant %uint 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %55 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %28 + %56 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %obj_0 = OpVariable %_ptr_Function_BinarySearchObject Function + %param = OpVariable %_ptr_Function_BinarySearchObject Function + OpStore %i %int_0 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %16 = OpLoad %int %i + %61 = OpSLessThan %bool %16 %int_10 + OpBranchConditional %61 %62 %58 + %62 = OpLabel + %17 = OpLoad %int %i + %63 = OpINotEqual %bool %17 %int_3 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + %18 = OpLoad %int %i + %66 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %67 = OpLoad %float %66 + %19 = OpConvertFToS %int %67 + %20 = OpISub %int %18 %19 + %68 = OpIEqual %bool %20 %int_4 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + %21 = OpLoad %int %i + %72 = OpAccessChain %_ptr_Function_int %obj_0 %int_0 %21 + OpStore %72 %int_11 + OpBranch %69 + %71 = OpLabel + %22 = OpLoad %int %i + %73 = OpIEqual %bool %22 %int_6 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %74 + %75 = OpLabel + %23 = OpLoad %int %i + %76 = OpAccessChain %_ptr_Function_int %obj_0 %int_0 %23 + OpStore %76 %int_17 + OpBranch %74 + %74 = OpLabel + OpBranch %59 + %69 = OpLabel + OpBranch %64 + %64 = OpLabel + OpBranch %77 + %77 = OpLabel + OpLoopMerge %78 %79 None + OpBranch %80 + %80 = OpLabel + OpBranch %79 + %79 = OpLabel + %81 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %82 = OpLoad %float %81 + %83 = OpFOrdGreaterThan %bool %float_0 %82 + OpBranchConditional %83 %77 %78 + %78 = OpLabel + OpBranch %59 + %59 = OpLabel + %24 = OpLoad %int %i + %25 = OpIAdd %int %24 %int_1 + OpStore %i %25 + OpBranch %57 + %58 = OpLabel + %84 = OpLoad %BinarySearchObject %obj_0 + OpStore %param %84 + %26 = OpFunctionCall %int %binarySearch_struct_BinarySearchObject_i1_10_1_ %param + OpStore %_GLF_color %55 + OpReturn + OpFunctionEnd +%binarySearch_struct_BinarySearchObject_i1_10_1_ = OpFunction %int None %34 + %obj = OpFunctionParameter %_ptr_Function_BinarySearchObject + %85 = OpLabel + %m = OpVariable %_ptr_Function_int Function + OpBranch %86 + %86 = OpLabel + OpLoopMerge %87 %88 None + OpBranch %89 + %89 = OpLabel + %90 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %91 = OpLoad %float %90 + %92 = OpFOrdGreaterThan %bool %91 %float_1 + OpBranchConditional %92 %93 %87 + %93 = OpLabel + %94 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %95 = OpLoad %float %94 + %13 = OpConvertFToS %int %95 + OpStore %m %13 + %14 = OpLoad %int %m + %96 = OpAccessChain %_ptr_Function_int %obj %int_0 %14 + %15 = OpLoad %int %96 + %97 = OpIEqual %bool %15 %int_1 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + OpReturnValue %int_1 + %98 = OpLabel + OpBranch %88 + %88 = OpLabel + OpBranch %86 + %87 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..4ca646f789 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.hlsl @@ -0,0 +1,76 @@ +struct BinarySearchObject { + int prime_numbers[10]; +}; + +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int binarySearch_struct_BinarySearchObject_i1_10_1_(inout BinarySearchObject obj) { + int m = 0; + while (true) { + const float x_91 = asfloat(x_8[0].x); + if ((x_91 > 1.0f)) { + } else { + break; + } + const float x_95 = asfloat(x_8[0].x); + m = int(x_95); + const int x_15 = obj.prime_numbers[m]; + if ((x_15 == 1)) { + return 1; + } + } + return 1; +} + +void main_1() { + int i = 0; + BinarySearchObject obj_1 = (BinarySearchObject)0; + BinarySearchObject param = (BinarySearchObject)0; + i = 0; + { + for(; (i < 10); i = (i + 1)) { + if ((i != 3)) { + const int x_18 = i; + const float x_67 = asfloat(x_8[0].x); + if (((x_18 - int(x_67)) == 4)) { + obj_1.prime_numbers[i] = 11; + } else { + if ((i == 6)) { + obj_1.prime_numbers[i] = 17; + } + continue; + } + } + while (true) { + { + const float x_82 = asfloat(x_8[0].y); + if ((0.0f > x_82)) { + } else { + break; + } + } + } + } + } + param = obj_1; + const int x_26 = binarySearch_struct_BinarySearchObject_i1_10_1_(param); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.msl new file mode 100644 index 0000000000..dee463b663 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.msl @@ -0,0 +1,98 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct BinarySearchObject { + tint_array_wrapper prime_numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int binarySearch_struct_BinarySearchObject_i1_10_1_(constant buf0& x_8, thread BinarySearchObject* const obj) { + int m = 0; + while (true) { + float const x_91 = x_8.injectionSwitch.x; + if ((x_91 > 1.0f)) { + } else { + break; + } + float const x_95 = x_8.injectionSwitch.x; + m = int(x_95); + int const x_14 = m; + int const x_15 = (*(obj)).prime_numbers.arr[x_14]; + if ((x_15 == 1)) { + return 1; + } + } + return 1; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + int i = 0; + BinarySearchObject obj_1 = {}; + BinarySearchObject param = {}; + i = 0; + while (true) { + int const x_16 = i; + if ((x_16 < 10)) { + } else { + break; + } + int const x_17 = i; + if ((x_17 != 3)) { + int const x_18 = i; + float const x_67 = x_8.injectionSwitch.x; + if (((x_18 - int(x_67)) == 4)) { + int const x_21 = i; + obj_1.prime_numbers.arr[x_21] = 11; + } else { + int const x_22 = i; + if ((x_22 == 6)) { + int const x_23 = i; + obj_1.prime_numbers.arr[x_23] = 17; + } + { + int const x_24 = i; + i = (x_24 + 1); + } + continue; + } + } + while (true) { + { + float const x_82 = x_8.injectionSwitch.y; + if ((0.0f > x_82)) { + } else { + break; + } + } + } + { + int const x_24 = i; + i = (x_24 + 1); + } + } + BinarySearchObject const x_84 = obj_1; + param = x_84; + int const x_26 = binarySearch_struct_BinarySearchObject_i1_10_1_(x_8, &(param)); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..763929ef2f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.spvasm @@ -0,0 +1,220 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 125 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %BinarySearchObject "BinarySearchObject" + OpMemberName %BinarySearchObject 0 "prime_numbers" + OpName %binarySearch_struct_BinarySearchObject_i1_10_1_ "binarySearch_struct_BinarySearchObject_i1_10_1_" + OpName %obj "obj" + OpName %m "m" + OpName %main_1 "main_1" + OpName %i "i" + OpName %obj_1 "obj_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %BinarySearchObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%BinarySearchObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Function_BinarySearchObject = OpTypePointer Function %BinarySearchObject + %12 = OpTypeFunction %int %_ptr_Function_BinarySearchObject +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %50 = OpTypeFunction %void + %56 = OpConstantNull %BinarySearchObject + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %112 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %113 = OpTypeFunction %void %main_out +%binarySearch_struct_BinarySearchObject_i1_10_1_ = OpFunction %int None %12 + %obj = OpFunctionParameter %_ptr_Function_BinarySearchObject + %21 = OpLabel + %m = OpVariable %_ptr_Function_int Function %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %31 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %32 = OpLoad %float %31 + %34 = OpFOrdGreaterThan %bool %32 %float_1 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %38 + %37 = OpLabel + OpBranch %36 + %38 = OpLabel + OpBranch %26 + %36 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %40 = OpLoad %float %39 + %41 = OpConvertFToS %int %40 + OpStore %m %41 + %42 = OpLoad %int %m + %44 = OpAccessChain %_ptr_Function_int %obj %uint_0 %42 + %45 = OpLoad %int %44 + %47 = OpIEqual %bool %45 %int_1 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + OpReturnValue %int_1 + %48 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %25 + %26 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %50 + %53 = OpLabel + %i = OpVariable %_ptr_Function_int Function %24 + %obj_1 = OpVariable %_ptr_Function_BinarySearchObject Function %56 + %param = OpVariable %_ptr_Function_BinarySearchObject Function %56 + OpStore %i %int_0 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %int %i + %65 = OpSLessThan %bool %63 %int_10 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %67 = OpLabel + OpBranch %66 + %68 = OpLabel + OpBranch %60 + %66 = OpLabel + %69 = OpLoad %int %i + %71 = OpINotEqual %bool %69 %int_3 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %76 = OpLoad %float %75 + %77 = OpConvertFToS %int %76 + %78 = OpISub %int %74 %77 + %80 = OpIEqual %bool %78 %int_4 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %84 = OpLoad %int %i + %85 = OpAccessChain %_ptr_Function_int %obj_1 %uint_0 %84 + OpStore %85 %int_11 + OpBranch %81 + %83 = OpLabel + %87 = OpLoad %int %i + %89 = OpIEqual %bool %87 %int_6 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpAccessChain %_ptr_Function_int %obj_1 %uint_0 %92 + OpStore %93 %int_17 + OpBranch %90 + %90 = OpLabel + OpBranch %61 + %81 = OpLabel + OpBranch %72 + %72 = OpLabel + OpBranch %95 + %95 = OpLabel + OpLoopMerge %96 %97 None + OpBranch %98 + %98 = OpLabel + OpBranch %97 + %97 = OpLabel + %100 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %101 = OpLoad %float %100 + %103 = OpFOrdGreaterThan %bool %float_0 %101 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %106 + %105 = OpLabel + OpBranch %104 + %106 = OpLabel + OpBranch %96 + %104 = OpLabel + OpBranch %95 + %96 = OpLabel + OpBranch %61 + %61 = OpLabel + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + OpBranch %59 + %60 = OpLabel + %109 = OpLoad %BinarySearchObject %obj_1 + OpStore %param %109 + %110 = OpFunctionCall %int %binarySearch_struct_BinarySearchObject_i1_10_1_ %param + OpStore %x_GLF_color %112 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %113 +%tint_symbol = OpFunctionParameter %main_out + %117 = OpLabel + %118 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %118 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %50 + %120 = OpLabel + %121 = OpFunctionCall %void %main_1 + %123 = OpLoad %v4float %x_GLF_color + %124 = OpCompositeConstruct %main_out %123 + %122 = OpFunctionCall %void %tint_symbol_2 %124 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 97[%97] is not post dominated by the back-edge block 104[%104] + %104 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..9d9f80c678 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.wgsl @@ -0,0 +1,92 @@ +struct BinarySearchObject { + prime_numbers : array; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn binarySearch_struct_BinarySearchObject_i1_10_1_(obj : ptr) -> i32 { + var m : i32; + loop { + let x_91 : f32 = x_8.injectionSwitch.x; + if ((x_91 > 1.0)) { + } else { + break; + } + let x_95 : f32 = x_8.injectionSwitch.x; + m = i32(x_95); + let x_14 : i32 = m; + let x_15 : i32 = (*(obj)).prime_numbers[x_14]; + if ((x_15 == 1)) { + return 1; + } + } + return 1; +} + +fn main_1() { + var i : i32; + var obj_1 : BinarySearchObject; + var param : BinarySearchObject; + i = 0; + loop { + let x_16 : i32 = i; + if ((x_16 < 10)) { + } else { + break; + } + let x_17 : i32 = i; + if ((x_17 != 3)) { + let x_18 : i32 = i; + let x_67 : f32 = x_8.injectionSwitch.x; + if (((x_18 - i32(x_67)) == 4)) { + let x_21 : i32 = i; + obj_1.prime_numbers[x_21] = 11; + } else { + let x_22 : i32 = i; + if ((x_22 == 6)) { + let x_23 : i32 = i; + obj_1.prime_numbers[x_23] = 17; + } + continue; + } + } + loop { + + continuing { + let x_82 : f32 = x_8.injectionSwitch.y; + if ((0.0 > x_82)) { + } else { + break; + } + } + } + + continuing { + let x_24 : i32 = i; + i = (x_24 + 1); + } + } + let x_84 : BinarySearchObject = obj_1; + param = x_84; + let x_26 : i32 = binarySearch_struct_BinarySearchObject_i1_10_1_(&(param)); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl new file mode 100644 index 0000000000..9d9f80c678 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl @@ -0,0 +1,92 @@ +struct BinarySearchObject { + prime_numbers : array; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn binarySearch_struct_BinarySearchObject_i1_10_1_(obj : ptr) -> i32 { + var m : i32; + loop { + let x_91 : f32 = x_8.injectionSwitch.x; + if ((x_91 > 1.0)) { + } else { + break; + } + let x_95 : f32 = x_8.injectionSwitch.x; + m = i32(x_95); + let x_14 : i32 = m; + let x_15 : i32 = (*(obj)).prime_numbers[x_14]; + if ((x_15 == 1)) { + return 1; + } + } + return 1; +} + +fn main_1() { + var i : i32; + var obj_1 : BinarySearchObject; + var param : BinarySearchObject; + i = 0; + loop { + let x_16 : i32 = i; + if ((x_16 < 10)) { + } else { + break; + } + let x_17 : i32 = i; + if ((x_17 != 3)) { + let x_18 : i32 = i; + let x_67 : f32 = x_8.injectionSwitch.x; + if (((x_18 - i32(x_67)) == 4)) { + let x_21 : i32 = i; + obj_1.prime_numbers[x_21] = 11; + } else { + let x_22 : i32 = i; + if ((x_22 == 6)) { + let x_23 : i32 = i; + obj_1.prime_numbers[x_23] = 17; + } + continue; + } + } + loop { + + continuing { + let x_82 : f32 = x_8.injectionSwitch.y; + if ((0.0 > x_82)) { + } else { + break; + } + } + } + + continuing { + let x_24 : i32 = i; + i = (x_24 + 1); + } + } + let x_84 : BinarySearchObject = obj_1; + param = x_84; + let x_26 : i32 = binarySearch_struct_BinarySearchObject_i1_10_1_(&(param)); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..4ca646f789 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.hlsl @@ -0,0 +1,76 @@ +struct BinarySearchObject { + int prime_numbers[10]; +}; + +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int binarySearch_struct_BinarySearchObject_i1_10_1_(inout BinarySearchObject obj) { + int m = 0; + while (true) { + const float x_91 = asfloat(x_8[0].x); + if ((x_91 > 1.0f)) { + } else { + break; + } + const float x_95 = asfloat(x_8[0].x); + m = int(x_95); + const int x_15 = obj.prime_numbers[m]; + if ((x_15 == 1)) { + return 1; + } + } + return 1; +} + +void main_1() { + int i = 0; + BinarySearchObject obj_1 = (BinarySearchObject)0; + BinarySearchObject param = (BinarySearchObject)0; + i = 0; + { + for(; (i < 10); i = (i + 1)) { + if ((i != 3)) { + const int x_18 = i; + const float x_67 = asfloat(x_8[0].x); + if (((x_18 - int(x_67)) == 4)) { + obj_1.prime_numbers[i] = 11; + } else { + if ((i == 6)) { + obj_1.prime_numbers[i] = 17; + } + continue; + } + } + while (true) { + { + const float x_82 = asfloat(x_8[0].y); + if ((0.0f > x_82)) { + } else { + break; + } + } + } + } + } + param = obj_1; + const int x_26 = binarySearch_struct_BinarySearchObject_i1_10_1_(param); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.msl new file mode 100644 index 0000000000..dee463b663 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.msl @@ -0,0 +1,98 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct BinarySearchObject { + tint_array_wrapper prime_numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int binarySearch_struct_BinarySearchObject_i1_10_1_(constant buf0& x_8, thread BinarySearchObject* const obj) { + int m = 0; + while (true) { + float const x_91 = x_8.injectionSwitch.x; + if ((x_91 > 1.0f)) { + } else { + break; + } + float const x_95 = x_8.injectionSwitch.x; + m = int(x_95); + int const x_14 = m; + int const x_15 = (*(obj)).prime_numbers.arr[x_14]; + if ((x_15 == 1)) { + return 1; + } + } + return 1; +} + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + int i = 0; + BinarySearchObject obj_1 = {}; + BinarySearchObject param = {}; + i = 0; + while (true) { + int const x_16 = i; + if ((x_16 < 10)) { + } else { + break; + } + int const x_17 = i; + if ((x_17 != 3)) { + int const x_18 = i; + float const x_67 = x_8.injectionSwitch.x; + if (((x_18 - int(x_67)) == 4)) { + int const x_21 = i; + obj_1.prime_numbers.arr[x_21] = 11; + } else { + int const x_22 = i; + if ((x_22 == 6)) { + int const x_23 = i; + obj_1.prime_numbers.arr[x_23] = 17; + } + { + int const x_24 = i; + i = (x_24 + 1); + } + continue; + } + } + while (true) { + { + float const x_82 = x_8.injectionSwitch.y; + if ((0.0f > x_82)) { + } else { + break; + } + } + } + { + int const x_24 = i; + i = (x_24 + 1); + } + } + BinarySearchObject const x_84 = obj_1; + param = x_84; + int const x_26 = binarySearch_struct_BinarySearchObject_i1_10_1_(x_8, &(param)); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..763929ef2f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.spvasm @@ -0,0 +1,220 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 125 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %BinarySearchObject "BinarySearchObject" + OpMemberName %BinarySearchObject 0 "prime_numbers" + OpName %binarySearch_struct_BinarySearchObject_i1_10_1_ "binarySearch_struct_BinarySearchObject_i1_10_1_" + OpName %obj "obj" + OpName %m "m" + OpName %main_1 "main_1" + OpName %i "i" + OpName %obj_1 "obj_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %BinarySearchObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%BinarySearchObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Function_BinarySearchObject = OpTypePointer Function %BinarySearchObject + %12 = OpTypeFunction %int %_ptr_Function_BinarySearchObject +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %50 = OpTypeFunction %void + %56 = OpConstantNull %BinarySearchObject + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %112 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %113 = OpTypeFunction %void %main_out +%binarySearch_struct_BinarySearchObject_i1_10_1_ = OpFunction %int None %12 + %obj = OpFunctionParameter %_ptr_Function_BinarySearchObject + %21 = OpLabel + %m = OpVariable %_ptr_Function_int Function %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %31 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %32 = OpLoad %float %31 + %34 = OpFOrdGreaterThan %bool %32 %float_1 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %38 + %37 = OpLabel + OpBranch %36 + %38 = OpLabel + OpBranch %26 + %36 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %40 = OpLoad %float %39 + %41 = OpConvertFToS %int %40 + OpStore %m %41 + %42 = OpLoad %int %m + %44 = OpAccessChain %_ptr_Function_int %obj %uint_0 %42 + %45 = OpLoad %int %44 + %47 = OpIEqual %bool %45 %int_1 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + OpReturnValue %int_1 + %48 = OpLabel + OpBranch %27 + %27 = OpLabel + OpBranch %25 + %26 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %50 + %53 = OpLabel + %i = OpVariable %_ptr_Function_int Function %24 + %obj_1 = OpVariable %_ptr_Function_BinarySearchObject Function %56 + %param = OpVariable %_ptr_Function_BinarySearchObject Function %56 + OpStore %i %int_0 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %int %i + %65 = OpSLessThan %bool %63 %int_10 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %67 = OpLabel + OpBranch %66 + %68 = OpLabel + OpBranch %60 + %66 = OpLabel + %69 = OpLoad %int %i + %71 = OpINotEqual %bool %69 %int_3 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + %74 = OpLoad %int %i + %75 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %76 = OpLoad %float %75 + %77 = OpConvertFToS %int %76 + %78 = OpISub %int %74 %77 + %80 = OpIEqual %bool %78 %int_4 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %84 = OpLoad %int %i + %85 = OpAccessChain %_ptr_Function_int %obj_1 %uint_0 %84 + OpStore %85 %int_11 + OpBranch %81 + %83 = OpLabel + %87 = OpLoad %int %i + %89 = OpIEqual %bool %87 %int_6 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpAccessChain %_ptr_Function_int %obj_1 %uint_0 %92 + OpStore %93 %int_17 + OpBranch %90 + %90 = OpLabel + OpBranch %61 + %81 = OpLabel + OpBranch %72 + %72 = OpLabel + OpBranch %95 + %95 = OpLabel + OpLoopMerge %96 %97 None + OpBranch %98 + %98 = OpLabel + OpBranch %97 + %97 = OpLabel + %100 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %101 = OpLoad %float %100 + %103 = OpFOrdGreaterThan %bool %float_0 %101 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %106 + %105 = OpLabel + OpBranch %104 + %106 = OpLabel + OpBranch %96 + %104 = OpLabel + OpBranch %95 + %96 = OpLabel + OpBranch %61 + %61 = OpLabel + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + OpBranch %59 + %60 = OpLabel + %109 = OpLoad %BinarySearchObject %obj_1 + OpStore %param %109 + %110 = OpFunctionCall %int %binarySearch_struct_BinarySearchObject_i1_10_1_ %param + OpStore %x_GLF_color %112 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %113 +%tint_symbol = OpFunctionParameter %main_out + %117 = OpLabel + %118 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %118 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %50 + %120 = OpLabel + %121 = OpFunctionCall %void %main_1 + %123 = OpLoad %v4float %x_GLF_color + %124 = OpCompositeConstruct %main_out %123 + %122 = OpFunctionCall %void %tint_symbol_2 %124 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 97[%97] is not post dominated by the back-edge block 104[%104] + %104 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..9d9f80c678 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.wgsl @@ -0,0 +1,92 @@ +struct BinarySearchObject { + prime_numbers : array; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn binarySearch_struct_BinarySearchObject_i1_10_1_(obj : ptr) -> i32 { + var m : i32; + loop { + let x_91 : f32 = x_8.injectionSwitch.x; + if ((x_91 > 1.0)) { + } else { + break; + } + let x_95 : f32 = x_8.injectionSwitch.x; + m = i32(x_95); + let x_14 : i32 = m; + let x_15 : i32 = (*(obj)).prime_numbers[x_14]; + if ((x_15 == 1)) { + return 1; + } + } + return 1; +} + +fn main_1() { + var i : i32; + var obj_1 : BinarySearchObject; + var param : BinarySearchObject; + i = 0; + loop { + let x_16 : i32 = i; + if ((x_16 < 10)) { + } else { + break; + } + let x_17 : i32 = i; + if ((x_17 != 3)) { + let x_18 : i32 = i; + let x_67 : f32 = x_8.injectionSwitch.x; + if (((x_18 - i32(x_67)) == 4)) { + let x_21 : i32 = i; + obj_1.prime_numbers[x_21] = 11; + } else { + let x_22 : i32 = i; + if ((x_22 == 6)) { + let x_23 : i32 = i; + obj_1.prime_numbers[x_23] = 17; + } + continue; + } + } + loop { + + continuing { + let x_82 : f32 = x_8.injectionSwitch.y; + if ((0.0 > x_82)) { + } else { + break; + } + } + } + + continuing { + let x_24 : i32 = i; + i = (x_24 + 1); + } + } + let x_84 : BinarySearchObject = obj_1; + param = x_84; + let x_26 : i32 = binarySearch_struct_BinarySearchObject_i1_10_1_(&(param)); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm new file mode 100644 index 0000000000..8fc1abcc0b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm @@ -0,0 +1,72 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f_mf22_ "f(mf22;" + OpName %m "m" + OpName %gl_FragCoord "gl_FragCoord" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %v3float = OpTypeVector %float 3 + %15 = OpTypeFunction %v3float %_ptr_Function_mat2v2float + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %20 = OpConstantComposite %v2float %float_0 %float_0 + %21 = OpConstantComposite %mat2v2float %20 %20 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %27 = OpConstantComposite %v2float %float_1 %float_0 + %28 = OpConstantComposite %v2float %float_0 %float_1 + %29 = OpConstantComposite %mat2v2float %27 %28 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %9 + %32 = OpLabel + %param = OpVariable %_ptr_Function_mat2v2float Function + %33 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %34 = OpLoad %float %33 + %35 = OpFOrdGreaterThanEqual %bool %34 %float_0 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %36 + %37 = OpLabel + OpBranch %36 + %36 = OpLabel + %38 = OpPhi %mat2v2float %21 %32 %29 %37 + %39 = OpMatrixTimesMatrix %mat2v2float %38 %38 + OpStore %param %39 + %40 = OpFunctionCall %v3float %f_mf22_ %param + OpStore %_GLF_color %31 + OpReturn + OpFunctionEnd + %f_mf22_ = OpFunction %v3float None %15 + %m = OpFunctionParameter %_ptr_Function_mat2v2float + %41 = OpLabel + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + OpReturnValue %17 + %44 = OpLabel + OpBranch %42 + %43 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..91e6f7c71d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.hlsl @@ -0,0 +1,43 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 f_mf22_(inout float2x2 m) { + while (true) { + return float3(1.0f, 1.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + float2x2 param = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 x_38_phi = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + const float x_34 = gl_FragCoord.x; + x_38_phi = float2x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + if ((x_34 >= 0.0f)) { + x_38_phi = float2x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f)); + } + const float2x2 x_38 = x_38_phi; + param = mul(x_38, x_38); + const float3 x_40 = f_mf22_(param); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.msl new file mode 100644 index 0000000000..6ff0d168e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 f_mf22_(thread float2x2* const m) { + while (true) { + return float3(1.0f, 1.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2x2 param = float2x2(0.0f); + float2x2 x_38_phi = float2x2(0.0f); + float const x_34 = (*(tint_symbol_5)).x; + x_38_phi = float2x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + if ((x_34 >= 0.0f)) { + x_38_phi = float2x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f)); + } + float2x2 const x_38 = x_38_phi; + param = (x_38 * x_38); + float3 const x_40 = f_mf22_(&(param)); + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..6623b07b88 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.spvasm @@ -0,0 +1,112 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %f_mf22_ "f_mf22_" + OpName %m "m" + OpName %main_1 "main_1" + OpName %param "param" + OpName %x_38_phi "x_38_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %11 = OpTypeFunction %v3float %_ptr_Function_mat2v2float + %float_1 = OpConstant %float 1 + %24 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %27 = OpTypeFunction %void + %32 = OpConstantNull %mat2v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %39 = OpConstantComposite %v2float %float_0 %float_0 + %40 = OpConstantComposite %mat2v2float %39 %39 + %bool = OpTypeBool + %45 = OpConstantComposite %v2float %float_1 %float_0 + %46 = OpConstantComposite %v2float %float_0 %float_1 + %47 = OpConstantComposite %mat2v2float %45 %46 + %52 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %f_mf22_ = OpFunction %v3float None %11 + %m = OpFunctionParameter %_ptr_Function_mat2v2float + %18 = OpLabel + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + OpReturnValue %24 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + OpReturnValue %26 + OpFunctionEnd + %main_1 = OpFunction %void None %27 + %30 = OpLabel + %param = OpVariable %_ptr_Function_mat2v2float Function %32 + %x_38_phi = OpVariable %_ptr_Function_mat2v2float Function %32 + %37 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + OpStore %x_38_phi %40 + %41 = OpFOrdGreaterThanEqual %bool %38 %float_0 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %43 + %44 = OpLabel + OpStore %x_38_phi %47 + OpBranch %43 + %43 = OpLabel + %48 = OpLoad %mat2v2float %x_38_phi + %49 = OpMatrixTimesMatrix %mat2v2float %48 %48 + OpStore %param %49 + %50 = OpFunctionCall %v3float %f_mf22_ %param + OpStore %x_GLF_color %52 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %53 +%tint_symbol_1 = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %60 = OpLabel + %61 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %61 + %62 = OpFunctionCall %void %main_1 + %64 = OpLoad %v4float %x_GLF_color + %65 = OpCompositeConstruct %main_out %64 + %63 = OpFunctionCall %void %tint_symbol_3 %65 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..ee6e11e179 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.spvasm.expected.wgsl @@ -0,0 +1,37 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn f_mf22_(m : ptr>) -> vec3 { + loop { + return vec3(1.0, 1.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + var param : mat2x2; + var x_38_phi : mat2x2; + let x_34 : f32 = gl_FragCoord.x; + x_38_phi = mat2x2(vec2(0.0, 0.0), vec2(0.0, 0.0)); + if ((x_34 >= 0.0)) { + x_38_phi = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); + } + let x_38 : mat2x2 = x_38_phi; + param = (x_38 * x_38); + let x_40 : vec3 = f_mf22_(&(param)); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl new file mode 100644 index 0000000000..ee6e11e179 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl @@ -0,0 +1,37 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn f_mf22_(m : ptr>) -> vec3 { + loop { + return vec3(1.0, 1.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + var param : mat2x2; + var x_38_phi : mat2x2; + let x_34 : f32 = gl_FragCoord.x; + x_38_phi = mat2x2(vec2(0.0, 0.0), vec2(0.0, 0.0)); + if ((x_34 >= 0.0)) { + x_38_phi = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); + } + let x_38 : mat2x2 = x_38_phi; + param = (x_38 * x_38); + let x_40 : vec3 = f_mf22_(&(param)); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..91e6f7c71d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.hlsl @@ -0,0 +1,43 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 f_mf22_(inout float2x2 m) { + while (true) { + return float3(1.0f, 1.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + float2x2 param = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + float2x2 x_38_phi = float2x2(0.0f, 0.0f, 0.0f, 0.0f); + const float x_34 = gl_FragCoord.x; + x_38_phi = float2x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + if ((x_34 >= 0.0f)) { + x_38_phi = float2x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f)); + } + const float2x2 x_38 = x_38_phi; + param = mul(x_38, x_38); + const float3 x_40 = f_mf22_(param); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.msl new file mode 100644 index 0000000000..6ff0d168e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.msl @@ -0,0 +1,42 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 f_mf22_(thread float2x2* const m) { + while (true) { + return float3(1.0f, 1.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2x2 param = float2x2(0.0f); + float2x2 x_38_phi = float2x2(0.0f); + float const x_34 = (*(tint_symbol_5)).x; + x_38_phi = float2x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); + if ((x_34 >= 0.0f)) { + x_38_phi = float2x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f)); + } + float2x2 const x_38 = x_38_phi; + param = (x_38 * x_38); + float3 const x_40 = f_mf22_(&(param)); + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..6623b07b88 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.spvasm @@ -0,0 +1,112 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 66 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %f_mf22_ "f_mf22_" + OpName %m "m" + OpName %main_1 "main_1" + OpName %param "param" + OpName %x_38_phi "x_38_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %11 = OpTypeFunction %v3float %_ptr_Function_mat2v2float + %float_1 = OpConstant %float 1 + %24 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %27 = OpTypeFunction %void + %32 = OpConstantNull %mat2v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %39 = OpConstantComposite %v2float %float_0 %float_0 + %40 = OpConstantComposite %mat2v2float %39 %39 + %bool = OpTypeBool + %45 = OpConstantComposite %v2float %float_1 %float_0 + %46 = OpConstantComposite %v2float %float_0 %float_1 + %47 = OpConstantComposite %mat2v2float %45 %46 + %52 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %f_mf22_ = OpFunction %v3float None %11 + %m = OpFunctionParameter %_ptr_Function_mat2v2float + %18 = OpLabel + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + OpReturnValue %24 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + OpReturnValue %26 + OpFunctionEnd + %main_1 = OpFunction %void None %27 + %30 = OpLabel + %param = OpVariable %_ptr_Function_mat2v2float Function %32 + %x_38_phi = OpVariable %_ptr_Function_mat2v2float Function %32 + %37 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + OpStore %x_38_phi %40 + %41 = OpFOrdGreaterThanEqual %bool %38 %float_0 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %43 + %44 = OpLabel + OpStore %x_38_phi %47 + OpBranch %43 + %43 = OpLabel + %48 = OpLoad %mat2v2float %x_38_phi + %49 = OpMatrixTimesMatrix %mat2v2float %48 %48 + OpStore %param %49 + %50 = OpFunctionCall %v3float %f_mf22_ %param + OpStore %x_GLF_color %52 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %53 +%tint_symbol_1 = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %60 = OpLabel + %61 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %61 + %62 = OpFunctionCall %void %main_1 + %64 = OpLoad %v4float %x_GLF_color + %65 = OpCompositeConstruct %main_out %64 + %63 = OpFunctionCall %void %tint_symbol_3 %65 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee6e11e179 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/matrices-and-return-in-loop/0.wgsl.expected.wgsl @@ -0,0 +1,37 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn f_mf22_(m : ptr>) -> vec3 { + loop { + return vec3(1.0, 1.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + var param : mat2x2; + var x_38_phi : mat2x2; + let x_34 : f32 = gl_FragCoord.x; + x_38_phi = mat2x2(vec2(0.0, 0.0), vec2(0.0, 0.0)); + if ((x_34 >= 0.0)) { + x_38_phi = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); + } + let x_38 : mat2x2 = x_38_phi; + param = (x_38 * x_38); + let x_40 : vec3 = f_mf22_(&(param)); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm new file mode 100644 index 0000000000..7b3e22d828 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm @@ -0,0 +1,87 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %temp "temp" + OpName %gv "gv" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gv RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 + %bool = OpTypeBool +%_ptr_Function_int = OpTypePointer Function %int + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %28 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %gv = OpVariable %_ptr_Private_v4float Private +%float_8_60000038 = OpConstant %float 8.60000038 + %uint_1 = OpConstant %uint 1 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %14 + %37 = OpLabel + %temp = OpVariable %_ptr_Function_int Function + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %39 = OpLoad %float %38 + %40 = OpFOrdGreaterThan %bool %39 %float_2 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + %8 = OpLoad %v4float %gv + %9 = OpExtInst %v4float %1 FMix %28 %28 %8 + %10 = OpCompositeConstruct %v4float %float_8_60000038 %float_8_60000038 %float_8_60000038 %float_8_60000038 + %11 = OpExtInst %v4float %1 FMax %9 %10 + %12 = OpCompositeExtract %float %11 1 + %43 = OpConvertFToS %int %12 + OpStore %temp %43 + %44 = OpLoad %int %temp + %45 = OpSLessThan %bool %44 %int_150 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + OpKill + %46 = OpLabel + %48 = OpLoad %int %temp + %49 = OpSLessThan %bool %48 %int_180 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpKill + %50 = OpLabel + OpBranch %41 + %41 = OpLabel + OpStore %_GLF_color %36 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..0628a80ff6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.hlsl @@ -0,0 +1,35 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 gv = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int temp = 0; + const float x_39 = asfloat(x_5[0].x); + if ((x_39 > 2.0f)) { + temp = int(max(lerp(float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), gv), float4(8.600000381f, 8.600000381f, 8.600000381f, 8.600000381f)).y); + if ((temp < 150)) { + discard; + } + if ((temp < 180)) { + discard; + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..388fcc68d4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4, thread float4* const tint_symbol_5) { + int temp = 0; + float const x_39 = x_5.injectionSwitch.x; + if ((x_39 > 2.0f)) { + float4 const x_8 = *(tint_symbol_4); + temp = int(fmax(mix(float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), x_8), float4(8.600000381f, 8.600000381f, 8.600000381f, 8.600000381f)).y); + int const x_44 = temp; + if ((x_44 < 150)) { + discard_fragment(); + } + int const x_48 = temp; + if ((x_48 < 180)) { + discard_fragment(); + } + } + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_5, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..ad29d54925 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.spvasm @@ -0,0 +1,111 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + %34 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %gv "gv" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %temp "temp" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float + %gv = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %37 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%float_8_60000038 = OpConstant %float 8.60000038 + %39 = OpConstantComposite %v4float %float_8_60000038 %float_8_60000038 %float_8_60000038 %float_8_60000038 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %float_0 = OpConstant %float 0 + %52 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %20 + %24 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %25 = OpLoad %float %24 + %27 = OpFOrdGreaterThan %bool %25 %float_2 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %29 + %30 = OpLabel + %31 = OpLoad %v4float %gv + %35 = OpExtInst %v4float %34 FMix %37 %37 %31 + %33 = OpExtInst %v4float %34 NMax %35 %39 + %40 = OpCompositeExtract %float %33 1 + %32 = OpConvertFToS %int %40 + OpStore %temp %32 + %41 = OpLoad %int %temp + %43 = OpSLessThan %bool %41 %int_150 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + OpKill + %44 = OpLabel + %46 = OpLoad %int %temp + %48 = OpSLessThan %bool %46 %int_180 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + OpKill + %49 = OpLabel + OpBranch %29 + %29 = OpLabel + OpStore %x_GLF_color %52 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %53 +%tint_symbol = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %60 = OpLabel + %61 = OpFunctionCall %void %main_1 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpCompositeConstruct %main_out %63 + %62 = OpFunctionCall %void %tint_symbol_2 %64 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f4bf9c7d3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.spvasm.expected.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var gv : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var temp : i32; + let x_39 : f32 = x_5.injectionSwitch.x; + if ((x_39 > 2.0)) { + let x_8 : vec4 = gv; + temp = i32(max(mix(vec4(1.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0), x_8), vec4(8.600000381, 8.600000381, 8.600000381, 8.600000381)).y); + let x_44 : i32 = temp; + if ((x_44 < 150)) { + discard; + } + let x_48 : i32 = temp; + if ((x_48 < 180)) { + discard; + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl new file mode 100644 index 0000000000..f4bf9c7d3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var gv : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var temp : i32; + let x_39 : f32 = x_5.injectionSwitch.x; + if ((x_39 > 2.0)) { + let x_8 : vec4 = gv; + temp = i32(max(mix(vec4(1.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0), x_8), vec4(8.600000381, 8.600000381, 8.600000381, 8.600000381)).y); + let x_44 : i32 = temp; + if ((x_44 < 150)) { + discard; + } + let x_48 : i32 = temp; + if ((x_48 < 180)) { + discard; + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..0628a80ff6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 gv = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int temp = 0; + const float x_39 = asfloat(x_5[0].x); + if ((x_39 > 2.0f)) { + temp = int(max(lerp(float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), gv), float4(8.600000381f, 8.600000381f, 8.600000381f, 8.600000381f)).y); + if ((temp < 150)) { + discard; + } + if ((temp < 180)) { + discard; + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..388fcc68d4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4, thread float4* const tint_symbol_5) { + int temp = 0; + float const x_39 = x_5.injectionSwitch.x; + if ((x_39 > 2.0f)) { + float4 const x_8 = *(tint_symbol_4); + temp = int(fmax(mix(float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), x_8), float4(8.600000381f, 8.600000381f, 8.600000381f, 8.600000381f)).y); + int const x_44 = temp; + if ((x_44 < 150)) { + discard_fragment(); + } + int const x_48 = temp; + if ((x_48 < 180)) { + discard_fragment(); + } + } + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + thread float4 tint_symbol_7 = 0.0f; + main_1(x_5, &(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..ad29d54925 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.spvasm @@ -0,0 +1,111 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + %34 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %gv "gv" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %temp "temp" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float + %gv = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %37 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%float_8_60000038 = OpConstant %float 8.60000038 + %39 = OpConstantComposite %v4float %float_8_60000038 %float_8_60000038 %float_8_60000038 %float_8_60000038 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %float_0 = OpConstant %float 0 + %52 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %20 + %24 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %25 = OpLoad %float %24 + %27 = OpFOrdGreaterThan %bool %25 %float_2 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %29 + %30 = OpLabel + %31 = OpLoad %v4float %gv + %35 = OpExtInst %v4float %34 FMix %37 %37 %31 + %33 = OpExtInst %v4float %34 NMax %35 %39 + %40 = OpCompositeExtract %float %33 1 + %32 = OpConvertFToS %int %40 + OpStore %temp %32 + %41 = OpLoad %int %temp + %43 = OpSLessThan %bool %41 %int_150 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + OpKill + %44 = OpLabel + %46 = OpLoad %int %temp + %48 = OpSLessThan %bool %46 %int_180 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + OpKill + %49 = OpLabel + OpBranch %29 + %29 = OpLabel + OpStore %x_GLF_color %52 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %53 +%tint_symbol = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %60 = OpLabel + %61 = OpFunctionCall %void %main_1 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpCompositeConstruct %main_out %63 + %62 = OpFunctionCall %void %tint_symbol_2 %64 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f4bf9c7d3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/max-mix-conditional-discard/0-opt.wgsl.expected.wgsl @@ -0,0 +1,40 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var gv : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var temp : i32; + let x_39 : f32 = x_5.injectionSwitch.x; + if ((x_39 > 2.0)) { + let x_8 : vec4 = gv; + temp = i32(max(mix(vec4(1.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0), x_8), vec4(8.600000381, 8.600000381, 8.600000381, 8.600000381)).y); + let x_44 : i32 = temp; + if ((x_44 < 150)) { + discard; + } + let x_48 : i32 = temp; + if ((x_48 < 180)) { + discard; + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm new file mode 100644 index 0000000000..7c1f536411 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm @@ -0,0 +1,44 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %GLF_live6mand_ "GLF_live6mand(" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %9 = OpTypeFunction %v3float + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_38730 = OpConstant %uint 38730 + %uint_63193 = OpConstant %uint 63193 + %uint_63173 = OpConstant %uint 63173 + %15 = OpConstantComposite %v3uint %uint_38730 %uint_63193 %uint_63173 + %float_463 = OpConstant %float 463 + %float_4 = OpConstant %float 4 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v3float %float_463 %float_4 %float_0 + %float_2 = OpConstant %float 2 + %21 = OpConstantComposite %v3float %float_2 %float_2 %float_2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %6 + %26 = OpLabel + %27 = OpFunctionCall %v3float %GLF_live6mand_ + OpStore %_GLF_color %25 + OpReturn + OpFunctionEnd +%GLF_live6mand_ = OpFunction %v3float None %9 + %28 = OpLabel + %29 = OpBitcast %v3float %15 + %30 = OpExtInst %v3float %1 FMix %29 %19 %21 + OpReturnValue %30 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..90b1ba3e4d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.hlsl @@ -0,0 +1,27 @@ +SKIP: FAILED + + +var x_GLF_color : vec4; + +fn GLF_live6mand_() -> vec3 { + return mix(bitcast>(vec3(38730u, 63193u, 63173u)), vec3(463.0, 4.0, 0.0), vec3(2.0, 2.0, 2.0)); +} + +fn main_1() { + let x_27 : vec3 = GLF_live6mand_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +Failed to generate: error: Unable to do bitcast to type __vec_3__f32 diff --git a/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..46dbf20336 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.msl @@ -0,0 +1,28 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 GLF_live6mand_() { + return mix(as_type(uint3(38730u, 63193u, 63173u)), float3(463.0f, 4.0f, 0.0f), float3(2.0f, 2.0f, 2.0f)); +} + +void main_1(thread float4* const tint_symbol_4) { + float3 const x_27 = GLF_live6mand_(); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..02d804c3ac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %GLF_live6mand_ "GLF_live6mand_" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %8 = OpTypeFunction %v3float + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_38730 = OpConstant %uint 38730 + %uint_63193 = OpConstant %uint 63193 + %uint_63173 = OpConstant %uint 63173 + %20 = OpConstantComposite %v3uint %uint_38730 %uint_63193 %uint_63173 + %float_463 = OpConstant %float 463 + %float_4 = OpConstant %float 4 + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v3float %float_463 %float_4 %float_0 + %float_2 = OpConstant %float 2 + %26 = OpConstantComposite %v3float %float_2 %float_2 %float_2 + %void = OpTypeVoid + %27 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %34 = OpTypeFunction %void %main_out +%GLF_live6mand_ = OpFunction %v3float None %8 + %11 = OpLabel + %14 = OpBitcast %v3float %20 + %12 = OpExtInst %v3float %13 FMix %14 %24 %26 + OpReturnValue %12 + OpFunctionEnd + %main_1 = OpFunction %void None %27 + %30 = OpLabel + %31 = OpFunctionCall %v3float %GLF_live6mand_ + OpStore %x_GLF_color %33 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %34 +%tint_symbol = OpFunctionParameter %main_out + %38 = OpLabel + %39 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %39 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %41 = OpLabel + %42 = OpFunctionCall %void %main_1 + %44 = OpLoad %v4float %x_GLF_color + %45 = OpCompositeConstruct %main_out %44 + %43 = OpFunctionCall %void %tint_symbol_2 %45 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..99c613ea6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var x_GLF_color : vec4; + +fn GLF_live6mand_() -> vec3 { + return mix(bitcast>(vec3(38730u, 63193u, 63173u)), vec3(463.0, 4.0, 0.0), vec3(2.0, 2.0, 2.0)); +} + +fn main_1() { + let x_27 : vec3 = GLF_live6mand_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl new file mode 100644 index 0000000000..99c613ea6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl @@ -0,0 +1,22 @@ +var x_GLF_color : vec4; + +fn GLF_live6mand_() -> vec3 { + return mix(bitcast>(vec3(38730u, 63193u, 63173u)), vec3(463.0, 4.0, 0.0), vec3(2.0, 2.0, 2.0)); +} + +fn main_1() { + let x_27 : vec3 = GLF_live6mand_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..90b1ba3e4d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +SKIP: FAILED + + +var x_GLF_color : vec4; + +fn GLF_live6mand_() -> vec3 { + return mix(bitcast>(vec3(38730u, 63193u, 63173u)), vec3(463.0, 4.0, 0.0), vec3(2.0, 2.0, 2.0)); +} + +fn main_1() { + let x_27 : vec3 = GLF_live6mand_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +Failed to generate: error: Unable to do bitcast to type __vec_3__f32 diff --git a/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..46dbf20336 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.msl @@ -0,0 +1,28 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 GLF_live6mand_() { + return mix(as_type(uint3(38730u, 63193u, 63173u)), float3(463.0f, 4.0f, 0.0f), float3(2.0f, 2.0f, 2.0f)); +} + +void main_1(thread float4* const tint_symbol_4) { + float3 const x_27 = GLF_live6mand_(); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..02d804c3ac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + %13 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %GLF_live6mand_ "GLF_live6mand_" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %8 = OpTypeFunction %v3float + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_38730 = OpConstant %uint 38730 + %uint_63193 = OpConstant %uint 63193 + %uint_63173 = OpConstant %uint 63173 + %20 = OpConstantComposite %v3uint %uint_38730 %uint_63193 %uint_63173 + %float_463 = OpConstant %float 463 + %float_4 = OpConstant %float 4 + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v3float %float_463 %float_4 %float_0 + %float_2 = OpConstant %float 2 + %26 = OpConstantComposite %v3float %float_2 %float_2 %float_2 + %void = OpTypeVoid + %27 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %34 = OpTypeFunction %void %main_out +%GLF_live6mand_ = OpFunction %v3float None %8 + %11 = OpLabel + %14 = OpBitcast %v3float %20 + %12 = OpExtInst %v3float %13 FMix %14 %24 %26 + OpReturnValue %12 + OpFunctionEnd + %main_1 = OpFunction %void None %27 + %30 = OpLabel + %31 = OpFunctionCall %v3float %GLF_live6mand_ + OpStore %x_GLF_color %33 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %34 +%tint_symbol = OpFunctionParameter %main_out + %38 = OpLabel + %39 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %39 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %41 = OpLabel + %42 = OpFunctionCall %void %main_1 + %44 = OpLoad %v4float %x_GLF_color + %45 = OpCompositeConstruct %main_out %44 + %43 = OpFunctionCall %void %tint_symbol_2 %45 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..99c613ea6d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/mix-floor-add/0-opt.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var x_GLF_color : vec4; + +fn GLF_live6mand_() -> vec3 { + return mix(bitcast>(vec3(38730u, 63193u, 63173u)), vec3(463.0, 4.0, 0.0), vec3(2.0, 2.0, 2.0)); +} + +fn main_1() { + let x_27 : vec3 = GLF_live6mand_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm new file mode 100644 index 0000000000..0ec3da23ab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm @@ -0,0 +1,122 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %m44 "m44" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %21 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %26 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %float_12 = OpConstant %float 12 + %31 = OpConstantComposite %v4float %float_9 %float_10 %float_11 %float_12 + %float_13 = OpConstant %float 13 + %float_14 = OpConstant %float 14 + %float_15 = OpConstant %float 15 + %float_16 = OpConstant %float 16 + %36 = OpConstantComposite %v4float %float_13 %float_14 %float_15 %float_16 + %37 = OpConstantComposite %mat4v4float %21 %26 %31 %36 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %50 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Function_float = OpTypePointer Function %float + %int_2 = OpConstant %int 2 + %uint_2 = OpConstant %uint 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %main = OpFunction %void None %13 + %56 = OpLabel + %m44 = OpVariable %_ptr_Function_mat4v4float Function + OpStore %m44 %37 + OpBranch %57 + %57 = OpLabel + %10 = OpPhi %int %int_0 %56 %9 %58 + %59 = OpSLessThan %bool %10 %int_4 + OpLoopMerge %60 %58 None + OpBranchConditional %59 %61 %60 + %61 = OpLabel + %62 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %63 = OpLoad %float %62 + %64 = OpFOrdLessThan %bool %63 %float_0 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + OpBranch %60 + %65 = OpLabel + OpBranch %67 + %67 = OpLabel + %11 = OpPhi %int %int_0 %65 %8 %68 + %69 = OpSLessThan %bool %11 %int_4 + OpLoopMerge %70 %68 None + OpBranchConditional %69 %68 %70 + %68 = OpLabel + %71 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Function_float %m44 %10 %11 + %74 = OpLoad %float %73 + %75 = OpFAdd %float %74 %72 + OpStore %73 %75 + %8 = OpIAdd %int %11 %int_1 + OpBranch %67 + %70 = OpLabel + OpBranch %58 + %58 = OpLabel + %9 = OpIAdd %int %10 %int_1 + OpBranch %57 + %60 = OpLabel + %76 = OpAccessChain %_ptr_Function_float %m44 %int_1 %uint_1 + %77 = OpLoad %float %76 + %78 = OpFSub %float %77 %float_6 + %79 = OpCompositeInsert %v4float %78 %50 0 + %80 = OpAccessChain %_ptr_Function_float %m44 %int_2 %uint_2 + %81 = OpLoad %float %80 + %82 = OpFSub %float %81 %float_11 + %83 = OpCompositeInsert %v4float %82 %79 3 + OpStore %_GLF_color %83 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..69942c8c45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.hlsl @@ -0,0 +1,79 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x4 m44 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int x_10_phi = 0; + m44 = float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f)); + x_10_phi = 0; + while (true) { + int x_9 = 0; + int x_11_phi = 0; + const int x_10 = x_10_phi; + if ((x_10 < 4)) { + } else { + break; + } + const float x_63 = gl_FragCoord.y; + if ((x_63 < 0.0f)) { + break; + } + x_11_phi = 0; + while (true) { + int x_8 = 0; + const int x_11 = x_11_phi; + if ((x_11 < 4)) { + } else { + break; + } + { + const float x_72 = asfloat(x_7[0].x); + const int x_73_save = x_10; + const int x_73_save_1 = x_11; + const float x_74 = m44[x_73_save][x_73_save_1]; + set_float4(m44[x_73_save], x_73_save_1, (x_74 + x_72)); + x_8 = (x_11 + 1); + x_11_phi = x_8; + } + } + { + x_9 = (x_10 + 1); + x_10_phi = x_9; + } + } + const float x_77 = m44[1].y; + float4 x_79_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_79_1.x = (x_77 - 6.0f); + const float4 x_79 = x_79_1; + const float x_81 = m44[2].z; + float4 x_83_1 = x_79; + x_83_1.w = (x_81 - 11.0f); + x_GLF_color = x_83_1; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.msl new file mode 100644 index 0000000000..998e2de4c9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float4x4 m44 = float4x4(0.0f); + int x_10_phi = 0; + m44 = float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f)); + x_10_phi = 0; + while (true) { + int x_9 = 0; + int x_11_phi = 0; + int const x_10 = x_10_phi; + if ((x_10 < 4)) { + } else { + break; + } + float const x_63 = (*(tint_symbol_5)).y; + if ((x_63 < 0.0f)) { + break; + } + x_11_phi = 0; + while (true) { + int x_8 = 0; + int const x_11 = x_11_phi; + if ((x_11 < 4)) { + } else { + break; + } + { + float const x_72 = x_7.one; + int const x_73_save = x_10; + int const x_73_save_1 = x_11; + float const x_74 = m44[x_73_save][x_73_save_1]; + m44[x_73_save][x_73_save_1] = (x_74 + x_72); + x_8 = (x_11 + 1); + x_11_phi = x_8; + } + } + { + x_9 = (x_10 + 1); + x_10_phi = x_9; + } + } + float const x_77 = m44[1].y; + float4 x_79_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_79_1.x = (x_77 - 6.0f); + float4 const x_79 = x_79_1; + float const x_81 = m44[2].z; + float4 x_83_1 = x_79; + x_83_1.w = (x_81 - 11.0f); + float4 const x_83 = x_83_1; + *(tint_symbol_6) = x_83; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..312327e1db --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.spvasm @@ -0,0 +1,202 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 124 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %m44 "m44" + OpName %x_10_phi "x_10_phi" + OpName %x_9 "x_9" + OpName %x_11_phi "x_11_phi" + OpName %x_8 "x_8" + OpName %x_79_1 "x_79_1" + OpName %x_83_1 "x_83_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %21 = OpConstantNull %mat4v4float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %30 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %35 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %float_12 = OpConstant %float 12 + %40 = OpConstantComposite %v4float %float_9 %float_10 %float_11 %float_12 + %float_13 = OpConstant %float 13 + %float_14 = OpConstant %float 14 + %float_15 = OpConstant %float 15 + %float_16 = OpConstant %float 16 + %45 = OpConstantComposite %v4float %float_13 %float_14 %float_15 %float_16 + %46 = OpConstantComposite %mat4v4float %30 %35 %40 %45 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %96 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int_2 = OpConstant %int 2 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %main_out = OpTypeStruct %v4float + %111 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %m44 = OpVariable %_ptr_Function_mat4v4float Function %21 + %x_10_phi = OpVariable %_ptr_Function_int Function %25 + %x_9 = OpVariable %_ptr_Function_int Function %25 + %x_11_phi = OpVariable %_ptr_Function_int Function %25 + %x_8 = OpVariable %_ptr_Function_int Function %25 + %x_79_1 = OpVariable %_ptr_Function_v4float Function %5 + %x_83_1 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %m44 %46 + OpStore %x_10_phi %int_0 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %54 = OpLoad %int %x_10_phi + %56 = OpSLessThan %bool %54 %int_4 + OpSelectionMerge %58 None + OpBranchConditional %56 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %49 + %58 = OpLabel + %64 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %65 = OpLoad %float %64 + %67 = OpFOrdLessThan %bool %65 %float_0 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + OpBranch %49 + %68 = OpLabel + OpStore %x_11_phi %int_0 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %75 = OpLoad %int %x_11_phi + %76 = OpSLessThan %bool %75 %int_4 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + OpBranch %77 + %79 = OpLabel + OpBranch %71 + %77 = OpLabel + OpBranch %72 + %72 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %83 = OpLoad %float %82 + %85 = OpAccessChain %_ptr_Function_float %m44 %54 %75 + %86 = OpLoad %float %85 + %87 = OpAccessChain %_ptr_Function_float %m44 %54 %75 + %88 = OpFAdd %float %86 %83 + OpStore %87 %88 + %90 = OpIAdd %int %75 %int_1 + OpStore %x_8 %90 + %91 = OpLoad %int %x_8 + OpStore %x_11_phi %91 + OpBranch %70 + %71 = OpLabel + OpBranch %50 + %50 = OpLabel + %92 = OpIAdd %int %54 %int_1 + OpStore %x_9 %92 + %93 = OpLoad %int %x_9 + OpStore %x_10_phi %93 + OpBranch %48 + %49 = OpLabel + %94 = OpAccessChain %_ptr_Function_float %m44 %int_1 %uint_1 + %95 = OpLoad %float %94 + OpStore %x_79_1 %96 + %99 = OpAccessChain %_ptr_Function_float %x_79_1 %uint_0 + %100 = OpFSub %float %95 %float_6 + OpStore %99 %100 + %101 = OpLoad %v4float %x_79_1 + %104 = OpAccessChain %_ptr_Function_float %m44 %int_2 %uint_2 + %105 = OpLoad %float %104 + OpStore %x_83_1 %101 + %108 = OpAccessChain %_ptr_Function_float %x_83_1 %uint_3 + %109 = OpFSub %float %105 %float_11 + OpStore %108 %109 + %110 = OpLoad %v4float %x_83_1 + OpStore %x_GLF_color %110 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %111 +%tint_symbol_1 = OpFunctionParameter %main_out + %115 = OpLabel + %116 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %116 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %118 = OpLabel + %119 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %119 + %120 = OpFunctionCall %void %main_1 + %122 = OpLoad %v4float %x_GLF_color + %123 = OpCompositeConstruct %main_out %122 + %121 = OpFunctionCall %void %tint_symbol_3 %123 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..8f6639e288 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.wgsl @@ -0,0 +1,75 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m44 : mat4x4; + var x_10_phi : i32; + m44 = mat4x4(vec4(1.0, 2.0, 3.0, 4.0), vec4(5.0, 6.0, 7.0, 8.0), vec4(9.0, 10.0, 11.0, 12.0), vec4(13.0, 14.0, 15.0, 16.0)); + x_10_phi = 0; + loop { + var x_9 : i32; + var x_11_phi : i32; + let x_10 : i32 = x_10_phi; + if ((x_10 < 4)) { + } else { + break; + } + let x_63 : f32 = gl_FragCoord.y; + if ((x_63 < 0.0)) { + break; + } + x_11_phi = 0; + loop { + var x_8 : i32; + let x_11 : i32 = x_11_phi; + if ((x_11 < 4)) { + } else { + break; + } + + continuing { + let x_72 : f32 = x_7.one; + let x_73 : ptr = &(m44[x_10][x_11]); + let x_74 : f32 = *(x_73); + *(x_73) = (x_74 + x_72); + x_8 = (x_11 + 1); + x_11_phi = x_8; + } + } + + continuing { + x_9 = (x_10 + 1); + x_10_phi = x_9; + } + } + let x_77 : f32 = m44[1].y; + var x_79_1 : vec4 = vec4(0.0, 0.0, 0.0, 0.0); + x_79_1.x = (x_77 - 6.0); + let x_79 : vec4 = x_79_1; + let x_81 : f32 = m44[2].z; + var x_83_1 : vec4 = x_79; + x_83_1.w = (x_81 - 11.0); + let x_83 : vec4 = x_83_1; + x_GLF_color = x_83; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl new file mode 100644 index 0000000000..8f6639e288 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl @@ -0,0 +1,75 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m44 : mat4x4; + var x_10_phi : i32; + m44 = mat4x4(vec4(1.0, 2.0, 3.0, 4.0), vec4(5.0, 6.0, 7.0, 8.0), vec4(9.0, 10.0, 11.0, 12.0), vec4(13.0, 14.0, 15.0, 16.0)); + x_10_phi = 0; + loop { + var x_9 : i32; + var x_11_phi : i32; + let x_10 : i32 = x_10_phi; + if ((x_10 < 4)) { + } else { + break; + } + let x_63 : f32 = gl_FragCoord.y; + if ((x_63 < 0.0)) { + break; + } + x_11_phi = 0; + loop { + var x_8 : i32; + let x_11 : i32 = x_11_phi; + if ((x_11 < 4)) { + } else { + break; + } + + continuing { + let x_72 : f32 = x_7.one; + let x_73 : ptr = &(m44[x_10][x_11]); + let x_74 : f32 = *(x_73); + *(x_73) = (x_74 + x_72); + x_8 = (x_11 + 1); + x_11_phi = x_8; + } + } + + continuing { + x_9 = (x_10 + 1); + x_10_phi = x_9; + } + } + let x_77 : f32 = m44[1].y; + var x_79_1 : vec4 = vec4(0.0, 0.0, 0.0, 0.0); + x_79_1.x = (x_77 - 6.0); + let x_79 : vec4 = x_79_1; + let x_81 : f32 = m44[2].z; + var x_83_1 : vec4 = x_79; + x_83_1.w = (x_81 - 11.0); + let x_83 : vec4 = x_83_1; + x_GLF_color = x_83; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..69942c8c45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.hlsl @@ -0,0 +1,79 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x4 m44 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int x_10_phi = 0; + m44 = float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f)); + x_10_phi = 0; + while (true) { + int x_9 = 0; + int x_11_phi = 0; + const int x_10 = x_10_phi; + if ((x_10 < 4)) { + } else { + break; + } + const float x_63 = gl_FragCoord.y; + if ((x_63 < 0.0f)) { + break; + } + x_11_phi = 0; + while (true) { + int x_8 = 0; + const int x_11 = x_11_phi; + if ((x_11 < 4)) { + } else { + break; + } + { + const float x_72 = asfloat(x_7[0].x); + const int x_73_save = x_10; + const int x_73_save_1 = x_11; + const float x_74 = m44[x_73_save][x_73_save_1]; + set_float4(m44[x_73_save], x_73_save_1, (x_74 + x_72)); + x_8 = (x_11 + 1); + x_11_phi = x_8; + } + } + { + x_9 = (x_10 + 1); + x_10_phi = x_9; + } + } + const float x_77 = m44[1].y; + float4 x_79_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_79_1.x = (x_77 - 6.0f); + const float4 x_79 = x_79_1; + const float x_81 = m44[2].z; + float4 x_83_1 = x_79; + x_83_1.w = (x_81 - 11.0f); + x_GLF_color = x_83_1; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.msl new file mode 100644 index 0000000000..998e2de4c9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.msl @@ -0,0 +1,75 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float one; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float4x4 m44 = float4x4(0.0f); + int x_10_phi = 0; + m44 = float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f)); + x_10_phi = 0; + while (true) { + int x_9 = 0; + int x_11_phi = 0; + int const x_10 = x_10_phi; + if ((x_10 < 4)) { + } else { + break; + } + float const x_63 = (*(tint_symbol_5)).y; + if ((x_63 < 0.0f)) { + break; + } + x_11_phi = 0; + while (true) { + int x_8 = 0; + int const x_11 = x_11_phi; + if ((x_11 < 4)) { + } else { + break; + } + { + float const x_72 = x_7.one; + int const x_73_save = x_10; + int const x_73_save_1 = x_11; + float const x_74 = m44[x_73_save][x_73_save_1]; + m44[x_73_save][x_73_save_1] = (x_74 + x_72); + x_8 = (x_11 + 1); + x_11_phi = x_8; + } + } + { + x_9 = (x_10 + 1); + x_10_phi = x_9; + } + } + float const x_77 = m44[1].y; + float4 x_79_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_79_1.x = (x_77 - 6.0f); + float4 const x_79 = x_79_1; + float const x_81 = m44[2].z; + float4 x_83_1 = x_79; + x_83_1.w = (x_81 - 11.0f); + float4 const x_83 = x_83_1; + *(tint_symbol_6) = x_83; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..312327e1db --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.spvasm @@ -0,0 +1,202 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 124 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "one" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %m44 "m44" + OpName %x_10_phi "x_10_phi" + OpName %x_9 "x_9" + OpName %x_11_phi "x_11_phi" + OpName %x_8 "x_8" + OpName %x_79_1 "x_79_1" + OpName %x_83_1 "x_83_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %21 = OpConstantNull %mat4v4float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %30 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %35 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %float_12 = OpConstant %float 12 + %40 = OpConstantComposite %v4float %float_9 %float_10 %float_11 %float_12 + %float_13 = OpConstant %float 13 + %float_14 = OpConstant %float 14 + %float_15 = OpConstant %float 15 + %float_16 = OpConstant %float 16 + %45 = OpConstantComposite %v4float %float_13 %float_14 %float_15 %float_16 + %46 = OpConstantComposite %mat4v4float %30 %35 %40 %45 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %96 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int_2 = OpConstant %int 2 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %main_out = OpTypeStruct %v4float + %111 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %m44 = OpVariable %_ptr_Function_mat4v4float Function %21 + %x_10_phi = OpVariable %_ptr_Function_int Function %25 + %x_9 = OpVariable %_ptr_Function_int Function %25 + %x_11_phi = OpVariable %_ptr_Function_int Function %25 + %x_8 = OpVariable %_ptr_Function_int Function %25 + %x_79_1 = OpVariable %_ptr_Function_v4float Function %5 + %x_83_1 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %m44 %46 + OpStore %x_10_phi %int_0 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %54 = OpLoad %int %x_10_phi + %56 = OpSLessThan %bool %54 %int_4 + OpSelectionMerge %58 None + OpBranchConditional %56 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %49 + %58 = OpLabel + %64 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %65 = OpLoad %float %64 + %67 = OpFOrdLessThan %bool %65 %float_0 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + OpBranch %49 + %68 = OpLabel + OpStore %x_11_phi %int_0 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %75 = OpLoad %int %x_11_phi + %76 = OpSLessThan %bool %75 %int_4 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + OpBranch %77 + %79 = OpLabel + OpBranch %71 + %77 = OpLabel + OpBranch %72 + %72 = OpLabel + %82 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 + %83 = OpLoad %float %82 + %85 = OpAccessChain %_ptr_Function_float %m44 %54 %75 + %86 = OpLoad %float %85 + %87 = OpAccessChain %_ptr_Function_float %m44 %54 %75 + %88 = OpFAdd %float %86 %83 + OpStore %87 %88 + %90 = OpIAdd %int %75 %int_1 + OpStore %x_8 %90 + %91 = OpLoad %int %x_8 + OpStore %x_11_phi %91 + OpBranch %70 + %71 = OpLabel + OpBranch %50 + %50 = OpLabel + %92 = OpIAdd %int %54 %int_1 + OpStore %x_9 %92 + %93 = OpLoad %int %x_9 + OpStore %x_10_phi %93 + OpBranch %48 + %49 = OpLabel + %94 = OpAccessChain %_ptr_Function_float %m44 %int_1 %uint_1 + %95 = OpLoad %float %94 + OpStore %x_79_1 %96 + %99 = OpAccessChain %_ptr_Function_float %x_79_1 %uint_0 + %100 = OpFSub %float %95 %float_6 + OpStore %99 %100 + %101 = OpLoad %v4float %x_79_1 + %104 = OpAccessChain %_ptr_Function_float %m44 %int_2 %uint_2 + %105 = OpLoad %float %104 + OpStore %x_83_1 %101 + %108 = OpAccessChain %_ptr_Function_float %x_83_1 %uint_3 + %109 = OpFSub %float %105 %float_11 + OpStore %108 %109 + %110 = OpLoad %v4float %x_83_1 + OpStore %x_GLF_color %110 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %111 +%tint_symbol_1 = OpFunctionParameter %main_out + %115 = OpLabel + %116 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %116 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %118 = OpLabel + %119 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %119 + %120 = OpFunctionCall %void %main_1 + %122 = OpLoad %v4float %x_GLF_color + %123 = OpCompositeConstruct %main_out %122 + %121 = OpFunctionCall %void %tint_symbol_3 %123 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..8f6639e288 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.wgsl @@ -0,0 +1,75 @@ +[[block]] +struct buf0 { + one : f32; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var m44 : mat4x4; + var x_10_phi : i32; + m44 = mat4x4(vec4(1.0, 2.0, 3.0, 4.0), vec4(5.0, 6.0, 7.0, 8.0), vec4(9.0, 10.0, 11.0, 12.0), vec4(13.0, 14.0, 15.0, 16.0)); + x_10_phi = 0; + loop { + var x_9 : i32; + var x_11_phi : i32; + let x_10 : i32 = x_10_phi; + if ((x_10 < 4)) { + } else { + break; + } + let x_63 : f32 = gl_FragCoord.y; + if ((x_63 < 0.0)) { + break; + } + x_11_phi = 0; + loop { + var x_8 : i32; + let x_11 : i32 = x_11_phi; + if ((x_11 < 4)) { + } else { + break; + } + + continuing { + let x_72 : f32 = x_7.one; + let x_73 : ptr = &(m44[x_10][x_11]); + let x_74 : f32 = *(x_73); + *(x_73) = (x_74 + x_72); + x_8 = (x_11 + 1); + x_11_phi = x_8; + } + } + + continuing { + x_9 = (x_10 + 1); + x_10_phi = x_9; + } + } + let x_77 : f32 = m44[1].y; + var x_79_1 : vec4 = vec4(0.0, 0.0, 0.0, 0.0); + x_79_1.x = (x_77 - 6.0); + let x_79 : vec4 = x_79_1; + let x_81 : f32 = m44[2].z; + var x_83_1 : vec4 = x_79; + x_83_1.w = (x_81 - 11.0); + let x_83 : vec4 = x_83_1; + x_GLF_color = x_83; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm new file mode 100644 index 0000000000..f854eb0011 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm @@ -0,0 +1,86 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %nb_mod_f1_ "nb_mod(f1;" + OpName %limit "limit" + OpName %_injected_loop_counter "_injected_loop_counter" + OpName %_injected_loop_counter_0 "_injected_loop_counter" + OpName %gl_FragCoord "gl_FragCoord" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %_injected_loop_counter RelaxedPrecision + OpDecorate %_injected_loop_counter_0 RelaxedPrecision + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %14 = OpTypeFunction %float %_ptr_Function_float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %30 = OpUndef %int + %true = OpConstantTrue %bool + %main = OpFunction %void None %11 + %32 = OpLabel + %param = OpVariable %_ptr_Function_float Function + %33 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %34 = OpLoad %float %33 + OpStore %param %34 + %35 = OpFunctionCall %float %nb_mod_f1_ %param + OpStore %_GLF_color %29 + OpReturn + OpFunctionEnd + %nb_mod_f1_ = OpFunction %float None %14 + %limit = OpFunctionParameter %_ptr_Function_float + %36 = OpLabel +%_injected_loop_counter = OpVariable %_ptr_Function_int Function +%_injected_loop_counter_0 = OpVariable %_ptr_Function_int Function + %37 = OpLoad %float %limit + %38 = OpFOrdGreaterThanEqual %bool %float_1 %37 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %39 + %40 = OpLabel + OpReturnValue %float_1 + %39 = OpLabel + OpStore %_injected_loop_counter %int_0 + OpBranch %41 + %41 = OpLabel + %42 = OpSLessThan %bool %int_0 %int_2 + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + OpStore %_injected_loop_counter_0 %int_0 + OpBranch %46 + %46 = OpLabel + %47 = OpSLessThan %bool %int_0 %int_1 + OpLoopMerge %44 %48 None + OpBranch %49 + %49 = OpLabel + OpReturnValue %float_1 + %48 = OpLabel + OpBranch %46 + %44 = OpLabel + OpBranch %41 + %43 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..861538a7aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.hlsl @@ -0,0 +1,49 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float nb_mod_f1_(inout float limit) { + int x_injected_loop_counter = 0; + int x_injected_loop_counter_1 = 0; + const float x_37 = limit; + if ((1.0f >= x_37)) { + return 1.0f; + } + x_injected_loop_counter = 0; + while (true) { + const bool x_42 = (0 < 2); + x_injected_loop_counter_1 = 0; + while (true) { + const bool x_47 = (0 < 1); + return 1.0f; + } + } + return 0.0f; +} + +void main_1() { + float param = 0.0f; + const float x_34 = gl_FragCoord.x; + param = x_34; + const float x_35 = nb_mod_f1_(param); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..24551288d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float nb_mod_f1_(thread float* const limit) { + int x_injected_loop_counter = 0; + int x_injected_loop_counter_1 = 0; + float const x_37 = *(limit); + if ((1.0f >= x_37)) { + return 1.0f; + } + x_injected_loop_counter = 0; + while (true) { + bool const x_42 = (0 < 2); + x_injected_loop_counter_1 = 0; + while (true) { + bool const x_47 = (0 < 1); + return 1.0f; + } + } + return 0.0f; +} + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float param = 0.0f; + float const x_34 = (*(tint_symbol_5)).x; + param = x_34; + float const x_35 = nb_mod_f1_(&(param)); + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..eca9c85597 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.spvasm @@ -0,0 +1,120 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %nb_mod_f1_ "nb_mod_f1_" + OpName %limit "limit" + OpName %x_injected_loop_counter "x_injected_loop_counter" + OpName %x_injected_loop_counter_1 "x_injected_loop_counter_1" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_float = OpTypePointer Function %float + %11 = OpTypeFunction %float %_ptr_Function_float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %void = OpTypeVoid + %42 = OpTypeFunction %void + %47 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %55 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %56 = OpTypeFunction %void %main_out + %nb_mod_f1_ = OpFunction %float None %11 + %limit = OpFunctionParameter %_ptr_Function_float + %15 = OpLabel +%x_injected_loop_counter = OpVariable %_ptr_Function_int Function %19 +%x_injected_loop_counter_1 = OpVariable %_ptr_Function_int Function %19 + %22 = OpLoad %float %limit + %24 = OpFOrdGreaterThanEqual %bool %float_1 %22 + OpSelectionMerge %26 None + OpBranchConditional %24 %27 %26 + %27 = OpLabel + OpReturnValue %float_1 + %26 = OpLabel + OpStore %x_injected_loop_counter %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %34 = OpSLessThan %bool %int_0 %int_2 + OpStore %x_injected_loop_counter_1 %int_0 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %40 = OpSLessThan %bool %int_0 %int_1 + OpReturnValue %float_1 + %37 = OpLabel + OpBranch %35 + %36 = OpLabel + OpBranch %31 + %31 = OpLabel + OpBranch %29 + %30 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + %main_1 = OpFunction %void None %42 + %45 = OpLabel + %param = OpVariable %_ptr_Function_float Function %47 + %51 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %52 = OpLoad %float %51 + OpStore %param %52 + %53 = OpFunctionCall %float %nb_mod_f1_ %param + OpStore %x_GLF_color %55 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %56 +%tint_symbol_1 = OpFunctionParameter %main_out + %60 = OpLabel + %61 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %61 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %42 + %63 = OpLabel + %64 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %64 + %65 = OpFunctionCall %void %main_1 + %67 = OpLoad %v4float %x_GLF_color + %68 = OpCompositeConstruct %main_out %67 + %66 = OpFunctionCall %void %tint_symbol_3 %68 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f37535cba2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm.expected.wgsl @@ -0,0 +1,43 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn nb_mod_f1_(limit : ptr) -> f32 { + var x_injected_loop_counter : i32; + var x_injected_loop_counter_1 : i32; + let x_37 : f32 = *(limit); + if ((1.0 >= x_37)) { + return 1.0; + } + x_injected_loop_counter = 0; + loop { + let x_42 : bool = (0 < 2); + x_injected_loop_counter_1 = 0; + loop { + let x_47 : bool = (0 < 1); + return 1.0; + } + } + return 0.0; +} + +fn main_1() { + var param : f32; + let x_34 : f32 = gl_FragCoord.x; + param = x_34; + let x_35 : f32 = nb_mod_f1_(&(param)); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl new file mode 100644 index 0000000000..f37535cba2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl @@ -0,0 +1,43 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn nb_mod_f1_(limit : ptr) -> f32 { + var x_injected_loop_counter : i32; + var x_injected_loop_counter_1 : i32; + let x_37 : f32 = *(limit); + if ((1.0 >= x_37)) { + return 1.0; + } + x_injected_loop_counter = 0; + loop { + let x_42 : bool = (0 < 2); + x_injected_loop_counter_1 = 0; + loop { + let x_47 : bool = (0 < 1); + return 1.0; + } + } + return 0.0; +} + +fn main_1() { + var param : f32; + let x_34 : f32 = gl_FragCoord.x; + param = x_34; + let x_35 : f32 = nb_mod_f1_(&(param)); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..861538a7aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.hlsl @@ -0,0 +1,49 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float nb_mod_f1_(inout float limit) { + int x_injected_loop_counter = 0; + int x_injected_loop_counter_1 = 0; + const float x_37 = limit; + if ((1.0f >= x_37)) { + return 1.0f; + } + x_injected_loop_counter = 0; + while (true) { + const bool x_42 = (0 < 2); + x_injected_loop_counter_1 = 0; + while (true) { + const bool x_47 = (0 < 1); + return 1.0f; + } + } + return 0.0f; +} + +void main_1() { + float param = 0.0f; + const float x_34 = gl_FragCoord.x; + param = x_34; + const float x_35 = nb_mod_f1_(param); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..24551288d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float nb_mod_f1_(thread float* const limit) { + int x_injected_loop_counter = 0; + int x_injected_loop_counter_1 = 0; + float const x_37 = *(limit); + if ((1.0f >= x_37)) { + return 1.0f; + } + x_injected_loop_counter = 0; + while (true) { + bool const x_42 = (0 < 2); + x_injected_loop_counter_1 = 0; + while (true) { + bool const x_47 = (0 < 1); + return 1.0f; + } + } + return 0.0f; +} + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float param = 0.0f; + float const x_34 = (*(tint_symbol_5)).x; + param = x_34; + float const x_35 = nb_mod_f1_(&(param)); + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..eca9c85597 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.spvasm @@ -0,0 +1,120 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %nb_mod_f1_ "nb_mod_f1_" + OpName %limit "limit" + OpName %x_injected_loop_counter "x_injected_loop_counter" + OpName %x_injected_loop_counter_1 "x_injected_loop_counter_1" + OpName %main_1 "main_1" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_float = OpTypePointer Function %float + %11 = OpTypeFunction %float %_ptr_Function_float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %void = OpTypeVoid + %42 = OpTypeFunction %void + %47 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %55 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %56 = OpTypeFunction %void %main_out + %nb_mod_f1_ = OpFunction %float None %11 + %limit = OpFunctionParameter %_ptr_Function_float + %15 = OpLabel +%x_injected_loop_counter = OpVariable %_ptr_Function_int Function %19 +%x_injected_loop_counter_1 = OpVariable %_ptr_Function_int Function %19 + %22 = OpLoad %float %limit + %24 = OpFOrdGreaterThanEqual %bool %float_1 %22 + OpSelectionMerge %26 None + OpBranchConditional %24 %27 %26 + %27 = OpLabel + OpReturnValue %float_1 + %26 = OpLabel + OpStore %x_injected_loop_counter %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %34 = OpSLessThan %bool %int_0 %int_2 + OpStore %x_injected_loop_counter_1 %int_0 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %40 = OpSLessThan %bool %int_0 %int_1 + OpReturnValue %float_1 + %37 = OpLabel + OpBranch %35 + %36 = OpLabel + OpBranch %31 + %31 = OpLabel + OpBranch %29 + %30 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + %main_1 = OpFunction %void None %42 + %45 = OpLabel + %param = OpVariable %_ptr_Function_float Function %47 + %51 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %52 = OpLoad %float %51 + OpStore %param %52 + %53 = OpFunctionCall %float %nb_mod_f1_ %param + OpStore %x_GLF_color %55 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %56 +%tint_symbol_1 = OpFunctionParameter %main_out + %60 = OpLabel + %61 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %61 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %42 + %63 = OpLabel + %64 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %64 + %65 = OpFunctionCall %void %main_1 + %67 = OpLoad %v4float %x_GLF_color + %68 = OpCompositeConstruct %main_out %67 + %66 = OpFunctionCall %void %tint_symbol_3 %68 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f37535cba2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl.expected.wgsl @@ -0,0 +1,43 @@ +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn nb_mod_f1_(limit : ptr) -> f32 { + var x_injected_loop_counter : i32; + var x_injected_loop_counter_1 : i32; + let x_37 : f32 = *(limit); + if ((1.0 >= x_37)) { + return 1.0; + } + x_injected_loop_counter = 0; + loop { + let x_42 : bool = (0 < 2); + x_injected_loop_counter_1 = 0; + loop { + let x_47 : bool = (0 < 1); + return 1.0; + } + } + return 0.0; +} + +fn main_1() { + var param : f32; + let x_34 : f32 = gl_FragCoord.x; + param = x_34; + let x_35 : f32 = nb_mod_f1_(&(param)); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm new file mode 100644 index 0000000000..f77dde32e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm @@ -0,0 +1,83 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpDecorate %i RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %17 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %11 + %31 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %17 + OpStore %i %int_0 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %7 = OpLoad %int %i + %36 = OpSLessThan %bool %7 %int_10 + OpBranchConditional %36 %37 %33 + %37 = OpLabel + OpStore %_GLF_color %23 + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %39 = OpLoad %float %38 + %40 = OpFOrdGreaterThan %bool %float_1 %39 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + OpStore %_GLF_color %17 + OpSelectionMerge %43 None + OpBranchConditional %true %44 %43 + %44 = OpLabel + OpReturn + %43 = OpLabel + OpBranch %41 + %41 = OpLabel + OpBranch %34 + %34 = OpLabel + %8 = OpLoad %int %i + %9 = OpIAdd %int %8 %int_1 + OpStore %i %9 + OpBranch %32 + %33 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..d41e23b581 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,37 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + int i = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + { + for(; (i < 10); i = (i + 1)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + const float x_39 = asfloat(x_6[0].y); + if ((1.0f > x_39)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + if (true) { + return; + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..54dd6b330c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,47 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + while (true) { + int const x_7 = i; + if ((x_7 < 10)) { + } else { + break; + } + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + float const x_39 = x_6.injectionSwitch.y; + if ((1.0f > x_39)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + if (true) { + return; + } + } + { + int const x_8 = i; + i = (x_8 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e38a6fcbb6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,117 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %35 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %51 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %i = OpVariable %_ptr_Function_int Function %19 + OpStore %x_GLF_color %22 + OpStore %i %int_0 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %i + %30 = OpSLessThan %bool %28 %int_10 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %25 + %32 = OpLabel + OpStore %x_GLF_color %35 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %41 = OpLoad %float %40 + %42 = OpFOrdGreaterThan %bool %float_1 %41 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpStore %x_GLF_color %22 + OpSelectionMerge %46 None + OpBranchConditional %true %47 %46 + %47 = OpLabel + OpReturn + %46 = OpLabel + OpBranch %43 + %43 = OpLabel + OpBranch %26 + %26 = OpLabel + %48 = OpLoad %int %i + %50 = OpIAdd %int %48 %int_1 + OpStore %i %50 + OpBranch %24 + %25 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %51 +%tint_symbol = OpFunctionParameter %main_out + %55 = OpLabel + %56 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %56 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %58 = OpLabel + %59 = OpFunctionCall %void %main_1 + %61 = OpLoad %v4float %x_GLF_color + %62 = OpCompositeConstruct %main_out %61 + %60 = OpFunctionCall %void %tint_symbol_2 %62 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ac61d8e0e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,46 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var i : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + loop { + let x_7 : i32 = i; + if ((x_7 < 10)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + let x_39 : f32 = x_6.injectionSwitch.y; + if ((1.0 > x_39)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + if (true) { + return; + } + } + + continuing { + let x_8 : i32 = i; + i = (x_8 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl new file mode 100644 index 0000000000..ac61d8e0e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl @@ -0,0 +1,46 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var i : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + loop { + let x_7 : i32 = i; + if ((x_7 < 10)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + let x_39 : f32 = x_6.injectionSwitch.y; + if ((1.0 > x_39)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + if (true) { + return; + } + } + + continuing { + let x_8 : i32 = i; + i = (x_8 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..d41e23b581 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + int i = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + { + for(; (i < 10); i = (i + 1)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + const float x_39 = asfloat(x_6[0].y); + if ((1.0f > x_39)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + if (true) { + return; + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..54dd6b330c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,47 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + while (true) { + int const x_7 = i; + if ((x_7 < 10)) { + } else { + break; + } + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + float const x_39 = x_6.injectionSwitch.y; + if ((1.0f > x_39)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + if (true) { + return; + } + } + { + int const x_8 = i; + i = (x_8 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e38a6fcbb6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,117 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %35 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %51 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %i = OpVariable %_ptr_Function_int Function %19 + OpStore %x_GLF_color %22 + OpStore %i %int_0 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %i + %30 = OpSLessThan %bool %28 %int_10 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpBranch %32 + %34 = OpLabel + OpBranch %25 + %32 = OpLabel + OpStore %x_GLF_color %35 + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %41 = OpLoad %float %40 + %42 = OpFOrdGreaterThan %bool %float_1 %41 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpStore %x_GLF_color %22 + OpSelectionMerge %46 None + OpBranchConditional %true %47 %46 + %47 = OpLabel + OpReturn + %46 = OpLabel + OpBranch %43 + %43 = OpLabel + OpBranch %26 + %26 = OpLabel + %48 = OpLoad %int %i + %50 = OpIAdd %int %48 %int_1 + OpStore %i %50 + OpBranch %24 + %25 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %51 +%tint_symbol = OpFunctionParameter %main_out + %55 = OpLabel + %56 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %56 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %58 = OpLabel + %59 = OpFunctionCall %void %main_1 + %61 = OpLoad %v4float %x_GLF_color + %62 = OpCompositeConstruct %main_out %61 + %60 = OpFunctionCall %void %tint_symbol_2 %62 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ac61d8e0e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-ifs-and-return-in-for-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,46 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var i : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + loop { + let x_7 : i32 = i; + if ((x_7 < 10)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + let x_39 : f32 = x_6.injectionSwitch.y; + if ((1.0 > x_39)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + if (true) { + return; + } + } + + continuing { + let x_8 : i32 = i; + i = (x_8 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm new file mode 100644 index 0000000000..c76e15340c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm @@ -0,0 +1,189 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %GLF_dead5cols "GLF_dead5cols" + OpName %GLF_dead5rows "GLF_dead5rows" + OpName %GLF_dead5c "GLF_dead5c" + OpName %GLF_dead5r "GLF_dead5r" + OpName %msb10 "msb10" + OpName %donor_replacementGLF_dead5sums "donor_replacementGLF_dead5sums" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %uint_1 = OpConstant %uint 1 + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %int_9 = OpConstant %int 9 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_200 = OpConstant %int 200 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %39 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %14 + %40 = OpLabel + %i = OpVariable %_ptr_Function_int Function +%GLF_dead5cols = OpVariable %_ptr_Function_int Function +%GLF_dead5rows = OpVariable %_ptr_Function_int Function + %GLF_dead5c = OpVariable %_ptr_Function_int Function + %GLF_dead5r = OpVariable %_ptr_Function_int Function + %msb10 = OpVariable %_ptr_Function_int Function +%donor_replacementGLF_dead5sums = OpVariable %_ptr_Function__arr_float_uint_9 Function + OpStore %i %int_0 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %int %i + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %47 = OpLoad %float %46 + %48 = OpConvertFToS %int %47 + %49 = OpSGreaterThanEqual %bool %45 %48 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpBranch %42 + %50 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %53 = OpLoad %float %52 + %54 = OpFOrdGreaterThan %bool %float_0 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + OpStore %GLF_dead5cols %int_2 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %GLF_dead5cols + %62 = OpSLessThanEqual %bool %61 %int_4 + OpBranchConditional %62 %63 %58 + %63 = OpLabel + OpStore %GLF_dead5rows %int_2 + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %int %GLF_dead5rows + %69 = OpSLessThanEqual %bool %68 %int_4 + OpBranchConditional %69 %70 %65 + %70 = OpLabel + OpStore %GLF_dead5c %int_0 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %int %GLF_dead5c + %76 = OpLoad %int %GLF_dead5cols + %77 = OpSLessThan %bool %75 %76 + OpBranchConditional %77 %78 %72 + %78 = OpLabel + OpStore %GLF_dead5r %int_0 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %int %GLF_dead5r + %84 = OpLoad %int %GLF_dead5rows + %85 = OpSLessThan %bool %83 %84 + OpBranchConditional %85 %86 %80 + %86 = OpLabel + %87 = OpLoad %int %msb10 + OpSelectionMerge %88 None + OpSwitch %87 %88 1 %89 8 %89 + %89 = OpLabel + %90 = OpLoad %int %msb10 + %91 = OpSGreaterThanEqual %bool %90 %int_0 + %92 = OpLoad %int %msb10 + %93 = OpSLessThan %bool %92 %int_9 + %94 = OpLogicalAnd %bool %91 %93 + %95 = OpLoad %int %msb10 + %96 = OpSelect %int %94 %95 %int_0 + %97 = OpAccessChain %_ptr_Function_float %donor_replacementGLF_dead5sums %96 + %98 = OpLoad %float %97 + %99 = OpFAdd %float %98 %float_1 + %100 = OpAccessChain %_ptr_Function_float %donor_replacementGLF_dead5sums %96 + OpStore %100 %99 + OpBranch %88 + %88 = OpLabel + OpBranch %81 + %81 = OpLabel + %101 = OpLoad %int %GLF_dead5r + %102 = OpIAdd %int %101 %int_1 + OpStore %GLF_dead5r %102 + OpBranch %79 + %80 = OpLabel + OpBranch %73 + %73 = OpLabel + %103 = OpLoad %int %GLF_dead5c + %104 = OpIAdd %int %103 %int_1 + OpStore %GLF_dead5c %104 + OpBranch %71 + %72 = OpLabel + %105 = OpLoad %int %msb10 + %106 = OpIAdd %int %105 %int_1 + OpStore %msb10 %106 + OpBranch %66 + %66 = OpLabel + %107 = OpLoad %int %GLF_dead5rows + %108 = OpIAdd %int %107 %int_1 + OpStore %GLF_dead5rows %108 + OpBranch %64 + %65 = OpLabel + OpBranch %59 + %59 = OpLabel + %109 = OpLoad %int %GLF_dead5cols + %110 = OpIAdd %int %109 %int_1 + OpStore %GLF_dead5cols %110 + OpBranch %57 + %58 = OpLabel + OpBranch %55 + %55 = OpLabel + %111 = OpLoad %int %i + %112 = OpIAdd %int %111 %int_1 + OpStore %i %112 + OpBranch %43 + %43 = OpLabel + %113 = OpLoad %int %i + %114 = OpSLessThan %bool %113 %int_200 + OpBranchConditional %114 %41 %42 + %42 = OpLabel + OpStore %_GLF_color %39 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..938e5639f9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.hlsl @@ -0,0 +1,85 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int GLF_dead5cols = 0; + int GLF_dead5rows = 0; + int GLF_dead5c = 0; + int GLF_dead5r = 0; + int msb10 = 0; + float donor_replacementGLF_dead5sums[9] = (float[9])0; + i = 0; + while (true) { + const int x_45 = i; + const float x_47 = asfloat(x_6[0].x); + if ((x_45 >= int(x_47))) { + break; + } + const float x_53 = asfloat(x_6[0].y); + if ((0.0f > x_53)) { + GLF_dead5cols = 2; + { + for(; (GLF_dead5cols <= 4); GLF_dead5cols = (GLF_dead5cols + 1)) { + GLF_dead5rows = 2; + { + for(; (GLF_dead5rows <= 4); GLF_dead5rows = (GLF_dead5rows + 1)) { + GLF_dead5c = 0; + { + for(; (GLF_dead5c < GLF_dead5cols); GLF_dead5c = (GLF_dead5c + 1)) { + GLF_dead5r = 0; + { + for(; (GLF_dead5r < GLF_dead5rows); GLF_dead5r = (GLF_dead5r + 1)) { + switch(msb10) { + case 1: + case 8: { + bool tint_tmp = (msb10 >= 0); + if (tint_tmp) { + tint_tmp = (msb10 < 9); + } + const int x_96 = ((tint_tmp) ? msb10 : 0); + const float x_98 = donor_replacementGLF_dead5sums[x_96]; + donor_replacementGLF_dead5sums[x_96] = (x_98 + 1.0f); + break; + } + default: { + break; + } + } + } + } + } + } + msb10 = (msb10 + 1); + } + } + } + } + } + i = (i + 1); + { + if ((i < 200)) { + } else { + break; + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.msl new file mode 100644 index 0000000000..d1d24c8260 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.msl @@ -0,0 +1,124 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + int GLF_dead5cols = 0; + int GLF_dead5rows = 0; + int GLF_dead5c = 0; + int GLF_dead5r = 0; + int msb10 = 0; + tint_array_wrapper donor_replacementGLF_dead5sums = {}; + i = 0; + while (true) { + int const x_45 = i; + float const x_47 = x_6.injectionSwitch.x; + if ((x_45 >= int(x_47))) { + break; + } + float const x_53 = x_6.injectionSwitch.y; + if ((0.0f > x_53)) { + GLF_dead5cols = 2; + while (true) { + int const x_61 = GLF_dead5cols; + if ((x_61 <= 4)) { + } else { + break; + } + GLF_dead5rows = 2; + while (true) { + int const x_68 = GLF_dead5rows; + if ((x_68 <= 4)) { + } else { + break; + } + GLF_dead5c = 0; + while (true) { + int const x_75 = GLF_dead5c; + int const x_76 = GLF_dead5cols; + if ((x_75 < x_76)) { + } else { + break; + } + GLF_dead5r = 0; + while (true) { + int const x_83 = GLF_dead5r; + int const x_84 = GLF_dead5rows; + if ((x_83 < x_84)) { + } else { + break; + } + int const x_87 = msb10; + switch(x_87) { + case 1: + case 8: { + int const x_90 = msb10; + int const x_92 = msb10; + int const x_95 = msb10; + int const x_96 = select(0, x_95, ((x_90 >= 0) && (x_92 < 9))); + float const x_98 = donor_replacementGLF_dead5sums.arr[x_96]; + donor_replacementGLF_dead5sums.arr[x_96] = (x_98 + 1.0f); + break; + } + default: { + break; + } + } + { + int const x_101 = GLF_dead5r; + GLF_dead5r = (x_101 + 1); + } + } + { + int const x_103 = GLF_dead5c; + GLF_dead5c = (x_103 + 1); + } + } + int const x_105 = msb10; + msb10 = (x_105 + 1); + { + int const x_107 = GLF_dead5rows; + GLF_dead5rows = (x_107 + 1); + } + } + { + int const x_109 = GLF_dead5cols; + GLF_dead5cols = (x_109 + 1); + } + } + } + int const x_111 = i; + i = (x_111 + 1); + { + int const x_113 = i; + if ((x_113 < 200)) { + } else { + break; + } + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..cb7cc448e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.spvasm @@ -0,0 +1,262 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 145 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %GLF_dead5cols "GLF_dead5cols" + OpName %GLF_dead5rows "GLF_dead5rows" + OpName %GLF_dead5c "GLF_dead5c" + OpName %GLF_dead5r "GLF_dead5r" + OpName %msb10 "msb10" + OpName %donor_replacementGLF_dead5sums "donor_replacementGLF_dead5sums" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %30 = OpConstantNull %_arr_float_uint_9 + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %int_9 = OpConstant %int 9 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %int_200 = OpConstant %int 200 + %132 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %133 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %i = OpVariable %_ptr_Function_int Function %19 +%GLF_dead5cols = OpVariable %_ptr_Function_int Function %19 +%GLF_dead5rows = OpVariable %_ptr_Function_int Function %19 + %GLF_dead5c = OpVariable %_ptr_Function_int Function %19 + %GLF_dead5r = OpVariable %_ptr_Function_int Function %19 + %msb10 = OpVariable %_ptr_Function_int Function %19 +%donor_replacementGLF_dead5sums = OpVariable %_ptr_Function__arr_float_uint_9 Function %30 + OpStore %i %int_0 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %40 = OpLoad %float %39 + %41 = OpConvertFToS %int %40 + %42 = OpSGreaterThanEqual %bool %36 %41 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %44 + %45 = OpLabel + OpBranch %33 + %44 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %48 = OpLoad %float %47 + %50 = OpFOrdGreaterThan %bool %float_0 %48 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + OpStore %GLF_dead5cols %int_2 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %int %GLF_dead5cols + %60 = OpSLessThanEqual %bool %58 %int_4 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %55 + %61 = OpLabel + OpStore %GLF_dead5rows %int_2 + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %int %GLF_dead5rows + %69 = OpSLessThanEqual %bool %68 %int_4 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %65 + %70 = OpLabel + OpStore %GLF_dead5c %int_0 + OpBranch %73 + %73 = OpLabel + OpLoopMerge %74 %75 None + OpBranch %76 + %76 = OpLabel + %77 = OpLoad %int %GLF_dead5c + %78 = OpLoad %int %GLF_dead5cols + %79 = OpSLessThan %bool %77 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + OpBranch %80 + %82 = OpLabel + OpBranch %74 + %80 = OpLabel + OpStore %GLF_dead5r %int_0 + OpBranch %83 + %83 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + %87 = OpLoad %int %GLF_dead5r + %88 = OpLoad %int %GLF_dead5rows + %89 = OpSLessThan %bool %87 %88 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 + %91 = OpLabel + OpBranch %90 + %92 = OpLabel + OpBranch %84 + %90 = OpLabel + %93 = OpLoad %int %msb10 + OpSelectionMerge %94 None + OpSwitch %93 %95 1 %96 8 %96 + %96 = OpLabel + %97 = OpLoad %int %msb10 + %98 = OpLoad %int %msb10 + %99 = OpLoad %int %msb10 + %101 = OpSGreaterThanEqual %bool %97 %int_0 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + %105 = OpSLessThan %bool %98 %int_9 + OpBranch %102 + %102 = OpLabel + %106 = OpPhi %bool %101 %96 %105 %103 + %100 = OpSelect %int %106 %99 %int_0 + %108 = OpAccessChain %_ptr_Function_float %donor_replacementGLF_dead5sums %100 + %109 = OpLoad %float %108 + %110 = OpAccessChain %_ptr_Function_float %donor_replacementGLF_dead5sums %100 + %112 = OpFAdd %float %109 %float_1 + OpStore %110 %112 + OpBranch %94 + %95 = OpLabel + OpBranch %94 + %94 = OpLabel + OpBranch %85 + %85 = OpLabel + %113 = OpLoad %int %GLF_dead5r + %115 = OpIAdd %int %113 %int_1 + OpStore %GLF_dead5r %115 + OpBranch %83 + %84 = OpLabel + OpBranch %75 + %75 = OpLabel + %116 = OpLoad %int %GLF_dead5c + %117 = OpIAdd %int %116 %int_1 + OpStore %GLF_dead5c %117 + OpBranch %73 + %74 = OpLabel + %118 = OpLoad %int %msb10 + %119 = OpIAdd %int %118 %int_1 + OpStore %msb10 %119 + OpBranch %66 + %66 = OpLabel + %120 = OpLoad %int %GLF_dead5rows + %121 = OpIAdd %int %120 %int_1 + OpStore %GLF_dead5rows %121 + OpBranch %64 + %65 = OpLabel + OpBranch %56 + %56 = OpLabel + %122 = OpLoad %int %GLF_dead5cols + %123 = OpIAdd %int %122 %int_1 + OpStore %GLF_dead5cols %123 + OpBranch %54 + %55 = OpLabel + OpBranch %51 + %51 = OpLabel + %124 = OpLoad %int %i + %125 = OpIAdd %int %124 %int_1 + OpStore %i %125 + OpBranch %34 + %34 = OpLabel + %126 = OpLoad %int %i + %128 = OpSLessThan %bool %126 %int_200 + OpSelectionMerge %129 None + OpBranchConditional %128 %130 %131 + %130 = OpLabel + OpBranch %129 + %131 = OpLabel + OpBranch %33 + %129 = OpLabel + OpBranch %32 + %33 = OpLabel + OpStore %x_GLF_color %132 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %133 +%tint_symbol = OpFunctionParameter %main_out + %137 = OpLabel + %138 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %138 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %140 = OpLabel + %141 = OpFunctionCall %void %main_1 + %143 = OpLoad %v4float %x_GLF_color + %144 = OpCompositeConstruct %main_out %143 + %142 = OpFunctionCall %void %tint_symbol_2 %144 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 34[%34] is not post dominated by the back-edge block 129[%129] + %129 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..31f3f0e1c7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.spvasm.expected.wgsl @@ -0,0 +1,121 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var GLF_dead5cols : i32; + var GLF_dead5rows : i32; + var GLF_dead5c : i32; + var GLF_dead5r : i32; + var msb10 : i32; + var donor_replacementGLF_dead5sums : array; + i = 0; + loop { + let x_45 : i32 = i; + let x_47 : f32 = x_6.injectionSwitch.x; + if ((x_45 >= i32(x_47))) { + break; + } + let x_53 : f32 = x_6.injectionSwitch.y; + if ((0.0 > x_53)) { + GLF_dead5cols = 2; + loop { + let x_61 : i32 = GLF_dead5cols; + if ((x_61 <= 4)) { + } else { + break; + } + GLF_dead5rows = 2; + loop { + let x_68 : i32 = GLF_dead5rows; + if ((x_68 <= 4)) { + } else { + break; + } + GLF_dead5c = 0; + loop { + let x_75 : i32 = GLF_dead5c; + let x_76 : i32 = GLF_dead5cols; + if ((x_75 < x_76)) { + } else { + break; + } + GLF_dead5r = 0; + loop { + let x_83 : i32 = GLF_dead5r; + let x_84 : i32 = GLF_dead5rows; + if ((x_83 < x_84)) { + } else { + break; + } + let x_87 : i32 = msb10; + switch(x_87) { + case 1, 8: { + let x_90 : i32 = msb10; + let x_92 : i32 = msb10; + let x_95 : i32 = msb10; + let x_96 : i32 = select(0, x_95, ((x_90 >= 0) && (x_92 < 9))); + let x_98 : f32 = donor_replacementGLF_dead5sums[x_96]; + donor_replacementGLF_dead5sums[x_96] = (x_98 + 1.0); + } + default: { + } + } + + continuing { + let x_101 : i32 = GLF_dead5r; + GLF_dead5r = (x_101 + 1); + } + } + + continuing { + let x_103 : i32 = GLF_dead5c; + GLF_dead5c = (x_103 + 1); + } + } + let x_105 : i32 = msb10; + msb10 = (x_105 + 1); + + continuing { + let x_107 : i32 = GLF_dead5rows; + GLF_dead5rows = (x_107 + 1); + } + } + + continuing { + let x_109 : i32 = GLF_dead5cols; + GLF_dead5cols = (x_109 + 1); + } + } + } + let x_111 : i32 = i; + i = (x_111 + 1); + + continuing { + let x_113 : i32 = i; + if ((x_113 < 200)) { + } else { + break; + } + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl new file mode 100644 index 0000000000..31f3f0e1c7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl @@ -0,0 +1,121 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var GLF_dead5cols : i32; + var GLF_dead5rows : i32; + var GLF_dead5c : i32; + var GLF_dead5r : i32; + var msb10 : i32; + var donor_replacementGLF_dead5sums : array; + i = 0; + loop { + let x_45 : i32 = i; + let x_47 : f32 = x_6.injectionSwitch.x; + if ((x_45 >= i32(x_47))) { + break; + } + let x_53 : f32 = x_6.injectionSwitch.y; + if ((0.0 > x_53)) { + GLF_dead5cols = 2; + loop { + let x_61 : i32 = GLF_dead5cols; + if ((x_61 <= 4)) { + } else { + break; + } + GLF_dead5rows = 2; + loop { + let x_68 : i32 = GLF_dead5rows; + if ((x_68 <= 4)) { + } else { + break; + } + GLF_dead5c = 0; + loop { + let x_75 : i32 = GLF_dead5c; + let x_76 : i32 = GLF_dead5cols; + if ((x_75 < x_76)) { + } else { + break; + } + GLF_dead5r = 0; + loop { + let x_83 : i32 = GLF_dead5r; + let x_84 : i32 = GLF_dead5rows; + if ((x_83 < x_84)) { + } else { + break; + } + let x_87 : i32 = msb10; + switch(x_87) { + case 1, 8: { + let x_90 : i32 = msb10; + let x_92 : i32 = msb10; + let x_95 : i32 = msb10; + let x_96 : i32 = select(0, x_95, ((x_90 >= 0) && (x_92 < 9))); + let x_98 : f32 = donor_replacementGLF_dead5sums[x_96]; + donor_replacementGLF_dead5sums[x_96] = (x_98 + 1.0); + } + default: { + } + } + + continuing { + let x_101 : i32 = GLF_dead5r; + GLF_dead5r = (x_101 + 1); + } + } + + continuing { + let x_103 : i32 = GLF_dead5c; + GLF_dead5c = (x_103 + 1); + } + } + let x_105 : i32 = msb10; + msb10 = (x_105 + 1); + + continuing { + let x_107 : i32 = GLF_dead5rows; + GLF_dead5rows = (x_107 + 1); + } + } + + continuing { + let x_109 : i32 = GLF_dead5cols; + GLF_dead5cols = (x_109 + 1); + } + } + } + let x_111 : i32 = i; + i = (x_111 + 1); + + continuing { + let x_113 : i32 = i; + if ((x_113 < 200)) { + } else { + break; + } + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..938e5639f9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.hlsl @@ -0,0 +1,85 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int GLF_dead5cols = 0; + int GLF_dead5rows = 0; + int GLF_dead5c = 0; + int GLF_dead5r = 0; + int msb10 = 0; + float donor_replacementGLF_dead5sums[9] = (float[9])0; + i = 0; + while (true) { + const int x_45 = i; + const float x_47 = asfloat(x_6[0].x); + if ((x_45 >= int(x_47))) { + break; + } + const float x_53 = asfloat(x_6[0].y); + if ((0.0f > x_53)) { + GLF_dead5cols = 2; + { + for(; (GLF_dead5cols <= 4); GLF_dead5cols = (GLF_dead5cols + 1)) { + GLF_dead5rows = 2; + { + for(; (GLF_dead5rows <= 4); GLF_dead5rows = (GLF_dead5rows + 1)) { + GLF_dead5c = 0; + { + for(; (GLF_dead5c < GLF_dead5cols); GLF_dead5c = (GLF_dead5c + 1)) { + GLF_dead5r = 0; + { + for(; (GLF_dead5r < GLF_dead5rows); GLF_dead5r = (GLF_dead5r + 1)) { + switch(msb10) { + case 1: + case 8: { + bool tint_tmp = (msb10 >= 0); + if (tint_tmp) { + tint_tmp = (msb10 < 9); + } + const int x_96 = ((tint_tmp) ? msb10 : 0); + const float x_98 = donor_replacementGLF_dead5sums[x_96]; + donor_replacementGLF_dead5sums[x_96] = (x_98 + 1.0f); + break; + } + default: { + break; + } + } + } + } + } + } + msb10 = (msb10 + 1); + } + } + } + } + } + i = (i + 1); + { + if ((i < 200)) { + } else { + break; + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.msl new file mode 100644 index 0000000000..d1d24c8260 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.msl @@ -0,0 +1,124 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + int GLF_dead5cols = 0; + int GLF_dead5rows = 0; + int GLF_dead5c = 0; + int GLF_dead5r = 0; + int msb10 = 0; + tint_array_wrapper donor_replacementGLF_dead5sums = {}; + i = 0; + while (true) { + int const x_45 = i; + float const x_47 = x_6.injectionSwitch.x; + if ((x_45 >= int(x_47))) { + break; + } + float const x_53 = x_6.injectionSwitch.y; + if ((0.0f > x_53)) { + GLF_dead5cols = 2; + while (true) { + int const x_61 = GLF_dead5cols; + if ((x_61 <= 4)) { + } else { + break; + } + GLF_dead5rows = 2; + while (true) { + int const x_68 = GLF_dead5rows; + if ((x_68 <= 4)) { + } else { + break; + } + GLF_dead5c = 0; + while (true) { + int const x_75 = GLF_dead5c; + int const x_76 = GLF_dead5cols; + if ((x_75 < x_76)) { + } else { + break; + } + GLF_dead5r = 0; + while (true) { + int const x_83 = GLF_dead5r; + int const x_84 = GLF_dead5rows; + if ((x_83 < x_84)) { + } else { + break; + } + int const x_87 = msb10; + switch(x_87) { + case 1: + case 8: { + int const x_90 = msb10; + int const x_92 = msb10; + int const x_95 = msb10; + int const x_96 = select(0, x_95, ((x_90 >= 0) && (x_92 < 9))); + float const x_98 = donor_replacementGLF_dead5sums.arr[x_96]; + donor_replacementGLF_dead5sums.arr[x_96] = (x_98 + 1.0f); + break; + } + default: { + break; + } + } + { + int const x_101 = GLF_dead5r; + GLF_dead5r = (x_101 + 1); + } + } + { + int const x_103 = GLF_dead5c; + GLF_dead5c = (x_103 + 1); + } + } + int const x_105 = msb10; + msb10 = (x_105 + 1); + { + int const x_107 = GLF_dead5rows; + GLF_dead5rows = (x_107 + 1); + } + } + { + int const x_109 = GLF_dead5cols; + GLF_dead5cols = (x_109 + 1); + } + } + } + int const x_111 = i; + i = (x_111 + 1); + { + int const x_113 = i; + if ((x_113 < 200)) { + } else { + break; + } + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..cb7cc448e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.spvasm @@ -0,0 +1,262 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 145 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %GLF_dead5cols "GLF_dead5cols" + OpName %GLF_dead5rows "GLF_dead5rows" + OpName %GLF_dead5c "GLF_dead5c" + OpName %GLF_dead5r "GLF_dead5r" + OpName %msb10 "msb10" + OpName %donor_replacementGLF_dead5sums "donor_replacementGLF_dead5sums" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %30 = OpConstantNull %_arr_float_uint_9 + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %int_9 = OpConstant %int 9 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %int_200 = OpConstant %int 200 + %132 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %133 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %i = OpVariable %_ptr_Function_int Function %19 +%GLF_dead5cols = OpVariable %_ptr_Function_int Function %19 +%GLF_dead5rows = OpVariable %_ptr_Function_int Function %19 + %GLF_dead5c = OpVariable %_ptr_Function_int Function %19 + %GLF_dead5r = OpVariable %_ptr_Function_int Function %19 + %msb10 = OpVariable %_ptr_Function_int Function %19 +%donor_replacementGLF_dead5sums = OpVariable %_ptr_Function__arr_float_uint_9 Function %30 + OpStore %i %int_0 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %40 = OpLoad %float %39 + %41 = OpConvertFToS %int %40 + %42 = OpSGreaterThanEqual %bool %36 %41 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %44 + %45 = OpLabel + OpBranch %33 + %44 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %48 = OpLoad %float %47 + %50 = OpFOrdGreaterThan %bool %float_0 %48 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + OpStore %GLF_dead5cols %int_2 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %int %GLF_dead5cols + %60 = OpSLessThanEqual %bool %58 %int_4 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %55 + %61 = OpLabel + OpStore %GLF_dead5rows %int_2 + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %int %GLF_dead5rows + %69 = OpSLessThanEqual %bool %68 %int_4 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %65 + %70 = OpLabel + OpStore %GLF_dead5c %int_0 + OpBranch %73 + %73 = OpLabel + OpLoopMerge %74 %75 None + OpBranch %76 + %76 = OpLabel + %77 = OpLoad %int %GLF_dead5c + %78 = OpLoad %int %GLF_dead5cols + %79 = OpSLessThan %bool %77 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + OpBranch %80 + %82 = OpLabel + OpBranch %74 + %80 = OpLabel + OpStore %GLF_dead5r %int_0 + OpBranch %83 + %83 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + %87 = OpLoad %int %GLF_dead5r + %88 = OpLoad %int %GLF_dead5rows + %89 = OpSLessThan %bool %87 %88 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 + %91 = OpLabel + OpBranch %90 + %92 = OpLabel + OpBranch %84 + %90 = OpLabel + %93 = OpLoad %int %msb10 + OpSelectionMerge %94 None + OpSwitch %93 %95 1 %96 8 %96 + %96 = OpLabel + %97 = OpLoad %int %msb10 + %98 = OpLoad %int %msb10 + %99 = OpLoad %int %msb10 + %101 = OpSGreaterThanEqual %bool %97 %int_0 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + %105 = OpSLessThan %bool %98 %int_9 + OpBranch %102 + %102 = OpLabel + %106 = OpPhi %bool %101 %96 %105 %103 + %100 = OpSelect %int %106 %99 %int_0 + %108 = OpAccessChain %_ptr_Function_float %donor_replacementGLF_dead5sums %100 + %109 = OpLoad %float %108 + %110 = OpAccessChain %_ptr_Function_float %donor_replacementGLF_dead5sums %100 + %112 = OpFAdd %float %109 %float_1 + OpStore %110 %112 + OpBranch %94 + %95 = OpLabel + OpBranch %94 + %94 = OpLabel + OpBranch %85 + %85 = OpLabel + %113 = OpLoad %int %GLF_dead5r + %115 = OpIAdd %int %113 %int_1 + OpStore %GLF_dead5r %115 + OpBranch %83 + %84 = OpLabel + OpBranch %75 + %75 = OpLabel + %116 = OpLoad %int %GLF_dead5c + %117 = OpIAdd %int %116 %int_1 + OpStore %GLF_dead5c %117 + OpBranch %73 + %74 = OpLabel + %118 = OpLoad %int %msb10 + %119 = OpIAdd %int %118 %int_1 + OpStore %msb10 %119 + OpBranch %66 + %66 = OpLabel + %120 = OpLoad %int %GLF_dead5rows + %121 = OpIAdd %int %120 %int_1 + OpStore %GLF_dead5rows %121 + OpBranch %64 + %65 = OpLabel + OpBranch %56 + %56 = OpLabel + %122 = OpLoad %int %GLF_dead5cols + %123 = OpIAdd %int %122 %int_1 + OpStore %GLF_dead5cols %123 + OpBranch %54 + %55 = OpLabel + OpBranch %51 + %51 = OpLabel + %124 = OpLoad %int %i + %125 = OpIAdd %int %124 %int_1 + OpStore %i %125 + OpBranch %34 + %34 = OpLabel + %126 = OpLoad %int %i + %128 = OpSLessThan %bool %126 %int_200 + OpSelectionMerge %129 None + OpBranchConditional %128 %130 %131 + %130 = OpLabel + OpBranch %129 + %131 = OpLabel + OpBranch %33 + %129 = OpLabel + OpBranch %32 + %33 = OpLabel + OpStore %x_GLF_color %132 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %133 +%tint_symbol = OpFunctionParameter %main_out + %137 = OpLabel + %138 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %138 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %140 = OpLabel + %141 = OpFunctionCall %void %main_1 + %143 = OpLoad %v4float %x_GLF_color + %144 = OpCompositeConstruct %main_out %143 + %142 = OpFunctionCall %void %tint_symbol_2 %144 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 34[%34] is not post dominated by the back-edge block 129[%129] + %129 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..31f3f0e1c7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-loops-switch/0.wgsl.expected.wgsl @@ -0,0 +1,121 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var GLF_dead5cols : i32; + var GLF_dead5rows : i32; + var GLF_dead5c : i32; + var GLF_dead5r : i32; + var msb10 : i32; + var donor_replacementGLF_dead5sums : array; + i = 0; + loop { + let x_45 : i32 = i; + let x_47 : f32 = x_6.injectionSwitch.x; + if ((x_45 >= i32(x_47))) { + break; + } + let x_53 : f32 = x_6.injectionSwitch.y; + if ((0.0 > x_53)) { + GLF_dead5cols = 2; + loop { + let x_61 : i32 = GLF_dead5cols; + if ((x_61 <= 4)) { + } else { + break; + } + GLF_dead5rows = 2; + loop { + let x_68 : i32 = GLF_dead5rows; + if ((x_68 <= 4)) { + } else { + break; + } + GLF_dead5c = 0; + loop { + let x_75 : i32 = GLF_dead5c; + let x_76 : i32 = GLF_dead5cols; + if ((x_75 < x_76)) { + } else { + break; + } + GLF_dead5r = 0; + loop { + let x_83 : i32 = GLF_dead5r; + let x_84 : i32 = GLF_dead5rows; + if ((x_83 < x_84)) { + } else { + break; + } + let x_87 : i32 = msb10; + switch(x_87) { + case 1, 8: { + let x_90 : i32 = msb10; + let x_92 : i32 = msb10; + let x_95 : i32 = msb10; + let x_96 : i32 = select(0, x_95, ((x_90 >= 0) && (x_92 < 9))); + let x_98 : f32 = donor_replacementGLF_dead5sums[x_96]; + donor_replacementGLF_dead5sums[x_96] = (x_98 + 1.0); + } + default: { + } + } + + continuing { + let x_101 : i32 = GLF_dead5r; + GLF_dead5r = (x_101 + 1); + } + } + + continuing { + let x_103 : i32 = GLF_dead5c; + GLF_dead5c = (x_103 + 1); + } + } + let x_105 : i32 = msb10; + msb10 = (x_105 + 1); + + continuing { + let x_107 : i32 = GLF_dead5rows; + GLF_dead5rows = (x_107 + 1); + } + } + + continuing { + let x_109 : i32 = GLF_dead5cols; + GLF_dead5cols = (x_109 + 1); + } + } + } + let x_111 : i32 = i; + i = (x_111 + 1); + + continuing { + let x_113 : i32 = i; + if ((x_113 < 200)) { + } else { + break; + } + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm new file mode 100644 index 0000000000..7a18a0579e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm @@ -0,0 +1,72 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %bool = OpTypeBool + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %8 + %28 = OpLabel + OpStore %_GLF_color %14 + %29 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %30 = OpLoad %float %29 + %31 = OpConvertFToS %int %30 + OpSelectionMerge %32 None + OpSwitch %31 %32 0 %33 42 %34 + %33 = OpLabel + OpSelectionMerge %35 None + OpSwitch %int_1 %35 1 %36 + %36 = OpLabel + %37 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %38 = OpLoad %float %37 + %39 = OpFOrdGreaterThanEqual %bool %38 %float_0 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + OpStore %_GLF_color %27 + OpBranch %35 + %40 = OpLabel + OpKill + %35 = OpLabel + OpBranch %34 + %34 = OpLabel + OpBranch %32 + %32 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..c45a7a534d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.hlsl @@ -0,0 +1,55 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + const float x_30 = asfloat(x_6[0].x); + switch(int(x_30)) { + case 0: { + switch(1) { + case 1: { + const float x_38 = gl_FragCoord.y; + if ((x_38 >= 0.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + discard; + break; + } + default: { + break; + } + } + /* fallthrough */ + } + case 42: { + break; + } + default: { + break; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4f27a35f95 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 1.0f); + float const x_30 = x_6.injectionSwitch.x; + switch(int(x_30)) { + case 0: { + switch(1) { + case 1: { + float const x_38 = (*(tint_symbol_6)).y; + if ((x_38 >= 0.0f)) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + discard_fragment(); + break; + } + default: { + break; + } + } + /* fallthrough */ + } + case 42: { + break; + } + default: { + break; + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..6a58a17f87 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %bool = OpTypeBool + %45 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %46 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + OpStore %x_GLF_color %21 + %25 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %26 = OpLoad %float %25 + %28 = OpConvertFToS %int %26 + OpSelectionMerge %27 None + OpSwitch %28 %30 0 %31 42 %32 + %31 = OpLabel + OpSelectionMerge %33 None + OpSwitch %int_1 %35 1 %36 + %36 = OpLabel + %39 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %40 = OpLoad %float %39 + %41 = OpFOrdGreaterThanEqual %bool %40 %float_0 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %43 + %44 = OpLabel + OpStore %x_GLF_color %45 + OpBranch %33 + %43 = OpLabel + OpKill + %35 = OpLabel + OpBranch %33 + %33 = OpLabel + OpBranch %32 + %32 = OpLabel + OpBranch %27 + %30 = OpLabel + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %46 +%tint_symbol_1 = OpFunctionParameter %main_out + %50 = OpLabel + %51 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %51 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %54 + %55 = OpFunctionCall %void %main_1 + %57 = OpLoad %v4float %x_GLF_color + %58 = OpCompositeConstruct %main_out %57 + %56 = OpFunctionCall %void %tint_symbol_3 %58 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..44294d2d5e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.wgsl @@ -0,0 +1,49 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +fn main_1() { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + let x_30 : f32 = x_6.injectionSwitch.x; + switch(i32(x_30)) { + case 0: { + switch(1) { + case 1: { + let x_38 : f32 = gl_FragCoord.y; + if ((x_38 >= 0.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + } + discard; + } + default: { + } + } + fallthrough; + } + case 42: { + } + default: { + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl new file mode 100644 index 0000000000..44294d2d5e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl @@ -0,0 +1,49 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +fn main_1() { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + let x_30 : f32 = x_6.injectionSwitch.x; + switch(i32(x_30)) { + case 0: { + switch(1) { + case 1: { + let x_38 : f32 = gl_FragCoord.y; + if ((x_38 >= 0.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + } + discard; + } + default: { + } + } + fallthrough; + } + case 42: { + } + default: { + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..c45a7a534d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.hlsl @@ -0,0 +1,55 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + const float x_30 = asfloat(x_6[0].x); + switch(int(x_30)) { + case 0: { + switch(1) { + case 1: { + const float x_38 = gl_FragCoord.y; + if ((x_38 >= 0.0f)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + discard; + break; + } + default: { + break; + } + } + /* fallthrough */ + } + case 42: { + break; + } + default: { + break; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4f27a35f95 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 1.0f); + float const x_30 = x_6.injectionSwitch.x; + switch(int(x_30)) { + case 0: { + switch(1) { + case 1: { + float const x_38 = (*(tint_symbol_6)).y; + if ((x_38 >= 0.0f)) { + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + discard_fragment(); + break; + } + default: { + break; + } + } + /* fallthrough */ + } + case 42: { + break; + } + default: { + break; + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..6a58a17f87 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %bool = OpTypeBool + %45 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %46 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + OpStore %x_GLF_color %21 + %25 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %26 = OpLoad %float %25 + %28 = OpConvertFToS %int %26 + OpSelectionMerge %27 None + OpSwitch %28 %30 0 %31 42 %32 + %31 = OpLabel + OpSelectionMerge %33 None + OpSwitch %int_1 %35 1 %36 + %36 = OpLabel + %39 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %40 = OpLoad %float %39 + %41 = OpFOrdGreaterThanEqual %bool %40 %float_0 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %43 + %44 = OpLabel + OpStore %x_GLF_color %45 + OpBranch %33 + %43 = OpLabel + OpKill + %35 = OpLabel + OpBranch %33 + %33 = OpLabel + OpBranch %32 + %32 = OpLabel + OpBranch %27 + %30 = OpLabel + OpBranch %27 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %46 +%tint_symbol_1 = OpFunctionParameter %main_out + %50 = OpLabel + %51 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %51 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %53 = OpLabel + %54 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %54 + %55 = OpFunctionCall %void %main_1 + %57 = OpLoad %v4float %x_GLF_color + %58 = OpCompositeConstruct %main_out %57 + %56 = OpFunctionCall %void %tint_symbol_3 %58 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..44294d2d5e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.wgsl @@ -0,0 +1,49 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var gl_FragCoord : vec4; + +fn main_1() { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + let x_30 : f32 = x_6.injectionSwitch.x; + switch(i32(x_30)) { + case 0: { + switch(1) { + case 1: { + let x_38 : f32 = gl_FragCoord.y; + if ((x_38 >= 0.0)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + } + discard; + } + default: { + } + } + fallthrough; + } + case 42: { + } + default: { + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm new file mode 100644 index 0000000000..4864c875b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm @@ -0,0 +1,87 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint_0 = OpConstant %uint 0 +%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1 + %main = OpFunction %void None %13 + %34 = OpLabel + %10 = OpVariable %_ptr_Function__arr_int_uint_1 Function + %9 = OpVariable %_ptr_Function__arr_int_uint_1 Function + %35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %6 = OpLoad %int %35 + %36 = OpAccessChain %_ptr_Function_int %9 %int_0 + OpStore %36 %6 + %37 = OpLoad %_arr_int_uint_1 %9 + OpStore %10 %37 + %38 = OpAccessChain %_ptr_Function_int %9 %int_0 + %7 = OpLoad %int %38 + OpSelectionMerge %39 None + OpSwitch %uint_0 %40 + %40 = OpLabel + OpStore %_GLF_color %23 + %41 = OpAccessChain %_ptr_Function_int %10 %int_0 + %8 = OpLoad %int %41 + %42 = OpIEqual %bool %8 %7 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpBranch %39 + %43 = OpLabel + OpBranch %39 + %39 = OpLabel + %11 = OpPhi %int %int_1 %44 %int_2 %43 + %45 = OpIEqual %bool %11 %int_1 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpStore %_GLF_color %31 + OpBranch %46 + %48 = OpLabel + OpStore %_GLF_color %23 + OpBranch %46 + %46 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..b530d09c38 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.hlsl @@ -0,0 +1,47 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + int x_10[1] = (int[1])0; + int x_9[1] = (int[1])0; + int x_7 = 0; + int x_11_phi = 0; + const int x_6 = asint(x_5[0].x); + x_9[0] = x_6; + x_10 = x_9; + x_7 = x_9[0]; + switch(0u) { + default: { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const int x_8 = x_10[0]; + if ((x_8 == asint(x_7))) { + x_11_phi = 1; + break; + } + x_11_phi = 2; + break; + } + } + if ((x_11_phi == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..7e85bb9fe6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct tint_array_wrapper { + int arr[1]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + tint_array_wrapper x_10 = {}; + tint_array_wrapper x_9 = {}; + int x_7 = 0; + int x_11_phi = 0; + int const x_6 = x_5.zero; + x_9.arr[0] = x_6; + tint_array_wrapper const x_37 = x_9; + x_10 = x_37; + x_7 = x_9.arr[0]; + switch(0u) { + default: { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + int const x_8 = x_10.arr[0]; + if ((x_8 == as_type(x_7))) { + x_11_phi = 1; + break; + } + x_11_phi = 2; + break; + } + } + int const x_11 = x_11_phi; + if ((x_11 == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..06b6414fce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_10 "x_10" + OpName %x_9 "x_9" + OpName %x_7 "x_7" + OpName %x_11_phi "x_11_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_1 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 +%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1 + %21 = OpConstantNull %_arr_int_uint_1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %39 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %56 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %57 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_10 = OpVariable %_ptr_Function__arr_int_uint_1 Function %21 + %x_9 = OpVariable %_ptr_Function__arr_int_uint_1 Function %21 + %x_7 = OpVariable %_ptr_Function_int Function %25 + %x_11_phi = OpVariable %_ptr_Function_int Function %25 + %29 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %30 = OpLoad %int %29 + %32 = OpAccessChain %_ptr_Function_int %x_9 %int_0 + OpStore %32 %30 + %33 = OpLoad %_arr_int_uint_1 %x_9 + OpStore %x_10 %33 + %34 = OpAccessChain %_ptr_Function_int %x_9 %int_0 + %35 = OpLoad %int %34 + OpStore %x_7 %35 + OpSelectionMerge %36 None + OpSwitch %uint_0 %37 + %37 = OpLabel + OpStore %x_GLF_color %39 + %40 = OpAccessChain %_ptr_Function_int %x_10 %int_0 + %41 = OpLoad %int %40 + %43 = OpLoad %int %x_7 + %42 = OpCopyObject %int %43 + %44 = OpIEqual %bool %41 %42 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %46 + %47 = OpLabel + OpStore %x_11_phi %int_1 + OpBranch %36 + %46 = OpLabel + OpStore %x_11_phi %int_2 + OpBranch %36 + %36 = OpLabel + %50 = OpLoad %int %x_11_phi + %51 = OpIEqual %bool %50 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpStore %x_GLF_color %56 + OpBranch %52 + %54 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %57 +%tint_symbol = OpFunctionParameter %main_out + %61 = OpLabel + %62 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %62 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %64 = OpLabel + %65 = OpFunctionCall %void %main_1 + %67 = OpLoad %v4float %x_GLF_color + %68 = OpCompositeConstruct %main_out %67 + %66 = OpFunctionCall %void %tint_symbol_2 %68 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..62409af016 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.spvasm.expected.wgsl @@ -0,0 +1,49 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_10 : array; + var x_9 : array; + var x_7 : i32; + var x_11_phi : i32; + let x_6 : i32 = x_5.zero; + x_9[0] = x_6; + let x_37 : array = x_9; + x_10 = x_37; + x_7 = x_9[0]; + switch(0u) { + default: { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_8 : i32 = x_10[0]; + if ((x_8 == bitcast(x_7))) { + x_11_phi = 1; + break; + } + x_11_phi = 2; + } + } + let x_11 : i32 = x_11_phi; + if ((x_11 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl new file mode 100644 index 0000000000..62409af016 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl @@ -0,0 +1,49 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_10 : array; + var x_9 : array; + var x_7 : i32; + var x_11_phi : i32; + let x_6 : i32 = x_5.zero; + x_9[0] = x_6; + let x_37 : array = x_9; + x_10 = x_37; + x_7 = x_9[0]; + switch(0u) { + default: { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_8 : i32 = x_10[0]; + if ((x_8 == bitcast(x_7))) { + x_11_phi = 1; + break; + } + x_11_phi = 2; + } + } + let x_11 : i32 = x_11_phi; + if ((x_11 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..b530d09c38 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.hlsl @@ -0,0 +1,47 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + int x_10[1] = (int[1])0; + int x_9[1] = (int[1])0; + int x_7 = 0; + int x_11_phi = 0; + const int x_6 = asint(x_5[0].x); + x_9[0] = x_6; + x_10 = x_9; + x_7 = x_9[0]; + switch(0u) { + default: { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + const int x_8 = x_10[0]; + if ((x_8 == asint(x_7))) { + x_11_phi = 1; + break; + } + x_11_phi = 2; + break; + } + } + if ((x_11_phi == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..7e85bb9fe6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.msl @@ -0,0 +1,55 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int zero; +}; +struct tint_array_wrapper { + int arr[1]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + tint_array_wrapper x_10 = {}; + tint_array_wrapper x_9 = {}; + int x_7 = 0; + int x_11_phi = 0; + int const x_6 = x_5.zero; + x_9.arr[0] = x_6; + tint_array_wrapper const x_37 = x_9; + x_10 = x_37; + x_7 = x_9.arr[0]; + switch(0u) { + default: { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + int const x_8 = x_10.arr[0]; + if ((x_8 == as_type(x_7))) { + x_11_phi = 1; + break; + } + x_11_phi = 2; + break; + } + } + int const x_11 = x_11_phi; + if ((x_11 == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..06b6414fce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_10 "x_10" + OpName %x_9 "x_9" + OpName %x_7 "x_7" + OpName %x_11_phi "x_11_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_1 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 +%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1 + %21 = OpConstantNull %_arr_int_uint_1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %39 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float_1 = OpConstant %float 1 + %56 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %57 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_10 = OpVariable %_ptr_Function__arr_int_uint_1 Function %21 + %x_9 = OpVariable %_ptr_Function__arr_int_uint_1 Function %21 + %x_7 = OpVariable %_ptr_Function_int Function %25 + %x_11_phi = OpVariable %_ptr_Function_int Function %25 + %29 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 + %30 = OpLoad %int %29 + %32 = OpAccessChain %_ptr_Function_int %x_9 %int_0 + OpStore %32 %30 + %33 = OpLoad %_arr_int_uint_1 %x_9 + OpStore %x_10 %33 + %34 = OpAccessChain %_ptr_Function_int %x_9 %int_0 + %35 = OpLoad %int %34 + OpStore %x_7 %35 + OpSelectionMerge %36 None + OpSwitch %uint_0 %37 + %37 = OpLabel + OpStore %x_GLF_color %39 + %40 = OpAccessChain %_ptr_Function_int %x_10 %int_0 + %41 = OpLoad %int %40 + %43 = OpLoad %int %x_7 + %42 = OpCopyObject %int %43 + %44 = OpIEqual %bool %41 %42 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %46 + %47 = OpLabel + OpStore %x_11_phi %int_1 + OpBranch %36 + %46 = OpLabel + OpStore %x_11_phi %int_2 + OpBranch %36 + %36 = OpLabel + %50 = OpLoad %int %x_11_phi + %51 = OpIEqual %bool %50 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpStore %x_GLF_color %56 + OpBranch %52 + %54 = OpLabel + OpStore %x_GLF_color %39 + OpBranch %52 + %52 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %57 +%tint_symbol = OpFunctionParameter %main_out + %61 = OpLabel + %62 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %62 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %64 = OpLabel + %65 = OpFunctionCall %void %main_1 + %67 = OpLoad %v4float %x_GLF_color + %68 = OpCompositeConstruct %main_out %67 + %66 = OpFunctionCall %void %tint_symbol_2 %68 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..62409af016 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/one-sized-array/0-opt.wgsl.expected.wgsl @@ -0,0 +1,49 @@ +[[block]] +struct buf0 { + zero : i32; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var x_10 : array; + var x_9 : array; + var x_7 : i32; + var x_11_phi : i32; + let x_6 : i32 = x_5.zero; + x_9[0] = x_6; + let x_37 : array = x_9; + x_10 = x_37; + x_7 = x_9[0]; + switch(0u) { + default: { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + let x_8 : i32 = x_10[0]; + if ((x_8 == bitcast(x_7))) { + x_11_phi = 1; + break; + } + x_11_phi = 2; + } + } + let x_11 : i32 = x_11_phi; + if ((x_11 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm new file mode 100644 index 0000000000..ef091fe314 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm @@ -0,0 +1,87 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %25 = OpUndef %float + %26 = OpUndef %v4float + %main = OpFunction %void None %8 + %27 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %29 = OpLoad %float %28 + %30 = OpFOrdGreaterThan %bool %29 %float_1 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %31 + %32 = OpLabel + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %41 = OpLoad %float %40 + %42 = OpFOrdLessThan %bool %41 %float_0 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpSelectionMerge %45 None + OpBranchConditional %30 %46 %38 + %46 = OpLabel + OpBranch %37 + %45 = OpLabel + OpBranch %38 + %38 = OpLabel + OpBranch %36 + %43 = OpLabel + OpBranch %37 + %37 = OpLabel + %47 = OpPhi %float %float_1 %46 %25 %43 + OpBranch %34 + %35 = OpLabel + OpBranch %33 + %34 = OpLabel + %48 = OpCompositeInsert %v4float %47 %26 1 + OpStore %_GLF_color %48 + OpBranch %31 + %31 = OpLabel + OpStore %_GLF_color %24 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..abeefe6b41 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,57 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_30 = false; + float x_47 = 0.0f; + const float x_29 = asfloat(x_6[0].x); + x_30 = (x_29 > 1.0f); + if (x_30) { + while (true) { + float x_47_phi = 0.0f; + while (true) { + const float x_41 = gl_FragCoord.x; + if ((x_41 < 0.0f)) { + if (x_30) { + x_47_phi = 1.0f; + break; + } else { + continue; + } + continue; + } + x_47_phi = 0.0f; + break; + } + x_47 = x_47_phi; + break; + } + float4 x_48_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_48_1.y = x_47; + x_GLF_color = x_48_1; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..cd6a1094a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + bool x_30 = false; + float x_47 = 0.0f; + float const x_29 = x_6.injectionSwitch.x; + x_30 = (x_29 > 1.0f); + if (x_30) { + while (true) { + float x_47_phi = 0.0f; + while (true) { + float const x_41 = (*(tint_symbol_5)).x; + if ((x_41 < 0.0f)) { + if (x_30) { + x_47_phi = 1.0f; + break; + } else { + continue; + } + continue; + } + x_47_phi = 0.0f; + break; + } + x_47 = x_47_phi; + break; + } + float4 x_48_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_48_1.y = x_47; + float4 const x_48 = x_48_1; + *(tint_symbol_6) = x_48; + } + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..cbe84e4580 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_30 "x_30" + OpName %x_47 "x_47" + OpName %x_47_phi "x_47_phi" + OpName %x_48_1 "x_48_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %57 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_1 = OpConstant %uint 1 + %64 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_30 = OpVariable %_ptr_Function_bool Function %22 + %x_47 = OpVariable %_ptr_Function_float Function %25 + %x_47_phi = OpVariable %_ptr_Function_float Function %25 + %x_48_1 = OpVariable %_ptr_Function_v4float Function %5 + %29 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %30 = OpLoad %float %29 + %32 = OpFOrdGreaterThan %bool %30 %float_1 + OpStore %x_30 %32 + %33 = OpLoad %bool %x_30 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %46 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %47 = OpLoad %float %46 + %49 = OpFOrdLessThan %bool %47 %float_0 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + %52 = OpLoad %bool %x_30 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + OpStore %x_47_phi %float_1 + OpBranch %42 + %55 = OpLabel + OpBranch %43 + %53 = OpLabel + OpBranch %43 + %50 = OpLabel + OpStore %x_47_phi %float_0 + OpBranch %42 + %43 = OpLabel + OpBranch %41 + %42 = OpLabel + %56 = OpLoad %float %x_47_phi + OpStore %x_47 %56 + OpBranch %37 + %38 = OpLabel + OpBranch %36 + %37 = OpLabel + OpStore %x_48_1 %57 + %61 = OpAccessChain %_ptr_Function_float %x_48_1 %uint_1 + %62 = OpLoad %float %x_47 + OpStore %61 %62 + %63 = OpLoad %v4float %x_48_1 + OpStore %x_GLF_color %63 + OpBranch %34 + %34 = OpLabel + OpStore %x_GLF_color %64 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %65 +%tint_symbol_1 = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %72 = OpLabel + %73 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %73 + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_3 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..fd8fb0e621 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,56 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_30 : bool; + var x_47 : f32; + let x_29 : f32 = x_6.injectionSwitch.x; + x_30 = (x_29 > 1.0); + if (x_30) { + loop { + var x_47_phi : f32; + loop { + let x_41 : f32 = gl_FragCoord.x; + if ((x_41 < 0.0)) { + if (x_30) { + x_47_phi = 1.0; + break; + } else { + continue; + } + continue; + } + x_47_phi = 0.0; + break; + } + x_47 = x_47_phi; + break; + } + var x_48_1 : vec4 = vec4(0.0, 0.0, 0.0, 0.0); + x_48_1.y = x_47; + let x_48 : vec4 = x_48_1; + x_GLF_color = x_48; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl new file mode 100644 index 0000000000..fd8fb0e621 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl @@ -0,0 +1,56 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_30 : bool; + var x_47 : f32; + let x_29 : f32 = x_6.injectionSwitch.x; + x_30 = (x_29 > 1.0); + if (x_30) { + loop { + var x_47_phi : f32; + loop { + let x_41 : f32 = gl_FragCoord.x; + if ((x_41 < 0.0)) { + if (x_30) { + x_47_phi = 1.0; + break; + } else { + continue; + } + continue; + } + x_47_phi = 0.0; + break; + } + x_47 = x_47_phi; + break; + } + var x_48_1 : vec4 = vec4(0.0, 0.0, 0.0, 0.0); + x_48_1.y = x_47; + let x_48 : vec4 = x_48_1; + x_GLF_color = x_48; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..abeefe6b41 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,57 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_30 = false; + float x_47 = 0.0f; + const float x_29 = asfloat(x_6[0].x); + x_30 = (x_29 > 1.0f); + if (x_30) { + while (true) { + float x_47_phi = 0.0f; + while (true) { + const float x_41 = gl_FragCoord.x; + if ((x_41 < 0.0f)) { + if (x_30) { + x_47_phi = 1.0f; + break; + } else { + continue; + } + continue; + } + x_47_phi = 0.0f; + break; + } + x_47 = x_47_phi; + break; + } + float4 x_48_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_48_1.y = x_47; + x_GLF_color = x_48_1; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..cd6a1094a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,57 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + bool x_30 = false; + float x_47 = 0.0f; + float const x_29 = x_6.injectionSwitch.x; + x_30 = (x_29 > 1.0f); + if (x_30) { + while (true) { + float x_47_phi = 0.0f; + while (true) { + float const x_41 = (*(tint_symbol_5)).x; + if ((x_41 < 0.0f)) { + if (x_30) { + x_47_phi = 1.0f; + break; + } else { + continue; + } + continue; + } + x_47_phi = 0.0f; + break; + } + x_47 = x_47_phi; + break; + } + float4 x_48_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_48_1.y = x_47; + float4 const x_48 = x_48_1; + *(tint_symbol_6) = x_48; + } + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..cbe84e4580 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_30 "x_30" + OpName %x_47 "x_47" + OpName %x_47_phi "x_47_phi" + OpName %x_48_1 "x_48_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %57 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_1 = OpConstant %uint 1 + %64 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_30 = OpVariable %_ptr_Function_bool Function %22 + %x_47 = OpVariable %_ptr_Function_float Function %25 + %x_47_phi = OpVariable %_ptr_Function_float Function %25 + %x_48_1 = OpVariable %_ptr_Function_v4float Function %5 + %29 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %30 = OpLoad %float %29 + %32 = OpFOrdGreaterThan %bool %30 %float_1 + OpStore %x_30 %32 + %33 = OpLoad %bool %x_30 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %46 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %47 = OpLoad %float %46 + %49 = OpFOrdLessThan %bool %47 %float_0 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + %52 = OpLoad %bool %x_30 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + OpStore %x_47_phi %float_1 + OpBranch %42 + %55 = OpLabel + OpBranch %43 + %53 = OpLabel + OpBranch %43 + %50 = OpLabel + OpStore %x_47_phi %float_0 + OpBranch %42 + %43 = OpLabel + OpBranch %41 + %42 = OpLabel + %56 = OpLoad %float %x_47_phi + OpStore %x_47 %56 + OpBranch %37 + %38 = OpLabel + OpBranch %36 + %37 = OpLabel + OpStore %x_48_1 %57 + %61 = OpAccessChain %_ptr_Function_float %x_48_1 %uint_1 + %62 = OpLoad %float %x_47 + OpStore %61 %62 + %63 = OpLoad %v4float %x_48_1 + OpStore %x_GLF_color %63 + OpBranch %34 + %34 = OpLabel + OpStore %x_GLF_color %64 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %65 +%tint_symbol_1 = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %72 = OpLabel + %73 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %73 + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_3 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..fd8fb0e621 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-float-from-while-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,56 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_30 : bool; + var x_47 : f32; + let x_29 : f32 = x_6.injectionSwitch.x; + x_30 = (x_29 > 1.0); + if (x_30) { + loop { + var x_47_phi : f32; + loop { + let x_41 : f32 = gl_FragCoord.x; + if ((x_41 < 0.0)) { + if (x_30) { + x_47_phi = 1.0; + break; + } else { + continue; + } + continue; + } + x_47_phi = 0.0; + break; + } + x_47 = x_47_phi; + break; + } + var x_48_1 : vec4 = vec4(0.0, 0.0, 0.0, 0.0); + x_48_1.y = x_47; + let x_48 : vec4 = x_48_1; + x_GLF_color = x_48; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm new file mode 100644 index 0000000000..6f810d5363 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm @@ -0,0 +1,95 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f_ "f(" + OpName %i "i" + OpName %c "c" + OpName %i_0 "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %i RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %i_0 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float = OpTypeFloat 32 + %18 = OpTypeFunction %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %28 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %16 + %34 = OpLabel + %c = OpVariable %_ptr_Function_v4float Function + %i_0 = OpVariable %_ptr_Function_int Function + OpStore %c %28 + OpStore %i_0 %int_0 + OpBranch %35 + %35 = OpLabel + %12 = OpLoad %int %i_0 + %36 = OpSLessThan %bool %12 %int_1 + OpLoopMerge %37 %38 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + %39 = OpFunctionCall %float %f_ + %40 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %40 %39 + %13 = OpLoad %int %i_0 + %14 = OpIAdd %int %13 %int_1 + OpStore %i_0 %14 + OpBranch %35 + %37 = OpLabel + %41 = OpLoad %v4float %c + OpStore %_GLF_color %41 + OpReturn + OpFunctionEnd + %f_ = OpFunction %float None %18 + %42 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_1 + OpBranch %43 + %43 = OpLabel + %8 = OpLoad %int %i + %44 = OpSLessThan %bool %8 %int_10 + OpLoopMerge %45 %46 None + OpBranchConditional %44 %47 %45 + %47 = OpLabel + %9 = OpLoad %int %i + %48 = OpConvertSToF %float %9 + %49 = OpFOrdGreaterThanEqual %bool %48 %float_1 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %46 + %51 = OpLabel + OpReturnValue %float_1 + %50 = OpLabel + OpBranch %46 + %46 = OpLabel + %10 = OpLoad %int %i + %11 = OpIAdd %int %10 %int_1 + OpStore %i %11 + OpBranch %43 + %45 = OpLabel + OpReturnValue %float_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..6ebe635f05 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.hlsl @@ -0,0 +1,50 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float f_() { + int i = 0; + i = 1; + { + for(; (i < 10); i = (i + 1)) { + if ((float(i) >= 1.0f)) { + return 1.0f; + } else { + continue; + } + } + } + return 1.0f; +} + +void main_1() { + float4 c = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i_1 = 0; + c = float4(1.0f, 0.0f, 0.0f, 1.0f); + i_1 = 0; + while (true) { + if ((i_1 < 1)) { + } else { + break; + } + { + const float x_39 = f_(); + c.x = x_39; + i_1 = (i_1 + 1); + } + } + x_GLF_color = c; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..110e1af70e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.msl @@ -0,0 +1,68 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float f_() { + int i = 0; + i = 1; + while (true) { + int const x_8 = i; + if ((x_8 < 10)) { + } else { + break; + } + int const x_9 = i; + if ((float(x_9) >= 1.0f)) { + return 1.0f; + } else { + { + int const x_10 = i; + i = (x_10 + 1); + } + continue; + } + { + int const x_10 = i; + i = (x_10 + 1); + } + } + return 1.0f; +} + +void main_1(thread float4* const tint_symbol_4) { + float4 c = 0.0f; + int i_1 = 0; + c = float4(1.0f, 0.0f, 0.0f, 1.0f); + i_1 = 0; + while (true) { + int const x_12 = i_1; + if ((x_12 < 1)) { + } else { + break; + } + { + float const x_39 = f_(); + c.x = x_39; + int const x_13 = i_1; + i_1 = (x_13 + 1); + } + } + float4 const x_41 = c; + *(tint_symbol_4) = x_41; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b4f0236d3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.spvasm @@ -0,0 +1,135 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %f_ "f_" + OpName %i "i" + OpName %main_1 "main_1" + OpName %c "c" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %8 = OpTypeFunction %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %void = OpTypeVoid + %36 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %63 = OpTypeFunction %void %main_out + %f_ = OpFunction %float None %8 + %10 = OpLabel + %i = OpVariable %_ptr_Function_int Function %14 + OpStore %i %int_1 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %20 = OpLoad %int %i + %22 = OpSLessThan %bool %20 %int_10 + OpSelectionMerge %24 None + OpBranchConditional %22 %25 %26 + %25 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %17 + %24 = OpLabel + %27 = OpLoad %int %i + %28 = OpConvertSToF %float %27 + %30 = OpFOrdGreaterThanEqual %bool %28 %float_1 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + OpReturnValue %float_1 + %33 = OpLabel + OpBranch %18 + %31 = OpLabel + OpBranch %18 + %18 = OpLabel + %34 = OpLoad %int %i + %35 = OpIAdd %int %34 %int_1 + OpStore %i %35 + OpBranch %16 + %17 = OpLabel + OpReturnValue %float_1 + OpFunctionEnd + %main_1 = OpFunction %void None %36 + %39 = OpLabel + %c = OpVariable %_ptr_Function_v4float Function %5 + %i_1 = OpVariable %_ptr_Function_int Function %14 + OpStore %c %44 + OpStore %i_1 %int_0 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %49 + %49 = OpLabel + %50 = OpLoad %int %i_1 + %51 = OpSLessThan %bool %50 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %47 + %52 = OpLabel + OpBranch %48 + %48 = OpLabel + %55 = OpFunctionCall %float %f_ + %59 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %59 %55 + %60 = OpLoad %int %i_1 + %61 = OpIAdd %int %60 %int_1 + OpStore %i_1 %61 + OpBranch %46 + %47 = OpLabel + %62 = OpLoad %v4float %c + OpStore %x_GLF_color %62 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %63 +%tint_symbol = OpFunctionParameter %main_out + %67 = OpLabel + %68 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %68 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %36 + %70 = OpLabel + %71 = OpFunctionCall %void %main_1 + %73 = OpLoad %v4float %x_GLF_color + %74 = OpCompositeConstruct %main_out %73 + %72 = OpFunctionCall %void %tint_symbol_2 %74 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..8e2cc4c114 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.spvasm.expected.wgsl @@ -0,0 +1,60 @@ +var x_GLF_color : vec4; + +fn f_() -> f32 { + var i : i32; + i = 1; + loop { + let x_8 : i32 = i; + if ((x_8 < 10)) { + } else { + break; + } + let x_9 : i32 = i; + if ((f32(x_9) >= 1.0)) { + return 1.0; + } else { + continue; + } + + continuing { + let x_10 : i32 = i; + i = (x_10 + 1); + } + } + return 1.0; +} + +fn main_1() { + var c : vec4; + var i_1 : i32; + c = vec4(1.0, 0.0, 0.0, 1.0); + i_1 = 0; + loop { + let x_12 : i32 = i_1; + if ((x_12 < 1)) { + } else { + break; + } + + continuing { + let x_39 : f32 = f_(); + c.x = x_39; + let x_13 : i32 = i_1; + i_1 = (x_13 + 1); + } + } + let x_41 : vec4 = c; + x_GLF_color = x_41; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl new file mode 100644 index 0000000000..8e2cc4c114 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl @@ -0,0 +1,60 @@ +var x_GLF_color : vec4; + +fn f_() -> f32 { + var i : i32; + i = 1; + loop { + let x_8 : i32 = i; + if ((x_8 < 10)) { + } else { + break; + } + let x_9 : i32 = i; + if ((f32(x_9) >= 1.0)) { + return 1.0; + } else { + continue; + } + + continuing { + let x_10 : i32 = i; + i = (x_10 + 1); + } + } + return 1.0; +} + +fn main_1() { + var c : vec4; + var i_1 : i32; + c = vec4(1.0, 0.0, 0.0, 1.0); + i_1 = 0; + loop { + let x_12 : i32 = i_1; + if ((x_12 < 1)) { + } else { + break; + } + + continuing { + let x_39 : f32 = f_(); + c.x = x_39; + let x_13 : i32 = i_1; + i_1 = (x_13 + 1); + } + } + let x_41 : vec4 = c; + x_GLF_color = x_41; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..6ebe635f05 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.hlsl @@ -0,0 +1,50 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float f_() { + int i = 0; + i = 1; + { + for(; (i < 10); i = (i + 1)) { + if ((float(i) >= 1.0f)) { + return 1.0f; + } else { + continue; + } + } + } + return 1.0f; +} + +void main_1() { + float4 c = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i_1 = 0; + c = float4(1.0f, 0.0f, 0.0f, 1.0f); + i_1 = 0; + while (true) { + if ((i_1 < 1)) { + } else { + break; + } + { + const float x_39 = f_(); + c.x = x_39; + i_1 = (i_1 + 1); + } + } + x_GLF_color = c; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..110e1af70e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.msl @@ -0,0 +1,68 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float f_() { + int i = 0; + i = 1; + while (true) { + int const x_8 = i; + if ((x_8 < 10)) { + } else { + break; + } + int const x_9 = i; + if ((float(x_9) >= 1.0f)) { + return 1.0f; + } else { + { + int const x_10 = i; + i = (x_10 + 1); + } + continue; + } + { + int const x_10 = i; + i = (x_10 + 1); + } + } + return 1.0f; +} + +void main_1(thread float4* const tint_symbol_4) { + float4 c = 0.0f; + int i_1 = 0; + c = float4(1.0f, 0.0f, 0.0f, 1.0f); + i_1 = 0; + while (true) { + int const x_12 = i_1; + if ((x_12 < 1)) { + } else { + break; + } + { + float const x_39 = f_(); + c.x = x_39; + int const x_13 = i_1; + i_1 = (x_13 + 1); + } + } + float4 const x_41 = c; + *(tint_symbol_4) = x_41; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b4f0236d3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.spvasm @@ -0,0 +1,135 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %f_ "f_" + OpName %i "i" + OpName %main_1 "main_1" + OpName %c "c" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %8 = OpTypeFunction %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %void = OpTypeVoid + %36 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %main_out = OpTypeStruct %v4float + %63 = OpTypeFunction %void %main_out + %f_ = OpFunction %float None %8 + %10 = OpLabel + %i = OpVariable %_ptr_Function_int Function %14 + OpStore %i %int_1 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %20 = OpLoad %int %i + %22 = OpSLessThan %bool %20 %int_10 + OpSelectionMerge %24 None + OpBranchConditional %22 %25 %26 + %25 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %17 + %24 = OpLabel + %27 = OpLoad %int %i + %28 = OpConvertSToF %float %27 + %30 = OpFOrdGreaterThanEqual %bool %28 %float_1 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %33 + %32 = OpLabel + OpReturnValue %float_1 + %33 = OpLabel + OpBranch %18 + %31 = OpLabel + OpBranch %18 + %18 = OpLabel + %34 = OpLoad %int %i + %35 = OpIAdd %int %34 %int_1 + OpStore %i %35 + OpBranch %16 + %17 = OpLabel + OpReturnValue %float_1 + OpFunctionEnd + %main_1 = OpFunction %void None %36 + %39 = OpLabel + %c = OpVariable %_ptr_Function_v4float Function %5 + %i_1 = OpVariable %_ptr_Function_int Function %14 + OpStore %c %44 + OpStore %i_1 %int_0 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %49 + %49 = OpLabel + %50 = OpLoad %int %i_1 + %51 = OpSLessThan %bool %50 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %47 + %52 = OpLabel + OpBranch %48 + %48 = OpLabel + %55 = OpFunctionCall %float %f_ + %59 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %59 %55 + %60 = OpLoad %int %i_1 + %61 = OpIAdd %int %60 %int_1 + OpStore %i_1 %61 + OpBranch %46 + %47 = OpLabel + %62 = OpLoad %v4float %c + OpStore %x_GLF_color %62 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %63 +%tint_symbol = OpFunctionParameter %main_out + %67 = OpLabel + %68 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %68 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %36 + %70 = OpLabel + %71 = OpFunctionCall %void %main_1 + %73 = OpLoad %v4float %x_GLF_color + %74 = OpCompositeConstruct %main_out %73 + %72 = OpFunctionCall %void %tint_symbol_2 %74 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e2cc4c114 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-in-loop-in-function/0-opt.wgsl.expected.wgsl @@ -0,0 +1,60 @@ +var x_GLF_color : vec4; + +fn f_() -> f32 { + var i : i32; + i = 1; + loop { + let x_8 : i32 = i; + if ((x_8 < 10)) { + } else { + break; + } + let x_9 : i32 = i; + if ((f32(x_9) >= 1.0)) { + return 1.0; + } else { + continue; + } + + continuing { + let x_10 : i32 = i; + i = (x_10 + 1); + } + } + return 1.0; +} + +fn main_1() { + var c : vec4; + var i_1 : i32; + c = vec4(1.0, 0.0, 0.0, 1.0); + i_1 = 0; + loop { + let x_12 : i32 = i_1; + if ((x_12 < 1)) { + } else { + break; + } + + continuing { + let x_39 : f32 = f_(); + c.x = x_39; + let x_13 : i32 = i_1; + i_1 = (x_13 + 1); + } + } + let x_41 : vec4 = c; + x_GLF_color = x_41; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm new file mode 100644 index 0000000000..adc2dd25a7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm @@ -0,0 +1,130 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %GLF_live4drawShape_ "GLF_live4drawShape(" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %i RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %13 = OpTypeFunction %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %29 = OpUndef %v3float + %30 = OpUndef %int + %31 = OpUndef %bool + %32 = OpUndef %v3float + %33 = OpUndef %int + %34 = OpUndef %bool + %main = OpFunction %void None %10 + %35 = OpLabel + %36 = OpVariable %_ptr_Function_bool Function %false + %37 = OpVariable %_ptr_Function_v3float Function + %6 = OpVariable %_ptr_Function_int Function + %38 = OpVariable %_ptr_Function_v3float Function + OpStore %_GLF_color %24 + OpStore %36 %false + OpBranch %39 + %39 = OpLabel + %40 = OpPhi %bool %false %35 %31 %41 + OpLoopMerge %42 %41 None + OpBranch %43 + %43 = OpLabel + OpStore %6 %int_0 + OpBranch %44 + %44 = OpLabel + %45 = OpPhi %bool %40 %43 %31 %46 + %7 = OpPhi %int %int_0 %43 %30 %46 + OpLoopMerge %47 %46 None + OpBranch %48 + %48 = OpLabel + %49 = OpSLessThan %bool %7 %int_0 + OpBranchConditional %49 %50 %47 + %50 = OpLabel + OpStore %36 %true + OpStore %37 %19 + OpBranch %47 + %46 = OpLabel + OpBranch %44 + %47 = OpLabel + %51 = OpPhi %v3float %29 %48 %19 %50 + %52 = OpPhi %bool %45 %48 %true %50 + OpSelectionMerge %53 None + OpBranchConditional %52 %42 %53 + %53 = OpLabel + %54 = OpUndef %v3float + OpStore %36 %true + OpBranch %42 + %41 = OpLabel + OpBranch %39 + %42 = OpLabel + %55 = OpPhi %v3float %51 %47 %54 %53 + OpStore %38 %55 + OpReturn + OpFunctionEnd +%GLF_live4drawShape_ = OpFunction %v3float None %13 + %56 = OpLabel + %57 = OpVariable %_ptr_Function_bool Function %false + %58 = OpVariable %_ptr_Function_v3float Function + %i = OpVariable %_ptr_Function_int Function + OpBranch %59 + %59 = OpLabel + %60 = OpPhi %bool %false %56 %34 %61 + OpLoopMerge %62 %61 None + OpBranch %63 + %63 = OpLabel + OpStore %i %int_0 + OpBranch %64 + %64 = OpLabel + %65 = OpPhi %bool %60 %63 %34 %66 + %8 = OpPhi %int %int_0 %63 %33 %66 + OpLoopMerge %67 %66 None + OpBranch %68 + %68 = OpLabel + %69 = OpSLessThan %bool %8 %int_0 + OpBranchConditional %69 %70 %67 + %70 = OpLabel + OpStore %57 %true + OpStore %58 %19 + OpBranch %67 + %66 = OpLabel + OpBranch %64 + %67 = OpLabel + %71 = OpPhi %v3float %32 %68 %19 %70 + %72 = OpPhi %bool %65 %68 %true %70 + OpSelectionMerge %73 None + OpBranchConditional %72 %62 %73 + %73 = OpLabel + %74 = OpUndef %v3float + OpStore %57 %true + OpBranch %62 + %61 = OpLabel + OpBranch %59 + %62 = OpLabel + %75 = OpPhi %v3float %71 %67 %74 %73 + OpReturnValue %75 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..3c94412150 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.hlsl @@ -0,0 +1,129 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_36 = false; + float3 x_37 = float3(0.0f, 0.0f, 0.0f); + int x_6 = 0; + float3 x_38 = float3(0.0f, 0.0f, 0.0f); + float3 x_51 = float3(0.0f, 0.0f, 0.0f); + float3 x_54 = float3(0.0f, 0.0f, 0.0f); + bool x_40_phi = false; + float3 x_55_phi = float3(0.0f, 0.0f, 0.0f); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_36 = false; + x_40_phi = false; + while (true) { + bool x_45 = false; + bool x_45_phi = false; + int x_7_phi = 0; + float3 x_51_phi = float3(0.0f, 0.0f, 0.0f); + bool x_52_phi = false; + const bool x_40 = x_40_phi; + x_6 = 0; + x_45_phi = x_40; + x_7_phi = 0; + while (true) { + x_45 = x_45_phi; + const int x_7 = x_7_phi; + x_51_phi = float3(0.0f, 0.0f, 0.0f); + x_52_phi = x_45; + if ((x_7 < 0)) { + } else { + break; + } + x_36 = true; + x_37 = float3(1.0f, 1.0f, 1.0f); + x_51_phi = float3(1.0f, 1.0f, 1.0f); + x_52_phi = true; + break; + { + x_45_phi = false; + x_7_phi = 0; + } + } + x_51 = x_51_phi; + const bool x_52 = x_52_phi; + x_55_phi = x_51; + if (x_52) { + break; + } + x_54 = float3(0.0f, 0.0f, 0.0f); + x_36 = true; + x_55_phi = x_54; + break; + { + x_40_phi = false; + } + } + x_38 = x_55_phi; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} + +float3 GLF_live4drawShape_() { + bool x_57 = false; + float3 x_58 = float3(0.0f, 0.0f, 0.0f); + int i = 0; + float3 x_71 = float3(0.0f, 0.0f, 0.0f); + float3 x_74 = float3(0.0f, 0.0f, 0.0f); + bool x_60_phi = false; + float3 x_75_phi = float3(0.0f, 0.0f, 0.0f); + x_60_phi = false; + while (true) { + bool x_65 = false; + bool x_65_phi = false; + int x_8_phi = 0; + float3 x_71_phi = float3(0.0f, 0.0f, 0.0f); + bool x_72_phi = false; + const bool x_60 = x_60_phi; + i = 0; + x_65_phi = x_60; + x_8_phi = 0; + while (true) { + x_65 = x_65_phi; + const int x_8 = x_8_phi; + x_71_phi = float3(0.0f, 0.0f, 0.0f); + x_72_phi = x_65; + if ((x_8 < 0)) { + } else { + break; + } + x_57 = true; + x_58 = float3(1.0f, 1.0f, 1.0f); + x_71_phi = float3(1.0f, 1.0f, 1.0f); + x_72_phi = true; + break; + { + x_65_phi = false; + x_8_phi = 0; + } + } + x_71 = x_71_phi; + const bool x_72 = x_72_phi; + x_75_phi = x_71; + if (x_72) { + break; + } + x_74 = float3(0.0f, 0.0f, 0.0f); + x_57 = true; + x_75_phi = x_74; + break; + { + x_60_phi = false; + } + } + return x_75_phi; +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.msl new file mode 100644 index 0000000000..75d8b9b1ae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.msl @@ -0,0 +1,134 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool x_36 = false; + float3 x_37 = 0.0f; + int x_6 = 0; + float3 x_38 = 0.0f; + float3 x_51 = 0.0f; + float3 x_54 = 0.0f; + bool x_40_phi = false; + float3 x_55_phi = 0.0f; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_36 = false; + x_40_phi = false; + while (true) { + bool x_45 = false; + bool x_45_phi = false; + int x_7_phi = 0; + float3 x_51_phi = 0.0f; + bool x_52_phi = false; + bool const x_40 = x_40_phi; + x_6 = 0; + x_45_phi = x_40; + x_7_phi = 0; + while (true) { + x_45 = x_45_phi; + int const x_7 = x_7_phi; + x_51_phi = float3(0.0f, 0.0f, 0.0f); + x_52_phi = x_45; + if ((x_7 < 0)) { + } else { + break; + } + x_36 = true; + x_37 = float3(1.0f, 1.0f, 1.0f); + x_51_phi = float3(1.0f, 1.0f, 1.0f); + x_52_phi = true; + break; + { + x_45_phi = false; + x_7_phi = 0; + } + } + x_51 = x_51_phi; + bool const x_52 = x_52_phi; + x_55_phi = x_51; + if (x_52) { + break; + } + x_54 = float3(0.0f, 0.0f, 0.0f); + x_36 = true; + x_55_phi = x_54; + break; + { + x_40_phi = false; + } + } + float3 const x_55 = x_55_phi; + x_38 = x_55; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +float3 GLF_live4drawShape_() { + bool x_57 = false; + float3 x_58 = 0.0f; + int i = 0; + float3 x_71 = 0.0f; + float3 x_74 = 0.0f; + bool x_60_phi = false; + float3 x_75_phi = 0.0f; + x_60_phi = false; + while (true) { + bool x_65 = false; + bool x_65_phi = false; + int x_8_phi = 0; + float3 x_71_phi = 0.0f; + bool x_72_phi = false; + bool const x_60 = x_60_phi; + i = 0; + x_65_phi = x_60; + x_8_phi = 0; + while (true) { + x_65 = x_65_phi; + int const x_8 = x_8_phi; + x_71_phi = float3(0.0f, 0.0f, 0.0f); + x_72_phi = x_65; + if ((x_8 < 0)) { + } else { + break; + } + x_57 = true; + x_58 = float3(1.0f, 1.0f, 1.0f); + x_71_phi = float3(1.0f, 1.0f, 1.0f); + x_72_phi = true; + break; + { + x_65_phi = false; + x_8_phi = 0; + } + } + x_71 = x_71_phi; + bool const x_72 = x_72_phi; + x_75_phi = x_71; + if (x_72) { + break; + } + x_74 = float3(0.0f, 0.0f, 0.0f); + x_57 = true; + x_75_phi = x_74; + break; + { + x_60_phi = false; + } + } + float3 const x_75 = x_75_phi; + return x_75; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..9396999ca5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.spvasm @@ -0,0 +1,245 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 115 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_36 "x_36" + OpName %x_37 "x_37" + OpName %x_6 "x_6" + OpName %x_38 "x_38" + OpName %x_51 "x_51" + OpName %x_54 "x_54" + OpName %x_40_phi "x_40_phi" + OpName %x_55_phi "x_55_phi" + OpName %x_45 "x_45" + OpName %x_45_phi "x_45_phi" + OpName %x_7_phi "x_7_phi" + OpName %x_51_phi "x_51_phi" + OpName %x_52_phi "x_52_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %GLF_live4drawShape_ "GLF_live4drawShape_" + OpName %x_57 "x_57" + OpName %x_58 "x_58" + OpName %i "i" + OpName %x_71 "x_71" + OpName %x_74 "x_74" + OpName %x_60_phi "x_60_phi" + OpName %x_75_phi "x_75_phi" + OpName %x_65 "x_65" + OpName %x_65_phi "x_65_phi" + OpName %x_8_phi "x_8_phi" + OpName %x_71_phi "x_71_phi" + OpName %x_72_phi "x_72_phi" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %16 = OpConstantNull %bool + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %50 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %true = OpConstantTrue %bool + %57 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %77 = OpTypeFunction %v3float + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %x_36 = OpVariable %_ptr_Function_bool Function %16 + %x_37 = OpVariable %_ptr_Function_v3float Function %20 + %x_6 = OpVariable %_ptr_Function_int Function %24 + %x_38 = OpVariable %_ptr_Function_v3float Function %20 + %x_51 = OpVariable %_ptr_Function_v3float Function %20 + %x_54 = OpVariable %_ptr_Function_v3float Function %20 + %x_40_phi = OpVariable %_ptr_Function_bool Function %16 + %x_55_phi = OpVariable %_ptr_Function_v3float Function %20 + %x_45 = OpVariable %_ptr_Function_bool Function %16 + %x_45_phi = OpVariable %_ptr_Function_bool Function %16 + %x_7_phi = OpVariable %_ptr_Function_int Function %24 + %x_51_phi = OpVariable %_ptr_Function_v3float Function %20 + %x_52_phi = OpVariable %_ptr_Function_bool Function %16 + OpStore %x_36 %false + OpStore %x_GLF_color %32 + OpStore %x_36 %false + OpStore %x_40_phi %false + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %42 = OpLoad %bool %x_40_phi + OpStore %x_6 %int_0 + OpStore %x_45_phi %42 + OpStore %x_7_phi %int_0 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %bool %x_45_phi + OpStore %x_45 %48 + %49 = OpLoad %int %x_7_phi + OpStore %x_51_phi %50 + %51 = OpLoad %bool %x_45 + OpStore %x_52_phi %51 + %52 = OpSLessThan %bool %49 %int_0 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + OpBranch %53 + %55 = OpLabel + OpBranch %45 + %53 = OpLabel + OpStore %x_36 %true + OpStore %x_37 %57 + OpStore %x_51_phi %57 + OpStore %x_52_phi %true + OpBranch %45 + %46 = OpLabel + OpStore %x_45_phi %false + OpStore %x_7_phi %int_0 + OpBranch %44 + %45 = OpLabel + %58 = OpLoad %v3float %x_51_phi + OpStore %x_51 %58 + %59 = OpLoad %bool %x_52_phi + %60 = OpLoad %v3float %x_51 + OpStore %x_55_phi %60 + OpSelectionMerge %61 None + OpBranchConditional %59 %62 %61 + %62 = OpLabel + OpBranch %34 + %61 = OpLabel + OpStore %x_54 %50 + OpStore %x_36 %true + %63 = OpLoad %v3float %x_54 + OpStore %x_55_phi %63 + OpBranch %34 + %35 = OpLabel + OpStore %x_40_phi %false + OpBranch %33 + %34 = OpLabel + %64 = OpLoad %v3float %x_55_phi + OpStore %x_38 %64 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %65 +%tint_symbol = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %72 = OpLabel + %73 = OpFunctionCall %void %main_1 + %75 = OpLoad %v4float %x_GLF_color + %76 = OpCompositeConstruct %main_out %75 + %74 = OpFunctionCall %void %tint_symbol_2 %76 + OpReturn + OpFunctionEnd +%GLF_live4drawShape_ = OpFunction %v3float None %77 + %79 = OpLabel + %x_57 = OpVariable %_ptr_Function_bool Function %16 + %x_58 = OpVariable %_ptr_Function_v3float Function %20 + %i = OpVariable %_ptr_Function_int Function %24 + %x_71 = OpVariable %_ptr_Function_v3float Function %20 + %x_74 = OpVariable %_ptr_Function_v3float Function %20 + %x_60_phi = OpVariable %_ptr_Function_bool Function %16 + %x_75_phi = OpVariable %_ptr_Function_v3float Function %20 + %x_65 = OpVariable %_ptr_Function_bool Function %16 + %x_65_phi = OpVariable %_ptr_Function_bool Function %16 + %x_8_phi = OpVariable %_ptr_Function_int Function %24 + %x_71_phi = OpVariable %_ptr_Function_v3float Function %20 + %x_72_phi = OpVariable %_ptr_Function_bool Function %16 + OpStore %x_57 %false + OpStore %x_60_phi %false + OpBranch %87 + %87 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %96 = OpLoad %bool %x_60_phi + OpStore %i %int_0 + OpStore %x_65_phi %96 + OpStore %x_8_phi %int_0 + OpBranch %97 + %97 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %101 = OpLoad %bool %x_65_phi + OpStore %x_65 %101 + %102 = OpLoad %int %x_8_phi + OpStore %x_71_phi %50 + %103 = OpLoad %bool %x_65 + OpStore %x_72_phi %103 + %104 = OpSLessThan %bool %102 %int_0 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %107 + %106 = OpLabel + OpBranch %105 + %107 = OpLabel + OpBranch %98 + %105 = OpLabel + OpStore %x_57 %true + OpStore %x_58 %57 + OpStore %x_71_phi %57 + OpStore %x_72_phi %true + OpBranch %98 + %99 = OpLabel + OpStore %x_65_phi %false + OpStore %x_8_phi %int_0 + OpBranch %97 + %98 = OpLabel + %108 = OpLoad %v3float %x_71_phi + OpStore %x_71 %108 + %109 = OpLoad %bool %x_72_phi + %110 = OpLoad %v3float %x_71 + OpStore %x_75_phi %110 + OpSelectionMerge %111 None + OpBranchConditional %109 %112 %111 + %112 = OpLabel + OpBranch %88 + %111 = OpLabel + OpStore %x_74 %50 + OpStore %x_57 %true + %113 = OpLoad %v3float %x_74 + OpStore %x_75_phi %113 + OpBranch %88 + %89 = OpLabel + OpStore %x_60_phi %false + OpBranch %87 + %88 = OpLabel + %114 = OpLoad %v3float %x_75_phi + OpReturnValue %114 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..def43264d0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.spvasm.expected.wgsl @@ -0,0 +1,132 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : bool = false; + var x_37 : vec3; + var x_6 : i32; + var x_38 : vec3; + var x_51 : vec3; + var x_54 : vec3; + var x_40_phi : bool; + var x_55_phi : vec3; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_36 = false; + x_40_phi = false; + loop { + var x_45 : bool; + var x_45_phi : bool; + var x_7_phi : i32; + var x_51_phi : vec3; + var x_52_phi : bool; + let x_40 : bool = x_40_phi; + x_6 = 0; + x_45_phi = x_40; + x_7_phi = 0; + loop { + x_45 = x_45_phi; + let x_7 : i32 = x_7_phi; + x_51_phi = vec3(0.0, 0.0, 0.0); + x_52_phi = x_45; + if ((x_7 < 0)) { + } else { + break; + } + x_36 = true; + x_37 = vec3(1.0, 1.0, 1.0); + x_51_phi = vec3(1.0, 1.0, 1.0); + x_52_phi = true; + break; + + continuing { + x_45_phi = false; + x_7_phi = 0; + } + } + x_51 = x_51_phi; + let x_52 : bool = x_52_phi; + x_55_phi = x_51; + if (x_52) { + break; + } + x_54 = vec3(0.0, 0.0, 0.0); + x_36 = true; + x_55_phi = x_54; + break; + + continuing { + x_40_phi = false; + } + } + let x_55 : vec3 = x_55_phi; + x_38 = x_55; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn GLF_live4drawShape_() -> vec3 { + var x_57 : bool = false; + var x_58 : vec3; + var i : i32; + var x_71 : vec3; + var x_74 : vec3; + var x_60_phi : bool; + var x_75_phi : vec3; + x_60_phi = false; + loop { + var x_65 : bool; + var x_65_phi : bool; + var x_8_phi : i32; + var x_71_phi : vec3; + var x_72_phi : bool; + let x_60 : bool = x_60_phi; + i = 0; + x_65_phi = x_60; + x_8_phi = 0; + loop { + x_65 = x_65_phi; + let x_8 : i32 = x_8_phi; + x_71_phi = vec3(0.0, 0.0, 0.0); + x_72_phi = x_65; + if ((x_8 < 0)) { + } else { + break; + } + x_57 = true; + x_58 = vec3(1.0, 1.0, 1.0); + x_71_phi = vec3(1.0, 1.0, 1.0); + x_72_phi = true; + break; + + continuing { + x_65_phi = false; + x_8_phi = 0; + } + } + x_71 = x_71_phi; + let x_72 : bool = x_72_phi; + x_75_phi = x_71; + if (x_72) { + break; + } + x_74 = vec3(0.0, 0.0, 0.0); + x_57 = true; + x_75_phi = x_74; + break; + + continuing { + x_60_phi = false; + } + } + let x_75 : vec3 = x_75_phi; + return x_75; +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl new file mode 100644 index 0000000000..def43264d0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl @@ -0,0 +1,132 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : bool = false; + var x_37 : vec3; + var x_6 : i32; + var x_38 : vec3; + var x_51 : vec3; + var x_54 : vec3; + var x_40_phi : bool; + var x_55_phi : vec3; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_36 = false; + x_40_phi = false; + loop { + var x_45 : bool; + var x_45_phi : bool; + var x_7_phi : i32; + var x_51_phi : vec3; + var x_52_phi : bool; + let x_40 : bool = x_40_phi; + x_6 = 0; + x_45_phi = x_40; + x_7_phi = 0; + loop { + x_45 = x_45_phi; + let x_7 : i32 = x_7_phi; + x_51_phi = vec3(0.0, 0.0, 0.0); + x_52_phi = x_45; + if ((x_7 < 0)) { + } else { + break; + } + x_36 = true; + x_37 = vec3(1.0, 1.0, 1.0); + x_51_phi = vec3(1.0, 1.0, 1.0); + x_52_phi = true; + break; + + continuing { + x_45_phi = false; + x_7_phi = 0; + } + } + x_51 = x_51_phi; + let x_52 : bool = x_52_phi; + x_55_phi = x_51; + if (x_52) { + break; + } + x_54 = vec3(0.0, 0.0, 0.0); + x_36 = true; + x_55_phi = x_54; + break; + + continuing { + x_40_phi = false; + } + } + let x_55 : vec3 = x_55_phi; + x_38 = x_55; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn GLF_live4drawShape_() -> vec3 { + var x_57 : bool = false; + var x_58 : vec3; + var i : i32; + var x_71 : vec3; + var x_74 : vec3; + var x_60_phi : bool; + var x_75_phi : vec3; + x_60_phi = false; + loop { + var x_65 : bool; + var x_65_phi : bool; + var x_8_phi : i32; + var x_71_phi : vec3; + var x_72_phi : bool; + let x_60 : bool = x_60_phi; + i = 0; + x_65_phi = x_60; + x_8_phi = 0; + loop { + x_65 = x_65_phi; + let x_8 : i32 = x_8_phi; + x_71_phi = vec3(0.0, 0.0, 0.0); + x_72_phi = x_65; + if ((x_8 < 0)) { + } else { + break; + } + x_57 = true; + x_58 = vec3(1.0, 1.0, 1.0); + x_71_phi = vec3(1.0, 1.0, 1.0); + x_72_phi = true; + break; + + continuing { + x_65_phi = false; + x_8_phi = 0; + } + } + x_71 = x_71_phi; + let x_72 : bool = x_72_phi; + x_75_phi = x_71; + if (x_72) { + break; + } + x_74 = vec3(0.0, 0.0, 0.0); + x_57 = true; + x_75_phi = x_74; + break; + + continuing { + x_60_phi = false; + } + } + let x_75 : vec3 = x_75_phi; + return x_75; +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..3c94412150 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.hlsl @@ -0,0 +1,129 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_36 = false; + float3 x_37 = float3(0.0f, 0.0f, 0.0f); + int x_6 = 0; + float3 x_38 = float3(0.0f, 0.0f, 0.0f); + float3 x_51 = float3(0.0f, 0.0f, 0.0f); + float3 x_54 = float3(0.0f, 0.0f, 0.0f); + bool x_40_phi = false; + float3 x_55_phi = float3(0.0f, 0.0f, 0.0f); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_36 = false; + x_40_phi = false; + while (true) { + bool x_45 = false; + bool x_45_phi = false; + int x_7_phi = 0; + float3 x_51_phi = float3(0.0f, 0.0f, 0.0f); + bool x_52_phi = false; + const bool x_40 = x_40_phi; + x_6 = 0; + x_45_phi = x_40; + x_7_phi = 0; + while (true) { + x_45 = x_45_phi; + const int x_7 = x_7_phi; + x_51_phi = float3(0.0f, 0.0f, 0.0f); + x_52_phi = x_45; + if ((x_7 < 0)) { + } else { + break; + } + x_36 = true; + x_37 = float3(1.0f, 1.0f, 1.0f); + x_51_phi = float3(1.0f, 1.0f, 1.0f); + x_52_phi = true; + break; + { + x_45_phi = false; + x_7_phi = 0; + } + } + x_51 = x_51_phi; + const bool x_52 = x_52_phi; + x_55_phi = x_51; + if (x_52) { + break; + } + x_54 = float3(0.0f, 0.0f, 0.0f); + x_36 = true; + x_55_phi = x_54; + break; + { + x_40_phi = false; + } + } + x_38 = x_55_phi; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} + +float3 GLF_live4drawShape_() { + bool x_57 = false; + float3 x_58 = float3(0.0f, 0.0f, 0.0f); + int i = 0; + float3 x_71 = float3(0.0f, 0.0f, 0.0f); + float3 x_74 = float3(0.0f, 0.0f, 0.0f); + bool x_60_phi = false; + float3 x_75_phi = float3(0.0f, 0.0f, 0.0f); + x_60_phi = false; + while (true) { + bool x_65 = false; + bool x_65_phi = false; + int x_8_phi = 0; + float3 x_71_phi = float3(0.0f, 0.0f, 0.0f); + bool x_72_phi = false; + const bool x_60 = x_60_phi; + i = 0; + x_65_phi = x_60; + x_8_phi = 0; + while (true) { + x_65 = x_65_phi; + const int x_8 = x_8_phi; + x_71_phi = float3(0.0f, 0.0f, 0.0f); + x_72_phi = x_65; + if ((x_8 < 0)) { + } else { + break; + } + x_57 = true; + x_58 = float3(1.0f, 1.0f, 1.0f); + x_71_phi = float3(1.0f, 1.0f, 1.0f); + x_72_phi = true; + break; + { + x_65_phi = false; + x_8_phi = 0; + } + } + x_71 = x_71_phi; + const bool x_72 = x_72_phi; + x_75_phi = x_71; + if (x_72) { + break; + } + x_74 = float3(0.0f, 0.0f, 0.0f); + x_57 = true; + x_75_phi = x_74; + break; + { + x_60_phi = false; + } + } + return x_75_phi; +} diff --git a/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.msl new file mode 100644 index 0000000000..75d8b9b1ae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.msl @@ -0,0 +1,134 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool x_36 = false; + float3 x_37 = 0.0f; + int x_6 = 0; + float3 x_38 = 0.0f; + float3 x_51 = 0.0f; + float3 x_54 = 0.0f; + bool x_40_phi = false; + float3 x_55_phi = 0.0f; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_36 = false; + x_40_phi = false; + while (true) { + bool x_45 = false; + bool x_45_phi = false; + int x_7_phi = 0; + float3 x_51_phi = 0.0f; + bool x_52_phi = false; + bool const x_40 = x_40_phi; + x_6 = 0; + x_45_phi = x_40; + x_7_phi = 0; + while (true) { + x_45 = x_45_phi; + int const x_7 = x_7_phi; + x_51_phi = float3(0.0f, 0.0f, 0.0f); + x_52_phi = x_45; + if ((x_7 < 0)) { + } else { + break; + } + x_36 = true; + x_37 = float3(1.0f, 1.0f, 1.0f); + x_51_phi = float3(1.0f, 1.0f, 1.0f); + x_52_phi = true; + break; + { + x_45_phi = false; + x_7_phi = 0; + } + } + x_51 = x_51_phi; + bool const x_52 = x_52_phi; + x_55_phi = x_51; + if (x_52) { + break; + } + x_54 = float3(0.0f, 0.0f, 0.0f); + x_36 = true; + x_55_phi = x_54; + break; + { + x_40_phi = false; + } + } + float3 const x_55 = x_55_phi; + x_38 = x_55; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + +float3 GLF_live4drawShape_() { + bool x_57 = false; + float3 x_58 = 0.0f; + int i = 0; + float3 x_71 = 0.0f; + float3 x_74 = 0.0f; + bool x_60_phi = false; + float3 x_75_phi = 0.0f; + x_60_phi = false; + while (true) { + bool x_65 = false; + bool x_65_phi = false; + int x_8_phi = 0; + float3 x_71_phi = 0.0f; + bool x_72_phi = false; + bool const x_60 = x_60_phi; + i = 0; + x_65_phi = x_60; + x_8_phi = 0; + while (true) { + x_65 = x_65_phi; + int const x_8 = x_8_phi; + x_71_phi = float3(0.0f, 0.0f, 0.0f); + x_72_phi = x_65; + if ((x_8 < 0)) { + } else { + break; + } + x_57 = true; + x_58 = float3(1.0f, 1.0f, 1.0f); + x_71_phi = float3(1.0f, 1.0f, 1.0f); + x_72_phi = true; + break; + { + x_65_phi = false; + x_8_phi = 0; + } + } + x_71 = x_71_phi; + bool const x_72 = x_72_phi; + x_75_phi = x_71; + if (x_72) { + break; + } + x_74 = float3(0.0f, 0.0f, 0.0f); + x_57 = true; + x_75_phi = x_74; + break; + { + x_60_phi = false; + } + } + float3 const x_75 = x_75_phi; + return x_75; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..9396999ca5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.spvasm @@ -0,0 +1,245 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 115 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_36 "x_36" + OpName %x_37 "x_37" + OpName %x_6 "x_6" + OpName %x_38 "x_38" + OpName %x_51 "x_51" + OpName %x_54 "x_54" + OpName %x_40_phi "x_40_phi" + OpName %x_55_phi "x_55_phi" + OpName %x_45 "x_45" + OpName %x_45_phi "x_45_phi" + OpName %x_7_phi "x_7_phi" + OpName %x_51_phi "x_51_phi" + OpName %x_52_phi "x_52_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpName %GLF_live4drawShape_ "GLF_live4drawShape_" + OpName %x_57 "x_57" + OpName %x_58 "x_58" + OpName %i "i" + OpName %x_71 "x_71" + OpName %x_74 "x_74" + OpName %x_60_phi "x_60_phi" + OpName %x_75_phi "x_75_phi" + OpName %x_65 "x_65" + OpName %x_65_phi "x_65_phi" + OpName %x_8_phi "x_8_phi" + OpName %x_71_phi "x_71_phi" + OpName %x_72_phi "x_72_phi" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %16 = OpConstantNull %bool + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %20 = OpConstantNull %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %50 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %true = OpConstantTrue %bool + %57 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %77 = OpTypeFunction %v3float + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %x_36 = OpVariable %_ptr_Function_bool Function %16 + %x_37 = OpVariable %_ptr_Function_v3float Function %20 + %x_6 = OpVariable %_ptr_Function_int Function %24 + %x_38 = OpVariable %_ptr_Function_v3float Function %20 + %x_51 = OpVariable %_ptr_Function_v3float Function %20 + %x_54 = OpVariable %_ptr_Function_v3float Function %20 + %x_40_phi = OpVariable %_ptr_Function_bool Function %16 + %x_55_phi = OpVariable %_ptr_Function_v3float Function %20 + %x_45 = OpVariable %_ptr_Function_bool Function %16 + %x_45_phi = OpVariable %_ptr_Function_bool Function %16 + %x_7_phi = OpVariable %_ptr_Function_int Function %24 + %x_51_phi = OpVariable %_ptr_Function_v3float Function %20 + %x_52_phi = OpVariable %_ptr_Function_bool Function %16 + OpStore %x_36 %false + OpStore %x_GLF_color %32 + OpStore %x_36 %false + OpStore %x_40_phi %false + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %42 = OpLoad %bool %x_40_phi + OpStore %x_6 %int_0 + OpStore %x_45_phi %42 + OpStore %x_7_phi %int_0 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %bool %x_45_phi + OpStore %x_45 %48 + %49 = OpLoad %int %x_7_phi + OpStore %x_51_phi %50 + %51 = OpLoad %bool %x_45 + OpStore %x_52_phi %51 + %52 = OpSLessThan %bool %49 %int_0 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + OpBranch %53 + %55 = OpLabel + OpBranch %45 + %53 = OpLabel + OpStore %x_36 %true + OpStore %x_37 %57 + OpStore %x_51_phi %57 + OpStore %x_52_phi %true + OpBranch %45 + %46 = OpLabel + OpStore %x_45_phi %false + OpStore %x_7_phi %int_0 + OpBranch %44 + %45 = OpLabel + %58 = OpLoad %v3float %x_51_phi + OpStore %x_51 %58 + %59 = OpLoad %bool %x_52_phi + %60 = OpLoad %v3float %x_51 + OpStore %x_55_phi %60 + OpSelectionMerge %61 None + OpBranchConditional %59 %62 %61 + %62 = OpLabel + OpBranch %34 + %61 = OpLabel + OpStore %x_54 %50 + OpStore %x_36 %true + %63 = OpLoad %v3float %x_54 + OpStore %x_55_phi %63 + OpBranch %34 + %35 = OpLabel + OpStore %x_40_phi %false + OpBranch %33 + %34 = OpLabel + %64 = OpLoad %v3float %x_55_phi + OpStore %x_38 %64 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %65 +%tint_symbol = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %72 = OpLabel + %73 = OpFunctionCall %void %main_1 + %75 = OpLoad %v4float %x_GLF_color + %76 = OpCompositeConstruct %main_out %75 + %74 = OpFunctionCall %void %tint_symbol_2 %76 + OpReturn + OpFunctionEnd +%GLF_live4drawShape_ = OpFunction %v3float None %77 + %79 = OpLabel + %x_57 = OpVariable %_ptr_Function_bool Function %16 + %x_58 = OpVariable %_ptr_Function_v3float Function %20 + %i = OpVariable %_ptr_Function_int Function %24 + %x_71 = OpVariable %_ptr_Function_v3float Function %20 + %x_74 = OpVariable %_ptr_Function_v3float Function %20 + %x_60_phi = OpVariable %_ptr_Function_bool Function %16 + %x_75_phi = OpVariable %_ptr_Function_v3float Function %20 + %x_65 = OpVariable %_ptr_Function_bool Function %16 + %x_65_phi = OpVariable %_ptr_Function_bool Function %16 + %x_8_phi = OpVariable %_ptr_Function_int Function %24 + %x_71_phi = OpVariable %_ptr_Function_v3float Function %20 + %x_72_phi = OpVariable %_ptr_Function_bool Function %16 + OpStore %x_57 %false + OpStore %x_60_phi %false + OpBranch %87 + %87 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %96 = OpLoad %bool %x_60_phi + OpStore %i %int_0 + OpStore %x_65_phi %96 + OpStore %x_8_phi %int_0 + OpBranch %97 + %97 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %101 = OpLoad %bool %x_65_phi + OpStore %x_65 %101 + %102 = OpLoad %int %x_8_phi + OpStore %x_71_phi %50 + %103 = OpLoad %bool %x_65 + OpStore %x_72_phi %103 + %104 = OpSLessThan %bool %102 %int_0 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %107 + %106 = OpLabel + OpBranch %105 + %107 = OpLabel + OpBranch %98 + %105 = OpLabel + OpStore %x_57 %true + OpStore %x_58 %57 + OpStore %x_71_phi %57 + OpStore %x_72_phi %true + OpBranch %98 + %99 = OpLabel + OpStore %x_65_phi %false + OpStore %x_8_phi %int_0 + OpBranch %97 + %98 = OpLabel + %108 = OpLoad %v3float %x_71_phi + OpStore %x_71 %108 + %109 = OpLoad %bool %x_72_phi + %110 = OpLoad %v3float %x_71 + OpStore %x_75_phi %110 + OpSelectionMerge %111 None + OpBranchConditional %109 %112 %111 + %112 = OpLabel + OpBranch %88 + %111 = OpLabel + OpStore %x_74 %50 + OpStore %x_57 %true + %113 = OpLoad %v3float %x_74 + OpStore %x_75_phi %113 + OpBranch %88 + %89 = OpLabel + OpStore %x_60_phi %false + OpBranch %87 + %88 = OpLabel + %114 = OpLoad %v3float %x_75_phi + OpReturnValue %114 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..def43264d0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/return-inside-loop-in-function/0.wgsl.expected.wgsl @@ -0,0 +1,132 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : bool = false; + var x_37 : vec3; + var x_6 : i32; + var x_38 : vec3; + var x_51 : vec3; + var x_54 : vec3; + var x_40_phi : bool; + var x_55_phi : vec3; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_36 = false; + x_40_phi = false; + loop { + var x_45 : bool; + var x_45_phi : bool; + var x_7_phi : i32; + var x_51_phi : vec3; + var x_52_phi : bool; + let x_40 : bool = x_40_phi; + x_6 = 0; + x_45_phi = x_40; + x_7_phi = 0; + loop { + x_45 = x_45_phi; + let x_7 : i32 = x_7_phi; + x_51_phi = vec3(0.0, 0.0, 0.0); + x_52_phi = x_45; + if ((x_7 < 0)) { + } else { + break; + } + x_36 = true; + x_37 = vec3(1.0, 1.0, 1.0); + x_51_phi = vec3(1.0, 1.0, 1.0); + x_52_phi = true; + break; + + continuing { + x_45_phi = false; + x_7_phi = 0; + } + } + x_51 = x_51_phi; + let x_52 : bool = x_52_phi; + x_55_phi = x_51; + if (x_52) { + break; + } + x_54 = vec3(0.0, 0.0, 0.0); + x_36 = true; + x_55_phi = x_54; + break; + + continuing { + x_40_phi = false; + } + } + let x_55 : vec3 = x_55_phi; + x_38 = x_55; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} + +fn GLF_live4drawShape_() -> vec3 { + var x_57 : bool = false; + var x_58 : vec3; + var i : i32; + var x_71 : vec3; + var x_74 : vec3; + var x_60_phi : bool; + var x_75_phi : vec3; + x_60_phi = false; + loop { + var x_65 : bool; + var x_65_phi : bool; + var x_8_phi : i32; + var x_71_phi : vec3; + var x_72_phi : bool; + let x_60 : bool = x_60_phi; + i = 0; + x_65_phi = x_60; + x_8_phi = 0; + loop { + x_65 = x_65_phi; + let x_8 : i32 = x_8_phi; + x_71_phi = vec3(0.0, 0.0, 0.0); + x_72_phi = x_65; + if ((x_8 < 0)) { + } else { + break; + } + x_57 = true; + x_58 = vec3(1.0, 1.0, 1.0); + x_71_phi = vec3(1.0, 1.0, 1.0); + x_72_phi = true; + break; + + continuing { + x_65_phi = false; + x_8_phi = 0; + } + } + x_71 = x_71_phi; + let x_72 : bool = x_72_phi; + x_75_phi = x_71; + if (x_72) { + break; + } + x_74 = vec3(0.0, 0.0, 0.0); + x_57 = true; + x_75_phi = x_74; + break; + + continuing { + x_60_phi = false; + } + } + let x_75 : vec3 = x_75_phi; + return x_75; +} diff --git a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm new file mode 100644 index 0000000000..f81fa10e10 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm @@ -0,0 +1,124 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %color "color" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %7 RelaxedPrecision + %void = OpTypeVoid + %9 = OpTypeFunction %void + %bool = OpTypeBool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 + %26 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %false = OpConstantFalse %bool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %30 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Function_bool = OpTypePointer Function %bool + %32 = OpUndef %v3float + %33 = OpUndef %bool + %34 = OpUndef %int + %main = OpFunction %void None %9 + %35 = OpLabel + %36 = OpVariable %_ptr_Function_bool Function %false + %37 = OpVariable %_ptr_Function_bool Function + %7 = OpVariable %_ptr_Function_int Function + %38 = OpVariable %_ptr_Function_bool Function + %color = OpVariable %_ptr_Function_v3float Function + OpBranch %39 + %39 = OpLabel + %40 = OpPhi %bool %33 %35 %40 %41 + %42 = OpPhi %v3float %32 %35 %43 %41 + OpLoopMerge %44 %41 None + OpBranch %45 + %45 = OpLabel + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %47 = OpLoad %float %46 + %48 = OpFOrdLessThan %bool %47 %float_0 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + OpStore %color %26 + OpBranch %49 + %49 = OpLabel + %43 = OpPhi %v3float %42 %45 %26 %50 + OpBranch %41 + %41 = OpLabel + OpBranchConditional %false %39 %44 + %44 = OpLabel + %51 = OpCompositeExtract %float %43 0 + %52 = OpCompositeExtract %float %43 1 + %53 = OpCompositeExtract %float %43 2 + %54 = OpCompositeConstruct %v4float %51 %52 %53 %float_1 + OpStore %36 %false + OpBranch %55 + %55 = OpLabel + %56 = OpPhi %bool %40 %44 %33 %57 + %58 = OpPhi %bool %false %44 %33 %57 + OpLoopMerge %59 %57 None + OpBranch %60 + %60 = OpLabel + OpStore %7 %int_0 + OpBranch %61 + %61 = OpLabel + %62 = OpPhi %bool %56 %60 %33 %63 + %64 = OpPhi %bool %false %60 %33 %63 + %65 = OpPhi %int %int_0 %60 %34 %63 + OpLoopMerge %66 %63 None + OpBranch %67 + %67 = OpLabel + %68 = OpSLessThan %bool %int_0 %int_1 + OpBranchConditional %true %69 %66 + %69 = OpLabel + OpStore %36 %true + OpStore %37 %true + OpBranch %66 + %63 = OpLabel + OpBranch %61 + %66 = OpLabel + %70 = OpPhi %bool %62 %67 %true %69 + %71 = OpPhi %bool %false %67 %true %69 + OpSelectionMerge %72 None + OpBranchConditional %true %59 %72 + %72 = OpLabel + OpStore %36 %true + OpBranch %59 + %57 = OpLabel + OpBranch %55 + %59 = OpLabel + OpStore %38 %true + %73 = OpSelect %float %true %float_1 %float_0 + %74 = OpCompositeConstruct %v4float %73 %73 %73 %73 + %75 = OpFAdd %v4float %54 %74 + OpStore %_GLF_color %75 + OpStore %_GLF_color %30 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.hlsl new file mode 100755 index 0000000000..b1d646dbab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.hlsl @@ -0,0 +1,113 @@ +SKIP: FAILED + +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_36 = false; + bool x_37 = false; + int x_7 = 0; + bool x_38 = false; + float3 color = float3(0.0f, 0.0f, 0.0f); + bool x_40 = false; + float3 x_43 = float3(0.0f, 0.0f, 0.0f); + bool x_40_phi = false; + float3 x_42_phi = float3(0.0f, 0.0f, 0.0f); + bool x_56_phi = false; + bool x_58_phi = false; + x_40_phi = false; + x_42_phi = float3(0.0f, 0.0f, 0.0f); + while (true) { + float3 x_43_phi = float3(0.0f, 0.0f, 0.0f); + x_40 = x_40_phi; + const float3 x_42 = x_42_phi; + const float x_47 = asfloat(x_5[0].y); + x_43_phi = x_42; + if ((x_47 < 0.0f)) { + color = float3(1.0f, 1.0f, 1.0f); + x_43_phi = float3(1.0f, 1.0f, 1.0f); + } + x_43 = x_43_phi; + { + x_40_phi = x_40; + x_42_phi = x_43; + if (false) { + } else { + break; + } + } + } + x_36 = false; + x_56_phi = x_40; + x_58_phi = false; + while (true) { + bool x_62 = false; + bool x_62_phi = false; + bool x_64_phi = false; + int x_65_phi = 0; + bool x_70_phi = false; + bool x_71_phi = false; + const bool x_56 = x_56_phi; + const bool x_58 = x_58_phi; + x_7 = 0; + x_62_phi = x_56; + x_64_phi = false; + x_65_phi = 0; + while (true) { + x_62 = x_62_phi; + const bool x_64 = x_64_phi; + const int x_65 = x_65_phi; + const bool x_68 = (0 < 1); + x_70_phi = x_62; + x_71_phi = false; + if (true) { + } else { + break; + } + x_36 = true; + x_37 = true; + x_70_phi = true; + x_71_phi = true; + break; + { + x_62_phi = false; + x_64_phi = false; + x_65_phi = 0; + } + } + const bool x_70 = x_70_phi; + const bool x_71 = x_71_phi; + if (true) { + break; + } + x_36 = true; + break; + { + x_56_phi = false; + x_58_phi = false; + } + } + x_38 = true; + const float x_73 = (true ? 1.0f : 0.0f); + x_GLF_color = (float4(x_43.x, x_43.y, x_43.z, 1.0f) + float4(x_73, x_73, x_73, x_73)); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} +Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 + diff --git a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..99464727fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + bool x_36 = false; + bool x_37 = false; + int x_7 = 0; + bool x_38 = false; + float3 color = 0.0f; + bool x_40 = false; + float3 x_43 = 0.0f; + bool x_40_phi = false; + float3 x_42_phi = 0.0f; + bool x_56_phi = false; + bool x_58_phi = false; + x_40_phi = false; + x_42_phi = float3(0.0f, 0.0f, 0.0f); + while (true) { + float3 x_43_phi = 0.0f; + x_40 = x_40_phi; + float3 const x_42 = x_42_phi; + float const x_47 = x_5.injectionSwitch.y; + x_43_phi = x_42; + if ((x_47 < 0.0f)) { + color = float3(1.0f, 1.0f, 1.0f); + x_43_phi = float3(1.0f, 1.0f, 1.0f); + } + x_43 = x_43_phi; + { + x_40_phi = x_40; + x_42_phi = x_43; + if (false) { + } else { + break; + } + } + } + x_36 = false; + x_56_phi = x_40; + x_58_phi = false; + while (true) { + bool x_62 = false; + bool x_62_phi = false; + bool x_64_phi = false; + int x_65_phi = 0; + bool x_70_phi = false; + bool x_71_phi = false; + bool const x_56 = x_56_phi; + bool const x_58 = x_58_phi; + x_7 = 0; + x_62_phi = x_56; + x_64_phi = false; + x_65_phi = 0; + while (true) { + x_62 = x_62_phi; + bool const x_64 = x_64_phi; + int const x_65 = x_65_phi; + bool const x_68 = (0 < 1); + x_70_phi = x_62; + x_71_phi = false; + if (true) { + } else { + break; + } + x_36 = true; + x_37 = true; + x_70_phi = true; + x_71_phi = true; + break; + { + x_62_phi = false; + x_64_phi = false; + x_65_phi = 0; + } + } + bool const x_70 = x_70_phi; + bool const x_71 = x_71_phi; + if (true) { + break; + } + x_36 = true; + break; + { + x_56_phi = false; + x_58_phi = false; + } + } + x_38 = true; + float const x_73 = select(0.0f, 1.0f, true); + *(tint_symbol_4) = (float4(x_43.x, x_43.y, x_43.z, 1.0f) + float4(x_73, x_73, x_73, x_73)); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..093acdca5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.spvasm @@ -0,0 +1,238 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 120 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_36 "x_36" + OpName %x_37 "x_37" + OpName %x_7 "x_7" + OpName %x_38 "x_38" + OpName %color "color" + OpName %x_40 "x_40" + OpName %x_43 "x_43" + OpName %x_40_phi "x_40_phi" + OpName %x_42_phi "x_42_phi" + OpName %x_56_phi "x_56_phi" + OpName %x_58_phi "x_58_phi" + OpName %x_43_phi "x_43_phi" + OpName %x_62 "x_62" + OpName %x_62_phi "x_62_phi" + OpName %x_64_phi "x_64_phi" + OpName %x_65_phi "x_65_phi" + OpName %x_70_phi "x_70_phi" + OpName %x_71_phi "x_71_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %30 = OpConstantNull %v3float + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %56 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool +%_ptr_Function_float = OpTypePointer Function %float + %uint_2 = OpConstant %uint 2 + %107 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %108 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_36 = OpVariable %_ptr_Function_bool Function %20 + %x_37 = OpVariable %_ptr_Function_bool Function %20 + %x_7 = OpVariable %_ptr_Function_int Function %25 + %x_38 = OpVariable %_ptr_Function_bool Function %20 + %color = OpVariable %_ptr_Function_v3float Function %30 + %x_40 = OpVariable %_ptr_Function_bool Function %20 + %x_43 = OpVariable %_ptr_Function_v3float Function %30 + %x_40_phi = OpVariable %_ptr_Function_bool Function %20 + %x_42_phi = OpVariable %_ptr_Function_v3float Function %30 + %x_56_phi = OpVariable %_ptr_Function_bool Function %20 + %x_58_phi = OpVariable %_ptr_Function_bool Function %20 + %x_43_phi = OpVariable %_ptr_Function_v3float Function %30 + %x_62 = OpVariable %_ptr_Function_bool Function %20 + %x_62_phi = OpVariable %_ptr_Function_bool Function %20 + %x_64_phi = OpVariable %_ptr_Function_bool Function %20 + %x_65_phi = OpVariable %_ptr_Function_int Function %25 + %x_70_phi = OpVariable %_ptr_Function_bool Function %20 + %x_71_phi = OpVariable %_ptr_Function_bool Function %20 + OpStore %x_36 %false + OpStore %x_40_phi %false + OpStore %x_42_phi %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %44 = OpLoad %bool %x_40_phi + OpStore %x_40 %44 + %45 = OpLoad %v3float %x_42_phi + %50 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %51 = OpLoad %float %50 + OpStore %x_43_phi %45 + %52 = OpFOrdLessThan %bool %51 %float_0 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + OpStore %color %56 + OpStore %x_43_phi %56 + OpBranch %53 + %53 = OpLabel + %57 = OpLoad %v3float %x_43_phi + OpStore %x_43 %57 + OpBranch %41 + %41 = OpLabel + %58 = OpLoad %bool %x_40 + OpStore %x_40_phi %58 + %59 = OpLoad %v3float %x_43 + OpStore %x_42_phi %59 + OpSelectionMerge %60 None + OpBranchConditional %false %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %40 + %60 = OpLabel + OpBranch %39 + %40 = OpLabel + OpStore %x_36 %false + %63 = OpLoad %bool %x_40 + OpStore %x_56_phi %63 + OpStore %x_58_phi %false + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %74 = OpLoad %bool %x_56_phi + %75 = OpLoad %bool %x_58_phi + OpStore %x_7 %int_0 + OpStore %x_62_phi %74 + OpStore %x_64_phi %false + OpStore %x_65_phi %int_0 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %78 %79 None + OpBranch %80 + %80 = OpLabel + %81 = OpLoad %bool %x_62_phi + OpStore %x_62 %81 + %82 = OpLoad %bool %x_64_phi + %83 = OpLoad %int %x_65_phi + %85 = OpSLessThan %bool %int_0 %int_1 + %86 = OpLoad %bool %x_62 + OpStore %x_70_phi %86 + OpStore %x_71_phi %false + OpSelectionMerge %88 None + OpBranchConditional %true %89 %90 + %89 = OpLabel + OpBranch %88 + %90 = OpLabel + OpBranch %78 + %88 = OpLabel + OpStore %x_36 %true + OpStore %x_37 %true + OpStore %x_70_phi %true + OpStore %x_71_phi %true + OpBranch %78 + %79 = OpLabel + OpStore %x_62_phi %false + OpStore %x_64_phi %false + OpStore %x_65_phi %int_0 + OpBranch %77 + %78 = OpLabel + %91 = OpLoad %bool %x_70_phi + %92 = OpLoad %bool %x_71_phi + OpSelectionMerge %93 None + OpBranchConditional %true %94 %93 + %94 = OpLabel + OpBranch %65 + %93 = OpLabel + OpStore %x_36 %true + OpBranch %65 + %66 = OpLabel + OpStore %x_56_phi %false + OpStore %x_58_phi %false + OpBranch %64 + %65 = OpLabel + OpStore %x_38 %true + %95 = OpSelect %float %true %float_1 %float_0 + %97 = OpAccessChain %_ptr_Function_float %x_43 %uint_0 + %98 = OpLoad %float %97 + %99 = OpAccessChain %_ptr_Function_float %x_43 %uint_1 + %100 = OpLoad %float %99 + %102 = OpAccessChain %_ptr_Function_float %x_43 %uint_2 + %103 = OpLoad %float %102 + %104 = OpCompositeConstruct %v4float %98 %100 %103 %float_1 + %105 = OpCompositeConstruct %v4float %95 %95 %95 %95 + %106 = OpFAdd %v4float %104 %105 + OpStore %x_GLF_color %106 + OpStore %x_GLF_color %107 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %108 +%tint_symbol = OpFunctionParameter %main_out + %112 = OpLabel + %113 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %113 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %115 = OpLabel + %116 = OpFunctionCall %void %main_1 + %118 = OpLoad %v4float %x_GLF_color + %119 = OpCompositeConstruct %main_out %118 + %117 = OpFunctionCall %void %tint_symbol_2 %119 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 41[%41] is not post dominated by the back-edge block 60[%60] + %60 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b1bfccabb1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.wgsl @@ -0,0 +1,113 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : bool = false; + var x_37 : bool; + var x_7 : i32; + var x_38 : bool; + var color : vec3; + var x_40 : bool; + var x_43 : vec3; + var x_40_phi : bool; + var x_42_phi : vec3; + var x_56_phi : bool; + var x_58_phi : bool; + x_40_phi = false; + x_42_phi = vec3(0.0, 0.0, 0.0); + loop { + var x_43_phi : vec3; + x_40 = x_40_phi; + let x_42 : vec3 = x_42_phi; + let x_47 : f32 = x_5.injectionSwitch.y; + x_43_phi = x_42; + if ((x_47 < 0.0)) { + color = vec3(1.0, 1.0, 1.0); + x_43_phi = vec3(1.0, 1.0, 1.0); + } + x_43 = x_43_phi; + + continuing { + x_40_phi = x_40; + x_42_phi = x_43; + if (false) { + } else { + break; + } + } + } + x_36 = false; + x_56_phi = x_40; + x_58_phi = false; + loop { + var x_62 : bool; + var x_62_phi : bool; + var x_64_phi : bool; + var x_65_phi : i32; + var x_70_phi : bool; + var x_71_phi : bool; + let x_56 : bool = x_56_phi; + let x_58 : bool = x_58_phi; + x_7 = 0; + x_62_phi = x_56; + x_64_phi = false; + x_65_phi = 0; + loop { + x_62 = x_62_phi; + let x_64 : bool = x_64_phi; + let x_65 : i32 = x_65_phi; + let x_68 : bool = (0 < 1); + x_70_phi = x_62; + x_71_phi = false; + if (true) { + } else { + break; + } + x_36 = true; + x_37 = true; + x_70_phi = true; + x_71_phi = true; + break; + + continuing { + x_62_phi = false; + x_64_phi = false; + x_65_phi = 0; + } + } + let x_70 : bool = x_70_phi; + let x_71 : bool = x_71_phi; + if (true) { + break; + } + x_36 = true; + break; + + continuing { + x_56_phi = false; + x_58_phi = false; + } + } + x_38 = true; + let x_73 : f32 = select(0.0, 1.0, true); + x_GLF_color = (vec4(x_43.x, x_43.y, x_43.z, 1.0) + vec4(x_73, x_73, x_73, x_73)); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl new file mode 100644 index 0000000000..b1bfccabb1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl @@ -0,0 +1,113 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : bool = false; + var x_37 : bool; + var x_7 : i32; + var x_38 : bool; + var color : vec3; + var x_40 : bool; + var x_43 : vec3; + var x_40_phi : bool; + var x_42_phi : vec3; + var x_56_phi : bool; + var x_58_phi : bool; + x_40_phi = false; + x_42_phi = vec3(0.0, 0.0, 0.0); + loop { + var x_43_phi : vec3; + x_40 = x_40_phi; + let x_42 : vec3 = x_42_phi; + let x_47 : f32 = x_5.injectionSwitch.y; + x_43_phi = x_42; + if ((x_47 < 0.0)) { + color = vec3(1.0, 1.0, 1.0); + x_43_phi = vec3(1.0, 1.0, 1.0); + } + x_43 = x_43_phi; + + continuing { + x_40_phi = x_40; + x_42_phi = x_43; + if (false) { + } else { + break; + } + } + } + x_36 = false; + x_56_phi = x_40; + x_58_phi = false; + loop { + var x_62 : bool; + var x_62_phi : bool; + var x_64_phi : bool; + var x_65_phi : i32; + var x_70_phi : bool; + var x_71_phi : bool; + let x_56 : bool = x_56_phi; + let x_58 : bool = x_58_phi; + x_7 = 0; + x_62_phi = x_56; + x_64_phi = false; + x_65_phi = 0; + loop { + x_62 = x_62_phi; + let x_64 : bool = x_64_phi; + let x_65 : i32 = x_65_phi; + let x_68 : bool = (0 < 1); + x_70_phi = x_62; + x_71_phi = false; + if (true) { + } else { + break; + } + x_36 = true; + x_37 = true; + x_70_phi = true; + x_71_phi = true; + break; + + continuing { + x_62_phi = false; + x_64_phi = false; + x_65_phi = 0; + } + } + let x_70 : bool = x_70_phi; + let x_71 : bool = x_71_phi; + if (true) { + break; + } + x_36 = true; + break; + + continuing { + x_56_phi = false; + x_58_phi = false; + } + } + x_38 = true; + let x_73 : f32 = select(0.0, 1.0, true); + x_GLF_color = (vec4(x_43.x, x_43.y, x_43.z, 1.0) + vec4(x_73, x_73, x_73, x_73)); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.hlsl new file mode 100755 index 0000000000..b1d646dbab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.hlsl @@ -0,0 +1,113 @@ +SKIP: FAILED + +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_36 = false; + bool x_37 = false; + int x_7 = 0; + bool x_38 = false; + float3 color = float3(0.0f, 0.0f, 0.0f); + bool x_40 = false; + float3 x_43 = float3(0.0f, 0.0f, 0.0f); + bool x_40_phi = false; + float3 x_42_phi = float3(0.0f, 0.0f, 0.0f); + bool x_56_phi = false; + bool x_58_phi = false; + x_40_phi = false; + x_42_phi = float3(0.0f, 0.0f, 0.0f); + while (true) { + float3 x_43_phi = float3(0.0f, 0.0f, 0.0f); + x_40 = x_40_phi; + const float3 x_42 = x_42_phi; + const float x_47 = asfloat(x_5[0].y); + x_43_phi = x_42; + if ((x_47 < 0.0f)) { + color = float3(1.0f, 1.0f, 1.0f); + x_43_phi = float3(1.0f, 1.0f, 1.0f); + } + x_43 = x_43_phi; + { + x_40_phi = x_40; + x_42_phi = x_43; + if (false) { + } else { + break; + } + } + } + x_36 = false; + x_56_phi = x_40; + x_58_phi = false; + while (true) { + bool x_62 = false; + bool x_62_phi = false; + bool x_64_phi = false; + int x_65_phi = 0; + bool x_70_phi = false; + bool x_71_phi = false; + const bool x_56 = x_56_phi; + const bool x_58 = x_58_phi; + x_7 = 0; + x_62_phi = x_56; + x_64_phi = false; + x_65_phi = 0; + while (true) { + x_62 = x_62_phi; + const bool x_64 = x_64_phi; + const int x_65 = x_65_phi; + const bool x_68 = (0 < 1); + x_70_phi = x_62; + x_71_phi = false; + if (true) { + } else { + break; + } + x_36 = true; + x_37 = true; + x_70_phi = true; + x_71_phi = true; + break; + { + x_62_phi = false; + x_64_phi = false; + x_65_phi = 0; + } + } + const bool x_70 = x_70_phi; + const bool x_71 = x_71_phi; + if (true) { + break; + } + x_36 = true; + break; + { + x_56_phi = false; + x_58_phi = false; + } + } + x_38 = true; + const float x_73 = (true ? 1.0f : 0.0f); + x_GLF_color = (float4(x_43.x, x_43.y, x_43.z, 1.0f) + float4(x_73, x_73, x_73, x_73)); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} +Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 + diff --git a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..99464727fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + bool x_36 = false; + bool x_37 = false; + int x_7 = 0; + bool x_38 = false; + float3 color = 0.0f; + bool x_40 = false; + float3 x_43 = 0.0f; + bool x_40_phi = false; + float3 x_42_phi = 0.0f; + bool x_56_phi = false; + bool x_58_phi = false; + x_40_phi = false; + x_42_phi = float3(0.0f, 0.0f, 0.0f); + while (true) { + float3 x_43_phi = 0.0f; + x_40 = x_40_phi; + float3 const x_42 = x_42_phi; + float const x_47 = x_5.injectionSwitch.y; + x_43_phi = x_42; + if ((x_47 < 0.0f)) { + color = float3(1.0f, 1.0f, 1.0f); + x_43_phi = float3(1.0f, 1.0f, 1.0f); + } + x_43 = x_43_phi; + { + x_40_phi = x_40; + x_42_phi = x_43; + if (false) { + } else { + break; + } + } + } + x_36 = false; + x_56_phi = x_40; + x_58_phi = false; + while (true) { + bool x_62 = false; + bool x_62_phi = false; + bool x_64_phi = false; + int x_65_phi = 0; + bool x_70_phi = false; + bool x_71_phi = false; + bool const x_56 = x_56_phi; + bool const x_58 = x_58_phi; + x_7 = 0; + x_62_phi = x_56; + x_64_phi = false; + x_65_phi = 0; + while (true) { + x_62 = x_62_phi; + bool const x_64 = x_64_phi; + int const x_65 = x_65_phi; + bool const x_68 = (0 < 1); + x_70_phi = x_62; + x_71_phi = false; + if (true) { + } else { + break; + } + x_36 = true; + x_37 = true; + x_70_phi = true; + x_71_phi = true; + break; + { + x_62_phi = false; + x_64_phi = false; + x_65_phi = 0; + } + } + bool const x_70 = x_70_phi; + bool const x_71 = x_71_phi; + if (true) { + break; + } + x_36 = true; + break; + { + x_56_phi = false; + x_58_phi = false; + } + } + x_38 = true; + float const x_73 = select(0.0f, 1.0f, true); + *(tint_symbol_4) = (float4(x_43.x, x_43.y, x_43.z, 1.0f) + float4(x_73, x_73, x_73, x_73)); + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..093acdca5b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.spvasm @@ -0,0 +1,238 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 120 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_36 "x_36" + OpName %x_37 "x_37" + OpName %x_7 "x_7" + OpName %x_38 "x_38" + OpName %color "color" + OpName %x_40 "x_40" + OpName %x_43 "x_43" + OpName %x_40_phi "x_40_phi" + OpName %x_42_phi "x_42_phi" + OpName %x_56_phi "x_56_phi" + OpName %x_58_phi "x_58_phi" + OpName %x_43_phi "x_43_phi" + OpName %x_62 "x_62" + OpName %x_62_phi "x_62_phi" + OpName %x_64_phi "x_64_phi" + OpName %x_65_phi "x_65_phi" + OpName %x_70_phi "x_70_phi" + OpName %x_71_phi "x_71_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %20 = OpConstantNull %bool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpConstantNull %int + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %30 = OpConstantNull %v3float + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %56 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool +%_ptr_Function_float = OpTypePointer Function %float + %uint_2 = OpConstant %uint 2 + %107 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %108 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_36 = OpVariable %_ptr_Function_bool Function %20 + %x_37 = OpVariable %_ptr_Function_bool Function %20 + %x_7 = OpVariable %_ptr_Function_int Function %25 + %x_38 = OpVariable %_ptr_Function_bool Function %20 + %color = OpVariable %_ptr_Function_v3float Function %30 + %x_40 = OpVariable %_ptr_Function_bool Function %20 + %x_43 = OpVariable %_ptr_Function_v3float Function %30 + %x_40_phi = OpVariable %_ptr_Function_bool Function %20 + %x_42_phi = OpVariable %_ptr_Function_v3float Function %30 + %x_56_phi = OpVariable %_ptr_Function_bool Function %20 + %x_58_phi = OpVariable %_ptr_Function_bool Function %20 + %x_43_phi = OpVariable %_ptr_Function_v3float Function %30 + %x_62 = OpVariable %_ptr_Function_bool Function %20 + %x_62_phi = OpVariable %_ptr_Function_bool Function %20 + %x_64_phi = OpVariable %_ptr_Function_bool Function %20 + %x_65_phi = OpVariable %_ptr_Function_int Function %25 + %x_70_phi = OpVariable %_ptr_Function_bool Function %20 + %x_71_phi = OpVariable %_ptr_Function_bool Function %20 + OpStore %x_36 %false + OpStore %x_40_phi %false + OpStore %x_42_phi %38 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %44 = OpLoad %bool %x_40_phi + OpStore %x_40 %44 + %45 = OpLoad %v3float %x_42_phi + %50 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %51 = OpLoad %float %50 + OpStore %x_43_phi %45 + %52 = OpFOrdLessThan %bool %51 %float_0 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + OpStore %color %56 + OpStore %x_43_phi %56 + OpBranch %53 + %53 = OpLabel + %57 = OpLoad %v3float %x_43_phi + OpStore %x_43 %57 + OpBranch %41 + %41 = OpLabel + %58 = OpLoad %bool %x_40 + OpStore %x_40_phi %58 + %59 = OpLoad %v3float %x_43 + OpStore %x_42_phi %59 + OpSelectionMerge %60 None + OpBranchConditional %false %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %40 + %60 = OpLabel + OpBranch %39 + %40 = OpLabel + OpStore %x_36 %false + %63 = OpLoad %bool %x_40 + OpStore %x_56_phi %63 + OpStore %x_58_phi %false + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %74 = OpLoad %bool %x_56_phi + %75 = OpLoad %bool %x_58_phi + OpStore %x_7 %int_0 + OpStore %x_62_phi %74 + OpStore %x_64_phi %false + OpStore %x_65_phi %int_0 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %78 %79 None + OpBranch %80 + %80 = OpLabel + %81 = OpLoad %bool %x_62_phi + OpStore %x_62 %81 + %82 = OpLoad %bool %x_64_phi + %83 = OpLoad %int %x_65_phi + %85 = OpSLessThan %bool %int_0 %int_1 + %86 = OpLoad %bool %x_62 + OpStore %x_70_phi %86 + OpStore %x_71_phi %false + OpSelectionMerge %88 None + OpBranchConditional %true %89 %90 + %89 = OpLabel + OpBranch %88 + %90 = OpLabel + OpBranch %78 + %88 = OpLabel + OpStore %x_36 %true + OpStore %x_37 %true + OpStore %x_70_phi %true + OpStore %x_71_phi %true + OpBranch %78 + %79 = OpLabel + OpStore %x_62_phi %false + OpStore %x_64_phi %false + OpStore %x_65_phi %int_0 + OpBranch %77 + %78 = OpLabel + %91 = OpLoad %bool %x_70_phi + %92 = OpLoad %bool %x_71_phi + OpSelectionMerge %93 None + OpBranchConditional %true %94 %93 + %94 = OpLabel + OpBranch %65 + %93 = OpLabel + OpStore %x_36 %true + OpBranch %65 + %66 = OpLabel + OpStore %x_56_phi %false + OpStore %x_58_phi %false + OpBranch %64 + %65 = OpLabel + OpStore %x_38 %true + %95 = OpSelect %float %true %float_1 %float_0 + %97 = OpAccessChain %_ptr_Function_float %x_43 %uint_0 + %98 = OpLoad %float %97 + %99 = OpAccessChain %_ptr_Function_float %x_43 %uint_1 + %100 = OpLoad %float %99 + %102 = OpAccessChain %_ptr_Function_float %x_43 %uint_2 + %103 = OpLoad %float %102 + %104 = OpCompositeConstruct %v4float %98 %100 %103 %float_1 + %105 = OpCompositeConstruct %v4float %95 %95 %95 %95 + %106 = OpFAdd %v4float %104 %105 + OpStore %x_GLF_color %106 + OpStore %x_GLF_color %107 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %108 +%tint_symbol = OpFunctionParameter %main_out + %112 = OpLabel + %113 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %113 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %115 = OpLabel + %116 = OpFunctionCall %void %main_1 + %118 = OpLoad %v4float %x_GLF_color + %119 = OpCompositeConstruct %main_out %118 + %117 = OpFunctionCall %void %tint_symbol_2 %119 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 41[%41] is not post dominated by the back-edge block 60[%60] + %60 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b1bfccabb1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.wgsl @@ -0,0 +1,113 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_36 : bool = false; + var x_37 : bool; + var x_7 : i32; + var x_38 : bool; + var color : vec3; + var x_40 : bool; + var x_43 : vec3; + var x_40_phi : bool; + var x_42_phi : vec3; + var x_56_phi : bool; + var x_58_phi : bool; + x_40_phi = false; + x_42_phi = vec3(0.0, 0.0, 0.0); + loop { + var x_43_phi : vec3; + x_40 = x_40_phi; + let x_42 : vec3 = x_42_phi; + let x_47 : f32 = x_5.injectionSwitch.y; + x_43_phi = x_42; + if ((x_47 < 0.0)) { + color = vec3(1.0, 1.0, 1.0); + x_43_phi = vec3(1.0, 1.0, 1.0); + } + x_43 = x_43_phi; + + continuing { + x_40_phi = x_40; + x_42_phi = x_43; + if (false) { + } else { + break; + } + } + } + x_36 = false; + x_56_phi = x_40; + x_58_phi = false; + loop { + var x_62 : bool; + var x_62_phi : bool; + var x_64_phi : bool; + var x_65_phi : i32; + var x_70_phi : bool; + var x_71_phi : bool; + let x_56 : bool = x_56_phi; + let x_58 : bool = x_58_phi; + x_7 = 0; + x_62_phi = x_56; + x_64_phi = false; + x_65_phi = 0; + loop { + x_62 = x_62_phi; + let x_64 : bool = x_64_phi; + let x_65 : i32 = x_65_phi; + let x_68 : bool = (0 < 1); + x_70_phi = x_62; + x_71_phi = false; + if (true) { + } else { + break; + } + x_36 = true; + x_37 = true; + x_70_phi = true; + x_71_phi = true; + break; + + continuing { + x_62_phi = false; + x_64_phi = false; + x_65_phi = 0; + } + } + let x_70 : bool = x_70_phi; + let x_71 : bool = x_71_phi; + if (true) { + break; + } + x_36 = true; + break; + + continuing { + x_56_phi = false; + x_58_phi = false; + } + } + x_38 = true; + let x_73 : f32 = select(0.0, 1.0, true); + x_GLF_color = (vec4(x_43.x, x_43.y, x_43.z, 1.0) + vec4(x_73, x_73, x_73, x_73)); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm new file mode 100644 index 0000000000..f1e613f500 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm @@ -0,0 +1,119 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_0 = OpConstant %int 0 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %main = OpFunction %void None %8 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel + %31 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %32 = OpLoad %float %31 + %33 = OpExtInst %float %1 FClamp %32 %float_0 %float_1 + %34 = OpConvertFToS %int %33 + OpStore %_GLF_color %18 + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %38 = OpPhi %bool %false %30 %39 %40 + %41 = OpPhi %v4float %18 %30 %42 %40 + OpLoopMerge %43 %40 None + OpBranch %44 + %44 = OpLabel + %42 = OpPhi %v4float %41 %37 %45 %46 + %47 = OpPhi %int %int_0 %37 %48 %46 + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %50 = OpLoad %float %49 + %51 = OpConvertFToS %int %50 + %52 = OpIAdd %int %34 %51 + %53 = OpSLessThan %bool %47 %52 + OpLoopMerge %54 %46 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + %56 = OpSLessThan %bool %34 %int_0 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + OpBranch %54 + %59 = OpLabel + %60 = OpIEqual %bool %34 %int_1 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + %64 = OpConvertSToF %float %34 + %65 = OpCompositeConstruct %v2float %64 %64 + %66 = OpVectorShuffle %v4float %42 %65 4 1 2 5 + OpBranch %61 + %63 = OpLabel + %67 = OpIAdd %int %34 %int_1 + %68 = OpConvertSToF %float %67 + %69 = OpCompositeConstruct %v2float %68 %68 + %70 = OpVectorShuffle %v4float %42 %69 4 1 2 5 + OpBranch %61 + %61 = OpLabel + %45 = OpPhi %v4float %66 %62 %70 %63 + OpBranch %57 + %57 = OpLabel + OpBranch %46 + %46 = OpLabel + %48 = OpIAdd %int %47 %int_1 + OpBranch %44 + %54 = OpLabel + %39 = OpPhi %bool %38 %44 %true %58 + OpSelectionMerge %71 None + OpBranchConditional %39 %43 %71 + %71 = OpLabel + OpBranch %40 + %40 = OpLabel + %72 = OpSLessThan %bool %34 %int_0 + OpBranchConditional %72 %37 %43 + %43 = OpLabel + OpSelectionMerge %73 None + OpBranchConditional %39 %35 %73 + %73 = OpLabel + OpStore %_GLF_color %42 + OpBranch %35 + %36 = OpLabel + OpBranch %30 + %35 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..a6f8c4be0b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.hlsl @@ -0,0 +1,101 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + while (true) { + float4 x_42 = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_39 = false; + bool x_38_phi = false; + float4 x_41_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_32 = gl_FragCoord.x; + const int x_34 = int(clamp(x_32, 0.0f, 1.0f)); + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_38_phi = false; + x_41_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + while (true) { + float4 x_42_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_47_phi = 0; + bool x_39_phi = false; + const bool x_38 = x_38_phi; + x_42_phi = x_41_phi; + x_47_phi = 0; + while (true) { + float4 x_45 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_48 = 0; + x_42 = x_42_phi; + const int x_47 = x_47_phi; + const float x_50 = asfloat(x_6[0].y); + x_39_phi = x_38; + if ((x_47 < (x_34 + int(x_50)))) { + } else { + break; + } + float4 x_66 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_70 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_45_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + if ((x_34 < 0)) { + x_39_phi = true; + break; + } else { + if ((x_34 == 1)) { + const float x_64 = float(x_34); + const float2 x_65 = float2(x_64, x_64); + x_66 = float4(x_65.x, x_42.y, x_42.z, x_65.y); + x_45_phi = x_66; + } else { + const float x_68 = float((x_34 + 1)); + const float2 x_69 = float2(x_68, x_68); + x_70 = float4(x_69.x, x_42.y, x_42.z, x_69.y); + x_45_phi = x_70; + } + x_45 = x_45_phi; + } + { + x_48 = (x_47 + 1); + x_42_phi = x_45; + x_47_phi = x_48; + } + } + x_39 = x_39_phi; + if (x_39) { + break; + } + { + x_38_phi = x_39; + x_41_phi = x_42; + if ((x_34 < 0)) { + } else { + break; + } + } + } + if (x_39) { + break; + } + x_GLF_color = x_42; + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.msl new file mode 100644 index 0000000000..9694480410 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.msl @@ -0,0 +1,101 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + while (true) { + float4 x_42 = 0.0f; + bool x_39 = false; + bool x_38_phi = false; + float4 x_41_phi = 0.0f; + float const x_32 = (*(tint_symbol_5)).x; + int const x_34 = int(clamp(x_32, 0.0f, 1.0f)); + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_38_phi = false; + x_41_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + while (true) { + float4 x_42_phi = 0.0f; + int x_47_phi = 0; + bool x_39_phi = false; + bool const x_38 = x_38_phi; + float4 const x_41 = x_41_phi; + x_42_phi = x_41; + x_47_phi = 0; + while (true) { + float4 x_45 = 0.0f; + int x_48 = 0; + x_42 = x_42_phi; + int const x_47 = x_47_phi; + float const x_50 = x_6.injectionSwitch.y; + x_39_phi = x_38; + if ((x_47 < (x_34 + int(x_50)))) { + } else { + break; + } + float4 x_66 = 0.0f; + float4 x_70 = 0.0f; + float4 x_45_phi = 0.0f; + if ((x_34 < 0)) { + x_39_phi = true; + break; + } else { + if ((x_34 == 1)) { + float const x_64 = float(x_34); + float2 const x_65 = float2(x_64, x_64); + x_66 = float4(x_65.x, x_42.y, x_42.z, x_65.y); + x_45_phi = x_66; + } else { + float const x_68 = float((x_34 + 1)); + float2 const x_69 = float2(x_68, x_68); + x_70 = float4(x_69.x, x_42.y, x_42.z, x_69.y); + x_45_phi = x_70; + } + x_45 = x_45_phi; + } + { + x_48 = (x_47 + 1); + x_42_phi = x_45; + x_47_phi = x_48; + } + } + x_39 = x_39_phi; + if (x_39) { + break; + } + { + x_38_phi = x_39; + x_41_phi = x_42; + if ((x_34 < 0)) { + } else { + break; + } + } + } + if (x_39) { + break; + } + *(tint_symbol_6) = x_42; + break; + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..ef40c268c9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.spvasm @@ -0,0 +1,252 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 141 +; Schema: 0 + OpCapability Shader + %39 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_42 "x_42" + OpName %x_39 "x_39" + OpName %x_38_phi "x_38_phi" + OpName %x_41_phi "x_41_phi" + OpName %x_42_phi "x_42_phi" + OpName %x_47_phi "x_47_phi" + OpName %x_39_phi "x_39_phi" + OpName %x_45 "x_45" + OpName %x_48 "x_48" + OpName %x_66 "x_66" + OpName %x_70 "x_70" + OpName %x_45_phi "x_45_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %28 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int = OpTypeInt 32 1 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %42 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool +%_ptr_Function_int = OpTypePointer Function %int + %51 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float + %uint_2 = OpConstant %uint 2 + %main_out = OpTypeStruct %v4float + %128 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_42 = OpVariable %_ptr_Function_v4float Function %5 + %x_39 = OpVariable %_ptr_Function_bool Function %28 + %x_38_phi = OpVariable %_ptr_Function_bool Function %28 + %x_41_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_42_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_47_phi = OpVariable %_ptr_Function_int Function %51 + %x_39_phi = OpVariable %_ptr_Function_bool Function %28 + %x_45 = OpVariable %_ptr_Function_v4float Function %5 + %x_48 = OpVariable %_ptr_Function_int Function %51 + %x_66 = OpVariable %_ptr_Function_v4float Function %5 + %x_70 = OpVariable %_ptr_Function_v4float Function %5 + %x_45_phi = OpVariable %_ptr_Function_v4float Function %5 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %34 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %35 = OpLoad %float %34 + %38 = OpExtInst %float %39 NClamp %35 %float_0 %float_1 + %36 = OpConvertFToS %int %38 + OpStore %x_GLF_color %42 + OpStore %x_38_phi %false + OpStore %x_41_phi %42 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %53 = OpLoad %bool %x_38_phi + %54 = OpLoad %v4float %x_41_phi + OpStore %x_42_phi %54 + OpStore %x_47_phi %int_0 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %62 = OpLoad %v4float %x_42_phi + OpStore %x_42 %62 + %63 = OpLoad %int %x_47_phi + %66 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %67 = OpLoad %float %66 + OpStore %x_39_phi %53 + %68 = OpConvertFToS %int %67 + %69 = OpIAdd %int %36 %68 + %70 = OpSLessThan %bool %63 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %57 + %71 = OpLabel + %77 = OpSLessThan %bool %36 %int_0 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + OpStore %x_39_phi %true + OpBranch %57 + %80 = OpLabel + %83 = OpIEqual %bool %36 %int_1 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + %87 = OpConvertSToF %float %36 + %88 = OpCompositeConstruct %v2float %87 %87 + %89 = OpCompositeExtract %float %88 0 + %91 = OpAccessChain %_ptr_Function_float %x_42 %uint_1 + %92 = OpLoad %float %91 + %94 = OpAccessChain %_ptr_Function_float %x_42 %uint_2 + %95 = OpLoad %float %94 + %96 = OpCompositeExtract %float %88 1 + %97 = OpCompositeConstruct %v4float %89 %92 %95 %96 + OpStore %x_66 %97 + %98 = OpLoad %v4float %x_66 + OpStore %x_45_phi %98 + OpBranch %84 + %86 = OpLabel + %100 = OpIAdd %int %36 %int_1 + %99 = OpConvertSToF %float %100 + %101 = OpCompositeConstruct %v2float %99 %99 + %102 = OpCompositeExtract %float %101 0 + %103 = OpAccessChain %_ptr_Function_float %x_42 %uint_1 + %104 = OpLoad %float %103 + %105 = OpAccessChain %_ptr_Function_float %x_42 %uint_2 + %106 = OpLoad %float %105 + %107 = OpCompositeExtract %float %101 1 + %108 = OpCompositeConstruct %v4float %102 %104 %106 %107 + OpStore %x_70 %108 + %109 = OpLoad %v4float %x_70 + OpStore %x_45_phi %109 + OpBranch %84 + %84 = OpLabel + %110 = OpLoad %v4float %x_45_phi + OpStore %x_45 %110 + OpBranch %78 + %78 = OpLabel + OpBranch %58 + %58 = OpLabel + %111 = OpIAdd %int %63 %int_1 + OpStore %x_48 %111 + %112 = OpLoad %v4float %x_45 + OpStore %x_42_phi %112 + %113 = OpLoad %int %x_48 + OpStore %x_47_phi %113 + OpBranch %56 + %57 = OpLabel + %114 = OpLoad %bool %x_39_phi + OpStore %x_39 %114 + %115 = OpLoad %bool %x_39 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + OpBranch %45 + %116 = OpLabel + OpBranch %46 + %46 = OpLabel + %118 = OpLoad %bool %x_39 + OpStore %x_38_phi %118 + %119 = OpLoad %v4float %x_42 + OpStore %x_41_phi %119 + %120 = OpSLessThan %bool %36 %int_0 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + OpBranch %121 + %123 = OpLabel + OpBranch %45 + %121 = OpLabel + OpBranch %44 + %45 = OpLabel + %124 = OpLoad %bool %x_39 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %125 + %126 = OpLabel + OpBranch %20 + %125 = OpLabel + %127 = OpLoad %v4float %x_42 + OpStore %x_GLF_color %127 + OpBranch %20 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %128 +%tint_symbol_1 = OpFunctionParameter %main_out + %132 = OpLabel + %133 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %133 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %135 = OpLabel + %136 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %136 + %137 = OpFunctionCall %void %main_1 + %139 = OpLoad %v4float %x_GLF_color + %140 = OpCompositeConstruct %main_out %139 + %138 = OpFunctionCall %void %tint_symbol_3 %140 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 46[%46] is not post dominated by the back-edge block 121[%121] + %121 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..ee729d9ec3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.spvasm.expected.wgsl @@ -0,0 +1,102 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + loop { + var x_42 : vec4; + var x_39 : bool; + var x_38_phi : bool; + var x_41_phi : vec4; + let x_32 : f32 = gl_FragCoord.x; + let x_34 : i32 = i32(clamp(x_32, 0.0, 1.0)); + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + x_38_phi = false; + x_41_phi = vec4(0.0, 0.0, 0.0, 0.0); + loop { + var x_42_phi : vec4; + var x_47_phi : i32; + var x_39_phi : bool; + let x_38 : bool = x_38_phi; + let x_41 : vec4 = x_41_phi; + x_42_phi = x_41; + x_47_phi = 0; + loop { + var x_45 : vec4; + var x_48 : i32; + x_42 = x_42_phi; + let x_47 : i32 = x_47_phi; + let x_50 : f32 = x_6.injectionSwitch.y; + x_39_phi = x_38; + if ((x_47 < (x_34 + i32(x_50)))) { + } else { + break; + } + var x_66 : vec4; + var x_70 : vec4; + var x_45_phi : vec4; + if ((x_34 < 0)) { + x_39_phi = true; + break; + } else { + if ((x_34 == 1)) { + let x_64 : f32 = f32(x_34); + let x_65 : vec2 = vec2(x_64, x_64); + x_66 = vec4(x_65.x, x_42.y, x_42.z, x_65.y); + x_45_phi = x_66; + } else { + let x_68 : f32 = f32((x_34 + 1)); + let x_69 : vec2 = vec2(x_68, x_68); + x_70 = vec4(x_69.x, x_42.y, x_42.z, x_69.y); + x_45_phi = x_70; + } + x_45 = x_45_phi; + } + + continuing { + x_48 = (x_47 + 1); + x_42_phi = x_45; + x_47_phi = x_48; + } + } + x_39 = x_39_phi; + if (x_39) { + break; + } + + continuing { + x_38_phi = x_39; + x_41_phi = x_42; + if ((x_34 < 0)) { + } else { + break; + } + } + } + if (x_39) { + break; + } + x_GLF_color = x_42; + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl new file mode 100644 index 0000000000..ee729d9ec3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl @@ -0,0 +1,102 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + loop { + var x_42 : vec4; + var x_39 : bool; + var x_38_phi : bool; + var x_41_phi : vec4; + let x_32 : f32 = gl_FragCoord.x; + let x_34 : i32 = i32(clamp(x_32, 0.0, 1.0)); + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + x_38_phi = false; + x_41_phi = vec4(0.0, 0.0, 0.0, 0.0); + loop { + var x_42_phi : vec4; + var x_47_phi : i32; + var x_39_phi : bool; + let x_38 : bool = x_38_phi; + let x_41 : vec4 = x_41_phi; + x_42_phi = x_41; + x_47_phi = 0; + loop { + var x_45 : vec4; + var x_48 : i32; + x_42 = x_42_phi; + let x_47 : i32 = x_47_phi; + let x_50 : f32 = x_6.injectionSwitch.y; + x_39_phi = x_38; + if ((x_47 < (x_34 + i32(x_50)))) { + } else { + break; + } + var x_66 : vec4; + var x_70 : vec4; + var x_45_phi : vec4; + if ((x_34 < 0)) { + x_39_phi = true; + break; + } else { + if ((x_34 == 1)) { + let x_64 : f32 = f32(x_34); + let x_65 : vec2 = vec2(x_64, x_64); + x_66 = vec4(x_65.x, x_42.y, x_42.z, x_65.y); + x_45_phi = x_66; + } else { + let x_68 : f32 = f32((x_34 + 1)); + let x_69 : vec2 = vec2(x_68, x_68); + x_70 = vec4(x_69.x, x_42.y, x_42.z, x_69.y); + x_45_phi = x_70; + } + x_45 = x_45_phi; + } + + continuing { + x_48 = (x_47 + 1); + x_42_phi = x_45; + x_47_phi = x_48; + } + } + x_39 = x_39_phi; + if (x_39) { + break; + } + + continuing { + x_38_phi = x_39; + x_41_phi = x_42; + if ((x_34 < 0)) { + } else { + break; + } + } + } + if (x_39) { + break; + } + x_GLF_color = x_42; + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..a6f8c4be0b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.hlsl @@ -0,0 +1,101 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + while (true) { + float4 x_42 = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_39 = false; + bool x_38_phi = false; + float4 x_41_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_32 = gl_FragCoord.x; + const int x_34 = int(clamp(x_32, 0.0f, 1.0f)); + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_38_phi = false; + x_41_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + while (true) { + float4 x_42_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_47_phi = 0; + bool x_39_phi = false; + const bool x_38 = x_38_phi; + x_42_phi = x_41_phi; + x_47_phi = 0; + while (true) { + float4 x_45 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_48 = 0; + x_42 = x_42_phi; + const int x_47 = x_47_phi; + const float x_50 = asfloat(x_6[0].y); + x_39_phi = x_38; + if ((x_47 < (x_34 + int(x_50)))) { + } else { + break; + } + float4 x_66 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_70 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_45_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + if ((x_34 < 0)) { + x_39_phi = true; + break; + } else { + if ((x_34 == 1)) { + const float x_64 = float(x_34); + const float2 x_65 = float2(x_64, x_64); + x_66 = float4(x_65.x, x_42.y, x_42.z, x_65.y); + x_45_phi = x_66; + } else { + const float x_68 = float((x_34 + 1)); + const float2 x_69 = float2(x_68, x_68); + x_70 = float4(x_69.x, x_42.y, x_42.z, x_69.y); + x_45_phi = x_70; + } + x_45 = x_45_phi; + } + { + x_48 = (x_47 + 1); + x_42_phi = x_45; + x_47_phi = x_48; + } + } + x_39 = x_39_phi; + if (x_39) { + break; + } + { + x_38_phi = x_39; + x_41_phi = x_42; + if ((x_34 < 0)) { + } else { + break; + } + } + } + if (x_39) { + break; + } + x_GLF_color = x_42; + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.msl new file mode 100644 index 0000000000..9694480410 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.msl @@ -0,0 +1,101 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + while (true) { + float4 x_42 = 0.0f; + bool x_39 = false; + bool x_38_phi = false; + float4 x_41_phi = 0.0f; + float const x_32 = (*(tint_symbol_5)).x; + int const x_34 = int(clamp(x_32, 0.0f, 1.0f)); + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_38_phi = false; + x_41_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + while (true) { + float4 x_42_phi = 0.0f; + int x_47_phi = 0; + bool x_39_phi = false; + bool const x_38 = x_38_phi; + float4 const x_41 = x_41_phi; + x_42_phi = x_41; + x_47_phi = 0; + while (true) { + float4 x_45 = 0.0f; + int x_48 = 0; + x_42 = x_42_phi; + int const x_47 = x_47_phi; + float const x_50 = x_6.injectionSwitch.y; + x_39_phi = x_38; + if ((x_47 < (x_34 + int(x_50)))) { + } else { + break; + } + float4 x_66 = 0.0f; + float4 x_70 = 0.0f; + float4 x_45_phi = 0.0f; + if ((x_34 < 0)) { + x_39_phi = true; + break; + } else { + if ((x_34 == 1)) { + float const x_64 = float(x_34); + float2 const x_65 = float2(x_64, x_64); + x_66 = float4(x_65.x, x_42.y, x_42.z, x_65.y); + x_45_phi = x_66; + } else { + float const x_68 = float((x_34 + 1)); + float2 const x_69 = float2(x_68, x_68); + x_70 = float4(x_69.x, x_42.y, x_42.z, x_69.y); + x_45_phi = x_70; + } + x_45 = x_45_phi; + } + { + x_48 = (x_47 + 1); + x_42_phi = x_45; + x_47_phi = x_48; + } + } + x_39 = x_39_phi; + if (x_39) { + break; + } + { + x_38_phi = x_39; + x_41_phi = x_42; + if ((x_34 < 0)) { + } else { + break; + } + } + } + if (x_39) { + break; + } + *(tint_symbol_6) = x_42; + break; + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..ef40c268c9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.spvasm @@ -0,0 +1,252 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 141 +; Schema: 0 + OpCapability Shader + %39 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_42 "x_42" + OpName %x_39 "x_39" + OpName %x_38_phi "x_38_phi" + OpName %x_41_phi "x_41_phi" + OpName %x_42_phi "x_42_phi" + OpName %x_47_phi "x_47_phi" + OpName %x_39_phi "x_39_phi" + OpName %x_45 "x_45" + OpName %x_48 "x_48" + OpName %x_66 "x_66" + OpName %x_70 "x_70" + OpName %x_45_phi "x_45_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %28 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int = OpTypeInt 32 1 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %42 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool +%_ptr_Function_int = OpTypePointer Function %int + %51 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float + %uint_2 = OpConstant %uint 2 + %main_out = OpTypeStruct %v4float + %128 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_42 = OpVariable %_ptr_Function_v4float Function %5 + %x_39 = OpVariable %_ptr_Function_bool Function %28 + %x_38_phi = OpVariable %_ptr_Function_bool Function %28 + %x_41_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_42_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_47_phi = OpVariable %_ptr_Function_int Function %51 + %x_39_phi = OpVariable %_ptr_Function_bool Function %28 + %x_45 = OpVariable %_ptr_Function_v4float Function %5 + %x_48 = OpVariable %_ptr_Function_int Function %51 + %x_66 = OpVariable %_ptr_Function_v4float Function %5 + %x_70 = OpVariable %_ptr_Function_v4float Function %5 + %x_45_phi = OpVariable %_ptr_Function_v4float Function %5 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %34 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %35 = OpLoad %float %34 + %38 = OpExtInst %float %39 NClamp %35 %float_0 %float_1 + %36 = OpConvertFToS %int %38 + OpStore %x_GLF_color %42 + OpStore %x_38_phi %false + OpStore %x_41_phi %42 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %53 = OpLoad %bool %x_38_phi + %54 = OpLoad %v4float %x_41_phi + OpStore %x_42_phi %54 + OpStore %x_47_phi %int_0 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %62 = OpLoad %v4float %x_42_phi + OpStore %x_42 %62 + %63 = OpLoad %int %x_47_phi + %66 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %67 = OpLoad %float %66 + OpStore %x_39_phi %53 + %68 = OpConvertFToS %int %67 + %69 = OpIAdd %int %36 %68 + %70 = OpSLessThan %bool %63 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %57 + %71 = OpLabel + %77 = OpSLessThan %bool %36 %int_0 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + OpStore %x_39_phi %true + OpBranch %57 + %80 = OpLabel + %83 = OpIEqual %bool %36 %int_1 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + %87 = OpConvertSToF %float %36 + %88 = OpCompositeConstruct %v2float %87 %87 + %89 = OpCompositeExtract %float %88 0 + %91 = OpAccessChain %_ptr_Function_float %x_42 %uint_1 + %92 = OpLoad %float %91 + %94 = OpAccessChain %_ptr_Function_float %x_42 %uint_2 + %95 = OpLoad %float %94 + %96 = OpCompositeExtract %float %88 1 + %97 = OpCompositeConstruct %v4float %89 %92 %95 %96 + OpStore %x_66 %97 + %98 = OpLoad %v4float %x_66 + OpStore %x_45_phi %98 + OpBranch %84 + %86 = OpLabel + %100 = OpIAdd %int %36 %int_1 + %99 = OpConvertSToF %float %100 + %101 = OpCompositeConstruct %v2float %99 %99 + %102 = OpCompositeExtract %float %101 0 + %103 = OpAccessChain %_ptr_Function_float %x_42 %uint_1 + %104 = OpLoad %float %103 + %105 = OpAccessChain %_ptr_Function_float %x_42 %uint_2 + %106 = OpLoad %float %105 + %107 = OpCompositeExtract %float %101 1 + %108 = OpCompositeConstruct %v4float %102 %104 %106 %107 + OpStore %x_70 %108 + %109 = OpLoad %v4float %x_70 + OpStore %x_45_phi %109 + OpBranch %84 + %84 = OpLabel + %110 = OpLoad %v4float %x_45_phi + OpStore %x_45 %110 + OpBranch %78 + %78 = OpLabel + OpBranch %58 + %58 = OpLabel + %111 = OpIAdd %int %63 %int_1 + OpStore %x_48 %111 + %112 = OpLoad %v4float %x_45 + OpStore %x_42_phi %112 + %113 = OpLoad %int %x_48 + OpStore %x_47_phi %113 + OpBranch %56 + %57 = OpLabel + %114 = OpLoad %bool %x_39_phi + OpStore %x_39 %114 + %115 = OpLoad %bool %x_39 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + OpBranch %45 + %116 = OpLabel + OpBranch %46 + %46 = OpLabel + %118 = OpLoad %bool %x_39 + OpStore %x_38_phi %118 + %119 = OpLoad %v4float %x_42 + OpStore %x_41_phi %119 + %120 = OpSLessThan %bool %36 %int_0 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + OpBranch %121 + %123 = OpLabel + OpBranch %45 + %121 = OpLabel + OpBranch %44 + %45 = OpLabel + %124 = OpLoad %bool %x_39 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %125 + %126 = OpLabel + OpBranch %20 + %125 = OpLabel + %127 = OpLoad %v4float %x_42 + OpStore %x_GLF_color %127 + OpBranch %20 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %128 +%tint_symbol_1 = OpFunctionParameter %main_out + %132 = OpLabel + %133 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %133 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %135 = OpLabel + %136 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %136 + %137 = OpFunctionCall %void %main_1 + %139 = OpLoad %v4float %x_GLF_color + %140 = OpCompositeConstruct %main_out %139 + %138 = OpFunctionCall %void %tint_symbol_3 %140 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 46[%46] is not post dominated by the back-edge block 121[%121] + %121 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee729d9ec3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/set-color-in-one-iteration-while-loop/0.wgsl.expected.wgsl @@ -0,0 +1,102 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + loop { + var x_42 : vec4; + var x_39 : bool; + var x_38_phi : bool; + var x_41_phi : vec4; + let x_32 : f32 = gl_FragCoord.x; + let x_34 : i32 = i32(clamp(x_32, 0.0, 1.0)); + x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); + x_38_phi = false; + x_41_phi = vec4(0.0, 0.0, 0.0, 0.0); + loop { + var x_42_phi : vec4; + var x_47_phi : i32; + var x_39_phi : bool; + let x_38 : bool = x_38_phi; + let x_41 : vec4 = x_41_phi; + x_42_phi = x_41; + x_47_phi = 0; + loop { + var x_45 : vec4; + var x_48 : i32; + x_42 = x_42_phi; + let x_47 : i32 = x_47_phi; + let x_50 : f32 = x_6.injectionSwitch.y; + x_39_phi = x_38; + if ((x_47 < (x_34 + i32(x_50)))) { + } else { + break; + } + var x_66 : vec4; + var x_70 : vec4; + var x_45_phi : vec4; + if ((x_34 < 0)) { + x_39_phi = true; + break; + } else { + if ((x_34 == 1)) { + let x_64 : f32 = f32(x_34); + let x_65 : vec2 = vec2(x_64, x_64); + x_66 = vec4(x_65.x, x_42.y, x_42.z, x_65.y); + x_45_phi = x_66; + } else { + let x_68 : f32 = f32((x_34 + 1)); + let x_69 : vec2 = vec2(x_68, x_68); + x_70 = vec4(x_69.x, x_42.y, x_42.z, x_69.y); + x_45_phi = x_70; + } + x_45 = x_45_phi; + } + + continuing { + x_48 = (x_47 + 1); + x_42_phi = x_45; + x_47_phi = x_48; + } + } + x_39 = x_39_phi; + if (x_39) { + break; + } + + continuing { + x_38_phi = x_39; + x_41_phi = x_42; + if ((x_34 < 0)) { + } else { + break; + } + } + } + if (x_39) { + break; + } + x_GLF_color = x_42; + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm new file mode 100644 index 0000000000..2e26a63533 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm @@ -0,0 +1,152 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %lv "lv" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %gv "gv" + OpName %gl_FragCoord "gl_FragCoord" + OpName %GLF_live5r "GLF_live5r" + OpName %GLF_live5_looplimiter6 "GLF_live5_looplimiter6" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %GLF_live5r RelaxedPrecision + OpDecorate %GLF_live5_looplimiter6 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Private_float = OpTypePointer Private %float + %gv = OpVariable %_ptr_Private_float Private + %float_260 = OpConstant %float 260 + %int_250 = OpConstant %int 250 + %int_180 = OpConstant %int 180 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %int_210 = OpConstant %int 210 + %true = OpConstantTrue %bool +%_ptr_Function_int = OpTypePointer Function %int + %int_6 = OpConstant %int 6 + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %41 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %15 + %42 = OpLabel + %lv = OpVariable %_ptr_Function_float Function + %43 = OpVariable %_ptr_Function_float Function + %GLF_live5r = OpVariable %_ptr_Function_int Function +%GLF_live5_looplimiter6 = OpVariable %_ptr_Function_int Function + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %45 = OpLoad %float %44 + %46 = OpFOrdGreaterThan %bool %float_1 %45 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + %50 = OpLoad %float %gv + %51 = OpExtInst %float %1 FAbs %50 + OpStore %43 %51 + OpBranch %47 + %49 = OpLabel + OpStore %43 %float_260 + OpBranch %47 + %47 = OpLabel + %52 = OpLoad %float %43 + OpStore %lv %52 + %53 = OpLoad %float %lv + %54 = OpConvertFToS %int %53 + %55 = OpSLessThan %bool %54 %int_250 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + %58 = OpLoad %float %lv + %59 = OpConvertFToS %int %58 + %60 = OpSLessThan %bool %59 %int_180 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + %64 = OpLoad %float %lv + %65 = OpExtInst %float %1 FClamp %64 %float_1 %float_1 + OpBranch %61 + %63 = OpLabel + %66 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %67 = OpLoad %float %66 + %68 = OpFOrdLessThan %bool %67 %float_0 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + %71 = OpLoad %float %lv + %72 = OpConvertFToS %int %71 + %73 = OpSLessThan %bool %72 %int_210 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %74 + %75 = OpLabel + OpBranch %76 + %76 = OpLabel + OpLoopMerge %77 %78 None + OpBranch %79 + %79 = OpLabel + OpBranch %78 + %78 = OpLabel + OpBranchConditional %true %76 %77 + %77 = OpLabel + OpBranch %74 + %74 = OpLabel + OpStore %GLF_live5r %int_0 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + OpBranchConditional %true %84 %81 + %84 = OpLabel + %11 = OpLoad %int %GLF_live5_looplimiter6 + %85 = OpSGreaterThanEqual %bool %11 %int_6 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + OpBranch %81 + %86 = OpLabel + %12 = OpLoad %int %GLF_live5_looplimiter6 + %13 = OpIAdd %int %12 %int_1 + OpStore %GLF_live5_looplimiter6 %13 + OpBranch %82 + %82 = OpLabel + OpBranch %80 + %81 = OpLabel + OpBranch %69 + %69 = OpLabel + OpBranch %61 + %61 = OpLabel + OpBranch %56 + %56 = OpLabel + OpStore %_GLF_color %41 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2b57a30d7a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.hlsl @@ -0,0 +1,71 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float gv = 0.0f; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float lv = 0.0f; + float x_43 = 0.0f; + int GLF_live5r = 0; + int GLF_live5_looplimiter6 = 0; + const float x_45 = asfloat(x_7[0].y); + if ((1.0f > x_45)) { + x_43 = abs(gv); + } else { + x_43 = 260.0f; + } + lv = x_43; + if ((int(lv) < 250)) { + if ((int(lv) < 180)) { + const float x_65 = clamp(lv, 1.0f, 1.0f); + } else { + const float x_67 = gl_FragCoord.y; + if ((x_67 < 0.0f)) { + if ((int(lv) < 210)) { + while (true) { + { + if (true) { + } else { + break; + } + } + } + } + GLF_live5r = 0; + while (true) { + if (true) { + } else { + break; + } + if ((GLF_live5_looplimiter6 >= 6)) { + break; + } + GLF_live5_looplimiter6 = (GLF_live5_looplimiter6 + 1); + } + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..3bfd32e28e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.msl @@ -0,0 +1,78 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float* const tint_symbol_5, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float lv = 0.0f; + float x_43 = 0.0f; + int GLF_live5r = 0; + int GLF_live5_looplimiter6 = 0; + float const x_45 = x_7.injectionSwitch.y; + if ((1.0f > x_45)) { + float const x_50 = *(tint_symbol_5); + x_43 = fabs(x_50); + } else { + x_43 = 260.0f; + } + float const x_52 = x_43; + lv = x_52; + float const x_53 = lv; + if ((int(x_53) < 250)) { + float const x_58 = lv; + if ((int(x_58) < 180)) { + float const x_64 = lv; + float const x_65 = clamp(x_64, 1.0f, 1.0f); + } else { + float const x_67 = (*(tint_symbol_6)).y; + if ((x_67 < 0.0f)) { + float const x_71 = lv; + if ((int(x_71) < 210)) { + while (true) { + { + if (true) { + } else { + break; + } + } + } + } + GLF_live5r = 0; + while (true) { + if (true) { + } else { + break; + } + int const x_11 = GLF_live5_looplimiter6; + if ((x_11 >= 6)) { + break; + } + int const x_12 = GLF_live5_looplimiter6; + GLF_live5_looplimiter6 = (x_12 + 1); + } + } + } + } + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_9), &(tint_symbol_8), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..17f5fb70f9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.spvasm @@ -0,0 +1,203 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + %44 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %gv "gv" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %lv "lv" + OpName %x_43 "x_43" + OpName %GLF_live5r "GLF_live5r" + OpName %GLF_live5_looplimiter6 "GLF_live5_looplimiter6" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float + %gv = OpVariable %_ptr_Private_float Private %8 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_260 = OpConstant %float 260 + %int_250 = OpConstant %int 250 + %int_180 = OpConstant %int 180 + %float_0 = OpConstant %float 0 + %int_210 = OpConstant %int 210 + %true = OpConstantTrue %bool + %int_0 = OpConstant %int 0 + %int_6 = OpConstant %int 6 + %int_1 = OpConstant %int 1 + %98 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %99 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %lv = OpVariable %_ptr_Function_float Function %8 + %x_43 = OpVariable %_ptr_Function_float Function %8 + %GLF_live5r = OpVariable %_ptr_Function_int Function %28 +%GLF_live5_looplimiter6 = OpVariable %_ptr_Function_int Function %28 + %34 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %35 = OpLoad %float %34 + %37 = OpFOrdGreaterThan %bool %float_1 %35 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + %42 = OpLoad %float %gv + %43 = OpExtInst %float %44 FAbs %42 + OpStore %x_43 %43 + OpBranch %39 + %41 = OpLabel + OpStore %x_43 %float_260 + OpBranch %39 + %39 = OpLabel + %46 = OpLoad %float %x_43 + OpStore %lv %46 + %47 = OpLoad %float %lv + %48 = OpConvertFToS %int %47 + %50 = OpSLessThan %bool %48 %int_250 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %53 = OpLoad %float %lv + %54 = OpConvertFToS %int %53 + %56 = OpSLessThan %bool %54 %int_180 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpLoad %float %lv + %61 = OpExtInst %float %44 NClamp %60 %float_1 %float_1 + OpBranch %57 + %59 = OpLabel + %62 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %63 = OpLoad %float %62 + %65 = OpFOrdLessThan %bool %63 %float_0 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %66 + %67 = OpLabel + %68 = OpLoad %float %lv + %69 = OpConvertFToS %int %68 + %71 = OpSLessThan %bool %69 %int_210 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + OpBranch %74 + %74 = OpLabel + OpLoopMerge %75 %76 None + OpBranch %77 + %77 = OpLabel + OpBranch %76 + %76 = OpLabel + OpSelectionMerge %79 None + OpBranchConditional %true %80 %81 + %80 = OpLabel + OpBranch %79 + %81 = OpLabel + OpBranch %75 + %79 = OpLabel + OpBranch %74 + %75 = OpLabel + OpBranch %72 + %72 = OpLabel + OpStore %GLF_live5r %int_0 + OpBranch %83 + %83 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + OpSelectionMerge %87 None + OpBranchConditional %true %88 %89 + %88 = OpLabel + OpBranch %87 + %89 = OpLabel + OpBranch %84 + %87 = OpLabel + %90 = OpLoad %int %GLF_live5_looplimiter6 + %92 = OpSGreaterThanEqual %bool %90 %int_6 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + OpBranch %84 + %93 = OpLabel + %95 = OpLoad %int %GLF_live5_looplimiter6 + %97 = OpIAdd %int %95 %int_1 + OpStore %GLF_live5_looplimiter6 %97 + OpBranch %85 + %85 = OpLabel + OpBranch %83 + %84 = OpLabel + OpBranch %66 + %66 = OpLabel + OpBranch %57 + %57 = OpLabel + OpBranch %51 + %51 = OpLabel + OpStore %x_GLF_color %98 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %99 +%tint_symbol_1 = OpFunctionParameter %main_out + %103 = OpLabel + %104 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %104 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %106 = OpLabel + %107 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %107 + %108 = OpFunctionCall %void %main_1 + %110 = OpLoad %v4float %x_GLF_color + %111 = OpCompositeConstruct %main_out %110 + %109 = OpFunctionCall %void %tint_symbol_3 %111 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 76[%76] is not post dominated by the back-edge block 79[%79] + %79 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..592be78359 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.wgsl @@ -0,0 +1,79 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gv : f32; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var lv : f32; + var x_43 : f32; + var GLF_live5r : i32; + var GLF_live5_looplimiter6 : i32; + let x_45 : f32 = x_7.injectionSwitch.y; + if ((1.0 > x_45)) { + let x_50 : f32 = gv; + x_43 = abs(x_50); + } else { + x_43 = 260.0; + } + let x_52 : f32 = x_43; + lv = x_52; + let x_53 : f32 = lv; + if ((i32(x_53) < 250)) { + let x_58 : f32 = lv; + if ((i32(x_58) < 180)) { + let x_64 : f32 = lv; + let x_65 : f32 = clamp(x_64, 1.0, 1.0); + } else { + let x_67 : f32 = gl_FragCoord.y; + if ((x_67 < 0.0)) { + let x_71 : f32 = lv; + if ((i32(x_71) < 210)) { + loop { + + continuing { + if (true) { + } else { + break; + } + } + } + } + GLF_live5r = 0; + loop { + if (true) { + } else { + break; + } + let x_11 : i32 = GLF_live5_looplimiter6; + if ((x_11 >= 6)) { + break; + } + let x_12 : i32 = GLF_live5_looplimiter6; + GLF_live5_looplimiter6 = (x_12 + 1); + } + } + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl new file mode 100644 index 0000000000..592be78359 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl @@ -0,0 +1,79 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gv : f32; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var lv : f32; + var x_43 : f32; + var GLF_live5r : i32; + var GLF_live5_looplimiter6 : i32; + let x_45 : f32 = x_7.injectionSwitch.y; + if ((1.0 > x_45)) { + let x_50 : f32 = gv; + x_43 = abs(x_50); + } else { + x_43 = 260.0; + } + let x_52 : f32 = x_43; + lv = x_52; + let x_53 : f32 = lv; + if ((i32(x_53) < 250)) { + let x_58 : f32 = lv; + if ((i32(x_58) < 180)) { + let x_64 : f32 = lv; + let x_65 : f32 = clamp(x_64, 1.0, 1.0); + } else { + let x_67 : f32 = gl_FragCoord.y; + if ((x_67 < 0.0)) { + let x_71 : f32 = lv; + if ((i32(x_71) < 210)) { + loop { + + continuing { + if (true) { + } else { + break; + } + } + } + } + GLF_live5r = 0; + loop { + if (true) { + } else { + break; + } + let x_11 : i32 = GLF_live5_looplimiter6; + if ((x_11 >= 6)) { + break; + } + let x_12 : i32 = GLF_live5_looplimiter6; + GLF_live5_looplimiter6 = (x_12 + 1); + } + } + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2b57a30d7a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.hlsl @@ -0,0 +1,71 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float gv = 0.0f; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float lv = 0.0f; + float x_43 = 0.0f; + int GLF_live5r = 0; + int GLF_live5_looplimiter6 = 0; + const float x_45 = asfloat(x_7[0].y); + if ((1.0f > x_45)) { + x_43 = abs(gv); + } else { + x_43 = 260.0f; + } + lv = x_43; + if ((int(lv) < 250)) { + if ((int(lv) < 180)) { + const float x_65 = clamp(lv, 1.0f, 1.0f); + } else { + const float x_67 = gl_FragCoord.y; + if ((x_67 < 0.0f)) { + if ((int(lv) < 210)) { + while (true) { + { + if (true) { + } else { + break; + } + } + } + } + GLF_live5r = 0; + while (true) { + if (true) { + } else { + break; + } + if ((GLF_live5_looplimiter6 >= 6)) { + break; + } + GLF_live5_looplimiter6 = (GLF_live5_looplimiter6 + 1); + } + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..3bfd32e28e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.msl @@ -0,0 +1,78 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float* const tint_symbol_5, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float lv = 0.0f; + float x_43 = 0.0f; + int GLF_live5r = 0; + int GLF_live5_looplimiter6 = 0; + float const x_45 = x_7.injectionSwitch.y; + if ((1.0f > x_45)) { + float const x_50 = *(tint_symbol_5); + x_43 = fabs(x_50); + } else { + x_43 = 260.0f; + } + float const x_52 = x_43; + lv = x_52; + float const x_53 = lv; + if ((int(x_53) < 250)) { + float const x_58 = lv; + if ((int(x_58) < 180)) { + float const x_64 = lv; + float const x_65 = clamp(x_64, 1.0f, 1.0f); + } else { + float const x_67 = (*(tint_symbol_6)).y; + if ((x_67 < 0.0f)) { + float const x_71 = lv; + if ((int(x_71) < 210)) { + while (true) { + { + if (true) { + } else { + break; + } + } + } + } + GLF_live5r = 0; + while (true) { + if (true) { + } else { + break; + } + int const x_11 = GLF_live5_looplimiter6; + if ((x_11 >= 6)) { + break; + } + int const x_12 = GLF_live5_looplimiter6; + GLF_live5_looplimiter6 = (x_12 + 1); + } + } + } + } + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_9), &(tint_symbol_8), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..17f5fb70f9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.spvasm @@ -0,0 +1,203 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 112 +; Schema: 0 + OpCapability Shader + %44 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %gv "gv" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %lv "lv" + OpName %x_43 "x_43" + OpName %GLF_live5r "GLF_live5r" + OpName %GLF_live5_looplimiter6 "GLF_live5_looplimiter6" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float + %gv = OpVariable %_ptr_Private_float Private %8 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_260 = OpConstant %float 260 + %int_250 = OpConstant %int 250 + %int_180 = OpConstant %int 180 + %float_0 = OpConstant %float 0 + %int_210 = OpConstant %int 210 + %true = OpConstantTrue %bool + %int_0 = OpConstant %int 0 + %int_6 = OpConstant %int 6 + %int_1 = OpConstant %int 1 + %98 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %99 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %lv = OpVariable %_ptr_Function_float Function %8 + %x_43 = OpVariable %_ptr_Function_float Function %8 + %GLF_live5r = OpVariable %_ptr_Function_int Function %28 +%GLF_live5_looplimiter6 = OpVariable %_ptr_Function_int Function %28 + %34 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %35 = OpLoad %float %34 + %37 = OpFOrdGreaterThan %bool %float_1 %35 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + %42 = OpLoad %float %gv + %43 = OpExtInst %float %44 FAbs %42 + OpStore %x_43 %43 + OpBranch %39 + %41 = OpLabel + OpStore %x_43 %float_260 + OpBranch %39 + %39 = OpLabel + %46 = OpLoad %float %x_43 + OpStore %lv %46 + %47 = OpLoad %float %lv + %48 = OpConvertFToS %int %47 + %50 = OpSLessThan %bool %48 %int_250 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %53 = OpLoad %float %lv + %54 = OpConvertFToS %int %53 + %56 = OpSLessThan %bool %54 %int_180 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + %60 = OpLoad %float %lv + %61 = OpExtInst %float %44 NClamp %60 %float_1 %float_1 + OpBranch %57 + %59 = OpLabel + %62 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %63 = OpLoad %float %62 + %65 = OpFOrdLessThan %bool %63 %float_0 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %66 + %67 = OpLabel + %68 = OpLoad %float %lv + %69 = OpConvertFToS %int %68 + %71 = OpSLessThan %bool %69 %int_210 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + OpBranch %74 + %74 = OpLabel + OpLoopMerge %75 %76 None + OpBranch %77 + %77 = OpLabel + OpBranch %76 + %76 = OpLabel + OpSelectionMerge %79 None + OpBranchConditional %true %80 %81 + %80 = OpLabel + OpBranch %79 + %81 = OpLabel + OpBranch %75 + %79 = OpLabel + OpBranch %74 + %75 = OpLabel + OpBranch %72 + %72 = OpLabel + OpStore %GLF_live5r %int_0 + OpBranch %83 + %83 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + OpSelectionMerge %87 None + OpBranchConditional %true %88 %89 + %88 = OpLabel + OpBranch %87 + %89 = OpLabel + OpBranch %84 + %87 = OpLabel + %90 = OpLoad %int %GLF_live5_looplimiter6 + %92 = OpSGreaterThanEqual %bool %90 %int_6 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + OpBranch %84 + %93 = OpLabel + %95 = OpLoad %int %GLF_live5_looplimiter6 + %97 = OpIAdd %int %95 %int_1 + OpStore %GLF_live5_looplimiter6 %97 + OpBranch %85 + %85 = OpLabel + OpBranch %83 + %84 = OpLabel + OpBranch %66 + %66 = OpLabel + OpBranch %57 + %57 = OpLabel + OpBranch %51 + %51 = OpLabel + OpStore %x_GLF_color %98 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %99 +%tint_symbol_1 = OpFunctionParameter %main_out + %103 = OpLabel + %104 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %104 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %106 = OpLabel + %107 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %107 + %108 = OpFunctionCall %void %main_1 + %110 = OpLoad %v4float %x_GLF_color + %111 = OpCompositeConstruct %main_out %110 + %109 = OpFunctionCall %void %tint_symbol_3 %111 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 76[%76] is not post dominated by the back-edge block 79[%79] + %79 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..592be78359 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.wgsl @@ -0,0 +1,79 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gv : f32; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var lv : f32; + var x_43 : f32; + var GLF_live5r : i32; + var GLF_live5_looplimiter6 : i32; + let x_45 : f32 = x_7.injectionSwitch.y; + if ((1.0 > x_45)) { + let x_50 : f32 = gv; + x_43 = abs(x_50); + } else { + x_43 = 260.0; + } + let x_52 : f32 = x_43; + lv = x_52; + let x_53 : f32 = lv; + if ((i32(x_53) < 250)) { + let x_58 : f32 = lv; + if ((i32(x_58) < 180)) { + let x_64 : f32 = lv; + let x_65 : f32 = clamp(x_64, 1.0, 1.0); + } else { + let x_67 : f32 = gl_FragCoord.y; + if ((x_67 < 0.0)) { + let x_71 : f32 = lv; + if ((i32(x_71) < 210)) { + loop { + + continuing { + if (true) { + } else { + break; + } + } + } + } + GLF_live5r = 0; + loop { + if (true) { + } else { + break; + } + let x_11 : i32 = GLF_live5_looplimiter6; + if ((x_11 >= 6)) { + break; + } + let x_12 : i32 = GLF_live5_looplimiter6; + GLF_live5_looplimiter6 = (x_12 + 1); + } + } + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm new file mode 100644 index 0000000000..e7e836bc43 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm @@ -0,0 +1,58 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %GLF_live9r "GLF_live9r" + OpName %g "g" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %13 = OpConstantComposite %v2float %float_1 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_3 = OpConstant %float 3 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %main = OpFunction %void None %7 + %23 = OpLabel + %GLF_live9r = OpVariable %_ptr_Function_int Function + %g = OpVariable %_ptr_Function_float Function + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + OpBranchConditional %true %28 %25 + %28 = OpLabel + OpSelectionMerge %29 None + OpBranchConditional %true %30 %29 + %30 = OpLabel + OpBranch %25 + %29 = OpLabel + %31 = OpLoad %int %GLF_live9r + %32 = OpExtInst %int %1 SClamp %31 %int_0 %int_1 + OpBranch %26 + %26 = OpLabel + OpBranch %24 + %25 = OpLabel + OpStore %g %float_3 + %33 = OpLoad %float %g + %34 = OpExtInst %float %1 SmoothStep %float_0 %float_1 %33 + %35 = OpCompositeConstruct %v4float %34 %float_0 %float_0 %float_1 + OpStore %_GLF_color %35 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..bbaed1e529 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,33 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int GLF_live9r = 0; + float g = 0.0f; + while (true) { + if (true) { + } else { + break; + } + if (true) { + break; + } + const int x_32 = clamp(GLF_live9r, 0, 1); + } + g = 3.0f; + x_GLF_color = float4(smoothstep(0.0f, 1.0f, g), 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f97960211e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int GLF_live9r = 0; + float g = 0.0f; + while (true) { + if (true) { + } else { + break; + } + if (true) { + break; + } + int const x_31 = GLF_live9r; + int const x_32 = clamp(x_31, 0, 1); + } + g = 3.0f; + float const x_33 = g; + *(tint_symbol_4) = float4(smoothstep(0.0f, 1.0f, x_33), 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e27323452d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %32 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %GLF_live9r "GLF_live9r" + OpName %g "g" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpConstantNull %float + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_3 = OpConstant %float 3 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %41 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %GLF_live9r = OpVariable %_ptr_Function_int Function %15 + %g = OpVariable %_ptr_Function_float Function %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + OpSelectionMerge %25 None + OpBranchConditional %true %26 %27 + %26 = OpLabel + OpBranch %25 + %27 = OpLabel + OpBranch %20 + %25 = OpLabel + OpSelectionMerge %28 None + OpBranchConditional %true %29 %28 + %29 = OpLabel + OpBranch %20 + %28 = OpLabel + %30 = OpLoad %int %GLF_live9r + %31 = OpExtInst %int %32 SClamp %30 %int_0 %int_1 + OpBranch %21 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + OpStore %g %float_3 + %36 = OpLoad %float %g + %37 = OpExtInst %float %32 SmoothStep %float_0 %float_1 %36 + %40 = OpCompositeConstruct %v4float %37 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %40 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %41 +%tint_symbol = OpFunctionParameter %main_out + %45 = OpLabel + %46 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %46 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %48 = OpLabel + %49 = OpFunctionCall %void %main_1 + %51 = OpLoad %v4float %x_GLF_color + %52 = OpCompositeConstruct %main_out %51 + %50 = OpFunctionCall %void %tint_symbol_2 %52 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..3f8d86d946 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var x_GLF_color : vec4; + +fn main_1() { + var GLF_live9r : i32; + var g : f32; + loop { + if (true) { + } else { + break; + } + if (true) { + break; + } + let x_31 : i32 = GLF_live9r; + let x_32 : i32 = clamp(x_31, 0, 1); + } + g = 3.0; + let x_33 : f32 = g; + x_GLF_color = vec4(smoothStep(0.0, 1.0, x_33), 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl new file mode 100644 index 0000000000..3f8d86d946 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl @@ -0,0 +1,32 @@ +var x_GLF_color : vec4; + +fn main_1() { + var GLF_live9r : i32; + var g : f32; + loop { + if (true) { + } else { + break; + } + if (true) { + break; + } + let x_31 : i32 = GLF_live9r; + let x_32 : i32 = clamp(x_31, 0, 1); + } + g = 3.0; + let x_33 : f32 = g; + x_GLF_color = vec4(smoothStep(0.0, 1.0, x_33), 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..bbaed1e529 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int GLF_live9r = 0; + float g = 0.0f; + while (true) { + if (true) { + } else { + break; + } + if (true) { + break; + } + const int x_32 = clamp(GLF_live9r, 0, 1); + } + g = 3.0f; + x_GLF_color = float4(smoothstep(0.0f, 1.0f, g), 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f97960211e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int GLF_live9r = 0; + float g = 0.0f; + while (true) { + if (true) { + } else { + break; + } + if (true) { + break; + } + int const x_31 = GLF_live9r; + int const x_32 = clamp(x_31, 0, 1); + } + g = 3.0f; + float const x_33 = g; + *(tint_symbol_4) = float4(smoothstep(0.0f, 1.0f, x_33), 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e27323452d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %32 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %GLF_live9r "GLF_live9r" + OpName %g "g" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpConstantNull %float + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_3 = OpConstant %float 3 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %41 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %GLF_live9r = OpVariable %_ptr_Function_int Function %15 + %g = OpVariable %_ptr_Function_float Function %18 + OpBranch %19 + %19 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + OpSelectionMerge %25 None + OpBranchConditional %true %26 %27 + %26 = OpLabel + OpBranch %25 + %27 = OpLabel + OpBranch %20 + %25 = OpLabel + OpSelectionMerge %28 None + OpBranchConditional %true %29 %28 + %29 = OpLabel + OpBranch %20 + %28 = OpLabel + %30 = OpLoad %int %GLF_live9r + %31 = OpExtInst %int %32 SClamp %30 %int_0 %int_1 + OpBranch %21 + %21 = OpLabel + OpBranch %19 + %20 = OpLabel + OpStore %g %float_3 + %36 = OpLoad %float %g + %37 = OpExtInst %float %32 SmoothStep %float_0 %float_1 %36 + %40 = OpCompositeConstruct %v4float %37 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %40 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %41 +%tint_symbol = OpFunctionParameter %main_out + %45 = OpLabel + %46 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %46 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %48 = OpLabel + %49 = OpFunctionCall %void %main_1 + %51 = OpLoad %v4float %x_GLF_color + %52 = OpCompositeConstruct %main_out %51 + %50 = OpFunctionCall %void %tint_symbol_2 %52 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..3f8d86d946 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/smoothstep-after-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,32 @@ +var x_GLF_color : vec4; + +fn main_1() { + var GLF_live9r : i32; + var g : f32; + loop { + if (true) { + } else { + break; + } + if (true) { + break; + } + let x_31 : i32 = GLF_live9r; + let x_32 : i32 = clamp(x_31, 0, 1); + } + g = 3.0; + let x_33 : f32 = g; + x_GLF_color = vec4(smoothStep(0.0, 1.0, x_33), 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm new file mode 100644 index 0000000000..4596d90f5c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm @@ -0,0 +1,609 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %pos "pos" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %ipos "ipos" + OpName %i "i" + OpName %map "map" + OpName %p "p" + OpName %canwalk "canwalk" + OpName %v "v" + OpName %directions "directions" + OpName %j "j" + OpName %d "d" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_16 = OpConstant %float 16 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %bool = OpTypeBool + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Private__arr_int_uint_256 = OpTypePointer Private %_arr_int_uint_256 + %map = OpVariable %_ptr_Private__arr_int_uint_256 Private +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %43 = OpConstantComposite %v2int %int_0 %int_0 +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %int_16 = OpConstant %int 16 + %int_14 = OpConstant %int 14 + %false = OpConstantFalse %bool + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %53 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %55 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main = OpFunction %void None %18 + %56 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function + %ipos = OpVariable %_ptr_Function_v2int Function + %i = OpVariable %_ptr_Function_int Function + %p = OpVariable %_ptr_Function_v2int Function + %canwalk = OpVariable %_ptr_Function_bool Function + %v = OpVariable %_ptr_Function_int Function + %directions = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %d = OpVariable %_ptr_Function_int Function + %57 = OpLoad %v4float %gl_FragCoord + %58 = OpVectorShuffle %v2float %57 %57 0 1 + %59 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %60 = OpLoad %v2float %59 + %61 = OpFDiv %v2float %58 %60 + OpStore %pos %61 + %62 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %63 = OpLoad %float %62 + %64 = OpFMul %float %63 %float_16 + %65 = OpConvertFToS %int %64 + %66 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %67 = OpLoad %float %66 + %68 = OpFMul %float %67 %float_16 + %69 = OpConvertFToS %int %68 + %70 = OpCompositeConstruct %v2int %65 %69 + OpStore %ipos %70 + OpStore %i %int_0 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %int %i + %76 = OpSLessThan %bool %75 %int_256 + OpBranchConditional %76 %77 %72 + %77 = OpLabel + %78 = OpLoad %int %i + %79 = OpAccessChain %_ptr_Private_int %map %78 + OpStore %79 %int_0 + OpBranch %73 + %73 = OpLabel + %80 = OpLoad %int %i + %81 = OpIAdd %int %80 %int_1 + OpStore %i %81 + OpBranch %71 + %72 = OpLabel + OpStore %p %43 + OpStore %canwalk %true + OpStore %v %int_0 + OpBranch %82 + %82 = OpLabel + OpLoopMerge %83 %84 None + OpBranch %85 + %85 = OpLabel + %86 = OpLoad %int %v + %87 = OpIAdd %int %86 %int_1 + OpStore %v %87 + OpStore %directions %int_0 + %88 = OpAccessChain %_ptr_Function_int %p %uint_0 + %89 = OpLoad %int %88 + %90 = OpSGreaterThan %bool %89 %int_0 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + %93 = OpAccessChain %_ptr_Function_int %p %uint_0 + %94 = OpLoad %int %93 + %95 = OpISub %int %94 %int_2 + %96 = OpAccessChain %_ptr_Function_int %p %uint_1 + %97 = OpLoad %int %96 + %98 = OpIMul %int %97 %int_16 + %99 = OpIAdd %int %95 %98 + %100 = OpAccessChain %_ptr_Private_int %map %99 + %101 = OpLoad %int %100 + %102 = OpIEqual %bool %101 %int_0 + OpBranch %91 + %91 = OpLabel + %103 = OpPhi %bool %90 %85 %102 %92 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + %106 = OpLoad %int %directions + %107 = OpIAdd %int %106 %int_1 + OpStore %directions %107 + OpBranch %104 + %104 = OpLabel + %108 = OpAccessChain %_ptr_Function_int %p %uint_1 + %109 = OpLoad %int %108 + %110 = OpSGreaterThan %bool %109 %int_0 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %111 + %112 = OpLabel + %113 = OpAccessChain %_ptr_Function_int %p %uint_0 + %114 = OpLoad %int %113 + %115 = OpAccessChain %_ptr_Function_int %p %uint_1 + %116 = OpLoad %int %115 + %117 = OpISub %int %116 %int_2 + %118 = OpIMul %int %117 %int_16 + %119 = OpIAdd %int %114 %118 + %120 = OpAccessChain %_ptr_Private_int %map %119 + %121 = OpLoad %int %120 + %122 = OpIEqual %bool %121 %int_0 + OpBranch %111 + %111 = OpLabel + %123 = OpPhi %bool %110 %104 %122 %112 + OpSelectionMerge %124 None + OpBranchConditional %123 %125 %124 + %125 = OpLabel + %126 = OpLoad %int %directions + %127 = OpIAdd %int %126 %int_1 + OpStore %directions %127 + OpBranch %124 + %124 = OpLabel + %128 = OpAccessChain %_ptr_Function_int %p %uint_0 + %129 = OpLoad %int %128 + %130 = OpSLessThan %bool %129 %int_14 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %131 + %132 = OpLabel + %133 = OpAccessChain %_ptr_Function_int %p %uint_0 + %134 = OpLoad %int %133 + %135 = OpIAdd %int %134 %int_2 + %136 = OpAccessChain %_ptr_Function_int %p %uint_1 + %137 = OpLoad %int %136 + %138 = OpIMul %int %137 %int_16 + %139 = OpIAdd %int %135 %138 + %140 = OpAccessChain %_ptr_Private_int %map %139 + %141 = OpLoad %int %140 + %142 = OpIEqual %bool %141 %int_0 + OpBranch %131 + %131 = OpLabel + %143 = OpPhi %bool %130 %124 %142 %132 + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %144 + %145 = OpLabel + %146 = OpLoad %int %directions + %147 = OpIAdd %int %146 %int_1 + OpStore %directions %147 + OpBranch %144 + %144 = OpLabel + %148 = OpAccessChain %_ptr_Function_int %p %uint_1 + %149 = OpLoad %int %148 + %150 = OpSLessThan %bool %149 %int_14 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %151 + %152 = OpLabel + %153 = OpAccessChain %_ptr_Function_int %p %uint_0 + %154 = OpLoad %int %153 + %155 = OpAccessChain %_ptr_Function_int %p %uint_1 + %156 = OpLoad %int %155 + %157 = OpIAdd %int %156 %int_2 + %158 = OpIMul %int %157 %int_16 + %159 = OpIAdd %int %154 %158 + %160 = OpAccessChain %_ptr_Private_int %map %159 + %161 = OpLoad %int %160 + %162 = OpIEqual %bool %161 %int_0 + OpBranch %151 + %151 = OpLabel + %163 = OpPhi %bool %150 %144 %162 %152 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %164 + %165 = OpLabel + %166 = OpLoad %int %directions + %167 = OpIAdd %int %166 %int_1 + OpStore %directions %167 + OpBranch %164 + %164 = OpLabel + %168 = OpLoad %int %directions + %169 = OpIEqual %bool %168 %int_0 + OpSelectionMerge %170 None + OpBranchConditional %169 %171 %172 + %171 = OpLabel + OpStore %canwalk %false + OpStore %i %int_0 + OpBranch %173 + %173 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %int %i + %178 = OpSLessThan %bool %177 %int_8 + OpBranchConditional %178 %179 %174 + %179 = OpLabel + OpStore %j %int_0 + OpBranch %180 + %180 = OpLabel + OpLoopMerge %181 %182 None + OpBranch %183 + %183 = OpLabel + %184 = OpLoad %int %j + %185 = OpSLessThan %bool %184 %int_8 + OpBranchConditional %185 %186 %181 + %186 = OpLabel + %187 = OpLoad %int %j + %188 = OpIMul %int %187 %int_2 + %189 = OpLoad %int %i + %190 = OpIMul %int %189 %int_2 + %191 = OpIMul %int %190 %int_16 + %192 = OpIAdd %int %188 %191 + %193 = OpAccessChain %_ptr_Private_int %map %192 + %194 = OpLoad %int %193 + %195 = OpIEqual %bool %194 %int_0 + OpSelectionMerge %196 None + OpBranchConditional %195 %197 %196 + %197 = OpLabel + %198 = OpLoad %int %j + %199 = OpIMul %int %198 %int_2 + %200 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %200 %199 + %201 = OpLoad %int %i + %202 = OpIMul %int %201 %int_2 + %203 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %203 %202 + OpStore %canwalk %true + OpBranch %196 + %196 = OpLabel + OpBranch %182 + %182 = OpLabel + %204 = OpLoad %int %j + %205 = OpIAdd %int %204 %int_1 + OpStore %j %205 + OpBranch %180 + %181 = OpLabel + OpBranch %175 + %175 = OpLabel + %206 = OpLoad %int %i + %207 = OpIAdd %int %206 %int_1 + OpStore %i %207 + OpBranch %173 + %174 = OpLabel + %208 = OpAccessChain %_ptr_Function_int %p %uint_0 + %209 = OpLoad %int %208 + %210 = OpAccessChain %_ptr_Function_int %p %uint_1 + %211 = OpLoad %int %210 + %212 = OpIMul %int %211 %int_16 + %213 = OpIAdd %int %209 %212 + %214 = OpAccessChain %_ptr_Private_int %map %213 + OpStore %214 %int_1 + OpBranch %170 + %172 = OpLabel + %215 = OpLoad %int %v + %216 = OpLoad %int %directions + %217 = OpSMod %int %215 %216 + OpStore %d %217 + %218 = OpLoad %int %directions + %219 = OpLoad %int %v + %220 = OpIAdd %int %219 %218 + OpStore %v %220 + %221 = OpLoad %int %d + %222 = OpSGreaterThanEqual %bool %221 %int_0 + OpSelectionMerge %223 None + OpBranchConditional %222 %224 %223 + %224 = OpLabel + %225 = OpAccessChain %_ptr_Function_int %p %uint_0 + %226 = OpLoad %int %225 + %227 = OpSGreaterThan %bool %226 %int_0 + OpBranch %223 + %223 = OpLabel + %228 = OpPhi %bool %222 %172 %227 %224 + OpSelectionMerge %229 None + OpBranchConditional %228 %230 %229 + %230 = OpLabel + %231 = OpAccessChain %_ptr_Function_int %p %uint_0 + %232 = OpLoad %int %231 + %233 = OpISub %int %232 %int_2 + %234 = OpAccessChain %_ptr_Function_int %p %uint_1 + %235 = OpLoad %int %234 + %236 = OpIMul %int %235 %int_16 + %237 = OpIAdd %int %233 %236 + %238 = OpAccessChain %_ptr_Private_int %map %237 + %239 = OpLoad %int %238 + %240 = OpIEqual %bool %239 %int_0 + OpBranch %229 + %229 = OpLabel + %241 = OpPhi %bool %228 %223 %240 %230 + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %242 + %243 = OpLabel + %244 = OpLoad %int %d + %245 = OpISub %int %244 %int_1 + OpStore %d %245 + %246 = OpAccessChain %_ptr_Function_int %p %uint_0 + %247 = OpLoad %int %246 + %248 = OpAccessChain %_ptr_Function_int %p %uint_1 + %249 = OpLoad %int %248 + %250 = OpIMul %int %249 %int_16 + %251 = OpIAdd %int %247 %250 + %252 = OpAccessChain %_ptr_Private_int %map %251 + OpStore %252 %int_1 + %253 = OpAccessChain %_ptr_Function_int %p %uint_0 + %254 = OpLoad %int %253 + %255 = OpISub %int %254 %int_1 + %256 = OpAccessChain %_ptr_Function_int %p %uint_1 + %257 = OpLoad %int %256 + %258 = OpIMul %int %257 %int_16 + %259 = OpIAdd %int %255 %258 + %260 = OpAccessChain %_ptr_Private_int %map %259 + OpStore %260 %int_1 + %261 = OpAccessChain %_ptr_Function_int %p %uint_0 + %262 = OpLoad %int %261 + %263 = OpISub %int %262 %int_2 + %264 = OpAccessChain %_ptr_Function_int %p %uint_1 + %265 = OpLoad %int %264 + %266 = OpIMul %int %265 %int_16 + %267 = OpIAdd %int %263 %266 + %268 = OpAccessChain %_ptr_Private_int %map %267 + OpStore %268 %int_1 + %269 = OpAccessChain %_ptr_Function_int %p %uint_0 + %270 = OpLoad %int %269 + %271 = OpISub %int %270 %int_2 + %272 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %272 %271 + OpBranch %242 + %242 = OpLabel + %273 = OpLoad %int %d + %274 = OpSGreaterThanEqual %bool %273 %int_0 + OpSelectionMerge %275 None + OpBranchConditional %274 %276 %275 + %276 = OpLabel + %277 = OpAccessChain %_ptr_Function_int %p %uint_1 + %278 = OpLoad %int %277 + %279 = OpSGreaterThan %bool %278 %int_0 + OpBranch %275 + %275 = OpLabel + %280 = OpPhi %bool %274 %242 %279 %276 + OpSelectionMerge %281 None + OpBranchConditional %280 %282 %281 + %282 = OpLabel + %283 = OpAccessChain %_ptr_Function_int %p %uint_0 + %284 = OpLoad %int %283 + %285 = OpAccessChain %_ptr_Function_int %p %uint_1 + %286 = OpLoad %int %285 + %287 = OpISub %int %286 %int_2 + %288 = OpIMul %int %287 %int_16 + %289 = OpIAdd %int %284 %288 + %290 = OpAccessChain %_ptr_Private_int %map %289 + %291 = OpLoad %int %290 + %292 = OpIEqual %bool %291 %int_0 + OpBranch %281 + %281 = OpLabel + %293 = OpPhi %bool %280 %275 %292 %282 + OpSelectionMerge %294 None + OpBranchConditional %293 %295 %294 + %295 = OpLabel + %296 = OpLoad %int %d + %297 = OpISub %int %296 %int_1 + OpStore %d %297 + %298 = OpAccessChain %_ptr_Function_int %p %uint_0 + %299 = OpLoad %int %298 + %300 = OpAccessChain %_ptr_Function_int %p %uint_1 + %301 = OpLoad %int %300 + %302 = OpIMul %int %301 %int_16 + %303 = OpIAdd %int %299 %302 + %304 = OpAccessChain %_ptr_Private_int %map %303 + OpStore %304 %int_1 + %305 = OpAccessChain %_ptr_Function_int %p %uint_0 + %306 = OpLoad %int %305 + %307 = OpAccessChain %_ptr_Function_int %p %uint_1 + %308 = OpLoad %int %307 + %309 = OpISub %int %308 %int_1 + %310 = OpIMul %int %309 %int_16 + %311 = OpIAdd %int %306 %310 + %312 = OpAccessChain %_ptr_Private_int %map %311 + OpStore %312 %int_1 + %313 = OpAccessChain %_ptr_Function_int %p %uint_0 + %314 = OpLoad %int %313 + %315 = OpAccessChain %_ptr_Function_int %p %uint_1 + %316 = OpLoad %int %315 + %317 = OpISub %int %316 %int_2 + %318 = OpIMul %int %317 %int_16 + %319 = OpIAdd %int %314 %318 + %320 = OpAccessChain %_ptr_Private_int %map %319 + OpStore %320 %int_1 + %321 = OpAccessChain %_ptr_Function_int %p %uint_1 + %322 = OpLoad %int %321 + %323 = OpISub %int %322 %int_2 + %324 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %324 %323 + OpBranch %294 + %294 = OpLabel + %325 = OpLoad %int %d + %326 = OpSGreaterThanEqual %bool %325 %int_0 + OpSelectionMerge %327 None + OpBranchConditional %326 %328 %327 + %328 = OpLabel + %329 = OpAccessChain %_ptr_Function_int %p %uint_0 + %330 = OpLoad %int %329 + %331 = OpSLessThan %bool %330 %int_14 + OpBranch %327 + %327 = OpLabel + %332 = OpPhi %bool %326 %294 %331 %328 + OpSelectionMerge %333 None + OpBranchConditional %332 %334 %333 + %334 = OpLabel + %335 = OpAccessChain %_ptr_Function_int %p %uint_0 + %336 = OpLoad %int %335 + %337 = OpIAdd %int %336 %int_2 + %338 = OpAccessChain %_ptr_Function_int %p %uint_1 + %339 = OpLoad %int %338 + %340 = OpIMul %int %339 %int_16 + %341 = OpIAdd %int %337 %340 + %342 = OpAccessChain %_ptr_Private_int %map %341 + %343 = OpLoad %int %342 + %344 = OpIEqual %bool %343 %int_0 + OpBranch %333 + %333 = OpLabel + %345 = OpPhi %bool %332 %327 %344 %334 + OpSelectionMerge %346 None + OpBranchConditional %345 %347 %346 + %347 = OpLabel + %348 = OpLoad %int %d + %349 = OpISub %int %348 %int_1 + OpStore %d %349 + %350 = OpAccessChain %_ptr_Function_int %p %uint_0 + %351 = OpLoad %int %350 + %352 = OpAccessChain %_ptr_Function_int %p %uint_1 + %353 = OpLoad %int %352 + %354 = OpIMul %int %353 %int_16 + %355 = OpIAdd %int %351 %354 + %356 = OpAccessChain %_ptr_Private_int %map %355 + OpStore %356 %int_1 + %357 = OpAccessChain %_ptr_Function_int %p %uint_0 + %358 = OpLoad %int %357 + %359 = OpIAdd %int %358 %int_1 + %360 = OpAccessChain %_ptr_Function_int %p %uint_1 + %361 = OpLoad %int %360 + %362 = OpIMul %int %361 %int_16 + %363 = OpIAdd %int %359 %362 + %364 = OpAccessChain %_ptr_Private_int %map %363 + OpStore %364 %int_1 + %365 = OpAccessChain %_ptr_Function_int %p %uint_0 + %366 = OpLoad %int %365 + %367 = OpIAdd %int %366 %int_2 + %368 = OpAccessChain %_ptr_Function_int %p %uint_1 + %369 = OpLoad %int %368 + %370 = OpIMul %int %369 %int_16 + %371 = OpIAdd %int %367 %370 + %372 = OpAccessChain %_ptr_Private_int %map %371 + OpStore %372 %int_1 + %373 = OpAccessChain %_ptr_Function_int %p %uint_0 + %374 = OpLoad %int %373 + %375 = OpIAdd %int %374 %int_2 + %376 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %376 %375 + OpBranch %346 + %346 = OpLabel + %377 = OpLoad %int %d + %378 = OpSGreaterThanEqual %bool %377 %int_0 + OpSelectionMerge %379 None + OpBranchConditional %378 %380 %379 + %380 = OpLabel + %381 = OpAccessChain %_ptr_Function_int %p %uint_1 + %382 = OpLoad %int %381 + %383 = OpSLessThan %bool %382 %int_14 + OpBranch %379 + %379 = OpLabel + %384 = OpPhi %bool %378 %346 %383 %380 + OpSelectionMerge %385 None + OpBranchConditional %384 %386 %385 + %386 = OpLabel + %387 = OpAccessChain %_ptr_Function_int %p %uint_0 + %388 = OpLoad %int %387 + %389 = OpAccessChain %_ptr_Function_int %p %uint_1 + %390 = OpLoad %int %389 + %391 = OpIAdd %int %390 %int_2 + %392 = OpIMul %int %391 %int_16 + %393 = OpIAdd %int %388 %392 + %394 = OpAccessChain %_ptr_Private_int %map %393 + %395 = OpLoad %int %394 + %396 = OpIEqual %bool %395 %int_0 + OpBranch %385 + %385 = OpLabel + %397 = OpPhi %bool %384 %379 %396 %386 + OpSelectionMerge %398 None + OpBranchConditional %397 %399 %398 + %399 = OpLabel + %400 = OpLoad %int %d + %401 = OpISub %int %400 %int_1 + OpStore %d %401 + %402 = OpAccessChain %_ptr_Function_int %p %uint_0 + %403 = OpLoad %int %402 + %404 = OpAccessChain %_ptr_Function_int %p %uint_1 + %405 = OpLoad %int %404 + %406 = OpIMul %int %405 %int_16 + %407 = OpIAdd %int %403 %406 + %408 = OpAccessChain %_ptr_Private_int %map %407 + OpStore %408 %int_1 + %409 = OpAccessChain %_ptr_Function_int %p %uint_0 + %410 = OpLoad %int %409 + %411 = OpAccessChain %_ptr_Function_int %p %uint_1 + %412 = OpLoad %int %411 + %413 = OpIAdd %int %412 %int_1 + %414 = OpIMul %int %413 %int_16 + %415 = OpIAdd %int %410 %414 + %416 = OpAccessChain %_ptr_Private_int %map %415 + OpStore %416 %int_1 + %417 = OpAccessChain %_ptr_Function_int %p %uint_0 + %418 = OpLoad %int %417 + %419 = OpAccessChain %_ptr_Function_int %p %uint_1 + %420 = OpLoad %int %419 + %421 = OpIAdd %int %420 %int_2 + %422 = OpIMul %int %421 %int_16 + %423 = OpIAdd %int %418 %422 + %424 = OpAccessChain %_ptr_Private_int %map %423 + OpStore %424 %int_1 + %425 = OpAccessChain %_ptr_Function_int %p %uint_1 + %426 = OpLoad %int %425 + %427 = OpIAdd %int %426 %int_2 + %428 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %428 %427 + OpBranch %398 + %398 = OpLabel + OpBranch %170 + %170 = OpLabel + %429 = OpAccessChain %_ptr_Function_int %ipos %uint_1 + %430 = OpLoad %int %429 + %431 = OpIMul %int %430 %int_16 + %432 = OpAccessChain %_ptr_Function_int %ipos %uint_0 + %433 = OpLoad %int %432 + %434 = OpIAdd %int %431 %433 + %435 = OpAccessChain %_ptr_Private_int %map %434 + %436 = OpLoad %int %435 + %437 = OpIEqual %bool %436 %int_1 + OpSelectionMerge %438 None + OpBranchConditional %437 %439 %438 + %439 = OpLabel + OpStore %_GLF_color %53 + OpReturn + %438 = OpLabel + OpBranch %84 + %84 = OpLabel + %440 = OpLoad %bool %canwalk + OpBranchConditional %440 %82 %83 + %83 = OpLabel + OpStore %_GLF_color %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..a5177e1007 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.hlsl @@ -0,0 +1,292 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static int map[256] = (int[256])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int i = 0; + int2 p = int2(0, 0); + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + const float4 x_57 = gl_FragCoord; + const float2 x_60 = asfloat(x_7[0].xy); + pos = (float2(x_57.x, x_57.y) / x_60); + const float x_63 = pos.x; + const float x_67 = pos.y; + ipos = int2(int((x_63 * 16.0f)), int((x_67 * 16.0f))); + i = 0; + { + for(; (i < 256); i = (i + 1)) { + map[i] = 0; + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_102 = false; + bool x_122 = false; + bool x_142 = false; + bool x_162 = false; + bool x_103_phi = false; + bool x_123_phi = false; + bool x_143_phi = false; + bool x_163_phi = false; + v = (v + 1); + directions = 0; + const int x_89 = p.x; + const bool x_90 = (x_89 > 0); + x_103_phi = x_90; + if (x_90) { + const int x_94 = p.x; + const int x_97 = p.y; + const int x_101 = map[((x_94 - 2) + (x_97 * 16))]; + x_102 = (x_101 == 0); + x_103_phi = x_102; + } + if (x_103_phi) { + directions = (directions + 1); + } + const int x_109 = p.y; + const bool x_110 = (x_109 > 0); + x_123_phi = x_110; + if (x_110) { + const int x_114 = p.x; + const int x_116 = p.y; + const int x_121 = map[(x_114 + ((x_116 - 2) * 16))]; + x_122 = (x_121 == 0); + x_123_phi = x_122; + } + if (x_123_phi) { + directions = (directions + 1); + } + const int x_129 = p.x; + const bool x_130 = (x_129 < 14); + x_143_phi = x_130; + if (x_130) { + const int x_134 = p.x; + const int x_137 = p.y; + const int x_141 = map[((x_134 + 2) + (x_137 * 16))]; + x_142 = (x_141 == 0); + x_143_phi = x_142; + } + if (x_143_phi) { + directions = (directions + 1); + } + const int x_149 = p.y; + const bool x_150 = (x_149 < 14); + x_163_phi = x_150; + if (x_150) { + const int x_154 = p.x; + const int x_156 = p.y; + const int x_161 = map[(x_154 + ((x_156 + 2) * 16))]; + x_162 = (x_161 == 0); + x_163_phi = x_162; + } + if (x_163_phi) { + directions = (directions + 1); + } + bool x_227 = false; + bool x_240 = false; + bool x_279 = false; + bool x_292 = false; + bool x_331 = false; + bool x_344 = false; + bool x_383 = false; + bool x_396 = false; + bool x_228_phi = false; + bool x_241_phi = false; + bool x_280_phi = false; + bool x_293_phi = false; + bool x_332_phi = false; + bool x_345_phi = false; + bool x_384_phi = false; + bool x_397_phi = false; + if ((directions == 0)) { + canwalk = false; + i = 0; + { + for(; (i < 8); i = (i + 1)) { + j = 0; + { + for(; (j < 8); j = (j + 1)) { + const int x_194 = map[((j * 2) + ((i * 2) * 16))]; + if ((x_194 == 0)) { + p.x = (j * 2); + p.y = (i * 2); + canwalk = true; + } + } + } + } + } + const int x_209 = p.x; + const int x_211 = p.y; + map[(x_209 + (x_211 * 16))] = 1; + } else { + d = (v % directions); + v = (v + directions); + const bool x_222 = (d >= 0); + x_228_phi = x_222; + if (x_222) { + const int x_226 = p.x; + x_227 = (x_226 > 0); + x_228_phi = x_227; + } + const bool x_228 = x_228_phi; + x_241_phi = x_228; + if (x_228) { + const int x_232 = p.x; + const int x_235 = p.y; + const int x_239 = map[((x_232 - 2) + (x_235 * 16))]; + x_240 = (x_239 == 0); + x_241_phi = x_240; + } + if (x_241_phi) { + d = (d - 1); + const int x_247 = p.x; + const int x_249 = p.y; + map[(x_247 + (x_249 * 16))] = 1; + const int x_254 = p.x; + const int x_257 = p.y; + map[((x_254 - 1) + (x_257 * 16))] = 1; + const int x_262 = p.x; + const int x_265 = p.y; + map[((x_262 - 2) + (x_265 * 16))] = 1; + const int x_270 = p.x; + p.x = (x_270 - 2); + } + const bool x_274 = (d >= 0); + x_280_phi = x_274; + if (x_274) { + const int x_278 = p.y; + x_279 = (x_278 > 0); + x_280_phi = x_279; + } + const bool x_280 = x_280_phi; + x_293_phi = x_280; + if (x_280) { + const int x_284 = p.x; + const int x_286 = p.y; + const int x_291 = map[(x_284 + ((x_286 - 2) * 16))]; + x_292 = (x_291 == 0); + x_293_phi = x_292; + } + if (x_293_phi) { + d = (d - 1); + const int x_299 = p.x; + const int x_301 = p.y; + map[(x_299 + (x_301 * 16))] = 1; + const int x_306 = p.x; + const int x_308 = p.y; + map[(x_306 + ((x_308 - 1) * 16))] = 1; + const int x_314 = p.x; + const int x_316 = p.y; + map[(x_314 + ((x_316 - 2) * 16))] = 1; + const int x_322 = p.y; + p.y = (x_322 - 2); + } + const bool x_326 = (d >= 0); + x_332_phi = x_326; + if (x_326) { + const int x_330 = p.x; + x_331 = (x_330 < 14); + x_332_phi = x_331; + } + const bool x_332 = x_332_phi; + x_345_phi = x_332; + if (x_332) { + const int x_336 = p.x; + const int x_339 = p.y; + const int x_343 = map[((x_336 + 2) + (x_339 * 16))]; + x_344 = (x_343 == 0); + x_345_phi = x_344; + } + if (x_345_phi) { + d = (d - 1); + const int x_351 = p.x; + const int x_353 = p.y; + map[(x_351 + (x_353 * 16))] = 1; + const int x_358 = p.x; + const int x_361 = p.y; + map[((x_358 + 1) + (x_361 * 16))] = 1; + const int x_366 = p.x; + const int x_369 = p.y; + map[((x_366 + 2) + (x_369 * 16))] = 1; + const int x_374 = p.x; + p.x = (x_374 + 2); + } + const bool x_378 = (d >= 0); + x_384_phi = x_378; + if (x_378) { + const int x_382 = p.y; + x_383 = (x_382 < 14); + x_384_phi = x_383; + } + const bool x_384 = x_384_phi; + x_397_phi = x_384; + if (x_384) { + const int x_388 = p.x; + const int x_390 = p.y; + const int x_395 = map[(x_388 + ((x_390 + 2) * 16))]; + x_396 = (x_395 == 0); + x_397_phi = x_396; + } + if (x_397_phi) { + d = (d - 1); + const int x_403 = p.x; + const int x_405 = p.y; + map[(x_403 + (x_405 * 16))] = 1; + const int x_410 = p.x; + const int x_412 = p.y; + map[(x_410 + ((x_412 + 1) * 16))] = 1; + const int x_418 = p.x; + const int x_420 = p.y; + map[(x_418 + ((x_420 + 2) * 16))] = 1; + const int x_426 = p.y; + p.y = (x_426 + 2); + } + } + const int x_430 = ipos.y; + const int x_433 = ipos.x; + const int x_436 = map[((x_430 * 16) + x_433)]; + if ((x_436 == 1)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + if (canwalk) { + } else { + break; + } + } + } + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..e1df0f21d4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.msl @@ -0,0 +1,347 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6, thread float4* const tint_symbol_7) { + float2 pos = 0.0f; + int2 ipos = 0; + int i = 0; + int2 p = 0; + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + float4 const x_57 = *(tint_symbol_5); + float2 const x_60 = x_7.resolution; + pos = (float2(x_57.x, x_57.y) / x_60); + float const x_63 = pos.x; + float const x_67 = pos.y; + ipos = int2(int((x_63 * 16.0f)), int((x_67 * 16.0f))); + i = 0; + while (true) { + int const x_75 = i; + if ((x_75 < 256)) { + } else { + break; + } + int const x_78 = i; + (*(tint_symbol_6)).arr[x_78] = 0; + { + int const x_80 = i; + i = (x_80 + 1); + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_102 = false; + bool x_122 = false; + bool x_142 = false; + bool x_162 = false; + bool x_103_phi = false; + bool x_123_phi = false; + bool x_143_phi = false; + bool x_163_phi = false; + int const x_86 = v; + v = (x_86 + 1); + directions = 0; + int const x_89 = p.x; + bool const x_90 = (x_89 > 0); + x_103_phi = x_90; + if (x_90) { + int const x_94 = p.x; + int const x_97 = p.y; + int const x_101 = (*(tint_symbol_6)).arr[((x_94 - 2) + (x_97 * 16))]; + x_102 = (x_101 == 0); + x_103_phi = x_102; + } + bool const x_103 = x_103_phi; + if (x_103) { + int const x_106 = directions; + directions = (x_106 + 1); + } + int const x_109 = p.y; + bool const x_110 = (x_109 > 0); + x_123_phi = x_110; + if (x_110) { + int const x_114 = p.x; + int const x_116 = p.y; + int const x_121 = (*(tint_symbol_6)).arr[(x_114 + ((x_116 - 2) * 16))]; + x_122 = (x_121 == 0); + x_123_phi = x_122; + } + bool const x_123 = x_123_phi; + if (x_123) { + int const x_126 = directions; + directions = (x_126 + 1); + } + int const x_129 = p.x; + bool const x_130 = (x_129 < 14); + x_143_phi = x_130; + if (x_130) { + int const x_134 = p.x; + int const x_137 = p.y; + int const x_141 = (*(tint_symbol_6)).arr[((x_134 + 2) + (x_137 * 16))]; + x_142 = (x_141 == 0); + x_143_phi = x_142; + } + bool const x_143 = x_143_phi; + if (x_143) { + int const x_146 = directions; + directions = (x_146 + 1); + } + int const x_149 = p.y; + bool const x_150 = (x_149 < 14); + x_163_phi = x_150; + if (x_150) { + int const x_154 = p.x; + int const x_156 = p.y; + int const x_161 = (*(tint_symbol_6)).arr[(x_154 + ((x_156 + 2) * 16))]; + x_162 = (x_161 == 0); + x_163_phi = x_162; + } + bool const x_163 = x_163_phi; + if (x_163) { + int const x_166 = directions; + directions = (x_166 + 1); + } + bool x_227 = false; + bool x_240 = false; + bool x_279 = false; + bool x_292 = false; + bool x_331 = false; + bool x_344 = false; + bool x_383 = false; + bool x_396 = false; + bool x_228_phi = false; + bool x_241_phi = false; + bool x_280_phi = false; + bool x_293_phi = false; + bool x_332_phi = false; + bool x_345_phi = false; + bool x_384_phi = false; + bool x_397_phi = false; + int const x_168 = directions; + if ((x_168 == 0)) { + canwalk = false; + i = 0; + while (true) { + int const x_177 = i; + if ((x_177 < 8)) { + } else { + break; + } + j = 0; + while (true) { + int const x_184 = j; + if ((x_184 < 8)) { + } else { + break; + } + int const x_187 = j; + int const x_189 = i; + int const x_194 = (*(tint_symbol_6)).arr[((x_187 * 2) + ((x_189 * 2) * 16))]; + if ((x_194 == 0)) { + int const x_198 = j; + p.x = (x_198 * 2); + int const x_201 = i; + p.y = (x_201 * 2); + canwalk = true; + } + { + int const x_204 = j; + j = (x_204 + 1); + } + } + { + int const x_206 = i; + i = (x_206 + 1); + } + } + int const x_209 = p.x; + int const x_211 = p.y; + (*(tint_symbol_6)).arr[(x_209 + (x_211 * 16))] = 1; + } else { + int const x_215 = v; + int const x_216 = directions; + d = (x_215 % x_216); + int const x_218 = directions; + int const x_219 = v; + v = (x_219 + x_218); + int const x_221 = d; + bool const x_222 = (x_221 >= 0); + x_228_phi = x_222; + if (x_222) { + int const x_226 = p.x; + x_227 = (x_226 > 0); + x_228_phi = x_227; + } + bool const x_228 = x_228_phi; + x_241_phi = x_228; + if (x_228) { + int const x_232 = p.x; + int const x_235 = p.y; + int const x_239 = (*(tint_symbol_6)).arr[((x_232 - 2) + (x_235 * 16))]; + x_240 = (x_239 == 0); + x_241_phi = x_240; + } + bool const x_241 = x_241_phi; + if (x_241) { + int const x_244 = d; + d = (x_244 - 1); + int const x_247 = p.x; + int const x_249 = p.y; + (*(tint_symbol_6)).arr[(x_247 + (x_249 * 16))] = 1; + int const x_254 = p.x; + int const x_257 = p.y; + (*(tint_symbol_6)).arr[((x_254 - 1) + (x_257 * 16))] = 1; + int const x_262 = p.x; + int const x_265 = p.y; + (*(tint_symbol_6)).arr[((x_262 - 2) + (x_265 * 16))] = 1; + int const x_270 = p.x; + p.x = (x_270 - 2); + } + int const x_273 = d; + bool const x_274 = (x_273 >= 0); + x_280_phi = x_274; + if (x_274) { + int const x_278 = p.y; + x_279 = (x_278 > 0); + x_280_phi = x_279; + } + bool const x_280 = x_280_phi; + x_293_phi = x_280; + if (x_280) { + int const x_284 = p.x; + int const x_286 = p.y; + int const x_291 = (*(tint_symbol_6)).arr[(x_284 + ((x_286 - 2) * 16))]; + x_292 = (x_291 == 0); + x_293_phi = x_292; + } + bool const x_293 = x_293_phi; + if (x_293) { + int const x_296 = d; + d = (x_296 - 1); + int const x_299 = p.x; + int const x_301 = p.y; + (*(tint_symbol_6)).arr[(x_299 + (x_301 * 16))] = 1; + int const x_306 = p.x; + int const x_308 = p.y; + (*(tint_symbol_6)).arr[(x_306 + ((x_308 - 1) * 16))] = 1; + int const x_314 = p.x; + int const x_316 = p.y; + (*(tint_symbol_6)).arr[(x_314 + ((x_316 - 2) * 16))] = 1; + int const x_322 = p.y; + p.y = (x_322 - 2); + } + int const x_325 = d; + bool const x_326 = (x_325 >= 0); + x_332_phi = x_326; + if (x_326) { + int const x_330 = p.x; + x_331 = (x_330 < 14); + x_332_phi = x_331; + } + bool const x_332 = x_332_phi; + x_345_phi = x_332; + if (x_332) { + int const x_336 = p.x; + int const x_339 = p.y; + int const x_343 = (*(tint_symbol_6)).arr[((x_336 + 2) + (x_339 * 16))]; + x_344 = (x_343 == 0); + x_345_phi = x_344; + } + bool const x_345 = x_345_phi; + if (x_345) { + int const x_348 = d; + d = (x_348 - 1); + int const x_351 = p.x; + int const x_353 = p.y; + (*(tint_symbol_6)).arr[(x_351 + (x_353 * 16))] = 1; + int const x_358 = p.x; + int const x_361 = p.y; + (*(tint_symbol_6)).arr[((x_358 + 1) + (x_361 * 16))] = 1; + int const x_366 = p.x; + int const x_369 = p.y; + (*(tint_symbol_6)).arr[((x_366 + 2) + (x_369 * 16))] = 1; + int const x_374 = p.x; + p.x = (x_374 + 2); + } + int const x_377 = d; + bool const x_378 = (x_377 >= 0); + x_384_phi = x_378; + if (x_378) { + int const x_382 = p.y; + x_383 = (x_382 < 14); + x_384_phi = x_383; + } + bool const x_384 = x_384_phi; + x_397_phi = x_384; + if (x_384) { + int const x_388 = p.x; + int const x_390 = p.y; + int const x_395 = (*(tint_symbol_6)).arr[(x_388 + ((x_390 + 2) * 16))]; + x_396 = (x_395 == 0); + x_397_phi = x_396; + } + bool const x_397 = x_397_phi; + if (x_397) { + int const x_400 = d; + d = (x_400 - 1); + int const x_403 = p.x; + int const x_405 = p.y; + (*(tint_symbol_6)).arr[(x_403 + (x_405 * 16))] = 1; + int const x_410 = p.x; + int const x_412 = p.y; + (*(tint_symbol_6)).arr[(x_410 + ((x_412 + 1) * 16))] = 1; + int const x_418 = p.x; + int const x_420 = p.y; + (*(tint_symbol_6)).arr[(x_418 + ((x_420 + 2) * 16))] = 1; + int const x_426 = p.y; + p.y = (x_426 + 2); + } + } + int const x_430 = ipos.y; + int const x_433 = ipos.x; + int const x_436 = (*(tint_symbol_6)).arr[((x_430 * 16) + x_433)]; + if ((x_436 == 1)) { + *(tint_symbol_7) = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + bool const x_440 = canwalk; + if (x_440) { + } else { + break; + } + } + } + *(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread tint_array_wrapper tint_symbol_9 = {}; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_8), &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4613f9f74f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.spvasm @@ -0,0 +1,775 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 509 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %map "map" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %ipos "ipos" + OpName %i "i" + OpName %p "p" + OpName %canwalk "canwalk" + OpName %v "v" + OpName %directions "directions" + OpName %j "j" + OpName %d "d" + OpName %x_102 "x_102" + OpName %x_122 "x_122" + OpName %x_142 "x_142" + OpName %x_162 "x_162" + OpName %x_103_phi "x_103_phi" + OpName %x_123_phi "x_123_phi" + OpName %x_143_phi "x_143_phi" + OpName %x_163_phi "x_163_phi" + OpName %x_227 "x_227" + OpName %x_240 "x_240" + OpName %x_279 "x_279" + OpName %x_292 "x_292" + OpName %x_331 "x_331" + OpName %x_344 "x_344" + OpName %x_383 "x_383" + OpName %x_396 "x_396" + OpName %x_228_phi "x_228_phi" + OpName %x_241_phi "x_241_phi" + OpName %x_280_phi "x_280_phi" + OpName %x_293_phi "x_293_phi" + OpName %x_332_phi "x_332_phi" + OpName %x_345_phi "x_345_phi" + OpName %x_384_phi "x_384_phi" + OpName %x_397_phi "x_397_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Private__arr_int_uint_256 = OpTypePointer Private %_arr_int_uint_256 + %16 = OpConstantNull %_arr_int_uint_256 + %map = OpVariable %_ptr_Private__arr_int_uint_256 Private %16 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %28 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %32 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_16 = OpConstant %float 16 + %int_0 = OpConstant %int 0 + %int_256 = OpConstant %int 256 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %83 = OpConstantComposite %v2int %int_0 %int_0 + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %int_16 = OpConstant %int 16 + %int_14 = OpConstant %int 14 + %false = OpConstantFalse %bool + %int_8 = OpConstant %int 8 + %float_1 = OpConstant %float 1 + %489 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %495 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %496 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %28 + %ipos = OpVariable %_ptr_Function_v2int Function %32 + %i = OpVariable %_ptr_Function_int Function %35 + %p = OpVariable %_ptr_Function_v2int Function %32 + %canwalk = OpVariable %_ptr_Function_bool Function %40 + %v = OpVariable %_ptr_Function_int Function %35 + %directions = OpVariable %_ptr_Function_int Function %35 + %j = OpVariable %_ptr_Function_int Function %35 + %d = OpVariable %_ptr_Function_int Function %35 + %x_102 = OpVariable %_ptr_Function_bool Function %40 + %x_122 = OpVariable %_ptr_Function_bool Function %40 + %x_142 = OpVariable %_ptr_Function_bool Function %40 + %x_162 = OpVariable %_ptr_Function_bool Function %40 + %x_103_phi = OpVariable %_ptr_Function_bool Function %40 + %x_123_phi = OpVariable %_ptr_Function_bool Function %40 + %x_143_phi = OpVariable %_ptr_Function_bool Function %40 + %x_163_phi = OpVariable %_ptr_Function_bool Function %40 + %x_227 = OpVariable %_ptr_Function_bool Function %40 + %x_240 = OpVariable %_ptr_Function_bool Function %40 + %x_279 = OpVariable %_ptr_Function_bool Function %40 + %x_292 = OpVariable %_ptr_Function_bool Function %40 + %x_331 = OpVariable %_ptr_Function_bool Function %40 + %x_344 = OpVariable %_ptr_Function_bool Function %40 + %x_383 = OpVariable %_ptr_Function_bool Function %40 + %x_396 = OpVariable %_ptr_Function_bool Function %40 + %x_228_phi = OpVariable %_ptr_Function_bool Function %40 + %x_241_phi = OpVariable %_ptr_Function_bool Function %40 + %x_280_phi = OpVariable %_ptr_Function_bool Function %40 + %x_293_phi = OpVariable %_ptr_Function_bool Function %40 + %x_332_phi = OpVariable %_ptr_Function_bool Function %40 + %x_345_phi = OpVariable %_ptr_Function_bool Function %40 + %x_384_phi = OpVariable %_ptr_Function_bool Function %40 + %x_397_phi = OpVariable %_ptr_Function_bool Function %40 + %45 = OpLoad %v4float %gl_FragCoord + %48 = OpAccessChain %_ptr_Uniform_v2float %x_7 %uint_0 + %49 = OpLoad %v2float %48 + %50 = OpCompositeExtract %float %45 0 + %51 = OpCompositeExtract %float %45 1 + %52 = OpCompositeConstruct %v2float %50 %51 + %53 = OpFDiv %v2float %52 %49 + OpStore %pos %53 + %55 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %59 = OpLoad %float %58 + %62 = OpFMul %float %56 %float_16 + %60 = OpConvertFToS %int %62 + %64 = OpFMul %float %59 %float_16 + %63 = OpConvertFToS %int %64 + %65 = OpCompositeConstruct %v2int %60 %63 + OpStore %ipos %65 + OpStore %i %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %i + %73 = OpSLessThan %bool %71 %int_256 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %74 + %76 = OpLabel + OpBranch %68 + %74 = OpLabel + %77 = OpLoad %int %i + %79 = OpAccessChain %_ptr_Private_int %map %77 + OpStore %79 %int_0 + OpBranch %69 + %69 = OpLabel + %80 = OpLoad %int %i + %82 = OpIAdd %int %80 %int_1 + OpStore %i %82 + OpBranch %67 + %68 = OpLabel + OpStore %p %83 + OpStore %canwalk %true + OpStore %v %int_0 + OpBranch %85 + %85 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %97 = OpLoad %int %v + %98 = OpIAdd %int %97 %int_1 + OpStore %v %98 + OpStore %directions %int_0 + %99 = OpAccessChain %_ptr_Function_int %p %uint_0 + %100 = OpLoad %int %99 + %101 = OpSGreaterThan %bool %100 %int_0 + OpStore %x_103_phi %101 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + %104 = OpAccessChain %_ptr_Function_int %p %uint_0 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Function_int %p %uint_1 + %107 = OpLoad %int %106 + %109 = OpISub %int %105 %int_2 + %111 = OpIMul %int %107 %int_16 + %112 = OpIAdd %int %109 %111 + %113 = OpAccessChain %_ptr_Private_int %map %112 + %114 = OpLoad %int %113 + %115 = OpIEqual %bool %114 %int_0 + OpStore %x_102 %115 + %116 = OpLoad %bool %x_102 + OpStore %x_103_phi %116 + OpBranch %102 + %102 = OpLabel + %117 = OpLoad %bool %x_103_phi + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %120 = OpLoad %int %directions + %121 = OpIAdd %int %120 %int_1 + OpStore %directions %121 + OpBranch %118 + %118 = OpLabel + %122 = OpAccessChain %_ptr_Function_int %p %uint_1 + %123 = OpLoad %int %122 + %124 = OpSGreaterThan %bool %123 %int_0 + OpStore %x_123_phi %124 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %125 + %126 = OpLabel + %127 = OpAccessChain %_ptr_Function_int %p %uint_0 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Function_int %p %uint_1 + %130 = OpLoad %int %129 + %131 = OpISub %int %130 %int_2 + %132 = OpIMul %int %131 %int_16 + %133 = OpIAdd %int %128 %132 + %134 = OpAccessChain %_ptr_Private_int %map %133 + %135 = OpLoad %int %134 + %136 = OpIEqual %bool %135 %int_0 + OpStore %x_122 %136 + %137 = OpLoad %bool %x_122 + OpStore %x_123_phi %137 + OpBranch %125 + %125 = OpLabel + %138 = OpLoad %bool %x_123_phi + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpLoad %int %directions + %142 = OpIAdd %int %141 %int_1 + OpStore %directions %142 + OpBranch %139 + %139 = OpLabel + %143 = OpAccessChain %_ptr_Function_int %p %uint_0 + %144 = OpLoad %int %143 + %146 = OpSLessThan %bool %144 %int_14 + OpStore %x_143_phi %146 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %147 + %148 = OpLabel + %149 = OpAccessChain %_ptr_Function_int %p %uint_0 + %150 = OpLoad %int %149 + %151 = OpAccessChain %_ptr_Function_int %p %uint_1 + %152 = OpLoad %int %151 + %153 = OpIAdd %int %150 %int_2 + %154 = OpIMul %int %152 %int_16 + %155 = OpIAdd %int %153 %154 + %156 = OpAccessChain %_ptr_Private_int %map %155 + %157 = OpLoad %int %156 + %158 = OpIEqual %bool %157 %int_0 + OpStore %x_142 %158 + %159 = OpLoad %bool %x_142 + OpStore %x_143_phi %159 + OpBranch %147 + %147 = OpLabel + %160 = OpLoad %bool %x_143_phi + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %161 + %162 = OpLabel + %163 = OpLoad %int %directions + %164 = OpIAdd %int %163 %int_1 + OpStore %directions %164 + OpBranch %161 + %161 = OpLabel + %165 = OpAccessChain %_ptr_Function_int %p %uint_1 + %166 = OpLoad %int %165 + %167 = OpSLessThan %bool %166 %int_14 + OpStore %x_163_phi %167 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %168 + %169 = OpLabel + %170 = OpAccessChain %_ptr_Function_int %p %uint_0 + %171 = OpLoad %int %170 + %172 = OpAccessChain %_ptr_Function_int %p %uint_1 + %173 = OpLoad %int %172 + %174 = OpIAdd %int %173 %int_2 + %175 = OpIMul %int %174 %int_16 + %176 = OpIAdd %int %171 %175 + %177 = OpAccessChain %_ptr_Private_int %map %176 + %178 = OpLoad %int %177 + %179 = OpIEqual %bool %178 %int_0 + OpStore %x_162 %179 + %180 = OpLoad %bool %x_162 + OpStore %x_163_phi %180 + OpBranch %168 + %168 = OpLabel + %181 = OpLoad %bool %x_163_phi + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %184 = OpLoad %int %directions + %185 = OpIAdd %int %184 %int_1 + OpStore %directions %185 + OpBranch %182 + %182 = OpLabel + %202 = OpLoad %int %directions + %203 = OpIEqual %bool %202 %int_0 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %206 + %205 = OpLabel + OpStore %canwalk %false + OpStore %i %int_0 + OpBranch %208 + %208 = OpLabel + OpLoopMerge %209 %210 None + OpBranch %211 + %211 = OpLabel + %212 = OpLoad %int %i + %214 = OpSLessThan %bool %212 %int_8 + OpSelectionMerge %215 None + OpBranchConditional %214 %216 %217 + %216 = OpLabel + OpBranch %215 + %217 = OpLabel + OpBranch %209 + %215 = OpLabel + OpStore %j %int_0 + OpBranch %218 + %218 = OpLabel + OpLoopMerge %219 %220 None + OpBranch %221 + %221 = OpLabel + %222 = OpLoad %int %j + %223 = OpSLessThan %bool %222 %int_8 + OpSelectionMerge %224 None + OpBranchConditional %223 %225 %226 + %225 = OpLabel + OpBranch %224 + %226 = OpLabel + OpBranch %219 + %224 = OpLabel + %227 = OpLoad %int %j + %228 = OpLoad %int %i + %229 = OpIMul %int %227 %int_2 + %230 = OpIMul %int %228 %int_2 + %231 = OpIMul %int %230 %int_16 + %232 = OpIAdd %int %229 %231 + %233 = OpAccessChain %_ptr_Private_int %map %232 + %234 = OpLoad %int %233 + %235 = OpIEqual %bool %234 %int_0 + OpSelectionMerge %236 None + OpBranchConditional %235 %237 %236 + %237 = OpLabel + %238 = OpLoad %int %j + %239 = OpAccessChain %_ptr_Function_int %p %uint_0 + %240 = OpIMul %int %238 %int_2 + OpStore %239 %240 + %241 = OpLoad %int %i + %242 = OpAccessChain %_ptr_Function_int %p %uint_1 + %243 = OpIMul %int %241 %int_2 + OpStore %242 %243 + OpStore %canwalk %true + OpBranch %236 + %236 = OpLabel + OpBranch %220 + %220 = OpLabel + %244 = OpLoad %int %j + %245 = OpIAdd %int %244 %int_1 + OpStore %j %245 + OpBranch %218 + %219 = OpLabel + OpBranch %210 + %210 = OpLabel + %246 = OpLoad %int %i + %247 = OpIAdd %int %246 %int_1 + OpStore %i %247 + OpBranch %208 + %209 = OpLabel + %248 = OpAccessChain %_ptr_Function_int %p %uint_0 + %249 = OpLoad %int %248 + %250 = OpAccessChain %_ptr_Function_int %p %uint_1 + %251 = OpLoad %int %250 + %252 = OpIMul %int %251 %int_16 + %253 = OpIAdd %int %249 %252 + %254 = OpAccessChain %_ptr_Private_int %map %253 + OpStore %254 %int_1 + OpBranch %204 + %206 = OpLabel + %255 = OpLoad %int %v + %256 = OpLoad %int %directions + %257 = OpSMod %int %255 %256 + OpStore %d %257 + %258 = OpLoad %int %directions + %259 = OpLoad %int %v + %260 = OpIAdd %int %259 %258 + OpStore %v %260 + %261 = OpLoad %int %d + %262 = OpSGreaterThanEqual %bool %261 %int_0 + OpStore %x_228_phi %262 + OpSelectionMerge %263 None + OpBranchConditional %262 %264 %263 + %264 = OpLabel + %265 = OpAccessChain %_ptr_Function_int %p %uint_0 + %266 = OpLoad %int %265 + %267 = OpSGreaterThan %bool %266 %int_0 + OpStore %x_227 %267 + %268 = OpLoad %bool %x_227 + OpStore %x_228_phi %268 + OpBranch %263 + %263 = OpLabel + %269 = OpLoad %bool %x_228_phi + OpStore %x_241_phi %269 + OpSelectionMerge %270 None + OpBranchConditional %269 %271 %270 + %271 = OpLabel + %272 = OpAccessChain %_ptr_Function_int %p %uint_0 + %273 = OpLoad %int %272 + %274 = OpAccessChain %_ptr_Function_int %p %uint_1 + %275 = OpLoad %int %274 + %276 = OpISub %int %273 %int_2 + %277 = OpIMul %int %275 %int_16 + %278 = OpIAdd %int %276 %277 + %279 = OpAccessChain %_ptr_Private_int %map %278 + %280 = OpLoad %int %279 + %281 = OpIEqual %bool %280 %int_0 + OpStore %x_240 %281 + %282 = OpLoad %bool %x_240 + OpStore %x_241_phi %282 + OpBranch %270 + %270 = OpLabel + %283 = OpLoad %bool %x_241_phi + OpSelectionMerge %284 None + OpBranchConditional %283 %285 %284 + %285 = OpLabel + %286 = OpLoad %int %d + %287 = OpISub %int %286 %int_1 + OpStore %d %287 + %288 = OpAccessChain %_ptr_Function_int %p %uint_0 + %289 = OpLoad %int %288 + %290 = OpAccessChain %_ptr_Function_int %p %uint_1 + %291 = OpLoad %int %290 + %292 = OpIMul %int %291 %int_16 + %293 = OpIAdd %int %289 %292 + %294 = OpAccessChain %_ptr_Private_int %map %293 + OpStore %294 %int_1 + %295 = OpAccessChain %_ptr_Function_int %p %uint_0 + %296 = OpLoad %int %295 + %297 = OpAccessChain %_ptr_Function_int %p %uint_1 + %298 = OpLoad %int %297 + %299 = OpISub %int %296 %int_1 + %300 = OpIMul %int %298 %int_16 + %301 = OpIAdd %int %299 %300 + %302 = OpAccessChain %_ptr_Private_int %map %301 + OpStore %302 %int_1 + %303 = OpAccessChain %_ptr_Function_int %p %uint_0 + %304 = OpLoad %int %303 + %305 = OpAccessChain %_ptr_Function_int %p %uint_1 + %306 = OpLoad %int %305 + %307 = OpISub %int %304 %int_2 + %308 = OpIMul %int %306 %int_16 + %309 = OpIAdd %int %307 %308 + %310 = OpAccessChain %_ptr_Private_int %map %309 + OpStore %310 %int_1 + %311 = OpAccessChain %_ptr_Function_int %p %uint_0 + %312 = OpLoad %int %311 + %313 = OpAccessChain %_ptr_Function_int %p %uint_0 + %314 = OpISub %int %312 %int_2 + OpStore %313 %314 + OpBranch %284 + %284 = OpLabel + %315 = OpLoad %int %d + %316 = OpSGreaterThanEqual %bool %315 %int_0 + OpStore %x_280_phi %316 + OpSelectionMerge %317 None + OpBranchConditional %316 %318 %317 + %318 = OpLabel + %319 = OpAccessChain %_ptr_Function_int %p %uint_1 + %320 = OpLoad %int %319 + %321 = OpSGreaterThan %bool %320 %int_0 + OpStore %x_279 %321 + %322 = OpLoad %bool %x_279 + OpStore %x_280_phi %322 + OpBranch %317 + %317 = OpLabel + %323 = OpLoad %bool %x_280_phi + OpStore %x_293_phi %323 + OpSelectionMerge %324 None + OpBranchConditional %323 %325 %324 + %325 = OpLabel + %326 = OpAccessChain %_ptr_Function_int %p %uint_0 + %327 = OpLoad %int %326 + %328 = OpAccessChain %_ptr_Function_int %p %uint_1 + %329 = OpLoad %int %328 + %330 = OpISub %int %329 %int_2 + %331 = OpIMul %int %330 %int_16 + %332 = OpIAdd %int %327 %331 + %333 = OpAccessChain %_ptr_Private_int %map %332 + %334 = OpLoad %int %333 + %335 = OpIEqual %bool %334 %int_0 + OpStore %x_292 %335 + %336 = OpLoad %bool %x_292 + OpStore %x_293_phi %336 + OpBranch %324 + %324 = OpLabel + %337 = OpLoad %bool %x_293_phi + OpSelectionMerge %338 None + OpBranchConditional %337 %339 %338 + %339 = OpLabel + %340 = OpLoad %int %d + %341 = OpISub %int %340 %int_1 + OpStore %d %341 + %342 = OpAccessChain %_ptr_Function_int %p %uint_0 + %343 = OpLoad %int %342 + %344 = OpAccessChain %_ptr_Function_int %p %uint_1 + %345 = OpLoad %int %344 + %346 = OpIMul %int %345 %int_16 + %347 = OpIAdd %int %343 %346 + %348 = OpAccessChain %_ptr_Private_int %map %347 + OpStore %348 %int_1 + %349 = OpAccessChain %_ptr_Function_int %p %uint_0 + %350 = OpLoad %int %349 + %351 = OpAccessChain %_ptr_Function_int %p %uint_1 + %352 = OpLoad %int %351 + %353 = OpISub %int %352 %int_1 + %354 = OpIMul %int %353 %int_16 + %355 = OpIAdd %int %350 %354 + %356 = OpAccessChain %_ptr_Private_int %map %355 + OpStore %356 %int_1 + %357 = OpAccessChain %_ptr_Function_int %p %uint_0 + %358 = OpLoad %int %357 + %359 = OpAccessChain %_ptr_Function_int %p %uint_1 + %360 = OpLoad %int %359 + %361 = OpISub %int %360 %int_2 + %362 = OpIMul %int %361 %int_16 + %363 = OpIAdd %int %358 %362 + %364 = OpAccessChain %_ptr_Private_int %map %363 + OpStore %364 %int_1 + %365 = OpAccessChain %_ptr_Function_int %p %uint_1 + %366 = OpLoad %int %365 + %367 = OpAccessChain %_ptr_Function_int %p %uint_1 + %368 = OpISub %int %366 %int_2 + OpStore %367 %368 + OpBranch %338 + %338 = OpLabel + %369 = OpLoad %int %d + %370 = OpSGreaterThanEqual %bool %369 %int_0 + OpStore %x_332_phi %370 + OpSelectionMerge %371 None + OpBranchConditional %370 %372 %371 + %372 = OpLabel + %373 = OpAccessChain %_ptr_Function_int %p %uint_0 + %374 = OpLoad %int %373 + %375 = OpSLessThan %bool %374 %int_14 + OpStore %x_331 %375 + %376 = OpLoad %bool %x_331 + OpStore %x_332_phi %376 + OpBranch %371 + %371 = OpLabel + %377 = OpLoad %bool %x_332_phi + OpStore %x_345_phi %377 + OpSelectionMerge %378 None + OpBranchConditional %377 %379 %378 + %379 = OpLabel + %380 = OpAccessChain %_ptr_Function_int %p %uint_0 + %381 = OpLoad %int %380 + %382 = OpAccessChain %_ptr_Function_int %p %uint_1 + %383 = OpLoad %int %382 + %384 = OpIAdd %int %381 %int_2 + %385 = OpIMul %int %383 %int_16 + %386 = OpIAdd %int %384 %385 + %387 = OpAccessChain %_ptr_Private_int %map %386 + %388 = OpLoad %int %387 + %389 = OpIEqual %bool %388 %int_0 + OpStore %x_344 %389 + %390 = OpLoad %bool %x_344 + OpStore %x_345_phi %390 + OpBranch %378 + %378 = OpLabel + %391 = OpLoad %bool %x_345_phi + OpSelectionMerge %392 None + OpBranchConditional %391 %393 %392 + %393 = OpLabel + %394 = OpLoad %int %d + %395 = OpISub %int %394 %int_1 + OpStore %d %395 + %396 = OpAccessChain %_ptr_Function_int %p %uint_0 + %397 = OpLoad %int %396 + %398 = OpAccessChain %_ptr_Function_int %p %uint_1 + %399 = OpLoad %int %398 + %400 = OpIMul %int %399 %int_16 + %401 = OpIAdd %int %397 %400 + %402 = OpAccessChain %_ptr_Private_int %map %401 + OpStore %402 %int_1 + %403 = OpAccessChain %_ptr_Function_int %p %uint_0 + %404 = OpLoad %int %403 + %405 = OpAccessChain %_ptr_Function_int %p %uint_1 + %406 = OpLoad %int %405 + %407 = OpIAdd %int %404 %int_1 + %408 = OpIMul %int %406 %int_16 + %409 = OpIAdd %int %407 %408 + %410 = OpAccessChain %_ptr_Private_int %map %409 + OpStore %410 %int_1 + %411 = OpAccessChain %_ptr_Function_int %p %uint_0 + %412 = OpLoad %int %411 + %413 = OpAccessChain %_ptr_Function_int %p %uint_1 + %414 = OpLoad %int %413 + %415 = OpIAdd %int %412 %int_2 + %416 = OpIMul %int %414 %int_16 + %417 = OpIAdd %int %415 %416 + %418 = OpAccessChain %_ptr_Private_int %map %417 + OpStore %418 %int_1 + %419 = OpAccessChain %_ptr_Function_int %p %uint_0 + %420 = OpLoad %int %419 + %421 = OpAccessChain %_ptr_Function_int %p %uint_0 + %422 = OpIAdd %int %420 %int_2 + OpStore %421 %422 + OpBranch %392 + %392 = OpLabel + %423 = OpLoad %int %d + %424 = OpSGreaterThanEqual %bool %423 %int_0 + OpStore %x_384_phi %424 + OpSelectionMerge %425 None + OpBranchConditional %424 %426 %425 + %426 = OpLabel + %427 = OpAccessChain %_ptr_Function_int %p %uint_1 + %428 = OpLoad %int %427 + %429 = OpSLessThan %bool %428 %int_14 + OpStore %x_383 %429 + %430 = OpLoad %bool %x_383 + OpStore %x_384_phi %430 + OpBranch %425 + %425 = OpLabel + %431 = OpLoad %bool %x_384_phi + OpStore %x_397_phi %431 + OpSelectionMerge %432 None + OpBranchConditional %431 %433 %432 + %433 = OpLabel + %434 = OpAccessChain %_ptr_Function_int %p %uint_0 + %435 = OpLoad %int %434 + %436 = OpAccessChain %_ptr_Function_int %p %uint_1 + %437 = OpLoad %int %436 + %438 = OpIAdd %int %437 %int_2 + %439 = OpIMul %int %438 %int_16 + %440 = OpIAdd %int %435 %439 + %441 = OpAccessChain %_ptr_Private_int %map %440 + %442 = OpLoad %int %441 + %443 = OpIEqual %bool %442 %int_0 + OpStore %x_396 %443 + %444 = OpLoad %bool %x_396 + OpStore %x_397_phi %444 + OpBranch %432 + %432 = OpLabel + %445 = OpLoad %bool %x_397_phi + OpSelectionMerge %446 None + OpBranchConditional %445 %447 %446 + %447 = OpLabel + %448 = OpLoad %int %d + %449 = OpISub %int %448 %int_1 + OpStore %d %449 + %450 = OpAccessChain %_ptr_Function_int %p %uint_0 + %451 = OpLoad %int %450 + %452 = OpAccessChain %_ptr_Function_int %p %uint_1 + %453 = OpLoad %int %452 + %454 = OpIMul %int %453 %int_16 + %455 = OpIAdd %int %451 %454 + %456 = OpAccessChain %_ptr_Private_int %map %455 + OpStore %456 %int_1 + %457 = OpAccessChain %_ptr_Function_int %p %uint_0 + %458 = OpLoad %int %457 + %459 = OpAccessChain %_ptr_Function_int %p %uint_1 + %460 = OpLoad %int %459 + %461 = OpIAdd %int %460 %int_1 + %462 = OpIMul %int %461 %int_16 + %463 = OpIAdd %int %458 %462 + %464 = OpAccessChain %_ptr_Private_int %map %463 + OpStore %464 %int_1 + %465 = OpAccessChain %_ptr_Function_int %p %uint_0 + %466 = OpLoad %int %465 + %467 = OpAccessChain %_ptr_Function_int %p %uint_1 + %468 = OpLoad %int %467 + %469 = OpIAdd %int %468 %int_2 + %470 = OpIMul %int %469 %int_16 + %471 = OpIAdd %int %466 %470 + %472 = OpAccessChain %_ptr_Private_int %map %471 + OpStore %472 %int_1 + %473 = OpAccessChain %_ptr_Function_int %p %uint_1 + %474 = OpLoad %int %473 + %475 = OpAccessChain %_ptr_Function_int %p %uint_1 + %476 = OpIAdd %int %474 %int_2 + OpStore %475 %476 + OpBranch %446 + %446 = OpLabel + OpBranch %204 + %204 = OpLabel + %477 = OpAccessChain %_ptr_Function_int %ipos %uint_1 + %478 = OpLoad %int %477 + %479 = OpAccessChain %_ptr_Function_int %ipos %uint_0 + %480 = OpLoad %int %479 + %481 = OpIMul %int %478 %int_16 + %482 = OpIAdd %int %481 %480 + %483 = OpAccessChain %_ptr_Private_int %map %482 + %484 = OpLoad %int %483 + %485 = OpIEqual %bool %484 %int_1 + OpSelectionMerge %486 None + OpBranchConditional %485 %487 %486 + %487 = OpLabel + OpStore %x_GLF_color %489 + OpReturn + %486 = OpLabel + OpBranch %87 + %87 = OpLabel + %490 = OpLoad %bool %canwalk + OpSelectionMerge %491 None + OpBranchConditional %490 %492 %493 + %492 = OpLabel + OpBranch %491 + %493 = OpLabel + OpBranch %86 + %491 = OpLabel + OpBranch %85 + %86 = OpLabel + OpStore %x_GLF_color %495 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %496 +%tint_symbol_1 = OpFunctionParameter %main_out + %500 = OpLabel + %501 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %501 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %503 = OpLabel + %504 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %504 + %505 = OpFunctionCall %void %main_1 + %507 = OpLoad %v4float %x_GLF_color + %508 = OpCompositeConstruct %main_out %507 + %506 = OpFunctionCall %void %tint_symbol_3 %508 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 87[%87] is not post dominated by the back-edge block 491[%491] + %491 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..4128fb76d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.spvasm.expected.wgsl @@ -0,0 +1,348 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var map : array; + +var x_GLF_color : vec4; + +fn main_1() { + var pos : vec2; + var ipos : vec2; + var i : i32; + var p : vec2; + var canwalk : bool; + var v : i32; + var directions : i32; + var j : i32; + var d : i32; + let x_57 : vec4 = gl_FragCoord; + let x_60 : vec2 = x_7.resolution; + pos = (vec2(x_57.x, x_57.y) / x_60); + let x_63 : f32 = pos.x; + let x_67 : f32 = pos.y; + ipos = vec2(i32((x_63 * 16.0)), i32((x_67 * 16.0))); + i = 0; + loop { + let x_75 : i32 = i; + if ((x_75 < 256)) { + } else { + break; + } + let x_78 : i32 = i; + map[x_78] = 0; + + continuing { + let x_80 : i32 = i; + i = (x_80 + 1); + } + } + p = vec2(0, 0); + canwalk = true; + v = 0; + loop { + var x_102 : bool; + var x_122 : bool; + var x_142 : bool; + var x_162 : bool; + var x_103_phi : bool; + var x_123_phi : bool; + var x_143_phi : bool; + var x_163_phi : bool; + let x_86 : i32 = v; + v = (x_86 + 1); + directions = 0; + let x_89 : i32 = p.x; + let x_90 : bool = (x_89 > 0); + x_103_phi = x_90; + if (x_90) { + let x_94 : i32 = p.x; + let x_97 : i32 = p.y; + let x_101 : i32 = map[((x_94 - 2) + (x_97 * 16))]; + x_102 = (x_101 == 0); + x_103_phi = x_102; + } + let x_103 : bool = x_103_phi; + if (x_103) { + let x_106 : i32 = directions; + directions = (x_106 + 1); + } + let x_109 : i32 = p.y; + let x_110 : bool = (x_109 > 0); + x_123_phi = x_110; + if (x_110) { + let x_114 : i32 = p.x; + let x_116 : i32 = p.y; + let x_121 : i32 = map[(x_114 + ((x_116 - 2) * 16))]; + x_122 = (x_121 == 0); + x_123_phi = x_122; + } + let x_123 : bool = x_123_phi; + if (x_123) { + let x_126 : i32 = directions; + directions = (x_126 + 1); + } + let x_129 : i32 = p.x; + let x_130 : bool = (x_129 < 14); + x_143_phi = x_130; + if (x_130) { + let x_134 : i32 = p.x; + let x_137 : i32 = p.y; + let x_141 : i32 = map[((x_134 + 2) + (x_137 * 16))]; + x_142 = (x_141 == 0); + x_143_phi = x_142; + } + let x_143 : bool = x_143_phi; + if (x_143) { + let x_146 : i32 = directions; + directions = (x_146 + 1); + } + let x_149 : i32 = p.y; + let x_150 : bool = (x_149 < 14); + x_163_phi = x_150; + if (x_150) { + let x_154 : i32 = p.x; + let x_156 : i32 = p.y; + let x_161 : i32 = map[(x_154 + ((x_156 + 2) * 16))]; + x_162 = (x_161 == 0); + x_163_phi = x_162; + } + let x_163 : bool = x_163_phi; + if (x_163) { + let x_166 : i32 = directions; + directions = (x_166 + 1); + } + var x_227 : bool; + var x_240 : bool; + var x_279 : bool; + var x_292 : bool; + var x_331 : bool; + var x_344 : bool; + var x_383 : bool; + var x_396 : bool; + var x_228_phi : bool; + var x_241_phi : bool; + var x_280_phi : bool; + var x_293_phi : bool; + var x_332_phi : bool; + var x_345_phi : bool; + var x_384_phi : bool; + var x_397_phi : bool; + let x_168 : i32 = directions; + if ((x_168 == 0)) { + canwalk = false; + i = 0; + loop { + let x_177 : i32 = i; + if ((x_177 < 8)) { + } else { + break; + } + j = 0; + loop { + let x_184 : i32 = j; + if ((x_184 < 8)) { + } else { + break; + } + let x_187 : i32 = j; + let x_189 : i32 = i; + let x_194 : i32 = map[((x_187 * 2) + ((x_189 * 2) * 16))]; + if ((x_194 == 0)) { + let x_198 : i32 = j; + p.x = (x_198 * 2); + let x_201 : i32 = i; + p.y = (x_201 * 2); + canwalk = true; + } + + continuing { + let x_204 : i32 = j; + j = (x_204 + 1); + } + } + + continuing { + let x_206 : i32 = i; + i = (x_206 + 1); + } + } + let x_209 : i32 = p.x; + let x_211 : i32 = p.y; + map[(x_209 + (x_211 * 16))] = 1; + } else { + let x_215 : i32 = v; + let x_216 : i32 = directions; + d = (x_215 % x_216); + let x_218 : i32 = directions; + let x_219 : i32 = v; + v = (x_219 + x_218); + let x_221 : i32 = d; + let x_222 : bool = (x_221 >= 0); + x_228_phi = x_222; + if (x_222) { + let x_226 : i32 = p.x; + x_227 = (x_226 > 0); + x_228_phi = x_227; + } + let x_228 : bool = x_228_phi; + x_241_phi = x_228; + if (x_228) { + let x_232 : i32 = p.x; + let x_235 : i32 = p.y; + let x_239 : i32 = map[((x_232 - 2) + (x_235 * 16))]; + x_240 = (x_239 == 0); + x_241_phi = x_240; + } + let x_241 : bool = x_241_phi; + if (x_241) { + let x_244 : i32 = d; + d = (x_244 - 1); + let x_247 : i32 = p.x; + let x_249 : i32 = p.y; + map[(x_247 + (x_249 * 16))] = 1; + let x_254 : i32 = p.x; + let x_257 : i32 = p.y; + map[((x_254 - 1) + (x_257 * 16))] = 1; + let x_262 : i32 = p.x; + let x_265 : i32 = p.y; + map[((x_262 - 2) + (x_265 * 16))] = 1; + let x_270 : i32 = p.x; + p.x = (x_270 - 2); + } + let x_273 : i32 = d; + let x_274 : bool = (x_273 >= 0); + x_280_phi = x_274; + if (x_274) { + let x_278 : i32 = p.y; + x_279 = (x_278 > 0); + x_280_phi = x_279; + } + let x_280 : bool = x_280_phi; + x_293_phi = x_280; + if (x_280) { + let x_284 : i32 = p.x; + let x_286 : i32 = p.y; + let x_291 : i32 = map[(x_284 + ((x_286 - 2) * 16))]; + x_292 = (x_291 == 0); + x_293_phi = x_292; + } + let x_293 : bool = x_293_phi; + if (x_293) { + let x_296 : i32 = d; + d = (x_296 - 1); + let x_299 : i32 = p.x; + let x_301 : i32 = p.y; + map[(x_299 + (x_301 * 16))] = 1; + let x_306 : i32 = p.x; + let x_308 : i32 = p.y; + map[(x_306 + ((x_308 - 1) * 16))] = 1; + let x_314 : i32 = p.x; + let x_316 : i32 = p.y; + map[(x_314 + ((x_316 - 2) * 16))] = 1; + let x_322 : i32 = p.y; + p.y = (x_322 - 2); + } + let x_325 : i32 = d; + let x_326 : bool = (x_325 >= 0); + x_332_phi = x_326; + if (x_326) { + let x_330 : i32 = p.x; + x_331 = (x_330 < 14); + x_332_phi = x_331; + } + let x_332 : bool = x_332_phi; + x_345_phi = x_332; + if (x_332) { + let x_336 : i32 = p.x; + let x_339 : i32 = p.y; + let x_343 : i32 = map[((x_336 + 2) + (x_339 * 16))]; + x_344 = (x_343 == 0); + x_345_phi = x_344; + } + let x_345 : bool = x_345_phi; + if (x_345) { + let x_348 : i32 = d; + d = (x_348 - 1); + let x_351 : i32 = p.x; + let x_353 : i32 = p.y; + map[(x_351 + (x_353 * 16))] = 1; + let x_358 : i32 = p.x; + let x_361 : i32 = p.y; + map[((x_358 + 1) + (x_361 * 16))] = 1; + let x_366 : i32 = p.x; + let x_369 : i32 = p.y; + map[((x_366 + 2) + (x_369 * 16))] = 1; + let x_374 : i32 = p.x; + p.x = (x_374 + 2); + } + let x_377 : i32 = d; + let x_378 : bool = (x_377 >= 0); + x_384_phi = x_378; + if (x_378) { + let x_382 : i32 = p.y; + x_383 = (x_382 < 14); + x_384_phi = x_383; + } + let x_384 : bool = x_384_phi; + x_397_phi = x_384; + if (x_384) { + let x_388 : i32 = p.x; + let x_390 : i32 = p.y; + let x_395 : i32 = map[(x_388 + ((x_390 + 2) * 16))]; + x_396 = (x_395 == 0); + x_397_phi = x_396; + } + let x_397 : bool = x_397_phi; + if (x_397) { + let x_400 : i32 = d; + d = (x_400 - 1); + let x_403 : i32 = p.x; + let x_405 : i32 = p.y; + map[(x_403 + (x_405 * 16))] = 1; + let x_410 : i32 = p.x; + let x_412 : i32 = p.y; + map[(x_410 + ((x_412 + 1) * 16))] = 1; + let x_418 : i32 = p.x; + let x_420 : i32 = p.y; + map[(x_418 + ((x_420 + 2) * 16))] = 1; + let x_426 : i32 = p.y; + p.y = (x_426 + 2); + } + } + let x_430 : i32 = ipos.y; + let x_433 : i32 = ipos.x; + let x_436 : i32 = map[((x_430 * 16) + x_433)]; + if ((x_436 == 1)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + return; + } + + continuing { + let x_440 : bool = canwalk; + if (x_440) { + } else { + break; + } + } + } + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl new file mode 100644 index 0000000000..4128fb76d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl @@ -0,0 +1,348 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var map : array; + +var x_GLF_color : vec4; + +fn main_1() { + var pos : vec2; + var ipos : vec2; + var i : i32; + var p : vec2; + var canwalk : bool; + var v : i32; + var directions : i32; + var j : i32; + var d : i32; + let x_57 : vec4 = gl_FragCoord; + let x_60 : vec2 = x_7.resolution; + pos = (vec2(x_57.x, x_57.y) / x_60); + let x_63 : f32 = pos.x; + let x_67 : f32 = pos.y; + ipos = vec2(i32((x_63 * 16.0)), i32((x_67 * 16.0))); + i = 0; + loop { + let x_75 : i32 = i; + if ((x_75 < 256)) { + } else { + break; + } + let x_78 : i32 = i; + map[x_78] = 0; + + continuing { + let x_80 : i32 = i; + i = (x_80 + 1); + } + } + p = vec2(0, 0); + canwalk = true; + v = 0; + loop { + var x_102 : bool; + var x_122 : bool; + var x_142 : bool; + var x_162 : bool; + var x_103_phi : bool; + var x_123_phi : bool; + var x_143_phi : bool; + var x_163_phi : bool; + let x_86 : i32 = v; + v = (x_86 + 1); + directions = 0; + let x_89 : i32 = p.x; + let x_90 : bool = (x_89 > 0); + x_103_phi = x_90; + if (x_90) { + let x_94 : i32 = p.x; + let x_97 : i32 = p.y; + let x_101 : i32 = map[((x_94 - 2) + (x_97 * 16))]; + x_102 = (x_101 == 0); + x_103_phi = x_102; + } + let x_103 : bool = x_103_phi; + if (x_103) { + let x_106 : i32 = directions; + directions = (x_106 + 1); + } + let x_109 : i32 = p.y; + let x_110 : bool = (x_109 > 0); + x_123_phi = x_110; + if (x_110) { + let x_114 : i32 = p.x; + let x_116 : i32 = p.y; + let x_121 : i32 = map[(x_114 + ((x_116 - 2) * 16))]; + x_122 = (x_121 == 0); + x_123_phi = x_122; + } + let x_123 : bool = x_123_phi; + if (x_123) { + let x_126 : i32 = directions; + directions = (x_126 + 1); + } + let x_129 : i32 = p.x; + let x_130 : bool = (x_129 < 14); + x_143_phi = x_130; + if (x_130) { + let x_134 : i32 = p.x; + let x_137 : i32 = p.y; + let x_141 : i32 = map[((x_134 + 2) + (x_137 * 16))]; + x_142 = (x_141 == 0); + x_143_phi = x_142; + } + let x_143 : bool = x_143_phi; + if (x_143) { + let x_146 : i32 = directions; + directions = (x_146 + 1); + } + let x_149 : i32 = p.y; + let x_150 : bool = (x_149 < 14); + x_163_phi = x_150; + if (x_150) { + let x_154 : i32 = p.x; + let x_156 : i32 = p.y; + let x_161 : i32 = map[(x_154 + ((x_156 + 2) * 16))]; + x_162 = (x_161 == 0); + x_163_phi = x_162; + } + let x_163 : bool = x_163_phi; + if (x_163) { + let x_166 : i32 = directions; + directions = (x_166 + 1); + } + var x_227 : bool; + var x_240 : bool; + var x_279 : bool; + var x_292 : bool; + var x_331 : bool; + var x_344 : bool; + var x_383 : bool; + var x_396 : bool; + var x_228_phi : bool; + var x_241_phi : bool; + var x_280_phi : bool; + var x_293_phi : bool; + var x_332_phi : bool; + var x_345_phi : bool; + var x_384_phi : bool; + var x_397_phi : bool; + let x_168 : i32 = directions; + if ((x_168 == 0)) { + canwalk = false; + i = 0; + loop { + let x_177 : i32 = i; + if ((x_177 < 8)) { + } else { + break; + } + j = 0; + loop { + let x_184 : i32 = j; + if ((x_184 < 8)) { + } else { + break; + } + let x_187 : i32 = j; + let x_189 : i32 = i; + let x_194 : i32 = map[((x_187 * 2) + ((x_189 * 2) * 16))]; + if ((x_194 == 0)) { + let x_198 : i32 = j; + p.x = (x_198 * 2); + let x_201 : i32 = i; + p.y = (x_201 * 2); + canwalk = true; + } + + continuing { + let x_204 : i32 = j; + j = (x_204 + 1); + } + } + + continuing { + let x_206 : i32 = i; + i = (x_206 + 1); + } + } + let x_209 : i32 = p.x; + let x_211 : i32 = p.y; + map[(x_209 + (x_211 * 16))] = 1; + } else { + let x_215 : i32 = v; + let x_216 : i32 = directions; + d = (x_215 % x_216); + let x_218 : i32 = directions; + let x_219 : i32 = v; + v = (x_219 + x_218); + let x_221 : i32 = d; + let x_222 : bool = (x_221 >= 0); + x_228_phi = x_222; + if (x_222) { + let x_226 : i32 = p.x; + x_227 = (x_226 > 0); + x_228_phi = x_227; + } + let x_228 : bool = x_228_phi; + x_241_phi = x_228; + if (x_228) { + let x_232 : i32 = p.x; + let x_235 : i32 = p.y; + let x_239 : i32 = map[((x_232 - 2) + (x_235 * 16))]; + x_240 = (x_239 == 0); + x_241_phi = x_240; + } + let x_241 : bool = x_241_phi; + if (x_241) { + let x_244 : i32 = d; + d = (x_244 - 1); + let x_247 : i32 = p.x; + let x_249 : i32 = p.y; + map[(x_247 + (x_249 * 16))] = 1; + let x_254 : i32 = p.x; + let x_257 : i32 = p.y; + map[((x_254 - 1) + (x_257 * 16))] = 1; + let x_262 : i32 = p.x; + let x_265 : i32 = p.y; + map[((x_262 - 2) + (x_265 * 16))] = 1; + let x_270 : i32 = p.x; + p.x = (x_270 - 2); + } + let x_273 : i32 = d; + let x_274 : bool = (x_273 >= 0); + x_280_phi = x_274; + if (x_274) { + let x_278 : i32 = p.y; + x_279 = (x_278 > 0); + x_280_phi = x_279; + } + let x_280 : bool = x_280_phi; + x_293_phi = x_280; + if (x_280) { + let x_284 : i32 = p.x; + let x_286 : i32 = p.y; + let x_291 : i32 = map[(x_284 + ((x_286 - 2) * 16))]; + x_292 = (x_291 == 0); + x_293_phi = x_292; + } + let x_293 : bool = x_293_phi; + if (x_293) { + let x_296 : i32 = d; + d = (x_296 - 1); + let x_299 : i32 = p.x; + let x_301 : i32 = p.y; + map[(x_299 + (x_301 * 16))] = 1; + let x_306 : i32 = p.x; + let x_308 : i32 = p.y; + map[(x_306 + ((x_308 - 1) * 16))] = 1; + let x_314 : i32 = p.x; + let x_316 : i32 = p.y; + map[(x_314 + ((x_316 - 2) * 16))] = 1; + let x_322 : i32 = p.y; + p.y = (x_322 - 2); + } + let x_325 : i32 = d; + let x_326 : bool = (x_325 >= 0); + x_332_phi = x_326; + if (x_326) { + let x_330 : i32 = p.x; + x_331 = (x_330 < 14); + x_332_phi = x_331; + } + let x_332 : bool = x_332_phi; + x_345_phi = x_332; + if (x_332) { + let x_336 : i32 = p.x; + let x_339 : i32 = p.y; + let x_343 : i32 = map[((x_336 + 2) + (x_339 * 16))]; + x_344 = (x_343 == 0); + x_345_phi = x_344; + } + let x_345 : bool = x_345_phi; + if (x_345) { + let x_348 : i32 = d; + d = (x_348 - 1); + let x_351 : i32 = p.x; + let x_353 : i32 = p.y; + map[(x_351 + (x_353 * 16))] = 1; + let x_358 : i32 = p.x; + let x_361 : i32 = p.y; + map[((x_358 + 1) + (x_361 * 16))] = 1; + let x_366 : i32 = p.x; + let x_369 : i32 = p.y; + map[((x_366 + 2) + (x_369 * 16))] = 1; + let x_374 : i32 = p.x; + p.x = (x_374 + 2); + } + let x_377 : i32 = d; + let x_378 : bool = (x_377 >= 0); + x_384_phi = x_378; + if (x_378) { + let x_382 : i32 = p.y; + x_383 = (x_382 < 14); + x_384_phi = x_383; + } + let x_384 : bool = x_384_phi; + x_397_phi = x_384; + if (x_384) { + let x_388 : i32 = p.x; + let x_390 : i32 = p.y; + let x_395 : i32 = map[(x_388 + ((x_390 + 2) * 16))]; + x_396 = (x_395 == 0); + x_397_phi = x_396; + } + let x_397 : bool = x_397_phi; + if (x_397) { + let x_400 : i32 = d; + d = (x_400 - 1); + let x_403 : i32 = p.x; + let x_405 : i32 = p.y; + map[(x_403 + (x_405 * 16))] = 1; + let x_410 : i32 = p.x; + let x_412 : i32 = p.y; + map[(x_410 + ((x_412 + 1) * 16))] = 1; + let x_418 : i32 = p.x; + let x_420 : i32 = p.y; + map[(x_418 + ((x_420 + 2) * 16))] = 1; + let x_426 : i32 = p.y; + p.y = (x_426 + 2); + } + } + let x_430 : i32 = ipos.y; + let x_433 : i32 = ipos.x; + let x_436 : i32 = map[((x_430 * 16) + x_433)]; + if ((x_436 == 1)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + return; + } + + continuing { + let x_440 : bool = canwalk; + if (x_440) { + } else { + break; + } + } + } + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..a5177e1007 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.hlsl @@ -0,0 +1,292 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static int map[256] = (int[256])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int i = 0; + int2 p = int2(0, 0); + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + const float4 x_57 = gl_FragCoord; + const float2 x_60 = asfloat(x_7[0].xy); + pos = (float2(x_57.x, x_57.y) / x_60); + const float x_63 = pos.x; + const float x_67 = pos.y; + ipos = int2(int((x_63 * 16.0f)), int((x_67 * 16.0f))); + i = 0; + { + for(; (i < 256); i = (i + 1)) { + map[i] = 0; + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_102 = false; + bool x_122 = false; + bool x_142 = false; + bool x_162 = false; + bool x_103_phi = false; + bool x_123_phi = false; + bool x_143_phi = false; + bool x_163_phi = false; + v = (v + 1); + directions = 0; + const int x_89 = p.x; + const bool x_90 = (x_89 > 0); + x_103_phi = x_90; + if (x_90) { + const int x_94 = p.x; + const int x_97 = p.y; + const int x_101 = map[((x_94 - 2) + (x_97 * 16))]; + x_102 = (x_101 == 0); + x_103_phi = x_102; + } + if (x_103_phi) { + directions = (directions + 1); + } + const int x_109 = p.y; + const bool x_110 = (x_109 > 0); + x_123_phi = x_110; + if (x_110) { + const int x_114 = p.x; + const int x_116 = p.y; + const int x_121 = map[(x_114 + ((x_116 - 2) * 16))]; + x_122 = (x_121 == 0); + x_123_phi = x_122; + } + if (x_123_phi) { + directions = (directions + 1); + } + const int x_129 = p.x; + const bool x_130 = (x_129 < 14); + x_143_phi = x_130; + if (x_130) { + const int x_134 = p.x; + const int x_137 = p.y; + const int x_141 = map[((x_134 + 2) + (x_137 * 16))]; + x_142 = (x_141 == 0); + x_143_phi = x_142; + } + if (x_143_phi) { + directions = (directions + 1); + } + const int x_149 = p.y; + const bool x_150 = (x_149 < 14); + x_163_phi = x_150; + if (x_150) { + const int x_154 = p.x; + const int x_156 = p.y; + const int x_161 = map[(x_154 + ((x_156 + 2) * 16))]; + x_162 = (x_161 == 0); + x_163_phi = x_162; + } + if (x_163_phi) { + directions = (directions + 1); + } + bool x_227 = false; + bool x_240 = false; + bool x_279 = false; + bool x_292 = false; + bool x_331 = false; + bool x_344 = false; + bool x_383 = false; + bool x_396 = false; + bool x_228_phi = false; + bool x_241_phi = false; + bool x_280_phi = false; + bool x_293_phi = false; + bool x_332_phi = false; + bool x_345_phi = false; + bool x_384_phi = false; + bool x_397_phi = false; + if ((directions == 0)) { + canwalk = false; + i = 0; + { + for(; (i < 8); i = (i + 1)) { + j = 0; + { + for(; (j < 8); j = (j + 1)) { + const int x_194 = map[((j * 2) + ((i * 2) * 16))]; + if ((x_194 == 0)) { + p.x = (j * 2); + p.y = (i * 2); + canwalk = true; + } + } + } + } + } + const int x_209 = p.x; + const int x_211 = p.y; + map[(x_209 + (x_211 * 16))] = 1; + } else { + d = (v % directions); + v = (v + directions); + const bool x_222 = (d >= 0); + x_228_phi = x_222; + if (x_222) { + const int x_226 = p.x; + x_227 = (x_226 > 0); + x_228_phi = x_227; + } + const bool x_228 = x_228_phi; + x_241_phi = x_228; + if (x_228) { + const int x_232 = p.x; + const int x_235 = p.y; + const int x_239 = map[((x_232 - 2) + (x_235 * 16))]; + x_240 = (x_239 == 0); + x_241_phi = x_240; + } + if (x_241_phi) { + d = (d - 1); + const int x_247 = p.x; + const int x_249 = p.y; + map[(x_247 + (x_249 * 16))] = 1; + const int x_254 = p.x; + const int x_257 = p.y; + map[((x_254 - 1) + (x_257 * 16))] = 1; + const int x_262 = p.x; + const int x_265 = p.y; + map[((x_262 - 2) + (x_265 * 16))] = 1; + const int x_270 = p.x; + p.x = (x_270 - 2); + } + const bool x_274 = (d >= 0); + x_280_phi = x_274; + if (x_274) { + const int x_278 = p.y; + x_279 = (x_278 > 0); + x_280_phi = x_279; + } + const bool x_280 = x_280_phi; + x_293_phi = x_280; + if (x_280) { + const int x_284 = p.x; + const int x_286 = p.y; + const int x_291 = map[(x_284 + ((x_286 - 2) * 16))]; + x_292 = (x_291 == 0); + x_293_phi = x_292; + } + if (x_293_phi) { + d = (d - 1); + const int x_299 = p.x; + const int x_301 = p.y; + map[(x_299 + (x_301 * 16))] = 1; + const int x_306 = p.x; + const int x_308 = p.y; + map[(x_306 + ((x_308 - 1) * 16))] = 1; + const int x_314 = p.x; + const int x_316 = p.y; + map[(x_314 + ((x_316 - 2) * 16))] = 1; + const int x_322 = p.y; + p.y = (x_322 - 2); + } + const bool x_326 = (d >= 0); + x_332_phi = x_326; + if (x_326) { + const int x_330 = p.x; + x_331 = (x_330 < 14); + x_332_phi = x_331; + } + const bool x_332 = x_332_phi; + x_345_phi = x_332; + if (x_332) { + const int x_336 = p.x; + const int x_339 = p.y; + const int x_343 = map[((x_336 + 2) + (x_339 * 16))]; + x_344 = (x_343 == 0); + x_345_phi = x_344; + } + if (x_345_phi) { + d = (d - 1); + const int x_351 = p.x; + const int x_353 = p.y; + map[(x_351 + (x_353 * 16))] = 1; + const int x_358 = p.x; + const int x_361 = p.y; + map[((x_358 + 1) + (x_361 * 16))] = 1; + const int x_366 = p.x; + const int x_369 = p.y; + map[((x_366 + 2) + (x_369 * 16))] = 1; + const int x_374 = p.x; + p.x = (x_374 + 2); + } + const bool x_378 = (d >= 0); + x_384_phi = x_378; + if (x_378) { + const int x_382 = p.y; + x_383 = (x_382 < 14); + x_384_phi = x_383; + } + const bool x_384 = x_384_phi; + x_397_phi = x_384; + if (x_384) { + const int x_388 = p.x; + const int x_390 = p.y; + const int x_395 = map[(x_388 + ((x_390 + 2) * 16))]; + x_396 = (x_395 == 0); + x_397_phi = x_396; + } + if (x_397_phi) { + d = (d - 1); + const int x_403 = p.x; + const int x_405 = p.y; + map[(x_403 + (x_405 * 16))] = 1; + const int x_410 = p.x; + const int x_412 = p.y; + map[(x_410 + ((x_412 + 1) * 16))] = 1; + const int x_418 = p.x; + const int x_420 = p.y; + map[(x_418 + ((x_420 + 2) * 16))] = 1; + const int x_426 = p.y; + p.y = (x_426 + 2); + } + } + const int x_430 = ipos.y; + const int x_433 = ipos.x; + const int x_436 = map[((x_430 * 16) + x_433)]; + if ((x_436 == 1)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + if (canwalk) { + } else { + break; + } + } + } + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..e1df0f21d4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.msl @@ -0,0 +1,347 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6, thread float4* const tint_symbol_7) { + float2 pos = 0.0f; + int2 ipos = 0; + int i = 0; + int2 p = 0; + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + float4 const x_57 = *(tint_symbol_5); + float2 const x_60 = x_7.resolution; + pos = (float2(x_57.x, x_57.y) / x_60); + float const x_63 = pos.x; + float const x_67 = pos.y; + ipos = int2(int((x_63 * 16.0f)), int((x_67 * 16.0f))); + i = 0; + while (true) { + int const x_75 = i; + if ((x_75 < 256)) { + } else { + break; + } + int const x_78 = i; + (*(tint_symbol_6)).arr[x_78] = 0; + { + int const x_80 = i; + i = (x_80 + 1); + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_102 = false; + bool x_122 = false; + bool x_142 = false; + bool x_162 = false; + bool x_103_phi = false; + bool x_123_phi = false; + bool x_143_phi = false; + bool x_163_phi = false; + int const x_86 = v; + v = (x_86 + 1); + directions = 0; + int const x_89 = p.x; + bool const x_90 = (x_89 > 0); + x_103_phi = x_90; + if (x_90) { + int const x_94 = p.x; + int const x_97 = p.y; + int const x_101 = (*(tint_symbol_6)).arr[((x_94 - 2) + (x_97 * 16))]; + x_102 = (x_101 == 0); + x_103_phi = x_102; + } + bool const x_103 = x_103_phi; + if (x_103) { + int const x_106 = directions; + directions = (x_106 + 1); + } + int const x_109 = p.y; + bool const x_110 = (x_109 > 0); + x_123_phi = x_110; + if (x_110) { + int const x_114 = p.x; + int const x_116 = p.y; + int const x_121 = (*(tint_symbol_6)).arr[(x_114 + ((x_116 - 2) * 16))]; + x_122 = (x_121 == 0); + x_123_phi = x_122; + } + bool const x_123 = x_123_phi; + if (x_123) { + int const x_126 = directions; + directions = (x_126 + 1); + } + int const x_129 = p.x; + bool const x_130 = (x_129 < 14); + x_143_phi = x_130; + if (x_130) { + int const x_134 = p.x; + int const x_137 = p.y; + int const x_141 = (*(tint_symbol_6)).arr[((x_134 + 2) + (x_137 * 16))]; + x_142 = (x_141 == 0); + x_143_phi = x_142; + } + bool const x_143 = x_143_phi; + if (x_143) { + int const x_146 = directions; + directions = (x_146 + 1); + } + int const x_149 = p.y; + bool const x_150 = (x_149 < 14); + x_163_phi = x_150; + if (x_150) { + int const x_154 = p.x; + int const x_156 = p.y; + int const x_161 = (*(tint_symbol_6)).arr[(x_154 + ((x_156 + 2) * 16))]; + x_162 = (x_161 == 0); + x_163_phi = x_162; + } + bool const x_163 = x_163_phi; + if (x_163) { + int const x_166 = directions; + directions = (x_166 + 1); + } + bool x_227 = false; + bool x_240 = false; + bool x_279 = false; + bool x_292 = false; + bool x_331 = false; + bool x_344 = false; + bool x_383 = false; + bool x_396 = false; + bool x_228_phi = false; + bool x_241_phi = false; + bool x_280_phi = false; + bool x_293_phi = false; + bool x_332_phi = false; + bool x_345_phi = false; + bool x_384_phi = false; + bool x_397_phi = false; + int const x_168 = directions; + if ((x_168 == 0)) { + canwalk = false; + i = 0; + while (true) { + int const x_177 = i; + if ((x_177 < 8)) { + } else { + break; + } + j = 0; + while (true) { + int const x_184 = j; + if ((x_184 < 8)) { + } else { + break; + } + int const x_187 = j; + int const x_189 = i; + int const x_194 = (*(tint_symbol_6)).arr[((x_187 * 2) + ((x_189 * 2) * 16))]; + if ((x_194 == 0)) { + int const x_198 = j; + p.x = (x_198 * 2); + int const x_201 = i; + p.y = (x_201 * 2); + canwalk = true; + } + { + int const x_204 = j; + j = (x_204 + 1); + } + } + { + int const x_206 = i; + i = (x_206 + 1); + } + } + int const x_209 = p.x; + int const x_211 = p.y; + (*(tint_symbol_6)).arr[(x_209 + (x_211 * 16))] = 1; + } else { + int const x_215 = v; + int const x_216 = directions; + d = (x_215 % x_216); + int const x_218 = directions; + int const x_219 = v; + v = (x_219 + x_218); + int const x_221 = d; + bool const x_222 = (x_221 >= 0); + x_228_phi = x_222; + if (x_222) { + int const x_226 = p.x; + x_227 = (x_226 > 0); + x_228_phi = x_227; + } + bool const x_228 = x_228_phi; + x_241_phi = x_228; + if (x_228) { + int const x_232 = p.x; + int const x_235 = p.y; + int const x_239 = (*(tint_symbol_6)).arr[((x_232 - 2) + (x_235 * 16))]; + x_240 = (x_239 == 0); + x_241_phi = x_240; + } + bool const x_241 = x_241_phi; + if (x_241) { + int const x_244 = d; + d = (x_244 - 1); + int const x_247 = p.x; + int const x_249 = p.y; + (*(tint_symbol_6)).arr[(x_247 + (x_249 * 16))] = 1; + int const x_254 = p.x; + int const x_257 = p.y; + (*(tint_symbol_6)).arr[((x_254 - 1) + (x_257 * 16))] = 1; + int const x_262 = p.x; + int const x_265 = p.y; + (*(tint_symbol_6)).arr[((x_262 - 2) + (x_265 * 16))] = 1; + int const x_270 = p.x; + p.x = (x_270 - 2); + } + int const x_273 = d; + bool const x_274 = (x_273 >= 0); + x_280_phi = x_274; + if (x_274) { + int const x_278 = p.y; + x_279 = (x_278 > 0); + x_280_phi = x_279; + } + bool const x_280 = x_280_phi; + x_293_phi = x_280; + if (x_280) { + int const x_284 = p.x; + int const x_286 = p.y; + int const x_291 = (*(tint_symbol_6)).arr[(x_284 + ((x_286 - 2) * 16))]; + x_292 = (x_291 == 0); + x_293_phi = x_292; + } + bool const x_293 = x_293_phi; + if (x_293) { + int const x_296 = d; + d = (x_296 - 1); + int const x_299 = p.x; + int const x_301 = p.y; + (*(tint_symbol_6)).arr[(x_299 + (x_301 * 16))] = 1; + int const x_306 = p.x; + int const x_308 = p.y; + (*(tint_symbol_6)).arr[(x_306 + ((x_308 - 1) * 16))] = 1; + int const x_314 = p.x; + int const x_316 = p.y; + (*(tint_symbol_6)).arr[(x_314 + ((x_316 - 2) * 16))] = 1; + int const x_322 = p.y; + p.y = (x_322 - 2); + } + int const x_325 = d; + bool const x_326 = (x_325 >= 0); + x_332_phi = x_326; + if (x_326) { + int const x_330 = p.x; + x_331 = (x_330 < 14); + x_332_phi = x_331; + } + bool const x_332 = x_332_phi; + x_345_phi = x_332; + if (x_332) { + int const x_336 = p.x; + int const x_339 = p.y; + int const x_343 = (*(tint_symbol_6)).arr[((x_336 + 2) + (x_339 * 16))]; + x_344 = (x_343 == 0); + x_345_phi = x_344; + } + bool const x_345 = x_345_phi; + if (x_345) { + int const x_348 = d; + d = (x_348 - 1); + int const x_351 = p.x; + int const x_353 = p.y; + (*(tint_symbol_6)).arr[(x_351 + (x_353 * 16))] = 1; + int const x_358 = p.x; + int const x_361 = p.y; + (*(tint_symbol_6)).arr[((x_358 + 1) + (x_361 * 16))] = 1; + int const x_366 = p.x; + int const x_369 = p.y; + (*(tint_symbol_6)).arr[((x_366 + 2) + (x_369 * 16))] = 1; + int const x_374 = p.x; + p.x = (x_374 + 2); + } + int const x_377 = d; + bool const x_378 = (x_377 >= 0); + x_384_phi = x_378; + if (x_378) { + int const x_382 = p.y; + x_383 = (x_382 < 14); + x_384_phi = x_383; + } + bool const x_384 = x_384_phi; + x_397_phi = x_384; + if (x_384) { + int const x_388 = p.x; + int const x_390 = p.y; + int const x_395 = (*(tint_symbol_6)).arr[(x_388 + ((x_390 + 2) * 16))]; + x_396 = (x_395 == 0); + x_397_phi = x_396; + } + bool const x_397 = x_397_phi; + if (x_397) { + int const x_400 = d; + d = (x_400 - 1); + int const x_403 = p.x; + int const x_405 = p.y; + (*(tint_symbol_6)).arr[(x_403 + (x_405 * 16))] = 1; + int const x_410 = p.x; + int const x_412 = p.y; + (*(tint_symbol_6)).arr[(x_410 + ((x_412 + 1) * 16))] = 1; + int const x_418 = p.x; + int const x_420 = p.y; + (*(tint_symbol_6)).arr[(x_418 + ((x_420 + 2) * 16))] = 1; + int const x_426 = p.y; + p.y = (x_426 + 2); + } + } + int const x_430 = ipos.y; + int const x_433 = ipos.x; + int const x_436 = (*(tint_symbol_6)).arr[((x_430 * 16) + x_433)]; + if ((x_436 == 1)) { + *(tint_symbol_7) = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + bool const x_440 = canwalk; + if (x_440) { + } else { + break; + } + } + } + *(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread tint_array_wrapper tint_symbol_9 = {}; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_8), &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4613f9f74f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.spvasm @@ -0,0 +1,775 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 509 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %map "map" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %ipos "ipos" + OpName %i "i" + OpName %p "p" + OpName %canwalk "canwalk" + OpName %v "v" + OpName %directions "directions" + OpName %j "j" + OpName %d "d" + OpName %x_102 "x_102" + OpName %x_122 "x_122" + OpName %x_142 "x_142" + OpName %x_162 "x_162" + OpName %x_103_phi "x_103_phi" + OpName %x_123_phi "x_123_phi" + OpName %x_143_phi "x_143_phi" + OpName %x_163_phi "x_163_phi" + OpName %x_227 "x_227" + OpName %x_240 "x_240" + OpName %x_279 "x_279" + OpName %x_292 "x_292" + OpName %x_331 "x_331" + OpName %x_344 "x_344" + OpName %x_383 "x_383" + OpName %x_396 "x_396" + OpName %x_228_phi "x_228_phi" + OpName %x_241_phi "x_241_phi" + OpName %x_280_phi "x_280_phi" + OpName %x_293_phi "x_293_phi" + OpName %x_332_phi "x_332_phi" + OpName %x_345_phi "x_345_phi" + OpName %x_384_phi "x_384_phi" + OpName %x_397_phi "x_397_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Private__arr_int_uint_256 = OpTypePointer Private %_arr_int_uint_256 + %16 = OpConstantNull %_arr_int_uint_256 + %map = OpVariable %_ptr_Private__arr_int_uint_256 Private %16 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %28 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %32 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_16 = OpConstant %float 16 + %int_0 = OpConstant %int 0 + %int_256 = OpConstant %int 256 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %83 = OpConstantComposite %v2int %int_0 %int_0 + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %int_16 = OpConstant %int 16 + %int_14 = OpConstant %int 14 + %false = OpConstantFalse %bool + %int_8 = OpConstant %int 8 + %float_1 = OpConstant %float 1 + %489 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %495 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %496 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %28 + %ipos = OpVariable %_ptr_Function_v2int Function %32 + %i = OpVariable %_ptr_Function_int Function %35 + %p = OpVariable %_ptr_Function_v2int Function %32 + %canwalk = OpVariable %_ptr_Function_bool Function %40 + %v = OpVariable %_ptr_Function_int Function %35 + %directions = OpVariable %_ptr_Function_int Function %35 + %j = OpVariable %_ptr_Function_int Function %35 + %d = OpVariable %_ptr_Function_int Function %35 + %x_102 = OpVariable %_ptr_Function_bool Function %40 + %x_122 = OpVariable %_ptr_Function_bool Function %40 + %x_142 = OpVariable %_ptr_Function_bool Function %40 + %x_162 = OpVariable %_ptr_Function_bool Function %40 + %x_103_phi = OpVariable %_ptr_Function_bool Function %40 + %x_123_phi = OpVariable %_ptr_Function_bool Function %40 + %x_143_phi = OpVariable %_ptr_Function_bool Function %40 + %x_163_phi = OpVariable %_ptr_Function_bool Function %40 + %x_227 = OpVariable %_ptr_Function_bool Function %40 + %x_240 = OpVariable %_ptr_Function_bool Function %40 + %x_279 = OpVariable %_ptr_Function_bool Function %40 + %x_292 = OpVariable %_ptr_Function_bool Function %40 + %x_331 = OpVariable %_ptr_Function_bool Function %40 + %x_344 = OpVariable %_ptr_Function_bool Function %40 + %x_383 = OpVariable %_ptr_Function_bool Function %40 + %x_396 = OpVariable %_ptr_Function_bool Function %40 + %x_228_phi = OpVariable %_ptr_Function_bool Function %40 + %x_241_phi = OpVariable %_ptr_Function_bool Function %40 + %x_280_phi = OpVariable %_ptr_Function_bool Function %40 + %x_293_phi = OpVariable %_ptr_Function_bool Function %40 + %x_332_phi = OpVariable %_ptr_Function_bool Function %40 + %x_345_phi = OpVariable %_ptr_Function_bool Function %40 + %x_384_phi = OpVariable %_ptr_Function_bool Function %40 + %x_397_phi = OpVariable %_ptr_Function_bool Function %40 + %45 = OpLoad %v4float %gl_FragCoord + %48 = OpAccessChain %_ptr_Uniform_v2float %x_7 %uint_0 + %49 = OpLoad %v2float %48 + %50 = OpCompositeExtract %float %45 0 + %51 = OpCompositeExtract %float %45 1 + %52 = OpCompositeConstruct %v2float %50 %51 + %53 = OpFDiv %v2float %52 %49 + OpStore %pos %53 + %55 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %59 = OpLoad %float %58 + %62 = OpFMul %float %56 %float_16 + %60 = OpConvertFToS %int %62 + %64 = OpFMul %float %59 %float_16 + %63 = OpConvertFToS %int %64 + %65 = OpCompositeConstruct %v2int %60 %63 + OpStore %ipos %65 + OpStore %i %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %i + %73 = OpSLessThan %bool %71 %int_256 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %74 + %76 = OpLabel + OpBranch %68 + %74 = OpLabel + %77 = OpLoad %int %i + %79 = OpAccessChain %_ptr_Private_int %map %77 + OpStore %79 %int_0 + OpBranch %69 + %69 = OpLabel + %80 = OpLoad %int %i + %82 = OpIAdd %int %80 %int_1 + OpStore %i %82 + OpBranch %67 + %68 = OpLabel + OpStore %p %83 + OpStore %canwalk %true + OpStore %v %int_0 + OpBranch %85 + %85 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %97 = OpLoad %int %v + %98 = OpIAdd %int %97 %int_1 + OpStore %v %98 + OpStore %directions %int_0 + %99 = OpAccessChain %_ptr_Function_int %p %uint_0 + %100 = OpLoad %int %99 + %101 = OpSGreaterThan %bool %100 %int_0 + OpStore %x_103_phi %101 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + %104 = OpAccessChain %_ptr_Function_int %p %uint_0 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Function_int %p %uint_1 + %107 = OpLoad %int %106 + %109 = OpISub %int %105 %int_2 + %111 = OpIMul %int %107 %int_16 + %112 = OpIAdd %int %109 %111 + %113 = OpAccessChain %_ptr_Private_int %map %112 + %114 = OpLoad %int %113 + %115 = OpIEqual %bool %114 %int_0 + OpStore %x_102 %115 + %116 = OpLoad %bool %x_102 + OpStore %x_103_phi %116 + OpBranch %102 + %102 = OpLabel + %117 = OpLoad %bool %x_103_phi + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %120 = OpLoad %int %directions + %121 = OpIAdd %int %120 %int_1 + OpStore %directions %121 + OpBranch %118 + %118 = OpLabel + %122 = OpAccessChain %_ptr_Function_int %p %uint_1 + %123 = OpLoad %int %122 + %124 = OpSGreaterThan %bool %123 %int_0 + OpStore %x_123_phi %124 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %125 + %126 = OpLabel + %127 = OpAccessChain %_ptr_Function_int %p %uint_0 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Function_int %p %uint_1 + %130 = OpLoad %int %129 + %131 = OpISub %int %130 %int_2 + %132 = OpIMul %int %131 %int_16 + %133 = OpIAdd %int %128 %132 + %134 = OpAccessChain %_ptr_Private_int %map %133 + %135 = OpLoad %int %134 + %136 = OpIEqual %bool %135 %int_0 + OpStore %x_122 %136 + %137 = OpLoad %bool %x_122 + OpStore %x_123_phi %137 + OpBranch %125 + %125 = OpLabel + %138 = OpLoad %bool %x_123_phi + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpLoad %int %directions + %142 = OpIAdd %int %141 %int_1 + OpStore %directions %142 + OpBranch %139 + %139 = OpLabel + %143 = OpAccessChain %_ptr_Function_int %p %uint_0 + %144 = OpLoad %int %143 + %146 = OpSLessThan %bool %144 %int_14 + OpStore %x_143_phi %146 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %147 + %148 = OpLabel + %149 = OpAccessChain %_ptr_Function_int %p %uint_0 + %150 = OpLoad %int %149 + %151 = OpAccessChain %_ptr_Function_int %p %uint_1 + %152 = OpLoad %int %151 + %153 = OpIAdd %int %150 %int_2 + %154 = OpIMul %int %152 %int_16 + %155 = OpIAdd %int %153 %154 + %156 = OpAccessChain %_ptr_Private_int %map %155 + %157 = OpLoad %int %156 + %158 = OpIEqual %bool %157 %int_0 + OpStore %x_142 %158 + %159 = OpLoad %bool %x_142 + OpStore %x_143_phi %159 + OpBranch %147 + %147 = OpLabel + %160 = OpLoad %bool %x_143_phi + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %161 + %162 = OpLabel + %163 = OpLoad %int %directions + %164 = OpIAdd %int %163 %int_1 + OpStore %directions %164 + OpBranch %161 + %161 = OpLabel + %165 = OpAccessChain %_ptr_Function_int %p %uint_1 + %166 = OpLoad %int %165 + %167 = OpSLessThan %bool %166 %int_14 + OpStore %x_163_phi %167 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %168 + %169 = OpLabel + %170 = OpAccessChain %_ptr_Function_int %p %uint_0 + %171 = OpLoad %int %170 + %172 = OpAccessChain %_ptr_Function_int %p %uint_1 + %173 = OpLoad %int %172 + %174 = OpIAdd %int %173 %int_2 + %175 = OpIMul %int %174 %int_16 + %176 = OpIAdd %int %171 %175 + %177 = OpAccessChain %_ptr_Private_int %map %176 + %178 = OpLoad %int %177 + %179 = OpIEqual %bool %178 %int_0 + OpStore %x_162 %179 + %180 = OpLoad %bool %x_162 + OpStore %x_163_phi %180 + OpBranch %168 + %168 = OpLabel + %181 = OpLoad %bool %x_163_phi + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %184 = OpLoad %int %directions + %185 = OpIAdd %int %184 %int_1 + OpStore %directions %185 + OpBranch %182 + %182 = OpLabel + %202 = OpLoad %int %directions + %203 = OpIEqual %bool %202 %int_0 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %206 + %205 = OpLabel + OpStore %canwalk %false + OpStore %i %int_0 + OpBranch %208 + %208 = OpLabel + OpLoopMerge %209 %210 None + OpBranch %211 + %211 = OpLabel + %212 = OpLoad %int %i + %214 = OpSLessThan %bool %212 %int_8 + OpSelectionMerge %215 None + OpBranchConditional %214 %216 %217 + %216 = OpLabel + OpBranch %215 + %217 = OpLabel + OpBranch %209 + %215 = OpLabel + OpStore %j %int_0 + OpBranch %218 + %218 = OpLabel + OpLoopMerge %219 %220 None + OpBranch %221 + %221 = OpLabel + %222 = OpLoad %int %j + %223 = OpSLessThan %bool %222 %int_8 + OpSelectionMerge %224 None + OpBranchConditional %223 %225 %226 + %225 = OpLabel + OpBranch %224 + %226 = OpLabel + OpBranch %219 + %224 = OpLabel + %227 = OpLoad %int %j + %228 = OpLoad %int %i + %229 = OpIMul %int %227 %int_2 + %230 = OpIMul %int %228 %int_2 + %231 = OpIMul %int %230 %int_16 + %232 = OpIAdd %int %229 %231 + %233 = OpAccessChain %_ptr_Private_int %map %232 + %234 = OpLoad %int %233 + %235 = OpIEqual %bool %234 %int_0 + OpSelectionMerge %236 None + OpBranchConditional %235 %237 %236 + %237 = OpLabel + %238 = OpLoad %int %j + %239 = OpAccessChain %_ptr_Function_int %p %uint_0 + %240 = OpIMul %int %238 %int_2 + OpStore %239 %240 + %241 = OpLoad %int %i + %242 = OpAccessChain %_ptr_Function_int %p %uint_1 + %243 = OpIMul %int %241 %int_2 + OpStore %242 %243 + OpStore %canwalk %true + OpBranch %236 + %236 = OpLabel + OpBranch %220 + %220 = OpLabel + %244 = OpLoad %int %j + %245 = OpIAdd %int %244 %int_1 + OpStore %j %245 + OpBranch %218 + %219 = OpLabel + OpBranch %210 + %210 = OpLabel + %246 = OpLoad %int %i + %247 = OpIAdd %int %246 %int_1 + OpStore %i %247 + OpBranch %208 + %209 = OpLabel + %248 = OpAccessChain %_ptr_Function_int %p %uint_0 + %249 = OpLoad %int %248 + %250 = OpAccessChain %_ptr_Function_int %p %uint_1 + %251 = OpLoad %int %250 + %252 = OpIMul %int %251 %int_16 + %253 = OpIAdd %int %249 %252 + %254 = OpAccessChain %_ptr_Private_int %map %253 + OpStore %254 %int_1 + OpBranch %204 + %206 = OpLabel + %255 = OpLoad %int %v + %256 = OpLoad %int %directions + %257 = OpSMod %int %255 %256 + OpStore %d %257 + %258 = OpLoad %int %directions + %259 = OpLoad %int %v + %260 = OpIAdd %int %259 %258 + OpStore %v %260 + %261 = OpLoad %int %d + %262 = OpSGreaterThanEqual %bool %261 %int_0 + OpStore %x_228_phi %262 + OpSelectionMerge %263 None + OpBranchConditional %262 %264 %263 + %264 = OpLabel + %265 = OpAccessChain %_ptr_Function_int %p %uint_0 + %266 = OpLoad %int %265 + %267 = OpSGreaterThan %bool %266 %int_0 + OpStore %x_227 %267 + %268 = OpLoad %bool %x_227 + OpStore %x_228_phi %268 + OpBranch %263 + %263 = OpLabel + %269 = OpLoad %bool %x_228_phi + OpStore %x_241_phi %269 + OpSelectionMerge %270 None + OpBranchConditional %269 %271 %270 + %271 = OpLabel + %272 = OpAccessChain %_ptr_Function_int %p %uint_0 + %273 = OpLoad %int %272 + %274 = OpAccessChain %_ptr_Function_int %p %uint_1 + %275 = OpLoad %int %274 + %276 = OpISub %int %273 %int_2 + %277 = OpIMul %int %275 %int_16 + %278 = OpIAdd %int %276 %277 + %279 = OpAccessChain %_ptr_Private_int %map %278 + %280 = OpLoad %int %279 + %281 = OpIEqual %bool %280 %int_0 + OpStore %x_240 %281 + %282 = OpLoad %bool %x_240 + OpStore %x_241_phi %282 + OpBranch %270 + %270 = OpLabel + %283 = OpLoad %bool %x_241_phi + OpSelectionMerge %284 None + OpBranchConditional %283 %285 %284 + %285 = OpLabel + %286 = OpLoad %int %d + %287 = OpISub %int %286 %int_1 + OpStore %d %287 + %288 = OpAccessChain %_ptr_Function_int %p %uint_0 + %289 = OpLoad %int %288 + %290 = OpAccessChain %_ptr_Function_int %p %uint_1 + %291 = OpLoad %int %290 + %292 = OpIMul %int %291 %int_16 + %293 = OpIAdd %int %289 %292 + %294 = OpAccessChain %_ptr_Private_int %map %293 + OpStore %294 %int_1 + %295 = OpAccessChain %_ptr_Function_int %p %uint_0 + %296 = OpLoad %int %295 + %297 = OpAccessChain %_ptr_Function_int %p %uint_1 + %298 = OpLoad %int %297 + %299 = OpISub %int %296 %int_1 + %300 = OpIMul %int %298 %int_16 + %301 = OpIAdd %int %299 %300 + %302 = OpAccessChain %_ptr_Private_int %map %301 + OpStore %302 %int_1 + %303 = OpAccessChain %_ptr_Function_int %p %uint_0 + %304 = OpLoad %int %303 + %305 = OpAccessChain %_ptr_Function_int %p %uint_1 + %306 = OpLoad %int %305 + %307 = OpISub %int %304 %int_2 + %308 = OpIMul %int %306 %int_16 + %309 = OpIAdd %int %307 %308 + %310 = OpAccessChain %_ptr_Private_int %map %309 + OpStore %310 %int_1 + %311 = OpAccessChain %_ptr_Function_int %p %uint_0 + %312 = OpLoad %int %311 + %313 = OpAccessChain %_ptr_Function_int %p %uint_0 + %314 = OpISub %int %312 %int_2 + OpStore %313 %314 + OpBranch %284 + %284 = OpLabel + %315 = OpLoad %int %d + %316 = OpSGreaterThanEqual %bool %315 %int_0 + OpStore %x_280_phi %316 + OpSelectionMerge %317 None + OpBranchConditional %316 %318 %317 + %318 = OpLabel + %319 = OpAccessChain %_ptr_Function_int %p %uint_1 + %320 = OpLoad %int %319 + %321 = OpSGreaterThan %bool %320 %int_0 + OpStore %x_279 %321 + %322 = OpLoad %bool %x_279 + OpStore %x_280_phi %322 + OpBranch %317 + %317 = OpLabel + %323 = OpLoad %bool %x_280_phi + OpStore %x_293_phi %323 + OpSelectionMerge %324 None + OpBranchConditional %323 %325 %324 + %325 = OpLabel + %326 = OpAccessChain %_ptr_Function_int %p %uint_0 + %327 = OpLoad %int %326 + %328 = OpAccessChain %_ptr_Function_int %p %uint_1 + %329 = OpLoad %int %328 + %330 = OpISub %int %329 %int_2 + %331 = OpIMul %int %330 %int_16 + %332 = OpIAdd %int %327 %331 + %333 = OpAccessChain %_ptr_Private_int %map %332 + %334 = OpLoad %int %333 + %335 = OpIEqual %bool %334 %int_0 + OpStore %x_292 %335 + %336 = OpLoad %bool %x_292 + OpStore %x_293_phi %336 + OpBranch %324 + %324 = OpLabel + %337 = OpLoad %bool %x_293_phi + OpSelectionMerge %338 None + OpBranchConditional %337 %339 %338 + %339 = OpLabel + %340 = OpLoad %int %d + %341 = OpISub %int %340 %int_1 + OpStore %d %341 + %342 = OpAccessChain %_ptr_Function_int %p %uint_0 + %343 = OpLoad %int %342 + %344 = OpAccessChain %_ptr_Function_int %p %uint_1 + %345 = OpLoad %int %344 + %346 = OpIMul %int %345 %int_16 + %347 = OpIAdd %int %343 %346 + %348 = OpAccessChain %_ptr_Private_int %map %347 + OpStore %348 %int_1 + %349 = OpAccessChain %_ptr_Function_int %p %uint_0 + %350 = OpLoad %int %349 + %351 = OpAccessChain %_ptr_Function_int %p %uint_1 + %352 = OpLoad %int %351 + %353 = OpISub %int %352 %int_1 + %354 = OpIMul %int %353 %int_16 + %355 = OpIAdd %int %350 %354 + %356 = OpAccessChain %_ptr_Private_int %map %355 + OpStore %356 %int_1 + %357 = OpAccessChain %_ptr_Function_int %p %uint_0 + %358 = OpLoad %int %357 + %359 = OpAccessChain %_ptr_Function_int %p %uint_1 + %360 = OpLoad %int %359 + %361 = OpISub %int %360 %int_2 + %362 = OpIMul %int %361 %int_16 + %363 = OpIAdd %int %358 %362 + %364 = OpAccessChain %_ptr_Private_int %map %363 + OpStore %364 %int_1 + %365 = OpAccessChain %_ptr_Function_int %p %uint_1 + %366 = OpLoad %int %365 + %367 = OpAccessChain %_ptr_Function_int %p %uint_1 + %368 = OpISub %int %366 %int_2 + OpStore %367 %368 + OpBranch %338 + %338 = OpLabel + %369 = OpLoad %int %d + %370 = OpSGreaterThanEqual %bool %369 %int_0 + OpStore %x_332_phi %370 + OpSelectionMerge %371 None + OpBranchConditional %370 %372 %371 + %372 = OpLabel + %373 = OpAccessChain %_ptr_Function_int %p %uint_0 + %374 = OpLoad %int %373 + %375 = OpSLessThan %bool %374 %int_14 + OpStore %x_331 %375 + %376 = OpLoad %bool %x_331 + OpStore %x_332_phi %376 + OpBranch %371 + %371 = OpLabel + %377 = OpLoad %bool %x_332_phi + OpStore %x_345_phi %377 + OpSelectionMerge %378 None + OpBranchConditional %377 %379 %378 + %379 = OpLabel + %380 = OpAccessChain %_ptr_Function_int %p %uint_0 + %381 = OpLoad %int %380 + %382 = OpAccessChain %_ptr_Function_int %p %uint_1 + %383 = OpLoad %int %382 + %384 = OpIAdd %int %381 %int_2 + %385 = OpIMul %int %383 %int_16 + %386 = OpIAdd %int %384 %385 + %387 = OpAccessChain %_ptr_Private_int %map %386 + %388 = OpLoad %int %387 + %389 = OpIEqual %bool %388 %int_0 + OpStore %x_344 %389 + %390 = OpLoad %bool %x_344 + OpStore %x_345_phi %390 + OpBranch %378 + %378 = OpLabel + %391 = OpLoad %bool %x_345_phi + OpSelectionMerge %392 None + OpBranchConditional %391 %393 %392 + %393 = OpLabel + %394 = OpLoad %int %d + %395 = OpISub %int %394 %int_1 + OpStore %d %395 + %396 = OpAccessChain %_ptr_Function_int %p %uint_0 + %397 = OpLoad %int %396 + %398 = OpAccessChain %_ptr_Function_int %p %uint_1 + %399 = OpLoad %int %398 + %400 = OpIMul %int %399 %int_16 + %401 = OpIAdd %int %397 %400 + %402 = OpAccessChain %_ptr_Private_int %map %401 + OpStore %402 %int_1 + %403 = OpAccessChain %_ptr_Function_int %p %uint_0 + %404 = OpLoad %int %403 + %405 = OpAccessChain %_ptr_Function_int %p %uint_1 + %406 = OpLoad %int %405 + %407 = OpIAdd %int %404 %int_1 + %408 = OpIMul %int %406 %int_16 + %409 = OpIAdd %int %407 %408 + %410 = OpAccessChain %_ptr_Private_int %map %409 + OpStore %410 %int_1 + %411 = OpAccessChain %_ptr_Function_int %p %uint_0 + %412 = OpLoad %int %411 + %413 = OpAccessChain %_ptr_Function_int %p %uint_1 + %414 = OpLoad %int %413 + %415 = OpIAdd %int %412 %int_2 + %416 = OpIMul %int %414 %int_16 + %417 = OpIAdd %int %415 %416 + %418 = OpAccessChain %_ptr_Private_int %map %417 + OpStore %418 %int_1 + %419 = OpAccessChain %_ptr_Function_int %p %uint_0 + %420 = OpLoad %int %419 + %421 = OpAccessChain %_ptr_Function_int %p %uint_0 + %422 = OpIAdd %int %420 %int_2 + OpStore %421 %422 + OpBranch %392 + %392 = OpLabel + %423 = OpLoad %int %d + %424 = OpSGreaterThanEqual %bool %423 %int_0 + OpStore %x_384_phi %424 + OpSelectionMerge %425 None + OpBranchConditional %424 %426 %425 + %426 = OpLabel + %427 = OpAccessChain %_ptr_Function_int %p %uint_1 + %428 = OpLoad %int %427 + %429 = OpSLessThan %bool %428 %int_14 + OpStore %x_383 %429 + %430 = OpLoad %bool %x_383 + OpStore %x_384_phi %430 + OpBranch %425 + %425 = OpLabel + %431 = OpLoad %bool %x_384_phi + OpStore %x_397_phi %431 + OpSelectionMerge %432 None + OpBranchConditional %431 %433 %432 + %433 = OpLabel + %434 = OpAccessChain %_ptr_Function_int %p %uint_0 + %435 = OpLoad %int %434 + %436 = OpAccessChain %_ptr_Function_int %p %uint_1 + %437 = OpLoad %int %436 + %438 = OpIAdd %int %437 %int_2 + %439 = OpIMul %int %438 %int_16 + %440 = OpIAdd %int %435 %439 + %441 = OpAccessChain %_ptr_Private_int %map %440 + %442 = OpLoad %int %441 + %443 = OpIEqual %bool %442 %int_0 + OpStore %x_396 %443 + %444 = OpLoad %bool %x_396 + OpStore %x_397_phi %444 + OpBranch %432 + %432 = OpLabel + %445 = OpLoad %bool %x_397_phi + OpSelectionMerge %446 None + OpBranchConditional %445 %447 %446 + %447 = OpLabel + %448 = OpLoad %int %d + %449 = OpISub %int %448 %int_1 + OpStore %d %449 + %450 = OpAccessChain %_ptr_Function_int %p %uint_0 + %451 = OpLoad %int %450 + %452 = OpAccessChain %_ptr_Function_int %p %uint_1 + %453 = OpLoad %int %452 + %454 = OpIMul %int %453 %int_16 + %455 = OpIAdd %int %451 %454 + %456 = OpAccessChain %_ptr_Private_int %map %455 + OpStore %456 %int_1 + %457 = OpAccessChain %_ptr_Function_int %p %uint_0 + %458 = OpLoad %int %457 + %459 = OpAccessChain %_ptr_Function_int %p %uint_1 + %460 = OpLoad %int %459 + %461 = OpIAdd %int %460 %int_1 + %462 = OpIMul %int %461 %int_16 + %463 = OpIAdd %int %458 %462 + %464 = OpAccessChain %_ptr_Private_int %map %463 + OpStore %464 %int_1 + %465 = OpAccessChain %_ptr_Function_int %p %uint_0 + %466 = OpLoad %int %465 + %467 = OpAccessChain %_ptr_Function_int %p %uint_1 + %468 = OpLoad %int %467 + %469 = OpIAdd %int %468 %int_2 + %470 = OpIMul %int %469 %int_16 + %471 = OpIAdd %int %466 %470 + %472 = OpAccessChain %_ptr_Private_int %map %471 + OpStore %472 %int_1 + %473 = OpAccessChain %_ptr_Function_int %p %uint_1 + %474 = OpLoad %int %473 + %475 = OpAccessChain %_ptr_Function_int %p %uint_1 + %476 = OpIAdd %int %474 %int_2 + OpStore %475 %476 + OpBranch %446 + %446 = OpLabel + OpBranch %204 + %204 = OpLabel + %477 = OpAccessChain %_ptr_Function_int %ipos %uint_1 + %478 = OpLoad %int %477 + %479 = OpAccessChain %_ptr_Function_int %ipos %uint_0 + %480 = OpLoad %int %479 + %481 = OpIMul %int %478 %int_16 + %482 = OpIAdd %int %481 %480 + %483 = OpAccessChain %_ptr_Private_int %map %482 + %484 = OpLoad %int %483 + %485 = OpIEqual %bool %484 %int_1 + OpSelectionMerge %486 None + OpBranchConditional %485 %487 %486 + %487 = OpLabel + OpStore %x_GLF_color %489 + OpReturn + %486 = OpLabel + OpBranch %87 + %87 = OpLabel + %490 = OpLoad %bool %canwalk + OpSelectionMerge %491 None + OpBranchConditional %490 %492 %493 + %492 = OpLabel + OpBranch %491 + %493 = OpLabel + OpBranch %86 + %491 = OpLabel + OpBranch %85 + %86 = OpLabel + OpStore %x_GLF_color %495 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %496 +%tint_symbol_1 = OpFunctionParameter %main_out + %500 = OpLabel + %501 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %501 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %503 = OpLabel + %504 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %504 + %505 = OpFunctionCall %void %main_1 + %507 = OpLoad %v4float %x_GLF_color + %508 = OpCompositeConstruct %main_out %507 + %506 = OpFunctionCall %void %tint_symbol_3 %508 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 87[%87] is not post dominated by the back-edge block 491[%491] + %491 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..4128fb76d9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-access-chains/0-opt.wgsl.expected.wgsl @@ -0,0 +1,348 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var map : array; + +var x_GLF_color : vec4; + +fn main_1() { + var pos : vec2; + var ipos : vec2; + var i : i32; + var p : vec2; + var canwalk : bool; + var v : i32; + var directions : i32; + var j : i32; + var d : i32; + let x_57 : vec4 = gl_FragCoord; + let x_60 : vec2 = x_7.resolution; + pos = (vec2(x_57.x, x_57.y) / x_60); + let x_63 : f32 = pos.x; + let x_67 : f32 = pos.y; + ipos = vec2(i32((x_63 * 16.0)), i32((x_67 * 16.0))); + i = 0; + loop { + let x_75 : i32 = i; + if ((x_75 < 256)) { + } else { + break; + } + let x_78 : i32 = i; + map[x_78] = 0; + + continuing { + let x_80 : i32 = i; + i = (x_80 + 1); + } + } + p = vec2(0, 0); + canwalk = true; + v = 0; + loop { + var x_102 : bool; + var x_122 : bool; + var x_142 : bool; + var x_162 : bool; + var x_103_phi : bool; + var x_123_phi : bool; + var x_143_phi : bool; + var x_163_phi : bool; + let x_86 : i32 = v; + v = (x_86 + 1); + directions = 0; + let x_89 : i32 = p.x; + let x_90 : bool = (x_89 > 0); + x_103_phi = x_90; + if (x_90) { + let x_94 : i32 = p.x; + let x_97 : i32 = p.y; + let x_101 : i32 = map[((x_94 - 2) + (x_97 * 16))]; + x_102 = (x_101 == 0); + x_103_phi = x_102; + } + let x_103 : bool = x_103_phi; + if (x_103) { + let x_106 : i32 = directions; + directions = (x_106 + 1); + } + let x_109 : i32 = p.y; + let x_110 : bool = (x_109 > 0); + x_123_phi = x_110; + if (x_110) { + let x_114 : i32 = p.x; + let x_116 : i32 = p.y; + let x_121 : i32 = map[(x_114 + ((x_116 - 2) * 16))]; + x_122 = (x_121 == 0); + x_123_phi = x_122; + } + let x_123 : bool = x_123_phi; + if (x_123) { + let x_126 : i32 = directions; + directions = (x_126 + 1); + } + let x_129 : i32 = p.x; + let x_130 : bool = (x_129 < 14); + x_143_phi = x_130; + if (x_130) { + let x_134 : i32 = p.x; + let x_137 : i32 = p.y; + let x_141 : i32 = map[((x_134 + 2) + (x_137 * 16))]; + x_142 = (x_141 == 0); + x_143_phi = x_142; + } + let x_143 : bool = x_143_phi; + if (x_143) { + let x_146 : i32 = directions; + directions = (x_146 + 1); + } + let x_149 : i32 = p.y; + let x_150 : bool = (x_149 < 14); + x_163_phi = x_150; + if (x_150) { + let x_154 : i32 = p.x; + let x_156 : i32 = p.y; + let x_161 : i32 = map[(x_154 + ((x_156 + 2) * 16))]; + x_162 = (x_161 == 0); + x_163_phi = x_162; + } + let x_163 : bool = x_163_phi; + if (x_163) { + let x_166 : i32 = directions; + directions = (x_166 + 1); + } + var x_227 : bool; + var x_240 : bool; + var x_279 : bool; + var x_292 : bool; + var x_331 : bool; + var x_344 : bool; + var x_383 : bool; + var x_396 : bool; + var x_228_phi : bool; + var x_241_phi : bool; + var x_280_phi : bool; + var x_293_phi : bool; + var x_332_phi : bool; + var x_345_phi : bool; + var x_384_phi : bool; + var x_397_phi : bool; + let x_168 : i32 = directions; + if ((x_168 == 0)) { + canwalk = false; + i = 0; + loop { + let x_177 : i32 = i; + if ((x_177 < 8)) { + } else { + break; + } + j = 0; + loop { + let x_184 : i32 = j; + if ((x_184 < 8)) { + } else { + break; + } + let x_187 : i32 = j; + let x_189 : i32 = i; + let x_194 : i32 = map[((x_187 * 2) + ((x_189 * 2) * 16))]; + if ((x_194 == 0)) { + let x_198 : i32 = j; + p.x = (x_198 * 2); + let x_201 : i32 = i; + p.y = (x_201 * 2); + canwalk = true; + } + + continuing { + let x_204 : i32 = j; + j = (x_204 + 1); + } + } + + continuing { + let x_206 : i32 = i; + i = (x_206 + 1); + } + } + let x_209 : i32 = p.x; + let x_211 : i32 = p.y; + map[(x_209 + (x_211 * 16))] = 1; + } else { + let x_215 : i32 = v; + let x_216 : i32 = directions; + d = (x_215 % x_216); + let x_218 : i32 = directions; + let x_219 : i32 = v; + v = (x_219 + x_218); + let x_221 : i32 = d; + let x_222 : bool = (x_221 >= 0); + x_228_phi = x_222; + if (x_222) { + let x_226 : i32 = p.x; + x_227 = (x_226 > 0); + x_228_phi = x_227; + } + let x_228 : bool = x_228_phi; + x_241_phi = x_228; + if (x_228) { + let x_232 : i32 = p.x; + let x_235 : i32 = p.y; + let x_239 : i32 = map[((x_232 - 2) + (x_235 * 16))]; + x_240 = (x_239 == 0); + x_241_phi = x_240; + } + let x_241 : bool = x_241_phi; + if (x_241) { + let x_244 : i32 = d; + d = (x_244 - 1); + let x_247 : i32 = p.x; + let x_249 : i32 = p.y; + map[(x_247 + (x_249 * 16))] = 1; + let x_254 : i32 = p.x; + let x_257 : i32 = p.y; + map[((x_254 - 1) + (x_257 * 16))] = 1; + let x_262 : i32 = p.x; + let x_265 : i32 = p.y; + map[((x_262 - 2) + (x_265 * 16))] = 1; + let x_270 : i32 = p.x; + p.x = (x_270 - 2); + } + let x_273 : i32 = d; + let x_274 : bool = (x_273 >= 0); + x_280_phi = x_274; + if (x_274) { + let x_278 : i32 = p.y; + x_279 = (x_278 > 0); + x_280_phi = x_279; + } + let x_280 : bool = x_280_phi; + x_293_phi = x_280; + if (x_280) { + let x_284 : i32 = p.x; + let x_286 : i32 = p.y; + let x_291 : i32 = map[(x_284 + ((x_286 - 2) * 16))]; + x_292 = (x_291 == 0); + x_293_phi = x_292; + } + let x_293 : bool = x_293_phi; + if (x_293) { + let x_296 : i32 = d; + d = (x_296 - 1); + let x_299 : i32 = p.x; + let x_301 : i32 = p.y; + map[(x_299 + (x_301 * 16))] = 1; + let x_306 : i32 = p.x; + let x_308 : i32 = p.y; + map[(x_306 + ((x_308 - 1) * 16))] = 1; + let x_314 : i32 = p.x; + let x_316 : i32 = p.y; + map[(x_314 + ((x_316 - 2) * 16))] = 1; + let x_322 : i32 = p.y; + p.y = (x_322 - 2); + } + let x_325 : i32 = d; + let x_326 : bool = (x_325 >= 0); + x_332_phi = x_326; + if (x_326) { + let x_330 : i32 = p.x; + x_331 = (x_330 < 14); + x_332_phi = x_331; + } + let x_332 : bool = x_332_phi; + x_345_phi = x_332; + if (x_332) { + let x_336 : i32 = p.x; + let x_339 : i32 = p.y; + let x_343 : i32 = map[((x_336 + 2) + (x_339 * 16))]; + x_344 = (x_343 == 0); + x_345_phi = x_344; + } + let x_345 : bool = x_345_phi; + if (x_345) { + let x_348 : i32 = d; + d = (x_348 - 1); + let x_351 : i32 = p.x; + let x_353 : i32 = p.y; + map[(x_351 + (x_353 * 16))] = 1; + let x_358 : i32 = p.x; + let x_361 : i32 = p.y; + map[((x_358 + 1) + (x_361 * 16))] = 1; + let x_366 : i32 = p.x; + let x_369 : i32 = p.y; + map[((x_366 + 2) + (x_369 * 16))] = 1; + let x_374 : i32 = p.x; + p.x = (x_374 + 2); + } + let x_377 : i32 = d; + let x_378 : bool = (x_377 >= 0); + x_384_phi = x_378; + if (x_378) { + let x_382 : i32 = p.y; + x_383 = (x_382 < 14); + x_384_phi = x_383; + } + let x_384 : bool = x_384_phi; + x_397_phi = x_384; + if (x_384) { + let x_388 : i32 = p.x; + let x_390 : i32 = p.y; + let x_395 : i32 = map[(x_388 + ((x_390 + 2) * 16))]; + x_396 = (x_395 == 0); + x_397_phi = x_396; + } + let x_397 : bool = x_397_phi; + if (x_397) { + let x_400 : i32 = d; + d = (x_400 - 1); + let x_403 : i32 = p.x; + let x_405 : i32 = p.y; + map[(x_403 + (x_405 * 16))] = 1; + let x_410 : i32 = p.x; + let x_412 : i32 = p.y; + map[(x_410 + ((x_412 + 1) * 16))] = 1; + let x_418 : i32 = p.x; + let x_420 : i32 = p.y; + map[(x_418 + ((x_420 + 2) * 16))] = 1; + let x_426 : i32 = p.y; + p.y = (x_426 + 2); + } + } + let x_430 : i32 = ipos.y; + let x_433 : i32 = ipos.x; + let x_436 : i32 = map[((x_430 * 16) + x_433)]; + if ((x_436 == 1)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + return; + } + + continuing { + let x_440 : bool = canwalk; + if (x_440) { + } else { + break; + } + } + } + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm new file mode 100644 index 0000000000..208f178335 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm @@ -0,0 +1,223 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %c "c" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_n0_5 = OpConstant %float -0.5 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %27 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %43 = OpUndef %float +%float_0_125 = OpConstant %float 0.125 + %main = OpFunction %void None %9 + %45 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function + OpStore %c %27 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %47 = OpLoad %float %46 + %48 = OpFMul %float %47 %float_0_125 + %49 = OpExtInst %float %1 Round %48 + %50 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %51 = OpLoad %float %50 + OpSelectionMerge %52 None + OpSwitch %uint_0 %53 + %53 = OpLabel + OpBranch %54 + %54 = OpLabel + %55 = OpPhi %float %float_n0_5 %53 %56 %57 + %58 = OpPhi %int %int_1 %53 %59 %57 + %60 = OpSLessThan %bool %58 %int_800 + OpLoopMerge %61 %57 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + %63 = OpSMod %int %58 %int_32 + %64 = OpIEqual %bool %63 %int_0 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %67 + %66 = OpLabel + %68 = OpFAdd %float %55 %float_0_400000006 + OpBranch %65 + %67 = OpLabel + %69 = OpConvertSToF %float %58 + %70 = OpExtInst %float %1 Round %49 + %71 = OpFMod %float %69 %70 + %72 = OpFOrdLessThanEqual %bool %71 %float_0_00999999978 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpFAdd %float %55 %float_100 + OpBranch %73 + %73 = OpLabel + %76 = OpPhi %float %55 %67 %75 %74 + OpBranch %65 + %65 = OpLabel + %56 = OpPhi %float %68 %66 %76 %73 + %77 = OpConvertSToF %float %58 + %78 = OpFOrdGreaterThanEqual %bool %77 %51 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + OpBranch %61 + %79 = OpLabel + OpBranch %57 + %57 = OpLabel + %59 = OpIAdd %int %58 %int_1 + OpBranch %54 + %61 = OpLabel + %81 = OpPhi %float %43 %54 %56 %80 + %82 = OpPhi %float %55 %54 %56 %80 + %83 = OpPhi %bool %false %54 %true %80 + OpSelectionMerge %84 None + OpBranchConditional %83 %52 %84 + %84 = OpLabel + OpBranch %52 + %52 = OpLabel + %85 = OpPhi %float %81 %61 %82 %84 + %86 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %86 %85 + %87 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %88 = OpLoad %float %87 + OpSelectionMerge %89 None + OpSwitch %uint_0 %90 + %90 = OpLabel + OpBranch %91 + %91 = OpLabel + %92 = OpPhi %float %float_n0_5 %90 %93 %94 + %95 = OpPhi %int %int_1 %90 %96 %94 + %97 = OpSLessThan %bool %95 %int_800 + OpLoopMerge %98 %94 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSMod %int %95 %int_32 + %101 = OpIEqual %bool %100 %int_0 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + %105 = OpFAdd %float %92 %float_0_400000006 + OpBranch %102 + %104 = OpLabel + %106 = OpConvertSToF %float %95 + %107 = OpExtInst %float %1 Round %49 + %108 = OpFMod %float %106 %107 + %109 = OpFOrdLessThanEqual %bool %108 %float_0_00999999978 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpFAdd %float %92 %float_100 + OpBranch %110 + %110 = OpLabel + %113 = OpPhi %float %92 %104 %112 %111 + OpBranch %102 + %102 = OpLabel + %93 = OpPhi %float %105 %103 %113 %110 + %114 = OpConvertSToF %float %95 + %115 = OpFOrdGreaterThanEqual %bool %114 %88 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + OpBranch %98 + %116 = OpLabel + OpBranch %94 + %94 = OpLabel + %96 = OpIAdd %int %95 %int_1 + OpBranch %91 + %98 = OpLabel + %118 = OpPhi %float %43 %91 %93 %117 + %119 = OpPhi %float %92 %91 %93 %117 + %120 = OpPhi %bool %false %91 %true %117 + OpSelectionMerge %121 None + OpBranchConditional %120 %89 %121 + %121 = OpLabel + OpBranch %89 + %89 = OpLabel + %122 = OpPhi %float %118 %98 %119 %121 + %123 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %123 %122 + %124 = OpLoad %float %86 + %125 = OpLoad %float %123 + %126 = OpFAdd %float %124 %125 + %127 = OpAccessChain %_ptr_Function_float %c %uint_2 + OpStore %127 %126 + OpBranch %128 + %128 = OpLabel + %129 = OpPhi %int %int_0 %89 %130 %131 + %132 = OpSLessThan %bool %129 %int_3 + OpLoopMerge %133 %131 None + OpBranchConditional %132 %134 %133 + %134 = OpLabel + %135 = OpAccessChain %_ptr_Function_float %c %129 + %136 = OpLoad %float %135 + %137 = OpFOrdGreaterThanEqual %bool %136 %float_1 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %138 + %139 = OpLabel + %140 = OpLoad %float %135 + %141 = OpLoad %float %135 + %142 = OpFMul %float %140 %141 + OpStore %135 %142 + OpBranch %138 + %138 = OpLabel + OpBranch %131 + %131 = OpLabel + %130 = OpIAdd %int %129 %int_1 + OpBranch %128 + %133 = OpLabel + %143 = OpLoad %v3float %c + %144 = OpExtInst %v3float %1 FAbs %143 + %145 = OpExtInst %v3float %1 Normalize %144 + %146 = OpCompositeExtract %float %145 0 + %147 = OpCompositeExtract %float %145 1 + %148 = OpCompositeExtract %float %145 2 + %149 = OpCompositeConstruct %v4float %146 %147 %148 %float_1 + OpStore %_GLF_color %149 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..8d53961c48 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.hlsl @@ -0,0 +1,202 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float x_51 = 0.0f; + float x_55 = 0.0f; + float x_56 = 0.0f; + float x_81 = 0.0f; + float x_82 = 0.0f; + float x_118 = 0.0f; + float x_119 = 0.0f; + float x_55_phi = 0.0f; + int x_58_phi = 0; + float x_81_phi = 0.0f; + float x_82_phi = 0.0f; + bool x_83_phi = false; + float x_85_phi = 0.0f; + float x_122_phi = 0.0f; + int x_129_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_47 = asfloat(x_7[0].x); + const float x_49 = round((x_47 * 0.125f)); + x_51 = gl_FragCoord.x; + switch(0u) { + default: { + x_55_phi = -0.5f; + x_58_phi = 1; + while (true) { + float x_68 = 0.0f; + float x_76 = 0.0f; + int x_59 = 0; + float x_56_phi = 0.0f; + x_55 = x_55_phi; + const int x_58 = x_58_phi; + x_81_phi = 0.0f; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + float x_75 = 0.0f; + float x_76_phi = 0.0f; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006f); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((float(x_58) % round(x_49)) <= 0.01f)) { + x_75 = (x_55 + 100.0f); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((float(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + const bool x_83 = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + break; + } + } + float x_88 = 0.0f; + float x_92 = 0.0f; + float x_93 = 0.0f; + float x_92_phi = 0.0f; + int x_95_phi = 0; + float x_118_phi = 0.0f; + float x_119_phi = 0.0f; + bool x_120_phi = false; + const float x_85 = x_85_phi; + c.x = x_85; + x_88 = gl_FragCoord.y; + switch(0u) { + default: { + x_92_phi = -0.5f; + x_95_phi = 1; + while (true) { + float x_105 = 0.0f; + float x_113 = 0.0f; + int x_96 = 0; + float x_93_phi = 0.0f; + x_92 = x_92_phi; + const int x_95 = x_95_phi; + x_118_phi = 0.0f; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + float x_112 = 0.0f; + float x_113_phi = 0.0f; + if (((x_95 % 32) == 0)) { + x_105 = (x_92 + 0.400000006f); + x_93_phi = x_105; + } else { + x_113_phi = x_92; + if (((float(x_95) % round(x_49)) <= 0.01f)) { + x_112 = (x_92 + 100.0f); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_93_phi = x_113; + } + x_93 = x_93_phi; + if ((float(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + const bool x_120 = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + break; + } + } + const float x_122 = x_122_phi; + c.y = x_122; + const float x_124 = c.x; + const float x_125 = c.y; + c.z = (x_124 + x_125); + x_129_phi = 0; + while (true) { + int x_130 = 0; + const int x_129 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + const int x_135_save = x_129; + const float x_136 = c[x_135_save]; + if ((x_136 >= 1.0f)) { + const float x_140 = c[x_135_save]; + const float x_141 = c[x_135_save]; + set_float3(c, x_135_save, (x_140 * x_141)); + } + { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + const float3 x_145 = normalize(abs(c)); + x_GLF_color = float4(x_145.x, x_145.y, x_145.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.msl new file mode 100755 index 0000000000..6b28523db2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.msl @@ -0,0 +1,208 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float x_51 = 0.0f; + float x_55 = 0.0f; + float x_56 = 0.0f; + float x_81 = 0.0f; + float x_82 = 0.0f; + float x_118 = 0.0f; + float x_119 = 0.0f; + float x_55_phi = 0.0f; + int x_58_phi = 0; + float x_81_phi = 0.0f; + float x_82_phi = 0.0f; + bool x_83_phi = false; + float x_85_phi = 0.0f; + float x_122_phi = 0.0f; + int x_129_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_47 = x_7.resolution.x; + float const x_49 = rint((x_47 * 0.125f)); + x_51 = (*(tint_symbol_5)).x; + switch(0u) { + default: { + x_55_phi = -0.5f; + x_58_phi = 1; + while (true) { + float x_68 = 0.0f; + float x_76 = 0.0f; + int x_59 = 0; + float x_56_phi = 0.0f; + x_55 = x_55_phi; + int const x_58 = x_58_phi; + x_81_phi = 0.0f; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + float x_75 = 0.0f; + float x_76_phi = 0.0f; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006f); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((float(x_58) % rint(x_49)) <= 0.01f)) { + x_75 = (x_55 + 100.0f); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((float(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + bool const x_83 = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + break; + } + } + float x_88 = 0.0f; + float x_92 = 0.0f; + float x_93 = 0.0f; + float x_92_phi = 0.0f; + int x_95_phi = 0; + float x_118_phi = 0.0f; + float x_119_phi = 0.0f; + bool x_120_phi = false; + float const x_85 = x_85_phi; + c.x = x_85; + x_88 = (*(tint_symbol_5)).y; + switch(0u) { + default: { + x_92_phi = -0.5f; + x_95_phi = 1; + while (true) { + float x_105 = 0.0f; + float x_113 = 0.0f; + int x_96 = 0; + float x_93_phi = 0.0f; + x_92 = x_92_phi; + int const x_95 = x_95_phi; + x_118_phi = 0.0f; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + float x_112 = 0.0f; + float x_113_phi = 0.0f; + if (((x_95 % 32) == 0)) { + x_105 = (x_92 + 0.400000006f); + x_93_phi = x_105; + } else { + x_113_phi = x_92; + if (((float(x_95) % rint(x_49)) <= 0.01f)) { + x_112 = (x_92 + 100.0f); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_93_phi = x_113; + } + x_93 = x_93_phi; + if ((float(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + bool const x_120 = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + break; + } + } + float const x_122 = x_122_phi; + c.y = x_122; + float const x_124 = c.x; + float const x_125 = c.y; + c.z = (x_124 + x_125); + x_129_phi = 0; + while (true) { + int x_130 = 0; + int const x_129 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + int const x_135_save = x_129; + float const x_136 = c[x_135_save]; + if ((x_136 >= 1.0f)) { + float const x_140 = c[x_135_save]; + float const x_141 = c[x_135_save]; + c[x_135_save] = (x_140 * x_141); + } + { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + float3 const x_143 = c; + float3 const x_145 = normalize(fabs(x_143)); + *(tint_symbol_6) = float4(x_145.x, x_145.y, x_145.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\u2mo.0.metal:60:29: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_58) % rint(x_49)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~ +T:\tmp\u2mo.0.metal:127:29: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_95) % rint(x_49)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~ +2 errors generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..fdd3fe1211 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.spvasm @@ -0,0 +1,449 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 254 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %c "c" + OpName %x_51 "x_51" + OpName %x_55 "x_55" + OpName %x_56 "x_56" + OpName %x_81 "x_81" + OpName %x_82 "x_82" + OpName %x_118 "x_118" + OpName %x_119 "x_119" + OpName %x_55_phi "x_55_phi" + OpName %x_58_phi "x_58_phi" + OpName %x_81_phi "x_81_phi" + OpName %x_82_phi "x_82_phi" + OpName %x_83_phi "x_83_phi" + OpName %x_85_phi "x_85_phi" + OpName %x_122_phi "x_122_phi" + OpName %x_129_phi "x_129_phi" + OpName %x_68 "x_68" + OpName %x_76 "x_76" + OpName %x_59 "x_59" + OpName %x_56_phi "x_56_phi" + OpName %x_75 "x_75" + OpName %x_76_phi "x_76_phi" + OpName %x_88 "x_88" + OpName %x_92 "x_92" + OpName %x_93 "x_93" + OpName %x_92_phi "x_92_phi" + OpName %x_95_phi "x_95_phi" + OpName %x_118_phi "x_118_phi" + OpName %x_119_phi "x_119_phi" + OpName %x_120_phi "x_120_phi" + OpName %x_105 "x_105" + OpName %x_113 "x_113" + OpName %x_96 "x_96" + OpName %x_93_phi "x_93_phi" + OpName %x_112 "x_112" + OpName %x_113_phi "x_113_phi" + OpName %x_130 "x_130" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %22 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %36 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %42 = OpConstantNull %bool + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %49 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0_125 = OpConstant %float 0.125 +%_ptr_Private_float = OpTypePointer Private %float + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %int_800 = OpConstant %int 800 + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %241 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %22 + %x_51 = OpVariable %_ptr_Function_float Function %25 + %x_55 = OpVariable %_ptr_Function_float Function %25 + %x_56 = OpVariable %_ptr_Function_float Function %25 + %x_81 = OpVariable %_ptr_Function_float Function %25 + %x_82 = OpVariable %_ptr_Function_float Function %25 + %x_118 = OpVariable %_ptr_Function_float Function %25 + %x_119 = OpVariable %_ptr_Function_float Function %25 + %x_55_phi = OpVariable %_ptr_Function_float Function %25 + %x_58_phi = OpVariable %_ptr_Function_int Function %36 + %x_81_phi = OpVariable %_ptr_Function_float Function %25 + %x_82_phi = OpVariable %_ptr_Function_float Function %25 + %x_83_phi = OpVariable %_ptr_Function_bool Function %42 + %x_85_phi = OpVariable %_ptr_Function_float Function %25 + %x_122_phi = OpVariable %_ptr_Function_float Function %25 + %x_129_phi = OpVariable %_ptr_Function_int Function %36 + %x_68 = OpVariable %_ptr_Function_float Function %25 + %x_76 = OpVariable %_ptr_Function_float Function %25 + %x_59 = OpVariable %_ptr_Function_int Function %36 + %x_56_phi = OpVariable %_ptr_Function_float Function %25 + %x_75 = OpVariable %_ptr_Function_float Function %25 + %x_76_phi = OpVariable %_ptr_Function_float Function %25 + %x_88 = OpVariable %_ptr_Function_float Function %25 + %x_92 = OpVariable %_ptr_Function_float Function %25 + %x_93 = OpVariable %_ptr_Function_float Function %25 + %x_92_phi = OpVariable %_ptr_Function_float Function %25 + %x_95_phi = OpVariable %_ptr_Function_int Function %36 + %x_118_phi = OpVariable %_ptr_Function_float Function %25 + %x_119_phi = OpVariable %_ptr_Function_float Function %25 + %x_120_phi = OpVariable %_ptr_Function_bool Function %42 + %x_105 = OpVariable %_ptr_Function_float Function %25 + %x_113 = OpVariable %_ptr_Function_float Function %25 + %x_96 = OpVariable %_ptr_Function_int Function %36 + %x_93_phi = OpVariable %_ptr_Function_float Function %25 + %x_112 = OpVariable %_ptr_Function_float Function %25 + %x_113_phi = OpVariable %_ptr_Function_float Function %25 + %x_130 = OpVariable %_ptr_Function_int Function %36 + OpStore %c %49 + %53 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %54 = OpLoad %float %53 + %58 = OpFMul %float %54 %float_0_125 + %55 = OpExtInst %float %56 RoundEven %58 + %60 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %61 = OpLoad %float %60 + OpStore %x_51 %61 + OpSelectionMerge %62 None + OpSwitch %uint_0 %63 + %63 = OpLabel + OpStore %x_55_phi %float_n0_5 + OpStore %x_58_phi %int_1 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %74 = OpLoad %float %x_55_phi + OpStore %x_55 %74 + %75 = OpLoad %int %x_58_phi + OpStore %x_81_phi %float_0 + %77 = OpLoad %float %x_55 + OpStore %x_82_phi %77 + OpStore %x_83_phi %false + %80 = OpSLessThan %bool %75 %int_800 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %67 + %81 = OpLabel + %87 = OpSMod %int %75 %int_32 + %89 = OpIEqual %bool %87 %int_0 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 + %91 = OpLabel + %93 = OpLoad %float %x_55 + %95 = OpFAdd %float %93 %float_0_400000006 + OpStore %x_68 %95 + %96 = OpLoad %float %x_68 + OpStore %x_56_phi %96 + OpBranch %90 + %92 = OpLabel + %97 = OpLoad %float %x_55 + OpStore %x_76_phi %97 + %98 = OpConvertSToF %float %75 + %99 = OpExtInst %float %56 RoundEven %55 + %100 = OpFMod %float %98 %99 + %102 = OpFOrdLessThanEqual %bool %100 %float_0_00999999978 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %103 + %104 = OpLabel + %105 = OpLoad %float %x_55 + %107 = OpFAdd %float %105 %float_100 + OpStore %x_75 %107 + %108 = OpLoad %float %x_75 + OpStore %x_76_phi %108 + OpBranch %103 + %103 = OpLabel + %109 = OpLoad %float %x_76_phi + OpStore %x_76 %109 + %110 = OpLoad %float %x_76 + OpStore %x_56_phi %110 + OpBranch %90 + %90 = OpLabel + %111 = OpLoad %float %x_56_phi + OpStore %x_56 %111 + %112 = OpConvertSToF %float %75 + %113 = OpLoad %float %x_51 + %114 = OpFOrdGreaterThanEqual %bool %112 %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %115 + %116 = OpLabel + %117 = OpLoad %float %x_56 + OpStore %x_81_phi %117 + %118 = OpLoad %float %x_56 + OpStore %x_82_phi %118 + OpStore %x_83_phi %true + OpBranch %67 + %115 = OpLabel + OpBranch %68 + %68 = OpLabel + %120 = OpIAdd %int %75 %int_1 + OpStore %x_59 %120 + %121 = OpLoad %float %x_56 + OpStore %x_55_phi %121 + %122 = OpLoad %int %x_59 + OpStore %x_58_phi %122 + OpBranch %66 + %67 = OpLabel + %123 = OpLoad %float %x_81_phi + OpStore %x_81 %123 + %124 = OpLoad %float %x_82_phi + OpStore %x_82 %124 + %125 = OpLoad %bool %x_83_phi + %126 = OpLoad %float %x_81 + OpStore %x_85_phi %126 + OpSelectionMerge %127 None + OpBranchConditional %125 %128 %127 + %128 = OpLabel + OpBranch %62 + %127 = OpLabel + %129 = OpLoad %float %x_82 + OpStore %x_85_phi %129 + OpBranch %62 + %62 = OpLabel + %138 = OpLoad %float %x_85_phi + %139 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %139 %138 + %141 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %142 = OpLoad %float %141 + OpStore %x_88 %142 + OpSelectionMerge %143 None + OpSwitch %uint_0 %144 + %144 = OpLabel + OpStore %x_92_phi %float_n0_5 + OpStore %x_95_phi %int_1 + OpBranch %145 + %145 = OpLabel + OpLoopMerge %146 %147 None + OpBranch %148 + %148 = OpLabel + %153 = OpLoad %float %x_92_phi + OpStore %x_92 %153 + %154 = OpLoad %int %x_95_phi + OpStore %x_118_phi %float_0 + %155 = OpLoad %float %x_92 + OpStore %x_119_phi %155 + OpStore %x_120_phi %false + %156 = OpSLessThan %bool %154 %int_800 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %159 + %158 = OpLabel + OpBranch %157 + %159 = OpLabel + OpBranch %146 + %157 = OpLabel + %162 = OpSMod %int %154 %int_32 + %163 = OpIEqual %bool %162 %int_0 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %166 + %165 = OpLabel + %167 = OpLoad %float %x_92 + %168 = OpFAdd %float %167 %float_0_400000006 + OpStore %x_105 %168 + %169 = OpLoad %float %x_105 + OpStore %x_93_phi %169 + OpBranch %164 + %166 = OpLabel + %170 = OpLoad %float %x_92 + OpStore %x_113_phi %170 + %171 = OpConvertSToF %float %154 + %172 = OpExtInst %float %56 RoundEven %55 + %173 = OpFMod %float %171 %172 + %174 = OpFOrdLessThanEqual %bool %173 %float_0_00999999978 + OpSelectionMerge %175 None + OpBranchConditional %174 %176 %175 + %176 = OpLabel + %177 = OpLoad %float %x_92 + %178 = OpFAdd %float %177 %float_100 + OpStore %x_112 %178 + %179 = OpLoad %float %x_112 + OpStore %x_113_phi %179 + OpBranch %175 + %175 = OpLabel + %180 = OpLoad %float %x_113_phi + OpStore %x_113 %180 + %181 = OpLoad %float %x_113 + OpStore %x_93_phi %181 + OpBranch %164 + %164 = OpLabel + %182 = OpLoad %float %x_93_phi + OpStore %x_93 %182 + %183 = OpConvertSToF %float %154 + %184 = OpLoad %float %x_88 + %185 = OpFOrdGreaterThanEqual %bool %183 %184 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %186 + %187 = OpLabel + %188 = OpLoad %float %x_93 + OpStore %x_118_phi %188 + %189 = OpLoad %float %x_93 + OpStore %x_119_phi %189 + OpStore %x_120_phi %true + OpBranch %146 + %186 = OpLabel + OpBranch %147 + %147 = OpLabel + %190 = OpIAdd %int %154 %int_1 + OpStore %x_96 %190 + %191 = OpLoad %float %x_93 + OpStore %x_92_phi %191 + %192 = OpLoad %int %x_96 + OpStore %x_95_phi %192 + OpBranch %145 + %146 = OpLabel + %193 = OpLoad %float %x_118_phi + OpStore %x_118 %193 + %194 = OpLoad %float %x_119_phi + OpStore %x_119 %194 + %195 = OpLoad %bool %x_120_phi + %196 = OpLoad %float %x_118 + OpStore %x_122_phi %196 + OpSelectionMerge %197 None + OpBranchConditional %195 %198 %197 + %198 = OpLabel + OpBranch %143 + %197 = OpLabel + %199 = OpLoad %float %x_119 + OpStore %x_122_phi %199 + OpBranch %143 + %143 = OpLabel + %200 = OpLoad %float %x_122_phi + %201 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %201 %200 + %202 = OpAccessChain %_ptr_Function_float %c %uint_0 + %203 = OpLoad %float %202 + %204 = OpAccessChain %_ptr_Function_float %c %uint_1 + %205 = OpLoad %float %204 + %207 = OpAccessChain %_ptr_Function_float %c %uint_2 + %208 = OpFAdd %float %203 %205 + OpStore %207 %208 + OpStore %x_129_phi %int_0 + OpBranch %209 + %209 = OpLabel + OpLoopMerge %210 %211 None + OpBranch %212 + %212 = OpLabel + %214 = OpLoad %int %x_129_phi + %216 = OpSLessThan %bool %214 %int_3 + OpSelectionMerge %217 None + OpBranchConditional %216 %218 %219 + %218 = OpLabel + OpBranch %217 + %219 = OpLabel + OpBranch %210 + %217 = OpLabel + %220 = OpAccessChain %_ptr_Function_float %c %214 + %221 = OpLoad %float %220 + %223 = OpFOrdGreaterThanEqual %bool %221 %float_1 + OpSelectionMerge %224 None + OpBranchConditional %223 %225 %224 + %225 = OpLabel + %226 = OpAccessChain %_ptr_Function_float %c %214 + %227 = OpLoad %float %226 + %228 = OpAccessChain %_ptr_Function_float %c %214 + %229 = OpLoad %float %228 + %230 = OpAccessChain %_ptr_Function_float %c %214 + %231 = OpFMul %float %227 %229 + OpStore %230 %231 + OpBranch %224 + %224 = OpLabel + OpBranch %211 + %211 = OpLabel + %232 = OpIAdd %int %214 %int_1 + OpStore %x_130 %232 + %233 = OpLoad %int %x_130 + OpStore %x_129_phi %233 + OpBranch %209 + %210 = OpLabel + %234 = OpLoad %v3float %c + %236 = OpExtInst %v3float %56 FAbs %234 + %235 = OpExtInst %v3float %56 Normalize %236 + %237 = OpCompositeExtract %float %235 0 + %238 = OpCompositeExtract %float %235 1 + %239 = OpCompositeExtract %float %235 2 + %240 = OpCompositeConstruct %v4float %237 %238 %239 %float_1 + OpStore %x_GLF_color %240 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %241 +%tint_symbol_1 = OpFunctionParameter %main_out + %245 = OpLabel + %246 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %246 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %248 = OpLabel + %249 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %249 + %250 = OpFunctionCall %void %main_1 + %252 = OpLoad %v4float %x_GLF_color + %253 = OpCompositeConstruct %main_out %252 + %251 = OpFunctionCall %void %tint_symbol_3 %253 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..41e57f4774 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.spvasm.expected.wgsl @@ -0,0 +1,200 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec3; + var x_51 : f32; + var x_55 : f32; + var x_56 : f32; + var x_81 : f32; + var x_82 : f32; + var x_118 : f32; + var x_119 : f32; + var x_55_phi : f32; + var x_58_phi : i32; + var x_81_phi : f32; + var x_82_phi : f32; + var x_83_phi : bool; + var x_85_phi : f32; + var x_122_phi : f32; + var x_129_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_47 : f32 = x_7.resolution.x; + let x_49 : f32 = round((x_47 * 0.125)); + x_51 = gl_FragCoord.x; + switch(0u) { + default: { + x_55_phi = -0.5; + x_58_phi = 1; + loop { + var x_68 : f32; + var x_76 : f32; + var x_59 : i32; + var x_56_phi : f32; + x_55 = x_55_phi; + let x_58 : i32 = x_58_phi; + x_81_phi = 0.0; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + var x_75 : f32; + var x_76_phi : f32; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((f32(x_58) % round(x_49)) <= 0.01)) { + x_75 = (x_55 + 100.0); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((f32(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + + continuing { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + let x_83 : bool = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + } + } + var x_88 : f32; + var x_92 : f32; + var x_93 : f32; + var x_92_phi : f32; + var x_95_phi : i32; + var x_118_phi : f32; + var x_119_phi : f32; + var x_120_phi : bool; + let x_85 : f32 = x_85_phi; + let x_86 : ptr = &(c.x); + *(x_86) = x_85; + x_88 = gl_FragCoord.y; + switch(0u) { + default: { + x_92_phi = -0.5; + x_95_phi = 1; + loop { + var x_105 : f32; + var x_113 : f32; + var x_96 : i32; + var x_93_phi : f32; + x_92 = x_92_phi; + let x_95 : i32 = x_95_phi; + x_118_phi = 0.0; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + var x_112 : f32; + var x_113_phi : f32; + if (((x_95 % 32) == 0)) { + x_105 = (x_92 + 0.400000006); + x_93_phi = x_105; + } else { + x_113_phi = x_92; + if (((f32(x_95) % round(x_49)) <= 0.01)) { + x_112 = (x_92 + 100.0); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_93_phi = x_113; + } + x_93 = x_93_phi; + if ((f32(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + + continuing { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + let x_120 : bool = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + } + } + let x_122 : f32 = x_122_phi; + let x_123 : ptr = &(c.y); + *(x_123) = x_122; + let x_124 : f32 = *(x_86); + let x_125 : f32 = *(x_123); + c.z = (x_124 + x_125); + x_129_phi = 0; + loop { + var x_130 : i32; + let x_129 : i32 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + let x_135 : ptr = &(c[x_129]); + let x_136 : f32 = *(x_135); + if ((x_136 >= 1.0)) { + let x_140 : f32 = *(x_135); + let x_141 : f32 = *(x_135); + *(x_135) = (x_140 * x_141); + } + + continuing { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + let x_143 : vec3 = c; + let x_145 : vec3 = normalize(abs(x_143)); + x_GLF_color = vec4(x_145.x, x_145.y, x_145.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl new file mode 100644 index 0000000000..41e57f4774 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl @@ -0,0 +1,200 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec3; + var x_51 : f32; + var x_55 : f32; + var x_56 : f32; + var x_81 : f32; + var x_82 : f32; + var x_118 : f32; + var x_119 : f32; + var x_55_phi : f32; + var x_58_phi : i32; + var x_81_phi : f32; + var x_82_phi : f32; + var x_83_phi : bool; + var x_85_phi : f32; + var x_122_phi : f32; + var x_129_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_47 : f32 = x_7.resolution.x; + let x_49 : f32 = round((x_47 * 0.125)); + x_51 = gl_FragCoord.x; + switch(0u) { + default: { + x_55_phi = -0.5; + x_58_phi = 1; + loop { + var x_68 : f32; + var x_76 : f32; + var x_59 : i32; + var x_56_phi : f32; + x_55 = x_55_phi; + let x_58 : i32 = x_58_phi; + x_81_phi = 0.0; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + var x_75 : f32; + var x_76_phi : f32; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((f32(x_58) % round(x_49)) <= 0.01)) { + x_75 = (x_55 + 100.0); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((f32(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + + continuing { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + let x_83 : bool = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + } + } + var x_88 : f32; + var x_92 : f32; + var x_93 : f32; + var x_92_phi : f32; + var x_95_phi : i32; + var x_118_phi : f32; + var x_119_phi : f32; + var x_120_phi : bool; + let x_85 : f32 = x_85_phi; + let x_86 : ptr = &(c.x); + *(x_86) = x_85; + x_88 = gl_FragCoord.y; + switch(0u) { + default: { + x_92_phi = -0.5; + x_95_phi = 1; + loop { + var x_105 : f32; + var x_113 : f32; + var x_96 : i32; + var x_93_phi : f32; + x_92 = x_92_phi; + let x_95 : i32 = x_95_phi; + x_118_phi = 0.0; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + var x_112 : f32; + var x_113_phi : f32; + if (((x_95 % 32) == 0)) { + x_105 = (x_92 + 0.400000006); + x_93_phi = x_105; + } else { + x_113_phi = x_92; + if (((f32(x_95) % round(x_49)) <= 0.01)) { + x_112 = (x_92 + 100.0); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_93_phi = x_113; + } + x_93 = x_93_phi; + if ((f32(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + + continuing { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + let x_120 : bool = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + } + } + let x_122 : f32 = x_122_phi; + let x_123 : ptr = &(c.y); + *(x_123) = x_122; + let x_124 : f32 = *(x_86); + let x_125 : f32 = *(x_123); + c.z = (x_124 + x_125); + x_129_phi = 0; + loop { + var x_130 : i32; + let x_129 : i32 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + let x_135 : ptr = &(c[x_129]); + let x_136 : f32 = *(x_135); + if ((x_136 >= 1.0)) { + let x_140 : f32 = *(x_135); + let x_141 : f32 = *(x_135); + *(x_135) = (x_140 * x_141); + } + + continuing { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + let x_143 : vec3 = c; + let x_145 : vec3 = normalize(abs(x_143)); + x_GLF_color = vec4(x_145.x, x_145.y, x_145.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..8d53961c48 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.hlsl @@ -0,0 +1,202 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float x_51 = 0.0f; + float x_55 = 0.0f; + float x_56 = 0.0f; + float x_81 = 0.0f; + float x_82 = 0.0f; + float x_118 = 0.0f; + float x_119 = 0.0f; + float x_55_phi = 0.0f; + int x_58_phi = 0; + float x_81_phi = 0.0f; + float x_82_phi = 0.0f; + bool x_83_phi = false; + float x_85_phi = 0.0f; + float x_122_phi = 0.0f; + int x_129_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_47 = asfloat(x_7[0].x); + const float x_49 = round((x_47 * 0.125f)); + x_51 = gl_FragCoord.x; + switch(0u) { + default: { + x_55_phi = -0.5f; + x_58_phi = 1; + while (true) { + float x_68 = 0.0f; + float x_76 = 0.0f; + int x_59 = 0; + float x_56_phi = 0.0f; + x_55 = x_55_phi; + const int x_58 = x_58_phi; + x_81_phi = 0.0f; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + float x_75 = 0.0f; + float x_76_phi = 0.0f; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006f); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((float(x_58) % round(x_49)) <= 0.01f)) { + x_75 = (x_55 + 100.0f); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((float(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + const bool x_83 = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + break; + } + } + float x_88 = 0.0f; + float x_92 = 0.0f; + float x_93 = 0.0f; + float x_92_phi = 0.0f; + int x_95_phi = 0; + float x_118_phi = 0.0f; + float x_119_phi = 0.0f; + bool x_120_phi = false; + const float x_85 = x_85_phi; + c.x = x_85; + x_88 = gl_FragCoord.y; + switch(0u) { + default: { + x_92_phi = -0.5f; + x_95_phi = 1; + while (true) { + float x_105 = 0.0f; + float x_113 = 0.0f; + int x_96 = 0; + float x_93_phi = 0.0f; + x_92 = x_92_phi; + const int x_95 = x_95_phi; + x_118_phi = 0.0f; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + float x_112 = 0.0f; + float x_113_phi = 0.0f; + if (((x_95 % 32) == 0)) { + x_105 = (x_92 + 0.400000006f); + x_93_phi = x_105; + } else { + x_113_phi = x_92; + if (((float(x_95) % round(x_49)) <= 0.01f)) { + x_112 = (x_92 + 100.0f); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_93_phi = x_113; + } + x_93 = x_93_phi; + if ((float(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + const bool x_120 = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + break; + } + } + const float x_122 = x_122_phi; + c.y = x_122; + const float x_124 = c.x; + const float x_125 = c.y; + c.z = (x_124 + x_125); + x_129_phi = 0; + while (true) { + int x_130 = 0; + const int x_129 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + const int x_135_save = x_129; + const float x_136 = c[x_135_save]; + if ((x_136 >= 1.0f)) { + const float x_140 = c[x_135_save]; + const float x_141 = c[x_135_save]; + set_float3(c, x_135_save, (x_140 * x_141)); + } + { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + const float3 x_145 = normalize(abs(c)); + x_GLF_color = float4(x_145.x, x_145.y, x_145.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.msl new file mode 100755 index 0000000000..a68104df10 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.msl @@ -0,0 +1,208 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float x_51 = 0.0f; + float x_55 = 0.0f; + float x_56 = 0.0f; + float x_81 = 0.0f; + float x_82 = 0.0f; + float x_118 = 0.0f; + float x_119 = 0.0f; + float x_55_phi = 0.0f; + int x_58_phi = 0; + float x_81_phi = 0.0f; + float x_82_phi = 0.0f; + bool x_83_phi = false; + float x_85_phi = 0.0f; + float x_122_phi = 0.0f; + int x_129_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_47 = x_7.resolution.x; + float const x_49 = rint((x_47 * 0.125f)); + x_51 = (*(tint_symbol_5)).x; + switch(0u) { + default: { + x_55_phi = -0.5f; + x_58_phi = 1; + while (true) { + float x_68 = 0.0f; + float x_76 = 0.0f; + int x_59 = 0; + float x_56_phi = 0.0f; + x_55 = x_55_phi; + int const x_58 = x_58_phi; + x_81_phi = 0.0f; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + float x_75 = 0.0f; + float x_76_phi = 0.0f; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006f); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((float(x_58) % rint(x_49)) <= 0.01f)) { + x_75 = (x_55 + 100.0f); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((float(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + bool const x_83 = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + break; + } + } + float x_88 = 0.0f; + float x_92 = 0.0f; + float x_93 = 0.0f; + float x_92_phi = 0.0f; + int x_95_phi = 0; + float x_118_phi = 0.0f; + float x_119_phi = 0.0f; + bool x_120_phi = false; + float const x_85 = x_85_phi; + c.x = x_85; + x_88 = (*(tint_symbol_5)).y; + switch(0u) { + default: { + x_92_phi = -0.5f; + x_95_phi = 1; + while (true) { + float x_105 = 0.0f; + float x_113 = 0.0f; + int x_96 = 0; + float x_93_phi = 0.0f; + x_92 = x_92_phi; + int const x_95 = x_95_phi; + x_118_phi = 0.0f; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + float x_112 = 0.0f; + float x_113_phi = 0.0f; + if (((x_95 % 32) == 0)) { + x_105 = (x_92 + 0.400000006f); + x_93_phi = x_105; + } else { + x_113_phi = x_92; + if (((float(x_95) % rint(x_49)) <= 0.01f)) { + x_112 = (x_92 + 100.0f); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_93_phi = x_113; + } + x_93 = x_93_phi; + if ((float(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + bool const x_120 = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + break; + } + } + float const x_122 = x_122_phi; + c.y = x_122; + float const x_124 = c.x; + float const x_125 = c.y; + c.z = (x_124 + x_125); + x_129_phi = 0; + while (true) { + int x_130 = 0; + int const x_129 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + int const x_135_save = x_129; + float const x_136 = c[x_135_save]; + if ((x_136 >= 1.0f)) { + float const x_140 = c[x_135_save]; + float const x_141 = c[x_135_save]; + c[x_135_save] = (x_140 * x_141); + } + { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + float3 const x_143 = c; + float3 const x_145 = normalize(fabs(x_143)); + *(tint_symbol_6) = float4(x_145.x, x_145.y, x_145.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\u938.0.metal:60:29: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_58) % rint(x_49)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~ +T:\tmp\u938.0.metal:127:29: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_95) % rint(x_49)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~ +2 errors generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..fdd3fe1211 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.spvasm @@ -0,0 +1,449 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 254 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %c "c" + OpName %x_51 "x_51" + OpName %x_55 "x_55" + OpName %x_56 "x_56" + OpName %x_81 "x_81" + OpName %x_82 "x_82" + OpName %x_118 "x_118" + OpName %x_119 "x_119" + OpName %x_55_phi "x_55_phi" + OpName %x_58_phi "x_58_phi" + OpName %x_81_phi "x_81_phi" + OpName %x_82_phi "x_82_phi" + OpName %x_83_phi "x_83_phi" + OpName %x_85_phi "x_85_phi" + OpName %x_122_phi "x_122_phi" + OpName %x_129_phi "x_129_phi" + OpName %x_68 "x_68" + OpName %x_76 "x_76" + OpName %x_59 "x_59" + OpName %x_56_phi "x_56_phi" + OpName %x_75 "x_75" + OpName %x_76_phi "x_76_phi" + OpName %x_88 "x_88" + OpName %x_92 "x_92" + OpName %x_93 "x_93" + OpName %x_92_phi "x_92_phi" + OpName %x_95_phi "x_95_phi" + OpName %x_118_phi "x_118_phi" + OpName %x_119_phi "x_119_phi" + OpName %x_120_phi "x_120_phi" + OpName %x_105 "x_105" + OpName %x_113 "x_113" + OpName %x_96 "x_96" + OpName %x_93_phi "x_93_phi" + OpName %x_112 "x_112" + OpName %x_113_phi "x_113_phi" + OpName %x_130 "x_130" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %22 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %36 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %42 = OpConstantNull %bool + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %49 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0_125 = OpConstant %float 0.125 +%_ptr_Private_float = OpTypePointer Private %float + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %int_800 = OpConstant %int 800 + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %241 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %22 + %x_51 = OpVariable %_ptr_Function_float Function %25 + %x_55 = OpVariable %_ptr_Function_float Function %25 + %x_56 = OpVariable %_ptr_Function_float Function %25 + %x_81 = OpVariable %_ptr_Function_float Function %25 + %x_82 = OpVariable %_ptr_Function_float Function %25 + %x_118 = OpVariable %_ptr_Function_float Function %25 + %x_119 = OpVariable %_ptr_Function_float Function %25 + %x_55_phi = OpVariable %_ptr_Function_float Function %25 + %x_58_phi = OpVariable %_ptr_Function_int Function %36 + %x_81_phi = OpVariable %_ptr_Function_float Function %25 + %x_82_phi = OpVariable %_ptr_Function_float Function %25 + %x_83_phi = OpVariable %_ptr_Function_bool Function %42 + %x_85_phi = OpVariable %_ptr_Function_float Function %25 + %x_122_phi = OpVariable %_ptr_Function_float Function %25 + %x_129_phi = OpVariable %_ptr_Function_int Function %36 + %x_68 = OpVariable %_ptr_Function_float Function %25 + %x_76 = OpVariable %_ptr_Function_float Function %25 + %x_59 = OpVariable %_ptr_Function_int Function %36 + %x_56_phi = OpVariable %_ptr_Function_float Function %25 + %x_75 = OpVariable %_ptr_Function_float Function %25 + %x_76_phi = OpVariable %_ptr_Function_float Function %25 + %x_88 = OpVariable %_ptr_Function_float Function %25 + %x_92 = OpVariable %_ptr_Function_float Function %25 + %x_93 = OpVariable %_ptr_Function_float Function %25 + %x_92_phi = OpVariable %_ptr_Function_float Function %25 + %x_95_phi = OpVariable %_ptr_Function_int Function %36 + %x_118_phi = OpVariable %_ptr_Function_float Function %25 + %x_119_phi = OpVariable %_ptr_Function_float Function %25 + %x_120_phi = OpVariable %_ptr_Function_bool Function %42 + %x_105 = OpVariable %_ptr_Function_float Function %25 + %x_113 = OpVariable %_ptr_Function_float Function %25 + %x_96 = OpVariable %_ptr_Function_int Function %36 + %x_93_phi = OpVariable %_ptr_Function_float Function %25 + %x_112 = OpVariable %_ptr_Function_float Function %25 + %x_113_phi = OpVariable %_ptr_Function_float Function %25 + %x_130 = OpVariable %_ptr_Function_int Function %36 + OpStore %c %49 + %53 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %54 = OpLoad %float %53 + %58 = OpFMul %float %54 %float_0_125 + %55 = OpExtInst %float %56 RoundEven %58 + %60 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %61 = OpLoad %float %60 + OpStore %x_51 %61 + OpSelectionMerge %62 None + OpSwitch %uint_0 %63 + %63 = OpLabel + OpStore %x_55_phi %float_n0_5 + OpStore %x_58_phi %int_1 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %74 = OpLoad %float %x_55_phi + OpStore %x_55 %74 + %75 = OpLoad %int %x_58_phi + OpStore %x_81_phi %float_0 + %77 = OpLoad %float %x_55 + OpStore %x_82_phi %77 + OpStore %x_83_phi %false + %80 = OpSLessThan %bool %75 %int_800 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %67 + %81 = OpLabel + %87 = OpSMod %int %75 %int_32 + %89 = OpIEqual %bool %87 %int_0 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 + %91 = OpLabel + %93 = OpLoad %float %x_55 + %95 = OpFAdd %float %93 %float_0_400000006 + OpStore %x_68 %95 + %96 = OpLoad %float %x_68 + OpStore %x_56_phi %96 + OpBranch %90 + %92 = OpLabel + %97 = OpLoad %float %x_55 + OpStore %x_76_phi %97 + %98 = OpConvertSToF %float %75 + %99 = OpExtInst %float %56 RoundEven %55 + %100 = OpFMod %float %98 %99 + %102 = OpFOrdLessThanEqual %bool %100 %float_0_00999999978 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %103 + %104 = OpLabel + %105 = OpLoad %float %x_55 + %107 = OpFAdd %float %105 %float_100 + OpStore %x_75 %107 + %108 = OpLoad %float %x_75 + OpStore %x_76_phi %108 + OpBranch %103 + %103 = OpLabel + %109 = OpLoad %float %x_76_phi + OpStore %x_76 %109 + %110 = OpLoad %float %x_76 + OpStore %x_56_phi %110 + OpBranch %90 + %90 = OpLabel + %111 = OpLoad %float %x_56_phi + OpStore %x_56 %111 + %112 = OpConvertSToF %float %75 + %113 = OpLoad %float %x_51 + %114 = OpFOrdGreaterThanEqual %bool %112 %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %115 + %116 = OpLabel + %117 = OpLoad %float %x_56 + OpStore %x_81_phi %117 + %118 = OpLoad %float %x_56 + OpStore %x_82_phi %118 + OpStore %x_83_phi %true + OpBranch %67 + %115 = OpLabel + OpBranch %68 + %68 = OpLabel + %120 = OpIAdd %int %75 %int_1 + OpStore %x_59 %120 + %121 = OpLoad %float %x_56 + OpStore %x_55_phi %121 + %122 = OpLoad %int %x_59 + OpStore %x_58_phi %122 + OpBranch %66 + %67 = OpLabel + %123 = OpLoad %float %x_81_phi + OpStore %x_81 %123 + %124 = OpLoad %float %x_82_phi + OpStore %x_82 %124 + %125 = OpLoad %bool %x_83_phi + %126 = OpLoad %float %x_81 + OpStore %x_85_phi %126 + OpSelectionMerge %127 None + OpBranchConditional %125 %128 %127 + %128 = OpLabel + OpBranch %62 + %127 = OpLabel + %129 = OpLoad %float %x_82 + OpStore %x_85_phi %129 + OpBranch %62 + %62 = OpLabel + %138 = OpLoad %float %x_85_phi + %139 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %139 %138 + %141 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %142 = OpLoad %float %141 + OpStore %x_88 %142 + OpSelectionMerge %143 None + OpSwitch %uint_0 %144 + %144 = OpLabel + OpStore %x_92_phi %float_n0_5 + OpStore %x_95_phi %int_1 + OpBranch %145 + %145 = OpLabel + OpLoopMerge %146 %147 None + OpBranch %148 + %148 = OpLabel + %153 = OpLoad %float %x_92_phi + OpStore %x_92 %153 + %154 = OpLoad %int %x_95_phi + OpStore %x_118_phi %float_0 + %155 = OpLoad %float %x_92 + OpStore %x_119_phi %155 + OpStore %x_120_phi %false + %156 = OpSLessThan %bool %154 %int_800 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %159 + %158 = OpLabel + OpBranch %157 + %159 = OpLabel + OpBranch %146 + %157 = OpLabel + %162 = OpSMod %int %154 %int_32 + %163 = OpIEqual %bool %162 %int_0 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %166 + %165 = OpLabel + %167 = OpLoad %float %x_92 + %168 = OpFAdd %float %167 %float_0_400000006 + OpStore %x_105 %168 + %169 = OpLoad %float %x_105 + OpStore %x_93_phi %169 + OpBranch %164 + %166 = OpLabel + %170 = OpLoad %float %x_92 + OpStore %x_113_phi %170 + %171 = OpConvertSToF %float %154 + %172 = OpExtInst %float %56 RoundEven %55 + %173 = OpFMod %float %171 %172 + %174 = OpFOrdLessThanEqual %bool %173 %float_0_00999999978 + OpSelectionMerge %175 None + OpBranchConditional %174 %176 %175 + %176 = OpLabel + %177 = OpLoad %float %x_92 + %178 = OpFAdd %float %177 %float_100 + OpStore %x_112 %178 + %179 = OpLoad %float %x_112 + OpStore %x_113_phi %179 + OpBranch %175 + %175 = OpLabel + %180 = OpLoad %float %x_113_phi + OpStore %x_113 %180 + %181 = OpLoad %float %x_113 + OpStore %x_93_phi %181 + OpBranch %164 + %164 = OpLabel + %182 = OpLoad %float %x_93_phi + OpStore %x_93 %182 + %183 = OpConvertSToF %float %154 + %184 = OpLoad %float %x_88 + %185 = OpFOrdGreaterThanEqual %bool %183 %184 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %186 + %187 = OpLabel + %188 = OpLoad %float %x_93 + OpStore %x_118_phi %188 + %189 = OpLoad %float %x_93 + OpStore %x_119_phi %189 + OpStore %x_120_phi %true + OpBranch %146 + %186 = OpLabel + OpBranch %147 + %147 = OpLabel + %190 = OpIAdd %int %154 %int_1 + OpStore %x_96 %190 + %191 = OpLoad %float %x_93 + OpStore %x_92_phi %191 + %192 = OpLoad %int %x_96 + OpStore %x_95_phi %192 + OpBranch %145 + %146 = OpLabel + %193 = OpLoad %float %x_118_phi + OpStore %x_118 %193 + %194 = OpLoad %float %x_119_phi + OpStore %x_119 %194 + %195 = OpLoad %bool %x_120_phi + %196 = OpLoad %float %x_118 + OpStore %x_122_phi %196 + OpSelectionMerge %197 None + OpBranchConditional %195 %198 %197 + %198 = OpLabel + OpBranch %143 + %197 = OpLabel + %199 = OpLoad %float %x_119 + OpStore %x_122_phi %199 + OpBranch %143 + %143 = OpLabel + %200 = OpLoad %float %x_122_phi + %201 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %201 %200 + %202 = OpAccessChain %_ptr_Function_float %c %uint_0 + %203 = OpLoad %float %202 + %204 = OpAccessChain %_ptr_Function_float %c %uint_1 + %205 = OpLoad %float %204 + %207 = OpAccessChain %_ptr_Function_float %c %uint_2 + %208 = OpFAdd %float %203 %205 + OpStore %207 %208 + OpStore %x_129_phi %int_0 + OpBranch %209 + %209 = OpLabel + OpLoopMerge %210 %211 None + OpBranch %212 + %212 = OpLabel + %214 = OpLoad %int %x_129_phi + %216 = OpSLessThan %bool %214 %int_3 + OpSelectionMerge %217 None + OpBranchConditional %216 %218 %219 + %218 = OpLabel + OpBranch %217 + %219 = OpLabel + OpBranch %210 + %217 = OpLabel + %220 = OpAccessChain %_ptr_Function_float %c %214 + %221 = OpLoad %float %220 + %223 = OpFOrdGreaterThanEqual %bool %221 %float_1 + OpSelectionMerge %224 None + OpBranchConditional %223 %225 %224 + %225 = OpLabel + %226 = OpAccessChain %_ptr_Function_float %c %214 + %227 = OpLoad %float %226 + %228 = OpAccessChain %_ptr_Function_float %c %214 + %229 = OpLoad %float %228 + %230 = OpAccessChain %_ptr_Function_float %c %214 + %231 = OpFMul %float %227 %229 + OpStore %230 %231 + OpBranch %224 + %224 = OpLabel + OpBranch %211 + %211 = OpLabel + %232 = OpIAdd %int %214 %int_1 + OpStore %x_130 %232 + %233 = OpLoad %int %x_130 + OpStore %x_129_phi %233 + OpBranch %209 + %210 = OpLabel + %234 = OpLoad %v3float %c + %236 = OpExtInst %v3float %56 FAbs %234 + %235 = OpExtInst %v3float %56 Normalize %236 + %237 = OpCompositeExtract %float %235 0 + %238 = OpCompositeExtract %float %235 1 + %239 = OpCompositeExtract %float %235 2 + %240 = OpCompositeConstruct %v4float %237 %238 %239 %float_1 + OpStore %x_GLF_color %240 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %241 +%tint_symbol_1 = OpFunctionParameter %main_out + %245 = OpLabel + %246 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %246 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %248 = OpLabel + %249 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %249 + %250 = OpFunctionCall %void %main_1 + %252 = OpLoad %v4float %x_GLF_color + %253 = OpCompositeConstruct %main_out %252 + %251 = OpFunctionCall %void %tint_symbol_3 %253 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..41e57f4774 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/0.wgsl.expected.wgsl @@ -0,0 +1,200 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec3; + var x_51 : f32; + var x_55 : f32; + var x_56 : f32; + var x_81 : f32; + var x_82 : f32; + var x_118 : f32; + var x_119 : f32; + var x_55_phi : f32; + var x_58_phi : i32; + var x_81_phi : f32; + var x_82_phi : f32; + var x_83_phi : bool; + var x_85_phi : f32; + var x_122_phi : f32; + var x_129_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_47 : f32 = x_7.resolution.x; + let x_49 : f32 = round((x_47 * 0.125)); + x_51 = gl_FragCoord.x; + switch(0u) { + default: { + x_55_phi = -0.5; + x_58_phi = 1; + loop { + var x_68 : f32; + var x_76 : f32; + var x_59 : i32; + var x_56_phi : f32; + x_55 = x_55_phi; + let x_58 : i32 = x_58_phi; + x_81_phi = 0.0; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + var x_75 : f32; + var x_76_phi : f32; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((f32(x_58) % round(x_49)) <= 0.01)) { + x_75 = (x_55 + 100.0); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((f32(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + + continuing { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + let x_83 : bool = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + } + } + var x_88 : f32; + var x_92 : f32; + var x_93 : f32; + var x_92_phi : f32; + var x_95_phi : i32; + var x_118_phi : f32; + var x_119_phi : f32; + var x_120_phi : bool; + let x_85 : f32 = x_85_phi; + let x_86 : ptr = &(c.x); + *(x_86) = x_85; + x_88 = gl_FragCoord.y; + switch(0u) { + default: { + x_92_phi = -0.5; + x_95_phi = 1; + loop { + var x_105 : f32; + var x_113 : f32; + var x_96 : i32; + var x_93_phi : f32; + x_92 = x_92_phi; + let x_95 : i32 = x_95_phi; + x_118_phi = 0.0; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + var x_112 : f32; + var x_113_phi : f32; + if (((x_95 % 32) == 0)) { + x_105 = (x_92 + 0.400000006); + x_93_phi = x_105; + } else { + x_113_phi = x_92; + if (((f32(x_95) % round(x_49)) <= 0.01)) { + x_112 = (x_92 + 100.0); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_93_phi = x_113; + } + x_93 = x_93_phi; + if ((f32(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + + continuing { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + let x_120 : bool = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + } + } + let x_122 : f32 = x_122_phi; + let x_123 : ptr = &(c.y); + *(x_123) = x_122; + let x_124 : f32 = *(x_86); + let x_125 : f32 = *(x_123); + c.z = (x_124 + x_125); + x_129_phi = 0; + loop { + var x_130 : i32; + let x_129 : i32 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + let x_135 : ptr = &(c[x_129]); + let x_136 : f32 = *(x_135); + if ((x_136 >= 1.0)) { + let x_140 : f32 = *(x_135); + let x_141 : f32 = *(x_135); + *(x_135) = (x_140 * x_141); + } + + continuing { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + let x_143 : vec3 = c; + let x_145 : vec3 = normalize(abs(x_143)); + x_GLF_color = vec4(x_145.x, x_145.y, x_145.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm new file mode 100644 index 0000000000..918bcf72ec --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm @@ -0,0 +1,229 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %c "c" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_n0_5 = OpConstant %float -0.5 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %27 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %43 = OpUndef %float +%float_0_125 = OpConstant %float 0.125 + %main = OpFunction %void None %9 + %45 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function + OpStore %c %27 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %47 = OpLoad %float %46 + %48 = OpCompositeConstruct %v2float %float_1 %47 + %49 = OpFMul %float %47 %float_0_125 + %50 = OpExtInst %float %1 Round %49 + %51 = OpCompositeConstruct %v2float %43 %float_n0_5 + %52 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %53 = OpLoad %float %52 + OpSelectionMerge %54 None + OpSwitch %uint_0 %55 + %55 = OpLabel + OpBranch %56 + %56 = OpLabel + %57 = OpPhi %float %float_n0_5 %55 %58 %59 + %60 = OpPhi %int %int_1 %55 %61 %59 + %62 = OpSLessThan %bool %60 %int_800 + OpLoopMerge %63 %59 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + %65 = OpSMod %int %60 %int_32 + %66 = OpIEqual %bool %65 %int_0 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %69 + %68 = OpLabel + %70 = OpFAdd %float %57 %float_0_400000006 + OpBranch %67 + %69 = OpLabel + %71 = OpConvertSToF %float %60 + %72 = OpExtInst %float %1 Round %50 + %73 = OpFMod %float %71 %72 + %74 = OpFOrdLessThanEqual %bool %73 %float_0_00999999978 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + %77 = OpFAdd %float %57 %float_100 + OpBranch %75 + %75 = OpLabel + %78 = OpPhi %float %57 %69 %77 %76 + OpBranch %67 + %67 = OpLabel + %58 = OpPhi %float %70 %68 %78 %75 + %79 = OpConvertSToF %float %60 + %80 = OpFOrdGreaterThanEqual %bool %79 %53 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + OpBranch %63 + %81 = OpLabel + OpBranch %59 + %59 = OpLabel + %61 = OpIAdd %int %60 %int_1 + OpBranch %56 + %63 = OpLabel + %83 = OpPhi %float %43 %56 %58 %82 + %84 = OpPhi %float %57 %56 %58 %82 + %85 = OpPhi %bool %false %56 %true %82 + OpSelectionMerge %86 None + OpBranchConditional %85 %54 %86 + %86 = OpLabel + OpBranch %54 + %54 = OpLabel + %87 = OpPhi %float %83 %63 %84 %86 + %88 = OpAccessChain %_ptr_Function_float %c %uint_0 + %89 = OpCompositeConstruct %v4float %84 %float_0_400000006 %83 %float_0_400000006 + %90 = OpCompositeConstruct %v3float %48 %float_n0_5 + OpStore %88 %87 + %91 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %92 = OpLoad %float %91 + OpSelectionMerge %93 None + OpSwitch %uint_0 %94 + %94 = OpLabel + %95 = OpCompositeConstruct %v4float %51 %43 %57 + %96 = OpCompositeExtract %float %90 2 + OpBranch %97 + %97 = OpLabel + %98 = OpPhi %float %96 %94 %99 %100 + %101 = OpPhi %int %int_1 %94 %102 %100 + %103 = OpSLessThan %bool %101 %int_800 + OpLoopMerge %104 %100 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + %106 = OpSMod %int %101 %int_32 + %107 = OpIEqual %bool %106 %int_0 + OpSelectionMerge %108 None + OpBranchConditional %107 %109 %110 + %109 = OpLabel + %111 = OpFAdd %float %98 %float_0_400000006 + OpBranch %108 + %110 = OpLabel + %112 = OpConvertSToF %float %101 + %113 = OpExtInst %float %1 Round %50 + %114 = OpFMod %float %112 %113 + %115 = OpFOrdLessThanEqual %bool %114 %float_0_00999999978 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + %118 = OpFAdd %float %98 %float_100 + OpBranch %116 + %116 = OpLabel + %119 = OpPhi %float %98 %110 %118 %117 + OpBranch %108 + %108 = OpLabel + %99 = OpPhi %float %111 %109 %119 %116 + %120 = OpConvertSToF %float %101 + %121 = OpFOrdGreaterThanEqual %bool %120 %92 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + OpBranch %104 + %122 = OpLabel + OpBranch %100 + %100 = OpLabel + %102 = OpIAdd %int %101 %int_1 + OpBranch %97 + %104 = OpLabel + %124 = OpPhi %float %43 %97 %99 %123 + %125 = OpPhi %float %98 %97 %99 %123 + %126 = OpPhi %bool %false %97 %true %123 + OpSelectionMerge %127 None + OpBranchConditional %126 %93 %127 + %127 = OpLabel + OpBranch %93 + %93 = OpLabel + %128 = OpPhi %float %124 %104 %125 %127 + %129 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %129 %128 + %130 = OpLoad %float %88 + %131 = OpLoad %float %129 + %132 = OpFAdd %float %130 %131 + %133 = OpAccessChain %_ptr_Function_float %c %uint_2 + OpStore %133 %132 + OpBranch %134 + %134 = OpLabel + %135 = OpPhi %int %int_0 %93 %136 %137 + %138 = OpSLessThan %bool %135 %int_3 + OpLoopMerge %139 %137 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpAccessChain %_ptr_Function_float %c %135 + %142 = OpLoad %float %141 + %143 = OpFOrdGreaterThanEqual %bool %142 %float_1 + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %144 + %145 = OpLabel + %146 = OpLoad %float %141 + %147 = OpLoad %float %141 + %148 = OpFMul %float %146 %147 + OpStore %141 %148 + OpBranch %144 + %144 = OpLabel + OpBranch %137 + %137 = OpLabel + %136 = OpIAdd %int %135 %int_1 + OpBranch %134 + %139 = OpLabel + %149 = OpLoad %v3float %c + %150 = OpExtInst %v3float %1 FAbs %149 + %151 = OpExtInst %v3float %1 Normalize %150 + %152 = OpCompositeExtract %float %151 0 + %153 = OpCompositeExtract %float %151 1 + %154 = OpCompositeExtract %float %151 2 + %155 = OpCompositeConstruct %v4float %152 %153 %154 %float_1 + OpStore %_GLF_color %155 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..f5c9fb04f1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.hlsl @@ -0,0 +1,207 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float x_53 = 0.0f; + float x_57 = 0.0f; + float x_58 = 0.0f; + float x_83 = 0.0f; + float x_84 = 0.0f; + float x_124 = 0.0f; + float x_125 = 0.0f; + float x_57_phi = 0.0f; + int x_60_phi = 0; + float x_83_phi = 0.0f; + float x_84_phi = 0.0f; + bool x_85_phi = false; + float x_87_phi = 0.0f; + float x_128_phi = 0.0f; + int x_135_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_47 = asfloat(x_7[0].x); + const float2 x_48 = float2(1.0f, x_47); + const float x_50 = round((x_47 * 0.125f)); + const float2 x_51 = float2(0.0f, -0.5f); + x_53 = gl_FragCoord.x; + switch(0u) { + default: { + x_57_phi = -0.5f; + x_60_phi = 1; + while (true) { + float x_70 = 0.0f; + float x_78 = 0.0f; + int x_61 = 0; + float x_58_phi = 0.0f; + x_57 = x_57_phi; + const int x_60 = x_60_phi; + x_83_phi = 0.0f; + x_84_phi = x_57; + x_85_phi = false; + if ((x_60 < 800)) { + } else { + break; + } + float x_77 = 0.0f; + float x_78_phi = 0.0f; + if (((x_60 % 32) == 0)) { + x_70 = (x_57 + 0.400000006f); + x_58_phi = x_70; + } else { + x_78_phi = x_57; + if (((float(x_60) % round(x_50)) <= 0.01f)) { + x_77 = (x_57 + 100.0f); + x_78_phi = x_77; + } + x_78 = x_78_phi; + x_58_phi = x_78; + } + x_58 = x_58_phi; + if ((float(x_60) >= x_53)) { + x_83_phi = x_58; + x_84_phi = x_58; + x_85_phi = true; + break; + } + { + x_61 = (x_60 + 1); + x_57_phi = x_58; + x_60_phi = x_61; + } + } + x_83 = x_83_phi; + x_84 = x_84_phi; + const bool x_85 = x_85_phi; + x_87_phi = x_83; + if (x_85) { + break; + } + x_87_phi = x_84; + break; + } + } + float x_92 = 0.0f; + float x_98 = 0.0f; + float x_99 = 0.0f; + float x_98_phi = 0.0f; + int x_101_phi = 0; + float x_124_phi = 0.0f; + float x_125_phi = 0.0f; + bool x_126_phi = false; + const float x_87 = x_87_phi; + const float4 x_89 = float4(x_84, 0.400000006f, x_83, 0.400000006f); + c.x = x_87; + x_92 = gl_FragCoord.y; + switch(0u) { + default: { + const float4 x_95 = float4(x_51, 0.0f, x_57); + const float x_96 = float3(x_48, -0.5f).z; + x_98_phi = x_96; + x_101_phi = 1; + while (true) { + float x_111 = 0.0f; + float x_119 = 0.0f; + int x_102 = 0; + float x_99_phi = 0.0f; + x_98 = x_98_phi; + const int x_101 = x_101_phi; + x_124_phi = 0.0f; + x_125_phi = x_98; + x_126_phi = false; + if ((x_101 < 800)) { + } else { + break; + } + float x_118 = 0.0f; + float x_119_phi = 0.0f; + if (((x_101 % 32) == 0)) { + x_111 = (x_98 + 0.400000006f); + x_99_phi = x_111; + } else { + x_119_phi = x_98; + if (((float(x_101) % round(x_50)) <= 0.01f)) { + x_118 = (x_98 + 100.0f); + x_119_phi = x_118; + } + x_119 = x_119_phi; + x_99_phi = x_119; + } + x_99 = x_99_phi; + if ((float(x_101) >= x_92)) { + x_124_phi = x_99; + x_125_phi = x_99; + x_126_phi = true; + break; + } + { + x_102 = (x_101 + 1); + x_98_phi = x_99; + x_101_phi = x_102; + } + } + x_124 = x_124_phi; + x_125 = x_125_phi; + const bool x_126 = x_126_phi; + x_128_phi = x_124; + if (x_126) { + break; + } + x_128_phi = x_125; + break; + } + } + const float x_128 = x_128_phi; + c.y = x_128; + const float x_130 = c.x; + const float x_131 = c.y; + c.z = (x_130 + x_131); + x_135_phi = 0; + while (true) { + int x_136 = 0; + const int x_135 = x_135_phi; + if ((x_135 < 3)) { + } else { + break; + } + const int x_141_save = x_135; + const float x_142 = c[x_141_save]; + if ((x_142 >= 1.0f)) { + const float x_146 = c[x_141_save]; + const float x_147 = c[x_141_save]; + set_float3(c, x_141_save, (x_146 * x_147)); + } + { + x_136 = (x_135 + 1); + x_135_phi = x_136; + } + } + const float3 x_151 = normalize(abs(c)); + x_GLF_color = float4(x_151.x, x_151.y, x_151.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.msl new file mode 100755 index 0000000000..1a98de4984 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.msl @@ -0,0 +1,213 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float x_53 = 0.0f; + float x_57 = 0.0f; + float x_58 = 0.0f; + float x_83 = 0.0f; + float x_84 = 0.0f; + float x_124 = 0.0f; + float x_125 = 0.0f; + float x_57_phi = 0.0f; + int x_60_phi = 0; + float x_83_phi = 0.0f; + float x_84_phi = 0.0f; + bool x_85_phi = false; + float x_87_phi = 0.0f; + float x_128_phi = 0.0f; + int x_135_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_47 = x_7.resolution.x; + float2 const x_48 = float2(1.0f, x_47); + float const x_50 = rint((x_47 * 0.125f)); + float2 const x_51 = float2(0.0f, -0.5f); + x_53 = (*(tint_symbol_5)).x; + switch(0u) { + default: { + x_57_phi = -0.5f; + x_60_phi = 1; + while (true) { + float x_70 = 0.0f; + float x_78 = 0.0f; + int x_61 = 0; + float x_58_phi = 0.0f; + x_57 = x_57_phi; + int const x_60 = x_60_phi; + x_83_phi = 0.0f; + x_84_phi = x_57; + x_85_phi = false; + if ((x_60 < 800)) { + } else { + break; + } + float x_77 = 0.0f; + float x_78_phi = 0.0f; + if (((x_60 % 32) == 0)) { + x_70 = (x_57 + 0.400000006f); + x_58_phi = x_70; + } else { + x_78_phi = x_57; + if (((float(x_60) % rint(x_50)) <= 0.01f)) { + x_77 = (x_57 + 100.0f); + x_78_phi = x_77; + } + x_78 = x_78_phi; + x_58_phi = x_78; + } + x_58 = x_58_phi; + if ((float(x_60) >= x_53)) { + x_83_phi = x_58; + x_84_phi = x_58; + x_85_phi = true; + break; + } + { + x_61 = (x_60 + 1); + x_57_phi = x_58; + x_60_phi = x_61; + } + } + x_83 = x_83_phi; + x_84 = x_84_phi; + bool const x_85 = x_85_phi; + x_87_phi = x_83; + if (x_85) { + break; + } + x_87_phi = x_84; + break; + } + } + float x_92 = 0.0f; + float x_98 = 0.0f; + float x_99 = 0.0f; + float x_98_phi = 0.0f; + int x_101_phi = 0; + float x_124_phi = 0.0f; + float x_125_phi = 0.0f; + bool x_126_phi = false; + float const x_87 = x_87_phi; + float4 const x_89 = float4(x_84, 0.400000006f, x_83, 0.400000006f); + c.x = x_87; + x_92 = (*(tint_symbol_5)).y; + switch(0u) { + default: { + float4 const x_95 = float4(x_51, 0.0f, x_57); + float const x_96 = float3(x_48, -0.5f).z; + x_98_phi = x_96; + x_101_phi = 1; + while (true) { + float x_111 = 0.0f; + float x_119 = 0.0f; + int x_102 = 0; + float x_99_phi = 0.0f; + x_98 = x_98_phi; + int const x_101 = x_101_phi; + x_124_phi = 0.0f; + x_125_phi = x_98; + x_126_phi = false; + if ((x_101 < 800)) { + } else { + break; + } + float x_118 = 0.0f; + float x_119_phi = 0.0f; + if (((x_101 % 32) == 0)) { + x_111 = (x_98 + 0.400000006f); + x_99_phi = x_111; + } else { + x_119_phi = x_98; + if (((float(x_101) % rint(x_50)) <= 0.01f)) { + x_118 = (x_98 + 100.0f); + x_119_phi = x_118; + } + x_119 = x_119_phi; + x_99_phi = x_119; + } + x_99 = x_99_phi; + if ((float(x_101) >= x_92)) { + x_124_phi = x_99; + x_125_phi = x_99; + x_126_phi = true; + break; + } + { + x_102 = (x_101 + 1); + x_98_phi = x_99; + x_101_phi = x_102; + } + } + x_124 = x_124_phi; + x_125 = x_125_phi; + bool const x_126 = x_126_phi; + x_128_phi = x_124; + if (x_126) { + break; + } + x_128_phi = x_125; + break; + } + } + float const x_128 = x_128_phi; + c.y = x_128; + float const x_130 = c.x; + float const x_131 = c.y; + c.z = (x_130 + x_131); + x_135_phi = 0; + while (true) { + int x_136 = 0; + int const x_135 = x_135_phi; + if ((x_135 < 3)) { + } else { + break; + } + int const x_141_save = x_135; + float const x_142 = c[x_141_save]; + if ((x_142 >= 1.0f)) { + float const x_146 = c[x_141_save]; + float const x_147 = c[x_141_save]; + c[x_141_save] = (x_146 * x_147); + } + { + x_136 = (x_135 + 1); + x_135_phi = x_136; + } + } + float3 const x_149 = c; + float3 const x_151 = normalize(fabs(x_149)); + *(tint_symbol_6) = float4(x_151.x, x_151.y, x_151.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\ufm8.0.metal:62:29: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_60) % rint(x_50)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~ +T:\tmp\ufm8.0.metal:132:30: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_101) % rint(x_50)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~ +2 errors generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..59c0cdb6a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.spvasm @@ -0,0 +1,462 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 267 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %c "c" + OpName %x_53 "x_53" + OpName %x_57 "x_57" + OpName %x_58 "x_58" + OpName %x_83 "x_83" + OpName %x_84 "x_84" + OpName %x_124 "x_124" + OpName %x_125 "x_125" + OpName %x_57_phi "x_57_phi" + OpName %x_60_phi "x_60_phi" + OpName %x_83_phi "x_83_phi" + OpName %x_84_phi "x_84_phi" + OpName %x_85_phi "x_85_phi" + OpName %x_87_phi "x_87_phi" + OpName %x_128_phi "x_128_phi" + OpName %x_135_phi "x_135_phi" + OpName %x_70 "x_70" + OpName %x_78 "x_78" + OpName %x_61 "x_61" + OpName %x_58_phi "x_58_phi" + OpName %x_77 "x_77" + OpName %x_78_phi "x_78_phi" + OpName %x_92 "x_92" + OpName %x_98 "x_98" + OpName %x_99 "x_99" + OpName %x_98_phi "x_98_phi" + OpName %x_101_phi "x_101_phi" + OpName %x_124_phi "x_124_phi" + OpName %x_125_phi "x_125_phi" + OpName %x_126_phi "x_126_phi" + OpName %x_111 "x_111" + OpName %x_119 "x_119" + OpName %x_102 "x_102" + OpName %x_99_phi "x_99_phi" + OpName %x_118 "x_118" + OpName %x_119_phi "x_119_phi" + OpName %x_136 "x_136" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %22 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %36 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %42 = OpConstantNull %bool + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %49 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 +%float_0_125 = OpConstant %float 0.125 + %float_0 = OpConstant %float 0 + %float_n0_5 = OpConstant %float -0.5 + %63 = OpConstantComposite %v2float %float_0 %float_n0_5 +%_ptr_Private_float = OpTypePointer Private %float + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %int_800 = OpConstant %int 800 + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %254 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %22 + %x_53 = OpVariable %_ptr_Function_float Function %25 + %x_57 = OpVariable %_ptr_Function_float Function %25 + %x_58 = OpVariable %_ptr_Function_float Function %25 + %x_83 = OpVariable %_ptr_Function_float Function %25 + %x_84 = OpVariable %_ptr_Function_float Function %25 + %x_124 = OpVariable %_ptr_Function_float Function %25 + %x_125 = OpVariable %_ptr_Function_float Function %25 + %x_57_phi = OpVariable %_ptr_Function_float Function %25 + %x_60_phi = OpVariable %_ptr_Function_int Function %36 + %x_83_phi = OpVariable %_ptr_Function_float Function %25 + %x_84_phi = OpVariable %_ptr_Function_float Function %25 + %x_85_phi = OpVariable %_ptr_Function_bool Function %42 + %x_87_phi = OpVariable %_ptr_Function_float Function %25 + %x_128_phi = OpVariable %_ptr_Function_float Function %25 + %x_135_phi = OpVariable %_ptr_Function_int Function %36 + %x_70 = OpVariable %_ptr_Function_float Function %25 + %x_78 = OpVariable %_ptr_Function_float Function %25 + %x_61 = OpVariable %_ptr_Function_int Function %36 + %x_58_phi = OpVariable %_ptr_Function_float Function %25 + %x_77 = OpVariable %_ptr_Function_float Function %25 + %x_78_phi = OpVariable %_ptr_Function_float Function %25 + %x_92 = OpVariable %_ptr_Function_float Function %25 + %x_98 = OpVariable %_ptr_Function_float Function %25 + %x_99 = OpVariable %_ptr_Function_float Function %25 + %x_98_phi = OpVariable %_ptr_Function_float Function %25 + %x_101_phi = OpVariable %_ptr_Function_int Function %36 + %x_124_phi = OpVariable %_ptr_Function_float Function %25 + %x_125_phi = OpVariable %_ptr_Function_float Function %25 + %x_126_phi = OpVariable %_ptr_Function_bool Function %42 + %x_111 = OpVariable %_ptr_Function_float Function %25 + %x_119 = OpVariable %_ptr_Function_float Function %25 + %x_102 = OpVariable %_ptr_Function_int Function %36 + %x_99_phi = OpVariable %_ptr_Function_float Function %25 + %x_118 = OpVariable %_ptr_Function_float Function %25 + %x_119_phi = OpVariable %_ptr_Function_float Function %25 + %x_136 = OpVariable %_ptr_Function_int Function %36 + OpStore %c %49 + %53 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %54 = OpLoad %float %53 + %56 = OpCompositeConstruct %v2float %float_1 %54 + %60 = OpFMul %float %54 %float_0_125 + %57 = OpExtInst %float %58 RoundEven %60 + %65 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %66 = OpLoad %float %65 + OpStore %x_53 %66 + OpSelectionMerge %67 None + OpSwitch %uint_0 %68 + %68 = OpLabel + OpStore %x_57_phi %float_n0_5 + OpStore %x_60_phi %int_1 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %78 = OpLoad %float %x_57_phi + OpStore %x_57 %78 + %79 = OpLoad %int %x_60_phi + OpStore %x_83_phi %float_0 + %80 = OpLoad %float %x_57 + OpStore %x_84_phi %80 + OpStore %x_85_phi %false + %83 = OpSLessThan %bool %79 %int_800 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + OpBranch %84 + %86 = OpLabel + OpBranch %71 + %84 = OpLabel + %90 = OpSMod %int %79 %int_32 + %92 = OpIEqual %bool %90 %int_0 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + %96 = OpLoad %float %x_57 + %98 = OpFAdd %float %96 %float_0_400000006 + OpStore %x_70 %98 + %99 = OpLoad %float %x_70 + OpStore %x_58_phi %99 + OpBranch %93 + %95 = OpLabel + %100 = OpLoad %float %x_57 + OpStore %x_78_phi %100 + %101 = OpConvertSToF %float %79 + %102 = OpExtInst %float %58 RoundEven %57 + %103 = OpFMod %float %101 %102 + %105 = OpFOrdLessThanEqual %bool %103 %float_0_00999999978 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + %108 = OpLoad %float %x_57 + %110 = OpFAdd %float %108 %float_100 + OpStore %x_77 %110 + %111 = OpLoad %float %x_77 + OpStore %x_78_phi %111 + OpBranch %106 + %106 = OpLabel + %112 = OpLoad %float %x_78_phi + OpStore %x_78 %112 + %113 = OpLoad %float %x_78 + OpStore %x_58_phi %113 + OpBranch %93 + %93 = OpLabel + %114 = OpLoad %float %x_58_phi + OpStore %x_58 %114 + %115 = OpConvertSToF %float %79 + %116 = OpLoad %float %x_53 + %117 = OpFOrdGreaterThanEqual %bool %115 %116 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %120 = OpLoad %float %x_58 + OpStore %x_83_phi %120 + %121 = OpLoad %float %x_58 + OpStore %x_84_phi %121 + OpStore %x_85_phi %true + OpBranch %71 + %118 = OpLabel + OpBranch %72 + %72 = OpLabel + %123 = OpIAdd %int %79 %int_1 + OpStore %x_61 %123 + %124 = OpLoad %float %x_58 + OpStore %x_57_phi %124 + %125 = OpLoad %int %x_61 + OpStore %x_60_phi %125 + OpBranch %70 + %71 = OpLabel + %126 = OpLoad %float %x_83_phi + OpStore %x_83 %126 + %127 = OpLoad %float %x_84_phi + OpStore %x_84 %127 + %128 = OpLoad %bool %x_85_phi + %129 = OpLoad %float %x_83 + OpStore %x_87_phi %129 + OpSelectionMerge %130 None + OpBranchConditional %128 %131 %130 + %131 = OpLabel + OpBranch %67 + %130 = OpLabel + %132 = OpLoad %float %x_84 + OpStore %x_87_phi %132 + OpBranch %67 + %67 = OpLabel + %141 = OpLoad %float %x_87_phi + %142 = OpLoad %float %x_84 + %143 = OpLoad %float %x_83 + %144 = OpCompositeConstruct %v4float %142 %float_0_400000006 %143 %float_0_400000006 + %145 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %145 %141 + %147 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %148 = OpLoad %float %147 + OpStore %x_92 %148 + OpSelectionMerge %149 None + OpSwitch %uint_0 %150 + %150 = OpLabel + %151 = OpCompositeExtract %float %63 0 + %152 = OpCompositeExtract %float %63 1 + %153 = OpLoad %float %x_57 + %154 = OpCompositeConstruct %v4float %151 %152 %float_0 %153 + %155 = OpCompositeExtract %float %56 0 + %156 = OpCompositeExtract %float %56 1 + %157 = OpCompositeConstruct %v3float %155 %156 %float_n0_5 + %158 = OpCompositeExtract %float %157 2 + OpStore %x_98_phi %158 + OpStore %x_101_phi %int_1 + OpBranch %159 + %159 = OpLabel + OpLoopMerge %160 %161 None + OpBranch %162 + %162 = OpLabel + %167 = OpLoad %float %x_98_phi + OpStore %x_98 %167 + %168 = OpLoad %int %x_101_phi + OpStore %x_124_phi %float_0 + %169 = OpLoad %float %x_98 + OpStore %x_125_phi %169 + OpStore %x_126_phi %false + %170 = OpSLessThan %bool %168 %int_800 + OpSelectionMerge %171 None + OpBranchConditional %170 %172 %173 + %172 = OpLabel + OpBranch %171 + %173 = OpLabel + OpBranch %160 + %171 = OpLabel + %176 = OpSMod %int %168 %int_32 + %177 = OpIEqual %bool %176 %int_0 + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %180 + %179 = OpLabel + %181 = OpLoad %float %x_98 + %182 = OpFAdd %float %181 %float_0_400000006 + OpStore %x_111 %182 + %183 = OpLoad %float %x_111 + OpStore %x_99_phi %183 + OpBranch %178 + %180 = OpLabel + %184 = OpLoad %float %x_98 + OpStore %x_119_phi %184 + %185 = OpConvertSToF %float %168 + %186 = OpExtInst %float %58 RoundEven %57 + %187 = OpFMod %float %185 %186 + %188 = OpFOrdLessThanEqual %bool %187 %float_0_00999999978 + OpSelectionMerge %189 None + OpBranchConditional %188 %190 %189 + %190 = OpLabel + %191 = OpLoad %float %x_98 + %192 = OpFAdd %float %191 %float_100 + OpStore %x_118 %192 + %193 = OpLoad %float %x_118 + OpStore %x_119_phi %193 + OpBranch %189 + %189 = OpLabel + %194 = OpLoad %float %x_119_phi + OpStore %x_119 %194 + %195 = OpLoad %float %x_119 + OpStore %x_99_phi %195 + OpBranch %178 + %178 = OpLabel + %196 = OpLoad %float %x_99_phi + OpStore %x_99 %196 + %197 = OpConvertSToF %float %168 + %198 = OpLoad %float %x_92 + %199 = OpFOrdGreaterThanEqual %bool %197 %198 + OpSelectionMerge %200 None + OpBranchConditional %199 %201 %200 + %201 = OpLabel + %202 = OpLoad %float %x_99 + OpStore %x_124_phi %202 + %203 = OpLoad %float %x_99 + OpStore %x_125_phi %203 + OpStore %x_126_phi %true + OpBranch %160 + %200 = OpLabel + OpBranch %161 + %161 = OpLabel + %204 = OpIAdd %int %168 %int_1 + OpStore %x_102 %204 + %205 = OpLoad %float %x_99 + OpStore %x_98_phi %205 + %206 = OpLoad %int %x_102 + OpStore %x_101_phi %206 + OpBranch %159 + %160 = OpLabel + %207 = OpLoad %float %x_124_phi + OpStore %x_124 %207 + %208 = OpLoad %float %x_125_phi + OpStore %x_125 %208 + %209 = OpLoad %bool %x_126_phi + %210 = OpLoad %float %x_124 + OpStore %x_128_phi %210 + OpSelectionMerge %211 None + OpBranchConditional %209 %212 %211 + %212 = OpLabel + OpBranch %149 + %211 = OpLabel + %213 = OpLoad %float %x_125 + OpStore %x_128_phi %213 + OpBranch %149 + %149 = OpLabel + %214 = OpLoad %float %x_128_phi + %215 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %215 %214 + %216 = OpAccessChain %_ptr_Function_float %c %uint_0 + %217 = OpLoad %float %216 + %218 = OpAccessChain %_ptr_Function_float %c %uint_1 + %219 = OpLoad %float %218 + %221 = OpAccessChain %_ptr_Function_float %c %uint_2 + %222 = OpFAdd %float %217 %219 + OpStore %221 %222 + OpStore %x_135_phi %int_0 + OpBranch %223 + %223 = OpLabel + OpLoopMerge %224 %225 None + OpBranch %226 + %226 = OpLabel + %228 = OpLoad %int %x_135_phi + %230 = OpSLessThan %bool %228 %int_3 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %233 + %232 = OpLabel + OpBranch %231 + %233 = OpLabel + OpBranch %224 + %231 = OpLabel + %234 = OpAccessChain %_ptr_Function_float %c %228 + %235 = OpLoad %float %234 + %236 = OpFOrdGreaterThanEqual %bool %235 %float_1 + OpSelectionMerge %237 None + OpBranchConditional %236 %238 %237 + %238 = OpLabel + %239 = OpAccessChain %_ptr_Function_float %c %228 + %240 = OpLoad %float %239 + %241 = OpAccessChain %_ptr_Function_float %c %228 + %242 = OpLoad %float %241 + %243 = OpAccessChain %_ptr_Function_float %c %228 + %244 = OpFMul %float %240 %242 + OpStore %243 %244 + OpBranch %237 + %237 = OpLabel + OpBranch %225 + %225 = OpLabel + %245 = OpIAdd %int %228 %int_1 + OpStore %x_136 %245 + %246 = OpLoad %int %x_136 + OpStore %x_135_phi %246 + OpBranch %223 + %224 = OpLabel + %247 = OpLoad %v3float %c + %249 = OpExtInst %v3float %58 FAbs %247 + %248 = OpExtInst %v3float %58 Normalize %249 + %250 = OpCompositeExtract %float %248 0 + %251 = OpCompositeExtract %float %248 1 + %252 = OpCompositeExtract %float %248 2 + %253 = OpCompositeConstruct %v4float %250 %251 %252 %float_1 + OpStore %x_GLF_color %253 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %254 +%tint_symbol_1 = OpFunctionParameter %main_out + %258 = OpLabel + %259 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %259 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %261 = OpLabel + %262 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %262 + %263 = OpFunctionCall %void %main_1 + %265 = OpLoad %v4float %x_GLF_color + %266 = OpCompositeConstruct %main_out %265 + %264 = OpFunctionCall %void %tint_symbol_3 %266 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..c2ad2e8b47 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.spvasm.expected.wgsl @@ -0,0 +1,205 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec3; + var x_53 : f32; + var x_57 : f32; + var x_58 : f32; + var x_83 : f32; + var x_84 : f32; + var x_124 : f32; + var x_125 : f32; + var x_57_phi : f32; + var x_60_phi : i32; + var x_83_phi : f32; + var x_84_phi : f32; + var x_85_phi : bool; + var x_87_phi : f32; + var x_128_phi : f32; + var x_135_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_47 : f32 = x_7.resolution.x; + let x_48 : vec2 = vec2(1.0, x_47); + let x_50 : f32 = round((x_47 * 0.125)); + let x_51 : vec2 = vec2(0.0, -0.5); + x_53 = gl_FragCoord.x; + switch(0u) { + default: { + x_57_phi = -0.5; + x_60_phi = 1; + loop { + var x_70 : f32; + var x_78 : f32; + var x_61 : i32; + var x_58_phi : f32; + x_57 = x_57_phi; + let x_60 : i32 = x_60_phi; + x_83_phi = 0.0; + x_84_phi = x_57; + x_85_phi = false; + if ((x_60 < 800)) { + } else { + break; + } + var x_77 : f32; + var x_78_phi : f32; + if (((x_60 % 32) == 0)) { + x_70 = (x_57 + 0.400000006); + x_58_phi = x_70; + } else { + x_78_phi = x_57; + if (((f32(x_60) % round(x_50)) <= 0.01)) { + x_77 = (x_57 + 100.0); + x_78_phi = x_77; + } + x_78 = x_78_phi; + x_58_phi = x_78; + } + x_58 = x_58_phi; + if ((f32(x_60) >= x_53)) { + x_83_phi = x_58; + x_84_phi = x_58; + x_85_phi = true; + break; + } + + continuing { + x_61 = (x_60 + 1); + x_57_phi = x_58; + x_60_phi = x_61; + } + } + x_83 = x_83_phi; + x_84 = x_84_phi; + let x_85 : bool = x_85_phi; + x_87_phi = x_83; + if (x_85) { + break; + } + x_87_phi = x_84; + } + } + var x_92 : f32; + var x_98 : f32; + var x_99 : f32; + var x_98_phi : f32; + var x_101_phi : i32; + var x_124_phi : f32; + var x_125_phi : f32; + var x_126_phi : bool; + let x_87 : f32 = x_87_phi; + let x_88 : ptr = &(c.x); + let x_89 : vec4 = vec4(x_84, 0.400000006, x_83, 0.400000006); + *(x_88) = x_87; + x_92 = gl_FragCoord.y; + switch(0u) { + default: { + let x_95 : vec4 = vec4(x_51, 0.0, x_57); + let x_96 : f32 = vec3(x_48, -0.5).z; + x_98_phi = x_96; + x_101_phi = 1; + loop { + var x_111 : f32; + var x_119 : f32; + var x_102 : i32; + var x_99_phi : f32; + x_98 = x_98_phi; + let x_101 : i32 = x_101_phi; + x_124_phi = 0.0; + x_125_phi = x_98; + x_126_phi = false; + if ((x_101 < 800)) { + } else { + break; + } + var x_118 : f32; + var x_119_phi : f32; + if (((x_101 % 32) == 0)) { + x_111 = (x_98 + 0.400000006); + x_99_phi = x_111; + } else { + x_119_phi = x_98; + if (((f32(x_101) % round(x_50)) <= 0.01)) { + x_118 = (x_98 + 100.0); + x_119_phi = x_118; + } + x_119 = x_119_phi; + x_99_phi = x_119; + } + x_99 = x_99_phi; + if ((f32(x_101) >= x_92)) { + x_124_phi = x_99; + x_125_phi = x_99; + x_126_phi = true; + break; + } + + continuing { + x_102 = (x_101 + 1); + x_98_phi = x_99; + x_101_phi = x_102; + } + } + x_124 = x_124_phi; + x_125 = x_125_phi; + let x_126 : bool = x_126_phi; + x_128_phi = x_124; + if (x_126) { + break; + } + x_128_phi = x_125; + } + } + let x_128 : f32 = x_128_phi; + let x_129 : ptr = &(c.y); + *(x_129) = x_128; + let x_130 : f32 = *(x_88); + let x_131 : f32 = *(x_129); + c.z = (x_130 + x_131); + x_135_phi = 0; + loop { + var x_136 : i32; + let x_135 : i32 = x_135_phi; + if ((x_135 < 3)) { + } else { + break; + } + let x_141 : ptr = &(c[x_135]); + let x_142 : f32 = *(x_141); + if ((x_142 >= 1.0)) { + let x_146 : f32 = *(x_141); + let x_147 : f32 = *(x_141); + *(x_141) = (x_146 * x_147); + } + + continuing { + x_136 = (x_135 + 1); + x_135_phi = x_136; + } + } + let x_149 : vec3 = c; + let x_151 : vec3 = normalize(abs(x_149)); + x_GLF_color = vec4(x_151.x, x_151.y, x_151.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl new file mode 100644 index 0000000000..c2ad2e8b47 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl @@ -0,0 +1,205 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec3; + var x_53 : f32; + var x_57 : f32; + var x_58 : f32; + var x_83 : f32; + var x_84 : f32; + var x_124 : f32; + var x_125 : f32; + var x_57_phi : f32; + var x_60_phi : i32; + var x_83_phi : f32; + var x_84_phi : f32; + var x_85_phi : bool; + var x_87_phi : f32; + var x_128_phi : f32; + var x_135_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_47 : f32 = x_7.resolution.x; + let x_48 : vec2 = vec2(1.0, x_47); + let x_50 : f32 = round((x_47 * 0.125)); + let x_51 : vec2 = vec2(0.0, -0.5); + x_53 = gl_FragCoord.x; + switch(0u) { + default: { + x_57_phi = -0.5; + x_60_phi = 1; + loop { + var x_70 : f32; + var x_78 : f32; + var x_61 : i32; + var x_58_phi : f32; + x_57 = x_57_phi; + let x_60 : i32 = x_60_phi; + x_83_phi = 0.0; + x_84_phi = x_57; + x_85_phi = false; + if ((x_60 < 800)) { + } else { + break; + } + var x_77 : f32; + var x_78_phi : f32; + if (((x_60 % 32) == 0)) { + x_70 = (x_57 + 0.400000006); + x_58_phi = x_70; + } else { + x_78_phi = x_57; + if (((f32(x_60) % round(x_50)) <= 0.01)) { + x_77 = (x_57 + 100.0); + x_78_phi = x_77; + } + x_78 = x_78_phi; + x_58_phi = x_78; + } + x_58 = x_58_phi; + if ((f32(x_60) >= x_53)) { + x_83_phi = x_58; + x_84_phi = x_58; + x_85_phi = true; + break; + } + + continuing { + x_61 = (x_60 + 1); + x_57_phi = x_58; + x_60_phi = x_61; + } + } + x_83 = x_83_phi; + x_84 = x_84_phi; + let x_85 : bool = x_85_phi; + x_87_phi = x_83; + if (x_85) { + break; + } + x_87_phi = x_84; + } + } + var x_92 : f32; + var x_98 : f32; + var x_99 : f32; + var x_98_phi : f32; + var x_101_phi : i32; + var x_124_phi : f32; + var x_125_phi : f32; + var x_126_phi : bool; + let x_87 : f32 = x_87_phi; + let x_88 : ptr = &(c.x); + let x_89 : vec4 = vec4(x_84, 0.400000006, x_83, 0.400000006); + *(x_88) = x_87; + x_92 = gl_FragCoord.y; + switch(0u) { + default: { + let x_95 : vec4 = vec4(x_51, 0.0, x_57); + let x_96 : f32 = vec3(x_48, -0.5).z; + x_98_phi = x_96; + x_101_phi = 1; + loop { + var x_111 : f32; + var x_119 : f32; + var x_102 : i32; + var x_99_phi : f32; + x_98 = x_98_phi; + let x_101 : i32 = x_101_phi; + x_124_phi = 0.0; + x_125_phi = x_98; + x_126_phi = false; + if ((x_101 < 800)) { + } else { + break; + } + var x_118 : f32; + var x_119_phi : f32; + if (((x_101 % 32) == 0)) { + x_111 = (x_98 + 0.400000006); + x_99_phi = x_111; + } else { + x_119_phi = x_98; + if (((f32(x_101) % round(x_50)) <= 0.01)) { + x_118 = (x_98 + 100.0); + x_119_phi = x_118; + } + x_119 = x_119_phi; + x_99_phi = x_119; + } + x_99 = x_99_phi; + if ((f32(x_101) >= x_92)) { + x_124_phi = x_99; + x_125_phi = x_99; + x_126_phi = true; + break; + } + + continuing { + x_102 = (x_101 + 1); + x_98_phi = x_99; + x_101_phi = x_102; + } + } + x_124 = x_124_phi; + x_125 = x_125_phi; + let x_126 : bool = x_126_phi; + x_128_phi = x_124; + if (x_126) { + break; + } + x_128_phi = x_125; + } + } + let x_128 : f32 = x_128_phi; + let x_129 : ptr = &(c.y); + *(x_129) = x_128; + let x_130 : f32 = *(x_88); + let x_131 : f32 = *(x_129); + c.z = (x_130 + x_131); + x_135_phi = 0; + loop { + var x_136 : i32; + let x_135 : i32 = x_135_phi; + if ((x_135 < 3)) { + } else { + break; + } + let x_141 : ptr = &(c[x_135]); + let x_142 : f32 = *(x_141); + if ((x_142 >= 1.0)) { + let x_146 : f32 = *(x_141); + let x_147 : f32 = *(x_141); + *(x_141) = (x_146 * x_147); + } + + continuing { + x_136 = (x_135 + 1); + x_135_phi = x_136; + } + } + let x_149 : vec3 = c; + let x_151 : vec3 = normalize(abs(x_149)); + x_GLF_color = vec4(x_151.x, x_151.y, x_151.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..f5c9fb04f1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.hlsl @@ -0,0 +1,207 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float x_53 = 0.0f; + float x_57 = 0.0f; + float x_58 = 0.0f; + float x_83 = 0.0f; + float x_84 = 0.0f; + float x_124 = 0.0f; + float x_125 = 0.0f; + float x_57_phi = 0.0f; + int x_60_phi = 0; + float x_83_phi = 0.0f; + float x_84_phi = 0.0f; + bool x_85_phi = false; + float x_87_phi = 0.0f; + float x_128_phi = 0.0f; + int x_135_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_47 = asfloat(x_7[0].x); + const float2 x_48 = float2(1.0f, x_47); + const float x_50 = round((x_47 * 0.125f)); + const float2 x_51 = float2(0.0f, -0.5f); + x_53 = gl_FragCoord.x; + switch(0u) { + default: { + x_57_phi = -0.5f; + x_60_phi = 1; + while (true) { + float x_70 = 0.0f; + float x_78 = 0.0f; + int x_61 = 0; + float x_58_phi = 0.0f; + x_57 = x_57_phi; + const int x_60 = x_60_phi; + x_83_phi = 0.0f; + x_84_phi = x_57; + x_85_phi = false; + if ((x_60 < 800)) { + } else { + break; + } + float x_77 = 0.0f; + float x_78_phi = 0.0f; + if (((x_60 % 32) == 0)) { + x_70 = (x_57 + 0.400000006f); + x_58_phi = x_70; + } else { + x_78_phi = x_57; + if (((float(x_60) % round(x_50)) <= 0.01f)) { + x_77 = (x_57 + 100.0f); + x_78_phi = x_77; + } + x_78 = x_78_phi; + x_58_phi = x_78; + } + x_58 = x_58_phi; + if ((float(x_60) >= x_53)) { + x_83_phi = x_58; + x_84_phi = x_58; + x_85_phi = true; + break; + } + { + x_61 = (x_60 + 1); + x_57_phi = x_58; + x_60_phi = x_61; + } + } + x_83 = x_83_phi; + x_84 = x_84_phi; + const bool x_85 = x_85_phi; + x_87_phi = x_83; + if (x_85) { + break; + } + x_87_phi = x_84; + break; + } + } + float x_92 = 0.0f; + float x_98 = 0.0f; + float x_99 = 0.0f; + float x_98_phi = 0.0f; + int x_101_phi = 0; + float x_124_phi = 0.0f; + float x_125_phi = 0.0f; + bool x_126_phi = false; + const float x_87 = x_87_phi; + const float4 x_89 = float4(x_84, 0.400000006f, x_83, 0.400000006f); + c.x = x_87; + x_92 = gl_FragCoord.y; + switch(0u) { + default: { + const float4 x_95 = float4(x_51, 0.0f, x_57); + const float x_96 = float3(x_48, -0.5f).z; + x_98_phi = x_96; + x_101_phi = 1; + while (true) { + float x_111 = 0.0f; + float x_119 = 0.0f; + int x_102 = 0; + float x_99_phi = 0.0f; + x_98 = x_98_phi; + const int x_101 = x_101_phi; + x_124_phi = 0.0f; + x_125_phi = x_98; + x_126_phi = false; + if ((x_101 < 800)) { + } else { + break; + } + float x_118 = 0.0f; + float x_119_phi = 0.0f; + if (((x_101 % 32) == 0)) { + x_111 = (x_98 + 0.400000006f); + x_99_phi = x_111; + } else { + x_119_phi = x_98; + if (((float(x_101) % round(x_50)) <= 0.01f)) { + x_118 = (x_98 + 100.0f); + x_119_phi = x_118; + } + x_119 = x_119_phi; + x_99_phi = x_119; + } + x_99 = x_99_phi; + if ((float(x_101) >= x_92)) { + x_124_phi = x_99; + x_125_phi = x_99; + x_126_phi = true; + break; + } + { + x_102 = (x_101 + 1); + x_98_phi = x_99; + x_101_phi = x_102; + } + } + x_124 = x_124_phi; + x_125 = x_125_phi; + const bool x_126 = x_126_phi; + x_128_phi = x_124; + if (x_126) { + break; + } + x_128_phi = x_125; + break; + } + } + const float x_128 = x_128_phi; + c.y = x_128; + const float x_130 = c.x; + const float x_131 = c.y; + c.z = (x_130 + x_131); + x_135_phi = 0; + while (true) { + int x_136 = 0; + const int x_135 = x_135_phi; + if ((x_135 < 3)) { + } else { + break; + } + const int x_141_save = x_135; + const float x_142 = c[x_141_save]; + if ((x_142 >= 1.0f)) { + const float x_146 = c[x_141_save]; + const float x_147 = c[x_141_save]; + set_float3(c, x_141_save, (x_146 * x_147)); + } + { + x_136 = (x_135 + 1); + x_135_phi = x_136; + } + } + const float3 x_151 = normalize(abs(c)); + x_GLF_color = float4(x_151.x, x_151.y, x_151.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.msl new file mode 100755 index 0000000000..4bdc690c28 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.msl @@ -0,0 +1,213 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float x_53 = 0.0f; + float x_57 = 0.0f; + float x_58 = 0.0f; + float x_83 = 0.0f; + float x_84 = 0.0f; + float x_124 = 0.0f; + float x_125 = 0.0f; + float x_57_phi = 0.0f; + int x_60_phi = 0; + float x_83_phi = 0.0f; + float x_84_phi = 0.0f; + bool x_85_phi = false; + float x_87_phi = 0.0f; + float x_128_phi = 0.0f; + int x_135_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_47 = x_7.resolution.x; + float2 const x_48 = float2(1.0f, x_47); + float const x_50 = rint((x_47 * 0.125f)); + float2 const x_51 = float2(0.0f, -0.5f); + x_53 = (*(tint_symbol_5)).x; + switch(0u) { + default: { + x_57_phi = -0.5f; + x_60_phi = 1; + while (true) { + float x_70 = 0.0f; + float x_78 = 0.0f; + int x_61 = 0; + float x_58_phi = 0.0f; + x_57 = x_57_phi; + int const x_60 = x_60_phi; + x_83_phi = 0.0f; + x_84_phi = x_57; + x_85_phi = false; + if ((x_60 < 800)) { + } else { + break; + } + float x_77 = 0.0f; + float x_78_phi = 0.0f; + if (((x_60 % 32) == 0)) { + x_70 = (x_57 + 0.400000006f); + x_58_phi = x_70; + } else { + x_78_phi = x_57; + if (((float(x_60) % rint(x_50)) <= 0.01f)) { + x_77 = (x_57 + 100.0f); + x_78_phi = x_77; + } + x_78 = x_78_phi; + x_58_phi = x_78; + } + x_58 = x_58_phi; + if ((float(x_60) >= x_53)) { + x_83_phi = x_58; + x_84_phi = x_58; + x_85_phi = true; + break; + } + { + x_61 = (x_60 + 1); + x_57_phi = x_58; + x_60_phi = x_61; + } + } + x_83 = x_83_phi; + x_84 = x_84_phi; + bool const x_85 = x_85_phi; + x_87_phi = x_83; + if (x_85) { + break; + } + x_87_phi = x_84; + break; + } + } + float x_92 = 0.0f; + float x_98 = 0.0f; + float x_99 = 0.0f; + float x_98_phi = 0.0f; + int x_101_phi = 0; + float x_124_phi = 0.0f; + float x_125_phi = 0.0f; + bool x_126_phi = false; + float const x_87 = x_87_phi; + float4 const x_89 = float4(x_84, 0.400000006f, x_83, 0.400000006f); + c.x = x_87; + x_92 = (*(tint_symbol_5)).y; + switch(0u) { + default: { + float4 const x_95 = float4(x_51, 0.0f, x_57); + float const x_96 = float3(x_48, -0.5f).z; + x_98_phi = x_96; + x_101_phi = 1; + while (true) { + float x_111 = 0.0f; + float x_119 = 0.0f; + int x_102 = 0; + float x_99_phi = 0.0f; + x_98 = x_98_phi; + int const x_101 = x_101_phi; + x_124_phi = 0.0f; + x_125_phi = x_98; + x_126_phi = false; + if ((x_101 < 800)) { + } else { + break; + } + float x_118 = 0.0f; + float x_119_phi = 0.0f; + if (((x_101 % 32) == 0)) { + x_111 = (x_98 + 0.400000006f); + x_99_phi = x_111; + } else { + x_119_phi = x_98; + if (((float(x_101) % rint(x_50)) <= 0.01f)) { + x_118 = (x_98 + 100.0f); + x_119_phi = x_118; + } + x_119 = x_119_phi; + x_99_phi = x_119; + } + x_99 = x_99_phi; + if ((float(x_101) >= x_92)) { + x_124_phi = x_99; + x_125_phi = x_99; + x_126_phi = true; + break; + } + { + x_102 = (x_101 + 1); + x_98_phi = x_99; + x_101_phi = x_102; + } + } + x_124 = x_124_phi; + x_125 = x_125_phi; + bool const x_126 = x_126_phi; + x_128_phi = x_124; + if (x_126) { + break; + } + x_128_phi = x_125; + break; + } + } + float const x_128 = x_128_phi; + c.y = x_128; + float const x_130 = c.x; + float const x_131 = c.y; + c.z = (x_130 + x_131); + x_135_phi = 0; + while (true) { + int x_136 = 0; + int const x_135 = x_135_phi; + if ((x_135 < 3)) { + } else { + break; + } + int const x_141_save = x_135; + float const x_142 = c[x_141_save]; + if ((x_142 >= 1.0f)) { + float const x_146 = c[x_141_save]; + float const x_147 = c[x_141_save]; + c[x_141_save] = (x_146 * x_147); + } + { + x_136 = (x_135 + 1); + x_135_phi = x_136; + } + } + float3 const x_149 = c; + float3 const x_151 = normalize(fabs(x_149)); + *(tint_symbol_6) = float4(x_151.x, x_151.y, x_151.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\u9vw.0.metal:62:29: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_60) % rint(x_50)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~ +T:\tmp\u9vw.0.metal:132:30: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_101) % rint(x_50)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~ +2 errors generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..59c0cdb6a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.spvasm @@ -0,0 +1,462 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 267 +; Schema: 0 + OpCapability Shader + %58 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %c "c" + OpName %x_53 "x_53" + OpName %x_57 "x_57" + OpName %x_58 "x_58" + OpName %x_83 "x_83" + OpName %x_84 "x_84" + OpName %x_124 "x_124" + OpName %x_125 "x_125" + OpName %x_57_phi "x_57_phi" + OpName %x_60_phi "x_60_phi" + OpName %x_83_phi "x_83_phi" + OpName %x_84_phi "x_84_phi" + OpName %x_85_phi "x_85_phi" + OpName %x_87_phi "x_87_phi" + OpName %x_128_phi "x_128_phi" + OpName %x_135_phi "x_135_phi" + OpName %x_70 "x_70" + OpName %x_78 "x_78" + OpName %x_61 "x_61" + OpName %x_58_phi "x_58_phi" + OpName %x_77 "x_77" + OpName %x_78_phi "x_78_phi" + OpName %x_92 "x_92" + OpName %x_98 "x_98" + OpName %x_99 "x_99" + OpName %x_98_phi "x_98_phi" + OpName %x_101_phi "x_101_phi" + OpName %x_124_phi "x_124_phi" + OpName %x_125_phi "x_125_phi" + OpName %x_126_phi "x_126_phi" + OpName %x_111 "x_111" + OpName %x_119 "x_119" + OpName %x_102 "x_102" + OpName %x_99_phi "x_99_phi" + OpName %x_118 "x_118" + OpName %x_119_phi "x_119_phi" + OpName %x_136 "x_136" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %22 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %36 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %42 = OpConstantNull %bool + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %49 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 +%float_0_125 = OpConstant %float 0.125 + %float_0 = OpConstant %float 0 + %float_n0_5 = OpConstant %float -0.5 + %63 = OpConstantComposite %v2float %float_0 %float_n0_5 +%_ptr_Private_float = OpTypePointer Private %float + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %int_800 = OpConstant %int 800 + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %254 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %22 + %x_53 = OpVariable %_ptr_Function_float Function %25 + %x_57 = OpVariable %_ptr_Function_float Function %25 + %x_58 = OpVariable %_ptr_Function_float Function %25 + %x_83 = OpVariable %_ptr_Function_float Function %25 + %x_84 = OpVariable %_ptr_Function_float Function %25 + %x_124 = OpVariable %_ptr_Function_float Function %25 + %x_125 = OpVariable %_ptr_Function_float Function %25 + %x_57_phi = OpVariable %_ptr_Function_float Function %25 + %x_60_phi = OpVariable %_ptr_Function_int Function %36 + %x_83_phi = OpVariable %_ptr_Function_float Function %25 + %x_84_phi = OpVariable %_ptr_Function_float Function %25 + %x_85_phi = OpVariable %_ptr_Function_bool Function %42 + %x_87_phi = OpVariable %_ptr_Function_float Function %25 + %x_128_phi = OpVariable %_ptr_Function_float Function %25 + %x_135_phi = OpVariable %_ptr_Function_int Function %36 + %x_70 = OpVariable %_ptr_Function_float Function %25 + %x_78 = OpVariable %_ptr_Function_float Function %25 + %x_61 = OpVariable %_ptr_Function_int Function %36 + %x_58_phi = OpVariable %_ptr_Function_float Function %25 + %x_77 = OpVariable %_ptr_Function_float Function %25 + %x_78_phi = OpVariable %_ptr_Function_float Function %25 + %x_92 = OpVariable %_ptr_Function_float Function %25 + %x_98 = OpVariable %_ptr_Function_float Function %25 + %x_99 = OpVariable %_ptr_Function_float Function %25 + %x_98_phi = OpVariable %_ptr_Function_float Function %25 + %x_101_phi = OpVariable %_ptr_Function_int Function %36 + %x_124_phi = OpVariable %_ptr_Function_float Function %25 + %x_125_phi = OpVariable %_ptr_Function_float Function %25 + %x_126_phi = OpVariable %_ptr_Function_bool Function %42 + %x_111 = OpVariable %_ptr_Function_float Function %25 + %x_119 = OpVariable %_ptr_Function_float Function %25 + %x_102 = OpVariable %_ptr_Function_int Function %36 + %x_99_phi = OpVariable %_ptr_Function_float Function %25 + %x_118 = OpVariable %_ptr_Function_float Function %25 + %x_119_phi = OpVariable %_ptr_Function_float Function %25 + %x_136 = OpVariable %_ptr_Function_int Function %36 + OpStore %c %49 + %53 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %54 = OpLoad %float %53 + %56 = OpCompositeConstruct %v2float %float_1 %54 + %60 = OpFMul %float %54 %float_0_125 + %57 = OpExtInst %float %58 RoundEven %60 + %65 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %66 = OpLoad %float %65 + OpStore %x_53 %66 + OpSelectionMerge %67 None + OpSwitch %uint_0 %68 + %68 = OpLabel + OpStore %x_57_phi %float_n0_5 + OpStore %x_60_phi %int_1 + OpBranch %70 + %70 = OpLabel + OpLoopMerge %71 %72 None + OpBranch %73 + %73 = OpLabel + %78 = OpLoad %float %x_57_phi + OpStore %x_57 %78 + %79 = OpLoad %int %x_60_phi + OpStore %x_83_phi %float_0 + %80 = OpLoad %float %x_57 + OpStore %x_84_phi %80 + OpStore %x_85_phi %false + %83 = OpSLessThan %bool %79 %int_800 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + OpBranch %84 + %86 = OpLabel + OpBranch %71 + %84 = OpLabel + %90 = OpSMod %int %79 %int_32 + %92 = OpIEqual %bool %90 %int_0 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + %96 = OpLoad %float %x_57 + %98 = OpFAdd %float %96 %float_0_400000006 + OpStore %x_70 %98 + %99 = OpLoad %float %x_70 + OpStore %x_58_phi %99 + OpBranch %93 + %95 = OpLabel + %100 = OpLoad %float %x_57 + OpStore %x_78_phi %100 + %101 = OpConvertSToF %float %79 + %102 = OpExtInst %float %58 RoundEven %57 + %103 = OpFMod %float %101 %102 + %105 = OpFOrdLessThanEqual %bool %103 %float_0_00999999978 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + %108 = OpLoad %float %x_57 + %110 = OpFAdd %float %108 %float_100 + OpStore %x_77 %110 + %111 = OpLoad %float %x_77 + OpStore %x_78_phi %111 + OpBranch %106 + %106 = OpLabel + %112 = OpLoad %float %x_78_phi + OpStore %x_78 %112 + %113 = OpLoad %float %x_78 + OpStore %x_58_phi %113 + OpBranch %93 + %93 = OpLabel + %114 = OpLoad %float %x_58_phi + OpStore %x_58 %114 + %115 = OpConvertSToF %float %79 + %116 = OpLoad %float %x_53 + %117 = OpFOrdGreaterThanEqual %bool %115 %116 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %120 = OpLoad %float %x_58 + OpStore %x_83_phi %120 + %121 = OpLoad %float %x_58 + OpStore %x_84_phi %121 + OpStore %x_85_phi %true + OpBranch %71 + %118 = OpLabel + OpBranch %72 + %72 = OpLabel + %123 = OpIAdd %int %79 %int_1 + OpStore %x_61 %123 + %124 = OpLoad %float %x_58 + OpStore %x_57_phi %124 + %125 = OpLoad %int %x_61 + OpStore %x_60_phi %125 + OpBranch %70 + %71 = OpLabel + %126 = OpLoad %float %x_83_phi + OpStore %x_83 %126 + %127 = OpLoad %float %x_84_phi + OpStore %x_84 %127 + %128 = OpLoad %bool %x_85_phi + %129 = OpLoad %float %x_83 + OpStore %x_87_phi %129 + OpSelectionMerge %130 None + OpBranchConditional %128 %131 %130 + %131 = OpLabel + OpBranch %67 + %130 = OpLabel + %132 = OpLoad %float %x_84 + OpStore %x_87_phi %132 + OpBranch %67 + %67 = OpLabel + %141 = OpLoad %float %x_87_phi + %142 = OpLoad %float %x_84 + %143 = OpLoad %float %x_83 + %144 = OpCompositeConstruct %v4float %142 %float_0_400000006 %143 %float_0_400000006 + %145 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %145 %141 + %147 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %148 = OpLoad %float %147 + OpStore %x_92 %148 + OpSelectionMerge %149 None + OpSwitch %uint_0 %150 + %150 = OpLabel + %151 = OpCompositeExtract %float %63 0 + %152 = OpCompositeExtract %float %63 1 + %153 = OpLoad %float %x_57 + %154 = OpCompositeConstruct %v4float %151 %152 %float_0 %153 + %155 = OpCompositeExtract %float %56 0 + %156 = OpCompositeExtract %float %56 1 + %157 = OpCompositeConstruct %v3float %155 %156 %float_n0_5 + %158 = OpCompositeExtract %float %157 2 + OpStore %x_98_phi %158 + OpStore %x_101_phi %int_1 + OpBranch %159 + %159 = OpLabel + OpLoopMerge %160 %161 None + OpBranch %162 + %162 = OpLabel + %167 = OpLoad %float %x_98_phi + OpStore %x_98 %167 + %168 = OpLoad %int %x_101_phi + OpStore %x_124_phi %float_0 + %169 = OpLoad %float %x_98 + OpStore %x_125_phi %169 + OpStore %x_126_phi %false + %170 = OpSLessThan %bool %168 %int_800 + OpSelectionMerge %171 None + OpBranchConditional %170 %172 %173 + %172 = OpLabel + OpBranch %171 + %173 = OpLabel + OpBranch %160 + %171 = OpLabel + %176 = OpSMod %int %168 %int_32 + %177 = OpIEqual %bool %176 %int_0 + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %180 + %179 = OpLabel + %181 = OpLoad %float %x_98 + %182 = OpFAdd %float %181 %float_0_400000006 + OpStore %x_111 %182 + %183 = OpLoad %float %x_111 + OpStore %x_99_phi %183 + OpBranch %178 + %180 = OpLabel + %184 = OpLoad %float %x_98 + OpStore %x_119_phi %184 + %185 = OpConvertSToF %float %168 + %186 = OpExtInst %float %58 RoundEven %57 + %187 = OpFMod %float %185 %186 + %188 = OpFOrdLessThanEqual %bool %187 %float_0_00999999978 + OpSelectionMerge %189 None + OpBranchConditional %188 %190 %189 + %190 = OpLabel + %191 = OpLoad %float %x_98 + %192 = OpFAdd %float %191 %float_100 + OpStore %x_118 %192 + %193 = OpLoad %float %x_118 + OpStore %x_119_phi %193 + OpBranch %189 + %189 = OpLabel + %194 = OpLoad %float %x_119_phi + OpStore %x_119 %194 + %195 = OpLoad %float %x_119 + OpStore %x_99_phi %195 + OpBranch %178 + %178 = OpLabel + %196 = OpLoad %float %x_99_phi + OpStore %x_99 %196 + %197 = OpConvertSToF %float %168 + %198 = OpLoad %float %x_92 + %199 = OpFOrdGreaterThanEqual %bool %197 %198 + OpSelectionMerge %200 None + OpBranchConditional %199 %201 %200 + %201 = OpLabel + %202 = OpLoad %float %x_99 + OpStore %x_124_phi %202 + %203 = OpLoad %float %x_99 + OpStore %x_125_phi %203 + OpStore %x_126_phi %true + OpBranch %160 + %200 = OpLabel + OpBranch %161 + %161 = OpLabel + %204 = OpIAdd %int %168 %int_1 + OpStore %x_102 %204 + %205 = OpLoad %float %x_99 + OpStore %x_98_phi %205 + %206 = OpLoad %int %x_102 + OpStore %x_101_phi %206 + OpBranch %159 + %160 = OpLabel + %207 = OpLoad %float %x_124_phi + OpStore %x_124 %207 + %208 = OpLoad %float %x_125_phi + OpStore %x_125 %208 + %209 = OpLoad %bool %x_126_phi + %210 = OpLoad %float %x_124 + OpStore %x_128_phi %210 + OpSelectionMerge %211 None + OpBranchConditional %209 %212 %211 + %212 = OpLabel + OpBranch %149 + %211 = OpLabel + %213 = OpLoad %float %x_125 + OpStore %x_128_phi %213 + OpBranch %149 + %149 = OpLabel + %214 = OpLoad %float %x_128_phi + %215 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %215 %214 + %216 = OpAccessChain %_ptr_Function_float %c %uint_0 + %217 = OpLoad %float %216 + %218 = OpAccessChain %_ptr_Function_float %c %uint_1 + %219 = OpLoad %float %218 + %221 = OpAccessChain %_ptr_Function_float %c %uint_2 + %222 = OpFAdd %float %217 %219 + OpStore %221 %222 + OpStore %x_135_phi %int_0 + OpBranch %223 + %223 = OpLabel + OpLoopMerge %224 %225 None + OpBranch %226 + %226 = OpLabel + %228 = OpLoad %int %x_135_phi + %230 = OpSLessThan %bool %228 %int_3 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %233 + %232 = OpLabel + OpBranch %231 + %233 = OpLabel + OpBranch %224 + %231 = OpLabel + %234 = OpAccessChain %_ptr_Function_float %c %228 + %235 = OpLoad %float %234 + %236 = OpFOrdGreaterThanEqual %bool %235 %float_1 + OpSelectionMerge %237 None + OpBranchConditional %236 %238 %237 + %238 = OpLabel + %239 = OpAccessChain %_ptr_Function_float %c %228 + %240 = OpLoad %float %239 + %241 = OpAccessChain %_ptr_Function_float %c %228 + %242 = OpLoad %float %241 + %243 = OpAccessChain %_ptr_Function_float %c %228 + %244 = OpFMul %float %240 %242 + OpStore %243 %244 + OpBranch %237 + %237 = OpLabel + OpBranch %225 + %225 = OpLabel + %245 = OpIAdd %int %228 %int_1 + OpStore %x_136 %245 + %246 = OpLoad %int %x_136 + OpStore %x_135_phi %246 + OpBranch %223 + %224 = OpLabel + %247 = OpLoad %v3float %c + %249 = OpExtInst %v3float %58 FAbs %247 + %248 = OpExtInst %v3float %58 Normalize %249 + %250 = OpCompositeExtract %float %248 0 + %251 = OpCompositeExtract %float %248 1 + %252 = OpCompositeExtract %float %248 2 + %253 = OpCompositeConstruct %v4float %250 %251 %252 %float_1 + OpStore %x_GLF_color %253 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %254 +%tint_symbol_1 = OpFunctionParameter %main_out + %258 = OpLabel + %259 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %259 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %261 = OpLabel + %262 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %262 + %263 = OpFunctionCall %void %main_1 + %265 = OpLoad %v4float %x_GLF_color + %266 = OpCompositeConstruct %main_out %265 + %264 = OpFunctionCall %void %tint_symbol_3 %266 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..c2ad2e8b47 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite-phi/1.wgsl.expected.wgsl @@ -0,0 +1,205 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec3; + var x_53 : f32; + var x_57 : f32; + var x_58 : f32; + var x_83 : f32; + var x_84 : f32; + var x_124 : f32; + var x_125 : f32; + var x_57_phi : f32; + var x_60_phi : i32; + var x_83_phi : f32; + var x_84_phi : f32; + var x_85_phi : bool; + var x_87_phi : f32; + var x_128_phi : f32; + var x_135_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_47 : f32 = x_7.resolution.x; + let x_48 : vec2 = vec2(1.0, x_47); + let x_50 : f32 = round((x_47 * 0.125)); + let x_51 : vec2 = vec2(0.0, -0.5); + x_53 = gl_FragCoord.x; + switch(0u) { + default: { + x_57_phi = -0.5; + x_60_phi = 1; + loop { + var x_70 : f32; + var x_78 : f32; + var x_61 : i32; + var x_58_phi : f32; + x_57 = x_57_phi; + let x_60 : i32 = x_60_phi; + x_83_phi = 0.0; + x_84_phi = x_57; + x_85_phi = false; + if ((x_60 < 800)) { + } else { + break; + } + var x_77 : f32; + var x_78_phi : f32; + if (((x_60 % 32) == 0)) { + x_70 = (x_57 + 0.400000006); + x_58_phi = x_70; + } else { + x_78_phi = x_57; + if (((f32(x_60) % round(x_50)) <= 0.01)) { + x_77 = (x_57 + 100.0); + x_78_phi = x_77; + } + x_78 = x_78_phi; + x_58_phi = x_78; + } + x_58 = x_58_phi; + if ((f32(x_60) >= x_53)) { + x_83_phi = x_58; + x_84_phi = x_58; + x_85_phi = true; + break; + } + + continuing { + x_61 = (x_60 + 1); + x_57_phi = x_58; + x_60_phi = x_61; + } + } + x_83 = x_83_phi; + x_84 = x_84_phi; + let x_85 : bool = x_85_phi; + x_87_phi = x_83; + if (x_85) { + break; + } + x_87_phi = x_84; + } + } + var x_92 : f32; + var x_98 : f32; + var x_99 : f32; + var x_98_phi : f32; + var x_101_phi : i32; + var x_124_phi : f32; + var x_125_phi : f32; + var x_126_phi : bool; + let x_87 : f32 = x_87_phi; + let x_88 : ptr = &(c.x); + let x_89 : vec4 = vec4(x_84, 0.400000006, x_83, 0.400000006); + *(x_88) = x_87; + x_92 = gl_FragCoord.y; + switch(0u) { + default: { + let x_95 : vec4 = vec4(x_51, 0.0, x_57); + let x_96 : f32 = vec3(x_48, -0.5).z; + x_98_phi = x_96; + x_101_phi = 1; + loop { + var x_111 : f32; + var x_119 : f32; + var x_102 : i32; + var x_99_phi : f32; + x_98 = x_98_phi; + let x_101 : i32 = x_101_phi; + x_124_phi = 0.0; + x_125_phi = x_98; + x_126_phi = false; + if ((x_101 < 800)) { + } else { + break; + } + var x_118 : f32; + var x_119_phi : f32; + if (((x_101 % 32) == 0)) { + x_111 = (x_98 + 0.400000006); + x_99_phi = x_111; + } else { + x_119_phi = x_98; + if (((f32(x_101) % round(x_50)) <= 0.01)) { + x_118 = (x_98 + 100.0); + x_119_phi = x_118; + } + x_119 = x_119_phi; + x_99_phi = x_119; + } + x_99 = x_99_phi; + if ((f32(x_101) >= x_92)) { + x_124_phi = x_99; + x_125_phi = x_99; + x_126_phi = true; + break; + } + + continuing { + x_102 = (x_101 + 1); + x_98_phi = x_99; + x_101_phi = x_102; + } + } + x_124 = x_124_phi; + x_125 = x_125_phi; + let x_126 : bool = x_126_phi; + x_128_phi = x_124; + if (x_126) { + break; + } + x_128_phi = x_125; + } + } + let x_128 : f32 = x_128_phi; + let x_129 : ptr = &(c.y); + *(x_129) = x_128; + let x_130 : f32 = *(x_88); + let x_131 : f32 = *(x_129); + c.z = (x_130 + x_131); + x_135_phi = 0; + loop { + var x_136 : i32; + let x_135 : i32 = x_135_phi; + if ((x_135 < 3)) { + } else { + break; + } + let x_141 : ptr = &(c[x_135]); + let x_142 : f32 = *(x_141); + if ((x_142 >= 1.0)) { + let x_146 : f32 = *(x_141); + let x_147 : f32 = *(x_141); + *(x_141) = (x_146 * x_147); + } + + continuing { + x_136 = (x_135 + 1); + x_135_phi = x_136; + } + } + let x_149 : vec3 = c; + let x_151 : vec3 = normalize(abs(x_149)); + x_GLF_color = vec4(x_151.x, x_151.y, x_151.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm new file mode 100644 index 0000000000..a12759dc19 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm @@ -0,0 +1,104 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %indexable "indexable" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %uint = OpTypeInt 32 0 + %float_10 = OpConstant %float 10 + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1000 = OpConstant %int 1000 + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %33 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %36 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %37 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %38 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %39 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %40 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %41 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %42 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %46 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %47 = OpConstantComposite %_arr_v4float_uint_16 %31 %33 %34 %35 %36 %37 %38 %39 %31 %40 %41 %42 %43 %44 %45 %46 + %int_16 = OpConstant %int 16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main = OpFunction %void None %9 + %51 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %52 = OpLoad %v4float %gl_FragCoord + %53 = OpVectorShuffle %v2float %52 %52 0 1 + %54 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %55 = OpLoad %v2float %54 + %56 = OpFDiv %v2float %53 %55 + %57 = OpCompositeExtract %float %56 0 + %58 = OpFMul %float %57 %float_10 + %59 = OpConvertFToS %int %58 + %60 = OpCompositeExtract %float %56 1 + %61 = OpFMul %float %60 %float_10 + %62 = OpConvertFToS %int %61 + %63 = OpIMul %int %62 %int_10 + %64 = OpIAdd %int %59 %63 + OpBranch %65 + %65 = OpLabel + %66 = OpPhi %int %int_100 %51 %67 %68 + %69 = OpPhi %int %int_0 %51 %70 %68 + %71 = OpSLessThan %bool %69 %64 + OpLoopMerge %72 %68 None + OpBranchConditional %71 %68 %72 + %68 = OpLabel + %73 = OpIMul %int %int_4 %66 + %74 = OpISub %int %int_1000 %66 + %75 = OpIMul %int %73 %74 + %67 = OpSDiv %int %75 %int_1000 + %70 = OpIAdd %int %69 %int_1 + OpBranch %65 + %72 = OpLabel + %76 = OpSMod %int %66 %int_16 + OpStore %indexable %47 + %77 = OpAccessChain %_ptr_Function_v4float %indexable %76 + %78 = OpLoad %v4float %77 + OpStore %_GLF_color %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..14cc0b58aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.hlsl @@ -0,0 +1,58 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int x_66 = 0; + int x_66_phi = 0; + int x_69_phi = 0; + const float4 x_52 = gl_FragCoord; + const float2 x_55 = asfloat(x_6[0].xy); + const float2 x_56 = (float2(x_52.x, x_52.y) / x_55); + const int x_64 = (int((x_56.x * 10.0f)) + (int((x_56.y * 10.0f)) * 10)); + x_66_phi = 100; + x_69_phi = 0; + while (true) { + int x_67 = 0; + int x_70 = 0; + x_66 = x_66_phi; + const int x_69 = x_69_phi; + if ((x_69 < x_64)) { + } else { + break; + } + { + x_67 = (((4 * asint(x_66)) * (1000 - asint(x_66))) / 1000); + x_70 = (x_69 + 1); + x_66_phi = x_67; + x_69_phi = x_70; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_78 = indexable[asint((x_66 % 16))]; + x_GLF_color = x_78; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.msl new file mode 100644 index 0000000000..f5bbeb84de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.msl @@ -0,0 +1,60 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int x_66 = 0; + int x_66_phi = 0; + int x_69_phi = 0; + float4 const x_52 = *(tint_symbol_6); + float2 const x_55 = x_6.resolution; + float2 const x_56 = (float2(x_52.x, x_52.y) / x_55); + int const x_64 = (int((x_56.x * 10.0f)) + (int((x_56.y * 10.0f)) * 10)); + x_66_phi = 100; + x_69_phi = 0; + while (true) { + int x_67 = 0; + int x_70 = 0; + x_66 = x_66_phi; + int const x_69 = x_69_phi; + if ((x_69 < x_64)) { + } else { + break; + } + { + x_67 = (((4 * as_type(x_66)) * (1000 - as_type(x_66))) / 1000); + x_70 = (x_69 + 1); + x_66_phi = x_67; + x_69_phi = x_70; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_78 = indexable.arr[as_type((x_66 % 16))]; + *(tint_symbol_7) = x_78; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..feaee7c200 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.spvasm @@ -0,0 +1,180 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 118 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_66 "x_66" + OpName %x_66_phi "x_66_phi" + OpName %x_69_phi "x_69_phi" + OpName %x_67 "x_67" + OpName %x_70 "x_70" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_10 = OpConstant %float 10 + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1000 = OpConstant %int 1000 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %81 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %83 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %84 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %85 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %86 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %87 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %88 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %89 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %90 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %91 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %92 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %93 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %94 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %95 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %96 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %97 = OpConstantComposite %_arr_v4float_uint_16 %81 %83 %84 %85 %86 %87 %88 %89 %81 %90 %91 %92 %93 %94 %95 %96 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %105 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_66 = OpVariable %_ptr_Function_int Function %28 + %x_66_phi = OpVariable %_ptr_Function_int Function %28 + %x_69_phi = OpVariable %_ptr_Function_int Function %28 + %x_67 = OpVariable %_ptr_Function_int Function %28 + %x_70 = OpVariable %_ptr_Function_int Function %28 + %31 = OpLoad %v4float %gl_FragCoord + %34 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %35 = OpLoad %v2float %34 + %36 = OpCompositeExtract %float %31 0 + %37 = OpCompositeExtract %float %31 1 + %38 = OpCompositeConstruct %v2float %36 %37 + %39 = OpFDiv %v2float %38 %35 + %41 = OpCompositeExtract %float %39 0 + %43 = OpFMul %float %41 %float_10 + %40 = OpConvertFToS %int %43 + %45 = OpCompositeExtract %float %39 1 + %46 = OpFMul %float %45 %float_10 + %44 = OpConvertFToS %int %46 + %48 = OpIMul %int %44 %int_10 + %49 = OpIAdd %int %40 %48 + OpStore %x_66_phi %int_100 + OpStore %x_69_phi %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %58 = OpLoad %int %x_66_phi + OpStore %x_66 %58 + %59 = OpLoad %int %x_69_phi + %60 = OpSLessThan %bool %59 %49 + OpSelectionMerge %62 None + OpBranchConditional %60 %63 %64 + %63 = OpLabel + OpBranch %62 + %64 = OpLabel + OpBranch %53 + %62 = OpLabel + OpBranch %54 + %54 = OpLabel + %67 = OpLoad %int %x_66 + %66 = OpCopyObject %int %67 + %68 = OpIMul %int %int_4 %66 + %71 = OpLoad %int %x_66 + %70 = OpCopyObject %int %71 + %72 = OpISub %int %int_1000 %70 + %73 = OpIMul %int %68 %72 + %74 = OpSDiv %int %73 %int_1000 + OpStore %x_67 %74 + %76 = OpIAdd %int %59 %int_1 + OpStore %x_70 %76 + %77 = OpLoad %int %x_67 + OpStore %x_66_phi %77 + %78 = OpLoad %int %x_70 + OpStore %x_69_phi %78 + OpBranch %52 + %53 = OpLabel + OpStore %indexable %97 + %99 = OpLoad %int %x_66 + %101 = OpSMod %int %99 %int_16 + %98 = OpCopyObject %int %101 + %103 = OpAccessChain %_ptr_Function_v4float %indexable %98 + %104 = OpLoad %v4float %103 + OpStore %x_GLF_color %104 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %105 +%tint_symbol_1 = OpFunctionParameter %main_out + %109 = OpLabel + %110 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %110 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %112 = OpLabel + %113 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %113 + %114 = OpFunctionCall %void %main_1 + %116 = OpLoad %v4float %x_GLF_color + %117 = OpCompositeConstruct %main_out %116 + %115 = OpFunctionCall %void %tint_symbol_3 %117 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..8d0080b490 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.spvasm.expected.wgsl @@ -0,0 +1,56 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_66 : i32; + var x_66_phi : i32; + var x_69_phi : i32; + let x_52 : vec4 = gl_FragCoord; + let x_55 : vec2 = x_6.resolution; + let x_56 : vec2 = (vec2(x_52.x, x_52.y) / x_55); + let x_64 : i32 = (i32((x_56.x * 10.0)) + (i32((x_56.y * 10.0)) * 10)); + x_66_phi = 100; + x_69_phi = 0; + loop { + var x_67 : i32; + var x_70 : i32; + x_66 = x_66_phi; + let x_69 : i32 = x_69_phi; + if ((x_69 < x_64)) { + } else { + break; + } + + continuing { + x_67 = (((4 * bitcast(x_66)) * (1000 - bitcast(x_66))) / 1000); + x_70 = (x_69 + 1); + x_66_phi = x_67; + x_69_phi = x_70; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_78 : vec4 = indexable[bitcast((x_66 % 16))]; + x_GLF_color = x_78; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl new file mode 100644 index 0000000000..8d0080b490 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl @@ -0,0 +1,56 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_66 : i32; + var x_66_phi : i32; + var x_69_phi : i32; + let x_52 : vec4 = gl_FragCoord; + let x_55 : vec2 = x_6.resolution; + let x_56 : vec2 = (vec2(x_52.x, x_52.y) / x_55); + let x_64 : i32 = (i32((x_56.x * 10.0)) + (i32((x_56.y * 10.0)) * 10)); + x_66_phi = 100; + x_69_phi = 0; + loop { + var x_67 : i32; + var x_70 : i32; + x_66 = x_66_phi; + let x_69 : i32 = x_69_phi; + if ((x_69 < x_64)) { + } else { + break; + } + + continuing { + x_67 = (((4 * bitcast(x_66)) * (1000 - bitcast(x_66))) / 1000); + x_70 = (x_69 + 1); + x_66_phi = x_67; + x_69_phi = x_70; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_78 : vec4 = indexable[bitcast((x_66 % 16))]; + x_GLF_color = x_78; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..14cc0b58aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.hlsl @@ -0,0 +1,58 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int x_66 = 0; + int x_66_phi = 0; + int x_69_phi = 0; + const float4 x_52 = gl_FragCoord; + const float2 x_55 = asfloat(x_6[0].xy); + const float2 x_56 = (float2(x_52.x, x_52.y) / x_55); + const int x_64 = (int((x_56.x * 10.0f)) + (int((x_56.y * 10.0f)) * 10)); + x_66_phi = 100; + x_69_phi = 0; + while (true) { + int x_67 = 0; + int x_70 = 0; + x_66 = x_66_phi; + const int x_69 = x_69_phi; + if ((x_69 < x_64)) { + } else { + break; + } + { + x_67 = (((4 * asint(x_66)) * (1000 - asint(x_66))) / 1000); + x_70 = (x_69 + 1); + x_66_phi = x_67; + x_69_phi = x_70; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_78 = indexable[asint((x_66 % 16))]; + x_GLF_color = x_78; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.msl new file mode 100644 index 0000000000..f5bbeb84de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.msl @@ -0,0 +1,60 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int x_66 = 0; + int x_66_phi = 0; + int x_69_phi = 0; + float4 const x_52 = *(tint_symbol_6); + float2 const x_55 = x_6.resolution; + float2 const x_56 = (float2(x_52.x, x_52.y) / x_55); + int const x_64 = (int((x_56.x * 10.0f)) + (int((x_56.y * 10.0f)) * 10)); + x_66_phi = 100; + x_69_phi = 0; + while (true) { + int x_67 = 0; + int x_70 = 0; + x_66 = x_66_phi; + int const x_69 = x_69_phi; + if ((x_69 < x_64)) { + } else { + break; + } + { + x_67 = (((4 * as_type(x_66)) * (1000 - as_type(x_66))) / 1000); + x_70 = (x_69 + 1); + x_66_phi = x_67; + x_69_phi = x_70; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_78 = indexable.arr[as_type((x_66 % 16))]; + *(tint_symbol_7) = x_78; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..feaee7c200 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.spvasm @@ -0,0 +1,180 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 118 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_66 "x_66" + OpName %x_66_phi "x_66_phi" + OpName %x_69_phi "x_69_phi" + OpName %x_67 "x_67" + OpName %x_70 "x_70" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_10 = OpConstant %float 10 + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1000 = OpConstant %int 1000 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %81 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %83 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %84 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %85 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %86 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %87 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %88 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %89 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %90 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %91 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %92 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %93 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %94 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %95 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %96 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %97 = OpConstantComposite %_arr_v4float_uint_16 %81 %83 %84 %85 %86 %87 %88 %89 %81 %90 %91 %92 %93 %94 %95 %96 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %105 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_66 = OpVariable %_ptr_Function_int Function %28 + %x_66_phi = OpVariable %_ptr_Function_int Function %28 + %x_69_phi = OpVariable %_ptr_Function_int Function %28 + %x_67 = OpVariable %_ptr_Function_int Function %28 + %x_70 = OpVariable %_ptr_Function_int Function %28 + %31 = OpLoad %v4float %gl_FragCoord + %34 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %35 = OpLoad %v2float %34 + %36 = OpCompositeExtract %float %31 0 + %37 = OpCompositeExtract %float %31 1 + %38 = OpCompositeConstruct %v2float %36 %37 + %39 = OpFDiv %v2float %38 %35 + %41 = OpCompositeExtract %float %39 0 + %43 = OpFMul %float %41 %float_10 + %40 = OpConvertFToS %int %43 + %45 = OpCompositeExtract %float %39 1 + %46 = OpFMul %float %45 %float_10 + %44 = OpConvertFToS %int %46 + %48 = OpIMul %int %44 %int_10 + %49 = OpIAdd %int %40 %48 + OpStore %x_66_phi %int_100 + OpStore %x_69_phi %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %58 = OpLoad %int %x_66_phi + OpStore %x_66 %58 + %59 = OpLoad %int %x_69_phi + %60 = OpSLessThan %bool %59 %49 + OpSelectionMerge %62 None + OpBranchConditional %60 %63 %64 + %63 = OpLabel + OpBranch %62 + %64 = OpLabel + OpBranch %53 + %62 = OpLabel + OpBranch %54 + %54 = OpLabel + %67 = OpLoad %int %x_66 + %66 = OpCopyObject %int %67 + %68 = OpIMul %int %int_4 %66 + %71 = OpLoad %int %x_66 + %70 = OpCopyObject %int %71 + %72 = OpISub %int %int_1000 %70 + %73 = OpIMul %int %68 %72 + %74 = OpSDiv %int %73 %int_1000 + OpStore %x_67 %74 + %76 = OpIAdd %int %59 %int_1 + OpStore %x_70 %76 + %77 = OpLoad %int %x_67 + OpStore %x_66_phi %77 + %78 = OpLoad %int %x_70 + OpStore %x_69_phi %78 + OpBranch %52 + %53 = OpLabel + OpStore %indexable %97 + %99 = OpLoad %int %x_66 + %101 = OpSMod %int %99 %int_16 + %98 = OpCopyObject %int %101 + %103 = OpAccessChain %_ptr_Function_v4float %indexable %98 + %104 = OpLoad %v4float %103 + OpStore %x_GLF_color %104 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %105 +%tint_symbol_1 = OpFunctionParameter %main_out + %109 = OpLabel + %110 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %110 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %112 = OpLabel + %113 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %113 + %114 = OpFunctionCall %void %main_1 + %116 = OpLoad %v4float %x_GLF_color + %117 = OpCompositeConstruct %main_out %116 + %115 = OpFunctionCall %void %tint_symbol_3 %117 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..8d0080b490 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/0.wgsl.expected.wgsl @@ -0,0 +1,56 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_66 : i32; + var x_66_phi : i32; + var x_69_phi : i32; + let x_52 : vec4 = gl_FragCoord; + let x_55 : vec2 = x_6.resolution; + let x_56 : vec2 = (vec2(x_52.x, x_52.y) / x_55); + let x_64 : i32 = (i32((x_56.x * 10.0)) + (i32((x_56.y * 10.0)) * 10)); + x_66_phi = 100; + x_69_phi = 0; + loop { + var x_67 : i32; + var x_70 : i32; + x_66 = x_66_phi; + let x_69 : i32 = x_69_phi; + if ((x_69 < x_64)) { + } else { + break; + } + + continuing { + x_67 = (((4 * bitcast(x_66)) * (1000 - bitcast(x_66))) / 1000); + x_70 = (x_69 + 1); + x_66_phi = x_67; + x_69_phi = x_70; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_78 : vec4 = indexable[bitcast((x_66 % 16))]; + x_GLF_color = x_78; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm new file mode 100644 index 0000000000..1f2cac9ea4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm @@ -0,0 +1,110 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %indexable "indexable" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %uint = OpTypeInt 32 0 + %float_10 = OpConstant %float 10 + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1000 = OpConstant %int 1000 + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %33 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %36 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %37 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %38 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %39 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %40 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %41 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %42 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %46 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %47 = OpConstantComposite %_arr_v4float_uint_16 %31 %33 %34 %35 %36 %37 %38 %39 %31 %40 %41 %42 %43 %44 %45 %46 + %int_16 = OpConstant %int 16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %51 = OpConstantComposite %v2float %float_0 %float_0 +%float_0_5_0 = OpConstant %float 0.5 + %main = OpFunction %void None %9 + %53 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %54 = OpLoad %v4float %gl_FragCoord + %55 = OpVectorShuffle %v2float %54 %54 0 1 + %56 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %57 = OpCompositeConstruct %v4float %float_0 %55 %float_0_5_0 + %58 = OpLoad %v2float %56 + %59 = OpFDiv %v2float %55 %58 + %60 = OpCompositeExtract %float %59 0 + %61 = OpCompositeExtract %float %57 3 + %62 = OpCompositeConstruct %v4float %61 %float_10 %51 + %63 = OpCompositeExtract %float %62 1 + %64 = OpFMul %float %60 %63 + %65 = OpConvertFToS %int %64 + %66 = OpCompositeExtract %float %59 1 + %67 = OpFMul %float %66 %float_10 + %68 = OpConvertFToS %int %67 + %69 = OpIMul %int %68 %int_10 + %70 = OpIAdd %int %65 %69 + OpBranch %71 + %71 = OpLabel + %72 = OpPhi %int %int_100 %53 %73 %74 + %75 = OpPhi %int %int_0 %53 %76 %74 + %77 = OpSLessThan %bool %75 %70 + OpLoopMerge %78 %74 None + OpBranchConditional %77 %74 %78 + %74 = OpLabel + %79 = OpIMul %int %int_4 %72 + %80 = OpISub %int %int_1000 %72 + %81 = OpIMul %int %79 %80 + %73 = OpSDiv %int %81 %int_1000 + %76 = OpIAdd %int %75 %int_1 + OpBranch %71 + %78 = OpLabel + %82 = OpSMod %int %72 %int_16 + OpStore %indexable %47 + %83 = OpAccessChain %_ptr_Function_v4float %indexable %82 + %84 = OpLoad %v4float %83 + OpStore %_GLF_color %84 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..ca6080371a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.hlsl @@ -0,0 +1,59 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int x_72 = 0; + int x_72_phi = 0; + int x_75_phi = 0; + const float4 x_54 = gl_FragCoord; + const float2 x_55 = float2(x_54.x, x_54.y); + const float2 x_58 = asfloat(x_6[0].xy); + const float2 x_59 = (x_55 / x_58); + const int x_70 = (int((x_59.x * float4(float4(0.0f, x_55, 0.5f).w, 10.0f, float2(0.0f, 0.0f)).y)) + (int((x_59.y * 10.0f)) * 10)); + x_72_phi = 100; + x_75_phi = 0; + while (true) { + int x_73 = 0; + int x_76 = 0; + x_72 = x_72_phi; + const int x_75 = x_75_phi; + if ((x_75 < x_70)) { + } else { + break; + } + { + x_73 = (((4 * asint(x_72)) * (1000 - asint(x_72))) / 1000); + x_76 = (x_75 + 1); + x_72_phi = x_73; + x_75_phi = x_76; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_84 = indexable[asint((x_72 % 16))]; + x_GLF_color = x_84; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.msl new file mode 100644 index 0000000000..7c00279f15 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int x_72 = 0; + int x_72_phi = 0; + int x_75_phi = 0; + float4 const x_54 = *(tint_symbol_6); + float2 const x_55 = float2(x_54.x, x_54.y); + float2 const x_58 = x_6.resolution; + float2 const x_59 = (x_55 / x_58); + int const x_70 = (int((x_59.x * float4(float4(0.0f, x_55, 0.5f).w, 10.0f, float2(0.0f, 0.0f)).y)) + (int((x_59.y * 10.0f)) * 10)); + x_72_phi = 100; + x_75_phi = 0; + while (true) { + int x_73 = 0; + int x_76 = 0; + x_72 = x_72_phi; + int const x_75 = x_75_phi; + if ((x_75 < x_70)) { + } else { + break; + } + { + x_73 = (((4 * as_type(x_72)) * (1000 - as_type(x_72))) / 1000); + x_76 = (x_75 + 1); + x_72_phi = x_73; + x_75_phi = x_76; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_84 = indexable.arr[as_type((x_72 % 16))]; + *(tint_symbol_7) = x_84; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..f9920e1acc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.spvasm @@ -0,0 +1,189 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 127 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_72 "x_72" + OpName %x_72_phi "x_72_phi" + OpName %x_75_phi "x_75_phi" + OpName %x_73 "x_73" + OpName %x_76 "x_76" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_0 = OpConstant %float 0 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %49 = OpConstantComposite %v2float %float_0 %float_0 + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1000 = OpConstant %int 1000 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %91 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %92 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %93 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %94 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %95 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %96 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %97 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %98 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %99 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %100 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %101 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %102 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %103 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %104 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %105 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %106 = OpConstantComposite %_arr_v4float_uint_16 %91 %92 %93 %94 %95 %96 %97 %98 %91 %99 %100 %101 %102 %103 %104 %105 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %114 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_72 = OpVariable %_ptr_Function_int Function %28 + %x_72_phi = OpVariable %_ptr_Function_int Function %28 + %x_75_phi = OpVariable %_ptr_Function_int Function %28 + %x_73 = OpVariable %_ptr_Function_int Function %28 + %x_76 = OpVariable %_ptr_Function_int Function %28 + %31 = OpLoad %v4float %gl_FragCoord + %32 = OpCompositeExtract %float %31 0 + %33 = OpCompositeExtract %float %31 1 + %34 = OpCompositeConstruct %v2float %32 %33 + %37 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %38 = OpLoad %v2float %37 + %39 = OpFDiv %v2float %34 %38 + %41 = OpCompositeExtract %float %39 0 + %43 = OpCompositeExtract %float %34 0 + %44 = OpCompositeExtract %float %34 1 + %46 = OpCompositeConstruct %v4float %float_0 %43 %44 %float_0_5 + %47 = OpCompositeExtract %float %46 3 + %50 = OpCompositeExtract %float %49 0 + %51 = OpCompositeExtract %float %49 1 + %52 = OpCompositeConstruct %v4float %47 %float_10 %50 %51 + %53 = OpCompositeExtract %float %52 1 + %54 = OpFMul %float %41 %53 + %40 = OpConvertFToS %int %54 + %56 = OpCompositeExtract %float %39 1 + %57 = OpFMul %float %56 %float_10 + %55 = OpConvertFToS %int %57 + %59 = OpIMul %int %55 %int_10 + %60 = OpIAdd %int %40 %59 + OpStore %x_72_phi %int_100 + OpStore %x_75_phi %int_0 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %69 = OpLoad %int %x_72_phi + OpStore %x_72 %69 + %70 = OpLoad %int %x_75_phi + %71 = OpSLessThan %bool %70 %60 + OpSelectionMerge %73 None + OpBranchConditional %71 %74 %75 + %74 = OpLabel + OpBranch %73 + %75 = OpLabel + OpBranch %64 + %73 = OpLabel + OpBranch %65 + %65 = OpLabel + %78 = OpLoad %int %x_72 + %77 = OpCopyObject %int %78 + %79 = OpIMul %int %int_4 %77 + %82 = OpLoad %int %x_72 + %81 = OpCopyObject %int %82 + %83 = OpISub %int %int_1000 %81 + %84 = OpIMul %int %79 %83 + %85 = OpSDiv %int %84 %int_1000 + OpStore %x_73 %85 + %87 = OpIAdd %int %70 %int_1 + OpStore %x_76 %87 + %88 = OpLoad %int %x_73 + OpStore %x_72_phi %88 + %89 = OpLoad %int %x_76 + OpStore %x_75_phi %89 + OpBranch %63 + %64 = OpLabel + OpStore %indexable %106 + %108 = OpLoad %int %x_72 + %110 = OpSMod %int %108 %int_16 + %107 = OpCopyObject %int %110 + %112 = OpAccessChain %_ptr_Function_v4float %indexable %107 + %113 = OpLoad %v4float %112 + OpStore %x_GLF_color %113 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %114 +%tint_symbol_1 = OpFunctionParameter %main_out + %118 = OpLabel + %119 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %119 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %121 = OpLabel + %122 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %122 + %123 = OpFunctionCall %void %main_1 + %125 = OpLoad %v4float %x_GLF_color + %126 = OpCompositeConstruct %main_out %125 + %124 = OpFunctionCall %void %tint_symbol_3 %126 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..daa49734a8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.spvasm.expected.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_72 : i32; + var x_72_phi : i32; + var x_75_phi : i32; + let x_54 : vec4 = gl_FragCoord; + let x_55 : vec2 = vec2(x_54.x, x_54.y); + let x_58 : vec2 = x_6.resolution; + let x_59 : vec2 = (x_55 / x_58); + let x_70 : i32 = (i32((x_59.x * vec4(vec4(0.0, x_55, 0.5).w, 10.0, vec2(0.0, 0.0)).y)) + (i32((x_59.y * 10.0)) * 10)); + x_72_phi = 100; + x_75_phi = 0; + loop { + var x_73 : i32; + var x_76 : i32; + x_72 = x_72_phi; + let x_75 : i32 = x_75_phi; + if ((x_75 < x_70)) { + } else { + break; + } + + continuing { + x_73 = (((4 * bitcast(x_72)) * (1000 - bitcast(x_72))) / 1000); + x_76 = (x_75 + 1); + x_72_phi = x_73; + x_75_phi = x_76; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_84 : vec4 = indexable[bitcast((x_72 % 16))]; + x_GLF_color = x_84; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl new file mode 100644 index 0000000000..daa49734a8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_72 : i32; + var x_72_phi : i32; + var x_75_phi : i32; + let x_54 : vec4 = gl_FragCoord; + let x_55 : vec2 = vec2(x_54.x, x_54.y); + let x_58 : vec2 = x_6.resolution; + let x_59 : vec2 = (x_55 / x_58); + let x_70 : i32 = (i32((x_59.x * vec4(vec4(0.0, x_55, 0.5).w, 10.0, vec2(0.0, 0.0)).y)) + (i32((x_59.y * 10.0)) * 10)); + x_72_phi = 100; + x_75_phi = 0; + loop { + var x_73 : i32; + var x_76 : i32; + x_72 = x_72_phi; + let x_75 : i32 = x_75_phi; + if ((x_75 < x_70)) { + } else { + break; + } + + continuing { + x_73 = (((4 * bitcast(x_72)) * (1000 - bitcast(x_72))) / 1000); + x_76 = (x_75 + 1); + x_72_phi = x_73; + x_75_phi = x_76; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_84 : vec4 = indexable[bitcast((x_72 % 16))]; + x_GLF_color = x_84; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..ca6080371a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.hlsl @@ -0,0 +1,59 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int x_72 = 0; + int x_72_phi = 0; + int x_75_phi = 0; + const float4 x_54 = gl_FragCoord; + const float2 x_55 = float2(x_54.x, x_54.y); + const float2 x_58 = asfloat(x_6[0].xy); + const float2 x_59 = (x_55 / x_58); + const int x_70 = (int((x_59.x * float4(float4(0.0f, x_55, 0.5f).w, 10.0f, float2(0.0f, 0.0f)).y)) + (int((x_59.y * 10.0f)) * 10)); + x_72_phi = 100; + x_75_phi = 0; + while (true) { + int x_73 = 0; + int x_76 = 0; + x_72 = x_72_phi; + const int x_75 = x_75_phi; + if ((x_75 < x_70)) { + } else { + break; + } + { + x_73 = (((4 * asint(x_72)) * (1000 - asint(x_72))) / 1000); + x_76 = (x_75 + 1); + x_72_phi = x_73; + x_75_phi = x_76; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_84 = indexable[asint((x_72 % 16))]; + x_GLF_color = x_84; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.msl new file mode 100644 index 0000000000..7c00279f15 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int x_72 = 0; + int x_72_phi = 0; + int x_75_phi = 0; + float4 const x_54 = *(tint_symbol_6); + float2 const x_55 = float2(x_54.x, x_54.y); + float2 const x_58 = x_6.resolution; + float2 const x_59 = (x_55 / x_58); + int const x_70 = (int((x_59.x * float4(float4(0.0f, x_55, 0.5f).w, 10.0f, float2(0.0f, 0.0f)).y)) + (int((x_59.y * 10.0f)) * 10)); + x_72_phi = 100; + x_75_phi = 0; + while (true) { + int x_73 = 0; + int x_76 = 0; + x_72 = x_72_phi; + int const x_75 = x_75_phi; + if ((x_75 < x_70)) { + } else { + break; + } + { + x_73 = (((4 * as_type(x_72)) * (1000 - as_type(x_72))) / 1000); + x_76 = (x_75 + 1); + x_72_phi = x_73; + x_75_phi = x_76; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_84 = indexable.arr[as_type((x_72 % 16))]; + *(tint_symbol_7) = x_84; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..f9920e1acc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.spvasm @@ -0,0 +1,189 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 127 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_72 "x_72" + OpName %x_72_phi "x_72_phi" + OpName %x_75_phi "x_75_phi" + OpName %x_73 "x_73" + OpName %x_76 "x_76" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_0 = OpConstant %float 0 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %49 = OpConstantComposite %v2float %float_0 %float_0 + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1000 = OpConstant %int 1000 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %91 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %92 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %93 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %94 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %95 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %96 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %97 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %98 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %99 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %100 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %101 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %102 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %103 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %104 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %105 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %106 = OpConstantComposite %_arr_v4float_uint_16 %91 %92 %93 %94 %95 %96 %97 %98 %91 %99 %100 %101 %102 %103 %104 %105 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %114 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_72 = OpVariable %_ptr_Function_int Function %28 + %x_72_phi = OpVariable %_ptr_Function_int Function %28 + %x_75_phi = OpVariable %_ptr_Function_int Function %28 + %x_73 = OpVariable %_ptr_Function_int Function %28 + %x_76 = OpVariable %_ptr_Function_int Function %28 + %31 = OpLoad %v4float %gl_FragCoord + %32 = OpCompositeExtract %float %31 0 + %33 = OpCompositeExtract %float %31 1 + %34 = OpCompositeConstruct %v2float %32 %33 + %37 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %38 = OpLoad %v2float %37 + %39 = OpFDiv %v2float %34 %38 + %41 = OpCompositeExtract %float %39 0 + %43 = OpCompositeExtract %float %34 0 + %44 = OpCompositeExtract %float %34 1 + %46 = OpCompositeConstruct %v4float %float_0 %43 %44 %float_0_5 + %47 = OpCompositeExtract %float %46 3 + %50 = OpCompositeExtract %float %49 0 + %51 = OpCompositeExtract %float %49 1 + %52 = OpCompositeConstruct %v4float %47 %float_10 %50 %51 + %53 = OpCompositeExtract %float %52 1 + %54 = OpFMul %float %41 %53 + %40 = OpConvertFToS %int %54 + %56 = OpCompositeExtract %float %39 1 + %57 = OpFMul %float %56 %float_10 + %55 = OpConvertFToS %int %57 + %59 = OpIMul %int %55 %int_10 + %60 = OpIAdd %int %40 %59 + OpStore %x_72_phi %int_100 + OpStore %x_75_phi %int_0 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %69 = OpLoad %int %x_72_phi + OpStore %x_72 %69 + %70 = OpLoad %int %x_75_phi + %71 = OpSLessThan %bool %70 %60 + OpSelectionMerge %73 None + OpBranchConditional %71 %74 %75 + %74 = OpLabel + OpBranch %73 + %75 = OpLabel + OpBranch %64 + %73 = OpLabel + OpBranch %65 + %65 = OpLabel + %78 = OpLoad %int %x_72 + %77 = OpCopyObject %int %78 + %79 = OpIMul %int %int_4 %77 + %82 = OpLoad %int %x_72 + %81 = OpCopyObject %int %82 + %83 = OpISub %int %int_1000 %81 + %84 = OpIMul %int %79 %83 + %85 = OpSDiv %int %84 %int_1000 + OpStore %x_73 %85 + %87 = OpIAdd %int %70 %int_1 + OpStore %x_76 %87 + %88 = OpLoad %int %x_73 + OpStore %x_72_phi %88 + %89 = OpLoad %int %x_76 + OpStore %x_75_phi %89 + OpBranch %63 + %64 = OpLabel + OpStore %indexable %106 + %108 = OpLoad %int %x_72 + %110 = OpSMod %int %108 %int_16 + %107 = OpCopyObject %int %110 + %112 = OpAccessChain %_ptr_Function_v4float %indexable %107 + %113 = OpLoad %v4float %112 + OpStore %x_GLF_color %113 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %114 +%tint_symbol_1 = OpFunctionParameter %main_out + %118 = OpLabel + %119 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %119 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %121 = OpLabel + %122 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %122 + %123 = OpFunctionCall %void %main_1 + %125 = OpLoad %v4float %x_GLF_color + %126 = OpCompositeConstruct %main_out %125 + %124 = OpFunctionCall %void %tint_symbol_3 %126 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..daa49734a8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composite2/1.wgsl.expected.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_72 : i32; + var x_72_phi : i32; + var x_75_phi : i32; + let x_54 : vec4 = gl_FragCoord; + let x_55 : vec2 = vec2(x_54.x, x_54.y); + let x_58 : vec2 = x_6.resolution; + let x_59 : vec2 = (x_55 / x_58); + let x_70 : i32 = (i32((x_59.x * vec4(vec4(0.0, x_55, 0.5).w, 10.0, vec2(0.0, 0.0)).y)) + (i32((x_59.y * 10.0)) * 10)); + x_72_phi = 100; + x_75_phi = 0; + loop { + var x_73 : i32; + var x_76 : i32; + x_72 = x_72_phi; + let x_75 : i32 = x_75_phi; + if ((x_75 < x_70)) { + } else { + break; + } + + continuing { + x_73 = (((4 * bitcast(x_72)) * (1000 - bitcast(x_72))) / 1000); + x_76 = (x_75 + 1); + x_72_phi = x_73; + x_75_phi = x_76; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_84 : vec4 = indexable[bitcast((x_72 % 16))]; + x_GLF_color = x_84; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm new file mode 100644 index 0000000000..b87985b216 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm @@ -0,0 +1,285 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %177 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %float_15 = OpConstant %float 15 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %183 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %192 = OpUndef %v4float +%float_0_0666666701 = OpConstant %float 0.0666666701 + %main = OpFunction %void None %8 + %194 = OpLabel + %195 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %196 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %197 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %198 = OpLoad %v4float %gl_FragCoord + %199 = OpVectorShuffle %v2float %198 %198 0 1 + %200 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %201 = OpLoad %v2float %200 + %202 = OpFDiv %v2float %199 %201 + %203 = OpCompositeExtract %float %202 0 + %204 = OpFMul %float %203 %float_256 + %205 = OpConvertFToS %int %204 + %206 = OpCompositeExtract %float %202 1 + %207 = OpFMul %float %206 %float_256 + %208 = OpConvertFToS %int %207 + %209 = OpCompositeConstruct %v2int %205 %208 + OpSelectionMerge %210 None + OpSwitch %uint_0 %211 + %211 = OpLabel + OpBranch %212 + %212 = OpLabel + %213 = OpPhi %v2int %209 %211 %214 %215 + %216 = OpCompositeExtract %int %213 1 + %217 = OpINotEqual %bool %216 %int_256 + OpLoopMerge %218 %215 None + OpBranchConditional %217 %219 %218 + %219 = OpLabel + %220 = OpCompositeExtract %int %213 0 + OpStore %195 %177 + %221 = OpAccessChain %_ptr_Function_int %195 %216 + %222 = OpLoad %int %221 + %223 = OpIAdd %int %222 %int_15 + %224 = OpSLessThan %bool %220 %223 + OpSelectionMerge %225 None + OpBranchConditional %224 %226 %225 + %226 = OpLabel + OpStore %196 %177 + %227 = OpAccessChain %_ptr_Function_int %196 %216 + %228 = OpLoad %int %227 + %229 = OpISub %int %228 %int_15 + %230 = OpSGreaterThan %bool %220 %229 + OpBranch %225 + %225 = OpLabel + %231 = OpPhi %bool %224 %219 %230 %226 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %232 + %233 = OpLabel + OpStore %197 %177 + %234 = OpAccessChain %_ptr_Function_int %197 %216 + %235 = OpLoad %int %234 + %236 = OpISub %int %220 %235 + %237 = OpConvertSToF %float %236 + %238 = OpExtInst %float %1 FAbs %237 + %239 = OpFSub %float %float_15 %238 + %240 = OpFMul %float %239 %float_0_0666666701 + %241 = OpCompositeConstruct %v4float %240 %240 %240 %float_1 + OpBranch %218 + %232 = OpLabel + %242 = OpIAdd %int %216 %int_1 + %214 = OpCompositeInsert %v2int %242 %213 1 + OpBranch %215 + %215 = OpLabel + OpBranch %212 + %218 = OpLabel + %243 = OpPhi %v4float %192 %212 %241 %233 + %244 = OpPhi %bool %false %212 %true %233 + OpSelectionMerge %245 None + OpBranchConditional %244 %210 %245 + %245 = OpLabel + OpBranch %210 + %210 = OpLabel + %246 = OpPhi %v4float %243 %218 %183 %245 + OpStore %_GLF_color %246 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..cd5825d506 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.hlsl @@ -0,0 +1,97 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_195[256] = (int[256])0; + int x_196[256] = (int[256])0; + int x_197[256] = (int[256])0; + int2 x_209 = int2(0, 0); + float4 x_241 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_243 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int2 x_213_phi = int2(0, 0); + float4 x_243_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_244_phi = false; + float4 x_246_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float4 x_198 = gl_FragCoord; + const float2 x_201 = asfloat(x_6[0].xy); + const float2 x_202 = (float2(x_198.x, x_198.y) / x_201); + x_209 = int2(int((x_202.x * 256.0f)), int((x_202.y * 256.0f))); + switch(0u) { + default: { + x_213_phi = x_209; + while (true) { + bool x_230 = false; + bool x_231_phi = false; + const int2 x_213 = x_213_phi; + const int x_216 = x_213.y; + x_243_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_244_phi = false; + if ((x_216 != 256)) { + } else { + break; + } + const int x_220 = x_213.x; + const int tint_symbol_5[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_195 = tint_symbol_5; + const int x_222 = x_195[x_216]; + const bool x_224 = (x_220 < (x_222 + 15)); + x_231_phi = x_224; + if (x_224) { + const int tint_symbol_6[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_196 = tint_symbol_6; + const int x_228 = x_196[x_216]; + x_230 = (x_220 > (x_228 - 15)); + x_231_phi = x_230; + } + if (x_231_phi) { + const int tint_symbol_7[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_197 = tint_symbol_7; + const int x_235 = x_197[x_216]; + const float x_240 = ((15.0f - abs(float((x_220 - x_235)))) * 0.06666667f); + x_241 = float4(x_240, x_240, x_240, 1.0f); + x_243_phi = x_241; + x_244_phi = true; + break; + } + int2 x_214_1 = x_213; + x_214_1.y = (x_216 + 1); + const int2 x_214 = x_214_1; + { + x_213_phi = x_214; + } + } + x_243 = x_243_phi; + const bool x_244 = x_244_phi; + x_246_phi = x_243; + if (x_244) { + break; + } + x_246_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + x_GLF_color = x_246_phi; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.msl new file mode 100644 index 0000000000..4c8e61355e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.msl @@ -0,0 +1,101 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) { + tint_array_wrapper x_195 = {}; + tint_array_wrapper x_196 = {}; + tint_array_wrapper x_197 = {}; + int2 x_209 = 0; + float4 x_241 = 0.0f; + float4 x_243 = 0.0f; + int2 x_213_phi = 0; + float4 x_243_phi = 0.0f; + bool x_244_phi = false; + float4 x_246_phi = 0.0f; + float4 const x_198 = *(tint_symbol_8); + float2 const x_201 = x_6.resolution; + float2 const x_202 = (float2(x_198.x, x_198.y) / x_201); + x_209 = int2(int((x_202.x * 256.0f)), int((x_202.y * 256.0f))); + switch(0u) { + default: { + x_213_phi = x_209; + while (true) { + bool x_230 = false; + bool x_231_phi = false; + int2 const x_213 = x_213_phi; + int const x_216 = x_213.y; + x_243_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_244_phi = false; + if ((x_216 != 256)) { + } else { + break; + } + int const x_220 = x_213.x; + tint_array_wrapper const tint_symbol_4 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_195 = tint_symbol_4; + int const x_222 = x_195.arr[x_216]; + bool const x_224 = (x_220 < (x_222 + 15)); + x_231_phi = x_224; + if (x_224) { + tint_array_wrapper const tint_symbol_5 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_196 = tint_symbol_5; + int const x_228 = x_196.arr[x_216]; + x_230 = (x_220 > (x_228 - 15)); + x_231_phi = x_230; + } + bool const x_231 = x_231_phi; + if (x_231) { + tint_array_wrapper const tint_symbol_6 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_197 = tint_symbol_6; + int const x_235 = x_197.arr[x_216]; + float const x_240 = ((15.0f - fabs(float((x_220 - x_235)))) * 0.06666667f); + x_241 = float4(x_240, x_240, x_240, 1.0f); + x_243_phi = x_241; + x_244_phi = true; + break; + } + int2 x_214_1 = x_213; + x_214_1.y = (x_216 + 1); + int2 const x_214 = x_214_1; + { + x_213_phi = x_214; + } + } + x_243 = x_243_phi; + bool const x_244 = x_244_phi; + x_246_phi = x_243; + if (x_244) { + break; + } + x_246_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + float4 const x_246 = x_246_phi; + *(tint_symbol_9) = x_246; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_11}; + tint_symbol_2 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..4a43cab9d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.spvasm @@ -0,0 +1,384 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 292 +; Schema: 0 + OpCapability Shader + %256 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_195 "x_195" + OpName %x_196 "x_196" + OpName %x_197 "x_197" + OpName %x_209 "x_209" + OpName %x_241 "x_241" + OpName %x_243 "x_243" + OpName %x_213_phi "x_213_phi" + OpName %x_243_phi "x_243_phi" + OpName %x_244_phi "x_244_phi" + OpName %x_246_phi "x_246_phi" + OpName %x_230 "x_230" + OpName %x_231_phi "x_231_phi" + OpName %x_214_1 "x_214_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %25 = OpConstantNull %_arr_int_uint_256 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %31 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 + %float_0 = OpConstant %float 0 + %71 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %int_256 = OpConstant %int 256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %236 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 +%_ptr_Function_int = OpTypePointer Function %int + %float_15 = OpConstant %float 15 +%float_0_0666666701 = OpConstant %float 0.0666666701 + %float_1 = OpConstant %float 1 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %277 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %279 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_195 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_196 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_197 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_209 = OpVariable %_ptr_Function_v2int Function %31 + %x_241 = OpVariable %_ptr_Function_v4float Function %5 + %x_243 = OpVariable %_ptr_Function_v4float Function %5 + %x_213_phi = OpVariable %_ptr_Function_v2int Function %31 + %x_243_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_244_phi = OpVariable %_ptr_Function_bool Function %40 + %x_246_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_230 = OpVariable %_ptr_Function_bool Function %40 + %x_231_phi = OpVariable %_ptr_Function_bool Function %40 + %x_214_1 = OpVariable %_ptr_Function_v2int Function %31 + %42 = OpLoad %v4float %gl_FragCoord + %45 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %46 = OpLoad %v2float %45 + %47 = OpCompositeExtract %float %42 0 + %48 = OpCompositeExtract %float %42 1 + %49 = OpCompositeConstruct %v2float %47 %48 + %50 = OpFDiv %v2float %49 %46 + %52 = OpCompositeExtract %float %50 0 + %54 = OpFMul %float %52 %float_256 + %51 = OpConvertFToS %int %54 + %56 = OpCompositeExtract %float %50 1 + %57 = OpFMul %float %56 %float_256 + %55 = OpConvertFToS %int %57 + %58 = OpCompositeConstruct %v2int %51 %55 + OpStore %x_209 %58 + OpSelectionMerge %59 None + OpSwitch %uint_0 %60 + %60 = OpLabel + %61 = OpLoad %v2int %x_209 + OpStore %x_213_phi %61 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %68 = OpLoad %v2int %x_213_phi + %69 = OpCompositeExtract %int %68 1 + OpStore %x_243_phi %71 + OpStore %x_244_phi %false + %74 = OpINotEqual %bool %69 %int_256 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpBranch %75 + %77 = OpLabel + OpBranch %63 + %75 = OpLabel + %78 = OpCompositeExtract %int %68 0 + OpStore %x_195 %236 + %238 = OpAccessChain %_ptr_Function_int %x_195 %69 + %239 = OpLoad %int %238 + %240 = OpIAdd %int %239 %int_15 + %241 = OpSLessThan %bool %78 %240 + OpStore %x_231_phi %241 + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %242 + %243 = OpLabel + OpStore %x_196 %236 + %244 = OpAccessChain %_ptr_Function_int %x_196 %69 + %245 = OpLoad %int %244 + %246 = OpISub %int %245 %int_15 + %247 = OpSGreaterThan %bool %78 %246 + OpStore %x_230 %247 + %248 = OpLoad %bool %x_230 + OpStore %x_231_phi %248 + OpBranch %242 + %242 = OpLabel + %249 = OpLoad %bool %x_231_phi + OpSelectionMerge %250 None + OpBranchConditional %249 %251 %250 + %251 = OpLabel + OpStore %x_197 %236 + %252 = OpAccessChain %_ptr_Function_int %x_197 %69 + %253 = OpLoad %int %252 + %258 = OpISub %int %78 %253 + %257 = OpConvertSToF %float %258 + %255 = OpExtInst %float %256 FAbs %257 + %259 = OpFSub %float %float_15 %255 + %261 = OpFMul %float %259 %float_0_0666666701 + %263 = OpCompositeConstruct %v4float %261 %261 %261 %float_1 + OpStore %x_241 %263 + %264 = OpLoad %v4float %x_241 + OpStore %x_243_phi %264 + OpStore %x_244_phi %true + OpBranch %63 + %250 = OpLabel + OpStore %x_214_1 %68 + %268 = OpAccessChain %_ptr_Function_int %x_214_1 %uint_1 + %270 = OpIAdd %int %69 %int_1 + OpStore %268 %270 + %271 = OpLoad %v2int %x_214_1 + OpBranch %64 + %64 = OpLabel + OpStore %x_213_phi %271 + OpBranch %62 + %63 = OpLabel + %272 = OpLoad %v4float %x_243_phi + OpStore %x_243 %272 + %273 = OpLoad %bool %x_244_phi + %274 = OpLoad %v4float %x_243 + OpStore %x_246_phi %274 + OpSelectionMerge %275 None + OpBranchConditional %273 %276 %275 + %276 = OpLabel + OpBranch %59 + %275 = OpLabel + OpStore %x_246_phi %277 + OpBranch %59 + %59 = OpLabel + %278 = OpLoad %v4float %x_246_phi + OpStore %x_GLF_color %278 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %279 +%tint_symbol_1 = OpFunctionParameter %main_out + %283 = OpLabel + %284 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %284 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %286 = OpLabel + %287 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %287 + %288 = OpFunctionCall %void %main_1 + %290 = OpLoad %v4float %x_GLF_color + %291 = OpCompositeConstruct %main_out %290 + %289 = OpFunctionCall %void %tint_symbol_3 %291 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..bdc7096473 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.spvasm.expected.wgsl @@ -0,0 +1,94 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_195 : array; + var x_196 : array; + var x_197 : array; + var x_209 : vec2; + var x_241 : vec4; + var x_243 : vec4; + var x_213_phi : vec2; + var x_243_phi : vec4; + var x_244_phi : bool; + var x_246_phi : vec4; + let x_198 : vec4 = gl_FragCoord; + let x_201 : vec2 = x_6.resolution; + let x_202 : vec2 = (vec2(x_198.x, x_198.y) / x_201); + x_209 = vec2(i32((x_202.x * 256.0)), i32((x_202.y * 256.0))); + switch(0u) { + default: { + x_213_phi = x_209; + loop { + var x_230 : bool; + var x_231_phi : bool; + let x_213 : vec2 = x_213_phi; + let x_216 : i32 = x_213.y; + x_243_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_244_phi = false; + if ((x_216 != 256)) { + } else { + break; + } + let x_220 : i32 = x_213.x; + x_195 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_222 : i32 = x_195[x_216]; + let x_224 : bool = (x_220 < (x_222 + 15)); + x_231_phi = x_224; + if (x_224) { + x_196 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_228 : i32 = x_196[x_216]; + x_230 = (x_220 > (x_228 - 15)); + x_231_phi = x_230; + } + let x_231 : bool = x_231_phi; + if (x_231) { + x_197 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_235 : i32 = x_197[x_216]; + let x_240 : f32 = ((15.0 - abs(f32((x_220 - x_235)))) * 0.06666667); + x_241 = vec4(x_240, x_240, x_240, 1.0); + x_243_phi = x_241; + x_244_phi = true; + break; + } + var x_214_1 : vec2 = x_213; + x_214_1.y = (x_216 + 1); + let x_214 : vec2 = x_214_1; + + continuing { + x_213_phi = x_214; + } + } + x_243 = x_243_phi; + let x_244 : bool = x_244_phi; + x_246_phi = x_243; + if (x_244) { + break; + } + x_246_phi = vec4(0.0, 0.0, 0.0, 1.0); + } + } + let x_246 : vec4 = x_246_phi; + x_GLF_color = x_246; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl new file mode 100644 index 0000000000..bdc7096473 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl @@ -0,0 +1,94 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_195 : array; + var x_196 : array; + var x_197 : array; + var x_209 : vec2; + var x_241 : vec4; + var x_243 : vec4; + var x_213_phi : vec2; + var x_243_phi : vec4; + var x_244_phi : bool; + var x_246_phi : vec4; + let x_198 : vec4 = gl_FragCoord; + let x_201 : vec2 = x_6.resolution; + let x_202 : vec2 = (vec2(x_198.x, x_198.y) / x_201); + x_209 = vec2(i32((x_202.x * 256.0)), i32((x_202.y * 256.0))); + switch(0u) { + default: { + x_213_phi = x_209; + loop { + var x_230 : bool; + var x_231_phi : bool; + let x_213 : vec2 = x_213_phi; + let x_216 : i32 = x_213.y; + x_243_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_244_phi = false; + if ((x_216 != 256)) { + } else { + break; + } + let x_220 : i32 = x_213.x; + x_195 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_222 : i32 = x_195[x_216]; + let x_224 : bool = (x_220 < (x_222 + 15)); + x_231_phi = x_224; + if (x_224) { + x_196 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_228 : i32 = x_196[x_216]; + x_230 = (x_220 > (x_228 - 15)); + x_231_phi = x_230; + } + let x_231 : bool = x_231_phi; + if (x_231) { + x_197 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_235 : i32 = x_197[x_216]; + let x_240 : f32 = ((15.0 - abs(f32((x_220 - x_235)))) * 0.06666667); + x_241 = vec4(x_240, x_240, x_240, 1.0); + x_243_phi = x_241; + x_244_phi = true; + break; + } + var x_214_1 : vec2 = x_213; + x_214_1.y = (x_216 + 1); + let x_214 : vec2 = x_214_1; + + continuing { + x_213_phi = x_214; + } + } + x_243 = x_243_phi; + let x_244 : bool = x_244_phi; + x_246_phi = x_243; + if (x_244) { + break; + } + x_246_phi = vec4(0.0, 0.0, 0.0, 1.0); + } + } + let x_246 : vec4 = x_246_phi; + x_GLF_color = x_246; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..cd5825d506 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.hlsl @@ -0,0 +1,97 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_195[256] = (int[256])0; + int x_196[256] = (int[256])0; + int x_197[256] = (int[256])0; + int2 x_209 = int2(0, 0); + float4 x_241 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_243 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int2 x_213_phi = int2(0, 0); + float4 x_243_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_244_phi = false; + float4 x_246_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float4 x_198 = gl_FragCoord; + const float2 x_201 = asfloat(x_6[0].xy); + const float2 x_202 = (float2(x_198.x, x_198.y) / x_201); + x_209 = int2(int((x_202.x * 256.0f)), int((x_202.y * 256.0f))); + switch(0u) { + default: { + x_213_phi = x_209; + while (true) { + bool x_230 = false; + bool x_231_phi = false; + const int2 x_213 = x_213_phi; + const int x_216 = x_213.y; + x_243_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_244_phi = false; + if ((x_216 != 256)) { + } else { + break; + } + const int x_220 = x_213.x; + const int tint_symbol_5[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_195 = tint_symbol_5; + const int x_222 = x_195[x_216]; + const bool x_224 = (x_220 < (x_222 + 15)); + x_231_phi = x_224; + if (x_224) { + const int tint_symbol_6[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_196 = tint_symbol_6; + const int x_228 = x_196[x_216]; + x_230 = (x_220 > (x_228 - 15)); + x_231_phi = x_230; + } + if (x_231_phi) { + const int tint_symbol_7[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_197 = tint_symbol_7; + const int x_235 = x_197[x_216]; + const float x_240 = ((15.0f - abs(float((x_220 - x_235)))) * 0.06666667f); + x_241 = float4(x_240, x_240, x_240, 1.0f); + x_243_phi = x_241; + x_244_phi = true; + break; + } + int2 x_214_1 = x_213; + x_214_1.y = (x_216 + 1); + const int2 x_214 = x_214_1; + { + x_213_phi = x_214; + } + } + x_243 = x_243_phi; + const bool x_244 = x_244_phi; + x_246_phi = x_243; + if (x_244) { + break; + } + x_246_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + x_GLF_color = x_246_phi; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.msl new file mode 100644 index 0000000000..4c8e61355e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.msl @@ -0,0 +1,101 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) { + tint_array_wrapper x_195 = {}; + tint_array_wrapper x_196 = {}; + tint_array_wrapper x_197 = {}; + int2 x_209 = 0; + float4 x_241 = 0.0f; + float4 x_243 = 0.0f; + int2 x_213_phi = 0; + float4 x_243_phi = 0.0f; + bool x_244_phi = false; + float4 x_246_phi = 0.0f; + float4 const x_198 = *(tint_symbol_8); + float2 const x_201 = x_6.resolution; + float2 const x_202 = (float2(x_198.x, x_198.y) / x_201); + x_209 = int2(int((x_202.x * 256.0f)), int((x_202.y * 256.0f))); + switch(0u) { + default: { + x_213_phi = x_209; + while (true) { + bool x_230 = false; + bool x_231_phi = false; + int2 const x_213 = x_213_phi; + int const x_216 = x_213.y; + x_243_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_244_phi = false; + if ((x_216 != 256)) { + } else { + break; + } + int const x_220 = x_213.x; + tint_array_wrapper const tint_symbol_4 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_195 = tint_symbol_4; + int const x_222 = x_195.arr[x_216]; + bool const x_224 = (x_220 < (x_222 + 15)); + x_231_phi = x_224; + if (x_224) { + tint_array_wrapper const tint_symbol_5 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_196 = tint_symbol_5; + int const x_228 = x_196.arr[x_216]; + x_230 = (x_220 > (x_228 - 15)); + x_231_phi = x_230; + } + bool const x_231 = x_231_phi; + if (x_231) { + tint_array_wrapper const tint_symbol_6 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_197 = tint_symbol_6; + int const x_235 = x_197.arr[x_216]; + float const x_240 = ((15.0f - fabs(float((x_220 - x_235)))) * 0.06666667f); + x_241 = float4(x_240, x_240, x_240, 1.0f); + x_243_phi = x_241; + x_244_phi = true; + break; + } + int2 x_214_1 = x_213; + x_214_1.y = (x_216 + 1); + int2 const x_214 = x_214_1; + { + x_213_phi = x_214; + } + } + x_243 = x_243_phi; + bool const x_244 = x_244_phi; + x_246_phi = x_243; + if (x_244) { + break; + } + x_246_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + float4 const x_246 = x_246_phi; + *(tint_symbol_9) = x_246; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_11}; + tint_symbol_2 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..4a43cab9d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.spvasm @@ -0,0 +1,384 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 292 +; Schema: 0 + OpCapability Shader + %256 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_195 "x_195" + OpName %x_196 "x_196" + OpName %x_197 "x_197" + OpName %x_209 "x_209" + OpName %x_241 "x_241" + OpName %x_243 "x_243" + OpName %x_213_phi "x_213_phi" + OpName %x_243_phi "x_243_phi" + OpName %x_244_phi "x_244_phi" + OpName %x_246_phi "x_246_phi" + OpName %x_230 "x_230" + OpName %x_231_phi "x_231_phi" + OpName %x_214_1 "x_214_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %25 = OpConstantNull %_arr_int_uint_256 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %31 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 + %float_0 = OpConstant %float 0 + %71 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %int_256 = OpConstant %int 256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %236 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 +%_ptr_Function_int = OpTypePointer Function %int + %float_15 = OpConstant %float 15 +%float_0_0666666701 = OpConstant %float 0.0666666701 + %float_1 = OpConstant %float 1 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %277 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %279 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_195 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_196 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_197 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_209 = OpVariable %_ptr_Function_v2int Function %31 + %x_241 = OpVariable %_ptr_Function_v4float Function %5 + %x_243 = OpVariable %_ptr_Function_v4float Function %5 + %x_213_phi = OpVariable %_ptr_Function_v2int Function %31 + %x_243_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_244_phi = OpVariable %_ptr_Function_bool Function %40 + %x_246_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_230 = OpVariable %_ptr_Function_bool Function %40 + %x_231_phi = OpVariable %_ptr_Function_bool Function %40 + %x_214_1 = OpVariable %_ptr_Function_v2int Function %31 + %42 = OpLoad %v4float %gl_FragCoord + %45 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %46 = OpLoad %v2float %45 + %47 = OpCompositeExtract %float %42 0 + %48 = OpCompositeExtract %float %42 1 + %49 = OpCompositeConstruct %v2float %47 %48 + %50 = OpFDiv %v2float %49 %46 + %52 = OpCompositeExtract %float %50 0 + %54 = OpFMul %float %52 %float_256 + %51 = OpConvertFToS %int %54 + %56 = OpCompositeExtract %float %50 1 + %57 = OpFMul %float %56 %float_256 + %55 = OpConvertFToS %int %57 + %58 = OpCompositeConstruct %v2int %51 %55 + OpStore %x_209 %58 + OpSelectionMerge %59 None + OpSwitch %uint_0 %60 + %60 = OpLabel + %61 = OpLoad %v2int %x_209 + OpStore %x_213_phi %61 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %68 = OpLoad %v2int %x_213_phi + %69 = OpCompositeExtract %int %68 1 + OpStore %x_243_phi %71 + OpStore %x_244_phi %false + %74 = OpINotEqual %bool %69 %int_256 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpBranch %75 + %77 = OpLabel + OpBranch %63 + %75 = OpLabel + %78 = OpCompositeExtract %int %68 0 + OpStore %x_195 %236 + %238 = OpAccessChain %_ptr_Function_int %x_195 %69 + %239 = OpLoad %int %238 + %240 = OpIAdd %int %239 %int_15 + %241 = OpSLessThan %bool %78 %240 + OpStore %x_231_phi %241 + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %242 + %243 = OpLabel + OpStore %x_196 %236 + %244 = OpAccessChain %_ptr_Function_int %x_196 %69 + %245 = OpLoad %int %244 + %246 = OpISub %int %245 %int_15 + %247 = OpSGreaterThan %bool %78 %246 + OpStore %x_230 %247 + %248 = OpLoad %bool %x_230 + OpStore %x_231_phi %248 + OpBranch %242 + %242 = OpLabel + %249 = OpLoad %bool %x_231_phi + OpSelectionMerge %250 None + OpBranchConditional %249 %251 %250 + %251 = OpLabel + OpStore %x_197 %236 + %252 = OpAccessChain %_ptr_Function_int %x_197 %69 + %253 = OpLoad %int %252 + %258 = OpISub %int %78 %253 + %257 = OpConvertSToF %float %258 + %255 = OpExtInst %float %256 FAbs %257 + %259 = OpFSub %float %float_15 %255 + %261 = OpFMul %float %259 %float_0_0666666701 + %263 = OpCompositeConstruct %v4float %261 %261 %261 %float_1 + OpStore %x_241 %263 + %264 = OpLoad %v4float %x_241 + OpStore %x_243_phi %264 + OpStore %x_244_phi %true + OpBranch %63 + %250 = OpLabel + OpStore %x_214_1 %68 + %268 = OpAccessChain %_ptr_Function_int %x_214_1 %uint_1 + %270 = OpIAdd %int %69 %int_1 + OpStore %268 %270 + %271 = OpLoad %v2int %x_214_1 + OpBranch %64 + %64 = OpLabel + OpStore %x_213_phi %271 + OpBranch %62 + %63 = OpLabel + %272 = OpLoad %v4float %x_243_phi + OpStore %x_243 %272 + %273 = OpLoad %bool %x_244_phi + %274 = OpLoad %v4float %x_243 + OpStore %x_246_phi %274 + OpSelectionMerge %275 None + OpBranchConditional %273 %276 %275 + %276 = OpLabel + OpBranch %59 + %275 = OpLabel + OpStore %x_246_phi %277 + OpBranch %59 + %59 = OpLabel + %278 = OpLoad %v4float %x_246_phi + OpStore %x_GLF_color %278 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %279 +%tint_symbol_1 = OpFunctionParameter %main_out + %283 = OpLabel + %284 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %284 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %286 = OpLabel + %287 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %287 + %288 = OpFunctionCall %void %main_1 + %290 = OpLoad %v4float %x_GLF_color + %291 = OpCompositeConstruct %main_out %290 + %289 = OpFunctionCall %void %tint_symbol_3 %291 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..bdc7096473 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/0.wgsl.expected.wgsl @@ -0,0 +1,94 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_195 : array; + var x_196 : array; + var x_197 : array; + var x_209 : vec2; + var x_241 : vec4; + var x_243 : vec4; + var x_213_phi : vec2; + var x_243_phi : vec4; + var x_244_phi : bool; + var x_246_phi : vec4; + let x_198 : vec4 = gl_FragCoord; + let x_201 : vec2 = x_6.resolution; + let x_202 : vec2 = (vec2(x_198.x, x_198.y) / x_201); + x_209 = vec2(i32((x_202.x * 256.0)), i32((x_202.y * 256.0))); + switch(0u) { + default: { + x_213_phi = x_209; + loop { + var x_230 : bool; + var x_231_phi : bool; + let x_213 : vec2 = x_213_phi; + let x_216 : i32 = x_213.y; + x_243_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_244_phi = false; + if ((x_216 != 256)) { + } else { + break; + } + let x_220 : i32 = x_213.x; + x_195 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_222 : i32 = x_195[x_216]; + let x_224 : bool = (x_220 < (x_222 + 15)); + x_231_phi = x_224; + if (x_224) { + x_196 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_228 : i32 = x_196[x_216]; + x_230 = (x_220 > (x_228 - 15)); + x_231_phi = x_230; + } + let x_231 : bool = x_231_phi; + if (x_231) { + x_197 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_235 : i32 = x_197[x_216]; + let x_240 : f32 = ((15.0 - abs(f32((x_220 - x_235)))) * 0.06666667); + x_241 = vec4(x_240, x_240, x_240, 1.0); + x_243_phi = x_241; + x_244_phi = true; + break; + } + var x_214_1 : vec2 = x_213; + x_214_1.y = (x_216 + 1); + let x_214 : vec2 = x_214_1; + + continuing { + x_213_phi = x_214; + } + } + x_243 = x_243_phi; + let x_244 : bool = x_244_phi; + x_246_phi = x_243; + if (x_244) { + break; + } + x_246_phi = vec4(0.0, 0.0, 0.0, 1.0); + } + } + let x_246 : vec4 = x_246_phi; + x_GLF_color = x_246; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm new file mode 100644 index 0000000000..80382f4403 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm @@ -0,0 +1,293 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %177 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %float_15 = OpConstant %float 15 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %183 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %192 = OpUndef %v4float +%float_0_0666666701 = OpConstant %float 0.0666666701 + %main = OpFunction %void None %8 + %194 = OpLabel + %195 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %196 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %197 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %198 = OpLoad %v4float %gl_FragCoord + %199 = OpVectorShuffle %v2float %198 %198 0 1 + %200 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %201 = OpLoad %v2float %200 + %202 = OpFDiv %v2float %199 %201 + %203 = OpCompositeConstruct %v4float %201 %float_15 %float_15 + %204 = OpSNegate %int %int_82 + %205 = OpCompositeExtract %float %202 0 + %206 = OpFMul %float %205 %float_256 + %207 = OpCompositeExtract %float %203 2 + %208 = OpCompositeConstruct %v2float %float_0 %207 + %209 = OpISub %int %int_120 %int_0 + %210 = OpConvertFToS %int %206 + %211 = OpCompositeExtract %float %202 1 + %212 = OpFMul %float %211 %float_256 + %213 = OpConvertFToS %int %212 + %214 = OpCompositeConstruct %v2int %210 %213 + OpSelectionMerge %215 None + OpSwitch %uint_0 %216 + %216 = OpLabel + OpBranch %217 + %217 = OpLabel + %218 = OpPhi %v2int %214 %216 %219 %220 + %221 = OpCompositeExtract %int %218 1 + %222 = OpINotEqual %bool %221 %int_256 + OpLoopMerge %223 %220 None + OpBranchConditional %222 %224 %223 + %224 = OpLabel + %225 = OpCompositeExtract %int %218 0 + OpStore %195 %177 + %226 = OpAccessChain %_ptr_Function_int %195 %221 + %227 = OpLoad %int %226 + %228 = OpIAdd %int %227 %int_15 + %229 = OpSLessThan %bool %225 %228 + OpSelectionMerge %230 None + OpBranchConditional %229 %231 %230 + %231 = OpLabel + OpStore %196 %177 + %232 = OpAccessChain %_ptr_Function_int %196 %221 + %233 = OpLoad %int %232 + %234 = OpISub %int %233 %int_15 + %235 = OpSGreaterThan %bool %225 %234 + OpBranch %230 + %230 = OpLabel + %236 = OpPhi %bool %229 %224 %235 %231 + OpSelectionMerge %237 None + OpBranchConditional %236 %238 %237 + %238 = OpLabel + OpStore %197 %177 + %239 = OpAccessChain %_ptr_Function_int %197 %221 + %240 = OpLoad %int %239 + %241 = OpISub %int %225 %240 + %242 = OpConvertSToF %float %241 + %243 = OpCompositeConstruct %buf0 %208 + %244 = OpIAdd %int %int_91 %int_244 + %245 = OpExtInst %float %1 FAbs %242 + %246 = OpCompositeExtract %float %243 0 1 + %247 = OpFSub %float %246 %245 + %248 = OpFMul %float %247 %float_0_0666666701 + %249 = OpCompositeConstruct %v4float %248 %248 %248 %float_1 + OpBranch %223 + %237 = OpLabel + %250 = OpIAdd %int %221 %int_1 + %219 = OpCompositeInsert %v2int %250 %218 1 + OpBranch %220 + %220 = OpLabel + OpBranch %217 + %223 = OpLabel + %251 = OpPhi %v4float %192 %217 %249 %238 + %252 = OpPhi %bool %false %217 %true %238 + OpSelectionMerge %253 None + OpBranchConditional %252 %215 %253 + %253 = OpLabel + OpBranch %215 + %215 = OpLabel + %254 = OpPhi %v4float %251 %223 %183 %253 + OpStore %_GLF_color %254 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.hlsl new file mode 100755 index 0000000000..6f779ccf9a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.hlsl @@ -0,0 +1,10 @@ +SKIP: FAILED + +..\..\src\writer\hlsl\generator_impl.cc:3099 internal compiler error: unhandled struct member attribute: offset +******************************************************************** +* The tint shader compiler has encountered an unexpected error. * +* * +* Please help us fix this issue by submitting a bug report at * +* crbug.com/tint with the source program that triggered the bug. * +******************************************************************** + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.msl new file mode 100644 index 0000000000..805d16daee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.msl @@ -0,0 +1,107 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + tint_array_wrapper x_195 = {}; + tint_array_wrapper x_196 = {}; + tint_array_wrapper x_197 = {}; + float2 x_208 = 0.0f; + int2 x_214 = 0; + float4 x_249 = 0.0f; + float4 x_251 = 0.0f; + int2 x_218_phi = 0; + float4 x_251_phi = 0.0f; + bool x_252_phi = false; + float4 x_254_phi = 0.0f; + float4 const x_198 = *(tint_symbol_9); + float2 const x_201 = x_6.resolution; + float2 const x_202 = (float2(x_198.x, x_198.y) / x_201); + int const x_204 = -(82); + x_208 = float2(0.0f, float4(x_201, 15.0f, 15.0f).z); + int const x_209 = (120 - 0); + x_214 = int2(int((x_202.x * 256.0f)), int((x_202.y * 256.0f))); + switch(0u) { + default: { + x_218_phi = x_214; + while (true) { + bool x_235 = false; + bool x_236_phi = false; + int2 const x_218 = x_218_phi; + int const x_221 = x_218.y; + x_251_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_252_phi = false; + if ((x_221 != 256)) { + } else { + break; + } + int const x_225 = x_218.x; + tint_array_wrapper const tint_symbol_4 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_195 = tint_symbol_4; + int const x_227 = x_195.arr[x_221]; + bool const x_229 = (x_225 < (x_227 + 15)); + x_236_phi = x_229; + if (x_229) { + tint_array_wrapper const tint_symbol_5 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_196 = tint_symbol_5; + int const x_233 = x_196.arr[x_221]; + x_235 = (x_225 > (x_233 - 15)); + x_236_phi = x_235; + } + bool const x_236 = x_236_phi; + if (x_236) { + tint_array_wrapper const tint_symbol_6 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_197 = tint_symbol_6; + int const x_240 = x_197.arr[x_221]; + int const x_244 = (91 + 244); + buf0 const tint_symbol_7 = {.resolution=x_208}; + float const x_248 = ((tint_symbol_7.resolution.y - fabs(float((x_225 - x_240)))) * 0.06666667f); + x_249 = float4(x_248, x_248, x_248, 1.0f); + x_251_phi = x_249; + x_252_phi = true; + break; + } + int2 x_219_1 = x_218; + x_219_1.y = (x_221 + 1); + int2 const x_219 = x_219_1; + { + x_218_phi = x_219; + } + } + x_251 = x_251_phi; + bool const x_252 = x_252_phi; + x_254_phi = x_251; + if (x_252) { + break; + } + x_254_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + float4 const x_254 = x_254_phi; + *(tint_symbol_10) = x_254; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..8f758b6bbc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.spvasm @@ -0,0 +1,401 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 307 +; Schema: 0 + OpCapability Shader + %271 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_195 "x_195" + OpName %x_196 "x_196" + OpName %x_197 "x_197" + OpName %x_208 "x_208" + OpName %x_214 "x_214" + OpName %x_249 "x_249" + OpName %x_251 "x_251" + OpName %x_218_phi "x_218_phi" + OpName %x_251_phi "x_251_phi" + OpName %x_252_phi "x_252_phi" + OpName %x_254_phi "x_254_phi" + OpName %x_235 "x_235" + OpName %x_236_phi "x_236_phi" + OpName %x_219_1 "x_219_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %25 = OpConstantNull %_arr_int_uint_256 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %30 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %34 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %43 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %int_82 = OpConstant %int 82 + %float_0 = OpConstant %float 0 + %float_15 = OpConstant %float 15 + %int_120 = OpConstant %int 120 + %int_0 = OpConstant %int 0 + %float_256 = OpConstant %float 256 + %85 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %int_256 = OpConstant %int 256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %247 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 +%_ptr_Function_int = OpTypePointer Function %int +%float_0_0666666701 = OpConstant %float 0.0666666701 + %float_1 = OpConstant %float 1 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %292 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %294 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_195 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_196 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_197 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_208 = OpVariable %_ptr_Function_v2float Function %30 + %x_214 = OpVariable %_ptr_Function_v2int Function %34 + %x_249 = OpVariable %_ptr_Function_v4float Function %5 + %x_251 = OpVariable %_ptr_Function_v4float Function %5 + %x_218_phi = OpVariable %_ptr_Function_v2int Function %34 + %x_251_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_252_phi = OpVariable %_ptr_Function_bool Function %43 + %x_254_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_235 = OpVariable %_ptr_Function_bool Function %43 + %x_236_phi = OpVariable %_ptr_Function_bool Function %43 + %x_219_1 = OpVariable %_ptr_Function_v2int Function %34 + %45 = OpLoad %v4float %gl_FragCoord + %48 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %49 = OpLoad %v2float %48 + %50 = OpCompositeExtract %float %45 0 + %51 = OpCompositeExtract %float %45 1 + %52 = OpCompositeConstruct %v2float %50 %51 + %53 = OpFDiv %v2float %52 %49 + %54 = OpSNegate %int %int_82 + %57 = OpCompositeExtract %float %49 0 + %58 = OpCompositeExtract %float %49 1 + %60 = OpCompositeConstruct %v4float %57 %58 %float_15 %float_15 + %61 = OpCompositeExtract %float %60 2 + %62 = OpCompositeConstruct %v2float %float_0 %61 + OpStore %x_208 %62 + %65 = OpISub %int %int_120 %int_0 + %67 = OpCompositeExtract %float %53 0 + %69 = OpFMul %float %67 %float_256 + %66 = OpConvertFToS %int %69 + %71 = OpCompositeExtract %float %53 1 + %72 = OpFMul %float %71 %float_256 + %70 = OpConvertFToS %int %72 + %73 = OpCompositeConstruct %v2int %66 %70 + OpStore %x_214 %73 + OpSelectionMerge %74 None + OpSwitch %uint_0 %75 + %75 = OpLabel + %76 = OpLoad %v2int %x_214 + OpStore %x_218_phi %76 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %78 %79 None + OpBranch %80 + %80 = OpLabel + %83 = OpLoad %v2int %x_218_phi + %84 = OpCompositeExtract %int %83 1 + OpStore %x_251_phi %85 + OpStore %x_252_phi %false + %88 = OpINotEqual %bool %84 %int_256 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %91 + %90 = OpLabel + OpBranch %89 + %91 = OpLabel + OpBranch %78 + %89 = OpLabel + %92 = OpCompositeExtract %int %83 0 + OpStore %x_195 %247 + %249 = OpAccessChain %_ptr_Function_int %x_195 %84 + %250 = OpLoad %int %249 + %251 = OpIAdd %int %250 %int_15 + %252 = OpSLessThan %bool %92 %251 + OpStore %x_236_phi %252 + OpSelectionMerge %253 None + OpBranchConditional %252 %254 %253 + %254 = OpLabel + OpStore %x_196 %247 + %255 = OpAccessChain %_ptr_Function_int %x_196 %84 + %256 = OpLoad %int %255 + %257 = OpISub %int %256 %int_15 + %258 = OpSGreaterThan %bool %92 %257 + OpStore %x_235 %258 + %259 = OpLoad %bool %x_235 + OpStore %x_236_phi %259 + OpBranch %253 + %253 = OpLabel + %260 = OpLoad %bool %x_236_phi + OpSelectionMerge %261 None + OpBranchConditional %260 %262 %261 + %262 = OpLabel + OpStore %x_197 %247 + %263 = OpAccessChain %_ptr_Function_int %x_197 %84 + %264 = OpLoad %int %263 + %265 = OpIAdd %int %int_91 %int_244 + %266 = OpLoad %v2float %x_208 + %267 = OpCompositeConstruct %buf0 %266 + %268 = OpCompositeExtract %v2float %267 0 + %269 = OpCompositeExtract %float %268 1 + %273 = OpISub %int %92 %264 + %272 = OpConvertSToF %float %273 + %270 = OpExtInst %float %271 FAbs %272 + %274 = OpFSub %float %269 %270 + %276 = OpFMul %float %274 %float_0_0666666701 + %278 = OpCompositeConstruct %v4float %276 %276 %276 %float_1 + OpStore %x_249 %278 + %279 = OpLoad %v4float %x_249 + OpStore %x_251_phi %279 + OpStore %x_252_phi %true + OpBranch %78 + %261 = OpLabel + OpStore %x_219_1 %83 + %283 = OpAccessChain %_ptr_Function_int %x_219_1 %uint_1 + %285 = OpIAdd %int %84 %int_1 + OpStore %283 %285 + %286 = OpLoad %v2int %x_219_1 + OpBranch %79 + %79 = OpLabel + OpStore %x_218_phi %286 + OpBranch %77 + %78 = OpLabel + %287 = OpLoad %v4float %x_251_phi + OpStore %x_251 %287 + %288 = OpLoad %bool %x_252_phi + %289 = OpLoad %v4float %x_251 + OpStore %x_254_phi %289 + OpSelectionMerge %290 None + OpBranchConditional %288 %291 %290 + %291 = OpLabel + OpBranch %74 + %290 = OpLabel + OpStore %x_254_phi %292 + OpBranch %74 + %74 = OpLabel + %293 = OpLoad %v4float %x_254_phi + OpStore %x_GLF_color %293 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %294 +%tint_symbol_1 = OpFunctionParameter %main_out + %298 = OpLabel + %299 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %299 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %301 = OpLabel + %302 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %302 + %303 = OpFunctionCall %void %main_1 + %305 = OpLoad %v4float %x_GLF_color + %306 = OpCompositeConstruct %main_out %305 + %304 = OpFunctionCall %void %tint_symbol_3 %306 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..a8a9633196 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.spvasm.expected.wgsl @@ -0,0 +1,99 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_195 : array; + var x_196 : array; + var x_197 : array; + var x_208 : vec2; + var x_214 : vec2; + var x_249 : vec4; + var x_251 : vec4; + var x_218_phi : vec2; + var x_251_phi : vec4; + var x_252_phi : bool; + var x_254_phi : vec4; + let x_198 : vec4 = gl_FragCoord; + let x_201 : vec2 = x_6.resolution; + let x_202 : vec2 = (vec2(x_198.x, x_198.y) / x_201); + let x_204 : i32 = -(82); + x_208 = vec2(0.0, vec4(x_201, 15.0, 15.0).z); + let x_209 : i32 = (120 - 0); + x_214 = vec2(i32((x_202.x * 256.0)), i32((x_202.y * 256.0))); + switch(0u) { + default: { + x_218_phi = x_214; + loop { + var x_235 : bool; + var x_236_phi : bool; + let x_218 : vec2 = x_218_phi; + let x_221 : i32 = x_218.y; + x_251_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_252_phi = false; + if ((x_221 != 256)) { + } else { + break; + } + let x_225 : i32 = x_218.x; + x_195 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_227 : i32 = x_195[x_221]; + let x_229 : bool = (x_225 < (x_227 + 15)); + x_236_phi = x_229; + if (x_229) { + x_196 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_233 : i32 = x_196[x_221]; + x_235 = (x_225 > (x_233 - 15)); + x_236_phi = x_235; + } + let x_236 : bool = x_236_phi; + if (x_236) { + x_197 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_240 : i32 = x_197[x_221]; + let x_244 : i32 = (91 + 244); + let x_248 : f32 = ((buf0(x_208).resolution.y - abs(f32((x_225 - x_240)))) * 0.06666667); + x_249 = vec4(x_248, x_248, x_248, 1.0); + x_251_phi = x_249; + x_252_phi = true; + break; + } + var x_219_1 : vec2 = x_218; + x_219_1.y = (x_221 + 1); + let x_219 : vec2 = x_219_1; + + continuing { + x_218_phi = x_219; + } + } + x_251 = x_251_phi; + let x_252 : bool = x_252_phi; + x_254_phi = x_251; + if (x_252) { + break; + } + x_254_phi = vec4(0.0, 0.0, 0.0, 1.0); + } + } + let x_254 : vec4 = x_254_phi; + x_GLF_color = x_254; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl new file mode 100644 index 0000000000..a8a9633196 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl @@ -0,0 +1,99 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_195 : array; + var x_196 : array; + var x_197 : array; + var x_208 : vec2; + var x_214 : vec2; + var x_249 : vec4; + var x_251 : vec4; + var x_218_phi : vec2; + var x_251_phi : vec4; + var x_252_phi : bool; + var x_254_phi : vec4; + let x_198 : vec4 = gl_FragCoord; + let x_201 : vec2 = x_6.resolution; + let x_202 : vec2 = (vec2(x_198.x, x_198.y) / x_201); + let x_204 : i32 = -(82); + x_208 = vec2(0.0, vec4(x_201, 15.0, 15.0).z); + let x_209 : i32 = (120 - 0); + x_214 = vec2(i32((x_202.x * 256.0)), i32((x_202.y * 256.0))); + switch(0u) { + default: { + x_218_phi = x_214; + loop { + var x_235 : bool; + var x_236_phi : bool; + let x_218 : vec2 = x_218_phi; + let x_221 : i32 = x_218.y; + x_251_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_252_phi = false; + if ((x_221 != 256)) { + } else { + break; + } + let x_225 : i32 = x_218.x; + x_195 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_227 : i32 = x_195[x_221]; + let x_229 : bool = (x_225 < (x_227 + 15)); + x_236_phi = x_229; + if (x_229) { + x_196 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_233 : i32 = x_196[x_221]; + x_235 = (x_225 > (x_233 - 15)); + x_236_phi = x_235; + } + let x_236 : bool = x_236_phi; + if (x_236) { + x_197 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_240 : i32 = x_197[x_221]; + let x_244 : i32 = (91 + 244); + let x_248 : f32 = ((buf0(x_208).resolution.y - abs(f32((x_225 - x_240)))) * 0.06666667); + x_249 = vec4(x_248, x_248, x_248, 1.0); + x_251_phi = x_249; + x_252_phi = true; + break; + } + var x_219_1 : vec2 = x_218; + x_219_1.y = (x_221 + 1); + let x_219 : vec2 = x_219_1; + + continuing { + x_218_phi = x_219; + } + } + x_251 = x_251_phi; + let x_252 : bool = x_252_phi; + x_254_phi = x_251; + if (x_252) { + break; + } + x_254_phi = vec4(0.0, 0.0, 0.0, 1.0); + } + } + let x_254 : vec4 = x_254_phi; + x_GLF_color = x_254; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..0e4020b9e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.hlsl @@ -0,0 +1,107 @@ +struct buf0 { + float2 resolution; +}; + +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_195[256] = (int[256])0; + int x_196[256] = (int[256])0; + int x_197[256] = (int[256])0; + float2 x_208 = float2(0.0f, 0.0f); + int2 x_214 = int2(0, 0); + float4 x_249 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_251 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int2 x_218_phi = int2(0, 0); + float4 x_251_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_252_phi = false; + float4 x_254_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float4 x_198 = gl_FragCoord; + const float2 x_201 = asfloat(x_6[0].xy); + const float2 x_202 = (float2(x_198.x, x_198.y) / x_201); + const int x_204 = -(82); + x_208 = float2(0.0f, float4(x_201, 15.0f, 15.0f).z); + const int x_209 = (120 - 0); + x_214 = int2(int((x_202.x * 256.0f)), int((x_202.y * 256.0f))); + switch(0u) { + default: { + x_218_phi = x_214; + while (true) { + bool x_235 = false; + bool x_236_phi = false; + const int2 x_218 = x_218_phi; + const int x_221 = x_218.y; + x_251_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_252_phi = false; + if ((x_221 != 256)) { + } else { + break; + } + const int x_225 = x_218.x; + const int tint_symbol_5[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_195 = tint_symbol_5; + const int x_227 = x_195[x_221]; + const bool x_229 = (x_225 < (x_227 + 15)); + x_236_phi = x_229; + if (x_229) { + const int tint_symbol_6[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_196 = tint_symbol_6; + const int x_233 = x_196[x_221]; + x_235 = (x_225 > (x_233 - 15)); + x_236_phi = x_235; + } + if (x_236_phi) { + const int tint_symbol_7[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_197 = tint_symbol_7; + const int x_240 = x_197[x_221]; + const int x_244 = (91 + 244); + const buf0 tint_symbol_8 = {x_208}; + const float x_248 = ((tint_symbol_8.resolution.y - abs(float((x_225 - x_240)))) * 0.06666667f); + x_249 = float4(x_248, x_248, x_248, 1.0f); + x_251_phi = x_249; + x_252_phi = true; + break; + } + int2 x_219_1 = x_218; + x_219_1.y = (x_221 + 1); + const int2 x_219 = x_219_1; + { + x_218_phi = x_219; + } + } + x_251 = x_251_phi; + const bool x_252 = x_252_phi; + x_254_phi = x_251; + if (x_252) { + break; + } + x_254_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + x_GLF_color = x_254_phi; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.msl new file mode 100644 index 0000000000..805d16daee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.msl @@ -0,0 +1,107 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + tint_array_wrapper x_195 = {}; + tint_array_wrapper x_196 = {}; + tint_array_wrapper x_197 = {}; + float2 x_208 = 0.0f; + int2 x_214 = 0; + float4 x_249 = 0.0f; + float4 x_251 = 0.0f; + int2 x_218_phi = 0; + float4 x_251_phi = 0.0f; + bool x_252_phi = false; + float4 x_254_phi = 0.0f; + float4 const x_198 = *(tint_symbol_9); + float2 const x_201 = x_6.resolution; + float2 const x_202 = (float2(x_198.x, x_198.y) / x_201); + int const x_204 = -(82); + x_208 = float2(0.0f, float4(x_201, 15.0f, 15.0f).z); + int const x_209 = (120 - 0); + x_214 = int2(int((x_202.x * 256.0f)), int((x_202.y * 256.0f))); + switch(0u) { + default: { + x_218_phi = x_214; + while (true) { + bool x_235 = false; + bool x_236_phi = false; + int2 const x_218 = x_218_phi; + int const x_221 = x_218.y; + x_251_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_252_phi = false; + if ((x_221 != 256)) { + } else { + break; + } + int const x_225 = x_218.x; + tint_array_wrapper const tint_symbol_4 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_195 = tint_symbol_4; + int const x_227 = x_195.arr[x_221]; + bool const x_229 = (x_225 < (x_227 + 15)); + x_236_phi = x_229; + if (x_229) { + tint_array_wrapper const tint_symbol_5 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_196 = tint_symbol_5; + int const x_233 = x_196.arr[x_221]; + x_235 = (x_225 > (x_233 - 15)); + x_236_phi = x_235; + } + bool const x_236 = x_236_phi; + if (x_236) { + tint_array_wrapper const tint_symbol_6 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_197 = tint_symbol_6; + int const x_240 = x_197.arr[x_221]; + int const x_244 = (91 + 244); + buf0 const tint_symbol_7 = {.resolution=x_208}; + float const x_248 = ((tint_symbol_7.resolution.y - fabs(float((x_225 - x_240)))) * 0.06666667f); + x_249 = float4(x_248, x_248, x_248, 1.0f); + x_251_phi = x_249; + x_252_phi = true; + break; + } + int2 x_219_1 = x_218; + x_219_1.y = (x_221 + 1); + int2 const x_219 = x_219_1; + { + x_218_phi = x_219; + } + } + x_251 = x_251_phi; + bool const x_252 = x_252_phi; + x_254_phi = x_251; + if (x_252) { + break; + } + x_254_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + float4 const x_254 = x_254_phi; + *(tint_symbol_10) = x_254; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..8f758b6bbc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.spvasm @@ -0,0 +1,401 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 307 +; Schema: 0 + OpCapability Shader + %271 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_195 "x_195" + OpName %x_196 "x_196" + OpName %x_197 "x_197" + OpName %x_208 "x_208" + OpName %x_214 "x_214" + OpName %x_249 "x_249" + OpName %x_251 "x_251" + OpName %x_218_phi "x_218_phi" + OpName %x_251_phi "x_251_phi" + OpName %x_252_phi "x_252_phi" + OpName %x_254_phi "x_254_phi" + OpName %x_235 "x_235" + OpName %x_236_phi "x_236_phi" + OpName %x_219_1 "x_219_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %25 = OpConstantNull %_arr_int_uint_256 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %30 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %34 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %43 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %int_82 = OpConstant %int 82 + %float_0 = OpConstant %float 0 + %float_15 = OpConstant %float 15 + %int_120 = OpConstant %int 120 + %int_0 = OpConstant %int 0 + %float_256 = OpConstant %float 256 + %85 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %int_256 = OpConstant %int 256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %247 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 +%_ptr_Function_int = OpTypePointer Function %int +%float_0_0666666701 = OpConstant %float 0.0666666701 + %float_1 = OpConstant %float 1 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %292 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %294 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_195 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_196 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_197 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_208 = OpVariable %_ptr_Function_v2float Function %30 + %x_214 = OpVariable %_ptr_Function_v2int Function %34 + %x_249 = OpVariable %_ptr_Function_v4float Function %5 + %x_251 = OpVariable %_ptr_Function_v4float Function %5 + %x_218_phi = OpVariable %_ptr_Function_v2int Function %34 + %x_251_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_252_phi = OpVariable %_ptr_Function_bool Function %43 + %x_254_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_235 = OpVariable %_ptr_Function_bool Function %43 + %x_236_phi = OpVariable %_ptr_Function_bool Function %43 + %x_219_1 = OpVariable %_ptr_Function_v2int Function %34 + %45 = OpLoad %v4float %gl_FragCoord + %48 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %49 = OpLoad %v2float %48 + %50 = OpCompositeExtract %float %45 0 + %51 = OpCompositeExtract %float %45 1 + %52 = OpCompositeConstruct %v2float %50 %51 + %53 = OpFDiv %v2float %52 %49 + %54 = OpSNegate %int %int_82 + %57 = OpCompositeExtract %float %49 0 + %58 = OpCompositeExtract %float %49 1 + %60 = OpCompositeConstruct %v4float %57 %58 %float_15 %float_15 + %61 = OpCompositeExtract %float %60 2 + %62 = OpCompositeConstruct %v2float %float_0 %61 + OpStore %x_208 %62 + %65 = OpISub %int %int_120 %int_0 + %67 = OpCompositeExtract %float %53 0 + %69 = OpFMul %float %67 %float_256 + %66 = OpConvertFToS %int %69 + %71 = OpCompositeExtract %float %53 1 + %72 = OpFMul %float %71 %float_256 + %70 = OpConvertFToS %int %72 + %73 = OpCompositeConstruct %v2int %66 %70 + OpStore %x_214 %73 + OpSelectionMerge %74 None + OpSwitch %uint_0 %75 + %75 = OpLabel + %76 = OpLoad %v2int %x_214 + OpStore %x_218_phi %76 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %78 %79 None + OpBranch %80 + %80 = OpLabel + %83 = OpLoad %v2int %x_218_phi + %84 = OpCompositeExtract %int %83 1 + OpStore %x_251_phi %85 + OpStore %x_252_phi %false + %88 = OpINotEqual %bool %84 %int_256 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %91 + %90 = OpLabel + OpBranch %89 + %91 = OpLabel + OpBranch %78 + %89 = OpLabel + %92 = OpCompositeExtract %int %83 0 + OpStore %x_195 %247 + %249 = OpAccessChain %_ptr_Function_int %x_195 %84 + %250 = OpLoad %int %249 + %251 = OpIAdd %int %250 %int_15 + %252 = OpSLessThan %bool %92 %251 + OpStore %x_236_phi %252 + OpSelectionMerge %253 None + OpBranchConditional %252 %254 %253 + %254 = OpLabel + OpStore %x_196 %247 + %255 = OpAccessChain %_ptr_Function_int %x_196 %84 + %256 = OpLoad %int %255 + %257 = OpISub %int %256 %int_15 + %258 = OpSGreaterThan %bool %92 %257 + OpStore %x_235 %258 + %259 = OpLoad %bool %x_235 + OpStore %x_236_phi %259 + OpBranch %253 + %253 = OpLabel + %260 = OpLoad %bool %x_236_phi + OpSelectionMerge %261 None + OpBranchConditional %260 %262 %261 + %262 = OpLabel + OpStore %x_197 %247 + %263 = OpAccessChain %_ptr_Function_int %x_197 %84 + %264 = OpLoad %int %263 + %265 = OpIAdd %int %int_91 %int_244 + %266 = OpLoad %v2float %x_208 + %267 = OpCompositeConstruct %buf0 %266 + %268 = OpCompositeExtract %v2float %267 0 + %269 = OpCompositeExtract %float %268 1 + %273 = OpISub %int %92 %264 + %272 = OpConvertSToF %float %273 + %270 = OpExtInst %float %271 FAbs %272 + %274 = OpFSub %float %269 %270 + %276 = OpFMul %float %274 %float_0_0666666701 + %278 = OpCompositeConstruct %v4float %276 %276 %276 %float_1 + OpStore %x_249 %278 + %279 = OpLoad %v4float %x_249 + OpStore %x_251_phi %279 + OpStore %x_252_phi %true + OpBranch %78 + %261 = OpLabel + OpStore %x_219_1 %83 + %283 = OpAccessChain %_ptr_Function_int %x_219_1 %uint_1 + %285 = OpIAdd %int %84 %int_1 + OpStore %283 %285 + %286 = OpLoad %v2int %x_219_1 + OpBranch %79 + %79 = OpLabel + OpStore %x_218_phi %286 + OpBranch %77 + %78 = OpLabel + %287 = OpLoad %v4float %x_251_phi + OpStore %x_251 %287 + %288 = OpLoad %bool %x_252_phi + %289 = OpLoad %v4float %x_251 + OpStore %x_254_phi %289 + OpSelectionMerge %290 None + OpBranchConditional %288 %291 %290 + %291 = OpLabel + OpBranch %74 + %290 = OpLabel + OpStore %x_254_phi %292 + OpBranch %74 + %74 = OpLabel + %293 = OpLoad %v4float %x_254_phi + OpStore %x_GLF_color %293 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %294 +%tint_symbol_1 = OpFunctionParameter %main_out + %298 = OpLabel + %299 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %299 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %301 = OpLabel + %302 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %302 + %303 = OpFunctionCall %void %main_1 + %305 = OpLoad %v4float %x_GLF_color + %306 = OpCompositeConstruct %main_out %305 + %304 = OpFunctionCall %void %tint_symbol_3 %306 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..a8a9633196 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-composites/1.wgsl.expected.wgsl @@ -0,0 +1,99 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_195 : array; + var x_196 : array; + var x_197 : array; + var x_208 : vec2; + var x_214 : vec2; + var x_249 : vec4; + var x_251 : vec4; + var x_218_phi : vec2; + var x_251_phi : vec4; + var x_252_phi : bool; + var x_254_phi : vec4; + let x_198 : vec4 = gl_FragCoord; + let x_201 : vec2 = x_6.resolution; + let x_202 : vec2 = (vec2(x_198.x, x_198.y) / x_201); + let x_204 : i32 = -(82); + x_208 = vec2(0.0, vec4(x_201, 15.0, 15.0).z); + let x_209 : i32 = (120 - 0); + x_214 = vec2(i32((x_202.x * 256.0)), i32((x_202.y * 256.0))); + switch(0u) { + default: { + x_218_phi = x_214; + loop { + var x_235 : bool; + var x_236_phi : bool; + let x_218 : vec2 = x_218_phi; + let x_221 : i32 = x_218.y; + x_251_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_252_phi = false; + if ((x_221 != 256)) { + } else { + break; + } + let x_225 : i32 = x_218.x; + x_195 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_227 : i32 = x_195[x_221]; + let x_229 : bool = (x_225 < (x_227 + 15)); + x_236_phi = x_229; + if (x_229) { + x_196 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_233 : i32 = x_196[x_221]; + x_235 = (x_225 > (x_233 - 15)); + x_236_phi = x_235; + } + let x_236 : bool = x_236_phi; + if (x_236) { + x_197 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_240 : i32 = x_197[x_221]; + let x_244 : i32 = (91 + 244); + let x_248 : f32 = ((buf0(x_208).resolution.y - abs(f32((x_225 - x_240)))) * 0.06666667); + x_249 = vec4(x_248, x_248, x_248, 1.0); + x_251_phi = x_249; + x_252_phi = true; + break; + } + var x_219_1 : vec2 = x_218; + x_219_1.y = (x_221 + 1); + let x_219 : vec2 = x_219_1; + + continuing { + x_218_phi = x_219; + } + } + x_251 = x_251_phi; + let x_252 : bool = x_252_phi; + x_254_phi = x_251; + if (x_252) { + break; + } + x_254_phi = vec4(0.0, 0.0, 0.0, 1.0); + } + } + let x_254 : vec4 = x_254_phi; + x_GLF_color = x_254; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm new file mode 100644 index 0000000000..b8609d355a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm @@ -0,0 +1,620 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %pos "pos" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %ipos "ipos" + OpName %i "i" + OpName %map "map" + OpName %p "p" + OpName %canwalk "canwalk" + OpName %v "v" + OpName %directions "directions" + OpName %j "j" + OpName %d "d" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_16 = OpConstant %float 16 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %bool = OpTypeBool + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Private__arr_int_uint_256 = OpTypePointer Private %_arr_int_uint_256 + %map = OpVariable %_ptr_Private__arr_int_uint_256 Private +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %43 = OpConstantComposite %v2int %int_0 %int_0 +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %int_16 = OpConstant %int 16 + %int_14 = OpConstant %int 14 + %false = OpConstantFalse %bool + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %53 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %55 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%mat2v4float = OpTypeMatrix %v4float 2 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %58 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %59 = OpConstantComposite %mat2v4float %58 %58 + %60 = OpVariable %_ptr_Private_mat2v4float Private %59 + %61 = OpConstantNull %bool + %main = OpFunction %void None %18 + %62 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function + %ipos = OpVariable %_ptr_Function_v2int Function + %i = OpVariable %_ptr_Function_int Function + %p = OpVariable %_ptr_Function_v2int Function + %canwalk = OpVariable %_ptr_Function_bool Function + %v = OpVariable %_ptr_Function_int Function + %directions = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %d = OpVariable %_ptr_Function_int Function + %63 = OpLoad %v4float %gl_FragCoord + %64 = OpVectorShuffle %v2float %63 %63 0 1 + %65 = OpISub %int %int_256 %int_14 + %66 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %67 = OpLoad %v2float %66 + %68 = OpSNegate %int %65 + %69 = OpFDiv %v2float %64 %67 + OpStore %pos %69 + %70 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %71 = OpLoad %float %70 + %72 = OpFMul %float %71 %float_16 + %73 = OpConvertFToS %int %72 + %74 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %75 = OpLoad %float %74 + %76 = OpFMul %float %75 %float_16 + %77 = OpConvertFToS %int %76 + %78 = OpCompositeConstruct %v2int %73 %77 + OpStore %ipos %78 + OpStore %i %int_0 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %int %i + %84 = OpSLessThan %bool %83 %int_256 + OpBranchConditional %84 %85 %80 + %85 = OpLabel + %86 = OpLoad %int %i + %87 = OpAccessChain %_ptr_Private_int %map %86 + OpStore %87 %int_0 + OpBranch %81 + %81 = OpLabel + %88 = OpLoad %int %i + %89 = OpIAdd %int %88 %int_1 + OpStore %i %89 + OpBranch %79 + %80 = OpLabel + OpStore %p %43 + OpStore %canwalk %true + OpStore %v %int_0 + OpBranch %90 + %90 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %int %v + %95 = OpIAdd %int %94 %int_1 + OpStore %v %95 + OpStore %directions %int_0 + %96 = OpAccessChain %_ptr_Function_int %p %uint_0 + %97 = OpLoad %int %96 + %98 = OpSGreaterThan %bool %97 %int_0 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %99 + %100 = OpLabel + %101 = OpAccessChain %_ptr_Function_int %p %uint_0 + %102 = OpLoad %int %101 + %103 = OpISub %int %102 %int_2 + %104 = OpAccessChain %_ptr_Function_int %p %uint_1 + %105 = OpLoad %int %104 + %106 = OpIMul %int %105 %int_16 + %107 = OpIAdd %int %103 %106 + %108 = OpAccessChain %_ptr_Private_int %map %107 + %109 = OpLoad %int %108 + %110 = OpIEqual %bool %109 %int_0 + OpBranch %99 + %99 = OpLabel + %111 = OpPhi %bool %98 %93 %110 %100 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %112 + %113 = OpLabel + %114 = OpLoad %int %directions + %115 = OpIAdd %int %114 %int_1 + OpStore %directions %115 + OpBranch %112 + %112 = OpLabel + %116 = OpAccessChain %_ptr_Function_int %p %uint_1 + %117 = OpLoad %int %116 + %118 = OpSGreaterThan %bool %117 %int_0 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %119 + %120 = OpLabel + %121 = OpAccessChain %_ptr_Function_int %p %uint_0 + %122 = OpLoad %int %121 + %123 = OpAccessChain %_ptr_Function_int %p %uint_1 + %124 = OpLoad %int %123 + %125 = OpISub %int %124 %int_2 + %126 = OpIMul %int %125 %int_16 + %127 = OpIAdd %int %122 %126 + %128 = OpAccessChain %_ptr_Private_int %map %127 + %129 = OpLoad %int %128 + %130 = OpIEqual %bool %129 %int_0 + OpBranch %119 + %119 = OpLabel + %131 = OpPhi %bool %118 %112 %130 %120 + OpSelectionMerge %132 None + OpBranchConditional %131 %133 %132 + %133 = OpLabel + %134 = OpLoad %int %directions + %135 = OpIAdd %int %134 %int_1 + OpStore %directions %135 + OpBranch %132 + %132 = OpLabel + %136 = OpAccessChain %_ptr_Function_int %p %uint_0 + %137 = OpLoad %int %136 + %138 = OpSLessThan %bool %137 %int_14 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpAccessChain %_ptr_Function_int %p %uint_0 + %142 = OpLoad %int %141 + %143 = OpIAdd %int %142 %int_2 + %144 = OpAccessChain %_ptr_Function_int %p %uint_1 + %145 = OpLoad %int %144 + %146 = OpIMul %int %145 %int_16 + %147 = OpIAdd %int %143 %146 + %148 = OpAccessChain %_ptr_Private_int %map %147 + %149 = OpLoad %int %148 + %150 = OpIEqual %bool %149 %int_0 + OpBranch %139 + %139 = OpLabel + %151 = OpPhi %bool %138 %132 %150 %140 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %152 + %153 = OpLabel + %154 = OpLoad %int %directions + %155 = OpIAdd %int %154 %int_1 + OpStore %directions %155 + OpBranch %152 + %152 = OpLabel + %156 = OpISub %int %int_256 %68 + %157 = OpAccessChain %_ptr_Function_int %p %uint_1 + %158 = OpLoad %int %157 + %159 = OpSLessThan %bool %158 %int_14 + OpSelectionMerge %160 None + OpBranchConditional %159 %161 %160 + %161 = OpLabel + %162 = OpAccessChain %_ptr_Function_int %p %uint_0 + %163 = OpLoad %int %162 + %164 = OpAccessChain %_ptr_Function_int %p %uint_1 + %165 = OpLoad %int %164 + %166 = OpIAdd %int %165 %int_2 + %167 = OpIMul %int %166 %int_16 + %168 = OpIAdd %int %163 %167 + %169 = OpAccessChain %_ptr_Private_int %map %168 + %170 = OpLoad %int %169 + %171 = OpIEqual %bool %170 %int_0 + OpBranch %160 + %160 = OpLabel + %172 = OpPhi %bool %159 %152 %171 %161 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %173 + %174 = OpLabel + %175 = OpLoad %int %directions + %176 = OpIAdd %int %175 %int_1 + OpStore %directions %176 + OpBranch %173 + %173 = OpLabel + %177 = OpLoad %int %directions + %178 = OpIEqual %bool %177 %int_0 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %181 + %180 = OpLabel + OpStore %canwalk %false + OpStore %i %int_0 + OpBranch %182 + %182 = OpLabel + OpLoopMerge %183 %184 None + OpBranch %185 + %185 = OpLabel + %186 = OpLoad %int %i + %187 = OpSLessThan %bool %186 %int_8 + OpBranchConditional %187 %188 %183 + %188 = OpLabel + OpStore %j %int_0 + %189 = OpISub %int %156 %186 + OpStore %60 %59 + OpBranchConditional %61 %184 %190 + %190 = OpLabel + OpLoopMerge %191 %192 Unroll + OpBranch %193 + %193 = OpLabel + %194 = OpLoad %int %j + %195 = OpSLessThan %bool %194 %int_8 + OpBranchConditional %195 %196 %191 + %196 = OpLabel + %197 = OpLoad %int %j + %198 = OpIMul %int %197 %int_2 + %199 = OpLoad %int %i + %200 = OpIMul %int %199 %int_2 + %201 = OpIMul %int %200 %int_16 + %202 = OpIAdd %int %198 %201 + %203 = OpAccessChain %_ptr_Private_int %map %202 + %204 = OpLoad %int %203 + %205 = OpIEqual %bool %204 %int_0 + OpSelectionMerge %206 None + OpBranchConditional %205 %207 %206 + %207 = OpLabel + %208 = OpLoad %int %j + %209 = OpIMul %int %208 %int_2 + %210 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %210 %209 + %211 = OpLoad %int %i + %212 = OpIMul %int %211 %int_2 + %213 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %213 %212 + OpStore %canwalk %true + OpBranch %206 + %206 = OpLabel + OpBranch %192 + %192 = OpLabel + %214 = OpLoad %int %j + %215 = OpIAdd %int %214 %int_1 + OpStore %j %215 + OpBranch %190 + %191 = OpLabel + OpBranch %184 + %184 = OpLabel + %216 = OpLoad %int %i + %217 = OpIAdd %int %216 %int_1 + OpStore %i %217 + OpBranch %182 + %183 = OpLabel + %218 = OpAccessChain %_ptr_Function_int %p %uint_0 + %219 = OpLoad %int %218 + %220 = OpAccessChain %_ptr_Function_int %p %uint_1 + %221 = OpLoad %int %220 + %222 = OpIMul %int %221 %int_16 + %223 = OpIAdd %int %219 %222 + %224 = OpAccessChain %_ptr_Private_int %map %223 + OpStore %224 %int_1 + OpBranch %179 + %181 = OpLabel + %225 = OpLoad %int %v + %226 = OpLoad %int %directions + %227 = OpSMod %int %225 %226 + OpStore %d %227 + %228 = OpLoad %int %directions + %229 = OpLoad %int %v + %230 = OpIAdd %int %229 %228 + OpStore %v %230 + %231 = OpLoad %int %d + %232 = OpSGreaterThanEqual %bool %231 %int_0 + OpSelectionMerge %233 None + OpBranchConditional %232 %234 %233 + %234 = OpLabel + %235 = OpAccessChain %_ptr_Function_int %p %uint_0 + %236 = OpLoad %int %235 + %237 = OpSGreaterThan %bool %236 %int_0 + OpBranch %233 + %233 = OpLabel + %238 = OpPhi %bool %232 %181 %237 %234 + OpSelectionMerge %239 None + OpBranchConditional %238 %240 %239 + %240 = OpLabel + %241 = OpAccessChain %_ptr_Function_int %p %uint_0 + %242 = OpLoad %int %241 + %243 = OpISub %int %242 %int_2 + %244 = OpAccessChain %_ptr_Function_int %p %uint_1 + %245 = OpLoad %int %244 + %246 = OpIMul %int %245 %int_16 + %247 = OpIAdd %int %243 %246 + %248 = OpAccessChain %_ptr_Private_int %map %247 + %249 = OpLoad %int %248 + %250 = OpIEqual %bool %249 %int_0 + OpBranch %239 + %239 = OpLabel + %251 = OpPhi %bool %238 %233 %250 %240 + OpSelectionMerge %252 None + OpBranchConditional %251 %253 %252 + %253 = OpLabel + %254 = OpLoad %int %d + %255 = OpISub %int %254 %int_1 + OpStore %d %255 + %256 = OpAccessChain %_ptr_Function_int %p %uint_0 + %257 = OpLoad %int %256 + %258 = OpAccessChain %_ptr_Function_int %p %uint_1 + %259 = OpLoad %int %258 + %260 = OpIMul %int %259 %int_16 + %261 = OpIAdd %int %257 %260 + %262 = OpAccessChain %_ptr_Private_int %map %261 + OpStore %262 %int_1 + %263 = OpAccessChain %_ptr_Function_int %p %uint_0 + %264 = OpLoad %int %263 + %265 = OpISub %int %264 %int_1 + %266 = OpAccessChain %_ptr_Function_int %p %uint_1 + %267 = OpLoad %int %266 + %268 = OpIMul %int %267 %int_16 + %269 = OpIAdd %int %265 %268 + %270 = OpAccessChain %_ptr_Private_int %map %269 + OpStore %270 %int_1 + %271 = OpAccessChain %_ptr_Function_int %p %uint_0 + %272 = OpLoad %int %271 + %273 = OpISub %int %272 %int_2 + %274 = OpAccessChain %_ptr_Function_int %p %uint_1 + %275 = OpLoad %int %274 + %276 = OpIMul %int %275 %int_16 + %277 = OpIAdd %int %273 %276 + %278 = OpAccessChain %_ptr_Private_int %map %277 + OpStore %278 %int_1 + %279 = OpAccessChain %_ptr_Function_int %p %uint_0 + %280 = OpLoad %int %279 + %281 = OpISub %int %280 %int_2 + %282 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %282 %281 + OpBranch %252 + %252 = OpLabel + %283 = OpLoad %int %d + %284 = OpSGreaterThanEqual %bool %283 %int_0 + OpSelectionMerge %285 None + OpBranchConditional %284 %286 %285 + %286 = OpLabel + %287 = OpAccessChain %_ptr_Function_int %p %uint_1 + %288 = OpLoad %int %287 + %289 = OpSGreaterThan %bool %288 %int_0 + OpBranch %285 + %285 = OpLabel + %290 = OpPhi %bool %284 %252 %289 %286 + OpSelectionMerge %291 None + OpBranchConditional %290 %292 %291 + %292 = OpLabel + %293 = OpAccessChain %_ptr_Function_int %p %uint_0 + %294 = OpLoad %int %293 + %295 = OpAccessChain %_ptr_Function_int %p %uint_1 + %296 = OpLoad %int %295 + %297 = OpISub %int %296 %int_2 + %298 = OpIMul %int %297 %int_16 + %299 = OpIAdd %int %294 %298 + %300 = OpAccessChain %_ptr_Private_int %map %299 + %301 = OpLoad %int %300 + %302 = OpIEqual %bool %301 %int_0 + OpBranch %291 + %291 = OpLabel + %303 = OpPhi %bool %290 %285 %302 %292 + OpSelectionMerge %304 None + OpBranchConditional %303 %305 %304 + %305 = OpLabel + %306 = OpLoad %int %d + %307 = OpISub %int %306 %int_1 + OpStore %d %307 + %308 = OpAccessChain %_ptr_Function_int %p %uint_0 + %309 = OpLoad %int %308 + %310 = OpAccessChain %_ptr_Function_int %p %uint_1 + %311 = OpLoad %int %310 + %312 = OpIMul %int %311 %int_16 + %313 = OpIAdd %int %309 %312 + %314 = OpAccessChain %_ptr_Private_int %map %313 + OpStore %314 %int_1 + %315 = OpAccessChain %_ptr_Function_int %p %uint_0 + %316 = OpLoad %int %315 + %317 = OpAccessChain %_ptr_Function_int %p %uint_1 + %318 = OpLoad %int %317 + %319 = OpISub %int %318 %int_1 + %320 = OpIMul %int %319 %int_16 + %321 = OpIAdd %int %316 %320 + %322 = OpAccessChain %_ptr_Private_int %map %321 + OpStore %322 %int_1 + %323 = OpAccessChain %_ptr_Function_int %p %uint_0 + %324 = OpLoad %int %323 + %325 = OpAccessChain %_ptr_Function_int %p %uint_1 + %326 = OpLoad %int %325 + %327 = OpISub %int %326 %int_2 + %328 = OpIMul %int %327 %int_16 + %329 = OpIAdd %int %324 %328 + %330 = OpAccessChain %_ptr_Private_int %map %329 + OpStore %330 %int_1 + %331 = OpAccessChain %_ptr_Function_int %p %uint_1 + %332 = OpLoad %int %331 + %333 = OpISub %int %332 %int_2 + %334 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %334 %333 + OpBranch %304 + %304 = OpLabel + %335 = OpLoad %int %d + %336 = OpSGreaterThanEqual %bool %335 %int_0 + OpSelectionMerge %337 None + OpBranchConditional %336 %338 %337 + %338 = OpLabel + %339 = OpAccessChain %_ptr_Function_int %p %uint_0 + %340 = OpLoad %int %339 + %341 = OpSLessThan %bool %340 %int_14 + OpBranch %337 + %337 = OpLabel + %342 = OpPhi %bool %336 %304 %341 %338 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %343 + %344 = OpLabel + %345 = OpAccessChain %_ptr_Function_int %p %uint_0 + %346 = OpLoad %int %345 + %347 = OpIAdd %int %346 %int_2 + %348 = OpAccessChain %_ptr_Function_int %p %uint_1 + %349 = OpLoad %int %348 + %350 = OpIMul %int %349 %int_16 + %351 = OpIAdd %int %347 %350 + %352 = OpAccessChain %_ptr_Private_int %map %351 + %353 = OpLoad %int %352 + %354 = OpIEqual %bool %353 %int_0 + OpBranch %343 + %343 = OpLabel + %355 = OpPhi %bool %342 %337 %354 %344 + OpSelectionMerge %356 None + OpBranchConditional %355 %357 %356 + %357 = OpLabel + %358 = OpLoad %int %d + %359 = OpISub %int %358 %int_1 + OpStore %d %359 + %360 = OpAccessChain %_ptr_Function_int %p %uint_0 + %361 = OpLoad %int %360 + %362 = OpAccessChain %_ptr_Function_int %p %uint_1 + %363 = OpLoad %int %362 + %364 = OpIMul %int %363 %int_16 + %365 = OpIAdd %int %361 %364 + %366 = OpAccessChain %_ptr_Private_int %map %365 + OpStore %366 %int_1 + %367 = OpAccessChain %_ptr_Function_int %p %uint_0 + %368 = OpLoad %int %367 + %369 = OpIAdd %int %368 %int_1 + %370 = OpAccessChain %_ptr_Function_int %p %uint_1 + %371 = OpLoad %int %370 + %372 = OpIMul %int %371 %int_16 + %373 = OpIAdd %int %369 %372 + %374 = OpAccessChain %_ptr_Private_int %map %373 + OpStore %374 %int_1 + %375 = OpAccessChain %_ptr_Function_int %p %uint_0 + %376 = OpLoad %int %375 + %377 = OpIAdd %int %376 %int_2 + %378 = OpAccessChain %_ptr_Function_int %p %uint_1 + %379 = OpLoad %int %378 + %380 = OpIMul %int %379 %int_16 + %381 = OpIAdd %int %377 %380 + %382 = OpAccessChain %_ptr_Private_int %map %381 + OpStore %382 %int_1 + %383 = OpAccessChain %_ptr_Function_int %p %uint_0 + %384 = OpLoad %int %383 + %385 = OpIAdd %int %384 %int_2 + %386 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %386 %385 + OpBranch %356 + %356 = OpLabel + %387 = OpLoad %int %d + %388 = OpSGreaterThanEqual %bool %387 %int_0 + OpSelectionMerge %389 None + OpBranchConditional %388 %390 %389 + %390 = OpLabel + %391 = OpAccessChain %_ptr_Function_int %p %uint_1 + %392 = OpLoad %int %391 + %393 = OpSLessThan %bool %392 %int_14 + OpBranch %389 + %389 = OpLabel + %394 = OpPhi %bool %388 %356 %393 %390 + OpSelectionMerge %395 None + OpBranchConditional %394 %396 %395 + %396 = OpLabel + %397 = OpAccessChain %_ptr_Function_int %p %uint_0 + %398 = OpLoad %int %397 + %399 = OpAccessChain %_ptr_Function_int %p %uint_1 + %400 = OpLoad %int %399 + %401 = OpIAdd %int %400 %int_2 + %402 = OpIMul %int %401 %int_16 + %403 = OpIAdd %int %398 %402 + %404 = OpAccessChain %_ptr_Private_int %map %403 + %405 = OpLoad %int %404 + %406 = OpIEqual %bool %405 %int_0 + OpBranch %395 + %395 = OpLabel + %407 = OpPhi %bool %394 %389 %406 %396 + OpSelectionMerge %408 None + OpBranchConditional %407 %409 %408 + %409 = OpLabel + %410 = OpLoad %int %d + %411 = OpISub %int %410 %int_1 + OpStore %d %411 + %412 = OpAccessChain %_ptr_Function_int %p %uint_0 + %413 = OpLoad %int %412 + %414 = OpAccessChain %_ptr_Function_int %p %uint_1 + %415 = OpLoad %int %414 + %416 = OpIMul %int %415 %int_16 + %417 = OpIAdd %int %413 %416 + %418 = OpAccessChain %_ptr_Private_int %map %417 + OpStore %418 %int_1 + %419 = OpAccessChain %_ptr_Function_int %p %uint_0 + %420 = OpLoad %int %419 + %421 = OpAccessChain %_ptr_Function_int %p %uint_1 + %422 = OpLoad %int %421 + %423 = OpIAdd %int %422 %int_1 + %424 = OpIMul %int %423 %int_16 + %425 = OpIAdd %int %420 %424 + %426 = OpAccessChain %_ptr_Private_int %map %425 + OpStore %426 %int_1 + %427 = OpAccessChain %_ptr_Function_int %p %uint_0 + %428 = OpLoad %int %427 + %429 = OpAccessChain %_ptr_Function_int %p %uint_1 + %430 = OpLoad %int %429 + %431 = OpIAdd %int %430 %int_2 + %432 = OpIMul %int %431 %int_16 + %433 = OpIAdd %int %428 %432 + %434 = OpAccessChain %_ptr_Private_int %map %433 + OpStore %434 %int_1 + %435 = OpAccessChain %_ptr_Function_int %p %uint_1 + %436 = OpLoad %int %435 + %437 = OpIAdd %int %436 %int_2 + %438 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %438 %437 + OpBranch %408 + %408 = OpLabel + OpBranch %179 + %179 = OpLabel + %439 = OpAccessChain %_ptr_Function_int %ipos %uint_1 + %440 = OpLoad %int %439 + %441 = OpIMul %int %440 %int_16 + %442 = OpAccessChain %_ptr_Function_int %ipos %uint_0 + %443 = OpLoad %int %442 + %444 = OpIAdd %int %441 %443 + %445 = OpAccessChain %_ptr_Private_int %map %444 + %446 = OpLoad %int %445 + %447 = OpIEqual %bool %446 %int_1 + OpSelectionMerge %448 None + OpBranchConditional %447 %449 %448 + %449 = OpLabel + OpStore %_GLF_color %53 + OpReturn + %448 = OpLabel + OpBranch %92 + %92 = OpLabel + %450 = OpLoad %bool %canwalk + OpBranchConditional %450 %90 %91 + %91 = OpLabel + OpStore %_GLF_color %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..d8420f8fb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.hlsl @@ -0,0 +1,309 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static int map[256] = (int[256])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float2x4 x_60 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int i = 0; + int2 p = int2(0, 0); + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + const float4 x_63 = gl_FragCoord; + const float2 x_67 = asfloat(x_7[0].xy); + const int x_68 = -((256 - 14)); + pos = (float2(x_63.x, x_63.y) / x_67); + const float x_71 = pos.x; + const float x_75 = pos.y; + ipos = int2(int((x_71 * 16.0f)), int((x_75 * 16.0f))); + i = 0; + { + for(; (i < 256); i = (i + 1)) { + map[i] = 0; + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_110 = false; + bool x_130 = false; + bool x_150 = false; + bool x_171 = false; + bool x_111_phi = false; + bool x_131_phi = false; + bool x_151_phi = false; + bool x_172_phi = false; + v = (v + 1); + directions = 0; + const int x_97 = p.x; + const bool x_98 = (x_97 > 0); + x_111_phi = x_98; + if (x_98) { + const int x_102 = p.x; + const int x_105 = p.y; + const int x_109 = map[((x_102 - 2) + (x_105 * 16))]; + x_110 = (x_109 == 0); + x_111_phi = x_110; + } + if (x_111_phi) { + directions = (directions + 1); + } + const int x_117 = p.y; + const bool x_118 = (x_117 > 0); + x_131_phi = x_118; + if (x_118) { + const int x_122 = p.x; + const int x_124 = p.y; + const int x_129 = map[(x_122 + ((x_124 - 2) * 16))]; + x_130 = (x_129 == 0); + x_131_phi = x_130; + } + if (x_131_phi) { + directions = (directions + 1); + } + const int x_137 = p.x; + const bool x_138 = (x_137 < 14); + x_151_phi = x_138; + if (x_138) { + const int x_142 = p.x; + const int x_145 = p.y; + const int x_149 = map[((x_142 + 2) + (x_145 * 16))]; + x_150 = (x_149 == 0); + x_151_phi = x_150; + } + if (x_151_phi) { + directions = (directions + 1); + } + const int x_156 = (256 - x_68); + const int x_158 = p.y; + const bool x_159 = (x_158 < 14); + x_172_phi = x_159; + if (x_159) { + const int x_163 = p.x; + const int x_165 = p.y; + const int x_170 = map[(x_163 + ((x_165 + 2) * 16))]; + x_171 = (x_170 == 0); + x_172_phi = x_171; + } + if (x_172_phi) { + directions = (directions + 1); + } + bool x_237 = false; + bool x_250 = false; + bool x_289 = false; + bool x_302 = false; + bool x_341 = false; + bool x_354 = false; + bool x_393 = false; + bool x_406 = false; + bool x_238_phi = false; + bool x_251_phi = false; + bool x_290_phi = false; + bool x_303_phi = false; + bool x_342_phi = false; + bool x_355_phi = false; + bool x_394_phi = false; + bool x_407_phi = false; + if ((directions == 0)) { + canwalk = false; + i = 0; + while (true) { + const int x_186 = i; + if ((x_186 < 8)) { + } else { + break; + } + j = 0; + const int x_189 = (x_156 - x_186); + x_60 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + if (false) { + { + i = (i + 1); + } + continue; + } + { + for(; (j < 8); j = (j + 1)) { + const int x_204 = map[((j * 2) + ((i * 2) * 16))]; + if ((x_204 == 0)) { + p.x = (j * 2); + p.y = (i * 2); + canwalk = true; + } + } + } + { + i = (i + 1); + } + } + const int x_219 = p.x; + const int x_221 = p.y; + map[(x_219 + (x_221 * 16))] = 1; + } else { + d = (v % directions); + v = (v + directions); + const bool x_232 = (d >= 0); + x_238_phi = x_232; + if (x_232) { + const int x_236 = p.x; + x_237 = (x_236 > 0); + x_238_phi = x_237; + } + const bool x_238 = x_238_phi; + x_251_phi = x_238; + if (x_238) { + const int x_242 = p.x; + const int x_245 = p.y; + const int x_249 = map[((x_242 - 2) + (x_245 * 16))]; + x_250 = (x_249 == 0); + x_251_phi = x_250; + } + if (x_251_phi) { + d = (d - 1); + const int x_257 = p.x; + const int x_259 = p.y; + map[(x_257 + (x_259 * 16))] = 1; + const int x_264 = p.x; + const int x_267 = p.y; + map[((x_264 - 1) + (x_267 * 16))] = 1; + const int x_272 = p.x; + const int x_275 = p.y; + map[((x_272 - 2) + (x_275 * 16))] = 1; + const int x_280 = p.x; + p.x = (x_280 - 2); + } + const bool x_284 = (d >= 0); + x_290_phi = x_284; + if (x_284) { + const int x_288 = p.y; + x_289 = (x_288 > 0); + x_290_phi = x_289; + } + const bool x_290 = x_290_phi; + x_303_phi = x_290; + if (x_290) { + const int x_294 = p.x; + const int x_296 = p.y; + const int x_301 = map[(x_294 + ((x_296 - 2) * 16))]; + x_302 = (x_301 == 0); + x_303_phi = x_302; + } + if (x_303_phi) { + d = (d - 1); + const int x_309 = p.x; + const int x_311 = p.y; + map[(x_309 + (x_311 * 16))] = 1; + const int x_316 = p.x; + const int x_318 = p.y; + map[(x_316 + ((x_318 - 1) * 16))] = 1; + const int x_324 = p.x; + const int x_326 = p.y; + map[(x_324 + ((x_326 - 2) * 16))] = 1; + const int x_332 = p.y; + p.y = (x_332 - 2); + } + const bool x_336 = (d >= 0); + x_342_phi = x_336; + if (x_336) { + const int x_340 = p.x; + x_341 = (x_340 < 14); + x_342_phi = x_341; + } + const bool x_342 = x_342_phi; + x_355_phi = x_342; + if (x_342) { + const int x_346 = p.x; + const int x_349 = p.y; + const int x_353 = map[((x_346 + 2) + (x_349 * 16))]; + x_354 = (x_353 == 0); + x_355_phi = x_354; + } + if (x_355_phi) { + d = (d - 1); + const int x_361 = p.x; + const int x_363 = p.y; + map[(x_361 + (x_363 * 16))] = 1; + const int x_368 = p.x; + const int x_371 = p.y; + map[((x_368 + 1) + (x_371 * 16))] = 1; + const int x_376 = p.x; + const int x_379 = p.y; + map[((x_376 + 2) + (x_379 * 16))] = 1; + const int x_384 = p.x; + p.x = (x_384 + 2); + } + const bool x_388 = (d >= 0); + x_394_phi = x_388; + if (x_388) { + const int x_392 = p.y; + x_393 = (x_392 < 14); + x_394_phi = x_393; + } + const bool x_394 = x_394_phi; + x_407_phi = x_394; + if (x_394) { + const int x_398 = p.x; + const int x_400 = p.y; + const int x_405 = map[(x_398 + ((x_400 + 2) * 16))]; + x_406 = (x_405 == 0); + x_407_phi = x_406; + } + if (x_407_phi) { + d = (d - 1); + const int x_413 = p.x; + const int x_415 = p.y; + map[(x_413 + (x_415 * 16))] = 1; + const int x_420 = p.x; + const int x_422 = p.y; + map[(x_420 + ((x_422 + 1) * 16))] = 1; + const int x_428 = p.x; + const int x_430 = p.y; + map[(x_428 + ((x_430 + 2) * 16))] = 1; + const int x_436 = p.y; + p.y = (x_436 + 2); + } + } + const int x_440 = ipos.y; + const int x_443 = ipos.x; + const int x_446 = map[((x_440 * 16) + x_443)]; + if ((x_446 == 1)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + if (canwalk) { + } else { + break; + } + } + } + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.msl new file mode 100644 index 0000000000..192b6aa28d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.msl @@ -0,0 +1,359 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6, thread float2x4* const tint_symbol_7, thread float4* const tint_symbol_8) { + float2 pos = 0.0f; + int2 ipos = 0; + int i = 0; + int2 p = 0; + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + float4 const x_63 = *(tint_symbol_5); + float2 const x_67 = x_7.resolution; + int const x_68 = -((256 - 14)); + pos = (float2(x_63.x, x_63.y) / x_67); + float const x_71 = pos.x; + float const x_75 = pos.y; + ipos = int2(int((x_71 * 16.0f)), int((x_75 * 16.0f))); + i = 0; + while (true) { + int const x_83 = i; + if ((x_83 < 256)) { + } else { + break; + } + int const x_86 = i; + (*(tint_symbol_6)).arr[x_86] = 0; + { + int const x_88 = i; + i = (x_88 + 1); + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_110 = false; + bool x_130 = false; + bool x_150 = false; + bool x_171 = false; + bool x_111_phi = false; + bool x_131_phi = false; + bool x_151_phi = false; + bool x_172_phi = false; + int const x_94 = v; + v = (x_94 + 1); + directions = 0; + int const x_97 = p.x; + bool const x_98 = (x_97 > 0); + x_111_phi = x_98; + if (x_98) { + int const x_102 = p.x; + int const x_105 = p.y; + int const x_109 = (*(tint_symbol_6)).arr[((x_102 - 2) + (x_105 * 16))]; + x_110 = (x_109 == 0); + x_111_phi = x_110; + } + bool const x_111 = x_111_phi; + if (x_111) { + int const x_114 = directions; + directions = (x_114 + 1); + } + int const x_117 = p.y; + bool const x_118 = (x_117 > 0); + x_131_phi = x_118; + if (x_118) { + int const x_122 = p.x; + int const x_124 = p.y; + int const x_129 = (*(tint_symbol_6)).arr[(x_122 + ((x_124 - 2) * 16))]; + x_130 = (x_129 == 0); + x_131_phi = x_130; + } + bool const x_131 = x_131_phi; + if (x_131) { + int const x_134 = directions; + directions = (x_134 + 1); + } + int const x_137 = p.x; + bool const x_138 = (x_137 < 14); + x_151_phi = x_138; + if (x_138) { + int const x_142 = p.x; + int const x_145 = p.y; + int const x_149 = (*(tint_symbol_6)).arr[((x_142 + 2) + (x_145 * 16))]; + x_150 = (x_149 == 0); + x_151_phi = x_150; + } + bool const x_151 = x_151_phi; + if (x_151) { + int const x_154 = directions; + directions = (x_154 + 1); + } + int const x_156 = (256 - x_68); + int const x_158 = p.y; + bool const x_159 = (x_158 < 14); + x_172_phi = x_159; + if (x_159) { + int const x_163 = p.x; + int const x_165 = p.y; + int const x_170 = (*(tint_symbol_6)).arr[(x_163 + ((x_165 + 2) * 16))]; + x_171 = (x_170 == 0); + x_172_phi = x_171; + } + bool const x_172 = x_172_phi; + if (x_172) { + int const x_175 = directions; + directions = (x_175 + 1); + } + bool x_237 = false; + bool x_250 = false; + bool x_289 = false; + bool x_302 = false; + bool x_341 = false; + bool x_354 = false; + bool x_393 = false; + bool x_406 = false; + bool x_238_phi = false; + bool x_251_phi = false; + bool x_290_phi = false; + bool x_303_phi = false; + bool x_342_phi = false; + bool x_355_phi = false; + bool x_394_phi = false; + bool x_407_phi = false; + int const x_177 = directions; + if ((x_177 == 0)) { + canwalk = false; + i = 0; + while (true) { + int const x_186 = i; + if ((x_186 < 8)) { + } else { + break; + } + j = 0; + int const x_189 = (x_156 - x_186); + *(tint_symbol_7) = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + if (false) { + { + int const x_216 = i; + i = (x_216 + 1); + } + continue; + } + while (true) { + int const x_194 = j; + if ((x_194 < 8)) { + } else { + break; + } + int const x_197 = j; + int const x_199 = i; + int const x_204 = (*(tint_symbol_6)).arr[((x_197 * 2) + ((x_199 * 2) * 16))]; + if ((x_204 == 0)) { + int const x_208 = j; + p.x = (x_208 * 2); + int const x_211 = i; + p.y = (x_211 * 2); + canwalk = true; + } + { + int const x_214 = j; + j = (x_214 + 1); + } + } + { + int const x_216 = i; + i = (x_216 + 1); + } + } + int const x_219 = p.x; + int const x_221 = p.y; + (*(tint_symbol_6)).arr[(x_219 + (x_221 * 16))] = 1; + } else { + int const x_225 = v; + int const x_226 = directions; + d = (x_225 % x_226); + int const x_228 = directions; + int const x_229 = v; + v = (x_229 + x_228); + int const x_231 = d; + bool const x_232 = (x_231 >= 0); + x_238_phi = x_232; + if (x_232) { + int const x_236 = p.x; + x_237 = (x_236 > 0); + x_238_phi = x_237; + } + bool const x_238 = x_238_phi; + x_251_phi = x_238; + if (x_238) { + int const x_242 = p.x; + int const x_245 = p.y; + int const x_249 = (*(tint_symbol_6)).arr[((x_242 - 2) + (x_245 * 16))]; + x_250 = (x_249 == 0); + x_251_phi = x_250; + } + bool const x_251 = x_251_phi; + if (x_251) { + int const x_254 = d; + d = (x_254 - 1); + int const x_257 = p.x; + int const x_259 = p.y; + (*(tint_symbol_6)).arr[(x_257 + (x_259 * 16))] = 1; + int const x_264 = p.x; + int const x_267 = p.y; + (*(tint_symbol_6)).arr[((x_264 - 1) + (x_267 * 16))] = 1; + int const x_272 = p.x; + int const x_275 = p.y; + (*(tint_symbol_6)).arr[((x_272 - 2) + (x_275 * 16))] = 1; + int const x_280 = p.x; + p.x = (x_280 - 2); + } + int const x_283 = d; + bool const x_284 = (x_283 >= 0); + x_290_phi = x_284; + if (x_284) { + int const x_288 = p.y; + x_289 = (x_288 > 0); + x_290_phi = x_289; + } + bool const x_290 = x_290_phi; + x_303_phi = x_290; + if (x_290) { + int const x_294 = p.x; + int const x_296 = p.y; + int const x_301 = (*(tint_symbol_6)).arr[(x_294 + ((x_296 - 2) * 16))]; + x_302 = (x_301 == 0); + x_303_phi = x_302; + } + bool const x_303 = x_303_phi; + if (x_303) { + int const x_306 = d; + d = (x_306 - 1); + int const x_309 = p.x; + int const x_311 = p.y; + (*(tint_symbol_6)).arr[(x_309 + (x_311 * 16))] = 1; + int const x_316 = p.x; + int const x_318 = p.y; + (*(tint_symbol_6)).arr[(x_316 + ((x_318 - 1) * 16))] = 1; + int const x_324 = p.x; + int const x_326 = p.y; + (*(tint_symbol_6)).arr[(x_324 + ((x_326 - 2) * 16))] = 1; + int const x_332 = p.y; + p.y = (x_332 - 2); + } + int const x_335 = d; + bool const x_336 = (x_335 >= 0); + x_342_phi = x_336; + if (x_336) { + int const x_340 = p.x; + x_341 = (x_340 < 14); + x_342_phi = x_341; + } + bool const x_342 = x_342_phi; + x_355_phi = x_342; + if (x_342) { + int const x_346 = p.x; + int const x_349 = p.y; + int const x_353 = (*(tint_symbol_6)).arr[((x_346 + 2) + (x_349 * 16))]; + x_354 = (x_353 == 0); + x_355_phi = x_354; + } + bool const x_355 = x_355_phi; + if (x_355) { + int const x_358 = d; + d = (x_358 - 1); + int const x_361 = p.x; + int const x_363 = p.y; + (*(tint_symbol_6)).arr[(x_361 + (x_363 * 16))] = 1; + int const x_368 = p.x; + int const x_371 = p.y; + (*(tint_symbol_6)).arr[((x_368 + 1) + (x_371 * 16))] = 1; + int const x_376 = p.x; + int const x_379 = p.y; + (*(tint_symbol_6)).arr[((x_376 + 2) + (x_379 * 16))] = 1; + int const x_384 = p.x; + p.x = (x_384 + 2); + } + int const x_387 = d; + bool const x_388 = (x_387 >= 0); + x_394_phi = x_388; + if (x_388) { + int const x_392 = p.y; + x_393 = (x_392 < 14); + x_394_phi = x_393; + } + bool const x_394 = x_394_phi; + x_407_phi = x_394; + if (x_394) { + int const x_398 = p.x; + int const x_400 = p.y; + int const x_405 = (*(tint_symbol_6)).arr[(x_398 + ((x_400 + 2) * 16))]; + x_406 = (x_405 == 0); + x_407_phi = x_406; + } + bool const x_407 = x_407_phi; + if (x_407) { + int const x_410 = d; + d = (x_410 - 1); + int const x_413 = p.x; + int const x_415 = p.y; + (*(tint_symbol_6)).arr[(x_413 + (x_415 * 16))] = 1; + int const x_420 = p.x; + int const x_422 = p.y; + (*(tint_symbol_6)).arr[(x_420 + ((x_422 + 1) * 16))] = 1; + int const x_428 = p.x; + int const x_430 = p.y; + (*(tint_symbol_6)).arr[(x_428 + ((x_430 + 2) * 16))] = 1; + int const x_436 = p.y; + p.y = (x_436 + 2); + } + } + int const x_440 = ipos.y; + int const x_443 = ipos.x; + int const x_446 = (*(tint_symbol_6)).arr[((x_440 * 16) + x_443)]; + if ((x_446 == 1)) { + *(tint_symbol_8) = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + bool const x_450 = canwalk; + if (x_450) { + } else { + break; + } + } + } + *(tint_symbol_8) = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread tint_array_wrapper tint_symbol_10 = {}; + thread float2x4 tint_symbol_11 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..efc1a09454 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.spvasm @@ -0,0 +1,791 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 520 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %map "map" + OpName %x_GLF_color "x_GLF_color" + OpName %x_60 "x_60" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %ipos "ipos" + OpName %i "i" + OpName %p "p" + OpName %canwalk "canwalk" + OpName %v "v" + OpName %directions "directions" + OpName %j "j" + OpName %d "d" + OpName %x_110 "x_110" + OpName %x_130 "x_130" + OpName %x_150 "x_150" + OpName %x_171 "x_171" + OpName %x_111_phi "x_111_phi" + OpName %x_131_phi "x_131_phi" + OpName %x_151_phi "x_151_phi" + OpName %x_172_phi "x_172_phi" + OpName %x_237 "x_237" + OpName %x_250 "x_250" + OpName %x_289 "x_289" + OpName %x_302 "x_302" + OpName %x_341 "x_341" + OpName %x_354 "x_354" + OpName %x_393 "x_393" + OpName %x_406 "x_406" + OpName %x_238_phi "x_238_phi" + OpName %x_251_phi "x_251_phi" + OpName %x_290_phi "x_290_phi" + OpName %x_303_phi "x_303_phi" + OpName %x_342_phi "x_342_phi" + OpName %x_355_phi "x_355_phi" + OpName %x_394_phi "x_394_phi" + OpName %x_407_phi "x_407_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Private__arr_int_uint_256 = OpTypePointer Private %_arr_int_uint_256 + %16 = OpConstantNull %_arr_int_uint_256 + %map = OpVariable %_ptr_Private__arr_int_uint_256 Private %16 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%mat2v4float = OpTypeMatrix %v4float 2 + %float_0 = OpConstant %float 0 + %20 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %21 = OpConstantComposite %mat2v4float %20 %20 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %x_60 = OpVariable %_ptr_Private_mat2v4float Private %21 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %28 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %34 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %38 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %41 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %46 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %int_256 = OpConstant %int 256 + %int_14 = OpConstant %int 14 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_16 = OpConstant %float 16 + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %92 = OpConstantComposite %v2int %int_0 %int_0 + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %int_16 = OpConstant %int 16 + %false = OpConstantFalse %bool + %int_8 = OpConstant %int 8 + %float_1 = OpConstant %float 1 + %501 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %506 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %507 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %28 + %31 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %34 + %ipos = OpVariable %_ptr_Function_v2int Function %38 + %i = OpVariable %_ptr_Function_int Function %41 + %p = OpVariable %_ptr_Function_v2int Function %38 + %canwalk = OpVariable %_ptr_Function_bool Function %46 + %v = OpVariable %_ptr_Function_int Function %41 + %directions = OpVariable %_ptr_Function_int Function %41 + %j = OpVariable %_ptr_Function_int Function %41 + %d = OpVariable %_ptr_Function_int Function %41 + %x_110 = OpVariable %_ptr_Function_bool Function %46 + %x_130 = OpVariable %_ptr_Function_bool Function %46 + %x_150 = OpVariable %_ptr_Function_bool Function %46 + %x_171 = OpVariable %_ptr_Function_bool Function %46 + %x_111_phi = OpVariable %_ptr_Function_bool Function %46 + %x_131_phi = OpVariable %_ptr_Function_bool Function %46 + %x_151_phi = OpVariable %_ptr_Function_bool Function %46 + %x_172_phi = OpVariable %_ptr_Function_bool Function %46 + %x_237 = OpVariable %_ptr_Function_bool Function %46 + %x_250 = OpVariable %_ptr_Function_bool Function %46 + %x_289 = OpVariable %_ptr_Function_bool Function %46 + %x_302 = OpVariable %_ptr_Function_bool Function %46 + %x_341 = OpVariable %_ptr_Function_bool Function %46 + %x_354 = OpVariable %_ptr_Function_bool Function %46 + %x_393 = OpVariable %_ptr_Function_bool Function %46 + %x_406 = OpVariable %_ptr_Function_bool Function %46 + %x_238_phi = OpVariable %_ptr_Function_bool Function %46 + %x_251_phi = OpVariable %_ptr_Function_bool Function %46 + %x_290_phi = OpVariable %_ptr_Function_bool Function %46 + %x_303_phi = OpVariable %_ptr_Function_bool Function %46 + %x_342_phi = OpVariable %_ptr_Function_bool Function %46 + %x_355_phi = OpVariable %_ptr_Function_bool Function %46 + %x_394_phi = OpVariable %_ptr_Function_bool Function %46 + %x_407_phi = OpVariable %_ptr_Function_bool Function %46 + %51 = OpLoad %v4float %gl_FragCoord + %54 = OpAccessChain %_ptr_Uniform_v2float %x_7 %uint_0 + %55 = OpLoad %v2float %54 + %59 = OpISub %int %int_256 %int_14 + %56 = OpSNegate %int %59 + %60 = OpCompositeExtract %float %51 0 + %61 = OpCompositeExtract %float %51 1 + %62 = OpCompositeConstruct %v2float %60 %61 + %63 = OpFDiv %v2float %62 %55 + OpStore %pos %63 + %65 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %66 = OpLoad %float %65 + %68 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %69 = OpLoad %float %68 + %72 = OpFMul %float %66 %float_16 + %70 = OpConvertFToS %int %72 + %74 = OpFMul %float %69 %float_16 + %73 = OpConvertFToS %int %74 + %75 = OpCompositeConstruct %v2int %70 %73 + OpStore %ipos %75 + OpStore %i %int_0 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %78 %79 None + OpBranch %80 + %80 = OpLabel + %81 = OpLoad %int %i + %82 = OpSLessThan %bool %81 %int_256 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + OpBranch %83 + %85 = OpLabel + OpBranch %78 + %83 = OpLabel + %86 = OpLoad %int %i + %88 = OpAccessChain %_ptr_Private_int %map %86 + OpStore %88 %int_0 + OpBranch %79 + %79 = OpLabel + %89 = OpLoad %int %i + %91 = OpIAdd %int %89 %int_1 + OpStore %i %91 + OpBranch %77 + %78 = OpLabel + OpStore %p %92 + OpStore %canwalk %true + OpStore %v %int_0 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %95 %96 None + OpBranch %97 + %97 = OpLabel + %106 = OpLoad %int %v + %107 = OpIAdd %int %106 %int_1 + OpStore %v %107 + OpStore %directions %int_0 + %108 = OpAccessChain %_ptr_Function_int %p %uint_0 + %109 = OpLoad %int %108 + %110 = OpSGreaterThan %bool %109 %int_0 + OpStore %x_111_phi %110 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %111 + %112 = OpLabel + %113 = OpAccessChain %_ptr_Function_int %p %uint_0 + %114 = OpLoad %int %113 + %115 = OpAccessChain %_ptr_Function_int %p %uint_1 + %116 = OpLoad %int %115 + %118 = OpISub %int %114 %int_2 + %120 = OpIMul %int %116 %int_16 + %121 = OpIAdd %int %118 %120 + %122 = OpAccessChain %_ptr_Private_int %map %121 + %123 = OpLoad %int %122 + %124 = OpIEqual %bool %123 %int_0 + OpStore %x_110 %124 + %125 = OpLoad %bool %x_110 + OpStore %x_111_phi %125 + OpBranch %111 + %111 = OpLabel + %126 = OpLoad %bool %x_111_phi + OpSelectionMerge %127 None + OpBranchConditional %126 %128 %127 + %128 = OpLabel + %129 = OpLoad %int %directions + %130 = OpIAdd %int %129 %int_1 + OpStore %directions %130 + OpBranch %127 + %127 = OpLabel + %131 = OpAccessChain %_ptr_Function_int %p %uint_1 + %132 = OpLoad %int %131 + %133 = OpSGreaterThan %bool %132 %int_0 + OpStore %x_131_phi %133 + OpSelectionMerge %134 None + OpBranchConditional %133 %135 %134 + %135 = OpLabel + %136 = OpAccessChain %_ptr_Function_int %p %uint_0 + %137 = OpLoad %int %136 + %138 = OpAccessChain %_ptr_Function_int %p %uint_1 + %139 = OpLoad %int %138 + %140 = OpISub %int %139 %int_2 + %141 = OpIMul %int %140 %int_16 + %142 = OpIAdd %int %137 %141 + %143 = OpAccessChain %_ptr_Private_int %map %142 + %144 = OpLoad %int %143 + %145 = OpIEqual %bool %144 %int_0 + OpStore %x_130 %145 + %146 = OpLoad %bool %x_130 + OpStore %x_131_phi %146 + OpBranch %134 + %134 = OpLabel + %147 = OpLoad %bool %x_131_phi + OpSelectionMerge %148 None + OpBranchConditional %147 %149 %148 + %149 = OpLabel + %150 = OpLoad %int %directions + %151 = OpIAdd %int %150 %int_1 + OpStore %directions %151 + OpBranch %148 + %148 = OpLabel + %152 = OpAccessChain %_ptr_Function_int %p %uint_0 + %153 = OpLoad %int %152 + %154 = OpSLessThan %bool %153 %int_14 + OpStore %x_151_phi %154 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %155 + %156 = OpLabel + %157 = OpAccessChain %_ptr_Function_int %p %uint_0 + %158 = OpLoad %int %157 + %159 = OpAccessChain %_ptr_Function_int %p %uint_1 + %160 = OpLoad %int %159 + %161 = OpIAdd %int %158 %int_2 + %162 = OpIMul %int %160 %int_16 + %163 = OpIAdd %int %161 %162 + %164 = OpAccessChain %_ptr_Private_int %map %163 + %165 = OpLoad %int %164 + %166 = OpIEqual %bool %165 %int_0 + OpStore %x_150 %166 + %167 = OpLoad %bool %x_150 + OpStore %x_151_phi %167 + OpBranch %155 + %155 = OpLabel + %168 = OpLoad %bool %x_151_phi + OpSelectionMerge %169 None + OpBranchConditional %168 %170 %169 + %170 = OpLabel + %171 = OpLoad %int %directions + %172 = OpIAdd %int %171 %int_1 + OpStore %directions %172 + OpBranch %169 + %169 = OpLabel + %173 = OpISub %int %int_256 %56 + %174 = OpAccessChain %_ptr_Function_int %p %uint_1 + %175 = OpLoad %int %174 + %176 = OpSLessThan %bool %175 %int_14 + OpStore %x_172_phi %176 + OpSelectionMerge %177 None + OpBranchConditional %176 %178 %177 + %178 = OpLabel + %179 = OpAccessChain %_ptr_Function_int %p %uint_0 + %180 = OpLoad %int %179 + %181 = OpAccessChain %_ptr_Function_int %p %uint_1 + %182 = OpLoad %int %181 + %183 = OpIAdd %int %182 %int_2 + %184 = OpIMul %int %183 %int_16 + %185 = OpIAdd %int %180 %184 + %186 = OpAccessChain %_ptr_Private_int %map %185 + %187 = OpLoad %int %186 + %188 = OpIEqual %bool %187 %int_0 + OpStore %x_171 %188 + %189 = OpLoad %bool %x_171 + OpStore %x_172_phi %189 + OpBranch %177 + %177 = OpLabel + %190 = OpLoad %bool %x_172_phi + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %191 + %192 = OpLabel + %193 = OpLoad %int %directions + %194 = OpIAdd %int %193 %int_1 + OpStore %directions %194 + OpBranch %191 + %191 = OpLabel + %211 = OpLoad %int %directions + %212 = OpIEqual %bool %211 %int_0 + OpSelectionMerge %213 None + OpBranchConditional %212 %214 %215 + %214 = OpLabel + OpStore %canwalk %false + OpStore %i %int_0 + OpBranch %217 + %217 = OpLabel + OpLoopMerge %218 %219 None + OpBranch %220 + %220 = OpLabel + %221 = OpLoad %int %i + %223 = OpSLessThan %bool %221 %int_8 + OpSelectionMerge %224 None + OpBranchConditional %223 %225 %226 + %225 = OpLabel + OpBranch %224 + %226 = OpLabel + OpBranch %218 + %224 = OpLabel + OpStore %j %int_0 + %227 = OpISub %int %173 %221 + OpStore %x_60 %21 + OpSelectionMerge %228 None + OpBranchConditional %false %229 %228 + %229 = OpLabel + OpBranch %219 + %228 = OpLabel + OpBranch %230 + %230 = OpLabel + OpLoopMerge %231 %232 None + OpBranch %233 + %233 = OpLabel + %234 = OpLoad %int %j + %235 = OpSLessThan %bool %234 %int_8 + OpSelectionMerge %236 None + OpBranchConditional %235 %237 %238 + %237 = OpLabel + OpBranch %236 + %238 = OpLabel + OpBranch %231 + %236 = OpLabel + %239 = OpLoad %int %j + %240 = OpLoad %int %i + %241 = OpIMul %int %239 %int_2 + %242 = OpIMul %int %240 %int_2 + %243 = OpIMul %int %242 %int_16 + %244 = OpIAdd %int %241 %243 + %245 = OpAccessChain %_ptr_Private_int %map %244 + %246 = OpLoad %int %245 + %247 = OpIEqual %bool %246 %int_0 + OpSelectionMerge %248 None + OpBranchConditional %247 %249 %248 + %249 = OpLabel + %250 = OpLoad %int %j + %251 = OpAccessChain %_ptr_Function_int %p %uint_0 + %252 = OpIMul %int %250 %int_2 + OpStore %251 %252 + %253 = OpLoad %int %i + %254 = OpAccessChain %_ptr_Function_int %p %uint_1 + %255 = OpIMul %int %253 %int_2 + OpStore %254 %255 + OpStore %canwalk %true + OpBranch %248 + %248 = OpLabel + OpBranch %232 + %232 = OpLabel + %256 = OpLoad %int %j + %257 = OpIAdd %int %256 %int_1 + OpStore %j %257 + OpBranch %230 + %231 = OpLabel + OpBranch %219 + %219 = OpLabel + %258 = OpLoad %int %i + %259 = OpIAdd %int %258 %int_1 + OpStore %i %259 + OpBranch %217 + %218 = OpLabel + %260 = OpAccessChain %_ptr_Function_int %p %uint_0 + %261 = OpLoad %int %260 + %262 = OpAccessChain %_ptr_Function_int %p %uint_1 + %263 = OpLoad %int %262 + %264 = OpIMul %int %263 %int_16 + %265 = OpIAdd %int %261 %264 + %266 = OpAccessChain %_ptr_Private_int %map %265 + OpStore %266 %int_1 + OpBranch %213 + %215 = OpLabel + %267 = OpLoad %int %v + %268 = OpLoad %int %directions + %269 = OpSMod %int %267 %268 + OpStore %d %269 + %270 = OpLoad %int %directions + %271 = OpLoad %int %v + %272 = OpIAdd %int %271 %270 + OpStore %v %272 + %273 = OpLoad %int %d + %274 = OpSGreaterThanEqual %bool %273 %int_0 + OpStore %x_238_phi %274 + OpSelectionMerge %275 None + OpBranchConditional %274 %276 %275 + %276 = OpLabel + %277 = OpAccessChain %_ptr_Function_int %p %uint_0 + %278 = OpLoad %int %277 + %279 = OpSGreaterThan %bool %278 %int_0 + OpStore %x_237 %279 + %280 = OpLoad %bool %x_237 + OpStore %x_238_phi %280 + OpBranch %275 + %275 = OpLabel + %281 = OpLoad %bool %x_238_phi + OpStore %x_251_phi %281 + OpSelectionMerge %282 None + OpBranchConditional %281 %283 %282 + %283 = OpLabel + %284 = OpAccessChain %_ptr_Function_int %p %uint_0 + %285 = OpLoad %int %284 + %286 = OpAccessChain %_ptr_Function_int %p %uint_1 + %287 = OpLoad %int %286 + %288 = OpISub %int %285 %int_2 + %289 = OpIMul %int %287 %int_16 + %290 = OpIAdd %int %288 %289 + %291 = OpAccessChain %_ptr_Private_int %map %290 + %292 = OpLoad %int %291 + %293 = OpIEqual %bool %292 %int_0 + OpStore %x_250 %293 + %294 = OpLoad %bool %x_250 + OpStore %x_251_phi %294 + OpBranch %282 + %282 = OpLabel + %295 = OpLoad %bool %x_251_phi + OpSelectionMerge %296 None + OpBranchConditional %295 %297 %296 + %297 = OpLabel + %298 = OpLoad %int %d + %299 = OpISub %int %298 %int_1 + OpStore %d %299 + %300 = OpAccessChain %_ptr_Function_int %p %uint_0 + %301 = OpLoad %int %300 + %302 = OpAccessChain %_ptr_Function_int %p %uint_1 + %303 = OpLoad %int %302 + %304 = OpIMul %int %303 %int_16 + %305 = OpIAdd %int %301 %304 + %306 = OpAccessChain %_ptr_Private_int %map %305 + OpStore %306 %int_1 + %307 = OpAccessChain %_ptr_Function_int %p %uint_0 + %308 = OpLoad %int %307 + %309 = OpAccessChain %_ptr_Function_int %p %uint_1 + %310 = OpLoad %int %309 + %311 = OpISub %int %308 %int_1 + %312 = OpIMul %int %310 %int_16 + %313 = OpIAdd %int %311 %312 + %314 = OpAccessChain %_ptr_Private_int %map %313 + OpStore %314 %int_1 + %315 = OpAccessChain %_ptr_Function_int %p %uint_0 + %316 = OpLoad %int %315 + %317 = OpAccessChain %_ptr_Function_int %p %uint_1 + %318 = OpLoad %int %317 + %319 = OpISub %int %316 %int_2 + %320 = OpIMul %int %318 %int_16 + %321 = OpIAdd %int %319 %320 + %322 = OpAccessChain %_ptr_Private_int %map %321 + OpStore %322 %int_1 + %323 = OpAccessChain %_ptr_Function_int %p %uint_0 + %324 = OpLoad %int %323 + %325 = OpAccessChain %_ptr_Function_int %p %uint_0 + %326 = OpISub %int %324 %int_2 + OpStore %325 %326 + OpBranch %296 + %296 = OpLabel + %327 = OpLoad %int %d + %328 = OpSGreaterThanEqual %bool %327 %int_0 + OpStore %x_290_phi %328 + OpSelectionMerge %329 None + OpBranchConditional %328 %330 %329 + %330 = OpLabel + %331 = OpAccessChain %_ptr_Function_int %p %uint_1 + %332 = OpLoad %int %331 + %333 = OpSGreaterThan %bool %332 %int_0 + OpStore %x_289 %333 + %334 = OpLoad %bool %x_289 + OpStore %x_290_phi %334 + OpBranch %329 + %329 = OpLabel + %335 = OpLoad %bool %x_290_phi + OpStore %x_303_phi %335 + OpSelectionMerge %336 None + OpBranchConditional %335 %337 %336 + %337 = OpLabel + %338 = OpAccessChain %_ptr_Function_int %p %uint_0 + %339 = OpLoad %int %338 + %340 = OpAccessChain %_ptr_Function_int %p %uint_1 + %341 = OpLoad %int %340 + %342 = OpISub %int %341 %int_2 + %343 = OpIMul %int %342 %int_16 + %344 = OpIAdd %int %339 %343 + %345 = OpAccessChain %_ptr_Private_int %map %344 + %346 = OpLoad %int %345 + %347 = OpIEqual %bool %346 %int_0 + OpStore %x_302 %347 + %348 = OpLoad %bool %x_302 + OpStore %x_303_phi %348 + OpBranch %336 + %336 = OpLabel + %349 = OpLoad %bool %x_303_phi + OpSelectionMerge %350 None + OpBranchConditional %349 %351 %350 + %351 = OpLabel + %352 = OpLoad %int %d + %353 = OpISub %int %352 %int_1 + OpStore %d %353 + %354 = OpAccessChain %_ptr_Function_int %p %uint_0 + %355 = OpLoad %int %354 + %356 = OpAccessChain %_ptr_Function_int %p %uint_1 + %357 = OpLoad %int %356 + %358 = OpIMul %int %357 %int_16 + %359 = OpIAdd %int %355 %358 + %360 = OpAccessChain %_ptr_Private_int %map %359 + OpStore %360 %int_1 + %361 = OpAccessChain %_ptr_Function_int %p %uint_0 + %362 = OpLoad %int %361 + %363 = OpAccessChain %_ptr_Function_int %p %uint_1 + %364 = OpLoad %int %363 + %365 = OpISub %int %364 %int_1 + %366 = OpIMul %int %365 %int_16 + %367 = OpIAdd %int %362 %366 + %368 = OpAccessChain %_ptr_Private_int %map %367 + OpStore %368 %int_1 + %369 = OpAccessChain %_ptr_Function_int %p %uint_0 + %370 = OpLoad %int %369 + %371 = OpAccessChain %_ptr_Function_int %p %uint_1 + %372 = OpLoad %int %371 + %373 = OpISub %int %372 %int_2 + %374 = OpIMul %int %373 %int_16 + %375 = OpIAdd %int %370 %374 + %376 = OpAccessChain %_ptr_Private_int %map %375 + OpStore %376 %int_1 + %377 = OpAccessChain %_ptr_Function_int %p %uint_1 + %378 = OpLoad %int %377 + %379 = OpAccessChain %_ptr_Function_int %p %uint_1 + %380 = OpISub %int %378 %int_2 + OpStore %379 %380 + OpBranch %350 + %350 = OpLabel + %381 = OpLoad %int %d + %382 = OpSGreaterThanEqual %bool %381 %int_0 + OpStore %x_342_phi %382 + OpSelectionMerge %383 None + OpBranchConditional %382 %384 %383 + %384 = OpLabel + %385 = OpAccessChain %_ptr_Function_int %p %uint_0 + %386 = OpLoad %int %385 + %387 = OpSLessThan %bool %386 %int_14 + OpStore %x_341 %387 + %388 = OpLoad %bool %x_341 + OpStore %x_342_phi %388 + OpBranch %383 + %383 = OpLabel + %389 = OpLoad %bool %x_342_phi + OpStore %x_355_phi %389 + OpSelectionMerge %390 None + OpBranchConditional %389 %391 %390 + %391 = OpLabel + %392 = OpAccessChain %_ptr_Function_int %p %uint_0 + %393 = OpLoad %int %392 + %394 = OpAccessChain %_ptr_Function_int %p %uint_1 + %395 = OpLoad %int %394 + %396 = OpIAdd %int %393 %int_2 + %397 = OpIMul %int %395 %int_16 + %398 = OpIAdd %int %396 %397 + %399 = OpAccessChain %_ptr_Private_int %map %398 + %400 = OpLoad %int %399 + %401 = OpIEqual %bool %400 %int_0 + OpStore %x_354 %401 + %402 = OpLoad %bool %x_354 + OpStore %x_355_phi %402 + OpBranch %390 + %390 = OpLabel + %403 = OpLoad %bool %x_355_phi + OpSelectionMerge %404 None + OpBranchConditional %403 %405 %404 + %405 = OpLabel + %406 = OpLoad %int %d + %407 = OpISub %int %406 %int_1 + OpStore %d %407 + %408 = OpAccessChain %_ptr_Function_int %p %uint_0 + %409 = OpLoad %int %408 + %410 = OpAccessChain %_ptr_Function_int %p %uint_1 + %411 = OpLoad %int %410 + %412 = OpIMul %int %411 %int_16 + %413 = OpIAdd %int %409 %412 + %414 = OpAccessChain %_ptr_Private_int %map %413 + OpStore %414 %int_1 + %415 = OpAccessChain %_ptr_Function_int %p %uint_0 + %416 = OpLoad %int %415 + %417 = OpAccessChain %_ptr_Function_int %p %uint_1 + %418 = OpLoad %int %417 + %419 = OpIAdd %int %416 %int_1 + %420 = OpIMul %int %418 %int_16 + %421 = OpIAdd %int %419 %420 + %422 = OpAccessChain %_ptr_Private_int %map %421 + OpStore %422 %int_1 + %423 = OpAccessChain %_ptr_Function_int %p %uint_0 + %424 = OpLoad %int %423 + %425 = OpAccessChain %_ptr_Function_int %p %uint_1 + %426 = OpLoad %int %425 + %427 = OpIAdd %int %424 %int_2 + %428 = OpIMul %int %426 %int_16 + %429 = OpIAdd %int %427 %428 + %430 = OpAccessChain %_ptr_Private_int %map %429 + OpStore %430 %int_1 + %431 = OpAccessChain %_ptr_Function_int %p %uint_0 + %432 = OpLoad %int %431 + %433 = OpAccessChain %_ptr_Function_int %p %uint_0 + %434 = OpIAdd %int %432 %int_2 + OpStore %433 %434 + OpBranch %404 + %404 = OpLabel + %435 = OpLoad %int %d + %436 = OpSGreaterThanEqual %bool %435 %int_0 + OpStore %x_394_phi %436 + OpSelectionMerge %437 None + OpBranchConditional %436 %438 %437 + %438 = OpLabel + %439 = OpAccessChain %_ptr_Function_int %p %uint_1 + %440 = OpLoad %int %439 + %441 = OpSLessThan %bool %440 %int_14 + OpStore %x_393 %441 + %442 = OpLoad %bool %x_393 + OpStore %x_394_phi %442 + OpBranch %437 + %437 = OpLabel + %443 = OpLoad %bool %x_394_phi + OpStore %x_407_phi %443 + OpSelectionMerge %444 None + OpBranchConditional %443 %445 %444 + %445 = OpLabel + %446 = OpAccessChain %_ptr_Function_int %p %uint_0 + %447 = OpLoad %int %446 + %448 = OpAccessChain %_ptr_Function_int %p %uint_1 + %449 = OpLoad %int %448 + %450 = OpIAdd %int %449 %int_2 + %451 = OpIMul %int %450 %int_16 + %452 = OpIAdd %int %447 %451 + %453 = OpAccessChain %_ptr_Private_int %map %452 + %454 = OpLoad %int %453 + %455 = OpIEqual %bool %454 %int_0 + OpStore %x_406 %455 + %456 = OpLoad %bool %x_406 + OpStore %x_407_phi %456 + OpBranch %444 + %444 = OpLabel + %457 = OpLoad %bool %x_407_phi + OpSelectionMerge %458 None + OpBranchConditional %457 %459 %458 + %459 = OpLabel + %460 = OpLoad %int %d + %461 = OpISub %int %460 %int_1 + OpStore %d %461 + %462 = OpAccessChain %_ptr_Function_int %p %uint_0 + %463 = OpLoad %int %462 + %464 = OpAccessChain %_ptr_Function_int %p %uint_1 + %465 = OpLoad %int %464 + %466 = OpIMul %int %465 %int_16 + %467 = OpIAdd %int %463 %466 + %468 = OpAccessChain %_ptr_Private_int %map %467 + OpStore %468 %int_1 + %469 = OpAccessChain %_ptr_Function_int %p %uint_0 + %470 = OpLoad %int %469 + %471 = OpAccessChain %_ptr_Function_int %p %uint_1 + %472 = OpLoad %int %471 + %473 = OpIAdd %int %472 %int_1 + %474 = OpIMul %int %473 %int_16 + %475 = OpIAdd %int %470 %474 + %476 = OpAccessChain %_ptr_Private_int %map %475 + OpStore %476 %int_1 + %477 = OpAccessChain %_ptr_Function_int %p %uint_0 + %478 = OpLoad %int %477 + %479 = OpAccessChain %_ptr_Function_int %p %uint_1 + %480 = OpLoad %int %479 + %481 = OpIAdd %int %480 %int_2 + %482 = OpIMul %int %481 %int_16 + %483 = OpIAdd %int %478 %482 + %484 = OpAccessChain %_ptr_Private_int %map %483 + OpStore %484 %int_1 + %485 = OpAccessChain %_ptr_Function_int %p %uint_1 + %486 = OpLoad %int %485 + %487 = OpAccessChain %_ptr_Function_int %p %uint_1 + %488 = OpIAdd %int %486 %int_2 + OpStore %487 %488 + OpBranch %458 + %458 = OpLabel + OpBranch %213 + %213 = OpLabel + %489 = OpAccessChain %_ptr_Function_int %ipos %uint_1 + %490 = OpLoad %int %489 + %491 = OpAccessChain %_ptr_Function_int %ipos %uint_0 + %492 = OpLoad %int %491 + %493 = OpIMul %int %490 %int_16 + %494 = OpIAdd %int %493 %492 + %495 = OpAccessChain %_ptr_Private_int %map %494 + %496 = OpLoad %int %495 + %497 = OpIEqual %bool %496 %int_1 + OpSelectionMerge %498 None + OpBranchConditional %497 %499 %498 + %499 = OpLabel + OpStore %x_GLF_color %501 + OpReturn + %498 = OpLabel + OpBranch %96 + %96 = OpLabel + %502 = OpLoad %bool %canwalk + OpSelectionMerge %503 None + OpBranchConditional %502 %504 %505 + %504 = OpLabel + OpBranch %503 + %505 = OpLabel + OpBranch %95 + %503 = OpLabel + OpBranch %94 + %95 = OpLabel + OpStore %x_GLF_color %506 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %507 +%tint_symbol_1 = OpFunctionParameter %main_out + %511 = OpLabel + %512 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %512 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %28 + %514 = OpLabel + %515 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %515 + %516 = OpFunctionCall %void %main_1 + %518 = OpLoad %v4float %x_GLF_color + %519 = OpCompositeConstruct %main_out %518 + %517 = OpFunctionCall %void %tint_symbol_3 %519 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 96[%96] is not post dominated by the back-edge block 503[%503] + %503 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..14e531e412 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.spvasm.expected.wgsl @@ -0,0 +1,357 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var map : array; + +var x_GLF_color : vec4; + +var x_60 : mat2x4 = mat2x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + +fn main_1() { + var pos : vec2; + var ipos : vec2; + var i : i32; + var p : vec2; + var canwalk : bool; + var v : i32; + var directions : i32; + var j : i32; + var d : i32; + let x_63 : vec4 = gl_FragCoord; + let x_67 : vec2 = x_7.resolution; + let x_68 : i32 = -((256 - 14)); + pos = (vec2(x_63.x, x_63.y) / x_67); + let x_71 : f32 = pos.x; + let x_75 : f32 = pos.y; + ipos = vec2(i32((x_71 * 16.0)), i32((x_75 * 16.0))); + i = 0; + loop { + let x_83 : i32 = i; + if ((x_83 < 256)) { + } else { + break; + } + let x_86 : i32 = i; + map[x_86] = 0; + + continuing { + let x_88 : i32 = i; + i = (x_88 + 1); + } + } + p = vec2(0, 0); + canwalk = true; + v = 0; + loop { + var x_110 : bool; + var x_130 : bool; + var x_150 : bool; + var x_171 : bool; + var x_111_phi : bool; + var x_131_phi : bool; + var x_151_phi : bool; + var x_172_phi : bool; + let x_94 : i32 = v; + v = (x_94 + 1); + directions = 0; + let x_97 : i32 = p.x; + let x_98 : bool = (x_97 > 0); + x_111_phi = x_98; + if (x_98) { + let x_102 : i32 = p.x; + let x_105 : i32 = p.y; + let x_109 : i32 = map[((x_102 - 2) + (x_105 * 16))]; + x_110 = (x_109 == 0); + x_111_phi = x_110; + } + let x_111 : bool = x_111_phi; + if (x_111) { + let x_114 : i32 = directions; + directions = (x_114 + 1); + } + let x_117 : i32 = p.y; + let x_118 : bool = (x_117 > 0); + x_131_phi = x_118; + if (x_118) { + let x_122 : i32 = p.x; + let x_124 : i32 = p.y; + let x_129 : i32 = map[(x_122 + ((x_124 - 2) * 16))]; + x_130 = (x_129 == 0); + x_131_phi = x_130; + } + let x_131 : bool = x_131_phi; + if (x_131) { + let x_134 : i32 = directions; + directions = (x_134 + 1); + } + let x_137 : i32 = p.x; + let x_138 : bool = (x_137 < 14); + x_151_phi = x_138; + if (x_138) { + let x_142 : i32 = p.x; + let x_145 : i32 = p.y; + let x_149 : i32 = map[((x_142 + 2) + (x_145 * 16))]; + x_150 = (x_149 == 0); + x_151_phi = x_150; + } + let x_151 : bool = x_151_phi; + if (x_151) { + let x_154 : i32 = directions; + directions = (x_154 + 1); + } + let x_156 : i32 = (256 - x_68); + let x_158 : i32 = p.y; + let x_159 : bool = (x_158 < 14); + x_172_phi = x_159; + if (x_159) { + let x_163 : i32 = p.x; + let x_165 : i32 = p.y; + let x_170 : i32 = map[(x_163 + ((x_165 + 2) * 16))]; + x_171 = (x_170 == 0); + x_172_phi = x_171; + } + let x_172 : bool = x_172_phi; + if (x_172) { + let x_175 : i32 = directions; + directions = (x_175 + 1); + } + var x_237 : bool; + var x_250 : bool; + var x_289 : bool; + var x_302 : bool; + var x_341 : bool; + var x_354 : bool; + var x_393 : bool; + var x_406 : bool; + var x_238_phi : bool; + var x_251_phi : bool; + var x_290_phi : bool; + var x_303_phi : bool; + var x_342_phi : bool; + var x_355_phi : bool; + var x_394_phi : bool; + var x_407_phi : bool; + let x_177 : i32 = directions; + if ((x_177 == 0)) { + canwalk = false; + i = 0; + loop { + let x_186 : i32 = i; + if ((x_186 < 8)) { + } else { + break; + } + j = 0; + let x_189 : i32 = (x_156 - x_186); + x_60 = mat2x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + if (false) { + continue; + } + loop { + let x_194 : i32 = j; + if ((x_194 < 8)) { + } else { + break; + } + let x_197 : i32 = j; + let x_199 : i32 = i; + let x_204 : i32 = map[((x_197 * 2) + ((x_199 * 2) * 16))]; + if ((x_204 == 0)) { + let x_208 : i32 = j; + p.x = (x_208 * 2); + let x_211 : i32 = i; + p.y = (x_211 * 2); + canwalk = true; + } + + continuing { + let x_214 : i32 = j; + j = (x_214 + 1); + } + } + + continuing { + let x_216 : i32 = i; + i = (x_216 + 1); + } + } + let x_219 : i32 = p.x; + let x_221 : i32 = p.y; + map[(x_219 + (x_221 * 16))] = 1; + } else { + let x_225 : i32 = v; + let x_226 : i32 = directions; + d = (x_225 % x_226); + let x_228 : i32 = directions; + let x_229 : i32 = v; + v = (x_229 + x_228); + let x_231 : i32 = d; + let x_232 : bool = (x_231 >= 0); + x_238_phi = x_232; + if (x_232) { + let x_236 : i32 = p.x; + x_237 = (x_236 > 0); + x_238_phi = x_237; + } + let x_238 : bool = x_238_phi; + x_251_phi = x_238; + if (x_238) { + let x_242 : i32 = p.x; + let x_245 : i32 = p.y; + let x_249 : i32 = map[((x_242 - 2) + (x_245 * 16))]; + x_250 = (x_249 == 0); + x_251_phi = x_250; + } + let x_251 : bool = x_251_phi; + if (x_251) { + let x_254 : i32 = d; + d = (x_254 - 1); + let x_257 : i32 = p.x; + let x_259 : i32 = p.y; + map[(x_257 + (x_259 * 16))] = 1; + let x_264 : i32 = p.x; + let x_267 : i32 = p.y; + map[((x_264 - 1) + (x_267 * 16))] = 1; + let x_272 : i32 = p.x; + let x_275 : i32 = p.y; + map[((x_272 - 2) + (x_275 * 16))] = 1; + let x_280 : i32 = p.x; + p.x = (x_280 - 2); + } + let x_283 : i32 = d; + let x_284 : bool = (x_283 >= 0); + x_290_phi = x_284; + if (x_284) { + let x_288 : i32 = p.y; + x_289 = (x_288 > 0); + x_290_phi = x_289; + } + let x_290 : bool = x_290_phi; + x_303_phi = x_290; + if (x_290) { + let x_294 : i32 = p.x; + let x_296 : i32 = p.y; + let x_301 : i32 = map[(x_294 + ((x_296 - 2) * 16))]; + x_302 = (x_301 == 0); + x_303_phi = x_302; + } + let x_303 : bool = x_303_phi; + if (x_303) { + let x_306 : i32 = d; + d = (x_306 - 1); + let x_309 : i32 = p.x; + let x_311 : i32 = p.y; + map[(x_309 + (x_311 * 16))] = 1; + let x_316 : i32 = p.x; + let x_318 : i32 = p.y; + map[(x_316 + ((x_318 - 1) * 16))] = 1; + let x_324 : i32 = p.x; + let x_326 : i32 = p.y; + map[(x_324 + ((x_326 - 2) * 16))] = 1; + let x_332 : i32 = p.y; + p.y = (x_332 - 2); + } + let x_335 : i32 = d; + let x_336 : bool = (x_335 >= 0); + x_342_phi = x_336; + if (x_336) { + let x_340 : i32 = p.x; + x_341 = (x_340 < 14); + x_342_phi = x_341; + } + let x_342 : bool = x_342_phi; + x_355_phi = x_342; + if (x_342) { + let x_346 : i32 = p.x; + let x_349 : i32 = p.y; + let x_353 : i32 = map[((x_346 + 2) + (x_349 * 16))]; + x_354 = (x_353 == 0); + x_355_phi = x_354; + } + let x_355 : bool = x_355_phi; + if (x_355) { + let x_358 : i32 = d; + d = (x_358 - 1); + let x_361 : i32 = p.x; + let x_363 : i32 = p.y; + map[(x_361 + (x_363 * 16))] = 1; + let x_368 : i32 = p.x; + let x_371 : i32 = p.y; + map[((x_368 + 1) + (x_371 * 16))] = 1; + let x_376 : i32 = p.x; + let x_379 : i32 = p.y; + map[((x_376 + 2) + (x_379 * 16))] = 1; + let x_384 : i32 = p.x; + p.x = (x_384 + 2); + } + let x_387 : i32 = d; + let x_388 : bool = (x_387 >= 0); + x_394_phi = x_388; + if (x_388) { + let x_392 : i32 = p.y; + x_393 = (x_392 < 14); + x_394_phi = x_393; + } + let x_394 : bool = x_394_phi; + x_407_phi = x_394; + if (x_394) { + let x_398 : i32 = p.x; + let x_400 : i32 = p.y; + let x_405 : i32 = map[(x_398 + ((x_400 + 2) * 16))]; + x_406 = (x_405 == 0); + x_407_phi = x_406; + } + let x_407 : bool = x_407_phi; + if (x_407) { + let x_410 : i32 = d; + d = (x_410 - 1); + let x_413 : i32 = p.x; + let x_415 : i32 = p.y; + map[(x_413 + (x_415 * 16))] = 1; + let x_420 : i32 = p.x; + let x_422 : i32 = p.y; + map[(x_420 + ((x_422 + 1) * 16))] = 1; + let x_428 : i32 = p.x; + let x_430 : i32 = p.y; + map[(x_428 + ((x_430 + 2) * 16))] = 1; + let x_436 : i32 = p.y; + p.y = (x_436 + 2); + } + } + let x_440 : i32 = ipos.y; + let x_443 : i32 = ipos.x; + let x_446 : i32 = map[((x_440 * 16) + x_443)]; + if ((x_446 == 1)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + return; + } + + continuing { + let x_450 : bool = canwalk; + if (x_450) { + } else { + break; + } + } + } + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl new file mode 100644 index 0000000000..14e531e412 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl @@ -0,0 +1,357 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var map : array; + +var x_GLF_color : vec4; + +var x_60 : mat2x4 = mat2x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + +fn main_1() { + var pos : vec2; + var ipos : vec2; + var i : i32; + var p : vec2; + var canwalk : bool; + var v : i32; + var directions : i32; + var j : i32; + var d : i32; + let x_63 : vec4 = gl_FragCoord; + let x_67 : vec2 = x_7.resolution; + let x_68 : i32 = -((256 - 14)); + pos = (vec2(x_63.x, x_63.y) / x_67); + let x_71 : f32 = pos.x; + let x_75 : f32 = pos.y; + ipos = vec2(i32((x_71 * 16.0)), i32((x_75 * 16.0))); + i = 0; + loop { + let x_83 : i32 = i; + if ((x_83 < 256)) { + } else { + break; + } + let x_86 : i32 = i; + map[x_86] = 0; + + continuing { + let x_88 : i32 = i; + i = (x_88 + 1); + } + } + p = vec2(0, 0); + canwalk = true; + v = 0; + loop { + var x_110 : bool; + var x_130 : bool; + var x_150 : bool; + var x_171 : bool; + var x_111_phi : bool; + var x_131_phi : bool; + var x_151_phi : bool; + var x_172_phi : bool; + let x_94 : i32 = v; + v = (x_94 + 1); + directions = 0; + let x_97 : i32 = p.x; + let x_98 : bool = (x_97 > 0); + x_111_phi = x_98; + if (x_98) { + let x_102 : i32 = p.x; + let x_105 : i32 = p.y; + let x_109 : i32 = map[((x_102 - 2) + (x_105 * 16))]; + x_110 = (x_109 == 0); + x_111_phi = x_110; + } + let x_111 : bool = x_111_phi; + if (x_111) { + let x_114 : i32 = directions; + directions = (x_114 + 1); + } + let x_117 : i32 = p.y; + let x_118 : bool = (x_117 > 0); + x_131_phi = x_118; + if (x_118) { + let x_122 : i32 = p.x; + let x_124 : i32 = p.y; + let x_129 : i32 = map[(x_122 + ((x_124 - 2) * 16))]; + x_130 = (x_129 == 0); + x_131_phi = x_130; + } + let x_131 : bool = x_131_phi; + if (x_131) { + let x_134 : i32 = directions; + directions = (x_134 + 1); + } + let x_137 : i32 = p.x; + let x_138 : bool = (x_137 < 14); + x_151_phi = x_138; + if (x_138) { + let x_142 : i32 = p.x; + let x_145 : i32 = p.y; + let x_149 : i32 = map[((x_142 + 2) + (x_145 * 16))]; + x_150 = (x_149 == 0); + x_151_phi = x_150; + } + let x_151 : bool = x_151_phi; + if (x_151) { + let x_154 : i32 = directions; + directions = (x_154 + 1); + } + let x_156 : i32 = (256 - x_68); + let x_158 : i32 = p.y; + let x_159 : bool = (x_158 < 14); + x_172_phi = x_159; + if (x_159) { + let x_163 : i32 = p.x; + let x_165 : i32 = p.y; + let x_170 : i32 = map[(x_163 + ((x_165 + 2) * 16))]; + x_171 = (x_170 == 0); + x_172_phi = x_171; + } + let x_172 : bool = x_172_phi; + if (x_172) { + let x_175 : i32 = directions; + directions = (x_175 + 1); + } + var x_237 : bool; + var x_250 : bool; + var x_289 : bool; + var x_302 : bool; + var x_341 : bool; + var x_354 : bool; + var x_393 : bool; + var x_406 : bool; + var x_238_phi : bool; + var x_251_phi : bool; + var x_290_phi : bool; + var x_303_phi : bool; + var x_342_phi : bool; + var x_355_phi : bool; + var x_394_phi : bool; + var x_407_phi : bool; + let x_177 : i32 = directions; + if ((x_177 == 0)) { + canwalk = false; + i = 0; + loop { + let x_186 : i32 = i; + if ((x_186 < 8)) { + } else { + break; + } + j = 0; + let x_189 : i32 = (x_156 - x_186); + x_60 = mat2x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + if (false) { + continue; + } + loop { + let x_194 : i32 = j; + if ((x_194 < 8)) { + } else { + break; + } + let x_197 : i32 = j; + let x_199 : i32 = i; + let x_204 : i32 = map[((x_197 * 2) + ((x_199 * 2) * 16))]; + if ((x_204 == 0)) { + let x_208 : i32 = j; + p.x = (x_208 * 2); + let x_211 : i32 = i; + p.y = (x_211 * 2); + canwalk = true; + } + + continuing { + let x_214 : i32 = j; + j = (x_214 + 1); + } + } + + continuing { + let x_216 : i32 = i; + i = (x_216 + 1); + } + } + let x_219 : i32 = p.x; + let x_221 : i32 = p.y; + map[(x_219 + (x_221 * 16))] = 1; + } else { + let x_225 : i32 = v; + let x_226 : i32 = directions; + d = (x_225 % x_226); + let x_228 : i32 = directions; + let x_229 : i32 = v; + v = (x_229 + x_228); + let x_231 : i32 = d; + let x_232 : bool = (x_231 >= 0); + x_238_phi = x_232; + if (x_232) { + let x_236 : i32 = p.x; + x_237 = (x_236 > 0); + x_238_phi = x_237; + } + let x_238 : bool = x_238_phi; + x_251_phi = x_238; + if (x_238) { + let x_242 : i32 = p.x; + let x_245 : i32 = p.y; + let x_249 : i32 = map[((x_242 - 2) + (x_245 * 16))]; + x_250 = (x_249 == 0); + x_251_phi = x_250; + } + let x_251 : bool = x_251_phi; + if (x_251) { + let x_254 : i32 = d; + d = (x_254 - 1); + let x_257 : i32 = p.x; + let x_259 : i32 = p.y; + map[(x_257 + (x_259 * 16))] = 1; + let x_264 : i32 = p.x; + let x_267 : i32 = p.y; + map[((x_264 - 1) + (x_267 * 16))] = 1; + let x_272 : i32 = p.x; + let x_275 : i32 = p.y; + map[((x_272 - 2) + (x_275 * 16))] = 1; + let x_280 : i32 = p.x; + p.x = (x_280 - 2); + } + let x_283 : i32 = d; + let x_284 : bool = (x_283 >= 0); + x_290_phi = x_284; + if (x_284) { + let x_288 : i32 = p.y; + x_289 = (x_288 > 0); + x_290_phi = x_289; + } + let x_290 : bool = x_290_phi; + x_303_phi = x_290; + if (x_290) { + let x_294 : i32 = p.x; + let x_296 : i32 = p.y; + let x_301 : i32 = map[(x_294 + ((x_296 - 2) * 16))]; + x_302 = (x_301 == 0); + x_303_phi = x_302; + } + let x_303 : bool = x_303_phi; + if (x_303) { + let x_306 : i32 = d; + d = (x_306 - 1); + let x_309 : i32 = p.x; + let x_311 : i32 = p.y; + map[(x_309 + (x_311 * 16))] = 1; + let x_316 : i32 = p.x; + let x_318 : i32 = p.y; + map[(x_316 + ((x_318 - 1) * 16))] = 1; + let x_324 : i32 = p.x; + let x_326 : i32 = p.y; + map[(x_324 + ((x_326 - 2) * 16))] = 1; + let x_332 : i32 = p.y; + p.y = (x_332 - 2); + } + let x_335 : i32 = d; + let x_336 : bool = (x_335 >= 0); + x_342_phi = x_336; + if (x_336) { + let x_340 : i32 = p.x; + x_341 = (x_340 < 14); + x_342_phi = x_341; + } + let x_342 : bool = x_342_phi; + x_355_phi = x_342; + if (x_342) { + let x_346 : i32 = p.x; + let x_349 : i32 = p.y; + let x_353 : i32 = map[((x_346 + 2) + (x_349 * 16))]; + x_354 = (x_353 == 0); + x_355_phi = x_354; + } + let x_355 : bool = x_355_phi; + if (x_355) { + let x_358 : i32 = d; + d = (x_358 - 1); + let x_361 : i32 = p.x; + let x_363 : i32 = p.y; + map[(x_361 + (x_363 * 16))] = 1; + let x_368 : i32 = p.x; + let x_371 : i32 = p.y; + map[((x_368 + 1) + (x_371 * 16))] = 1; + let x_376 : i32 = p.x; + let x_379 : i32 = p.y; + map[((x_376 + 2) + (x_379 * 16))] = 1; + let x_384 : i32 = p.x; + p.x = (x_384 + 2); + } + let x_387 : i32 = d; + let x_388 : bool = (x_387 >= 0); + x_394_phi = x_388; + if (x_388) { + let x_392 : i32 = p.y; + x_393 = (x_392 < 14); + x_394_phi = x_393; + } + let x_394 : bool = x_394_phi; + x_407_phi = x_394; + if (x_394) { + let x_398 : i32 = p.x; + let x_400 : i32 = p.y; + let x_405 : i32 = map[(x_398 + ((x_400 + 2) * 16))]; + x_406 = (x_405 == 0); + x_407_phi = x_406; + } + let x_407 : bool = x_407_phi; + if (x_407) { + let x_410 : i32 = d; + d = (x_410 - 1); + let x_413 : i32 = p.x; + let x_415 : i32 = p.y; + map[(x_413 + (x_415 * 16))] = 1; + let x_420 : i32 = p.x; + let x_422 : i32 = p.y; + map[(x_420 + ((x_422 + 1) * 16))] = 1; + let x_428 : i32 = p.x; + let x_430 : i32 = p.y; + map[(x_428 + ((x_430 + 2) * 16))] = 1; + let x_436 : i32 = p.y; + p.y = (x_436 + 2); + } + } + let x_440 : i32 = ipos.y; + let x_443 : i32 = ipos.x; + let x_446 : i32 = map[((x_440 * 16) + x_443)]; + if ((x_446 == 1)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + return; + } + + continuing { + let x_450 : bool = canwalk; + if (x_450) { + } else { + break; + } + } + } + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..d8420f8fb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.hlsl @@ -0,0 +1,309 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static int map[256] = (int[256])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float2x4 x_60 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int i = 0; + int2 p = int2(0, 0); + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + const float4 x_63 = gl_FragCoord; + const float2 x_67 = asfloat(x_7[0].xy); + const int x_68 = -((256 - 14)); + pos = (float2(x_63.x, x_63.y) / x_67); + const float x_71 = pos.x; + const float x_75 = pos.y; + ipos = int2(int((x_71 * 16.0f)), int((x_75 * 16.0f))); + i = 0; + { + for(; (i < 256); i = (i + 1)) { + map[i] = 0; + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_110 = false; + bool x_130 = false; + bool x_150 = false; + bool x_171 = false; + bool x_111_phi = false; + bool x_131_phi = false; + bool x_151_phi = false; + bool x_172_phi = false; + v = (v + 1); + directions = 0; + const int x_97 = p.x; + const bool x_98 = (x_97 > 0); + x_111_phi = x_98; + if (x_98) { + const int x_102 = p.x; + const int x_105 = p.y; + const int x_109 = map[((x_102 - 2) + (x_105 * 16))]; + x_110 = (x_109 == 0); + x_111_phi = x_110; + } + if (x_111_phi) { + directions = (directions + 1); + } + const int x_117 = p.y; + const bool x_118 = (x_117 > 0); + x_131_phi = x_118; + if (x_118) { + const int x_122 = p.x; + const int x_124 = p.y; + const int x_129 = map[(x_122 + ((x_124 - 2) * 16))]; + x_130 = (x_129 == 0); + x_131_phi = x_130; + } + if (x_131_phi) { + directions = (directions + 1); + } + const int x_137 = p.x; + const bool x_138 = (x_137 < 14); + x_151_phi = x_138; + if (x_138) { + const int x_142 = p.x; + const int x_145 = p.y; + const int x_149 = map[((x_142 + 2) + (x_145 * 16))]; + x_150 = (x_149 == 0); + x_151_phi = x_150; + } + if (x_151_phi) { + directions = (directions + 1); + } + const int x_156 = (256 - x_68); + const int x_158 = p.y; + const bool x_159 = (x_158 < 14); + x_172_phi = x_159; + if (x_159) { + const int x_163 = p.x; + const int x_165 = p.y; + const int x_170 = map[(x_163 + ((x_165 + 2) * 16))]; + x_171 = (x_170 == 0); + x_172_phi = x_171; + } + if (x_172_phi) { + directions = (directions + 1); + } + bool x_237 = false; + bool x_250 = false; + bool x_289 = false; + bool x_302 = false; + bool x_341 = false; + bool x_354 = false; + bool x_393 = false; + bool x_406 = false; + bool x_238_phi = false; + bool x_251_phi = false; + bool x_290_phi = false; + bool x_303_phi = false; + bool x_342_phi = false; + bool x_355_phi = false; + bool x_394_phi = false; + bool x_407_phi = false; + if ((directions == 0)) { + canwalk = false; + i = 0; + while (true) { + const int x_186 = i; + if ((x_186 < 8)) { + } else { + break; + } + j = 0; + const int x_189 = (x_156 - x_186); + x_60 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + if (false) { + { + i = (i + 1); + } + continue; + } + { + for(; (j < 8); j = (j + 1)) { + const int x_204 = map[((j * 2) + ((i * 2) * 16))]; + if ((x_204 == 0)) { + p.x = (j * 2); + p.y = (i * 2); + canwalk = true; + } + } + } + { + i = (i + 1); + } + } + const int x_219 = p.x; + const int x_221 = p.y; + map[(x_219 + (x_221 * 16))] = 1; + } else { + d = (v % directions); + v = (v + directions); + const bool x_232 = (d >= 0); + x_238_phi = x_232; + if (x_232) { + const int x_236 = p.x; + x_237 = (x_236 > 0); + x_238_phi = x_237; + } + const bool x_238 = x_238_phi; + x_251_phi = x_238; + if (x_238) { + const int x_242 = p.x; + const int x_245 = p.y; + const int x_249 = map[((x_242 - 2) + (x_245 * 16))]; + x_250 = (x_249 == 0); + x_251_phi = x_250; + } + if (x_251_phi) { + d = (d - 1); + const int x_257 = p.x; + const int x_259 = p.y; + map[(x_257 + (x_259 * 16))] = 1; + const int x_264 = p.x; + const int x_267 = p.y; + map[((x_264 - 1) + (x_267 * 16))] = 1; + const int x_272 = p.x; + const int x_275 = p.y; + map[((x_272 - 2) + (x_275 * 16))] = 1; + const int x_280 = p.x; + p.x = (x_280 - 2); + } + const bool x_284 = (d >= 0); + x_290_phi = x_284; + if (x_284) { + const int x_288 = p.y; + x_289 = (x_288 > 0); + x_290_phi = x_289; + } + const bool x_290 = x_290_phi; + x_303_phi = x_290; + if (x_290) { + const int x_294 = p.x; + const int x_296 = p.y; + const int x_301 = map[(x_294 + ((x_296 - 2) * 16))]; + x_302 = (x_301 == 0); + x_303_phi = x_302; + } + if (x_303_phi) { + d = (d - 1); + const int x_309 = p.x; + const int x_311 = p.y; + map[(x_309 + (x_311 * 16))] = 1; + const int x_316 = p.x; + const int x_318 = p.y; + map[(x_316 + ((x_318 - 1) * 16))] = 1; + const int x_324 = p.x; + const int x_326 = p.y; + map[(x_324 + ((x_326 - 2) * 16))] = 1; + const int x_332 = p.y; + p.y = (x_332 - 2); + } + const bool x_336 = (d >= 0); + x_342_phi = x_336; + if (x_336) { + const int x_340 = p.x; + x_341 = (x_340 < 14); + x_342_phi = x_341; + } + const bool x_342 = x_342_phi; + x_355_phi = x_342; + if (x_342) { + const int x_346 = p.x; + const int x_349 = p.y; + const int x_353 = map[((x_346 + 2) + (x_349 * 16))]; + x_354 = (x_353 == 0); + x_355_phi = x_354; + } + if (x_355_phi) { + d = (d - 1); + const int x_361 = p.x; + const int x_363 = p.y; + map[(x_361 + (x_363 * 16))] = 1; + const int x_368 = p.x; + const int x_371 = p.y; + map[((x_368 + 1) + (x_371 * 16))] = 1; + const int x_376 = p.x; + const int x_379 = p.y; + map[((x_376 + 2) + (x_379 * 16))] = 1; + const int x_384 = p.x; + p.x = (x_384 + 2); + } + const bool x_388 = (d >= 0); + x_394_phi = x_388; + if (x_388) { + const int x_392 = p.y; + x_393 = (x_392 < 14); + x_394_phi = x_393; + } + const bool x_394 = x_394_phi; + x_407_phi = x_394; + if (x_394) { + const int x_398 = p.x; + const int x_400 = p.y; + const int x_405 = map[(x_398 + ((x_400 + 2) * 16))]; + x_406 = (x_405 == 0); + x_407_phi = x_406; + } + if (x_407_phi) { + d = (d - 1); + const int x_413 = p.x; + const int x_415 = p.y; + map[(x_413 + (x_415 * 16))] = 1; + const int x_420 = p.x; + const int x_422 = p.y; + map[(x_420 + ((x_422 + 1) * 16))] = 1; + const int x_428 = p.x; + const int x_430 = p.y; + map[(x_428 + ((x_430 + 2) * 16))] = 1; + const int x_436 = p.y; + p.y = (x_436 + 2); + } + } + const int x_440 = ipos.y; + const int x_443 = ipos.x; + const int x_446 = map[((x_440 * 16) + x_443)]; + if ((x_446 == 1)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + if (canwalk) { + } else { + break; + } + } + } + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.msl new file mode 100644 index 0000000000..192b6aa28d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.msl @@ -0,0 +1,359 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6, thread float2x4* const tint_symbol_7, thread float4* const tint_symbol_8) { + float2 pos = 0.0f; + int2 ipos = 0; + int i = 0; + int2 p = 0; + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + float4 const x_63 = *(tint_symbol_5); + float2 const x_67 = x_7.resolution; + int const x_68 = -((256 - 14)); + pos = (float2(x_63.x, x_63.y) / x_67); + float const x_71 = pos.x; + float const x_75 = pos.y; + ipos = int2(int((x_71 * 16.0f)), int((x_75 * 16.0f))); + i = 0; + while (true) { + int const x_83 = i; + if ((x_83 < 256)) { + } else { + break; + } + int const x_86 = i; + (*(tint_symbol_6)).arr[x_86] = 0; + { + int const x_88 = i; + i = (x_88 + 1); + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_110 = false; + bool x_130 = false; + bool x_150 = false; + bool x_171 = false; + bool x_111_phi = false; + bool x_131_phi = false; + bool x_151_phi = false; + bool x_172_phi = false; + int const x_94 = v; + v = (x_94 + 1); + directions = 0; + int const x_97 = p.x; + bool const x_98 = (x_97 > 0); + x_111_phi = x_98; + if (x_98) { + int const x_102 = p.x; + int const x_105 = p.y; + int const x_109 = (*(tint_symbol_6)).arr[((x_102 - 2) + (x_105 * 16))]; + x_110 = (x_109 == 0); + x_111_phi = x_110; + } + bool const x_111 = x_111_phi; + if (x_111) { + int const x_114 = directions; + directions = (x_114 + 1); + } + int const x_117 = p.y; + bool const x_118 = (x_117 > 0); + x_131_phi = x_118; + if (x_118) { + int const x_122 = p.x; + int const x_124 = p.y; + int const x_129 = (*(tint_symbol_6)).arr[(x_122 + ((x_124 - 2) * 16))]; + x_130 = (x_129 == 0); + x_131_phi = x_130; + } + bool const x_131 = x_131_phi; + if (x_131) { + int const x_134 = directions; + directions = (x_134 + 1); + } + int const x_137 = p.x; + bool const x_138 = (x_137 < 14); + x_151_phi = x_138; + if (x_138) { + int const x_142 = p.x; + int const x_145 = p.y; + int const x_149 = (*(tint_symbol_6)).arr[((x_142 + 2) + (x_145 * 16))]; + x_150 = (x_149 == 0); + x_151_phi = x_150; + } + bool const x_151 = x_151_phi; + if (x_151) { + int const x_154 = directions; + directions = (x_154 + 1); + } + int const x_156 = (256 - x_68); + int const x_158 = p.y; + bool const x_159 = (x_158 < 14); + x_172_phi = x_159; + if (x_159) { + int const x_163 = p.x; + int const x_165 = p.y; + int const x_170 = (*(tint_symbol_6)).arr[(x_163 + ((x_165 + 2) * 16))]; + x_171 = (x_170 == 0); + x_172_phi = x_171; + } + bool const x_172 = x_172_phi; + if (x_172) { + int const x_175 = directions; + directions = (x_175 + 1); + } + bool x_237 = false; + bool x_250 = false; + bool x_289 = false; + bool x_302 = false; + bool x_341 = false; + bool x_354 = false; + bool x_393 = false; + bool x_406 = false; + bool x_238_phi = false; + bool x_251_phi = false; + bool x_290_phi = false; + bool x_303_phi = false; + bool x_342_phi = false; + bool x_355_phi = false; + bool x_394_phi = false; + bool x_407_phi = false; + int const x_177 = directions; + if ((x_177 == 0)) { + canwalk = false; + i = 0; + while (true) { + int const x_186 = i; + if ((x_186 < 8)) { + } else { + break; + } + j = 0; + int const x_189 = (x_156 - x_186); + *(tint_symbol_7) = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + if (false) { + { + int const x_216 = i; + i = (x_216 + 1); + } + continue; + } + while (true) { + int const x_194 = j; + if ((x_194 < 8)) { + } else { + break; + } + int const x_197 = j; + int const x_199 = i; + int const x_204 = (*(tint_symbol_6)).arr[((x_197 * 2) + ((x_199 * 2) * 16))]; + if ((x_204 == 0)) { + int const x_208 = j; + p.x = (x_208 * 2); + int const x_211 = i; + p.y = (x_211 * 2); + canwalk = true; + } + { + int const x_214 = j; + j = (x_214 + 1); + } + } + { + int const x_216 = i; + i = (x_216 + 1); + } + } + int const x_219 = p.x; + int const x_221 = p.y; + (*(tint_symbol_6)).arr[(x_219 + (x_221 * 16))] = 1; + } else { + int const x_225 = v; + int const x_226 = directions; + d = (x_225 % x_226); + int const x_228 = directions; + int const x_229 = v; + v = (x_229 + x_228); + int const x_231 = d; + bool const x_232 = (x_231 >= 0); + x_238_phi = x_232; + if (x_232) { + int const x_236 = p.x; + x_237 = (x_236 > 0); + x_238_phi = x_237; + } + bool const x_238 = x_238_phi; + x_251_phi = x_238; + if (x_238) { + int const x_242 = p.x; + int const x_245 = p.y; + int const x_249 = (*(tint_symbol_6)).arr[((x_242 - 2) + (x_245 * 16))]; + x_250 = (x_249 == 0); + x_251_phi = x_250; + } + bool const x_251 = x_251_phi; + if (x_251) { + int const x_254 = d; + d = (x_254 - 1); + int const x_257 = p.x; + int const x_259 = p.y; + (*(tint_symbol_6)).arr[(x_257 + (x_259 * 16))] = 1; + int const x_264 = p.x; + int const x_267 = p.y; + (*(tint_symbol_6)).arr[((x_264 - 1) + (x_267 * 16))] = 1; + int const x_272 = p.x; + int const x_275 = p.y; + (*(tint_symbol_6)).arr[((x_272 - 2) + (x_275 * 16))] = 1; + int const x_280 = p.x; + p.x = (x_280 - 2); + } + int const x_283 = d; + bool const x_284 = (x_283 >= 0); + x_290_phi = x_284; + if (x_284) { + int const x_288 = p.y; + x_289 = (x_288 > 0); + x_290_phi = x_289; + } + bool const x_290 = x_290_phi; + x_303_phi = x_290; + if (x_290) { + int const x_294 = p.x; + int const x_296 = p.y; + int const x_301 = (*(tint_symbol_6)).arr[(x_294 + ((x_296 - 2) * 16))]; + x_302 = (x_301 == 0); + x_303_phi = x_302; + } + bool const x_303 = x_303_phi; + if (x_303) { + int const x_306 = d; + d = (x_306 - 1); + int const x_309 = p.x; + int const x_311 = p.y; + (*(tint_symbol_6)).arr[(x_309 + (x_311 * 16))] = 1; + int const x_316 = p.x; + int const x_318 = p.y; + (*(tint_symbol_6)).arr[(x_316 + ((x_318 - 1) * 16))] = 1; + int const x_324 = p.x; + int const x_326 = p.y; + (*(tint_symbol_6)).arr[(x_324 + ((x_326 - 2) * 16))] = 1; + int const x_332 = p.y; + p.y = (x_332 - 2); + } + int const x_335 = d; + bool const x_336 = (x_335 >= 0); + x_342_phi = x_336; + if (x_336) { + int const x_340 = p.x; + x_341 = (x_340 < 14); + x_342_phi = x_341; + } + bool const x_342 = x_342_phi; + x_355_phi = x_342; + if (x_342) { + int const x_346 = p.x; + int const x_349 = p.y; + int const x_353 = (*(tint_symbol_6)).arr[((x_346 + 2) + (x_349 * 16))]; + x_354 = (x_353 == 0); + x_355_phi = x_354; + } + bool const x_355 = x_355_phi; + if (x_355) { + int const x_358 = d; + d = (x_358 - 1); + int const x_361 = p.x; + int const x_363 = p.y; + (*(tint_symbol_6)).arr[(x_361 + (x_363 * 16))] = 1; + int const x_368 = p.x; + int const x_371 = p.y; + (*(tint_symbol_6)).arr[((x_368 + 1) + (x_371 * 16))] = 1; + int const x_376 = p.x; + int const x_379 = p.y; + (*(tint_symbol_6)).arr[((x_376 + 2) + (x_379 * 16))] = 1; + int const x_384 = p.x; + p.x = (x_384 + 2); + } + int const x_387 = d; + bool const x_388 = (x_387 >= 0); + x_394_phi = x_388; + if (x_388) { + int const x_392 = p.y; + x_393 = (x_392 < 14); + x_394_phi = x_393; + } + bool const x_394 = x_394_phi; + x_407_phi = x_394; + if (x_394) { + int const x_398 = p.x; + int const x_400 = p.y; + int const x_405 = (*(tint_symbol_6)).arr[(x_398 + ((x_400 + 2) * 16))]; + x_406 = (x_405 == 0); + x_407_phi = x_406; + } + bool const x_407 = x_407_phi; + if (x_407) { + int const x_410 = d; + d = (x_410 - 1); + int const x_413 = p.x; + int const x_415 = p.y; + (*(tint_symbol_6)).arr[(x_413 + (x_415 * 16))] = 1; + int const x_420 = p.x; + int const x_422 = p.y; + (*(tint_symbol_6)).arr[(x_420 + ((x_422 + 1) * 16))] = 1; + int const x_428 = p.x; + int const x_430 = p.y; + (*(tint_symbol_6)).arr[(x_428 + ((x_430 + 2) * 16))] = 1; + int const x_436 = p.y; + p.y = (x_436 + 2); + } + } + int const x_440 = ipos.y; + int const x_443 = ipos.x; + int const x_446 = (*(tint_symbol_6)).arr[((x_440 * 16) + x_443)]; + if ((x_446 == 1)) { + *(tint_symbol_8) = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + bool const x_450 = canwalk; + if (x_450) { + } else { + break; + } + } + } + *(tint_symbol_8) = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread tint_array_wrapper tint_symbol_10 = {}; + thread float2x4 tint_symbol_11 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..efc1a09454 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.spvasm @@ -0,0 +1,791 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 520 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %map "map" + OpName %x_GLF_color "x_GLF_color" + OpName %x_60 "x_60" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %ipos "ipos" + OpName %i "i" + OpName %p "p" + OpName %canwalk "canwalk" + OpName %v "v" + OpName %directions "directions" + OpName %j "j" + OpName %d "d" + OpName %x_110 "x_110" + OpName %x_130 "x_130" + OpName %x_150 "x_150" + OpName %x_171 "x_171" + OpName %x_111_phi "x_111_phi" + OpName %x_131_phi "x_131_phi" + OpName %x_151_phi "x_151_phi" + OpName %x_172_phi "x_172_phi" + OpName %x_237 "x_237" + OpName %x_250 "x_250" + OpName %x_289 "x_289" + OpName %x_302 "x_302" + OpName %x_341 "x_341" + OpName %x_354 "x_354" + OpName %x_393 "x_393" + OpName %x_406 "x_406" + OpName %x_238_phi "x_238_phi" + OpName %x_251_phi "x_251_phi" + OpName %x_290_phi "x_290_phi" + OpName %x_303_phi "x_303_phi" + OpName %x_342_phi "x_342_phi" + OpName %x_355_phi "x_355_phi" + OpName %x_394_phi "x_394_phi" + OpName %x_407_phi "x_407_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Private__arr_int_uint_256 = OpTypePointer Private %_arr_int_uint_256 + %16 = OpConstantNull %_arr_int_uint_256 + %map = OpVariable %_ptr_Private__arr_int_uint_256 Private %16 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%mat2v4float = OpTypeMatrix %v4float 2 + %float_0 = OpConstant %float 0 + %20 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %21 = OpConstantComposite %mat2v4float %20 %20 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %x_60 = OpVariable %_ptr_Private_mat2v4float Private %21 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %28 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %34 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %38 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %41 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %46 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %int_256 = OpConstant %int 256 + %int_14 = OpConstant %int 14 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_16 = OpConstant %float 16 + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %92 = OpConstantComposite %v2int %int_0 %int_0 + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %int_16 = OpConstant %int 16 + %false = OpConstantFalse %bool + %int_8 = OpConstant %int 8 + %float_1 = OpConstant %float 1 + %501 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %506 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %507 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %28 + %31 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %34 + %ipos = OpVariable %_ptr_Function_v2int Function %38 + %i = OpVariable %_ptr_Function_int Function %41 + %p = OpVariable %_ptr_Function_v2int Function %38 + %canwalk = OpVariable %_ptr_Function_bool Function %46 + %v = OpVariable %_ptr_Function_int Function %41 + %directions = OpVariable %_ptr_Function_int Function %41 + %j = OpVariable %_ptr_Function_int Function %41 + %d = OpVariable %_ptr_Function_int Function %41 + %x_110 = OpVariable %_ptr_Function_bool Function %46 + %x_130 = OpVariable %_ptr_Function_bool Function %46 + %x_150 = OpVariable %_ptr_Function_bool Function %46 + %x_171 = OpVariable %_ptr_Function_bool Function %46 + %x_111_phi = OpVariable %_ptr_Function_bool Function %46 + %x_131_phi = OpVariable %_ptr_Function_bool Function %46 + %x_151_phi = OpVariable %_ptr_Function_bool Function %46 + %x_172_phi = OpVariable %_ptr_Function_bool Function %46 + %x_237 = OpVariable %_ptr_Function_bool Function %46 + %x_250 = OpVariable %_ptr_Function_bool Function %46 + %x_289 = OpVariable %_ptr_Function_bool Function %46 + %x_302 = OpVariable %_ptr_Function_bool Function %46 + %x_341 = OpVariable %_ptr_Function_bool Function %46 + %x_354 = OpVariable %_ptr_Function_bool Function %46 + %x_393 = OpVariable %_ptr_Function_bool Function %46 + %x_406 = OpVariable %_ptr_Function_bool Function %46 + %x_238_phi = OpVariable %_ptr_Function_bool Function %46 + %x_251_phi = OpVariable %_ptr_Function_bool Function %46 + %x_290_phi = OpVariable %_ptr_Function_bool Function %46 + %x_303_phi = OpVariable %_ptr_Function_bool Function %46 + %x_342_phi = OpVariable %_ptr_Function_bool Function %46 + %x_355_phi = OpVariable %_ptr_Function_bool Function %46 + %x_394_phi = OpVariable %_ptr_Function_bool Function %46 + %x_407_phi = OpVariable %_ptr_Function_bool Function %46 + %51 = OpLoad %v4float %gl_FragCoord + %54 = OpAccessChain %_ptr_Uniform_v2float %x_7 %uint_0 + %55 = OpLoad %v2float %54 + %59 = OpISub %int %int_256 %int_14 + %56 = OpSNegate %int %59 + %60 = OpCompositeExtract %float %51 0 + %61 = OpCompositeExtract %float %51 1 + %62 = OpCompositeConstruct %v2float %60 %61 + %63 = OpFDiv %v2float %62 %55 + OpStore %pos %63 + %65 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %66 = OpLoad %float %65 + %68 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %69 = OpLoad %float %68 + %72 = OpFMul %float %66 %float_16 + %70 = OpConvertFToS %int %72 + %74 = OpFMul %float %69 %float_16 + %73 = OpConvertFToS %int %74 + %75 = OpCompositeConstruct %v2int %70 %73 + OpStore %ipos %75 + OpStore %i %int_0 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %78 %79 None + OpBranch %80 + %80 = OpLabel + %81 = OpLoad %int %i + %82 = OpSLessThan %bool %81 %int_256 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + OpBranch %83 + %85 = OpLabel + OpBranch %78 + %83 = OpLabel + %86 = OpLoad %int %i + %88 = OpAccessChain %_ptr_Private_int %map %86 + OpStore %88 %int_0 + OpBranch %79 + %79 = OpLabel + %89 = OpLoad %int %i + %91 = OpIAdd %int %89 %int_1 + OpStore %i %91 + OpBranch %77 + %78 = OpLabel + OpStore %p %92 + OpStore %canwalk %true + OpStore %v %int_0 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %95 %96 None + OpBranch %97 + %97 = OpLabel + %106 = OpLoad %int %v + %107 = OpIAdd %int %106 %int_1 + OpStore %v %107 + OpStore %directions %int_0 + %108 = OpAccessChain %_ptr_Function_int %p %uint_0 + %109 = OpLoad %int %108 + %110 = OpSGreaterThan %bool %109 %int_0 + OpStore %x_111_phi %110 + OpSelectionMerge %111 None + OpBranchConditional %110 %112 %111 + %112 = OpLabel + %113 = OpAccessChain %_ptr_Function_int %p %uint_0 + %114 = OpLoad %int %113 + %115 = OpAccessChain %_ptr_Function_int %p %uint_1 + %116 = OpLoad %int %115 + %118 = OpISub %int %114 %int_2 + %120 = OpIMul %int %116 %int_16 + %121 = OpIAdd %int %118 %120 + %122 = OpAccessChain %_ptr_Private_int %map %121 + %123 = OpLoad %int %122 + %124 = OpIEqual %bool %123 %int_0 + OpStore %x_110 %124 + %125 = OpLoad %bool %x_110 + OpStore %x_111_phi %125 + OpBranch %111 + %111 = OpLabel + %126 = OpLoad %bool %x_111_phi + OpSelectionMerge %127 None + OpBranchConditional %126 %128 %127 + %128 = OpLabel + %129 = OpLoad %int %directions + %130 = OpIAdd %int %129 %int_1 + OpStore %directions %130 + OpBranch %127 + %127 = OpLabel + %131 = OpAccessChain %_ptr_Function_int %p %uint_1 + %132 = OpLoad %int %131 + %133 = OpSGreaterThan %bool %132 %int_0 + OpStore %x_131_phi %133 + OpSelectionMerge %134 None + OpBranchConditional %133 %135 %134 + %135 = OpLabel + %136 = OpAccessChain %_ptr_Function_int %p %uint_0 + %137 = OpLoad %int %136 + %138 = OpAccessChain %_ptr_Function_int %p %uint_1 + %139 = OpLoad %int %138 + %140 = OpISub %int %139 %int_2 + %141 = OpIMul %int %140 %int_16 + %142 = OpIAdd %int %137 %141 + %143 = OpAccessChain %_ptr_Private_int %map %142 + %144 = OpLoad %int %143 + %145 = OpIEqual %bool %144 %int_0 + OpStore %x_130 %145 + %146 = OpLoad %bool %x_130 + OpStore %x_131_phi %146 + OpBranch %134 + %134 = OpLabel + %147 = OpLoad %bool %x_131_phi + OpSelectionMerge %148 None + OpBranchConditional %147 %149 %148 + %149 = OpLabel + %150 = OpLoad %int %directions + %151 = OpIAdd %int %150 %int_1 + OpStore %directions %151 + OpBranch %148 + %148 = OpLabel + %152 = OpAccessChain %_ptr_Function_int %p %uint_0 + %153 = OpLoad %int %152 + %154 = OpSLessThan %bool %153 %int_14 + OpStore %x_151_phi %154 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %155 + %156 = OpLabel + %157 = OpAccessChain %_ptr_Function_int %p %uint_0 + %158 = OpLoad %int %157 + %159 = OpAccessChain %_ptr_Function_int %p %uint_1 + %160 = OpLoad %int %159 + %161 = OpIAdd %int %158 %int_2 + %162 = OpIMul %int %160 %int_16 + %163 = OpIAdd %int %161 %162 + %164 = OpAccessChain %_ptr_Private_int %map %163 + %165 = OpLoad %int %164 + %166 = OpIEqual %bool %165 %int_0 + OpStore %x_150 %166 + %167 = OpLoad %bool %x_150 + OpStore %x_151_phi %167 + OpBranch %155 + %155 = OpLabel + %168 = OpLoad %bool %x_151_phi + OpSelectionMerge %169 None + OpBranchConditional %168 %170 %169 + %170 = OpLabel + %171 = OpLoad %int %directions + %172 = OpIAdd %int %171 %int_1 + OpStore %directions %172 + OpBranch %169 + %169 = OpLabel + %173 = OpISub %int %int_256 %56 + %174 = OpAccessChain %_ptr_Function_int %p %uint_1 + %175 = OpLoad %int %174 + %176 = OpSLessThan %bool %175 %int_14 + OpStore %x_172_phi %176 + OpSelectionMerge %177 None + OpBranchConditional %176 %178 %177 + %178 = OpLabel + %179 = OpAccessChain %_ptr_Function_int %p %uint_0 + %180 = OpLoad %int %179 + %181 = OpAccessChain %_ptr_Function_int %p %uint_1 + %182 = OpLoad %int %181 + %183 = OpIAdd %int %182 %int_2 + %184 = OpIMul %int %183 %int_16 + %185 = OpIAdd %int %180 %184 + %186 = OpAccessChain %_ptr_Private_int %map %185 + %187 = OpLoad %int %186 + %188 = OpIEqual %bool %187 %int_0 + OpStore %x_171 %188 + %189 = OpLoad %bool %x_171 + OpStore %x_172_phi %189 + OpBranch %177 + %177 = OpLabel + %190 = OpLoad %bool %x_172_phi + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %191 + %192 = OpLabel + %193 = OpLoad %int %directions + %194 = OpIAdd %int %193 %int_1 + OpStore %directions %194 + OpBranch %191 + %191 = OpLabel + %211 = OpLoad %int %directions + %212 = OpIEqual %bool %211 %int_0 + OpSelectionMerge %213 None + OpBranchConditional %212 %214 %215 + %214 = OpLabel + OpStore %canwalk %false + OpStore %i %int_0 + OpBranch %217 + %217 = OpLabel + OpLoopMerge %218 %219 None + OpBranch %220 + %220 = OpLabel + %221 = OpLoad %int %i + %223 = OpSLessThan %bool %221 %int_8 + OpSelectionMerge %224 None + OpBranchConditional %223 %225 %226 + %225 = OpLabel + OpBranch %224 + %226 = OpLabel + OpBranch %218 + %224 = OpLabel + OpStore %j %int_0 + %227 = OpISub %int %173 %221 + OpStore %x_60 %21 + OpSelectionMerge %228 None + OpBranchConditional %false %229 %228 + %229 = OpLabel + OpBranch %219 + %228 = OpLabel + OpBranch %230 + %230 = OpLabel + OpLoopMerge %231 %232 None + OpBranch %233 + %233 = OpLabel + %234 = OpLoad %int %j + %235 = OpSLessThan %bool %234 %int_8 + OpSelectionMerge %236 None + OpBranchConditional %235 %237 %238 + %237 = OpLabel + OpBranch %236 + %238 = OpLabel + OpBranch %231 + %236 = OpLabel + %239 = OpLoad %int %j + %240 = OpLoad %int %i + %241 = OpIMul %int %239 %int_2 + %242 = OpIMul %int %240 %int_2 + %243 = OpIMul %int %242 %int_16 + %244 = OpIAdd %int %241 %243 + %245 = OpAccessChain %_ptr_Private_int %map %244 + %246 = OpLoad %int %245 + %247 = OpIEqual %bool %246 %int_0 + OpSelectionMerge %248 None + OpBranchConditional %247 %249 %248 + %249 = OpLabel + %250 = OpLoad %int %j + %251 = OpAccessChain %_ptr_Function_int %p %uint_0 + %252 = OpIMul %int %250 %int_2 + OpStore %251 %252 + %253 = OpLoad %int %i + %254 = OpAccessChain %_ptr_Function_int %p %uint_1 + %255 = OpIMul %int %253 %int_2 + OpStore %254 %255 + OpStore %canwalk %true + OpBranch %248 + %248 = OpLabel + OpBranch %232 + %232 = OpLabel + %256 = OpLoad %int %j + %257 = OpIAdd %int %256 %int_1 + OpStore %j %257 + OpBranch %230 + %231 = OpLabel + OpBranch %219 + %219 = OpLabel + %258 = OpLoad %int %i + %259 = OpIAdd %int %258 %int_1 + OpStore %i %259 + OpBranch %217 + %218 = OpLabel + %260 = OpAccessChain %_ptr_Function_int %p %uint_0 + %261 = OpLoad %int %260 + %262 = OpAccessChain %_ptr_Function_int %p %uint_1 + %263 = OpLoad %int %262 + %264 = OpIMul %int %263 %int_16 + %265 = OpIAdd %int %261 %264 + %266 = OpAccessChain %_ptr_Private_int %map %265 + OpStore %266 %int_1 + OpBranch %213 + %215 = OpLabel + %267 = OpLoad %int %v + %268 = OpLoad %int %directions + %269 = OpSMod %int %267 %268 + OpStore %d %269 + %270 = OpLoad %int %directions + %271 = OpLoad %int %v + %272 = OpIAdd %int %271 %270 + OpStore %v %272 + %273 = OpLoad %int %d + %274 = OpSGreaterThanEqual %bool %273 %int_0 + OpStore %x_238_phi %274 + OpSelectionMerge %275 None + OpBranchConditional %274 %276 %275 + %276 = OpLabel + %277 = OpAccessChain %_ptr_Function_int %p %uint_0 + %278 = OpLoad %int %277 + %279 = OpSGreaterThan %bool %278 %int_0 + OpStore %x_237 %279 + %280 = OpLoad %bool %x_237 + OpStore %x_238_phi %280 + OpBranch %275 + %275 = OpLabel + %281 = OpLoad %bool %x_238_phi + OpStore %x_251_phi %281 + OpSelectionMerge %282 None + OpBranchConditional %281 %283 %282 + %283 = OpLabel + %284 = OpAccessChain %_ptr_Function_int %p %uint_0 + %285 = OpLoad %int %284 + %286 = OpAccessChain %_ptr_Function_int %p %uint_1 + %287 = OpLoad %int %286 + %288 = OpISub %int %285 %int_2 + %289 = OpIMul %int %287 %int_16 + %290 = OpIAdd %int %288 %289 + %291 = OpAccessChain %_ptr_Private_int %map %290 + %292 = OpLoad %int %291 + %293 = OpIEqual %bool %292 %int_0 + OpStore %x_250 %293 + %294 = OpLoad %bool %x_250 + OpStore %x_251_phi %294 + OpBranch %282 + %282 = OpLabel + %295 = OpLoad %bool %x_251_phi + OpSelectionMerge %296 None + OpBranchConditional %295 %297 %296 + %297 = OpLabel + %298 = OpLoad %int %d + %299 = OpISub %int %298 %int_1 + OpStore %d %299 + %300 = OpAccessChain %_ptr_Function_int %p %uint_0 + %301 = OpLoad %int %300 + %302 = OpAccessChain %_ptr_Function_int %p %uint_1 + %303 = OpLoad %int %302 + %304 = OpIMul %int %303 %int_16 + %305 = OpIAdd %int %301 %304 + %306 = OpAccessChain %_ptr_Private_int %map %305 + OpStore %306 %int_1 + %307 = OpAccessChain %_ptr_Function_int %p %uint_0 + %308 = OpLoad %int %307 + %309 = OpAccessChain %_ptr_Function_int %p %uint_1 + %310 = OpLoad %int %309 + %311 = OpISub %int %308 %int_1 + %312 = OpIMul %int %310 %int_16 + %313 = OpIAdd %int %311 %312 + %314 = OpAccessChain %_ptr_Private_int %map %313 + OpStore %314 %int_1 + %315 = OpAccessChain %_ptr_Function_int %p %uint_0 + %316 = OpLoad %int %315 + %317 = OpAccessChain %_ptr_Function_int %p %uint_1 + %318 = OpLoad %int %317 + %319 = OpISub %int %316 %int_2 + %320 = OpIMul %int %318 %int_16 + %321 = OpIAdd %int %319 %320 + %322 = OpAccessChain %_ptr_Private_int %map %321 + OpStore %322 %int_1 + %323 = OpAccessChain %_ptr_Function_int %p %uint_0 + %324 = OpLoad %int %323 + %325 = OpAccessChain %_ptr_Function_int %p %uint_0 + %326 = OpISub %int %324 %int_2 + OpStore %325 %326 + OpBranch %296 + %296 = OpLabel + %327 = OpLoad %int %d + %328 = OpSGreaterThanEqual %bool %327 %int_0 + OpStore %x_290_phi %328 + OpSelectionMerge %329 None + OpBranchConditional %328 %330 %329 + %330 = OpLabel + %331 = OpAccessChain %_ptr_Function_int %p %uint_1 + %332 = OpLoad %int %331 + %333 = OpSGreaterThan %bool %332 %int_0 + OpStore %x_289 %333 + %334 = OpLoad %bool %x_289 + OpStore %x_290_phi %334 + OpBranch %329 + %329 = OpLabel + %335 = OpLoad %bool %x_290_phi + OpStore %x_303_phi %335 + OpSelectionMerge %336 None + OpBranchConditional %335 %337 %336 + %337 = OpLabel + %338 = OpAccessChain %_ptr_Function_int %p %uint_0 + %339 = OpLoad %int %338 + %340 = OpAccessChain %_ptr_Function_int %p %uint_1 + %341 = OpLoad %int %340 + %342 = OpISub %int %341 %int_2 + %343 = OpIMul %int %342 %int_16 + %344 = OpIAdd %int %339 %343 + %345 = OpAccessChain %_ptr_Private_int %map %344 + %346 = OpLoad %int %345 + %347 = OpIEqual %bool %346 %int_0 + OpStore %x_302 %347 + %348 = OpLoad %bool %x_302 + OpStore %x_303_phi %348 + OpBranch %336 + %336 = OpLabel + %349 = OpLoad %bool %x_303_phi + OpSelectionMerge %350 None + OpBranchConditional %349 %351 %350 + %351 = OpLabel + %352 = OpLoad %int %d + %353 = OpISub %int %352 %int_1 + OpStore %d %353 + %354 = OpAccessChain %_ptr_Function_int %p %uint_0 + %355 = OpLoad %int %354 + %356 = OpAccessChain %_ptr_Function_int %p %uint_1 + %357 = OpLoad %int %356 + %358 = OpIMul %int %357 %int_16 + %359 = OpIAdd %int %355 %358 + %360 = OpAccessChain %_ptr_Private_int %map %359 + OpStore %360 %int_1 + %361 = OpAccessChain %_ptr_Function_int %p %uint_0 + %362 = OpLoad %int %361 + %363 = OpAccessChain %_ptr_Function_int %p %uint_1 + %364 = OpLoad %int %363 + %365 = OpISub %int %364 %int_1 + %366 = OpIMul %int %365 %int_16 + %367 = OpIAdd %int %362 %366 + %368 = OpAccessChain %_ptr_Private_int %map %367 + OpStore %368 %int_1 + %369 = OpAccessChain %_ptr_Function_int %p %uint_0 + %370 = OpLoad %int %369 + %371 = OpAccessChain %_ptr_Function_int %p %uint_1 + %372 = OpLoad %int %371 + %373 = OpISub %int %372 %int_2 + %374 = OpIMul %int %373 %int_16 + %375 = OpIAdd %int %370 %374 + %376 = OpAccessChain %_ptr_Private_int %map %375 + OpStore %376 %int_1 + %377 = OpAccessChain %_ptr_Function_int %p %uint_1 + %378 = OpLoad %int %377 + %379 = OpAccessChain %_ptr_Function_int %p %uint_1 + %380 = OpISub %int %378 %int_2 + OpStore %379 %380 + OpBranch %350 + %350 = OpLabel + %381 = OpLoad %int %d + %382 = OpSGreaterThanEqual %bool %381 %int_0 + OpStore %x_342_phi %382 + OpSelectionMerge %383 None + OpBranchConditional %382 %384 %383 + %384 = OpLabel + %385 = OpAccessChain %_ptr_Function_int %p %uint_0 + %386 = OpLoad %int %385 + %387 = OpSLessThan %bool %386 %int_14 + OpStore %x_341 %387 + %388 = OpLoad %bool %x_341 + OpStore %x_342_phi %388 + OpBranch %383 + %383 = OpLabel + %389 = OpLoad %bool %x_342_phi + OpStore %x_355_phi %389 + OpSelectionMerge %390 None + OpBranchConditional %389 %391 %390 + %391 = OpLabel + %392 = OpAccessChain %_ptr_Function_int %p %uint_0 + %393 = OpLoad %int %392 + %394 = OpAccessChain %_ptr_Function_int %p %uint_1 + %395 = OpLoad %int %394 + %396 = OpIAdd %int %393 %int_2 + %397 = OpIMul %int %395 %int_16 + %398 = OpIAdd %int %396 %397 + %399 = OpAccessChain %_ptr_Private_int %map %398 + %400 = OpLoad %int %399 + %401 = OpIEqual %bool %400 %int_0 + OpStore %x_354 %401 + %402 = OpLoad %bool %x_354 + OpStore %x_355_phi %402 + OpBranch %390 + %390 = OpLabel + %403 = OpLoad %bool %x_355_phi + OpSelectionMerge %404 None + OpBranchConditional %403 %405 %404 + %405 = OpLabel + %406 = OpLoad %int %d + %407 = OpISub %int %406 %int_1 + OpStore %d %407 + %408 = OpAccessChain %_ptr_Function_int %p %uint_0 + %409 = OpLoad %int %408 + %410 = OpAccessChain %_ptr_Function_int %p %uint_1 + %411 = OpLoad %int %410 + %412 = OpIMul %int %411 %int_16 + %413 = OpIAdd %int %409 %412 + %414 = OpAccessChain %_ptr_Private_int %map %413 + OpStore %414 %int_1 + %415 = OpAccessChain %_ptr_Function_int %p %uint_0 + %416 = OpLoad %int %415 + %417 = OpAccessChain %_ptr_Function_int %p %uint_1 + %418 = OpLoad %int %417 + %419 = OpIAdd %int %416 %int_1 + %420 = OpIMul %int %418 %int_16 + %421 = OpIAdd %int %419 %420 + %422 = OpAccessChain %_ptr_Private_int %map %421 + OpStore %422 %int_1 + %423 = OpAccessChain %_ptr_Function_int %p %uint_0 + %424 = OpLoad %int %423 + %425 = OpAccessChain %_ptr_Function_int %p %uint_1 + %426 = OpLoad %int %425 + %427 = OpIAdd %int %424 %int_2 + %428 = OpIMul %int %426 %int_16 + %429 = OpIAdd %int %427 %428 + %430 = OpAccessChain %_ptr_Private_int %map %429 + OpStore %430 %int_1 + %431 = OpAccessChain %_ptr_Function_int %p %uint_0 + %432 = OpLoad %int %431 + %433 = OpAccessChain %_ptr_Function_int %p %uint_0 + %434 = OpIAdd %int %432 %int_2 + OpStore %433 %434 + OpBranch %404 + %404 = OpLabel + %435 = OpLoad %int %d + %436 = OpSGreaterThanEqual %bool %435 %int_0 + OpStore %x_394_phi %436 + OpSelectionMerge %437 None + OpBranchConditional %436 %438 %437 + %438 = OpLabel + %439 = OpAccessChain %_ptr_Function_int %p %uint_1 + %440 = OpLoad %int %439 + %441 = OpSLessThan %bool %440 %int_14 + OpStore %x_393 %441 + %442 = OpLoad %bool %x_393 + OpStore %x_394_phi %442 + OpBranch %437 + %437 = OpLabel + %443 = OpLoad %bool %x_394_phi + OpStore %x_407_phi %443 + OpSelectionMerge %444 None + OpBranchConditional %443 %445 %444 + %445 = OpLabel + %446 = OpAccessChain %_ptr_Function_int %p %uint_0 + %447 = OpLoad %int %446 + %448 = OpAccessChain %_ptr_Function_int %p %uint_1 + %449 = OpLoad %int %448 + %450 = OpIAdd %int %449 %int_2 + %451 = OpIMul %int %450 %int_16 + %452 = OpIAdd %int %447 %451 + %453 = OpAccessChain %_ptr_Private_int %map %452 + %454 = OpLoad %int %453 + %455 = OpIEqual %bool %454 %int_0 + OpStore %x_406 %455 + %456 = OpLoad %bool %x_406 + OpStore %x_407_phi %456 + OpBranch %444 + %444 = OpLabel + %457 = OpLoad %bool %x_407_phi + OpSelectionMerge %458 None + OpBranchConditional %457 %459 %458 + %459 = OpLabel + %460 = OpLoad %int %d + %461 = OpISub %int %460 %int_1 + OpStore %d %461 + %462 = OpAccessChain %_ptr_Function_int %p %uint_0 + %463 = OpLoad %int %462 + %464 = OpAccessChain %_ptr_Function_int %p %uint_1 + %465 = OpLoad %int %464 + %466 = OpIMul %int %465 %int_16 + %467 = OpIAdd %int %463 %466 + %468 = OpAccessChain %_ptr_Private_int %map %467 + OpStore %468 %int_1 + %469 = OpAccessChain %_ptr_Function_int %p %uint_0 + %470 = OpLoad %int %469 + %471 = OpAccessChain %_ptr_Function_int %p %uint_1 + %472 = OpLoad %int %471 + %473 = OpIAdd %int %472 %int_1 + %474 = OpIMul %int %473 %int_16 + %475 = OpIAdd %int %470 %474 + %476 = OpAccessChain %_ptr_Private_int %map %475 + OpStore %476 %int_1 + %477 = OpAccessChain %_ptr_Function_int %p %uint_0 + %478 = OpLoad %int %477 + %479 = OpAccessChain %_ptr_Function_int %p %uint_1 + %480 = OpLoad %int %479 + %481 = OpIAdd %int %480 %int_2 + %482 = OpIMul %int %481 %int_16 + %483 = OpIAdd %int %478 %482 + %484 = OpAccessChain %_ptr_Private_int %map %483 + OpStore %484 %int_1 + %485 = OpAccessChain %_ptr_Function_int %p %uint_1 + %486 = OpLoad %int %485 + %487 = OpAccessChain %_ptr_Function_int %p %uint_1 + %488 = OpIAdd %int %486 %int_2 + OpStore %487 %488 + OpBranch %458 + %458 = OpLabel + OpBranch %213 + %213 = OpLabel + %489 = OpAccessChain %_ptr_Function_int %ipos %uint_1 + %490 = OpLoad %int %489 + %491 = OpAccessChain %_ptr_Function_int %ipos %uint_0 + %492 = OpLoad %int %491 + %493 = OpIMul %int %490 %int_16 + %494 = OpIAdd %int %493 %492 + %495 = OpAccessChain %_ptr_Private_int %map %494 + %496 = OpLoad %int %495 + %497 = OpIEqual %bool %496 %int_1 + OpSelectionMerge %498 None + OpBranchConditional %497 %499 %498 + %499 = OpLabel + OpStore %x_GLF_color %501 + OpReturn + %498 = OpLabel + OpBranch %96 + %96 = OpLabel + %502 = OpLoad %bool %canwalk + OpSelectionMerge %503 None + OpBranchConditional %502 %504 %505 + %504 = OpLabel + OpBranch %503 + %505 = OpLabel + OpBranch %95 + %503 = OpLabel + OpBranch %94 + %95 = OpLabel + OpStore %x_GLF_color %506 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %507 +%tint_symbol_1 = OpFunctionParameter %main_out + %511 = OpLabel + %512 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %512 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %28 + %514 = OpLabel + %515 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %515 + %516 = OpFunctionCall %void %main_1 + %518 = OpLoad %v4float %x_GLF_color + %519 = OpCompositeConstruct %main_out %518 + %517 = OpFunctionCall %void %tint_symbol_3 %519 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 96[%96] is not post dominated by the back-edge block 503[%503] + %503 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..14e531e412 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-dead-break-and-unroll/1.wgsl.expected.wgsl @@ -0,0 +1,357 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var map : array; + +var x_GLF_color : vec4; + +var x_60 : mat2x4 = mat2x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + +fn main_1() { + var pos : vec2; + var ipos : vec2; + var i : i32; + var p : vec2; + var canwalk : bool; + var v : i32; + var directions : i32; + var j : i32; + var d : i32; + let x_63 : vec4 = gl_FragCoord; + let x_67 : vec2 = x_7.resolution; + let x_68 : i32 = -((256 - 14)); + pos = (vec2(x_63.x, x_63.y) / x_67); + let x_71 : f32 = pos.x; + let x_75 : f32 = pos.y; + ipos = vec2(i32((x_71 * 16.0)), i32((x_75 * 16.0))); + i = 0; + loop { + let x_83 : i32 = i; + if ((x_83 < 256)) { + } else { + break; + } + let x_86 : i32 = i; + map[x_86] = 0; + + continuing { + let x_88 : i32 = i; + i = (x_88 + 1); + } + } + p = vec2(0, 0); + canwalk = true; + v = 0; + loop { + var x_110 : bool; + var x_130 : bool; + var x_150 : bool; + var x_171 : bool; + var x_111_phi : bool; + var x_131_phi : bool; + var x_151_phi : bool; + var x_172_phi : bool; + let x_94 : i32 = v; + v = (x_94 + 1); + directions = 0; + let x_97 : i32 = p.x; + let x_98 : bool = (x_97 > 0); + x_111_phi = x_98; + if (x_98) { + let x_102 : i32 = p.x; + let x_105 : i32 = p.y; + let x_109 : i32 = map[((x_102 - 2) + (x_105 * 16))]; + x_110 = (x_109 == 0); + x_111_phi = x_110; + } + let x_111 : bool = x_111_phi; + if (x_111) { + let x_114 : i32 = directions; + directions = (x_114 + 1); + } + let x_117 : i32 = p.y; + let x_118 : bool = (x_117 > 0); + x_131_phi = x_118; + if (x_118) { + let x_122 : i32 = p.x; + let x_124 : i32 = p.y; + let x_129 : i32 = map[(x_122 + ((x_124 - 2) * 16))]; + x_130 = (x_129 == 0); + x_131_phi = x_130; + } + let x_131 : bool = x_131_phi; + if (x_131) { + let x_134 : i32 = directions; + directions = (x_134 + 1); + } + let x_137 : i32 = p.x; + let x_138 : bool = (x_137 < 14); + x_151_phi = x_138; + if (x_138) { + let x_142 : i32 = p.x; + let x_145 : i32 = p.y; + let x_149 : i32 = map[((x_142 + 2) + (x_145 * 16))]; + x_150 = (x_149 == 0); + x_151_phi = x_150; + } + let x_151 : bool = x_151_phi; + if (x_151) { + let x_154 : i32 = directions; + directions = (x_154 + 1); + } + let x_156 : i32 = (256 - x_68); + let x_158 : i32 = p.y; + let x_159 : bool = (x_158 < 14); + x_172_phi = x_159; + if (x_159) { + let x_163 : i32 = p.x; + let x_165 : i32 = p.y; + let x_170 : i32 = map[(x_163 + ((x_165 + 2) * 16))]; + x_171 = (x_170 == 0); + x_172_phi = x_171; + } + let x_172 : bool = x_172_phi; + if (x_172) { + let x_175 : i32 = directions; + directions = (x_175 + 1); + } + var x_237 : bool; + var x_250 : bool; + var x_289 : bool; + var x_302 : bool; + var x_341 : bool; + var x_354 : bool; + var x_393 : bool; + var x_406 : bool; + var x_238_phi : bool; + var x_251_phi : bool; + var x_290_phi : bool; + var x_303_phi : bool; + var x_342_phi : bool; + var x_355_phi : bool; + var x_394_phi : bool; + var x_407_phi : bool; + let x_177 : i32 = directions; + if ((x_177 == 0)) { + canwalk = false; + i = 0; + loop { + let x_186 : i32 = i; + if ((x_186 < 8)) { + } else { + break; + } + j = 0; + let x_189 : i32 = (x_156 - x_186); + x_60 = mat2x4(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + if (false) { + continue; + } + loop { + let x_194 : i32 = j; + if ((x_194 < 8)) { + } else { + break; + } + let x_197 : i32 = j; + let x_199 : i32 = i; + let x_204 : i32 = map[((x_197 * 2) + ((x_199 * 2) * 16))]; + if ((x_204 == 0)) { + let x_208 : i32 = j; + p.x = (x_208 * 2); + let x_211 : i32 = i; + p.y = (x_211 * 2); + canwalk = true; + } + + continuing { + let x_214 : i32 = j; + j = (x_214 + 1); + } + } + + continuing { + let x_216 : i32 = i; + i = (x_216 + 1); + } + } + let x_219 : i32 = p.x; + let x_221 : i32 = p.y; + map[(x_219 + (x_221 * 16))] = 1; + } else { + let x_225 : i32 = v; + let x_226 : i32 = directions; + d = (x_225 % x_226); + let x_228 : i32 = directions; + let x_229 : i32 = v; + v = (x_229 + x_228); + let x_231 : i32 = d; + let x_232 : bool = (x_231 >= 0); + x_238_phi = x_232; + if (x_232) { + let x_236 : i32 = p.x; + x_237 = (x_236 > 0); + x_238_phi = x_237; + } + let x_238 : bool = x_238_phi; + x_251_phi = x_238; + if (x_238) { + let x_242 : i32 = p.x; + let x_245 : i32 = p.y; + let x_249 : i32 = map[((x_242 - 2) + (x_245 * 16))]; + x_250 = (x_249 == 0); + x_251_phi = x_250; + } + let x_251 : bool = x_251_phi; + if (x_251) { + let x_254 : i32 = d; + d = (x_254 - 1); + let x_257 : i32 = p.x; + let x_259 : i32 = p.y; + map[(x_257 + (x_259 * 16))] = 1; + let x_264 : i32 = p.x; + let x_267 : i32 = p.y; + map[((x_264 - 1) + (x_267 * 16))] = 1; + let x_272 : i32 = p.x; + let x_275 : i32 = p.y; + map[((x_272 - 2) + (x_275 * 16))] = 1; + let x_280 : i32 = p.x; + p.x = (x_280 - 2); + } + let x_283 : i32 = d; + let x_284 : bool = (x_283 >= 0); + x_290_phi = x_284; + if (x_284) { + let x_288 : i32 = p.y; + x_289 = (x_288 > 0); + x_290_phi = x_289; + } + let x_290 : bool = x_290_phi; + x_303_phi = x_290; + if (x_290) { + let x_294 : i32 = p.x; + let x_296 : i32 = p.y; + let x_301 : i32 = map[(x_294 + ((x_296 - 2) * 16))]; + x_302 = (x_301 == 0); + x_303_phi = x_302; + } + let x_303 : bool = x_303_phi; + if (x_303) { + let x_306 : i32 = d; + d = (x_306 - 1); + let x_309 : i32 = p.x; + let x_311 : i32 = p.y; + map[(x_309 + (x_311 * 16))] = 1; + let x_316 : i32 = p.x; + let x_318 : i32 = p.y; + map[(x_316 + ((x_318 - 1) * 16))] = 1; + let x_324 : i32 = p.x; + let x_326 : i32 = p.y; + map[(x_324 + ((x_326 - 2) * 16))] = 1; + let x_332 : i32 = p.y; + p.y = (x_332 - 2); + } + let x_335 : i32 = d; + let x_336 : bool = (x_335 >= 0); + x_342_phi = x_336; + if (x_336) { + let x_340 : i32 = p.x; + x_341 = (x_340 < 14); + x_342_phi = x_341; + } + let x_342 : bool = x_342_phi; + x_355_phi = x_342; + if (x_342) { + let x_346 : i32 = p.x; + let x_349 : i32 = p.y; + let x_353 : i32 = map[((x_346 + 2) + (x_349 * 16))]; + x_354 = (x_353 == 0); + x_355_phi = x_354; + } + let x_355 : bool = x_355_phi; + if (x_355) { + let x_358 : i32 = d; + d = (x_358 - 1); + let x_361 : i32 = p.x; + let x_363 : i32 = p.y; + map[(x_361 + (x_363 * 16))] = 1; + let x_368 : i32 = p.x; + let x_371 : i32 = p.y; + map[((x_368 + 1) + (x_371 * 16))] = 1; + let x_376 : i32 = p.x; + let x_379 : i32 = p.y; + map[((x_376 + 2) + (x_379 * 16))] = 1; + let x_384 : i32 = p.x; + p.x = (x_384 + 2); + } + let x_387 : i32 = d; + let x_388 : bool = (x_387 >= 0); + x_394_phi = x_388; + if (x_388) { + let x_392 : i32 = p.y; + x_393 = (x_392 < 14); + x_394_phi = x_393; + } + let x_394 : bool = x_394_phi; + x_407_phi = x_394; + if (x_394) { + let x_398 : i32 = p.x; + let x_400 : i32 = p.y; + let x_405 : i32 = map[(x_398 + ((x_400 + 2) * 16))]; + x_406 = (x_405 == 0); + x_407_phi = x_406; + } + let x_407 : bool = x_407_phi; + if (x_407) { + let x_410 : i32 = d; + d = (x_410 - 1); + let x_413 : i32 = p.x; + let x_415 : i32 = p.y; + map[(x_413 + (x_415 * 16))] = 1; + let x_420 : i32 = p.x; + let x_422 : i32 = p.y; + map[(x_420 + ((x_422 + 1) * 16))] = 1; + let x_428 : i32 = p.x; + let x_430 : i32 = p.y; + map[(x_428 + ((x_430 + 2) * 16))] = 1; + let x_436 : i32 = p.y; + p.y = (x_436 + 2); + } + } + let x_440 : i32 = ipos.y; + let x_443 : i32 = ipos.x; + let x_446 : i32 = map[((x_440 * 16) + x_443)]; + if ((x_446 == 1)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + return; + } + + continuing { + let x_450 : bool = canwalk; + if (x_450) { + } else { + break; + } + } + } + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm new file mode 100644 index 0000000000..2f7825277b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm @@ -0,0 +1,255 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %collision_vf2_vf4_ "collision(vf2;vf4;" + OpName %pos "pos" + OpName %quad "quad" + OpName %match_vf2_ "match(vf2;" + OpName %pos_0 "pos" + OpName %res "res" + OpName %i "i" + OpName %param "param" + OpName %param_0 "param" + OpName %indexable "indexable" + OpName %indexable_0 "indexable" + OpName %indexable_1 "indexable" + OpName %indexable_2 "indexable" + OpName %lin "lin" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %param_1 "param" + OpName %index "index" + OpName %state "state" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool + %32 = OpTypeFunction %bool %_ptr_Function_v2float %_ptr_Function_v4float + %33 = OpTypeFunction %v4float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %44 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_8 = OpConstant %int 8 + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %53 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %54 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %55 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %57 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %60 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %62 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %64 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %66 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %67 = OpConstantComposite %_arr_v4float_uint_8 %53 %54 %55 %57 %60 %62 %64 %66 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %72 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %73 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %74 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %75 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %76 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %77 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %78 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %79 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %80 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %81 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %82 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %83 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %84 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %85 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %86 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %87 = OpConstantComposite %_arr_v4float_uint_16 %72 %73 %74 %75 %76 %77 %78 %79 %72 %80 %81 %82 %83 %84 %85 %86 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_ptr_Private_int = OpTypePointer Private %int + %index = OpVariable %_ptr_Private_int Private +%_arr_int_uint_16 = OpTypeArray %int %uint_16 +%_ptr_Private__arr_int_uint_16 = OpTypePointer Private %_arr_int_uint_16 + %state = OpVariable %_ptr_Private__arr_int_uint_16 Private + %main = OpFunction %void None %25 + %101 = OpLabel + %lin = OpVariable %_ptr_Function_v2float Function + %param_1 = OpVariable %_ptr_Function_v2float Function + %102 = OpLoad %v4float %gl_FragCoord + %103 = OpVectorShuffle %v2float %102 %102 0 1 + %104 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %105 = OpLoad %v2float %104 + %106 = OpFDiv %v2float %103 %105 + OpStore %lin %106 + %107 = OpLoad %v2float %lin + %108 = OpVectorTimesScalar %v2float %107 %float_32 + %109 = OpExtInst %v2float %1 Floor %108 + OpStore %lin %109 + %110 = OpLoad %v2float %lin + OpStore %param_1 %110 + %111 = OpFunctionCall %v4float %match_vf2_ %param_1 + OpStore %_GLF_color %111 + OpReturn + OpFunctionEnd +%collision_vf2_vf4_ = OpFunction %bool None %32 + %pos = OpFunctionParameter %_ptr_Function_v2float + %quad = OpFunctionParameter %_ptr_Function_v4float + %112 = OpLabel + %113 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %114 = OpLoad %float %113 + %115 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %116 = OpLoad %float %115 + %117 = OpFOrdLessThan %bool %114 %116 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + OpReturnValue %false + %118 = OpLabel + %120 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %121 = OpLoad %float %120 + %122 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %123 = OpLoad %float %122 + %124 = OpFOrdLessThan %bool %121 %123 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %125 + %126 = OpLabel + OpReturnValue %false + %125 = OpLabel + %127 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %128 = OpLoad %float %127 + %129 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %130 = OpLoad %float %129 + %131 = OpAccessChain %_ptr_Function_float %quad %uint_2 + %132 = OpLoad %float %131 + %133 = OpFAdd %float %130 %132 + %134 = OpFOrdGreaterThan %bool %128 %133 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %135 + %136 = OpLabel + OpReturnValue %false + %135 = OpLabel + %137 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %138 = OpLoad %float %137 + %139 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %140 = OpLoad %float %139 + %141 = OpAccessChain %_ptr_Function_float %quad %uint_3 + %142 = OpLoad %float %141 + %143 = OpFAdd %float %140 %142 + %144 = OpFOrdGreaterThan %bool %138 %143 + OpSelectionMerge %145 None + OpBranchConditional %144 %146 %145 + %146 = OpLabel + OpReturnValue %false + %145 = OpLabel + OpReturnValue %true + OpFunctionEnd + %match_vf2_ = OpFunction %v4float None %33 + %pos_0 = OpFunctionParameter %_ptr_Function_v2float + %147 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function + %i = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_v2float Function + %param_0 = OpVariable %_ptr_Function_v4float Function + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_8 Function +%indexable_0 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function +%indexable_1 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function +%indexable_2 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + OpStore %res %44 + OpStore %i %int_0 + OpBranch %148 + %148 = OpLabel + OpLoopMerge %149 %150 None + OpBranch %151 + %151 = OpLabel + %152 = OpLoad %int %i + %153 = OpSLessThan %bool %152 %int_8 + OpBranchConditional %153 %154 %149 + %154 = OpLabel + %155 = OpLoad %int %i + %156 = OpLoad %v2float %pos_0 + OpStore %param %156 + OpStore %indexable %67 + %157 = OpAccessChain %_ptr_Function_v4float %indexable %155 + %158 = OpLoad %v4float %157 + OpStore %param_0 %158 + %159 = OpFunctionCall %bool %collision_vf2_vf4_ %param %param_0 + OpSelectionMerge %160 None + OpBranchConditional %159 %161 %160 + %161 = OpLabel + %162 = OpLoad %int %i + OpStore %indexable_0 %67 + %163 = OpAccessChain %_ptr_Function_float %indexable_0 %162 %uint_0 + %164 = OpLoad %float %163 + %165 = OpConvertFToS %int %164 + %166 = OpLoad %int %i + OpStore %indexable_1 %67 + %167 = OpAccessChain %_ptr_Function_float %indexable_1 %166 %uint_1 + %168 = OpLoad %float %167 + %169 = OpConvertFToS %int %168 + %170 = OpIMul %int %165 %169 + %171 = OpLoad %int %i + %172 = OpIMul %int %171 %int_9 + %173 = OpIAdd %int %170 %172 + %174 = OpIAdd %int %173 %int_11 + %175 = OpSMod %int %174 %int_16 + OpStore %indexable_2 %87 + %176 = OpAccessChain %_ptr_Function_v4float %indexable_2 %175 + %177 = OpLoad %v4float %176 + OpStore %res %177 + OpBranch %160 + %160 = OpLabel + OpBranch %150 + %150 = OpLabel + %178 = OpLoad %int %i + %179 = OpIAdd %int %178 %int_1 + OpStore %i %179 + OpBranch %148 + %149 = OpLabel + %180 = OpLoad %v4float %res + OpReturnValue %180 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3588689955 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.hlsl @@ -0,0 +1,106 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_20 : register(b0, space0) { + uint4 x_20[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int index = 0; +static int state[16] = (int[16])0; + +bool collision_vf2_vf4_(inout float2 pos, inout float4 quad) { + const float x_114 = pos.x; + const float x_116 = quad.x; + if ((x_114 < x_116)) { + return false; + } + const float x_121 = pos.y; + const float x_123 = quad.y; + if ((x_121 < x_123)) { + return false; + } + const float x_128 = pos.x; + const float x_130 = quad.x; + const float x_132 = quad.z; + if ((x_128 > (x_130 + x_132))) { + return false; + } + const float x_138 = pos.y; + const float x_140 = quad.y; + const float x_142 = quad.w; + if ((x_138 > (x_140 + x_142))) { + return false; + } + return true; +} + +float4 match_vf2_(inout float2 pos_1) { + float4 res = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + float2 param = float2(0.0f, 0.0f); + float4 param_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 indexable[8] = (float4[8])0; + float4 indexable_1[8] = (float4[8])0; + float4 indexable_2[8] = (float4[8])0; + float4 indexable_3[16] = (float4[16])0; + res = float4(0.5f, 0.5f, 1.0f, 1.0f); + i = 0; + { + for(; (i < 8); i = (i + 1)) { + const int x_155 = i; + const float2 x_156 = pos_1; + param = x_156; + const float4 tint_symbol_5[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable = tint_symbol_5; + const float4 x_158 = indexable[x_155]; + param_1 = x_158; + const bool x_159 = collision_vf2_vf4_(param, param_1); + if (x_159) { + const int x_162 = i; + const float4 tint_symbol_6[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable_1 = tint_symbol_6; + const float x_164 = indexable_1[x_162].x; + const int x_166 = i; + const float4 tint_symbol_7[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable_2 = tint_symbol_7; + const float x_168 = indexable_2[x_166].y; + const int x_171 = i; + const float4 tint_symbol_8[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable_3 = tint_symbol_8; + const float4 x_177 = indexable_3[((((int(x_164) * int(x_168)) + (x_171 * 9)) + 11) % 16)]; + res = x_177; + } + } + } + return res; +} + +void main_1() { + float2 lin = float2(0.0f, 0.0f); + float2 param_2 = float2(0.0f, 0.0f); + const float4 x_102 = gl_FragCoord; + const float2 x_105 = asfloat(x_20[0].xy); + lin = (float2(x_102.x, x_102.y) / x_105); + lin = floor((lin * 32.0f)); + param_2 = lin; + const float4 x_111 = match_vf2_(param_2); + x_GLF_color = x_111; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..8780c86dfe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.msl @@ -0,0 +1,122 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[16]; +}; +struct tint_array_wrapper_1 { + float4 arr[8]; +}; +struct tint_array_wrapper_2 { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +bool collision_vf2_vf4_(thread float2* const pos, thread float4* const quad) { + float const x_114 = (*(pos)).x; + float const x_116 = (*(quad)).x; + if ((x_114 < x_116)) { + return false; + } + float const x_121 = (*(pos)).y; + float const x_123 = (*(quad)).y; + if ((x_121 < x_123)) { + return false; + } + float const x_128 = (*(pos)).x; + float const x_130 = (*(quad)).x; + float const x_132 = (*(quad)).z; + if ((x_128 > (x_130 + x_132))) { + return false; + } + float const x_138 = (*(pos)).y; + float const x_140 = (*(quad)).y; + float const x_142 = (*(quad)).w; + if ((x_138 > (x_140 + x_142))) { + return false; + } + return true; +} + +float4 match_vf2_(thread float2* const pos_1) { + float4 res = 0.0f; + int i = 0; + float2 param = 0.0f; + float4 param_1 = 0.0f; + tint_array_wrapper_1 indexable = {}; + tint_array_wrapper_1 indexable_1 = {}; + tint_array_wrapper_1 indexable_2 = {}; + tint_array_wrapper_2 indexable_3 = {}; + res = float4(0.5f, 0.5f, 1.0f, 1.0f); + i = 0; + while (true) { + int const x_152 = i; + if ((x_152 < 8)) { + } else { + break; + } + int const x_155 = i; + float2 const x_156 = *(pos_1); + param = x_156; + tint_array_wrapper_1 const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable = tint_symbol_4; + float4 const x_158 = indexable.arr[x_155]; + param_1 = x_158; + bool const x_159 = collision_vf2_vf4_(&(param), &(param_1)); + if (x_159) { + int const x_162 = i; + tint_array_wrapper_1 const tint_symbol_5 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable_1 = tint_symbol_5; + float const x_164 = indexable_1.arr[x_162].x; + int const x_166 = i; + tint_array_wrapper_1 const tint_symbol_6 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable_2 = tint_symbol_6; + float const x_168 = indexable_2.arr[x_166].y; + int const x_171 = i; + tint_array_wrapper_2 const tint_symbol_7 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable_3 = tint_symbol_7; + float4 const x_177 = indexable_3.arr[((((int(x_164) * int(x_168)) + (x_171 * 9)) + 11) % 16)]; + res = x_177; + } + { + int const x_178 = i; + i = (x_178 + 1); + } + } + float4 const x_180 = res; + return x_180; +} + +void main_1(constant buf0& x_20, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + float2 lin = 0.0f; + float2 param_2 = 0.0f; + float4 const x_102 = *(tint_symbol_9); + float2 const x_105 = x_20.resolution; + lin = (float2(x_102.x, x_102.y) / x_105); + float2 const x_107 = lin; + lin = floor((x_107 * 32.0f)); + float2 const x_110 = lin; + param_2 = x_110; + float4 const x_111 = match_vf2_(&(param_2)); + *(tint_symbol_10) = x_111; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_20 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_20, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..d01b8b5700 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.spvasm @@ -0,0 +1,306 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 221 +; Schema: 0 + OpCapability Shader + %202 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_20 "x_20" + OpName %x_GLF_color "x_GLF_color" + OpName %index "index" + OpName %state "state" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %collision_vf2_vf4_ "collision_vf2_vf4_" + OpName %pos "pos" + OpName %quad "quad" + OpName %match_vf2_ "match_vf2_" + OpName %pos_1 "pos_1" + OpName %res "res" + OpName %i "i" + OpName %param "param" + OpName %param_1 "param_1" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %indexable_2 "indexable_2" + OpName %indexable_3 "indexable_3" + OpName %main_1 "main_1" + OpName %lin "lin" + OpName %param_2 "param_2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_20 NonWritable + OpDecorate %x_20 DescriptorSet 0 + OpDecorate %x_20 Binding 0 + OpDecorate %_arr_int_uint_16 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_8 ArrayStride 16 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_20 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %14 = OpConstantNull %int + %index = OpVariable %_ptr_Private_int Private %14 + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_int_uint_16 = OpTypeArray %int %uint_16 +%_ptr_Private__arr_int_uint_16 = OpTypePointer Private %_arr_int_uint_16 + %20 = OpConstantNull %_arr_int_uint_16 + %state = OpVariable %_ptr_Private__arr_int_uint_16 Private %20 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %bool = OpTypeBool +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpTypeFunction %bool %_ptr_Function_v2float %_ptr_Function_v4float + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %84 = OpTypeFunction %v4float %_ptr_Function_v2float +%_ptr_Function_int = OpTypePointer Function %int + %92 = OpConstantNull %v2float + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %98 = OpConstantNull %_arr_v4float_uint_8 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %104 = OpConstantNull %_arr_v4float_uint_16 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %107 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %int_8 = OpConstant %int 8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %124 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %125 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %126 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %128 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %131 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %133 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %135 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %137 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %138 = OpConstantComposite %_arr_v4float_uint_8 %124 %125 %126 %128 %131 %133 %135 %137 + %float_0 = OpConstant %float 0 + %154 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %155 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %157 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %158 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %159 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %160 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %161 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %162 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %164 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %166 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %167 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %168 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %169 = OpConstantComposite %_arr_v4float_uint_16 %154 %155 %156 %157 %158 %159 %160 %161 %154 %162 %163 %164 %165 %166 %167 %168 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %186 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 + %main_out = OpTypeStruct %v4float + %208 = OpTypeFunction %void %main_out +%collision_vf2_vf4_ = OpFunction %bool None %25 + %pos = OpFunctionParameter %_ptr_Function_v2float + %quad = OpFunctionParameter %_ptr_Function_v4float + %32 = OpLabel + %36 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %37 = OpLoad %float %36 + %39 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %40 = OpLoad %float %39 + %41 = OpFOrdLessThan %bool %37 %40 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpReturnValue %false + %42 = OpLabel + %47 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %48 = OpLoad %float %47 + %50 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %51 = OpLoad %float %50 + %52 = OpFOrdLessThan %bool %48 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + OpReturnValue %false + %53 = OpLabel + %56 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %57 = OpLoad %float %56 + %59 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %60 = OpLoad %float %59 + %63 = OpAccessChain %_ptr_Function_float %quad %uint_2 + %64 = OpLoad %float %63 + %65 = OpFAdd %float %60 %64 + %66 = OpFOrdGreaterThan %bool %57 %65 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %67 + %68 = OpLabel + OpReturnValue %false + %67 = OpLabel + %70 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %71 = OpLoad %float %70 + %73 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %74 = OpLoad %float %73 + %77 = OpAccessChain %_ptr_Function_float %quad %uint_3 + %78 = OpLoad %float %77 + %79 = OpFAdd %float %74 %78 + %80 = OpFOrdGreaterThan %bool %71 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + OpReturnValue %false + %81 = OpLabel + OpReturnValue %true + OpFunctionEnd + %match_vf2_ = OpFunction %v4float None %84 + %pos_1 = OpFunctionParameter %_ptr_Function_v2float + %87 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %i = OpVariable %_ptr_Function_int Function %14 + %param = OpVariable %_ptr_Function_v2float Function %92 + %param_1 = OpVariable %_ptr_Function_v4float Function %5 + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %98 +%indexable_1 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %98 +%indexable_2 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %98 +%indexable_3 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %104 + OpStore %res %107 + OpStore %i %int_0 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %110 %111 None + OpBranch %112 + %112 = OpLabel + %113 = OpLoad %int %i + %115 = OpSLessThan %bool %113 %int_8 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %118 + %117 = OpLabel + OpBranch %116 + %118 = OpLabel + OpBranch %110 + %116 = OpLabel + %119 = OpLoad %int %i + %121 = OpLoad %v2float %pos_1 + OpStore %param %121 + OpStore %indexable %138 + %139 = OpAccessChain %_ptr_Function_v4float %indexable %119 + %140 = OpLoad %v4float %139 + OpStore %param_1 %140 + %141 = OpFunctionCall %bool %collision_vf2_vf4_ %param %param_1 + OpSelectionMerge %144 None + OpBranchConditional %141 %145 %144 + %145 = OpLabel + %146 = OpLoad %int %i + OpStore %indexable_1 %138 + %147 = OpAccessChain %_ptr_Function_float %indexable_1 %146 %uint_0 + %148 = OpLoad %float %147 + %149 = OpLoad %int %i + OpStore %indexable_2 %138 + %150 = OpAccessChain %_ptr_Function_float %indexable_2 %149 %uint_1 + %151 = OpLoad %float %150 + %152 = OpLoad %int %i + OpStore %indexable_3 %169 + %170 = OpConvertFToS %int %148 + %171 = OpConvertFToS %int %151 + %172 = OpIMul %int %170 %171 + %174 = OpIMul %int %152 %int_9 + %175 = OpIAdd %int %172 %174 + %177 = OpIAdd %int %175 %int_11 + %179 = OpSMod %int %177 %int_16 + %180 = OpAccessChain %_ptr_Function_v4float %indexable_3 %179 + %181 = OpLoad %v4float %180 + OpStore %res %181 + OpBranch %144 + %144 = OpLabel + OpBranch %111 + %111 = OpLabel + %182 = OpLoad %int %i + %184 = OpIAdd %int %182 %int_1 + OpStore %i %184 + OpBranch %109 + %110 = OpLabel + %185 = OpLoad %v4float %res + OpReturnValue %185 + OpFunctionEnd + %main_1 = OpFunction %void None %186 + %189 = OpLabel + %lin = OpVariable %_ptr_Function_v2float Function %92 + %param_2 = OpVariable %_ptr_Function_v2float Function %92 + %192 = OpLoad %v4float %gl_FragCoord + %194 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_0 + %195 = OpLoad %v2float %194 + %196 = OpCompositeExtract %float %192 0 + %197 = OpCompositeExtract %float %192 1 + %198 = OpCompositeConstruct %v2float %196 %197 + %199 = OpFDiv %v2float %198 %195 + OpStore %lin %199 + %200 = OpLoad %v2float %lin + %204 = OpVectorTimesScalar %v2float %200 %float_32 + %201 = OpExtInst %v2float %202 Floor %204 + OpStore %lin %201 + %205 = OpLoad %v2float %lin + OpStore %param_2 %205 + %206 = OpFunctionCall %v4float %match_vf2_ %param_2 + OpStore %x_GLF_color %206 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %208 +%tint_symbol_1 = OpFunctionParameter %main_out + %212 = OpLabel + %213 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %213 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %186 + %215 = OpLabel + %216 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %216 + %217 = OpFunctionCall %void %main_1 + %219 = OpLoad %v4float %x_GLF_color + %220 = OpCompositeConstruct %main_out %219 + %218 = OpFunctionCall %void %tint_symbol_3 %220 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f8f9584d01 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.spvasm.expected.wgsl @@ -0,0 +1,113 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_20 : buf0; + +var x_GLF_color : vec4; + +var index : i32; + +var state : array; + +fn collision_vf2_vf4_(pos : ptr>, quad : ptr>) -> bool { + let x_114 : f32 = (*(pos)).x; + let x_116 : f32 = (*(quad)).x; + if ((x_114 < x_116)) { + return false; + } + let x_121 : f32 = (*(pos)).y; + let x_123 : f32 = (*(quad)).y; + if ((x_121 < x_123)) { + return false; + } + let x_128 : f32 = (*(pos)).x; + let x_130 : f32 = (*(quad)).x; + let x_132 : f32 = (*(quad)).z; + if ((x_128 > (x_130 + x_132))) { + return false; + } + let x_138 : f32 = (*(pos)).y; + let x_140 : f32 = (*(quad)).y; + let x_142 : f32 = (*(quad)).w; + if ((x_138 > (x_140 + x_142))) { + return false; + } + return true; +} + +fn match_vf2_(pos_1 : ptr>) -> vec4 { + var res : vec4; + var i : i32; + var param : vec2; + var param_1 : vec4; + var indexable : array, 8>; + var indexable_1 : array, 8>; + var indexable_2 : array, 8>; + var indexable_3 : array, 16>; + res = vec4(0.5, 0.5, 1.0, 1.0); + i = 0; + loop { + let x_152 : i32 = i; + if ((x_152 < 8)) { + } else { + break; + } + let x_155 : i32 = i; + let x_156 : vec2 = *(pos_1); + param = x_156; + indexable = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_158 : vec4 = indexable[x_155]; + param_1 = x_158; + let x_159 : bool = collision_vf2_vf4_(&(param), &(param_1)); + if (x_159) { + let x_162 : i32 = i; + indexable_1 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_164 : f32 = indexable_1[x_162].x; + let x_166 : i32 = i; + indexable_2 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_168 : f32 = indexable_2[x_166].y; + let x_171 : i32 = i; + indexable_3 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_177 : vec4 = indexable_3[((((i32(x_164) * i32(x_168)) + (x_171 * 9)) + 11) % 16)]; + res = x_177; + } + + continuing { + let x_178 : i32 = i; + i = (x_178 + 1); + } + } + let x_180 : vec4 = res; + return x_180; +} + +fn main_1() { + var lin : vec2; + var param_2 : vec2; + let x_102 : vec4 = gl_FragCoord; + let x_105 : vec2 = x_20.resolution; + lin = (vec2(x_102.x, x_102.y) / x_105); + let x_107 : vec2 = lin; + lin = floor((x_107 * 32.0)); + let x_110 : vec2 = lin; + param_2 = x_110; + let x_111 : vec4 = match_vf2_(&(param_2)); + x_GLF_color = x_111; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl new file mode 100644 index 0000000000..f8f9584d01 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl @@ -0,0 +1,113 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_20 : buf0; + +var x_GLF_color : vec4; + +var index : i32; + +var state : array; + +fn collision_vf2_vf4_(pos : ptr>, quad : ptr>) -> bool { + let x_114 : f32 = (*(pos)).x; + let x_116 : f32 = (*(quad)).x; + if ((x_114 < x_116)) { + return false; + } + let x_121 : f32 = (*(pos)).y; + let x_123 : f32 = (*(quad)).y; + if ((x_121 < x_123)) { + return false; + } + let x_128 : f32 = (*(pos)).x; + let x_130 : f32 = (*(quad)).x; + let x_132 : f32 = (*(quad)).z; + if ((x_128 > (x_130 + x_132))) { + return false; + } + let x_138 : f32 = (*(pos)).y; + let x_140 : f32 = (*(quad)).y; + let x_142 : f32 = (*(quad)).w; + if ((x_138 > (x_140 + x_142))) { + return false; + } + return true; +} + +fn match_vf2_(pos_1 : ptr>) -> vec4 { + var res : vec4; + var i : i32; + var param : vec2; + var param_1 : vec4; + var indexable : array, 8>; + var indexable_1 : array, 8>; + var indexable_2 : array, 8>; + var indexable_3 : array, 16>; + res = vec4(0.5, 0.5, 1.0, 1.0); + i = 0; + loop { + let x_152 : i32 = i; + if ((x_152 < 8)) { + } else { + break; + } + let x_155 : i32 = i; + let x_156 : vec2 = *(pos_1); + param = x_156; + indexable = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_158 : vec4 = indexable[x_155]; + param_1 = x_158; + let x_159 : bool = collision_vf2_vf4_(&(param), &(param_1)); + if (x_159) { + let x_162 : i32 = i; + indexable_1 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_164 : f32 = indexable_1[x_162].x; + let x_166 : i32 = i; + indexable_2 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_168 : f32 = indexable_2[x_166].y; + let x_171 : i32 = i; + indexable_3 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_177 : vec4 = indexable_3[((((i32(x_164) * i32(x_168)) + (x_171 * 9)) + 11) % 16)]; + res = x_177; + } + + continuing { + let x_178 : i32 = i; + i = (x_178 + 1); + } + } + let x_180 : vec4 = res; + return x_180; +} + +fn main_1() { + var lin : vec2; + var param_2 : vec2; + let x_102 : vec4 = gl_FragCoord; + let x_105 : vec2 = x_20.resolution; + lin = (vec2(x_102.x, x_102.y) / x_105); + let x_107 : vec2 = lin; + lin = floor((x_107 * 32.0)); + let x_110 : vec2 = lin; + param_2 = x_110; + let x_111 : vec4 = match_vf2_(&(param_2)); + x_GLF_color = x_111; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..3588689955 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.hlsl @@ -0,0 +1,106 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_20 : register(b0, space0) { + uint4 x_20[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int index = 0; +static int state[16] = (int[16])0; + +bool collision_vf2_vf4_(inout float2 pos, inout float4 quad) { + const float x_114 = pos.x; + const float x_116 = quad.x; + if ((x_114 < x_116)) { + return false; + } + const float x_121 = pos.y; + const float x_123 = quad.y; + if ((x_121 < x_123)) { + return false; + } + const float x_128 = pos.x; + const float x_130 = quad.x; + const float x_132 = quad.z; + if ((x_128 > (x_130 + x_132))) { + return false; + } + const float x_138 = pos.y; + const float x_140 = quad.y; + const float x_142 = quad.w; + if ((x_138 > (x_140 + x_142))) { + return false; + } + return true; +} + +float4 match_vf2_(inout float2 pos_1) { + float4 res = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + float2 param = float2(0.0f, 0.0f); + float4 param_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 indexable[8] = (float4[8])0; + float4 indexable_1[8] = (float4[8])0; + float4 indexable_2[8] = (float4[8])0; + float4 indexable_3[16] = (float4[16])0; + res = float4(0.5f, 0.5f, 1.0f, 1.0f); + i = 0; + { + for(; (i < 8); i = (i + 1)) { + const int x_155 = i; + const float2 x_156 = pos_1; + param = x_156; + const float4 tint_symbol_5[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable = tint_symbol_5; + const float4 x_158 = indexable[x_155]; + param_1 = x_158; + const bool x_159 = collision_vf2_vf4_(param, param_1); + if (x_159) { + const int x_162 = i; + const float4 tint_symbol_6[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable_1 = tint_symbol_6; + const float x_164 = indexable_1[x_162].x; + const int x_166 = i; + const float4 tint_symbol_7[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable_2 = tint_symbol_7; + const float x_168 = indexable_2[x_166].y; + const int x_171 = i; + const float4 tint_symbol_8[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable_3 = tint_symbol_8; + const float4 x_177 = indexable_3[((((int(x_164) * int(x_168)) + (x_171 * 9)) + 11) % 16)]; + res = x_177; + } + } + } + return res; +} + +void main_1() { + float2 lin = float2(0.0f, 0.0f); + float2 param_2 = float2(0.0f, 0.0f); + const float4 x_102 = gl_FragCoord; + const float2 x_105 = asfloat(x_20[0].xy); + lin = (float2(x_102.x, x_102.y) / x_105); + lin = floor((lin * 32.0f)); + param_2 = lin; + const float4 x_111 = match_vf2_(param_2); + x_GLF_color = x_111; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..8780c86dfe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.msl @@ -0,0 +1,122 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[16]; +}; +struct tint_array_wrapper_1 { + float4 arr[8]; +}; +struct tint_array_wrapper_2 { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +bool collision_vf2_vf4_(thread float2* const pos, thread float4* const quad) { + float const x_114 = (*(pos)).x; + float const x_116 = (*(quad)).x; + if ((x_114 < x_116)) { + return false; + } + float const x_121 = (*(pos)).y; + float const x_123 = (*(quad)).y; + if ((x_121 < x_123)) { + return false; + } + float const x_128 = (*(pos)).x; + float const x_130 = (*(quad)).x; + float const x_132 = (*(quad)).z; + if ((x_128 > (x_130 + x_132))) { + return false; + } + float const x_138 = (*(pos)).y; + float const x_140 = (*(quad)).y; + float const x_142 = (*(quad)).w; + if ((x_138 > (x_140 + x_142))) { + return false; + } + return true; +} + +float4 match_vf2_(thread float2* const pos_1) { + float4 res = 0.0f; + int i = 0; + float2 param = 0.0f; + float4 param_1 = 0.0f; + tint_array_wrapper_1 indexable = {}; + tint_array_wrapper_1 indexable_1 = {}; + tint_array_wrapper_1 indexable_2 = {}; + tint_array_wrapper_2 indexable_3 = {}; + res = float4(0.5f, 0.5f, 1.0f, 1.0f); + i = 0; + while (true) { + int const x_152 = i; + if ((x_152 < 8)) { + } else { + break; + } + int const x_155 = i; + float2 const x_156 = *(pos_1); + param = x_156; + tint_array_wrapper_1 const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable = tint_symbol_4; + float4 const x_158 = indexable.arr[x_155]; + param_1 = x_158; + bool const x_159 = collision_vf2_vf4_(&(param), &(param_1)); + if (x_159) { + int const x_162 = i; + tint_array_wrapper_1 const tint_symbol_5 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable_1 = tint_symbol_5; + float const x_164 = indexable_1.arr[x_162].x; + int const x_166 = i; + tint_array_wrapper_1 const tint_symbol_6 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable_2 = tint_symbol_6; + float const x_168 = indexable_2.arr[x_166].y; + int const x_171 = i; + tint_array_wrapper_2 const tint_symbol_7 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable_3 = tint_symbol_7; + float4 const x_177 = indexable_3.arr[((((int(x_164) * int(x_168)) + (x_171 * 9)) + 11) % 16)]; + res = x_177; + } + { + int const x_178 = i; + i = (x_178 + 1); + } + } + float4 const x_180 = res; + return x_180; +} + +void main_1(constant buf0& x_20, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + float2 lin = 0.0f; + float2 param_2 = 0.0f; + float4 const x_102 = *(tint_symbol_9); + float2 const x_105 = x_20.resolution; + lin = (float2(x_102.x, x_102.y) / x_105); + float2 const x_107 = lin; + lin = floor((x_107 * 32.0f)); + float2 const x_110 = lin; + param_2 = x_110; + float4 const x_111 = match_vf2_(&(param_2)); + *(tint_symbol_10) = x_111; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_20 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_20, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..d01b8b5700 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.spvasm @@ -0,0 +1,306 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 221 +; Schema: 0 + OpCapability Shader + %202 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_20 "x_20" + OpName %x_GLF_color "x_GLF_color" + OpName %index "index" + OpName %state "state" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %collision_vf2_vf4_ "collision_vf2_vf4_" + OpName %pos "pos" + OpName %quad "quad" + OpName %match_vf2_ "match_vf2_" + OpName %pos_1 "pos_1" + OpName %res "res" + OpName %i "i" + OpName %param "param" + OpName %param_1 "param_1" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %indexable_2 "indexable_2" + OpName %indexable_3 "indexable_3" + OpName %main_1 "main_1" + OpName %lin "lin" + OpName %param_2 "param_2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_20 NonWritable + OpDecorate %x_20 DescriptorSet 0 + OpDecorate %x_20 Binding 0 + OpDecorate %_arr_int_uint_16 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_8 ArrayStride 16 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_20 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %14 = OpConstantNull %int + %index = OpVariable %_ptr_Private_int Private %14 + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_int_uint_16 = OpTypeArray %int %uint_16 +%_ptr_Private__arr_int_uint_16 = OpTypePointer Private %_arr_int_uint_16 + %20 = OpConstantNull %_arr_int_uint_16 + %state = OpVariable %_ptr_Private__arr_int_uint_16 Private %20 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %bool = OpTypeBool +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpTypeFunction %bool %_ptr_Function_v2float %_ptr_Function_v4float + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %84 = OpTypeFunction %v4float %_ptr_Function_v2float +%_ptr_Function_int = OpTypePointer Function %int + %92 = OpConstantNull %v2float + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %98 = OpConstantNull %_arr_v4float_uint_8 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %104 = OpConstantNull %_arr_v4float_uint_16 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %107 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %int_8 = OpConstant %int 8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %124 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %125 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %126 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %128 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %131 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %133 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %135 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %137 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %138 = OpConstantComposite %_arr_v4float_uint_8 %124 %125 %126 %128 %131 %133 %135 %137 + %float_0 = OpConstant %float 0 + %154 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %155 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %157 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %158 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %159 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %160 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %161 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %162 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %164 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %166 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %167 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %168 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %169 = OpConstantComposite %_arr_v4float_uint_16 %154 %155 %156 %157 %158 %159 %160 %161 %154 %162 %163 %164 %165 %166 %167 %168 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %186 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 + %main_out = OpTypeStruct %v4float + %208 = OpTypeFunction %void %main_out +%collision_vf2_vf4_ = OpFunction %bool None %25 + %pos = OpFunctionParameter %_ptr_Function_v2float + %quad = OpFunctionParameter %_ptr_Function_v4float + %32 = OpLabel + %36 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %37 = OpLoad %float %36 + %39 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %40 = OpLoad %float %39 + %41 = OpFOrdLessThan %bool %37 %40 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpReturnValue %false + %42 = OpLabel + %47 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %48 = OpLoad %float %47 + %50 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %51 = OpLoad %float %50 + %52 = OpFOrdLessThan %bool %48 %51 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + OpReturnValue %false + %53 = OpLabel + %56 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %57 = OpLoad %float %56 + %59 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %60 = OpLoad %float %59 + %63 = OpAccessChain %_ptr_Function_float %quad %uint_2 + %64 = OpLoad %float %63 + %65 = OpFAdd %float %60 %64 + %66 = OpFOrdGreaterThan %bool %57 %65 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %67 + %68 = OpLabel + OpReturnValue %false + %67 = OpLabel + %70 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %71 = OpLoad %float %70 + %73 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %74 = OpLoad %float %73 + %77 = OpAccessChain %_ptr_Function_float %quad %uint_3 + %78 = OpLoad %float %77 + %79 = OpFAdd %float %74 %78 + %80 = OpFOrdGreaterThan %bool %71 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + OpReturnValue %false + %81 = OpLabel + OpReturnValue %true + OpFunctionEnd + %match_vf2_ = OpFunction %v4float None %84 + %pos_1 = OpFunctionParameter %_ptr_Function_v2float + %87 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %i = OpVariable %_ptr_Function_int Function %14 + %param = OpVariable %_ptr_Function_v2float Function %92 + %param_1 = OpVariable %_ptr_Function_v4float Function %5 + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %98 +%indexable_1 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %98 +%indexable_2 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %98 +%indexable_3 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %104 + OpStore %res %107 + OpStore %i %int_0 + OpBranch %109 + %109 = OpLabel + OpLoopMerge %110 %111 None + OpBranch %112 + %112 = OpLabel + %113 = OpLoad %int %i + %115 = OpSLessThan %bool %113 %int_8 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %118 + %117 = OpLabel + OpBranch %116 + %118 = OpLabel + OpBranch %110 + %116 = OpLabel + %119 = OpLoad %int %i + %121 = OpLoad %v2float %pos_1 + OpStore %param %121 + OpStore %indexable %138 + %139 = OpAccessChain %_ptr_Function_v4float %indexable %119 + %140 = OpLoad %v4float %139 + OpStore %param_1 %140 + %141 = OpFunctionCall %bool %collision_vf2_vf4_ %param %param_1 + OpSelectionMerge %144 None + OpBranchConditional %141 %145 %144 + %145 = OpLabel + %146 = OpLoad %int %i + OpStore %indexable_1 %138 + %147 = OpAccessChain %_ptr_Function_float %indexable_1 %146 %uint_0 + %148 = OpLoad %float %147 + %149 = OpLoad %int %i + OpStore %indexable_2 %138 + %150 = OpAccessChain %_ptr_Function_float %indexable_2 %149 %uint_1 + %151 = OpLoad %float %150 + %152 = OpLoad %int %i + OpStore %indexable_3 %169 + %170 = OpConvertFToS %int %148 + %171 = OpConvertFToS %int %151 + %172 = OpIMul %int %170 %171 + %174 = OpIMul %int %152 %int_9 + %175 = OpIAdd %int %172 %174 + %177 = OpIAdd %int %175 %int_11 + %179 = OpSMod %int %177 %int_16 + %180 = OpAccessChain %_ptr_Function_v4float %indexable_3 %179 + %181 = OpLoad %v4float %180 + OpStore %res %181 + OpBranch %144 + %144 = OpLabel + OpBranch %111 + %111 = OpLabel + %182 = OpLoad %int %i + %184 = OpIAdd %int %182 %int_1 + OpStore %i %184 + OpBranch %109 + %110 = OpLabel + %185 = OpLoad %v4float %res + OpReturnValue %185 + OpFunctionEnd + %main_1 = OpFunction %void None %186 + %189 = OpLabel + %lin = OpVariable %_ptr_Function_v2float Function %92 + %param_2 = OpVariable %_ptr_Function_v2float Function %92 + %192 = OpLoad %v4float %gl_FragCoord + %194 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_0 + %195 = OpLoad %v2float %194 + %196 = OpCompositeExtract %float %192 0 + %197 = OpCompositeExtract %float %192 1 + %198 = OpCompositeConstruct %v2float %196 %197 + %199 = OpFDiv %v2float %198 %195 + OpStore %lin %199 + %200 = OpLoad %v2float %lin + %204 = OpVectorTimesScalar %v2float %200 %float_32 + %201 = OpExtInst %v2float %202 Floor %204 + OpStore %lin %201 + %205 = OpLoad %v2float %lin + OpStore %param_2 %205 + %206 = OpFunctionCall %v4float %match_vf2_ %param_2 + OpStore %x_GLF_color %206 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %208 +%tint_symbol_1 = OpFunctionParameter %main_out + %212 = OpLabel + %213 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %213 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %186 + %215 = OpLabel + %216 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %216 + %217 = OpFunctionCall %void %main_1 + %219 = OpLoad %v4float %x_GLF_color + %220 = OpCompositeConstruct %main_out %219 + %218 = OpFunctionCall %void %tint_symbol_3 %220 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f8f9584d01 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/0-opt.wgsl.expected.wgsl @@ -0,0 +1,113 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_20 : buf0; + +var x_GLF_color : vec4; + +var index : i32; + +var state : array; + +fn collision_vf2_vf4_(pos : ptr>, quad : ptr>) -> bool { + let x_114 : f32 = (*(pos)).x; + let x_116 : f32 = (*(quad)).x; + if ((x_114 < x_116)) { + return false; + } + let x_121 : f32 = (*(pos)).y; + let x_123 : f32 = (*(quad)).y; + if ((x_121 < x_123)) { + return false; + } + let x_128 : f32 = (*(pos)).x; + let x_130 : f32 = (*(quad)).x; + let x_132 : f32 = (*(quad)).z; + if ((x_128 > (x_130 + x_132))) { + return false; + } + let x_138 : f32 = (*(pos)).y; + let x_140 : f32 = (*(quad)).y; + let x_142 : f32 = (*(quad)).w; + if ((x_138 > (x_140 + x_142))) { + return false; + } + return true; +} + +fn match_vf2_(pos_1 : ptr>) -> vec4 { + var res : vec4; + var i : i32; + var param : vec2; + var param_1 : vec4; + var indexable : array, 8>; + var indexable_1 : array, 8>; + var indexable_2 : array, 8>; + var indexable_3 : array, 16>; + res = vec4(0.5, 0.5, 1.0, 1.0); + i = 0; + loop { + let x_152 : i32 = i; + if ((x_152 < 8)) { + } else { + break; + } + let x_155 : i32 = i; + let x_156 : vec2 = *(pos_1); + param = x_156; + indexable = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_158 : vec4 = indexable[x_155]; + param_1 = x_158; + let x_159 : bool = collision_vf2_vf4_(&(param), &(param_1)); + if (x_159) { + let x_162 : i32 = i; + indexable_1 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_164 : f32 = indexable_1[x_162].x; + let x_166 : i32 = i; + indexable_2 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_168 : f32 = indexable_2[x_166].y; + let x_171 : i32 = i; + indexable_3 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_177 : vec4 = indexable_3[((((i32(x_164) * i32(x_168)) + (x_171 * 9)) + 11) % 16)]; + res = x_177; + } + + continuing { + let x_178 : i32 = i; + i = (x_178 + 1); + } + } + let x_180 : vec4 = res; + return x_180; +} + +fn main_1() { + var lin : vec2; + var param_2 : vec2; + let x_102 : vec4 = gl_FragCoord; + let x_105 : vec2 = x_20.resolution; + lin = (vec2(x_102.x, x_102.y) / x_105); + let x_107 : vec2 = lin; + lin = floor((x_107 * 32.0)); + let x_110 : vec2 = lin; + param_2 = x_110; + let x_111 : vec4 = match_vf2_(&(param_2)); + x_GLF_color = x_111; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm new file mode 100644 index 0000000000..e2303ec8f6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm @@ -0,0 +1,259 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %collision_vf2_vf4_ "collision(vf2;vf4;" + OpName %pos "pos" + OpName %quad "quad" + OpName %match_vf2_ "match(vf2;" + OpName %pos_0 "pos" + OpName %res "res" + OpName %i "i" + OpName %param "param" + OpName %param_0 "param" + OpName %indexable "indexable" + OpName %indexable_0 "indexable" + OpName %indexable_1 "indexable" + OpName %indexable_2 "indexable" + OpName %lin "lin" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %param_1 "param" + OpName %index "index" + OpName %state "state" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool + %32 = OpTypeFunction %bool %_ptr_Function_v2float %_ptr_Function_v4float + %33 = OpTypeFunction %v4float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %44 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_8 = OpConstant %int 8 + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %53 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %54 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %55 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %57 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %60 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %62 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %64 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %66 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %67 = OpConstantComposite %_arr_v4float_uint_8 %53 %54 %55 %57 %60 %62 %64 %66 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %72 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %73 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %74 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %75 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %76 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %77 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %78 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %79 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %80 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %81 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %82 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %83 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %84 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %85 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %86 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %87 = OpConstantComposite %_arr_v4float_uint_16 %72 %73 %74 %75 %76 %77 %78 %79 %72 %80 %81 %82 %83 %84 %85 %86 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_ptr_Private_int = OpTypePointer Private %int + %index = OpVariable %_ptr_Private_int Private +%_arr_int_uint_16 = OpTypeArray %int %uint_16 +%_ptr_Private__arr_int_uint_16 = OpTypePointer Private %_arr_int_uint_16 + %state = OpVariable %_ptr_Private__arr_int_uint_16 Private + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %103 = OpConstantComposite %v4bool %false %false %false %false + %main = OpFunction %void None %25 + %104 = OpLabel + %lin = OpVariable %_ptr_Function_v2float Function + %param_1 = OpVariable %_ptr_Function_v2float Function + %105 = OpLoad %v4float %gl_FragCoord + %106 = OpVectorShuffle %v2float %105 %105 0 1 + %107 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %108 = OpLoad %v2float %107 + %109 = OpFDiv %v2float %106 %108 + OpStore %lin %109 + %110 = OpLoad %v2float %lin + %111 = OpVectorTimesScalar %v2float %110 %float_32 + %112 = OpExtInst %v2float %1 Floor %111 + OpStore %lin %112 + %113 = OpLoad %v2float %lin + OpStore %param_1 %113 + %114 = OpFunctionCall %v4float %match_vf2_ %param_1 + OpStore %_GLF_color %114 + OpReturn + OpFunctionEnd +%collision_vf2_vf4_ = OpFunction %bool None %32 + %pos = OpFunctionParameter %_ptr_Function_v2float + %quad = OpFunctionParameter %_ptr_Function_v4float + %115 = OpLabel + %116 = OpVariable %_ptr_Function_v4bool Function %103 + %117 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %118 = OpLoad %float %117 + %119 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %120 = OpLoad %float %119 + %121 = OpFOrdLessThan %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + OpReturnValue %false + %122 = OpLabel + %124 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %125 = OpLoad %float %124 + %126 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %127 = OpLoad %float %126 + %128 = OpFOrdLessThan %bool %125 %127 + OpSelectionMerge %129 None + OpBranchConditional %128 %130 %129 + %130 = OpLabel + OpReturnValue %false + %129 = OpLabel + %131 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %132 = OpLoad %float %131 + %133 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %134 = OpLoad %float %133 + %135 = OpAccessChain %_ptr_Function_float %quad %uint_2 + %136 = OpLoad %float %135 + %137 = OpFAdd %float %134 %136 + %138 = OpFOrdGreaterThan %bool %132 %137 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + OpReturnValue %false + %139 = OpLabel + %141 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %142 = OpLoad %float %141 + %143 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %144 = OpLoad %float %143 + %145 = OpAccessChain %_ptr_Function_float %quad %uint_3 + %146 = OpLoad %float %145 + %147 = OpFAdd %float %144 %146 + %148 = OpFOrdGreaterThan %bool %142 %147 + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %149 + %150 = OpLabel + OpReturnValue %false + %149 = OpLabel + OpReturnValue %true + OpFunctionEnd + %match_vf2_ = OpFunction %v4float None %33 + %pos_0 = OpFunctionParameter %_ptr_Function_v2float + %151 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function + %i = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_v2float Function + %param_0 = OpVariable %_ptr_Function_v4float Function + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_8 Function +%indexable_0 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function +%indexable_1 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function +%indexable_2 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + OpStore %res %44 + OpStore %i %int_0 + OpBranch %152 + %152 = OpLabel + OpLoopMerge %153 %154 None + OpBranch %155 + %155 = OpLabel + %156 = OpLoad %int %i + %157 = OpSLessThan %bool %156 %int_8 + OpBranchConditional %157 %158 %153 + %158 = OpLabel + %159 = OpLoad %int %i + %160 = OpLoad %v2float %pos_0 + OpStore %param %160 + OpStore %indexable %67 + %161 = OpAccessChain %_ptr_Function_v4float %indexable %159 + %162 = OpLoad %v4float %161 + OpStore %param_0 %162 + %163 = OpFunctionCall %bool %collision_vf2_vf4_ %param %param_0 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %164 + %165 = OpLabel + %166 = OpLoad %int %i + OpStore %indexable_0 %67 + %167 = OpAccessChain %_ptr_Function_float %indexable_0 %166 %uint_0 + %168 = OpLoad %float %167 + %169 = OpConvertFToS %int %168 + %170 = OpLoad %int %i + OpStore %indexable_1 %67 + %171 = OpAccessChain %_ptr_Function_float %indexable_1 %170 %uint_1 + %172 = OpLoad %float %171 + %173 = OpConvertFToS %int %172 + %174 = OpIMul %int %169 %173 + %175 = OpLoad %int %i + %176 = OpIMul %int %175 %int_9 + %177 = OpIAdd %int %174 %176 + %178 = OpIAdd %int %177 %int_11 + %179 = OpSMod %int %178 %int_16 + OpStore %indexable_2 %87 + %180 = OpAccessChain %_ptr_Function_v4float %indexable_2 %179 + %181 = OpLoad %v4float %180 + OpStore %res %181 + OpBranch %164 + %164 = OpLabel + OpBranch %154 + %154 = OpLabel + %182 = OpLoad %int %i + %183 = OpIAdd %int %182 %int_1 + OpStore %i %183 + OpBranch %152 + %153 = OpLabel + %184 = OpLoad %v4float %res + OpReturnValue %184 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..fb1988545b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.hlsl @@ -0,0 +1,107 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_20 : register(b0, space0) { + uint4 x_20[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int index = 0; +static int state[16] = (int[16])0; + +bool collision_vf2_vf4_(inout float2 pos, inout float4 quad) { + bool4 x_116 = bool4(false, false, false, false); + const float x_118 = pos.x; + const float x_120 = quad.x; + if ((x_118 < x_120)) { + return false; + } + const float x_125 = pos.y; + const float x_127 = quad.y; + if ((x_125 < x_127)) { + return false; + } + const float x_132 = pos.x; + const float x_134 = quad.x; + const float x_136 = quad.z; + if ((x_132 > (x_134 + x_136))) { + return false; + } + const float x_142 = pos.y; + const float x_144 = quad.y; + const float x_146 = quad.w; + if ((x_142 > (x_144 + x_146))) { + return false; + } + return true; +} + +float4 match_vf2_(inout float2 pos_1) { + float4 res = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + float2 param = float2(0.0f, 0.0f); + float4 param_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 indexable[8] = (float4[8])0; + float4 indexable_1[8] = (float4[8])0; + float4 indexable_2[8] = (float4[8])0; + float4 indexable_3[16] = (float4[16])0; + res = float4(0.5f, 0.5f, 1.0f, 1.0f); + i = 0; + { + for(; (i < 8); i = (i + 1)) { + const int x_159 = i; + const float2 x_160 = pos_1; + param = x_160; + const float4 tint_symbol_5[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable = tint_symbol_5; + const float4 x_162 = indexable[x_159]; + param_1 = x_162; + const bool x_163 = collision_vf2_vf4_(param, param_1); + if (x_163) { + const int x_166 = i; + const float4 tint_symbol_6[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable_1 = tint_symbol_6; + const float x_168 = indexable_1[x_166].x; + const int x_170 = i; + const float4 tint_symbol_7[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable_2 = tint_symbol_7; + const float x_172 = indexable_2[x_170].y; + const int x_175 = i; + const float4 tint_symbol_8[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable_3 = tint_symbol_8; + const float4 x_181 = indexable_3[((((int(x_168) * int(x_172)) + (x_175 * 9)) + 11) % 16)]; + res = x_181; + } + } + } + return res; +} + +void main_1() { + float2 lin = float2(0.0f, 0.0f); + float2 param_2 = float2(0.0f, 0.0f); + const float4 x_105 = gl_FragCoord; + const float2 x_108 = asfloat(x_20[0].xy); + lin = (float2(x_105.x, x_105.y) / x_108); + lin = floor((lin * 32.0f)); + param_2 = lin; + const float4 x_114 = match_vf2_(param_2); + x_GLF_color = x_114; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.msl new file mode 100644 index 0000000000..5b43db6ff9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.msl @@ -0,0 +1,123 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[16]; +}; +struct tint_array_wrapper_1 { + float4 arr[8]; +}; +struct tint_array_wrapper_2 { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +bool collision_vf2_vf4_(thread float2* const pos, thread float4* const quad) { + bool4 x_116 = bool4(false, false, false, false); + float const x_118 = (*(pos)).x; + float const x_120 = (*(quad)).x; + if ((x_118 < x_120)) { + return false; + } + float const x_125 = (*(pos)).y; + float const x_127 = (*(quad)).y; + if ((x_125 < x_127)) { + return false; + } + float const x_132 = (*(pos)).x; + float const x_134 = (*(quad)).x; + float const x_136 = (*(quad)).z; + if ((x_132 > (x_134 + x_136))) { + return false; + } + float const x_142 = (*(pos)).y; + float const x_144 = (*(quad)).y; + float const x_146 = (*(quad)).w; + if ((x_142 > (x_144 + x_146))) { + return false; + } + return true; +} + +float4 match_vf2_(thread float2* const pos_1) { + float4 res = 0.0f; + int i = 0; + float2 param = 0.0f; + float4 param_1 = 0.0f; + tint_array_wrapper_1 indexable = {}; + tint_array_wrapper_1 indexable_1 = {}; + tint_array_wrapper_1 indexable_2 = {}; + tint_array_wrapper_2 indexable_3 = {}; + res = float4(0.5f, 0.5f, 1.0f, 1.0f); + i = 0; + while (true) { + int const x_156 = i; + if ((x_156 < 8)) { + } else { + break; + } + int const x_159 = i; + float2 const x_160 = *(pos_1); + param = x_160; + tint_array_wrapper_1 const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable = tint_symbol_4; + float4 const x_162 = indexable.arr[x_159]; + param_1 = x_162; + bool const x_163 = collision_vf2_vf4_(&(param), &(param_1)); + if (x_163) { + int const x_166 = i; + tint_array_wrapper_1 const tint_symbol_5 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable_1 = tint_symbol_5; + float const x_168 = indexable_1.arr[x_166].x; + int const x_170 = i; + tint_array_wrapper_1 const tint_symbol_6 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable_2 = tint_symbol_6; + float const x_172 = indexable_2.arr[x_170].y; + int const x_175 = i; + tint_array_wrapper_2 const tint_symbol_7 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable_3 = tint_symbol_7; + float4 const x_181 = indexable_3.arr[((((int(x_168) * int(x_172)) + (x_175 * 9)) + 11) % 16)]; + res = x_181; + } + { + int const x_182 = i; + i = (x_182 + 1); + } + } + float4 const x_184 = res; + return x_184; +} + +void main_1(constant buf0& x_20, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + float2 lin = 0.0f; + float2 param_2 = 0.0f; + float4 const x_105 = *(tint_symbol_9); + float2 const x_108 = x_20.resolution; + lin = (float2(x_105.x, x_105.y) / x_108); + float2 const x_110 = lin; + lin = floor((x_110 * 32.0f)); + float2 const x_113 = lin; + param_2 = x_113; + float4 const x_114 = match_vf2_(&(param_2)); + *(tint_symbol_10) = x_114; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_20 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_20, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..44345bd109 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.spvasm @@ -0,0 +1,313 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 226 +; Schema: 0 + OpCapability Shader + %207 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_20 "x_20" + OpName %x_GLF_color "x_GLF_color" + OpName %index "index" + OpName %state "state" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %collision_vf2_vf4_ "collision_vf2_vf4_" + OpName %pos "pos" + OpName %quad "quad" + OpName %x_116 "x_116" + OpName %match_vf2_ "match_vf2_" + OpName %pos_1 "pos_1" + OpName %res "res" + OpName %i "i" + OpName %param "param" + OpName %param_1 "param_1" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %indexable_2 "indexable_2" + OpName %indexable_3 "indexable_3" + OpName %main_1 "main_1" + OpName %lin "lin" + OpName %param_2 "param_2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_20 NonWritable + OpDecorate %x_20 DescriptorSet 0 + OpDecorate %x_20 Binding 0 + OpDecorate %_arr_int_uint_16 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_8 ArrayStride 16 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_20 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %14 = OpConstantNull %int + %index = OpVariable %_ptr_Private_int Private %14 + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_int_uint_16 = OpTypeArray %int %uint_16 +%_ptr_Private__arr_int_uint_16 = OpTypePointer Private %_arr_int_uint_16 + %20 = OpConstantNull %_arr_int_uint_16 + %state = OpVariable %_ptr_Private__arr_int_uint_16 Private %20 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %bool = OpTypeBool +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpTypeFunction %bool %_ptr_Function_v2float %_ptr_Function_v4float + %v4bool = OpTypeVector %bool 4 + %false = OpConstantFalse %bool + %35 = OpConstantComposite %v4bool %false %false %false %false +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %38 = OpConstantNull %v4bool + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %89 = OpTypeFunction %v4float %_ptr_Function_v2float +%_ptr_Function_int = OpTypePointer Function %int + %97 = OpConstantNull %v2float + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %103 = OpConstantNull %_arr_v4float_uint_8 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %109 = OpConstantNull %_arr_v4float_uint_16 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %112 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %int_8 = OpConstant %int 8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %129 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %130 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %131 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %133 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %136 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %138 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %140 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %142 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %143 = OpConstantComposite %_arr_v4float_uint_8 %129 %130 %131 %133 %136 %138 %140 %142 + %float_0 = OpConstant %float 0 + %159 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %160 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %161 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %162 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %164 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %166 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %167 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %168 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %169 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %170 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %171 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %172 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %173 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %174 = OpConstantComposite %_arr_v4float_uint_16 %159 %160 %161 %162 %163 %164 %165 %166 %159 %167 %168 %169 %170 %171 %172 %173 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %191 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 + %main_out = OpTypeStruct %v4float + %213 = OpTypeFunction %void %main_out +%collision_vf2_vf4_ = OpFunction %bool None %25 + %pos = OpFunctionParameter %_ptr_Function_v2float + %quad = OpFunctionParameter %_ptr_Function_v4float + %32 = OpLabel + %x_116 = OpVariable %_ptr_Function_v4bool Function %38 + OpStore %x_116 %35 + %42 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %43 = OpLoad %float %42 + %45 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %46 = OpLoad %float %45 + %47 = OpFOrdLessThan %bool %43 %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + OpReturnValue %false + %48 = OpLabel + %52 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %53 = OpLoad %float %52 + %55 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %56 = OpLoad %float %55 + %57 = OpFOrdLessThan %bool %53 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + OpReturnValue %false + %58 = OpLabel + %61 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %62 = OpLoad %float %61 + %64 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %65 = OpLoad %float %64 + %68 = OpAccessChain %_ptr_Function_float %quad %uint_2 + %69 = OpLoad %float %68 + %70 = OpFAdd %float %65 %69 + %71 = OpFOrdGreaterThan %bool %62 %70 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + OpReturnValue %false + %72 = OpLabel + %75 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %76 = OpLoad %float %75 + %78 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %79 = OpLoad %float %78 + %82 = OpAccessChain %_ptr_Function_float %quad %uint_3 + %83 = OpLoad %float %82 + %84 = OpFAdd %float %79 %83 + %85 = OpFOrdGreaterThan %bool %76 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + OpReturnValue %false + %86 = OpLabel + OpReturnValue %true + OpFunctionEnd + %match_vf2_ = OpFunction %v4float None %89 + %pos_1 = OpFunctionParameter %_ptr_Function_v2float + %92 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %i = OpVariable %_ptr_Function_int Function %14 + %param = OpVariable %_ptr_Function_v2float Function %97 + %param_1 = OpVariable %_ptr_Function_v4float Function %5 + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %103 +%indexable_1 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %103 +%indexable_2 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %103 +%indexable_3 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %109 + OpStore %res %112 + OpStore %i %int_0 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i + %120 = OpSLessThan %bool %118 %int_8 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + OpBranch %121 + %123 = OpLabel + OpBranch %115 + %121 = OpLabel + %124 = OpLoad %int %i + %126 = OpLoad %v2float %pos_1 + OpStore %param %126 + OpStore %indexable %143 + %144 = OpAccessChain %_ptr_Function_v4float %indexable %124 + %145 = OpLoad %v4float %144 + OpStore %param_1 %145 + %146 = OpFunctionCall %bool %collision_vf2_vf4_ %param %param_1 + OpSelectionMerge %149 None + OpBranchConditional %146 %150 %149 + %150 = OpLabel + %151 = OpLoad %int %i + OpStore %indexable_1 %143 + %152 = OpAccessChain %_ptr_Function_float %indexable_1 %151 %uint_0 + %153 = OpLoad %float %152 + %154 = OpLoad %int %i + OpStore %indexable_2 %143 + %155 = OpAccessChain %_ptr_Function_float %indexable_2 %154 %uint_1 + %156 = OpLoad %float %155 + %157 = OpLoad %int %i + OpStore %indexable_3 %174 + %175 = OpConvertFToS %int %153 + %176 = OpConvertFToS %int %156 + %177 = OpIMul %int %175 %176 + %179 = OpIMul %int %157 %int_9 + %180 = OpIAdd %int %177 %179 + %182 = OpIAdd %int %180 %int_11 + %184 = OpSMod %int %182 %int_16 + %185 = OpAccessChain %_ptr_Function_v4float %indexable_3 %184 + %186 = OpLoad %v4float %185 + OpStore %res %186 + OpBranch %149 + %149 = OpLabel + OpBranch %116 + %116 = OpLabel + %187 = OpLoad %int %i + %189 = OpIAdd %int %187 %int_1 + OpStore %i %189 + OpBranch %114 + %115 = OpLabel + %190 = OpLoad %v4float %res + OpReturnValue %190 + OpFunctionEnd + %main_1 = OpFunction %void None %191 + %194 = OpLabel + %lin = OpVariable %_ptr_Function_v2float Function %97 + %param_2 = OpVariable %_ptr_Function_v2float Function %97 + %197 = OpLoad %v4float %gl_FragCoord + %199 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_0 + %200 = OpLoad %v2float %199 + %201 = OpCompositeExtract %float %197 0 + %202 = OpCompositeExtract %float %197 1 + %203 = OpCompositeConstruct %v2float %201 %202 + %204 = OpFDiv %v2float %203 %200 + OpStore %lin %204 + %205 = OpLoad %v2float %lin + %209 = OpVectorTimesScalar %v2float %205 %float_32 + %206 = OpExtInst %v2float %207 Floor %209 + OpStore %lin %206 + %210 = OpLoad %v2float %lin + OpStore %param_2 %210 + %211 = OpFunctionCall %v4float %match_vf2_ %param_2 + OpStore %x_GLF_color %211 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %213 +%tint_symbol_1 = OpFunctionParameter %main_out + %217 = OpLabel + %218 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %218 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %191 + %220 = OpLabel + %221 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %221 + %222 = OpFunctionCall %void %main_1 + %224 = OpLoad %v4float %x_GLF_color + %225 = OpCompositeConstruct %main_out %224 + %223 = OpFunctionCall %void %tint_symbol_3 %225 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..f70d557eac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.spvasm.expected.wgsl @@ -0,0 +1,114 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_20 : buf0; + +var x_GLF_color : vec4; + +var index : i32; + +var state : array; + +fn collision_vf2_vf4_(pos : ptr>, quad : ptr>) -> bool { + var x_116 : vec4 = vec4(false, false, false, false); + let x_118 : f32 = (*(pos)).x; + let x_120 : f32 = (*(quad)).x; + if ((x_118 < x_120)) { + return false; + } + let x_125 : f32 = (*(pos)).y; + let x_127 : f32 = (*(quad)).y; + if ((x_125 < x_127)) { + return false; + } + let x_132 : f32 = (*(pos)).x; + let x_134 : f32 = (*(quad)).x; + let x_136 : f32 = (*(quad)).z; + if ((x_132 > (x_134 + x_136))) { + return false; + } + let x_142 : f32 = (*(pos)).y; + let x_144 : f32 = (*(quad)).y; + let x_146 : f32 = (*(quad)).w; + if ((x_142 > (x_144 + x_146))) { + return false; + } + return true; +} + +fn match_vf2_(pos_1 : ptr>) -> vec4 { + var res : vec4; + var i : i32; + var param : vec2; + var param_1 : vec4; + var indexable : array, 8>; + var indexable_1 : array, 8>; + var indexable_2 : array, 8>; + var indexable_3 : array, 16>; + res = vec4(0.5, 0.5, 1.0, 1.0); + i = 0; + loop { + let x_156 : i32 = i; + if ((x_156 < 8)) { + } else { + break; + } + let x_159 : i32 = i; + let x_160 : vec2 = *(pos_1); + param = x_160; + indexable = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_162 : vec4 = indexable[x_159]; + param_1 = x_162; + let x_163 : bool = collision_vf2_vf4_(&(param), &(param_1)); + if (x_163) { + let x_166 : i32 = i; + indexable_1 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_168 : f32 = indexable_1[x_166].x; + let x_170 : i32 = i; + indexable_2 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_172 : f32 = indexable_2[x_170].y; + let x_175 : i32 = i; + indexable_3 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_181 : vec4 = indexable_3[((((i32(x_168) * i32(x_172)) + (x_175 * 9)) + 11) % 16)]; + res = x_181; + } + + continuing { + let x_182 : i32 = i; + i = (x_182 + 1); + } + } + let x_184 : vec4 = res; + return x_184; +} + +fn main_1() { + var lin : vec2; + var param_2 : vec2; + let x_105 : vec4 = gl_FragCoord; + let x_108 : vec2 = x_20.resolution; + lin = (vec2(x_105.x, x_105.y) / x_108); + let x_110 : vec2 = lin; + lin = floor((x_110 * 32.0)); + let x_113 : vec2 = lin; + param_2 = x_113; + let x_114 : vec4 = match_vf2_(&(param_2)); + x_GLF_color = x_114; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl new file mode 100644 index 0000000000..f70d557eac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl @@ -0,0 +1,114 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_20 : buf0; + +var x_GLF_color : vec4; + +var index : i32; + +var state : array; + +fn collision_vf2_vf4_(pos : ptr>, quad : ptr>) -> bool { + var x_116 : vec4 = vec4(false, false, false, false); + let x_118 : f32 = (*(pos)).x; + let x_120 : f32 = (*(quad)).x; + if ((x_118 < x_120)) { + return false; + } + let x_125 : f32 = (*(pos)).y; + let x_127 : f32 = (*(quad)).y; + if ((x_125 < x_127)) { + return false; + } + let x_132 : f32 = (*(pos)).x; + let x_134 : f32 = (*(quad)).x; + let x_136 : f32 = (*(quad)).z; + if ((x_132 > (x_134 + x_136))) { + return false; + } + let x_142 : f32 = (*(pos)).y; + let x_144 : f32 = (*(quad)).y; + let x_146 : f32 = (*(quad)).w; + if ((x_142 > (x_144 + x_146))) { + return false; + } + return true; +} + +fn match_vf2_(pos_1 : ptr>) -> vec4 { + var res : vec4; + var i : i32; + var param : vec2; + var param_1 : vec4; + var indexable : array, 8>; + var indexable_1 : array, 8>; + var indexable_2 : array, 8>; + var indexable_3 : array, 16>; + res = vec4(0.5, 0.5, 1.0, 1.0); + i = 0; + loop { + let x_156 : i32 = i; + if ((x_156 < 8)) { + } else { + break; + } + let x_159 : i32 = i; + let x_160 : vec2 = *(pos_1); + param = x_160; + indexable = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_162 : vec4 = indexable[x_159]; + param_1 = x_162; + let x_163 : bool = collision_vf2_vf4_(&(param), &(param_1)); + if (x_163) { + let x_166 : i32 = i; + indexable_1 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_168 : f32 = indexable_1[x_166].x; + let x_170 : i32 = i; + indexable_2 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_172 : f32 = indexable_2[x_170].y; + let x_175 : i32 = i; + indexable_3 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_181 : vec4 = indexable_3[((((i32(x_168) * i32(x_172)) + (x_175 * 9)) + 11) % 16)]; + res = x_181; + } + + continuing { + let x_182 : i32 = i; + i = (x_182 + 1); + } + } + let x_184 : vec4 = res; + return x_184; +} + +fn main_1() { + var lin : vec2; + var param_2 : vec2; + let x_105 : vec4 = gl_FragCoord; + let x_108 : vec2 = x_20.resolution; + lin = (vec2(x_105.x, x_105.y) / x_108); + let x_110 : vec2 = lin; + lin = floor((x_110 * 32.0)); + let x_113 : vec2 = lin; + param_2 = x_113; + let x_114 : vec4 = match_vf2_(&(param_2)); + x_GLF_color = x_114; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..fb1988545b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.hlsl @@ -0,0 +1,107 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_20 : register(b0, space0) { + uint4 x_20[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int index = 0; +static int state[16] = (int[16])0; + +bool collision_vf2_vf4_(inout float2 pos, inout float4 quad) { + bool4 x_116 = bool4(false, false, false, false); + const float x_118 = pos.x; + const float x_120 = quad.x; + if ((x_118 < x_120)) { + return false; + } + const float x_125 = pos.y; + const float x_127 = quad.y; + if ((x_125 < x_127)) { + return false; + } + const float x_132 = pos.x; + const float x_134 = quad.x; + const float x_136 = quad.z; + if ((x_132 > (x_134 + x_136))) { + return false; + } + const float x_142 = pos.y; + const float x_144 = quad.y; + const float x_146 = quad.w; + if ((x_142 > (x_144 + x_146))) { + return false; + } + return true; +} + +float4 match_vf2_(inout float2 pos_1) { + float4 res = float4(0.0f, 0.0f, 0.0f, 0.0f); + int i = 0; + float2 param = float2(0.0f, 0.0f); + float4 param_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 indexable[8] = (float4[8])0; + float4 indexable_1[8] = (float4[8])0; + float4 indexable_2[8] = (float4[8])0; + float4 indexable_3[16] = (float4[16])0; + res = float4(0.5f, 0.5f, 1.0f, 1.0f); + i = 0; + { + for(; (i < 8); i = (i + 1)) { + const int x_159 = i; + const float2 x_160 = pos_1; + param = x_160; + const float4 tint_symbol_5[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable = tint_symbol_5; + const float4 x_162 = indexable[x_159]; + param_1 = x_162; + const bool x_163 = collision_vf2_vf4_(param, param_1); + if (x_163) { + const int x_166 = i; + const float4 tint_symbol_6[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable_1 = tint_symbol_6; + const float x_168 = indexable_1[x_166].x; + const int x_170 = i; + const float4 tint_symbol_7[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable_2 = tint_symbol_7; + const float x_172 = indexable_2[x_170].y; + const int x_175 = i; + const float4 tint_symbol_8[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable_3 = tint_symbol_8; + const float4 x_181 = indexable_3[((((int(x_168) * int(x_172)) + (x_175 * 9)) + 11) % 16)]; + res = x_181; + } + } + } + return res; +} + +void main_1() { + float2 lin = float2(0.0f, 0.0f); + float2 param_2 = float2(0.0f, 0.0f); + const float4 x_105 = gl_FragCoord; + const float2 x_108 = asfloat(x_20[0].xy); + lin = (float2(x_105.x, x_105.y) / x_108); + lin = floor((lin * 32.0f)); + param_2 = lin; + const float4 x_114 = match_vf2_(param_2); + x_GLF_color = x_114; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.msl new file mode 100644 index 0000000000..5b43db6ff9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.msl @@ -0,0 +1,123 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[16]; +}; +struct tint_array_wrapper_1 { + float4 arr[8]; +}; +struct tint_array_wrapper_2 { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +bool collision_vf2_vf4_(thread float2* const pos, thread float4* const quad) { + bool4 x_116 = bool4(false, false, false, false); + float const x_118 = (*(pos)).x; + float const x_120 = (*(quad)).x; + if ((x_118 < x_120)) { + return false; + } + float const x_125 = (*(pos)).y; + float const x_127 = (*(quad)).y; + if ((x_125 < x_127)) { + return false; + } + float const x_132 = (*(pos)).x; + float const x_134 = (*(quad)).x; + float const x_136 = (*(quad)).z; + if ((x_132 > (x_134 + x_136))) { + return false; + } + float const x_142 = (*(pos)).y; + float const x_144 = (*(quad)).y; + float const x_146 = (*(quad)).w; + if ((x_142 > (x_144 + x_146))) { + return false; + } + return true; +} + +float4 match_vf2_(thread float2* const pos_1) { + float4 res = 0.0f; + int i = 0; + float2 param = 0.0f; + float4 param_1 = 0.0f; + tint_array_wrapper_1 indexable = {}; + tint_array_wrapper_1 indexable_1 = {}; + tint_array_wrapper_1 indexable_2 = {}; + tint_array_wrapper_2 indexable_3 = {}; + res = float4(0.5f, 0.5f, 1.0f, 1.0f); + i = 0; + while (true) { + int const x_156 = i; + if ((x_156 < 8)) { + } else { + break; + } + int const x_159 = i; + float2 const x_160 = *(pos_1); + param = x_160; + tint_array_wrapper_1 const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable = tint_symbol_4; + float4 const x_162 = indexable.arr[x_159]; + param_1 = x_162; + bool const x_163 = collision_vf2_vf4_(&(param), &(param_1)); + if (x_163) { + int const x_166 = i; + tint_array_wrapper_1 const tint_symbol_5 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable_1 = tint_symbol_5; + float const x_168 = indexable_1.arr[x_166].x; + int const x_170 = i; + tint_array_wrapper_1 const tint_symbol_6 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable_2 = tint_symbol_6; + float const x_172 = indexable_2.arr[x_170].y; + int const x_175 = i; + tint_array_wrapper_2 const tint_symbol_7 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable_3 = tint_symbol_7; + float4 const x_181 = indexable_3.arr[((((int(x_168) * int(x_172)) + (x_175 * 9)) + 11) % 16)]; + res = x_181; + } + { + int const x_182 = i; + i = (x_182 + 1); + } + } + float4 const x_184 = res; + return x_184; +} + +void main_1(constant buf0& x_20, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + float2 lin = 0.0f; + float2 param_2 = 0.0f; + float4 const x_105 = *(tint_symbol_9); + float2 const x_108 = x_20.resolution; + lin = (float2(x_105.x, x_105.y) / x_108); + float2 const x_110 = lin; + lin = floor((x_110 * 32.0f)); + float2 const x_113 = lin; + param_2 = x_113; + float4 const x_114 = match_vf2_(&(param_2)); + *(tint_symbol_10) = x_114; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_20 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_20, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..44345bd109 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.spvasm @@ -0,0 +1,313 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 226 +; Schema: 0 + OpCapability Shader + %207 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_20 "x_20" + OpName %x_GLF_color "x_GLF_color" + OpName %index "index" + OpName %state "state" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %collision_vf2_vf4_ "collision_vf2_vf4_" + OpName %pos "pos" + OpName %quad "quad" + OpName %x_116 "x_116" + OpName %match_vf2_ "match_vf2_" + OpName %pos_1 "pos_1" + OpName %res "res" + OpName %i "i" + OpName %param "param" + OpName %param_1 "param_1" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %indexable_2 "indexable_2" + OpName %indexable_3 "indexable_3" + OpName %main_1 "main_1" + OpName %lin "lin" + OpName %param_2 "param_2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_20 NonWritable + OpDecorate %x_20 DescriptorSet 0 + OpDecorate %x_20 Binding 0 + OpDecorate %_arr_int_uint_16 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_8 ArrayStride 16 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_20 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %14 = OpConstantNull %int + %index = OpVariable %_ptr_Private_int Private %14 + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_int_uint_16 = OpTypeArray %int %uint_16 +%_ptr_Private__arr_int_uint_16 = OpTypePointer Private %_arr_int_uint_16 + %20 = OpConstantNull %_arr_int_uint_16 + %state = OpVariable %_ptr_Private__arr_int_uint_16 Private %20 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %bool = OpTypeBool +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %25 = OpTypeFunction %bool %_ptr_Function_v2float %_ptr_Function_v4float + %v4bool = OpTypeVector %bool 4 + %false = OpConstantFalse %bool + %35 = OpConstantComposite %v4bool %false %false %false %false +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %38 = OpConstantNull %v4bool + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %89 = OpTypeFunction %v4float %_ptr_Function_v2float +%_ptr_Function_int = OpTypePointer Function %int + %97 = OpConstantNull %v2float + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %103 = OpConstantNull %_arr_v4float_uint_8 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %109 = OpConstantNull %_arr_v4float_uint_16 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %112 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %int_8 = OpConstant %int 8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %129 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %130 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %131 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %133 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %136 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %138 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %140 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %142 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %143 = OpConstantComposite %_arr_v4float_uint_8 %129 %130 %131 %133 %136 %138 %140 %142 + %float_0 = OpConstant %float 0 + %159 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %160 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %161 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %162 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %164 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %166 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %167 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %168 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %169 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %170 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %171 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %172 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %173 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %174 = OpConstantComposite %_arr_v4float_uint_16 %159 %160 %161 %162 %163 %164 %165 %166 %159 %167 %168 %169 %170 %171 %172 %173 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %191 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 + %main_out = OpTypeStruct %v4float + %213 = OpTypeFunction %void %main_out +%collision_vf2_vf4_ = OpFunction %bool None %25 + %pos = OpFunctionParameter %_ptr_Function_v2float + %quad = OpFunctionParameter %_ptr_Function_v4float + %32 = OpLabel + %x_116 = OpVariable %_ptr_Function_v4bool Function %38 + OpStore %x_116 %35 + %42 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %43 = OpLoad %float %42 + %45 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %46 = OpLoad %float %45 + %47 = OpFOrdLessThan %bool %43 %46 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + OpReturnValue %false + %48 = OpLabel + %52 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %53 = OpLoad %float %52 + %55 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %56 = OpLoad %float %55 + %57 = OpFOrdLessThan %bool %53 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + OpReturnValue %false + %58 = OpLabel + %61 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %62 = OpLoad %float %61 + %64 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %65 = OpLoad %float %64 + %68 = OpAccessChain %_ptr_Function_float %quad %uint_2 + %69 = OpLoad %float %68 + %70 = OpFAdd %float %65 %69 + %71 = OpFOrdGreaterThan %bool %62 %70 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + OpReturnValue %false + %72 = OpLabel + %75 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %76 = OpLoad %float %75 + %78 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %79 = OpLoad %float %78 + %82 = OpAccessChain %_ptr_Function_float %quad %uint_3 + %83 = OpLoad %float %82 + %84 = OpFAdd %float %79 %83 + %85 = OpFOrdGreaterThan %bool %76 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + OpReturnValue %false + %86 = OpLabel + OpReturnValue %true + OpFunctionEnd + %match_vf2_ = OpFunction %v4float None %89 + %pos_1 = OpFunctionParameter %_ptr_Function_v2float + %92 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %i = OpVariable %_ptr_Function_int Function %14 + %param = OpVariable %_ptr_Function_v2float Function %97 + %param_1 = OpVariable %_ptr_Function_v4float Function %5 + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %103 +%indexable_1 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %103 +%indexable_2 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %103 +%indexable_3 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %109 + OpStore %res %112 + OpStore %i %int_0 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i + %120 = OpSLessThan %bool %118 %int_8 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + OpBranch %121 + %123 = OpLabel + OpBranch %115 + %121 = OpLabel + %124 = OpLoad %int %i + %126 = OpLoad %v2float %pos_1 + OpStore %param %126 + OpStore %indexable %143 + %144 = OpAccessChain %_ptr_Function_v4float %indexable %124 + %145 = OpLoad %v4float %144 + OpStore %param_1 %145 + %146 = OpFunctionCall %bool %collision_vf2_vf4_ %param %param_1 + OpSelectionMerge %149 None + OpBranchConditional %146 %150 %149 + %150 = OpLabel + %151 = OpLoad %int %i + OpStore %indexable_1 %143 + %152 = OpAccessChain %_ptr_Function_float %indexable_1 %151 %uint_0 + %153 = OpLoad %float %152 + %154 = OpLoad %int %i + OpStore %indexable_2 %143 + %155 = OpAccessChain %_ptr_Function_float %indexable_2 %154 %uint_1 + %156 = OpLoad %float %155 + %157 = OpLoad %int %i + OpStore %indexable_3 %174 + %175 = OpConvertFToS %int %153 + %176 = OpConvertFToS %int %156 + %177 = OpIMul %int %175 %176 + %179 = OpIMul %int %157 %int_9 + %180 = OpIAdd %int %177 %179 + %182 = OpIAdd %int %180 %int_11 + %184 = OpSMod %int %182 %int_16 + %185 = OpAccessChain %_ptr_Function_v4float %indexable_3 %184 + %186 = OpLoad %v4float %185 + OpStore %res %186 + OpBranch %149 + %149 = OpLabel + OpBranch %116 + %116 = OpLabel + %187 = OpLoad %int %i + %189 = OpIAdd %int %187 %int_1 + OpStore %i %189 + OpBranch %114 + %115 = OpLabel + %190 = OpLoad %v4float %res + OpReturnValue %190 + OpFunctionEnd + %main_1 = OpFunction %void None %191 + %194 = OpLabel + %lin = OpVariable %_ptr_Function_v2float Function %97 + %param_2 = OpVariable %_ptr_Function_v2float Function %97 + %197 = OpLoad %v4float %gl_FragCoord + %199 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_0 + %200 = OpLoad %v2float %199 + %201 = OpCompositeExtract %float %197 0 + %202 = OpCompositeExtract %float %197 1 + %203 = OpCompositeConstruct %v2float %201 %202 + %204 = OpFDiv %v2float %203 %200 + OpStore %lin %204 + %205 = OpLoad %v2float %lin + %209 = OpVectorTimesScalar %v2float %205 %float_32 + %206 = OpExtInst %v2float %207 Floor %209 + OpStore %lin %206 + %210 = OpLoad %v2float %lin + OpStore %param_2 %210 + %211 = OpFunctionCall %v4float %match_vf2_ %param_2 + OpStore %x_GLF_color %211 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %213 +%tint_symbol_1 = OpFunctionParameter %main_out + %217 = OpLabel + %218 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %218 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %191 + %220 = OpLabel + %221 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %221 + %222 = OpFunctionCall %void %main_1 + %224 = OpLoad %v4float %x_GLF_color + %225 = OpCompositeConstruct %main_out %224 + %223 = OpFunctionCall %void %tint_symbol_3 %225 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..f70d557eac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-declare-bvec4/1.wgsl.expected.wgsl @@ -0,0 +1,114 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_20 : buf0; + +var x_GLF_color : vec4; + +var index : i32; + +var state : array; + +fn collision_vf2_vf4_(pos : ptr>, quad : ptr>) -> bool { + var x_116 : vec4 = vec4(false, false, false, false); + let x_118 : f32 = (*(pos)).x; + let x_120 : f32 = (*(quad)).x; + if ((x_118 < x_120)) { + return false; + } + let x_125 : f32 = (*(pos)).y; + let x_127 : f32 = (*(quad)).y; + if ((x_125 < x_127)) { + return false; + } + let x_132 : f32 = (*(pos)).x; + let x_134 : f32 = (*(quad)).x; + let x_136 : f32 = (*(quad)).z; + if ((x_132 > (x_134 + x_136))) { + return false; + } + let x_142 : f32 = (*(pos)).y; + let x_144 : f32 = (*(quad)).y; + let x_146 : f32 = (*(quad)).w; + if ((x_142 > (x_144 + x_146))) { + return false; + } + return true; +} + +fn match_vf2_(pos_1 : ptr>) -> vec4 { + var res : vec4; + var i : i32; + var param : vec2; + var param_1 : vec4; + var indexable : array, 8>; + var indexable_1 : array, 8>; + var indexable_2 : array, 8>; + var indexable_3 : array, 16>; + res = vec4(0.5, 0.5, 1.0, 1.0); + i = 0; + loop { + let x_156 : i32 = i; + if ((x_156 < 8)) { + } else { + break; + } + let x_159 : i32 = i; + let x_160 : vec2 = *(pos_1); + param = x_160; + indexable = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_162 : vec4 = indexable[x_159]; + param_1 = x_162; + let x_163 : bool = collision_vf2_vf4_(&(param), &(param_1)); + if (x_163) { + let x_166 : i32 = i; + indexable_1 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_168 : f32 = indexable_1[x_166].x; + let x_170 : i32 = i; + indexable_2 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_172 : f32 = indexable_2[x_170].y; + let x_175 : i32 = i; + indexable_3 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_181 : vec4 = indexable_3[((((i32(x_168) * i32(x_172)) + (x_175 * 9)) + 11) % 16)]; + res = x_181; + } + + continuing { + let x_182 : i32 = i; + i = (x_182 + 1); + } + } + let x_184 : vec4 = res; + return x_184; +} + +fn main_1() { + var lin : vec2; + var param_2 : vec2; + let x_105 : vec4 = gl_FragCoord; + let x_108 : vec2 = x_20.resolution; + lin = (vec2(x_105.x, x_105.y) / x_108); + let x_110 : vec2 = lin; + lin = floor((x_110 * 32.0)); + let x_113 : vec2 = lin; + param_2 = x_113; + let x_114 : vec4 = match_vf2_(&(param_2)); + x_GLF_color = x_114; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm new file mode 100644 index 0000000000..a8c4c53612 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm @@ -0,0 +1,565 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %merge_i1_i1_i1_ "merge(i1;i1;i1;" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %mergeSort_ "mergeSort(" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %temp "temp" + OpName %i_0 "i" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_1 "i" + OpName %from_0 "from" + OpName %mid_0 "mid" + OpName %to_0 "to" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %i_2 "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %j_0 "j" + OpName %gl_FragCoord "gl_FragCoord" + OpName %grey "grey" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %__0 "" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %34 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %37 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private + %int_10 = OpConstant %int 10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int_30 = OpConstant %int 30 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %main = OpFunction %void None %34 + %85 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %grey = OpVariable %_ptr_Function_float Function + %86 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %87 = OpLoad %float %86 + %88 = OpConvertFToS %int %87 + OpStore %i_2 %88 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %90 %91 None + OpBranch %92 + %92 = OpLabel + %93 = OpLoad %int %i_2 + OpSelectionMerge %94 None + OpSwitch %93 %94 0 %95 1 %96 2 %97 3 %98 4 %99 5 %100 6 %101 7 %102 8 %103 9 %104 + %95 = OpLabel + %105 = OpLoad %int %i_2 + %106 = OpAccessChain %_ptr_Private_int %data %105 + OpStore %106 %int_4 + OpBranch %94 + %96 = OpLabel + %107 = OpLoad %int %i_2 + %108 = OpAccessChain %_ptr_Private_int %data %107 + OpStore %108 %int_3 + OpBranch %94 + %97 = OpLabel + %109 = OpLoad %int %i_2 + %110 = OpAccessChain %_ptr_Private_int %data %109 + OpStore %110 %int_2 + OpBranch %94 + %98 = OpLabel + %111 = OpLoad %int %i_2 + %112 = OpAccessChain %_ptr_Private_int %data %111 + OpStore %112 %int_1 + OpBranch %94 + %99 = OpLabel + %113 = OpLoad %int %i_2 + %114 = OpAccessChain %_ptr_Private_int %data %113 + OpStore %114 %int_0 + OpBranch %94 + %100 = OpLabel + %115 = OpLoad %int %i_2 + %116 = OpAccessChain %_ptr_Private_int %data %115 + OpStore %116 %int_n1 + OpBranch %94 + %101 = OpLabel + %117 = OpLoad %int %i_2 + %118 = OpAccessChain %_ptr_Private_int %data %117 + OpStore %118 %int_n2 + OpBranch %94 + %102 = OpLabel + %119 = OpLoad %int %i_2 + %120 = OpAccessChain %_ptr_Private_int %data %119 + OpStore %120 %int_n3 + OpBranch %94 + %103 = OpLabel + %121 = OpLoad %int %i_2 + %122 = OpAccessChain %_ptr_Private_int %data %121 + OpStore %122 %int_n4 + OpBranch %94 + %104 = OpLabel + %123 = OpLoad %int %i_2 + %124 = OpAccessChain %_ptr_Private_int %data %123 + OpStore %124 %int_n5 + OpBranch %94 + %94 = OpLabel + %125 = OpLoad %int %i_2 + %126 = OpIAdd %int %125 %int_1 + OpStore %i_2 %126 + OpBranch %91 + %91 = OpLabel + %127 = OpLoad %int %i_2 + %128 = OpSLessThan %bool %127 %int_10 + OpBranchConditional %128 %89 %90 + %90 = OpLabel + OpStore %j_0 %int_0 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %133 = OpLoad %int %j_0 + %134 = OpSLessThan %bool %133 %int_10 + OpBranchConditional %134 %135 %130 + %135 = OpLabel + %136 = OpLoad %int %j_0 + %137 = OpLoad %int %j_0 + %138 = OpAccessChain %_ptr_Private_int %data %137 + %139 = OpLoad %int %138 + %140 = OpAccessChain %_ptr_Private_int %temp %136 + OpStore %140 %139 + OpBranch %131 + %131 = OpLabel + %141 = OpLoad %int %j_0 + %142 = OpIAdd %int %141 %int_1 + OpStore %j_0 %142 + OpBranch %129 + %130 = OpLabel + %143 = OpFunctionCall %void %mergeSort_ + %144 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %145 = OpLoad %float %144 + %146 = OpConvertFToS %int %145 + %147 = OpSLessThan %bool %146 %int_30 + OpSelectionMerge %148 None + OpBranchConditional %147 %149 %150 + %149 = OpLabel + %151 = OpAccessChain %_ptr_Private_int %data %int_0 + %152 = OpLoad %int %151 + %153 = OpConvertSToF %float %152 + %154 = OpFDiv %float %153 %float_10 + %155 = OpFAdd %float %float_0_5 %154 + OpStore %grey %155 + OpBranch %148 + %150 = OpLabel + %156 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %157 = OpLoad %float %156 + %158 = OpConvertFToS %int %157 + %159 = OpSLessThan %bool %158 %int_60 + OpSelectionMerge %160 None + OpBranchConditional %159 %161 %162 + %161 = OpLabel + %163 = OpAccessChain %_ptr_Private_int %data %int_1 + %164 = OpLoad %int %163 + %165 = OpConvertSToF %float %164 + %166 = OpFDiv %float %165 %float_10 + %167 = OpFAdd %float %float_0_5 %166 + OpStore %grey %167 + OpBranch %160 + %162 = OpLabel + %168 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %169 = OpLoad %float %168 + %170 = OpConvertFToS %int %169 + %171 = OpSLessThan %bool %170 %int_90 + OpSelectionMerge %172 None + OpBranchConditional %171 %173 %174 + %173 = OpLabel + %175 = OpAccessChain %_ptr_Private_int %data %int_2 + %176 = OpLoad %int %175 + %177 = OpConvertSToF %float %176 + %178 = OpFDiv %float %177 %float_10 + %179 = OpFAdd %float %float_0_5 %178 + OpStore %grey %179 + OpBranch %172 + %174 = OpLabel + %180 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %181 = OpLoad %float %180 + %182 = OpConvertFToS %int %181 + %183 = OpSLessThan %bool %182 %int_120 + OpSelectionMerge %184 None + OpBranchConditional %183 %185 %186 + %185 = OpLabel + %187 = OpAccessChain %_ptr_Private_int %data %int_3 + %188 = OpLoad %int %187 + %189 = OpConvertSToF %float %188 + %190 = OpFDiv %float %189 %float_10 + %191 = OpFAdd %float %float_0_5 %190 + OpStore %grey %191 + OpBranch %184 + %186 = OpLabel + %192 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %193 = OpLoad %float %192 + %194 = OpConvertFToS %int %193 + %195 = OpSLessThan %bool %194 %int_150 + OpSelectionMerge %196 None + OpBranchConditional %195 %197 %198 + %197 = OpLabel + OpKill + %198 = OpLabel + %199 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %200 = OpLoad %float %199 + %201 = OpConvertFToS %int %200 + %202 = OpSLessThan %bool %201 %int_180 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %205 + %204 = OpLabel + %206 = OpAccessChain %_ptr_Private_int %data %int_5 + %207 = OpLoad %int %206 + %208 = OpConvertSToF %float %207 + %209 = OpFDiv %float %208 %float_10 + %210 = OpFAdd %float %float_0_5 %209 + OpStore %grey %210 + OpBranch %203 + %205 = OpLabel + %211 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %212 = OpLoad %float %211 + %213 = OpConvertFToS %int %212 + %214 = OpSLessThan %bool %213 %int_210 + OpSelectionMerge %215 None + OpBranchConditional %214 %216 %217 + %216 = OpLabel + %218 = OpAccessChain %_ptr_Private_int %data %int_6 + %219 = OpLoad %int %218 + %220 = OpConvertSToF %float %219 + %221 = OpFDiv %float %220 %float_10 + %222 = OpFAdd %float %float_0_5 %221 + OpStore %grey %222 + OpBranch %215 + %217 = OpLabel + %223 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %224 = OpLoad %float %223 + %225 = OpConvertFToS %int %224 + %226 = OpSLessThan %bool %225 %int_240 + OpSelectionMerge %227 None + OpBranchConditional %226 %228 %229 + %228 = OpLabel + %230 = OpAccessChain %_ptr_Private_int %data %int_7 + %231 = OpLoad %int %230 + %232 = OpConvertSToF %float %231 + %233 = OpFDiv %float %232 %float_10 + %234 = OpFAdd %float %float_0_5 %233 + OpStore %grey %234 + OpBranch %227 + %229 = OpLabel + %235 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %236 = OpLoad %float %235 + %237 = OpConvertFToS %int %236 + %238 = OpSLessThan %bool %237 %int_270 + OpSelectionMerge %239 None + OpBranchConditional %238 %240 %241 + %240 = OpLabel + %242 = OpAccessChain %_ptr_Private_int %data %int_8 + %243 = OpLoad %int %242 + %244 = OpConvertSToF %float %243 + %245 = OpFDiv %float %244 %float_10 + %246 = OpFAdd %float %float_0_5 %245 + OpStore %grey %246 + OpBranch %239 + %241 = OpLabel + OpKill + %239 = OpLabel + OpBranch %227 + %227 = OpLabel + OpBranch %215 + %215 = OpLabel + OpBranch %203 + %203 = OpLabel + OpBranch %196 + %196 = OpLabel + OpBranch %184 + %184 = OpLabel + OpBranch %172 + %172 = OpLabel + OpBranch %160 + %160 = OpLabel + OpBranch %148 + %148 = OpLabel + %247 = OpLoad %float %grey + %248 = OpCompositeConstruct %v3float %247 %247 %247 + %249 = OpCompositeExtract %float %248 0 + %250 = OpCompositeExtract %float %248 1 + %251 = OpCompositeExtract %float %248 2 + %252 = OpCompositeConstruct %v4float %249 %250 %251 %float_1 + OpStore %_GLF_color %252 + OpReturn + OpFunctionEnd +%merge_i1_i1_i1_ = OpFunction %void None %37 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %253 = OpLabel + %k = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %254 = OpLoad %int %from + OpStore %k %254 + %255 = OpLoad %int %from + OpStore %i %255 + %256 = OpLoad %int %mid + %257 = OpIAdd %int %256 %int_1 + OpStore %j %257 + OpBranch %258 + %258 = OpLabel + OpLoopMerge %259 %260 None + OpBranch %261 + %261 = OpLabel + %262 = OpLoad %int %i + %263 = OpLoad %int %mid + %264 = OpSLessThanEqual %bool %262 %263 + %265 = OpLoad %int %j + %266 = OpLoad %int %to + %267 = OpSLessThanEqual %bool %265 %266 + %268 = OpLogicalAnd %bool %264 %267 + OpBranchConditional %268 %269 %259 + %269 = OpLabel + %270 = OpLoad %int %i + %271 = OpAccessChain %_ptr_Private_int %data %270 + %272 = OpLoad %int %271 + %273 = OpLoad %int %j + %274 = OpAccessChain %_ptr_Private_int %data %273 + %275 = OpLoad %int %274 + %276 = OpSLessThan %bool %272 %275 + OpSelectionMerge %277 None + OpBranchConditional %276 %278 %279 + %278 = OpLabel + %280 = OpLoad %int %k + %281 = OpIAdd %int %280 %int_1 + OpStore %k %281 + %282 = OpLoad %int %i + %283 = OpIAdd %int %282 %int_1 + OpStore %i %283 + %284 = OpAccessChain %_ptr_Private_int %data %282 + %285 = OpLoad %int %284 + %286 = OpAccessChain %_ptr_Private_int %temp %280 + OpStore %286 %285 + OpBranch %277 + %279 = OpLabel + %287 = OpLoad %int %k + %288 = OpIAdd %int %287 %int_1 + OpStore %k %288 + %289 = OpLoad %int %j + %290 = OpIAdd %int %289 %int_1 + OpStore %j %290 + %291 = OpAccessChain %_ptr_Private_int %data %289 + %292 = OpLoad %int %291 + %293 = OpAccessChain %_ptr_Private_int %temp %287 + OpStore %293 %292 + OpBranch %277 + %277 = OpLabel + OpBranch %260 + %260 = OpLabel + OpBranch %258 + %259 = OpLabel + OpBranch %294 + %294 = OpLabel + OpLoopMerge %295 %296 None + OpBranch %297 + %297 = OpLabel + %298 = OpLoad %int %i + %299 = OpSLessThan %bool %298 %int_10 + %300 = OpLoad %int %i + %301 = OpLoad %int %mid + %302 = OpSLessThanEqual %bool %300 %301 + %303 = OpLogicalAnd %bool %299 %302 + OpBranchConditional %303 %304 %295 + %304 = OpLabel + %305 = OpLoad %int %k + %306 = OpIAdd %int %305 %int_1 + OpStore %k %306 + %307 = OpLoad %int %i + %308 = OpIAdd %int %307 %int_1 + OpStore %i %308 + %309 = OpAccessChain %_ptr_Private_int %data %307 + %310 = OpLoad %int %309 + %311 = OpAccessChain %_ptr_Private_int %temp %305 + OpStore %311 %310 + OpBranch %296 + %296 = OpLabel + OpBranch %294 + %295 = OpLabel + %312 = OpLoad %int %from + OpStore %i_0 %312 + OpBranch %313 + %313 = OpLabel + OpLoopMerge %314 %315 None + OpBranch %316 + %316 = OpLabel + %317 = OpLoad %int %i_0 + %318 = OpLoad %int %to + %319 = OpSLessThanEqual %bool %317 %318 + OpBranchConditional %319 %320 %314 + %320 = OpLabel + %321 = OpLoad %int %i_0 + %322 = OpLoad %int %i_0 + %323 = OpAccessChain %_ptr_Private_int %temp %322 + %324 = OpLoad %int %323 + %325 = OpAccessChain %_ptr_Private_int %data %321 + OpStore %325 %324 + OpBranch %315 + %315 = OpLabel + %326 = OpLoad %int %i_0 + %327 = OpIAdd %int %326 %int_1 + OpStore %i_0 %327 + OpBranch %313 + %314 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %34 + %328 = OpLabel + %low = OpVariable %_ptr_Function_int Function + %high = OpVariable %_ptr_Function_int Function + %m = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %from_0 = OpVariable %_ptr_Function_int Function + %mid_0 = OpVariable %_ptr_Function_int Function + %to_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %329 + %329 = OpLabel + OpLoopMerge %330 %331 None + OpBranch %332 + %332 = OpLabel + %333 = OpLoad %int %m + %334 = OpLoad %int %high + %335 = OpSLessThanEqual %bool %333 %334 + OpBranchConditional %335 %336 %330 + %336 = OpLabel + %337 = OpLoad %int %low + OpStore %i_1 %337 + OpBranch %338 + %338 = OpLabel + OpLoopMerge %339 %340 None + OpBranch %341 + %341 = OpLabel + %342 = OpLoad %int %i_1 + %343 = OpLoad %int %high + %344 = OpSLessThan %bool %342 %343 + OpBranchConditional %344 %345 %339 + %345 = OpLabel + %346 = OpLoad %int %i_1 + OpStore %from_0 %346 + %347 = OpLoad %int %i_1 + %348 = OpLoad %int %m + %349 = OpIAdd %int %347 %348 + %350 = OpISub %int %349 %int_1 + OpStore %mid_0 %350 + %351 = OpLoad %int %i_1 + %352 = OpLoad %int %m + %353 = OpIMul %int %int_2 %352 + %354 = OpIAdd %int %351 %353 + %355 = OpISub %int %354 %int_1 + %356 = OpLoad %int %high + %357 = OpExtInst %int %1 SMin %355 %356 + OpStore %to_0 %357 + %358 = OpLoad %int %from_0 + OpStore %param %358 + %359 = OpLoad %int %mid_0 + OpStore %param_0 %359 + %360 = OpLoad %int %to_0 + OpStore %param_1 %360 + %361 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_0 %param_1 + OpBranch %340 + %340 = OpLabel + %362 = OpLoad %int %m + %363 = OpIMul %int %int_2 %362 + %364 = OpLoad %int %i_1 + %365 = OpIAdd %int %364 %363 + OpStore %i_1 %365 + OpBranch %338 + %339 = OpLabel + OpBranch %331 + %331 = OpLabel + %366 = OpLoad %int %m + %367 = OpIMul %int %int_2 %366 + OpStore %m %367 + OpBranch %329 + %330 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..be184c8dcf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.hlsl @@ -0,0 +1,271 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_32 : register(b1, space0) { + uint4 x_32[1]; +}; + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_254 = from; + k = x_254; + const int x_255 = from; + i = x_255; + const int x_256 = mid; + j = (x_256 + 1); + while (true) { + const int x_262 = i; + const int x_263 = mid; + const int x_265 = j; + const int x_266 = to; + bool tint_tmp = (x_262 <= x_263); + if (tint_tmp) { + tint_tmp = (x_265 <= x_266); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_272 = data[i]; + const int x_275 = data[j]; + if ((x_272 < x_275)) { + const int x_280 = k; + k = (x_280 + 1); + const int x_282 = i; + i = (x_282 + 1); + const int x_285 = data[x_282]; + temp[x_280] = x_285; + } else { + const int x_287 = k; + k = (x_287 + 1); + const int x_289 = j; + j = (x_289 + 1); + const int x_292 = data[x_289]; + temp[x_287] = x_292; + } + } + while (true) { + const int x_298 = i; + const int x_300 = i; + const int x_301 = mid; + bool tint_tmp_1 = (x_298 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_300 <= x_301); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_305 = k; + k = (x_305 + 1); + const int x_307 = i; + i = (x_307 + 1); + const int x_310 = data[x_307]; + temp[x_305] = x_310; + } + const int x_312 = from; + i_1 = x_312; + while (true) { + const int x_317 = i_1; + const int x_318 = to; + if ((x_317 <= x_318)) { + } else { + break; + } + const int x_321 = i_1; + const int x_324 = temp[i_1]; + data[x_321] = x_324; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_87 = asfloat(x_28[0].x); + i_3 = int(x_87); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_136 = j_1; + const int x_139 = data[j_1]; + temp[x_136] = x_139; + } + } + mergeSort_(); + const float x_145 = gl_FragCoord.y; + if ((int(x_145) < 30)) { + const int x_152 = data[0]; + grey = (0.5f + (float(x_152) / 10.0f)); + } else { + const float x_157 = gl_FragCoord.y; + if ((int(x_157) < 60)) { + const int x_164 = data[1]; + grey = (0.5f + (float(x_164) / 10.0f)); + } else { + const float x_169 = gl_FragCoord.y; + if ((int(x_169) < 90)) { + const int x_176 = data[2]; + grey = (0.5f + (float(x_176) / 10.0f)); + } else { + const float x_181 = gl_FragCoord.y; + if ((int(x_181) < 120)) { + const int x_188 = data[3]; + grey = (0.5f + (float(x_188) / 10.0f)); + } else { + const float x_193 = gl_FragCoord.y; + if ((int(x_193) < 150)) { + discard; + } else { + const float x_200 = gl_FragCoord.y; + if ((int(x_200) < 180)) { + const int x_207 = data[5]; + grey = (0.5f + (float(x_207) / 10.0f)); + } else { + const float x_212 = gl_FragCoord.y; + if ((int(x_212) < 210)) { + const int x_219 = data[6]; + grey = (0.5f + (float(x_219) / 10.0f)); + } else { + const float x_224 = gl_FragCoord.y; + if ((int(x_224) < 240)) { + const int x_231 = data[7]; + grey = (0.5f + (float(x_231) / 10.0f)); + } else { + const float x_236 = gl_FragCoord.y; + if ((int(x_236) < 270)) { + const int x_243 = data[8]; + grey = (0.5f + (float(x_243) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_247 = grey; + const float3 x_248 = float3(x_247, x_247, x_247); + x_GLF_color = float4(x_248.x, x_248.y, x_248.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..6e7adb415a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.msl @@ -0,0 +1,317 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_254 = *(from); + k = x_254; + int const x_255 = *(from); + i = x_255; + int const x_256 = *(mid); + j = (x_256 + 1); + while (true) { + int const x_262 = i; + int const x_263 = *(mid); + int const x_265 = j; + int const x_266 = *(to); + if (((x_262 <= x_263) && (x_265 <= x_266))) { + } else { + break; + } + int const x_270 = i; + int const x_272 = (*(tint_symbol_5)).arr[x_270]; + int const x_273 = j; + int const x_275 = (*(tint_symbol_5)).arr[x_273]; + if ((x_272 < x_275)) { + int const x_280 = k; + k = (x_280 + 1); + int const x_282 = i; + i = (x_282 + 1); + int const x_285 = (*(tint_symbol_5)).arr[x_282]; + (*(tint_symbol_6)).arr[x_280] = x_285; + } else { + int const x_287 = k; + k = (x_287 + 1); + int const x_289 = j; + j = (x_289 + 1); + int const x_292 = (*(tint_symbol_5)).arr[x_289]; + (*(tint_symbol_6)).arr[x_287] = x_292; + } + } + while (true) { + int const x_298 = i; + int const x_300 = i; + int const x_301 = *(mid); + if (((x_298 < 10) && (x_300 <= x_301))) { + } else { + break; + } + int const x_305 = k; + k = (x_305 + 1); + int const x_307 = i; + i = (x_307 + 1); + int const x_310 = (*(tint_symbol_5)).arr[x_307]; + (*(tint_symbol_6)).arr[x_305] = x_310; + } + int const x_312 = *(from); + i_1 = x_312; + while (true) { + int const x_317 = i_1; + int const x_318 = *(to); + if ((x_317 <= x_318)) { + } else { + break; + } + int const x_321 = i_1; + int const x_322 = i_1; + int const x_324 = (*(tint_symbol_6)).arr[x_322]; + (*(tint_symbol_5)).arr[x_321] = x_324; + { + int const x_326 = i_1; + i_1 = (x_326 + 1); + } + } + return; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_333 = m; + int const x_334 = high; + if ((x_333 <= x_334)) { + } else { + break; + } + int const x_337 = low; + i_2 = x_337; + while (true) { + int const x_342 = i_2; + int const x_343 = high; + if ((x_342 < x_343)) { + } else { + break; + } + int const x_346 = i_2; + from_1 = x_346; + int const x_347 = i_2; + int const x_348 = m; + mid_1 = ((x_347 + x_348) - 1); + int const x_351 = i_2; + int const x_352 = m; + int const x_356 = high; + to_1 = min(((x_351 + (2 * x_352)) - 1), x_356); + int const x_358 = from_1; + param = x_358; + int const x_359 = mid_1; + param_1 = x_359; + int const x_360 = to_1; + param_2 = x_360; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_362 = m; + int const x_364 = i_2; + i_2 = (x_364 + (2 * x_362)); + } + } + { + int const x_366 = m; + m = (2 * x_366); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_87 = x_28.injectionSwitch.x; + i_3 = int(x_87); + while (true) { + int const x_93 = i_3; + switch(x_93) { + case 9: { + int const x_123 = i_3; + (*(tint_symbol_9)).arr[x_123] = -5; + break; + } + case 8: { + int const x_121 = i_3; + (*(tint_symbol_9)).arr[x_121] = -4; + break; + } + case 7: { + int const x_119 = i_3; + (*(tint_symbol_9)).arr[x_119] = -3; + break; + } + case 6: { + int const x_117 = i_3; + (*(tint_symbol_9)).arr[x_117] = -2; + break; + } + case 5: { + int const x_115 = i_3; + (*(tint_symbol_9)).arr[x_115] = -1; + break; + } + case 4: { + int const x_113 = i_3; + (*(tint_symbol_9)).arr[x_113] = 0; + break; + } + case 3: { + int const x_111 = i_3; + (*(tint_symbol_9)).arr[x_111] = 1; + break; + } + case 2: { + int const x_109 = i_3; + (*(tint_symbol_9)).arr[x_109] = 2; + break; + } + case 1: { + int const x_107 = i_3; + (*(tint_symbol_9)).arr[x_107] = 3; + break; + } + case 0: { + int const x_105 = i_3; + (*(tint_symbol_9)).arr[x_105] = 4; + break; + } + default: { + break; + } + } + int const x_125 = i_3; + i_3 = (x_125 + 1); + { + int const x_127 = i_3; + if ((x_127 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_133 = j_1; + if ((x_133 < 10)) { + } else { + break; + } + int const x_136 = j_1; + int const x_137 = j_1; + int const x_139 = (*(tint_symbol_9)).arr[x_137]; + (*(tint_symbol_10)).arr[x_136] = x_139; + { + int const x_141 = j_1; + j_1 = (x_141 + 1); + } + } + mergeSort_(tint_symbol_9, tint_symbol_10); + float const x_145 = (*(tint_symbol_11)).y; + if ((int(x_145) < 30)) { + int const x_152 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_152) / 10.0f)); + } else { + float const x_157 = (*(tint_symbol_11)).y; + if ((int(x_157) < 60)) { + int const x_164 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_164) / 10.0f)); + } else { + float const x_169 = (*(tint_symbol_11)).y; + if ((int(x_169) < 90)) { + int const x_176 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_176) / 10.0f)); + } else { + float const x_181 = (*(tint_symbol_11)).y; + if ((int(x_181) < 120)) { + int const x_188 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_188) / 10.0f)); + } else { + float const x_193 = (*(tint_symbol_11)).y; + if ((int(x_193) < 150)) { + discard_fragment(); + } else { + float const x_200 = (*(tint_symbol_11)).y; + if ((int(x_200) < 180)) { + int const x_207 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_207) / 10.0f)); + } else { + float const x_212 = (*(tint_symbol_11)).y; + if ((int(x_212) < 210)) { + int const x_219 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_219) / 10.0f)); + } else { + float const x_224 = (*(tint_symbol_11)).y; + if ((int(x_224) < 240)) { + int const x_231 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_231) / 10.0f)); + } else { + float const x_236 = (*(tint_symbol_11)).y; + if ((int(x_236) < 270)) { + int const x_243 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_243) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_247 = grey; + float3 const x_248 = float3(x_247, x_247, x_247); + *(tint_symbol_12) = float4(x_248.x, x_248.y, x_248.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..9042981b0c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.spvasm @@ -0,0 +1,660 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 419 +; Schema: 0 + OpCapability Shader + %180 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_32 "x_32" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_32 NonWritable + OpDecorate %x_32 DescriptorSet 0 + OpDecorate %x_32 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_32 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %35 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %135 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %204 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %406 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %26 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %33 = OpLabel + %k = OpVariable %_ptr_Function_int Function %35 + %i = OpVariable %_ptr_Function_int Function %35 + %j = OpVariable %_ptr_Function_int Function %35 + %i_1 = OpVariable %_ptr_Function_int Function %35 + %40 = OpLoad %int %from + OpStore %k %40 + %42 = OpLoad %int %from + OpStore %i %42 + %44 = OpLoad %int %mid + %46 = OpIAdd %int %44 %int_1 + OpStore %j %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i + %53 = OpLoad %int %mid + %54 = OpLoad %int %j + %56 = OpLoad %int %to + %57 = OpSLessThanEqual %bool %51 %53 + OpSelectionMerge %59 None + OpBranchConditional %57 %60 %59 + %60 = OpLabel + %61 = OpSLessThanEqual %bool %54 %56 + OpBranch %59 + %59 = OpLabel + %62 = OpPhi %bool %57 %50 %61 %60 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %48 + %63 = OpLabel + %66 = OpLoad %int %i + %68 = OpAccessChain %_ptr_Private_int %data %66 + %69 = OpLoad %int %68 + %70 = OpLoad %int %j + %71 = OpAccessChain %_ptr_Private_int %data %70 + %72 = OpLoad %int %71 + %73 = OpSLessThan %bool %69 %72 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %77 = OpLoad %int %k + %78 = OpIAdd %int %77 %int_1 + OpStore %k %78 + %79 = OpLoad %int %i + %80 = OpIAdd %int %79 %int_1 + OpStore %i %80 + %81 = OpAccessChain %_ptr_Private_int %data %79 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Private_int %temp %77 + OpStore %83 %82 + OpBranch %74 + %76 = OpLabel + %84 = OpLoad %int %k + %85 = OpIAdd %int %84 %int_1 + OpStore %k %85 + %86 = OpLoad %int %j + %87 = OpIAdd %int %86 %int_1 + OpStore %j %87 + %88 = OpAccessChain %_ptr_Private_int %data %86 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Private_int %temp %84 + OpStore %90 %89 + OpBranch %74 + %74 = OpLabel + OpBranch %49 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %i + %96 = OpLoad %int %i + %98 = OpLoad %int %mid + %100 = OpSLessThan %bool %95 %int_10 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpSLessThanEqual %bool %96 %98 + OpBranch %101 + %101 = OpLabel + %104 = OpPhi %bool %100 %94 %103 %102 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %107 + %106 = OpLabel + OpBranch %105 + %107 = OpLabel + OpBranch %92 + %105 = OpLabel + %108 = OpLoad %int %k + %109 = OpIAdd %int %108 %int_1 + OpStore %k %109 + %110 = OpLoad %int %i + %111 = OpIAdd %int %110 %int_1 + OpStore %i %111 + %112 = OpAccessChain %_ptr_Private_int %data %110 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Private_int %temp %108 + OpStore %114 %113 + OpBranch %93 + %93 = OpLabel + OpBranch %91 + %92 = OpLabel + %116 = OpLoad %int %from + OpStore %i_1 %116 + OpBranch %117 + %117 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %121 = OpLoad %int %i_1 + %123 = OpLoad %int %to + %124 = OpSLessThanEqual %bool %121 %123 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %127 + %126 = OpLabel + OpBranch %125 + %127 = OpLabel + OpBranch %118 + %125 = OpLabel + %128 = OpLoad %int %i_1 + %129 = OpLoad %int %i_1 + %130 = OpAccessChain %_ptr_Private_int %temp %129 + %131 = OpLoad %int %130 + %132 = OpAccessChain %_ptr_Private_int %data %128 + OpStore %132 %131 + OpBranch %119 + %119 = OpLabel + %133 = OpLoad %int %i_1 + %134 = OpIAdd %int %133 %int_1 + OpStore %i_1 %134 + OpBranch %117 + %118 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %135 + %137 = OpLabel + %low = OpVariable %_ptr_Function_int Function %35 + %high = OpVariable %_ptr_Function_int Function %35 + %m = OpVariable %_ptr_Function_int Function %35 + %i_2 = OpVariable %_ptr_Function_int Function %35 + %from_1 = OpVariable %_ptr_Function_int Function %35 + %mid_1 = OpVariable %_ptr_Function_int Function %35 + %to_1 = OpVariable %_ptr_Function_int Function %35 + %param = OpVariable %_ptr_Function_int Function %35 + %param_1 = OpVariable %_ptr_Function_int Function %35 + %param_2 = OpVariable %_ptr_Function_int Function %35 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %154 = OpLoad %int %m + %155 = OpLoad %int %high + %156 = OpSLessThanEqual %bool %154 %155 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %159 + %158 = OpLabel + OpBranch %157 + %159 = OpLabel + OpBranch %151 + %157 = OpLabel + %160 = OpLoad %int %low + OpStore %i_2 %160 + OpBranch %161 + %161 = OpLabel + OpLoopMerge %162 %163 None + OpBranch %164 + %164 = OpLabel + %165 = OpLoad %int %i_2 + %166 = OpLoad %int %high + %167 = OpSLessThan %bool %165 %166 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %162 + %168 = OpLabel + %171 = OpLoad %int %i_2 + OpStore %from_1 %171 + %172 = OpLoad %int %i_2 + %173 = OpLoad %int %m + %174 = OpIAdd %int %172 %173 + %175 = OpISub %int %174 %int_1 + OpStore %mid_1 %175 + %176 = OpLoad %int %i_2 + %177 = OpLoad %int %m + %178 = OpLoad %int %high + %182 = OpIMul %int %int_2 %177 + %183 = OpIAdd %int %176 %182 + %184 = OpISub %int %183 %int_1 + %179 = OpExtInst %int %180 SMin %184 %178 + OpStore %to_1 %179 + %185 = OpLoad %int %from_1 + OpStore %param %185 + %186 = OpLoad %int %mid_1 + OpStore %param_1 %186 + %187 = OpLoad %int %to_1 + OpStore %param_2 %187 + %188 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %163 + %163 = OpLabel + %192 = OpLoad %int %m + %193 = OpLoad %int %i_2 + %194 = OpIMul %int %int_2 %192 + %195 = OpIAdd %int %193 %194 + OpStore %i_2 %195 + OpBranch %161 + %162 = OpLabel + OpBranch %152 + %152 = OpLabel + %196 = OpLoad %int %m + %197 = OpIMul %int %int_2 %196 + OpStore %m %197 + OpBranch %150 + %151 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %135 + %199 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %35 + %j_1 = OpVariable %_ptr_Function_int Function %35 + %grey = OpVariable %_ptr_Function_float Function %204 + %207 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %208 = OpLoad %float %207 + %209 = OpConvertFToS %int %208 + OpStore %i_3 %209 + OpBranch %210 + %210 = OpLabel + OpLoopMerge %211 %212 None + OpBranch %213 + %213 = OpLabel + %214 = OpLoad %int %i_3 + OpSelectionMerge %215 None + OpSwitch %214 %216 9 %217 8 %218 7 %219 6 %220 5 %221 4 %222 3 %223 2 %224 1 %225 0 %226 + %217 = OpLabel + %227 = OpLoad %int %i_3 + %228 = OpAccessChain %_ptr_Private_int %data %227 + OpStore %228 %int_n5 + OpBranch %215 + %218 = OpLabel + %230 = OpLoad %int %i_3 + %231 = OpAccessChain %_ptr_Private_int %data %230 + OpStore %231 %int_n4 + OpBranch %215 + %219 = OpLabel + %233 = OpLoad %int %i_3 + %234 = OpAccessChain %_ptr_Private_int %data %233 + OpStore %234 %int_n3 + OpBranch %215 + %220 = OpLabel + %236 = OpLoad %int %i_3 + %237 = OpAccessChain %_ptr_Private_int %data %236 + OpStore %237 %int_n2 + OpBranch %215 + %221 = OpLabel + %239 = OpLoad %int %i_3 + %240 = OpAccessChain %_ptr_Private_int %data %239 + OpStore %240 %int_n1 + OpBranch %215 + %222 = OpLabel + %242 = OpLoad %int %i_3 + %243 = OpAccessChain %_ptr_Private_int %data %242 + OpStore %243 %int_0 + OpBranch %215 + %223 = OpLabel + %244 = OpLoad %int %i_3 + %245 = OpAccessChain %_ptr_Private_int %data %244 + OpStore %245 %int_1 + OpBranch %215 + %224 = OpLabel + %246 = OpLoad %int %i_3 + %247 = OpAccessChain %_ptr_Private_int %data %246 + OpStore %247 %int_2 + OpBranch %215 + %225 = OpLabel + %248 = OpLoad %int %i_3 + %249 = OpAccessChain %_ptr_Private_int %data %248 + OpStore %249 %int_3 + OpBranch %215 + %226 = OpLabel + %251 = OpLoad %int %i_3 + %252 = OpAccessChain %_ptr_Private_int %data %251 + OpStore %252 %int_4 + OpBranch %215 + %216 = OpLabel + OpBranch %215 + %215 = OpLabel + %254 = OpLoad %int %i_3 + %255 = OpIAdd %int %254 %int_1 + OpStore %i_3 %255 + OpBranch %212 + %212 = OpLabel + %256 = OpLoad %int %i_3 + %257 = OpSLessThan %bool %256 %int_10 + OpSelectionMerge %258 None + OpBranchConditional %257 %259 %260 + %259 = OpLabel + OpBranch %258 + %260 = OpLabel + OpBranch %211 + %258 = OpLabel + OpBranch %210 + %211 = OpLabel + OpStore %j_1 %int_0 + OpBranch %261 + %261 = OpLabel + OpLoopMerge %262 %263 None + OpBranch %264 + %264 = OpLabel + %265 = OpLoad %int %j_1 + %266 = OpSLessThan %bool %265 %int_10 + OpSelectionMerge %267 None + OpBranchConditional %266 %268 %269 + %268 = OpLabel + OpBranch %267 + %269 = OpLabel + OpBranch %262 + %267 = OpLabel + %270 = OpLoad %int %j_1 + %271 = OpLoad %int %j_1 + %272 = OpAccessChain %_ptr_Private_int %data %271 + %273 = OpLoad %int %272 + %274 = OpAccessChain %_ptr_Private_int %temp %270 + OpStore %274 %273 + OpBranch %263 + %263 = OpLabel + %275 = OpLoad %int %j_1 + %276 = OpIAdd %int %275 %int_1 + OpStore %j_1 %276 + OpBranch %261 + %262 = OpLabel + %277 = OpFunctionCall %void %mergeSort_ + %280 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %281 = OpLoad %float %280 + %282 = OpConvertFToS %int %281 + %284 = OpSLessThan %bool %282 %int_30 + OpSelectionMerge %285 None + OpBranchConditional %284 %286 %287 + %286 = OpLabel + %288 = OpAccessChain %_ptr_Private_int %data %int_0 + %289 = OpLoad %int %288 + %291 = OpConvertSToF %float %289 + %293 = OpFDiv %float %291 %float_10 + %294 = OpFAdd %float %float_0_5 %293 + OpStore %grey %294 + OpBranch %285 + %287 = OpLabel + %295 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %296 = OpLoad %float %295 + %297 = OpConvertFToS %int %296 + %299 = OpSLessThan %bool %297 %int_60 + OpSelectionMerge %300 None + OpBranchConditional %299 %301 %302 + %301 = OpLabel + %303 = OpAccessChain %_ptr_Private_int %data %int_1 + %304 = OpLoad %int %303 + %305 = OpConvertSToF %float %304 + %306 = OpFDiv %float %305 %float_10 + %307 = OpFAdd %float %float_0_5 %306 + OpStore %grey %307 + OpBranch %300 + %302 = OpLabel + %308 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %309 = OpLoad %float %308 + %310 = OpConvertFToS %int %309 + %312 = OpSLessThan %bool %310 %int_90 + OpSelectionMerge %313 None + OpBranchConditional %312 %314 %315 + %314 = OpLabel + %316 = OpAccessChain %_ptr_Private_int %data %int_2 + %317 = OpLoad %int %316 + %318 = OpConvertSToF %float %317 + %319 = OpFDiv %float %318 %float_10 + %320 = OpFAdd %float %float_0_5 %319 + OpStore %grey %320 + OpBranch %313 + %315 = OpLabel + %321 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %322 = OpLoad %float %321 + %323 = OpConvertFToS %int %322 + %325 = OpSLessThan %bool %323 %int_120 + OpSelectionMerge %326 None + OpBranchConditional %325 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %_ptr_Private_int %data %int_3 + %330 = OpLoad %int %329 + %331 = OpConvertSToF %float %330 + %332 = OpFDiv %float %331 %float_10 + %333 = OpFAdd %float %float_0_5 %332 + OpStore %grey %333 + OpBranch %326 + %328 = OpLabel + %334 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %335 = OpLoad %float %334 + %336 = OpConvertFToS %int %335 + %338 = OpSLessThan %bool %336 %int_150 + OpSelectionMerge %339 None + OpBranchConditional %338 %340 %341 + %340 = OpLabel + OpKill + %341 = OpLabel + %342 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %343 = OpLoad %float %342 + %344 = OpConvertFToS %int %343 + %346 = OpSLessThan %bool %344 %int_180 + OpSelectionMerge %347 None + OpBranchConditional %346 %348 %349 + %348 = OpLabel + %351 = OpAccessChain %_ptr_Private_int %data %int_5 + %352 = OpLoad %int %351 + %353 = OpConvertSToF %float %352 + %354 = OpFDiv %float %353 %float_10 + %355 = OpFAdd %float %float_0_5 %354 + OpStore %grey %355 + OpBranch %347 + %349 = OpLabel + %356 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %357 = OpLoad %float %356 + %358 = OpConvertFToS %int %357 + %360 = OpSLessThan %bool %358 %int_210 + OpSelectionMerge %361 None + OpBranchConditional %360 %362 %363 + %362 = OpLabel + %365 = OpAccessChain %_ptr_Private_int %data %int_6 + %366 = OpLoad %int %365 + %367 = OpConvertSToF %float %366 + %368 = OpFDiv %float %367 %float_10 + %369 = OpFAdd %float %float_0_5 %368 + OpStore %grey %369 + OpBranch %361 + %363 = OpLabel + %370 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %371 = OpLoad %float %370 + %372 = OpConvertFToS %int %371 + %374 = OpSLessThan %bool %372 %int_240 + OpSelectionMerge %375 None + OpBranchConditional %374 %376 %377 + %376 = OpLabel + %379 = OpAccessChain %_ptr_Private_int %data %int_7 + %380 = OpLoad %int %379 + %381 = OpConvertSToF %float %380 + %382 = OpFDiv %float %381 %float_10 + %383 = OpFAdd %float %float_0_5 %382 + OpStore %grey %383 + OpBranch %375 + %377 = OpLabel + %384 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %385 = OpLoad %float %384 + %386 = OpConvertFToS %int %385 + %388 = OpSLessThan %bool %386 %int_270 + OpSelectionMerge %389 None + OpBranchConditional %388 %390 %391 + %390 = OpLabel + %393 = OpAccessChain %_ptr_Private_int %data %int_8 + %394 = OpLoad %int %393 + %395 = OpConvertSToF %float %394 + %396 = OpFDiv %float %395 %float_10 + %397 = OpFAdd %float %float_0_5 %396 + OpStore %grey %397 + OpBranch %389 + %391 = OpLabel + OpKill + %389 = OpLabel + OpBranch %375 + %375 = OpLabel + OpBranch %361 + %361 = OpLabel + OpBranch %347 + %347 = OpLabel + OpBranch %339 + %339 = OpLabel + OpBranch %326 + %326 = OpLabel + OpBranch %313 + %313 = OpLabel + OpBranch %300 + %300 = OpLabel + OpBranch %285 + %285 = OpLabel + %398 = OpLoad %float %grey + %400 = OpCompositeConstruct %v3float %398 %398 %398 + %401 = OpCompositeExtract %float %400 0 + %402 = OpCompositeExtract %float %400 1 + %403 = OpCompositeExtract %float %400 2 + %405 = OpCompositeConstruct %v4float %401 %402 %403 %float_1 + OpStore %x_GLF_color %405 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %406 +%tint_symbol_1 = OpFunctionParameter %main_out + %410 = OpLabel + %411 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %411 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %135 + %413 = OpLabel + %414 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %414 + %415 = OpFunctionCall %void %main_1 + %417 = OpLoad %v4float %x_GLF_color + %418 = OpCompositeConstruct %main_out %417 + %416 = OpFunctionCall %void %tint_symbol_3 %418 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 212[%212] is not post dominated by the back-edge block 258[%258] + %258 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..e61feb541e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.spvasm.expected.wgsl @@ -0,0 +1,313 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_32 : buf1; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_254 : i32 = *(from); + k = x_254; + let x_255 : i32 = *(from); + i = x_255; + let x_256 : i32 = *(mid); + j = (x_256 + 1); + loop { + let x_262 : i32 = i; + let x_263 : i32 = *(mid); + let x_265 : i32 = j; + let x_266 : i32 = *(to); + if (((x_262 <= x_263) && (x_265 <= x_266))) { + } else { + break; + } + let x_270 : i32 = i; + let x_272 : i32 = data[x_270]; + let x_273 : i32 = j; + let x_275 : i32 = data[x_273]; + if ((x_272 < x_275)) { + let x_280 : i32 = k; + k = (x_280 + 1); + let x_282 : i32 = i; + i = (x_282 + 1); + let x_285 : i32 = data[x_282]; + temp[x_280] = x_285; + } else { + let x_287 : i32 = k; + k = (x_287 + 1); + let x_289 : i32 = j; + j = (x_289 + 1); + let x_292 : i32 = data[x_289]; + temp[x_287] = x_292; + } + } + loop { + let x_298 : i32 = i; + let x_300 : i32 = i; + let x_301 : i32 = *(mid); + if (((x_298 < 10) && (x_300 <= x_301))) { + } else { + break; + } + let x_305 : i32 = k; + k = (x_305 + 1); + let x_307 : i32 = i; + i = (x_307 + 1); + let x_310 : i32 = data[x_307]; + temp[x_305] = x_310; + } + let x_312 : i32 = *(from); + i_1 = x_312; + loop { + let x_317 : i32 = i_1; + let x_318 : i32 = *(to); + if ((x_317 <= x_318)) { + } else { + break; + } + let x_321 : i32 = i_1; + let x_322 : i32 = i_1; + let x_324 : i32 = temp[x_322]; + data[x_321] = x_324; + + continuing { + let x_326 : i32 = i_1; + i_1 = (x_326 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_333 : i32 = m; + let x_334 : i32 = high; + if ((x_333 <= x_334)) { + } else { + break; + } + let x_337 : i32 = low; + i_2 = x_337; + loop { + let x_342 : i32 = i_2; + let x_343 : i32 = high; + if ((x_342 < x_343)) { + } else { + break; + } + let x_346 : i32 = i_2; + from_1 = x_346; + let x_347 : i32 = i_2; + let x_348 : i32 = m; + mid_1 = ((x_347 + x_348) - 1); + let x_351 : i32 = i_2; + let x_352 : i32 = m; + let x_356 : i32 = high; + to_1 = min(((x_351 + (2 * x_352)) - 1), x_356); + let x_358 : i32 = from_1; + param = x_358; + let x_359 : i32 = mid_1; + param_1 = x_359; + let x_360 : i32 = to_1; + param_2 = x_360; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_362 : i32 = m; + let x_364 : i32 = i_2; + i_2 = (x_364 + (2 * x_362)); + } + } + + continuing { + let x_366 : i32 = m; + m = (2 * x_366); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_87 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_87); + loop { + let x_93 : i32 = i_3; + switch(x_93) { + case 9: { + let x_123 : i32 = i_3; + data[x_123] = -5; + } + case 8: { + let x_121 : i32 = i_3; + data[x_121] = -4; + } + case 7: { + let x_119 : i32 = i_3; + data[x_119] = -3; + } + case 6: { + let x_117 : i32 = i_3; + data[x_117] = -2; + } + case 5: { + let x_115 : i32 = i_3; + data[x_115] = -1; + } + case 4: { + let x_113 : i32 = i_3; + data[x_113] = 0; + } + case 3: { + let x_111 : i32 = i_3; + data[x_111] = 1; + } + case 2: { + let x_109 : i32 = i_3; + data[x_109] = 2; + } + case 1: { + let x_107 : i32 = i_3; + data[x_107] = 3; + } + case 0: { + let x_105 : i32 = i_3; + data[x_105] = 4; + } + default: { + } + } + let x_125 : i32 = i_3; + i_3 = (x_125 + 1); + + continuing { + let x_127 : i32 = i_3; + if ((x_127 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_133 : i32 = j_1; + if ((x_133 < 10)) { + } else { + break; + } + let x_136 : i32 = j_1; + let x_137 : i32 = j_1; + let x_139 : i32 = data[x_137]; + temp[x_136] = x_139; + + continuing { + let x_141 : i32 = j_1; + j_1 = (x_141 + 1); + } + } + mergeSort_(); + let x_145 : f32 = gl_FragCoord.y; + if ((i32(x_145) < 30)) { + let x_152 : i32 = data[0]; + grey = (0.5 + (f32(x_152) / 10.0)); + } else { + let x_157 : f32 = gl_FragCoord.y; + if ((i32(x_157) < 60)) { + let x_164 : i32 = data[1]; + grey = (0.5 + (f32(x_164) / 10.0)); + } else { + let x_169 : f32 = gl_FragCoord.y; + if ((i32(x_169) < 90)) { + let x_176 : i32 = data[2]; + grey = (0.5 + (f32(x_176) / 10.0)); + } else { + let x_181 : f32 = gl_FragCoord.y; + if ((i32(x_181) < 120)) { + let x_188 : i32 = data[3]; + grey = (0.5 + (f32(x_188) / 10.0)); + } else { + let x_193 : f32 = gl_FragCoord.y; + if ((i32(x_193) < 150)) { + discard; + } else { + let x_200 : f32 = gl_FragCoord.y; + if ((i32(x_200) < 180)) { + let x_207 : i32 = data[5]; + grey = (0.5 + (f32(x_207) / 10.0)); + } else { + let x_212 : f32 = gl_FragCoord.y; + if ((i32(x_212) < 210)) { + let x_219 : i32 = data[6]; + grey = (0.5 + (f32(x_219) / 10.0)); + } else { + let x_224 : f32 = gl_FragCoord.y; + if ((i32(x_224) < 240)) { + let x_231 : i32 = data[7]; + grey = (0.5 + (f32(x_231) / 10.0)); + } else { + let x_236 : f32 = gl_FragCoord.y; + if ((i32(x_236) < 270)) { + let x_243 : i32 = data[8]; + grey = (0.5 + (f32(x_243) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_247 : f32 = grey; + let x_248 : vec3 = vec3(x_247, x_247, x_247); + x_GLF_color = vec4(x_248.x, x_248.y, x_248.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl new file mode 100644 index 0000000000..e61feb541e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl @@ -0,0 +1,313 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_32 : buf1; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_254 : i32 = *(from); + k = x_254; + let x_255 : i32 = *(from); + i = x_255; + let x_256 : i32 = *(mid); + j = (x_256 + 1); + loop { + let x_262 : i32 = i; + let x_263 : i32 = *(mid); + let x_265 : i32 = j; + let x_266 : i32 = *(to); + if (((x_262 <= x_263) && (x_265 <= x_266))) { + } else { + break; + } + let x_270 : i32 = i; + let x_272 : i32 = data[x_270]; + let x_273 : i32 = j; + let x_275 : i32 = data[x_273]; + if ((x_272 < x_275)) { + let x_280 : i32 = k; + k = (x_280 + 1); + let x_282 : i32 = i; + i = (x_282 + 1); + let x_285 : i32 = data[x_282]; + temp[x_280] = x_285; + } else { + let x_287 : i32 = k; + k = (x_287 + 1); + let x_289 : i32 = j; + j = (x_289 + 1); + let x_292 : i32 = data[x_289]; + temp[x_287] = x_292; + } + } + loop { + let x_298 : i32 = i; + let x_300 : i32 = i; + let x_301 : i32 = *(mid); + if (((x_298 < 10) && (x_300 <= x_301))) { + } else { + break; + } + let x_305 : i32 = k; + k = (x_305 + 1); + let x_307 : i32 = i; + i = (x_307 + 1); + let x_310 : i32 = data[x_307]; + temp[x_305] = x_310; + } + let x_312 : i32 = *(from); + i_1 = x_312; + loop { + let x_317 : i32 = i_1; + let x_318 : i32 = *(to); + if ((x_317 <= x_318)) { + } else { + break; + } + let x_321 : i32 = i_1; + let x_322 : i32 = i_1; + let x_324 : i32 = temp[x_322]; + data[x_321] = x_324; + + continuing { + let x_326 : i32 = i_1; + i_1 = (x_326 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_333 : i32 = m; + let x_334 : i32 = high; + if ((x_333 <= x_334)) { + } else { + break; + } + let x_337 : i32 = low; + i_2 = x_337; + loop { + let x_342 : i32 = i_2; + let x_343 : i32 = high; + if ((x_342 < x_343)) { + } else { + break; + } + let x_346 : i32 = i_2; + from_1 = x_346; + let x_347 : i32 = i_2; + let x_348 : i32 = m; + mid_1 = ((x_347 + x_348) - 1); + let x_351 : i32 = i_2; + let x_352 : i32 = m; + let x_356 : i32 = high; + to_1 = min(((x_351 + (2 * x_352)) - 1), x_356); + let x_358 : i32 = from_1; + param = x_358; + let x_359 : i32 = mid_1; + param_1 = x_359; + let x_360 : i32 = to_1; + param_2 = x_360; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_362 : i32 = m; + let x_364 : i32 = i_2; + i_2 = (x_364 + (2 * x_362)); + } + } + + continuing { + let x_366 : i32 = m; + m = (2 * x_366); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_87 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_87); + loop { + let x_93 : i32 = i_3; + switch(x_93) { + case 9: { + let x_123 : i32 = i_3; + data[x_123] = -5; + } + case 8: { + let x_121 : i32 = i_3; + data[x_121] = -4; + } + case 7: { + let x_119 : i32 = i_3; + data[x_119] = -3; + } + case 6: { + let x_117 : i32 = i_3; + data[x_117] = -2; + } + case 5: { + let x_115 : i32 = i_3; + data[x_115] = -1; + } + case 4: { + let x_113 : i32 = i_3; + data[x_113] = 0; + } + case 3: { + let x_111 : i32 = i_3; + data[x_111] = 1; + } + case 2: { + let x_109 : i32 = i_3; + data[x_109] = 2; + } + case 1: { + let x_107 : i32 = i_3; + data[x_107] = 3; + } + case 0: { + let x_105 : i32 = i_3; + data[x_105] = 4; + } + default: { + } + } + let x_125 : i32 = i_3; + i_3 = (x_125 + 1); + + continuing { + let x_127 : i32 = i_3; + if ((x_127 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_133 : i32 = j_1; + if ((x_133 < 10)) { + } else { + break; + } + let x_136 : i32 = j_1; + let x_137 : i32 = j_1; + let x_139 : i32 = data[x_137]; + temp[x_136] = x_139; + + continuing { + let x_141 : i32 = j_1; + j_1 = (x_141 + 1); + } + } + mergeSort_(); + let x_145 : f32 = gl_FragCoord.y; + if ((i32(x_145) < 30)) { + let x_152 : i32 = data[0]; + grey = (0.5 + (f32(x_152) / 10.0)); + } else { + let x_157 : f32 = gl_FragCoord.y; + if ((i32(x_157) < 60)) { + let x_164 : i32 = data[1]; + grey = (0.5 + (f32(x_164) / 10.0)); + } else { + let x_169 : f32 = gl_FragCoord.y; + if ((i32(x_169) < 90)) { + let x_176 : i32 = data[2]; + grey = (0.5 + (f32(x_176) / 10.0)); + } else { + let x_181 : f32 = gl_FragCoord.y; + if ((i32(x_181) < 120)) { + let x_188 : i32 = data[3]; + grey = (0.5 + (f32(x_188) / 10.0)); + } else { + let x_193 : f32 = gl_FragCoord.y; + if ((i32(x_193) < 150)) { + discard; + } else { + let x_200 : f32 = gl_FragCoord.y; + if ((i32(x_200) < 180)) { + let x_207 : i32 = data[5]; + grey = (0.5 + (f32(x_207) / 10.0)); + } else { + let x_212 : f32 = gl_FragCoord.y; + if ((i32(x_212) < 210)) { + let x_219 : i32 = data[6]; + grey = (0.5 + (f32(x_219) / 10.0)); + } else { + let x_224 : f32 = gl_FragCoord.y; + if ((i32(x_224) < 240)) { + let x_231 : i32 = data[7]; + grey = (0.5 + (f32(x_231) / 10.0)); + } else { + let x_236 : f32 = gl_FragCoord.y; + if ((i32(x_236) < 270)) { + let x_243 : i32 = data[8]; + grey = (0.5 + (f32(x_243) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_247 : f32 = grey; + let x_248 : vec3 = vec3(x_247, x_247, x_247); + x_GLF_color = vec4(x_248.x, x_248.y, x_248.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..be184c8dcf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.hlsl @@ -0,0 +1,271 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_32 : register(b1, space0) { + uint4 x_32[1]; +}; + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_254 = from; + k = x_254; + const int x_255 = from; + i = x_255; + const int x_256 = mid; + j = (x_256 + 1); + while (true) { + const int x_262 = i; + const int x_263 = mid; + const int x_265 = j; + const int x_266 = to; + bool tint_tmp = (x_262 <= x_263); + if (tint_tmp) { + tint_tmp = (x_265 <= x_266); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_272 = data[i]; + const int x_275 = data[j]; + if ((x_272 < x_275)) { + const int x_280 = k; + k = (x_280 + 1); + const int x_282 = i; + i = (x_282 + 1); + const int x_285 = data[x_282]; + temp[x_280] = x_285; + } else { + const int x_287 = k; + k = (x_287 + 1); + const int x_289 = j; + j = (x_289 + 1); + const int x_292 = data[x_289]; + temp[x_287] = x_292; + } + } + while (true) { + const int x_298 = i; + const int x_300 = i; + const int x_301 = mid; + bool tint_tmp_1 = (x_298 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_300 <= x_301); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_305 = k; + k = (x_305 + 1); + const int x_307 = i; + i = (x_307 + 1); + const int x_310 = data[x_307]; + temp[x_305] = x_310; + } + const int x_312 = from; + i_1 = x_312; + while (true) { + const int x_317 = i_1; + const int x_318 = to; + if ((x_317 <= x_318)) { + } else { + break; + } + const int x_321 = i_1; + const int x_324 = temp[i_1]; + data[x_321] = x_324; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_87 = asfloat(x_28[0].x); + i_3 = int(x_87); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_136 = j_1; + const int x_139 = data[j_1]; + temp[x_136] = x_139; + } + } + mergeSort_(); + const float x_145 = gl_FragCoord.y; + if ((int(x_145) < 30)) { + const int x_152 = data[0]; + grey = (0.5f + (float(x_152) / 10.0f)); + } else { + const float x_157 = gl_FragCoord.y; + if ((int(x_157) < 60)) { + const int x_164 = data[1]; + grey = (0.5f + (float(x_164) / 10.0f)); + } else { + const float x_169 = gl_FragCoord.y; + if ((int(x_169) < 90)) { + const int x_176 = data[2]; + grey = (0.5f + (float(x_176) / 10.0f)); + } else { + const float x_181 = gl_FragCoord.y; + if ((int(x_181) < 120)) { + const int x_188 = data[3]; + grey = (0.5f + (float(x_188) / 10.0f)); + } else { + const float x_193 = gl_FragCoord.y; + if ((int(x_193) < 150)) { + discard; + } else { + const float x_200 = gl_FragCoord.y; + if ((int(x_200) < 180)) { + const int x_207 = data[5]; + grey = (0.5f + (float(x_207) / 10.0f)); + } else { + const float x_212 = gl_FragCoord.y; + if ((int(x_212) < 210)) { + const int x_219 = data[6]; + grey = (0.5f + (float(x_219) / 10.0f)); + } else { + const float x_224 = gl_FragCoord.y; + if ((int(x_224) < 240)) { + const int x_231 = data[7]; + grey = (0.5f + (float(x_231) / 10.0f)); + } else { + const float x_236 = gl_FragCoord.y; + if ((int(x_236) < 270)) { + const int x_243 = data[8]; + grey = (0.5f + (float(x_243) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_247 = grey; + const float3 x_248 = float3(x_247, x_247, x_247); + x_GLF_color = float4(x_248.x, x_248.y, x_248.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..6e7adb415a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.msl @@ -0,0 +1,317 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_254 = *(from); + k = x_254; + int const x_255 = *(from); + i = x_255; + int const x_256 = *(mid); + j = (x_256 + 1); + while (true) { + int const x_262 = i; + int const x_263 = *(mid); + int const x_265 = j; + int const x_266 = *(to); + if (((x_262 <= x_263) && (x_265 <= x_266))) { + } else { + break; + } + int const x_270 = i; + int const x_272 = (*(tint_symbol_5)).arr[x_270]; + int const x_273 = j; + int const x_275 = (*(tint_symbol_5)).arr[x_273]; + if ((x_272 < x_275)) { + int const x_280 = k; + k = (x_280 + 1); + int const x_282 = i; + i = (x_282 + 1); + int const x_285 = (*(tint_symbol_5)).arr[x_282]; + (*(tint_symbol_6)).arr[x_280] = x_285; + } else { + int const x_287 = k; + k = (x_287 + 1); + int const x_289 = j; + j = (x_289 + 1); + int const x_292 = (*(tint_symbol_5)).arr[x_289]; + (*(tint_symbol_6)).arr[x_287] = x_292; + } + } + while (true) { + int const x_298 = i; + int const x_300 = i; + int const x_301 = *(mid); + if (((x_298 < 10) && (x_300 <= x_301))) { + } else { + break; + } + int const x_305 = k; + k = (x_305 + 1); + int const x_307 = i; + i = (x_307 + 1); + int const x_310 = (*(tint_symbol_5)).arr[x_307]; + (*(tint_symbol_6)).arr[x_305] = x_310; + } + int const x_312 = *(from); + i_1 = x_312; + while (true) { + int const x_317 = i_1; + int const x_318 = *(to); + if ((x_317 <= x_318)) { + } else { + break; + } + int const x_321 = i_1; + int const x_322 = i_1; + int const x_324 = (*(tint_symbol_6)).arr[x_322]; + (*(tint_symbol_5)).arr[x_321] = x_324; + { + int const x_326 = i_1; + i_1 = (x_326 + 1); + } + } + return; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_333 = m; + int const x_334 = high; + if ((x_333 <= x_334)) { + } else { + break; + } + int const x_337 = low; + i_2 = x_337; + while (true) { + int const x_342 = i_2; + int const x_343 = high; + if ((x_342 < x_343)) { + } else { + break; + } + int const x_346 = i_2; + from_1 = x_346; + int const x_347 = i_2; + int const x_348 = m; + mid_1 = ((x_347 + x_348) - 1); + int const x_351 = i_2; + int const x_352 = m; + int const x_356 = high; + to_1 = min(((x_351 + (2 * x_352)) - 1), x_356); + int const x_358 = from_1; + param = x_358; + int const x_359 = mid_1; + param_1 = x_359; + int const x_360 = to_1; + param_2 = x_360; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_362 = m; + int const x_364 = i_2; + i_2 = (x_364 + (2 * x_362)); + } + } + { + int const x_366 = m; + m = (2 * x_366); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_87 = x_28.injectionSwitch.x; + i_3 = int(x_87); + while (true) { + int const x_93 = i_3; + switch(x_93) { + case 9: { + int const x_123 = i_3; + (*(tint_symbol_9)).arr[x_123] = -5; + break; + } + case 8: { + int const x_121 = i_3; + (*(tint_symbol_9)).arr[x_121] = -4; + break; + } + case 7: { + int const x_119 = i_3; + (*(tint_symbol_9)).arr[x_119] = -3; + break; + } + case 6: { + int const x_117 = i_3; + (*(tint_symbol_9)).arr[x_117] = -2; + break; + } + case 5: { + int const x_115 = i_3; + (*(tint_symbol_9)).arr[x_115] = -1; + break; + } + case 4: { + int const x_113 = i_3; + (*(tint_symbol_9)).arr[x_113] = 0; + break; + } + case 3: { + int const x_111 = i_3; + (*(tint_symbol_9)).arr[x_111] = 1; + break; + } + case 2: { + int const x_109 = i_3; + (*(tint_symbol_9)).arr[x_109] = 2; + break; + } + case 1: { + int const x_107 = i_3; + (*(tint_symbol_9)).arr[x_107] = 3; + break; + } + case 0: { + int const x_105 = i_3; + (*(tint_symbol_9)).arr[x_105] = 4; + break; + } + default: { + break; + } + } + int const x_125 = i_3; + i_3 = (x_125 + 1); + { + int const x_127 = i_3; + if ((x_127 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_133 = j_1; + if ((x_133 < 10)) { + } else { + break; + } + int const x_136 = j_1; + int const x_137 = j_1; + int const x_139 = (*(tint_symbol_9)).arr[x_137]; + (*(tint_symbol_10)).arr[x_136] = x_139; + { + int const x_141 = j_1; + j_1 = (x_141 + 1); + } + } + mergeSort_(tint_symbol_9, tint_symbol_10); + float const x_145 = (*(tint_symbol_11)).y; + if ((int(x_145) < 30)) { + int const x_152 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_152) / 10.0f)); + } else { + float const x_157 = (*(tint_symbol_11)).y; + if ((int(x_157) < 60)) { + int const x_164 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_164) / 10.0f)); + } else { + float const x_169 = (*(tint_symbol_11)).y; + if ((int(x_169) < 90)) { + int const x_176 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_176) / 10.0f)); + } else { + float const x_181 = (*(tint_symbol_11)).y; + if ((int(x_181) < 120)) { + int const x_188 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_188) / 10.0f)); + } else { + float const x_193 = (*(tint_symbol_11)).y; + if ((int(x_193) < 150)) { + discard_fragment(); + } else { + float const x_200 = (*(tint_symbol_11)).y; + if ((int(x_200) < 180)) { + int const x_207 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_207) / 10.0f)); + } else { + float const x_212 = (*(tint_symbol_11)).y; + if ((int(x_212) < 210)) { + int const x_219 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_219) / 10.0f)); + } else { + float const x_224 = (*(tint_symbol_11)).y; + if ((int(x_224) < 240)) { + int const x_231 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_231) / 10.0f)); + } else { + float const x_236 = (*(tint_symbol_11)).y; + if ((int(x_236) < 270)) { + int const x_243 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_243) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_247 = grey; + float3 const x_248 = float3(x_247, x_247, x_247); + *(tint_symbol_12) = float4(x_248.x, x_248.y, x_248.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..9042981b0c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.spvasm @@ -0,0 +1,660 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 419 +; Schema: 0 + OpCapability Shader + %180 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_32 "x_32" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_32 NonWritable + OpDecorate %x_32 DescriptorSet 0 + OpDecorate %x_32 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_32 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %35 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %135 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %204 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %406 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %26 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %33 = OpLabel + %k = OpVariable %_ptr_Function_int Function %35 + %i = OpVariable %_ptr_Function_int Function %35 + %j = OpVariable %_ptr_Function_int Function %35 + %i_1 = OpVariable %_ptr_Function_int Function %35 + %40 = OpLoad %int %from + OpStore %k %40 + %42 = OpLoad %int %from + OpStore %i %42 + %44 = OpLoad %int %mid + %46 = OpIAdd %int %44 %int_1 + OpStore %j %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i + %53 = OpLoad %int %mid + %54 = OpLoad %int %j + %56 = OpLoad %int %to + %57 = OpSLessThanEqual %bool %51 %53 + OpSelectionMerge %59 None + OpBranchConditional %57 %60 %59 + %60 = OpLabel + %61 = OpSLessThanEqual %bool %54 %56 + OpBranch %59 + %59 = OpLabel + %62 = OpPhi %bool %57 %50 %61 %60 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %48 + %63 = OpLabel + %66 = OpLoad %int %i + %68 = OpAccessChain %_ptr_Private_int %data %66 + %69 = OpLoad %int %68 + %70 = OpLoad %int %j + %71 = OpAccessChain %_ptr_Private_int %data %70 + %72 = OpLoad %int %71 + %73 = OpSLessThan %bool %69 %72 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %77 = OpLoad %int %k + %78 = OpIAdd %int %77 %int_1 + OpStore %k %78 + %79 = OpLoad %int %i + %80 = OpIAdd %int %79 %int_1 + OpStore %i %80 + %81 = OpAccessChain %_ptr_Private_int %data %79 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Private_int %temp %77 + OpStore %83 %82 + OpBranch %74 + %76 = OpLabel + %84 = OpLoad %int %k + %85 = OpIAdd %int %84 %int_1 + OpStore %k %85 + %86 = OpLoad %int %j + %87 = OpIAdd %int %86 %int_1 + OpStore %j %87 + %88 = OpAccessChain %_ptr_Private_int %data %86 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Private_int %temp %84 + OpStore %90 %89 + OpBranch %74 + %74 = OpLabel + OpBranch %49 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %i + %96 = OpLoad %int %i + %98 = OpLoad %int %mid + %100 = OpSLessThan %bool %95 %int_10 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpSLessThanEqual %bool %96 %98 + OpBranch %101 + %101 = OpLabel + %104 = OpPhi %bool %100 %94 %103 %102 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %107 + %106 = OpLabel + OpBranch %105 + %107 = OpLabel + OpBranch %92 + %105 = OpLabel + %108 = OpLoad %int %k + %109 = OpIAdd %int %108 %int_1 + OpStore %k %109 + %110 = OpLoad %int %i + %111 = OpIAdd %int %110 %int_1 + OpStore %i %111 + %112 = OpAccessChain %_ptr_Private_int %data %110 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Private_int %temp %108 + OpStore %114 %113 + OpBranch %93 + %93 = OpLabel + OpBranch %91 + %92 = OpLabel + %116 = OpLoad %int %from + OpStore %i_1 %116 + OpBranch %117 + %117 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %121 = OpLoad %int %i_1 + %123 = OpLoad %int %to + %124 = OpSLessThanEqual %bool %121 %123 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %127 + %126 = OpLabel + OpBranch %125 + %127 = OpLabel + OpBranch %118 + %125 = OpLabel + %128 = OpLoad %int %i_1 + %129 = OpLoad %int %i_1 + %130 = OpAccessChain %_ptr_Private_int %temp %129 + %131 = OpLoad %int %130 + %132 = OpAccessChain %_ptr_Private_int %data %128 + OpStore %132 %131 + OpBranch %119 + %119 = OpLabel + %133 = OpLoad %int %i_1 + %134 = OpIAdd %int %133 %int_1 + OpStore %i_1 %134 + OpBranch %117 + %118 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %135 + %137 = OpLabel + %low = OpVariable %_ptr_Function_int Function %35 + %high = OpVariable %_ptr_Function_int Function %35 + %m = OpVariable %_ptr_Function_int Function %35 + %i_2 = OpVariable %_ptr_Function_int Function %35 + %from_1 = OpVariable %_ptr_Function_int Function %35 + %mid_1 = OpVariable %_ptr_Function_int Function %35 + %to_1 = OpVariable %_ptr_Function_int Function %35 + %param = OpVariable %_ptr_Function_int Function %35 + %param_1 = OpVariable %_ptr_Function_int Function %35 + %param_2 = OpVariable %_ptr_Function_int Function %35 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %154 = OpLoad %int %m + %155 = OpLoad %int %high + %156 = OpSLessThanEqual %bool %154 %155 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %159 + %158 = OpLabel + OpBranch %157 + %159 = OpLabel + OpBranch %151 + %157 = OpLabel + %160 = OpLoad %int %low + OpStore %i_2 %160 + OpBranch %161 + %161 = OpLabel + OpLoopMerge %162 %163 None + OpBranch %164 + %164 = OpLabel + %165 = OpLoad %int %i_2 + %166 = OpLoad %int %high + %167 = OpSLessThan %bool %165 %166 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %162 + %168 = OpLabel + %171 = OpLoad %int %i_2 + OpStore %from_1 %171 + %172 = OpLoad %int %i_2 + %173 = OpLoad %int %m + %174 = OpIAdd %int %172 %173 + %175 = OpISub %int %174 %int_1 + OpStore %mid_1 %175 + %176 = OpLoad %int %i_2 + %177 = OpLoad %int %m + %178 = OpLoad %int %high + %182 = OpIMul %int %int_2 %177 + %183 = OpIAdd %int %176 %182 + %184 = OpISub %int %183 %int_1 + %179 = OpExtInst %int %180 SMin %184 %178 + OpStore %to_1 %179 + %185 = OpLoad %int %from_1 + OpStore %param %185 + %186 = OpLoad %int %mid_1 + OpStore %param_1 %186 + %187 = OpLoad %int %to_1 + OpStore %param_2 %187 + %188 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %163 + %163 = OpLabel + %192 = OpLoad %int %m + %193 = OpLoad %int %i_2 + %194 = OpIMul %int %int_2 %192 + %195 = OpIAdd %int %193 %194 + OpStore %i_2 %195 + OpBranch %161 + %162 = OpLabel + OpBranch %152 + %152 = OpLabel + %196 = OpLoad %int %m + %197 = OpIMul %int %int_2 %196 + OpStore %m %197 + OpBranch %150 + %151 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %135 + %199 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %35 + %j_1 = OpVariable %_ptr_Function_int Function %35 + %grey = OpVariable %_ptr_Function_float Function %204 + %207 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %208 = OpLoad %float %207 + %209 = OpConvertFToS %int %208 + OpStore %i_3 %209 + OpBranch %210 + %210 = OpLabel + OpLoopMerge %211 %212 None + OpBranch %213 + %213 = OpLabel + %214 = OpLoad %int %i_3 + OpSelectionMerge %215 None + OpSwitch %214 %216 9 %217 8 %218 7 %219 6 %220 5 %221 4 %222 3 %223 2 %224 1 %225 0 %226 + %217 = OpLabel + %227 = OpLoad %int %i_3 + %228 = OpAccessChain %_ptr_Private_int %data %227 + OpStore %228 %int_n5 + OpBranch %215 + %218 = OpLabel + %230 = OpLoad %int %i_3 + %231 = OpAccessChain %_ptr_Private_int %data %230 + OpStore %231 %int_n4 + OpBranch %215 + %219 = OpLabel + %233 = OpLoad %int %i_3 + %234 = OpAccessChain %_ptr_Private_int %data %233 + OpStore %234 %int_n3 + OpBranch %215 + %220 = OpLabel + %236 = OpLoad %int %i_3 + %237 = OpAccessChain %_ptr_Private_int %data %236 + OpStore %237 %int_n2 + OpBranch %215 + %221 = OpLabel + %239 = OpLoad %int %i_3 + %240 = OpAccessChain %_ptr_Private_int %data %239 + OpStore %240 %int_n1 + OpBranch %215 + %222 = OpLabel + %242 = OpLoad %int %i_3 + %243 = OpAccessChain %_ptr_Private_int %data %242 + OpStore %243 %int_0 + OpBranch %215 + %223 = OpLabel + %244 = OpLoad %int %i_3 + %245 = OpAccessChain %_ptr_Private_int %data %244 + OpStore %245 %int_1 + OpBranch %215 + %224 = OpLabel + %246 = OpLoad %int %i_3 + %247 = OpAccessChain %_ptr_Private_int %data %246 + OpStore %247 %int_2 + OpBranch %215 + %225 = OpLabel + %248 = OpLoad %int %i_3 + %249 = OpAccessChain %_ptr_Private_int %data %248 + OpStore %249 %int_3 + OpBranch %215 + %226 = OpLabel + %251 = OpLoad %int %i_3 + %252 = OpAccessChain %_ptr_Private_int %data %251 + OpStore %252 %int_4 + OpBranch %215 + %216 = OpLabel + OpBranch %215 + %215 = OpLabel + %254 = OpLoad %int %i_3 + %255 = OpIAdd %int %254 %int_1 + OpStore %i_3 %255 + OpBranch %212 + %212 = OpLabel + %256 = OpLoad %int %i_3 + %257 = OpSLessThan %bool %256 %int_10 + OpSelectionMerge %258 None + OpBranchConditional %257 %259 %260 + %259 = OpLabel + OpBranch %258 + %260 = OpLabel + OpBranch %211 + %258 = OpLabel + OpBranch %210 + %211 = OpLabel + OpStore %j_1 %int_0 + OpBranch %261 + %261 = OpLabel + OpLoopMerge %262 %263 None + OpBranch %264 + %264 = OpLabel + %265 = OpLoad %int %j_1 + %266 = OpSLessThan %bool %265 %int_10 + OpSelectionMerge %267 None + OpBranchConditional %266 %268 %269 + %268 = OpLabel + OpBranch %267 + %269 = OpLabel + OpBranch %262 + %267 = OpLabel + %270 = OpLoad %int %j_1 + %271 = OpLoad %int %j_1 + %272 = OpAccessChain %_ptr_Private_int %data %271 + %273 = OpLoad %int %272 + %274 = OpAccessChain %_ptr_Private_int %temp %270 + OpStore %274 %273 + OpBranch %263 + %263 = OpLabel + %275 = OpLoad %int %j_1 + %276 = OpIAdd %int %275 %int_1 + OpStore %j_1 %276 + OpBranch %261 + %262 = OpLabel + %277 = OpFunctionCall %void %mergeSort_ + %280 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %281 = OpLoad %float %280 + %282 = OpConvertFToS %int %281 + %284 = OpSLessThan %bool %282 %int_30 + OpSelectionMerge %285 None + OpBranchConditional %284 %286 %287 + %286 = OpLabel + %288 = OpAccessChain %_ptr_Private_int %data %int_0 + %289 = OpLoad %int %288 + %291 = OpConvertSToF %float %289 + %293 = OpFDiv %float %291 %float_10 + %294 = OpFAdd %float %float_0_5 %293 + OpStore %grey %294 + OpBranch %285 + %287 = OpLabel + %295 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %296 = OpLoad %float %295 + %297 = OpConvertFToS %int %296 + %299 = OpSLessThan %bool %297 %int_60 + OpSelectionMerge %300 None + OpBranchConditional %299 %301 %302 + %301 = OpLabel + %303 = OpAccessChain %_ptr_Private_int %data %int_1 + %304 = OpLoad %int %303 + %305 = OpConvertSToF %float %304 + %306 = OpFDiv %float %305 %float_10 + %307 = OpFAdd %float %float_0_5 %306 + OpStore %grey %307 + OpBranch %300 + %302 = OpLabel + %308 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %309 = OpLoad %float %308 + %310 = OpConvertFToS %int %309 + %312 = OpSLessThan %bool %310 %int_90 + OpSelectionMerge %313 None + OpBranchConditional %312 %314 %315 + %314 = OpLabel + %316 = OpAccessChain %_ptr_Private_int %data %int_2 + %317 = OpLoad %int %316 + %318 = OpConvertSToF %float %317 + %319 = OpFDiv %float %318 %float_10 + %320 = OpFAdd %float %float_0_5 %319 + OpStore %grey %320 + OpBranch %313 + %315 = OpLabel + %321 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %322 = OpLoad %float %321 + %323 = OpConvertFToS %int %322 + %325 = OpSLessThan %bool %323 %int_120 + OpSelectionMerge %326 None + OpBranchConditional %325 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %_ptr_Private_int %data %int_3 + %330 = OpLoad %int %329 + %331 = OpConvertSToF %float %330 + %332 = OpFDiv %float %331 %float_10 + %333 = OpFAdd %float %float_0_5 %332 + OpStore %grey %333 + OpBranch %326 + %328 = OpLabel + %334 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %335 = OpLoad %float %334 + %336 = OpConvertFToS %int %335 + %338 = OpSLessThan %bool %336 %int_150 + OpSelectionMerge %339 None + OpBranchConditional %338 %340 %341 + %340 = OpLabel + OpKill + %341 = OpLabel + %342 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %343 = OpLoad %float %342 + %344 = OpConvertFToS %int %343 + %346 = OpSLessThan %bool %344 %int_180 + OpSelectionMerge %347 None + OpBranchConditional %346 %348 %349 + %348 = OpLabel + %351 = OpAccessChain %_ptr_Private_int %data %int_5 + %352 = OpLoad %int %351 + %353 = OpConvertSToF %float %352 + %354 = OpFDiv %float %353 %float_10 + %355 = OpFAdd %float %float_0_5 %354 + OpStore %grey %355 + OpBranch %347 + %349 = OpLabel + %356 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %357 = OpLoad %float %356 + %358 = OpConvertFToS %int %357 + %360 = OpSLessThan %bool %358 %int_210 + OpSelectionMerge %361 None + OpBranchConditional %360 %362 %363 + %362 = OpLabel + %365 = OpAccessChain %_ptr_Private_int %data %int_6 + %366 = OpLoad %int %365 + %367 = OpConvertSToF %float %366 + %368 = OpFDiv %float %367 %float_10 + %369 = OpFAdd %float %float_0_5 %368 + OpStore %grey %369 + OpBranch %361 + %363 = OpLabel + %370 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %371 = OpLoad %float %370 + %372 = OpConvertFToS %int %371 + %374 = OpSLessThan %bool %372 %int_240 + OpSelectionMerge %375 None + OpBranchConditional %374 %376 %377 + %376 = OpLabel + %379 = OpAccessChain %_ptr_Private_int %data %int_7 + %380 = OpLoad %int %379 + %381 = OpConvertSToF %float %380 + %382 = OpFDiv %float %381 %float_10 + %383 = OpFAdd %float %float_0_5 %382 + OpStore %grey %383 + OpBranch %375 + %377 = OpLabel + %384 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %385 = OpLoad %float %384 + %386 = OpConvertFToS %int %385 + %388 = OpSLessThan %bool %386 %int_270 + OpSelectionMerge %389 None + OpBranchConditional %388 %390 %391 + %390 = OpLabel + %393 = OpAccessChain %_ptr_Private_int %data %int_8 + %394 = OpLoad %int %393 + %395 = OpConvertSToF %float %394 + %396 = OpFDiv %float %395 %float_10 + %397 = OpFAdd %float %float_0_5 %396 + OpStore %grey %397 + OpBranch %389 + %391 = OpLabel + OpKill + %389 = OpLabel + OpBranch %375 + %375 = OpLabel + OpBranch %361 + %361 = OpLabel + OpBranch %347 + %347 = OpLabel + OpBranch %339 + %339 = OpLabel + OpBranch %326 + %326 = OpLabel + OpBranch %313 + %313 = OpLabel + OpBranch %300 + %300 = OpLabel + OpBranch %285 + %285 = OpLabel + %398 = OpLoad %float %grey + %400 = OpCompositeConstruct %v3float %398 %398 %398 + %401 = OpCompositeExtract %float %400 0 + %402 = OpCompositeExtract %float %400 1 + %403 = OpCompositeExtract %float %400 2 + %405 = OpCompositeConstruct %v4float %401 %402 %403 %float_1 + OpStore %x_GLF_color %405 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %406 +%tint_symbol_1 = OpFunctionParameter %main_out + %410 = OpLabel + %411 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %411 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %135 + %413 = OpLabel + %414 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %414 + %415 = OpFunctionCall %void %main_1 + %417 = OpLoad %v4float %x_GLF_color + %418 = OpCompositeConstruct %main_out %417 + %416 = OpFunctionCall %void %tint_symbol_3 %418 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 212[%212] is not post dominated by the back-edge block 258[%258] + %258 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..e61feb541e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/0-opt.wgsl.expected.wgsl @@ -0,0 +1,313 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_32 : buf1; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_254 : i32 = *(from); + k = x_254; + let x_255 : i32 = *(from); + i = x_255; + let x_256 : i32 = *(mid); + j = (x_256 + 1); + loop { + let x_262 : i32 = i; + let x_263 : i32 = *(mid); + let x_265 : i32 = j; + let x_266 : i32 = *(to); + if (((x_262 <= x_263) && (x_265 <= x_266))) { + } else { + break; + } + let x_270 : i32 = i; + let x_272 : i32 = data[x_270]; + let x_273 : i32 = j; + let x_275 : i32 = data[x_273]; + if ((x_272 < x_275)) { + let x_280 : i32 = k; + k = (x_280 + 1); + let x_282 : i32 = i; + i = (x_282 + 1); + let x_285 : i32 = data[x_282]; + temp[x_280] = x_285; + } else { + let x_287 : i32 = k; + k = (x_287 + 1); + let x_289 : i32 = j; + j = (x_289 + 1); + let x_292 : i32 = data[x_289]; + temp[x_287] = x_292; + } + } + loop { + let x_298 : i32 = i; + let x_300 : i32 = i; + let x_301 : i32 = *(mid); + if (((x_298 < 10) && (x_300 <= x_301))) { + } else { + break; + } + let x_305 : i32 = k; + k = (x_305 + 1); + let x_307 : i32 = i; + i = (x_307 + 1); + let x_310 : i32 = data[x_307]; + temp[x_305] = x_310; + } + let x_312 : i32 = *(from); + i_1 = x_312; + loop { + let x_317 : i32 = i_1; + let x_318 : i32 = *(to); + if ((x_317 <= x_318)) { + } else { + break; + } + let x_321 : i32 = i_1; + let x_322 : i32 = i_1; + let x_324 : i32 = temp[x_322]; + data[x_321] = x_324; + + continuing { + let x_326 : i32 = i_1; + i_1 = (x_326 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_333 : i32 = m; + let x_334 : i32 = high; + if ((x_333 <= x_334)) { + } else { + break; + } + let x_337 : i32 = low; + i_2 = x_337; + loop { + let x_342 : i32 = i_2; + let x_343 : i32 = high; + if ((x_342 < x_343)) { + } else { + break; + } + let x_346 : i32 = i_2; + from_1 = x_346; + let x_347 : i32 = i_2; + let x_348 : i32 = m; + mid_1 = ((x_347 + x_348) - 1); + let x_351 : i32 = i_2; + let x_352 : i32 = m; + let x_356 : i32 = high; + to_1 = min(((x_351 + (2 * x_352)) - 1), x_356); + let x_358 : i32 = from_1; + param = x_358; + let x_359 : i32 = mid_1; + param_1 = x_359; + let x_360 : i32 = to_1; + param_2 = x_360; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_362 : i32 = m; + let x_364 : i32 = i_2; + i_2 = (x_364 + (2 * x_362)); + } + } + + continuing { + let x_366 : i32 = m; + m = (2 * x_366); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_87 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_87); + loop { + let x_93 : i32 = i_3; + switch(x_93) { + case 9: { + let x_123 : i32 = i_3; + data[x_123] = -5; + } + case 8: { + let x_121 : i32 = i_3; + data[x_121] = -4; + } + case 7: { + let x_119 : i32 = i_3; + data[x_119] = -3; + } + case 6: { + let x_117 : i32 = i_3; + data[x_117] = -2; + } + case 5: { + let x_115 : i32 = i_3; + data[x_115] = -1; + } + case 4: { + let x_113 : i32 = i_3; + data[x_113] = 0; + } + case 3: { + let x_111 : i32 = i_3; + data[x_111] = 1; + } + case 2: { + let x_109 : i32 = i_3; + data[x_109] = 2; + } + case 1: { + let x_107 : i32 = i_3; + data[x_107] = 3; + } + case 0: { + let x_105 : i32 = i_3; + data[x_105] = 4; + } + default: { + } + } + let x_125 : i32 = i_3; + i_3 = (x_125 + 1); + + continuing { + let x_127 : i32 = i_3; + if ((x_127 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_133 : i32 = j_1; + if ((x_133 < 10)) { + } else { + break; + } + let x_136 : i32 = j_1; + let x_137 : i32 = j_1; + let x_139 : i32 = data[x_137]; + temp[x_136] = x_139; + + continuing { + let x_141 : i32 = j_1; + j_1 = (x_141 + 1); + } + } + mergeSort_(); + let x_145 : f32 = gl_FragCoord.y; + if ((i32(x_145) < 30)) { + let x_152 : i32 = data[0]; + grey = (0.5 + (f32(x_152) / 10.0)); + } else { + let x_157 : f32 = gl_FragCoord.y; + if ((i32(x_157) < 60)) { + let x_164 : i32 = data[1]; + grey = (0.5 + (f32(x_164) / 10.0)); + } else { + let x_169 : f32 = gl_FragCoord.y; + if ((i32(x_169) < 90)) { + let x_176 : i32 = data[2]; + grey = (0.5 + (f32(x_176) / 10.0)); + } else { + let x_181 : f32 = gl_FragCoord.y; + if ((i32(x_181) < 120)) { + let x_188 : i32 = data[3]; + grey = (0.5 + (f32(x_188) / 10.0)); + } else { + let x_193 : f32 = gl_FragCoord.y; + if ((i32(x_193) < 150)) { + discard; + } else { + let x_200 : f32 = gl_FragCoord.y; + if ((i32(x_200) < 180)) { + let x_207 : i32 = data[5]; + grey = (0.5 + (f32(x_207) / 10.0)); + } else { + let x_212 : f32 = gl_FragCoord.y; + if ((i32(x_212) < 210)) { + let x_219 : i32 = data[6]; + grey = (0.5 + (f32(x_219) / 10.0)); + } else { + let x_224 : f32 = gl_FragCoord.y; + if ((i32(x_224) < 240)) { + let x_231 : i32 = data[7]; + grey = (0.5 + (f32(x_231) / 10.0)); + } else { + let x_236 : f32 = gl_FragCoord.y; + if ((i32(x_236) < 270)) { + let x_243 : i32 = data[8]; + grey = (0.5 + (f32(x_243) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_247 : f32 = grey; + let x_248 : vec3 = vec3(x_247, x_247, x_247); + x_GLF_color = vec4(x_248.x, x_248.y, x_248.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm new file mode 100644 index 0000000000..1746285973 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm @@ -0,0 +1,566 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %merge_i1_i1_i1_ "merge(i1;i1;i1;" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %mergeSort_ "mergeSort(" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %temp "temp" + OpName %i_0 "i" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_1 "i" + OpName %from_0 "from" + OpName %mid_0 "mid" + OpName %to_0 "to" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %i_2 "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %j_0 "j" + OpName %gl_FragCoord "gl_FragCoord" + OpName %grey "grey" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %__0 "" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %34 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %37 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private + %int_10 = OpConstant %int 10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int_30 = OpConstant %int 30 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %true = OpConstantTrue %bool + %main = OpFunction %void None %34 + %86 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %grey = OpVariable %_ptr_Function_float Function + %87 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %88 = OpLoad %float %87 + %89 = OpConvertFToS %int %88 + OpStore %i_2 %89 + OpBranch %90 + %90 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %int %i_2 + OpSelectionMerge %95 None + OpSwitch %94 %95 0 %96 1 %97 2 %98 3 %99 4 %100 5 %101 6 %102 7 %103 8 %104 9 %105 + %96 = OpLabel + %106 = OpLoad %int %i_2 + %107 = OpAccessChain %_ptr_Private_int %data %106 + OpStore %107 %int_4 + OpBranch %95 + %97 = OpLabel + %108 = OpLoad %int %i_2 + %109 = OpAccessChain %_ptr_Private_int %data %108 + OpStore %109 %int_3 + OpBranch %95 + %98 = OpLabel + %110 = OpLoad %int %i_2 + %111 = OpAccessChain %_ptr_Private_int %data %110 + OpStore %111 %int_2 + OpBranch %95 + %99 = OpLabel + %112 = OpLoad %int %i_2 + %113 = OpAccessChain %_ptr_Private_int %data %112 + OpStore %113 %int_1 + OpBranch %95 + %100 = OpLabel + %114 = OpLoad %int %i_2 + %115 = OpAccessChain %_ptr_Private_int %data %114 + OpStore %115 %int_0 + OpBranch %95 + %101 = OpLabel + %116 = OpLoad %int %i_2 + %117 = OpAccessChain %_ptr_Private_int %data %116 + OpStore %117 %int_n1 + OpBranch %95 + %102 = OpLabel + %118 = OpLoad %int %i_2 + %119 = OpAccessChain %_ptr_Private_int %data %118 + OpStore %119 %int_n2 + OpBranch %95 + %103 = OpLabel + %120 = OpLoad %int %i_2 + %121 = OpAccessChain %_ptr_Private_int %data %120 + OpStore %121 %int_n3 + OpBranch %95 + %104 = OpLabel + %122 = OpLoad %int %i_2 + %123 = OpAccessChain %_ptr_Private_int %data %122 + OpStore %123 %int_n4 + OpBranch %95 + %105 = OpLabel + %124 = OpLoad %int %i_2 + %125 = OpAccessChain %_ptr_Private_int %data %124 + OpStore %125 %int_n5 + OpBranchConditional %true %95 %92 + %95 = OpLabel + %126 = OpLoad %int %i_2 + %127 = OpIAdd %int %126 %int_1 + OpStore %i_2 %127 + OpBranchConditional %true %92 %92 + %92 = OpLabel + %128 = OpLoad %int %i_2 + %129 = OpSLessThan %bool %128 %int_10 + OpBranchConditional %129 %90 %91 + %91 = OpLabel + OpStore %j_0 %int_0 + OpBranch %130 + %130 = OpLabel + OpLoopMerge %131 %132 None + OpBranch %133 + %133 = OpLabel + %134 = OpLoad %int %j_0 + %135 = OpSLessThan %bool %134 %int_10 + OpBranchConditional %135 %136 %131 + %136 = OpLabel + %137 = OpLoad %int %j_0 + %138 = OpLoad %int %j_0 + %139 = OpAccessChain %_ptr_Private_int %data %138 + %140 = OpLoad %int %139 + %141 = OpAccessChain %_ptr_Private_int %temp %137 + OpStore %141 %140 + OpBranch %132 + %132 = OpLabel + %142 = OpLoad %int %j_0 + %143 = OpIAdd %int %142 %int_1 + OpStore %j_0 %143 + OpBranch %130 + %131 = OpLabel + %144 = OpFunctionCall %void %mergeSort_ + %145 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %146 = OpLoad %float %145 + %147 = OpConvertFToS %int %146 + %148 = OpSLessThan %bool %147 %int_30 + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %151 + %150 = OpLabel + %152 = OpAccessChain %_ptr_Private_int %data %int_0 + %153 = OpLoad %int %152 + %154 = OpConvertSToF %float %153 + %155 = OpFDiv %float %154 %float_10 + %156 = OpFAdd %float %float_0_5 %155 + OpStore %grey %156 + OpBranch %149 + %151 = OpLabel + %157 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %158 = OpLoad %float %157 + %159 = OpConvertFToS %int %158 + %160 = OpSLessThan %bool %159 %int_60 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + %164 = OpAccessChain %_ptr_Private_int %data %int_1 + %165 = OpLoad %int %164 + %166 = OpConvertSToF %float %165 + %167 = OpFDiv %float %166 %float_10 + %168 = OpFAdd %float %float_0_5 %167 + OpStore %grey %168 + OpBranch %161 + %163 = OpLabel + %169 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %170 = OpLoad %float %169 + %171 = OpConvertFToS %int %170 + %172 = OpSLessThan %bool %171 %int_90 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %175 + %174 = OpLabel + %176 = OpAccessChain %_ptr_Private_int %data %int_2 + %177 = OpLoad %int %176 + %178 = OpConvertSToF %float %177 + %179 = OpFDiv %float %178 %float_10 + %180 = OpFAdd %float %float_0_5 %179 + OpStore %grey %180 + OpBranch %173 + %175 = OpLabel + %181 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %182 = OpLoad %float %181 + %183 = OpConvertFToS %int %182 + %184 = OpSLessThan %bool %183 %int_120 + OpSelectionMerge %185 None + OpBranchConditional %184 %186 %187 + %186 = OpLabel + %188 = OpAccessChain %_ptr_Private_int %data %int_3 + %189 = OpLoad %int %188 + %190 = OpConvertSToF %float %189 + %191 = OpFDiv %float %190 %float_10 + %192 = OpFAdd %float %float_0_5 %191 + OpStore %grey %192 + OpBranch %185 + %187 = OpLabel + %193 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %194 = OpLoad %float %193 + %195 = OpConvertFToS %int %194 + %196 = OpSLessThan %bool %195 %int_150 + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %199 + %198 = OpLabel + OpKill + %199 = OpLabel + %200 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %201 = OpLoad %float %200 + %202 = OpConvertFToS %int %201 + %203 = OpSLessThan %bool %202 %int_180 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %206 + %205 = OpLabel + %207 = OpAccessChain %_ptr_Private_int %data %int_5 + %208 = OpLoad %int %207 + %209 = OpConvertSToF %float %208 + %210 = OpFDiv %float %209 %float_10 + %211 = OpFAdd %float %float_0_5 %210 + OpStore %grey %211 + OpBranch %204 + %206 = OpLabel + %212 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %213 = OpLoad %float %212 + %214 = OpConvertFToS %int %213 + %215 = OpSLessThan %bool %214 %int_210 + OpSelectionMerge %216 None + OpBranchConditional %215 %217 %218 + %217 = OpLabel + %219 = OpAccessChain %_ptr_Private_int %data %int_6 + %220 = OpLoad %int %219 + %221 = OpConvertSToF %float %220 + %222 = OpFDiv %float %221 %float_10 + %223 = OpFAdd %float %float_0_5 %222 + OpStore %grey %223 + OpBranch %216 + %218 = OpLabel + %224 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %225 = OpLoad %float %224 + %226 = OpConvertFToS %int %225 + %227 = OpSLessThan %bool %226 %int_240 + OpSelectionMerge %228 None + OpBranchConditional %227 %229 %230 + %229 = OpLabel + %231 = OpAccessChain %_ptr_Private_int %data %int_7 + %232 = OpLoad %int %231 + %233 = OpConvertSToF %float %232 + %234 = OpFDiv %float %233 %float_10 + %235 = OpFAdd %float %float_0_5 %234 + OpStore %grey %235 + OpBranch %228 + %230 = OpLabel + %236 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %237 = OpLoad %float %236 + %238 = OpConvertFToS %int %237 + %239 = OpSLessThan %bool %238 %int_270 + OpSelectionMerge %240 None + OpBranchConditional %239 %241 %242 + %241 = OpLabel + %243 = OpAccessChain %_ptr_Private_int %data %int_8 + %244 = OpLoad %int %243 + %245 = OpConvertSToF %float %244 + %246 = OpFDiv %float %245 %float_10 + %247 = OpFAdd %float %float_0_5 %246 + OpStore %grey %247 + OpBranch %240 + %242 = OpLabel + OpKill + %240 = OpLabel + OpBranch %228 + %228 = OpLabel + OpBranch %216 + %216 = OpLabel + OpBranch %204 + %204 = OpLabel + OpBranch %197 + %197 = OpLabel + OpBranch %185 + %185 = OpLabel + OpBranch %173 + %173 = OpLabel + OpBranch %161 + %161 = OpLabel + OpBranch %149 + %149 = OpLabel + %248 = OpLoad %float %grey + %249 = OpCompositeConstruct %v3float %248 %248 %248 + %250 = OpCompositeExtract %float %249 0 + %251 = OpCompositeExtract %float %249 1 + %252 = OpCompositeExtract %float %249 2 + %253 = OpCompositeConstruct %v4float %250 %251 %252 %float_1 + OpStore %_GLF_color %253 + OpReturn + OpFunctionEnd +%merge_i1_i1_i1_ = OpFunction %void None %37 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %254 = OpLabel + %k = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %255 = OpLoad %int %from + OpStore %k %255 + %256 = OpLoad %int %from + OpStore %i %256 + %257 = OpLoad %int %mid + %258 = OpIAdd %int %257 %int_1 + OpStore %j %258 + OpBranch %259 + %259 = OpLabel + OpLoopMerge %260 %261 None + OpBranch %262 + %262 = OpLabel + %263 = OpLoad %int %i + %264 = OpLoad %int %mid + %265 = OpSLessThanEqual %bool %263 %264 + %266 = OpLoad %int %j + %267 = OpLoad %int %to + %268 = OpSLessThanEqual %bool %266 %267 + %269 = OpLogicalAnd %bool %265 %268 + OpBranchConditional %269 %270 %260 + %270 = OpLabel + %271 = OpLoad %int %i + %272 = OpAccessChain %_ptr_Private_int %data %271 + %273 = OpLoad %int %272 + %274 = OpLoad %int %j + %275 = OpAccessChain %_ptr_Private_int %data %274 + %276 = OpLoad %int %275 + %277 = OpSLessThan %bool %273 %276 + OpSelectionMerge %278 None + OpBranchConditional %277 %279 %280 + %279 = OpLabel + %281 = OpLoad %int %k + %282 = OpIAdd %int %281 %int_1 + OpStore %k %282 + %283 = OpLoad %int %i + %284 = OpIAdd %int %283 %int_1 + OpStore %i %284 + %285 = OpAccessChain %_ptr_Private_int %data %283 + %286 = OpLoad %int %285 + %287 = OpAccessChain %_ptr_Private_int %temp %281 + OpStore %287 %286 + OpBranch %278 + %280 = OpLabel + %288 = OpLoad %int %k + %289 = OpIAdd %int %288 %int_1 + OpStore %k %289 + %290 = OpLoad %int %j + %291 = OpIAdd %int %290 %int_1 + OpStore %j %291 + %292 = OpAccessChain %_ptr_Private_int %data %290 + %293 = OpLoad %int %292 + %294 = OpAccessChain %_ptr_Private_int %temp %288 + OpStore %294 %293 + OpBranch %278 + %278 = OpLabel + OpBranch %261 + %261 = OpLabel + OpBranch %259 + %260 = OpLabel + OpBranch %295 + %295 = OpLabel + OpLoopMerge %296 %297 None + OpBranch %298 + %298 = OpLabel + %299 = OpLoad %int %i + %300 = OpSLessThan %bool %299 %int_10 + %301 = OpLoad %int %i + %302 = OpLoad %int %mid + %303 = OpSLessThanEqual %bool %301 %302 + %304 = OpLogicalAnd %bool %300 %303 + OpBranchConditional %304 %305 %296 + %305 = OpLabel + %306 = OpLoad %int %k + %307 = OpIAdd %int %306 %int_1 + OpStore %k %307 + %308 = OpLoad %int %i + %309 = OpIAdd %int %308 %int_1 + OpStore %i %309 + %310 = OpAccessChain %_ptr_Private_int %data %308 + %311 = OpLoad %int %310 + %312 = OpAccessChain %_ptr_Private_int %temp %306 + OpStore %312 %311 + OpBranch %297 + %297 = OpLabel + OpBranch %295 + %296 = OpLabel + %313 = OpLoad %int %from + OpStore %i_0 %313 + OpBranch %314 + %314 = OpLabel + OpLoopMerge %315 %316 None + OpBranch %317 + %317 = OpLabel + %318 = OpLoad %int %i_0 + %319 = OpLoad %int %to + %320 = OpSLessThanEqual %bool %318 %319 + OpBranchConditional %320 %321 %315 + %321 = OpLabel + %322 = OpLoad %int %i_0 + %323 = OpLoad %int %i_0 + %324 = OpAccessChain %_ptr_Private_int %temp %323 + %325 = OpLoad %int %324 + %326 = OpAccessChain %_ptr_Private_int %data %322 + OpStore %326 %325 + OpBranch %316 + %316 = OpLabel + %327 = OpLoad %int %i_0 + %328 = OpIAdd %int %327 %int_1 + OpStore %i_0 %328 + OpBranch %314 + %315 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %34 + %329 = OpLabel + %low = OpVariable %_ptr_Function_int Function + %high = OpVariable %_ptr_Function_int Function + %m = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %from_0 = OpVariable %_ptr_Function_int Function + %mid_0 = OpVariable %_ptr_Function_int Function + %to_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %330 + %330 = OpLabel + OpLoopMerge %331 %332 None + OpBranch %333 + %333 = OpLabel + %334 = OpLoad %int %m + %335 = OpLoad %int %high + %336 = OpSLessThanEqual %bool %334 %335 + OpBranchConditional %336 %337 %331 + %337 = OpLabel + %338 = OpLoad %int %low + OpStore %i_1 %338 + OpBranch %339 + %339 = OpLabel + OpLoopMerge %340 %341 None + OpBranch %342 + %342 = OpLabel + %343 = OpLoad %int %i_1 + %344 = OpLoad %int %high + %345 = OpSLessThan %bool %343 %344 + OpBranchConditional %345 %346 %340 + %346 = OpLabel + %347 = OpLoad %int %i_1 + OpStore %from_0 %347 + %348 = OpLoad %int %i_1 + %349 = OpLoad %int %m + %350 = OpIAdd %int %348 %349 + %351 = OpISub %int %350 %int_1 + OpStore %mid_0 %351 + %352 = OpLoad %int %i_1 + %353 = OpLoad %int %m + %354 = OpIMul %int %int_2 %353 + %355 = OpIAdd %int %352 %354 + %356 = OpISub %int %355 %int_1 + %357 = OpLoad %int %high + %358 = OpExtInst %int %1 SMin %356 %357 + OpStore %to_0 %358 + %359 = OpLoad %int %from_0 + OpStore %param %359 + %360 = OpLoad %int %mid_0 + OpStore %param_0 %360 + %361 = OpLoad %int %to_0 + OpStore %param_1 %361 + %362 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_0 %param_1 + OpBranch %341 + %341 = OpLabel + %363 = OpLoad %int %m + %364 = OpIMul %int %int_2 %363 + %365 = OpLoad %int %i_1 + %366 = OpIAdd %int %365 %364 + OpStore %i_1 %366 + OpBranch %339 + %340 = OpLabel + OpBranch %332 + %332 = OpLabel + %367 = OpLoad %int %m + %368 = OpIMul %int %int_2 %367 + OpStore %m %368 + OpBranch %330 + %331 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..b6f582eb3f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.hlsl @@ -0,0 +1,281 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_32 : register(b1, space0) { + uint4 x_32[1]; +}; + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_255 = from; + k = x_255; + const int x_256 = from; + i = x_256; + const int x_257 = mid; + j = (x_257 + 1); + while (true) { + const int x_263 = i; + const int x_264 = mid; + const int x_266 = j; + const int x_267 = to; + bool tint_tmp = (x_263 <= x_264); + if (tint_tmp) { + tint_tmp = (x_266 <= x_267); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_273 = data[i]; + const int x_276 = data[j]; + if ((x_273 < x_276)) { + const int x_281 = k; + k = (x_281 + 1); + const int x_283 = i; + i = (x_283 + 1); + const int x_286 = data[x_283]; + temp[x_281] = x_286; + } else { + const int x_288 = k; + k = (x_288 + 1); + const int x_290 = j; + j = (x_290 + 1); + const int x_293 = data[x_290]; + temp[x_288] = x_293; + } + } + while (true) { + const int x_299 = i; + const int x_301 = i; + const int x_302 = mid; + bool tint_tmp_1 = (x_299 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_301 <= x_302); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_306 = k; + k = (x_306 + 1); + const int x_308 = i; + i = (x_308 + 1); + const int x_311 = data[x_308]; + temp[x_306] = x_311; + } + const int x_313 = from; + i_1 = x_313; + while (true) { + const int x_318 = i_1; + const int x_319 = to; + if ((x_318 <= x_319)) { + } else { + break; + } + const int x_322 = i_1; + const int x_325 = temp[i_1]; + data[x_322] = x_325; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_88 = asfloat(x_28[0].x); + i_3 = int(x_88); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + if (true) { + } else { + { + if ((i_3 < 10)) { + } else { + break; + } + } + continue; + } + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_137 = j_1; + const int x_140 = data[j_1]; + temp[x_137] = x_140; + } + } + mergeSort_(); + const float x_146 = gl_FragCoord.y; + if ((int(x_146) < 30)) { + const int x_153 = data[0]; + grey = (0.5f + (float(x_153) / 10.0f)); + } else { + const float x_158 = gl_FragCoord.y; + if ((int(x_158) < 60)) { + const int x_165 = data[1]; + grey = (0.5f + (float(x_165) / 10.0f)); + } else { + const float x_170 = gl_FragCoord.y; + if ((int(x_170) < 90)) { + const int x_177 = data[2]; + grey = (0.5f + (float(x_177) / 10.0f)); + } else { + const float x_182 = gl_FragCoord.y; + if ((int(x_182) < 120)) { + const int x_189 = data[3]; + grey = (0.5f + (float(x_189) / 10.0f)); + } else { + const float x_194 = gl_FragCoord.y; + if ((int(x_194) < 150)) { + discard; + } else { + const float x_201 = gl_FragCoord.y; + if ((int(x_201) < 180)) { + const int x_208 = data[5]; + grey = (0.5f + (float(x_208) / 10.0f)); + } else { + const float x_213 = gl_FragCoord.y; + if ((int(x_213) < 210)) { + const int x_220 = data[6]; + grey = (0.5f + (float(x_220) / 10.0f)); + } else { + const float x_225 = gl_FragCoord.y; + if ((int(x_225) < 240)) { + const int x_232 = data[7]; + grey = (0.5f + (float(x_232) / 10.0f)); + } else { + const float x_237 = gl_FragCoord.y; + if ((int(x_237) < 270)) { + const int x_244 = data[8]; + grey = (0.5f + (float(x_244) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_248 = grey; + const float3 x_249 = float3(x_248, x_248, x_248); + x_GLF_color = float4(x_249.x, x_249.y, x_249.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.msl new file mode 100644 index 0000000000..983295be0f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.msl @@ -0,0 +1,328 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_255 = *(from); + k = x_255; + int const x_256 = *(from); + i = x_256; + int const x_257 = *(mid); + j = (x_257 + 1); + while (true) { + int const x_263 = i; + int const x_264 = *(mid); + int const x_266 = j; + int const x_267 = *(to); + if (((x_263 <= x_264) && (x_266 <= x_267))) { + } else { + break; + } + int const x_271 = i; + int const x_273 = (*(tint_symbol_5)).arr[x_271]; + int const x_274 = j; + int const x_276 = (*(tint_symbol_5)).arr[x_274]; + if ((x_273 < x_276)) { + int const x_281 = k; + k = (x_281 + 1); + int const x_283 = i; + i = (x_283 + 1); + int const x_286 = (*(tint_symbol_5)).arr[x_283]; + (*(tint_symbol_6)).arr[x_281] = x_286; + } else { + int const x_288 = k; + k = (x_288 + 1); + int const x_290 = j; + j = (x_290 + 1); + int const x_293 = (*(tint_symbol_5)).arr[x_290]; + (*(tint_symbol_6)).arr[x_288] = x_293; + } + } + while (true) { + int const x_299 = i; + int const x_301 = i; + int const x_302 = *(mid); + if (((x_299 < 10) && (x_301 <= x_302))) { + } else { + break; + } + int const x_306 = k; + k = (x_306 + 1); + int const x_308 = i; + i = (x_308 + 1); + int const x_311 = (*(tint_symbol_5)).arr[x_308]; + (*(tint_symbol_6)).arr[x_306] = x_311; + } + int const x_313 = *(from); + i_1 = x_313; + while (true) { + int const x_318 = i_1; + int const x_319 = *(to); + if ((x_318 <= x_319)) { + } else { + break; + } + int const x_322 = i_1; + int const x_323 = i_1; + int const x_325 = (*(tint_symbol_6)).arr[x_323]; + (*(tint_symbol_5)).arr[x_322] = x_325; + { + int const x_327 = i_1; + i_1 = (x_327 + 1); + } + } + return; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_334 = m; + int const x_335 = high; + if ((x_334 <= x_335)) { + } else { + break; + } + int const x_338 = low; + i_2 = x_338; + while (true) { + int const x_343 = i_2; + int const x_344 = high; + if ((x_343 < x_344)) { + } else { + break; + } + int const x_347 = i_2; + from_1 = x_347; + int const x_348 = i_2; + int const x_349 = m; + mid_1 = ((x_348 + x_349) - 1); + int const x_352 = i_2; + int const x_353 = m; + int const x_357 = high; + to_1 = min(((x_352 + (2 * x_353)) - 1), x_357); + int const x_359 = from_1; + param = x_359; + int const x_360 = mid_1; + param_1 = x_360; + int const x_361 = to_1; + param_2 = x_361; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_363 = m; + int const x_365 = i_2; + i_2 = (x_365 + (2 * x_363)); + } + } + { + int const x_367 = m; + m = (2 * x_367); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_88 = x_28.injectionSwitch.x; + i_3 = int(x_88); + while (true) { + int const x_94 = i_3; + switch(x_94) { + case 9: { + int const x_124 = i_3; + (*(tint_symbol_9)).arr[x_124] = -5; + if (true) { + } else { + { + int const x_128 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + continue; + } + break; + } + case 8: { + int const x_122 = i_3; + (*(tint_symbol_9)).arr[x_122] = -4; + break; + } + case 7: { + int const x_120 = i_3; + (*(tint_symbol_9)).arr[x_120] = -3; + break; + } + case 6: { + int const x_118 = i_3; + (*(tint_symbol_9)).arr[x_118] = -2; + break; + } + case 5: { + int const x_116 = i_3; + (*(tint_symbol_9)).arr[x_116] = -1; + break; + } + case 4: { + int const x_114 = i_3; + (*(tint_symbol_9)).arr[x_114] = 0; + break; + } + case 3: { + int const x_112 = i_3; + (*(tint_symbol_9)).arr[x_112] = 1; + break; + } + case 2: { + int const x_110 = i_3; + (*(tint_symbol_9)).arr[x_110] = 2; + break; + } + case 1: { + int const x_108 = i_3; + (*(tint_symbol_9)).arr[x_108] = 3; + break; + } + case 0: { + int const x_106 = i_3; + (*(tint_symbol_9)).arr[x_106] = 4; + break; + } + default: { + break; + } + } + int const x_126 = i_3; + i_3 = (x_126 + 1); + { + int const x_128 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_134 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + int const x_137 = j_1; + int const x_138 = j_1; + int const x_140 = (*(tint_symbol_9)).arr[x_138]; + (*(tint_symbol_10)).arr[x_137] = x_140; + { + int const x_142 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(tint_symbol_9, tint_symbol_10); + float const x_146 = (*(tint_symbol_11)).y; + if ((int(x_146) < 30)) { + int const x_153 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_153) / 10.0f)); + } else { + float const x_158 = (*(tint_symbol_11)).y; + if ((int(x_158) < 60)) { + int const x_165 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_165) / 10.0f)); + } else { + float const x_170 = (*(tint_symbol_11)).y; + if ((int(x_170) < 90)) { + int const x_177 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_177) / 10.0f)); + } else { + float const x_182 = (*(tint_symbol_11)).y; + if ((int(x_182) < 120)) { + int const x_189 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_189) / 10.0f)); + } else { + float const x_194 = (*(tint_symbol_11)).y; + if ((int(x_194) < 150)) { + discard_fragment(); + } else { + float const x_201 = (*(tint_symbol_11)).y; + if ((int(x_201) < 180)) { + int const x_208 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_208) / 10.0f)); + } else { + float const x_213 = (*(tint_symbol_11)).y; + if ((int(x_213) < 210)) { + int const x_220 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_220) / 10.0f)); + } else { + float const x_225 = (*(tint_symbol_11)).y; + if ((int(x_225) < 240)) { + int const x_232 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_232) / 10.0f)); + } else { + float const x_237 = (*(tint_symbol_11)).y; + if ((int(x_237) < 270)) { + int const x_244 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_244) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_248 = grey; + float3 const x_249 = float3(x_248, x_248, x_248); + *(tint_symbol_12) = float4(x_249.x, x_249.y, x_249.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..a382317bf6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.spvasm @@ -0,0 +1,668 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 423 +; Schema: 0 + OpCapability Shader + %180 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_32 "x_32" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_32 NonWritable + OpDecorate %x_32 DescriptorSet 0 + OpDecorate %x_32 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_32 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %35 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %135 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %204 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %true = OpConstantTrue %bool + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %410 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %26 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %33 = OpLabel + %k = OpVariable %_ptr_Function_int Function %35 + %i = OpVariable %_ptr_Function_int Function %35 + %j = OpVariable %_ptr_Function_int Function %35 + %i_1 = OpVariable %_ptr_Function_int Function %35 + %40 = OpLoad %int %from + OpStore %k %40 + %42 = OpLoad %int %from + OpStore %i %42 + %44 = OpLoad %int %mid + %46 = OpIAdd %int %44 %int_1 + OpStore %j %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i + %53 = OpLoad %int %mid + %54 = OpLoad %int %j + %56 = OpLoad %int %to + %57 = OpSLessThanEqual %bool %51 %53 + OpSelectionMerge %59 None + OpBranchConditional %57 %60 %59 + %60 = OpLabel + %61 = OpSLessThanEqual %bool %54 %56 + OpBranch %59 + %59 = OpLabel + %62 = OpPhi %bool %57 %50 %61 %60 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %48 + %63 = OpLabel + %66 = OpLoad %int %i + %68 = OpAccessChain %_ptr_Private_int %data %66 + %69 = OpLoad %int %68 + %70 = OpLoad %int %j + %71 = OpAccessChain %_ptr_Private_int %data %70 + %72 = OpLoad %int %71 + %73 = OpSLessThan %bool %69 %72 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %77 = OpLoad %int %k + %78 = OpIAdd %int %77 %int_1 + OpStore %k %78 + %79 = OpLoad %int %i + %80 = OpIAdd %int %79 %int_1 + OpStore %i %80 + %81 = OpAccessChain %_ptr_Private_int %data %79 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Private_int %temp %77 + OpStore %83 %82 + OpBranch %74 + %76 = OpLabel + %84 = OpLoad %int %k + %85 = OpIAdd %int %84 %int_1 + OpStore %k %85 + %86 = OpLoad %int %j + %87 = OpIAdd %int %86 %int_1 + OpStore %j %87 + %88 = OpAccessChain %_ptr_Private_int %data %86 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Private_int %temp %84 + OpStore %90 %89 + OpBranch %74 + %74 = OpLabel + OpBranch %49 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %i + %96 = OpLoad %int %i + %98 = OpLoad %int %mid + %100 = OpSLessThan %bool %95 %int_10 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpSLessThanEqual %bool %96 %98 + OpBranch %101 + %101 = OpLabel + %104 = OpPhi %bool %100 %94 %103 %102 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %107 + %106 = OpLabel + OpBranch %105 + %107 = OpLabel + OpBranch %92 + %105 = OpLabel + %108 = OpLoad %int %k + %109 = OpIAdd %int %108 %int_1 + OpStore %k %109 + %110 = OpLoad %int %i + %111 = OpIAdd %int %110 %int_1 + OpStore %i %111 + %112 = OpAccessChain %_ptr_Private_int %data %110 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Private_int %temp %108 + OpStore %114 %113 + OpBranch %93 + %93 = OpLabel + OpBranch %91 + %92 = OpLabel + %116 = OpLoad %int %from + OpStore %i_1 %116 + OpBranch %117 + %117 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %121 = OpLoad %int %i_1 + %123 = OpLoad %int %to + %124 = OpSLessThanEqual %bool %121 %123 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %127 + %126 = OpLabel + OpBranch %125 + %127 = OpLabel + OpBranch %118 + %125 = OpLabel + %128 = OpLoad %int %i_1 + %129 = OpLoad %int %i_1 + %130 = OpAccessChain %_ptr_Private_int %temp %129 + %131 = OpLoad %int %130 + %132 = OpAccessChain %_ptr_Private_int %data %128 + OpStore %132 %131 + OpBranch %119 + %119 = OpLabel + %133 = OpLoad %int %i_1 + %134 = OpIAdd %int %133 %int_1 + OpStore %i_1 %134 + OpBranch %117 + %118 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %135 + %137 = OpLabel + %low = OpVariable %_ptr_Function_int Function %35 + %high = OpVariable %_ptr_Function_int Function %35 + %m = OpVariable %_ptr_Function_int Function %35 + %i_2 = OpVariable %_ptr_Function_int Function %35 + %from_1 = OpVariable %_ptr_Function_int Function %35 + %mid_1 = OpVariable %_ptr_Function_int Function %35 + %to_1 = OpVariable %_ptr_Function_int Function %35 + %param = OpVariable %_ptr_Function_int Function %35 + %param_1 = OpVariable %_ptr_Function_int Function %35 + %param_2 = OpVariable %_ptr_Function_int Function %35 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %154 = OpLoad %int %m + %155 = OpLoad %int %high + %156 = OpSLessThanEqual %bool %154 %155 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %159 + %158 = OpLabel + OpBranch %157 + %159 = OpLabel + OpBranch %151 + %157 = OpLabel + %160 = OpLoad %int %low + OpStore %i_2 %160 + OpBranch %161 + %161 = OpLabel + OpLoopMerge %162 %163 None + OpBranch %164 + %164 = OpLabel + %165 = OpLoad %int %i_2 + %166 = OpLoad %int %high + %167 = OpSLessThan %bool %165 %166 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %162 + %168 = OpLabel + %171 = OpLoad %int %i_2 + OpStore %from_1 %171 + %172 = OpLoad %int %i_2 + %173 = OpLoad %int %m + %174 = OpIAdd %int %172 %173 + %175 = OpISub %int %174 %int_1 + OpStore %mid_1 %175 + %176 = OpLoad %int %i_2 + %177 = OpLoad %int %m + %178 = OpLoad %int %high + %182 = OpIMul %int %int_2 %177 + %183 = OpIAdd %int %176 %182 + %184 = OpISub %int %183 %int_1 + %179 = OpExtInst %int %180 SMin %184 %178 + OpStore %to_1 %179 + %185 = OpLoad %int %from_1 + OpStore %param %185 + %186 = OpLoad %int %mid_1 + OpStore %param_1 %186 + %187 = OpLoad %int %to_1 + OpStore %param_2 %187 + %188 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %163 + %163 = OpLabel + %192 = OpLoad %int %m + %193 = OpLoad %int %i_2 + %194 = OpIMul %int %int_2 %192 + %195 = OpIAdd %int %193 %194 + OpStore %i_2 %195 + OpBranch %161 + %162 = OpLabel + OpBranch %152 + %152 = OpLabel + %196 = OpLoad %int %m + %197 = OpIMul %int %int_2 %196 + OpStore %m %197 + OpBranch %150 + %151 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %135 + %199 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %35 + %j_1 = OpVariable %_ptr_Function_int Function %35 + %grey = OpVariable %_ptr_Function_float Function %204 + %207 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %208 = OpLoad %float %207 + %209 = OpConvertFToS %int %208 + OpStore %i_3 %209 + OpBranch %210 + %210 = OpLabel + OpLoopMerge %211 %212 None + OpBranch %213 + %213 = OpLabel + %214 = OpLoad %int %i_3 + OpSelectionMerge %215 None + OpSwitch %214 %216 9 %217 8 %218 7 %219 6 %220 5 %221 4 %222 3 %223 2 %224 1 %225 0 %226 + %217 = OpLabel + %227 = OpLoad %int %i_3 + %228 = OpAccessChain %_ptr_Private_int %data %227 + OpStore %228 %int_n5 + OpSelectionMerge %231 None + OpBranchConditional %true %232 %233 + %232 = OpLabel + OpBranch %231 + %233 = OpLabel + OpBranch %212 + %231 = OpLabel + OpBranch %215 + %218 = OpLabel + %234 = OpLoad %int %i_3 + %235 = OpAccessChain %_ptr_Private_int %data %234 + OpStore %235 %int_n4 + OpBranch %215 + %219 = OpLabel + %237 = OpLoad %int %i_3 + %238 = OpAccessChain %_ptr_Private_int %data %237 + OpStore %238 %int_n3 + OpBranch %215 + %220 = OpLabel + %240 = OpLoad %int %i_3 + %241 = OpAccessChain %_ptr_Private_int %data %240 + OpStore %241 %int_n2 + OpBranch %215 + %221 = OpLabel + %243 = OpLoad %int %i_3 + %244 = OpAccessChain %_ptr_Private_int %data %243 + OpStore %244 %int_n1 + OpBranch %215 + %222 = OpLabel + %246 = OpLoad %int %i_3 + %247 = OpAccessChain %_ptr_Private_int %data %246 + OpStore %247 %int_0 + OpBranch %215 + %223 = OpLabel + %248 = OpLoad %int %i_3 + %249 = OpAccessChain %_ptr_Private_int %data %248 + OpStore %249 %int_1 + OpBranch %215 + %224 = OpLabel + %250 = OpLoad %int %i_3 + %251 = OpAccessChain %_ptr_Private_int %data %250 + OpStore %251 %int_2 + OpBranch %215 + %225 = OpLabel + %252 = OpLoad %int %i_3 + %253 = OpAccessChain %_ptr_Private_int %data %252 + OpStore %253 %int_3 + OpBranch %215 + %226 = OpLabel + %255 = OpLoad %int %i_3 + %256 = OpAccessChain %_ptr_Private_int %data %255 + OpStore %256 %int_4 + OpBranch %215 + %216 = OpLabel + OpBranch %215 + %215 = OpLabel + %258 = OpLoad %int %i_3 + %259 = OpIAdd %int %258 %int_1 + OpStore %i_3 %259 + OpBranch %212 + %212 = OpLabel + %260 = OpLoad %int %i_3 + %261 = OpSLessThan %bool %260 %int_10 + OpSelectionMerge %262 None + OpBranchConditional %261 %263 %264 + %263 = OpLabel + OpBranch %262 + %264 = OpLabel + OpBranch %211 + %262 = OpLabel + OpBranch %210 + %211 = OpLabel + OpStore %j_1 %int_0 + OpBranch %265 + %265 = OpLabel + OpLoopMerge %266 %267 None + OpBranch %268 + %268 = OpLabel + %269 = OpLoad %int %j_1 + %270 = OpSLessThan %bool %269 %int_10 + OpSelectionMerge %271 None + OpBranchConditional %270 %272 %273 + %272 = OpLabel + OpBranch %271 + %273 = OpLabel + OpBranch %266 + %271 = OpLabel + %274 = OpLoad %int %j_1 + %275 = OpLoad %int %j_1 + %276 = OpAccessChain %_ptr_Private_int %data %275 + %277 = OpLoad %int %276 + %278 = OpAccessChain %_ptr_Private_int %temp %274 + OpStore %278 %277 + OpBranch %267 + %267 = OpLabel + %279 = OpLoad %int %j_1 + %280 = OpIAdd %int %279 %int_1 + OpStore %j_1 %280 + OpBranch %265 + %266 = OpLabel + %281 = OpFunctionCall %void %mergeSort_ + %284 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %285 = OpLoad %float %284 + %286 = OpConvertFToS %int %285 + %288 = OpSLessThan %bool %286 %int_30 + OpSelectionMerge %289 None + OpBranchConditional %288 %290 %291 + %290 = OpLabel + %292 = OpAccessChain %_ptr_Private_int %data %int_0 + %293 = OpLoad %int %292 + %295 = OpConvertSToF %float %293 + %297 = OpFDiv %float %295 %float_10 + %298 = OpFAdd %float %float_0_5 %297 + OpStore %grey %298 + OpBranch %289 + %291 = OpLabel + %299 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %300 = OpLoad %float %299 + %301 = OpConvertFToS %int %300 + %303 = OpSLessThan %bool %301 %int_60 + OpSelectionMerge %304 None + OpBranchConditional %303 %305 %306 + %305 = OpLabel + %307 = OpAccessChain %_ptr_Private_int %data %int_1 + %308 = OpLoad %int %307 + %309 = OpConvertSToF %float %308 + %310 = OpFDiv %float %309 %float_10 + %311 = OpFAdd %float %float_0_5 %310 + OpStore %grey %311 + OpBranch %304 + %306 = OpLabel + %312 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %313 = OpLoad %float %312 + %314 = OpConvertFToS %int %313 + %316 = OpSLessThan %bool %314 %int_90 + OpSelectionMerge %317 None + OpBranchConditional %316 %318 %319 + %318 = OpLabel + %320 = OpAccessChain %_ptr_Private_int %data %int_2 + %321 = OpLoad %int %320 + %322 = OpConvertSToF %float %321 + %323 = OpFDiv %float %322 %float_10 + %324 = OpFAdd %float %float_0_5 %323 + OpStore %grey %324 + OpBranch %317 + %319 = OpLabel + %325 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %326 = OpLoad %float %325 + %327 = OpConvertFToS %int %326 + %329 = OpSLessThan %bool %327 %int_120 + OpSelectionMerge %330 None + OpBranchConditional %329 %331 %332 + %331 = OpLabel + %333 = OpAccessChain %_ptr_Private_int %data %int_3 + %334 = OpLoad %int %333 + %335 = OpConvertSToF %float %334 + %336 = OpFDiv %float %335 %float_10 + %337 = OpFAdd %float %float_0_5 %336 + OpStore %grey %337 + OpBranch %330 + %332 = OpLabel + %338 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %339 = OpLoad %float %338 + %340 = OpConvertFToS %int %339 + %342 = OpSLessThan %bool %340 %int_150 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %345 + %344 = OpLabel + OpKill + %345 = OpLabel + %346 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %347 = OpLoad %float %346 + %348 = OpConvertFToS %int %347 + %350 = OpSLessThan %bool %348 %int_180 + OpSelectionMerge %351 None + OpBranchConditional %350 %352 %353 + %352 = OpLabel + %355 = OpAccessChain %_ptr_Private_int %data %int_5 + %356 = OpLoad %int %355 + %357 = OpConvertSToF %float %356 + %358 = OpFDiv %float %357 %float_10 + %359 = OpFAdd %float %float_0_5 %358 + OpStore %grey %359 + OpBranch %351 + %353 = OpLabel + %360 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %361 = OpLoad %float %360 + %362 = OpConvertFToS %int %361 + %364 = OpSLessThan %bool %362 %int_210 + OpSelectionMerge %365 None + OpBranchConditional %364 %366 %367 + %366 = OpLabel + %369 = OpAccessChain %_ptr_Private_int %data %int_6 + %370 = OpLoad %int %369 + %371 = OpConvertSToF %float %370 + %372 = OpFDiv %float %371 %float_10 + %373 = OpFAdd %float %float_0_5 %372 + OpStore %grey %373 + OpBranch %365 + %367 = OpLabel + %374 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %375 = OpLoad %float %374 + %376 = OpConvertFToS %int %375 + %378 = OpSLessThan %bool %376 %int_240 + OpSelectionMerge %379 None + OpBranchConditional %378 %380 %381 + %380 = OpLabel + %383 = OpAccessChain %_ptr_Private_int %data %int_7 + %384 = OpLoad %int %383 + %385 = OpConvertSToF %float %384 + %386 = OpFDiv %float %385 %float_10 + %387 = OpFAdd %float %float_0_5 %386 + OpStore %grey %387 + OpBranch %379 + %381 = OpLabel + %388 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %389 = OpLoad %float %388 + %390 = OpConvertFToS %int %389 + %392 = OpSLessThan %bool %390 %int_270 + OpSelectionMerge %393 None + OpBranchConditional %392 %394 %395 + %394 = OpLabel + %397 = OpAccessChain %_ptr_Private_int %data %int_8 + %398 = OpLoad %int %397 + %399 = OpConvertSToF %float %398 + %400 = OpFDiv %float %399 %float_10 + %401 = OpFAdd %float %float_0_5 %400 + OpStore %grey %401 + OpBranch %393 + %395 = OpLabel + OpKill + %393 = OpLabel + OpBranch %379 + %379 = OpLabel + OpBranch %365 + %365 = OpLabel + OpBranch %351 + %351 = OpLabel + OpBranch %343 + %343 = OpLabel + OpBranch %330 + %330 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %304 + %304 = OpLabel + OpBranch %289 + %289 = OpLabel + %402 = OpLoad %float %grey + %404 = OpCompositeConstruct %v3float %402 %402 %402 + %405 = OpCompositeExtract %float %404 0 + %406 = OpCompositeExtract %float %404 1 + %407 = OpCompositeExtract %float %404 2 + %409 = OpCompositeConstruct %v4float %405 %406 %407 %float_1 + OpStore %x_GLF_color %409 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %410 +%tint_symbol_1 = OpFunctionParameter %main_out + %414 = OpLabel + %415 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %415 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %135 + %417 = OpLabel + %418 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %418 + %419 = OpFunctionCall %void %main_1 + %421 = OpLoad %v4float %x_GLF_color + %422 = OpCompositeConstruct %main_out %421 + %420 = OpFunctionCall %void %tint_symbol_3 %422 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 212[%212] is not post dominated by the back-edge block 262[%262] + %262 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..b969e06e6b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.spvasm.expected.wgsl @@ -0,0 +1,317 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_32 : buf1; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_255 : i32 = *(from); + k = x_255; + let x_256 : i32 = *(from); + i = x_256; + let x_257 : i32 = *(mid); + j = (x_257 + 1); + loop { + let x_263 : i32 = i; + let x_264 : i32 = *(mid); + let x_266 : i32 = j; + let x_267 : i32 = *(to); + if (((x_263 <= x_264) && (x_266 <= x_267))) { + } else { + break; + } + let x_271 : i32 = i; + let x_273 : i32 = data[x_271]; + let x_274 : i32 = j; + let x_276 : i32 = data[x_274]; + if ((x_273 < x_276)) { + let x_281 : i32 = k; + k = (x_281 + 1); + let x_283 : i32 = i; + i = (x_283 + 1); + let x_286 : i32 = data[x_283]; + temp[x_281] = x_286; + } else { + let x_288 : i32 = k; + k = (x_288 + 1); + let x_290 : i32 = j; + j = (x_290 + 1); + let x_293 : i32 = data[x_290]; + temp[x_288] = x_293; + } + } + loop { + let x_299 : i32 = i; + let x_301 : i32 = i; + let x_302 : i32 = *(mid); + if (((x_299 < 10) && (x_301 <= x_302))) { + } else { + break; + } + let x_306 : i32 = k; + k = (x_306 + 1); + let x_308 : i32 = i; + i = (x_308 + 1); + let x_311 : i32 = data[x_308]; + temp[x_306] = x_311; + } + let x_313 : i32 = *(from); + i_1 = x_313; + loop { + let x_318 : i32 = i_1; + let x_319 : i32 = *(to); + if ((x_318 <= x_319)) { + } else { + break; + } + let x_322 : i32 = i_1; + let x_323 : i32 = i_1; + let x_325 : i32 = temp[x_323]; + data[x_322] = x_325; + + continuing { + let x_327 : i32 = i_1; + i_1 = (x_327 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_334 : i32 = m; + let x_335 : i32 = high; + if ((x_334 <= x_335)) { + } else { + break; + } + let x_338 : i32 = low; + i_2 = x_338; + loop { + let x_343 : i32 = i_2; + let x_344 : i32 = high; + if ((x_343 < x_344)) { + } else { + break; + } + let x_347 : i32 = i_2; + from_1 = x_347; + let x_348 : i32 = i_2; + let x_349 : i32 = m; + mid_1 = ((x_348 + x_349) - 1); + let x_352 : i32 = i_2; + let x_353 : i32 = m; + let x_357 : i32 = high; + to_1 = min(((x_352 + (2 * x_353)) - 1), x_357); + let x_359 : i32 = from_1; + param = x_359; + let x_360 : i32 = mid_1; + param_1 = x_360; + let x_361 : i32 = to_1; + param_2 = x_361; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_363 : i32 = m; + let x_365 : i32 = i_2; + i_2 = (x_365 + (2 * x_363)); + } + } + + continuing { + let x_367 : i32 = m; + m = (2 * x_367); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_88 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_88); + loop { + let x_94 : i32 = i_3; + switch(x_94) { + case 9: { + let x_124 : i32 = i_3; + data[x_124] = -5; + if (true) { + } else { + continue; + } + } + case 8: { + let x_122 : i32 = i_3; + data[x_122] = -4; + } + case 7: { + let x_120 : i32 = i_3; + data[x_120] = -3; + } + case 6: { + let x_118 : i32 = i_3; + data[x_118] = -2; + } + case 5: { + let x_116 : i32 = i_3; + data[x_116] = -1; + } + case 4: { + let x_114 : i32 = i_3; + data[x_114] = 0; + } + case 3: { + let x_112 : i32 = i_3; + data[x_112] = 1; + } + case 2: { + let x_110 : i32 = i_3; + data[x_110] = 2; + } + case 1: { + let x_108 : i32 = i_3; + data[x_108] = 3; + } + case 0: { + let x_106 : i32 = i_3; + data[x_106] = 4; + } + default: { + } + } + let x_126 : i32 = i_3; + i_3 = (x_126 + 1); + + continuing { + let x_128 : i32 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_134 : i32 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + let x_137 : i32 = j_1; + let x_138 : i32 = j_1; + let x_140 : i32 = data[x_138]; + temp[x_137] = x_140; + + continuing { + let x_142 : i32 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(); + let x_146 : f32 = gl_FragCoord.y; + if ((i32(x_146) < 30)) { + let x_153 : i32 = data[0]; + grey = (0.5 + (f32(x_153) / 10.0)); + } else { + let x_158 : f32 = gl_FragCoord.y; + if ((i32(x_158) < 60)) { + let x_165 : i32 = data[1]; + grey = (0.5 + (f32(x_165) / 10.0)); + } else { + let x_170 : f32 = gl_FragCoord.y; + if ((i32(x_170) < 90)) { + let x_177 : i32 = data[2]; + grey = (0.5 + (f32(x_177) / 10.0)); + } else { + let x_182 : f32 = gl_FragCoord.y; + if ((i32(x_182) < 120)) { + let x_189 : i32 = data[3]; + grey = (0.5 + (f32(x_189) / 10.0)); + } else { + let x_194 : f32 = gl_FragCoord.y; + if ((i32(x_194) < 150)) { + discard; + } else { + let x_201 : f32 = gl_FragCoord.y; + if ((i32(x_201) < 180)) { + let x_208 : i32 = data[5]; + grey = (0.5 + (f32(x_208) / 10.0)); + } else { + let x_213 : f32 = gl_FragCoord.y; + if ((i32(x_213) < 210)) { + let x_220 : i32 = data[6]; + grey = (0.5 + (f32(x_220) / 10.0)); + } else { + let x_225 : f32 = gl_FragCoord.y; + if ((i32(x_225) < 240)) { + let x_232 : i32 = data[7]; + grey = (0.5 + (f32(x_232) / 10.0)); + } else { + let x_237 : f32 = gl_FragCoord.y; + if ((i32(x_237) < 270)) { + let x_244 : i32 = data[8]; + grey = (0.5 + (f32(x_244) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_248 : f32 = grey; + let x_249 : vec3 = vec3(x_248, x_248, x_248); + x_GLF_color = vec4(x_249.x, x_249.y, x_249.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl new file mode 100644 index 0000000000..b969e06e6b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl @@ -0,0 +1,317 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_32 : buf1; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_255 : i32 = *(from); + k = x_255; + let x_256 : i32 = *(from); + i = x_256; + let x_257 : i32 = *(mid); + j = (x_257 + 1); + loop { + let x_263 : i32 = i; + let x_264 : i32 = *(mid); + let x_266 : i32 = j; + let x_267 : i32 = *(to); + if (((x_263 <= x_264) && (x_266 <= x_267))) { + } else { + break; + } + let x_271 : i32 = i; + let x_273 : i32 = data[x_271]; + let x_274 : i32 = j; + let x_276 : i32 = data[x_274]; + if ((x_273 < x_276)) { + let x_281 : i32 = k; + k = (x_281 + 1); + let x_283 : i32 = i; + i = (x_283 + 1); + let x_286 : i32 = data[x_283]; + temp[x_281] = x_286; + } else { + let x_288 : i32 = k; + k = (x_288 + 1); + let x_290 : i32 = j; + j = (x_290 + 1); + let x_293 : i32 = data[x_290]; + temp[x_288] = x_293; + } + } + loop { + let x_299 : i32 = i; + let x_301 : i32 = i; + let x_302 : i32 = *(mid); + if (((x_299 < 10) && (x_301 <= x_302))) { + } else { + break; + } + let x_306 : i32 = k; + k = (x_306 + 1); + let x_308 : i32 = i; + i = (x_308 + 1); + let x_311 : i32 = data[x_308]; + temp[x_306] = x_311; + } + let x_313 : i32 = *(from); + i_1 = x_313; + loop { + let x_318 : i32 = i_1; + let x_319 : i32 = *(to); + if ((x_318 <= x_319)) { + } else { + break; + } + let x_322 : i32 = i_1; + let x_323 : i32 = i_1; + let x_325 : i32 = temp[x_323]; + data[x_322] = x_325; + + continuing { + let x_327 : i32 = i_1; + i_1 = (x_327 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_334 : i32 = m; + let x_335 : i32 = high; + if ((x_334 <= x_335)) { + } else { + break; + } + let x_338 : i32 = low; + i_2 = x_338; + loop { + let x_343 : i32 = i_2; + let x_344 : i32 = high; + if ((x_343 < x_344)) { + } else { + break; + } + let x_347 : i32 = i_2; + from_1 = x_347; + let x_348 : i32 = i_2; + let x_349 : i32 = m; + mid_1 = ((x_348 + x_349) - 1); + let x_352 : i32 = i_2; + let x_353 : i32 = m; + let x_357 : i32 = high; + to_1 = min(((x_352 + (2 * x_353)) - 1), x_357); + let x_359 : i32 = from_1; + param = x_359; + let x_360 : i32 = mid_1; + param_1 = x_360; + let x_361 : i32 = to_1; + param_2 = x_361; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_363 : i32 = m; + let x_365 : i32 = i_2; + i_2 = (x_365 + (2 * x_363)); + } + } + + continuing { + let x_367 : i32 = m; + m = (2 * x_367); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_88 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_88); + loop { + let x_94 : i32 = i_3; + switch(x_94) { + case 9: { + let x_124 : i32 = i_3; + data[x_124] = -5; + if (true) { + } else { + continue; + } + } + case 8: { + let x_122 : i32 = i_3; + data[x_122] = -4; + } + case 7: { + let x_120 : i32 = i_3; + data[x_120] = -3; + } + case 6: { + let x_118 : i32 = i_3; + data[x_118] = -2; + } + case 5: { + let x_116 : i32 = i_3; + data[x_116] = -1; + } + case 4: { + let x_114 : i32 = i_3; + data[x_114] = 0; + } + case 3: { + let x_112 : i32 = i_3; + data[x_112] = 1; + } + case 2: { + let x_110 : i32 = i_3; + data[x_110] = 2; + } + case 1: { + let x_108 : i32 = i_3; + data[x_108] = 3; + } + case 0: { + let x_106 : i32 = i_3; + data[x_106] = 4; + } + default: { + } + } + let x_126 : i32 = i_3; + i_3 = (x_126 + 1); + + continuing { + let x_128 : i32 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_134 : i32 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + let x_137 : i32 = j_1; + let x_138 : i32 = j_1; + let x_140 : i32 = data[x_138]; + temp[x_137] = x_140; + + continuing { + let x_142 : i32 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(); + let x_146 : f32 = gl_FragCoord.y; + if ((i32(x_146) < 30)) { + let x_153 : i32 = data[0]; + grey = (0.5 + (f32(x_153) / 10.0)); + } else { + let x_158 : f32 = gl_FragCoord.y; + if ((i32(x_158) < 60)) { + let x_165 : i32 = data[1]; + grey = (0.5 + (f32(x_165) / 10.0)); + } else { + let x_170 : f32 = gl_FragCoord.y; + if ((i32(x_170) < 90)) { + let x_177 : i32 = data[2]; + grey = (0.5 + (f32(x_177) / 10.0)); + } else { + let x_182 : f32 = gl_FragCoord.y; + if ((i32(x_182) < 120)) { + let x_189 : i32 = data[3]; + grey = (0.5 + (f32(x_189) / 10.0)); + } else { + let x_194 : f32 = gl_FragCoord.y; + if ((i32(x_194) < 150)) { + discard; + } else { + let x_201 : f32 = gl_FragCoord.y; + if ((i32(x_201) < 180)) { + let x_208 : i32 = data[5]; + grey = (0.5 + (f32(x_208) / 10.0)); + } else { + let x_213 : f32 = gl_FragCoord.y; + if ((i32(x_213) < 210)) { + let x_220 : i32 = data[6]; + grey = (0.5 + (f32(x_220) / 10.0)); + } else { + let x_225 : f32 = gl_FragCoord.y; + if ((i32(x_225) < 240)) { + let x_232 : i32 = data[7]; + grey = (0.5 + (f32(x_232) / 10.0)); + } else { + let x_237 : f32 = gl_FragCoord.y; + if ((i32(x_237) < 270)) { + let x_244 : i32 = data[8]; + grey = (0.5 + (f32(x_244) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_248 : f32 = grey; + let x_249 : vec3 = vec3(x_248, x_248, x_248); + x_GLF_color = vec4(x_249.x, x_249.y, x_249.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..b6f582eb3f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.hlsl @@ -0,0 +1,281 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_32 : register(b1, space0) { + uint4 x_32[1]; +}; + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_255 = from; + k = x_255; + const int x_256 = from; + i = x_256; + const int x_257 = mid; + j = (x_257 + 1); + while (true) { + const int x_263 = i; + const int x_264 = mid; + const int x_266 = j; + const int x_267 = to; + bool tint_tmp = (x_263 <= x_264); + if (tint_tmp) { + tint_tmp = (x_266 <= x_267); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_273 = data[i]; + const int x_276 = data[j]; + if ((x_273 < x_276)) { + const int x_281 = k; + k = (x_281 + 1); + const int x_283 = i; + i = (x_283 + 1); + const int x_286 = data[x_283]; + temp[x_281] = x_286; + } else { + const int x_288 = k; + k = (x_288 + 1); + const int x_290 = j; + j = (x_290 + 1); + const int x_293 = data[x_290]; + temp[x_288] = x_293; + } + } + while (true) { + const int x_299 = i; + const int x_301 = i; + const int x_302 = mid; + bool tint_tmp_1 = (x_299 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_301 <= x_302); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_306 = k; + k = (x_306 + 1); + const int x_308 = i; + i = (x_308 + 1); + const int x_311 = data[x_308]; + temp[x_306] = x_311; + } + const int x_313 = from; + i_1 = x_313; + while (true) { + const int x_318 = i_1; + const int x_319 = to; + if ((x_318 <= x_319)) { + } else { + break; + } + const int x_322 = i_1; + const int x_325 = temp[i_1]; + data[x_322] = x_325; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_88 = asfloat(x_28[0].x); + i_3 = int(x_88); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + if (true) { + } else { + { + if ((i_3 < 10)) { + } else { + break; + } + } + continue; + } + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_137 = j_1; + const int x_140 = data[j_1]; + temp[x_137] = x_140; + } + } + mergeSort_(); + const float x_146 = gl_FragCoord.y; + if ((int(x_146) < 30)) { + const int x_153 = data[0]; + grey = (0.5f + (float(x_153) / 10.0f)); + } else { + const float x_158 = gl_FragCoord.y; + if ((int(x_158) < 60)) { + const int x_165 = data[1]; + grey = (0.5f + (float(x_165) / 10.0f)); + } else { + const float x_170 = gl_FragCoord.y; + if ((int(x_170) < 90)) { + const int x_177 = data[2]; + grey = (0.5f + (float(x_177) / 10.0f)); + } else { + const float x_182 = gl_FragCoord.y; + if ((int(x_182) < 120)) { + const int x_189 = data[3]; + grey = (0.5f + (float(x_189) / 10.0f)); + } else { + const float x_194 = gl_FragCoord.y; + if ((int(x_194) < 150)) { + discard; + } else { + const float x_201 = gl_FragCoord.y; + if ((int(x_201) < 180)) { + const int x_208 = data[5]; + grey = (0.5f + (float(x_208) / 10.0f)); + } else { + const float x_213 = gl_FragCoord.y; + if ((int(x_213) < 210)) { + const int x_220 = data[6]; + grey = (0.5f + (float(x_220) / 10.0f)); + } else { + const float x_225 = gl_FragCoord.y; + if ((int(x_225) < 240)) { + const int x_232 = data[7]; + grey = (0.5f + (float(x_232) / 10.0f)); + } else { + const float x_237 = gl_FragCoord.y; + if ((int(x_237) < 270)) { + const int x_244 = data[8]; + grey = (0.5f + (float(x_244) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_248 = grey; + const float3 x_249 = float3(x_248, x_248, x_248); + x_GLF_color = float4(x_249.x, x_249.y, x_249.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.msl new file mode 100644 index 0000000000..983295be0f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.msl @@ -0,0 +1,328 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_255 = *(from); + k = x_255; + int const x_256 = *(from); + i = x_256; + int const x_257 = *(mid); + j = (x_257 + 1); + while (true) { + int const x_263 = i; + int const x_264 = *(mid); + int const x_266 = j; + int const x_267 = *(to); + if (((x_263 <= x_264) && (x_266 <= x_267))) { + } else { + break; + } + int const x_271 = i; + int const x_273 = (*(tint_symbol_5)).arr[x_271]; + int const x_274 = j; + int const x_276 = (*(tint_symbol_5)).arr[x_274]; + if ((x_273 < x_276)) { + int const x_281 = k; + k = (x_281 + 1); + int const x_283 = i; + i = (x_283 + 1); + int const x_286 = (*(tint_symbol_5)).arr[x_283]; + (*(tint_symbol_6)).arr[x_281] = x_286; + } else { + int const x_288 = k; + k = (x_288 + 1); + int const x_290 = j; + j = (x_290 + 1); + int const x_293 = (*(tint_symbol_5)).arr[x_290]; + (*(tint_symbol_6)).arr[x_288] = x_293; + } + } + while (true) { + int const x_299 = i; + int const x_301 = i; + int const x_302 = *(mid); + if (((x_299 < 10) && (x_301 <= x_302))) { + } else { + break; + } + int const x_306 = k; + k = (x_306 + 1); + int const x_308 = i; + i = (x_308 + 1); + int const x_311 = (*(tint_symbol_5)).arr[x_308]; + (*(tint_symbol_6)).arr[x_306] = x_311; + } + int const x_313 = *(from); + i_1 = x_313; + while (true) { + int const x_318 = i_1; + int const x_319 = *(to); + if ((x_318 <= x_319)) { + } else { + break; + } + int const x_322 = i_1; + int const x_323 = i_1; + int const x_325 = (*(tint_symbol_6)).arr[x_323]; + (*(tint_symbol_5)).arr[x_322] = x_325; + { + int const x_327 = i_1; + i_1 = (x_327 + 1); + } + } + return; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_334 = m; + int const x_335 = high; + if ((x_334 <= x_335)) { + } else { + break; + } + int const x_338 = low; + i_2 = x_338; + while (true) { + int const x_343 = i_2; + int const x_344 = high; + if ((x_343 < x_344)) { + } else { + break; + } + int const x_347 = i_2; + from_1 = x_347; + int const x_348 = i_2; + int const x_349 = m; + mid_1 = ((x_348 + x_349) - 1); + int const x_352 = i_2; + int const x_353 = m; + int const x_357 = high; + to_1 = min(((x_352 + (2 * x_353)) - 1), x_357); + int const x_359 = from_1; + param = x_359; + int const x_360 = mid_1; + param_1 = x_360; + int const x_361 = to_1; + param_2 = x_361; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_363 = m; + int const x_365 = i_2; + i_2 = (x_365 + (2 * x_363)); + } + } + { + int const x_367 = m; + m = (2 * x_367); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_88 = x_28.injectionSwitch.x; + i_3 = int(x_88); + while (true) { + int const x_94 = i_3; + switch(x_94) { + case 9: { + int const x_124 = i_3; + (*(tint_symbol_9)).arr[x_124] = -5; + if (true) { + } else { + { + int const x_128 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + continue; + } + break; + } + case 8: { + int const x_122 = i_3; + (*(tint_symbol_9)).arr[x_122] = -4; + break; + } + case 7: { + int const x_120 = i_3; + (*(tint_symbol_9)).arr[x_120] = -3; + break; + } + case 6: { + int const x_118 = i_3; + (*(tint_symbol_9)).arr[x_118] = -2; + break; + } + case 5: { + int const x_116 = i_3; + (*(tint_symbol_9)).arr[x_116] = -1; + break; + } + case 4: { + int const x_114 = i_3; + (*(tint_symbol_9)).arr[x_114] = 0; + break; + } + case 3: { + int const x_112 = i_3; + (*(tint_symbol_9)).arr[x_112] = 1; + break; + } + case 2: { + int const x_110 = i_3; + (*(tint_symbol_9)).arr[x_110] = 2; + break; + } + case 1: { + int const x_108 = i_3; + (*(tint_symbol_9)).arr[x_108] = 3; + break; + } + case 0: { + int const x_106 = i_3; + (*(tint_symbol_9)).arr[x_106] = 4; + break; + } + default: { + break; + } + } + int const x_126 = i_3; + i_3 = (x_126 + 1); + { + int const x_128 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_134 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + int const x_137 = j_1; + int const x_138 = j_1; + int const x_140 = (*(tint_symbol_9)).arr[x_138]; + (*(tint_symbol_10)).arr[x_137] = x_140; + { + int const x_142 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(tint_symbol_9, tint_symbol_10); + float const x_146 = (*(tint_symbol_11)).y; + if ((int(x_146) < 30)) { + int const x_153 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_153) / 10.0f)); + } else { + float const x_158 = (*(tint_symbol_11)).y; + if ((int(x_158) < 60)) { + int const x_165 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_165) / 10.0f)); + } else { + float const x_170 = (*(tint_symbol_11)).y; + if ((int(x_170) < 90)) { + int const x_177 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_177) / 10.0f)); + } else { + float const x_182 = (*(tint_symbol_11)).y; + if ((int(x_182) < 120)) { + int const x_189 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_189) / 10.0f)); + } else { + float const x_194 = (*(tint_symbol_11)).y; + if ((int(x_194) < 150)) { + discard_fragment(); + } else { + float const x_201 = (*(tint_symbol_11)).y; + if ((int(x_201) < 180)) { + int const x_208 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_208) / 10.0f)); + } else { + float const x_213 = (*(tint_symbol_11)).y; + if ((int(x_213) < 210)) { + int const x_220 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_220) / 10.0f)); + } else { + float const x_225 = (*(tint_symbol_11)).y; + if ((int(x_225) < 240)) { + int const x_232 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_232) / 10.0f)); + } else { + float const x_237 = (*(tint_symbol_11)).y; + if ((int(x_237) < 270)) { + int const x_244 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_244) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_248 = grey; + float3 const x_249 = float3(x_248, x_248, x_248); + *(tint_symbol_12) = float4(x_249.x, x_249.y, x_249.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..a382317bf6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.spvasm @@ -0,0 +1,668 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 423 +; Schema: 0 + OpCapability Shader + %180 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_32 "x_32" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_32 NonWritable + OpDecorate %x_32 DescriptorSet 0 + OpDecorate %x_32 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_32 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %35 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %135 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %204 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %true = OpConstantTrue %bool + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %410 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %26 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %33 = OpLabel + %k = OpVariable %_ptr_Function_int Function %35 + %i = OpVariable %_ptr_Function_int Function %35 + %j = OpVariable %_ptr_Function_int Function %35 + %i_1 = OpVariable %_ptr_Function_int Function %35 + %40 = OpLoad %int %from + OpStore %k %40 + %42 = OpLoad %int %from + OpStore %i %42 + %44 = OpLoad %int %mid + %46 = OpIAdd %int %44 %int_1 + OpStore %j %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i + %53 = OpLoad %int %mid + %54 = OpLoad %int %j + %56 = OpLoad %int %to + %57 = OpSLessThanEqual %bool %51 %53 + OpSelectionMerge %59 None + OpBranchConditional %57 %60 %59 + %60 = OpLabel + %61 = OpSLessThanEqual %bool %54 %56 + OpBranch %59 + %59 = OpLabel + %62 = OpPhi %bool %57 %50 %61 %60 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %48 + %63 = OpLabel + %66 = OpLoad %int %i + %68 = OpAccessChain %_ptr_Private_int %data %66 + %69 = OpLoad %int %68 + %70 = OpLoad %int %j + %71 = OpAccessChain %_ptr_Private_int %data %70 + %72 = OpLoad %int %71 + %73 = OpSLessThan %bool %69 %72 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %77 = OpLoad %int %k + %78 = OpIAdd %int %77 %int_1 + OpStore %k %78 + %79 = OpLoad %int %i + %80 = OpIAdd %int %79 %int_1 + OpStore %i %80 + %81 = OpAccessChain %_ptr_Private_int %data %79 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Private_int %temp %77 + OpStore %83 %82 + OpBranch %74 + %76 = OpLabel + %84 = OpLoad %int %k + %85 = OpIAdd %int %84 %int_1 + OpStore %k %85 + %86 = OpLoad %int %j + %87 = OpIAdd %int %86 %int_1 + OpStore %j %87 + %88 = OpAccessChain %_ptr_Private_int %data %86 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Private_int %temp %84 + OpStore %90 %89 + OpBranch %74 + %74 = OpLabel + OpBranch %49 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %i + %96 = OpLoad %int %i + %98 = OpLoad %int %mid + %100 = OpSLessThan %bool %95 %int_10 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpSLessThanEqual %bool %96 %98 + OpBranch %101 + %101 = OpLabel + %104 = OpPhi %bool %100 %94 %103 %102 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %107 + %106 = OpLabel + OpBranch %105 + %107 = OpLabel + OpBranch %92 + %105 = OpLabel + %108 = OpLoad %int %k + %109 = OpIAdd %int %108 %int_1 + OpStore %k %109 + %110 = OpLoad %int %i + %111 = OpIAdd %int %110 %int_1 + OpStore %i %111 + %112 = OpAccessChain %_ptr_Private_int %data %110 + %113 = OpLoad %int %112 + %114 = OpAccessChain %_ptr_Private_int %temp %108 + OpStore %114 %113 + OpBranch %93 + %93 = OpLabel + OpBranch %91 + %92 = OpLabel + %116 = OpLoad %int %from + OpStore %i_1 %116 + OpBranch %117 + %117 = OpLabel + OpLoopMerge %118 %119 None + OpBranch %120 + %120 = OpLabel + %121 = OpLoad %int %i_1 + %123 = OpLoad %int %to + %124 = OpSLessThanEqual %bool %121 %123 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %127 + %126 = OpLabel + OpBranch %125 + %127 = OpLabel + OpBranch %118 + %125 = OpLabel + %128 = OpLoad %int %i_1 + %129 = OpLoad %int %i_1 + %130 = OpAccessChain %_ptr_Private_int %temp %129 + %131 = OpLoad %int %130 + %132 = OpAccessChain %_ptr_Private_int %data %128 + OpStore %132 %131 + OpBranch %119 + %119 = OpLabel + %133 = OpLoad %int %i_1 + %134 = OpIAdd %int %133 %int_1 + OpStore %i_1 %134 + OpBranch %117 + %118 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %135 + %137 = OpLabel + %low = OpVariable %_ptr_Function_int Function %35 + %high = OpVariable %_ptr_Function_int Function %35 + %m = OpVariable %_ptr_Function_int Function %35 + %i_2 = OpVariable %_ptr_Function_int Function %35 + %from_1 = OpVariable %_ptr_Function_int Function %35 + %mid_1 = OpVariable %_ptr_Function_int Function %35 + %to_1 = OpVariable %_ptr_Function_int Function %35 + %param = OpVariable %_ptr_Function_int Function %35 + %param_1 = OpVariable %_ptr_Function_int Function %35 + %param_2 = OpVariable %_ptr_Function_int Function %35 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %154 = OpLoad %int %m + %155 = OpLoad %int %high + %156 = OpSLessThanEqual %bool %154 %155 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %159 + %158 = OpLabel + OpBranch %157 + %159 = OpLabel + OpBranch %151 + %157 = OpLabel + %160 = OpLoad %int %low + OpStore %i_2 %160 + OpBranch %161 + %161 = OpLabel + OpLoopMerge %162 %163 None + OpBranch %164 + %164 = OpLabel + %165 = OpLoad %int %i_2 + %166 = OpLoad %int %high + %167 = OpSLessThan %bool %165 %166 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %162 + %168 = OpLabel + %171 = OpLoad %int %i_2 + OpStore %from_1 %171 + %172 = OpLoad %int %i_2 + %173 = OpLoad %int %m + %174 = OpIAdd %int %172 %173 + %175 = OpISub %int %174 %int_1 + OpStore %mid_1 %175 + %176 = OpLoad %int %i_2 + %177 = OpLoad %int %m + %178 = OpLoad %int %high + %182 = OpIMul %int %int_2 %177 + %183 = OpIAdd %int %176 %182 + %184 = OpISub %int %183 %int_1 + %179 = OpExtInst %int %180 SMin %184 %178 + OpStore %to_1 %179 + %185 = OpLoad %int %from_1 + OpStore %param %185 + %186 = OpLoad %int %mid_1 + OpStore %param_1 %186 + %187 = OpLoad %int %to_1 + OpStore %param_2 %187 + %188 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %163 + %163 = OpLabel + %192 = OpLoad %int %m + %193 = OpLoad %int %i_2 + %194 = OpIMul %int %int_2 %192 + %195 = OpIAdd %int %193 %194 + OpStore %i_2 %195 + OpBranch %161 + %162 = OpLabel + OpBranch %152 + %152 = OpLabel + %196 = OpLoad %int %m + %197 = OpIMul %int %int_2 %196 + OpStore %m %197 + OpBranch %150 + %151 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %135 + %199 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %35 + %j_1 = OpVariable %_ptr_Function_int Function %35 + %grey = OpVariable %_ptr_Function_float Function %204 + %207 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %208 = OpLoad %float %207 + %209 = OpConvertFToS %int %208 + OpStore %i_3 %209 + OpBranch %210 + %210 = OpLabel + OpLoopMerge %211 %212 None + OpBranch %213 + %213 = OpLabel + %214 = OpLoad %int %i_3 + OpSelectionMerge %215 None + OpSwitch %214 %216 9 %217 8 %218 7 %219 6 %220 5 %221 4 %222 3 %223 2 %224 1 %225 0 %226 + %217 = OpLabel + %227 = OpLoad %int %i_3 + %228 = OpAccessChain %_ptr_Private_int %data %227 + OpStore %228 %int_n5 + OpSelectionMerge %231 None + OpBranchConditional %true %232 %233 + %232 = OpLabel + OpBranch %231 + %233 = OpLabel + OpBranch %212 + %231 = OpLabel + OpBranch %215 + %218 = OpLabel + %234 = OpLoad %int %i_3 + %235 = OpAccessChain %_ptr_Private_int %data %234 + OpStore %235 %int_n4 + OpBranch %215 + %219 = OpLabel + %237 = OpLoad %int %i_3 + %238 = OpAccessChain %_ptr_Private_int %data %237 + OpStore %238 %int_n3 + OpBranch %215 + %220 = OpLabel + %240 = OpLoad %int %i_3 + %241 = OpAccessChain %_ptr_Private_int %data %240 + OpStore %241 %int_n2 + OpBranch %215 + %221 = OpLabel + %243 = OpLoad %int %i_3 + %244 = OpAccessChain %_ptr_Private_int %data %243 + OpStore %244 %int_n1 + OpBranch %215 + %222 = OpLabel + %246 = OpLoad %int %i_3 + %247 = OpAccessChain %_ptr_Private_int %data %246 + OpStore %247 %int_0 + OpBranch %215 + %223 = OpLabel + %248 = OpLoad %int %i_3 + %249 = OpAccessChain %_ptr_Private_int %data %248 + OpStore %249 %int_1 + OpBranch %215 + %224 = OpLabel + %250 = OpLoad %int %i_3 + %251 = OpAccessChain %_ptr_Private_int %data %250 + OpStore %251 %int_2 + OpBranch %215 + %225 = OpLabel + %252 = OpLoad %int %i_3 + %253 = OpAccessChain %_ptr_Private_int %data %252 + OpStore %253 %int_3 + OpBranch %215 + %226 = OpLabel + %255 = OpLoad %int %i_3 + %256 = OpAccessChain %_ptr_Private_int %data %255 + OpStore %256 %int_4 + OpBranch %215 + %216 = OpLabel + OpBranch %215 + %215 = OpLabel + %258 = OpLoad %int %i_3 + %259 = OpIAdd %int %258 %int_1 + OpStore %i_3 %259 + OpBranch %212 + %212 = OpLabel + %260 = OpLoad %int %i_3 + %261 = OpSLessThan %bool %260 %int_10 + OpSelectionMerge %262 None + OpBranchConditional %261 %263 %264 + %263 = OpLabel + OpBranch %262 + %264 = OpLabel + OpBranch %211 + %262 = OpLabel + OpBranch %210 + %211 = OpLabel + OpStore %j_1 %int_0 + OpBranch %265 + %265 = OpLabel + OpLoopMerge %266 %267 None + OpBranch %268 + %268 = OpLabel + %269 = OpLoad %int %j_1 + %270 = OpSLessThan %bool %269 %int_10 + OpSelectionMerge %271 None + OpBranchConditional %270 %272 %273 + %272 = OpLabel + OpBranch %271 + %273 = OpLabel + OpBranch %266 + %271 = OpLabel + %274 = OpLoad %int %j_1 + %275 = OpLoad %int %j_1 + %276 = OpAccessChain %_ptr_Private_int %data %275 + %277 = OpLoad %int %276 + %278 = OpAccessChain %_ptr_Private_int %temp %274 + OpStore %278 %277 + OpBranch %267 + %267 = OpLabel + %279 = OpLoad %int %j_1 + %280 = OpIAdd %int %279 %int_1 + OpStore %j_1 %280 + OpBranch %265 + %266 = OpLabel + %281 = OpFunctionCall %void %mergeSort_ + %284 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %285 = OpLoad %float %284 + %286 = OpConvertFToS %int %285 + %288 = OpSLessThan %bool %286 %int_30 + OpSelectionMerge %289 None + OpBranchConditional %288 %290 %291 + %290 = OpLabel + %292 = OpAccessChain %_ptr_Private_int %data %int_0 + %293 = OpLoad %int %292 + %295 = OpConvertSToF %float %293 + %297 = OpFDiv %float %295 %float_10 + %298 = OpFAdd %float %float_0_5 %297 + OpStore %grey %298 + OpBranch %289 + %291 = OpLabel + %299 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %300 = OpLoad %float %299 + %301 = OpConvertFToS %int %300 + %303 = OpSLessThan %bool %301 %int_60 + OpSelectionMerge %304 None + OpBranchConditional %303 %305 %306 + %305 = OpLabel + %307 = OpAccessChain %_ptr_Private_int %data %int_1 + %308 = OpLoad %int %307 + %309 = OpConvertSToF %float %308 + %310 = OpFDiv %float %309 %float_10 + %311 = OpFAdd %float %float_0_5 %310 + OpStore %grey %311 + OpBranch %304 + %306 = OpLabel + %312 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %313 = OpLoad %float %312 + %314 = OpConvertFToS %int %313 + %316 = OpSLessThan %bool %314 %int_90 + OpSelectionMerge %317 None + OpBranchConditional %316 %318 %319 + %318 = OpLabel + %320 = OpAccessChain %_ptr_Private_int %data %int_2 + %321 = OpLoad %int %320 + %322 = OpConvertSToF %float %321 + %323 = OpFDiv %float %322 %float_10 + %324 = OpFAdd %float %float_0_5 %323 + OpStore %grey %324 + OpBranch %317 + %319 = OpLabel + %325 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %326 = OpLoad %float %325 + %327 = OpConvertFToS %int %326 + %329 = OpSLessThan %bool %327 %int_120 + OpSelectionMerge %330 None + OpBranchConditional %329 %331 %332 + %331 = OpLabel + %333 = OpAccessChain %_ptr_Private_int %data %int_3 + %334 = OpLoad %int %333 + %335 = OpConvertSToF %float %334 + %336 = OpFDiv %float %335 %float_10 + %337 = OpFAdd %float %float_0_5 %336 + OpStore %grey %337 + OpBranch %330 + %332 = OpLabel + %338 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %339 = OpLoad %float %338 + %340 = OpConvertFToS %int %339 + %342 = OpSLessThan %bool %340 %int_150 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %345 + %344 = OpLabel + OpKill + %345 = OpLabel + %346 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %347 = OpLoad %float %346 + %348 = OpConvertFToS %int %347 + %350 = OpSLessThan %bool %348 %int_180 + OpSelectionMerge %351 None + OpBranchConditional %350 %352 %353 + %352 = OpLabel + %355 = OpAccessChain %_ptr_Private_int %data %int_5 + %356 = OpLoad %int %355 + %357 = OpConvertSToF %float %356 + %358 = OpFDiv %float %357 %float_10 + %359 = OpFAdd %float %float_0_5 %358 + OpStore %grey %359 + OpBranch %351 + %353 = OpLabel + %360 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %361 = OpLoad %float %360 + %362 = OpConvertFToS %int %361 + %364 = OpSLessThan %bool %362 %int_210 + OpSelectionMerge %365 None + OpBranchConditional %364 %366 %367 + %366 = OpLabel + %369 = OpAccessChain %_ptr_Private_int %data %int_6 + %370 = OpLoad %int %369 + %371 = OpConvertSToF %float %370 + %372 = OpFDiv %float %371 %float_10 + %373 = OpFAdd %float %float_0_5 %372 + OpStore %grey %373 + OpBranch %365 + %367 = OpLabel + %374 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %375 = OpLoad %float %374 + %376 = OpConvertFToS %int %375 + %378 = OpSLessThan %bool %376 %int_240 + OpSelectionMerge %379 None + OpBranchConditional %378 %380 %381 + %380 = OpLabel + %383 = OpAccessChain %_ptr_Private_int %data %int_7 + %384 = OpLoad %int %383 + %385 = OpConvertSToF %float %384 + %386 = OpFDiv %float %385 %float_10 + %387 = OpFAdd %float %float_0_5 %386 + OpStore %grey %387 + OpBranch %379 + %381 = OpLabel + %388 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %389 = OpLoad %float %388 + %390 = OpConvertFToS %int %389 + %392 = OpSLessThan %bool %390 %int_270 + OpSelectionMerge %393 None + OpBranchConditional %392 %394 %395 + %394 = OpLabel + %397 = OpAccessChain %_ptr_Private_int %data %int_8 + %398 = OpLoad %int %397 + %399 = OpConvertSToF %float %398 + %400 = OpFDiv %float %399 %float_10 + %401 = OpFAdd %float %float_0_5 %400 + OpStore %grey %401 + OpBranch %393 + %395 = OpLabel + OpKill + %393 = OpLabel + OpBranch %379 + %379 = OpLabel + OpBranch %365 + %365 = OpLabel + OpBranch %351 + %351 = OpLabel + OpBranch %343 + %343 = OpLabel + OpBranch %330 + %330 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %304 + %304 = OpLabel + OpBranch %289 + %289 = OpLabel + %402 = OpLoad %float %grey + %404 = OpCompositeConstruct %v3float %402 %402 %402 + %405 = OpCompositeExtract %float %404 0 + %406 = OpCompositeExtract %float %404 1 + %407 = OpCompositeExtract %float %404 2 + %409 = OpCompositeConstruct %v4float %405 %406 %407 %float_1 + OpStore %x_GLF_color %409 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %410 +%tint_symbol_1 = OpFunctionParameter %main_out + %414 = OpLabel + %415 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %415 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %135 + %417 = OpLabel + %418 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %418 + %419 = OpFunctionCall %void %main_1 + %421 = OpLoad %v4float %x_GLF_color + %422 = OpCompositeConstruct %main_out %421 + %420 = OpFunctionCall %void %tint_symbol_3 %422 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 212[%212] is not post dominated by the back-edge block 262[%262] + %262 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..b969e06e6b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block/1.wgsl.expected.wgsl @@ -0,0 +1,317 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_32 : buf1; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_255 : i32 = *(from); + k = x_255; + let x_256 : i32 = *(from); + i = x_256; + let x_257 : i32 = *(mid); + j = (x_257 + 1); + loop { + let x_263 : i32 = i; + let x_264 : i32 = *(mid); + let x_266 : i32 = j; + let x_267 : i32 = *(to); + if (((x_263 <= x_264) && (x_266 <= x_267))) { + } else { + break; + } + let x_271 : i32 = i; + let x_273 : i32 = data[x_271]; + let x_274 : i32 = j; + let x_276 : i32 = data[x_274]; + if ((x_273 < x_276)) { + let x_281 : i32 = k; + k = (x_281 + 1); + let x_283 : i32 = i; + i = (x_283 + 1); + let x_286 : i32 = data[x_283]; + temp[x_281] = x_286; + } else { + let x_288 : i32 = k; + k = (x_288 + 1); + let x_290 : i32 = j; + j = (x_290 + 1); + let x_293 : i32 = data[x_290]; + temp[x_288] = x_293; + } + } + loop { + let x_299 : i32 = i; + let x_301 : i32 = i; + let x_302 : i32 = *(mid); + if (((x_299 < 10) && (x_301 <= x_302))) { + } else { + break; + } + let x_306 : i32 = k; + k = (x_306 + 1); + let x_308 : i32 = i; + i = (x_308 + 1); + let x_311 : i32 = data[x_308]; + temp[x_306] = x_311; + } + let x_313 : i32 = *(from); + i_1 = x_313; + loop { + let x_318 : i32 = i_1; + let x_319 : i32 = *(to); + if ((x_318 <= x_319)) { + } else { + break; + } + let x_322 : i32 = i_1; + let x_323 : i32 = i_1; + let x_325 : i32 = temp[x_323]; + data[x_322] = x_325; + + continuing { + let x_327 : i32 = i_1; + i_1 = (x_327 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_334 : i32 = m; + let x_335 : i32 = high; + if ((x_334 <= x_335)) { + } else { + break; + } + let x_338 : i32 = low; + i_2 = x_338; + loop { + let x_343 : i32 = i_2; + let x_344 : i32 = high; + if ((x_343 < x_344)) { + } else { + break; + } + let x_347 : i32 = i_2; + from_1 = x_347; + let x_348 : i32 = i_2; + let x_349 : i32 = m; + mid_1 = ((x_348 + x_349) - 1); + let x_352 : i32 = i_2; + let x_353 : i32 = m; + let x_357 : i32 = high; + to_1 = min(((x_352 + (2 * x_353)) - 1), x_357); + let x_359 : i32 = from_1; + param = x_359; + let x_360 : i32 = mid_1; + param_1 = x_360; + let x_361 : i32 = to_1; + param_2 = x_361; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_363 : i32 = m; + let x_365 : i32 = i_2; + i_2 = (x_365 + (2 * x_363)); + } + } + + continuing { + let x_367 : i32 = m; + m = (2 * x_367); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_88 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_88); + loop { + let x_94 : i32 = i_3; + switch(x_94) { + case 9: { + let x_124 : i32 = i_3; + data[x_124] = -5; + if (true) { + } else { + continue; + } + } + case 8: { + let x_122 : i32 = i_3; + data[x_122] = -4; + } + case 7: { + let x_120 : i32 = i_3; + data[x_120] = -3; + } + case 6: { + let x_118 : i32 = i_3; + data[x_118] = -2; + } + case 5: { + let x_116 : i32 = i_3; + data[x_116] = -1; + } + case 4: { + let x_114 : i32 = i_3; + data[x_114] = 0; + } + case 3: { + let x_112 : i32 = i_3; + data[x_112] = 1; + } + case 2: { + let x_110 : i32 = i_3; + data[x_110] = 2; + } + case 1: { + let x_108 : i32 = i_3; + data[x_108] = 3; + } + case 0: { + let x_106 : i32 = i_3; + data[x_106] = 4; + } + default: { + } + } + let x_126 : i32 = i_3; + i_3 = (x_126 + 1); + + continuing { + let x_128 : i32 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_134 : i32 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + let x_137 : i32 = j_1; + let x_138 : i32 = j_1; + let x_140 : i32 = data[x_138]; + temp[x_137] = x_140; + + continuing { + let x_142 : i32 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(); + let x_146 : f32 = gl_FragCoord.y; + if ((i32(x_146) < 30)) { + let x_153 : i32 = data[0]; + grey = (0.5 + (f32(x_153) / 10.0)); + } else { + let x_158 : f32 = gl_FragCoord.y; + if ((i32(x_158) < 60)) { + let x_165 : i32 = data[1]; + grey = (0.5 + (f32(x_165) / 10.0)); + } else { + let x_170 : f32 = gl_FragCoord.y; + if ((i32(x_170) < 90)) { + let x_177 : i32 = data[2]; + grey = (0.5 + (f32(x_177) / 10.0)); + } else { + let x_182 : f32 = gl_FragCoord.y; + if ((i32(x_182) < 120)) { + let x_189 : i32 = data[3]; + grey = (0.5 + (f32(x_189) / 10.0)); + } else { + let x_194 : f32 = gl_FragCoord.y; + if ((i32(x_194) < 150)) { + discard; + } else { + let x_201 : f32 = gl_FragCoord.y; + if ((i32(x_201) < 180)) { + let x_208 : i32 = data[5]; + grey = (0.5 + (f32(x_208) / 10.0)); + } else { + let x_213 : f32 = gl_FragCoord.y; + if ((i32(x_213) < 210)) { + let x_220 : i32 = data[6]; + grey = (0.5 + (f32(x_220) / 10.0)); + } else { + let x_225 : f32 = gl_FragCoord.y; + if ((i32(x_225) < 240)) { + let x_232 : i32 = data[7]; + grey = (0.5 + (f32(x_232) / 10.0)); + } else { + let x_237 : f32 = gl_FragCoord.y; + if ((i32(x_237) < 270)) { + let x_244 : i32 = data[8]; + grey = (0.5 + (f32(x_244) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_248 : f32 = grey; + let x_249 : vec3 = vec3(x_248, x_248, x_248); + x_GLF_color = vec4(x_249.x, x_249.y, x_249.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm new file mode 100644 index 0000000000..9da572bc3e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm @@ -0,0 +1,177 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %_ "" + OpName %data "data" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_10 = OpConstant %int 10 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_5 = OpConstant %int 5 + %float_1 = OpConstant %float 1 + %float_0_5 = OpConstant %float 0.5 +%float_0_100000001 = OpConstant %float 0.100000001 + %main = OpFunction %void None %11 + %38 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function + OpBranch %39 + %39 = OpLabel + %40 = OpPhi %int %int_0 %38 %41 %42 + %43 = OpSLessThan %bool %40 %int_10 + OpLoopMerge %44 %42 None + OpBranchConditional %43 %42 %44 + %42 = OpLabel + %45 = OpISub %int %int_10 %40 + %46 = OpConvertSToF %float %45 + %47 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %48 = OpLoad %float %47 + %49 = OpFMul %float %46 %48 + %50 = OpAccessChain %_ptr_Function_float %data %40 + OpStore %50 %49 + %41 = OpIAdd %int %40 %int_1 + OpBranch %39 + %44 = OpLabel + OpBranch %51 + %51 = OpLabel + %52 = OpPhi %int %int_0 %44 %53 %54 + %55 = OpSLessThan %bool %52 %int_9 + OpLoopMerge %56 %54 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + OpBranch %58 + %58 = OpLabel + %59 = OpPhi %int %int_0 %57 %60 %61 + %62 = OpSLessThan %bool %59 %int_10 + OpLoopMerge %63 %61 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + %65 = OpIAdd %int %52 %int_1 + %66 = OpSLessThan %bool %59 %65 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %67 + %68 = OpLabel + OpBranch %61 + %67 = OpLabel + %69 = OpAccessChain %_ptr_Function_float %data %52 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Function_float %data %59 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %74 = OpLoad %float %73 + %75 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %76 = OpLoad %float %75 + %77 = OpFMul %float %76 %float_0_5 + %78 = OpFOrdLessThan %bool %74 %77 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %81 + %80 = OpLabel + %82 = OpFOrdGreaterThan %bool %70 %72 + OpBranch %79 + %81 = OpLabel + %83 = OpFOrdLessThan %bool %70 %72 + OpBranch %79 + %79 = OpLabel + %84 = OpPhi %bool %82 %80 %83 %81 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + %87 = OpLoad %float %69 + %88 = OpLoad %float %71 + OpStore %69 %88 + OpStore %71 %87 + OpBranch %85 + %85 = OpLabel + OpBranch %61 + %61 = OpLabel + %60 = OpIAdd %int %59 %int_1 + OpBranch %58 + %63 = OpLabel + OpBranch %54 + %54 = OpLabel + %53 = OpIAdd %int %52 %int_1 + OpBranch %51 + %56 = OpLabel + %89 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %92 = OpLoad %float %91 + %93 = OpFMul %float %92 %float_0_5 + %94 = OpFOrdLessThan %bool %90 %93 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %97 + %96 = OpLabel + %98 = OpAccessChain %_ptr_Function_float %data %int_0 + %99 = OpLoad %float %98 + %100 = OpFMul %float %99 %float_0_100000001 + %101 = OpAccessChain %_ptr_Function_float %data %int_5 + %102 = OpLoad %float %101 + %103 = OpFMul %float %102 %float_0_100000001 + %104 = OpAccessChain %_ptr_Function_float %data %int_9 + %105 = OpLoad %float %104 + %106 = OpFMul %float %105 %float_0_100000001 + %107 = OpCompositeConstruct %v4float %100 %103 %106 %float_1 + OpStore %_GLF_color %107 + OpBranch %95 + %97 = OpLabel + %108 = OpAccessChain %_ptr_Function_float %data %int_5 + %109 = OpLoad %float %108 + %110 = OpFMul %float %109 %float_0_100000001 + %111 = OpAccessChain %_ptr_Function_float %data %int_9 + %112 = OpLoad %float %111 + %113 = OpFMul %float %112 %float_0_100000001 + %114 = OpAccessChain %_ptr_Function_float %data %int_0 + %115 = OpLoad %float %114 + %116 = OpFMul %float %115 %float_0_100000001 + %117 = OpCompositeConstruct %v4float %110 %113 %116 %float_1 + OpStore %_GLF_color %117 + OpBranch %95 + %95 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..059390e488 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.hlsl @@ -0,0 +1,118 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float data[10] = (float[10])0; + int x_40_phi = 0; + int x_52_phi = 0; + x_40_phi = 0; + while (true) { + int x_41 = 0; + const int x_40 = x_40_phi; + if ((x_40 < 10)) { + } else { + break; + } + { + const float x_48 = asfloat(x_9[0].y); + data[x_40] = (float((10 - x_40)) * x_48); + x_41 = (x_40 + 1); + x_40_phi = x_41; + } + } + x_52_phi = 0; + while (true) { + int x_53 = 0; + int x_59_phi = 0; + const int x_52 = x_52_phi; + if ((x_52 < 9)) { + } else { + break; + } + x_59_phi = 0; + while (true) { + bool x_82 = false; + bool x_83 = false; + int x_60 = 0; + bool x_84_phi = false; + const int x_59 = x_59_phi; + if ((x_59 < 10)) { + } else { + break; + } + if ((x_59 < (x_52 + 1))) { + { + x_60 = (x_59 + 1); + x_59_phi = x_60; + } + continue; + } + const int x_69_save = x_52; + const float x_70 = data[x_69_save]; + const int x_71_save = x_59; + const float x_72 = data[x_71_save]; + const float x_74 = gl_FragCoord.y; + const float x_76 = asfloat(x_6[0].y); + if ((x_74 < (x_76 * 0.5f))) { + x_82 = (x_70 > x_72); + x_84_phi = x_82; + } else { + x_83 = (x_70 < x_72); + x_84_phi = x_83; + } + if (x_84_phi) { + const float x_87 = data[x_69_save]; + const float x_88 = data[x_71_save]; + data[x_69_save] = x_88; + data[x_71_save] = x_87; + } + { + x_60 = (x_59 + 1); + x_59_phi = x_60; + } + } + { + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + const float x_90 = gl_FragCoord.x; + const float x_92 = asfloat(x_6[0].x); + if ((x_90 < (x_92 * 0.5f))) { + const float x_99 = data[0]; + const float x_102 = data[5]; + const float x_105 = data[9]; + x_GLF_color = float4((x_99 * 0.100000001f), (x_102 * 0.100000001f), (x_105 * 0.100000001f), 1.0f); + } else { + const float x_109 = data[5]; + const float x_112 = data[9]; + const float x_115 = data[0]; + x_GLF_color = float4((x_109 * 0.100000001f), (x_112 * 0.100000001f), (x_115 * 0.100000001f), 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.msl new file mode 100644 index 0000000000..45769f1fe4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.msl @@ -0,0 +1,121 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_9, constant buf1& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + tint_array_wrapper data = {}; + int x_40_phi = 0; + int x_52_phi = 0; + x_40_phi = 0; + while (true) { + int x_41 = 0; + int const x_40 = x_40_phi; + if ((x_40 < 10)) { + } else { + break; + } + { + float const x_48 = x_9.injectionSwitch.y; + data.arr[x_40] = (float((10 - x_40)) * x_48); + x_41 = (x_40 + 1); + x_40_phi = x_41; + } + } + x_52_phi = 0; + while (true) { + int x_53 = 0; + int x_59_phi = 0; + int const x_52 = x_52_phi; + if ((x_52 < 9)) { + } else { + break; + } + x_59_phi = 0; + while (true) { + bool x_82 = false; + bool x_83 = false; + int x_60 = 0; + bool x_84_phi = false; + int const x_59 = x_59_phi; + if ((x_59 < 10)) { + } else { + break; + } + if ((x_59 < (x_52 + 1))) { + { + x_60 = (x_59 + 1); + x_59_phi = x_60; + } + continue; + } + int const x_69_save = x_52; + float const x_70 = data.arr[x_69_save]; + int const x_71_save = x_59; + float const x_72 = data.arr[x_71_save]; + float const x_74 = (*(tint_symbol_5)).y; + float const x_76 = x_6.resolution.y; + if ((x_74 < (x_76 * 0.5f))) { + x_82 = (x_70 > x_72); + x_84_phi = x_82; + } else { + x_83 = (x_70 < x_72); + x_84_phi = x_83; + } + bool const x_84 = x_84_phi; + if (x_84) { + float const x_87 = data.arr[x_69_save]; + float const x_88 = data.arr[x_71_save]; + data.arr[x_69_save] = x_88; + data.arr[x_71_save] = x_87; + } + { + x_60 = (x_59 + 1); + x_59_phi = x_60; + } + } + { + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + float const x_90 = (*(tint_symbol_5)).x; + float const x_92 = x_6.resolution.x; + if ((x_90 < (x_92 * 0.5f))) { + float const x_99 = data.arr[0]; + float const x_102 = data.arr[5]; + float const x_105 = data.arr[9]; + *(tint_symbol_6) = float4((x_99 * 0.100000001f), (x_102 * 0.100000001f), (x_105 * 0.100000001f), 1.0f); + } else { + float const x_109 = data.arr[5]; + float const x_112 = data.arr[9]; + float const x_115 = data.arr[0]; + *(tint_symbol_6) = float4((x_109 * 0.100000001f), (x_112 * 0.100000001f), (x_115 * 0.100000001f), 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_9 [[buffer(0)]], constant buf1& x_6 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_9, x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..43b700f91b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.spvasm @@ -0,0 +1,282 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 167 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %data "data" + OpName %x_40_phi "x_40_phi" + OpName %x_52_phi "x_52_phi" + OpName %x_41 "x_41" + OpName %x_53 "x_53" + OpName %x_59_phi "x_59_phi" + OpName %x_82 "x_82" + OpName %x_83 "x_83" + OpName %x_60 "x_60" + OpName %x_84_phi "x_84_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %27 = OpConstantNull %_arr_float_uint_10 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 +%_ptr_Function_bool = OpTypePointer Function %bool + %77 = OpConstantNull %bool +%_ptr_Private_float = OpTypePointer Private %float + %float_0_5 = OpConstant %float 0.5 + %int_5 = OpConstant %int 5 +%float_0_100000001 = OpConstant %float 0.100000001 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %154 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function %27 + %x_40_phi = OpVariable %_ptr_Function_int Function %31 + %x_52_phi = OpVariable %_ptr_Function_int Function %31 + %x_41 = OpVariable %_ptr_Function_int Function %31 + %x_53 = OpVariable %_ptr_Function_int Function %31 + %x_59_phi = OpVariable %_ptr_Function_int Function %31 + %x_82 = OpVariable %_ptr_Function_bool Function %77 + %x_83 = OpVariable %_ptr_Function_bool Function %77 + %x_60 = OpVariable %_ptr_Function_int Function %31 + %x_84_phi = OpVariable %_ptr_Function_bool Function %77 + OpStore %x_40_phi %int_0 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %39 = OpLoad %int %x_40_phi + %41 = OpSLessThan %bool %39 %int_10 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %35 + %43 = OpLabel + OpBranch %36 + %36 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Function_float %data %39 + %54 = OpISub %int %int_10 %39 + %53 = OpConvertSToF %float %54 + %55 = OpFMul %float %53 %50 + OpStore %52 %55 + %57 = OpIAdd %int %39 %int_1 + OpStore %x_41 %57 + %58 = OpLoad %int %x_41 + OpStore %x_40_phi %58 + OpBranch %34 + %35 = OpLabel + OpStore %x_52_phi %int_0 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %65 = OpLoad %int %x_52_phi + %67 = OpSLessThan %bool %65 %int_9 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %60 + %68 = OpLabel + OpStore %x_59_phi %int_0 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %81 = OpLoad %int %x_59_phi + %82 = OpSLessThan %bool %81 %int_10 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + OpBranch %83 + %85 = OpLabel + OpBranch %72 + %83 = OpLabel + %86 = OpIAdd %int %65 %int_1 + %87 = OpSLessThan %bool %81 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + OpBranch %73 + %88 = OpLabel + %90 = OpAccessChain %_ptr_Function_float %data %65 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Function_float %data %81 + %93 = OpLoad %float %92 + %95 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %96 = OpLoad %float %95 + %97 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %98 = OpLoad %float %97 + %100 = OpFMul %float %98 %float_0_5 + %101 = OpFOrdLessThan %bool %96 %100 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + %105 = OpFOrdGreaterThan %bool %91 %93 + OpStore %x_82 %105 + %106 = OpLoad %bool %x_82 + OpStore %x_84_phi %106 + OpBranch %102 + %104 = OpLabel + %107 = OpFOrdLessThan %bool %91 %93 + OpStore %x_83 %107 + %108 = OpLoad %bool %x_83 + OpStore %x_84_phi %108 + OpBranch %102 + %102 = OpLabel + %109 = OpLoad %bool %x_84_phi + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpAccessChain %_ptr_Function_float %data %65 + %113 = OpLoad %float %112 + %114 = OpAccessChain %_ptr_Function_float %data %81 + %115 = OpLoad %float %114 + %116 = OpAccessChain %_ptr_Function_float %data %65 + OpStore %116 %115 + %117 = OpAccessChain %_ptr_Function_float %data %81 + OpStore %117 %113 + OpBranch %110 + %110 = OpLabel + OpBranch %73 + %73 = OpLabel + %118 = OpIAdd %int %81 %int_1 + OpStore %x_60 %118 + %119 = OpLoad %int %x_60 + OpStore %x_59_phi %119 + OpBranch %71 + %72 = OpLabel + OpBranch %61 + %61 = OpLabel + %120 = OpIAdd %int %65 %int_1 + OpStore %x_53 %120 + %121 = OpLoad %int %x_53 + OpStore %x_52_phi %121 + OpBranch %59 + %60 = OpLabel + %122 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %123 = OpLoad %float %122 + %124 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %125 = OpLoad %float %124 + %126 = OpFMul %float %125 %float_0_5 + %127 = OpFOrdLessThan %bool %123 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %130 + %129 = OpLabel + %131 = OpAccessChain %_ptr_Function_float %data %int_0 + %132 = OpLoad %float %131 + %134 = OpAccessChain %_ptr_Function_float %data %int_5 + %135 = OpLoad %float %134 + %136 = OpAccessChain %_ptr_Function_float %data %int_9 + %137 = OpLoad %float %136 + %139 = OpFMul %float %132 %float_0_100000001 + %140 = OpFMul %float %135 %float_0_100000001 + %141 = OpFMul %float %137 %float_0_100000001 + %143 = OpCompositeConstruct %v4float %139 %140 %141 %float_1 + OpStore %x_GLF_color %143 + OpBranch %128 + %130 = OpLabel + %144 = OpAccessChain %_ptr_Function_float %data %int_5 + %145 = OpLoad %float %144 + %146 = OpAccessChain %_ptr_Function_float %data %int_9 + %147 = OpLoad %float %146 + %148 = OpAccessChain %_ptr_Function_float %data %int_0 + %149 = OpLoad %float %148 + %150 = OpFMul %float %145 %float_0_100000001 + %151 = OpFMul %float %147 %float_0_100000001 + %152 = OpFMul %float %149 %float_0_100000001 + %153 = OpCompositeConstruct %v4float %150 %151 %152 %float_1 + OpStore %x_GLF_color %153 + OpBranch %128 + %128 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %154 +%tint_symbol_1 = OpFunctionParameter %main_out + %158 = OpLabel + %159 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %159 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %161 = OpLabel + %162 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %162 + %163 = OpFunctionCall %void %main_1 + %165 = OpLoad %v4float %x_GLF_color + %166 = OpCompositeConstruct %main_out %165 + %164 = OpFunctionCall %void %tint_symbol_3 %166 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..819f07bc4d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.spvasm.expected.wgsl @@ -0,0 +1,120 @@ +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var x_40_phi : i32; + var x_52_phi : i32; + x_40_phi = 0; + loop { + var x_41 : i32; + let x_40 : i32 = x_40_phi; + if ((x_40 < 10)) { + } else { + break; + } + + continuing { + let x_48 : f32 = x_9.injectionSwitch.y; + data[x_40] = (f32((10 - x_40)) * x_48); + x_41 = (x_40 + 1); + x_40_phi = x_41; + } + } + x_52_phi = 0; + loop { + var x_53 : i32; + var x_59_phi : i32; + let x_52 : i32 = x_52_phi; + if ((x_52 < 9)) { + } else { + break; + } + x_59_phi = 0; + loop { + var x_82 : bool; + var x_83 : bool; + var x_60 : i32; + var x_84_phi : bool; + let x_59 : i32 = x_59_phi; + if ((x_59 < 10)) { + } else { + break; + } + if ((x_59 < (x_52 + 1))) { + continue; + } + let x_69 : ptr = &(data[x_52]); + let x_70 : f32 = *(x_69); + let x_71 : ptr = &(data[x_59]); + let x_72 : f32 = *(x_71); + let x_74 : f32 = gl_FragCoord.y; + let x_76 : f32 = x_6.resolution.y; + if ((x_74 < (x_76 * 0.5))) { + x_82 = (x_70 > x_72); + x_84_phi = x_82; + } else { + x_83 = (x_70 < x_72); + x_84_phi = x_83; + } + let x_84 : bool = x_84_phi; + if (x_84) { + let x_87 : f32 = *(x_69); + let x_88 : f32 = *(x_71); + *(x_69) = x_88; + *(x_71) = x_87; + } + + continuing { + x_60 = (x_59 + 1); + x_59_phi = x_60; + } + } + + continuing { + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + let x_90 : f32 = gl_FragCoord.x; + let x_92 : f32 = x_6.resolution.x; + if ((x_90 < (x_92 * 0.5))) { + let x_99 : f32 = data[0]; + let x_102 : f32 = data[5]; + let x_105 : f32 = data[9]; + x_GLF_color = vec4((x_99 * 0.100000001), (x_102 * 0.100000001), (x_105 * 0.100000001), 1.0); + } else { + let x_109 : f32 = data[5]; + let x_112 : f32 = data[9]; + let x_115 : f32 = data[0]; + x_GLF_color = vec4((x_109 * 0.100000001), (x_112 * 0.100000001), (x_115 * 0.100000001), 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl new file mode 100644 index 0000000000..819f07bc4d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl @@ -0,0 +1,120 @@ +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var x_40_phi : i32; + var x_52_phi : i32; + x_40_phi = 0; + loop { + var x_41 : i32; + let x_40 : i32 = x_40_phi; + if ((x_40 < 10)) { + } else { + break; + } + + continuing { + let x_48 : f32 = x_9.injectionSwitch.y; + data[x_40] = (f32((10 - x_40)) * x_48); + x_41 = (x_40 + 1); + x_40_phi = x_41; + } + } + x_52_phi = 0; + loop { + var x_53 : i32; + var x_59_phi : i32; + let x_52 : i32 = x_52_phi; + if ((x_52 < 9)) { + } else { + break; + } + x_59_phi = 0; + loop { + var x_82 : bool; + var x_83 : bool; + var x_60 : i32; + var x_84_phi : bool; + let x_59 : i32 = x_59_phi; + if ((x_59 < 10)) { + } else { + break; + } + if ((x_59 < (x_52 + 1))) { + continue; + } + let x_69 : ptr = &(data[x_52]); + let x_70 : f32 = *(x_69); + let x_71 : ptr = &(data[x_59]); + let x_72 : f32 = *(x_71); + let x_74 : f32 = gl_FragCoord.y; + let x_76 : f32 = x_6.resolution.y; + if ((x_74 < (x_76 * 0.5))) { + x_82 = (x_70 > x_72); + x_84_phi = x_82; + } else { + x_83 = (x_70 < x_72); + x_84_phi = x_83; + } + let x_84 : bool = x_84_phi; + if (x_84) { + let x_87 : f32 = *(x_69); + let x_88 : f32 = *(x_71); + *(x_69) = x_88; + *(x_71) = x_87; + } + + continuing { + x_60 = (x_59 + 1); + x_59_phi = x_60; + } + } + + continuing { + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + let x_90 : f32 = gl_FragCoord.x; + let x_92 : f32 = x_6.resolution.x; + if ((x_90 < (x_92 * 0.5))) { + let x_99 : f32 = data[0]; + let x_102 : f32 = data[5]; + let x_105 : f32 = data[9]; + x_GLF_color = vec4((x_99 * 0.100000001), (x_102 * 0.100000001), (x_105 * 0.100000001), 1.0); + } else { + let x_109 : f32 = data[5]; + let x_112 : f32 = data[9]; + let x_115 : f32 = data[0]; + x_GLF_color = vec4((x_109 * 0.100000001), (x_112 * 0.100000001), (x_115 * 0.100000001), 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..059390e488 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.hlsl @@ -0,0 +1,118 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float data[10] = (float[10])0; + int x_40_phi = 0; + int x_52_phi = 0; + x_40_phi = 0; + while (true) { + int x_41 = 0; + const int x_40 = x_40_phi; + if ((x_40 < 10)) { + } else { + break; + } + { + const float x_48 = asfloat(x_9[0].y); + data[x_40] = (float((10 - x_40)) * x_48); + x_41 = (x_40 + 1); + x_40_phi = x_41; + } + } + x_52_phi = 0; + while (true) { + int x_53 = 0; + int x_59_phi = 0; + const int x_52 = x_52_phi; + if ((x_52 < 9)) { + } else { + break; + } + x_59_phi = 0; + while (true) { + bool x_82 = false; + bool x_83 = false; + int x_60 = 0; + bool x_84_phi = false; + const int x_59 = x_59_phi; + if ((x_59 < 10)) { + } else { + break; + } + if ((x_59 < (x_52 + 1))) { + { + x_60 = (x_59 + 1); + x_59_phi = x_60; + } + continue; + } + const int x_69_save = x_52; + const float x_70 = data[x_69_save]; + const int x_71_save = x_59; + const float x_72 = data[x_71_save]; + const float x_74 = gl_FragCoord.y; + const float x_76 = asfloat(x_6[0].y); + if ((x_74 < (x_76 * 0.5f))) { + x_82 = (x_70 > x_72); + x_84_phi = x_82; + } else { + x_83 = (x_70 < x_72); + x_84_phi = x_83; + } + if (x_84_phi) { + const float x_87 = data[x_69_save]; + const float x_88 = data[x_71_save]; + data[x_69_save] = x_88; + data[x_71_save] = x_87; + } + { + x_60 = (x_59 + 1); + x_59_phi = x_60; + } + } + { + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + const float x_90 = gl_FragCoord.x; + const float x_92 = asfloat(x_6[0].x); + if ((x_90 < (x_92 * 0.5f))) { + const float x_99 = data[0]; + const float x_102 = data[5]; + const float x_105 = data[9]; + x_GLF_color = float4((x_99 * 0.100000001f), (x_102 * 0.100000001f), (x_105 * 0.100000001f), 1.0f); + } else { + const float x_109 = data[5]; + const float x_112 = data[9]; + const float x_115 = data[0]; + x_GLF_color = float4((x_109 * 0.100000001f), (x_112 * 0.100000001f), (x_115 * 0.100000001f), 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.msl new file mode 100644 index 0000000000..45769f1fe4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.msl @@ -0,0 +1,121 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_9, constant buf1& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + tint_array_wrapper data = {}; + int x_40_phi = 0; + int x_52_phi = 0; + x_40_phi = 0; + while (true) { + int x_41 = 0; + int const x_40 = x_40_phi; + if ((x_40 < 10)) { + } else { + break; + } + { + float const x_48 = x_9.injectionSwitch.y; + data.arr[x_40] = (float((10 - x_40)) * x_48); + x_41 = (x_40 + 1); + x_40_phi = x_41; + } + } + x_52_phi = 0; + while (true) { + int x_53 = 0; + int x_59_phi = 0; + int const x_52 = x_52_phi; + if ((x_52 < 9)) { + } else { + break; + } + x_59_phi = 0; + while (true) { + bool x_82 = false; + bool x_83 = false; + int x_60 = 0; + bool x_84_phi = false; + int const x_59 = x_59_phi; + if ((x_59 < 10)) { + } else { + break; + } + if ((x_59 < (x_52 + 1))) { + { + x_60 = (x_59 + 1); + x_59_phi = x_60; + } + continue; + } + int const x_69_save = x_52; + float const x_70 = data.arr[x_69_save]; + int const x_71_save = x_59; + float const x_72 = data.arr[x_71_save]; + float const x_74 = (*(tint_symbol_5)).y; + float const x_76 = x_6.resolution.y; + if ((x_74 < (x_76 * 0.5f))) { + x_82 = (x_70 > x_72); + x_84_phi = x_82; + } else { + x_83 = (x_70 < x_72); + x_84_phi = x_83; + } + bool const x_84 = x_84_phi; + if (x_84) { + float const x_87 = data.arr[x_69_save]; + float const x_88 = data.arr[x_71_save]; + data.arr[x_69_save] = x_88; + data.arr[x_71_save] = x_87; + } + { + x_60 = (x_59 + 1); + x_59_phi = x_60; + } + } + { + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + float const x_90 = (*(tint_symbol_5)).x; + float const x_92 = x_6.resolution.x; + if ((x_90 < (x_92 * 0.5f))) { + float const x_99 = data.arr[0]; + float const x_102 = data.arr[5]; + float const x_105 = data.arr[9]; + *(tint_symbol_6) = float4((x_99 * 0.100000001f), (x_102 * 0.100000001f), (x_105 * 0.100000001f), 1.0f); + } else { + float const x_109 = data.arr[5]; + float const x_112 = data.arr[9]; + float const x_115 = data.arr[0]; + *(tint_symbol_6) = float4((x_109 * 0.100000001f), (x_112 * 0.100000001f), (x_115 * 0.100000001f), 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_9 [[buffer(0)]], constant buf1& x_6 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_9, x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..43b700f91b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.spvasm @@ -0,0 +1,282 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 167 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %data "data" + OpName %x_40_phi "x_40_phi" + OpName %x_52_phi "x_52_phi" + OpName %x_41 "x_41" + OpName %x_53 "x_53" + OpName %x_59_phi "x_59_phi" + OpName %x_82 "x_82" + OpName %x_83 "x_83" + OpName %x_60 "x_60" + OpName %x_84_phi "x_84_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %27 = OpConstantNull %_arr_float_uint_10 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 +%_ptr_Function_bool = OpTypePointer Function %bool + %77 = OpConstantNull %bool +%_ptr_Private_float = OpTypePointer Private %float + %float_0_5 = OpConstant %float 0.5 + %int_5 = OpConstant %int 5 +%float_0_100000001 = OpConstant %float 0.100000001 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %154 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function %27 + %x_40_phi = OpVariable %_ptr_Function_int Function %31 + %x_52_phi = OpVariable %_ptr_Function_int Function %31 + %x_41 = OpVariable %_ptr_Function_int Function %31 + %x_53 = OpVariable %_ptr_Function_int Function %31 + %x_59_phi = OpVariable %_ptr_Function_int Function %31 + %x_82 = OpVariable %_ptr_Function_bool Function %77 + %x_83 = OpVariable %_ptr_Function_bool Function %77 + %x_60 = OpVariable %_ptr_Function_int Function %31 + %x_84_phi = OpVariable %_ptr_Function_bool Function %77 + OpStore %x_40_phi %int_0 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %39 = OpLoad %int %x_40_phi + %41 = OpSLessThan %bool %39 %int_10 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %35 + %43 = OpLabel + OpBranch %36 + %36 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Function_float %data %39 + %54 = OpISub %int %int_10 %39 + %53 = OpConvertSToF %float %54 + %55 = OpFMul %float %53 %50 + OpStore %52 %55 + %57 = OpIAdd %int %39 %int_1 + OpStore %x_41 %57 + %58 = OpLoad %int %x_41 + OpStore %x_40_phi %58 + OpBranch %34 + %35 = OpLabel + OpStore %x_52_phi %int_0 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %65 = OpLoad %int %x_52_phi + %67 = OpSLessThan %bool %65 %int_9 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %60 + %68 = OpLabel + OpStore %x_59_phi %int_0 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %81 = OpLoad %int %x_59_phi + %82 = OpSLessThan %bool %81 %int_10 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + OpBranch %83 + %85 = OpLabel + OpBranch %72 + %83 = OpLabel + %86 = OpIAdd %int %65 %int_1 + %87 = OpSLessThan %bool %81 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + OpBranch %73 + %88 = OpLabel + %90 = OpAccessChain %_ptr_Function_float %data %65 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Function_float %data %81 + %93 = OpLoad %float %92 + %95 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %96 = OpLoad %float %95 + %97 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %98 = OpLoad %float %97 + %100 = OpFMul %float %98 %float_0_5 + %101 = OpFOrdLessThan %bool %96 %100 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + %105 = OpFOrdGreaterThan %bool %91 %93 + OpStore %x_82 %105 + %106 = OpLoad %bool %x_82 + OpStore %x_84_phi %106 + OpBranch %102 + %104 = OpLabel + %107 = OpFOrdLessThan %bool %91 %93 + OpStore %x_83 %107 + %108 = OpLoad %bool %x_83 + OpStore %x_84_phi %108 + OpBranch %102 + %102 = OpLabel + %109 = OpLoad %bool %x_84_phi + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpAccessChain %_ptr_Function_float %data %65 + %113 = OpLoad %float %112 + %114 = OpAccessChain %_ptr_Function_float %data %81 + %115 = OpLoad %float %114 + %116 = OpAccessChain %_ptr_Function_float %data %65 + OpStore %116 %115 + %117 = OpAccessChain %_ptr_Function_float %data %81 + OpStore %117 %113 + OpBranch %110 + %110 = OpLabel + OpBranch %73 + %73 = OpLabel + %118 = OpIAdd %int %81 %int_1 + OpStore %x_60 %118 + %119 = OpLoad %int %x_60 + OpStore %x_59_phi %119 + OpBranch %71 + %72 = OpLabel + OpBranch %61 + %61 = OpLabel + %120 = OpIAdd %int %65 %int_1 + OpStore %x_53 %120 + %121 = OpLoad %int %x_53 + OpStore %x_52_phi %121 + OpBranch %59 + %60 = OpLabel + %122 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %123 = OpLoad %float %122 + %124 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %125 = OpLoad %float %124 + %126 = OpFMul %float %125 %float_0_5 + %127 = OpFOrdLessThan %bool %123 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %130 + %129 = OpLabel + %131 = OpAccessChain %_ptr_Function_float %data %int_0 + %132 = OpLoad %float %131 + %134 = OpAccessChain %_ptr_Function_float %data %int_5 + %135 = OpLoad %float %134 + %136 = OpAccessChain %_ptr_Function_float %data %int_9 + %137 = OpLoad %float %136 + %139 = OpFMul %float %132 %float_0_100000001 + %140 = OpFMul %float %135 %float_0_100000001 + %141 = OpFMul %float %137 %float_0_100000001 + %143 = OpCompositeConstruct %v4float %139 %140 %141 %float_1 + OpStore %x_GLF_color %143 + OpBranch %128 + %130 = OpLabel + %144 = OpAccessChain %_ptr_Function_float %data %int_5 + %145 = OpLoad %float %144 + %146 = OpAccessChain %_ptr_Function_float %data %int_9 + %147 = OpLoad %float %146 + %148 = OpAccessChain %_ptr_Function_float %data %int_0 + %149 = OpLoad %float %148 + %150 = OpFMul %float %145 %float_0_100000001 + %151 = OpFMul %float %147 %float_0_100000001 + %152 = OpFMul %float %149 %float_0_100000001 + %153 = OpCompositeConstruct %v4float %150 %151 %152 %float_1 + OpStore %x_GLF_color %153 + OpBranch %128 + %128 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %154 +%tint_symbol_1 = OpFunctionParameter %main_out + %158 = OpLabel + %159 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %159 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %161 = OpLabel + %162 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %162 + %163 = OpFunctionCall %void %main_1 + %165 = OpLoad %v4float %x_GLF_color + %166 = OpCompositeConstruct %main_out %165 + %164 = OpFunctionCall %void %tint_symbol_3 %166 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..819f07bc4d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/0.wgsl.expected.wgsl @@ -0,0 +1,120 @@ +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var x_40_phi : i32; + var x_52_phi : i32; + x_40_phi = 0; + loop { + var x_41 : i32; + let x_40 : i32 = x_40_phi; + if ((x_40 < 10)) { + } else { + break; + } + + continuing { + let x_48 : f32 = x_9.injectionSwitch.y; + data[x_40] = (f32((10 - x_40)) * x_48); + x_41 = (x_40 + 1); + x_40_phi = x_41; + } + } + x_52_phi = 0; + loop { + var x_53 : i32; + var x_59_phi : i32; + let x_52 : i32 = x_52_phi; + if ((x_52 < 9)) { + } else { + break; + } + x_59_phi = 0; + loop { + var x_82 : bool; + var x_83 : bool; + var x_60 : i32; + var x_84_phi : bool; + let x_59 : i32 = x_59_phi; + if ((x_59 < 10)) { + } else { + break; + } + if ((x_59 < (x_52 + 1))) { + continue; + } + let x_69 : ptr = &(data[x_52]); + let x_70 : f32 = *(x_69); + let x_71 : ptr = &(data[x_59]); + let x_72 : f32 = *(x_71); + let x_74 : f32 = gl_FragCoord.y; + let x_76 : f32 = x_6.resolution.y; + if ((x_74 < (x_76 * 0.5))) { + x_82 = (x_70 > x_72); + x_84_phi = x_82; + } else { + x_83 = (x_70 < x_72); + x_84_phi = x_83; + } + let x_84 : bool = x_84_phi; + if (x_84) { + let x_87 : f32 = *(x_69); + let x_88 : f32 = *(x_71); + *(x_69) = x_88; + *(x_71) = x_87; + } + + continuing { + x_60 = (x_59 + 1); + x_59_phi = x_60; + } + } + + continuing { + x_53 = (x_52 + 1); + x_52_phi = x_53; + } + } + let x_90 : f32 = gl_FragCoord.x; + let x_92 : f32 = x_6.resolution.x; + if ((x_90 < (x_92 * 0.5))) { + let x_99 : f32 = data[0]; + let x_102 : f32 = data[5]; + let x_105 : f32 = data[9]; + x_GLF_color = vec4((x_99 * 0.100000001), (x_102 * 0.100000001), (x_105 * 0.100000001), 1.0); + } else { + let x_109 : f32 = data[5]; + let x_112 : f32 = data[9]; + let x_115 : f32 = data[0]; + x_GLF_color = vec4((x_109 * 0.100000001), (x_112 * 0.100000001), (x_115 * 0.100000001), 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm new file mode 100644 index 0000000000..11995695c5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm @@ -0,0 +1,178 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %_ "" + OpName %data "data" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_10 = OpConstant %int 10 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_5 = OpConstant %int 5 + %float_1 = OpConstant %float 1 + %float_0_5 = OpConstant %float 0.5 +%float_0_100000001 = OpConstant %float 0.100000001 + %true = OpConstantTrue %bool + %main = OpFunction %void None %11 + %39 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function + OpBranch %40 + %40 = OpLabel + %41 = OpPhi %int %int_0 %39 %42 %43 + %44 = OpSLessThan %bool %41 %int_10 + OpLoopMerge %45 %43 None + OpBranchConditional %44 %43 %45 + %43 = OpLabel + %46 = OpISub %int %int_10 %41 + %47 = OpConvertSToF %float %46 + %48 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %49 = OpLoad %float %48 + %50 = OpFMul %float %47 %49 + %51 = OpAccessChain %_ptr_Function_float %data %41 + OpStore %51 %50 + %42 = OpIAdd %int %41 %int_1 + OpBranch %40 + %45 = OpLabel + OpBranch %52 + %52 = OpLabel + %53 = OpPhi %int %int_0 %45 %54 %55 + %56 = OpSLessThan %bool %53 %int_9 + OpLoopMerge %57 %55 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + OpBranch %59 + %59 = OpLabel + %60 = OpPhi %int %int_0 %58 %61 %62 + %63 = OpSLessThan %bool %60 %int_10 + OpLoopMerge %64 %62 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + %66 = OpIAdd %int %53 %int_1 + %67 = OpSLessThan %bool %60 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + OpBranch %62 + %68 = OpLabel + %70 = OpAccessChain %_ptr_Function_float %data %53 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Function_float %data %60 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %77 = OpLoad %float %76 + %78 = OpFMul %float %77 %float_0_5 + %79 = OpFOrdLessThan %bool %75 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + %83 = OpFOrdGreaterThan %bool %71 %73 + OpBranch %80 + %82 = OpLabel + %84 = OpFOrdLessThan %bool %71 %73 + OpBranch %80 + %80 = OpLabel + %85 = OpPhi %bool %83 %81 %84 %82 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpLoad %float %70 + %89 = OpLoad %float %72 + OpStore %70 %89 + OpStore %72 %88 + OpBranch %86 + %86 = OpLabel + OpBranch %62 + %62 = OpLabel + %61 = OpIAdd %int %60 %int_1 + OpBranch %59 + %64 = OpLabel + OpBranch %55 + %55 = OpLabel + %54 = OpIAdd %int %53 %int_1 + OpBranch %52 + %57 = OpLabel + %90 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %93 = OpLoad %float %92 + %94 = OpFMul %float %93 %float_0_5 + %95 = OpFOrdLessThan %bool %91 %94 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %98 + %97 = OpLabel + %99 = OpAccessChain %_ptr_Function_float %data %int_0 + %100 = OpLoad %float %99 + %101 = OpFMul %float %100 %float_0_100000001 + %102 = OpAccessChain %_ptr_Function_float %data %int_5 + %103 = OpLoad %float %102 + %104 = OpFMul %float %103 %float_0_100000001 + %105 = OpAccessChain %_ptr_Function_float %data %int_9 + %106 = OpLoad %float %105 + %107 = OpFMul %float %106 %float_0_100000001 + %108 = OpCompositeConstruct %v4float %101 %104 %107 %float_1 + OpStore %_GLF_color %108 + OpBranch %96 + %98 = OpLabel + %109 = OpAccessChain %_ptr_Function_float %data %int_5 + %110 = OpLoad %float %109 + %111 = OpFMul %float %110 %float_0_100000001 + %112 = OpAccessChain %_ptr_Function_float %data %int_9 + %113 = OpLoad %float %112 + %114 = OpFMul %float %113 %float_0_100000001 + %115 = OpAccessChain %_ptr_Function_float %data %int_0 + %116 = OpLoad %float %115 + %117 = OpFMul %float %116 %float_0_100000001 + %118 = OpCompositeConstruct %v4float %111 %114 %117 %float_1 + OpStore %_GLF_color %118 + OpBranchConditional %true %96 %96 + %96 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..9792c8f4ff --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.hlsl @@ -0,0 +1,118 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float data[10] = (float[10])0; + int x_41_phi = 0; + int x_53_phi = 0; + x_41_phi = 0; + while (true) { + int x_42 = 0; + const int x_41 = x_41_phi; + if ((x_41 < 10)) { + } else { + break; + } + { + const float x_49 = asfloat(x_9[0].y); + data[x_41] = (float((10 - x_41)) * x_49); + x_42 = (x_41 + 1); + x_41_phi = x_42; + } + } + x_53_phi = 0; + while (true) { + int x_54 = 0; + int x_60_phi = 0; + const int x_53 = x_53_phi; + if ((x_53 < 9)) { + } else { + break; + } + x_60_phi = 0; + while (true) { + bool x_83 = false; + bool x_84 = false; + int x_61 = 0; + bool x_85_phi = false; + const int x_60 = x_60_phi; + if ((x_60 < 10)) { + } else { + break; + } + if ((x_60 < (x_53 + 1))) { + { + x_61 = (x_60 + 1); + x_60_phi = x_61; + } + continue; + } + const int x_70_save = x_53; + const float x_71 = data[x_70_save]; + const int x_72_save = x_60; + const float x_73 = data[x_72_save]; + const float x_75 = gl_FragCoord.y; + const float x_77 = asfloat(x_6[0].y); + if ((x_75 < (x_77 * 0.5f))) { + x_83 = (x_71 > x_73); + x_85_phi = x_83; + } else { + x_84 = (x_71 < x_73); + x_85_phi = x_84; + } + if (x_85_phi) { + const float x_88 = data[x_70_save]; + const float x_89 = data[x_72_save]; + data[x_70_save] = x_89; + data[x_72_save] = x_88; + } + { + x_61 = (x_60 + 1); + x_60_phi = x_61; + } + } + { + x_54 = (x_53 + 1); + x_53_phi = x_54; + } + } + const float x_91 = gl_FragCoord.x; + const float x_93 = asfloat(x_6[0].x); + if ((x_91 < (x_93 * 0.5f))) { + const float x_100 = data[0]; + const float x_103 = data[5]; + const float x_106 = data[9]; + x_GLF_color = float4((x_100 * 0.100000001f), (x_103 * 0.100000001f), (x_106 * 0.100000001f), 1.0f); + } else { + const float x_110 = data[5]; + const float x_113 = data[9]; + const float x_116 = data[0]; + x_GLF_color = float4((x_110 * 0.100000001f), (x_113 * 0.100000001f), (x_116 * 0.100000001f), 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.msl new file mode 100644 index 0000000000..0bcea9e569 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.msl @@ -0,0 +1,121 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_9, constant buf1& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + tint_array_wrapper data = {}; + int x_41_phi = 0; + int x_53_phi = 0; + x_41_phi = 0; + while (true) { + int x_42 = 0; + int const x_41 = x_41_phi; + if ((x_41 < 10)) { + } else { + break; + } + { + float const x_49 = x_9.injectionSwitch.y; + data.arr[x_41] = (float((10 - x_41)) * x_49); + x_42 = (x_41 + 1); + x_41_phi = x_42; + } + } + x_53_phi = 0; + while (true) { + int x_54 = 0; + int x_60_phi = 0; + int const x_53 = x_53_phi; + if ((x_53 < 9)) { + } else { + break; + } + x_60_phi = 0; + while (true) { + bool x_83 = false; + bool x_84 = false; + int x_61 = 0; + bool x_85_phi = false; + int const x_60 = x_60_phi; + if ((x_60 < 10)) { + } else { + break; + } + if ((x_60 < (x_53 + 1))) { + { + x_61 = (x_60 + 1); + x_60_phi = x_61; + } + continue; + } + int const x_70_save = x_53; + float const x_71 = data.arr[x_70_save]; + int const x_72_save = x_60; + float const x_73 = data.arr[x_72_save]; + float const x_75 = (*(tint_symbol_5)).y; + float const x_77 = x_6.resolution.y; + if ((x_75 < (x_77 * 0.5f))) { + x_83 = (x_71 > x_73); + x_85_phi = x_83; + } else { + x_84 = (x_71 < x_73); + x_85_phi = x_84; + } + bool const x_85 = x_85_phi; + if (x_85) { + float const x_88 = data.arr[x_70_save]; + float const x_89 = data.arr[x_72_save]; + data.arr[x_70_save] = x_89; + data.arr[x_72_save] = x_88; + } + { + x_61 = (x_60 + 1); + x_60_phi = x_61; + } + } + { + x_54 = (x_53 + 1); + x_53_phi = x_54; + } + } + float const x_91 = (*(tint_symbol_5)).x; + float const x_93 = x_6.resolution.x; + if ((x_91 < (x_93 * 0.5f))) { + float const x_100 = data.arr[0]; + float const x_103 = data.arr[5]; + float const x_106 = data.arr[9]; + *(tint_symbol_6) = float4((x_100 * 0.100000001f), (x_103 * 0.100000001f), (x_106 * 0.100000001f), 1.0f); + } else { + float const x_110 = data.arr[5]; + float const x_113 = data.arr[9]; + float const x_116 = data.arr[0]; + *(tint_symbol_6) = float4((x_110 * 0.100000001f), (x_113 * 0.100000001f), (x_116 * 0.100000001f), 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_9 [[buffer(0)]], constant buf1& x_6 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_9, x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..8a60eb4eb0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.spvasm @@ -0,0 +1,282 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 167 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %data "data" + OpName %x_41_phi "x_41_phi" + OpName %x_53_phi "x_53_phi" + OpName %x_42 "x_42" + OpName %x_54 "x_54" + OpName %x_60_phi "x_60_phi" + OpName %x_83 "x_83" + OpName %x_84 "x_84" + OpName %x_61 "x_61" + OpName %x_85_phi "x_85_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %27 = OpConstantNull %_arr_float_uint_10 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 +%_ptr_Function_bool = OpTypePointer Function %bool + %77 = OpConstantNull %bool +%_ptr_Private_float = OpTypePointer Private %float + %float_0_5 = OpConstant %float 0.5 + %int_5 = OpConstant %int 5 +%float_0_100000001 = OpConstant %float 0.100000001 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %154 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function %27 + %x_41_phi = OpVariable %_ptr_Function_int Function %31 + %x_53_phi = OpVariable %_ptr_Function_int Function %31 + %x_42 = OpVariable %_ptr_Function_int Function %31 + %x_54 = OpVariable %_ptr_Function_int Function %31 + %x_60_phi = OpVariable %_ptr_Function_int Function %31 + %x_83 = OpVariable %_ptr_Function_bool Function %77 + %x_84 = OpVariable %_ptr_Function_bool Function %77 + %x_61 = OpVariable %_ptr_Function_int Function %31 + %x_85_phi = OpVariable %_ptr_Function_bool Function %77 + OpStore %x_41_phi %int_0 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %39 = OpLoad %int %x_41_phi + %41 = OpSLessThan %bool %39 %int_10 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %35 + %43 = OpLabel + OpBranch %36 + %36 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Function_float %data %39 + %54 = OpISub %int %int_10 %39 + %53 = OpConvertSToF %float %54 + %55 = OpFMul %float %53 %50 + OpStore %52 %55 + %57 = OpIAdd %int %39 %int_1 + OpStore %x_42 %57 + %58 = OpLoad %int %x_42 + OpStore %x_41_phi %58 + OpBranch %34 + %35 = OpLabel + OpStore %x_53_phi %int_0 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %65 = OpLoad %int %x_53_phi + %67 = OpSLessThan %bool %65 %int_9 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %60 + %68 = OpLabel + OpStore %x_60_phi %int_0 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %81 = OpLoad %int %x_60_phi + %82 = OpSLessThan %bool %81 %int_10 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + OpBranch %83 + %85 = OpLabel + OpBranch %72 + %83 = OpLabel + %86 = OpIAdd %int %65 %int_1 + %87 = OpSLessThan %bool %81 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + OpBranch %73 + %88 = OpLabel + %90 = OpAccessChain %_ptr_Function_float %data %65 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Function_float %data %81 + %93 = OpLoad %float %92 + %95 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %96 = OpLoad %float %95 + %97 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %98 = OpLoad %float %97 + %100 = OpFMul %float %98 %float_0_5 + %101 = OpFOrdLessThan %bool %96 %100 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + %105 = OpFOrdGreaterThan %bool %91 %93 + OpStore %x_83 %105 + %106 = OpLoad %bool %x_83 + OpStore %x_85_phi %106 + OpBranch %102 + %104 = OpLabel + %107 = OpFOrdLessThan %bool %91 %93 + OpStore %x_84 %107 + %108 = OpLoad %bool %x_84 + OpStore %x_85_phi %108 + OpBranch %102 + %102 = OpLabel + %109 = OpLoad %bool %x_85_phi + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpAccessChain %_ptr_Function_float %data %65 + %113 = OpLoad %float %112 + %114 = OpAccessChain %_ptr_Function_float %data %81 + %115 = OpLoad %float %114 + %116 = OpAccessChain %_ptr_Function_float %data %65 + OpStore %116 %115 + %117 = OpAccessChain %_ptr_Function_float %data %81 + OpStore %117 %113 + OpBranch %110 + %110 = OpLabel + OpBranch %73 + %73 = OpLabel + %118 = OpIAdd %int %81 %int_1 + OpStore %x_61 %118 + %119 = OpLoad %int %x_61 + OpStore %x_60_phi %119 + OpBranch %71 + %72 = OpLabel + OpBranch %61 + %61 = OpLabel + %120 = OpIAdd %int %65 %int_1 + OpStore %x_54 %120 + %121 = OpLoad %int %x_54 + OpStore %x_53_phi %121 + OpBranch %59 + %60 = OpLabel + %122 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %123 = OpLoad %float %122 + %124 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %125 = OpLoad %float %124 + %126 = OpFMul %float %125 %float_0_5 + %127 = OpFOrdLessThan %bool %123 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %130 + %129 = OpLabel + %131 = OpAccessChain %_ptr_Function_float %data %int_0 + %132 = OpLoad %float %131 + %134 = OpAccessChain %_ptr_Function_float %data %int_5 + %135 = OpLoad %float %134 + %136 = OpAccessChain %_ptr_Function_float %data %int_9 + %137 = OpLoad %float %136 + %139 = OpFMul %float %132 %float_0_100000001 + %140 = OpFMul %float %135 %float_0_100000001 + %141 = OpFMul %float %137 %float_0_100000001 + %143 = OpCompositeConstruct %v4float %139 %140 %141 %float_1 + OpStore %x_GLF_color %143 + OpBranch %128 + %130 = OpLabel + %144 = OpAccessChain %_ptr_Function_float %data %int_5 + %145 = OpLoad %float %144 + %146 = OpAccessChain %_ptr_Function_float %data %int_9 + %147 = OpLoad %float %146 + %148 = OpAccessChain %_ptr_Function_float %data %int_0 + %149 = OpLoad %float %148 + %150 = OpFMul %float %145 %float_0_100000001 + %151 = OpFMul %float %147 %float_0_100000001 + %152 = OpFMul %float %149 %float_0_100000001 + %153 = OpCompositeConstruct %v4float %150 %151 %152 %float_1 + OpStore %x_GLF_color %153 + OpBranch %128 + %128 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %154 +%tint_symbol_1 = OpFunctionParameter %main_out + %158 = OpLabel + %159 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %159 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %161 = OpLabel + %162 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %162 + %163 = OpFunctionCall %void %main_1 + %165 = OpLoad %v4float %x_GLF_color + %166 = OpCompositeConstruct %main_out %165 + %164 = OpFunctionCall %void %tint_symbol_3 %166 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..aac8d577ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.spvasm.expected.wgsl @@ -0,0 +1,120 @@ +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var x_41_phi : i32; + var x_53_phi : i32; + x_41_phi = 0; + loop { + var x_42 : i32; + let x_41 : i32 = x_41_phi; + if ((x_41 < 10)) { + } else { + break; + } + + continuing { + let x_49 : f32 = x_9.injectionSwitch.y; + data[x_41] = (f32((10 - x_41)) * x_49); + x_42 = (x_41 + 1); + x_41_phi = x_42; + } + } + x_53_phi = 0; + loop { + var x_54 : i32; + var x_60_phi : i32; + let x_53 : i32 = x_53_phi; + if ((x_53 < 9)) { + } else { + break; + } + x_60_phi = 0; + loop { + var x_83 : bool; + var x_84 : bool; + var x_61 : i32; + var x_85_phi : bool; + let x_60 : i32 = x_60_phi; + if ((x_60 < 10)) { + } else { + break; + } + if ((x_60 < (x_53 + 1))) { + continue; + } + let x_70 : ptr = &(data[x_53]); + let x_71 : f32 = *(x_70); + let x_72 : ptr = &(data[x_60]); + let x_73 : f32 = *(x_72); + let x_75 : f32 = gl_FragCoord.y; + let x_77 : f32 = x_6.resolution.y; + if ((x_75 < (x_77 * 0.5))) { + x_83 = (x_71 > x_73); + x_85_phi = x_83; + } else { + x_84 = (x_71 < x_73); + x_85_phi = x_84; + } + let x_85 : bool = x_85_phi; + if (x_85) { + let x_88 : f32 = *(x_70); + let x_89 : f32 = *(x_72); + *(x_70) = x_89; + *(x_72) = x_88; + } + + continuing { + x_61 = (x_60 + 1); + x_60_phi = x_61; + } + } + + continuing { + x_54 = (x_53 + 1); + x_53_phi = x_54; + } + } + let x_91 : f32 = gl_FragCoord.x; + let x_93 : f32 = x_6.resolution.x; + if ((x_91 < (x_93 * 0.5))) { + let x_100 : f32 = data[0]; + let x_103 : f32 = data[5]; + let x_106 : f32 = data[9]; + x_GLF_color = vec4((x_100 * 0.100000001), (x_103 * 0.100000001), (x_106 * 0.100000001), 1.0); + } else { + let x_110 : f32 = data[5]; + let x_113 : f32 = data[9]; + let x_116 : f32 = data[0]; + x_GLF_color = vec4((x_110 * 0.100000001), (x_113 * 0.100000001), (x_116 * 0.100000001), 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl new file mode 100644 index 0000000000..aac8d577ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl @@ -0,0 +1,120 @@ +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var x_41_phi : i32; + var x_53_phi : i32; + x_41_phi = 0; + loop { + var x_42 : i32; + let x_41 : i32 = x_41_phi; + if ((x_41 < 10)) { + } else { + break; + } + + continuing { + let x_49 : f32 = x_9.injectionSwitch.y; + data[x_41] = (f32((10 - x_41)) * x_49); + x_42 = (x_41 + 1); + x_41_phi = x_42; + } + } + x_53_phi = 0; + loop { + var x_54 : i32; + var x_60_phi : i32; + let x_53 : i32 = x_53_phi; + if ((x_53 < 9)) { + } else { + break; + } + x_60_phi = 0; + loop { + var x_83 : bool; + var x_84 : bool; + var x_61 : i32; + var x_85_phi : bool; + let x_60 : i32 = x_60_phi; + if ((x_60 < 10)) { + } else { + break; + } + if ((x_60 < (x_53 + 1))) { + continue; + } + let x_70 : ptr = &(data[x_53]); + let x_71 : f32 = *(x_70); + let x_72 : ptr = &(data[x_60]); + let x_73 : f32 = *(x_72); + let x_75 : f32 = gl_FragCoord.y; + let x_77 : f32 = x_6.resolution.y; + if ((x_75 < (x_77 * 0.5))) { + x_83 = (x_71 > x_73); + x_85_phi = x_83; + } else { + x_84 = (x_71 < x_73); + x_85_phi = x_84; + } + let x_85 : bool = x_85_phi; + if (x_85) { + let x_88 : f32 = *(x_70); + let x_89 : f32 = *(x_72); + *(x_70) = x_89; + *(x_72) = x_88; + } + + continuing { + x_61 = (x_60 + 1); + x_60_phi = x_61; + } + } + + continuing { + x_54 = (x_53 + 1); + x_53_phi = x_54; + } + } + let x_91 : f32 = gl_FragCoord.x; + let x_93 : f32 = x_6.resolution.x; + if ((x_91 < (x_93 * 0.5))) { + let x_100 : f32 = data[0]; + let x_103 : f32 = data[5]; + let x_106 : f32 = data[9]; + x_GLF_color = vec4((x_100 * 0.100000001), (x_103 * 0.100000001), (x_106 * 0.100000001), 1.0); + } else { + let x_110 : f32 = data[5]; + let x_113 : f32 = data[9]; + let x_116 : f32 = data[0]; + x_GLF_color = vec4((x_110 * 0.100000001), (x_113 * 0.100000001), (x_116 * 0.100000001), 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..9792c8f4ff --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.hlsl @@ -0,0 +1,118 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float data[10] = (float[10])0; + int x_41_phi = 0; + int x_53_phi = 0; + x_41_phi = 0; + while (true) { + int x_42 = 0; + const int x_41 = x_41_phi; + if ((x_41 < 10)) { + } else { + break; + } + { + const float x_49 = asfloat(x_9[0].y); + data[x_41] = (float((10 - x_41)) * x_49); + x_42 = (x_41 + 1); + x_41_phi = x_42; + } + } + x_53_phi = 0; + while (true) { + int x_54 = 0; + int x_60_phi = 0; + const int x_53 = x_53_phi; + if ((x_53 < 9)) { + } else { + break; + } + x_60_phi = 0; + while (true) { + bool x_83 = false; + bool x_84 = false; + int x_61 = 0; + bool x_85_phi = false; + const int x_60 = x_60_phi; + if ((x_60 < 10)) { + } else { + break; + } + if ((x_60 < (x_53 + 1))) { + { + x_61 = (x_60 + 1); + x_60_phi = x_61; + } + continue; + } + const int x_70_save = x_53; + const float x_71 = data[x_70_save]; + const int x_72_save = x_60; + const float x_73 = data[x_72_save]; + const float x_75 = gl_FragCoord.y; + const float x_77 = asfloat(x_6[0].y); + if ((x_75 < (x_77 * 0.5f))) { + x_83 = (x_71 > x_73); + x_85_phi = x_83; + } else { + x_84 = (x_71 < x_73); + x_85_phi = x_84; + } + if (x_85_phi) { + const float x_88 = data[x_70_save]; + const float x_89 = data[x_72_save]; + data[x_70_save] = x_89; + data[x_72_save] = x_88; + } + { + x_61 = (x_60 + 1); + x_60_phi = x_61; + } + } + { + x_54 = (x_53 + 1); + x_53_phi = x_54; + } + } + const float x_91 = gl_FragCoord.x; + const float x_93 = asfloat(x_6[0].x); + if ((x_91 < (x_93 * 0.5f))) { + const float x_100 = data[0]; + const float x_103 = data[5]; + const float x_106 = data[9]; + x_GLF_color = float4((x_100 * 0.100000001f), (x_103 * 0.100000001f), (x_106 * 0.100000001f), 1.0f); + } else { + const float x_110 = data[5]; + const float x_113 = data[9]; + const float x_116 = data[0]; + x_GLF_color = float4((x_110 * 0.100000001f), (x_113 * 0.100000001f), (x_116 * 0.100000001f), 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.msl new file mode 100644 index 0000000000..0bcea9e569 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.msl @@ -0,0 +1,121 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_9, constant buf1& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + tint_array_wrapper data = {}; + int x_41_phi = 0; + int x_53_phi = 0; + x_41_phi = 0; + while (true) { + int x_42 = 0; + int const x_41 = x_41_phi; + if ((x_41 < 10)) { + } else { + break; + } + { + float const x_49 = x_9.injectionSwitch.y; + data.arr[x_41] = (float((10 - x_41)) * x_49); + x_42 = (x_41 + 1); + x_41_phi = x_42; + } + } + x_53_phi = 0; + while (true) { + int x_54 = 0; + int x_60_phi = 0; + int const x_53 = x_53_phi; + if ((x_53 < 9)) { + } else { + break; + } + x_60_phi = 0; + while (true) { + bool x_83 = false; + bool x_84 = false; + int x_61 = 0; + bool x_85_phi = false; + int const x_60 = x_60_phi; + if ((x_60 < 10)) { + } else { + break; + } + if ((x_60 < (x_53 + 1))) { + { + x_61 = (x_60 + 1); + x_60_phi = x_61; + } + continue; + } + int const x_70_save = x_53; + float const x_71 = data.arr[x_70_save]; + int const x_72_save = x_60; + float const x_73 = data.arr[x_72_save]; + float const x_75 = (*(tint_symbol_5)).y; + float const x_77 = x_6.resolution.y; + if ((x_75 < (x_77 * 0.5f))) { + x_83 = (x_71 > x_73); + x_85_phi = x_83; + } else { + x_84 = (x_71 < x_73); + x_85_phi = x_84; + } + bool const x_85 = x_85_phi; + if (x_85) { + float const x_88 = data.arr[x_70_save]; + float const x_89 = data.arr[x_72_save]; + data.arr[x_70_save] = x_89; + data.arr[x_72_save] = x_88; + } + { + x_61 = (x_60 + 1); + x_60_phi = x_61; + } + } + { + x_54 = (x_53 + 1); + x_53_phi = x_54; + } + } + float const x_91 = (*(tint_symbol_5)).x; + float const x_93 = x_6.resolution.x; + if ((x_91 < (x_93 * 0.5f))) { + float const x_100 = data.arr[0]; + float const x_103 = data.arr[5]; + float const x_106 = data.arr[9]; + *(tint_symbol_6) = float4((x_100 * 0.100000001f), (x_103 * 0.100000001f), (x_106 * 0.100000001f), 1.0f); + } else { + float const x_110 = data.arr[5]; + float const x_113 = data.arr[9]; + float const x_116 = data.arr[0]; + *(tint_symbol_6) = float4((x_110 * 0.100000001f), (x_113 * 0.100000001f), (x_116 * 0.100000001f), 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_9 [[buffer(0)]], constant buf1& x_6 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_9, x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..8a60eb4eb0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.spvasm @@ -0,0 +1,282 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 167 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %data "data" + OpName %x_41_phi "x_41_phi" + OpName %x_53_phi "x_53_phi" + OpName %x_42 "x_42" + OpName %x_54 "x_54" + OpName %x_60_phi "x_60_phi" + OpName %x_83 "x_83" + OpName %x_84 "x_84" + OpName %x_61 "x_61" + OpName %x_85_phi "x_85_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %27 = OpConstantNull %_arr_float_uint_10 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %31 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 +%_ptr_Function_bool = OpTypePointer Function %bool + %77 = OpConstantNull %bool +%_ptr_Private_float = OpTypePointer Private %float + %float_0_5 = OpConstant %float 0.5 + %int_5 = OpConstant %int 5 +%float_0_100000001 = OpConstant %float 0.100000001 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %154 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function %27 + %x_41_phi = OpVariable %_ptr_Function_int Function %31 + %x_53_phi = OpVariable %_ptr_Function_int Function %31 + %x_42 = OpVariable %_ptr_Function_int Function %31 + %x_54 = OpVariable %_ptr_Function_int Function %31 + %x_60_phi = OpVariable %_ptr_Function_int Function %31 + %x_83 = OpVariable %_ptr_Function_bool Function %77 + %x_84 = OpVariable %_ptr_Function_bool Function %77 + %x_61 = OpVariable %_ptr_Function_int Function %31 + %x_85_phi = OpVariable %_ptr_Function_bool Function %77 + OpStore %x_41_phi %int_0 + OpBranch %34 + %34 = OpLabel + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %39 = OpLoad %int %x_41_phi + %41 = OpSLessThan %bool %39 %int_10 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %35 + %43 = OpLabel + OpBranch %36 + %36 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Function_float %data %39 + %54 = OpISub %int %int_10 %39 + %53 = OpConvertSToF %float %54 + %55 = OpFMul %float %53 %50 + OpStore %52 %55 + %57 = OpIAdd %int %39 %int_1 + OpStore %x_42 %57 + %58 = OpLoad %int %x_42 + OpStore %x_41_phi %58 + OpBranch %34 + %35 = OpLabel + OpStore %x_53_phi %int_0 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %65 = OpLoad %int %x_53_phi + %67 = OpSLessThan %bool %65 %int_9 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpBranch %68 + %70 = OpLabel + OpBranch %60 + %68 = OpLabel + OpStore %x_60_phi %int_0 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %81 = OpLoad %int %x_60_phi + %82 = OpSLessThan %bool %81 %int_10 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %85 + %84 = OpLabel + OpBranch %83 + %85 = OpLabel + OpBranch %72 + %83 = OpLabel + %86 = OpIAdd %int %65 %int_1 + %87 = OpSLessThan %bool %81 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + OpBranch %73 + %88 = OpLabel + %90 = OpAccessChain %_ptr_Function_float %data %65 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Function_float %data %81 + %93 = OpLoad %float %92 + %95 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %96 = OpLoad %float %95 + %97 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %98 = OpLoad %float %97 + %100 = OpFMul %float %98 %float_0_5 + %101 = OpFOrdLessThan %bool %96 %100 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + %105 = OpFOrdGreaterThan %bool %91 %93 + OpStore %x_83 %105 + %106 = OpLoad %bool %x_83 + OpStore %x_85_phi %106 + OpBranch %102 + %104 = OpLabel + %107 = OpFOrdLessThan %bool %91 %93 + OpStore %x_84 %107 + %108 = OpLoad %bool %x_84 + OpStore %x_85_phi %108 + OpBranch %102 + %102 = OpLabel + %109 = OpLoad %bool %x_85_phi + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpAccessChain %_ptr_Function_float %data %65 + %113 = OpLoad %float %112 + %114 = OpAccessChain %_ptr_Function_float %data %81 + %115 = OpLoad %float %114 + %116 = OpAccessChain %_ptr_Function_float %data %65 + OpStore %116 %115 + %117 = OpAccessChain %_ptr_Function_float %data %81 + OpStore %117 %113 + OpBranch %110 + %110 = OpLabel + OpBranch %73 + %73 = OpLabel + %118 = OpIAdd %int %81 %int_1 + OpStore %x_61 %118 + %119 = OpLoad %int %x_61 + OpStore %x_60_phi %119 + OpBranch %71 + %72 = OpLabel + OpBranch %61 + %61 = OpLabel + %120 = OpIAdd %int %65 %int_1 + OpStore %x_54 %120 + %121 = OpLoad %int %x_54 + OpStore %x_53_phi %121 + OpBranch %59 + %60 = OpLabel + %122 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %123 = OpLoad %float %122 + %124 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %125 = OpLoad %float %124 + %126 = OpFMul %float %125 %float_0_5 + %127 = OpFOrdLessThan %bool %123 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %130 + %129 = OpLabel + %131 = OpAccessChain %_ptr_Function_float %data %int_0 + %132 = OpLoad %float %131 + %134 = OpAccessChain %_ptr_Function_float %data %int_5 + %135 = OpLoad %float %134 + %136 = OpAccessChain %_ptr_Function_float %data %int_9 + %137 = OpLoad %float %136 + %139 = OpFMul %float %132 %float_0_100000001 + %140 = OpFMul %float %135 %float_0_100000001 + %141 = OpFMul %float %137 %float_0_100000001 + %143 = OpCompositeConstruct %v4float %139 %140 %141 %float_1 + OpStore %x_GLF_color %143 + OpBranch %128 + %130 = OpLabel + %144 = OpAccessChain %_ptr_Function_float %data %int_5 + %145 = OpLoad %float %144 + %146 = OpAccessChain %_ptr_Function_float %data %int_9 + %147 = OpLoad %float %146 + %148 = OpAccessChain %_ptr_Function_float %data %int_0 + %149 = OpLoad %float %148 + %150 = OpFMul %float %145 %float_0_100000001 + %151 = OpFMul %float %147 %float_0_100000001 + %152 = OpFMul %float %149 %float_0_100000001 + %153 = OpCompositeConstruct %v4float %150 %151 %152 %float_1 + OpStore %x_GLF_color %153 + OpBranch %128 + %128 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %154 +%tint_symbol_1 = OpFunctionParameter %main_out + %158 = OpLabel + %159 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %159 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %161 = OpLabel + %162 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %162 + %163 = OpFunctionCall %void %main_1 + %165 = OpLoad %v4float %x_GLF_color + %166 = OpCompositeConstruct %main_out %165 + %164 = OpFunctionCall %void %tint_symbol_3 %166 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..aac8d577ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block2/1.wgsl.expected.wgsl @@ -0,0 +1,120 @@ +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var data : array; + var x_41_phi : i32; + var x_53_phi : i32; + x_41_phi = 0; + loop { + var x_42 : i32; + let x_41 : i32 = x_41_phi; + if ((x_41 < 10)) { + } else { + break; + } + + continuing { + let x_49 : f32 = x_9.injectionSwitch.y; + data[x_41] = (f32((10 - x_41)) * x_49); + x_42 = (x_41 + 1); + x_41_phi = x_42; + } + } + x_53_phi = 0; + loop { + var x_54 : i32; + var x_60_phi : i32; + let x_53 : i32 = x_53_phi; + if ((x_53 < 9)) { + } else { + break; + } + x_60_phi = 0; + loop { + var x_83 : bool; + var x_84 : bool; + var x_61 : i32; + var x_85_phi : bool; + let x_60 : i32 = x_60_phi; + if ((x_60 < 10)) { + } else { + break; + } + if ((x_60 < (x_53 + 1))) { + continue; + } + let x_70 : ptr = &(data[x_53]); + let x_71 : f32 = *(x_70); + let x_72 : ptr = &(data[x_60]); + let x_73 : f32 = *(x_72); + let x_75 : f32 = gl_FragCoord.y; + let x_77 : f32 = x_6.resolution.y; + if ((x_75 < (x_77 * 0.5))) { + x_83 = (x_71 > x_73); + x_85_phi = x_83; + } else { + x_84 = (x_71 < x_73); + x_85_phi = x_84; + } + let x_85 : bool = x_85_phi; + if (x_85) { + let x_88 : f32 = *(x_70); + let x_89 : f32 = *(x_72); + *(x_70) = x_89; + *(x_72) = x_88; + } + + continuing { + x_61 = (x_60 + 1); + x_60_phi = x_61; + } + } + + continuing { + x_54 = (x_53 + 1); + x_53_phi = x_54; + } + } + let x_91 : f32 = gl_FragCoord.x; + let x_93 : f32 = x_6.resolution.x; + if ((x_91 < (x_93 * 0.5))) { + let x_100 : f32 = data[0]; + let x_103 : f32 = data[5]; + let x_106 : f32 = data[9]; + x_GLF_color = vec4((x_100 * 0.100000001), (x_103 * 0.100000001), (x_106 * 0.100000001), 1.0); + } else { + let x_110 : f32 = data[5]; + let x_113 : f32 = data[9]; + let x_116 : f32 = data[0]; + x_GLF_color = vec4((x_110 * 0.100000001), (x_113 * 0.100000001), (x_116 * 0.100000001), 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm new file mode 100644 index 0000000000..6504342a9a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm @@ -0,0 +1,570 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %merge_i1_i1_i1_ "merge(i1;i1;i1;" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %mergeSort_ "mergeSort(" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %temp "temp" + OpName %i_0 "i" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_1 "i" + OpName %from_0 "from" + OpName %mid_0 "mid" + OpName %to_0 "to" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %i_2 "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %j_0 "j" + OpName %gl_FragCoord "gl_FragCoord" + OpName %grey "grey" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %__0 "" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %34 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %37 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private + %int_10 = OpConstant %int 10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int_30 = OpConstant %int 30 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %true = OpConstantTrue %bool + %float_256 = OpConstant %float 256 + %main = OpFunction %void None %34 + %87 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %grey = OpVariable %_ptr_Function_float Function + %88 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %89 = OpLoad %float %88 + %90 = OpConvertFToS %int %89 + OpStore %i_2 %90 + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %i_2 + OpSelectionMerge %96 None + OpSwitch %95 %96 0 %97 1 %98 2 %99 3 %100 4 %101 5 %102 6 %103 7 %104 8 %105 9 %106 + %97 = OpLabel + %107 = OpLoad %int %i_2 + %108 = OpAccessChain %_ptr_Private_int %data %107 + OpStore %108 %int_4 + OpBranch %96 + %98 = OpLabel + %109 = OpLoad %int %i_2 + %110 = OpAccessChain %_ptr_Private_int %data %109 + OpStore %110 %int_3 + OpBranch %96 + %99 = OpLabel + %111 = OpLoad %int %i_2 + %112 = OpAccessChain %_ptr_Private_int %data %111 + OpStore %112 %int_2 + OpBranch %96 + %100 = OpLabel + %113 = OpLoad %int %i_2 + %114 = OpAccessChain %_ptr_Private_int %data %113 + OpStore %114 %int_1 + OpBranch %96 + %101 = OpLabel + %115 = OpLoad %int %i_2 + %116 = OpAccessChain %_ptr_Private_int %data %115 + OpStore %116 %int_0 + OpBranch %96 + %102 = OpLabel + %117 = OpLoad %int %i_2 + %118 = OpAccessChain %_ptr_Private_int %data %117 + OpStore %118 %int_n1 + OpBranch %96 + %103 = OpLabel + %119 = OpLoad %int %i_2 + %120 = OpAccessChain %_ptr_Private_int %data %119 + OpStore %120 %int_n2 + OpBranch %96 + %104 = OpLabel + %121 = OpLoad %int %i_2 + %122 = OpAccessChain %_ptr_Private_int %data %121 + OpStore %122 %int_n3 + OpBranch %96 + %105 = OpLabel + %123 = OpLoad %int %i_2 + %124 = OpAccessChain %_ptr_Private_int %data %123 + OpStore %124 %int_n4 + OpBranch %96 + %106 = OpLabel + %125 = OpLoad %int %i_2 + %126 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %126 %int_n5 + OpBranch %96 + %96 = OpLabel + %127 = OpLoad %int %i_2 + %128 = OpIAdd %int %127 %int_1 + OpStore %i_2 %128 + OpBranch %93 + %93 = OpLabel + %129 = OpLoad %int %i_2 + %130 = OpSLessThan %bool %129 %int_10 + OpBranchConditional %130 %91 %92 + %92 = OpLabel + OpStore %j_0 %int_0 + OpBranch %131 + %131 = OpLabel + OpLoopMerge %132 %133 None + OpBranch %134 + %134 = OpLabel + %135 = OpLoad %int %j_0 + %136 = OpSLessThan %bool %135 %int_10 + OpBranchConditional %136 %137 %132 + %137 = OpLabel + %138 = OpLoad %int %j_0 + %139 = OpLoad %int %j_0 + %140 = OpAccessChain %_ptr_Private_int %data %139 + %141 = OpLoad %int %140 + %142 = OpAccessChain %_ptr_Private_int %temp %138 + OpStore %142 %141 + OpBranch %133 + %133 = OpLabel + %143 = OpLoad %int %j_0 + %144 = OpIAdd %int %143 %int_1 + OpStore %j_0 %144 + OpBranch %131 + %132 = OpLabel + %145 = OpFunctionCall %void %mergeSort_ + %146 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %147 = OpLoad %float %146 + %148 = OpConvertFToS %int %147 + %149 = OpSLessThan %bool %148 %int_30 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %152 + %151 = OpLabel + %153 = OpAccessChain %_ptr_Private_int %data %int_0 + %154 = OpLoad %int %153 + %155 = OpConvertSToF %float %154 + %156 = OpFDiv %float %155 %float_10 + %157 = OpFAdd %float %float_0_5 %156 + OpStore %grey %157 + OpBranch %150 + %152 = OpLabel + %158 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %159 = OpLoad %float %158 + %160 = OpConvertFToS %int %159 + %161 = OpSLessThan %bool %160 %int_60 + OpSelectionMerge %162 None + OpBranchConditional %161 %163 %164 + %163 = OpLabel + %165 = OpAccessChain %_ptr_Private_int %data %int_1 + %166 = OpLoad %int %165 + %167 = OpConvertSToF %float %166 + %168 = OpFDiv %float %167 %float_10 + %169 = OpFAdd %float %float_0_5 %168 + OpStore %grey %169 + OpBranch %162 + %164 = OpLabel + %170 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %171 = OpLoad %float %170 + %172 = OpConvertFToS %int %171 + %173 = OpSLessThan %bool %172 %int_90 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %176 + %175 = OpLabel + %177 = OpAccessChain %_ptr_Private_int %data %int_2 + %178 = OpLoad %int %177 + %179 = OpConvertSToF %float %178 + %180 = OpFDiv %float %179 %float_10 + %181 = OpFAdd %float %float_0_5 %180 + OpStore %grey %181 + OpBranch %174 + %176 = OpLabel + %182 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %183 = OpLoad %float %182 + %184 = OpConvertFToS %int %183 + %185 = OpSLessThan %bool %184 %int_120 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + %189 = OpAccessChain %_ptr_Private_int %data %int_3 + %190 = OpLoad %int %189 + %191 = OpConvertSToF %float %190 + %192 = OpFDiv %float %191 %float_10 + %193 = OpFAdd %float %float_0_5 %192 + OpStore %grey %193 + OpBranch %186 + %188 = OpLabel + %194 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %195 = OpLoad %float %194 + %196 = OpConvertFToS %int %195 + %197 = OpSLessThan %bool %196 %int_150 + OpSelectionMerge %198 None + OpBranchConditional %197 %199 %200 + %199 = OpLabel + OpKill + %200 = OpLabel + %201 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %202 = OpLoad %float %201 + %203 = OpConvertFToS %int %202 + %204 = OpSLessThan %bool %203 %int_180 + OpSelectionMerge %205 None + OpBranchConditional %204 %206 %207 + %206 = OpLabel + %208 = OpAccessChain %_ptr_Private_int %data %int_5 + %209 = OpLoad %int %208 + %210 = OpConvertSToF %float %209 + %211 = OpFDiv %float %210 %float_10 + %212 = OpFAdd %float %float_0_5 %211 + OpStore %grey %212 + OpBranch %205 + %207 = OpLabel + %213 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %214 = OpLoad %float %213 + %215 = OpConvertFToS %int %214 + %216 = OpSLessThan %bool %215 %int_210 + OpSelectionMerge %217 None + OpBranchConditional %216 %218 %219 + %218 = OpLabel + %220 = OpAccessChain %_ptr_Private_int %data %int_6 + %221 = OpLoad %int %220 + %222 = OpConvertSToF %float %221 + %223 = OpFDiv %float %222 %float_10 + %224 = OpFAdd %float %float_0_5 %223 + OpStore %grey %224 + OpBranch %217 + %219 = OpLabel + %225 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %226 = OpLoad %float %225 + %227 = OpConvertFToS %int %226 + %228 = OpSLessThan %bool %227 %int_240 + OpSelectionMerge %229 None + OpBranchConditional %228 %230 %231 + %230 = OpLabel + %232 = OpAccessChain %_ptr_Private_int %data %int_7 + %233 = OpLoad %int %232 + %234 = OpConvertSToF %float %233 + %235 = OpFDiv %float %234 %float_10 + %236 = OpFAdd %float %float_0_5 %235 + OpStore %grey %236 + OpBranch %229 + %231 = OpLabel + %237 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %238 = OpLoad %float %237 + %239 = OpConvertFToS %int %238 + %240 = OpSLessThan %bool %239 %int_270 + OpSelectionMerge %241 None + OpBranchConditional %240 %242 %243 + %242 = OpLabel + %244 = OpAccessChain %_ptr_Private_int %data %int_8 + %245 = OpLoad %int %244 + %246 = OpConvertSToF %float %245 + %247 = OpFDiv %float %246 %float_10 + %248 = OpFAdd %float %float_0_5 %247 + OpStore %grey %248 + OpBranch %241 + %243 = OpLabel + OpKill + %241 = OpLabel + OpBranch %229 + %229 = OpLabel + OpBranch %217 + %217 = OpLabel + OpBranch %205 + %205 = OpLabel + OpBranch %198 + %198 = OpLabel + OpBranch %186 + %186 = OpLabel + OpBranch %174 + %174 = OpLabel + OpBranch %162 + %162 = OpLabel + OpBranch %150 + %150 = OpLabel + %249 = OpLoad %float %grey + %250 = OpCompositeConstruct %v3float %249 %249 %249 + %251 = OpCompositeExtract %float %250 0 + %252 = OpCompositeExtract %float %250 1 + %253 = OpCompositeExtract %float %250 2 + %254 = OpCompositeConstruct %v4float %251 %252 %253 %float_1 + OpStore %_GLF_color %254 + OpReturn + OpFunctionEnd +%merge_i1_i1_i1_ = OpFunction %void None %37 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %255 = OpLabel + %k = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %256 = OpLoad %int %from + OpStore %k %256 + %257 = OpLoad %int %from + OpStore %i %257 + %258 = OpLoad %int %mid + %259 = OpIAdd %int %258 %int_1 + OpStore %j %259 + OpBranch %260 + %260 = OpLabel + OpLoopMerge %261 %262 None + OpBranch %263 + %263 = OpLabel + %264 = OpLoad %int %i + %265 = OpLoad %int %mid + %266 = OpSLessThanEqual %bool %264 %265 + %267 = OpLoad %int %j + %268 = OpLoad %int %to + %269 = OpSLessThanEqual %bool %267 %268 + %270 = OpLogicalAnd %bool %266 %269 + OpBranchConditional %270 %271 %261 + %271 = OpLabel + %272 = OpLoad %int %i + %273 = OpAccessChain %_ptr_Private_int %data %272 + %274 = OpLoad %int %273 + %275 = OpLoad %int %j + %276 = OpAccessChain %_ptr_Private_int %data %275 + %277 = OpLoad %int %276 + %278 = OpSLessThan %bool %274 %277 + OpSelectionMerge %279 None + OpBranchConditional %278 %280 %281 + %280 = OpLabel + %282 = OpLoad %int %k + %283 = OpIAdd %int %282 %int_1 + OpStore %k %283 + %284 = OpLoad %int %i + %285 = OpIAdd %int %284 %int_1 + OpStore %i %285 + %286 = OpAccessChain %_ptr_Private_int %data %284 + %287 = OpLoad %int %286 + %288 = OpAccessChain %_ptr_Private_int %temp %282 + OpStore %288 %287 + OpBranch %279 + %281 = OpLabel + %289 = OpLoad %int %k + %290 = OpIAdd %int %289 %int_1 + OpStore %k %290 + %291 = OpLoad %int %j + %292 = OpIAdd %int %291 %int_1 + OpStore %j %292 + %293 = OpAccessChain %_ptr_Private_int %data %291 + %294 = OpLoad %int %293 + %295 = OpAccessChain %_ptr_Private_int %temp %289 + OpStore %295 %294 + OpBranch %279 + %279 = OpLabel + OpBranch %262 + %262 = OpLabel + OpBranch %260 + %261 = OpLabel + OpBranch %296 + %296 = OpLabel + %297 = OpFUnordGreaterThanEqual %bool %float_256 %float_1 + OpLoopMerge %298 %299 None + OpBranchConditional %297 %300 %299 + %300 = OpLabel + %301 = OpLoad %int %i + %302 = OpSLessThan %bool %301 %int_10 + %303 = OpLoad %int %i + %304 = OpLoad %int %mid + %305 = OpSLessThanEqual %bool %303 %304 + %306 = OpLogicalAnd %bool %302 %305 + OpBranchConditional %306 %307 %298 + %307 = OpLabel + OpBranch %308 + %308 = OpLabel + %309 = OpLoad %int %k + %310 = OpIAdd %int %309 %int_1 + OpStore %k %310 + %311 = OpLoad %int %i + %312 = OpIAdd %int %311 %int_1 + OpStore %i %312 + %313 = OpAccessChain %_ptr_Private_int %data %311 + %314 = OpLoad %int %313 + %315 = OpAccessChain %_ptr_Private_int %temp %309 + OpStore %315 %314 + OpBranchConditional %true %299 %299 + %299 = OpLabel + OpBranch %296 + %298 = OpLabel + %316 = OpLoad %int %from + OpStore %i_0 %316 + OpBranch %317 + %317 = OpLabel + OpLoopMerge %318 %319 None + OpBranch %320 + %320 = OpLabel + %321 = OpLoad %int %i_0 + %322 = OpLoad %int %to + %323 = OpSLessThanEqual %bool %321 %322 + OpBranchConditional %323 %324 %318 + %324 = OpLabel + %325 = OpLoad %int %i_0 + %326 = OpLoad %int %i_0 + %327 = OpAccessChain %_ptr_Private_int %temp %326 + %328 = OpLoad %int %327 + %329 = OpAccessChain %_ptr_Private_int %data %325 + OpStore %329 %328 + OpBranch %319 + %319 = OpLabel + %330 = OpLoad %int %i_0 + %331 = OpIAdd %int %330 %int_1 + OpStore %i_0 %331 + OpBranch %317 + %318 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %34 + %332 = OpLabel + %low = OpVariable %_ptr_Function_int Function + %high = OpVariable %_ptr_Function_int Function + %m = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %from_0 = OpVariable %_ptr_Function_int Function + %mid_0 = OpVariable %_ptr_Function_int Function + %to_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %333 + %333 = OpLabel + OpLoopMerge %334 %335 None + OpBranch %336 + %336 = OpLabel + %337 = OpLoad %int %m + %338 = OpLoad %int %high + %339 = OpSLessThanEqual %bool %337 %338 + OpBranchConditional %339 %340 %334 + %340 = OpLabel + %341 = OpLoad %int %low + OpStore %i_1 %341 + OpBranch %342 + %342 = OpLabel + OpLoopMerge %343 %344 None + OpBranch %345 + %345 = OpLabel + %346 = OpLoad %int %i_1 + %347 = OpLoad %int %high + %348 = OpSLessThan %bool %346 %347 + OpBranchConditional %348 %349 %343 + %349 = OpLabel + %350 = OpLoad %int %i_1 + OpStore %from_0 %350 + %351 = OpLoad %int %i_1 + %352 = OpLoad %int %m + %353 = OpIAdd %int %351 %352 + %354 = OpISub %int %353 %int_1 + OpStore %mid_0 %354 + %355 = OpLoad %int %i_1 + %356 = OpLoad %int %m + %357 = OpIMul %int %int_2 %356 + %358 = OpIAdd %int %355 %357 + %359 = OpISub %int %358 %int_1 + %360 = OpLoad %int %high + %361 = OpExtInst %int %1 SMin %359 %360 + OpStore %to_0 %361 + %362 = OpLoad %int %from_0 + OpStore %param %362 + %363 = OpLoad %int %mid_0 + OpStore %param_0 %363 + %364 = OpLoad %int %to_0 + OpStore %param_1 %364 + %365 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_0 %param_1 + OpBranch %344 + %344 = OpLabel + %366 = OpLoad %int %m + %367 = OpIMul %int %int_2 %366 + %368 = OpLoad %int %i_1 + %369 = OpIAdd %int %368 %367 + OpStore %i_1 %369 + OpBranch %342 + %343 = OpLabel + OpBranch %335 + %335 = OpLabel + %370 = OpLoad %int %m + %371 = OpIMul %int %int_2 %370 + OpStore %m %371 + OpBranch %333 + %334 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..61539cb6d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.hlsl @@ -0,0 +1,275 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_32 : register(b1, space0) { + uint4 x_32[1]; +}; + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_256 = from; + k = x_256; + const int x_257 = from; + i = x_257; + const int x_258 = mid; + j = (x_258 + 1); + while (true) { + const int x_264 = i; + const int x_265 = mid; + const int x_267 = j; + const int x_268 = to; + bool tint_tmp = (x_264 <= x_265); + if (tint_tmp) { + tint_tmp = (x_267 <= x_268); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_274 = data[i]; + const int x_277 = data[j]; + if ((x_274 < x_277)) { + const int x_282 = k; + k = (x_282 + 1); + const int x_284 = i; + i = (x_284 + 1); + const int x_287 = data[x_284]; + temp[x_282] = x_287; + } else { + const int x_289 = k; + k = (x_289 + 1); + const int x_291 = j; + j = (x_291 + 1); + const int x_294 = data[x_291]; + temp[x_289] = x_294; + } + } + while (true) { + if (!((256.0f < 1.0f))) { + } else { + continue; + } + const int x_301 = i; + const int x_303 = i; + const int x_304 = mid; + bool tint_tmp_1 = (x_301 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_303 <= x_304); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_309 = k; + k = (x_309 + 1); + const int x_311 = i; + i = (x_311 + 1); + const int x_314 = data[x_311]; + temp[x_309] = x_314; + } + const int x_316 = from; + i_1 = x_316; + while (true) { + const int x_321 = i_1; + const int x_322 = to; + if ((x_321 <= x_322)) { + } else { + break; + } + const int x_325 = i_1; + const int x_328 = temp[i_1]; + data[x_325] = x_328; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_89 = asfloat(x_28[0].x); + i_3 = int(x_89); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_138 = j_1; + const int x_141 = data[j_1]; + temp[x_138] = x_141; + } + } + mergeSort_(); + const float x_147 = gl_FragCoord.y; + if ((int(x_147) < 30)) { + const int x_154 = data[0]; + grey = (0.5f + (float(x_154) / 10.0f)); + } else { + const float x_159 = gl_FragCoord.y; + if ((int(x_159) < 60)) { + const int x_166 = data[1]; + grey = (0.5f + (float(x_166) / 10.0f)); + } else { + const float x_171 = gl_FragCoord.y; + if ((int(x_171) < 90)) { + const int x_178 = data[2]; + grey = (0.5f + (float(x_178) / 10.0f)); + } else { + const float x_183 = gl_FragCoord.y; + if ((int(x_183) < 120)) { + const int x_190 = data[3]; + grey = (0.5f + (float(x_190) / 10.0f)); + } else { + const float x_195 = gl_FragCoord.y; + if ((int(x_195) < 150)) { + discard; + } else { + const float x_202 = gl_FragCoord.y; + if ((int(x_202) < 180)) { + const int x_209 = data[5]; + grey = (0.5f + (float(x_209) / 10.0f)); + } else { + const float x_214 = gl_FragCoord.y; + if ((int(x_214) < 210)) { + const int x_221 = data[6]; + grey = (0.5f + (float(x_221) / 10.0f)); + } else { + const float x_226 = gl_FragCoord.y; + if ((int(x_226) < 240)) { + const int x_233 = data[7]; + grey = (0.5f + (float(x_233) / 10.0f)); + } else { + const float x_238 = gl_FragCoord.y; + if ((int(x_238) < 270)) { + const int x_245 = data[8]; + grey = (0.5f + (float(x_245) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_249 = grey; + const float3 x_250 = float3(x_249, x_249, x_249); + x_GLF_color = float4(x_250.x, x_250.y, x_250.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.msl new file mode 100644 index 0000000000..e2f24480fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.msl @@ -0,0 +1,321 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_256 = *(from); + k = x_256; + int const x_257 = *(from); + i = x_257; + int const x_258 = *(mid); + j = (x_258 + 1); + while (true) { + int const x_264 = i; + int const x_265 = *(mid); + int const x_267 = j; + int const x_268 = *(to); + if (((x_264 <= x_265) && (x_267 <= x_268))) { + } else { + break; + } + int const x_272 = i; + int const x_274 = (*(tint_symbol_5)).arr[x_272]; + int const x_275 = j; + int const x_277 = (*(tint_symbol_5)).arr[x_275]; + if ((x_274 < x_277)) { + int const x_282 = k; + k = (x_282 + 1); + int const x_284 = i; + i = (x_284 + 1); + int const x_287 = (*(tint_symbol_5)).arr[x_284]; + (*(tint_symbol_6)).arr[x_282] = x_287; + } else { + int const x_289 = k; + k = (x_289 + 1); + int const x_291 = j; + j = (x_291 + 1); + int const x_294 = (*(tint_symbol_5)).arr[x_291]; + (*(tint_symbol_6)).arr[x_289] = x_294; + } + } + while (true) { + if (!((256.0f < 1.0f))) { + } else { + continue; + } + int const x_301 = i; + int const x_303 = i; + int const x_304 = *(mid); + if (((x_301 < 10) && (x_303 <= x_304))) { + } else { + break; + } + int const x_309 = k; + k = (x_309 + 1); + int const x_311 = i; + i = (x_311 + 1); + int const x_314 = (*(tint_symbol_5)).arr[x_311]; + (*(tint_symbol_6)).arr[x_309] = x_314; + } + int const x_316 = *(from); + i_1 = x_316; + while (true) { + int const x_321 = i_1; + int const x_322 = *(to); + if ((x_321 <= x_322)) { + } else { + break; + } + int const x_325 = i_1; + int const x_326 = i_1; + int const x_328 = (*(tint_symbol_6)).arr[x_326]; + (*(tint_symbol_5)).arr[x_325] = x_328; + { + int const x_330 = i_1; + i_1 = (x_330 + 1); + } + } + return; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_337 = m; + int const x_338 = high; + if ((x_337 <= x_338)) { + } else { + break; + } + int const x_341 = low; + i_2 = x_341; + while (true) { + int const x_346 = i_2; + int const x_347 = high; + if ((x_346 < x_347)) { + } else { + break; + } + int const x_350 = i_2; + from_1 = x_350; + int const x_351 = i_2; + int const x_352 = m; + mid_1 = ((x_351 + x_352) - 1); + int const x_355 = i_2; + int const x_356 = m; + int const x_360 = high; + to_1 = min(((x_355 + (2 * x_356)) - 1), x_360); + int const x_362 = from_1; + param = x_362; + int const x_363 = mid_1; + param_1 = x_363; + int const x_364 = to_1; + param_2 = x_364; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_366 = m; + int const x_368 = i_2; + i_2 = (x_368 + (2 * x_366)); + } + } + { + int const x_370 = m; + m = (2 * x_370); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_89 = x_28.injectionSwitch.x; + i_3 = int(x_89); + while (true) { + int const x_95 = i_3; + switch(x_95) { + case 9: { + int const x_125 = i_3; + (*(tint_symbol_9)).arr[x_125] = -5; + break; + } + case 8: { + int const x_123 = i_3; + (*(tint_symbol_9)).arr[x_123] = -4; + break; + } + case 7: { + int const x_121 = i_3; + (*(tint_symbol_9)).arr[x_121] = -3; + break; + } + case 6: { + int const x_119 = i_3; + (*(tint_symbol_9)).arr[x_119] = -2; + break; + } + case 5: { + int const x_117 = i_3; + (*(tint_symbol_9)).arr[x_117] = -1; + break; + } + case 4: { + int const x_115 = i_3; + (*(tint_symbol_9)).arr[x_115] = 0; + break; + } + case 3: { + int const x_113 = i_3; + (*(tint_symbol_9)).arr[x_113] = 1; + break; + } + case 2: { + int const x_111 = i_3; + (*(tint_symbol_9)).arr[x_111] = 2; + break; + } + case 1: { + int const x_109 = i_3; + (*(tint_symbol_9)).arr[x_109] = 3; + break; + } + case 0: { + int const x_107 = i_3; + (*(tint_symbol_9)).arr[x_107] = 4; + break; + } + default: { + break; + } + } + int const x_127 = i_3; + i_3 = (x_127 + 1); + { + int const x_129 = i_3; + if ((x_129 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_135 = j_1; + if ((x_135 < 10)) { + } else { + break; + } + int const x_138 = j_1; + int const x_139 = j_1; + int const x_141 = (*(tint_symbol_9)).arr[x_139]; + (*(tint_symbol_10)).arr[x_138] = x_141; + { + int const x_143 = j_1; + j_1 = (x_143 + 1); + } + } + mergeSort_(tint_symbol_9, tint_symbol_10); + float const x_147 = (*(tint_symbol_11)).y; + if ((int(x_147) < 30)) { + int const x_154 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_154) / 10.0f)); + } else { + float const x_159 = (*(tint_symbol_11)).y; + if ((int(x_159) < 60)) { + int const x_166 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_166) / 10.0f)); + } else { + float const x_171 = (*(tint_symbol_11)).y; + if ((int(x_171) < 90)) { + int const x_178 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_178) / 10.0f)); + } else { + float const x_183 = (*(tint_symbol_11)).y; + if ((int(x_183) < 120)) { + int const x_190 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_190) / 10.0f)); + } else { + float const x_195 = (*(tint_symbol_11)).y; + if ((int(x_195) < 150)) { + discard_fragment(); + } else { + float const x_202 = (*(tint_symbol_11)).y; + if ((int(x_202) < 180)) { + int const x_209 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_209) / 10.0f)); + } else { + float const x_214 = (*(tint_symbol_11)).y; + if ((int(x_214) < 210)) { + int const x_221 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_221) / 10.0f)); + } else { + float const x_226 = (*(tint_symbol_11)).y; + if ((int(x_226) < 240)) { + int const x_233 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_233) / 10.0f)); + } else { + float const x_238 = (*(tint_symbol_11)).y; + if ((int(x_238) < 270)) { + int const x_245 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_245) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_249 = grey; + float3 const x_250 = float3(x_249, x_249, x_249); + *(tint_symbol_12) = float4(x_250.x, x_250.y, x_250.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..f632619db4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.spvasm @@ -0,0 +1,670 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 425 +; Schema: 0 + OpCapability Shader + %187 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_32 "x_32" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_32 NonWritable + OpDecorate %x_32 DescriptorSet 0 + OpDecorate %x_32 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_32 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %35 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %float_256 = OpConstant %float 256 + %float_1 = OpConstant %float 1 + %int_10 = OpConstant %int 10 + %142 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %211 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %main_out = OpTypeStruct %v4float + %412 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %26 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %33 = OpLabel + %k = OpVariable %_ptr_Function_int Function %35 + %i = OpVariable %_ptr_Function_int Function %35 + %j = OpVariable %_ptr_Function_int Function %35 + %i_1 = OpVariable %_ptr_Function_int Function %35 + %40 = OpLoad %int %from + OpStore %k %40 + %42 = OpLoad %int %from + OpStore %i %42 + %44 = OpLoad %int %mid + %46 = OpIAdd %int %44 %int_1 + OpStore %j %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i + %53 = OpLoad %int %mid + %54 = OpLoad %int %j + %56 = OpLoad %int %to + %57 = OpSLessThanEqual %bool %51 %53 + OpSelectionMerge %59 None + OpBranchConditional %57 %60 %59 + %60 = OpLabel + %61 = OpSLessThanEqual %bool %54 %56 + OpBranch %59 + %59 = OpLabel + %62 = OpPhi %bool %57 %50 %61 %60 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %48 + %63 = OpLabel + %66 = OpLoad %int %i + %68 = OpAccessChain %_ptr_Private_int %data %66 + %69 = OpLoad %int %68 + %70 = OpLoad %int %j + %71 = OpAccessChain %_ptr_Private_int %data %70 + %72 = OpLoad %int %71 + %73 = OpSLessThan %bool %69 %72 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %77 = OpLoad %int %k + %78 = OpIAdd %int %77 %int_1 + OpStore %k %78 + %79 = OpLoad %int %i + %80 = OpIAdd %int %79 %int_1 + OpStore %i %80 + %81 = OpAccessChain %_ptr_Private_int %data %79 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Private_int %temp %77 + OpStore %83 %82 + OpBranch %74 + %76 = OpLabel + %84 = OpLoad %int %k + %85 = OpIAdd %int %84 %int_1 + OpStore %k %85 + %86 = OpLoad %int %j + %87 = OpIAdd %int %86 %int_1 + OpStore %j %87 + %88 = OpAccessChain %_ptr_Private_int %data %86 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Private_int %temp %84 + OpStore %90 %89 + OpBranch %74 + %74 = OpLabel + OpBranch %49 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %98 = OpFOrdLessThan %bool %float_256 %float_1 + %95 = OpLogicalNot %bool %98 + OpSelectionMerge %99 None + OpBranchConditional %95 %100 %101 + %100 = OpLabel + OpBranch %99 + %101 = OpLabel + OpBranch %93 + %99 = OpLabel + %102 = OpLoad %int %i + %103 = OpLoad %int %i + %105 = OpLoad %int %mid + %107 = OpSLessThan %bool %102 %int_10 + OpSelectionMerge %108 None + OpBranchConditional %107 %109 %108 + %109 = OpLabel + %110 = OpSLessThanEqual %bool %103 %105 + OpBranch %108 + %108 = OpLabel + %111 = OpPhi %bool %107 %99 %110 %109 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %114 + %113 = OpLabel + OpBranch %112 + %114 = OpLabel + OpBranch %92 + %112 = OpLabel + %115 = OpLoad %int %k + %116 = OpIAdd %int %115 %int_1 + OpStore %k %116 + %117 = OpLoad %int %i + %118 = OpIAdd %int %117 %int_1 + OpStore %i %118 + %119 = OpAccessChain %_ptr_Private_int %data %117 + %120 = OpLoad %int %119 + %121 = OpAccessChain %_ptr_Private_int %temp %115 + OpStore %121 %120 + OpBranch %93 + %93 = OpLabel + OpBranch %91 + %92 = OpLabel + %123 = OpLoad %int %from + OpStore %i_1 %123 + OpBranch %124 + %124 = OpLabel + OpLoopMerge %125 %126 None + OpBranch %127 + %127 = OpLabel + %128 = OpLoad %int %i_1 + %130 = OpLoad %int %to + %131 = OpSLessThanEqual %bool %128 %130 + OpSelectionMerge %132 None + OpBranchConditional %131 %133 %134 + %133 = OpLabel + OpBranch %132 + %134 = OpLabel + OpBranch %125 + %132 = OpLabel + %135 = OpLoad %int %i_1 + %136 = OpLoad %int %i_1 + %137 = OpAccessChain %_ptr_Private_int %temp %136 + %138 = OpLoad %int %137 + %139 = OpAccessChain %_ptr_Private_int %data %135 + OpStore %139 %138 + OpBranch %126 + %126 = OpLabel + %140 = OpLoad %int %i_1 + %141 = OpIAdd %int %140 %int_1 + OpStore %i_1 %141 + OpBranch %124 + %125 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %142 + %144 = OpLabel + %low = OpVariable %_ptr_Function_int Function %35 + %high = OpVariable %_ptr_Function_int Function %35 + %m = OpVariable %_ptr_Function_int Function %35 + %i_2 = OpVariable %_ptr_Function_int Function %35 + %from_1 = OpVariable %_ptr_Function_int Function %35 + %mid_1 = OpVariable %_ptr_Function_int Function %35 + %to_1 = OpVariable %_ptr_Function_int Function %35 + %param = OpVariable %_ptr_Function_int Function %35 + %param_1 = OpVariable %_ptr_Function_int Function %35 + %param_2 = OpVariable %_ptr_Function_int Function %35 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %157 + %157 = OpLabel + OpLoopMerge %158 %159 None + OpBranch %160 + %160 = OpLabel + %161 = OpLoad %int %m + %162 = OpLoad %int %high + %163 = OpSLessThanEqual %bool %161 %162 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %166 + %165 = OpLabel + OpBranch %164 + %166 = OpLabel + OpBranch %158 + %164 = OpLabel + %167 = OpLoad %int %low + OpStore %i_2 %167 + OpBranch %168 + %168 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %172 = OpLoad %int %i_2 + %173 = OpLoad %int %high + %174 = OpSLessThan %bool %172 %173 + OpSelectionMerge %175 None + OpBranchConditional %174 %176 %177 + %176 = OpLabel + OpBranch %175 + %177 = OpLabel + OpBranch %169 + %175 = OpLabel + %178 = OpLoad %int %i_2 + OpStore %from_1 %178 + %179 = OpLoad %int %i_2 + %180 = OpLoad %int %m + %181 = OpIAdd %int %179 %180 + %182 = OpISub %int %181 %int_1 + OpStore %mid_1 %182 + %183 = OpLoad %int %i_2 + %184 = OpLoad %int %m + %185 = OpLoad %int %high + %189 = OpIMul %int %int_2 %184 + %190 = OpIAdd %int %183 %189 + %191 = OpISub %int %190 %int_1 + %186 = OpExtInst %int %187 SMin %191 %185 + OpStore %to_1 %186 + %192 = OpLoad %int %from_1 + OpStore %param %192 + %193 = OpLoad %int %mid_1 + OpStore %param_1 %193 + %194 = OpLoad %int %to_1 + OpStore %param_2 %194 + %195 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %170 + %170 = OpLabel + %199 = OpLoad %int %m + %200 = OpLoad %int %i_2 + %201 = OpIMul %int %int_2 %199 + %202 = OpIAdd %int %200 %201 + OpStore %i_2 %202 + OpBranch %168 + %169 = OpLabel + OpBranch %159 + %159 = OpLabel + %203 = OpLoad %int %m + %204 = OpIMul %int %int_2 %203 + OpStore %m %204 + OpBranch %157 + %158 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %142 + %206 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %35 + %j_1 = OpVariable %_ptr_Function_int Function %35 + %grey = OpVariable %_ptr_Function_float Function %211 + %214 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %215 = OpLoad %float %214 + %216 = OpConvertFToS %int %215 + OpStore %i_3 %216 + OpBranch %217 + %217 = OpLabel + OpLoopMerge %218 %219 None + OpBranch %220 + %220 = OpLabel + %221 = OpLoad %int %i_3 + OpSelectionMerge %222 None + OpSwitch %221 %223 9 %224 8 %225 7 %226 6 %227 5 %228 4 %229 3 %230 2 %231 1 %232 0 %233 + %224 = OpLabel + %234 = OpLoad %int %i_3 + %235 = OpAccessChain %_ptr_Private_int %data %234 + OpStore %235 %int_n5 + OpBranch %222 + %225 = OpLabel + %237 = OpLoad %int %i_3 + %238 = OpAccessChain %_ptr_Private_int %data %237 + OpStore %238 %int_n4 + OpBranch %222 + %226 = OpLabel + %240 = OpLoad %int %i_3 + %241 = OpAccessChain %_ptr_Private_int %data %240 + OpStore %241 %int_n3 + OpBranch %222 + %227 = OpLabel + %243 = OpLoad %int %i_3 + %244 = OpAccessChain %_ptr_Private_int %data %243 + OpStore %244 %int_n2 + OpBranch %222 + %228 = OpLabel + %246 = OpLoad %int %i_3 + %247 = OpAccessChain %_ptr_Private_int %data %246 + OpStore %247 %int_n1 + OpBranch %222 + %229 = OpLabel + %249 = OpLoad %int %i_3 + %250 = OpAccessChain %_ptr_Private_int %data %249 + OpStore %250 %int_0 + OpBranch %222 + %230 = OpLabel + %251 = OpLoad %int %i_3 + %252 = OpAccessChain %_ptr_Private_int %data %251 + OpStore %252 %int_1 + OpBranch %222 + %231 = OpLabel + %253 = OpLoad %int %i_3 + %254 = OpAccessChain %_ptr_Private_int %data %253 + OpStore %254 %int_2 + OpBranch %222 + %232 = OpLabel + %255 = OpLoad %int %i_3 + %256 = OpAccessChain %_ptr_Private_int %data %255 + OpStore %256 %int_3 + OpBranch %222 + %233 = OpLabel + %258 = OpLoad %int %i_3 + %259 = OpAccessChain %_ptr_Private_int %data %258 + OpStore %259 %int_4 + OpBranch %222 + %223 = OpLabel + OpBranch %222 + %222 = OpLabel + %261 = OpLoad %int %i_3 + %262 = OpIAdd %int %261 %int_1 + OpStore %i_3 %262 + OpBranch %219 + %219 = OpLabel + %263 = OpLoad %int %i_3 + %264 = OpSLessThan %bool %263 %int_10 + OpSelectionMerge %265 None + OpBranchConditional %264 %266 %267 + %266 = OpLabel + OpBranch %265 + %267 = OpLabel + OpBranch %218 + %265 = OpLabel + OpBranch %217 + %218 = OpLabel + OpStore %j_1 %int_0 + OpBranch %268 + %268 = OpLabel + OpLoopMerge %269 %270 None + OpBranch %271 + %271 = OpLabel + %272 = OpLoad %int %j_1 + %273 = OpSLessThan %bool %272 %int_10 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %276 + %275 = OpLabel + OpBranch %274 + %276 = OpLabel + OpBranch %269 + %274 = OpLabel + %277 = OpLoad %int %j_1 + %278 = OpLoad %int %j_1 + %279 = OpAccessChain %_ptr_Private_int %data %278 + %280 = OpLoad %int %279 + %281 = OpAccessChain %_ptr_Private_int %temp %277 + OpStore %281 %280 + OpBranch %270 + %270 = OpLabel + %282 = OpLoad %int %j_1 + %283 = OpIAdd %int %282 %int_1 + OpStore %j_1 %283 + OpBranch %268 + %269 = OpLabel + %284 = OpFunctionCall %void %mergeSort_ + %287 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %288 = OpLoad %float %287 + %289 = OpConvertFToS %int %288 + %291 = OpSLessThan %bool %289 %int_30 + OpSelectionMerge %292 None + OpBranchConditional %291 %293 %294 + %293 = OpLabel + %295 = OpAccessChain %_ptr_Private_int %data %int_0 + %296 = OpLoad %int %295 + %298 = OpConvertSToF %float %296 + %300 = OpFDiv %float %298 %float_10 + %301 = OpFAdd %float %float_0_5 %300 + OpStore %grey %301 + OpBranch %292 + %294 = OpLabel + %302 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %303 = OpLoad %float %302 + %304 = OpConvertFToS %int %303 + %306 = OpSLessThan %bool %304 %int_60 + OpSelectionMerge %307 None + OpBranchConditional %306 %308 %309 + %308 = OpLabel + %310 = OpAccessChain %_ptr_Private_int %data %int_1 + %311 = OpLoad %int %310 + %312 = OpConvertSToF %float %311 + %313 = OpFDiv %float %312 %float_10 + %314 = OpFAdd %float %float_0_5 %313 + OpStore %grey %314 + OpBranch %307 + %309 = OpLabel + %315 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %316 = OpLoad %float %315 + %317 = OpConvertFToS %int %316 + %319 = OpSLessThan %bool %317 %int_90 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %_ptr_Private_int %data %int_2 + %324 = OpLoad %int %323 + %325 = OpConvertSToF %float %324 + %326 = OpFDiv %float %325 %float_10 + %327 = OpFAdd %float %float_0_5 %326 + OpStore %grey %327 + OpBranch %320 + %322 = OpLabel + %328 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %329 = OpLoad %float %328 + %330 = OpConvertFToS %int %329 + %332 = OpSLessThan %bool %330 %int_120 + OpSelectionMerge %333 None + OpBranchConditional %332 %334 %335 + %334 = OpLabel + %336 = OpAccessChain %_ptr_Private_int %data %int_3 + %337 = OpLoad %int %336 + %338 = OpConvertSToF %float %337 + %339 = OpFDiv %float %338 %float_10 + %340 = OpFAdd %float %float_0_5 %339 + OpStore %grey %340 + OpBranch %333 + %335 = OpLabel + %341 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %342 = OpLoad %float %341 + %343 = OpConvertFToS %int %342 + %345 = OpSLessThan %bool %343 %int_150 + OpSelectionMerge %346 None + OpBranchConditional %345 %347 %348 + %347 = OpLabel + OpKill + %348 = OpLabel + %349 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %350 = OpLoad %float %349 + %351 = OpConvertFToS %int %350 + %353 = OpSLessThan %bool %351 %int_180 + OpSelectionMerge %354 None + OpBranchConditional %353 %355 %356 + %355 = OpLabel + %358 = OpAccessChain %_ptr_Private_int %data %int_5 + %359 = OpLoad %int %358 + %360 = OpConvertSToF %float %359 + %361 = OpFDiv %float %360 %float_10 + %362 = OpFAdd %float %float_0_5 %361 + OpStore %grey %362 + OpBranch %354 + %356 = OpLabel + %363 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %364 = OpLoad %float %363 + %365 = OpConvertFToS %int %364 + %367 = OpSLessThan %bool %365 %int_210 + OpSelectionMerge %368 None + OpBranchConditional %367 %369 %370 + %369 = OpLabel + %372 = OpAccessChain %_ptr_Private_int %data %int_6 + %373 = OpLoad %int %372 + %374 = OpConvertSToF %float %373 + %375 = OpFDiv %float %374 %float_10 + %376 = OpFAdd %float %float_0_5 %375 + OpStore %grey %376 + OpBranch %368 + %370 = OpLabel + %377 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %378 = OpLoad %float %377 + %379 = OpConvertFToS %int %378 + %381 = OpSLessThan %bool %379 %int_240 + OpSelectionMerge %382 None + OpBranchConditional %381 %383 %384 + %383 = OpLabel + %386 = OpAccessChain %_ptr_Private_int %data %int_7 + %387 = OpLoad %int %386 + %388 = OpConvertSToF %float %387 + %389 = OpFDiv %float %388 %float_10 + %390 = OpFAdd %float %float_0_5 %389 + OpStore %grey %390 + OpBranch %382 + %384 = OpLabel + %391 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %392 = OpLoad %float %391 + %393 = OpConvertFToS %int %392 + %395 = OpSLessThan %bool %393 %int_270 + OpSelectionMerge %396 None + OpBranchConditional %395 %397 %398 + %397 = OpLabel + %400 = OpAccessChain %_ptr_Private_int %data %int_8 + %401 = OpLoad %int %400 + %402 = OpConvertSToF %float %401 + %403 = OpFDiv %float %402 %float_10 + %404 = OpFAdd %float %float_0_5 %403 + OpStore %grey %404 + OpBranch %396 + %398 = OpLabel + OpKill + %396 = OpLabel + OpBranch %382 + %382 = OpLabel + OpBranch %368 + %368 = OpLabel + OpBranch %354 + %354 = OpLabel + OpBranch %346 + %346 = OpLabel + OpBranch %333 + %333 = OpLabel + OpBranch %320 + %320 = OpLabel + OpBranch %307 + %307 = OpLabel + OpBranch %292 + %292 = OpLabel + %405 = OpLoad %float %grey + %407 = OpCompositeConstruct %v3float %405 %405 %405 + %408 = OpCompositeExtract %float %407 0 + %409 = OpCompositeExtract %float %407 1 + %410 = OpCompositeExtract %float %407 2 + %411 = OpCompositeConstruct %v4float %408 %409 %410 %float_1 + OpStore %x_GLF_color %411 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %412 +%tint_symbol_1 = OpFunctionParameter %main_out + %416 = OpLabel + %417 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %417 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %142 + %419 = OpLabel + %420 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %420 + %421 = OpFunctionCall %void %main_1 + %423 = OpLoad %v4float %x_GLF_color + %424 = OpCompositeConstruct %main_out %423 + %422 = OpFunctionCall %void %tint_symbol_3 %424 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 219[%219] is not post dominated by the back-edge block 265[%265] + %265 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..b26ac1280f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.spvasm.expected.wgsl @@ -0,0 +1,317 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_32 : buf1; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_256 : i32 = *(from); + k = x_256; + let x_257 : i32 = *(from); + i = x_257; + let x_258 : i32 = *(mid); + j = (x_258 + 1); + loop { + let x_264 : i32 = i; + let x_265 : i32 = *(mid); + let x_267 : i32 = j; + let x_268 : i32 = *(to); + if (((x_264 <= x_265) && (x_267 <= x_268))) { + } else { + break; + } + let x_272 : i32 = i; + let x_274 : i32 = data[x_272]; + let x_275 : i32 = j; + let x_277 : i32 = data[x_275]; + if ((x_274 < x_277)) { + let x_282 : i32 = k; + k = (x_282 + 1); + let x_284 : i32 = i; + i = (x_284 + 1); + let x_287 : i32 = data[x_284]; + temp[x_282] = x_287; + } else { + let x_289 : i32 = k; + k = (x_289 + 1); + let x_291 : i32 = j; + j = (x_291 + 1); + let x_294 : i32 = data[x_291]; + temp[x_289] = x_294; + } + } + loop { + if (!((256.0 < 1.0))) { + } else { + continue; + } + let x_301 : i32 = i; + let x_303 : i32 = i; + let x_304 : i32 = *(mid); + if (((x_301 < 10) && (x_303 <= x_304))) { + } else { + break; + } + let x_309 : i32 = k; + k = (x_309 + 1); + let x_311 : i32 = i; + i = (x_311 + 1); + let x_314 : i32 = data[x_311]; + temp[x_309] = x_314; + } + let x_316 : i32 = *(from); + i_1 = x_316; + loop { + let x_321 : i32 = i_1; + let x_322 : i32 = *(to); + if ((x_321 <= x_322)) { + } else { + break; + } + let x_325 : i32 = i_1; + let x_326 : i32 = i_1; + let x_328 : i32 = temp[x_326]; + data[x_325] = x_328; + + continuing { + let x_330 : i32 = i_1; + i_1 = (x_330 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_337 : i32 = m; + let x_338 : i32 = high; + if ((x_337 <= x_338)) { + } else { + break; + } + let x_341 : i32 = low; + i_2 = x_341; + loop { + let x_346 : i32 = i_2; + let x_347 : i32 = high; + if ((x_346 < x_347)) { + } else { + break; + } + let x_350 : i32 = i_2; + from_1 = x_350; + let x_351 : i32 = i_2; + let x_352 : i32 = m; + mid_1 = ((x_351 + x_352) - 1); + let x_355 : i32 = i_2; + let x_356 : i32 = m; + let x_360 : i32 = high; + to_1 = min(((x_355 + (2 * x_356)) - 1), x_360); + let x_362 : i32 = from_1; + param = x_362; + let x_363 : i32 = mid_1; + param_1 = x_363; + let x_364 : i32 = to_1; + param_2 = x_364; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_366 : i32 = m; + let x_368 : i32 = i_2; + i_2 = (x_368 + (2 * x_366)); + } + } + + continuing { + let x_370 : i32 = m; + m = (2 * x_370); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_89 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_89); + loop { + let x_95 : i32 = i_3; + switch(x_95) { + case 9: { + let x_125 : i32 = i_3; + data[x_125] = -5; + } + case 8: { + let x_123 : i32 = i_3; + data[x_123] = -4; + } + case 7: { + let x_121 : i32 = i_3; + data[x_121] = -3; + } + case 6: { + let x_119 : i32 = i_3; + data[x_119] = -2; + } + case 5: { + let x_117 : i32 = i_3; + data[x_117] = -1; + } + case 4: { + let x_115 : i32 = i_3; + data[x_115] = 0; + } + case 3: { + let x_113 : i32 = i_3; + data[x_113] = 1; + } + case 2: { + let x_111 : i32 = i_3; + data[x_111] = 2; + } + case 1: { + let x_109 : i32 = i_3; + data[x_109] = 3; + } + case 0: { + let x_107 : i32 = i_3; + data[x_107] = 4; + } + default: { + } + } + let x_127 : i32 = i_3; + i_3 = (x_127 + 1); + + continuing { + let x_129 : i32 = i_3; + if ((x_129 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_135 : i32 = j_1; + if ((x_135 < 10)) { + } else { + break; + } + let x_138 : i32 = j_1; + let x_139 : i32 = j_1; + let x_141 : i32 = data[x_139]; + temp[x_138] = x_141; + + continuing { + let x_143 : i32 = j_1; + j_1 = (x_143 + 1); + } + } + mergeSort_(); + let x_147 : f32 = gl_FragCoord.y; + if ((i32(x_147) < 30)) { + let x_154 : i32 = data[0]; + grey = (0.5 + (f32(x_154) / 10.0)); + } else { + let x_159 : f32 = gl_FragCoord.y; + if ((i32(x_159) < 60)) { + let x_166 : i32 = data[1]; + grey = (0.5 + (f32(x_166) / 10.0)); + } else { + let x_171 : f32 = gl_FragCoord.y; + if ((i32(x_171) < 90)) { + let x_178 : i32 = data[2]; + grey = (0.5 + (f32(x_178) / 10.0)); + } else { + let x_183 : f32 = gl_FragCoord.y; + if ((i32(x_183) < 120)) { + let x_190 : i32 = data[3]; + grey = (0.5 + (f32(x_190) / 10.0)); + } else { + let x_195 : f32 = gl_FragCoord.y; + if ((i32(x_195) < 150)) { + discard; + } else { + let x_202 : f32 = gl_FragCoord.y; + if ((i32(x_202) < 180)) { + let x_209 : i32 = data[5]; + grey = (0.5 + (f32(x_209) / 10.0)); + } else { + let x_214 : f32 = gl_FragCoord.y; + if ((i32(x_214) < 210)) { + let x_221 : i32 = data[6]; + grey = (0.5 + (f32(x_221) / 10.0)); + } else { + let x_226 : f32 = gl_FragCoord.y; + if ((i32(x_226) < 240)) { + let x_233 : i32 = data[7]; + grey = (0.5 + (f32(x_233) / 10.0)); + } else { + let x_238 : f32 = gl_FragCoord.y; + if ((i32(x_238) < 270)) { + let x_245 : i32 = data[8]; + grey = (0.5 + (f32(x_245) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_249 : f32 = grey; + let x_250 : vec3 = vec3(x_249, x_249, x_249); + x_GLF_color = vec4(x_250.x, x_250.y, x_250.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl new file mode 100644 index 0000000000..b26ac1280f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl @@ -0,0 +1,317 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_32 : buf1; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_256 : i32 = *(from); + k = x_256; + let x_257 : i32 = *(from); + i = x_257; + let x_258 : i32 = *(mid); + j = (x_258 + 1); + loop { + let x_264 : i32 = i; + let x_265 : i32 = *(mid); + let x_267 : i32 = j; + let x_268 : i32 = *(to); + if (((x_264 <= x_265) && (x_267 <= x_268))) { + } else { + break; + } + let x_272 : i32 = i; + let x_274 : i32 = data[x_272]; + let x_275 : i32 = j; + let x_277 : i32 = data[x_275]; + if ((x_274 < x_277)) { + let x_282 : i32 = k; + k = (x_282 + 1); + let x_284 : i32 = i; + i = (x_284 + 1); + let x_287 : i32 = data[x_284]; + temp[x_282] = x_287; + } else { + let x_289 : i32 = k; + k = (x_289 + 1); + let x_291 : i32 = j; + j = (x_291 + 1); + let x_294 : i32 = data[x_291]; + temp[x_289] = x_294; + } + } + loop { + if (!((256.0 < 1.0))) { + } else { + continue; + } + let x_301 : i32 = i; + let x_303 : i32 = i; + let x_304 : i32 = *(mid); + if (((x_301 < 10) && (x_303 <= x_304))) { + } else { + break; + } + let x_309 : i32 = k; + k = (x_309 + 1); + let x_311 : i32 = i; + i = (x_311 + 1); + let x_314 : i32 = data[x_311]; + temp[x_309] = x_314; + } + let x_316 : i32 = *(from); + i_1 = x_316; + loop { + let x_321 : i32 = i_1; + let x_322 : i32 = *(to); + if ((x_321 <= x_322)) { + } else { + break; + } + let x_325 : i32 = i_1; + let x_326 : i32 = i_1; + let x_328 : i32 = temp[x_326]; + data[x_325] = x_328; + + continuing { + let x_330 : i32 = i_1; + i_1 = (x_330 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_337 : i32 = m; + let x_338 : i32 = high; + if ((x_337 <= x_338)) { + } else { + break; + } + let x_341 : i32 = low; + i_2 = x_341; + loop { + let x_346 : i32 = i_2; + let x_347 : i32 = high; + if ((x_346 < x_347)) { + } else { + break; + } + let x_350 : i32 = i_2; + from_1 = x_350; + let x_351 : i32 = i_2; + let x_352 : i32 = m; + mid_1 = ((x_351 + x_352) - 1); + let x_355 : i32 = i_2; + let x_356 : i32 = m; + let x_360 : i32 = high; + to_1 = min(((x_355 + (2 * x_356)) - 1), x_360); + let x_362 : i32 = from_1; + param = x_362; + let x_363 : i32 = mid_1; + param_1 = x_363; + let x_364 : i32 = to_1; + param_2 = x_364; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_366 : i32 = m; + let x_368 : i32 = i_2; + i_2 = (x_368 + (2 * x_366)); + } + } + + continuing { + let x_370 : i32 = m; + m = (2 * x_370); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_89 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_89); + loop { + let x_95 : i32 = i_3; + switch(x_95) { + case 9: { + let x_125 : i32 = i_3; + data[x_125] = -5; + } + case 8: { + let x_123 : i32 = i_3; + data[x_123] = -4; + } + case 7: { + let x_121 : i32 = i_3; + data[x_121] = -3; + } + case 6: { + let x_119 : i32 = i_3; + data[x_119] = -2; + } + case 5: { + let x_117 : i32 = i_3; + data[x_117] = -1; + } + case 4: { + let x_115 : i32 = i_3; + data[x_115] = 0; + } + case 3: { + let x_113 : i32 = i_3; + data[x_113] = 1; + } + case 2: { + let x_111 : i32 = i_3; + data[x_111] = 2; + } + case 1: { + let x_109 : i32 = i_3; + data[x_109] = 3; + } + case 0: { + let x_107 : i32 = i_3; + data[x_107] = 4; + } + default: { + } + } + let x_127 : i32 = i_3; + i_3 = (x_127 + 1); + + continuing { + let x_129 : i32 = i_3; + if ((x_129 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_135 : i32 = j_1; + if ((x_135 < 10)) { + } else { + break; + } + let x_138 : i32 = j_1; + let x_139 : i32 = j_1; + let x_141 : i32 = data[x_139]; + temp[x_138] = x_141; + + continuing { + let x_143 : i32 = j_1; + j_1 = (x_143 + 1); + } + } + mergeSort_(); + let x_147 : f32 = gl_FragCoord.y; + if ((i32(x_147) < 30)) { + let x_154 : i32 = data[0]; + grey = (0.5 + (f32(x_154) / 10.0)); + } else { + let x_159 : f32 = gl_FragCoord.y; + if ((i32(x_159) < 60)) { + let x_166 : i32 = data[1]; + grey = (0.5 + (f32(x_166) / 10.0)); + } else { + let x_171 : f32 = gl_FragCoord.y; + if ((i32(x_171) < 90)) { + let x_178 : i32 = data[2]; + grey = (0.5 + (f32(x_178) / 10.0)); + } else { + let x_183 : f32 = gl_FragCoord.y; + if ((i32(x_183) < 120)) { + let x_190 : i32 = data[3]; + grey = (0.5 + (f32(x_190) / 10.0)); + } else { + let x_195 : f32 = gl_FragCoord.y; + if ((i32(x_195) < 150)) { + discard; + } else { + let x_202 : f32 = gl_FragCoord.y; + if ((i32(x_202) < 180)) { + let x_209 : i32 = data[5]; + grey = (0.5 + (f32(x_209) / 10.0)); + } else { + let x_214 : f32 = gl_FragCoord.y; + if ((i32(x_214) < 210)) { + let x_221 : i32 = data[6]; + grey = (0.5 + (f32(x_221) / 10.0)); + } else { + let x_226 : f32 = gl_FragCoord.y; + if ((i32(x_226) < 240)) { + let x_233 : i32 = data[7]; + grey = (0.5 + (f32(x_233) / 10.0)); + } else { + let x_238 : f32 = gl_FragCoord.y; + if ((i32(x_238) < 270)) { + let x_245 : i32 = data[8]; + grey = (0.5 + (f32(x_245) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_249 : f32 = grey; + let x_250 : vec3 = vec3(x_249, x_249, x_249); + x_GLF_color = vec4(x_250.x, x_250.y, x_250.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..61539cb6d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.hlsl @@ -0,0 +1,275 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_32 : register(b1, space0) { + uint4 x_32[1]; +}; + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_256 = from; + k = x_256; + const int x_257 = from; + i = x_257; + const int x_258 = mid; + j = (x_258 + 1); + while (true) { + const int x_264 = i; + const int x_265 = mid; + const int x_267 = j; + const int x_268 = to; + bool tint_tmp = (x_264 <= x_265); + if (tint_tmp) { + tint_tmp = (x_267 <= x_268); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_274 = data[i]; + const int x_277 = data[j]; + if ((x_274 < x_277)) { + const int x_282 = k; + k = (x_282 + 1); + const int x_284 = i; + i = (x_284 + 1); + const int x_287 = data[x_284]; + temp[x_282] = x_287; + } else { + const int x_289 = k; + k = (x_289 + 1); + const int x_291 = j; + j = (x_291 + 1); + const int x_294 = data[x_291]; + temp[x_289] = x_294; + } + } + while (true) { + if (!((256.0f < 1.0f))) { + } else { + continue; + } + const int x_301 = i; + const int x_303 = i; + const int x_304 = mid; + bool tint_tmp_1 = (x_301 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_303 <= x_304); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_309 = k; + k = (x_309 + 1); + const int x_311 = i; + i = (x_311 + 1); + const int x_314 = data[x_311]; + temp[x_309] = x_314; + } + const int x_316 = from; + i_1 = x_316; + while (true) { + const int x_321 = i_1; + const int x_322 = to; + if ((x_321 <= x_322)) { + } else { + break; + } + const int x_325 = i_1; + const int x_328 = temp[i_1]; + data[x_325] = x_328; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_89 = asfloat(x_28[0].x); + i_3 = int(x_89); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_138 = j_1; + const int x_141 = data[j_1]; + temp[x_138] = x_141; + } + } + mergeSort_(); + const float x_147 = gl_FragCoord.y; + if ((int(x_147) < 30)) { + const int x_154 = data[0]; + grey = (0.5f + (float(x_154) / 10.0f)); + } else { + const float x_159 = gl_FragCoord.y; + if ((int(x_159) < 60)) { + const int x_166 = data[1]; + grey = (0.5f + (float(x_166) / 10.0f)); + } else { + const float x_171 = gl_FragCoord.y; + if ((int(x_171) < 90)) { + const int x_178 = data[2]; + grey = (0.5f + (float(x_178) / 10.0f)); + } else { + const float x_183 = gl_FragCoord.y; + if ((int(x_183) < 120)) { + const int x_190 = data[3]; + grey = (0.5f + (float(x_190) / 10.0f)); + } else { + const float x_195 = gl_FragCoord.y; + if ((int(x_195) < 150)) { + discard; + } else { + const float x_202 = gl_FragCoord.y; + if ((int(x_202) < 180)) { + const int x_209 = data[5]; + grey = (0.5f + (float(x_209) / 10.0f)); + } else { + const float x_214 = gl_FragCoord.y; + if ((int(x_214) < 210)) { + const int x_221 = data[6]; + grey = (0.5f + (float(x_221) / 10.0f)); + } else { + const float x_226 = gl_FragCoord.y; + if ((int(x_226) < 240)) { + const int x_233 = data[7]; + grey = (0.5f + (float(x_233) / 10.0f)); + } else { + const float x_238 = gl_FragCoord.y; + if ((int(x_238) < 270)) { + const int x_245 = data[8]; + grey = (0.5f + (float(x_245) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_249 = grey; + const float3 x_250 = float3(x_249, x_249, x_249); + x_GLF_color = float4(x_250.x, x_250.y, x_250.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.msl new file mode 100644 index 0000000000..e2f24480fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.msl @@ -0,0 +1,321 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_256 = *(from); + k = x_256; + int const x_257 = *(from); + i = x_257; + int const x_258 = *(mid); + j = (x_258 + 1); + while (true) { + int const x_264 = i; + int const x_265 = *(mid); + int const x_267 = j; + int const x_268 = *(to); + if (((x_264 <= x_265) && (x_267 <= x_268))) { + } else { + break; + } + int const x_272 = i; + int const x_274 = (*(tint_symbol_5)).arr[x_272]; + int const x_275 = j; + int const x_277 = (*(tint_symbol_5)).arr[x_275]; + if ((x_274 < x_277)) { + int const x_282 = k; + k = (x_282 + 1); + int const x_284 = i; + i = (x_284 + 1); + int const x_287 = (*(tint_symbol_5)).arr[x_284]; + (*(tint_symbol_6)).arr[x_282] = x_287; + } else { + int const x_289 = k; + k = (x_289 + 1); + int const x_291 = j; + j = (x_291 + 1); + int const x_294 = (*(tint_symbol_5)).arr[x_291]; + (*(tint_symbol_6)).arr[x_289] = x_294; + } + } + while (true) { + if (!((256.0f < 1.0f))) { + } else { + continue; + } + int const x_301 = i; + int const x_303 = i; + int const x_304 = *(mid); + if (((x_301 < 10) && (x_303 <= x_304))) { + } else { + break; + } + int const x_309 = k; + k = (x_309 + 1); + int const x_311 = i; + i = (x_311 + 1); + int const x_314 = (*(tint_symbol_5)).arr[x_311]; + (*(tint_symbol_6)).arr[x_309] = x_314; + } + int const x_316 = *(from); + i_1 = x_316; + while (true) { + int const x_321 = i_1; + int const x_322 = *(to); + if ((x_321 <= x_322)) { + } else { + break; + } + int const x_325 = i_1; + int const x_326 = i_1; + int const x_328 = (*(tint_symbol_6)).arr[x_326]; + (*(tint_symbol_5)).arr[x_325] = x_328; + { + int const x_330 = i_1; + i_1 = (x_330 + 1); + } + } + return; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_337 = m; + int const x_338 = high; + if ((x_337 <= x_338)) { + } else { + break; + } + int const x_341 = low; + i_2 = x_341; + while (true) { + int const x_346 = i_2; + int const x_347 = high; + if ((x_346 < x_347)) { + } else { + break; + } + int const x_350 = i_2; + from_1 = x_350; + int const x_351 = i_2; + int const x_352 = m; + mid_1 = ((x_351 + x_352) - 1); + int const x_355 = i_2; + int const x_356 = m; + int const x_360 = high; + to_1 = min(((x_355 + (2 * x_356)) - 1), x_360); + int const x_362 = from_1; + param = x_362; + int const x_363 = mid_1; + param_1 = x_363; + int const x_364 = to_1; + param_2 = x_364; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_366 = m; + int const x_368 = i_2; + i_2 = (x_368 + (2 * x_366)); + } + } + { + int const x_370 = m; + m = (2 * x_370); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_89 = x_28.injectionSwitch.x; + i_3 = int(x_89); + while (true) { + int const x_95 = i_3; + switch(x_95) { + case 9: { + int const x_125 = i_3; + (*(tint_symbol_9)).arr[x_125] = -5; + break; + } + case 8: { + int const x_123 = i_3; + (*(tint_symbol_9)).arr[x_123] = -4; + break; + } + case 7: { + int const x_121 = i_3; + (*(tint_symbol_9)).arr[x_121] = -3; + break; + } + case 6: { + int const x_119 = i_3; + (*(tint_symbol_9)).arr[x_119] = -2; + break; + } + case 5: { + int const x_117 = i_3; + (*(tint_symbol_9)).arr[x_117] = -1; + break; + } + case 4: { + int const x_115 = i_3; + (*(tint_symbol_9)).arr[x_115] = 0; + break; + } + case 3: { + int const x_113 = i_3; + (*(tint_symbol_9)).arr[x_113] = 1; + break; + } + case 2: { + int const x_111 = i_3; + (*(tint_symbol_9)).arr[x_111] = 2; + break; + } + case 1: { + int const x_109 = i_3; + (*(tint_symbol_9)).arr[x_109] = 3; + break; + } + case 0: { + int const x_107 = i_3; + (*(tint_symbol_9)).arr[x_107] = 4; + break; + } + default: { + break; + } + } + int const x_127 = i_3; + i_3 = (x_127 + 1); + { + int const x_129 = i_3; + if ((x_129 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_135 = j_1; + if ((x_135 < 10)) { + } else { + break; + } + int const x_138 = j_1; + int const x_139 = j_1; + int const x_141 = (*(tint_symbol_9)).arr[x_139]; + (*(tint_symbol_10)).arr[x_138] = x_141; + { + int const x_143 = j_1; + j_1 = (x_143 + 1); + } + } + mergeSort_(tint_symbol_9, tint_symbol_10); + float const x_147 = (*(tint_symbol_11)).y; + if ((int(x_147) < 30)) { + int const x_154 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_154) / 10.0f)); + } else { + float const x_159 = (*(tint_symbol_11)).y; + if ((int(x_159) < 60)) { + int const x_166 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_166) / 10.0f)); + } else { + float const x_171 = (*(tint_symbol_11)).y; + if ((int(x_171) < 90)) { + int const x_178 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_178) / 10.0f)); + } else { + float const x_183 = (*(tint_symbol_11)).y; + if ((int(x_183) < 120)) { + int const x_190 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_190) / 10.0f)); + } else { + float const x_195 = (*(tint_symbol_11)).y; + if ((int(x_195) < 150)) { + discard_fragment(); + } else { + float const x_202 = (*(tint_symbol_11)).y; + if ((int(x_202) < 180)) { + int const x_209 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_209) / 10.0f)); + } else { + float const x_214 = (*(tint_symbol_11)).y; + if ((int(x_214) < 210)) { + int const x_221 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_221) / 10.0f)); + } else { + float const x_226 = (*(tint_symbol_11)).y; + if ((int(x_226) < 240)) { + int const x_233 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_233) / 10.0f)); + } else { + float const x_238 = (*(tint_symbol_11)).y; + if ((int(x_238) < 270)) { + int const x_245 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_245) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_249 = grey; + float3 const x_250 = float3(x_249, x_249, x_249); + *(tint_symbol_12) = float4(x_250.x, x_250.y, x_250.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..f632619db4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.spvasm @@ -0,0 +1,670 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 425 +; Schema: 0 + OpCapability Shader + %187 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_32 "x_32" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_32 NonWritable + OpDecorate %x_32 DescriptorSet 0 + OpDecorate %x_32 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_32 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %35 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %float_256 = OpConstant %float 256 + %float_1 = OpConstant %float 1 + %int_10 = OpConstant %int 10 + %142 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %211 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %main_out = OpTypeStruct %v4float + %412 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %26 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %33 = OpLabel + %k = OpVariable %_ptr_Function_int Function %35 + %i = OpVariable %_ptr_Function_int Function %35 + %j = OpVariable %_ptr_Function_int Function %35 + %i_1 = OpVariable %_ptr_Function_int Function %35 + %40 = OpLoad %int %from + OpStore %k %40 + %42 = OpLoad %int %from + OpStore %i %42 + %44 = OpLoad %int %mid + %46 = OpIAdd %int %44 %int_1 + OpStore %j %46 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i + %53 = OpLoad %int %mid + %54 = OpLoad %int %j + %56 = OpLoad %int %to + %57 = OpSLessThanEqual %bool %51 %53 + OpSelectionMerge %59 None + OpBranchConditional %57 %60 %59 + %60 = OpLabel + %61 = OpSLessThanEqual %bool %54 %56 + OpBranch %59 + %59 = OpLabel + %62 = OpPhi %bool %57 %50 %61 %60 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %48 + %63 = OpLabel + %66 = OpLoad %int %i + %68 = OpAccessChain %_ptr_Private_int %data %66 + %69 = OpLoad %int %68 + %70 = OpLoad %int %j + %71 = OpAccessChain %_ptr_Private_int %data %70 + %72 = OpLoad %int %71 + %73 = OpSLessThan %bool %69 %72 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %77 = OpLoad %int %k + %78 = OpIAdd %int %77 %int_1 + OpStore %k %78 + %79 = OpLoad %int %i + %80 = OpIAdd %int %79 %int_1 + OpStore %i %80 + %81 = OpAccessChain %_ptr_Private_int %data %79 + %82 = OpLoad %int %81 + %83 = OpAccessChain %_ptr_Private_int %temp %77 + OpStore %83 %82 + OpBranch %74 + %76 = OpLabel + %84 = OpLoad %int %k + %85 = OpIAdd %int %84 %int_1 + OpStore %k %85 + %86 = OpLoad %int %j + %87 = OpIAdd %int %86 %int_1 + OpStore %j %87 + %88 = OpAccessChain %_ptr_Private_int %data %86 + %89 = OpLoad %int %88 + %90 = OpAccessChain %_ptr_Private_int %temp %84 + OpStore %90 %89 + OpBranch %74 + %74 = OpLabel + OpBranch %49 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + OpBranch %91 + %91 = OpLabel + OpLoopMerge %92 %93 None + OpBranch %94 + %94 = OpLabel + %98 = OpFOrdLessThan %bool %float_256 %float_1 + %95 = OpLogicalNot %bool %98 + OpSelectionMerge %99 None + OpBranchConditional %95 %100 %101 + %100 = OpLabel + OpBranch %99 + %101 = OpLabel + OpBranch %93 + %99 = OpLabel + %102 = OpLoad %int %i + %103 = OpLoad %int %i + %105 = OpLoad %int %mid + %107 = OpSLessThan %bool %102 %int_10 + OpSelectionMerge %108 None + OpBranchConditional %107 %109 %108 + %109 = OpLabel + %110 = OpSLessThanEqual %bool %103 %105 + OpBranch %108 + %108 = OpLabel + %111 = OpPhi %bool %107 %99 %110 %109 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %114 + %113 = OpLabel + OpBranch %112 + %114 = OpLabel + OpBranch %92 + %112 = OpLabel + %115 = OpLoad %int %k + %116 = OpIAdd %int %115 %int_1 + OpStore %k %116 + %117 = OpLoad %int %i + %118 = OpIAdd %int %117 %int_1 + OpStore %i %118 + %119 = OpAccessChain %_ptr_Private_int %data %117 + %120 = OpLoad %int %119 + %121 = OpAccessChain %_ptr_Private_int %temp %115 + OpStore %121 %120 + OpBranch %93 + %93 = OpLabel + OpBranch %91 + %92 = OpLabel + %123 = OpLoad %int %from + OpStore %i_1 %123 + OpBranch %124 + %124 = OpLabel + OpLoopMerge %125 %126 None + OpBranch %127 + %127 = OpLabel + %128 = OpLoad %int %i_1 + %130 = OpLoad %int %to + %131 = OpSLessThanEqual %bool %128 %130 + OpSelectionMerge %132 None + OpBranchConditional %131 %133 %134 + %133 = OpLabel + OpBranch %132 + %134 = OpLabel + OpBranch %125 + %132 = OpLabel + %135 = OpLoad %int %i_1 + %136 = OpLoad %int %i_1 + %137 = OpAccessChain %_ptr_Private_int %temp %136 + %138 = OpLoad %int %137 + %139 = OpAccessChain %_ptr_Private_int %data %135 + OpStore %139 %138 + OpBranch %126 + %126 = OpLabel + %140 = OpLoad %int %i_1 + %141 = OpIAdd %int %140 %int_1 + OpStore %i_1 %141 + OpBranch %124 + %125 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %142 + %144 = OpLabel + %low = OpVariable %_ptr_Function_int Function %35 + %high = OpVariable %_ptr_Function_int Function %35 + %m = OpVariable %_ptr_Function_int Function %35 + %i_2 = OpVariable %_ptr_Function_int Function %35 + %from_1 = OpVariable %_ptr_Function_int Function %35 + %mid_1 = OpVariable %_ptr_Function_int Function %35 + %to_1 = OpVariable %_ptr_Function_int Function %35 + %param = OpVariable %_ptr_Function_int Function %35 + %param_1 = OpVariable %_ptr_Function_int Function %35 + %param_2 = OpVariable %_ptr_Function_int Function %35 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %157 + %157 = OpLabel + OpLoopMerge %158 %159 None + OpBranch %160 + %160 = OpLabel + %161 = OpLoad %int %m + %162 = OpLoad %int %high + %163 = OpSLessThanEqual %bool %161 %162 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %166 + %165 = OpLabel + OpBranch %164 + %166 = OpLabel + OpBranch %158 + %164 = OpLabel + %167 = OpLoad %int %low + OpStore %i_2 %167 + OpBranch %168 + %168 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %172 = OpLoad %int %i_2 + %173 = OpLoad %int %high + %174 = OpSLessThan %bool %172 %173 + OpSelectionMerge %175 None + OpBranchConditional %174 %176 %177 + %176 = OpLabel + OpBranch %175 + %177 = OpLabel + OpBranch %169 + %175 = OpLabel + %178 = OpLoad %int %i_2 + OpStore %from_1 %178 + %179 = OpLoad %int %i_2 + %180 = OpLoad %int %m + %181 = OpIAdd %int %179 %180 + %182 = OpISub %int %181 %int_1 + OpStore %mid_1 %182 + %183 = OpLoad %int %i_2 + %184 = OpLoad %int %m + %185 = OpLoad %int %high + %189 = OpIMul %int %int_2 %184 + %190 = OpIAdd %int %183 %189 + %191 = OpISub %int %190 %int_1 + %186 = OpExtInst %int %187 SMin %191 %185 + OpStore %to_1 %186 + %192 = OpLoad %int %from_1 + OpStore %param %192 + %193 = OpLoad %int %mid_1 + OpStore %param_1 %193 + %194 = OpLoad %int %to_1 + OpStore %param_2 %194 + %195 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %170 + %170 = OpLabel + %199 = OpLoad %int %m + %200 = OpLoad %int %i_2 + %201 = OpIMul %int %int_2 %199 + %202 = OpIAdd %int %200 %201 + OpStore %i_2 %202 + OpBranch %168 + %169 = OpLabel + OpBranch %159 + %159 = OpLabel + %203 = OpLoad %int %m + %204 = OpIMul %int %int_2 %203 + OpStore %m %204 + OpBranch %157 + %158 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %142 + %206 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %35 + %j_1 = OpVariable %_ptr_Function_int Function %35 + %grey = OpVariable %_ptr_Function_float Function %211 + %214 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %215 = OpLoad %float %214 + %216 = OpConvertFToS %int %215 + OpStore %i_3 %216 + OpBranch %217 + %217 = OpLabel + OpLoopMerge %218 %219 None + OpBranch %220 + %220 = OpLabel + %221 = OpLoad %int %i_3 + OpSelectionMerge %222 None + OpSwitch %221 %223 9 %224 8 %225 7 %226 6 %227 5 %228 4 %229 3 %230 2 %231 1 %232 0 %233 + %224 = OpLabel + %234 = OpLoad %int %i_3 + %235 = OpAccessChain %_ptr_Private_int %data %234 + OpStore %235 %int_n5 + OpBranch %222 + %225 = OpLabel + %237 = OpLoad %int %i_3 + %238 = OpAccessChain %_ptr_Private_int %data %237 + OpStore %238 %int_n4 + OpBranch %222 + %226 = OpLabel + %240 = OpLoad %int %i_3 + %241 = OpAccessChain %_ptr_Private_int %data %240 + OpStore %241 %int_n3 + OpBranch %222 + %227 = OpLabel + %243 = OpLoad %int %i_3 + %244 = OpAccessChain %_ptr_Private_int %data %243 + OpStore %244 %int_n2 + OpBranch %222 + %228 = OpLabel + %246 = OpLoad %int %i_3 + %247 = OpAccessChain %_ptr_Private_int %data %246 + OpStore %247 %int_n1 + OpBranch %222 + %229 = OpLabel + %249 = OpLoad %int %i_3 + %250 = OpAccessChain %_ptr_Private_int %data %249 + OpStore %250 %int_0 + OpBranch %222 + %230 = OpLabel + %251 = OpLoad %int %i_3 + %252 = OpAccessChain %_ptr_Private_int %data %251 + OpStore %252 %int_1 + OpBranch %222 + %231 = OpLabel + %253 = OpLoad %int %i_3 + %254 = OpAccessChain %_ptr_Private_int %data %253 + OpStore %254 %int_2 + OpBranch %222 + %232 = OpLabel + %255 = OpLoad %int %i_3 + %256 = OpAccessChain %_ptr_Private_int %data %255 + OpStore %256 %int_3 + OpBranch %222 + %233 = OpLabel + %258 = OpLoad %int %i_3 + %259 = OpAccessChain %_ptr_Private_int %data %258 + OpStore %259 %int_4 + OpBranch %222 + %223 = OpLabel + OpBranch %222 + %222 = OpLabel + %261 = OpLoad %int %i_3 + %262 = OpIAdd %int %261 %int_1 + OpStore %i_3 %262 + OpBranch %219 + %219 = OpLabel + %263 = OpLoad %int %i_3 + %264 = OpSLessThan %bool %263 %int_10 + OpSelectionMerge %265 None + OpBranchConditional %264 %266 %267 + %266 = OpLabel + OpBranch %265 + %267 = OpLabel + OpBranch %218 + %265 = OpLabel + OpBranch %217 + %218 = OpLabel + OpStore %j_1 %int_0 + OpBranch %268 + %268 = OpLabel + OpLoopMerge %269 %270 None + OpBranch %271 + %271 = OpLabel + %272 = OpLoad %int %j_1 + %273 = OpSLessThan %bool %272 %int_10 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %276 + %275 = OpLabel + OpBranch %274 + %276 = OpLabel + OpBranch %269 + %274 = OpLabel + %277 = OpLoad %int %j_1 + %278 = OpLoad %int %j_1 + %279 = OpAccessChain %_ptr_Private_int %data %278 + %280 = OpLoad %int %279 + %281 = OpAccessChain %_ptr_Private_int %temp %277 + OpStore %281 %280 + OpBranch %270 + %270 = OpLabel + %282 = OpLoad %int %j_1 + %283 = OpIAdd %int %282 %int_1 + OpStore %j_1 %283 + OpBranch %268 + %269 = OpLabel + %284 = OpFunctionCall %void %mergeSort_ + %287 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %288 = OpLoad %float %287 + %289 = OpConvertFToS %int %288 + %291 = OpSLessThan %bool %289 %int_30 + OpSelectionMerge %292 None + OpBranchConditional %291 %293 %294 + %293 = OpLabel + %295 = OpAccessChain %_ptr_Private_int %data %int_0 + %296 = OpLoad %int %295 + %298 = OpConvertSToF %float %296 + %300 = OpFDiv %float %298 %float_10 + %301 = OpFAdd %float %float_0_5 %300 + OpStore %grey %301 + OpBranch %292 + %294 = OpLabel + %302 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %303 = OpLoad %float %302 + %304 = OpConvertFToS %int %303 + %306 = OpSLessThan %bool %304 %int_60 + OpSelectionMerge %307 None + OpBranchConditional %306 %308 %309 + %308 = OpLabel + %310 = OpAccessChain %_ptr_Private_int %data %int_1 + %311 = OpLoad %int %310 + %312 = OpConvertSToF %float %311 + %313 = OpFDiv %float %312 %float_10 + %314 = OpFAdd %float %float_0_5 %313 + OpStore %grey %314 + OpBranch %307 + %309 = OpLabel + %315 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %316 = OpLoad %float %315 + %317 = OpConvertFToS %int %316 + %319 = OpSLessThan %bool %317 %int_90 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %_ptr_Private_int %data %int_2 + %324 = OpLoad %int %323 + %325 = OpConvertSToF %float %324 + %326 = OpFDiv %float %325 %float_10 + %327 = OpFAdd %float %float_0_5 %326 + OpStore %grey %327 + OpBranch %320 + %322 = OpLabel + %328 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %329 = OpLoad %float %328 + %330 = OpConvertFToS %int %329 + %332 = OpSLessThan %bool %330 %int_120 + OpSelectionMerge %333 None + OpBranchConditional %332 %334 %335 + %334 = OpLabel + %336 = OpAccessChain %_ptr_Private_int %data %int_3 + %337 = OpLoad %int %336 + %338 = OpConvertSToF %float %337 + %339 = OpFDiv %float %338 %float_10 + %340 = OpFAdd %float %float_0_5 %339 + OpStore %grey %340 + OpBranch %333 + %335 = OpLabel + %341 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %342 = OpLoad %float %341 + %343 = OpConvertFToS %int %342 + %345 = OpSLessThan %bool %343 %int_150 + OpSelectionMerge %346 None + OpBranchConditional %345 %347 %348 + %347 = OpLabel + OpKill + %348 = OpLabel + %349 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %350 = OpLoad %float %349 + %351 = OpConvertFToS %int %350 + %353 = OpSLessThan %bool %351 %int_180 + OpSelectionMerge %354 None + OpBranchConditional %353 %355 %356 + %355 = OpLabel + %358 = OpAccessChain %_ptr_Private_int %data %int_5 + %359 = OpLoad %int %358 + %360 = OpConvertSToF %float %359 + %361 = OpFDiv %float %360 %float_10 + %362 = OpFAdd %float %float_0_5 %361 + OpStore %grey %362 + OpBranch %354 + %356 = OpLabel + %363 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %364 = OpLoad %float %363 + %365 = OpConvertFToS %int %364 + %367 = OpSLessThan %bool %365 %int_210 + OpSelectionMerge %368 None + OpBranchConditional %367 %369 %370 + %369 = OpLabel + %372 = OpAccessChain %_ptr_Private_int %data %int_6 + %373 = OpLoad %int %372 + %374 = OpConvertSToF %float %373 + %375 = OpFDiv %float %374 %float_10 + %376 = OpFAdd %float %float_0_5 %375 + OpStore %grey %376 + OpBranch %368 + %370 = OpLabel + %377 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %378 = OpLoad %float %377 + %379 = OpConvertFToS %int %378 + %381 = OpSLessThan %bool %379 %int_240 + OpSelectionMerge %382 None + OpBranchConditional %381 %383 %384 + %383 = OpLabel + %386 = OpAccessChain %_ptr_Private_int %data %int_7 + %387 = OpLoad %int %386 + %388 = OpConvertSToF %float %387 + %389 = OpFDiv %float %388 %float_10 + %390 = OpFAdd %float %float_0_5 %389 + OpStore %grey %390 + OpBranch %382 + %384 = OpLabel + %391 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %392 = OpLoad %float %391 + %393 = OpConvertFToS %int %392 + %395 = OpSLessThan %bool %393 %int_270 + OpSelectionMerge %396 None + OpBranchConditional %395 %397 %398 + %397 = OpLabel + %400 = OpAccessChain %_ptr_Private_int %data %int_8 + %401 = OpLoad %int %400 + %402 = OpConvertSToF %float %401 + %403 = OpFDiv %float %402 %float_10 + %404 = OpFAdd %float %float_0_5 %403 + OpStore %grey %404 + OpBranch %396 + %398 = OpLabel + OpKill + %396 = OpLabel + OpBranch %382 + %382 = OpLabel + OpBranch %368 + %368 = OpLabel + OpBranch %354 + %354 = OpLabel + OpBranch %346 + %346 = OpLabel + OpBranch %333 + %333 = OpLabel + OpBranch %320 + %320 = OpLabel + OpBranch %307 + %307 = OpLabel + OpBranch %292 + %292 = OpLabel + %405 = OpLoad %float %grey + %407 = OpCompositeConstruct %v3float %405 %405 %405 + %408 = OpCompositeExtract %float %407 0 + %409 = OpCompositeExtract %float %407 1 + %410 = OpCompositeExtract %float %407 2 + %411 = OpCompositeConstruct %v4float %408 %409 %410 %float_1 + OpStore %x_GLF_color %411 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %412 +%tint_symbol_1 = OpFunctionParameter %main_out + %416 = OpLabel + %417 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %417 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %142 + %419 = OpLabel + %420 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %420 + %421 = OpFunctionCall %void %main_1 + %423 = OpLoad %v4float %x_GLF_color + %424 = OpCompositeConstruct %main_out %423 + %422 = OpFunctionCall %void %tint_symbol_3 %424 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 219[%219] is not post dominated by the back-edge block 265[%265] + %265 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..b26ac1280f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-block3/1.wgsl.expected.wgsl @@ -0,0 +1,317 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_32 : buf1; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_256 : i32 = *(from); + k = x_256; + let x_257 : i32 = *(from); + i = x_257; + let x_258 : i32 = *(mid); + j = (x_258 + 1); + loop { + let x_264 : i32 = i; + let x_265 : i32 = *(mid); + let x_267 : i32 = j; + let x_268 : i32 = *(to); + if (((x_264 <= x_265) && (x_267 <= x_268))) { + } else { + break; + } + let x_272 : i32 = i; + let x_274 : i32 = data[x_272]; + let x_275 : i32 = j; + let x_277 : i32 = data[x_275]; + if ((x_274 < x_277)) { + let x_282 : i32 = k; + k = (x_282 + 1); + let x_284 : i32 = i; + i = (x_284 + 1); + let x_287 : i32 = data[x_284]; + temp[x_282] = x_287; + } else { + let x_289 : i32 = k; + k = (x_289 + 1); + let x_291 : i32 = j; + j = (x_291 + 1); + let x_294 : i32 = data[x_291]; + temp[x_289] = x_294; + } + } + loop { + if (!((256.0 < 1.0))) { + } else { + continue; + } + let x_301 : i32 = i; + let x_303 : i32 = i; + let x_304 : i32 = *(mid); + if (((x_301 < 10) && (x_303 <= x_304))) { + } else { + break; + } + let x_309 : i32 = k; + k = (x_309 + 1); + let x_311 : i32 = i; + i = (x_311 + 1); + let x_314 : i32 = data[x_311]; + temp[x_309] = x_314; + } + let x_316 : i32 = *(from); + i_1 = x_316; + loop { + let x_321 : i32 = i_1; + let x_322 : i32 = *(to); + if ((x_321 <= x_322)) { + } else { + break; + } + let x_325 : i32 = i_1; + let x_326 : i32 = i_1; + let x_328 : i32 = temp[x_326]; + data[x_325] = x_328; + + continuing { + let x_330 : i32 = i_1; + i_1 = (x_330 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_337 : i32 = m; + let x_338 : i32 = high; + if ((x_337 <= x_338)) { + } else { + break; + } + let x_341 : i32 = low; + i_2 = x_341; + loop { + let x_346 : i32 = i_2; + let x_347 : i32 = high; + if ((x_346 < x_347)) { + } else { + break; + } + let x_350 : i32 = i_2; + from_1 = x_350; + let x_351 : i32 = i_2; + let x_352 : i32 = m; + mid_1 = ((x_351 + x_352) - 1); + let x_355 : i32 = i_2; + let x_356 : i32 = m; + let x_360 : i32 = high; + to_1 = min(((x_355 + (2 * x_356)) - 1), x_360); + let x_362 : i32 = from_1; + param = x_362; + let x_363 : i32 = mid_1; + param_1 = x_363; + let x_364 : i32 = to_1; + param_2 = x_364; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_366 : i32 = m; + let x_368 : i32 = i_2; + i_2 = (x_368 + (2 * x_366)); + } + } + + continuing { + let x_370 : i32 = m; + m = (2 * x_370); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_89 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_89); + loop { + let x_95 : i32 = i_3; + switch(x_95) { + case 9: { + let x_125 : i32 = i_3; + data[x_125] = -5; + } + case 8: { + let x_123 : i32 = i_3; + data[x_123] = -4; + } + case 7: { + let x_121 : i32 = i_3; + data[x_121] = -3; + } + case 6: { + let x_119 : i32 = i_3; + data[x_119] = -2; + } + case 5: { + let x_117 : i32 = i_3; + data[x_117] = -1; + } + case 4: { + let x_115 : i32 = i_3; + data[x_115] = 0; + } + case 3: { + let x_113 : i32 = i_3; + data[x_113] = 1; + } + case 2: { + let x_111 : i32 = i_3; + data[x_111] = 2; + } + case 1: { + let x_109 : i32 = i_3; + data[x_109] = 3; + } + case 0: { + let x_107 : i32 = i_3; + data[x_107] = 4; + } + default: { + } + } + let x_127 : i32 = i_3; + i_3 = (x_127 + 1); + + continuing { + let x_129 : i32 = i_3; + if ((x_129 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_135 : i32 = j_1; + if ((x_135 < 10)) { + } else { + break; + } + let x_138 : i32 = j_1; + let x_139 : i32 = j_1; + let x_141 : i32 = data[x_139]; + temp[x_138] = x_141; + + continuing { + let x_143 : i32 = j_1; + j_1 = (x_143 + 1); + } + } + mergeSort_(); + let x_147 : f32 = gl_FragCoord.y; + if ((i32(x_147) < 30)) { + let x_154 : i32 = data[0]; + grey = (0.5 + (f32(x_154) / 10.0)); + } else { + let x_159 : f32 = gl_FragCoord.y; + if ((i32(x_159) < 60)) { + let x_166 : i32 = data[1]; + grey = (0.5 + (f32(x_166) / 10.0)); + } else { + let x_171 : f32 = gl_FragCoord.y; + if ((i32(x_171) < 90)) { + let x_178 : i32 = data[2]; + grey = (0.5 + (f32(x_178) / 10.0)); + } else { + let x_183 : f32 = gl_FragCoord.y; + if ((i32(x_183) < 120)) { + let x_190 : i32 = data[3]; + grey = (0.5 + (f32(x_190) / 10.0)); + } else { + let x_195 : f32 = gl_FragCoord.y; + if ((i32(x_195) < 150)) { + discard; + } else { + let x_202 : f32 = gl_FragCoord.y; + if ((i32(x_202) < 180)) { + let x_209 : i32 = data[5]; + grey = (0.5 + (f32(x_209) / 10.0)); + } else { + let x_214 : f32 = gl_FragCoord.y; + if ((i32(x_214) < 210)) { + let x_221 : i32 = data[6]; + grey = (0.5 + (f32(x_221) / 10.0)); + } else { + let x_226 : f32 = gl_FragCoord.y; + if ((i32(x_226) < 240)) { + let x_233 : i32 = data[7]; + grey = (0.5 + (f32(x_233) / 10.0)); + } else { + let x_238 : f32 = gl_FragCoord.y; + if ((i32(x_238) < 270)) { + let x_245 : i32 = data[8]; + grey = (0.5 + (f32(x_245) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_249 : f32 = grey; + let x_250 : vec3 = vec3(x_249, x_249, x_249); + x_GLF_color = vec4(x_250.x, x_250.y, x_250.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm new file mode 100644 index 0000000000..682080cf20 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm @@ -0,0 +1,695 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree "tree" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %34 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %uint_0 = OpConstant %uint 0 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool +%_ptr_Function__arr_BST_uint_10 = OpTypePointer Function %_arr_BST_uint_10 + %40 = OpUndef %int + %41 = OpConstantComposite %BST %int_9 %int_n1 %int_n1 + %42 = OpConstantComposite %BST %int_5 %int_n1 %int_n1 + %43 = OpConstantComposite %BST %int_12 %int_n1 %int_n1 + %int_3 = OpConstant %int 3 + %45 = OpConstantComposite %BST %int_15 %int_n1 %int_n1 + %int_4 = OpConstant %int 4 + %47 = OpConstantComposite %BST %int_7 %int_n1 %int_n1 + %48 = OpConstantComposite %BST %int_8 %int_n1 %int_n1 + %49 = OpConstantComposite %BST %int_2 %int_n1 %int_n1 + %50 = OpConstantComposite %BST %int_6 %int_n1 %int_n1 + %51 = OpConstantComposite %BST %int_17 %int_n1 %int_n1 + %52 = OpConstantComposite %BST %int_13 %int_n1 %int_n1 + %int_15_0 = OpConstant %int 15 + %int_6_0 = OpConstant %int 6 + %uint_3 = OpConstant %uint 3 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %7 + %57 = OpLabel + %tree = OpVariable %_ptr_Function__arr_BST_uint_10 Function + %58 = OpAccessChain %_ptr_Function_BST %tree %int_0 + OpStore %58 %41 + OpSelectionMerge %59 None + OpSwitch %uint_0 %60 + %60 = OpLabel + OpBranch %61 + %61 = OpLabel + %62 = OpPhi %int %int_0 %60 %63 %64 + %65 = OpSLessThanEqual %bool %62 %int_1 + OpLoopMerge %66 %64 None + OpBranchConditional %65 %67 %66 + %67 = OpLabel + %68 = OpAccessChain %_ptr_Function_int %tree %62 %int_0 + %69 = OpLoad %int %68 + %70 = OpSLessThanEqual %bool %int_5 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %73 = OpLabel + %74 = OpAccessChain %_ptr_Function_int %tree %62 %int_2 + %75 = OpLoad %int %74 + %76 = OpIEqual %bool %75 %int_n1 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %79 = OpLabel + %80 = OpLoad %int %74 + OpBranch %64 + %78 = OpLabel + OpStore %74 %int_1 + %81 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %81 %42 + OpBranch %66 + %77 = OpLabel + OpUnreachable + %72 = OpLabel + %82 = OpAccessChain %_ptr_Function_int %tree %62 %int_1 + %83 = OpLoad %int %82 + %84 = OpIEqual %bool %83 %int_n1 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %87 + %87 = OpLabel + %88 = OpLoad %int %82 + OpBranch %64 + %86 = OpLabel + OpStore %82 %int_1 + %89 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %89 %42 + OpBranch %66 + %85 = OpLabel + OpUnreachable + %71 = OpLabel + OpUnreachable + %64 = OpLabel + %63 = OpPhi %int %80 %79 %88 %87 + OpBranch %61 + %66 = OpLabel + %90 = OpPhi %bool %false %61 %true %78 %true %86 + OpSelectionMerge %91 None + OpBranchConditional %90 %59 %91 + %91 = OpLabel + OpBranch %59 + %59 = OpLabel + OpSelectionMerge %92 None + OpSwitch %uint_0 %93 + %93 = OpLabel + OpBranch %94 + %94 = OpLabel + %95 = OpPhi %int %int_0 %93 %96 %97 + %98 = OpSLessThanEqual %bool %95 %int_2 + OpLoopMerge %99 %97 None + OpBranchConditional %98 %100 %99 + %100 = OpLabel + %101 = OpAccessChain %_ptr_Function_int %tree %95 %int_0 + %102 = OpLoad %int %101 + %103 = OpSLessThanEqual %bool %int_12 %102 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %106 + %106 = OpLabel + %107 = OpAccessChain %_ptr_Function_int %tree %95 %int_2 + %108 = OpLoad %int %107 + %109 = OpIEqual %bool %108 %int_n1 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %112 + %112 = OpLabel + %113 = OpLoad %int %107 + OpBranch %97 + %111 = OpLabel + OpStore %107 %int_2 + %114 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %114 %43 + OpBranch %99 + %110 = OpLabel + OpUnreachable + %105 = OpLabel + %115 = OpAccessChain %_ptr_Function_int %tree %95 %int_1 + %116 = OpLoad %int %115 + %117 = OpIEqual %bool %116 %int_n1 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %120 + %120 = OpLabel + %121 = OpLoad %int %115 + OpBranch %97 + %119 = OpLabel + OpStore %115 %int_2 + %122 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %122 %43 + OpBranch %99 + %118 = OpLabel + OpUnreachable + %104 = OpLabel + OpUnreachable + %97 = OpLabel + %96 = OpPhi %int %113 %112 %121 %120 + OpBranch %94 + %99 = OpLabel + %123 = OpPhi %bool %false %94 %true %111 %true %119 + OpSelectionMerge %124 None + OpBranchConditional %123 %92 %124 + %124 = OpLabel + OpBranch %92 + %92 = OpLabel + OpSelectionMerge %125 None + OpSwitch %uint_0 %126 + %126 = OpLabel + OpBranch %127 + %127 = OpLabel + %128 = OpPhi %int %int_0 %126 %129 %130 + %131 = OpSLessThanEqual %bool %128 %int_3 + OpLoopMerge %132 %130 None + OpBranchConditional %131 %133 %132 + %133 = OpLabel + %134 = OpAccessChain %_ptr_Function_int %tree %128 %int_0 + %135 = OpLoad %int %134 + %136 = OpSLessThanEqual %bool %int_15 %135 + OpSelectionMerge %137 None + OpBranchConditional %136 %138 %139 + %139 = OpLabel + %140 = OpAccessChain %_ptr_Function_int %tree %128 %int_2 + %141 = OpLoad %int %140 + %142 = OpIEqual %bool %141 %int_n1 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %145 + %145 = OpLabel + %146 = OpLoad %int %140 + OpBranch %130 + %144 = OpLabel + OpStore %140 %int_3 + %147 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %147 %45 + OpBranch %132 + %143 = OpLabel + OpUnreachable + %138 = OpLabel + %148 = OpAccessChain %_ptr_Function_int %tree %128 %int_1 + %149 = OpLoad %int %148 + %150 = OpIEqual %bool %149 %int_n1 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %153 + %153 = OpLabel + %154 = OpLoad %int %148 + OpBranch %130 + %152 = OpLabel + OpStore %148 %int_3 + %155 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %155 %45 + OpBranch %132 + %151 = OpLabel + OpUnreachable + %137 = OpLabel + OpUnreachable + %130 = OpLabel + %129 = OpPhi %int %146 %145 %154 %153 + OpBranch %127 + %132 = OpLabel + %156 = OpPhi %bool %false %127 %true %144 %true %152 + OpSelectionMerge %157 None + OpBranchConditional %156 %125 %157 + %157 = OpLabel + OpBranch %125 + %125 = OpLabel + OpSelectionMerge %158 None + OpSwitch %uint_0 %159 + %159 = OpLabel + OpBranch %160 + %160 = OpLabel + %161 = OpPhi %int %int_0 %159 %162 %163 + %164 = OpSLessThanEqual %bool %161 %int_4 + OpLoopMerge %165 %163 None + OpBranchConditional %164 %166 %165 + %166 = OpLabel + %167 = OpAccessChain %_ptr_Function_int %tree %161 %int_0 + %168 = OpLoad %int %167 + %169 = OpSLessThanEqual %bool %int_7 %168 + OpSelectionMerge %170 None + OpBranchConditional %169 %171 %172 + %172 = OpLabel + %173 = OpAccessChain %_ptr_Function_int %tree %161 %int_2 + %174 = OpLoad %int %173 + %175 = OpIEqual %bool %174 %int_n1 + OpSelectionMerge %176 None + OpBranchConditional %175 %177 %178 + %178 = OpLabel + %179 = OpLoad %int %173 + OpBranch %163 + %177 = OpLabel + OpStore %173 %int_4 + %180 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %180 %47 + OpBranch %165 + %176 = OpLabel + OpUnreachable + %171 = OpLabel + %181 = OpAccessChain %_ptr_Function_int %tree %161 %int_1 + %182 = OpLoad %int %181 + %183 = OpIEqual %bool %182 %int_n1 + OpSelectionMerge %184 None + OpBranchConditional %183 %185 %186 + %186 = OpLabel + %187 = OpLoad %int %181 + OpBranch %163 + %185 = OpLabel + OpStore %181 %int_4 + %188 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %188 %47 + OpBranch %165 + %184 = OpLabel + OpUnreachable + %170 = OpLabel + OpUnreachable + %163 = OpLabel + %162 = OpPhi %int %179 %178 %187 %186 + OpBranch %160 + %165 = OpLabel + %189 = OpPhi %bool %false %160 %true %177 %true %185 + OpSelectionMerge %190 None + OpBranchConditional %189 %158 %190 + %190 = OpLabel + OpBranch %158 + %158 = OpLabel + OpSelectionMerge %191 None + OpSwitch %uint_0 %192 + %192 = OpLabel + OpBranch %193 + %193 = OpLabel + %194 = OpPhi %int %int_0 %192 %195 %196 + %197 = OpSLessThanEqual %bool %194 %int_5 + OpLoopMerge %198 %196 None + OpBranchConditional %197 %199 %198 + %199 = OpLabel + %200 = OpAccessChain %_ptr_Function_int %tree %194 %int_0 + %201 = OpLoad %int %200 + %202 = OpSLessThanEqual %bool %int_8 %201 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %205 + %205 = OpLabel + %206 = OpAccessChain %_ptr_Function_int %tree %194 %int_2 + %207 = OpLoad %int %206 + %208 = OpIEqual %bool %207 %int_n1 + OpSelectionMerge %209 None + OpBranchConditional %208 %210 %211 + %211 = OpLabel + %212 = OpLoad %int %206 + OpBranch %196 + %210 = OpLabel + OpStore %206 %int_5 + %213 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %213 %48 + OpBranch %198 + %209 = OpLabel + OpUnreachable + %204 = OpLabel + %214 = OpAccessChain %_ptr_Function_int %tree %194 %int_1 + %215 = OpLoad %int %214 + %216 = OpIEqual %bool %215 %int_n1 + OpSelectionMerge %217 None + OpBranchConditional %216 %218 %219 + %219 = OpLabel + %220 = OpLoad %int %214 + OpBranch %196 + %218 = OpLabel + OpStore %214 %int_5 + %221 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %221 %48 + OpBranch %198 + %217 = OpLabel + OpUnreachable + %203 = OpLabel + OpUnreachable + %196 = OpLabel + %195 = OpPhi %int %212 %211 %220 %219 + OpBranch %193 + %198 = OpLabel + %222 = OpPhi %bool %false %193 %true %210 %true %218 + OpSelectionMerge %223 None + OpBranchConditional %222 %191 %223 + %223 = OpLabel + OpBranch %191 + %191 = OpLabel + OpSelectionMerge %224 None + OpSwitch %uint_0 %225 + %225 = OpLabel + OpBranch %226 + %226 = OpLabel + %227 = OpPhi %int %int_0 %225 %228 %229 + %230 = OpSLessThanEqual %bool %227 %int_6 + OpLoopMerge %231 %229 None + OpBranchConditional %230 %232 %231 + %232 = OpLabel + %233 = OpAccessChain %_ptr_Function_int %tree %227 %int_0 + %234 = OpLoad %int %233 + %235 = OpSLessThanEqual %bool %int_2 %234 + OpSelectionMerge %236 None + OpBranchConditional %235 %237 %238 + %238 = OpLabel + %239 = OpAccessChain %_ptr_Function_int %tree %227 %int_2 + %240 = OpLoad %int %239 + %241 = OpIEqual %bool %240 %int_n1 + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %244 + %244 = OpLabel + %245 = OpLoad %int %239 + OpBranch %229 + %243 = OpLabel + OpStore %239 %int_6 + %246 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %246 %49 + OpBranch %231 + %242 = OpLabel + OpUnreachable + %237 = OpLabel + %247 = OpAccessChain %_ptr_Function_int %tree %227 %int_1 + %248 = OpLoad %int %247 + %249 = OpIEqual %bool %248 %int_n1 + OpSelectionMerge %250 None + OpBranchConditional %249 %251 %252 + %252 = OpLabel + %253 = OpLoad %int %247 + OpBranch %229 + %251 = OpLabel + OpStore %247 %int_6 + %254 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %254 %49 + OpBranch %231 + %250 = OpLabel + OpUnreachable + %236 = OpLabel + OpUnreachable + %229 = OpLabel + %228 = OpPhi %int %245 %244 %253 %252 + OpBranch %226 + %231 = OpLabel + %255 = OpPhi %bool %false %226 %true %243 %true %251 + OpSelectionMerge %256 None + OpBranchConditional %255 %224 %256 + %256 = OpLabel + OpBranch %224 + %224 = OpLabel + OpSelectionMerge %257 None + OpSwitch %uint_0 %258 + %258 = OpLabel + OpBranch %259 + %259 = OpLabel + %260 = OpPhi %int %int_0 %258 %261 %262 + %263 = OpSLessThanEqual %bool %260 %int_7 + OpLoopMerge %264 %262 None + OpBranchConditional %263 %265 %264 + %265 = OpLabel + %266 = OpAccessChain %_ptr_Function_int %tree %260 %int_0 + %267 = OpLoad %int %266 + %268 = OpSLessThanEqual %bool %int_6 %267 + OpSelectionMerge %269 None + OpBranchConditional %268 %270 %271 + %271 = OpLabel + %272 = OpAccessChain %_ptr_Function_int %tree %260 %int_2 + %273 = OpLoad %int %272 + %274 = OpIEqual %bool %273 %int_n1 + OpSelectionMerge %275 None + OpBranchConditional %274 %276 %277 + %277 = OpLabel + %278 = OpLoad %int %272 + OpBranch %262 + %276 = OpLabel + OpStore %272 %int_7 + %279 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %279 %50 + OpBranch %264 + %275 = OpLabel + OpUnreachable + %270 = OpLabel + %280 = OpAccessChain %_ptr_Function_int %tree %260 %int_1 + %281 = OpLoad %int %280 + %282 = OpIEqual %bool %281 %int_n1 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %285 + %285 = OpLabel + %286 = OpLoad %int %280 + OpBranch %262 + %284 = OpLabel + OpStore %280 %int_7 + %287 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %287 %50 + OpBranch %264 + %283 = OpLabel + OpUnreachable + %269 = OpLabel + OpUnreachable + %262 = OpLabel + %261 = OpPhi %int %278 %277 %286 %285 + OpBranch %259 + %264 = OpLabel + %288 = OpPhi %bool %false %259 %true %276 %true %284 + OpSelectionMerge %289 None + OpBranchConditional %288 %257 %289 + %289 = OpLabel + OpBranch %257 + %257 = OpLabel + OpSelectionMerge %290 None + OpSwitch %uint_0 %291 + %291 = OpLabel + OpBranch %292 + %292 = OpLabel + %293 = OpPhi %int %int_0 %291 %294 %295 + %296 = OpSLessThanEqual %bool %293 %int_8 + OpLoopMerge %297 %295 None + OpBranchConditional %296 %298 %297 + %298 = OpLabel + %299 = OpAccessChain %_ptr_Function_int %tree %293 %int_0 + %300 = OpLoad %int %299 + %301 = OpSLessThanEqual %bool %int_17 %300 + OpSelectionMerge %302 None + OpBranchConditional %301 %303 %304 + %304 = OpLabel + %305 = OpAccessChain %_ptr_Function_int %tree %293 %int_2 + %306 = OpLoad %int %305 + %307 = OpIEqual %bool %306 %int_n1 + OpSelectionMerge %308 None + OpBranchConditional %307 %309 %310 + %310 = OpLabel + %311 = OpLoad %int %305 + OpBranch %295 + %309 = OpLabel + OpStore %305 %int_8 + %312 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %312 %51 + OpBranch %297 + %308 = OpLabel + OpUnreachable + %303 = OpLabel + %313 = OpAccessChain %_ptr_Function_int %tree %293 %int_1 + %314 = OpLoad %int %313 + %315 = OpIEqual %bool %314 %int_n1 + OpSelectionMerge %316 None + OpBranchConditional %315 %317 %318 + %318 = OpLabel + %319 = OpLoad %int %313 + OpBranch %295 + %317 = OpLabel + OpStore %313 %int_8 + %320 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %320 %51 + OpBranch %297 + %316 = OpLabel + OpUnreachable + %302 = OpLabel + OpUnreachable + %295 = OpLabel + %294 = OpPhi %int %311 %310 %319 %318 + OpBranch %292 + %297 = OpLabel + %321 = OpPhi %bool %false %292 %true %309 %true %317 + OpSelectionMerge %322 None + OpBranchConditional %321 %290 %322 + %322 = OpLabel + OpBranch %290 + %290 = OpLabel + OpSelectionMerge %323 None + OpSwitch %uint_0 %324 + %324 = OpLabel + OpBranch %325 + %325 = OpLabel + %326 = OpPhi %int %int_0 %324 %327 %328 + %329 = OpSLessThanEqual %bool %326 %int_9 + OpLoopMerge %330 %328 None + OpBranchConditional %329 %331 %330 + %331 = OpLabel + %332 = OpAccessChain %_ptr_Function_int %tree %326 %int_0 + %333 = OpLoad %int %332 + %334 = OpSLessThanEqual %bool %int_13 %333 + OpSelectionMerge %335 None + OpBranchConditional %334 %336 %337 + %337 = OpLabel + %338 = OpAccessChain %_ptr_Function_int %tree %326 %int_2 + %339 = OpLoad %int %338 + %340 = OpIEqual %bool %339 %int_n1 + OpSelectionMerge %341 None + OpBranchConditional %340 %342 %343 + %343 = OpLabel + %344 = OpLoad %int %338 + OpBranch %328 + %342 = OpLabel + OpStore %338 %int_9 + %345 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %345 %52 + OpBranch %330 + %341 = OpLabel + OpUnreachable + %336 = OpLabel + %346 = OpAccessChain %_ptr_Function_int %tree %326 %int_1 + %347 = OpLoad %int %346 + %348 = OpIEqual %bool %347 %int_n1 + OpSelectionMerge %349 None + OpBranchConditional %348 %350 %351 + %351 = OpLabel + %352 = OpLoad %int %346 + OpBranch %328 + %350 = OpLabel + OpStore %346 %int_9 + %353 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %353 %52 + OpBranch %330 + %349 = OpLabel + OpUnreachable + %335 = OpLabel + OpUnreachable + %328 = OpLabel + %327 = OpPhi %int %344 %343 %352 %351 + OpBranch %325 + %330 = OpLabel + %354 = OpPhi %bool %false %325 %true %342 %true %350 + OpSelectionMerge %355 None + OpBranchConditional %354 %323 %355 + %355 = OpLabel + OpBranch %323 + %323 = OpLabel + OpBranch %356 + %356 = OpLabel + %357 = OpPhi %int %40 %323 %358 %359 + %360 = OpPhi %int %int_0 %323 %361 %359 + %362 = OpPhi %int %int_0 %323 %363 %359 + %364 = OpSLessThan %bool %362 %int_20 + %365 = OpISub %int %int_6_0 %int_15_0 + %366 = OpULessThanEqual %bool %uint_3 %uint_3 + %367 = OpSelect %uint %366 %uint_3 %uint_3 + %368 = OpAccessChain %_ptr_Output_float %_GLF_color %367 + OpLoopMerge %369 %359 None + OpBranchConditional %364 %370 %369 + %370 = OpLabel + OpSelectionMerge %371 None + OpSwitch %uint_0 %372 + %372 = OpLabel + OpBranch %373 + %373 = OpLabel + %374 = OpPhi %int %int_0 %372 %375 %376 + %377 = OpINotEqual %bool %374 %int_n1 + OpLoopMerge %378 %376 None + OpBranchConditional %377 %379 %378 + %379 = OpLabel + %380 = OpAccessChain %_ptr_Function_BST %tree %374 + %381 = OpLoad %BST %380 + %382 = OpCompositeExtract %int %381 0 + %383 = OpCompositeExtract %int %381 1 + %384 = OpInBoundsAccessChain %_ptr_Output_float %368 + %385 = OpCompositeExtract %int %381 2 + %386 = OpIEqual %bool %382 %362 + OpSelectionMerge %387 None + OpBranchConditional %386 %388 %387 + %388 = OpLabel + OpBranch %378 + %387 = OpLabel + %389 = OpLoad %float %384 + %390 = OpSLessThanEqual %bool %362 %382 + %391 = OpLogicalNot %bool %390 + %375 = OpSelect %int %391 %385 %383 + OpBranch %376 + %376 = OpLabel + OpBranch %373 + %378 = OpLabel + %392 = OpPhi %int %357 %373 %362 %388 + %393 = OpPhi %bool %false %373 %true %388 + OpSelectionMerge %394 None + OpBranchConditional %393 %371 %394 + %394 = OpLabel + OpBranch %371 + %371 = OpLabel + %358 = OpPhi %int %392 %378 %int_n1 %394 + OpSelectionMerge %395 None + OpSwitch %362 %396 9 %397 5 %397 12 %397 15 %397 7 %397 8 %397 2 %397 6 %397 17 %397 13 %397 + %397 = OpLabel + %398 = OpIEqual %bool %358 %362 + OpSelectionMerge %399 None + OpBranchConditional %398 %400 %399 + %400 = OpLabel + %401 = OpIAdd %int %360 %int_1 + OpBranch %399 + %399 = OpLabel + %402 = OpPhi %int %360 %397 %401 %400 + OpBranch %395 + %396 = OpLabel + %403 = OpIEqual %bool %358 %int_n1 + OpSelectionMerge %404 None + OpBranchConditional %403 %405 %404 + %405 = OpLabel + %406 = OpIAdd %int %360 %int_1 + OpBranch %404 + %404 = OpLabel + %407 = OpPhi %int %360 %396 %406 %405 + OpBranch %395 + %395 = OpLabel + %361 = OpPhi %int %402 %399 %407 %404 + OpBranch %359 + %359 = OpLabel + %363 = OpIAdd %int %362 %int_1 + OpBranch %356 + %369 = OpLabel + %408 = OpIEqual %bool %360 %int_20 + OpSelectionMerge %409 None + OpBranchConditional %408 %410 %411 + %411 = OpLabel + OpStore %_GLF_color %35 + OpBranch %409 + %410 = OpLabel + OpStore %_GLF_color %34 + OpBranch %409 + %409 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..6b3b61f5d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.hlsl @@ -0,0 +1,750 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + BST tree[10] = (BST[10])0; + int x_360 = 0; + int x_62_phi = 0; + bool x_90_phi = false; + int x_357_phi = 0; + int x_360_phi = 0; + int x_362_phi = 0; + const BST tint_symbol_2 = {9, -1, -1}; + tree[0] = tint_symbol_2; + switch(0u) { + default: { + x_62_phi = 0; + while (true) { + int x_88 = 0; + int x_80 = 0; + int x_63 = 0; + int x_63_phi = 0; + const int x_62 = x_62_phi; + x_90_phi = false; + if ((x_62 <= 1)) { + } else { + break; + } + const int x_69 = tree[x_62].data; + if ((5 <= x_69)) { + const int x_82_save = x_62; + const int x_83 = tree[x_82_save].leftIndex; + if ((x_83 == -1)) { + tree[x_82_save].leftIndex = 1; + const BST tint_symbol_3 = {5, -1, -1}; + tree[1] = tint_symbol_3; + x_90_phi = true; + break; + } else { + x_88 = tree[x_82_save].leftIndex; + x_63_phi = x_88; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + continue; + } + return; + } else { + const int x_74_save = x_62; + const int x_75 = tree[x_74_save].rightIndex; + if ((x_75 == -1)) { + tree[x_74_save].rightIndex = 1; + const BST tint_symbol_4 = {5, -1, -1}; + tree[1] = tint_symbol_4; + x_90_phi = true; + break; + } else { + x_80 = tree[x_74_save].rightIndex; + x_63_phi = x_80; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + continue; + } + return; + } + return; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + } + if (x_90_phi) { + break; + } + break; + } + } + int x_95_phi = 0; + bool x_123_phi = false; + switch(0u) { + default: { + x_95_phi = 0; + while (true) { + int x_121 = 0; + int x_113 = 0; + int x_96 = 0; + int x_96_phi = 0; + const int x_95 = x_95_phi; + x_123_phi = false; + if ((x_95 <= 2)) { + } else { + break; + } + const int x_102 = tree[x_95].data; + if ((12 <= x_102)) { + const int x_115_save = x_95; + const int x_116 = tree[x_115_save].leftIndex; + if ((x_116 == -1)) { + tree[x_115_save].leftIndex = 2; + const BST tint_symbol_5 = {12, -1, -1}; + tree[2] = tint_symbol_5; + x_123_phi = true; + break; + } else { + x_121 = tree[x_115_save].leftIndex; + x_96_phi = x_121; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + continue; + } + return; + } else { + const int x_107_save = x_95; + const int x_108 = tree[x_107_save].rightIndex; + if ((x_108 == -1)) { + tree[x_107_save].rightIndex = 2; + const BST tint_symbol_6 = {12, -1, -1}; + tree[2] = tint_symbol_6; + x_123_phi = true; + break; + } else { + x_113 = tree[x_107_save].rightIndex; + x_96_phi = x_113; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + continue; + } + return; + } + return; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + } + if (x_123_phi) { + break; + } + break; + } + } + int x_128_phi = 0; + bool x_156_phi = false; + switch(0u) { + default: { + x_128_phi = 0; + while (true) { + int x_154 = 0; + int x_146 = 0; + int x_129 = 0; + int x_129_phi = 0; + const int x_128 = x_128_phi; + x_156_phi = false; + if ((x_128 <= 3)) { + } else { + break; + } + const int x_135 = tree[x_128].data; + if ((15 <= x_135)) { + const int x_148_save = x_128; + const int x_149 = tree[x_148_save].leftIndex; + if ((x_149 == -1)) { + tree[x_148_save].leftIndex = 3; + const BST tint_symbol_7 = {15, -1, -1}; + tree[3] = tint_symbol_7; + x_156_phi = true; + break; + } else { + x_154 = tree[x_148_save].leftIndex; + x_129_phi = x_154; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + continue; + } + return; + } else { + const int x_140_save = x_128; + const int x_141 = tree[x_140_save].rightIndex; + if ((x_141 == -1)) { + tree[x_140_save].rightIndex = 3; + const BST tint_symbol_8 = {15, -1, -1}; + tree[3] = tint_symbol_8; + x_156_phi = true; + break; + } else { + x_146 = tree[x_140_save].rightIndex; + x_129_phi = x_146; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + continue; + } + return; + } + return; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + } + if (x_156_phi) { + break; + } + break; + } + } + int x_161_phi = 0; + bool x_189_phi = false; + switch(0u) { + default: { + x_161_phi = 0; + while (true) { + int x_187 = 0; + int x_179 = 0; + int x_162 = 0; + int x_162_phi = 0; + const int x_161 = x_161_phi; + x_189_phi = false; + if ((x_161 <= 4)) { + } else { + break; + } + const int x_168 = tree[x_161].data; + if ((7 <= x_168)) { + const int x_181_save = x_161; + const int x_182 = tree[x_181_save].leftIndex; + if ((x_182 == -1)) { + tree[x_181_save].leftIndex = 4; + const BST tint_symbol_9 = {7, -1, -1}; + tree[4] = tint_symbol_9; + x_189_phi = true; + break; + } else { + x_187 = tree[x_181_save].leftIndex; + x_162_phi = x_187; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + continue; + } + return; + } else { + const int x_173_save = x_161; + const int x_174 = tree[x_173_save].rightIndex; + if ((x_174 == -1)) { + tree[x_173_save].rightIndex = 4; + const BST tint_symbol_10 = {7, -1, -1}; + tree[4] = tint_symbol_10; + x_189_phi = true; + break; + } else { + x_179 = tree[x_173_save].rightIndex; + x_162_phi = x_179; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + continue; + } + return; + } + return; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + } + if (x_189_phi) { + break; + } + break; + } + } + int x_194_phi = 0; + bool x_222_phi = false; + switch(0u) { + default: { + x_194_phi = 0; + while (true) { + int x_220 = 0; + int x_212 = 0; + int x_195 = 0; + int x_195_phi = 0; + const int x_194 = x_194_phi; + x_222_phi = false; + if ((x_194 <= 5)) { + } else { + break; + } + const int x_201 = tree[x_194].data; + if ((8 <= x_201)) { + const int x_214_save = x_194; + const int x_215 = tree[x_214_save].leftIndex; + if ((x_215 == -1)) { + tree[x_214_save].leftIndex = 5; + const BST tint_symbol_11 = {8, -1, -1}; + tree[5] = tint_symbol_11; + x_222_phi = true; + break; + } else { + x_220 = tree[x_214_save].leftIndex; + x_195_phi = x_220; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + continue; + } + return; + } else { + const int x_206_save = x_194; + const int x_207 = tree[x_206_save].rightIndex; + if ((x_207 == -1)) { + tree[x_206_save].rightIndex = 5; + const BST tint_symbol_12 = {8, -1, -1}; + tree[5] = tint_symbol_12; + x_222_phi = true; + break; + } else { + x_212 = tree[x_206_save].rightIndex; + x_195_phi = x_212; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + continue; + } + return; + } + return; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + } + if (x_222_phi) { + break; + } + break; + } + } + int x_227_phi = 0; + bool x_255_phi = false; + switch(0u) { + default: { + x_227_phi = 0; + while (true) { + int x_253 = 0; + int x_245 = 0; + int x_228 = 0; + int x_228_phi = 0; + const int x_227 = x_227_phi; + x_255_phi = false; + if ((x_227 <= 6)) { + } else { + break; + } + const int x_234 = tree[x_227].data; + if ((2 <= x_234)) { + const int x_247_save = x_227; + const int x_248 = tree[x_247_save].leftIndex; + if ((x_248 == -1)) { + tree[x_247_save].leftIndex = 6; + const BST tint_symbol_13 = {2, -1, -1}; + tree[6] = tint_symbol_13; + x_255_phi = true; + break; + } else { + x_253 = tree[x_247_save].leftIndex; + x_228_phi = x_253; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + continue; + } + return; + } else { + const int x_239_save = x_227; + const int x_240 = tree[x_239_save].rightIndex; + if ((x_240 == -1)) { + tree[x_239_save].rightIndex = 6; + const BST tint_symbol_14 = {2, -1, -1}; + tree[6] = tint_symbol_14; + x_255_phi = true; + break; + } else { + x_245 = tree[x_239_save].rightIndex; + x_228_phi = x_245; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + continue; + } + return; + } + return; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + } + if (x_255_phi) { + break; + } + break; + } + } + int x_260_phi = 0; + bool x_288_phi = false; + switch(0u) { + default: { + x_260_phi = 0; + while (true) { + int x_286 = 0; + int x_278 = 0; + int x_261 = 0; + int x_261_phi = 0; + const int x_260 = x_260_phi; + x_288_phi = false; + if ((x_260 <= 7)) { + } else { + break; + } + const int x_267 = tree[x_260].data; + if ((6 <= x_267)) { + const int x_280_save = x_260; + const int x_281 = tree[x_280_save].leftIndex; + if ((x_281 == -1)) { + tree[x_280_save].leftIndex = 7; + const BST tint_symbol_15 = {6, -1, -1}; + tree[7] = tint_symbol_15; + x_288_phi = true; + break; + } else { + x_286 = tree[x_280_save].leftIndex; + x_261_phi = x_286; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + continue; + } + return; + } else { + const int x_272_save = x_260; + const int x_273 = tree[x_272_save].rightIndex; + if ((x_273 == -1)) { + tree[x_272_save].rightIndex = 7; + const BST tint_symbol_16 = {6, -1, -1}; + tree[7] = tint_symbol_16; + x_288_phi = true; + break; + } else { + x_278 = tree[x_272_save].rightIndex; + x_261_phi = x_278; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + continue; + } + return; + } + return; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + } + if (x_288_phi) { + break; + } + break; + } + } + int x_293_phi = 0; + bool x_321_phi = false; + switch(0u) { + default: { + x_293_phi = 0; + while (true) { + int x_319 = 0; + int x_311 = 0; + int x_294 = 0; + int x_294_phi = 0; + const int x_293 = x_293_phi; + x_321_phi = false; + if ((x_293 <= 8)) { + } else { + break; + } + const int x_300 = tree[x_293].data; + if ((17 <= x_300)) { + const int x_313_save = x_293; + const int x_314 = tree[x_313_save].leftIndex; + if ((x_314 == -1)) { + tree[x_313_save].leftIndex = 8; + const BST tint_symbol_17 = {17, -1, -1}; + tree[8] = tint_symbol_17; + x_321_phi = true; + break; + } else { + x_319 = tree[x_313_save].leftIndex; + x_294_phi = x_319; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + continue; + } + return; + } else { + const int x_305_save = x_293; + const int x_306 = tree[x_305_save].rightIndex; + if ((x_306 == -1)) { + tree[x_305_save].rightIndex = 8; + const BST tint_symbol_18 = {17, -1, -1}; + tree[8] = tint_symbol_18; + x_321_phi = true; + break; + } else { + x_311 = tree[x_305_save].rightIndex; + x_294_phi = x_311; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + continue; + } + return; + } + return; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + } + if (x_321_phi) { + break; + } + break; + } + } + int x_326_phi = 0; + bool x_354_phi = false; + switch(0u) { + default: { + x_326_phi = 0; + while (true) { + int x_352 = 0; + int x_344 = 0; + int x_327 = 0; + int x_327_phi = 0; + const int x_326 = x_326_phi; + x_354_phi = false; + if ((x_326 <= 9)) { + } else { + break; + } + const int x_333 = tree[x_326].data; + if ((13 <= x_333)) { + const int x_346_save = x_326; + const int x_347 = tree[x_346_save].leftIndex; + if ((x_347 == -1)) { + tree[x_346_save].leftIndex = 9; + const BST tint_symbol_19 = {13, -1, -1}; + tree[9] = tint_symbol_19; + x_354_phi = true; + break; + } else { + x_352 = tree[x_346_save].leftIndex; + x_327_phi = x_352; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + continue; + } + return; + } else { + const int x_338_save = x_326; + const int x_339 = tree[x_338_save].rightIndex; + if ((x_339 == -1)) { + tree[x_338_save].rightIndex = 9; + const BST tint_symbol_20 = {13, -1, -1}; + tree[9] = tint_symbol_20; + x_354_phi = true; + break; + } else { + x_344 = tree[x_338_save].rightIndex; + x_327_phi = x_344; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + continue; + } + return; + } + return; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + } + if (x_354_phi) { + break; + } + break; + } + } + x_357_phi = 0; + x_360_phi = 0; + x_362_phi = 0; + while (true) { + int x_392 = 0; + int x_402 = 0; + int x_407 = 0; + int x_363 = 0; + int x_358_phi = 0; + int x_361_phi = 0; + const int x_357 = x_357_phi; + x_360 = x_360_phi; + const int x_362 = x_362_phi; + const int x_365 = (6 - 15); + if ((x_362 < 20)) { + } else { + break; + } + int x_374_phi = 0; + int x_392_phi = 0; + bool x_393_phi = false; + switch(0u) { + default: { + x_374_phi = 0; + while (true) { + const int x_374 = x_374_phi; + x_392_phi = x_357; + x_393_phi = false; + if ((x_374 != -1)) { + } else { + break; + } + const BST x_381 = tree[x_374]; + const int x_382 = x_381.data; + const int x_383 = x_381.leftIndex; + const int x_385 = x_381.rightIndex; + if ((x_382 == x_362)) { + x_392_phi = x_362; + x_393_phi = true; + break; + } + const float x_389 = x_GLF_color[((3u <= 3u) ? 3u : 3u)]; + { + x_374_phi = (!((x_362 <= x_382)) ? x_385 : x_383); + } + } + x_392 = x_392_phi; + const bool x_393 = x_393_phi; + x_358_phi = x_392; + if (x_393) { + break; + } + x_358_phi = -1; + break; + } + } + int x_358 = 0; + int x_401 = 0; + int x_406 = 0; + int x_402_phi = 0; + int x_407_phi = 0; + x_358 = x_358_phi; + switch(x_362) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_402_phi = x_360; + if ((x_358 == asint(x_362))) { + x_401 = asint((x_360 + asint(1))); + x_402_phi = x_401; + } + x_402 = x_402_phi; + x_361_phi = x_402; + break; + } + default: { + x_407_phi = x_360; + if ((x_358 == asint(-1))) { + x_406 = asint((x_360 + asint(1))); + x_407_phi = x_406; + } + x_407 = x_407_phi; + x_361_phi = x_407; + break; + } + } + const int x_361 = x_361_phi; + { + x_363 = (x_362 + 1); + x_357_phi = x_358; + x_360_phi = x_361; + x_362_phi = x_363; + } + } + if ((x_360 == asint(20))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_21 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_21; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.msl new file mode 100644 index 0000000000..94bc881457 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.msl @@ -0,0 +1,764 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_23) { + tint_array_wrapper tree = {}; + int x_360 = 0; + int x_62_phi = 0; + bool x_90_phi = false; + int x_357_phi = 0; + int x_360_phi = 0; + int x_362_phi = 0; + BST const tint_symbol_3 = {.data=9, .leftIndex=-1, .rightIndex=-1}; + tree.arr[0] = tint_symbol_3; + switch(0u) { + default: { + x_62_phi = 0; + while (true) { + int x_88 = 0; + int x_80 = 0; + int x_63 = 0; + int x_63_phi = 0; + int const x_62 = x_62_phi; + x_90_phi = false; + if ((x_62 <= 1)) { + } else { + break; + } + int const x_69 = tree.arr[x_62].data; + if ((5 <= x_69)) { + int const x_82_save = x_62; + int const x_83 = tree.arr[x_82_save].leftIndex; + if ((x_83 == -1)) { + tree.arr[x_82_save].leftIndex = 1; + BST const tint_symbol_4 = {.data=5, .leftIndex=-1, .rightIndex=-1}; + tree.arr[1] = tint_symbol_4; + x_90_phi = true; + break; + } else { + x_88 = tree.arr[x_82_save].leftIndex; + x_63_phi = x_88; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + continue; + } + return; + } else { + int const x_74_save = x_62; + int const x_75 = tree.arr[x_74_save].rightIndex; + if ((x_75 == -1)) { + tree.arr[x_74_save].rightIndex = 1; + BST const tint_symbol_5 = {.data=5, .leftIndex=-1, .rightIndex=-1}; + tree.arr[1] = tint_symbol_5; + x_90_phi = true; + break; + } else { + x_80 = tree.arr[x_74_save].rightIndex; + x_63_phi = x_80; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + continue; + } + return; + } + return; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + } + bool const x_90 = x_90_phi; + if (x_90) { + break; + } + break; + } + } + int x_95_phi = 0; + bool x_123_phi = false; + switch(0u) { + default: { + x_95_phi = 0; + while (true) { + int x_121 = 0; + int x_113 = 0; + int x_96 = 0; + int x_96_phi = 0; + int const x_95 = x_95_phi; + x_123_phi = false; + if ((x_95 <= 2)) { + } else { + break; + } + int const x_102 = tree.arr[x_95].data; + if ((12 <= x_102)) { + int const x_115_save = x_95; + int const x_116 = tree.arr[x_115_save].leftIndex; + if ((x_116 == -1)) { + tree.arr[x_115_save].leftIndex = 2; + BST const tint_symbol_6 = {.data=12, .leftIndex=-1, .rightIndex=-1}; + tree.arr[2] = tint_symbol_6; + x_123_phi = true; + break; + } else { + x_121 = tree.arr[x_115_save].leftIndex; + x_96_phi = x_121; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + continue; + } + return; + } else { + int const x_107_save = x_95; + int const x_108 = tree.arr[x_107_save].rightIndex; + if ((x_108 == -1)) { + tree.arr[x_107_save].rightIndex = 2; + BST const tint_symbol_7 = {.data=12, .leftIndex=-1, .rightIndex=-1}; + tree.arr[2] = tint_symbol_7; + x_123_phi = true; + break; + } else { + x_113 = tree.arr[x_107_save].rightIndex; + x_96_phi = x_113; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + continue; + } + return; + } + return; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + } + bool const x_123 = x_123_phi; + if (x_123) { + break; + } + break; + } + } + int x_128_phi = 0; + bool x_156_phi = false; + switch(0u) { + default: { + x_128_phi = 0; + while (true) { + int x_154 = 0; + int x_146 = 0; + int x_129 = 0; + int x_129_phi = 0; + int const x_128 = x_128_phi; + x_156_phi = false; + if ((x_128 <= 3)) { + } else { + break; + } + int const x_135 = tree.arr[x_128].data; + if ((15 <= x_135)) { + int const x_148_save = x_128; + int const x_149 = tree.arr[x_148_save].leftIndex; + if ((x_149 == -1)) { + tree.arr[x_148_save].leftIndex = 3; + BST const tint_symbol_8 = {.data=15, .leftIndex=-1, .rightIndex=-1}; + tree.arr[3] = tint_symbol_8; + x_156_phi = true; + break; + } else { + x_154 = tree.arr[x_148_save].leftIndex; + x_129_phi = x_154; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + continue; + } + return; + } else { + int const x_140_save = x_128; + int const x_141 = tree.arr[x_140_save].rightIndex; + if ((x_141 == -1)) { + tree.arr[x_140_save].rightIndex = 3; + BST const tint_symbol_9 = {.data=15, .leftIndex=-1, .rightIndex=-1}; + tree.arr[3] = tint_symbol_9; + x_156_phi = true; + break; + } else { + x_146 = tree.arr[x_140_save].rightIndex; + x_129_phi = x_146; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + continue; + } + return; + } + return; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + } + bool const x_156 = x_156_phi; + if (x_156) { + break; + } + break; + } + } + int x_161_phi = 0; + bool x_189_phi = false; + switch(0u) { + default: { + x_161_phi = 0; + while (true) { + int x_187 = 0; + int x_179 = 0; + int x_162 = 0; + int x_162_phi = 0; + int const x_161 = x_161_phi; + x_189_phi = false; + if ((x_161 <= 4)) { + } else { + break; + } + int const x_168 = tree.arr[x_161].data; + if ((7 <= x_168)) { + int const x_181_save = x_161; + int const x_182 = tree.arr[x_181_save].leftIndex; + if ((x_182 == -1)) { + tree.arr[x_181_save].leftIndex = 4; + BST const tint_symbol_10 = {.data=7, .leftIndex=-1, .rightIndex=-1}; + tree.arr[4] = tint_symbol_10; + x_189_phi = true; + break; + } else { + x_187 = tree.arr[x_181_save].leftIndex; + x_162_phi = x_187; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + continue; + } + return; + } else { + int const x_173_save = x_161; + int const x_174 = tree.arr[x_173_save].rightIndex; + if ((x_174 == -1)) { + tree.arr[x_173_save].rightIndex = 4; + BST const tint_symbol_11 = {.data=7, .leftIndex=-1, .rightIndex=-1}; + tree.arr[4] = tint_symbol_11; + x_189_phi = true; + break; + } else { + x_179 = tree.arr[x_173_save].rightIndex; + x_162_phi = x_179; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + continue; + } + return; + } + return; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + } + bool const x_189 = x_189_phi; + if (x_189) { + break; + } + break; + } + } + int x_194_phi = 0; + bool x_222_phi = false; + switch(0u) { + default: { + x_194_phi = 0; + while (true) { + int x_220 = 0; + int x_212 = 0; + int x_195 = 0; + int x_195_phi = 0; + int const x_194 = x_194_phi; + x_222_phi = false; + if ((x_194 <= 5)) { + } else { + break; + } + int const x_201 = tree.arr[x_194].data; + if ((8 <= x_201)) { + int const x_214_save = x_194; + int const x_215 = tree.arr[x_214_save].leftIndex; + if ((x_215 == -1)) { + tree.arr[x_214_save].leftIndex = 5; + BST const tint_symbol_12 = {.data=8, .leftIndex=-1, .rightIndex=-1}; + tree.arr[5] = tint_symbol_12; + x_222_phi = true; + break; + } else { + x_220 = tree.arr[x_214_save].leftIndex; + x_195_phi = x_220; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + continue; + } + return; + } else { + int const x_206_save = x_194; + int const x_207 = tree.arr[x_206_save].rightIndex; + if ((x_207 == -1)) { + tree.arr[x_206_save].rightIndex = 5; + BST const tint_symbol_13 = {.data=8, .leftIndex=-1, .rightIndex=-1}; + tree.arr[5] = tint_symbol_13; + x_222_phi = true; + break; + } else { + x_212 = tree.arr[x_206_save].rightIndex; + x_195_phi = x_212; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + continue; + } + return; + } + return; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + } + bool const x_222 = x_222_phi; + if (x_222) { + break; + } + break; + } + } + int x_227_phi = 0; + bool x_255_phi = false; + switch(0u) { + default: { + x_227_phi = 0; + while (true) { + int x_253 = 0; + int x_245 = 0; + int x_228 = 0; + int x_228_phi = 0; + int const x_227 = x_227_phi; + x_255_phi = false; + if ((x_227 <= 6)) { + } else { + break; + } + int const x_234 = tree.arr[x_227].data; + if ((2 <= x_234)) { + int const x_247_save = x_227; + int const x_248 = tree.arr[x_247_save].leftIndex; + if ((x_248 == -1)) { + tree.arr[x_247_save].leftIndex = 6; + BST const tint_symbol_14 = {.data=2, .leftIndex=-1, .rightIndex=-1}; + tree.arr[6] = tint_symbol_14; + x_255_phi = true; + break; + } else { + x_253 = tree.arr[x_247_save].leftIndex; + x_228_phi = x_253; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + continue; + } + return; + } else { + int const x_239_save = x_227; + int const x_240 = tree.arr[x_239_save].rightIndex; + if ((x_240 == -1)) { + tree.arr[x_239_save].rightIndex = 6; + BST const tint_symbol_15 = {.data=2, .leftIndex=-1, .rightIndex=-1}; + tree.arr[6] = tint_symbol_15; + x_255_phi = true; + break; + } else { + x_245 = tree.arr[x_239_save].rightIndex; + x_228_phi = x_245; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + continue; + } + return; + } + return; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + } + bool const x_255 = x_255_phi; + if (x_255) { + break; + } + break; + } + } + int x_260_phi = 0; + bool x_288_phi = false; + switch(0u) { + default: { + x_260_phi = 0; + while (true) { + int x_286 = 0; + int x_278 = 0; + int x_261 = 0; + int x_261_phi = 0; + int const x_260 = x_260_phi; + x_288_phi = false; + if ((x_260 <= 7)) { + } else { + break; + } + int const x_267 = tree.arr[x_260].data; + if ((6 <= x_267)) { + int const x_280_save = x_260; + int const x_281 = tree.arr[x_280_save].leftIndex; + if ((x_281 == -1)) { + tree.arr[x_280_save].leftIndex = 7; + BST const tint_symbol_16 = {.data=6, .leftIndex=-1, .rightIndex=-1}; + tree.arr[7] = tint_symbol_16; + x_288_phi = true; + break; + } else { + x_286 = tree.arr[x_280_save].leftIndex; + x_261_phi = x_286; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + continue; + } + return; + } else { + int const x_272_save = x_260; + int const x_273 = tree.arr[x_272_save].rightIndex; + if ((x_273 == -1)) { + tree.arr[x_272_save].rightIndex = 7; + BST const tint_symbol_17 = {.data=6, .leftIndex=-1, .rightIndex=-1}; + tree.arr[7] = tint_symbol_17; + x_288_phi = true; + break; + } else { + x_278 = tree.arr[x_272_save].rightIndex; + x_261_phi = x_278; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + continue; + } + return; + } + return; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + } + bool const x_288 = x_288_phi; + if (x_288) { + break; + } + break; + } + } + int x_293_phi = 0; + bool x_321_phi = false; + switch(0u) { + default: { + x_293_phi = 0; + while (true) { + int x_319 = 0; + int x_311 = 0; + int x_294 = 0; + int x_294_phi = 0; + int const x_293 = x_293_phi; + x_321_phi = false; + if ((x_293 <= 8)) { + } else { + break; + } + int const x_300 = tree.arr[x_293].data; + if ((17 <= x_300)) { + int const x_313_save = x_293; + int const x_314 = tree.arr[x_313_save].leftIndex; + if ((x_314 == -1)) { + tree.arr[x_313_save].leftIndex = 8; + BST const tint_symbol_18 = {.data=17, .leftIndex=-1, .rightIndex=-1}; + tree.arr[8] = tint_symbol_18; + x_321_phi = true; + break; + } else { + x_319 = tree.arr[x_313_save].leftIndex; + x_294_phi = x_319; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + continue; + } + return; + } else { + int const x_305_save = x_293; + int const x_306 = tree.arr[x_305_save].rightIndex; + if ((x_306 == -1)) { + tree.arr[x_305_save].rightIndex = 8; + BST const tint_symbol_19 = {.data=17, .leftIndex=-1, .rightIndex=-1}; + tree.arr[8] = tint_symbol_19; + x_321_phi = true; + break; + } else { + x_311 = tree.arr[x_305_save].rightIndex; + x_294_phi = x_311; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + continue; + } + return; + } + return; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + } + bool const x_321 = x_321_phi; + if (x_321) { + break; + } + break; + } + } + int x_326_phi = 0; + bool x_354_phi = false; + switch(0u) { + default: { + x_326_phi = 0; + while (true) { + int x_352 = 0; + int x_344 = 0; + int x_327 = 0; + int x_327_phi = 0; + int const x_326 = x_326_phi; + x_354_phi = false; + if ((x_326 <= 9)) { + } else { + break; + } + int const x_333 = tree.arr[x_326].data; + if ((13 <= x_333)) { + int const x_346_save = x_326; + int const x_347 = tree.arr[x_346_save].leftIndex; + if ((x_347 == -1)) { + tree.arr[x_346_save].leftIndex = 9; + BST const tint_symbol_20 = {.data=13, .leftIndex=-1, .rightIndex=-1}; + tree.arr[9] = tint_symbol_20; + x_354_phi = true; + break; + } else { + x_352 = tree.arr[x_346_save].leftIndex; + x_327_phi = x_352; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + continue; + } + return; + } else { + int const x_338_save = x_326; + int const x_339 = tree.arr[x_338_save].rightIndex; + if ((x_339 == -1)) { + tree.arr[x_338_save].rightIndex = 9; + BST const tint_symbol_21 = {.data=13, .leftIndex=-1, .rightIndex=-1}; + tree.arr[9] = tint_symbol_21; + x_354_phi = true; + break; + } else { + x_344 = tree.arr[x_338_save].rightIndex; + x_327_phi = x_344; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + continue; + } + return; + } + return; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + } + bool const x_354 = x_354_phi; + if (x_354) { + break; + } + break; + } + } + x_357_phi = 0; + x_360_phi = 0; + x_362_phi = 0; + while (true) { + int x_392 = 0; + int x_402 = 0; + int x_407 = 0; + int x_363 = 0; + int x_358_phi = 0; + int x_361_phi = 0; + int const x_357 = x_357_phi; + x_360 = x_360_phi; + int const x_362 = x_362_phi; + int const x_365 = (6 - 15); + if ((x_362 < 20)) { + } else { + break; + } + int x_374_phi = 0; + int x_392_phi = 0; + bool x_393_phi = false; + switch(0u) { + default: { + x_374_phi = 0; + while (true) { + int const x_374 = x_374_phi; + x_392_phi = x_357; + x_393_phi = false; + if ((x_374 != -1)) { + } else { + break; + } + BST const x_381 = tree.arr[x_374]; + int const x_382 = x_381.data; + int const x_383 = x_381.leftIndex; + int const x_385 = x_381.rightIndex; + if ((x_382 == x_362)) { + x_392_phi = x_362; + x_393_phi = true; + break; + } + float const x_389 = (*(tint_symbol_23))[select(3u, 3u, (3u <= 3u))]; + { + x_374_phi = select(x_383, x_385, !((x_362 <= x_382))); + } + } + x_392 = x_392_phi; + bool const x_393 = x_393_phi; + x_358_phi = x_392; + if (x_393) { + break; + } + x_358_phi = -1; + break; + } + } + int x_358 = 0; + int x_401 = 0; + int x_406 = 0; + int x_402_phi = 0; + int x_407_phi = 0; + x_358 = x_358_phi; + switch(x_362) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_402_phi = x_360; + if ((x_358 == as_type(x_362))) { + x_401 = as_type((x_360 + as_type(1))); + x_402_phi = x_401; + } + x_402 = x_402_phi; + x_361_phi = x_402; + break; + } + default: { + x_407_phi = x_360; + if ((x_358 == as_type(-1))) { + x_406 = as_type((x_360 + as_type(1))); + x_407_phi = x_406; + } + x_407 = x_407_phi; + x_361_phi = x_407; + break; + } + } + int const x_361 = x_361_phi; + { + x_363 = (x_362 + 1); + x_357_phi = x_358; + x_360_phi = x_361; + x_362_phi = x_363; + } + } + if ((x_360 == as_type(20))) { + *(tint_symbol_23) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_23) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_24 = 0.0f; + main_1(&(tint_symbol_24)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_24}; + tint_symbol_1 const tint_symbol_22 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_22; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..9057c705a2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.spvasm @@ -0,0 +1,1174 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 627 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree "tree" + OpName %x_360 "x_360" + OpName %x_62_phi "x_62_phi" + OpName %x_90_phi "x_90_phi" + OpName %x_357_phi "x_357_phi" + OpName %x_360_phi "x_360_phi" + OpName %x_362_phi "x_362_phi" + OpName %x_88 "x_88" + OpName %x_80 "x_80" + OpName %x_63 "x_63" + OpName %x_63_phi "x_63_phi" + OpName %x_95_phi "x_95_phi" + OpName %x_123_phi "x_123_phi" + OpName %x_121 "x_121" + OpName %x_113 "x_113" + OpName %x_96 "x_96" + OpName %x_96_phi "x_96_phi" + OpName %x_128_phi "x_128_phi" + OpName %x_156_phi "x_156_phi" + OpName %x_154 "x_154" + OpName %x_146 "x_146" + OpName %x_129 "x_129" + OpName %x_129_phi "x_129_phi" + OpName %x_161_phi "x_161_phi" + OpName %x_189_phi "x_189_phi" + OpName %x_187 "x_187" + OpName %x_179 "x_179" + OpName %x_162 "x_162" + OpName %x_162_phi "x_162_phi" + OpName %x_194_phi "x_194_phi" + OpName %x_222_phi "x_222_phi" + OpName %x_220 "x_220" + OpName %x_212 "x_212" + OpName %x_195 "x_195" + OpName %x_195_phi "x_195_phi" + OpName %x_227_phi "x_227_phi" + OpName %x_255_phi "x_255_phi" + OpName %x_253 "x_253" + OpName %x_245 "x_245" + OpName %x_228 "x_228" + OpName %x_228_phi "x_228_phi" + OpName %x_260_phi "x_260_phi" + OpName %x_288_phi "x_288_phi" + OpName %x_286 "x_286" + OpName %x_278 "x_278" + OpName %x_261 "x_261" + OpName %x_261_phi "x_261_phi" + OpName %x_293_phi "x_293_phi" + OpName %x_321_phi "x_321_phi" + OpName %x_319 "x_319" + OpName %x_311 "x_311" + OpName %x_294 "x_294" + OpName %x_294_phi "x_294_phi" + OpName %x_326_phi "x_326_phi" + OpName %x_354_phi "x_354_phi" + OpName %x_352 "x_352" + OpName %x_344 "x_344" + OpName %x_327 "x_327" + OpName %x_327_phi "x_327_phi" + OpName %x_392 "x_392" + OpName %x_402 "x_402" + OpName %x_407 "x_407" + OpName %x_363 "x_363" + OpName %x_358_phi "x_358_phi" + OpName %x_361_phi "x_361_phi" + OpName %x_374_phi "x_374_phi" + OpName %x_392_phi "x_392_phi" + OpName %x_393_phi "x_393_phi" + OpName %x_358 "x_358" + OpName %x_401 "x_401" + OpName %x_406 "x_406" + OpName %x_402_phi "x_402_phi" + OpName %x_407_phi "x_407_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Function__arr_BST_uint_10 = OpTypePointer Function %_arr_BST_uint_10 + %19 = OpConstantNull %_arr_BST_uint_10 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool + %int_0 = OpConstant %int 0 +%_ptr_Function_BST = OpTypePointer Function %BST + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 + %36 = OpConstantComposite %BST %int_9 %int_n1 %int_n1 + %uint_0 = OpConstant %uint 0 + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 + %71 = OpConstantComposite %BST %int_5 %int_n1 %int_n1 + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 + %int_12 = OpConstant %int 12 + %126 = OpConstantComposite %BST %int_12 %int_n1 %int_n1 + %int_3 = OpConstant %int 3 + %int_15 = OpConstant %int 15 + %179 = OpConstantComposite %BST %int_15 %int_n1 %int_n1 + %int_4 = OpConstant %int 4 + %int_7 = OpConstant %int 7 + %232 = OpConstantComposite %BST %int_7 %int_n1 %int_n1 + %int_8 = OpConstant %int 8 + %284 = OpConstantComposite %BST %int_8 %int_n1 %int_n1 + %int_6 = OpConstant %int 6 + %336 = OpConstantComposite %BST %int_2 %int_n1 %int_n1 + %387 = OpConstantComposite %BST %int_6 %int_n1 %int_n1 + %int_17 = OpConstant %int 17 + %439 = OpConstantComposite %BST %int_17 %int_n1 %int_n1 + %int_13 = OpConstant %int 13 + %491 = OpConstantComposite %BST %int_13 %int_n1 %int_n1 + %int_20 = OpConstant %int 20 + %uint_3 = OpConstant %uint 3 +%_ptr_Private_float = OpTypePointer Private %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %613 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %614 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %615 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %tree = OpVariable %_ptr_Function__arr_BST_uint_10 Function %19 + %x_360 = OpVariable %_ptr_Function_int Function %22 + %x_62_phi = OpVariable %_ptr_Function_int Function %22 + %x_90_phi = OpVariable %_ptr_Function_bool Function %27 + %x_357_phi = OpVariable %_ptr_Function_int Function %22 + %x_360_phi = OpVariable %_ptr_Function_int Function %22 + %x_362_phi = OpVariable %_ptr_Function_int Function %22 + %x_88 = OpVariable %_ptr_Function_int Function %22 + %x_80 = OpVariable %_ptr_Function_int Function %22 + %x_63 = OpVariable %_ptr_Function_int Function %22 + %x_63_phi = OpVariable %_ptr_Function_int Function %22 + %x_95_phi = OpVariable %_ptr_Function_int Function %22 + %x_123_phi = OpVariable %_ptr_Function_bool Function %27 + %x_121 = OpVariable %_ptr_Function_int Function %22 + %x_113 = OpVariable %_ptr_Function_int Function %22 + %x_96 = OpVariable %_ptr_Function_int Function %22 + %x_96_phi = OpVariable %_ptr_Function_int Function %22 + %x_128_phi = OpVariable %_ptr_Function_int Function %22 + %x_156_phi = OpVariable %_ptr_Function_bool Function %27 + %x_154 = OpVariable %_ptr_Function_int Function %22 + %x_146 = OpVariable %_ptr_Function_int Function %22 + %x_129 = OpVariable %_ptr_Function_int Function %22 + %x_129_phi = OpVariable %_ptr_Function_int Function %22 + %x_161_phi = OpVariable %_ptr_Function_int Function %22 + %x_189_phi = OpVariable %_ptr_Function_bool Function %27 + %x_187 = OpVariable %_ptr_Function_int Function %22 + %x_179 = OpVariable %_ptr_Function_int Function %22 + %x_162 = OpVariable %_ptr_Function_int Function %22 + %x_162_phi = OpVariable %_ptr_Function_int Function %22 + %x_194_phi = OpVariable %_ptr_Function_int Function %22 + %x_222_phi = OpVariable %_ptr_Function_bool Function %27 + %x_220 = OpVariable %_ptr_Function_int Function %22 + %x_212 = OpVariable %_ptr_Function_int Function %22 + %x_195 = OpVariable %_ptr_Function_int Function %22 + %x_195_phi = OpVariable %_ptr_Function_int Function %22 + %x_227_phi = OpVariable %_ptr_Function_int Function %22 + %x_255_phi = OpVariable %_ptr_Function_bool Function %27 + %x_253 = OpVariable %_ptr_Function_int Function %22 + %x_245 = OpVariable %_ptr_Function_int Function %22 + %x_228 = OpVariable %_ptr_Function_int Function %22 + %x_228_phi = OpVariable %_ptr_Function_int Function %22 + %x_260_phi = OpVariable %_ptr_Function_int Function %22 + %x_288_phi = OpVariable %_ptr_Function_bool Function %27 + %x_286 = OpVariable %_ptr_Function_int Function %22 + %x_278 = OpVariable %_ptr_Function_int Function %22 + %x_261 = OpVariable %_ptr_Function_int Function %22 + %x_261_phi = OpVariable %_ptr_Function_int Function %22 + %x_293_phi = OpVariable %_ptr_Function_int Function %22 + %x_321_phi = OpVariable %_ptr_Function_bool Function %27 + %x_319 = OpVariable %_ptr_Function_int Function %22 + %x_311 = OpVariable %_ptr_Function_int Function %22 + %x_294 = OpVariable %_ptr_Function_int Function %22 + %x_294_phi = OpVariable %_ptr_Function_int Function %22 + %x_326_phi = OpVariable %_ptr_Function_int Function %22 + %x_354_phi = OpVariable %_ptr_Function_bool Function %27 + %x_352 = OpVariable %_ptr_Function_int Function %22 + %x_344 = OpVariable %_ptr_Function_int Function %22 + %x_327 = OpVariable %_ptr_Function_int Function %22 + %x_327_phi = OpVariable %_ptr_Function_int Function %22 + %x_392 = OpVariable %_ptr_Function_int Function %22 + %x_402 = OpVariable %_ptr_Function_int Function %22 + %x_407 = OpVariable %_ptr_Function_int Function %22 + %x_363 = OpVariable %_ptr_Function_int Function %22 + %x_358_phi = OpVariable %_ptr_Function_int Function %22 + %x_361_phi = OpVariable %_ptr_Function_int Function %22 + %x_374_phi = OpVariable %_ptr_Function_int Function %22 + %x_392_phi = OpVariable %_ptr_Function_int Function %22 + %x_393_phi = OpVariable %_ptr_Function_bool Function %27 + %x_358 = OpVariable %_ptr_Function_int Function %22 + %x_401 = OpVariable %_ptr_Function_int Function %22 + %x_406 = OpVariable %_ptr_Function_int Function %22 + %x_402_phi = OpVariable %_ptr_Function_int Function %22 + %x_407_phi = OpVariable %_ptr_Function_int Function %22 + %33 = OpAccessChain %_ptr_Function_BST %tree %int_0 + OpStore %33 %36 + OpSelectionMerge %37 None + OpSwitch %uint_0 %39 + %39 = OpLabel + OpStore %x_62_phi %int_0 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %48 = OpLoad %int %x_62_phi + OpStore %x_90_phi %false + %51 = OpSLessThanEqual %bool %48 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %41 + %52 = OpLabel + %55 = OpAccessChain %_ptr_Function_int %tree %48 %uint_0 + %56 = OpLoad %int %55 + %58 = OpSLessThanEqual %bool %int_5 %56 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + %63 = OpAccessChain %_ptr_Function_int %tree %48 %uint_1 + %64 = OpLoad %int %63 + %65 = OpIEqual %bool %64 %int_n1 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %67 = OpLabel + %69 = OpAccessChain %_ptr_Function_int %tree %48 %uint_1 + OpStore %69 %int_1 + %70 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %70 %71 + OpStore %x_90_phi %true + OpBranch %41 + %68 = OpLabel + %73 = OpAccessChain %_ptr_Function_int %tree %48 %uint_1 + %74 = OpLoad %int %73 + OpStore %x_88 %74 + %75 = OpLoad %int %x_88 + OpStore %x_63_phi %75 + OpBranch %42 + %66 = OpLabel + OpReturn + %61 = OpLabel + %77 = OpAccessChain %_ptr_Function_int %tree %48 %uint_2 + %78 = OpLoad %int %77 + %79 = OpIEqual %bool %78 %int_n1 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + %83 = OpAccessChain %_ptr_Function_int %tree %48 %uint_2 + OpStore %83 %int_1 + %84 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %84 %71 + OpStore %x_90_phi %true + OpBranch %41 + %82 = OpLabel + %85 = OpAccessChain %_ptr_Function_int %tree %48 %uint_2 + %86 = OpLoad %int %85 + OpStore %x_80 %86 + %87 = OpLoad %int %x_80 + OpStore %x_63_phi %87 + OpBranch %42 + %80 = OpLabel + OpReturn + %59 = OpLabel + OpReturn + %42 = OpLabel + %88 = OpLoad %int %x_63_phi + OpStore %x_63 %88 + %89 = OpLoad %int %x_63 + OpStore %x_62_phi %89 + OpBranch %40 + %41 = OpLabel + %90 = OpLoad %bool %x_90_phi + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + OpBranch %37 + %91 = OpLabel + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %95 None + OpSwitch %uint_0 %96 + %96 = OpLabel + OpStore %x_95_phi %int_0 + OpBranch %97 + %97 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %105 = OpLoad %int %x_95_phi + OpStore %x_123_phi %false + %107 = OpSLessThanEqual %bool %105 %int_2 + OpSelectionMerge %108 None + OpBranchConditional %107 %109 %110 + %109 = OpLabel + OpBranch %108 + %110 = OpLabel + OpBranch %98 + %108 = OpLabel + %111 = OpAccessChain %_ptr_Function_int %tree %105 %uint_0 + %112 = OpLoad %int %111 + %114 = OpSLessThanEqual %bool %int_12 %112 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %117 + %116 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %tree %105 %uint_1 + %119 = OpLoad %int %118 + %120 = OpIEqual %bool %119 %int_n1 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + %124 = OpAccessChain %_ptr_Function_int %tree %105 %uint_1 + OpStore %124 %int_2 + %125 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %125 %126 + OpStore %x_123_phi %true + OpBranch %98 + %123 = OpLabel + %127 = OpAccessChain %_ptr_Function_int %tree %105 %uint_1 + %128 = OpLoad %int %127 + OpStore %x_121 %128 + %129 = OpLoad %int %x_121 + OpStore %x_96_phi %129 + OpBranch %99 + %121 = OpLabel + OpReturn + %117 = OpLabel + %130 = OpAccessChain %_ptr_Function_int %tree %105 %uint_2 + %131 = OpLoad %int %130 + %132 = OpIEqual %bool %131 %int_n1 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %135 + %134 = OpLabel + %136 = OpAccessChain %_ptr_Function_int %tree %105 %uint_2 + OpStore %136 %int_2 + %137 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %137 %126 + OpStore %x_123_phi %true + OpBranch %98 + %135 = OpLabel + %138 = OpAccessChain %_ptr_Function_int %tree %105 %uint_2 + %139 = OpLoad %int %138 + OpStore %x_113 %139 + %140 = OpLoad %int %x_113 + OpStore %x_96_phi %140 + OpBranch %99 + %133 = OpLabel + OpReturn + %115 = OpLabel + OpReturn + %99 = OpLabel + %141 = OpLoad %int %x_96_phi + OpStore %x_96 %141 + %142 = OpLoad %int %x_96 + OpStore %x_95_phi %142 + OpBranch %97 + %98 = OpLabel + %143 = OpLoad %bool %x_123_phi + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %144 + %145 = OpLabel + OpBranch %95 + %144 = OpLabel + OpBranch %95 + %95 = OpLabel + OpSelectionMerge %148 None + OpSwitch %uint_0 %149 + %149 = OpLabel + OpStore %x_128_phi %int_0 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %158 = OpLoad %int %x_128_phi + OpStore %x_156_phi %false + %160 = OpSLessThanEqual %bool %158 %int_3 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + OpBranch %161 + %163 = OpLabel + OpBranch %151 + %161 = OpLabel + %164 = OpAccessChain %_ptr_Function_int %tree %158 %uint_0 + %165 = OpLoad %int %164 + %167 = OpSLessThanEqual %bool %int_15 %165 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + %171 = OpAccessChain %_ptr_Function_int %tree %158 %uint_1 + %172 = OpLoad %int %171 + %173 = OpIEqual %bool %172 %int_n1 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %176 + %175 = OpLabel + %177 = OpAccessChain %_ptr_Function_int %tree %158 %uint_1 + OpStore %177 %int_3 + %178 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %178 %179 + OpStore %x_156_phi %true + OpBranch %151 + %176 = OpLabel + %180 = OpAccessChain %_ptr_Function_int %tree %158 %uint_1 + %181 = OpLoad %int %180 + OpStore %x_154 %181 + %182 = OpLoad %int %x_154 + OpStore %x_129_phi %182 + OpBranch %152 + %174 = OpLabel + OpReturn + %170 = OpLabel + %183 = OpAccessChain %_ptr_Function_int %tree %158 %uint_2 + %184 = OpLoad %int %183 + %185 = OpIEqual %bool %184 %int_n1 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + %189 = OpAccessChain %_ptr_Function_int %tree %158 %uint_2 + OpStore %189 %int_3 + %190 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %190 %179 + OpStore %x_156_phi %true + OpBranch %151 + %188 = OpLabel + %191 = OpAccessChain %_ptr_Function_int %tree %158 %uint_2 + %192 = OpLoad %int %191 + OpStore %x_146 %192 + %193 = OpLoad %int %x_146 + OpStore %x_129_phi %193 + OpBranch %152 + %186 = OpLabel + OpReturn + %168 = OpLabel + OpReturn + %152 = OpLabel + %194 = OpLoad %int %x_129_phi + OpStore %x_129 %194 + %195 = OpLoad %int %x_129 + OpStore %x_128_phi %195 + OpBranch %150 + %151 = OpLabel + %196 = OpLoad %bool %x_156_phi + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %197 + %198 = OpLabel + OpBranch %148 + %197 = OpLabel + OpBranch %148 + %148 = OpLabel + OpSelectionMerge %201 None + OpSwitch %uint_0 %202 + %202 = OpLabel + OpStore %x_161_phi %int_0 + OpBranch %203 + %203 = OpLabel + OpLoopMerge %204 %205 None + OpBranch %206 + %206 = OpLabel + %211 = OpLoad %int %x_161_phi + OpStore %x_189_phi %false + %213 = OpSLessThanEqual %bool %211 %int_4 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %204 + %214 = OpLabel + %217 = OpAccessChain %_ptr_Function_int %tree %211 %uint_0 + %218 = OpLoad %int %217 + %220 = OpSLessThanEqual %bool %int_7 %218 + OpSelectionMerge %221 None + OpBranchConditional %220 %222 %223 + %222 = OpLabel + %224 = OpAccessChain %_ptr_Function_int %tree %211 %uint_1 + %225 = OpLoad %int %224 + %226 = OpIEqual %bool %225 %int_n1 + OpSelectionMerge %227 None + OpBranchConditional %226 %228 %229 + %228 = OpLabel + %230 = OpAccessChain %_ptr_Function_int %tree %211 %uint_1 + OpStore %230 %int_4 + %231 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %231 %232 + OpStore %x_189_phi %true + OpBranch %204 + %229 = OpLabel + %233 = OpAccessChain %_ptr_Function_int %tree %211 %uint_1 + %234 = OpLoad %int %233 + OpStore %x_187 %234 + %235 = OpLoad %int %x_187 + OpStore %x_162_phi %235 + OpBranch %205 + %227 = OpLabel + OpReturn + %223 = OpLabel + %236 = OpAccessChain %_ptr_Function_int %tree %211 %uint_2 + %237 = OpLoad %int %236 + %238 = OpIEqual %bool %237 %int_n1 + OpSelectionMerge %239 None + OpBranchConditional %238 %240 %241 + %240 = OpLabel + %242 = OpAccessChain %_ptr_Function_int %tree %211 %uint_2 + OpStore %242 %int_4 + %243 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %243 %232 + OpStore %x_189_phi %true + OpBranch %204 + %241 = OpLabel + %244 = OpAccessChain %_ptr_Function_int %tree %211 %uint_2 + %245 = OpLoad %int %244 + OpStore %x_179 %245 + %246 = OpLoad %int %x_179 + OpStore %x_162_phi %246 + OpBranch %205 + %239 = OpLabel + OpReturn + %221 = OpLabel + OpReturn + %205 = OpLabel + %247 = OpLoad %int %x_162_phi + OpStore %x_162 %247 + %248 = OpLoad %int %x_162 + OpStore %x_161_phi %248 + OpBranch %203 + %204 = OpLabel + %249 = OpLoad %bool %x_189_phi + OpSelectionMerge %250 None + OpBranchConditional %249 %251 %250 + %251 = OpLabel + OpBranch %201 + %250 = OpLabel + OpBranch %201 + %201 = OpLabel + OpSelectionMerge %254 None + OpSwitch %uint_0 %255 + %255 = OpLabel + OpStore %x_194_phi %int_0 + OpBranch %256 + %256 = OpLabel + OpLoopMerge %257 %258 None + OpBranch %259 + %259 = OpLabel + %264 = OpLoad %int %x_194_phi + OpStore %x_222_phi %false + %265 = OpSLessThanEqual %bool %264 %int_5 + OpSelectionMerge %266 None + OpBranchConditional %265 %267 %268 + %267 = OpLabel + OpBranch %266 + %268 = OpLabel + OpBranch %257 + %266 = OpLabel + %269 = OpAccessChain %_ptr_Function_int %tree %264 %uint_0 + %270 = OpLoad %int %269 + %272 = OpSLessThanEqual %bool %int_8 %270 + OpSelectionMerge %273 None + OpBranchConditional %272 %274 %275 + %274 = OpLabel + %276 = OpAccessChain %_ptr_Function_int %tree %264 %uint_1 + %277 = OpLoad %int %276 + %278 = OpIEqual %bool %277 %int_n1 + OpSelectionMerge %279 None + OpBranchConditional %278 %280 %281 + %280 = OpLabel + %282 = OpAccessChain %_ptr_Function_int %tree %264 %uint_1 + OpStore %282 %int_5 + %283 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %283 %284 + OpStore %x_222_phi %true + OpBranch %257 + %281 = OpLabel + %285 = OpAccessChain %_ptr_Function_int %tree %264 %uint_1 + %286 = OpLoad %int %285 + OpStore %x_220 %286 + %287 = OpLoad %int %x_220 + OpStore %x_195_phi %287 + OpBranch %258 + %279 = OpLabel + OpReturn + %275 = OpLabel + %288 = OpAccessChain %_ptr_Function_int %tree %264 %uint_2 + %289 = OpLoad %int %288 + %290 = OpIEqual %bool %289 %int_n1 + OpSelectionMerge %291 None + OpBranchConditional %290 %292 %293 + %292 = OpLabel + %294 = OpAccessChain %_ptr_Function_int %tree %264 %uint_2 + OpStore %294 %int_5 + %295 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %295 %284 + OpStore %x_222_phi %true + OpBranch %257 + %293 = OpLabel + %296 = OpAccessChain %_ptr_Function_int %tree %264 %uint_2 + %297 = OpLoad %int %296 + OpStore %x_212 %297 + %298 = OpLoad %int %x_212 + OpStore %x_195_phi %298 + OpBranch %258 + %291 = OpLabel + OpReturn + %273 = OpLabel + OpReturn + %258 = OpLabel + %299 = OpLoad %int %x_195_phi + OpStore %x_195 %299 + %300 = OpLoad %int %x_195 + OpStore %x_194_phi %300 + OpBranch %256 + %257 = OpLabel + %301 = OpLoad %bool %x_222_phi + OpSelectionMerge %302 None + OpBranchConditional %301 %303 %302 + %303 = OpLabel + OpBranch %254 + %302 = OpLabel + OpBranch %254 + %254 = OpLabel + OpSelectionMerge %306 None + OpSwitch %uint_0 %307 + %307 = OpLabel + OpStore %x_227_phi %int_0 + OpBranch %308 + %308 = OpLabel + OpLoopMerge %309 %310 None + OpBranch %311 + %311 = OpLabel + %316 = OpLoad %int %x_227_phi + OpStore %x_255_phi %false + %318 = OpSLessThanEqual %bool %316 %int_6 + OpSelectionMerge %319 None + OpBranchConditional %318 %320 %321 + %320 = OpLabel + OpBranch %319 + %321 = OpLabel + OpBranch %309 + %319 = OpLabel + %322 = OpAccessChain %_ptr_Function_int %tree %316 %uint_0 + %323 = OpLoad %int %322 + %324 = OpSLessThanEqual %bool %int_2 %323 + OpSelectionMerge %325 None + OpBranchConditional %324 %326 %327 + %326 = OpLabel + %328 = OpAccessChain %_ptr_Function_int %tree %316 %uint_1 + %329 = OpLoad %int %328 + %330 = OpIEqual %bool %329 %int_n1 + OpSelectionMerge %331 None + OpBranchConditional %330 %332 %333 + %332 = OpLabel + %334 = OpAccessChain %_ptr_Function_int %tree %316 %uint_1 + OpStore %334 %int_6 + %335 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %335 %336 + OpStore %x_255_phi %true + OpBranch %309 + %333 = OpLabel + %337 = OpAccessChain %_ptr_Function_int %tree %316 %uint_1 + %338 = OpLoad %int %337 + OpStore %x_253 %338 + %339 = OpLoad %int %x_253 + OpStore %x_228_phi %339 + OpBranch %310 + %331 = OpLabel + OpReturn + %327 = OpLabel + %340 = OpAccessChain %_ptr_Function_int %tree %316 %uint_2 + %341 = OpLoad %int %340 + %342 = OpIEqual %bool %341 %int_n1 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %345 + %344 = OpLabel + %346 = OpAccessChain %_ptr_Function_int %tree %316 %uint_2 + OpStore %346 %int_6 + %347 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %347 %336 + OpStore %x_255_phi %true + OpBranch %309 + %345 = OpLabel + %348 = OpAccessChain %_ptr_Function_int %tree %316 %uint_2 + %349 = OpLoad %int %348 + OpStore %x_245 %349 + %350 = OpLoad %int %x_245 + OpStore %x_228_phi %350 + OpBranch %310 + %343 = OpLabel + OpReturn + %325 = OpLabel + OpReturn + %310 = OpLabel + %351 = OpLoad %int %x_228_phi + OpStore %x_228 %351 + %352 = OpLoad %int %x_228 + OpStore %x_227_phi %352 + OpBranch %308 + %309 = OpLabel + %353 = OpLoad %bool %x_255_phi + OpSelectionMerge %354 None + OpBranchConditional %353 %355 %354 + %355 = OpLabel + OpBranch %306 + %354 = OpLabel + OpBranch %306 + %306 = OpLabel + OpSelectionMerge %358 None + OpSwitch %uint_0 %359 + %359 = OpLabel + OpStore %x_260_phi %int_0 + OpBranch %360 + %360 = OpLabel + OpLoopMerge %361 %362 None + OpBranch %363 + %363 = OpLabel + %368 = OpLoad %int %x_260_phi + OpStore %x_288_phi %false + %369 = OpSLessThanEqual %bool %368 %int_7 + OpSelectionMerge %370 None + OpBranchConditional %369 %371 %372 + %371 = OpLabel + OpBranch %370 + %372 = OpLabel + OpBranch %361 + %370 = OpLabel + %373 = OpAccessChain %_ptr_Function_int %tree %368 %uint_0 + %374 = OpLoad %int %373 + %375 = OpSLessThanEqual %bool %int_6 %374 + OpSelectionMerge %376 None + OpBranchConditional %375 %377 %378 + %377 = OpLabel + %379 = OpAccessChain %_ptr_Function_int %tree %368 %uint_1 + %380 = OpLoad %int %379 + %381 = OpIEqual %bool %380 %int_n1 + OpSelectionMerge %382 None + OpBranchConditional %381 %383 %384 + %383 = OpLabel + %385 = OpAccessChain %_ptr_Function_int %tree %368 %uint_1 + OpStore %385 %int_7 + %386 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %386 %387 + OpStore %x_288_phi %true + OpBranch %361 + %384 = OpLabel + %388 = OpAccessChain %_ptr_Function_int %tree %368 %uint_1 + %389 = OpLoad %int %388 + OpStore %x_286 %389 + %390 = OpLoad %int %x_286 + OpStore %x_261_phi %390 + OpBranch %362 + %382 = OpLabel + OpReturn + %378 = OpLabel + %391 = OpAccessChain %_ptr_Function_int %tree %368 %uint_2 + %392 = OpLoad %int %391 + %393 = OpIEqual %bool %392 %int_n1 + OpSelectionMerge %394 None + OpBranchConditional %393 %395 %396 + %395 = OpLabel + %397 = OpAccessChain %_ptr_Function_int %tree %368 %uint_2 + OpStore %397 %int_7 + %398 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %398 %387 + OpStore %x_288_phi %true + OpBranch %361 + %396 = OpLabel + %399 = OpAccessChain %_ptr_Function_int %tree %368 %uint_2 + %400 = OpLoad %int %399 + OpStore %x_278 %400 + %401 = OpLoad %int %x_278 + OpStore %x_261_phi %401 + OpBranch %362 + %394 = OpLabel + OpReturn + %376 = OpLabel + OpReturn + %362 = OpLabel + %402 = OpLoad %int %x_261_phi + OpStore %x_261 %402 + %403 = OpLoad %int %x_261 + OpStore %x_260_phi %403 + OpBranch %360 + %361 = OpLabel + %404 = OpLoad %bool %x_288_phi + OpSelectionMerge %405 None + OpBranchConditional %404 %406 %405 + %406 = OpLabel + OpBranch %358 + %405 = OpLabel + OpBranch %358 + %358 = OpLabel + OpSelectionMerge %409 None + OpSwitch %uint_0 %410 + %410 = OpLabel + OpStore %x_293_phi %int_0 + OpBranch %411 + %411 = OpLabel + OpLoopMerge %412 %413 None + OpBranch %414 + %414 = OpLabel + %419 = OpLoad %int %x_293_phi + OpStore %x_321_phi %false + %420 = OpSLessThanEqual %bool %419 %int_8 + OpSelectionMerge %421 None + OpBranchConditional %420 %422 %423 + %422 = OpLabel + OpBranch %421 + %423 = OpLabel + OpBranch %412 + %421 = OpLabel + %424 = OpAccessChain %_ptr_Function_int %tree %419 %uint_0 + %425 = OpLoad %int %424 + %427 = OpSLessThanEqual %bool %int_17 %425 + OpSelectionMerge %428 None + OpBranchConditional %427 %429 %430 + %429 = OpLabel + %431 = OpAccessChain %_ptr_Function_int %tree %419 %uint_1 + %432 = OpLoad %int %431 + %433 = OpIEqual %bool %432 %int_n1 + OpSelectionMerge %434 None + OpBranchConditional %433 %435 %436 + %435 = OpLabel + %437 = OpAccessChain %_ptr_Function_int %tree %419 %uint_1 + OpStore %437 %int_8 + %438 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %438 %439 + OpStore %x_321_phi %true + OpBranch %412 + %436 = OpLabel + %440 = OpAccessChain %_ptr_Function_int %tree %419 %uint_1 + %441 = OpLoad %int %440 + OpStore %x_319 %441 + %442 = OpLoad %int %x_319 + OpStore %x_294_phi %442 + OpBranch %413 + %434 = OpLabel + OpReturn + %430 = OpLabel + %443 = OpAccessChain %_ptr_Function_int %tree %419 %uint_2 + %444 = OpLoad %int %443 + %445 = OpIEqual %bool %444 %int_n1 + OpSelectionMerge %446 None + OpBranchConditional %445 %447 %448 + %447 = OpLabel + %449 = OpAccessChain %_ptr_Function_int %tree %419 %uint_2 + OpStore %449 %int_8 + %450 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %450 %439 + OpStore %x_321_phi %true + OpBranch %412 + %448 = OpLabel + %451 = OpAccessChain %_ptr_Function_int %tree %419 %uint_2 + %452 = OpLoad %int %451 + OpStore %x_311 %452 + %453 = OpLoad %int %x_311 + OpStore %x_294_phi %453 + OpBranch %413 + %446 = OpLabel + OpReturn + %428 = OpLabel + OpReturn + %413 = OpLabel + %454 = OpLoad %int %x_294_phi + OpStore %x_294 %454 + %455 = OpLoad %int %x_294 + OpStore %x_293_phi %455 + OpBranch %411 + %412 = OpLabel + %456 = OpLoad %bool %x_321_phi + OpSelectionMerge %457 None + OpBranchConditional %456 %458 %457 + %458 = OpLabel + OpBranch %409 + %457 = OpLabel + OpBranch %409 + %409 = OpLabel + OpSelectionMerge %461 None + OpSwitch %uint_0 %462 + %462 = OpLabel + OpStore %x_326_phi %int_0 + OpBranch %463 + %463 = OpLabel + OpLoopMerge %464 %465 None + OpBranch %466 + %466 = OpLabel + %471 = OpLoad %int %x_326_phi + OpStore %x_354_phi %false + %472 = OpSLessThanEqual %bool %471 %int_9 + OpSelectionMerge %473 None + OpBranchConditional %472 %474 %475 + %474 = OpLabel + OpBranch %473 + %475 = OpLabel + OpBranch %464 + %473 = OpLabel + %476 = OpAccessChain %_ptr_Function_int %tree %471 %uint_0 + %477 = OpLoad %int %476 + %479 = OpSLessThanEqual %bool %int_13 %477 + OpSelectionMerge %480 None + OpBranchConditional %479 %481 %482 + %481 = OpLabel + %483 = OpAccessChain %_ptr_Function_int %tree %471 %uint_1 + %484 = OpLoad %int %483 + %485 = OpIEqual %bool %484 %int_n1 + OpSelectionMerge %486 None + OpBranchConditional %485 %487 %488 + %487 = OpLabel + %489 = OpAccessChain %_ptr_Function_int %tree %471 %uint_1 + OpStore %489 %int_9 + %490 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %490 %491 + OpStore %x_354_phi %true + OpBranch %464 + %488 = OpLabel + %492 = OpAccessChain %_ptr_Function_int %tree %471 %uint_1 + %493 = OpLoad %int %492 + OpStore %x_352 %493 + %494 = OpLoad %int %x_352 + OpStore %x_327_phi %494 + OpBranch %465 + %486 = OpLabel + OpReturn + %482 = OpLabel + %495 = OpAccessChain %_ptr_Function_int %tree %471 %uint_2 + %496 = OpLoad %int %495 + %497 = OpIEqual %bool %496 %int_n1 + OpSelectionMerge %498 None + OpBranchConditional %497 %499 %500 + %499 = OpLabel + %501 = OpAccessChain %_ptr_Function_int %tree %471 %uint_2 + OpStore %501 %int_9 + %502 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %502 %491 + OpStore %x_354_phi %true + OpBranch %464 + %500 = OpLabel + %503 = OpAccessChain %_ptr_Function_int %tree %471 %uint_2 + %504 = OpLoad %int %503 + OpStore %x_344 %504 + %505 = OpLoad %int %x_344 + OpStore %x_327_phi %505 + OpBranch %465 + %498 = OpLabel + OpReturn + %480 = OpLabel + OpReturn + %465 = OpLabel + %506 = OpLoad %int %x_327_phi + OpStore %x_327 %506 + %507 = OpLoad %int %x_327 + OpStore %x_326_phi %507 + OpBranch %463 + %464 = OpLabel + %508 = OpLoad %bool %x_354_phi + OpSelectionMerge %509 None + OpBranchConditional %508 %510 %509 + %510 = OpLabel + OpBranch %461 + %509 = OpLabel + OpBranch %461 + %461 = OpLabel + OpStore %x_357_phi %int_0 + OpStore %x_360_phi %int_0 + OpStore %x_362_phi %int_0 + OpBranch %511 + %511 = OpLabel + OpLoopMerge %512 %513 None + OpBranch %514 + %514 = OpLabel + %521 = OpLoad %int %x_357_phi + %522 = OpLoad %int %x_360_phi + OpStore %x_360 %522 + %523 = OpLoad %int %x_362_phi + %524 = OpISub %int %int_6 %int_15 + %526 = OpSLessThan %bool %523 %int_20 + OpSelectionMerge %527 None + OpBranchConditional %526 %528 %529 + %528 = OpLabel + OpBranch %527 + %529 = OpLabel + OpBranch %512 + %527 = OpLabel + OpSelectionMerge %533 None + OpSwitch %uint_0 %534 + %534 = OpLabel + OpStore %x_374_phi %int_0 + OpBranch %535 + %535 = OpLabel + OpLoopMerge %536 %537 None + OpBranch %538 + %538 = OpLabel + %539 = OpLoad %int %x_374_phi + OpStore %x_392_phi %521 + OpStore %x_393_phi %false + %540 = OpINotEqual %bool %539 %int_n1 + OpSelectionMerge %541 None + OpBranchConditional %540 %542 %543 + %542 = OpLabel + OpBranch %541 + %543 = OpLabel + OpBranch %536 + %541 = OpLabel + %544 = OpAccessChain %_ptr_Function_BST %tree %539 + %545 = OpLoad %BST %544 + %546 = OpCompositeExtract %int %545 0 + %547 = OpCompositeExtract %int %545 1 + %548 = OpCompositeExtract %int %545 2 + %549 = OpIEqual %bool %546 %523 + OpSelectionMerge %550 None + OpBranchConditional %549 %551 %550 + %551 = OpLabel + OpStore %x_392_phi %523 + OpStore %x_393_phi %true + OpBranch %536 + %550 = OpLabel + %554 = OpULessThanEqual %bool %uint_3 %uint_3 + %552 = OpSelect %uint %554 %uint_3 %uint_3 + %556 = OpAccessChain %_ptr_Private_float %x_GLF_color %552 + %557 = OpLoad %float %556 + OpBranch %537 + %537 = OpLabel + %560 = OpSLessThanEqual %bool %523 %546 + %559 = OpLogicalNot %bool %560 + %558 = OpSelect %int %559 %548 %547 + OpStore %x_374_phi %558 + OpBranch %535 + %536 = OpLabel + %561 = OpLoad %int %x_392_phi + OpStore %x_392 %561 + %562 = OpLoad %bool %x_393_phi + %563 = OpLoad %int %x_392 + OpStore %x_358_phi %563 + OpSelectionMerge %564 None + OpBranchConditional %562 %565 %564 + %565 = OpLabel + OpBranch %533 + %564 = OpLabel + OpStore %x_358_phi %int_n1 + OpBranch %533 + %533 = OpLabel + %571 = OpLoad %int %x_358_phi + OpStore %x_358 %571 + OpSelectionMerge %572 None + OpSwitch %523 %573 2 %574 5 %574 6 %574 7 %574 8 %574 9 %574 12 %574 13 %574 15 %574 17 %574 + %574 = OpLabel + %575 = OpLoad %int %x_360 + OpStore %x_402_phi %575 + %576 = OpLoad %int %x_358 + %577 = OpCopyObject %int %523 + %578 = OpIEqual %bool %576 %577 + OpSelectionMerge %579 None + OpBranchConditional %578 %580 %579 + %580 = OpLabel + %582 = OpLoad %int %x_360 + %583 = OpCopyObject %int %int_1 + %584 = OpIAdd %int %582 %583 + %581 = OpCopyObject %int %584 + OpStore %x_401 %581 + %585 = OpLoad %int %x_401 + OpStore %x_402_phi %585 + OpBranch %579 + %579 = OpLabel + %586 = OpLoad %int %x_402_phi + OpStore %x_402 %586 + %587 = OpLoad %int %x_402 + OpStore %x_361_phi %587 + OpBranch %572 + %573 = OpLabel + %588 = OpLoad %int %x_360 + OpStore %x_407_phi %588 + %589 = OpLoad %int %x_358 + %590 = OpCopyObject %int %int_n1 + %591 = OpIEqual %bool %589 %590 + OpSelectionMerge %592 None + OpBranchConditional %591 %593 %592 + %593 = OpLabel + %595 = OpLoad %int %x_360 + %596 = OpCopyObject %int %int_1 + %597 = OpIAdd %int %595 %596 + %594 = OpCopyObject %int %597 + OpStore %x_406 %594 + %598 = OpLoad %int %x_406 + OpStore %x_407_phi %598 + OpBranch %592 + %592 = OpLabel + %599 = OpLoad %int %x_407_phi + OpStore %x_407 %599 + %600 = OpLoad %int %x_407 + OpStore %x_361_phi %600 + OpBranch %572 + %572 = OpLabel + %601 = OpLoad %int %x_361_phi + OpBranch %513 + %513 = OpLabel + %602 = OpIAdd %int %523 %int_1 + OpStore %x_363 %602 + %603 = OpLoad %int %x_358 + OpStore %x_357_phi %603 + OpStore %x_360_phi %601 + %604 = OpLoad %int %x_363 + OpStore %x_362_phi %604 + OpBranch %511 + %512 = OpLabel + %605 = OpLoad %int %x_360 + %606 = OpCopyObject %int %int_20 + %607 = OpIEqual %bool %605 %606 + OpSelectionMerge %608 None + OpBranchConditional %607 %609 %610 + %609 = OpLabel + OpStore %x_GLF_color %613 + OpBranch %608 + %610 = OpLabel + OpStore %x_GLF_color %614 + OpBranch %608 + %608 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %615 +%tint_symbol = OpFunctionParameter %main_out + %619 = OpLabel + %620 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %620 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %622 = OpLabel + %623 = OpFunctionCall %void %main_1 + %625 = OpLoad %v4float %x_GLF_color + %626 = OpCompositeConstruct %main_out %625 + %624 = OpFunctionCall %void %tint_symbol_2 %626 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..0c19b19cd9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.wgsl @@ -0,0 +1,655 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var x_GLF_color : vec4; + +fn main_1() { + var tree : array; + var x_360 : i32; + var x_62_phi : i32; + var x_90_phi : bool; + var x_357_phi : i32; + var x_360_phi : i32; + var x_362_phi : i32; + tree[0] = BST(9, -1, -1); + switch(0u) { + default: { + x_62_phi = 0; + loop { + var x_88 : i32; + var x_80 : i32; + var x_63 : i32; + var x_63_phi : i32; + let x_62 : i32 = x_62_phi; + x_90_phi = false; + if ((x_62 <= 1)) { + } else { + break; + } + let x_69 : i32 = tree[x_62].data; + if ((5 <= x_69)) { + let x_82 : ptr = &(tree[x_62].leftIndex); + let x_83 : i32 = *(x_82); + if ((x_83 == -1)) { + *(x_82) = 1; + tree[1] = BST(5, -1, -1); + x_90_phi = true; + break; + } else { + x_88 = *(x_82); + x_63_phi = x_88; + continue; + } + return; + } else { + let x_74 : ptr = &(tree[x_62].rightIndex); + let x_75 : i32 = *(x_74); + if ((x_75 == -1)) { + *(x_74) = 1; + tree[1] = BST(5, -1, -1); + x_90_phi = true; + break; + } else { + x_80 = *(x_74); + x_63_phi = x_80; + continue; + } + return; + } + return; + + continuing { + x_63 = x_63_phi; + x_62_phi = x_63; + } + } + let x_90 : bool = x_90_phi; + if (x_90) { + break; + } + } + } + var x_95_phi : i32; + var x_123_phi : bool; + switch(0u) { + default: { + x_95_phi = 0; + loop { + var x_121 : i32; + var x_113 : i32; + var x_96 : i32; + var x_96_phi : i32; + let x_95 : i32 = x_95_phi; + x_123_phi = false; + if ((x_95 <= 2)) { + } else { + break; + } + let x_102 : i32 = tree[x_95].data; + if ((12 <= x_102)) { + let x_115 : ptr = &(tree[x_95].leftIndex); + let x_116 : i32 = *(x_115); + if ((x_116 == -1)) { + *(x_115) = 2; + tree[2] = BST(12, -1, -1); + x_123_phi = true; + break; + } else { + x_121 = *(x_115); + x_96_phi = x_121; + continue; + } + return; + } else { + let x_107 : ptr = &(tree[x_95].rightIndex); + let x_108 : i32 = *(x_107); + if ((x_108 == -1)) { + *(x_107) = 2; + tree[2] = BST(12, -1, -1); + x_123_phi = true; + break; + } else { + x_113 = *(x_107); + x_96_phi = x_113; + continue; + } + return; + } + return; + + continuing { + x_96 = x_96_phi; + x_95_phi = x_96; + } + } + let x_123 : bool = x_123_phi; + if (x_123) { + break; + } + } + } + var x_128_phi : i32; + var x_156_phi : bool; + switch(0u) { + default: { + x_128_phi = 0; + loop { + var x_154 : i32; + var x_146 : i32; + var x_129 : i32; + var x_129_phi : i32; + let x_128 : i32 = x_128_phi; + x_156_phi = false; + if ((x_128 <= 3)) { + } else { + break; + } + let x_135 : i32 = tree[x_128].data; + if ((15 <= x_135)) { + let x_148 : ptr = &(tree[x_128].leftIndex); + let x_149 : i32 = *(x_148); + if ((x_149 == -1)) { + *(x_148) = 3; + tree[3] = BST(15, -1, -1); + x_156_phi = true; + break; + } else { + x_154 = *(x_148); + x_129_phi = x_154; + continue; + } + return; + } else { + let x_140 : ptr = &(tree[x_128].rightIndex); + let x_141 : i32 = *(x_140); + if ((x_141 == -1)) { + *(x_140) = 3; + tree[3] = BST(15, -1, -1); + x_156_phi = true; + break; + } else { + x_146 = *(x_140); + x_129_phi = x_146; + continue; + } + return; + } + return; + + continuing { + x_129 = x_129_phi; + x_128_phi = x_129; + } + } + let x_156 : bool = x_156_phi; + if (x_156) { + break; + } + } + } + var x_161_phi : i32; + var x_189_phi : bool; + switch(0u) { + default: { + x_161_phi = 0; + loop { + var x_187 : i32; + var x_179 : i32; + var x_162 : i32; + var x_162_phi : i32; + let x_161 : i32 = x_161_phi; + x_189_phi = false; + if ((x_161 <= 4)) { + } else { + break; + } + let x_168 : i32 = tree[x_161].data; + if ((7 <= x_168)) { + let x_181 : ptr = &(tree[x_161].leftIndex); + let x_182 : i32 = *(x_181); + if ((x_182 == -1)) { + *(x_181) = 4; + tree[4] = BST(7, -1, -1); + x_189_phi = true; + break; + } else { + x_187 = *(x_181); + x_162_phi = x_187; + continue; + } + return; + } else { + let x_173 : ptr = &(tree[x_161].rightIndex); + let x_174 : i32 = *(x_173); + if ((x_174 == -1)) { + *(x_173) = 4; + tree[4] = BST(7, -1, -1); + x_189_phi = true; + break; + } else { + x_179 = *(x_173); + x_162_phi = x_179; + continue; + } + return; + } + return; + + continuing { + x_162 = x_162_phi; + x_161_phi = x_162; + } + } + let x_189 : bool = x_189_phi; + if (x_189) { + break; + } + } + } + var x_194_phi : i32; + var x_222_phi : bool; + switch(0u) { + default: { + x_194_phi = 0; + loop { + var x_220 : i32; + var x_212 : i32; + var x_195 : i32; + var x_195_phi : i32; + let x_194 : i32 = x_194_phi; + x_222_phi = false; + if ((x_194 <= 5)) { + } else { + break; + } + let x_201 : i32 = tree[x_194].data; + if ((8 <= x_201)) { + let x_214 : ptr = &(tree[x_194].leftIndex); + let x_215 : i32 = *(x_214); + if ((x_215 == -1)) { + *(x_214) = 5; + tree[5] = BST(8, -1, -1); + x_222_phi = true; + break; + } else { + x_220 = *(x_214); + x_195_phi = x_220; + continue; + } + return; + } else { + let x_206 : ptr = &(tree[x_194].rightIndex); + let x_207 : i32 = *(x_206); + if ((x_207 == -1)) { + *(x_206) = 5; + tree[5] = BST(8, -1, -1); + x_222_phi = true; + break; + } else { + x_212 = *(x_206); + x_195_phi = x_212; + continue; + } + return; + } + return; + + continuing { + x_195 = x_195_phi; + x_194_phi = x_195; + } + } + let x_222 : bool = x_222_phi; + if (x_222) { + break; + } + } + } + var x_227_phi : i32; + var x_255_phi : bool; + switch(0u) { + default: { + x_227_phi = 0; + loop { + var x_253 : i32; + var x_245 : i32; + var x_228 : i32; + var x_228_phi : i32; + let x_227 : i32 = x_227_phi; + x_255_phi = false; + if ((x_227 <= 6)) { + } else { + break; + } + let x_234 : i32 = tree[x_227].data; + if ((2 <= x_234)) { + let x_247 : ptr = &(tree[x_227].leftIndex); + let x_248 : i32 = *(x_247); + if ((x_248 == -1)) { + *(x_247) = 6; + tree[6] = BST(2, -1, -1); + x_255_phi = true; + break; + } else { + x_253 = *(x_247); + x_228_phi = x_253; + continue; + } + return; + } else { + let x_239 : ptr = &(tree[x_227].rightIndex); + let x_240 : i32 = *(x_239); + if ((x_240 == -1)) { + *(x_239) = 6; + tree[6] = BST(2, -1, -1); + x_255_phi = true; + break; + } else { + x_245 = *(x_239); + x_228_phi = x_245; + continue; + } + return; + } + return; + + continuing { + x_228 = x_228_phi; + x_227_phi = x_228; + } + } + let x_255 : bool = x_255_phi; + if (x_255) { + break; + } + } + } + var x_260_phi : i32; + var x_288_phi : bool; + switch(0u) { + default: { + x_260_phi = 0; + loop { + var x_286 : i32; + var x_278 : i32; + var x_261 : i32; + var x_261_phi : i32; + let x_260 : i32 = x_260_phi; + x_288_phi = false; + if ((x_260 <= 7)) { + } else { + break; + } + let x_267 : i32 = tree[x_260].data; + if ((6 <= x_267)) { + let x_280 : ptr = &(tree[x_260].leftIndex); + let x_281 : i32 = *(x_280); + if ((x_281 == -1)) { + *(x_280) = 7; + tree[7] = BST(6, -1, -1); + x_288_phi = true; + break; + } else { + x_286 = *(x_280); + x_261_phi = x_286; + continue; + } + return; + } else { + let x_272 : ptr = &(tree[x_260].rightIndex); + let x_273 : i32 = *(x_272); + if ((x_273 == -1)) { + *(x_272) = 7; + tree[7] = BST(6, -1, -1); + x_288_phi = true; + break; + } else { + x_278 = *(x_272); + x_261_phi = x_278; + continue; + } + return; + } + return; + + continuing { + x_261 = x_261_phi; + x_260_phi = x_261; + } + } + let x_288 : bool = x_288_phi; + if (x_288) { + break; + } + } + } + var x_293_phi : i32; + var x_321_phi : bool; + switch(0u) { + default: { + x_293_phi = 0; + loop { + var x_319 : i32; + var x_311 : i32; + var x_294 : i32; + var x_294_phi : i32; + let x_293 : i32 = x_293_phi; + x_321_phi = false; + if ((x_293 <= 8)) { + } else { + break; + } + let x_300 : i32 = tree[x_293].data; + if ((17 <= x_300)) { + let x_313 : ptr = &(tree[x_293].leftIndex); + let x_314 : i32 = *(x_313); + if ((x_314 == -1)) { + *(x_313) = 8; + tree[8] = BST(17, -1, -1); + x_321_phi = true; + break; + } else { + x_319 = *(x_313); + x_294_phi = x_319; + continue; + } + return; + } else { + let x_305 : ptr = &(tree[x_293].rightIndex); + let x_306 : i32 = *(x_305); + if ((x_306 == -1)) { + *(x_305) = 8; + tree[8] = BST(17, -1, -1); + x_321_phi = true; + break; + } else { + x_311 = *(x_305); + x_294_phi = x_311; + continue; + } + return; + } + return; + + continuing { + x_294 = x_294_phi; + x_293_phi = x_294; + } + } + let x_321 : bool = x_321_phi; + if (x_321) { + break; + } + } + } + var x_326_phi : i32; + var x_354_phi : bool; + switch(0u) { + default: { + x_326_phi = 0; + loop { + var x_352 : i32; + var x_344 : i32; + var x_327 : i32; + var x_327_phi : i32; + let x_326 : i32 = x_326_phi; + x_354_phi = false; + if ((x_326 <= 9)) { + } else { + break; + } + let x_333 : i32 = tree[x_326].data; + if ((13 <= x_333)) { + let x_346 : ptr = &(tree[x_326].leftIndex); + let x_347 : i32 = *(x_346); + if ((x_347 == -1)) { + *(x_346) = 9; + tree[9] = BST(13, -1, -1); + x_354_phi = true; + break; + } else { + x_352 = *(x_346); + x_327_phi = x_352; + continue; + } + return; + } else { + let x_338 : ptr = &(tree[x_326].rightIndex); + let x_339 : i32 = *(x_338); + if ((x_339 == -1)) { + *(x_338) = 9; + tree[9] = BST(13, -1, -1); + x_354_phi = true; + break; + } else { + x_344 = *(x_338); + x_327_phi = x_344; + continue; + } + return; + } + return; + + continuing { + x_327 = x_327_phi; + x_326_phi = x_327; + } + } + let x_354 : bool = x_354_phi; + if (x_354) { + break; + } + } + } + x_357_phi = 0; + x_360_phi = 0; + x_362_phi = 0; + loop { + var x_392 : i32; + var x_402 : i32; + var x_407 : i32; + var x_363 : i32; + var x_358_phi : i32; + var x_361_phi : i32; + let x_357 : i32 = x_357_phi; + x_360 = x_360_phi; + let x_362 : i32 = x_362_phi; + let x_365 : i32 = (6 - 15); + if ((x_362 < 20)) { + } else { + break; + } + var x_374_phi : i32; + var x_392_phi : i32; + var x_393_phi : bool; + switch(0u) { + default: { + x_374_phi = 0; + loop { + let x_374 : i32 = x_374_phi; + x_392_phi = x_357; + x_393_phi = false; + if ((x_374 != -1)) { + } else { + break; + } + let x_381 : BST = tree[x_374]; + let x_382 : i32 = x_381.data; + let x_383 : i32 = x_381.leftIndex; + let x_385 : i32 = x_381.rightIndex; + if ((x_382 == x_362)) { + x_392_phi = x_362; + x_393_phi = true; + break; + } + let x_389 : f32 = x_GLF_color[select(3u, 3u, (3u <= 3u))]; + + continuing { + x_374_phi = select(x_383, x_385, !((x_362 <= x_382))); + } + } + x_392 = x_392_phi; + let x_393 : bool = x_393_phi; + x_358_phi = x_392; + if (x_393) { + break; + } + x_358_phi = -1; + } + } + var x_358 : i32; + var x_401 : i32; + var x_406 : i32; + var x_402_phi : i32; + var x_407_phi : i32; + x_358 = x_358_phi; + switch(x_362) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + x_402_phi = x_360; + if ((x_358 == bitcast(x_362))) { + x_401 = bitcast((x_360 + bitcast(1))); + x_402_phi = x_401; + } + x_402 = x_402_phi; + x_361_phi = x_402; + } + default: { + x_407_phi = x_360; + if ((x_358 == bitcast(-1))) { + x_406 = bitcast((x_360 + bitcast(1))); + x_407_phi = x_406; + } + x_407 = x_407_phi; + x_361_phi = x_407; + } + } + let x_361 : i32 = x_361_phi; + + continuing { + x_363 = (x_362 + 1); + x_357_phi = x_358; + x_360_phi = x_361; + x_362_phi = x_363; + } + } + if ((x_360 == bitcast(20))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl new file mode 100644 index 0000000000..0c19b19cd9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl @@ -0,0 +1,655 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var x_GLF_color : vec4; + +fn main_1() { + var tree : array; + var x_360 : i32; + var x_62_phi : i32; + var x_90_phi : bool; + var x_357_phi : i32; + var x_360_phi : i32; + var x_362_phi : i32; + tree[0] = BST(9, -1, -1); + switch(0u) { + default: { + x_62_phi = 0; + loop { + var x_88 : i32; + var x_80 : i32; + var x_63 : i32; + var x_63_phi : i32; + let x_62 : i32 = x_62_phi; + x_90_phi = false; + if ((x_62 <= 1)) { + } else { + break; + } + let x_69 : i32 = tree[x_62].data; + if ((5 <= x_69)) { + let x_82 : ptr = &(tree[x_62].leftIndex); + let x_83 : i32 = *(x_82); + if ((x_83 == -1)) { + *(x_82) = 1; + tree[1] = BST(5, -1, -1); + x_90_phi = true; + break; + } else { + x_88 = *(x_82); + x_63_phi = x_88; + continue; + } + return; + } else { + let x_74 : ptr = &(tree[x_62].rightIndex); + let x_75 : i32 = *(x_74); + if ((x_75 == -1)) { + *(x_74) = 1; + tree[1] = BST(5, -1, -1); + x_90_phi = true; + break; + } else { + x_80 = *(x_74); + x_63_phi = x_80; + continue; + } + return; + } + return; + + continuing { + x_63 = x_63_phi; + x_62_phi = x_63; + } + } + let x_90 : bool = x_90_phi; + if (x_90) { + break; + } + } + } + var x_95_phi : i32; + var x_123_phi : bool; + switch(0u) { + default: { + x_95_phi = 0; + loop { + var x_121 : i32; + var x_113 : i32; + var x_96 : i32; + var x_96_phi : i32; + let x_95 : i32 = x_95_phi; + x_123_phi = false; + if ((x_95 <= 2)) { + } else { + break; + } + let x_102 : i32 = tree[x_95].data; + if ((12 <= x_102)) { + let x_115 : ptr = &(tree[x_95].leftIndex); + let x_116 : i32 = *(x_115); + if ((x_116 == -1)) { + *(x_115) = 2; + tree[2] = BST(12, -1, -1); + x_123_phi = true; + break; + } else { + x_121 = *(x_115); + x_96_phi = x_121; + continue; + } + return; + } else { + let x_107 : ptr = &(tree[x_95].rightIndex); + let x_108 : i32 = *(x_107); + if ((x_108 == -1)) { + *(x_107) = 2; + tree[2] = BST(12, -1, -1); + x_123_phi = true; + break; + } else { + x_113 = *(x_107); + x_96_phi = x_113; + continue; + } + return; + } + return; + + continuing { + x_96 = x_96_phi; + x_95_phi = x_96; + } + } + let x_123 : bool = x_123_phi; + if (x_123) { + break; + } + } + } + var x_128_phi : i32; + var x_156_phi : bool; + switch(0u) { + default: { + x_128_phi = 0; + loop { + var x_154 : i32; + var x_146 : i32; + var x_129 : i32; + var x_129_phi : i32; + let x_128 : i32 = x_128_phi; + x_156_phi = false; + if ((x_128 <= 3)) { + } else { + break; + } + let x_135 : i32 = tree[x_128].data; + if ((15 <= x_135)) { + let x_148 : ptr = &(tree[x_128].leftIndex); + let x_149 : i32 = *(x_148); + if ((x_149 == -1)) { + *(x_148) = 3; + tree[3] = BST(15, -1, -1); + x_156_phi = true; + break; + } else { + x_154 = *(x_148); + x_129_phi = x_154; + continue; + } + return; + } else { + let x_140 : ptr = &(tree[x_128].rightIndex); + let x_141 : i32 = *(x_140); + if ((x_141 == -1)) { + *(x_140) = 3; + tree[3] = BST(15, -1, -1); + x_156_phi = true; + break; + } else { + x_146 = *(x_140); + x_129_phi = x_146; + continue; + } + return; + } + return; + + continuing { + x_129 = x_129_phi; + x_128_phi = x_129; + } + } + let x_156 : bool = x_156_phi; + if (x_156) { + break; + } + } + } + var x_161_phi : i32; + var x_189_phi : bool; + switch(0u) { + default: { + x_161_phi = 0; + loop { + var x_187 : i32; + var x_179 : i32; + var x_162 : i32; + var x_162_phi : i32; + let x_161 : i32 = x_161_phi; + x_189_phi = false; + if ((x_161 <= 4)) { + } else { + break; + } + let x_168 : i32 = tree[x_161].data; + if ((7 <= x_168)) { + let x_181 : ptr = &(tree[x_161].leftIndex); + let x_182 : i32 = *(x_181); + if ((x_182 == -1)) { + *(x_181) = 4; + tree[4] = BST(7, -1, -1); + x_189_phi = true; + break; + } else { + x_187 = *(x_181); + x_162_phi = x_187; + continue; + } + return; + } else { + let x_173 : ptr = &(tree[x_161].rightIndex); + let x_174 : i32 = *(x_173); + if ((x_174 == -1)) { + *(x_173) = 4; + tree[4] = BST(7, -1, -1); + x_189_phi = true; + break; + } else { + x_179 = *(x_173); + x_162_phi = x_179; + continue; + } + return; + } + return; + + continuing { + x_162 = x_162_phi; + x_161_phi = x_162; + } + } + let x_189 : bool = x_189_phi; + if (x_189) { + break; + } + } + } + var x_194_phi : i32; + var x_222_phi : bool; + switch(0u) { + default: { + x_194_phi = 0; + loop { + var x_220 : i32; + var x_212 : i32; + var x_195 : i32; + var x_195_phi : i32; + let x_194 : i32 = x_194_phi; + x_222_phi = false; + if ((x_194 <= 5)) { + } else { + break; + } + let x_201 : i32 = tree[x_194].data; + if ((8 <= x_201)) { + let x_214 : ptr = &(tree[x_194].leftIndex); + let x_215 : i32 = *(x_214); + if ((x_215 == -1)) { + *(x_214) = 5; + tree[5] = BST(8, -1, -1); + x_222_phi = true; + break; + } else { + x_220 = *(x_214); + x_195_phi = x_220; + continue; + } + return; + } else { + let x_206 : ptr = &(tree[x_194].rightIndex); + let x_207 : i32 = *(x_206); + if ((x_207 == -1)) { + *(x_206) = 5; + tree[5] = BST(8, -1, -1); + x_222_phi = true; + break; + } else { + x_212 = *(x_206); + x_195_phi = x_212; + continue; + } + return; + } + return; + + continuing { + x_195 = x_195_phi; + x_194_phi = x_195; + } + } + let x_222 : bool = x_222_phi; + if (x_222) { + break; + } + } + } + var x_227_phi : i32; + var x_255_phi : bool; + switch(0u) { + default: { + x_227_phi = 0; + loop { + var x_253 : i32; + var x_245 : i32; + var x_228 : i32; + var x_228_phi : i32; + let x_227 : i32 = x_227_phi; + x_255_phi = false; + if ((x_227 <= 6)) { + } else { + break; + } + let x_234 : i32 = tree[x_227].data; + if ((2 <= x_234)) { + let x_247 : ptr = &(tree[x_227].leftIndex); + let x_248 : i32 = *(x_247); + if ((x_248 == -1)) { + *(x_247) = 6; + tree[6] = BST(2, -1, -1); + x_255_phi = true; + break; + } else { + x_253 = *(x_247); + x_228_phi = x_253; + continue; + } + return; + } else { + let x_239 : ptr = &(tree[x_227].rightIndex); + let x_240 : i32 = *(x_239); + if ((x_240 == -1)) { + *(x_239) = 6; + tree[6] = BST(2, -1, -1); + x_255_phi = true; + break; + } else { + x_245 = *(x_239); + x_228_phi = x_245; + continue; + } + return; + } + return; + + continuing { + x_228 = x_228_phi; + x_227_phi = x_228; + } + } + let x_255 : bool = x_255_phi; + if (x_255) { + break; + } + } + } + var x_260_phi : i32; + var x_288_phi : bool; + switch(0u) { + default: { + x_260_phi = 0; + loop { + var x_286 : i32; + var x_278 : i32; + var x_261 : i32; + var x_261_phi : i32; + let x_260 : i32 = x_260_phi; + x_288_phi = false; + if ((x_260 <= 7)) { + } else { + break; + } + let x_267 : i32 = tree[x_260].data; + if ((6 <= x_267)) { + let x_280 : ptr = &(tree[x_260].leftIndex); + let x_281 : i32 = *(x_280); + if ((x_281 == -1)) { + *(x_280) = 7; + tree[7] = BST(6, -1, -1); + x_288_phi = true; + break; + } else { + x_286 = *(x_280); + x_261_phi = x_286; + continue; + } + return; + } else { + let x_272 : ptr = &(tree[x_260].rightIndex); + let x_273 : i32 = *(x_272); + if ((x_273 == -1)) { + *(x_272) = 7; + tree[7] = BST(6, -1, -1); + x_288_phi = true; + break; + } else { + x_278 = *(x_272); + x_261_phi = x_278; + continue; + } + return; + } + return; + + continuing { + x_261 = x_261_phi; + x_260_phi = x_261; + } + } + let x_288 : bool = x_288_phi; + if (x_288) { + break; + } + } + } + var x_293_phi : i32; + var x_321_phi : bool; + switch(0u) { + default: { + x_293_phi = 0; + loop { + var x_319 : i32; + var x_311 : i32; + var x_294 : i32; + var x_294_phi : i32; + let x_293 : i32 = x_293_phi; + x_321_phi = false; + if ((x_293 <= 8)) { + } else { + break; + } + let x_300 : i32 = tree[x_293].data; + if ((17 <= x_300)) { + let x_313 : ptr = &(tree[x_293].leftIndex); + let x_314 : i32 = *(x_313); + if ((x_314 == -1)) { + *(x_313) = 8; + tree[8] = BST(17, -1, -1); + x_321_phi = true; + break; + } else { + x_319 = *(x_313); + x_294_phi = x_319; + continue; + } + return; + } else { + let x_305 : ptr = &(tree[x_293].rightIndex); + let x_306 : i32 = *(x_305); + if ((x_306 == -1)) { + *(x_305) = 8; + tree[8] = BST(17, -1, -1); + x_321_phi = true; + break; + } else { + x_311 = *(x_305); + x_294_phi = x_311; + continue; + } + return; + } + return; + + continuing { + x_294 = x_294_phi; + x_293_phi = x_294; + } + } + let x_321 : bool = x_321_phi; + if (x_321) { + break; + } + } + } + var x_326_phi : i32; + var x_354_phi : bool; + switch(0u) { + default: { + x_326_phi = 0; + loop { + var x_352 : i32; + var x_344 : i32; + var x_327 : i32; + var x_327_phi : i32; + let x_326 : i32 = x_326_phi; + x_354_phi = false; + if ((x_326 <= 9)) { + } else { + break; + } + let x_333 : i32 = tree[x_326].data; + if ((13 <= x_333)) { + let x_346 : ptr = &(tree[x_326].leftIndex); + let x_347 : i32 = *(x_346); + if ((x_347 == -1)) { + *(x_346) = 9; + tree[9] = BST(13, -1, -1); + x_354_phi = true; + break; + } else { + x_352 = *(x_346); + x_327_phi = x_352; + continue; + } + return; + } else { + let x_338 : ptr = &(tree[x_326].rightIndex); + let x_339 : i32 = *(x_338); + if ((x_339 == -1)) { + *(x_338) = 9; + tree[9] = BST(13, -1, -1); + x_354_phi = true; + break; + } else { + x_344 = *(x_338); + x_327_phi = x_344; + continue; + } + return; + } + return; + + continuing { + x_327 = x_327_phi; + x_326_phi = x_327; + } + } + let x_354 : bool = x_354_phi; + if (x_354) { + break; + } + } + } + x_357_phi = 0; + x_360_phi = 0; + x_362_phi = 0; + loop { + var x_392 : i32; + var x_402 : i32; + var x_407 : i32; + var x_363 : i32; + var x_358_phi : i32; + var x_361_phi : i32; + let x_357 : i32 = x_357_phi; + x_360 = x_360_phi; + let x_362 : i32 = x_362_phi; + let x_365 : i32 = (6 - 15); + if ((x_362 < 20)) { + } else { + break; + } + var x_374_phi : i32; + var x_392_phi : i32; + var x_393_phi : bool; + switch(0u) { + default: { + x_374_phi = 0; + loop { + let x_374 : i32 = x_374_phi; + x_392_phi = x_357; + x_393_phi = false; + if ((x_374 != -1)) { + } else { + break; + } + let x_381 : BST = tree[x_374]; + let x_382 : i32 = x_381.data; + let x_383 : i32 = x_381.leftIndex; + let x_385 : i32 = x_381.rightIndex; + if ((x_382 == x_362)) { + x_392_phi = x_362; + x_393_phi = true; + break; + } + let x_389 : f32 = x_GLF_color[select(3u, 3u, (3u <= 3u))]; + + continuing { + x_374_phi = select(x_383, x_385, !((x_362 <= x_382))); + } + } + x_392 = x_392_phi; + let x_393 : bool = x_393_phi; + x_358_phi = x_392; + if (x_393) { + break; + } + x_358_phi = -1; + } + } + var x_358 : i32; + var x_401 : i32; + var x_406 : i32; + var x_402_phi : i32; + var x_407_phi : i32; + x_358 = x_358_phi; + switch(x_362) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + x_402_phi = x_360; + if ((x_358 == bitcast(x_362))) { + x_401 = bitcast((x_360 + bitcast(1))); + x_402_phi = x_401; + } + x_402 = x_402_phi; + x_361_phi = x_402; + } + default: { + x_407_phi = x_360; + if ((x_358 == bitcast(-1))) { + x_406 = bitcast((x_360 + bitcast(1))); + x_407_phi = x_406; + } + x_407 = x_407_phi; + x_361_phi = x_407; + } + } + let x_361 : i32 = x_361_phi; + + continuing { + x_363 = (x_362 + 1); + x_357_phi = x_358; + x_360_phi = x_361; + x_362_phi = x_363; + } + } + if ((x_360 == bitcast(20))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..6b3b61f5d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.hlsl @@ -0,0 +1,750 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + BST tree[10] = (BST[10])0; + int x_360 = 0; + int x_62_phi = 0; + bool x_90_phi = false; + int x_357_phi = 0; + int x_360_phi = 0; + int x_362_phi = 0; + const BST tint_symbol_2 = {9, -1, -1}; + tree[0] = tint_symbol_2; + switch(0u) { + default: { + x_62_phi = 0; + while (true) { + int x_88 = 0; + int x_80 = 0; + int x_63 = 0; + int x_63_phi = 0; + const int x_62 = x_62_phi; + x_90_phi = false; + if ((x_62 <= 1)) { + } else { + break; + } + const int x_69 = tree[x_62].data; + if ((5 <= x_69)) { + const int x_82_save = x_62; + const int x_83 = tree[x_82_save].leftIndex; + if ((x_83 == -1)) { + tree[x_82_save].leftIndex = 1; + const BST tint_symbol_3 = {5, -1, -1}; + tree[1] = tint_symbol_3; + x_90_phi = true; + break; + } else { + x_88 = tree[x_82_save].leftIndex; + x_63_phi = x_88; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + continue; + } + return; + } else { + const int x_74_save = x_62; + const int x_75 = tree[x_74_save].rightIndex; + if ((x_75 == -1)) { + tree[x_74_save].rightIndex = 1; + const BST tint_symbol_4 = {5, -1, -1}; + tree[1] = tint_symbol_4; + x_90_phi = true; + break; + } else { + x_80 = tree[x_74_save].rightIndex; + x_63_phi = x_80; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + continue; + } + return; + } + return; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + } + if (x_90_phi) { + break; + } + break; + } + } + int x_95_phi = 0; + bool x_123_phi = false; + switch(0u) { + default: { + x_95_phi = 0; + while (true) { + int x_121 = 0; + int x_113 = 0; + int x_96 = 0; + int x_96_phi = 0; + const int x_95 = x_95_phi; + x_123_phi = false; + if ((x_95 <= 2)) { + } else { + break; + } + const int x_102 = tree[x_95].data; + if ((12 <= x_102)) { + const int x_115_save = x_95; + const int x_116 = tree[x_115_save].leftIndex; + if ((x_116 == -1)) { + tree[x_115_save].leftIndex = 2; + const BST tint_symbol_5 = {12, -1, -1}; + tree[2] = tint_symbol_5; + x_123_phi = true; + break; + } else { + x_121 = tree[x_115_save].leftIndex; + x_96_phi = x_121; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + continue; + } + return; + } else { + const int x_107_save = x_95; + const int x_108 = tree[x_107_save].rightIndex; + if ((x_108 == -1)) { + tree[x_107_save].rightIndex = 2; + const BST tint_symbol_6 = {12, -1, -1}; + tree[2] = tint_symbol_6; + x_123_phi = true; + break; + } else { + x_113 = tree[x_107_save].rightIndex; + x_96_phi = x_113; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + continue; + } + return; + } + return; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + } + if (x_123_phi) { + break; + } + break; + } + } + int x_128_phi = 0; + bool x_156_phi = false; + switch(0u) { + default: { + x_128_phi = 0; + while (true) { + int x_154 = 0; + int x_146 = 0; + int x_129 = 0; + int x_129_phi = 0; + const int x_128 = x_128_phi; + x_156_phi = false; + if ((x_128 <= 3)) { + } else { + break; + } + const int x_135 = tree[x_128].data; + if ((15 <= x_135)) { + const int x_148_save = x_128; + const int x_149 = tree[x_148_save].leftIndex; + if ((x_149 == -1)) { + tree[x_148_save].leftIndex = 3; + const BST tint_symbol_7 = {15, -1, -1}; + tree[3] = tint_symbol_7; + x_156_phi = true; + break; + } else { + x_154 = tree[x_148_save].leftIndex; + x_129_phi = x_154; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + continue; + } + return; + } else { + const int x_140_save = x_128; + const int x_141 = tree[x_140_save].rightIndex; + if ((x_141 == -1)) { + tree[x_140_save].rightIndex = 3; + const BST tint_symbol_8 = {15, -1, -1}; + tree[3] = tint_symbol_8; + x_156_phi = true; + break; + } else { + x_146 = tree[x_140_save].rightIndex; + x_129_phi = x_146; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + continue; + } + return; + } + return; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + } + if (x_156_phi) { + break; + } + break; + } + } + int x_161_phi = 0; + bool x_189_phi = false; + switch(0u) { + default: { + x_161_phi = 0; + while (true) { + int x_187 = 0; + int x_179 = 0; + int x_162 = 0; + int x_162_phi = 0; + const int x_161 = x_161_phi; + x_189_phi = false; + if ((x_161 <= 4)) { + } else { + break; + } + const int x_168 = tree[x_161].data; + if ((7 <= x_168)) { + const int x_181_save = x_161; + const int x_182 = tree[x_181_save].leftIndex; + if ((x_182 == -1)) { + tree[x_181_save].leftIndex = 4; + const BST tint_symbol_9 = {7, -1, -1}; + tree[4] = tint_symbol_9; + x_189_phi = true; + break; + } else { + x_187 = tree[x_181_save].leftIndex; + x_162_phi = x_187; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + continue; + } + return; + } else { + const int x_173_save = x_161; + const int x_174 = tree[x_173_save].rightIndex; + if ((x_174 == -1)) { + tree[x_173_save].rightIndex = 4; + const BST tint_symbol_10 = {7, -1, -1}; + tree[4] = tint_symbol_10; + x_189_phi = true; + break; + } else { + x_179 = tree[x_173_save].rightIndex; + x_162_phi = x_179; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + continue; + } + return; + } + return; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + } + if (x_189_phi) { + break; + } + break; + } + } + int x_194_phi = 0; + bool x_222_phi = false; + switch(0u) { + default: { + x_194_phi = 0; + while (true) { + int x_220 = 0; + int x_212 = 0; + int x_195 = 0; + int x_195_phi = 0; + const int x_194 = x_194_phi; + x_222_phi = false; + if ((x_194 <= 5)) { + } else { + break; + } + const int x_201 = tree[x_194].data; + if ((8 <= x_201)) { + const int x_214_save = x_194; + const int x_215 = tree[x_214_save].leftIndex; + if ((x_215 == -1)) { + tree[x_214_save].leftIndex = 5; + const BST tint_symbol_11 = {8, -1, -1}; + tree[5] = tint_symbol_11; + x_222_phi = true; + break; + } else { + x_220 = tree[x_214_save].leftIndex; + x_195_phi = x_220; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + continue; + } + return; + } else { + const int x_206_save = x_194; + const int x_207 = tree[x_206_save].rightIndex; + if ((x_207 == -1)) { + tree[x_206_save].rightIndex = 5; + const BST tint_symbol_12 = {8, -1, -1}; + tree[5] = tint_symbol_12; + x_222_phi = true; + break; + } else { + x_212 = tree[x_206_save].rightIndex; + x_195_phi = x_212; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + continue; + } + return; + } + return; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + } + if (x_222_phi) { + break; + } + break; + } + } + int x_227_phi = 0; + bool x_255_phi = false; + switch(0u) { + default: { + x_227_phi = 0; + while (true) { + int x_253 = 0; + int x_245 = 0; + int x_228 = 0; + int x_228_phi = 0; + const int x_227 = x_227_phi; + x_255_phi = false; + if ((x_227 <= 6)) { + } else { + break; + } + const int x_234 = tree[x_227].data; + if ((2 <= x_234)) { + const int x_247_save = x_227; + const int x_248 = tree[x_247_save].leftIndex; + if ((x_248 == -1)) { + tree[x_247_save].leftIndex = 6; + const BST tint_symbol_13 = {2, -1, -1}; + tree[6] = tint_symbol_13; + x_255_phi = true; + break; + } else { + x_253 = tree[x_247_save].leftIndex; + x_228_phi = x_253; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + continue; + } + return; + } else { + const int x_239_save = x_227; + const int x_240 = tree[x_239_save].rightIndex; + if ((x_240 == -1)) { + tree[x_239_save].rightIndex = 6; + const BST tint_symbol_14 = {2, -1, -1}; + tree[6] = tint_symbol_14; + x_255_phi = true; + break; + } else { + x_245 = tree[x_239_save].rightIndex; + x_228_phi = x_245; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + continue; + } + return; + } + return; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + } + if (x_255_phi) { + break; + } + break; + } + } + int x_260_phi = 0; + bool x_288_phi = false; + switch(0u) { + default: { + x_260_phi = 0; + while (true) { + int x_286 = 0; + int x_278 = 0; + int x_261 = 0; + int x_261_phi = 0; + const int x_260 = x_260_phi; + x_288_phi = false; + if ((x_260 <= 7)) { + } else { + break; + } + const int x_267 = tree[x_260].data; + if ((6 <= x_267)) { + const int x_280_save = x_260; + const int x_281 = tree[x_280_save].leftIndex; + if ((x_281 == -1)) { + tree[x_280_save].leftIndex = 7; + const BST tint_symbol_15 = {6, -1, -1}; + tree[7] = tint_symbol_15; + x_288_phi = true; + break; + } else { + x_286 = tree[x_280_save].leftIndex; + x_261_phi = x_286; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + continue; + } + return; + } else { + const int x_272_save = x_260; + const int x_273 = tree[x_272_save].rightIndex; + if ((x_273 == -1)) { + tree[x_272_save].rightIndex = 7; + const BST tint_symbol_16 = {6, -1, -1}; + tree[7] = tint_symbol_16; + x_288_phi = true; + break; + } else { + x_278 = tree[x_272_save].rightIndex; + x_261_phi = x_278; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + continue; + } + return; + } + return; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + } + if (x_288_phi) { + break; + } + break; + } + } + int x_293_phi = 0; + bool x_321_phi = false; + switch(0u) { + default: { + x_293_phi = 0; + while (true) { + int x_319 = 0; + int x_311 = 0; + int x_294 = 0; + int x_294_phi = 0; + const int x_293 = x_293_phi; + x_321_phi = false; + if ((x_293 <= 8)) { + } else { + break; + } + const int x_300 = tree[x_293].data; + if ((17 <= x_300)) { + const int x_313_save = x_293; + const int x_314 = tree[x_313_save].leftIndex; + if ((x_314 == -1)) { + tree[x_313_save].leftIndex = 8; + const BST tint_symbol_17 = {17, -1, -1}; + tree[8] = tint_symbol_17; + x_321_phi = true; + break; + } else { + x_319 = tree[x_313_save].leftIndex; + x_294_phi = x_319; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + continue; + } + return; + } else { + const int x_305_save = x_293; + const int x_306 = tree[x_305_save].rightIndex; + if ((x_306 == -1)) { + tree[x_305_save].rightIndex = 8; + const BST tint_symbol_18 = {17, -1, -1}; + tree[8] = tint_symbol_18; + x_321_phi = true; + break; + } else { + x_311 = tree[x_305_save].rightIndex; + x_294_phi = x_311; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + continue; + } + return; + } + return; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + } + if (x_321_phi) { + break; + } + break; + } + } + int x_326_phi = 0; + bool x_354_phi = false; + switch(0u) { + default: { + x_326_phi = 0; + while (true) { + int x_352 = 0; + int x_344 = 0; + int x_327 = 0; + int x_327_phi = 0; + const int x_326 = x_326_phi; + x_354_phi = false; + if ((x_326 <= 9)) { + } else { + break; + } + const int x_333 = tree[x_326].data; + if ((13 <= x_333)) { + const int x_346_save = x_326; + const int x_347 = tree[x_346_save].leftIndex; + if ((x_347 == -1)) { + tree[x_346_save].leftIndex = 9; + const BST tint_symbol_19 = {13, -1, -1}; + tree[9] = tint_symbol_19; + x_354_phi = true; + break; + } else { + x_352 = tree[x_346_save].leftIndex; + x_327_phi = x_352; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + continue; + } + return; + } else { + const int x_338_save = x_326; + const int x_339 = tree[x_338_save].rightIndex; + if ((x_339 == -1)) { + tree[x_338_save].rightIndex = 9; + const BST tint_symbol_20 = {13, -1, -1}; + tree[9] = tint_symbol_20; + x_354_phi = true; + break; + } else { + x_344 = tree[x_338_save].rightIndex; + x_327_phi = x_344; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + continue; + } + return; + } + return; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + } + if (x_354_phi) { + break; + } + break; + } + } + x_357_phi = 0; + x_360_phi = 0; + x_362_phi = 0; + while (true) { + int x_392 = 0; + int x_402 = 0; + int x_407 = 0; + int x_363 = 0; + int x_358_phi = 0; + int x_361_phi = 0; + const int x_357 = x_357_phi; + x_360 = x_360_phi; + const int x_362 = x_362_phi; + const int x_365 = (6 - 15); + if ((x_362 < 20)) { + } else { + break; + } + int x_374_phi = 0; + int x_392_phi = 0; + bool x_393_phi = false; + switch(0u) { + default: { + x_374_phi = 0; + while (true) { + const int x_374 = x_374_phi; + x_392_phi = x_357; + x_393_phi = false; + if ((x_374 != -1)) { + } else { + break; + } + const BST x_381 = tree[x_374]; + const int x_382 = x_381.data; + const int x_383 = x_381.leftIndex; + const int x_385 = x_381.rightIndex; + if ((x_382 == x_362)) { + x_392_phi = x_362; + x_393_phi = true; + break; + } + const float x_389 = x_GLF_color[((3u <= 3u) ? 3u : 3u)]; + { + x_374_phi = (!((x_362 <= x_382)) ? x_385 : x_383); + } + } + x_392 = x_392_phi; + const bool x_393 = x_393_phi; + x_358_phi = x_392; + if (x_393) { + break; + } + x_358_phi = -1; + break; + } + } + int x_358 = 0; + int x_401 = 0; + int x_406 = 0; + int x_402_phi = 0; + int x_407_phi = 0; + x_358 = x_358_phi; + switch(x_362) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_402_phi = x_360; + if ((x_358 == asint(x_362))) { + x_401 = asint((x_360 + asint(1))); + x_402_phi = x_401; + } + x_402 = x_402_phi; + x_361_phi = x_402; + break; + } + default: { + x_407_phi = x_360; + if ((x_358 == asint(-1))) { + x_406 = asint((x_360 + asint(1))); + x_407_phi = x_406; + } + x_407 = x_407_phi; + x_361_phi = x_407; + break; + } + } + const int x_361 = x_361_phi; + { + x_363 = (x_362 + 1); + x_357_phi = x_358; + x_360_phi = x_361; + x_362_phi = x_363; + } + } + if ((x_360 == asint(20))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_21 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_21; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.msl new file mode 100644 index 0000000000..94bc881457 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.msl @@ -0,0 +1,764 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_23) { + tint_array_wrapper tree = {}; + int x_360 = 0; + int x_62_phi = 0; + bool x_90_phi = false; + int x_357_phi = 0; + int x_360_phi = 0; + int x_362_phi = 0; + BST const tint_symbol_3 = {.data=9, .leftIndex=-1, .rightIndex=-1}; + tree.arr[0] = tint_symbol_3; + switch(0u) { + default: { + x_62_phi = 0; + while (true) { + int x_88 = 0; + int x_80 = 0; + int x_63 = 0; + int x_63_phi = 0; + int const x_62 = x_62_phi; + x_90_phi = false; + if ((x_62 <= 1)) { + } else { + break; + } + int const x_69 = tree.arr[x_62].data; + if ((5 <= x_69)) { + int const x_82_save = x_62; + int const x_83 = tree.arr[x_82_save].leftIndex; + if ((x_83 == -1)) { + tree.arr[x_82_save].leftIndex = 1; + BST const tint_symbol_4 = {.data=5, .leftIndex=-1, .rightIndex=-1}; + tree.arr[1] = tint_symbol_4; + x_90_phi = true; + break; + } else { + x_88 = tree.arr[x_82_save].leftIndex; + x_63_phi = x_88; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + continue; + } + return; + } else { + int const x_74_save = x_62; + int const x_75 = tree.arr[x_74_save].rightIndex; + if ((x_75 == -1)) { + tree.arr[x_74_save].rightIndex = 1; + BST const tint_symbol_5 = {.data=5, .leftIndex=-1, .rightIndex=-1}; + tree.arr[1] = tint_symbol_5; + x_90_phi = true; + break; + } else { + x_80 = tree.arr[x_74_save].rightIndex; + x_63_phi = x_80; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + continue; + } + return; + } + return; + { + x_63 = x_63_phi; + x_62_phi = x_63; + } + } + bool const x_90 = x_90_phi; + if (x_90) { + break; + } + break; + } + } + int x_95_phi = 0; + bool x_123_phi = false; + switch(0u) { + default: { + x_95_phi = 0; + while (true) { + int x_121 = 0; + int x_113 = 0; + int x_96 = 0; + int x_96_phi = 0; + int const x_95 = x_95_phi; + x_123_phi = false; + if ((x_95 <= 2)) { + } else { + break; + } + int const x_102 = tree.arr[x_95].data; + if ((12 <= x_102)) { + int const x_115_save = x_95; + int const x_116 = tree.arr[x_115_save].leftIndex; + if ((x_116 == -1)) { + tree.arr[x_115_save].leftIndex = 2; + BST const tint_symbol_6 = {.data=12, .leftIndex=-1, .rightIndex=-1}; + tree.arr[2] = tint_symbol_6; + x_123_phi = true; + break; + } else { + x_121 = tree.arr[x_115_save].leftIndex; + x_96_phi = x_121; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + continue; + } + return; + } else { + int const x_107_save = x_95; + int const x_108 = tree.arr[x_107_save].rightIndex; + if ((x_108 == -1)) { + tree.arr[x_107_save].rightIndex = 2; + BST const tint_symbol_7 = {.data=12, .leftIndex=-1, .rightIndex=-1}; + tree.arr[2] = tint_symbol_7; + x_123_phi = true; + break; + } else { + x_113 = tree.arr[x_107_save].rightIndex; + x_96_phi = x_113; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + continue; + } + return; + } + return; + { + x_96 = x_96_phi; + x_95_phi = x_96; + } + } + bool const x_123 = x_123_phi; + if (x_123) { + break; + } + break; + } + } + int x_128_phi = 0; + bool x_156_phi = false; + switch(0u) { + default: { + x_128_phi = 0; + while (true) { + int x_154 = 0; + int x_146 = 0; + int x_129 = 0; + int x_129_phi = 0; + int const x_128 = x_128_phi; + x_156_phi = false; + if ((x_128 <= 3)) { + } else { + break; + } + int const x_135 = tree.arr[x_128].data; + if ((15 <= x_135)) { + int const x_148_save = x_128; + int const x_149 = tree.arr[x_148_save].leftIndex; + if ((x_149 == -1)) { + tree.arr[x_148_save].leftIndex = 3; + BST const tint_symbol_8 = {.data=15, .leftIndex=-1, .rightIndex=-1}; + tree.arr[3] = tint_symbol_8; + x_156_phi = true; + break; + } else { + x_154 = tree.arr[x_148_save].leftIndex; + x_129_phi = x_154; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + continue; + } + return; + } else { + int const x_140_save = x_128; + int const x_141 = tree.arr[x_140_save].rightIndex; + if ((x_141 == -1)) { + tree.arr[x_140_save].rightIndex = 3; + BST const tint_symbol_9 = {.data=15, .leftIndex=-1, .rightIndex=-1}; + tree.arr[3] = tint_symbol_9; + x_156_phi = true; + break; + } else { + x_146 = tree.arr[x_140_save].rightIndex; + x_129_phi = x_146; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + continue; + } + return; + } + return; + { + x_129 = x_129_phi; + x_128_phi = x_129; + } + } + bool const x_156 = x_156_phi; + if (x_156) { + break; + } + break; + } + } + int x_161_phi = 0; + bool x_189_phi = false; + switch(0u) { + default: { + x_161_phi = 0; + while (true) { + int x_187 = 0; + int x_179 = 0; + int x_162 = 0; + int x_162_phi = 0; + int const x_161 = x_161_phi; + x_189_phi = false; + if ((x_161 <= 4)) { + } else { + break; + } + int const x_168 = tree.arr[x_161].data; + if ((7 <= x_168)) { + int const x_181_save = x_161; + int const x_182 = tree.arr[x_181_save].leftIndex; + if ((x_182 == -1)) { + tree.arr[x_181_save].leftIndex = 4; + BST const tint_symbol_10 = {.data=7, .leftIndex=-1, .rightIndex=-1}; + tree.arr[4] = tint_symbol_10; + x_189_phi = true; + break; + } else { + x_187 = tree.arr[x_181_save].leftIndex; + x_162_phi = x_187; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + continue; + } + return; + } else { + int const x_173_save = x_161; + int const x_174 = tree.arr[x_173_save].rightIndex; + if ((x_174 == -1)) { + tree.arr[x_173_save].rightIndex = 4; + BST const tint_symbol_11 = {.data=7, .leftIndex=-1, .rightIndex=-1}; + tree.arr[4] = tint_symbol_11; + x_189_phi = true; + break; + } else { + x_179 = tree.arr[x_173_save].rightIndex; + x_162_phi = x_179; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + continue; + } + return; + } + return; + { + x_162 = x_162_phi; + x_161_phi = x_162; + } + } + bool const x_189 = x_189_phi; + if (x_189) { + break; + } + break; + } + } + int x_194_phi = 0; + bool x_222_phi = false; + switch(0u) { + default: { + x_194_phi = 0; + while (true) { + int x_220 = 0; + int x_212 = 0; + int x_195 = 0; + int x_195_phi = 0; + int const x_194 = x_194_phi; + x_222_phi = false; + if ((x_194 <= 5)) { + } else { + break; + } + int const x_201 = tree.arr[x_194].data; + if ((8 <= x_201)) { + int const x_214_save = x_194; + int const x_215 = tree.arr[x_214_save].leftIndex; + if ((x_215 == -1)) { + tree.arr[x_214_save].leftIndex = 5; + BST const tint_symbol_12 = {.data=8, .leftIndex=-1, .rightIndex=-1}; + tree.arr[5] = tint_symbol_12; + x_222_phi = true; + break; + } else { + x_220 = tree.arr[x_214_save].leftIndex; + x_195_phi = x_220; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + continue; + } + return; + } else { + int const x_206_save = x_194; + int const x_207 = tree.arr[x_206_save].rightIndex; + if ((x_207 == -1)) { + tree.arr[x_206_save].rightIndex = 5; + BST const tint_symbol_13 = {.data=8, .leftIndex=-1, .rightIndex=-1}; + tree.arr[5] = tint_symbol_13; + x_222_phi = true; + break; + } else { + x_212 = tree.arr[x_206_save].rightIndex; + x_195_phi = x_212; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + continue; + } + return; + } + return; + { + x_195 = x_195_phi; + x_194_phi = x_195; + } + } + bool const x_222 = x_222_phi; + if (x_222) { + break; + } + break; + } + } + int x_227_phi = 0; + bool x_255_phi = false; + switch(0u) { + default: { + x_227_phi = 0; + while (true) { + int x_253 = 0; + int x_245 = 0; + int x_228 = 0; + int x_228_phi = 0; + int const x_227 = x_227_phi; + x_255_phi = false; + if ((x_227 <= 6)) { + } else { + break; + } + int const x_234 = tree.arr[x_227].data; + if ((2 <= x_234)) { + int const x_247_save = x_227; + int const x_248 = tree.arr[x_247_save].leftIndex; + if ((x_248 == -1)) { + tree.arr[x_247_save].leftIndex = 6; + BST const tint_symbol_14 = {.data=2, .leftIndex=-1, .rightIndex=-1}; + tree.arr[6] = tint_symbol_14; + x_255_phi = true; + break; + } else { + x_253 = tree.arr[x_247_save].leftIndex; + x_228_phi = x_253; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + continue; + } + return; + } else { + int const x_239_save = x_227; + int const x_240 = tree.arr[x_239_save].rightIndex; + if ((x_240 == -1)) { + tree.arr[x_239_save].rightIndex = 6; + BST const tint_symbol_15 = {.data=2, .leftIndex=-1, .rightIndex=-1}; + tree.arr[6] = tint_symbol_15; + x_255_phi = true; + break; + } else { + x_245 = tree.arr[x_239_save].rightIndex; + x_228_phi = x_245; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + continue; + } + return; + } + return; + { + x_228 = x_228_phi; + x_227_phi = x_228; + } + } + bool const x_255 = x_255_phi; + if (x_255) { + break; + } + break; + } + } + int x_260_phi = 0; + bool x_288_phi = false; + switch(0u) { + default: { + x_260_phi = 0; + while (true) { + int x_286 = 0; + int x_278 = 0; + int x_261 = 0; + int x_261_phi = 0; + int const x_260 = x_260_phi; + x_288_phi = false; + if ((x_260 <= 7)) { + } else { + break; + } + int const x_267 = tree.arr[x_260].data; + if ((6 <= x_267)) { + int const x_280_save = x_260; + int const x_281 = tree.arr[x_280_save].leftIndex; + if ((x_281 == -1)) { + tree.arr[x_280_save].leftIndex = 7; + BST const tint_symbol_16 = {.data=6, .leftIndex=-1, .rightIndex=-1}; + tree.arr[7] = tint_symbol_16; + x_288_phi = true; + break; + } else { + x_286 = tree.arr[x_280_save].leftIndex; + x_261_phi = x_286; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + continue; + } + return; + } else { + int const x_272_save = x_260; + int const x_273 = tree.arr[x_272_save].rightIndex; + if ((x_273 == -1)) { + tree.arr[x_272_save].rightIndex = 7; + BST const tint_symbol_17 = {.data=6, .leftIndex=-1, .rightIndex=-1}; + tree.arr[7] = tint_symbol_17; + x_288_phi = true; + break; + } else { + x_278 = tree.arr[x_272_save].rightIndex; + x_261_phi = x_278; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + continue; + } + return; + } + return; + { + x_261 = x_261_phi; + x_260_phi = x_261; + } + } + bool const x_288 = x_288_phi; + if (x_288) { + break; + } + break; + } + } + int x_293_phi = 0; + bool x_321_phi = false; + switch(0u) { + default: { + x_293_phi = 0; + while (true) { + int x_319 = 0; + int x_311 = 0; + int x_294 = 0; + int x_294_phi = 0; + int const x_293 = x_293_phi; + x_321_phi = false; + if ((x_293 <= 8)) { + } else { + break; + } + int const x_300 = tree.arr[x_293].data; + if ((17 <= x_300)) { + int const x_313_save = x_293; + int const x_314 = tree.arr[x_313_save].leftIndex; + if ((x_314 == -1)) { + tree.arr[x_313_save].leftIndex = 8; + BST const tint_symbol_18 = {.data=17, .leftIndex=-1, .rightIndex=-1}; + tree.arr[8] = tint_symbol_18; + x_321_phi = true; + break; + } else { + x_319 = tree.arr[x_313_save].leftIndex; + x_294_phi = x_319; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + continue; + } + return; + } else { + int const x_305_save = x_293; + int const x_306 = tree.arr[x_305_save].rightIndex; + if ((x_306 == -1)) { + tree.arr[x_305_save].rightIndex = 8; + BST const tint_symbol_19 = {.data=17, .leftIndex=-1, .rightIndex=-1}; + tree.arr[8] = tint_symbol_19; + x_321_phi = true; + break; + } else { + x_311 = tree.arr[x_305_save].rightIndex; + x_294_phi = x_311; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + continue; + } + return; + } + return; + { + x_294 = x_294_phi; + x_293_phi = x_294; + } + } + bool const x_321 = x_321_phi; + if (x_321) { + break; + } + break; + } + } + int x_326_phi = 0; + bool x_354_phi = false; + switch(0u) { + default: { + x_326_phi = 0; + while (true) { + int x_352 = 0; + int x_344 = 0; + int x_327 = 0; + int x_327_phi = 0; + int const x_326 = x_326_phi; + x_354_phi = false; + if ((x_326 <= 9)) { + } else { + break; + } + int const x_333 = tree.arr[x_326].data; + if ((13 <= x_333)) { + int const x_346_save = x_326; + int const x_347 = tree.arr[x_346_save].leftIndex; + if ((x_347 == -1)) { + tree.arr[x_346_save].leftIndex = 9; + BST const tint_symbol_20 = {.data=13, .leftIndex=-1, .rightIndex=-1}; + tree.arr[9] = tint_symbol_20; + x_354_phi = true; + break; + } else { + x_352 = tree.arr[x_346_save].leftIndex; + x_327_phi = x_352; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + continue; + } + return; + } else { + int const x_338_save = x_326; + int const x_339 = tree.arr[x_338_save].rightIndex; + if ((x_339 == -1)) { + tree.arr[x_338_save].rightIndex = 9; + BST const tint_symbol_21 = {.data=13, .leftIndex=-1, .rightIndex=-1}; + tree.arr[9] = tint_symbol_21; + x_354_phi = true; + break; + } else { + x_344 = tree.arr[x_338_save].rightIndex; + x_327_phi = x_344; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + continue; + } + return; + } + return; + { + x_327 = x_327_phi; + x_326_phi = x_327; + } + } + bool const x_354 = x_354_phi; + if (x_354) { + break; + } + break; + } + } + x_357_phi = 0; + x_360_phi = 0; + x_362_phi = 0; + while (true) { + int x_392 = 0; + int x_402 = 0; + int x_407 = 0; + int x_363 = 0; + int x_358_phi = 0; + int x_361_phi = 0; + int const x_357 = x_357_phi; + x_360 = x_360_phi; + int const x_362 = x_362_phi; + int const x_365 = (6 - 15); + if ((x_362 < 20)) { + } else { + break; + } + int x_374_phi = 0; + int x_392_phi = 0; + bool x_393_phi = false; + switch(0u) { + default: { + x_374_phi = 0; + while (true) { + int const x_374 = x_374_phi; + x_392_phi = x_357; + x_393_phi = false; + if ((x_374 != -1)) { + } else { + break; + } + BST const x_381 = tree.arr[x_374]; + int const x_382 = x_381.data; + int const x_383 = x_381.leftIndex; + int const x_385 = x_381.rightIndex; + if ((x_382 == x_362)) { + x_392_phi = x_362; + x_393_phi = true; + break; + } + float const x_389 = (*(tint_symbol_23))[select(3u, 3u, (3u <= 3u))]; + { + x_374_phi = select(x_383, x_385, !((x_362 <= x_382))); + } + } + x_392 = x_392_phi; + bool const x_393 = x_393_phi; + x_358_phi = x_392; + if (x_393) { + break; + } + x_358_phi = -1; + break; + } + } + int x_358 = 0; + int x_401 = 0; + int x_406 = 0; + int x_402_phi = 0; + int x_407_phi = 0; + x_358 = x_358_phi; + switch(x_362) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_402_phi = x_360; + if ((x_358 == as_type(x_362))) { + x_401 = as_type((x_360 + as_type(1))); + x_402_phi = x_401; + } + x_402 = x_402_phi; + x_361_phi = x_402; + break; + } + default: { + x_407_phi = x_360; + if ((x_358 == as_type(-1))) { + x_406 = as_type((x_360 + as_type(1))); + x_407_phi = x_406; + } + x_407 = x_407_phi; + x_361_phi = x_407; + break; + } + } + int const x_361 = x_361_phi; + { + x_363 = (x_362 + 1); + x_357_phi = x_358; + x_360_phi = x_361; + x_362_phi = x_363; + } + } + if ((x_360 == as_type(20))) { + *(tint_symbol_23) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_23) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_24 = 0.0f; + main_1(&(tint_symbol_24)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_24}; + tint_symbol_1 const tint_symbol_22 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_22; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..9057c705a2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.spvasm @@ -0,0 +1,1174 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 627 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree "tree" + OpName %x_360 "x_360" + OpName %x_62_phi "x_62_phi" + OpName %x_90_phi "x_90_phi" + OpName %x_357_phi "x_357_phi" + OpName %x_360_phi "x_360_phi" + OpName %x_362_phi "x_362_phi" + OpName %x_88 "x_88" + OpName %x_80 "x_80" + OpName %x_63 "x_63" + OpName %x_63_phi "x_63_phi" + OpName %x_95_phi "x_95_phi" + OpName %x_123_phi "x_123_phi" + OpName %x_121 "x_121" + OpName %x_113 "x_113" + OpName %x_96 "x_96" + OpName %x_96_phi "x_96_phi" + OpName %x_128_phi "x_128_phi" + OpName %x_156_phi "x_156_phi" + OpName %x_154 "x_154" + OpName %x_146 "x_146" + OpName %x_129 "x_129" + OpName %x_129_phi "x_129_phi" + OpName %x_161_phi "x_161_phi" + OpName %x_189_phi "x_189_phi" + OpName %x_187 "x_187" + OpName %x_179 "x_179" + OpName %x_162 "x_162" + OpName %x_162_phi "x_162_phi" + OpName %x_194_phi "x_194_phi" + OpName %x_222_phi "x_222_phi" + OpName %x_220 "x_220" + OpName %x_212 "x_212" + OpName %x_195 "x_195" + OpName %x_195_phi "x_195_phi" + OpName %x_227_phi "x_227_phi" + OpName %x_255_phi "x_255_phi" + OpName %x_253 "x_253" + OpName %x_245 "x_245" + OpName %x_228 "x_228" + OpName %x_228_phi "x_228_phi" + OpName %x_260_phi "x_260_phi" + OpName %x_288_phi "x_288_phi" + OpName %x_286 "x_286" + OpName %x_278 "x_278" + OpName %x_261 "x_261" + OpName %x_261_phi "x_261_phi" + OpName %x_293_phi "x_293_phi" + OpName %x_321_phi "x_321_phi" + OpName %x_319 "x_319" + OpName %x_311 "x_311" + OpName %x_294 "x_294" + OpName %x_294_phi "x_294_phi" + OpName %x_326_phi "x_326_phi" + OpName %x_354_phi "x_354_phi" + OpName %x_352 "x_352" + OpName %x_344 "x_344" + OpName %x_327 "x_327" + OpName %x_327_phi "x_327_phi" + OpName %x_392 "x_392" + OpName %x_402 "x_402" + OpName %x_407 "x_407" + OpName %x_363 "x_363" + OpName %x_358_phi "x_358_phi" + OpName %x_361_phi "x_361_phi" + OpName %x_374_phi "x_374_phi" + OpName %x_392_phi "x_392_phi" + OpName %x_393_phi "x_393_phi" + OpName %x_358 "x_358" + OpName %x_401 "x_401" + OpName %x_406 "x_406" + OpName %x_402_phi "x_402_phi" + OpName %x_407_phi "x_407_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Function__arr_BST_uint_10 = OpTypePointer Function %_arr_BST_uint_10 + %19 = OpConstantNull %_arr_BST_uint_10 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool + %int_0 = OpConstant %int 0 +%_ptr_Function_BST = OpTypePointer Function %BST + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 + %36 = OpConstantComposite %BST %int_9 %int_n1 %int_n1 + %uint_0 = OpConstant %uint 0 + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 + %71 = OpConstantComposite %BST %int_5 %int_n1 %int_n1 + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 + %int_12 = OpConstant %int 12 + %126 = OpConstantComposite %BST %int_12 %int_n1 %int_n1 + %int_3 = OpConstant %int 3 + %int_15 = OpConstant %int 15 + %179 = OpConstantComposite %BST %int_15 %int_n1 %int_n1 + %int_4 = OpConstant %int 4 + %int_7 = OpConstant %int 7 + %232 = OpConstantComposite %BST %int_7 %int_n1 %int_n1 + %int_8 = OpConstant %int 8 + %284 = OpConstantComposite %BST %int_8 %int_n1 %int_n1 + %int_6 = OpConstant %int 6 + %336 = OpConstantComposite %BST %int_2 %int_n1 %int_n1 + %387 = OpConstantComposite %BST %int_6 %int_n1 %int_n1 + %int_17 = OpConstant %int 17 + %439 = OpConstantComposite %BST %int_17 %int_n1 %int_n1 + %int_13 = OpConstant %int 13 + %491 = OpConstantComposite %BST %int_13 %int_n1 %int_n1 + %int_20 = OpConstant %int 20 + %uint_3 = OpConstant %uint 3 +%_ptr_Private_float = OpTypePointer Private %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %613 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %614 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %615 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %tree = OpVariable %_ptr_Function__arr_BST_uint_10 Function %19 + %x_360 = OpVariable %_ptr_Function_int Function %22 + %x_62_phi = OpVariable %_ptr_Function_int Function %22 + %x_90_phi = OpVariable %_ptr_Function_bool Function %27 + %x_357_phi = OpVariable %_ptr_Function_int Function %22 + %x_360_phi = OpVariable %_ptr_Function_int Function %22 + %x_362_phi = OpVariable %_ptr_Function_int Function %22 + %x_88 = OpVariable %_ptr_Function_int Function %22 + %x_80 = OpVariable %_ptr_Function_int Function %22 + %x_63 = OpVariable %_ptr_Function_int Function %22 + %x_63_phi = OpVariable %_ptr_Function_int Function %22 + %x_95_phi = OpVariable %_ptr_Function_int Function %22 + %x_123_phi = OpVariable %_ptr_Function_bool Function %27 + %x_121 = OpVariable %_ptr_Function_int Function %22 + %x_113 = OpVariable %_ptr_Function_int Function %22 + %x_96 = OpVariable %_ptr_Function_int Function %22 + %x_96_phi = OpVariable %_ptr_Function_int Function %22 + %x_128_phi = OpVariable %_ptr_Function_int Function %22 + %x_156_phi = OpVariable %_ptr_Function_bool Function %27 + %x_154 = OpVariable %_ptr_Function_int Function %22 + %x_146 = OpVariable %_ptr_Function_int Function %22 + %x_129 = OpVariable %_ptr_Function_int Function %22 + %x_129_phi = OpVariable %_ptr_Function_int Function %22 + %x_161_phi = OpVariable %_ptr_Function_int Function %22 + %x_189_phi = OpVariable %_ptr_Function_bool Function %27 + %x_187 = OpVariable %_ptr_Function_int Function %22 + %x_179 = OpVariable %_ptr_Function_int Function %22 + %x_162 = OpVariable %_ptr_Function_int Function %22 + %x_162_phi = OpVariable %_ptr_Function_int Function %22 + %x_194_phi = OpVariable %_ptr_Function_int Function %22 + %x_222_phi = OpVariable %_ptr_Function_bool Function %27 + %x_220 = OpVariable %_ptr_Function_int Function %22 + %x_212 = OpVariable %_ptr_Function_int Function %22 + %x_195 = OpVariable %_ptr_Function_int Function %22 + %x_195_phi = OpVariable %_ptr_Function_int Function %22 + %x_227_phi = OpVariable %_ptr_Function_int Function %22 + %x_255_phi = OpVariable %_ptr_Function_bool Function %27 + %x_253 = OpVariable %_ptr_Function_int Function %22 + %x_245 = OpVariable %_ptr_Function_int Function %22 + %x_228 = OpVariable %_ptr_Function_int Function %22 + %x_228_phi = OpVariable %_ptr_Function_int Function %22 + %x_260_phi = OpVariable %_ptr_Function_int Function %22 + %x_288_phi = OpVariable %_ptr_Function_bool Function %27 + %x_286 = OpVariable %_ptr_Function_int Function %22 + %x_278 = OpVariable %_ptr_Function_int Function %22 + %x_261 = OpVariable %_ptr_Function_int Function %22 + %x_261_phi = OpVariable %_ptr_Function_int Function %22 + %x_293_phi = OpVariable %_ptr_Function_int Function %22 + %x_321_phi = OpVariable %_ptr_Function_bool Function %27 + %x_319 = OpVariable %_ptr_Function_int Function %22 + %x_311 = OpVariable %_ptr_Function_int Function %22 + %x_294 = OpVariable %_ptr_Function_int Function %22 + %x_294_phi = OpVariable %_ptr_Function_int Function %22 + %x_326_phi = OpVariable %_ptr_Function_int Function %22 + %x_354_phi = OpVariable %_ptr_Function_bool Function %27 + %x_352 = OpVariable %_ptr_Function_int Function %22 + %x_344 = OpVariable %_ptr_Function_int Function %22 + %x_327 = OpVariable %_ptr_Function_int Function %22 + %x_327_phi = OpVariable %_ptr_Function_int Function %22 + %x_392 = OpVariable %_ptr_Function_int Function %22 + %x_402 = OpVariable %_ptr_Function_int Function %22 + %x_407 = OpVariable %_ptr_Function_int Function %22 + %x_363 = OpVariable %_ptr_Function_int Function %22 + %x_358_phi = OpVariable %_ptr_Function_int Function %22 + %x_361_phi = OpVariable %_ptr_Function_int Function %22 + %x_374_phi = OpVariable %_ptr_Function_int Function %22 + %x_392_phi = OpVariable %_ptr_Function_int Function %22 + %x_393_phi = OpVariable %_ptr_Function_bool Function %27 + %x_358 = OpVariable %_ptr_Function_int Function %22 + %x_401 = OpVariable %_ptr_Function_int Function %22 + %x_406 = OpVariable %_ptr_Function_int Function %22 + %x_402_phi = OpVariable %_ptr_Function_int Function %22 + %x_407_phi = OpVariable %_ptr_Function_int Function %22 + %33 = OpAccessChain %_ptr_Function_BST %tree %int_0 + OpStore %33 %36 + OpSelectionMerge %37 None + OpSwitch %uint_0 %39 + %39 = OpLabel + OpStore %x_62_phi %int_0 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %48 = OpLoad %int %x_62_phi + OpStore %x_90_phi %false + %51 = OpSLessThanEqual %bool %48 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %41 + %52 = OpLabel + %55 = OpAccessChain %_ptr_Function_int %tree %48 %uint_0 + %56 = OpLoad %int %55 + %58 = OpSLessThanEqual %bool %int_5 %56 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + %63 = OpAccessChain %_ptr_Function_int %tree %48 %uint_1 + %64 = OpLoad %int %63 + %65 = OpIEqual %bool %64 %int_n1 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %67 = OpLabel + %69 = OpAccessChain %_ptr_Function_int %tree %48 %uint_1 + OpStore %69 %int_1 + %70 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %70 %71 + OpStore %x_90_phi %true + OpBranch %41 + %68 = OpLabel + %73 = OpAccessChain %_ptr_Function_int %tree %48 %uint_1 + %74 = OpLoad %int %73 + OpStore %x_88 %74 + %75 = OpLoad %int %x_88 + OpStore %x_63_phi %75 + OpBranch %42 + %66 = OpLabel + OpReturn + %61 = OpLabel + %77 = OpAccessChain %_ptr_Function_int %tree %48 %uint_2 + %78 = OpLoad %int %77 + %79 = OpIEqual %bool %78 %int_n1 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + %83 = OpAccessChain %_ptr_Function_int %tree %48 %uint_2 + OpStore %83 %int_1 + %84 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %84 %71 + OpStore %x_90_phi %true + OpBranch %41 + %82 = OpLabel + %85 = OpAccessChain %_ptr_Function_int %tree %48 %uint_2 + %86 = OpLoad %int %85 + OpStore %x_80 %86 + %87 = OpLoad %int %x_80 + OpStore %x_63_phi %87 + OpBranch %42 + %80 = OpLabel + OpReturn + %59 = OpLabel + OpReturn + %42 = OpLabel + %88 = OpLoad %int %x_63_phi + OpStore %x_63 %88 + %89 = OpLoad %int %x_63 + OpStore %x_62_phi %89 + OpBranch %40 + %41 = OpLabel + %90 = OpLoad %bool %x_90_phi + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + OpBranch %37 + %91 = OpLabel + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %95 None + OpSwitch %uint_0 %96 + %96 = OpLabel + OpStore %x_95_phi %int_0 + OpBranch %97 + %97 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %105 = OpLoad %int %x_95_phi + OpStore %x_123_phi %false + %107 = OpSLessThanEqual %bool %105 %int_2 + OpSelectionMerge %108 None + OpBranchConditional %107 %109 %110 + %109 = OpLabel + OpBranch %108 + %110 = OpLabel + OpBranch %98 + %108 = OpLabel + %111 = OpAccessChain %_ptr_Function_int %tree %105 %uint_0 + %112 = OpLoad %int %111 + %114 = OpSLessThanEqual %bool %int_12 %112 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %117 + %116 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %tree %105 %uint_1 + %119 = OpLoad %int %118 + %120 = OpIEqual %bool %119 %int_n1 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + %124 = OpAccessChain %_ptr_Function_int %tree %105 %uint_1 + OpStore %124 %int_2 + %125 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %125 %126 + OpStore %x_123_phi %true + OpBranch %98 + %123 = OpLabel + %127 = OpAccessChain %_ptr_Function_int %tree %105 %uint_1 + %128 = OpLoad %int %127 + OpStore %x_121 %128 + %129 = OpLoad %int %x_121 + OpStore %x_96_phi %129 + OpBranch %99 + %121 = OpLabel + OpReturn + %117 = OpLabel + %130 = OpAccessChain %_ptr_Function_int %tree %105 %uint_2 + %131 = OpLoad %int %130 + %132 = OpIEqual %bool %131 %int_n1 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %135 + %134 = OpLabel + %136 = OpAccessChain %_ptr_Function_int %tree %105 %uint_2 + OpStore %136 %int_2 + %137 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %137 %126 + OpStore %x_123_phi %true + OpBranch %98 + %135 = OpLabel + %138 = OpAccessChain %_ptr_Function_int %tree %105 %uint_2 + %139 = OpLoad %int %138 + OpStore %x_113 %139 + %140 = OpLoad %int %x_113 + OpStore %x_96_phi %140 + OpBranch %99 + %133 = OpLabel + OpReturn + %115 = OpLabel + OpReturn + %99 = OpLabel + %141 = OpLoad %int %x_96_phi + OpStore %x_96 %141 + %142 = OpLoad %int %x_96 + OpStore %x_95_phi %142 + OpBranch %97 + %98 = OpLabel + %143 = OpLoad %bool %x_123_phi + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %144 + %145 = OpLabel + OpBranch %95 + %144 = OpLabel + OpBranch %95 + %95 = OpLabel + OpSelectionMerge %148 None + OpSwitch %uint_0 %149 + %149 = OpLabel + OpStore %x_128_phi %int_0 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %158 = OpLoad %int %x_128_phi + OpStore %x_156_phi %false + %160 = OpSLessThanEqual %bool %158 %int_3 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + OpBranch %161 + %163 = OpLabel + OpBranch %151 + %161 = OpLabel + %164 = OpAccessChain %_ptr_Function_int %tree %158 %uint_0 + %165 = OpLoad %int %164 + %167 = OpSLessThanEqual %bool %int_15 %165 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + %171 = OpAccessChain %_ptr_Function_int %tree %158 %uint_1 + %172 = OpLoad %int %171 + %173 = OpIEqual %bool %172 %int_n1 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %176 + %175 = OpLabel + %177 = OpAccessChain %_ptr_Function_int %tree %158 %uint_1 + OpStore %177 %int_3 + %178 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %178 %179 + OpStore %x_156_phi %true + OpBranch %151 + %176 = OpLabel + %180 = OpAccessChain %_ptr_Function_int %tree %158 %uint_1 + %181 = OpLoad %int %180 + OpStore %x_154 %181 + %182 = OpLoad %int %x_154 + OpStore %x_129_phi %182 + OpBranch %152 + %174 = OpLabel + OpReturn + %170 = OpLabel + %183 = OpAccessChain %_ptr_Function_int %tree %158 %uint_2 + %184 = OpLoad %int %183 + %185 = OpIEqual %bool %184 %int_n1 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + %189 = OpAccessChain %_ptr_Function_int %tree %158 %uint_2 + OpStore %189 %int_3 + %190 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %190 %179 + OpStore %x_156_phi %true + OpBranch %151 + %188 = OpLabel + %191 = OpAccessChain %_ptr_Function_int %tree %158 %uint_2 + %192 = OpLoad %int %191 + OpStore %x_146 %192 + %193 = OpLoad %int %x_146 + OpStore %x_129_phi %193 + OpBranch %152 + %186 = OpLabel + OpReturn + %168 = OpLabel + OpReturn + %152 = OpLabel + %194 = OpLoad %int %x_129_phi + OpStore %x_129 %194 + %195 = OpLoad %int %x_129 + OpStore %x_128_phi %195 + OpBranch %150 + %151 = OpLabel + %196 = OpLoad %bool %x_156_phi + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %197 + %198 = OpLabel + OpBranch %148 + %197 = OpLabel + OpBranch %148 + %148 = OpLabel + OpSelectionMerge %201 None + OpSwitch %uint_0 %202 + %202 = OpLabel + OpStore %x_161_phi %int_0 + OpBranch %203 + %203 = OpLabel + OpLoopMerge %204 %205 None + OpBranch %206 + %206 = OpLabel + %211 = OpLoad %int %x_161_phi + OpStore %x_189_phi %false + %213 = OpSLessThanEqual %bool %211 %int_4 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %204 + %214 = OpLabel + %217 = OpAccessChain %_ptr_Function_int %tree %211 %uint_0 + %218 = OpLoad %int %217 + %220 = OpSLessThanEqual %bool %int_7 %218 + OpSelectionMerge %221 None + OpBranchConditional %220 %222 %223 + %222 = OpLabel + %224 = OpAccessChain %_ptr_Function_int %tree %211 %uint_1 + %225 = OpLoad %int %224 + %226 = OpIEqual %bool %225 %int_n1 + OpSelectionMerge %227 None + OpBranchConditional %226 %228 %229 + %228 = OpLabel + %230 = OpAccessChain %_ptr_Function_int %tree %211 %uint_1 + OpStore %230 %int_4 + %231 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %231 %232 + OpStore %x_189_phi %true + OpBranch %204 + %229 = OpLabel + %233 = OpAccessChain %_ptr_Function_int %tree %211 %uint_1 + %234 = OpLoad %int %233 + OpStore %x_187 %234 + %235 = OpLoad %int %x_187 + OpStore %x_162_phi %235 + OpBranch %205 + %227 = OpLabel + OpReturn + %223 = OpLabel + %236 = OpAccessChain %_ptr_Function_int %tree %211 %uint_2 + %237 = OpLoad %int %236 + %238 = OpIEqual %bool %237 %int_n1 + OpSelectionMerge %239 None + OpBranchConditional %238 %240 %241 + %240 = OpLabel + %242 = OpAccessChain %_ptr_Function_int %tree %211 %uint_2 + OpStore %242 %int_4 + %243 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %243 %232 + OpStore %x_189_phi %true + OpBranch %204 + %241 = OpLabel + %244 = OpAccessChain %_ptr_Function_int %tree %211 %uint_2 + %245 = OpLoad %int %244 + OpStore %x_179 %245 + %246 = OpLoad %int %x_179 + OpStore %x_162_phi %246 + OpBranch %205 + %239 = OpLabel + OpReturn + %221 = OpLabel + OpReturn + %205 = OpLabel + %247 = OpLoad %int %x_162_phi + OpStore %x_162 %247 + %248 = OpLoad %int %x_162 + OpStore %x_161_phi %248 + OpBranch %203 + %204 = OpLabel + %249 = OpLoad %bool %x_189_phi + OpSelectionMerge %250 None + OpBranchConditional %249 %251 %250 + %251 = OpLabel + OpBranch %201 + %250 = OpLabel + OpBranch %201 + %201 = OpLabel + OpSelectionMerge %254 None + OpSwitch %uint_0 %255 + %255 = OpLabel + OpStore %x_194_phi %int_0 + OpBranch %256 + %256 = OpLabel + OpLoopMerge %257 %258 None + OpBranch %259 + %259 = OpLabel + %264 = OpLoad %int %x_194_phi + OpStore %x_222_phi %false + %265 = OpSLessThanEqual %bool %264 %int_5 + OpSelectionMerge %266 None + OpBranchConditional %265 %267 %268 + %267 = OpLabel + OpBranch %266 + %268 = OpLabel + OpBranch %257 + %266 = OpLabel + %269 = OpAccessChain %_ptr_Function_int %tree %264 %uint_0 + %270 = OpLoad %int %269 + %272 = OpSLessThanEqual %bool %int_8 %270 + OpSelectionMerge %273 None + OpBranchConditional %272 %274 %275 + %274 = OpLabel + %276 = OpAccessChain %_ptr_Function_int %tree %264 %uint_1 + %277 = OpLoad %int %276 + %278 = OpIEqual %bool %277 %int_n1 + OpSelectionMerge %279 None + OpBranchConditional %278 %280 %281 + %280 = OpLabel + %282 = OpAccessChain %_ptr_Function_int %tree %264 %uint_1 + OpStore %282 %int_5 + %283 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %283 %284 + OpStore %x_222_phi %true + OpBranch %257 + %281 = OpLabel + %285 = OpAccessChain %_ptr_Function_int %tree %264 %uint_1 + %286 = OpLoad %int %285 + OpStore %x_220 %286 + %287 = OpLoad %int %x_220 + OpStore %x_195_phi %287 + OpBranch %258 + %279 = OpLabel + OpReturn + %275 = OpLabel + %288 = OpAccessChain %_ptr_Function_int %tree %264 %uint_2 + %289 = OpLoad %int %288 + %290 = OpIEqual %bool %289 %int_n1 + OpSelectionMerge %291 None + OpBranchConditional %290 %292 %293 + %292 = OpLabel + %294 = OpAccessChain %_ptr_Function_int %tree %264 %uint_2 + OpStore %294 %int_5 + %295 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %295 %284 + OpStore %x_222_phi %true + OpBranch %257 + %293 = OpLabel + %296 = OpAccessChain %_ptr_Function_int %tree %264 %uint_2 + %297 = OpLoad %int %296 + OpStore %x_212 %297 + %298 = OpLoad %int %x_212 + OpStore %x_195_phi %298 + OpBranch %258 + %291 = OpLabel + OpReturn + %273 = OpLabel + OpReturn + %258 = OpLabel + %299 = OpLoad %int %x_195_phi + OpStore %x_195 %299 + %300 = OpLoad %int %x_195 + OpStore %x_194_phi %300 + OpBranch %256 + %257 = OpLabel + %301 = OpLoad %bool %x_222_phi + OpSelectionMerge %302 None + OpBranchConditional %301 %303 %302 + %303 = OpLabel + OpBranch %254 + %302 = OpLabel + OpBranch %254 + %254 = OpLabel + OpSelectionMerge %306 None + OpSwitch %uint_0 %307 + %307 = OpLabel + OpStore %x_227_phi %int_0 + OpBranch %308 + %308 = OpLabel + OpLoopMerge %309 %310 None + OpBranch %311 + %311 = OpLabel + %316 = OpLoad %int %x_227_phi + OpStore %x_255_phi %false + %318 = OpSLessThanEqual %bool %316 %int_6 + OpSelectionMerge %319 None + OpBranchConditional %318 %320 %321 + %320 = OpLabel + OpBranch %319 + %321 = OpLabel + OpBranch %309 + %319 = OpLabel + %322 = OpAccessChain %_ptr_Function_int %tree %316 %uint_0 + %323 = OpLoad %int %322 + %324 = OpSLessThanEqual %bool %int_2 %323 + OpSelectionMerge %325 None + OpBranchConditional %324 %326 %327 + %326 = OpLabel + %328 = OpAccessChain %_ptr_Function_int %tree %316 %uint_1 + %329 = OpLoad %int %328 + %330 = OpIEqual %bool %329 %int_n1 + OpSelectionMerge %331 None + OpBranchConditional %330 %332 %333 + %332 = OpLabel + %334 = OpAccessChain %_ptr_Function_int %tree %316 %uint_1 + OpStore %334 %int_6 + %335 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %335 %336 + OpStore %x_255_phi %true + OpBranch %309 + %333 = OpLabel + %337 = OpAccessChain %_ptr_Function_int %tree %316 %uint_1 + %338 = OpLoad %int %337 + OpStore %x_253 %338 + %339 = OpLoad %int %x_253 + OpStore %x_228_phi %339 + OpBranch %310 + %331 = OpLabel + OpReturn + %327 = OpLabel + %340 = OpAccessChain %_ptr_Function_int %tree %316 %uint_2 + %341 = OpLoad %int %340 + %342 = OpIEqual %bool %341 %int_n1 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %345 + %344 = OpLabel + %346 = OpAccessChain %_ptr_Function_int %tree %316 %uint_2 + OpStore %346 %int_6 + %347 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %347 %336 + OpStore %x_255_phi %true + OpBranch %309 + %345 = OpLabel + %348 = OpAccessChain %_ptr_Function_int %tree %316 %uint_2 + %349 = OpLoad %int %348 + OpStore %x_245 %349 + %350 = OpLoad %int %x_245 + OpStore %x_228_phi %350 + OpBranch %310 + %343 = OpLabel + OpReturn + %325 = OpLabel + OpReturn + %310 = OpLabel + %351 = OpLoad %int %x_228_phi + OpStore %x_228 %351 + %352 = OpLoad %int %x_228 + OpStore %x_227_phi %352 + OpBranch %308 + %309 = OpLabel + %353 = OpLoad %bool %x_255_phi + OpSelectionMerge %354 None + OpBranchConditional %353 %355 %354 + %355 = OpLabel + OpBranch %306 + %354 = OpLabel + OpBranch %306 + %306 = OpLabel + OpSelectionMerge %358 None + OpSwitch %uint_0 %359 + %359 = OpLabel + OpStore %x_260_phi %int_0 + OpBranch %360 + %360 = OpLabel + OpLoopMerge %361 %362 None + OpBranch %363 + %363 = OpLabel + %368 = OpLoad %int %x_260_phi + OpStore %x_288_phi %false + %369 = OpSLessThanEqual %bool %368 %int_7 + OpSelectionMerge %370 None + OpBranchConditional %369 %371 %372 + %371 = OpLabel + OpBranch %370 + %372 = OpLabel + OpBranch %361 + %370 = OpLabel + %373 = OpAccessChain %_ptr_Function_int %tree %368 %uint_0 + %374 = OpLoad %int %373 + %375 = OpSLessThanEqual %bool %int_6 %374 + OpSelectionMerge %376 None + OpBranchConditional %375 %377 %378 + %377 = OpLabel + %379 = OpAccessChain %_ptr_Function_int %tree %368 %uint_1 + %380 = OpLoad %int %379 + %381 = OpIEqual %bool %380 %int_n1 + OpSelectionMerge %382 None + OpBranchConditional %381 %383 %384 + %383 = OpLabel + %385 = OpAccessChain %_ptr_Function_int %tree %368 %uint_1 + OpStore %385 %int_7 + %386 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %386 %387 + OpStore %x_288_phi %true + OpBranch %361 + %384 = OpLabel + %388 = OpAccessChain %_ptr_Function_int %tree %368 %uint_1 + %389 = OpLoad %int %388 + OpStore %x_286 %389 + %390 = OpLoad %int %x_286 + OpStore %x_261_phi %390 + OpBranch %362 + %382 = OpLabel + OpReturn + %378 = OpLabel + %391 = OpAccessChain %_ptr_Function_int %tree %368 %uint_2 + %392 = OpLoad %int %391 + %393 = OpIEqual %bool %392 %int_n1 + OpSelectionMerge %394 None + OpBranchConditional %393 %395 %396 + %395 = OpLabel + %397 = OpAccessChain %_ptr_Function_int %tree %368 %uint_2 + OpStore %397 %int_7 + %398 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %398 %387 + OpStore %x_288_phi %true + OpBranch %361 + %396 = OpLabel + %399 = OpAccessChain %_ptr_Function_int %tree %368 %uint_2 + %400 = OpLoad %int %399 + OpStore %x_278 %400 + %401 = OpLoad %int %x_278 + OpStore %x_261_phi %401 + OpBranch %362 + %394 = OpLabel + OpReturn + %376 = OpLabel + OpReturn + %362 = OpLabel + %402 = OpLoad %int %x_261_phi + OpStore %x_261 %402 + %403 = OpLoad %int %x_261 + OpStore %x_260_phi %403 + OpBranch %360 + %361 = OpLabel + %404 = OpLoad %bool %x_288_phi + OpSelectionMerge %405 None + OpBranchConditional %404 %406 %405 + %406 = OpLabel + OpBranch %358 + %405 = OpLabel + OpBranch %358 + %358 = OpLabel + OpSelectionMerge %409 None + OpSwitch %uint_0 %410 + %410 = OpLabel + OpStore %x_293_phi %int_0 + OpBranch %411 + %411 = OpLabel + OpLoopMerge %412 %413 None + OpBranch %414 + %414 = OpLabel + %419 = OpLoad %int %x_293_phi + OpStore %x_321_phi %false + %420 = OpSLessThanEqual %bool %419 %int_8 + OpSelectionMerge %421 None + OpBranchConditional %420 %422 %423 + %422 = OpLabel + OpBranch %421 + %423 = OpLabel + OpBranch %412 + %421 = OpLabel + %424 = OpAccessChain %_ptr_Function_int %tree %419 %uint_0 + %425 = OpLoad %int %424 + %427 = OpSLessThanEqual %bool %int_17 %425 + OpSelectionMerge %428 None + OpBranchConditional %427 %429 %430 + %429 = OpLabel + %431 = OpAccessChain %_ptr_Function_int %tree %419 %uint_1 + %432 = OpLoad %int %431 + %433 = OpIEqual %bool %432 %int_n1 + OpSelectionMerge %434 None + OpBranchConditional %433 %435 %436 + %435 = OpLabel + %437 = OpAccessChain %_ptr_Function_int %tree %419 %uint_1 + OpStore %437 %int_8 + %438 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %438 %439 + OpStore %x_321_phi %true + OpBranch %412 + %436 = OpLabel + %440 = OpAccessChain %_ptr_Function_int %tree %419 %uint_1 + %441 = OpLoad %int %440 + OpStore %x_319 %441 + %442 = OpLoad %int %x_319 + OpStore %x_294_phi %442 + OpBranch %413 + %434 = OpLabel + OpReturn + %430 = OpLabel + %443 = OpAccessChain %_ptr_Function_int %tree %419 %uint_2 + %444 = OpLoad %int %443 + %445 = OpIEqual %bool %444 %int_n1 + OpSelectionMerge %446 None + OpBranchConditional %445 %447 %448 + %447 = OpLabel + %449 = OpAccessChain %_ptr_Function_int %tree %419 %uint_2 + OpStore %449 %int_8 + %450 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %450 %439 + OpStore %x_321_phi %true + OpBranch %412 + %448 = OpLabel + %451 = OpAccessChain %_ptr_Function_int %tree %419 %uint_2 + %452 = OpLoad %int %451 + OpStore %x_311 %452 + %453 = OpLoad %int %x_311 + OpStore %x_294_phi %453 + OpBranch %413 + %446 = OpLabel + OpReturn + %428 = OpLabel + OpReturn + %413 = OpLabel + %454 = OpLoad %int %x_294_phi + OpStore %x_294 %454 + %455 = OpLoad %int %x_294 + OpStore %x_293_phi %455 + OpBranch %411 + %412 = OpLabel + %456 = OpLoad %bool %x_321_phi + OpSelectionMerge %457 None + OpBranchConditional %456 %458 %457 + %458 = OpLabel + OpBranch %409 + %457 = OpLabel + OpBranch %409 + %409 = OpLabel + OpSelectionMerge %461 None + OpSwitch %uint_0 %462 + %462 = OpLabel + OpStore %x_326_phi %int_0 + OpBranch %463 + %463 = OpLabel + OpLoopMerge %464 %465 None + OpBranch %466 + %466 = OpLabel + %471 = OpLoad %int %x_326_phi + OpStore %x_354_phi %false + %472 = OpSLessThanEqual %bool %471 %int_9 + OpSelectionMerge %473 None + OpBranchConditional %472 %474 %475 + %474 = OpLabel + OpBranch %473 + %475 = OpLabel + OpBranch %464 + %473 = OpLabel + %476 = OpAccessChain %_ptr_Function_int %tree %471 %uint_0 + %477 = OpLoad %int %476 + %479 = OpSLessThanEqual %bool %int_13 %477 + OpSelectionMerge %480 None + OpBranchConditional %479 %481 %482 + %481 = OpLabel + %483 = OpAccessChain %_ptr_Function_int %tree %471 %uint_1 + %484 = OpLoad %int %483 + %485 = OpIEqual %bool %484 %int_n1 + OpSelectionMerge %486 None + OpBranchConditional %485 %487 %488 + %487 = OpLabel + %489 = OpAccessChain %_ptr_Function_int %tree %471 %uint_1 + OpStore %489 %int_9 + %490 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %490 %491 + OpStore %x_354_phi %true + OpBranch %464 + %488 = OpLabel + %492 = OpAccessChain %_ptr_Function_int %tree %471 %uint_1 + %493 = OpLoad %int %492 + OpStore %x_352 %493 + %494 = OpLoad %int %x_352 + OpStore %x_327_phi %494 + OpBranch %465 + %486 = OpLabel + OpReturn + %482 = OpLabel + %495 = OpAccessChain %_ptr_Function_int %tree %471 %uint_2 + %496 = OpLoad %int %495 + %497 = OpIEqual %bool %496 %int_n1 + OpSelectionMerge %498 None + OpBranchConditional %497 %499 %500 + %499 = OpLabel + %501 = OpAccessChain %_ptr_Function_int %tree %471 %uint_2 + OpStore %501 %int_9 + %502 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %502 %491 + OpStore %x_354_phi %true + OpBranch %464 + %500 = OpLabel + %503 = OpAccessChain %_ptr_Function_int %tree %471 %uint_2 + %504 = OpLoad %int %503 + OpStore %x_344 %504 + %505 = OpLoad %int %x_344 + OpStore %x_327_phi %505 + OpBranch %465 + %498 = OpLabel + OpReturn + %480 = OpLabel + OpReturn + %465 = OpLabel + %506 = OpLoad %int %x_327_phi + OpStore %x_327 %506 + %507 = OpLoad %int %x_327 + OpStore %x_326_phi %507 + OpBranch %463 + %464 = OpLabel + %508 = OpLoad %bool %x_354_phi + OpSelectionMerge %509 None + OpBranchConditional %508 %510 %509 + %510 = OpLabel + OpBranch %461 + %509 = OpLabel + OpBranch %461 + %461 = OpLabel + OpStore %x_357_phi %int_0 + OpStore %x_360_phi %int_0 + OpStore %x_362_phi %int_0 + OpBranch %511 + %511 = OpLabel + OpLoopMerge %512 %513 None + OpBranch %514 + %514 = OpLabel + %521 = OpLoad %int %x_357_phi + %522 = OpLoad %int %x_360_phi + OpStore %x_360 %522 + %523 = OpLoad %int %x_362_phi + %524 = OpISub %int %int_6 %int_15 + %526 = OpSLessThan %bool %523 %int_20 + OpSelectionMerge %527 None + OpBranchConditional %526 %528 %529 + %528 = OpLabel + OpBranch %527 + %529 = OpLabel + OpBranch %512 + %527 = OpLabel + OpSelectionMerge %533 None + OpSwitch %uint_0 %534 + %534 = OpLabel + OpStore %x_374_phi %int_0 + OpBranch %535 + %535 = OpLabel + OpLoopMerge %536 %537 None + OpBranch %538 + %538 = OpLabel + %539 = OpLoad %int %x_374_phi + OpStore %x_392_phi %521 + OpStore %x_393_phi %false + %540 = OpINotEqual %bool %539 %int_n1 + OpSelectionMerge %541 None + OpBranchConditional %540 %542 %543 + %542 = OpLabel + OpBranch %541 + %543 = OpLabel + OpBranch %536 + %541 = OpLabel + %544 = OpAccessChain %_ptr_Function_BST %tree %539 + %545 = OpLoad %BST %544 + %546 = OpCompositeExtract %int %545 0 + %547 = OpCompositeExtract %int %545 1 + %548 = OpCompositeExtract %int %545 2 + %549 = OpIEqual %bool %546 %523 + OpSelectionMerge %550 None + OpBranchConditional %549 %551 %550 + %551 = OpLabel + OpStore %x_392_phi %523 + OpStore %x_393_phi %true + OpBranch %536 + %550 = OpLabel + %554 = OpULessThanEqual %bool %uint_3 %uint_3 + %552 = OpSelect %uint %554 %uint_3 %uint_3 + %556 = OpAccessChain %_ptr_Private_float %x_GLF_color %552 + %557 = OpLoad %float %556 + OpBranch %537 + %537 = OpLabel + %560 = OpSLessThanEqual %bool %523 %546 + %559 = OpLogicalNot %bool %560 + %558 = OpSelect %int %559 %548 %547 + OpStore %x_374_phi %558 + OpBranch %535 + %536 = OpLabel + %561 = OpLoad %int %x_392_phi + OpStore %x_392 %561 + %562 = OpLoad %bool %x_393_phi + %563 = OpLoad %int %x_392 + OpStore %x_358_phi %563 + OpSelectionMerge %564 None + OpBranchConditional %562 %565 %564 + %565 = OpLabel + OpBranch %533 + %564 = OpLabel + OpStore %x_358_phi %int_n1 + OpBranch %533 + %533 = OpLabel + %571 = OpLoad %int %x_358_phi + OpStore %x_358 %571 + OpSelectionMerge %572 None + OpSwitch %523 %573 2 %574 5 %574 6 %574 7 %574 8 %574 9 %574 12 %574 13 %574 15 %574 17 %574 + %574 = OpLabel + %575 = OpLoad %int %x_360 + OpStore %x_402_phi %575 + %576 = OpLoad %int %x_358 + %577 = OpCopyObject %int %523 + %578 = OpIEqual %bool %576 %577 + OpSelectionMerge %579 None + OpBranchConditional %578 %580 %579 + %580 = OpLabel + %582 = OpLoad %int %x_360 + %583 = OpCopyObject %int %int_1 + %584 = OpIAdd %int %582 %583 + %581 = OpCopyObject %int %584 + OpStore %x_401 %581 + %585 = OpLoad %int %x_401 + OpStore %x_402_phi %585 + OpBranch %579 + %579 = OpLabel + %586 = OpLoad %int %x_402_phi + OpStore %x_402 %586 + %587 = OpLoad %int %x_402 + OpStore %x_361_phi %587 + OpBranch %572 + %573 = OpLabel + %588 = OpLoad %int %x_360 + OpStore %x_407_phi %588 + %589 = OpLoad %int %x_358 + %590 = OpCopyObject %int %int_n1 + %591 = OpIEqual %bool %589 %590 + OpSelectionMerge %592 None + OpBranchConditional %591 %593 %592 + %593 = OpLabel + %595 = OpLoad %int %x_360 + %596 = OpCopyObject %int %int_1 + %597 = OpIAdd %int %595 %596 + %594 = OpCopyObject %int %597 + OpStore %x_406 %594 + %598 = OpLoad %int %x_406 + OpStore %x_407_phi %598 + OpBranch %592 + %592 = OpLabel + %599 = OpLoad %int %x_407_phi + OpStore %x_407 %599 + %600 = OpLoad %int %x_407 + OpStore %x_361_phi %600 + OpBranch %572 + %572 = OpLabel + %601 = OpLoad %int %x_361_phi + OpBranch %513 + %513 = OpLabel + %602 = OpIAdd %int %523 %int_1 + OpStore %x_363 %602 + %603 = OpLoad %int %x_358 + OpStore %x_357_phi %603 + OpStore %x_360_phi %601 + %604 = OpLoad %int %x_363 + OpStore %x_362_phi %604 + OpBranch %511 + %512 = OpLabel + %605 = OpLoad %int %x_360 + %606 = OpCopyObject %int %int_20 + %607 = OpIEqual %bool %605 %606 + OpSelectionMerge %608 None + OpBranchConditional %607 %609 %610 + %609 = OpLabel + OpStore %x_GLF_color %613 + OpBranch %608 + %610 = OpLabel + OpStore %x_GLF_color %614 + OpBranch %608 + %608 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %615 +%tint_symbol = OpFunctionParameter %main_out + %619 = OpLabel + %620 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %620 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %622 = OpLabel + %623 = OpFunctionCall %void %main_1 + %625 = OpLoad %v4float %x_GLF_color + %626 = OpCompositeConstruct %main_out %625 + %624 = OpFunctionCall %void %tint_symbol_2 %626 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c19b19cd9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.wgsl @@ -0,0 +1,655 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var x_GLF_color : vec4; + +fn main_1() { + var tree : array; + var x_360 : i32; + var x_62_phi : i32; + var x_90_phi : bool; + var x_357_phi : i32; + var x_360_phi : i32; + var x_362_phi : i32; + tree[0] = BST(9, -1, -1); + switch(0u) { + default: { + x_62_phi = 0; + loop { + var x_88 : i32; + var x_80 : i32; + var x_63 : i32; + var x_63_phi : i32; + let x_62 : i32 = x_62_phi; + x_90_phi = false; + if ((x_62 <= 1)) { + } else { + break; + } + let x_69 : i32 = tree[x_62].data; + if ((5 <= x_69)) { + let x_82 : ptr = &(tree[x_62].leftIndex); + let x_83 : i32 = *(x_82); + if ((x_83 == -1)) { + *(x_82) = 1; + tree[1] = BST(5, -1, -1); + x_90_phi = true; + break; + } else { + x_88 = *(x_82); + x_63_phi = x_88; + continue; + } + return; + } else { + let x_74 : ptr = &(tree[x_62].rightIndex); + let x_75 : i32 = *(x_74); + if ((x_75 == -1)) { + *(x_74) = 1; + tree[1] = BST(5, -1, -1); + x_90_phi = true; + break; + } else { + x_80 = *(x_74); + x_63_phi = x_80; + continue; + } + return; + } + return; + + continuing { + x_63 = x_63_phi; + x_62_phi = x_63; + } + } + let x_90 : bool = x_90_phi; + if (x_90) { + break; + } + } + } + var x_95_phi : i32; + var x_123_phi : bool; + switch(0u) { + default: { + x_95_phi = 0; + loop { + var x_121 : i32; + var x_113 : i32; + var x_96 : i32; + var x_96_phi : i32; + let x_95 : i32 = x_95_phi; + x_123_phi = false; + if ((x_95 <= 2)) { + } else { + break; + } + let x_102 : i32 = tree[x_95].data; + if ((12 <= x_102)) { + let x_115 : ptr = &(tree[x_95].leftIndex); + let x_116 : i32 = *(x_115); + if ((x_116 == -1)) { + *(x_115) = 2; + tree[2] = BST(12, -1, -1); + x_123_phi = true; + break; + } else { + x_121 = *(x_115); + x_96_phi = x_121; + continue; + } + return; + } else { + let x_107 : ptr = &(tree[x_95].rightIndex); + let x_108 : i32 = *(x_107); + if ((x_108 == -1)) { + *(x_107) = 2; + tree[2] = BST(12, -1, -1); + x_123_phi = true; + break; + } else { + x_113 = *(x_107); + x_96_phi = x_113; + continue; + } + return; + } + return; + + continuing { + x_96 = x_96_phi; + x_95_phi = x_96; + } + } + let x_123 : bool = x_123_phi; + if (x_123) { + break; + } + } + } + var x_128_phi : i32; + var x_156_phi : bool; + switch(0u) { + default: { + x_128_phi = 0; + loop { + var x_154 : i32; + var x_146 : i32; + var x_129 : i32; + var x_129_phi : i32; + let x_128 : i32 = x_128_phi; + x_156_phi = false; + if ((x_128 <= 3)) { + } else { + break; + } + let x_135 : i32 = tree[x_128].data; + if ((15 <= x_135)) { + let x_148 : ptr = &(tree[x_128].leftIndex); + let x_149 : i32 = *(x_148); + if ((x_149 == -1)) { + *(x_148) = 3; + tree[3] = BST(15, -1, -1); + x_156_phi = true; + break; + } else { + x_154 = *(x_148); + x_129_phi = x_154; + continue; + } + return; + } else { + let x_140 : ptr = &(tree[x_128].rightIndex); + let x_141 : i32 = *(x_140); + if ((x_141 == -1)) { + *(x_140) = 3; + tree[3] = BST(15, -1, -1); + x_156_phi = true; + break; + } else { + x_146 = *(x_140); + x_129_phi = x_146; + continue; + } + return; + } + return; + + continuing { + x_129 = x_129_phi; + x_128_phi = x_129; + } + } + let x_156 : bool = x_156_phi; + if (x_156) { + break; + } + } + } + var x_161_phi : i32; + var x_189_phi : bool; + switch(0u) { + default: { + x_161_phi = 0; + loop { + var x_187 : i32; + var x_179 : i32; + var x_162 : i32; + var x_162_phi : i32; + let x_161 : i32 = x_161_phi; + x_189_phi = false; + if ((x_161 <= 4)) { + } else { + break; + } + let x_168 : i32 = tree[x_161].data; + if ((7 <= x_168)) { + let x_181 : ptr = &(tree[x_161].leftIndex); + let x_182 : i32 = *(x_181); + if ((x_182 == -1)) { + *(x_181) = 4; + tree[4] = BST(7, -1, -1); + x_189_phi = true; + break; + } else { + x_187 = *(x_181); + x_162_phi = x_187; + continue; + } + return; + } else { + let x_173 : ptr = &(tree[x_161].rightIndex); + let x_174 : i32 = *(x_173); + if ((x_174 == -1)) { + *(x_173) = 4; + tree[4] = BST(7, -1, -1); + x_189_phi = true; + break; + } else { + x_179 = *(x_173); + x_162_phi = x_179; + continue; + } + return; + } + return; + + continuing { + x_162 = x_162_phi; + x_161_phi = x_162; + } + } + let x_189 : bool = x_189_phi; + if (x_189) { + break; + } + } + } + var x_194_phi : i32; + var x_222_phi : bool; + switch(0u) { + default: { + x_194_phi = 0; + loop { + var x_220 : i32; + var x_212 : i32; + var x_195 : i32; + var x_195_phi : i32; + let x_194 : i32 = x_194_phi; + x_222_phi = false; + if ((x_194 <= 5)) { + } else { + break; + } + let x_201 : i32 = tree[x_194].data; + if ((8 <= x_201)) { + let x_214 : ptr = &(tree[x_194].leftIndex); + let x_215 : i32 = *(x_214); + if ((x_215 == -1)) { + *(x_214) = 5; + tree[5] = BST(8, -1, -1); + x_222_phi = true; + break; + } else { + x_220 = *(x_214); + x_195_phi = x_220; + continue; + } + return; + } else { + let x_206 : ptr = &(tree[x_194].rightIndex); + let x_207 : i32 = *(x_206); + if ((x_207 == -1)) { + *(x_206) = 5; + tree[5] = BST(8, -1, -1); + x_222_phi = true; + break; + } else { + x_212 = *(x_206); + x_195_phi = x_212; + continue; + } + return; + } + return; + + continuing { + x_195 = x_195_phi; + x_194_phi = x_195; + } + } + let x_222 : bool = x_222_phi; + if (x_222) { + break; + } + } + } + var x_227_phi : i32; + var x_255_phi : bool; + switch(0u) { + default: { + x_227_phi = 0; + loop { + var x_253 : i32; + var x_245 : i32; + var x_228 : i32; + var x_228_phi : i32; + let x_227 : i32 = x_227_phi; + x_255_phi = false; + if ((x_227 <= 6)) { + } else { + break; + } + let x_234 : i32 = tree[x_227].data; + if ((2 <= x_234)) { + let x_247 : ptr = &(tree[x_227].leftIndex); + let x_248 : i32 = *(x_247); + if ((x_248 == -1)) { + *(x_247) = 6; + tree[6] = BST(2, -1, -1); + x_255_phi = true; + break; + } else { + x_253 = *(x_247); + x_228_phi = x_253; + continue; + } + return; + } else { + let x_239 : ptr = &(tree[x_227].rightIndex); + let x_240 : i32 = *(x_239); + if ((x_240 == -1)) { + *(x_239) = 6; + tree[6] = BST(2, -1, -1); + x_255_phi = true; + break; + } else { + x_245 = *(x_239); + x_228_phi = x_245; + continue; + } + return; + } + return; + + continuing { + x_228 = x_228_phi; + x_227_phi = x_228; + } + } + let x_255 : bool = x_255_phi; + if (x_255) { + break; + } + } + } + var x_260_phi : i32; + var x_288_phi : bool; + switch(0u) { + default: { + x_260_phi = 0; + loop { + var x_286 : i32; + var x_278 : i32; + var x_261 : i32; + var x_261_phi : i32; + let x_260 : i32 = x_260_phi; + x_288_phi = false; + if ((x_260 <= 7)) { + } else { + break; + } + let x_267 : i32 = tree[x_260].data; + if ((6 <= x_267)) { + let x_280 : ptr = &(tree[x_260].leftIndex); + let x_281 : i32 = *(x_280); + if ((x_281 == -1)) { + *(x_280) = 7; + tree[7] = BST(6, -1, -1); + x_288_phi = true; + break; + } else { + x_286 = *(x_280); + x_261_phi = x_286; + continue; + } + return; + } else { + let x_272 : ptr = &(tree[x_260].rightIndex); + let x_273 : i32 = *(x_272); + if ((x_273 == -1)) { + *(x_272) = 7; + tree[7] = BST(6, -1, -1); + x_288_phi = true; + break; + } else { + x_278 = *(x_272); + x_261_phi = x_278; + continue; + } + return; + } + return; + + continuing { + x_261 = x_261_phi; + x_260_phi = x_261; + } + } + let x_288 : bool = x_288_phi; + if (x_288) { + break; + } + } + } + var x_293_phi : i32; + var x_321_phi : bool; + switch(0u) { + default: { + x_293_phi = 0; + loop { + var x_319 : i32; + var x_311 : i32; + var x_294 : i32; + var x_294_phi : i32; + let x_293 : i32 = x_293_phi; + x_321_phi = false; + if ((x_293 <= 8)) { + } else { + break; + } + let x_300 : i32 = tree[x_293].data; + if ((17 <= x_300)) { + let x_313 : ptr = &(tree[x_293].leftIndex); + let x_314 : i32 = *(x_313); + if ((x_314 == -1)) { + *(x_313) = 8; + tree[8] = BST(17, -1, -1); + x_321_phi = true; + break; + } else { + x_319 = *(x_313); + x_294_phi = x_319; + continue; + } + return; + } else { + let x_305 : ptr = &(tree[x_293].rightIndex); + let x_306 : i32 = *(x_305); + if ((x_306 == -1)) { + *(x_305) = 8; + tree[8] = BST(17, -1, -1); + x_321_phi = true; + break; + } else { + x_311 = *(x_305); + x_294_phi = x_311; + continue; + } + return; + } + return; + + continuing { + x_294 = x_294_phi; + x_293_phi = x_294; + } + } + let x_321 : bool = x_321_phi; + if (x_321) { + break; + } + } + } + var x_326_phi : i32; + var x_354_phi : bool; + switch(0u) { + default: { + x_326_phi = 0; + loop { + var x_352 : i32; + var x_344 : i32; + var x_327 : i32; + var x_327_phi : i32; + let x_326 : i32 = x_326_phi; + x_354_phi = false; + if ((x_326 <= 9)) { + } else { + break; + } + let x_333 : i32 = tree[x_326].data; + if ((13 <= x_333)) { + let x_346 : ptr = &(tree[x_326].leftIndex); + let x_347 : i32 = *(x_346); + if ((x_347 == -1)) { + *(x_346) = 9; + tree[9] = BST(13, -1, -1); + x_354_phi = true; + break; + } else { + x_352 = *(x_346); + x_327_phi = x_352; + continue; + } + return; + } else { + let x_338 : ptr = &(tree[x_326].rightIndex); + let x_339 : i32 = *(x_338); + if ((x_339 == -1)) { + *(x_338) = 9; + tree[9] = BST(13, -1, -1); + x_354_phi = true; + break; + } else { + x_344 = *(x_338); + x_327_phi = x_344; + continue; + } + return; + } + return; + + continuing { + x_327 = x_327_phi; + x_326_phi = x_327; + } + } + let x_354 : bool = x_354_phi; + if (x_354) { + break; + } + } + } + x_357_phi = 0; + x_360_phi = 0; + x_362_phi = 0; + loop { + var x_392 : i32; + var x_402 : i32; + var x_407 : i32; + var x_363 : i32; + var x_358_phi : i32; + var x_361_phi : i32; + let x_357 : i32 = x_357_phi; + x_360 = x_360_phi; + let x_362 : i32 = x_362_phi; + let x_365 : i32 = (6 - 15); + if ((x_362 < 20)) { + } else { + break; + } + var x_374_phi : i32; + var x_392_phi : i32; + var x_393_phi : bool; + switch(0u) { + default: { + x_374_phi = 0; + loop { + let x_374 : i32 = x_374_phi; + x_392_phi = x_357; + x_393_phi = false; + if ((x_374 != -1)) { + } else { + break; + } + let x_381 : BST = tree[x_374]; + let x_382 : i32 = x_381.data; + let x_383 : i32 = x_381.leftIndex; + let x_385 : i32 = x_381.rightIndex; + if ((x_382 == x_362)) { + x_392_phi = x_362; + x_393_phi = true; + break; + } + let x_389 : f32 = x_GLF_color[select(3u, 3u, (3u <= 3u))]; + + continuing { + x_374_phi = select(x_383, x_385, !((x_362 <= x_382))); + } + } + x_392 = x_392_phi; + let x_393 : bool = x_393_phi; + x_358_phi = x_392; + if (x_393) { + break; + } + x_358_phi = -1; + } + } + var x_358 : i32; + var x_401 : i32; + var x_406 : i32; + var x_402_phi : i32; + var x_407_phi : i32; + x_358 = x_358_phi; + switch(x_362) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + x_402_phi = x_360; + if ((x_358 == bitcast(x_362))) { + x_401 = bitcast((x_360 + bitcast(1))); + x_402_phi = x_401; + } + x_402 = x_402_phi; + x_361_phi = x_402; + } + default: { + x_407_phi = x_360; + if ((x_358 == bitcast(-1))) { + x_406 = bitcast((x_360 + bitcast(1))); + x_407_phi = x_406; + } + x_407 = x_407_phi; + x_361_phi = x_407; + } + } + let x_361 : i32 = x_361_phi; + + continuing { + x_363 = (x_362 + 1); + x_357_phi = x_358; + x_360_phi = x_361; + x_362_phi = x_363; + } + } + if ((x_360 == bitcast(20))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm new file mode 100644 index 0000000000..c48df7563d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm @@ -0,0 +1,183 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %true = OpConstantTrue %bool + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_8 = OpConstant %int 8 + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %30 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %31 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %32 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %34 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %37 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %39 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %41 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %43 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %44 = OpConstantComposite %_arr_v4float_uint_8 %30 %31 %32 %34 %37 %39 %41 %43 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %49 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %50 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %51 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %52 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %53 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %54 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %55 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %56 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %57 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %58 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %59 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %60 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %61 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %62 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %63 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %64 = OpConstantComposite %_arr_v4float_uint_16 %49 %50 %51 %52 %53 %54 %55 %56 %49 %57 %58 %59 %60 %61 %62 %63 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %75 = OpConstantNull %int + %main = OpFunction %void None %8 + %76 = OpLabel + %77 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function + %78 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function + %79 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function + %80 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %81 = OpLoad %v4float %gl_FragCoord + %82 = OpVectorShuffle %v2float %81 %81 0 1 + %83 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %84 = OpLoad %v2float %83 + %85 = OpFDiv %v2float %82 %84 + %86 = OpVectorTimesScalar %v2float %85 %float_32 + %87 = OpExtInst %v2float %1 Floor %86 + OpBranch %88 + %88 = OpLabel + %89 = OpPhi %v4float %22 %76 %90 %91 + %92 = OpPhi %int %75 %76 %93 %91 + %94 = OpSLessThan %bool %92 %int_8 + OpLoopMerge %95 %91 Unroll + OpBranchConditional %94 %96 %95 + %96 = OpLabel + OpStore %77 %44 + %97 = OpAccessChain %_ptr_Function_v4float %77 %92 + %98 = OpLoad %v4float %97 + OpSelectionMerge %99 None + OpSwitch %uint_0 %100 + %100 = OpLabel + %101 = OpCompositeExtract %float %87 0 + %102 = OpCompositeExtract %float %98 0 + %103 = OpFOrdLessThan %bool %101 %102 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + OpBranch %99 + %104 = OpLabel + %106 = OpCompositeExtract %float %87 1 + %107 = OpCompositeExtract %float %98 1 + %108 = OpFOrdLessThan %bool %106 %107 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %109 + %110 = OpLabel + OpBranch %99 + %109 = OpLabel + %111 = OpCompositeExtract %float %98 2 + %112 = OpFAdd %float %102 %111 + %113 = OpFOrdGreaterThan %bool %101 %112 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %114 + %115 = OpLabel + OpBranch %99 + %114 = OpLabel + %116 = OpCompositeExtract %float %98 3 + %117 = OpFAdd %float %107 %116 + %118 = OpFOrdGreaterThan %bool %106 %117 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %119 + %120 = OpLabel + OpBranch %99 + %119 = OpLabel + OpBranch %99 + %99 = OpLabel + %121 = OpPhi %bool %false %105 %false %110 %false %115 %false %120 %true %119 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + OpStore %78 %44 + %124 = OpAccessChain %_ptr_Function_float %78 %92 %uint_0 + %125 = OpLoad %float %124 + %126 = OpConvertFToS %int %125 + OpStore %79 %44 + %127 = OpAccessChain %_ptr_Function_float %79 %92 %uint_1 + %128 = OpLoad %float %127 + %129 = OpConvertFToS %int %128 + %130 = OpIMul %int %126 %129 + %131 = OpIMul %int %92 %int_9 + %132 = OpIAdd %int %130 %131 + %133 = OpIAdd %int %132 %int_11 + %134 = OpSMod %int %133 %int_16 + OpStore %80 %64 + %135 = OpAccessChain %_ptr_Function_v4float %80 %134 + %136 = OpLoad %v4float %135 + OpBranch %122 + %122 = OpLabel + %90 = OpPhi %v4float %89 %99 %136 %123 + OpBranch %91 + %91 = OpLabel + %93 = OpIAdd %int %92 %int_1 + OpBranch %88 + %95 = OpLabel + OpStore %_GLF_color %89 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..0326a9c8d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.hlsl @@ -0,0 +1,103 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 x_77[8] = (float4[8])0; + float4 x_78[8] = (float4[8])0; + float4 x_79[8] = (float4[8])0; + float4 x_80[16] = (float4[16])0; + float4 x_89 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_89_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_92_phi = 0; + const float4 x_81 = gl_FragCoord; + const float2 x_84 = asfloat(x_6[0].xy); + const float2 x_87 = floor(((float2(x_81.x, x_81.y) / x_84) * 32.0f)); + x_89_phi = float4(0.5f, 0.5f, 1.0f, 1.0f); + x_92_phi = 0; + while (true) { + float4 x_136 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_93 = 0; + bool x_121_phi = false; + float4 x_90_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_89 = x_89_phi; + const int x_92 = x_92_phi; + if ((x_92 < 8)) { + } else { + break; + } + float4 x_98 = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float4 tint_symbol_5[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_77 = tint_symbol_5; + x_98 = x_77[x_92]; + switch(0u) { + default: { + const float x_101 = x_87.x; + const float x_102 = x_98.x; + if ((x_101 < x_102)) { + x_121_phi = false; + break; + } + const float x_106 = x_87.y; + const float x_107 = x_98.y; + if ((x_106 < x_107)) { + x_121_phi = false; + break; + } + if ((x_101 > (x_102 + x_98.z))) { + x_121_phi = false; + break; + } + if ((x_106 > (x_107 + x_98.w))) { + x_121_phi = false; + break; + } + x_121_phi = true; + break; + } + } + const bool x_121 = x_121_phi; + x_90_phi = x_89; + if (x_121) { + const float4 tint_symbol_6[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_78 = tint_symbol_6; + const float x_125 = x_78[x_92].x; + const float4 tint_symbol_7[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_79 = tint_symbol_7; + const float x_128 = x_79[x_92].y; + const float4 tint_symbol_8[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + x_80 = tint_symbol_8; + x_136 = x_80[((((int(x_125) * int(x_128)) + (x_92 * 9)) + 11) % 16)]; + x_90_phi = x_136; + } + const float4 x_90 = x_90_phi; + { + x_93 = (x_92 + 1); + x_89_phi = x_90; + x_92_phi = x_93; + } + } + x_GLF_color = x_89; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.msl new file mode 100644 index 0000000000..ecbf92fc29 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[8]; +}; +struct tint_array_wrapper_1 { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + tint_array_wrapper x_77 = {}; + tint_array_wrapper x_78 = {}; + tint_array_wrapper x_79 = {}; + tint_array_wrapper_1 x_80 = {}; + float4 x_89 = 0.0f; + float4 x_89_phi = 0.0f; + int x_92_phi = 0; + float4 const x_81 = *(tint_symbol_9); + float2 const x_84 = x_6.resolution; + float2 const x_87 = floor(((float2(x_81.x, x_81.y) / x_84) * 32.0f)); + x_89_phi = float4(0.5f, 0.5f, 1.0f, 1.0f); + x_92_phi = 0; + while (true) { + float4 x_136 = 0.0f; + int x_93 = 0; + bool x_121_phi = false; + float4 x_90_phi = 0.0f; + x_89 = x_89_phi; + int const x_92 = x_92_phi; + if ((x_92 < 8)) { + } else { + break; + } + float4 x_98 = 0.0f; + tint_array_wrapper const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_77 = tint_symbol_4; + x_98 = x_77.arr[x_92]; + switch(0u) { + default: { + float const x_101 = x_87.x; + float const x_102 = x_98.x; + if ((x_101 < x_102)) { + x_121_phi = false; + break; + } + float const x_106 = x_87.y; + float const x_107 = x_98.y; + if ((x_106 < x_107)) { + x_121_phi = false; + break; + } + if ((x_101 > (x_102 + x_98.z))) { + x_121_phi = false; + break; + } + if ((x_106 > (x_107 + x_98.w))) { + x_121_phi = false; + break; + } + x_121_phi = true; + break; + } + } + bool const x_121 = x_121_phi; + x_90_phi = x_89; + if (x_121) { + tint_array_wrapper const tint_symbol_5 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_78 = tint_symbol_5; + float const x_125 = x_78.arr[x_92].x; + tint_array_wrapper const tint_symbol_6 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_79 = tint_symbol_6; + float const x_128 = x_79.arr[x_92].y; + tint_array_wrapper_1 const tint_symbol_7 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + x_80 = tint_symbol_7; + x_136 = x_80.arr[((((int(x_125) * int(x_128)) + (x_92 * 9)) + 11) % 16)]; + x_90_phi = x_136; + } + float4 const x_90 = x_90_phi; + { + x_93 = (x_92 + 1); + x_89_phi = x_90; + x_92_phi = x_93; + } + } + *(tint_symbol_10) = x_89; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..770f48a068 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.spvasm @@ -0,0 +1,280 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 182 +; Schema: 0 + OpCapability Shader + %45 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_77 "x_77" + OpName %x_78 "x_78" + OpName %x_79 "x_79" + OpName %x_80 "x_80" + OpName %x_89 "x_89" + OpName %x_89_phi "x_89_phi" + OpName %x_92_phi "x_92_phi" + OpName %x_136 "x_136" + OpName %x_93 "x_93" + OpName %x_121_phi "x_121_phi" + OpName %x_90_phi "x_90_phi" + OpName %x_98 "x_98" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_8 ArrayStride 16 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %24 = OpConstantNull %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %31 = OpConstantNull %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %38 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %54 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %65 = OpConstantNull %bool + %int_8 = OpConstant %int 8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %77 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %78 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %79 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %81 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %84 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %86 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %88 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %90 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %91 = OpConstantComposite %_arr_v4float_uint_8 %77 %78 %79 %81 %84 %86 %88 %90 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %float_0 = OpConstant %float 0 + %135 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %136 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %137 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %138 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %139 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %140 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %141 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %142 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %143 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %144 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %145 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %146 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %147 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %148 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %149 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %150 = OpConstantComposite %_arr_v4float_uint_16 %135 %136 %137 %138 %139 %140 %141 %142 %135 %143 %144 %145 %146 %147 %148 %149 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %169 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_77 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %24 + %x_78 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %24 + %x_79 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %24 + %x_80 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %31 + %x_89 = OpVariable %_ptr_Function_v4float Function %5 + %x_89_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_92_phi = OpVariable %_ptr_Function_int Function %38 + %x_136 = OpVariable %_ptr_Function_v4float Function %5 + %x_93 = OpVariable %_ptr_Function_int Function %38 + %x_121_phi = OpVariable %_ptr_Function_bool Function %65 + %x_90_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_98 = OpVariable %_ptr_Function_v4float Function %5 + %39 = OpLoad %v4float %gl_FragCoord + %42 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %43 = OpLoad %v2float %42 + %46 = OpCompositeExtract %float %39 0 + %47 = OpCompositeExtract %float %39 1 + %48 = OpCompositeConstruct %v2float %46 %47 + %49 = OpFDiv %v2float %48 %43 + %51 = OpVectorTimesScalar %v2float %49 %float_32 + %44 = OpExtInst %v2float %45 Floor %51 + OpStore %x_89_phi %54 + OpStore %x_92_phi %int_0 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %67 = OpLoad %v4float %x_89_phi + OpStore %x_89 %67 + %68 = OpLoad %int %x_92_phi + %70 = OpSLessThan %bool %68 %int_8 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %57 + %71 = OpLabel + OpStore %x_77 %91 + %92 = OpAccessChain %_ptr_Function_v4float %x_77 %68 + %93 = OpLoad %v4float %92 + OpStore %x_98 %93 + OpSelectionMerge %94 None + OpSwitch %uint_0 %95 + %95 = OpLabel + %96 = OpCompositeExtract %float %44 0 + %98 = OpAccessChain %_ptr_Function_float %x_98 %uint_0 + %99 = OpLoad %float %98 + %100 = OpFOrdLessThan %bool %96 %99 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %x_121_phi %false + OpBranch %94 + %101 = OpLabel + %104 = OpCompositeExtract %float %44 1 + %106 = OpAccessChain %_ptr_Function_float %x_98 %uint_1 + %107 = OpLoad %float %106 + %108 = OpFOrdLessThan %bool %104 %107 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %109 + %110 = OpLabel + OpStore %x_121_phi %false + OpBranch %94 + %109 = OpLabel + %112 = OpAccessChain %_ptr_Function_float %x_98 %uint_2 + %113 = OpLoad %float %112 + %114 = OpFAdd %float %99 %113 + %115 = OpFOrdGreaterThan %bool %96 %114 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + OpStore %x_121_phi %false + OpBranch %94 + %116 = OpLabel + %119 = OpAccessChain %_ptr_Function_float %x_98 %uint_3 + %120 = OpLoad %float %119 + %121 = OpFAdd %float %107 %120 + %122 = OpFOrdGreaterThan %bool %104 %121 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %123 + %124 = OpLabel + OpStore %x_121_phi %false + OpBranch %94 + %123 = OpLabel + OpStore %x_121_phi %true + OpBranch %94 + %94 = OpLabel + %126 = OpLoad %bool %x_121_phi + %127 = OpLoad %v4float %x_89 + OpStore %x_90_phi %127 + OpSelectionMerge %128 None + OpBranchConditional %126 %129 %128 + %129 = OpLabel + OpStore %x_78 %91 + %130 = OpAccessChain %_ptr_Function_float %x_78 %68 %uint_0 + %131 = OpLoad %float %130 + OpStore %x_79 %91 + %132 = OpAccessChain %_ptr_Function_float %x_79 %68 %uint_1 + %133 = OpLoad %float %132 + OpStore %x_80 %150 + %151 = OpConvertFToS %int %131 + %152 = OpConvertFToS %int %133 + %153 = OpIMul %int %151 %152 + %155 = OpIMul %int %68 %int_9 + %156 = OpIAdd %int %153 %155 + %158 = OpIAdd %int %156 %int_11 + %160 = OpSMod %int %158 %int_16 + %161 = OpAccessChain %_ptr_Function_v4float %x_80 %160 + %162 = OpLoad %v4float %161 + OpStore %x_136 %162 + %163 = OpLoad %v4float %x_136 + OpStore %x_90_phi %163 + OpBranch %128 + %128 = OpLabel + %164 = OpLoad %v4float %x_90_phi + OpBranch %58 + %58 = OpLabel + %166 = OpIAdd %int %68 %int_1 + OpStore %x_93 %166 + OpStore %x_89_phi %164 + %167 = OpLoad %int %x_93 + OpStore %x_92_phi %167 + OpBranch %56 + %57 = OpLabel + %168 = OpLoad %v4float %x_89 + OpStore %x_GLF_color %168 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %169 +%tint_symbol_1 = OpFunctionParameter %main_out + %173 = OpLabel + %174 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %174 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %176 = OpLabel + %177 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %177 + %178 = OpFunctionCall %void %main_1 + %180 = OpLoad %v4float %x_GLF_color + %181 = OpCompositeConstruct %main_out %180 + %179 = OpFunctionCall %void %tint_symbol_3 %181 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..1742de06a3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.spvasm.expected.wgsl @@ -0,0 +1,97 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_77 : array, 8>; + var x_78 : array, 8>; + var x_79 : array, 8>; + var x_80 : array, 16>; + var x_89 : vec4; + var x_89_phi : vec4; + var x_92_phi : i32; + let x_81 : vec4 = gl_FragCoord; + let x_84 : vec2 = x_6.resolution; + let x_87 : vec2 = floor(((vec2(x_81.x, x_81.y) / x_84) * 32.0)); + x_89_phi = vec4(0.5, 0.5, 1.0, 1.0); + x_92_phi = 0; + loop { + var x_136 : vec4; + var x_93 : i32; + var x_121_phi : bool; + var x_90_phi : vec4; + x_89 = x_89_phi; + let x_92 : i32 = x_92_phi; + if ((x_92 < 8)) { + } else { + break; + } + var x_98 : vec4; + x_77 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + x_98 = x_77[x_92]; + switch(0u) { + default: { + let x_101 : f32 = x_87.x; + let x_102 : f32 = x_98.x; + if ((x_101 < x_102)) { + x_121_phi = false; + break; + } + let x_106 : f32 = x_87.y; + let x_107 : f32 = x_98.y; + if ((x_106 < x_107)) { + x_121_phi = false; + break; + } + if ((x_101 > (x_102 + x_98.z))) { + x_121_phi = false; + break; + } + if ((x_106 > (x_107 + x_98.w))) { + x_121_phi = false; + break; + } + x_121_phi = true; + } + } + let x_121 : bool = x_121_phi; + x_90_phi = x_89; + if (x_121) { + x_78 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_125 : f32 = x_78[x_92].x; + x_79 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_128 : f32 = x_79[x_92].y; + x_80 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + x_136 = x_80[((((i32(x_125) * i32(x_128)) + (x_92 * 9)) + 11) % 16)]; + x_90_phi = x_136; + } + let x_90 : vec4 = x_90_phi; + + continuing { + x_93 = (x_92 + 1); + x_89_phi = x_90; + x_92_phi = x_93; + } + } + x_GLF_color = x_89; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl new file mode 100644 index 0000000000..1742de06a3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl @@ -0,0 +1,97 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_77 : array, 8>; + var x_78 : array, 8>; + var x_79 : array, 8>; + var x_80 : array, 16>; + var x_89 : vec4; + var x_89_phi : vec4; + var x_92_phi : i32; + let x_81 : vec4 = gl_FragCoord; + let x_84 : vec2 = x_6.resolution; + let x_87 : vec2 = floor(((vec2(x_81.x, x_81.y) / x_84) * 32.0)); + x_89_phi = vec4(0.5, 0.5, 1.0, 1.0); + x_92_phi = 0; + loop { + var x_136 : vec4; + var x_93 : i32; + var x_121_phi : bool; + var x_90_phi : vec4; + x_89 = x_89_phi; + let x_92 : i32 = x_92_phi; + if ((x_92 < 8)) { + } else { + break; + } + var x_98 : vec4; + x_77 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + x_98 = x_77[x_92]; + switch(0u) { + default: { + let x_101 : f32 = x_87.x; + let x_102 : f32 = x_98.x; + if ((x_101 < x_102)) { + x_121_phi = false; + break; + } + let x_106 : f32 = x_87.y; + let x_107 : f32 = x_98.y; + if ((x_106 < x_107)) { + x_121_phi = false; + break; + } + if ((x_101 > (x_102 + x_98.z))) { + x_121_phi = false; + break; + } + if ((x_106 > (x_107 + x_98.w))) { + x_121_phi = false; + break; + } + x_121_phi = true; + } + } + let x_121 : bool = x_121_phi; + x_90_phi = x_89; + if (x_121) { + x_78 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_125 : f32 = x_78[x_92].x; + x_79 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_128 : f32 = x_79[x_92].y; + x_80 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + x_136 = x_80[((((i32(x_125) * i32(x_128)) + (x_92 * 9)) + 11) % 16)]; + x_90_phi = x_136; + } + let x_90 : vec4 = x_90_phi; + + continuing { + x_93 = (x_92 + 1); + x_89_phi = x_90; + x_92_phi = x_93; + } + } + x_GLF_color = x_89; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..0326a9c8d6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.hlsl @@ -0,0 +1,103 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 x_77[8] = (float4[8])0; + float4 x_78[8] = (float4[8])0; + float4 x_79[8] = (float4[8])0; + float4 x_80[16] = (float4[16])0; + float4 x_89 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_89_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_92_phi = 0; + const float4 x_81 = gl_FragCoord; + const float2 x_84 = asfloat(x_6[0].xy); + const float2 x_87 = floor(((float2(x_81.x, x_81.y) / x_84) * 32.0f)); + x_89_phi = float4(0.5f, 0.5f, 1.0f, 1.0f); + x_92_phi = 0; + while (true) { + float4 x_136 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_93 = 0; + bool x_121_phi = false; + float4 x_90_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_89 = x_89_phi; + const int x_92 = x_92_phi; + if ((x_92 < 8)) { + } else { + break; + } + float4 x_98 = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float4 tint_symbol_5[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_77 = tint_symbol_5; + x_98 = x_77[x_92]; + switch(0u) { + default: { + const float x_101 = x_87.x; + const float x_102 = x_98.x; + if ((x_101 < x_102)) { + x_121_phi = false; + break; + } + const float x_106 = x_87.y; + const float x_107 = x_98.y; + if ((x_106 < x_107)) { + x_121_phi = false; + break; + } + if ((x_101 > (x_102 + x_98.z))) { + x_121_phi = false; + break; + } + if ((x_106 > (x_107 + x_98.w))) { + x_121_phi = false; + break; + } + x_121_phi = true; + break; + } + } + const bool x_121 = x_121_phi; + x_90_phi = x_89; + if (x_121) { + const float4 tint_symbol_6[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_78 = tint_symbol_6; + const float x_125 = x_78[x_92].x; + const float4 tint_symbol_7[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_79 = tint_symbol_7; + const float x_128 = x_79[x_92].y; + const float4 tint_symbol_8[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + x_80 = tint_symbol_8; + x_136 = x_80[((((int(x_125) * int(x_128)) + (x_92 * 9)) + 11) % 16)]; + x_90_phi = x_136; + } + const float4 x_90 = x_90_phi; + { + x_93 = (x_92 + 1); + x_89_phi = x_90; + x_92_phi = x_93; + } + } + x_GLF_color = x_89; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.msl new file mode 100644 index 0000000000..ecbf92fc29 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[8]; +}; +struct tint_array_wrapper_1 { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + tint_array_wrapper x_77 = {}; + tint_array_wrapper x_78 = {}; + tint_array_wrapper x_79 = {}; + tint_array_wrapper_1 x_80 = {}; + float4 x_89 = 0.0f; + float4 x_89_phi = 0.0f; + int x_92_phi = 0; + float4 const x_81 = *(tint_symbol_9); + float2 const x_84 = x_6.resolution; + float2 const x_87 = floor(((float2(x_81.x, x_81.y) / x_84) * 32.0f)); + x_89_phi = float4(0.5f, 0.5f, 1.0f, 1.0f); + x_92_phi = 0; + while (true) { + float4 x_136 = 0.0f; + int x_93 = 0; + bool x_121_phi = false; + float4 x_90_phi = 0.0f; + x_89 = x_89_phi; + int const x_92 = x_92_phi; + if ((x_92 < 8)) { + } else { + break; + } + float4 x_98 = 0.0f; + tint_array_wrapper const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_77 = tint_symbol_4; + x_98 = x_77.arr[x_92]; + switch(0u) { + default: { + float const x_101 = x_87.x; + float const x_102 = x_98.x; + if ((x_101 < x_102)) { + x_121_phi = false; + break; + } + float const x_106 = x_87.y; + float const x_107 = x_98.y; + if ((x_106 < x_107)) { + x_121_phi = false; + break; + } + if ((x_101 > (x_102 + x_98.z))) { + x_121_phi = false; + break; + } + if ((x_106 > (x_107 + x_98.w))) { + x_121_phi = false; + break; + } + x_121_phi = true; + break; + } + } + bool const x_121 = x_121_phi; + x_90_phi = x_89; + if (x_121) { + tint_array_wrapper const tint_symbol_5 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_78 = tint_symbol_5; + float const x_125 = x_78.arr[x_92].x; + tint_array_wrapper const tint_symbol_6 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_79 = tint_symbol_6; + float const x_128 = x_79.arr[x_92].y; + tint_array_wrapper_1 const tint_symbol_7 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + x_80 = tint_symbol_7; + x_136 = x_80.arr[((((int(x_125) * int(x_128)) + (x_92 * 9)) + 11) % 16)]; + x_90_phi = x_136; + } + float4 const x_90 = x_90_phi; + { + x_93 = (x_92 + 1); + x_89_phi = x_90; + x_92_phi = x_93; + } + } + *(tint_symbol_10) = x_89; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..770f48a068 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.spvasm @@ -0,0 +1,280 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 182 +; Schema: 0 + OpCapability Shader + %45 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_77 "x_77" + OpName %x_78 "x_78" + OpName %x_79 "x_79" + OpName %x_80 "x_80" + OpName %x_89 "x_89" + OpName %x_89_phi "x_89_phi" + OpName %x_92_phi "x_92_phi" + OpName %x_136 "x_136" + OpName %x_93 "x_93" + OpName %x_121_phi "x_121_phi" + OpName %x_90_phi "x_90_phi" + OpName %x_98 "x_98" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_8 ArrayStride 16 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %24 = OpConstantNull %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %31 = OpConstantNull %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %38 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %54 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %65 = OpConstantNull %bool + %int_8 = OpConstant %int 8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %77 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %78 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %79 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %81 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %84 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %86 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %88 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %90 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %91 = OpConstantComposite %_arr_v4float_uint_8 %77 %78 %79 %81 %84 %86 %88 %90 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %float_0 = OpConstant %float 0 + %135 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %136 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %137 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %138 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %139 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %140 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %141 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %142 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %143 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %144 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %145 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %146 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %147 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %148 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %149 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %150 = OpConstantComposite %_arr_v4float_uint_16 %135 %136 %137 %138 %139 %140 %141 %142 %135 %143 %144 %145 %146 %147 %148 %149 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %169 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_77 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %24 + %x_78 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %24 + %x_79 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %24 + %x_80 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %31 + %x_89 = OpVariable %_ptr_Function_v4float Function %5 + %x_89_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_92_phi = OpVariable %_ptr_Function_int Function %38 + %x_136 = OpVariable %_ptr_Function_v4float Function %5 + %x_93 = OpVariable %_ptr_Function_int Function %38 + %x_121_phi = OpVariable %_ptr_Function_bool Function %65 + %x_90_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_98 = OpVariable %_ptr_Function_v4float Function %5 + %39 = OpLoad %v4float %gl_FragCoord + %42 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %43 = OpLoad %v2float %42 + %46 = OpCompositeExtract %float %39 0 + %47 = OpCompositeExtract %float %39 1 + %48 = OpCompositeConstruct %v2float %46 %47 + %49 = OpFDiv %v2float %48 %43 + %51 = OpVectorTimesScalar %v2float %49 %float_32 + %44 = OpExtInst %v2float %45 Floor %51 + OpStore %x_89_phi %54 + OpStore %x_92_phi %int_0 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %67 = OpLoad %v4float %x_89_phi + OpStore %x_89 %67 + %68 = OpLoad %int %x_92_phi + %70 = OpSLessThan %bool %68 %int_8 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %57 + %71 = OpLabel + OpStore %x_77 %91 + %92 = OpAccessChain %_ptr_Function_v4float %x_77 %68 + %93 = OpLoad %v4float %92 + OpStore %x_98 %93 + OpSelectionMerge %94 None + OpSwitch %uint_0 %95 + %95 = OpLabel + %96 = OpCompositeExtract %float %44 0 + %98 = OpAccessChain %_ptr_Function_float %x_98 %uint_0 + %99 = OpLoad %float %98 + %100 = OpFOrdLessThan %bool %96 %99 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %x_121_phi %false + OpBranch %94 + %101 = OpLabel + %104 = OpCompositeExtract %float %44 1 + %106 = OpAccessChain %_ptr_Function_float %x_98 %uint_1 + %107 = OpLoad %float %106 + %108 = OpFOrdLessThan %bool %104 %107 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %109 + %110 = OpLabel + OpStore %x_121_phi %false + OpBranch %94 + %109 = OpLabel + %112 = OpAccessChain %_ptr_Function_float %x_98 %uint_2 + %113 = OpLoad %float %112 + %114 = OpFAdd %float %99 %113 + %115 = OpFOrdGreaterThan %bool %96 %114 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + OpStore %x_121_phi %false + OpBranch %94 + %116 = OpLabel + %119 = OpAccessChain %_ptr_Function_float %x_98 %uint_3 + %120 = OpLoad %float %119 + %121 = OpFAdd %float %107 %120 + %122 = OpFOrdGreaterThan %bool %104 %121 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %123 + %124 = OpLabel + OpStore %x_121_phi %false + OpBranch %94 + %123 = OpLabel + OpStore %x_121_phi %true + OpBranch %94 + %94 = OpLabel + %126 = OpLoad %bool %x_121_phi + %127 = OpLoad %v4float %x_89 + OpStore %x_90_phi %127 + OpSelectionMerge %128 None + OpBranchConditional %126 %129 %128 + %129 = OpLabel + OpStore %x_78 %91 + %130 = OpAccessChain %_ptr_Function_float %x_78 %68 %uint_0 + %131 = OpLoad %float %130 + OpStore %x_79 %91 + %132 = OpAccessChain %_ptr_Function_float %x_79 %68 %uint_1 + %133 = OpLoad %float %132 + OpStore %x_80 %150 + %151 = OpConvertFToS %int %131 + %152 = OpConvertFToS %int %133 + %153 = OpIMul %int %151 %152 + %155 = OpIMul %int %68 %int_9 + %156 = OpIAdd %int %153 %155 + %158 = OpIAdd %int %156 %int_11 + %160 = OpSMod %int %158 %int_16 + %161 = OpAccessChain %_ptr_Function_v4float %x_80 %160 + %162 = OpLoad %v4float %161 + OpStore %x_136 %162 + %163 = OpLoad %v4float %x_136 + OpStore %x_90_phi %163 + OpBranch %128 + %128 = OpLabel + %164 = OpLoad %v4float %x_90_phi + OpBranch %58 + %58 = OpLabel + %166 = OpIAdd %int %68 %int_1 + OpStore %x_93 %166 + OpStore %x_89_phi %164 + %167 = OpLoad %int %x_93 + OpStore %x_92_phi %167 + OpBranch %56 + %57 = OpLabel + %168 = OpLoad %v4float %x_89 + OpStore %x_GLF_color %168 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %169 +%tint_symbol_1 = OpFunctionParameter %main_out + %173 = OpLabel + %174 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %174 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %176 = OpLabel + %177 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %177 + %178 = OpFunctionCall %void %main_1 + %180 = OpLoad %v4float %x_GLF_color + %181 = OpCompositeConstruct %main_out %180 + %179 = OpFunctionCall %void %tint_symbol_3 %181 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..1742de06a3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-null-in-phi-and-unroll/1.wgsl.expected.wgsl @@ -0,0 +1,97 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_77 : array, 8>; + var x_78 : array, 8>; + var x_79 : array, 8>; + var x_80 : array, 16>; + var x_89 : vec4; + var x_89_phi : vec4; + var x_92_phi : i32; + let x_81 : vec4 = gl_FragCoord; + let x_84 : vec2 = x_6.resolution; + let x_87 : vec2 = floor(((vec2(x_81.x, x_81.y) / x_84) * 32.0)); + x_89_phi = vec4(0.5, 0.5, 1.0, 1.0); + x_92_phi = 0; + loop { + var x_136 : vec4; + var x_93 : i32; + var x_121_phi : bool; + var x_90_phi : vec4; + x_89 = x_89_phi; + let x_92 : i32 = x_92_phi; + if ((x_92 < 8)) { + } else { + break; + } + var x_98 : vec4; + x_77 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + x_98 = x_77[x_92]; + switch(0u) { + default: { + let x_101 : f32 = x_87.x; + let x_102 : f32 = x_98.x; + if ((x_101 < x_102)) { + x_121_phi = false; + break; + } + let x_106 : f32 = x_87.y; + let x_107 : f32 = x_98.y; + if ((x_106 < x_107)) { + x_121_phi = false; + break; + } + if ((x_101 > (x_102 + x_98.z))) { + x_121_phi = false; + break; + } + if ((x_106 > (x_107 + x_98.w))) { + x_121_phi = false; + break; + } + x_121_phi = true; + } + } + let x_121 : bool = x_121_phi; + x_90_phi = x_89; + if (x_121) { + x_78 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_125 : f32 = x_78[x_92].x; + x_79 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_128 : f32 = x_79[x_92].y; + x_80 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + x_136 = x_80[((((i32(x_125) * i32(x_128)) + (x_92 * 9)) + 11) % 16)]; + x_90_phi = x_136; + } + let x_90 : vec4 = x_90_phi; + + continuing { + x_93 = (x_92 + 1); + x_89_phi = x_90; + x_92_phi = x_93; + } + } + x_GLF_color = x_89; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm new file mode 100644 index 0000000000..84be19f2fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm @@ -0,0 +1,111 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %indexable "indexable" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %uint = OpTypeInt 32 0 + %float_10 = OpConstant %float 10 + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1000 = OpConstant %int 1000 + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %33 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %36 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %37 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %38 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %39 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %40 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %41 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %42 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %46 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %47 = OpConstantComposite %_arr_v4float_uint_16 %31 %33 %34 %35 %36 %37 %38 %39 %31 %40 %41 %42 %43 %44 %45 %46 + %int_16 = OpConstant %int 16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0_0 = OpConstant %float 0 + %52 = OpConstantComposite %v4float %float_0_0 %float_0_0 %float_0_0 %float_0_0 + %53 = OpConstantComposite %_arr_v4float_uint_16 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 + %main = OpFunction %void None %9 + %54 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %55 = OpLoad %v4float %gl_FragCoord + %56 = OpVectorShuffle %v2float %55 %55 0 1 + %57 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %58 = OpLoad %v2float %57 + %59 = OpFDiv %v2float %56 %58 + %60 = OpCompositeExtract %float %59 0 + %61 = OpFMul %float %60 %float_10 + %62 = OpConvertFToS %int %61 + %63 = OpCompositeExtract %float %59 1 + %64 = OpFMul %float %63 %float_10 + %65 = OpConvertFToS %int %64 + %66 = OpIMul %int %65 %int_10 + %67 = OpIAdd %int %62 %66 + OpBranch %68 + %68 = OpLabel + %69 = OpPhi %int %int_100 %54 %70 %71 + %72 = OpPhi %int %int_0 %54 %73 %71 + %74 = OpSLessThan %bool %72 %67 + OpLoopMerge %75 %71 None + OpBranchConditional %74 %71 %75 + %71 = OpLabel + %76 = OpIMul %int %int_4 %69 + %77 = OpISub %int %int_1000 %69 + %78 = OpIMul %int %76 %77 + %70 = OpSDiv %int %78 %int_1000 + %73 = OpIAdd %int %72 %int_1 + OpBranch %68 + %75 = OpLabel + %79 = OpSMod %int %69 %int_16 + OpStore %indexable %47 + %80 = OpLoad %_arr_v4float_uint_16 %indexable + OpStore %indexable %53 + OpStore %indexable %80 + %81 = OpVectorShuffle %v2float %41 %37 1 4 + %82 = OpAccessChain %_ptr_Function_v4float %indexable %79 + %83 = OpLoad %v4float %82 + OpStore %_GLF_color %83 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..99984150c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.hlsl @@ -0,0 +1,63 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int x_69 = 0; + int x_69_phi = 0; + int x_72_phi = 0; + const float4 x_55 = gl_FragCoord; + const float2 x_58 = asfloat(x_6[0].xy); + const float2 x_59 = (float2(x_55.x, x_55.y) / x_58); + const int x_67 = (int((x_59.x * 10.0f)) + (int((x_59.y * 10.0f)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + while (true) { + int x_70 = 0; + int x_73 = 0; + x_69 = x_69_phi; + const int x_72 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + { + x_70 = (((4 * asint(x_69)) * (1000 - asint(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_80[16] = indexable; + const float4 tint_symbol_6[16] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + indexable = tint_symbol_6; + indexable = x_80; + const float2 x_81 = float2(float4(0.0f, 1.0f, 0.0f, 1.0f).y, float4(0.5f, 0.0f, 0.5f, 1.0f).x); + const float4 x_83 = indexable[asint((x_69 % 16))]; + x_GLF_color = x_83; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.msl new file mode 100644 index 0000000000..d75eca0ec1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.msl @@ -0,0 +1,65 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + tint_array_wrapper indexable = {}; + int x_69 = 0; + int x_69_phi = 0; + int x_72_phi = 0; + float4 const x_55 = *(tint_symbol_7); + float2 const x_58 = x_6.resolution; + float2 const x_59 = (float2(x_55.x, x_55.y) / x_58); + int const x_67 = (int((x_59.x * 10.0f)) + (int((x_59.y * 10.0f)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + while (true) { + int x_70 = 0; + int x_73 = 0; + x_69 = x_69_phi; + int const x_72 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + { + x_70 = (((4 * as_type(x_69)) * (1000 - as_type(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + tint_array_wrapper const x_80 = indexable; + tint_array_wrapper const tint_symbol_5 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + indexable = tint_symbol_5; + indexable = x_80; + float2 const x_81 = float2(float4(0.0f, 1.0f, 0.0f, 1.0f).y, float4(0.5f, 0.0f, 0.5f, 1.0f).x); + float4 const x_83 = indexable.arr[as_type((x_69 % 16))]; + *(tint_symbol_8) = x_83; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_6 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..7dfa9c84ed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.spvasm @@ -0,0 +1,188 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 124 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_69 "x_69" + OpName %x_69_phi "x_69_phi" + OpName %x_72_phi "x_72_phi" + OpName %x_70 "x_70" + OpName %x_73 "x_73" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_10 = OpConstant %float 10 + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1000 = OpConstant %int 1000 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %81 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %83 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %84 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %85 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %86 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %87 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %88 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %89 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %90 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %91 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %92 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %93 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %94 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %95 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %96 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %97 = OpConstantComposite %_arr_v4float_uint_16 %81 %83 %84 %85 %86 %87 %88 %89 %81 %90 %91 %92 %93 %94 %95 %96 + %99 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %100 = OpConstantComposite %_arr_v4float_uint_16 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %111 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_69 = OpVariable %_ptr_Function_int Function %28 + %x_69_phi = OpVariable %_ptr_Function_int Function %28 + %x_72_phi = OpVariable %_ptr_Function_int Function %28 + %x_70 = OpVariable %_ptr_Function_int Function %28 + %x_73 = OpVariable %_ptr_Function_int Function %28 + %31 = OpLoad %v4float %gl_FragCoord + %34 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %35 = OpLoad %v2float %34 + %36 = OpCompositeExtract %float %31 0 + %37 = OpCompositeExtract %float %31 1 + %38 = OpCompositeConstruct %v2float %36 %37 + %39 = OpFDiv %v2float %38 %35 + %41 = OpCompositeExtract %float %39 0 + %43 = OpFMul %float %41 %float_10 + %40 = OpConvertFToS %int %43 + %45 = OpCompositeExtract %float %39 1 + %46 = OpFMul %float %45 %float_10 + %44 = OpConvertFToS %int %46 + %48 = OpIMul %int %44 %int_10 + %49 = OpIAdd %int %40 %48 + OpStore %x_69_phi %int_100 + OpStore %x_72_phi %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %58 = OpLoad %int %x_69_phi + OpStore %x_69 %58 + %59 = OpLoad %int %x_72_phi + %60 = OpSLessThan %bool %59 %49 + OpSelectionMerge %62 None + OpBranchConditional %60 %63 %64 + %63 = OpLabel + OpBranch %62 + %64 = OpLabel + OpBranch %53 + %62 = OpLabel + OpBranch %54 + %54 = OpLabel + %67 = OpLoad %int %x_69 + %66 = OpCopyObject %int %67 + %68 = OpIMul %int %int_4 %66 + %71 = OpLoad %int %x_69 + %70 = OpCopyObject %int %71 + %72 = OpISub %int %int_1000 %70 + %73 = OpIMul %int %68 %72 + %74 = OpSDiv %int %73 %int_1000 + OpStore %x_70 %74 + %76 = OpIAdd %int %59 %int_1 + OpStore %x_73 %76 + %77 = OpLoad %int %x_70 + OpStore %x_69_phi %77 + %78 = OpLoad %int %x_73 + OpStore %x_72_phi %78 + OpBranch %52 + %53 = OpLabel + OpStore %indexable %97 + %98 = OpLoad %_arr_v4float_uint_16 %indexable + OpStore %indexable %100 + OpStore %indexable %98 + %101 = OpCompositeExtract %float %91 1 + %102 = OpCompositeExtract %float %87 0 + %103 = OpCompositeConstruct %v2float %101 %102 + %105 = OpLoad %int %x_69 + %107 = OpSMod %int %105 %int_16 + %104 = OpCopyObject %int %107 + %109 = OpAccessChain %_ptr_Function_v4float %indexable %104 + %110 = OpLoad %v4float %109 + OpStore %x_GLF_color %110 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %111 +%tint_symbol_1 = OpFunctionParameter %main_out + %115 = OpLabel + %116 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %116 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %118 = OpLabel + %119 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %119 + %120 = OpFunctionCall %void %main_1 + %122 = OpLoad %v4float %x_GLF_color + %123 = OpCompositeConstruct %main_out %122 + %121 = OpFunctionCall %void %tint_symbol_3 %123 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..e7aeb6de4f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.spvasm.expected.wgsl @@ -0,0 +1,60 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_69 : i32; + var x_69_phi : i32; + var x_72_phi : i32; + let x_55 : vec4 = gl_FragCoord; + let x_58 : vec2 = x_6.resolution; + let x_59 : vec2 = (vec2(x_55.x, x_55.y) / x_58); + let x_67 : i32 = (i32((x_59.x * 10.0)) + (i32((x_59.y * 10.0)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + loop { + var x_70 : i32; + var x_73 : i32; + x_69 = x_69_phi; + let x_72 : i32 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + + continuing { + x_70 = (((4 * bitcast(x_69)) * (1000 - bitcast(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_80 : array, 16> = indexable; + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + indexable = x_80; + let x_81 : vec2 = vec2(vec4(0.0, 1.0, 0.0, 1.0).y, vec4(0.5, 0.0, 0.5, 1.0).x); + let x_83 : vec4 = indexable[bitcast((x_69 % 16))]; + x_GLF_color = x_83; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl new file mode 100644 index 0000000000..e7aeb6de4f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl @@ -0,0 +1,60 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_69 : i32; + var x_69_phi : i32; + var x_72_phi : i32; + let x_55 : vec4 = gl_FragCoord; + let x_58 : vec2 = x_6.resolution; + let x_59 : vec2 = (vec2(x_55.x, x_55.y) / x_58); + let x_67 : i32 = (i32((x_59.x * 10.0)) + (i32((x_59.y * 10.0)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + loop { + var x_70 : i32; + var x_73 : i32; + x_69 = x_69_phi; + let x_72 : i32 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + + continuing { + x_70 = (((4 * bitcast(x_69)) * (1000 - bitcast(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_80 : array, 16> = indexable; + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + indexable = x_80; + let x_81 : vec2 = vec2(vec4(0.0, 1.0, 0.0, 1.0).y, vec4(0.5, 0.0, 0.5, 1.0).x); + let x_83 : vec4 = indexable[bitcast((x_69 % 16))]; + x_GLF_color = x_83; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..99984150c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.hlsl @@ -0,0 +1,63 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int x_69 = 0; + int x_69_phi = 0; + int x_72_phi = 0; + const float4 x_55 = gl_FragCoord; + const float2 x_58 = asfloat(x_6[0].xy); + const float2 x_59 = (float2(x_55.x, x_55.y) / x_58); + const int x_67 = (int((x_59.x * 10.0f)) + (int((x_59.y * 10.0f)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + while (true) { + int x_70 = 0; + int x_73 = 0; + x_69 = x_69_phi; + const int x_72 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + { + x_70 = (((4 * asint(x_69)) * (1000 - asint(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_80[16] = indexable; + const float4 tint_symbol_6[16] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + indexable = tint_symbol_6; + indexable = x_80; + const float2 x_81 = float2(float4(0.0f, 1.0f, 0.0f, 1.0f).y, float4(0.5f, 0.0f, 0.5f, 1.0f).x); + const float4 x_83 = indexable[asint((x_69 % 16))]; + x_GLF_color = x_83; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.msl new file mode 100644 index 0000000000..d75eca0ec1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.msl @@ -0,0 +1,65 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + tint_array_wrapper indexable = {}; + int x_69 = 0; + int x_69_phi = 0; + int x_72_phi = 0; + float4 const x_55 = *(tint_symbol_7); + float2 const x_58 = x_6.resolution; + float2 const x_59 = (float2(x_55.x, x_55.y) / x_58); + int const x_67 = (int((x_59.x * 10.0f)) + (int((x_59.y * 10.0f)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + while (true) { + int x_70 = 0; + int x_73 = 0; + x_69 = x_69_phi; + int const x_72 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + { + x_70 = (((4 * as_type(x_69)) * (1000 - as_type(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + tint_array_wrapper const x_80 = indexable; + tint_array_wrapper const tint_symbol_5 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + indexable = tint_symbol_5; + indexable = x_80; + float2 const x_81 = float2(float4(0.0f, 1.0f, 0.0f, 1.0f).y, float4(0.5f, 0.0f, 0.5f, 1.0f).x); + float4 const x_83 = indexable.arr[as_type((x_69 % 16))]; + *(tint_symbol_8) = x_83; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_6 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..7dfa9c84ed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.spvasm @@ -0,0 +1,188 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 124 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_69 "x_69" + OpName %x_69_phi "x_69_phi" + OpName %x_72_phi "x_72_phi" + OpName %x_70 "x_70" + OpName %x_73 "x_73" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_10 = OpConstant %float 10 + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1000 = OpConstant %int 1000 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %81 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %83 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %84 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %85 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %86 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %87 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %88 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %89 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %90 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %91 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %92 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %93 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %94 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %95 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %96 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %97 = OpConstantComposite %_arr_v4float_uint_16 %81 %83 %84 %85 %86 %87 %88 %89 %81 %90 %91 %92 %93 %94 %95 %96 + %99 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %100 = OpConstantComposite %_arr_v4float_uint_16 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 %99 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %111 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_69 = OpVariable %_ptr_Function_int Function %28 + %x_69_phi = OpVariable %_ptr_Function_int Function %28 + %x_72_phi = OpVariable %_ptr_Function_int Function %28 + %x_70 = OpVariable %_ptr_Function_int Function %28 + %x_73 = OpVariable %_ptr_Function_int Function %28 + %31 = OpLoad %v4float %gl_FragCoord + %34 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %35 = OpLoad %v2float %34 + %36 = OpCompositeExtract %float %31 0 + %37 = OpCompositeExtract %float %31 1 + %38 = OpCompositeConstruct %v2float %36 %37 + %39 = OpFDiv %v2float %38 %35 + %41 = OpCompositeExtract %float %39 0 + %43 = OpFMul %float %41 %float_10 + %40 = OpConvertFToS %int %43 + %45 = OpCompositeExtract %float %39 1 + %46 = OpFMul %float %45 %float_10 + %44 = OpConvertFToS %int %46 + %48 = OpIMul %int %44 %int_10 + %49 = OpIAdd %int %40 %48 + OpStore %x_69_phi %int_100 + OpStore %x_72_phi %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %58 = OpLoad %int %x_69_phi + OpStore %x_69 %58 + %59 = OpLoad %int %x_72_phi + %60 = OpSLessThan %bool %59 %49 + OpSelectionMerge %62 None + OpBranchConditional %60 %63 %64 + %63 = OpLabel + OpBranch %62 + %64 = OpLabel + OpBranch %53 + %62 = OpLabel + OpBranch %54 + %54 = OpLabel + %67 = OpLoad %int %x_69 + %66 = OpCopyObject %int %67 + %68 = OpIMul %int %int_4 %66 + %71 = OpLoad %int %x_69 + %70 = OpCopyObject %int %71 + %72 = OpISub %int %int_1000 %70 + %73 = OpIMul %int %68 %72 + %74 = OpSDiv %int %73 %int_1000 + OpStore %x_70 %74 + %76 = OpIAdd %int %59 %int_1 + OpStore %x_73 %76 + %77 = OpLoad %int %x_70 + OpStore %x_69_phi %77 + %78 = OpLoad %int %x_73 + OpStore %x_72_phi %78 + OpBranch %52 + %53 = OpLabel + OpStore %indexable %97 + %98 = OpLoad %_arr_v4float_uint_16 %indexable + OpStore %indexable %100 + OpStore %indexable %98 + %101 = OpCompositeExtract %float %91 1 + %102 = OpCompositeExtract %float %87 0 + %103 = OpCompositeConstruct %v2float %101 %102 + %105 = OpLoad %int %x_69 + %107 = OpSMod %int %105 %int_16 + %104 = OpCopyObject %int %107 + %109 = OpAccessChain %_ptr_Function_v4float %indexable %104 + %110 = OpLoad %v4float %109 + OpStore %x_GLF_color %110 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %111 +%tint_symbol_1 = OpFunctionParameter %main_out + %115 = OpLabel + %116 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %116 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %118 = OpLabel + %119 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %119 + %120 = OpFunctionCall %void %main_1 + %122 = OpLoad %v4float %x_GLF_color + %123 = OpCompositeConstruct %main_out %122 + %121 = OpFunctionCall %void %tint_symbol_3 %123 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..e7aeb6de4f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/1.wgsl.expected.wgsl @@ -0,0 +1,60 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_69 : i32; + var x_69_phi : i32; + var x_72_phi : i32; + let x_55 : vec4 = gl_FragCoord; + let x_58 : vec2 = x_6.resolution; + let x_59 : vec2 = (vec2(x_55.x, x_55.y) / x_58); + let x_67 : i32 = (i32((x_59.x * 10.0)) + (i32((x_59.y * 10.0)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + loop { + var x_70 : i32; + var x_73 : i32; + x_69 = x_69_phi; + let x_72 : i32 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + + continuing { + x_70 = (((4 * bitcast(x_69)) * (1000 - bitcast(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_80 : array, 16> = indexable; + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + indexable = x_80; + let x_81 : vec2 = vec2(vec4(0.0, 1.0, 0.0, 1.0).y, vec4(0.5, 0.0, 0.5, 1.0).x); + let x_83 : vec4 = indexable[bitcast((x_69 % 16))]; + x_GLF_color = x_83; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm new file mode 100644 index 0000000000..ee9d9646f8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm @@ -0,0 +1,108 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %indexable "indexable" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %uint = OpTypeInt 32 0 + %float_10 = OpConstant %float 10 + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1000 = OpConstant %int 1000 + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %33 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %36 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %37 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %38 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %39 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %40 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %41 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %42 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %46 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %47 = OpConstantComposite %_arr_v4float_uint_16 %31 %33 %34 %35 %36 %37 %38 %39 %31 %40 %41 %42 %43 %44 %45 %46 + %int_16 = OpConstant %int 16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0_0 = OpConstant %float 0 + %52 = OpConstantComposite %v4float %float_0_0 %float_0_0 %float_0_0 %float_0_0 + %53 = OpConstantComposite %_arr_v4float_uint_16 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 %52 + %main = OpFunction %void None %9 + %54 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %55 = OpLoad %v4float %gl_FragCoord + %56 = OpVectorShuffle %v2float %55 %55 0 1 + %57 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %58 = OpLoad %v2float %57 + %59 = OpFDiv %v2float %56 %58 + %60 = OpCompositeExtract %float %59 0 + %61 = OpFMul %float %60 %float_10 + %62 = OpConvertFToS %int %61 + %63 = OpCompositeExtract %float %59 1 + %64 = OpFMul %float %63 %float_10 + %65 = OpConvertFToS %int %64 + %66 = OpIMul %int %65 %int_10 + %67 = OpIAdd %int %62 %66 + OpBranch %68 + %68 = OpLabel + %69 = OpPhi %int %int_100 %54 %70 %71 + %72 = OpPhi %int %int_0 %54 %73 %71 + %74 = OpSLessThan %bool %72 %67 + OpLoopMerge %75 %71 None + OpBranchConditional %74 %71 %75 + %71 = OpLabel + %76 = OpIMul %int %int_4 %69 + %77 = OpISub %int %int_1000 %69 + %78 = OpIMul %int %76 %77 + %70 = OpSDiv %int %78 %int_1000 + %73 = OpIAdd %int %72 %int_1 + OpBranch %68 + %75 = OpLabel + %79 = OpSMod %int %69 %int_16 + OpStore %indexable %47 + %80 = OpVectorShuffle %v2float %41 %37 1 4 + %81 = OpAccessChain %_ptr_Function_v4float %indexable %79 + %82 = OpLoad %v4float %81 + OpStore %_GLF_color %82 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.hlsl new file mode 100644 index 0000000000..ac6e8e006d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.hlsl @@ -0,0 +1,59 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int x_69 = 0; + int x_69_phi = 0; + int x_72_phi = 0; + const float4 x_55 = gl_FragCoord; + const float2 x_58 = asfloat(x_6[0].xy); + const float2 x_59 = (float2(x_55.x, x_55.y) / x_58); + const int x_67 = (int((x_59.x * 10.0f)) + (int((x_59.y * 10.0f)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + while (true) { + int x_70 = 0; + int x_73 = 0; + x_69 = x_69_phi; + const int x_72 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + { + x_70 = (((4 * asint(x_69)) * (1000 - asint(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float2 x_80 = float2(float4(0.0f, 1.0f, 0.0f, 1.0f).y, float4(0.5f, 0.0f, 0.5f, 1.0f).x); + const float4 x_82 = indexable[asint((x_69 % 16))]; + x_GLF_color = x_82; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.msl new file mode 100644 index 0000000000..f126328cb8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int x_69 = 0; + int x_69_phi = 0; + int x_72_phi = 0; + float4 const x_55 = *(tint_symbol_6); + float2 const x_58 = x_6.resolution; + float2 const x_59 = (float2(x_55.x, x_55.y) / x_58); + int const x_67 = (int((x_59.x * 10.0f)) + (int((x_59.y * 10.0f)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + while (true) { + int x_70 = 0; + int x_73 = 0; + x_69 = x_69_phi; + int const x_72 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + { + x_70 = (((4 * as_type(x_69)) * (1000 - as_type(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float2 const x_80 = float2(float4(0.0f, 1.0f, 0.0f, 1.0f).y, float4(0.5f, 0.0f, 0.5f, 1.0f).x); + float4 const x_82 = indexable.arr[as_type((x_69 % 16))]; + *(tint_symbol_7) = x_82; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.spvasm new file mode 100644 index 0000000000..6899c0390f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.spvasm @@ -0,0 +1,183 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 121 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_69 "x_69" + OpName %x_69_phi "x_69_phi" + OpName %x_72_phi "x_72_phi" + OpName %x_70 "x_70" + OpName %x_73 "x_73" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_10 = OpConstant %float 10 + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1000 = OpConstant %int 1000 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %81 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %83 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %84 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %85 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %86 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %87 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %88 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %89 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %90 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %91 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %92 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %93 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %94 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %95 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %96 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %97 = OpConstantComposite %_arr_v4float_uint_16 %81 %83 %84 %85 %86 %87 %88 %89 %81 %90 %91 %92 %93 %94 %95 %96 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %108 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_69 = OpVariable %_ptr_Function_int Function %28 + %x_69_phi = OpVariable %_ptr_Function_int Function %28 + %x_72_phi = OpVariable %_ptr_Function_int Function %28 + %x_70 = OpVariable %_ptr_Function_int Function %28 + %x_73 = OpVariable %_ptr_Function_int Function %28 + %31 = OpLoad %v4float %gl_FragCoord + %34 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %35 = OpLoad %v2float %34 + %36 = OpCompositeExtract %float %31 0 + %37 = OpCompositeExtract %float %31 1 + %38 = OpCompositeConstruct %v2float %36 %37 + %39 = OpFDiv %v2float %38 %35 + %41 = OpCompositeExtract %float %39 0 + %43 = OpFMul %float %41 %float_10 + %40 = OpConvertFToS %int %43 + %45 = OpCompositeExtract %float %39 1 + %46 = OpFMul %float %45 %float_10 + %44 = OpConvertFToS %int %46 + %48 = OpIMul %int %44 %int_10 + %49 = OpIAdd %int %40 %48 + OpStore %x_69_phi %int_100 + OpStore %x_72_phi %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %58 = OpLoad %int %x_69_phi + OpStore %x_69 %58 + %59 = OpLoad %int %x_72_phi + %60 = OpSLessThan %bool %59 %49 + OpSelectionMerge %62 None + OpBranchConditional %60 %63 %64 + %63 = OpLabel + OpBranch %62 + %64 = OpLabel + OpBranch %53 + %62 = OpLabel + OpBranch %54 + %54 = OpLabel + %67 = OpLoad %int %x_69 + %66 = OpCopyObject %int %67 + %68 = OpIMul %int %int_4 %66 + %71 = OpLoad %int %x_69 + %70 = OpCopyObject %int %71 + %72 = OpISub %int %int_1000 %70 + %73 = OpIMul %int %68 %72 + %74 = OpSDiv %int %73 %int_1000 + OpStore %x_70 %74 + %76 = OpIAdd %int %59 %int_1 + OpStore %x_73 %76 + %77 = OpLoad %int %x_70 + OpStore %x_69_phi %77 + %78 = OpLoad %int %x_73 + OpStore %x_72_phi %78 + OpBranch %52 + %53 = OpLabel + OpStore %indexable %97 + %98 = OpCompositeExtract %float %91 1 + %99 = OpCompositeExtract %float %87 0 + %100 = OpCompositeConstruct %v2float %98 %99 + %102 = OpLoad %int %x_69 + %104 = OpSMod %int %102 %int_16 + %101 = OpCopyObject %int %104 + %106 = OpAccessChain %_ptr_Function_v4float %indexable %101 + %107 = OpLoad %v4float %106 + OpStore %x_GLF_color %107 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %108 +%tint_symbol_1 = OpFunctionParameter %main_out + %112 = OpLabel + %113 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %113 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %115 = OpLabel + %116 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %116 + %117 = OpFunctionCall %void %main_1 + %119 = OpLoad %v4float %x_GLF_color + %120 = OpCompositeConstruct %main_out %119 + %118 = OpFunctionCall %void %tint_symbol_3 %120 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.wgsl new file mode 100644 index 0000000000..088e3cdfd6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.spvasm.expected.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_69 : i32; + var x_69_phi : i32; + var x_72_phi : i32; + let x_55 : vec4 = gl_FragCoord; + let x_58 : vec2 = x_6.resolution; + let x_59 : vec2 = (vec2(x_55.x, x_55.y) / x_58); + let x_67 : i32 = (i32((x_59.x * 10.0)) + (i32((x_59.y * 10.0)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + loop { + var x_70 : i32; + var x_73 : i32; + x_69 = x_69_phi; + let x_72 : i32 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + + continuing { + x_70 = (((4 * bitcast(x_69)) * (1000 - bitcast(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_80 : vec2 = vec2(vec4(0.0, 1.0, 0.0, 1.0).y, vec4(0.5, 0.0, 0.5, 1.0).x); + let x_82 : vec4 = indexable[bitcast((x_69 % 16))]; + x_GLF_color = x_82; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl new file mode 100644 index 0000000000..088e3cdfd6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_69 : i32; + var x_69_phi : i32; + var x_72_phi : i32; + let x_55 : vec4 = gl_FragCoord; + let x_58 : vec2 = x_6.resolution; + let x_59 : vec2 = (vec2(x_55.x, x_55.y) / x_58); + let x_67 : i32 = (i32((x_59.x * 10.0)) + (i32((x_59.y * 10.0)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + loop { + var x_70 : i32; + var x_73 : i32; + x_69 = x_69_phi; + let x_72 : i32 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + + continuing { + x_70 = (((4 * bitcast(x_69)) * (1000 - bitcast(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_80 : vec2 = vec2(vec4(0.0, 1.0, 0.0, 1.0).y, vec4(0.5, 0.0, 0.5, 1.0).x); + let x_82 : vec4 = indexable[bitcast((x_69 % 16))]; + x_GLF_color = x_82; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.hlsl new file mode 100644 index 0000000000..ac6e8e006d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.hlsl @@ -0,0 +1,59 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int x_69 = 0; + int x_69_phi = 0; + int x_72_phi = 0; + const float4 x_55 = gl_FragCoord; + const float2 x_58 = asfloat(x_6[0].xy); + const float2 x_59 = (float2(x_55.x, x_55.y) / x_58); + const int x_67 = (int((x_59.x * 10.0f)) + (int((x_59.y * 10.0f)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + while (true) { + int x_70 = 0; + int x_73 = 0; + x_69 = x_69_phi; + const int x_72 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + { + x_70 = (((4 * asint(x_69)) * (1000 - asint(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float2 x_80 = float2(float4(0.0f, 1.0f, 0.0f, 1.0f).y, float4(0.5f, 0.0f, 0.5f, 1.0f).x); + const float4 x_82 = indexable[asint((x_69 % 16))]; + x_GLF_color = x_82; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.msl new file mode 100644 index 0000000000..f126328cb8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int x_69 = 0; + int x_69_phi = 0; + int x_72_phi = 0; + float4 const x_55 = *(tint_symbol_6); + float2 const x_58 = x_6.resolution; + float2 const x_59 = (float2(x_55.x, x_55.y) / x_58); + int const x_67 = (int((x_59.x * 10.0f)) + (int((x_59.y * 10.0f)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + while (true) { + int x_70 = 0; + int x_73 = 0; + x_69 = x_69_phi; + int const x_72 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + { + x_70 = (((4 * as_type(x_69)) * (1000 - as_type(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float2 const x_80 = float2(float4(0.0f, 1.0f, 0.0f, 1.0f).y, float4(0.5f, 0.0f, 0.5f, 1.0f).x); + float4 const x_82 = indexable.arr[as_type((x_69 % 16))]; + *(tint_symbol_7) = x_82; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.spvasm new file mode 100644 index 0000000000..6899c0390f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.spvasm @@ -0,0 +1,183 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 121 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_69 "x_69" + OpName %x_69_phi "x_69_phi" + OpName %x_72_phi "x_72_phi" + OpName %x_70 "x_70" + OpName %x_73 "x_73" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_10 = OpConstant %float 10 + %int_10 = OpConstant %int 10 + %int_100 = OpConstant %int 100 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1000 = OpConstant %int 1000 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %81 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %83 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %84 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %85 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %86 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %87 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %88 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %89 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %90 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %91 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %92 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %93 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %94 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %95 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %96 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %97 = OpConstantComposite %_arr_v4float_uint_16 %81 %83 %84 %85 %86 %87 %88 %89 %81 %90 %91 %92 %93 %94 %95 %96 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %108 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_69 = OpVariable %_ptr_Function_int Function %28 + %x_69_phi = OpVariable %_ptr_Function_int Function %28 + %x_72_phi = OpVariable %_ptr_Function_int Function %28 + %x_70 = OpVariable %_ptr_Function_int Function %28 + %x_73 = OpVariable %_ptr_Function_int Function %28 + %31 = OpLoad %v4float %gl_FragCoord + %34 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %35 = OpLoad %v2float %34 + %36 = OpCompositeExtract %float %31 0 + %37 = OpCompositeExtract %float %31 1 + %38 = OpCompositeConstruct %v2float %36 %37 + %39 = OpFDiv %v2float %38 %35 + %41 = OpCompositeExtract %float %39 0 + %43 = OpFMul %float %41 %float_10 + %40 = OpConvertFToS %int %43 + %45 = OpCompositeExtract %float %39 1 + %46 = OpFMul %float %45 %float_10 + %44 = OpConvertFToS %int %46 + %48 = OpIMul %int %44 %int_10 + %49 = OpIAdd %int %40 %48 + OpStore %x_69_phi %int_100 + OpStore %x_72_phi %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %58 = OpLoad %int %x_69_phi + OpStore %x_69 %58 + %59 = OpLoad %int %x_72_phi + %60 = OpSLessThan %bool %59 %49 + OpSelectionMerge %62 None + OpBranchConditional %60 %63 %64 + %63 = OpLabel + OpBranch %62 + %64 = OpLabel + OpBranch %53 + %62 = OpLabel + OpBranch %54 + %54 = OpLabel + %67 = OpLoad %int %x_69 + %66 = OpCopyObject %int %67 + %68 = OpIMul %int %int_4 %66 + %71 = OpLoad %int %x_69 + %70 = OpCopyObject %int %71 + %72 = OpISub %int %int_1000 %70 + %73 = OpIMul %int %68 %72 + %74 = OpSDiv %int %73 %int_1000 + OpStore %x_70 %74 + %76 = OpIAdd %int %59 %int_1 + OpStore %x_73 %76 + %77 = OpLoad %int %x_70 + OpStore %x_69_phi %77 + %78 = OpLoad %int %x_73 + OpStore %x_72_phi %78 + OpBranch %52 + %53 = OpLabel + OpStore %indexable %97 + %98 = OpCompositeExtract %float %91 1 + %99 = OpCompositeExtract %float %87 0 + %100 = OpCompositeConstruct %v2float %98 %99 + %102 = OpLoad %int %x_69 + %104 = OpSMod %int %102 %int_16 + %101 = OpCopyObject %int %104 + %106 = OpAccessChain %_ptr_Function_v4float %indexable %101 + %107 = OpLoad %v4float %106 + OpStore %x_GLF_color %107 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %108 +%tint_symbol_1 = OpFunctionParameter %main_out + %112 = OpLabel + %113 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %113 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %115 = OpLabel + %116 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %116 + %117 = OpFunctionCall %void %main_1 + %119 = OpLoad %v4float %x_GLF_color + %120 = OpCompositeConstruct %main_out %119 + %118 = OpFunctionCall %void %tint_symbol_3 %120 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.wgsl new file mode 100644 index 0000000000..088e3cdfd6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bifurcation-Os-mutate-var-vector-shuffle/2.wgsl.expected.wgsl @@ -0,0 +1,57 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_69 : i32; + var x_69_phi : i32; + var x_72_phi : i32; + let x_55 : vec4 = gl_FragCoord; + let x_58 : vec2 = x_6.resolution; + let x_59 : vec2 = (vec2(x_55.x, x_55.y) / x_58); + let x_67 : i32 = (i32((x_59.x * 10.0)) + (i32((x_59.y * 10.0)) * 10)); + x_69_phi = 100; + x_72_phi = 0; + loop { + var x_70 : i32; + var x_73 : i32; + x_69 = x_69_phi; + let x_72 : i32 = x_72_phi; + if ((x_72 < x_67)) { + } else { + break; + } + + continuing { + x_70 = (((4 * bitcast(x_69)) * (1000 - bitcast(x_69))) / 1000); + x_73 = (x_72 + 1); + x_69_phi = x_70; + x_72_phi = x_73; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_80 : vec2 = vec2(vec4(0.0, 1.0, 0.0, 1.0).y, vec4(0.5, 0.0, 0.5, 1.0).x); + let x_82 : vec4 = indexable[bitcast((x_69 % 16))]; + x_GLF_color = x_82; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm new file mode 100644 index 0000000000..ca63a271e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm @@ -0,0 +1,248 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %checkSwap_f1_f1_ "checkSwap(f1;f1;" + OpName %a "a" + OpName %b "b" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %_ "" + OpName %i "i" + OpName %data "data" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %__0 "" + OpName %i_0 "i" + OpName %j "j" + OpName %doSwap "doSwap" + OpName %param "param" + OpName %param_0 "param" + OpName %temp "temp" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %21 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %25 = OpTypeFunction %bool %_ptr_Function_float %_ptr_Function_float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 +%_ptr_Function_bool = OpTypePointer Function %bool +%_ptr_Function_int = OpTypePointer Function %int + %int_10 = OpConstant %int 10 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_10 = OpConstant %float 10 + %int_5 = OpConstant %int 5 + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %21 + %51 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function + %i_0 = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %doSwap = OpVariable %_ptr_Function_bool Function + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_float Function + %temp = OpVariable %_ptr_Function_float Function + OpStore %i %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %i + %57 = OpSLessThan %bool %56 %int_10 + OpBranchConditional %57 %58 %53 + %58 = OpLabel + %59 = OpLoad %int %i + %60 = OpLoad %int %i + %61 = OpISub %int %int_10 %60 + %62 = OpConvertSToF %float %61 + %63 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %64 = OpLoad %float %63 + %65 = OpFMul %float %62 %64 + %66 = OpAccessChain %_ptr_Function_float %data %59 + OpStore %66 %65 + OpBranch %54 + %54 = OpLabel + %67 = OpLoad %int %i + %68 = OpIAdd %int %67 %int_1 + OpStore %i %68 + OpBranch %52 + %53 = OpLabel + OpStore %i_0 %int_0 + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %int %i_0 + %74 = OpSLessThan %bool %73 %int_9 + OpBranchConditional %74 %75 %70 + %75 = OpLabel + OpStore %j %int_0 + OpBranch %76 + %76 = OpLabel + OpLoopMerge %77 %78 None + OpBranch %79 + %79 = OpLabel + %80 = OpLoad %int %j + %81 = OpSLessThan %bool %80 %int_10 + OpBranchConditional %81 %82 %77 + %82 = OpLabel + %83 = OpLoad %int %j + %84 = OpLoad %int %i_0 + %85 = OpIAdd %int %84 %int_1 + %86 = OpSLessThan %bool %83 %85 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %87 + %88 = OpLabel + OpBranch %78 + %87 = OpLabel + %89 = OpLoad %int %i_0 + %90 = OpLoad %int %j + %91 = OpAccessChain %_ptr_Function_float %data %89 + %92 = OpLoad %float %91 + OpStore %param %92 + %93 = OpAccessChain %_ptr_Function_float %data %90 + %94 = OpLoad %float %93 + OpStore %param_0 %94 + %95 = OpFunctionCall %bool %checkSwap_f1_f1_ %param %param_0 + OpStore %doSwap %95 + %96 = OpLoad %bool %doSwap + OpSelectionMerge %97 None + OpBranchConditional %96 %98 %97 + %98 = OpLabel + %99 = OpLoad %int %i_0 + %100 = OpAccessChain %_ptr_Function_float %data %99 + %101 = OpLoad %float %100 + OpStore %temp %101 + %102 = OpLoad %int %i_0 + %103 = OpLoad %int %j + %104 = OpAccessChain %_ptr_Function_float %data %103 + %105 = OpLoad %float %104 + %106 = OpAccessChain %_ptr_Function_float %data %102 + OpStore %106 %105 + %107 = OpLoad %int %j + %108 = OpLoad %float %temp + %109 = OpAccessChain %_ptr_Function_float %data %107 + OpStore %109 %108 + OpBranch %97 + %97 = OpLabel + OpBranch %78 + %78 = OpLabel + %110 = OpLoad %int %j + %111 = OpIAdd %int %110 %int_1 + OpStore %j %111 + OpBranch %76 + %77 = OpLabel + OpBranch %71 + %71 = OpLabel + %112 = OpLoad %int %i_0 + %113 = OpIAdd %int %112 %int_1 + OpStore %i_0 %113 + OpBranch %69 + %70 = OpLabel + %114 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %115 = OpLoad %float %114 + %116 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %117 = OpLoad %float %116 + %118 = OpFDiv %float %117 %float_2 + %119 = OpFOrdLessThan %bool %115 %118 + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %_ptr_Function_float %data %int_0 + %124 = OpLoad %float %123 + %125 = OpFDiv %float %124 %float_10 + %126 = OpAccessChain %_ptr_Function_float %data %int_5 + %127 = OpLoad %float %126 + %128 = OpFDiv %float %127 %float_10 + %129 = OpAccessChain %_ptr_Function_float %data %int_9 + %130 = OpLoad %float %129 + %131 = OpFDiv %float %130 %float_10 + %132 = OpCompositeConstruct %v4float %125 %128 %131 %float_1 + OpStore %_GLF_color %132 + OpBranch %120 + %122 = OpLabel + %133 = OpAccessChain %_ptr_Function_float %data %int_5 + %134 = OpLoad %float %133 + %135 = OpFDiv %float %134 %float_10 + %136 = OpAccessChain %_ptr_Function_float %data %int_9 + %137 = OpLoad %float %136 + %138 = OpFDiv %float %137 %float_10 + %139 = OpAccessChain %_ptr_Function_float %data %int_0 + %140 = OpLoad %float %139 + %141 = OpFDiv %float %140 %float_10 + %142 = OpCompositeConstruct %v4float %135 %138 %141 %float_1 + OpStore %_GLF_color %142 + OpBranch %120 + %120 = OpLabel + OpReturn + OpFunctionEnd +%checkSwap_f1_f1_ = OpFunction %bool None %25 + %a = OpFunctionParameter %_ptr_Function_float + %b = OpFunctionParameter %_ptr_Function_float + %143 = OpLabel + %144 = OpVariable %_ptr_Function_bool Function + %145 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %146 = OpLoad %float %145 + %147 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %148 = OpLoad %float %147 + %149 = OpFDiv %float %148 %float_2 + %150 = OpFOrdLessThan %bool %146 %149 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %153 + %152 = OpLabel + %154 = OpLoad %float %a + %155 = OpLoad %float %b + %156 = OpFOrdGreaterThan %bool %154 %155 + OpStore %144 %156 + OpBranch %151 + %153 = OpLabel + %157 = OpLoad %float %a + %158 = OpLoad %float %b + %159 = OpFOrdLessThan %bool %157 %158 + OpStore %144 %159 + OpBranch %151 + %151 = OpLabel + %160 = OpLoad %bool %144 + OpReturnValue %160 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..5ff3989336 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.hlsl @@ -0,0 +1,105 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[1]; +}; +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +bool checkSwap_f1_f1_(inout float a, inout float b) { + bool x_144 = false; + const float x_146 = gl_FragCoord.y; + const float x_148 = asfloat(x_9[0].y); + if ((x_146 < (x_148 / 2.0f))) { + const float x_154 = a; + const float x_155 = b; + x_144 = (x_154 > x_155); + } else { + const float x_157 = a; + const float x_158 = b; + x_144 = (x_157 < x_158); + } + return x_144; +} + +void main_1() { + int i = 0; + float data[10] = (float[10])0; + int i_1 = 0; + int j = 0; + bool doSwap = false; + float param = 0.0f; + float param_1 = 0.0f; + float temp = 0.0f; + i = 0; + { + for(; (i < 10); i = (i + 1)) { + const int x_59 = i; + const int x_60 = i; + const float x_64 = asfloat(x_13[0].y); + data[x_59] = (float((10 - x_60)) * x_64); + } + } + i_1 = 0; + { + for(; (i_1 < 9); i_1 = (i_1 + 1)) { + j = 0; + { + for(; (j < 10); j = (j + 1)) { + if ((j < (i_1 + 1))) { + continue; + } + const int x_90 = j; + const float x_92 = data[i_1]; + param = x_92; + const float x_94 = data[x_90]; + param_1 = x_94; + const bool x_95 = checkSwap_f1_f1_(param, param_1); + doSwap = x_95; + if (doSwap) { + const float x_101 = data[i_1]; + temp = x_101; + const int x_102 = i_1; + const float x_105 = data[j]; + data[x_102] = x_105; + data[j] = temp; + } + } + } + } + } + const float x_115 = gl_FragCoord.x; + const float x_117 = asfloat(x_9[0].x); + if ((x_115 < (x_117 / 2.0f))) { + const float x_124 = data[0]; + const float x_127 = data[5]; + const float x_130 = data[9]; + x_GLF_color = float4((x_124 / 10.0f), (x_127 / 10.0f), (x_130 / 10.0f), 1.0f); + } else { + const float x_134 = data[5]; + const float x_137 = data[9]; + const float x_140 = data[0]; + x_GLF_color = float4((x_134 / 10.0f), (x_137 / 10.0f), (x_140 / 10.0f), 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.msl new file mode 100644 index 0000000000..08dcf56e46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.msl @@ -0,0 +1,141 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +bool checkSwap_f1_f1_(constant buf1& x_9, thread float* const a, thread float* const b, thread float4* const tint_symbol_5) { + bool x_144 = false; + float const x_146 = (*(tint_symbol_5)).y; + float const x_148 = x_9.resolution.y; + if ((x_146 < (x_148 / 2.0f))) { + float const x_154 = *(a); + float const x_155 = *(b); + x_144 = (x_154 > x_155); + } else { + float const x_157 = *(a); + float const x_158 = *(b); + x_144 = (x_157 < x_158); + } + bool const x_160 = x_144; + return x_160; +} + +void main_1(constant buf0& x_13, constant buf1& x_9, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int i = 0; + tint_array_wrapper data = {}; + int i_1 = 0; + int j = 0; + bool doSwap = false; + float param = 0.0f; + float param_1 = 0.0f; + float temp = 0.0f; + i = 0; + while (true) { + int const x_56 = i; + if ((x_56 < 10)) { + } else { + break; + } + int const x_59 = i; + int const x_60 = i; + float const x_64 = x_13.injectionSwitch.y; + data.arr[x_59] = (float((10 - x_60)) * x_64); + { + int const x_67 = i; + i = (x_67 + 1); + } + } + i_1 = 0; + while (true) { + int const x_73 = i_1; + if ((x_73 < 9)) { + } else { + break; + } + j = 0; + while (true) { + int const x_80 = j; + if ((x_80 < 10)) { + } else { + break; + } + int const x_83 = j; + int const x_84 = i_1; + if ((x_83 < (x_84 + 1))) { + { + int const x_110 = j; + j = (x_110 + 1); + } + continue; + } + int const x_89 = i_1; + int const x_90 = j; + float const x_92 = data.arr[x_89]; + param = x_92; + float const x_94 = data.arr[x_90]; + param_1 = x_94; + bool const x_95 = checkSwap_f1_f1_(x_9, &(param), &(param_1), tint_symbol_6); + doSwap = x_95; + bool const x_96 = doSwap; + if (x_96) { + int const x_99 = i_1; + float const x_101 = data.arr[x_99]; + temp = x_101; + int const x_102 = i_1; + int const x_103 = j; + float const x_105 = data.arr[x_103]; + data.arr[x_102] = x_105; + int const x_107 = j; + float const x_108 = temp; + data.arr[x_107] = x_108; + } + { + int const x_110 = j; + j = (x_110 + 1); + } + } + { + int const x_112 = i_1; + i_1 = (x_112 + 1); + } + } + float const x_115 = (*(tint_symbol_6)).x; + float const x_117 = x_9.resolution.x; + if ((x_115 < (x_117 / 2.0f))) { + float const x_124 = data.arr[0]; + float const x_127 = data.arr[5]; + float const x_130 = data.arr[9]; + *(tint_symbol_7) = float4((x_124 / 10.0f), (x_127 / 10.0f), (x_130 / 10.0f), 1.0f); + } else { + float const x_134 = data.arr[5]; + float const x_137 = data.arr[9]; + float const x_140 = data.arr[0]; + *(tint_symbol_7) = float4((x_134 / 10.0f), (x_137 / 10.0f), (x_140 / 10.0f), 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_13, x_9, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..d4767b32d0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.spvasm @@ -0,0 +1,305 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 193 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_9 "x_9" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_13 "x_13" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %checkSwap_f1_f1_ "checkSwap_f1_f1_" + OpName %a "a" + OpName %b "b" + OpName %x_144 "x_144" + OpName %main_1 "main_1" + OpName %i "i" + OpName %data "data" + OpName %i_1 "i_1" + OpName %j "j" + OpName %doSwap "doSwap" + OpName %param "param" + OpName %param_1 "param_1" + OpName %temp "temp" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpTypeFunction %bool %_ptr_Function_float %_ptr_Function_float +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 + %void = OpTypeVoid + %54 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %61 = OpConstantNull %int + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %66 = OpConstantNull %_arr_float_uint_10 + %71 = OpConstantNull %float + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %float_10 = OpConstant %float 10 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %180 = OpTypeFunction %void %main_out +%checkSwap_f1_f1_ = OpFunction %bool None %18 + %a = OpFunctionParameter %_ptr_Function_float + %b = OpFunctionParameter %_ptr_Function_float + %24 = OpLabel + %x_144 = OpVariable %_ptr_Function_bool Function %27 + %31 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %32 = OpLoad %float %31 + %35 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %36 = OpLoad %float %35 + %38 = OpFDiv %float %36 %float_2 + %39 = OpFOrdLessThan %bool %32 %38 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %42 + %41 = OpLabel + %44 = OpLoad %float %a + %46 = OpLoad %float %b + %47 = OpFOrdGreaterThan %bool %44 %46 + OpStore %x_144 %47 + OpBranch %40 + %42 = OpLabel + %49 = OpLoad %float %a + %51 = OpLoad %float %b + %52 = OpFOrdLessThan %bool %49 %51 + OpStore %x_144 %52 + OpBranch %40 + %40 = OpLabel + %53 = OpLoad %bool %x_144 + OpReturnValue %53 + OpFunctionEnd + %main_1 = OpFunction %void None %54 + %57 = OpLabel + %i = OpVariable %_ptr_Function_int Function %61 + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function %66 + %i_1 = OpVariable %_ptr_Function_int Function %61 + %j = OpVariable %_ptr_Function_int Function %61 + %doSwap = OpVariable %_ptr_Function_bool Function %27 + %param = OpVariable %_ptr_Function_float Function %71 + %param_1 = OpVariable %_ptr_Function_float Function %71 + %temp = OpVariable %_ptr_Function_float Function %71 + OpStore %i %int_0 + OpBranch %75 + %75 = OpLabel + OpLoopMerge %76 %77 None + OpBranch %78 + %78 = OpLabel + %79 = OpLoad %int %i + %81 = OpSLessThan %bool %79 %int_10 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + OpBranch %82 + %84 = OpLabel + OpBranch %76 + %82 = OpLabel + %85 = OpLoad %int %i + %86 = OpLoad %int %i + %87 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_1 + %88 = OpLoad %float %87 + %89 = OpAccessChain %_ptr_Function_float %data %85 + %91 = OpISub %int %int_10 %86 + %90 = OpConvertSToF %float %91 + %92 = OpFMul %float %90 %88 + OpStore %89 %92 + OpBranch %77 + %77 = OpLabel + %93 = OpLoad %int %i + %95 = OpIAdd %int %93 %int_1 + OpStore %i %95 + OpBranch %75 + %76 = OpLabel + OpStore %i_1 %int_0 + OpBranch %96 + %96 = OpLabel + OpLoopMerge %97 %98 None + OpBranch %99 + %99 = OpLabel + %100 = OpLoad %int %i_1 + %102 = OpSLessThan %bool %100 %int_9 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + OpBranch %103 + %105 = OpLabel + OpBranch %97 + %103 = OpLabel + OpStore %j %int_0 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %110 = OpLoad %int %j + %111 = OpSLessThan %bool %110 %int_10 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %114 + %113 = OpLabel + OpBranch %112 + %114 = OpLabel + OpBranch %107 + %112 = OpLabel + %115 = OpLoad %int %j + %116 = OpLoad %int %i_1 + %117 = OpIAdd %int %116 %int_1 + %118 = OpSLessThan %bool %115 %117 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %119 + %120 = OpLabel + OpBranch %108 + %119 = OpLabel + %121 = OpLoad %int %i_1 + %122 = OpLoad %int %j + %123 = OpAccessChain %_ptr_Function_float %data %121 + %124 = OpLoad %float %123 + OpStore %param %124 + %125 = OpAccessChain %_ptr_Function_float %data %122 + %126 = OpLoad %float %125 + OpStore %param_1 %126 + %127 = OpFunctionCall %bool %checkSwap_f1_f1_ %param %param_1 + OpStore %doSwap %127 + %130 = OpLoad %bool %doSwap + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %131 + %132 = OpLabel + %133 = OpLoad %int %i_1 + %134 = OpAccessChain %_ptr_Function_float %data %133 + %135 = OpLoad %float %134 + OpStore %temp %135 + %136 = OpLoad %int %i_1 + %137 = OpLoad %int %j + %138 = OpAccessChain %_ptr_Function_float %data %137 + %139 = OpLoad %float %138 + %140 = OpAccessChain %_ptr_Function_float %data %136 + OpStore %140 %139 + %141 = OpLoad %int %j + %142 = OpLoad %float %temp + %143 = OpAccessChain %_ptr_Function_float %data %141 + OpStore %143 %142 + OpBranch %131 + %131 = OpLabel + OpBranch %108 + %108 = OpLabel + %144 = OpLoad %int %j + %145 = OpIAdd %int %144 %int_1 + OpStore %j %145 + OpBranch %106 + %107 = OpLabel + OpBranch %98 + %98 = OpLabel + %146 = OpLoad %int %i_1 + %147 = OpIAdd %int %146 %int_1 + OpStore %i_1 %147 + OpBranch %96 + %97 = OpLabel + %148 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %149 = OpLoad %float %148 + %150 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %151 = OpLoad %float %150 + %152 = OpFDiv %float %151 %float_2 + %153 = OpFOrdLessThan %bool %149 %152 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + %157 = OpAccessChain %_ptr_Function_float %data %int_0 + %158 = OpLoad %float %157 + %160 = OpAccessChain %_ptr_Function_float %data %int_5 + %161 = OpLoad %float %160 + %162 = OpAccessChain %_ptr_Function_float %data %int_9 + %163 = OpLoad %float %162 + %165 = OpFDiv %float %158 %float_10 + %166 = OpFDiv %float %161 %float_10 + %167 = OpFDiv %float %163 %float_10 + %169 = OpCompositeConstruct %v4float %165 %166 %167 %float_1 + OpStore %x_GLF_color %169 + OpBranch %154 + %156 = OpLabel + %170 = OpAccessChain %_ptr_Function_float %data %int_5 + %171 = OpLoad %float %170 + %172 = OpAccessChain %_ptr_Function_float %data %int_9 + %173 = OpLoad %float %172 + %174 = OpAccessChain %_ptr_Function_float %data %int_0 + %175 = OpLoad %float %174 + %176 = OpFDiv %float %171 %float_10 + %177 = OpFDiv %float %173 %float_10 + %178 = OpFDiv %float %175 %float_10 + %179 = OpCompositeConstruct %v4float %176 %177 %178 %float_1 + OpStore %x_GLF_color %179 + OpBranch %154 + %154 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %180 +%tint_symbol_1 = OpFunctionParameter %main_out + %184 = OpLabel + %185 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %185 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %54 + %187 = OpLabel + %188 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %188 + %189 = OpFunctionCall %void %main_1 + %191 = OpLoad %v4float %x_GLF_color + %192 = OpCompositeConstruct %main_out %191 + %190 = OpFunctionCall %void %tint_symbol_3 %192 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..9074163092 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.spvasm.expected.wgsl @@ -0,0 +1,140 @@ +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +[[group(0), binding(0)]] var x_13 : buf0; + +var x_GLF_color : vec4; + +fn checkSwap_f1_f1_(a : ptr, b : ptr) -> bool { + var x_144 : bool; + let x_146 : f32 = gl_FragCoord.y; + let x_148 : f32 = x_9.resolution.y; + if ((x_146 < (x_148 / 2.0))) { + let x_154 : f32 = *(a); + let x_155 : f32 = *(b); + x_144 = (x_154 > x_155); + } else { + let x_157 : f32 = *(a); + let x_158 : f32 = *(b); + x_144 = (x_157 < x_158); + } + let x_160 : bool = x_144; + return x_160; +} + +fn main_1() { + var i : i32; + var data : array; + var i_1 : i32; + var j : i32; + var doSwap : bool; + var param : f32; + var param_1 : f32; + var temp : f32; + i = 0; + loop { + let x_56 : i32 = i; + if ((x_56 < 10)) { + } else { + break; + } + let x_59 : i32 = i; + let x_60 : i32 = i; + let x_64 : f32 = x_13.injectionSwitch.y; + data[x_59] = (f32((10 - x_60)) * x_64); + + continuing { + let x_67 : i32 = i; + i = (x_67 + 1); + } + } + i_1 = 0; + loop { + let x_73 : i32 = i_1; + if ((x_73 < 9)) { + } else { + break; + } + j = 0; + loop { + let x_80 : i32 = j; + if ((x_80 < 10)) { + } else { + break; + } + let x_83 : i32 = j; + let x_84 : i32 = i_1; + if ((x_83 < (x_84 + 1))) { + continue; + } + let x_89 : i32 = i_1; + let x_90 : i32 = j; + let x_92 : f32 = data[x_89]; + param = x_92; + let x_94 : f32 = data[x_90]; + param_1 = x_94; + let x_95 : bool = checkSwap_f1_f1_(&(param), &(param_1)); + doSwap = x_95; + let x_96 : bool = doSwap; + if (x_96) { + let x_99 : i32 = i_1; + let x_101 : f32 = data[x_99]; + temp = x_101; + let x_102 : i32 = i_1; + let x_103 : i32 = j; + let x_105 : f32 = data[x_103]; + data[x_102] = x_105; + let x_107 : i32 = j; + let x_108 : f32 = temp; + data[x_107] = x_108; + } + + continuing { + let x_110 : i32 = j; + j = (x_110 + 1); + } + } + + continuing { + let x_112 : i32 = i_1; + i_1 = (x_112 + 1); + } + } + let x_115 : f32 = gl_FragCoord.x; + let x_117 : f32 = x_9.resolution.x; + if ((x_115 < (x_117 / 2.0))) { + let x_124 : f32 = data[0]; + let x_127 : f32 = data[5]; + let x_130 : f32 = data[9]; + x_GLF_color = vec4((x_124 / 10.0), (x_127 / 10.0), (x_130 / 10.0), 1.0); + } else { + let x_134 : f32 = data[5]; + let x_137 : f32 = data[9]; + let x_140 : f32 = data[0]; + x_GLF_color = vec4((x_134 / 10.0), (x_137 / 10.0), (x_140 / 10.0), 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl new file mode 100644 index 0000000000..9074163092 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl @@ -0,0 +1,140 @@ +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +[[group(0), binding(0)]] var x_13 : buf0; + +var x_GLF_color : vec4; + +fn checkSwap_f1_f1_(a : ptr, b : ptr) -> bool { + var x_144 : bool; + let x_146 : f32 = gl_FragCoord.y; + let x_148 : f32 = x_9.resolution.y; + if ((x_146 < (x_148 / 2.0))) { + let x_154 : f32 = *(a); + let x_155 : f32 = *(b); + x_144 = (x_154 > x_155); + } else { + let x_157 : f32 = *(a); + let x_158 : f32 = *(b); + x_144 = (x_157 < x_158); + } + let x_160 : bool = x_144; + return x_160; +} + +fn main_1() { + var i : i32; + var data : array; + var i_1 : i32; + var j : i32; + var doSwap : bool; + var param : f32; + var param_1 : f32; + var temp : f32; + i = 0; + loop { + let x_56 : i32 = i; + if ((x_56 < 10)) { + } else { + break; + } + let x_59 : i32 = i; + let x_60 : i32 = i; + let x_64 : f32 = x_13.injectionSwitch.y; + data[x_59] = (f32((10 - x_60)) * x_64); + + continuing { + let x_67 : i32 = i; + i = (x_67 + 1); + } + } + i_1 = 0; + loop { + let x_73 : i32 = i_1; + if ((x_73 < 9)) { + } else { + break; + } + j = 0; + loop { + let x_80 : i32 = j; + if ((x_80 < 10)) { + } else { + break; + } + let x_83 : i32 = j; + let x_84 : i32 = i_1; + if ((x_83 < (x_84 + 1))) { + continue; + } + let x_89 : i32 = i_1; + let x_90 : i32 = j; + let x_92 : f32 = data[x_89]; + param = x_92; + let x_94 : f32 = data[x_90]; + param_1 = x_94; + let x_95 : bool = checkSwap_f1_f1_(&(param), &(param_1)); + doSwap = x_95; + let x_96 : bool = doSwap; + if (x_96) { + let x_99 : i32 = i_1; + let x_101 : f32 = data[x_99]; + temp = x_101; + let x_102 : i32 = i_1; + let x_103 : i32 = j; + let x_105 : f32 = data[x_103]; + data[x_102] = x_105; + let x_107 : i32 = j; + let x_108 : f32 = temp; + data[x_107] = x_108; + } + + continuing { + let x_110 : i32 = j; + j = (x_110 + 1); + } + } + + continuing { + let x_112 : i32 = i_1; + i_1 = (x_112 + 1); + } + } + let x_115 : f32 = gl_FragCoord.x; + let x_117 : f32 = x_9.resolution.x; + if ((x_115 < (x_117 / 2.0))) { + let x_124 : f32 = data[0]; + let x_127 : f32 = data[5]; + let x_130 : f32 = data[9]; + x_GLF_color = vec4((x_124 / 10.0), (x_127 / 10.0), (x_130 / 10.0), 1.0); + } else { + let x_134 : f32 = data[5]; + let x_137 : f32 = data[9]; + let x_140 : f32 = data[0]; + x_GLF_color = vec4((x_134 / 10.0), (x_137 / 10.0), (x_140 / 10.0), 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..5ff3989336 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.hlsl @@ -0,0 +1,105 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[1]; +}; +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +bool checkSwap_f1_f1_(inout float a, inout float b) { + bool x_144 = false; + const float x_146 = gl_FragCoord.y; + const float x_148 = asfloat(x_9[0].y); + if ((x_146 < (x_148 / 2.0f))) { + const float x_154 = a; + const float x_155 = b; + x_144 = (x_154 > x_155); + } else { + const float x_157 = a; + const float x_158 = b; + x_144 = (x_157 < x_158); + } + return x_144; +} + +void main_1() { + int i = 0; + float data[10] = (float[10])0; + int i_1 = 0; + int j = 0; + bool doSwap = false; + float param = 0.0f; + float param_1 = 0.0f; + float temp = 0.0f; + i = 0; + { + for(; (i < 10); i = (i + 1)) { + const int x_59 = i; + const int x_60 = i; + const float x_64 = asfloat(x_13[0].y); + data[x_59] = (float((10 - x_60)) * x_64); + } + } + i_1 = 0; + { + for(; (i_1 < 9); i_1 = (i_1 + 1)) { + j = 0; + { + for(; (j < 10); j = (j + 1)) { + if ((j < (i_1 + 1))) { + continue; + } + const int x_90 = j; + const float x_92 = data[i_1]; + param = x_92; + const float x_94 = data[x_90]; + param_1 = x_94; + const bool x_95 = checkSwap_f1_f1_(param, param_1); + doSwap = x_95; + if (doSwap) { + const float x_101 = data[i_1]; + temp = x_101; + const int x_102 = i_1; + const float x_105 = data[j]; + data[x_102] = x_105; + data[j] = temp; + } + } + } + } + } + const float x_115 = gl_FragCoord.x; + const float x_117 = asfloat(x_9[0].x); + if ((x_115 < (x_117 / 2.0f))) { + const float x_124 = data[0]; + const float x_127 = data[5]; + const float x_130 = data[9]; + x_GLF_color = float4((x_124 / 10.0f), (x_127 / 10.0f), (x_130 / 10.0f), 1.0f); + } else { + const float x_134 = data[5]; + const float x_137 = data[9]; + const float x_140 = data[0]; + x_GLF_color = float4((x_134 / 10.0f), (x_137 / 10.0f), (x_140 / 10.0f), 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.msl new file mode 100644 index 0000000000..08dcf56e46 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.msl @@ -0,0 +1,141 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +bool checkSwap_f1_f1_(constant buf1& x_9, thread float* const a, thread float* const b, thread float4* const tint_symbol_5) { + bool x_144 = false; + float const x_146 = (*(tint_symbol_5)).y; + float const x_148 = x_9.resolution.y; + if ((x_146 < (x_148 / 2.0f))) { + float const x_154 = *(a); + float const x_155 = *(b); + x_144 = (x_154 > x_155); + } else { + float const x_157 = *(a); + float const x_158 = *(b); + x_144 = (x_157 < x_158); + } + bool const x_160 = x_144; + return x_160; +} + +void main_1(constant buf0& x_13, constant buf1& x_9, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int i = 0; + tint_array_wrapper data = {}; + int i_1 = 0; + int j = 0; + bool doSwap = false; + float param = 0.0f; + float param_1 = 0.0f; + float temp = 0.0f; + i = 0; + while (true) { + int const x_56 = i; + if ((x_56 < 10)) { + } else { + break; + } + int const x_59 = i; + int const x_60 = i; + float const x_64 = x_13.injectionSwitch.y; + data.arr[x_59] = (float((10 - x_60)) * x_64); + { + int const x_67 = i; + i = (x_67 + 1); + } + } + i_1 = 0; + while (true) { + int const x_73 = i_1; + if ((x_73 < 9)) { + } else { + break; + } + j = 0; + while (true) { + int const x_80 = j; + if ((x_80 < 10)) { + } else { + break; + } + int const x_83 = j; + int const x_84 = i_1; + if ((x_83 < (x_84 + 1))) { + { + int const x_110 = j; + j = (x_110 + 1); + } + continue; + } + int const x_89 = i_1; + int const x_90 = j; + float const x_92 = data.arr[x_89]; + param = x_92; + float const x_94 = data.arr[x_90]; + param_1 = x_94; + bool const x_95 = checkSwap_f1_f1_(x_9, &(param), &(param_1), tint_symbol_6); + doSwap = x_95; + bool const x_96 = doSwap; + if (x_96) { + int const x_99 = i_1; + float const x_101 = data.arr[x_99]; + temp = x_101; + int const x_102 = i_1; + int const x_103 = j; + float const x_105 = data.arr[x_103]; + data.arr[x_102] = x_105; + int const x_107 = j; + float const x_108 = temp; + data.arr[x_107] = x_108; + } + { + int const x_110 = j; + j = (x_110 + 1); + } + } + { + int const x_112 = i_1; + i_1 = (x_112 + 1); + } + } + float const x_115 = (*(tint_symbol_6)).x; + float const x_117 = x_9.resolution.x; + if ((x_115 < (x_117 / 2.0f))) { + float const x_124 = data.arr[0]; + float const x_127 = data.arr[5]; + float const x_130 = data.arr[9]; + *(tint_symbol_7) = float4((x_124 / 10.0f), (x_127 / 10.0f), (x_130 / 10.0f), 1.0f); + } else { + float const x_134 = data.arr[5]; + float const x_137 = data.arr[9]; + float const x_140 = data.arr[0]; + *(tint_symbol_7) = float4((x_134 / 10.0f), (x_137 / 10.0f), (x_140 / 10.0f), 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_13, x_9, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..d4767b32d0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.spvasm @@ -0,0 +1,305 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 193 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_9 "x_9" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_13 "x_13" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %checkSwap_f1_f1_ "checkSwap_f1_f1_" + OpName %a "a" + OpName %b "b" + OpName %x_144 "x_144" + OpName %main_1 "main_1" + OpName %i "i" + OpName %data "data" + OpName %i_1 "i_1" + OpName %j "j" + OpName %doSwap "doSwap" + OpName %param "param" + OpName %param_1 "param_1" + OpName %temp "temp" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpTypeFunction %bool %_ptr_Function_float %_ptr_Function_float +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 + %void = OpTypeVoid + %54 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %61 = OpConstantNull %int + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %66 = OpConstantNull %_arr_float_uint_10 + %71 = OpConstantNull %float + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %float_10 = OpConstant %float 10 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %180 = OpTypeFunction %void %main_out +%checkSwap_f1_f1_ = OpFunction %bool None %18 + %a = OpFunctionParameter %_ptr_Function_float + %b = OpFunctionParameter %_ptr_Function_float + %24 = OpLabel + %x_144 = OpVariable %_ptr_Function_bool Function %27 + %31 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %32 = OpLoad %float %31 + %35 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %36 = OpLoad %float %35 + %38 = OpFDiv %float %36 %float_2 + %39 = OpFOrdLessThan %bool %32 %38 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %42 + %41 = OpLabel + %44 = OpLoad %float %a + %46 = OpLoad %float %b + %47 = OpFOrdGreaterThan %bool %44 %46 + OpStore %x_144 %47 + OpBranch %40 + %42 = OpLabel + %49 = OpLoad %float %a + %51 = OpLoad %float %b + %52 = OpFOrdLessThan %bool %49 %51 + OpStore %x_144 %52 + OpBranch %40 + %40 = OpLabel + %53 = OpLoad %bool %x_144 + OpReturnValue %53 + OpFunctionEnd + %main_1 = OpFunction %void None %54 + %57 = OpLabel + %i = OpVariable %_ptr_Function_int Function %61 + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function %66 + %i_1 = OpVariable %_ptr_Function_int Function %61 + %j = OpVariable %_ptr_Function_int Function %61 + %doSwap = OpVariable %_ptr_Function_bool Function %27 + %param = OpVariable %_ptr_Function_float Function %71 + %param_1 = OpVariable %_ptr_Function_float Function %71 + %temp = OpVariable %_ptr_Function_float Function %71 + OpStore %i %int_0 + OpBranch %75 + %75 = OpLabel + OpLoopMerge %76 %77 None + OpBranch %78 + %78 = OpLabel + %79 = OpLoad %int %i + %81 = OpSLessThan %bool %79 %int_10 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + OpBranch %82 + %84 = OpLabel + OpBranch %76 + %82 = OpLabel + %85 = OpLoad %int %i + %86 = OpLoad %int %i + %87 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_1 + %88 = OpLoad %float %87 + %89 = OpAccessChain %_ptr_Function_float %data %85 + %91 = OpISub %int %int_10 %86 + %90 = OpConvertSToF %float %91 + %92 = OpFMul %float %90 %88 + OpStore %89 %92 + OpBranch %77 + %77 = OpLabel + %93 = OpLoad %int %i + %95 = OpIAdd %int %93 %int_1 + OpStore %i %95 + OpBranch %75 + %76 = OpLabel + OpStore %i_1 %int_0 + OpBranch %96 + %96 = OpLabel + OpLoopMerge %97 %98 None + OpBranch %99 + %99 = OpLabel + %100 = OpLoad %int %i_1 + %102 = OpSLessThan %bool %100 %int_9 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + OpBranch %103 + %105 = OpLabel + OpBranch %97 + %103 = OpLabel + OpStore %j %int_0 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %107 %108 None + OpBranch %109 + %109 = OpLabel + %110 = OpLoad %int %j + %111 = OpSLessThan %bool %110 %int_10 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %114 + %113 = OpLabel + OpBranch %112 + %114 = OpLabel + OpBranch %107 + %112 = OpLabel + %115 = OpLoad %int %j + %116 = OpLoad %int %i_1 + %117 = OpIAdd %int %116 %int_1 + %118 = OpSLessThan %bool %115 %117 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %119 + %120 = OpLabel + OpBranch %108 + %119 = OpLabel + %121 = OpLoad %int %i_1 + %122 = OpLoad %int %j + %123 = OpAccessChain %_ptr_Function_float %data %121 + %124 = OpLoad %float %123 + OpStore %param %124 + %125 = OpAccessChain %_ptr_Function_float %data %122 + %126 = OpLoad %float %125 + OpStore %param_1 %126 + %127 = OpFunctionCall %bool %checkSwap_f1_f1_ %param %param_1 + OpStore %doSwap %127 + %130 = OpLoad %bool %doSwap + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %131 + %132 = OpLabel + %133 = OpLoad %int %i_1 + %134 = OpAccessChain %_ptr_Function_float %data %133 + %135 = OpLoad %float %134 + OpStore %temp %135 + %136 = OpLoad %int %i_1 + %137 = OpLoad %int %j + %138 = OpAccessChain %_ptr_Function_float %data %137 + %139 = OpLoad %float %138 + %140 = OpAccessChain %_ptr_Function_float %data %136 + OpStore %140 %139 + %141 = OpLoad %int %j + %142 = OpLoad %float %temp + %143 = OpAccessChain %_ptr_Function_float %data %141 + OpStore %143 %142 + OpBranch %131 + %131 = OpLabel + OpBranch %108 + %108 = OpLabel + %144 = OpLoad %int %j + %145 = OpIAdd %int %144 %int_1 + OpStore %j %145 + OpBranch %106 + %107 = OpLabel + OpBranch %98 + %98 = OpLabel + %146 = OpLoad %int %i_1 + %147 = OpIAdd %int %146 %int_1 + OpStore %i_1 %147 + OpBranch %96 + %97 = OpLabel + %148 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %149 = OpLoad %float %148 + %150 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %151 = OpLoad %float %150 + %152 = OpFDiv %float %151 %float_2 + %153 = OpFOrdLessThan %bool %149 %152 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + %157 = OpAccessChain %_ptr_Function_float %data %int_0 + %158 = OpLoad %float %157 + %160 = OpAccessChain %_ptr_Function_float %data %int_5 + %161 = OpLoad %float %160 + %162 = OpAccessChain %_ptr_Function_float %data %int_9 + %163 = OpLoad %float %162 + %165 = OpFDiv %float %158 %float_10 + %166 = OpFDiv %float %161 %float_10 + %167 = OpFDiv %float %163 %float_10 + %169 = OpCompositeConstruct %v4float %165 %166 %167 %float_1 + OpStore %x_GLF_color %169 + OpBranch %154 + %156 = OpLabel + %170 = OpAccessChain %_ptr_Function_float %data %int_5 + %171 = OpLoad %float %170 + %172 = OpAccessChain %_ptr_Function_float %data %int_9 + %173 = OpLoad %float %172 + %174 = OpAccessChain %_ptr_Function_float %data %int_0 + %175 = OpLoad %float %174 + %176 = OpFDiv %float %171 %float_10 + %177 = OpFDiv %float %173 %float_10 + %178 = OpFDiv %float %175 %float_10 + %179 = OpCompositeConstruct %v4float %176 %177 %178 %float_1 + OpStore %x_GLF_color %179 + OpBranch %154 + %154 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %180 +%tint_symbol_1 = OpFunctionParameter %main_out + %184 = OpLabel + %185 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %185 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %54 + %187 = OpLabel + %188 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %188 + %189 = OpFunctionCall %void %main_1 + %191 = OpLoad %v4float %x_GLF_color + %192 = OpCompositeConstruct %main_out %191 + %190 = OpFunctionCall %void %tint_symbol_3 %192 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..9074163092 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/0.wgsl.expected.wgsl @@ -0,0 +1,140 @@ +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +[[group(0), binding(0)]] var x_13 : buf0; + +var x_GLF_color : vec4; + +fn checkSwap_f1_f1_(a : ptr, b : ptr) -> bool { + var x_144 : bool; + let x_146 : f32 = gl_FragCoord.y; + let x_148 : f32 = x_9.resolution.y; + if ((x_146 < (x_148 / 2.0))) { + let x_154 : f32 = *(a); + let x_155 : f32 = *(b); + x_144 = (x_154 > x_155); + } else { + let x_157 : f32 = *(a); + let x_158 : f32 = *(b); + x_144 = (x_157 < x_158); + } + let x_160 : bool = x_144; + return x_160; +} + +fn main_1() { + var i : i32; + var data : array; + var i_1 : i32; + var j : i32; + var doSwap : bool; + var param : f32; + var param_1 : f32; + var temp : f32; + i = 0; + loop { + let x_56 : i32 = i; + if ((x_56 < 10)) { + } else { + break; + } + let x_59 : i32 = i; + let x_60 : i32 = i; + let x_64 : f32 = x_13.injectionSwitch.y; + data[x_59] = (f32((10 - x_60)) * x_64); + + continuing { + let x_67 : i32 = i; + i = (x_67 + 1); + } + } + i_1 = 0; + loop { + let x_73 : i32 = i_1; + if ((x_73 < 9)) { + } else { + break; + } + j = 0; + loop { + let x_80 : i32 = j; + if ((x_80 < 10)) { + } else { + break; + } + let x_83 : i32 = j; + let x_84 : i32 = i_1; + if ((x_83 < (x_84 + 1))) { + continue; + } + let x_89 : i32 = i_1; + let x_90 : i32 = j; + let x_92 : f32 = data[x_89]; + param = x_92; + let x_94 : f32 = data[x_90]; + param_1 = x_94; + let x_95 : bool = checkSwap_f1_f1_(&(param), &(param_1)); + doSwap = x_95; + let x_96 : bool = doSwap; + if (x_96) { + let x_99 : i32 = i_1; + let x_101 : f32 = data[x_99]; + temp = x_101; + let x_102 : i32 = i_1; + let x_103 : i32 = j; + let x_105 : f32 = data[x_103]; + data[x_102] = x_105; + let x_107 : i32 = j; + let x_108 : f32 = temp; + data[x_107] = x_108; + } + + continuing { + let x_110 : i32 = j; + j = (x_110 + 1); + } + } + + continuing { + let x_112 : i32 = i_1; + i_1 = (x_112 + 1); + } + } + let x_115 : f32 = gl_FragCoord.x; + let x_117 : f32 = x_9.resolution.x; + if ((x_115 < (x_117 / 2.0))) { + let x_124 : f32 = data[0]; + let x_127 : f32 = data[5]; + let x_130 : f32 = data[9]; + x_GLF_color = vec4((x_124 / 10.0), (x_127 / 10.0), (x_130 / 10.0), 1.0); + } else { + let x_134 : f32 = data[5]; + let x_137 : f32 = data[9]; + let x_140 : f32 = data[0]; + x_GLF_color = vec4((x_134 / 10.0), (x_137 / 10.0), (x_140 / 10.0), 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm new file mode 100644 index 0000000000..5b6120e0a8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm @@ -0,0 +1,305 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %checkSwap_f1_f1_ "checkSwap(f1;f1;" + OpName %a "a" + OpName %b "b" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %_ "" + OpName %i "i" + OpName %data "data" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %__0 "" + OpName %i_0 "i" + OpName %j "j" + OpName %doSwap "doSwap" + OpName %param "param" + OpName %param_0 "param" + OpName %temp "temp" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %21 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %25 = OpTypeFunction %bool %_ptr_Function_float %_ptr_Function_float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 +%_ptr_Function_bool = OpTypePointer Function %bool +%_ptr_Function_int = OpTypePointer Function %int + %int_10 = OpConstant %int 10 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_10 = OpConstant %float 10 + %int_5 = OpConstant %int 5 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %main = OpFunction %void None %21 + %54 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function + %i_0 = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %doSwap = OpVariable %_ptr_Function_bool Function + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_float Function + %temp = OpVariable %_ptr_Function_float Function + OpStore %i %int_0 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %int %i + %60 = OpSLessThan %bool %59 %int_10 + OpBranchConditional %60 %61 %56 + %61 = OpLabel + %62 = OpLoad %int %i + %63 = OpLoad %int %i + %64 = OpISub %int %int_10 %63 + %65 = OpConvertSToF %float %64 + %66 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %67 = OpLoad %float %66 + %68 = OpFMul %float %65 %67 + %69 = OpAccessChain %_ptr_Function_float %data %62 + OpStore %69 %68 + OpBranch %57 + %57 = OpLabel + %70 = OpLoad %int %i + %71 = OpIAdd %int %70 %int_1 + OpStore %i %71 + OpBranch %55 + %56 = OpLabel + OpStore %i_0 %int_0 + OpBranch %72 + %72 = OpLabel + OpLoopMerge %73 %74 None + OpBranch %75 + %75 = OpLabel + %76 = OpLoad %int %i_0 + %77 = OpSLessThan %bool %76 %int_9 + OpBranchConditional %77 %78 %73 + %78 = OpLabel + OpStore %j %int_0 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %int %j + %84 = OpSLessThan %bool %83 %int_10 + OpBranchConditional %84 %85 %80 + %85 = OpLabel + %86 = OpLoad %int %j + %87 = OpLoad %int %i_0 + %88 = OpIAdd %int %87 %int_1 + %89 = OpSLessThan %bool %86 %88 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + OpBranch %81 + %90 = OpLabel + %92 = OpLoad %int %i_0 + %93 = OpLoad %int %j + %94 = OpAccessChain %_ptr_Function_float %data %92 + %95 = OpLoad %float %94 + OpStore %param %95 + %96 = OpAccessChain %_ptr_Function_float %data %93 + %97 = OpLoad %float %96 + OpStore %param_0 %97 + %98 = OpFunctionCall %bool %checkSwap_f1_f1_ %param %param_0 + OpStore %doSwap %98 + %99 = OpLoad %bool %doSwap + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %100 + %101 = OpLabel + %102 = OpLoad %int %i_0 + %103 = OpAccessChain %_ptr_Function_float %data %102 + %104 = OpLoad %float %103 + OpStore %temp %104 + %105 = OpLoad %int %i_0 + %106 = OpLoad %int %j + %107 = OpAccessChain %_ptr_Function_float %data %106 + %108 = OpLoad %float %107 + %109 = OpAccessChain %_ptr_Function_float %data %105 + OpStore %109 %108 + %110 = OpLoad %int %j + %111 = OpLoad %float %temp + %112 = OpAccessChain %_ptr_Function_float %data %110 + OpStore %112 %111 + OpBranch %100 + %100 = OpLabel + OpBranch %81 + %81 = OpLabel + %113 = OpLoad %int %j + %114 = OpIAdd %int %113 %int_1 + OpStore %j %114 + OpBranch %79 + %80 = OpLabel + OpBranch %74 + %74 = OpLabel + %115 = OpLoad %int %i_0 + %116 = OpIAdd %int %115 %int_1 + OpStore %i_0 %116 + OpBranch %72 + %73 = OpLabel + %117 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %118 = OpLoad %float %117 + %119 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %120 = OpLoad %float %119 + %121 = OpFDiv %float %120 %float_2 + %122 = OpFOrdLessThan %bool %118 %121 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %125 + %124 = OpLabel + %126 = OpAccessChain %_ptr_Function_float %data %int_0 + %127 = OpLoad %float %126 + %128 = OpFDiv %float %127 %float_10 + %129 = OpAccessChain %_ptr_Function_float %data %int_5 + %130 = OpLoad %float %129 + %131 = OpFDiv %float %130 %float_10 + %132 = OpAccessChain %_ptr_Function_float %data %int_9 + %133 = OpLoad %float %132 + %134 = OpFDiv %float %133 %float_10 + %135 = OpCompositeConstruct %v4float %128 %131 %134 %float_1 + OpStore %_GLF_color %135 + OpBranch %123 + %125 = OpLabel + %136 = OpAccessChain %_ptr_Function_float %data %int_5 + %137 = OpLoad %float %136 + %138 = OpFDiv %float %137 %float_10 + %139 = OpAccessChain %_ptr_Function_float %data %int_9 + %140 = OpLoad %float %139 + %141 = OpFDiv %float %140 %float_10 + %142 = OpAccessChain %_ptr_Function_float %data %int_0 + %143 = OpLoad %float %142 + %144 = OpFDiv %float %143 %float_10 + %145 = OpCompositeConstruct %v4float %138 %141 %144 %float_1 + OpStore %_GLF_color %145 + OpBranch %123 + %123 = OpLabel + OpReturn + OpFunctionEnd +%checkSwap_f1_f1_ = OpFunction %bool None %25 + %a = OpFunctionParameter %_ptr_Function_float + %b = OpFunctionParameter %_ptr_Function_float + %146 = OpLabel + %147 = OpVariable %_ptr_Function_bool Function + %148 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %149 = OpLoad %float %148 + %150 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %151 = OpLoad %float %150 + %152 = OpFDiv %float %151 %float_2 + %153 = OpFOrdLessThan %bool %149 %152 + OpBranch %154 + %154 = OpLabel + OpSelectionMerge %155 None + OpBranchConditional %153 %156 %157 + %156 = OpLabel + %158 = OpLoad %float %a + OpBranch %155 + %157 = OpLabel + %159 = OpCopyObject %float %float_0 + OpBranch %155 + %155 = OpLabel + %160 = OpPhi %float %158 %156 %159 %157 + OpSelectionMerge %161 None + OpBranchConditional %false %162 %162 + %162 = OpLabel + OpSelectionMerge %163 None + OpBranchConditional %153 %164 %165 + %164 = OpLabel + %166 = OpLoad %float %b + OpBranch %163 + %165 = OpLabel + %167 = OpCopyObject %float %float_0 + OpBranch %163 + %163 = OpLabel + %168 = OpPhi %float %166 %164 %167 %165 + %169 = OpFOrdGreaterThan %bool %160 %168 + OpBranch %170 + %170 = OpLabel + OpSelectionMerge %171 None + OpBranchConditional %153 %172 %171 + %172 = OpLabel + OpStore %147 %169 + OpBranch %171 + %171 = OpLabel + OpBranchConditional %true %173 %161 + %173 = OpLabel + OpBranch %161 + %161 = OpLabel + OpBranch %174 + %174 = OpLabel + OpSelectionMerge %175 None + OpBranchConditional %153 %176 %177 + %177 = OpLabel + %178 = OpLoad %float %a + OpBranch %175 + %176 = OpLabel + %179 = OpCopyObject %float %float_0 + OpBranch %175 + %175 = OpLabel + %180 = OpPhi %float %178 %177 %179 %176 + OpSelectionMerge %181 None + OpBranchConditional %153 %182 %183 + %183 = OpLabel + %184 = OpLoad %float %b + OpBranch %181 + %182 = OpLabel + %185 = OpCopyObject %float %float_0 + OpBranch %181 + %181 = OpLabel + %186 = OpPhi %float %184 %183 %185 %182 + %187 = OpFOrdLessThan %bool %180 %186 + OpSelectionMerge %188 None + OpBranchConditional %153 %188 %189 + %189 = OpLabel + OpStore %147 %187 + OpBranch %188 + %188 = OpLabel + OpBranch %190 + %190 = OpLabel + %191 = OpLoad %bool %147 + OpReturnValue %191 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..8afa23d312 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.hlsl @@ -0,0 +1,161 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[1]; +}; +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +bool checkSwap_f1_f1_(inout float a, inout float b) { + bool x_147 = false; + float x_158 = 0.0f; + float x_159 = 0.0f; + float x_179 = 0.0f; + float x_178 = 0.0f; + float x_185 = 0.0f; + float x_184 = 0.0f; + float x_160_phi = 0.0f; + float x_180_phi = 0.0f; + float x_186_phi = 0.0f; + const float x_149 = gl_FragCoord.y; + const float x_151 = asfloat(x_9[0].y); + const bool x_153 = (x_149 < (x_151 / 2.0f)); + if (x_153) { + x_158 = a; + x_160_phi = x_158; + } else { + x_159 = 0.0f; + x_160_phi = x_159; + } + float x_166 = 0.0f; + float x_167 = 0.0f; + float x_168_phi = 0.0f; + const float x_160 = x_160_phi; + bool guard155 = true; + if (false) { + } else { + if (guard155) { + if (x_153) { + x_166 = b; + x_168_phi = x_166; + } else { + x_167 = 0.0f; + x_168_phi = x_167; + } + const bool x_169 = (x_160 > x_168_phi); + if (x_153) { + x_147 = x_169; + } + if (true) { + } else { + guard155 = false; + } + if (guard155) { + guard155 = false; + } + } + } + if (x_153) { + x_179 = 0.0f; + x_180_phi = x_179; + } else { + x_178 = a; + x_180_phi = x_178; + } + const float x_180 = x_180_phi; + if (x_153) { + x_185 = 0.0f; + x_186_phi = x_185; + } else { + x_184 = b; + x_186_phi = x_184; + } + const float x_186 = x_186_phi; + if (x_153) { + } else { + x_147 = (x_180 < x_186); + } + return x_147; +} + +void main_1() { + int i = 0; + float data[10] = (float[10])0; + int i_1 = 0; + int j = 0; + bool doSwap = false; + float param = 0.0f; + float param_1 = 0.0f; + float temp = 0.0f; + i = 0; + { + for(; (i < 10); i = (i + 1)) { + const int x_62 = i; + const int x_63 = i; + const float x_67 = asfloat(x_13[0].y); + data[x_62] = (float((10 - x_63)) * x_67); + } + } + i_1 = 0; + { + for(; (i_1 < 9); i_1 = (i_1 + 1)) { + j = 0; + { + for(; (j < 10); j = (j + 1)) { + if ((j < (i_1 + 1))) { + continue; + } + const int x_93 = j; + const float x_95 = data[i_1]; + param = x_95; + const float x_97 = data[x_93]; + param_1 = x_97; + const bool x_98 = checkSwap_f1_f1_(param, param_1); + doSwap = x_98; + if (doSwap) { + const float x_104 = data[i_1]; + temp = x_104; + const int x_105 = i_1; + const float x_108 = data[j]; + data[x_105] = x_108; + data[j] = temp; + } + } + } + } + } + const float x_118 = gl_FragCoord.x; + const float x_120 = asfloat(x_9[0].x); + if ((x_118 < (x_120 / 2.0f))) { + const float x_127 = data[0]; + const float x_130 = data[5]; + const float x_133 = data[9]; + x_GLF_color = float4((x_127 / 10.0f), (x_130 / 10.0f), (x_133 / 10.0f), 1.0f); + } else { + const float x_137 = data[5]; + const float x_140 = data[9]; + const float x_143 = data[0]; + x_GLF_color = float4((x_137 / 10.0f), (x_140 / 10.0f), (x_143 / 10.0f), 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.msl new file mode 100644 index 0000000000..3475e4507b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.msl @@ -0,0 +1,198 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +bool checkSwap_f1_f1_(constant buf1& x_9, thread float* const a, thread float* const b, thread float4* const tint_symbol_5) { + bool x_147 = false; + float x_158 = 0.0f; + float x_159 = 0.0f; + float x_179 = 0.0f; + float x_178 = 0.0f; + float x_185 = 0.0f; + float x_184 = 0.0f; + float x_160_phi = 0.0f; + float x_180_phi = 0.0f; + float x_186_phi = 0.0f; + float const x_149 = (*(tint_symbol_5)).y; + float const x_151 = x_9.resolution.y; + bool const x_153 = (x_149 < (x_151 / 2.0f)); + if (x_153) { + x_158 = *(a); + x_160_phi = x_158; + } else { + x_159 = 0.0f; + x_160_phi = x_159; + } + float x_166 = 0.0f; + float x_167 = 0.0f; + float x_168_phi = 0.0f; + float const x_160 = x_160_phi; + bool guard155 = true; + if (false) { + } else { + if (guard155) { + if (x_153) { + x_166 = *(b); + x_168_phi = x_166; + } else { + x_167 = 0.0f; + x_168_phi = x_167; + } + float const x_168 = x_168_phi; + bool const x_169 = (x_160 > x_168); + if (x_153) { + x_147 = x_169; + } + if (true) { + } else { + guard155 = false; + } + if (guard155) { + guard155 = false; + } + } + } + if (x_153) { + x_179 = 0.0f; + x_180_phi = x_179; + } else { + x_178 = *(a); + x_180_phi = x_178; + } + float const x_180 = x_180_phi; + if (x_153) { + x_185 = 0.0f; + x_186_phi = x_185; + } else { + x_184 = *(b); + x_186_phi = x_184; + } + float const x_186 = x_186_phi; + if (x_153) { + } else { + x_147 = (x_180 < x_186); + } + bool const x_191 = x_147; + return x_191; +} + +void main_1(constant buf0& x_13, constant buf1& x_9, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int i = 0; + tint_array_wrapper data = {}; + int i_1 = 0; + int j = 0; + bool doSwap = false; + float param = 0.0f; + float param_1 = 0.0f; + float temp = 0.0f; + i = 0; + while (true) { + int const x_59 = i; + if ((x_59 < 10)) { + } else { + break; + } + int const x_62 = i; + int const x_63 = i; + float const x_67 = x_13.injectionSwitch.y; + data.arr[x_62] = (float((10 - x_63)) * x_67); + { + int const x_70 = i; + i = (x_70 + 1); + } + } + i_1 = 0; + while (true) { + int const x_76 = i_1; + if ((x_76 < 9)) { + } else { + break; + } + j = 0; + while (true) { + int const x_83 = j; + if ((x_83 < 10)) { + } else { + break; + } + int const x_86 = j; + int const x_87 = i_1; + if ((x_86 < (x_87 + 1))) { + { + int const x_113 = j; + j = (x_113 + 1); + } + continue; + } + int const x_92 = i_1; + int const x_93 = j; + float const x_95 = data.arr[x_92]; + param = x_95; + float const x_97 = data.arr[x_93]; + param_1 = x_97; + bool const x_98 = checkSwap_f1_f1_(x_9, &(param), &(param_1), tint_symbol_6); + doSwap = x_98; + bool const x_99 = doSwap; + if (x_99) { + int const x_102 = i_1; + float const x_104 = data.arr[x_102]; + temp = x_104; + int const x_105 = i_1; + int const x_106 = j; + float const x_108 = data.arr[x_106]; + data.arr[x_105] = x_108; + int const x_110 = j; + float const x_111 = temp; + data.arr[x_110] = x_111; + } + { + int const x_113 = j; + j = (x_113 + 1); + } + } + { + int const x_115 = i_1; + i_1 = (x_115 + 1); + } + } + float const x_118 = (*(tint_symbol_6)).x; + float const x_120 = x_9.resolution.x; + if ((x_118 < (x_120 / 2.0f))) { + float const x_127 = data.arr[0]; + float const x_130 = data.arr[5]; + float const x_133 = data.arr[9]; + *(tint_symbol_7) = float4((x_127 / 10.0f), (x_130 / 10.0f), (x_133 / 10.0f), 1.0f); + } else { + float const x_137 = data.arr[5]; + float const x_140 = data.arr[9]; + float const x_143 = data.arr[0]; + *(tint_symbol_7) = float4((x_137 / 10.0f), (x_140 / 10.0f), (x_143 / 10.0f), 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_13, x_9, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..75d9c10c03 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.spvasm @@ -0,0 +1,424 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 247 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_9 "x_9" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_13 "x_13" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %checkSwap_f1_f1_ "checkSwap_f1_f1_" + OpName %a "a" + OpName %b "b" + OpName %x_147 "x_147" + OpName %x_158 "x_158" + OpName %x_159 "x_159" + OpName %x_179 "x_179" + OpName %x_178 "x_178" + OpName %x_185 "x_185" + OpName %x_184 "x_184" + OpName %x_160_phi "x_160_phi" + OpName %x_180_phi "x_180_phi" + OpName %x_186_phi "x_186_phi" + OpName %x_166 "x_166" + OpName %x_167 "x_167" + OpName %x_168_phi "x_168_phi" + OpName %guard155 "guard155" + OpName %main_1 "main_1" + OpName %i "i" + OpName %data "data" + OpName %i_1 "i_1" + OpName %j "j" + OpName %doSwap "doSwap" + OpName %param "param" + OpName %param_1 "param_1" + OpName %temp "temp" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpTypeFunction %bool %_ptr_Function_float %_ptr_Function_float +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool + %29 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %void = OpTypeVoid + %109 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %116 = OpConstantNull %int + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %121 = OpConstantNull %_arr_float_uint_10 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %float_10 = OpConstant %float 10 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %234 = OpTypeFunction %void %main_out +%checkSwap_f1_f1_ = OpFunction %bool None %18 + %a = OpFunctionParameter %_ptr_Function_float + %b = OpFunctionParameter %_ptr_Function_float + %24 = OpLabel + %x_147 = OpVariable %_ptr_Function_bool Function %27 + %x_158 = OpVariable %_ptr_Function_float Function %29 + %x_159 = OpVariable %_ptr_Function_float Function %29 + %x_179 = OpVariable %_ptr_Function_float Function %29 + %x_178 = OpVariable %_ptr_Function_float Function %29 + %x_185 = OpVariable %_ptr_Function_float Function %29 + %x_184 = OpVariable %_ptr_Function_float Function %29 + %x_160_phi = OpVariable %_ptr_Function_float Function %29 + %x_180_phi = OpVariable %_ptr_Function_float Function %29 + %x_186_phi = OpVariable %_ptr_Function_float Function %29 + %x_166 = OpVariable %_ptr_Function_float Function %29 + %x_167 = OpVariable %_ptr_Function_float Function %29 + %x_168_phi = OpVariable %_ptr_Function_float Function %29 + %guard155 = OpVariable %_ptr_Function_bool Function %27 + %41 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %42 = OpLoad %float %41 + %45 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %46 = OpLoad %float %45 + %48 = OpFDiv %float %46 %float_2 + %49 = OpFOrdLessThan %bool %42 %48 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + %54 = OpLoad %float %a + OpStore %x_158 %54 + %55 = OpLoad %float %x_158 + OpStore %x_160_phi %55 + OpBranch %50 + %52 = OpLabel + OpStore %x_159 %float_0 + %57 = OpLoad %float %x_159 + OpStore %x_160_phi %57 + OpBranch %50 + %50 = OpLabel + %61 = OpLoad %float %x_160_phi + OpStore %guard155 %true + OpSelectionMerge %65 None + OpBranchConditional %false %66 %67 + %66 = OpLabel + OpBranch %65 + %67 = OpLabel + %68 = OpLoad %bool %guard155 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + OpSelectionMerge %71 None + OpBranchConditional %49 %72 %73 + %72 = OpLabel + %75 = OpLoad %float %b + OpStore %x_166 %75 + %76 = OpLoad %float %x_166 + OpStore %x_168_phi %76 + OpBranch %71 + %73 = OpLabel + OpStore %x_167 %float_0 + %77 = OpLoad %float %x_167 + OpStore %x_168_phi %77 + OpBranch %71 + %71 = OpLabel + %78 = OpLoad %float %x_168_phi + %79 = OpFOrdGreaterThan %bool %61 %78 + OpSelectionMerge %80 None + OpBranchConditional %49 %81 %80 + %81 = OpLabel + OpStore %x_147 %79 + OpBranch %80 + %80 = OpLabel + OpSelectionMerge %82 None + OpBranchConditional %true %83 %84 + %83 = OpLabel + OpBranch %82 + %84 = OpLabel + OpStore %guard155 %false + OpBranch %82 + %82 = OpLabel + %85 = OpLoad %bool %guard155 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + OpStore %guard155 %false + OpBranch %86 + %86 = OpLabel + OpBranch %69 + %69 = OpLabel + OpBranch %65 + %65 = OpLabel + OpSelectionMerge %88 None + OpBranchConditional %49 %89 %90 + %89 = OpLabel + OpStore %x_179 %float_0 + %91 = OpLoad %float %x_179 + OpStore %x_180_phi %91 + OpBranch %88 + %90 = OpLabel + %93 = OpLoad %float %a + OpStore %x_178 %93 + %94 = OpLoad %float %x_178 + OpStore %x_180_phi %94 + OpBranch %88 + %88 = OpLabel + %95 = OpLoad %float %x_180_phi + OpSelectionMerge %96 None + OpBranchConditional %49 %97 %98 + %97 = OpLabel + OpStore %x_185 %float_0 + %99 = OpLoad %float %x_185 + OpStore %x_186_phi %99 + OpBranch %96 + %98 = OpLabel + %101 = OpLoad %float %b + OpStore %x_184 %101 + %102 = OpLoad %float %x_184 + OpStore %x_186_phi %102 + OpBranch %96 + %96 = OpLabel + %103 = OpLoad %float %x_186_phi + OpSelectionMerge %104 None + OpBranchConditional %49 %105 %106 + %105 = OpLabel + OpBranch %104 + %106 = OpLabel + %107 = OpFOrdLessThan %bool %95 %103 + OpStore %x_147 %107 + OpBranch %104 + %104 = OpLabel + %108 = OpLoad %bool %x_147 + OpReturnValue %108 + OpFunctionEnd + %main_1 = OpFunction %void None %109 + %112 = OpLabel + %i = OpVariable %_ptr_Function_int Function %116 + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function %121 + %i_1 = OpVariable %_ptr_Function_int Function %116 + %j = OpVariable %_ptr_Function_int Function %116 + %doSwap = OpVariable %_ptr_Function_bool Function %27 + %param = OpVariable %_ptr_Function_float Function %29 + %param_1 = OpVariable %_ptr_Function_float Function %29 + %temp = OpVariable %_ptr_Function_float Function %29 + OpStore %i %int_0 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %133 = OpLoad %int %i + %135 = OpSLessThan %bool %133 %int_10 + OpSelectionMerge %136 None + OpBranchConditional %135 %137 %138 + %137 = OpLabel + OpBranch %136 + %138 = OpLabel + OpBranch %130 + %136 = OpLabel + %139 = OpLoad %int %i + %140 = OpLoad %int %i + %141 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_1 + %142 = OpLoad %float %141 + %143 = OpAccessChain %_ptr_Function_float %data %139 + %145 = OpISub %int %int_10 %140 + %144 = OpConvertSToF %float %145 + %146 = OpFMul %float %144 %142 + OpStore %143 %146 + OpBranch %131 + %131 = OpLabel + %147 = OpLoad %int %i + %149 = OpIAdd %int %147 %int_1 + OpStore %i %149 + OpBranch %129 + %130 = OpLabel + OpStore %i_1 %int_0 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %154 = OpLoad %int %i_1 + %156 = OpSLessThan %bool %154 %int_9 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %159 + %158 = OpLabel + OpBranch %157 + %159 = OpLabel + OpBranch %151 + %157 = OpLabel + OpStore %j %int_0 + OpBranch %160 + %160 = OpLabel + OpLoopMerge %161 %162 None + OpBranch %163 + %163 = OpLabel + %164 = OpLoad %int %j + %165 = OpSLessThan %bool %164 %int_10 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %168 + %167 = OpLabel + OpBranch %166 + %168 = OpLabel + OpBranch %161 + %166 = OpLabel + %169 = OpLoad %int %j + %170 = OpLoad %int %i_1 + %171 = OpIAdd %int %170 %int_1 + %172 = OpSLessThan %bool %169 %171 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %173 + %174 = OpLabel + OpBranch %162 + %173 = OpLabel + %175 = OpLoad %int %i_1 + %176 = OpLoad %int %j + %177 = OpAccessChain %_ptr_Function_float %data %175 + %178 = OpLoad %float %177 + OpStore %param %178 + %179 = OpAccessChain %_ptr_Function_float %data %176 + %180 = OpLoad %float %179 + OpStore %param_1 %180 + %181 = OpFunctionCall %bool %checkSwap_f1_f1_ %param %param_1 + OpStore %doSwap %181 + %184 = OpLoad %bool %doSwap + OpSelectionMerge %185 None + OpBranchConditional %184 %186 %185 + %186 = OpLabel + %187 = OpLoad %int %i_1 + %188 = OpAccessChain %_ptr_Function_float %data %187 + %189 = OpLoad %float %188 + OpStore %temp %189 + %190 = OpLoad %int %i_1 + %191 = OpLoad %int %j + %192 = OpAccessChain %_ptr_Function_float %data %191 + %193 = OpLoad %float %192 + %194 = OpAccessChain %_ptr_Function_float %data %190 + OpStore %194 %193 + %195 = OpLoad %int %j + %196 = OpLoad %float %temp + %197 = OpAccessChain %_ptr_Function_float %data %195 + OpStore %197 %196 + OpBranch %185 + %185 = OpLabel + OpBranch %162 + %162 = OpLabel + %198 = OpLoad %int %j + %199 = OpIAdd %int %198 %int_1 + OpStore %j %199 + OpBranch %160 + %161 = OpLabel + OpBranch %152 + %152 = OpLabel + %200 = OpLoad %int %i_1 + %201 = OpIAdd %int %200 %int_1 + OpStore %i_1 %201 + OpBranch %150 + %151 = OpLabel + %202 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %203 = OpLoad %float %202 + %204 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %205 = OpLoad %float %204 + %206 = OpFDiv %float %205 %float_2 + %207 = OpFOrdLessThan %bool %203 %206 + OpSelectionMerge %208 None + OpBranchConditional %207 %209 %210 + %209 = OpLabel + %211 = OpAccessChain %_ptr_Function_float %data %int_0 + %212 = OpLoad %float %211 + %214 = OpAccessChain %_ptr_Function_float %data %int_5 + %215 = OpLoad %float %214 + %216 = OpAccessChain %_ptr_Function_float %data %int_9 + %217 = OpLoad %float %216 + %219 = OpFDiv %float %212 %float_10 + %220 = OpFDiv %float %215 %float_10 + %221 = OpFDiv %float %217 %float_10 + %223 = OpCompositeConstruct %v4float %219 %220 %221 %float_1 + OpStore %x_GLF_color %223 + OpBranch %208 + %210 = OpLabel + %224 = OpAccessChain %_ptr_Function_float %data %int_5 + %225 = OpLoad %float %224 + %226 = OpAccessChain %_ptr_Function_float %data %int_9 + %227 = OpLoad %float %226 + %228 = OpAccessChain %_ptr_Function_float %data %int_0 + %229 = OpLoad %float %228 + %230 = OpFDiv %float %225 %float_10 + %231 = OpFDiv %float %227 %float_10 + %232 = OpFDiv %float %229 %float_10 + %233 = OpCompositeConstruct %v4float %230 %231 %232 %float_1 + OpStore %x_GLF_color %233 + OpBranch %208 + %208 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %234 +%tint_symbol_1 = OpFunctionParameter %main_out + %238 = OpLabel + %239 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %239 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %109 + %241 = OpLabel + %242 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %242 + %243 = OpFunctionCall %void %main_1 + %245 = OpLoad %v4float %x_GLF_color + %246 = OpCompositeConstruct %main_out %245 + %244 = OpFunctionCall %void %tint_symbol_3 %246 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..6e36ff77b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.spvasm.expected.wgsl @@ -0,0 +1,197 @@ +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +[[group(0), binding(0)]] var x_13 : buf0; + +var x_GLF_color : vec4; + +fn checkSwap_f1_f1_(a : ptr, b : ptr) -> bool { + var x_147 : bool; + var x_158 : f32; + var x_159 : f32; + var x_179 : f32; + var x_178 : f32; + var x_185 : f32; + var x_184 : f32; + var x_160_phi : f32; + var x_180_phi : f32; + var x_186_phi : f32; + let x_149 : f32 = gl_FragCoord.y; + let x_151 : f32 = x_9.resolution.y; + let x_153 : bool = (x_149 < (x_151 / 2.0)); + if (x_153) { + x_158 = *(a); + x_160_phi = x_158; + } else { + x_159 = 0.0; + x_160_phi = x_159; + } + var x_166 : f32; + var x_167 : f32; + var x_168_phi : f32; + let x_160 : f32 = x_160_phi; + var guard155 : bool = true; + if (false) { + } else { + if (guard155) { + if (x_153) { + x_166 = *(b); + x_168_phi = x_166; + } else { + x_167 = 0.0; + x_168_phi = x_167; + } + let x_168 : f32 = x_168_phi; + let x_169 : bool = (x_160 > x_168); + if (x_153) { + x_147 = x_169; + } + if (true) { + } else { + guard155 = false; + } + if (guard155) { + guard155 = false; + } + } + } + if (x_153) { + x_179 = 0.0; + x_180_phi = x_179; + } else { + x_178 = *(a); + x_180_phi = x_178; + } + let x_180 : f32 = x_180_phi; + if (x_153) { + x_185 = 0.0; + x_186_phi = x_185; + } else { + x_184 = *(b); + x_186_phi = x_184; + } + let x_186 : f32 = x_186_phi; + if (x_153) { + } else { + x_147 = (x_180 < x_186); + } + let x_191 : bool = x_147; + return x_191; +} + +fn main_1() { + var i : i32; + var data : array; + var i_1 : i32; + var j : i32; + var doSwap : bool; + var param : f32; + var param_1 : f32; + var temp : f32; + i = 0; + loop { + let x_59 : i32 = i; + if ((x_59 < 10)) { + } else { + break; + } + let x_62 : i32 = i; + let x_63 : i32 = i; + let x_67 : f32 = x_13.injectionSwitch.y; + data[x_62] = (f32((10 - x_63)) * x_67); + + continuing { + let x_70 : i32 = i; + i = (x_70 + 1); + } + } + i_1 = 0; + loop { + let x_76 : i32 = i_1; + if ((x_76 < 9)) { + } else { + break; + } + j = 0; + loop { + let x_83 : i32 = j; + if ((x_83 < 10)) { + } else { + break; + } + let x_86 : i32 = j; + let x_87 : i32 = i_1; + if ((x_86 < (x_87 + 1))) { + continue; + } + let x_92 : i32 = i_1; + let x_93 : i32 = j; + let x_95 : f32 = data[x_92]; + param = x_95; + let x_97 : f32 = data[x_93]; + param_1 = x_97; + let x_98 : bool = checkSwap_f1_f1_(&(param), &(param_1)); + doSwap = x_98; + let x_99 : bool = doSwap; + if (x_99) { + let x_102 : i32 = i_1; + let x_104 : f32 = data[x_102]; + temp = x_104; + let x_105 : i32 = i_1; + let x_106 : i32 = j; + let x_108 : f32 = data[x_106]; + data[x_105] = x_108; + let x_110 : i32 = j; + let x_111 : f32 = temp; + data[x_110] = x_111; + } + + continuing { + let x_113 : i32 = j; + j = (x_113 + 1); + } + } + + continuing { + let x_115 : i32 = i_1; + i_1 = (x_115 + 1); + } + } + let x_118 : f32 = gl_FragCoord.x; + let x_120 : f32 = x_9.resolution.x; + if ((x_118 < (x_120 / 2.0))) { + let x_127 : f32 = data[0]; + let x_130 : f32 = data[5]; + let x_133 : f32 = data[9]; + x_GLF_color = vec4((x_127 / 10.0), (x_130 / 10.0), (x_133 / 10.0), 1.0); + } else { + let x_137 : f32 = data[5]; + let x_140 : f32 = data[9]; + let x_143 : f32 = data[0]; + x_GLF_color = vec4((x_137 / 10.0), (x_140 / 10.0), (x_143 / 10.0), 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl new file mode 100644 index 0000000000..6e36ff77b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl @@ -0,0 +1,197 @@ +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +[[group(0), binding(0)]] var x_13 : buf0; + +var x_GLF_color : vec4; + +fn checkSwap_f1_f1_(a : ptr, b : ptr) -> bool { + var x_147 : bool; + var x_158 : f32; + var x_159 : f32; + var x_179 : f32; + var x_178 : f32; + var x_185 : f32; + var x_184 : f32; + var x_160_phi : f32; + var x_180_phi : f32; + var x_186_phi : f32; + let x_149 : f32 = gl_FragCoord.y; + let x_151 : f32 = x_9.resolution.y; + let x_153 : bool = (x_149 < (x_151 / 2.0)); + if (x_153) { + x_158 = *(a); + x_160_phi = x_158; + } else { + x_159 = 0.0; + x_160_phi = x_159; + } + var x_166 : f32; + var x_167 : f32; + var x_168_phi : f32; + let x_160 : f32 = x_160_phi; + var guard155 : bool = true; + if (false) { + } else { + if (guard155) { + if (x_153) { + x_166 = *(b); + x_168_phi = x_166; + } else { + x_167 = 0.0; + x_168_phi = x_167; + } + let x_168 : f32 = x_168_phi; + let x_169 : bool = (x_160 > x_168); + if (x_153) { + x_147 = x_169; + } + if (true) { + } else { + guard155 = false; + } + if (guard155) { + guard155 = false; + } + } + } + if (x_153) { + x_179 = 0.0; + x_180_phi = x_179; + } else { + x_178 = *(a); + x_180_phi = x_178; + } + let x_180 : f32 = x_180_phi; + if (x_153) { + x_185 = 0.0; + x_186_phi = x_185; + } else { + x_184 = *(b); + x_186_phi = x_184; + } + let x_186 : f32 = x_186_phi; + if (x_153) { + } else { + x_147 = (x_180 < x_186); + } + let x_191 : bool = x_147; + return x_191; +} + +fn main_1() { + var i : i32; + var data : array; + var i_1 : i32; + var j : i32; + var doSwap : bool; + var param : f32; + var param_1 : f32; + var temp : f32; + i = 0; + loop { + let x_59 : i32 = i; + if ((x_59 < 10)) { + } else { + break; + } + let x_62 : i32 = i; + let x_63 : i32 = i; + let x_67 : f32 = x_13.injectionSwitch.y; + data[x_62] = (f32((10 - x_63)) * x_67); + + continuing { + let x_70 : i32 = i; + i = (x_70 + 1); + } + } + i_1 = 0; + loop { + let x_76 : i32 = i_1; + if ((x_76 < 9)) { + } else { + break; + } + j = 0; + loop { + let x_83 : i32 = j; + if ((x_83 < 10)) { + } else { + break; + } + let x_86 : i32 = j; + let x_87 : i32 = i_1; + if ((x_86 < (x_87 + 1))) { + continue; + } + let x_92 : i32 = i_1; + let x_93 : i32 = j; + let x_95 : f32 = data[x_92]; + param = x_95; + let x_97 : f32 = data[x_93]; + param_1 = x_97; + let x_98 : bool = checkSwap_f1_f1_(&(param), &(param_1)); + doSwap = x_98; + let x_99 : bool = doSwap; + if (x_99) { + let x_102 : i32 = i_1; + let x_104 : f32 = data[x_102]; + temp = x_104; + let x_105 : i32 = i_1; + let x_106 : i32 = j; + let x_108 : f32 = data[x_106]; + data[x_105] = x_108; + let x_110 : i32 = j; + let x_111 : f32 = temp; + data[x_110] = x_111; + } + + continuing { + let x_113 : i32 = j; + j = (x_113 + 1); + } + } + + continuing { + let x_115 : i32 = i_1; + i_1 = (x_115 + 1); + } + } + let x_118 : f32 = gl_FragCoord.x; + let x_120 : f32 = x_9.resolution.x; + if ((x_118 < (x_120 / 2.0))) { + let x_127 : f32 = data[0]; + let x_130 : f32 = data[5]; + let x_133 : f32 = data[9]; + x_GLF_color = vec4((x_127 / 10.0), (x_130 / 10.0), (x_133 / 10.0), 1.0); + } else { + let x_137 : f32 = data[5]; + let x_140 : f32 = data[9]; + let x_143 : f32 = data[0]; + x_GLF_color = vec4((x_137 / 10.0), (x_140 / 10.0), (x_143 / 10.0), 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..8afa23d312 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.hlsl @@ -0,0 +1,161 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[1]; +}; +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +bool checkSwap_f1_f1_(inout float a, inout float b) { + bool x_147 = false; + float x_158 = 0.0f; + float x_159 = 0.0f; + float x_179 = 0.0f; + float x_178 = 0.0f; + float x_185 = 0.0f; + float x_184 = 0.0f; + float x_160_phi = 0.0f; + float x_180_phi = 0.0f; + float x_186_phi = 0.0f; + const float x_149 = gl_FragCoord.y; + const float x_151 = asfloat(x_9[0].y); + const bool x_153 = (x_149 < (x_151 / 2.0f)); + if (x_153) { + x_158 = a; + x_160_phi = x_158; + } else { + x_159 = 0.0f; + x_160_phi = x_159; + } + float x_166 = 0.0f; + float x_167 = 0.0f; + float x_168_phi = 0.0f; + const float x_160 = x_160_phi; + bool guard155 = true; + if (false) { + } else { + if (guard155) { + if (x_153) { + x_166 = b; + x_168_phi = x_166; + } else { + x_167 = 0.0f; + x_168_phi = x_167; + } + const bool x_169 = (x_160 > x_168_phi); + if (x_153) { + x_147 = x_169; + } + if (true) { + } else { + guard155 = false; + } + if (guard155) { + guard155 = false; + } + } + } + if (x_153) { + x_179 = 0.0f; + x_180_phi = x_179; + } else { + x_178 = a; + x_180_phi = x_178; + } + const float x_180 = x_180_phi; + if (x_153) { + x_185 = 0.0f; + x_186_phi = x_185; + } else { + x_184 = b; + x_186_phi = x_184; + } + const float x_186 = x_186_phi; + if (x_153) { + } else { + x_147 = (x_180 < x_186); + } + return x_147; +} + +void main_1() { + int i = 0; + float data[10] = (float[10])0; + int i_1 = 0; + int j = 0; + bool doSwap = false; + float param = 0.0f; + float param_1 = 0.0f; + float temp = 0.0f; + i = 0; + { + for(; (i < 10); i = (i + 1)) { + const int x_62 = i; + const int x_63 = i; + const float x_67 = asfloat(x_13[0].y); + data[x_62] = (float((10 - x_63)) * x_67); + } + } + i_1 = 0; + { + for(; (i_1 < 9); i_1 = (i_1 + 1)) { + j = 0; + { + for(; (j < 10); j = (j + 1)) { + if ((j < (i_1 + 1))) { + continue; + } + const int x_93 = j; + const float x_95 = data[i_1]; + param = x_95; + const float x_97 = data[x_93]; + param_1 = x_97; + const bool x_98 = checkSwap_f1_f1_(param, param_1); + doSwap = x_98; + if (doSwap) { + const float x_104 = data[i_1]; + temp = x_104; + const int x_105 = i_1; + const float x_108 = data[j]; + data[x_105] = x_108; + data[j] = temp; + } + } + } + } + } + const float x_118 = gl_FragCoord.x; + const float x_120 = asfloat(x_9[0].x); + if ((x_118 < (x_120 / 2.0f))) { + const float x_127 = data[0]; + const float x_130 = data[5]; + const float x_133 = data[9]; + x_GLF_color = float4((x_127 / 10.0f), (x_130 / 10.0f), (x_133 / 10.0f), 1.0f); + } else { + const float x_137 = data[5]; + const float x_140 = data[9]; + const float x_143 = data[0]; + x_GLF_color = float4((x_137 / 10.0f), (x_140 / 10.0f), (x_143 / 10.0f), 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.msl new file mode 100644 index 0000000000..3475e4507b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.msl @@ -0,0 +1,198 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +bool checkSwap_f1_f1_(constant buf1& x_9, thread float* const a, thread float* const b, thread float4* const tint_symbol_5) { + bool x_147 = false; + float x_158 = 0.0f; + float x_159 = 0.0f; + float x_179 = 0.0f; + float x_178 = 0.0f; + float x_185 = 0.0f; + float x_184 = 0.0f; + float x_160_phi = 0.0f; + float x_180_phi = 0.0f; + float x_186_phi = 0.0f; + float const x_149 = (*(tint_symbol_5)).y; + float const x_151 = x_9.resolution.y; + bool const x_153 = (x_149 < (x_151 / 2.0f)); + if (x_153) { + x_158 = *(a); + x_160_phi = x_158; + } else { + x_159 = 0.0f; + x_160_phi = x_159; + } + float x_166 = 0.0f; + float x_167 = 0.0f; + float x_168_phi = 0.0f; + float const x_160 = x_160_phi; + bool guard155 = true; + if (false) { + } else { + if (guard155) { + if (x_153) { + x_166 = *(b); + x_168_phi = x_166; + } else { + x_167 = 0.0f; + x_168_phi = x_167; + } + float const x_168 = x_168_phi; + bool const x_169 = (x_160 > x_168); + if (x_153) { + x_147 = x_169; + } + if (true) { + } else { + guard155 = false; + } + if (guard155) { + guard155 = false; + } + } + } + if (x_153) { + x_179 = 0.0f; + x_180_phi = x_179; + } else { + x_178 = *(a); + x_180_phi = x_178; + } + float const x_180 = x_180_phi; + if (x_153) { + x_185 = 0.0f; + x_186_phi = x_185; + } else { + x_184 = *(b); + x_186_phi = x_184; + } + float const x_186 = x_186_phi; + if (x_153) { + } else { + x_147 = (x_180 < x_186); + } + bool const x_191 = x_147; + return x_191; +} + +void main_1(constant buf0& x_13, constant buf1& x_9, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int i = 0; + tint_array_wrapper data = {}; + int i_1 = 0; + int j = 0; + bool doSwap = false; + float param = 0.0f; + float param_1 = 0.0f; + float temp = 0.0f; + i = 0; + while (true) { + int const x_59 = i; + if ((x_59 < 10)) { + } else { + break; + } + int const x_62 = i; + int const x_63 = i; + float const x_67 = x_13.injectionSwitch.y; + data.arr[x_62] = (float((10 - x_63)) * x_67); + { + int const x_70 = i; + i = (x_70 + 1); + } + } + i_1 = 0; + while (true) { + int const x_76 = i_1; + if ((x_76 < 9)) { + } else { + break; + } + j = 0; + while (true) { + int const x_83 = j; + if ((x_83 < 10)) { + } else { + break; + } + int const x_86 = j; + int const x_87 = i_1; + if ((x_86 < (x_87 + 1))) { + { + int const x_113 = j; + j = (x_113 + 1); + } + continue; + } + int const x_92 = i_1; + int const x_93 = j; + float const x_95 = data.arr[x_92]; + param = x_95; + float const x_97 = data.arr[x_93]; + param_1 = x_97; + bool const x_98 = checkSwap_f1_f1_(x_9, &(param), &(param_1), tint_symbol_6); + doSwap = x_98; + bool const x_99 = doSwap; + if (x_99) { + int const x_102 = i_1; + float const x_104 = data.arr[x_102]; + temp = x_104; + int const x_105 = i_1; + int const x_106 = j; + float const x_108 = data.arr[x_106]; + data.arr[x_105] = x_108; + int const x_110 = j; + float const x_111 = temp; + data.arr[x_110] = x_111; + } + { + int const x_113 = j; + j = (x_113 + 1); + } + } + { + int const x_115 = i_1; + i_1 = (x_115 + 1); + } + } + float const x_118 = (*(tint_symbol_6)).x; + float const x_120 = x_9.resolution.x; + if ((x_118 < (x_120 / 2.0f))) { + float const x_127 = data.arr[0]; + float const x_130 = data.arr[5]; + float const x_133 = data.arr[9]; + *(tint_symbol_7) = float4((x_127 / 10.0f), (x_130 / 10.0f), (x_133 / 10.0f), 1.0f); + } else { + float const x_137 = data.arr[5]; + float const x_140 = data.arr[9]; + float const x_143 = data.arr[0]; + *(tint_symbol_7) = float4((x_137 / 10.0f), (x_140 / 10.0f), (x_143 / 10.0f), 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_13, x_9, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..75d9c10c03 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.spvasm @@ -0,0 +1,424 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 247 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_9 "x_9" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_13 "x_13" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %checkSwap_f1_f1_ "checkSwap_f1_f1_" + OpName %a "a" + OpName %b "b" + OpName %x_147 "x_147" + OpName %x_158 "x_158" + OpName %x_159 "x_159" + OpName %x_179 "x_179" + OpName %x_178 "x_178" + OpName %x_185 "x_185" + OpName %x_184 "x_184" + OpName %x_160_phi "x_160_phi" + OpName %x_180_phi "x_180_phi" + OpName %x_186_phi "x_186_phi" + OpName %x_166 "x_166" + OpName %x_167 "x_167" + OpName %x_168_phi "x_168_phi" + OpName %guard155 "guard155" + OpName %main_1 "main_1" + OpName %i "i" + OpName %data "data" + OpName %i_1 "i_1" + OpName %j "j" + OpName %doSwap "doSwap" + OpName %param "param" + OpName %param_1 "param_1" + OpName %temp "temp" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_9 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpTypeFunction %bool %_ptr_Function_float %_ptr_Function_float +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool + %29 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %void = OpTypeVoid + %109 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %116 = OpConstantNull %int + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %121 = OpConstantNull %_arr_float_uint_10 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %float_10 = OpConstant %float 10 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %234 = OpTypeFunction %void %main_out +%checkSwap_f1_f1_ = OpFunction %bool None %18 + %a = OpFunctionParameter %_ptr_Function_float + %b = OpFunctionParameter %_ptr_Function_float + %24 = OpLabel + %x_147 = OpVariable %_ptr_Function_bool Function %27 + %x_158 = OpVariable %_ptr_Function_float Function %29 + %x_159 = OpVariable %_ptr_Function_float Function %29 + %x_179 = OpVariable %_ptr_Function_float Function %29 + %x_178 = OpVariable %_ptr_Function_float Function %29 + %x_185 = OpVariable %_ptr_Function_float Function %29 + %x_184 = OpVariable %_ptr_Function_float Function %29 + %x_160_phi = OpVariable %_ptr_Function_float Function %29 + %x_180_phi = OpVariable %_ptr_Function_float Function %29 + %x_186_phi = OpVariable %_ptr_Function_float Function %29 + %x_166 = OpVariable %_ptr_Function_float Function %29 + %x_167 = OpVariable %_ptr_Function_float Function %29 + %x_168_phi = OpVariable %_ptr_Function_float Function %29 + %guard155 = OpVariable %_ptr_Function_bool Function %27 + %41 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %42 = OpLoad %float %41 + %45 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %46 = OpLoad %float %45 + %48 = OpFDiv %float %46 %float_2 + %49 = OpFOrdLessThan %bool %42 %48 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %52 + %51 = OpLabel + %54 = OpLoad %float %a + OpStore %x_158 %54 + %55 = OpLoad %float %x_158 + OpStore %x_160_phi %55 + OpBranch %50 + %52 = OpLabel + OpStore %x_159 %float_0 + %57 = OpLoad %float %x_159 + OpStore %x_160_phi %57 + OpBranch %50 + %50 = OpLabel + %61 = OpLoad %float %x_160_phi + OpStore %guard155 %true + OpSelectionMerge %65 None + OpBranchConditional %false %66 %67 + %66 = OpLabel + OpBranch %65 + %67 = OpLabel + %68 = OpLoad %bool %guard155 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + OpSelectionMerge %71 None + OpBranchConditional %49 %72 %73 + %72 = OpLabel + %75 = OpLoad %float %b + OpStore %x_166 %75 + %76 = OpLoad %float %x_166 + OpStore %x_168_phi %76 + OpBranch %71 + %73 = OpLabel + OpStore %x_167 %float_0 + %77 = OpLoad %float %x_167 + OpStore %x_168_phi %77 + OpBranch %71 + %71 = OpLabel + %78 = OpLoad %float %x_168_phi + %79 = OpFOrdGreaterThan %bool %61 %78 + OpSelectionMerge %80 None + OpBranchConditional %49 %81 %80 + %81 = OpLabel + OpStore %x_147 %79 + OpBranch %80 + %80 = OpLabel + OpSelectionMerge %82 None + OpBranchConditional %true %83 %84 + %83 = OpLabel + OpBranch %82 + %84 = OpLabel + OpStore %guard155 %false + OpBranch %82 + %82 = OpLabel + %85 = OpLoad %bool %guard155 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + OpStore %guard155 %false + OpBranch %86 + %86 = OpLabel + OpBranch %69 + %69 = OpLabel + OpBranch %65 + %65 = OpLabel + OpSelectionMerge %88 None + OpBranchConditional %49 %89 %90 + %89 = OpLabel + OpStore %x_179 %float_0 + %91 = OpLoad %float %x_179 + OpStore %x_180_phi %91 + OpBranch %88 + %90 = OpLabel + %93 = OpLoad %float %a + OpStore %x_178 %93 + %94 = OpLoad %float %x_178 + OpStore %x_180_phi %94 + OpBranch %88 + %88 = OpLabel + %95 = OpLoad %float %x_180_phi + OpSelectionMerge %96 None + OpBranchConditional %49 %97 %98 + %97 = OpLabel + OpStore %x_185 %float_0 + %99 = OpLoad %float %x_185 + OpStore %x_186_phi %99 + OpBranch %96 + %98 = OpLabel + %101 = OpLoad %float %b + OpStore %x_184 %101 + %102 = OpLoad %float %x_184 + OpStore %x_186_phi %102 + OpBranch %96 + %96 = OpLabel + %103 = OpLoad %float %x_186_phi + OpSelectionMerge %104 None + OpBranchConditional %49 %105 %106 + %105 = OpLabel + OpBranch %104 + %106 = OpLabel + %107 = OpFOrdLessThan %bool %95 %103 + OpStore %x_147 %107 + OpBranch %104 + %104 = OpLabel + %108 = OpLoad %bool %x_147 + OpReturnValue %108 + OpFunctionEnd + %main_1 = OpFunction %void None %109 + %112 = OpLabel + %i = OpVariable %_ptr_Function_int Function %116 + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function %121 + %i_1 = OpVariable %_ptr_Function_int Function %116 + %j = OpVariable %_ptr_Function_int Function %116 + %doSwap = OpVariable %_ptr_Function_bool Function %27 + %param = OpVariable %_ptr_Function_float Function %29 + %param_1 = OpVariable %_ptr_Function_float Function %29 + %temp = OpVariable %_ptr_Function_float Function %29 + OpStore %i %int_0 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %133 = OpLoad %int %i + %135 = OpSLessThan %bool %133 %int_10 + OpSelectionMerge %136 None + OpBranchConditional %135 %137 %138 + %137 = OpLabel + OpBranch %136 + %138 = OpLabel + OpBranch %130 + %136 = OpLabel + %139 = OpLoad %int %i + %140 = OpLoad %int %i + %141 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_1 + %142 = OpLoad %float %141 + %143 = OpAccessChain %_ptr_Function_float %data %139 + %145 = OpISub %int %int_10 %140 + %144 = OpConvertSToF %float %145 + %146 = OpFMul %float %144 %142 + OpStore %143 %146 + OpBranch %131 + %131 = OpLabel + %147 = OpLoad %int %i + %149 = OpIAdd %int %147 %int_1 + OpStore %i %149 + OpBranch %129 + %130 = OpLabel + OpStore %i_1 %int_0 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %154 = OpLoad %int %i_1 + %156 = OpSLessThan %bool %154 %int_9 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %159 + %158 = OpLabel + OpBranch %157 + %159 = OpLabel + OpBranch %151 + %157 = OpLabel + OpStore %j %int_0 + OpBranch %160 + %160 = OpLabel + OpLoopMerge %161 %162 None + OpBranch %163 + %163 = OpLabel + %164 = OpLoad %int %j + %165 = OpSLessThan %bool %164 %int_10 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %168 + %167 = OpLabel + OpBranch %166 + %168 = OpLabel + OpBranch %161 + %166 = OpLabel + %169 = OpLoad %int %j + %170 = OpLoad %int %i_1 + %171 = OpIAdd %int %170 %int_1 + %172 = OpSLessThan %bool %169 %171 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %173 + %174 = OpLabel + OpBranch %162 + %173 = OpLabel + %175 = OpLoad %int %i_1 + %176 = OpLoad %int %j + %177 = OpAccessChain %_ptr_Function_float %data %175 + %178 = OpLoad %float %177 + OpStore %param %178 + %179 = OpAccessChain %_ptr_Function_float %data %176 + %180 = OpLoad %float %179 + OpStore %param_1 %180 + %181 = OpFunctionCall %bool %checkSwap_f1_f1_ %param %param_1 + OpStore %doSwap %181 + %184 = OpLoad %bool %doSwap + OpSelectionMerge %185 None + OpBranchConditional %184 %186 %185 + %186 = OpLabel + %187 = OpLoad %int %i_1 + %188 = OpAccessChain %_ptr_Function_float %data %187 + %189 = OpLoad %float %188 + OpStore %temp %189 + %190 = OpLoad %int %i_1 + %191 = OpLoad %int %j + %192 = OpAccessChain %_ptr_Function_float %data %191 + %193 = OpLoad %float %192 + %194 = OpAccessChain %_ptr_Function_float %data %190 + OpStore %194 %193 + %195 = OpLoad %int %j + %196 = OpLoad %float %temp + %197 = OpAccessChain %_ptr_Function_float %data %195 + OpStore %197 %196 + OpBranch %185 + %185 = OpLabel + OpBranch %162 + %162 = OpLabel + %198 = OpLoad %int %j + %199 = OpIAdd %int %198 %int_1 + OpStore %j %199 + OpBranch %160 + %161 = OpLabel + OpBranch %152 + %152 = OpLabel + %200 = OpLoad %int %i_1 + %201 = OpIAdd %int %200 %int_1 + OpStore %i_1 %201 + OpBranch %150 + %151 = OpLabel + %202 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %203 = OpLoad %float %202 + %204 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %205 = OpLoad %float %204 + %206 = OpFDiv %float %205 %float_2 + %207 = OpFOrdLessThan %bool %203 %206 + OpSelectionMerge %208 None + OpBranchConditional %207 %209 %210 + %209 = OpLabel + %211 = OpAccessChain %_ptr_Function_float %data %int_0 + %212 = OpLoad %float %211 + %214 = OpAccessChain %_ptr_Function_float %data %int_5 + %215 = OpLoad %float %214 + %216 = OpAccessChain %_ptr_Function_float %data %int_9 + %217 = OpLoad %float %216 + %219 = OpFDiv %float %212 %float_10 + %220 = OpFDiv %float %215 %float_10 + %221 = OpFDiv %float %217 %float_10 + %223 = OpCompositeConstruct %v4float %219 %220 %221 %float_1 + OpStore %x_GLF_color %223 + OpBranch %208 + %210 = OpLabel + %224 = OpAccessChain %_ptr_Function_float %data %int_5 + %225 = OpLoad %float %224 + %226 = OpAccessChain %_ptr_Function_float %data %int_9 + %227 = OpLoad %float %226 + %228 = OpAccessChain %_ptr_Function_float %data %int_0 + %229 = OpLoad %float %228 + %230 = OpFDiv %float %225 %float_10 + %231 = OpFDiv %float %227 %float_10 + %232 = OpFDiv %float %229 %float_10 + %233 = OpCompositeConstruct %v4float %230 %231 %232 %float_1 + OpStore %x_GLF_color %233 + OpBranch %208 + %208 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %234 +%tint_symbol_1 = OpFunctionParameter %main_out + %238 = OpLabel + %239 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %239 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %109 + %241 = OpLabel + %242 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %242 + %243 = OpFunctionCall %void %main_1 + %245 = OpLoad %v4float %x_GLF_color + %246 = OpCompositeConstruct %main_out %245 + %244 = OpFunctionCall %void %tint_symbol_3 %246 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..6e36ff77b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-bubblesort-flag-complex-conditionals/1.wgsl.expected.wgsl @@ -0,0 +1,197 @@ +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf1; + +[[group(0), binding(0)]] var x_13 : buf0; + +var x_GLF_color : vec4; + +fn checkSwap_f1_f1_(a : ptr, b : ptr) -> bool { + var x_147 : bool; + var x_158 : f32; + var x_159 : f32; + var x_179 : f32; + var x_178 : f32; + var x_185 : f32; + var x_184 : f32; + var x_160_phi : f32; + var x_180_phi : f32; + var x_186_phi : f32; + let x_149 : f32 = gl_FragCoord.y; + let x_151 : f32 = x_9.resolution.y; + let x_153 : bool = (x_149 < (x_151 / 2.0)); + if (x_153) { + x_158 = *(a); + x_160_phi = x_158; + } else { + x_159 = 0.0; + x_160_phi = x_159; + } + var x_166 : f32; + var x_167 : f32; + var x_168_phi : f32; + let x_160 : f32 = x_160_phi; + var guard155 : bool = true; + if (false) { + } else { + if (guard155) { + if (x_153) { + x_166 = *(b); + x_168_phi = x_166; + } else { + x_167 = 0.0; + x_168_phi = x_167; + } + let x_168 : f32 = x_168_phi; + let x_169 : bool = (x_160 > x_168); + if (x_153) { + x_147 = x_169; + } + if (true) { + } else { + guard155 = false; + } + if (guard155) { + guard155 = false; + } + } + } + if (x_153) { + x_179 = 0.0; + x_180_phi = x_179; + } else { + x_178 = *(a); + x_180_phi = x_178; + } + let x_180 : f32 = x_180_phi; + if (x_153) { + x_185 = 0.0; + x_186_phi = x_185; + } else { + x_184 = *(b); + x_186_phi = x_184; + } + let x_186 : f32 = x_186_phi; + if (x_153) { + } else { + x_147 = (x_180 < x_186); + } + let x_191 : bool = x_147; + return x_191; +} + +fn main_1() { + var i : i32; + var data : array; + var i_1 : i32; + var j : i32; + var doSwap : bool; + var param : f32; + var param_1 : f32; + var temp : f32; + i = 0; + loop { + let x_59 : i32 = i; + if ((x_59 < 10)) { + } else { + break; + } + let x_62 : i32 = i; + let x_63 : i32 = i; + let x_67 : f32 = x_13.injectionSwitch.y; + data[x_62] = (f32((10 - x_63)) * x_67); + + continuing { + let x_70 : i32 = i; + i = (x_70 + 1); + } + } + i_1 = 0; + loop { + let x_76 : i32 = i_1; + if ((x_76 < 9)) { + } else { + break; + } + j = 0; + loop { + let x_83 : i32 = j; + if ((x_83 < 10)) { + } else { + break; + } + let x_86 : i32 = j; + let x_87 : i32 = i_1; + if ((x_86 < (x_87 + 1))) { + continue; + } + let x_92 : i32 = i_1; + let x_93 : i32 = j; + let x_95 : f32 = data[x_92]; + param = x_95; + let x_97 : f32 = data[x_93]; + param_1 = x_97; + let x_98 : bool = checkSwap_f1_f1_(&(param), &(param_1)); + doSwap = x_98; + let x_99 : bool = doSwap; + if (x_99) { + let x_102 : i32 = i_1; + let x_104 : f32 = data[x_102]; + temp = x_104; + let x_105 : i32 = i_1; + let x_106 : i32 = j; + let x_108 : f32 = data[x_106]; + data[x_105] = x_108; + let x_110 : i32 = j; + let x_111 : f32 = temp; + data[x_110] = x_111; + } + + continuing { + let x_113 : i32 = j; + j = (x_113 + 1); + } + } + + continuing { + let x_115 : i32 = i_1; + i_1 = (x_115 + 1); + } + } + let x_118 : f32 = gl_FragCoord.x; + let x_120 : f32 = x_9.resolution.x; + if ((x_118 < (x_120 / 2.0))) { + let x_127 : f32 = data[0]; + let x_130 : f32 = data[5]; + let x_133 : f32 = data[9]; + x_GLF_color = vec4((x_127 / 10.0), (x_130 / 10.0), (x_133 / 10.0), 1.0); + } else { + let x_137 : f32 = data[5]; + let x_140 : f32 = data[9]; + let x_143 : f32 = data[0]; + x_GLF_color = vec4((x_137 / 10.0), (x_140 / 10.0), (x_143 / 10.0), 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm new file mode 100644 index 0000000000..9fa3f8520a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm @@ -0,0 +1,114 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %indexable "indexable" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %uint = OpTypeInt 32 0 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %30 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %32 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %33 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %36 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %37 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %38 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %39 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %40 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %41 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %42 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %43 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %44 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %45 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %46 = OpConstantComposite %_arr_v4float_uint_16 %30 %32 %33 %34 %35 %36 %37 %38 %30 %39 %40 %41 %42 %43 %44 %45 + %int_16 = OpConstant %int 16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main = OpFunction %void None %9 + %50 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %51 = OpLoad %v4float %gl_FragCoord + %52 = OpVectorShuffle %v2float %51 %51 0 1 + %53 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %54 = OpLoad %v2float %53 + %55 = OpFDiv %v2float %52 %54 + %56 = OpVectorTimesScalar %v2float %55 %float_8 + %57 = OpExtInst %v2float %1 Floor %56 + %58 = OpCompositeExtract %float %57 0 + %59 = OpConvertFToS %int %58 + %60 = OpIMul %int %59 %int_8 + %61 = OpCompositeExtract %float %57 1 + %62 = OpConvertFToS %int %61 + %63 = OpIAdd %int %60 %62 + OpBranch %64 + %64 = OpLabel + %65 = OpPhi %int %int_0 %50 %66 %67 + %68 = OpPhi %int %63 %50 %69 %67 + %70 = OpSGreaterThan %bool %68 %int_1 + OpLoopMerge %71 %67 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %73 = OpBitwiseAnd %int %68 %int_1 + %74 = OpIEqual %bool %73 %int_1 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + %78 = OpIMul %int %int_3 %68 + %79 = OpIAdd %int %78 %int_1 + OpBranch %75 + %77 = OpLabel + %80 = OpSDiv %int %68 %int_2 + OpBranch %75 + %75 = OpLabel + %69 = OpPhi %int %79 %76 %80 %77 + %66 = OpIAdd %int %65 %int_1 + OpBranch %67 + %67 = OpLabel + OpBranch %64 + %71 = OpLabel + %81 = OpSMod %int %65 %int_16 + OpStore %indexable %46 + %82 = OpAccessChain %_ptr_Function_v4float %indexable %81 + %83 = OpLoad %v4float %82 + OpStore %_GLF_color %83 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..74ac34ac0e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.hlsl @@ -0,0 +1,65 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int x_65 = 0; + int x_65_phi = 0; + int x_68_phi = 0; + const float4 x_51 = gl_FragCoord; + const float2 x_54 = asfloat(x_6[0].xy); + const float2 x_57 = floor(((float2(x_51.x, x_51.y) / x_54) * 8.0f)); + const int x_63 = ((int(x_57.x) * 8) + int(x_57.y)); + x_65_phi = 0; + x_68_phi = x_63; + while (true) { + int x_79 = 0; + int x_80 = 0; + int x_69_phi = 0; + x_65 = x_65_phi; + const int x_68 = x_68_phi; + if ((x_68 > 1)) { + } else { + break; + } + if (((x_68 & 1) == 1)) { + x_79 = ((3 * x_68) + 1); + x_69_phi = x_79; + } else { + x_80 = (x_68 / 2); + x_69_phi = x_80; + } + const int x_69 = x_69_phi; + { + x_65_phi = asint((x_65 + asint(1))); + x_68_phi = x_69; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_83 = indexable[asint((x_65 % 16))]; + x_GLF_color = x_83; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.msl new file mode 100644 index 0000000000..c9c314f17f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.msl @@ -0,0 +1,67 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int x_65 = 0; + int x_65_phi = 0; + int x_68_phi = 0; + float4 const x_51 = *(tint_symbol_6); + float2 const x_54 = x_6.resolution; + float2 const x_57 = floor(((float2(x_51.x, x_51.y) / x_54) * 8.0f)); + int const x_63 = ((int(x_57.x) * 8) + int(x_57.y)); + x_65_phi = 0; + x_68_phi = x_63; + while (true) { + int x_79 = 0; + int x_80 = 0; + int x_69_phi = 0; + x_65 = x_65_phi; + int const x_68 = x_68_phi; + if ((x_68 > 1)) { + } else { + break; + } + if (((x_68 & 1) == 1)) { + x_79 = ((3 * x_68) + 1); + x_69_phi = x_79; + } else { + x_80 = (x_68 / 2); + x_69_phi = x_80; + } + int const x_69 = x_69_phi; + { + x_65_phi = as_type((x_65 + as_type(1))); + x_68_phi = x_69; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_83 = indexable.arr[as_type((x_65 % 16))]; + *(tint_symbol_7) = x_83; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..5b409191ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.spvasm @@ -0,0 +1,192 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 123 +; Schema: 0 + OpCapability Shader + %37 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_65 "x_65" + OpName %x_65_phi "x_65_phi" + OpName %x_68_phi "x_68_phi" + OpName %x_79 "x_79" + OpName %x_80 "x_80" + OpName %x_69_phi "x_69_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %86 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %88 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %89 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %90 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %91 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %92 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %93 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %94 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %95 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %96 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %97 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %98 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %99 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %100 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %101 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %102 = OpConstantComposite %_arr_v4float_uint_16 %86 %88 %89 %90 %91 %92 %93 %94 %86 %95 %96 %97 %98 %99 %100 %101 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %110 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_65 = OpVariable %_ptr_Function_int Function %28 + %x_65_phi = OpVariable %_ptr_Function_int Function %28 + %x_68_phi = OpVariable %_ptr_Function_int Function %28 + %x_79 = OpVariable %_ptr_Function_int Function %28 + %x_80 = OpVariable %_ptr_Function_int Function %28 + %x_69_phi = OpVariable %_ptr_Function_int Function %28 + %31 = OpLoad %v4float %gl_FragCoord + %34 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %35 = OpLoad %v2float %34 + %38 = OpCompositeExtract %float %31 0 + %39 = OpCompositeExtract %float %31 1 + %40 = OpCompositeConstruct %v2float %38 %39 + %41 = OpFDiv %v2float %40 %35 + %43 = OpVectorTimesScalar %v2float %41 %float_8 + %36 = OpExtInst %v2float %37 Floor %43 + %45 = OpCompositeExtract %float %36 0 + %44 = OpConvertFToS %int %45 + %47 = OpIMul %int %44 %int_8 + %49 = OpCompositeExtract %float %36 1 + %48 = OpConvertFToS %int %49 + %50 = OpIAdd %int %47 %48 + OpStore %x_65_phi %int_0 + OpStore %x_68_phi %50 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %59 = OpLoad %int %x_65_phi + OpStore %x_65 %59 + %60 = OpLoad %int %x_68_phi + %62 = OpSGreaterThan %bool %60 %int_1 + OpSelectionMerge %64 None + OpBranchConditional %62 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %53 + %64 = OpLabel + %67 = OpBitwiseAnd %int %60 %int_1 + %68 = OpIEqual %bool %67 %int_1 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + %73 = OpIMul %int %int_3 %60 + %74 = OpIAdd %int %73 %int_1 + OpStore %x_79 %74 + %75 = OpLoad %int %x_79 + OpStore %x_69_phi %75 + OpBranch %69 + %71 = OpLabel + %77 = OpSDiv %int %60 %int_2 + OpStore %x_80 %77 + %78 = OpLoad %int %x_80 + OpStore %x_69_phi %78 + OpBranch %69 + %69 = OpLabel + %79 = OpLoad %int %x_69_phi + OpBranch %54 + %54 = OpLabel + %81 = OpLoad %int %x_65 + %82 = OpCopyObject %int %int_1 + %83 = OpIAdd %int %81 %82 + %80 = OpCopyObject %int %83 + OpStore %x_65_phi %80 + OpStore %x_68_phi %79 + OpBranch %52 + %53 = OpLabel + OpStore %indexable %102 + %104 = OpLoad %int %x_65 + %106 = OpSMod %int %104 %int_16 + %103 = OpCopyObject %int %106 + %108 = OpAccessChain %_ptr_Function_v4float %indexable %103 + %109 = OpLoad %v4float %108 + OpStore %x_GLF_color %109 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %110 +%tint_symbol_1 = OpFunctionParameter %main_out + %114 = OpLabel + %115 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %115 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %117 = OpLabel + %118 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %118 + %119 = OpFunctionCall %void %main_1 + %121 = OpLoad %v4float %x_GLF_color + %122 = OpCompositeConstruct %main_out %121 + %120 = OpFunctionCall %void %tint_symbol_3 %122 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..919b5ea423 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.spvasm.expected.wgsl @@ -0,0 +1,63 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_65 : i32; + var x_65_phi : i32; + var x_68_phi : i32; + let x_51 : vec4 = gl_FragCoord; + let x_54 : vec2 = x_6.resolution; + let x_57 : vec2 = floor(((vec2(x_51.x, x_51.y) / x_54) * 8.0)); + let x_63 : i32 = ((i32(x_57.x) * 8) + i32(x_57.y)); + x_65_phi = 0; + x_68_phi = x_63; + loop { + var x_79 : i32; + var x_80 : i32; + var x_69_phi : i32; + x_65 = x_65_phi; + let x_68 : i32 = x_68_phi; + if ((x_68 > 1)) { + } else { + break; + } + if (((x_68 & 1) == 1)) { + x_79 = ((3 * x_68) + 1); + x_69_phi = x_79; + } else { + x_80 = (x_68 / 2); + x_69_phi = x_80; + } + let x_69 : i32 = x_69_phi; + + continuing { + x_65_phi = bitcast((x_65 + bitcast(1))); + x_68_phi = x_69; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_83 : vec4 = indexable[bitcast((x_65 % 16))]; + x_GLF_color = x_83; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl new file mode 100644 index 0000000000..919b5ea423 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl @@ -0,0 +1,63 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_65 : i32; + var x_65_phi : i32; + var x_68_phi : i32; + let x_51 : vec4 = gl_FragCoord; + let x_54 : vec2 = x_6.resolution; + let x_57 : vec2 = floor(((vec2(x_51.x, x_51.y) / x_54) * 8.0)); + let x_63 : i32 = ((i32(x_57.x) * 8) + i32(x_57.y)); + x_65_phi = 0; + x_68_phi = x_63; + loop { + var x_79 : i32; + var x_80 : i32; + var x_69_phi : i32; + x_65 = x_65_phi; + let x_68 : i32 = x_68_phi; + if ((x_68 > 1)) { + } else { + break; + } + if (((x_68 & 1) == 1)) { + x_79 = ((3 * x_68) + 1); + x_69_phi = x_79; + } else { + x_80 = (x_68 / 2); + x_69_phi = x_80; + } + let x_69 : i32 = x_69_phi; + + continuing { + x_65_phi = bitcast((x_65 + bitcast(1))); + x_68_phi = x_69; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_83 : vec4 = indexable[bitcast((x_65 % 16))]; + x_GLF_color = x_83; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..74ac34ac0e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.hlsl @@ -0,0 +1,65 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int x_65 = 0; + int x_65_phi = 0; + int x_68_phi = 0; + const float4 x_51 = gl_FragCoord; + const float2 x_54 = asfloat(x_6[0].xy); + const float2 x_57 = floor(((float2(x_51.x, x_51.y) / x_54) * 8.0f)); + const int x_63 = ((int(x_57.x) * 8) + int(x_57.y)); + x_65_phi = 0; + x_68_phi = x_63; + while (true) { + int x_79 = 0; + int x_80 = 0; + int x_69_phi = 0; + x_65 = x_65_phi; + const int x_68 = x_68_phi; + if ((x_68 > 1)) { + } else { + break; + } + if (((x_68 & 1) == 1)) { + x_79 = ((3 * x_68) + 1); + x_69_phi = x_79; + } else { + x_80 = (x_68 / 2); + x_69_phi = x_80; + } + const int x_69 = x_69_phi; + { + x_65_phi = asint((x_65 + asint(1))); + x_68_phi = x_69; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_83 = indexable[asint((x_65 % 16))]; + x_GLF_color = x_83; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.msl new file mode 100644 index 0000000000..c9c314f17f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.msl @@ -0,0 +1,67 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int x_65 = 0; + int x_65_phi = 0; + int x_68_phi = 0; + float4 const x_51 = *(tint_symbol_6); + float2 const x_54 = x_6.resolution; + float2 const x_57 = floor(((float2(x_51.x, x_51.y) / x_54) * 8.0f)); + int const x_63 = ((int(x_57.x) * 8) + int(x_57.y)); + x_65_phi = 0; + x_68_phi = x_63; + while (true) { + int x_79 = 0; + int x_80 = 0; + int x_69_phi = 0; + x_65 = x_65_phi; + int const x_68 = x_68_phi; + if ((x_68 > 1)) { + } else { + break; + } + if (((x_68 & 1) == 1)) { + x_79 = ((3 * x_68) + 1); + x_69_phi = x_79; + } else { + x_80 = (x_68 / 2); + x_69_phi = x_80; + } + int const x_69 = x_69_phi; + { + x_65_phi = as_type((x_65 + as_type(1))); + x_68_phi = x_69; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_83 = indexable.arr[as_type((x_65 % 16))]; + *(tint_symbol_7) = x_83; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..5b409191ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.spvasm @@ -0,0 +1,192 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 123 +; Schema: 0 + OpCapability Shader + %37 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_65 "x_65" + OpName %x_65_phi "x_65_phi" + OpName %x_68_phi "x_68_phi" + OpName %x_79 "x_79" + OpName %x_80 "x_80" + OpName %x_69_phi "x_69_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %86 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %88 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %89 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %90 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %91 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %92 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %93 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %94 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %95 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %96 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %97 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %98 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %99 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %100 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %101 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %102 = OpConstantComposite %_arr_v4float_uint_16 %86 %88 %89 %90 %91 %92 %93 %94 %86 %95 %96 %97 %98 %99 %100 %101 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %110 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_65 = OpVariable %_ptr_Function_int Function %28 + %x_65_phi = OpVariable %_ptr_Function_int Function %28 + %x_68_phi = OpVariable %_ptr_Function_int Function %28 + %x_79 = OpVariable %_ptr_Function_int Function %28 + %x_80 = OpVariable %_ptr_Function_int Function %28 + %x_69_phi = OpVariable %_ptr_Function_int Function %28 + %31 = OpLoad %v4float %gl_FragCoord + %34 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %35 = OpLoad %v2float %34 + %38 = OpCompositeExtract %float %31 0 + %39 = OpCompositeExtract %float %31 1 + %40 = OpCompositeConstruct %v2float %38 %39 + %41 = OpFDiv %v2float %40 %35 + %43 = OpVectorTimesScalar %v2float %41 %float_8 + %36 = OpExtInst %v2float %37 Floor %43 + %45 = OpCompositeExtract %float %36 0 + %44 = OpConvertFToS %int %45 + %47 = OpIMul %int %44 %int_8 + %49 = OpCompositeExtract %float %36 1 + %48 = OpConvertFToS %int %49 + %50 = OpIAdd %int %47 %48 + OpStore %x_65_phi %int_0 + OpStore %x_68_phi %50 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %59 = OpLoad %int %x_65_phi + OpStore %x_65 %59 + %60 = OpLoad %int %x_68_phi + %62 = OpSGreaterThan %bool %60 %int_1 + OpSelectionMerge %64 None + OpBranchConditional %62 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %53 + %64 = OpLabel + %67 = OpBitwiseAnd %int %60 %int_1 + %68 = OpIEqual %bool %67 %int_1 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + %73 = OpIMul %int %int_3 %60 + %74 = OpIAdd %int %73 %int_1 + OpStore %x_79 %74 + %75 = OpLoad %int %x_79 + OpStore %x_69_phi %75 + OpBranch %69 + %71 = OpLabel + %77 = OpSDiv %int %60 %int_2 + OpStore %x_80 %77 + %78 = OpLoad %int %x_80 + OpStore %x_69_phi %78 + OpBranch %69 + %69 = OpLabel + %79 = OpLoad %int %x_69_phi + OpBranch %54 + %54 = OpLabel + %81 = OpLoad %int %x_65 + %82 = OpCopyObject %int %int_1 + %83 = OpIAdd %int %81 %82 + %80 = OpCopyObject %int %83 + OpStore %x_65_phi %80 + OpStore %x_68_phi %79 + OpBranch %52 + %53 = OpLabel + OpStore %indexable %102 + %104 = OpLoad %int %x_65 + %106 = OpSMod %int %104 %int_16 + %103 = OpCopyObject %int %106 + %108 = OpAccessChain %_ptr_Function_v4float %indexable %103 + %109 = OpLoad %v4float %108 + OpStore %x_GLF_color %109 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %110 +%tint_symbol_1 = OpFunctionParameter %main_out + %114 = OpLabel + %115 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %115 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %117 = OpLabel + %118 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %118 + %119 = OpFunctionCall %void %main_1 + %121 = OpLoad %v4float %x_GLF_color + %122 = OpCompositeConstruct %main_out %121 + %120 = OpFunctionCall %void %tint_symbol_3 %122 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..919b5ea423 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/0.wgsl.expected.wgsl @@ -0,0 +1,63 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_65 : i32; + var x_65_phi : i32; + var x_68_phi : i32; + let x_51 : vec4 = gl_FragCoord; + let x_54 : vec2 = x_6.resolution; + let x_57 : vec2 = floor(((vec2(x_51.x, x_51.y) / x_54) * 8.0)); + let x_63 : i32 = ((i32(x_57.x) * 8) + i32(x_57.y)); + x_65_phi = 0; + x_68_phi = x_63; + loop { + var x_79 : i32; + var x_80 : i32; + var x_69_phi : i32; + x_65 = x_65_phi; + let x_68 : i32 = x_68_phi; + if ((x_68 > 1)) { + } else { + break; + } + if (((x_68 & 1) == 1)) { + x_79 = ((3 * x_68) + 1); + x_69_phi = x_79; + } else { + x_80 = (x_68 / 2); + x_69_phi = x_80; + } + let x_69 : i32 = x_69_phi; + + continuing { + x_65_phi = bitcast((x_65 + bitcast(1))); + x_68_phi = x_69; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_83 : vec4 = indexable[bitcast((x_65 % 16))]; + x_GLF_color = x_83; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm new file mode 100644 index 0000000000..fe859908ed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm @@ -0,0 +1,125 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %indexable "indexable" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %uint = OpTypeInt 32 0 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %30 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %32 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %33 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %34 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %36 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %37 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %38 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %39 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %40 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %41 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %42 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %43 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %44 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %45 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %46 = OpConstantComposite %_arr_v4float_uint_16 %30 %32 %33 %34 %35 %36 %37 %38 %30 %39 %40 %41 %42 %43 %44 %45 + %int_16 = OpConstant %int 16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0_0 = OpConstant %float 0 + %51 = OpConstantComposite %v4float %float_0_0 %float_0_0 %float_0_0 %float_0_0 + %52 = OpConstantComposite %_arr_v4float_uint_16 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51 %51 + %main = OpFunction %void None %9 + %53 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %54 = OpLoad %v4float %gl_FragCoord + %55 = OpVectorShuffle %v2float %54 %54 0 1 + %56 = OpCompositeConstruct %v4float %float_0 %float_8 %55 + %57 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %58 = OpLoad %v2float %57 + %59 = OpCompositeConstruct %_arr_v4float_uint_16 %35 %43 %37 %44 %45 %37 %37 %36 %41 %54 %35 %34 %33 %32 %40 %39 + %60 = OpFDiv %v2float %55 %58 + %61 = OpVectorTimesScalar %v2float %60 %float_8 + %62 = OpExtInst %v2float %1 Floor %61 + %63 = OpCompositeConstruct %v4float %61 %float_0_5 %float_1 + %64 = OpCompositeExtract %float %62 0 + %65 = OpConvertFToS %int %64 + %66 = OpIMul %int %65 %int_8 + %67 = OpCompositeExtract %float %62 1 + %68 = OpConvertFToS %int %67 + %69 = OpIAdd %int %66 %68 + OpBranch %70 + %70 = OpLabel + %71 = OpPhi %int %int_0 %53 %72 %73 + %74 = OpPhi %int %69 %53 %75 %73 + %76 = OpSGreaterThan %bool %74 %int_1 + OpLoopMerge %77 %73 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + %79 = OpBitwiseAnd %int %74 %int_1 + %80 = OpIEqual %bool %79 %int_1 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %84 = OpIMul %int %int_3 %74 + %85 = OpIAdd %int %84 %int_1 + OpBranch %81 + %83 = OpLabel + %86 = OpSDiv %int %74 %int_2 + OpBranch %81 + %81 = OpLabel + %75 = OpPhi %int %85 %82 %86 %83 + %72 = OpIAdd %int %71 %int_1 + OpBranch %73 + %73 = OpLabel + OpBranch %70 + %77 = OpLabel + %87 = OpSMod %int %71 %int_16 + OpStore %indexable %46 + %88 = OpLoad %_arr_v4float_uint_16 %indexable + OpStore %indexable %52 + OpStore %indexable %88 + %89 = OpCompositeExtract %v4float %59 1 + %90 = OpCompositeConstruct %_arr_v4float_uint_16 %36 %36 %40 %30 %36 %38 %43 %30 %40 %56 %35 %37 %36 %41 %43 %63 + %91 = OpAccessChain %_ptr_Function_v4float %indexable %87 + %92 = OpLoad %v4float %91 + OpStore %_GLF_color %92 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..5df85e4d50 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.hlsl @@ -0,0 +1,74 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int x_71 = 0; + int x_71_phi = 0; + int x_74_phi = 0; + const float4 x_54 = gl_FragCoord; + const float2 x_55 = float2(x_54.x, x_54.y); + const float2 x_58 = asfloat(x_6[0].xy); + const float2 x_61 = ((x_55 / x_58) * 8.0f); + const float2 x_62 = floor(x_61); + const int x_69 = ((int(x_62.x) * 8) + int(x_62.y)); + x_71_phi = 0; + x_74_phi = x_69; + while (true) { + int x_85 = 0; + int x_86 = 0; + int x_75_phi = 0; + x_71 = x_71_phi; + const int x_74 = x_74_phi; + if ((x_74 > 1)) { + } else { + break; + } + if (((x_74 & 1) == 1)) { + x_85 = ((3 * x_74) + 1); + x_75_phi = x_85; + } else { + x_86 = (x_74 / 2); + x_75_phi = x_86; + } + const int x_75 = x_75_phi; + { + x_71_phi = asint((x_71 + asint(1))); + x_74_phi = x_75; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_88[16] = indexable; + const float4 tint_symbol_6[16] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + indexable = tint_symbol_6; + indexable = x_88; + const float4 tint_symbol_7[16] = {float4(0.0f, 0.0f, 0.5f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), x_54, float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f)}; + const float4 x_89 = tint_symbol_7[1u]; + const float4 x_90[16] = {float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 8.0f, x_55), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(x_61, 0.5f, 1.0f)}; + const float4 x_92 = indexable[asint((x_71 % 16))]; + x_GLF_color = x_92; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.msl new file mode 100644 index 0000000000..b1f84a6692 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.msl @@ -0,0 +1,76 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) { + tint_array_wrapper indexable = {}; + int x_71 = 0; + int x_71_phi = 0; + int x_74_phi = 0; + float4 const x_54 = *(tint_symbol_8); + float2 const x_55 = float2(x_54.x, x_54.y); + float2 const x_58 = x_6.resolution; + float2 const x_61 = ((x_55 / x_58) * 8.0f); + float2 const x_62 = floor(x_61); + int const x_69 = ((int(x_62.x) * 8) + int(x_62.y)); + x_71_phi = 0; + x_74_phi = x_69; + while (true) { + int x_85 = 0; + int x_86 = 0; + int x_75_phi = 0; + x_71 = x_71_phi; + int const x_74 = x_74_phi; + if ((x_74 > 1)) { + } else { + break; + } + if (((x_74 & 1) == 1)) { + x_85 = ((3 * x_74) + 1); + x_75_phi = x_85; + } else { + x_86 = (x_74 / 2); + x_75_phi = x_86; + } + int const x_75 = x_75_phi; + { + x_71_phi = as_type((x_71 + as_type(1))); + x_74_phi = x_75; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + tint_array_wrapper const x_88 = indexable; + tint_array_wrapper const tint_symbol_5 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + indexable = tint_symbol_5; + indexable = x_88; + tint_array_wrapper const tint_symbol_6 = {.arr={float4(0.0f, 0.0f, 0.5f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), x_54, float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f)}}; + float4 const x_89 = tint_symbol_6.arr[1u]; + tint_array_wrapper const x_90 = {.arr={float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 8.0f, x_55), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(x_61, 0.5f, 1.0f)}}; + float4 const x_92 = indexable.arr[as_type((x_71 % 16))]; + *(tint_symbol_9) = x_92; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_11}; + tint_symbol_2 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..9edd5c342c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.spvasm @@ -0,0 +1,207 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 136 +; Schema: 0 + OpCapability Shader + %43 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_71 "x_71" + OpName %x_71_phi "x_71_phi" + OpName %x_74_phi "x_74_phi" + OpName %x_85 "x_85" + OpName %x_86 "x_86" + OpName %x_75_phi "x_75_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %86 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %88 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %89 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %90 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %91 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %92 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %93 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %94 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %95 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %96 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %97 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %98 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %99 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %100 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %101 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %102 = OpConstantComposite %_arr_v4float_uint_16 %86 %88 %89 %90 %91 %92 %93 %94 %86 %95 %96 %97 %98 %99 %100 %101 + %104 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %105 = OpConstantComposite %_arr_v4float_uint_16 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 + %uint_1 = OpConstant %uint 1 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %123 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_71 = OpVariable %_ptr_Function_int Function %28 + %x_71_phi = OpVariable %_ptr_Function_int Function %28 + %x_74_phi = OpVariable %_ptr_Function_int Function %28 + %x_85 = OpVariable %_ptr_Function_int Function %28 + %x_86 = OpVariable %_ptr_Function_int Function %28 + %x_75_phi = OpVariable %_ptr_Function_int Function %28 + %31 = OpLoad %v4float %gl_FragCoord + %32 = OpCompositeExtract %float %31 0 + %33 = OpCompositeExtract %float %31 1 + %34 = OpCompositeConstruct %v2float %32 %33 + %37 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %38 = OpLoad %v2float %37 + %39 = OpFDiv %v2float %34 %38 + %41 = OpVectorTimesScalar %v2float %39 %float_8 + %42 = OpExtInst %v2float %43 Floor %41 + %45 = OpCompositeExtract %float %42 0 + %44 = OpConvertFToS %int %45 + %47 = OpIMul %int %44 %int_8 + %49 = OpCompositeExtract %float %42 1 + %48 = OpConvertFToS %int %49 + %50 = OpIAdd %int %47 %48 + OpStore %x_71_phi %int_0 + OpStore %x_74_phi %50 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %59 = OpLoad %int %x_71_phi + OpStore %x_71 %59 + %60 = OpLoad %int %x_74_phi + %62 = OpSGreaterThan %bool %60 %int_1 + OpSelectionMerge %64 None + OpBranchConditional %62 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %53 + %64 = OpLabel + %67 = OpBitwiseAnd %int %60 %int_1 + %68 = OpIEqual %bool %67 %int_1 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + %73 = OpIMul %int %int_3 %60 + %74 = OpIAdd %int %73 %int_1 + OpStore %x_85 %74 + %75 = OpLoad %int %x_85 + OpStore %x_75_phi %75 + OpBranch %69 + %71 = OpLabel + %77 = OpSDiv %int %60 %int_2 + OpStore %x_86 %77 + %78 = OpLoad %int %x_86 + OpStore %x_75_phi %78 + OpBranch %69 + %69 = OpLabel + %79 = OpLoad %int %x_75_phi + OpBranch %54 + %54 = OpLabel + %81 = OpLoad %int %x_71 + %82 = OpCopyObject %int %int_1 + %83 = OpIAdd %int %81 %82 + %80 = OpCopyObject %int %83 + OpStore %x_71_phi %80 + OpStore %x_74_phi %79 + OpBranch %52 + %53 = OpLabel + OpStore %indexable %102 + %103 = OpLoad %_arr_v4float_uint_16 %indexable + OpStore %indexable %105 + OpStore %indexable %103 + %106 = OpCompositeConstruct %_arr_v4float_uint_16 %91 %99 %93 %100 %101 %93 %93 %92 %97 %31 %91 %90 %89 %88 %96 %95 + %108 = OpCompositeExtract %v4float %106 1 + %109 = OpCompositeExtract %float %34 0 + %110 = OpCompositeExtract %float %34 1 + %111 = OpCompositeConstruct %v4float %float_0 %float_8 %109 %110 + %112 = OpCompositeExtract %float %41 0 + %113 = OpCompositeExtract %float %41 1 + %114 = OpCompositeConstruct %v4float %112 %113 %float_0_5 %float_1 + %115 = OpCompositeConstruct %_arr_v4float_uint_16 %92 %92 %96 %86 %92 %94 %99 %86 %96 %111 %91 %93 %92 %97 %99 %114 + %117 = OpLoad %int %x_71 + %119 = OpSMod %int %117 %int_16 + %116 = OpCopyObject %int %119 + %121 = OpAccessChain %_ptr_Function_v4float %indexable %116 + %122 = OpLoad %v4float %121 + OpStore %x_GLF_color %122 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %123 +%tint_symbol_1 = OpFunctionParameter %main_out + %127 = OpLabel + %128 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %128 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %130 = OpLabel + %131 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %131 + %132 = OpFunctionCall %void %main_1 + %134 = OpLoad %v4float %x_GLF_color + %135 = OpCompositeConstruct %main_out %134 + %133 = OpFunctionCall %void %tint_symbol_3 %135 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..872479c664 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.spvasm.expected.wgsl @@ -0,0 +1,70 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_71 : i32; + var x_71_phi : i32; + var x_74_phi : i32; + let x_54 : vec4 = gl_FragCoord; + let x_55 : vec2 = vec2(x_54.x, x_54.y); + let x_58 : vec2 = x_6.resolution; + let x_61 : vec2 = ((x_55 / x_58) * 8.0); + let x_62 : vec2 = floor(x_61); + let x_69 : i32 = ((i32(x_62.x) * 8) + i32(x_62.y)); + x_71_phi = 0; + x_74_phi = x_69; + loop { + var x_85 : i32; + var x_86 : i32; + var x_75_phi : i32; + x_71 = x_71_phi; + let x_74 : i32 = x_74_phi; + if ((x_74 > 1)) { + } else { + break; + } + if (((x_74 & 1) == 1)) { + x_85 = ((3 * x_74) + 1); + x_75_phi = x_85; + } else { + x_86 = (x_74 / 2); + x_75_phi = x_86; + } + let x_75 : i32 = x_75_phi; + + continuing { + x_71_phi = bitcast((x_71 + bitcast(1))); + x_74_phi = x_75; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_88 : array, 16> = indexable; + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + indexable = x_88; + let x_89 : vec4 = array, 16>(vec4(0.0, 0.0, 0.5, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(1.0, 1.0, 0.0, 1.0), x_54, vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0))[1u]; + let x_90 : array, 16> = array, 16>(vec4(0.5, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(0.0, 8.0, x_55), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(x_61, 0.5, 1.0)); + let x_92 : vec4 = indexable[bitcast((x_71 % 16))]; + x_GLF_color = x_92; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl new file mode 100644 index 0000000000..872479c664 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl @@ -0,0 +1,70 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_71 : i32; + var x_71_phi : i32; + var x_74_phi : i32; + let x_54 : vec4 = gl_FragCoord; + let x_55 : vec2 = vec2(x_54.x, x_54.y); + let x_58 : vec2 = x_6.resolution; + let x_61 : vec2 = ((x_55 / x_58) * 8.0); + let x_62 : vec2 = floor(x_61); + let x_69 : i32 = ((i32(x_62.x) * 8) + i32(x_62.y)); + x_71_phi = 0; + x_74_phi = x_69; + loop { + var x_85 : i32; + var x_86 : i32; + var x_75_phi : i32; + x_71 = x_71_phi; + let x_74 : i32 = x_74_phi; + if ((x_74 > 1)) { + } else { + break; + } + if (((x_74 & 1) == 1)) { + x_85 = ((3 * x_74) + 1); + x_75_phi = x_85; + } else { + x_86 = (x_74 / 2); + x_75_phi = x_86; + } + let x_75 : i32 = x_75_phi; + + continuing { + x_71_phi = bitcast((x_71 + bitcast(1))); + x_74_phi = x_75; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_88 : array, 16> = indexable; + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + indexable = x_88; + let x_89 : vec4 = array, 16>(vec4(0.0, 0.0, 0.5, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(1.0, 1.0, 0.0, 1.0), x_54, vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0))[1u]; + let x_90 : array, 16> = array, 16>(vec4(0.5, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(0.0, 8.0, x_55), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(x_61, 0.5, 1.0)); + let x_92 : vec4 = indexable[bitcast((x_71 % 16))]; + x_GLF_color = x_92; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..5df85e4d50 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.hlsl @@ -0,0 +1,74 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int x_71 = 0; + int x_71_phi = 0; + int x_74_phi = 0; + const float4 x_54 = gl_FragCoord; + const float2 x_55 = float2(x_54.x, x_54.y); + const float2 x_58 = asfloat(x_6[0].xy); + const float2 x_61 = ((x_55 / x_58) * 8.0f); + const float2 x_62 = floor(x_61); + const int x_69 = ((int(x_62.x) * 8) + int(x_62.y)); + x_71_phi = 0; + x_74_phi = x_69; + while (true) { + int x_85 = 0; + int x_86 = 0; + int x_75_phi = 0; + x_71 = x_71_phi; + const int x_74 = x_74_phi; + if ((x_74 > 1)) { + } else { + break; + } + if (((x_74 & 1) == 1)) { + x_85 = ((3 * x_74) + 1); + x_75_phi = x_85; + } else { + x_86 = (x_74 / 2); + x_75_phi = x_86; + } + const int x_75 = x_75_phi; + { + x_71_phi = asint((x_71 + asint(1))); + x_74_phi = x_75; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_88[16] = indexable; + const float4 tint_symbol_6[16] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + indexable = tint_symbol_6; + indexable = x_88; + const float4 tint_symbol_7[16] = {float4(0.0f, 0.0f, 0.5f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), x_54, float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f)}; + const float4 x_89 = tint_symbol_7[1u]; + const float4 x_90[16] = {float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 8.0f, x_55), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(x_61, 0.5f, 1.0f)}; + const float4 x_92 = indexable[asint((x_71 % 16))]; + x_GLF_color = x_92; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.msl new file mode 100644 index 0000000000..b1f84a6692 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.msl @@ -0,0 +1,76 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) { + tint_array_wrapper indexable = {}; + int x_71 = 0; + int x_71_phi = 0; + int x_74_phi = 0; + float4 const x_54 = *(tint_symbol_8); + float2 const x_55 = float2(x_54.x, x_54.y); + float2 const x_58 = x_6.resolution; + float2 const x_61 = ((x_55 / x_58) * 8.0f); + float2 const x_62 = floor(x_61); + int const x_69 = ((int(x_62.x) * 8) + int(x_62.y)); + x_71_phi = 0; + x_74_phi = x_69; + while (true) { + int x_85 = 0; + int x_86 = 0; + int x_75_phi = 0; + x_71 = x_71_phi; + int const x_74 = x_74_phi; + if ((x_74 > 1)) { + } else { + break; + } + if (((x_74 & 1) == 1)) { + x_85 = ((3 * x_74) + 1); + x_75_phi = x_85; + } else { + x_86 = (x_74 / 2); + x_75_phi = x_86; + } + int const x_75 = x_75_phi; + { + x_71_phi = as_type((x_71 + as_type(1))); + x_74_phi = x_75; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + tint_array_wrapper const x_88 = indexable; + tint_array_wrapper const tint_symbol_5 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + indexable = tint_symbol_5; + indexable = x_88; + tint_array_wrapper const tint_symbol_6 = {.arr={float4(0.0f, 0.0f, 0.5f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), x_54, float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f)}}; + float4 const x_89 = tint_symbol_6.arr[1u]; + tint_array_wrapper const x_90 = {.arr={float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 8.0f, x_55), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(x_61, 0.5f, 1.0f)}}; + float4 const x_92 = indexable.arr[as_type((x_71 % 16))]; + *(tint_symbol_9) = x_92; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_11}; + tint_symbol_2 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..9edd5c342c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.spvasm @@ -0,0 +1,207 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 136 +; Schema: 0 + OpCapability Shader + %43 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_71 "x_71" + OpName %x_71_phi "x_71_phi" + OpName %x_74_phi "x_74_phi" + OpName %x_85 "x_85" + OpName %x_86 "x_86" + OpName %x_75_phi "x_75_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %28 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %86 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %88 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %89 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %90 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %91 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %92 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %93 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %94 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %95 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %96 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %97 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %98 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %99 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %100 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %101 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %102 = OpConstantComposite %_arr_v4float_uint_16 %86 %88 %89 %90 %91 %92 %93 %94 %86 %95 %96 %97 %98 %99 %100 %101 + %104 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %105 = OpConstantComposite %_arr_v4float_uint_16 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 %104 + %uint_1 = OpConstant %uint 1 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %123 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_71 = OpVariable %_ptr_Function_int Function %28 + %x_71_phi = OpVariable %_ptr_Function_int Function %28 + %x_74_phi = OpVariable %_ptr_Function_int Function %28 + %x_85 = OpVariable %_ptr_Function_int Function %28 + %x_86 = OpVariable %_ptr_Function_int Function %28 + %x_75_phi = OpVariable %_ptr_Function_int Function %28 + %31 = OpLoad %v4float %gl_FragCoord + %32 = OpCompositeExtract %float %31 0 + %33 = OpCompositeExtract %float %31 1 + %34 = OpCompositeConstruct %v2float %32 %33 + %37 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %38 = OpLoad %v2float %37 + %39 = OpFDiv %v2float %34 %38 + %41 = OpVectorTimesScalar %v2float %39 %float_8 + %42 = OpExtInst %v2float %43 Floor %41 + %45 = OpCompositeExtract %float %42 0 + %44 = OpConvertFToS %int %45 + %47 = OpIMul %int %44 %int_8 + %49 = OpCompositeExtract %float %42 1 + %48 = OpConvertFToS %int %49 + %50 = OpIAdd %int %47 %48 + OpStore %x_71_phi %int_0 + OpStore %x_74_phi %50 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %59 = OpLoad %int %x_71_phi + OpStore %x_71 %59 + %60 = OpLoad %int %x_74_phi + %62 = OpSGreaterThan %bool %60 %int_1 + OpSelectionMerge %64 None + OpBranchConditional %62 %65 %66 + %65 = OpLabel + OpBranch %64 + %66 = OpLabel + OpBranch %53 + %64 = OpLabel + %67 = OpBitwiseAnd %int %60 %int_1 + %68 = OpIEqual %bool %67 %int_1 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + %73 = OpIMul %int %int_3 %60 + %74 = OpIAdd %int %73 %int_1 + OpStore %x_85 %74 + %75 = OpLoad %int %x_85 + OpStore %x_75_phi %75 + OpBranch %69 + %71 = OpLabel + %77 = OpSDiv %int %60 %int_2 + OpStore %x_86 %77 + %78 = OpLoad %int %x_86 + OpStore %x_75_phi %78 + OpBranch %69 + %69 = OpLabel + %79 = OpLoad %int %x_75_phi + OpBranch %54 + %54 = OpLabel + %81 = OpLoad %int %x_71 + %82 = OpCopyObject %int %int_1 + %83 = OpIAdd %int %81 %82 + %80 = OpCopyObject %int %83 + OpStore %x_71_phi %80 + OpStore %x_74_phi %79 + OpBranch %52 + %53 = OpLabel + OpStore %indexable %102 + %103 = OpLoad %_arr_v4float_uint_16 %indexable + OpStore %indexable %105 + OpStore %indexable %103 + %106 = OpCompositeConstruct %_arr_v4float_uint_16 %91 %99 %93 %100 %101 %93 %93 %92 %97 %31 %91 %90 %89 %88 %96 %95 + %108 = OpCompositeExtract %v4float %106 1 + %109 = OpCompositeExtract %float %34 0 + %110 = OpCompositeExtract %float %34 1 + %111 = OpCompositeConstruct %v4float %float_0 %float_8 %109 %110 + %112 = OpCompositeExtract %float %41 0 + %113 = OpCompositeExtract %float %41 1 + %114 = OpCompositeConstruct %v4float %112 %113 %float_0_5 %float_1 + %115 = OpCompositeConstruct %_arr_v4float_uint_16 %92 %92 %96 %86 %92 %94 %99 %86 %96 %111 %91 %93 %92 %97 %99 %114 + %117 = OpLoad %int %x_71 + %119 = OpSMod %int %117 %int_16 + %116 = OpCopyObject %int %119 + %121 = OpAccessChain %_ptr_Function_v4float %indexable %116 + %122 = OpLoad %v4float %121 + OpStore %x_GLF_color %122 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %123 +%tint_symbol_1 = OpFunctionParameter %main_out + %127 = OpLabel + %128 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %128 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %130 = OpLabel + %131 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %131 + %132 = OpFunctionCall %void %main_1 + %134 = OpLoad %v4float %x_GLF_color + %135 = OpCompositeConstruct %main_out %134 + %133 = OpFunctionCall %void %tint_symbol_3 %135 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..872479c664 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-collatz-O-mutate-composite-construct-extract/1.wgsl.expected.wgsl @@ -0,0 +1,70 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_71 : i32; + var x_71_phi : i32; + var x_74_phi : i32; + let x_54 : vec4 = gl_FragCoord; + let x_55 : vec2 = vec2(x_54.x, x_54.y); + let x_58 : vec2 = x_6.resolution; + let x_61 : vec2 = ((x_55 / x_58) * 8.0); + let x_62 : vec2 = floor(x_61); + let x_69 : i32 = ((i32(x_62.x) * 8) + i32(x_62.y)); + x_71_phi = 0; + x_74_phi = x_69; + loop { + var x_85 : i32; + var x_86 : i32; + var x_75_phi : i32; + x_71 = x_71_phi; + let x_74 : i32 = x_74_phi; + if ((x_74 > 1)) { + } else { + break; + } + if (((x_74 & 1) == 1)) { + x_85 = ((3 * x_74) + 1); + x_75_phi = x_85; + } else { + x_86 = (x_74 / 2); + x_75_phi = x_86; + } + let x_75 : i32 = x_75_phi; + + continuing { + x_71_phi = bitcast((x_71 + bitcast(1))); + x_74_phi = x_75; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_88 : array, 16> = indexable; + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + indexable = x_88; + let x_89 : vec4 = array, 16>(vec4(0.0, 0.0, 0.5, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(1.0, 1.0, 0.0, 1.0), x_54, vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0))[1u]; + let x_90 : array, 16> = array, 16>(vec4(0.5, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(0.0, 8.0, x_55), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(x_61, 0.5, 1.0)); + let x_92 : vec4 = indexable[bitcast((x_71 % 16))]; + x_GLF_color = x_92; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm new file mode 100644 index 0000000000..c006009e5a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm @@ -0,0 +1,223 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %c "c" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_n0_5 = OpConstant %float -0.5 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %27 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %43 = OpUndef %float +%float_0_125 = OpConstant %float 0.125 + %main = OpFunction %void None %9 + %45 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function + OpStore %c %27 + %46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %47 = OpLoad %float %46 + %48 = OpFMul %float %47 %float_0_125 + %49 = OpExtInst %float %1 Round %48 + %50 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %51 = OpLoad %float %50 + OpSelectionMerge %52 None + OpSwitch %uint_0 %53 + %53 = OpLabel + OpBranch %54 + %54 = OpLabel + %55 = OpPhi %float %float_n0_5 %53 %56 %57 + %58 = OpPhi %int %int_1 %53 %59 %57 + %60 = OpSLessThan %bool %58 %int_800 + OpLoopMerge %61 %57 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + %63 = OpSMod %int %58 %int_32 + %64 = OpIEqual %bool %63 %int_0 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %67 + %66 = OpLabel + %68 = OpFAdd %float %55 %float_0_400000006 + OpBranch %65 + %67 = OpLabel + %69 = OpConvertSToF %float %58 + %70 = OpExtInst %float %1 Round %49 + %71 = OpFMod %float %69 %70 + %72 = OpFOrdLessThanEqual %bool %71 %float_0_00999999978 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpFAdd %float %55 %float_100 + OpBranch %73 + %73 = OpLabel + %76 = OpPhi %float %55 %67 %75 %74 + OpBranch %65 + %65 = OpLabel + %56 = OpPhi %float %68 %66 %76 %73 + %77 = OpConvertSToF %float %58 + %78 = OpFOrdGreaterThanEqual %bool %77 %51 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %79 + %80 = OpLabel + OpBranch %61 + %79 = OpLabel + OpBranch %57 + %57 = OpLabel + %59 = OpIAdd %int %58 %int_1 + OpBranch %54 + %61 = OpLabel + %81 = OpPhi %float %43 %54 %56 %80 + %82 = OpPhi %float %55 %54 %56 %80 + %83 = OpPhi %bool %false %54 %true %80 + OpSelectionMerge %84 None + OpBranchConditional %83 %52 %84 + %84 = OpLabel + OpBranch %52 + %52 = OpLabel + %85 = OpPhi %float %81 %61 %82 %84 + %86 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %86 %85 + %87 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %88 = OpLoad %float %87 + OpSelectionMerge %89 None + OpSwitch %uint_0 %90 + %90 = OpLabel + OpBranch %91 + %91 = OpLabel + %92 = OpPhi %float %float_n0_5 %90 %93 %94 + %95 = OpPhi %int %int_1 %90 %96 %94 + %97 = OpSLessThan %bool %95 %int_800 + OpLoopMerge %98 %94 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSMod %int %95 %int_32 + %101 = OpIEqual %bool %100 %int_0 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %104 = OpLabel + %105 = OpConvertSToF %float %95 + %106 = OpExtInst %float %1 Round %49 + %107 = OpFMod %float %105 %106 + %108 = OpFOrdLessThanEqual %bool %107 %float_0_00999999978 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %109 + %110 = OpLabel + %111 = OpFAdd %float %92 %float_100 + OpBranch %109 + %109 = OpLabel + %112 = OpPhi %float %92 %104 %111 %110 + OpBranch %102 + %102 = OpLabel + %93 = OpPhi %float %113 %103 %112 %109 + %114 = OpConvertSToF %float %95 + %115 = OpFOrdGreaterThanEqual %bool %114 %88 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + OpBranch %98 + %98 = OpLabel + %118 = OpPhi %float %43 %91 %93 %117 + %119 = OpPhi %float %92 %91 %93 %117 + %120 = OpPhi %bool %false %91 %true %117 + OpSelectionMerge %121 None + OpBranchConditional %120 %89 %121 + %103 = OpLabel + %113 = OpFAdd %float %92 %float_0_400000006 + OpBranch %102 + %116 = OpLabel + OpBranch %94 + %94 = OpLabel + %96 = OpIAdd %int %95 %int_1 + OpBranch %91 + %121 = OpLabel + OpBranch %89 + %89 = OpLabel + %122 = OpPhi %float %118 %98 %119 %121 + %123 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %123 %122 + %124 = OpLoad %float %86 + %125 = OpLoad %float %123 + %126 = OpFAdd %float %124 %125 + %127 = OpAccessChain %_ptr_Function_float %c %uint_2 + OpStore %127 %126 + OpBranch %128 + %128 = OpLabel + %129 = OpPhi %int %int_0 %89 %130 %131 + %132 = OpSLessThan %bool %129 %int_3 + OpLoopMerge %133 %131 None + OpBranchConditional %132 %134 %133 + %134 = OpLabel + %135 = OpAccessChain %_ptr_Function_float %c %129 + %136 = OpLoad %float %135 + %137 = OpFOrdGreaterThanEqual %bool %136 %float_1 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %138 + %139 = OpLabel + %140 = OpLoad %float %135 + %141 = OpLoad %float %135 + %142 = OpFMul %float %140 %141 + OpStore %135 %142 + OpBranch %138 + %138 = OpLabel + OpBranch %131 + %131 = OpLabel + %130 = OpIAdd %int %129 %int_1 + OpBranch %128 + %133 = OpLabel + %143 = OpLoad %v3float %c + %144 = OpExtInst %v3float %1 FAbs %143 + %145 = OpExtInst %v3float %1 Normalize %144 + %146 = OpCompositeExtract %float %145 0 + %147 = OpCompositeExtract %float %145 1 + %148 = OpCompositeExtract %float %145 2 + %149 = OpCompositeConstruct %v4float %146 %147 %148 %float_1 + OpStore %_GLF_color %149 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..3102fad3c5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.hlsl @@ -0,0 +1,202 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float x_51 = 0.0f; + float x_55 = 0.0f; + float x_56 = 0.0f; + float x_81 = 0.0f; + float x_82 = 0.0f; + float x_118 = 0.0f; + float x_119 = 0.0f; + float x_55_phi = 0.0f; + int x_58_phi = 0; + float x_81_phi = 0.0f; + float x_82_phi = 0.0f; + bool x_83_phi = false; + float x_85_phi = 0.0f; + float x_122_phi = 0.0f; + int x_129_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_47 = asfloat(x_7[0].x); + const float x_49 = round((x_47 * 0.125f)); + x_51 = gl_FragCoord.x; + switch(0u) { + default: { + x_55_phi = -0.5f; + x_58_phi = 1; + while (true) { + float x_68 = 0.0f; + float x_76 = 0.0f; + int x_59 = 0; + float x_56_phi = 0.0f; + x_55 = x_55_phi; + const int x_58 = x_58_phi; + x_81_phi = 0.0f; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + float x_75 = 0.0f; + float x_76_phi = 0.0f; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006f); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((float(x_58) % round(x_49)) <= 0.01f)) { + x_75 = (x_55 + 100.0f); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((float(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + const bool x_83 = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + break; + } + } + float x_88 = 0.0f; + float x_92 = 0.0f; + float x_93 = 0.0f; + float x_92_phi = 0.0f; + int x_95_phi = 0; + float x_118_phi = 0.0f; + float x_119_phi = 0.0f; + bool x_120_phi = false; + const float x_85 = x_85_phi; + c.x = x_85; + x_88 = gl_FragCoord.y; + switch(0u) { + default: { + x_92_phi = -0.5f; + x_95_phi = 1; + while (true) { + float x_113 = 0.0f; + float x_112 = 0.0f; + int x_96 = 0; + float x_93_phi = 0.0f; + x_92 = x_92_phi; + const int x_95 = x_95_phi; + x_118_phi = 0.0f; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + float x_111 = 0.0f; + float x_112_phi = 0.0f; + if (((x_95 % 32) == 0)) { + x_113 = (x_92 + 0.400000006f); + x_93_phi = x_113; + } else { + x_112_phi = x_92; + if (((float(x_95) % round(x_49)) <= 0.01f)) { + x_111 = (x_92 + 100.0f); + x_112_phi = x_111; + } + x_112 = x_112_phi; + x_93_phi = x_112; + } + x_93 = x_93_phi; + if ((float(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + const bool x_120 = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + break; + } + } + const float x_122 = x_122_phi; + c.y = x_122; + const float x_124 = c.x; + const float x_125 = c.y; + c.z = (x_124 + x_125); + x_129_phi = 0; + while (true) { + int x_130 = 0; + const int x_129 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + const int x_135_save = x_129; + const float x_136 = c[x_135_save]; + if ((x_136 >= 1.0f)) { + const float x_140 = c[x_135_save]; + const float x_141 = c[x_135_save]; + set_float3(c, x_135_save, (x_140 * x_141)); + } + { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + const float3 x_145 = normalize(abs(c)); + x_GLF_color = float4(x_145.x, x_145.y, x_145.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.msl new file mode 100755 index 0000000000..ccf66a646d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.msl @@ -0,0 +1,208 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float x_51 = 0.0f; + float x_55 = 0.0f; + float x_56 = 0.0f; + float x_81 = 0.0f; + float x_82 = 0.0f; + float x_118 = 0.0f; + float x_119 = 0.0f; + float x_55_phi = 0.0f; + int x_58_phi = 0; + float x_81_phi = 0.0f; + float x_82_phi = 0.0f; + bool x_83_phi = false; + float x_85_phi = 0.0f; + float x_122_phi = 0.0f; + int x_129_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_47 = x_7.resolution.x; + float const x_49 = rint((x_47 * 0.125f)); + x_51 = (*(tint_symbol_5)).x; + switch(0u) { + default: { + x_55_phi = -0.5f; + x_58_phi = 1; + while (true) { + float x_68 = 0.0f; + float x_76 = 0.0f; + int x_59 = 0; + float x_56_phi = 0.0f; + x_55 = x_55_phi; + int const x_58 = x_58_phi; + x_81_phi = 0.0f; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + float x_75 = 0.0f; + float x_76_phi = 0.0f; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006f); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((float(x_58) % rint(x_49)) <= 0.01f)) { + x_75 = (x_55 + 100.0f); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((float(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + bool const x_83 = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + break; + } + } + float x_88 = 0.0f; + float x_92 = 0.0f; + float x_93 = 0.0f; + float x_92_phi = 0.0f; + int x_95_phi = 0; + float x_118_phi = 0.0f; + float x_119_phi = 0.0f; + bool x_120_phi = false; + float const x_85 = x_85_phi; + c.x = x_85; + x_88 = (*(tint_symbol_5)).y; + switch(0u) { + default: { + x_92_phi = -0.5f; + x_95_phi = 1; + while (true) { + float x_113 = 0.0f; + float x_112 = 0.0f; + int x_96 = 0; + float x_93_phi = 0.0f; + x_92 = x_92_phi; + int const x_95 = x_95_phi; + x_118_phi = 0.0f; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + float x_111 = 0.0f; + float x_112_phi = 0.0f; + if (((x_95 % 32) == 0)) { + x_113 = (x_92 + 0.400000006f); + x_93_phi = x_113; + } else { + x_112_phi = x_92; + if (((float(x_95) % rint(x_49)) <= 0.01f)) { + x_111 = (x_92 + 100.0f); + x_112_phi = x_111; + } + x_112 = x_112_phi; + x_93_phi = x_112; + } + x_93 = x_93_phi; + if ((float(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + bool const x_120 = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + break; + } + } + float const x_122 = x_122_phi; + c.y = x_122; + float const x_124 = c.x; + float const x_125 = c.y; + c.z = (x_124 + x_125); + x_129_phi = 0; + while (true) { + int x_130 = 0; + int const x_129 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + int const x_135_save = x_129; + float const x_136 = c[x_135_save]; + if ((x_136 >= 1.0f)) { + float const x_140 = c[x_135_save]; + float const x_141 = c[x_135_save]; + c[x_135_save] = (x_140 * x_141); + } + { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + float3 const x_143 = c; + float3 const x_145 = normalize(fabs(x_143)); + *(tint_symbol_6) = float4(x_145.x, x_145.y, x_145.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\u3lk.0.metal:60:29: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_58) % rint(x_49)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~ +T:\tmp\u3lk.0.metal:127:29: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_95) % rint(x_49)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~ +2 errors generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..d596d8556b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.spvasm @@ -0,0 +1,449 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 254 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %c "c" + OpName %x_51 "x_51" + OpName %x_55 "x_55" + OpName %x_56 "x_56" + OpName %x_81 "x_81" + OpName %x_82 "x_82" + OpName %x_118 "x_118" + OpName %x_119 "x_119" + OpName %x_55_phi "x_55_phi" + OpName %x_58_phi "x_58_phi" + OpName %x_81_phi "x_81_phi" + OpName %x_82_phi "x_82_phi" + OpName %x_83_phi "x_83_phi" + OpName %x_85_phi "x_85_phi" + OpName %x_122_phi "x_122_phi" + OpName %x_129_phi "x_129_phi" + OpName %x_68 "x_68" + OpName %x_76 "x_76" + OpName %x_59 "x_59" + OpName %x_56_phi "x_56_phi" + OpName %x_75 "x_75" + OpName %x_76_phi "x_76_phi" + OpName %x_88 "x_88" + OpName %x_92 "x_92" + OpName %x_93 "x_93" + OpName %x_92_phi "x_92_phi" + OpName %x_95_phi "x_95_phi" + OpName %x_118_phi "x_118_phi" + OpName %x_119_phi "x_119_phi" + OpName %x_120_phi "x_120_phi" + OpName %x_113 "x_113" + OpName %x_112 "x_112" + OpName %x_96 "x_96" + OpName %x_93_phi "x_93_phi" + OpName %x_111 "x_111" + OpName %x_112_phi "x_112_phi" + OpName %x_130 "x_130" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %22 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %36 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %42 = OpConstantNull %bool + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %49 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0_125 = OpConstant %float 0.125 +%_ptr_Private_float = OpTypePointer Private %float + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %int_800 = OpConstant %int 800 + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %241 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %22 + %x_51 = OpVariable %_ptr_Function_float Function %25 + %x_55 = OpVariable %_ptr_Function_float Function %25 + %x_56 = OpVariable %_ptr_Function_float Function %25 + %x_81 = OpVariable %_ptr_Function_float Function %25 + %x_82 = OpVariable %_ptr_Function_float Function %25 + %x_118 = OpVariable %_ptr_Function_float Function %25 + %x_119 = OpVariable %_ptr_Function_float Function %25 + %x_55_phi = OpVariable %_ptr_Function_float Function %25 + %x_58_phi = OpVariable %_ptr_Function_int Function %36 + %x_81_phi = OpVariable %_ptr_Function_float Function %25 + %x_82_phi = OpVariable %_ptr_Function_float Function %25 + %x_83_phi = OpVariable %_ptr_Function_bool Function %42 + %x_85_phi = OpVariable %_ptr_Function_float Function %25 + %x_122_phi = OpVariable %_ptr_Function_float Function %25 + %x_129_phi = OpVariable %_ptr_Function_int Function %36 + %x_68 = OpVariable %_ptr_Function_float Function %25 + %x_76 = OpVariable %_ptr_Function_float Function %25 + %x_59 = OpVariable %_ptr_Function_int Function %36 + %x_56_phi = OpVariable %_ptr_Function_float Function %25 + %x_75 = OpVariable %_ptr_Function_float Function %25 + %x_76_phi = OpVariable %_ptr_Function_float Function %25 + %x_88 = OpVariable %_ptr_Function_float Function %25 + %x_92 = OpVariable %_ptr_Function_float Function %25 + %x_93 = OpVariable %_ptr_Function_float Function %25 + %x_92_phi = OpVariable %_ptr_Function_float Function %25 + %x_95_phi = OpVariable %_ptr_Function_int Function %36 + %x_118_phi = OpVariable %_ptr_Function_float Function %25 + %x_119_phi = OpVariable %_ptr_Function_float Function %25 + %x_120_phi = OpVariable %_ptr_Function_bool Function %42 + %x_113 = OpVariable %_ptr_Function_float Function %25 + %x_112 = OpVariable %_ptr_Function_float Function %25 + %x_96 = OpVariable %_ptr_Function_int Function %36 + %x_93_phi = OpVariable %_ptr_Function_float Function %25 + %x_111 = OpVariable %_ptr_Function_float Function %25 + %x_112_phi = OpVariable %_ptr_Function_float Function %25 + %x_130 = OpVariable %_ptr_Function_int Function %36 + OpStore %c %49 + %53 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %54 = OpLoad %float %53 + %58 = OpFMul %float %54 %float_0_125 + %55 = OpExtInst %float %56 RoundEven %58 + %60 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %61 = OpLoad %float %60 + OpStore %x_51 %61 + OpSelectionMerge %62 None + OpSwitch %uint_0 %63 + %63 = OpLabel + OpStore %x_55_phi %float_n0_5 + OpStore %x_58_phi %int_1 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %74 = OpLoad %float %x_55_phi + OpStore %x_55 %74 + %75 = OpLoad %int %x_58_phi + OpStore %x_81_phi %float_0 + %77 = OpLoad %float %x_55 + OpStore %x_82_phi %77 + OpStore %x_83_phi %false + %80 = OpSLessThan %bool %75 %int_800 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %67 + %81 = OpLabel + %87 = OpSMod %int %75 %int_32 + %89 = OpIEqual %bool %87 %int_0 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 + %91 = OpLabel + %93 = OpLoad %float %x_55 + %95 = OpFAdd %float %93 %float_0_400000006 + OpStore %x_68 %95 + %96 = OpLoad %float %x_68 + OpStore %x_56_phi %96 + OpBranch %90 + %92 = OpLabel + %97 = OpLoad %float %x_55 + OpStore %x_76_phi %97 + %98 = OpConvertSToF %float %75 + %99 = OpExtInst %float %56 RoundEven %55 + %100 = OpFMod %float %98 %99 + %102 = OpFOrdLessThanEqual %bool %100 %float_0_00999999978 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %103 + %104 = OpLabel + %105 = OpLoad %float %x_55 + %107 = OpFAdd %float %105 %float_100 + OpStore %x_75 %107 + %108 = OpLoad %float %x_75 + OpStore %x_76_phi %108 + OpBranch %103 + %103 = OpLabel + %109 = OpLoad %float %x_76_phi + OpStore %x_76 %109 + %110 = OpLoad %float %x_76 + OpStore %x_56_phi %110 + OpBranch %90 + %90 = OpLabel + %111 = OpLoad %float %x_56_phi + OpStore %x_56 %111 + %112 = OpConvertSToF %float %75 + %113 = OpLoad %float %x_51 + %114 = OpFOrdGreaterThanEqual %bool %112 %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %115 + %116 = OpLabel + %117 = OpLoad %float %x_56 + OpStore %x_81_phi %117 + %118 = OpLoad %float %x_56 + OpStore %x_82_phi %118 + OpStore %x_83_phi %true + OpBranch %67 + %115 = OpLabel + OpBranch %68 + %68 = OpLabel + %120 = OpIAdd %int %75 %int_1 + OpStore %x_59 %120 + %121 = OpLoad %float %x_56 + OpStore %x_55_phi %121 + %122 = OpLoad %int %x_59 + OpStore %x_58_phi %122 + OpBranch %66 + %67 = OpLabel + %123 = OpLoad %float %x_81_phi + OpStore %x_81 %123 + %124 = OpLoad %float %x_82_phi + OpStore %x_82 %124 + %125 = OpLoad %bool %x_83_phi + %126 = OpLoad %float %x_81 + OpStore %x_85_phi %126 + OpSelectionMerge %127 None + OpBranchConditional %125 %128 %127 + %128 = OpLabel + OpBranch %62 + %127 = OpLabel + %129 = OpLoad %float %x_82 + OpStore %x_85_phi %129 + OpBranch %62 + %62 = OpLabel + %138 = OpLoad %float %x_85_phi + %139 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %139 %138 + %141 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %142 = OpLoad %float %141 + OpStore %x_88 %142 + OpSelectionMerge %143 None + OpSwitch %uint_0 %144 + %144 = OpLabel + OpStore %x_92_phi %float_n0_5 + OpStore %x_95_phi %int_1 + OpBranch %145 + %145 = OpLabel + OpLoopMerge %146 %147 None + OpBranch %148 + %148 = OpLabel + %153 = OpLoad %float %x_92_phi + OpStore %x_92 %153 + %154 = OpLoad %int %x_95_phi + OpStore %x_118_phi %float_0 + %155 = OpLoad %float %x_92 + OpStore %x_119_phi %155 + OpStore %x_120_phi %false + %156 = OpSLessThan %bool %154 %int_800 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %159 + %158 = OpLabel + OpBranch %157 + %159 = OpLabel + OpBranch %146 + %157 = OpLabel + %162 = OpSMod %int %154 %int_32 + %163 = OpIEqual %bool %162 %int_0 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %166 + %165 = OpLabel + %167 = OpLoad %float %x_92 + %168 = OpFAdd %float %167 %float_0_400000006 + OpStore %x_113 %168 + %169 = OpLoad %float %x_113 + OpStore %x_93_phi %169 + OpBranch %164 + %166 = OpLabel + %170 = OpLoad %float %x_92 + OpStore %x_112_phi %170 + %171 = OpConvertSToF %float %154 + %172 = OpExtInst %float %56 RoundEven %55 + %173 = OpFMod %float %171 %172 + %174 = OpFOrdLessThanEqual %bool %173 %float_0_00999999978 + OpSelectionMerge %175 None + OpBranchConditional %174 %176 %175 + %176 = OpLabel + %177 = OpLoad %float %x_92 + %178 = OpFAdd %float %177 %float_100 + OpStore %x_111 %178 + %179 = OpLoad %float %x_111 + OpStore %x_112_phi %179 + OpBranch %175 + %175 = OpLabel + %180 = OpLoad %float %x_112_phi + OpStore %x_112 %180 + %181 = OpLoad %float %x_112 + OpStore %x_93_phi %181 + OpBranch %164 + %164 = OpLabel + %182 = OpLoad %float %x_93_phi + OpStore %x_93 %182 + %183 = OpConvertSToF %float %154 + %184 = OpLoad %float %x_88 + %185 = OpFOrdGreaterThanEqual %bool %183 %184 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %186 + %187 = OpLabel + %188 = OpLoad %float %x_93 + OpStore %x_118_phi %188 + %189 = OpLoad %float %x_93 + OpStore %x_119_phi %189 + OpStore %x_120_phi %true + OpBranch %146 + %186 = OpLabel + OpBranch %147 + %147 = OpLabel + %190 = OpIAdd %int %154 %int_1 + OpStore %x_96 %190 + %191 = OpLoad %float %x_93 + OpStore %x_92_phi %191 + %192 = OpLoad %int %x_96 + OpStore %x_95_phi %192 + OpBranch %145 + %146 = OpLabel + %193 = OpLoad %float %x_118_phi + OpStore %x_118 %193 + %194 = OpLoad %float %x_119_phi + OpStore %x_119 %194 + %195 = OpLoad %bool %x_120_phi + %196 = OpLoad %float %x_118 + OpStore %x_122_phi %196 + OpSelectionMerge %197 None + OpBranchConditional %195 %198 %197 + %198 = OpLabel + OpBranch %143 + %197 = OpLabel + %199 = OpLoad %float %x_119 + OpStore %x_122_phi %199 + OpBranch %143 + %143 = OpLabel + %200 = OpLoad %float %x_122_phi + %201 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %201 %200 + %202 = OpAccessChain %_ptr_Function_float %c %uint_0 + %203 = OpLoad %float %202 + %204 = OpAccessChain %_ptr_Function_float %c %uint_1 + %205 = OpLoad %float %204 + %207 = OpAccessChain %_ptr_Function_float %c %uint_2 + %208 = OpFAdd %float %203 %205 + OpStore %207 %208 + OpStore %x_129_phi %int_0 + OpBranch %209 + %209 = OpLabel + OpLoopMerge %210 %211 None + OpBranch %212 + %212 = OpLabel + %214 = OpLoad %int %x_129_phi + %216 = OpSLessThan %bool %214 %int_3 + OpSelectionMerge %217 None + OpBranchConditional %216 %218 %219 + %218 = OpLabel + OpBranch %217 + %219 = OpLabel + OpBranch %210 + %217 = OpLabel + %220 = OpAccessChain %_ptr_Function_float %c %214 + %221 = OpLoad %float %220 + %223 = OpFOrdGreaterThanEqual %bool %221 %float_1 + OpSelectionMerge %224 None + OpBranchConditional %223 %225 %224 + %225 = OpLabel + %226 = OpAccessChain %_ptr_Function_float %c %214 + %227 = OpLoad %float %226 + %228 = OpAccessChain %_ptr_Function_float %c %214 + %229 = OpLoad %float %228 + %230 = OpAccessChain %_ptr_Function_float %c %214 + %231 = OpFMul %float %227 %229 + OpStore %230 %231 + OpBranch %224 + %224 = OpLabel + OpBranch %211 + %211 = OpLabel + %232 = OpIAdd %int %214 %int_1 + OpStore %x_130 %232 + %233 = OpLoad %int %x_130 + OpStore %x_129_phi %233 + OpBranch %209 + %210 = OpLabel + %234 = OpLoad %v3float %c + %236 = OpExtInst %v3float %56 FAbs %234 + %235 = OpExtInst %v3float %56 Normalize %236 + %237 = OpCompositeExtract %float %235 0 + %238 = OpCompositeExtract %float %235 1 + %239 = OpCompositeExtract %float %235 2 + %240 = OpCompositeConstruct %v4float %237 %238 %239 %float_1 + OpStore %x_GLF_color %240 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %241 +%tint_symbol_1 = OpFunctionParameter %main_out + %245 = OpLabel + %246 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %246 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %248 = OpLabel + %249 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %249 + %250 = OpFunctionCall %void %main_1 + %252 = OpLoad %v4float %x_GLF_color + %253 = OpCompositeConstruct %main_out %252 + %251 = OpFunctionCall %void %tint_symbol_3 %253 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..20e6da9e58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.spvasm.expected.wgsl @@ -0,0 +1,200 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec3; + var x_51 : f32; + var x_55 : f32; + var x_56 : f32; + var x_81 : f32; + var x_82 : f32; + var x_118 : f32; + var x_119 : f32; + var x_55_phi : f32; + var x_58_phi : i32; + var x_81_phi : f32; + var x_82_phi : f32; + var x_83_phi : bool; + var x_85_phi : f32; + var x_122_phi : f32; + var x_129_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_47 : f32 = x_7.resolution.x; + let x_49 : f32 = round((x_47 * 0.125)); + x_51 = gl_FragCoord.x; + switch(0u) { + default: { + x_55_phi = -0.5; + x_58_phi = 1; + loop { + var x_68 : f32; + var x_76 : f32; + var x_59 : i32; + var x_56_phi : f32; + x_55 = x_55_phi; + let x_58 : i32 = x_58_phi; + x_81_phi = 0.0; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + var x_75 : f32; + var x_76_phi : f32; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((f32(x_58) % round(x_49)) <= 0.01)) { + x_75 = (x_55 + 100.0); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((f32(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + + continuing { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + let x_83 : bool = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + } + } + var x_88 : f32; + var x_92 : f32; + var x_93 : f32; + var x_92_phi : f32; + var x_95_phi : i32; + var x_118_phi : f32; + var x_119_phi : f32; + var x_120_phi : bool; + let x_85 : f32 = x_85_phi; + let x_86 : ptr = &(c.x); + *(x_86) = x_85; + x_88 = gl_FragCoord.y; + switch(0u) { + default: { + x_92_phi = -0.5; + x_95_phi = 1; + loop { + var x_113 : f32; + var x_112 : f32; + var x_96 : i32; + var x_93_phi : f32; + x_92 = x_92_phi; + let x_95 : i32 = x_95_phi; + x_118_phi = 0.0; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + var x_111 : f32; + var x_112_phi : f32; + if (((x_95 % 32) == 0)) { + x_113 = (x_92 + 0.400000006); + x_93_phi = x_113; + } else { + x_112_phi = x_92; + if (((f32(x_95) % round(x_49)) <= 0.01)) { + x_111 = (x_92 + 100.0); + x_112_phi = x_111; + } + x_112 = x_112_phi; + x_93_phi = x_112; + } + x_93 = x_93_phi; + if ((f32(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + + continuing { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + let x_120 : bool = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + } + } + let x_122 : f32 = x_122_phi; + let x_123 : ptr = &(c.y); + *(x_123) = x_122; + let x_124 : f32 = *(x_86); + let x_125 : f32 = *(x_123); + c.z = (x_124 + x_125); + x_129_phi = 0; + loop { + var x_130 : i32; + let x_129 : i32 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + let x_135 : ptr = &(c[x_129]); + let x_136 : f32 = *(x_135); + if ((x_136 >= 1.0)) { + let x_140 : f32 = *(x_135); + let x_141 : f32 = *(x_135); + *(x_135) = (x_140 * x_141); + } + + continuing { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + let x_143 : vec3 = c; + let x_145 : vec3 = normalize(abs(x_143)); + x_GLF_color = vec4(x_145.x, x_145.y, x_145.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl new file mode 100644 index 0000000000..20e6da9e58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl @@ -0,0 +1,200 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec3; + var x_51 : f32; + var x_55 : f32; + var x_56 : f32; + var x_81 : f32; + var x_82 : f32; + var x_118 : f32; + var x_119 : f32; + var x_55_phi : f32; + var x_58_phi : i32; + var x_81_phi : f32; + var x_82_phi : f32; + var x_83_phi : bool; + var x_85_phi : f32; + var x_122_phi : f32; + var x_129_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_47 : f32 = x_7.resolution.x; + let x_49 : f32 = round((x_47 * 0.125)); + x_51 = gl_FragCoord.x; + switch(0u) { + default: { + x_55_phi = -0.5; + x_58_phi = 1; + loop { + var x_68 : f32; + var x_76 : f32; + var x_59 : i32; + var x_56_phi : f32; + x_55 = x_55_phi; + let x_58 : i32 = x_58_phi; + x_81_phi = 0.0; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + var x_75 : f32; + var x_76_phi : f32; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((f32(x_58) % round(x_49)) <= 0.01)) { + x_75 = (x_55 + 100.0); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((f32(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + + continuing { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + let x_83 : bool = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + } + } + var x_88 : f32; + var x_92 : f32; + var x_93 : f32; + var x_92_phi : f32; + var x_95_phi : i32; + var x_118_phi : f32; + var x_119_phi : f32; + var x_120_phi : bool; + let x_85 : f32 = x_85_phi; + let x_86 : ptr = &(c.x); + *(x_86) = x_85; + x_88 = gl_FragCoord.y; + switch(0u) { + default: { + x_92_phi = -0.5; + x_95_phi = 1; + loop { + var x_113 : f32; + var x_112 : f32; + var x_96 : i32; + var x_93_phi : f32; + x_92 = x_92_phi; + let x_95 : i32 = x_95_phi; + x_118_phi = 0.0; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + var x_111 : f32; + var x_112_phi : f32; + if (((x_95 % 32) == 0)) { + x_113 = (x_92 + 0.400000006); + x_93_phi = x_113; + } else { + x_112_phi = x_92; + if (((f32(x_95) % round(x_49)) <= 0.01)) { + x_111 = (x_92 + 100.0); + x_112_phi = x_111; + } + x_112 = x_112_phi; + x_93_phi = x_112; + } + x_93 = x_93_phi; + if ((f32(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + + continuing { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + let x_120 : bool = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + } + } + let x_122 : f32 = x_122_phi; + let x_123 : ptr = &(c.y); + *(x_123) = x_122; + let x_124 : f32 = *(x_86); + let x_125 : f32 = *(x_123); + c.z = (x_124 + x_125); + x_129_phi = 0; + loop { + var x_130 : i32; + let x_129 : i32 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + let x_135 : ptr = &(c[x_129]); + let x_136 : f32 = *(x_135); + if ((x_136 >= 1.0)) { + let x_140 : f32 = *(x_135); + let x_141 : f32 = *(x_135); + *(x_135) = (x_140 * x_141); + } + + continuing { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + let x_143 : vec3 = c; + let x_145 : vec3 = normalize(abs(x_143)); + x_GLF_color = vec4(x_145.x, x_145.y, x_145.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..3102fad3c5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.hlsl @@ -0,0 +1,202 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float x_51 = 0.0f; + float x_55 = 0.0f; + float x_56 = 0.0f; + float x_81 = 0.0f; + float x_82 = 0.0f; + float x_118 = 0.0f; + float x_119 = 0.0f; + float x_55_phi = 0.0f; + int x_58_phi = 0; + float x_81_phi = 0.0f; + float x_82_phi = 0.0f; + bool x_83_phi = false; + float x_85_phi = 0.0f; + float x_122_phi = 0.0f; + int x_129_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_47 = asfloat(x_7[0].x); + const float x_49 = round((x_47 * 0.125f)); + x_51 = gl_FragCoord.x; + switch(0u) { + default: { + x_55_phi = -0.5f; + x_58_phi = 1; + while (true) { + float x_68 = 0.0f; + float x_76 = 0.0f; + int x_59 = 0; + float x_56_phi = 0.0f; + x_55 = x_55_phi; + const int x_58 = x_58_phi; + x_81_phi = 0.0f; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + float x_75 = 0.0f; + float x_76_phi = 0.0f; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006f); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((float(x_58) % round(x_49)) <= 0.01f)) { + x_75 = (x_55 + 100.0f); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((float(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + const bool x_83 = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + break; + } + } + float x_88 = 0.0f; + float x_92 = 0.0f; + float x_93 = 0.0f; + float x_92_phi = 0.0f; + int x_95_phi = 0; + float x_118_phi = 0.0f; + float x_119_phi = 0.0f; + bool x_120_phi = false; + const float x_85 = x_85_phi; + c.x = x_85; + x_88 = gl_FragCoord.y; + switch(0u) { + default: { + x_92_phi = -0.5f; + x_95_phi = 1; + while (true) { + float x_113 = 0.0f; + float x_112 = 0.0f; + int x_96 = 0; + float x_93_phi = 0.0f; + x_92 = x_92_phi; + const int x_95 = x_95_phi; + x_118_phi = 0.0f; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + float x_111 = 0.0f; + float x_112_phi = 0.0f; + if (((x_95 % 32) == 0)) { + x_113 = (x_92 + 0.400000006f); + x_93_phi = x_113; + } else { + x_112_phi = x_92; + if (((float(x_95) % round(x_49)) <= 0.01f)) { + x_111 = (x_92 + 100.0f); + x_112_phi = x_111; + } + x_112 = x_112_phi; + x_93_phi = x_112; + } + x_93 = x_93_phi; + if ((float(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + const bool x_120 = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + break; + } + } + const float x_122 = x_122_phi; + c.y = x_122; + const float x_124 = c.x; + const float x_125 = c.y; + c.z = (x_124 + x_125); + x_129_phi = 0; + while (true) { + int x_130 = 0; + const int x_129 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + const int x_135_save = x_129; + const float x_136 = c[x_135_save]; + if ((x_136 >= 1.0f)) { + const float x_140 = c[x_135_save]; + const float x_141 = c[x_135_save]; + set_float3(c, x_135_save, (x_140 * x_141)); + } + { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + const float3 x_145 = normalize(abs(c)); + x_GLF_color = float4(x_145.x, x_145.y, x_145.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.msl new file mode 100755 index 0000000000..f28bdc8e20 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.msl @@ -0,0 +1,208 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float x_51 = 0.0f; + float x_55 = 0.0f; + float x_56 = 0.0f; + float x_81 = 0.0f; + float x_82 = 0.0f; + float x_118 = 0.0f; + float x_119 = 0.0f; + float x_55_phi = 0.0f; + int x_58_phi = 0; + float x_81_phi = 0.0f; + float x_82_phi = 0.0f; + bool x_83_phi = false; + float x_85_phi = 0.0f; + float x_122_phi = 0.0f; + int x_129_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_47 = x_7.resolution.x; + float const x_49 = rint((x_47 * 0.125f)); + x_51 = (*(tint_symbol_5)).x; + switch(0u) { + default: { + x_55_phi = -0.5f; + x_58_phi = 1; + while (true) { + float x_68 = 0.0f; + float x_76 = 0.0f; + int x_59 = 0; + float x_56_phi = 0.0f; + x_55 = x_55_phi; + int const x_58 = x_58_phi; + x_81_phi = 0.0f; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + float x_75 = 0.0f; + float x_76_phi = 0.0f; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006f); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((float(x_58) % rint(x_49)) <= 0.01f)) { + x_75 = (x_55 + 100.0f); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((float(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + bool const x_83 = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + break; + } + } + float x_88 = 0.0f; + float x_92 = 0.0f; + float x_93 = 0.0f; + float x_92_phi = 0.0f; + int x_95_phi = 0; + float x_118_phi = 0.0f; + float x_119_phi = 0.0f; + bool x_120_phi = false; + float const x_85 = x_85_phi; + c.x = x_85; + x_88 = (*(tint_symbol_5)).y; + switch(0u) { + default: { + x_92_phi = -0.5f; + x_95_phi = 1; + while (true) { + float x_113 = 0.0f; + float x_112 = 0.0f; + int x_96 = 0; + float x_93_phi = 0.0f; + x_92 = x_92_phi; + int const x_95 = x_95_phi; + x_118_phi = 0.0f; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + float x_111 = 0.0f; + float x_112_phi = 0.0f; + if (((x_95 % 32) == 0)) { + x_113 = (x_92 + 0.400000006f); + x_93_phi = x_113; + } else { + x_112_phi = x_92; + if (((float(x_95) % rint(x_49)) <= 0.01f)) { + x_111 = (x_92 + 100.0f); + x_112_phi = x_111; + } + x_112 = x_112_phi; + x_93_phi = x_112; + } + x_93 = x_93_phi; + if ((float(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + bool const x_120 = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + break; + } + } + float const x_122 = x_122_phi; + c.y = x_122; + float const x_124 = c.x; + float const x_125 = c.y; + c.z = (x_124 + x_125); + x_129_phi = 0; + while (true) { + int x_130 = 0; + int const x_129 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + int const x_135_save = x_129; + float const x_136 = c[x_135_save]; + if ((x_136 >= 1.0f)) { + float const x_140 = c[x_135_save]; + float const x_141 = c[x_135_save]; + c[x_135_save] = (x_140 * x_141); + } + { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + float3 const x_143 = c; + float3 const x_145 = normalize(fabs(x_143)); + *(tint_symbol_6) = float4(x_145.x, x_145.y, x_145.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\udmw.0.metal:60:29: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_58) % rint(x_49)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~ +T:\tmp\udmw.0.metal:127:29: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_95) % rint(x_49)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~ +2 errors generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..d596d8556b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.spvasm @@ -0,0 +1,449 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 254 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %c "c" + OpName %x_51 "x_51" + OpName %x_55 "x_55" + OpName %x_56 "x_56" + OpName %x_81 "x_81" + OpName %x_82 "x_82" + OpName %x_118 "x_118" + OpName %x_119 "x_119" + OpName %x_55_phi "x_55_phi" + OpName %x_58_phi "x_58_phi" + OpName %x_81_phi "x_81_phi" + OpName %x_82_phi "x_82_phi" + OpName %x_83_phi "x_83_phi" + OpName %x_85_phi "x_85_phi" + OpName %x_122_phi "x_122_phi" + OpName %x_129_phi "x_129_phi" + OpName %x_68 "x_68" + OpName %x_76 "x_76" + OpName %x_59 "x_59" + OpName %x_56_phi "x_56_phi" + OpName %x_75 "x_75" + OpName %x_76_phi "x_76_phi" + OpName %x_88 "x_88" + OpName %x_92 "x_92" + OpName %x_93 "x_93" + OpName %x_92_phi "x_92_phi" + OpName %x_95_phi "x_95_phi" + OpName %x_118_phi "x_118_phi" + OpName %x_119_phi "x_119_phi" + OpName %x_120_phi "x_120_phi" + OpName %x_113 "x_113" + OpName %x_112 "x_112" + OpName %x_96 "x_96" + OpName %x_93_phi "x_93_phi" + OpName %x_111 "x_111" + OpName %x_112_phi "x_112_phi" + OpName %x_130 "x_130" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %22 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %36 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %42 = OpConstantNull %bool + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %49 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0_125 = OpConstant %float 0.125 +%_ptr_Private_float = OpTypePointer Private %float + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %int_800 = OpConstant %int 800 + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %241 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %22 + %x_51 = OpVariable %_ptr_Function_float Function %25 + %x_55 = OpVariable %_ptr_Function_float Function %25 + %x_56 = OpVariable %_ptr_Function_float Function %25 + %x_81 = OpVariable %_ptr_Function_float Function %25 + %x_82 = OpVariable %_ptr_Function_float Function %25 + %x_118 = OpVariable %_ptr_Function_float Function %25 + %x_119 = OpVariable %_ptr_Function_float Function %25 + %x_55_phi = OpVariable %_ptr_Function_float Function %25 + %x_58_phi = OpVariable %_ptr_Function_int Function %36 + %x_81_phi = OpVariable %_ptr_Function_float Function %25 + %x_82_phi = OpVariable %_ptr_Function_float Function %25 + %x_83_phi = OpVariable %_ptr_Function_bool Function %42 + %x_85_phi = OpVariable %_ptr_Function_float Function %25 + %x_122_phi = OpVariable %_ptr_Function_float Function %25 + %x_129_phi = OpVariable %_ptr_Function_int Function %36 + %x_68 = OpVariable %_ptr_Function_float Function %25 + %x_76 = OpVariable %_ptr_Function_float Function %25 + %x_59 = OpVariable %_ptr_Function_int Function %36 + %x_56_phi = OpVariable %_ptr_Function_float Function %25 + %x_75 = OpVariable %_ptr_Function_float Function %25 + %x_76_phi = OpVariable %_ptr_Function_float Function %25 + %x_88 = OpVariable %_ptr_Function_float Function %25 + %x_92 = OpVariable %_ptr_Function_float Function %25 + %x_93 = OpVariable %_ptr_Function_float Function %25 + %x_92_phi = OpVariable %_ptr_Function_float Function %25 + %x_95_phi = OpVariable %_ptr_Function_int Function %36 + %x_118_phi = OpVariable %_ptr_Function_float Function %25 + %x_119_phi = OpVariable %_ptr_Function_float Function %25 + %x_120_phi = OpVariable %_ptr_Function_bool Function %42 + %x_113 = OpVariable %_ptr_Function_float Function %25 + %x_112 = OpVariable %_ptr_Function_float Function %25 + %x_96 = OpVariable %_ptr_Function_int Function %36 + %x_93_phi = OpVariable %_ptr_Function_float Function %25 + %x_111 = OpVariable %_ptr_Function_float Function %25 + %x_112_phi = OpVariable %_ptr_Function_float Function %25 + %x_130 = OpVariable %_ptr_Function_int Function %36 + OpStore %c %49 + %53 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %54 = OpLoad %float %53 + %58 = OpFMul %float %54 %float_0_125 + %55 = OpExtInst %float %56 RoundEven %58 + %60 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %61 = OpLoad %float %60 + OpStore %x_51 %61 + OpSelectionMerge %62 None + OpSwitch %uint_0 %63 + %63 = OpLabel + OpStore %x_55_phi %float_n0_5 + OpStore %x_58_phi %int_1 + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %74 = OpLoad %float %x_55_phi + OpStore %x_55 %74 + %75 = OpLoad %int %x_58_phi + OpStore %x_81_phi %float_0 + %77 = OpLoad %float %x_55 + OpStore %x_82_phi %77 + OpStore %x_83_phi %false + %80 = OpSLessThan %bool %75 %int_800 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %67 + %81 = OpLabel + %87 = OpSMod %int %75 %int_32 + %89 = OpIEqual %bool %87 %int_0 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %92 + %91 = OpLabel + %93 = OpLoad %float %x_55 + %95 = OpFAdd %float %93 %float_0_400000006 + OpStore %x_68 %95 + %96 = OpLoad %float %x_68 + OpStore %x_56_phi %96 + OpBranch %90 + %92 = OpLabel + %97 = OpLoad %float %x_55 + OpStore %x_76_phi %97 + %98 = OpConvertSToF %float %75 + %99 = OpExtInst %float %56 RoundEven %55 + %100 = OpFMod %float %98 %99 + %102 = OpFOrdLessThanEqual %bool %100 %float_0_00999999978 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %103 + %104 = OpLabel + %105 = OpLoad %float %x_55 + %107 = OpFAdd %float %105 %float_100 + OpStore %x_75 %107 + %108 = OpLoad %float %x_75 + OpStore %x_76_phi %108 + OpBranch %103 + %103 = OpLabel + %109 = OpLoad %float %x_76_phi + OpStore %x_76 %109 + %110 = OpLoad %float %x_76 + OpStore %x_56_phi %110 + OpBranch %90 + %90 = OpLabel + %111 = OpLoad %float %x_56_phi + OpStore %x_56 %111 + %112 = OpConvertSToF %float %75 + %113 = OpLoad %float %x_51 + %114 = OpFOrdGreaterThanEqual %bool %112 %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %115 + %116 = OpLabel + %117 = OpLoad %float %x_56 + OpStore %x_81_phi %117 + %118 = OpLoad %float %x_56 + OpStore %x_82_phi %118 + OpStore %x_83_phi %true + OpBranch %67 + %115 = OpLabel + OpBranch %68 + %68 = OpLabel + %120 = OpIAdd %int %75 %int_1 + OpStore %x_59 %120 + %121 = OpLoad %float %x_56 + OpStore %x_55_phi %121 + %122 = OpLoad %int %x_59 + OpStore %x_58_phi %122 + OpBranch %66 + %67 = OpLabel + %123 = OpLoad %float %x_81_phi + OpStore %x_81 %123 + %124 = OpLoad %float %x_82_phi + OpStore %x_82 %124 + %125 = OpLoad %bool %x_83_phi + %126 = OpLoad %float %x_81 + OpStore %x_85_phi %126 + OpSelectionMerge %127 None + OpBranchConditional %125 %128 %127 + %128 = OpLabel + OpBranch %62 + %127 = OpLabel + %129 = OpLoad %float %x_82 + OpStore %x_85_phi %129 + OpBranch %62 + %62 = OpLabel + %138 = OpLoad %float %x_85_phi + %139 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %139 %138 + %141 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %142 = OpLoad %float %141 + OpStore %x_88 %142 + OpSelectionMerge %143 None + OpSwitch %uint_0 %144 + %144 = OpLabel + OpStore %x_92_phi %float_n0_5 + OpStore %x_95_phi %int_1 + OpBranch %145 + %145 = OpLabel + OpLoopMerge %146 %147 None + OpBranch %148 + %148 = OpLabel + %153 = OpLoad %float %x_92_phi + OpStore %x_92 %153 + %154 = OpLoad %int %x_95_phi + OpStore %x_118_phi %float_0 + %155 = OpLoad %float %x_92 + OpStore %x_119_phi %155 + OpStore %x_120_phi %false + %156 = OpSLessThan %bool %154 %int_800 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %159 + %158 = OpLabel + OpBranch %157 + %159 = OpLabel + OpBranch %146 + %157 = OpLabel + %162 = OpSMod %int %154 %int_32 + %163 = OpIEqual %bool %162 %int_0 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %166 + %165 = OpLabel + %167 = OpLoad %float %x_92 + %168 = OpFAdd %float %167 %float_0_400000006 + OpStore %x_113 %168 + %169 = OpLoad %float %x_113 + OpStore %x_93_phi %169 + OpBranch %164 + %166 = OpLabel + %170 = OpLoad %float %x_92 + OpStore %x_112_phi %170 + %171 = OpConvertSToF %float %154 + %172 = OpExtInst %float %56 RoundEven %55 + %173 = OpFMod %float %171 %172 + %174 = OpFOrdLessThanEqual %bool %173 %float_0_00999999978 + OpSelectionMerge %175 None + OpBranchConditional %174 %176 %175 + %176 = OpLabel + %177 = OpLoad %float %x_92 + %178 = OpFAdd %float %177 %float_100 + OpStore %x_111 %178 + %179 = OpLoad %float %x_111 + OpStore %x_112_phi %179 + OpBranch %175 + %175 = OpLabel + %180 = OpLoad %float %x_112_phi + OpStore %x_112 %180 + %181 = OpLoad %float %x_112 + OpStore %x_93_phi %181 + OpBranch %164 + %164 = OpLabel + %182 = OpLoad %float %x_93_phi + OpStore %x_93 %182 + %183 = OpConvertSToF %float %154 + %184 = OpLoad %float %x_88 + %185 = OpFOrdGreaterThanEqual %bool %183 %184 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %186 + %187 = OpLabel + %188 = OpLoad %float %x_93 + OpStore %x_118_phi %188 + %189 = OpLoad %float %x_93 + OpStore %x_119_phi %189 + OpStore %x_120_phi %true + OpBranch %146 + %186 = OpLabel + OpBranch %147 + %147 = OpLabel + %190 = OpIAdd %int %154 %int_1 + OpStore %x_96 %190 + %191 = OpLoad %float %x_93 + OpStore %x_92_phi %191 + %192 = OpLoad %int %x_96 + OpStore %x_95_phi %192 + OpBranch %145 + %146 = OpLabel + %193 = OpLoad %float %x_118_phi + OpStore %x_118 %193 + %194 = OpLoad %float %x_119_phi + OpStore %x_119 %194 + %195 = OpLoad %bool %x_120_phi + %196 = OpLoad %float %x_118 + OpStore %x_122_phi %196 + OpSelectionMerge %197 None + OpBranchConditional %195 %198 %197 + %198 = OpLabel + OpBranch %143 + %197 = OpLabel + %199 = OpLoad %float %x_119 + OpStore %x_122_phi %199 + OpBranch %143 + %143 = OpLabel + %200 = OpLoad %float %x_122_phi + %201 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %201 %200 + %202 = OpAccessChain %_ptr_Function_float %c %uint_0 + %203 = OpLoad %float %202 + %204 = OpAccessChain %_ptr_Function_float %c %uint_1 + %205 = OpLoad %float %204 + %207 = OpAccessChain %_ptr_Function_float %c %uint_2 + %208 = OpFAdd %float %203 %205 + OpStore %207 %208 + OpStore %x_129_phi %int_0 + OpBranch %209 + %209 = OpLabel + OpLoopMerge %210 %211 None + OpBranch %212 + %212 = OpLabel + %214 = OpLoad %int %x_129_phi + %216 = OpSLessThan %bool %214 %int_3 + OpSelectionMerge %217 None + OpBranchConditional %216 %218 %219 + %218 = OpLabel + OpBranch %217 + %219 = OpLabel + OpBranch %210 + %217 = OpLabel + %220 = OpAccessChain %_ptr_Function_float %c %214 + %221 = OpLoad %float %220 + %223 = OpFOrdGreaterThanEqual %bool %221 %float_1 + OpSelectionMerge %224 None + OpBranchConditional %223 %225 %224 + %225 = OpLabel + %226 = OpAccessChain %_ptr_Function_float %c %214 + %227 = OpLoad %float %226 + %228 = OpAccessChain %_ptr_Function_float %c %214 + %229 = OpLoad %float %228 + %230 = OpAccessChain %_ptr_Function_float %c %214 + %231 = OpFMul %float %227 %229 + OpStore %230 %231 + OpBranch %224 + %224 = OpLabel + OpBranch %211 + %211 = OpLabel + %232 = OpIAdd %int %214 %int_1 + OpStore %x_130 %232 + %233 = OpLoad %int %x_130 + OpStore %x_129_phi %233 + OpBranch %209 + %210 = OpLabel + %234 = OpLoad %v3float %c + %236 = OpExtInst %v3float %56 FAbs %234 + %235 = OpExtInst %v3float %56 Normalize %236 + %237 = OpCompositeExtract %float %235 0 + %238 = OpCompositeExtract %float %235 1 + %239 = OpCompositeExtract %float %235 2 + %240 = OpCompositeConstruct %v4float %237 %238 %239 %float_1 + OpStore %x_GLF_color %240 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %241 +%tint_symbol_1 = OpFunctionParameter %main_out + %245 = OpLabel + %246 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %246 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %248 = OpLabel + %249 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %249 + %250 = OpFunctionCall %void %main_1 + %252 = OpLoad %v4float %x_GLF_color + %253 = OpCompositeConstruct %main_out %252 + %251 = OpFunctionCall %void %tint_symbol_3 %253 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..20e6da9e58 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-colorgrid-modulo-O-move-block-down/1.wgsl.expected.wgsl @@ -0,0 +1,200 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec3; + var x_51 : f32; + var x_55 : f32; + var x_56 : f32; + var x_81 : f32; + var x_82 : f32; + var x_118 : f32; + var x_119 : f32; + var x_55_phi : f32; + var x_58_phi : i32; + var x_81_phi : f32; + var x_82_phi : f32; + var x_83_phi : bool; + var x_85_phi : f32; + var x_122_phi : f32; + var x_129_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_47 : f32 = x_7.resolution.x; + let x_49 : f32 = round((x_47 * 0.125)); + x_51 = gl_FragCoord.x; + switch(0u) { + default: { + x_55_phi = -0.5; + x_58_phi = 1; + loop { + var x_68 : f32; + var x_76 : f32; + var x_59 : i32; + var x_56_phi : f32; + x_55 = x_55_phi; + let x_58 : i32 = x_58_phi; + x_81_phi = 0.0; + x_82_phi = x_55; + x_83_phi = false; + if ((x_58 < 800)) { + } else { + break; + } + var x_75 : f32; + var x_76_phi : f32; + if (((x_58 % 32) == 0)) { + x_68 = (x_55 + 0.400000006); + x_56_phi = x_68; + } else { + x_76_phi = x_55; + if (((f32(x_58) % round(x_49)) <= 0.01)) { + x_75 = (x_55 + 100.0); + x_76_phi = x_75; + } + x_76 = x_76_phi; + x_56_phi = x_76; + } + x_56 = x_56_phi; + if ((f32(x_58) >= x_51)) { + x_81_phi = x_56; + x_82_phi = x_56; + x_83_phi = true; + break; + } + + continuing { + x_59 = (x_58 + 1); + x_55_phi = x_56; + x_58_phi = x_59; + } + } + x_81 = x_81_phi; + x_82 = x_82_phi; + let x_83 : bool = x_83_phi; + x_85_phi = x_81; + if (x_83) { + break; + } + x_85_phi = x_82; + } + } + var x_88 : f32; + var x_92 : f32; + var x_93 : f32; + var x_92_phi : f32; + var x_95_phi : i32; + var x_118_phi : f32; + var x_119_phi : f32; + var x_120_phi : bool; + let x_85 : f32 = x_85_phi; + let x_86 : ptr = &(c.x); + *(x_86) = x_85; + x_88 = gl_FragCoord.y; + switch(0u) { + default: { + x_92_phi = -0.5; + x_95_phi = 1; + loop { + var x_113 : f32; + var x_112 : f32; + var x_96 : i32; + var x_93_phi : f32; + x_92 = x_92_phi; + let x_95 : i32 = x_95_phi; + x_118_phi = 0.0; + x_119_phi = x_92; + x_120_phi = false; + if ((x_95 < 800)) { + } else { + break; + } + var x_111 : f32; + var x_112_phi : f32; + if (((x_95 % 32) == 0)) { + x_113 = (x_92 + 0.400000006); + x_93_phi = x_113; + } else { + x_112_phi = x_92; + if (((f32(x_95) % round(x_49)) <= 0.01)) { + x_111 = (x_92 + 100.0); + x_112_phi = x_111; + } + x_112 = x_112_phi; + x_93_phi = x_112; + } + x_93 = x_93_phi; + if ((f32(x_95) >= x_88)) { + x_118_phi = x_93; + x_119_phi = x_93; + x_120_phi = true; + break; + } + + continuing { + x_96 = (x_95 + 1); + x_92_phi = x_93; + x_95_phi = x_96; + } + } + x_118 = x_118_phi; + x_119 = x_119_phi; + let x_120 : bool = x_120_phi; + x_122_phi = x_118; + if (x_120) { + break; + } + x_122_phi = x_119; + } + } + let x_122 : f32 = x_122_phi; + let x_123 : ptr = &(c.y); + *(x_123) = x_122; + let x_124 : f32 = *(x_86); + let x_125 : f32 = *(x_123); + c.z = (x_124 + x_125); + x_129_phi = 0; + loop { + var x_130 : i32; + let x_129 : i32 = x_129_phi; + if ((x_129 < 3)) { + } else { + break; + } + let x_135 : ptr = &(c[x_129]); + let x_136 : f32 = *(x_135); + if ((x_136 >= 1.0)) { + let x_140 : f32 = *(x_135); + let x_141 : f32 = *(x_135); + *(x_135) = (x_140 * x_141); + } + + continuing { + x_130 = (x_129 + 1); + x_129_phi = x_130; + } + } + let x_143 : vec3 = c; + let x_145 : vec3 = normalize(abs(x_143)); + x_GLF_color = vec4(x_145.x, x_145.y, x_145.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm new file mode 100644 index 0000000000..cc80c9a174 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm @@ -0,0 +1,662 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %pos "pos" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %ipos "ipos" + OpName %i "i" + OpName %map "map" + OpName %p "p" + OpName %canwalk "canwalk" + OpName %v "v" + OpName %directions "directions" + OpName %j "j" + OpName %d "d" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_16 = OpConstant %float 16 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %bool = OpTypeBool + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Private__arr_int_uint_256 = OpTypePointer Private %_arr_int_uint_256 + %map = OpVariable %_ptr_Private__arr_int_uint_256 Private +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %43 = OpConstantComposite %v2int %int_0 %int_0 +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %int_16 = OpConstant %int 16 + %int_14 = OpConstant %int 14 + %false = OpConstantFalse %bool + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %53 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %55 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %int_0_0 = OpConstant %int 0 + %57 = OpConstantComposite %_arr_int_uint_256 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 + %main = OpFunction %void None %18 + %58 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function + %ipos = OpVariable %_ptr_Function_v2int Function + %i = OpVariable %_ptr_Function_int Function + %p = OpVariable %_ptr_Function_v2int Function + %canwalk = OpVariable %_ptr_Function_bool Function + %v = OpVariable %_ptr_Function_int Function + %directions = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %d = OpVariable %_ptr_Function_int Function + %59 = OpLoad %v4float %gl_FragCoord + %60 = OpVectorShuffle %v2float %59 %59 0 1 + %61 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %62 = OpLoad %v2float %61 + %63 = OpFDiv %v2float %60 %62 + OpStore %pos %63 + %64 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %65 = OpLoad %float %64 + %66 = OpFMul %float %65 %float_16 + %67 = OpConvertFToS %int %66 + %68 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %69 = OpLoad %float %68 + %70 = OpFMul %float %69 %float_16 + %71 = OpConvertFToS %int %70 + %72 = OpCompositeConstruct %v2int %67 %71 + OpStore %ipos %72 + OpStore %i %int_0 + OpBranch %73 + %73 = OpLabel + OpLoopMerge %74 %75 None + OpBranch %76 + %76 = OpLabel + %77 = OpLoad %int %i + %78 = OpSLessThan %bool %77 %int_256 + OpBranchConditional %78 %79 %74 + %79 = OpLabel + %80 = OpLoad %int %i + %81 = OpAccessChain %_ptr_Private_int %map %80 + OpStore %81 %int_0 + OpBranch %75 + %75 = OpLabel + %82 = OpLoad %int %i + %83 = OpIAdd %int %82 %int_1 + OpStore %i %83 + OpBranch %73 + %74 = OpLabel + OpStore %p %43 + OpStore %canwalk %true + OpStore %v %int_0 + OpBranch %84 + %84 = OpLabel + OpLoopMerge %85 %86 None + OpBranch %87 + %87 = OpLabel + %88 = OpLoad %int %v + %89 = OpIAdd %int %88 %int_1 + OpStore %v %89 + OpStore %directions %int_0 + %90 = OpAccessChain %_ptr_Function_int %p %uint_0 + %91 = OpLoad %int %90 + %92 = OpSGreaterThan %bool %91 %int_0 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + %95 = OpAccessChain %_ptr_Function_int %p %uint_0 + %96 = OpLoad %int %95 + %97 = OpISub %int %96 %int_2 + %98 = OpAccessChain %_ptr_Function_int %p %uint_1 + %99 = OpLoad %int %98 + %100 = OpIMul %int %99 %int_16 + %101 = OpIAdd %int %97 %100 + %102 = OpAccessChain %_ptr_Private_int %map %101 + %103 = OpLoad %int %102 + %104 = OpIEqual %bool %103 %int_0 + OpBranch %93 + %93 = OpLabel + %105 = OpPhi %bool %92 %87 %104 %94 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + %108 = OpLoad %int %directions + %109 = OpIAdd %int %108 %int_1 + OpStore %directions %109 + OpBranch %106 + %106 = OpLabel + %110 = OpAccessChain %_ptr_Function_int %p %uint_1 + %111 = OpLoad %int %110 + %112 = OpSGreaterThan %bool %111 %int_0 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + %115 = OpAccessChain %_ptr_Function_int %p %uint_0 + %116 = OpLoad %int %115 + %117 = OpAccessChain %_ptr_Function_int %p %uint_1 + %118 = OpLoad %int %117 + %119 = OpISub %int %118 %int_2 + %120 = OpIMul %int %119 %int_16 + %121 = OpIAdd %int %116 %120 + %122 = OpAccessChain %_ptr_Private_int %map %121 + %123 = OpLoad %int %122 + %124 = OpIEqual %bool %123 %int_0 + OpBranch %113 + %113 = OpLabel + %125 = OpPhi %bool %112 %106 %124 %114 + OpSelectionMerge %126 None + OpBranchConditional %125 %127 %126 + %127 = OpLabel + %128 = OpLoad %int %directions + %129 = OpIAdd %int %128 %int_1 + OpStore %directions %129 + OpBranch %126 + %126 = OpLabel + %130 = OpAccessChain %_ptr_Function_int %p %uint_0 + %131 = OpLoad %int %130 + %132 = OpSLessThan %bool %131 %int_14 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %133 + %134 = OpLabel + %135 = OpAccessChain %_ptr_Function_int %p %uint_0 + %136 = OpLoad %int %135 + %137 = OpIAdd %int %136 %int_2 + %138 = OpAccessChain %_ptr_Function_int %p %uint_1 + %139 = OpLoad %int %138 + %140 = OpIMul %int %139 %int_16 + %141 = OpIAdd %int %137 %140 + %142 = OpAccessChain %_ptr_Private_int %map %141 + %143 = OpLoad %int %142 + %144 = OpIEqual %bool %143 %int_0 + OpBranch %133 + %133 = OpLabel + %145 = OpPhi %bool %132 %126 %144 %134 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %148 = OpLoad %int %directions + %149 = OpIAdd %int %148 %int_1 + OpStore %directions %149 + OpBranch %146 + %146 = OpLabel + %150 = OpAccessChain %_ptr_Function_int %p %uint_1 + %151 = OpLoad %int %150 + %152 = OpSLessThan %bool %151 %int_14 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + %155 = OpAccessChain %_ptr_Function_int %p %uint_0 + %156 = OpLoad %int %155 + %157 = OpAccessChain %_ptr_Function_int %p %uint_1 + %158 = OpLoad %int %157 + %159 = OpIAdd %int %158 %int_2 + %160 = OpIMul %int %159 %int_16 + %161 = OpIAdd %int %156 %160 + %162 = OpAccessChain %_ptr_Private_int %map %161 + %163 = OpLoad %int %162 + %164 = OpIEqual %bool %163 %int_0 + OpBranch %153 + %153 = OpLabel + %165 = OpPhi %bool %152 %146 %164 %154 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %166 + %167 = OpLabel + %168 = OpLoad %int %directions + %169 = OpIAdd %int %168 %int_1 + OpStore %directions %169 + OpBranch %166 + %166 = OpLabel + %170 = OpLoad %int %directions + %171 = OpIEqual %bool %170 %int_0 + OpSelectionMerge %172 None + OpBranchConditional %171 %173 %174 + %173 = OpLabel + OpStore %canwalk %false + OpStore %i %int_0 + OpBranch %175 + %175 = OpLabel + OpLoopMerge %176 %177 None + OpBranch %178 + %178 = OpLabel + %179 = OpLoad %int %i + %180 = OpSLessThan %bool %179 %int_8 + OpBranchConditional %180 %181 %176 + %181 = OpLabel + OpStore %j %int_0 + OpBranch %182 + %182 = OpLabel + OpLoopMerge %183 %184 None + OpBranch %185 + %185 = OpLabel + %186 = OpLoad %int %j + %187 = OpSLessThan %bool %186 %int_8 + OpBranchConditional %187 %188 %183 + %188 = OpLabel + %189 = OpLoad %int %j + %190 = OpIMul %int %189 %int_2 + %191 = OpLoad %int %i + %192 = OpIMul %int %191 %int_2 + %193 = OpIMul %int %192 %int_16 + %194 = OpIAdd %int %190 %193 + %195 = OpAccessChain %_ptr_Private_int %map %194 + %196 = OpLoad %int %195 + %197 = OpIEqual %bool %196 %int_0 + OpSelectionMerge %198 None + OpBranchConditional %197 %199 %198 + %199 = OpLabel + %200 = OpLoad %int %j + %201 = OpIMul %int %200 %int_2 + %202 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %202 %201 + %203 = OpLoad %int %i + %204 = OpIMul %int %203 %int_2 + %205 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %205 %204 + OpStore %canwalk %true + OpBranch %198 + %198 = OpLabel + OpBranch %184 + %184 = OpLabel + %206 = OpLoad %int %j + %207 = OpIAdd %int %206 %int_1 + OpStore %j %207 + OpBranch %182 + %183 = OpLabel + OpBranch %177 + %177 = OpLabel + %208 = OpLoad %int %i + %209 = OpIAdd %int %208 %int_1 + OpStore %i %209 + OpBranch %175 + %176 = OpLabel + %210 = OpAccessChain %_ptr_Function_int %p %uint_0 + %211 = OpLoad %int %210 + %212 = OpAccessChain %_ptr_Function_int %p %uint_1 + %213 = OpLoad %int %212 + %214 = OpIMul %int %213 %int_16 + %215 = OpIAdd %int %211 %214 + %216 = OpAccessChain %_ptr_Private_int %map %215 + OpStore %216 %int_1 + OpBranch %172 + %174 = OpLabel + %217 = OpLoad %int %v + %218 = OpLoad %int %directions + %219 = OpSMod %int %217 %218 + OpStore %d %219 + %220 = OpLoad %int %directions + %221 = OpLoad %int %v + %222 = OpIAdd %int %221 %220 + OpStore %v %222 + %223 = OpLoad %int %d + %224 = OpSGreaterThanEqual %bool %223 %int_0 + OpSelectionMerge %225 None + OpBranchConditional %224 %226 %225 + %226 = OpLabel + %227 = OpAccessChain %_ptr_Function_int %p %uint_0 + %228 = OpLoad %int %227 + %229 = OpSGreaterThan %bool %228 %int_0 + OpBranch %225 + %225 = OpLabel + %230 = OpPhi %bool %224 %174 %229 %226 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %231 + %232 = OpLabel + %233 = OpAccessChain %_ptr_Function_int %p %uint_0 + %234 = OpLoad %int %233 + %235 = OpISub %int %234 %int_2 + %236 = OpAccessChain %_ptr_Function_int %p %uint_1 + %237 = OpLoad %int %236 + %238 = OpIMul %int %237 %int_16 + %239 = OpIAdd %int %235 %238 + %240 = OpAccessChain %_ptr_Private_int %map %239 + %241 = OpLoad %int %240 + %242 = OpIEqual %bool %241 %int_0 + OpBranch %231 + %231 = OpLabel + %243 = OpPhi %bool %230 %225 %242 %232 + OpSelectionMerge %244 None + OpBranchConditional %243 %245 %244 + %245 = OpLabel + %246 = OpLoad %int %d + %247 = OpISub %int %246 %int_1 + OpStore %d %247 + %248 = OpAccessChain %_ptr_Function_int %p %uint_0 + %249 = OpLoad %int %248 + %250 = OpAccessChain %_ptr_Function_int %p %uint_1 + %251 = OpLoad %int %250 + %252 = OpIMul %int %251 %int_16 + %253 = OpIAdd %int %249 %252 + %254 = OpAccessChain %_ptr_Private_int %map %253 + OpStore %254 %int_1 + %255 = OpAccessChain %_ptr_Function_int %p %uint_0 + %256 = OpLoad %int %255 + %257 = OpISub %int %256 %int_1 + %258 = OpAccessChain %_ptr_Function_int %p %uint_1 + %259 = OpLoad %int %258 + %260 = OpIMul %int %259 %int_16 + %261 = OpIAdd %int %257 %260 + %262 = OpAccessChain %_ptr_Private_int %map %261 + OpStore %262 %int_1 + %263 = OpAccessChain %_ptr_Function_int %p %uint_0 + %264 = OpLoad %int %263 + %265 = OpISub %int %264 %int_2 + %266 = OpAccessChain %_ptr_Function_int %p %uint_1 + %267 = OpLoad %int %266 + %268 = OpIMul %int %267 %int_16 + %269 = OpIAdd %int %265 %268 + %270 = OpAccessChain %_ptr_Private_int %map %269 + OpStore %270 %int_1 + %271 = OpAccessChain %_ptr_Function_int %p %uint_0 + %272 = OpLoad %int %271 + %273 = OpISub %int %272 %int_2 + %274 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %274 %273 + OpBranch %244 + %244 = OpLabel + %275 = OpLoad %int %d + %276 = OpSGreaterThanEqual %bool %275 %int_0 + OpSelectionMerge %277 None + OpBranchConditional %276 %278 %277 + %278 = OpLabel + %279 = OpAccessChain %_ptr_Function_int %p %uint_1 + %280 = OpLoad %int %279 + %281 = OpSGreaterThan %bool %280 %int_0 + OpBranch %277 + %277 = OpLabel + %282 = OpPhi %bool %276 %244 %281 %278 + OpBranch %283 + %283 = OpLabel + %284 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpSelectionMerge %285 None + OpBranchConditional %282 %286 %287 + %286 = OpLabel + %288 = OpLoad %int %284 + OpBranch %285 + %287 = OpLabel + %289 = OpCopyObject %int %int_0_0 + OpBranch %285 + %285 = OpLabel + %290 = OpPhi %int %288 %286 %289 %287 + %291 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpSelectionMerge %292 None + OpBranchConditional %282 %293 %294 + %293 = OpLabel + %295 = OpLoad %int %291 + OpBranch %292 + %294 = OpLabel + %296 = OpCopyObject %int %int_0_0 + OpBranch %292 + %292 = OpLabel + %297 = OpPhi %int %295 %293 %296 %294 + %298 = OpISub %int %297 %int_2 + %299 = OpIMul %int %298 %int_16 + OpSelectionMerge %300 None + OpBranchConditional %282 %301 %302 + %301 = OpLabel + %303 = OpLoad %_arr_int_uint_256 %map + OpBranch %300 + %302 = OpLabel + %304 = OpCopyObject %_arr_int_uint_256 %57 + OpBranch %300 + %300 = OpLabel + %305 = OpPhi %_arr_int_uint_256 %303 %301 %304 %302 + OpSelectionMerge %306 None + OpBranchConditional %282 %307 %306 + %307 = OpLabel + OpStore %map %57 + OpBranch %306 + %306 = OpLabel + OpSelectionMerge %308 None + OpBranchConditional %282 %309 %308 + %309 = OpLabel + OpStore %map %305 + OpBranch %308 + %308 = OpLabel + %310 = OpIAdd %int %290 %299 + %311 = OpAccessChain %_ptr_Private_int %map %310 + OpSelectionMerge %312 None + OpBranchConditional %282 %313 %314 + %313 = OpLabel + %315 = OpLoad %int %311 + OpBranch %312 + %314 = OpLabel + %316 = OpCopyObject %int %int_0_0 + OpBranch %312 + %312 = OpLabel + %317 = OpPhi %int %315 %313 %316 %314 + %318 = OpIEqual %bool %317 %int_0 + OpBranch %319 + %319 = OpLabel + %320 = OpSelect %bool %282 %318 %282 + OpSelectionMerge %321 None + OpBranchConditional %320 %322 %321 + %322 = OpLabel + %323 = OpLoad %int %d + %324 = OpISub %int %323 %int_1 + OpStore %d %324 + %325 = OpAccessChain %_ptr_Function_int %p %uint_0 + %326 = OpLoad %int %325 + %327 = OpAccessChain %_ptr_Function_int %p %uint_1 + %328 = OpLoad %int %327 + %329 = OpIMul %int %328 %int_16 + %330 = OpIAdd %int %326 %329 + %331 = OpAccessChain %_ptr_Private_int %map %330 + OpStore %331 %int_1 + %332 = OpAccessChain %_ptr_Function_int %p %uint_0 + %333 = OpLoad %int %332 + %334 = OpAccessChain %_ptr_Function_int %p %uint_1 + %335 = OpLoad %int %334 + %336 = OpISub %int %335 %int_1 + %337 = OpIMul %int %336 %int_16 + %338 = OpIAdd %int %333 %337 + %339 = OpAccessChain %_ptr_Private_int %map %338 + OpStore %339 %int_1 + %340 = OpAccessChain %_ptr_Function_int %p %uint_0 + %341 = OpLoad %int %340 + %342 = OpAccessChain %_ptr_Function_int %p %uint_1 + %343 = OpLoad %int %342 + %344 = OpISub %int %343 %int_2 + %345 = OpLoad %_arr_int_uint_256 %map + OpStore %map %57 + OpStore %map %345 + %346 = OpIMul %int %344 %int_16 + %347 = OpIAdd %int %341 %346 + %348 = OpAccessChain %_ptr_Private_int %map %347 + OpStore %348 %int_1 + %349 = OpAccessChain %_ptr_Function_int %p %uint_1 + %350 = OpLoad %int %349 + %351 = OpISub %int %350 %int_2 + %352 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %352 %351 + OpBranch %321 + %321 = OpLabel + %353 = OpLoad %int %d + %354 = OpSGreaterThanEqual %bool %353 %int_0 + OpSelectionMerge %355 None + OpBranchConditional %354 %356 %355 + %356 = OpLabel + %357 = OpAccessChain %_ptr_Function_int %p %uint_0 + %358 = OpLoad %int %357 + %359 = OpSLessThan %bool %358 %int_14 + OpBranch %355 + %355 = OpLabel + %360 = OpPhi %bool %354 %321 %359 %356 + OpSelectionMerge %361 None + OpBranchConditional %360 %362 %361 + %362 = OpLabel + %363 = OpAccessChain %_ptr_Function_int %p %uint_0 + %364 = OpLoad %int %363 + %365 = OpIAdd %int %364 %int_2 + %366 = OpAccessChain %_ptr_Function_int %p %uint_1 + %367 = OpLoad %int %366 + %368 = OpIMul %int %367 %int_16 + %369 = OpIAdd %int %365 %368 + %370 = OpAccessChain %_ptr_Private_int %map %369 + %371 = OpLoad %int %370 + %372 = OpIEqual %bool %371 %int_0 + OpBranch %361 + %361 = OpLabel + %373 = OpPhi %bool %360 %355 %372 %362 + OpSelectionMerge %374 None + OpBranchConditional %373 %375 %374 + %375 = OpLabel + %376 = OpLoad %int %d + %377 = OpISub %int %376 %int_1 + OpStore %d %377 + %378 = OpAccessChain %_ptr_Function_int %p %uint_0 + %379 = OpLoad %int %378 + %380 = OpAccessChain %_ptr_Function_int %p %uint_1 + %381 = OpLoad %int %380 + %382 = OpIMul %int %381 %int_16 + %383 = OpIAdd %int %379 %382 + %384 = OpAccessChain %_ptr_Private_int %map %383 + OpStore %384 %int_1 + %385 = OpAccessChain %_ptr_Function_int %p %uint_0 + %386 = OpLoad %int %385 + %387 = OpIAdd %int %386 %int_1 + %388 = OpAccessChain %_ptr_Function_int %p %uint_1 + %389 = OpLoad %int %388 + %390 = OpIMul %int %389 %int_16 + %391 = OpIAdd %int %387 %390 + %392 = OpAccessChain %_ptr_Private_int %map %391 + OpStore %392 %int_1 + %393 = OpAccessChain %_ptr_Function_int %p %uint_0 + %394 = OpLoad %int %393 + %395 = OpIAdd %int %394 %int_2 + %396 = OpAccessChain %_ptr_Function_int %p %uint_1 + %397 = OpLoad %int %396 + %398 = OpIMul %int %397 %int_16 + %399 = OpIAdd %int %395 %398 + %400 = OpAccessChain %_ptr_Private_int %map %399 + OpStore %400 %int_1 + %401 = OpAccessChain %_ptr_Function_int %p %uint_0 + %402 = OpLoad %int %401 + %403 = OpIAdd %int %402 %int_2 + %404 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %404 %403 + OpBranch %374 + %374 = OpLabel + %405 = OpLoad %int %d + %406 = OpSGreaterThanEqual %bool %405 %int_0 + OpSelectionMerge %407 None + OpBranchConditional %406 %408 %407 + %408 = OpLabel + %409 = OpAccessChain %_ptr_Function_int %p %uint_1 + %410 = OpLoad %int %409 + %411 = OpSLessThan %bool %410 %int_14 + OpBranch %407 + %407 = OpLabel + %412 = OpPhi %bool %406 %374 %411 %408 + OpSelectionMerge %413 None + OpBranchConditional %412 %414 %413 + %414 = OpLabel + %415 = OpAccessChain %_ptr_Function_int %p %uint_0 + %416 = OpLoad %int %415 + %417 = OpAccessChain %_ptr_Function_int %p %uint_1 + %418 = OpLoad %int %417 + %419 = OpIAdd %int %418 %int_2 + %420 = OpIMul %int %419 %int_16 + %421 = OpIAdd %int %416 %420 + %422 = OpAccessChain %_ptr_Private_int %map %421 + %423 = OpLoad %int %422 + %424 = OpIEqual %bool %423 %int_0 + OpBranch %413 + %413 = OpLabel + %425 = OpPhi %bool %412 %407 %424 %414 + OpSelectionMerge %426 None + OpBranchConditional %425 %427 %426 + %427 = OpLabel + %428 = OpLoad %int %d + %429 = OpISub %int %428 %int_1 + OpStore %d %429 + %430 = OpAccessChain %_ptr_Function_int %p %uint_0 + %431 = OpLoad %int %430 + %432 = OpAccessChain %_ptr_Function_int %p %uint_1 + %433 = OpLoad %int %432 + %434 = OpIMul %int %433 %int_16 + %435 = OpIAdd %int %431 %434 + %436 = OpAccessChain %_ptr_Private_int %map %435 + OpStore %436 %int_1 + %437 = OpAccessChain %_ptr_Function_int %p %uint_0 + %438 = OpLoad %int %437 + %439 = OpAccessChain %_ptr_Function_int %p %uint_1 + %440 = OpLoad %int %439 + %441 = OpIAdd %int %440 %int_1 + %442 = OpIMul %int %441 %int_16 + %443 = OpIAdd %int %438 %442 + %444 = OpAccessChain %_ptr_Private_int %map %443 + OpStore %444 %int_1 + %445 = OpAccessChain %_ptr_Function_int %p %uint_0 + %446 = OpLoad %int %445 + %447 = OpAccessChain %_ptr_Function_int %p %uint_1 + %448 = OpLoad %int %447 + %449 = OpIAdd %int %448 %int_2 + %450 = OpIMul %int %449 %int_16 + %451 = OpIAdd %int %446 %450 + %452 = OpAccessChain %_ptr_Private_int %map %451 + OpStore %452 %int_1 + %453 = OpAccessChain %_ptr_Function_int %p %uint_1 + %454 = OpLoad %int %453 + %455 = OpIAdd %int %454 %int_2 + %456 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %456 %455 + OpBranch %426 + %426 = OpLabel + OpBranch %172 + %172 = OpLabel + %457 = OpAccessChain %_ptr_Function_int %ipos %uint_1 + %458 = OpLoad %int %457 + %459 = OpIMul %int %458 %int_16 + %460 = OpAccessChain %_ptr_Function_int %ipos %uint_0 + %461 = OpLoad %int %460 + %462 = OpIAdd %int %459 %461 + %463 = OpAccessChain %_ptr_Private_int %map %462 + %464 = OpLoad %int %463 + %465 = OpIEqual %bool %464 %int_1 + OpSelectionMerge %466 None + OpBranchConditional %465 %467 %466 + %467 = OpLabel + OpStore %_GLF_color %53 + OpReturn + %466 = OpLabel + OpBranch %86 + %86 = OpLabel + %468 = OpLoad %bool %canwalk + OpBranchConditional %468 %84 %85 + %85 = OpLabel + OpStore %_GLF_color %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..0505c28fae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.hlsl @@ -0,0 +1,338 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static int map[256] = (int[256])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int i = 0; + int2 p = int2(0, 0); + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + const float4 x_59 = gl_FragCoord; + const float2 x_62 = asfloat(x_7[0].xy); + pos = (float2(x_59.x, x_59.y) / x_62); + const float x_65 = pos.x; + const float x_69 = pos.y; + ipos = int2(int((x_65 * 16.0f)), int((x_69 * 16.0f))); + i = 0; + { + for(; (i < 256); i = (i + 1)) { + map[i] = 0; + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_104 = false; + bool x_124 = false; + bool x_144 = false; + bool x_164 = false; + bool x_105_phi = false; + bool x_125_phi = false; + bool x_145_phi = false; + bool x_165_phi = false; + v = (v + 1); + directions = 0; + const int x_91 = p.x; + const bool x_92 = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + const int x_96 = p.x; + const int x_99 = p.y; + const int x_103 = map[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + if (x_105_phi) { + directions = (directions + 1); + } + const int x_111 = p.y; + const bool x_112 = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + const int x_116 = p.x; + const int x_118 = p.y; + const int x_123 = map[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + if (x_125_phi) { + directions = (directions + 1); + } + const int x_131 = p.x; + const bool x_132 = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + const int x_136 = p.x; + const int x_139 = p.y; + const int x_143 = map[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + if (x_145_phi) { + directions = (directions + 1); + } + const int x_151 = p.y; + const bool x_152 = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + const int x_156 = p.x; + const int x_158 = p.y; + const int x_163 = map[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + if (x_165_phi) { + directions = (directions + 1); + } + bool x_229 = false; + bool x_242 = false; + bool x_281 = false; + int x_288 = 0; + int x_289 = 0; + int x_295 = 0; + int x_296 = 0; + int x_303[256] = (int[256])0; + int x_304[256] = (int[256])0; + int x_315 = 0; + int x_316 = 0; + bool x_359 = false; + bool x_372 = false; + bool x_411 = false; + bool x_424 = false; + bool x_230_phi = false; + bool x_243_phi = false; + bool x_282_phi = false; + int x_290_phi = 0; + int x_297_phi = 0; + int x_305_phi[256] = (int[256])0; + int x_317_phi = 0; + bool x_360_phi = false; + bool x_373_phi = false; + bool x_412_phi = false; + bool x_425_phi = false; + if ((directions == 0)) { + canwalk = false; + i = 0; + { + for(; (i < 8); i = (i + 1)) { + j = 0; + { + for(; (j < 8); j = (j + 1)) { + const int x_196 = map[((j * 2) + ((i * 2) * 16))]; + if ((x_196 == 0)) { + p.x = (j * 2); + p.y = (i * 2); + canwalk = true; + } + } + } + } + } + const int x_211 = p.x; + const int x_213 = p.y; + map[(x_211 + (x_213 * 16))] = 1; + } else { + d = (v % directions); + v = (v + directions); + const bool x_224 = (d >= 0); + x_230_phi = x_224; + if (x_224) { + const int x_228 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + const bool x_230 = x_230_phi; + x_243_phi = x_230; + if (x_230) { + const int x_234 = p.x; + const int x_237 = p.y; + const int x_241 = map[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + if (x_243_phi) { + d = (d - 1); + const int x_249 = p.x; + const int x_251 = p.y; + map[(x_249 + (x_251 * 16))] = 1; + const int x_256 = p.x; + const int x_259 = p.y; + map[((x_256 - 1) + (x_259 * 16))] = 1; + const int x_264 = p.x; + const int x_267 = p.y; + map[((x_264 - 2) + (x_267 * 16))] = 1; + const int x_272 = p.x; + p.x = (x_272 - 2); + } + const bool x_276 = (d >= 0); + x_282_phi = x_276; + if (x_276) { + const int x_280 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + const bool x_282 = x_282_phi; + if (x_282) { + x_288 = p.x; + x_290_phi = x_288; + } else { + x_289 = 0; + x_290_phi = x_289; + } + const int x_290 = x_290_phi; + if (x_282) { + x_295 = p.y; + x_297_phi = x_295; + } else { + x_296 = 0; + x_297_phi = x_296; + } + const int x_299 = ((x_297_phi - 2) * 16); + if (x_282) { + x_303 = map; + x_305_phi = x_303; + } else { + const int tint_symbol_5[256] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + x_304 = tint_symbol_5; + x_305_phi = x_304; + } + const int x_305[256] = x_305_phi; + if (x_282) { + const int tint_symbol_6[256] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + map = tint_symbol_6; + } + if (x_282) { + map = x_305; + } + if (x_282) { + x_315 = map[(x_290 + x_299)]; + x_317_phi = x_315; + } else { + x_316 = 0; + x_317_phi = x_316; + } + const bool x_318 = (x_317_phi == 0); + if ((x_282 ? x_318 : x_282)) { + d = (d - 1); + const int x_326 = p.x; + const int x_328 = p.y; + map[(x_326 + (x_328 * 16))] = 1; + const int x_333 = p.x; + const int x_335 = p.y; + map[(x_333 + ((x_335 - 1) * 16))] = 1; + const int x_341 = p.x; + const int x_343 = p.y; + const int x_345[256] = map; + const int tint_symbol_7[256] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + map = tint_symbol_7; + map = x_345; + map[(x_341 + ((x_343 - 2) * 16))] = 1; + const int x_350 = p.y; + p.y = (x_350 - 2); + } + const bool x_354 = (d >= 0); + x_360_phi = x_354; + if (x_354) { + const int x_358 = p.x; + x_359 = (x_358 < 14); + x_360_phi = x_359; + } + const bool x_360 = x_360_phi; + x_373_phi = x_360; + if (x_360) { + const int x_364 = p.x; + const int x_367 = p.y; + const int x_371 = map[((x_364 + 2) + (x_367 * 16))]; + x_372 = (x_371 == 0); + x_373_phi = x_372; + } + if (x_373_phi) { + d = (d - 1); + const int x_379 = p.x; + const int x_381 = p.y; + map[(x_379 + (x_381 * 16))] = 1; + const int x_386 = p.x; + const int x_389 = p.y; + map[((x_386 + 1) + (x_389 * 16))] = 1; + const int x_394 = p.x; + const int x_397 = p.y; + map[((x_394 + 2) + (x_397 * 16))] = 1; + const int x_402 = p.x; + p.x = (x_402 + 2); + } + const bool x_406 = (d >= 0); + x_412_phi = x_406; + if (x_406) { + const int x_410 = p.y; + x_411 = (x_410 < 14); + x_412_phi = x_411; + } + const bool x_412 = x_412_phi; + x_425_phi = x_412; + if (x_412) { + const int x_416 = p.x; + const int x_418 = p.y; + const int x_423 = map[(x_416 + ((x_418 + 2) * 16))]; + x_424 = (x_423 == 0); + x_425_phi = x_424; + } + if (x_425_phi) { + d = (d - 1); + const int x_431 = p.x; + const int x_433 = p.y; + map[(x_431 + (x_433 * 16))] = 1; + const int x_438 = p.x; + const int x_440 = p.y; + map[(x_438 + ((x_440 + 1) * 16))] = 1; + const int x_446 = p.x; + const int x_448 = p.y; + map[(x_446 + ((x_448 + 2) * 16))] = 1; + const int x_454 = p.y; + p.y = (x_454 + 2); + } + } + const int x_458 = ipos.y; + const int x_461 = ipos.x; + const int x_464 = map[((x_458 * 16) + x_461)]; + if ((x_464 == 1)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + if (canwalk) { + } else { + break; + } + } + } + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.msl new file mode 100644 index 0000000000..794863afd0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.msl @@ -0,0 +1,394 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_8, thread tint_array_wrapper* const tint_symbol_9, thread float4* const tint_symbol_10) { + float2 pos = 0.0f; + int2 ipos = 0; + int i = 0; + int2 p = 0; + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + float4 const x_59 = *(tint_symbol_8); + float2 const x_62 = x_7.resolution; + pos = (float2(x_59.x, x_59.y) / x_62); + float const x_65 = pos.x; + float const x_69 = pos.y; + ipos = int2(int((x_65 * 16.0f)), int((x_69 * 16.0f))); + i = 0; + while (true) { + int const x_77 = i; + if ((x_77 < 256)) { + } else { + break; + } + int const x_80 = i; + (*(tint_symbol_9)).arr[x_80] = 0; + { + int const x_82 = i; + i = (x_82 + 1); + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_104 = false; + bool x_124 = false; + bool x_144 = false; + bool x_164 = false; + bool x_105_phi = false; + bool x_125_phi = false; + bool x_145_phi = false; + bool x_165_phi = false; + int const x_88 = v; + v = (x_88 + 1); + directions = 0; + int const x_91 = p.x; + bool const x_92 = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + int const x_96 = p.x; + int const x_99 = p.y; + int const x_103 = (*(tint_symbol_9)).arr[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + bool const x_105 = x_105_phi; + if (x_105) { + int const x_108 = directions; + directions = (x_108 + 1); + } + int const x_111 = p.y; + bool const x_112 = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + int const x_116 = p.x; + int const x_118 = p.y; + int const x_123 = (*(tint_symbol_9)).arr[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + bool const x_125 = x_125_phi; + if (x_125) { + int const x_128 = directions; + directions = (x_128 + 1); + } + int const x_131 = p.x; + bool const x_132 = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + int const x_136 = p.x; + int const x_139 = p.y; + int const x_143 = (*(tint_symbol_9)).arr[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + bool const x_145 = x_145_phi; + if (x_145) { + int const x_148 = directions; + directions = (x_148 + 1); + } + int const x_151 = p.y; + bool const x_152 = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + int const x_156 = p.x; + int const x_158 = p.y; + int const x_163 = (*(tint_symbol_9)).arr[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + bool const x_165 = x_165_phi; + if (x_165) { + int const x_168 = directions; + directions = (x_168 + 1); + } + bool x_229 = false; + bool x_242 = false; + bool x_281 = false; + int x_288 = 0; + int x_289 = 0; + int x_295 = 0; + int x_296 = 0; + tint_array_wrapper x_303 = {}; + tint_array_wrapper x_304 = {}; + int x_315 = 0; + int x_316 = 0; + bool x_359 = false; + bool x_372 = false; + bool x_411 = false; + bool x_424 = false; + bool x_230_phi = false; + bool x_243_phi = false; + bool x_282_phi = false; + int x_290_phi = 0; + int x_297_phi = 0; + tint_array_wrapper x_305_phi = {}; + int x_317_phi = 0; + bool x_360_phi = false; + bool x_373_phi = false; + bool x_412_phi = false; + bool x_425_phi = false; + int const x_170 = directions; + if ((x_170 == 0)) { + canwalk = false; + i = 0; + while (true) { + int const x_179 = i; + if ((x_179 < 8)) { + } else { + break; + } + j = 0; + while (true) { + int const x_186 = j; + if ((x_186 < 8)) { + } else { + break; + } + int const x_189 = j; + int const x_191 = i; + int const x_196 = (*(tint_symbol_9)).arr[((x_189 * 2) + ((x_191 * 2) * 16))]; + if ((x_196 == 0)) { + int const x_200 = j; + p.x = (x_200 * 2); + int const x_203 = i; + p.y = (x_203 * 2); + canwalk = true; + } + { + int const x_206 = j; + j = (x_206 + 1); + } + } + { + int const x_208 = i; + i = (x_208 + 1); + } + } + int const x_211 = p.x; + int const x_213 = p.y; + (*(tint_symbol_9)).arr[(x_211 + (x_213 * 16))] = 1; + } else { + int const x_217 = v; + int const x_218 = directions; + d = (x_217 % x_218); + int const x_220 = directions; + int const x_221 = v; + v = (x_221 + x_220); + int const x_223 = d; + bool const x_224 = (x_223 >= 0); + x_230_phi = x_224; + if (x_224) { + int const x_228 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + bool const x_230 = x_230_phi; + x_243_phi = x_230; + if (x_230) { + int const x_234 = p.x; + int const x_237 = p.y; + int const x_241 = (*(tint_symbol_9)).arr[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + bool const x_243 = x_243_phi; + if (x_243) { + int const x_246 = d; + d = (x_246 - 1); + int const x_249 = p.x; + int const x_251 = p.y; + (*(tint_symbol_9)).arr[(x_249 + (x_251 * 16))] = 1; + int const x_256 = p.x; + int const x_259 = p.y; + (*(tint_symbol_9)).arr[((x_256 - 1) + (x_259 * 16))] = 1; + int const x_264 = p.x; + int const x_267 = p.y; + (*(tint_symbol_9)).arr[((x_264 - 2) + (x_267 * 16))] = 1; + int const x_272 = p.x; + p.x = (x_272 - 2); + } + int const x_275 = d; + bool const x_276 = (x_275 >= 0); + x_282_phi = x_276; + if (x_276) { + int const x_280 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + bool const x_282 = x_282_phi; + if (x_282) { + x_288 = p.x; + x_290_phi = x_288; + } else { + x_289 = 0; + x_290_phi = x_289; + } + int const x_290 = x_290_phi; + if (x_282) { + x_295 = p.y; + x_297_phi = x_295; + } else { + x_296 = 0; + x_297_phi = x_296; + } + int const x_297 = x_297_phi; + int const x_299 = ((x_297 - 2) * 16); + if (x_282) { + x_303 = *(tint_symbol_9); + x_305_phi = x_303; + } else { + tint_array_wrapper const tint_symbol_4 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + x_304 = tint_symbol_4; + x_305_phi = x_304; + } + tint_array_wrapper const x_305 = x_305_phi; + if (x_282) { + tint_array_wrapper const tint_symbol_5 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + *(tint_symbol_9) = tint_symbol_5; + } + if (x_282) { + *(tint_symbol_9) = x_305; + } + if (x_282) { + x_315 = (*(tint_symbol_9)).arr[(x_290 + x_299)]; + x_317_phi = x_315; + } else { + x_316 = 0; + x_317_phi = x_316; + } + int const x_317 = x_317_phi; + bool const x_318 = (x_317 == 0); + if (select(x_282, x_318, x_282)) { + int const x_323 = d; + d = (x_323 - 1); + int const x_326 = p.x; + int const x_328 = p.y; + (*(tint_symbol_9)).arr[(x_326 + (x_328 * 16))] = 1; + int const x_333 = p.x; + int const x_335 = p.y; + (*(tint_symbol_9)).arr[(x_333 + ((x_335 - 1) * 16))] = 1; + int const x_341 = p.x; + int const x_343 = p.y; + tint_array_wrapper const x_345 = *(tint_symbol_9); + tint_array_wrapper const tint_symbol_6 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + *(tint_symbol_9) = tint_symbol_6; + *(tint_symbol_9) = x_345; + (*(tint_symbol_9)).arr[(x_341 + ((x_343 - 2) * 16))] = 1; + int const x_350 = p.y; + p.y = (x_350 - 2); + } + int const x_353 = d; + bool const x_354 = (x_353 >= 0); + x_360_phi = x_354; + if (x_354) { + int const x_358 = p.x; + x_359 = (x_358 < 14); + x_360_phi = x_359; + } + bool const x_360 = x_360_phi; + x_373_phi = x_360; + if (x_360) { + int const x_364 = p.x; + int const x_367 = p.y; + int const x_371 = (*(tint_symbol_9)).arr[((x_364 + 2) + (x_367 * 16))]; + x_372 = (x_371 == 0); + x_373_phi = x_372; + } + bool const x_373 = x_373_phi; + if (x_373) { + int const x_376 = d; + d = (x_376 - 1); + int const x_379 = p.x; + int const x_381 = p.y; + (*(tint_symbol_9)).arr[(x_379 + (x_381 * 16))] = 1; + int const x_386 = p.x; + int const x_389 = p.y; + (*(tint_symbol_9)).arr[((x_386 + 1) + (x_389 * 16))] = 1; + int const x_394 = p.x; + int const x_397 = p.y; + (*(tint_symbol_9)).arr[((x_394 + 2) + (x_397 * 16))] = 1; + int const x_402 = p.x; + p.x = (x_402 + 2); + } + int const x_405 = d; + bool const x_406 = (x_405 >= 0); + x_412_phi = x_406; + if (x_406) { + int const x_410 = p.y; + x_411 = (x_410 < 14); + x_412_phi = x_411; + } + bool const x_412 = x_412_phi; + x_425_phi = x_412; + if (x_412) { + int const x_416 = p.x; + int const x_418 = p.y; + int const x_423 = (*(tint_symbol_9)).arr[(x_416 + ((x_418 + 2) * 16))]; + x_424 = (x_423 == 0); + x_425_phi = x_424; + } + bool const x_425 = x_425_phi; + if (x_425) { + int const x_428 = d; + d = (x_428 - 1); + int const x_431 = p.x; + int const x_433 = p.y; + (*(tint_symbol_9)).arr[(x_431 + (x_433 * 16))] = 1; + int const x_438 = p.x; + int const x_440 = p.y; + (*(tint_symbol_9)).arr[(x_438 + ((x_440 + 1) * 16))] = 1; + int const x_446 = p.x; + int const x_448 = p.y; + (*(tint_symbol_9)).arr[(x_446 + ((x_448 + 2) * 16))] = 1; + int const x_454 = p.y; + p.y = (x_454 + 2); + } + } + int const x_458 = ipos.y; + int const x_461 = ipos.x; + int const x_464 = (*(tint_symbol_9)).arr[((x_458 * 16) + x_461)]; + if ((x_464 == 1)) { + *(tint_symbol_10) = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + bool const x_468 = canwalk; + if (x_468) { + } else { + break; + } + } + } + *(tint_symbol_10) = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread tint_array_wrapper tint_symbol_12 = {}; + thread float4 tint_symbol_13 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_11), &(tint_symbol_12), &(tint_symbol_13)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13}; + tint_symbol_2 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..bde11c85cf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.spvasm @@ -0,0 +1,860 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 548 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %map "map" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %ipos "ipos" + OpName %i "i" + OpName %p "p" + OpName %canwalk "canwalk" + OpName %v "v" + OpName %directions "directions" + OpName %j "j" + OpName %d "d" + OpName %x_104 "x_104" + OpName %x_124 "x_124" + OpName %x_144 "x_144" + OpName %x_164 "x_164" + OpName %x_105_phi "x_105_phi" + OpName %x_125_phi "x_125_phi" + OpName %x_145_phi "x_145_phi" + OpName %x_165_phi "x_165_phi" + OpName %x_229 "x_229" + OpName %x_242 "x_242" + OpName %x_281 "x_281" + OpName %x_288 "x_288" + OpName %x_289 "x_289" + OpName %x_295 "x_295" + OpName %x_296 "x_296" + OpName %x_303 "x_303" + OpName %x_304 "x_304" + OpName %x_315 "x_315" + OpName %x_316 "x_316" + OpName %x_359 "x_359" + OpName %x_372 "x_372" + OpName %x_411 "x_411" + OpName %x_424 "x_424" + OpName %x_230_phi "x_230_phi" + OpName %x_243_phi "x_243_phi" + OpName %x_282_phi "x_282_phi" + OpName %x_290_phi "x_290_phi" + OpName %x_297_phi "x_297_phi" + OpName %x_305_phi "x_305_phi" + OpName %x_317_phi "x_317_phi" + OpName %x_360_phi "x_360_phi" + OpName %x_373_phi "x_373_phi" + OpName %x_412_phi "x_412_phi" + OpName %x_425_phi "x_425_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Private__arr_int_uint_256 = OpTypePointer Private %_arr_int_uint_256 + %16 = OpConstantNull %_arr_int_uint_256 + %map = OpVariable %_ptr_Private__arr_int_uint_256 Private %16 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %28 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %32 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_16 = OpConstant %float 16 + %int_0 = OpConstant %int 0 + %int_256 = OpConstant %int 256 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %83 = OpConstantComposite %v2int %int_0 %int_0 + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %int_16 = OpConstant %int 16 + %int_14 = OpConstant %int 14 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %false = OpConstantFalse %bool + %int_8 = OpConstant %int 8 + %358 = OpConstantComposite %_arr_int_uint_256 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 + %float_1 = OpConstant %float 1 + %528 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %534 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %535 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %28 + %ipos = OpVariable %_ptr_Function_v2int Function %32 + %i = OpVariable %_ptr_Function_int Function %35 + %p = OpVariable %_ptr_Function_v2int Function %32 + %canwalk = OpVariable %_ptr_Function_bool Function %40 + %v = OpVariable %_ptr_Function_int Function %35 + %directions = OpVariable %_ptr_Function_int Function %35 + %j = OpVariable %_ptr_Function_int Function %35 + %d = OpVariable %_ptr_Function_int Function %35 + %x_104 = OpVariable %_ptr_Function_bool Function %40 + %x_124 = OpVariable %_ptr_Function_bool Function %40 + %x_144 = OpVariable %_ptr_Function_bool Function %40 + %x_164 = OpVariable %_ptr_Function_bool Function %40 + %x_105_phi = OpVariable %_ptr_Function_bool Function %40 + %x_125_phi = OpVariable %_ptr_Function_bool Function %40 + %x_145_phi = OpVariable %_ptr_Function_bool Function %40 + %x_165_phi = OpVariable %_ptr_Function_bool Function %40 + %x_229 = OpVariable %_ptr_Function_bool Function %40 + %x_242 = OpVariable %_ptr_Function_bool Function %40 + %x_281 = OpVariable %_ptr_Function_bool Function %40 + %x_288 = OpVariable %_ptr_Function_int Function %35 + %x_289 = OpVariable %_ptr_Function_int Function %35 + %x_295 = OpVariable %_ptr_Function_int Function %35 + %x_296 = OpVariable %_ptr_Function_int Function %35 + %x_303 = OpVariable %_ptr_Function__arr_int_uint_256 Function %16 + %x_304 = OpVariable %_ptr_Function__arr_int_uint_256 Function %16 + %x_315 = OpVariable %_ptr_Function_int Function %35 + %x_316 = OpVariable %_ptr_Function_int Function %35 + %x_359 = OpVariable %_ptr_Function_bool Function %40 + %x_372 = OpVariable %_ptr_Function_bool Function %40 + %x_411 = OpVariable %_ptr_Function_bool Function %40 + %x_424 = OpVariable %_ptr_Function_bool Function %40 + %x_230_phi = OpVariable %_ptr_Function_bool Function %40 + %x_243_phi = OpVariable %_ptr_Function_bool Function %40 + %x_282_phi = OpVariable %_ptr_Function_bool Function %40 + %x_290_phi = OpVariable %_ptr_Function_int Function %35 + %x_297_phi = OpVariable %_ptr_Function_int Function %35 + %x_305_phi = OpVariable %_ptr_Function__arr_int_uint_256 Function %16 + %x_317_phi = OpVariable %_ptr_Function_int Function %35 + %x_360_phi = OpVariable %_ptr_Function_bool Function %40 + %x_373_phi = OpVariable %_ptr_Function_bool Function %40 + %x_412_phi = OpVariable %_ptr_Function_bool Function %40 + %x_425_phi = OpVariable %_ptr_Function_bool Function %40 + %45 = OpLoad %v4float %gl_FragCoord + %48 = OpAccessChain %_ptr_Uniform_v2float %x_7 %uint_0 + %49 = OpLoad %v2float %48 + %50 = OpCompositeExtract %float %45 0 + %51 = OpCompositeExtract %float %45 1 + %52 = OpCompositeConstruct %v2float %50 %51 + %53 = OpFDiv %v2float %52 %49 + OpStore %pos %53 + %55 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %59 = OpLoad %float %58 + %62 = OpFMul %float %56 %float_16 + %60 = OpConvertFToS %int %62 + %64 = OpFMul %float %59 %float_16 + %63 = OpConvertFToS %int %64 + %65 = OpCompositeConstruct %v2int %60 %63 + OpStore %ipos %65 + OpStore %i %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %i + %73 = OpSLessThan %bool %71 %int_256 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %74 + %76 = OpLabel + OpBranch %68 + %74 = OpLabel + %77 = OpLoad %int %i + %79 = OpAccessChain %_ptr_Private_int %map %77 + OpStore %79 %int_0 + OpBranch %69 + %69 = OpLabel + %80 = OpLoad %int %i + %82 = OpIAdd %int %80 %int_1 + OpStore %i %82 + OpBranch %67 + %68 = OpLabel + OpStore %p %83 + OpStore %canwalk %true + OpStore %v %int_0 + OpBranch %85 + %85 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %97 = OpLoad %int %v + %98 = OpIAdd %int %97 %int_1 + OpStore %v %98 + OpStore %directions %int_0 + %99 = OpAccessChain %_ptr_Function_int %p %uint_0 + %100 = OpLoad %int %99 + %101 = OpSGreaterThan %bool %100 %int_0 + OpStore %x_105_phi %101 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + %104 = OpAccessChain %_ptr_Function_int %p %uint_0 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Function_int %p %uint_1 + %107 = OpLoad %int %106 + %109 = OpISub %int %105 %int_2 + %111 = OpIMul %int %107 %int_16 + %112 = OpIAdd %int %109 %111 + %113 = OpAccessChain %_ptr_Private_int %map %112 + %114 = OpLoad %int %113 + %115 = OpIEqual %bool %114 %int_0 + OpStore %x_104 %115 + %116 = OpLoad %bool %x_104 + OpStore %x_105_phi %116 + OpBranch %102 + %102 = OpLabel + %117 = OpLoad %bool %x_105_phi + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %120 = OpLoad %int %directions + %121 = OpIAdd %int %120 %int_1 + OpStore %directions %121 + OpBranch %118 + %118 = OpLabel + %122 = OpAccessChain %_ptr_Function_int %p %uint_1 + %123 = OpLoad %int %122 + %124 = OpSGreaterThan %bool %123 %int_0 + OpStore %x_125_phi %124 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %125 + %126 = OpLabel + %127 = OpAccessChain %_ptr_Function_int %p %uint_0 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Function_int %p %uint_1 + %130 = OpLoad %int %129 + %131 = OpISub %int %130 %int_2 + %132 = OpIMul %int %131 %int_16 + %133 = OpIAdd %int %128 %132 + %134 = OpAccessChain %_ptr_Private_int %map %133 + %135 = OpLoad %int %134 + %136 = OpIEqual %bool %135 %int_0 + OpStore %x_124 %136 + %137 = OpLoad %bool %x_124 + OpStore %x_125_phi %137 + OpBranch %125 + %125 = OpLabel + %138 = OpLoad %bool %x_125_phi + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpLoad %int %directions + %142 = OpIAdd %int %141 %int_1 + OpStore %directions %142 + OpBranch %139 + %139 = OpLabel + %143 = OpAccessChain %_ptr_Function_int %p %uint_0 + %144 = OpLoad %int %143 + %146 = OpSLessThan %bool %144 %int_14 + OpStore %x_145_phi %146 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %147 + %148 = OpLabel + %149 = OpAccessChain %_ptr_Function_int %p %uint_0 + %150 = OpLoad %int %149 + %151 = OpAccessChain %_ptr_Function_int %p %uint_1 + %152 = OpLoad %int %151 + %153 = OpIAdd %int %150 %int_2 + %154 = OpIMul %int %152 %int_16 + %155 = OpIAdd %int %153 %154 + %156 = OpAccessChain %_ptr_Private_int %map %155 + %157 = OpLoad %int %156 + %158 = OpIEqual %bool %157 %int_0 + OpStore %x_144 %158 + %159 = OpLoad %bool %x_144 + OpStore %x_145_phi %159 + OpBranch %147 + %147 = OpLabel + %160 = OpLoad %bool %x_145_phi + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %161 + %162 = OpLabel + %163 = OpLoad %int %directions + %164 = OpIAdd %int %163 %int_1 + OpStore %directions %164 + OpBranch %161 + %161 = OpLabel + %165 = OpAccessChain %_ptr_Function_int %p %uint_1 + %166 = OpLoad %int %165 + %167 = OpSLessThan %bool %166 %int_14 + OpStore %x_165_phi %167 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %168 + %169 = OpLabel + %170 = OpAccessChain %_ptr_Function_int %p %uint_0 + %171 = OpLoad %int %170 + %172 = OpAccessChain %_ptr_Function_int %p %uint_1 + %173 = OpLoad %int %172 + %174 = OpIAdd %int %173 %int_2 + %175 = OpIMul %int %174 %int_16 + %176 = OpIAdd %int %171 %175 + %177 = OpAccessChain %_ptr_Private_int %map %176 + %178 = OpLoad %int %177 + %179 = OpIEqual %bool %178 %int_0 + OpStore %x_164 %179 + %180 = OpLoad %bool %x_164 + OpStore %x_165_phi %180 + OpBranch %168 + %168 = OpLabel + %181 = OpLoad %bool %x_165_phi + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %184 = OpLoad %int %directions + %185 = OpIAdd %int %184 %int_1 + OpStore %directions %185 + OpBranch %182 + %182 = OpLabel + %213 = OpLoad %int %directions + %214 = OpIEqual %bool %213 %int_0 + OpSelectionMerge %215 None + OpBranchConditional %214 %216 %217 + %216 = OpLabel + OpStore %canwalk %false + OpStore %i %int_0 + OpBranch %219 + %219 = OpLabel + OpLoopMerge %220 %221 None + OpBranch %222 + %222 = OpLabel + %223 = OpLoad %int %i + %225 = OpSLessThan %bool %223 %int_8 + OpSelectionMerge %226 None + OpBranchConditional %225 %227 %228 + %227 = OpLabel + OpBranch %226 + %228 = OpLabel + OpBranch %220 + %226 = OpLabel + OpStore %j %int_0 + OpBranch %229 + %229 = OpLabel + OpLoopMerge %230 %231 None + OpBranch %232 + %232 = OpLabel + %233 = OpLoad %int %j + %234 = OpSLessThan %bool %233 %int_8 + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %237 + %236 = OpLabel + OpBranch %235 + %237 = OpLabel + OpBranch %230 + %235 = OpLabel + %238 = OpLoad %int %j + %239 = OpLoad %int %i + %240 = OpIMul %int %238 %int_2 + %241 = OpIMul %int %239 %int_2 + %242 = OpIMul %int %241 %int_16 + %243 = OpIAdd %int %240 %242 + %244 = OpAccessChain %_ptr_Private_int %map %243 + %245 = OpLoad %int %244 + %246 = OpIEqual %bool %245 %int_0 + OpSelectionMerge %247 None + OpBranchConditional %246 %248 %247 + %248 = OpLabel + %249 = OpLoad %int %j + %250 = OpAccessChain %_ptr_Function_int %p %uint_0 + %251 = OpIMul %int %249 %int_2 + OpStore %250 %251 + %252 = OpLoad %int %i + %253 = OpAccessChain %_ptr_Function_int %p %uint_1 + %254 = OpIMul %int %252 %int_2 + OpStore %253 %254 + OpStore %canwalk %true + OpBranch %247 + %247 = OpLabel + OpBranch %231 + %231 = OpLabel + %255 = OpLoad %int %j + %256 = OpIAdd %int %255 %int_1 + OpStore %j %256 + OpBranch %229 + %230 = OpLabel + OpBranch %221 + %221 = OpLabel + %257 = OpLoad %int %i + %258 = OpIAdd %int %257 %int_1 + OpStore %i %258 + OpBranch %219 + %220 = OpLabel + %259 = OpAccessChain %_ptr_Function_int %p %uint_0 + %260 = OpLoad %int %259 + %261 = OpAccessChain %_ptr_Function_int %p %uint_1 + %262 = OpLoad %int %261 + %263 = OpIMul %int %262 %int_16 + %264 = OpIAdd %int %260 %263 + %265 = OpAccessChain %_ptr_Private_int %map %264 + OpStore %265 %int_1 + OpBranch %215 + %217 = OpLabel + %266 = OpLoad %int %v + %267 = OpLoad %int %directions + %268 = OpSMod %int %266 %267 + OpStore %d %268 + %269 = OpLoad %int %directions + %270 = OpLoad %int %v + %271 = OpIAdd %int %270 %269 + OpStore %v %271 + %272 = OpLoad %int %d + %273 = OpSGreaterThanEqual %bool %272 %int_0 + OpStore %x_230_phi %273 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %274 + %275 = OpLabel + %276 = OpAccessChain %_ptr_Function_int %p %uint_0 + %277 = OpLoad %int %276 + %278 = OpSGreaterThan %bool %277 %int_0 + OpStore %x_229 %278 + %279 = OpLoad %bool %x_229 + OpStore %x_230_phi %279 + OpBranch %274 + %274 = OpLabel + %280 = OpLoad %bool %x_230_phi + OpStore %x_243_phi %280 + OpSelectionMerge %281 None + OpBranchConditional %280 %282 %281 + %282 = OpLabel + %283 = OpAccessChain %_ptr_Function_int %p %uint_0 + %284 = OpLoad %int %283 + %285 = OpAccessChain %_ptr_Function_int %p %uint_1 + %286 = OpLoad %int %285 + %287 = OpISub %int %284 %int_2 + %288 = OpIMul %int %286 %int_16 + %289 = OpIAdd %int %287 %288 + %290 = OpAccessChain %_ptr_Private_int %map %289 + %291 = OpLoad %int %290 + %292 = OpIEqual %bool %291 %int_0 + OpStore %x_242 %292 + %293 = OpLoad %bool %x_242 + OpStore %x_243_phi %293 + OpBranch %281 + %281 = OpLabel + %294 = OpLoad %bool %x_243_phi + OpSelectionMerge %295 None + OpBranchConditional %294 %296 %295 + %296 = OpLabel + %297 = OpLoad %int %d + %298 = OpISub %int %297 %int_1 + OpStore %d %298 + %299 = OpAccessChain %_ptr_Function_int %p %uint_0 + %300 = OpLoad %int %299 + %301 = OpAccessChain %_ptr_Function_int %p %uint_1 + %302 = OpLoad %int %301 + %303 = OpIMul %int %302 %int_16 + %304 = OpIAdd %int %300 %303 + %305 = OpAccessChain %_ptr_Private_int %map %304 + OpStore %305 %int_1 + %306 = OpAccessChain %_ptr_Function_int %p %uint_0 + %307 = OpLoad %int %306 + %308 = OpAccessChain %_ptr_Function_int %p %uint_1 + %309 = OpLoad %int %308 + %310 = OpISub %int %307 %int_1 + %311 = OpIMul %int %309 %int_16 + %312 = OpIAdd %int %310 %311 + %313 = OpAccessChain %_ptr_Private_int %map %312 + OpStore %313 %int_1 + %314 = OpAccessChain %_ptr_Function_int %p %uint_0 + %315 = OpLoad %int %314 + %316 = OpAccessChain %_ptr_Function_int %p %uint_1 + %317 = OpLoad %int %316 + %318 = OpISub %int %315 %int_2 + %319 = OpIMul %int %317 %int_16 + %320 = OpIAdd %int %318 %319 + %321 = OpAccessChain %_ptr_Private_int %map %320 + OpStore %321 %int_1 + %322 = OpAccessChain %_ptr_Function_int %p %uint_0 + %323 = OpLoad %int %322 + %324 = OpAccessChain %_ptr_Function_int %p %uint_0 + %325 = OpISub %int %323 %int_2 + OpStore %324 %325 + OpBranch %295 + %295 = OpLabel + %326 = OpLoad %int %d + %327 = OpSGreaterThanEqual %bool %326 %int_0 + OpStore %x_282_phi %327 + OpSelectionMerge %328 None + OpBranchConditional %327 %329 %328 + %329 = OpLabel + %330 = OpAccessChain %_ptr_Function_int %p %uint_1 + %331 = OpLoad %int %330 + %332 = OpSGreaterThan %bool %331 %int_0 + OpStore %x_281 %332 + %333 = OpLoad %bool %x_281 + OpStore %x_282_phi %333 + OpBranch %328 + %328 = OpLabel + %334 = OpLoad %bool %x_282_phi + OpSelectionMerge %335 None + OpBranchConditional %334 %336 %337 + %336 = OpLabel + %338 = OpAccessChain %_ptr_Function_int %p %uint_0 + %339 = OpLoad %int %338 + OpStore %x_288 %339 + %340 = OpLoad %int %x_288 + OpStore %x_290_phi %340 + OpBranch %335 + %337 = OpLabel + OpStore %x_289 %int_0 + %341 = OpLoad %int %x_289 + OpStore %x_290_phi %341 + OpBranch %335 + %335 = OpLabel + %342 = OpLoad %int %x_290_phi + OpSelectionMerge %343 None + OpBranchConditional %334 %344 %345 + %344 = OpLabel + %346 = OpAccessChain %_ptr_Function_int %p %uint_1 + %347 = OpLoad %int %346 + OpStore %x_295 %347 + %348 = OpLoad %int %x_295 + OpStore %x_297_phi %348 + OpBranch %343 + %345 = OpLabel + OpStore %x_296 %int_0 + %349 = OpLoad %int %x_296 + OpStore %x_297_phi %349 + OpBranch %343 + %343 = OpLabel + %350 = OpLoad %int %x_297_phi + %351 = OpISub %int %350 %int_2 + %352 = OpIMul %int %351 %int_16 + OpSelectionMerge %353 None + OpBranchConditional %334 %354 %355 + %354 = OpLabel + %356 = OpLoad %_arr_int_uint_256 %map + OpStore %x_303 %356 + %357 = OpLoad %_arr_int_uint_256 %x_303 + OpStore %x_305_phi %357 + OpBranch %353 + %355 = OpLabel + OpStore %x_304 %358 + %359 = OpLoad %_arr_int_uint_256 %x_304 + OpStore %x_305_phi %359 + OpBranch %353 + %353 = OpLabel + %360 = OpLoad %_arr_int_uint_256 %x_305_phi + OpSelectionMerge %361 None + OpBranchConditional %334 %362 %361 + %362 = OpLabel + OpStore %map %358 + OpBranch %361 + %361 = OpLabel + OpSelectionMerge %363 None + OpBranchConditional %334 %364 %363 + %364 = OpLabel + OpStore %map %360 + OpBranch %363 + %363 = OpLabel + OpSelectionMerge %365 None + OpBranchConditional %334 %366 %367 + %366 = OpLabel + %368 = OpIAdd %int %342 %352 + %369 = OpAccessChain %_ptr_Private_int %map %368 + %370 = OpLoad %int %369 + OpStore %x_315 %370 + %371 = OpLoad %int %x_315 + OpStore %x_317_phi %371 + OpBranch %365 + %367 = OpLabel + OpStore %x_316 %int_0 + %372 = OpLoad %int %x_316 + OpStore %x_317_phi %372 + OpBranch %365 + %365 = OpLabel + %373 = OpLoad %int %x_317_phi + %374 = OpIEqual %bool %373 %int_0 + %375 = OpSelect %bool %334 %374 %334 + OpSelectionMerge %376 None + OpBranchConditional %375 %377 %376 + %377 = OpLabel + %378 = OpLoad %int %d + %379 = OpISub %int %378 %int_1 + OpStore %d %379 + %380 = OpAccessChain %_ptr_Function_int %p %uint_0 + %381 = OpLoad %int %380 + %382 = OpAccessChain %_ptr_Function_int %p %uint_1 + %383 = OpLoad %int %382 + %384 = OpIMul %int %383 %int_16 + %385 = OpIAdd %int %381 %384 + %386 = OpAccessChain %_ptr_Private_int %map %385 + OpStore %386 %int_1 + %387 = OpAccessChain %_ptr_Function_int %p %uint_0 + %388 = OpLoad %int %387 + %389 = OpAccessChain %_ptr_Function_int %p %uint_1 + %390 = OpLoad %int %389 + %391 = OpISub %int %390 %int_1 + %392 = OpIMul %int %391 %int_16 + %393 = OpIAdd %int %388 %392 + %394 = OpAccessChain %_ptr_Private_int %map %393 + OpStore %394 %int_1 + %395 = OpAccessChain %_ptr_Function_int %p %uint_0 + %396 = OpLoad %int %395 + %397 = OpAccessChain %_ptr_Function_int %p %uint_1 + %398 = OpLoad %int %397 + %399 = OpLoad %_arr_int_uint_256 %map + OpStore %map %358 + OpStore %map %399 + %400 = OpISub %int %398 %int_2 + %401 = OpIMul %int %400 %int_16 + %402 = OpIAdd %int %396 %401 + %403 = OpAccessChain %_ptr_Private_int %map %402 + OpStore %403 %int_1 + %404 = OpAccessChain %_ptr_Function_int %p %uint_1 + %405 = OpLoad %int %404 + %406 = OpAccessChain %_ptr_Function_int %p %uint_1 + %407 = OpISub %int %405 %int_2 + OpStore %406 %407 + OpBranch %376 + %376 = OpLabel + %408 = OpLoad %int %d + %409 = OpSGreaterThanEqual %bool %408 %int_0 + OpStore %x_360_phi %409 + OpSelectionMerge %410 None + OpBranchConditional %409 %411 %410 + %411 = OpLabel + %412 = OpAccessChain %_ptr_Function_int %p %uint_0 + %413 = OpLoad %int %412 + %414 = OpSLessThan %bool %413 %int_14 + OpStore %x_359 %414 + %415 = OpLoad %bool %x_359 + OpStore %x_360_phi %415 + OpBranch %410 + %410 = OpLabel + %416 = OpLoad %bool %x_360_phi + OpStore %x_373_phi %416 + OpSelectionMerge %417 None + OpBranchConditional %416 %418 %417 + %418 = OpLabel + %419 = OpAccessChain %_ptr_Function_int %p %uint_0 + %420 = OpLoad %int %419 + %421 = OpAccessChain %_ptr_Function_int %p %uint_1 + %422 = OpLoad %int %421 + %423 = OpIAdd %int %420 %int_2 + %424 = OpIMul %int %422 %int_16 + %425 = OpIAdd %int %423 %424 + %426 = OpAccessChain %_ptr_Private_int %map %425 + %427 = OpLoad %int %426 + %428 = OpIEqual %bool %427 %int_0 + OpStore %x_372 %428 + %429 = OpLoad %bool %x_372 + OpStore %x_373_phi %429 + OpBranch %417 + %417 = OpLabel + %430 = OpLoad %bool %x_373_phi + OpSelectionMerge %431 None + OpBranchConditional %430 %432 %431 + %432 = OpLabel + %433 = OpLoad %int %d + %434 = OpISub %int %433 %int_1 + OpStore %d %434 + %435 = OpAccessChain %_ptr_Function_int %p %uint_0 + %436 = OpLoad %int %435 + %437 = OpAccessChain %_ptr_Function_int %p %uint_1 + %438 = OpLoad %int %437 + %439 = OpIMul %int %438 %int_16 + %440 = OpIAdd %int %436 %439 + %441 = OpAccessChain %_ptr_Private_int %map %440 + OpStore %441 %int_1 + %442 = OpAccessChain %_ptr_Function_int %p %uint_0 + %443 = OpLoad %int %442 + %444 = OpAccessChain %_ptr_Function_int %p %uint_1 + %445 = OpLoad %int %444 + %446 = OpIAdd %int %443 %int_1 + %447 = OpIMul %int %445 %int_16 + %448 = OpIAdd %int %446 %447 + %449 = OpAccessChain %_ptr_Private_int %map %448 + OpStore %449 %int_1 + %450 = OpAccessChain %_ptr_Function_int %p %uint_0 + %451 = OpLoad %int %450 + %452 = OpAccessChain %_ptr_Function_int %p %uint_1 + %453 = OpLoad %int %452 + %454 = OpIAdd %int %451 %int_2 + %455 = OpIMul %int %453 %int_16 + %456 = OpIAdd %int %454 %455 + %457 = OpAccessChain %_ptr_Private_int %map %456 + OpStore %457 %int_1 + %458 = OpAccessChain %_ptr_Function_int %p %uint_0 + %459 = OpLoad %int %458 + %460 = OpAccessChain %_ptr_Function_int %p %uint_0 + %461 = OpIAdd %int %459 %int_2 + OpStore %460 %461 + OpBranch %431 + %431 = OpLabel + %462 = OpLoad %int %d + %463 = OpSGreaterThanEqual %bool %462 %int_0 + OpStore %x_412_phi %463 + OpSelectionMerge %464 None + OpBranchConditional %463 %465 %464 + %465 = OpLabel + %466 = OpAccessChain %_ptr_Function_int %p %uint_1 + %467 = OpLoad %int %466 + %468 = OpSLessThan %bool %467 %int_14 + OpStore %x_411 %468 + %469 = OpLoad %bool %x_411 + OpStore %x_412_phi %469 + OpBranch %464 + %464 = OpLabel + %470 = OpLoad %bool %x_412_phi + OpStore %x_425_phi %470 + OpSelectionMerge %471 None + OpBranchConditional %470 %472 %471 + %472 = OpLabel + %473 = OpAccessChain %_ptr_Function_int %p %uint_0 + %474 = OpLoad %int %473 + %475 = OpAccessChain %_ptr_Function_int %p %uint_1 + %476 = OpLoad %int %475 + %477 = OpIAdd %int %476 %int_2 + %478 = OpIMul %int %477 %int_16 + %479 = OpIAdd %int %474 %478 + %480 = OpAccessChain %_ptr_Private_int %map %479 + %481 = OpLoad %int %480 + %482 = OpIEqual %bool %481 %int_0 + OpStore %x_424 %482 + %483 = OpLoad %bool %x_424 + OpStore %x_425_phi %483 + OpBranch %471 + %471 = OpLabel + %484 = OpLoad %bool %x_425_phi + OpSelectionMerge %485 None + OpBranchConditional %484 %486 %485 + %486 = OpLabel + %487 = OpLoad %int %d + %488 = OpISub %int %487 %int_1 + OpStore %d %488 + %489 = OpAccessChain %_ptr_Function_int %p %uint_0 + %490 = OpLoad %int %489 + %491 = OpAccessChain %_ptr_Function_int %p %uint_1 + %492 = OpLoad %int %491 + %493 = OpIMul %int %492 %int_16 + %494 = OpIAdd %int %490 %493 + %495 = OpAccessChain %_ptr_Private_int %map %494 + OpStore %495 %int_1 + %496 = OpAccessChain %_ptr_Function_int %p %uint_0 + %497 = OpLoad %int %496 + %498 = OpAccessChain %_ptr_Function_int %p %uint_1 + %499 = OpLoad %int %498 + %500 = OpIAdd %int %499 %int_1 + %501 = OpIMul %int %500 %int_16 + %502 = OpIAdd %int %497 %501 + %503 = OpAccessChain %_ptr_Private_int %map %502 + OpStore %503 %int_1 + %504 = OpAccessChain %_ptr_Function_int %p %uint_0 + %505 = OpLoad %int %504 + %506 = OpAccessChain %_ptr_Function_int %p %uint_1 + %507 = OpLoad %int %506 + %508 = OpIAdd %int %507 %int_2 + %509 = OpIMul %int %508 %int_16 + %510 = OpIAdd %int %505 %509 + %511 = OpAccessChain %_ptr_Private_int %map %510 + OpStore %511 %int_1 + %512 = OpAccessChain %_ptr_Function_int %p %uint_1 + %513 = OpLoad %int %512 + %514 = OpAccessChain %_ptr_Function_int %p %uint_1 + %515 = OpIAdd %int %513 %int_2 + OpStore %514 %515 + OpBranch %485 + %485 = OpLabel + OpBranch %215 + %215 = OpLabel + %516 = OpAccessChain %_ptr_Function_int %ipos %uint_1 + %517 = OpLoad %int %516 + %518 = OpAccessChain %_ptr_Function_int %ipos %uint_0 + %519 = OpLoad %int %518 + %520 = OpIMul %int %517 %int_16 + %521 = OpIAdd %int %520 %519 + %522 = OpAccessChain %_ptr_Private_int %map %521 + %523 = OpLoad %int %522 + %524 = OpIEqual %bool %523 %int_1 + OpSelectionMerge %525 None + OpBranchConditional %524 %526 %525 + %526 = OpLabel + OpStore %x_GLF_color %528 + OpReturn + %525 = OpLabel + OpBranch %87 + %87 = OpLabel + %529 = OpLoad %bool %canwalk + OpSelectionMerge %530 None + OpBranchConditional %529 %531 %532 + %531 = OpLabel + OpBranch %530 + %532 = OpLabel + OpBranch %86 + %530 = OpLabel + OpBranch %85 + %86 = OpLabel + OpStore %x_GLF_color %534 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %535 +%tint_symbol_1 = OpFunctionParameter %main_out + %539 = OpLabel + %540 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %540 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %542 = OpLabel + %543 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %543 + %544 = OpFunctionCall %void %main_1 + %546 = OpLoad %v4float %x_GLF_color + %547 = OpCompositeConstruct %main_out %546 + %545 = OpFunctionCall %void %tint_symbol_3 %547 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 87[%87] is not post dominated by the back-edge block 530[%530] + %530 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..76364260c1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.wgsl @@ -0,0 +1,392 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var map : array; + +var x_GLF_color : vec4; + +fn main_1() { + var pos : vec2; + var ipos : vec2; + var i : i32; + var p : vec2; + var canwalk : bool; + var v : i32; + var directions : i32; + var j : i32; + var d : i32; + let x_59 : vec4 = gl_FragCoord; + let x_62 : vec2 = x_7.resolution; + pos = (vec2(x_59.x, x_59.y) / x_62); + let x_65 : f32 = pos.x; + let x_69 : f32 = pos.y; + ipos = vec2(i32((x_65 * 16.0)), i32((x_69 * 16.0))); + i = 0; + loop { + let x_77 : i32 = i; + if ((x_77 < 256)) { + } else { + break; + } + let x_80 : i32 = i; + map[x_80] = 0; + + continuing { + let x_82 : i32 = i; + i = (x_82 + 1); + } + } + p = vec2(0, 0); + canwalk = true; + v = 0; + loop { + var x_104 : bool; + var x_124 : bool; + var x_144 : bool; + var x_164 : bool; + var x_105_phi : bool; + var x_125_phi : bool; + var x_145_phi : bool; + var x_165_phi : bool; + let x_88 : i32 = v; + v = (x_88 + 1); + directions = 0; + let x_91 : i32 = p.x; + let x_92 : bool = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + let x_96 : i32 = p.x; + let x_99 : i32 = p.y; + let x_103 : i32 = map[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + let x_105 : bool = x_105_phi; + if (x_105) { + let x_108 : i32 = directions; + directions = (x_108 + 1); + } + let x_111 : i32 = p.y; + let x_112 : bool = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + let x_116 : i32 = p.x; + let x_118 : i32 = p.y; + let x_123 : i32 = map[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + let x_125 : bool = x_125_phi; + if (x_125) { + let x_128 : i32 = directions; + directions = (x_128 + 1); + } + let x_131 : i32 = p.x; + let x_132 : bool = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + let x_136 : i32 = p.x; + let x_139 : i32 = p.y; + let x_143 : i32 = map[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + let x_145 : bool = x_145_phi; + if (x_145) { + let x_148 : i32 = directions; + directions = (x_148 + 1); + } + let x_151 : i32 = p.y; + let x_152 : bool = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + let x_156 : i32 = p.x; + let x_158 : i32 = p.y; + let x_163 : i32 = map[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + let x_165 : bool = x_165_phi; + if (x_165) { + let x_168 : i32 = directions; + directions = (x_168 + 1); + } + var x_229 : bool; + var x_242 : bool; + var x_281 : bool; + var x_288 : i32; + var x_289 : i32; + var x_295 : i32; + var x_296 : i32; + var x_303 : array; + var x_304 : array; + var x_315 : i32; + var x_316 : i32; + var x_359 : bool; + var x_372 : bool; + var x_411 : bool; + var x_424 : bool; + var x_230_phi : bool; + var x_243_phi : bool; + var x_282_phi : bool; + var x_290_phi : i32; + var x_297_phi : i32; + var x_305_phi : array; + var x_317_phi : i32; + var x_360_phi : bool; + var x_373_phi : bool; + var x_412_phi : bool; + var x_425_phi : bool; + let x_170 : i32 = directions; + if ((x_170 == 0)) { + canwalk = false; + i = 0; + loop { + let x_179 : i32 = i; + if ((x_179 < 8)) { + } else { + break; + } + j = 0; + loop { + let x_186 : i32 = j; + if ((x_186 < 8)) { + } else { + break; + } + let x_189 : i32 = j; + let x_191 : i32 = i; + let x_196 : i32 = map[((x_189 * 2) + ((x_191 * 2) * 16))]; + if ((x_196 == 0)) { + let x_200 : i32 = j; + p.x = (x_200 * 2); + let x_203 : i32 = i; + p.y = (x_203 * 2); + canwalk = true; + } + + continuing { + let x_206 : i32 = j; + j = (x_206 + 1); + } + } + + continuing { + let x_208 : i32 = i; + i = (x_208 + 1); + } + } + let x_211 : i32 = p.x; + let x_213 : i32 = p.y; + map[(x_211 + (x_213 * 16))] = 1; + } else { + let x_217 : i32 = v; + let x_218 : i32 = directions; + d = (x_217 % x_218); + let x_220 : i32 = directions; + let x_221 : i32 = v; + v = (x_221 + x_220); + let x_223 : i32 = d; + let x_224 : bool = (x_223 >= 0); + x_230_phi = x_224; + if (x_224) { + let x_228 : i32 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + let x_230 : bool = x_230_phi; + x_243_phi = x_230; + if (x_230) { + let x_234 : i32 = p.x; + let x_237 : i32 = p.y; + let x_241 : i32 = map[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + let x_243 : bool = x_243_phi; + if (x_243) { + let x_246 : i32 = d; + d = (x_246 - 1); + let x_249 : i32 = p.x; + let x_251 : i32 = p.y; + map[(x_249 + (x_251 * 16))] = 1; + let x_256 : i32 = p.x; + let x_259 : i32 = p.y; + map[((x_256 - 1) + (x_259 * 16))] = 1; + let x_264 : i32 = p.x; + let x_267 : i32 = p.y; + map[((x_264 - 2) + (x_267 * 16))] = 1; + let x_272 : i32 = p.x; + p.x = (x_272 - 2); + } + let x_275 : i32 = d; + let x_276 : bool = (x_275 >= 0); + x_282_phi = x_276; + if (x_276) { + let x_280 : i32 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + let x_282 : bool = x_282_phi; + if (x_282) { + x_288 = p.x; + x_290_phi = x_288; + } else { + x_289 = 0; + x_290_phi = x_289; + } + let x_290 : i32 = x_290_phi; + if (x_282) { + x_295 = p.y; + x_297_phi = x_295; + } else { + x_296 = 0; + x_297_phi = x_296; + } + let x_297 : i32 = x_297_phi; + let x_299 : i32 = ((x_297 - 2) * 16); + if (x_282) { + x_303 = map; + x_305_phi = x_303; + } else { + x_304 = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + x_305_phi = x_304; + } + let x_305 : array = x_305_phi; + if (x_282) { + map = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } + if (x_282) { + map = x_305; + } + if (x_282) { + x_315 = map[(x_290 + x_299)]; + x_317_phi = x_315; + } else { + x_316 = 0; + x_317_phi = x_316; + } + let x_317 : i32 = x_317_phi; + let x_318 : bool = (x_317 == 0); + if (select(x_282, x_318, x_282)) { + let x_323 : i32 = d; + d = (x_323 - 1); + let x_326 : i32 = p.x; + let x_328 : i32 = p.y; + map[(x_326 + (x_328 * 16))] = 1; + let x_333 : i32 = p.x; + let x_335 : i32 = p.y; + map[(x_333 + ((x_335 - 1) * 16))] = 1; + let x_341 : i32 = p.x; + let x_343 : i32 = p.y; + let x_345 : array = map; + map = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + map = x_345; + map[(x_341 + ((x_343 - 2) * 16))] = 1; + let x_350 : i32 = p.y; + p.y = (x_350 - 2); + } + let x_353 : i32 = d; + let x_354 : bool = (x_353 >= 0); + x_360_phi = x_354; + if (x_354) { + let x_358 : i32 = p.x; + x_359 = (x_358 < 14); + x_360_phi = x_359; + } + let x_360 : bool = x_360_phi; + x_373_phi = x_360; + if (x_360) { + let x_364 : i32 = p.x; + let x_367 : i32 = p.y; + let x_371 : i32 = map[((x_364 + 2) + (x_367 * 16))]; + x_372 = (x_371 == 0); + x_373_phi = x_372; + } + let x_373 : bool = x_373_phi; + if (x_373) { + let x_376 : i32 = d; + d = (x_376 - 1); + let x_379 : i32 = p.x; + let x_381 : i32 = p.y; + map[(x_379 + (x_381 * 16))] = 1; + let x_386 : i32 = p.x; + let x_389 : i32 = p.y; + map[((x_386 + 1) + (x_389 * 16))] = 1; + let x_394 : i32 = p.x; + let x_397 : i32 = p.y; + map[((x_394 + 2) + (x_397 * 16))] = 1; + let x_402 : i32 = p.x; + p.x = (x_402 + 2); + } + let x_405 : i32 = d; + let x_406 : bool = (x_405 >= 0); + x_412_phi = x_406; + if (x_406) { + let x_410 : i32 = p.y; + x_411 = (x_410 < 14); + x_412_phi = x_411; + } + let x_412 : bool = x_412_phi; + x_425_phi = x_412; + if (x_412) { + let x_416 : i32 = p.x; + let x_418 : i32 = p.y; + let x_423 : i32 = map[(x_416 + ((x_418 + 2) * 16))]; + x_424 = (x_423 == 0); + x_425_phi = x_424; + } + let x_425 : bool = x_425_phi; + if (x_425) { + let x_428 : i32 = d; + d = (x_428 - 1); + let x_431 : i32 = p.x; + let x_433 : i32 = p.y; + map[(x_431 + (x_433 * 16))] = 1; + let x_438 : i32 = p.x; + let x_440 : i32 = p.y; + map[(x_438 + ((x_440 + 1) * 16))] = 1; + let x_446 : i32 = p.x; + let x_448 : i32 = p.y; + map[(x_446 + ((x_448 + 2) * 16))] = 1; + let x_454 : i32 = p.y; + p.y = (x_454 + 2); + } + } + let x_458 : i32 = ipos.y; + let x_461 : i32 = ipos.x; + let x_464 : i32 = map[((x_458 * 16) + x_461)]; + if ((x_464 == 1)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + return; + } + + continuing { + let x_468 : bool = canwalk; + if (x_468) { + } else { + break; + } + } + } + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl new file mode 100644 index 0000000000..76364260c1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl @@ -0,0 +1,392 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var map : array; + +var x_GLF_color : vec4; + +fn main_1() { + var pos : vec2; + var ipos : vec2; + var i : i32; + var p : vec2; + var canwalk : bool; + var v : i32; + var directions : i32; + var j : i32; + var d : i32; + let x_59 : vec4 = gl_FragCoord; + let x_62 : vec2 = x_7.resolution; + pos = (vec2(x_59.x, x_59.y) / x_62); + let x_65 : f32 = pos.x; + let x_69 : f32 = pos.y; + ipos = vec2(i32((x_65 * 16.0)), i32((x_69 * 16.0))); + i = 0; + loop { + let x_77 : i32 = i; + if ((x_77 < 256)) { + } else { + break; + } + let x_80 : i32 = i; + map[x_80] = 0; + + continuing { + let x_82 : i32 = i; + i = (x_82 + 1); + } + } + p = vec2(0, 0); + canwalk = true; + v = 0; + loop { + var x_104 : bool; + var x_124 : bool; + var x_144 : bool; + var x_164 : bool; + var x_105_phi : bool; + var x_125_phi : bool; + var x_145_phi : bool; + var x_165_phi : bool; + let x_88 : i32 = v; + v = (x_88 + 1); + directions = 0; + let x_91 : i32 = p.x; + let x_92 : bool = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + let x_96 : i32 = p.x; + let x_99 : i32 = p.y; + let x_103 : i32 = map[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + let x_105 : bool = x_105_phi; + if (x_105) { + let x_108 : i32 = directions; + directions = (x_108 + 1); + } + let x_111 : i32 = p.y; + let x_112 : bool = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + let x_116 : i32 = p.x; + let x_118 : i32 = p.y; + let x_123 : i32 = map[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + let x_125 : bool = x_125_phi; + if (x_125) { + let x_128 : i32 = directions; + directions = (x_128 + 1); + } + let x_131 : i32 = p.x; + let x_132 : bool = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + let x_136 : i32 = p.x; + let x_139 : i32 = p.y; + let x_143 : i32 = map[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + let x_145 : bool = x_145_phi; + if (x_145) { + let x_148 : i32 = directions; + directions = (x_148 + 1); + } + let x_151 : i32 = p.y; + let x_152 : bool = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + let x_156 : i32 = p.x; + let x_158 : i32 = p.y; + let x_163 : i32 = map[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + let x_165 : bool = x_165_phi; + if (x_165) { + let x_168 : i32 = directions; + directions = (x_168 + 1); + } + var x_229 : bool; + var x_242 : bool; + var x_281 : bool; + var x_288 : i32; + var x_289 : i32; + var x_295 : i32; + var x_296 : i32; + var x_303 : array; + var x_304 : array; + var x_315 : i32; + var x_316 : i32; + var x_359 : bool; + var x_372 : bool; + var x_411 : bool; + var x_424 : bool; + var x_230_phi : bool; + var x_243_phi : bool; + var x_282_phi : bool; + var x_290_phi : i32; + var x_297_phi : i32; + var x_305_phi : array; + var x_317_phi : i32; + var x_360_phi : bool; + var x_373_phi : bool; + var x_412_phi : bool; + var x_425_phi : bool; + let x_170 : i32 = directions; + if ((x_170 == 0)) { + canwalk = false; + i = 0; + loop { + let x_179 : i32 = i; + if ((x_179 < 8)) { + } else { + break; + } + j = 0; + loop { + let x_186 : i32 = j; + if ((x_186 < 8)) { + } else { + break; + } + let x_189 : i32 = j; + let x_191 : i32 = i; + let x_196 : i32 = map[((x_189 * 2) + ((x_191 * 2) * 16))]; + if ((x_196 == 0)) { + let x_200 : i32 = j; + p.x = (x_200 * 2); + let x_203 : i32 = i; + p.y = (x_203 * 2); + canwalk = true; + } + + continuing { + let x_206 : i32 = j; + j = (x_206 + 1); + } + } + + continuing { + let x_208 : i32 = i; + i = (x_208 + 1); + } + } + let x_211 : i32 = p.x; + let x_213 : i32 = p.y; + map[(x_211 + (x_213 * 16))] = 1; + } else { + let x_217 : i32 = v; + let x_218 : i32 = directions; + d = (x_217 % x_218); + let x_220 : i32 = directions; + let x_221 : i32 = v; + v = (x_221 + x_220); + let x_223 : i32 = d; + let x_224 : bool = (x_223 >= 0); + x_230_phi = x_224; + if (x_224) { + let x_228 : i32 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + let x_230 : bool = x_230_phi; + x_243_phi = x_230; + if (x_230) { + let x_234 : i32 = p.x; + let x_237 : i32 = p.y; + let x_241 : i32 = map[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + let x_243 : bool = x_243_phi; + if (x_243) { + let x_246 : i32 = d; + d = (x_246 - 1); + let x_249 : i32 = p.x; + let x_251 : i32 = p.y; + map[(x_249 + (x_251 * 16))] = 1; + let x_256 : i32 = p.x; + let x_259 : i32 = p.y; + map[((x_256 - 1) + (x_259 * 16))] = 1; + let x_264 : i32 = p.x; + let x_267 : i32 = p.y; + map[((x_264 - 2) + (x_267 * 16))] = 1; + let x_272 : i32 = p.x; + p.x = (x_272 - 2); + } + let x_275 : i32 = d; + let x_276 : bool = (x_275 >= 0); + x_282_phi = x_276; + if (x_276) { + let x_280 : i32 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + let x_282 : bool = x_282_phi; + if (x_282) { + x_288 = p.x; + x_290_phi = x_288; + } else { + x_289 = 0; + x_290_phi = x_289; + } + let x_290 : i32 = x_290_phi; + if (x_282) { + x_295 = p.y; + x_297_phi = x_295; + } else { + x_296 = 0; + x_297_phi = x_296; + } + let x_297 : i32 = x_297_phi; + let x_299 : i32 = ((x_297 - 2) * 16); + if (x_282) { + x_303 = map; + x_305_phi = x_303; + } else { + x_304 = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + x_305_phi = x_304; + } + let x_305 : array = x_305_phi; + if (x_282) { + map = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } + if (x_282) { + map = x_305; + } + if (x_282) { + x_315 = map[(x_290 + x_299)]; + x_317_phi = x_315; + } else { + x_316 = 0; + x_317_phi = x_316; + } + let x_317 : i32 = x_317_phi; + let x_318 : bool = (x_317 == 0); + if (select(x_282, x_318, x_282)) { + let x_323 : i32 = d; + d = (x_323 - 1); + let x_326 : i32 = p.x; + let x_328 : i32 = p.y; + map[(x_326 + (x_328 * 16))] = 1; + let x_333 : i32 = p.x; + let x_335 : i32 = p.y; + map[(x_333 + ((x_335 - 1) * 16))] = 1; + let x_341 : i32 = p.x; + let x_343 : i32 = p.y; + let x_345 : array = map; + map = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + map = x_345; + map[(x_341 + ((x_343 - 2) * 16))] = 1; + let x_350 : i32 = p.y; + p.y = (x_350 - 2); + } + let x_353 : i32 = d; + let x_354 : bool = (x_353 >= 0); + x_360_phi = x_354; + if (x_354) { + let x_358 : i32 = p.x; + x_359 = (x_358 < 14); + x_360_phi = x_359; + } + let x_360 : bool = x_360_phi; + x_373_phi = x_360; + if (x_360) { + let x_364 : i32 = p.x; + let x_367 : i32 = p.y; + let x_371 : i32 = map[((x_364 + 2) + (x_367 * 16))]; + x_372 = (x_371 == 0); + x_373_phi = x_372; + } + let x_373 : bool = x_373_phi; + if (x_373) { + let x_376 : i32 = d; + d = (x_376 - 1); + let x_379 : i32 = p.x; + let x_381 : i32 = p.y; + map[(x_379 + (x_381 * 16))] = 1; + let x_386 : i32 = p.x; + let x_389 : i32 = p.y; + map[((x_386 + 1) + (x_389 * 16))] = 1; + let x_394 : i32 = p.x; + let x_397 : i32 = p.y; + map[((x_394 + 2) + (x_397 * 16))] = 1; + let x_402 : i32 = p.x; + p.x = (x_402 + 2); + } + let x_405 : i32 = d; + let x_406 : bool = (x_405 >= 0); + x_412_phi = x_406; + if (x_406) { + let x_410 : i32 = p.y; + x_411 = (x_410 < 14); + x_412_phi = x_411; + } + let x_412 : bool = x_412_phi; + x_425_phi = x_412; + if (x_412) { + let x_416 : i32 = p.x; + let x_418 : i32 = p.y; + let x_423 : i32 = map[(x_416 + ((x_418 + 2) * 16))]; + x_424 = (x_423 == 0); + x_425_phi = x_424; + } + let x_425 : bool = x_425_phi; + if (x_425) { + let x_428 : i32 = d; + d = (x_428 - 1); + let x_431 : i32 = p.x; + let x_433 : i32 = p.y; + map[(x_431 + (x_433 * 16))] = 1; + let x_438 : i32 = p.x; + let x_440 : i32 = p.y; + map[(x_438 + ((x_440 + 1) * 16))] = 1; + let x_446 : i32 = p.x; + let x_448 : i32 = p.y; + map[(x_446 + ((x_448 + 2) * 16))] = 1; + let x_454 : i32 = p.y; + p.y = (x_454 + 2); + } + } + let x_458 : i32 = ipos.y; + let x_461 : i32 = ipos.x; + let x_464 : i32 = map[((x_458 * 16) + x_461)]; + if ((x_464 == 1)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + return; + } + + continuing { + let x_468 : bool = canwalk; + if (x_468) { + } else { + break; + } + } + } + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..0505c28fae --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.hlsl @@ -0,0 +1,338 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static int map[256] = (int[256])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int i = 0; + int2 p = int2(0, 0); + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + const float4 x_59 = gl_FragCoord; + const float2 x_62 = asfloat(x_7[0].xy); + pos = (float2(x_59.x, x_59.y) / x_62); + const float x_65 = pos.x; + const float x_69 = pos.y; + ipos = int2(int((x_65 * 16.0f)), int((x_69 * 16.0f))); + i = 0; + { + for(; (i < 256); i = (i + 1)) { + map[i] = 0; + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_104 = false; + bool x_124 = false; + bool x_144 = false; + bool x_164 = false; + bool x_105_phi = false; + bool x_125_phi = false; + bool x_145_phi = false; + bool x_165_phi = false; + v = (v + 1); + directions = 0; + const int x_91 = p.x; + const bool x_92 = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + const int x_96 = p.x; + const int x_99 = p.y; + const int x_103 = map[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + if (x_105_phi) { + directions = (directions + 1); + } + const int x_111 = p.y; + const bool x_112 = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + const int x_116 = p.x; + const int x_118 = p.y; + const int x_123 = map[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + if (x_125_phi) { + directions = (directions + 1); + } + const int x_131 = p.x; + const bool x_132 = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + const int x_136 = p.x; + const int x_139 = p.y; + const int x_143 = map[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + if (x_145_phi) { + directions = (directions + 1); + } + const int x_151 = p.y; + const bool x_152 = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + const int x_156 = p.x; + const int x_158 = p.y; + const int x_163 = map[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + if (x_165_phi) { + directions = (directions + 1); + } + bool x_229 = false; + bool x_242 = false; + bool x_281 = false; + int x_288 = 0; + int x_289 = 0; + int x_295 = 0; + int x_296 = 0; + int x_303[256] = (int[256])0; + int x_304[256] = (int[256])0; + int x_315 = 0; + int x_316 = 0; + bool x_359 = false; + bool x_372 = false; + bool x_411 = false; + bool x_424 = false; + bool x_230_phi = false; + bool x_243_phi = false; + bool x_282_phi = false; + int x_290_phi = 0; + int x_297_phi = 0; + int x_305_phi[256] = (int[256])0; + int x_317_phi = 0; + bool x_360_phi = false; + bool x_373_phi = false; + bool x_412_phi = false; + bool x_425_phi = false; + if ((directions == 0)) { + canwalk = false; + i = 0; + { + for(; (i < 8); i = (i + 1)) { + j = 0; + { + for(; (j < 8); j = (j + 1)) { + const int x_196 = map[((j * 2) + ((i * 2) * 16))]; + if ((x_196 == 0)) { + p.x = (j * 2); + p.y = (i * 2); + canwalk = true; + } + } + } + } + } + const int x_211 = p.x; + const int x_213 = p.y; + map[(x_211 + (x_213 * 16))] = 1; + } else { + d = (v % directions); + v = (v + directions); + const bool x_224 = (d >= 0); + x_230_phi = x_224; + if (x_224) { + const int x_228 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + const bool x_230 = x_230_phi; + x_243_phi = x_230; + if (x_230) { + const int x_234 = p.x; + const int x_237 = p.y; + const int x_241 = map[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + if (x_243_phi) { + d = (d - 1); + const int x_249 = p.x; + const int x_251 = p.y; + map[(x_249 + (x_251 * 16))] = 1; + const int x_256 = p.x; + const int x_259 = p.y; + map[((x_256 - 1) + (x_259 * 16))] = 1; + const int x_264 = p.x; + const int x_267 = p.y; + map[((x_264 - 2) + (x_267 * 16))] = 1; + const int x_272 = p.x; + p.x = (x_272 - 2); + } + const bool x_276 = (d >= 0); + x_282_phi = x_276; + if (x_276) { + const int x_280 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + const bool x_282 = x_282_phi; + if (x_282) { + x_288 = p.x; + x_290_phi = x_288; + } else { + x_289 = 0; + x_290_phi = x_289; + } + const int x_290 = x_290_phi; + if (x_282) { + x_295 = p.y; + x_297_phi = x_295; + } else { + x_296 = 0; + x_297_phi = x_296; + } + const int x_299 = ((x_297_phi - 2) * 16); + if (x_282) { + x_303 = map; + x_305_phi = x_303; + } else { + const int tint_symbol_5[256] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + x_304 = tint_symbol_5; + x_305_phi = x_304; + } + const int x_305[256] = x_305_phi; + if (x_282) { + const int tint_symbol_6[256] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + map = tint_symbol_6; + } + if (x_282) { + map = x_305; + } + if (x_282) { + x_315 = map[(x_290 + x_299)]; + x_317_phi = x_315; + } else { + x_316 = 0; + x_317_phi = x_316; + } + const bool x_318 = (x_317_phi == 0); + if ((x_282 ? x_318 : x_282)) { + d = (d - 1); + const int x_326 = p.x; + const int x_328 = p.y; + map[(x_326 + (x_328 * 16))] = 1; + const int x_333 = p.x; + const int x_335 = p.y; + map[(x_333 + ((x_335 - 1) * 16))] = 1; + const int x_341 = p.x; + const int x_343 = p.y; + const int x_345[256] = map; + const int tint_symbol_7[256] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + map = tint_symbol_7; + map = x_345; + map[(x_341 + ((x_343 - 2) * 16))] = 1; + const int x_350 = p.y; + p.y = (x_350 - 2); + } + const bool x_354 = (d >= 0); + x_360_phi = x_354; + if (x_354) { + const int x_358 = p.x; + x_359 = (x_358 < 14); + x_360_phi = x_359; + } + const bool x_360 = x_360_phi; + x_373_phi = x_360; + if (x_360) { + const int x_364 = p.x; + const int x_367 = p.y; + const int x_371 = map[((x_364 + 2) + (x_367 * 16))]; + x_372 = (x_371 == 0); + x_373_phi = x_372; + } + if (x_373_phi) { + d = (d - 1); + const int x_379 = p.x; + const int x_381 = p.y; + map[(x_379 + (x_381 * 16))] = 1; + const int x_386 = p.x; + const int x_389 = p.y; + map[((x_386 + 1) + (x_389 * 16))] = 1; + const int x_394 = p.x; + const int x_397 = p.y; + map[((x_394 + 2) + (x_397 * 16))] = 1; + const int x_402 = p.x; + p.x = (x_402 + 2); + } + const bool x_406 = (d >= 0); + x_412_phi = x_406; + if (x_406) { + const int x_410 = p.y; + x_411 = (x_410 < 14); + x_412_phi = x_411; + } + const bool x_412 = x_412_phi; + x_425_phi = x_412; + if (x_412) { + const int x_416 = p.x; + const int x_418 = p.y; + const int x_423 = map[(x_416 + ((x_418 + 2) * 16))]; + x_424 = (x_423 == 0); + x_425_phi = x_424; + } + if (x_425_phi) { + d = (d - 1); + const int x_431 = p.x; + const int x_433 = p.y; + map[(x_431 + (x_433 * 16))] = 1; + const int x_438 = p.x; + const int x_440 = p.y; + map[(x_438 + ((x_440 + 1) * 16))] = 1; + const int x_446 = p.x; + const int x_448 = p.y; + map[(x_446 + ((x_448 + 2) * 16))] = 1; + const int x_454 = p.y; + p.y = (x_454 + 2); + } + } + const int x_458 = ipos.y; + const int x_461 = ipos.x; + const int x_464 = map[((x_458 * 16) + x_461)]; + if ((x_464 == 1)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + if (canwalk) { + } else { + break; + } + } + } + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.msl new file mode 100644 index 0000000000..794863afd0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.msl @@ -0,0 +1,394 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_8, thread tint_array_wrapper* const tint_symbol_9, thread float4* const tint_symbol_10) { + float2 pos = 0.0f; + int2 ipos = 0; + int i = 0; + int2 p = 0; + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + float4 const x_59 = *(tint_symbol_8); + float2 const x_62 = x_7.resolution; + pos = (float2(x_59.x, x_59.y) / x_62); + float const x_65 = pos.x; + float const x_69 = pos.y; + ipos = int2(int((x_65 * 16.0f)), int((x_69 * 16.0f))); + i = 0; + while (true) { + int const x_77 = i; + if ((x_77 < 256)) { + } else { + break; + } + int const x_80 = i; + (*(tint_symbol_9)).arr[x_80] = 0; + { + int const x_82 = i; + i = (x_82 + 1); + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_104 = false; + bool x_124 = false; + bool x_144 = false; + bool x_164 = false; + bool x_105_phi = false; + bool x_125_phi = false; + bool x_145_phi = false; + bool x_165_phi = false; + int const x_88 = v; + v = (x_88 + 1); + directions = 0; + int const x_91 = p.x; + bool const x_92 = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + int const x_96 = p.x; + int const x_99 = p.y; + int const x_103 = (*(tint_symbol_9)).arr[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + bool const x_105 = x_105_phi; + if (x_105) { + int const x_108 = directions; + directions = (x_108 + 1); + } + int const x_111 = p.y; + bool const x_112 = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + int const x_116 = p.x; + int const x_118 = p.y; + int const x_123 = (*(tint_symbol_9)).arr[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + bool const x_125 = x_125_phi; + if (x_125) { + int const x_128 = directions; + directions = (x_128 + 1); + } + int const x_131 = p.x; + bool const x_132 = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + int const x_136 = p.x; + int const x_139 = p.y; + int const x_143 = (*(tint_symbol_9)).arr[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + bool const x_145 = x_145_phi; + if (x_145) { + int const x_148 = directions; + directions = (x_148 + 1); + } + int const x_151 = p.y; + bool const x_152 = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + int const x_156 = p.x; + int const x_158 = p.y; + int const x_163 = (*(tint_symbol_9)).arr[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + bool const x_165 = x_165_phi; + if (x_165) { + int const x_168 = directions; + directions = (x_168 + 1); + } + bool x_229 = false; + bool x_242 = false; + bool x_281 = false; + int x_288 = 0; + int x_289 = 0; + int x_295 = 0; + int x_296 = 0; + tint_array_wrapper x_303 = {}; + tint_array_wrapper x_304 = {}; + int x_315 = 0; + int x_316 = 0; + bool x_359 = false; + bool x_372 = false; + bool x_411 = false; + bool x_424 = false; + bool x_230_phi = false; + bool x_243_phi = false; + bool x_282_phi = false; + int x_290_phi = 0; + int x_297_phi = 0; + tint_array_wrapper x_305_phi = {}; + int x_317_phi = 0; + bool x_360_phi = false; + bool x_373_phi = false; + bool x_412_phi = false; + bool x_425_phi = false; + int const x_170 = directions; + if ((x_170 == 0)) { + canwalk = false; + i = 0; + while (true) { + int const x_179 = i; + if ((x_179 < 8)) { + } else { + break; + } + j = 0; + while (true) { + int const x_186 = j; + if ((x_186 < 8)) { + } else { + break; + } + int const x_189 = j; + int const x_191 = i; + int const x_196 = (*(tint_symbol_9)).arr[((x_189 * 2) + ((x_191 * 2) * 16))]; + if ((x_196 == 0)) { + int const x_200 = j; + p.x = (x_200 * 2); + int const x_203 = i; + p.y = (x_203 * 2); + canwalk = true; + } + { + int const x_206 = j; + j = (x_206 + 1); + } + } + { + int const x_208 = i; + i = (x_208 + 1); + } + } + int const x_211 = p.x; + int const x_213 = p.y; + (*(tint_symbol_9)).arr[(x_211 + (x_213 * 16))] = 1; + } else { + int const x_217 = v; + int const x_218 = directions; + d = (x_217 % x_218); + int const x_220 = directions; + int const x_221 = v; + v = (x_221 + x_220); + int const x_223 = d; + bool const x_224 = (x_223 >= 0); + x_230_phi = x_224; + if (x_224) { + int const x_228 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + bool const x_230 = x_230_phi; + x_243_phi = x_230; + if (x_230) { + int const x_234 = p.x; + int const x_237 = p.y; + int const x_241 = (*(tint_symbol_9)).arr[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + bool const x_243 = x_243_phi; + if (x_243) { + int const x_246 = d; + d = (x_246 - 1); + int const x_249 = p.x; + int const x_251 = p.y; + (*(tint_symbol_9)).arr[(x_249 + (x_251 * 16))] = 1; + int const x_256 = p.x; + int const x_259 = p.y; + (*(tint_symbol_9)).arr[((x_256 - 1) + (x_259 * 16))] = 1; + int const x_264 = p.x; + int const x_267 = p.y; + (*(tint_symbol_9)).arr[((x_264 - 2) + (x_267 * 16))] = 1; + int const x_272 = p.x; + p.x = (x_272 - 2); + } + int const x_275 = d; + bool const x_276 = (x_275 >= 0); + x_282_phi = x_276; + if (x_276) { + int const x_280 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + bool const x_282 = x_282_phi; + if (x_282) { + x_288 = p.x; + x_290_phi = x_288; + } else { + x_289 = 0; + x_290_phi = x_289; + } + int const x_290 = x_290_phi; + if (x_282) { + x_295 = p.y; + x_297_phi = x_295; + } else { + x_296 = 0; + x_297_phi = x_296; + } + int const x_297 = x_297_phi; + int const x_299 = ((x_297 - 2) * 16); + if (x_282) { + x_303 = *(tint_symbol_9); + x_305_phi = x_303; + } else { + tint_array_wrapper const tint_symbol_4 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + x_304 = tint_symbol_4; + x_305_phi = x_304; + } + tint_array_wrapper const x_305 = x_305_phi; + if (x_282) { + tint_array_wrapper const tint_symbol_5 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + *(tint_symbol_9) = tint_symbol_5; + } + if (x_282) { + *(tint_symbol_9) = x_305; + } + if (x_282) { + x_315 = (*(tint_symbol_9)).arr[(x_290 + x_299)]; + x_317_phi = x_315; + } else { + x_316 = 0; + x_317_phi = x_316; + } + int const x_317 = x_317_phi; + bool const x_318 = (x_317 == 0); + if (select(x_282, x_318, x_282)) { + int const x_323 = d; + d = (x_323 - 1); + int const x_326 = p.x; + int const x_328 = p.y; + (*(tint_symbol_9)).arr[(x_326 + (x_328 * 16))] = 1; + int const x_333 = p.x; + int const x_335 = p.y; + (*(tint_symbol_9)).arr[(x_333 + ((x_335 - 1) * 16))] = 1; + int const x_341 = p.x; + int const x_343 = p.y; + tint_array_wrapper const x_345 = *(tint_symbol_9); + tint_array_wrapper const tint_symbol_6 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + *(tint_symbol_9) = tint_symbol_6; + *(tint_symbol_9) = x_345; + (*(tint_symbol_9)).arr[(x_341 + ((x_343 - 2) * 16))] = 1; + int const x_350 = p.y; + p.y = (x_350 - 2); + } + int const x_353 = d; + bool const x_354 = (x_353 >= 0); + x_360_phi = x_354; + if (x_354) { + int const x_358 = p.x; + x_359 = (x_358 < 14); + x_360_phi = x_359; + } + bool const x_360 = x_360_phi; + x_373_phi = x_360; + if (x_360) { + int const x_364 = p.x; + int const x_367 = p.y; + int const x_371 = (*(tint_symbol_9)).arr[((x_364 + 2) + (x_367 * 16))]; + x_372 = (x_371 == 0); + x_373_phi = x_372; + } + bool const x_373 = x_373_phi; + if (x_373) { + int const x_376 = d; + d = (x_376 - 1); + int const x_379 = p.x; + int const x_381 = p.y; + (*(tint_symbol_9)).arr[(x_379 + (x_381 * 16))] = 1; + int const x_386 = p.x; + int const x_389 = p.y; + (*(tint_symbol_9)).arr[((x_386 + 1) + (x_389 * 16))] = 1; + int const x_394 = p.x; + int const x_397 = p.y; + (*(tint_symbol_9)).arr[((x_394 + 2) + (x_397 * 16))] = 1; + int const x_402 = p.x; + p.x = (x_402 + 2); + } + int const x_405 = d; + bool const x_406 = (x_405 >= 0); + x_412_phi = x_406; + if (x_406) { + int const x_410 = p.y; + x_411 = (x_410 < 14); + x_412_phi = x_411; + } + bool const x_412 = x_412_phi; + x_425_phi = x_412; + if (x_412) { + int const x_416 = p.x; + int const x_418 = p.y; + int const x_423 = (*(tint_symbol_9)).arr[(x_416 + ((x_418 + 2) * 16))]; + x_424 = (x_423 == 0); + x_425_phi = x_424; + } + bool const x_425 = x_425_phi; + if (x_425) { + int const x_428 = d; + d = (x_428 - 1); + int const x_431 = p.x; + int const x_433 = p.y; + (*(tint_symbol_9)).arr[(x_431 + (x_433 * 16))] = 1; + int const x_438 = p.x; + int const x_440 = p.y; + (*(tint_symbol_9)).arr[(x_438 + ((x_440 + 1) * 16))] = 1; + int const x_446 = p.x; + int const x_448 = p.y; + (*(tint_symbol_9)).arr[(x_446 + ((x_448 + 2) * 16))] = 1; + int const x_454 = p.y; + p.y = (x_454 + 2); + } + } + int const x_458 = ipos.y; + int const x_461 = ipos.x; + int const x_464 = (*(tint_symbol_9)).arr[((x_458 * 16) + x_461)]; + if ((x_464 == 1)) { + *(tint_symbol_10) = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + bool const x_468 = canwalk; + if (x_468) { + } else { + break; + } + } + } + *(tint_symbol_10) = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread tint_array_wrapper tint_symbol_12 = {}; + thread float4 tint_symbol_13 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_11), &(tint_symbol_12), &(tint_symbol_13)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13}; + tint_symbol_2 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..bde11c85cf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.spvasm @@ -0,0 +1,860 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 548 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %map "map" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %ipos "ipos" + OpName %i "i" + OpName %p "p" + OpName %canwalk "canwalk" + OpName %v "v" + OpName %directions "directions" + OpName %j "j" + OpName %d "d" + OpName %x_104 "x_104" + OpName %x_124 "x_124" + OpName %x_144 "x_144" + OpName %x_164 "x_164" + OpName %x_105_phi "x_105_phi" + OpName %x_125_phi "x_125_phi" + OpName %x_145_phi "x_145_phi" + OpName %x_165_phi "x_165_phi" + OpName %x_229 "x_229" + OpName %x_242 "x_242" + OpName %x_281 "x_281" + OpName %x_288 "x_288" + OpName %x_289 "x_289" + OpName %x_295 "x_295" + OpName %x_296 "x_296" + OpName %x_303 "x_303" + OpName %x_304 "x_304" + OpName %x_315 "x_315" + OpName %x_316 "x_316" + OpName %x_359 "x_359" + OpName %x_372 "x_372" + OpName %x_411 "x_411" + OpName %x_424 "x_424" + OpName %x_230_phi "x_230_phi" + OpName %x_243_phi "x_243_phi" + OpName %x_282_phi "x_282_phi" + OpName %x_290_phi "x_290_phi" + OpName %x_297_phi "x_297_phi" + OpName %x_305_phi "x_305_phi" + OpName %x_317_phi "x_317_phi" + OpName %x_360_phi "x_360_phi" + OpName %x_373_phi "x_373_phi" + OpName %x_412_phi "x_412_phi" + OpName %x_425_phi "x_425_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Private__arr_int_uint_256 = OpTypePointer Private %_arr_int_uint_256 + %16 = OpConstantNull %_arr_int_uint_256 + %map = OpVariable %_ptr_Private__arr_int_uint_256 Private %16 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %28 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %32 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_16 = OpConstant %float 16 + %int_0 = OpConstant %int 0 + %int_256 = OpConstant %int 256 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %83 = OpConstantComposite %v2int %int_0 %int_0 + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %int_16 = OpConstant %int 16 + %int_14 = OpConstant %int 14 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %false = OpConstantFalse %bool + %int_8 = OpConstant %int 8 + %358 = OpConstantComposite %_arr_int_uint_256 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 + %float_1 = OpConstant %float 1 + %528 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %534 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %535 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %28 + %ipos = OpVariable %_ptr_Function_v2int Function %32 + %i = OpVariable %_ptr_Function_int Function %35 + %p = OpVariable %_ptr_Function_v2int Function %32 + %canwalk = OpVariable %_ptr_Function_bool Function %40 + %v = OpVariable %_ptr_Function_int Function %35 + %directions = OpVariable %_ptr_Function_int Function %35 + %j = OpVariable %_ptr_Function_int Function %35 + %d = OpVariable %_ptr_Function_int Function %35 + %x_104 = OpVariable %_ptr_Function_bool Function %40 + %x_124 = OpVariable %_ptr_Function_bool Function %40 + %x_144 = OpVariable %_ptr_Function_bool Function %40 + %x_164 = OpVariable %_ptr_Function_bool Function %40 + %x_105_phi = OpVariable %_ptr_Function_bool Function %40 + %x_125_phi = OpVariable %_ptr_Function_bool Function %40 + %x_145_phi = OpVariable %_ptr_Function_bool Function %40 + %x_165_phi = OpVariable %_ptr_Function_bool Function %40 + %x_229 = OpVariable %_ptr_Function_bool Function %40 + %x_242 = OpVariable %_ptr_Function_bool Function %40 + %x_281 = OpVariable %_ptr_Function_bool Function %40 + %x_288 = OpVariable %_ptr_Function_int Function %35 + %x_289 = OpVariable %_ptr_Function_int Function %35 + %x_295 = OpVariable %_ptr_Function_int Function %35 + %x_296 = OpVariable %_ptr_Function_int Function %35 + %x_303 = OpVariable %_ptr_Function__arr_int_uint_256 Function %16 + %x_304 = OpVariable %_ptr_Function__arr_int_uint_256 Function %16 + %x_315 = OpVariable %_ptr_Function_int Function %35 + %x_316 = OpVariable %_ptr_Function_int Function %35 + %x_359 = OpVariable %_ptr_Function_bool Function %40 + %x_372 = OpVariable %_ptr_Function_bool Function %40 + %x_411 = OpVariable %_ptr_Function_bool Function %40 + %x_424 = OpVariable %_ptr_Function_bool Function %40 + %x_230_phi = OpVariable %_ptr_Function_bool Function %40 + %x_243_phi = OpVariable %_ptr_Function_bool Function %40 + %x_282_phi = OpVariable %_ptr_Function_bool Function %40 + %x_290_phi = OpVariable %_ptr_Function_int Function %35 + %x_297_phi = OpVariable %_ptr_Function_int Function %35 + %x_305_phi = OpVariable %_ptr_Function__arr_int_uint_256 Function %16 + %x_317_phi = OpVariable %_ptr_Function_int Function %35 + %x_360_phi = OpVariable %_ptr_Function_bool Function %40 + %x_373_phi = OpVariable %_ptr_Function_bool Function %40 + %x_412_phi = OpVariable %_ptr_Function_bool Function %40 + %x_425_phi = OpVariable %_ptr_Function_bool Function %40 + %45 = OpLoad %v4float %gl_FragCoord + %48 = OpAccessChain %_ptr_Uniform_v2float %x_7 %uint_0 + %49 = OpLoad %v2float %48 + %50 = OpCompositeExtract %float %45 0 + %51 = OpCompositeExtract %float %45 1 + %52 = OpCompositeConstruct %v2float %50 %51 + %53 = OpFDiv %v2float %52 %49 + OpStore %pos %53 + %55 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %59 = OpLoad %float %58 + %62 = OpFMul %float %56 %float_16 + %60 = OpConvertFToS %int %62 + %64 = OpFMul %float %59 %float_16 + %63 = OpConvertFToS %int %64 + %65 = OpCompositeConstruct %v2int %60 %63 + OpStore %ipos %65 + OpStore %i %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %i + %73 = OpSLessThan %bool %71 %int_256 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %74 + %76 = OpLabel + OpBranch %68 + %74 = OpLabel + %77 = OpLoad %int %i + %79 = OpAccessChain %_ptr_Private_int %map %77 + OpStore %79 %int_0 + OpBranch %69 + %69 = OpLabel + %80 = OpLoad %int %i + %82 = OpIAdd %int %80 %int_1 + OpStore %i %82 + OpBranch %67 + %68 = OpLabel + OpStore %p %83 + OpStore %canwalk %true + OpStore %v %int_0 + OpBranch %85 + %85 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %97 = OpLoad %int %v + %98 = OpIAdd %int %97 %int_1 + OpStore %v %98 + OpStore %directions %int_0 + %99 = OpAccessChain %_ptr_Function_int %p %uint_0 + %100 = OpLoad %int %99 + %101 = OpSGreaterThan %bool %100 %int_0 + OpStore %x_105_phi %101 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + %104 = OpAccessChain %_ptr_Function_int %p %uint_0 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Function_int %p %uint_1 + %107 = OpLoad %int %106 + %109 = OpISub %int %105 %int_2 + %111 = OpIMul %int %107 %int_16 + %112 = OpIAdd %int %109 %111 + %113 = OpAccessChain %_ptr_Private_int %map %112 + %114 = OpLoad %int %113 + %115 = OpIEqual %bool %114 %int_0 + OpStore %x_104 %115 + %116 = OpLoad %bool %x_104 + OpStore %x_105_phi %116 + OpBranch %102 + %102 = OpLabel + %117 = OpLoad %bool %x_105_phi + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %120 = OpLoad %int %directions + %121 = OpIAdd %int %120 %int_1 + OpStore %directions %121 + OpBranch %118 + %118 = OpLabel + %122 = OpAccessChain %_ptr_Function_int %p %uint_1 + %123 = OpLoad %int %122 + %124 = OpSGreaterThan %bool %123 %int_0 + OpStore %x_125_phi %124 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %125 + %126 = OpLabel + %127 = OpAccessChain %_ptr_Function_int %p %uint_0 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Function_int %p %uint_1 + %130 = OpLoad %int %129 + %131 = OpISub %int %130 %int_2 + %132 = OpIMul %int %131 %int_16 + %133 = OpIAdd %int %128 %132 + %134 = OpAccessChain %_ptr_Private_int %map %133 + %135 = OpLoad %int %134 + %136 = OpIEqual %bool %135 %int_0 + OpStore %x_124 %136 + %137 = OpLoad %bool %x_124 + OpStore %x_125_phi %137 + OpBranch %125 + %125 = OpLabel + %138 = OpLoad %bool %x_125_phi + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpLoad %int %directions + %142 = OpIAdd %int %141 %int_1 + OpStore %directions %142 + OpBranch %139 + %139 = OpLabel + %143 = OpAccessChain %_ptr_Function_int %p %uint_0 + %144 = OpLoad %int %143 + %146 = OpSLessThan %bool %144 %int_14 + OpStore %x_145_phi %146 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %147 + %148 = OpLabel + %149 = OpAccessChain %_ptr_Function_int %p %uint_0 + %150 = OpLoad %int %149 + %151 = OpAccessChain %_ptr_Function_int %p %uint_1 + %152 = OpLoad %int %151 + %153 = OpIAdd %int %150 %int_2 + %154 = OpIMul %int %152 %int_16 + %155 = OpIAdd %int %153 %154 + %156 = OpAccessChain %_ptr_Private_int %map %155 + %157 = OpLoad %int %156 + %158 = OpIEqual %bool %157 %int_0 + OpStore %x_144 %158 + %159 = OpLoad %bool %x_144 + OpStore %x_145_phi %159 + OpBranch %147 + %147 = OpLabel + %160 = OpLoad %bool %x_145_phi + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %161 + %162 = OpLabel + %163 = OpLoad %int %directions + %164 = OpIAdd %int %163 %int_1 + OpStore %directions %164 + OpBranch %161 + %161 = OpLabel + %165 = OpAccessChain %_ptr_Function_int %p %uint_1 + %166 = OpLoad %int %165 + %167 = OpSLessThan %bool %166 %int_14 + OpStore %x_165_phi %167 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %168 + %169 = OpLabel + %170 = OpAccessChain %_ptr_Function_int %p %uint_0 + %171 = OpLoad %int %170 + %172 = OpAccessChain %_ptr_Function_int %p %uint_1 + %173 = OpLoad %int %172 + %174 = OpIAdd %int %173 %int_2 + %175 = OpIMul %int %174 %int_16 + %176 = OpIAdd %int %171 %175 + %177 = OpAccessChain %_ptr_Private_int %map %176 + %178 = OpLoad %int %177 + %179 = OpIEqual %bool %178 %int_0 + OpStore %x_164 %179 + %180 = OpLoad %bool %x_164 + OpStore %x_165_phi %180 + OpBranch %168 + %168 = OpLabel + %181 = OpLoad %bool %x_165_phi + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %184 = OpLoad %int %directions + %185 = OpIAdd %int %184 %int_1 + OpStore %directions %185 + OpBranch %182 + %182 = OpLabel + %213 = OpLoad %int %directions + %214 = OpIEqual %bool %213 %int_0 + OpSelectionMerge %215 None + OpBranchConditional %214 %216 %217 + %216 = OpLabel + OpStore %canwalk %false + OpStore %i %int_0 + OpBranch %219 + %219 = OpLabel + OpLoopMerge %220 %221 None + OpBranch %222 + %222 = OpLabel + %223 = OpLoad %int %i + %225 = OpSLessThan %bool %223 %int_8 + OpSelectionMerge %226 None + OpBranchConditional %225 %227 %228 + %227 = OpLabel + OpBranch %226 + %228 = OpLabel + OpBranch %220 + %226 = OpLabel + OpStore %j %int_0 + OpBranch %229 + %229 = OpLabel + OpLoopMerge %230 %231 None + OpBranch %232 + %232 = OpLabel + %233 = OpLoad %int %j + %234 = OpSLessThan %bool %233 %int_8 + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %237 + %236 = OpLabel + OpBranch %235 + %237 = OpLabel + OpBranch %230 + %235 = OpLabel + %238 = OpLoad %int %j + %239 = OpLoad %int %i + %240 = OpIMul %int %238 %int_2 + %241 = OpIMul %int %239 %int_2 + %242 = OpIMul %int %241 %int_16 + %243 = OpIAdd %int %240 %242 + %244 = OpAccessChain %_ptr_Private_int %map %243 + %245 = OpLoad %int %244 + %246 = OpIEqual %bool %245 %int_0 + OpSelectionMerge %247 None + OpBranchConditional %246 %248 %247 + %248 = OpLabel + %249 = OpLoad %int %j + %250 = OpAccessChain %_ptr_Function_int %p %uint_0 + %251 = OpIMul %int %249 %int_2 + OpStore %250 %251 + %252 = OpLoad %int %i + %253 = OpAccessChain %_ptr_Function_int %p %uint_1 + %254 = OpIMul %int %252 %int_2 + OpStore %253 %254 + OpStore %canwalk %true + OpBranch %247 + %247 = OpLabel + OpBranch %231 + %231 = OpLabel + %255 = OpLoad %int %j + %256 = OpIAdd %int %255 %int_1 + OpStore %j %256 + OpBranch %229 + %230 = OpLabel + OpBranch %221 + %221 = OpLabel + %257 = OpLoad %int %i + %258 = OpIAdd %int %257 %int_1 + OpStore %i %258 + OpBranch %219 + %220 = OpLabel + %259 = OpAccessChain %_ptr_Function_int %p %uint_0 + %260 = OpLoad %int %259 + %261 = OpAccessChain %_ptr_Function_int %p %uint_1 + %262 = OpLoad %int %261 + %263 = OpIMul %int %262 %int_16 + %264 = OpIAdd %int %260 %263 + %265 = OpAccessChain %_ptr_Private_int %map %264 + OpStore %265 %int_1 + OpBranch %215 + %217 = OpLabel + %266 = OpLoad %int %v + %267 = OpLoad %int %directions + %268 = OpSMod %int %266 %267 + OpStore %d %268 + %269 = OpLoad %int %directions + %270 = OpLoad %int %v + %271 = OpIAdd %int %270 %269 + OpStore %v %271 + %272 = OpLoad %int %d + %273 = OpSGreaterThanEqual %bool %272 %int_0 + OpStore %x_230_phi %273 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %274 + %275 = OpLabel + %276 = OpAccessChain %_ptr_Function_int %p %uint_0 + %277 = OpLoad %int %276 + %278 = OpSGreaterThan %bool %277 %int_0 + OpStore %x_229 %278 + %279 = OpLoad %bool %x_229 + OpStore %x_230_phi %279 + OpBranch %274 + %274 = OpLabel + %280 = OpLoad %bool %x_230_phi + OpStore %x_243_phi %280 + OpSelectionMerge %281 None + OpBranchConditional %280 %282 %281 + %282 = OpLabel + %283 = OpAccessChain %_ptr_Function_int %p %uint_0 + %284 = OpLoad %int %283 + %285 = OpAccessChain %_ptr_Function_int %p %uint_1 + %286 = OpLoad %int %285 + %287 = OpISub %int %284 %int_2 + %288 = OpIMul %int %286 %int_16 + %289 = OpIAdd %int %287 %288 + %290 = OpAccessChain %_ptr_Private_int %map %289 + %291 = OpLoad %int %290 + %292 = OpIEqual %bool %291 %int_0 + OpStore %x_242 %292 + %293 = OpLoad %bool %x_242 + OpStore %x_243_phi %293 + OpBranch %281 + %281 = OpLabel + %294 = OpLoad %bool %x_243_phi + OpSelectionMerge %295 None + OpBranchConditional %294 %296 %295 + %296 = OpLabel + %297 = OpLoad %int %d + %298 = OpISub %int %297 %int_1 + OpStore %d %298 + %299 = OpAccessChain %_ptr_Function_int %p %uint_0 + %300 = OpLoad %int %299 + %301 = OpAccessChain %_ptr_Function_int %p %uint_1 + %302 = OpLoad %int %301 + %303 = OpIMul %int %302 %int_16 + %304 = OpIAdd %int %300 %303 + %305 = OpAccessChain %_ptr_Private_int %map %304 + OpStore %305 %int_1 + %306 = OpAccessChain %_ptr_Function_int %p %uint_0 + %307 = OpLoad %int %306 + %308 = OpAccessChain %_ptr_Function_int %p %uint_1 + %309 = OpLoad %int %308 + %310 = OpISub %int %307 %int_1 + %311 = OpIMul %int %309 %int_16 + %312 = OpIAdd %int %310 %311 + %313 = OpAccessChain %_ptr_Private_int %map %312 + OpStore %313 %int_1 + %314 = OpAccessChain %_ptr_Function_int %p %uint_0 + %315 = OpLoad %int %314 + %316 = OpAccessChain %_ptr_Function_int %p %uint_1 + %317 = OpLoad %int %316 + %318 = OpISub %int %315 %int_2 + %319 = OpIMul %int %317 %int_16 + %320 = OpIAdd %int %318 %319 + %321 = OpAccessChain %_ptr_Private_int %map %320 + OpStore %321 %int_1 + %322 = OpAccessChain %_ptr_Function_int %p %uint_0 + %323 = OpLoad %int %322 + %324 = OpAccessChain %_ptr_Function_int %p %uint_0 + %325 = OpISub %int %323 %int_2 + OpStore %324 %325 + OpBranch %295 + %295 = OpLabel + %326 = OpLoad %int %d + %327 = OpSGreaterThanEqual %bool %326 %int_0 + OpStore %x_282_phi %327 + OpSelectionMerge %328 None + OpBranchConditional %327 %329 %328 + %329 = OpLabel + %330 = OpAccessChain %_ptr_Function_int %p %uint_1 + %331 = OpLoad %int %330 + %332 = OpSGreaterThan %bool %331 %int_0 + OpStore %x_281 %332 + %333 = OpLoad %bool %x_281 + OpStore %x_282_phi %333 + OpBranch %328 + %328 = OpLabel + %334 = OpLoad %bool %x_282_phi + OpSelectionMerge %335 None + OpBranchConditional %334 %336 %337 + %336 = OpLabel + %338 = OpAccessChain %_ptr_Function_int %p %uint_0 + %339 = OpLoad %int %338 + OpStore %x_288 %339 + %340 = OpLoad %int %x_288 + OpStore %x_290_phi %340 + OpBranch %335 + %337 = OpLabel + OpStore %x_289 %int_0 + %341 = OpLoad %int %x_289 + OpStore %x_290_phi %341 + OpBranch %335 + %335 = OpLabel + %342 = OpLoad %int %x_290_phi + OpSelectionMerge %343 None + OpBranchConditional %334 %344 %345 + %344 = OpLabel + %346 = OpAccessChain %_ptr_Function_int %p %uint_1 + %347 = OpLoad %int %346 + OpStore %x_295 %347 + %348 = OpLoad %int %x_295 + OpStore %x_297_phi %348 + OpBranch %343 + %345 = OpLabel + OpStore %x_296 %int_0 + %349 = OpLoad %int %x_296 + OpStore %x_297_phi %349 + OpBranch %343 + %343 = OpLabel + %350 = OpLoad %int %x_297_phi + %351 = OpISub %int %350 %int_2 + %352 = OpIMul %int %351 %int_16 + OpSelectionMerge %353 None + OpBranchConditional %334 %354 %355 + %354 = OpLabel + %356 = OpLoad %_arr_int_uint_256 %map + OpStore %x_303 %356 + %357 = OpLoad %_arr_int_uint_256 %x_303 + OpStore %x_305_phi %357 + OpBranch %353 + %355 = OpLabel + OpStore %x_304 %358 + %359 = OpLoad %_arr_int_uint_256 %x_304 + OpStore %x_305_phi %359 + OpBranch %353 + %353 = OpLabel + %360 = OpLoad %_arr_int_uint_256 %x_305_phi + OpSelectionMerge %361 None + OpBranchConditional %334 %362 %361 + %362 = OpLabel + OpStore %map %358 + OpBranch %361 + %361 = OpLabel + OpSelectionMerge %363 None + OpBranchConditional %334 %364 %363 + %364 = OpLabel + OpStore %map %360 + OpBranch %363 + %363 = OpLabel + OpSelectionMerge %365 None + OpBranchConditional %334 %366 %367 + %366 = OpLabel + %368 = OpIAdd %int %342 %352 + %369 = OpAccessChain %_ptr_Private_int %map %368 + %370 = OpLoad %int %369 + OpStore %x_315 %370 + %371 = OpLoad %int %x_315 + OpStore %x_317_phi %371 + OpBranch %365 + %367 = OpLabel + OpStore %x_316 %int_0 + %372 = OpLoad %int %x_316 + OpStore %x_317_phi %372 + OpBranch %365 + %365 = OpLabel + %373 = OpLoad %int %x_317_phi + %374 = OpIEqual %bool %373 %int_0 + %375 = OpSelect %bool %334 %374 %334 + OpSelectionMerge %376 None + OpBranchConditional %375 %377 %376 + %377 = OpLabel + %378 = OpLoad %int %d + %379 = OpISub %int %378 %int_1 + OpStore %d %379 + %380 = OpAccessChain %_ptr_Function_int %p %uint_0 + %381 = OpLoad %int %380 + %382 = OpAccessChain %_ptr_Function_int %p %uint_1 + %383 = OpLoad %int %382 + %384 = OpIMul %int %383 %int_16 + %385 = OpIAdd %int %381 %384 + %386 = OpAccessChain %_ptr_Private_int %map %385 + OpStore %386 %int_1 + %387 = OpAccessChain %_ptr_Function_int %p %uint_0 + %388 = OpLoad %int %387 + %389 = OpAccessChain %_ptr_Function_int %p %uint_1 + %390 = OpLoad %int %389 + %391 = OpISub %int %390 %int_1 + %392 = OpIMul %int %391 %int_16 + %393 = OpIAdd %int %388 %392 + %394 = OpAccessChain %_ptr_Private_int %map %393 + OpStore %394 %int_1 + %395 = OpAccessChain %_ptr_Function_int %p %uint_0 + %396 = OpLoad %int %395 + %397 = OpAccessChain %_ptr_Function_int %p %uint_1 + %398 = OpLoad %int %397 + %399 = OpLoad %_arr_int_uint_256 %map + OpStore %map %358 + OpStore %map %399 + %400 = OpISub %int %398 %int_2 + %401 = OpIMul %int %400 %int_16 + %402 = OpIAdd %int %396 %401 + %403 = OpAccessChain %_ptr_Private_int %map %402 + OpStore %403 %int_1 + %404 = OpAccessChain %_ptr_Function_int %p %uint_1 + %405 = OpLoad %int %404 + %406 = OpAccessChain %_ptr_Function_int %p %uint_1 + %407 = OpISub %int %405 %int_2 + OpStore %406 %407 + OpBranch %376 + %376 = OpLabel + %408 = OpLoad %int %d + %409 = OpSGreaterThanEqual %bool %408 %int_0 + OpStore %x_360_phi %409 + OpSelectionMerge %410 None + OpBranchConditional %409 %411 %410 + %411 = OpLabel + %412 = OpAccessChain %_ptr_Function_int %p %uint_0 + %413 = OpLoad %int %412 + %414 = OpSLessThan %bool %413 %int_14 + OpStore %x_359 %414 + %415 = OpLoad %bool %x_359 + OpStore %x_360_phi %415 + OpBranch %410 + %410 = OpLabel + %416 = OpLoad %bool %x_360_phi + OpStore %x_373_phi %416 + OpSelectionMerge %417 None + OpBranchConditional %416 %418 %417 + %418 = OpLabel + %419 = OpAccessChain %_ptr_Function_int %p %uint_0 + %420 = OpLoad %int %419 + %421 = OpAccessChain %_ptr_Function_int %p %uint_1 + %422 = OpLoad %int %421 + %423 = OpIAdd %int %420 %int_2 + %424 = OpIMul %int %422 %int_16 + %425 = OpIAdd %int %423 %424 + %426 = OpAccessChain %_ptr_Private_int %map %425 + %427 = OpLoad %int %426 + %428 = OpIEqual %bool %427 %int_0 + OpStore %x_372 %428 + %429 = OpLoad %bool %x_372 + OpStore %x_373_phi %429 + OpBranch %417 + %417 = OpLabel + %430 = OpLoad %bool %x_373_phi + OpSelectionMerge %431 None + OpBranchConditional %430 %432 %431 + %432 = OpLabel + %433 = OpLoad %int %d + %434 = OpISub %int %433 %int_1 + OpStore %d %434 + %435 = OpAccessChain %_ptr_Function_int %p %uint_0 + %436 = OpLoad %int %435 + %437 = OpAccessChain %_ptr_Function_int %p %uint_1 + %438 = OpLoad %int %437 + %439 = OpIMul %int %438 %int_16 + %440 = OpIAdd %int %436 %439 + %441 = OpAccessChain %_ptr_Private_int %map %440 + OpStore %441 %int_1 + %442 = OpAccessChain %_ptr_Function_int %p %uint_0 + %443 = OpLoad %int %442 + %444 = OpAccessChain %_ptr_Function_int %p %uint_1 + %445 = OpLoad %int %444 + %446 = OpIAdd %int %443 %int_1 + %447 = OpIMul %int %445 %int_16 + %448 = OpIAdd %int %446 %447 + %449 = OpAccessChain %_ptr_Private_int %map %448 + OpStore %449 %int_1 + %450 = OpAccessChain %_ptr_Function_int %p %uint_0 + %451 = OpLoad %int %450 + %452 = OpAccessChain %_ptr_Function_int %p %uint_1 + %453 = OpLoad %int %452 + %454 = OpIAdd %int %451 %int_2 + %455 = OpIMul %int %453 %int_16 + %456 = OpIAdd %int %454 %455 + %457 = OpAccessChain %_ptr_Private_int %map %456 + OpStore %457 %int_1 + %458 = OpAccessChain %_ptr_Function_int %p %uint_0 + %459 = OpLoad %int %458 + %460 = OpAccessChain %_ptr_Function_int %p %uint_0 + %461 = OpIAdd %int %459 %int_2 + OpStore %460 %461 + OpBranch %431 + %431 = OpLabel + %462 = OpLoad %int %d + %463 = OpSGreaterThanEqual %bool %462 %int_0 + OpStore %x_412_phi %463 + OpSelectionMerge %464 None + OpBranchConditional %463 %465 %464 + %465 = OpLabel + %466 = OpAccessChain %_ptr_Function_int %p %uint_1 + %467 = OpLoad %int %466 + %468 = OpSLessThan %bool %467 %int_14 + OpStore %x_411 %468 + %469 = OpLoad %bool %x_411 + OpStore %x_412_phi %469 + OpBranch %464 + %464 = OpLabel + %470 = OpLoad %bool %x_412_phi + OpStore %x_425_phi %470 + OpSelectionMerge %471 None + OpBranchConditional %470 %472 %471 + %472 = OpLabel + %473 = OpAccessChain %_ptr_Function_int %p %uint_0 + %474 = OpLoad %int %473 + %475 = OpAccessChain %_ptr_Function_int %p %uint_1 + %476 = OpLoad %int %475 + %477 = OpIAdd %int %476 %int_2 + %478 = OpIMul %int %477 %int_16 + %479 = OpIAdd %int %474 %478 + %480 = OpAccessChain %_ptr_Private_int %map %479 + %481 = OpLoad %int %480 + %482 = OpIEqual %bool %481 %int_0 + OpStore %x_424 %482 + %483 = OpLoad %bool %x_424 + OpStore %x_425_phi %483 + OpBranch %471 + %471 = OpLabel + %484 = OpLoad %bool %x_425_phi + OpSelectionMerge %485 None + OpBranchConditional %484 %486 %485 + %486 = OpLabel + %487 = OpLoad %int %d + %488 = OpISub %int %487 %int_1 + OpStore %d %488 + %489 = OpAccessChain %_ptr_Function_int %p %uint_0 + %490 = OpLoad %int %489 + %491 = OpAccessChain %_ptr_Function_int %p %uint_1 + %492 = OpLoad %int %491 + %493 = OpIMul %int %492 %int_16 + %494 = OpIAdd %int %490 %493 + %495 = OpAccessChain %_ptr_Private_int %map %494 + OpStore %495 %int_1 + %496 = OpAccessChain %_ptr_Function_int %p %uint_0 + %497 = OpLoad %int %496 + %498 = OpAccessChain %_ptr_Function_int %p %uint_1 + %499 = OpLoad %int %498 + %500 = OpIAdd %int %499 %int_1 + %501 = OpIMul %int %500 %int_16 + %502 = OpIAdd %int %497 %501 + %503 = OpAccessChain %_ptr_Private_int %map %502 + OpStore %503 %int_1 + %504 = OpAccessChain %_ptr_Function_int %p %uint_0 + %505 = OpLoad %int %504 + %506 = OpAccessChain %_ptr_Function_int %p %uint_1 + %507 = OpLoad %int %506 + %508 = OpIAdd %int %507 %int_2 + %509 = OpIMul %int %508 %int_16 + %510 = OpIAdd %int %505 %509 + %511 = OpAccessChain %_ptr_Private_int %map %510 + OpStore %511 %int_1 + %512 = OpAccessChain %_ptr_Function_int %p %uint_1 + %513 = OpLoad %int %512 + %514 = OpAccessChain %_ptr_Function_int %p %uint_1 + %515 = OpIAdd %int %513 %int_2 + OpStore %514 %515 + OpBranch %485 + %485 = OpLabel + OpBranch %215 + %215 = OpLabel + %516 = OpAccessChain %_ptr_Function_int %ipos %uint_1 + %517 = OpLoad %int %516 + %518 = OpAccessChain %_ptr_Function_int %ipos %uint_0 + %519 = OpLoad %int %518 + %520 = OpIMul %int %517 %int_16 + %521 = OpIAdd %int %520 %519 + %522 = OpAccessChain %_ptr_Private_int %map %521 + %523 = OpLoad %int %522 + %524 = OpIEqual %bool %523 %int_1 + OpSelectionMerge %525 None + OpBranchConditional %524 %526 %525 + %526 = OpLabel + OpStore %x_GLF_color %528 + OpReturn + %525 = OpLabel + OpBranch %87 + %87 = OpLabel + %529 = OpLoad %bool %canwalk + OpSelectionMerge %530 None + OpBranchConditional %529 %531 %532 + %531 = OpLabel + OpBranch %530 + %532 = OpLabel + OpBranch %86 + %530 = OpLabel + OpBranch %85 + %86 = OpLabel + OpStore %x_GLF_color %534 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %535 +%tint_symbol_1 = OpFunctionParameter %main_out + %539 = OpLabel + %540 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %540 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %542 = OpLabel + %543 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %543 + %544 = OpFunctionCall %void %main_1 + %546 = OpLoad %v4float %x_GLF_color + %547 = OpCompositeConstruct %main_out %546 + %545 = OpFunctionCall %void %tint_symbol_3 %547 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 87[%87] is not post dominated by the back-edge block 530[%530] + %530 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..76364260c1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.wgsl @@ -0,0 +1,392 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var map : array; + +var x_GLF_color : vec4; + +fn main_1() { + var pos : vec2; + var ipos : vec2; + var i : i32; + var p : vec2; + var canwalk : bool; + var v : i32; + var directions : i32; + var j : i32; + var d : i32; + let x_59 : vec4 = gl_FragCoord; + let x_62 : vec2 = x_7.resolution; + pos = (vec2(x_59.x, x_59.y) / x_62); + let x_65 : f32 = pos.x; + let x_69 : f32 = pos.y; + ipos = vec2(i32((x_65 * 16.0)), i32((x_69 * 16.0))); + i = 0; + loop { + let x_77 : i32 = i; + if ((x_77 < 256)) { + } else { + break; + } + let x_80 : i32 = i; + map[x_80] = 0; + + continuing { + let x_82 : i32 = i; + i = (x_82 + 1); + } + } + p = vec2(0, 0); + canwalk = true; + v = 0; + loop { + var x_104 : bool; + var x_124 : bool; + var x_144 : bool; + var x_164 : bool; + var x_105_phi : bool; + var x_125_phi : bool; + var x_145_phi : bool; + var x_165_phi : bool; + let x_88 : i32 = v; + v = (x_88 + 1); + directions = 0; + let x_91 : i32 = p.x; + let x_92 : bool = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + let x_96 : i32 = p.x; + let x_99 : i32 = p.y; + let x_103 : i32 = map[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + let x_105 : bool = x_105_phi; + if (x_105) { + let x_108 : i32 = directions; + directions = (x_108 + 1); + } + let x_111 : i32 = p.y; + let x_112 : bool = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + let x_116 : i32 = p.x; + let x_118 : i32 = p.y; + let x_123 : i32 = map[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + let x_125 : bool = x_125_phi; + if (x_125) { + let x_128 : i32 = directions; + directions = (x_128 + 1); + } + let x_131 : i32 = p.x; + let x_132 : bool = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + let x_136 : i32 = p.x; + let x_139 : i32 = p.y; + let x_143 : i32 = map[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + let x_145 : bool = x_145_phi; + if (x_145) { + let x_148 : i32 = directions; + directions = (x_148 + 1); + } + let x_151 : i32 = p.y; + let x_152 : bool = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + let x_156 : i32 = p.x; + let x_158 : i32 = p.y; + let x_163 : i32 = map[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + let x_165 : bool = x_165_phi; + if (x_165) { + let x_168 : i32 = directions; + directions = (x_168 + 1); + } + var x_229 : bool; + var x_242 : bool; + var x_281 : bool; + var x_288 : i32; + var x_289 : i32; + var x_295 : i32; + var x_296 : i32; + var x_303 : array; + var x_304 : array; + var x_315 : i32; + var x_316 : i32; + var x_359 : bool; + var x_372 : bool; + var x_411 : bool; + var x_424 : bool; + var x_230_phi : bool; + var x_243_phi : bool; + var x_282_phi : bool; + var x_290_phi : i32; + var x_297_phi : i32; + var x_305_phi : array; + var x_317_phi : i32; + var x_360_phi : bool; + var x_373_phi : bool; + var x_412_phi : bool; + var x_425_phi : bool; + let x_170 : i32 = directions; + if ((x_170 == 0)) { + canwalk = false; + i = 0; + loop { + let x_179 : i32 = i; + if ((x_179 < 8)) { + } else { + break; + } + j = 0; + loop { + let x_186 : i32 = j; + if ((x_186 < 8)) { + } else { + break; + } + let x_189 : i32 = j; + let x_191 : i32 = i; + let x_196 : i32 = map[((x_189 * 2) + ((x_191 * 2) * 16))]; + if ((x_196 == 0)) { + let x_200 : i32 = j; + p.x = (x_200 * 2); + let x_203 : i32 = i; + p.y = (x_203 * 2); + canwalk = true; + } + + continuing { + let x_206 : i32 = j; + j = (x_206 + 1); + } + } + + continuing { + let x_208 : i32 = i; + i = (x_208 + 1); + } + } + let x_211 : i32 = p.x; + let x_213 : i32 = p.y; + map[(x_211 + (x_213 * 16))] = 1; + } else { + let x_217 : i32 = v; + let x_218 : i32 = directions; + d = (x_217 % x_218); + let x_220 : i32 = directions; + let x_221 : i32 = v; + v = (x_221 + x_220); + let x_223 : i32 = d; + let x_224 : bool = (x_223 >= 0); + x_230_phi = x_224; + if (x_224) { + let x_228 : i32 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + let x_230 : bool = x_230_phi; + x_243_phi = x_230; + if (x_230) { + let x_234 : i32 = p.x; + let x_237 : i32 = p.y; + let x_241 : i32 = map[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + let x_243 : bool = x_243_phi; + if (x_243) { + let x_246 : i32 = d; + d = (x_246 - 1); + let x_249 : i32 = p.x; + let x_251 : i32 = p.y; + map[(x_249 + (x_251 * 16))] = 1; + let x_256 : i32 = p.x; + let x_259 : i32 = p.y; + map[((x_256 - 1) + (x_259 * 16))] = 1; + let x_264 : i32 = p.x; + let x_267 : i32 = p.y; + map[((x_264 - 2) + (x_267 * 16))] = 1; + let x_272 : i32 = p.x; + p.x = (x_272 - 2); + } + let x_275 : i32 = d; + let x_276 : bool = (x_275 >= 0); + x_282_phi = x_276; + if (x_276) { + let x_280 : i32 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + let x_282 : bool = x_282_phi; + if (x_282) { + x_288 = p.x; + x_290_phi = x_288; + } else { + x_289 = 0; + x_290_phi = x_289; + } + let x_290 : i32 = x_290_phi; + if (x_282) { + x_295 = p.y; + x_297_phi = x_295; + } else { + x_296 = 0; + x_297_phi = x_296; + } + let x_297 : i32 = x_297_phi; + let x_299 : i32 = ((x_297 - 2) * 16); + if (x_282) { + x_303 = map; + x_305_phi = x_303; + } else { + x_304 = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + x_305_phi = x_304; + } + let x_305 : array = x_305_phi; + if (x_282) { + map = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } + if (x_282) { + map = x_305; + } + if (x_282) { + x_315 = map[(x_290 + x_299)]; + x_317_phi = x_315; + } else { + x_316 = 0; + x_317_phi = x_316; + } + let x_317 : i32 = x_317_phi; + let x_318 : bool = (x_317 == 0); + if (select(x_282, x_318, x_282)) { + let x_323 : i32 = d; + d = (x_323 - 1); + let x_326 : i32 = p.x; + let x_328 : i32 = p.y; + map[(x_326 + (x_328 * 16))] = 1; + let x_333 : i32 = p.x; + let x_335 : i32 = p.y; + map[(x_333 + ((x_335 - 1) * 16))] = 1; + let x_341 : i32 = p.x; + let x_343 : i32 = p.y; + let x_345 : array = map; + map = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + map = x_345; + map[(x_341 + ((x_343 - 2) * 16))] = 1; + let x_350 : i32 = p.y; + p.y = (x_350 - 2); + } + let x_353 : i32 = d; + let x_354 : bool = (x_353 >= 0); + x_360_phi = x_354; + if (x_354) { + let x_358 : i32 = p.x; + x_359 = (x_358 < 14); + x_360_phi = x_359; + } + let x_360 : bool = x_360_phi; + x_373_phi = x_360; + if (x_360) { + let x_364 : i32 = p.x; + let x_367 : i32 = p.y; + let x_371 : i32 = map[((x_364 + 2) + (x_367 * 16))]; + x_372 = (x_371 == 0); + x_373_phi = x_372; + } + let x_373 : bool = x_373_phi; + if (x_373) { + let x_376 : i32 = d; + d = (x_376 - 1); + let x_379 : i32 = p.x; + let x_381 : i32 = p.y; + map[(x_379 + (x_381 * 16))] = 1; + let x_386 : i32 = p.x; + let x_389 : i32 = p.y; + map[((x_386 + 1) + (x_389 * 16))] = 1; + let x_394 : i32 = p.x; + let x_397 : i32 = p.y; + map[((x_394 + 2) + (x_397 * 16))] = 1; + let x_402 : i32 = p.x; + p.x = (x_402 + 2); + } + let x_405 : i32 = d; + let x_406 : bool = (x_405 >= 0); + x_412_phi = x_406; + if (x_406) { + let x_410 : i32 = p.y; + x_411 = (x_410 < 14); + x_412_phi = x_411; + } + let x_412 : bool = x_412_phi; + x_425_phi = x_412; + if (x_412) { + let x_416 : i32 = p.x; + let x_418 : i32 = p.y; + let x_423 : i32 = map[(x_416 + ((x_418 + 2) * 16))]; + x_424 = (x_423 == 0); + x_425_phi = x_424; + } + let x_425 : bool = x_425_phi; + if (x_425) { + let x_428 : i32 = d; + d = (x_428 - 1); + let x_431 : i32 = p.x; + let x_433 : i32 = p.y; + map[(x_431 + (x_433 * 16))] = 1; + let x_438 : i32 = p.x; + let x_440 : i32 = p.y; + map[(x_438 + ((x_440 + 1) * 16))] = 1; + let x_446 : i32 = p.x; + let x_448 : i32 = p.y; + map[(x_446 + ((x_448 + 2) * 16))] = 1; + let x_454 : i32 = p.y; + p.y = (x_454 + 2); + } + } + let x_458 : i32 = ipos.y; + let x_461 : i32 = ipos.x; + let x_464 : i32 = map[((x_458 * 16) + x_461)]; + if ((x_464 == 1)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + return; + } + + continuing { + let x_468 : bool = canwalk; + if (x_468) { + } else { + break; + } + } + } + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm new file mode 100644 index 0000000000..189e3fb3d2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm @@ -0,0 +1,617 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %pos "pos" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %ipos "ipos" + OpName %i "i" + OpName %map "map" + OpName %p "p" + OpName %canwalk "canwalk" + OpName %v "v" + OpName %directions "directions" + OpName %j "j" + OpName %d "d" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_16 = OpConstant %float 16 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %bool = OpTypeBool + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Private__arr_int_uint_256 = OpTypePointer Private %_arr_int_uint_256 + %map = OpVariable %_ptr_Private__arr_int_uint_256 Private +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %43 = OpConstantComposite %v2int %int_0 %int_0 +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %int_16 = OpConstant %int 16 + %int_14 = OpConstant %int 14 + %false = OpConstantFalse %bool + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %53 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %55 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %int_0_0 = OpConstant %int 0 + %57 = OpConstantComposite %_arr_int_uint_256 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 + %main = OpFunction %void None %18 + %58 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function + %ipos = OpVariable %_ptr_Function_v2int Function + %i = OpVariable %_ptr_Function_int Function + %p = OpVariable %_ptr_Function_v2int Function + %canwalk = OpVariable %_ptr_Function_bool Function + %v = OpVariable %_ptr_Function_int Function + %directions = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %d = OpVariable %_ptr_Function_int Function + %59 = OpLoad %v4float %gl_FragCoord + %60 = OpVectorShuffle %v2float %59 %59 0 1 + %61 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %62 = OpLoad %v2float %61 + %63 = OpFDiv %v2float %60 %62 + OpStore %pos %63 + %64 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %65 = OpLoad %float %64 + %66 = OpFMul %float %65 %float_16 + %67 = OpConvertFToS %int %66 + %68 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %69 = OpLoad %float %68 + %70 = OpFMul %float %69 %float_16 + %71 = OpConvertFToS %int %70 + %72 = OpCompositeConstruct %v2int %67 %71 + OpStore %ipos %72 + OpStore %i %int_0 + OpBranch %73 + %73 = OpLabel + OpLoopMerge %74 %75 None + OpBranch %76 + %76 = OpLabel + %77 = OpLoad %int %i + %78 = OpSLessThan %bool %77 %int_256 + OpBranchConditional %78 %79 %74 + %79 = OpLabel + %80 = OpLoad %int %i + %81 = OpAccessChain %_ptr_Private_int %map %80 + OpStore %81 %int_0 + OpBranch %75 + %75 = OpLabel + %82 = OpLoad %int %i + %83 = OpIAdd %int %82 %int_1 + OpStore %i %83 + OpBranch %73 + %74 = OpLabel + OpStore %p %43 + OpStore %canwalk %true + OpStore %v %int_0 + OpBranch %84 + %84 = OpLabel + OpLoopMerge %85 %86 None + OpBranch %87 + %87 = OpLabel + %88 = OpLoad %int %v + %89 = OpIAdd %int %88 %int_1 + OpStore %v %89 + OpStore %directions %int_0 + %90 = OpAccessChain %_ptr_Function_int %p %uint_0 + %91 = OpLoad %int %90 + %92 = OpSGreaterThan %bool %91 %int_0 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + %95 = OpAccessChain %_ptr_Function_int %p %uint_0 + %96 = OpLoad %int %95 + %97 = OpISub %int %96 %int_2 + %98 = OpAccessChain %_ptr_Function_int %p %uint_1 + %99 = OpLoad %int %98 + %100 = OpIMul %int %99 %int_16 + %101 = OpIAdd %int %97 %100 + %102 = OpAccessChain %_ptr_Private_int %map %101 + %103 = OpLoad %int %102 + %104 = OpIEqual %bool %103 %int_0 + OpBranch %93 + %93 = OpLabel + %105 = OpPhi %bool %92 %87 %104 %94 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + %108 = OpLoad %int %directions + %109 = OpIAdd %int %108 %int_1 + OpStore %directions %109 + OpBranch %106 + %106 = OpLabel + %110 = OpAccessChain %_ptr_Function_int %p %uint_1 + %111 = OpLoad %int %110 + %112 = OpSGreaterThan %bool %111 %int_0 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + %115 = OpAccessChain %_ptr_Function_int %p %uint_0 + %116 = OpLoad %int %115 + %117 = OpAccessChain %_ptr_Function_int %p %uint_1 + %118 = OpLoad %int %117 + %119 = OpISub %int %118 %int_2 + %120 = OpIMul %int %119 %int_16 + %121 = OpIAdd %int %116 %120 + %122 = OpAccessChain %_ptr_Private_int %map %121 + %123 = OpLoad %int %122 + %124 = OpIEqual %bool %123 %int_0 + OpBranch %113 + %113 = OpLabel + %125 = OpPhi %bool %112 %106 %124 %114 + OpSelectionMerge %126 None + OpBranchConditional %125 %127 %126 + %127 = OpLabel + %128 = OpLoad %int %directions + %129 = OpIAdd %int %128 %int_1 + OpStore %directions %129 + OpBranch %126 + %126 = OpLabel + %130 = OpAccessChain %_ptr_Function_int %p %uint_0 + %131 = OpLoad %int %130 + %132 = OpSLessThan %bool %131 %int_14 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %133 + %134 = OpLabel + %135 = OpAccessChain %_ptr_Function_int %p %uint_0 + %136 = OpLoad %int %135 + %137 = OpIAdd %int %136 %int_2 + %138 = OpAccessChain %_ptr_Function_int %p %uint_1 + %139 = OpLoad %int %138 + %140 = OpIMul %int %139 %int_16 + %141 = OpIAdd %int %137 %140 + %142 = OpAccessChain %_ptr_Private_int %map %141 + %143 = OpLoad %int %142 + %144 = OpIEqual %bool %143 %int_0 + OpBranch %133 + %133 = OpLabel + %145 = OpPhi %bool %132 %126 %144 %134 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %148 = OpLoad %int %directions + %149 = OpIAdd %int %148 %int_1 + OpStore %directions %149 + OpBranch %146 + %146 = OpLabel + %150 = OpAccessChain %_ptr_Function_int %p %uint_1 + %151 = OpLoad %int %150 + %152 = OpSLessThan %bool %151 %int_14 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + %155 = OpAccessChain %_ptr_Function_int %p %uint_0 + %156 = OpLoad %int %155 + %157 = OpAccessChain %_ptr_Function_int %p %uint_1 + %158 = OpLoad %int %157 + %159 = OpIAdd %int %158 %int_2 + %160 = OpIMul %int %159 %int_16 + %161 = OpIAdd %int %156 %160 + %162 = OpAccessChain %_ptr_Private_int %map %161 + %163 = OpLoad %int %162 + %164 = OpIEqual %bool %163 %int_0 + OpBranch %153 + %153 = OpLabel + %165 = OpPhi %bool %152 %146 %164 %154 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %166 + %167 = OpLabel + %168 = OpLoad %int %directions + %169 = OpIAdd %int %168 %int_1 + OpStore %directions %169 + OpBranch %166 + %166 = OpLabel + %170 = OpLoad %int %directions + %171 = OpIEqual %bool %170 %int_0 + OpSelectionMerge %172 None + OpBranchConditional %171 %173 %174 + %173 = OpLabel + OpStore %canwalk %false + OpStore %i %int_0 + OpBranch %175 + %175 = OpLabel + OpLoopMerge %176 %177 None + OpBranch %178 + %178 = OpLabel + %179 = OpLoad %int %i + %180 = OpSLessThan %bool %179 %int_8 + OpBranchConditional %180 %181 %176 + %181 = OpLabel + OpStore %j %int_0 + OpBranch %182 + %182 = OpLabel + OpLoopMerge %183 %184 None + OpBranch %185 + %185 = OpLabel + %186 = OpLoad %int %j + %187 = OpSLessThan %bool %186 %int_8 + OpBranchConditional %187 %188 %183 + %188 = OpLabel + %189 = OpLoad %int %j + %190 = OpIMul %int %189 %int_2 + %191 = OpLoad %int %i + %192 = OpIMul %int %191 %int_2 + %193 = OpIMul %int %192 %int_16 + %194 = OpIAdd %int %190 %193 + %195 = OpAccessChain %_ptr_Private_int %map %194 + %196 = OpLoad %int %195 + %197 = OpIEqual %bool %196 %int_0 + OpSelectionMerge %198 None + OpBranchConditional %197 %199 %198 + %199 = OpLabel + %200 = OpLoad %int %j + %201 = OpIMul %int %200 %int_2 + %202 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %202 %201 + %203 = OpLoad %int %i + %204 = OpIMul %int %203 %int_2 + %205 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %205 %204 + OpStore %canwalk %true + OpBranch %198 + %198 = OpLabel + OpBranch %184 + %184 = OpLabel + %206 = OpLoad %int %j + %207 = OpIAdd %int %206 %int_1 + OpStore %j %207 + OpBranch %182 + %183 = OpLabel + OpBranch %177 + %177 = OpLabel + %208 = OpLoad %int %i + %209 = OpIAdd %int %208 %int_1 + OpStore %i %209 + OpBranch %175 + %176 = OpLabel + %210 = OpAccessChain %_ptr_Function_int %p %uint_0 + %211 = OpLoad %int %210 + %212 = OpAccessChain %_ptr_Function_int %p %uint_1 + %213 = OpLoad %int %212 + %214 = OpIMul %int %213 %int_16 + %215 = OpIAdd %int %211 %214 + %216 = OpAccessChain %_ptr_Private_int %map %215 + OpStore %216 %int_1 + OpBranch %172 + %174 = OpLabel + %217 = OpLoad %int %v + %218 = OpLoad %int %directions + %219 = OpSMod %int %217 %218 + OpStore %d %219 + %220 = OpLoad %int %directions + %221 = OpLoad %int %v + %222 = OpIAdd %int %221 %220 + OpStore %v %222 + %223 = OpLoad %int %d + %224 = OpSGreaterThanEqual %bool %223 %int_0 + OpSelectionMerge %225 None + OpBranchConditional %224 %226 %225 + %226 = OpLabel + %227 = OpAccessChain %_ptr_Function_int %p %uint_0 + %228 = OpLoad %int %227 + %229 = OpSGreaterThan %bool %228 %int_0 + OpBranch %225 + %225 = OpLabel + %230 = OpPhi %bool %224 %174 %229 %226 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %231 + %232 = OpLabel + %233 = OpAccessChain %_ptr_Function_int %p %uint_0 + %234 = OpLoad %int %233 + %235 = OpISub %int %234 %int_2 + %236 = OpAccessChain %_ptr_Function_int %p %uint_1 + %237 = OpLoad %int %236 + %238 = OpIMul %int %237 %int_16 + %239 = OpIAdd %int %235 %238 + %240 = OpAccessChain %_ptr_Private_int %map %239 + %241 = OpLoad %int %240 + %242 = OpIEqual %bool %241 %int_0 + OpBranch %231 + %231 = OpLabel + %243 = OpPhi %bool %230 %225 %242 %232 + OpSelectionMerge %244 None + OpBranchConditional %243 %245 %244 + %245 = OpLabel + %246 = OpLoad %int %d + %247 = OpISub %int %246 %int_1 + OpStore %d %247 + %248 = OpAccessChain %_ptr_Function_int %p %uint_0 + %249 = OpLoad %int %248 + %250 = OpAccessChain %_ptr_Function_int %p %uint_1 + %251 = OpLoad %int %250 + %252 = OpIMul %int %251 %int_16 + %253 = OpIAdd %int %249 %252 + %254 = OpAccessChain %_ptr_Private_int %map %253 + OpStore %254 %int_1 + %255 = OpAccessChain %_ptr_Function_int %p %uint_0 + %256 = OpLoad %int %255 + %257 = OpISub %int %256 %int_1 + %258 = OpAccessChain %_ptr_Function_int %p %uint_1 + %259 = OpLoad %int %258 + %260 = OpIMul %int %259 %int_16 + %261 = OpIAdd %int %257 %260 + %262 = OpAccessChain %_ptr_Private_int %map %261 + OpStore %262 %int_1 + %263 = OpAccessChain %_ptr_Function_int %p %uint_0 + %264 = OpLoad %int %263 + %265 = OpISub %int %264 %int_2 + %266 = OpAccessChain %_ptr_Function_int %p %uint_1 + %267 = OpLoad %int %266 + %268 = OpIMul %int %267 %int_16 + %269 = OpIAdd %int %265 %268 + %270 = OpAccessChain %_ptr_Private_int %map %269 + OpStore %270 %int_1 + %271 = OpAccessChain %_ptr_Function_int %p %uint_0 + %272 = OpLoad %int %271 + %273 = OpISub %int %272 %int_2 + %274 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %274 %273 + OpBranch %244 + %244 = OpLabel + %275 = OpLoad %int %d + %276 = OpSGreaterThanEqual %bool %275 %int_0 + OpSelectionMerge %277 None + OpBranchConditional %276 %278 %277 + %278 = OpLabel + %279 = OpAccessChain %_ptr_Function_int %p %uint_1 + %280 = OpLoad %int %279 + %281 = OpSGreaterThan %bool %280 %int_0 + OpBranch %277 + %277 = OpLabel + %282 = OpPhi %bool %276 %244 %281 %278 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %283 + %284 = OpLabel + %285 = OpAccessChain %_ptr_Function_int %p %uint_0 + %286 = OpLoad %int %285 + %287 = OpAccessChain %_ptr_Function_int %p %uint_1 + %288 = OpLoad %int %287 + %289 = OpISub %int %288 %int_2 + %290 = OpIMul %int %289 %int_16 + %291 = OpLoad %_arr_int_uint_256 %map + OpStore %map %57 + OpStore %map %291 + %292 = OpIAdd %int %286 %290 + %293 = OpAccessChain %_ptr_Private_int %map %292 + %294 = OpLoad %int %293 + %295 = OpIEqual %bool %294 %int_0 + OpBranch %283 + %283 = OpLabel + %296 = OpPhi %bool %282 %277 %295 %284 + OpSelectionMerge %297 None + OpBranchConditional %296 %298 %297 + %298 = OpLabel + %299 = OpLoad %int %d + %300 = OpISub %int %299 %int_1 + OpStore %d %300 + %301 = OpAccessChain %_ptr_Function_int %p %uint_0 + %302 = OpLoad %int %301 + %303 = OpAccessChain %_ptr_Function_int %p %uint_1 + %304 = OpLoad %int %303 + %305 = OpIMul %int %304 %int_16 + %306 = OpIAdd %int %302 %305 + %307 = OpAccessChain %_ptr_Private_int %map %306 + OpStore %307 %int_1 + %308 = OpAccessChain %_ptr_Function_int %p %uint_0 + %309 = OpLoad %int %308 + %310 = OpAccessChain %_ptr_Function_int %p %uint_1 + %311 = OpLoad %int %310 + %312 = OpISub %int %311 %int_1 + %313 = OpIMul %int %312 %int_16 + %314 = OpIAdd %int %309 %313 + %315 = OpAccessChain %_ptr_Private_int %map %314 + OpStore %315 %int_1 + %316 = OpAccessChain %_ptr_Function_int %p %uint_0 + %317 = OpLoad %int %316 + %318 = OpAccessChain %_ptr_Function_int %p %uint_1 + %319 = OpLoad %int %318 + %320 = OpISub %int %319 %int_2 + %321 = OpLoad %_arr_int_uint_256 %map + OpStore %map %57 + OpStore %map %321 + %322 = OpIMul %int %320 %int_16 + %323 = OpIAdd %int %317 %322 + %324 = OpAccessChain %_ptr_Private_int %map %323 + OpStore %324 %int_1 + %325 = OpAccessChain %_ptr_Function_int %p %uint_1 + %326 = OpLoad %int %325 + %327 = OpISub %int %326 %int_2 + %328 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %328 %327 + OpBranch %297 + %297 = OpLabel + %329 = OpLoad %int %d + %330 = OpSGreaterThanEqual %bool %329 %int_0 + OpSelectionMerge %331 None + OpBranchConditional %330 %332 %331 + %332 = OpLabel + %333 = OpAccessChain %_ptr_Function_int %p %uint_0 + %334 = OpLoad %int %333 + %335 = OpSLessThan %bool %334 %int_14 + OpBranch %331 + %331 = OpLabel + %336 = OpPhi %bool %330 %297 %335 %332 + OpSelectionMerge %337 None + OpBranchConditional %336 %338 %337 + %338 = OpLabel + %339 = OpAccessChain %_ptr_Function_int %p %uint_0 + %340 = OpLoad %int %339 + %341 = OpIAdd %int %340 %int_2 + %342 = OpAccessChain %_ptr_Function_int %p %uint_1 + %343 = OpLoad %int %342 + %344 = OpIMul %int %343 %int_16 + %345 = OpIAdd %int %341 %344 + %346 = OpAccessChain %_ptr_Private_int %map %345 + %347 = OpLoad %int %346 + %348 = OpIEqual %bool %347 %int_0 + OpBranch %337 + %337 = OpLabel + %349 = OpPhi %bool %336 %331 %348 %338 + OpSelectionMerge %350 None + OpBranchConditional %349 %351 %350 + %351 = OpLabel + %352 = OpLoad %int %d + %353 = OpISub %int %352 %int_1 + OpStore %d %353 + %354 = OpAccessChain %_ptr_Function_int %p %uint_0 + %355 = OpLoad %int %354 + %356 = OpAccessChain %_ptr_Function_int %p %uint_1 + %357 = OpLoad %int %356 + %358 = OpIMul %int %357 %int_16 + %359 = OpIAdd %int %355 %358 + %360 = OpAccessChain %_ptr_Private_int %map %359 + OpStore %360 %int_1 + %361 = OpAccessChain %_ptr_Function_int %p %uint_0 + %362 = OpLoad %int %361 + %363 = OpIAdd %int %362 %int_1 + %364 = OpAccessChain %_ptr_Function_int %p %uint_1 + %365 = OpLoad %int %364 + %366 = OpIMul %int %365 %int_16 + %367 = OpIAdd %int %363 %366 + %368 = OpAccessChain %_ptr_Private_int %map %367 + OpStore %368 %int_1 + %369 = OpAccessChain %_ptr_Function_int %p %uint_0 + %370 = OpLoad %int %369 + %371 = OpIAdd %int %370 %int_2 + %372 = OpAccessChain %_ptr_Function_int %p %uint_1 + %373 = OpLoad %int %372 + %374 = OpIMul %int %373 %int_16 + %375 = OpIAdd %int %371 %374 + %376 = OpAccessChain %_ptr_Private_int %map %375 + OpStore %376 %int_1 + %377 = OpAccessChain %_ptr_Function_int %p %uint_0 + %378 = OpLoad %int %377 + %379 = OpIAdd %int %378 %int_2 + %380 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %380 %379 + OpBranch %350 + %350 = OpLabel + %381 = OpLoad %int %d + %382 = OpSGreaterThanEqual %bool %381 %int_0 + OpSelectionMerge %383 None + OpBranchConditional %382 %384 %383 + %384 = OpLabel + %385 = OpAccessChain %_ptr_Function_int %p %uint_1 + %386 = OpLoad %int %385 + %387 = OpSLessThan %bool %386 %int_14 + OpBranch %383 + %383 = OpLabel + %388 = OpPhi %bool %382 %350 %387 %384 + OpSelectionMerge %389 None + OpBranchConditional %388 %390 %389 + %390 = OpLabel + %391 = OpAccessChain %_ptr_Function_int %p %uint_0 + %392 = OpLoad %int %391 + %393 = OpAccessChain %_ptr_Function_int %p %uint_1 + %394 = OpLoad %int %393 + %395 = OpIAdd %int %394 %int_2 + %396 = OpIMul %int %395 %int_16 + %397 = OpIAdd %int %392 %396 + %398 = OpAccessChain %_ptr_Private_int %map %397 + %399 = OpLoad %int %398 + %400 = OpIEqual %bool %399 %int_0 + OpBranch %389 + %389 = OpLabel + %401 = OpPhi %bool %388 %383 %400 %390 + OpSelectionMerge %402 None + OpBranchConditional %401 %403 %402 + %403 = OpLabel + %404 = OpLoad %int %d + %405 = OpISub %int %404 %int_1 + OpStore %d %405 + %406 = OpAccessChain %_ptr_Function_int %p %uint_0 + %407 = OpLoad %int %406 + %408 = OpAccessChain %_ptr_Function_int %p %uint_1 + %409 = OpLoad %int %408 + %410 = OpIMul %int %409 %int_16 + %411 = OpIAdd %int %407 %410 + %412 = OpAccessChain %_ptr_Private_int %map %411 + OpStore %412 %int_1 + %413 = OpAccessChain %_ptr_Function_int %p %uint_0 + %414 = OpLoad %int %413 + %415 = OpAccessChain %_ptr_Function_int %p %uint_1 + %416 = OpLoad %int %415 + %417 = OpIAdd %int %416 %int_1 + %418 = OpIMul %int %417 %int_16 + %419 = OpIAdd %int %414 %418 + %420 = OpAccessChain %_ptr_Private_int %map %419 + OpStore %420 %int_1 + %421 = OpAccessChain %_ptr_Function_int %p %uint_0 + %422 = OpLoad %int %421 + %423 = OpAccessChain %_ptr_Function_int %p %uint_1 + %424 = OpLoad %int %423 + %425 = OpIAdd %int %424 %int_2 + %426 = OpIMul %int %425 %int_16 + %427 = OpIAdd %int %422 %426 + %428 = OpAccessChain %_ptr_Private_int %map %427 + OpStore %428 %int_1 + %429 = OpAccessChain %_ptr_Function_int %p %uint_1 + %430 = OpLoad %int %429 + %431 = OpIAdd %int %430 %int_2 + %432 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %432 %431 + OpBranch %402 + %402 = OpLabel + OpBranch %172 + %172 = OpLabel + %433 = OpAccessChain %_ptr_Function_int %ipos %uint_1 + %434 = OpLoad %int %433 + %435 = OpIMul %int %434 %int_16 + %436 = OpAccessChain %_ptr_Function_int %ipos %uint_0 + %437 = OpLoad %int %436 + %438 = OpIAdd %int %435 %437 + %439 = OpAccessChain %_ptr_Private_int %map %438 + %440 = OpLoad %int %439 + %441 = OpIEqual %bool %440 %int_1 + OpSelectionMerge %442 None + OpBranchConditional %441 %443 %442 + %443 = OpLabel + OpStore %_GLF_color %53 + OpReturn + %442 = OpLabel + OpBranch %86 + %86 = OpLabel + %444 = OpLoad %bool %canwalk + OpBranchConditional %444 %84 %85 + %85 = OpLabel + OpStore %_GLF_color %55 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.hlsl new file mode 100644 index 0000000000..cfe3abd180 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.hlsl @@ -0,0 +1,300 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static int map[256] = (int[256])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int i = 0; + int2 p = int2(0, 0); + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + const float4 x_59 = gl_FragCoord; + const float2 x_62 = asfloat(x_7[0].xy); + pos = (float2(x_59.x, x_59.y) / x_62); + const float x_65 = pos.x; + const float x_69 = pos.y; + ipos = int2(int((x_65 * 16.0f)), int((x_69 * 16.0f))); + i = 0; + { + for(; (i < 256); i = (i + 1)) { + map[i] = 0; + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_104 = false; + bool x_124 = false; + bool x_144 = false; + bool x_164 = false; + bool x_105_phi = false; + bool x_125_phi = false; + bool x_145_phi = false; + bool x_165_phi = false; + v = (v + 1); + directions = 0; + const int x_91 = p.x; + const bool x_92 = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + const int x_96 = p.x; + const int x_99 = p.y; + const int x_103 = map[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + if (x_105_phi) { + directions = (directions + 1); + } + const int x_111 = p.y; + const bool x_112 = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + const int x_116 = p.x; + const int x_118 = p.y; + const int x_123 = map[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + if (x_125_phi) { + directions = (directions + 1); + } + const int x_131 = p.x; + const bool x_132 = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + const int x_136 = p.x; + const int x_139 = p.y; + const int x_143 = map[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + if (x_145_phi) { + directions = (directions + 1); + } + const int x_151 = p.y; + const bool x_152 = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + const int x_156 = p.x; + const int x_158 = p.y; + const int x_163 = map[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + if (x_165_phi) { + directions = (directions + 1); + } + bool x_229 = false; + bool x_242 = false; + bool x_281 = false; + bool x_295 = false; + bool x_335 = false; + bool x_348 = false; + bool x_387 = false; + bool x_400 = false; + bool x_230_phi = false; + bool x_243_phi = false; + bool x_282_phi = false; + bool x_296_phi = false; + bool x_336_phi = false; + bool x_349_phi = false; + bool x_388_phi = false; + bool x_401_phi = false; + if ((directions == 0)) { + canwalk = false; + i = 0; + { + for(; (i < 8); i = (i + 1)) { + j = 0; + { + for(; (j < 8); j = (j + 1)) { + const int x_196 = map[((j * 2) + ((i * 2) * 16))]; + if ((x_196 == 0)) { + p.x = (j * 2); + p.y = (i * 2); + canwalk = true; + } + } + } + } + } + const int x_211 = p.x; + const int x_213 = p.y; + map[(x_211 + (x_213 * 16))] = 1; + } else { + d = (v % directions); + v = (v + directions); + const bool x_224 = (d >= 0); + x_230_phi = x_224; + if (x_224) { + const int x_228 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + const bool x_230 = x_230_phi; + x_243_phi = x_230; + if (x_230) { + const int x_234 = p.x; + const int x_237 = p.y; + const int x_241 = map[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + if (x_243_phi) { + d = (d - 1); + const int x_249 = p.x; + const int x_251 = p.y; + map[(x_249 + (x_251 * 16))] = 1; + const int x_256 = p.x; + const int x_259 = p.y; + map[((x_256 - 1) + (x_259 * 16))] = 1; + const int x_264 = p.x; + const int x_267 = p.y; + map[((x_264 - 2) + (x_267 * 16))] = 1; + const int x_272 = p.x; + p.x = (x_272 - 2); + } + const bool x_276 = (d >= 0); + x_282_phi = x_276; + if (x_276) { + const int x_280 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + const bool x_282 = x_282_phi; + x_296_phi = x_282; + if (x_282) { + const int x_286 = p.x; + const int x_288 = p.y; + const int x_291[256] = map; + const int tint_symbol_5[256] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + map = tint_symbol_5; + map = x_291; + const int x_294 = map[(x_286 + ((x_288 - 2) * 16))]; + x_295 = (x_294 == 0); + x_296_phi = x_295; + } + if (x_296_phi) { + d = (d - 1); + const int x_302 = p.x; + const int x_304 = p.y; + map[(x_302 + (x_304 * 16))] = 1; + const int x_309 = p.x; + const int x_311 = p.y; + map[(x_309 + ((x_311 - 1) * 16))] = 1; + const int x_317 = p.x; + const int x_319 = p.y; + const int x_321[256] = map; + const int tint_symbol_6[256] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + map = tint_symbol_6; + map = x_321; + map[(x_317 + ((x_319 - 2) * 16))] = 1; + const int x_326 = p.y; + p.y = (x_326 - 2); + } + const bool x_330 = (d >= 0); + x_336_phi = x_330; + if (x_330) { + const int x_334 = p.x; + x_335 = (x_334 < 14); + x_336_phi = x_335; + } + const bool x_336 = x_336_phi; + x_349_phi = x_336; + if (x_336) { + const int x_340 = p.x; + const int x_343 = p.y; + const int x_347 = map[((x_340 + 2) + (x_343 * 16))]; + x_348 = (x_347 == 0); + x_349_phi = x_348; + } + if (x_349_phi) { + d = (d - 1); + const int x_355 = p.x; + const int x_357 = p.y; + map[(x_355 + (x_357 * 16))] = 1; + const int x_362 = p.x; + const int x_365 = p.y; + map[((x_362 + 1) + (x_365 * 16))] = 1; + const int x_370 = p.x; + const int x_373 = p.y; + map[((x_370 + 2) + (x_373 * 16))] = 1; + const int x_378 = p.x; + p.x = (x_378 + 2); + } + const bool x_382 = (d >= 0); + x_388_phi = x_382; + if (x_382) { + const int x_386 = p.y; + x_387 = (x_386 < 14); + x_388_phi = x_387; + } + const bool x_388 = x_388_phi; + x_401_phi = x_388; + if (x_388) { + const int x_392 = p.x; + const int x_394 = p.y; + const int x_399 = map[(x_392 + ((x_394 + 2) * 16))]; + x_400 = (x_399 == 0); + x_401_phi = x_400; + } + if (x_401_phi) { + d = (d - 1); + const int x_407 = p.x; + const int x_409 = p.y; + map[(x_407 + (x_409 * 16))] = 1; + const int x_414 = p.x; + const int x_416 = p.y; + map[(x_414 + ((x_416 + 1) * 16))] = 1; + const int x_422 = p.x; + const int x_424 = p.y; + map[(x_422 + ((x_424 + 2) * 16))] = 1; + const int x_430 = p.y; + p.y = (x_430 + 2); + } + } + const int x_434 = ipos.y; + const int x_437 = ipos.x; + const int x_440 = map[((x_434 * 16) + x_437)]; + if ((x_440 == 1)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + if (canwalk) { + } else { + break; + } + } + } + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.msl new file mode 100644 index 0000000000..b60fe95824 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.msl @@ -0,0 +1,355 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8, thread float4* const tint_symbol_9) { + float2 pos = 0.0f; + int2 ipos = 0; + int i = 0; + int2 p = 0; + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + float4 const x_59 = *(tint_symbol_7); + float2 const x_62 = x_7.resolution; + pos = (float2(x_59.x, x_59.y) / x_62); + float const x_65 = pos.x; + float const x_69 = pos.y; + ipos = int2(int((x_65 * 16.0f)), int((x_69 * 16.0f))); + i = 0; + while (true) { + int const x_77 = i; + if ((x_77 < 256)) { + } else { + break; + } + int const x_80 = i; + (*(tint_symbol_8)).arr[x_80] = 0; + { + int const x_82 = i; + i = (x_82 + 1); + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_104 = false; + bool x_124 = false; + bool x_144 = false; + bool x_164 = false; + bool x_105_phi = false; + bool x_125_phi = false; + bool x_145_phi = false; + bool x_165_phi = false; + int const x_88 = v; + v = (x_88 + 1); + directions = 0; + int const x_91 = p.x; + bool const x_92 = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + int const x_96 = p.x; + int const x_99 = p.y; + int const x_103 = (*(tint_symbol_8)).arr[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + bool const x_105 = x_105_phi; + if (x_105) { + int const x_108 = directions; + directions = (x_108 + 1); + } + int const x_111 = p.y; + bool const x_112 = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + int const x_116 = p.x; + int const x_118 = p.y; + int const x_123 = (*(tint_symbol_8)).arr[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + bool const x_125 = x_125_phi; + if (x_125) { + int const x_128 = directions; + directions = (x_128 + 1); + } + int const x_131 = p.x; + bool const x_132 = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + int const x_136 = p.x; + int const x_139 = p.y; + int const x_143 = (*(tint_symbol_8)).arr[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + bool const x_145 = x_145_phi; + if (x_145) { + int const x_148 = directions; + directions = (x_148 + 1); + } + int const x_151 = p.y; + bool const x_152 = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + int const x_156 = p.x; + int const x_158 = p.y; + int const x_163 = (*(tint_symbol_8)).arr[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + bool const x_165 = x_165_phi; + if (x_165) { + int const x_168 = directions; + directions = (x_168 + 1); + } + bool x_229 = false; + bool x_242 = false; + bool x_281 = false; + bool x_295 = false; + bool x_335 = false; + bool x_348 = false; + bool x_387 = false; + bool x_400 = false; + bool x_230_phi = false; + bool x_243_phi = false; + bool x_282_phi = false; + bool x_296_phi = false; + bool x_336_phi = false; + bool x_349_phi = false; + bool x_388_phi = false; + bool x_401_phi = false; + int const x_170 = directions; + if ((x_170 == 0)) { + canwalk = false; + i = 0; + while (true) { + int const x_179 = i; + if ((x_179 < 8)) { + } else { + break; + } + j = 0; + while (true) { + int const x_186 = j; + if ((x_186 < 8)) { + } else { + break; + } + int const x_189 = j; + int const x_191 = i; + int const x_196 = (*(tint_symbol_8)).arr[((x_189 * 2) + ((x_191 * 2) * 16))]; + if ((x_196 == 0)) { + int const x_200 = j; + p.x = (x_200 * 2); + int const x_203 = i; + p.y = (x_203 * 2); + canwalk = true; + } + { + int const x_206 = j; + j = (x_206 + 1); + } + } + { + int const x_208 = i; + i = (x_208 + 1); + } + } + int const x_211 = p.x; + int const x_213 = p.y; + (*(tint_symbol_8)).arr[(x_211 + (x_213 * 16))] = 1; + } else { + int const x_217 = v; + int const x_218 = directions; + d = (x_217 % x_218); + int const x_220 = directions; + int const x_221 = v; + v = (x_221 + x_220); + int const x_223 = d; + bool const x_224 = (x_223 >= 0); + x_230_phi = x_224; + if (x_224) { + int const x_228 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + bool const x_230 = x_230_phi; + x_243_phi = x_230; + if (x_230) { + int const x_234 = p.x; + int const x_237 = p.y; + int const x_241 = (*(tint_symbol_8)).arr[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + bool const x_243 = x_243_phi; + if (x_243) { + int const x_246 = d; + d = (x_246 - 1); + int const x_249 = p.x; + int const x_251 = p.y; + (*(tint_symbol_8)).arr[(x_249 + (x_251 * 16))] = 1; + int const x_256 = p.x; + int const x_259 = p.y; + (*(tint_symbol_8)).arr[((x_256 - 1) + (x_259 * 16))] = 1; + int const x_264 = p.x; + int const x_267 = p.y; + (*(tint_symbol_8)).arr[((x_264 - 2) + (x_267 * 16))] = 1; + int const x_272 = p.x; + p.x = (x_272 - 2); + } + int const x_275 = d; + bool const x_276 = (x_275 >= 0); + x_282_phi = x_276; + if (x_276) { + int const x_280 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + bool const x_282 = x_282_phi; + x_296_phi = x_282; + if (x_282) { + int const x_286 = p.x; + int const x_288 = p.y; + tint_array_wrapper const x_291 = *(tint_symbol_8); + tint_array_wrapper const tint_symbol_4 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + *(tint_symbol_8) = tint_symbol_4; + *(tint_symbol_8) = x_291; + int const x_294 = (*(tint_symbol_8)).arr[(x_286 + ((x_288 - 2) * 16))]; + x_295 = (x_294 == 0); + x_296_phi = x_295; + } + bool const x_296 = x_296_phi; + if (x_296) { + int const x_299 = d; + d = (x_299 - 1); + int const x_302 = p.x; + int const x_304 = p.y; + (*(tint_symbol_8)).arr[(x_302 + (x_304 * 16))] = 1; + int const x_309 = p.x; + int const x_311 = p.y; + (*(tint_symbol_8)).arr[(x_309 + ((x_311 - 1) * 16))] = 1; + int const x_317 = p.x; + int const x_319 = p.y; + tint_array_wrapper const x_321 = *(tint_symbol_8); + tint_array_wrapper const tint_symbol_5 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + *(tint_symbol_8) = tint_symbol_5; + *(tint_symbol_8) = x_321; + (*(tint_symbol_8)).arr[(x_317 + ((x_319 - 2) * 16))] = 1; + int const x_326 = p.y; + p.y = (x_326 - 2); + } + int const x_329 = d; + bool const x_330 = (x_329 >= 0); + x_336_phi = x_330; + if (x_330) { + int const x_334 = p.x; + x_335 = (x_334 < 14); + x_336_phi = x_335; + } + bool const x_336 = x_336_phi; + x_349_phi = x_336; + if (x_336) { + int const x_340 = p.x; + int const x_343 = p.y; + int const x_347 = (*(tint_symbol_8)).arr[((x_340 + 2) + (x_343 * 16))]; + x_348 = (x_347 == 0); + x_349_phi = x_348; + } + bool const x_349 = x_349_phi; + if (x_349) { + int const x_352 = d; + d = (x_352 - 1); + int const x_355 = p.x; + int const x_357 = p.y; + (*(tint_symbol_8)).arr[(x_355 + (x_357 * 16))] = 1; + int const x_362 = p.x; + int const x_365 = p.y; + (*(tint_symbol_8)).arr[((x_362 + 1) + (x_365 * 16))] = 1; + int const x_370 = p.x; + int const x_373 = p.y; + (*(tint_symbol_8)).arr[((x_370 + 2) + (x_373 * 16))] = 1; + int const x_378 = p.x; + p.x = (x_378 + 2); + } + int const x_381 = d; + bool const x_382 = (x_381 >= 0); + x_388_phi = x_382; + if (x_382) { + int const x_386 = p.y; + x_387 = (x_386 < 14); + x_388_phi = x_387; + } + bool const x_388 = x_388_phi; + x_401_phi = x_388; + if (x_388) { + int const x_392 = p.x; + int const x_394 = p.y; + int const x_399 = (*(tint_symbol_8)).arr[(x_392 + ((x_394 + 2) * 16))]; + x_400 = (x_399 == 0); + x_401_phi = x_400; + } + bool const x_401 = x_401_phi; + if (x_401) { + int const x_404 = d; + d = (x_404 - 1); + int const x_407 = p.x; + int const x_409 = p.y; + (*(tint_symbol_8)).arr[(x_407 + (x_409 * 16))] = 1; + int const x_414 = p.x; + int const x_416 = p.y; + (*(tint_symbol_8)).arr[(x_414 + ((x_416 + 1) * 16))] = 1; + int const x_422 = p.x; + int const x_424 = p.y; + (*(tint_symbol_8)).arr[(x_422 + ((x_424 + 2) * 16))] = 1; + int const x_430 = p.y; + p.y = (x_430 + 2); + } + } + int const x_434 = ipos.y; + int const x_437 = ipos.x; + int const x_440 = (*(tint_symbol_8)).arr[((x_434 * 16) + x_437)]; + if ((x_440 == 1)) { + *(tint_symbol_9) = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + bool const x_444 = canwalk; + if (x_444) { + } else { + break; + } + } + } + *(tint_symbol_9) = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_10 = 0.0f; + thread tint_array_wrapper tint_symbol_11 = {}; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_10), &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_6 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.spvasm new file mode 100644 index 0000000000..577b0fa261 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.spvasm @@ -0,0 +1,782 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 512 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %map "map" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %ipos "ipos" + OpName %i "i" + OpName %p "p" + OpName %canwalk "canwalk" + OpName %v "v" + OpName %directions "directions" + OpName %j "j" + OpName %d "d" + OpName %x_104 "x_104" + OpName %x_124 "x_124" + OpName %x_144 "x_144" + OpName %x_164 "x_164" + OpName %x_105_phi "x_105_phi" + OpName %x_125_phi "x_125_phi" + OpName %x_145_phi "x_145_phi" + OpName %x_165_phi "x_165_phi" + OpName %x_229 "x_229" + OpName %x_242 "x_242" + OpName %x_281 "x_281" + OpName %x_295 "x_295" + OpName %x_335 "x_335" + OpName %x_348 "x_348" + OpName %x_387 "x_387" + OpName %x_400 "x_400" + OpName %x_230_phi "x_230_phi" + OpName %x_243_phi "x_243_phi" + OpName %x_282_phi "x_282_phi" + OpName %x_296_phi "x_296_phi" + OpName %x_336_phi "x_336_phi" + OpName %x_349_phi "x_349_phi" + OpName %x_388_phi "x_388_phi" + OpName %x_401_phi "x_401_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Private__arr_int_uint_256 = OpTypePointer Private %_arr_int_uint_256 + %16 = OpConstantNull %_arr_int_uint_256 + %map = OpVariable %_ptr_Private__arr_int_uint_256 Private %16 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %28 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %32 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_16 = OpConstant %float 16 + %int_0 = OpConstant %int 0 + %int_256 = OpConstant %int 256 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %83 = OpConstantComposite %v2int %int_0 %int_0 + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %int_16 = OpConstant %int 16 + %int_14 = OpConstant %int 14 + %false = OpConstantFalse %bool + %int_8 = OpConstant %int 8 + %331 = OpConstantComposite %_arr_int_uint_256 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 + %float_1 = OpConstant %float 1 + %492 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %498 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %499 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %28 + %ipos = OpVariable %_ptr_Function_v2int Function %32 + %i = OpVariable %_ptr_Function_int Function %35 + %p = OpVariable %_ptr_Function_v2int Function %32 + %canwalk = OpVariable %_ptr_Function_bool Function %40 + %v = OpVariable %_ptr_Function_int Function %35 + %directions = OpVariable %_ptr_Function_int Function %35 + %j = OpVariable %_ptr_Function_int Function %35 + %d = OpVariable %_ptr_Function_int Function %35 + %x_104 = OpVariable %_ptr_Function_bool Function %40 + %x_124 = OpVariable %_ptr_Function_bool Function %40 + %x_144 = OpVariable %_ptr_Function_bool Function %40 + %x_164 = OpVariable %_ptr_Function_bool Function %40 + %x_105_phi = OpVariable %_ptr_Function_bool Function %40 + %x_125_phi = OpVariable %_ptr_Function_bool Function %40 + %x_145_phi = OpVariable %_ptr_Function_bool Function %40 + %x_165_phi = OpVariable %_ptr_Function_bool Function %40 + %x_229 = OpVariable %_ptr_Function_bool Function %40 + %x_242 = OpVariable %_ptr_Function_bool Function %40 + %x_281 = OpVariable %_ptr_Function_bool Function %40 + %x_295 = OpVariable %_ptr_Function_bool Function %40 + %x_335 = OpVariable %_ptr_Function_bool Function %40 + %x_348 = OpVariable %_ptr_Function_bool Function %40 + %x_387 = OpVariable %_ptr_Function_bool Function %40 + %x_400 = OpVariable %_ptr_Function_bool Function %40 + %x_230_phi = OpVariable %_ptr_Function_bool Function %40 + %x_243_phi = OpVariable %_ptr_Function_bool Function %40 + %x_282_phi = OpVariable %_ptr_Function_bool Function %40 + %x_296_phi = OpVariable %_ptr_Function_bool Function %40 + %x_336_phi = OpVariable %_ptr_Function_bool Function %40 + %x_349_phi = OpVariable %_ptr_Function_bool Function %40 + %x_388_phi = OpVariable %_ptr_Function_bool Function %40 + %x_401_phi = OpVariable %_ptr_Function_bool Function %40 + %45 = OpLoad %v4float %gl_FragCoord + %48 = OpAccessChain %_ptr_Uniform_v2float %x_7 %uint_0 + %49 = OpLoad %v2float %48 + %50 = OpCompositeExtract %float %45 0 + %51 = OpCompositeExtract %float %45 1 + %52 = OpCompositeConstruct %v2float %50 %51 + %53 = OpFDiv %v2float %52 %49 + OpStore %pos %53 + %55 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %59 = OpLoad %float %58 + %62 = OpFMul %float %56 %float_16 + %60 = OpConvertFToS %int %62 + %64 = OpFMul %float %59 %float_16 + %63 = OpConvertFToS %int %64 + %65 = OpCompositeConstruct %v2int %60 %63 + OpStore %ipos %65 + OpStore %i %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %i + %73 = OpSLessThan %bool %71 %int_256 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %74 + %76 = OpLabel + OpBranch %68 + %74 = OpLabel + %77 = OpLoad %int %i + %79 = OpAccessChain %_ptr_Private_int %map %77 + OpStore %79 %int_0 + OpBranch %69 + %69 = OpLabel + %80 = OpLoad %int %i + %82 = OpIAdd %int %80 %int_1 + OpStore %i %82 + OpBranch %67 + %68 = OpLabel + OpStore %p %83 + OpStore %canwalk %true + OpStore %v %int_0 + OpBranch %85 + %85 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %97 = OpLoad %int %v + %98 = OpIAdd %int %97 %int_1 + OpStore %v %98 + OpStore %directions %int_0 + %99 = OpAccessChain %_ptr_Function_int %p %uint_0 + %100 = OpLoad %int %99 + %101 = OpSGreaterThan %bool %100 %int_0 + OpStore %x_105_phi %101 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + %104 = OpAccessChain %_ptr_Function_int %p %uint_0 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Function_int %p %uint_1 + %107 = OpLoad %int %106 + %109 = OpISub %int %105 %int_2 + %111 = OpIMul %int %107 %int_16 + %112 = OpIAdd %int %109 %111 + %113 = OpAccessChain %_ptr_Private_int %map %112 + %114 = OpLoad %int %113 + %115 = OpIEqual %bool %114 %int_0 + OpStore %x_104 %115 + %116 = OpLoad %bool %x_104 + OpStore %x_105_phi %116 + OpBranch %102 + %102 = OpLabel + %117 = OpLoad %bool %x_105_phi + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %120 = OpLoad %int %directions + %121 = OpIAdd %int %120 %int_1 + OpStore %directions %121 + OpBranch %118 + %118 = OpLabel + %122 = OpAccessChain %_ptr_Function_int %p %uint_1 + %123 = OpLoad %int %122 + %124 = OpSGreaterThan %bool %123 %int_0 + OpStore %x_125_phi %124 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %125 + %126 = OpLabel + %127 = OpAccessChain %_ptr_Function_int %p %uint_0 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Function_int %p %uint_1 + %130 = OpLoad %int %129 + %131 = OpISub %int %130 %int_2 + %132 = OpIMul %int %131 %int_16 + %133 = OpIAdd %int %128 %132 + %134 = OpAccessChain %_ptr_Private_int %map %133 + %135 = OpLoad %int %134 + %136 = OpIEqual %bool %135 %int_0 + OpStore %x_124 %136 + %137 = OpLoad %bool %x_124 + OpStore %x_125_phi %137 + OpBranch %125 + %125 = OpLabel + %138 = OpLoad %bool %x_125_phi + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpLoad %int %directions + %142 = OpIAdd %int %141 %int_1 + OpStore %directions %142 + OpBranch %139 + %139 = OpLabel + %143 = OpAccessChain %_ptr_Function_int %p %uint_0 + %144 = OpLoad %int %143 + %146 = OpSLessThan %bool %144 %int_14 + OpStore %x_145_phi %146 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %147 + %148 = OpLabel + %149 = OpAccessChain %_ptr_Function_int %p %uint_0 + %150 = OpLoad %int %149 + %151 = OpAccessChain %_ptr_Function_int %p %uint_1 + %152 = OpLoad %int %151 + %153 = OpIAdd %int %150 %int_2 + %154 = OpIMul %int %152 %int_16 + %155 = OpIAdd %int %153 %154 + %156 = OpAccessChain %_ptr_Private_int %map %155 + %157 = OpLoad %int %156 + %158 = OpIEqual %bool %157 %int_0 + OpStore %x_144 %158 + %159 = OpLoad %bool %x_144 + OpStore %x_145_phi %159 + OpBranch %147 + %147 = OpLabel + %160 = OpLoad %bool %x_145_phi + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %161 + %162 = OpLabel + %163 = OpLoad %int %directions + %164 = OpIAdd %int %163 %int_1 + OpStore %directions %164 + OpBranch %161 + %161 = OpLabel + %165 = OpAccessChain %_ptr_Function_int %p %uint_1 + %166 = OpLoad %int %165 + %167 = OpSLessThan %bool %166 %int_14 + OpStore %x_165_phi %167 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %168 + %169 = OpLabel + %170 = OpAccessChain %_ptr_Function_int %p %uint_0 + %171 = OpLoad %int %170 + %172 = OpAccessChain %_ptr_Function_int %p %uint_1 + %173 = OpLoad %int %172 + %174 = OpIAdd %int %173 %int_2 + %175 = OpIMul %int %174 %int_16 + %176 = OpIAdd %int %171 %175 + %177 = OpAccessChain %_ptr_Private_int %map %176 + %178 = OpLoad %int %177 + %179 = OpIEqual %bool %178 %int_0 + OpStore %x_164 %179 + %180 = OpLoad %bool %x_164 + OpStore %x_165_phi %180 + OpBranch %168 + %168 = OpLabel + %181 = OpLoad %bool %x_165_phi + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %184 = OpLoad %int %directions + %185 = OpIAdd %int %184 %int_1 + OpStore %directions %185 + OpBranch %182 + %182 = OpLabel + %202 = OpLoad %int %directions + %203 = OpIEqual %bool %202 %int_0 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %206 + %205 = OpLabel + OpStore %canwalk %false + OpStore %i %int_0 + OpBranch %208 + %208 = OpLabel + OpLoopMerge %209 %210 None + OpBranch %211 + %211 = OpLabel + %212 = OpLoad %int %i + %214 = OpSLessThan %bool %212 %int_8 + OpSelectionMerge %215 None + OpBranchConditional %214 %216 %217 + %216 = OpLabel + OpBranch %215 + %217 = OpLabel + OpBranch %209 + %215 = OpLabel + OpStore %j %int_0 + OpBranch %218 + %218 = OpLabel + OpLoopMerge %219 %220 None + OpBranch %221 + %221 = OpLabel + %222 = OpLoad %int %j + %223 = OpSLessThan %bool %222 %int_8 + OpSelectionMerge %224 None + OpBranchConditional %223 %225 %226 + %225 = OpLabel + OpBranch %224 + %226 = OpLabel + OpBranch %219 + %224 = OpLabel + %227 = OpLoad %int %j + %228 = OpLoad %int %i + %229 = OpIMul %int %227 %int_2 + %230 = OpIMul %int %228 %int_2 + %231 = OpIMul %int %230 %int_16 + %232 = OpIAdd %int %229 %231 + %233 = OpAccessChain %_ptr_Private_int %map %232 + %234 = OpLoad %int %233 + %235 = OpIEqual %bool %234 %int_0 + OpSelectionMerge %236 None + OpBranchConditional %235 %237 %236 + %237 = OpLabel + %238 = OpLoad %int %j + %239 = OpAccessChain %_ptr_Function_int %p %uint_0 + %240 = OpIMul %int %238 %int_2 + OpStore %239 %240 + %241 = OpLoad %int %i + %242 = OpAccessChain %_ptr_Function_int %p %uint_1 + %243 = OpIMul %int %241 %int_2 + OpStore %242 %243 + OpStore %canwalk %true + OpBranch %236 + %236 = OpLabel + OpBranch %220 + %220 = OpLabel + %244 = OpLoad %int %j + %245 = OpIAdd %int %244 %int_1 + OpStore %j %245 + OpBranch %218 + %219 = OpLabel + OpBranch %210 + %210 = OpLabel + %246 = OpLoad %int %i + %247 = OpIAdd %int %246 %int_1 + OpStore %i %247 + OpBranch %208 + %209 = OpLabel + %248 = OpAccessChain %_ptr_Function_int %p %uint_0 + %249 = OpLoad %int %248 + %250 = OpAccessChain %_ptr_Function_int %p %uint_1 + %251 = OpLoad %int %250 + %252 = OpIMul %int %251 %int_16 + %253 = OpIAdd %int %249 %252 + %254 = OpAccessChain %_ptr_Private_int %map %253 + OpStore %254 %int_1 + OpBranch %204 + %206 = OpLabel + %255 = OpLoad %int %v + %256 = OpLoad %int %directions + %257 = OpSMod %int %255 %256 + OpStore %d %257 + %258 = OpLoad %int %directions + %259 = OpLoad %int %v + %260 = OpIAdd %int %259 %258 + OpStore %v %260 + %261 = OpLoad %int %d + %262 = OpSGreaterThanEqual %bool %261 %int_0 + OpStore %x_230_phi %262 + OpSelectionMerge %263 None + OpBranchConditional %262 %264 %263 + %264 = OpLabel + %265 = OpAccessChain %_ptr_Function_int %p %uint_0 + %266 = OpLoad %int %265 + %267 = OpSGreaterThan %bool %266 %int_0 + OpStore %x_229 %267 + %268 = OpLoad %bool %x_229 + OpStore %x_230_phi %268 + OpBranch %263 + %263 = OpLabel + %269 = OpLoad %bool %x_230_phi + OpStore %x_243_phi %269 + OpSelectionMerge %270 None + OpBranchConditional %269 %271 %270 + %271 = OpLabel + %272 = OpAccessChain %_ptr_Function_int %p %uint_0 + %273 = OpLoad %int %272 + %274 = OpAccessChain %_ptr_Function_int %p %uint_1 + %275 = OpLoad %int %274 + %276 = OpISub %int %273 %int_2 + %277 = OpIMul %int %275 %int_16 + %278 = OpIAdd %int %276 %277 + %279 = OpAccessChain %_ptr_Private_int %map %278 + %280 = OpLoad %int %279 + %281 = OpIEqual %bool %280 %int_0 + OpStore %x_242 %281 + %282 = OpLoad %bool %x_242 + OpStore %x_243_phi %282 + OpBranch %270 + %270 = OpLabel + %283 = OpLoad %bool %x_243_phi + OpSelectionMerge %284 None + OpBranchConditional %283 %285 %284 + %285 = OpLabel + %286 = OpLoad %int %d + %287 = OpISub %int %286 %int_1 + OpStore %d %287 + %288 = OpAccessChain %_ptr_Function_int %p %uint_0 + %289 = OpLoad %int %288 + %290 = OpAccessChain %_ptr_Function_int %p %uint_1 + %291 = OpLoad %int %290 + %292 = OpIMul %int %291 %int_16 + %293 = OpIAdd %int %289 %292 + %294 = OpAccessChain %_ptr_Private_int %map %293 + OpStore %294 %int_1 + %295 = OpAccessChain %_ptr_Function_int %p %uint_0 + %296 = OpLoad %int %295 + %297 = OpAccessChain %_ptr_Function_int %p %uint_1 + %298 = OpLoad %int %297 + %299 = OpISub %int %296 %int_1 + %300 = OpIMul %int %298 %int_16 + %301 = OpIAdd %int %299 %300 + %302 = OpAccessChain %_ptr_Private_int %map %301 + OpStore %302 %int_1 + %303 = OpAccessChain %_ptr_Function_int %p %uint_0 + %304 = OpLoad %int %303 + %305 = OpAccessChain %_ptr_Function_int %p %uint_1 + %306 = OpLoad %int %305 + %307 = OpISub %int %304 %int_2 + %308 = OpIMul %int %306 %int_16 + %309 = OpIAdd %int %307 %308 + %310 = OpAccessChain %_ptr_Private_int %map %309 + OpStore %310 %int_1 + %311 = OpAccessChain %_ptr_Function_int %p %uint_0 + %312 = OpLoad %int %311 + %313 = OpAccessChain %_ptr_Function_int %p %uint_0 + %314 = OpISub %int %312 %int_2 + OpStore %313 %314 + OpBranch %284 + %284 = OpLabel + %315 = OpLoad %int %d + %316 = OpSGreaterThanEqual %bool %315 %int_0 + OpStore %x_282_phi %316 + OpSelectionMerge %317 None + OpBranchConditional %316 %318 %317 + %318 = OpLabel + %319 = OpAccessChain %_ptr_Function_int %p %uint_1 + %320 = OpLoad %int %319 + %321 = OpSGreaterThan %bool %320 %int_0 + OpStore %x_281 %321 + %322 = OpLoad %bool %x_281 + OpStore %x_282_phi %322 + OpBranch %317 + %317 = OpLabel + %323 = OpLoad %bool %x_282_phi + OpStore %x_296_phi %323 + OpSelectionMerge %324 None + OpBranchConditional %323 %325 %324 + %325 = OpLabel + %326 = OpAccessChain %_ptr_Function_int %p %uint_0 + %327 = OpLoad %int %326 + %328 = OpAccessChain %_ptr_Function_int %p %uint_1 + %329 = OpLoad %int %328 + %330 = OpLoad %_arr_int_uint_256 %map + OpStore %map %331 + OpStore %map %330 + %332 = OpISub %int %329 %int_2 + %333 = OpIMul %int %332 %int_16 + %334 = OpIAdd %int %327 %333 + %335 = OpAccessChain %_ptr_Private_int %map %334 + %336 = OpLoad %int %335 + %337 = OpIEqual %bool %336 %int_0 + OpStore %x_295 %337 + %338 = OpLoad %bool %x_295 + OpStore %x_296_phi %338 + OpBranch %324 + %324 = OpLabel + %339 = OpLoad %bool %x_296_phi + OpSelectionMerge %340 None + OpBranchConditional %339 %341 %340 + %341 = OpLabel + %342 = OpLoad %int %d + %343 = OpISub %int %342 %int_1 + OpStore %d %343 + %344 = OpAccessChain %_ptr_Function_int %p %uint_0 + %345 = OpLoad %int %344 + %346 = OpAccessChain %_ptr_Function_int %p %uint_1 + %347 = OpLoad %int %346 + %348 = OpIMul %int %347 %int_16 + %349 = OpIAdd %int %345 %348 + %350 = OpAccessChain %_ptr_Private_int %map %349 + OpStore %350 %int_1 + %351 = OpAccessChain %_ptr_Function_int %p %uint_0 + %352 = OpLoad %int %351 + %353 = OpAccessChain %_ptr_Function_int %p %uint_1 + %354 = OpLoad %int %353 + %355 = OpISub %int %354 %int_1 + %356 = OpIMul %int %355 %int_16 + %357 = OpIAdd %int %352 %356 + %358 = OpAccessChain %_ptr_Private_int %map %357 + OpStore %358 %int_1 + %359 = OpAccessChain %_ptr_Function_int %p %uint_0 + %360 = OpLoad %int %359 + %361 = OpAccessChain %_ptr_Function_int %p %uint_1 + %362 = OpLoad %int %361 + %363 = OpLoad %_arr_int_uint_256 %map + OpStore %map %331 + OpStore %map %363 + %364 = OpISub %int %362 %int_2 + %365 = OpIMul %int %364 %int_16 + %366 = OpIAdd %int %360 %365 + %367 = OpAccessChain %_ptr_Private_int %map %366 + OpStore %367 %int_1 + %368 = OpAccessChain %_ptr_Function_int %p %uint_1 + %369 = OpLoad %int %368 + %370 = OpAccessChain %_ptr_Function_int %p %uint_1 + %371 = OpISub %int %369 %int_2 + OpStore %370 %371 + OpBranch %340 + %340 = OpLabel + %372 = OpLoad %int %d + %373 = OpSGreaterThanEqual %bool %372 %int_0 + OpStore %x_336_phi %373 + OpSelectionMerge %374 None + OpBranchConditional %373 %375 %374 + %375 = OpLabel + %376 = OpAccessChain %_ptr_Function_int %p %uint_0 + %377 = OpLoad %int %376 + %378 = OpSLessThan %bool %377 %int_14 + OpStore %x_335 %378 + %379 = OpLoad %bool %x_335 + OpStore %x_336_phi %379 + OpBranch %374 + %374 = OpLabel + %380 = OpLoad %bool %x_336_phi + OpStore %x_349_phi %380 + OpSelectionMerge %381 None + OpBranchConditional %380 %382 %381 + %382 = OpLabel + %383 = OpAccessChain %_ptr_Function_int %p %uint_0 + %384 = OpLoad %int %383 + %385 = OpAccessChain %_ptr_Function_int %p %uint_1 + %386 = OpLoad %int %385 + %387 = OpIAdd %int %384 %int_2 + %388 = OpIMul %int %386 %int_16 + %389 = OpIAdd %int %387 %388 + %390 = OpAccessChain %_ptr_Private_int %map %389 + %391 = OpLoad %int %390 + %392 = OpIEqual %bool %391 %int_0 + OpStore %x_348 %392 + %393 = OpLoad %bool %x_348 + OpStore %x_349_phi %393 + OpBranch %381 + %381 = OpLabel + %394 = OpLoad %bool %x_349_phi + OpSelectionMerge %395 None + OpBranchConditional %394 %396 %395 + %396 = OpLabel + %397 = OpLoad %int %d + %398 = OpISub %int %397 %int_1 + OpStore %d %398 + %399 = OpAccessChain %_ptr_Function_int %p %uint_0 + %400 = OpLoad %int %399 + %401 = OpAccessChain %_ptr_Function_int %p %uint_1 + %402 = OpLoad %int %401 + %403 = OpIMul %int %402 %int_16 + %404 = OpIAdd %int %400 %403 + %405 = OpAccessChain %_ptr_Private_int %map %404 + OpStore %405 %int_1 + %406 = OpAccessChain %_ptr_Function_int %p %uint_0 + %407 = OpLoad %int %406 + %408 = OpAccessChain %_ptr_Function_int %p %uint_1 + %409 = OpLoad %int %408 + %410 = OpIAdd %int %407 %int_1 + %411 = OpIMul %int %409 %int_16 + %412 = OpIAdd %int %410 %411 + %413 = OpAccessChain %_ptr_Private_int %map %412 + OpStore %413 %int_1 + %414 = OpAccessChain %_ptr_Function_int %p %uint_0 + %415 = OpLoad %int %414 + %416 = OpAccessChain %_ptr_Function_int %p %uint_1 + %417 = OpLoad %int %416 + %418 = OpIAdd %int %415 %int_2 + %419 = OpIMul %int %417 %int_16 + %420 = OpIAdd %int %418 %419 + %421 = OpAccessChain %_ptr_Private_int %map %420 + OpStore %421 %int_1 + %422 = OpAccessChain %_ptr_Function_int %p %uint_0 + %423 = OpLoad %int %422 + %424 = OpAccessChain %_ptr_Function_int %p %uint_0 + %425 = OpIAdd %int %423 %int_2 + OpStore %424 %425 + OpBranch %395 + %395 = OpLabel + %426 = OpLoad %int %d + %427 = OpSGreaterThanEqual %bool %426 %int_0 + OpStore %x_388_phi %427 + OpSelectionMerge %428 None + OpBranchConditional %427 %429 %428 + %429 = OpLabel + %430 = OpAccessChain %_ptr_Function_int %p %uint_1 + %431 = OpLoad %int %430 + %432 = OpSLessThan %bool %431 %int_14 + OpStore %x_387 %432 + %433 = OpLoad %bool %x_387 + OpStore %x_388_phi %433 + OpBranch %428 + %428 = OpLabel + %434 = OpLoad %bool %x_388_phi + OpStore %x_401_phi %434 + OpSelectionMerge %435 None + OpBranchConditional %434 %436 %435 + %436 = OpLabel + %437 = OpAccessChain %_ptr_Function_int %p %uint_0 + %438 = OpLoad %int %437 + %439 = OpAccessChain %_ptr_Function_int %p %uint_1 + %440 = OpLoad %int %439 + %441 = OpIAdd %int %440 %int_2 + %442 = OpIMul %int %441 %int_16 + %443 = OpIAdd %int %438 %442 + %444 = OpAccessChain %_ptr_Private_int %map %443 + %445 = OpLoad %int %444 + %446 = OpIEqual %bool %445 %int_0 + OpStore %x_400 %446 + %447 = OpLoad %bool %x_400 + OpStore %x_401_phi %447 + OpBranch %435 + %435 = OpLabel + %448 = OpLoad %bool %x_401_phi + OpSelectionMerge %449 None + OpBranchConditional %448 %450 %449 + %450 = OpLabel + %451 = OpLoad %int %d + %452 = OpISub %int %451 %int_1 + OpStore %d %452 + %453 = OpAccessChain %_ptr_Function_int %p %uint_0 + %454 = OpLoad %int %453 + %455 = OpAccessChain %_ptr_Function_int %p %uint_1 + %456 = OpLoad %int %455 + %457 = OpIMul %int %456 %int_16 + %458 = OpIAdd %int %454 %457 + %459 = OpAccessChain %_ptr_Private_int %map %458 + OpStore %459 %int_1 + %460 = OpAccessChain %_ptr_Function_int %p %uint_0 + %461 = OpLoad %int %460 + %462 = OpAccessChain %_ptr_Function_int %p %uint_1 + %463 = OpLoad %int %462 + %464 = OpIAdd %int %463 %int_1 + %465 = OpIMul %int %464 %int_16 + %466 = OpIAdd %int %461 %465 + %467 = OpAccessChain %_ptr_Private_int %map %466 + OpStore %467 %int_1 + %468 = OpAccessChain %_ptr_Function_int %p %uint_0 + %469 = OpLoad %int %468 + %470 = OpAccessChain %_ptr_Function_int %p %uint_1 + %471 = OpLoad %int %470 + %472 = OpIAdd %int %471 %int_2 + %473 = OpIMul %int %472 %int_16 + %474 = OpIAdd %int %469 %473 + %475 = OpAccessChain %_ptr_Private_int %map %474 + OpStore %475 %int_1 + %476 = OpAccessChain %_ptr_Function_int %p %uint_1 + %477 = OpLoad %int %476 + %478 = OpAccessChain %_ptr_Function_int %p %uint_1 + %479 = OpIAdd %int %477 %int_2 + OpStore %478 %479 + OpBranch %449 + %449 = OpLabel + OpBranch %204 + %204 = OpLabel + %480 = OpAccessChain %_ptr_Function_int %ipos %uint_1 + %481 = OpLoad %int %480 + %482 = OpAccessChain %_ptr_Function_int %ipos %uint_0 + %483 = OpLoad %int %482 + %484 = OpIMul %int %481 %int_16 + %485 = OpIAdd %int %484 %483 + %486 = OpAccessChain %_ptr_Private_int %map %485 + %487 = OpLoad %int %486 + %488 = OpIEqual %bool %487 %int_1 + OpSelectionMerge %489 None + OpBranchConditional %488 %490 %489 + %490 = OpLabel + OpStore %x_GLF_color %492 + OpReturn + %489 = OpLabel + OpBranch %87 + %87 = OpLabel + %493 = OpLoad %bool %canwalk + OpSelectionMerge %494 None + OpBranchConditional %493 %495 %496 + %495 = OpLabel + OpBranch %494 + %496 = OpLabel + OpBranch %86 + %494 = OpLabel + OpBranch %85 + %86 = OpLabel + OpStore %x_GLF_color %498 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %499 +%tint_symbol_1 = OpFunctionParameter %main_out + %503 = OpLabel + %504 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %504 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %506 = OpLabel + %507 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %507 + %508 = OpFunctionCall %void %main_1 + %510 = OpLoad %v4float %x_GLF_color + %511 = OpCompositeConstruct %main_out %510 + %509 = OpFunctionCall %void %tint_symbol_3 %511 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 87[%87] is not post dominated by the back-edge block 494[%494] + %494 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.wgsl new file mode 100644 index 0000000000..774e546e7f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.spvasm.expected.wgsl @@ -0,0 +1,354 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var map : array; + +var x_GLF_color : vec4; + +fn main_1() { + var pos : vec2; + var ipos : vec2; + var i : i32; + var p : vec2; + var canwalk : bool; + var v : i32; + var directions : i32; + var j : i32; + var d : i32; + let x_59 : vec4 = gl_FragCoord; + let x_62 : vec2 = x_7.resolution; + pos = (vec2(x_59.x, x_59.y) / x_62); + let x_65 : f32 = pos.x; + let x_69 : f32 = pos.y; + ipos = vec2(i32((x_65 * 16.0)), i32((x_69 * 16.0))); + i = 0; + loop { + let x_77 : i32 = i; + if ((x_77 < 256)) { + } else { + break; + } + let x_80 : i32 = i; + map[x_80] = 0; + + continuing { + let x_82 : i32 = i; + i = (x_82 + 1); + } + } + p = vec2(0, 0); + canwalk = true; + v = 0; + loop { + var x_104 : bool; + var x_124 : bool; + var x_144 : bool; + var x_164 : bool; + var x_105_phi : bool; + var x_125_phi : bool; + var x_145_phi : bool; + var x_165_phi : bool; + let x_88 : i32 = v; + v = (x_88 + 1); + directions = 0; + let x_91 : i32 = p.x; + let x_92 : bool = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + let x_96 : i32 = p.x; + let x_99 : i32 = p.y; + let x_103 : i32 = map[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + let x_105 : bool = x_105_phi; + if (x_105) { + let x_108 : i32 = directions; + directions = (x_108 + 1); + } + let x_111 : i32 = p.y; + let x_112 : bool = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + let x_116 : i32 = p.x; + let x_118 : i32 = p.y; + let x_123 : i32 = map[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + let x_125 : bool = x_125_phi; + if (x_125) { + let x_128 : i32 = directions; + directions = (x_128 + 1); + } + let x_131 : i32 = p.x; + let x_132 : bool = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + let x_136 : i32 = p.x; + let x_139 : i32 = p.y; + let x_143 : i32 = map[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + let x_145 : bool = x_145_phi; + if (x_145) { + let x_148 : i32 = directions; + directions = (x_148 + 1); + } + let x_151 : i32 = p.y; + let x_152 : bool = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + let x_156 : i32 = p.x; + let x_158 : i32 = p.y; + let x_163 : i32 = map[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + let x_165 : bool = x_165_phi; + if (x_165) { + let x_168 : i32 = directions; + directions = (x_168 + 1); + } + var x_229 : bool; + var x_242 : bool; + var x_281 : bool; + var x_295 : bool; + var x_335 : bool; + var x_348 : bool; + var x_387 : bool; + var x_400 : bool; + var x_230_phi : bool; + var x_243_phi : bool; + var x_282_phi : bool; + var x_296_phi : bool; + var x_336_phi : bool; + var x_349_phi : bool; + var x_388_phi : bool; + var x_401_phi : bool; + let x_170 : i32 = directions; + if ((x_170 == 0)) { + canwalk = false; + i = 0; + loop { + let x_179 : i32 = i; + if ((x_179 < 8)) { + } else { + break; + } + j = 0; + loop { + let x_186 : i32 = j; + if ((x_186 < 8)) { + } else { + break; + } + let x_189 : i32 = j; + let x_191 : i32 = i; + let x_196 : i32 = map[((x_189 * 2) + ((x_191 * 2) * 16))]; + if ((x_196 == 0)) { + let x_200 : i32 = j; + p.x = (x_200 * 2); + let x_203 : i32 = i; + p.y = (x_203 * 2); + canwalk = true; + } + + continuing { + let x_206 : i32 = j; + j = (x_206 + 1); + } + } + + continuing { + let x_208 : i32 = i; + i = (x_208 + 1); + } + } + let x_211 : i32 = p.x; + let x_213 : i32 = p.y; + map[(x_211 + (x_213 * 16))] = 1; + } else { + let x_217 : i32 = v; + let x_218 : i32 = directions; + d = (x_217 % x_218); + let x_220 : i32 = directions; + let x_221 : i32 = v; + v = (x_221 + x_220); + let x_223 : i32 = d; + let x_224 : bool = (x_223 >= 0); + x_230_phi = x_224; + if (x_224) { + let x_228 : i32 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + let x_230 : bool = x_230_phi; + x_243_phi = x_230; + if (x_230) { + let x_234 : i32 = p.x; + let x_237 : i32 = p.y; + let x_241 : i32 = map[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + let x_243 : bool = x_243_phi; + if (x_243) { + let x_246 : i32 = d; + d = (x_246 - 1); + let x_249 : i32 = p.x; + let x_251 : i32 = p.y; + map[(x_249 + (x_251 * 16))] = 1; + let x_256 : i32 = p.x; + let x_259 : i32 = p.y; + map[((x_256 - 1) + (x_259 * 16))] = 1; + let x_264 : i32 = p.x; + let x_267 : i32 = p.y; + map[((x_264 - 2) + (x_267 * 16))] = 1; + let x_272 : i32 = p.x; + p.x = (x_272 - 2); + } + let x_275 : i32 = d; + let x_276 : bool = (x_275 >= 0); + x_282_phi = x_276; + if (x_276) { + let x_280 : i32 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + let x_282 : bool = x_282_phi; + x_296_phi = x_282; + if (x_282) { + let x_286 : i32 = p.x; + let x_288 : i32 = p.y; + let x_291 : array = map; + map = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + map = x_291; + let x_294 : i32 = map[(x_286 + ((x_288 - 2) * 16))]; + x_295 = (x_294 == 0); + x_296_phi = x_295; + } + let x_296 : bool = x_296_phi; + if (x_296) { + let x_299 : i32 = d; + d = (x_299 - 1); + let x_302 : i32 = p.x; + let x_304 : i32 = p.y; + map[(x_302 + (x_304 * 16))] = 1; + let x_309 : i32 = p.x; + let x_311 : i32 = p.y; + map[(x_309 + ((x_311 - 1) * 16))] = 1; + let x_317 : i32 = p.x; + let x_319 : i32 = p.y; + let x_321 : array = map; + map = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + map = x_321; + map[(x_317 + ((x_319 - 2) * 16))] = 1; + let x_326 : i32 = p.y; + p.y = (x_326 - 2); + } + let x_329 : i32 = d; + let x_330 : bool = (x_329 >= 0); + x_336_phi = x_330; + if (x_330) { + let x_334 : i32 = p.x; + x_335 = (x_334 < 14); + x_336_phi = x_335; + } + let x_336 : bool = x_336_phi; + x_349_phi = x_336; + if (x_336) { + let x_340 : i32 = p.x; + let x_343 : i32 = p.y; + let x_347 : i32 = map[((x_340 + 2) + (x_343 * 16))]; + x_348 = (x_347 == 0); + x_349_phi = x_348; + } + let x_349 : bool = x_349_phi; + if (x_349) { + let x_352 : i32 = d; + d = (x_352 - 1); + let x_355 : i32 = p.x; + let x_357 : i32 = p.y; + map[(x_355 + (x_357 * 16))] = 1; + let x_362 : i32 = p.x; + let x_365 : i32 = p.y; + map[((x_362 + 1) + (x_365 * 16))] = 1; + let x_370 : i32 = p.x; + let x_373 : i32 = p.y; + map[((x_370 + 2) + (x_373 * 16))] = 1; + let x_378 : i32 = p.x; + p.x = (x_378 + 2); + } + let x_381 : i32 = d; + let x_382 : bool = (x_381 >= 0); + x_388_phi = x_382; + if (x_382) { + let x_386 : i32 = p.y; + x_387 = (x_386 < 14); + x_388_phi = x_387; + } + let x_388 : bool = x_388_phi; + x_401_phi = x_388; + if (x_388) { + let x_392 : i32 = p.x; + let x_394 : i32 = p.y; + let x_399 : i32 = map[(x_392 + ((x_394 + 2) * 16))]; + x_400 = (x_399 == 0); + x_401_phi = x_400; + } + let x_401 : bool = x_401_phi; + if (x_401) { + let x_404 : i32 = d; + d = (x_404 - 1); + let x_407 : i32 = p.x; + let x_409 : i32 = p.y; + map[(x_407 + (x_409 * 16))] = 1; + let x_414 : i32 = p.x; + let x_416 : i32 = p.y; + map[(x_414 + ((x_416 + 1) * 16))] = 1; + let x_422 : i32 = p.x; + let x_424 : i32 = p.y; + map[(x_422 + ((x_424 + 2) * 16))] = 1; + let x_430 : i32 = p.y; + p.y = (x_430 + 2); + } + } + let x_434 : i32 = ipos.y; + let x_437 : i32 = ipos.x; + let x_440 : i32 = map[((x_434 * 16) + x_437)]; + if ((x_440 == 1)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + return; + } + + continuing { + let x_444 : bool = canwalk; + if (x_444) { + } else { + break; + } + } + } + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl new file mode 100644 index 0000000000..774e546e7f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl @@ -0,0 +1,354 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var map : array; + +var x_GLF_color : vec4; + +fn main_1() { + var pos : vec2; + var ipos : vec2; + var i : i32; + var p : vec2; + var canwalk : bool; + var v : i32; + var directions : i32; + var j : i32; + var d : i32; + let x_59 : vec4 = gl_FragCoord; + let x_62 : vec2 = x_7.resolution; + pos = (vec2(x_59.x, x_59.y) / x_62); + let x_65 : f32 = pos.x; + let x_69 : f32 = pos.y; + ipos = vec2(i32((x_65 * 16.0)), i32((x_69 * 16.0))); + i = 0; + loop { + let x_77 : i32 = i; + if ((x_77 < 256)) { + } else { + break; + } + let x_80 : i32 = i; + map[x_80] = 0; + + continuing { + let x_82 : i32 = i; + i = (x_82 + 1); + } + } + p = vec2(0, 0); + canwalk = true; + v = 0; + loop { + var x_104 : bool; + var x_124 : bool; + var x_144 : bool; + var x_164 : bool; + var x_105_phi : bool; + var x_125_phi : bool; + var x_145_phi : bool; + var x_165_phi : bool; + let x_88 : i32 = v; + v = (x_88 + 1); + directions = 0; + let x_91 : i32 = p.x; + let x_92 : bool = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + let x_96 : i32 = p.x; + let x_99 : i32 = p.y; + let x_103 : i32 = map[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + let x_105 : bool = x_105_phi; + if (x_105) { + let x_108 : i32 = directions; + directions = (x_108 + 1); + } + let x_111 : i32 = p.y; + let x_112 : bool = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + let x_116 : i32 = p.x; + let x_118 : i32 = p.y; + let x_123 : i32 = map[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + let x_125 : bool = x_125_phi; + if (x_125) { + let x_128 : i32 = directions; + directions = (x_128 + 1); + } + let x_131 : i32 = p.x; + let x_132 : bool = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + let x_136 : i32 = p.x; + let x_139 : i32 = p.y; + let x_143 : i32 = map[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + let x_145 : bool = x_145_phi; + if (x_145) { + let x_148 : i32 = directions; + directions = (x_148 + 1); + } + let x_151 : i32 = p.y; + let x_152 : bool = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + let x_156 : i32 = p.x; + let x_158 : i32 = p.y; + let x_163 : i32 = map[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + let x_165 : bool = x_165_phi; + if (x_165) { + let x_168 : i32 = directions; + directions = (x_168 + 1); + } + var x_229 : bool; + var x_242 : bool; + var x_281 : bool; + var x_295 : bool; + var x_335 : bool; + var x_348 : bool; + var x_387 : bool; + var x_400 : bool; + var x_230_phi : bool; + var x_243_phi : bool; + var x_282_phi : bool; + var x_296_phi : bool; + var x_336_phi : bool; + var x_349_phi : bool; + var x_388_phi : bool; + var x_401_phi : bool; + let x_170 : i32 = directions; + if ((x_170 == 0)) { + canwalk = false; + i = 0; + loop { + let x_179 : i32 = i; + if ((x_179 < 8)) { + } else { + break; + } + j = 0; + loop { + let x_186 : i32 = j; + if ((x_186 < 8)) { + } else { + break; + } + let x_189 : i32 = j; + let x_191 : i32 = i; + let x_196 : i32 = map[((x_189 * 2) + ((x_191 * 2) * 16))]; + if ((x_196 == 0)) { + let x_200 : i32 = j; + p.x = (x_200 * 2); + let x_203 : i32 = i; + p.y = (x_203 * 2); + canwalk = true; + } + + continuing { + let x_206 : i32 = j; + j = (x_206 + 1); + } + } + + continuing { + let x_208 : i32 = i; + i = (x_208 + 1); + } + } + let x_211 : i32 = p.x; + let x_213 : i32 = p.y; + map[(x_211 + (x_213 * 16))] = 1; + } else { + let x_217 : i32 = v; + let x_218 : i32 = directions; + d = (x_217 % x_218); + let x_220 : i32 = directions; + let x_221 : i32 = v; + v = (x_221 + x_220); + let x_223 : i32 = d; + let x_224 : bool = (x_223 >= 0); + x_230_phi = x_224; + if (x_224) { + let x_228 : i32 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + let x_230 : bool = x_230_phi; + x_243_phi = x_230; + if (x_230) { + let x_234 : i32 = p.x; + let x_237 : i32 = p.y; + let x_241 : i32 = map[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + let x_243 : bool = x_243_phi; + if (x_243) { + let x_246 : i32 = d; + d = (x_246 - 1); + let x_249 : i32 = p.x; + let x_251 : i32 = p.y; + map[(x_249 + (x_251 * 16))] = 1; + let x_256 : i32 = p.x; + let x_259 : i32 = p.y; + map[((x_256 - 1) + (x_259 * 16))] = 1; + let x_264 : i32 = p.x; + let x_267 : i32 = p.y; + map[((x_264 - 2) + (x_267 * 16))] = 1; + let x_272 : i32 = p.x; + p.x = (x_272 - 2); + } + let x_275 : i32 = d; + let x_276 : bool = (x_275 >= 0); + x_282_phi = x_276; + if (x_276) { + let x_280 : i32 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + let x_282 : bool = x_282_phi; + x_296_phi = x_282; + if (x_282) { + let x_286 : i32 = p.x; + let x_288 : i32 = p.y; + let x_291 : array = map; + map = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + map = x_291; + let x_294 : i32 = map[(x_286 + ((x_288 - 2) * 16))]; + x_295 = (x_294 == 0); + x_296_phi = x_295; + } + let x_296 : bool = x_296_phi; + if (x_296) { + let x_299 : i32 = d; + d = (x_299 - 1); + let x_302 : i32 = p.x; + let x_304 : i32 = p.y; + map[(x_302 + (x_304 * 16))] = 1; + let x_309 : i32 = p.x; + let x_311 : i32 = p.y; + map[(x_309 + ((x_311 - 1) * 16))] = 1; + let x_317 : i32 = p.x; + let x_319 : i32 = p.y; + let x_321 : array = map; + map = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + map = x_321; + map[(x_317 + ((x_319 - 2) * 16))] = 1; + let x_326 : i32 = p.y; + p.y = (x_326 - 2); + } + let x_329 : i32 = d; + let x_330 : bool = (x_329 >= 0); + x_336_phi = x_330; + if (x_330) { + let x_334 : i32 = p.x; + x_335 = (x_334 < 14); + x_336_phi = x_335; + } + let x_336 : bool = x_336_phi; + x_349_phi = x_336; + if (x_336) { + let x_340 : i32 = p.x; + let x_343 : i32 = p.y; + let x_347 : i32 = map[((x_340 + 2) + (x_343 * 16))]; + x_348 = (x_347 == 0); + x_349_phi = x_348; + } + let x_349 : bool = x_349_phi; + if (x_349) { + let x_352 : i32 = d; + d = (x_352 - 1); + let x_355 : i32 = p.x; + let x_357 : i32 = p.y; + map[(x_355 + (x_357 * 16))] = 1; + let x_362 : i32 = p.x; + let x_365 : i32 = p.y; + map[((x_362 + 1) + (x_365 * 16))] = 1; + let x_370 : i32 = p.x; + let x_373 : i32 = p.y; + map[((x_370 + 2) + (x_373 * 16))] = 1; + let x_378 : i32 = p.x; + p.x = (x_378 + 2); + } + let x_381 : i32 = d; + let x_382 : bool = (x_381 >= 0); + x_388_phi = x_382; + if (x_382) { + let x_386 : i32 = p.y; + x_387 = (x_386 < 14); + x_388_phi = x_387; + } + let x_388 : bool = x_388_phi; + x_401_phi = x_388; + if (x_388) { + let x_392 : i32 = p.x; + let x_394 : i32 = p.y; + let x_399 : i32 = map[(x_392 + ((x_394 + 2) * 16))]; + x_400 = (x_399 == 0); + x_401_phi = x_400; + } + let x_401 : bool = x_401_phi; + if (x_401) { + let x_404 : i32 = d; + d = (x_404 - 1); + let x_407 : i32 = p.x; + let x_409 : i32 = p.y; + map[(x_407 + (x_409 * 16))] = 1; + let x_414 : i32 = p.x; + let x_416 : i32 = p.y; + map[(x_414 + ((x_416 + 1) * 16))] = 1; + let x_422 : i32 = p.x; + let x_424 : i32 = p.y; + map[(x_422 + ((x_424 + 2) * 16))] = 1; + let x_430 : i32 = p.y; + p.y = (x_430 + 2); + } + } + let x_434 : i32 = ipos.y; + let x_437 : i32 = ipos.x; + let x_440 : i32 = map[((x_434 * 16) + x_437)]; + if ((x_440 == 1)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + return; + } + + continuing { + let x_444 : bool = canwalk; + if (x_444) { + } else { + break; + } + } + } + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.hlsl new file mode 100644 index 0000000000..cfe3abd180 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.hlsl @@ -0,0 +1,300 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static int map[256] = (int[256])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int i = 0; + int2 p = int2(0, 0); + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + const float4 x_59 = gl_FragCoord; + const float2 x_62 = asfloat(x_7[0].xy); + pos = (float2(x_59.x, x_59.y) / x_62); + const float x_65 = pos.x; + const float x_69 = pos.y; + ipos = int2(int((x_65 * 16.0f)), int((x_69 * 16.0f))); + i = 0; + { + for(; (i < 256); i = (i + 1)) { + map[i] = 0; + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_104 = false; + bool x_124 = false; + bool x_144 = false; + bool x_164 = false; + bool x_105_phi = false; + bool x_125_phi = false; + bool x_145_phi = false; + bool x_165_phi = false; + v = (v + 1); + directions = 0; + const int x_91 = p.x; + const bool x_92 = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + const int x_96 = p.x; + const int x_99 = p.y; + const int x_103 = map[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + if (x_105_phi) { + directions = (directions + 1); + } + const int x_111 = p.y; + const bool x_112 = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + const int x_116 = p.x; + const int x_118 = p.y; + const int x_123 = map[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + if (x_125_phi) { + directions = (directions + 1); + } + const int x_131 = p.x; + const bool x_132 = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + const int x_136 = p.x; + const int x_139 = p.y; + const int x_143 = map[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + if (x_145_phi) { + directions = (directions + 1); + } + const int x_151 = p.y; + const bool x_152 = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + const int x_156 = p.x; + const int x_158 = p.y; + const int x_163 = map[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + if (x_165_phi) { + directions = (directions + 1); + } + bool x_229 = false; + bool x_242 = false; + bool x_281 = false; + bool x_295 = false; + bool x_335 = false; + bool x_348 = false; + bool x_387 = false; + bool x_400 = false; + bool x_230_phi = false; + bool x_243_phi = false; + bool x_282_phi = false; + bool x_296_phi = false; + bool x_336_phi = false; + bool x_349_phi = false; + bool x_388_phi = false; + bool x_401_phi = false; + if ((directions == 0)) { + canwalk = false; + i = 0; + { + for(; (i < 8); i = (i + 1)) { + j = 0; + { + for(; (j < 8); j = (j + 1)) { + const int x_196 = map[((j * 2) + ((i * 2) * 16))]; + if ((x_196 == 0)) { + p.x = (j * 2); + p.y = (i * 2); + canwalk = true; + } + } + } + } + } + const int x_211 = p.x; + const int x_213 = p.y; + map[(x_211 + (x_213 * 16))] = 1; + } else { + d = (v % directions); + v = (v + directions); + const bool x_224 = (d >= 0); + x_230_phi = x_224; + if (x_224) { + const int x_228 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + const bool x_230 = x_230_phi; + x_243_phi = x_230; + if (x_230) { + const int x_234 = p.x; + const int x_237 = p.y; + const int x_241 = map[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + if (x_243_phi) { + d = (d - 1); + const int x_249 = p.x; + const int x_251 = p.y; + map[(x_249 + (x_251 * 16))] = 1; + const int x_256 = p.x; + const int x_259 = p.y; + map[((x_256 - 1) + (x_259 * 16))] = 1; + const int x_264 = p.x; + const int x_267 = p.y; + map[((x_264 - 2) + (x_267 * 16))] = 1; + const int x_272 = p.x; + p.x = (x_272 - 2); + } + const bool x_276 = (d >= 0); + x_282_phi = x_276; + if (x_276) { + const int x_280 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + const bool x_282 = x_282_phi; + x_296_phi = x_282; + if (x_282) { + const int x_286 = p.x; + const int x_288 = p.y; + const int x_291[256] = map; + const int tint_symbol_5[256] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + map = tint_symbol_5; + map = x_291; + const int x_294 = map[(x_286 + ((x_288 - 2) * 16))]; + x_295 = (x_294 == 0); + x_296_phi = x_295; + } + if (x_296_phi) { + d = (d - 1); + const int x_302 = p.x; + const int x_304 = p.y; + map[(x_302 + (x_304 * 16))] = 1; + const int x_309 = p.x; + const int x_311 = p.y; + map[(x_309 + ((x_311 - 1) * 16))] = 1; + const int x_317 = p.x; + const int x_319 = p.y; + const int x_321[256] = map; + const int tint_symbol_6[256] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + map = tint_symbol_6; + map = x_321; + map[(x_317 + ((x_319 - 2) * 16))] = 1; + const int x_326 = p.y; + p.y = (x_326 - 2); + } + const bool x_330 = (d >= 0); + x_336_phi = x_330; + if (x_330) { + const int x_334 = p.x; + x_335 = (x_334 < 14); + x_336_phi = x_335; + } + const bool x_336 = x_336_phi; + x_349_phi = x_336; + if (x_336) { + const int x_340 = p.x; + const int x_343 = p.y; + const int x_347 = map[((x_340 + 2) + (x_343 * 16))]; + x_348 = (x_347 == 0); + x_349_phi = x_348; + } + if (x_349_phi) { + d = (d - 1); + const int x_355 = p.x; + const int x_357 = p.y; + map[(x_355 + (x_357 * 16))] = 1; + const int x_362 = p.x; + const int x_365 = p.y; + map[((x_362 + 1) + (x_365 * 16))] = 1; + const int x_370 = p.x; + const int x_373 = p.y; + map[((x_370 + 2) + (x_373 * 16))] = 1; + const int x_378 = p.x; + p.x = (x_378 + 2); + } + const bool x_382 = (d >= 0); + x_388_phi = x_382; + if (x_382) { + const int x_386 = p.y; + x_387 = (x_386 < 14); + x_388_phi = x_387; + } + const bool x_388 = x_388_phi; + x_401_phi = x_388; + if (x_388) { + const int x_392 = p.x; + const int x_394 = p.y; + const int x_399 = map[(x_392 + ((x_394 + 2) * 16))]; + x_400 = (x_399 == 0); + x_401_phi = x_400; + } + if (x_401_phi) { + d = (d - 1); + const int x_407 = p.x; + const int x_409 = p.y; + map[(x_407 + (x_409 * 16))] = 1; + const int x_414 = p.x; + const int x_416 = p.y; + map[(x_414 + ((x_416 + 1) * 16))] = 1; + const int x_422 = p.x; + const int x_424 = p.y; + map[(x_422 + ((x_424 + 2) * 16))] = 1; + const int x_430 = p.y; + p.y = (x_430 + 2); + } + } + const int x_434 = ipos.y; + const int x_437 = ipos.x; + const int x_440 = map[((x_434 * 16) + x_437)]; + if ((x_440 == 1)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + if (canwalk) { + } else { + break; + } + } + } + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.msl new file mode 100644 index 0000000000..b60fe95824 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.msl @@ -0,0 +1,355 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8, thread float4* const tint_symbol_9) { + float2 pos = 0.0f; + int2 ipos = 0; + int i = 0; + int2 p = 0; + bool canwalk = false; + int v = 0; + int directions = 0; + int j = 0; + int d = 0; + float4 const x_59 = *(tint_symbol_7); + float2 const x_62 = x_7.resolution; + pos = (float2(x_59.x, x_59.y) / x_62); + float const x_65 = pos.x; + float const x_69 = pos.y; + ipos = int2(int((x_65 * 16.0f)), int((x_69 * 16.0f))); + i = 0; + while (true) { + int const x_77 = i; + if ((x_77 < 256)) { + } else { + break; + } + int const x_80 = i; + (*(tint_symbol_8)).arr[x_80] = 0; + { + int const x_82 = i; + i = (x_82 + 1); + } + } + p = int2(0, 0); + canwalk = true; + v = 0; + while (true) { + bool x_104 = false; + bool x_124 = false; + bool x_144 = false; + bool x_164 = false; + bool x_105_phi = false; + bool x_125_phi = false; + bool x_145_phi = false; + bool x_165_phi = false; + int const x_88 = v; + v = (x_88 + 1); + directions = 0; + int const x_91 = p.x; + bool const x_92 = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + int const x_96 = p.x; + int const x_99 = p.y; + int const x_103 = (*(tint_symbol_8)).arr[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + bool const x_105 = x_105_phi; + if (x_105) { + int const x_108 = directions; + directions = (x_108 + 1); + } + int const x_111 = p.y; + bool const x_112 = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + int const x_116 = p.x; + int const x_118 = p.y; + int const x_123 = (*(tint_symbol_8)).arr[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + bool const x_125 = x_125_phi; + if (x_125) { + int const x_128 = directions; + directions = (x_128 + 1); + } + int const x_131 = p.x; + bool const x_132 = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + int const x_136 = p.x; + int const x_139 = p.y; + int const x_143 = (*(tint_symbol_8)).arr[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + bool const x_145 = x_145_phi; + if (x_145) { + int const x_148 = directions; + directions = (x_148 + 1); + } + int const x_151 = p.y; + bool const x_152 = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + int const x_156 = p.x; + int const x_158 = p.y; + int const x_163 = (*(tint_symbol_8)).arr[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + bool const x_165 = x_165_phi; + if (x_165) { + int const x_168 = directions; + directions = (x_168 + 1); + } + bool x_229 = false; + bool x_242 = false; + bool x_281 = false; + bool x_295 = false; + bool x_335 = false; + bool x_348 = false; + bool x_387 = false; + bool x_400 = false; + bool x_230_phi = false; + bool x_243_phi = false; + bool x_282_phi = false; + bool x_296_phi = false; + bool x_336_phi = false; + bool x_349_phi = false; + bool x_388_phi = false; + bool x_401_phi = false; + int const x_170 = directions; + if ((x_170 == 0)) { + canwalk = false; + i = 0; + while (true) { + int const x_179 = i; + if ((x_179 < 8)) { + } else { + break; + } + j = 0; + while (true) { + int const x_186 = j; + if ((x_186 < 8)) { + } else { + break; + } + int const x_189 = j; + int const x_191 = i; + int const x_196 = (*(tint_symbol_8)).arr[((x_189 * 2) + ((x_191 * 2) * 16))]; + if ((x_196 == 0)) { + int const x_200 = j; + p.x = (x_200 * 2); + int const x_203 = i; + p.y = (x_203 * 2); + canwalk = true; + } + { + int const x_206 = j; + j = (x_206 + 1); + } + } + { + int const x_208 = i; + i = (x_208 + 1); + } + } + int const x_211 = p.x; + int const x_213 = p.y; + (*(tint_symbol_8)).arr[(x_211 + (x_213 * 16))] = 1; + } else { + int const x_217 = v; + int const x_218 = directions; + d = (x_217 % x_218); + int const x_220 = directions; + int const x_221 = v; + v = (x_221 + x_220); + int const x_223 = d; + bool const x_224 = (x_223 >= 0); + x_230_phi = x_224; + if (x_224) { + int const x_228 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + bool const x_230 = x_230_phi; + x_243_phi = x_230; + if (x_230) { + int const x_234 = p.x; + int const x_237 = p.y; + int const x_241 = (*(tint_symbol_8)).arr[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + bool const x_243 = x_243_phi; + if (x_243) { + int const x_246 = d; + d = (x_246 - 1); + int const x_249 = p.x; + int const x_251 = p.y; + (*(tint_symbol_8)).arr[(x_249 + (x_251 * 16))] = 1; + int const x_256 = p.x; + int const x_259 = p.y; + (*(tint_symbol_8)).arr[((x_256 - 1) + (x_259 * 16))] = 1; + int const x_264 = p.x; + int const x_267 = p.y; + (*(tint_symbol_8)).arr[((x_264 - 2) + (x_267 * 16))] = 1; + int const x_272 = p.x; + p.x = (x_272 - 2); + } + int const x_275 = d; + bool const x_276 = (x_275 >= 0); + x_282_phi = x_276; + if (x_276) { + int const x_280 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + bool const x_282 = x_282_phi; + x_296_phi = x_282; + if (x_282) { + int const x_286 = p.x; + int const x_288 = p.y; + tint_array_wrapper const x_291 = *(tint_symbol_8); + tint_array_wrapper const tint_symbol_4 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + *(tint_symbol_8) = tint_symbol_4; + *(tint_symbol_8) = x_291; + int const x_294 = (*(tint_symbol_8)).arr[(x_286 + ((x_288 - 2) * 16))]; + x_295 = (x_294 == 0); + x_296_phi = x_295; + } + bool const x_296 = x_296_phi; + if (x_296) { + int const x_299 = d; + d = (x_299 - 1); + int const x_302 = p.x; + int const x_304 = p.y; + (*(tint_symbol_8)).arr[(x_302 + (x_304 * 16))] = 1; + int const x_309 = p.x; + int const x_311 = p.y; + (*(tint_symbol_8)).arr[(x_309 + ((x_311 - 1) * 16))] = 1; + int const x_317 = p.x; + int const x_319 = p.y; + tint_array_wrapper const x_321 = *(tint_symbol_8); + tint_array_wrapper const tint_symbol_5 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + *(tint_symbol_8) = tint_symbol_5; + *(tint_symbol_8) = x_321; + (*(tint_symbol_8)).arr[(x_317 + ((x_319 - 2) * 16))] = 1; + int const x_326 = p.y; + p.y = (x_326 - 2); + } + int const x_329 = d; + bool const x_330 = (x_329 >= 0); + x_336_phi = x_330; + if (x_330) { + int const x_334 = p.x; + x_335 = (x_334 < 14); + x_336_phi = x_335; + } + bool const x_336 = x_336_phi; + x_349_phi = x_336; + if (x_336) { + int const x_340 = p.x; + int const x_343 = p.y; + int const x_347 = (*(tint_symbol_8)).arr[((x_340 + 2) + (x_343 * 16))]; + x_348 = (x_347 == 0); + x_349_phi = x_348; + } + bool const x_349 = x_349_phi; + if (x_349) { + int const x_352 = d; + d = (x_352 - 1); + int const x_355 = p.x; + int const x_357 = p.y; + (*(tint_symbol_8)).arr[(x_355 + (x_357 * 16))] = 1; + int const x_362 = p.x; + int const x_365 = p.y; + (*(tint_symbol_8)).arr[((x_362 + 1) + (x_365 * 16))] = 1; + int const x_370 = p.x; + int const x_373 = p.y; + (*(tint_symbol_8)).arr[((x_370 + 2) + (x_373 * 16))] = 1; + int const x_378 = p.x; + p.x = (x_378 + 2); + } + int const x_381 = d; + bool const x_382 = (x_381 >= 0); + x_388_phi = x_382; + if (x_382) { + int const x_386 = p.y; + x_387 = (x_386 < 14); + x_388_phi = x_387; + } + bool const x_388 = x_388_phi; + x_401_phi = x_388; + if (x_388) { + int const x_392 = p.x; + int const x_394 = p.y; + int const x_399 = (*(tint_symbol_8)).arr[(x_392 + ((x_394 + 2) * 16))]; + x_400 = (x_399 == 0); + x_401_phi = x_400; + } + bool const x_401 = x_401_phi; + if (x_401) { + int const x_404 = d; + d = (x_404 - 1); + int const x_407 = p.x; + int const x_409 = p.y; + (*(tint_symbol_8)).arr[(x_407 + (x_409 * 16))] = 1; + int const x_414 = p.x; + int const x_416 = p.y; + (*(tint_symbol_8)).arr[(x_414 + ((x_416 + 1) * 16))] = 1; + int const x_422 = p.x; + int const x_424 = p.y; + (*(tint_symbol_8)).arr[(x_422 + ((x_424 + 2) * 16))] = 1; + int const x_430 = p.y; + p.y = (x_430 + 2); + } + } + int const x_434 = ipos.y; + int const x_437 = ipos.x; + int const x_440 = (*(tint_symbol_8)).arr[((x_434 * 16) + x_437)]; + if ((x_440 == 1)) { + *(tint_symbol_9) = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; + } + { + bool const x_444 = canwalk; + if (x_444) { + } else { + break; + } + } + } + *(tint_symbol_9) = float4(0.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_10 = 0.0f; + thread tint_array_wrapper tint_symbol_11 = {}; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_10), &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_6 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.spvasm new file mode 100644 index 0000000000..577b0fa261 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.spvasm @@ -0,0 +1,782 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 512 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_7 "x_7" + OpName %map "map" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %ipos "ipos" + OpName %i "i" + OpName %p "p" + OpName %canwalk "canwalk" + OpName %v "v" + OpName %directions "directions" + OpName %j "j" + OpName %d "d" + OpName %x_104 "x_104" + OpName %x_124 "x_124" + OpName %x_144 "x_144" + OpName %x_164 "x_164" + OpName %x_105_phi "x_105_phi" + OpName %x_125_phi "x_125_phi" + OpName %x_145_phi "x_145_phi" + OpName %x_165_phi "x_165_phi" + OpName %x_229 "x_229" + OpName %x_242 "x_242" + OpName %x_281 "x_281" + OpName %x_295 "x_295" + OpName %x_335 "x_335" + OpName %x_348 "x_348" + OpName %x_387 "x_387" + OpName %x_400 "x_400" + OpName %x_230_phi "x_230_phi" + OpName %x_243_phi "x_243_phi" + OpName %x_282_phi "x_282_phi" + OpName %x_296_phi "x_296_phi" + OpName %x_336_phi "x_336_phi" + OpName %x_349_phi "x_349_phi" + OpName %x_388_phi "x_388_phi" + OpName %x_401_phi "x_401_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Private__arr_int_uint_256 = OpTypePointer Private %_arr_int_uint_256 + %16 = OpConstantNull %_arr_int_uint_256 + %map = OpVariable %_ptr_Private__arr_int_uint_256 Private %16 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %28 = OpConstantNull %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %32 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %float_16 = OpConstant %float 16 + %int_0 = OpConstant %int 0 + %int_256 = OpConstant %int 256 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %83 = OpConstantComposite %v2int %int_0 %int_0 + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %int_16 = OpConstant %int 16 + %int_14 = OpConstant %int 14 + %false = OpConstantFalse %bool + %int_8 = OpConstant %int 8 + %331 = OpConstantComposite %_arr_int_uint_256 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 + %float_1 = OpConstant %float 1 + %492 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %498 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %499 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %22 + %25 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %28 + %ipos = OpVariable %_ptr_Function_v2int Function %32 + %i = OpVariable %_ptr_Function_int Function %35 + %p = OpVariable %_ptr_Function_v2int Function %32 + %canwalk = OpVariable %_ptr_Function_bool Function %40 + %v = OpVariable %_ptr_Function_int Function %35 + %directions = OpVariable %_ptr_Function_int Function %35 + %j = OpVariable %_ptr_Function_int Function %35 + %d = OpVariable %_ptr_Function_int Function %35 + %x_104 = OpVariable %_ptr_Function_bool Function %40 + %x_124 = OpVariable %_ptr_Function_bool Function %40 + %x_144 = OpVariable %_ptr_Function_bool Function %40 + %x_164 = OpVariable %_ptr_Function_bool Function %40 + %x_105_phi = OpVariable %_ptr_Function_bool Function %40 + %x_125_phi = OpVariable %_ptr_Function_bool Function %40 + %x_145_phi = OpVariable %_ptr_Function_bool Function %40 + %x_165_phi = OpVariable %_ptr_Function_bool Function %40 + %x_229 = OpVariable %_ptr_Function_bool Function %40 + %x_242 = OpVariable %_ptr_Function_bool Function %40 + %x_281 = OpVariable %_ptr_Function_bool Function %40 + %x_295 = OpVariable %_ptr_Function_bool Function %40 + %x_335 = OpVariable %_ptr_Function_bool Function %40 + %x_348 = OpVariable %_ptr_Function_bool Function %40 + %x_387 = OpVariable %_ptr_Function_bool Function %40 + %x_400 = OpVariable %_ptr_Function_bool Function %40 + %x_230_phi = OpVariable %_ptr_Function_bool Function %40 + %x_243_phi = OpVariable %_ptr_Function_bool Function %40 + %x_282_phi = OpVariable %_ptr_Function_bool Function %40 + %x_296_phi = OpVariable %_ptr_Function_bool Function %40 + %x_336_phi = OpVariable %_ptr_Function_bool Function %40 + %x_349_phi = OpVariable %_ptr_Function_bool Function %40 + %x_388_phi = OpVariable %_ptr_Function_bool Function %40 + %x_401_phi = OpVariable %_ptr_Function_bool Function %40 + %45 = OpLoad %v4float %gl_FragCoord + %48 = OpAccessChain %_ptr_Uniform_v2float %x_7 %uint_0 + %49 = OpLoad %v2float %48 + %50 = OpCompositeExtract %float %45 0 + %51 = OpCompositeExtract %float %45 1 + %52 = OpCompositeConstruct %v2float %50 %51 + %53 = OpFDiv %v2float %52 %49 + OpStore %pos %53 + %55 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %56 = OpLoad %float %55 + %58 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %59 = OpLoad %float %58 + %62 = OpFMul %float %56 %float_16 + %60 = OpConvertFToS %int %62 + %64 = OpFMul %float %59 %float_16 + %63 = OpConvertFToS %int %64 + %65 = OpCompositeConstruct %v2int %60 %63 + OpStore %ipos %65 + OpStore %i %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %i + %73 = OpSLessThan %bool %71 %int_256 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpBranch %74 + %76 = OpLabel + OpBranch %68 + %74 = OpLabel + %77 = OpLoad %int %i + %79 = OpAccessChain %_ptr_Private_int %map %77 + OpStore %79 %int_0 + OpBranch %69 + %69 = OpLabel + %80 = OpLoad %int %i + %82 = OpIAdd %int %80 %int_1 + OpStore %i %82 + OpBranch %67 + %68 = OpLabel + OpStore %p %83 + OpStore %canwalk %true + OpStore %v %int_0 + OpBranch %85 + %85 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %97 = OpLoad %int %v + %98 = OpIAdd %int %97 %int_1 + OpStore %v %98 + OpStore %directions %int_0 + %99 = OpAccessChain %_ptr_Function_int %p %uint_0 + %100 = OpLoad %int %99 + %101 = OpSGreaterThan %bool %100 %int_0 + OpStore %x_105_phi %101 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + %104 = OpAccessChain %_ptr_Function_int %p %uint_0 + %105 = OpLoad %int %104 + %106 = OpAccessChain %_ptr_Function_int %p %uint_1 + %107 = OpLoad %int %106 + %109 = OpISub %int %105 %int_2 + %111 = OpIMul %int %107 %int_16 + %112 = OpIAdd %int %109 %111 + %113 = OpAccessChain %_ptr_Private_int %map %112 + %114 = OpLoad %int %113 + %115 = OpIEqual %bool %114 %int_0 + OpStore %x_104 %115 + %116 = OpLoad %bool %x_104 + OpStore %x_105_phi %116 + OpBranch %102 + %102 = OpLabel + %117 = OpLoad %bool %x_105_phi + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %120 = OpLoad %int %directions + %121 = OpIAdd %int %120 %int_1 + OpStore %directions %121 + OpBranch %118 + %118 = OpLabel + %122 = OpAccessChain %_ptr_Function_int %p %uint_1 + %123 = OpLoad %int %122 + %124 = OpSGreaterThan %bool %123 %int_0 + OpStore %x_125_phi %124 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %125 + %126 = OpLabel + %127 = OpAccessChain %_ptr_Function_int %p %uint_0 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Function_int %p %uint_1 + %130 = OpLoad %int %129 + %131 = OpISub %int %130 %int_2 + %132 = OpIMul %int %131 %int_16 + %133 = OpIAdd %int %128 %132 + %134 = OpAccessChain %_ptr_Private_int %map %133 + %135 = OpLoad %int %134 + %136 = OpIEqual %bool %135 %int_0 + OpStore %x_124 %136 + %137 = OpLoad %bool %x_124 + OpStore %x_125_phi %137 + OpBranch %125 + %125 = OpLabel + %138 = OpLoad %bool %x_125_phi + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpLoad %int %directions + %142 = OpIAdd %int %141 %int_1 + OpStore %directions %142 + OpBranch %139 + %139 = OpLabel + %143 = OpAccessChain %_ptr_Function_int %p %uint_0 + %144 = OpLoad %int %143 + %146 = OpSLessThan %bool %144 %int_14 + OpStore %x_145_phi %146 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %147 + %148 = OpLabel + %149 = OpAccessChain %_ptr_Function_int %p %uint_0 + %150 = OpLoad %int %149 + %151 = OpAccessChain %_ptr_Function_int %p %uint_1 + %152 = OpLoad %int %151 + %153 = OpIAdd %int %150 %int_2 + %154 = OpIMul %int %152 %int_16 + %155 = OpIAdd %int %153 %154 + %156 = OpAccessChain %_ptr_Private_int %map %155 + %157 = OpLoad %int %156 + %158 = OpIEqual %bool %157 %int_0 + OpStore %x_144 %158 + %159 = OpLoad %bool %x_144 + OpStore %x_145_phi %159 + OpBranch %147 + %147 = OpLabel + %160 = OpLoad %bool %x_145_phi + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %161 + %162 = OpLabel + %163 = OpLoad %int %directions + %164 = OpIAdd %int %163 %int_1 + OpStore %directions %164 + OpBranch %161 + %161 = OpLabel + %165 = OpAccessChain %_ptr_Function_int %p %uint_1 + %166 = OpLoad %int %165 + %167 = OpSLessThan %bool %166 %int_14 + OpStore %x_165_phi %167 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %168 + %169 = OpLabel + %170 = OpAccessChain %_ptr_Function_int %p %uint_0 + %171 = OpLoad %int %170 + %172 = OpAccessChain %_ptr_Function_int %p %uint_1 + %173 = OpLoad %int %172 + %174 = OpIAdd %int %173 %int_2 + %175 = OpIMul %int %174 %int_16 + %176 = OpIAdd %int %171 %175 + %177 = OpAccessChain %_ptr_Private_int %map %176 + %178 = OpLoad %int %177 + %179 = OpIEqual %bool %178 %int_0 + OpStore %x_164 %179 + %180 = OpLoad %bool %x_164 + OpStore %x_165_phi %180 + OpBranch %168 + %168 = OpLabel + %181 = OpLoad %bool %x_165_phi + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %184 = OpLoad %int %directions + %185 = OpIAdd %int %184 %int_1 + OpStore %directions %185 + OpBranch %182 + %182 = OpLabel + %202 = OpLoad %int %directions + %203 = OpIEqual %bool %202 %int_0 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %206 + %205 = OpLabel + OpStore %canwalk %false + OpStore %i %int_0 + OpBranch %208 + %208 = OpLabel + OpLoopMerge %209 %210 None + OpBranch %211 + %211 = OpLabel + %212 = OpLoad %int %i + %214 = OpSLessThan %bool %212 %int_8 + OpSelectionMerge %215 None + OpBranchConditional %214 %216 %217 + %216 = OpLabel + OpBranch %215 + %217 = OpLabel + OpBranch %209 + %215 = OpLabel + OpStore %j %int_0 + OpBranch %218 + %218 = OpLabel + OpLoopMerge %219 %220 None + OpBranch %221 + %221 = OpLabel + %222 = OpLoad %int %j + %223 = OpSLessThan %bool %222 %int_8 + OpSelectionMerge %224 None + OpBranchConditional %223 %225 %226 + %225 = OpLabel + OpBranch %224 + %226 = OpLabel + OpBranch %219 + %224 = OpLabel + %227 = OpLoad %int %j + %228 = OpLoad %int %i + %229 = OpIMul %int %227 %int_2 + %230 = OpIMul %int %228 %int_2 + %231 = OpIMul %int %230 %int_16 + %232 = OpIAdd %int %229 %231 + %233 = OpAccessChain %_ptr_Private_int %map %232 + %234 = OpLoad %int %233 + %235 = OpIEqual %bool %234 %int_0 + OpSelectionMerge %236 None + OpBranchConditional %235 %237 %236 + %237 = OpLabel + %238 = OpLoad %int %j + %239 = OpAccessChain %_ptr_Function_int %p %uint_0 + %240 = OpIMul %int %238 %int_2 + OpStore %239 %240 + %241 = OpLoad %int %i + %242 = OpAccessChain %_ptr_Function_int %p %uint_1 + %243 = OpIMul %int %241 %int_2 + OpStore %242 %243 + OpStore %canwalk %true + OpBranch %236 + %236 = OpLabel + OpBranch %220 + %220 = OpLabel + %244 = OpLoad %int %j + %245 = OpIAdd %int %244 %int_1 + OpStore %j %245 + OpBranch %218 + %219 = OpLabel + OpBranch %210 + %210 = OpLabel + %246 = OpLoad %int %i + %247 = OpIAdd %int %246 %int_1 + OpStore %i %247 + OpBranch %208 + %209 = OpLabel + %248 = OpAccessChain %_ptr_Function_int %p %uint_0 + %249 = OpLoad %int %248 + %250 = OpAccessChain %_ptr_Function_int %p %uint_1 + %251 = OpLoad %int %250 + %252 = OpIMul %int %251 %int_16 + %253 = OpIAdd %int %249 %252 + %254 = OpAccessChain %_ptr_Private_int %map %253 + OpStore %254 %int_1 + OpBranch %204 + %206 = OpLabel + %255 = OpLoad %int %v + %256 = OpLoad %int %directions + %257 = OpSMod %int %255 %256 + OpStore %d %257 + %258 = OpLoad %int %directions + %259 = OpLoad %int %v + %260 = OpIAdd %int %259 %258 + OpStore %v %260 + %261 = OpLoad %int %d + %262 = OpSGreaterThanEqual %bool %261 %int_0 + OpStore %x_230_phi %262 + OpSelectionMerge %263 None + OpBranchConditional %262 %264 %263 + %264 = OpLabel + %265 = OpAccessChain %_ptr_Function_int %p %uint_0 + %266 = OpLoad %int %265 + %267 = OpSGreaterThan %bool %266 %int_0 + OpStore %x_229 %267 + %268 = OpLoad %bool %x_229 + OpStore %x_230_phi %268 + OpBranch %263 + %263 = OpLabel + %269 = OpLoad %bool %x_230_phi + OpStore %x_243_phi %269 + OpSelectionMerge %270 None + OpBranchConditional %269 %271 %270 + %271 = OpLabel + %272 = OpAccessChain %_ptr_Function_int %p %uint_0 + %273 = OpLoad %int %272 + %274 = OpAccessChain %_ptr_Function_int %p %uint_1 + %275 = OpLoad %int %274 + %276 = OpISub %int %273 %int_2 + %277 = OpIMul %int %275 %int_16 + %278 = OpIAdd %int %276 %277 + %279 = OpAccessChain %_ptr_Private_int %map %278 + %280 = OpLoad %int %279 + %281 = OpIEqual %bool %280 %int_0 + OpStore %x_242 %281 + %282 = OpLoad %bool %x_242 + OpStore %x_243_phi %282 + OpBranch %270 + %270 = OpLabel + %283 = OpLoad %bool %x_243_phi + OpSelectionMerge %284 None + OpBranchConditional %283 %285 %284 + %285 = OpLabel + %286 = OpLoad %int %d + %287 = OpISub %int %286 %int_1 + OpStore %d %287 + %288 = OpAccessChain %_ptr_Function_int %p %uint_0 + %289 = OpLoad %int %288 + %290 = OpAccessChain %_ptr_Function_int %p %uint_1 + %291 = OpLoad %int %290 + %292 = OpIMul %int %291 %int_16 + %293 = OpIAdd %int %289 %292 + %294 = OpAccessChain %_ptr_Private_int %map %293 + OpStore %294 %int_1 + %295 = OpAccessChain %_ptr_Function_int %p %uint_0 + %296 = OpLoad %int %295 + %297 = OpAccessChain %_ptr_Function_int %p %uint_1 + %298 = OpLoad %int %297 + %299 = OpISub %int %296 %int_1 + %300 = OpIMul %int %298 %int_16 + %301 = OpIAdd %int %299 %300 + %302 = OpAccessChain %_ptr_Private_int %map %301 + OpStore %302 %int_1 + %303 = OpAccessChain %_ptr_Function_int %p %uint_0 + %304 = OpLoad %int %303 + %305 = OpAccessChain %_ptr_Function_int %p %uint_1 + %306 = OpLoad %int %305 + %307 = OpISub %int %304 %int_2 + %308 = OpIMul %int %306 %int_16 + %309 = OpIAdd %int %307 %308 + %310 = OpAccessChain %_ptr_Private_int %map %309 + OpStore %310 %int_1 + %311 = OpAccessChain %_ptr_Function_int %p %uint_0 + %312 = OpLoad %int %311 + %313 = OpAccessChain %_ptr_Function_int %p %uint_0 + %314 = OpISub %int %312 %int_2 + OpStore %313 %314 + OpBranch %284 + %284 = OpLabel + %315 = OpLoad %int %d + %316 = OpSGreaterThanEqual %bool %315 %int_0 + OpStore %x_282_phi %316 + OpSelectionMerge %317 None + OpBranchConditional %316 %318 %317 + %318 = OpLabel + %319 = OpAccessChain %_ptr_Function_int %p %uint_1 + %320 = OpLoad %int %319 + %321 = OpSGreaterThan %bool %320 %int_0 + OpStore %x_281 %321 + %322 = OpLoad %bool %x_281 + OpStore %x_282_phi %322 + OpBranch %317 + %317 = OpLabel + %323 = OpLoad %bool %x_282_phi + OpStore %x_296_phi %323 + OpSelectionMerge %324 None + OpBranchConditional %323 %325 %324 + %325 = OpLabel + %326 = OpAccessChain %_ptr_Function_int %p %uint_0 + %327 = OpLoad %int %326 + %328 = OpAccessChain %_ptr_Function_int %p %uint_1 + %329 = OpLoad %int %328 + %330 = OpLoad %_arr_int_uint_256 %map + OpStore %map %331 + OpStore %map %330 + %332 = OpISub %int %329 %int_2 + %333 = OpIMul %int %332 %int_16 + %334 = OpIAdd %int %327 %333 + %335 = OpAccessChain %_ptr_Private_int %map %334 + %336 = OpLoad %int %335 + %337 = OpIEqual %bool %336 %int_0 + OpStore %x_295 %337 + %338 = OpLoad %bool %x_295 + OpStore %x_296_phi %338 + OpBranch %324 + %324 = OpLabel + %339 = OpLoad %bool %x_296_phi + OpSelectionMerge %340 None + OpBranchConditional %339 %341 %340 + %341 = OpLabel + %342 = OpLoad %int %d + %343 = OpISub %int %342 %int_1 + OpStore %d %343 + %344 = OpAccessChain %_ptr_Function_int %p %uint_0 + %345 = OpLoad %int %344 + %346 = OpAccessChain %_ptr_Function_int %p %uint_1 + %347 = OpLoad %int %346 + %348 = OpIMul %int %347 %int_16 + %349 = OpIAdd %int %345 %348 + %350 = OpAccessChain %_ptr_Private_int %map %349 + OpStore %350 %int_1 + %351 = OpAccessChain %_ptr_Function_int %p %uint_0 + %352 = OpLoad %int %351 + %353 = OpAccessChain %_ptr_Function_int %p %uint_1 + %354 = OpLoad %int %353 + %355 = OpISub %int %354 %int_1 + %356 = OpIMul %int %355 %int_16 + %357 = OpIAdd %int %352 %356 + %358 = OpAccessChain %_ptr_Private_int %map %357 + OpStore %358 %int_1 + %359 = OpAccessChain %_ptr_Function_int %p %uint_0 + %360 = OpLoad %int %359 + %361 = OpAccessChain %_ptr_Function_int %p %uint_1 + %362 = OpLoad %int %361 + %363 = OpLoad %_arr_int_uint_256 %map + OpStore %map %331 + OpStore %map %363 + %364 = OpISub %int %362 %int_2 + %365 = OpIMul %int %364 %int_16 + %366 = OpIAdd %int %360 %365 + %367 = OpAccessChain %_ptr_Private_int %map %366 + OpStore %367 %int_1 + %368 = OpAccessChain %_ptr_Function_int %p %uint_1 + %369 = OpLoad %int %368 + %370 = OpAccessChain %_ptr_Function_int %p %uint_1 + %371 = OpISub %int %369 %int_2 + OpStore %370 %371 + OpBranch %340 + %340 = OpLabel + %372 = OpLoad %int %d + %373 = OpSGreaterThanEqual %bool %372 %int_0 + OpStore %x_336_phi %373 + OpSelectionMerge %374 None + OpBranchConditional %373 %375 %374 + %375 = OpLabel + %376 = OpAccessChain %_ptr_Function_int %p %uint_0 + %377 = OpLoad %int %376 + %378 = OpSLessThan %bool %377 %int_14 + OpStore %x_335 %378 + %379 = OpLoad %bool %x_335 + OpStore %x_336_phi %379 + OpBranch %374 + %374 = OpLabel + %380 = OpLoad %bool %x_336_phi + OpStore %x_349_phi %380 + OpSelectionMerge %381 None + OpBranchConditional %380 %382 %381 + %382 = OpLabel + %383 = OpAccessChain %_ptr_Function_int %p %uint_0 + %384 = OpLoad %int %383 + %385 = OpAccessChain %_ptr_Function_int %p %uint_1 + %386 = OpLoad %int %385 + %387 = OpIAdd %int %384 %int_2 + %388 = OpIMul %int %386 %int_16 + %389 = OpIAdd %int %387 %388 + %390 = OpAccessChain %_ptr_Private_int %map %389 + %391 = OpLoad %int %390 + %392 = OpIEqual %bool %391 %int_0 + OpStore %x_348 %392 + %393 = OpLoad %bool %x_348 + OpStore %x_349_phi %393 + OpBranch %381 + %381 = OpLabel + %394 = OpLoad %bool %x_349_phi + OpSelectionMerge %395 None + OpBranchConditional %394 %396 %395 + %396 = OpLabel + %397 = OpLoad %int %d + %398 = OpISub %int %397 %int_1 + OpStore %d %398 + %399 = OpAccessChain %_ptr_Function_int %p %uint_0 + %400 = OpLoad %int %399 + %401 = OpAccessChain %_ptr_Function_int %p %uint_1 + %402 = OpLoad %int %401 + %403 = OpIMul %int %402 %int_16 + %404 = OpIAdd %int %400 %403 + %405 = OpAccessChain %_ptr_Private_int %map %404 + OpStore %405 %int_1 + %406 = OpAccessChain %_ptr_Function_int %p %uint_0 + %407 = OpLoad %int %406 + %408 = OpAccessChain %_ptr_Function_int %p %uint_1 + %409 = OpLoad %int %408 + %410 = OpIAdd %int %407 %int_1 + %411 = OpIMul %int %409 %int_16 + %412 = OpIAdd %int %410 %411 + %413 = OpAccessChain %_ptr_Private_int %map %412 + OpStore %413 %int_1 + %414 = OpAccessChain %_ptr_Function_int %p %uint_0 + %415 = OpLoad %int %414 + %416 = OpAccessChain %_ptr_Function_int %p %uint_1 + %417 = OpLoad %int %416 + %418 = OpIAdd %int %415 %int_2 + %419 = OpIMul %int %417 %int_16 + %420 = OpIAdd %int %418 %419 + %421 = OpAccessChain %_ptr_Private_int %map %420 + OpStore %421 %int_1 + %422 = OpAccessChain %_ptr_Function_int %p %uint_0 + %423 = OpLoad %int %422 + %424 = OpAccessChain %_ptr_Function_int %p %uint_0 + %425 = OpIAdd %int %423 %int_2 + OpStore %424 %425 + OpBranch %395 + %395 = OpLabel + %426 = OpLoad %int %d + %427 = OpSGreaterThanEqual %bool %426 %int_0 + OpStore %x_388_phi %427 + OpSelectionMerge %428 None + OpBranchConditional %427 %429 %428 + %429 = OpLabel + %430 = OpAccessChain %_ptr_Function_int %p %uint_1 + %431 = OpLoad %int %430 + %432 = OpSLessThan %bool %431 %int_14 + OpStore %x_387 %432 + %433 = OpLoad %bool %x_387 + OpStore %x_388_phi %433 + OpBranch %428 + %428 = OpLabel + %434 = OpLoad %bool %x_388_phi + OpStore %x_401_phi %434 + OpSelectionMerge %435 None + OpBranchConditional %434 %436 %435 + %436 = OpLabel + %437 = OpAccessChain %_ptr_Function_int %p %uint_0 + %438 = OpLoad %int %437 + %439 = OpAccessChain %_ptr_Function_int %p %uint_1 + %440 = OpLoad %int %439 + %441 = OpIAdd %int %440 %int_2 + %442 = OpIMul %int %441 %int_16 + %443 = OpIAdd %int %438 %442 + %444 = OpAccessChain %_ptr_Private_int %map %443 + %445 = OpLoad %int %444 + %446 = OpIEqual %bool %445 %int_0 + OpStore %x_400 %446 + %447 = OpLoad %bool %x_400 + OpStore %x_401_phi %447 + OpBranch %435 + %435 = OpLabel + %448 = OpLoad %bool %x_401_phi + OpSelectionMerge %449 None + OpBranchConditional %448 %450 %449 + %450 = OpLabel + %451 = OpLoad %int %d + %452 = OpISub %int %451 %int_1 + OpStore %d %452 + %453 = OpAccessChain %_ptr_Function_int %p %uint_0 + %454 = OpLoad %int %453 + %455 = OpAccessChain %_ptr_Function_int %p %uint_1 + %456 = OpLoad %int %455 + %457 = OpIMul %int %456 %int_16 + %458 = OpIAdd %int %454 %457 + %459 = OpAccessChain %_ptr_Private_int %map %458 + OpStore %459 %int_1 + %460 = OpAccessChain %_ptr_Function_int %p %uint_0 + %461 = OpLoad %int %460 + %462 = OpAccessChain %_ptr_Function_int %p %uint_1 + %463 = OpLoad %int %462 + %464 = OpIAdd %int %463 %int_1 + %465 = OpIMul %int %464 %int_16 + %466 = OpIAdd %int %461 %465 + %467 = OpAccessChain %_ptr_Private_int %map %466 + OpStore %467 %int_1 + %468 = OpAccessChain %_ptr_Function_int %p %uint_0 + %469 = OpLoad %int %468 + %470 = OpAccessChain %_ptr_Function_int %p %uint_1 + %471 = OpLoad %int %470 + %472 = OpIAdd %int %471 %int_2 + %473 = OpIMul %int %472 %int_16 + %474 = OpIAdd %int %469 %473 + %475 = OpAccessChain %_ptr_Private_int %map %474 + OpStore %475 %int_1 + %476 = OpAccessChain %_ptr_Function_int %p %uint_1 + %477 = OpLoad %int %476 + %478 = OpAccessChain %_ptr_Function_int %p %uint_1 + %479 = OpIAdd %int %477 %int_2 + OpStore %478 %479 + OpBranch %449 + %449 = OpLabel + OpBranch %204 + %204 = OpLabel + %480 = OpAccessChain %_ptr_Function_int %ipos %uint_1 + %481 = OpLoad %int %480 + %482 = OpAccessChain %_ptr_Function_int %ipos %uint_0 + %483 = OpLoad %int %482 + %484 = OpIMul %int %481 %int_16 + %485 = OpIAdd %int %484 %483 + %486 = OpAccessChain %_ptr_Private_int %map %485 + %487 = OpLoad %int %486 + %488 = OpIEqual %bool %487 %int_1 + OpSelectionMerge %489 None + OpBranchConditional %488 %490 %489 + %490 = OpLabel + OpStore %x_GLF_color %492 + OpReturn + %489 = OpLabel + OpBranch %87 + %87 = OpLabel + %493 = OpLoad %bool %canwalk + OpSelectionMerge %494 None + OpBranchConditional %493 %495 %496 + %495 = OpLabel + OpBranch %494 + %496 = OpLabel + OpBranch %86 + %494 = OpLabel + OpBranch %85 + %86 = OpLabel + OpStore %x_GLF_color %498 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %499 +%tint_symbol_1 = OpFunctionParameter %main_out + %503 = OpLabel + %504 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %504 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %506 = OpLabel + %507 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %507 + %508 = OpFunctionCall %void %main_1 + %510 = OpLoad %v4float %x_GLF_color + %511 = OpCompositeConstruct %main_out %510 + %509 = OpFunctionCall %void %tint_symbol_3 %511 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 87[%87] is not post dominated by the back-edge block 494[%494] + %494 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.wgsl new file mode 100644 index 0000000000..774e546e7f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/2.wgsl.expected.wgsl @@ -0,0 +1,354 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var map : array; + +var x_GLF_color : vec4; + +fn main_1() { + var pos : vec2; + var ipos : vec2; + var i : i32; + var p : vec2; + var canwalk : bool; + var v : i32; + var directions : i32; + var j : i32; + var d : i32; + let x_59 : vec4 = gl_FragCoord; + let x_62 : vec2 = x_7.resolution; + pos = (vec2(x_59.x, x_59.y) / x_62); + let x_65 : f32 = pos.x; + let x_69 : f32 = pos.y; + ipos = vec2(i32((x_65 * 16.0)), i32((x_69 * 16.0))); + i = 0; + loop { + let x_77 : i32 = i; + if ((x_77 < 256)) { + } else { + break; + } + let x_80 : i32 = i; + map[x_80] = 0; + + continuing { + let x_82 : i32 = i; + i = (x_82 + 1); + } + } + p = vec2(0, 0); + canwalk = true; + v = 0; + loop { + var x_104 : bool; + var x_124 : bool; + var x_144 : bool; + var x_164 : bool; + var x_105_phi : bool; + var x_125_phi : bool; + var x_145_phi : bool; + var x_165_phi : bool; + let x_88 : i32 = v; + v = (x_88 + 1); + directions = 0; + let x_91 : i32 = p.x; + let x_92 : bool = (x_91 > 0); + x_105_phi = x_92; + if (x_92) { + let x_96 : i32 = p.x; + let x_99 : i32 = p.y; + let x_103 : i32 = map[((x_96 - 2) + (x_99 * 16))]; + x_104 = (x_103 == 0); + x_105_phi = x_104; + } + let x_105 : bool = x_105_phi; + if (x_105) { + let x_108 : i32 = directions; + directions = (x_108 + 1); + } + let x_111 : i32 = p.y; + let x_112 : bool = (x_111 > 0); + x_125_phi = x_112; + if (x_112) { + let x_116 : i32 = p.x; + let x_118 : i32 = p.y; + let x_123 : i32 = map[(x_116 + ((x_118 - 2) * 16))]; + x_124 = (x_123 == 0); + x_125_phi = x_124; + } + let x_125 : bool = x_125_phi; + if (x_125) { + let x_128 : i32 = directions; + directions = (x_128 + 1); + } + let x_131 : i32 = p.x; + let x_132 : bool = (x_131 < 14); + x_145_phi = x_132; + if (x_132) { + let x_136 : i32 = p.x; + let x_139 : i32 = p.y; + let x_143 : i32 = map[((x_136 + 2) + (x_139 * 16))]; + x_144 = (x_143 == 0); + x_145_phi = x_144; + } + let x_145 : bool = x_145_phi; + if (x_145) { + let x_148 : i32 = directions; + directions = (x_148 + 1); + } + let x_151 : i32 = p.y; + let x_152 : bool = (x_151 < 14); + x_165_phi = x_152; + if (x_152) { + let x_156 : i32 = p.x; + let x_158 : i32 = p.y; + let x_163 : i32 = map[(x_156 + ((x_158 + 2) * 16))]; + x_164 = (x_163 == 0); + x_165_phi = x_164; + } + let x_165 : bool = x_165_phi; + if (x_165) { + let x_168 : i32 = directions; + directions = (x_168 + 1); + } + var x_229 : bool; + var x_242 : bool; + var x_281 : bool; + var x_295 : bool; + var x_335 : bool; + var x_348 : bool; + var x_387 : bool; + var x_400 : bool; + var x_230_phi : bool; + var x_243_phi : bool; + var x_282_phi : bool; + var x_296_phi : bool; + var x_336_phi : bool; + var x_349_phi : bool; + var x_388_phi : bool; + var x_401_phi : bool; + let x_170 : i32 = directions; + if ((x_170 == 0)) { + canwalk = false; + i = 0; + loop { + let x_179 : i32 = i; + if ((x_179 < 8)) { + } else { + break; + } + j = 0; + loop { + let x_186 : i32 = j; + if ((x_186 < 8)) { + } else { + break; + } + let x_189 : i32 = j; + let x_191 : i32 = i; + let x_196 : i32 = map[((x_189 * 2) + ((x_191 * 2) * 16))]; + if ((x_196 == 0)) { + let x_200 : i32 = j; + p.x = (x_200 * 2); + let x_203 : i32 = i; + p.y = (x_203 * 2); + canwalk = true; + } + + continuing { + let x_206 : i32 = j; + j = (x_206 + 1); + } + } + + continuing { + let x_208 : i32 = i; + i = (x_208 + 1); + } + } + let x_211 : i32 = p.x; + let x_213 : i32 = p.y; + map[(x_211 + (x_213 * 16))] = 1; + } else { + let x_217 : i32 = v; + let x_218 : i32 = directions; + d = (x_217 % x_218); + let x_220 : i32 = directions; + let x_221 : i32 = v; + v = (x_221 + x_220); + let x_223 : i32 = d; + let x_224 : bool = (x_223 >= 0); + x_230_phi = x_224; + if (x_224) { + let x_228 : i32 = p.x; + x_229 = (x_228 > 0); + x_230_phi = x_229; + } + let x_230 : bool = x_230_phi; + x_243_phi = x_230; + if (x_230) { + let x_234 : i32 = p.x; + let x_237 : i32 = p.y; + let x_241 : i32 = map[((x_234 - 2) + (x_237 * 16))]; + x_242 = (x_241 == 0); + x_243_phi = x_242; + } + let x_243 : bool = x_243_phi; + if (x_243) { + let x_246 : i32 = d; + d = (x_246 - 1); + let x_249 : i32 = p.x; + let x_251 : i32 = p.y; + map[(x_249 + (x_251 * 16))] = 1; + let x_256 : i32 = p.x; + let x_259 : i32 = p.y; + map[((x_256 - 1) + (x_259 * 16))] = 1; + let x_264 : i32 = p.x; + let x_267 : i32 = p.y; + map[((x_264 - 2) + (x_267 * 16))] = 1; + let x_272 : i32 = p.x; + p.x = (x_272 - 2); + } + let x_275 : i32 = d; + let x_276 : bool = (x_275 >= 0); + x_282_phi = x_276; + if (x_276) { + let x_280 : i32 = p.y; + x_281 = (x_280 > 0); + x_282_phi = x_281; + } + let x_282 : bool = x_282_phi; + x_296_phi = x_282; + if (x_282) { + let x_286 : i32 = p.x; + let x_288 : i32 = p.y; + let x_291 : array = map; + map = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + map = x_291; + let x_294 : i32 = map[(x_286 + ((x_288 - 2) * 16))]; + x_295 = (x_294 == 0); + x_296_phi = x_295; + } + let x_296 : bool = x_296_phi; + if (x_296) { + let x_299 : i32 = d; + d = (x_299 - 1); + let x_302 : i32 = p.x; + let x_304 : i32 = p.y; + map[(x_302 + (x_304 * 16))] = 1; + let x_309 : i32 = p.x; + let x_311 : i32 = p.y; + map[(x_309 + ((x_311 - 1) * 16))] = 1; + let x_317 : i32 = p.x; + let x_319 : i32 = p.y; + let x_321 : array = map; + map = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + map = x_321; + map[(x_317 + ((x_319 - 2) * 16))] = 1; + let x_326 : i32 = p.y; + p.y = (x_326 - 2); + } + let x_329 : i32 = d; + let x_330 : bool = (x_329 >= 0); + x_336_phi = x_330; + if (x_330) { + let x_334 : i32 = p.x; + x_335 = (x_334 < 14); + x_336_phi = x_335; + } + let x_336 : bool = x_336_phi; + x_349_phi = x_336; + if (x_336) { + let x_340 : i32 = p.x; + let x_343 : i32 = p.y; + let x_347 : i32 = map[((x_340 + 2) + (x_343 * 16))]; + x_348 = (x_347 == 0); + x_349_phi = x_348; + } + let x_349 : bool = x_349_phi; + if (x_349) { + let x_352 : i32 = d; + d = (x_352 - 1); + let x_355 : i32 = p.x; + let x_357 : i32 = p.y; + map[(x_355 + (x_357 * 16))] = 1; + let x_362 : i32 = p.x; + let x_365 : i32 = p.y; + map[((x_362 + 1) + (x_365 * 16))] = 1; + let x_370 : i32 = p.x; + let x_373 : i32 = p.y; + map[((x_370 + 2) + (x_373 * 16))] = 1; + let x_378 : i32 = p.x; + p.x = (x_378 + 2); + } + let x_381 : i32 = d; + let x_382 : bool = (x_381 >= 0); + x_388_phi = x_382; + if (x_382) { + let x_386 : i32 = p.y; + x_387 = (x_386 < 14); + x_388_phi = x_387; + } + let x_388 : bool = x_388_phi; + x_401_phi = x_388; + if (x_388) { + let x_392 : i32 = p.x; + let x_394 : i32 = p.y; + let x_399 : i32 = map[(x_392 + ((x_394 + 2) * 16))]; + x_400 = (x_399 == 0); + x_401_phi = x_400; + } + let x_401 : bool = x_401_phi; + if (x_401) { + let x_404 : i32 = d; + d = (x_404 - 1); + let x_407 : i32 = p.x; + let x_409 : i32 = p.y; + map[(x_407 + (x_409 * 16))] = 1; + let x_414 : i32 = p.x; + let x_416 : i32 = p.y; + map[(x_414 + ((x_416 + 1) * 16))] = 1; + let x_422 : i32 = p.x; + let x_424 : i32 = p.y; + map[(x_422 + ((x_424 + 2) * 16))] = 1; + let x_430 : i32 = p.y; + p.y = (x_430 + 2); + } + } + let x_434 : i32 = ipos.y; + let x_437 : i32 = ipos.x; + let x_440 : i32 = map[((x_434 * 16) + x_437)]; + if ((x_440 == 1)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + return; + } + + continuing { + let x_444 : bool = canwalk; + if (x_444) { + } else { + break; + } + } + } + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm new file mode 100644 index 0000000000..3e57abdcb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm @@ -0,0 +1,386 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 + %int_10 = OpConstant %int 10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 +%float_0_100000001 = OpConstant %float 0.100000001 + %int_0_0 = OpConstant %int 0 + %57 = OpConstantComposite %_arr_int_uint_10 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 + %main = OpFunction %void None %10 + %58 = OpLabel + %temp = OpVariable %_ptr_Function__arr_int_uint_10 Function + %data = OpVariable %_ptr_Function__arr_int_uint_10 Function + %59 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %60 = OpLoad %float %59 + %61 = OpConvertFToS %int %60 + OpBranch %62 + %62 = OpLabel + %63 = OpPhi %int %61 %58 %64 %65 + OpLoopMerge %66 %65 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %_arr_int_uint_10 %data + OpStore %data %57 + OpStore %data %68 + %69 = OpIAdd %int %63 %int_1 + OpSelectionMerge %70 None + OpSwitch %63 %70 0 %71 1 %72 2 %73 3 %74 4 %75 5 %76 6 %77 7 %78 8 %79 9 %80 + %71 = OpLabel + %81 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %81 %int_4 + %82 = OpIAdd %int %63 %int_1 + OpBranch %70 + %72 = OpLabel + %83 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %83 %int_3 + %84 = OpIAdd %int %63 %int_1 + OpBranch %70 + %73 = OpLabel + %85 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %85 %int_2 + %86 = OpIAdd %int %63 %int_1 + OpBranch %70 + %74 = OpLabel + %87 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %87 %int_1 + %88 = OpIAdd %int %63 %int_1 + OpBranch %70 + %75 = OpLabel + %89 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %89 %int_0 + %90 = OpIAdd %int %63 %int_1 + OpBranch %70 + %76 = OpLabel + %91 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %91 %int_n1 + %92 = OpIAdd %int %63 %int_1 + OpBranch %70 + %77 = OpLabel + %93 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %93 %int_n2 + %94 = OpIAdd %int %63 %int_1 + OpBranch %70 + %78 = OpLabel + %95 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %95 %int_n3 + %96 = OpIAdd %int %63 %int_1 + OpBranch %70 + %79 = OpLabel + %97 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %97 %int_n4 + %98 = OpIAdd %int %63 %int_1 + OpBranch %70 + %80 = OpLabel + %99 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %99 %int_n5 + %100 = OpIAdd %int %63 %int_1 + OpBranch %70 + %70 = OpLabel + %64 = OpPhi %int %69 %67 %82 %71 %84 %72 %86 %73 %88 %74 %90 %75 %92 %76 %94 %77 %96 %78 %98 %79 %100 %80 + OpBranch %65 + %65 = OpLabel + %101 = OpSLessThan %bool %64 %int_10 + OpBranchConditional %101 %62 %66 + %66 = OpLabel + OpBranch %102 + %102 = OpLabel + %103 = OpPhi %int %int_0 %66 %104 %105 + %106 = OpSLessThan %bool %103 %int_10 + OpLoopMerge %107 %105 None + OpBranchConditional %106 %105 %107 + %105 = OpLabel + %108 = OpAccessChain %_ptr_Function_int %data %103 + %109 = OpLoad %int %108 + %110 = OpAccessChain %_ptr_Function_int %temp %103 + OpStore %110 %109 + %104 = OpIAdd %int %103 %int_1 + OpBranch %102 + %107 = OpLabel + OpBranch %111 + %111 = OpLabel + %112 = OpPhi %int %int_1 %107 %113 %114 + %115 = OpSLessThanEqual %bool %112 %int_9 + OpLoopMerge %116 %114 None + OpBranchConditional %115 %117 %116 + %117 = OpLabel + OpBranch %118 + %118 = OpLabel + %119 = OpPhi %int %int_0 %117 %120 %121 + %122 = OpSLessThan %bool %119 %int_9 + OpLoopMerge %123 %121 None + OpBranchConditional %122 %124 %123 + %124 = OpLabel + %125 = OpIAdd %int %119 %112 + %126 = OpISub %int %125 %int_1 + %127 = OpIMul %int %int_2 %112 + %120 = OpIAdd %int %119 %127 + %128 = OpISub %int %120 %int_1 + %129 = OpExtInst %int %1 SMin %128 %int_9 + OpBranch %130 + %130 = OpLabel + %131 = OpPhi %int %119 %124 %132 %133 + %134 = OpPhi %int %125 %124 %135 %133 + %136 = OpPhi %int %119 %124 %137 %133 + %138 = OpSLessThanEqual %bool %136 %126 + %139 = OpSLessThanEqual %bool %134 %129 + %140 = OpLogicalAnd %bool %138 %139 + OpLoopMerge %141 %133 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + %143 = OpAccessChain %_ptr_Function_int %data %136 + %144 = OpLoad %int %143 + %145 = OpAccessChain %_ptr_Function_int %data %134 + %146 = OpLoad %int %145 + %147 = OpSLessThan %bool %144 %146 + %132 = OpIAdd %int %131 %int_1 + OpSelectionMerge %148 None + OpBranchConditional %147 %149 %150 + %149 = OpLabel + %151 = OpIAdd %int %136 %int_1 + %152 = OpLoad %int %143 + %153 = OpAccessChain %_ptr_Function_int %temp %131 + OpStore %153 %152 + OpBranch %148 + %150 = OpLabel + %154 = OpIAdd %int %134 %int_1 + %155 = OpLoad %int %145 + %156 = OpAccessChain %_ptr_Function_int %temp %131 + OpStore %156 %155 + OpBranch %148 + %148 = OpLabel + %135 = OpPhi %int %134 %149 %154 %150 + %137 = OpPhi %int %151 %149 %136 %150 + OpBranch %133 + %133 = OpLabel + OpBranch %130 + %141 = OpLabel + OpBranch %157 + %157 = OpLabel + %158 = OpPhi %int %131 %141 %159 %160 + %161 = OpPhi %int %136 %141 %162 %160 + %163 = OpSLessThan %bool %161 %int_10 + %164 = OpSLessThanEqual %bool %161 %126 + %165 = OpLogicalAnd %bool %163 %164 + OpLoopMerge %166 %160 None + OpBranchConditional %165 %160 %166 + %160 = OpLabel + %159 = OpIAdd %int %158 %int_1 + %162 = OpIAdd %int %161 %int_1 + %167 = OpAccessChain %_ptr_Function_int %data %161 + %168 = OpLoad %int %167 + %169 = OpAccessChain %_ptr_Function_int %temp %158 + OpStore %169 %168 + OpBranch %157 + %166 = OpLabel + OpBranch %170 + %170 = OpLabel + %171 = OpPhi %int %119 %166 %172 %173 + %174 = OpSLessThanEqual %bool %171 %129 + OpLoopMerge %175 %173 None + OpBranchConditional %174 %173 %175 + %173 = OpLabel + %176 = OpAccessChain %_ptr_Function_int %temp %171 + %177 = OpLoad %int %176 + %178 = OpAccessChain %_ptr_Function_int %data %171 + OpStore %178 %177 + %172 = OpIAdd %int %171 %int_1 + OpBranch %170 + %175 = OpLabel + OpBranch %121 + %121 = OpLabel + OpBranch %118 + %123 = OpLabel + OpBranch %114 + %114 = OpLabel + %113 = OpIMul %int %int_2 %112 + OpBranch %111 + %116 = OpLabel + %179 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %180 = OpLoad %float %179 + %181 = OpConvertFToS %int %180 + %182 = OpSLessThan %bool %181 %int_30 + OpSelectionMerge %183 None + OpBranchConditional %182 %184 %185 + %184 = OpLabel + %186 = OpAccessChain %_ptr_Function_int %data %int_0 + %187 = OpLoad %int %186 + %188 = OpConvertSToF %float %187 + %189 = OpFMul %float %188 %float_0_100000001 + %190 = OpFAdd %float %float_0_5 %189 + OpBranch %183 + %185 = OpLabel + %191 = OpSLessThan %bool %181 %int_60 + OpSelectionMerge %192 None + OpBranchConditional %191 %193 %194 + %193 = OpLabel + %195 = OpAccessChain %_ptr_Function_int %data %int_1 + %196 = OpLoad %int %195 + %197 = OpConvertSToF %float %196 + %198 = OpFMul %float %197 %float_0_100000001 + %199 = OpFAdd %float %float_0_5 %198 + OpBranch %192 + %194 = OpLabel + %200 = OpSLessThan %bool %181 %int_90 + OpSelectionMerge %201 None + OpBranchConditional %200 %202 %203 + %202 = OpLabel + %204 = OpAccessChain %_ptr_Function_int %data %int_2 + %205 = OpLoad %int %204 + %206 = OpConvertSToF %float %205 + %207 = OpFMul %float %206 %float_0_100000001 + %208 = OpFAdd %float %float_0_5 %207 + OpBranch %201 + %203 = OpLabel + %209 = OpSLessThan %bool %181 %int_120 + OpSelectionMerge %210 None + OpBranchConditional %209 %211 %212 + %211 = OpLabel + %213 = OpAccessChain %_ptr_Function_int %data %int_3 + %214 = OpLoad %int %213 + %215 = OpConvertSToF %float %214 + %216 = OpFMul %float %215 %float_0_100000001 + %217 = OpFAdd %float %float_0_5 %216 + OpBranch %210 + %212 = OpLabel + %218 = OpSLessThan %bool %181 %int_150 + OpSelectionMerge %219 None + OpBranchConditional %218 %220 %221 + %220 = OpLabel + OpKill + %221 = OpLabel + %222 = OpSLessThan %bool %181 %int_180 + OpSelectionMerge %223 None + OpBranchConditional %222 %224 %225 + %224 = OpLabel + %226 = OpAccessChain %_ptr_Function_int %data %int_5 + %227 = OpLoad %int %226 + %228 = OpConvertSToF %float %227 + %229 = OpFMul %float %228 %float_0_100000001 + %230 = OpFAdd %float %float_0_5 %229 + OpBranch %223 + %225 = OpLabel + %231 = OpSLessThan %bool %181 %int_210 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %234 + %233 = OpLabel + %235 = OpAccessChain %_ptr_Function_int %data %int_6 + %236 = OpLoad %int %235 + %237 = OpConvertSToF %float %236 + %238 = OpFMul %float %237 %float_0_100000001 + %239 = OpFAdd %float %float_0_5 %238 + OpBranch %232 + %234 = OpLabel + %240 = OpSLessThan %bool %181 %int_240 + OpSelectionMerge %241 None + OpBranchConditional %240 %242 %243 + %242 = OpLabel + %244 = OpAccessChain %_ptr_Function_int %data %int_7 + %245 = OpLoad %int %244 + %246 = OpConvertSToF %float %245 + %247 = OpFMul %float %246 %float_0_100000001 + %248 = OpFAdd %float %float_0_5 %247 + OpBranch %241 + %243 = OpLabel + %249 = OpSLessThan %bool %181 %int_270 + OpSelectionMerge %250 None + OpBranchConditional %249 %250 %251 + %250 = OpLabel + %252 = OpAccessChain %_ptr_Function_int %data %int_8 + %253 = OpLoad %int %252 + %254 = OpConvertSToF %float %253 + %255 = OpFMul %float %254 %float_0_100000001 + %256 = OpFAdd %float %float_0_5 %255 + OpBranch %241 + %251 = OpLabel + OpKill + %241 = OpLabel + %257 = OpPhi %float %248 %242 %256 %250 + OpBranch %232 + %232 = OpLabel + %258 = OpPhi %float %239 %233 %257 %241 + OpBranch %223 + %223 = OpLabel + %259 = OpPhi %float %230 %224 %258 %232 + OpBranch %219 + %219 = OpLabel + OpBranch %210 + %210 = OpLabel + %260 = OpPhi %float %217 %211 %259 %219 + OpBranch %201 + %201 = OpLabel + %261 = OpPhi %float %208 %202 %260 %210 + OpBranch %192 + %192 = OpLabel + %262 = OpPhi %float %199 %193 %261 %201 + OpBranch %183 + %183 = OpLabel + %263 = OpPhi %float %190 %184 %262 %192 + %264 = OpCompositeConstruct %v4float %263 %263 %263 %float_1 + OpStore %_GLF_color %264 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..975a0e5bb2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.hlsl @@ -0,0 +1,356 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int temp[10] = (int[10])0; + int data[10] = (int[10])0; + float x_190 = 0.0f; + float x_262 = 0.0f; + int x_63_phi = 0; + int x_103_phi = 0; + int x_112_phi = 0; + float x_263_phi = 0.0f; + const float x_60 = asfloat(x_8[0].x); + const int x_61 = int(x_60); + x_63_phi = x_61; + while (true) { + int x_100 = 0; + int x_98 = 0; + int x_96 = 0; + int x_94 = 0; + int x_92 = 0; + int x_90 = 0; + int x_88 = 0; + int x_86 = 0; + int x_84 = 0; + int x_82 = 0; + int x_64_phi = 0; + const int x_63 = x_63_phi; + const int x_68[10] = data; + const int tint_symbol_5[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + data = tint_symbol_5; + data = x_68; + const int x_69 = (x_63 + 1); + x_64_phi = x_69; + switch(x_63) { + case 9: { + data[x_63] = -5; + x_100 = (x_63 + 1); + x_64_phi = x_100; + break; + } + case 8: { + data[x_63] = -4; + x_98 = (x_63 + 1); + x_64_phi = x_98; + break; + } + case 7: { + data[x_63] = -3; + x_96 = (x_63 + 1); + x_64_phi = x_96; + break; + } + case 6: { + data[x_63] = -2; + x_94 = (x_63 + 1); + x_64_phi = x_94; + break; + } + case 5: { + data[x_63] = -1; + x_92 = (x_63 + 1); + x_64_phi = x_92; + break; + } + case 4: { + data[x_63] = 0; + x_90 = (x_63 + 1); + x_64_phi = x_90; + break; + } + case 3: { + data[x_63] = 1; + x_88 = (x_63 + 1); + x_64_phi = x_88; + break; + } + case 2: { + data[x_63] = 2; + x_86 = (x_63 + 1); + x_64_phi = x_86; + break; + } + case 1: { + data[x_63] = 3; + x_84 = (x_63 + 1); + x_64_phi = x_84; + break; + } + case 0: { + data[x_63] = 4; + x_82 = (x_63 + 1); + x_64_phi = x_82; + break; + } + default: { + break; + } + } + const int x_64 = x_64_phi; + { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_103_phi = 0; + while (true) { + int x_104 = 0; + const int x_103 = x_103_phi; + if ((x_103 < 10)) { + } else { + break; + } + { + const int x_109 = data[x_103]; + temp[x_103] = x_109; + x_104 = (x_103 + 1); + x_103_phi = x_104; + } + } + x_112_phi = 1; + while (true) { + int x_113 = 0; + int x_119_phi = 0; + const int x_112 = x_112_phi; + if ((x_112 <= 9)) { + } else { + break; + } + x_119_phi = 0; + while (true) { + int x_131 = 0; + int x_136 = 0; + int x_131_phi = 0; + int x_134_phi = 0; + int x_136_phi = 0; + int x_158_phi = 0; + int x_161_phi = 0; + int x_171_phi = 0; + const int x_119 = x_119_phi; + if ((x_119 < 9)) { + } else { + break; + } + const int x_125 = (x_119 + x_112); + const int x_126 = (x_125 - 1); + const int x_120 = (x_119 + (2 * x_112)); + const int x_129 = min((x_120 - 1), 9); + x_131_phi = x_119; + x_134_phi = x_125; + x_136_phi = x_119; + while (true) { + int x_151 = 0; + int x_154 = 0; + int x_135_phi = 0; + int x_137_phi = 0; + x_131 = x_131_phi; + const int x_134 = x_134_phi; + x_136 = x_136_phi; + bool tint_tmp = (x_136 <= x_126); + if (tint_tmp) { + tint_tmp = (x_134 <= x_129); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_143_save = x_136; + const int x_144 = data[x_143_save]; + const int x_145_save = x_134; + const int x_146 = data[x_145_save]; + const int x_132 = asint((x_131 + asint(1))); + if ((x_144 < x_146)) { + x_151 = asint((x_136 + asint(1))); + const int x_152 = data[x_143_save]; + temp[x_131] = x_152; + x_135_phi = x_134; + x_137_phi = x_151; + } else { + x_154 = (x_134 + 1); + const int x_155 = data[x_145_save]; + temp[x_131] = x_155; + x_135_phi = x_154; + x_137_phi = x_136; + } + const int x_135 = x_135_phi; + const int x_137 = x_137_phi; + { + x_131_phi = x_132; + x_134_phi = x_135; + x_136_phi = x_137; + } + } + x_158_phi = x_131; + x_161_phi = x_136; + while (true) { + int x_159 = 0; + int x_162 = 0; + const int x_158 = x_158_phi; + const int x_161 = x_161_phi; + bool tint_tmp_1 = (x_161 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_161 <= x_126); + } + if ((tint_tmp_1)) { + } else { + break; + } + { + x_159 = (x_158 + 1); + x_162 = (x_161 + 1); + const int x_168 = data[x_161]; + temp[x_158] = x_168; + x_158_phi = x_159; + x_161_phi = x_162; + } + } + x_171_phi = x_119; + while (true) { + int x_172 = 0; + const int x_171 = x_171_phi; + if ((x_171 <= x_129)) { + } else { + break; + } + { + const int x_177 = temp[x_171]; + data[x_171] = x_177; + x_172 = (x_171 + 1); + x_171_phi = x_172; + } + } + { + x_119_phi = x_120; + } + } + { + x_113 = (2 * x_112); + x_112_phi = x_113; + } + } + int x_181 = 0; + float x_199 = 0.0f; + float x_261 = 0.0f; + float x_262_phi = 0.0f; + const float x_180 = gl_FragCoord.y; + x_181 = int(x_180); + if ((x_181 < 30)) { + const int x_187 = data[0]; + x_190 = (0.5f + (float(x_187) * 0.100000001f)); + x_263_phi = x_190; + } else { + float x_208 = 0.0f; + float x_260 = 0.0f; + float x_261_phi = 0.0f; + if ((x_181 < 60)) { + const int x_196 = data[1]; + x_199 = (0.5f + (float(x_196) * 0.100000001f)); + x_262_phi = x_199; + } else { + float x_217 = 0.0f; + float x_259 = 0.0f; + float x_260_phi = 0.0f; + if ((x_181 < 90)) { + const int x_205 = data[2]; + x_208 = (0.5f + (float(x_205) * 0.100000001f)); + x_261_phi = x_208; + } else { + if ((x_181 < 120)) { + const int x_214 = data[3]; + x_217 = (0.5f + (float(x_214) * 0.100000001f)); + x_260_phi = x_217; + } else { + float x_230 = 0.0f; + float x_258 = 0.0f; + float x_259_phi = 0.0f; + if ((x_181 < 150)) { + discard; + } else { + float x_239 = 0.0f; + float x_257 = 0.0f; + float x_258_phi = 0.0f; + if ((x_181 < 180)) { + const int x_227 = data[5]; + x_230 = (0.5f + (float(x_227) * 0.100000001f)); + x_259_phi = x_230; + } else { + float x_248 = 0.0f; + float x_256 = 0.0f; + float x_257_phi = 0.0f; + if ((x_181 < 210)) { + const int x_236 = data[6]; + x_239 = (0.5f + (float(x_236) * 0.100000001f)); + x_258_phi = x_239; + } else { + if ((x_181 < 240)) { + const int x_245 = data[7]; + x_248 = (0.5f + (float(x_245) * 0.100000001f)); + x_257_phi = x_248; + } else { + if ((x_181 < 270)) { + } else { + discard; + } + const int x_253 = data[8]; + x_256 = (0.5f + (float(x_253) * 0.100000001f)); + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + x_259_phi = x_258; + } + x_259 = x_259_phi; + } + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + x_262 = x_262_phi; + x_263_phi = x_262; + } + const float x_263 = x_263_phi; + x_GLF_color = float4(x_263, x_263, x_263, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.msl new file mode 100644 index 0000000000..e8a7ca8cee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.msl @@ -0,0 +1,350 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper temp = {}; + tint_array_wrapper data = {}; + float x_190 = 0.0f; + float x_262 = 0.0f; + int x_63_phi = 0; + int x_103_phi = 0; + int x_112_phi = 0; + float x_263_phi = 0.0f; + float const x_60 = x_8.injectionSwitch.x; + int const x_61 = int(x_60); + x_63_phi = x_61; + while (true) { + int x_100 = 0; + int x_98 = 0; + int x_96 = 0; + int x_94 = 0; + int x_92 = 0; + int x_90 = 0; + int x_88 = 0; + int x_86 = 0; + int x_84 = 0; + int x_82 = 0; + int x_64_phi = 0; + int const x_63 = x_63_phi; + tint_array_wrapper const x_68 = data; + tint_array_wrapper const tint_symbol_4 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + data = tint_symbol_4; + data = x_68; + int const x_69 = (x_63 + 1); + x_64_phi = x_69; + switch(x_63) { + case 9: { + data.arr[x_63] = -5; + x_100 = (x_63 + 1); + x_64_phi = x_100; + break; + } + case 8: { + data.arr[x_63] = -4; + x_98 = (x_63 + 1); + x_64_phi = x_98; + break; + } + case 7: { + data.arr[x_63] = -3; + x_96 = (x_63 + 1); + x_64_phi = x_96; + break; + } + case 6: { + data.arr[x_63] = -2; + x_94 = (x_63 + 1); + x_64_phi = x_94; + break; + } + case 5: { + data.arr[x_63] = -1; + x_92 = (x_63 + 1); + x_64_phi = x_92; + break; + } + case 4: { + data.arr[x_63] = 0; + x_90 = (x_63 + 1); + x_64_phi = x_90; + break; + } + case 3: { + data.arr[x_63] = 1; + x_88 = (x_63 + 1); + x_64_phi = x_88; + break; + } + case 2: { + data.arr[x_63] = 2; + x_86 = (x_63 + 1); + x_64_phi = x_86; + break; + } + case 1: { + data.arr[x_63] = 3; + x_84 = (x_63 + 1); + x_64_phi = x_84; + break; + } + case 0: { + data.arr[x_63] = 4; + x_82 = (x_63 + 1); + x_64_phi = x_82; + break; + } + default: { + break; + } + } + int const x_64 = x_64_phi; + { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_103_phi = 0; + while (true) { + int x_104 = 0; + int const x_103 = x_103_phi; + if ((x_103 < 10)) { + } else { + break; + } + { + int const x_109 = data.arr[x_103]; + temp.arr[x_103] = x_109; + x_104 = (x_103 + 1); + x_103_phi = x_104; + } + } + x_112_phi = 1; + while (true) { + int x_113 = 0; + int x_119_phi = 0; + int const x_112 = x_112_phi; + if ((x_112 <= 9)) { + } else { + break; + } + x_119_phi = 0; + while (true) { + int x_131 = 0; + int x_136 = 0; + int x_131_phi = 0; + int x_134_phi = 0; + int x_136_phi = 0; + int x_158_phi = 0; + int x_161_phi = 0; + int x_171_phi = 0; + int const x_119 = x_119_phi; + if ((x_119 < 9)) { + } else { + break; + } + int const x_125 = (x_119 + x_112); + int const x_126 = (x_125 - 1); + int const x_120 = (x_119 + (2 * x_112)); + int const x_129 = min((x_120 - 1), 9); + x_131_phi = x_119; + x_134_phi = x_125; + x_136_phi = x_119; + while (true) { + int x_151 = 0; + int x_154 = 0; + int x_135_phi = 0; + int x_137_phi = 0; + x_131 = x_131_phi; + int const x_134 = x_134_phi; + x_136 = x_136_phi; + if (((x_136 <= x_126) && (x_134 <= x_129))) { + } else { + break; + } + int const x_143_save = x_136; + int const x_144 = data.arr[x_143_save]; + int const x_145_save = x_134; + int const x_146 = data.arr[x_145_save]; + int const x_132 = as_type((x_131 + as_type(1))); + if ((x_144 < x_146)) { + x_151 = as_type((x_136 + as_type(1))); + int const x_152 = data.arr[x_143_save]; + temp.arr[x_131] = x_152; + x_135_phi = x_134; + x_137_phi = x_151; + } else { + x_154 = (x_134 + 1); + int const x_155 = data.arr[x_145_save]; + temp.arr[x_131] = x_155; + x_135_phi = x_154; + x_137_phi = x_136; + } + int const x_135 = x_135_phi; + int const x_137 = x_137_phi; + { + x_131_phi = x_132; + x_134_phi = x_135; + x_136_phi = x_137; + } + } + x_158_phi = x_131; + x_161_phi = x_136; + while (true) { + int x_159 = 0; + int x_162 = 0; + int const x_158 = x_158_phi; + int const x_161 = x_161_phi; + if (((x_161 < 10) && (x_161 <= x_126))) { + } else { + break; + } + { + x_159 = (x_158 + 1); + x_162 = (x_161 + 1); + int const x_168 = data.arr[x_161]; + temp.arr[x_158] = x_168; + x_158_phi = x_159; + x_161_phi = x_162; + } + } + x_171_phi = x_119; + while (true) { + int x_172 = 0; + int const x_171 = x_171_phi; + if ((x_171 <= x_129)) { + } else { + break; + } + { + int const x_177 = temp.arr[x_171]; + data.arr[x_171] = x_177; + x_172 = (x_171 + 1); + x_171_phi = x_172; + } + } + { + x_119_phi = x_120; + } + } + { + x_113 = (2 * x_112); + x_112_phi = x_113; + } + } + int x_181 = 0; + float x_199 = 0.0f; + float x_261 = 0.0f; + float x_262_phi = 0.0f; + float const x_180 = (*(tint_symbol_6)).y; + x_181 = int(x_180); + if ((x_181 < 30)) { + int const x_187 = data.arr[0]; + x_190 = (0.5f + (float(x_187) * 0.100000001f)); + x_263_phi = x_190; + } else { + float x_208 = 0.0f; + float x_260 = 0.0f; + float x_261_phi = 0.0f; + if ((x_181 < 60)) { + int const x_196 = data.arr[1]; + x_199 = (0.5f + (float(x_196) * 0.100000001f)); + x_262_phi = x_199; + } else { + float x_217 = 0.0f; + float x_259 = 0.0f; + float x_260_phi = 0.0f; + if ((x_181 < 90)) { + int const x_205 = data.arr[2]; + x_208 = (0.5f + (float(x_205) * 0.100000001f)); + x_261_phi = x_208; + } else { + if ((x_181 < 120)) { + int const x_214 = data.arr[3]; + x_217 = (0.5f + (float(x_214) * 0.100000001f)); + x_260_phi = x_217; + } else { + float x_230 = 0.0f; + float x_258 = 0.0f; + float x_259_phi = 0.0f; + if ((x_181 < 150)) { + discard_fragment(); + } else { + float x_239 = 0.0f; + float x_257 = 0.0f; + float x_258_phi = 0.0f; + if ((x_181 < 180)) { + int const x_227 = data.arr[5]; + x_230 = (0.5f + (float(x_227) * 0.100000001f)); + x_259_phi = x_230; + } else { + float x_248 = 0.0f; + float x_256 = 0.0f; + float x_257_phi = 0.0f; + if ((x_181 < 210)) { + int const x_236 = data.arr[6]; + x_239 = (0.5f + (float(x_236) * 0.100000001f)); + x_258_phi = x_239; + } else { + if ((x_181 < 240)) { + int const x_245 = data.arr[7]; + x_248 = (0.5f + (float(x_245) * 0.100000001f)); + x_257_phi = x_248; + } else { + if ((x_181 < 270)) { + } else { + discard_fragment(); + } + int const x_253 = data.arr[8]; + x_256 = (0.5f + (float(x_253) * 0.100000001f)); + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + x_259_phi = x_258; + } + x_259 = x_259_phi; + } + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + x_262 = x_262_phi; + x_263_phi = x_262; + } + float const x_263 = x_263_phi; + *(tint_symbol_7) = float4(x_263, x_263, x_263, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..63a761de45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.spvasm @@ -0,0 +1,746 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 424 +; Schema: 0 + OpCapability Shader + %169 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %temp "temp" + OpName %data "data" + OpName %x_190 "x_190" + OpName %x_262 "x_262" + OpName %x_63_phi "x_63_phi" + OpName %x_103_phi "x_103_phi" + OpName %x_112_phi "x_112_phi" + OpName %x_263_phi "x_263_phi" + OpName %x_100 "x_100" + OpName %x_98 "x_98" + OpName %x_96 "x_96" + OpName %x_94 "x_94" + OpName %x_92 "x_92" + OpName %x_90 "x_90" + OpName %x_88 "x_88" + OpName %x_86 "x_86" + OpName %x_84 "x_84" + OpName %x_82 "x_82" + OpName %x_64_phi "x_64_phi" + OpName %x_104 "x_104" + OpName %x_113 "x_113" + OpName %x_119_phi "x_119_phi" + OpName %x_131 "x_131" + OpName %x_136 "x_136" + OpName %x_131_phi "x_131_phi" + OpName %x_134_phi "x_134_phi" + OpName %x_136_phi "x_136_phi" + OpName %x_158_phi "x_158_phi" + OpName %x_161_phi "x_161_phi" + OpName %x_171_phi "x_171_phi" + OpName %x_151 "x_151" + OpName %x_154 "x_154" + OpName %x_135_phi "x_135_phi" + OpName %x_137_phi "x_137_phi" + OpName %x_159 "x_159" + OpName %x_162 "x_162" + OpName %x_172 "x_172" + OpName %x_181 "x_181" + OpName %x_199 "x_199" + OpName %x_261 "x_261" + OpName %x_262_phi "x_262_phi" + OpName %x_208 "x_208" + OpName %x_260 "x_260" + OpName %x_261_phi "x_261_phi" + OpName %x_217 "x_217" + OpName %x_259 "x_259" + OpName %x_260_phi "x_260_phi" + OpName %x_230 "x_230" + OpName %x_258 "x_258" + OpName %x_259_phi "x_259_phi" + OpName %x_239 "x_239" + OpName %x_257 "x_257" + OpName %x_258_phi "x_258_phi" + OpName %x_248 "x_248" + OpName %x_256 "x_256" + OpName %x_257_phi "x_257_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %25 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %60 = OpConstantComposite %_arr_int_uint_10 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 + %int_1 = OpConstant %int 1 + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 +%float_0_100000001 = OpConstant %float 0.100000001 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %411 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %temp = OpVariable %_ptr_Function__arr_int_uint_10 Function %25 + %data = OpVariable %_ptr_Function__arr_int_uint_10 Function %25 + %x_190 = OpVariable %_ptr_Function_float Function %29 + %x_262 = OpVariable %_ptr_Function_float Function %29 + %x_63_phi = OpVariable %_ptr_Function_int Function %33 + %x_103_phi = OpVariable %_ptr_Function_int Function %33 + %x_112_phi = OpVariable %_ptr_Function_int Function %33 + %x_263_phi = OpVariable %_ptr_Function_float Function %29 + %x_100 = OpVariable %_ptr_Function_int Function %33 + %x_98 = OpVariable %_ptr_Function_int Function %33 + %x_96 = OpVariable %_ptr_Function_int Function %33 + %x_94 = OpVariable %_ptr_Function_int Function %33 + %x_92 = OpVariable %_ptr_Function_int Function %33 + %x_90 = OpVariable %_ptr_Function_int Function %33 + %x_88 = OpVariable %_ptr_Function_int Function %33 + %x_86 = OpVariable %_ptr_Function_int Function %33 + %x_84 = OpVariable %_ptr_Function_int Function %33 + %x_82 = OpVariable %_ptr_Function_int Function %33 + %x_64_phi = OpVariable %_ptr_Function_int Function %33 + %x_104 = OpVariable %_ptr_Function_int Function %33 + %x_113 = OpVariable %_ptr_Function_int Function %33 + %x_119_phi = OpVariable %_ptr_Function_int Function %33 + %x_131 = OpVariable %_ptr_Function_int Function %33 + %x_136 = OpVariable %_ptr_Function_int Function %33 + %x_131_phi = OpVariable %_ptr_Function_int Function %33 + %x_134_phi = OpVariable %_ptr_Function_int Function %33 + %x_136_phi = OpVariable %_ptr_Function_int Function %33 + %x_158_phi = OpVariable %_ptr_Function_int Function %33 + %x_161_phi = OpVariable %_ptr_Function_int Function %33 + %x_171_phi = OpVariable %_ptr_Function_int Function %33 + %x_151 = OpVariable %_ptr_Function_int Function %33 + %x_154 = OpVariable %_ptr_Function_int Function %33 + %x_135_phi = OpVariable %_ptr_Function_int Function %33 + %x_137_phi = OpVariable %_ptr_Function_int Function %33 + %x_159 = OpVariable %_ptr_Function_int Function %33 + %x_162 = OpVariable %_ptr_Function_int Function %33 + %x_172 = OpVariable %_ptr_Function_int Function %33 + %x_181 = OpVariable %_ptr_Function_int Function %33 + %x_199 = OpVariable %_ptr_Function_float Function %29 + %x_261 = OpVariable %_ptr_Function_float Function %29 + %x_262_phi = OpVariable %_ptr_Function_float Function %29 + %x_208 = OpVariable %_ptr_Function_float Function %29 + %x_260 = OpVariable %_ptr_Function_float Function %29 + %x_261_phi = OpVariable %_ptr_Function_float Function %29 + %x_217 = OpVariable %_ptr_Function_float Function %29 + %x_259 = OpVariable %_ptr_Function_float Function %29 + %x_260_phi = OpVariable %_ptr_Function_float Function %29 + %x_230 = OpVariable %_ptr_Function_float Function %29 + %x_258 = OpVariable %_ptr_Function_float Function %29 + %x_259_phi = OpVariable %_ptr_Function_float Function %29 + %x_239 = OpVariable %_ptr_Function_float Function %29 + %x_257 = OpVariable %_ptr_Function_float Function %29 + %x_258_phi = OpVariable %_ptr_Function_float Function %29 + %x_248 = OpVariable %_ptr_Function_float Function %29 + %x_256 = OpVariable %_ptr_Function_float Function %29 + %x_257_phi = OpVariable %_ptr_Function_float Function %29 + %39 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %40 = OpLoad %float %39 + %41 = OpConvertFToS %int %40 + OpStore %x_63_phi %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %57 = OpLoad %int %x_63_phi + %58 = OpLoad %_arr_int_uint_10 %data + OpStore %data %60 + OpStore %data %58 + %62 = OpIAdd %int %57 %int_1 + OpStore %x_64_phi %62 + OpSelectionMerge %63 None + OpSwitch %57 %64 9 %65 8 %66 7 %67 6 %68 5 %69 4 %70 3 %71 2 %72 1 %73 0 %74 + %65 = OpLabel + %75 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %75 %int_n5 + %77 = OpIAdd %int %57 %int_1 + OpStore %x_100 %77 + %78 = OpLoad %int %x_100 + OpStore %x_64_phi %78 + OpBranch %63 + %66 = OpLabel + %79 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %79 %int_n4 + %81 = OpIAdd %int %57 %int_1 + OpStore %x_98 %81 + %82 = OpLoad %int %x_98 + OpStore %x_64_phi %82 + OpBranch %63 + %67 = OpLabel + %83 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %83 %int_n3 + %85 = OpIAdd %int %57 %int_1 + OpStore %x_96 %85 + %86 = OpLoad %int %x_96 + OpStore %x_64_phi %86 + OpBranch %63 + %68 = OpLabel + %87 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %87 %int_n2 + %89 = OpIAdd %int %57 %int_1 + OpStore %x_94 %89 + %90 = OpLoad %int %x_94 + OpStore %x_64_phi %90 + OpBranch %63 + %69 = OpLabel + %91 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %91 %int_n1 + %93 = OpIAdd %int %57 %int_1 + OpStore %x_92 %93 + %94 = OpLoad %int %x_92 + OpStore %x_64_phi %94 + OpBranch %63 + %70 = OpLabel + %95 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %95 %int_0 + %96 = OpIAdd %int %57 %int_1 + OpStore %x_90 %96 + %97 = OpLoad %int %x_90 + OpStore %x_64_phi %97 + OpBranch %63 + %71 = OpLabel + %98 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %98 %int_1 + %99 = OpIAdd %int %57 %int_1 + OpStore %x_88 %99 + %100 = OpLoad %int %x_88 + OpStore %x_64_phi %100 + OpBranch %63 + %72 = OpLabel + %101 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %101 %int_2 + %103 = OpIAdd %int %57 %int_1 + OpStore %x_86 %103 + %104 = OpLoad %int %x_86 + OpStore %x_64_phi %104 + OpBranch %63 + %73 = OpLabel + %105 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %105 %int_3 + %107 = OpIAdd %int %57 %int_1 + OpStore %x_84 %107 + %108 = OpLoad %int %x_84 + OpStore %x_64_phi %108 + OpBranch %63 + %74 = OpLabel + %109 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %109 %int_4 + %111 = OpIAdd %int %57 %int_1 + OpStore %x_82 %111 + %112 = OpLoad %int %x_82 + OpStore %x_64_phi %112 + OpBranch %63 + %64 = OpLabel + OpBranch %63 + %63 = OpLabel + %113 = OpLoad %int %x_64_phi + OpBranch %44 + %44 = OpLabel + OpStore %x_63_phi %113 + %115 = OpSLessThan %bool %113 %int_10 + OpSelectionMerge %117 None + OpBranchConditional %115 %118 %119 + %118 = OpLabel + OpBranch %117 + %119 = OpLabel + OpBranch %43 + %117 = OpLabel + OpBranch %42 + %43 = OpLabel + OpStore %x_103_phi %int_0 + OpBranch %120 + %120 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %125 = OpLoad %int %x_103_phi + %126 = OpSLessThan %bool %125 %int_10 + OpSelectionMerge %127 None + OpBranchConditional %126 %128 %129 + %128 = OpLabel + OpBranch %127 + %129 = OpLabel + OpBranch %121 + %127 = OpLabel + OpBranch %122 + %122 = OpLabel + %130 = OpAccessChain %_ptr_Function_int %data %125 + %131 = OpLoad %int %130 + %132 = OpAccessChain %_ptr_Function_int %temp %125 + OpStore %132 %131 + %133 = OpIAdd %int %125 %int_1 + OpStore %x_104 %133 + %134 = OpLoad %int %x_104 + OpStore %x_103_phi %134 + OpBranch %120 + %121 = OpLabel + OpStore %x_112_phi %int_1 + OpBranch %135 + %135 = OpLabel + OpLoopMerge %136 %137 None + OpBranch %138 + %138 = OpLabel + %141 = OpLoad %int %x_112_phi + %143 = OpSLessThanEqual %bool %141 %int_9 + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %146 + %145 = OpLabel + OpBranch %144 + %146 = OpLabel + OpBranch %136 + %144 = OpLabel + OpStore %x_119_phi %int_0 + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %159 = OpLoad %int %x_119_phi + %160 = OpSLessThan %bool %159 %int_9 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + OpBranch %161 + %163 = OpLabel + OpBranch %148 + %161 = OpLabel + %164 = OpIAdd %int %159 %141 + %165 = OpISub %int %164 %int_1 + %166 = OpIMul %int %int_2 %141 + %167 = OpIAdd %int %159 %166 + %170 = OpISub %int %167 %int_1 + %168 = OpExtInst %int %169 SMin %170 %int_9 + OpStore %x_131_phi %159 + OpStore %x_134_phi %164 + OpStore %x_136_phi %159 + OpBranch %171 + %171 = OpLabel + OpLoopMerge %172 %173 None + OpBranch %174 + %174 = OpLabel + %179 = OpLoad %int %x_131_phi + OpStore %x_131 %179 + %180 = OpLoad %int %x_134_phi + %181 = OpLoad %int %x_136_phi + OpStore %x_136 %181 + %182 = OpLoad %int %x_136 + %183 = OpSLessThanEqual %bool %182 %165 + OpSelectionMerge %184 None + OpBranchConditional %183 %185 %184 + %185 = OpLabel + %186 = OpSLessThanEqual %bool %180 %168 + OpBranch %184 + %184 = OpLabel + %187 = OpPhi %bool %183 %174 %186 %185 + OpSelectionMerge %188 None + OpBranchConditional %187 %189 %190 + %189 = OpLabel + OpBranch %188 + %190 = OpLabel + OpBranch %172 + %188 = OpLabel + %191 = OpLoad %int %x_136 + %192 = OpAccessChain %_ptr_Function_int %data %191 + %193 = OpLoad %int %192 + %194 = OpAccessChain %_ptr_Function_int %data %180 + %195 = OpLoad %int %194 + %197 = OpLoad %int %x_131 + %198 = OpCopyObject %int %int_1 + %199 = OpIAdd %int %197 %198 + %196 = OpCopyObject %int %199 + %200 = OpSLessThan %bool %193 %195 + OpSelectionMerge %201 None + OpBranchConditional %200 %202 %203 + %202 = OpLabel + %205 = OpLoad %int %x_136 + %206 = OpCopyObject %int %int_1 + %207 = OpIAdd %int %205 %206 + %204 = OpCopyObject %int %207 + OpStore %x_151 %204 + %208 = OpAccessChain %_ptr_Function_int %data %191 + %209 = OpLoad %int %208 + %210 = OpLoad %int %x_131 + %211 = OpAccessChain %_ptr_Function_int %temp %210 + OpStore %211 %209 + OpStore %x_135_phi %180 + %212 = OpLoad %int %x_151 + OpStore %x_137_phi %212 + OpBranch %201 + %203 = OpLabel + %213 = OpIAdd %int %180 %int_1 + OpStore %x_154 %213 + %214 = OpAccessChain %_ptr_Function_int %data %180 + %215 = OpLoad %int %214 + %216 = OpLoad %int %x_131 + %217 = OpAccessChain %_ptr_Function_int %temp %216 + OpStore %217 %215 + %218 = OpLoad %int %x_154 + OpStore %x_135_phi %218 + %219 = OpLoad %int %x_136 + OpStore %x_137_phi %219 + OpBranch %201 + %201 = OpLabel + %220 = OpLoad %int %x_135_phi + %221 = OpLoad %int %x_137_phi + OpBranch %173 + %173 = OpLabel + OpStore %x_131_phi %196 + OpStore %x_134_phi %220 + OpStore %x_136_phi %221 + OpBranch %171 + %172 = OpLabel + %222 = OpLoad %int %x_131 + OpStore %x_158_phi %222 + %223 = OpLoad %int %x_136 + OpStore %x_161_phi %223 + OpBranch %224 + %224 = OpLabel + OpLoopMerge %225 %226 None + OpBranch %227 + %227 = OpLabel + %230 = OpLoad %int %x_158_phi + %231 = OpLoad %int %x_161_phi + %232 = OpSLessThan %bool %231 %int_10 + OpSelectionMerge %233 None + OpBranchConditional %232 %234 %233 + %234 = OpLabel + %235 = OpSLessThanEqual %bool %231 %165 + OpBranch %233 + %233 = OpLabel + %236 = OpPhi %bool %232 %227 %235 %234 + OpSelectionMerge %237 None + OpBranchConditional %236 %238 %239 + %238 = OpLabel + OpBranch %237 + %239 = OpLabel + OpBranch %225 + %237 = OpLabel + OpBranch %226 + %226 = OpLabel + %240 = OpIAdd %int %230 %int_1 + OpStore %x_159 %240 + %241 = OpIAdd %int %231 %int_1 + OpStore %x_162 %241 + %242 = OpAccessChain %_ptr_Function_int %data %231 + %243 = OpLoad %int %242 + %244 = OpAccessChain %_ptr_Function_int %temp %230 + OpStore %244 %243 + %245 = OpLoad %int %x_159 + OpStore %x_158_phi %245 + %246 = OpLoad %int %x_162 + OpStore %x_161_phi %246 + OpBranch %224 + %225 = OpLabel + OpStore %x_171_phi %159 + OpBranch %247 + %247 = OpLabel + OpLoopMerge %248 %249 None + OpBranch %250 + %250 = OpLabel + %252 = OpLoad %int %x_171_phi + %253 = OpSLessThanEqual %bool %252 %168 + OpSelectionMerge %254 None + OpBranchConditional %253 %255 %256 + %255 = OpLabel + OpBranch %254 + %256 = OpLabel + OpBranch %248 + %254 = OpLabel + OpBranch %249 + %249 = OpLabel + %257 = OpAccessChain %_ptr_Function_int %temp %252 + %258 = OpLoad %int %257 + %259 = OpAccessChain %_ptr_Function_int %data %252 + OpStore %259 %258 + %260 = OpIAdd %int %252 %int_1 + OpStore %x_172 %260 + %261 = OpLoad %int %x_172 + OpStore %x_171_phi %261 + OpBranch %247 + %248 = OpLabel + OpBranch %149 + %149 = OpLabel + OpStore %x_119_phi %167 + OpBranch %147 + %148 = OpLabel + OpBranch %137 + %137 = OpLabel + %262 = OpIMul %int %int_2 %141 + OpStore %x_113 %262 + %263 = OpLoad %int %x_113 + OpStore %x_112_phi %263 + OpBranch %135 + %136 = OpLabel + %270 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %271 = OpLoad %float %270 + %272 = OpConvertFToS %int %271 + OpStore %x_181 %272 + %273 = OpLoad %int %x_181 + %275 = OpSLessThan %bool %273 %int_30 + OpSelectionMerge %276 None + OpBranchConditional %275 %277 %278 + %277 = OpLabel + %279 = OpAccessChain %_ptr_Function_int %data %int_0 + %280 = OpLoad %int %279 + %282 = OpConvertSToF %float %280 + %284 = OpFMul %float %282 %float_0_100000001 + %285 = OpFAdd %float %float_0_5 %284 + OpStore %x_190 %285 + %286 = OpLoad %float %x_190 + OpStore %x_263_phi %286 + OpBranch %276 + %278 = OpLabel + %290 = OpLoad %int %x_181 + %292 = OpSLessThan %bool %290 %int_60 + OpSelectionMerge %293 None + OpBranchConditional %292 %294 %295 + %294 = OpLabel + %296 = OpAccessChain %_ptr_Function_int %data %int_1 + %297 = OpLoad %int %296 + %298 = OpConvertSToF %float %297 + %299 = OpFMul %float %298 %float_0_100000001 + %300 = OpFAdd %float %float_0_5 %299 + OpStore %x_199 %300 + %301 = OpLoad %float %x_199 + OpStore %x_262_phi %301 + OpBranch %293 + %295 = OpLabel + %305 = OpLoad %int %x_181 + %307 = OpSLessThan %bool %305 %int_90 + OpSelectionMerge %308 None + OpBranchConditional %307 %309 %310 + %309 = OpLabel + %311 = OpAccessChain %_ptr_Function_int %data %int_2 + %312 = OpLoad %int %311 + %313 = OpConvertSToF %float %312 + %314 = OpFMul %float %313 %float_0_100000001 + %315 = OpFAdd %float %float_0_5 %314 + OpStore %x_208 %315 + %316 = OpLoad %float %x_208 + OpStore %x_261_phi %316 + OpBranch %308 + %310 = OpLabel + %317 = OpLoad %int %x_181 + %319 = OpSLessThan %bool %317 %int_120 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %_ptr_Function_int %data %int_3 + %324 = OpLoad %int %323 + %325 = OpConvertSToF %float %324 + %326 = OpFMul %float %325 %float_0_100000001 + %327 = OpFAdd %float %float_0_5 %326 + OpStore %x_217 %327 + %328 = OpLoad %float %x_217 + OpStore %x_260_phi %328 + OpBranch %320 + %322 = OpLabel + %332 = OpLoad %int %x_181 + %334 = OpSLessThan %bool %332 %int_150 + OpSelectionMerge %335 None + OpBranchConditional %334 %336 %337 + %336 = OpLabel + OpKill + %337 = OpLabel + %341 = OpLoad %int %x_181 + %343 = OpSLessThan %bool %341 %int_180 + OpSelectionMerge %344 None + OpBranchConditional %343 %345 %346 + %345 = OpLabel + %348 = OpAccessChain %_ptr_Function_int %data %int_5 + %349 = OpLoad %int %348 + %350 = OpConvertSToF %float %349 + %351 = OpFMul %float %350 %float_0_100000001 + %352 = OpFAdd %float %float_0_5 %351 + OpStore %x_230 %352 + %353 = OpLoad %float %x_230 + OpStore %x_259_phi %353 + OpBranch %344 + %346 = OpLabel + %357 = OpLoad %int %x_181 + %359 = OpSLessThan %bool %357 %int_210 + OpSelectionMerge %360 None + OpBranchConditional %359 %361 %362 + %361 = OpLabel + %364 = OpAccessChain %_ptr_Function_int %data %int_6 + %365 = OpLoad %int %364 + %366 = OpConvertSToF %float %365 + %367 = OpFMul %float %366 %float_0_100000001 + %368 = OpFAdd %float %float_0_5 %367 + OpStore %x_239 %368 + %369 = OpLoad %float %x_239 + OpStore %x_258_phi %369 + OpBranch %360 + %362 = OpLabel + %370 = OpLoad %int %x_181 + %372 = OpSLessThan %bool %370 %int_240 + OpSelectionMerge %373 None + OpBranchConditional %372 %374 %375 + %374 = OpLabel + %377 = OpAccessChain %_ptr_Function_int %data %int_7 + %378 = OpLoad %int %377 + %379 = OpConvertSToF %float %378 + %380 = OpFMul %float %379 %float_0_100000001 + %381 = OpFAdd %float %float_0_5 %380 + OpStore %x_248 %381 + %382 = OpLoad %float %x_248 + OpStore %x_257_phi %382 + OpBranch %373 + %375 = OpLabel + %383 = OpLoad %int %x_181 + %385 = OpSLessThan %bool %383 %int_270 + OpSelectionMerge %386 None + OpBranchConditional %385 %387 %388 + %387 = OpLabel + OpBranch %386 + %388 = OpLabel + OpKill + %386 = OpLabel + %390 = OpAccessChain %_ptr_Function_int %data %int_8 + %391 = OpLoad %int %390 + %392 = OpConvertSToF %float %391 + %393 = OpFMul %float %392 %float_0_100000001 + %394 = OpFAdd %float %float_0_5 %393 + OpStore %x_256 %394 + %395 = OpLoad %float %x_256 + OpStore %x_257_phi %395 + OpBranch %373 + %373 = OpLabel + %396 = OpLoad %float %x_257_phi + OpStore %x_257 %396 + %397 = OpLoad %float %x_257 + OpStore %x_258_phi %397 + OpBranch %360 + %360 = OpLabel + %398 = OpLoad %float %x_258_phi + OpStore %x_258 %398 + %399 = OpLoad %float %x_258 + OpStore %x_259_phi %399 + OpBranch %344 + %344 = OpLabel + %400 = OpLoad %float %x_259_phi + OpStore %x_259 %400 + OpBranch %335 + %335 = OpLabel + %401 = OpLoad %float %x_259 + OpStore %x_260_phi %401 + OpBranch %320 + %320 = OpLabel + %402 = OpLoad %float %x_260_phi + OpStore %x_260 %402 + %403 = OpLoad %float %x_260 + OpStore %x_261_phi %403 + OpBranch %308 + %308 = OpLabel + %404 = OpLoad %float %x_261_phi + OpStore %x_261 %404 + %405 = OpLoad %float %x_261 + OpStore %x_262_phi %405 + OpBranch %293 + %293 = OpLabel + %406 = OpLoad %float %x_262_phi + OpStore %x_262 %406 + %407 = OpLoad %float %x_262 + OpStore %x_263_phi %407 + OpBranch %276 + %276 = OpLabel + %408 = OpLoad %float %x_263_phi + %410 = OpCompositeConstruct %v4float %408 %408 %408 %float_1 + OpStore %x_GLF_color %410 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %411 +%tint_symbol_1 = OpFunctionParameter %main_out + %415 = OpLabel + %416 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %416 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %418 = OpLabel + %419 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %419 + %420 = OpFunctionCall %void %main_1 + %422 = OpLoad %v4float %x_GLF_color + %423 = OpCompositeConstruct %main_out %422 + %421 = OpFunctionCall %void %tint_symbol_3 %423 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 44[%44] is not post dominated by the back-edge block 117[%117] + %117 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..fc4bfa1122 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.spvasm.expected.wgsl @@ -0,0 +1,341 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var temp : array; + var data : array; + var x_190 : f32; + var x_262 : f32; + var x_63_phi : i32; + var x_103_phi : i32; + var x_112_phi : i32; + var x_263_phi : f32; + let x_60 : f32 = x_8.injectionSwitch.x; + let x_61 : i32 = i32(x_60); + x_63_phi = x_61; + loop { + var x_100 : i32; + var x_98 : i32; + var x_96 : i32; + var x_94 : i32; + var x_92 : i32; + var x_90 : i32; + var x_88 : i32; + var x_86 : i32; + var x_84 : i32; + var x_82 : i32; + var x_64_phi : i32; + let x_63 : i32 = x_63_phi; + let x_68 : array = data; + data = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + data = x_68; + let x_69 : i32 = (x_63 + 1); + x_64_phi = x_69; + switch(x_63) { + case 9: { + data[x_63] = -5; + x_100 = (x_63 + 1); + x_64_phi = x_100; + } + case 8: { + data[x_63] = -4; + x_98 = (x_63 + 1); + x_64_phi = x_98; + } + case 7: { + data[x_63] = -3; + x_96 = (x_63 + 1); + x_64_phi = x_96; + } + case 6: { + data[x_63] = -2; + x_94 = (x_63 + 1); + x_64_phi = x_94; + } + case 5: { + data[x_63] = -1; + x_92 = (x_63 + 1); + x_64_phi = x_92; + } + case 4: { + data[x_63] = 0; + x_90 = (x_63 + 1); + x_64_phi = x_90; + } + case 3: { + data[x_63] = 1; + x_88 = (x_63 + 1); + x_64_phi = x_88; + } + case 2: { + data[x_63] = 2; + x_86 = (x_63 + 1); + x_64_phi = x_86; + } + case 1: { + data[x_63] = 3; + x_84 = (x_63 + 1); + x_64_phi = x_84; + } + case 0: { + data[x_63] = 4; + x_82 = (x_63 + 1); + x_64_phi = x_82; + } + default: { + } + } + let x_64 : i32 = x_64_phi; + + continuing { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_103_phi = 0; + loop { + var x_104 : i32; + let x_103 : i32 = x_103_phi; + if ((x_103 < 10)) { + } else { + break; + } + + continuing { + let x_109 : i32 = data[x_103]; + temp[x_103] = x_109; + x_104 = (x_103 + 1); + x_103_phi = x_104; + } + } + x_112_phi = 1; + loop { + var x_113 : i32; + var x_119_phi : i32; + let x_112 : i32 = x_112_phi; + if ((x_112 <= 9)) { + } else { + break; + } + x_119_phi = 0; + loop { + var x_131 : i32; + var x_136 : i32; + var x_131_phi : i32; + var x_134_phi : i32; + var x_136_phi : i32; + var x_158_phi : i32; + var x_161_phi : i32; + var x_171_phi : i32; + let x_119 : i32 = x_119_phi; + if ((x_119 < 9)) { + } else { + break; + } + let x_125 : i32 = (x_119 + x_112); + let x_126 : i32 = (x_125 - 1); + let x_120 : i32 = (x_119 + (2 * x_112)); + let x_129 : i32 = min((x_120 - 1), 9); + x_131_phi = x_119; + x_134_phi = x_125; + x_136_phi = x_119; + loop { + var x_151 : i32; + var x_154 : i32; + var x_135_phi : i32; + var x_137_phi : i32; + x_131 = x_131_phi; + let x_134 : i32 = x_134_phi; + x_136 = x_136_phi; + if (((x_136 <= x_126) && (x_134 <= x_129))) { + } else { + break; + } + let x_143 : ptr = &(data[x_136]); + let x_144 : i32 = *(x_143); + let x_145 : ptr = &(data[x_134]); + let x_146 : i32 = *(x_145); + let x_132 : i32 = bitcast((x_131 + bitcast(1))); + if ((x_144 < x_146)) { + x_151 = bitcast((x_136 + bitcast(1))); + let x_152 : i32 = *(x_143); + temp[x_131] = x_152; + x_135_phi = x_134; + x_137_phi = x_151; + } else { + x_154 = (x_134 + 1); + let x_155 : i32 = *(x_145); + temp[x_131] = x_155; + x_135_phi = x_154; + x_137_phi = x_136; + } + let x_135 : i32 = x_135_phi; + let x_137 : i32 = x_137_phi; + + continuing { + x_131_phi = x_132; + x_134_phi = x_135; + x_136_phi = x_137; + } + } + x_158_phi = x_131; + x_161_phi = x_136; + loop { + var x_159 : i32; + var x_162 : i32; + let x_158 : i32 = x_158_phi; + let x_161 : i32 = x_161_phi; + if (((x_161 < 10) && (x_161 <= x_126))) { + } else { + break; + } + + continuing { + x_159 = (x_158 + 1); + x_162 = (x_161 + 1); + let x_168 : i32 = data[x_161]; + temp[x_158] = x_168; + x_158_phi = x_159; + x_161_phi = x_162; + } + } + x_171_phi = x_119; + loop { + var x_172 : i32; + let x_171 : i32 = x_171_phi; + if ((x_171 <= x_129)) { + } else { + break; + } + + continuing { + let x_177 : i32 = temp[x_171]; + data[x_171] = x_177; + x_172 = (x_171 + 1); + x_171_phi = x_172; + } + } + + continuing { + x_119_phi = x_120; + } + } + + continuing { + x_113 = (2 * x_112); + x_112_phi = x_113; + } + } + var x_181 : i32; + var x_199 : f32; + var x_261 : f32; + var x_262_phi : f32; + let x_180 : f32 = gl_FragCoord.y; + x_181 = i32(x_180); + if ((x_181 < 30)) { + let x_187 : i32 = data[0]; + x_190 = (0.5 + (f32(x_187) * 0.100000001)); + x_263_phi = x_190; + } else { + var x_208 : f32; + var x_260 : f32; + var x_261_phi : f32; + if ((x_181 < 60)) { + let x_196 : i32 = data[1]; + x_199 = (0.5 + (f32(x_196) * 0.100000001)); + x_262_phi = x_199; + } else { + var x_217 : f32; + var x_259 : f32; + var x_260_phi : f32; + if ((x_181 < 90)) { + let x_205 : i32 = data[2]; + x_208 = (0.5 + (f32(x_205) * 0.100000001)); + x_261_phi = x_208; + } else { + if ((x_181 < 120)) { + let x_214 : i32 = data[3]; + x_217 = (0.5 + (f32(x_214) * 0.100000001)); + x_260_phi = x_217; + } else { + var x_230 : f32; + var x_258 : f32; + var x_259_phi : f32; + if ((x_181 < 150)) { + discard; + } else { + var x_239 : f32; + var x_257 : f32; + var x_258_phi : f32; + if ((x_181 < 180)) { + let x_227 : i32 = data[5]; + x_230 = (0.5 + (f32(x_227) * 0.100000001)); + x_259_phi = x_230; + } else { + var x_248 : f32; + var x_256 : f32; + var x_257_phi : f32; + if ((x_181 < 210)) { + let x_236 : i32 = data[6]; + x_239 = (0.5 + (f32(x_236) * 0.100000001)); + x_258_phi = x_239; + } else { + if ((x_181 < 240)) { + let x_245 : i32 = data[7]; + x_248 = (0.5 + (f32(x_245) * 0.100000001)); + x_257_phi = x_248; + } else { + if ((x_181 < 270)) { + } else { + discard; + } + let x_253 : i32 = data[8]; + x_256 = (0.5 + (f32(x_253) * 0.100000001)); + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + x_259_phi = x_258; + } + x_259 = x_259_phi; + } + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + x_262 = x_262_phi; + x_263_phi = x_262; + } + let x_263 : f32 = x_263_phi; + x_GLF_color = vec4(x_263, x_263, x_263, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl new file mode 100644 index 0000000000..fc4bfa1122 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl @@ -0,0 +1,341 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var temp : array; + var data : array; + var x_190 : f32; + var x_262 : f32; + var x_63_phi : i32; + var x_103_phi : i32; + var x_112_phi : i32; + var x_263_phi : f32; + let x_60 : f32 = x_8.injectionSwitch.x; + let x_61 : i32 = i32(x_60); + x_63_phi = x_61; + loop { + var x_100 : i32; + var x_98 : i32; + var x_96 : i32; + var x_94 : i32; + var x_92 : i32; + var x_90 : i32; + var x_88 : i32; + var x_86 : i32; + var x_84 : i32; + var x_82 : i32; + var x_64_phi : i32; + let x_63 : i32 = x_63_phi; + let x_68 : array = data; + data = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + data = x_68; + let x_69 : i32 = (x_63 + 1); + x_64_phi = x_69; + switch(x_63) { + case 9: { + data[x_63] = -5; + x_100 = (x_63 + 1); + x_64_phi = x_100; + } + case 8: { + data[x_63] = -4; + x_98 = (x_63 + 1); + x_64_phi = x_98; + } + case 7: { + data[x_63] = -3; + x_96 = (x_63 + 1); + x_64_phi = x_96; + } + case 6: { + data[x_63] = -2; + x_94 = (x_63 + 1); + x_64_phi = x_94; + } + case 5: { + data[x_63] = -1; + x_92 = (x_63 + 1); + x_64_phi = x_92; + } + case 4: { + data[x_63] = 0; + x_90 = (x_63 + 1); + x_64_phi = x_90; + } + case 3: { + data[x_63] = 1; + x_88 = (x_63 + 1); + x_64_phi = x_88; + } + case 2: { + data[x_63] = 2; + x_86 = (x_63 + 1); + x_64_phi = x_86; + } + case 1: { + data[x_63] = 3; + x_84 = (x_63 + 1); + x_64_phi = x_84; + } + case 0: { + data[x_63] = 4; + x_82 = (x_63 + 1); + x_64_phi = x_82; + } + default: { + } + } + let x_64 : i32 = x_64_phi; + + continuing { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_103_phi = 0; + loop { + var x_104 : i32; + let x_103 : i32 = x_103_phi; + if ((x_103 < 10)) { + } else { + break; + } + + continuing { + let x_109 : i32 = data[x_103]; + temp[x_103] = x_109; + x_104 = (x_103 + 1); + x_103_phi = x_104; + } + } + x_112_phi = 1; + loop { + var x_113 : i32; + var x_119_phi : i32; + let x_112 : i32 = x_112_phi; + if ((x_112 <= 9)) { + } else { + break; + } + x_119_phi = 0; + loop { + var x_131 : i32; + var x_136 : i32; + var x_131_phi : i32; + var x_134_phi : i32; + var x_136_phi : i32; + var x_158_phi : i32; + var x_161_phi : i32; + var x_171_phi : i32; + let x_119 : i32 = x_119_phi; + if ((x_119 < 9)) { + } else { + break; + } + let x_125 : i32 = (x_119 + x_112); + let x_126 : i32 = (x_125 - 1); + let x_120 : i32 = (x_119 + (2 * x_112)); + let x_129 : i32 = min((x_120 - 1), 9); + x_131_phi = x_119; + x_134_phi = x_125; + x_136_phi = x_119; + loop { + var x_151 : i32; + var x_154 : i32; + var x_135_phi : i32; + var x_137_phi : i32; + x_131 = x_131_phi; + let x_134 : i32 = x_134_phi; + x_136 = x_136_phi; + if (((x_136 <= x_126) && (x_134 <= x_129))) { + } else { + break; + } + let x_143 : ptr = &(data[x_136]); + let x_144 : i32 = *(x_143); + let x_145 : ptr = &(data[x_134]); + let x_146 : i32 = *(x_145); + let x_132 : i32 = bitcast((x_131 + bitcast(1))); + if ((x_144 < x_146)) { + x_151 = bitcast((x_136 + bitcast(1))); + let x_152 : i32 = *(x_143); + temp[x_131] = x_152; + x_135_phi = x_134; + x_137_phi = x_151; + } else { + x_154 = (x_134 + 1); + let x_155 : i32 = *(x_145); + temp[x_131] = x_155; + x_135_phi = x_154; + x_137_phi = x_136; + } + let x_135 : i32 = x_135_phi; + let x_137 : i32 = x_137_phi; + + continuing { + x_131_phi = x_132; + x_134_phi = x_135; + x_136_phi = x_137; + } + } + x_158_phi = x_131; + x_161_phi = x_136; + loop { + var x_159 : i32; + var x_162 : i32; + let x_158 : i32 = x_158_phi; + let x_161 : i32 = x_161_phi; + if (((x_161 < 10) && (x_161 <= x_126))) { + } else { + break; + } + + continuing { + x_159 = (x_158 + 1); + x_162 = (x_161 + 1); + let x_168 : i32 = data[x_161]; + temp[x_158] = x_168; + x_158_phi = x_159; + x_161_phi = x_162; + } + } + x_171_phi = x_119; + loop { + var x_172 : i32; + let x_171 : i32 = x_171_phi; + if ((x_171 <= x_129)) { + } else { + break; + } + + continuing { + let x_177 : i32 = temp[x_171]; + data[x_171] = x_177; + x_172 = (x_171 + 1); + x_171_phi = x_172; + } + } + + continuing { + x_119_phi = x_120; + } + } + + continuing { + x_113 = (2 * x_112); + x_112_phi = x_113; + } + } + var x_181 : i32; + var x_199 : f32; + var x_261 : f32; + var x_262_phi : f32; + let x_180 : f32 = gl_FragCoord.y; + x_181 = i32(x_180); + if ((x_181 < 30)) { + let x_187 : i32 = data[0]; + x_190 = (0.5 + (f32(x_187) * 0.100000001)); + x_263_phi = x_190; + } else { + var x_208 : f32; + var x_260 : f32; + var x_261_phi : f32; + if ((x_181 < 60)) { + let x_196 : i32 = data[1]; + x_199 = (0.5 + (f32(x_196) * 0.100000001)); + x_262_phi = x_199; + } else { + var x_217 : f32; + var x_259 : f32; + var x_260_phi : f32; + if ((x_181 < 90)) { + let x_205 : i32 = data[2]; + x_208 = (0.5 + (f32(x_205) * 0.100000001)); + x_261_phi = x_208; + } else { + if ((x_181 < 120)) { + let x_214 : i32 = data[3]; + x_217 = (0.5 + (f32(x_214) * 0.100000001)); + x_260_phi = x_217; + } else { + var x_230 : f32; + var x_258 : f32; + var x_259_phi : f32; + if ((x_181 < 150)) { + discard; + } else { + var x_239 : f32; + var x_257 : f32; + var x_258_phi : f32; + if ((x_181 < 180)) { + let x_227 : i32 = data[5]; + x_230 = (0.5 + (f32(x_227) * 0.100000001)); + x_259_phi = x_230; + } else { + var x_248 : f32; + var x_256 : f32; + var x_257_phi : f32; + if ((x_181 < 210)) { + let x_236 : i32 = data[6]; + x_239 = (0.5 + (f32(x_236) * 0.100000001)); + x_258_phi = x_239; + } else { + if ((x_181 < 240)) { + let x_245 : i32 = data[7]; + x_248 = (0.5 + (f32(x_245) * 0.100000001)); + x_257_phi = x_248; + } else { + if ((x_181 < 270)) { + } else { + discard; + } + let x_253 : i32 = data[8]; + x_256 = (0.5 + (f32(x_253) * 0.100000001)); + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + x_259_phi = x_258; + } + x_259 = x_259_phi; + } + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + x_262 = x_262_phi; + x_263_phi = x_262; + } + let x_263 : f32 = x_263_phi; + x_GLF_color = vec4(x_263, x_263, x_263, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..975a0e5bb2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.hlsl @@ -0,0 +1,356 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int temp[10] = (int[10])0; + int data[10] = (int[10])0; + float x_190 = 0.0f; + float x_262 = 0.0f; + int x_63_phi = 0; + int x_103_phi = 0; + int x_112_phi = 0; + float x_263_phi = 0.0f; + const float x_60 = asfloat(x_8[0].x); + const int x_61 = int(x_60); + x_63_phi = x_61; + while (true) { + int x_100 = 0; + int x_98 = 0; + int x_96 = 0; + int x_94 = 0; + int x_92 = 0; + int x_90 = 0; + int x_88 = 0; + int x_86 = 0; + int x_84 = 0; + int x_82 = 0; + int x_64_phi = 0; + const int x_63 = x_63_phi; + const int x_68[10] = data; + const int tint_symbol_5[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + data = tint_symbol_5; + data = x_68; + const int x_69 = (x_63 + 1); + x_64_phi = x_69; + switch(x_63) { + case 9: { + data[x_63] = -5; + x_100 = (x_63 + 1); + x_64_phi = x_100; + break; + } + case 8: { + data[x_63] = -4; + x_98 = (x_63 + 1); + x_64_phi = x_98; + break; + } + case 7: { + data[x_63] = -3; + x_96 = (x_63 + 1); + x_64_phi = x_96; + break; + } + case 6: { + data[x_63] = -2; + x_94 = (x_63 + 1); + x_64_phi = x_94; + break; + } + case 5: { + data[x_63] = -1; + x_92 = (x_63 + 1); + x_64_phi = x_92; + break; + } + case 4: { + data[x_63] = 0; + x_90 = (x_63 + 1); + x_64_phi = x_90; + break; + } + case 3: { + data[x_63] = 1; + x_88 = (x_63 + 1); + x_64_phi = x_88; + break; + } + case 2: { + data[x_63] = 2; + x_86 = (x_63 + 1); + x_64_phi = x_86; + break; + } + case 1: { + data[x_63] = 3; + x_84 = (x_63 + 1); + x_64_phi = x_84; + break; + } + case 0: { + data[x_63] = 4; + x_82 = (x_63 + 1); + x_64_phi = x_82; + break; + } + default: { + break; + } + } + const int x_64 = x_64_phi; + { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_103_phi = 0; + while (true) { + int x_104 = 0; + const int x_103 = x_103_phi; + if ((x_103 < 10)) { + } else { + break; + } + { + const int x_109 = data[x_103]; + temp[x_103] = x_109; + x_104 = (x_103 + 1); + x_103_phi = x_104; + } + } + x_112_phi = 1; + while (true) { + int x_113 = 0; + int x_119_phi = 0; + const int x_112 = x_112_phi; + if ((x_112 <= 9)) { + } else { + break; + } + x_119_phi = 0; + while (true) { + int x_131 = 0; + int x_136 = 0; + int x_131_phi = 0; + int x_134_phi = 0; + int x_136_phi = 0; + int x_158_phi = 0; + int x_161_phi = 0; + int x_171_phi = 0; + const int x_119 = x_119_phi; + if ((x_119 < 9)) { + } else { + break; + } + const int x_125 = (x_119 + x_112); + const int x_126 = (x_125 - 1); + const int x_120 = (x_119 + (2 * x_112)); + const int x_129 = min((x_120 - 1), 9); + x_131_phi = x_119; + x_134_phi = x_125; + x_136_phi = x_119; + while (true) { + int x_151 = 0; + int x_154 = 0; + int x_135_phi = 0; + int x_137_phi = 0; + x_131 = x_131_phi; + const int x_134 = x_134_phi; + x_136 = x_136_phi; + bool tint_tmp = (x_136 <= x_126); + if (tint_tmp) { + tint_tmp = (x_134 <= x_129); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_143_save = x_136; + const int x_144 = data[x_143_save]; + const int x_145_save = x_134; + const int x_146 = data[x_145_save]; + const int x_132 = asint((x_131 + asint(1))); + if ((x_144 < x_146)) { + x_151 = asint((x_136 + asint(1))); + const int x_152 = data[x_143_save]; + temp[x_131] = x_152; + x_135_phi = x_134; + x_137_phi = x_151; + } else { + x_154 = (x_134 + 1); + const int x_155 = data[x_145_save]; + temp[x_131] = x_155; + x_135_phi = x_154; + x_137_phi = x_136; + } + const int x_135 = x_135_phi; + const int x_137 = x_137_phi; + { + x_131_phi = x_132; + x_134_phi = x_135; + x_136_phi = x_137; + } + } + x_158_phi = x_131; + x_161_phi = x_136; + while (true) { + int x_159 = 0; + int x_162 = 0; + const int x_158 = x_158_phi; + const int x_161 = x_161_phi; + bool tint_tmp_1 = (x_161 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_161 <= x_126); + } + if ((tint_tmp_1)) { + } else { + break; + } + { + x_159 = (x_158 + 1); + x_162 = (x_161 + 1); + const int x_168 = data[x_161]; + temp[x_158] = x_168; + x_158_phi = x_159; + x_161_phi = x_162; + } + } + x_171_phi = x_119; + while (true) { + int x_172 = 0; + const int x_171 = x_171_phi; + if ((x_171 <= x_129)) { + } else { + break; + } + { + const int x_177 = temp[x_171]; + data[x_171] = x_177; + x_172 = (x_171 + 1); + x_171_phi = x_172; + } + } + { + x_119_phi = x_120; + } + } + { + x_113 = (2 * x_112); + x_112_phi = x_113; + } + } + int x_181 = 0; + float x_199 = 0.0f; + float x_261 = 0.0f; + float x_262_phi = 0.0f; + const float x_180 = gl_FragCoord.y; + x_181 = int(x_180); + if ((x_181 < 30)) { + const int x_187 = data[0]; + x_190 = (0.5f + (float(x_187) * 0.100000001f)); + x_263_phi = x_190; + } else { + float x_208 = 0.0f; + float x_260 = 0.0f; + float x_261_phi = 0.0f; + if ((x_181 < 60)) { + const int x_196 = data[1]; + x_199 = (0.5f + (float(x_196) * 0.100000001f)); + x_262_phi = x_199; + } else { + float x_217 = 0.0f; + float x_259 = 0.0f; + float x_260_phi = 0.0f; + if ((x_181 < 90)) { + const int x_205 = data[2]; + x_208 = (0.5f + (float(x_205) * 0.100000001f)); + x_261_phi = x_208; + } else { + if ((x_181 < 120)) { + const int x_214 = data[3]; + x_217 = (0.5f + (float(x_214) * 0.100000001f)); + x_260_phi = x_217; + } else { + float x_230 = 0.0f; + float x_258 = 0.0f; + float x_259_phi = 0.0f; + if ((x_181 < 150)) { + discard; + } else { + float x_239 = 0.0f; + float x_257 = 0.0f; + float x_258_phi = 0.0f; + if ((x_181 < 180)) { + const int x_227 = data[5]; + x_230 = (0.5f + (float(x_227) * 0.100000001f)); + x_259_phi = x_230; + } else { + float x_248 = 0.0f; + float x_256 = 0.0f; + float x_257_phi = 0.0f; + if ((x_181 < 210)) { + const int x_236 = data[6]; + x_239 = (0.5f + (float(x_236) * 0.100000001f)); + x_258_phi = x_239; + } else { + if ((x_181 < 240)) { + const int x_245 = data[7]; + x_248 = (0.5f + (float(x_245) * 0.100000001f)); + x_257_phi = x_248; + } else { + if ((x_181 < 270)) { + } else { + discard; + } + const int x_253 = data[8]; + x_256 = (0.5f + (float(x_253) * 0.100000001f)); + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + x_259_phi = x_258; + } + x_259 = x_259_phi; + } + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + x_262 = x_262_phi; + x_263_phi = x_262; + } + const float x_263 = x_263_phi; + x_GLF_color = float4(x_263, x_263, x_263, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.msl new file mode 100644 index 0000000000..e8a7ca8cee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.msl @@ -0,0 +1,350 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper temp = {}; + tint_array_wrapper data = {}; + float x_190 = 0.0f; + float x_262 = 0.0f; + int x_63_phi = 0; + int x_103_phi = 0; + int x_112_phi = 0; + float x_263_phi = 0.0f; + float const x_60 = x_8.injectionSwitch.x; + int const x_61 = int(x_60); + x_63_phi = x_61; + while (true) { + int x_100 = 0; + int x_98 = 0; + int x_96 = 0; + int x_94 = 0; + int x_92 = 0; + int x_90 = 0; + int x_88 = 0; + int x_86 = 0; + int x_84 = 0; + int x_82 = 0; + int x_64_phi = 0; + int const x_63 = x_63_phi; + tint_array_wrapper const x_68 = data; + tint_array_wrapper const tint_symbol_4 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + data = tint_symbol_4; + data = x_68; + int const x_69 = (x_63 + 1); + x_64_phi = x_69; + switch(x_63) { + case 9: { + data.arr[x_63] = -5; + x_100 = (x_63 + 1); + x_64_phi = x_100; + break; + } + case 8: { + data.arr[x_63] = -4; + x_98 = (x_63 + 1); + x_64_phi = x_98; + break; + } + case 7: { + data.arr[x_63] = -3; + x_96 = (x_63 + 1); + x_64_phi = x_96; + break; + } + case 6: { + data.arr[x_63] = -2; + x_94 = (x_63 + 1); + x_64_phi = x_94; + break; + } + case 5: { + data.arr[x_63] = -1; + x_92 = (x_63 + 1); + x_64_phi = x_92; + break; + } + case 4: { + data.arr[x_63] = 0; + x_90 = (x_63 + 1); + x_64_phi = x_90; + break; + } + case 3: { + data.arr[x_63] = 1; + x_88 = (x_63 + 1); + x_64_phi = x_88; + break; + } + case 2: { + data.arr[x_63] = 2; + x_86 = (x_63 + 1); + x_64_phi = x_86; + break; + } + case 1: { + data.arr[x_63] = 3; + x_84 = (x_63 + 1); + x_64_phi = x_84; + break; + } + case 0: { + data.arr[x_63] = 4; + x_82 = (x_63 + 1); + x_64_phi = x_82; + break; + } + default: { + break; + } + } + int const x_64 = x_64_phi; + { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_103_phi = 0; + while (true) { + int x_104 = 0; + int const x_103 = x_103_phi; + if ((x_103 < 10)) { + } else { + break; + } + { + int const x_109 = data.arr[x_103]; + temp.arr[x_103] = x_109; + x_104 = (x_103 + 1); + x_103_phi = x_104; + } + } + x_112_phi = 1; + while (true) { + int x_113 = 0; + int x_119_phi = 0; + int const x_112 = x_112_phi; + if ((x_112 <= 9)) { + } else { + break; + } + x_119_phi = 0; + while (true) { + int x_131 = 0; + int x_136 = 0; + int x_131_phi = 0; + int x_134_phi = 0; + int x_136_phi = 0; + int x_158_phi = 0; + int x_161_phi = 0; + int x_171_phi = 0; + int const x_119 = x_119_phi; + if ((x_119 < 9)) { + } else { + break; + } + int const x_125 = (x_119 + x_112); + int const x_126 = (x_125 - 1); + int const x_120 = (x_119 + (2 * x_112)); + int const x_129 = min((x_120 - 1), 9); + x_131_phi = x_119; + x_134_phi = x_125; + x_136_phi = x_119; + while (true) { + int x_151 = 0; + int x_154 = 0; + int x_135_phi = 0; + int x_137_phi = 0; + x_131 = x_131_phi; + int const x_134 = x_134_phi; + x_136 = x_136_phi; + if (((x_136 <= x_126) && (x_134 <= x_129))) { + } else { + break; + } + int const x_143_save = x_136; + int const x_144 = data.arr[x_143_save]; + int const x_145_save = x_134; + int const x_146 = data.arr[x_145_save]; + int const x_132 = as_type((x_131 + as_type(1))); + if ((x_144 < x_146)) { + x_151 = as_type((x_136 + as_type(1))); + int const x_152 = data.arr[x_143_save]; + temp.arr[x_131] = x_152; + x_135_phi = x_134; + x_137_phi = x_151; + } else { + x_154 = (x_134 + 1); + int const x_155 = data.arr[x_145_save]; + temp.arr[x_131] = x_155; + x_135_phi = x_154; + x_137_phi = x_136; + } + int const x_135 = x_135_phi; + int const x_137 = x_137_phi; + { + x_131_phi = x_132; + x_134_phi = x_135; + x_136_phi = x_137; + } + } + x_158_phi = x_131; + x_161_phi = x_136; + while (true) { + int x_159 = 0; + int x_162 = 0; + int const x_158 = x_158_phi; + int const x_161 = x_161_phi; + if (((x_161 < 10) && (x_161 <= x_126))) { + } else { + break; + } + { + x_159 = (x_158 + 1); + x_162 = (x_161 + 1); + int const x_168 = data.arr[x_161]; + temp.arr[x_158] = x_168; + x_158_phi = x_159; + x_161_phi = x_162; + } + } + x_171_phi = x_119; + while (true) { + int x_172 = 0; + int const x_171 = x_171_phi; + if ((x_171 <= x_129)) { + } else { + break; + } + { + int const x_177 = temp.arr[x_171]; + data.arr[x_171] = x_177; + x_172 = (x_171 + 1); + x_171_phi = x_172; + } + } + { + x_119_phi = x_120; + } + } + { + x_113 = (2 * x_112); + x_112_phi = x_113; + } + } + int x_181 = 0; + float x_199 = 0.0f; + float x_261 = 0.0f; + float x_262_phi = 0.0f; + float const x_180 = (*(tint_symbol_6)).y; + x_181 = int(x_180); + if ((x_181 < 30)) { + int const x_187 = data.arr[0]; + x_190 = (0.5f + (float(x_187) * 0.100000001f)); + x_263_phi = x_190; + } else { + float x_208 = 0.0f; + float x_260 = 0.0f; + float x_261_phi = 0.0f; + if ((x_181 < 60)) { + int const x_196 = data.arr[1]; + x_199 = (0.5f + (float(x_196) * 0.100000001f)); + x_262_phi = x_199; + } else { + float x_217 = 0.0f; + float x_259 = 0.0f; + float x_260_phi = 0.0f; + if ((x_181 < 90)) { + int const x_205 = data.arr[2]; + x_208 = (0.5f + (float(x_205) * 0.100000001f)); + x_261_phi = x_208; + } else { + if ((x_181 < 120)) { + int const x_214 = data.arr[3]; + x_217 = (0.5f + (float(x_214) * 0.100000001f)); + x_260_phi = x_217; + } else { + float x_230 = 0.0f; + float x_258 = 0.0f; + float x_259_phi = 0.0f; + if ((x_181 < 150)) { + discard_fragment(); + } else { + float x_239 = 0.0f; + float x_257 = 0.0f; + float x_258_phi = 0.0f; + if ((x_181 < 180)) { + int const x_227 = data.arr[5]; + x_230 = (0.5f + (float(x_227) * 0.100000001f)); + x_259_phi = x_230; + } else { + float x_248 = 0.0f; + float x_256 = 0.0f; + float x_257_phi = 0.0f; + if ((x_181 < 210)) { + int const x_236 = data.arr[6]; + x_239 = (0.5f + (float(x_236) * 0.100000001f)); + x_258_phi = x_239; + } else { + if ((x_181 < 240)) { + int const x_245 = data.arr[7]; + x_248 = (0.5f + (float(x_245) * 0.100000001f)); + x_257_phi = x_248; + } else { + if ((x_181 < 270)) { + } else { + discard_fragment(); + } + int const x_253 = data.arr[8]; + x_256 = (0.5f + (float(x_253) * 0.100000001f)); + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + x_259_phi = x_258; + } + x_259 = x_259_phi; + } + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + x_262 = x_262_phi; + x_263_phi = x_262; + } + float const x_263 = x_263_phi; + *(tint_symbol_7) = float4(x_263, x_263, x_263, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..63a761de45 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.spvasm @@ -0,0 +1,746 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 424 +; Schema: 0 + OpCapability Shader + %169 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %temp "temp" + OpName %data "data" + OpName %x_190 "x_190" + OpName %x_262 "x_262" + OpName %x_63_phi "x_63_phi" + OpName %x_103_phi "x_103_phi" + OpName %x_112_phi "x_112_phi" + OpName %x_263_phi "x_263_phi" + OpName %x_100 "x_100" + OpName %x_98 "x_98" + OpName %x_96 "x_96" + OpName %x_94 "x_94" + OpName %x_92 "x_92" + OpName %x_90 "x_90" + OpName %x_88 "x_88" + OpName %x_86 "x_86" + OpName %x_84 "x_84" + OpName %x_82 "x_82" + OpName %x_64_phi "x_64_phi" + OpName %x_104 "x_104" + OpName %x_113 "x_113" + OpName %x_119_phi "x_119_phi" + OpName %x_131 "x_131" + OpName %x_136 "x_136" + OpName %x_131_phi "x_131_phi" + OpName %x_134_phi "x_134_phi" + OpName %x_136_phi "x_136_phi" + OpName %x_158_phi "x_158_phi" + OpName %x_161_phi "x_161_phi" + OpName %x_171_phi "x_171_phi" + OpName %x_151 "x_151" + OpName %x_154 "x_154" + OpName %x_135_phi "x_135_phi" + OpName %x_137_phi "x_137_phi" + OpName %x_159 "x_159" + OpName %x_162 "x_162" + OpName %x_172 "x_172" + OpName %x_181 "x_181" + OpName %x_199 "x_199" + OpName %x_261 "x_261" + OpName %x_262_phi "x_262_phi" + OpName %x_208 "x_208" + OpName %x_260 "x_260" + OpName %x_261_phi "x_261_phi" + OpName %x_217 "x_217" + OpName %x_259 "x_259" + OpName %x_260_phi "x_260_phi" + OpName %x_230 "x_230" + OpName %x_258 "x_258" + OpName %x_259_phi "x_259_phi" + OpName %x_239 "x_239" + OpName %x_257 "x_257" + OpName %x_258_phi "x_258_phi" + OpName %x_248 "x_248" + OpName %x_256 "x_256" + OpName %x_257_phi "x_257_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %25 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_0 = OpConstant %int 0 + %60 = OpConstantComposite %_arr_int_uint_10 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 + %int_1 = OpConstant %int 1 + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 +%float_0_100000001 = OpConstant %float 0.100000001 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %411 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %temp = OpVariable %_ptr_Function__arr_int_uint_10 Function %25 + %data = OpVariable %_ptr_Function__arr_int_uint_10 Function %25 + %x_190 = OpVariable %_ptr_Function_float Function %29 + %x_262 = OpVariable %_ptr_Function_float Function %29 + %x_63_phi = OpVariable %_ptr_Function_int Function %33 + %x_103_phi = OpVariable %_ptr_Function_int Function %33 + %x_112_phi = OpVariable %_ptr_Function_int Function %33 + %x_263_phi = OpVariable %_ptr_Function_float Function %29 + %x_100 = OpVariable %_ptr_Function_int Function %33 + %x_98 = OpVariable %_ptr_Function_int Function %33 + %x_96 = OpVariable %_ptr_Function_int Function %33 + %x_94 = OpVariable %_ptr_Function_int Function %33 + %x_92 = OpVariable %_ptr_Function_int Function %33 + %x_90 = OpVariable %_ptr_Function_int Function %33 + %x_88 = OpVariable %_ptr_Function_int Function %33 + %x_86 = OpVariable %_ptr_Function_int Function %33 + %x_84 = OpVariable %_ptr_Function_int Function %33 + %x_82 = OpVariable %_ptr_Function_int Function %33 + %x_64_phi = OpVariable %_ptr_Function_int Function %33 + %x_104 = OpVariable %_ptr_Function_int Function %33 + %x_113 = OpVariable %_ptr_Function_int Function %33 + %x_119_phi = OpVariable %_ptr_Function_int Function %33 + %x_131 = OpVariable %_ptr_Function_int Function %33 + %x_136 = OpVariable %_ptr_Function_int Function %33 + %x_131_phi = OpVariable %_ptr_Function_int Function %33 + %x_134_phi = OpVariable %_ptr_Function_int Function %33 + %x_136_phi = OpVariable %_ptr_Function_int Function %33 + %x_158_phi = OpVariable %_ptr_Function_int Function %33 + %x_161_phi = OpVariable %_ptr_Function_int Function %33 + %x_171_phi = OpVariable %_ptr_Function_int Function %33 + %x_151 = OpVariable %_ptr_Function_int Function %33 + %x_154 = OpVariable %_ptr_Function_int Function %33 + %x_135_phi = OpVariable %_ptr_Function_int Function %33 + %x_137_phi = OpVariable %_ptr_Function_int Function %33 + %x_159 = OpVariable %_ptr_Function_int Function %33 + %x_162 = OpVariable %_ptr_Function_int Function %33 + %x_172 = OpVariable %_ptr_Function_int Function %33 + %x_181 = OpVariable %_ptr_Function_int Function %33 + %x_199 = OpVariable %_ptr_Function_float Function %29 + %x_261 = OpVariable %_ptr_Function_float Function %29 + %x_262_phi = OpVariable %_ptr_Function_float Function %29 + %x_208 = OpVariable %_ptr_Function_float Function %29 + %x_260 = OpVariable %_ptr_Function_float Function %29 + %x_261_phi = OpVariable %_ptr_Function_float Function %29 + %x_217 = OpVariable %_ptr_Function_float Function %29 + %x_259 = OpVariable %_ptr_Function_float Function %29 + %x_260_phi = OpVariable %_ptr_Function_float Function %29 + %x_230 = OpVariable %_ptr_Function_float Function %29 + %x_258 = OpVariable %_ptr_Function_float Function %29 + %x_259_phi = OpVariable %_ptr_Function_float Function %29 + %x_239 = OpVariable %_ptr_Function_float Function %29 + %x_257 = OpVariable %_ptr_Function_float Function %29 + %x_258_phi = OpVariable %_ptr_Function_float Function %29 + %x_248 = OpVariable %_ptr_Function_float Function %29 + %x_256 = OpVariable %_ptr_Function_float Function %29 + %x_257_phi = OpVariable %_ptr_Function_float Function %29 + %39 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %40 = OpLoad %float %39 + %41 = OpConvertFToS %int %40 + OpStore %x_63_phi %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %57 = OpLoad %int %x_63_phi + %58 = OpLoad %_arr_int_uint_10 %data + OpStore %data %60 + OpStore %data %58 + %62 = OpIAdd %int %57 %int_1 + OpStore %x_64_phi %62 + OpSelectionMerge %63 None + OpSwitch %57 %64 9 %65 8 %66 7 %67 6 %68 5 %69 4 %70 3 %71 2 %72 1 %73 0 %74 + %65 = OpLabel + %75 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %75 %int_n5 + %77 = OpIAdd %int %57 %int_1 + OpStore %x_100 %77 + %78 = OpLoad %int %x_100 + OpStore %x_64_phi %78 + OpBranch %63 + %66 = OpLabel + %79 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %79 %int_n4 + %81 = OpIAdd %int %57 %int_1 + OpStore %x_98 %81 + %82 = OpLoad %int %x_98 + OpStore %x_64_phi %82 + OpBranch %63 + %67 = OpLabel + %83 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %83 %int_n3 + %85 = OpIAdd %int %57 %int_1 + OpStore %x_96 %85 + %86 = OpLoad %int %x_96 + OpStore %x_64_phi %86 + OpBranch %63 + %68 = OpLabel + %87 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %87 %int_n2 + %89 = OpIAdd %int %57 %int_1 + OpStore %x_94 %89 + %90 = OpLoad %int %x_94 + OpStore %x_64_phi %90 + OpBranch %63 + %69 = OpLabel + %91 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %91 %int_n1 + %93 = OpIAdd %int %57 %int_1 + OpStore %x_92 %93 + %94 = OpLoad %int %x_92 + OpStore %x_64_phi %94 + OpBranch %63 + %70 = OpLabel + %95 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %95 %int_0 + %96 = OpIAdd %int %57 %int_1 + OpStore %x_90 %96 + %97 = OpLoad %int %x_90 + OpStore %x_64_phi %97 + OpBranch %63 + %71 = OpLabel + %98 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %98 %int_1 + %99 = OpIAdd %int %57 %int_1 + OpStore %x_88 %99 + %100 = OpLoad %int %x_88 + OpStore %x_64_phi %100 + OpBranch %63 + %72 = OpLabel + %101 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %101 %int_2 + %103 = OpIAdd %int %57 %int_1 + OpStore %x_86 %103 + %104 = OpLoad %int %x_86 + OpStore %x_64_phi %104 + OpBranch %63 + %73 = OpLabel + %105 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %105 %int_3 + %107 = OpIAdd %int %57 %int_1 + OpStore %x_84 %107 + %108 = OpLoad %int %x_84 + OpStore %x_64_phi %108 + OpBranch %63 + %74 = OpLabel + %109 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %109 %int_4 + %111 = OpIAdd %int %57 %int_1 + OpStore %x_82 %111 + %112 = OpLoad %int %x_82 + OpStore %x_64_phi %112 + OpBranch %63 + %64 = OpLabel + OpBranch %63 + %63 = OpLabel + %113 = OpLoad %int %x_64_phi + OpBranch %44 + %44 = OpLabel + OpStore %x_63_phi %113 + %115 = OpSLessThan %bool %113 %int_10 + OpSelectionMerge %117 None + OpBranchConditional %115 %118 %119 + %118 = OpLabel + OpBranch %117 + %119 = OpLabel + OpBranch %43 + %117 = OpLabel + OpBranch %42 + %43 = OpLabel + OpStore %x_103_phi %int_0 + OpBranch %120 + %120 = OpLabel + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %125 = OpLoad %int %x_103_phi + %126 = OpSLessThan %bool %125 %int_10 + OpSelectionMerge %127 None + OpBranchConditional %126 %128 %129 + %128 = OpLabel + OpBranch %127 + %129 = OpLabel + OpBranch %121 + %127 = OpLabel + OpBranch %122 + %122 = OpLabel + %130 = OpAccessChain %_ptr_Function_int %data %125 + %131 = OpLoad %int %130 + %132 = OpAccessChain %_ptr_Function_int %temp %125 + OpStore %132 %131 + %133 = OpIAdd %int %125 %int_1 + OpStore %x_104 %133 + %134 = OpLoad %int %x_104 + OpStore %x_103_phi %134 + OpBranch %120 + %121 = OpLabel + OpStore %x_112_phi %int_1 + OpBranch %135 + %135 = OpLabel + OpLoopMerge %136 %137 None + OpBranch %138 + %138 = OpLabel + %141 = OpLoad %int %x_112_phi + %143 = OpSLessThanEqual %bool %141 %int_9 + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %146 + %145 = OpLabel + OpBranch %144 + %146 = OpLabel + OpBranch %136 + %144 = OpLabel + OpStore %x_119_phi %int_0 + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %159 = OpLoad %int %x_119_phi + %160 = OpSLessThan %bool %159 %int_9 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + OpBranch %161 + %163 = OpLabel + OpBranch %148 + %161 = OpLabel + %164 = OpIAdd %int %159 %141 + %165 = OpISub %int %164 %int_1 + %166 = OpIMul %int %int_2 %141 + %167 = OpIAdd %int %159 %166 + %170 = OpISub %int %167 %int_1 + %168 = OpExtInst %int %169 SMin %170 %int_9 + OpStore %x_131_phi %159 + OpStore %x_134_phi %164 + OpStore %x_136_phi %159 + OpBranch %171 + %171 = OpLabel + OpLoopMerge %172 %173 None + OpBranch %174 + %174 = OpLabel + %179 = OpLoad %int %x_131_phi + OpStore %x_131 %179 + %180 = OpLoad %int %x_134_phi + %181 = OpLoad %int %x_136_phi + OpStore %x_136 %181 + %182 = OpLoad %int %x_136 + %183 = OpSLessThanEqual %bool %182 %165 + OpSelectionMerge %184 None + OpBranchConditional %183 %185 %184 + %185 = OpLabel + %186 = OpSLessThanEqual %bool %180 %168 + OpBranch %184 + %184 = OpLabel + %187 = OpPhi %bool %183 %174 %186 %185 + OpSelectionMerge %188 None + OpBranchConditional %187 %189 %190 + %189 = OpLabel + OpBranch %188 + %190 = OpLabel + OpBranch %172 + %188 = OpLabel + %191 = OpLoad %int %x_136 + %192 = OpAccessChain %_ptr_Function_int %data %191 + %193 = OpLoad %int %192 + %194 = OpAccessChain %_ptr_Function_int %data %180 + %195 = OpLoad %int %194 + %197 = OpLoad %int %x_131 + %198 = OpCopyObject %int %int_1 + %199 = OpIAdd %int %197 %198 + %196 = OpCopyObject %int %199 + %200 = OpSLessThan %bool %193 %195 + OpSelectionMerge %201 None + OpBranchConditional %200 %202 %203 + %202 = OpLabel + %205 = OpLoad %int %x_136 + %206 = OpCopyObject %int %int_1 + %207 = OpIAdd %int %205 %206 + %204 = OpCopyObject %int %207 + OpStore %x_151 %204 + %208 = OpAccessChain %_ptr_Function_int %data %191 + %209 = OpLoad %int %208 + %210 = OpLoad %int %x_131 + %211 = OpAccessChain %_ptr_Function_int %temp %210 + OpStore %211 %209 + OpStore %x_135_phi %180 + %212 = OpLoad %int %x_151 + OpStore %x_137_phi %212 + OpBranch %201 + %203 = OpLabel + %213 = OpIAdd %int %180 %int_1 + OpStore %x_154 %213 + %214 = OpAccessChain %_ptr_Function_int %data %180 + %215 = OpLoad %int %214 + %216 = OpLoad %int %x_131 + %217 = OpAccessChain %_ptr_Function_int %temp %216 + OpStore %217 %215 + %218 = OpLoad %int %x_154 + OpStore %x_135_phi %218 + %219 = OpLoad %int %x_136 + OpStore %x_137_phi %219 + OpBranch %201 + %201 = OpLabel + %220 = OpLoad %int %x_135_phi + %221 = OpLoad %int %x_137_phi + OpBranch %173 + %173 = OpLabel + OpStore %x_131_phi %196 + OpStore %x_134_phi %220 + OpStore %x_136_phi %221 + OpBranch %171 + %172 = OpLabel + %222 = OpLoad %int %x_131 + OpStore %x_158_phi %222 + %223 = OpLoad %int %x_136 + OpStore %x_161_phi %223 + OpBranch %224 + %224 = OpLabel + OpLoopMerge %225 %226 None + OpBranch %227 + %227 = OpLabel + %230 = OpLoad %int %x_158_phi + %231 = OpLoad %int %x_161_phi + %232 = OpSLessThan %bool %231 %int_10 + OpSelectionMerge %233 None + OpBranchConditional %232 %234 %233 + %234 = OpLabel + %235 = OpSLessThanEqual %bool %231 %165 + OpBranch %233 + %233 = OpLabel + %236 = OpPhi %bool %232 %227 %235 %234 + OpSelectionMerge %237 None + OpBranchConditional %236 %238 %239 + %238 = OpLabel + OpBranch %237 + %239 = OpLabel + OpBranch %225 + %237 = OpLabel + OpBranch %226 + %226 = OpLabel + %240 = OpIAdd %int %230 %int_1 + OpStore %x_159 %240 + %241 = OpIAdd %int %231 %int_1 + OpStore %x_162 %241 + %242 = OpAccessChain %_ptr_Function_int %data %231 + %243 = OpLoad %int %242 + %244 = OpAccessChain %_ptr_Function_int %temp %230 + OpStore %244 %243 + %245 = OpLoad %int %x_159 + OpStore %x_158_phi %245 + %246 = OpLoad %int %x_162 + OpStore %x_161_phi %246 + OpBranch %224 + %225 = OpLabel + OpStore %x_171_phi %159 + OpBranch %247 + %247 = OpLabel + OpLoopMerge %248 %249 None + OpBranch %250 + %250 = OpLabel + %252 = OpLoad %int %x_171_phi + %253 = OpSLessThanEqual %bool %252 %168 + OpSelectionMerge %254 None + OpBranchConditional %253 %255 %256 + %255 = OpLabel + OpBranch %254 + %256 = OpLabel + OpBranch %248 + %254 = OpLabel + OpBranch %249 + %249 = OpLabel + %257 = OpAccessChain %_ptr_Function_int %temp %252 + %258 = OpLoad %int %257 + %259 = OpAccessChain %_ptr_Function_int %data %252 + OpStore %259 %258 + %260 = OpIAdd %int %252 %int_1 + OpStore %x_172 %260 + %261 = OpLoad %int %x_172 + OpStore %x_171_phi %261 + OpBranch %247 + %248 = OpLabel + OpBranch %149 + %149 = OpLabel + OpStore %x_119_phi %167 + OpBranch %147 + %148 = OpLabel + OpBranch %137 + %137 = OpLabel + %262 = OpIMul %int %int_2 %141 + OpStore %x_113 %262 + %263 = OpLoad %int %x_113 + OpStore %x_112_phi %263 + OpBranch %135 + %136 = OpLabel + %270 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %271 = OpLoad %float %270 + %272 = OpConvertFToS %int %271 + OpStore %x_181 %272 + %273 = OpLoad %int %x_181 + %275 = OpSLessThan %bool %273 %int_30 + OpSelectionMerge %276 None + OpBranchConditional %275 %277 %278 + %277 = OpLabel + %279 = OpAccessChain %_ptr_Function_int %data %int_0 + %280 = OpLoad %int %279 + %282 = OpConvertSToF %float %280 + %284 = OpFMul %float %282 %float_0_100000001 + %285 = OpFAdd %float %float_0_5 %284 + OpStore %x_190 %285 + %286 = OpLoad %float %x_190 + OpStore %x_263_phi %286 + OpBranch %276 + %278 = OpLabel + %290 = OpLoad %int %x_181 + %292 = OpSLessThan %bool %290 %int_60 + OpSelectionMerge %293 None + OpBranchConditional %292 %294 %295 + %294 = OpLabel + %296 = OpAccessChain %_ptr_Function_int %data %int_1 + %297 = OpLoad %int %296 + %298 = OpConvertSToF %float %297 + %299 = OpFMul %float %298 %float_0_100000001 + %300 = OpFAdd %float %float_0_5 %299 + OpStore %x_199 %300 + %301 = OpLoad %float %x_199 + OpStore %x_262_phi %301 + OpBranch %293 + %295 = OpLabel + %305 = OpLoad %int %x_181 + %307 = OpSLessThan %bool %305 %int_90 + OpSelectionMerge %308 None + OpBranchConditional %307 %309 %310 + %309 = OpLabel + %311 = OpAccessChain %_ptr_Function_int %data %int_2 + %312 = OpLoad %int %311 + %313 = OpConvertSToF %float %312 + %314 = OpFMul %float %313 %float_0_100000001 + %315 = OpFAdd %float %float_0_5 %314 + OpStore %x_208 %315 + %316 = OpLoad %float %x_208 + OpStore %x_261_phi %316 + OpBranch %308 + %310 = OpLabel + %317 = OpLoad %int %x_181 + %319 = OpSLessThan %bool %317 %int_120 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %_ptr_Function_int %data %int_3 + %324 = OpLoad %int %323 + %325 = OpConvertSToF %float %324 + %326 = OpFMul %float %325 %float_0_100000001 + %327 = OpFAdd %float %float_0_5 %326 + OpStore %x_217 %327 + %328 = OpLoad %float %x_217 + OpStore %x_260_phi %328 + OpBranch %320 + %322 = OpLabel + %332 = OpLoad %int %x_181 + %334 = OpSLessThan %bool %332 %int_150 + OpSelectionMerge %335 None + OpBranchConditional %334 %336 %337 + %336 = OpLabel + OpKill + %337 = OpLabel + %341 = OpLoad %int %x_181 + %343 = OpSLessThan %bool %341 %int_180 + OpSelectionMerge %344 None + OpBranchConditional %343 %345 %346 + %345 = OpLabel + %348 = OpAccessChain %_ptr_Function_int %data %int_5 + %349 = OpLoad %int %348 + %350 = OpConvertSToF %float %349 + %351 = OpFMul %float %350 %float_0_100000001 + %352 = OpFAdd %float %float_0_5 %351 + OpStore %x_230 %352 + %353 = OpLoad %float %x_230 + OpStore %x_259_phi %353 + OpBranch %344 + %346 = OpLabel + %357 = OpLoad %int %x_181 + %359 = OpSLessThan %bool %357 %int_210 + OpSelectionMerge %360 None + OpBranchConditional %359 %361 %362 + %361 = OpLabel + %364 = OpAccessChain %_ptr_Function_int %data %int_6 + %365 = OpLoad %int %364 + %366 = OpConvertSToF %float %365 + %367 = OpFMul %float %366 %float_0_100000001 + %368 = OpFAdd %float %float_0_5 %367 + OpStore %x_239 %368 + %369 = OpLoad %float %x_239 + OpStore %x_258_phi %369 + OpBranch %360 + %362 = OpLabel + %370 = OpLoad %int %x_181 + %372 = OpSLessThan %bool %370 %int_240 + OpSelectionMerge %373 None + OpBranchConditional %372 %374 %375 + %374 = OpLabel + %377 = OpAccessChain %_ptr_Function_int %data %int_7 + %378 = OpLoad %int %377 + %379 = OpConvertSToF %float %378 + %380 = OpFMul %float %379 %float_0_100000001 + %381 = OpFAdd %float %float_0_5 %380 + OpStore %x_248 %381 + %382 = OpLoad %float %x_248 + OpStore %x_257_phi %382 + OpBranch %373 + %375 = OpLabel + %383 = OpLoad %int %x_181 + %385 = OpSLessThan %bool %383 %int_270 + OpSelectionMerge %386 None + OpBranchConditional %385 %387 %388 + %387 = OpLabel + OpBranch %386 + %388 = OpLabel + OpKill + %386 = OpLabel + %390 = OpAccessChain %_ptr_Function_int %data %int_8 + %391 = OpLoad %int %390 + %392 = OpConvertSToF %float %391 + %393 = OpFMul %float %392 %float_0_100000001 + %394 = OpFAdd %float %float_0_5 %393 + OpStore %x_256 %394 + %395 = OpLoad %float %x_256 + OpStore %x_257_phi %395 + OpBranch %373 + %373 = OpLabel + %396 = OpLoad %float %x_257_phi + OpStore %x_257 %396 + %397 = OpLoad %float %x_257 + OpStore %x_258_phi %397 + OpBranch %360 + %360 = OpLabel + %398 = OpLoad %float %x_258_phi + OpStore %x_258 %398 + %399 = OpLoad %float %x_258 + OpStore %x_259_phi %399 + OpBranch %344 + %344 = OpLabel + %400 = OpLoad %float %x_259_phi + OpStore %x_259 %400 + OpBranch %335 + %335 = OpLabel + %401 = OpLoad %float %x_259 + OpStore %x_260_phi %401 + OpBranch %320 + %320 = OpLabel + %402 = OpLoad %float %x_260_phi + OpStore %x_260 %402 + %403 = OpLoad %float %x_260 + OpStore %x_261_phi %403 + OpBranch %308 + %308 = OpLabel + %404 = OpLoad %float %x_261_phi + OpStore %x_261 %404 + %405 = OpLoad %float %x_261 + OpStore %x_262_phi %405 + OpBranch %293 + %293 = OpLabel + %406 = OpLoad %float %x_262_phi + OpStore %x_262 %406 + %407 = OpLoad %float %x_262 + OpStore %x_263_phi %407 + OpBranch %276 + %276 = OpLabel + %408 = OpLoad %float %x_263_phi + %410 = OpCompositeConstruct %v4float %408 %408 %408 %float_1 + OpStore %x_GLF_color %410 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %411 +%tint_symbol_1 = OpFunctionParameter %main_out + %415 = OpLabel + %416 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %416 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %418 = OpLabel + %419 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %419 + %420 = OpFunctionCall %void %main_1 + %422 = OpLoad %v4float %x_GLF_color + %423 = OpCompositeConstruct %main_out %422 + %421 = OpFunctionCall %void %tint_symbol_3 %423 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 44[%44] is not post dominated by the back-edge block 117[%117] + %117 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..fc4bfa1122 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/1.wgsl.expected.wgsl @@ -0,0 +1,341 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var temp : array; + var data : array; + var x_190 : f32; + var x_262 : f32; + var x_63_phi : i32; + var x_103_phi : i32; + var x_112_phi : i32; + var x_263_phi : f32; + let x_60 : f32 = x_8.injectionSwitch.x; + let x_61 : i32 = i32(x_60); + x_63_phi = x_61; + loop { + var x_100 : i32; + var x_98 : i32; + var x_96 : i32; + var x_94 : i32; + var x_92 : i32; + var x_90 : i32; + var x_88 : i32; + var x_86 : i32; + var x_84 : i32; + var x_82 : i32; + var x_64_phi : i32; + let x_63 : i32 = x_63_phi; + let x_68 : array = data; + data = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + data = x_68; + let x_69 : i32 = (x_63 + 1); + x_64_phi = x_69; + switch(x_63) { + case 9: { + data[x_63] = -5; + x_100 = (x_63 + 1); + x_64_phi = x_100; + } + case 8: { + data[x_63] = -4; + x_98 = (x_63 + 1); + x_64_phi = x_98; + } + case 7: { + data[x_63] = -3; + x_96 = (x_63 + 1); + x_64_phi = x_96; + } + case 6: { + data[x_63] = -2; + x_94 = (x_63 + 1); + x_64_phi = x_94; + } + case 5: { + data[x_63] = -1; + x_92 = (x_63 + 1); + x_64_phi = x_92; + } + case 4: { + data[x_63] = 0; + x_90 = (x_63 + 1); + x_64_phi = x_90; + } + case 3: { + data[x_63] = 1; + x_88 = (x_63 + 1); + x_64_phi = x_88; + } + case 2: { + data[x_63] = 2; + x_86 = (x_63 + 1); + x_64_phi = x_86; + } + case 1: { + data[x_63] = 3; + x_84 = (x_63 + 1); + x_64_phi = x_84; + } + case 0: { + data[x_63] = 4; + x_82 = (x_63 + 1); + x_64_phi = x_82; + } + default: { + } + } + let x_64 : i32 = x_64_phi; + + continuing { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_103_phi = 0; + loop { + var x_104 : i32; + let x_103 : i32 = x_103_phi; + if ((x_103 < 10)) { + } else { + break; + } + + continuing { + let x_109 : i32 = data[x_103]; + temp[x_103] = x_109; + x_104 = (x_103 + 1); + x_103_phi = x_104; + } + } + x_112_phi = 1; + loop { + var x_113 : i32; + var x_119_phi : i32; + let x_112 : i32 = x_112_phi; + if ((x_112 <= 9)) { + } else { + break; + } + x_119_phi = 0; + loop { + var x_131 : i32; + var x_136 : i32; + var x_131_phi : i32; + var x_134_phi : i32; + var x_136_phi : i32; + var x_158_phi : i32; + var x_161_phi : i32; + var x_171_phi : i32; + let x_119 : i32 = x_119_phi; + if ((x_119 < 9)) { + } else { + break; + } + let x_125 : i32 = (x_119 + x_112); + let x_126 : i32 = (x_125 - 1); + let x_120 : i32 = (x_119 + (2 * x_112)); + let x_129 : i32 = min((x_120 - 1), 9); + x_131_phi = x_119; + x_134_phi = x_125; + x_136_phi = x_119; + loop { + var x_151 : i32; + var x_154 : i32; + var x_135_phi : i32; + var x_137_phi : i32; + x_131 = x_131_phi; + let x_134 : i32 = x_134_phi; + x_136 = x_136_phi; + if (((x_136 <= x_126) && (x_134 <= x_129))) { + } else { + break; + } + let x_143 : ptr = &(data[x_136]); + let x_144 : i32 = *(x_143); + let x_145 : ptr = &(data[x_134]); + let x_146 : i32 = *(x_145); + let x_132 : i32 = bitcast((x_131 + bitcast(1))); + if ((x_144 < x_146)) { + x_151 = bitcast((x_136 + bitcast(1))); + let x_152 : i32 = *(x_143); + temp[x_131] = x_152; + x_135_phi = x_134; + x_137_phi = x_151; + } else { + x_154 = (x_134 + 1); + let x_155 : i32 = *(x_145); + temp[x_131] = x_155; + x_135_phi = x_154; + x_137_phi = x_136; + } + let x_135 : i32 = x_135_phi; + let x_137 : i32 = x_137_phi; + + continuing { + x_131_phi = x_132; + x_134_phi = x_135; + x_136_phi = x_137; + } + } + x_158_phi = x_131; + x_161_phi = x_136; + loop { + var x_159 : i32; + var x_162 : i32; + let x_158 : i32 = x_158_phi; + let x_161 : i32 = x_161_phi; + if (((x_161 < 10) && (x_161 <= x_126))) { + } else { + break; + } + + continuing { + x_159 = (x_158 + 1); + x_162 = (x_161 + 1); + let x_168 : i32 = data[x_161]; + temp[x_158] = x_168; + x_158_phi = x_159; + x_161_phi = x_162; + } + } + x_171_phi = x_119; + loop { + var x_172 : i32; + let x_171 : i32 = x_171_phi; + if ((x_171 <= x_129)) { + } else { + break; + } + + continuing { + let x_177 : i32 = temp[x_171]; + data[x_171] = x_177; + x_172 = (x_171 + 1); + x_171_phi = x_172; + } + } + + continuing { + x_119_phi = x_120; + } + } + + continuing { + x_113 = (2 * x_112); + x_112_phi = x_113; + } + } + var x_181 : i32; + var x_199 : f32; + var x_261 : f32; + var x_262_phi : f32; + let x_180 : f32 = gl_FragCoord.y; + x_181 = i32(x_180); + if ((x_181 < 30)) { + let x_187 : i32 = data[0]; + x_190 = (0.5 + (f32(x_187) * 0.100000001)); + x_263_phi = x_190; + } else { + var x_208 : f32; + var x_260 : f32; + var x_261_phi : f32; + if ((x_181 < 60)) { + let x_196 : i32 = data[1]; + x_199 = (0.5 + (f32(x_196) * 0.100000001)); + x_262_phi = x_199; + } else { + var x_217 : f32; + var x_259 : f32; + var x_260_phi : f32; + if ((x_181 < 90)) { + let x_205 : i32 = data[2]; + x_208 = (0.5 + (f32(x_205) * 0.100000001)); + x_261_phi = x_208; + } else { + if ((x_181 < 120)) { + let x_214 : i32 = data[3]; + x_217 = (0.5 + (f32(x_214) * 0.100000001)); + x_260_phi = x_217; + } else { + var x_230 : f32; + var x_258 : f32; + var x_259_phi : f32; + if ((x_181 < 150)) { + discard; + } else { + var x_239 : f32; + var x_257 : f32; + var x_258_phi : f32; + if ((x_181 < 180)) { + let x_227 : i32 = data[5]; + x_230 = (0.5 + (f32(x_227) * 0.100000001)); + x_259_phi = x_230; + } else { + var x_248 : f32; + var x_256 : f32; + var x_257_phi : f32; + if ((x_181 < 210)) { + let x_236 : i32 = data[6]; + x_239 = (0.5 + (f32(x_236) * 0.100000001)); + x_258_phi = x_239; + } else { + if ((x_181 < 240)) { + let x_245 : i32 = data[7]; + x_248 = (0.5 + (f32(x_245) * 0.100000001)); + x_257_phi = x_248; + } else { + if ((x_181 < 270)) { + } else { + discard; + } + let x_253 : i32 = data[8]; + x_256 = (0.5 + (f32(x_253) * 0.100000001)); + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + x_259_phi = x_258; + } + x_259 = x_259_phi; + } + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + x_262 = x_262_phi; + x_263_phi = x_262; + } + let x_263 : f32 = x_263_phi; + x_GLF_color = vec4(x_263, x_263, x_263, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm new file mode 100644 index 0000000000..ed7d367d55 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm @@ -0,0 +1,383 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 + %int_10 = OpConstant %int 10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 +%float_0_100000001 = OpConstant %float 0.100000001 + %int_0_0 = OpConstant %int 0 + %57 = OpConstantComposite %_arr_int_uint_10 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 + %main = OpFunction %void None %10 + %58 = OpLabel + %temp = OpVariable %_ptr_Function__arr_int_uint_10 Function + %data = OpVariable %_ptr_Function__arr_int_uint_10 Function + %59 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %60 = OpLoad %float %59 + %61 = OpConvertFToS %int %60 + OpBranch %62 + %62 = OpLabel + %63 = OpPhi %int %61 %58 %64 %65 + OpLoopMerge %66 %65 None + OpBranch %67 + %67 = OpLabel + %68 = OpIAdd %int %63 %int_1 + OpSelectionMerge %69 None + OpSwitch %63 %69 0 %70 1 %71 2 %72 3 %73 4 %74 5 %75 6 %76 7 %77 8 %78 9 %79 + %70 = OpLabel + %80 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %80 %int_4 + %81 = OpIAdd %int %63 %int_1 + OpBranch %69 + %71 = OpLabel + %82 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %82 %int_3 + %83 = OpIAdd %int %63 %int_1 + OpBranch %69 + %72 = OpLabel + %84 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %84 %int_2 + %85 = OpIAdd %int %63 %int_1 + OpBranch %69 + %73 = OpLabel + %86 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %86 %int_1 + %87 = OpIAdd %int %63 %int_1 + OpBranch %69 + %74 = OpLabel + %88 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %88 %int_0 + %89 = OpIAdd %int %63 %int_1 + OpBranch %69 + %75 = OpLabel + %90 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %90 %int_n1 + %91 = OpIAdd %int %63 %int_1 + OpBranch %69 + %76 = OpLabel + %92 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %92 %int_n2 + %93 = OpIAdd %int %63 %int_1 + OpBranch %69 + %77 = OpLabel + %94 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %94 %int_n3 + %95 = OpIAdd %int %63 %int_1 + OpBranch %69 + %78 = OpLabel + %96 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %96 %int_n4 + %97 = OpIAdd %int %63 %int_1 + OpBranch %69 + %79 = OpLabel + %98 = OpAccessChain %_ptr_Function_int %data %63 + OpStore %98 %int_n5 + %99 = OpIAdd %int %63 %int_1 + OpBranch %69 + %69 = OpLabel + %64 = OpPhi %int %68 %67 %81 %70 %83 %71 %85 %72 %87 %73 %89 %74 %91 %75 %93 %76 %95 %77 %97 %78 %99 %79 + OpBranch %65 + %65 = OpLabel + %100 = OpSLessThan %bool %64 %int_10 + OpBranchConditional %100 %62 %66 + %66 = OpLabel + OpBranch %101 + %101 = OpLabel + %102 = OpPhi %int %int_0 %66 %103 %104 + %105 = OpSLessThan %bool %102 %int_10 + OpLoopMerge %106 %104 None + OpBranchConditional %105 %104 %106 + %104 = OpLabel + %107 = OpAccessChain %_ptr_Function_int %data %102 + %108 = OpLoad %int %107 + %109 = OpAccessChain %_ptr_Function_int %temp %102 + OpStore %109 %108 + %103 = OpIAdd %int %102 %int_1 + OpBranch %101 + %106 = OpLabel + OpBranch %110 + %110 = OpLabel + %111 = OpPhi %int %int_1 %106 %112 %113 + %114 = OpSLessThanEqual %bool %111 %int_9 + OpLoopMerge %115 %113 None + OpBranchConditional %114 %116 %115 + %116 = OpLabel + OpBranch %117 + %117 = OpLabel + %118 = OpPhi %int %int_0 %116 %119 %120 + %121 = OpSLessThan %bool %118 %int_9 + OpLoopMerge %122 %120 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + %124 = OpIAdd %int %118 %111 + %125 = OpISub %int %124 %int_1 + %126 = OpIMul %int %int_2 %111 + %119 = OpIAdd %int %118 %126 + %127 = OpISub %int %119 %int_1 + %128 = OpExtInst %int %1 SMin %127 %int_9 + OpBranch %129 + %129 = OpLabel + %130 = OpPhi %int %118 %123 %131 %132 + %133 = OpPhi %int %124 %123 %134 %132 + %135 = OpPhi %int %118 %123 %136 %132 + %137 = OpSLessThanEqual %bool %135 %125 + %138 = OpSLessThanEqual %bool %133 %128 + %139 = OpLogicalAnd %bool %137 %138 + OpLoopMerge %140 %132 None + OpBranchConditional %139 %141 %140 + %141 = OpLabel + %142 = OpAccessChain %_ptr_Function_int %data %135 + %143 = OpLoad %int %142 + %144 = OpAccessChain %_ptr_Function_int %data %133 + %145 = OpLoad %int %144 + %146 = OpSLessThan %bool %143 %145 + %131 = OpIAdd %int %130 %int_1 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %149 + %148 = OpLabel + %150 = OpIAdd %int %135 %int_1 + %151 = OpLoad %int %142 + %152 = OpAccessChain %_ptr_Function_int %temp %130 + OpStore %152 %151 + OpBranch %147 + %149 = OpLabel + %153 = OpIAdd %int %133 %int_1 + %154 = OpLoad %int %144 + %155 = OpAccessChain %_ptr_Function_int %temp %130 + OpStore %155 %154 + OpBranch %147 + %147 = OpLabel + %134 = OpPhi %int %133 %148 %153 %149 + %136 = OpPhi %int %150 %148 %135 %149 + OpBranch %132 + %132 = OpLabel + OpBranch %129 + %140 = OpLabel + OpBranch %156 + %156 = OpLabel + %157 = OpPhi %int %130 %140 %158 %159 + %160 = OpPhi %int %135 %140 %161 %159 + %162 = OpSLessThan %bool %160 %int_10 + %163 = OpSLessThanEqual %bool %160 %125 + %164 = OpLogicalAnd %bool %162 %163 + OpLoopMerge %165 %159 None + OpBranchConditional %164 %159 %165 + %159 = OpLabel + %158 = OpIAdd %int %157 %int_1 + %161 = OpIAdd %int %160 %int_1 + %166 = OpAccessChain %_ptr_Function_int %data %160 + %167 = OpLoad %int %166 + %168 = OpAccessChain %_ptr_Function_int %temp %157 + OpStore %168 %167 + OpBranch %156 + %165 = OpLabel + OpBranch %169 + %169 = OpLabel + %170 = OpPhi %int %118 %165 %171 %172 + %173 = OpSLessThanEqual %bool %170 %128 + OpLoopMerge %174 %172 None + OpBranchConditional %173 %172 %174 + %172 = OpLabel + %175 = OpAccessChain %_ptr_Function_int %temp %170 + %176 = OpLoad %int %175 + %177 = OpAccessChain %_ptr_Function_int %data %170 + OpStore %177 %176 + %171 = OpIAdd %int %170 %int_1 + OpBranch %169 + %174 = OpLabel + OpBranch %120 + %120 = OpLabel + OpBranch %117 + %122 = OpLabel + OpBranch %113 + %113 = OpLabel + %112 = OpIMul %int %int_2 %111 + OpBranch %110 + %115 = OpLabel + %178 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %179 = OpLoad %float %178 + %180 = OpConvertFToS %int %179 + %181 = OpSLessThan %bool %180 %int_30 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %184 + %183 = OpLabel + %185 = OpAccessChain %_ptr_Function_int %data %int_0 + %186 = OpLoad %int %185 + %187 = OpConvertSToF %float %186 + %188 = OpFMul %float %187 %float_0_100000001 + %189 = OpFAdd %float %float_0_5 %188 + OpBranch %182 + %184 = OpLabel + %190 = OpSLessThan %bool %180 %int_60 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %193 + %192 = OpLabel + %194 = OpAccessChain %_ptr_Function_int %data %int_1 + %195 = OpLoad %int %194 + %196 = OpConvertSToF %float %195 + %197 = OpFMul %float %196 %float_0_100000001 + %198 = OpFAdd %float %float_0_5 %197 + OpBranch %191 + %193 = OpLabel + %199 = OpSLessThan %bool %180 %int_90 + OpSelectionMerge %200 None + OpBranchConditional %199 %201 %202 + %201 = OpLabel + %203 = OpAccessChain %_ptr_Function_int %data %int_2 + %204 = OpLoad %int %203 + %205 = OpConvertSToF %float %204 + %206 = OpFMul %float %205 %float_0_100000001 + %207 = OpFAdd %float %float_0_5 %206 + OpBranch %200 + %202 = OpLabel + %208 = OpSLessThan %bool %180 %int_120 + OpSelectionMerge %209 None + OpBranchConditional %208 %210 %211 + %210 = OpLabel + %212 = OpAccessChain %_ptr_Function_int %data %int_3 + %213 = OpLoad %int %212 + %214 = OpConvertSToF %float %213 + %215 = OpFMul %float %214 %float_0_100000001 + %216 = OpFAdd %float %float_0_5 %215 + OpBranch %209 + %211 = OpLabel + %217 = OpSLessThan %bool %180 %int_150 + OpSelectionMerge %218 None + OpBranchConditional %217 %219 %220 + %219 = OpLabel + OpKill + %220 = OpLabel + %221 = OpSLessThan %bool %180 %int_180 + OpSelectionMerge %222 None + OpBranchConditional %221 %223 %224 + %223 = OpLabel + %225 = OpAccessChain %_ptr_Function_int %data %int_5 + %226 = OpLoad %int %225 + %227 = OpConvertSToF %float %226 + %228 = OpFMul %float %227 %float_0_100000001 + %229 = OpFAdd %float %float_0_5 %228 + OpBranch %222 + %224 = OpLabel + %230 = OpSLessThan %bool %180 %int_210 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %233 + %232 = OpLabel + %234 = OpAccessChain %_ptr_Function_int %data %int_6 + %235 = OpLoad %int %234 + %236 = OpConvertSToF %float %235 + %237 = OpFMul %float %236 %float_0_100000001 + %238 = OpFAdd %float %float_0_5 %237 + OpBranch %231 + %233 = OpLabel + %239 = OpSLessThan %bool %180 %int_240 + OpSelectionMerge %240 None + OpBranchConditional %239 %241 %242 + %241 = OpLabel + %243 = OpAccessChain %_ptr_Function_int %data %int_7 + %244 = OpLoad %int %243 + %245 = OpConvertSToF %float %244 + %246 = OpFMul %float %245 %float_0_100000001 + %247 = OpFAdd %float %float_0_5 %246 + OpBranch %240 + %242 = OpLabel + %248 = OpSLessThan %bool %180 %int_270 + OpSelectionMerge %249 None + OpBranchConditional %248 %249 %250 + %249 = OpLabel + %251 = OpAccessChain %_ptr_Function_int %data %int_8 + %252 = OpLoad %int %251 + %253 = OpConvertSToF %float %252 + %254 = OpFMul %float %253 %float_0_100000001 + %255 = OpFAdd %float %float_0_5 %254 + OpBranch %240 + %250 = OpLabel + OpKill + %240 = OpLabel + %256 = OpPhi %float %247 %241 %255 %249 + OpBranch %231 + %231 = OpLabel + %257 = OpPhi %float %238 %232 %256 %240 + OpBranch %222 + %222 = OpLabel + %258 = OpPhi %float %229 %223 %257 %231 + OpBranch %218 + %218 = OpLabel + OpBranch %209 + %209 = OpLabel + %259 = OpPhi %float %216 %210 %258 %218 + OpBranch %200 + %200 = OpLabel + %260 = OpPhi %float %207 %201 %259 %209 + OpBranch %191 + %191 = OpLabel + %261 = OpPhi %float %198 %192 %260 %200 + OpBranch %182 + %182 = OpLabel + %262 = OpPhi %float %189 %183 %261 %191 + %263 = OpCompositeConstruct %v4float %262 %262 %262 %float_1 + OpStore %_GLF_color %263 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.hlsl new file mode 100644 index 0000000000..3b86173722 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.hlsl @@ -0,0 +1,352 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int temp[10] = (int[10])0; + int data[10] = (int[10])0; + float x_189 = 0.0f; + float x_261 = 0.0f; + int x_63_phi = 0; + int x_102_phi = 0; + int x_111_phi = 0; + float x_262_phi = 0.0f; + const float x_60 = asfloat(x_8[0].x); + const int x_61 = int(x_60); + x_63_phi = x_61; + while (true) { + int x_99 = 0; + int x_97 = 0; + int x_95 = 0; + int x_93 = 0; + int x_91 = 0; + int x_89 = 0; + int x_87 = 0; + int x_85 = 0; + int x_83 = 0; + int x_81 = 0; + int x_64_phi = 0; + const int x_63 = x_63_phi; + const int x_68 = (x_63 + 1); + x_64_phi = x_68; + switch(x_63) { + case 9: { + data[x_63] = -5; + x_99 = (x_63 + 1); + x_64_phi = x_99; + break; + } + case 8: { + data[x_63] = -4; + x_97 = (x_63 + 1); + x_64_phi = x_97; + break; + } + case 7: { + data[x_63] = -3; + x_95 = (x_63 + 1); + x_64_phi = x_95; + break; + } + case 6: { + data[x_63] = -2; + x_93 = (x_63 + 1); + x_64_phi = x_93; + break; + } + case 5: { + data[x_63] = -1; + x_91 = (x_63 + 1); + x_64_phi = x_91; + break; + } + case 4: { + data[x_63] = 0; + x_89 = (x_63 + 1); + x_64_phi = x_89; + break; + } + case 3: { + data[x_63] = 1; + x_87 = (x_63 + 1); + x_64_phi = x_87; + break; + } + case 2: { + data[x_63] = 2; + x_85 = (x_63 + 1); + x_64_phi = x_85; + break; + } + case 1: { + data[x_63] = 3; + x_83 = (x_63 + 1); + x_64_phi = x_83; + break; + } + case 0: { + data[x_63] = 4; + x_81 = (x_63 + 1); + x_64_phi = x_81; + break; + } + default: { + break; + } + } + const int x_64 = x_64_phi; + { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_102_phi = 0; + while (true) { + int x_103 = 0; + const int x_102 = x_102_phi; + if ((x_102 < 10)) { + } else { + break; + } + { + const int x_108 = data[x_102]; + temp[x_102] = x_108; + x_103 = (x_102 + 1); + x_102_phi = x_103; + } + } + x_111_phi = 1; + while (true) { + int x_112 = 0; + int x_118_phi = 0; + const int x_111 = x_111_phi; + if ((x_111 <= 9)) { + } else { + break; + } + x_118_phi = 0; + while (true) { + int x_130 = 0; + int x_135 = 0; + int x_130_phi = 0; + int x_133_phi = 0; + int x_135_phi = 0; + int x_157_phi = 0; + int x_160_phi = 0; + int x_170_phi = 0; + const int x_118 = x_118_phi; + if ((x_118 < 9)) { + } else { + break; + } + const int x_124 = (x_118 + x_111); + const int x_125 = (x_124 - 1); + const int x_119 = (x_118 + (2 * x_111)); + const int x_128 = min((x_119 - 1), 9); + x_130_phi = x_118; + x_133_phi = x_124; + x_135_phi = x_118; + while (true) { + int x_150 = 0; + int x_153 = 0; + int x_134_phi = 0; + int x_136_phi = 0; + x_130 = x_130_phi; + const int x_133 = x_133_phi; + x_135 = x_135_phi; + bool tint_tmp = (x_135 <= x_125); + if (tint_tmp) { + tint_tmp = (x_133 <= x_128); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_142_save = x_135; + const int x_143 = data[x_142_save]; + const int x_144_save = x_133; + const int x_145 = data[x_144_save]; + const int x_131 = asint((x_130 + asint(1))); + if ((x_143 < x_145)) { + x_150 = asint((x_135 + asint(1))); + const int x_151 = data[x_142_save]; + temp[x_130] = x_151; + x_134_phi = x_133; + x_136_phi = x_150; + } else { + x_153 = (x_133 + 1); + const int x_154 = data[x_144_save]; + temp[x_130] = x_154; + x_134_phi = x_153; + x_136_phi = x_135; + } + const int x_134 = x_134_phi; + const int x_136 = x_136_phi; + { + x_130_phi = x_131; + x_133_phi = x_134; + x_135_phi = x_136; + } + } + x_157_phi = x_130; + x_160_phi = x_135; + while (true) { + int x_158 = 0; + int x_161 = 0; + const int x_157 = x_157_phi; + const int x_160 = x_160_phi; + bool tint_tmp_1 = (x_160 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_160 <= x_125); + } + if ((tint_tmp_1)) { + } else { + break; + } + { + x_158 = (x_157 + 1); + x_161 = (x_160 + 1); + const int x_167 = data[x_160]; + temp[x_157] = x_167; + x_157_phi = x_158; + x_160_phi = x_161; + } + } + x_170_phi = x_118; + while (true) { + int x_171 = 0; + const int x_170 = x_170_phi; + if ((x_170 <= x_128)) { + } else { + break; + } + { + const int x_176 = temp[x_170]; + data[x_170] = x_176; + x_171 = (x_170 + 1); + x_170_phi = x_171; + } + } + { + x_118_phi = x_119; + } + } + { + x_112 = (2 * x_111); + x_111_phi = x_112; + } + } + int x_180 = 0; + float x_198 = 0.0f; + float x_260 = 0.0f; + float x_261_phi = 0.0f; + const float x_179 = gl_FragCoord.y; + x_180 = int(x_179); + if ((x_180 < 30)) { + const int x_186 = data[0]; + x_189 = (0.5f + (float(x_186) * 0.100000001f)); + x_262_phi = x_189; + } else { + float x_207 = 0.0f; + float x_259 = 0.0f; + float x_260_phi = 0.0f; + if ((x_180 < 60)) { + const int x_195 = data[1]; + x_198 = (0.5f + (float(x_195) * 0.100000001f)); + x_261_phi = x_198; + } else { + float x_216 = 0.0f; + float x_258 = 0.0f; + float x_259_phi = 0.0f; + if ((x_180 < 90)) { + const int x_204 = data[2]; + x_207 = (0.5f + (float(x_204) * 0.100000001f)); + x_260_phi = x_207; + } else { + if ((x_180 < 120)) { + const int x_213 = data[3]; + x_216 = (0.5f + (float(x_213) * 0.100000001f)); + x_259_phi = x_216; + } else { + float x_229 = 0.0f; + float x_257 = 0.0f; + float x_258_phi = 0.0f; + if ((x_180 < 150)) { + discard; + } else { + float x_238 = 0.0f; + float x_256 = 0.0f; + float x_257_phi = 0.0f; + if ((x_180 < 180)) { + const int x_226 = data[5]; + x_229 = (0.5f + (float(x_226) * 0.100000001f)); + x_258_phi = x_229; + } else { + float x_247 = 0.0f; + float x_255 = 0.0f; + float x_256_phi = 0.0f; + if ((x_180 < 210)) { + const int x_235 = data[6]; + x_238 = (0.5f + (float(x_235) * 0.100000001f)); + x_257_phi = x_238; + } else { + if ((x_180 < 240)) { + const int x_244 = data[7]; + x_247 = (0.5f + (float(x_244) * 0.100000001f)); + x_256_phi = x_247; + } else { + if ((x_180 < 270)) { + } else { + discard; + } + const int x_252 = data[8]; + x_255 = (0.5f + (float(x_252) * 0.100000001f)); + x_256_phi = x_255; + } + x_256 = x_256_phi; + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + } + x_259_phi = x_258; + } + x_259 = x_259_phi; + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + const float x_262 = x_262_phi; + x_GLF_color = float4(x_262, x_262, x_262, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.msl new file mode 100644 index 0000000000..64e598bb88 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.msl @@ -0,0 +1,346 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + tint_array_wrapper temp = {}; + tint_array_wrapper data = {}; + float x_189 = 0.0f; + float x_261 = 0.0f; + int x_63_phi = 0; + int x_102_phi = 0; + int x_111_phi = 0; + float x_262_phi = 0.0f; + float const x_60 = x_8.injectionSwitch.x; + int const x_61 = int(x_60); + x_63_phi = x_61; + while (true) { + int x_99 = 0; + int x_97 = 0; + int x_95 = 0; + int x_93 = 0; + int x_91 = 0; + int x_89 = 0; + int x_87 = 0; + int x_85 = 0; + int x_83 = 0; + int x_81 = 0; + int x_64_phi = 0; + int const x_63 = x_63_phi; + int const x_68 = (x_63 + 1); + x_64_phi = x_68; + switch(x_63) { + case 9: { + data.arr[x_63] = -5; + x_99 = (x_63 + 1); + x_64_phi = x_99; + break; + } + case 8: { + data.arr[x_63] = -4; + x_97 = (x_63 + 1); + x_64_phi = x_97; + break; + } + case 7: { + data.arr[x_63] = -3; + x_95 = (x_63 + 1); + x_64_phi = x_95; + break; + } + case 6: { + data.arr[x_63] = -2; + x_93 = (x_63 + 1); + x_64_phi = x_93; + break; + } + case 5: { + data.arr[x_63] = -1; + x_91 = (x_63 + 1); + x_64_phi = x_91; + break; + } + case 4: { + data.arr[x_63] = 0; + x_89 = (x_63 + 1); + x_64_phi = x_89; + break; + } + case 3: { + data.arr[x_63] = 1; + x_87 = (x_63 + 1); + x_64_phi = x_87; + break; + } + case 2: { + data.arr[x_63] = 2; + x_85 = (x_63 + 1); + x_64_phi = x_85; + break; + } + case 1: { + data.arr[x_63] = 3; + x_83 = (x_63 + 1); + x_64_phi = x_83; + break; + } + case 0: { + data.arr[x_63] = 4; + x_81 = (x_63 + 1); + x_64_phi = x_81; + break; + } + default: { + break; + } + } + int const x_64 = x_64_phi; + { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_102_phi = 0; + while (true) { + int x_103 = 0; + int const x_102 = x_102_phi; + if ((x_102 < 10)) { + } else { + break; + } + { + int const x_108 = data.arr[x_102]; + temp.arr[x_102] = x_108; + x_103 = (x_102 + 1); + x_102_phi = x_103; + } + } + x_111_phi = 1; + while (true) { + int x_112 = 0; + int x_118_phi = 0; + int const x_111 = x_111_phi; + if ((x_111 <= 9)) { + } else { + break; + } + x_118_phi = 0; + while (true) { + int x_130 = 0; + int x_135 = 0; + int x_130_phi = 0; + int x_133_phi = 0; + int x_135_phi = 0; + int x_157_phi = 0; + int x_160_phi = 0; + int x_170_phi = 0; + int const x_118 = x_118_phi; + if ((x_118 < 9)) { + } else { + break; + } + int const x_124 = (x_118 + x_111); + int const x_125 = (x_124 - 1); + int const x_119 = (x_118 + (2 * x_111)); + int const x_128 = min((x_119 - 1), 9); + x_130_phi = x_118; + x_133_phi = x_124; + x_135_phi = x_118; + while (true) { + int x_150 = 0; + int x_153 = 0; + int x_134_phi = 0; + int x_136_phi = 0; + x_130 = x_130_phi; + int const x_133 = x_133_phi; + x_135 = x_135_phi; + if (((x_135 <= x_125) && (x_133 <= x_128))) { + } else { + break; + } + int const x_142_save = x_135; + int const x_143 = data.arr[x_142_save]; + int const x_144_save = x_133; + int const x_145 = data.arr[x_144_save]; + int const x_131 = as_type((x_130 + as_type(1))); + if ((x_143 < x_145)) { + x_150 = as_type((x_135 + as_type(1))); + int const x_151 = data.arr[x_142_save]; + temp.arr[x_130] = x_151; + x_134_phi = x_133; + x_136_phi = x_150; + } else { + x_153 = (x_133 + 1); + int const x_154 = data.arr[x_144_save]; + temp.arr[x_130] = x_154; + x_134_phi = x_153; + x_136_phi = x_135; + } + int const x_134 = x_134_phi; + int const x_136 = x_136_phi; + { + x_130_phi = x_131; + x_133_phi = x_134; + x_135_phi = x_136; + } + } + x_157_phi = x_130; + x_160_phi = x_135; + while (true) { + int x_158 = 0; + int x_161 = 0; + int const x_157 = x_157_phi; + int const x_160 = x_160_phi; + if (((x_160 < 10) && (x_160 <= x_125))) { + } else { + break; + } + { + x_158 = (x_157 + 1); + x_161 = (x_160 + 1); + int const x_167 = data.arr[x_160]; + temp.arr[x_157] = x_167; + x_157_phi = x_158; + x_160_phi = x_161; + } + } + x_170_phi = x_118; + while (true) { + int x_171 = 0; + int const x_170 = x_170_phi; + if ((x_170 <= x_128)) { + } else { + break; + } + { + int const x_176 = temp.arr[x_170]; + data.arr[x_170] = x_176; + x_171 = (x_170 + 1); + x_170_phi = x_171; + } + } + { + x_118_phi = x_119; + } + } + { + x_112 = (2 * x_111); + x_111_phi = x_112; + } + } + int x_180 = 0; + float x_198 = 0.0f; + float x_260 = 0.0f; + float x_261_phi = 0.0f; + float const x_179 = (*(tint_symbol_5)).y; + x_180 = int(x_179); + if ((x_180 < 30)) { + int const x_186 = data.arr[0]; + x_189 = (0.5f + (float(x_186) * 0.100000001f)); + x_262_phi = x_189; + } else { + float x_207 = 0.0f; + float x_259 = 0.0f; + float x_260_phi = 0.0f; + if ((x_180 < 60)) { + int const x_195 = data.arr[1]; + x_198 = (0.5f + (float(x_195) * 0.100000001f)); + x_261_phi = x_198; + } else { + float x_216 = 0.0f; + float x_258 = 0.0f; + float x_259_phi = 0.0f; + if ((x_180 < 90)) { + int const x_204 = data.arr[2]; + x_207 = (0.5f + (float(x_204) * 0.100000001f)); + x_260_phi = x_207; + } else { + if ((x_180 < 120)) { + int const x_213 = data.arr[3]; + x_216 = (0.5f + (float(x_213) * 0.100000001f)); + x_259_phi = x_216; + } else { + float x_229 = 0.0f; + float x_257 = 0.0f; + float x_258_phi = 0.0f; + if ((x_180 < 150)) { + discard_fragment(); + } else { + float x_238 = 0.0f; + float x_256 = 0.0f; + float x_257_phi = 0.0f; + if ((x_180 < 180)) { + int const x_226 = data.arr[5]; + x_229 = (0.5f + (float(x_226) * 0.100000001f)); + x_258_phi = x_229; + } else { + float x_247 = 0.0f; + float x_255 = 0.0f; + float x_256_phi = 0.0f; + if ((x_180 < 210)) { + int const x_235 = data.arr[6]; + x_238 = (0.5f + (float(x_235) * 0.100000001f)); + x_257_phi = x_238; + } else { + if ((x_180 < 240)) { + int const x_244 = data.arr[7]; + x_247 = (0.5f + (float(x_244) * 0.100000001f)); + x_256_phi = x_247; + } else { + if ((x_180 < 270)) { + } else { + discard_fragment(); + } + int const x_252 = data.arr[8]; + x_255 = (0.5f + (float(x_252) * 0.100000001f)); + x_256_phi = x_255; + } + x_256 = x_256_phi; + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + } + x_259_phi = x_258; + } + x_259 = x_259_phi; + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + float const x_262 = x_262_phi; + *(tint_symbol_6) = float4(x_262, x_262, x_262, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.spvasm new file mode 100644 index 0000000000..105bea0bd2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.spvasm @@ -0,0 +1,742 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 422 +; Schema: 0 + OpCapability Shader + %167 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %temp "temp" + OpName %data "data" + OpName %x_189 "x_189" + OpName %x_261 "x_261" + OpName %x_63_phi "x_63_phi" + OpName %x_102_phi "x_102_phi" + OpName %x_111_phi "x_111_phi" + OpName %x_262_phi "x_262_phi" + OpName %x_99 "x_99" + OpName %x_97 "x_97" + OpName %x_95 "x_95" + OpName %x_93 "x_93" + OpName %x_91 "x_91" + OpName %x_89 "x_89" + OpName %x_87 "x_87" + OpName %x_85 "x_85" + OpName %x_83 "x_83" + OpName %x_81 "x_81" + OpName %x_64_phi "x_64_phi" + OpName %x_103 "x_103" + OpName %x_112 "x_112" + OpName %x_118_phi "x_118_phi" + OpName %x_130 "x_130" + OpName %x_135 "x_135" + OpName %x_130_phi "x_130_phi" + OpName %x_133_phi "x_133_phi" + OpName %x_135_phi "x_135_phi" + OpName %x_157_phi "x_157_phi" + OpName %x_160_phi "x_160_phi" + OpName %x_170_phi "x_170_phi" + OpName %x_150 "x_150" + OpName %x_153 "x_153" + OpName %x_134_phi "x_134_phi" + OpName %x_136_phi "x_136_phi" + OpName %x_158 "x_158" + OpName %x_161 "x_161" + OpName %x_171 "x_171" + OpName %x_180 "x_180" + OpName %x_198 "x_198" + OpName %x_260 "x_260" + OpName %x_261_phi "x_261_phi" + OpName %x_207 "x_207" + OpName %x_259 "x_259" + OpName %x_260_phi "x_260_phi" + OpName %x_216 "x_216" + OpName %x_258 "x_258" + OpName %x_259_phi "x_259_phi" + OpName %x_229 "x_229" + OpName %x_257 "x_257" + OpName %x_258_phi "x_258_phi" + OpName %x_238 "x_238" + OpName %x_256 "x_256" + OpName %x_257_phi "x_257_phi" + OpName %x_247 "x_247" + OpName %x_255 "x_255" + OpName %x_256_phi "x_256_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %25 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 +%float_0_100000001 = OpConstant %float 0.100000001 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %409 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %temp = OpVariable %_ptr_Function__arr_int_uint_10 Function %25 + %data = OpVariable %_ptr_Function__arr_int_uint_10 Function %25 + %x_189 = OpVariable %_ptr_Function_float Function %29 + %x_261 = OpVariable %_ptr_Function_float Function %29 + %x_63_phi = OpVariable %_ptr_Function_int Function %33 + %x_102_phi = OpVariable %_ptr_Function_int Function %33 + %x_111_phi = OpVariable %_ptr_Function_int Function %33 + %x_262_phi = OpVariable %_ptr_Function_float Function %29 + %x_99 = OpVariable %_ptr_Function_int Function %33 + %x_97 = OpVariable %_ptr_Function_int Function %33 + %x_95 = OpVariable %_ptr_Function_int Function %33 + %x_93 = OpVariable %_ptr_Function_int Function %33 + %x_91 = OpVariable %_ptr_Function_int Function %33 + %x_89 = OpVariable %_ptr_Function_int Function %33 + %x_87 = OpVariable %_ptr_Function_int Function %33 + %x_85 = OpVariable %_ptr_Function_int Function %33 + %x_83 = OpVariable %_ptr_Function_int Function %33 + %x_81 = OpVariable %_ptr_Function_int Function %33 + %x_64_phi = OpVariable %_ptr_Function_int Function %33 + %x_103 = OpVariable %_ptr_Function_int Function %33 + %x_112 = OpVariable %_ptr_Function_int Function %33 + %x_118_phi = OpVariable %_ptr_Function_int Function %33 + %x_130 = OpVariable %_ptr_Function_int Function %33 + %x_135 = OpVariable %_ptr_Function_int Function %33 + %x_130_phi = OpVariable %_ptr_Function_int Function %33 + %x_133_phi = OpVariable %_ptr_Function_int Function %33 + %x_135_phi = OpVariable %_ptr_Function_int Function %33 + %x_157_phi = OpVariable %_ptr_Function_int Function %33 + %x_160_phi = OpVariable %_ptr_Function_int Function %33 + %x_170_phi = OpVariable %_ptr_Function_int Function %33 + %x_150 = OpVariable %_ptr_Function_int Function %33 + %x_153 = OpVariable %_ptr_Function_int Function %33 + %x_134_phi = OpVariable %_ptr_Function_int Function %33 + %x_136_phi = OpVariable %_ptr_Function_int Function %33 + %x_158 = OpVariable %_ptr_Function_int Function %33 + %x_161 = OpVariable %_ptr_Function_int Function %33 + %x_171 = OpVariable %_ptr_Function_int Function %33 + %x_180 = OpVariable %_ptr_Function_int Function %33 + %x_198 = OpVariable %_ptr_Function_float Function %29 + %x_260 = OpVariable %_ptr_Function_float Function %29 + %x_261_phi = OpVariable %_ptr_Function_float Function %29 + %x_207 = OpVariable %_ptr_Function_float Function %29 + %x_259 = OpVariable %_ptr_Function_float Function %29 + %x_260_phi = OpVariable %_ptr_Function_float Function %29 + %x_216 = OpVariable %_ptr_Function_float Function %29 + %x_258 = OpVariable %_ptr_Function_float Function %29 + %x_259_phi = OpVariable %_ptr_Function_float Function %29 + %x_229 = OpVariable %_ptr_Function_float Function %29 + %x_257 = OpVariable %_ptr_Function_float Function %29 + %x_258_phi = OpVariable %_ptr_Function_float Function %29 + %x_238 = OpVariable %_ptr_Function_float Function %29 + %x_256 = OpVariable %_ptr_Function_float Function %29 + %x_257_phi = OpVariable %_ptr_Function_float Function %29 + %x_247 = OpVariable %_ptr_Function_float Function %29 + %x_255 = OpVariable %_ptr_Function_float Function %29 + %x_256_phi = OpVariable %_ptr_Function_float Function %29 + %39 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %40 = OpLoad %float %39 + %41 = OpConvertFToS %int %40 + OpStore %x_63_phi %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %57 = OpLoad %int %x_63_phi + %59 = OpIAdd %int %57 %int_1 + OpStore %x_64_phi %59 + OpSelectionMerge %60 None + OpSwitch %57 %61 9 %62 8 %63 7 %64 6 %65 5 %66 4 %67 3 %68 2 %69 1 %70 0 %71 + %62 = OpLabel + %72 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %72 %int_n5 + %74 = OpIAdd %int %57 %int_1 + OpStore %x_99 %74 + %75 = OpLoad %int %x_99 + OpStore %x_64_phi %75 + OpBranch %60 + %63 = OpLabel + %76 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %76 %int_n4 + %78 = OpIAdd %int %57 %int_1 + OpStore %x_97 %78 + %79 = OpLoad %int %x_97 + OpStore %x_64_phi %79 + OpBranch %60 + %64 = OpLabel + %80 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %80 %int_n3 + %82 = OpIAdd %int %57 %int_1 + OpStore %x_95 %82 + %83 = OpLoad %int %x_95 + OpStore %x_64_phi %83 + OpBranch %60 + %65 = OpLabel + %84 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %84 %int_n2 + %86 = OpIAdd %int %57 %int_1 + OpStore %x_93 %86 + %87 = OpLoad %int %x_93 + OpStore %x_64_phi %87 + OpBranch %60 + %66 = OpLabel + %88 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %88 %int_n1 + %90 = OpIAdd %int %57 %int_1 + OpStore %x_91 %90 + %91 = OpLoad %int %x_91 + OpStore %x_64_phi %91 + OpBranch %60 + %67 = OpLabel + %92 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %92 %int_0 + %94 = OpIAdd %int %57 %int_1 + OpStore %x_89 %94 + %95 = OpLoad %int %x_89 + OpStore %x_64_phi %95 + OpBranch %60 + %68 = OpLabel + %96 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %96 %int_1 + %97 = OpIAdd %int %57 %int_1 + OpStore %x_87 %97 + %98 = OpLoad %int %x_87 + OpStore %x_64_phi %98 + OpBranch %60 + %69 = OpLabel + %99 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %99 %int_2 + %101 = OpIAdd %int %57 %int_1 + OpStore %x_85 %101 + %102 = OpLoad %int %x_85 + OpStore %x_64_phi %102 + OpBranch %60 + %70 = OpLabel + %103 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %103 %int_3 + %105 = OpIAdd %int %57 %int_1 + OpStore %x_83 %105 + %106 = OpLoad %int %x_83 + OpStore %x_64_phi %106 + OpBranch %60 + %71 = OpLabel + %107 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %107 %int_4 + %109 = OpIAdd %int %57 %int_1 + OpStore %x_81 %109 + %110 = OpLoad %int %x_81 + OpStore %x_64_phi %110 + OpBranch %60 + %61 = OpLabel + OpBranch %60 + %60 = OpLabel + %111 = OpLoad %int %x_64_phi + OpBranch %44 + %44 = OpLabel + OpStore %x_63_phi %111 + %113 = OpSLessThan %bool %111 %int_10 + OpSelectionMerge %115 None + OpBranchConditional %113 %116 %117 + %116 = OpLabel + OpBranch %115 + %117 = OpLabel + OpBranch %43 + %115 = OpLabel + OpBranch %42 + %43 = OpLabel + OpStore %x_102_phi %int_0 + OpBranch %118 + %118 = OpLabel + OpLoopMerge %119 %120 None + OpBranch %121 + %121 = OpLabel + %123 = OpLoad %int %x_102_phi + %124 = OpSLessThan %bool %123 %int_10 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %127 + %126 = OpLabel + OpBranch %125 + %127 = OpLabel + OpBranch %119 + %125 = OpLabel + OpBranch %120 + %120 = OpLabel + %128 = OpAccessChain %_ptr_Function_int %data %123 + %129 = OpLoad %int %128 + %130 = OpAccessChain %_ptr_Function_int %temp %123 + OpStore %130 %129 + %131 = OpIAdd %int %123 %int_1 + OpStore %x_103 %131 + %132 = OpLoad %int %x_103 + OpStore %x_102_phi %132 + OpBranch %118 + %119 = OpLabel + OpStore %x_111_phi %int_1 + OpBranch %133 + %133 = OpLabel + OpLoopMerge %134 %135 None + OpBranch %136 + %136 = OpLabel + %139 = OpLoad %int %x_111_phi + %141 = OpSLessThanEqual %bool %139 %int_9 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %144 + %143 = OpLabel + OpBranch %142 + %144 = OpLabel + OpBranch %134 + %142 = OpLabel + OpStore %x_118_phi %int_0 + OpBranch %145 + %145 = OpLabel + OpLoopMerge %146 %147 None + OpBranch %148 + %148 = OpLabel + %157 = OpLoad %int %x_118_phi + %158 = OpSLessThan %bool %157 %int_9 + OpSelectionMerge %159 None + OpBranchConditional %158 %160 %161 + %160 = OpLabel + OpBranch %159 + %161 = OpLabel + OpBranch %146 + %159 = OpLabel + %162 = OpIAdd %int %157 %139 + %163 = OpISub %int %162 %int_1 + %164 = OpIMul %int %int_2 %139 + %165 = OpIAdd %int %157 %164 + %168 = OpISub %int %165 %int_1 + %166 = OpExtInst %int %167 SMin %168 %int_9 + OpStore %x_130_phi %157 + OpStore %x_133_phi %162 + OpStore %x_135_phi %157 + OpBranch %169 + %169 = OpLabel + OpLoopMerge %170 %171 None + OpBranch %172 + %172 = OpLabel + %177 = OpLoad %int %x_130_phi + OpStore %x_130 %177 + %178 = OpLoad %int %x_133_phi + %179 = OpLoad %int %x_135_phi + OpStore %x_135 %179 + %180 = OpLoad %int %x_135 + %181 = OpSLessThanEqual %bool %180 %163 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %184 = OpSLessThanEqual %bool %178 %166 + OpBranch %182 + %182 = OpLabel + %185 = OpPhi %bool %181 %172 %184 %183 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + OpBranch %186 + %188 = OpLabel + OpBranch %170 + %186 = OpLabel + %189 = OpLoad %int %x_135 + %190 = OpAccessChain %_ptr_Function_int %data %189 + %191 = OpLoad %int %190 + %192 = OpAccessChain %_ptr_Function_int %data %178 + %193 = OpLoad %int %192 + %195 = OpLoad %int %x_130 + %196 = OpCopyObject %int %int_1 + %197 = OpIAdd %int %195 %196 + %194 = OpCopyObject %int %197 + %198 = OpSLessThan %bool %191 %193 + OpSelectionMerge %199 None + OpBranchConditional %198 %200 %201 + %200 = OpLabel + %203 = OpLoad %int %x_135 + %204 = OpCopyObject %int %int_1 + %205 = OpIAdd %int %203 %204 + %202 = OpCopyObject %int %205 + OpStore %x_150 %202 + %206 = OpAccessChain %_ptr_Function_int %data %189 + %207 = OpLoad %int %206 + %208 = OpLoad %int %x_130 + %209 = OpAccessChain %_ptr_Function_int %temp %208 + OpStore %209 %207 + OpStore %x_134_phi %178 + %210 = OpLoad %int %x_150 + OpStore %x_136_phi %210 + OpBranch %199 + %201 = OpLabel + %211 = OpIAdd %int %178 %int_1 + OpStore %x_153 %211 + %212 = OpAccessChain %_ptr_Function_int %data %178 + %213 = OpLoad %int %212 + %214 = OpLoad %int %x_130 + %215 = OpAccessChain %_ptr_Function_int %temp %214 + OpStore %215 %213 + %216 = OpLoad %int %x_153 + OpStore %x_134_phi %216 + %217 = OpLoad %int %x_135 + OpStore %x_136_phi %217 + OpBranch %199 + %199 = OpLabel + %218 = OpLoad %int %x_134_phi + %219 = OpLoad %int %x_136_phi + OpBranch %171 + %171 = OpLabel + OpStore %x_130_phi %194 + OpStore %x_133_phi %218 + OpStore %x_135_phi %219 + OpBranch %169 + %170 = OpLabel + %220 = OpLoad %int %x_130 + OpStore %x_157_phi %220 + %221 = OpLoad %int %x_135 + OpStore %x_160_phi %221 + OpBranch %222 + %222 = OpLabel + OpLoopMerge %223 %224 None + OpBranch %225 + %225 = OpLabel + %228 = OpLoad %int %x_157_phi + %229 = OpLoad %int %x_160_phi + %230 = OpSLessThan %bool %229 %int_10 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %231 + %232 = OpLabel + %233 = OpSLessThanEqual %bool %229 %163 + OpBranch %231 + %231 = OpLabel + %234 = OpPhi %bool %230 %225 %233 %232 + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %237 + %236 = OpLabel + OpBranch %235 + %237 = OpLabel + OpBranch %223 + %235 = OpLabel + OpBranch %224 + %224 = OpLabel + %238 = OpIAdd %int %228 %int_1 + OpStore %x_158 %238 + %239 = OpIAdd %int %229 %int_1 + OpStore %x_161 %239 + %240 = OpAccessChain %_ptr_Function_int %data %229 + %241 = OpLoad %int %240 + %242 = OpAccessChain %_ptr_Function_int %temp %228 + OpStore %242 %241 + %243 = OpLoad %int %x_158 + OpStore %x_157_phi %243 + %244 = OpLoad %int %x_161 + OpStore %x_160_phi %244 + OpBranch %222 + %223 = OpLabel + OpStore %x_170_phi %157 + OpBranch %245 + %245 = OpLabel + OpLoopMerge %246 %247 None + OpBranch %248 + %248 = OpLabel + %250 = OpLoad %int %x_170_phi + %251 = OpSLessThanEqual %bool %250 %166 + OpSelectionMerge %252 None + OpBranchConditional %251 %253 %254 + %253 = OpLabel + OpBranch %252 + %254 = OpLabel + OpBranch %246 + %252 = OpLabel + OpBranch %247 + %247 = OpLabel + %255 = OpAccessChain %_ptr_Function_int %temp %250 + %256 = OpLoad %int %255 + %257 = OpAccessChain %_ptr_Function_int %data %250 + OpStore %257 %256 + %258 = OpIAdd %int %250 %int_1 + OpStore %x_171 %258 + %259 = OpLoad %int %x_171 + OpStore %x_170_phi %259 + OpBranch %245 + %246 = OpLabel + OpBranch %147 + %147 = OpLabel + OpStore %x_118_phi %165 + OpBranch %145 + %146 = OpLabel + OpBranch %135 + %135 = OpLabel + %260 = OpIMul %int %int_2 %139 + OpStore %x_112 %260 + %261 = OpLoad %int %x_112 + OpStore %x_111_phi %261 + OpBranch %133 + %134 = OpLabel + %268 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %269 = OpLoad %float %268 + %270 = OpConvertFToS %int %269 + OpStore %x_180 %270 + %271 = OpLoad %int %x_180 + %273 = OpSLessThan %bool %271 %int_30 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %276 + %275 = OpLabel + %277 = OpAccessChain %_ptr_Function_int %data %int_0 + %278 = OpLoad %int %277 + %280 = OpConvertSToF %float %278 + %282 = OpFMul %float %280 %float_0_100000001 + %283 = OpFAdd %float %float_0_5 %282 + OpStore %x_189 %283 + %284 = OpLoad %float %x_189 + OpStore %x_262_phi %284 + OpBranch %274 + %276 = OpLabel + %288 = OpLoad %int %x_180 + %290 = OpSLessThan %bool %288 %int_60 + OpSelectionMerge %291 None + OpBranchConditional %290 %292 %293 + %292 = OpLabel + %294 = OpAccessChain %_ptr_Function_int %data %int_1 + %295 = OpLoad %int %294 + %296 = OpConvertSToF %float %295 + %297 = OpFMul %float %296 %float_0_100000001 + %298 = OpFAdd %float %float_0_5 %297 + OpStore %x_198 %298 + %299 = OpLoad %float %x_198 + OpStore %x_261_phi %299 + OpBranch %291 + %293 = OpLabel + %303 = OpLoad %int %x_180 + %305 = OpSLessThan %bool %303 %int_90 + OpSelectionMerge %306 None + OpBranchConditional %305 %307 %308 + %307 = OpLabel + %309 = OpAccessChain %_ptr_Function_int %data %int_2 + %310 = OpLoad %int %309 + %311 = OpConvertSToF %float %310 + %312 = OpFMul %float %311 %float_0_100000001 + %313 = OpFAdd %float %float_0_5 %312 + OpStore %x_207 %313 + %314 = OpLoad %float %x_207 + OpStore %x_260_phi %314 + OpBranch %306 + %308 = OpLabel + %315 = OpLoad %int %x_180 + %317 = OpSLessThan %bool %315 %int_120 + OpSelectionMerge %318 None + OpBranchConditional %317 %319 %320 + %319 = OpLabel + %321 = OpAccessChain %_ptr_Function_int %data %int_3 + %322 = OpLoad %int %321 + %323 = OpConvertSToF %float %322 + %324 = OpFMul %float %323 %float_0_100000001 + %325 = OpFAdd %float %float_0_5 %324 + OpStore %x_216 %325 + %326 = OpLoad %float %x_216 + OpStore %x_259_phi %326 + OpBranch %318 + %320 = OpLabel + %330 = OpLoad %int %x_180 + %332 = OpSLessThan %bool %330 %int_150 + OpSelectionMerge %333 None + OpBranchConditional %332 %334 %335 + %334 = OpLabel + OpKill + %335 = OpLabel + %339 = OpLoad %int %x_180 + %341 = OpSLessThan %bool %339 %int_180 + OpSelectionMerge %342 None + OpBranchConditional %341 %343 %344 + %343 = OpLabel + %346 = OpAccessChain %_ptr_Function_int %data %int_5 + %347 = OpLoad %int %346 + %348 = OpConvertSToF %float %347 + %349 = OpFMul %float %348 %float_0_100000001 + %350 = OpFAdd %float %float_0_5 %349 + OpStore %x_229 %350 + %351 = OpLoad %float %x_229 + OpStore %x_258_phi %351 + OpBranch %342 + %344 = OpLabel + %355 = OpLoad %int %x_180 + %357 = OpSLessThan %bool %355 %int_210 + OpSelectionMerge %358 None + OpBranchConditional %357 %359 %360 + %359 = OpLabel + %362 = OpAccessChain %_ptr_Function_int %data %int_6 + %363 = OpLoad %int %362 + %364 = OpConvertSToF %float %363 + %365 = OpFMul %float %364 %float_0_100000001 + %366 = OpFAdd %float %float_0_5 %365 + OpStore %x_238 %366 + %367 = OpLoad %float %x_238 + OpStore %x_257_phi %367 + OpBranch %358 + %360 = OpLabel + %368 = OpLoad %int %x_180 + %370 = OpSLessThan %bool %368 %int_240 + OpSelectionMerge %371 None + OpBranchConditional %370 %372 %373 + %372 = OpLabel + %375 = OpAccessChain %_ptr_Function_int %data %int_7 + %376 = OpLoad %int %375 + %377 = OpConvertSToF %float %376 + %378 = OpFMul %float %377 %float_0_100000001 + %379 = OpFAdd %float %float_0_5 %378 + OpStore %x_247 %379 + %380 = OpLoad %float %x_247 + OpStore %x_256_phi %380 + OpBranch %371 + %373 = OpLabel + %381 = OpLoad %int %x_180 + %383 = OpSLessThan %bool %381 %int_270 + OpSelectionMerge %384 None + OpBranchConditional %383 %385 %386 + %385 = OpLabel + OpBranch %384 + %386 = OpLabel + OpKill + %384 = OpLabel + %388 = OpAccessChain %_ptr_Function_int %data %int_8 + %389 = OpLoad %int %388 + %390 = OpConvertSToF %float %389 + %391 = OpFMul %float %390 %float_0_100000001 + %392 = OpFAdd %float %float_0_5 %391 + OpStore %x_255 %392 + %393 = OpLoad %float %x_255 + OpStore %x_256_phi %393 + OpBranch %371 + %371 = OpLabel + %394 = OpLoad %float %x_256_phi + OpStore %x_256 %394 + %395 = OpLoad %float %x_256 + OpStore %x_257_phi %395 + OpBranch %358 + %358 = OpLabel + %396 = OpLoad %float %x_257_phi + OpStore %x_257 %396 + %397 = OpLoad %float %x_257 + OpStore %x_258_phi %397 + OpBranch %342 + %342 = OpLabel + %398 = OpLoad %float %x_258_phi + OpStore %x_258 %398 + OpBranch %333 + %333 = OpLabel + %399 = OpLoad %float %x_258 + OpStore %x_259_phi %399 + OpBranch %318 + %318 = OpLabel + %400 = OpLoad %float %x_259_phi + OpStore %x_259 %400 + %401 = OpLoad %float %x_259 + OpStore %x_260_phi %401 + OpBranch %306 + %306 = OpLabel + %402 = OpLoad %float %x_260_phi + OpStore %x_260 %402 + %403 = OpLoad %float %x_260 + OpStore %x_261_phi %403 + OpBranch %291 + %291 = OpLabel + %404 = OpLoad %float %x_261_phi + OpStore %x_261 %404 + %405 = OpLoad %float %x_261 + OpStore %x_262_phi %405 + OpBranch %274 + %274 = OpLabel + %406 = OpLoad %float %x_262_phi + %408 = OpCompositeConstruct %v4float %406 %406 %406 %float_1 + OpStore %x_GLF_color %408 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %409 +%tint_symbol_1 = OpFunctionParameter %main_out + %413 = OpLabel + %414 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %414 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %416 = OpLabel + %417 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %417 + %418 = OpFunctionCall %void %main_1 + %420 = OpLoad %v4float %x_GLF_color + %421 = OpCompositeConstruct %main_out %420 + %419 = OpFunctionCall %void %tint_symbol_3 %421 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 44[%44] is not post dominated by the back-edge block 115[%115] + %115 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.wgsl new file mode 100644 index 0000000000..0d0b64bf8e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.spvasm.expected.wgsl @@ -0,0 +1,338 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var temp : array; + var data : array; + var x_189 : f32; + var x_261 : f32; + var x_63_phi : i32; + var x_102_phi : i32; + var x_111_phi : i32; + var x_262_phi : f32; + let x_60 : f32 = x_8.injectionSwitch.x; + let x_61 : i32 = i32(x_60); + x_63_phi = x_61; + loop { + var x_99 : i32; + var x_97 : i32; + var x_95 : i32; + var x_93 : i32; + var x_91 : i32; + var x_89 : i32; + var x_87 : i32; + var x_85 : i32; + var x_83 : i32; + var x_81 : i32; + var x_64_phi : i32; + let x_63 : i32 = x_63_phi; + let x_68 : i32 = (x_63 + 1); + x_64_phi = x_68; + switch(x_63) { + case 9: { + data[x_63] = -5; + x_99 = (x_63 + 1); + x_64_phi = x_99; + } + case 8: { + data[x_63] = -4; + x_97 = (x_63 + 1); + x_64_phi = x_97; + } + case 7: { + data[x_63] = -3; + x_95 = (x_63 + 1); + x_64_phi = x_95; + } + case 6: { + data[x_63] = -2; + x_93 = (x_63 + 1); + x_64_phi = x_93; + } + case 5: { + data[x_63] = -1; + x_91 = (x_63 + 1); + x_64_phi = x_91; + } + case 4: { + data[x_63] = 0; + x_89 = (x_63 + 1); + x_64_phi = x_89; + } + case 3: { + data[x_63] = 1; + x_87 = (x_63 + 1); + x_64_phi = x_87; + } + case 2: { + data[x_63] = 2; + x_85 = (x_63 + 1); + x_64_phi = x_85; + } + case 1: { + data[x_63] = 3; + x_83 = (x_63 + 1); + x_64_phi = x_83; + } + case 0: { + data[x_63] = 4; + x_81 = (x_63 + 1); + x_64_phi = x_81; + } + default: { + } + } + let x_64 : i32 = x_64_phi; + + continuing { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_102_phi = 0; + loop { + var x_103 : i32; + let x_102 : i32 = x_102_phi; + if ((x_102 < 10)) { + } else { + break; + } + + continuing { + let x_108 : i32 = data[x_102]; + temp[x_102] = x_108; + x_103 = (x_102 + 1); + x_102_phi = x_103; + } + } + x_111_phi = 1; + loop { + var x_112 : i32; + var x_118_phi : i32; + let x_111 : i32 = x_111_phi; + if ((x_111 <= 9)) { + } else { + break; + } + x_118_phi = 0; + loop { + var x_130 : i32; + var x_135 : i32; + var x_130_phi : i32; + var x_133_phi : i32; + var x_135_phi : i32; + var x_157_phi : i32; + var x_160_phi : i32; + var x_170_phi : i32; + let x_118 : i32 = x_118_phi; + if ((x_118 < 9)) { + } else { + break; + } + let x_124 : i32 = (x_118 + x_111); + let x_125 : i32 = (x_124 - 1); + let x_119 : i32 = (x_118 + (2 * x_111)); + let x_128 : i32 = min((x_119 - 1), 9); + x_130_phi = x_118; + x_133_phi = x_124; + x_135_phi = x_118; + loop { + var x_150 : i32; + var x_153 : i32; + var x_134_phi : i32; + var x_136_phi : i32; + x_130 = x_130_phi; + let x_133 : i32 = x_133_phi; + x_135 = x_135_phi; + if (((x_135 <= x_125) && (x_133 <= x_128))) { + } else { + break; + } + let x_142 : ptr = &(data[x_135]); + let x_143 : i32 = *(x_142); + let x_144 : ptr = &(data[x_133]); + let x_145 : i32 = *(x_144); + let x_131 : i32 = bitcast((x_130 + bitcast(1))); + if ((x_143 < x_145)) { + x_150 = bitcast((x_135 + bitcast(1))); + let x_151 : i32 = *(x_142); + temp[x_130] = x_151; + x_134_phi = x_133; + x_136_phi = x_150; + } else { + x_153 = (x_133 + 1); + let x_154 : i32 = *(x_144); + temp[x_130] = x_154; + x_134_phi = x_153; + x_136_phi = x_135; + } + let x_134 : i32 = x_134_phi; + let x_136 : i32 = x_136_phi; + + continuing { + x_130_phi = x_131; + x_133_phi = x_134; + x_135_phi = x_136; + } + } + x_157_phi = x_130; + x_160_phi = x_135; + loop { + var x_158 : i32; + var x_161 : i32; + let x_157 : i32 = x_157_phi; + let x_160 : i32 = x_160_phi; + if (((x_160 < 10) && (x_160 <= x_125))) { + } else { + break; + } + + continuing { + x_158 = (x_157 + 1); + x_161 = (x_160 + 1); + let x_167 : i32 = data[x_160]; + temp[x_157] = x_167; + x_157_phi = x_158; + x_160_phi = x_161; + } + } + x_170_phi = x_118; + loop { + var x_171 : i32; + let x_170 : i32 = x_170_phi; + if ((x_170 <= x_128)) { + } else { + break; + } + + continuing { + let x_176 : i32 = temp[x_170]; + data[x_170] = x_176; + x_171 = (x_170 + 1); + x_170_phi = x_171; + } + } + + continuing { + x_118_phi = x_119; + } + } + + continuing { + x_112 = (2 * x_111); + x_111_phi = x_112; + } + } + var x_180 : i32; + var x_198 : f32; + var x_260 : f32; + var x_261_phi : f32; + let x_179 : f32 = gl_FragCoord.y; + x_180 = i32(x_179); + if ((x_180 < 30)) { + let x_186 : i32 = data[0]; + x_189 = (0.5 + (f32(x_186) * 0.100000001)); + x_262_phi = x_189; + } else { + var x_207 : f32; + var x_259 : f32; + var x_260_phi : f32; + if ((x_180 < 60)) { + let x_195 : i32 = data[1]; + x_198 = (0.5 + (f32(x_195) * 0.100000001)); + x_261_phi = x_198; + } else { + var x_216 : f32; + var x_258 : f32; + var x_259_phi : f32; + if ((x_180 < 90)) { + let x_204 : i32 = data[2]; + x_207 = (0.5 + (f32(x_204) * 0.100000001)); + x_260_phi = x_207; + } else { + if ((x_180 < 120)) { + let x_213 : i32 = data[3]; + x_216 = (0.5 + (f32(x_213) * 0.100000001)); + x_259_phi = x_216; + } else { + var x_229 : f32; + var x_257 : f32; + var x_258_phi : f32; + if ((x_180 < 150)) { + discard; + } else { + var x_238 : f32; + var x_256 : f32; + var x_257_phi : f32; + if ((x_180 < 180)) { + let x_226 : i32 = data[5]; + x_229 = (0.5 + (f32(x_226) * 0.100000001)); + x_258_phi = x_229; + } else { + var x_247 : f32; + var x_255 : f32; + var x_256_phi : f32; + if ((x_180 < 210)) { + let x_235 : i32 = data[6]; + x_238 = (0.5 + (f32(x_235) * 0.100000001)); + x_257_phi = x_238; + } else { + if ((x_180 < 240)) { + let x_244 : i32 = data[7]; + x_247 = (0.5 + (f32(x_244) * 0.100000001)); + x_256_phi = x_247; + } else { + if ((x_180 < 270)) { + } else { + discard; + } + let x_252 : i32 = data[8]; + x_255 = (0.5 + (f32(x_252) * 0.100000001)); + x_256_phi = x_255; + } + x_256 = x_256_phi; + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + } + x_259_phi = x_258; + } + x_259 = x_259_phi; + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + let x_262 : f32 = x_262_phi; + x_GLF_color = vec4(x_262, x_262, x_262, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl new file mode 100644 index 0000000000..0d0b64bf8e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl @@ -0,0 +1,338 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var temp : array; + var data : array; + var x_189 : f32; + var x_261 : f32; + var x_63_phi : i32; + var x_102_phi : i32; + var x_111_phi : i32; + var x_262_phi : f32; + let x_60 : f32 = x_8.injectionSwitch.x; + let x_61 : i32 = i32(x_60); + x_63_phi = x_61; + loop { + var x_99 : i32; + var x_97 : i32; + var x_95 : i32; + var x_93 : i32; + var x_91 : i32; + var x_89 : i32; + var x_87 : i32; + var x_85 : i32; + var x_83 : i32; + var x_81 : i32; + var x_64_phi : i32; + let x_63 : i32 = x_63_phi; + let x_68 : i32 = (x_63 + 1); + x_64_phi = x_68; + switch(x_63) { + case 9: { + data[x_63] = -5; + x_99 = (x_63 + 1); + x_64_phi = x_99; + } + case 8: { + data[x_63] = -4; + x_97 = (x_63 + 1); + x_64_phi = x_97; + } + case 7: { + data[x_63] = -3; + x_95 = (x_63 + 1); + x_64_phi = x_95; + } + case 6: { + data[x_63] = -2; + x_93 = (x_63 + 1); + x_64_phi = x_93; + } + case 5: { + data[x_63] = -1; + x_91 = (x_63 + 1); + x_64_phi = x_91; + } + case 4: { + data[x_63] = 0; + x_89 = (x_63 + 1); + x_64_phi = x_89; + } + case 3: { + data[x_63] = 1; + x_87 = (x_63 + 1); + x_64_phi = x_87; + } + case 2: { + data[x_63] = 2; + x_85 = (x_63 + 1); + x_64_phi = x_85; + } + case 1: { + data[x_63] = 3; + x_83 = (x_63 + 1); + x_64_phi = x_83; + } + case 0: { + data[x_63] = 4; + x_81 = (x_63 + 1); + x_64_phi = x_81; + } + default: { + } + } + let x_64 : i32 = x_64_phi; + + continuing { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_102_phi = 0; + loop { + var x_103 : i32; + let x_102 : i32 = x_102_phi; + if ((x_102 < 10)) { + } else { + break; + } + + continuing { + let x_108 : i32 = data[x_102]; + temp[x_102] = x_108; + x_103 = (x_102 + 1); + x_102_phi = x_103; + } + } + x_111_phi = 1; + loop { + var x_112 : i32; + var x_118_phi : i32; + let x_111 : i32 = x_111_phi; + if ((x_111 <= 9)) { + } else { + break; + } + x_118_phi = 0; + loop { + var x_130 : i32; + var x_135 : i32; + var x_130_phi : i32; + var x_133_phi : i32; + var x_135_phi : i32; + var x_157_phi : i32; + var x_160_phi : i32; + var x_170_phi : i32; + let x_118 : i32 = x_118_phi; + if ((x_118 < 9)) { + } else { + break; + } + let x_124 : i32 = (x_118 + x_111); + let x_125 : i32 = (x_124 - 1); + let x_119 : i32 = (x_118 + (2 * x_111)); + let x_128 : i32 = min((x_119 - 1), 9); + x_130_phi = x_118; + x_133_phi = x_124; + x_135_phi = x_118; + loop { + var x_150 : i32; + var x_153 : i32; + var x_134_phi : i32; + var x_136_phi : i32; + x_130 = x_130_phi; + let x_133 : i32 = x_133_phi; + x_135 = x_135_phi; + if (((x_135 <= x_125) && (x_133 <= x_128))) { + } else { + break; + } + let x_142 : ptr = &(data[x_135]); + let x_143 : i32 = *(x_142); + let x_144 : ptr = &(data[x_133]); + let x_145 : i32 = *(x_144); + let x_131 : i32 = bitcast((x_130 + bitcast(1))); + if ((x_143 < x_145)) { + x_150 = bitcast((x_135 + bitcast(1))); + let x_151 : i32 = *(x_142); + temp[x_130] = x_151; + x_134_phi = x_133; + x_136_phi = x_150; + } else { + x_153 = (x_133 + 1); + let x_154 : i32 = *(x_144); + temp[x_130] = x_154; + x_134_phi = x_153; + x_136_phi = x_135; + } + let x_134 : i32 = x_134_phi; + let x_136 : i32 = x_136_phi; + + continuing { + x_130_phi = x_131; + x_133_phi = x_134; + x_135_phi = x_136; + } + } + x_157_phi = x_130; + x_160_phi = x_135; + loop { + var x_158 : i32; + var x_161 : i32; + let x_157 : i32 = x_157_phi; + let x_160 : i32 = x_160_phi; + if (((x_160 < 10) && (x_160 <= x_125))) { + } else { + break; + } + + continuing { + x_158 = (x_157 + 1); + x_161 = (x_160 + 1); + let x_167 : i32 = data[x_160]; + temp[x_157] = x_167; + x_157_phi = x_158; + x_160_phi = x_161; + } + } + x_170_phi = x_118; + loop { + var x_171 : i32; + let x_170 : i32 = x_170_phi; + if ((x_170 <= x_128)) { + } else { + break; + } + + continuing { + let x_176 : i32 = temp[x_170]; + data[x_170] = x_176; + x_171 = (x_170 + 1); + x_170_phi = x_171; + } + } + + continuing { + x_118_phi = x_119; + } + } + + continuing { + x_112 = (2 * x_111); + x_111_phi = x_112; + } + } + var x_180 : i32; + var x_198 : f32; + var x_260 : f32; + var x_261_phi : f32; + let x_179 : f32 = gl_FragCoord.y; + x_180 = i32(x_179); + if ((x_180 < 30)) { + let x_186 : i32 = data[0]; + x_189 = (0.5 + (f32(x_186) * 0.100000001)); + x_262_phi = x_189; + } else { + var x_207 : f32; + var x_259 : f32; + var x_260_phi : f32; + if ((x_180 < 60)) { + let x_195 : i32 = data[1]; + x_198 = (0.5 + (f32(x_195) * 0.100000001)); + x_261_phi = x_198; + } else { + var x_216 : f32; + var x_258 : f32; + var x_259_phi : f32; + if ((x_180 < 90)) { + let x_204 : i32 = data[2]; + x_207 = (0.5 + (f32(x_204) * 0.100000001)); + x_260_phi = x_207; + } else { + if ((x_180 < 120)) { + let x_213 : i32 = data[3]; + x_216 = (0.5 + (f32(x_213) * 0.100000001)); + x_259_phi = x_216; + } else { + var x_229 : f32; + var x_257 : f32; + var x_258_phi : f32; + if ((x_180 < 150)) { + discard; + } else { + var x_238 : f32; + var x_256 : f32; + var x_257_phi : f32; + if ((x_180 < 180)) { + let x_226 : i32 = data[5]; + x_229 = (0.5 + (f32(x_226) * 0.100000001)); + x_258_phi = x_229; + } else { + var x_247 : f32; + var x_255 : f32; + var x_256_phi : f32; + if ((x_180 < 210)) { + let x_235 : i32 = data[6]; + x_238 = (0.5 + (f32(x_235) * 0.100000001)); + x_257_phi = x_238; + } else { + if ((x_180 < 240)) { + let x_244 : i32 = data[7]; + x_247 = (0.5 + (f32(x_244) * 0.100000001)); + x_256_phi = x_247; + } else { + if ((x_180 < 270)) { + } else { + discard; + } + let x_252 : i32 = data[8]; + x_255 = (0.5 + (f32(x_252) * 0.100000001)); + x_256_phi = x_255; + } + x_256 = x_256_phi; + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + } + x_259_phi = x_258; + } + x_259 = x_259_phi; + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + let x_262 : f32 = x_262_phi; + x_GLF_color = vec4(x_262, x_262, x_262, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.hlsl new file mode 100644 index 0000000000..3b86173722 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.hlsl @@ -0,0 +1,352 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int temp[10] = (int[10])0; + int data[10] = (int[10])0; + float x_189 = 0.0f; + float x_261 = 0.0f; + int x_63_phi = 0; + int x_102_phi = 0; + int x_111_phi = 0; + float x_262_phi = 0.0f; + const float x_60 = asfloat(x_8[0].x); + const int x_61 = int(x_60); + x_63_phi = x_61; + while (true) { + int x_99 = 0; + int x_97 = 0; + int x_95 = 0; + int x_93 = 0; + int x_91 = 0; + int x_89 = 0; + int x_87 = 0; + int x_85 = 0; + int x_83 = 0; + int x_81 = 0; + int x_64_phi = 0; + const int x_63 = x_63_phi; + const int x_68 = (x_63 + 1); + x_64_phi = x_68; + switch(x_63) { + case 9: { + data[x_63] = -5; + x_99 = (x_63 + 1); + x_64_phi = x_99; + break; + } + case 8: { + data[x_63] = -4; + x_97 = (x_63 + 1); + x_64_phi = x_97; + break; + } + case 7: { + data[x_63] = -3; + x_95 = (x_63 + 1); + x_64_phi = x_95; + break; + } + case 6: { + data[x_63] = -2; + x_93 = (x_63 + 1); + x_64_phi = x_93; + break; + } + case 5: { + data[x_63] = -1; + x_91 = (x_63 + 1); + x_64_phi = x_91; + break; + } + case 4: { + data[x_63] = 0; + x_89 = (x_63 + 1); + x_64_phi = x_89; + break; + } + case 3: { + data[x_63] = 1; + x_87 = (x_63 + 1); + x_64_phi = x_87; + break; + } + case 2: { + data[x_63] = 2; + x_85 = (x_63 + 1); + x_64_phi = x_85; + break; + } + case 1: { + data[x_63] = 3; + x_83 = (x_63 + 1); + x_64_phi = x_83; + break; + } + case 0: { + data[x_63] = 4; + x_81 = (x_63 + 1); + x_64_phi = x_81; + break; + } + default: { + break; + } + } + const int x_64 = x_64_phi; + { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_102_phi = 0; + while (true) { + int x_103 = 0; + const int x_102 = x_102_phi; + if ((x_102 < 10)) { + } else { + break; + } + { + const int x_108 = data[x_102]; + temp[x_102] = x_108; + x_103 = (x_102 + 1); + x_102_phi = x_103; + } + } + x_111_phi = 1; + while (true) { + int x_112 = 0; + int x_118_phi = 0; + const int x_111 = x_111_phi; + if ((x_111 <= 9)) { + } else { + break; + } + x_118_phi = 0; + while (true) { + int x_130 = 0; + int x_135 = 0; + int x_130_phi = 0; + int x_133_phi = 0; + int x_135_phi = 0; + int x_157_phi = 0; + int x_160_phi = 0; + int x_170_phi = 0; + const int x_118 = x_118_phi; + if ((x_118 < 9)) { + } else { + break; + } + const int x_124 = (x_118 + x_111); + const int x_125 = (x_124 - 1); + const int x_119 = (x_118 + (2 * x_111)); + const int x_128 = min((x_119 - 1), 9); + x_130_phi = x_118; + x_133_phi = x_124; + x_135_phi = x_118; + while (true) { + int x_150 = 0; + int x_153 = 0; + int x_134_phi = 0; + int x_136_phi = 0; + x_130 = x_130_phi; + const int x_133 = x_133_phi; + x_135 = x_135_phi; + bool tint_tmp = (x_135 <= x_125); + if (tint_tmp) { + tint_tmp = (x_133 <= x_128); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_142_save = x_135; + const int x_143 = data[x_142_save]; + const int x_144_save = x_133; + const int x_145 = data[x_144_save]; + const int x_131 = asint((x_130 + asint(1))); + if ((x_143 < x_145)) { + x_150 = asint((x_135 + asint(1))); + const int x_151 = data[x_142_save]; + temp[x_130] = x_151; + x_134_phi = x_133; + x_136_phi = x_150; + } else { + x_153 = (x_133 + 1); + const int x_154 = data[x_144_save]; + temp[x_130] = x_154; + x_134_phi = x_153; + x_136_phi = x_135; + } + const int x_134 = x_134_phi; + const int x_136 = x_136_phi; + { + x_130_phi = x_131; + x_133_phi = x_134; + x_135_phi = x_136; + } + } + x_157_phi = x_130; + x_160_phi = x_135; + while (true) { + int x_158 = 0; + int x_161 = 0; + const int x_157 = x_157_phi; + const int x_160 = x_160_phi; + bool tint_tmp_1 = (x_160 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_160 <= x_125); + } + if ((tint_tmp_1)) { + } else { + break; + } + { + x_158 = (x_157 + 1); + x_161 = (x_160 + 1); + const int x_167 = data[x_160]; + temp[x_157] = x_167; + x_157_phi = x_158; + x_160_phi = x_161; + } + } + x_170_phi = x_118; + while (true) { + int x_171 = 0; + const int x_170 = x_170_phi; + if ((x_170 <= x_128)) { + } else { + break; + } + { + const int x_176 = temp[x_170]; + data[x_170] = x_176; + x_171 = (x_170 + 1); + x_170_phi = x_171; + } + } + { + x_118_phi = x_119; + } + } + { + x_112 = (2 * x_111); + x_111_phi = x_112; + } + } + int x_180 = 0; + float x_198 = 0.0f; + float x_260 = 0.0f; + float x_261_phi = 0.0f; + const float x_179 = gl_FragCoord.y; + x_180 = int(x_179); + if ((x_180 < 30)) { + const int x_186 = data[0]; + x_189 = (0.5f + (float(x_186) * 0.100000001f)); + x_262_phi = x_189; + } else { + float x_207 = 0.0f; + float x_259 = 0.0f; + float x_260_phi = 0.0f; + if ((x_180 < 60)) { + const int x_195 = data[1]; + x_198 = (0.5f + (float(x_195) * 0.100000001f)); + x_261_phi = x_198; + } else { + float x_216 = 0.0f; + float x_258 = 0.0f; + float x_259_phi = 0.0f; + if ((x_180 < 90)) { + const int x_204 = data[2]; + x_207 = (0.5f + (float(x_204) * 0.100000001f)); + x_260_phi = x_207; + } else { + if ((x_180 < 120)) { + const int x_213 = data[3]; + x_216 = (0.5f + (float(x_213) * 0.100000001f)); + x_259_phi = x_216; + } else { + float x_229 = 0.0f; + float x_257 = 0.0f; + float x_258_phi = 0.0f; + if ((x_180 < 150)) { + discard; + } else { + float x_238 = 0.0f; + float x_256 = 0.0f; + float x_257_phi = 0.0f; + if ((x_180 < 180)) { + const int x_226 = data[5]; + x_229 = (0.5f + (float(x_226) * 0.100000001f)); + x_258_phi = x_229; + } else { + float x_247 = 0.0f; + float x_255 = 0.0f; + float x_256_phi = 0.0f; + if ((x_180 < 210)) { + const int x_235 = data[6]; + x_238 = (0.5f + (float(x_235) * 0.100000001f)); + x_257_phi = x_238; + } else { + if ((x_180 < 240)) { + const int x_244 = data[7]; + x_247 = (0.5f + (float(x_244) * 0.100000001f)); + x_256_phi = x_247; + } else { + if ((x_180 < 270)) { + } else { + discard; + } + const int x_252 = data[8]; + x_255 = (0.5f + (float(x_252) * 0.100000001f)); + x_256_phi = x_255; + } + x_256 = x_256_phi; + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + } + x_259_phi = x_258; + } + x_259 = x_259_phi; + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + const float x_262 = x_262_phi; + x_GLF_color = float4(x_262, x_262, x_262, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.msl new file mode 100644 index 0000000000..64e598bb88 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.msl @@ -0,0 +1,346 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + tint_array_wrapper temp = {}; + tint_array_wrapper data = {}; + float x_189 = 0.0f; + float x_261 = 0.0f; + int x_63_phi = 0; + int x_102_phi = 0; + int x_111_phi = 0; + float x_262_phi = 0.0f; + float const x_60 = x_8.injectionSwitch.x; + int const x_61 = int(x_60); + x_63_phi = x_61; + while (true) { + int x_99 = 0; + int x_97 = 0; + int x_95 = 0; + int x_93 = 0; + int x_91 = 0; + int x_89 = 0; + int x_87 = 0; + int x_85 = 0; + int x_83 = 0; + int x_81 = 0; + int x_64_phi = 0; + int const x_63 = x_63_phi; + int const x_68 = (x_63 + 1); + x_64_phi = x_68; + switch(x_63) { + case 9: { + data.arr[x_63] = -5; + x_99 = (x_63 + 1); + x_64_phi = x_99; + break; + } + case 8: { + data.arr[x_63] = -4; + x_97 = (x_63 + 1); + x_64_phi = x_97; + break; + } + case 7: { + data.arr[x_63] = -3; + x_95 = (x_63 + 1); + x_64_phi = x_95; + break; + } + case 6: { + data.arr[x_63] = -2; + x_93 = (x_63 + 1); + x_64_phi = x_93; + break; + } + case 5: { + data.arr[x_63] = -1; + x_91 = (x_63 + 1); + x_64_phi = x_91; + break; + } + case 4: { + data.arr[x_63] = 0; + x_89 = (x_63 + 1); + x_64_phi = x_89; + break; + } + case 3: { + data.arr[x_63] = 1; + x_87 = (x_63 + 1); + x_64_phi = x_87; + break; + } + case 2: { + data.arr[x_63] = 2; + x_85 = (x_63 + 1); + x_64_phi = x_85; + break; + } + case 1: { + data.arr[x_63] = 3; + x_83 = (x_63 + 1); + x_64_phi = x_83; + break; + } + case 0: { + data.arr[x_63] = 4; + x_81 = (x_63 + 1); + x_64_phi = x_81; + break; + } + default: { + break; + } + } + int const x_64 = x_64_phi; + { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_102_phi = 0; + while (true) { + int x_103 = 0; + int const x_102 = x_102_phi; + if ((x_102 < 10)) { + } else { + break; + } + { + int const x_108 = data.arr[x_102]; + temp.arr[x_102] = x_108; + x_103 = (x_102 + 1); + x_102_phi = x_103; + } + } + x_111_phi = 1; + while (true) { + int x_112 = 0; + int x_118_phi = 0; + int const x_111 = x_111_phi; + if ((x_111 <= 9)) { + } else { + break; + } + x_118_phi = 0; + while (true) { + int x_130 = 0; + int x_135 = 0; + int x_130_phi = 0; + int x_133_phi = 0; + int x_135_phi = 0; + int x_157_phi = 0; + int x_160_phi = 0; + int x_170_phi = 0; + int const x_118 = x_118_phi; + if ((x_118 < 9)) { + } else { + break; + } + int const x_124 = (x_118 + x_111); + int const x_125 = (x_124 - 1); + int const x_119 = (x_118 + (2 * x_111)); + int const x_128 = min((x_119 - 1), 9); + x_130_phi = x_118; + x_133_phi = x_124; + x_135_phi = x_118; + while (true) { + int x_150 = 0; + int x_153 = 0; + int x_134_phi = 0; + int x_136_phi = 0; + x_130 = x_130_phi; + int const x_133 = x_133_phi; + x_135 = x_135_phi; + if (((x_135 <= x_125) && (x_133 <= x_128))) { + } else { + break; + } + int const x_142_save = x_135; + int const x_143 = data.arr[x_142_save]; + int const x_144_save = x_133; + int const x_145 = data.arr[x_144_save]; + int const x_131 = as_type((x_130 + as_type(1))); + if ((x_143 < x_145)) { + x_150 = as_type((x_135 + as_type(1))); + int const x_151 = data.arr[x_142_save]; + temp.arr[x_130] = x_151; + x_134_phi = x_133; + x_136_phi = x_150; + } else { + x_153 = (x_133 + 1); + int const x_154 = data.arr[x_144_save]; + temp.arr[x_130] = x_154; + x_134_phi = x_153; + x_136_phi = x_135; + } + int const x_134 = x_134_phi; + int const x_136 = x_136_phi; + { + x_130_phi = x_131; + x_133_phi = x_134; + x_135_phi = x_136; + } + } + x_157_phi = x_130; + x_160_phi = x_135; + while (true) { + int x_158 = 0; + int x_161 = 0; + int const x_157 = x_157_phi; + int const x_160 = x_160_phi; + if (((x_160 < 10) && (x_160 <= x_125))) { + } else { + break; + } + { + x_158 = (x_157 + 1); + x_161 = (x_160 + 1); + int const x_167 = data.arr[x_160]; + temp.arr[x_157] = x_167; + x_157_phi = x_158; + x_160_phi = x_161; + } + } + x_170_phi = x_118; + while (true) { + int x_171 = 0; + int const x_170 = x_170_phi; + if ((x_170 <= x_128)) { + } else { + break; + } + { + int const x_176 = temp.arr[x_170]; + data.arr[x_170] = x_176; + x_171 = (x_170 + 1); + x_170_phi = x_171; + } + } + { + x_118_phi = x_119; + } + } + { + x_112 = (2 * x_111); + x_111_phi = x_112; + } + } + int x_180 = 0; + float x_198 = 0.0f; + float x_260 = 0.0f; + float x_261_phi = 0.0f; + float const x_179 = (*(tint_symbol_5)).y; + x_180 = int(x_179); + if ((x_180 < 30)) { + int const x_186 = data.arr[0]; + x_189 = (0.5f + (float(x_186) * 0.100000001f)); + x_262_phi = x_189; + } else { + float x_207 = 0.0f; + float x_259 = 0.0f; + float x_260_phi = 0.0f; + if ((x_180 < 60)) { + int const x_195 = data.arr[1]; + x_198 = (0.5f + (float(x_195) * 0.100000001f)); + x_261_phi = x_198; + } else { + float x_216 = 0.0f; + float x_258 = 0.0f; + float x_259_phi = 0.0f; + if ((x_180 < 90)) { + int const x_204 = data.arr[2]; + x_207 = (0.5f + (float(x_204) * 0.100000001f)); + x_260_phi = x_207; + } else { + if ((x_180 < 120)) { + int const x_213 = data.arr[3]; + x_216 = (0.5f + (float(x_213) * 0.100000001f)); + x_259_phi = x_216; + } else { + float x_229 = 0.0f; + float x_257 = 0.0f; + float x_258_phi = 0.0f; + if ((x_180 < 150)) { + discard_fragment(); + } else { + float x_238 = 0.0f; + float x_256 = 0.0f; + float x_257_phi = 0.0f; + if ((x_180 < 180)) { + int const x_226 = data.arr[5]; + x_229 = (0.5f + (float(x_226) * 0.100000001f)); + x_258_phi = x_229; + } else { + float x_247 = 0.0f; + float x_255 = 0.0f; + float x_256_phi = 0.0f; + if ((x_180 < 210)) { + int const x_235 = data.arr[6]; + x_238 = (0.5f + (float(x_235) * 0.100000001f)); + x_257_phi = x_238; + } else { + if ((x_180 < 240)) { + int const x_244 = data.arr[7]; + x_247 = (0.5f + (float(x_244) * 0.100000001f)); + x_256_phi = x_247; + } else { + if ((x_180 < 270)) { + } else { + discard_fragment(); + } + int const x_252 = data.arr[8]; + x_255 = (0.5f + (float(x_252) * 0.100000001f)); + x_256_phi = x_255; + } + x_256 = x_256_phi; + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + } + x_259_phi = x_258; + } + x_259 = x_259_phi; + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + float const x_262 = x_262_phi; + *(tint_symbol_6) = float4(x_262, x_262, x_262, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.spvasm new file mode 100644 index 0000000000..105bea0bd2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.spvasm @@ -0,0 +1,742 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 422 +; Schema: 0 + OpCapability Shader + %167 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %temp "temp" + OpName %data "data" + OpName %x_189 "x_189" + OpName %x_261 "x_261" + OpName %x_63_phi "x_63_phi" + OpName %x_102_phi "x_102_phi" + OpName %x_111_phi "x_111_phi" + OpName %x_262_phi "x_262_phi" + OpName %x_99 "x_99" + OpName %x_97 "x_97" + OpName %x_95 "x_95" + OpName %x_93 "x_93" + OpName %x_91 "x_91" + OpName %x_89 "x_89" + OpName %x_87 "x_87" + OpName %x_85 "x_85" + OpName %x_83 "x_83" + OpName %x_81 "x_81" + OpName %x_64_phi "x_64_phi" + OpName %x_103 "x_103" + OpName %x_112 "x_112" + OpName %x_118_phi "x_118_phi" + OpName %x_130 "x_130" + OpName %x_135 "x_135" + OpName %x_130_phi "x_130_phi" + OpName %x_133_phi "x_133_phi" + OpName %x_135_phi "x_135_phi" + OpName %x_157_phi "x_157_phi" + OpName %x_160_phi "x_160_phi" + OpName %x_170_phi "x_170_phi" + OpName %x_150 "x_150" + OpName %x_153 "x_153" + OpName %x_134_phi "x_134_phi" + OpName %x_136_phi "x_136_phi" + OpName %x_158 "x_158" + OpName %x_161 "x_161" + OpName %x_171 "x_171" + OpName %x_180 "x_180" + OpName %x_198 "x_198" + OpName %x_260 "x_260" + OpName %x_261_phi "x_261_phi" + OpName %x_207 "x_207" + OpName %x_259 "x_259" + OpName %x_260_phi "x_260_phi" + OpName %x_216 "x_216" + OpName %x_258 "x_258" + OpName %x_259_phi "x_259_phi" + OpName %x_229 "x_229" + OpName %x_257 "x_257" + OpName %x_258_phi "x_258_phi" + OpName %x_238 "x_238" + OpName %x_256 "x_256" + OpName %x_257_phi "x_257_phi" + OpName %x_247 "x_247" + OpName %x_255 "x_255" + OpName %x_256_phi "x_256_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %25 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 +%float_0_100000001 = OpConstant %float 0.100000001 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %409 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %temp = OpVariable %_ptr_Function__arr_int_uint_10 Function %25 + %data = OpVariable %_ptr_Function__arr_int_uint_10 Function %25 + %x_189 = OpVariable %_ptr_Function_float Function %29 + %x_261 = OpVariable %_ptr_Function_float Function %29 + %x_63_phi = OpVariable %_ptr_Function_int Function %33 + %x_102_phi = OpVariable %_ptr_Function_int Function %33 + %x_111_phi = OpVariable %_ptr_Function_int Function %33 + %x_262_phi = OpVariable %_ptr_Function_float Function %29 + %x_99 = OpVariable %_ptr_Function_int Function %33 + %x_97 = OpVariable %_ptr_Function_int Function %33 + %x_95 = OpVariable %_ptr_Function_int Function %33 + %x_93 = OpVariable %_ptr_Function_int Function %33 + %x_91 = OpVariable %_ptr_Function_int Function %33 + %x_89 = OpVariable %_ptr_Function_int Function %33 + %x_87 = OpVariable %_ptr_Function_int Function %33 + %x_85 = OpVariable %_ptr_Function_int Function %33 + %x_83 = OpVariable %_ptr_Function_int Function %33 + %x_81 = OpVariable %_ptr_Function_int Function %33 + %x_64_phi = OpVariable %_ptr_Function_int Function %33 + %x_103 = OpVariable %_ptr_Function_int Function %33 + %x_112 = OpVariable %_ptr_Function_int Function %33 + %x_118_phi = OpVariable %_ptr_Function_int Function %33 + %x_130 = OpVariable %_ptr_Function_int Function %33 + %x_135 = OpVariable %_ptr_Function_int Function %33 + %x_130_phi = OpVariable %_ptr_Function_int Function %33 + %x_133_phi = OpVariable %_ptr_Function_int Function %33 + %x_135_phi = OpVariable %_ptr_Function_int Function %33 + %x_157_phi = OpVariable %_ptr_Function_int Function %33 + %x_160_phi = OpVariable %_ptr_Function_int Function %33 + %x_170_phi = OpVariable %_ptr_Function_int Function %33 + %x_150 = OpVariable %_ptr_Function_int Function %33 + %x_153 = OpVariable %_ptr_Function_int Function %33 + %x_134_phi = OpVariable %_ptr_Function_int Function %33 + %x_136_phi = OpVariable %_ptr_Function_int Function %33 + %x_158 = OpVariable %_ptr_Function_int Function %33 + %x_161 = OpVariable %_ptr_Function_int Function %33 + %x_171 = OpVariable %_ptr_Function_int Function %33 + %x_180 = OpVariable %_ptr_Function_int Function %33 + %x_198 = OpVariable %_ptr_Function_float Function %29 + %x_260 = OpVariable %_ptr_Function_float Function %29 + %x_261_phi = OpVariable %_ptr_Function_float Function %29 + %x_207 = OpVariable %_ptr_Function_float Function %29 + %x_259 = OpVariable %_ptr_Function_float Function %29 + %x_260_phi = OpVariable %_ptr_Function_float Function %29 + %x_216 = OpVariable %_ptr_Function_float Function %29 + %x_258 = OpVariable %_ptr_Function_float Function %29 + %x_259_phi = OpVariable %_ptr_Function_float Function %29 + %x_229 = OpVariable %_ptr_Function_float Function %29 + %x_257 = OpVariable %_ptr_Function_float Function %29 + %x_258_phi = OpVariable %_ptr_Function_float Function %29 + %x_238 = OpVariable %_ptr_Function_float Function %29 + %x_256 = OpVariable %_ptr_Function_float Function %29 + %x_257_phi = OpVariable %_ptr_Function_float Function %29 + %x_247 = OpVariable %_ptr_Function_float Function %29 + %x_255 = OpVariable %_ptr_Function_float Function %29 + %x_256_phi = OpVariable %_ptr_Function_float Function %29 + %39 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %40 = OpLoad %float %39 + %41 = OpConvertFToS %int %40 + OpStore %x_63_phi %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %57 = OpLoad %int %x_63_phi + %59 = OpIAdd %int %57 %int_1 + OpStore %x_64_phi %59 + OpSelectionMerge %60 None + OpSwitch %57 %61 9 %62 8 %63 7 %64 6 %65 5 %66 4 %67 3 %68 2 %69 1 %70 0 %71 + %62 = OpLabel + %72 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %72 %int_n5 + %74 = OpIAdd %int %57 %int_1 + OpStore %x_99 %74 + %75 = OpLoad %int %x_99 + OpStore %x_64_phi %75 + OpBranch %60 + %63 = OpLabel + %76 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %76 %int_n4 + %78 = OpIAdd %int %57 %int_1 + OpStore %x_97 %78 + %79 = OpLoad %int %x_97 + OpStore %x_64_phi %79 + OpBranch %60 + %64 = OpLabel + %80 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %80 %int_n3 + %82 = OpIAdd %int %57 %int_1 + OpStore %x_95 %82 + %83 = OpLoad %int %x_95 + OpStore %x_64_phi %83 + OpBranch %60 + %65 = OpLabel + %84 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %84 %int_n2 + %86 = OpIAdd %int %57 %int_1 + OpStore %x_93 %86 + %87 = OpLoad %int %x_93 + OpStore %x_64_phi %87 + OpBranch %60 + %66 = OpLabel + %88 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %88 %int_n1 + %90 = OpIAdd %int %57 %int_1 + OpStore %x_91 %90 + %91 = OpLoad %int %x_91 + OpStore %x_64_phi %91 + OpBranch %60 + %67 = OpLabel + %92 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %92 %int_0 + %94 = OpIAdd %int %57 %int_1 + OpStore %x_89 %94 + %95 = OpLoad %int %x_89 + OpStore %x_64_phi %95 + OpBranch %60 + %68 = OpLabel + %96 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %96 %int_1 + %97 = OpIAdd %int %57 %int_1 + OpStore %x_87 %97 + %98 = OpLoad %int %x_87 + OpStore %x_64_phi %98 + OpBranch %60 + %69 = OpLabel + %99 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %99 %int_2 + %101 = OpIAdd %int %57 %int_1 + OpStore %x_85 %101 + %102 = OpLoad %int %x_85 + OpStore %x_64_phi %102 + OpBranch %60 + %70 = OpLabel + %103 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %103 %int_3 + %105 = OpIAdd %int %57 %int_1 + OpStore %x_83 %105 + %106 = OpLoad %int %x_83 + OpStore %x_64_phi %106 + OpBranch %60 + %71 = OpLabel + %107 = OpAccessChain %_ptr_Function_int %data %57 + OpStore %107 %int_4 + %109 = OpIAdd %int %57 %int_1 + OpStore %x_81 %109 + %110 = OpLoad %int %x_81 + OpStore %x_64_phi %110 + OpBranch %60 + %61 = OpLabel + OpBranch %60 + %60 = OpLabel + %111 = OpLoad %int %x_64_phi + OpBranch %44 + %44 = OpLabel + OpStore %x_63_phi %111 + %113 = OpSLessThan %bool %111 %int_10 + OpSelectionMerge %115 None + OpBranchConditional %113 %116 %117 + %116 = OpLabel + OpBranch %115 + %117 = OpLabel + OpBranch %43 + %115 = OpLabel + OpBranch %42 + %43 = OpLabel + OpStore %x_102_phi %int_0 + OpBranch %118 + %118 = OpLabel + OpLoopMerge %119 %120 None + OpBranch %121 + %121 = OpLabel + %123 = OpLoad %int %x_102_phi + %124 = OpSLessThan %bool %123 %int_10 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %127 + %126 = OpLabel + OpBranch %125 + %127 = OpLabel + OpBranch %119 + %125 = OpLabel + OpBranch %120 + %120 = OpLabel + %128 = OpAccessChain %_ptr_Function_int %data %123 + %129 = OpLoad %int %128 + %130 = OpAccessChain %_ptr_Function_int %temp %123 + OpStore %130 %129 + %131 = OpIAdd %int %123 %int_1 + OpStore %x_103 %131 + %132 = OpLoad %int %x_103 + OpStore %x_102_phi %132 + OpBranch %118 + %119 = OpLabel + OpStore %x_111_phi %int_1 + OpBranch %133 + %133 = OpLabel + OpLoopMerge %134 %135 None + OpBranch %136 + %136 = OpLabel + %139 = OpLoad %int %x_111_phi + %141 = OpSLessThanEqual %bool %139 %int_9 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %144 + %143 = OpLabel + OpBranch %142 + %144 = OpLabel + OpBranch %134 + %142 = OpLabel + OpStore %x_118_phi %int_0 + OpBranch %145 + %145 = OpLabel + OpLoopMerge %146 %147 None + OpBranch %148 + %148 = OpLabel + %157 = OpLoad %int %x_118_phi + %158 = OpSLessThan %bool %157 %int_9 + OpSelectionMerge %159 None + OpBranchConditional %158 %160 %161 + %160 = OpLabel + OpBranch %159 + %161 = OpLabel + OpBranch %146 + %159 = OpLabel + %162 = OpIAdd %int %157 %139 + %163 = OpISub %int %162 %int_1 + %164 = OpIMul %int %int_2 %139 + %165 = OpIAdd %int %157 %164 + %168 = OpISub %int %165 %int_1 + %166 = OpExtInst %int %167 SMin %168 %int_9 + OpStore %x_130_phi %157 + OpStore %x_133_phi %162 + OpStore %x_135_phi %157 + OpBranch %169 + %169 = OpLabel + OpLoopMerge %170 %171 None + OpBranch %172 + %172 = OpLabel + %177 = OpLoad %int %x_130_phi + OpStore %x_130 %177 + %178 = OpLoad %int %x_133_phi + %179 = OpLoad %int %x_135_phi + OpStore %x_135 %179 + %180 = OpLoad %int %x_135 + %181 = OpSLessThanEqual %bool %180 %163 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %184 = OpSLessThanEqual %bool %178 %166 + OpBranch %182 + %182 = OpLabel + %185 = OpPhi %bool %181 %172 %184 %183 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + OpBranch %186 + %188 = OpLabel + OpBranch %170 + %186 = OpLabel + %189 = OpLoad %int %x_135 + %190 = OpAccessChain %_ptr_Function_int %data %189 + %191 = OpLoad %int %190 + %192 = OpAccessChain %_ptr_Function_int %data %178 + %193 = OpLoad %int %192 + %195 = OpLoad %int %x_130 + %196 = OpCopyObject %int %int_1 + %197 = OpIAdd %int %195 %196 + %194 = OpCopyObject %int %197 + %198 = OpSLessThan %bool %191 %193 + OpSelectionMerge %199 None + OpBranchConditional %198 %200 %201 + %200 = OpLabel + %203 = OpLoad %int %x_135 + %204 = OpCopyObject %int %int_1 + %205 = OpIAdd %int %203 %204 + %202 = OpCopyObject %int %205 + OpStore %x_150 %202 + %206 = OpAccessChain %_ptr_Function_int %data %189 + %207 = OpLoad %int %206 + %208 = OpLoad %int %x_130 + %209 = OpAccessChain %_ptr_Function_int %temp %208 + OpStore %209 %207 + OpStore %x_134_phi %178 + %210 = OpLoad %int %x_150 + OpStore %x_136_phi %210 + OpBranch %199 + %201 = OpLabel + %211 = OpIAdd %int %178 %int_1 + OpStore %x_153 %211 + %212 = OpAccessChain %_ptr_Function_int %data %178 + %213 = OpLoad %int %212 + %214 = OpLoad %int %x_130 + %215 = OpAccessChain %_ptr_Function_int %temp %214 + OpStore %215 %213 + %216 = OpLoad %int %x_153 + OpStore %x_134_phi %216 + %217 = OpLoad %int %x_135 + OpStore %x_136_phi %217 + OpBranch %199 + %199 = OpLabel + %218 = OpLoad %int %x_134_phi + %219 = OpLoad %int %x_136_phi + OpBranch %171 + %171 = OpLabel + OpStore %x_130_phi %194 + OpStore %x_133_phi %218 + OpStore %x_135_phi %219 + OpBranch %169 + %170 = OpLabel + %220 = OpLoad %int %x_130 + OpStore %x_157_phi %220 + %221 = OpLoad %int %x_135 + OpStore %x_160_phi %221 + OpBranch %222 + %222 = OpLabel + OpLoopMerge %223 %224 None + OpBranch %225 + %225 = OpLabel + %228 = OpLoad %int %x_157_phi + %229 = OpLoad %int %x_160_phi + %230 = OpSLessThan %bool %229 %int_10 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %231 + %232 = OpLabel + %233 = OpSLessThanEqual %bool %229 %163 + OpBranch %231 + %231 = OpLabel + %234 = OpPhi %bool %230 %225 %233 %232 + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %237 + %236 = OpLabel + OpBranch %235 + %237 = OpLabel + OpBranch %223 + %235 = OpLabel + OpBranch %224 + %224 = OpLabel + %238 = OpIAdd %int %228 %int_1 + OpStore %x_158 %238 + %239 = OpIAdd %int %229 %int_1 + OpStore %x_161 %239 + %240 = OpAccessChain %_ptr_Function_int %data %229 + %241 = OpLoad %int %240 + %242 = OpAccessChain %_ptr_Function_int %temp %228 + OpStore %242 %241 + %243 = OpLoad %int %x_158 + OpStore %x_157_phi %243 + %244 = OpLoad %int %x_161 + OpStore %x_160_phi %244 + OpBranch %222 + %223 = OpLabel + OpStore %x_170_phi %157 + OpBranch %245 + %245 = OpLabel + OpLoopMerge %246 %247 None + OpBranch %248 + %248 = OpLabel + %250 = OpLoad %int %x_170_phi + %251 = OpSLessThanEqual %bool %250 %166 + OpSelectionMerge %252 None + OpBranchConditional %251 %253 %254 + %253 = OpLabel + OpBranch %252 + %254 = OpLabel + OpBranch %246 + %252 = OpLabel + OpBranch %247 + %247 = OpLabel + %255 = OpAccessChain %_ptr_Function_int %temp %250 + %256 = OpLoad %int %255 + %257 = OpAccessChain %_ptr_Function_int %data %250 + OpStore %257 %256 + %258 = OpIAdd %int %250 %int_1 + OpStore %x_171 %258 + %259 = OpLoad %int %x_171 + OpStore %x_170_phi %259 + OpBranch %245 + %246 = OpLabel + OpBranch %147 + %147 = OpLabel + OpStore %x_118_phi %165 + OpBranch %145 + %146 = OpLabel + OpBranch %135 + %135 = OpLabel + %260 = OpIMul %int %int_2 %139 + OpStore %x_112 %260 + %261 = OpLoad %int %x_112 + OpStore %x_111_phi %261 + OpBranch %133 + %134 = OpLabel + %268 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %269 = OpLoad %float %268 + %270 = OpConvertFToS %int %269 + OpStore %x_180 %270 + %271 = OpLoad %int %x_180 + %273 = OpSLessThan %bool %271 %int_30 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %276 + %275 = OpLabel + %277 = OpAccessChain %_ptr_Function_int %data %int_0 + %278 = OpLoad %int %277 + %280 = OpConvertSToF %float %278 + %282 = OpFMul %float %280 %float_0_100000001 + %283 = OpFAdd %float %float_0_5 %282 + OpStore %x_189 %283 + %284 = OpLoad %float %x_189 + OpStore %x_262_phi %284 + OpBranch %274 + %276 = OpLabel + %288 = OpLoad %int %x_180 + %290 = OpSLessThan %bool %288 %int_60 + OpSelectionMerge %291 None + OpBranchConditional %290 %292 %293 + %292 = OpLabel + %294 = OpAccessChain %_ptr_Function_int %data %int_1 + %295 = OpLoad %int %294 + %296 = OpConvertSToF %float %295 + %297 = OpFMul %float %296 %float_0_100000001 + %298 = OpFAdd %float %float_0_5 %297 + OpStore %x_198 %298 + %299 = OpLoad %float %x_198 + OpStore %x_261_phi %299 + OpBranch %291 + %293 = OpLabel + %303 = OpLoad %int %x_180 + %305 = OpSLessThan %bool %303 %int_90 + OpSelectionMerge %306 None + OpBranchConditional %305 %307 %308 + %307 = OpLabel + %309 = OpAccessChain %_ptr_Function_int %data %int_2 + %310 = OpLoad %int %309 + %311 = OpConvertSToF %float %310 + %312 = OpFMul %float %311 %float_0_100000001 + %313 = OpFAdd %float %float_0_5 %312 + OpStore %x_207 %313 + %314 = OpLoad %float %x_207 + OpStore %x_260_phi %314 + OpBranch %306 + %308 = OpLabel + %315 = OpLoad %int %x_180 + %317 = OpSLessThan %bool %315 %int_120 + OpSelectionMerge %318 None + OpBranchConditional %317 %319 %320 + %319 = OpLabel + %321 = OpAccessChain %_ptr_Function_int %data %int_3 + %322 = OpLoad %int %321 + %323 = OpConvertSToF %float %322 + %324 = OpFMul %float %323 %float_0_100000001 + %325 = OpFAdd %float %float_0_5 %324 + OpStore %x_216 %325 + %326 = OpLoad %float %x_216 + OpStore %x_259_phi %326 + OpBranch %318 + %320 = OpLabel + %330 = OpLoad %int %x_180 + %332 = OpSLessThan %bool %330 %int_150 + OpSelectionMerge %333 None + OpBranchConditional %332 %334 %335 + %334 = OpLabel + OpKill + %335 = OpLabel + %339 = OpLoad %int %x_180 + %341 = OpSLessThan %bool %339 %int_180 + OpSelectionMerge %342 None + OpBranchConditional %341 %343 %344 + %343 = OpLabel + %346 = OpAccessChain %_ptr_Function_int %data %int_5 + %347 = OpLoad %int %346 + %348 = OpConvertSToF %float %347 + %349 = OpFMul %float %348 %float_0_100000001 + %350 = OpFAdd %float %float_0_5 %349 + OpStore %x_229 %350 + %351 = OpLoad %float %x_229 + OpStore %x_258_phi %351 + OpBranch %342 + %344 = OpLabel + %355 = OpLoad %int %x_180 + %357 = OpSLessThan %bool %355 %int_210 + OpSelectionMerge %358 None + OpBranchConditional %357 %359 %360 + %359 = OpLabel + %362 = OpAccessChain %_ptr_Function_int %data %int_6 + %363 = OpLoad %int %362 + %364 = OpConvertSToF %float %363 + %365 = OpFMul %float %364 %float_0_100000001 + %366 = OpFAdd %float %float_0_5 %365 + OpStore %x_238 %366 + %367 = OpLoad %float %x_238 + OpStore %x_257_phi %367 + OpBranch %358 + %360 = OpLabel + %368 = OpLoad %int %x_180 + %370 = OpSLessThan %bool %368 %int_240 + OpSelectionMerge %371 None + OpBranchConditional %370 %372 %373 + %372 = OpLabel + %375 = OpAccessChain %_ptr_Function_int %data %int_7 + %376 = OpLoad %int %375 + %377 = OpConvertSToF %float %376 + %378 = OpFMul %float %377 %float_0_100000001 + %379 = OpFAdd %float %float_0_5 %378 + OpStore %x_247 %379 + %380 = OpLoad %float %x_247 + OpStore %x_256_phi %380 + OpBranch %371 + %373 = OpLabel + %381 = OpLoad %int %x_180 + %383 = OpSLessThan %bool %381 %int_270 + OpSelectionMerge %384 None + OpBranchConditional %383 %385 %386 + %385 = OpLabel + OpBranch %384 + %386 = OpLabel + OpKill + %384 = OpLabel + %388 = OpAccessChain %_ptr_Function_int %data %int_8 + %389 = OpLoad %int %388 + %390 = OpConvertSToF %float %389 + %391 = OpFMul %float %390 %float_0_100000001 + %392 = OpFAdd %float %float_0_5 %391 + OpStore %x_255 %392 + %393 = OpLoad %float %x_255 + OpStore %x_256_phi %393 + OpBranch %371 + %371 = OpLabel + %394 = OpLoad %float %x_256_phi + OpStore %x_256 %394 + %395 = OpLoad %float %x_256 + OpStore %x_257_phi %395 + OpBranch %358 + %358 = OpLabel + %396 = OpLoad %float %x_257_phi + OpStore %x_257 %396 + %397 = OpLoad %float %x_257 + OpStore %x_258_phi %397 + OpBranch %342 + %342 = OpLabel + %398 = OpLoad %float %x_258_phi + OpStore %x_258 %398 + OpBranch %333 + %333 = OpLabel + %399 = OpLoad %float %x_258 + OpStore %x_259_phi %399 + OpBranch %318 + %318 = OpLabel + %400 = OpLoad %float %x_259_phi + OpStore %x_259 %400 + %401 = OpLoad %float %x_259 + OpStore %x_260_phi %401 + OpBranch %306 + %306 = OpLabel + %402 = OpLoad %float %x_260_phi + OpStore %x_260 %402 + %403 = OpLoad %float %x_260 + OpStore %x_261_phi %403 + OpBranch %291 + %291 = OpLabel + %404 = OpLoad %float %x_261_phi + OpStore %x_261 %404 + %405 = OpLoad %float %x_261 + OpStore %x_262_phi %405 + OpBranch %274 + %274 = OpLabel + %406 = OpLoad %float %x_262_phi + %408 = OpCompositeConstruct %v4float %406 %406 %406 %float_1 + OpStore %x_GLF_color %408 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %409 +%tint_symbol_1 = OpFunctionParameter %main_out + %413 = OpLabel + %414 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %414 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %416 = OpLabel + %417 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %417 + %418 = OpFunctionCall %void %main_1 + %420 = OpLoad %v4float %x_GLF_color + %421 = OpCompositeConstruct %main_out %420 + %419 = OpFunctionCall %void %tint_symbol_3 %421 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 44[%44] is not post dominated by the back-edge block 115[%115] + %115 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.wgsl new file mode 100644 index 0000000000..0d0b64bf8e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-O-prop-up-mutate-var/2.wgsl.expected.wgsl @@ -0,0 +1,338 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var temp : array; + var data : array; + var x_189 : f32; + var x_261 : f32; + var x_63_phi : i32; + var x_102_phi : i32; + var x_111_phi : i32; + var x_262_phi : f32; + let x_60 : f32 = x_8.injectionSwitch.x; + let x_61 : i32 = i32(x_60); + x_63_phi = x_61; + loop { + var x_99 : i32; + var x_97 : i32; + var x_95 : i32; + var x_93 : i32; + var x_91 : i32; + var x_89 : i32; + var x_87 : i32; + var x_85 : i32; + var x_83 : i32; + var x_81 : i32; + var x_64_phi : i32; + let x_63 : i32 = x_63_phi; + let x_68 : i32 = (x_63 + 1); + x_64_phi = x_68; + switch(x_63) { + case 9: { + data[x_63] = -5; + x_99 = (x_63 + 1); + x_64_phi = x_99; + } + case 8: { + data[x_63] = -4; + x_97 = (x_63 + 1); + x_64_phi = x_97; + } + case 7: { + data[x_63] = -3; + x_95 = (x_63 + 1); + x_64_phi = x_95; + } + case 6: { + data[x_63] = -2; + x_93 = (x_63 + 1); + x_64_phi = x_93; + } + case 5: { + data[x_63] = -1; + x_91 = (x_63 + 1); + x_64_phi = x_91; + } + case 4: { + data[x_63] = 0; + x_89 = (x_63 + 1); + x_64_phi = x_89; + } + case 3: { + data[x_63] = 1; + x_87 = (x_63 + 1); + x_64_phi = x_87; + } + case 2: { + data[x_63] = 2; + x_85 = (x_63 + 1); + x_64_phi = x_85; + } + case 1: { + data[x_63] = 3; + x_83 = (x_63 + 1); + x_64_phi = x_83; + } + case 0: { + data[x_63] = 4; + x_81 = (x_63 + 1); + x_64_phi = x_81; + } + default: { + } + } + let x_64 : i32 = x_64_phi; + + continuing { + x_63_phi = x_64; + if ((x_64 < 10)) { + } else { + break; + } + } + } + x_102_phi = 0; + loop { + var x_103 : i32; + let x_102 : i32 = x_102_phi; + if ((x_102 < 10)) { + } else { + break; + } + + continuing { + let x_108 : i32 = data[x_102]; + temp[x_102] = x_108; + x_103 = (x_102 + 1); + x_102_phi = x_103; + } + } + x_111_phi = 1; + loop { + var x_112 : i32; + var x_118_phi : i32; + let x_111 : i32 = x_111_phi; + if ((x_111 <= 9)) { + } else { + break; + } + x_118_phi = 0; + loop { + var x_130 : i32; + var x_135 : i32; + var x_130_phi : i32; + var x_133_phi : i32; + var x_135_phi : i32; + var x_157_phi : i32; + var x_160_phi : i32; + var x_170_phi : i32; + let x_118 : i32 = x_118_phi; + if ((x_118 < 9)) { + } else { + break; + } + let x_124 : i32 = (x_118 + x_111); + let x_125 : i32 = (x_124 - 1); + let x_119 : i32 = (x_118 + (2 * x_111)); + let x_128 : i32 = min((x_119 - 1), 9); + x_130_phi = x_118; + x_133_phi = x_124; + x_135_phi = x_118; + loop { + var x_150 : i32; + var x_153 : i32; + var x_134_phi : i32; + var x_136_phi : i32; + x_130 = x_130_phi; + let x_133 : i32 = x_133_phi; + x_135 = x_135_phi; + if (((x_135 <= x_125) && (x_133 <= x_128))) { + } else { + break; + } + let x_142 : ptr = &(data[x_135]); + let x_143 : i32 = *(x_142); + let x_144 : ptr = &(data[x_133]); + let x_145 : i32 = *(x_144); + let x_131 : i32 = bitcast((x_130 + bitcast(1))); + if ((x_143 < x_145)) { + x_150 = bitcast((x_135 + bitcast(1))); + let x_151 : i32 = *(x_142); + temp[x_130] = x_151; + x_134_phi = x_133; + x_136_phi = x_150; + } else { + x_153 = (x_133 + 1); + let x_154 : i32 = *(x_144); + temp[x_130] = x_154; + x_134_phi = x_153; + x_136_phi = x_135; + } + let x_134 : i32 = x_134_phi; + let x_136 : i32 = x_136_phi; + + continuing { + x_130_phi = x_131; + x_133_phi = x_134; + x_135_phi = x_136; + } + } + x_157_phi = x_130; + x_160_phi = x_135; + loop { + var x_158 : i32; + var x_161 : i32; + let x_157 : i32 = x_157_phi; + let x_160 : i32 = x_160_phi; + if (((x_160 < 10) && (x_160 <= x_125))) { + } else { + break; + } + + continuing { + x_158 = (x_157 + 1); + x_161 = (x_160 + 1); + let x_167 : i32 = data[x_160]; + temp[x_157] = x_167; + x_157_phi = x_158; + x_160_phi = x_161; + } + } + x_170_phi = x_118; + loop { + var x_171 : i32; + let x_170 : i32 = x_170_phi; + if ((x_170 <= x_128)) { + } else { + break; + } + + continuing { + let x_176 : i32 = temp[x_170]; + data[x_170] = x_176; + x_171 = (x_170 + 1); + x_170_phi = x_171; + } + } + + continuing { + x_118_phi = x_119; + } + } + + continuing { + x_112 = (2 * x_111); + x_111_phi = x_112; + } + } + var x_180 : i32; + var x_198 : f32; + var x_260 : f32; + var x_261_phi : f32; + let x_179 : f32 = gl_FragCoord.y; + x_180 = i32(x_179); + if ((x_180 < 30)) { + let x_186 : i32 = data[0]; + x_189 = (0.5 + (f32(x_186) * 0.100000001)); + x_262_phi = x_189; + } else { + var x_207 : f32; + var x_259 : f32; + var x_260_phi : f32; + if ((x_180 < 60)) { + let x_195 : i32 = data[1]; + x_198 = (0.5 + (f32(x_195) * 0.100000001)); + x_261_phi = x_198; + } else { + var x_216 : f32; + var x_258 : f32; + var x_259_phi : f32; + if ((x_180 < 90)) { + let x_204 : i32 = data[2]; + x_207 = (0.5 + (f32(x_204) * 0.100000001)); + x_260_phi = x_207; + } else { + if ((x_180 < 120)) { + let x_213 : i32 = data[3]; + x_216 = (0.5 + (f32(x_213) * 0.100000001)); + x_259_phi = x_216; + } else { + var x_229 : f32; + var x_257 : f32; + var x_258_phi : f32; + if ((x_180 < 150)) { + discard; + } else { + var x_238 : f32; + var x_256 : f32; + var x_257_phi : f32; + if ((x_180 < 180)) { + let x_226 : i32 = data[5]; + x_229 = (0.5 + (f32(x_226) * 0.100000001)); + x_258_phi = x_229; + } else { + var x_247 : f32; + var x_255 : f32; + var x_256_phi : f32; + if ((x_180 < 210)) { + let x_235 : i32 = data[6]; + x_238 = (0.5 + (f32(x_235) * 0.100000001)); + x_257_phi = x_238; + } else { + if ((x_180 < 240)) { + let x_244 : i32 = data[7]; + x_247 = (0.5 + (f32(x_244) * 0.100000001)); + x_256_phi = x_247; + } else { + if ((x_180 < 270)) { + } else { + discard; + } + let x_252 : i32 = data[8]; + x_255 = (0.5 + (f32(x_252) * 0.100000001)); + x_256_phi = x_255; + } + x_256 = x_256_phi; + x_257_phi = x_256; + } + x_257 = x_257_phi; + x_258_phi = x_257; + } + x_258 = x_258_phi; + } + x_259_phi = x_258; + } + x_259 = x_259_phi; + x_260_phi = x_259; + } + x_260 = x_260_phi; + x_261_phi = x_260; + } + x_261 = x_261_phi; + x_262_phi = x_261; + } + let x_262 : f32 = x_262_phi; + x_GLF_color = vec4(x_262, x_262, x_262, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm new file mode 100644 index 0000000000..7e89166e63 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm @@ -0,0 +1,555 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %merge_i1_i1_i1_ "merge(i1;i1;i1;" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %mergeSort_ "mergeSort(" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %temp "temp" + OpName %i_0 "i" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_1 "i" + OpName %from_0 "from" + OpName %mid_0 "mid" + OpName %to_0 "to" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %i_2 "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %j_0 "j" + OpName %gl_FragCoord "gl_FragCoord" + OpName %grey "grey" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %32 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private + %int_10 = OpConstant %int 10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int_30 = OpConstant %int 30 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %32 + %82 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %grey = OpVariable %_ptr_Function_float Function + %83 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %84 = OpLoad %float %83 + %85 = OpConvertFToS %int %84 + OpStore %i_2 %85 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %87 %88 None + OpBranch %89 + %89 = OpLabel + %90 = OpLoad %int %i_2 + OpSelectionMerge %91 None + OpSwitch %90 %91 0 %92 1 %93 2 %94 3 %95 4 %96 5 %97 6 %98 7 %99 8 %100 9 %101 + %92 = OpLabel + %102 = OpLoad %int %i_2 + %103 = OpAccessChain %_ptr_Private_int %data %102 + OpStore %103 %int_4 + OpBranch %91 + %93 = OpLabel + %104 = OpLoad %int %i_2 + %105 = OpAccessChain %_ptr_Private_int %data %104 + OpStore %105 %int_3 + OpBranch %91 + %94 = OpLabel + %106 = OpLoad %int %i_2 + %107 = OpAccessChain %_ptr_Private_int %data %106 + OpStore %107 %int_2 + OpBranch %91 + %95 = OpLabel + %108 = OpLoad %int %i_2 + %109 = OpAccessChain %_ptr_Private_int %data %108 + OpStore %109 %int_1 + OpBranch %91 + %96 = OpLabel + %110 = OpLoad %int %i_2 + %111 = OpAccessChain %_ptr_Private_int %data %110 + OpStore %111 %int_0 + OpBranch %91 + %97 = OpLabel + %112 = OpLoad %int %i_2 + %113 = OpAccessChain %_ptr_Private_int %data %112 + OpStore %113 %int_n1 + OpBranch %91 + %98 = OpLabel + %114 = OpLoad %int %i_2 + %115 = OpAccessChain %_ptr_Private_int %data %114 + OpStore %115 %int_n2 + OpBranch %91 + %99 = OpLabel + %116 = OpLoad %int %i_2 + %117 = OpAccessChain %_ptr_Private_int %data %116 + OpStore %117 %int_n3 + OpBranch %91 + %100 = OpLabel + %118 = OpLoad %int %i_2 + %119 = OpAccessChain %_ptr_Private_int %data %118 + OpStore %119 %int_n4 + OpBranch %91 + %101 = OpLabel + %120 = OpLoad %int %i_2 + %121 = OpAccessChain %_ptr_Private_int %data %120 + OpStore %121 %int_n5 + OpBranch %91 + %91 = OpLabel + %122 = OpLoad %int %i_2 + %123 = OpIAdd %int %122 %int_1 + OpStore %i_2 %123 + OpBranch %88 + %88 = OpLabel + %124 = OpLoad %int %i_2 + %125 = OpSLessThan %bool %124 %int_10 + OpBranchConditional %125 %86 %87 + %87 = OpLabel + OpStore %j_0 %int_0 + OpBranch %126 + %126 = OpLabel + OpLoopMerge %127 %128 None + OpBranch %129 + %129 = OpLabel + %130 = OpLoad %int %j_0 + %131 = OpSLessThan %bool %130 %int_10 + OpBranchConditional %131 %132 %127 + %132 = OpLabel + %133 = OpLoad %int %j_0 + %134 = OpLoad %int %j_0 + %135 = OpAccessChain %_ptr_Private_int %data %134 + %136 = OpLoad %int %135 + %137 = OpAccessChain %_ptr_Private_int %temp %133 + OpStore %137 %136 + OpBranch %128 + %128 = OpLabel + %138 = OpLoad %int %j_0 + %139 = OpIAdd %int %138 %int_1 + OpStore %j_0 %139 + OpBranch %126 + %127 = OpLabel + %140 = OpFunctionCall %void %mergeSort_ + %141 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %142 = OpLoad %float %141 + %143 = OpConvertFToS %int %142 + %144 = OpSLessThan %bool %143 %int_30 + OpSelectionMerge %145 None + OpBranchConditional %144 %146 %147 + %146 = OpLabel + %148 = OpAccessChain %_ptr_Private_int %data %int_0 + %149 = OpLoad %int %148 + %150 = OpConvertSToF %float %149 + %151 = OpFDiv %float %150 %float_10 + %152 = OpFAdd %float %float_0_5 %151 + OpStore %grey %152 + OpBranch %145 + %147 = OpLabel + %153 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %154 = OpLoad %float %153 + %155 = OpConvertFToS %int %154 + %156 = OpSLessThan %bool %155 %int_60 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %159 + %158 = OpLabel + %160 = OpAccessChain %_ptr_Private_int %data %int_1 + %161 = OpLoad %int %160 + %162 = OpConvertSToF %float %161 + %163 = OpFDiv %float %162 %float_10 + %164 = OpFAdd %float %float_0_5 %163 + OpStore %grey %164 + OpBranch %157 + %159 = OpLabel + %165 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %166 = OpLoad %float %165 + %167 = OpConvertFToS %int %166 + %168 = OpSLessThan %bool %167 %int_90 + OpSelectionMerge %169 None + OpBranchConditional %168 %170 %171 + %170 = OpLabel + %172 = OpAccessChain %_ptr_Private_int %data %int_2 + %173 = OpLoad %int %172 + %174 = OpConvertSToF %float %173 + %175 = OpFDiv %float %174 %float_10 + %176 = OpFAdd %float %float_0_5 %175 + OpStore %grey %176 + OpBranch %169 + %171 = OpLabel + %177 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %178 = OpLoad %float %177 + %179 = OpConvertFToS %int %178 + %180 = OpSLessThan %bool %179 %int_120 + OpSelectionMerge %181 None + OpBranchConditional %180 %182 %183 + %182 = OpLabel + %184 = OpAccessChain %_ptr_Private_int %data %int_3 + %185 = OpLoad %int %184 + %186 = OpConvertSToF %float %185 + %187 = OpFDiv %float %186 %float_10 + %188 = OpFAdd %float %float_0_5 %187 + OpStore %grey %188 + OpBranch %181 + %183 = OpLabel + %189 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %190 = OpLoad %float %189 + %191 = OpConvertFToS %int %190 + %192 = OpSLessThan %bool %191 %int_150 + OpSelectionMerge %193 None + OpBranchConditional %192 %194 %195 + %194 = OpLabel + OpKill + %195 = OpLabel + %196 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %197 = OpLoad %float %196 + %198 = OpConvertFToS %int %197 + %199 = OpSLessThan %bool %198 %int_180 + OpSelectionMerge %200 None + OpBranchConditional %199 %201 %202 + %201 = OpLabel + %203 = OpAccessChain %_ptr_Private_int %data %int_5 + %204 = OpLoad %int %203 + %205 = OpConvertSToF %float %204 + %206 = OpFDiv %float %205 %float_10 + %207 = OpFAdd %float %float_0_5 %206 + OpStore %grey %207 + OpBranch %200 + %202 = OpLabel + %208 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %209 = OpLoad %float %208 + %210 = OpConvertFToS %int %209 + %211 = OpSLessThan %bool %210 %int_210 + OpSelectionMerge %212 None + OpBranchConditional %211 %213 %214 + %213 = OpLabel + %215 = OpAccessChain %_ptr_Private_int %data %int_6 + %216 = OpLoad %int %215 + %217 = OpConvertSToF %float %216 + %218 = OpFDiv %float %217 %float_10 + %219 = OpFAdd %float %float_0_5 %218 + OpStore %grey %219 + OpBranch %212 + %214 = OpLabel + %220 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %221 = OpLoad %float %220 + %222 = OpConvertFToS %int %221 + %223 = OpSLessThan %bool %222 %int_240 + OpSelectionMerge %224 None + OpBranchConditional %223 %225 %226 + %225 = OpLabel + %227 = OpAccessChain %_ptr_Private_int %data %int_7 + %228 = OpLoad %int %227 + %229 = OpConvertSToF %float %228 + %230 = OpFDiv %float %229 %float_10 + %231 = OpFAdd %float %float_0_5 %230 + OpStore %grey %231 + OpBranch %224 + %226 = OpLabel + %232 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %233 = OpLoad %float %232 + %234 = OpConvertFToS %int %233 + %235 = OpSLessThan %bool %234 %int_270 + OpSelectionMerge %236 None + OpBranchConditional %235 %237 %238 + %237 = OpLabel + %239 = OpAccessChain %_ptr_Private_int %data %int_8 + %240 = OpLoad %int %239 + %241 = OpConvertSToF %float %240 + %242 = OpFDiv %float %241 %float_10 + %243 = OpFAdd %float %float_0_5 %242 + OpStore %grey %243 + OpBranch %236 + %238 = OpLabel + OpKill + %236 = OpLabel + OpBranch %224 + %224 = OpLabel + OpBranch %212 + %212 = OpLabel + OpBranch %200 + %200 = OpLabel + OpBranch %193 + %193 = OpLabel + OpBranch %181 + %181 = OpLabel + OpBranch %169 + %169 = OpLabel + OpBranch %157 + %157 = OpLabel + OpBranch %145 + %145 = OpLabel + %244 = OpLoad %float %grey + %245 = OpCompositeConstruct %v3float %244 %244 %244 + %246 = OpCompositeExtract %float %245 0 + %247 = OpCompositeExtract %float %245 1 + %248 = OpCompositeExtract %float %245 2 + %249 = OpCompositeConstruct %v4float %246 %247 %248 %float_1 + OpStore %_GLF_color %249 + OpReturn + OpFunctionEnd +%merge_i1_i1_i1_ = OpFunction %void None %35 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %250 = OpLabel + %k = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %251 = OpLoad %int %from + OpStore %k %251 + %252 = OpLoad %int %from + OpStore %i %252 + %253 = OpLoad %int %mid + %254 = OpIAdd %int %253 %int_1 + OpStore %j %254 + OpBranch %255 + %255 = OpLabel + OpLoopMerge %256 %257 None + OpBranch %258 + %258 = OpLabel + %259 = OpLoad %int %i + %260 = OpLoad %int %mid + %261 = OpSLessThanEqual %bool %259 %260 + %262 = OpLoad %int %j + %263 = OpLoad %int %to + %264 = OpSLessThanEqual %bool %262 %263 + %265 = OpLogicalAnd %bool %261 %264 + OpBranchConditional %265 %266 %256 + %266 = OpLabel + %267 = OpLoad %int %i + %268 = OpAccessChain %_ptr_Private_int %data %267 + %269 = OpLoad %int %268 + %270 = OpLoad %int %j + %271 = OpAccessChain %_ptr_Private_int %data %270 + %272 = OpLoad %int %271 + %273 = OpSLessThan %bool %269 %272 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %276 + %275 = OpLabel + %277 = OpLoad %int %k + %278 = OpIAdd %int %277 %int_1 + OpStore %k %278 + %279 = OpLoad %int %i + %280 = OpIAdd %int %279 %int_1 + OpStore %i %280 + %281 = OpAccessChain %_ptr_Private_int %data %279 + %282 = OpLoad %int %281 + %283 = OpAccessChain %_ptr_Private_int %temp %277 + OpStore %283 %282 + OpBranch %274 + %276 = OpLabel + %284 = OpLoad %int %k + %285 = OpIAdd %int %284 %int_1 + OpStore %k %285 + %286 = OpLoad %int %j + %287 = OpIAdd %int %286 %int_1 + OpStore %j %287 + %288 = OpAccessChain %_ptr_Private_int %data %286 + %289 = OpLoad %int %288 + %290 = OpAccessChain %_ptr_Private_int %temp %284 + OpStore %290 %289 + OpBranch %274 + %274 = OpLabel + OpBranch %257 + %257 = OpLabel + OpBranch %255 + %256 = OpLabel + OpBranch %291 + %291 = OpLabel + OpLoopMerge %292 %293 None + OpBranch %294 + %294 = OpLabel + %295 = OpLoad %int %i + %296 = OpSLessThan %bool %295 %int_10 + %297 = OpLoad %int %i + %298 = OpLoad %int %mid + %299 = OpSLessThanEqual %bool %297 %298 + %300 = OpLogicalAnd %bool %296 %299 + OpBranchConditional %300 %301 %292 + %301 = OpLabel + %302 = OpLoad %int %k + %303 = OpIAdd %int %302 %int_1 + OpStore %k %303 + %304 = OpLoad %int %i + %305 = OpIAdd %int %304 %int_1 + OpStore %i %305 + %306 = OpAccessChain %_ptr_Private_int %data %304 + %307 = OpLoad %int %306 + %308 = OpAccessChain %_ptr_Private_int %temp %302 + OpStore %308 %307 + OpBranch %293 + %293 = OpLabel + OpBranch %291 + %292 = OpLabel + %309 = OpLoad %int %from + OpStore %i_0 %309 + OpBranch %310 + %310 = OpLabel + OpLoopMerge %311 %312 None + OpBranch %313 + %313 = OpLabel + %314 = OpLoad %int %i_0 + %315 = OpLoad %int %to + %316 = OpSLessThanEqual %bool %314 %315 + OpBranchConditional %316 %317 %311 + %317 = OpLabel + %318 = OpLoad %int %i_0 + %319 = OpLoad %int %i_0 + %320 = OpAccessChain %_ptr_Private_int %temp %319 + %321 = OpLoad %int %320 + %322 = OpAccessChain %_ptr_Private_int %data %318 + OpStore %322 %321 + OpBranch %312 + %312 = OpLabel + %323 = OpLoad %int %i_0 + %324 = OpIAdd %int %323 %int_1 + OpStore %i_0 %324 + OpBranch %310 + %311 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %32 + %325 = OpLabel + %low = OpVariable %_ptr_Function_int Function + %high = OpVariable %_ptr_Function_int Function + %m = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %from_0 = OpVariable %_ptr_Function_int Function + %mid_0 = OpVariable %_ptr_Function_int Function + %to_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %326 + %326 = OpLabel + OpLoopMerge %327 %328 None + OpBranch %329 + %329 = OpLabel + %330 = OpLoad %int %m + %331 = OpLoad %int %high + %332 = OpSLessThanEqual %bool %330 %331 + OpBranchConditional %332 %333 %327 + %333 = OpLabel + %334 = OpLoad %int %low + OpStore %i_1 %334 + OpBranch %335 + %335 = OpLabel + OpLoopMerge %336 %337 None + OpBranch %338 + %338 = OpLabel + %339 = OpLoad %int %i_1 + %340 = OpLoad %int %high + %341 = OpSLessThan %bool %339 %340 + OpBranchConditional %341 %342 %336 + %342 = OpLabel + %343 = OpLoad %int %i_1 + OpStore %from_0 %343 + %344 = OpLoad %int %i_1 + %345 = OpLoad %int %m + %346 = OpIAdd %int %344 %345 + %347 = OpISub %int %346 %int_1 + OpStore %mid_0 %347 + %348 = OpLoad %int %i_1 + %349 = OpLoad %int %m + %350 = OpIMul %int %int_2 %349 + %351 = OpIAdd %int %348 %350 + %352 = OpISub %int %351 %int_1 + %353 = OpLoad %int %high + %354 = OpExtInst %int %1 SMin %352 %353 + OpStore %to_0 %354 + %355 = OpLoad %int %from_0 + OpStore %param %355 + %356 = OpLoad %int %mid_0 + OpStore %param_0 %356 + %357 = OpLoad %int %to_0 + OpStore %param_1 %357 + %358 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_0 %param_1 + OpBranch %337 + %337 = OpLabel + %359 = OpLoad %int %m + %360 = OpIMul %int %int_2 %359 + %361 = OpLoad %int %i_1 + %362 = OpIAdd %int %361 %360 + OpStore %i_1 %362 + OpBranch %335 + %336 = OpLabel + OpBranch %328 + %328 = OpLabel + %363 = OpLoad %int %m + %364 = OpIMul %int %int_2 %363 + OpStore %m %364 + OpBranch %326 + %327 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..6a30ba44d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.hlsl @@ -0,0 +1,268 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_251 = from; + k = x_251; + const int x_252 = from; + i = x_252; + const int x_253 = mid; + j = (x_253 + 1); + while (true) { + const int x_259 = i; + const int x_260 = mid; + const int x_262 = j; + const int x_263 = to; + bool tint_tmp = (x_259 <= x_260); + if (tint_tmp) { + tint_tmp = (x_262 <= x_263); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_269 = data[i]; + const int x_272 = data[j]; + if ((x_269 < x_272)) { + const int x_277 = k; + k = (x_277 + 1); + const int x_279 = i; + i = (x_279 + 1); + const int x_282 = data[x_279]; + temp[x_277] = x_282; + } else { + const int x_284 = k; + k = (x_284 + 1); + const int x_286 = j; + j = (x_286 + 1); + const int x_289 = data[x_286]; + temp[x_284] = x_289; + } + } + while (true) { + const int x_295 = i; + const int x_297 = i; + const int x_298 = mid; + bool tint_tmp_1 = (x_295 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_297 <= x_298); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_302 = k; + k = (x_302 + 1); + const int x_304 = i; + i = (x_304 + 1); + const int x_307 = data[x_304]; + temp[x_302] = x_307; + } + const int x_309 = from; + i_1 = x_309; + while (true) { + const int x_314 = i_1; + const int x_315 = to; + if ((x_314 <= x_315)) { + } else { + break; + } + const int x_318 = i_1; + const int x_321 = temp[i_1]; + data[x_318] = x_321; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_84 = asfloat(x_28[0].x); + i_3 = int(x_84); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_133 = j_1; + const int x_136 = data[j_1]; + temp[x_133] = x_136; + } + } + mergeSort_(); + const float x_142 = gl_FragCoord.y; + if ((int(x_142) < 30)) { + const int x_149 = data[0]; + grey = (0.5f + (float(x_149) / 10.0f)); + } else { + const float x_154 = gl_FragCoord.y; + if ((int(x_154) < 60)) { + const int x_161 = data[1]; + grey = (0.5f + (float(x_161) / 10.0f)); + } else { + const float x_166 = gl_FragCoord.y; + if ((int(x_166) < 90)) { + const int x_173 = data[2]; + grey = (0.5f + (float(x_173) / 10.0f)); + } else { + const float x_178 = gl_FragCoord.y; + if ((int(x_178) < 120)) { + const int x_185 = data[3]; + grey = (0.5f + (float(x_185) / 10.0f)); + } else { + const float x_190 = gl_FragCoord.y; + if ((int(x_190) < 150)) { + discard; + } else { + const float x_197 = gl_FragCoord.y; + if ((int(x_197) < 180)) { + const int x_204 = data[5]; + grey = (0.5f + (float(x_204) / 10.0f)); + } else { + const float x_209 = gl_FragCoord.y; + if ((int(x_209) < 210)) { + const int x_216 = data[6]; + grey = (0.5f + (float(x_216) / 10.0f)); + } else { + const float x_221 = gl_FragCoord.y; + if ((int(x_221) < 240)) { + const int x_228 = data[7]; + grey = (0.5f + (float(x_228) / 10.0f)); + } else { + const float x_233 = gl_FragCoord.y; + if ((int(x_233) < 270)) { + const int x_240 = data[8]; + grey = (0.5f + (float(x_240) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_244 = grey; + const float3 x_245 = float3(x_244, x_244, x_244); + x_GLF_color = float4(x_245.x, x_245.y, x_245.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.msl new file mode 100644 index 0000000000..6340b475e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.msl @@ -0,0 +1,314 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_251 = *(from); + k = x_251; + int const x_252 = *(from); + i = x_252; + int const x_253 = *(mid); + j = (x_253 + 1); + while (true) { + int const x_259 = i; + int const x_260 = *(mid); + int const x_262 = j; + int const x_263 = *(to); + if (((x_259 <= x_260) && (x_262 <= x_263))) { + } else { + break; + } + int const x_267 = i; + int const x_269 = (*(tint_symbol_5)).arr[x_267]; + int const x_270 = j; + int const x_272 = (*(tint_symbol_5)).arr[x_270]; + if ((x_269 < x_272)) { + int const x_277 = k; + k = (x_277 + 1); + int const x_279 = i; + i = (x_279 + 1); + int const x_282 = (*(tint_symbol_5)).arr[x_279]; + (*(tint_symbol_6)).arr[x_277] = x_282; + } else { + int const x_284 = k; + k = (x_284 + 1); + int const x_286 = j; + j = (x_286 + 1); + int const x_289 = (*(tint_symbol_5)).arr[x_286]; + (*(tint_symbol_6)).arr[x_284] = x_289; + } + } + while (true) { + int const x_295 = i; + int const x_297 = i; + int const x_298 = *(mid); + if (((x_295 < 10) && (x_297 <= x_298))) { + } else { + break; + } + int const x_302 = k; + k = (x_302 + 1); + int const x_304 = i; + i = (x_304 + 1); + int const x_307 = (*(tint_symbol_5)).arr[x_304]; + (*(tint_symbol_6)).arr[x_302] = x_307; + } + int const x_309 = *(from); + i_1 = x_309; + while (true) { + int const x_314 = i_1; + int const x_315 = *(to); + if ((x_314 <= x_315)) { + } else { + break; + } + int const x_318 = i_1; + int const x_319 = i_1; + int const x_321 = (*(tint_symbol_6)).arr[x_319]; + (*(tint_symbol_5)).arr[x_318] = x_321; + { + int const x_323 = i_1; + i_1 = (x_323 + 1); + } + } + return; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_330 = m; + int const x_331 = high; + if ((x_330 <= x_331)) { + } else { + break; + } + int const x_334 = low; + i_2 = x_334; + while (true) { + int const x_339 = i_2; + int const x_340 = high; + if ((x_339 < x_340)) { + } else { + break; + } + int const x_343 = i_2; + from_1 = x_343; + int const x_344 = i_2; + int const x_345 = m; + mid_1 = ((x_344 + x_345) - 1); + int const x_348 = i_2; + int const x_349 = m; + int const x_353 = high; + to_1 = min(((x_348 + (2 * x_349)) - 1), x_353); + int const x_355 = from_1; + param = x_355; + int const x_356 = mid_1; + param_1 = x_356; + int const x_357 = to_1; + param_2 = x_357; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_359 = m; + int const x_361 = i_2; + i_2 = (x_361 + (2 * x_359)); + } + } + { + int const x_363 = m; + m = (2 * x_363); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_84 = x_28.injectionSwitch.x; + i_3 = int(x_84); + while (true) { + int const x_90 = i_3; + switch(x_90) { + case 9: { + int const x_120 = i_3; + (*(tint_symbol_9)).arr[x_120] = -5; + break; + } + case 8: { + int const x_118 = i_3; + (*(tint_symbol_9)).arr[x_118] = -4; + break; + } + case 7: { + int const x_116 = i_3; + (*(tint_symbol_9)).arr[x_116] = -3; + break; + } + case 6: { + int const x_114 = i_3; + (*(tint_symbol_9)).arr[x_114] = -2; + break; + } + case 5: { + int const x_112 = i_3; + (*(tint_symbol_9)).arr[x_112] = -1; + break; + } + case 4: { + int const x_110 = i_3; + (*(tint_symbol_9)).arr[x_110] = 0; + break; + } + case 3: { + int const x_108 = i_3; + (*(tint_symbol_9)).arr[x_108] = 1; + break; + } + case 2: { + int const x_106 = i_3; + (*(tint_symbol_9)).arr[x_106] = 2; + break; + } + case 1: { + int const x_104 = i_3; + (*(tint_symbol_9)).arr[x_104] = 3; + break; + } + case 0: { + int const x_102 = i_3; + (*(tint_symbol_9)).arr[x_102] = 4; + break; + } + default: { + break; + } + } + int const x_122 = i_3; + i_3 = (x_122 + 1); + { + int const x_124 = i_3; + if ((x_124 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_130 = j_1; + if ((x_130 < 10)) { + } else { + break; + } + int const x_133 = j_1; + int const x_134 = j_1; + int const x_136 = (*(tint_symbol_9)).arr[x_134]; + (*(tint_symbol_10)).arr[x_133] = x_136; + { + int const x_138 = j_1; + j_1 = (x_138 + 1); + } + } + mergeSort_(tint_symbol_9, tint_symbol_10); + float const x_142 = (*(tint_symbol_11)).y; + if ((int(x_142) < 30)) { + int const x_149 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_149) / 10.0f)); + } else { + float const x_154 = (*(tint_symbol_11)).y; + if ((int(x_154) < 60)) { + int const x_161 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_161) / 10.0f)); + } else { + float const x_166 = (*(tint_symbol_11)).y; + if ((int(x_166) < 90)) { + int const x_173 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_173) / 10.0f)); + } else { + float const x_178 = (*(tint_symbol_11)).y; + if ((int(x_178) < 120)) { + int const x_185 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_185) / 10.0f)); + } else { + float const x_190 = (*(tint_symbol_11)).y; + if ((int(x_190) < 150)) { + discard_fragment(); + } else { + float const x_197 = (*(tint_symbol_11)).y; + if ((int(x_197) < 180)) { + int const x_204 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_204) / 10.0f)); + } else { + float const x_209 = (*(tint_symbol_11)).y; + if ((int(x_209) < 210)) { + int const x_216 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_216) / 10.0f)); + } else { + float const x_221 = (*(tint_symbol_11)).y; + if ((int(x_221) < 240)) { + int const x_228 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_228) / 10.0f)); + } else { + float const x_233 = (*(tint_symbol_11)).y; + if ((int(x_233) < 270)) { + int const x_240 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_240) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_244 = grey; + float3 const x_245 = float3(x_244, x_244, x_244); + *(tint_symbol_12) = float4(x_245.x, x_245.y, x_245.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..4df39a6a63 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.spvasm @@ -0,0 +1,649 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 416 +; Schema: 0 + OpCapability Shader + %177 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %132 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %201 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %403 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpLoad %int %mid + %51 = OpLoad %int %j + %53 = OpLoad %int %to + %54 = OpSLessThanEqual %bool %48 %50 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %58 = OpSLessThanEqual %bool %51 %53 + OpBranch %56 + %56 = OpLabel + %59 = OpPhi %bool %54 %47 %58 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %45 + %60 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Private_int %data %63 + %66 = OpLoad %int %65 + %67 = OpLoad %int %j + %68 = OpAccessChain %_ptr_Private_int %data %67 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %k + %75 = OpIAdd %int %74 %int_1 + OpStore %k %75 + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + %78 = OpAccessChain %_ptr_Private_int %data %76 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Private_int %temp %74 + OpStore %80 %79 + OpBranch %71 + %73 = OpLabel + %81 = OpLoad %int %k + %82 = OpIAdd %int %81 %int_1 + OpStore %k %82 + %83 = OpLoad %int %j + %84 = OpIAdd %int %83 %int_1 + OpStore %j %84 + %85 = OpAccessChain %_ptr_Private_int %data %83 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Private_int %temp %81 + OpStore %87 %86 + OpBranch %71 + %71 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpLoad %int %i + %95 = OpLoad %int %mid + %97 = OpSLessThan %bool %92 %int_10 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSLessThanEqual %bool %93 %95 + OpBranch %98 + %98 = OpLabel + %101 = OpPhi %bool %97 %91 %100 %99 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpBranch %102 + %104 = OpLabel + OpBranch %89 + %102 = OpLabel + %105 = OpLoad %int %k + %106 = OpIAdd %int %105 %int_1 + OpStore %k %106 + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + %109 = OpAccessChain %_ptr_Private_int %data %107 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Private_int %temp %105 + OpStore %111 %110 + OpBranch %90 + %90 = OpLabel + OpBranch %88 + %89 = OpLabel + %113 = OpLoad %int %from + OpStore %i_1 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpLoad %int %to + %121 = OpSLessThanEqual %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + OpBranch %122 + %124 = OpLabel + OpBranch %115 + %122 = OpLabel + %125 = OpLoad %int %i_1 + %126 = OpLoad %int %i_1 + %127 = OpAccessChain %_ptr_Private_int %temp %126 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %129 %128 + OpBranch %116 + %116 = OpLabel + %130 = OpLoad %int %i_1 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_1 %131 + OpBranch %114 + %115 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %132 + %134 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %151 = OpLoad %int %m + %152 = OpLoad %int %high + %153 = OpSLessThanEqual %bool %151 %152 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + OpBranch %154 + %156 = OpLabel + OpBranch %148 + %154 = OpLabel + %157 = OpLoad %int %low + OpStore %i_2 %157 + OpBranch %158 + %158 = OpLabel + OpLoopMerge %159 %160 None + OpBranch %161 + %161 = OpLabel + %162 = OpLoad %int %i_2 + %163 = OpLoad %int %high + %164 = OpSLessThan %bool %162 %163 + OpSelectionMerge %165 None + OpBranchConditional %164 %166 %167 + %166 = OpLabel + OpBranch %165 + %167 = OpLabel + OpBranch %159 + %165 = OpLabel + %168 = OpLoad %int %i_2 + OpStore %from_1 %168 + %169 = OpLoad %int %i_2 + %170 = OpLoad %int %m + %171 = OpIAdd %int %169 %170 + %172 = OpISub %int %171 %int_1 + OpStore %mid_1 %172 + %173 = OpLoad %int %i_2 + %174 = OpLoad %int %m + %175 = OpLoad %int %high + %179 = OpIMul %int %int_2 %174 + %180 = OpIAdd %int %173 %179 + %181 = OpISub %int %180 %int_1 + %176 = OpExtInst %int %177 SMin %181 %175 + OpStore %to_1 %176 + %182 = OpLoad %int %from_1 + OpStore %param %182 + %183 = OpLoad %int %mid_1 + OpStore %param_1 %183 + %184 = OpLoad %int %to_1 + OpStore %param_2 %184 + %185 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %160 + %160 = OpLabel + %189 = OpLoad %int %m + %190 = OpLoad %int %i_2 + %191 = OpIMul %int %int_2 %189 + %192 = OpIAdd %int %190 %191 + OpStore %i_2 %192 + OpBranch %158 + %159 = OpLabel + OpBranch %149 + %149 = OpLabel + %193 = OpLoad %int %m + %194 = OpIMul %int %int_2 %193 + OpStore %m %194 + OpBranch %147 + %148 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %132 + %196 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %201 + %204 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %205 = OpLoad %float %204 + %206 = OpConvertFToS %int %205 + OpStore %i_3 %206 + OpBranch %207 + %207 = OpLabel + OpLoopMerge %208 %209 None + OpBranch %210 + %210 = OpLabel + %211 = OpLoad %int %i_3 + OpSelectionMerge %212 None + OpSwitch %211 %213 9 %214 8 %215 7 %216 6 %217 5 %218 4 %219 3 %220 2 %221 1 %222 0 %223 + %214 = OpLabel + %224 = OpLoad %int %i_3 + %225 = OpAccessChain %_ptr_Private_int %data %224 + OpStore %225 %int_n5 + OpBranch %212 + %215 = OpLabel + %227 = OpLoad %int %i_3 + %228 = OpAccessChain %_ptr_Private_int %data %227 + OpStore %228 %int_n4 + OpBranch %212 + %216 = OpLabel + %230 = OpLoad %int %i_3 + %231 = OpAccessChain %_ptr_Private_int %data %230 + OpStore %231 %int_n3 + OpBranch %212 + %217 = OpLabel + %233 = OpLoad %int %i_3 + %234 = OpAccessChain %_ptr_Private_int %data %233 + OpStore %234 %int_n2 + OpBranch %212 + %218 = OpLabel + %236 = OpLoad %int %i_3 + %237 = OpAccessChain %_ptr_Private_int %data %236 + OpStore %237 %int_n1 + OpBranch %212 + %219 = OpLabel + %239 = OpLoad %int %i_3 + %240 = OpAccessChain %_ptr_Private_int %data %239 + OpStore %240 %int_0 + OpBranch %212 + %220 = OpLabel + %241 = OpLoad %int %i_3 + %242 = OpAccessChain %_ptr_Private_int %data %241 + OpStore %242 %int_1 + OpBranch %212 + %221 = OpLabel + %243 = OpLoad %int %i_3 + %244 = OpAccessChain %_ptr_Private_int %data %243 + OpStore %244 %int_2 + OpBranch %212 + %222 = OpLabel + %245 = OpLoad %int %i_3 + %246 = OpAccessChain %_ptr_Private_int %data %245 + OpStore %246 %int_3 + OpBranch %212 + %223 = OpLabel + %248 = OpLoad %int %i_3 + %249 = OpAccessChain %_ptr_Private_int %data %248 + OpStore %249 %int_4 + OpBranch %212 + %213 = OpLabel + OpBranch %212 + %212 = OpLabel + %251 = OpLoad %int %i_3 + %252 = OpIAdd %int %251 %int_1 + OpStore %i_3 %252 + OpBranch %209 + %209 = OpLabel + %253 = OpLoad %int %i_3 + %254 = OpSLessThan %bool %253 %int_10 + OpSelectionMerge %255 None + OpBranchConditional %254 %256 %257 + %256 = OpLabel + OpBranch %255 + %257 = OpLabel + OpBranch %208 + %255 = OpLabel + OpBranch %207 + %208 = OpLabel + OpStore %j_1 %int_0 + OpBranch %258 + %258 = OpLabel + OpLoopMerge %259 %260 None + OpBranch %261 + %261 = OpLabel + %262 = OpLoad %int %j_1 + %263 = OpSLessThan %bool %262 %int_10 + OpSelectionMerge %264 None + OpBranchConditional %263 %265 %266 + %265 = OpLabel + OpBranch %264 + %266 = OpLabel + OpBranch %259 + %264 = OpLabel + %267 = OpLoad %int %j_1 + %268 = OpLoad %int %j_1 + %269 = OpAccessChain %_ptr_Private_int %data %268 + %270 = OpLoad %int %269 + %271 = OpAccessChain %_ptr_Private_int %temp %267 + OpStore %271 %270 + OpBranch %260 + %260 = OpLabel + %272 = OpLoad %int %j_1 + %273 = OpIAdd %int %272 %int_1 + OpStore %j_1 %273 + OpBranch %258 + %259 = OpLabel + %274 = OpFunctionCall %void %mergeSort_ + %277 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %278 = OpLoad %float %277 + %279 = OpConvertFToS %int %278 + %281 = OpSLessThan %bool %279 %int_30 + OpSelectionMerge %282 None + OpBranchConditional %281 %283 %284 + %283 = OpLabel + %285 = OpAccessChain %_ptr_Private_int %data %int_0 + %286 = OpLoad %int %285 + %288 = OpConvertSToF %float %286 + %290 = OpFDiv %float %288 %float_10 + %291 = OpFAdd %float %float_0_5 %290 + OpStore %grey %291 + OpBranch %282 + %284 = OpLabel + %292 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %293 = OpLoad %float %292 + %294 = OpConvertFToS %int %293 + %296 = OpSLessThan %bool %294 %int_60 + OpSelectionMerge %297 None + OpBranchConditional %296 %298 %299 + %298 = OpLabel + %300 = OpAccessChain %_ptr_Private_int %data %int_1 + %301 = OpLoad %int %300 + %302 = OpConvertSToF %float %301 + %303 = OpFDiv %float %302 %float_10 + %304 = OpFAdd %float %float_0_5 %303 + OpStore %grey %304 + OpBranch %297 + %299 = OpLabel + %305 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %306 = OpLoad %float %305 + %307 = OpConvertFToS %int %306 + %309 = OpSLessThan %bool %307 %int_90 + OpSelectionMerge %310 None + OpBranchConditional %309 %311 %312 + %311 = OpLabel + %313 = OpAccessChain %_ptr_Private_int %data %int_2 + %314 = OpLoad %int %313 + %315 = OpConvertSToF %float %314 + %316 = OpFDiv %float %315 %float_10 + %317 = OpFAdd %float %float_0_5 %316 + OpStore %grey %317 + OpBranch %310 + %312 = OpLabel + %318 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %319 = OpLoad %float %318 + %320 = OpConvertFToS %int %319 + %322 = OpSLessThan %bool %320 %int_120 + OpSelectionMerge %323 None + OpBranchConditional %322 %324 %325 + %324 = OpLabel + %326 = OpAccessChain %_ptr_Private_int %data %int_3 + %327 = OpLoad %int %326 + %328 = OpConvertSToF %float %327 + %329 = OpFDiv %float %328 %float_10 + %330 = OpFAdd %float %float_0_5 %329 + OpStore %grey %330 + OpBranch %323 + %325 = OpLabel + %331 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %332 = OpLoad %float %331 + %333 = OpConvertFToS %int %332 + %335 = OpSLessThan %bool %333 %int_150 + OpSelectionMerge %336 None + OpBranchConditional %335 %337 %338 + %337 = OpLabel + OpKill + %338 = OpLabel + %339 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %340 = OpLoad %float %339 + %341 = OpConvertFToS %int %340 + %343 = OpSLessThan %bool %341 %int_180 + OpSelectionMerge %344 None + OpBranchConditional %343 %345 %346 + %345 = OpLabel + %348 = OpAccessChain %_ptr_Private_int %data %int_5 + %349 = OpLoad %int %348 + %350 = OpConvertSToF %float %349 + %351 = OpFDiv %float %350 %float_10 + %352 = OpFAdd %float %float_0_5 %351 + OpStore %grey %352 + OpBranch %344 + %346 = OpLabel + %353 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %354 = OpLoad %float %353 + %355 = OpConvertFToS %int %354 + %357 = OpSLessThan %bool %355 %int_210 + OpSelectionMerge %358 None + OpBranchConditional %357 %359 %360 + %359 = OpLabel + %362 = OpAccessChain %_ptr_Private_int %data %int_6 + %363 = OpLoad %int %362 + %364 = OpConvertSToF %float %363 + %365 = OpFDiv %float %364 %float_10 + %366 = OpFAdd %float %float_0_5 %365 + OpStore %grey %366 + OpBranch %358 + %360 = OpLabel + %367 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %368 = OpLoad %float %367 + %369 = OpConvertFToS %int %368 + %371 = OpSLessThan %bool %369 %int_240 + OpSelectionMerge %372 None + OpBranchConditional %371 %373 %374 + %373 = OpLabel + %376 = OpAccessChain %_ptr_Private_int %data %int_7 + %377 = OpLoad %int %376 + %378 = OpConvertSToF %float %377 + %379 = OpFDiv %float %378 %float_10 + %380 = OpFAdd %float %float_0_5 %379 + OpStore %grey %380 + OpBranch %372 + %374 = OpLabel + %381 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %382 = OpLoad %float %381 + %383 = OpConvertFToS %int %382 + %385 = OpSLessThan %bool %383 %int_270 + OpSelectionMerge %386 None + OpBranchConditional %385 %387 %388 + %387 = OpLabel + %390 = OpAccessChain %_ptr_Private_int %data %int_8 + %391 = OpLoad %int %390 + %392 = OpConvertSToF %float %391 + %393 = OpFDiv %float %392 %float_10 + %394 = OpFAdd %float %float_0_5 %393 + OpStore %grey %394 + OpBranch %386 + %388 = OpLabel + OpKill + %386 = OpLabel + OpBranch %372 + %372 = OpLabel + OpBranch %358 + %358 = OpLabel + OpBranch %344 + %344 = OpLabel + OpBranch %336 + %336 = OpLabel + OpBranch %323 + %323 = OpLabel + OpBranch %310 + %310 = OpLabel + OpBranch %297 + %297 = OpLabel + OpBranch %282 + %282 = OpLabel + %395 = OpLoad %float %grey + %397 = OpCompositeConstruct %v3float %395 %395 %395 + %398 = OpCompositeExtract %float %397 0 + %399 = OpCompositeExtract %float %397 1 + %400 = OpCompositeExtract %float %397 2 + %402 = OpCompositeConstruct %v4float %398 %399 %400 %float_1 + OpStore %x_GLF_color %402 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %403 +%tint_symbol_1 = OpFunctionParameter %main_out + %407 = OpLabel + %408 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %408 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %132 + %410 = OpLabel + %411 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %411 + %412 = OpFunctionCall %void %main_1 + %414 = OpLoad %v4float %x_GLF_color + %415 = OpCompositeConstruct %main_out %414 + %413 = OpFunctionCall %void %tint_symbol_3 %415 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 209[%209] is not post dominated by the back-edge block 255[%255] + %255 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..c8f464e35a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.spvasm.expected.wgsl @@ -0,0 +1,306 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_251 : i32 = *(from); + k = x_251; + let x_252 : i32 = *(from); + i = x_252; + let x_253 : i32 = *(mid); + j = (x_253 + 1); + loop { + let x_259 : i32 = i; + let x_260 : i32 = *(mid); + let x_262 : i32 = j; + let x_263 : i32 = *(to); + if (((x_259 <= x_260) && (x_262 <= x_263))) { + } else { + break; + } + let x_267 : i32 = i; + let x_269 : i32 = data[x_267]; + let x_270 : i32 = j; + let x_272 : i32 = data[x_270]; + if ((x_269 < x_272)) { + let x_277 : i32 = k; + k = (x_277 + 1); + let x_279 : i32 = i; + i = (x_279 + 1); + let x_282 : i32 = data[x_279]; + temp[x_277] = x_282; + } else { + let x_284 : i32 = k; + k = (x_284 + 1); + let x_286 : i32 = j; + j = (x_286 + 1); + let x_289 : i32 = data[x_286]; + temp[x_284] = x_289; + } + } + loop { + let x_295 : i32 = i; + let x_297 : i32 = i; + let x_298 : i32 = *(mid); + if (((x_295 < 10) && (x_297 <= x_298))) { + } else { + break; + } + let x_302 : i32 = k; + k = (x_302 + 1); + let x_304 : i32 = i; + i = (x_304 + 1); + let x_307 : i32 = data[x_304]; + temp[x_302] = x_307; + } + let x_309 : i32 = *(from); + i_1 = x_309; + loop { + let x_314 : i32 = i_1; + let x_315 : i32 = *(to); + if ((x_314 <= x_315)) { + } else { + break; + } + let x_318 : i32 = i_1; + let x_319 : i32 = i_1; + let x_321 : i32 = temp[x_319]; + data[x_318] = x_321; + + continuing { + let x_323 : i32 = i_1; + i_1 = (x_323 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_330 : i32 = m; + let x_331 : i32 = high; + if ((x_330 <= x_331)) { + } else { + break; + } + let x_334 : i32 = low; + i_2 = x_334; + loop { + let x_339 : i32 = i_2; + let x_340 : i32 = high; + if ((x_339 < x_340)) { + } else { + break; + } + let x_343 : i32 = i_2; + from_1 = x_343; + let x_344 : i32 = i_2; + let x_345 : i32 = m; + mid_1 = ((x_344 + x_345) - 1); + let x_348 : i32 = i_2; + let x_349 : i32 = m; + let x_353 : i32 = high; + to_1 = min(((x_348 + (2 * x_349)) - 1), x_353); + let x_355 : i32 = from_1; + param = x_355; + let x_356 : i32 = mid_1; + param_1 = x_356; + let x_357 : i32 = to_1; + param_2 = x_357; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_359 : i32 = m; + let x_361 : i32 = i_2; + i_2 = (x_361 + (2 * x_359)); + } + } + + continuing { + let x_363 : i32 = m; + m = (2 * x_363); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_84 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_84); + loop { + let x_90 : i32 = i_3; + switch(x_90) { + case 9: { + let x_120 : i32 = i_3; + data[x_120] = -5; + } + case 8: { + let x_118 : i32 = i_3; + data[x_118] = -4; + } + case 7: { + let x_116 : i32 = i_3; + data[x_116] = -3; + } + case 6: { + let x_114 : i32 = i_3; + data[x_114] = -2; + } + case 5: { + let x_112 : i32 = i_3; + data[x_112] = -1; + } + case 4: { + let x_110 : i32 = i_3; + data[x_110] = 0; + } + case 3: { + let x_108 : i32 = i_3; + data[x_108] = 1; + } + case 2: { + let x_106 : i32 = i_3; + data[x_106] = 2; + } + case 1: { + let x_104 : i32 = i_3; + data[x_104] = 3; + } + case 0: { + let x_102 : i32 = i_3; + data[x_102] = 4; + } + default: { + } + } + let x_122 : i32 = i_3; + i_3 = (x_122 + 1); + + continuing { + let x_124 : i32 = i_3; + if ((x_124 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_130 : i32 = j_1; + if ((x_130 < 10)) { + } else { + break; + } + let x_133 : i32 = j_1; + let x_134 : i32 = j_1; + let x_136 : i32 = data[x_134]; + temp[x_133] = x_136; + + continuing { + let x_138 : i32 = j_1; + j_1 = (x_138 + 1); + } + } + mergeSort_(); + let x_142 : f32 = gl_FragCoord.y; + if ((i32(x_142) < 30)) { + let x_149 : i32 = data[0]; + grey = (0.5 + (f32(x_149) / 10.0)); + } else { + let x_154 : f32 = gl_FragCoord.y; + if ((i32(x_154) < 60)) { + let x_161 : i32 = data[1]; + grey = (0.5 + (f32(x_161) / 10.0)); + } else { + let x_166 : f32 = gl_FragCoord.y; + if ((i32(x_166) < 90)) { + let x_173 : i32 = data[2]; + grey = (0.5 + (f32(x_173) / 10.0)); + } else { + let x_178 : f32 = gl_FragCoord.y; + if ((i32(x_178) < 120)) { + let x_185 : i32 = data[3]; + grey = (0.5 + (f32(x_185) / 10.0)); + } else { + let x_190 : f32 = gl_FragCoord.y; + if ((i32(x_190) < 150)) { + discard; + } else { + let x_197 : f32 = gl_FragCoord.y; + if ((i32(x_197) < 180)) { + let x_204 : i32 = data[5]; + grey = (0.5 + (f32(x_204) / 10.0)); + } else { + let x_209 : f32 = gl_FragCoord.y; + if ((i32(x_209) < 210)) { + let x_216 : i32 = data[6]; + grey = (0.5 + (f32(x_216) / 10.0)); + } else { + let x_221 : f32 = gl_FragCoord.y; + if ((i32(x_221) < 240)) { + let x_228 : i32 = data[7]; + grey = (0.5 + (f32(x_228) / 10.0)); + } else { + let x_233 : f32 = gl_FragCoord.y; + if ((i32(x_233) < 270)) { + let x_240 : i32 = data[8]; + grey = (0.5 + (f32(x_240) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_244 : f32 = grey; + let x_245 : vec3 = vec3(x_244, x_244, x_244); + x_GLF_color = vec4(x_245.x, x_245.y, x_245.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl new file mode 100644 index 0000000000..c8f464e35a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl @@ -0,0 +1,306 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_251 : i32 = *(from); + k = x_251; + let x_252 : i32 = *(from); + i = x_252; + let x_253 : i32 = *(mid); + j = (x_253 + 1); + loop { + let x_259 : i32 = i; + let x_260 : i32 = *(mid); + let x_262 : i32 = j; + let x_263 : i32 = *(to); + if (((x_259 <= x_260) && (x_262 <= x_263))) { + } else { + break; + } + let x_267 : i32 = i; + let x_269 : i32 = data[x_267]; + let x_270 : i32 = j; + let x_272 : i32 = data[x_270]; + if ((x_269 < x_272)) { + let x_277 : i32 = k; + k = (x_277 + 1); + let x_279 : i32 = i; + i = (x_279 + 1); + let x_282 : i32 = data[x_279]; + temp[x_277] = x_282; + } else { + let x_284 : i32 = k; + k = (x_284 + 1); + let x_286 : i32 = j; + j = (x_286 + 1); + let x_289 : i32 = data[x_286]; + temp[x_284] = x_289; + } + } + loop { + let x_295 : i32 = i; + let x_297 : i32 = i; + let x_298 : i32 = *(mid); + if (((x_295 < 10) && (x_297 <= x_298))) { + } else { + break; + } + let x_302 : i32 = k; + k = (x_302 + 1); + let x_304 : i32 = i; + i = (x_304 + 1); + let x_307 : i32 = data[x_304]; + temp[x_302] = x_307; + } + let x_309 : i32 = *(from); + i_1 = x_309; + loop { + let x_314 : i32 = i_1; + let x_315 : i32 = *(to); + if ((x_314 <= x_315)) { + } else { + break; + } + let x_318 : i32 = i_1; + let x_319 : i32 = i_1; + let x_321 : i32 = temp[x_319]; + data[x_318] = x_321; + + continuing { + let x_323 : i32 = i_1; + i_1 = (x_323 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_330 : i32 = m; + let x_331 : i32 = high; + if ((x_330 <= x_331)) { + } else { + break; + } + let x_334 : i32 = low; + i_2 = x_334; + loop { + let x_339 : i32 = i_2; + let x_340 : i32 = high; + if ((x_339 < x_340)) { + } else { + break; + } + let x_343 : i32 = i_2; + from_1 = x_343; + let x_344 : i32 = i_2; + let x_345 : i32 = m; + mid_1 = ((x_344 + x_345) - 1); + let x_348 : i32 = i_2; + let x_349 : i32 = m; + let x_353 : i32 = high; + to_1 = min(((x_348 + (2 * x_349)) - 1), x_353); + let x_355 : i32 = from_1; + param = x_355; + let x_356 : i32 = mid_1; + param_1 = x_356; + let x_357 : i32 = to_1; + param_2 = x_357; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_359 : i32 = m; + let x_361 : i32 = i_2; + i_2 = (x_361 + (2 * x_359)); + } + } + + continuing { + let x_363 : i32 = m; + m = (2 * x_363); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_84 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_84); + loop { + let x_90 : i32 = i_3; + switch(x_90) { + case 9: { + let x_120 : i32 = i_3; + data[x_120] = -5; + } + case 8: { + let x_118 : i32 = i_3; + data[x_118] = -4; + } + case 7: { + let x_116 : i32 = i_3; + data[x_116] = -3; + } + case 6: { + let x_114 : i32 = i_3; + data[x_114] = -2; + } + case 5: { + let x_112 : i32 = i_3; + data[x_112] = -1; + } + case 4: { + let x_110 : i32 = i_3; + data[x_110] = 0; + } + case 3: { + let x_108 : i32 = i_3; + data[x_108] = 1; + } + case 2: { + let x_106 : i32 = i_3; + data[x_106] = 2; + } + case 1: { + let x_104 : i32 = i_3; + data[x_104] = 3; + } + case 0: { + let x_102 : i32 = i_3; + data[x_102] = 4; + } + default: { + } + } + let x_122 : i32 = i_3; + i_3 = (x_122 + 1); + + continuing { + let x_124 : i32 = i_3; + if ((x_124 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_130 : i32 = j_1; + if ((x_130 < 10)) { + } else { + break; + } + let x_133 : i32 = j_1; + let x_134 : i32 = j_1; + let x_136 : i32 = data[x_134]; + temp[x_133] = x_136; + + continuing { + let x_138 : i32 = j_1; + j_1 = (x_138 + 1); + } + } + mergeSort_(); + let x_142 : f32 = gl_FragCoord.y; + if ((i32(x_142) < 30)) { + let x_149 : i32 = data[0]; + grey = (0.5 + (f32(x_149) / 10.0)); + } else { + let x_154 : f32 = gl_FragCoord.y; + if ((i32(x_154) < 60)) { + let x_161 : i32 = data[1]; + grey = (0.5 + (f32(x_161) / 10.0)); + } else { + let x_166 : f32 = gl_FragCoord.y; + if ((i32(x_166) < 90)) { + let x_173 : i32 = data[2]; + grey = (0.5 + (f32(x_173) / 10.0)); + } else { + let x_178 : f32 = gl_FragCoord.y; + if ((i32(x_178) < 120)) { + let x_185 : i32 = data[3]; + grey = (0.5 + (f32(x_185) / 10.0)); + } else { + let x_190 : f32 = gl_FragCoord.y; + if ((i32(x_190) < 150)) { + discard; + } else { + let x_197 : f32 = gl_FragCoord.y; + if ((i32(x_197) < 180)) { + let x_204 : i32 = data[5]; + grey = (0.5 + (f32(x_204) / 10.0)); + } else { + let x_209 : f32 = gl_FragCoord.y; + if ((i32(x_209) < 210)) { + let x_216 : i32 = data[6]; + grey = (0.5 + (f32(x_216) / 10.0)); + } else { + let x_221 : f32 = gl_FragCoord.y; + if ((i32(x_221) < 240)) { + let x_228 : i32 = data[7]; + grey = (0.5 + (f32(x_228) / 10.0)); + } else { + let x_233 : f32 = gl_FragCoord.y; + if ((i32(x_233) < 270)) { + let x_240 : i32 = data[8]; + grey = (0.5 + (f32(x_240) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_244 : f32 = grey; + let x_245 : vec3 = vec3(x_244, x_244, x_244); + x_GLF_color = vec4(x_245.x, x_245.y, x_245.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..6a30ba44d8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.hlsl @@ -0,0 +1,268 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_251 = from; + k = x_251; + const int x_252 = from; + i = x_252; + const int x_253 = mid; + j = (x_253 + 1); + while (true) { + const int x_259 = i; + const int x_260 = mid; + const int x_262 = j; + const int x_263 = to; + bool tint_tmp = (x_259 <= x_260); + if (tint_tmp) { + tint_tmp = (x_262 <= x_263); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_269 = data[i]; + const int x_272 = data[j]; + if ((x_269 < x_272)) { + const int x_277 = k; + k = (x_277 + 1); + const int x_279 = i; + i = (x_279 + 1); + const int x_282 = data[x_279]; + temp[x_277] = x_282; + } else { + const int x_284 = k; + k = (x_284 + 1); + const int x_286 = j; + j = (x_286 + 1); + const int x_289 = data[x_286]; + temp[x_284] = x_289; + } + } + while (true) { + const int x_295 = i; + const int x_297 = i; + const int x_298 = mid; + bool tint_tmp_1 = (x_295 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_297 <= x_298); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_302 = k; + k = (x_302 + 1); + const int x_304 = i; + i = (x_304 + 1); + const int x_307 = data[x_304]; + temp[x_302] = x_307; + } + const int x_309 = from; + i_1 = x_309; + while (true) { + const int x_314 = i_1; + const int x_315 = to; + if ((x_314 <= x_315)) { + } else { + break; + } + const int x_318 = i_1; + const int x_321 = temp[i_1]; + data[x_318] = x_321; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_84 = asfloat(x_28[0].x); + i_3 = int(x_84); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_133 = j_1; + const int x_136 = data[j_1]; + temp[x_133] = x_136; + } + } + mergeSort_(); + const float x_142 = gl_FragCoord.y; + if ((int(x_142) < 30)) { + const int x_149 = data[0]; + grey = (0.5f + (float(x_149) / 10.0f)); + } else { + const float x_154 = gl_FragCoord.y; + if ((int(x_154) < 60)) { + const int x_161 = data[1]; + grey = (0.5f + (float(x_161) / 10.0f)); + } else { + const float x_166 = gl_FragCoord.y; + if ((int(x_166) < 90)) { + const int x_173 = data[2]; + grey = (0.5f + (float(x_173) / 10.0f)); + } else { + const float x_178 = gl_FragCoord.y; + if ((int(x_178) < 120)) { + const int x_185 = data[3]; + grey = (0.5f + (float(x_185) / 10.0f)); + } else { + const float x_190 = gl_FragCoord.y; + if ((int(x_190) < 150)) { + discard; + } else { + const float x_197 = gl_FragCoord.y; + if ((int(x_197) < 180)) { + const int x_204 = data[5]; + grey = (0.5f + (float(x_204) / 10.0f)); + } else { + const float x_209 = gl_FragCoord.y; + if ((int(x_209) < 210)) { + const int x_216 = data[6]; + grey = (0.5f + (float(x_216) / 10.0f)); + } else { + const float x_221 = gl_FragCoord.y; + if ((int(x_221) < 240)) { + const int x_228 = data[7]; + grey = (0.5f + (float(x_228) / 10.0f)); + } else { + const float x_233 = gl_FragCoord.y; + if ((int(x_233) < 270)) { + const int x_240 = data[8]; + grey = (0.5f + (float(x_240) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_244 = grey; + const float3 x_245 = float3(x_244, x_244, x_244); + x_GLF_color = float4(x_245.x, x_245.y, x_245.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.msl new file mode 100644 index 0000000000..6340b475e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.msl @@ -0,0 +1,314 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_251 = *(from); + k = x_251; + int const x_252 = *(from); + i = x_252; + int const x_253 = *(mid); + j = (x_253 + 1); + while (true) { + int const x_259 = i; + int const x_260 = *(mid); + int const x_262 = j; + int const x_263 = *(to); + if (((x_259 <= x_260) && (x_262 <= x_263))) { + } else { + break; + } + int const x_267 = i; + int const x_269 = (*(tint_symbol_5)).arr[x_267]; + int const x_270 = j; + int const x_272 = (*(tint_symbol_5)).arr[x_270]; + if ((x_269 < x_272)) { + int const x_277 = k; + k = (x_277 + 1); + int const x_279 = i; + i = (x_279 + 1); + int const x_282 = (*(tint_symbol_5)).arr[x_279]; + (*(tint_symbol_6)).arr[x_277] = x_282; + } else { + int const x_284 = k; + k = (x_284 + 1); + int const x_286 = j; + j = (x_286 + 1); + int const x_289 = (*(tint_symbol_5)).arr[x_286]; + (*(tint_symbol_6)).arr[x_284] = x_289; + } + } + while (true) { + int const x_295 = i; + int const x_297 = i; + int const x_298 = *(mid); + if (((x_295 < 10) && (x_297 <= x_298))) { + } else { + break; + } + int const x_302 = k; + k = (x_302 + 1); + int const x_304 = i; + i = (x_304 + 1); + int const x_307 = (*(tint_symbol_5)).arr[x_304]; + (*(tint_symbol_6)).arr[x_302] = x_307; + } + int const x_309 = *(from); + i_1 = x_309; + while (true) { + int const x_314 = i_1; + int const x_315 = *(to); + if ((x_314 <= x_315)) { + } else { + break; + } + int const x_318 = i_1; + int const x_319 = i_1; + int const x_321 = (*(tint_symbol_6)).arr[x_319]; + (*(tint_symbol_5)).arr[x_318] = x_321; + { + int const x_323 = i_1; + i_1 = (x_323 + 1); + } + } + return; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_330 = m; + int const x_331 = high; + if ((x_330 <= x_331)) { + } else { + break; + } + int const x_334 = low; + i_2 = x_334; + while (true) { + int const x_339 = i_2; + int const x_340 = high; + if ((x_339 < x_340)) { + } else { + break; + } + int const x_343 = i_2; + from_1 = x_343; + int const x_344 = i_2; + int const x_345 = m; + mid_1 = ((x_344 + x_345) - 1); + int const x_348 = i_2; + int const x_349 = m; + int const x_353 = high; + to_1 = min(((x_348 + (2 * x_349)) - 1), x_353); + int const x_355 = from_1; + param = x_355; + int const x_356 = mid_1; + param_1 = x_356; + int const x_357 = to_1; + param_2 = x_357; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_359 = m; + int const x_361 = i_2; + i_2 = (x_361 + (2 * x_359)); + } + } + { + int const x_363 = m; + m = (2 * x_363); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_84 = x_28.injectionSwitch.x; + i_3 = int(x_84); + while (true) { + int const x_90 = i_3; + switch(x_90) { + case 9: { + int const x_120 = i_3; + (*(tint_symbol_9)).arr[x_120] = -5; + break; + } + case 8: { + int const x_118 = i_3; + (*(tint_symbol_9)).arr[x_118] = -4; + break; + } + case 7: { + int const x_116 = i_3; + (*(tint_symbol_9)).arr[x_116] = -3; + break; + } + case 6: { + int const x_114 = i_3; + (*(tint_symbol_9)).arr[x_114] = -2; + break; + } + case 5: { + int const x_112 = i_3; + (*(tint_symbol_9)).arr[x_112] = -1; + break; + } + case 4: { + int const x_110 = i_3; + (*(tint_symbol_9)).arr[x_110] = 0; + break; + } + case 3: { + int const x_108 = i_3; + (*(tint_symbol_9)).arr[x_108] = 1; + break; + } + case 2: { + int const x_106 = i_3; + (*(tint_symbol_9)).arr[x_106] = 2; + break; + } + case 1: { + int const x_104 = i_3; + (*(tint_symbol_9)).arr[x_104] = 3; + break; + } + case 0: { + int const x_102 = i_3; + (*(tint_symbol_9)).arr[x_102] = 4; + break; + } + default: { + break; + } + } + int const x_122 = i_3; + i_3 = (x_122 + 1); + { + int const x_124 = i_3; + if ((x_124 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_130 = j_1; + if ((x_130 < 10)) { + } else { + break; + } + int const x_133 = j_1; + int const x_134 = j_1; + int const x_136 = (*(tint_symbol_9)).arr[x_134]; + (*(tint_symbol_10)).arr[x_133] = x_136; + { + int const x_138 = j_1; + j_1 = (x_138 + 1); + } + } + mergeSort_(tint_symbol_9, tint_symbol_10); + float const x_142 = (*(tint_symbol_11)).y; + if ((int(x_142) < 30)) { + int const x_149 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_149) / 10.0f)); + } else { + float const x_154 = (*(tint_symbol_11)).y; + if ((int(x_154) < 60)) { + int const x_161 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_161) / 10.0f)); + } else { + float const x_166 = (*(tint_symbol_11)).y; + if ((int(x_166) < 90)) { + int const x_173 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_173) / 10.0f)); + } else { + float const x_178 = (*(tint_symbol_11)).y; + if ((int(x_178) < 120)) { + int const x_185 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_185) / 10.0f)); + } else { + float const x_190 = (*(tint_symbol_11)).y; + if ((int(x_190) < 150)) { + discard_fragment(); + } else { + float const x_197 = (*(tint_symbol_11)).y; + if ((int(x_197) < 180)) { + int const x_204 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_204) / 10.0f)); + } else { + float const x_209 = (*(tint_symbol_11)).y; + if ((int(x_209) < 210)) { + int const x_216 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_216) / 10.0f)); + } else { + float const x_221 = (*(tint_symbol_11)).y; + if ((int(x_221) < 240)) { + int const x_228 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_228) / 10.0f)); + } else { + float const x_233 = (*(tint_symbol_11)).y; + if ((int(x_233) < 270)) { + int const x_240 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_240) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_244 = grey; + float3 const x_245 = float3(x_244, x_244, x_244); + *(tint_symbol_12) = float4(x_245.x, x_245.y, x_245.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..4df39a6a63 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.spvasm @@ -0,0 +1,649 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 416 +; Schema: 0 + OpCapability Shader + %177 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %132 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %201 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %403 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpLoad %int %mid + %51 = OpLoad %int %j + %53 = OpLoad %int %to + %54 = OpSLessThanEqual %bool %48 %50 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %58 = OpSLessThanEqual %bool %51 %53 + OpBranch %56 + %56 = OpLabel + %59 = OpPhi %bool %54 %47 %58 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %45 + %60 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Private_int %data %63 + %66 = OpLoad %int %65 + %67 = OpLoad %int %j + %68 = OpAccessChain %_ptr_Private_int %data %67 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %k + %75 = OpIAdd %int %74 %int_1 + OpStore %k %75 + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + %78 = OpAccessChain %_ptr_Private_int %data %76 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Private_int %temp %74 + OpStore %80 %79 + OpBranch %71 + %73 = OpLabel + %81 = OpLoad %int %k + %82 = OpIAdd %int %81 %int_1 + OpStore %k %82 + %83 = OpLoad %int %j + %84 = OpIAdd %int %83 %int_1 + OpStore %j %84 + %85 = OpAccessChain %_ptr_Private_int %data %83 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Private_int %temp %81 + OpStore %87 %86 + OpBranch %71 + %71 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpLoad %int %i + %95 = OpLoad %int %mid + %97 = OpSLessThan %bool %92 %int_10 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSLessThanEqual %bool %93 %95 + OpBranch %98 + %98 = OpLabel + %101 = OpPhi %bool %97 %91 %100 %99 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpBranch %102 + %104 = OpLabel + OpBranch %89 + %102 = OpLabel + %105 = OpLoad %int %k + %106 = OpIAdd %int %105 %int_1 + OpStore %k %106 + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + %109 = OpAccessChain %_ptr_Private_int %data %107 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Private_int %temp %105 + OpStore %111 %110 + OpBranch %90 + %90 = OpLabel + OpBranch %88 + %89 = OpLabel + %113 = OpLoad %int %from + OpStore %i_1 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpLoad %int %to + %121 = OpSLessThanEqual %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + OpBranch %122 + %124 = OpLabel + OpBranch %115 + %122 = OpLabel + %125 = OpLoad %int %i_1 + %126 = OpLoad %int %i_1 + %127 = OpAccessChain %_ptr_Private_int %temp %126 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %129 %128 + OpBranch %116 + %116 = OpLabel + %130 = OpLoad %int %i_1 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_1 %131 + OpBranch %114 + %115 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %132 + %134 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %151 = OpLoad %int %m + %152 = OpLoad %int %high + %153 = OpSLessThanEqual %bool %151 %152 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + OpBranch %154 + %156 = OpLabel + OpBranch %148 + %154 = OpLabel + %157 = OpLoad %int %low + OpStore %i_2 %157 + OpBranch %158 + %158 = OpLabel + OpLoopMerge %159 %160 None + OpBranch %161 + %161 = OpLabel + %162 = OpLoad %int %i_2 + %163 = OpLoad %int %high + %164 = OpSLessThan %bool %162 %163 + OpSelectionMerge %165 None + OpBranchConditional %164 %166 %167 + %166 = OpLabel + OpBranch %165 + %167 = OpLabel + OpBranch %159 + %165 = OpLabel + %168 = OpLoad %int %i_2 + OpStore %from_1 %168 + %169 = OpLoad %int %i_2 + %170 = OpLoad %int %m + %171 = OpIAdd %int %169 %170 + %172 = OpISub %int %171 %int_1 + OpStore %mid_1 %172 + %173 = OpLoad %int %i_2 + %174 = OpLoad %int %m + %175 = OpLoad %int %high + %179 = OpIMul %int %int_2 %174 + %180 = OpIAdd %int %173 %179 + %181 = OpISub %int %180 %int_1 + %176 = OpExtInst %int %177 SMin %181 %175 + OpStore %to_1 %176 + %182 = OpLoad %int %from_1 + OpStore %param %182 + %183 = OpLoad %int %mid_1 + OpStore %param_1 %183 + %184 = OpLoad %int %to_1 + OpStore %param_2 %184 + %185 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %160 + %160 = OpLabel + %189 = OpLoad %int %m + %190 = OpLoad %int %i_2 + %191 = OpIMul %int %int_2 %189 + %192 = OpIAdd %int %190 %191 + OpStore %i_2 %192 + OpBranch %158 + %159 = OpLabel + OpBranch %149 + %149 = OpLabel + %193 = OpLoad %int %m + %194 = OpIMul %int %int_2 %193 + OpStore %m %194 + OpBranch %147 + %148 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %132 + %196 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %201 + %204 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %205 = OpLoad %float %204 + %206 = OpConvertFToS %int %205 + OpStore %i_3 %206 + OpBranch %207 + %207 = OpLabel + OpLoopMerge %208 %209 None + OpBranch %210 + %210 = OpLabel + %211 = OpLoad %int %i_3 + OpSelectionMerge %212 None + OpSwitch %211 %213 9 %214 8 %215 7 %216 6 %217 5 %218 4 %219 3 %220 2 %221 1 %222 0 %223 + %214 = OpLabel + %224 = OpLoad %int %i_3 + %225 = OpAccessChain %_ptr_Private_int %data %224 + OpStore %225 %int_n5 + OpBranch %212 + %215 = OpLabel + %227 = OpLoad %int %i_3 + %228 = OpAccessChain %_ptr_Private_int %data %227 + OpStore %228 %int_n4 + OpBranch %212 + %216 = OpLabel + %230 = OpLoad %int %i_3 + %231 = OpAccessChain %_ptr_Private_int %data %230 + OpStore %231 %int_n3 + OpBranch %212 + %217 = OpLabel + %233 = OpLoad %int %i_3 + %234 = OpAccessChain %_ptr_Private_int %data %233 + OpStore %234 %int_n2 + OpBranch %212 + %218 = OpLabel + %236 = OpLoad %int %i_3 + %237 = OpAccessChain %_ptr_Private_int %data %236 + OpStore %237 %int_n1 + OpBranch %212 + %219 = OpLabel + %239 = OpLoad %int %i_3 + %240 = OpAccessChain %_ptr_Private_int %data %239 + OpStore %240 %int_0 + OpBranch %212 + %220 = OpLabel + %241 = OpLoad %int %i_3 + %242 = OpAccessChain %_ptr_Private_int %data %241 + OpStore %242 %int_1 + OpBranch %212 + %221 = OpLabel + %243 = OpLoad %int %i_3 + %244 = OpAccessChain %_ptr_Private_int %data %243 + OpStore %244 %int_2 + OpBranch %212 + %222 = OpLabel + %245 = OpLoad %int %i_3 + %246 = OpAccessChain %_ptr_Private_int %data %245 + OpStore %246 %int_3 + OpBranch %212 + %223 = OpLabel + %248 = OpLoad %int %i_3 + %249 = OpAccessChain %_ptr_Private_int %data %248 + OpStore %249 %int_4 + OpBranch %212 + %213 = OpLabel + OpBranch %212 + %212 = OpLabel + %251 = OpLoad %int %i_3 + %252 = OpIAdd %int %251 %int_1 + OpStore %i_3 %252 + OpBranch %209 + %209 = OpLabel + %253 = OpLoad %int %i_3 + %254 = OpSLessThan %bool %253 %int_10 + OpSelectionMerge %255 None + OpBranchConditional %254 %256 %257 + %256 = OpLabel + OpBranch %255 + %257 = OpLabel + OpBranch %208 + %255 = OpLabel + OpBranch %207 + %208 = OpLabel + OpStore %j_1 %int_0 + OpBranch %258 + %258 = OpLabel + OpLoopMerge %259 %260 None + OpBranch %261 + %261 = OpLabel + %262 = OpLoad %int %j_1 + %263 = OpSLessThan %bool %262 %int_10 + OpSelectionMerge %264 None + OpBranchConditional %263 %265 %266 + %265 = OpLabel + OpBranch %264 + %266 = OpLabel + OpBranch %259 + %264 = OpLabel + %267 = OpLoad %int %j_1 + %268 = OpLoad %int %j_1 + %269 = OpAccessChain %_ptr_Private_int %data %268 + %270 = OpLoad %int %269 + %271 = OpAccessChain %_ptr_Private_int %temp %267 + OpStore %271 %270 + OpBranch %260 + %260 = OpLabel + %272 = OpLoad %int %j_1 + %273 = OpIAdd %int %272 %int_1 + OpStore %j_1 %273 + OpBranch %258 + %259 = OpLabel + %274 = OpFunctionCall %void %mergeSort_ + %277 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %278 = OpLoad %float %277 + %279 = OpConvertFToS %int %278 + %281 = OpSLessThan %bool %279 %int_30 + OpSelectionMerge %282 None + OpBranchConditional %281 %283 %284 + %283 = OpLabel + %285 = OpAccessChain %_ptr_Private_int %data %int_0 + %286 = OpLoad %int %285 + %288 = OpConvertSToF %float %286 + %290 = OpFDiv %float %288 %float_10 + %291 = OpFAdd %float %float_0_5 %290 + OpStore %grey %291 + OpBranch %282 + %284 = OpLabel + %292 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %293 = OpLoad %float %292 + %294 = OpConvertFToS %int %293 + %296 = OpSLessThan %bool %294 %int_60 + OpSelectionMerge %297 None + OpBranchConditional %296 %298 %299 + %298 = OpLabel + %300 = OpAccessChain %_ptr_Private_int %data %int_1 + %301 = OpLoad %int %300 + %302 = OpConvertSToF %float %301 + %303 = OpFDiv %float %302 %float_10 + %304 = OpFAdd %float %float_0_5 %303 + OpStore %grey %304 + OpBranch %297 + %299 = OpLabel + %305 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %306 = OpLoad %float %305 + %307 = OpConvertFToS %int %306 + %309 = OpSLessThan %bool %307 %int_90 + OpSelectionMerge %310 None + OpBranchConditional %309 %311 %312 + %311 = OpLabel + %313 = OpAccessChain %_ptr_Private_int %data %int_2 + %314 = OpLoad %int %313 + %315 = OpConvertSToF %float %314 + %316 = OpFDiv %float %315 %float_10 + %317 = OpFAdd %float %float_0_5 %316 + OpStore %grey %317 + OpBranch %310 + %312 = OpLabel + %318 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %319 = OpLoad %float %318 + %320 = OpConvertFToS %int %319 + %322 = OpSLessThan %bool %320 %int_120 + OpSelectionMerge %323 None + OpBranchConditional %322 %324 %325 + %324 = OpLabel + %326 = OpAccessChain %_ptr_Private_int %data %int_3 + %327 = OpLoad %int %326 + %328 = OpConvertSToF %float %327 + %329 = OpFDiv %float %328 %float_10 + %330 = OpFAdd %float %float_0_5 %329 + OpStore %grey %330 + OpBranch %323 + %325 = OpLabel + %331 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %332 = OpLoad %float %331 + %333 = OpConvertFToS %int %332 + %335 = OpSLessThan %bool %333 %int_150 + OpSelectionMerge %336 None + OpBranchConditional %335 %337 %338 + %337 = OpLabel + OpKill + %338 = OpLabel + %339 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %340 = OpLoad %float %339 + %341 = OpConvertFToS %int %340 + %343 = OpSLessThan %bool %341 %int_180 + OpSelectionMerge %344 None + OpBranchConditional %343 %345 %346 + %345 = OpLabel + %348 = OpAccessChain %_ptr_Private_int %data %int_5 + %349 = OpLoad %int %348 + %350 = OpConvertSToF %float %349 + %351 = OpFDiv %float %350 %float_10 + %352 = OpFAdd %float %float_0_5 %351 + OpStore %grey %352 + OpBranch %344 + %346 = OpLabel + %353 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %354 = OpLoad %float %353 + %355 = OpConvertFToS %int %354 + %357 = OpSLessThan %bool %355 %int_210 + OpSelectionMerge %358 None + OpBranchConditional %357 %359 %360 + %359 = OpLabel + %362 = OpAccessChain %_ptr_Private_int %data %int_6 + %363 = OpLoad %int %362 + %364 = OpConvertSToF %float %363 + %365 = OpFDiv %float %364 %float_10 + %366 = OpFAdd %float %float_0_5 %365 + OpStore %grey %366 + OpBranch %358 + %360 = OpLabel + %367 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %368 = OpLoad %float %367 + %369 = OpConvertFToS %int %368 + %371 = OpSLessThan %bool %369 %int_240 + OpSelectionMerge %372 None + OpBranchConditional %371 %373 %374 + %373 = OpLabel + %376 = OpAccessChain %_ptr_Private_int %data %int_7 + %377 = OpLoad %int %376 + %378 = OpConvertSToF %float %377 + %379 = OpFDiv %float %378 %float_10 + %380 = OpFAdd %float %float_0_5 %379 + OpStore %grey %380 + OpBranch %372 + %374 = OpLabel + %381 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %382 = OpLoad %float %381 + %383 = OpConvertFToS %int %382 + %385 = OpSLessThan %bool %383 %int_270 + OpSelectionMerge %386 None + OpBranchConditional %385 %387 %388 + %387 = OpLabel + %390 = OpAccessChain %_ptr_Private_int %data %int_8 + %391 = OpLoad %int %390 + %392 = OpConvertSToF %float %391 + %393 = OpFDiv %float %392 %float_10 + %394 = OpFAdd %float %float_0_5 %393 + OpStore %grey %394 + OpBranch %386 + %388 = OpLabel + OpKill + %386 = OpLabel + OpBranch %372 + %372 = OpLabel + OpBranch %358 + %358 = OpLabel + OpBranch %344 + %344 = OpLabel + OpBranch %336 + %336 = OpLabel + OpBranch %323 + %323 = OpLabel + OpBranch %310 + %310 = OpLabel + OpBranch %297 + %297 = OpLabel + OpBranch %282 + %282 = OpLabel + %395 = OpLoad %float %grey + %397 = OpCompositeConstruct %v3float %395 %395 %395 + %398 = OpCompositeExtract %float %397 0 + %399 = OpCompositeExtract %float %397 1 + %400 = OpCompositeExtract %float %397 2 + %402 = OpCompositeConstruct %v4float %398 %399 %400 %float_1 + OpStore %x_GLF_color %402 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %403 +%tint_symbol_1 = OpFunctionParameter %main_out + %407 = OpLabel + %408 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %408 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %132 + %410 = OpLabel + %411 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %411 + %412 = OpFunctionCall %void %main_1 + %414 = OpLoad %v4float %x_GLF_color + %415 = OpCompositeConstruct %main_out %414 + %413 = OpFunctionCall %void %tint_symbol_3 %415 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 209[%209] is not post dominated by the back-edge block 255[%255] + %255 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..c8f464e35a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.wgsl @@ -0,0 +1,306 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_251 : i32 = *(from); + k = x_251; + let x_252 : i32 = *(from); + i = x_252; + let x_253 : i32 = *(mid); + j = (x_253 + 1); + loop { + let x_259 : i32 = i; + let x_260 : i32 = *(mid); + let x_262 : i32 = j; + let x_263 : i32 = *(to); + if (((x_259 <= x_260) && (x_262 <= x_263))) { + } else { + break; + } + let x_267 : i32 = i; + let x_269 : i32 = data[x_267]; + let x_270 : i32 = j; + let x_272 : i32 = data[x_270]; + if ((x_269 < x_272)) { + let x_277 : i32 = k; + k = (x_277 + 1); + let x_279 : i32 = i; + i = (x_279 + 1); + let x_282 : i32 = data[x_279]; + temp[x_277] = x_282; + } else { + let x_284 : i32 = k; + k = (x_284 + 1); + let x_286 : i32 = j; + j = (x_286 + 1); + let x_289 : i32 = data[x_286]; + temp[x_284] = x_289; + } + } + loop { + let x_295 : i32 = i; + let x_297 : i32 = i; + let x_298 : i32 = *(mid); + if (((x_295 < 10) && (x_297 <= x_298))) { + } else { + break; + } + let x_302 : i32 = k; + k = (x_302 + 1); + let x_304 : i32 = i; + i = (x_304 + 1); + let x_307 : i32 = data[x_304]; + temp[x_302] = x_307; + } + let x_309 : i32 = *(from); + i_1 = x_309; + loop { + let x_314 : i32 = i_1; + let x_315 : i32 = *(to); + if ((x_314 <= x_315)) { + } else { + break; + } + let x_318 : i32 = i_1; + let x_319 : i32 = i_1; + let x_321 : i32 = temp[x_319]; + data[x_318] = x_321; + + continuing { + let x_323 : i32 = i_1; + i_1 = (x_323 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_330 : i32 = m; + let x_331 : i32 = high; + if ((x_330 <= x_331)) { + } else { + break; + } + let x_334 : i32 = low; + i_2 = x_334; + loop { + let x_339 : i32 = i_2; + let x_340 : i32 = high; + if ((x_339 < x_340)) { + } else { + break; + } + let x_343 : i32 = i_2; + from_1 = x_343; + let x_344 : i32 = i_2; + let x_345 : i32 = m; + mid_1 = ((x_344 + x_345) - 1); + let x_348 : i32 = i_2; + let x_349 : i32 = m; + let x_353 : i32 = high; + to_1 = min(((x_348 + (2 * x_349)) - 1), x_353); + let x_355 : i32 = from_1; + param = x_355; + let x_356 : i32 = mid_1; + param_1 = x_356; + let x_357 : i32 = to_1; + param_2 = x_357; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_359 : i32 = m; + let x_361 : i32 = i_2; + i_2 = (x_361 + (2 * x_359)); + } + } + + continuing { + let x_363 : i32 = m; + m = (2 * x_363); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_84 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_84); + loop { + let x_90 : i32 = i_3; + switch(x_90) { + case 9: { + let x_120 : i32 = i_3; + data[x_120] = -5; + } + case 8: { + let x_118 : i32 = i_3; + data[x_118] = -4; + } + case 7: { + let x_116 : i32 = i_3; + data[x_116] = -3; + } + case 6: { + let x_114 : i32 = i_3; + data[x_114] = -2; + } + case 5: { + let x_112 : i32 = i_3; + data[x_112] = -1; + } + case 4: { + let x_110 : i32 = i_3; + data[x_110] = 0; + } + case 3: { + let x_108 : i32 = i_3; + data[x_108] = 1; + } + case 2: { + let x_106 : i32 = i_3; + data[x_106] = 2; + } + case 1: { + let x_104 : i32 = i_3; + data[x_104] = 3; + } + case 0: { + let x_102 : i32 = i_3; + data[x_102] = 4; + } + default: { + } + } + let x_122 : i32 = i_3; + i_3 = (x_122 + 1); + + continuing { + let x_124 : i32 = i_3; + if ((x_124 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_130 : i32 = j_1; + if ((x_130 < 10)) { + } else { + break; + } + let x_133 : i32 = j_1; + let x_134 : i32 = j_1; + let x_136 : i32 = data[x_134]; + temp[x_133] = x_136; + + continuing { + let x_138 : i32 = j_1; + j_1 = (x_138 + 1); + } + } + mergeSort_(); + let x_142 : f32 = gl_FragCoord.y; + if ((i32(x_142) < 30)) { + let x_149 : i32 = data[0]; + grey = (0.5 + (f32(x_149) / 10.0)); + } else { + let x_154 : f32 = gl_FragCoord.y; + if ((i32(x_154) < 60)) { + let x_161 : i32 = data[1]; + grey = (0.5 + (f32(x_161) / 10.0)); + } else { + let x_166 : f32 = gl_FragCoord.y; + if ((i32(x_166) < 90)) { + let x_173 : i32 = data[2]; + grey = (0.5 + (f32(x_173) / 10.0)); + } else { + let x_178 : f32 = gl_FragCoord.y; + if ((i32(x_178) < 120)) { + let x_185 : i32 = data[3]; + grey = (0.5 + (f32(x_185) / 10.0)); + } else { + let x_190 : f32 = gl_FragCoord.y; + if ((i32(x_190) < 150)) { + discard; + } else { + let x_197 : f32 = gl_FragCoord.y; + if ((i32(x_197) < 180)) { + let x_204 : i32 = data[5]; + grey = (0.5 + (f32(x_204) / 10.0)); + } else { + let x_209 : f32 = gl_FragCoord.y; + if ((i32(x_209) < 210)) { + let x_216 : i32 = data[6]; + grey = (0.5 + (f32(x_216) / 10.0)); + } else { + let x_221 : f32 = gl_FragCoord.y; + if ((i32(x_221) < 240)) { + let x_228 : i32 = data[7]; + grey = (0.5 + (f32(x_228) / 10.0)); + } else { + let x_233 : f32 = gl_FragCoord.y; + if ((i32(x_233) < 270)) { + let x_240 : i32 = data[8]; + grey = (0.5 + (f32(x_240) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_244 : f32 = grey; + let x_245 : vec3 = vec3(x_244, x_244, x_244); + x_GLF_color = vec4(x_245.x, x_245.y, x_245.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm new file mode 100644 index 0000000000..bfbb984b43 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm @@ -0,0 +1,571 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %merge_i1_i1_i1_ "merge(i1;i1;i1;" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %mergeSort_ "mergeSort(" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %temp "temp" + OpName %i_0 "i" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_1 "i" + OpName %from_0 "from" + OpName %mid_0 "mid" + OpName %to_0 "to" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %i_2 "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %j_0 "j" + OpName %gl_FragCoord "gl_FragCoord" + OpName %grey "grey" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %32 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private + %int_10 = OpConstant %int 10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int_30 = OpConstant %int 30 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %false = OpConstantFalse %bool + %float_0 = OpConstant %float 0 + %main = OpFunction %void None %32 + %84 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %grey = OpVariable %_ptr_Function_float Function + %85 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %86 = OpLoad %float %85 + %87 = OpConvertFToS %int %86 + OpStore %i_2 %87 + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %i_2 + OpSelectionMerge %93 None + OpSwitch %92 %93 0 %94 1 %95 2 %96 3 %97 4 %98 5 %99 6 %100 7 %101 8 %102 9 %103 + %94 = OpLabel + %104 = OpLoad %int %i_2 + %105 = OpAccessChain %_ptr_Private_int %data %104 + OpStore %105 %int_4 + OpBranch %93 + %95 = OpLabel + %106 = OpLoad %int %i_2 + %107 = OpAccessChain %_ptr_Private_int %data %106 + OpStore %107 %int_3 + OpBranch %93 + %96 = OpLabel + %108 = OpLoad %int %i_2 + %109 = OpAccessChain %_ptr_Private_int %data %108 + OpStore %109 %int_2 + OpBranch %93 + %97 = OpLabel + %110 = OpLoad %int %i_2 + %111 = OpAccessChain %_ptr_Private_int %data %110 + OpStore %111 %int_1 + OpBranch %93 + %98 = OpLabel + %112 = OpLoad %int %i_2 + %113 = OpAccessChain %_ptr_Private_int %data %112 + OpStore %113 %int_0 + OpBranch %93 + %99 = OpLabel + %114 = OpLoad %int %i_2 + %115 = OpAccessChain %_ptr_Private_int %data %114 + OpStore %115 %int_n1 + OpBranch %93 + %100 = OpLabel + %116 = OpLoad %int %i_2 + %117 = OpAccessChain %_ptr_Private_int %data %116 + OpStore %117 %int_n2 + OpBranch %93 + %101 = OpLabel + %118 = OpLoad %int %i_2 + %119 = OpAccessChain %_ptr_Private_int %data %118 + OpStore %119 %int_n3 + OpBranch %93 + %102 = OpLabel + %120 = OpLoad %int %i_2 + %121 = OpAccessChain %_ptr_Private_int %data %120 + OpStore %121 %int_n4 + OpBranch %93 + %103 = OpLabel + %122 = OpLoad %int %i_2 + %123 = OpAccessChain %_ptr_Private_int %data %122 + OpStore %123 %int_n5 + OpBranch %93 + %93 = OpLabel + %124 = OpLoad %int %i_2 + %125 = OpIAdd %int %124 %int_1 + OpStore %i_2 %125 + OpBranch %90 + %90 = OpLabel + %126 = OpLoad %int %i_2 + %127 = OpSLessThan %bool %126 %int_10 + OpBranchConditional %127 %88 %89 + %89 = OpLabel + OpStore %j_0 %int_0 + OpBranch %128 + %128 = OpLabel + OpLoopMerge %129 %130 None + OpBranch %131 + %131 = OpLabel + %132 = OpLoad %int %j_0 + %133 = OpSLessThan %bool %132 %int_10 + %134 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %135 = OpLoad %float %134 + %136 = OpFUnordGreaterThan %bool %135 %float_1 + OpSelectionMerge %137 None + OpBranchConditional %136 %138 %137 + %138 = OpLabel + OpStore %grey %float_1 + OpBranchConditional %false %137 %137 + %137 = OpLabel + OpBranchConditional %133 %139 %129 + %139 = OpLabel + %140 = OpLoad %int %j_0 + %141 = OpLoad %int %j_0 + %142 = OpAccessChain %_ptr_Private_int %data %141 + %143 = OpLoad %int %142 + %144 = OpAccessChain %_ptr_Private_int %temp %140 + OpStore %144 %143 + OpBranch %130 + %130 = OpLabel + %145 = OpLoad %int %j_0 + %146 = OpIAdd %int %145 %int_1 + OpStore %j_0 %146 + OpBranch %128 + %129 = OpLabel + %147 = OpFunctionCall %void %mergeSort_ + %148 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %149 = OpLoad %float %148 + %150 = OpConvertFToS %int %149 + %151 = OpSLessThan %bool %150 %int_30 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %154 + %153 = OpLabel + %155 = OpAccessChain %_ptr_Private_int %data %int_0 + %156 = OpLoad %int %155 + %157 = OpConvertSToF %float %156 + %158 = OpFDiv %float %157 %float_10 + %159 = OpFAdd %float %float_0_5 %158 + OpStore %grey %159 + OpBranch %152 + %154 = OpLabel + %160 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %161 = OpLoad %float %160 + %162 = OpConvertFToS %int %161 + %163 = OpSLessThan %bool %162 %int_60 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %166 + %165 = OpLabel + %167 = OpAccessChain %_ptr_Private_int %data %int_1 + %168 = OpLoad %int %167 + %169 = OpConvertSToF %float %168 + %170 = OpFDiv %float %169 %float_10 + %171 = OpFAdd %float %float_0_5 %170 + OpStore %grey %171 + OpBranch %164 + %166 = OpLabel + %172 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %173 = OpLoad %float %172 + %174 = OpConvertFToS %int %173 + %175 = OpSLessThan %bool %174 %int_90 + OpSelectionMerge %176 None + OpBranchConditional %175 %177 %178 + %177 = OpLabel + %179 = OpAccessChain %_ptr_Private_int %data %int_2 + %180 = OpLoad %int %179 + %181 = OpConvertSToF %float %180 + %182 = OpFDiv %float %181 %float_10 + %183 = OpFAdd %float %float_0_5 %182 + OpStore %grey %183 + OpBranch %176 + %178 = OpLabel + %184 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %185 = OpLoad %float %184 + %186 = OpConvertFToS %int %185 + %187 = OpSLessThan %bool %186 %int_120 + OpSelectionMerge %188 None + OpBranchConditional %187 %189 %190 + %189 = OpLabel + %191 = OpAccessChain %_ptr_Private_int %data %int_3 + %192 = OpLoad %int %191 + %193 = OpConvertSToF %float %192 + %194 = OpFDiv %float %193 %float_10 + %195 = OpFAdd %float %float_0_5 %194 + OpStore %grey %195 + OpBranch %188 + %190 = OpLabel + %196 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %197 = OpLoad %float %196 + %198 = OpConvertFToS %int %197 + %199 = OpSLessThan %bool %198 %int_150 + OpSelectionMerge %200 None + OpBranchConditional %199 %201 %202 + %201 = OpLabel + OpKill + %202 = OpLabel + %203 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %204 = OpLoad %float %203 + %205 = OpConvertFToS %int %204 + %206 = OpSLessThan %bool %205 %int_180 + OpSelectionMerge %207 None + OpBranchConditional %206 %208 %209 + %208 = OpLabel + %210 = OpAccessChain %_ptr_Private_int %data %int_5 + %211 = OpLoad %int %210 + %212 = OpConvertSToF %float %211 + %213 = OpFDiv %float %212 %float_10 + %214 = OpFAdd %float %float_0_5 %213 + OpStore %grey %214 + OpBranch %207 + %209 = OpLabel + %215 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %216 = OpLoad %float %215 + %217 = OpConvertFToS %int %216 + %218 = OpSLessThan %bool %217 %int_210 + OpSelectionMerge %219 None + OpBranchConditional %218 %220 %221 + %220 = OpLabel + %222 = OpAccessChain %_ptr_Private_int %data %int_6 + %223 = OpLoad %int %222 + %224 = OpConvertSToF %float %223 + %225 = OpFDiv %float %224 %float_10 + %226 = OpFAdd %float %float_0_5 %225 + OpStore %grey %226 + OpBranch %219 + %221 = OpLabel + %227 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %228 = OpLoad %float %227 + %229 = OpConvertFToS %int %228 + %230 = OpSLessThan %bool %229 %int_240 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %233 + %232 = OpLabel + %234 = OpAccessChain %_ptr_Private_int %data %int_7 + %235 = OpLoad %int %234 + %236 = OpConvertSToF %float %235 + %237 = OpFDiv %float %236 %float_10 + %238 = OpFAdd %float %float_0_5 %237 + OpStore %grey %238 + OpBranch %231 + %233 = OpLabel + %239 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %240 = OpLoad %float %239 + %241 = OpConvertFToS %int %240 + %242 = OpSLessThan %bool %241 %int_270 + OpSelectionMerge %243 None + OpBranchConditional %242 %244 %245 + %244 = OpLabel + %246 = OpAccessChain %_ptr_Private_int %data %int_8 + %247 = OpLoad %int %246 + %248 = OpConvertSToF %float %247 + %249 = OpFDiv %float %248 %float_10 + %250 = OpFAdd %float %float_0_5 %249 + OpStore %grey %250 + OpBranch %243 + %245 = OpLabel + %251 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %252 = OpLoad %float %251 + %253 = OpFUnordGreaterThanEqual %bool %float_0 %252 + OpBranchConditional %253 %243 %254 + %254 = OpLabel + OpKill + %243 = OpLabel + OpBranch %231 + %231 = OpLabel + OpBranch %219 + %219 = OpLabel + OpBranch %207 + %207 = OpLabel + OpBranch %200 + %200 = OpLabel + OpBranch %188 + %188 = OpLabel + OpBranch %176 + %176 = OpLabel + OpBranch %164 + %164 = OpLabel + OpBranch %152 + %152 = OpLabel + %255 = OpLoad %float %grey + %256 = OpCompositeConstruct %v3float %255 %255 %255 + %257 = OpCompositeExtract %float %256 0 + %258 = OpCompositeExtract %float %256 1 + %259 = OpCompositeExtract %float %256 2 + %260 = OpCompositeConstruct %v4float %257 %258 %259 %float_1 + OpStore %_GLF_color %260 + OpReturn + OpFunctionEnd +%merge_i1_i1_i1_ = OpFunction %void None %35 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %261 = OpLabel + %k = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %262 = OpLoad %int %from + OpStore %k %262 + %263 = OpLoad %int %from + OpStore %i %263 + %264 = OpLoad %int %mid + %265 = OpIAdd %int %264 %int_1 + OpStore %j %265 + OpBranch %266 + %266 = OpLabel + OpLoopMerge %267 %268 None + OpBranch %269 + %269 = OpLabel + %270 = OpLoad %int %i + %271 = OpLoad %int %mid + %272 = OpSLessThanEqual %bool %270 %271 + %273 = OpLoad %int %j + %274 = OpLoad %int %to + %275 = OpSLessThanEqual %bool %273 %274 + %276 = OpLogicalAnd %bool %272 %275 + OpBranchConditional %276 %277 %267 + %277 = OpLabel + %278 = OpLoad %int %i + %279 = OpAccessChain %_ptr_Private_int %data %278 + %280 = OpLoad %int %279 + %281 = OpLoad %int %j + %282 = OpAccessChain %_ptr_Private_int %data %281 + %283 = OpLoad %int %282 + %284 = OpSLessThan %bool %280 %283 + OpSelectionMerge %285 None + OpBranchConditional %284 %286 %287 + %286 = OpLabel + %288 = OpLoad %int %k + %289 = OpIAdd %int %288 %int_1 + OpStore %k %289 + %290 = OpLoad %int %i + %291 = OpIAdd %int %290 %int_1 + OpStore %i %291 + %292 = OpAccessChain %_ptr_Private_int %data %290 + %293 = OpLoad %int %292 + %294 = OpAccessChain %_ptr_Private_int %temp %288 + OpStore %294 %293 + OpBranch %285 + %287 = OpLabel + %295 = OpLoad %int %k + %296 = OpIAdd %int %295 %int_1 + OpStore %k %296 + %297 = OpLoad %int %j + %298 = OpIAdd %int %297 %int_1 + OpStore %j %298 + %299 = OpAccessChain %_ptr_Private_int %data %297 + %300 = OpLoad %int %299 + %301 = OpAccessChain %_ptr_Private_int %temp %295 + OpStore %301 %300 + OpBranch %285 + %285 = OpLabel + OpBranch %268 + %268 = OpLabel + OpBranch %266 + %267 = OpLabel + OpBranch %302 + %302 = OpLabel + OpLoopMerge %303 %304 None + OpBranch %305 + %305 = OpLabel + %306 = OpLoad %int %i + %307 = OpSLessThan %bool %306 %int_10 + %308 = OpLoad %int %i + %309 = OpLoad %int %mid + %310 = OpSLessThanEqual %bool %308 %309 + %311 = OpLogicalAnd %bool %307 %310 + OpBranchConditional %311 %312 %303 + %312 = OpLabel + %313 = OpLoad %int %k + %314 = OpIAdd %int %313 %int_1 + OpStore %k %314 + %315 = OpLoad %int %i + %316 = OpIAdd %int %315 %int_1 + OpStore %i %316 + %317 = OpAccessChain %_ptr_Private_int %data %315 + %318 = OpLoad %int %317 + %319 = OpAccessChain %_ptr_Private_int %temp %313 + OpStore %319 %318 + OpBranch %304 + %304 = OpLabel + OpBranch %302 + %303 = OpLabel + %320 = OpLoad %int %from + OpStore %i_0 %320 + OpBranch %321 + %321 = OpLabel + OpLoopMerge %322 %323 None + OpBranch %324 + %324 = OpLabel + %325 = OpLoad %int %i_0 + %326 = OpLoad %int %to + %327 = OpSLessThanEqual %bool %325 %326 + OpBranchConditional %327 %328 %322 + %328 = OpLabel + %329 = OpLoad %int %i_0 + %330 = OpLoad %int %i_0 + %331 = OpAccessChain %_ptr_Private_int %temp %330 + %332 = OpLoad %int %331 + %333 = OpAccessChain %_ptr_Private_int %data %329 + OpStore %333 %332 + OpBranch %323 + %323 = OpLabel + %334 = OpLoad %int %i_0 + %335 = OpIAdd %int %334 %int_1 + OpStore %i_0 %335 + OpBranch %321 + %322 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %32 + %336 = OpLabel + %low = OpVariable %_ptr_Function_int Function + %high = OpVariable %_ptr_Function_int Function + %m = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %from_0 = OpVariable %_ptr_Function_int Function + %mid_0 = OpVariable %_ptr_Function_int Function + %to_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %337 + %337 = OpLabel + OpLoopMerge %338 %339 None + OpBranch %340 + %340 = OpLabel + %341 = OpLoad %int %m + %342 = OpLoad %int %high + %343 = OpSLessThanEqual %bool %341 %342 + OpBranchConditional %343 %344 %338 + %344 = OpLabel + %345 = OpLoad %int %low + OpStore %i_1 %345 + OpBranch %346 + %346 = OpLabel + OpLoopMerge %347 %348 None + OpBranch %349 + %349 = OpLabel + %350 = OpLoad %int %i_1 + %351 = OpLoad %int %high + %352 = OpSLessThan %bool %350 %351 + OpBranchConditional %352 %353 %347 + %353 = OpLabel + %354 = OpLoad %int %i_1 + OpStore %from_0 %354 + %355 = OpLoad %int %i_1 + %356 = OpLoad %int %m + %357 = OpIAdd %int %355 %356 + %358 = OpISub %int %357 %int_1 + OpStore %mid_0 %358 + %359 = OpLoad %int %i_1 + %360 = OpLoad %int %m + %361 = OpIMul %int %int_2 %360 + %362 = OpIAdd %int %359 %361 + %363 = OpISub %int %362 %int_1 + %364 = OpLoad %int %high + %365 = OpExtInst %int %1 SMin %363 %364 + OpStore %to_0 %365 + %366 = OpLoad %int %from_0 + OpStore %param %366 + %367 = OpLoad %int %mid_0 + OpStore %param_0 %367 + %368 = OpLoad %int %to_0 + OpStore %param_1 %368 + %369 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_0 %param_1 + OpBranch %348 + %348 = OpLabel + %370 = OpLoad %int %m + %371 = OpIMul %int %int_2 %370 + %372 = OpLoad %int %i_1 + %373 = OpIAdd %int %372 %371 + OpStore %i_1 %373 + OpBranch %346 + %347 = OpLabel + OpBranch %339 + %339 = OpLabel + %374 = OpLoad %int %m + %375 = OpIMul %int %int_2 %374 + OpStore %m %375 + OpBranch %337 + %338 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..b21b248eda --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.hlsl @@ -0,0 +1,288 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_262 = from; + k = x_262; + const int x_263 = from; + i = x_263; + const int x_264 = mid; + j = (x_264 + 1); + while (true) { + const int x_270 = i; + const int x_271 = mid; + const int x_273 = j; + const int x_274 = to; + bool tint_tmp = (x_270 <= x_271); + if (tint_tmp) { + tint_tmp = (x_273 <= x_274); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_280 = data[i]; + const int x_283 = data[j]; + if ((x_280 < x_283)) { + const int x_288 = k; + k = (x_288 + 1); + const int x_290 = i; + i = (x_290 + 1); + const int x_293 = data[x_290]; + temp[x_288] = x_293; + } else { + const int x_295 = k; + k = (x_295 + 1); + const int x_297 = j; + j = (x_297 + 1); + const int x_300 = data[x_297]; + temp[x_295] = x_300; + } + } + while (true) { + const int x_306 = i; + const int x_308 = i; + const int x_309 = mid; + bool tint_tmp_1 = (x_306 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_308 <= x_309); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_313 = k; + k = (x_313 + 1); + const int x_315 = i; + i = (x_315 + 1); + const int x_318 = data[x_315]; + temp[x_313] = x_318; + } + const int x_320 = from; + i_1 = x_320; + while (true) { + const int x_325 = i_1; + const int x_326 = to; + if ((x_325 <= x_326)) { + } else { + break; + } + const int x_329 = i_1; + const int x_332 = temp[i_1]; + data[x_329] = x_332; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_86 = asfloat(x_28[0].x); + i_3 = int(x_86); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + const bool x_133 = (j_1 < 10); + const float x_135 = asfloat(x_28[0].x); + if (!((x_135 <= 1.0f))) { + grey = 1.0f; + } + if (x_133) { + } else { + break; + } + const int x_140 = j_1; + const int x_143 = data[j_1]; + temp[x_140] = x_143; + { + j_1 = (j_1 + 1); + } + } + mergeSort_(); + const float x_149 = gl_FragCoord.y; + if ((int(x_149) < 30)) { + const int x_156 = data[0]; + grey = (0.5f + (float(x_156) / 10.0f)); + } else { + const float x_161 = gl_FragCoord.y; + if ((int(x_161) < 60)) { + const int x_168 = data[1]; + grey = (0.5f + (float(x_168) / 10.0f)); + } else { + const float x_173 = gl_FragCoord.y; + if ((int(x_173) < 90)) { + const int x_180 = data[2]; + grey = (0.5f + (float(x_180) / 10.0f)); + } else { + const float x_185 = gl_FragCoord.y; + if ((int(x_185) < 120)) { + const int x_192 = data[3]; + grey = (0.5f + (float(x_192) / 10.0f)); + } else { + const float x_197 = gl_FragCoord.y; + if ((int(x_197) < 150)) { + discard; + } else { + const float x_204 = gl_FragCoord.y; + if ((int(x_204) < 180)) { + const int x_211 = data[5]; + grey = (0.5f + (float(x_211) / 10.0f)); + } else { + const float x_216 = gl_FragCoord.y; + if ((int(x_216) < 210)) { + const int x_223 = data[6]; + grey = (0.5f + (float(x_223) / 10.0f)); + } else { + const float x_228 = gl_FragCoord.y; + if ((int(x_228) < 240)) { + const int x_235 = data[7]; + grey = (0.5f + (float(x_235) / 10.0f)); + } else { + const float x_240 = gl_FragCoord.y; + bool guard233 = true; + if ((int(x_240) < 270)) { + const int x_247 = data[8]; + grey = (0.5f + (float(x_247) / 10.0f)); + guard233 = false; + } else { + if (guard233) { + const float x_252 = asfloat(x_28[0].y); + if (!((0.0f < x_252))) { + guard233 = false; + } + if (guard233) { + discard; + } + } + } + } + } + } + } + } + } + } + } + const float x_255 = grey; + const float3 x_256 = float3(x_255, x_255, x_255); + x_GLF_color = float4(x_256.x, x_256.y, x_256.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.msl new file mode 100644 index 0000000000..941121e54e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.msl @@ -0,0 +1,329 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_262 = *(from); + k = x_262; + int const x_263 = *(from); + i = x_263; + int const x_264 = *(mid); + j = (x_264 + 1); + while (true) { + int const x_270 = i; + int const x_271 = *(mid); + int const x_273 = j; + int const x_274 = *(to); + if (((x_270 <= x_271) && (x_273 <= x_274))) { + } else { + break; + } + int const x_278 = i; + int const x_280 = (*(tint_symbol_5)).arr[x_278]; + int const x_281 = j; + int const x_283 = (*(tint_symbol_5)).arr[x_281]; + if ((x_280 < x_283)) { + int const x_288 = k; + k = (x_288 + 1); + int const x_290 = i; + i = (x_290 + 1); + int const x_293 = (*(tint_symbol_5)).arr[x_290]; + (*(tint_symbol_6)).arr[x_288] = x_293; + } else { + int const x_295 = k; + k = (x_295 + 1); + int const x_297 = j; + j = (x_297 + 1); + int const x_300 = (*(tint_symbol_5)).arr[x_297]; + (*(tint_symbol_6)).arr[x_295] = x_300; + } + } + while (true) { + int const x_306 = i; + int const x_308 = i; + int const x_309 = *(mid); + if (((x_306 < 10) && (x_308 <= x_309))) { + } else { + break; + } + int const x_313 = k; + k = (x_313 + 1); + int const x_315 = i; + i = (x_315 + 1); + int const x_318 = (*(tint_symbol_5)).arr[x_315]; + (*(tint_symbol_6)).arr[x_313] = x_318; + } + int const x_320 = *(from); + i_1 = x_320; + while (true) { + int const x_325 = i_1; + int const x_326 = *(to); + if ((x_325 <= x_326)) { + } else { + break; + } + int const x_329 = i_1; + int const x_330 = i_1; + int const x_332 = (*(tint_symbol_6)).arr[x_330]; + (*(tint_symbol_5)).arr[x_329] = x_332; + { + int const x_334 = i_1; + i_1 = (x_334 + 1); + } + } + return; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_341 = m; + int const x_342 = high; + if ((x_341 <= x_342)) { + } else { + break; + } + int const x_345 = low; + i_2 = x_345; + while (true) { + int const x_350 = i_2; + int const x_351 = high; + if ((x_350 < x_351)) { + } else { + break; + } + int const x_354 = i_2; + from_1 = x_354; + int const x_355 = i_2; + int const x_356 = m; + mid_1 = ((x_355 + x_356) - 1); + int const x_359 = i_2; + int const x_360 = m; + int const x_364 = high; + to_1 = min(((x_359 + (2 * x_360)) - 1), x_364); + int const x_366 = from_1; + param = x_366; + int const x_367 = mid_1; + param_1 = x_367; + int const x_368 = to_1; + param_2 = x_368; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_370 = m; + int const x_372 = i_2; + i_2 = (x_372 + (2 * x_370)); + } + } + { + int const x_374 = m; + m = (2 * x_374); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_86 = x_28.injectionSwitch.x; + i_3 = int(x_86); + while (true) { + int const x_92 = i_3; + switch(x_92) { + case 9: { + int const x_122 = i_3; + (*(tint_symbol_9)).arr[x_122] = -5; + break; + } + case 8: { + int const x_120 = i_3; + (*(tint_symbol_9)).arr[x_120] = -4; + break; + } + case 7: { + int const x_118 = i_3; + (*(tint_symbol_9)).arr[x_118] = -3; + break; + } + case 6: { + int const x_116 = i_3; + (*(tint_symbol_9)).arr[x_116] = -2; + break; + } + case 5: { + int const x_114 = i_3; + (*(tint_symbol_9)).arr[x_114] = -1; + break; + } + case 4: { + int const x_112 = i_3; + (*(tint_symbol_9)).arr[x_112] = 0; + break; + } + case 3: { + int const x_110 = i_3; + (*(tint_symbol_9)).arr[x_110] = 1; + break; + } + case 2: { + int const x_108 = i_3; + (*(tint_symbol_9)).arr[x_108] = 2; + break; + } + case 1: { + int const x_106 = i_3; + (*(tint_symbol_9)).arr[x_106] = 3; + break; + } + case 0: { + int const x_104 = i_3; + (*(tint_symbol_9)).arr[x_104] = 4; + break; + } + default: { + break; + } + } + int const x_124 = i_3; + i_3 = (x_124 + 1); + { + int const x_126 = i_3; + if ((x_126 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_132 = j_1; + bool const x_133 = (x_132 < 10); + float const x_135 = x_28.injectionSwitch.x; + if (!((x_135 <= 1.0f))) { + grey = 1.0f; + } + if (x_133) { + } else { + break; + } + int const x_140 = j_1; + int const x_141 = j_1; + int const x_143 = (*(tint_symbol_9)).arr[x_141]; + (*(tint_symbol_10)).arr[x_140] = x_143; + { + int const x_145 = j_1; + j_1 = (x_145 + 1); + } + } + mergeSort_(tint_symbol_9, tint_symbol_10); + float const x_149 = (*(tint_symbol_11)).y; + if ((int(x_149) < 30)) { + int const x_156 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_156) / 10.0f)); + } else { + float const x_161 = (*(tint_symbol_11)).y; + if ((int(x_161) < 60)) { + int const x_168 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_168) / 10.0f)); + } else { + float const x_173 = (*(tint_symbol_11)).y; + if ((int(x_173) < 90)) { + int const x_180 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_180) / 10.0f)); + } else { + float const x_185 = (*(tint_symbol_11)).y; + if ((int(x_185) < 120)) { + int const x_192 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_192) / 10.0f)); + } else { + float const x_197 = (*(tint_symbol_11)).y; + if ((int(x_197) < 150)) { + discard_fragment(); + } else { + float const x_204 = (*(tint_symbol_11)).y; + if ((int(x_204) < 180)) { + int const x_211 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_211) / 10.0f)); + } else { + float const x_216 = (*(tint_symbol_11)).y; + if ((int(x_216) < 210)) { + int const x_223 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_223) / 10.0f)); + } else { + float const x_228 = (*(tint_symbol_11)).y; + if ((int(x_228) < 240)) { + int const x_235 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_235) / 10.0f)); + } else { + float const x_240 = (*(tint_symbol_11)).y; + bool guard233 = true; + if ((int(x_240) < 270)) { + int const x_247 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_247) / 10.0f)); + guard233 = false; + } else { + if (guard233) { + float const x_252 = x_28.injectionSwitch.y; + if (!((0.0f < x_252))) { + guard233 = false; + } + if (guard233) { + discard_fragment(); + } + } + } + } + } + } + } + } + } + } + } + float const x_255 = grey; + float3 const x_256 = float3(x_255, x_255, x_255); + *(tint_symbol_12) = float4(x_256.x, x_256.y, x_256.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..e2ae2d94e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.spvasm @@ -0,0 +1,690 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 440 +; Schema: 0 + OpCapability Shader + %177 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %guard233 "guard233" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %132 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %201 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %393 = OpConstantNull %bool + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %false = OpConstantFalse %bool + %float_0 = OpConstant %float 0 + %v3float = OpTypeVector %float 3 + %main_out = OpTypeStruct %v4float + %427 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpLoad %int %mid + %51 = OpLoad %int %j + %53 = OpLoad %int %to + %54 = OpSLessThanEqual %bool %48 %50 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %58 = OpSLessThanEqual %bool %51 %53 + OpBranch %56 + %56 = OpLabel + %59 = OpPhi %bool %54 %47 %58 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %45 + %60 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Private_int %data %63 + %66 = OpLoad %int %65 + %67 = OpLoad %int %j + %68 = OpAccessChain %_ptr_Private_int %data %67 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %k + %75 = OpIAdd %int %74 %int_1 + OpStore %k %75 + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + %78 = OpAccessChain %_ptr_Private_int %data %76 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Private_int %temp %74 + OpStore %80 %79 + OpBranch %71 + %73 = OpLabel + %81 = OpLoad %int %k + %82 = OpIAdd %int %81 %int_1 + OpStore %k %82 + %83 = OpLoad %int %j + %84 = OpIAdd %int %83 %int_1 + OpStore %j %84 + %85 = OpAccessChain %_ptr_Private_int %data %83 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Private_int %temp %81 + OpStore %87 %86 + OpBranch %71 + %71 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpLoad %int %i + %95 = OpLoad %int %mid + %97 = OpSLessThan %bool %92 %int_10 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSLessThanEqual %bool %93 %95 + OpBranch %98 + %98 = OpLabel + %101 = OpPhi %bool %97 %91 %100 %99 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpBranch %102 + %104 = OpLabel + OpBranch %89 + %102 = OpLabel + %105 = OpLoad %int %k + %106 = OpIAdd %int %105 %int_1 + OpStore %k %106 + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + %109 = OpAccessChain %_ptr_Private_int %data %107 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Private_int %temp %105 + OpStore %111 %110 + OpBranch %90 + %90 = OpLabel + OpBranch %88 + %89 = OpLabel + %113 = OpLoad %int %from + OpStore %i_1 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpLoad %int %to + %121 = OpSLessThanEqual %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + OpBranch %122 + %124 = OpLabel + OpBranch %115 + %122 = OpLabel + %125 = OpLoad %int %i_1 + %126 = OpLoad %int %i_1 + %127 = OpAccessChain %_ptr_Private_int %temp %126 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %129 %128 + OpBranch %116 + %116 = OpLabel + %130 = OpLoad %int %i_1 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_1 %131 + OpBranch %114 + %115 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %132 + %134 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %151 = OpLoad %int %m + %152 = OpLoad %int %high + %153 = OpSLessThanEqual %bool %151 %152 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + OpBranch %154 + %156 = OpLabel + OpBranch %148 + %154 = OpLabel + %157 = OpLoad %int %low + OpStore %i_2 %157 + OpBranch %158 + %158 = OpLabel + OpLoopMerge %159 %160 None + OpBranch %161 + %161 = OpLabel + %162 = OpLoad %int %i_2 + %163 = OpLoad %int %high + %164 = OpSLessThan %bool %162 %163 + OpSelectionMerge %165 None + OpBranchConditional %164 %166 %167 + %166 = OpLabel + OpBranch %165 + %167 = OpLabel + OpBranch %159 + %165 = OpLabel + %168 = OpLoad %int %i_2 + OpStore %from_1 %168 + %169 = OpLoad %int %i_2 + %170 = OpLoad %int %m + %171 = OpIAdd %int %169 %170 + %172 = OpISub %int %171 %int_1 + OpStore %mid_1 %172 + %173 = OpLoad %int %i_2 + %174 = OpLoad %int %m + %175 = OpLoad %int %high + %179 = OpIMul %int %int_2 %174 + %180 = OpIAdd %int %173 %179 + %181 = OpISub %int %180 %int_1 + %176 = OpExtInst %int %177 SMin %181 %175 + OpStore %to_1 %176 + %182 = OpLoad %int %from_1 + OpStore %param %182 + %183 = OpLoad %int %mid_1 + OpStore %param_1 %183 + %184 = OpLoad %int %to_1 + OpStore %param_2 %184 + %185 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %160 + %160 = OpLabel + %189 = OpLoad %int %m + %190 = OpLoad %int %i_2 + %191 = OpIMul %int %int_2 %189 + %192 = OpIAdd %int %190 %191 + OpStore %i_2 %192 + OpBranch %158 + %159 = OpLabel + OpBranch %149 + %149 = OpLabel + %193 = OpLoad %int %m + %194 = OpIMul %int %int_2 %193 + OpStore %m %194 + OpBranch %147 + %148 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %132 + %196 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %201 + %guard233 = OpVariable %_ptr_Function_bool Function %393 + %204 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %205 = OpLoad %float %204 + %206 = OpConvertFToS %int %205 + OpStore %i_3 %206 + OpBranch %207 + %207 = OpLabel + OpLoopMerge %208 %209 None + OpBranch %210 + %210 = OpLabel + %211 = OpLoad %int %i_3 + OpSelectionMerge %212 None + OpSwitch %211 %213 9 %214 8 %215 7 %216 6 %217 5 %218 4 %219 3 %220 2 %221 1 %222 0 %223 + %214 = OpLabel + %224 = OpLoad %int %i_3 + %225 = OpAccessChain %_ptr_Private_int %data %224 + OpStore %225 %int_n5 + OpBranch %212 + %215 = OpLabel + %227 = OpLoad %int %i_3 + %228 = OpAccessChain %_ptr_Private_int %data %227 + OpStore %228 %int_n4 + OpBranch %212 + %216 = OpLabel + %230 = OpLoad %int %i_3 + %231 = OpAccessChain %_ptr_Private_int %data %230 + OpStore %231 %int_n3 + OpBranch %212 + %217 = OpLabel + %233 = OpLoad %int %i_3 + %234 = OpAccessChain %_ptr_Private_int %data %233 + OpStore %234 %int_n2 + OpBranch %212 + %218 = OpLabel + %236 = OpLoad %int %i_3 + %237 = OpAccessChain %_ptr_Private_int %data %236 + OpStore %237 %int_n1 + OpBranch %212 + %219 = OpLabel + %239 = OpLoad %int %i_3 + %240 = OpAccessChain %_ptr_Private_int %data %239 + OpStore %240 %int_0 + OpBranch %212 + %220 = OpLabel + %241 = OpLoad %int %i_3 + %242 = OpAccessChain %_ptr_Private_int %data %241 + OpStore %242 %int_1 + OpBranch %212 + %221 = OpLabel + %243 = OpLoad %int %i_3 + %244 = OpAccessChain %_ptr_Private_int %data %243 + OpStore %244 %int_2 + OpBranch %212 + %222 = OpLabel + %245 = OpLoad %int %i_3 + %246 = OpAccessChain %_ptr_Private_int %data %245 + OpStore %246 %int_3 + OpBranch %212 + %223 = OpLabel + %248 = OpLoad %int %i_3 + %249 = OpAccessChain %_ptr_Private_int %data %248 + OpStore %249 %int_4 + OpBranch %212 + %213 = OpLabel + OpBranch %212 + %212 = OpLabel + %251 = OpLoad %int %i_3 + %252 = OpIAdd %int %251 %int_1 + OpStore %i_3 %252 + OpBranch %209 + %209 = OpLabel + %253 = OpLoad %int %i_3 + %254 = OpSLessThan %bool %253 %int_10 + OpSelectionMerge %255 None + OpBranchConditional %254 %256 %257 + %256 = OpLabel + OpBranch %255 + %257 = OpLabel + OpBranch %208 + %255 = OpLabel + OpBranch %207 + %208 = OpLabel + OpStore %j_1 %int_0 + OpBranch %258 + %258 = OpLabel + OpLoopMerge %259 %260 None + OpBranch %261 + %261 = OpLabel + %262 = OpLoad %int %j_1 + %263 = OpSLessThan %bool %262 %int_10 + %264 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %265 = OpLoad %float %264 + %268 = OpFOrdLessThanEqual %bool %265 %float_1 + %266 = OpLogicalNot %bool %268 + OpSelectionMerge %269 None + OpBranchConditional %266 %270 %269 + %270 = OpLabel + OpStore %grey %float_1 + OpBranch %269 + %269 = OpLabel + OpSelectionMerge %271 None + OpBranchConditional %263 %272 %273 + %272 = OpLabel + OpBranch %271 + %273 = OpLabel + OpBranch %259 + %271 = OpLabel + %274 = OpLoad %int %j_1 + %275 = OpLoad %int %j_1 + %276 = OpAccessChain %_ptr_Private_int %data %275 + %277 = OpLoad %int %276 + %278 = OpAccessChain %_ptr_Private_int %temp %274 + OpStore %278 %277 + OpBranch %260 + %260 = OpLabel + %279 = OpLoad %int %j_1 + %280 = OpIAdd %int %279 %int_1 + OpStore %j_1 %280 + OpBranch %258 + %259 = OpLabel + %281 = OpFunctionCall %void %mergeSort_ + %284 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %285 = OpLoad %float %284 + %286 = OpConvertFToS %int %285 + %288 = OpSLessThan %bool %286 %int_30 + OpSelectionMerge %289 None + OpBranchConditional %288 %290 %291 + %290 = OpLabel + %292 = OpAccessChain %_ptr_Private_int %data %int_0 + %293 = OpLoad %int %292 + %295 = OpConvertSToF %float %293 + %297 = OpFDiv %float %295 %float_10 + %298 = OpFAdd %float %float_0_5 %297 + OpStore %grey %298 + OpBranch %289 + %291 = OpLabel + %299 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %300 = OpLoad %float %299 + %301 = OpConvertFToS %int %300 + %303 = OpSLessThan %bool %301 %int_60 + OpSelectionMerge %304 None + OpBranchConditional %303 %305 %306 + %305 = OpLabel + %307 = OpAccessChain %_ptr_Private_int %data %int_1 + %308 = OpLoad %int %307 + %309 = OpConvertSToF %float %308 + %310 = OpFDiv %float %309 %float_10 + %311 = OpFAdd %float %float_0_5 %310 + OpStore %grey %311 + OpBranch %304 + %306 = OpLabel + %312 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %313 = OpLoad %float %312 + %314 = OpConvertFToS %int %313 + %316 = OpSLessThan %bool %314 %int_90 + OpSelectionMerge %317 None + OpBranchConditional %316 %318 %319 + %318 = OpLabel + %320 = OpAccessChain %_ptr_Private_int %data %int_2 + %321 = OpLoad %int %320 + %322 = OpConvertSToF %float %321 + %323 = OpFDiv %float %322 %float_10 + %324 = OpFAdd %float %float_0_5 %323 + OpStore %grey %324 + OpBranch %317 + %319 = OpLabel + %325 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %326 = OpLoad %float %325 + %327 = OpConvertFToS %int %326 + %329 = OpSLessThan %bool %327 %int_120 + OpSelectionMerge %330 None + OpBranchConditional %329 %331 %332 + %331 = OpLabel + %333 = OpAccessChain %_ptr_Private_int %data %int_3 + %334 = OpLoad %int %333 + %335 = OpConvertSToF %float %334 + %336 = OpFDiv %float %335 %float_10 + %337 = OpFAdd %float %float_0_5 %336 + OpStore %grey %337 + OpBranch %330 + %332 = OpLabel + %338 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %339 = OpLoad %float %338 + %340 = OpConvertFToS %int %339 + %342 = OpSLessThan %bool %340 %int_150 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %345 + %344 = OpLabel + OpKill + %345 = OpLabel + %346 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %347 = OpLoad %float %346 + %348 = OpConvertFToS %int %347 + %350 = OpSLessThan %bool %348 %int_180 + OpSelectionMerge %351 None + OpBranchConditional %350 %352 %353 + %352 = OpLabel + %355 = OpAccessChain %_ptr_Private_int %data %int_5 + %356 = OpLoad %int %355 + %357 = OpConvertSToF %float %356 + %358 = OpFDiv %float %357 %float_10 + %359 = OpFAdd %float %float_0_5 %358 + OpStore %grey %359 + OpBranch %351 + %353 = OpLabel + %360 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %361 = OpLoad %float %360 + %362 = OpConvertFToS %int %361 + %364 = OpSLessThan %bool %362 %int_210 + OpSelectionMerge %365 None + OpBranchConditional %364 %366 %367 + %366 = OpLabel + %369 = OpAccessChain %_ptr_Private_int %data %int_6 + %370 = OpLoad %int %369 + %371 = OpConvertSToF %float %370 + %372 = OpFDiv %float %371 %float_10 + %373 = OpFAdd %float %float_0_5 %372 + OpStore %grey %373 + OpBranch %365 + %367 = OpLabel + %374 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %375 = OpLoad %float %374 + %376 = OpConvertFToS %int %375 + %378 = OpSLessThan %bool %376 %int_240 + OpSelectionMerge %379 None + OpBranchConditional %378 %380 %381 + %380 = OpLabel + %383 = OpAccessChain %_ptr_Private_int %data %int_7 + %384 = OpLoad %int %383 + %385 = OpConvertSToF %float %384 + %386 = OpFDiv %float %385 %float_10 + %387 = OpFAdd %float %float_0_5 %386 + OpStore %grey %387 + OpBranch %379 + %381 = OpLabel + %388 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %389 = OpLoad %float %388 + OpStore %guard233 %true + %394 = OpConvertFToS %int %389 + %396 = OpSLessThan %bool %394 %int_270 + OpSelectionMerge %397 None + OpBranchConditional %396 %398 %399 + %398 = OpLabel + %401 = OpAccessChain %_ptr_Private_int %data %int_8 + %402 = OpLoad %int %401 + %403 = OpConvertSToF %float %402 + %404 = OpFDiv %float %403 %float_10 + %405 = OpFAdd %float %float_0_5 %404 + OpStore %grey %405 + OpStore %guard233 %false + OpBranch %397 + %399 = OpLabel + %407 = OpLoad %bool %guard233 + OpSelectionMerge %408 None + OpBranchConditional %407 %409 %408 + %409 = OpLabel + %410 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %411 = OpLoad %float %410 + %414 = OpFOrdLessThan %bool %float_0 %411 + %412 = OpLogicalNot %bool %414 + OpSelectionMerge %415 None + OpBranchConditional %412 %416 %415 + %416 = OpLabel + OpStore %guard233 %false + OpBranch %415 + %415 = OpLabel + %417 = OpLoad %bool %guard233 + OpSelectionMerge %418 None + OpBranchConditional %417 %419 %418 + %419 = OpLabel + OpKill + %418 = OpLabel + OpBranch %408 + %408 = OpLabel + OpBranch %397 + %397 = OpLabel + OpBranch %379 + %379 = OpLabel + OpBranch %365 + %365 = OpLabel + OpBranch %351 + %351 = OpLabel + OpBranch %343 + %343 = OpLabel + OpBranch %330 + %330 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %304 + %304 = OpLabel + OpBranch %289 + %289 = OpLabel + %420 = OpLoad %float %grey + %422 = OpCompositeConstruct %v3float %420 %420 %420 + %423 = OpCompositeExtract %float %422 0 + %424 = OpCompositeExtract %float %422 1 + %425 = OpCompositeExtract %float %422 2 + %426 = OpCompositeConstruct %v4float %423 %424 %425 %float_1 + OpStore %x_GLF_color %426 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %427 +%tint_symbol_1 = OpFunctionParameter %main_out + %431 = OpLabel + %432 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %432 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %132 + %434 = OpLabel + %435 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %435 + %436 = OpFunctionCall %void %main_1 + %438 = OpLoad %v4float %x_GLF_color + %439 = OpCompositeConstruct %main_out %438 + %437 = OpFunctionCall %void %tint_symbol_3 %439 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 209[%209] is not post dominated by the back-edge block 255[%255] + %255 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..4e442a361d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.spvasm.expected.wgsl @@ -0,0 +1,321 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_262 : i32 = *(from); + k = x_262; + let x_263 : i32 = *(from); + i = x_263; + let x_264 : i32 = *(mid); + j = (x_264 + 1); + loop { + let x_270 : i32 = i; + let x_271 : i32 = *(mid); + let x_273 : i32 = j; + let x_274 : i32 = *(to); + if (((x_270 <= x_271) && (x_273 <= x_274))) { + } else { + break; + } + let x_278 : i32 = i; + let x_280 : i32 = data[x_278]; + let x_281 : i32 = j; + let x_283 : i32 = data[x_281]; + if ((x_280 < x_283)) { + let x_288 : i32 = k; + k = (x_288 + 1); + let x_290 : i32 = i; + i = (x_290 + 1); + let x_293 : i32 = data[x_290]; + temp[x_288] = x_293; + } else { + let x_295 : i32 = k; + k = (x_295 + 1); + let x_297 : i32 = j; + j = (x_297 + 1); + let x_300 : i32 = data[x_297]; + temp[x_295] = x_300; + } + } + loop { + let x_306 : i32 = i; + let x_308 : i32 = i; + let x_309 : i32 = *(mid); + if (((x_306 < 10) && (x_308 <= x_309))) { + } else { + break; + } + let x_313 : i32 = k; + k = (x_313 + 1); + let x_315 : i32 = i; + i = (x_315 + 1); + let x_318 : i32 = data[x_315]; + temp[x_313] = x_318; + } + let x_320 : i32 = *(from); + i_1 = x_320; + loop { + let x_325 : i32 = i_1; + let x_326 : i32 = *(to); + if ((x_325 <= x_326)) { + } else { + break; + } + let x_329 : i32 = i_1; + let x_330 : i32 = i_1; + let x_332 : i32 = temp[x_330]; + data[x_329] = x_332; + + continuing { + let x_334 : i32 = i_1; + i_1 = (x_334 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_341 : i32 = m; + let x_342 : i32 = high; + if ((x_341 <= x_342)) { + } else { + break; + } + let x_345 : i32 = low; + i_2 = x_345; + loop { + let x_350 : i32 = i_2; + let x_351 : i32 = high; + if ((x_350 < x_351)) { + } else { + break; + } + let x_354 : i32 = i_2; + from_1 = x_354; + let x_355 : i32 = i_2; + let x_356 : i32 = m; + mid_1 = ((x_355 + x_356) - 1); + let x_359 : i32 = i_2; + let x_360 : i32 = m; + let x_364 : i32 = high; + to_1 = min(((x_359 + (2 * x_360)) - 1), x_364); + let x_366 : i32 = from_1; + param = x_366; + let x_367 : i32 = mid_1; + param_1 = x_367; + let x_368 : i32 = to_1; + param_2 = x_368; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_370 : i32 = m; + let x_372 : i32 = i_2; + i_2 = (x_372 + (2 * x_370)); + } + } + + continuing { + let x_374 : i32 = m; + m = (2 * x_374); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_86 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_86); + loop { + let x_92 : i32 = i_3; + switch(x_92) { + case 9: { + let x_122 : i32 = i_3; + data[x_122] = -5; + } + case 8: { + let x_120 : i32 = i_3; + data[x_120] = -4; + } + case 7: { + let x_118 : i32 = i_3; + data[x_118] = -3; + } + case 6: { + let x_116 : i32 = i_3; + data[x_116] = -2; + } + case 5: { + let x_114 : i32 = i_3; + data[x_114] = -1; + } + case 4: { + let x_112 : i32 = i_3; + data[x_112] = 0; + } + case 3: { + let x_110 : i32 = i_3; + data[x_110] = 1; + } + case 2: { + let x_108 : i32 = i_3; + data[x_108] = 2; + } + case 1: { + let x_106 : i32 = i_3; + data[x_106] = 3; + } + case 0: { + let x_104 : i32 = i_3; + data[x_104] = 4; + } + default: { + } + } + let x_124 : i32 = i_3; + i_3 = (x_124 + 1); + + continuing { + let x_126 : i32 = i_3; + if ((x_126 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_132 : i32 = j_1; + let x_133 : bool = (x_132 < 10); + let x_135 : f32 = x_28.injectionSwitch.x; + if (!((x_135 <= 1.0))) { + grey = 1.0; + } + if (x_133) { + } else { + break; + } + let x_140 : i32 = j_1; + let x_141 : i32 = j_1; + let x_143 : i32 = data[x_141]; + temp[x_140] = x_143; + + continuing { + let x_145 : i32 = j_1; + j_1 = (x_145 + 1); + } + } + mergeSort_(); + let x_149 : f32 = gl_FragCoord.y; + if ((i32(x_149) < 30)) { + let x_156 : i32 = data[0]; + grey = (0.5 + (f32(x_156) / 10.0)); + } else { + let x_161 : f32 = gl_FragCoord.y; + if ((i32(x_161) < 60)) { + let x_168 : i32 = data[1]; + grey = (0.5 + (f32(x_168) / 10.0)); + } else { + let x_173 : f32 = gl_FragCoord.y; + if ((i32(x_173) < 90)) { + let x_180 : i32 = data[2]; + grey = (0.5 + (f32(x_180) / 10.0)); + } else { + let x_185 : f32 = gl_FragCoord.y; + if ((i32(x_185) < 120)) { + let x_192 : i32 = data[3]; + grey = (0.5 + (f32(x_192) / 10.0)); + } else { + let x_197 : f32 = gl_FragCoord.y; + if ((i32(x_197) < 150)) { + discard; + } else { + let x_204 : f32 = gl_FragCoord.y; + if ((i32(x_204) < 180)) { + let x_211 : i32 = data[5]; + grey = (0.5 + (f32(x_211) / 10.0)); + } else { + let x_216 : f32 = gl_FragCoord.y; + if ((i32(x_216) < 210)) { + let x_223 : i32 = data[6]; + grey = (0.5 + (f32(x_223) / 10.0)); + } else { + let x_228 : f32 = gl_FragCoord.y; + if ((i32(x_228) < 240)) { + let x_235 : i32 = data[7]; + grey = (0.5 + (f32(x_235) / 10.0)); + } else { + let x_240 : f32 = gl_FragCoord.y; + var guard233 : bool = true; + if ((i32(x_240) < 270)) { + let x_247 : i32 = data[8]; + grey = (0.5 + (f32(x_247) / 10.0)); + guard233 = false; + } else { + if (guard233) { + let x_252 : f32 = x_28.injectionSwitch.y; + if (!((0.0 < x_252))) { + guard233 = false; + } + if (guard233) { + discard; + } + } + } + } + } + } + } + } + } + } + } + let x_255 : f32 = grey; + let x_256 : vec3 = vec3(x_255, x_255, x_255); + x_GLF_color = vec4(x_256.x, x_256.y, x_256.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl new file mode 100644 index 0000000000..4e442a361d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl @@ -0,0 +1,321 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_262 : i32 = *(from); + k = x_262; + let x_263 : i32 = *(from); + i = x_263; + let x_264 : i32 = *(mid); + j = (x_264 + 1); + loop { + let x_270 : i32 = i; + let x_271 : i32 = *(mid); + let x_273 : i32 = j; + let x_274 : i32 = *(to); + if (((x_270 <= x_271) && (x_273 <= x_274))) { + } else { + break; + } + let x_278 : i32 = i; + let x_280 : i32 = data[x_278]; + let x_281 : i32 = j; + let x_283 : i32 = data[x_281]; + if ((x_280 < x_283)) { + let x_288 : i32 = k; + k = (x_288 + 1); + let x_290 : i32 = i; + i = (x_290 + 1); + let x_293 : i32 = data[x_290]; + temp[x_288] = x_293; + } else { + let x_295 : i32 = k; + k = (x_295 + 1); + let x_297 : i32 = j; + j = (x_297 + 1); + let x_300 : i32 = data[x_297]; + temp[x_295] = x_300; + } + } + loop { + let x_306 : i32 = i; + let x_308 : i32 = i; + let x_309 : i32 = *(mid); + if (((x_306 < 10) && (x_308 <= x_309))) { + } else { + break; + } + let x_313 : i32 = k; + k = (x_313 + 1); + let x_315 : i32 = i; + i = (x_315 + 1); + let x_318 : i32 = data[x_315]; + temp[x_313] = x_318; + } + let x_320 : i32 = *(from); + i_1 = x_320; + loop { + let x_325 : i32 = i_1; + let x_326 : i32 = *(to); + if ((x_325 <= x_326)) { + } else { + break; + } + let x_329 : i32 = i_1; + let x_330 : i32 = i_1; + let x_332 : i32 = temp[x_330]; + data[x_329] = x_332; + + continuing { + let x_334 : i32 = i_1; + i_1 = (x_334 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_341 : i32 = m; + let x_342 : i32 = high; + if ((x_341 <= x_342)) { + } else { + break; + } + let x_345 : i32 = low; + i_2 = x_345; + loop { + let x_350 : i32 = i_2; + let x_351 : i32 = high; + if ((x_350 < x_351)) { + } else { + break; + } + let x_354 : i32 = i_2; + from_1 = x_354; + let x_355 : i32 = i_2; + let x_356 : i32 = m; + mid_1 = ((x_355 + x_356) - 1); + let x_359 : i32 = i_2; + let x_360 : i32 = m; + let x_364 : i32 = high; + to_1 = min(((x_359 + (2 * x_360)) - 1), x_364); + let x_366 : i32 = from_1; + param = x_366; + let x_367 : i32 = mid_1; + param_1 = x_367; + let x_368 : i32 = to_1; + param_2 = x_368; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_370 : i32 = m; + let x_372 : i32 = i_2; + i_2 = (x_372 + (2 * x_370)); + } + } + + continuing { + let x_374 : i32 = m; + m = (2 * x_374); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_86 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_86); + loop { + let x_92 : i32 = i_3; + switch(x_92) { + case 9: { + let x_122 : i32 = i_3; + data[x_122] = -5; + } + case 8: { + let x_120 : i32 = i_3; + data[x_120] = -4; + } + case 7: { + let x_118 : i32 = i_3; + data[x_118] = -3; + } + case 6: { + let x_116 : i32 = i_3; + data[x_116] = -2; + } + case 5: { + let x_114 : i32 = i_3; + data[x_114] = -1; + } + case 4: { + let x_112 : i32 = i_3; + data[x_112] = 0; + } + case 3: { + let x_110 : i32 = i_3; + data[x_110] = 1; + } + case 2: { + let x_108 : i32 = i_3; + data[x_108] = 2; + } + case 1: { + let x_106 : i32 = i_3; + data[x_106] = 3; + } + case 0: { + let x_104 : i32 = i_3; + data[x_104] = 4; + } + default: { + } + } + let x_124 : i32 = i_3; + i_3 = (x_124 + 1); + + continuing { + let x_126 : i32 = i_3; + if ((x_126 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_132 : i32 = j_1; + let x_133 : bool = (x_132 < 10); + let x_135 : f32 = x_28.injectionSwitch.x; + if (!((x_135 <= 1.0))) { + grey = 1.0; + } + if (x_133) { + } else { + break; + } + let x_140 : i32 = j_1; + let x_141 : i32 = j_1; + let x_143 : i32 = data[x_141]; + temp[x_140] = x_143; + + continuing { + let x_145 : i32 = j_1; + j_1 = (x_145 + 1); + } + } + mergeSort_(); + let x_149 : f32 = gl_FragCoord.y; + if ((i32(x_149) < 30)) { + let x_156 : i32 = data[0]; + grey = (0.5 + (f32(x_156) / 10.0)); + } else { + let x_161 : f32 = gl_FragCoord.y; + if ((i32(x_161) < 60)) { + let x_168 : i32 = data[1]; + grey = (0.5 + (f32(x_168) / 10.0)); + } else { + let x_173 : f32 = gl_FragCoord.y; + if ((i32(x_173) < 90)) { + let x_180 : i32 = data[2]; + grey = (0.5 + (f32(x_180) / 10.0)); + } else { + let x_185 : f32 = gl_FragCoord.y; + if ((i32(x_185) < 120)) { + let x_192 : i32 = data[3]; + grey = (0.5 + (f32(x_192) / 10.0)); + } else { + let x_197 : f32 = gl_FragCoord.y; + if ((i32(x_197) < 150)) { + discard; + } else { + let x_204 : f32 = gl_FragCoord.y; + if ((i32(x_204) < 180)) { + let x_211 : i32 = data[5]; + grey = (0.5 + (f32(x_211) / 10.0)); + } else { + let x_216 : f32 = gl_FragCoord.y; + if ((i32(x_216) < 210)) { + let x_223 : i32 = data[6]; + grey = (0.5 + (f32(x_223) / 10.0)); + } else { + let x_228 : f32 = gl_FragCoord.y; + if ((i32(x_228) < 240)) { + let x_235 : i32 = data[7]; + grey = (0.5 + (f32(x_235) / 10.0)); + } else { + let x_240 : f32 = gl_FragCoord.y; + var guard233 : bool = true; + if ((i32(x_240) < 270)) { + let x_247 : i32 = data[8]; + grey = (0.5 + (f32(x_247) / 10.0)); + guard233 = false; + } else { + if (guard233) { + let x_252 : f32 = x_28.injectionSwitch.y; + if (!((0.0 < x_252))) { + guard233 = false; + } + if (guard233) { + discard; + } + } + } + } + } + } + } + } + } + } + } + let x_255 : f32 = grey; + let x_256 : vec3 = vec3(x_255, x_255, x_255); + x_GLF_color = vec4(x_256.x, x_256.y, x_256.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..b21b248eda --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.hlsl @@ -0,0 +1,288 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_262 = from; + k = x_262; + const int x_263 = from; + i = x_263; + const int x_264 = mid; + j = (x_264 + 1); + while (true) { + const int x_270 = i; + const int x_271 = mid; + const int x_273 = j; + const int x_274 = to; + bool tint_tmp = (x_270 <= x_271); + if (tint_tmp) { + tint_tmp = (x_273 <= x_274); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_280 = data[i]; + const int x_283 = data[j]; + if ((x_280 < x_283)) { + const int x_288 = k; + k = (x_288 + 1); + const int x_290 = i; + i = (x_290 + 1); + const int x_293 = data[x_290]; + temp[x_288] = x_293; + } else { + const int x_295 = k; + k = (x_295 + 1); + const int x_297 = j; + j = (x_297 + 1); + const int x_300 = data[x_297]; + temp[x_295] = x_300; + } + } + while (true) { + const int x_306 = i; + const int x_308 = i; + const int x_309 = mid; + bool tint_tmp_1 = (x_306 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_308 <= x_309); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_313 = k; + k = (x_313 + 1); + const int x_315 = i; + i = (x_315 + 1); + const int x_318 = data[x_315]; + temp[x_313] = x_318; + } + const int x_320 = from; + i_1 = x_320; + while (true) { + const int x_325 = i_1; + const int x_326 = to; + if ((x_325 <= x_326)) { + } else { + break; + } + const int x_329 = i_1; + const int x_332 = temp[i_1]; + data[x_329] = x_332; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_86 = asfloat(x_28[0].x); + i_3 = int(x_86); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + const bool x_133 = (j_1 < 10); + const float x_135 = asfloat(x_28[0].x); + if (!((x_135 <= 1.0f))) { + grey = 1.0f; + } + if (x_133) { + } else { + break; + } + const int x_140 = j_1; + const int x_143 = data[j_1]; + temp[x_140] = x_143; + { + j_1 = (j_1 + 1); + } + } + mergeSort_(); + const float x_149 = gl_FragCoord.y; + if ((int(x_149) < 30)) { + const int x_156 = data[0]; + grey = (0.5f + (float(x_156) / 10.0f)); + } else { + const float x_161 = gl_FragCoord.y; + if ((int(x_161) < 60)) { + const int x_168 = data[1]; + grey = (0.5f + (float(x_168) / 10.0f)); + } else { + const float x_173 = gl_FragCoord.y; + if ((int(x_173) < 90)) { + const int x_180 = data[2]; + grey = (0.5f + (float(x_180) / 10.0f)); + } else { + const float x_185 = gl_FragCoord.y; + if ((int(x_185) < 120)) { + const int x_192 = data[3]; + grey = (0.5f + (float(x_192) / 10.0f)); + } else { + const float x_197 = gl_FragCoord.y; + if ((int(x_197) < 150)) { + discard; + } else { + const float x_204 = gl_FragCoord.y; + if ((int(x_204) < 180)) { + const int x_211 = data[5]; + grey = (0.5f + (float(x_211) / 10.0f)); + } else { + const float x_216 = gl_FragCoord.y; + if ((int(x_216) < 210)) { + const int x_223 = data[6]; + grey = (0.5f + (float(x_223) / 10.0f)); + } else { + const float x_228 = gl_FragCoord.y; + if ((int(x_228) < 240)) { + const int x_235 = data[7]; + grey = (0.5f + (float(x_235) / 10.0f)); + } else { + const float x_240 = gl_FragCoord.y; + bool guard233 = true; + if ((int(x_240) < 270)) { + const int x_247 = data[8]; + grey = (0.5f + (float(x_247) / 10.0f)); + guard233 = false; + } else { + if (guard233) { + const float x_252 = asfloat(x_28[0].y); + if (!((0.0f < x_252))) { + guard233 = false; + } + if (guard233) { + discard; + } + } + } + } + } + } + } + } + } + } + } + const float x_255 = grey; + const float3 x_256 = float3(x_255, x_255, x_255); + x_GLF_color = float4(x_256.x, x_256.y, x_256.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.msl new file mode 100644 index 0000000000..941121e54e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.msl @@ -0,0 +1,329 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_262 = *(from); + k = x_262; + int const x_263 = *(from); + i = x_263; + int const x_264 = *(mid); + j = (x_264 + 1); + while (true) { + int const x_270 = i; + int const x_271 = *(mid); + int const x_273 = j; + int const x_274 = *(to); + if (((x_270 <= x_271) && (x_273 <= x_274))) { + } else { + break; + } + int const x_278 = i; + int const x_280 = (*(tint_symbol_5)).arr[x_278]; + int const x_281 = j; + int const x_283 = (*(tint_symbol_5)).arr[x_281]; + if ((x_280 < x_283)) { + int const x_288 = k; + k = (x_288 + 1); + int const x_290 = i; + i = (x_290 + 1); + int const x_293 = (*(tint_symbol_5)).arr[x_290]; + (*(tint_symbol_6)).arr[x_288] = x_293; + } else { + int const x_295 = k; + k = (x_295 + 1); + int const x_297 = j; + j = (x_297 + 1); + int const x_300 = (*(tint_symbol_5)).arr[x_297]; + (*(tint_symbol_6)).arr[x_295] = x_300; + } + } + while (true) { + int const x_306 = i; + int const x_308 = i; + int const x_309 = *(mid); + if (((x_306 < 10) && (x_308 <= x_309))) { + } else { + break; + } + int const x_313 = k; + k = (x_313 + 1); + int const x_315 = i; + i = (x_315 + 1); + int const x_318 = (*(tint_symbol_5)).arr[x_315]; + (*(tint_symbol_6)).arr[x_313] = x_318; + } + int const x_320 = *(from); + i_1 = x_320; + while (true) { + int const x_325 = i_1; + int const x_326 = *(to); + if ((x_325 <= x_326)) { + } else { + break; + } + int const x_329 = i_1; + int const x_330 = i_1; + int const x_332 = (*(tint_symbol_6)).arr[x_330]; + (*(tint_symbol_5)).arr[x_329] = x_332; + { + int const x_334 = i_1; + i_1 = (x_334 + 1); + } + } + return; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_341 = m; + int const x_342 = high; + if ((x_341 <= x_342)) { + } else { + break; + } + int const x_345 = low; + i_2 = x_345; + while (true) { + int const x_350 = i_2; + int const x_351 = high; + if ((x_350 < x_351)) { + } else { + break; + } + int const x_354 = i_2; + from_1 = x_354; + int const x_355 = i_2; + int const x_356 = m; + mid_1 = ((x_355 + x_356) - 1); + int const x_359 = i_2; + int const x_360 = m; + int const x_364 = high; + to_1 = min(((x_359 + (2 * x_360)) - 1), x_364); + int const x_366 = from_1; + param = x_366; + int const x_367 = mid_1; + param_1 = x_367; + int const x_368 = to_1; + param_2 = x_368; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_370 = m; + int const x_372 = i_2; + i_2 = (x_372 + (2 * x_370)); + } + } + { + int const x_374 = m; + m = (2 * x_374); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_86 = x_28.injectionSwitch.x; + i_3 = int(x_86); + while (true) { + int const x_92 = i_3; + switch(x_92) { + case 9: { + int const x_122 = i_3; + (*(tint_symbol_9)).arr[x_122] = -5; + break; + } + case 8: { + int const x_120 = i_3; + (*(tint_symbol_9)).arr[x_120] = -4; + break; + } + case 7: { + int const x_118 = i_3; + (*(tint_symbol_9)).arr[x_118] = -3; + break; + } + case 6: { + int const x_116 = i_3; + (*(tint_symbol_9)).arr[x_116] = -2; + break; + } + case 5: { + int const x_114 = i_3; + (*(tint_symbol_9)).arr[x_114] = -1; + break; + } + case 4: { + int const x_112 = i_3; + (*(tint_symbol_9)).arr[x_112] = 0; + break; + } + case 3: { + int const x_110 = i_3; + (*(tint_symbol_9)).arr[x_110] = 1; + break; + } + case 2: { + int const x_108 = i_3; + (*(tint_symbol_9)).arr[x_108] = 2; + break; + } + case 1: { + int const x_106 = i_3; + (*(tint_symbol_9)).arr[x_106] = 3; + break; + } + case 0: { + int const x_104 = i_3; + (*(tint_symbol_9)).arr[x_104] = 4; + break; + } + default: { + break; + } + } + int const x_124 = i_3; + i_3 = (x_124 + 1); + { + int const x_126 = i_3; + if ((x_126 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_132 = j_1; + bool const x_133 = (x_132 < 10); + float const x_135 = x_28.injectionSwitch.x; + if (!((x_135 <= 1.0f))) { + grey = 1.0f; + } + if (x_133) { + } else { + break; + } + int const x_140 = j_1; + int const x_141 = j_1; + int const x_143 = (*(tint_symbol_9)).arr[x_141]; + (*(tint_symbol_10)).arr[x_140] = x_143; + { + int const x_145 = j_1; + j_1 = (x_145 + 1); + } + } + mergeSort_(tint_symbol_9, tint_symbol_10); + float const x_149 = (*(tint_symbol_11)).y; + if ((int(x_149) < 30)) { + int const x_156 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_156) / 10.0f)); + } else { + float const x_161 = (*(tint_symbol_11)).y; + if ((int(x_161) < 60)) { + int const x_168 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_168) / 10.0f)); + } else { + float const x_173 = (*(tint_symbol_11)).y; + if ((int(x_173) < 90)) { + int const x_180 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_180) / 10.0f)); + } else { + float const x_185 = (*(tint_symbol_11)).y; + if ((int(x_185) < 120)) { + int const x_192 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_192) / 10.0f)); + } else { + float const x_197 = (*(tint_symbol_11)).y; + if ((int(x_197) < 150)) { + discard_fragment(); + } else { + float const x_204 = (*(tint_symbol_11)).y; + if ((int(x_204) < 180)) { + int const x_211 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_211) / 10.0f)); + } else { + float const x_216 = (*(tint_symbol_11)).y; + if ((int(x_216) < 210)) { + int const x_223 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_223) / 10.0f)); + } else { + float const x_228 = (*(tint_symbol_11)).y; + if ((int(x_228) < 240)) { + int const x_235 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_235) / 10.0f)); + } else { + float const x_240 = (*(tint_symbol_11)).y; + bool guard233 = true; + if ((int(x_240) < 270)) { + int const x_247 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_247) / 10.0f)); + guard233 = false; + } else { + if (guard233) { + float const x_252 = x_28.injectionSwitch.y; + if (!((0.0f < x_252))) { + guard233 = false; + } + if (guard233) { + discard_fragment(); + } + } + } + } + } + } + } + } + } + } + } + float const x_255 = grey; + float3 const x_256 = float3(x_255, x_255, x_255); + *(tint_symbol_12) = float4(x_256.x, x_256.y, x_256.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..e2ae2d94e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.spvasm @@ -0,0 +1,690 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 440 +; Schema: 0 + OpCapability Shader + %177 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %guard233 "guard233" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %132 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %201 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %true = OpConstantTrue %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %393 = OpConstantNull %bool + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %false = OpConstantFalse %bool + %float_0 = OpConstant %float 0 + %v3float = OpTypeVector %float 3 + %main_out = OpTypeStruct %v4float + %427 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpLoad %int %mid + %51 = OpLoad %int %j + %53 = OpLoad %int %to + %54 = OpSLessThanEqual %bool %48 %50 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %58 = OpSLessThanEqual %bool %51 %53 + OpBranch %56 + %56 = OpLabel + %59 = OpPhi %bool %54 %47 %58 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %45 + %60 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Private_int %data %63 + %66 = OpLoad %int %65 + %67 = OpLoad %int %j + %68 = OpAccessChain %_ptr_Private_int %data %67 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %k + %75 = OpIAdd %int %74 %int_1 + OpStore %k %75 + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + %78 = OpAccessChain %_ptr_Private_int %data %76 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Private_int %temp %74 + OpStore %80 %79 + OpBranch %71 + %73 = OpLabel + %81 = OpLoad %int %k + %82 = OpIAdd %int %81 %int_1 + OpStore %k %82 + %83 = OpLoad %int %j + %84 = OpIAdd %int %83 %int_1 + OpStore %j %84 + %85 = OpAccessChain %_ptr_Private_int %data %83 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Private_int %temp %81 + OpStore %87 %86 + OpBranch %71 + %71 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpLoad %int %i + %95 = OpLoad %int %mid + %97 = OpSLessThan %bool %92 %int_10 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSLessThanEqual %bool %93 %95 + OpBranch %98 + %98 = OpLabel + %101 = OpPhi %bool %97 %91 %100 %99 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpBranch %102 + %104 = OpLabel + OpBranch %89 + %102 = OpLabel + %105 = OpLoad %int %k + %106 = OpIAdd %int %105 %int_1 + OpStore %k %106 + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + %109 = OpAccessChain %_ptr_Private_int %data %107 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Private_int %temp %105 + OpStore %111 %110 + OpBranch %90 + %90 = OpLabel + OpBranch %88 + %89 = OpLabel + %113 = OpLoad %int %from + OpStore %i_1 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpLoad %int %to + %121 = OpSLessThanEqual %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + OpBranch %122 + %124 = OpLabel + OpBranch %115 + %122 = OpLabel + %125 = OpLoad %int %i_1 + %126 = OpLoad %int %i_1 + %127 = OpAccessChain %_ptr_Private_int %temp %126 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %129 %128 + OpBranch %116 + %116 = OpLabel + %130 = OpLoad %int %i_1 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_1 %131 + OpBranch %114 + %115 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %132 + %134 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %151 = OpLoad %int %m + %152 = OpLoad %int %high + %153 = OpSLessThanEqual %bool %151 %152 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + OpBranch %154 + %156 = OpLabel + OpBranch %148 + %154 = OpLabel + %157 = OpLoad %int %low + OpStore %i_2 %157 + OpBranch %158 + %158 = OpLabel + OpLoopMerge %159 %160 None + OpBranch %161 + %161 = OpLabel + %162 = OpLoad %int %i_2 + %163 = OpLoad %int %high + %164 = OpSLessThan %bool %162 %163 + OpSelectionMerge %165 None + OpBranchConditional %164 %166 %167 + %166 = OpLabel + OpBranch %165 + %167 = OpLabel + OpBranch %159 + %165 = OpLabel + %168 = OpLoad %int %i_2 + OpStore %from_1 %168 + %169 = OpLoad %int %i_2 + %170 = OpLoad %int %m + %171 = OpIAdd %int %169 %170 + %172 = OpISub %int %171 %int_1 + OpStore %mid_1 %172 + %173 = OpLoad %int %i_2 + %174 = OpLoad %int %m + %175 = OpLoad %int %high + %179 = OpIMul %int %int_2 %174 + %180 = OpIAdd %int %173 %179 + %181 = OpISub %int %180 %int_1 + %176 = OpExtInst %int %177 SMin %181 %175 + OpStore %to_1 %176 + %182 = OpLoad %int %from_1 + OpStore %param %182 + %183 = OpLoad %int %mid_1 + OpStore %param_1 %183 + %184 = OpLoad %int %to_1 + OpStore %param_2 %184 + %185 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %160 + %160 = OpLabel + %189 = OpLoad %int %m + %190 = OpLoad %int %i_2 + %191 = OpIMul %int %int_2 %189 + %192 = OpIAdd %int %190 %191 + OpStore %i_2 %192 + OpBranch %158 + %159 = OpLabel + OpBranch %149 + %149 = OpLabel + %193 = OpLoad %int %m + %194 = OpIMul %int %int_2 %193 + OpStore %m %194 + OpBranch %147 + %148 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %132 + %196 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %201 + %guard233 = OpVariable %_ptr_Function_bool Function %393 + %204 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %205 = OpLoad %float %204 + %206 = OpConvertFToS %int %205 + OpStore %i_3 %206 + OpBranch %207 + %207 = OpLabel + OpLoopMerge %208 %209 None + OpBranch %210 + %210 = OpLabel + %211 = OpLoad %int %i_3 + OpSelectionMerge %212 None + OpSwitch %211 %213 9 %214 8 %215 7 %216 6 %217 5 %218 4 %219 3 %220 2 %221 1 %222 0 %223 + %214 = OpLabel + %224 = OpLoad %int %i_3 + %225 = OpAccessChain %_ptr_Private_int %data %224 + OpStore %225 %int_n5 + OpBranch %212 + %215 = OpLabel + %227 = OpLoad %int %i_3 + %228 = OpAccessChain %_ptr_Private_int %data %227 + OpStore %228 %int_n4 + OpBranch %212 + %216 = OpLabel + %230 = OpLoad %int %i_3 + %231 = OpAccessChain %_ptr_Private_int %data %230 + OpStore %231 %int_n3 + OpBranch %212 + %217 = OpLabel + %233 = OpLoad %int %i_3 + %234 = OpAccessChain %_ptr_Private_int %data %233 + OpStore %234 %int_n2 + OpBranch %212 + %218 = OpLabel + %236 = OpLoad %int %i_3 + %237 = OpAccessChain %_ptr_Private_int %data %236 + OpStore %237 %int_n1 + OpBranch %212 + %219 = OpLabel + %239 = OpLoad %int %i_3 + %240 = OpAccessChain %_ptr_Private_int %data %239 + OpStore %240 %int_0 + OpBranch %212 + %220 = OpLabel + %241 = OpLoad %int %i_3 + %242 = OpAccessChain %_ptr_Private_int %data %241 + OpStore %242 %int_1 + OpBranch %212 + %221 = OpLabel + %243 = OpLoad %int %i_3 + %244 = OpAccessChain %_ptr_Private_int %data %243 + OpStore %244 %int_2 + OpBranch %212 + %222 = OpLabel + %245 = OpLoad %int %i_3 + %246 = OpAccessChain %_ptr_Private_int %data %245 + OpStore %246 %int_3 + OpBranch %212 + %223 = OpLabel + %248 = OpLoad %int %i_3 + %249 = OpAccessChain %_ptr_Private_int %data %248 + OpStore %249 %int_4 + OpBranch %212 + %213 = OpLabel + OpBranch %212 + %212 = OpLabel + %251 = OpLoad %int %i_3 + %252 = OpIAdd %int %251 %int_1 + OpStore %i_3 %252 + OpBranch %209 + %209 = OpLabel + %253 = OpLoad %int %i_3 + %254 = OpSLessThan %bool %253 %int_10 + OpSelectionMerge %255 None + OpBranchConditional %254 %256 %257 + %256 = OpLabel + OpBranch %255 + %257 = OpLabel + OpBranch %208 + %255 = OpLabel + OpBranch %207 + %208 = OpLabel + OpStore %j_1 %int_0 + OpBranch %258 + %258 = OpLabel + OpLoopMerge %259 %260 None + OpBranch %261 + %261 = OpLabel + %262 = OpLoad %int %j_1 + %263 = OpSLessThan %bool %262 %int_10 + %264 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %265 = OpLoad %float %264 + %268 = OpFOrdLessThanEqual %bool %265 %float_1 + %266 = OpLogicalNot %bool %268 + OpSelectionMerge %269 None + OpBranchConditional %266 %270 %269 + %270 = OpLabel + OpStore %grey %float_1 + OpBranch %269 + %269 = OpLabel + OpSelectionMerge %271 None + OpBranchConditional %263 %272 %273 + %272 = OpLabel + OpBranch %271 + %273 = OpLabel + OpBranch %259 + %271 = OpLabel + %274 = OpLoad %int %j_1 + %275 = OpLoad %int %j_1 + %276 = OpAccessChain %_ptr_Private_int %data %275 + %277 = OpLoad %int %276 + %278 = OpAccessChain %_ptr_Private_int %temp %274 + OpStore %278 %277 + OpBranch %260 + %260 = OpLabel + %279 = OpLoad %int %j_1 + %280 = OpIAdd %int %279 %int_1 + OpStore %j_1 %280 + OpBranch %258 + %259 = OpLabel + %281 = OpFunctionCall %void %mergeSort_ + %284 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %285 = OpLoad %float %284 + %286 = OpConvertFToS %int %285 + %288 = OpSLessThan %bool %286 %int_30 + OpSelectionMerge %289 None + OpBranchConditional %288 %290 %291 + %290 = OpLabel + %292 = OpAccessChain %_ptr_Private_int %data %int_0 + %293 = OpLoad %int %292 + %295 = OpConvertSToF %float %293 + %297 = OpFDiv %float %295 %float_10 + %298 = OpFAdd %float %float_0_5 %297 + OpStore %grey %298 + OpBranch %289 + %291 = OpLabel + %299 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %300 = OpLoad %float %299 + %301 = OpConvertFToS %int %300 + %303 = OpSLessThan %bool %301 %int_60 + OpSelectionMerge %304 None + OpBranchConditional %303 %305 %306 + %305 = OpLabel + %307 = OpAccessChain %_ptr_Private_int %data %int_1 + %308 = OpLoad %int %307 + %309 = OpConvertSToF %float %308 + %310 = OpFDiv %float %309 %float_10 + %311 = OpFAdd %float %float_0_5 %310 + OpStore %grey %311 + OpBranch %304 + %306 = OpLabel + %312 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %313 = OpLoad %float %312 + %314 = OpConvertFToS %int %313 + %316 = OpSLessThan %bool %314 %int_90 + OpSelectionMerge %317 None + OpBranchConditional %316 %318 %319 + %318 = OpLabel + %320 = OpAccessChain %_ptr_Private_int %data %int_2 + %321 = OpLoad %int %320 + %322 = OpConvertSToF %float %321 + %323 = OpFDiv %float %322 %float_10 + %324 = OpFAdd %float %float_0_5 %323 + OpStore %grey %324 + OpBranch %317 + %319 = OpLabel + %325 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %326 = OpLoad %float %325 + %327 = OpConvertFToS %int %326 + %329 = OpSLessThan %bool %327 %int_120 + OpSelectionMerge %330 None + OpBranchConditional %329 %331 %332 + %331 = OpLabel + %333 = OpAccessChain %_ptr_Private_int %data %int_3 + %334 = OpLoad %int %333 + %335 = OpConvertSToF %float %334 + %336 = OpFDiv %float %335 %float_10 + %337 = OpFAdd %float %float_0_5 %336 + OpStore %grey %337 + OpBranch %330 + %332 = OpLabel + %338 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %339 = OpLoad %float %338 + %340 = OpConvertFToS %int %339 + %342 = OpSLessThan %bool %340 %int_150 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %345 + %344 = OpLabel + OpKill + %345 = OpLabel + %346 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %347 = OpLoad %float %346 + %348 = OpConvertFToS %int %347 + %350 = OpSLessThan %bool %348 %int_180 + OpSelectionMerge %351 None + OpBranchConditional %350 %352 %353 + %352 = OpLabel + %355 = OpAccessChain %_ptr_Private_int %data %int_5 + %356 = OpLoad %int %355 + %357 = OpConvertSToF %float %356 + %358 = OpFDiv %float %357 %float_10 + %359 = OpFAdd %float %float_0_5 %358 + OpStore %grey %359 + OpBranch %351 + %353 = OpLabel + %360 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %361 = OpLoad %float %360 + %362 = OpConvertFToS %int %361 + %364 = OpSLessThan %bool %362 %int_210 + OpSelectionMerge %365 None + OpBranchConditional %364 %366 %367 + %366 = OpLabel + %369 = OpAccessChain %_ptr_Private_int %data %int_6 + %370 = OpLoad %int %369 + %371 = OpConvertSToF %float %370 + %372 = OpFDiv %float %371 %float_10 + %373 = OpFAdd %float %float_0_5 %372 + OpStore %grey %373 + OpBranch %365 + %367 = OpLabel + %374 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %375 = OpLoad %float %374 + %376 = OpConvertFToS %int %375 + %378 = OpSLessThan %bool %376 %int_240 + OpSelectionMerge %379 None + OpBranchConditional %378 %380 %381 + %380 = OpLabel + %383 = OpAccessChain %_ptr_Private_int %data %int_7 + %384 = OpLoad %int %383 + %385 = OpConvertSToF %float %384 + %386 = OpFDiv %float %385 %float_10 + %387 = OpFAdd %float %float_0_5 %386 + OpStore %grey %387 + OpBranch %379 + %381 = OpLabel + %388 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %389 = OpLoad %float %388 + OpStore %guard233 %true + %394 = OpConvertFToS %int %389 + %396 = OpSLessThan %bool %394 %int_270 + OpSelectionMerge %397 None + OpBranchConditional %396 %398 %399 + %398 = OpLabel + %401 = OpAccessChain %_ptr_Private_int %data %int_8 + %402 = OpLoad %int %401 + %403 = OpConvertSToF %float %402 + %404 = OpFDiv %float %403 %float_10 + %405 = OpFAdd %float %float_0_5 %404 + OpStore %grey %405 + OpStore %guard233 %false + OpBranch %397 + %399 = OpLabel + %407 = OpLoad %bool %guard233 + OpSelectionMerge %408 None + OpBranchConditional %407 %409 %408 + %409 = OpLabel + %410 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %411 = OpLoad %float %410 + %414 = OpFOrdLessThan %bool %float_0 %411 + %412 = OpLogicalNot %bool %414 + OpSelectionMerge %415 None + OpBranchConditional %412 %416 %415 + %416 = OpLabel + OpStore %guard233 %false + OpBranch %415 + %415 = OpLabel + %417 = OpLoad %bool %guard233 + OpSelectionMerge %418 None + OpBranchConditional %417 %419 %418 + %419 = OpLabel + OpKill + %418 = OpLabel + OpBranch %408 + %408 = OpLabel + OpBranch %397 + %397 = OpLabel + OpBranch %379 + %379 = OpLabel + OpBranch %365 + %365 = OpLabel + OpBranch %351 + %351 = OpLabel + OpBranch %343 + %343 = OpLabel + OpBranch %330 + %330 = OpLabel + OpBranch %317 + %317 = OpLabel + OpBranch %304 + %304 = OpLabel + OpBranch %289 + %289 = OpLabel + %420 = OpLoad %float %grey + %422 = OpCompositeConstruct %v3float %420 %420 %420 + %423 = OpCompositeExtract %float %422 0 + %424 = OpCompositeExtract %float %422 1 + %425 = OpCompositeExtract %float %422 2 + %426 = OpCompositeConstruct %v4float %423 %424 %425 %float_1 + OpStore %x_GLF_color %426 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %427 +%tint_symbol_1 = OpFunctionParameter %main_out + %431 = OpLabel + %432 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %432 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %132 + %434 = OpLabel + %435 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %435 + %436 = OpFunctionCall %void %main_1 + %438 = OpLoad %v4float %x_GLF_color + %439 = OpCompositeConstruct %main_out %438 + %437 = OpFunctionCall %void %tint_symbol_3 %439 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 209[%209] is not post dominated by the back-edge block 255[%255] + %255 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..4e442a361d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/1.wgsl.expected.wgsl @@ -0,0 +1,321 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_262 : i32 = *(from); + k = x_262; + let x_263 : i32 = *(from); + i = x_263; + let x_264 : i32 = *(mid); + j = (x_264 + 1); + loop { + let x_270 : i32 = i; + let x_271 : i32 = *(mid); + let x_273 : i32 = j; + let x_274 : i32 = *(to); + if (((x_270 <= x_271) && (x_273 <= x_274))) { + } else { + break; + } + let x_278 : i32 = i; + let x_280 : i32 = data[x_278]; + let x_281 : i32 = j; + let x_283 : i32 = data[x_281]; + if ((x_280 < x_283)) { + let x_288 : i32 = k; + k = (x_288 + 1); + let x_290 : i32 = i; + i = (x_290 + 1); + let x_293 : i32 = data[x_290]; + temp[x_288] = x_293; + } else { + let x_295 : i32 = k; + k = (x_295 + 1); + let x_297 : i32 = j; + j = (x_297 + 1); + let x_300 : i32 = data[x_297]; + temp[x_295] = x_300; + } + } + loop { + let x_306 : i32 = i; + let x_308 : i32 = i; + let x_309 : i32 = *(mid); + if (((x_306 < 10) && (x_308 <= x_309))) { + } else { + break; + } + let x_313 : i32 = k; + k = (x_313 + 1); + let x_315 : i32 = i; + i = (x_315 + 1); + let x_318 : i32 = data[x_315]; + temp[x_313] = x_318; + } + let x_320 : i32 = *(from); + i_1 = x_320; + loop { + let x_325 : i32 = i_1; + let x_326 : i32 = *(to); + if ((x_325 <= x_326)) { + } else { + break; + } + let x_329 : i32 = i_1; + let x_330 : i32 = i_1; + let x_332 : i32 = temp[x_330]; + data[x_329] = x_332; + + continuing { + let x_334 : i32 = i_1; + i_1 = (x_334 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_341 : i32 = m; + let x_342 : i32 = high; + if ((x_341 <= x_342)) { + } else { + break; + } + let x_345 : i32 = low; + i_2 = x_345; + loop { + let x_350 : i32 = i_2; + let x_351 : i32 = high; + if ((x_350 < x_351)) { + } else { + break; + } + let x_354 : i32 = i_2; + from_1 = x_354; + let x_355 : i32 = i_2; + let x_356 : i32 = m; + mid_1 = ((x_355 + x_356) - 1); + let x_359 : i32 = i_2; + let x_360 : i32 = m; + let x_364 : i32 = high; + to_1 = min(((x_359 + (2 * x_360)) - 1), x_364); + let x_366 : i32 = from_1; + param = x_366; + let x_367 : i32 = mid_1; + param_1 = x_367; + let x_368 : i32 = to_1; + param_2 = x_368; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_370 : i32 = m; + let x_372 : i32 = i_2; + i_2 = (x_372 + (2 * x_370)); + } + } + + continuing { + let x_374 : i32 = m; + m = (2 * x_374); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_86 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_86); + loop { + let x_92 : i32 = i_3; + switch(x_92) { + case 9: { + let x_122 : i32 = i_3; + data[x_122] = -5; + } + case 8: { + let x_120 : i32 = i_3; + data[x_120] = -4; + } + case 7: { + let x_118 : i32 = i_3; + data[x_118] = -3; + } + case 6: { + let x_116 : i32 = i_3; + data[x_116] = -2; + } + case 5: { + let x_114 : i32 = i_3; + data[x_114] = -1; + } + case 4: { + let x_112 : i32 = i_3; + data[x_112] = 0; + } + case 3: { + let x_110 : i32 = i_3; + data[x_110] = 1; + } + case 2: { + let x_108 : i32 = i_3; + data[x_108] = 2; + } + case 1: { + let x_106 : i32 = i_3; + data[x_106] = 3; + } + case 0: { + let x_104 : i32 = i_3; + data[x_104] = 4; + } + default: { + } + } + let x_124 : i32 = i_3; + i_3 = (x_124 + 1); + + continuing { + let x_126 : i32 = i_3; + if ((x_126 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_132 : i32 = j_1; + let x_133 : bool = (x_132 < 10); + let x_135 : f32 = x_28.injectionSwitch.x; + if (!((x_135 <= 1.0))) { + grey = 1.0; + } + if (x_133) { + } else { + break; + } + let x_140 : i32 = j_1; + let x_141 : i32 = j_1; + let x_143 : i32 = data[x_141]; + temp[x_140] = x_143; + + continuing { + let x_145 : i32 = j_1; + j_1 = (x_145 + 1); + } + } + mergeSort_(); + let x_149 : f32 = gl_FragCoord.y; + if ((i32(x_149) < 30)) { + let x_156 : i32 = data[0]; + grey = (0.5 + (f32(x_156) / 10.0)); + } else { + let x_161 : f32 = gl_FragCoord.y; + if ((i32(x_161) < 60)) { + let x_168 : i32 = data[1]; + grey = (0.5 + (f32(x_168) / 10.0)); + } else { + let x_173 : f32 = gl_FragCoord.y; + if ((i32(x_173) < 90)) { + let x_180 : i32 = data[2]; + grey = (0.5 + (f32(x_180) / 10.0)); + } else { + let x_185 : f32 = gl_FragCoord.y; + if ((i32(x_185) < 120)) { + let x_192 : i32 = data[3]; + grey = (0.5 + (f32(x_192) / 10.0)); + } else { + let x_197 : f32 = gl_FragCoord.y; + if ((i32(x_197) < 150)) { + discard; + } else { + let x_204 : f32 = gl_FragCoord.y; + if ((i32(x_204) < 180)) { + let x_211 : i32 = data[5]; + grey = (0.5 + (f32(x_211) / 10.0)); + } else { + let x_216 : f32 = gl_FragCoord.y; + if ((i32(x_216) < 210)) { + let x_223 : i32 = data[6]; + grey = (0.5 + (f32(x_223) / 10.0)); + } else { + let x_228 : f32 = gl_FragCoord.y; + if ((i32(x_228) < 240)) { + let x_235 : i32 = data[7]; + grey = (0.5 + (f32(x_235) / 10.0)); + } else { + let x_240 : f32 = gl_FragCoord.y; + var guard233 : bool = true; + if ((i32(x_240) < 270)) { + let x_247 : i32 = data[8]; + grey = (0.5 + (f32(x_247) / 10.0)); + guard233 = false; + } else { + if (guard233) { + let x_252 : f32 = x_28.injectionSwitch.y; + if (!((0.0 < x_252))) { + guard233 = false; + } + if (guard233) { + discard; + } + } + } + } + } + } + } + } + } + } + } + let x_255 : f32 = grey; + let x_256 : vec3 = vec3(x_255, x_255, x_255); + x_GLF_color = vec4(x_256.x, x_256.y, x_256.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm new file mode 100644 index 0000000000..2f1327c3e9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm @@ -0,0 +1,688 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %merge_i1_i1_i1_ "merge(i1;i1;i1;" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %mergeSort_ "mergeSort(" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %temp "temp" + OpName %i_0 "i" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_1 "i" + OpName %from_0 "from" + OpName %mid_0 "mid" + OpName %to_0 "to" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %i_2 "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %j_0 "j" + OpName %gl_FragCoord "gl_FragCoord" + OpName %grey "grey" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %32 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private + %int_10 = OpConstant %int 10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int_30 = OpConstant %int 30 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %int_0_0 = OpConstant %int 0 + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %float_0 = OpConstant %float 0 + %main = OpFunction %void None %32 + %86 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %grey = OpVariable %_ptr_Function_float Function + %87 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %88 = OpLoad %float %87 + %89 = OpConvertFToS %int %88 + OpStore %i_2 %89 + OpBranch %90 + %90 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %int %i_2 + OpSelectionMerge %95 None + OpSwitch %94 %95 0 %96 1 %97 2 %98 3 %99 4 %100 5 %101 6 %102 7 %103 8 %104 9 %105 + %96 = OpLabel + %106 = OpLoad %int %i_2 + %107 = OpAccessChain %_ptr_Private_int %data %106 + OpStore %107 %int_4 + OpBranch %95 + %97 = OpLabel + %108 = OpLoad %int %i_2 + %109 = OpAccessChain %_ptr_Private_int %data %108 + OpStore %109 %int_3 + OpBranch %95 + %98 = OpLabel + %110 = OpLoad %int %i_2 + %111 = OpAccessChain %_ptr_Private_int %data %110 + OpStore %111 %int_2 + OpBranch %95 + %99 = OpLabel + %112 = OpLoad %int %i_2 + %113 = OpAccessChain %_ptr_Private_int %data %112 + OpStore %113 %int_1 + OpBranch %95 + %100 = OpLabel + %114 = OpLoad %int %i_2 + %115 = OpAccessChain %_ptr_Private_int %data %114 + OpStore %115 %int_0 + OpBranch %95 + %101 = OpLabel + %116 = OpLoad %int %i_2 + %117 = OpAccessChain %_ptr_Private_int %data %116 + OpStore %117 %int_n1 + OpBranch %95 + %102 = OpLabel + %118 = OpLoad %int %i_2 + %119 = OpAccessChain %_ptr_Private_int %data %118 + OpStore %119 %int_n2 + OpBranch %95 + %103 = OpLabel + %120 = OpLoad %int %i_2 + %121 = OpAccessChain %_ptr_Private_int %data %120 + OpStore %121 %int_n3 + OpBranch %95 + %104 = OpLabel + %122 = OpLoad %int %i_2 + %123 = OpAccessChain %_ptr_Private_int %data %122 + OpStore %123 %int_n4 + OpBranch %95 + %105 = OpLabel + %124 = OpLoad %int %i_2 + %125 = OpAccessChain %_ptr_Private_int %data %124 + OpStore %125 %int_n5 + OpBranch %95 + %95 = OpLabel + %126 = OpLoad %int %i_2 + %127 = OpIAdd %int %126 %int_1 + OpStore %i_2 %127 + OpBranch %92 + %92 = OpLabel + %128 = OpLoad %int %i_2 + %129 = OpSLessThan %bool %128 %int_10 + OpBranchConditional %129 %90 %91 + %91 = OpLabel + OpStore %j_0 %int_0 + OpBranch %130 + %130 = OpLabel + OpLoopMerge %131 %132 None + OpBranch %133 + %133 = OpLabel + %134 = OpLoad %int %j_0 + %135 = OpSLessThan %bool %134 %int_10 + OpBranchConditional %135 %136 %131 + %136 = OpLabel + %137 = OpLoad %int %j_0 + %138 = OpLoad %int %j_0 + %139 = OpAccessChain %_ptr_Private_int %data %138 + %140 = OpLoad %int %139 + %141 = OpAccessChain %_ptr_Private_int %temp %137 + OpStore %141 %140 + OpBranch %132 + %132 = OpLabel + %142 = OpLoad %int %j_0 + %143 = OpIAdd %int %142 %int_1 + OpStore %j_0 %143 + OpBranch %130 + %131 = OpLabel + %144 = OpFunctionCall %void %mergeSort_ + %145 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %146 = OpLoad %float %145 + %147 = OpConvertFToS %int %146 + %148 = OpSLessThan %bool %147 %int_30 + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %151 + %150 = OpLabel + %152 = OpAccessChain %_ptr_Private_int %data %int_0 + %153 = OpLoad %int %152 + %154 = OpConvertSToF %float %153 + %155 = OpFDiv %float %154 %float_10 + %156 = OpFAdd %float %float_0_5 %155 + OpStore %grey %156 + OpBranch %149 + %151 = OpLabel + %157 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %158 = OpLoad %float %157 + %159 = OpConvertFToS %int %158 + %160 = OpSLessThan %bool %159 %int_60 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + %164 = OpAccessChain %_ptr_Private_int %data %int_1 + %165 = OpLoad %int %164 + %166 = OpConvertSToF %float %165 + %167 = OpFDiv %float %166 %float_10 + %168 = OpFAdd %float %float_0_5 %167 + OpStore %grey %168 + OpBranch %161 + %163 = OpLabel + %169 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %170 = OpLoad %float %169 + %171 = OpConvertFToS %int %170 + %172 = OpSLessThan %bool %171 %int_90 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %175 + %174 = OpLabel + %176 = OpAccessChain %_ptr_Private_int %data %int_2 + %177 = OpLoad %int %176 + %178 = OpConvertSToF %float %177 + %179 = OpFDiv %float %178 %float_10 + %180 = OpFAdd %float %float_0_5 %179 + OpStore %grey %180 + OpBranch %173 + %175 = OpLabel + %181 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %182 = OpLoad %float %181 + %183 = OpConvertFToS %int %182 + %184 = OpSLessThan %bool %183 %int_120 + OpSelectionMerge %185 None + OpBranchConditional %184 %186 %187 + %186 = OpLabel + %188 = OpAccessChain %_ptr_Private_int %data %int_3 + %189 = OpLoad %int %188 + %190 = OpConvertSToF %float %189 + %191 = OpFDiv %float %190 %float_10 + %192 = OpFAdd %float %float_0_5 %191 + OpStore %grey %192 + OpBranch %185 + %187 = OpLabel + %193 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %194 = OpLoad %float %193 + %195 = OpConvertFToS %int %194 + %196 = OpSLessThan %bool %195 %int_150 + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %199 + %198 = OpLabel + OpKill + %199 = OpLabel + %200 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %201 = OpLoad %float %200 + %202 = OpConvertFToS %int %201 + %203 = OpSLessThan %bool %202 %int_180 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %206 + %205 = OpLabel + %207 = OpAccessChain %_ptr_Private_int %data %int_5 + %208 = OpLoad %int %207 + %209 = OpConvertSToF %float %208 + %210 = OpFDiv %float %209 %float_10 + %211 = OpFAdd %float %float_0_5 %210 + OpStore %grey %211 + OpBranch %204 + %206 = OpLabel + %212 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %213 = OpLoad %float %212 + %214 = OpConvertFToS %int %213 + %215 = OpSLessThan %bool %214 %int_210 + OpSelectionMerge %216 None + OpBranchConditional %215 %217 %218 + %217 = OpLabel + %219 = OpAccessChain %_ptr_Private_int %data %int_6 + %220 = OpLoad %int %219 + %221 = OpConvertSToF %float %220 + %222 = OpFDiv %float %221 %float_10 + %223 = OpFAdd %float %float_0_5 %222 + OpStore %grey %223 + OpBranch %216 + %218 = OpLabel + %224 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %225 = OpLoad %float %224 + %226 = OpConvertFToS %int %225 + %227 = OpSLessThan %bool %226 %int_240 + OpSelectionMerge %228 None + OpBranchConditional %227 %229 %230 + %229 = OpLabel + %231 = OpAccessChain %_ptr_Private_int %data %int_7 + %232 = OpLoad %int %231 + %233 = OpConvertSToF %float %232 + %234 = OpFDiv %float %233 %float_10 + %235 = OpFAdd %float %float_0_5 %234 + OpStore %grey %235 + OpBranch %228 + %230 = OpLabel + %236 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %237 = OpLoad %float %236 + %238 = OpConvertFToS %int %237 + %239 = OpSLessThan %bool %238 %int_270 + OpSelectionMerge %240 None + OpBranchConditional %239 %241 %242 + %241 = OpLabel + %243 = OpAccessChain %_ptr_Private_int %data %int_8 + %244 = OpLoad %int %243 + %245 = OpConvertSToF %float %244 + %246 = OpFDiv %float %245 %float_10 + %247 = OpFAdd %float %float_0_5 %246 + OpStore %grey %247 + OpBranch %240 + %242 = OpLabel + OpKill + %240 = OpLabel + OpBranch %228 + %228 = OpLabel + OpBranch %216 + %216 = OpLabel + OpBranch %204 + %204 = OpLabel + OpBranch %197 + %197 = OpLabel + OpBranch %185 + %185 = OpLabel + OpBranch %173 + %173 = OpLabel + OpBranch %161 + %161 = OpLabel + OpBranch %149 + %149 = OpLabel + %248 = OpLoad %float %grey + %249 = OpCompositeConstruct %v3float %248 %248 %248 + %250 = OpCompositeExtract %float %249 0 + %251 = OpCompositeExtract %float %249 1 + %252 = OpCompositeExtract %float %249 2 + %253 = OpCompositeConstruct %v4float %250 %251 %252 %float_1 + OpStore %_GLF_color %253 + OpReturn + OpFunctionEnd +%merge_i1_i1_i1_ = OpFunction %void None %35 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %254 = OpLabel + %k = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %255 = OpLoad %int %from + OpStore %k %255 + %256 = OpLoad %int %from + OpStore %i %256 + %257 = OpLoad %int %mid + %258 = OpIAdd %int %257 %int_1 + OpStore %j %258 + OpBranch %259 + %259 = OpLabel + %260 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %261 = OpLoad %float %260 + %262 = OpFOrdGreaterThanEqual %bool %float_1 %261 + OpLoopMerge %263 %264 None + OpBranchConditional %262 %265 %264 + %265 = OpLabel + %266 = OpLoad %int %i + %267 = OpLoad %int %mid + %268 = OpSLessThanEqual %bool %266 %267 + %269 = OpLoad %int %j + %270 = OpLoad %int %to + %271 = OpSLessThanEqual %bool %269 %270 + %272 = OpLogicalAnd %bool %268 %271 + OpBranchConditional %272 %273 %263 + %273 = OpLabel + %274 = OpLoad %int %i + %275 = OpAccessChain %_ptr_Private_int %data %274 + %276 = OpLoad %int %275 + %277 = OpLoad %int %j + %278 = OpAccessChain %_ptr_Private_int %data %277 + %279 = OpLoad %int %278 + %280 = OpSLessThan %bool %276 %279 + OpBranch %281 + %281 = OpLabel + OpSelectionMerge %282 None + OpBranchConditional %280 %283 %284 + %283 = OpLabel + %285 = OpLoad %int %k + OpBranch %282 + %284 = OpLabel + %286 = OpCopyObject %int %int_0_0 + OpBranch %282 + %282 = OpLabel + %287 = OpPhi %int %285 %283 %286 %284 + %288 = OpIAdd %int %287 %int_1 + OpBranch %289 + %289 = OpLabel + OpSelectionMerge %290 None + OpBranchConditional %280 %291 %290 + %291 = OpLabel + OpStore %k %288 + %292 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %293 = OpLoad %float %292 + %294 = OpFUnordGreaterThan %bool %float_1 %293 + OpBranchConditional %294 %290 %264 + %290 = OpLabel + OpBranch %295 + %295 = OpLabel + %296 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %297 = OpLoad %float %296 + %298 = OpFOrdGreaterThanEqual %bool %297 %float_0 + OpBranchConditional %298 %299 %264 + %299 = OpLabel + %300 = OpCopyObject %int %int_0_0 + OpBranch %301 + %301 = OpLabel + OpSelectionMerge %302 None + OpBranchConditional %280 %303 %304 + %303 = OpLabel + %305 = OpLoad %int %i + OpBranch %302 + %304 = OpLabel + %306 = OpCopyObject %int %int_0_0 + OpBranch %302 + %302 = OpLabel + %307 = OpPhi %int %305 %303 %306 %304 + OpBranch %308 + %308 = OpLabel + %309 = OpSelect %int %280 %307 %300 + %310 = OpIAdd %int %309 %int_1 + OpSelectionMerge %311 None + OpBranchConditional %280 %312 %311 + %312 = OpLabel + OpStore %i %310 + OpBranch %311 + %311 = OpLabel + %313 = OpAccessChain %_ptr_Private_int %data %309 + OpBranch %314 + %314 = OpLabel + %315 = OpCopyObject %int %int_0_0 + OpBranch %316 + %316 = OpLabel + OpSelectionMerge %317 None + OpBranchConditional %280 %318 %319 + %318 = OpLabel + %320 = OpLoad %int %313 + %321 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %322 = OpLoad %float %321 + %323 = OpFUnordGreaterThan %bool %float_0 %322 + OpBranchConditional %323 %264 %317 + %319 = OpLabel + %324 = OpCopyObject %int %int_0_0 + %325 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %326 = OpLoad %float %325 + %327 = OpFUnordGreaterThanEqual %bool %326 %float_0 + OpBranchConditional %327 %317 %264 + %317 = OpLabel + %328 = OpPhi %int %320 %318 %324 %319 + OpBranch %329 + %329 = OpLabel + %330 = OpSelect %int %280 %328 %315 + %331 = OpAccessChain %_ptr_Private_int %temp %287 + OpSelectionMerge %332 None + OpBranchConditional %280 %333 %332 + %333 = OpLabel + OpStore %331 %330 + OpBranch %332 + %332 = OpLabel + OpBranch %334 + %334 = OpLabel + OpSelectionMerge %335 None + OpBranchConditional %280 %336 %337 + %337 = OpLabel + %338 = OpLoad %int %k + OpBranch %335 + %336 = OpLabel + %339 = OpCopyObject %int %int_0_0 + OpBranch %335 + %335 = OpLabel + %340 = OpPhi %int %338 %337 %339 %336 + %341 = OpIAdd %int %340 %int_1 + OpSelectionMerge %342 None + OpBranchConditional %280 %342 %343 + %343 = OpLabel + OpStore %k %341 + OpBranch %342 + %342 = OpLabel + %344 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %345 = OpLoad %float %344 + %346 = OpFUnordGreaterThan %bool %float_1 %345 + OpBranchConditional %346 %347 %264 + %347 = OpLabel + OpSelectionMerge %348 None + OpBranchConditional %280 %349 %350 + %350 = OpLabel + %351 = OpLoad %int %j + OpBranch %348 + %349 = OpLabel + %352 = OpCopyObject %int %int_0_0 + OpBranch %348 + %348 = OpLabel + %353 = OpPhi %int %351 %350 %352 %349 + OpBranch %354 + %354 = OpLabel + %355 = OpCopyObject %int %int_0_0 + OpBranch %356 + %356 = OpLabel + %357 = OpSelect %int %280 %355 %353 + %358 = OpIAdd %int %357 %int_1 + OpSelectionMerge %359 None + OpBranchConditional %280 %359 %360 + %360 = OpLabel + OpStore %j %358 + OpBranch %359 + %359 = OpLabel + %361 = OpAccessChain %_ptr_Private_int %data %357 + OpSelectionMerge %362 None + OpBranchConditional %280 %363 %364 + %364 = OpLabel + %365 = OpLoad %int %361 + OpBranch %362 + %363 = OpLabel + %366 = OpCopyObject %int %int_0_0 + OpBranch %362 + %362 = OpLabel + %367 = OpPhi %int %365 %364 %366 %363 + %368 = OpAccessChain %_ptr_Private_int %temp %340 + OpSelectionMerge %369 None + OpBranchConditional %280 %369 %370 + %370 = OpLabel + OpStore %368 %367 + OpBranch %369 + %369 = OpLabel + OpBranch %371 + %371 = OpLabel + OpBranch %264 + %264 = OpLabel + OpBranch %259 + %263 = OpLabel + OpBranch %372 + %372 = OpLabel + OpLoopMerge %373 %374 None + OpBranch %375 + %375 = OpLabel + %376 = OpLoad %int %i + %377 = OpSLessThan %bool %376 %int_10 + %378 = OpLoad %int %i + %379 = OpLoad %int %mid + %380 = OpSLessThanEqual %bool %378 %379 + %381 = OpLogicalAnd %bool %377 %380 + OpBranchConditional %381 %382 %373 + %382 = OpLabel + %383 = OpLoad %int %k + %384 = OpIAdd %int %383 %int_1 + OpStore %k %384 + %385 = OpLoad %int %i + %386 = OpIAdd %int %385 %int_1 + OpStore %i %386 + %387 = OpAccessChain %_ptr_Private_int %data %385 + %388 = OpLoad %int %387 + %389 = OpAccessChain %_ptr_Private_int %temp %383 + OpStore %389 %388 + OpBranch %374 + %374 = OpLabel + OpBranch %372 + %373 = OpLabel + %390 = OpLoad %int %from + OpStore %i_0 %390 + OpBranch %391 + %391 = OpLabel + OpLoopMerge %392 %393 None + OpBranch %394 + %394 = OpLabel + %395 = OpLoad %int %i_0 + %396 = OpLoad %int %to + %397 = OpSLessThanEqual %bool %395 %396 + OpBranchConditional %397 %398 %392 + %398 = OpLabel + %399 = OpLoad %int %i_0 + %400 = OpLoad %int %i_0 + %401 = OpAccessChain %_ptr_Private_int %temp %400 + %402 = OpLoad %int %401 + %403 = OpAccessChain %_ptr_Private_int %data %399 + OpStore %403 %402 + OpBranch %393 + %393 = OpLabel + %404 = OpLoad %int %i_0 + %405 = OpIAdd %int %404 %int_1 + OpStore %i_0 %405 + OpBranch %391 + %392 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %32 + %406 = OpLabel + %low = OpVariable %_ptr_Function_int Function + %high = OpVariable %_ptr_Function_int Function + %m = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %from_0 = OpVariable %_ptr_Function_int Function + %mid_0 = OpVariable %_ptr_Function_int Function + %to_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %407 + %407 = OpLabel + OpLoopMerge %408 %409 None + OpBranch %410 + %410 = OpLabel + %411 = OpLoad %int %m + %412 = OpLoad %int %high + %413 = OpSLessThanEqual %bool %411 %412 + OpBranchConditional %413 %414 %408 + %414 = OpLabel + %415 = OpLoad %int %low + OpStore %i_1 %415 + OpBranch %416 + %416 = OpLabel + OpLoopMerge %417 %418 None + OpBranch %419 + %419 = OpLabel + %420 = OpLoad %int %i_1 + %421 = OpLoad %int %high + %422 = OpSLessThan %bool %420 %421 + OpBranchConditional %422 %423 %417 + %423 = OpLabel + %424 = OpLoad %int %i_1 + OpStore %from_0 %424 + %425 = OpLoad %int %i_1 + %426 = OpLoad %int %m + %427 = OpIAdd %int %425 %426 + %428 = OpISub %int %427 %int_1 + OpStore %mid_0 %428 + %429 = OpLoad %int %i_1 + %430 = OpLoad %int %m + %431 = OpIMul %int %int_2 %430 + %432 = OpIAdd %int %429 %431 + %433 = OpISub %int %432 %int_1 + %434 = OpLoad %int %high + %435 = OpExtInst %int %1 SMin %433 %434 + OpStore %to_0 %435 + %436 = OpLoad %int %from_0 + OpStore %param %436 + %437 = OpLoad %int %mid_0 + OpStore %param_0 %437 + %438 = OpLoad %int %to_0 + OpStore %param_1 %438 + %439 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_0 %param_1 + OpBranch %418 + %418 = OpLabel + %440 = OpLoad %int %m + %441 = OpIMul %int %int_2 %440 + %442 = OpLoad %int %i_1 + %443 = OpIAdd %int %442 %441 + OpStore %i_1 %443 + OpBranch %416 + %417 = OpLabel + OpBranch %409 + %409 = OpLabel + %444 = OpLoad %int %m + %445 = OpIMul %int %int_2 %444 + OpStore %m %445 + OpBranch %407 + %408 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..5cccfe9135 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.hlsl @@ -0,0 +1,373 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_255 = from; + k = x_255; + const int x_256 = from; + i = x_256; + const int x_257 = mid; + j = (x_257 + 1); + while (true) { + int x_285 = 0; + int x_286 = 0; + int x_305 = 0; + int x_306 = 0; + int x_320 = 0; + int x_324 = 0; + int x_339 = 0; + int x_338 = 0; + int x_352 = 0; + int x_351 = 0; + int x_366 = 0; + int x_365 = 0; + int x_287_phi = 0; + int x_307_phi = 0; + int x_328_phi = 0; + int x_340_phi = 0; + int x_353_phi = 0; + int x_367_phi = 0; + const float x_261 = asfloat(x_28[0].x); + if ((1.0f >= x_261)) { + } else { + continue; + } + const int x_266 = i; + const int x_267 = mid; + const int x_269 = j; + const int x_270 = to; + bool tint_tmp = (x_266 <= x_267); + if (tint_tmp) { + tint_tmp = (x_269 <= x_270); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_276 = data[i]; + const int x_279 = data[j]; + const bool x_280 = (x_276 < x_279); + if (x_280) { + x_285 = k; + x_287_phi = x_285; + } else { + x_286 = 0; + x_287_phi = x_286; + } + const int x_287 = x_287_phi; + const int x_288 = (x_287 + 1); + if (x_280) { + k = x_288; + const float x_293 = asfloat(x_28[0].x); + if (!((1.0f <= x_293))) { + } else { + continue; + } + } + const float x_297 = asfloat(x_28[0].y); + if ((x_297 >= 0.0f)) { + } else { + continue; + } + const int x_300 = 0; + if (x_280) { + x_305 = i; + x_307_phi = x_305; + } else { + x_306 = 0; + x_307_phi = x_306; + } + const int x_309 = (x_280 ? x_307_phi : x_300); + if (x_280) { + i = (x_309 + 1); + } + const int x_315 = 0; + if (x_280) { + x_320 = data[x_309]; + const float x_322 = asfloat(x_28[0].y); + x_328_phi = x_320; + if (!((0.0f <= x_322))) { + continue; + } + } else { + x_324 = 0; + const float x_326 = asfloat(x_28[0].y); + x_328_phi = x_324; + if (!((x_326 < 0.0f))) { + } else { + continue; + } + } + const int x_328 = x_328_phi; + if (x_280) { + temp[x_287] = (x_280 ? x_328 : x_315); + } + if (x_280) { + x_339 = 0; + x_340_phi = x_339; + } else { + x_338 = k; + x_340_phi = x_338; + } + const int x_340 = x_340_phi; + if (x_280) { + } else { + k = (x_340 + 1); + } + const float x_345 = asfloat(x_28[0].x); + if (!((1.0f <= x_345))) { + } else { + continue; + } + if (x_280) { + x_352 = 0; + x_353_phi = x_352; + } else { + x_351 = j; + x_353_phi = x_351; + } + const int x_357 = (x_280 ? 0 : x_353_phi); + if (x_280) { + } else { + j = (x_357 + 1); + } + if (x_280) { + x_366 = 0; + x_367_phi = x_366; + } else { + x_365 = data[x_357]; + x_367_phi = x_365; + } + const int x_367 = x_367_phi; + if (x_280) { + } else { + temp[x_340] = x_367; + } + } + while (true) { + const int x_376 = i; + const int x_378 = i; + const int x_379 = mid; + bool tint_tmp_1 = (x_376 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_378 <= x_379); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_383 = k; + k = (x_383 + 1); + const int x_385 = i; + i = (x_385 + 1); + const int x_388 = data[x_385]; + temp[x_383] = x_388; + } + const int x_390 = from; + i_1 = x_390; + while (true) { + const int x_395 = i_1; + const int x_396 = to; + if ((x_395 <= x_396)) { + } else { + break; + } + const int x_399 = i_1; + const int x_402 = temp[i_1]; + data[x_399] = x_402; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_88 = asfloat(x_28[0].x); + i_3 = int(x_88); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_137 = j_1; + const int x_140 = data[j_1]; + temp[x_137] = x_140; + } + } + mergeSort_(); + const float x_146 = gl_FragCoord.y; + if ((int(x_146) < 30)) { + const int x_153 = data[0]; + grey = (0.5f + (float(x_153) / 10.0f)); + } else { + const float x_158 = gl_FragCoord.y; + if ((int(x_158) < 60)) { + const int x_165 = data[1]; + grey = (0.5f + (float(x_165) / 10.0f)); + } else { + const float x_170 = gl_FragCoord.y; + if ((int(x_170) < 90)) { + const int x_177 = data[2]; + grey = (0.5f + (float(x_177) / 10.0f)); + } else { + const float x_182 = gl_FragCoord.y; + if ((int(x_182) < 120)) { + const int x_189 = data[3]; + grey = (0.5f + (float(x_189) / 10.0f)); + } else { + const float x_194 = gl_FragCoord.y; + if ((int(x_194) < 150)) { + discard; + } else { + const float x_201 = gl_FragCoord.y; + if ((int(x_201) < 180)) { + const int x_208 = data[5]; + grey = (0.5f + (float(x_208) / 10.0f)); + } else { + const float x_213 = gl_FragCoord.y; + if ((int(x_213) < 210)) { + const int x_220 = data[6]; + grey = (0.5f + (float(x_220) / 10.0f)); + } else { + const float x_225 = gl_FragCoord.y; + if ((int(x_225) < 240)) { + const int x_232 = data[7]; + grey = (0.5f + (float(x_232) / 10.0f)); + } else { + const float x_237 = gl_FragCoord.y; + if ((int(x_237) < 270)) { + const int x_244 = data[8]; + grey = (0.5f + (float(x_244) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_248 = grey; + const float3 x_249 = float3(x_248, x_248, x_248); + x_GLF_color = float4(x_249.x, x_249.y, x_249.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.msl new file mode 100644 index 0000000000..a023050028 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.msl @@ -0,0 +1,422 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(constant buf0& x_28, thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_255 = *(from); + k = x_255; + int const x_256 = *(from); + i = x_256; + int const x_257 = *(mid); + j = (x_257 + 1); + while (true) { + int x_285 = 0; + int x_286 = 0; + int x_305 = 0; + int x_306 = 0; + int x_320 = 0; + int x_324 = 0; + int x_339 = 0; + int x_338 = 0; + int x_352 = 0; + int x_351 = 0; + int x_366 = 0; + int x_365 = 0; + int x_287_phi = 0; + int x_307_phi = 0; + int x_328_phi = 0; + int x_340_phi = 0; + int x_353_phi = 0; + int x_367_phi = 0; + float const x_261 = x_28.injectionSwitch.x; + if ((1.0f >= x_261)) { + } else { + continue; + } + int const x_266 = i; + int const x_267 = *(mid); + int const x_269 = j; + int const x_270 = *(to); + if (((x_266 <= x_267) && (x_269 <= x_270))) { + } else { + break; + } + int const x_274 = i; + int const x_276 = (*(tint_symbol_5)).arr[x_274]; + int const x_277 = j; + int const x_279 = (*(tint_symbol_5)).arr[x_277]; + bool const x_280 = (x_276 < x_279); + if (x_280) { + x_285 = k; + x_287_phi = x_285; + } else { + x_286 = 0; + x_287_phi = x_286; + } + int const x_287 = x_287_phi; + int const x_288 = (x_287 + 1); + if (x_280) { + k = x_288; + float const x_293 = x_28.injectionSwitch.x; + if (!((1.0f <= x_293))) { + } else { + continue; + } + } + float const x_297 = x_28.injectionSwitch.y; + if ((x_297 >= 0.0f)) { + } else { + continue; + } + int const x_300 = 0; + if (x_280) { + x_305 = i; + x_307_phi = x_305; + } else { + x_306 = 0; + x_307_phi = x_306; + } + int const x_307 = x_307_phi; + int const x_309 = select(x_300, x_307, x_280); + if (x_280) { + i = (x_309 + 1); + } + int const x_315 = 0; + if (x_280) { + x_320 = (*(tint_symbol_5)).arr[x_309]; + float const x_322 = x_28.injectionSwitch.y; + x_328_phi = x_320; + if (!((0.0f <= x_322))) { + continue; + } + } else { + x_324 = 0; + float const x_326 = x_28.injectionSwitch.y; + x_328_phi = x_324; + if (!((x_326 < 0.0f))) { + } else { + continue; + } + } + int const x_328 = x_328_phi; + if (x_280) { + (*(tint_symbol_6)).arr[x_287] = select(x_315, x_328, x_280); + } + if (x_280) { + x_339 = 0; + x_340_phi = x_339; + } else { + x_338 = k; + x_340_phi = x_338; + } + int const x_340 = x_340_phi; + if (x_280) { + } else { + k = (x_340 + 1); + } + float const x_345 = x_28.injectionSwitch.x; + if (!((1.0f <= x_345))) { + } else { + continue; + } + if (x_280) { + x_352 = 0; + x_353_phi = x_352; + } else { + x_351 = j; + x_353_phi = x_351; + } + int const x_353 = x_353_phi; + int const x_355 = 0; + int const x_357 = select(x_353, x_355, x_280); + if (x_280) { + } else { + j = (x_357 + 1); + } + if (x_280) { + x_366 = 0; + x_367_phi = x_366; + } else { + x_365 = (*(tint_symbol_5)).arr[x_357]; + x_367_phi = x_365; + } + int const x_367 = x_367_phi; + if (x_280) { + } else { + (*(tint_symbol_6)).arr[x_340] = x_367; + } + } + while (true) { + int const x_376 = i; + int const x_378 = i; + int const x_379 = *(mid); + if (((x_376 < 10) && (x_378 <= x_379))) { + } else { + break; + } + int const x_383 = k; + k = (x_383 + 1); + int const x_385 = i; + i = (x_385 + 1); + int const x_388 = (*(tint_symbol_5)).arr[x_385]; + (*(tint_symbol_6)).arr[x_383] = x_388; + } + int const x_390 = *(from); + i_1 = x_390; + while (true) { + int const x_395 = i_1; + int const x_396 = *(to); + if ((x_395 <= x_396)) { + } else { + break; + } + int const x_399 = i_1; + int const x_400 = i_1; + int const x_402 = (*(tint_symbol_6)).arr[x_400]; + (*(tint_symbol_5)).arr[x_399] = x_402; + { + int const x_404 = i_1; + i_1 = (x_404 + 1); + } + } + return; +} + +void mergeSort_(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_411 = m; + int const x_412 = high; + if ((x_411 <= x_412)) { + } else { + break; + } + int const x_415 = low; + i_2 = x_415; + while (true) { + int const x_420 = i_2; + int const x_421 = high; + if ((x_420 < x_421)) { + } else { + break; + } + int const x_424 = i_2; + from_1 = x_424; + int const x_425 = i_2; + int const x_426 = m; + mid_1 = ((x_425 + x_426) - 1); + int const x_429 = i_2; + int const x_430 = m; + int const x_434 = high; + to_1 = min(((x_429 + (2 * x_430)) - 1), x_434); + int const x_436 = from_1; + param = x_436; + int const x_437 = mid_1; + param_1 = x_437; + int const x_438 = to_1; + param_2 = x_438; + merge_i1_i1_i1_(x_28, &(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_440 = m; + int const x_442 = i_2; + i_2 = (x_442 + (2 * x_440)); + } + } + { + int const x_444 = m; + m = (2 * x_444); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_88 = x_28.injectionSwitch.x; + i_3 = int(x_88); + while (true) { + int const x_94 = i_3; + switch(x_94) { + case 9: { + int const x_124 = i_3; + (*(tint_symbol_9)).arr[x_124] = -5; + break; + } + case 8: { + int const x_122 = i_3; + (*(tint_symbol_9)).arr[x_122] = -4; + break; + } + case 7: { + int const x_120 = i_3; + (*(tint_symbol_9)).arr[x_120] = -3; + break; + } + case 6: { + int const x_118 = i_3; + (*(tint_symbol_9)).arr[x_118] = -2; + break; + } + case 5: { + int const x_116 = i_3; + (*(tint_symbol_9)).arr[x_116] = -1; + break; + } + case 4: { + int const x_114 = i_3; + (*(tint_symbol_9)).arr[x_114] = 0; + break; + } + case 3: { + int const x_112 = i_3; + (*(tint_symbol_9)).arr[x_112] = 1; + break; + } + case 2: { + int const x_110 = i_3; + (*(tint_symbol_9)).arr[x_110] = 2; + break; + } + case 1: { + int const x_108 = i_3; + (*(tint_symbol_9)).arr[x_108] = 3; + break; + } + case 0: { + int const x_106 = i_3; + (*(tint_symbol_9)).arr[x_106] = 4; + break; + } + default: { + break; + } + } + int const x_126 = i_3; + i_3 = (x_126 + 1); + { + int const x_128 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_134 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + int const x_137 = j_1; + int const x_138 = j_1; + int const x_140 = (*(tint_symbol_9)).arr[x_138]; + (*(tint_symbol_10)).arr[x_137] = x_140; + { + int const x_142 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(x_28, tint_symbol_9, tint_symbol_10); + float const x_146 = (*(tint_symbol_11)).y; + if ((int(x_146) < 30)) { + int const x_153 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_153) / 10.0f)); + } else { + float const x_158 = (*(tint_symbol_11)).y; + if ((int(x_158) < 60)) { + int const x_165 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_165) / 10.0f)); + } else { + float const x_170 = (*(tint_symbol_11)).y; + if ((int(x_170) < 90)) { + int const x_177 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_177) / 10.0f)); + } else { + float const x_182 = (*(tint_symbol_11)).y; + if ((int(x_182) < 120)) { + int const x_189 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_189) / 10.0f)); + } else { + float const x_194 = (*(tint_symbol_11)).y; + if ((int(x_194) < 150)) { + discard_fragment(); + } else { + float const x_201 = (*(tint_symbol_11)).y; + if ((int(x_201) < 180)) { + int const x_208 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_208) / 10.0f)); + } else { + float const x_213 = (*(tint_symbol_11)).y; + if ((int(x_213) < 210)) { + int const x_220 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_220) / 10.0f)); + } else { + float const x_225 = (*(tint_symbol_11)).y; + if ((int(x_225) < 240)) { + int const x_232 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_232) / 10.0f)); + } else { + float const x_237 = (*(tint_symbol_11)).y; + if ((int(x_237) < 270)) { + int const x_244 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_244) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_248 = grey; + float3 const x_249 = float3(x_248, x_248, x_248); + *(tint_symbol_12) = float4(x_249.x, x_249.y, x_249.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..aa67796b49 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.spvasm @@ -0,0 +1,864 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 525 +; Schema: 0 + OpCapability Shader + %290 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %x_285 "x_285" + OpName %x_286 "x_286" + OpName %x_305 "x_305" + OpName %x_306 "x_306" + OpName %x_320 "x_320" + OpName %x_324 "x_324" + OpName %x_339 "x_339" + OpName %x_338 "x_338" + OpName %x_352 "x_352" + OpName %x_351 "x_351" + OpName %x_366 "x_366" + OpName %x_365 "x_365" + OpName %x_287_phi "x_287_phi" + OpName %x_307_phi "x_307_phi" + OpName %x_328_phi "x_328_phi" + OpName %x_340_phi "x_340_phi" + OpName %x_353_phi "x_353_phi" + OpName %x_367_phi "x_367_phi" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %int_10 = OpConstant %int 10 + %246 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %314 = OpConstantNull %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %main_out = OpTypeStruct %v4float + %512 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %x_285 = OpVariable %_ptr_Function_int Function %32 + %x_286 = OpVariable %_ptr_Function_int Function %32 + %x_305 = OpVariable %_ptr_Function_int Function %32 + %x_306 = OpVariable %_ptr_Function_int Function %32 + %x_320 = OpVariable %_ptr_Function_int Function %32 + %x_324 = OpVariable %_ptr_Function_int Function %32 + %x_339 = OpVariable %_ptr_Function_int Function %32 + %x_338 = OpVariable %_ptr_Function_int Function %32 + %x_352 = OpVariable %_ptr_Function_int Function %32 + %x_351 = OpVariable %_ptr_Function_int Function %32 + %x_366 = OpVariable %_ptr_Function_int Function %32 + %x_365 = OpVariable %_ptr_Function_int Function %32 + %x_287_phi = OpVariable %_ptr_Function_int Function %32 + %x_307_phi = OpVariable %_ptr_Function_int Function %32 + %x_328_phi = OpVariable %_ptr_Function_int Function %32 + %x_340_phi = OpVariable %_ptr_Function_int Function %32 + %x_353_phi = OpVariable %_ptr_Function_int Function %32 + %x_367_phi = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %69 = OpLoad %float %68 + %71 = OpFOrdGreaterThanEqual %bool %float_1 %69 + OpSelectionMerge %73 None + OpBranchConditional %71 %74 %75 + %74 = OpLabel + OpBranch %73 + %75 = OpLabel + OpBranch %46 + %73 = OpLabel + %76 = OpLoad %int %i + %78 = OpLoad %int %mid + %79 = OpLoad %int %j + %81 = OpLoad %int %to + %82 = OpSLessThanEqual %bool %76 %78 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + %85 = OpSLessThanEqual %bool %79 %81 + OpBranch %83 + %83 = OpLabel + %86 = OpPhi %bool %82 %73 %85 %84 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %89 + %88 = OpLabel + OpBranch %87 + %89 = OpLabel + OpBranch %45 + %87 = OpLabel + %90 = OpLoad %int %i + %92 = OpAccessChain %_ptr_Private_int %data %90 + %93 = OpLoad %int %92 + %94 = OpLoad %int %j + %95 = OpAccessChain %_ptr_Private_int %data %94 + %96 = OpLoad %int %95 + %97 = OpSLessThan %bool %93 %96 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %100 + %99 = OpLabel + %101 = OpLoad %int %k + OpStore %x_285 %101 + %102 = OpLoad %int %x_285 + OpStore %x_287_phi %102 + OpBranch %98 + %100 = OpLabel + OpStore %x_286 %int_0 + %104 = OpLoad %int %x_286 + OpStore %x_287_phi %104 + OpBranch %98 + %98 = OpLabel + %105 = OpLoad %int %x_287_phi + %106 = OpIAdd %int %105 %int_1 + OpSelectionMerge %107 None + OpBranchConditional %97 %108 %107 + %108 = OpLabel + OpStore %k %106 + %109 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %110 = OpLoad %float %109 + %112 = OpFOrdLessThanEqual %bool %float_1 %110 + %111 = OpLogicalNot %bool %112 + OpSelectionMerge %113 None + OpBranchConditional %111 %114 %115 + %114 = OpLabel + OpBranch %113 + %115 = OpLabel + OpBranch %46 + %113 = OpLabel + OpBranch %107 + %107 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %118 = OpLoad %float %117 + %120 = OpFOrdGreaterThanEqual %bool %118 %float_0 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + OpBranch %121 + %123 = OpLabel + OpBranch %46 + %121 = OpLabel + OpSelectionMerge %124 None + OpBranchConditional %97 %125 %126 + %125 = OpLabel + %127 = OpLoad %int %i + OpStore %x_305 %127 + %128 = OpLoad %int %x_305 + OpStore %x_307_phi %128 + OpBranch %124 + %126 = OpLabel + OpStore %x_306 %int_0 + %129 = OpLoad %int %x_306 + OpStore %x_307_phi %129 + OpBranch %124 + %124 = OpLabel + %130 = OpLoad %int %x_307_phi + %131 = OpSelect %int %97 %130 %int_0 + OpSelectionMerge %132 None + OpBranchConditional %97 %133 %132 + %133 = OpLabel + %134 = OpIAdd %int %131 %int_1 + OpStore %i %134 + OpBranch %132 + %132 = OpLabel + OpSelectionMerge %135 None + OpBranchConditional %97 %136 %137 + %136 = OpLabel + %138 = OpAccessChain %_ptr_Private_int %data %131 + %139 = OpLoad %int %138 + OpStore %x_320 %139 + %140 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %141 = OpLoad %float %140 + %142 = OpLoad %int %x_320 + OpStore %x_328_phi %142 + %144 = OpFOrdLessThanEqual %bool %float_0 %141 + %143 = OpLogicalNot %bool %144 + OpSelectionMerge %145 None + OpBranchConditional %143 %146 %145 + %146 = OpLabel + OpBranch %46 + %145 = OpLabel + OpBranch %135 + %137 = OpLabel + OpStore %x_324 %int_0 + %147 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %148 = OpLoad %float %147 + %149 = OpLoad %int %x_324 + OpStore %x_328_phi %149 + %151 = OpFOrdLessThan %bool %148 %float_0 + %150 = OpLogicalNot %bool %151 + OpSelectionMerge %152 None + OpBranchConditional %150 %153 %154 + %153 = OpLabel + OpBranch %152 + %154 = OpLabel + OpBranch %46 + %152 = OpLabel + OpBranch %135 + %135 = OpLabel + %155 = OpLoad %int %x_328_phi + OpSelectionMerge %156 None + OpBranchConditional %97 %157 %156 + %157 = OpLabel + %158 = OpAccessChain %_ptr_Private_int %temp %105 + %159 = OpSelect %int %97 %155 %int_0 + OpStore %158 %159 + OpBranch %156 + %156 = OpLabel + OpSelectionMerge %160 None + OpBranchConditional %97 %161 %162 + %161 = OpLabel + OpStore %x_339 %int_0 + %163 = OpLoad %int %x_339 + OpStore %x_340_phi %163 + OpBranch %160 + %162 = OpLabel + %164 = OpLoad %int %k + OpStore %x_338 %164 + %165 = OpLoad %int %x_338 + OpStore %x_340_phi %165 + OpBranch %160 + %160 = OpLabel + %166 = OpLoad %int %x_340_phi + OpSelectionMerge %167 None + OpBranchConditional %97 %168 %169 + %168 = OpLabel + OpBranch %167 + %169 = OpLabel + %170 = OpIAdd %int %166 %int_1 + OpStore %k %170 + OpBranch %167 + %167 = OpLabel + %171 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %172 = OpLoad %float %171 + %174 = OpFOrdLessThanEqual %bool %float_1 %172 + %173 = OpLogicalNot %bool %174 + OpSelectionMerge %175 None + OpBranchConditional %173 %176 %177 + %176 = OpLabel + OpBranch %175 + %177 = OpLabel + OpBranch %46 + %175 = OpLabel + OpSelectionMerge %178 None + OpBranchConditional %97 %179 %180 + %179 = OpLabel + OpStore %x_352 %int_0 + %181 = OpLoad %int %x_352 + OpStore %x_353_phi %181 + OpBranch %178 + %180 = OpLabel + %182 = OpLoad %int %j + OpStore %x_351 %182 + %183 = OpLoad %int %x_351 + OpStore %x_353_phi %183 + OpBranch %178 + %178 = OpLabel + %184 = OpLoad %int %x_353_phi + %185 = OpSelect %int %97 %int_0 %184 + OpSelectionMerge %186 None + OpBranchConditional %97 %187 %188 + %187 = OpLabel + OpBranch %186 + %188 = OpLabel + %189 = OpIAdd %int %185 %int_1 + OpStore %j %189 + OpBranch %186 + %186 = OpLabel + OpSelectionMerge %190 None + OpBranchConditional %97 %191 %192 + %191 = OpLabel + OpStore %x_366 %int_0 + %193 = OpLoad %int %x_366 + OpStore %x_367_phi %193 + OpBranch %190 + %192 = OpLabel + %194 = OpAccessChain %_ptr_Private_int %data %185 + %195 = OpLoad %int %194 + OpStore %x_365 %195 + %196 = OpLoad %int %x_365 + OpStore %x_367_phi %196 + OpBranch %190 + %190 = OpLabel + %197 = OpLoad %int %x_367_phi + OpSelectionMerge %198 None + OpBranchConditional %97 %199 %200 + %199 = OpLabel + OpBranch %198 + %200 = OpLabel + %201 = OpAccessChain %_ptr_Private_int %temp %166 + OpStore %201 %197 + OpBranch %198 + %198 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %202 + %202 = OpLabel + OpLoopMerge %203 %204 None + OpBranch %205 + %205 = OpLabel + %206 = OpLoad %int %i + %207 = OpLoad %int %i + %209 = OpLoad %int %mid + %211 = OpSLessThan %bool %206 %int_10 + OpSelectionMerge %212 None + OpBranchConditional %211 %213 %212 + %213 = OpLabel + %214 = OpSLessThanEqual %bool %207 %209 + OpBranch %212 + %212 = OpLabel + %215 = OpPhi %bool %211 %205 %214 %213 + OpSelectionMerge %216 None + OpBranchConditional %215 %217 %218 + %217 = OpLabel + OpBranch %216 + %218 = OpLabel + OpBranch %203 + %216 = OpLabel + %219 = OpLoad %int %k + %220 = OpIAdd %int %219 %int_1 + OpStore %k %220 + %221 = OpLoad %int %i + %222 = OpIAdd %int %221 %int_1 + OpStore %i %222 + %223 = OpAccessChain %_ptr_Private_int %data %221 + %224 = OpLoad %int %223 + %225 = OpAccessChain %_ptr_Private_int %temp %219 + OpStore %225 %224 + OpBranch %204 + %204 = OpLabel + OpBranch %202 + %203 = OpLabel + %227 = OpLoad %int %from + OpStore %i_1 %227 + OpBranch %228 + %228 = OpLabel + OpLoopMerge %229 %230 None + OpBranch %231 + %231 = OpLabel + %232 = OpLoad %int %i_1 + %234 = OpLoad %int %to + %235 = OpSLessThanEqual %bool %232 %234 + OpSelectionMerge %236 None + OpBranchConditional %235 %237 %238 + %237 = OpLabel + OpBranch %236 + %238 = OpLabel + OpBranch %229 + %236 = OpLabel + %239 = OpLoad %int %i_1 + %240 = OpLoad %int %i_1 + %241 = OpAccessChain %_ptr_Private_int %temp %240 + %242 = OpLoad %int %241 + %243 = OpAccessChain %_ptr_Private_int %data %239 + OpStore %243 %242 + OpBranch %230 + %230 = OpLabel + %244 = OpLoad %int %i_1 + %245 = OpIAdd %int %244 %int_1 + OpStore %i_1 %245 + OpBranch %228 + %229 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %246 + %248 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %260 + %260 = OpLabel + OpLoopMerge %261 %262 None + OpBranch %263 + %263 = OpLabel + %264 = OpLoad %int %m + %265 = OpLoad %int %high + %266 = OpSLessThanEqual %bool %264 %265 + OpSelectionMerge %267 None + OpBranchConditional %266 %268 %269 + %268 = OpLabel + OpBranch %267 + %269 = OpLabel + OpBranch %261 + %267 = OpLabel + %270 = OpLoad %int %low + OpStore %i_2 %270 + OpBranch %271 + %271 = OpLabel + OpLoopMerge %272 %273 None + OpBranch %274 + %274 = OpLabel + %275 = OpLoad %int %i_2 + %276 = OpLoad %int %high + %277 = OpSLessThan %bool %275 %276 + OpSelectionMerge %278 None + OpBranchConditional %277 %279 %280 + %279 = OpLabel + OpBranch %278 + %280 = OpLabel + OpBranch %272 + %278 = OpLabel + %281 = OpLoad %int %i_2 + OpStore %from_1 %281 + %282 = OpLoad %int %i_2 + %283 = OpLoad %int %m + %284 = OpIAdd %int %282 %283 + %285 = OpISub %int %284 %int_1 + OpStore %mid_1 %285 + %286 = OpLoad %int %i_2 + %287 = OpLoad %int %m + %288 = OpLoad %int %high + %292 = OpIMul %int %int_2 %287 + %293 = OpIAdd %int %286 %292 + %294 = OpISub %int %293 %int_1 + %289 = OpExtInst %int %290 SMin %294 %288 + OpStore %to_1 %289 + %295 = OpLoad %int %from_1 + OpStore %param %295 + %296 = OpLoad %int %mid_1 + OpStore %param_1 %296 + %297 = OpLoad %int %to_1 + OpStore %param_2 %297 + %298 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %273 + %273 = OpLabel + %302 = OpLoad %int %m + %303 = OpLoad %int %i_2 + %304 = OpIMul %int %int_2 %302 + %305 = OpIAdd %int %303 %304 + OpStore %i_2 %305 + OpBranch %271 + %272 = OpLabel + OpBranch %262 + %262 = OpLabel + %306 = OpLoad %int %m + %307 = OpIMul %int %int_2 %306 + OpStore %m %307 + OpBranch %260 + %261 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %246 + %309 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %314 + %315 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %316 = OpLoad %float %315 + %317 = OpConvertFToS %int %316 + OpStore %i_3 %317 + OpBranch %318 + %318 = OpLabel + OpLoopMerge %319 %320 None + OpBranch %321 + %321 = OpLabel + %322 = OpLoad %int %i_3 + OpSelectionMerge %323 None + OpSwitch %322 %324 9 %325 8 %326 7 %327 6 %328 5 %329 4 %330 3 %331 2 %332 1 %333 0 %334 + %325 = OpLabel + %335 = OpLoad %int %i_3 + %336 = OpAccessChain %_ptr_Private_int %data %335 + OpStore %336 %int_n5 + OpBranch %323 + %326 = OpLabel + %338 = OpLoad %int %i_3 + %339 = OpAccessChain %_ptr_Private_int %data %338 + OpStore %339 %int_n4 + OpBranch %323 + %327 = OpLabel + %341 = OpLoad %int %i_3 + %342 = OpAccessChain %_ptr_Private_int %data %341 + OpStore %342 %int_n3 + OpBranch %323 + %328 = OpLabel + %344 = OpLoad %int %i_3 + %345 = OpAccessChain %_ptr_Private_int %data %344 + OpStore %345 %int_n2 + OpBranch %323 + %329 = OpLabel + %347 = OpLoad %int %i_3 + %348 = OpAccessChain %_ptr_Private_int %data %347 + OpStore %348 %int_n1 + OpBranch %323 + %330 = OpLabel + %350 = OpLoad %int %i_3 + %351 = OpAccessChain %_ptr_Private_int %data %350 + OpStore %351 %int_0 + OpBranch %323 + %331 = OpLabel + %352 = OpLoad %int %i_3 + %353 = OpAccessChain %_ptr_Private_int %data %352 + OpStore %353 %int_1 + OpBranch %323 + %332 = OpLabel + %354 = OpLoad %int %i_3 + %355 = OpAccessChain %_ptr_Private_int %data %354 + OpStore %355 %int_2 + OpBranch %323 + %333 = OpLabel + %356 = OpLoad %int %i_3 + %357 = OpAccessChain %_ptr_Private_int %data %356 + OpStore %357 %int_3 + OpBranch %323 + %334 = OpLabel + %359 = OpLoad %int %i_3 + %360 = OpAccessChain %_ptr_Private_int %data %359 + OpStore %360 %int_4 + OpBranch %323 + %324 = OpLabel + OpBranch %323 + %323 = OpLabel + %362 = OpLoad %int %i_3 + %363 = OpIAdd %int %362 %int_1 + OpStore %i_3 %363 + OpBranch %320 + %320 = OpLabel + %364 = OpLoad %int %i_3 + %365 = OpSLessThan %bool %364 %int_10 + OpSelectionMerge %366 None + OpBranchConditional %365 %367 %368 + %367 = OpLabel + OpBranch %366 + %368 = OpLabel + OpBranch %319 + %366 = OpLabel + OpBranch %318 + %319 = OpLabel + OpStore %j_1 %int_0 + OpBranch %369 + %369 = OpLabel + OpLoopMerge %370 %371 None + OpBranch %372 + %372 = OpLabel + %373 = OpLoad %int %j_1 + %374 = OpSLessThan %bool %373 %int_10 + OpSelectionMerge %375 None + OpBranchConditional %374 %376 %377 + %376 = OpLabel + OpBranch %375 + %377 = OpLabel + OpBranch %370 + %375 = OpLabel + %378 = OpLoad %int %j_1 + %379 = OpLoad %int %j_1 + %380 = OpAccessChain %_ptr_Private_int %data %379 + %381 = OpLoad %int %380 + %382 = OpAccessChain %_ptr_Private_int %temp %378 + OpStore %382 %381 + OpBranch %371 + %371 = OpLabel + %383 = OpLoad %int %j_1 + %384 = OpIAdd %int %383 %int_1 + OpStore %j_1 %384 + OpBranch %369 + %370 = OpLabel + %385 = OpFunctionCall %void %mergeSort_ + %387 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %388 = OpLoad %float %387 + %389 = OpConvertFToS %int %388 + %391 = OpSLessThan %bool %389 %int_30 + OpSelectionMerge %392 None + OpBranchConditional %391 %393 %394 + %393 = OpLabel + %395 = OpAccessChain %_ptr_Private_int %data %int_0 + %396 = OpLoad %int %395 + %398 = OpConvertSToF %float %396 + %400 = OpFDiv %float %398 %float_10 + %401 = OpFAdd %float %float_0_5 %400 + OpStore %grey %401 + OpBranch %392 + %394 = OpLabel + %402 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %403 = OpLoad %float %402 + %404 = OpConvertFToS %int %403 + %406 = OpSLessThan %bool %404 %int_60 + OpSelectionMerge %407 None + OpBranchConditional %406 %408 %409 + %408 = OpLabel + %410 = OpAccessChain %_ptr_Private_int %data %int_1 + %411 = OpLoad %int %410 + %412 = OpConvertSToF %float %411 + %413 = OpFDiv %float %412 %float_10 + %414 = OpFAdd %float %float_0_5 %413 + OpStore %grey %414 + OpBranch %407 + %409 = OpLabel + %415 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %416 = OpLoad %float %415 + %417 = OpConvertFToS %int %416 + %419 = OpSLessThan %bool %417 %int_90 + OpSelectionMerge %420 None + OpBranchConditional %419 %421 %422 + %421 = OpLabel + %423 = OpAccessChain %_ptr_Private_int %data %int_2 + %424 = OpLoad %int %423 + %425 = OpConvertSToF %float %424 + %426 = OpFDiv %float %425 %float_10 + %427 = OpFAdd %float %float_0_5 %426 + OpStore %grey %427 + OpBranch %420 + %422 = OpLabel + %428 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %429 = OpLoad %float %428 + %430 = OpConvertFToS %int %429 + %432 = OpSLessThan %bool %430 %int_120 + OpSelectionMerge %433 None + OpBranchConditional %432 %434 %435 + %434 = OpLabel + %436 = OpAccessChain %_ptr_Private_int %data %int_3 + %437 = OpLoad %int %436 + %438 = OpConvertSToF %float %437 + %439 = OpFDiv %float %438 %float_10 + %440 = OpFAdd %float %float_0_5 %439 + OpStore %grey %440 + OpBranch %433 + %435 = OpLabel + %441 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %442 = OpLoad %float %441 + %443 = OpConvertFToS %int %442 + %445 = OpSLessThan %bool %443 %int_150 + OpSelectionMerge %446 None + OpBranchConditional %445 %447 %448 + %447 = OpLabel + OpKill + %448 = OpLabel + %449 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %450 = OpLoad %float %449 + %451 = OpConvertFToS %int %450 + %453 = OpSLessThan %bool %451 %int_180 + OpSelectionMerge %454 None + OpBranchConditional %453 %455 %456 + %455 = OpLabel + %458 = OpAccessChain %_ptr_Private_int %data %int_5 + %459 = OpLoad %int %458 + %460 = OpConvertSToF %float %459 + %461 = OpFDiv %float %460 %float_10 + %462 = OpFAdd %float %float_0_5 %461 + OpStore %grey %462 + OpBranch %454 + %456 = OpLabel + %463 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %464 = OpLoad %float %463 + %465 = OpConvertFToS %int %464 + %467 = OpSLessThan %bool %465 %int_210 + OpSelectionMerge %468 None + OpBranchConditional %467 %469 %470 + %469 = OpLabel + %472 = OpAccessChain %_ptr_Private_int %data %int_6 + %473 = OpLoad %int %472 + %474 = OpConvertSToF %float %473 + %475 = OpFDiv %float %474 %float_10 + %476 = OpFAdd %float %float_0_5 %475 + OpStore %grey %476 + OpBranch %468 + %470 = OpLabel + %477 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %478 = OpLoad %float %477 + %479 = OpConvertFToS %int %478 + %481 = OpSLessThan %bool %479 %int_240 + OpSelectionMerge %482 None + OpBranchConditional %481 %483 %484 + %483 = OpLabel + %486 = OpAccessChain %_ptr_Private_int %data %int_7 + %487 = OpLoad %int %486 + %488 = OpConvertSToF %float %487 + %489 = OpFDiv %float %488 %float_10 + %490 = OpFAdd %float %float_0_5 %489 + OpStore %grey %490 + OpBranch %482 + %484 = OpLabel + %491 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %492 = OpLoad %float %491 + %493 = OpConvertFToS %int %492 + %495 = OpSLessThan %bool %493 %int_270 + OpSelectionMerge %496 None + OpBranchConditional %495 %497 %498 + %497 = OpLabel + %500 = OpAccessChain %_ptr_Private_int %data %int_8 + %501 = OpLoad %int %500 + %502 = OpConvertSToF %float %501 + %503 = OpFDiv %float %502 %float_10 + %504 = OpFAdd %float %float_0_5 %503 + OpStore %grey %504 + OpBranch %496 + %498 = OpLabel + OpKill + %496 = OpLabel + OpBranch %482 + %482 = OpLabel + OpBranch %468 + %468 = OpLabel + OpBranch %454 + %454 = OpLabel + OpBranch %446 + %446 = OpLabel + OpBranch %433 + %433 = OpLabel + OpBranch %420 + %420 = OpLabel + OpBranch %407 + %407 = OpLabel + OpBranch %392 + %392 = OpLabel + %505 = OpLoad %float %grey + %507 = OpCompositeConstruct %v3float %505 %505 %505 + %508 = OpCompositeExtract %float %507 0 + %509 = OpCompositeExtract %float %507 1 + %510 = OpCompositeExtract %float %507 2 + %511 = OpCompositeConstruct %v4float %508 %509 %510 %float_1 + OpStore %x_GLF_color %511 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %512 +%tint_symbol_1 = OpFunctionParameter %main_out + %516 = OpLabel + %517 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %517 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %246 + %519 = OpLabel + %520 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %520 + %521 = OpFunctionCall %void %main_1 + %523 = OpLoad %v4float %x_GLF_color + %524 = OpCompositeConstruct %main_out %523 + %522 = OpFunctionCall %void %tint_symbol_3 %524 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 320[%320] is not post dominated by the back-edge block 366[%366] + %366 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..5fac853322 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.spvasm.expected.wgsl @@ -0,0 +1,414 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_255 : i32 = *(from); + k = x_255; + let x_256 : i32 = *(from); + i = x_256; + let x_257 : i32 = *(mid); + j = (x_257 + 1); + loop { + var x_285 : i32; + var x_286 : i32; + var x_305 : i32; + var x_306 : i32; + var x_320 : i32; + var x_324 : i32; + var x_339 : i32; + var x_338 : i32; + var x_352 : i32; + var x_351 : i32; + var x_366 : i32; + var x_365 : i32; + var x_287_phi : i32; + var x_307_phi : i32; + var x_328_phi : i32; + var x_340_phi : i32; + var x_353_phi : i32; + var x_367_phi : i32; + let x_261 : f32 = x_28.injectionSwitch.x; + if ((1.0 >= x_261)) { + } else { + continue; + } + let x_266 : i32 = i; + let x_267 : i32 = *(mid); + let x_269 : i32 = j; + let x_270 : i32 = *(to); + if (((x_266 <= x_267) && (x_269 <= x_270))) { + } else { + break; + } + let x_274 : i32 = i; + let x_276 : i32 = data[x_274]; + let x_277 : i32 = j; + let x_279 : i32 = data[x_277]; + let x_280 : bool = (x_276 < x_279); + if (x_280) { + x_285 = k; + x_287_phi = x_285; + } else { + x_286 = 0; + x_287_phi = x_286; + } + let x_287 : i32 = x_287_phi; + let x_288 : i32 = (x_287 + 1); + if (x_280) { + k = x_288; + let x_293 : f32 = x_28.injectionSwitch.x; + if (!((1.0 <= x_293))) { + } else { + continue; + } + } + let x_297 : f32 = x_28.injectionSwitch.y; + if ((x_297 >= 0.0)) { + } else { + continue; + } + let x_300 : i32 = 0; + if (x_280) { + x_305 = i; + x_307_phi = x_305; + } else { + x_306 = 0; + x_307_phi = x_306; + } + let x_307 : i32 = x_307_phi; + let x_309 : i32 = select(x_300, x_307, x_280); + if (x_280) { + i = (x_309 + 1); + } + let x_315 : i32 = 0; + if (x_280) { + x_320 = data[x_309]; + let x_322 : f32 = x_28.injectionSwitch.y; + x_328_phi = x_320; + if (!((0.0 <= x_322))) { + continue; + } + } else { + x_324 = 0; + let x_326 : f32 = x_28.injectionSwitch.y; + x_328_phi = x_324; + if (!((x_326 < 0.0))) { + } else { + continue; + } + } + let x_328 : i32 = x_328_phi; + if (x_280) { + temp[x_287] = select(x_315, x_328, x_280); + } + if (x_280) { + x_339 = 0; + x_340_phi = x_339; + } else { + x_338 = k; + x_340_phi = x_338; + } + let x_340 : i32 = x_340_phi; + if (x_280) { + } else { + k = (x_340 + 1); + } + let x_345 : f32 = x_28.injectionSwitch.x; + if (!((1.0 <= x_345))) { + } else { + continue; + } + if (x_280) { + x_352 = 0; + x_353_phi = x_352; + } else { + x_351 = j; + x_353_phi = x_351; + } + let x_353 : i32 = x_353_phi; + let x_355 : i32 = 0; + let x_357 : i32 = select(x_353, x_355, x_280); + if (x_280) { + } else { + j = (x_357 + 1); + } + if (x_280) { + x_366 = 0; + x_367_phi = x_366; + } else { + x_365 = data[x_357]; + x_367_phi = x_365; + } + let x_367 : i32 = x_367_phi; + if (x_280) { + } else { + temp[x_340] = x_367; + } + } + loop { + let x_376 : i32 = i; + let x_378 : i32 = i; + let x_379 : i32 = *(mid); + if (((x_376 < 10) && (x_378 <= x_379))) { + } else { + break; + } + let x_383 : i32 = k; + k = (x_383 + 1); + let x_385 : i32 = i; + i = (x_385 + 1); + let x_388 : i32 = data[x_385]; + temp[x_383] = x_388; + } + let x_390 : i32 = *(from); + i_1 = x_390; + loop { + let x_395 : i32 = i_1; + let x_396 : i32 = *(to); + if ((x_395 <= x_396)) { + } else { + break; + } + let x_399 : i32 = i_1; + let x_400 : i32 = i_1; + let x_402 : i32 = temp[x_400]; + data[x_399] = x_402; + + continuing { + let x_404 : i32 = i_1; + i_1 = (x_404 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_411 : i32 = m; + let x_412 : i32 = high; + if ((x_411 <= x_412)) { + } else { + break; + } + let x_415 : i32 = low; + i_2 = x_415; + loop { + let x_420 : i32 = i_2; + let x_421 : i32 = high; + if ((x_420 < x_421)) { + } else { + break; + } + let x_424 : i32 = i_2; + from_1 = x_424; + let x_425 : i32 = i_2; + let x_426 : i32 = m; + mid_1 = ((x_425 + x_426) - 1); + let x_429 : i32 = i_2; + let x_430 : i32 = m; + let x_434 : i32 = high; + to_1 = min(((x_429 + (2 * x_430)) - 1), x_434); + let x_436 : i32 = from_1; + param = x_436; + let x_437 : i32 = mid_1; + param_1 = x_437; + let x_438 : i32 = to_1; + param_2 = x_438; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_440 : i32 = m; + let x_442 : i32 = i_2; + i_2 = (x_442 + (2 * x_440)); + } + } + + continuing { + let x_444 : i32 = m; + m = (2 * x_444); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_88 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_88); + loop { + let x_94 : i32 = i_3; + switch(x_94) { + case 9: { + let x_124 : i32 = i_3; + data[x_124] = -5; + } + case 8: { + let x_122 : i32 = i_3; + data[x_122] = -4; + } + case 7: { + let x_120 : i32 = i_3; + data[x_120] = -3; + } + case 6: { + let x_118 : i32 = i_3; + data[x_118] = -2; + } + case 5: { + let x_116 : i32 = i_3; + data[x_116] = -1; + } + case 4: { + let x_114 : i32 = i_3; + data[x_114] = 0; + } + case 3: { + let x_112 : i32 = i_3; + data[x_112] = 1; + } + case 2: { + let x_110 : i32 = i_3; + data[x_110] = 2; + } + case 1: { + let x_108 : i32 = i_3; + data[x_108] = 3; + } + case 0: { + let x_106 : i32 = i_3; + data[x_106] = 4; + } + default: { + } + } + let x_126 : i32 = i_3; + i_3 = (x_126 + 1); + + continuing { + let x_128 : i32 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_134 : i32 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + let x_137 : i32 = j_1; + let x_138 : i32 = j_1; + let x_140 : i32 = data[x_138]; + temp[x_137] = x_140; + + continuing { + let x_142 : i32 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(); + let x_146 : f32 = gl_FragCoord.y; + if ((i32(x_146) < 30)) { + let x_153 : i32 = data[0]; + grey = (0.5 + (f32(x_153) / 10.0)); + } else { + let x_158 : f32 = gl_FragCoord.y; + if ((i32(x_158) < 60)) { + let x_165 : i32 = data[1]; + grey = (0.5 + (f32(x_165) / 10.0)); + } else { + let x_170 : f32 = gl_FragCoord.y; + if ((i32(x_170) < 90)) { + let x_177 : i32 = data[2]; + grey = (0.5 + (f32(x_177) / 10.0)); + } else { + let x_182 : f32 = gl_FragCoord.y; + if ((i32(x_182) < 120)) { + let x_189 : i32 = data[3]; + grey = (0.5 + (f32(x_189) / 10.0)); + } else { + let x_194 : f32 = gl_FragCoord.y; + if ((i32(x_194) < 150)) { + discard; + } else { + let x_201 : f32 = gl_FragCoord.y; + if ((i32(x_201) < 180)) { + let x_208 : i32 = data[5]; + grey = (0.5 + (f32(x_208) / 10.0)); + } else { + let x_213 : f32 = gl_FragCoord.y; + if ((i32(x_213) < 210)) { + let x_220 : i32 = data[6]; + grey = (0.5 + (f32(x_220) / 10.0)); + } else { + let x_225 : f32 = gl_FragCoord.y; + if ((i32(x_225) < 240)) { + let x_232 : i32 = data[7]; + grey = (0.5 + (f32(x_232) / 10.0)); + } else { + let x_237 : f32 = gl_FragCoord.y; + if ((i32(x_237) < 270)) { + let x_244 : i32 = data[8]; + grey = (0.5 + (f32(x_244) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_248 : f32 = grey; + let x_249 : vec3 = vec3(x_248, x_248, x_248); + x_GLF_color = vec4(x_249.x, x_249.y, x_249.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl new file mode 100644 index 0000000000..5fac853322 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl @@ -0,0 +1,414 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_255 : i32 = *(from); + k = x_255; + let x_256 : i32 = *(from); + i = x_256; + let x_257 : i32 = *(mid); + j = (x_257 + 1); + loop { + var x_285 : i32; + var x_286 : i32; + var x_305 : i32; + var x_306 : i32; + var x_320 : i32; + var x_324 : i32; + var x_339 : i32; + var x_338 : i32; + var x_352 : i32; + var x_351 : i32; + var x_366 : i32; + var x_365 : i32; + var x_287_phi : i32; + var x_307_phi : i32; + var x_328_phi : i32; + var x_340_phi : i32; + var x_353_phi : i32; + var x_367_phi : i32; + let x_261 : f32 = x_28.injectionSwitch.x; + if ((1.0 >= x_261)) { + } else { + continue; + } + let x_266 : i32 = i; + let x_267 : i32 = *(mid); + let x_269 : i32 = j; + let x_270 : i32 = *(to); + if (((x_266 <= x_267) && (x_269 <= x_270))) { + } else { + break; + } + let x_274 : i32 = i; + let x_276 : i32 = data[x_274]; + let x_277 : i32 = j; + let x_279 : i32 = data[x_277]; + let x_280 : bool = (x_276 < x_279); + if (x_280) { + x_285 = k; + x_287_phi = x_285; + } else { + x_286 = 0; + x_287_phi = x_286; + } + let x_287 : i32 = x_287_phi; + let x_288 : i32 = (x_287 + 1); + if (x_280) { + k = x_288; + let x_293 : f32 = x_28.injectionSwitch.x; + if (!((1.0 <= x_293))) { + } else { + continue; + } + } + let x_297 : f32 = x_28.injectionSwitch.y; + if ((x_297 >= 0.0)) { + } else { + continue; + } + let x_300 : i32 = 0; + if (x_280) { + x_305 = i; + x_307_phi = x_305; + } else { + x_306 = 0; + x_307_phi = x_306; + } + let x_307 : i32 = x_307_phi; + let x_309 : i32 = select(x_300, x_307, x_280); + if (x_280) { + i = (x_309 + 1); + } + let x_315 : i32 = 0; + if (x_280) { + x_320 = data[x_309]; + let x_322 : f32 = x_28.injectionSwitch.y; + x_328_phi = x_320; + if (!((0.0 <= x_322))) { + continue; + } + } else { + x_324 = 0; + let x_326 : f32 = x_28.injectionSwitch.y; + x_328_phi = x_324; + if (!((x_326 < 0.0))) { + } else { + continue; + } + } + let x_328 : i32 = x_328_phi; + if (x_280) { + temp[x_287] = select(x_315, x_328, x_280); + } + if (x_280) { + x_339 = 0; + x_340_phi = x_339; + } else { + x_338 = k; + x_340_phi = x_338; + } + let x_340 : i32 = x_340_phi; + if (x_280) { + } else { + k = (x_340 + 1); + } + let x_345 : f32 = x_28.injectionSwitch.x; + if (!((1.0 <= x_345))) { + } else { + continue; + } + if (x_280) { + x_352 = 0; + x_353_phi = x_352; + } else { + x_351 = j; + x_353_phi = x_351; + } + let x_353 : i32 = x_353_phi; + let x_355 : i32 = 0; + let x_357 : i32 = select(x_353, x_355, x_280); + if (x_280) { + } else { + j = (x_357 + 1); + } + if (x_280) { + x_366 = 0; + x_367_phi = x_366; + } else { + x_365 = data[x_357]; + x_367_phi = x_365; + } + let x_367 : i32 = x_367_phi; + if (x_280) { + } else { + temp[x_340] = x_367; + } + } + loop { + let x_376 : i32 = i; + let x_378 : i32 = i; + let x_379 : i32 = *(mid); + if (((x_376 < 10) && (x_378 <= x_379))) { + } else { + break; + } + let x_383 : i32 = k; + k = (x_383 + 1); + let x_385 : i32 = i; + i = (x_385 + 1); + let x_388 : i32 = data[x_385]; + temp[x_383] = x_388; + } + let x_390 : i32 = *(from); + i_1 = x_390; + loop { + let x_395 : i32 = i_1; + let x_396 : i32 = *(to); + if ((x_395 <= x_396)) { + } else { + break; + } + let x_399 : i32 = i_1; + let x_400 : i32 = i_1; + let x_402 : i32 = temp[x_400]; + data[x_399] = x_402; + + continuing { + let x_404 : i32 = i_1; + i_1 = (x_404 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_411 : i32 = m; + let x_412 : i32 = high; + if ((x_411 <= x_412)) { + } else { + break; + } + let x_415 : i32 = low; + i_2 = x_415; + loop { + let x_420 : i32 = i_2; + let x_421 : i32 = high; + if ((x_420 < x_421)) { + } else { + break; + } + let x_424 : i32 = i_2; + from_1 = x_424; + let x_425 : i32 = i_2; + let x_426 : i32 = m; + mid_1 = ((x_425 + x_426) - 1); + let x_429 : i32 = i_2; + let x_430 : i32 = m; + let x_434 : i32 = high; + to_1 = min(((x_429 + (2 * x_430)) - 1), x_434); + let x_436 : i32 = from_1; + param = x_436; + let x_437 : i32 = mid_1; + param_1 = x_437; + let x_438 : i32 = to_1; + param_2 = x_438; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_440 : i32 = m; + let x_442 : i32 = i_2; + i_2 = (x_442 + (2 * x_440)); + } + } + + continuing { + let x_444 : i32 = m; + m = (2 * x_444); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_88 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_88); + loop { + let x_94 : i32 = i_3; + switch(x_94) { + case 9: { + let x_124 : i32 = i_3; + data[x_124] = -5; + } + case 8: { + let x_122 : i32 = i_3; + data[x_122] = -4; + } + case 7: { + let x_120 : i32 = i_3; + data[x_120] = -3; + } + case 6: { + let x_118 : i32 = i_3; + data[x_118] = -2; + } + case 5: { + let x_116 : i32 = i_3; + data[x_116] = -1; + } + case 4: { + let x_114 : i32 = i_3; + data[x_114] = 0; + } + case 3: { + let x_112 : i32 = i_3; + data[x_112] = 1; + } + case 2: { + let x_110 : i32 = i_3; + data[x_110] = 2; + } + case 1: { + let x_108 : i32 = i_3; + data[x_108] = 3; + } + case 0: { + let x_106 : i32 = i_3; + data[x_106] = 4; + } + default: { + } + } + let x_126 : i32 = i_3; + i_3 = (x_126 + 1); + + continuing { + let x_128 : i32 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_134 : i32 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + let x_137 : i32 = j_1; + let x_138 : i32 = j_1; + let x_140 : i32 = data[x_138]; + temp[x_137] = x_140; + + continuing { + let x_142 : i32 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(); + let x_146 : f32 = gl_FragCoord.y; + if ((i32(x_146) < 30)) { + let x_153 : i32 = data[0]; + grey = (0.5 + (f32(x_153) / 10.0)); + } else { + let x_158 : f32 = gl_FragCoord.y; + if ((i32(x_158) < 60)) { + let x_165 : i32 = data[1]; + grey = (0.5 + (f32(x_165) / 10.0)); + } else { + let x_170 : f32 = gl_FragCoord.y; + if ((i32(x_170) < 90)) { + let x_177 : i32 = data[2]; + grey = (0.5 + (f32(x_177) / 10.0)); + } else { + let x_182 : f32 = gl_FragCoord.y; + if ((i32(x_182) < 120)) { + let x_189 : i32 = data[3]; + grey = (0.5 + (f32(x_189) / 10.0)); + } else { + let x_194 : f32 = gl_FragCoord.y; + if ((i32(x_194) < 150)) { + discard; + } else { + let x_201 : f32 = gl_FragCoord.y; + if ((i32(x_201) < 180)) { + let x_208 : i32 = data[5]; + grey = (0.5 + (f32(x_208) / 10.0)); + } else { + let x_213 : f32 = gl_FragCoord.y; + if ((i32(x_213) < 210)) { + let x_220 : i32 = data[6]; + grey = (0.5 + (f32(x_220) / 10.0)); + } else { + let x_225 : f32 = gl_FragCoord.y; + if ((i32(x_225) < 240)) { + let x_232 : i32 = data[7]; + grey = (0.5 + (f32(x_232) / 10.0)); + } else { + let x_237 : f32 = gl_FragCoord.y; + if ((i32(x_237) < 270)) { + let x_244 : i32 = data[8]; + grey = (0.5 + (f32(x_244) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_248 : f32 = grey; + let x_249 : vec3 = vec3(x_248, x_248, x_248); + x_GLF_color = vec4(x_249.x, x_249.y, x_249.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..5cccfe9135 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.hlsl @@ -0,0 +1,373 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_255 = from; + k = x_255; + const int x_256 = from; + i = x_256; + const int x_257 = mid; + j = (x_257 + 1); + while (true) { + int x_285 = 0; + int x_286 = 0; + int x_305 = 0; + int x_306 = 0; + int x_320 = 0; + int x_324 = 0; + int x_339 = 0; + int x_338 = 0; + int x_352 = 0; + int x_351 = 0; + int x_366 = 0; + int x_365 = 0; + int x_287_phi = 0; + int x_307_phi = 0; + int x_328_phi = 0; + int x_340_phi = 0; + int x_353_phi = 0; + int x_367_phi = 0; + const float x_261 = asfloat(x_28[0].x); + if ((1.0f >= x_261)) { + } else { + continue; + } + const int x_266 = i; + const int x_267 = mid; + const int x_269 = j; + const int x_270 = to; + bool tint_tmp = (x_266 <= x_267); + if (tint_tmp) { + tint_tmp = (x_269 <= x_270); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_276 = data[i]; + const int x_279 = data[j]; + const bool x_280 = (x_276 < x_279); + if (x_280) { + x_285 = k; + x_287_phi = x_285; + } else { + x_286 = 0; + x_287_phi = x_286; + } + const int x_287 = x_287_phi; + const int x_288 = (x_287 + 1); + if (x_280) { + k = x_288; + const float x_293 = asfloat(x_28[0].x); + if (!((1.0f <= x_293))) { + } else { + continue; + } + } + const float x_297 = asfloat(x_28[0].y); + if ((x_297 >= 0.0f)) { + } else { + continue; + } + const int x_300 = 0; + if (x_280) { + x_305 = i; + x_307_phi = x_305; + } else { + x_306 = 0; + x_307_phi = x_306; + } + const int x_309 = (x_280 ? x_307_phi : x_300); + if (x_280) { + i = (x_309 + 1); + } + const int x_315 = 0; + if (x_280) { + x_320 = data[x_309]; + const float x_322 = asfloat(x_28[0].y); + x_328_phi = x_320; + if (!((0.0f <= x_322))) { + continue; + } + } else { + x_324 = 0; + const float x_326 = asfloat(x_28[0].y); + x_328_phi = x_324; + if (!((x_326 < 0.0f))) { + } else { + continue; + } + } + const int x_328 = x_328_phi; + if (x_280) { + temp[x_287] = (x_280 ? x_328 : x_315); + } + if (x_280) { + x_339 = 0; + x_340_phi = x_339; + } else { + x_338 = k; + x_340_phi = x_338; + } + const int x_340 = x_340_phi; + if (x_280) { + } else { + k = (x_340 + 1); + } + const float x_345 = asfloat(x_28[0].x); + if (!((1.0f <= x_345))) { + } else { + continue; + } + if (x_280) { + x_352 = 0; + x_353_phi = x_352; + } else { + x_351 = j; + x_353_phi = x_351; + } + const int x_357 = (x_280 ? 0 : x_353_phi); + if (x_280) { + } else { + j = (x_357 + 1); + } + if (x_280) { + x_366 = 0; + x_367_phi = x_366; + } else { + x_365 = data[x_357]; + x_367_phi = x_365; + } + const int x_367 = x_367_phi; + if (x_280) { + } else { + temp[x_340] = x_367; + } + } + while (true) { + const int x_376 = i; + const int x_378 = i; + const int x_379 = mid; + bool tint_tmp_1 = (x_376 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_378 <= x_379); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_383 = k; + k = (x_383 + 1); + const int x_385 = i; + i = (x_385 + 1); + const int x_388 = data[x_385]; + temp[x_383] = x_388; + } + const int x_390 = from; + i_1 = x_390; + while (true) { + const int x_395 = i_1; + const int x_396 = to; + if ((x_395 <= x_396)) { + } else { + break; + } + const int x_399 = i_1; + const int x_402 = temp[i_1]; + data[x_399] = x_402; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_88 = asfloat(x_28[0].x); + i_3 = int(x_88); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_137 = j_1; + const int x_140 = data[j_1]; + temp[x_137] = x_140; + } + } + mergeSort_(); + const float x_146 = gl_FragCoord.y; + if ((int(x_146) < 30)) { + const int x_153 = data[0]; + grey = (0.5f + (float(x_153) / 10.0f)); + } else { + const float x_158 = gl_FragCoord.y; + if ((int(x_158) < 60)) { + const int x_165 = data[1]; + grey = (0.5f + (float(x_165) / 10.0f)); + } else { + const float x_170 = gl_FragCoord.y; + if ((int(x_170) < 90)) { + const int x_177 = data[2]; + grey = (0.5f + (float(x_177) / 10.0f)); + } else { + const float x_182 = gl_FragCoord.y; + if ((int(x_182) < 120)) { + const int x_189 = data[3]; + grey = (0.5f + (float(x_189) / 10.0f)); + } else { + const float x_194 = gl_FragCoord.y; + if ((int(x_194) < 150)) { + discard; + } else { + const float x_201 = gl_FragCoord.y; + if ((int(x_201) < 180)) { + const int x_208 = data[5]; + grey = (0.5f + (float(x_208) / 10.0f)); + } else { + const float x_213 = gl_FragCoord.y; + if ((int(x_213) < 210)) { + const int x_220 = data[6]; + grey = (0.5f + (float(x_220) / 10.0f)); + } else { + const float x_225 = gl_FragCoord.y; + if ((int(x_225) < 240)) { + const int x_232 = data[7]; + grey = (0.5f + (float(x_232) / 10.0f)); + } else { + const float x_237 = gl_FragCoord.y; + if ((int(x_237) < 270)) { + const int x_244 = data[8]; + grey = (0.5f + (float(x_244) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_248 = grey; + const float3 x_249 = float3(x_248, x_248, x_248); + x_GLF_color = float4(x_249.x, x_249.y, x_249.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.msl new file mode 100644 index 0000000000..a023050028 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.msl @@ -0,0 +1,422 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(constant buf0& x_28, thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_255 = *(from); + k = x_255; + int const x_256 = *(from); + i = x_256; + int const x_257 = *(mid); + j = (x_257 + 1); + while (true) { + int x_285 = 0; + int x_286 = 0; + int x_305 = 0; + int x_306 = 0; + int x_320 = 0; + int x_324 = 0; + int x_339 = 0; + int x_338 = 0; + int x_352 = 0; + int x_351 = 0; + int x_366 = 0; + int x_365 = 0; + int x_287_phi = 0; + int x_307_phi = 0; + int x_328_phi = 0; + int x_340_phi = 0; + int x_353_phi = 0; + int x_367_phi = 0; + float const x_261 = x_28.injectionSwitch.x; + if ((1.0f >= x_261)) { + } else { + continue; + } + int const x_266 = i; + int const x_267 = *(mid); + int const x_269 = j; + int const x_270 = *(to); + if (((x_266 <= x_267) && (x_269 <= x_270))) { + } else { + break; + } + int const x_274 = i; + int const x_276 = (*(tint_symbol_5)).arr[x_274]; + int const x_277 = j; + int const x_279 = (*(tint_symbol_5)).arr[x_277]; + bool const x_280 = (x_276 < x_279); + if (x_280) { + x_285 = k; + x_287_phi = x_285; + } else { + x_286 = 0; + x_287_phi = x_286; + } + int const x_287 = x_287_phi; + int const x_288 = (x_287 + 1); + if (x_280) { + k = x_288; + float const x_293 = x_28.injectionSwitch.x; + if (!((1.0f <= x_293))) { + } else { + continue; + } + } + float const x_297 = x_28.injectionSwitch.y; + if ((x_297 >= 0.0f)) { + } else { + continue; + } + int const x_300 = 0; + if (x_280) { + x_305 = i; + x_307_phi = x_305; + } else { + x_306 = 0; + x_307_phi = x_306; + } + int const x_307 = x_307_phi; + int const x_309 = select(x_300, x_307, x_280); + if (x_280) { + i = (x_309 + 1); + } + int const x_315 = 0; + if (x_280) { + x_320 = (*(tint_symbol_5)).arr[x_309]; + float const x_322 = x_28.injectionSwitch.y; + x_328_phi = x_320; + if (!((0.0f <= x_322))) { + continue; + } + } else { + x_324 = 0; + float const x_326 = x_28.injectionSwitch.y; + x_328_phi = x_324; + if (!((x_326 < 0.0f))) { + } else { + continue; + } + } + int const x_328 = x_328_phi; + if (x_280) { + (*(tint_symbol_6)).arr[x_287] = select(x_315, x_328, x_280); + } + if (x_280) { + x_339 = 0; + x_340_phi = x_339; + } else { + x_338 = k; + x_340_phi = x_338; + } + int const x_340 = x_340_phi; + if (x_280) { + } else { + k = (x_340 + 1); + } + float const x_345 = x_28.injectionSwitch.x; + if (!((1.0f <= x_345))) { + } else { + continue; + } + if (x_280) { + x_352 = 0; + x_353_phi = x_352; + } else { + x_351 = j; + x_353_phi = x_351; + } + int const x_353 = x_353_phi; + int const x_355 = 0; + int const x_357 = select(x_353, x_355, x_280); + if (x_280) { + } else { + j = (x_357 + 1); + } + if (x_280) { + x_366 = 0; + x_367_phi = x_366; + } else { + x_365 = (*(tint_symbol_5)).arr[x_357]; + x_367_phi = x_365; + } + int const x_367 = x_367_phi; + if (x_280) { + } else { + (*(tint_symbol_6)).arr[x_340] = x_367; + } + } + while (true) { + int const x_376 = i; + int const x_378 = i; + int const x_379 = *(mid); + if (((x_376 < 10) && (x_378 <= x_379))) { + } else { + break; + } + int const x_383 = k; + k = (x_383 + 1); + int const x_385 = i; + i = (x_385 + 1); + int const x_388 = (*(tint_symbol_5)).arr[x_385]; + (*(tint_symbol_6)).arr[x_383] = x_388; + } + int const x_390 = *(from); + i_1 = x_390; + while (true) { + int const x_395 = i_1; + int const x_396 = *(to); + if ((x_395 <= x_396)) { + } else { + break; + } + int const x_399 = i_1; + int const x_400 = i_1; + int const x_402 = (*(tint_symbol_6)).arr[x_400]; + (*(tint_symbol_5)).arr[x_399] = x_402; + { + int const x_404 = i_1; + i_1 = (x_404 + 1); + } + } + return; +} + +void mergeSort_(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_411 = m; + int const x_412 = high; + if ((x_411 <= x_412)) { + } else { + break; + } + int const x_415 = low; + i_2 = x_415; + while (true) { + int const x_420 = i_2; + int const x_421 = high; + if ((x_420 < x_421)) { + } else { + break; + } + int const x_424 = i_2; + from_1 = x_424; + int const x_425 = i_2; + int const x_426 = m; + mid_1 = ((x_425 + x_426) - 1); + int const x_429 = i_2; + int const x_430 = m; + int const x_434 = high; + to_1 = min(((x_429 + (2 * x_430)) - 1), x_434); + int const x_436 = from_1; + param = x_436; + int const x_437 = mid_1; + param_1 = x_437; + int const x_438 = to_1; + param_2 = x_438; + merge_i1_i1_i1_(x_28, &(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_440 = m; + int const x_442 = i_2; + i_2 = (x_442 + (2 * x_440)); + } + } + { + int const x_444 = m; + m = (2 * x_444); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_88 = x_28.injectionSwitch.x; + i_3 = int(x_88); + while (true) { + int const x_94 = i_3; + switch(x_94) { + case 9: { + int const x_124 = i_3; + (*(tint_symbol_9)).arr[x_124] = -5; + break; + } + case 8: { + int const x_122 = i_3; + (*(tint_symbol_9)).arr[x_122] = -4; + break; + } + case 7: { + int const x_120 = i_3; + (*(tint_symbol_9)).arr[x_120] = -3; + break; + } + case 6: { + int const x_118 = i_3; + (*(tint_symbol_9)).arr[x_118] = -2; + break; + } + case 5: { + int const x_116 = i_3; + (*(tint_symbol_9)).arr[x_116] = -1; + break; + } + case 4: { + int const x_114 = i_3; + (*(tint_symbol_9)).arr[x_114] = 0; + break; + } + case 3: { + int const x_112 = i_3; + (*(tint_symbol_9)).arr[x_112] = 1; + break; + } + case 2: { + int const x_110 = i_3; + (*(tint_symbol_9)).arr[x_110] = 2; + break; + } + case 1: { + int const x_108 = i_3; + (*(tint_symbol_9)).arr[x_108] = 3; + break; + } + case 0: { + int const x_106 = i_3; + (*(tint_symbol_9)).arr[x_106] = 4; + break; + } + default: { + break; + } + } + int const x_126 = i_3; + i_3 = (x_126 + 1); + { + int const x_128 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_134 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + int const x_137 = j_1; + int const x_138 = j_1; + int const x_140 = (*(tint_symbol_9)).arr[x_138]; + (*(tint_symbol_10)).arr[x_137] = x_140; + { + int const x_142 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(x_28, tint_symbol_9, tint_symbol_10); + float const x_146 = (*(tint_symbol_11)).y; + if ((int(x_146) < 30)) { + int const x_153 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_153) / 10.0f)); + } else { + float const x_158 = (*(tint_symbol_11)).y; + if ((int(x_158) < 60)) { + int const x_165 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_165) / 10.0f)); + } else { + float const x_170 = (*(tint_symbol_11)).y; + if ((int(x_170) < 90)) { + int const x_177 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_177) / 10.0f)); + } else { + float const x_182 = (*(tint_symbol_11)).y; + if ((int(x_182) < 120)) { + int const x_189 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_189) / 10.0f)); + } else { + float const x_194 = (*(tint_symbol_11)).y; + if ((int(x_194) < 150)) { + discard_fragment(); + } else { + float const x_201 = (*(tint_symbol_11)).y; + if ((int(x_201) < 180)) { + int const x_208 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_208) / 10.0f)); + } else { + float const x_213 = (*(tint_symbol_11)).y; + if ((int(x_213) < 210)) { + int const x_220 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_220) / 10.0f)); + } else { + float const x_225 = (*(tint_symbol_11)).y; + if ((int(x_225) < 240)) { + int const x_232 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_232) / 10.0f)); + } else { + float const x_237 = (*(tint_symbol_11)).y; + if ((int(x_237) < 270)) { + int const x_244 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_244) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_248 = grey; + float3 const x_249 = float3(x_248, x_248, x_248); + *(tint_symbol_12) = float4(x_249.x, x_249.y, x_249.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..aa67796b49 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.spvasm @@ -0,0 +1,864 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 525 +; Schema: 0 + OpCapability Shader + %290 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %x_285 "x_285" + OpName %x_286 "x_286" + OpName %x_305 "x_305" + OpName %x_306 "x_306" + OpName %x_320 "x_320" + OpName %x_324 "x_324" + OpName %x_339 "x_339" + OpName %x_338 "x_338" + OpName %x_352 "x_352" + OpName %x_351 "x_351" + OpName %x_366 "x_366" + OpName %x_365 "x_365" + OpName %x_287_phi "x_287_phi" + OpName %x_307_phi "x_307_phi" + OpName %x_328_phi "x_328_phi" + OpName %x_340_phi "x_340_phi" + OpName %x_353_phi "x_353_phi" + OpName %x_367_phi "x_367_phi" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %int_10 = OpConstant %int 10 + %246 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %314 = OpConstantNull %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %main_out = OpTypeStruct %v4float + %512 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %x_285 = OpVariable %_ptr_Function_int Function %32 + %x_286 = OpVariable %_ptr_Function_int Function %32 + %x_305 = OpVariable %_ptr_Function_int Function %32 + %x_306 = OpVariable %_ptr_Function_int Function %32 + %x_320 = OpVariable %_ptr_Function_int Function %32 + %x_324 = OpVariable %_ptr_Function_int Function %32 + %x_339 = OpVariable %_ptr_Function_int Function %32 + %x_338 = OpVariable %_ptr_Function_int Function %32 + %x_352 = OpVariable %_ptr_Function_int Function %32 + %x_351 = OpVariable %_ptr_Function_int Function %32 + %x_366 = OpVariable %_ptr_Function_int Function %32 + %x_365 = OpVariable %_ptr_Function_int Function %32 + %x_287_phi = OpVariable %_ptr_Function_int Function %32 + %x_307_phi = OpVariable %_ptr_Function_int Function %32 + %x_328_phi = OpVariable %_ptr_Function_int Function %32 + %x_340_phi = OpVariable %_ptr_Function_int Function %32 + %x_353_phi = OpVariable %_ptr_Function_int Function %32 + %x_367_phi = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %68 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %69 = OpLoad %float %68 + %71 = OpFOrdGreaterThanEqual %bool %float_1 %69 + OpSelectionMerge %73 None + OpBranchConditional %71 %74 %75 + %74 = OpLabel + OpBranch %73 + %75 = OpLabel + OpBranch %46 + %73 = OpLabel + %76 = OpLoad %int %i + %78 = OpLoad %int %mid + %79 = OpLoad %int %j + %81 = OpLoad %int %to + %82 = OpSLessThanEqual %bool %76 %78 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + %85 = OpSLessThanEqual %bool %79 %81 + OpBranch %83 + %83 = OpLabel + %86 = OpPhi %bool %82 %73 %85 %84 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %89 + %88 = OpLabel + OpBranch %87 + %89 = OpLabel + OpBranch %45 + %87 = OpLabel + %90 = OpLoad %int %i + %92 = OpAccessChain %_ptr_Private_int %data %90 + %93 = OpLoad %int %92 + %94 = OpLoad %int %j + %95 = OpAccessChain %_ptr_Private_int %data %94 + %96 = OpLoad %int %95 + %97 = OpSLessThan %bool %93 %96 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %100 + %99 = OpLabel + %101 = OpLoad %int %k + OpStore %x_285 %101 + %102 = OpLoad %int %x_285 + OpStore %x_287_phi %102 + OpBranch %98 + %100 = OpLabel + OpStore %x_286 %int_0 + %104 = OpLoad %int %x_286 + OpStore %x_287_phi %104 + OpBranch %98 + %98 = OpLabel + %105 = OpLoad %int %x_287_phi + %106 = OpIAdd %int %105 %int_1 + OpSelectionMerge %107 None + OpBranchConditional %97 %108 %107 + %108 = OpLabel + OpStore %k %106 + %109 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %110 = OpLoad %float %109 + %112 = OpFOrdLessThanEqual %bool %float_1 %110 + %111 = OpLogicalNot %bool %112 + OpSelectionMerge %113 None + OpBranchConditional %111 %114 %115 + %114 = OpLabel + OpBranch %113 + %115 = OpLabel + OpBranch %46 + %113 = OpLabel + OpBranch %107 + %107 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %118 = OpLoad %float %117 + %120 = OpFOrdGreaterThanEqual %bool %118 %float_0 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + OpBranch %121 + %123 = OpLabel + OpBranch %46 + %121 = OpLabel + OpSelectionMerge %124 None + OpBranchConditional %97 %125 %126 + %125 = OpLabel + %127 = OpLoad %int %i + OpStore %x_305 %127 + %128 = OpLoad %int %x_305 + OpStore %x_307_phi %128 + OpBranch %124 + %126 = OpLabel + OpStore %x_306 %int_0 + %129 = OpLoad %int %x_306 + OpStore %x_307_phi %129 + OpBranch %124 + %124 = OpLabel + %130 = OpLoad %int %x_307_phi + %131 = OpSelect %int %97 %130 %int_0 + OpSelectionMerge %132 None + OpBranchConditional %97 %133 %132 + %133 = OpLabel + %134 = OpIAdd %int %131 %int_1 + OpStore %i %134 + OpBranch %132 + %132 = OpLabel + OpSelectionMerge %135 None + OpBranchConditional %97 %136 %137 + %136 = OpLabel + %138 = OpAccessChain %_ptr_Private_int %data %131 + %139 = OpLoad %int %138 + OpStore %x_320 %139 + %140 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %141 = OpLoad %float %140 + %142 = OpLoad %int %x_320 + OpStore %x_328_phi %142 + %144 = OpFOrdLessThanEqual %bool %float_0 %141 + %143 = OpLogicalNot %bool %144 + OpSelectionMerge %145 None + OpBranchConditional %143 %146 %145 + %146 = OpLabel + OpBranch %46 + %145 = OpLabel + OpBranch %135 + %137 = OpLabel + OpStore %x_324 %int_0 + %147 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %148 = OpLoad %float %147 + %149 = OpLoad %int %x_324 + OpStore %x_328_phi %149 + %151 = OpFOrdLessThan %bool %148 %float_0 + %150 = OpLogicalNot %bool %151 + OpSelectionMerge %152 None + OpBranchConditional %150 %153 %154 + %153 = OpLabel + OpBranch %152 + %154 = OpLabel + OpBranch %46 + %152 = OpLabel + OpBranch %135 + %135 = OpLabel + %155 = OpLoad %int %x_328_phi + OpSelectionMerge %156 None + OpBranchConditional %97 %157 %156 + %157 = OpLabel + %158 = OpAccessChain %_ptr_Private_int %temp %105 + %159 = OpSelect %int %97 %155 %int_0 + OpStore %158 %159 + OpBranch %156 + %156 = OpLabel + OpSelectionMerge %160 None + OpBranchConditional %97 %161 %162 + %161 = OpLabel + OpStore %x_339 %int_0 + %163 = OpLoad %int %x_339 + OpStore %x_340_phi %163 + OpBranch %160 + %162 = OpLabel + %164 = OpLoad %int %k + OpStore %x_338 %164 + %165 = OpLoad %int %x_338 + OpStore %x_340_phi %165 + OpBranch %160 + %160 = OpLabel + %166 = OpLoad %int %x_340_phi + OpSelectionMerge %167 None + OpBranchConditional %97 %168 %169 + %168 = OpLabel + OpBranch %167 + %169 = OpLabel + %170 = OpIAdd %int %166 %int_1 + OpStore %k %170 + OpBranch %167 + %167 = OpLabel + %171 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %172 = OpLoad %float %171 + %174 = OpFOrdLessThanEqual %bool %float_1 %172 + %173 = OpLogicalNot %bool %174 + OpSelectionMerge %175 None + OpBranchConditional %173 %176 %177 + %176 = OpLabel + OpBranch %175 + %177 = OpLabel + OpBranch %46 + %175 = OpLabel + OpSelectionMerge %178 None + OpBranchConditional %97 %179 %180 + %179 = OpLabel + OpStore %x_352 %int_0 + %181 = OpLoad %int %x_352 + OpStore %x_353_phi %181 + OpBranch %178 + %180 = OpLabel + %182 = OpLoad %int %j + OpStore %x_351 %182 + %183 = OpLoad %int %x_351 + OpStore %x_353_phi %183 + OpBranch %178 + %178 = OpLabel + %184 = OpLoad %int %x_353_phi + %185 = OpSelect %int %97 %int_0 %184 + OpSelectionMerge %186 None + OpBranchConditional %97 %187 %188 + %187 = OpLabel + OpBranch %186 + %188 = OpLabel + %189 = OpIAdd %int %185 %int_1 + OpStore %j %189 + OpBranch %186 + %186 = OpLabel + OpSelectionMerge %190 None + OpBranchConditional %97 %191 %192 + %191 = OpLabel + OpStore %x_366 %int_0 + %193 = OpLoad %int %x_366 + OpStore %x_367_phi %193 + OpBranch %190 + %192 = OpLabel + %194 = OpAccessChain %_ptr_Private_int %data %185 + %195 = OpLoad %int %194 + OpStore %x_365 %195 + %196 = OpLoad %int %x_365 + OpStore %x_367_phi %196 + OpBranch %190 + %190 = OpLabel + %197 = OpLoad %int %x_367_phi + OpSelectionMerge %198 None + OpBranchConditional %97 %199 %200 + %199 = OpLabel + OpBranch %198 + %200 = OpLabel + %201 = OpAccessChain %_ptr_Private_int %temp %166 + OpStore %201 %197 + OpBranch %198 + %198 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %202 + %202 = OpLabel + OpLoopMerge %203 %204 None + OpBranch %205 + %205 = OpLabel + %206 = OpLoad %int %i + %207 = OpLoad %int %i + %209 = OpLoad %int %mid + %211 = OpSLessThan %bool %206 %int_10 + OpSelectionMerge %212 None + OpBranchConditional %211 %213 %212 + %213 = OpLabel + %214 = OpSLessThanEqual %bool %207 %209 + OpBranch %212 + %212 = OpLabel + %215 = OpPhi %bool %211 %205 %214 %213 + OpSelectionMerge %216 None + OpBranchConditional %215 %217 %218 + %217 = OpLabel + OpBranch %216 + %218 = OpLabel + OpBranch %203 + %216 = OpLabel + %219 = OpLoad %int %k + %220 = OpIAdd %int %219 %int_1 + OpStore %k %220 + %221 = OpLoad %int %i + %222 = OpIAdd %int %221 %int_1 + OpStore %i %222 + %223 = OpAccessChain %_ptr_Private_int %data %221 + %224 = OpLoad %int %223 + %225 = OpAccessChain %_ptr_Private_int %temp %219 + OpStore %225 %224 + OpBranch %204 + %204 = OpLabel + OpBranch %202 + %203 = OpLabel + %227 = OpLoad %int %from + OpStore %i_1 %227 + OpBranch %228 + %228 = OpLabel + OpLoopMerge %229 %230 None + OpBranch %231 + %231 = OpLabel + %232 = OpLoad %int %i_1 + %234 = OpLoad %int %to + %235 = OpSLessThanEqual %bool %232 %234 + OpSelectionMerge %236 None + OpBranchConditional %235 %237 %238 + %237 = OpLabel + OpBranch %236 + %238 = OpLabel + OpBranch %229 + %236 = OpLabel + %239 = OpLoad %int %i_1 + %240 = OpLoad %int %i_1 + %241 = OpAccessChain %_ptr_Private_int %temp %240 + %242 = OpLoad %int %241 + %243 = OpAccessChain %_ptr_Private_int %data %239 + OpStore %243 %242 + OpBranch %230 + %230 = OpLabel + %244 = OpLoad %int %i_1 + %245 = OpIAdd %int %244 %int_1 + OpStore %i_1 %245 + OpBranch %228 + %229 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %246 + %248 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %260 + %260 = OpLabel + OpLoopMerge %261 %262 None + OpBranch %263 + %263 = OpLabel + %264 = OpLoad %int %m + %265 = OpLoad %int %high + %266 = OpSLessThanEqual %bool %264 %265 + OpSelectionMerge %267 None + OpBranchConditional %266 %268 %269 + %268 = OpLabel + OpBranch %267 + %269 = OpLabel + OpBranch %261 + %267 = OpLabel + %270 = OpLoad %int %low + OpStore %i_2 %270 + OpBranch %271 + %271 = OpLabel + OpLoopMerge %272 %273 None + OpBranch %274 + %274 = OpLabel + %275 = OpLoad %int %i_2 + %276 = OpLoad %int %high + %277 = OpSLessThan %bool %275 %276 + OpSelectionMerge %278 None + OpBranchConditional %277 %279 %280 + %279 = OpLabel + OpBranch %278 + %280 = OpLabel + OpBranch %272 + %278 = OpLabel + %281 = OpLoad %int %i_2 + OpStore %from_1 %281 + %282 = OpLoad %int %i_2 + %283 = OpLoad %int %m + %284 = OpIAdd %int %282 %283 + %285 = OpISub %int %284 %int_1 + OpStore %mid_1 %285 + %286 = OpLoad %int %i_2 + %287 = OpLoad %int %m + %288 = OpLoad %int %high + %292 = OpIMul %int %int_2 %287 + %293 = OpIAdd %int %286 %292 + %294 = OpISub %int %293 %int_1 + %289 = OpExtInst %int %290 SMin %294 %288 + OpStore %to_1 %289 + %295 = OpLoad %int %from_1 + OpStore %param %295 + %296 = OpLoad %int %mid_1 + OpStore %param_1 %296 + %297 = OpLoad %int %to_1 + OpStore %param_2 %297 + %298 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %273 + %273 = OpLabel + %302 = OpLoad %int %m + %303 = OpLoad %int %i_2 + %304 = OpIMul %int %int_2 %302 + %305 = OpIAdd %int %303 %304 + OpStore %i_2 %305 + OpBranch %271 + %272 = OpLabel + OpBranch %262 + %262 = OpLabel + %306 = OpLoad %int %m + %307 = OpIMul %int %int_2 %306 + OpStore %m %307 + OpBranch %260 + %261 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %246 + %309 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %314 + %315 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %316 = OpLoad %float %315 + %317 = OpConvertFToS %int %316 + OpStore %i_3 %317 + OpBranch %318 + %318 = OpLabel + OpLoopMerge %319 %320 None + OpBranch %321 + %321 = OpLabel + %322 = OpLoad %int %i_3 + OpSelectionMerge %323 None + OpSwitch %322 %324 9 %325 8 %326 7 %327 6 %328 5 %329 4 %330 3 %331 2 %332 1 %333 0 %334 + %325 = OpLabel + %335 = OpLoad %int %i_3 + %336 = OpAccessChain %_ptr_Private_int %data %335 + OpStore %336 %int_n5 + OpBranch %323 + %326 = OpLabel + %338 = OpLoad %int %i_3 + %339 = OpAccessChain %_ptr_Private_int %data %338 + OpStore %339 %int_n4 + OpBranch %323 + %327 = OpLabel + %341 = OpLoad %int %i_3 + %342 = OpAccessChain %_ptr_Private_int %data %341 + OpStore %342 %int_n3 + OpBranch %323 + %328 = OpLabel + %344 = OpLoad %int %i_3 + %345 = OpAccessChain %_ptr_Private_int %data %344 + OpStore %345 %int_n2 + OpBranch %323 + %329 = OpLabel + %347 = OpLoad %int %i_3 + %348 = OpAccessChain %_ptr_Private_int %data %347 + OpStore %348 %int_n1 + OpBranch %323 + %330 = OpLabel + %350 = OpLoad %int %i_3 + %351 = OpAccessChain %_ptr_Private_int %data %350 + OpStore %351 %int_0 + OpBranch %323 + %331 = OpLabel + %352 = OpLoad %int %i_3 + %353 = OpAccessChain %_ptr_Private_int %data %352 + OpStore %353 %int_1 + OpBranch %323 + %332 = OpLabel + %354 = OpLoad %int %i_3 + %355 = OpAccessChain %_ptr_Private_int %data %354 + OpStore %355 %int_2 + OpBranch %323 + %333 = OpLabel + %356 = OpLoad %int %i_3 + %357 = OpAccessChain %_ptr_Private_int %data %356 + OpStore %357 %int_3 + OpBranch %323 + %334 = OpLabel + %359 = OpLoad %int %i_3 + %360 = OpAccessChain %_ptr_Private_int %data %359 + OpStore %360 %int_4 + OpBranch %323 + %324 = OpLabel + OpBranch %323 + %323 = OpLabel + %362 = OpLoad %int %i_3 + %363 = OpIAdd %int %362 %int_1 + OpStore %i_3 %363 + OpBranch %320 + %320 = OpLabel + %364 = OpLoad %int %i_3 + %365 = OpSLessThan %bool %364 %int_10 + OpSelectionMerge %366 None + OpBranchConditional %365 %367 %368 + %367 = OpLabel + OpBranch %366 + %368 = OpLabel + OpBranch %319 + %366 = OpLabel + OpBranch %318 + %319 = OpLabel + OpStore %j_1 %int_0 + OpBranch %369 + %369 = OpLabel + OpLoopMerge %370 %371 None + OpBranch %372 + %372 = OpLabel + %373 = OpLoad %int %j_1 + %374 = OpSLessThan %bool %373 %int_10 + OpSelectionMerge %375 None + OpBranchConditional %374 %376 %377 + %376 = OpLabel + OpBranch %375 + %377 = OpLabel + OpBranch %370 + %375 = OpLabel + %378 = OpLoad %int %j_1 + %379 = OpLoad %int %j_1 + %380 = OpAccessChain %_ptr_Private_int %data %379 + %381 = OpLoad %int %380 + %382 = OpAccessChain %_ptr_Private_int %temp %378 + OpStore %382 %381 + OpBranch %371 + %371 = OpLabel + %383 = OpLoad %int %j_1 + %384 = OpIAdd %int %383 %int_1 + OpStore %j_1 %384 + OpBranch %369 + %370 = OpLabel + %385 = OpFunctionCall %void %mergeSort_ + %387 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %388 = OpLoad %float %387 + %389 = OpConvertFToS %int %388 + %391 = OpSLessThan %bool %389 %int_30 + OpSelectionMerge %392 None + OpBranchConditional %391 %393 %394 + %393 = OpLabel + %395 = OpAccessChain %_ptr_Private_int %data %int_0 + %396 = OpLoad %int %395 + %398 = OpConvertSToF %float %396 + %400 = OpFDiv %float %398 %float_10 + %401 = OpFAdd %float %float_0_5 %400 + OpStore %grey %401 + OpBranch %392 + %394 = OpLabel + %402 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %403 = OpLoad %float %402 + %404 = OpConvertFToS %int %403 + %406 = OpSLessThan %bool %404 %int_60 + OpSelectionMerge %407 None + OpBranchConditional %406 %408 %409 + %408 = OpLabel + %410 = OpAccessChain %_ptr_Private_int %data %int_1 + %411 = OpLoad %int %410 + %412 = OpConvertSToF %float %411 + %413 = OpFDiv %float %412 %float_10 + %414 = OpFAdd %float %float_0_5 %413 + OpStore %grey %414 + OpBranch %407 + %409 = OpLabel + %415 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %416 = OpLoad %float %415 + %417 = OpConvertFToS %int %416 + %419 = OpSLessThan %bool %417 %int_90 + OpSelectionMerge %420 None + OpBranchConditional %419 %421 %422 + %421 = OpLabel + %423 = OpAccessChain %_ptr_Private_int %data %int_2 + %424 = OpLoad %int %423 + %425 = OpConvertSToF %float %424 + %426 = OpFDiv %float %425 %float_10 + %427 = OpFAdd %float %float_0_5 %426 + OpStore %grey %427 + OpBranch %420 + %422 = OpLabel + %428 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %429 = OpLoad %float %428 + %430 = OpConvertFToS %int %429 + %432 = OpSLessThan %bool %430 %int_120 + OpSelectionMerge %433 None + OpBranchConditional %432 %434 %435 + %434 = OpLabel + %436 = OpAccessChain %_ptr_Private_int %data %int_3 + %437 = OpLoad %int %436 + %438 = OpConvertSToF %float %437 + %439 = OpFDiv %float %438 %float_10 + %440 = OpFAdd %float %float_0_5 %439 + OpStore %grey %440 + OpBranch %433 + %435 = OpLabel + %441 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %442 = OpLoad %float %441 + %443 = OpConvertFToS %int %442 + %445 = OpSLessThan %bool %443 %int_150 + OpSelectionMerge %446 None + OpBranchConditional %445 %447 %448 + %447 = OpLabel + OpKill + %448 = OpLabel + %449 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %450 = OpLoad %float %449 + %451 = OpConvertFToS %int %450 + %453 = OpSLessThan %bool %451 %int_180 + OpSelectionMerge %454 None + OpBranchConditional %453 %455 %456 + %455 = OpLabel + %458 = OpAccessChain %_ptr_Private_int %data %int_5 + %459 = OpLoad %int %458 + %460 = OpConvertSToF %float %459 + %461 = OpFDiv %float %460 %float_10 + %462 = OpFAdd %float %float_0_5 %461 + OpStore %grey %462 + OpBranch %454 + %456 = OpLabel + %463 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %464 = OpLoad %float %463 + %465 = OpConvertFToS %int %464 + %467 = OpSLessThan %bool %465 %int_210 + OpSelectionMerge %468 None + OpBranchConditional %467 %469 %470 + %469 = OpLabel + %472 = OpAccessChain %_ptr_Private_int %data %int_6 + %473 = OpLoad %int %472 + %474 = OpConvertSToF %float %473 + %475 = OpFDiv %float %474 %float_10 + %476 = OpFAdd %float %float_0_5 %475 + OpStore %grey %476 + OpBranch %468 + %470 = OpLabel + %477 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %478 = OpLoad %float %477 + %479 = OpConvertFToS %int %478 + %481 = OpSLessThan %bool %479 %int_240 + OpSelectionMerge %482 None + OpBranchConditional %481 %483 %484 + %483 = OpLabel + %486 = OpAccessChain %_ptr_Private_int %data %int_7 + %487 = OpLoad %int %486 + %488 = OpConvertSToF %float %487 + %489 = OpFDiv %float %488 %float_10 + %490 = OpFAdd %float %float_0_5 %489 + OpStore %grey %490 + OpBranch %482 + %484 = OpLabel + %491 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %492 = OpLoad %float %491 + %493 = OpConvertFToS %int %492 + %495 = OpSLessThan %bool %493 %int_270 + OpSelectionMerge %496 None + OpBranchConditional %495 %497 %498 + %497 = OpLabel + %500 = OpAccessChain %_ptr_Private_int %data %int_8 + %501 = OpLoad %int %500 + %502 = OpConvertSToF %float %501 + %503 = OpFDiv %float %502 %float_10 + %504 = OpFAdd %float %float_0_5 %503 + OpStore %grey %504 + OpBranch %496 + %498 = OpLabel + OpKill + %496 = OpLabel + OpBranch %482 + %482 = OpLabel + OpBranch %468 + %468 = OpLabel + OpBranch %454 + %454 = OpLabel + OpBranch %446 + %446 = OpLabel + OpBranch %433 + %433 = OpLabel + OpBranch %420 + %420 = OpLabel + OpBranch %407 + %407 = OpLabel + OpBranch %392 + %392 = OpLabel + %505 = OpLoad %float %grey + %507 = OpCompositeConstruct %v3float %505 %505 %505 + %508 = OpCompositeExtract %float %507 0 + %509 = OpCompositeExtract %float %507 1 + %510 = OpCompositeExtract %float %507 2 + %511 = OpCompositeConstruct %v4float %508 %509 %510 %float_1 + OpStore %x_GLF_color %511 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %512 +%tint_symbol_1 = OpFunctionParameter %main_out + %516 = OpLabel + %517 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %517 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %246 + %519 = OpLabel + %520 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %520 + %521 = OpFunctionCall %void %main_1 + %523 = OpLoad %v4float %x_GLF_color + %524 = OpCompositeConstruct %main_out %523 + %522 = OpFunctionCall %void %tint_symbol_3 %524 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 320[%320] is not post dominated by the back-edge block 366[%366] + %366 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..5fac853322 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/1.wgsl.expected.wgsl @@ -0,0 +1,414 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_255 : i32 = *(from); + k = x_255; + let x_256 : i32 = *(from); + i = x_256; + let x_257 : i32 = *(mid); + j = (x_257 + 1); + loop { + var x_285 : i32; + var x_286 : i32; + var x_305 : i32; + var x_306 : i32; + var x_320 : i32; + var x_324 : i32; + var x_339 : i32; + var x_338 : i32; + var x_352 : i32; + var x_351 : i32; + var x_366 : i32; + var x_365 : i32; + var x_287_phi : i32; + var x_307_phi : i32; + var x_328_phi : i32; + var x_340_phi : i32; + var x_353_phi : i32; + var x_367_phi : i32; + let x_261 : f32 = x_28.injectionSwitch.x; + if ((1.0 >= x_261)) { + } else { + continue; + } + let x_266 : i32 = i; + let x_267 : i32 = *(mid); + let x_269 : i32 = j; + let x_270 : i32 = *(to); + if (((x_266 <= x_267) && (x_269 <= x_270))) { + } else { + break; + } + let x_274 : i32 = i; + let x_276 : i32 = data[x_274]; + let x_277 : i32 = j; + let x_279 : i32 = data[x_277]; + let x_280 : bool = (x_276 < x_279); + if (x_280) { + x_285 = k; + x_287_phi = x_285; + } else { + x_286 = 0; + x_287_phi = x_286; + } + let x_287 : i32 = x_287_phi; + let x_288 : i32 = (x_287 + 1); + if (x_280) { + k = x_288; + let x_293 : f32 = x_28.injectionSwitch.x; + if (!((1.0 <= x_293))) { + } else { + continue; + } + } + let x_297 : f32 = x_28.injectionSwitch.y; + if ((x_297 >= 0.0)) { + } else { + continue; + } + let x_300 : i32 = 0; + if (x_280) { + x_305 = i; + x_307_phi = x_305; + } else { + x_306 = 0; + x_307_phi = x_306; + } + let x_307 : i32 = x_307_phi; + let x_309 : i32 = select(x_300, x_307, x_280); + if (x_280) { + i = (x_309 + 1); + } + let x_315 : i32 = 0; + if (x_280) { + x_320 = data[x_309]; + let x_322 : f32 = x_28.injectionSwitch.y; + x_328_phi = x_320; + if (!((0.0 <= x_322))) { + continue; + } + } else { + x_324 = 0; + let x_326 : f32 = x_28.injectionSwitch.y; + x_328_phi = x_324; + if (!((x_326 < 0.0))) { + } else { + continue; + } + } + let x_328 : i32 = x_328_phi; + if (x_280) { + temp[x_287] = select(x_315, x_328, x_280); + } + if (x_280) { + x_339 = 0; + x_340_phi = x_339; + } else { + x_338 = k; + x_340_phi = x_338; + } + let x_340 : i32 = x_340_phi; + if (x_280) { + } else { + k = (x_340 + 1); + } + let x_345 : f32 = x_28.injectionSwitch.x; + if (!((1.0 <= x_345))) { + } else { + continue; + } + if (x_280) { + x_352 = 0; + x_353_phi = x_352; + } else { + x_351 = j; + x_353_phi = x_351; + } + let x_353 : i32 = x_353_phi; + let x_355 : i32 = 0; + let x_357 : i32 = select(x_353, x_355, x_280); + if (x_280) { + } else { + j = (x_357 + 1); + } + if (x_280) { + x_366 = 0; + x_367_phi = x_366; + } else { + x_365 = data[x_357]; + x_367_phi = x_365; + } + let x_367 : i32 = x_367_phi; + if (x_280) { + } else { + temp[x_340] = x_367; + } + } + loop { + let x_376 : i32 = i; + let x_378 : i32 = i; + let x_379 : i32 = *(mid); + if (((x_376 < 10) && (x_378 <= x_379))) { + } else { + break; + } + let x_383 : i32 = k; + k = (x_383 + 1); + let x_385 : i32 = i; + i = (x_385 + 1); + let x_388 : i32 = data[x_385]; + temp[x_383] = x_388; + } + let x_390 : i32 = *(from); + i_1 = x_390; + loop { + let x_395 : i32 = i_1; + let x_396 : i32 = *(to); + if ((x_395 <= x_396)) { + } else { + break; + } + let x_399 : i32 = i_1; + let x_400 : i32 = i_1; + let x_402 : i32 = temp[x_400]; + data[x_399] = x_402; + + continuing { + let x_404 : i32 = i_1; + i_1 = (x_404 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_411 : i32 = m; + let x_412 : i32 = high; + if ((x_411 <= x_412)) { + } else { + break; + } + let x_415 : i32 = low; + i_2 = x_415; + loop { + let x_420 : i32 = i_2; + let x_421 : i32 = high; + if ((x_420 < x_421)) { + } else { + break; + } + let x_424 : i32 = i_2; + from_1 = x_424; + let x_425 : i32 = i_2; + let x_426 : i32 = m; + mid_1 = ((x_425 + x_426) - 1); + let x_429 : i32 = i_2; + let x_430 : i32 = m; + let x_434 : i32 = high; + to_1 = min(((x_429 + (2 * x_430)) - 1), x_434); + let x_436 : i32 = from_1; + param = x_436; + let x_437 : i32 = mid_1; + param_1 = x_437; + let x_438 : i32 = to_1; + param_2 = x_438; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_440 : i32 = m; + let x_442 : i32 = i_2; + i_2 = (x_442 + (2 * x_440)); + } + } + + continuing { + let x_444 : i32 = m; + m = (2 * x_444); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_88 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_88); + loop { + let x_94 : i32 = i_3; + switch(x_94) { + case 9: { + let x_124 : i32 = i_3; + data[x_124] = -5; + } + case 8: { + let x_122 : i32 = i_3; + data[x_122] = -4; + } + case 7: { + let x_120 : i32 = i_3; + data[x_120] = -3; + } + case 6: { + let x_118 : i32 = i_3; + data[x_118] = -2; + } + case 5: { + let x_116 : i32 = i_3; + data[x_116] = -1; + } + case 4: { + let x_114 : i32 = i_3; + data[x_114] = 0; + } + case 3: { + let x_112 : i32 = i_3; + data[x_112] = 1; + } + case 2: { + let x_110 : i32 = i_3; + data[x_110] = 2; + } + case 1: { + let x_108 : i32 = i_3; + data[x_108] = 3; + } + case 0: { + let x_106 : i32 = i_3; + data[x_106] = 4; + } + default: { + } + } + let x_126 : i32 = i_3; + i_3 = (x_126 + 1); + + continuing { + let x_128 : i32 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_134 : i32 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + let x_137 : i32 = j_1; + let x_138 : i32 = j_1; + let x_140 : i32 = data[x_138]; + temp[x_137] = x_140; + + continuing { + let x_142 : i32 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(); + let x_146 : f32 = gl_FragCoord.y; + if ((i32(x_146) < 30)) { + let x_153 : i32 = data[0]; + grey = (0.5 + (f32(x_153) / 10.0)); + } else { + let x_158 : f32 = gl_FragCoord.y; + if ((i32(x_158) < 60)) { + let x_165 : i32 = data[1]; + grey = (0.5 + (f32(x_165) / 10.0)); + } else { + let x_170 : f32 = gl_FragCoord.y; + if ((i32(x_170) < 90)) { + let x_177 : i32 = data[2]; + grey = (0.5 + (f32(x_177) / 10.0)); + } else { + let x_182 : f32 = gl_FragCoord.y; + if ((i32(x_182) < 120)) { + let x_189 : i32 = data[3]; + grey = (0.5 + (f32(x_189) / 10.0)); + } else { + let x_194 : f32 = gl_FragCoord.y; + if ((i32(x_194) < 150)) { + discard; + } else { + let x_201 : f32 = gl_FragCoord.y; + if ((i32(x_201) < 180)) { + let x_208 : i32 = data[5]; + grey = (0.5 + (f32(x_208) / 10.0)); + } else { + let x_213 : f32 = gl_FragCoord.y; + if ((i32(x_213) < 210)) { + let x_220 : i32 = data[6]; + grey = (0.5 + (f32(x_220) / 10.0)); + } else { + let x_225 : f32 = gl_FragCoord.y; + if ((i32(x_225) < 240)) { + let x_232 : i32 = data[7]; + grey = (0.5 + (f32(x_232) / 10.0)); + } else { + let x_237 : f32 = gl_FragCoord.y; + if ((i32(x_237) < 270)) { + let x_244 : i32 = data[8]; + grey = (0.5 + (f32(x_244) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_248 : f32 = grey; + let x_249 : vec3 = vec3(x_248, x_248, x_248); + x_GLF_color = vec4(x_249.x, x_249.y, x_249.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm new file mode 100644 index 0000000000..5ddec35bce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm @@ -0,0 +1,686 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %merge_i1_i1_i1_ "merge(i1;i1;i1;" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %mergeSort_ "mergeSort(" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %temp "temp" + OpName %i_0 "i" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_1 "i" + OpName %from_0 "from" + OpName %mid_0 "mid" + OpName %to_0 "to" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %i_2 "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %j_0 "j" + OpName %gl_FragCoord "gl_FragCoord" + OpName %grey "grey" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %32 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private + %int_10 = OpConstant %int 10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int_30 = OpConstant %int 30 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %int_0_0 = OpConstant %int 0 + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %float_0 = OpConstant %float 0 + %main = OpFunction %void None %32 + %86 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %grey = OpVariable %_ptr_Function_float Function + %87 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %88 = OpLoad %float %87 + %89 = OpConvertFToS %int %88 + OpStore %i_2 %89 + OpBranch %90 + %90 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %int %i_2 + OpSelectionMerge %95 None + OpSwitch %94 %95 0 %96 1 %97 2 %98 3 %99 4 %100 5 %101 6 %102 7 %103 8 %104 9 %105 + %96 = OpLabel + %106 = OpLoad %int %i_2 + %107 = OpAccessChain %_ptr_Private_int %data %106 + OpStore %107 %int_4 + OpBranch %95 + %97 = OpLabel + %108 = OpLoad %int %i_2 + %109 = OpAccessChain %_ptr_Private_int %data %108 + OpStore %109 %int_3 + OpBranch %95 + %98 = OpLabel + %110 = OpLoad %int %i_2 + %111 = OpAccessChain %_ptr_Private_int %data %110 + OpStore %111 %int_2 + OpBranch %95 + %99 = OpLabel + %112 = OpLoad %int %i_2 + %113 = OpAccessChain %_ptr_Private_int %data %112 + OpStore %113 %int_1 + OpBranch %95 + %100 = OpLabel + %114 = OpLoad %int %i_2 + %115 = OpAccessChain %_ptr_Private_int %data %114 + OpStore %115 %int_0 + OpBranch %95 + %101 = OpLabel + %116 = OpLoad %int %i_2 + %117 = OpAccessChain %_ptr_Private_int %data %116 + OpStore %117 %int_n1 + OpBranch %95 + %102 = OpLabel + %118 = OpLoad %int %i_2 + %119 = OpAccessChain %_ptr_Private_int %data %118 + OpStore %119 %int_n2 + OpBranch %95 + %103 = OpLabel + %120 = OpLoad %int %i_2 + %121 = OpAccessChain %_ptr_Private_int %data %120 + OpStore %121 %int_n3 + OpBranch %95 + %104 = OpLabel + %122 = OpLoad %int %i_2 + %123 = OpAccessChain %_ptr_Private_int %data %122 + OpStore %123 %int_n4 + OpBranch %95 + %105 = OpLabel + %124 = OpLoad %int %i_2 + %125 = OpAccessChain %_ptr_Private_int %data %124 + OpStore %125 %int_n5 + OpBranch %95 + %95 = OpLabel + %126 = OpLoad %int %i_2 + %127 = OpIAdd %int %126 %int_1 + OpStore %i_2 %127 + OpBranch %92 + %92 = OpLabel + %128 = OpLoad %int %i_2 + %129 = OpSLessThan %bool %128 %int_10 + OpBranchConditional %129 %90 %91 + %91 = OpLabel + OpStore %j_0 %int_0 + OpBranch %130 + %130 = OpLabel + OpLoopMerge %131 %132 None + OpBranch %133 + %133 = OpLabel + %134 = OpLoad %int %j_0 + %135 = OpSLessThan %bool %134 %int_10 + OpBranchConditional %135 %136 %131 + %136 = OpLabel + %137 = OpLoad %int %j_0 + %138 = OpLoad %int %j_0 + %139 = OpAccessChain %_ptr_Private_int %data %138 + %140 = OpLoad %int %139 + %141 = OpAccessChain %_ptr_Private_int %temp %137 + OpStore %141 %140 + OpBranch %132 + %132 = OpLabel + %142 = OpLoad %int %j_0 + %143 = OpIAdd %int %142 %int_1 + OpStore %j_0 %143 + OpBranch %130 + %131 = OpLabel + %144 = OpFunctionCall %void %mergeSort_ + %145 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %146 = OpLoad %float %145 + %147 = OpConvertFToS %int %146 + %148 = OpSLessThan %bool %147 %int_30 + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %151 + %150 = OpLabel + %152 = OpAccessChain %_ptr_Private_int %data %int_0 + %153 = OpLoad %int %152 + %154 = OpConvertSToF %float %153 + %155 = OpFDiv %float %154 %float_10 + %156 = OpFAdd %float %float_0_5 %155 + OpStore %grey %156 + OpBranch %149 + %151 = OpLabel + %157 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %158 = OpLoad %float %157 + %159 = OpConvertFToS %int %158 + %160 = OpSLessThan %bool %159 %int_60 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + %164 = OpAccessChain %_ptr_Private_int %data %int_1 + %165 = OpLoad %int %164 + %166 = OpConvertSToF %float %165 + %167 = OpFDiv %float %166 %float_10 + %168 = OpFAdd %float %float_0_5 %167 + OpStore %grey %168 + OpBranch %161 + %163 = OpLabel + %169 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %170 = OpLoad %float %169 + %171 = OpConvertFToS %int %170 + %172 = OpSLessThan %bool %171 %int_90 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %175 + %174 = OpLabel + %176 = OpAccessChain %_ptr_Private_int %data %int_2 + %177 = OpLoad %int %176 + %178 = OpConvertSToF %float %177 + %179 = OpFDiv %float %178 %float_10 + %180 = OpFAdd %float %float_0_5 %179 + OpStore %grey %180 + OpBranch %173 + %175 = OpLabel + %181 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %182 = OpLoad %float %181 + %183 = OpConvertFToS %int %182 + %184 = OpSLessThan %bool %183 %int_120 + OpSelectionMerge %185 None + OpBranchConditional %184 %186 %187 + %186 = OpLabel + %188 = OpAccessChain %_ptr_Private_int %data %int_3 + %189 = OpLoad %int %188 + %190 = OpConvertSToF %float %189 + %191 = OpFDiv %float %190 %float_10 + %192 = OpFAdd %float %float_0_5 %191 + OpStore %grey %192 + OpBranch %185 + %187 = OpLabel + %193 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %194 = OpLoad %float %193 + %195 = OpConvertFToS %int %194 + %196 = OpSLessThan %bool %195 %int_150 + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %199 + %198 = OpLabel + OpKill + %199 = OpLabel + %200 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %201 = OpLoad %float %200 + %202 = OpConvertFToS %int %201 + %203 = OpSLessThan %bool %202 %int_180 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %206 + %205 = OpLabel + %207 = OpAccessChain %_ptr_Private_int %data %int_5 + %208 = OpLoad %int %207 + %209 = OpConvertSToF %float %208 + %210 = OpFDiv %float %209 %float_10 + %211 = OpFAdd %float %float_0_5 %210 + OpStore %grey %211 + OpBranch %204 + %206 = OpLabel + %212 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %213 = OpLoad %float %212 + %214 = OpConvertFToS %int %213 + %215 = OpSLessThan %bool %214 %int_210 + OpSelectionMerge %216 None + OpBranchConditional %215 %217 %218 + %217 = OpLabel + %219 = OpAccessChain %_ptr_Private_int %data %int_6 + %220 = OpLoad %int %219 + %221 = OpConvertSToF %float %220 + %222 = OpFDiv %float %221 %float_10 + %223 = OpFAdd %float %float_0_5 %222 + OpStore %grey %223 + OpBranch %216 + %218 = OpLabel + %224 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %225 = OpLoad %float %224 + %226 = OpConvertFToS %int %225 + %227 = OpSLessThan %bool %226 %int_240 + OpSelectionMerge %228 None + OpBranchConditional %227 %229 %230 + %229 = OpLabel + %231 = OpAccessChain %_ptr_Private_int %data %int_7 + %232 = OpLoad %int %231 + %233 = OpConvertSToF %float %232 + %234 = OpFDiv %float %233 %float_10 + %235 = OpFAdd %float %float_0_5 %234 + OpStore %grey %235 + OpBranch %228 + %230 = OpLabel + %236 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %237 = OpLoad %float %236 + %238 = OpConvertFToS %int %237 + %239 = OpSLessThan %bool %238 %int_270 + OpSelectionMerge %240 None + OpBranchConditional %239 %241 %242 + %241 = OpLabel + %243 = OpAccessChain %_ptr_Private_int %data %int_8 + %244 = OpLoad %int %243 + %245 = OpConvertSToF %float %244 + %246 = OpFDiv %float %245 %float_10 + %247 = OpFAdd %float %float_0_5 %246 + OpStore %grey %247 + OpBranch %240 + %242 = OpLabel + OpKill + %240 = OpLabel + OpBranch %228 + %228 = OpLabel + OpBranch %216 + %216 = OpLabel + OpBranch %204 + %204 = OpLabel + OpBranch %197 + %197 = OpLabel + OpBranch %185 + %185 = OpLabel + OpBranch %173 + %173 = OpLabel + OpBranch %161 + %161 = OpLabel + OpBranch %149 + %149 = OpLabel + %248 = OpLoad %float %grey + %249 = OpCompositeConstruct %v3float %248 %248 %248 + %250 = OpCompositeExtract %float %249 0 + %251 = OpCompositeExtract %float %249 1 + %252 = OpCompositeExtract %float %249 2 + %253 = OpCompositeConstruct %v4float %250 %251 %252 %float_1 + OpStore %_GLF_color %253 + OpReturn + OpFunctionEnd +%merge_i1_i1_i1_ = OpFunction %void None %35 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %254 = OpLabel + %k = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %255 = OpLoad %int %from + OpStore %k %255 + %256 = OpLoad %int %from + OpStore %i %256 + %257 = OpLoad %int %mid + %258 = OpIAdd %int %257 %int_1 + OpStore %j %258 + OpBranch %259 + %259 = OpLabel + %260 = OpFOrdGreaterThanEqual %bool %float_1 %float_0 + OpLoopMerge %261 %262 None + OpBranchConditional %260 %263 %262 + %263 = OpLabel + %264 = OpLoad %int %i + %265 = OpLoad %int %mid + %266 = OpSLessThanEqual %bool %264 %265 + %267 = OpLoad %int %j + %268 = OpLoad %int %to + %269 = OpSLessThanEqual %bool %267 %268 + %270 = OpLogicalAnd %bool %266 %269 + OpBranchConditional %270 %271 %261 + %271 = OpLabel + %272 = OpLoad %int %i + %273 = OpAccessChain %_ptr_Private_int %data %272 + %274 = OpLoad %int %273 + %275 = OpLoad %int %j + %276 = OpAccessChain %_ptr_Private_int %data %275 + %277 = OpLoad %int %276 + %278 = OpSLessThan %bool %274 %277 + OpBranch %279 + %279 = OpLabel + OpSelectionMerge %280 None + OpBranchConditional %278 %281 %282 + %281 = OpLabel + %283 = OpLoad %int %k + OpBranch %280 + %282 = OpLabel + %284 = OpCopyObject %int %int_0_0 + OpBranch %280 + %280 = OpLabel + %285 = OpPhi %int %283 %281 %284 %282 + %286 = OpIAdd %int %285 %int_1 + OpBranch %287 + %287 = OpLabel + OpSelectionMerge %288 None + OpBranchConditional %278 %289 %288 + %289 = OpLabel + OpStore %k %286 + %290 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %291 = OpLoad %float %290 + %292 = OpFUnordGreaterThan %bool %float_1 %291 + OpBranchConditional %292 %288 %262 + %288 = OpLabel + OpBranch %293 + %293 = OpLabel + %294 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %295 = OpLoad %float %294 + %296 = OpFOrdGreaterThanEqual %bool %295 %float_0 + OpBranchConditional %296 %297 %262 + %297 = OpLabel + %298 = OpCopyObject %int %int_0_0 + OpBranch %299 + %299 = OpLabel + OpSelectionMerge %300 None + OpBranchConditional %278 %301 %302 + %301 = OpLabel + %303 = OpLoad %int %i + OpBranch %300 + %302 = OpLabel + %304 = OpCopyObject %int %int_0_0 + OpBranch %300 + %300 = OpLabel + %305 = OpPhi %int %303 %301 %304 %302 + OpBranch %306 + %306 = OpLabel + %307 = OpSelect %int %278 %305 %298 + %308 = OpIAdd %int %307 %int_1 + OpSelectionMerge %309 None + OpBranchConditional %278 %310 %309 + %310 = OpLabel + OpStore %i %308 + OpBranch %309 + %309 = OpLabel + %311 = OpAccessChain %_ptr_Private_int %data %307 + OpBranch %312 + %312 = OpLabel + %313 = OpCopyObject %int %int_0_0 + OpBranch %314 + %314 = OpLabel + OpSelectionMerge %315 None + OpBranchConditional %278 %316 %317 + %316 = OpLabel + %318 = OpLoad %int %311 + %319 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %320 = OpLoad %float %319 + %321 = OpFUnordGreaterThan %bool %float_0 %320 + OpBranchConditional %321 %262 %315 + %317 = OpLabel + %322 = OpCopyObject %int %int_0_0 + %323 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %324 = OpLoad %float %323 + %325 = OpFUnordGreaterThanEqual %bool %324 %float_0 + OpBranchConditional %325 %315 %262 + %315 = OpLabel + %326 = OpPhi %int %318 %316 %322 %317 + OpBranch %327 + %327 = OpLabel + %328 = OpSelect %int %278 %326 %313 + %329 = OpAccessChain %_ptr_Private_int %temp %285 + OpSelectionMerge %330 None + OpBranchConditional %278 %331 %330 + %331 = OpLabel + OpStore %329 %328 + OpBranch %330 + %330 = OpLabel + OpBranch %332 + %332 = OpLabel + OpSelectionMerge %333 None + OpBranchConditional %278 %334 %335 + %335 = OpLabel + %336 = OpLoad %int %k + OpBranch %333 + %334 = OpLabel + %337 = OpCopyObject %int %int_0_0 + OpBranch %333 + %333 = OpLabel + %338 = OpPhi %int %336 %335 %337 %334 + %339 = OpIAdd %int %338 %int_1 + OpSelectionMerge %340 None + OpBranchConditional %278 %340 %341 + %341 = OpLabel + OpStore %k %339 + OpBranch %340 + %340 = OpLabel + %342 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + %343 = OpLoad %float %342 + %344 = OpFUnordGreaterThan %bool %float_1 %343 + OpBranchConditional %344 %345 %262 + %345 = OpLabel + OpSelectionMerge %346 None + OpBranchConditional %278 %347 %348 + %348 = OpLabel + %349 = OpLoad %int %j + OpBranch %346 + %347 = OpLabel + %350 = OpCopyObject %int %int_0_0 + OpBranch %346 + %346 = OpLabel + %351 = OpPhi %int %349 %348 %350 %347 + OpBranch %352 + %352 = OpLabel + %353 = OpCopyObject %int %int_0_0 + OpBranch %354 + %354 = OpLabel + %355 = OpSelect %int %278 %353 %351 + %356 = OpIAdd %int %355 %int_1 + OpSelectionMerge %357 None + OpBranchConditional %278 %357 %358 + %358 = OpLabel + OpStore %j %356 + OpBranch %357 + %357 = OpLabel + %359 = OpAccessChain %_ptr_Private_int %data %355 + OpSelectionMerge %360 None + OpBranchConditional %278 %361 %362 + %362 = OpLabel + %363 = OpLoad %int %359 + OpBranch %360 + %361 = OpLabel + %364 = OpCopyObject %int %int_0_0 + OpBranch %360 + %360 = OpLabel + %365 = OpPhi %int %363 %362 %364 %361 + %366 = OpAccessChain %_ptr_Private_int %temp %338 + OpSelectionMerge %367 None + OpBranchConditional %278 %367 %368 + %368 = OpLabel + OpStore %366 %365 + OpBranch %367 + %367 = OpLabel + OpBranch %369 + %369 = OpLabel + OpBranch %262 + %262 = OpLabel + OpBranch %259 + %261 = OpLabel + OpBranch %370 + %370 = OpLabel + OpLoopMerge %371 %372 None + OpBranch %373 + %373 = OpLabel + %374 = OpLoad %int %i + %375 = OpSLessThan %bool %374 %int_10 + %376 = OpLoad %int %i + %377 = OpLoad %int %mid + %378 = OpSLessThanEqual %bool %376 %377 + %379 = OpLogicalAnd %bool %375 %378 + OpBranchConditional %379 %380 %371 + %380 = OpLabel + %381 = OpLoad %int %k + %382 = OpIAdd %int %381 %int_1 + OpStore %k %382 + %383 = OpLoad %int %i + %384 = OpIAdd %int %383 %int_1 + OpStore %i %384 + %385 = OpAccessChain %_ptr_Private_int %data %383 + %386 = OpLoad %int %385 + %387 = OpAccessChain %_ptr_Private_int %temp %381 + OpStore %387 %386 + OpBranch %372 + %372 = OpLabel + OpBranch %370 + %371 = OpLabel + %388 = OpLoad %int %from + OpStore %i_0 %388 + OpBranch %389 + %389 = OpLabel + OpLoopMerge %390 %391 None + OpBranch %392 + %392 = OpLabel + %393 = OpLoad %int %i_0 + %394 = OpLoad %int %to + %395 = OpSLessThanEqual %bool %393 %394 + OpBranchConditional %395 %396 %390 + %396 = OpLabel + %397 = OpLoad %int %i_0 + %398 = OpLoad %int %i_0 + %399 = OpAccessChain %_ptr_Private_int %temp %398 + %400 = OpLoad %int %399 + %401 = OpAccessChain %_ptr_Private_int %data %397 + OpStore %401 %400 + OpBranch %391 + %391 = OpLabel + %402 = OpLoad %int %i_0 + %403 = OpIAdd %int %402 %int_1 + OpStore %i_0 %403 + OpBranch %389 + %390 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %32 + %404 = OpLabel + %low = OpVariable %_ptr_Function_int Function + %high = OpVariable %_ptr_Function_int Function + %m = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %from_0 = OpVariable %_ptr_Function_int Function + %mid_0 = OpVariable %_ptr_Function_int Function + %to_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %405 + %405 = OpLabel + OpLoopMerge %406 %407 None + OpBranch %408 + %408 = OpLabel + %409 = OpLoad %int %m + %410 = OpLoad %int %high + %411 = OpSLessThanEqual %bool %409 %410 + OpBranchConditional %411 %412 %406 + %412 = OpLabel + %413 = OpLoad %int %low + OpStore %i_1 %413 + OpBranch %414 + %414 = OpLabel + OpLoopMerge %415 %416 None + OpBranch %417 + %417 = OpLabel + %418 = OpLoad %int %i_1 + %419 = OpLoad %int %high + %420 = OpSLessThan %bool %418 %419 + OpBranchConditional %420 %421 %415 + %421 = OpLabel + %422 = OpLoad %int %i_1 + OpStore %from_0 %422 + %423 = OpLoad %int %i_1 + %424 = OpLoad %int %m + %425 = OpIAdd %int %423 %424 + %426 = OpISub %int %425 %int_1 + OpStore %mid_0 %426 + %427 = OpLoad %int %i_1 + %428 = OpLoad %int %m + %429 = OpIMul %int %int_2 %428 + %430 = OpIAdd %int %427 %429 + %431 = OpISub %int %430 %int_1 + %432 = OpLoad %int %high + %433 = OpExtInst %int %1 SMin %431 %432 + OpStore %to_0 %433 + %434 = OpLoad %int %from_0 + OpStore %param %434 + %435 = OpLoad %int %mid_0 + OpStore %param_0 %435 + %436 = OpLoad %int %to_0 + OpStore %param_1 %436 + %437 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_0 %param_1 + OpBranch %416 + %416 = OpLabel + %438 = OpLoad %int %m + %439 = OpIMul %int %int_2 %438 + %440 = OpLoad %int %i_1 + %441 = OpIAdd %int %440 %439 + OpStore %i_1 %441 + OpBranch %414 + %415 = OpLabel + OpBranch %407 + %407 = OpLabel + %442 = OpLoad %int %m + %443 = OpIMul %int %int_2 %442 + OpStore %m %443 + OpBranch %405 + %406 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9cf6e4b4ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.hlsl @@ -0,0 +1,372 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_255 = from; + k = x_255; + const int x_256 = from; + i = x_256; + const int x_257 = mid; + j = (x_257 + 1); + while (true) { + int x_283 = 0; + int x_284 = 0; + int x_303 = 0; + int x_304 = 0; + int x_318 = 0; + int x_322 = 0; + int x_337 = 0; + int x_336 = 0; + int x_350 = 0; + int x_349 = 0; + int x_364 = 0; + int x_363 = 0; + int x_285_phi = 0; + int x_305_phi = 0; + int x_326_phi = 0; + int x_338_phi = 0; + int x_351_phi = 0; + int x_365_phi = 0; + if ((1.0f >= 0.0f)) { + } else { + continue; + } + const int x_264 = i; + const int x_265 = mid; + const int x_267 = j; + const int x_268 = to; + bool tint_tmp = (x_264 <= x_265); + if (tint_tmp) { + tint_tmp = (x_267 <= x_268); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_274 = data[i]; + const int x_277 = data[j]; + const bool x_278 = (x_274 < x_277); + if (x_278) { + x_283 = k; + x_285_phi = x_283; + } else { + x_284 = 0; + x_285_phi = x_284; + } + const int x_285 = x_285_phi; + const int x_286 = (x_285 + 1); + if (x_278) { + k = x_286; + const float x_291 = asfloat(x_28[0].x); + if (!((1.0f <= x_291))) { + } else { + continue; + } + } + const float x_295 = asfloat(x_28[0].y); + if ((x_295 >= 0.0f)) { + } else { + continue; + } + const int x_298 = 0; + if (x_278) { + x_303 = i; + x_305_phi = x_303; + } else { + x_304 = 0; + x_305_phi = x_304; + } + const int x_307 = (x_278 ? x_305_phi : x_298); + if (x_278) { + i = (x_307 + 1); + } + const int x_313 = 0; + if (x_278) { + x_318 = data[x_307]; + const float x_320 = asfloat(x_28[0].y); + x_326_phi = x_318; + if (!((0.0f <= x_320))) { + continue; + } + } else { + x_322 = 0; + const float x_324 = asfloat(x_28[0].y); + x_326_phi = x_322; + if (!((x_324 < 0.0f))) { + } else { + continue; + } + } + const int x_326 = x_326_phi; + if (x_278) { + temp[x_285] = (x_278 ? x_326 : x_313); + } + if (x_278) { + x_337 = 0; + x_338_phi = x_337; + } else { + x_336 = k; + x_338_phi = x_336; + } + const int x_338 = x_338_phi; + if (x_278) { + } else { + k = (x_338 + 1); + } + const float x_343 = asfloat(x_28[0].x); + if (!((1.0f <= x_343))) { + } else { + continue; + } + if (x_278) { + x_350 = 0; + x_351_phi = x_350; + } else { + x_349 = j; + x_351_phi = x_349; + } + const int x_355 = (x_278 ? 0 : x_351_phi); + if (x_278) { + } else { + j = (x_355 + 1); + } + if (x_278) { + x_364 = 0; + x_365_phi = x_364; + } else { + x_363 = data[x_355]; + x_365_phi = x_363; + } + const int x_365 = x_365_phi; + if (x_278) { + } else { + temp[x_338] = x_365; + } + } + while (true) { + const int x_374 = i; + const int x_376 = i; + const int x_377 = mid; + bool tint_tmp_1 = (x_374 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_376 <= x_377); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_381 = k; + k = (x_381 + 1); + const int x_383 = i; + i = (x_383 + 1); + const int x_386 = data[x_383]; + temp[x_381] = x_386; + } + const int x_388 = from; + i_1 = x_388; + while (true) { + const int x_393 = i_1; + const int x_394 = to; + if ((x_393 <= x_394)) { + } else { + break; + } + const int x_397 = i_1; + const int x_400 = temp[i_1]; + data[x_397] = x_400; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_88 = asfloat(x_28[0].x); + i_3 = int(x_88); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_137 = j_1; + const int x_140 = data[j_1]; + temp[x_137] = x_140; + } + } + mergeSort_(); + const float x_146 = gl_FragCoord.y; + if ((int(x_146) < 30)) { + const int x_153 = data[0]; + grey = (0.5f + (float(x_153) / 10.0f)); + } else { + const float x_158 = gl_FragCoord.y; + if ((int(x_158) < 60)) { + const int x_165 = data[1]; + grey = (0.5f + (float(x_165) / 10.0f)); + } else { + const float x_170 = gl_FragCoord.y; + if ((int(x_170) < 90)) { + const int x_177 = data[2]; + grey = (0.5f + (float(x_177) / 10.0f)); + } else { + const float x_182 = gl_FragCoord.y; + if ((int(x_182) < 120)) { + const int x_189 = data[3]; + grey = (0.5f + (float(x_189) / 10.0f)); + } else { + const float x_194 = gl_FragCoord.y; + if ((int(x_194) < 150)) { + discard; + } else { + const float x_201 = gl_FragCoord.y; + if ((int(x_201) < 180)) { + const int x_208 = data[5]; + grey = (0.5f + (float(x_208) / 10.0f)); + } else { + const float x_213 = gl_FragCoord.y; + if ((int(x_213) < 210)) { + const int x_220 = data[6]; + grey = (0.5f + (float(x_220) / 10.0f)); + } else { + const float x_225 = gl_FragCoord.y; + if ((int(x_225) < 240)) { + const int x_232 = data[7]; + grey = (0.5f + (float(x_232) / 10.0f)); + } else { + const float x_237 = gl_FragCoord.y; + if ((int(x_237) < 270)) { + const int x_244 = data[8]; + grey = (0.5f + (float(x_244) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_248 = grey; + const float3 x_249 = float3(x_248, x_248, x_248); + x_GLF_color = float4(x_249.x, x_249.y, x_249.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.msl new file mode 100644 index 0000000000..c3a165b3f5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.msl @@ -0,0 +1,421 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(constant buf0& x_28, thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_255 = *(from); + k = x_255; + int const x_256 = *(from); + i = x_256; + int const x_257 = *(mid); + j = (x_257 + 1); + while (true) { + int x_283 = 0; + int x_284 = 0; + int x_303 = 0; + int x_304 = 0; + int x_318 = 0; + int x_322 = 0; + int x_337 = 0; + int x_336 = 0; + int x_350 = 0; + int x_349 = 0; + int x_364 = 0; + int x_363 = 0; + int x_285_phi = 0; + int x_305_phi = 0; + int x_326_phi = 0; + int x_338_phi = 0; + int x_351_phi = 0; + int x_365_phi = 0; + if ((1.0f >= 0.0f)) { + } else { + continue; + } + int const x_264 = i; + int const x_265 = *(mid); + int const x_267 = j; + int const x_268 = *(to); + if (((x_264 <= x_265) && (x_267 <= x_268))) { + } else { + break; + } + int const x_272 = i; + int const x_274 = (*(tint_symbol_5)).arr[x_272]; + int const x_275 = j; + int const x_277 = (*(tint_symbol_5)).arr[x_275]; + bool const x_278 = (x_274 < x_277); + if (x_278) { + x_283 = k; + x_285_phi = x_283; + } else { + x_284 = 0; + x_285_phi = x_284; + } + int const x_285 = x_285_phi; + int const x_286 = (x_285 + 1); + if (x_278) { + k = x_286; + float const x_291 = x_28.injectionSwitch.x; + if (!((1.0f <= x_291))) { + } else { + continue; + } + } + float const x_295 = x_28.injectionSwitch.y; + if ((x_295 >= 0.0f)) { + } else { + continue; + } + int const x_298 = 0; + if (x_278) { + x_303 = i; + x_305_phi = x_303; + } else { + x_304 = 0; + x_305_phi = x_304; + } + int const x_305 = x_305_phi; + int const x_307 = select(x_298, x_305, x_278); + if (x_278) { + i = (x_307 + 1); + } + int const x_313 = 0; + if (x_278) { + x_318 = (*(tint_symbol_5)).arr[x_307]; + float const x_320 = x_28.injectionSwitch.y; + x_326_phi = x_318; + if (!((0.0f <= x_320))) { + continue; + } + } else { + x_322 = 0; + float const x_324 = x_28.injectionSwitch.y; + x_326_phi = x_322; + if (!((x_324 < 0.0f))) { + } else { + continue; + } + } + int const x_326 = x_326_phi; + if (x_278) { + (*(tint_symbol_6)).arr[x_285] = select(x_313, x_326, x_278); + } + if (x_278) { + x_337 = 0; + x_338_phi = x_337; + } else { + x_336 = k; + x_338_phi = x_336; + } + int const x_338 = x_338_phi; + if (x_278) { + } else { + k = (x_338 + 1); + } + float const x_343 = x_28.injectionSwitch.x; + if (!((1.0f <= x_343))) { + } else { + continue; + } + if (x_278) { + x_350 = 0; + x_351_phi = x_350; + } else { + x_349 = j; + x_351_phi = x_349; + } + int const x_351 = x_351_phi; + int const x_353 = 0; + int const x_355 = select(x_351, x_353, x_278); + if (x_278) { + } else { + j = (x_355 + 1); + } + if (x_278) { + x_364 = 0; + x_365_phi = x_364; + } else { + x_363 = (*(tint_symbol_5)).arr[x_355]; + x_365_phi = x_363; + } + int const x_365 = x_365_phi; + if (x_278) { + } else { + (*(tint_symbol_6)).arr[x_338] = x_365; + } + } + while (true) { + int const x_374 = i; + int const x_376 = i; + int const x_377 = *(mid); + if (((x_374 < 10) && (x_376 <= x_377))) { + } else { + break; + } + int const x_381 = k; + k = (x_381 + 1); + int const x_383 = i; + i = (x_383 + 1); + int const x_386 = (*(tint_symbol_5)).arr[x_383]; + (*(tint_symbol_6)).arr[x_381] = x_386; + } + int const x_388 = *(from); + i_1 = x_388; + while (true) { + int const x_393 = i_1; + int const x_394 = *(to); + if ((x_393 <= x_394)) { + } else { + break; + } + int const x_397 = i_1; + int const x_398 = i_1; + int const x_400 = (*(tint_symbol_6)).arr[x_398]; + (*(tint_symbol_5)).arr[x_397] = x_400; + { + int const x_402 = i_1; + i_1 = (x_402 + 1); + } + } + return; +} + +void mergeSort_(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_409 = m; + int const x_410 = high; + if ((x_409 <= x_410)) { + } else { + break; + } + int const x_413 = low; + i_2 = x_413; + while (true) { + int const x_418 = i_2; + int const x_419 = high; + if ((x_418 < x_419)) { + } else { + break; + } + int const x_422 = i_2; + from_1 = x_422; + int const x_423 = i_2; + int const x_424 = m; + mid_1 = ((x_423 + x_424) - 1); + int const x_427 = i_2; + int const x_428 = m; + int const x_432 = high; + to_1 = min(((x_427 + (2 * x_428)) - 1), x_432); + int const x_434 = from_1; + param = x_434; + int const x_435 = mid_1; + param_1 = x_435; + int const x_436 = to_1; + param_2 = x_436; + merge_i1_i1_i1_(x_28, &(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_438 = m; + int const x_440 = i_2; + i_2 = (x_440 + (2 * x_438)); + } + } + { + int const x_442 = m; + m = (2 * x_442); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_88 = x_28.injectionSwitch.x; + i_3 = int(x_88); + while (true) { + int const x_94 = i_3; + switch(x_94) { + case 9: { + int const x_124 = i_3; + (*(tint_symbol_9)).arr[x_124] = -5; + break; + } + case 8: { + int const x_122 = i_3; + (*(tint_symbol_9)).arr[x_122] = -4; + break; + } + case 7: { + int const x_120 = i_3; + (*(tint_symbol_9)).arr[x_120] = -3; + break; + } + case 6: { + int const x_118 = i_3; + (*(tint_symbol_9)).arr[x_118] = -2; + break; + } + case 5: { + int const x_116 = i_3; + (*(tint_symbol_9)).arr[x_116] = -1; + break; + } + case 4: { + int const x_114 = i_3; + (*(tint_symbol_9)).arr[x_114] = 0; + break; + } + case 3: { + int const x_112 = i_3; + (*(tint_symbol_9)).arr[x_112] = 1; + break; + } + case 2: { + int const x_110 = i_3; + (*(tint_symbol_9)).arr[x_110] = 2; + break; + } + case 1: { + int const x_108 = i_3; + (*(tint_symbol_9)).arr[x_108] = 3; + break; + } + case 0: { + int const x_106 = i_3; + (*(tint_symbol_9)).arr[x_106] = 4; + break; + } + default: { + break; + } + } + int const x_126 = i_3; + i_3 = (x_126 + 1); + { + int const x_128 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_134 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + int const x_137 = j_1; + int const x_138 = j_1; + int const x_140 = (*(tint_symbol_9)).arr[x_138]; + (*(tint_symbol_10)).arr[x_137] = x_140; + { + int const x_142 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(x_28, tint_symbol_9, tint_symbol_10); + float const x_146 = (*(tint_symbol_11)).y; + if ((int(x_146) < 30)) { + int const x_153 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_153) / 10.0f)); + } else { + float const x_158 = (*(tint_symbol_11)).y; + if ((int(x_158) < 60)) { + int const x_165 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_165) / 10.0f)); + } else { + float const x_170 = (*(tint_symbol_11)).y; + if ((int(x_170) < 90)) { + int const x_177 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_177) / 10.0f)); + } else { + float const x_182 = (*(tint_symbol_11)).y; + if ((int(x_182) < 120)) { + int const x_189 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_189) / 10.0f)); + } else { + float const x_194 = (*(tint_symbol_11)).y; + if ((int(x_194) < 150)) { + discard_fragment(); + } else { + float const x_201 = (*(tint_symbol_11)).y; + if ((int(x_201) < 180)) { + int const x_208 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_208) / 10.0f)); + } else { + float const x_213 = (*(tint_symbol_11)).y; + if ((int(x_213) < 210)) { + int const x_220 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_220) / 10.0f)); + } else { + float const x_225 = (*(tint_symbol_11)).y; + if ((int(x_225) < 240)) { + int const x_232 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_232) / 10.0f)); + } else { + float const x_237 = (*(tint_symbol_11)).y; + if ((int(x_237) < 270)) { + int const x_244 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_244) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_248 = grey; + float3 const x_249 = float3(x_248, x_248, x_248); + *(tint_symbol_12) = float4(x_249.x, x_249.y, x_249.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..338bca8871 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.spvasm @@ -0,0 +1,862 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 523 +; Schema: 0 + OpCapability Shader + %288 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %x_283 "x_283" + OpName %x_284 "x_284" + OpName %x_303 "x_303" + OpName %x_304 "x_304" + OpName %x_318 "x_318" + OpName %x_322 "x_322" + OpName %x_337 "x_337" + OpName %x_336 "x_336" + OpName %x_350 "x_350" + OpName %x_349 "x_349" + OpName %x_364 "x_364" + OpName %x_363 "x_363" + OpName %x_285_phi "x_285_phi" + OpName %x_305_phi "x_305_phi" + OpName %x_326_phi "x_326_phi" + OpName %x_338_phi "x_338_phi" + OpName %x_351_phi "x_351_phi" + OpName %x_365_phi "x_365_phi" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %int_10 = OpConstant %int 10 + %244 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %312 = OpConstantNull %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %main_out = OpTypeStruct %v4float + %510 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %x_283 = OpVariable %_ptr_Function_int Function %32 + %x_284 = OpVariable %_ptr_Function_int Function %32 + %x_303 = OpVariable %_ptr_Function_int Function %32 + %x_304 = OpVariable %_ptr_Function_int Function %32 + %x_318 = OpVariable %_ptr_Function_int Function %32 + %x_322 = OpVariable %_ptr_Function_int Function %32 + %x_337 = OpVariable %_ptr_Function_int Function %32 + %x_336 = OpVariable %_ptr_Function_int Function %32 + %x_350 = OpVariable %_ptr_Function_int Function %32 + %x_349 = OpVariable %_ptr_Function_int Function %32 + %x_364 = OpVariable %_ptr_Function_int Function %32 + %x_363 = OpVariable %_ptr_Function_int Function %32 + %x_285_phi = OpVariable %_ptr_Function_int Function %32 + %x_305_phi = OpVariable %_ptr_Function_int Function %32 + %x_326_phi = OpVariable %_ptr_Function_int Function %32 + %x_338_phi = OpVariable %_ptr_Function_int Function %32 + %x_351_phi = OpVariable %_ptr_Function_int Function %32 + %x_365_phi = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %68 = OpFOrdGreaterThanEqual %bool %float_1 %float_0 + OpSelectionMerge %70 None + OpBranchConditional %68 %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %46 + %70 = OpLabel + %73 = OpLoad %int %i + %75 = OpLoad %int %mid + %76 = OpLoad %int %j + %78 = OpLoad %int %to + %79 = OpSLessThanEqual %bool %73 %75 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %80 + %81 = OpLabel + %82 = OpSLessThanEqual %bool %76 %78 + OpBranch %80 + %80 = OpLabel + %83 = OpPhi %bool %79 %70 %82 %81 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + OpBranch %84 + %86 = OpLabel + OpBranch %45 + %84 = OpLabel + %87 = OpLoad %int %i + %89 = OpAccessChain %_ptr_Private_int %data %87 + %90 = OpLoad %int %89 + %91 = OpLoad %int %j + %92 = OpAccessChain %_ptr_Private_int %data %91 + %93 = OpLoad %int %92 + %94 = OpSLessThan %bool %90 %93 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %97 + %96 = OpLabel + %98 = OpLoad %int %k + OpStore %x_283 %98 + %99 = OpLoad %int %x_283 + OpStore %x_285_phi %99 + OpBranch %95 + %97 = OpLabel + OpStore %x_284 %int_0 + %101 = OpLoad %int %x_284 + OpStore %x_285_phi %101 + OpBranch %95 + %95 = OpLabel + %102 = OpLoad %int %x_285_phi + %103 = OpIAdd %int %102 %int_1 + OpSelectionMerge %104 None + OpBranchConditional %94 %105 %104 + %105 = OpLabel + OpStore %k %103 + %108 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %109 = OpLoad %float %108 + %111 = OpFOrdLessThanEqual %bool %float_1 %109 + %110 = OpLogicalNot %bool %111 + OpSelectionMerge %112 None + OpBranchConditional %110 %113 %114 + %113 = OpLabel + OpBranch %112 + %114 = OpLabel + OpBranch %46 + %112 = OpLabel + OpBranch %104 + %104 = OpLabel + %116 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %117 = OpLoad %float %116 + %118 = OpFOrdGreaterThanEqual %bool %117 %float_0 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %121 + %120 = OpLabel + OpBranch %119 + %121 = OpLabel + OpBranch %46 + %119 = OpLabel + OpSelectionMerge %122 None + OpBranchConditional %94 %123 %124 + %123 = OpLabel + %125 = OpLoad %int %i + OpStore %x_303 %125 + %126 = OpLoad %int %x_303 + OpStore %x_305_phi %126 + OpBranch %122 + %124 = OpLabel + OpStore %x_304 %int_0 + %127 = OpLoad %int %x_304 + OpStore %x_305_phi %127 + OpBranch %122 + %122 = OpLabel + %128 = OpLoad %int %x_305_phi + %129 = OpSelect %int %94 %128 %int_0 + OpSelectionMerge %130 None + OpBranchConditional %94 %131 %130 + %131 = OpLabel + %132 = OpIAdd %int %129 %int_1 + OpStore %i %132 + OpBranch %130 + %130 = OpLabel + OpSelectionMerge %133 None + OpBranchConditional %94 %134 %135 + %134 = OpLabel + %136 = OpAccessChain %_ptr_Private_int %data %129 + %137 = OpLoad %int %136 + OpStore %x_318 %137 + %138 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %139 = OpLoad %float %138 + %140 = OpLoad %int %x_318 + OpStore %x_326_phi %140 + %142 = OpFOrdLessThanEqual %bool %float_0 %139 + %141 = OpLogicalNot %bool %142 + OpSelectionMerge %143 None + OpBranchConditional %141 %144 %143 + %144 = OpLabel + OpBranch %46 + %143 = OpLabel + OpBranch %133 + %135 = OpLabel + OpStore %x_322 %int_0 + %145 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %146 = OpLoad %float %145 + %147 = OpLoad %int %x_322 + OpStore %x_326_phi %147 + %149 = OpFOrdLessThan %bool %146 %float_0 + %148 = OpLogicalNot %bool %149 + OpSelectionMerge %150 None + OpBranchConditional %148 %151 %152 + %151 = OpLabel + OpBranch %150 + %152 = OpLabel + OpBranch %46 + %150 = OpLabel + OpBranch %133 + %133 = OpLabel + %153 = OpLoad %int %x_326_phi + OpSelectionMerge %154 None + OpBranchConditional %94 %155 %154 + %155 = OpLabel + %156 = OpAccessChain %_ptr_Private_int %temp %102 + %157 = OpSelect %int %94 %153 %int_0 + OpStore %156 %157 + OpBranch %154 + %154 = OpLabel + OpSelectionMerge %158 None + OpBranchConditional %94 %159 %160 + %159 = OpLabel + OpStore %x_337 %int_0 + %161 = OpLoad %int %x_337 + OpStore %x_338_phi %161 + OpBranch %158 + %160 = OpLabel + %162 = OpLoad %int %k + OpStore %x_336 %162 + %163 = OpLoad %int %x_336 + OpStore %x_338_phi %163 + OpBranch %158 + %158 = OpLabel + %164 = OpLoad %int %x_338_phi + OpSelectionMerge %165 None + OpBranchConditional %94 %166 %167 + %166 = OpLabel + OpBranch %165 + %167 = OpLabel + %168 = OpIAdd %int %164 %int_1 + OpStore %k %168 + OpBranch %165 + %165 = OpLabel + %169 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %170 = OpLoad %float %169 + %172 = OpFOrdLessThanEqual %bool %float_1 %170 + %171 = OpLogicalNot %bool %172 + OpSelectionMerge %173 None + OpBranchConditional %171 %174 %175 + %174 = OpLabel + OpBranch %173 + %175 = OpLabel + OpBranch %46 + %173 = OpLabel + OpSelectionMerge %176 None + OpBranchConditional %94 %177 %178 + %177 = OpLabel + OpStore %x_350 %int_0 + %179 = OpLoad %int %x_350 + OpStore %x_351_phi %179 + OpBranch %176 + %178 = OpLabel + %180 = OpLoad %int %j + OpStore %x_349 %180 + %181 = OpLoad %int %x_349 + OpStore %x_351_phi %181 + OpBranch %176 + %176 = OpLabel + %182 = OpLoad %int %x_351_phi + %183 = OpSelect %int %94 %int_0 %182 + OpSelectionMerge %184 None + OpBranchConditional %94 %185 %186 + %185 = OpLabel + OpBranch %184 + %186 = OpLabel + %187 = OpIAdd %int %183 %int_1 + OpStore %j %187 + OpBranch %184 + %184 = OpLabel + OpSelectionMerge %188 None + OpBranchConditional %94 %189 %190 + %189 = OpLabel + OpStore %x_364 %int_0 + %191 = OpLoad %int %x_364 + OpStore %x_365_phi %191 + OpBranch %188 + %190 = OpLabel + %192 = OpAccessChain %_ptr_Private_int %data %183 + %193 = OpLoad %int %192 + OpStore %x_363 %193 + %194 = OpLoad %int %x_363 + OpStore %x_365_phi %194 + OpBranch %188 + %188 = OpLabel + %195 = OpLoad %int %x_365_phi + OpSelectionMerge %196 None + OpBranchConditional %94 %197 %198 + %197 = OpLabel + OpBranch %196 + %198 = OpLabel + %199 = OpAccessChain %_ptr_Private_int %temp %164 + OpStore %199 %195 + OpBranch %196 + %196 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %200 + %200 = OpLabel + OpLoopMerge %201 %202 None + OpBranch %203 + %203 = OpLabel + %204 = OpLoad %int %i + %205 = OpLoad %int %i + %207 = OpLoad %int %mid + %209 = OpSLessThan %bool %204 %int_10 + OpSelectionMerge %210 None + OpBranchConditional %209 %211 %210 + %211 = OpLabel + %212 = OpSLessThanEqual %bool %205 %207 + OpBranch %210 + %210 = OpLabel + %213 = OpPhi %bool %209 %203 %212 %211 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %201 + %214 = OpLabel + %217 = OpLoad %int %k + %218 = OpIAdd %int %217 %int_1 + OpStore %k %218 + %219 = OpLoad %int %i + %220 = OpIAdd %int %219 %int_1 + OpStore %i %220 + %221 = OpAccessChain %_ptr_Private_int %data %219 + %222 = OpLoad %int %221 + %223 = OpAccessChain %_ptr_Private_int %temp %217 + OpStore %223 %222 + OpBranch %202 + %202 = OpLabel + OpBranch %200 + %201 = OpLabel + %225 = OpLoad %int %from + OpStore %i_1 %225 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %227 %228 None + OpBranch %229 + %229 = OpLabel + %230 = OpLoad %int %i_1 + %232 = OpLoad %int %to + %233 = OpSLessThanEqual %bool %230 %232 + OpSelectionMerge %234 None + OpBranchConditional %233 %235 %236 + %235 = OpLabel + OpBranch %234 + %236 = OpLabel + OpBranch %227 + %234 = OpLabel + %237 = OpLoad %int %i_1 + %238 = OpLoad %int %i_1 + %239 = OpAccessChain %_ptr_Private_int %temp %238 + %240 = OpLoad %int %239 + %241 = OpAccessChain %_ptr_Private_int %data %237 + OpStore %241 %240 + OpBranch %228 + %228 = OpLabel + %242 = OpLoad %int %i_1 + %243 = OpIAdd %int %242 %int_1 + OpStore %i_1 %243 + OpBranch %226 + %227 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %244 + %246 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %258 + %258 = OpLabel + OpLoopMerge %259 %260 None + OpBranch %261 + %261 = OpLabel + %262 = OpLoad %int %m + %263 = OpLoad %int %high + %264 = OpSLessThanEqual %bool %262 %263 + OpSelectionMerge %265 None + OpBranchConditional %264 %266 %267 + %266 = OpLabel + OpBranch %265 + %267 = OpLabel + OpBranch %259 + %265 = OpLabel + %268 = OpLoad %int %low + OpStore %i_2 %268 + OpBranch %269 + %269 = OpLabel + OpLoopMerge %270 %271 None + OpBranch %272 + %272 = OpLabel + %273 = OpLoad %int %i_2 + %274 = OpLoad %int %high + %275 = OpSLessThan %bool %273 %274 + OpSelectionMerge %276 None + OpBranchConditional %275 %277 %278 + %277 = OpLabel + OpBranch %276 + %278 = OpLabel + OpBranch %270 + %276 = OpLabel + %279 = OpLoad %int %i_2 + OpStore %from_1 %279 + %280 = OpLoad %int %i_2 + %281 = OpLoad %int %m + %282 = OpIAdd %int %280 %281 + %283 = OpISub %int %282 %int_1 + OpStore %mid_1 %283 + %284 = OpLoad %int %i_2 + %285 = OpLoad %int %m + %286 = OpLoad %int %high + %290 = OpIMul %int %int_2 %285 + %291 = OpIAdd %int %284 %290 + %292 = OpISub %int %291 %int_1 + %287 = OpExtInst %int %288 SMin %292 %286 + OpStore %to_1 %287 + %293 = OpLoad %int %from_1 + OpStore %param %293 + %294 = OpLoad %int %mid_1 + OpStore %param_1 %294 + %295 = OpLoad %int %to_1 + OpStore %param_2 %295 + %296 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %271 + %271 = OpLabel + %300 = OpLoad %int %m + %301 = OpLoad %int %i_2 + %302 = OpIMul %int %int_2 %300 + %303 = OpIAdd %int %301 %302 + OpStore %i_2 %303 + OpBranch %269 + %270 = OpLabel + OpBranch %260 + %260 = OpLabel + %304 = OpLoad %int %m + %305 = OpIMul %int %int_2 %304 + OpStore %m %305 + OpBranch %258 + %259 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %244 + %307 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %312 + %313 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %314 = OpLoad %float %313 + %315 = OpConvertFToS %int %314 + OpStore %i_3 %315 + OpBranch %316 + %316 = OpLabel + OpLoopMerge %317 %318 None + OpBranch %319 + %319 = OpLabel + %320 = OpLoad %int %i_3 + OpSelectionMerge %321 None + OpSwitch %320 %322 9 %323 8 %324 7 %325 6 %326 5 %327 4 %328 3 %329 2 %330 1 %331 0 %332 + %323 = OpLabel + %333 = OpLoad %int %i_3 + %334 = OpAccessChain %_ptr_Private_int %data %333 + OpStore %334 %int_n5 + OpBranch %321 + %324 = OpLabel + %336 = OpLoad %int %i_3 + %337 = OpAccessChain %_ptr_Private_int %data %336 + OpStore %337 %int_n4 + OpBranch %321 + %325 = OpLabel + %339 = OpLoad %int %i_3 + %340 = OpAccessChain %_ptr_Private_int %data %339 + OpStore %340 %int_n3 + OpBranch %321 + %326 = OpLabel + %342 = OpLoad %int %i_3 + %343 = OpAccessChain %_ptr_Private_int %data %342 + OpStore %343 %int_n2 + OpBranch %321 + %327 = OpLabel + %345 = OpLoad %int %i_3 + %346 = OpAccessChain %_ptr_Private_int %data %345 + OpStore %346 %int_n1 + OpBranch %321 + %328 = OpLabel + %348 = OpLoad %int %i_3 + %349 = OpAccessChain %_ptr_Private_int %data %348 + OpStore %349 %int_0 + OpBranch %321 + %329 = OpLabel + %350 = OpLoad %int %i_3 + %351 = OpAccessChain %_ptr_Private_int %data %350 + OpStore %351 %int_1 + OpBranch %321 + %330 = OpLabel + %352 = OpLoad %int %i_3 + %353 = OpAccessChain %_ptr_Private_int %data %352 + OpStore %353 %int_2 + OpBranch %321 + %331 = OpLabel + %354 = OpLoad %int %i_3 + %355 = OpAccessChain %_ptr_Private_int %data %354 + OpStore %355 %int_3 + OpBranch %321 + %332 = OpLabel + %357 = OpLoad %int %i_3 + %358 = OpAccessChain %_ptr_Private_int %data %357 + OpStore %358 %int_4 + OpBranch %321 + %322 = OpLabel + OpBranch %321 + %321 = OpLabel + %360 = OpLoad %int %i_3 + %361 = OpIAdd %int %360 %int_1 + OpStore %i_3 %361 + OpBranch %318 + %318 = OpLabel + %362 = OpLoad %int %i_3 + %363 = OpSLessThan %bool %362 %int_10 + OpSelectionMerge %364 None + OpBranchConditional %363 %365 %366 + %365 = OpLabel + OpBranch %364 + %366 = OpLabel + OpBranch %317 + %364 = OpLabel + OpBranch %316 + %317 = OpLabel + OpStore %j_1 %int_0 + OpBranch %367 + %367 = OpLabel + OpLoopMerge %368 %369 None + OpBranch %370 + %370 = OpLabel + %371 = OpLoad %int %j_1 + %372 = OpSLessThan %bool %371 %int_10 + OpSelectionMerge %373 None + OpBranchConditional %372 %374 %375 + %374 = OpLabel + OpBranch %373 + %375 = OpLabel + OpBranch %368 + %373 = OpLabel + %376 = OpLoad %int %j_1 + %377 = OpLoad %int %j_1 + %378 = OpAccessChain %_ptr_Private_int %data %377 + %379 = OpLoad %int %378 + %380 = OpAccessChain %_ptr_Private_int %temp %376 + OpStore %380 %379 + OpBranch %369 + %369 = OpLabel + %381 = OpLoad %int %j_1 + %382 = OpIAdd %int %381 %int_1 + OpStore %j_1 %382 + OpBranch %367 + %368 = OpLabel + %383 = OpFunctionCall %void %mergeSort_ + %385 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %386 = OpLoad %float %385 + %387 = OpConvertFToS %int %386 + %389 = OpSLessThan %bool %387 %int_30 + OpSelectionMerge %390 None + OpBranchConditional %389 %391 %392 + %391 = OpLabel + %393 = OpAccessChain %_ptr_Private_int %data %int_0 + %394 = OpLoad %int %393 + %396 = OpConvertSToF %float %394 + %398 = OpFDiv %float %396 %float_10 + %399 = OpFAdd %float %float_0_5 %398 + OpStore %grey %399 + OpBranch %390 + %392 = OpLabel + %400 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %401 = OpLoad %float %400 + %402 = OpConvertFToS %int %401 + %404 = OpSLessThan %bool %402 %int_60 + OpSelectionMerge %405 None + OpBranchConditional %404 %406 %407 + %406 = OpLabel + %408 = OpAccessChain %_ptr_Private_int %data %int_1 + %409 = OpLoad %int %408 + %410 = OpConvertSToF %float %409 + %411 = OpFDiv %float %410 %float_10 + %412 = OpFAdd %float %float_0_5 %411 + OpStore %grey %412 + OpBranch %405 + %407 = OpLabel + %413 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %414 = OpLoad %float %413 + %415 = OpConvertFToS %int %414 + %417 = OpSLessThan %bool %415 %int_90 + OpSelectionMerge %418 None + OpBranchConditional %417 %419 %420 + %419 = OpLabel + %421 = OpAccessChain %_ptr_Private_int %data %int_2 + %422 = OpLoad %int %421 + %423 = OpConvertSToF %float %422 + %424 = OpFDiv %float %423 %float_10 + %425 = OpFAdd %float %float_0_5 %424 + OpStore %grey %425 + OpBranch %418 + %420 = OpLabel + %426 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %427 = OpLoad %float %426 + %428 = OpConvertFToS %int %427 + %430 = OpSLessThan %bool %428 %int_120 + OpSelectionMerge %431 None + OpBranchConditional %430 %432 %433 + %432 = OpLabel + %434 = OpAccessChain %_ptr_Private_int %data %int_3 + %435 = OpLoad %int %434 + %436 = OpConvertSToF %float %435 + %437 = OpFDiv %float %436 %float_10 + %438 = OpFAdd %float %float_0_5 %437 + OpStore %grey %438 + OpBranch %431 + %433 = OpLabel + %439 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %440 = OpLoad %float %439 + %441 = OpConvertFToS %int %440 + %443 = OpSLessThan %bool %441 %int_150 + OpSelectionMerge %444 None + OpBranchConditional %443 %445 %446 + %445 = OpLabel + OpKill + %446 = OpLabel + %447 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %448 = OpLoad %float %447 + %449 = OpConvertFToS %int %448 + %451 = OpSLessThan %bool %449 %int_180 + OpSelectionMerge %452 None + OpBranchConditional %451 %453 %454 + %453 = OpLabel + %456 = OpAccessChain %_ptr_Private_int %data %int_5 + %457 = OpLoad %int %456 + %458 = OpConvertSToF %float %457 + %459 = OpFDiv %float %458 %float_10 + %460 = OpFAdd %float %float_0_5 %459 + OpStore %grey %460 + OpBranch %452 + %454 = OpLabel + %461 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %462 = OpLoad %float %461 + %463 = OpConvertFToS %int %462 + %465 = OpSLessThan %bool %463 %int_210 + OpSelectionMerge %466 None + OpBranchConditional %465 %467 %468 + %467 = OpLabel + %470 = OpAccessChain %_ptr_Private_int %data %int_6 + %471 = OpLoad %int %470 + %472 = OpConvertSToF %float %471 + %473 = OpFDiv %float %472 %float_10 + %474 = OpFAdd %float %float_0_5 %473 + OpStore %grey %474 + OpBranch %466 + %468 = OpLabel + %475 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %476 = OpLoad %float %475 + %477 = OpConvertFToS %int %476 + %479 = OpSLessThan %bool %477 %int_240 + OpSelectionMerge %480 None + OpBranchConditional %479 %481 %482 + %481 = OpLabel + %484 = OpAccessChain %_ptr_Private_int %data %int_7 + %485 = OpLoad %int %484 + %486 = OpConvertSToF %float %485 + %487 = OpFDiv %float %486 %float_10 + %488 = OpFAdd %float %float_0_5 %487 + OpStore %grey %488 + OpBranch %480 + %482 = OpLabel + %489 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %490 = OpLoad %float %489 + %491 = OpConvertFToS %int %490 + %493 = OpSLessThan %bool %491 %int_270 + OpSelectionMerge %494 None + OpBranchConditional %493 %495 %496 + %495 = OpLabel + %498 = OpAccessChain %_ptr_Private_int %data %int_8 + %499 = OpLoad %int %498 + %500 = OpConvertSToF %float %499 + %501 = OpFDiv %float %500 %float_10 + %502 = OpFAdd %float %float_0_5 %501 + OpStore %grey %502 + OpBranch %494 + %496 = OpLabel + OpKill + %494 = OpLabel + OpBranch %480 + %480 = OpLabel + OpBranch %466 + %466 = OpLabel + OpBranch %452 + %452 = OpLabel + OpBranch %444 + %444 = OpLabel + OpBranch %431 + %431 = OpLabel + OpBranch %418 + %418 = OpLabel + OpBranch %405 + %405 = OpLabel + OpBranch %390 + %390 = OpLabel + %503 = OpLoad %float %grey + %505 = OpCompositeConstruct %v3float %503 %503 %503 + %506 = OpCompositeExtract %float %505 0 + %507 = OpCompositeExtract %float %505 1 + %508 = OpCompositeExtract %float %505 2 + %509 = OpCompositeConstruct %v4float %506 %507 %508 %float_1 + OpStore %x_GLF_color %509 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %510 +%tint_symbol_1 = OpFunctionParameter %main_out + %514 = OpLabel + %515 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %515 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %244 + %517 = OpLabel + %518 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %518 + %519 = OpFunctionCall %void %main_1 + %521 = OpLoad %v4float %x_GLF_color + %522 = OpCompositeConstruct %main_out %521 + %520 = OpFunctionCall %void %tint_symbol_3 %522 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 318[%318] is not post dominated by the back-edge block 364[%364] + %364 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..e349c0c6e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.spvasm.expected.wgsl @@ -0,0 +1,413 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_255 : i32 = *(from); + k = x_255; + let x_256 : i32 = *(from); + i = x_256; + let x_257 : i32 = *(mid); + j = (x_257 + 1); + loop { + var x_283 : i32; + var x_284 : i32; + var x_303 : i32; + var x_304 : i32; + var x_318 : i32; + var x_322 : i32; + var x_337 : i32; + var x_336 : i32; + var x_350 : i32; + var x_349 : i32; + var x_364 : i32; + var x_363 : i32; + var x_285_phi : i32; + var x_305_phi : i32; + var x_326_phi : i32; + var x_338_phi : i32; + var x_351_phi : i32; + var x_365_phi : i32; + if ((1.0 >= 0.0)) { + } else { + continue; + } + let x_264 : i32 = i; + let x_265 : i32 = *(mid); + let x_267 : i32 = j; + let x_268 : i32 = *(to); + if (((x_264 <= x_265) && (x_267 <= x_268))) { + } else { + break; + } + let x_272 : i32 = i; + let x_274 : i32 = data[x_272]; + let x_275 : i32 = j; + let x_277 : i32 = data[x_275]; + let x_278 : bool = (x_274 < x_277); + if (x_278) { + x_283 = k; + x_285_phi = x_283; + } else { + x_284 = 0; + x_285_phi = x_284; + } + let x_285 : i32 = x_285_phi; + let x_286 : i32 = (x_285 + 1); + if (x_278) { + k = x_286; + let x_291 : f32 = x_28.injectionSwitch.x; + if (!((1.0 <= x_291))) { + } else { + continue; + } + } + let x_295 : f32 = x_28.injectionSwitch.y; + if ((x_295 >= 0.0)) { + } else { + continue; + } + let x_298 : i32 = 0; + if (x_278) { + x_303 = i; + x_305_phi = x_303; + } else { + x_304 = 0; + x_305_phi = x_304; + } + let x_305 : i32 = x_305_phi; + let x_307 : i32 = select(x_298, x_305, x_278); + if (x_278) { + i = (x_307 + 1); + } + let x_313 : i32 = 0; + if (x_278) { + x_318 = data[x_307]; + let x_320 : f32 = x_28.injectionSwitch.y; + x_326_phi = x_318; + if (!((0.0 <= x_320))) { + continue; + } + } else { + x_322 = 0; + let x_324 : f32 = x_28.injectionSwitch.y; + x_326_phi = x_322; + if (!((x_324 < 0.0))) { + } else { + continue; + } + } + let x_326 : i32 = x_326_phi; + if (x_278) { + temp[x_285] = select(x_313, x_326, x_278); + } + if (x_278) { + x_337 = 0; + x_338_phi = x_337; + } else { + x_336 = k; + x_338_phi = x_336; + } + let x_338 : i32 = x_338_phi; + if (x_278) { + } else { + k = (x_338 + 1); + } + let x_343 : f32 = x_28.injectionSwitch.x; + if (!((1.0 <= x_343))) { + } else { + continue; + } + if (x_278) { + x_350 = 0; + x_351_phi = x_350; + } else { + x_349 = j; + x_351_phi = x_349; + } + let x_351 : i32 = x_351_phi; + let x_353 : i32 = 0; + let x_355 : i32 = select(x_351, x_353, x_278); + if (x_278) { + } else { + j = (x_355 + 1); + } + if (x_278) { + x_364 = 0; + x_365_phi = x_364; + } else { + x_363 = data[x_355]; + x_365_phi = x_363; + } + let x_365 : i32 = x_365_phi; + if (x_278) { + } else { + temp[x_338] = x_365; + } + } + loop { + let x_374 : i32 = i; + let x_376 : i32 = i; + let x_377 : i32 = *(mid); + if (((x_374 < 10) && (x_376 <= x_377))) { + } else { + break; + } + let x_381 : i32 = k; + k = (x_381 + 1); + let x_383 : i32 = i; + i = (x_383 + 1); + let x_386 : i32 = data[x_383]; + temp[x_381] = x_386; + } + let x_388 : i32 = *(from); + i_1 = x_388; + loop { + let x_393 : i32 = i_1; + let x_394 : i32 = *(to); + if ((x_393 <= x_394)) { + } else { + break; + } + let x_397 : i32 = i_1; + let x_398 : i32 = i_1; + let x_400 : i32 = temp[x_398]; + data[x_397] = x_400; + + continuing { + let x_402 : i32 = i_1; + i_1 = (x_402 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_409 : i32 = m; + let x_410 : i32 = high; + if ((x_409 <= x_410)) { + } else { + break; + } + let x_413 : i32 = low; + i_2 = x_413; + loop { + let x_418 : i32 = i_2; + let x_419 : i32 = high; + if ((x_418 < x_419)) { + } else { + break; + } + let x_422 : i32 = i_2; + from_1 = x_422; + let x_423 : i32 = i_2; + let x_424 : i32 = m; + mid_1 = ((x_423 + x_424) - 1); + let x_427 : i32 = i_2; + let x_428 : i32 = m; + let x_432 : i32 = high; + to_1 = min(((x_427 + (2 * x_428)) - 1), x_432); + let x_434 : i32 = from_1; + param = x_434; + let x_435 : i32 = mid_1; + param_1 = x_435; + let x_436 : i32 = to_1; + param_2 = x_436; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_438 : i32 = m; + let x_440 : i32 = i_2; + i_2 = (x_440 + (2 * x_438)); + } + } + + continuing { + let x_442 : i32 = m; + m = (2 * x_442); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_88 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_88); + loop { + let x_94 : i32 = i_3; + switch(x_94) { + case 9: { + let x_124 : i32 = i_3; + data[x_124] = -5; + } + case 8: { + let x_122 : i32 = i_3; + data[x_122] = -4; + } + case 7: { + let x_120 : i32 = i_3; + data[x_120] = -3; + } + case 6: { + let x_118 : i32 = i_3; + data[x_118] = -2; + } + case 5: { + let x_116 : i32 = i_3; + data[x_116] = -1; + } + case 4: { + let x_114 : i32 = i_3; + data[x_114] = 0; + } + case 3: { + let x_112 : i32 = i_3; + data[x_112] = 1; + } + case 2: { + let x_110 : i32 = i_3; + data[x_110] = 2; + } + case 1: { + let x_108 : i32 = i_3; + data[x_108] = 3; + } + case 0: { + let x_106 : i32 = i_3; + data[x_106] = 4; + } + default: { + } + } + let x_126 : i32 = i_3; + i_3 = (x_126 + 1); + + continuing { + let x_128 : i32 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_134 : i32 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + let x_137 : i32 = j_1; + let x_138 : i32 = j_1; + let x_140 : i32 = data[x_138]; + temp[x_137] = x_140; + + continuing { + let x_142 : i32 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(); + let x_146 : f32 = gl_FragCoord.y; + if ((i32(x_146) < 30)) { + let x_153 : i32 = data[0]; + grey = (0.5 + (f32(x_153) / 10.0)); + } else { + let x_158 : f32 = gl_FragCoord.y; + if ((i32(x_158) < 60)) { + let x_165 : i32 = data[1]; + grey = (0.5 + (f32(x_165) / 10.0)); + } else { + let x_170 : f32 = gl_FragCoord.y; + if ((i32(x_170) < 90)) { + let x_177 : i32 = data[2]; + grey = (0.5 + (f32(x_177) / 10.0)); + } else { + let x_182 : f32 = gl_FragCoord.y; + if ((i32(x_182) < 120)) { + let x_189 : i32 = data[3]; + grey = (0.5 + (f32(x_189) / 10.0)); + } else { + let x_194 : f32 = gl_FragCoord.y; + if ((i32(x_194) < 150)) { + discard; + } else { + let x_201 : f32 = gl_FragCoord.y; + if ((i32(x_201) < 180)) { + let x_208 : i32 = data[5]; + grey = (0.5 + (f32(x_208) / 10.0)); + } else { + let x_213 : f32 = gl_FragCoord.y; + if ((i32(x_213) < 210)) { + let x_220 : i32 = data[6]; + grey = (0.5 + (f32(x_220) / 10.0)); + } else { + let x_225 : f32 = gl_FragCoord.y; + if ((i32(x_225) < 240)) { + let x_232 : i32 = data[7]; + grey = (0.5 + (f32(x_232) / 10.0)); + } else { + let x_237 : f32 = gl_FragCoord.y; + if ((i32(x_237) < 270)) { + let x_244 : i32 = data[8]; + grey = (0.5 + (f32(x_244) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_248 : f32 = grey; + let x_249 : vec3 = vec3(x_248, x_248, x_248); + x_GLF_color = vec4(x_249.x, x_249.y, x_249.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl new file mode 100644 index 0000000000..e349c0c6e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl @@ -0,0 +1,413 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_255 : i32 = *(from); + k = x_255; + let x_256 : i32 = *(from); + i = x_256; + let x_257 : i32 = *(mid); + j = (x_257 + 1); + loop { + var x_283 : i32; + var x_284 : i32; + var x_303 : i32; + var x_304 : i32; + var x_318 : i32; + var x_322 : i32; + var x_337 : i32; + var x_336 : i32; + var x_350 : i32; + var x_349 : i32; + var x_364 : i32; + var x_363 : i32; + var x_285_phi : i32; + var x_305_phi : i32; + var x_326_phi : i32; + var x_338_phi : i32; + var x_351_phi : i32; + var x_365_phi : i32; + if ((1.0 >= 0.0)) { + } else { + continue; + } + let x_264 : i32 = i; + let x_265 : i32 = *(mid); + let x_267 : i32 = j; + let x_268 : i32 = *(to); + if (((x_264 <= x_265) && (x_267 <= x_268))) { + } else { + break; + } + let x_272 : i32 = i; + let x_274 : i32 = data[x_272]; + let x_275 : i32 = j; + let x_277 : i32 = data[x_275]; + let x_278 : bool = (x_274 < x_277); + if (x_278) { + x_283 = k; + x_285_phi = x_283; + } else { + x_284 = 0; + x_285_phi = x_284; + } + let x_285 : i32 = x_285_phi; + let x_286 : i32 = (x_285 + 1); + if (x_278) { + k = x_286; + let x_291 : f32 = x_28.injectionSwitch.x; + if (!((1.0 <= x_291))) { + } else { + continue; + } + } + let x_295 : f32 = x_28.injectionSwitch.y; + if ((x_295 >= 0.0)) { + } else { + continue; + } + let x_298 : i32 = 0; + if (x_278) { + x_303 = i; + x_305_phi = x_303; + } else { + x_304 = 0; + x_305_phi = x_304; + } + let x_305 : i32 = x_305_phi; + let x_307 : i32 = select(x_298, x_305, x_278); + if (x_278) { + i = (x_307 + 1); + } + let x_313 : i32 = 0; + if (x_278) { + x_318 = data[x_307]; + let x_320 : f32 = x_28.injectionSwitch.y; + x_326_phi = x_318; + if (!((0.0 <= x_320))) { + continue; + } + } else { + x_322 = 0; + let x_324 : f32 = x_28.injectionSwitch.y; + x_326_phi = x_322; + if (!((x_324 < 0.0))) { + } else { + continue; + } + } + let x_326 : i32 = x_326_phi; + if (x_278) { + temp[x_285] = select(x_313, x_326, x_278); + } + if (x_278) { + x_337 = 0; + x_338_phi = x_337; + } else { + x_336 = k; + x_338_phi = x_336; + } + let x_338 : i32 = x_338_phi; + if (x_278) { + } else { + k = (x_338 + 1); + } + let x_343 : f32 = x_28.injectionSwitch.x; + if (!((1.0 <= x_343))) { + } else { + continue; + } + if (x_278) { + x_350 = 0; + x_351_phi = x_350; + } else { + x_349 = j; + x_351_phi = x_349; + } + let x_351 : i32 = x_351_phi; + let x_353 : i32 = 0; + let x_355 : i32 = select(x_351, x_353, x_278); + if (x_278) { + } else { + j = (x_355 + 1); + } + if (x_278) { + x_364 = 0; + x_365_phi = x_364; + } else { + x_363 = data[x_355]; + x_365_phi = x_363; + } + let x_365 : i32 = x_365_phi; + if (x_278) { + } else { + temp[x_338] = x_365; + } + } + loop { + let x_374 : i32 = i; + let x_376 : i32 = i; + let x_377 : i32 = *(mid); + if (((x_374 < 10) && (x_376 <= x_377))) { + } else { + break; + } + let x_381 : i32 = k; + k = (x_381 + 1); + let x_383 : i32 = i; + i = (x_383 + 1); + let x_386 : i32 = data[x_383]; + temp[x_381] = x_386; + } + let x_388 : i32 = *(from); + i_1 = x_388; + loop { + let x_393 : i32 = i_1; + let x_394 : i32 = *(to); + if ((x_393 <= x_394)) { + } else { + break; + } + let x_397 : i32 = i_1; + let x_398 : i32 = i_1; + let x_400 : i32 = temp[x_398]; + data[x_397] = x_400; + + continuing { + let x_402 : i32 = i_1; + i_1 = (x_402 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_409 : i32 = m; + let x_410 : i32 = high; + if ((x_409 <= x_410)) { + } else { + break; + } + let x_413 : i32 = low; + i_2 = x_413; + loop { + let x_418 : i32 = i_2; + let x_419 : i32 = high; + if ((x_418 < x_419)) { + } else { + break; + } + let x_422 : i32 = i_2; + from_1 = x_422; + let x_423 : i32 = i_2; + let x_424 : i32 = m; + mid_1 = ((x_423 + x_424) - 1); + let x_427 : i32 = i_2; + let x_428 : i32 = m; + let x_432 : i32 = high; + to_1 = min(((x_427 + (2 * x_428)) - 1), x_432); + let x_434 : i32 = from_1; + param = x_434; + let x_435 : i32 = mid_1; + param_1 = x_435; + let x_436 : i32 = to_1; + param_2 = x_436; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_438 : i32 = m; + let x_440 : i32 = i_2; + i_2 = (x_440 + (2 * x_438)); + } + } + + continuing { + let x_442 : i32 = m; + m = (2 * x_442); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_88 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_88); + loop { + let x_94 : i32 = i_3; + switch(x_94) { + case 9: { + let x_124 : i32 = i_3; + data[x_124] = -5; + } + case 8: { + let x_122 : i32 = i_3; + data[x_122] = -4; + } + case 7: { + let x_120 : i32 = i_3; + data[x_120] = -3; + } + case 6: { + let x_118 : i32 = i_3; + data[x_118] = -2; + } + case 5: { + let x_116 : i32 = i_3; + data[x_116] = -1; + } + case 4: { + let x_114 : i32 = i_3; + data[x_114] = 0; + } + case 3: { + let x_112 : i32 = i_3; + data[x_112] = 1; + } + case 2: { + let x_110 : i32 = i_3; + data[x_110] = 2; + } + case 1: { + let x_108 : i32 = i_3; + data[x_108] = 3; + } + case 0: { + let x_106 : i32 = i_3; + data[x_106] = 4; + } + default: { + } + } + let x_126 : i32 = i_3; + i_3 = (x_126 + 1); + + continuing { + let x_128 : i32 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_134 : i32 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + let x_137 : i32 = j_1; + let x_138 : i32 = j_1; + let x_140 : i32 = data[x_138]; + temp[x_137] = x_140; + + continuing { + let x_142 : i32 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(); + let x_146 : f32 = gl_FragCoord.y; + if ((i32(x_146) < 30)) { + let x_153 : i32 = data[0]; + grey = (0.5 + (f32(x_153) / 10.0)); + } else { + let x_158 : f32 = gl_FragCoord.y; + if ((i32(x_158) < 60)) { + let x_165 : i32 = data[1]; + grey = (0.5 + (f32(x_165) / 10.0)); + } else { + let x_170 : f32 = gl_FragCoord.y; + if ((i32(x_170) < 90)) { + let x_177 : i32 = data[2]; + grey = (0.5 + (f32(x_177) / 10.0)); + } else { + let x_182 : f32 = gl_FragCoord.y; + if ((i32(x_182) < 120)) { + let x_189 : i32 = data[3]; + grey = (0.5 + (f32(x_189) / 10.0)); + } else { + let x_194 : f32 = gl_FragCoord.y; + if ((i32(x_194) < 150)) { + discard; + } else { + let x_201 : f32 = gl_FragCoord.y; + if ((i32(x_201) < 180)) { + let x_208 : i32 = data[5]; + grey = (0.5 + (f32(x_208) / 10.0)); + } else { + let x_213 : f32 = gl_FragCoord.y; + if ((i32(x_213) < 210)) { + let x_220 : i32 = data[6]; + grey = (0.5 + (f32(x_220) / 10.0)); + } else { + let x_225 : f32 = gl_FragCoord.y; + if ((i32(x_225) < 240)) { + let x_232 : i32 = data[7]; + grey = (0.5 + (f32(x_232) / 10.0)); + } else { + let x_237 : f32 = gl_FragCoord.y; + if ((i32(x_237) < 270)) { + let x_244 : i32 = data[8]; + grey = (0.5 + (f32(x_244) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_248 : f32 = grey; + let x_249 : vec3 = vec3(x_248, x_248, x_248); + x_GLF_color = vec4(x_249.x, x_249.y, x_249.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9cf6e4b4ba --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.hlsl @@ -0,0 +1,372 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_255 = from; + k = x_255; + const int x_256 = from; + i = x_256; + const int x_257 = mid; + j = (x_257 + 1); + while (true) { + int x_283 = 0; + int x_284 = 0; + int x_303 = 0; + int x_304 = 0; + int x_318 = 0; + int x_322 = 0; + int x_337 = 0; + int x_336 = 0; + int x_350 = 0; + int x_349 = 0; + int x_364 = 0; + int x_363 = 0; + int x_285_phi = 0; + int x_305_phi = 0; + int x_326_phi = 0; + int x_338_phi = 0; + int x_351_phi = 0; + int x_365_phi = 0; + if ((1.0f >= 0.0f)) { + } else { + continue; + } + const int x_264 = i; + const int x_265 = mid; + const int x_267 = j; + const int x_268 = to; + bool tint_tmp = (x_264 <= x_265); + if (tint_tmp) { + tint_tmp = (x_267 <= x_268); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_274 = data[i]; + const int x_277 = data[j]; + const bool x_278 = (x_274 < x_277); + if (x_278) { + x_283 = k; + x_285_phi = x_283; + } else { + x_284 = 0; + x_285_phi = x_284; + } + const int x_285 = x_285_phi; + const int x_286 = (x_285 + 1); + if (x_278) { + k = x_286; + const float x_291 = asfloat(x_28[0].x); + if (!((1.0f <= x_291))) { + } else { + continue; + } + } + const float x_295 = asfloat(x_28[0].y); + if ((x_295 >= 0.0f)) { + } else { + continue; + } + const int x_298 = 0; + if (x_278) { + x_303 = i; + x_305_phi = x_303; + } else { + x_304 = 0; + x_305_phi = x_304; + } + const int x_307 = (x_278 ? x_305_phi : x_298); + if (x_278) { + i = (x_307 + 1); + } + const int x_313 = 0; + if (x_278) { + x_318 = data[x_307]; + const float x_320 = asfloat(x_28[0].y); + x_326_phi = x_318; + if (!((0.0f <= x_320))) { + continue; + } + } else { + x_322 = 0; + const float x_324 = asfloat(x_28[0].y); + x_326_phi = x_322; + if (!((x_324 < 0.0f))) { + } else { + continue; + } + } + const int x_326 = x_326_phi; + if (x_278) { + temp[x_285] = (x_278 ? x_326 : x_313); + } + if (x_278) { + x_337 = 0; + x_338_phi = x_337; + } else { + x_336 = k; + x_338_phi = x_336; + } + const int x_338 = x_338_phi; + if (x_278) { + } else { + k = (x_338 + 1); + } + const float x_343 = asfloat(x_28[0].x); + if (!((1.0f <= x_343))) { + } else { + continue; + } + if (x_278) { + x_350 = 0; + x_351_phi = x_350; + } else { + x_349 = j; + x_351_phi = x_349; + } + const int x_355 = (x_278 ? 0 : x_351_phi); + if (x_278) { + } else { + j = (x_355 + 1); + } + if (x_278) { + x_364 = 0; + x_365_phi = x_364; + } else { + x_363 = data[x_355]; + x_365_phi = x_363; + } + const int x_365 = x_365_phi; + if (x_278) { + } else { + temp[x_338] = x_365; + } + } + while (true) { + const int x_374 = i; + const int x_376 = i; + const int x_377 = mid; + bool tint_tmp_1 = (x_374 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_376 <= x_377); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_381 = k; + k = (x_381 + 1); + const int x_383 = i; + i = (x_383 + 1); + const int x_386 = data[x_383]; + temp[x_381] = x_386; + } + const int x_388 = from; + i_1 = x_388; + while (true) { + const int x_393 = i_1; + const int x_394 = to; + if ((x_393 <= x_394)) { + } else { + break; + } + const int x_397 = i_1; + const int x_400 = temp[i_1]; + data[x_397] = x_400; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_88 = asfloat(x_28[0].x); + i_3 = int(x_88); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_137 = j_1; + const int x_140 = data[j_1]; + temp[x_137] = x_140; + } + } + mergeSort_(); + const float x_146 = gl_FragCoord.y; + if ((int(x_146) < 30)) { + const int x_153 = data[0]; + grey = (0.5f + (float(x_153) / 10.0f)); + } else { + const float x_158 = gl_FragCoord.y; + if ((int(x_158) < 60)) { + const int x_165 = data[1]; + grey = (0.5f + (float(x_165) / 10.0f)); + } else { + const float x_170 = gl_FragCoord.y; + if ((int(x_170) < 90)) { + const int x_177 = data[2]; + grey = (0.5f + (float(x_177) / 10.0f)); + } else { + const float x_182 = gl_FragCoord.y; + if ((int(x_182) < 120)) { + const int x_189 = data[3]; + grey = (0.5f + (float(x_189) / 10.0f)); + } else { + const float x_194 = gl_FragCoord.y; + if ((int(x_194) < 150)) { + discard; + } else { + const float x_201 = gl_FragCoord.y; + if ((int(x_201) < 180)) { + const int x_208 = data[5]; + grey = (0.5f + (float(x_208) / 10.0f)); + } else { + const float x_213 = gl_FragCoord.y; + if ((int(x_213) < 210)) { + const int x_220 = data[6]; + grey = (0.5f + (float(x_220) / 10.0f)); + } else { + const float x_225 = gl_FragCoord.y; + if ((int(x_225) < 240)) { + const int x_232 = data[7]; + grey = (0.5f + (float(x_232) / 10.0f)); + } else { + const float x_237 = gl_FragCoord.y; + if ((int(x_237) < 270)) { + const int x_244 = data[8]; + grey = (0.5f + (float(x_244) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_248 = grey; + const float3 x_249 = float3(x_248, x_248, x_248); + x_GLF_color = float4(x_249.x, x_249.y, x_249.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.msl new file mode 100644 index 0000000000..c3a165b3f5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.msl @@ -0,0 +1,421 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(constant buf0& x_28, thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_255 = *(from); + k = x_255; + int const x_256 = *(from); + i = x_256; + int const x_257 = *(mid); + j = (x_257 + 1); + while (true) { + int x_283 = 0; + int x_284 = 0; + int x_303 = 0; + int x_304 = 0; + int x_318 = 0; + int x_322 = 0; + int x_337 = 0; + int x_336 = 0; + int x_350 = 0; + int x_349 = 0; + int x_364 = 0; + int x_363 = 0; + int x_285_phi = 0; + int x_305_phi = 0; + int x_326_phi = 0; + int x_338_phi = 0; + int x_351_phi = 0; + int x_365_phi = 0; + if ((1.0f >= 0.0f)) { + } else { + continue; + } + int const x_264 = i; + int const x_265 = *(mid); + int const x_267 = j; + int const x_268 = *(to); + if (((x_264 <= x_265) && (x_267 <= x_268))) { + } else { + break; + } + int const x_272 = i; + int const x_274 = (*(tint_symbol_5)).arr[x_272]; + int const x_275 = j; + int const x_277 = (*(tint_symbol_5)).arr[x_275]; + bool const x_278 = (x_274 < x_277); + if (x_278) { + x_283 = k; + x_285_phi = x_283; + } else { + x_284 = 0; + x_285_phi = x_284; + } + int const x_285 = x_285_phi; + int const x_286 = (x_285 + 1); + if (x_278) { + k = x_286; + float const x_291 = x_28.injectionSwitch.x; + if (!((1.0f <= x_291))) { + } else { + continue; + } + } + float const x_295 = x_28.injectionSwitch.y; + if ((x_295 >= 0.0f)) { + } else { + continue; + } + int const x_298 = 0; + if (x_278) { + x_303 = i; + x_305_phi = x_303; + } else { + x_304 = 0; + x_305_phi = x_304; + } + int const x_305 = x_305_phi; + int const x_307 = select(x_298, x_305, x_278); + if (x_278) { + i = (x_307 + 1); + } + int const x_313 = 0; + if (x_278) { + x_318 = (*(tint_symbol_5)).arr[x_307]; + float const x_320 = x_28.injectionSwitch.y; + x_326_phi = x_318; + if (!((0.0f <= x_320))) { + continue; + } + } else { + x_322 = 0; + float const x_324 = x_28.injectionSwitch.y; + x_326_phi = x_322; + if (!((x_324 < 0.0f))) { + } else { + continue; + } + } + int const x_326 = x_326_phi; + if (x_278) { + (*(tint_symbol_6)).arr[x_285] = select(x_313, x_326, x_278); + } + if (x_278) { + x_337 = 0; + x_338_phi = x_337; + } else { + x_336 = k; + x_338_phi = x_336; + } + int const x_338 = x_338_phi; + if (x_278) { + } else { + k = (x_338 + 1); + } + float const x_343 = x_28.injectionSwitch.x; + if (!((1.0f <= x_343))) { + } else { + continue; + } + if (x_278) { + x_350 = 0; + x_351_phi = x_350; + } else { + x_349 = j; + x_351_phi = x_349; + } + int const x_351 = x_351_phi; + int const x_353 = 0; + int const x_355 = select(x_351, x_353, x_278); + if (x_278) { + } else { + j = (x_355 + 1); + } + if (x_278) { + x_364 = 0; + x_365_phi = x_364; + } else { + x_363 = (*(tint_symbol_5)).arr[x_355]; + x_365_phi = x_363; + } + int const x_365 = x_365_phi; + if (x_278) { + } else { + (*(tint_symbol_6)).arr[x_338] = x_365; + } + } + while (true) { + int const x_374 = i; + int const x_376 = i; + int const x_377 = *(mid); + if (((x_374 < 10) && (x_376 <= x_377))) { + } else { + break; + } + int const x_381 = k; + k = (x_381 + 1); + int const x_383 = i; + i = (x_383 + 1); + int const x_386 = (*(tint_symbol_5)).arr[x_383]; + (*(tint_symbol_6)).arr[x_381] = x_386; + } + int const x_388 = *(from); + i_1 = x_388; + while (true) { + int const x_393 = i_1; + int const x_394 = *(to); + if ((x_393 <= x_394)) { + } else { + break; + } + int const x_397 = i_1; + int const x_398 = i_1; + int const x_400 = (*(tint_symbol_6)).arr[x_398]; + (*(tint_symbol_5)).arr[x_397] = x_400; + { + int const x_402 = i_1; + i_1 = (x_402 + 1); + } + } + return; +} + +void mergeSort_(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_409 = m; + int const x_410 = high; + if ((x_409 <= x_410)) { + } else { + break; + } + int const x_413 = low; + i_2 = x_413; + while (true) { + int const x_418 = i_2; + int const x_419 = high; + if ((x_418 < x_419)) { + } else { + break; + } + int const x_422 = i_2; + from_1 = x_422; + int const x_423 = i_2; + int const x_424 = m; + mid_1 = ((x_423 + x_424) - 1); + int const x_427 = i_2; + int const x_428 = m; + int const x_432 = high; + to_1 = min(((x_427 + (2 * x_428)) - 1), x_432); + int const x_434 = from_1; + param = x_434; + int const x_435 = mid_1; + param_1 = x_435; + int const x_436 = to_1; + param_2 = x_436; + merge_i1_i1_i1_(x_28, &(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_438 = m; + int const x_440 = i_2; + i_2 = (x_440 + (2 * x_438)); + } + } + { + int const x_442 = m; + m = (2 * x_442); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_88 = x_28.injectionSwitch.x; + i_3 = int(x_88); + while (true) { + int const x_94 = i_3; + switch(x_94) { + case 9: { + int const x_124 = i_3; + (*(tint_symbol_9)).arr[x_124] = -5; + break; + } + case 8: { + int const x_122 = i_3; + (*(tint_symbol_9)).arr[x_122] = -4; + break; + } + case 7: { + int const x_120 = i_3; + (*(tint_symbol_9)).arr[x_120] = -3; + break; + } + case 6: { + int const x_118 = i_3; + (*(tint_symbol_9)).arr[x_118] = -2; + break; + } + case 5: { + int const x_116 = i_3; + (*(tint_symbol_9)).arr[x_116] = -1; + break; + } + case 4: { + int const x_114 = i_3; + (*(tint_symbol_9)).arr[x_114] = 0; + break; + } + case 3: { + int const x_112 = i_3; + (*(tint_symbol_9)).arr[x_112] = 1; + break; + } + case 2: { + int const x_110 = i_3; + (*(tint_symbol_9)).arr[x_110] = 2; + break; + } + case 1: { + int const x_108 = i_3; + (*(tint_symbol_9)).arr[x_108] = 3; + break; + } + case 0: { + int const x_106 = i_3; + (*(tint_symbol_9)).arr[x_106] = 4; + break; + } + default: { + break; + } + } + int const x_126 = i_3; + i_3 = (x_126 + 1); + { + int const x_128 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_134 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + int const x_137 = j_1; + int const x_138 = j_1; + int const x_140 = (*(tint_symbol_9)).arr[x_138]; + (*(tint_symbol_10)).arr[x_137] = x_140; + { + int const x_142 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(x_28, tint_symbol_9, tint_symbol_10); + float const x_146 = (*(tint_symbol_11)).y; + if ((int(x_146) < 30)) { + int const x_153 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_153) / 10.0f)); + } else { + float const x_158 = (*(tint_symbol_11)).y; + if ((int(x_158) < 60)) { + int const x_165 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_165) / 10.0f)); + } else { + float const x_170 = (*(tint_symbol_11)).y; + if ((int(x_170) < 90)) { + int const x_177 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_177) / 10.0f)); + } else { + float const x_182 = (*(tint_symbol_11)).y; + if ((int(x_182) < 120)) { + int const x_189 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_189) / 10.0f)); + } else { + float const x_194 = (*(tint_symbol_11)).y; + if ((int(x_194) < 150)) { + discard_fragment(); + } else { + float const x_201 = (*(tint_symbol_11)).y; + if ((int(x_201) < 180)) { + int const x_208 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_208) / 10.0f)); + } else { + float const x_213 = (*(tint_symbol_11)).y; + if ((int(x_213) < 210)) { + int const x_220 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_220) / 10.0f)); + } else { + float const x_225 = (*(tint_symbol_11)).y; + if ((int(x_225) < 240)) { + int const x_232 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_232) / 10.0f)); + } else { + float const x_237 = (*(tint_symbol_11)).y; + if ((int(x_237) < 270)) { + int const x_244 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_244) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_248 = grey; + float3 const x_249 = float3(x_248, x_248, x_248); + *(tint_symbol_12) = float4(x_249.x, x_249.y, x_249.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..338bca8871 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.spvasm @@ -0,0 +1,862 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 523 +; Schema: 0 + OpCapability Shader + %288 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %x_283 "x_283" + OpName %x_284 "x_284" + OpName %x_303 "x_303" + OpName %x_304 "x_304" + OpName %x_318 "x_318" + OpName %x_322 "x_322" + OpName %x_337 "x_337" + OpName %x_336 "x_336" + OpName %x_350 "x_350" + OpName %x_349 "x_349" + OpName %x_364 "x_364" + OpName %x_363 "x_363" + OpName %x_285_phi "x_285_phi" + OpName %x_305_phi "x_305_phi" + OpName %x_326_phi "x_326_phi" + OpName %x_338_phi "x_338_phi" + OpName %x_351_phi "x_351_phi" + OpName %x_365_phi "x_365_phi" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %int_10 = OpConstant %int 10 + %244 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %312 = OpConstantNull %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %main_out = OpTypeStruct %v4float + %510 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %x_283 = OpVariable %_ptr_Function_int Function %32 + %x_284 = OpVariable %_ptr_Function_int Function %32 + %x_303 = OpVariable %_ptr_Function_int Function %32 + %x_304 = OpVariable %_ptr_Function_int Function %32 + %x_318 = OpVariable %_ptr_Function_int Function %32 + %x_322 = OpVariable %_ptr_Function_int Function %32 + %x_337 = OpVariable %_ptr_Function_int Function %32 + %x_336 = OpVariable %_ptr_Function_int Function %32 + %x_350 = OpVariable %_ptr_Function_int Function %32 + %x_349 = OpVariable %_ptr_Function_int Function %32 + %x_364 = OpVariable %_ptr_Function_int Function %32 + %x_363 = OpVariable %_ptr_Function_int Function %32 + %x_285_phi = OpVariable %_ptr_Function_int Function %32 + %x_305_phi = OpVariable %_ptr_Function_int Function %32 + %x_326_phi = OpVariable %_ptr_Function_int Function %32 + %x_338_phi = OpVariable %_ptr_Function_int Function %32 + %x_351_phi = OpVariable %_ptr_Function_int Function %32 + %x_365_phi = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %68 = OpFOrdGreaterThanEqual %bool %float_1 %float_0 + OpSelectionMerge %70 None + OpBranchConditional %68 %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %46 + %70 = OpLabel + %73 = OpLoad %int %i + %75 = OpLoad %int %mid + %76 = OpLoad %int %j + %78 = OpLoad %int %to + %79 = OpSLessThanEqual %bool %73 %75 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %80 + %81 = OpLabel + %82 = OpSLessThanEqual %bool %76 %78 + OpBranch %80 + %80 = OpLabel + %83 = OpPhi %bool %79 %70 %82 %81 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + OpBranch %84 + %86 = OpLabel + OpBranch %45 + %84 = OpLabel + %87 = OpLoad %int %i + %89 = OpAccessChain %_ptr_Private_int %data %87 + %90 = OpLoad %int %89 + %91 = OpLoad %int %j + %92 = OpAccessChain %_ptr_Private_int %data %91 + %93 = OpLoad %int %92 + %94 = OpSLessThan %bool %90 %93 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %97 + %96 = OpLabel + %98 = OpLoad %int %k + OpStore %x_283 %98 + %99 = OpLoad %int %x_283 + OpStore %x_285_phi %99 + OpBranch %95 + %97 = OpLabel + OpStore %x_284 %int_0 + %101 = OpLoad %int %x_284 + OpStore %x_285_phi %101 + OpBranch %95 + %95 = OpLabel + %102 = OpLoad %int %x_285_phi + %103 = OpIAdd %int %102 %int_1 + OpSelectionMerge %104 None + OpBranchConditional %94 %105 %104 + %105 = OpLabel + OpStore %k %103 + %108 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %109 = OpLoad %float %108 + %111 = OpFOrdLessThanEqual %bool %float_1 %109 + %110 = OpLogicalNot %bool %111 + OpSelectionMerge %112 None + OpBranchConditional %110 %113 %114 + %113 = OpLabel + OpBranch %112 + %114 = OpLabel + OpBranch %46 + %112 = OpLabel + OpBranch %104 + %104 = OpLabel + %116 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %117 = OpLoad %float %116 + %118 = OpFOrdGreaterThanEqual %bool %117 %float_0 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %121 + %120 = OpLabel + OpBranch %119 + %121 = OpLabel + OpBranch %46 + %119 = OpLabel + OpSelectionMerge %122 None + OpBranchConditional %94 %123 %124 + %123 = OpLabel + %125 = OpLoad %int %i + OpStore %x_303 %125 + %126 = OpLoad %int %x_303 + OpStore %x_305_phi %126 + OpBranch %122 + %124 = OpLabel + OpStore %x_304 %int_0 + %127 = OpLoad %int %x_304 + OpStore %x_305_phi %127 + OpBranch %122 + %122 = OpLabel + %128 = OpLoad %int %x_305_phi + %129 = OpSelect %int %94 %128 %int_0 + OpSelectionMerge %130 None + OpBranchConditional %94 %131 %130 + %131 = OpLabel + %132 = OpIAdd %int %129 %int_1 + OpStore %i %132 + OpBranch %130 + %130 = OpLabel + OpSelectionMerge %133 None + OpBranchConditional %94 %134 %135 + %134 = OpLabel + %136 = OpAccessChain %_ptr_Private_int %data %129 + %137 = OpLoad %int %136 + OpStore %x_318 %137 + %138 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %139 = OpLoad %float %138 + %140 = OpLoad %int %x_318 + OpStore %x_326_phi %140 + %142 = OpFOrdLessThanEqual %bool %float_0 %139 + %141 = OpLogicalNot %bool %142 + OpSelectionMerge %143 None + OpBranchConditional %141 %144 %143 + %144 = OpLabel + OpBranch %46 + %143 = OpLabel + OpBranch %133 + %135 = OpLabel + OpStore %x_322 %int_0 + %145 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_1 + %146 = OpLoad %float %145 + %147 = OpLoad %int %x_322 + OpStore %x_326_phi %147 + %149 = OpFOrdLessThan %bool %146 %float_0 + %148 = OpLogicalNot %bool %149 + OpSelectionMerge %150 None + OpBranchConditional %148 %151 %152 + %151 = OpLabel + OpBranch %150 + %152 = OpLabel + OpBranch %46 + %150 = OpLabel + OpBranch %133 + %133 = OpLabel + %153 = OpLoad %int %x_326_phi + OpSelectionMerge %154 None + OpBranchConditional %94 %155 %154 + %155 = OpLabel + %156 = OpAccessChain %_ptr_Private_int %temp %102 + %157 = OpSelect %int %94 %153 %int_0 + OpStore %156 %157 + OpBranch %154 + %154 = OpLabel + OpSelectionMerge %158 None + OpBranchConditional %94 %159 %160 + %159 = OpLabel + OpStore %x_337 %int_0 + %161 = OpLoad %int %x_337 + OpStore %x_338_phi %161 + OpBranch %158 + %160 = OpLabel + %162 = OpLoad %int %k + OpStore %x_336 %162 + %163 = OpLoad %int %x_336 + OpStore %x_338_phi %163 + OpBranch %158 + %158 = OpLabel + %164 = OpLoad %int %x_338_phi + OpSelectionMerge %165 None + OpBranchConditional %94 %166 %167 + %166 = OpLabel + OpBranch %165 + %167 = OpLabel + %168 = OpIAdd %int %164 %int_1 + OpStore %k %168 + OpBranch %165 + %165 = OpLabel + %169 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %170 = OpLoad %float %169 + %172 = OpFOrdLessThanEqual %bool %float_1 %170 + %171 = OpLogicalNot %bool %172 + OpSelectionMerge %173 None + OpBranchConditional %171 %174 %175 + %174 = OpLabel + OpBranch %173 + %175 = OpLabel + OpBranch %46 + %173 = OpLabel + OpSelectionMerge %176 None + OpBranchConditional %94 %177 %178 + %177 = OpLabel + OpStore %x_350 %int_0 + %179 = OpLoad %int %x_350 + OpStore %x_351_phi %179 + OpBranch %176 + %178 = OpLabel + %180 = OpLoad %int %j + OpStore %x_349 %180 + %181 = OpLoad %int %x_349 + OpStore %x_351_phi %181 + OpBranch %176 + %176 = OpLabel + %182 = OpLoad %int %x_351_phi + %183 = OpSelect %int %94 %int_0 %182 + OpSelectionMerge %184 None + OpBranchConditional %94 %185 %186 + %185 = OpLabel + OpBranch %184 + %186 = OpLabel + %187 = OpIAdd %int %183 %int_1 + OpStore %j %187 + OpBranch %184 + %184 = OpLabel + OpSelectionMerge %188 None + OpBranchConditional %94 %189 %190 + %189 = OpLabel + OpStore %x_364 %int_0 + %191 = OpLoad %int %x_364 + OpStore %x_365_phi %191 + OpBranch %188 + %190 = OpLabel + %192 = OpAccessChain %_ptr_Private_int %data %183 + %193 = OpLoad %int %192 + OpStore %x_363 %193 + %194 = OpLoad %int %x_363 + OpStore %x_365_phi %194 + OpBranch %188 + %188 = OpLabel + %195 = OpLoad %int %x_365_phi + OpSelectionMerge %196 None + OpBranchConditional %94 %197 %198 + %197 = OpLabel + OpBranch %196 + %198 = OpLabel + %199 = OpAccessChain %_ptr_Private_int %temp %164 + OpStore %199 %195 + OpBranch %196 + %196 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %200 + %200 = OpLabel + OpLoopMerge %201 %202 None + OpBranch %203 + %203 = OpLabel + %204 = OpLoad %int %i + %205 = OpLoad %int %i + %207 = OpLoad %int %mid + %209 = OpSLessThan %bool %204 %int_10 + OpSelectionMerge %210 None + OpBranchConditional %209 %211 %210 + %211 = OpLabel + %212 = OpSLessThanEqual %bool %205 %207 + OpBranch %210 + %210 = OpLabel + %213 = OpPhi %bool %209 %203 %212 %211 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %201 + %214 = OpLabel + %217 = OpLoad %int %k + %218 = OpIAdd %int %217 %int_1 + OpStore %k %218 + %219 = OpLoad %int %i + %220 = OpIAdd %int %219 %int_1 + OpStore %i %220 + %221 = OpAccessChain %_ptr_Private_int %data %219 + %222 = OpLoad %int %221 + %223 = OpAccessChain %_ptr_Private_int %temp %217 + OpStore %223 %222 + OpBranch %202 + %202 = OpLabel + OpBranch %200 + %201 = OpLabel + %225 = OpLoad %int %from + OpStore %i_1 %225 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %227 %228 None + OpBranch %229 + %229 = OpLabel + %230 = OpLoad %int %i_1 + %232 = OpLoad %int %to + %233 = OpSLessThanEqual %bool %230 %232 + OpSelectionMerge %234 None + OpBranchConditional %233 %235 %236 + %235 = OpLabel + OpBranch %234 + %236 = OpLabel + OpBranch %227 + %234 = OpLabel + %237 = OpLoad %int %i_1 + %238 = OpLoad %int %i_1 + %239 = OpAccessChain %_ptr_Private_int %temp %238 + %240 = OpLoad %int %239 + %241 = OpAccessChain %_ptr_Private_int %data %237 + OpStore %241 %240 + OpBranch %228 + %228 = OpLabel + %242 = OpLoad %int %i_1 + %243 = OpIAdd %int %242 %int_1 + OpStore %i_1 %243 + OpBranch %226 + %227 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %244 + %246 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %258 + %258 = OpLabel + OpLoopMerge %259 %260 None + OpBranch %261 + %261 = OpLabel + %262 = OpLoad %int %m + %263 = OpLoad %int %high + %264 = OpSLessThanEqual %bool %262 %263 + OpSelectionMerge %265 None + OpBranchConditional %264 %266 %267 + %266 = OpLabel + OpBranch %265 + %267 = OpLabel + OpBranch %259 + %265 = OpLabel + %268 = OpLoad %int %low + OpStore %i_2 %268 + OpBranch %269 + %269 = OpLabel + OpLoopMerge %270 %271 None + OpBranch %272 + %272 = OpLabel + %273 = OpLoad %int %i_2 + %274 = OpLoad %int %high + %275 = OpSLessThan %bool %273 %274 + OpSelectionMerge %276 None + OpBranchConditional %275 %277 %278 + %277 = OpLabel + OpBranch %276 + %278 = OpLabel + OpBranch %270 + %276 = OpLabel + %279 = OpLoad %int %i_2 + OpStore %from_1 %279 + %280 = OpLoad %int %i_2 + %281 = OpLoad %int %m + %282 = OpIAdd %int %280 %281 + %283 = OpISub %int %282 %int_1 + OpStore %mid_1 %283 + %284 = OpLoad %int %i_2 + %285 = OpLoad %int %m + %286 = OpLoad %int %high + %290 = OpIMul %int %int_2 %285 + %291 = OpIAdd %int %284 %290 + %292 = OpISub %int %291 %int_1 + %287 = OpExtInst %int %288 SMin %292 %286 + OpStore %to_1 %287 + %293 = OpLoad %int %from_1 + OpStore %param %293 + %294 = OpLoad %int %mid_1 + OpStore %param_1 %294 + %295 = OpLoad %int %to_1 + OpStore %param_2 %295 + %296 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %271 + %271 = OpLabel + %300 = OpLoad %int %m + %301 = OpLoad %int %i_2 + %302 = OpIMul %int %int_2 %300 + %303 = OpIAdd %int %301 %302 + OpStore %i_2 %303 + OpBranch %269 + %270 = OpLabel + OpBranch %260 + %260 = OpLabel + %304 = OpLoad %int %m + %305 = OpIMul %int %int_2 %304 + OpStore %m %305 + OpBranch %258 + %259 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %244 + %307 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %312 + %313 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %314 = OpLoad %float %313 + %315 = OpConvertFToS %int %314 + OpStore %i_3 %315 + OpBranch %316 + %316 = OpLabel + OpLoopMerge %317 %318 None + OpBranch %319 + %319 = OpLabel + %320 = OpLoad %int %i_3 + OpSelectionMerge %321 None + OpSwitch %320 %322 9 %323 8 %324 7 %325 6 %326 5 %327 4 %328 3 %329 2 %330 1 %331 0 %332 + %323 = OpLabel + %333 = OpLoad %int %i_3 + %334 = OpAccessChain %_ptr_Private_int %data %333 + OpStore %334 %int_n5 + OpBranch %321 + %324 = OpLabel + %336 = OpLoad %int %i_3 + %337 = OpAccessChain %_ptr_Private_int %data %336 + OpStore %337 %int_n4 + OpBranch %321 + %325 = OpLabel + %339 = OpLoad %int %i_3 + %340 = OpAccessChain %_ptr_Private_int %data %339 + OpStore %340 %int_n3 + OpBranch %321 + %326 = OpLabel + %342 = OpLoad %int %i_3 + %343 = OpAccessChain %_ptr_Private_int %data %342 + OpStore %343 %int_n2 + OpBranch %321 + %327 = OpLabel + %345 = OpLoad %int %i_3 + %346 = OpAccessChain %_ptr_Private_int %data %345 + OpStore %346 %int_n1 + OpBranch %321 + %328 = OpLabel + %348 = OpLoad %int %i_3 + %349 = OpAccessChain %_ptr_Private_int %data %348 + OpStore %349 %int_0 + OpBranch %321 + %329 = OpLabel + %350 = OpLoad %int %i_3 + %351 = OpAccessChain %_ptr_Private_int %data %350 + OpStore %351 %int_1 + OpBranch %321 + %330 = OpLabel + %352 = OpLoad %int %i_3 + %353 = OpAccessChain %_ptr_Private_int %data %352 + OpStore %353 %int_2 + OpBranch %321 + %331 = OpLabel + %354 = OpLoad %int %i_3 + %355 = OpAccessChain %_ptr_Private_int %data %354 + OpStore %355 %int_3 + OpBranch %321 + %332 = OpLabel + %357 = OpLoad %int %i_3 + %358 = OpAccessChain %_ptr_Private_int %data %357 + OpStore %358 %int_4 + OpBranch %321 + %322 = OpLabel + OpBranch %321 + %321 = OpLabel + %360 = OpLoad %int %i_3 + %361 = OpIAdd %int %360 %int_1 + OpStore %i_3 %361 + OpBranch %318 + %318 = OpLabel + %362 = OpLoad %int %i_3 + %363 = OpSLessThan %bool %362 %int_10 + OpSelectionMerge %364 None + OpBranchConditional %363 %365 %366 + %365 = OpLabel + OpBranch %364 + %366 = OpLabel + OpBranch %317 + %364 = OpLabel + OpBranch %316 + %317 = OpLabel + OpStore %j_1 %int_0 + OpBranch %367 + %367 = OpLabel + OpLoopMerge %368 %369 None + OpBranch %370 + %370 = OpLabel + %371 = OpLoad %int %j_1 + %372 = OpSLessThan %bool %371 %int_10 + OpSelectionMerge %373 None + OpBranchConditional %372 %374 %375 + %374 = OpLabel + OpBranch %373 + %375 = OpLabel + OpBranch %368 + %373 = OpLabel + %376 = OpLoad %int %j_1 + %377 = OpLoad %int %j_1 + %378 = OpAccessChain %_ptr_Private_int %data %377 + %379 = OpLoad %int %378 + %380 = OpAccessChain %_ptr_Private_int %temp %376 + OpStore %380 %379 + OpBranch %369 + %369 = OpLabel + %381 = OpLoad %int %j_1 + %382 = OpIAdd %int %381 %int_1 + OpStore %j_1 %382 + OpBranch %367 + %368 = OpLabel + %383 = OpFunctionCall %void %mergeSort_ + %385 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %386 = OpLoad %float %385 + %387 = OpConvertFToS %int %386 + %389 = OpSLessThan %bool %387 %int_30 + OpSelectionMerge %390 None + OpBranchConditional %389 %391 %392 + %391 = OpLabel + %393 = OpAccessChain %_ptr_Private_int %data %int_0 + %394 = OpLoad %int %393 + %396 = OpConvertSToF %float %394 + %398 = OpFDiv %float %396 %float_10 + %399 = OpFAdd %float %float_0_5 %398 + OpStore %grey %399 + OpBranch %390 + %392 = OpLabel + %400 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %401 = OpLoad %float %400 + %402 = OpConvertFToS %int %401 + %404 = OpSLessThan %bool %402 %int_60 + OpSelectionMerge %405 None + OpBranchConditional %404 %406 %407 + %406 = OpLabel + %408 = OpAccessChain %_ptr_Private_int %data %int_1 + %409 = OpLoad %int %408 + %410 = OpConvertSToF %float %409 + %411 = OpFDiv %float %410 %float_10 + %412 = OpFAdd %float %float_0_5 %411 + OpStore %grey %412 + OpBranch %405 + %407 = OpLabel + %413 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %414 = OpLoad %float %413 + %415 = OpConvertFToS %int %414 + %417 = OpSLessThan %bool %415 %int_90 + OpSelectionMerge %418 None + OpBranchConditional %417 %419 %420 + %419 = OpLabel + %421 = OpAccessChain %_ptr_Private_int %data %int_2 + %422 = OpLoad %int %421 + %423 = OpConvertSToF %float %422 + %424 = OpFDiv %float %423 %float_10 + %425 = OpFAdd %float %float_0_5 %424 + OpStore %grey %425 + OpBranch %418 + %420 = OpLabel + %426 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %427 = OpLoad %float %426 + %428 = OpConvertFToS %int %427 + %430 = OpSLessThan %bool %428 %int_120 + OpSelectionMerge %431 None + OpBranchConditional %430 %432 %433 + %432 = OpLabel + %434 = OpAccessChain %_ptr_Private_int %data %int_3 + %435 = OpLoad %int %434 + %436 = OpConvertSToF %float %435 + %437 = OpFDiv %float %436 %float_10 + %438 = OpFAdd %float %float_0_5 %437 + OpStore %grey %438 + OpBranch %431 + %433 = OpLabel + %439 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %440 = OpLoad %float %439 + %441 = OpConvertFToS %int %440 + %443 = OpSLessThan %bool %441 %int_150 + OpSelectionMerge %444 None + OpBranchConditional %443 %445 %446 + %445 = OpLabel + OpKill + %446 = OpLabel + %447 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %448 = OpLoad %float %447 + %449 = OpConvertFToS %int %448 + %451 = OpSLessThan %bool %449 %int_180 + OpSelectionMerge %452 None + OpBranchConditional %451 %453 %454 + %453 = OpLabel + %456 = OpAccessChain %_ptr_Private_int %data %int_5 + %457 = OpLoad %int %456 + %458 = OpConvertSToF %float %457 + %459 = OpFDiv %float %458 %float_10 + %460 = OpFAdd %float %float_0_5 %459 + OpStore %grey %460 + OpBranch %452 + %454 = OpLabel + %461 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %462 = OpLoad %float %461 + %463 = OpConvertFToS %int %462 + %465 = OpSLessThan %bool %463 %int_210 + OpSelectionMerge %466 None + OpBranchConditional %465 %467 %468 + %467 = OpLabel + %470 = OpAccessChain %_ptr_Private_int %data %int_6 + %471 = OpLoad %int %470 + %472 = OpConvertSToF %float %471 + %473 = OpFDiv %float %472 %float_10 + %474 = OpFAdd %float %float_0_5 %473 + OpStore %grey %474 + OpBranch %466 + %468 = OpLabel + %475 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %476 = OpLoad %float %475 + %477 = OpConvertFToS %int %476 + %479 = OpSLessThan %bool %477 %int_240 + OpSelectionMerge %480 None + OpBranchConditional %479 %481 %482 + %481 = OpLabel + %484 = OpAccessChain %_ptr_Private_int %data %int_7 + %485 = OpLoad %int %484 + %486 = OpConvertSToF %float %485 + %487 = OpFDiv %float %486 %float_10 + %488 = OpFAdd %float %float_0_5 %487 + OpStore %grey %488 + OpBranch %480 + %482 = OpLabel + %489 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %490 = OpLoad %float %489 + %491 = OpConvertFToS %int %490 + %493 = OpSLessThan %bool %491 %int_270 + OpSelectionMerge %494 None + OpBranchConditional %493 %495 %496 + %495 = OpLabel + %498 = OpAccessChain %_ptr_Private_int %data %int_8 + %499 = OpLoad %int %498 + %500 = OpConvertSToF %float %499 + %501 = OpFDiv %float %500 %float_10 + %502 = OpFAdd %float %float_0_5 %501 + OpStore %grey %502 + OpBranch %494 + %496 = OpLabel + OpKill + %494 = OpLabel + OpBranch %480 + %480 = OpLabel + OpBranch %466 + %466 = OpLabel + OpBranch %452 + %452 = OpLabel + OpBranch %444 + %444 = OpLabel + OpBranch %431 + %431 = OpLabel + OpBranch %418 + %418 = OpLabel + OpBranch %405 + %405 = OpLabel + OpBranch %390 + %390 = OpLabel + %503 = OpLoad %float %grey + %505 = OpCompositeConstruct %v3float %503 %503 %503 + %506 = OpCompositeExtract %float %505 0 + %507 = OpCompositeExtract %float %505 1 + %508 = OpCompositeExtract %float %505 2 + %509 = OpCompositeConstruct %v4float %506 %507 %508 %float_1 + OpStore %x_GLF_color %509 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %510 +%tint_symbol_1 = OpFunctionParameter %main_out + %514 = OpLabel + %515 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %515 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %244 + %517 = OpLabel + %518 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %518 + %519 = OpFunctionCall %void %main_1 + %521 = OpLoad %v4float %x_GLF_color + %522 = OpCompositeConstruct %main_out %521 + %520 = OpFunctionCall %void %tint_symbol_3 %522 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 318[%318] is not post dominated by the back-edge block 364[%364] + %364 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..e349c0c6e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatten-selection-dead-continues/2-opt.wgsl.expected.wgsl @@ -0,0 +1,413 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_255 : i32 = *(from); + k = x_255; + let x_256 : i32 = *(from); + i = x_256; + let x_257 : i32 = *(mid); + j = (x_257 + 1); + loop { + var x_283 : i32; + var x_284 : i32; + var x_303 : i32; + var x_304 : i32; + var x_318 : i32; + var x_322 : i32; + var x_337 : i32; + var x_336 : i32; + var x_350 : i32; + var x_349 : i32; + var x_364 : i32; + var x_363 : i32; + var x_285_phi : i32; + var x_305_phi : i32; + var x_326_phi : i32; + var x_338_phi : i32; + var x_351_phi : i32; + var x_365_phi : i32; + if ((1.0 >= 0.0)) { + } else { + continue; + } + let x_264 : i32 = i; + let x_265 : i32 = *(mid); + let x_267 : i32 = j; + let x_268 : i32 = *(to); + if (((x_264 <= x_265) && (x_267 <= x_268))) { + } else { + break; + } + let x_272 : i32 = i; + let x_274 : i32 = data[x_272]; + let x_275 : i32 = j; + let x_277 : i32 = data[x_275]; + let x_278 : bool = (x_274 < x_277); + if (x_278) { + x_283 = k; + x_285_phi = x_283; + } else { + x_284 = 0; + x_285_phi = x_284; + } + let x_285 : i32 = x_285_phi; + let x_286 : i32 = (x_285 + 1); + if (x_278) { + k = x_286; + let x_291 : f32 = x_28.injectionSwitch.x; + if (!((1.0 <= x_291))) { + } else { + continue; + } + } + let x_295 : f32 = x_28.injectionSwitch.y; + if ((x_295 >= 0.0)) { + } else { + continue; + } + let x_298 : i32 = 0; + if (x_278) { + x_303 = i; + x_305_phi = x_303; + } else { + x_304 = 0; + x_305_phi = x_304; + } + let x_305 : i32 = x_305_phi; + let x_307 : i32 = select(x_298, x_305, x_278); + if (x_278) { + i = (x_307 + 1); + } + let x_313 : i32 = 0; + if (x_278) { + x_318 = data[x_307]; + let x_320 : f32 = x_28.injectionSwitch.y; + x_326_phi = x_318; + if (!((0.0 <= x_320))) { + continue; + } + } else { + x_322 = 0; + let x_324 : f32 = x_28.injectionSwitch.y; + x_326_phi = x_322; + if (!((x_324 < 0.0))) { + } else { + continue; + } + } + let x_326 : i32 = x_326_phi; + if (x_278) { + temp[x_285] = select(x_313, x_326, x_278); + } + if (x_278) { + x_337 = 0; + x_338_phi = x_337; + } else { + x_336 = k; + x_338_phi = x_336; + } + let x_338 : i32 = x_338_phi; + if (x_278) { + } else { + k = (x_338 + 1); + } + let x_343 : f32 = x_28.injectionSwitch.x; + if (!((1.0 <= x_343))) { + } else { + continue; + } + if (x_278) { + x_350 = 0; + x_351_phi = x_350; + } else { + x_349 = j; + x_351_phi = x_349; + } + let x_351 : i32 = x_351_phi; + let x_353 : i32 = 0; + let x_355 : i32 = select(x_351, x_353, x_278); + if (x_278) { + } else { + j = (x_355 + 1); + } + if (x_278) { + x_364 = 0; + x_365_phi = x_364; + } else { + x_363 = data[x_355]; + x_365_phi = x_363; + } + let x_365 : i32 = x_365_phi; + if (x_278) { + } else { + temp[x_338] = x_365; + } + } + loop { + let x_374 : i32 = i; + let x_376 : i32 = i; + let x_377 : i32 = *(mid); + if (((x_374 < 10) && (x_376 <= x_377))) { + } else { + break; + } + let x_381 : i32 = k; + k = (x_381 + 1); + let x_383 : i32 = i; + i = (x_383 + 1); + let x_386 : i32 = data[x_383]; + temp[x_381] = x_386; + } + let x_388 : i32 = *(from); + i_1 = x_388; + loop { + let x_393 : i32 = i_1; + let x_394 : i32 = *(to); + if ((x_393 <= x_394)) { + } else { + break; + } + let x_397 : i32 = i_1; + let x_398 : i32 = i_1; + let x_400 : i32 = temp[x_398]; + data[x_397] = x_400; + + continuing { + let x_402 : i32 = i_1; + i_1 = (x_402 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_409 : i32 = m; + let x_410 : i32 = high; + if ((x_409 <= x_410)) { + } else { + break; + } + let x_413 : i32 = low; + i_2 = x_413; + loop { + let x_418 : i32 = i_2; + let x_419 : i32 = high; + if ((x_418 < x_419)) { + } else { + break; + } + let x_422 : i32 = i_2; + from_1 = x_422; + let x_423 : i32 = i_2; + let x_424 : i32 = m; + mid_1 = ((x_423 + x_424) - 1); + let x_427 : i32 = i_2; + let x_428 : i32 = m; + let x_432 : i32 = high; + to_1 = min(((x_427 + (2 * x_428)) - 1), x_432); + let x_434 : i32 = from_1; + param = x_434; + let x_435 : i32 = mid_1; + param_1 = x_435; + let x_436 : i32 = to_1; + param_2 = x_436; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_438 : i32 = m; + let x_440 : i32 = i_2; + i_2 = (x_440 + (2 * x_438)); + } + } + + continuing { + let x_442 : i32 = m; + m = (2 * x_442); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_88 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_88); + loop { + let x_94 : i32 = i_3; + switch(x_94) { + case 9: { + let x_124 : i32 = i_3; + data[x_124] = -5; + } + case 8: { + let x_122 : i32 = i_3; + data[x_122] = -4; + } + case 7: { + let x_120 : i32 = i_3; + data[x_120] = -3; + } + case 6: { + let x_118 : i32 = i_3; + data[x_118] = -2; + } + case 5: { + let x_116 : i32 = i_3; + data[x_116] = -1; + } + case 4: { + let x_114 : i32 = i_3; + data[x_114] = 0; + } + case 3: { + let x_112 : i32 = i_3; + data[x_112] = 1; + } + case 2: { + let x_110 : i32 = i_3; + data[x_110] = 2; + } + case 1: { + let x_108 : i32 = i_3; + data[x_108] = 3; + } + case 0: { + let x_106 : i32 = i_3; + data[x_106] = 4; + } + default: { + } + } + let x_126 : i32 = i_3; + i_3 = (x_126 + 1); + + continuing { + let x_128 : i32 = i_3; + if ((x_128 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_134 : i32 = j_1; + if ((x_134 < 10)) { + } else { + break; + } + let x_137 : i32 = j_1; + let x_138 : i32 = j_1; + let x_140 : i32 = data[x_138]; + temp[x_137] = x_140; + + continuing { + let x_142 : i32 = j_1; + j_1 = (x_142 + 1); + } + } + mergeSort_(); + let x_146 : f32 = gl_FragCoord.y; + if ((i32(x_146) < 30)) { + let x_153 : i32 = data[0]; + grey = (0.5 + (f32(x_153) / 10.0)); + } else { + let x_158 : f32 = gl_FragCoord.y; + if ((i32(x_158) < 60)) { + let x_165 : i32 = data[1]; + grey = (0.5 + (f32(x_165) / 10.0)); + } else { + let x_170 : f32 = gl_FragCoord.y; + if ((i32(x_170) < 90)) { + let x_177 : i32 = data[2]; + grey = (0.5 + (f32(x_177) / 10.0)); + } else { + let x_182 : f32 = gl_FragCoord.y; + if ((i32(x_182) < 120)) { + let x_189 : i32 = data[3]; + grey = (0.5 + (f32(x_189) / 10.0)); + } else { + let x_194 : f32 = gl_FragCoord.y; + if ((i32(x_194) < 150)) { + discard; + } else { + let x_201 : f32 = gl_FragCoord.y; + if ((i32(x_201) < 180)) { + let x_208 : i32 = data[5]; + grey = (0.5 + (f32(x_208) / 10.0)); + } else { + let x_213 : f32 = gl_FragCoord.y; + if ((i32(x_213) < 210)) { + let x_220 : i32 = data[6]; + grey = (0.5 + (f32(x_220) / 10.0)); + } else { + let x_225 : f32 = gl_FragCoord.y; + if ((i32(x_225) < 240)) { + let x_232 : i32 = data[7]; + grey = (0.5 + (f32(x_232) / 10.0)); + } else { + let x_237 : f32 = gl_FragCoord.y; + if ((i32(x_237) < 270)) { + let x_244 : i32 = data[8]; + grey = (0.5 + (f32(x_244) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_248 : f32 = grey; + let x_249 : vec3 = vec3(x_248, x_248, x_248); + x_GLF_color = vec4(x_249.x, x_249.y, x_249.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm new file mode 100644 index 0000000000..f35b7eb69a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm @@ -0,0 +1,634 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %merge_i1_i1_i1_ "merge(i1;i1;i1;" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %mergeSort_ "mergeSort(" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %temp "temp" + OpName %i_0 "i" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_1 "i" + OpName %from_0 "from" + OpName %mid_0 "mid" + OpName %to_0 "to" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %i_2 "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %j_0 "j" + OpName %gl_FragCoord "gl_FragCoord" + OpName %grey "grey" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %32 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private + %int_10 = OpConstant %int 10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int_30 = OpConstant %int 30 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %int_0_0 = OpConstant %int 0 + %83 = OpConstantComposite %_arr_int_uint_10 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 + %main = OpFunction %void None %32 + %84 = OpLabel + %85 = OpVariable %_ptr_Function_int Function + %86 = OpVariable %_ptr_Function_int Function + %87 = OpVariable %_ptr_Function_int Function + %88 = OpVariable %_ptr_Function_int Function + %89 = OpVariable %_ptr_Function_int Function + %90 = OpVariable %_ptr_Function_int Function + %91 = OpVariable %_ptr_Function_int Function + %92 = OpVariable %_ptr_Function_int Function + %93 = OpVariable %_ptr_Function_int Function + %94 = OpVariable %_ptr_Function_int Function + %i_2 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %grey = OpVariable %_ptr_Function_float Function + %95 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %96 = OpLoad %float %95 + %97 = OpConvertFToS %int %96 + OpStore %i_2 %97 + OpBranch %98 + %98 = OpLabel + OpLoopMerge %99 %100 None + OpBranch %101 + %101 = OpLabel + %102 = OpLoad %int %i_2 + OpSelectionMerge %103 None + OpSwitch %102 %103 0 %104 1 %105 2 %106 3 %107 4 %108 5 %109 6 %110 7 %111 8 %112 9 %113 + %104 = OpLabel + %114 = OpLoad %int %i_2 + %115 = OpAccessChain %_ptr_Private_int %data %114 + OpStore %115 %int_4 + OpBranch %103 + %105 = OpLabel + %116 = OpLoad %int %i_2 + %117 = OpAccessChain %_ptr_Private_int %data %116 + OpStore %117 %int_3 + OpBranch %103 + %106 = OpLabel + %118 = OpLoad %int %i_2 + %119 = OpAccessChain %_ptr_Private_int %data %118 + OpStore %119 %int_2 + OpBranch %103 + %107 = OpLabel + %120 = OpLoad %int %i_2 + %121 = OpAccessChain %_ptr_Private_int %data %120 + OpStore %121 %int_1 + OpBranch %103 + %108 = OpLabel + %122 = OpLoad %int %i_2 + %123 = OpAccessChain %_ptr_Private_int %data %122 + OpStore %123 %int_0 + OpBranch %103 + %109 = OpLabel + %124 = OpLoad %int %i_2 + %125 = OpAccessChain %_ptr_Private_int %data %124 + OpStore %125 %int_n1 + OpBranch %103 + %110 = OpLabel + %126 = OpLoad %int %i_2 + %127 = OpAccessChain %_ptr_Private_int %data %126 + OpStore %127 %int_n2 + OpBranch %103 + %111 = OpLabel + %128 = OpLoad %int %i_2 + %129 = OpAccessChain %_ptr_Private_int %data %128 + OpStore %129 %int_n3 + OpBranch %103 + %112 = OpLabel + %130 = OpLoad %int %i_2 + %131 = OpAccessChain %_ptr_Private_int %data %130 + OpStore %131 %int_n4 + OpBranch %103 + %113 = OpLabel + %132 = OpLoad %int %i_2 + %133 = OpAccessChain %_ptr_Private_int %data %132 + OpStore %133 %int_n5 + OpBranch %103 + %103 = OpLabel + %134 = OpLoad %int %i_2 + %135 = OpIAdd %int %134 %int_1 + OpStore %i_2 %135 + OpBranch %100 + %100 = OpLabel + %136 = OpLoad %int %i_2 + %137 = OpSLessThan %bool %136 %int_10 + OpBranchConditional %137 %98 %99 + %99 = OpLabel + OpStore %j_0 %int_0 + OpBranch %138 + %138 = OpLabel + OpLoopMerge %139 %140 None + OpBranch %141 + %141 = OpLabel + %142 = OpLoad %int %j_0 + %143 = OpSLessThan %bool %142 %int_10 + OpBranchConditional %143 %144 %139 + %144 = OpLabel + %145 = OpLoad %int %j_0 + %146 = OpLoad %int %j_0 + %147 = OpAccessChain %_ptr_Private_int %data %146 + %148 = OpLoad %int %147 + %149 = OpAccessChain %_ptr_Private_int %temp %145 + OpStore %149 %148 + OpBranch %140 + %140 = OpLabel + %150 = OpLoad %int %j_0 + %151 = OpIAdd %int %150 %int_1 + OpStore %j_0 %151 + OpBranch %138 + %139 = OpLabel + OpStore %94 %int_0 + OpStore %93 %int_9 + OpStore %92 %int_1 + OpBranch %152 + %152 = OpLabel + OpLoopMerge %153 %154 None + OpBranch %155 + %155 = OpLabel + %156 = OpLoad %int %92 + %157 = OpLoad %int %93 + %158 = OpSLessThanEqual %bool %156 %157 + OpBranchConditional %158 %159 %153 + %159 = OpLabel + %160 = OpLoad %int %94 + OpStore %91 %160 + OpBranch %161 + %161 = OpLabel + OpLoopMerge %162 %163 None + OpBranch %164 + %164 = OpLabel + %165 = OpLoad %int %91 + %166 = OpLoad %int %93 + %167 = OpSLessThan %bool %165 %166 + OpBranchConditional %167 %168 %162 + %168 = OpLabel + %169 = OpLoad %int %91 + OpStore %90 %169 + %170 = OpLoad %int %91 + %171 = OpLoad %int %92 + %172 = OpIAdd %int %170 %171 + %173 = OpLoad %_arr_int_uint_10 %data + OpStore %data %83 + OpStore %data %173 + %174 = OpISub %int %172 %int_1 + OpStore %89 %174 + %175 = OpLoad %int %91 + %176 = OpLoad %int %92 + %177 = OpIMul %int %int_2 %176 + %178 = OpIAdd %int %175 %177 + %179 = OpISub %int %178 %int_1 + %180 = OpLoad %int %93 + %181 = OpExtInst %int %1 SMin %179 %180 + OpStore %88 %181 + %182 = OpLoad %int %90 + OpStore %87 %182 + %183 = OpLoad %int %89 + OpStore %86 %183 + %184 = OpLoad %int %88 + OpStore %85 %184 + %185 = OpFunctionCall %void %merge_i1_i1_i1_ %87 %86 %85 + OpBranch %163 + %163 = OpLabel + %186 = OpLoad %int %92 + %187 = OpIMul %int %int_2 %186 + %188 = OpLoad %int %91 + %189 = OpIAdd %int %188 %187 + OpStore %91 %189 + OpBranch %161 + %162 = OpLabel + OpBranch %154 + %154 = OpLabel + %190 = OpLoad %int %92 + %191 = OpIMul %int %int_2 %190 + OpStore %92 %191 + OpBranch %152 + %153 = OpLabel + OpBranch %192 + %192 = OpLabel + %193 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %194 = OpLoad %float %193 + %195 = OpConvertFToS %int %194 + %196 = OpSLessThan %bool %195 %int_30 + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %199 + %198 = OpLabel + %200 = OpAccessChain %_ptr_Private_int %data %int_0 + %201 = OpLoad %int %200 + %202 = OpConvertSToF %float %201 + %203 = OpFDiv %float %202 %float_10 + %204 = OpFAdd %float %float_0_5 %203 + OpStore %grey %204 + OpBranch %197 + %199 = OpLabel + %205 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %206 = OpLoad %float %205 + %207 = OpConvertFToS %int %206 + %208 = OpSLessThan %bool %207 %int_60 + OpSelectionMerge %209 None + OpBranchConditional %208 %210 %211 + %210 = OpLabel + %212 = OpAccessChain %_ptr_Private_int %data %int_1 + %213 = OpLoad %int %212 + %214 = OpConvertSToF %float %213 + %215 = OpFDiv %float %214 %float_10 + %216 = OpFAdd %float %float_0_5 %215 + OpStore %grey %216 + OpBranch %209 + %211 = OpLabel + %217 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %218 = OpLoad %float %217 + %219 = OpConvertFToS %int %218 + %220 = OpSLessThan %bool %219 %int_90 + OpSelectionMerge %221 None + OpBranchConditional %220 %222 %223 + %222 = OpLabel + %224 = OpAccessChain %_ptr_Private_int %data %int_2 + %225 = OpLoad %int %224 + %226 = OpConvertSToF %float %225 + %227 = OpFDiv %float %226 %float_10 + %228 = OpFAdd %float %float_0_5 %227 + OpStore %grey %228 + OpBranch %221 + %223 = OpLabel + %229 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %230 = OpLoad %float %229 + %231 = OpConvertFToS %int %230 + %232 = OpSLessThan %bool %231 %int_120 + OpSelectionMerge %233 None + OpBranchConditional %232 %234 %235 + %234 = OpLabel + %236 = OpAccessChain %_ptr_Private_int %data %int_3 + %237 = OpLoad %int %236 + %238 = OpConvertSToF %float %237 + %239 = OpFDiv %float %238 %float_10 + %240 = OpFAdd %float %float_0_5 %239 + OpStore %grey %240 + OpBranch %233 + %235 = OpLabel + %241 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %242 = OpLoad %float %241 + %243 = OpConvertFToS %int %242 + %244 = OpSLessThan %bool %243 %int_150 + OpSelectionMerge %245 None + OpBranchConditional %244 %246 %247 + %246 = OpLabel + OpKill + %247 = OpLabel + %248 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %249 = OpLoad %float %248 + %250 = OpConvertFToS %int %249 + %251 = OpSLessThan %bool %250 %int_180 + OpSelectionMerge %252 None + OpBranchConditional %251 %253 %254 + %253 = OpLabel + %255 = OpAccessChain %_ptr_Private_int %data %int_5 + %256 = OpLoad %int %255 + %257 = OpConvertSToF %float %256 + %258 = OpFDiv %float %257 %float_10 + %259 = OpFAdd %float %float_0_5 %258 + OpStore %grey %259 + OpBranch %252 + %254 = OpLabel + %260 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %261 = OpLoad %float %260 + %262 = OpConvertFToS %int %261 + %263 = OpSLessThan %bool %262 %int_210 + OpSelectionMerge %264 None + OpBranchConditional %263 %265 %266 + %265 = OpLabel + %267 = OpAccessChain %_ptr_Private_int %data %int_6 + %268 = OpLoad %int %267 + %269 = OpConvertSToF %float %268 + %270 = OpFDiv %float %269 %float_10 + %271 = OpFAdd %float %float_0_5 %270 + OpStore %grey %271 + OpBranch %264 + %266 = OpLabel + %272 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %273 = OpLoad %float %272 + %274 = OpConvertFToS %int %273 + %275 = OpSLessThan %bool %274 %int_240 + OpSelectionMerge %276 None + OpBranchConditional %275 %277 %278 + %277 = OpLabel + %279 = OpAccessChain %_ptr_Private_int %data %int_7 + %280 = OpLoad %int %279 + %281 = OpConvertSToF %float %280 + %282 = OpFDiv %float %281 %float_10 + %283 = OpFAdd %float %float_0_5 %282 + OpStore %grey %283 + OpBranch %276 + %278 = OpLabel + %284 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %285 = OpLoad %float %284 + %286 = OpConvertFToS %int %285 + %287 = OpSLessThan %bool %286 %int_270 + OpSelectionMerge %288 None + OpBranchConditional %287 %289 %290 + %289 = OpLabel + %291 = OpAccessChain %_ptr_Private_int %data %int_8 + %292 = OpLoad %int %291 + %293 = OpConvertSToF %float %292 + %294 = OpFDiv %float %293 %float_10 + %295 = OpFAdd %float %float_0_5 %294 + OpStore %grey %295 + OpBranch %288 + %290 = OpLabel + OpKill + %288 = OpLabel + OpBranch %276 + %276 = OpLabel + OpBranch %264 + %264 = OpLabel + OpBranch %252 + %252 = OpLabel + OpBranch %245 + %245 = OpLabel + OpBranch %233 + %233 = OpLabel + OpBranch %221 + %221 = OpLabel + OpBranch %209 + %209 = OpLabel + OpBranch %197 + %197 = OpLabel + %296 = OpLoad %float %grey + %297 = OpCompositeConstruct %v3float %296 %296 %296 + %298 = OpCompositeExtract %float %297 0 + %299 = OpCompositeExtract %float %297 1 + %300 = OpCompositeExtract %float %297 2 + %301 = OpCompositeConstruct %v4float %298 %299 %300 %float_1 + OpStore %_GLF_color %301 + OpReturn + OpFunctionEnd +%merge_i1_i1_i1_ = OpFunction %void None %35 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %302 = OpLabel + %k = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %303 = OpLoad %int %from + OpStore %k %303 + %304 = OpLoad %int %from + OpStore %i %304 + %305 = OpLoad %int %mid + %306 = OpIAdd %int %305 %int_1 + OpStore %j %306 + OpBranch %307 + %307 = OpLabel + OpLoopMerge %308 %309 None + OpBranch %310 + %310 = OpLabel + %311 = OpLoad %int %i + %312 = OpLoad %int %mid + %313 = OpSLessThanEqual %bool %311 %312 + %314 = OpLoad %int %j + %315 = OpLoad %int %to + %316 = OpSLessThanEqual %bool %314 %315 + %317 = OpLogicalAnd %bool %313 %316 + OpBranchConditional %317 %318 %308 + %318 = OpLabel + %319 = OpLoad %int %i + %320 = OpAccessChain %_ptr_Private_int %data %319 + %321 = OpLoad %int %320 + %322 = OpLoad %int %j + %323 = OpAccessChain %_ptr_Private_int %data %322 + %324 = OpLoad %int %323 + %325 = OpSLessThan %bool %321 %324 + OpSelectionMerge %326 None + OpBranchConditional %325 %327 %328 + %327 = OpLabel + %329 = OpLoad %int %k + %330 = OpIAdd %int %329 %int_1 + OpStore %k %330 + %331 = OpLoad %int %i + %332 = OpIAdd %int %331 %int_1 + OpStore %i %332 + %333 = OpAccessChain %_ptr_Private_int %data %331 + %334 = OpLoad %int %333 + %335 = OpAccessChain %_ptr_Private_int %temp %329 + OpStore %335 %334 + OpBranch %326 + %328 = OpLabel + %336 = OpLoad %int %k + %337 = OpIAdd %int %336 %int_1 + OpStore %k %337 + %338 = OpLoad %int %j + %339 = OpIAdd %int %338 %int_1 + OpStore %j %339 + %340 = OpAccessChain %_ptr_Private_int %data %338 + %341 = OpLoad %int %340 + %342 = OpAccessChain %_ptr_Private_int %temp %336 + OpStore %342 %341 + OpBranch %326 + %326 = OpLabel + OpBranch %309 + %309 = OpLabel + OpBranch %307 + %308 = OpLabel + OpBranch %343 + %343 = OpLabel + OpLoopMerge %344 %345 None + OpBranch %346 + %346 = OpLabel + %347 = OpLoad %int %i + %348 = OpSLessThan %bool %347 %int_10 + %349 = OpLoad %int %i + %350 = OpLoad %int %mid + %351 = OpSLessThanEqual %bool %349 %350 + %352 = OpLogicalAnd %bool %348 %351 + OpBranchConditional %352 %353 %344 + %353 = OpLabel + %354 = OpLoad %int %k + %355 = OpIAdd %int %354 %int_1 + OpStore %k %355 + %356 = OpLoad %int %i + %357 = OpIAdd %int %356 %int_1 + OpStore %i %357 + %358 = OpAccessChain %_ptr_Private_int %data %356 + %359 = OpLoad %int %358 + %360 = OpAccessChain %_ptr_Private_int %temp %354 + OpStore %360 %359 + OpBranch %345 + %345 = OpLabel + OpBranch %343 + %344 = OpLabel + %361 = OpLoad %int %from + OpStore %i_0 %361 + OpBranch %362 + %362 = OpLabel + OpLoopMerge %363 %364 None + OpBranch %365 + %365 = OpLabel + %366 = OpLoad %int %i_0 + %367 = OpLoad %int %to + %368 = OpSLessThanEqual %bool %366 %367 + OpBranchConditional %368 %369 %363 + %369 = OpLabel + %370 = OpLoad %int %i_0 + %371 = OpLoad %int %i_0 + %372 = OpAccessChain %_ptr_Private_int %temp %371 + %373 = OpLoad %int %372 + %374 = OpAccessChain %_ptr_Private_int %data %370 + OpStore %374 %373 + OpBranch %364 + %364 = OpLabel + %375 = OpLoad %int %i_0 + %376 = OpIAdd %int %375 %int_1 + OpStore %i_0 %376 + OpBranch %362 + %363 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %32 + %377 = OpLabel + %low = OpVariable %_ptr_Function_int Function + %high = OpVariable %_ptr_Function_int Function + %m = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %from_0 = OpVariable %_ptr_Function_int Function + %mid_0 = OpVariable %_ptr_Function_int Function + %to_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %378 + %378 = OpLabel + OpLoopMerge %379 %380 None + OpBranch %381 + %381 = OpLabel + %382 = OpLoad %int %m + %383 = OpLoad %int %high + %384 = OpSLessThanEqual %bool %382 %383 + OpBranchConditional %384 %385 %379 + %385 = OpLabel + %386 = OpLoad %int %low + OpStore %i_1 %386 + OpBranch %387 + %387 = OpLabel + OpLoopMerge %388 %389 None + OpBranch %390 + %390 = OpLabel + %391 = OpLoad %int %i_1 + %392 = OpLoad %int %high + %393 = OpSLessThan %bool %391 %392 + OpBranchConditional %393 %394 %388 + %394 = OpLabel + %395 = OpLoad %int %i_1 + OpStore %from_0 %395 + %396 = OpLoad %int %i_1 + %397 = OpLoad %int %m + %398 = OpIAdd %int %396 %397 + %399 = OpISub %int %398 %int_1 + OpStore %mid_0 %399 + %400 = OpLoad %int %i_1 + %401 = OpLoad %int %m + %402 = OpIMul %int %int_2 %401 + %403 = OpIAdd %int %400 %402 + %404 = OpISub %int %403 %int_1 + %405 = OpLoad %int %high + %406 = OpExtInst %int %1 SMin %404 %405 + OpStore %to_0 %406 + %407 = OpLoad %int %from_0 + OpStore %param %407 + %408 = OpLoad %int %mid_0 + OpStore %param_0 %408 + %409 = OpLoad %int %to_0 + OpStore %param_1 %409 + %410 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_0 %param_1 + OpBranch %389 + %389 = OpLabel + %411 = OpLoad %int %m + %412 = OpIMul %int %int_2 %411 + %413 = OpLoad %int %i_1 + %414 = OpIAdd %int %413 %412 + OpStore %i_1 %414 + OpBranch %387 + %388 = OpLabel + OpBranch %380 + %380 = OpLabel + %415 = OpLoad %int %m + %416 = OpIMul %int %int_2 %415 + OpStore %m %416 + OpBranch %378 + %379 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..03b86e89e7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.hlsl @@ -0,0 +1,302 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_303 = from; + k = x_303; + const int x_304 = from; + i = x_304; + const int x_305 = mid; + j = (x_305 + 1); + while (true) { + const int x_311 = i; + const int x_312 = mid; + const int x_314 = j; + const int x_315 = to; + bool tint_tmp = (x_311 <= x_312); + if (tint_tmp) { + tint_tmp = (x_314 <= x_315); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_321 = data[i]; + const int x_324 = data[j]; + if ((x_321 < x_324)) { + const int x_329 = k; + k = (x_329 + 1); + const int x_331 = i; + i = (x_331 + 1); + const int x_334 = data[x_331]; + temp[x_329] = x_334; + } else { + const int x_336 = k; + k = (x_336 + 1); + const int x_338 = j; + j = (x_338 + 1); + const int x_341 = data[x_338]; + temp[x_336] = x_341; + } + } + while (true) { + const int x_347 = i; + const int x_349 = i; + const int x_350 = mid; + bool tint_tmp_1 = (x_347 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_349 <= x_350); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_354 = k; + k = (x_354 + 1); + const int x_356 = i; + i = (x_356 + 1); + const int x_359 = data[x_356]; + temp[x_354] = x_359; + } + const int x_361 = from; + i_1 = x_361; + while (true) { + const int x_366 = i_1; + const int x_367 = to; + if ((x_366 <= x_367)) { + } else { + break; + } + const int x_370 = i_1; + const int x_373 = temp[i_1]; + data[x_370] = x_373; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void main_1() { + int x_85 = 0; + int x_86 = 0; + int x_87 = 0; + int x_88 = 0; + int x_89 = 0; + int x_90 = 0; + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94 = 0; + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_96 = asfloat(x_28[0].x); + i_3 = int(x_96); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_145 = j_1; + const int x_148 = data[j_1]; + temp[x_145] = x_148; + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + { + for(; (x_92 <= x_93); x_92 = (2 * x_92)) { + x_91 = x_94; + { + for(; (x_91 < x_93); x_91 = (x_91 + (2 * x_92))) { + x_90 = x_91; + const int x_170 = x_91; + const int x_171 = x_92; + const int x_173[10] = data; + const int tint_symbol_5[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + data = tint_symbol_5; + data = x_173; + x_89 = ((x_170 + x_171) - 1); + x_88 = min(((x_91 + (2 * x_92)) - 1), x_93); + x_87 = x_90; + x_86 = x_89; + x_85 = x_88; + merge_i1_i1_i1_(x_87, x_86, x_85); + } + } + } + } + const float x_194 = gl_FragCoord.y; + if ((int(x_194) < 30)) { + const int x_201 = data[0]; + grey = (0.5f + (float(x_201) / 10.0f)); + } else { + const float x_206 = gl_FragCoord.y; + if ((int(x_206) < 60)) { + const int x_213 = data[1]; + grey = (0.5f + (float(x_213) / 10.0f)); + } else { + const float x_218 = gl_FragCoord.y; + if ((int(x_218) < 90)) { + const int x_225 = data[2]; + grey = (0.5f + (float(x_225) / 10.0f)); + } else { + const float x_230 = gl_FragCoord.y; + if ((int(x_230) < 120)) { + const int x_237 = data[3]; + grey = (0.5f + (float(x_237) / 10.0f)); + } else { + const float x_242 = gl_FragCoord.y; + if ((int(x_242) < 150)) { + discard; + } else { + const float x_249 = gl_FragCoord.y; + if ((int(x_249) < 180)) { + const int x_256 = data[5]; + grey = (0.5f + (float(x_256) / 10.0f)); + } else { + const float x_261 = gl_FragCoord.y; + if ((int(x_261) < 210)) { + const int x_268 = data[6]; + grey = (0.5f + (float(x_268) / 10.0f)); + } else { + const float x_273 = gl_FragCoord.y; + if ((int(x_273) < 240)) { + const int x_280 = data[7]; + grey = (0.5f + (float(x_280) / 10.0f)); + } else { + const float x_285 = gl_FragCoord.y; + if ((int(x_285) < 270)) { + const int x_292 = data[8]; + grey = (0.5f + (float(x_292) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_296 = grey; + const float3 x_297 = float3(x_296, x_296, x_296); + x_GLF_color = float4(x_297.x, x_297.y, x_297.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.msl new file mode 100644 index 0000000000..6506890d21 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.msl @@ -0,0 +1,373 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_6, thread tint_array_wrapper* const tint_symbol_7) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_303 = *(from); + k = x_303; + int const x_304 = *(from); + i = x_304; + int const x_305 = *(mid); + j = (x_305 + 1); + while (true) { + int const x_311 = i; + int const x_312 = *(mid); + int const x_314 = j; + int const x_315 = *(to); + if (((x_311 <= x_312) && (x_314 <= x_315))) { + } else { + break; + } + int const x_319 = i; + int const x_321 = (*(tint_symbol_6)).arr[x_319]; + int const x_322 = j; + int const x_324 = (*(tint_symbol_6)).arr[x_322]; + if ((x_321 < x_324)) { + int const x_329 = k; + k = (x_329 + 1); + int const x_331 = i; + i = (x_331 + 1); + int const x_334 = (*(tint_symbol_6)).arr[x_331]; + (*(tint_symbol_7)).arr[x_329] = x_334; + } else { + int const x_336 = k; + k = (x_336 + 1); + int const x_338 = j; + j = (x_338 + 1); + int const x_341 = (*(tint_symbol_6)).arr[x_338]; + (*(tint_symbol_7)).arr[x_336] = x_341; + } + } + while (true) { + int const x_347 = i; + int const x_349 = i; + int const x_350 = *(mid); + if (((x_347 < 10) && (x_349 <= x_350))) { + } else { + break; + } + int const x_354 = k; + k = (x_354 + 1); + int const x_356 = i; + i = (x_356 + 1); + int const x_359 = (*(tint_symbol_6)).arr[x_356]; + (*(tint_symbol_7)).arr[x_354] = x_359; + } + int const x_361 = *(from); + i_1 = x_361; + while (true) { + int const x_366 = i_1; + int const x_367 = *(to); + if ((x_366 <= x_367)) { + } else { + break; + } + int const x_370 = i_1; + int const x_371 = i_1; + int const x_373 = (*(tint_symbol_7)).arr[x_371]; + (*(tint_symbol_6)).arr[x_370] = x_373; + { + int const x_375 = i_1; + i_1 = (x_375 + 1); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_8, thread tint_array_wrapper* const tint_symbol_9, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) { + int x_85 = 0; + int x_86 = 0; + int x_87 = 0; + int x_88 = 0; + int x_89 = 0; + int x_90 = 0; + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94 = 0; + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_96 = x_28.injectionSwitch.x; + i_3 = int(x_96); + while (true) { + int const x_102 = i_3; + switch(x_102) { + case 9: { + int const x_132 = i_3; + (*(tint_symbol_8)).arr[x_132] = -5; + break; + } + case 8: { + int const x_130 = i_3; + (*(tint_symbol_8)).arr[x_130] = -4; + break; + } + case 7: { + int const x_128 = i_3; + (*(tint_symbol_8)).arr[x_128] = -3; + break; + } + case 6: { + int const x_126 = i_3; + (*(tint_symbol_8)).arr[x_126] = -2; + break; + } + case 5: { + int const x_124 = i_3; + (*(tint_symbol_8)).arr[x_124] = -1; + break; + } + case 4: { + int const x_122 = i_3; + (*(tint_symbol_8)).arr[x_122] = 0; + break; + } + case 3: { + int const x_120 = i_3; + (*(tint_symbol_8)).arr[x_120] = 1; + break; + } + case 2: { + int const x_118 = i_3; + (*(tint_symbol_8)).arr[x_118] = 2; + break; + } + case 1: { + int const x_116 = i_3; + (*(tint_symbol_8)).arr[x_116] = 3; + break; + } + case 0: { + int const x_114 = i_3; + (*(tint_symbol_8)).arr[x_114] = 4; + break; + } + default: { + break; + } + } + int const x_134 = i_3; + i_3 = (x_134 + 1); + { + int const x_136 = i_3; + if ((x_136 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_142 = j_1; + if ((x_142 < 10)) { + } else { + break; + } + int const x_145 = j_1; + int const x_146 = j_1; + int const x_148 = (*(tint_symbol_8)).arr[x_146]; + (*(tint_symbol_9)).arr[x_145] = x_148; + { + int const x_150 = j_1; + j_1 = (x_150 + 1); + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + while (true) { + int const x_156 = x_92; + int const x_157 = x_93; + if ((x_156 <= x_157)) { + } else { + break; + } + int const x_160 = x_94; + x_91 = x_160; + while (true) { + int const x_165 = x_91; + int const x_166 = x_93; + if ((x_165 < x_166)) { + } else { + break; + } + int const x_169 = x_91; + x_90 = x_169; + int const x_170 = x_91; + int const x_171 = x_92; + tint_array_wrapper const x_173 = *(tint_symbol_8); + tint_array_wrapper const tint_symbol_4 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + *(tint_symbol_8) = tint_symbol_4; + *(tint_symbol_8) = x_173; + x_89 = ((x_170 + x_171) - 1); + int const x_175 = x_91; + int const x_176 = x_92; + int const x_180 = x_93; + x_88 = min(((x_175 + (2 * x_176)) - 1), x_180); + int const x_182 = x_90; + x_87 = x_182; + int const x_183 = x_89; + x_86 = x_183; + int const x_184 = x_88; + x_85 = x_184; + merge_i1_i1_i1_(&(x_87), &(x_86), &(x_85), tint_symbol_8, tint_symbol_9); + { + int const x_186 = x_92; + int const x_188 = x_91; + x_91 = (x_188 + (2 * x_186)); + } + } + { + int const x_190 = x_92; + x_92 = (2 * x_190); + } + } + float const x_194 = (*(tint_symbol_10)).y; + if ((int(x_194) < 30)) { + int const x_201 = (*(tint_symbol_8)).arr[0]; + grey = (0.5f + (float(x_201) / 10.0f)); + } else { + float const x_206 = (*(tint_symbol_10)).y; + if ((int(x_206) < 60)) { + int const x_213 = (*(tint_symbol_8)).arr[1]; + grey = (0.5f + (float(x_213) / 10.0f)); + } else { + float const x_218 = (*(tint_symbol_10)).y; + if ((int(x_218) < 90)) { + int const x_225 = (*(tint_symbol_8)).arr[2]; + grey = (0.5f + (float(x_225) / 10.0f)); + } else { + float const x_230 = (*(tint_symbol_10)).y; + if ((int(x_230) < 120)) { + int const x_237 = (*(tint_symbol_8)).arr[3]; + grey = (0.5f + (float(x_237) / 10.0f)); + } else { + float const x_242 = (*(tint_symbol_10)).y; + if ((int(x_242) < 150)) { + discard_fragment(); + } else { + float const x_249 = (*(tint_symbol_10)).y; + if ((int(x_249) < 180)) { + int const x_256 = (*(tint_symbol_8)).arr[5]; + grey = (0.5f + (float(x_256) / 10.0f)); + } else { + float const x_261 = (*(tint_symbol_10)).y; + if ((int(x_261) < 210)) { + int const x_268 = (*(tint_symbol_8)).arr[6]; + grey = (0.5f + (float(x_268) / 10.0f)); + } else { + float const x_273 = (*(tint_symbol_10)).y; + if ((int(x_273) < 240)) { + int const x_280 = (*(tint_symbol_8)).arr[7]; + grey = (0.5f + (float(x_280) / 10.0f)); + } else { + float const x_285 = (*(tint_symbol_10)).y; + if ((int(x_285) < 270)) { + int const x_292 = (*(tint_symbol_8)).arr[8]; + grey = (0.5f + (float(x_292) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_296 = grey; + float3 const x_297 = float3(x_296, x_296, x_296); + *(tint_symbol_11) = float4(x_297.x, x_297.y, x_297.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_12 = 0.0f; + thread tint_array_wrapper tint_symbol_13 = {}; + thread tint_array_wrapper tint_symbol_14 = {}; + thread float4 tint_symbol_15 = 0.0f; + tint_symbol_12 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_13), &(tint_symbol_14), &(tint_symbol_12), &(tint_symbol_15)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_15}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_16, thread tint_array_wrapper* const tint_symbol_17) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_382 = m; + int const x_383 = high; + if ((x_382 <= x_383)) { + } else { + break; + } + int const x_386 = low; + i_2 = x_386; + while (true) { + int const x_391 = i_2; + int const x_392 = high; + if ((x_391 < x_392)) { + } else { + break; + } + int const x_395 = i_2; + from_1 = x_395; + int const x_396 = i_2; + int const x_397 = m; + mid_1 = ((x_396 + x_397) - 1); + int const x_400 = i_2; + int const x_401 = m; + int const x_405 = high; + to_1 = min(((x_400 + (2 * x_401)) - 1), x_405); + int const x_407 = from_1; + param = x_407; + int const x_408 = mid_1; + param_1 = x_408; + int const x_409 = to_1; + param_2 = x_409; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_16, tint_symbol_17); + { + int const x_411 = m; + int const x_413 = i_2; + i_2 = (x_413 + (2 * x_411)); + } + } + { + int const x_415 = m; + m = (2 * x_415); + } + } + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..451e62716f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.spvasm @@ -0,0 +1,745 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 473 +; Schema: 0 + OpCapability Shader + %257 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %main_1 "main_1" + OpName %x_85 "x_85" + OpName %x_86 "x_86" + OpName %x_87 "x_87" + OpName %x_88 "x_88" + OpName %x_89 "x_89" + OpName %x_90 "x_90" + OpName %x_91 "x_91" + OpName %x_92 "x_92" + OpName %x_93 "x_93" + OpName %x_94 "x_94" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %132 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %149 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_9 = OpConstant %int 9 + %250 = OpConstantComposite %_arr_int_uint_10 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %402 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpLoad %int %mid + %51 = OpLoad %int %j + %53 = OpLoad %int %to + %54 = OpSLessThanEqual %bool %48 %50 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %58 = OpSLessThanEqual %bool %51 %53 + OpBranch %56 + %56 = OpLabel + %59 = OpPhi %bool %54 %47 %58 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %45 + %60 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Private_int %data %63 + %66 = OpLoad %int %65 + %67 = OpLoad %int %j + %68 = OpAccessChain %_ptr_Private_int %data %67 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %k + %75 = OpIAdd %int %74 %int_1 + OpStore %k %75 + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + %78 = OpAccessChain %_ptr_Private_int %data %76 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Private_int %temp %74 + OpStore %80 %79 + OpBranch %71 + %73 = OpLabel + %81 = OpLoad %int %k + %82 = OpIAdd %int %81 %int_1 + OpStore %k %82 + %83 = OpLoad %int %j + %84 = OpIAdd %int %83 %int_1 + OpStore %j %84 + %85 = OpAccessChain %_ptr_Private_int %data %83 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Private_int %temp %81 + OpStore %87 %86 + OpBranch %71 + %71 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpLoad %int %i + %95 = OpLoad %int %mid + %97 = OpSLessThan %bool %92 %int_10 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSLessThanEqual %bool %93 %95 + OpBranch %98 + %98 = OpLabel + %101 = OpPhi %bool %97 %91 %100 %99 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpBranch %102 + %104 = OpLabel + OpBranch %89 + %102 = OpLabel + %105 = OpLoad %int %k + %106 = OpIAdd %int %105 %int_1 + OpStore %k %106 + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + %109 = OpAccessChain %_ptr_Private_int %data %107 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Private_int %temp %105 + OpStore %111 %110 + OpBranch %90 + %90 = OpLabel + OpBranch %88 + %89 = OpLabel + %113 = OpLoad %int %from + OpStore %i_1 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpLoad %int %to + %121 = OpSLessThanEqual %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + OpBranch %122 + %124 = OpLabel + OpBranch %115 + %122 = OpLabel + %125 = OpLoad %int %i_1 + %126 = OpLoad %int %i_1 + %127 = OpAccessChain %_ptr_Private_int %temp %126 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %129 %128 + OpBranch %116 + %116 = OpLabel + %130 = OpLoad %int %i_1 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_1 %131 + OpBranch %114 + %115 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %132 + %134 = OpLabel + %x_85 = OpVariable %_ptr_Function_int Function %32 + %x_86 = OpVariable %_ptr_Function_int Function %32 + %x_87 = OpVariable %_ptr_Function_int Function %32 + %x_88 = OpVariable %_ptr_Function_int Function %32 + %x_89 = OpVariable %_ptr_Function_int Function %32 + %x_90 = OpVariable %_ptr_Function_int Function %32 + %x_91 = OpVariable %_ptr_Function_int Function %32 + %x_92 = OpVariable %_ptr_Function_int Function %32 + %x_93 = OpVariable %_ptr_Function_int Function %32 + %x_94 = OpVariable %_ptr_Function_int Function %32 + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %149 + %152 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %153 = OpLoad %float %152 + %154 = OpConvertFToS %int %153 + OpStore %i_3 %154 + OpBranch %155 + %155 = OpLabel + OpLoopMerge %156 %157 None + OpBranch %158 + %158 = OpLabel + %159 = OpLoad %int %i_3 + OpSelectionMerge %160 None + OpSwitch %159 %161 9 %162 8 %163 7 %164 6 %165 5 %166 4 %167 3 %168 2 %169 1 %170 0 %171 + %162 = OpLabel + %172 = OpLoad %int %i_3 + %173 = OpAccessChain %_ptr_Private_int %data %172 + OpStore %173 %int_n5 + OpBranch %160 + %163 = OpLabel + %175 = OpLoad %int %i_3 + %176 = OpAccessChain %_ptr_Private_int %data %175 + OpStore %176 %int_n4 + OpBranch %160 + %164 = OpLabel + %178 = OpLoad %int %i_3 + %179 = OpAccessChain %_ptr_Private_int %data %178 + OpStore %179 %int_n3 + OpBranch %160 + %165 = OpLabel + %181 = OpLoad %int %i_3 + %182 = OpAccessChain %_ptr_Private_int %data %181 + OpStore %182 %int_n2 + OpBranch %160 + %166 = OpLabel + %184 = OpLoad %int %i_3 + %185 = OpAccessChain %_ptr_Private_int %data %184 + OpStore %185 %int_n1 + OpBranch %160 + %167 = OpLabel + %187 = OpLoad %int %i_3 + %188 = OpAccessChain %_ptr_Private_int %data %187 + OpStore %188 %int_0 + OpBranch %160 + %168 = OpLabel + %190 = OpLoad %int %i_3 + %191 = OpAccessChain %_ptr_Private_int %data %190 + OpStore %191 %int_1 + OpBranch %160 + %169 = OpLabel + %192 = OpLoad %int %i_3 + %193 = OpAccessChain %_ptr_Private_int %data %192 + OpStore %193 %int_2 + OpBranch %160 + %170 = OpLabel + %195 = OpLoad %int %i_3 + %196 = OpAccessChain %_ptr_Private_int %data %195 + OpStore %196 %int_3 + OpBranch %160 + %171 = OpLabel + %198 = OpLoad %int %i_3 + %199 = OpAccessChain %_ptr_Private_int %data %198 + OpStore %199 %int_4 + OpBranch %160 + %161 = OpLabel + OpBranch %160 + %160 = OpLabel + %201 = OpLoad %int %i_3 + %202 = OpIAdd %int %201 %int_1 + OpStore %i_3 %202 + OpBranch %157 + %157 = OpLabel + %203 = OpLoad %int %i_3 + %204 = OpSLessThan %bool %203 %int_10 + OpSelectionMerge %205 None + OpBranchConditional %204 %206 %207 + %206 = OpLabel + OpBranch %205 + %207 = OpLabel + OpBranch %156 + %205 = OpLabel + OpBranch %155 + %156 = OpLabel + OpStore %j_1 %int_0 + OpBranch %208 + %208 = OpLabel + OpLoopMerge %209 %210 None + OpBranch %211 + %211 = OpLabel + %212 = OpLoad %int %j_1 + %213 = OpSLessThan %bool %212 %int_10 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %209 + %214 = OpLabel + %217 = OpLoad %int %j_1 + %218 = OpLoad %int %j_1 + %219 = OpAccessChain %_ptr_Private_int %data %218 + %220 = OpLoad %int %219 + %221 = OpAccessChain %_ptr_Private_int %temp %217 + OpStore %221 %220 + OpBranch %210 + %210 = OpLabel + %222 = OpLoad %int %j_1 + %223 = OpIAdd %int %222 %int_1 + OpStore %j_1 %223 + OpBranch %208 + %209 = OpLabel + OpStore %x_94 %int_0 + OpStore %x_93 %int_9 + OpStore %x_92 %int_1 + OpBranch %225 + %225 = OpLabel + OpLoopMerge %226 %227 None + OpBranch %228 + %228 = OpLabel + %229 = OpLoad %int %x_92 + %230 = OpLoad %int %x_93 + %231 = OpSLessThanEqual %bool %229 %230 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %234 + %233 = OpLabel + OpBranch %232 + %234 = OpLabel + OpBranch %226 + %232 = OpLabel + %235 = OpLoad %int %x_94 + OpStore %x_91 %235 + OpBranch %236 + %236 = OpLabel + OpLoopMerge %237 %238 None + OpBranch %239 + %239 = OpLabel + %240 = OpLoad %int %x_91 + %241 = OpLoad %int %x_93 + %242 = OpSLessThan %bool %240 %241 + OpSelectionMerge %243 None + OpBranchConditional %242 %244 %245 + %244 = OpLabel + OpBranch %243 + %245 = OpLabel + OpBranch %237 + %243 = OpLabel + %246 = OpLoad %int %x_91 + OpStore %x_90 %246 + %247 = OpLoad %int %x_91 + %248 = OpLoad %int %x_92 + %249 = OpLoad %_arr_int_uint_10 %data + OpStore %data %250 + OpStore %data %249 + %251 = OpIAdd %int %247 %248 + %252 = OpISub %int %251 %int_1 + OpStore %x_89 %252 + %253 = OpLoad %int %x_91 + %254 = OpLoad %int %x_92 + %255 = OpLoad %int %x_93 + %258 = OpIMul %int %int_2 %254 + %259 = OpIAdd %int %253 %258 + %260 = OpISub %int %259 %int_1 + %256 = OpExtInst %int %257 SMin %260 %255 + OpStore %x_88 %256 + %261 = OpLoad %int %x_90 + OpStore %x_87 %261 + %262 = OpLoad %int %x_89 + OpStore %x_86 %262 + %263 = OpLoad %int %x_88 + OpStore %x_85 %263 + %264 = OpFunctionCall %void %merge_i1_i1_i1_ %x_87 %x_86 %x_85 + OpBranch %238 + %238 = OpLabel + %268 = OpLoad %int %x_92 + %269 = OpLoad %int %x_91 + %270 = OpIMul %int %int_2 %268 + %271 = OpIAdd %int %269 %270 + OpStore %x_91 %271 + OpBranch %236 + %237 = OpLabel + OpBranch %227 + %227 = OpLabel + %272 = OpLoad %int %x_92 + %273 = OpIMul %int %int_2 %272 + OpStore %x_92 %273 + OpBranch %225 + %226 = OpLabel + %276 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %277 = OpLoad %float %276 + %278 = OpConvertFToS %int %277 + %280 = OpSLessThan %bool %278 %int_30 + OpSelectionMerge %281 None + OpBranchConditional %280 %282 %283 + %282 = OpLabel + %284 = OpAccessChain %_ptr_Private_int %data %int_0 + %285 = OpLoad %int %284 + %287 = OpConvertSToF %float %285 + %289 = OpFDiv %float %287 %float_10 + %290 = OpFAdd %float %float_0_5 %289 + OpStore %grey %290 + OpBranch %281 + %283 = OpLabel + %291 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %292 = OpLoad %float %291 + %293 = OpConvertFToS %int %292 + %295 = OpSLessThan %bool %293 %int_60 + OpSelectionMerge %296 None + OpBranchConditional %295 %297 %298 + %297 = OpLabel + %299 = OpAccessChain %_ptr_Private_int %data %int_1 + %300 = OpLoad %int %299 + %301 = OpConvertSToF %float %300 + %302 = OpFDiv %float %301 %float_10 + %303 = OpFAdd %float %float_0_5 %302 + OpStore %grey %303 + OpBranch %296 + %298 = OpLabel + %304 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %305 = OpLoad %float %304 + %306 = OpConvertFToS %int %305 + %308 = OpSLessThan %bool %306 %int_90 + OpSelectionMerge %309 None + OpBranchConditional %308 %310 %311 + %310 = OpLabel + %312 = OpAccessChain %_ptr_Private_int %data %int_2 + %313 = OpLoad %int %312 + %314 = OpConvertSToF %float %313 + %315 = OpFDiv %float %314 %float_10 + %316 = OpFAdd %float %float_0_5 %315 + OpStore %grey %316 + OpBranch %309 + %311 = OpLabel + %317 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %318 = OpLoad %float %317 + %319 = OpConvertFToS %int %318 + %321 = OpSLessThan %bool %319 %int_120 + OpSelectionMerge %322 None + OpBranchConditional %321 %323 %324 + %323 = OpLabel + %325 = OpAccessChain %_ptr_Private_int %data %int_3 + %326 = OpLoad %int %325 + %327 = OpConvertSToF %float %326 + %328 = OpFDiv %float %327 %float_10 + %329 = OpFAdd %float %float_0_5 %328 + OpStore %grey %329 + OpBranch %322 + %324 = OpLabel + %330 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %331 = OpLoad %float %330 + %332 = OpConvertFToS %int %331 + %334 = OpSLessThan %bool %332 %int_150 + OpSelectionMerge %335 None + OpBranchConditional %334 %336 %337 + %336 = OpLabel + OpKill + %337 = OpLabel + %338 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %339 = OpLoad %float %338 + %340 = OpConvertFToS %int %339 + %342 = OpSLessThan %bool %340 %int_180 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %345 + %344 = OpLabel + %347 = OpAccessChain %_ptr_Private_int %data %int_5 + %348 = OpLoad %int %347 + %349 = OpConvertSToF %float %348 + %350 = OpFDiv %float %349 %float_10 + %351 = OpFAdd %float %float_0_5 %350 + OpStore %grey %351 + OpBranch %343 + %345 = OpLabel + %352 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %353 = OpLoad %float %352 + %354 = OpConvertFToS %int %353 + %356 = OpSLessThan %bool %354 %int_210 + OpSelectionMerge %357 None + OpBranchConditional %356 %358 %359 + %358 = OpLabel + %361 = OpAccessChain %_ptr_Private_int %data %int_6 + %362 = OpLoad %int %361 + %363 = OpConvertSToF %float %362 + %364 = OpFDiv %float %363 %float_10 + %365 = OpFAdd %float %float_0_5 %364 + OpStore %grey %365 + OpBranch %357 + %359 = OpLabel + %366 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %367 = OpLoad %float %366 + %368 = OpConvertFToS %int %367 + %370 = OpSLessThan %bool %368 %int_240 + OpSelectionMerge %371 None + OpBranchConditional %370 %372 %373 + %372 = OpLabel + %375 = OpAccessChain %_ptr_Private_int %data %int_7 + %376 = OpLoad %int %375 + %377 = OpConvertSToF %float %376 + %378 = OpFDiv %float %377 %float_10 + %379 = OpFAdd %float %float_0_5 %378 + OpStore %grey %379 + OpBranch %371 + %373 = OpLabel + %380 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %381 = OpLoad %float %380 + %382 = OpConvertFToS %int %381 + %384 = OpSLessThan %bool %382 %int_270 + OpSelectionMerge %385 None + OpBranchConditional %384 %386 %387 + %386 = OpLabel + %389 = OpAccessChain %_ptr_Private_int %data %int_8 + %390 = OpLoad %int %389 + %391 = OpConvertSToF %float %390 + %392 = OpFDiv %float %391 %float_10 + %393 = OpFAdd %float %float_0_5 %392 + OpStore %grey %393 + OpBranch %385 + %387 = OpLabel + OpKill + %385 = OpLabel + OpBranch %371 + %371 = OpLabel + OpBranch %357 + %357 = OpLabel + OpBranch %343 + %343 = OpLabel + OpBranch %335 + %335 = OpLabel + OpBranch %322 + %322 = OpLabel + OpBranch %309 + %309 = OpLabel + OpBranch %296 + %296 = OpLabel + OpBranch %281 + %281 = OpLabel + %394 = OpLoad %float %grey + %396 = OpCompositeConstruct %v3float %394 %394 %394 + %397 = OpCompositeExtract %float %396 0 + %398 = OpCompositeExtract %float %396 1 + %399 = OpCompositeExtract %float %396 2 + %401 = OpCompositeConstruct %v4float %397 %398 %399 %float_1 + OpStore %x_GLF_color %401 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %402 +%tint_symbol_1 = OpFunctionParameter %main_out + %406 = OpLabel + %407 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %407 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %132 + %409 = OpLabel + %410 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %410 + %411 = OpFunctionCall %void %main_1 + %413 = OpLoad %v4float %x_GLF_color + %414 = OpCompositeConstruct %main_out %413 + %412 = OpFunctionCall %void %tint_symbol_3 %414 + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %132 + %416 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %427 + %427 = OpLabel + OpLoopMerge %428 %429 None + OpBranch %430 + %430 = OpLabel + %431 = OpLoad %int %m + %432 = OpLoad %int %high + %433 = OpSLessThanEqual %bool %431 %432 + OpSelectionMerge %434 None + OpBranchConditional %433 %435 %436 + %435 = OpLabel + OpBranch %434 + %436 = OpLabel + OpBranch %428 + %434 = OpLabel + %437 = OpLoad %int %low + OpStore %i_2 %437 + OpBranch %438 + %438 = OpLabel + OpLoopMerge %439 %440 None + OpBranch %441 + %441 = OpLabel + %442 = OpLoad %int %i_2 + %443 = OpLoad %int %high + %444 = OpSLessThan %bool %442 %443 + OpSelectionMerge %445 None + OpBranchConditional %444 %446 %447 + %446 = OpLabel + OpBranch %445 + %447 = OpLabel + OpBranch %439 + %445 = OpLabel + %448 = OpLoad %int %i_2 + OpStore %from_1 %448 + %449 = OpLoad %int %i_2 + %450 = OpLoad %int %m + %451 = OpIAdd %int %449 %450 + %452 = OpISub %int %451 %int_1 + OpStore %mid_1 %452 + %453 = OpLoad %int %i_2 + %454 = OpLoad %int %m + %455 = OpLoad %int %high + %457 = OpIMul %int %int_2 %454 + %458 = OpIAdd %int %453 %457 + %459 = OpISub %int %458 %int_1 + %456 = OpExtInst %int %257 SMin %459 %455 + OpStore %to_1 %456 + %460 = OpLoad %int %from_1 + OpStore %param %460 + %461 = OpLoad %int %mid_1 + OpStore %param_1 %461 + %462 = OpLoad %int %to_1 + OpStore %param_2 %462 + %463 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %440 + %440 = OpLabel + %467 = OpLoad %int %m + %468 = OpLoad %int %i_2 + %469 = OpIMul %int %int_2 %467 + %470 = OpIAdd %int %468 %469 + OpStore %i_2 %470 + OpBranch %438 + %439 = OpLabel + OpBranch %429 + %429 = OpLabel + %471 = OpLoad %int %m + %472 = OpIMul %int %int_2 %471 + OpStore %m %472 + OpBranch %427 + %428 = OpLabel + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 157[%157] is not post dominated by the back-edge block 205[%205] + %205 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..bf1622999f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.spvasm.expected.wgsl @@ -0,0 +1,366 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_303 : i32 = *(from); + k = x_303; + let x_304 : i32 = *(from); + i = x_304; + let x_305 : i32 = *(mid); + j = (x_305 + 1); + loop { + let x_311 : i32 = i; + let x_312 : i32 = *(mid); + let x_314 : i32 = j; + let x_315 : i32 = *(to); + if (((x_311 <= x_312) && (x_314 <= x_315))) { + } else { + break; + } + let x_319 : i32 = i; + let x_321 : i32 = data[x_319]; + let x_322 : i32 = j; + let x_324 : i32 = data[x_322]; + if ((x_321 < x_324)) { + let x_329 : i32 = k; + k = (x_329 + 1); + let x_331 : i32 = i; + i = (x_331 + 1); + let x_334 : i32 = data[x_331]; + temp[x_329] = x_334; + } else { + let x_336 : i32 = k; + k = (x_336 + 1); + let x_338 : i32 = j; + j = (x_338 + 1); + let x_341 : i32 = data[x_338]; + temp[x_336] = x_341; + } + } + loop { + let x_347 : i32 = i; + let x_349 : i32 = i; + let x_350 : i32 = *(mid); + if (((x_347 < 10) && (x_349 <= x_350))) { + } else { + break; + } + let x_354 : i32 = k; + k = (x_354 + 1); + let x_356 : i32 = i; + i = (x_356 + 1); + let x_359 : i32 = data[x_356]; + temp[x_354] = x_359; + } + let x_361 : i32 = *(from); + i_1 = x_361; + loop { + let x_366 : i32 = i_1; + let x_367 : i32 = *(to); + if ((x_366 <= x_367)) { + } else { + break; + } + let x_370 : i32 = i_1; + let x_371 : i32 = i_1; + let x_373 : i32 = temp[x_371]; + data[x_370] = x_373; + + continuing { + let x_375 : i32 = i_1; + i_1 = (x_375 + 1); + } + } + return; +} + +fn main_1() { + var x_85 : i32; + var x_86 : i32; + var x_87 : i32; + var x_88 : i32; + var x_89 : i32; + var x_90 : i32; + var x_91 : i32; + var x_92 : i32; + var x_93 : i32; + var x_94 : i32; + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_96 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_96); + loop { + let x_102 : i32 = i_3; + switch(x_102) { + case 9: { + let x_132 : i32 = i_3; + data[x_132] = -5; + } + case 8: { + let x_130 : i32 = i_3; + data[x_130] = -4; + } + case 7: { + let x_128 : i32 = i_3; + data[x_128] = -3; + } + case 6: { + let x_126 : i32 = i_3; + data[x_126] = -2; + } + case 5: { + let x_124 : i32 = i_3; + data[x_124] = -1; + } + case 4: { + let x_122 : i32 = i_3; + data[x_122] = 0; + } + case 3: { + let x_120 : i32 = i_3; + data[x_120] = 1; + } + case 2: { + let x_118 : i32 = i_3; + data[x_118] = 2; + } + case 1: { + let x_116 : i32 = i_3; + data[x_116] = 3; + } + case 0: { + let x_114 : i32 = i_3; + data[x_114] = 4; + } + default: { + } + } + let x_134 : i32 = i_3; + i_3 = (x_134 + 1); + + continuing { + let x_136 : i32 = i_3; + if ((x_136 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_142 : i32 = j_1; + if ((x_142 < 10)) { + } else { + break; + } + let x_145 : i32 = j_1; + let x_146 : i32 = j_1; + let x_148 : i32 = data[x_146]; + temp[x_145] = x_148; + + continuing { + let x_150 : i32 = j_1; + j_1 = (x_150 + 1); + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + loop { + let x_156 : i32 = x_92; + let x_157 : i32 = x_93; + if ((x_156 <= x_157)) { + } else { + break; + } + let x_160 : i32 = x_94; + x_91 = x_160; + loop { + let x_165 : i32 = x_91; + let x_166 : i32 = x_93; + if ((x_165 < x_166)) { + } else { + break; + } + let x_169 : i32 = x_91; + x_90 = x_169; + let x_170 : i32 = x_91; + let x_171 : i32 = x_92; + let x_173 : array = data; + data = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + data = x_173; + x_89 = ((x_170 + x_171) - 1); + let x_175 : i32 = x_91; + let x_176 : i32 = x_92; + let x_180 : i32 = x_93; + x_88 = min(((x_175 + (2 * x_176)) - 1), x_180); + let x_182 : i32 = x_90; + x_87 = x_182; + let x_183 : i32 = x_89; + x_86 = x_183; + let x_184 : i32 = x_88; + x_85 = x_184; + merge_i1_i1_i1_(&(x_87), &(x_86), &(x_85)); + + continuing { + let x_186 : i32 = x_92; + let x_188 : i32 = x_91; + x_91 = (x_188 + (2 * x_186)); + } + } + + continuing { + let x_190 : i32 = x_92; + x_92 = (2 * x_190); + } + } + let x_194 : f32 = gl_FragCoord.y; + if ((i32(x_194) < 30)) { + let x_201 : i32 = data[0]; + grey = (0.5 + (f32(x_201) / 10.0)); + } else { + let x_206 : f32 = gl_FragCoord.y; + if ((i32(x_206) < 60)) { + let x_213 : i32 = data[1]; + grey = (0.5 + (f32(x_213) / 10.0)); + } else { + let x_218 : f32 = gl_FragCoord.y; + if ((i32(x_218) < 90)) { + let x_225 : i32 = data[2]; + grey = (0.5 + (f32(x_225) / 10.0)); + } else { + let x_230 : f32 = gl_FragCoord.y; + if ((i32(x_230) < 120)) { + let x_237 : i32 = data[3]; + grey = (0.5 + (f32(x_237) / 10.0)); + } else { + let x_242 : f32 = gl_FragCoord.y; + if ((i32(x_242) < 150)) { + discard; + } else { + let x_249 : f32 = gl_FragCoord.y; + if ((i32(x_249) < 180)) { + let x_256 : i32 = data[5]; + grey = (0.5 + (f32(x_256) / 10.0)); + } else { + let x_261 : f32 = gl_FragCoord.y; + if ((i32(x_261) < 210)) { + let x_268 : i32 = data[6]; + grey = (0.5 + (f32(x_268) / 10.0)); + } else { + let x_273 : f32 = gl_FragCoord.y; + if ((i32(x_273) < 240)) { + let x_280 : i32 = data[7]; + grey = (0.5 + (f32(x_280) / 10.0)); + } else { + let x_285 : f32 = gl_FragCoord.y; + if ((i32(x_285) < 270)) { + let x_292 : i32 = data[8]; + grey = (0.5 + (f32(x_292) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_296 : f32 = grey; + let x_297 : vec3 = vec3(x_296, x_296, x_296); + x_GLF_color = vec4(x_297.x, x_297.y, x_297.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_382 : i32 = m; + let x_383 : i32 = high; + if ((x_382 <= x_383)) { + } else { + break; + } + let x_386 : i32 = low; + i_2 = x_386; + loop { + let x_391 : i32 = i_2; + let x_392 : i32 = high; + if ((x_391 < x_392)) { + } else { + break; + } + let x_395 : i32 = i_2; + from_1 = x_395; + let x_396 : i32 = i_2; + let x_397 : i32 = m; + mid_1 = ((x_396 + x_397) - 1); + let x_400 : i32 = i_2; + let x_401 : i32 = m; + let x_405 : i32 = high; + to_1 = min(((x_400 + (2 * x_401)) - 1), x_405); + let x_407 : i32 = from_1; + param = x_407; + let x_408 : i32 = mid_1; + param_1 = x_408; + let x_409 : i32 = to_1; + param_2 = x_409; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_411 : i32 = m; + let x_413 : i32 = i_2; + i_2 = (x_413 + (2 * x_411)); + } + } + + continuing { + let x_415 : i32 = m; + m = (2 * x_415); + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl new file mode 100644 index 0000000000..bf1622999f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl @@ -0,0 +1,366 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_303 : i32 = *(from); + k = x_303; + let x_304 : i32 = *(from); + i = x_304; + let x_305 : i32 = *(mid); + j = (x_305 + 1); + loop { + let x_311 : i32 = i; + let x_312 : i32 = *(mid); + let x_314 : i32 = j; + let x_315 : i32 = *(to); + if (((x_311 <= x_312) && (x_314 <= x_315))) { + } else { + break; + } + let x_319 : i32 = i; + let x_321 : i32 = data[x_319]; + let x_322 : i32 = j; + let x_324 : i32 = data[x_322]; + if ((x_321 < x_324)) { + let x_329 : i32 = k; + k = (x_329 + 1); + let x_331 : i32 = i; + i = (x_331 + 1); + let x_334 : i32 = data[x_331]; + temp[x_329] = x_334; + } else { + let x_336 : i32 = k; + k = (x_336 + 1); + let x_338 : i32 = j; + j = (x_338 + 1); + let x_341 : i32 = data[x_338]; + temp[x_336] = x_341; + } + } + loop { + let x_347 : i32 = i; + let x_349 : i32 = i; + let x_350 : i32 = *(mid); + if (((x_347 < 10) && (x_349 <= x_350))) { + } else { + break; + } + let x_354 : i32 = k; + k = (x_354 + 1); + let x_356 : i32 = i; + i = (x_356 + 1); + let x_359 : i32 = data[x_356]; + temp[x_354] = x_359; + } + let x_361 : i32 = *(from); + i_1 = x_361; + loop { + let x_366 : i32 = i_1; + let x_367 : i32 = *(to); + if ((x_366 <= x_367)) { + } else { + break; + } + let x_370 : i32 = i_1; + let x_371 : i32 = i_1; + let x_373 : i32 = temp[x_371]; + data[x_370] = x_373; + + continuing { + let x_375 : i32 = i_1; + i_1 = (x_375 + 1); + } + } + return; +} + +fn main_1() { + var x_85 : i32; + var x_86 : i32; + var x_87 : i32; + var x_88 : i32; + var x_89 : i32; + var x_90 : i32; + var x_91 : i32; + var x_92 : i32; + var x_93 : i32; + var x_94 : i32; + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_96 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_96); + loop { + let x_102 : i32 = i_3; + switch(x_102) { + case 9: { + let x_132 : i32 = i_3; + data[x_132] = -5; + } + case 8: { + let x_130 : i32 = i_3; + data[x_130] = -4; + } + case 7: { + let x_128 : i32 = i_3; + data[x_128] = -3; + } + case 6: { + let x_126 : i32 = i_3; + data[x_126] = -2; + } + case 5: { + let x_124 : i32 = i_3; + data[x_124] = -1; + } + case 4: { + let x_122 : i32 = i_3; + data[x_122] = 0; + } + case 3: { + let x_120 : i32 = i_3; + data[x_120] = 1; + } + case 2: { + let x_118 : i32 = i_3; + data[x_118] = 2; + } + case 1: { + let x_116 : i32 = i_3; + data[x_116] = 3; + } + case 0: { + let x_114 : i32 = i_3; + data[x_114] = 4; + } + default: { + } + } + let x_134 : i32 = i_3; + i_3 = (x_134 + 1); + + continuing { + let x_136 : i32 = i_3; + if ((x_136 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_142 : i32 = j_1; + if ((x_142 < 10)) { + } else { + break; + } + let x_145 : i32 = j_1; + let x_146 : i32 = j_1; + let x_148 : i32 = data[x_146]; + temp[x_145] = x_148; + + continuing { + let x_150 : i32 = j_1; + j_1 = (x_150 + 1); + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + loop { + let x_156 : i32 = x_92; + let x_157 : i32 = x_93; + if ((x_156 <= x_157)) { + } else { + break; + } + let x_160 : i32 = x_94; + x_91 = x_160; + loop { + let x_165 : i32 = x_91; + let x_166 : i32 = x_93; + if ((x_165 < x_166)) { + } else { + break; + } + let x_169 : i32 = x_91; + x_90 = x_169; + let x_170 : i32 = x_91; + let x_171 : i32 = x_92; + let x_173 : array = data; + data = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + data = x_173; + x_89 = ((x_170 + x_171) - 1); + let x_175 : i32 = x_91; + let x_176 : i32 = x_92; + let x_180 : i32 = x_93; + x_88 = min(((x_175 + (2 * x_176)) - 1), x_180); + let x_182 : i32 = x_90; + x_87 = x_182; + let x_183 : i32 = x_89; + x_86 = x_183; + let x_184 : i32 = x_88; + x_85 = x_184; + merge_i1_i1_i1_(&(x_87), &(x_86), &(x_85)); + + continuing { + let x_186 : i32 = x_92; + let x_188 : i32 = x_91; + x_91 = (x_188 + (2 * x_186)); + } + } + + continuing { + let x_190 : i32 = x_92; + x_92 = (2 * x_190); + } + } + let x_194 : f32 = gl_FragCoord.y; + if ((i32(x_194) < 30)) { + let x_201 : i32 = data[0]; + grey = (0.5 + (f32(x_201) / 10.0)); + } else { + let x_206 : f32 = gl_FragCoord.y; + if ((i32(x_206) < 60)) { + let x_213 : i32 = data[1]; + grey = (0.5 + (f32(x_213) / 10.0)); + } else { + let x_218 : f32 = gl_FragCoord.y; + if ((i32(x_218) < 90)) { + let x_225 : i32 = data[2]; + grey = (0.5 + (f32(x_225) / 10.0)); + } else { + let x_230 : f32 = gl_FragCoord.y; + if ((i32(x_230) < 120)) { + let x_237 : i32 = data[3]; + grey = (0.5 + (f32(x_237) / 10.0)); + } else { + let x_242 : f32 = gl_FragCoord.y; + if ((i32(x_242) < 150)) { + discard; + } else { + let x_249 : f32 = gl_FragCoord.y; + if ((i32(x_249) < 180)) { + let x_256 : i32 = data[5]; + grey = (0.5 + (f32(x_256) / 10.0)); + } else { + let x_261 : f32 = gl_FragCoord.y; + if ((i32(x_261) < 210)) { + let x_268 : i32 = data[6]; + grey = (0.5 + (f32(x_268) / 10.0)); + } else { + let x_273 : f32 = gl_FragCoord.y; + if ((i32(x_273) < 240)) { + let x_280 : i32 = data[7]; + grey = (0.5 + (f32(x_280) / 10.0)); + } else { + let x_285 : f32 = gl_FragCoord.y; + if ((i32(x_285) < 270)) { + let x_292 : i32 = data[8]; + grey = (0.5 + (f32(x_292) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_296 : f32 = grey; + let x_297 : vec3 = vec3(x_296, x_296, x_296); + x_GLF_color = vec4(x_297.x, x_297.y, x_297.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_382 : i32 = m; + let x_383 : i32 = high; + if ((x_382 <= x_383)) { + } else { + break; + } + let x_386 : i32 = low; + i_2 = x_386; + loop { + let x_391 : i32 = i_2; + let x_392 : i32 = high; + if ((x_391 < x_392)) { + } else { + break; + } + let x_395 : i32 = i_2; + from_1 = x_395; + let x_396 : i32 = i_2; + let x_397 : i32 = m; + mid_1 = ((x_396 + x_397) - 1); + let x_400 : i32 = i_2; + let x_401 : i32 = m; + let x_405 : i32 = high; + to_1 = min(((x_400 + (2 * x_401)) - 1), x_405); + let x_407 : i32 = from_1; + param = x_407; + let x_408 : i32 = mid_1; + param_1 = x_408; + let x_409 : i32 = to_1; + param_2 = x_409; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_411 : i32 = m; + let x_413 : i32 = i_2; + i_2 = (x_413 + (2 * x_411)); + } + } + + continuing { + let x_415 : i32 = m; + m = (2 * x_415); + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..03b86e89e7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.hlsl @@ -0,0 +1,302 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_303 = from; + k = x_303; + const int x_304 = from; + i = x_304; + const int x_305 = mid; + j = (x_305 + 1); + while (true) { + const int x_311 = i; + const int x_312 = mid; + const int x_314 = j; + const int x_315 = to; + bool tint_tmp = (x_311 <= x_312); + if (tint_tmp) { + tint_tmp = (x_314 <= x_315); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_321 = data[i]; + const int x_324 = data[j]; + if ((x_321 < x_324)) { + const int x_329 = k; + k = (x_329 + 1); + const int x_331 = i; + i = (x_331 + 1); + const int x_334 = data[x_331]; + temp[x_329] = x_334; + } else { + const int x_336 = k; + k = (x_336 + 1); + const int x_338 = j; + j = (x_338 + 1); + const int x_341 = data[x_338]; + temp[x_336] = x_341; + } + } + while (true) { + const int x_347 = i; + const int x_349 = i; + const int x_350 = mid; + bool tint_tmp_1 = (x_347 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_349 <= x_350); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_354 = k; + k = (x_354 + 1); + const int x_356 = i; + i = (x_356 + 1); + const int x_359 = data[x_356]; + temp[x_354] = x_359; + } + const int x_361 = from; + i_1 = x_361; + while (true) { + const int x_366 = i_1; + const int x_367 = to; + if ((x_366 <= x_367)) { + } else { + break; + } + const int x_370 = i_1; + const int x_373 = temp[i_1]; + data[x_370] = x_373; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void main_1() { + int x_85 = 0; + int x_86 = 0; + int x_87 = 0; + int x_88 = 0; + int x_89 = 0; + int x_90 = 0; + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94 = 0; + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_96 = asfloat(x_28[0].x); + i_3 = int(x_96); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_145 = j_1; + const int x_148 = data[j_1]; + temp[x_145] = x_148; + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + { + for(; (x_92 <= x_93); x_92 = (2 * x_92)) { + x_91 = x_94; + { + for(; (x_91 < x_93); x_91 = (x_91 + (2 * x_92))) { + x_90 = x_91; + const int x_170 = x_91; + const int x_171 = x_92; + const int x_173[10] = data; + const int tint_symbol_5[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + data = tint_symbol_5; + data = x_173; + x_89 = ((x_170 + x_171) - 1); + x_88 = min(((x_91 + (2 * x_92)) - 1), x_93); + x_87 = x_90; + x_86 = x_89; + x_85 = x_88; + merge_i1_i1_i1_(x_87, x_86, x_85); + } + } + } + } + const float x_194 = gl_FragCoord.y; + if ((int(x_194) < 30)) { + const int x_201 = data[0]; + grey = (0.5f + (float(x_201) / 10.0f)); + } else { + const float x_206 = gl_FragCoord.y; + if ((int(x_206) < 60)) { + const int x_213 = data[1]; + grey = (0.5f + (float(x_213) / 10.0f)); + } else { + const float x_218 = gl_FragCoord.y; + if ((int(x_218) < 90)) { + const int x_225 = data[2]; + grey = (0.5f + (float(x_225) / 10.0f)); + } else { + const float x_230 = gl_FragCoord.y; + if ((int(x_230) < 120)) { + const int x_237 = data[3]; + grey = (0.5f + (float(x_237) / 10.0f)); + } else { + const float x_242 = gl_FragCoord.y; + if ((int(x_242) < 150)) { + discard; + } else { + const float x_249 = gl_FragCoord.y; + if ((int(x_249) < 180)) { + const int x_256 = data[5]; + grey = (0.5f + (float(x_256) / 10.0f)); + } else { + const float x_261 = gl_FragCoord.y; + if ((int(x_261) < 210)) { + const int x_268 = data[6]; + grey = (0.5f + (float(x_268) / 10.0f)); + } else { + const float x_273 = gl_FragCoord.y; + if ((int(x_273) < 240)) { + const int x_280 = data[7]; + grey = (0.5f + (float(x_280) / 10.0f)); + } else { + const float x_285 = gl_FragCoord.y; + if ((int(x_285) < 270)) { + const int x_292 = data[8]; + grey = (0.5f + (float(x_292) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_296 = grey; + const float3 x_297 = float3(x_296, x_296, x_296); + x_GLF_color = float4(x_297.x, x_297.y, x_297.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.msl new file mode 100644 index 0000000000..6506890d21 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.msl @@ -0,0 +1,373 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_6, thread tint_array_wrapper* const tint_symbol_7) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_303 = *(from); + k = x_303; + int const x_304 = *(from); + i = x_304; + int const x_305 = *(mid); + j = (x_305 + 1); + while (true) { + int const x_311 = i; + int const x_312 = *(mid); + int const x_314 = j; + int const x_315 = *(to); + if (((x_311 <= x_312) && (x_314 <= x_315))) { + } else { + break; + } + int const x_319 = i; + int const x_321 = (*(tint_symbol_6)).arr[x_319]; + int const x_322 = j; + int const x_324 = (*(tint_symbol_6)).arr[x_322]; + if ((x_321 < x_324)) { + int const x_329 = k; + k = (x_329 + 1); + int const x_331 = i; + i = (x_331 + 1); + int const x_334 = (*(tint_symbol_6)).arr[x_331]; + (*(tint_symbol_7)).arr[x_329] = x_334; + } else { + int const x_336 = k; + k = (x_336 + 1); + int const x_338 = j; + j = (x_338 + 1); + int const x_341 = (*(tint_symbol_6)).arr[x_338]; + (*(tint_symbol_7)).arr[x_336] = x_341; + } + } + while (true) { + int const x_347 = i; + int const x_349 = i; + int const x_350 = *(mid); + if (((x_347 < 10) && (x_349 <= x_350))) { + } else { + break; + } + int const x_354 = k; + k = (x_354 + 1); + int const x_356 = i; + i = (x_356 + 1); + int const x_359 = (*(tint_symbol_6)).arr[x_356]; + (*(tint_symbol_7)).arr[x_354] = x_359; + } + int const x_361 = *(from); + i_1 = x_361; + while (true) { + int const x_366 = i_1; + int const x_367 = *(to); + if ((x_366 <= x_367)) { + } else { + break; + } + int const x_370 = i_1; + int const x_371 = i_1; + int const x_373 = (*(tint_symbol_7)).arr[x_371]; + (*(tint_symbol_6)).arr[x_370] = x_373; + { + int const x_375 = i_1; + i_1 = (x_375 + 1); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_8, thread tint_array_wrapper* const tint_symbol_9, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) { + int x_85 = 0; + int x_86 = 0; + int x_87 = 0; + int x_88 = 0; + int x_89 = 0; + int x_90 = 0; + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94 = 0; + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_96 = x_28.injectionSwitch.x; + i_3 = int(x_96); + while (true) { + int const x_102 = i_3; + switch(x_102) { + case 9: { + int const x_132 = i_3; + (*(tint_symbol_8)).arr[x_132] = -5; + break; + } + case 8: { + int const x_130 = i_3; + (*(tint_symbol_8)).arr[x_130] = -4; + break; + } + case 7: { + int const x_128 = i_3; + (*(tint_symbol_8)).arr[x_128] = -3; + break; + } + case 6: { + int const x_126 = i_3; + (*(tint_symbol_8)).arr[x_126] = -2; + break; + } + case 5: { + int const x_124 = i_3; + (*(tint_symbol_8)).arr[x_124] = -1; + break; + } + case 4: { + int const x_122 = i_3; + (*(tint_symbol_8)).arr[x_122] = 0; + break; + } + case 3: { + int const x_120 = i_3; + (*(tint_symbol_8)).arr[x_120] = 1; + break; + } + case 2: { + int const x_118 = i_3; + (*(tint_symbol_8)).arr[x_118] = 2; + break; + } + case 1: { + int const x_116 = i_3; + (*(tint_symbol_8)).arr[x_116] = 3; + break; + } + case 0: { + int const x_114 = i_3; + (*(tint_symbol_8)).arr[x_114] = 4; + break; + } + default: { + break; + } + } + int const x_134 = i_3; + i_3 = (x_134 + 1); + { + int const x_136 = i_3; + if ((x_136 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_142 = j_1; + if ((x_142 < 10)) { + } else { + break; + } + int const x_145 = j_1; + int const x_146 = j_1; + int const x_148 = (*(tint_symbol_8)).arr[x_146]; + (*(tint_symbol_9)).arr[x_145] = x_148; + { + int const x_150 = j_1; + j_1 = (x_150 + 1); + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + while (true) { + int const x_156 = x_92; + int const x_157 = x_93; + if ((x_156 <= x_157)) { + } else { + break; + } + int const x_160 = x_94; + x_91 = x_160; + while (true) { + int const x_165 = x_91; + int const x_166 = x_93; + if ((x_165 < x_166)) { + } else { + break; + } + int const x_169 = x_91; + x_90 = x_169; + int const x_170 = x_91; + int const x_171 = x_92; + tint_array_wrapper const x_173 = *(tint_symbol_8); + tint_array_wrapper const tint_symbol_4 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + *(tint_symbol_8) = tint_symbol_4; + *(tint_symbol_8) = x_173; + x_89 = ((x_170 + x_171) - 1); + int const x_175 = x_91; + int const x_176 = x_92; + int const x_180 = x_93; + x_88 = min(((x_175 + (2 * x_176)) - 1), x_180); + int const x_182 = x_90; + x_87 = x_182; + int const x_183 = x_89; + x_86 = x_183; + int const x_184 = x_88; + x_85 = x_184; + merge_i1_i1_i1_(&(x_87), &(x_86), &(x_85), tint_symbol_8, tint_symbol_9); + { + int const x_186 = x_92; + int const x_188 = x_91; + x_91 = (x_188 + (2 * x_186)); + } + } + { + int const x_190 = x_92; + x_92 = (2 * x_190); + } + } + float const x_194 = (*(tint_symbol_10)).y; + if ((int(x_194) < 30)) { + int const x_201 = (*(tint_symbol_8)).arr[0]; + grey = (0.5f + (float(x_201) / 10.0f)); + } else { + float const x_206 = (*(tint_symbol_10)).y; + if ((int(x_206) < 60)) { + int const x_213 = (*(tint_symbol_8)).arr[1]; + grey = (0.5f + (float(x_213) / 10.0f)); + } else { + float const x_218 = (*(tint_symbol_10)).y; + if ((int(x_218) < 90)) { + int const x_225 = (*(tint_symbol_8)).arr[2]; + grey = (0.5f + (float(x_225) / 10.0f)); + } else { + float const x_230 = (*(tint_symbol_10)).y; + if ((int(x_230) < 120)) { + int const x_237 = (*(tint_symbol_8)).arr[3]; + grey = (0.5f + (float(x_237) / 10.0f)); + } else { + float const x_242 = (*(tint_symbol_10)).y; + if ((int(x_242) < 150)) { + discard_fragment(); + } else { + float const x_249 = (*(tint_symbol_10)).y; + if ((int(x_249) < 180)) { + int const x_256 = (*(tint_symbol_8)).arr[5]; + grey = (0.5f + (float(x_256) / 10.0f)); + } else { + float const x_261 = (*(tint_symbol_10)).y; + if ((int(x_261) < 210)) { + int const x_268 = (*(tint_symbol_8)).arr[6]; + grey = (0.5f + (float(x_268) / 10.0f)); + } else { + float const x_273 = (*(tint_symbol_10)).y; + if ((int(x_273) < 240)) { + int const x_280 = (*(tint_symbol_8)).arr[7]; + grey = (0.5f + (float(x_280) / 10.0f)); + } else { + float const x_285 = (*(tint_symbol_10)).y; + if ((int(x_285) < 270)) { + int const x_292 = (*(tint_symbol_8)).arr[8]; + grey = (0.5f + (float(x_292) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_296 = grey; + float3 const x_297 = float3(x_296, x_296, x_296); + *(tint_symbol_11) = float4(x_297.x, x_297.y, x_297.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_12 = 0.0f; + thread tint_array_wrapper tint_symbol_13 = {}; + thread tint_array_wrapper tint_symbol_14 = {}; + thread float4 tint_symbol_15 = 0.0f; + tint_symbol_12 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_13), &(tint_symbol_14), &(tint_symbol_12), &(tint_symbol_15)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_15}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_16, thread tint_array_wrapper* const tint_symbol_17) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_382 = m; + int const x_383 = high; + if ((x_382 <= x_383)) { + } else { + break; + } + int const x_386 = low; + i_2 = x_386; + while (true) { + int const x_391 = i_2; + int const x_392 = high; + if ((x_391 < x_392)) { + } else { + break; + } + int const x_395 = i_2; + from_1 = x_395; + int const x_396 = i_2; + int const x_397 = m; + mid_1 = ((x_396 + x_397) - 1); + int const x_400 = i_2; + int const x_401 = m; + int const x_405 = high; + to_1 = min(((x_400 + (2 * x_401)) - 1), x_405); + int const x_407 = from_1; + param = x_407; + int const x_408 = mid_1; + param_1 = x_408; + int const x_409 = to_1; + param_2 = x_409; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_16, tint_symbol_17); + { + int const x_411 = m; + int const x_413 = i_2; + i_2 = (x_413 + (2 * x_411)); + } + } + { + int const x_415 = m; + m = (2 * x_415); + } + } + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..451e62716f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.spvasm @@ -0,0 +1,745 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 473 +; Schema: 0 + OpCapability Shader + %257 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %main_1 "main_1" + OpName %x_85 "x_85" + OpName %x_86 "x_86" + OpName %x_87 "x_87" + OpName %x_88 "x_88" + OpName %x_89 "x_89" + OpName %x_90 "x_90" + OpName %x_91 "x_91" + OpName %x_92 "x_92" + OpName %x_93 "x_93" + OpName %x_94 "x_94" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %132 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %149 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_9 = OpConstant %int 9 + %250 = OpConstantComposite %_arr_int_uint_10 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %402 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpLoad %int %mid + %51 = OpLoad %int %j + %53 = OpLoad %int %to + %54 = OpSLessThanEqual %bool %48 %50 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %58 = OpSLessThanEqual %bool %51 %53 + OpBranch %56 + %56 = OpLabel + %59 = OpPhi %bool %54 %47 %58 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %45 + %60 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Private_int %data %63 + %66 = OpLoad %int %65 + %67 = OpLoad %int %j + %68 = OpAccessChain %_ptr_Private_int %data %67 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %k + %75 = OpIAdd %int %74 %int_1 + OpStore %k %75 + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + %78 = OpAccessChain %_ptr_Private_int %data %76 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Private_int %temp %74 + OpStore %80 %79 + OpBranch %71 + %73 = OpLabel + %81 = OpLoad %int %k + %82 = OpIAdd %int %81 %int_1 + OpStore %k %82 + %83 = OpLoad %int %j + %84 = OpIAdd %int %83 %int_1 + OpStore %j %84 + %85 = OpAccessChain %_ptr_Private_int %data %83 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Private_int %temp %81 + OpStore %87 %86 + OpBranch %71 + %71 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpLoad %int %i + %95 = OpLoad %int %mid + %97 = OpSLessThan %bool %92 %int_10 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSLessThanEqual %bool %93 %95 + OpBranch %98 + %98 = OpLabel + %101 = OpPhi %bool %97 %91 %100 %99 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpBranch %102 + %104 = OpLabel + OpBranch %89 + %102 = OpLabel + %105 = OpLoad %int %k + %106 = OpIAdd %int %105 %int_1 + OpStore %k %106 + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + %109 = OpAccessChain %_ptr_Private_int %data %107 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Private_int %temp %105 + OpStore %111 %110 + OpBranch %90 + %90 = OpLabel + OpBranch %88 + %89 = OpLabel + %113 = OpLoad %int %from + OpStore %i_1 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpLoad %int %to + %121 = OpSLessThanEqual %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + OpBranch %122 + %124 = OpLabel + OpBranch %115 + %122 = OpLabel + %125 = OpLoad %int %i_1 + %126 = OpLoad %int %i_1 + %127 = OpAccessChain %_ptr_Private_int %temp %126 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %129 %128 + OpBranch %116 + %116 = OpLabel + %130 = OpLoad %int %i_1 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_1 %131 + OpBranch %114 + %115 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %132 + %134 = OpLabel + %x_85 = OpVariable %_ptr_Function_int Function %32 + %x_86 = OpVariable %_ptr_Function_int Function %32 + %x_87 = OpVariable %_ptr_Function_int Function %32 + %x_88 = OpVariable %_ptr_Function_int Function %32 + %x_89 = OpVariable %_ptr_Function_int Function %32 + %x_90 = OpVariable %_ptr_Function_int Function %32 + %x_91 = OpVariable %_ptr_Function_int Function %32 + %x_92 = OpVariable %_ptr_Function_int Function %32 + %x_93 = OpVariable %_ptr_Function_int Function %32 + %x_94 = OpVariable %_ptr_Function_int Function %32 + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %149 + %152 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %153 = OpLoad %float %152 + %154 = OpConvertFToS %int %153 + OpStore %i_3 %154 + OpBranch %155 + %155 = OpLabel + OpLoopMerge %156 %157 None + OpBranch %158 + %158 = OpLabel + %159 = OpLoad %int %i_3 + OpSelectionMerge %160 None + OpSwitch %159 %161 9 %162 8 %163 7 %164 6 %165 5 %166 4 %167 3 %168 2 %169 1 %170 0 %171 + %162 = OpLabel + %172 = OpLoad %int %i_3 + %173 = OpAccessChain %_ptr_Private_int %data %172 + OpStore %173 %int_n5 + OpBranch %160 + %163 = OpLabel + %175 = OpLoad %int %i_3 + %176 = OpAccessChain %_ptr_Private_int %data %175 + OpStore %176 %int_n4 + OpBranch %160 + %164 = OpLabel + %178 = OpLoad %int %i_3 + %179 = OpAccessChain %_ptr_Private_int %data %178 + OpStore %179 %int_n3 + OpBranch %160 + %165 = OpLabel + %181 = OpLoad %int %i_3 + %182 = OpAccessChain %_ptr_Private_int %data %181 + OpStore %182 %int_n2 + OpBranch %160 + %166 = OpLabel + %184 = OpLoad %int %i_3 + %185 = OpAccessChain %_ptr_Private_int %data %184 + OpStore %185 %int_n1 + OpBranch %160 + %167 = OpLabel + %187 = OpLoad %int %i_3 + %188 = OpAccessChain %_ptr_Private_int %data %187 + OpStore %188 %int_0 + OpBranch %160 + %168 = OpLabel + %190 = OpLoad %int %i_3 + %191 = OpAccessChain %_ptr_Private_int %data %190 + OpStore %191 %int_1 + OpBranch %160 + %169 = OpLabel + %192 = OpLoad %int %i_3 + %193 = OpAccessChain %_ptr_Private_int %data %192 + OpStore %193 %int_2 + OpBranch %160 + %170 = OpLabel + %195 = OpLoad %int %i_3 + %196 = OpAccessChain %_ptr_Private_int %data %195 + OpStore %196 %int_3 + OpBranch %160 + %171 = OpLabel + %198 = OpLoad %int %i_3 + %199 = OpAccessChain %_ptr_Private_int %data %198 + OpStore %199 %int_4 + OpBranch %160 + %161 = OpLabel + OpBranch %160 + %160 = OpLabel + %201 = OpLoad %int %i_3 + %202 = OpIAdd %int %201 %int_1 + OpStore %i_3 %202 + OpBranch %157 + %157 = OpLabel + %203 = OpLoad %int %i_3 + %204 = OpSLessThan %bool %203 %int_10 + OpSelectionMerge %205 None + OpBranchConditional %204 %206 %207 + %206 = OpLabel + OpBranch %205 + %207 = OpLabel + OpBranch %156 + %205 = OpLabel + OpBranch %155 + %156 = OpLabel + OpStore %j_1 %int_0 + OpBranch %208 + %208 = OpLabel + OpLoopMerge %209 %210 None + OpBranch %211 + %211 = OpLabel + %212 = OpLoad %int %j_1 + %213 = OpSLessThan %bool %212 %int_10 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %209 + %214 = OpLabel + %217 = OpLoad %int %j_1 + %218 = OpLoad %int %j_1 + %219 = OpAccessChain %_ptr_Private_int %data %218 + %220 = OpLoad %int %219 + %221 = OpAccessChain %_ptr_Private_int %temp %217 + OpStore %221 %220 + OpBranch %210 + %210 = OpLabel + %222 = OpLoad %int %j_1 + %223 = OpIAdd %int %222 %int_1 + OpStore %j_1 %223 + OpBranch %208 + %209 = OpLabel + OpStore %x_94 %int_0 + OpStore %x_93 %int_9 + OpStore %x_92 %int_1 + OpBranch %225 + %225 = OpLabel + OpLoopMerge %226 %227 None + OpBranch %228 + %228 = OpLabel + %229 = OpLoad %int %x_92 + %230 = OpLoad %int %x_93 + %231 = OpSLessThanEqual %bool %229 %230 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %234 + %233 = OpLabel + OpBranch %232 + %234 = OpLabel + OpBranch %226 + %232 = OpLabel + %235 = OpLoad %int %x_94 + OpStore %x_91 %235 + OpBranch %236 + %236 = OpLabel + OpLoopMerge %237 %238 None + OpBranch %239 + %239 = OpLabel + %240 = OpLoad %int %x_91 + %241 = OpLoad %int %x_93 + %242 = OpSLessThan %bool %240 %241 + OpSelectionMerge %243 None + OpBranchConditional %242 %244 %245 + %244 = OpLabel + OpBranch %243 + %245 = OpLabel + OpBranch %237 + %243 = OpLabel + %246 = OpLoad %int %x_91 + OpStore %x_90 %246 + %247 = OpLoad %int %x_91 + %248 = OpLoad %int %x_92 + %249 = OpLoad %_arr_int_uint_10 %data + OpStore %data %250 + OpStore %data %249 + %251 = OpIAdd %int %247 %248 + %252 = OpISub %int %251 %int_1 + OpStore %x_89 %252 + %253 = OpLoad %int %x_91 + %254 = OpLoad %int %x_92 + %255 = OpLoad %int %x_93 + %258 = OpIMul %int %int_2 %254 + %259 = OpIAdd %int %253 %258 + %260 = OpISub %int %259 %int_1 + %256 = OpExtInst %int %257 SMin %260 %255 + OpStore %x_88 %256 + %261 = OpLoad %int %x_90 + OpStore %x_87 %261 + %262 = OpLoad %int %x_89 + OpStore %x_86 %262 + %263 = OpLoad %int %x_88 + OpStore %x_85 %263 + %264 = OpFunctionCall %void %merge_i1_i1_i1_ %x_87 %x_86 %x_85 + OpBranch %238 + %238 = OpLabel + %268 = OpLoad %int %x_92 + %269 = OpLoad %int %x_91 + %270 = OpIMul %int %int_2 %268 + %271 = OpIAdd %int %269 %270 + OpStore %x_91 %271 + OpBranch %236 + %237 = OpLabel + OpBranch %227 + %227 = OpLabel + %272 = OpLoad %int %x_92 + %273 = OpIMul %int %int_2 %272 + OpStore %x_92 %273 + OpBranch %225 + %226 = OpLabel + %276 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %277 = OpLoad %float %276 + %278 = OpConvertFToS %int %277 + %280 = OpSLessThan %bool %278 %int_30 + OpSelectionMerge %281 None + OpBranchConditional %280 %282 %283 + %282 = OpLabel + %284 = OpAccessChain %_ptr_Private_int %data %int_0 + %285 = OpLoad %int %284 + %287 = OpConvertSToF %float %285 + %289 = OpFDiv %float %287 %float_10 + %290 = OpFAdd %float %float_0_5 %289 + OpStore %grey %290 + OpBranch %281 + %283 = OpLabel + %291 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %292 = OpLoad %float %291 + %293 = OpConvertFToS %int %292 + %295 = OpSLessThan %bool %293 %int_60 + OpSelectionMerge %296 None + OpBranchConditional %295 %297 %298 + %297 = OpLabel + %299 = OpAccessChain %_ptr_Private_int %data %int_1 + %300 = OpLoad %int %299 + %301 = OpConvertSToF %float %300 + %302 = OpFDiv %float %301 %float_10 + %303 = OpFAdd %float %float_0_5 %302 + OpStore %grey %303 + OpBranch %296 + %298 = OpLabel + %304 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %305 = OpLoad %float %304 + %306 = OpConvertFToS %int %305 + %308 = OpSLessThan %bool %306 %int_90 + OpSelectionMerge %309 None + OpBranchConditional %308 %310 %311 + %310 = OpLabel + %312 = OpAccessChain %_ptr_Private_int %data %int_2 + %313 = OpLoad %int %312 + %314 = OpConvertSToF %float %313 + %315 = OpFDiv %float %314 %float_10 + %316 = OpFAdd %float %float_0_5 %315 + OpStore %grey %316 + OpBranch %309 + %311 = OpLabel + %317 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %318 = OpLoad %float %317 + %319 = OpConvertFToS %int %318 + %321 = OpSLessThan %bool %319 %int_120 + OpSelectionMerge %322 None + OpBranchConditional %321 %323 %324 + %323 = OpLabel + %325 = OpAccessChain %_ptr_Private_int %data %int_3 + %326 = OpLoad %int %325 + %327 = OpConvertSToF %float %326 + %328 = OpFDiv %float %327 %float_10 + %329 = OpFAdd %float %float_0_5 %328 + OpStore %grey %329 + OpBranch %322 + %324 = OpLabel + %330 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %331 = OpLoad %float %330 + %332 = OpConvertFToS %int %331 + %334 = OpSLessThan %bool %332 %int_150 + OpSelectionMerge %335 None + OpBranchConditional %334 %336 %337 + %336 = OpLabel + OpKill + %337 = OpLabel + %338 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %339 = OpLoad %float %338 + %340 = OpConvertFToS %int %339 + %342 = OpSLessThan %bool %340 %int_180 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %345 + %344 = OpLabel + %347 = OpAccessChain %_ptr_Private_int %data %int_5 + %348 = OpLoad %int %347 + %349 = OpConvertSToF %float %348 + %350 = OpFDiv %float %349 %float_10 + %351 = OpFAdd %float %float_0_5 %350 + OpStore %grey %351 + OpBranch %343 + %345 = OpLabel + %352 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %353 = OpLoad %float %352 + %354 = OpConvertFToS %int %353 + %356 = OpSLessThan %bool %354 %int_210 + OpSelectionMerge %357 None + OpBranchConditional %356 %358 %359 + %358 = OpLabel + %361 = OpAccessChain %_ptr_Private_int %data %int_6 + %362 = OpLoad %int %361 + %363 = OpConvertSToF %float %362 + %364 = OpFDiv %float %363 %float_10 + %365 = OpFAdd %float %float_0_5 %364 + OpStore %grey %365 + OpBranch %357 + %359 = OpLabel + %366 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %367 = OpLoad %float %366 + %368 = OpConvertFToS %int %367 + %370 = OpSLessThan %bool %368 %int_240 + OpSelectionMerge %371 None + OpBranchConditional %370 %372 %373 + %372 = OpLabel + %375 = OpAccessChain %_ptr_Private_int %data %int_7 + %376 = OpLoad %int %375 + %377 = OpConvertSToF %float %376 + %378 = OpFDiv %float %377 %float_10 + %379 = OpFAdd %float %float_0_5 %378 + OpStore %grey %379 + OpBranch %371 + %373 = OpLabel + %380 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %381 = OpLoad %float %380 + %382 = OpConvertFToS %int %381 + %384 = OpSLessThan %bool %382 %int_270 + OpSelectionMerge %385 None + OpBranchConditional %384 %386 %387 + %386 = OpLabel + %389 = OpAccessChain %_ptr_Private_int %data %int_8 + %390 = OpLoad %int %389 + %391 = OpConvertSToF %float %390 + %392 = OpFDiv %float %391 %float_10 + %393 = OpFAdd %float %float_0_5 %392 + OpStore %grey %393 + OpBranch %385 + %387 = OpLabel + OpKill + %385 = OpLabel + OpBranch %371 + %371 = OpLabel + OpBranch %357 + %357 = OpLabel + OpBranch %343 + %343 = OpLabel + OpBranch %335 + %335 = OpLabel + OpBranch %322 + %322 = OpLabel + OpBranch %309 + %309 = OpLabel + OpBranch %296 + %296 = OpLabel + OpBranch %281 + %281 = OpLabel + %394 = OpLoad %float %grey + %396 = OpCompositeConstruct %v3float %394 %394 %394 + %397 = OpCompositeExtract %float %396 0 + %398 = OpCompositeExtract %float %396 1 + %399 = OpCompositeExtract %float %396 2 + %401 = OpCompositeConstruct %v4float %397 %398 %399 %float_1 + OpStore %x_GLF_color %401 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %402 +%tint_symbol_1 = OpFunctionParameter %main_out + %406 = OpLabel + %407 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %407 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %132 + %409 = OpLabel + %410 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %410 + %411 = OpFunctionCall %void %main_1 + %413 = OpLoad %v4float %x_GLF_color + %414 = OpCompositeConstruct %main_out %413 + %412 = OpFunctionCall %void %tint_symbol_3 %414 + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %132 + %416 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %427 + %427 = OpLabel + OpLoopMerge %428 %429 None + OpBranch %430 + %430 = OpLabel + %431 = OpLoad %int %m + %432 = OpLoad %int %high + %433 = OpSLessThanEqual %bool %431 %432 + OpSelectionMerge %434 None + OpBranchConditional %433 %435 %436 + %435 = OpLabel + OpBranch %434 + %436 = OpLabel + OpBranch %428 + %434 = OpLabel + %437 = OpLoad %int %low + OpStore %i_2 %437 + OpBranch %438 + %438 = OpLabel + OpLoopMerge %439 %440 None + OpBranch %441 + %441 = OpLabel + %442 = OpLoad %int %i_2 + %443 = OpLoad %int %high + %444 = OpSLessThan %bool %442 %443 + OpSelectionMerge %445 None + OpBranchConditional %444 %446 %447 + %446 = OpLabel + OpBranch %445 + %447 = OpLabel + OpBranch %439 + %445 = OpLabel + %448 = OpLoad %int %i_2 + OpStore %from_1 %448 + %449 = OpLoad %int %i_2 + %450 = OpLoad %int %m + %451 = OpIAdd %int %449 %450 + %452 = OpISub %int %451 %int_1 + OpStore %mid_1 %452 + %453 = OpLoad %int %i_2 + %454 = OpLoad %int %m + %455 = OpLoad %int %high + %457 = OpIMul %int %int_2 %454 + %458 = OpIAdd %int %453 %457 + %459 = OpISub %int %458 %int_1 + %456 = OpExtInst %int %257 SMin %459 %455 + OpStore %to_1 %456 + %460 = OpLoad %int %from_1 + OpStore %param %460 + %461 = OpLoad %int %mid_1 + OpStore %param_1 %461 + %462 = OpLoad %int %to_1 + OpStore %param_2 %462 + %463 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %440 + %440 = OpLabel + %467 = OpLoad %int %m + %468 = OpLoad %int %i_2 + %469 = OpIMul %int %int_2 %467 + %470 = OpIAdd %int %468 %469 + OpStore %i_2 %470 + OpBranch %438 + %439 = OpLabel + OpBranch %429 + %429 = OpLabel + %471 = OpLoad %int %m + %472 = OpIMul %int %int_2 %471 + OpStore %m %472 + OpBranch %427 + %428 = OpLabel + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 157[%157] is not post dominated by the back-edge block 205[%205] + %205 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..bf1622999f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/1.wgsl.expected.wgsl @@ -0,0 +1,366 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_303 : i32 = *(from); + k = x_303; + let x_304 : i32 = *(from); + i = x_304; + let x_305 : i32 = *(mid); + j = (x_305 + 1); + loop { + let x_311 : i32 = i; + let x_312 : i32 = *(mid); + let x_314 : i32 = j; + let x_315 : i32 = *(to); + if (((x_311 <= x_312) && (x_314 <= x_315))) { + } else { + break; + } + let x_319 : i32 = i; + let x_321 : i32 = data[x_319]; + let x_322 : i32 = j; + let x_324 : i32 = data[x_322]; + if ((x_321 < x_324)) { + let x_329 : i32 = k; + k = (x_329 + 1); + let x_331 : i32 = i; + i = (x_331 + 1); + let x_334 : i32 = data[x_331]; + temp[x_329] = x_334; + } else { + let x_336 : i32 = k; + k = (x_336 + 1); + let x_338 : i32 = j; + j = (x_338 + 1); + let x_341 : i32 = data[x_338]; + temp[x_336] = x_341; + } + } + loop { + let x_347 : i32 = i; + let x_349 : i32 = i; + let x_350 : i32 = *(mid); + if (((x_347 < 10) && (x_349 <= x_350))) { + } else { + break; + } + let x_354 : i32 = k; + k = (x_354 + 1); + let x_356 : i32 = i; + i = (x_356 + 1); + let x_359 : i32 = data[x_356]; + temp[x_354] = x_359; + } + let x_361 : i32 = *(from); + i_1 = x_361; + loop { + let x_366 : i32 = i_1; + let x_367 : i32 = *(to); + if ((x_366 <= x_367)) { + } else { + break; + } + let x_370 : i32 = i_1; + let x_371 : i32 = i_1; + let x_373 : i32 = temp[x_371]; + data[x_370] = x_373; + + continuing { + let x_375 : i32 = i_1; + i_1 = (x_375 + 1); + } + } + return; +} + +fn main_1() { + var x_85 : i32; + var x_86 : i32; + var x_87 : i32; + var x_88 : i32; + var x_89 : i32; + var x_90 : i32; + var x_91 : i32; + var x_92 : i32; + var x_93 : i32; + var x_94 : i32; + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_96 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_96); + loop { + let x_102 : i32 = i_3; + switch(x_102) { + case 9: { + let x_132 : i32 = i_3; + data[x_132] = -5; + } + case 8: { + let x_130 : i32 = i_3; + data[x_130] = -4; + } + case 7: { + let x_128 : i32 = i_3; + data[x_128] = -3; + } + case 6: { + let x_126 : i32 = i_3; + data[x_126] = -2; + } + case 5: { + let x_124 : i32 = i_3; + data[x_124] = -1; + } + case 4: { + let x_122 : i32 = i_3; + data[x_122] = 0; + } + case 3: { + let x_120 : i32 = i_3; + data[x_120] = 1; + } + case 2: { + let x_118 : i32 = i_3; + data[x_118] = 2; + } + case 1: { + let x_116 : i32 = i_3; + data[x_116] = 3; + } + case 0: { + let x_114 : i32 = i_3; + data[x_114] = 4; + } + default: { + } + } + let x_134 : i32 = i_3; + i_3 = (x_134 + 1); + + continuing { + let x_136 : i32 = i_3; + if ((x_136 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_142 : i32 = j_1; + if ((x_142 < 10)) { + } else { + break; + } + let x_145 : i32 = j_1; + let x_146 : i32 = j_1; + let x_148 : i32 = data[x_146]; + temp[x_145] = x_148; + + continuing { + let x_150 : i32 = j_1; + j_1 = (x_150 + 1); + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + loop { + let x_156 : i32 = x_92; + let x_157 : i32 = x_93; + if ((x_156 <= x_157)) { + } else { + break; + } + let x_160 : i32 = x_94; + x_91 = x_160; + loop { + let x_165 : i32 = x_91; + let x_166 : i32 = x_93; + if ((x_165 < x_166)) { + } else { + break; + } + let x_169 : i32 = x_91; + x_90 = x_169; + let x_170 : i32 = x_91; + let x_171 : i32 = x_92; + let x_173 : array = data; + data = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + data = x_173; + x_89 = ((x_170 + x_171) - 1); + let x_175 : i32 = x_91; + let x_176 : i32 = x_92; + let x_180 : i32 = x_93; + x_88 = min(((x_175 + (2 * x_176)) - 1), x_180); + let x_182 : i32 = x_90; + x_87 = x_182; + let x_183 : i32 = x_89; + x_86 = x_183; + let x_184 : i32 = x_88; + x_85 = x_184; + merge_i1_i1_i1_(&(x_87), &(x_86), &(x_85)); + + continuing { + let x_186 : i32 = x_92; + let x_188 : i32 = x_91; + x_91 = (x_188 + (2 * x_186)); + } + } + + continuing { + let x_190 : i32 = x_92; + x_92 = (2 * x_190); + } + } + let x_194 : f32 = gl_FragCoord.y; + if ((i32(x_194) < 30)) { + let x_201 : i32 = data[0]; + grey = (0.5 + (f32(x_201) / 10.0)); + } else { + let x_206 : f32 = gl_FragCoord.y; + if ((i32(x_206) < 60)) { + let x_213 : i32 = data[1]; + grey = (0.5 + (f32(x_213) / 10.0)); + } else { + let x_218 : f32 = gl_FragCoord.y; + if ((i32(x_218) < 90)) { + let x_225 : i32 = data[2]; + grey = (0.5 + (f32(x_225) / 10.0)); + } else { + let x_230 : f32 = gl_FragCoord.y; + if ((i32(x_230) < 120)) { + let x_237 : i32 = data[3]; + grey = (0.5 + (f32(x_237) / 10.0)); + } else { + let x_242 : f32 = gl_FragCoord.y; + if ((i32(x_242) < 150)) { + discard; + } else { + let x_249 : f32 = gl_FragCoord.y; + if ((i32(x_249) < 180)) { + let x_256 : i32 = data[5]; + grey = (0.5 + (f32(x_256) / 10.0)); + } else { + let x_261 : f32 = gl_FragCoord.y; + if ((i32(x_261) < 210)) { + let x_268 : i32 = data[6]; + grey = (0.5 + (f32(x_268) / 10.0)); + } else { + let x_273 : f32 = gl_FragCoord.y; + if ((i32(x_273) < 240)) { + let x_280 : i32 = data[7]; + grey = (0.5 + (f32(x_280) / 10.0)); + } else { + let x_285 : f32 = gl_FragCoord.y; + if ((i32(x_285) < 270)) { + let x_292 : i32 = data[8]; + grey = (0.5 + (f32(x_292) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_296 : f32 = grey; + let x_297 : vec3 = vec3(x_296, x_296, x_296); + x_GLF_color = vec4(x_297.x, x_297.y, x_297.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_382 : i32 = m; + let x_383 : i32 = high; + if ((x_382 <= x_383)) { + } else { + break; + } + let x_386 : i32 = low; + i_2 = x_386; + loop { + let x_391 : i32 = i_2; + let x_392 : i32 = high; + if ((x_391 < x_392)) { + } else { + break; + } + let x_395 : i32 = i_2; + from_1 = x_395; + let x_396 : i32 = i_2; + let x_397 : i32 = m; + mid_1 = ((x_396 + x_397) - 1); + let x_400 : i32 = i_2; + let x_401 : i32 = m; + let x_405 : i32 = high; + to_1 = min(((x_400 + (2 * x_401)) - 1), x_405); + let x_407 : i32 = from_1; + param = x_407; + let x_408 : i32 = mid_1; + param_1 = x_408; + let x_409 : i32 = to_1; + param_2 = x_409; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_411 : i32 = m; + let x_413 : i32 = i_2; + i_2 = (x_413 + (2 * x_411)); + } + } + + continuing { + let x_415 : i32 = m; + m = (2 * x_415); + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm new file mode 100644 index 0000000000..c45e451035 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm @@ -0,0 +1,631 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %merge_i1_i1_i1_ "merge(i1;i1;i1;" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %mergeSort_ "mergeSort(" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %temp "temp" + OpName %i_0 "i" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_1 "i" + OpName %from_0 "from" + OpName %mid_0 "mid" + OpName %to_0 "to" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %i_2 "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %j_0 "j" + OpName %gl_FragCoord "gl_FragCoord" + OpName %grey "grey" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %32 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private + %int_10 = OpConstant %int 10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int_30 = OpConstant %int 30 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %int_0_0 = OpConstant %int 0 + %83 = OpConstantComposite %_arr_int_uint_10 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 + %main = OpFunction %void None %32 + %84 = OpLabel + %85 = OpVariable %_ptr_Function_int Function + %86 = OpVariable %_ptr_Function_int Function + %87 = OpVariable %_ptr_Function_int Function + %88 = OpVariable %_ptr_Function_int Function + %89 = OpVariable %_ptr_Function_int Function + %90 = OpVariable %_ptr_Function_int Function + %91 = OpVariable %_ptr_Function_int Function + %92 = OpVariable %_ptr_Function_int Function + %93 = OpVariable %_ptr_Function_int Function + %94 = OpVariable %_ptr_Function_int Function + %i_2 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %grey = OpVariable %_ptr_Function_float Function + %95 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %96 = OpLoad %float %95 + %97 = OpConvertFToS %int %96 + OpStore %i_2 %97 + OpBranch %98 + %98 = OpLabel + OpLoopMerge %99 %100 None + OpBranch %101 + %101 = OpLabel + %102 = OpLoad %int %i_2 + OpSelectionMerge %103 None + OpSwitch %102 %103 0 %104 1 %105 2 %106 3 %107 4 %108 5 %109 6 %110 7 %111 8 %112 9 %113 + %104 = OpLabel + %114 = OpLoad %int %i_2 + %115 = OpAccessChain %_ptr_Private_int %data %114 + OpStore %115 %int_4 + OpBranch %103 + %105 = OpLabel + %116 = OpLoad %int %i_2 + %117 = OpAccessChain %_ptr_Private_int %data %116 + OpStore %117 %int_3 + OpBranch %103 + %106 = OpLabel + %118 = OpLoad %int %i_2 + %119 = OpAccessChain %_ptr_Private_int %data %118 + OpStore %119 %int_2 + OpBranch %103 + %107 = OpLabel + %120 = OpLoad %int %i_2 + %121 = OpAccessChain %_ptr_Private_int %data %120 + OpStore %121 %int_1 + OpBranch %103 + %108 = OpLabel + %122 = OpLoad %int %i_2 + %123 = OpAccessChain %_ptr_Private_int %data %122 + OpStore %123 %int_0 + OpBranch %103 + %109 = OpLabel + %124 = OpLoad %int %i_2 + %125 = OpAccessChain %_ptr_Private_int %data %124 + OpStore %125 %int_n1 + OpBranch %103 + %110 = OpLabel + %126 = OpLoad %int %i_2 + %127 = OpAccessChain %_ptr_Private_int %data %126 + OpStore %127 %int_n2 + OpBranch %103 + %111 = OpLabel + %128 = OpLoad %int %i_2 + %129 = OpAccessChain %_ptr_Private_int %data %128 + OpStore %129 %int_n3 + OpBranch %103 + %112 = OpLabel + %130 = OpLoad %int %i_2 + %131 = OpAccessChain %_ptr_Private_int %data %130 + OpStore %131 %int_n4 + OpBranch %103 + %113 = OpLabel + %132 = OpLoad %int %i_2 + %133 = OpAccessChain %_ptr_Private_int %data %132 + OpStore %133 %int_n5 + OpBranch %103 + %103 = OpLabel + %134 = OpLoad %int %i_2 + %135 = OpIAdd %int %134 %int_1 + OpStore %i_2 %135 + OpBranch %100 + %100 = OpLabel + %136 = OpLoad %int %i_2 + %137 = OpSLessThan %bool %136 %int_10 + OpBranchConditional %137 %98 %99 + %99 = OpLabel + OpStore %j_0 %int_0 + OpBranch %138 + %138 = OpLabel + OpLoopMerge %139 %140 None + OpBranch %141 + %141 = OpLabel + %142 = OpLoad %int %j_0 + %143 = OpSLessThan %bool %142 %int_10 + OpBranchConditional %143 %144 %139 + %144 = OpLabel + %145 = OpLoad %int %j_0 + %146 = OpLoad %int %j_0 + %147 = OpAccessChain %_ptr_Private_int %data %146 + %148 = OpLoad %int %147 + %149 = OpAccessChain %_ptr_Private_int %temp %145 + OpStore %149 %148 + OpBranch %140 + %140 = OpLabel + %150 = OpLoad %int %j_0 + %151 = OpIAdd %int %150 %int_1 + OpStore %j_0 %151 + OpBranch %138 + %139 = OpLabel + OpStore %94 %int_0 + OpStore %93 %int_9 + OpStore %92 %int_1 + OpBranch %152 + %152 = OpLabel + OpLoopMerge %153 %154 None + OpBranch %155 + %155 = OpLabel + %156 = OpLoad %int %92 + %157 = OpLoad %int %93 + %158 = OpSLessThanEqual %bool %156 %157 + OpBranchConditional %158 %159 %153 + %159 = OpLabel + %160 = OpLoad %int %94 + OpStore %91 %160 + OpBranch %161 + %161 = OpLabel + OpLoopMerge %162 %163 None + OpBranch %164 + %164 = OpLabel + %165 = OpLoad %int %91 + %166 = OpLoad %int %93 + %167 = OpSLessThan %bool %165 %166 + OpBranchConditional %167 %168 %162 + %168 = OpLabel + %169 = OpLoad %int %91 + OpStore %90 %169 + %170 = OpLoad %int %91 + %171 = OpLoad %int %92 + %172 = OpIAdd %int %170 %171 + %173 = OpISub %int %172 %int_1 + OpStore %89 %173 + %174 = OpLoad %int %91 + %175 = OpLoad %int %92 + %176 = OpIMul %int %int_2 %175 + %177 = OpIAdd %int %174 %176 + %178 = OpISub %int %177 %int_1 + %179 = OpLoad %int %93 + %180 = OpExtInst %int %1 SMin %178 %179 + OpStore %88 %180 + %181 = OpLoad %int %90 + OpStore %87 %181 + %182 = OpLoad %int %89 + OpStore %86 %182 + %183 = OpLoad %int %88 + OpStore %85 %183 + %184 = OpFunctionCall %void %merge_i1_i1_i1_ %87 %86 %85 + OpBranch %163 + %163 = OpLabel + %185 = OpLoad %int %92 + %186 = OpIMul %int %int_2 %185 + %187 = OpLoad %int %91 + %188 = OpIAdd %int %187 %186 + OpStore %91 %188 + OpBranch %161 + %162 = OpLabel + OpBranch %154 + %154 = OpLabel + %189 = OpLoad %int %92 + %190 = OpIMul %int %int_2 %189 + OpStore %92 %190 + OpBranch %152 + %153 = OpLabel + OpBranch %191 + %191 = OpLabel + %192 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %193 = OpLoad %float %192 + %194 = OpConvertFToS %int %193 + %195 = OpSLessThan %bool %194 %int_30 + OpSelectionMerge %196 None + OpBranchConditional %195 %197 %198 + %197 = OpLabel + %199 = OpAccessChain %_ptr_Private_int %data %int_0 + %200 = OpLoad %int %199 + %201 = OpConvertSToF %float %200 + %202 = OpFDiv %float %201 %float_10 + %203 = OpFAdd %float %float_0_5 %202 + OpStore %grey %203 + OpBranch %196 + %198 = OpLabel + %204 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %205 = OpLoad %float %204 + %206 = OpConvertFToS %int %205 + %207 = OpSLessThan %bool %206 %int_60 + OpSelectionMerge %208 None + OpBranchConditional %207 %209 %210 + %209 = OpLabel + %211 = OpAccessChain %_ptr_Private_int %data %int_1 + %212 = OpLoad %int %211 + %213 = OpConvertSToF %float %212 + %214 = OpFDiv %float %213 %float_10 + %215 = OpFAdd %float %float_0_5 %214 + OpStore %grey %215 + OpBranch %208 + %210 = OpLabel + %216 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %217 = OpLoad %float %216 + %218 = OpConvertFToS %int %217 + %219 = OpSLessThan %bool %218 %int_90 + OpSelectionMerge %220 None + OpBranchConditional %219 %221 %222 + %221 = OpLabel + %223 = OpAccessChain %_ptr_Private_int %data %int_2 + %224 = OpLoad %int %223 + %225 = OpConvertSToF %float %224 + %226 = OpFDiv %float %225 %float_10 + %227 = OpFAdd %float %float_0_5 %226 + OpStore %grey %227 + OpBranch %220 + %222 = OpLabel + %228 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %229 = OpLoad %float %228 + %230 = OpConvertFToS %int %229 + %231 = OpSLessThan %bool %230 %int_120 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %234 + %233 = OpLabel + %235 = OpAccessChain %_ptr_Private_int %data %int_3 + %236 = OpLoad %int %235 + %237 = OpConvertSToF %float %236 + %238 = OpFDiv %float %237 %float_10 + %239 = OpFAdd %float %float_0_5 %238 + OpStore %grey %239 + OpBranch %232 + %234 = OpLabel + %240 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %241 = OpLoad %float %240 + %242 = OpConvertFToS %int %241 + %243 = OpSLessThan %bool %242 %int_150 + OpSelectionMerge %244 None + OpBranchConditional %243 %245 %246 + %245 = OpLabel + OpKill + %246 = OpLabel + %247 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %248 = OpLoad %float %247 + %249 = OpConvertFToS %int %248 + %250 = OpSLessThan %bool %249 %int_180 + OpSelectionMerge %251 None + OpBranchConditional %250 %252 %253 + %252 = OpLabel + %254 = OpAccessChain %_ptr_Private_int %data %int_5 + %255 = OpLoad %int %254 + %256 = OpConvertSToF %float %255 + %257 = OpFDiv %float %256 %float_10 + %258 = OpFAdd %float %float_0_5 %257 + OpStore %grey %258 + OpBranch %251 + %253 = OpLabel + %259 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %260 = OpLoad %float %259 + %261 = OpConvertFToS %int %260 + %262 = OpSLessThan %bool %261 %int_210 + OpSelectionMerge %263 None + OpBranchConditional %262 %264 %265 + %264 = OpLabel + %266 = OpAccessChain %_ptr_Private_int %data %int_6 + %267 = OpLoad %int %266 + %268 = OpConvertSToF %float %267 + %269 = OpFDiv %float %268 %float_10 + %270 = OpFAdd %float %float_0_5 %269 + OpStore %grey %270 + OpBranch %263 + %265 = OpLabel + %271 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %272 = OpLoad %float %271 + %273 = OpConvertFToS %int %272 + %274 = OpSLessThan %bool %273 %int_240 + OpSelectionMerge %275 None + OpBranchConditional %274 %276 %277 + %276 = OpLabel + %278 = OpAccessChain %_ptr_Private_int %data %int_7 + %279 = OpLoad %int %278 + %280 = OpConvertSToF %float %279 + %281 = OpFDiv %float %280 %float_10 + %282 = OpFAdd %float %float_0_5 %281 + OpStore %grey %282 + OpBranch %275 + %277 = OpLabel + %283 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %284 = OpLoad %float %283 + %285 = OpConvertFToS %int %284 + %286 = OpSLessThan %bool %285 %int_270 + OpSelectionMerge %287 None + OpBranchConditional %286 %288 %289 + %288 = OpLabel + %290 = OpAccessChain %_ptr_Private_int %data %int_8 + %291 = OpLoad %int %290 + %292 = OpConvertSToF %float %291 + %293 = OpFDiv %float %292 %float_10 + %294 = OpFAdd %float %float_0_5 %293 + OpStore %grey %294 + OpBranch %287 + %289 = OpLabel + OpKill + %287 = OpLabel + OpBranch %275 + %275 = OpLabel + OpBranch %263 + %263 = OpLabel + OpBranch %251 + %251 = OpLabel + OpBranch %244 + %244 = OpLabel + OpBranch %232 + %232 = OpLabel + OpBranch %220 + %220 = OpLabel + OpBranch %208 + %208 = OpLabel + OpBranch %196 + %196 = OpLabel + %295 = OpLoad %float %grey + %296 = OpCompositeConstruct %v3float %295 %295 %295 + %297 = OpCompositeExtract %float %296 0 + %298 = OpCompositeExtract %float %296 1 + %299 = OpCompositeExtract %float %296 2 + %300 = OpCompositeConstruct %v4float %297 %298 %299 %float_1 + OpStore %_GLF_color %300 + OpReturn + OpFunctionEnd +%merge_i1_i1_i1_ = OpFunction %void None %35 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %301 = OpLabel + %k = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %302 = OpLoad %int %from + OpStore %k %302 + %303 = OpLoad %int %from + OpStore %i %303 + %304 = OpLoad %int %mid + %305 = OpIAdd %int %304 %int_1 + OpStore %j %305 + OpBranch %306 + %306 = OpLabel + OpLoopMerge %307 %308 None + OpBranch %309 + %309 = OpLabel + %310 = OpLoad %int %i + %311 = OpLoad %int %mid + %312 = OpSLessThanEqual %bool %310 %311 + %313 = OpLoad %int %j + %314 = OpLoad %int %to + %315 = OpSLessThanEqual %bool %313 %314 + %316 = OpLogicalAnd %bool %312 %315 + OpBranchConditional %316 %317 %307 + %317 = OpLabel + %318 = OpLoad %int %i + %319 = OpAccessChain %_ptr_Private_int %data %318 + %320 = OpLoad %int %319 + %321 = OpLoad %int %j + %322 = OpAccessChain %_ptr_Private_int %data %321 + %323 = OpLoad %int %322 + %324 = OpSLessThan %bool %320 %323 + OpSelectionMerge %325 None + OpBranchConditional %324 %326 %327 + %326 = OpLabel + %328 = OpLoad %int %k + %329 = OpIAdd %int %328 %int_1 + OpStore %k %329 + %330 = OpLoad %int %i + %331 = OpIAdd %int %330 %int_1 + OpStore %i %331 + %332 = OpAccessChain %_ptr_Private_int %data %330 + %333 = OpLoad %int %332 + %334 = OpAccessChain %_ptr_Private_int %temp %328 + OpStore %334 %333 + OpBranch %325 + %327 = OpLabel + %335 = OpLoad %int %k + %336 = OpIAdd %int %335 %int_1 + OpStore %k %336 + %337 = OpLoad %int %j + %338 = OpIAdd %int %337 %int_1 + OpStore %j %338 + %339 = OpAccessChain %_ptr_Private_int %data %337 + %340 = OpLoad %int %339 + %341 = OpAccessChain %_ptr_Private_int %temp %335 + OpStore %341 %340 + OpBranch %325 + %325 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %306 + %307 = OpLabel + OpBranch %342 + %342 = OpLabel + OpLoopMerge %343 %344 None + OpBranch %345 + %345 = OpLabel + %346 = OpLoad %int %i + %347 = OpSLessThan %bool %346 %int_10 + %348 = OpLoad %int %i + %349 = OpLoad %int %mid + %350 = OpSLessThanEqual %bool %348 %349 + %351 = OpLogicalAnd %bool %347 %350 + OpBranchConditional %351 %352 %343 + %352 = OpLabel + %353 = OpLoad %int %k + %354 = OpIAdd %int %353 %int_1 + OpStore %k %354 + %355 = OpLoad %int %i + %356 = OpIAdd %int %355 %int_1 + OpStore %i %356 + %357 = OpAccessChain %_ptr_Private_int %data %355 + %358 = OpLoad %int %357 + %359 = OpAccessChain %_ptr_Private_int %temp %353 + OpStore %359 %358 + OpBranch %344 + %344 = OpLabel + OpBranch %342 + %343 = OpLabel + %360 = OpLoad %int %from + OpStore %i_0 %360 + OpBranch %361 + %361 = OpLabel + OpLoopMerge %362 %363 None + OpBranch %364 + %364 = OpLabel + %365 = OpLoad %int %i_0 + %366 = OpLoad %int %to + %367 = OpSLessThanEqual %bool %365 %366 + OpBranchConditional %367 %368 %362 + %368 = OpLabel + %369 = OpLoad %int %i_0 + %370 = OpLoad %int %i_0 + %371 = OpAccessChain %_ptr_Private_int %temp %370 + %372 = OpLoad %int %371 + %373 = OpAccessChain %_ptr_Private_int %data %369 + OpStore %373 %372 + OpBranch %363 + %363 = OpLabel + %374 = OpLoad %int %i_0 + %375 = OpIAdd %int %374 %int_1 + OpStore %i_0 %375 + OpBranch %361 + %362 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %32 + %376 = OpLabel + %low = OpVariable %_ptr_Function_int Function + %high = OpVariable %_ptr_Function_int Function + %m = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %from_0 = OpVariable %_ptr_Function_int Function + %mid_0 = OpVariable %_ptr_Function_int Function + %to_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %377 + %377 = OpLabel + OpLoopMerge %378 %379 None + OpBranch %380 + %380 = OpLabel + %381 = OpLoad %int %m + %382 = OpLoad %int %high + %383 = OpSLessThanEqual %bool %381 %382 + OpBranchConditional %383 %384 %378 + %384 = OpLabel + %385 = OpLoad %int %low + OpStore %i_1 %385 + OpBranch %386 + %386 = OpLabel + OpLoopMerge %387 %388 None + OpBranch %389 + %389 = OpLabel + %390 = OpLoad %int %i_1 + %391 = OpLoad %int %high + %392 = OpSLessThan %bool %390 %391 + OpBranchConditional %392 %393 %387 + %393 = OpLabel + %394 = OpLoad %int %i_1 + OpStore %from_0 %394 + %395 = OpLoad %int %i_1 + %396 = OpLoad %int %m + %397 = OpIAdd %int %395 %396 + %398 = OpISub %int %397 %int_1 + OpStore %mid_0 %398 + %399 = OpLoad %int %i_1 + %400 = OpLoad %int %m + %401 = OpIMul %int %int_2 %400 + %402 = OpIAdd %int %399 %401 + %403 = OpISub %int %402 %int_1 + %404 = OpLoad %int %high + %405 = OpExtInst %int %1 SMin %403 %404 + OpStore %to_0 %405 + %406 = OpLoad %int %from_0 + OpStore %param %406 + %407 = OpLoad %int %mid_0 + OpStore %param_0 %407 + %408 = OpLoad %int %to_0 + OpStore %param_1 %408 + %409 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_0 %param_1 + OpBranch %388 + %388 = OpLabel + %410 = OpLoad %int %m + %411 = OpIMul %int %int_2 %410 + %412 = OpLoad %int %i_1 + %413 = OpIAdd %int %412 %411 + OpStore %i_1 %413 + OpBranch %386 + %387 = OpLabel + OpBranch %379 + %379 = OpLabel + %414 = OpLoad %int %m + %415 = OpIMul %int %int_2 %414 + OpStore %m %415 + OpBranch %377 + %378 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.hlsl new file mode 100644 index 0000000000..30e945e64d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.hlsl @@ -0,0 +1,296 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_302 = from; + k = x_302; + const int x_303 = from; + i = x_303; + const int x_304 = mid; + j = (x_304 + 1); + while (true) { + const int x_310 = i; + const int x_311 = mid; + const int x_313 = j; + const int x_314 = to; + bool tint_tmp = (x_310 <= x_311); + if (tint_tmp) { + tint_tmp = (x_313 <= x_314); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_320 = data[i]; + const int x_323 = data[j]; + if ((x_320 < x_323)) { + const int x_328 = k; + k = (x_328 + 1); + const int x_330 = i; + i = (x_330 + 1); + const int x_333 = data[x_330]; + temp[x_328] = x_333; + } else { + const int x_335 = k; + k = (x_335 + 1); + const int x_337 = j; + j = (x_337 + 1); + const int x_340 = data[x_337]; + temp[x_335] = x_340; + } + } + while (true) { + const int x_346 = i; + const int x_348 = i; + const int x_349 = mid; + bool tint_tmp_1 = (x_346 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_348 <= x_349); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_353 = k; + k = (x_353 + 1); + const int x_355 = i; + i = (x_355 + 1); + const int x_358 = data[x_355]; + temp[x_353] = x_358; + } + const int x_360 = from; + i_1 = x_360; + while (true) { + const int x_365 = i_1; + const int x_366 = to; + if ((x_365 <= x_366)) { + } else { + break; + } + const int x_369 = i_1; + const int x_372 = temp[i_1]; + data[x_369] = x_372; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void main_1() { + int x_85 = 0; + int x_86 = 0; + int x_87 = 0; + int x_88 = 0; + int x_89 = 0; + int x_90 = 0; + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94 = 0; + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_96 = asfloat(x_28[0].x); + i_3 = int(x_96); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_145 = j_1; + const int x_148 = data[j_1]; + temp[x_145] = x_148; + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + { + for(; (x_92 <= x_93); x_92 = (2 * x_92)) { + x_91 = x_94; + { + for(; (x_91 < x_93); x_91 = (x_91 + (2 * x_92))) { + x_90 = x_91; + x_89 = ((x_91 + x_92) - 1); + x_88 = min(((x_91 + (2 * x_92)) - 1), x_93); + x_87 = x_90; + x_86 = x_89; + x_85 = x_88; + merge_i1_i1_i1_(x_87, x_86, x_85); + } + } + } + } + const float x_193 = gl_FragCoord.y; + if ((int(x_193) < 30)) { + const int x_200 = data[0]; + grey = (0.5f + (float(x_200) / 10.0f)); + } else { + const float x_205 = gl_FragCoord.y; + if ((int(x_205) < 60)) { + const int x_212 = data[1]; + grey = (0.5f + (float(x_212) / 10.0f)); + } else { + const float x_217 = gl_FragCoord.y; + if ((int(x_217) < 90)) { + const int x_224 = data[2]; + grey = (0.5f + (float(x_224) / 10.0f)); + } else { + const float x_229 = gl_FragCoord.y; + if ((int(x_229) < 120)) { + const int x_236 = data[3]; + grey = (0.5f + (float(x_236) / 10.0f)); + } else { + const float x_241 = gl_FragCoord.y; + if ((int(x_241) < 150)) { + discard; + } else { + const float x_248 = gl_FragCoord.y; + if ((int(x_248) < 180)) { + const int x_255 = data[5]; + grey = (0.5f + (float(x_255) / 10.0f)); + } else { + const float x_260 = gl_FragCoord.y; + if ((int(x_260) < 210)) { + const int x_267 = data[6]; + grey = (0.5f + (float(x_267) / 10.0f)); + } else { + const float x_272 = gl_FragCoord.y; + if ((int(x_272) < 240)) { + const int x_279 = data[7]; + grey = (0.5f + (float(x_279) / 10.0f)); + } else { + const float x_284 = gl_FragCoord.y; + if ((int(x_284) < 270)) { + const int x_291 = data[8]; + grey = (0.5f + (float(x_291) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_295 = grey; + const float3 x_296 = float3(x_295, x_295, x_295); + x_GLF_color = float4(x_296.x, x_296.y, x_296.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.msl new file mode 100644 index 0000000000..a550d0fd12 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.msl @@ -0,0 +1,369 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_302 = *(from); + k = x_302; + int const x_303 = *(from); + i = x_303; + int const x_304 = *(mid); + j = (x_304 + 1); + while (true) { + int const x_310 = i; + int const x_311 = *(mid); + int const x_313 = j; + int const x_314 = *(to); + if (((x_310 <= x_311) && (x_313 <= x_314))) { + } else { + break; + } + int const x_318 = i; + int const x_320 = (*(tint_symbol_5)).arr[x_318]; + int const x_321 = j; + int const x_323 = (*(tint_symbol_5)).arr[x_321]; + if ((x_320 < x_323)) { + int const x_328 = k; + k = (x_328 + 1); + int const x_330 = i; + i = (x_330 + 1); + int const x_333 = (*(tint_symbol_5)).arr[x_330]; + (*(tint_symbol_6)).arr[x_328] = x_333; + } else { + int const x_335 = k; + k = (x_335 + 1); + int const x_337 = j; + j = (x_337 + 1); + int const x_340 = (*(tint_symbol_5)).arr[x_337]; + (*(tint_symbol_6)).arr[x_335] = x_340; + } + } + while (true) { + int const x_346 = i; + int const x_348 = i; + int const x_349 = *(mid); + if (((x_346 < 10) && (x_348 <= x_349))) { + } else { + break; + } + int const x_353 = k; + k = (x_353 + 1); + int const x_355 = i; + i = (x_355 + 1); + int const x_358 = (*(tint_symbol_5)).arr[x_355]; + (*(tint_symbol_6)).arr[x_353] = x_358; + } + int const x_360 = *(from); + i_1 = x_360; + while (true) { + int const x_365 = i_1; + int const x_366 = *(to); + if ((x_365 <= x_366)) { + } else { + break; + } + int const x_369 = i_1; + int const x_370 = i_1; + int const x_372 = (*(tint_symbol_6)).arr[x_370]; + (*(tint_symbol_5)).arr[x_369] = x_372; + { + int const x_374 = i_1; + i_1 = (x_374 + 1); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + int x_85 = 0; + int x_86 = 0; + int x_87 = 0; + int x_88 = 0; + int x_89 = 0; + int x_90 = 0; + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94 = 0; + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_96 = x_28.injectionSwitch.x; + i_3 = int(x_96); + while (true) { + int const x_102 = i_3; + switch(x_102) { + case 9: { + int const x_132 = i_3; + (*(tint_symbol_7)).arr[x_132] = -5; + break; + } + case 8: { + int const x_130 = i_3; + (*(tint_symbol_7)).arr[x_130] = -4; + break; + } + case 7: { + int const x_128 = i_3; + (*(tint_symbol_7)).arr[x_128] = -3; + break; + } + case 6: { + int const x_126 = i_3; + (*(tint_symbol_7)).arr[x_126] = -2; + break; + } + case 5: { + int const x_124 = i_3; + (*(tint_symbol_7)).arr[x_124] = -1; + break; + } + case 4: { + int const x_122 = i_3; + (*(tint_symbol_7)).arr[x_122] = 0; + break; + } + case 3: { + int const x_120 = i_3; + (*(tint_symbol_7)).arr[x_120] = 1; + break; + } + case 2: { + int const x_118 = i_3; + (*(tint_symbol_7)).arr[x_118] = 2; + break; + } + case 1: { + int const x_116 = i_3; + (*(tint_symbol_7)).arr[x_116] = 3; + break; + } + case 0: { + int const x_114 = i_3; + (*(tint_symbol_7)).arr[x_114] = 4; + break; + } + default: { + break; + } + } + int const x_134 = i_3; + i_3 = (x_134 + 1); + { + int const x_136 = i_3; + if ((x_136 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_142 = j_1; + if ((x_142 < 10)) { + } else { + break; + } + int const x_145 = j_1; + int const x_146 = j_1; + int const x_148 = (*(tint_symbol_7)).arr[x_146]; + (*(tint_symbol_8)).arr[x_145] = x_148; + { + int const x_150 = j_1; + j_1 = (x_150 + 1); + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + while (true) { + int const x_156 = x_92; + int const x_157 = x_93; + if ((x_156 <= x_157)) { + } else { + break; + } + int const x_160 = x_94; + x_91 = x_160; + while (true) { + int const x_165 = x_91; + int const x_166 = x_93; + if ((x_165 < x_166)) { + } else { + break; + } + int const x_169 = x_91; + x_90 = x_169; + int const x_170 = x_91; + int const x_171 = x_92; + x_89 = ((x_170 + x_171) - 1); + int const x_174 = x_91; + int const x_175 = x_92; + int const x_179 = x_93; + x_88 = min(((x_174 + (2 * x_175)) - 1), x_179); + int const x_181 = x_90; + x_87 = x_181; + int const x_182 = x_89; + x_86 = x_182; + int const x_183 = x_88; + x_85 = x_183; + merge_i1_i1_i1_(&(x_87), &(x_86), &(x_85), tint_symbol_7, tint_symbol_8); + { + int const x_185 = x_92; + int const x_187 = x_91; + x_91 = (x_187 + (2 * x_185)); + } + } + { + int const x_189 = x_92; + x_92 = (2 * x_189); + } + } + float const x_193 = (*(tint_symbol_9)).y; + if ((int(x_193) < 30)) { + int const x_200 = (*(tint_symbol_7)).arr[0]; + grey = (0.5f + (float(x_200) / 10.0f)); + } else { + float const x_205 = (*(tint_symbol_9)).y; + if ((int(x_205) < 60)) { + int const x_212 = (*(tint_symbol_7)).arr[1]; + grey = (0.5f + (float(x_212) / 10.0f)); + } else { + float const x_217 = (*(tint_symbol_9)).y; + if ((int(x_217) < 90)) { + int const x_224 = (*(tint_symbol_7)).arr[2]; + grey = (0.5f + (float(x_224) / 10.0f)); + } else { + float const x_229 = (*(tint_symbol_9)).y; + if ((int(x_229) < 120)) { + int const x_236 = (*(tint_symbol_7)).arr[3]; + grey = (0.5f + (float(x_236) / 10.0f)); + } else { + float const x_241 = (*(tint_symbol_9)).y; + if ((int(x_241) < 150)) { + discard_fragment(); + } else { + float const x_248 = (*(tint_symbol_9)).y; + if ((int(x_248) < 180)) { + int const x_255 = (*(tint_symbol_7)).arr[5]; + grey = (0.5f + (float(x_255) / 10.0f)); + } else { + float const x_260 = (*(tint_symbol_9)).y; + if ((int(x_260) < 210)) { + int const x_267 = (*(tint_symbol_7)).arr[6]; + grey = (0.5f + (float(x_267) / 10.0f)); + } else { + float const x_272 = (*(tint_symbol_9)).y; + if ((int(x_272) < 240)) { + int const x_279 = (*(tint_symbol_7)).arr[7]; + grey = (0.5f + (float(x_279) / 10.0f)); + } else { + float const x_284 = (*(tint_symbol_9)).y; + if ((int(x_284) < 270)) { + int const x_291 = (*(tint_symbol_7)).arr[8]; + grey = (0.5f + (float(x_291) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_295 = grey; + float3 const x_296 = float3(x_295, x_295, x_295); + *(tint_symbol_10) = float4(x_296.x, x_296.y, x_296.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread tint_array_wrapper tint_symbol_12 = {}; + thread tint_array_wrapper tint_symbol_13 = {}; + thread float4 tint_symbol_14 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_12), &(tint_symbol_13), &(tint_symbol_11), &(tint_symbol_14)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_14}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_15, thread tint_array_wrapper* const tint_symbol_16) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_381 = m; + int const x_382 = high; + if ((x_381 <= x_382)) { + } else { + break; + } + int const x_385 = low; + i_2 = x_385; + while (true) { + int const x_390 = i_2; + int const x_391 = high; + if ((x_390 < x_391)) { + } else { + break; + } + int const x_394 = i_2; + from_1 = x_394; + int const x_395 = i_2; + int const x_396 = m; + mid_1 = ((x_395 + x_396) - 1); + int const x_399 = i_2; + int const x_400 = m; + int const x_404 = high; + to_1 = min(((x_399 + (2 * x_400)) - 1), x_404); + int const x_406 = from_1; + param = x_406; + int const x_407 = mid_1; + param_1 = x_407; + int const x_408 = to_1; + param_2 = x_408; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_15, tint_symbol_16); + { + int const x_410 = m; + int const x_412 = i_2; + i_2 = (x_412 + (2 * x_410)); + } + } + { + int const x_414 = m; + m = (2 * x_414); + } + } + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.spvasm new file mode 100644 index 0000000000..5cce2a6fa2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.spvasm @@ -0,0 +1,741 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 471 +; Schema: 0 + OpCapability Shader + %255 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %main_1 "main_1" + OpName %x_85 "x_85" + OpName %x_86 "x_86" + OpName %x_87 "x_87" + OpName %x_88 "x_88" + OpName %x_89 "x_89" + OpName %x_90 "x_90" + OpName %x_91 "x_91" + OpName %x_92 "x_92" + OpName %x_93 "x_93" + OpName %x_94 "x_94" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %132 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %149 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %400 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpLoad %int %mid + %51 = OpLoad %int %j + %53 = OpLoad %int %to + %54 = OpSLessThanEqual %bool %48 %50 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %58 = OpSLessThanEqual %bool %51 %53 + OpBranch %56 + %56 = OpLabel + %59 = OpPhi %bool %54 %47 %58 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %45 + %60 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Private_int %data %63 + %66 = OpLoad %int %65 + %67 = OpLoad %int %j + %68 = OpAccessChain %_ptr_Private_int %data %67 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %k + %75 = OpIAdd %int %74 %int_1 + OpStore %k %75 + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + %78 = OpAccessChain %_ptr_Private_int %data %76 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Private_int %temp %74 + OpStore %80 %79 + OpBranch %71 + %73 = OpLabel + %81 = OpLoad %int %k + %82 = OpIAdd %int %81 %int_1 + OpStore %k %82 + %83 = OpLoad %int %j + %84 = OpIAdd %int %83 %int_1 + OpStore %j %84 + %85 = OpAccessChain %_ptr_Private_int %data %83 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Private_int %temp %81 + OpStore %87 %86 + OpBranch %71 + %71 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpLoad %int %i + %95 = OpLoad %int %mid + %97 = OpSLessThan %bool %92 %int_10 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSLessThanEqual %bool %93 %95 + OpBranch %98 + %98 = OpLabel + %101 = OpPhi %bool %97 %91 %100 %99 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpBranch %102 + %104 = OpLabel + OpBranch %89 + %102 = OpLabel + %105 = OpLoad %int %k + %106 = OpIAdd %int %105 %int_1 + OpStore %k %106 + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + %109 = OpAccessChain %_ptr_Private_int %data %107 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Private_int %temp %105 + OpStore %111 %110 + OpBranch %90 + %90 = OpLabel + OpBranch %88 + %89 = OpLabel + %113 = OpLoad %int %from + OpStore %i_1 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpLoad %int %to + %121 = OpSLessThanEqual %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + OpBranch %122 + %124 = OpLabel + OpBranch %115 + %122 = OpLabel + %125 = OpLoad %int %i_1 + %126 = OpLoad %int %i_1 + %127 = OpAccessChain %_ptr_Private_int %temp %126 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %129 %128 + OpBranch %116 + %116 = OpLabel + %130 = OpLoad %int %i_1 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_1 %131 + OpBranch %114 + %115 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %132 + %134 = OpLabel + %x_85 = OpVariable %_ptr_Function_int Function %32 + %x_86 = OpVariable %_ptr_Function_int Function %32 + %x_87 = OpVariable %_ptr_Function_int Function %32 + %x_88 = OpVariable %_ptr_Function_int Function %32 + %x_89 = OpVariable %_ptr_Function_int Function %32 + %x_90 = OpVariable %_ptr_Function_int Function %32 + %x_91 = OpVariable %_ptr_Function_int Function %32 + %x_92 = OpVariable %_ptr_Function_int Function %32 + %x_93 = OpVariable %_ptr_Function_int Function %32 + %x_94 = OpVariable %_ptr_Function_int Function %32 + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %149 + %152 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %153 = OpLoad %float %152 + %154 = OpConvertFToS %int %153 + OpStore %i_3 %154 + OpBranch %155 + %155 = OpLabel + OpLoopMerge %156 %157 None + OpBranch %158 + %158 = OpLabel + %159 = OpLoad %int %i_3 + OpSelectionMerge %160 None + OpSwitch %159 %161 9 %162 8 %163 7 %164 6 %165 5 %166 4 %167 3 %168 2 %169 1 %170 0 %171 + %162 = OpLabel + %172 = OpLoad %int %i_3 + %173 = OpAccessChain %_ptr_Private_int %data %172 + OpStore %173 %int_n5 + OpBranch %160 + %163 = OpLabel + %175 = OpLoad %int %i_3 + %176 = OpAccessChain %_ptr_Private_int %data %175 + OpStore %176 %int_n4 + OpBranch %160 + %164 = OpLabel + %178 = OpLoad %int %i_3 + %179 = OpAccessChain %_ptr_Private_int %data %178 + OpStore %179 %int_n3 + OpBranch %160 + %165 = OpLabel + %181 = OpLoad %int %i_3 + %182 = OpAccessChain %_ptr_Private_int %data %181 + OpStore %182 %int_n2 + OpBranch %160 + %166 = OpLabel + %184 = OpLoad %int %i_3 + %185 = OpAccessChain %_ptr_Private_int %data %184 + OpStore %185 %int_n1 + OpBranch %160 + %167 = OpLabel + %187 = OpLoad %int %i_3 + %188 = OpAccessChain %_ptr_Private_int %data %187 + OpStore %188 %int_0 + OpBranch %160 + %168 = OpLabel + %190 = OpLoad %int %i_3 + %191 = OpAccessChain %_ptr_Private_int %data %190 + OpStore %191 %int_1 + OpBranch %160 + %169 = OpLabel + %192 = OpLoad %int %i_3 + %193 = OpAccessChain %_ptr_Private_int %data %192 + OpStore %193 %int_2 + OpBranch %160 + %170 = OpLabel + %195 = OpLoad %int %i_3 + %196 = OpAccessChain %_ptr_Private_int %data %195 + OpStore %196 %int_3 + OpBranch %160 + %171 = OpLabel + %198 = OpLoad %int %i_3 + %199 = OpAccessChain %_ptr_Private_int %data %198 + OpStore %199 %int_4 + OpBranch %160 + %161 = OpLabel + OpBranch %160 + %160 = OpLabel + %201 = OpLoad %int %i_3 + %202 = OpIAdd %int %201 %int_1 + OpStore %i_3 %202 + OpBranch %157 + %157 = OpLabel + %203 = OpLoad %int %i_3 + %204 = OpSLessThan %bool %203 %int_10 + OpSelectionMerge %205 None + OpBranchConditional %204 %206 %207 + %206 = OpLabel + OpBranch %205 + %207 = OpLabel + OpBranch %156 + %205 = OpLabel + OpBranch %155 + %156 = OpLabel + OpStore %j_1 %int_0 + OpBranch %208 + %208 = OpLabel + OpLoopMerge %209 %210 None + OpBranch %211 + %211 = OpLabel + %212 = OpLoad %int %j_1 + %213 = OpSLessThan %bool %212 %int_10 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %209 + %214 = OpLabel + %217 = OpLoad %int %j_1 + %218 = OpLoad %int %j_1 + %219 = OpAccessChain %_ptr_Private_int %data %218 + %220 = OpLoad %int %219 + %221 = OpAccessChain %_ptr_Private_int %temp %217 + OpStore %221 %220 + OpBranch %210 + %210 = OpLabel + %222 = OpLoad %int %j_1 + %223 = OpIAdd %int %222 %int_1 + OpStore %j_1 %223 + OpBranch %208 + %209 = OpLabel + OpStore %x_94 %int_0 + OpStore %x_93 %int_9 + OpStore %x_92 %int_1 + OpBranch %225 + %225 = OpLabel + OpLoopMerge %226 %227 None + OpBranch %228 + %228 = OpLabel + %229 = OpLoad %int %x_92 + %230 = OpLoad %int %x_93 + %231 = OpSLessThanEqual %bool %229 %230 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %234 + %233 = OpLabel + OpBranch %232 + %234 = OpLabel + OpBranch %226 + %232 = OpLabel + %235 = OpLoad %int %x_94 + OpStore %x_91 %235 + OpBranch %236 + %236 = OpLabel + OpLoopMerge %237 %238 None + OpBranch %239 + %239 = OpLabel + %240 = OpLoad %int %x_91 + %241 = OpLoad %int %x_93 + %242 = OpSLessThan %bool %240 %241 + OpSelectionMerge %243 None + OpBranchConditional %242 %244 %245 + %244 = OpLabel + OpBranch %243 + %245 = OpLabel + OpBranch %237 + %243 = OpLabel + %246 = OpLoad %int %x_91 + OpStore %x_90 %246 + %247 = OpLoad %int %x_91 + %248 = OpLoad %int %x_92 + %249 = OpIAdd %int %247 %248 + %250 = OpISub %int %249 %int_1 + OpStore %x_89 %250 + %251 = OpLoad %int %x_91 + %252 = OpLoad %int %x_92 + %253 = OpLoad %int %x_93 + %256 = OpIMul %int %int_2 %252 + %257 = OpIAdd %int %251 %256 + %258 = OpISub %int %257 %int_1 + %254 = OpExtInst %int %255 SMin %258 %253 + OpStore %x_88 %254 + %259 = OpLoad %int %x_90 + OpStore %x_87 %259 + %260 = OpLoad %int %x_89 + OpStore %x_86 %260 + %261 = OpLoad %int %x_88 + OpStore %x_85 %261 + %262 = OpFunctionCall %void %merge_i1_i1_i1_ %x_87 %x_86 %x_85 + OpBranch %238 + %238 = OpLabel + %266 = OpLoad %int %x_92 + %267 = OpLoad %int %x_91 + %268 = OpIMul %int %int_2 %266 + %269 = OpIAdd %int %267 %268 + OpStore %x_91 %269 + OpBranch %236 + %237 = OpLabel + OpBranch %227 + %227 = OpLabel + %270 = OpLoad %int %x_92 + %271 = OpIMul %int %int_2 %270 + OpStore %x_92 %271 + OpBranch %225 + %226 = OpLabel + %274 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %275 = OpLoad %float %274 + %276 = OpConvertFToS %int %275 + %278 = OpSLessThan %bool %276 %int_30 + OpSelectionMerge %279 None + OpBranchConditional %278 %280 %281 + %280 = OpLabel + %282 = OpAccessChain %_ptr_Private_int %data %int_0 + %283 = OpLoad %int %282 + %285 = OpConvertSToF %float %283 + %287 = OpFDiv %float %285 %float_10 + %288 = OpFAdd %float %float_0_5 %287 + OpStore %grey %288 + OpBranch %279 + %281 = OpLabel + %289 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %290 = OpLoad %float %289 + %291 = OpConvertFToS %int %290 + %293 = OpSLessThan %bool %291 %int_60 + OpSelectionMerge %294 None + OpBranchConditional %293 %295 %296 + %295 = OpLabel + %297 = OpAccessChain %_ptr_Private_int %data %int_1 + %298 = OpLoad %int %297 + %299 = OpConvertSToF %float %298 + %300 = OpFDiv %float %299 %float_10 + %301 = OpFAdd %float %float_0_5 %300 + OpStore %grey %301 + OpBranch %294 + %296 = OpLabel + %302 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %303 = OpLoad %float %302 + %304 = OpConvertFToS %int %303 + %306 = OpSLessThan %bool %304 %int_90 + OpSelectionMerge %307 None + OpBranchConditional %306 %308 %309 + %308 = OpLabel + %310 = OpAccessChain %_ptr_Private_int %data %int_2 + %311 = OpLoad %int %310 + %312 = OpConvertSToF %float %311 + %313 = OpFDiv %float %312 %float_10 + %314 = OpFAdd %float %float_0_5 %313 + OpStore %grey %314 + OpBranch %307 + %309 = OpLabel + %315 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %316 = OpLoad %float %315 + %317 = OpConvertFToS %int %316 + %319 = OpSLessThan %bool %317 %int_120 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %_ptr_Private_int %data %int_3 + %324 = OpLoad %int %323 + %325 = OpConvertSToF %float %324 + %326 = OpFDiv %float %325 %float_10 + %327 = OpFAdd %float %float_0_5 %326 + OpStore %grey %327 + OpBranch %320 + %322 = OpLabel + %328 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %329 = OpLoad %float %328 + %330 = OpConvertFToS %int %329 + %332 = OpSLessThan %bool %330 %int_150 + OpSelectionMerge %333 None + OpBranchConditional %332 %334 %335 + %334 = OpLabel + OpKill + %335 = OpLabel + %336 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %337 = OpLoad %float %336 + %338 = OpConvertFToS %int %337 + %340 = OpSLessThan %bool %338 %int_180 + OpSelectionMerge %341 None + OpBranchConditional %340 %342 %343 + %342 = OpLabel + %345 = OpAccessChain %_ptr_Private_int %data %int_5 + %346 = OpLoad %int %345 + %347 = OpConvertSToF %float %346 + %348 = OpFDiv %float %347 %float_10 + %349 = OpFAdd %float %float_0_5 %348 + OpStore %grey %349 + OpBranch %341 + %343 = OpLabel + %350 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %351 = OpLoad %float %350 + %352 = OpConvertFToS %int %351 + %354 = OpSLessThan %bool %352 %int_210 + OpSelectionMerge %355 None + OpBranchConditional %354 %356 %357 + %356 = OpLabel + %359 = OpAccessChain %_ptr_Private_int %data %int_6 + %360 = OpLoad %int %359 + %361 = OpConvertSToF %float %360 + %362 = OpFDiv %float %361 %float_10 + %363 = OpFAdd %float %float_0_5 %362 + OpStore %grey %363 + OpBranch %355 + %357 = OpLabel + %364 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %365 = OpLoad %float %364 + %366 = OpConvertFToS %int %365 + %368 = OpSLessThan %bool %366 %int_240 + OpSelectionMerge %369 None + OpBranchConditional %368 %370 %371 + %370 = OpLabel + %373 = OpAccessChain %_ptr_Private_int %data %int_7 + %374 = OpLoad %int %373 + %375 = OpConvertSToF %float %374 + %376 = OpFDiv %float %375 %float_10 + %377 = OpFAdd %float %float_0_5 %376 + OpStore %grey %377 + OpBranch %369 + %371 = OpLabel + %378 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %379 = OpLoad %float %378 + %380 = OpConvertFToS %int %379 + %382 = OpSLessThan %bool %380 %int_270 + OpSelectionMerge %383 None + OpBranchConditional %382 %384 %385 + %384 = OpLabel + %387 = OpAccessChain %_ptr_Private_int %data %int_8 + %388 = OpLoad %int %387 + %389 = OpConvertSToF %float %388 + %390 = OpFDiv %float %389 %float_10 + %391 = OpFAdd %float %float_0_5 %390 + OpStore %grey %391 + OpBranch %383 + %385 = OpLabel + OpKill + %383 = OpLabel + OpBranch %369 + %369 = OpLabel + OpBranch %355 + %355 = OpLabel + OpBranch %341 + %341 = OpLabel + OpBranch %333 + %333 = OpLabel + OpBranch %320 + %320 = OpLabel + OpBranch %307 + %307 = OpLabel + OpBranch %294 + %294 = OpLabel + OpBranch %279 + %279 = OpLabel + %392 = OpLoad %float %grey + %394 = OpCompositeConstruct %v3float %392 %392 %392 + %395 = OpCompositeExtract %float %394 0 + %396 = OpCompositeExtract %float %394 1 + %397 = OpCompositeExtract %float %394 2 + %399 = OpCompositeConstruct %v4float %395 %396 %397 %float_1 + OpStore %x_GLF_color %399 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %400 +%tint_symbol_1 = OpFunctionParameter %main_out + %404 = OpLabel + %405 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %405 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %132 + %407 = OpLabel + %408 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %408 + %409 = OpFunctionCall %void %main_1 + %411 = OpLoad %v4float %x_GLF_color + %412 = OpCompositeConstruct %main_out %411 + %410 = OpFunctionCall %void %tint_symbol_3 %412 + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %132 + %414 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %425 + %425 = OpLabel + OpLoopMerge %426 %427 None + OpBranch %428 + %428 = OpLabel + %429 = OpLoad %int %m + %430 = OpLoad %int %high + %431 = OpSLessThanEqual %bool %429 %430 + OpSelectionMerge %432 None + OpBranchConditional %431 %433 %434 + %433 = OpLabel + OpBranch %432 + %434 = OpLabel + OpBranch %426 + %432 = OpLabel + %435 = OpLoad %int %low + OpStore %i_2 %435 + OpBranch %436 + %436 = OpLabel + OpLoopMerge %437 %438 None + OpBranch %439 + %439 = OpLabel + %440 = OpLoad %int %i_2 + %441 = OpLoad %int %high + %442 = OpSLessThan %bool %440 %441 + OpSelectionMerge %443 None + OpBranchConditional %442 %444 %445 + %444 = OpLabel + OpBranch %443 + %445 = OpLabel + OpBranch %437 + %443 = OpLabel + %446 = OpLoad %int %i_2 + OpStore %from_1 %446 + %447 = OpLoad %int %i_2 + %448 = OpLoad %int %m + %449 = OpIAdd %int %447 %448 + %450 = OpISub %int %449 %int_1 + OpStore %mid_1 %450 + %451 = OpLoad %int %i_2 + %452 = OpLoad %int %m + %453 = OpLoad %int %high + %455 = OpIMul %int %int_2 %452 + %456 = OpIAdd %int %451 %455 + %457 = OpISub %int %456 %int_1 + %454 = OpExtInst %int %255 SMin %457 %453 + OpStore %to_1 %454 + %458 = OpLoad %int %from_1 + OpStore %param %458 + %459 = OpLoad %int %mid_1 + OpStore %param_1 %459 + %460 = OpLoad %int %to_1 + OpStore %param_2 %460 + %461 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %438 + %438 = OpLabel + %465 = OpLoad %int %m + %466 = OpLoad %int %i_2 + %467 = OpIMul %int %int_2 %465 + %468 = OpIAdd %int %466 %467 + OpStore %i_2 %468 + OpBranch %436 + %437 = OpLabel + OpBranch %427 + %427 = OpLabel + %469 = OpLoad %int %m + %470 = OpIMul %int %int_2 %469 + OpStore %m %470 + OpBranch %425 + %426 = OpLabel + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 157[%157] is not post dominated by the back-edge block 205[%205] + %205 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.wgsl new file mode 100644 index 0000000000..57c9c296b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.spvasm.expected.wgsl @@ -0,0 +1,363 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_302 : i32 = *(from); + k = x_302; + let x_303 : i32 = *(from); + i = x_303; + let x_304 : i32 = *(mid); + j = (x_304 + 1); + loop { + let x_310 : i32 = i; + let x_311 : i32 = *(mid); + let x_313 : i32 = j; + let x_314 : i32 = *(to); + if (((x_310 <= x_311) && (x_313 <= x_314))) { + } else { + break; + } + let x_318 : i32 = i; + let x_320 : i32 = data[x_318]; + let x_321 : i32 = j; + let x_323 : i32 = data[x_321]; + if ((x_320 < x_323)) { + let x_328 : i32 = k; + k = (x_328 + 1); + let x_330 : i32 = i; + i = (x_330 + 1); + let x_333 : i32 = data[x_330]; + temp[x_328] = x_333; + } else { + let x_335 : i32 = k; + k = (x_335 + 1); + let x_337 : i32 = j; + j = (x_337 + 1); + let x_340 : i32 = data[x_337]; + temp[x_335] = x_340; + } + } + loop { + let x_346 : i32 = i; + let x_348 : i32 = i; + let x_349 : i32 = *(mid); + if (((x_346 < 10) && (x_348 <= x_349))) { + } else { + break; + } + let x_353 : i32 = k; + k = (x_353 + 1); + let x_355 : i32 = i; + i = (x_355 + 1); + let x_358 : i32 = data[x_355]; + temp[x_353] = x_358; + } + let x_360 : i32 = *(from); + i_1 = x_360; + loop { + let x_365 : i32 = i_1; + let x_366 : i32 = *(to); + if ((x_365 <= x_366)) { + } else { + break; + } + let x_369 : i32 = i_1; + let x_370 : i32 = i_1; + let x_372 : i32 = temp[x_370]; + data[x_369] = x_372; + + continuing { + let x_374 : i32 = i_1; + i_1 = (x_374 + 1); + } + } + return; +} + +fn main_1() { + var x_85 : i32; + var x_86 : i32; + var x_87 : i32; + var x_88 : i32; + var x_89 : i32; + var x_90 : i32; + var x_91 : i32; + var x_92 : i32; + var x_93 : i32; + var x_94 : i32; + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_96 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_96); + loop { + let x_102 : i32 = i_3; + switch(x_102) { + case 9: { + let x_132 : i32 = i_3; + data[x_132] = -5; + } + case 8: { + let x_130 : i32 = i_3; + data[x_130] = -4; + } + case 7: { + let x_128 : i32 = i_3; + data[x_128] = -3; + } + case 6: { + let x_126 : i32 = i_3; + data[x_126] = -2; + } + case 5: { + let x_124 : i32 = i_3; + data[x_124] = -1; + } + case 4: { + let x_122 : i32 = i_3; + data[x_122] = 0; + } + case 3: { + let x_120 : i32 = i_3; + data[x_120] = 1; + } + case 2: { + let x_118 : i32 = i_3; + data[x_118] = 2; + } + case 1: { + let x_116 : i32 = i_3; + data[x_116] = 3; + } + case 0: { + let x_114 : i32 = i_3; + data[x_114] = 4; + } + default: { + } + } + let x_134 : i32 = i_3; + i_3 = (x_134 + 1); + + continuing { + let x_136 : i32 = i_3; + if ((x_136 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_142 : i32 = j_1; + if ((x_142 < 10)) { + } else { + break; + } + let x_145 : i32 = j_1; + let x_146 : i32 = j_1; + let x_148 : i32 = data[x_146]; + temp[x_145] = x_148; + + continuing { + let x_150 : i32 = j_1; + j_1 = (x_150 + 1); + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + loop { + let x_156 : i32 = x_92; + let x_157 : i32 = x_93; + if ((x_156 <= x_157)) { + } else { + break; + } + let x_160 : i32 = x_94; + x_91 = x_160; + loop { + let x_165 : i32 = x_91; + let x_166 : i32 = x_93; + if ((x_165 < x_166)) { + } else { + break; + } + let x_169 : i32 = x_91; + x_90 = x_169; + let x_170 : i32 = x_91; + let x_171 : i32 = x_92; + x_89 = ((x_170 + x_171) - 1); + let x_174 : i32 = x_91; + let x_175 : i32 = x_92; + let x_179 : i32 = x_93; + x_88 = min(((x_174 + (2 * x_175)) - 1), x_179); + let x_181 : i32 = x_90; + x_87 = x_181; + let x_182 : i32 = x_89; + x_86 = x_182; + let x_183 : i32 = x_88; + x_85 = x_183; + merge_i1_i1_i1_(&(x_87), &(x_86), &(x_85)); + + continuing { + let x_185 : i32 = x_92; + let x_187 : i32 = x_91; + x_91 = (x_187 + (2 * x_185)); + } + } + + continuing { + let x_189 : i32 = x_92; + x_92 = (2 * x_189); + } + } + let x_193 : f32 = gl_FragCoord.y; + if ((i32(x_193) < 30)) { + let x_200 : i32 = data[0]; + grey = (0.5 + (f32(x_200) / 10.0)); + } else { + let x_205 : f32 = gl_FragCoord.y; + if ((i32(x_205) < 60)) { + let x_212 : i32 = data[1]; + grey = (0.5 + (f32(x_212) / 10.0)); + } else { + let x_217 : f32 = gl_FragCoord.y; + if ((i32(x_217) < 90)) { + let x_224 : i32 = data[2]; + grey = (0.5 + (f32(x_224) / 10.0)); + } else { + let x_229 : f32 = gl_FragCoord.y; + if ((i32(x_229) < 120)) { + let x_236 : i32 = data[3]; + grey = (0.5 + (f32(x_236) / 10.0)); + } else { + let x_241 : f32 = gl_FragCoord.y; + if ((i32(x_241) < 150)) { + discard; + } else { + let x_248 : f32 = gl_FragCoord.y; + if ((i32(x_248) < 180)) { + let x_255 : i32 = data[5]; + grey = (0.5 + (f32(x_255) / 10.0)); + } else { + let x_260 : f32 = gl_FragCoord.y; + if ((i32(x_260) < 210)) { + let x_267 : i32 = data[6]; + grey = (0.5 + (f32(x_267) / 10.0)); + } else { + let x_272 : f32 = gl_FragCoord.y; + if ((i32(x_272) < 240)) { + let x_279 : i32 = data[7]; + grey = (0.5 + (f32(x_279) / 10.0)); + } else { + let x_284 : f32 = gl_FragCoord.y; + if ((i32(x_284) < 270)) { + let x_291 : i32 = data[8]; + grey = (0.5 + (f32(x_291) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_295 : f32 = grey; + let x_296 : vec3 = vec3(x_295, x_295, x_295); + x_GLF_color = vec4(x_296.x, x_296.y, x_296.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_381 : i32 = m; + let x_382 : i32 = high; + if ((x_381 <= x_382)) { + } else { + break; + } + let x_385 : i32 = low; + i_2 = x_385; + loop { + let x_390 : i32 = i_2; + let x_391 : i32 = high; + if ((x_390 < x_391)) { + } else { + break; + } + let x_394 : i32 = i_2; + from_1 = x_394; + let x_395 : i32 = i_2; + let x_396 : i32 = m; + mid_1 = ((x_395 + x_396) - 1); + let x_399 : i32 = i_2; + let x_400 : i32 = m; + let x_404 : i32 = high; + to_1 = min(((x_399 + (2 * x_400)) - 1), x_404); + let x_406 : i32 = from_1; + param = x_406; + let x_407 : i32 = mid_1; + param_1 = x_407; + let x_408 : i32 = to_1; + param_2 = x_408; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_410 : i32 = m; + let x_412 : i32 = i_2; + i_2 = (x_412 + (2 * x_410)); + } + } + + continuing { + let x_414 : i32 = m; + m = (2 * x_414); + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl new file mode 100644 index 0000000000..57c9c296b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl @@ -0,0 +1,363 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_302 : i32 = *(from); + k = x_302; + let x_303 : i32 = *(from); + i = x_303; + let x_304 : i32 = *(mid); + j = (x_304 + 1); + loop { + let x_310 : i32 = i; + let x_311 : i32 = *(mid); + let x_313 : i32 = j; + let x_314 : i32 = *(to); + if (((x_310 <= x_311) && (x_313 <= x_314))) { + } else { + break; + } + let x_318 : i32 = i; + let x_320 : i32 = data[x_318]; + let x_321 : i32 = j; + let x_323 : i32 = data[x_321]; + if ((x_320 < x_323)) { + let x_328 : i32 = k; + k = (x_328 + 1); + let x_330 : i32 = i; + i = (x_330 + 1); + let x_333 : i32 = data[x_330]; + temp[x_328] = x_333; + } else { + let x_335 : i32 = k; + k = (x_335 + 1); + let x_337 : i32 = j; + j = (x_337 + 1); + let x_340 : i32 = data[x_337]; + temp[x_335] = x_340; + } + } + loop { + let x_346 : i32 = i; + let x_348 : i32 = i; + let x_349 : i32 = *(mid); + if (((x_346 < 10) && (x_348 <= x_349))) { + } else { + break; + } + let x_353 : i32 = k; + k = (x_353 + 1); + let x_355 : i32 = i; + i = (x_355 + 1); + let x_358 : i32 = data[x_355]; + temp[x_353] = x_358; + } + let x_360 : i32 = *(from); + i_1 = x_360; + loop { + let x_365 : i32 = i_1; + let x_366 : i32 = *(to); + if ((x_365 <= x_366)) { + } else { + break; + } + let x_369 : i32 = i_1; + let x_370 : i32 = i_1; + let x_372 : i32 = temp[x_370]; + data[x_369] = x_372; + + continuing { + let x_374 : i32 = i_1; + i_1 = (x_374 + 1); + } + } + return; +} + +fn main_1() { + var x_85 : i32; + var x_86 : i32; + var x_87 : i32; + var x_88 : i32; + var x_89 : i32; + var x_90 : i32; + var x_91 : i32; + var x_92 : i32; + var x_93 : i32; + var x_94 : i32; + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_96 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_96); + loop { + let x_102 : i32 = i_3; + switch(x_102) { + case 9: { + let x_132 : i32 = i_3; + data[x_132] = -5; + } + case 8: { + let x_130 : i32 = i_3; + data[x_130] = -4; + } + case 7: { + let x_128 : i32 = i_3; + data[x_128] = -3; + } + case 6: { + let x_126 : i32 = i_3; + data[x_126] = -2; + } + case 5: { + let x_124 : i32 = i_3; + data[x_124] = -1; + } + case 4: { + let x_122 : i32 = i_3; + data[x_122] = 0; + } + case 3: { + let x_120 : i32 = i_3; + data[x_120] = 1; + } + case 2: { + let x_118 : i32 = i_3; + data[x_118] = 2; + } + case 1: { + let x_116 : i32 = i_3; + data[x_116] = 3; + } + case 0: { + let x_114 : i32 = i_3; + data[x_114] = 4; + } + default: { + } + } + let x_134 : i32 = i_3; + i_3 = (x_134 + 1); + + continuing { + let x_136 : i32 = i_3; + if ((x_136 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_142 : i32 = j_1; + if ((x_142 < 10)) { + } else { + break; + } + let x_145 : i32 = j_1; + let x_146 : i32 = j_1; + let x_148 : i32 = data[x_146]; + temp[x_145] = x_148; + + continuing { + let x_150 : i32 = j_1; + j_1 = (x_150 + 1); + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + loop { + let x_156 : i32 = x_92; + let x_157 : i32 = x_93; + if ((x_156 <= x_157)) { + } else { + break; + } + let x_160 : i32 = x_94; + x_91 = x_160; + loop { + let x_165 : i32 = x_91; + let x_166 : i32 = x_93; + if ((x_165 < x_166)) { + } else { + break; + } + let x_169 : i32 = x_91; + x_90 = x_169; + let x_170 : i32 = x_91; + let x_171 : i32 = x_92; + x_89 = ((x_170 + x_171) - 1); + let x_174 : i32 = x_91; + let x_175 : i32 = x_92; + let x_179 : i32 = x_93; + x_88 = min(((x_174 + (2 * x_175)) - 1), x_179); + let x_181 : i32 = x_90; + x_87 = x_181; + let x_182 : i32 = x_89; + x_86 = x_182; + let x_183 : i32 = x_88; + x_85 = x_183; + merge_i1_i1_i1_(&(x_87), &(x_86), &(x_85)); + + continuing { + let x_185 : i32 = x_92; + let x_187 : i32 = x_91; + x_91 = (x_187 + (2 * x_185)); + } + } + + continuing { + let x_189 : i32 = x_92; + x_92 = (2 * x_189); + } + } + let x_193 : f32 = gl_FragCoord.y; + if ((i32(x_193) < 30)) { + let x_200 : i32 = data[0]; + grey = (0.5 + (f32(x_200) / 10.0)); + } else { + let x_205 : f32 = gl_FragCoord.y; + if ((i32(x_205) < 60)) { + let x_212 : i32 = data[1]; + grey = (0.5 + (f32(x_212) / 10.0)); + } else { + let x_217 : f32 = gl_FragCoord.y; + if ((i32(x_217) < 90)) { + let x_224 : i32 = data[2]; + grey = (0.5 + (f32(x_224) / 10.0)); + } else { + let x_229 : f32 = gl_FragCoord.y; + if ((i32(x_229) < 120)) { + let x_236 : i32 = data[3]; + grey = (0.5 + (f32(x_236) / 10.0)); + } else { + let x_241 : f32 = gl_FragCoord.y; + if ((i32(x_241) < 150)) { + discard; + } else { + let x_248 : f32 = gl_FragCoord.y; + if ((i32(x_248) < 180)) { + let x_255 : i32 = data[5]; + grey = (0.5 + (f32(x_255) / 10.0)); + } else { + let x_260 : f32 = gl_FragCoord.y; + if ((i32(x_260) < 210)) { + let x_267 : i32 = data[6]; + grey = (0.5 + (f32(x_267) / 10.0)); + } else { + let x_272 : f32 = gl_FragCoord.y; + if ((i32(x_272) < 240)) { + let x_279 : i32 = data[7]; + grey = (0.5 + (f32(x_279) / 10.0)); + } else { + let x_284 : f32 = gl_FragCoord.y; + if ((i32(x_284) < 270)) { + let x_291 : i32 = data[8]; + grey = (0.5 + (f32(x_291) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_295 : f32 = grey; + let x_296 : vec3 = vec3(x_295, x_295, x_295); + x_GLF_color = vec4(x_296.x, x_296.y, x_296.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_381 : i32 = m; + let x_382 : i32 = high; + if ((x_381 <= x_382)) { + } else { + break; + } + let x_385 : i32 = low; + i_2 = x_385; + loop { + let x_390 : i32 = i_2; + let x_391 : i32 = high; + if ((x_390 < x_391)) { + } else { + break; + } + let x_394 : i32 = i_2; + from_1 = x_394; + let x_395 : i32 = i_2; + let x_396 : i32 = m; + mid_1 = ((x_395 + x_396) - 1); + let x_399 : i32 = i_2; + let x_400 : i32 = m; + let x_404 : i32 = high; + to_1 = min(((x_399 + (2 * x_400)) - 1), x_404); + let x_406 : i32 = from_1; + param = x_406; + let x_407 : i32 = mid_1; + param_1 = x_407; + let x_408 : i32 = to_1; + param_2 = x_408; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_410 : i32 = m; + let x_412 : i32 = i_2; + i_2 = (x_412 + (2 * x_410)); + } + } + + continuing { + let x_414 : i32 = m; + m = (2 * x_414); + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.hlsl new file mode 100644 index 0000000000..30e945e64d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.hlsl @@ -0,0 +1,296 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_302 = from; + k = x_302; + const int x_303 = from; + i = x_303; + const int x_304 = mid; + j = (x_304 + 1); + while (true) { + const int x_310 = i; + const int x_311 = mid; + const int x_313 = j; + const int x_314 = to; + bool tint_tmp = (x_310 <= x_311); + if (tint_tmp) { + tint_tmp = (x_313 <= x_314); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_320 = data[i]; + const int x_323 = data[j]; + if ((x_320 < x_323)) { + const int x_328 = k; + k = (x_328 + 1); + const int x_330 = i; + i = (x_330 + 1); + const int x_333 = data[x_330]; + temp[x_328] = x_333; + } else { + const int x_335 = k; + k = (x_335 + 1); + const int x_337 = j; + j = (x_337 + 1); + const int x_340 = data[x_337]; + temp[x_335] = x_340; + } + } + while (true) { + const int x_346 = i; + const int x_348 = i; + const int x_349 = mid; + bool tint_tmp_1 = (x_346 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_348 <= x_349); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_353 = k; + k = (x_353 + 1); + const int x_355 = i; + i = (x_355 + 1); + const int x_358 = data[x_355]; + temp[x_353] = x_358; + } + const int x_360 = from; + i_1 = x_360; + while (true) { + const int x_365 = i_1; + const int x_366 = to; + if ((x_365 <= x_366)) { + } else { + break; + } + const int x_369 = i_1; + const int x_372 = temp[i_1]; + data[x_369] = x_372; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void main_1() { + int x_85 = 0; + int x_86 = 0; + int x_87 = 0; + int x_88 = 0; + int x_89 = 0; + int x_90 = 0; + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94 = 0; + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_96 = asfloat(x_28[0].x); + i_3 = int(x_96); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_145 = j_1; + const int x_148 = data[j_1]; + temp[x_145] = x_148; + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + { + for(; (x_92 <= x_93); x_92 = (2 * x_92)) { + x_91 = x_94; + { + for(; (x_91 < x_93); x_91 = (x_91 + (2 * x_92))) { + x_90 = x_91; + x_89 = ((x_91 + x_92) - 1); + x_88 = min(((x_91 + (2 * x_92)) - 1), x_93); + x_87 = x_90; + x_86 = x_89; + x_85 = x_88; + merge_i1_i1_i1_(x_87, x_86, x_85); + } + } + } + } + const float x_193 = gl_FragCoord.y; + if ((int(x_193) < 30)) { + const int x_200 = data[0]; + grey = (0.5f + (float(x_200) / 10.0f)); + } else { + const float x_205 = gl_FragCoord.y; + if ((int(x_205) < 60)) { + const int x_212 = data[1]; + grey = (0.5f + (float(x_212) / 10.0f)); + } else { + const float x_217 = gl_FragCoord.y; + if ((int(x_217) < 90)) { + const int x_224 = data[2]; + grey = (0.5f + (float(x_224) / 10.0f)); + } else { + const float x_229 = gl_FragCoord.y; + if ((int(x_229) < 120)) { + const int x_236 = data[3]; + grey = (0.5f + (float(x_236) / 10.0f)); + } else { + const float x_241 = gl_FragCoord.y; + if ((int(x_241) < 150)) { + discard; + } else { + const float x_248 = gl_FragCoord.y; + if ((int(x_248) < 180)) { + const int x_255 = data[5]; + grey = (0.5f + (float(x_255) / 10.0f)); + } else { + const float x_260 = gl_FragCoord.y; + if ((int(x_260) < 210)) { + const int x_267 = data[6]; + grey = (0.5f + (float(x_267) / 10.0f)); + } else { + const float x_272 = gl_FragCoord.y; + if ((int(x_272) < 240)) { + const int x_279 = data[7]; + grey = (0.5f + (float(x_279) / 10.0f)); + } else { + const float x_284 = gl_FragCoord.y; + if ((int(x_284) < 270)) { + const int x_291 = data[8]; + grey = (0.5f + (float(x_291) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_295 = grey; + const float3 x_296 = float3(x_295, x_295, x_295); + x_GLF_color = float4(x_296.x, x_296.y, x_296.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.msl new file mode 100644 index 0000000000..a550d0fd12 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.msl @@ -0,0 +1,369 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_302 = *(from); + k = x_302; + int const x_303 = *(from); + i = x_303; + int const x_304 = *(mid); + j = (x_304 + 1); + while (true) { + int const x_310 = i; + int const x_311 = *(mid); + int const x_313 = j; + int const x_314 = *(to); + if (((x_310 <= x_311) && (x_313 <= x_314))) { + } else { + break; + } + int const x_318 = i; + int const x_320 = (*(tint_symbol_5)).arr[x_318]; + int const x_321 = j; + int const x_323 = (*(tint_symbol_5)).arr[x_321]; + if ((x_320 < x_323)) { + int const x_328 = k; + k = (x_328 + 1); + int const x_330 = i; + i = (x_330 + 1); + int const x_333 = (*(tint_symbol_5)).arr[x_330]; + (*(tint_symbol_6)).arr[x_328] = x_333; + } else { + int const x_335 = k; + k = (x_335 + 1); + int const x_337 = j; + j = (x_337 + 1); + int const x_340 = (*(tint_symbol_5)).arr[x_337]; + (*(tint_symbol_6)).arr[x_335] = x_340; + } + } + while (true) { + int const x_346 = i; + int const x_348 = i; + int const x_349 = *(mid); + if (((x_346 < 10) && (x_348 <= x_349))) { + } else { + break; + } + int const x_353 = k; + k = (x_353 + 1); + int const x_355 = i; + i = (x_355 + 1); + int const x_358 = (*(tint_symbol_5)).arr[x_355]; + (*(tint_symbol_6)).arr[x_353] = x_358; + } + int const x_360 = *(from); + i_1 = x_360; + while (true) { + int const x_365 = i_1; + int const x_366 = *(to); + if ((x_365 <= x_366)) { + } else { + break; + } + int const x_369 = i_1; + int const x_370 = i_1; + int const x_372 = (*(tint_symbol_6)).arr[x_370]; + (*(tint_symbol_5)).arr[x_369] = x_372; + { + int const x_374 = i_1; + i_1 = (x_374 + 1); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + int x_85 = 0; + int x_86 = 0; + int x_87 = 0; + int x_88 = 0; + int x_89 = 0; + int x_90 = 0; + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94 = 0; + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_96 = x_28.injectionSwitch.x; + i_3 = int(x_96); + while (true) { + int const x_102 = i_3; + switch(x_102) { + case 9: { + int const x_132 = i_3; + (*(tint_symbol_7)).arr[x_132] = -5; + break; + } + case 8: { + int const x_130 = i_3; + (*(tint_symbol_7)).arr[x_130] = -4; + break; + } + case 7: { + int const x_128 = i_3; + (*(tint_symbol_7)).arr[x_128] = -3; + break; + } + case 6: { + int const x_126 = i_3; + (*(tint_symbol_7)).arr[x_126] = -2; + break; + } + case 5: { + int const x_124 = i_3; + (*(tint_symbol_7)).arr[x_124] = -1; + break; + } + case 4: { + int const x_122 = i_3; + (*(tint_symbol_7)).arr[x_122] = 0; + break; + } + case 3: { + int const x_120 = i_3; + (*(tint_symbol_7)).arr[x_120] = 1; + break; + } + case 2: { + int const x_118 = i_3; + (*(tint_symbol_7)).arr[x_118] = 2; + break; + } + case 1: { + int const x_116 = i_3; + (*(tint_symbol_7)).arr[x_116] = 3; + break; + } + case 0: { + int const x_114 = i_3; + (*(tint_symbol_7)).arr[x_114] = 4; + break; + } + default: { + break; + } + } + int const x_134 = i_3; + i_3 = (x_134 + 1); + { + int const x_136 = i_3; + if ((x_136 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_142 = j_1; + if ((x_142 < 10)) { + } else { + break; + } + int const x_145 = j_1; + int const x_146 = j_1; + int const x_148 = (*(tint_symbol_7)).arr[x_146]; + (*(tint_symbol_8)).arr[x_145] = x_148; + { + int const x_150 = j_1; + j_1 = (x_150 + 1); + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + while (true) { + int const x_156 = x_92; + int const x_157 = x_93; + if ((x_156 <= x_157)) { + } else { + break; + } + int const x_160 = x_94; + x_91 = x_160; + while (true) { + int const x_165 = x_91; + int const x_166 = x_93; + if ((x_165 < x_166)) { + } else { + break; + } + int const x_169 = x_91; + x_90 = x_169; + int const x_170 = x_91; + int const x_171 = x_92; + x_89 = ((x_170 + x_171) - 1); + int const x_174 = x_91; + int const x_175 = x_92; + int const x_179 = x_93; + x_88 = min(((x_174 + (2 * x_175)) - 1), x_179); + int const x_181 = x_90; + x_87 = x_181; + int const x_182 = x_89; + x_86 = x_182; + int const x_183 = x_88; + x_85 = x_183; + merge_i1_i1_i1_(&(x_87), &(x_86), &(x_85), tint_symbol_7, tint_symbol_8); + { + int const x_185 = x_92; + int const x_187 = x_91; + x_91 = (x_187 + (2 * x_185)); + } + } + { + int const x_189 = x_92; + x_92 = (2 * x_189); + } + } + float const x_193 = (*(tint_symbol_9)).y; + if ((int(x_193) < 30)) { + int const x_200 = (*(tint_symbol_7)).arr[0]; + grey = (0.5f + (float(x_200) / 10.0f)); + } else { + float const x_205 = (*(tint_symbol_9)).y; + if ((int(x_205) < 60)) { + int const x_212 = (*(tint_symbol_7)).arr[1]; + grey = (0.5f + (float(x_212) / 10.0f)); + } else { + float const x_217 = (*(tint_symbol_9)).y; + if ((int(x_217) < 90)) { + int const x_224 = (*(tint_symbol_7)).arr[2]; + grey = (0.5f + (float(x_224) / 10.0f)); + } else { + float const x_229 = (*(tint_symbol_9)).y; + if ((int(x_229) < 120)) { + int const x_236 = (*(tint_symbol_7)).arr[3]; + grey = (0.5f + (float(x_236) / 10.0f)); + } else { + float const x_241 = (*(tint_symbol_9)).y; + if ((int(x_241) < 150)) { + discard_fragment(); + } else { + float const x_248 = (*(tint_symbol_9)).y; + if ((int(x_248) < 180)) { + int const x_255 = (*(tint_symbol_7)).arr[5]; + grey = (0.5f + (float(x_255) / 10.0f)); + } else { + float const x_260 = (*(tint_symbol_9)).y; + if ((int(x_260) < 210)) { + int const x_267 = (*(tint_symbol_7)).arr[6]; + grey = (0.5f + (float(x_267) / 10.0f)); + } else { + float const x_272 = (*(tint_symbol_9)).y; + if ((int(x_272) < 240)) { + int const x_279 = (*(tint_symbol_7)).arr[7]; + grey = (0.5f + (float(x_279) / 10.0f)); + } else { + float const x_284 = (*(tint_symbol_9)).y; + if ((int(x_284) < 270)) { + int const x_291 = (*(tint_symbol_7)).arr[8]; + grey = (0.5f + (float(x_291) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_295 = grey; + float3 const x_296 = float3(x_295, x_295, x_295); + *(tint_symbol_10) = float4(x_296.x, x_296.y, x_296.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread tint_array_wrapper tint_symbol_12 = {}; + thread tint_array_wrapper tint_symbol_13 = {}; + thread float4 tint_symbol_14 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_12), &(tint_symbol_13), &(tint_symbol_11), &(tint_symbol_14)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_14}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_15, thread tint_array_wrapper* const tint_symbol_16) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_381 = m; + int const x_382 = high; + if ((x_381 <= x_382)) { + } else { + break; + } + int const x_385 = low; + i_2 = x_385; + while (true) { + int const x_390 = i_2; + int const x_391 = high; + if ((x_390 < x_391)) { + } else { + break; + } + int const x_394 = i_2; + from_1 = x_394; + int const x_395 = i_2; + int const x_396 = m; + mid_1 = ((x_395 + x_396) - 1); + int const x_399 = i_2; + int const x_400 = m; + int const x_404 = high; + to_1 = min(((x_399 + (2 * x_400)) - 1), x_404); + int const x_406 = from_1; + param = x_406; + int const x_407 = mid_1; + param_1 = x_407; + int const x_408 = to_1; + param_2 = x_408; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_15, tint_symbol_16); + { + int const x_410 = m; + int const x_412 = i_2; + i_2 = (x_412 + (2 * x_410)); + } + } + { + int const x_414 = m; + m = (2 * x_414); + } + } + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.spvasm new file mode 100644 index 0000000000..5cce2a6fa2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.spvasm @@ -0,0 +1,741 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 471 +; Schema: 0 + OpCapability Shader + %255 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %main_1 "main_1" + OpName %x_85 "x_85" + OpName %x_86 "x_86" + OpName %x_87 "x_87" + OpName %x_88 "x_88" + OpName %x_89 "x_89" + OpName %x_90 "x_90" + OpName %x_91 "x_91" + OpName %x_92 "x_92" + OpName %x_93 "x_93" + OpName %x_94 "x_94" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %132 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %149 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %400 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpLoad %int %mid + %51 = OpLoad %int %j + %53 = OpLoad %int %to + %54 = OpSLessThanEqual %bool %48 %50 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %58 = OpSLessThanEqual %bool %51 %53 + OpBranch %56 + %56 = OpLabel + %59 = OpPhi %bool %54 %47 %58 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %45 + %60 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Private_int %data %63 + %66 = OpLoad %int %65 + %67 = OpLoad %int %j + %68 = OpAccessChain %_ptr_Private_int %data %67 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %k + %75 = OpIAdd %int %74 %int_1 + OpStore %k %75 + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + %78 = OpAccessChain %_ptr_Private_int %data %76 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Private_int %temp %74 + OpStore %80 %79 + OpBranch %71 + %73 = OpLabel + %81 = OpLoad %int %k + %82 = OpIAdd %int %81 %int_1 + OpStore %k %82 + %83 = OpLoad %int %j + %84 = OpIAdd %int %83 %int_1 + OpStore %j %84 + %85 = OpAccessChain %_ptr_Private_int %data %83 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Private_int %temp %81 + OpStore %87 %86 + OpBranch %71 + %71 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpLoad %int %i + %95 = OpLoad %int %mid + %97 = OpSLessThan %bool %92 %int_10 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSLessThanEqual %bool %93 %95 + OpBranch %98 + %98 = OpLabel + %101 = OpPhi %bool %97 %91 %100 %99 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpBranch %102 + %104 = OpLabel + OpBranch %89 + %102 = OpLabel + %105 = OpLoad %int %k + %106 = OpIAdd %int %105 %int_1 + OpStore %k %106 + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + %109 = OpAccessChain %_ptr_Private_int %data %107 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Private_int %temp %105 + OpStore %111 %110 + OpBranch %90 + %90 = OpLabel + OpBranch %88 + %89 = OpLabel + %113 = OpLoad %int %from + OpStore %i_1 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpLoad %int %to + %121 = OpSLessThanEqual %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + OpBranch %122 + %124 = OpLabel + OpBranch %115 + %122 = OpLabel + %125 = OpLoad %int %i_1 + %126 = OpLoad %int %i_1 + %127 = OpAccessChain %_ptr_Private_int %temp %126 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %129 %128 + OpBranch %116 + %116 = OpLabel + %130 = OpLoad %int %i_1 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_1 %131 + OpBranch %114 + %115 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %132 + %134 = OpLabel + %x_85 = OpVariable %_ptr_Function_int Function %32 + %x_86 = OpVariable %_ptr_Function_int Function %32 + %x_87 = OpVariable %_ptr_Function_int Function %32 + %x_88 = OpVariable %_ptr_Function_int Function %32 + %x_89 = OpVariable %_ptr_Function_int Function %32 + %x_90 = OpVariable %_ptr_Function_int Function %32 + %x_91 = OpVariable %_ptr_Function_int Function %32 + %x_92 = OpVariable %_ptr_Function_int Function %32 + %x_93 = OpVariable %_ptr_Function_int Function %32 + %x_94 = OpVariable %_ptr_Function_int Function %32 + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %149 + %152 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %153 = OpLoad %float %152 + %154 = OpConvertFToS %int %153 + OpStore %i_3 %154 + OpBranch %155 + %155 = OpLabel + OpLoopMerge %156 %157 None + OpBranch %158 + %158 = OpLabel + %159 = OpLoad %int %i_3 + OpSelectionMerge %160 None + OpSwitch %159 %161 9 %162 8 %163 7 %164 6 %165 5 %166 4 %167 3 %168 2 %169 1 %170 0 %171 + %162 = OpLabel + %172 = OpLoad %int %i_3 + %173 = OpAccessChain %_ptr_Private_int %data %172 + OpStore %173 %int_n5 + OpBranch %160 + %163 = OpLabel + %175 = OpLoad %int %i_3 + %176 = OpAccessChain %_ptr_Private_int %data %175 + OpStore %176 %int_n4 + OpBranch %160 + %164 = OpLabel + %178 = OpLoad %int %i_3 + %179 = OpAccessChain %_ptr_Private_int %data %178 + OpStore %179 %int_n3 + OpBranch %160 + %165 = OpLabel + %181 = OpLoad %int %i_3 + %182 = OpAccessChain %_ptr_Private_int %data %181 + OpStore %182 %int_n2 + OpBranch %160 + %166 = OpLabel + %184 = OpLoad %int %i_3 + %185 = OpAccessChain %_ptr_Private_int %data %184 + OpStore %185 %int_n1 + OpBranch %160 + %167 = OpLabel + %187 = OpLoad %int %i_3 + %188 = OpAccessChain %_ptr_Private_int %data %187 + OpStore %188 %int_0 + OpBranch %160 + %168 = OpLabel + %190 = OpLoad %int %i_3 + %191 = OpAccessChain %_ptr_Private_int %data %190 + OpStore %191 %int_1 + OpBranch %160 + %169 = OpLabel + %192 = OpLoad %int %i_3 + %193 = OpAccessChain %_ptr_Private_int %data %192 + OpStore %193 %int_2 + OpBranch %160 + %170 = OpLabel + %195 = OpLoad %int %i_3 + %196 = OpAccessChain %_ptr_Private_int %data %195 + OpStore %196 %int_3 + OpBranch %160 + %171 = OpLabel + %198 = OpLoad %int %i_3 + %199 = OpAccessChain %_ptr_Private_int %data %198 + OpStore %199 %int_4 + OpBranch %160 + %161 = OpLabel + OpBranch %160 + %160 = OpLabel + %201 = OpLoad %int %i_3 + %202 = OpIAdd %int %201 %int_1 + OpStore %i_3 %202 + OpBranch %157 + %157 = OpLabel + %203 = OpLoad %int %i_3 + %204 = OpSLessThan %bool %203 %int_10 + OpSelectionMerge %205 None + OpBranchConditional %204 %206 %207 + %206 = OpLabel + OpBranch %205 + %207 = OpLabel + OpBranch %156 + %205 = OpLabel + OpBranch %155 + %156 = OpLabel + OpStore %j_1 %int_0 + OpBranch %208 + %208 = OpLabel + OpLoopMerge %209 %210 None + OpBranch %211 + %211 = OpLabel + %212 = OpLoad %int %j_1 + %213 = OpSLessThan %bool %212 %int_10 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %209 + %214 = OpLabel + %217 = OpLoad %int %j_1 + %218 = OpLoad %int %j_1 + %219 = OpAccessChain %_ptr_Private_int %data %218 + %220 = OpLoad %int %219 + %221 = OpAccessChain %_ptr_Private_int %temp %217 + OpStore %221 %220 + OpBranch %210 + %210 = OpLabel + %222 = OpLoad %int %j_1 + %223 = OpIAdd %int %222 %int_1 + OpStore %j_1 %223 + OpBranch %208 + %209 = OpLabel + OpStore %x_94 %int_0 + OpStore %x_93 %int_9 + OpStore %x_92 %int_1 + OpBranch %225 + %225 = OpLabel + OpLoopMerge %226 %227 None + OpBranch %228 + %228 = OpLabel + %229 = OpLoad %int %x_92 + %230 = OpLoad %int %x_93 + %231 = OpSLessThanEqual %bool %229 %230 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %234 + %233 = OpLabel + OpBranch %232 + %234 = OpLabel + OpBranch %226 + %232 = OpLabel + %235 = OpLoad %int %x_94 + OpStore %x_91 %235 + OpBranch %236 + %236 = OpLabel + OpLoopMerge %237 %238 None + OpBranch %239 + %239 = OpLabel + %240 = OpLoad %int %x_91 + %241 = OpLoad %int %x_93 + %242 = OpSLessThan %bool %240 %241 + OpSelectionMerge %243 None + OpBranchConditional %242 %244 %245 + %244 = OpLabel + OpBranch %243 + %245 = OpLabel + OpBranch %237 + %243 = OpLabel + %246 = OpLoad %int %x_91 + OpStore %x_90 %246 + %247 = OpLoad %int %x_91 + %248 = OpLoad %int %x_92 + %249 = OpIAdd %int %247 %248 + %250 = OpISub %int %249 %int_1 + OpStore %x_89 %250 + %251 = OpLoad %int %x_91 + %252 = OpLoad %int %x_92 + %253 = OpLoad %int %x_93 + %256 = OpIMul %int %int_2 %252 + %257 = OpIAdd %int %251 %256 + %258 = OpISub %int %257 %int_1 + %254 = OpExtInst %int %255 SMin %258 %253 + OpStore %x_88 %254 + %259 = OpLoad %int %x_90 + OpStore %x_87 %259 + %260 = OpLoad %int %x_89 + OpStore %x_86 %260 + %261 = OpLoad %int %x_88 + OpStore %x_85 %261 + %262 = OpFunctionCall %void %merge_i1_i1_i1_ %x_87 %x_86 %x_85 + OpBranch %238 + %238 = OpLabel + %266 = OpLoad %int %x_92 + %267 = OpLoad %int %x_91 + %268 = OpIMul %int %int_2 %266 + %269 = OpIAdd %int %267 %268 + OpStore %x_91 %269 + OpBranch %236 + %237 = OpLabel + OpBranch %227 + %227 = OpLabel + %270 = OpLoad %int %x_92 + %271 = OpIMul %int %int_2 %270 + OpStore %x_92 %271 + OpBranch %225 + %226 = OpLabel + %274 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %275 = OpLoad %float %274 + %276 = OpConvertFToS %int %275 + %278 = OpSLessThan %bool %276 %int_30 + OpSelectionMerge %279 None + OpBranchConditional %278 %280 %281 + %280 = OpLabel + %282 = OpAccessChain %_ptr_Private_int %data %int_0 + %283 = OpLoad %int %282 + %285 = OpConvertSToF %float %283 + %287 = OpFDiv %float %285 %float_10 + %288 = OpFAdd %float %float_0_5 %287 + OpStore %grey %288 + OpBranch %279 + %281 = OpLabel + %289 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %290 = OpLoad %float %289 + %291 = OpConvertFToS %int %290 + %293 = OpSLessThan %bool %291 %int_60 + OpSelectionMerge %294 None + OpBranchConditional %293 %295 %296 + %295 = OpLabel + %297 = OpAccessChain %_ptr_Private_int %data %int_1 + %298 = OpLoad %int %297 + %299 = OpConvertSToF %float %298 + %300 = OpFDiv %float %299 %float_10 + %301 = OpFAdd %float %float_0_5 %300 + OpStore %grey %301 + OpBranch %294 + %296 = OpLabel + %302 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %303 = OpLoad %float %302 + %304 = OpConvertFToS %int %303 + %306 = OpSLessThan %bool %304 %int_90 + OpSelectionMerge %307 None + OpBranchConditional %306 %308 %309 + %308 = OpLabel + %310 = OpAccessChain %_ptr_Private_int %data %int_2 + %311 = OpLoad %int %310 + %312 = OpConvertSToF %float %311 + %313 = OpFDiv %float %312 %float_10 + %314 = OpFAdd %float %float_0_5 %313 + OpStore %grey %314 + OpBranch %307 + %309 = OpLabel + %315 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %316 = OpLoad %float %315 + %317 = OpConvertFToS %int %316 + %319 = OpSLessThan %bool %317 %int_120 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %_ptr_Private_int %data %int_3 + %324 = OpLoad %int %323 + %325 = OpConvertSToF %float %324 + %326 = OpFDiv %float %325 %float_10 + %327 = OpFAdd %float %float_0_5 %326 + OpStore %grey %327 + OpBranch %320 + %322 = OpLabel + %328 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %329 = OpLoad %float %328 + %330 = OpConvertFToS %int %329 + %332 = OpSLessThan %bool %330 %int_150 + OpSelectionMerge %333 None + OpBranchConditional %332 %334 %335 + %334 = OpLabel + OpKill + %335 = OpLabel + %336 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %337 = OpLoad %float %336 + %338 = OpConvertFToS %int %337 + %340 = OpSLessThan %bool %338 %int_180 + OpSelectionMerge %341 None + OpBranchConditional %340 %342 %343 + %342 = OpLabel + %345 = OpAccessChain %_ptr_Private_int %data %int_5 + %346 = OpLoad %int %345 + %347 = OpConvertSToF %float %346 + %348 = OpFDiv %float %347 %float_10 + %349 = OpFAdd %float %float_0_5 %348 + OpStore %grey %349 + OpBranch %341 + %343 = OpLabel + %350 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %351 = OpLoad %float %350 + %352 = OpConvertFToS %int %351 + %354 = OpSLessThan %bool %352 %int_210 + OpSelectionMerge %355 None + OpBranchConditional %354 %356 %357 + %356 = OpLabel + %359 = OpAccessChain %_ptr_Private_int %data %int_6 + %360 = OpLoad %int %359 + %361 = OpConvertSToF %float %360 + %362 = OpFDiv %float %361 %float_10 + %363 = OpFAdd %float %float_0_5 %362 + OpStore %grey %363 + OpBranch %355 + %357 = OpLabel + %364 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %365 = OpLoad %float %364 + %366 = OpConvertFToS %int %365 + %368 = OpSLessThan %bool %366 %int_240 + OpSelectionMerge %369 None + OpBranchConditional %368 %370 %371 + %370 = OpLabel + %373 = OpAccessChain %_ptr_Private_int %data %int_7 + %374 = OpLoad %int %373 + %375 = OpConvertSToF %float %374 + %376 = OpFDiv %float %375 %float_10 + %377 = OpFAdd %float %float_0_5 %376 + OpStore %grey %377 + OpBranch %369 + %371 = OpLabel + %378 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %379 = OpLoad %float %378 + %380 = OpConvertFToS %int %379 + %382 = OpSLessThan %bool %380 %int_270 + OpSelectionMerge %383 None + OpBranchConditional %382 %384 %385 + %384 = OpLabel + %387 = OpAccessChain %_ptr_Private_int %data %int_8 + %388 = OpLoad %int %387 + %389 = OpConvertSToF %float %388 + %390 = OpFDiv %float %389 %float_10 + %391 = OpFAdd %float %float_0_5 %390 + OpStore %grey %391 + OpBranch %383 + %385 = OpLabel + OpKill + %383 = OpLabel + OpBranch %369 + %369 = OpLabel + OpBranch %355 + %355 = OpLabel + OpBranch %341 + %341 = OpLabel + OpBranch %333 + %333 = OpLabel + OpBranch %320 + %320 = OpLabel + OpBranch %307 + %307 = OpLabel + OpBranch %294 + %294 = OpLabel + OpBranch %279 + %279 = OpLabel + %392 = OpLoad %float %grey + %394 = OpCompositeConstruct %v3float %392 %392 %392 + %395 = OpCompositeExtract %float %394 0 + %396 = OpCompositeExtract %float %394 1 + %397 = OpCompositeExtract %float %394 2 + %399 = OpCompositeConstruct %v4float %395 %396 %397 %float_1 + OpStore %x_GLF_color %399 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %400 +%tint_symbol_1 = OpFunctionParameter %main_out + %404 = OpLabel + %405 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %405 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %132 + %407 = OpLabel + %408 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %408 + %409 = OpFunctionCall %void %main_1 + %411 = OpLoad %v4float %x_GLF_color + %412 = OpCompositeConstruct %main_out %411 + %410 = OpFunctionCall %void %tint_symbol_3 %412 + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %132 + %414 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %425 + %425 = OpLabel + OpLoopMerge %426 %427 None + OpBranch %428 + %428 = OpLabel + %429 = OpLoad %int %m + %430 = OpLoad %int %high + %431 = OpSLessThanEqual %bool %429 %430 + OpSelectionMerge %432 None + OpBranchConditional %431 %433 %434 + %433 = OpLabel + OpBranch %432 + %434 = OpLabel + OpBranch %426 + %432 = OpLabel + %435 = OpLoad %int %low + OpStore %i_2 %435 + OpBranch %436 + %436 = OpLabel + OpLoopMerge %437 %438 None + OpBranch %439 + %439 = OpLabel + %440 = OpLoad %int %i_2 + %441 = OpLoad %int %high + %442 = OpSLessThan %bool %440 %441 + OpSelectionMerge %443 None + OpBranchConditional %442 %444 %445 + %444 = OpLabel + OpBranch %443 + %445 = OpLabel + OpBranch %437 + %443 = OpLabel + %446 = OpLoad %int %i_2 + OpStore %from_1 %446 + %447 = OpLoad %int %i_2 + %448 = OpLoad %int %m + %449 = OpIAdd %int %447 %448 + %450 = OpISub %int %449 %int_1 + OpStore %mid_1 %450 + %451 = OpLoad %int %i_2 + %452 = OpLoad %int %m + %453 = OpLoad %int %high + %455 = OpIMul %int %int_2 %452 + %456 = OpIAdd %int %451 %455 + %457 = OpISub %int %456 %int_1 + %454 = OpExtInst %int %255 SMin %457 %453 + OpStore %to_1 %454 + %458 = OpLoad %int %from_1 + OpStore %param %458 + %459 = OpLoad %int %mid_1 + OpStore %param_1 %459 + %460 = OpLoad %int %to_1 + OpStore %param_2 %460 + %461 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %438 + %438 = OpLabel + %465 = OpLoad %int %m + %466 = OpLoad %int %i_2 + %467 = OpIMul %int %int_2 %465 + %468 = OpIAdd %int %466 %467 + OpStore %i_2 %468 + OpBranch %436 + %437 = OpLabel + OpBranch %427 + %427 = OpLabel + %469 = OpLoad %int %m + %470 = OpIMul %int %int_2 %469 + OpStore %m %470 + OpBranch %425 + %426 = OpLabel + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 157[%157] is not post dominated by the back-edge block 205[%205] + %205 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.wgsl new file mode 100644 index 0000000000..57c9c296b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-func-inline-mutate-var/2.wgsl.expected.wgsl @@ -0,0 +1,363 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_302 : i32 = *(from); + k = x_302; + let x_303 : i32 = *(from); + i = x_303; + let x_304 : i32 = *(mid); + j = (x_304 + 1); + loop { + let x_310 : i32 = i; + let x_311 : i32 = *(mid); + let x_313 : i32 = j; + let x_314 : i32 = *(to); + if (((x_310 <= x_311) && (x_313 <= x_314))) { + } else { + break; + } + let x_318 : i32 = i; + let x_320 : i32 = data[x_318]; + let x_321 : i32 = j; + let x_323 : i32 = data[x_321]; + if ((x_320 < x_323)) { + let x_328 : i32 = k; + k = (x_328 + 1); + let x_330 : i32 = i; + i = (x_330 + 1); + let x_333 : i32 = data[x_330]; + temp[x_328] = x_333; + } else { + let x_335 : i32 = k; + k = (x_335 + 1); + let x_337 : i32 = j; + j = (x_337 + 1); + let x_340 : i32 = data[x_337]; + temp[x_335] = x_340; + } + } + loop { + let x_346 : i32 = i; + let x_348 : i32 = i; + let x_349 : i32 = *(mid); + if (((x_346 < 10) && (x_348 <= x_349))) { + } else { + break; + } + let x_353 : i32 = k; + k = (x_353 + 1); + let x_355 : i32 = i; + i = (x_355 + 1); + let x_358 : i32 = data[x_355]; + temp[x_353] = x_358; + } + let x_360 : i32 = *(from); + i_1 = x_360; + loop { + let x_365 : i32 = i_1; + let x_366 : i32 = *(to); + if ((x_365 <= x_366)) { + } else { + break; + } + let x_369 : i32 = i_1; + let x_370 : i32 = i_1; + let x_372 : i32 = temp[x_370]; + data[x_369] = x_372; + + continuing { + let x_374 : i32 = i_1; + i_1 = (x_374 + 1); + } + } + return; +} + +fn main_1() { + var x_85 : i32; + var x_86 : i32; + var x_87 : i32; + var x_88 : i32; + var x_89 : i32; + var x_90 : i32; + var x_91 : i32; + var x_92 : i32; + var x_93 : i32; + var x_94 : i32; + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_96 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_96); + loop { + let x_102 : i32 = i_3; + switch(x_102) { + case 9: { + let x_132 : i32 = i_3; + data[x_132] = -5; + } + case 8: { + let x_130 : i32 = i_3; + data[x_130] = -4; + } + case 7: { + let x_128 : i32 = i_3; + data[x_128] = -3; + } + case 6: { + let x_126 : i32 = i_3; + data[x_126] = -2; + } + case 5: { + let x_124 : i32 = i_3; + data[x_124] = -1; + } + case 4: { + let x_122 : i32 = i_3; + data[x_122] = 0; + } + case 3: { + let x_120 : i32 = i_3; + data[x_120] = 1; + } + case 2: { + let x_118 : i32 = i_3; + data[x_118] = 2; + } + case 1: { + let x_116 : i32 = i_3; + data[x_116] = 3; + } + case 0: { + let x_114 : i32 = i_3; + data[x_114] = 4; + } + default: { + } + } + let x_134 : i32 = i_3; + i_3 = (x_134 + 1); + + continuing { + let x_136 : i32 = i_3; + if ((x_136 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_142 : i32 = j_1; + if ((x_142 < 10)) { + } else { + break; + } + let x_145 : i32 = j_1; + let x_146 : i32 = j_1; + let x_148 : i32 = data[x_146]; + temp[x_145] = x_148; + + continuing { + let x_150 : i32 = j_1; + j_1 = (x_150 + 1); + } + } + x_94 = 0; + x_93 = 9; + x_92 = 1; + loop { + let x_156 : i32 = x_92; + let x_157 : i32 = x_93; + if ((x_156 <= x_157)) { + } else { + break; + } + let x_160 : i32 = x_94; + x_91 = x_160; + loop { + let x_165 : i32 = x_91; + let x_166 : i32 = x_93; + if ((x_165 < x_166)) { + } else { + break; + } + let x_169 : i32 = x_91; + x_90 = x_169; + let x_170 : i32 = x_91; + let x_171 : i32 = x_92; + x_89 = ((x_170 + x_171) - 1); + let x_174 : i32 = x_91; + let x_175 : i32 = x_92; + let x_179 : i32 = x_93; + x_88 = min(((x_174 + (2 * x_175)) - 1), x_179); + let x_181 : i32 = x_90; + x_87 = x_181; + let x_182 : i32 = x_89; + x_86 = x_182; + let x_183 : i32 = x_88; + x_85 = x_183; + merge_i1_i1_i1_(&(x_87), &(x_86), &(x_85)); + + continuing { + let x_185 : i32 = x_92; + let x_187 : i32 = x_91; + x_91 = (x_187 + (2 * x_185)); + } + } + + continuing { + let x_189 : i32 = x_92; + x_92 = (2 * x_189); + } + } + let x_193 : f32 = gl_FragCoord.y; + if ((i32(x_193) < 30)) { + let x_200 : i32 = data[0]; + grey = (0.5 + (f32(x_200) / 10.0)); + } else { + let x_205 : f32 = gl_FragCoord.y; + if ((i32(x_205) < 60)) { + let x_212 : i32 = data[1]; + grey = (0.5 + (f32(x_212) / 10.0)); + } else { + let x_217 : f32 = gl_FragCoord.y; + if ((i32(x_217) < 90)) { + let x_224 : i32 = data[2]; + grey = (0.5 + (f32(x_224) / 10.0)); + } else { + let x_229 : f32 = gl_FragCoord.y; + if ((i32(x_229) < 120)) { + let x_236 : i32 = data[3]; + grey = (0.5 + (f32(x_236) / 10.0)); + } else { + let x_241 : f32 = gl_FragCoord.y; + if ((i32(x_241) < 150)) { + discard; + } else { + let x_248 : f32 = gl_FragCoord.y; + if ((i32(x_248) < 180)) { + let x_255 : i32 = data[5]; + grey = (0.5 + (f32(x_255) / 10.0)); + } else { + let x_260 : f32 = gl_FragCoord.y; + if ((i32(x_260) < 210)) { + let x_267 : i32 = data[6]; + grey = (0.5 + (f32(x_267) / 10.0)); + } else { + let x_272 : f32 = gl_FragCoord.y; + if ((i32(x_272) < 240)) { + let x_279 : i32 = data[7]; + grey = (0.5 + (f32(x_279) / 10.0)); + } else { + let x_284 : f32 = gl_FragCoord.y; + if ((i32(x_284) < 270)) { + let x_291 : i32 = data[8]; + grey = (0.5 + (f32(x_291) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_295 : f32 = grey; + let x_296 : vec3 = vec3(x_295, x_295, x_295); + x_GLF_color = vec4(x_296.x, x_296.y, x_296.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_381 : i32 = m; + let x_382 : i32 = high; + if ((x_381 <= x_382)) { + } else { + break; + } + let x_385 : i32 = low; + i_2 = x_385; + loop { + let x_390 : i32 = i_2; + let x_391 : i32 = high; + if ((x_390 < x_391)) { + } else { + break; + } + let x_394 : i32 = i_2; + from_1 = x_394; + let x_395 : i32 = i_2; + let x_396 : i32 = m; + mid_1 = ((x_395 + x_396) - 1); + let x_399 : i32 = i_2; + let x_400 : i32 = m; + let x_404 : i32 = high; + to_1 = min(((x_399 + (2 * x_400)) - 1), x_404); + let x_406 : i32 = from_1; + param = x_406; + let x_407 : i32 = mid_1; + param_1 = x_407; + let x_408 : i32 = to_1; + param_2 = x_408; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_410 : i32 = m; + let x_412 : i32 = i_2; + i_2 = (x_412 + (2 * x_410)); + } + } + + continuing { + let x_414 : i32 = m; + m = (2 * x_414); + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm new file mode 100644 index 0000000000..a003313825 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm @@ -0,0 +1,161 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %indexable "indexable" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_100 = OpConstant %int 100 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %37 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %38 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %40 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %41 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %42 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %43 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %46 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %49 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %50 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %51 = OpConstantComposite %_arr_v4float_uint_16 %35 %37 %38 %39 %40 %41 %42 %43 %35 %44 %45 %46 %47 %48 %49 %50 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %54 = OpUndef %v2int + %main = OpFunction %void None %9 + %55 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %56 = OpLoad %v4float %gl_FragCoord + %57 = OpVectorShuffle %v2float %56 %56 0 1 + %58 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %59 = OpLoad %v2float %58 + %60 = OpFDiv %v2float %57 %59 + %61 = OpCompositeExtract %float %60 0 + %62 = OpFMul %float %61 %float_8 + %63 = OpConvertFToS %int %62 + %64 = OpCompositeExtract %float %60 1 + %65 = OpFMul %float %64 %float_8 + %66 = OpConvertFToS %int %65 + %67 = OpBitwiseAnd %int %63 %int_5 + %68 = OpBitwiseAnd %int %66 %int_10 + %69 = OpBitwiseOr %int %67 %68 + %70 = OpBitwiseAnd %int %66 %int_5 + %71 = OpBitwiseAnd %int %63 %int_10 + %72 = OpBitwiseOr %int %70 %71 + %73 = OpIMul %int %69 %int_8 + %74 = OpIAdd %int %73 %72 + %75 = OpCompositeConstruct %v2int %74 %int_0 + OpBranch %76 + %76 = OpLabel + %77 = OpPhi %v2int %75 %55 %78 %79 + %80 = OpPhi %int %int_0 %55 %81 %79 + %82 = OpSLessThan %bool %80 %int_100 + OpLoopMerge %83 %79 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + %85 = OpCompositeExtract %int %77 0 + %86 = OpSGreaterThan %bool %85 %int_0 + OpSelectionMerge %87 None + OpBranchConditional %86 %88 %87 + %88 = OpLabel + %89 = OpCompositeExtract %int %77 1 + %90 = OpISub %int %89 %int_1 + %91 = OpCompositeInsert %v2int %90 %77 1 + OpBranch %87 + %87 = OpLabel + %92 = OpPhi %v2int %77 %84 %91 %88 + %93 = OpCompositeExtract %int %92 0 + %94 = OpSLessThan %bool %93 %int_0 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + %97 = OpCompositeExtract %int %92 1 + %98 = OpIAdd %int %97 %int_1 + %99 = OpCompositeInsert %v2int %98 %92 1 + OpBranch %95 + %95 = OpLabel + %100 = OpPhi %v2int %92 %87 %99 %96 + %101 = OpCompositeExtract %int %100 1 + %102 = OpSDiv %int %101 %int_2 + %103 = OpCompositeExtract %int %100 0 + %104 = OpIAdd %int %103 %102 + %78 = OpCompositeInsert %v2int %104 %100 0 + OpBranch %79 + %79 = OpLabel + %81 = OpIAdd %int %80 %int_1 + OpBranch %76 + %83 = OpLabel + %105 = OpCompositeExtract %int %77 0 + %106 = OpSLessThan %bool %105 %int_0 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %107 + %108 = OpLabel + %109 = OpSNegate %int %105 + %110 = OpCompositeInsert %v2int %109 %54 0 + OpBranch %107 + %107 = OpLabel + %111 = OpPhi %v2int %77 %83 %110 %108 + OpBranch %112 + %112 = OpLabel + %113 = OpPhi %v2int %111 %107 %114 %115 + %116 = OpCompositeExtract %int %113 0 + %117 = OpSGreaterThan %bool %116 %int_15 + OpLoopMerge %118 %115 None + OpBranchConditional %117 %115 %118 + %115 = OpLabel + %119 = OpISub %int %116 %int_16 + %114 = OpCompositeInsert %v2int %119 %54 0 + OpBranch %112 + %118 = OpLabel + OpStore %indexable %51 + %120 = OpAccessChain %_ptr_Function_v4float %indexable %116 + %121 = OpLoad %v4float %120 + OpStore %_GLF_color %121 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..5a6f9c465e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.hlsl @@ -0,0 +1,104 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int2 x_77 = int2(0, 0); + int2 x_110 = int2(0, 0); + int x_116 = 0; + int2 x_77_phi = int2(0, 0); + int x_80_phi = 0; + int2 x_111_phi = int2(0, 0); + int2 x_113_phi = int2(0, 0); + const float4 x_56 = gl_FragCoord; + const float2 x_59 = asfloat(x_6[0].xy); + const float2 x_60 = (float2(x_56.x, x_56.y) / x_59); + const int x_63 = int((x_60.x * 8.0f)); + const int x_66 = int((x_60.y * 8.0f)); + const int2 x_75 = int2(((((x_63 & 5) | (x_66 & 10)) * 8) + ((x_66 & 5) | (x_63 & 10))), 0); + x_77_phi = x_75; + x_80_phi = 0; + while (true) { + int2 x_91 = int2(0, 0); + int2 x_99 = int2(0, 0); + int x_81 = 0; + int2 x_92_phi = int2(0, 0); + int2 x_100_phi = int2(0, 0); + x_77 = x_77_phi; + const int x_80 = x_80_phi; + if ((x_80 < 100)) { + } else { + break; + } + x_92_phi = x_77; + if ((x_77.x > 0)) { + x_91 = x_77; + x_91.y = (x_77.y - 1); + x_92_phi = x_91; + } + const int2 x_92 = x_92_phi; + x_100_phi = x_92; + if ((x_92.x < 0)) { + x_99 = x_92; + x_99.y = (x_92.y + 1); + x_100_phi = x_99; + } + const int2 x_100 = x_100_phi; + int2 x_78_1 = x_100; + x_78_1.x = (x_100.x + (x_100.y / 2)); + const int2 x_78 = x_78_1; + { + x_81 = (x_80 + 1); + x_77_phi = x_78; + x_80_phi = x_81; + } + } + const int x_105 = x_77.x; + x_111_phi = x_77; + if ((x_105 < 0)) { + x_110 = int2(0, 0); + x_110.x = -(x_105); + x_111_phi = x_110; + } + x_113_phi = x_111_phi; + while (true) { + int2 x_114 = int2(0, 0); + x_116 = x_113_phi.x; + if ((x_116 > 15)) { + } else { + break; + } + { + x_114 = int2(0, 0); + x_114.x = asint((x_116 - asint(16))); + x_113_phi = x_114; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_121 = indexable[x_116]; + x_GLF_color = x_121; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.msl new file mode 100644 index 0000000000..426677694e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int2 x_77 = 0; + int2 x_110 = 0; + int x_116 = 0; + int2 x_77_phi = 0; + int x_80_phi = 0; + int2 x_111_phi = 0; + int2 x_113_phi = 0; + float4 const x_56 = *(tint_symbol_6); + float2 const x_59 = x_6.resolution; + float2 const x_60 = (float2(x_56.x, x_56.y) / x_59); + int const x_63 = int((x_60.x * 8.0f)); + int const x_66 = int((x_60.y * 8.0f)); + int2 const x_75 = int2(((((x_63 & 5) | (x_66 & 10)) * 8) + ((x_66 & 5) | (x_63 & 10))), 0); + x_77_phi = x_75; + x_80_phi = 0; + while (true) { + int2 x_91 = 0; + int2 x_99 = 0; + int x_81 = 0; + int2 x_92_phi = 0; + int2 x_100_phi = 0; + x_77 = x_77_phi; + int const x_80 = x_80_phi; + if ((x_80 < 100)) { + } else { + break; + } + x_92_phi = x_77; + if ((x_77.x > 0)) { + x_91 = x_77; + x_91.y = (x_77.y - 1); + x_92_phi = x_91; + } + int2 const x_92 = x_92_phi; + x_100_phi = x_92; + if ((x_92.x < 0)) { + x_99 = x_92; + x_99.y = (x_92.y + 1); + x_100_phi = x_99; + } + int2 const x_100 = x_100_phi; + int2 x_78_1 = x_100; + x_78_1.x = (x_100.x + (x_100.y / 2)); + int2 const x_78 = x_78_1; + { + x_81 = (x_80 + 1); + x_77_phi = x_78; + x_80_phi = x_81; + } + } + int const x_105 = x_77.x; + x_111_phi = x_77; + if ((x_105 < 0)) { + x_110 = int2(0, 0); + x_110.x = -(x_105); + x_111_phi = x_110; + } + int2 const x_111 = x_111_phi; + x_113_phi = x_111; + while (true) { + int2 x_114 = 0; + int2 const x_113 = x_113_phi; + x_116 = x_113.x; + if ((x_116 > 15)) { + } else { + break; + } + { + x_114 = int2(0, 0); + x_114.x = as_type((x_116 - as_type(16))); + x_113_phi = x_114; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_121 = indexable.arr[x_116]; + *(tint_symbol_7) = x_121; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..d89e65c597 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.spvasm @@ -0,0 +1,292 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 185 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_77 "x_77" + OpName %x_110 "x_110" + OpName %x_116 "x_116" + OpName %x_77_phi "x_77_phi" + OpName %x_80_phi "x_80_phi" + OpName %x_111_phi "x_111_phi" + OpName %x_113_phi "x_113_phi" + OpName %x_91 "x_91" + OpName %x_99 "x_99" + OpName %x_81 "x_81" + OpName %x_92_phi "x_92_phi" + OpName %x_100_phi "x_100_phi" + OpName %x_78_1 "x_78_1" + OpName %x_114 "x_114" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %124 = OpConstantComposite %v2int %int_0 %int_0 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %151 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %153 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %154 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %155 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %157 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %158 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %159 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %160 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %161 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %162 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %164 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %166 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %167 = OpConstantComposite %_arr_v4float_uint_16 %151 %153 %154 %155 %156 %157 %158 %159 %151 %160 %161 %162 %163 %164 %165 %166 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %172 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_77 = OpVariable %_ptr_Function_v2int Function %29 + %x_110 = OpVariable %_ptr_Function_v2int Function %29 + %x_116 = OpVariable %_ptr_Function_int Function %33 + %x_77_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_80_phi = OpVariable %_ptr_Function_int Function %33 + %x_111_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_113_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_91 = OpVariable %_ptr_Function_v2int Function %29 + %x_99 = OpVariable %_ptr_Function_v2int Function %29 + %x_81 = OpVariable %_ptr_Function_int Function %33 + %x_92_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_100_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_78_1 = OpVariable %_ptr_Function_v2int Function %29 + %x_114 = OpVariable %_ptr_Function_v2int Function %29 + %38 = OpLoad %v4float %gl_FragCoord + %41 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %42 = OpLoad %v2float %41 + %43 = OpCompositeExtract %float %38 0 + %44 = OpCompositeExtract %float %38 1 + %45 = OpCompositeConstruct %v2float %43 %44 + %46 = OpFDiv %v2float %45 %42 + %48 = OpCompositeExtract %float %46 0 + %50 = OpFMul %float %48 %float_8 + %47 = OpConvertFToS %int %50 + %52 = OpCompositeExtract %float %46 1 + %53 = OpFMul %float %52 %float_8 + %51 = OpConvertFToS %int %53 + %55 = OpBitwiseAnd %int %47 %int_5 + %57 = OpBitwiseAnd %int %51 %int_10 + %58 = OpBitwiseOr %int %55 %57 + %60 = OpIMul %int %58 %int_8 + %61 = OpBitwiseAnd %int %51 %int_5 + %62 = OpBitwiseAnd %int %47 %int_10 + %63 = OpBitwiseOr %int %61 %62 + %64 = OpIAdd %int %60 %63 + %66 = OpCompositeConstruct %v2int %64 %int_0 + OpStore %x_77_phi %66 + OpStore %x_80_phi %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %76 = OpLoad %v2int %x_77_phi + OpStore %x_77 %76 + %77 = OpLoad %int %x_80_phi + %79 = OpSLessThan %bool %77 %int_100 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %68 + %81 = OpLabel + %84 = OpLoad %v2int %x_77 + OpStore %x_92_phi %84 + %85 = OpAccessChain %_ptr_Function_int %x_77 %uint_0 + %86 = OpLoad %int %85 + %87 = OpSGreaterThan %bool %86 %int_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpLoad %v2int %x_77 + OpStore %x_91 %90 + %92 = OpAccessChain %_ptr_Function_int %x_91 %uint_1 + %93 = OpAccessChain %_ptr_Function_int %x_77 %uint_1 + %94 = OpLoad %int %93 + %96 = OpISub %int %94 %int_1 + OpStore %92 %96 + %97 = OpLoad %v2int %x_91 + OpStore %x_92_phi %97 + OpBranch %88 + %88 = OpLabel + %98 = OpLoad %v2int %x_92_phi + OpStore %x_100_phi %98 + %99 = OpCompositeExtract %int %98 0 + %100 = OpSLessThan %bool %99 %int_0 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %x_99 %98 + %103 = OpAccessChain %_ptr_Function_int %x_99 %uint_1 + %104 = OpCompositeExtract %int %98 1 + %105 = OpIAdd %int %104 %int_1 + OpStore %103 %105 + %106 = OpLoad %v2int %x_99 + OpStore %x_100_phi %106 + OpBranch %101 + %101 = OpLabel + %107 = OpLoad %v2int %x_100_phi + OpStore %x_78_1 %107 + %109 = OpAccessChain %_ptr_Function_int %x_78_1 %uint_0 + %110 = OpCompositeExtract %int %107 0 + %111 = OpCompositeExtract %int %107 1 + %113 = OpSDiv %int %111 %int_2 + %114 = OpIAdd %int %110 %113 + OpStore %109 %114 + %115 = OpLoad %v2int %x_78_1 + OpBranch %69 + %69 = OpLabel + %116 = OpIAdd %int %77 %int_1 + OpStore %x_81 %116 + OpStore %x_77_phi %115 + %117 = OpLoad %int %x_81 + OpStore %x_80_phi %117 + OpBranch %67 + %68 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %x_77 %uint_0 + %119 = OpLoad %int %118 + %120 = OpLoad %v2int %x_77 + OpStore %x_111_phi %120 + %121 = OpSLessThan %bool %119 %int_0 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + OpStore %x_110 %124 + %125 = OpAccessChain %_ptr_Function_int %x_110 %uint_0 + %126 = OpSNegate %int %119 + OpStore %125 %126 + %127 = OpLoad %v2int %x_110 + OpStore %x_111_phi %127 + OpBranch %122 + %122 = OpLabel + %128 = OpLoad %v2int %x_111_phi + OpStore %x_113_phi %128 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %134 = OpLoad %v2int %x_113_phi + %135 = OpCompositeExtract %int %134 0 + OpStore %x_116 %135 + %136 = OpLoad %int %x_116 + %138 = OpSGreaterThan %bool %136 %int_15 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpBranch %139 + %141 = OpLabel + OpBranch %130 + %139 = OpLabel + OpBranch %131 + %131 = OpLabel + OpStore %x_114 %124 + %142 = OpAccessChain %_ptr_Function_int %x_114 %uint_0 + %144 = OpLoad %int %x_116 + %145 = OpCopyObject %int %int_16 + %147 = OpISub %int %144 %145 + %143 = OpCopyObject %int %147 + OpStore %142 %143 + %148 = OpLoad %v2int %x_114 + OpStore %x_113_phi %148 + OpBranch %129 + %130 = OpLabel + OpStore %indexable %167 + %168 = OpLoad %int %x_116 + %170 = OpAccessChain %_ptr_Function_v4float %indexable %168 + %171 = OpLoad %v4float %170 + OpStore %x_GLF_color %171 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %172 +%tint_symbol_1 = OpFunctionParameter %main_out + %176 = OpLabel + %177 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %177 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %179 = OpLabel + %180 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %180 + %181 = OpFunctionCall %void %main_1 + %183 = OpLoad %v4float %x_GLF_color + %184 = OpCompositeConstruct %main_out %183 + %182 = OpFunctionCall %void %tint_symbol_3 %184 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..be331aa369 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.spvasm.expected.wgsl @@ -0,0 +1,105 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_77 : vec2; + var x_110 : vec2; + var x_116 : i32; + var x_77_phi : vec2; + var x_80_phi : i32; + var x_111_phi : vec2; + var x_113_phi : vec2; + let x_56 : vec4 = gl_FragCoord; + let x_59 : vec2 = x_6.resolution; + let x_60 : vec2 = (vec2(x_56.x, x_56.y) / x_59); + let x_63 : i32 = i32((x_60.x * 8.0)); + let x_66 : i32 = i32((x_60.y * 8.0)); + let x_75 : vec2 = vec2(((((x_63 & 5) | (x_66 & 10)) * 8) + ((x_66 & 5) | (x_63 & 10))), 0); + x_77_phi = x_75; + x_80_phi = 0; + loop { + var x_91 : vec2; + var x_99 : vec2; + var x_81 : i32; + var x_92_phi : vec2; + var x_100_phi : vec2; + x_77 = x_77_phi; + let x_80 : i32 = x_80_phi; + if ((x_80 < 100)) { + } else { + break; + } + x_92_phi = x_77; + if ((x_77.x > 0)) { + x_91 = x_77; + x_91.y = (x_77.y - 1); + x_92_phi = x_91; + } + let x_92 : vec2 = x_92_phi; + x_100_phi = x_92; + if ((x_92.x < 0)) { + x_99 = x_92; + x_99.y = (x_92.y + 1); + x_100_phi = x_99; + } + let x_100 : vec2 = x_100_phi; + var x_78_1 : vec2 = x_100; + x_78_1.x = (x_100.x + (x_100.y / 2)); + let x_78 : vec2 = x_78_1; + + continuing { + x_81 = (x_80 + 1); + x_77_phi = x_78; + x_80_phi = x_81; + } + } + let x_105 : i32 = x_77.x; + x_111_phi = x_77; + if ((x_105 < 0)) { + x_110 = vec2(0, 0); + x_110.x = -(x_105); + x_111_phi = x_110; + } + let x_111 : vec2 = x_111_phi; + x_113_phi = x_111; + loop { + var x_114 : vec2; + let x_113 : vec2 = x_113_phi; + x_116 = x_113.x; + if ((x_116 > 15)) { + } else { + break; + } + + continuing { + x_114 = vec2(0, 0); + x_114.x = bitcast((x_116 - bitcast(16))); + x_113_phi = x_114; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_121 : vec4 = indexable[x_116]; + x_GLF_color = x_121; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl new file mode 100644 index 0000000000..be331aa369 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl @@ -0,0 +1,105 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_77 : vec2; + var x_110 : vec2; + var x_116 : i32; + var x_77_phi : vec2; + var x_80_phi : i32; + var x_111_phi : vec2; + var x_113_phi : vec2; + let x_56 : vec4 = gl_FragCoord; + let x_59 : vec2 = x_6.resolution; + let x_60 : vec2 = (vec2(x_56.x, x_56.y) / x_59); + let x_63 : i32 = i32((x_60.x * 8.0)); + let x_66 : i32 = i32((x_60.y * 8.0)); + let x_75 : vec2 = vec2(((((x_63 & 5) | (x_66 & 10)) * 8) + ((x_66 & 5) | (x_63 & 10))), 0); + x_77_phi = x_75; + x_80_phi = 0; + loop { + var x_91 : vec2; + var x_99 : vec2; + var x_81 : i32; + var x_92_phi : vec2; + var x_100_phi : vec2; + x_77 = x_77_phi; + let x_80 : i32 = x_80_phi; + if ((x_80 < 100)) { + } else { + break; + } + x_92_phi = x_77; + if ((x_77.x > 0)) { + x_91 = x_77; + x_91.y = (x_77.y - 1); + x_92_phi = x_91; + } + let x_92 : vec2 = x_92_phi; + x_100_phi = x_92; + if ((x_92.x < 0)) { + x_99 = x_92; + x_99.y = (x_92.y + 1); + x_100_phi = x_99; + } + let x_100 : vec2 = x_100_phi; + var x_78_1 : vec2 = x_100; + x_78_1.x = (x_100.x + (x_100.y / 2)); + let x_78 : vec2 = x_78_1; + + continuing { + x_81 = (x_80 + 1); + x_77_phi = x_78; + x_80_phi = x_81; + } + } + let x_105 : i32 = x_77.x; + x_111_phi = x_77; + if ((x_105 < 0)) { + x_110 = vec2(0, 0); + x_110.x = -(x_105); + x_111_phi = x_110; + } + let x_111 : vec2 = x_111_phi; + x_113_phi = x_111; + loop { + var x_114 : vec2; + let x_113 : vec2 = x_113_phi; + x_116 = x_113.x; + if ((x_116 > 15)) { + } else { + break; + } + + continuing { + x_114 = vec2(0, 0); + x_114.x = bitcast((x_116 - bitcast(16))); + x_113_phi = x_114; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_121 : vec4 = indexable[x_116]; + x_GLF_color = x_121; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..5a6f9c465e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.hlsl @@ -0,0 +1,104 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int2 x_77 = int2(0, 0); + int2 x_110 = int2(0, 0); + int x_116 = 0; + int2 x_77_phi = int2(0, 0); + int x_80_phi = 0; + int2 x_111_phi = int2(0, 0); + int2 x_113_phi = int2(0, 0); + const float4 x_56 = gl_FragCoord; + const float2 x_59 = asfloat(x_6[0].xy); + const float2 x_60 = (float2(x_56.x, x_56.y) / x_59); + const int x_63 = int((x_60.x * 8.0f)); + const int x_66 = int((x_60.y * 8.0f)); + const int2 x_75 = int2(((((x_63 & 5) | (x_66 & 10)) * 8) + ((x_66 & 5) | (x_63 & 10))), 0); + x_77_phi = x_75; + x_80_phi = 0; + while (true) { + int2 x_91 = int2(0, 0); + int2 x_99 = int2(0, 0); + int x_81 = 0; + int2 x_92_phi = int2(0, 0); + int2 x_100_phi = int2(0, 0); + x_77 = x_77_phi; + const int x_80 = x_80_phi; + if ((x_80 < 100)) { + } else { + break; + } + x_92_phi = x_77; + if ((x_77.x > 0)) { + x_91 = x_77; + x_91.y = (x_77.y - 1); + x_92_phi = x_91; + } + const int2 x_92 = x_92_phi; + x_100_phi = x_92; + if ((x_92.x < 0)) { + x_99 = x_92; + x_99.y = (x_92.y + 1); + x_100_phi = x_99; + } + const int2 x_100 = x_100_phi; + int2 x_78_1 = x_100; + x_78_1.x = (x_100.x + (x_100.y / 2)); + const int2 x_78 = x_78_1; + { + x_81 = (x_80 + 1); + x_77_phi = x_78; + x_80_phi = x_81; + } + } + const int x_105 = x_77.x; + x_111_phi = x_77; + if ((x_105 < 0)) { + x_110 = int2(0, 0); + x_110.x = -(x_105); + x_111_phi = x_110; + } + x_113_phi = x_111_phi; + while (true) { + int2 x_114 = int2(0, 0); + x_116 = x_113_phi.x; + if ((x_116 > 15)) { + } else { + break; + } + { + x_114 = int2(0, 0); + x_114.x = asint((x_116 - asint(16))); + x_113_phi = x_114; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_121 = indexable[x_116]; + x_GLF_color = x_121; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.msl new file mode 100644 index 0000000000..426677694e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int2 x_77 = 0; + int2 x_110 = 0; + int x_116 = 0; + int2 x_77_phi = 0; + int x_80_phi = 0; + int2 x_111_phi = 0; + int2 x_113_phi = 0; + float4 const x_56 = *(tint_symbol_6); + float2 const x_59 = x_6.resolution; + float2 const x_60 = (float2(x_56.x, x_56.y) / x_59); + int const x_63 = int((x_60.x * 8.0f)); + int const x_66 = int((x_60.y * 8.0f)); + int2 const x_75 = int2(((((x_63 & 5) | (x_66 & 10)) * 8) + ((x_66 & 5) | (x_63 & 10))), 0); + x_77_phi = x_75; + x_80_phi = 0; + while (true) { + int2 x_91 = 0; + int2 x_99 = 0; + int x_81 = 0; + int2 x_92_phi = 0; + int2 x_100_phi = 0; + x_77 = x_77_phi; + int const x_80 = x_80_phi; + if ((x_80 < 100)) { + } else { + break; + } + x_92_phi = x_77; + if ((x_77.x > 0)) { + x_91 = x_77; + x_91.y = (x_77.y - 1); + x_92_phi = x_91; + } + int2 const x_92 = x_92_phi; + x_100_phi = x_92; + if ((x_92.x < 0)) { + x_99 = x_92; + x_99.y = (x_92.y + 1); + x_100_phi = x_99; + } + int2 const x_100 = x_100_phi; + int2 x_78_1 = x_100; + x_78_1.x = (x_100.x + (x_100.y / 2)); + int2 const x_78 = x_78_1; + { + x_81 = (x_80 + 1); + x_77_phi = x_78; + x_80_phi = x_81; + } + } + int const x_105 = x_77.x; + x_111_phi = x_77; + if ((x_105 < 0)) { + x_110 = int2(0, 0); + x_110.x = -(x_105); + x_111_phi = x_110; + } + int2 const x_111 = x_111_phi; + x_113_phi = x_111; + while (true) { + int2 x_114 = 0; + int2 const x_113 = x_113_phi; + x_116 = x_113.x; + if ((x_116 > 15)) { + } else { + break; + } + { + x_114 = int2(0, 0); + x_114.x = as_type((x_116 - as_type(16))); + x_113_phi = x_114; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_121 = indexable.arr[x_116]; + *(tint_symbol_7) = x_121; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..d89e65c597 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.spvasm @@ -0,0 +1,292 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 185 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_77 "x_77" + OpName %x_110 "x_110" + OpName %x_116 "x_116" + OpName %x_77_phi "x_77_phi" + OpName %x_80_phi "x_80_phi" + OpName %x_111_phi "x_111_phi" + OpName %x_113_phi "x_113_phi" + OpName %x_91 "x_91" + OpName %x_99 "x_99" + OpName %x_81 "x_81" + OpName %x_92_phi "x_92_phi" + OpName %x_100_phi "x_100_phi" + OpName %x_78_1 "x_78_1" + OpName %x_114 "x_114" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %124 = OpConstantComposite %v2int %int_0 %int_0 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %151 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %153 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %154 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %155 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %157 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %158 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %159 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %160 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %161 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %162 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %164 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %166 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %167 = OpConstantComposite %_arr_v4float_uint_16 %151 %153 %154 %155 %156 %157 %158 %159 %151 %160 %161 %162 %163 %164 %165 %166 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %172 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_77 = OpVariable %_ptr_Function_v2int Function %29 + %x_110 = OpVariable %_ptr_Function_v2int Function %29 + %x_116 = OpVariable %_ptr_Function_int Function %33 + %x_77_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_80_phi = OpVariable %_ptr_Function_int Function %33 + %x_111_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_113_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_91 = OpVariable %_ptr_Function_v2int Function %29 + %x_99 = OpVariable %_ptr_Function_v2int Function %29 + %x_81 = OpVariable %_ptr_Function_int Function %33 + %x_92_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_100_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_78_1 = OpVariable %_ptr_Function_v2int Function %29 + %x_114 = OpVariable %_ptr_Function_v2int Function %29 + %38 = OpLoad %v4float %gl_FragCoord + %41 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %42 = OpLoad %v2float %41 + %43 = OpCompositeExtract %float %38 0 + %44 = OpCompositeExtract %float %38 1 + %45 = OpCompositeConstruct %v2float %43 %44 + %46 = OpFDiv %v2float %45 %42 + %48 = OpCompositeExtract %float %46 0 + %50 = OpFMul %float %48 %float_8 + %47 = OpConvertFToS %int %50 + %52 = OpCompositeExtract %float %46 1 + %53 = OpFMul %float %52 %float_8 + %51 = OpConvertFToS %int %53 + %55 = OpBitwiseAnd %int %47 %int_5 + %57 = OpBitwiseAnd %int %51 %int_10 + %58 = OpBitwiseOr %int %55 %57 + %60 = OpIMul %int %58 %int_8 + %61 = OpBitwiseAnd %int %51 %int_5 + %62 = OpBitwiseAnd %int %47 %int_10 + %63 = OpBitwiseOr %int %61 %62 + %64 = OpIAdd %int %60 %63 + %66 = OpCompositeConstruct %v2int %64 %int_0 + OpStore %x_77_phi %66 + OpStore %x_80_phi %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %76 = OpLoad %v2int %x_77_phi + OpStore %x_77 %76 + %77 = OpLoad %int %x_80_phi + %79 = OpSLessThan %bool %77 %int_100 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %68 + %81 = OpLabel + %84 = OpLoad %v2int %x_77 + OpStore %x_92_phi %84 + %85 = OpAccessChain %_ptr_Function_int %x_77 %uint_0 + %86 = OpLoad %int %85 + %87 = OpSGreaterThan %bool %86 %int_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpLoad %v2int %x_77 + OpStore %x_91 %90 + %92 = OpAccessChain %_ptr_Function_int %x_91 %uint_1 + %93 = OpAccessChain %_ptr_Function_int %x_77 %uint_1 + %94 = OpLoad %int %93 + %96 = OpISub %int %94 %int_1 + OpStore %92 %96 + %97 = OpLoad %v2int %x_91 + OpStore %x_92_phi %97 + OpBranch %88 + %88 = OpLabel + %98 = OpLoad %v2int %x_92_phi + OpStore %x_100_phi %98 + %99 = OpCompositeExtract %int %98 0 + %100 = OpSLessThan %bool %99 %int_0 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %x_99 %98 + %103 = OpAccessChain %_ptr_Function_int %x_99 %uint_1 + %104 = OpCompositeExtract %int %98 1 + %105 = OpIAdd %int %104 %int_1 + OpStore %103 %105 + %106 = OpLoad %v2int %x_99 + OpStore %x_100_phi %106 + OpBranch %101 + %101 = OpLabel + %107 = OpLoad %v2int %x_100_phi + OpStore %x_78_1 %107 + %109 = OpAccessChain %_ptr_Function_int %x_78_1 %uint_0 + %110 = OpCompositeExtract %int %107 0 + %111 = OpCompositeExtract %int %107 1 + %113 = OpSDiv %int %111 %int_2 + %114 = OpIAdd %int %110 %113 + OpStore %109 %114 + %115 = OpLoad %v2int %x_78_1 + OpBranch %69 + %69 = OpLabel + %116 = OpIAdd %int %77 %int_1 + OpStore %x_81 %116 + OpStore %x_77_phi %115 + %117 = OpLoad %int %x_81 + OpStore %x_80_phi %117 + OpBranch %67 + %68 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %x_77 %uint_0 + %119 = OpLoad %int %118 + %120 = OpLoad %v2int %x_77 + OpStore %x_111_phi %120 + %121 = OpSLessThan %bool %119 %int_0 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + OpStore %x_110 %124 + %125 = OpAccessChain %_ptr_Function_int %x_110 %uint_0 + %126 = OpSNegate %int %119 + OpStore %125 %126 + %127 = OpLoad %v2int %x_110 + OpStore %x_111_phi %127 + OpBranch %122 + %122 = OpLabel + %128 = OpLoad %v2int %x_111_phi + OpStore %x_113_phi %128 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %134 = OpLoad %v2int %x_113_phi + %135 = OpCompositeExtract %int %134 0 + OpStore %x_116 %135 + %136 = OpLoad %int %x_116 + %138 = OpSGreaterThan %bool %136 %int_15 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpBranch %139 + %141 = OpLabel + OpBranch %130 + %139 = OpLabel + OpBranch %131 + %131 = OpLabel + OpStore %x_114 %124 + %142 = OpAccessChain %_ptr_Function_int %x_114 %uint_0 + %144 = OpLoad %int %x_116 + %145 = OpCopyObject %int %int_16 + %147 = OpISub %int %144 %145 + %143 = OpCopyObject %int %147 + OpStore %142 %143 + %148 = OpLoad %v2int %x_114 + OpStore %x_113_phi %148 + OpBranch %129 + %130 = OpLabel + OpStore %indexable %167 + %168 = OpLoad %int %x_116 + %170 = OpAccessChain %_ptr_Function_v4float %indexable %168 + %171 = OpLoad %v4float %170 + OpStore %x_GLF_color %171 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %172 +%tint_symbol_1 = OpFunctionParameter %main_out + %176 = OpLabel + %177 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %177 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %179 = OpLabel + %180 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %180 + %181 = OpFunctionCall %void %main_1 + %183 = OpLoad %v4float %x_GLF_color + %184 = OpCompositeConstruct %main_out %183 + %182 = OpFunctionCall %void %tint_symbol_3 %184 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..be331aa369 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/0.wgsl.expected.wgsl @@ -0,0 +1,105 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_77 : vec2; + var x_110 : vec2; + var x_116 : i32; + var x_77_phi : vec2; + var x_80_phi : i32; + var x_111_phi : vec2; + var x_113_phi : vec2; + let x_56 : vec4 = gl_FragCoord; + let x_59 : vec2 = x_6.resolution; + let x_60 : vec2 = (vec2(x_56.x, x_56.y) / x_59); + let x_63 : i32 = i32((x_60.x * 8.0)); + let x_66 : i32 = i32((x_60.y * 8.0)); + let x_75 : vec2 = vec2(((((x_63 & 5) | (x_66 & 10)) * 8) + ((x_66 & 5) | (x_63 & 10))), 0); + x_77_phi = x_75; + x_80_phi = 0; + loop { + var x_91 : vec2; + var x_99 : vec2; + var x_81 : i32; + var x_92_phi : vec2; + var x_100_phi : vec2; + x_77 = x_77_phi; + let x_80 : i32 = x_80_phi; + if ((x_80 < 100)) { + } else { + break; + } + x_92_phi = x_77; + if ((x_77.x > 0)) { + x_91 = x_77; + x_91.y = (x_77.y - 1); + x_92_phi = x_91; + } + let x_92 : vec2 = x_92_phi; + x_100_phi = x_92; + if ((x_92.x < 0)) { + x_99 = x_92; + x_99.y = (x_92.y + 1); + x_100_phi = x_99; + } + let x_100 : vec2 = x_100_phi; + var x_78_1 : vec2 = x_100; + x_78_1.x = (x_100.x + (x_100.y / 2)); + let x_78 : vec2 = x_78_1; + + continuing { + x_81 = (x_80 + 1); + x_77_phi = x_78; + x_80_phi = x_81; + } + } + let x_105 : i32 = x_77.x; + x_111_phi = x_77; + if ((x_105 < 0)) { + x_110 = vec2(0, 0); + x_110.x = -(x_105); + x_111_phi = x_110; + } + let x_111 : vec2 = x_111_phi; + x_113_phi = x_111; + loop { + var x_114 : vec2; + let x_113 : vec2 = x_113_phi; + x_116 = x_113.x; + if ((x_116 > 15)) { + } else { + break; + } + + continuing { + x_114 = vec2(0, 0); + x_114.x = bitcast((x_116 - bitcast(16))); + x_113_phi = x_114; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_121 : vec4 = indexable[x_116]; + x_GLF_color = x_121; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm new file mode 100644 index 0000000000..d7ff45c6ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm @@ -0,0 +1,167 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %indexable "indexable" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_100 = OpConstant %int 100 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %37 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %38 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %40 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %41 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %42 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %43 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %46 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %49 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %50 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %51 = OpConstantComposite %_arr_v4float_uint_16 %35 %37 %38 %39 %40 %41 %42 %43 %35 %44 %45 %46 %47 %48 %49 %50 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %54 = OpUndef %v2int + %float_0_0 = OpConstant %float 0 + %56 = OpConstantComposite %v4float %float_0_0 %float_0_0 %float_0_0 %float_0_0 + %57 = OpConstantComposite %_arr_v4float_uint_16 %56 %56 %56 %56 %56 %56 %56 %56 %56 %56 %56 %56 %56 %56 %56 %56 + %main = OpFunction %void None %9 + %58 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %59 = OpLoad %v4float %gl_FragCoord + %60 = OpVectorShuffle %v2float %59 %59 0 1 + %61 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %62 = OpLoad %v2float %61 + %63 = OpFDiv %v2float %60 %62 + %64 = OpCompositeExtract %float %63 0 + %65 = OpFMul %float %64 %float_8 + %66 = OpConvertFToS %int %65 + %67 = OpCompositeExtract %float %63 1 + %68 = OpFMul %float %67 %float_8 + %69 = OpConvertFToS %int %68 + %70 = OpBitwiseAnd %int %66 %int_5 + %71 = OpBitwiseAnd %int %69 %int_10 + %72 = OpBitwiseOr %int %70 %71 + %73 = OpBitwiseAnd %int %69 %int_5 + %74 = OpBitwiseAnd %int %66 %int_10 + %75 = OpBitwiseOr %int %73 %74 + %76 = OpIMul %int %72 %int_8 + %77 = OpIAdd %int %76 %75 + %78 = OpCompositeConstruct %v2int %77 %int_0 + OpBranch %79 + %79 = OpLabel + %80 = OpPhi %v2int %78 %58 %81 %82 + %83 = OpPhi %int %int_0 %58 %84 %82 + %85 = OpSLessThan %bool %83 %int_100 + OpLoopMerge %86 %82 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpCompositeExtract %int %80 0 + %89 = OpSGreaterThan %bool %88 %int_0 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + %92 = OpCompositeExtract %int %80 1 + %93 = OpISub %int %92 %int_1 + %94 = OpCompositeInsert %v2int %93 %80 1 + OpBranch %90 + %90 = OpLabel + %95 = OpPhi %v2int %80 %87 %94 %91 + %96 = OpCompositeExtract %int %95 0 + %97 = OpSLessThan %bool %96 %int_0 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpCompositeExtract %int %95 1 + %101 = OpIAdd %int %100 %int_1 + %102 = OpCompositeInsert %v2int %101 %95 1 + OpBranch %98 + %98 = OpLabel + %103 = OpPhi %v2int %95 %90 %102 %99 + %104 = OpCompositeExtract %int %103 1 + %105 = OpSDiv %int %104 %int_2 + %106 = OpCompositeExtract %int %103 0 + %107 = OpIAdd %int %106 %105 + %81 = OpCompositeInsert %v2int %107 %103 0 + OpBranch %82 + %82 = OpLabel + %84 = OpIAdd %int %83 %int_1 + OpBranch %79 + %86 = OpLabel + %108 = OpCompositeExtract %int %80 0 + %109 = OpSLessThan %bool %108 %int_0 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpSNegate %int %108 + %113 = OpCompositeInsert %v2int %112 %54 0 + OpBranch %110 + %110 = OpLabel + %114 = OpPhi %v2int %80 %86 %113 %111 + OpBranch %115 + %115 = OpLabel + %116 = OpPhi %v2int %114 %110 %117 %118 + %119 = OpCompositeExtract %int %116 0 + %120 = OpSGreaterThan %bool %119 %int_15 + OpLoopMerge %121 %118 None + OpBranchConditional %120 %118 %121 + %118 = OpLabel + %122 = OpISub %int %119 %int_16 + %117 = OpCompositeInsert %v2int %122 %54 0 + OpBranch %115 + %121 = OpLabel + OpStore %indexable %51 + %123 = OpLoad %_arr_v4float_uint_16 %indexable + OpStore %indexable %57 + OpStore %indexable %123 + %124 = OpAccessChain %_ptr_Function_v4float %indexable %119 + %125 = OpLoad %v4float %124 + OpStore %_GLF_color %125 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..9baedc80cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.hlsl @@ -0,0 +1,108 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int2 x_80 = int2(0, 0); + int2 x_113 = int2(0, 0); + int x_119 = 0; + int2 x_80_phi = int2(0, 0); + int x_83_phi = 0; + int2 x_114_phi = int2(0, 0); + int2 x_116_phi = int2(0, 0); + const float4 x_59 = gl_FragCoord; + const float2 x_62 = asfloat(x_6[0].xy); + const float2 x_63 = (float2(x_59.x, x_59.y) / x_62); + const int x_66 = int((x_63.x * 8.0f)); + const int x_69 = int((x_63.y * 8.0f)); + const int2 x_78 = int2(((((x_66 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_66 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + while (true) { + int2 x_94 = int2(0, 0); + int2 x_102 = int2(0, 0); + int x_84 = 0; + int2 x_95_phi = int2(0, 0); + int2 x_103_phi = int2(0, 0); + x_80 = x_80_phi; + const int x_83 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + const int2 x_95 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + const int2 x_103 = x_103_phi; + int2 x_81_1 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + const int2 x_81 = x_81_1; + { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + const int x_108 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = int2(0, 0); + x_113.x = -(x_108); + x_114_phi = x_113; + } + x_116_phi = x_114_phi; + while (true) { + int2 x_117 = int2(0, 0); + x_119 = x_116_phi.x; + if ((x_119 > 15)) { + } else { + break; + } + { + x_117 = int2(0, 0); + x_117.x = asint((x_119 - asint(16))); + x_116_phi = x_117; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_123[16] = indexable; + const float4 tint_symbol_6[16] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + indexable = tint_symbol_6; + indexable = x_123; + const float4 x_125 = indexable[x_119]; + x_GLF_color = x_125; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.msl new file mode 100644 index 0000000000..0e7d8641b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + tint_array_wrapper indexable = {}; + int2 x_80 = 0; + int2 x_113 = 0; + int x_119 = 0; + int2 x_80_phi = 0; + int x_83_phi = 0; + int2 x_114_phi = 0; + int2 x_116_phi = 0; + float4 const x_59 = *(tint_symbol_7); + float2 const x_62 = x_6.resolution; + float2 const x_63 = (float2(x_59.x, x_59.y) / x_62); + int const x_66 = int((x_63.x * 8.0f)); + int const x_69 = int((x_63.y * 8.0f)); + int2 const x_78 = int2(((((x_66 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_66 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + while (true) { + int2 x_94 = 0; + int2 x_102 = 0; + int x_84 = 0; + int2 x_95_phi = 0; + int2 x_103_phi = 0; + x_80 = x_80_phi; + int const x_83 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + int2 const x_95 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + int2 const x_103 = x_103_phi; + int2 x_81_1 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + int2 const x_81 = x_81_1; + { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + int const x_108 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = int2(0, 0); + x_113.x = -(x_108); + x_114_phi = x_113; + } + int2 const x_114 = x_114_phi; + x_116_phi = x_114; + while (true) { + int2 x_117 = 0; + int2 const x_116 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + { + x_117 = int2(0, 0); + x_117.x = as_type((x_119 - as_type(16))); + x_116_phi = x_117; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + tint_array_wrapper const x_123 = indexable; + tint_array_wrapper const tint_symbol_5 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + indexable = tint_symbol_5; + indexable = x_123; + float4 const x_125 = indexable.arr[x_119]; + *(tint_symbol_8) = x_125; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_6 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..0b49352fbc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.spvasm @@ -0,0 +1,297 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 188 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_80 "x_80" + OpName %x_113 "x_113" + OpName %x_119 "x_119" + OpName %x_80_phi "x_80_phi" + OpName %x_83_phi "x_83_phi" + OpName %x_114_phi "x_114_phi" + OpName %x_116_phi "x_116_phi" + OpName %x_94 "x_94" + OpName %x_102 "x_102" + OpName %x_84 "x_84" + OpName %x_95_phi "x_95_phi" + OpName %x_103_phi "x_103_phi" + OpName %x_81_1 "x_81_1" + OpName %x_117 "x_117" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %124 = OpConstantComposite %v2int %int_0 %int_0 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %151 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %153 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %154 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %155 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %157 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %158 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %159 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %160 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %161 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %162 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %164 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %166 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %167 = OpConstantComposite %_arr_v4float_uint_16 %151 %153 %154 %155 %156 %157 %158 %159 %151 %160 %161 %162 %163 %164 %165 %166 + %169 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %170 = OpConstantComposite %_arr_v4float_uint_16 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %175 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_80 = OpVariable %_ptr_Function_v2int Function %29 + %x_113 = OpVariable %_ptr_Function_v2int Function %29 + %x_119 = OpVariable %_ptr_Function_int Function %33 + %x_80_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_83_phi = OpVariable %_ptr_Function_int Function %33 + %x_114_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_116_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_94 = OpVariable %_ptr_Function_v2int Function %29 + %x_102 = OpVariable %_ptr_Function_v2int Function %29 + %x_84 = OpVariable %_ptr_Function_int Function %33 + %x_95_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_103_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_81_1 = OpVariable %_ptr_Function_v2int Function %29 + %x_117 = OpVariable %_ptr_Function_v2int Function %29 + %38 = OpLoad %v4float %gl_FragCoord + %41 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %42 = OpLoad %v2float %41 + %43 = OpCompositeExtract %float %38 0 + %44 = OpCompositeExtract %float %38 1 + %45 = OpCompositeConstruct %v2float %43 %44 + %46 = OpFDiv %v2float %45 %42 + %48 = OpCompositeExtract %float %46 0 + %50 = OpFMul %float %48 %float_8 + %47 = OpConvertFToS %int %50 + %52 = OpCompositeExtract %float %46 1 + %53 = OpFMul %float %52 %float_8 + %51 = OpConvertFToS %int %53 + %55 = OpBitwiseAnd %int %47 %int_5 + %57 = OpBitwiseAnd %int %51 %int_10 + %58 = OpBitwiseOr %int %55 %57 + %60 = OpIMul %int %58 %int_8 + %61 = OpBitwiseAnd %int %51 %int_5 + %62 = OpBitwiseAnd %int %47 %int_10 + %63 = OpBitwiseOr %int %61 %62 + %64 = OpIAdd %int %60 %63 + %66 = OpCompositeConstruct %v2int %64 %int_0 + OpStore %x_80_phi %66 + OpStore %x_83_phi %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %76 = OpLoad %v2int %x_80_phi + OpStore %x_80 %76 + %77 = OpLoad %int %x_83_phi + %79 = OpSLessThan %bool %77 %int_100 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %68 + %81 = OpLabel + %84 = OpLoad %v2int %x_80 + OpStore %x_95_phi %84 + %85 = OpAccessChain %_ptr_Function_int %x_80 %uint_0 + %86 = OpLoad %int %85 + %87 = OpSGreaterThan %bool %86 %int_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpLoad %v2int %x_80 + OpStore %x_94 %90 + %92 = OpAccessChain %_ptr_Function_int %x_94 %uint_1 + %93 = OpAccessChain %_ptr_Function_int %x_80 %uint_1 + %94 = OpLoad %int %93 + %96 = OpISub %int %94 %int_1 + OpStore %92 %96 + %97 = OpLoad %v2int %x_94 + OpStore %x_95_phi %97 + OpBranch %88 + %88 = OpLabel + %98 = OpLoad %v2int %x_95_phi + OpStore %x_103_phi %98 + %99 = OpCompositeExtract %int %98 0 + %100 = OpSLessThan %bool %99 %int_0 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %x_102 %98 + %103 = OpAccessChain %_ptr_Function_int %x_102 %uint_1 + %104 = OpCompositeExtract %int %98 1 + %105 = OpIAdd %int %104 %int_1 + OpStore %103 %105 + %106 = OpLoad %v2int %x_102 + OpStore %x_103_phi %106 + OpBranch %101 + %101 = OpLabel + %107 = OpLoad %v2int %x_103_phi + OpStore %x_81_1 %107 + %109 = OpAccessChain %_ptr_Function_int %x_81_1 %uint_0 + %110 = OpCompositeExtract %int %107 0 + %111 = OpCompositeExtract %int %107 1 + %113 = OpSDiv %int %111 %int_2 + %114 = OpIAdd %int %110 %113 + OpStore %109 %114 + %115 = OpLoad %v2int %x_81_1 + OpBranch %69 + %69 = OpLabel + %116 = OpIAdd %int %77 %int_1 + OpStore %x_84 %116 + OpStore %x_80_phi %115 + %117 = OpLoad %int %x_84 + OpStore %x_83_phi %117 + OpBranch %67 + %68 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %x_80 %uint_0 + %119 = OpLoad %int %118 + %120 = OpLoad %v2int %x_80 + OpStore %x_114_phi %120 + %121 = OpSLessThan %bool %119 %int_0 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + OpStore %x_113 %124 + %125 = OpAccessChain %_ptr_Function_int %x_113 %uint_0 + %126 = OpSNegate %int %119 + OpStore %125 %126 + %127 = OpLoad %v2int %x_113 + OpStore %x_114_phi %127 + OpBranch %122 + %122 = OpLabel + %128 = OpLoad %v2int %x_114_phi + OpStore %x_116_phi %128 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %134 = OpLoad %v2int %x_116_phi + %135 = OpCompositeExtract %int %134 0 + OpStore %x_119 %135 + %136 = OpLoad %int %x_119 + %138 = OpSGreaterThan %bool %136 %int_15 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpBranch %139 + %141 = OpLabel + OpBranch %130 + %139 = OpLabel + OpBranch %131 + %131 = OpLabel + OpStore %x_117 %124 + %142 = OpAccessChain %_ptr_Function_int %x_117 %uint_0 + %144 = OpLoad %int %x_119 + %145 = OpCopyObject %int %int_16 + %147 = OpISub %int %144 %145 + %143 = OpCopyObject %int %147 + OpStore %142 %143 + %148 = OpLoad %v2int %x_117 + OpStore %x_116_phi %148 + OpBranch %129 + %130 = OpLabel + OpStore %indexable %167 + %168 = OpLoad %_arr_v4float_uint_16 %indexable + OpStore %indexable %170 + OpStore %indexable %168 + %171 = OpLoad %int %x_119 + %173 = OpAccessChain %_ptr_Function_v4float %indexable %171 + %174 = OpLoad %v4float %173 + OpStore %x_GLF_color %174 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %175 +%tint_symbol_1 = OpFunctionParameter %main_out + %179 = OpLabel + %180 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %180 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %182 = OpLabel + %183 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %183 + %184 = OpFunctionCall %void %main_1 + %186 = OpLoad %v4float %x_GLF_color + %187 = OpCompositeConstruct %main_out %186 + %185 = OpFunctionCall %void %tint_symbol_3 %187 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..0424d49b7c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.spvasm.expected.wgsl @@ -0,0 +1,108 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_80 : vec2; + var x_113 : vec2; + var x_119 : i32; + var x_80_phi : vec2; + var x_83_phi : i32; + var x_114_phi : vec2; + var x_116_phi : vec2; + let x_59 : vec4 = gl_FragCoord; + let x_62 : vec2 = x_6.resolution; + let x_63 : vec2 = (vec2(x_59.x, x_59.y) / x_62); + let x_66 : i32 = i32((x_63.x * 8.0)); + let x_69 : i32 = i32((x_63.y * 8.0)); + let x_78 : vec2 = vec2(((((x_66 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_66 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + loop { + var x_94 : vec2; + var x_102 : vec2; + var x_84 : i32; + var x_95_phi : vec2; + var x_103_phi : vec2; + x_80 = x_80_phi; + let x_83 : i32 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + let x_95 : vec2 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + let x_103 : vec2 = x_103_phi; + var x_81_1 : vec2 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + let x_81 : vec2 = x_81_1; + + continuing { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + let x_108 : i32 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = vec2(0, 0); + x_113.x = -(x_108); + x_114_phi = x_113; + } + let x_114 : vec2 = x_114_phi; + x_116_phi = x_114; + loop { + var x_117 : vec2; + let x_116 : vec2 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + + continuing { + x_117 = vec2(0, 0); + x_117.x = bitcast((x_119 - bitcast(16))); + x_116_phi = x_117; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_123 : array, 16> = indexable; + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + indexable = x_123; + let x_125 : vec4 = indexable[x_119]; + x_GLF_color = x_125; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl new file mode 100644 index 0000000000..0424d49b7c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl @@ -0,0 +1,108 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_80 : vec2; + var x_113 : vec2; + var x_119 : i32; + var x_80_phi : vec2; + var x_83_phi : i32; + var x_114_phi : vec2; + var x_116_phi : vec2; + let x_59 : vec4 = gl_FragCoord; + let x_62 : vec2 = x_6.resolution; + let x_63 : vec2 = (vec2(x_59.x, x_59.y) / x_62); + let x_66 : i32 = i32((x_63.x * 8.0)); + let x_69 : i32 = i32((x_63.y * 8.0)); + let x_78 : vec2 = vec2(((((x_66 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_66 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + loop { + var x_94 : vec2; + var x_102 : vec2; + var x_84 : i32; + var x_95_phi : vec2; + var x_103_phi : vec2; + x_80 = x_80_phi; + let x_83 : i32 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + let x_95 : vec2 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + let x_103 : vec2 = x_103_phi; + var x_81_1 : vec2 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + let x_81 : vec2 = x_81_1; + + continuing { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + let x_108 : i32 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = vec2(0, 0); + x_113.x = -(x_108); + x_114_phi = x_113; + } + let x_114 : vec2 = x_114_phi; + x_116_phi = x_114; + loop { + var x_117 : vec2; + let x_116 : vec2 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + + continuing { + x_117 = vec2(0, 0); + x_117.x = bitcast((x_119 - bitcast(16))); + x_116_phi = x_117; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_123 : array, 16> = indexable; + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + indexable = x_123; + let x_125 : vec4 = indexable[x_119]; + x_GLF_color = x_125; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..9baedc80cd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.hlsl @@ -0,0 +1,108 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int2 x_80 = int2(0, 0); + int2 x_113 = int2(0, 0); + int x_119 = 0; + int2 x_80_phi = int2(0, 0); + int x_83_phi = 0; + int2 x_114_phi = int2(0, 0); + int2 x_116_phi = int2(0, 0); + const float4 x_59 = gl_FragCoord; + const float2 x_62 = asfloat(x_6[0].xy); + const float2 x_63 = (float2(x_59.x, x_59.y) / x_62); + const int x_66 = int((x_63.x * 8.0f)); + const int x_69 = int((x_63.y * 8.0f)); + const int2 x_78 = int2(((((x_66 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_66 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + while (true) { + int2 x_94 = int2(0, 0); + int2 x_102 = int2(0, 0); + int x_84 = 0; + int2 x_95_phi = int2(0, 0); + int2 x_103_phi = int2(0, 0); + x_80 = x_80_phi; + const int x_83 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + const int2 x_95 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + const int2 x_103 = x_103_phi; + int2 x_81_1 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + const int2 x_81 = x_81_1; + { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + const int x_108 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = int2(0, 0); + x_113.x = -(x_108); + x_114_phi = x_113; + } + x_116_phi = x_114_phi; + while (true) { + int2 x_117 = int2(0, 0); + x_119 = x_116_phi.x; + if ((x_119 > 15)) { + } else { + break; + } + { + x_117 = int2(0, 0); + x_117.x = asint((x_119 - asint(16))); + x_116_phi = x_117; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_123[16] = indexable; + const float4 tint_symbol_6[16] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + indexable = tint_symbol_6; + indexable = x_123; + const float4 x_125 = indexable[x_119]; + x_GLF_color = x_125; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.msl new file mode 100644 index 0000000000..0e7d8641b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + tint_array_wrapper indexable = {}; + int2 x_80 = 0; + int2 x_113 = 0; + int x_119 = 0; + int2 x_80_phi = 0; + int x_83_phi = 0; + int2 x_114_phi = 0; + int2 x_116_phi = 0; + float4 const x_59 = *(tint_symbol_7); + float2 const x_62 = x_6.resolution; + float2 const x_63 = (float2(x_59.x, x_59.y) / x_62); + int const x_66 = int((x_63.x * 8.0f)); + int const x_69 = int((x_63.y * 8.0f)); + int2 const x_78 = int2(((((x_66 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_66 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + while (true) { + int2 x_94 = 0; + int2 x_102 = 0; + int x_84 = 0; + int2 x_95_phi = 0; + int2 x_103_phi = 0; + x_80 = x_80_phi; + int const x_83 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + int2 const x_95 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + int2 const x_103 = x_103_phi; + int2 x_81_1 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + int2 const x_81 = x_81_1; + { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + int const x_108 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = int2(0, 0); + x_113.x = -(x_108); + x_114_phi = x_113; + } + int2 const x_114 = x_114_phi; + x_116_phi = x_114; + while (true) { + int2 x_117 = 0; + int2 const x_116 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + { + x_117 = int2(0, 0); + x_117.x = as_type((x_119 - as_type(16))); + x_116_phi = x_117; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + tint_array_wrapper const x_123 = indexable; + tint_array_wrapper const tint_symbol_5 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + indexable = tint_symbol_5; + indexable = x_123; + float4 const x_125 = indexable.arr[x_119]; + *(tint_symbol_8) = x_125; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_6 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..0b49352fbc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.spvasm @@ -0,0 +1,297 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 188 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_80 "x_80" + OpName %x_113 "x_113" + OpName %x_119 "x_119" + OpName %x_80_phi "x_80_phi" + OpName %x_83_phi "x_83_phi" + OpName %x_114_phi "x_114_phi" + OpName %x_116_phi "x_116_phi" + OpName %x_94 "x_94" + OpName %x_102 "x_102" + OpName %x_84 "x_84" + OpName %x_95_phi "x_95_phi" + OpName %x_103_phi "x_103_phi" + OpName %x_81_1 "x_81_1" + OpName %x_117 "x_117" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %124 = OpConstantComposite %v2int %int_0 %int_0 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %151 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %153 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %154 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %155 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %157 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %158 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %159 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %160 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %161 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %162 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %164 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %166 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %167 = OpConstantComposite %_arr_v4float_uint_16 %151 %153 %154 %155 %156 %157 %158 %159 %151 %160 %161 %162 %163 %164 %165 %166 + %169 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %170 = OpConstantComposite %_arr_v4float_uint_16 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %175 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_80 = OpVariable %_ptr_Function_v2int Function %29 + %x_113 = OpVariable %_ptr_Function_v2int Function %29 + %x_119 = OpVariable %_ptr_Function_int Function %33 + %x_80_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_83_phi = OpVariable %_ptr_Function_int Function %33 + %x_114_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_116_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_94 = OpVariable %_ptr_Function_v2int Function %29 + %x_102 = OpVariable %_ptr_Function_v2int Function %29 + %x_84 = OpVariable %_ptr_Function_int Function %33 + %x_95_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_103_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_81_1 = OpVariable %_ptr_Function_v2int Function %29 + %x_117 = OpVariable %_ptr_Function_v2int Function %29 + %38 = OpLoad %v4float %gl_FragCoord + %41 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %42 = OpLoad %v2float %41 + %43 = OpCompositeExtract %float %38 0 + %44 = OpCompositeExtract %float %38 1 + %45 = OpCompositeConstruct %v2float %43 %44 + %46 = OpFDiv %v2float %45 %42 + %48 = OpCompositeExtract %float %46 0 + %50 = OpFMul %float %48 %float_8 + %47 = OpConvertFToS %int %50 + %52 = OpCompositeExtract %float %46 1 + %53 = OpFMul %float %52 %float_8 + %51 = OpConvertFToS %int %53 + %55 = OpBitwiseAnd %int %47 %int_5 + %57 = OpBitwiseAnd %int %51 %int_10 + %58 = OpBitwiseOr %int %55 %57 + %60 = OpIMul %int %58 %int_8 + %61 = OpBitwiseAnd %int %51 %int_5 + %62 = OpBitwiseAnd %int %47 %int_10 + %63 = OpBitwiseOr %int %61 %62 + %64 = OpIAdd %int %60 %63 + %66 = OpCompositeConstruct %v2int %64 %int_0 + OpStore %x_80_phi %66 + OpStore %x_83_phi %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %76 = OpLoad %v2int %x_80_phi + OpStore %x_80 %76 + %77 = OpLoad %int %x_83_phi + %79 = OpSLessThan %bool %77 %int_100 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %68 + %81 = OpLabel + %84 = OpLoad %v2int %x_80 + OpStore %x_95_phi %84 + %85 = OpAccessChain %_ptr_Function_int %x_80 %uint_0 + %86 = OpLoad %int %85 + %87 = OpSGreaterThan %bool %86 %int_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpLoad %v2int %x_80 + OpStore %x_94 %90 + %92 = OpAccessChain %_ptr_Function_int %x_94 %uint_1 + %93 = OpAccessChain %_ptr_Function_int %x_80 %uint_1 + %94 = OpLoad %int %93 + %96 = OpISub %int %94 %int_1 + OpStore %92 %96 + %97 = OpLoad %v2int %x_94 + OpStore %x_95_phi %97 + OpBranch %88 + %88 = OpLabel + %98 = OpLoad %v2int %x_95_phi + OpStore %x_103_phi %98 + %99 = OpCompositeExtract %int %98 0 + %100 = OpSLessThan %bool %99 %int_0 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %x_102 %98 + %103 = OpAccessChain %_ptr_Function_int %x_102 %uint_1 + %104 = OpCompositeExtract %int %98 1 + %105 = OpIAdd %int %104 %int_1 + OpStore %103 %105 + %106 = OpLoad %v2int %x_102 + OpStore %x_103_phi %106 + OpBranch %101 + %101 = OpLabel + %107 = OpLoad %v2int %x_103_phi + OpStore %x_81_1 %107 + %109 = OpAccessChain %_ptr_Function_int %x_81_1 %uint_0 + %110 = OpCompositeExtract %int %107 0 + %111 = OpCompositeExtract %int %107 1 + %113 = OpSDiv %int %111 %int_2 + %114 = OpIAdd %int %110 %113 + OpStore %109 %114 + %115 = OpLoad %v2int %x_81_1 + OpBranch %69 + %69 = OpLabel + %116 = OpIAdd %int %77 %int_1 + OpStore %x_84 %116 + OpStore %x_80_phi %115 + %117 = OpLoad %int %x_84 + OpStore %x_83_phi %117 + OpBranch %67 + %68 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %x_80 %uint_0 + %119 = OpLoad %int %118 + %120 = OpLoad %v2int %x_80 + OpStore %x_114_phi %120 + %121 = OpSLessThan %bool %119 %int_0 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + OpStore %x_113 %124 + %125 = OpAccessChain %_ptr_Function_int %x_113 %uint_0 + %126 = OpSNegate %int %119 + OpStore %125 %126 + %127 = OpLoad %v2int %x_113 + OpStore %x_114_phi %127 + OpBranch %122 + %122 = OpLabel + %128 = OpLoad %v2int %x_114_phi + OpStore %x_116_phi %128 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %134 = OpLoad %v2int %x_116_phi + %135 = OpCompositeExtract %int %134 0 + OpStore %x_119 %135 + %136 = OpLoad %int %x_119 + %138 = OpSGreaterThan %bool %136 %int_15 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpBranch %139 + %141 = OpLabel + OpBranch %130 + %139 = OpLabel + OpBranch %131 + %131 = OpLabel + OpStore %x_117 %124 + %142 = OpAccessChain %_ptr_Function_int %x_117 %uint_0 + %144 = OpLoad %int %x_119 + %145 = OpCopyObject %int %int_16 + %147 = OpISub %int %144 %145 + %143 = OpCopyObject %int %147 + OpStore %142 %143 + %148 = OpLoad %v2int %x_117 + OpStore %x_116_phi %148 + OpBranch %129 + %130 = OpLabel + OpStore %indexable %167 + %168 = OpLoad %_arr_v4float_uint_16 %indexable + OpStore %indexable %170 + OpStore %indexable %168 + %171 = OpLoad %int %x_119 + %173 = OpAccessChain %_ptr_Function_v4float %indexable %171 + %174 = OpLoad %v4float %173 + OpStore %x_GLF_color %174 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %175 +%tint_symbol_1 = OpFunctionParameter %main_out + %179 = OpLabel + %180 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %180 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %182 = OpLabel + %183 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %183 + %184 = OpFunctionCall %void %main_1 + %186 = OpLoad %v4float %x_GLF_color + %187 = OpCompositeConstruct %main_out %186 + %185 = OpFunctionCall %void %tint_symbol_3 %187 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..0424d49b7c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-O-mutate-variable/1.wgsl.expected.wgsl @@ -0,0 +1,108 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_80 : vec2; + var x_113 : vec2; + var x_119 : i32; + var x_80_phi : vec2; + var x_83_phi : i32; + var x_114_phi : vec2; + var x_116_phi : vec2; + let x_59 : vec4 = gl_FragCoord; + let x_62 : vec2 = x_6.resolution; + let x_63 : vec2 = (vec2(x_59.x, x_59.y) / x_62); + let x_66 : i32 = i32((x_63.x * 8.0)); + let x_69 : i32 = i32((x_63.y * 8.0)); + let x_78 : vec2 = vec2(((((x_66 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_66 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + loop { + var x_94 : vec2; + var x_102 : vec2; + var x_84 : i32; + var x_95_phi : vec2; + var x_103_phi : vec2; + x_80 = x_80_phi; + let x_83 : i32 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + let x_95 : vec2 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + let x_103 : vec2 = x_103_phi; + var x_81_1 : vec2 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + let x_81 : vec2 = x_81_1; + + continuing { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + let x_108 : i32 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = vec2(0, 0); + x_113.x = -(x_108); + x_114_phi = x_113; + } + let x_114 : vec2 = x_114_phi; + x_116_phi = x_114; + loop { + var x_117 : vec2; + let x_116 : vec2 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + + continuing { + x_117 = vec2(0, 0); + x_117.x = bitcast((x_119 - bitcast(16))); + x_116_phi = x_117; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_123 : array, 16> = indexable; + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + indexable = x_123; + let x_125 : vec4 = indexable[x_119]; + x_GLF_color = x_125; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm new file mode 100644 index 0000000000..e5750e17c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm @@ -0,0 +1,160 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %indexable "indexable" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_100 = OpConstant %int 100 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %37 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %38 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %40 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %41 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %42 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %43 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %46 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %49 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %50 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %51 = OpConstantComposite %_arr_v4float_uint_16 %35 %37 %38 %39 %40 %41 %42 %43 %35 %44 %45 %46 %47 %48 %49 %50 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main = OpFunction %void None %9 + %54 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %55 = OpLoad %v4float %gl_FragCoord + %56 = OpVectorShuffle %v2float %55 %55 0 1 + %57 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %58 = OpLoad %v2float %57 + %59 = OpFDiv %v2float %56 %58 + %60 = OpCompositeExtract %float %59 0 + %61 = OpFMul %float %60 %float_8 + %62 = OpConvertFToS %int %61 + %63 = OpCompositeExtract %float %59 1 + %64 = OpFMul %float %63 %float_8 + %65 = OpConvertFToS %int %64 + %66 = OpBitwiseAnd %int %62 %int_5 + %67 = OpBitwiseAnd %int %65 %int_10 + %68 = OpBitwiseOr %int %66 %67 + %69 = OpBitwiseAnd %int %65 %int_5 + %70 = OpBitwiseAnd %int %62 %int_10 + %71 = OpBitwiseOr %int %69 %70 + %72 = OpIMul %int %68 %int_8 + %73 = OpIAdd %int %72 %71 + %74 = OpCompositeConstruct %v2int %73 %int_0 + OpBranch %75 + %75 = OpLabel + %76 = OpPhi %v2int %74 %54 %77 %78 + %79 = OpPhi %int %int_0 %54 %80 %78 + %81 = OpSLessThan %bool %79 %int_100 + OpLoopMerge %82 %78 None + OpBranchConditional %81 %83 %82 + %83 = OpLabel + %84 = OpCompositeExtract %int %76 0 + %85 = OpSGreaterThan %bool %84 %int_0 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpCompositeExtract %int %76 1 + %89 = OpISub %int %88 %int_1 + %90 = OpCompositeInsert %v2int %89 %76 1 + OpBranch %86 + %86 = OpLabel + %91 = OpPhi %v2int %76 %83 %90 %87 + %92 = OpCompositeExtract %int %91 0 + %93 = OpSLessThan %bool %92 %int_0 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %94 + %95 = OpLabel + %96 = OpCompositeExtract %int %91 1 + %97 = OpIAdd %int %96 %int_1 + %98 = OpCompositeInsert %v2int %97 %91 1 + OpBranch %94 + %94 = OpLabel + %99 = OpPhi %v2int %91 %86 %98 %95 + %100 = OpCompositeExtract %int %99 1 + %101 = OpSDiv %int %100 %int_2 + %102 = OpCompositeExtract %int %99 0 + %103 = OpIAdd %int %102 %101 + %77 = OpCompositeInsert %v2int %103 %99 0 + OpBranch %78 + %78 = OpLabel + %80 = OpIAdd %int %79 %int_1 + OpBranch %75 + %82 = OpLabel + %104 = OpCompositeExtract %int %76 0 + %105 = OpSLessThan %bool %104 %int_0 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + %108 = OpSNegate %int %104 + %109 = OpCompositeInsert %v2int %108 %76 0 + OpBranch %106 + %106 = OpLabel + %110 = OpPhi %v2int %76 %82 %109 %107 + OpBranch %111 + %111 = OpLabel + %112 = OpPhi %v2int %110 %106 %113 %114 + %115 = OpCompositeExtract %int %112 0 + %116 = OpSGreaterThan %bool %115 %int_15 + OpLoopMerge %117 %114 None + OpBranchConditional %116 %114 %117 + %114 = OpLabel + %118 = OpISub %int %115 %int_16 + %113 = OpCompositeInsert %v2int %118 %112 0 + OpBranch %111 + %117 = OpLabel + OpStore %indexable %51 + %119 = OpAccessChain %_ptr_Function_v4float %indexable %115 + %120 = OpLoad %v4float %119 + OpStore %_GLF_color %120 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..d58e8dc1c3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.hlsl @@ -0,0 +1,105 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int2 x_76 = int2(0, 0); + int2 x_109 = int2(0, 0); + int x_115 = 0; + int2 x_76_phi = int2(0, 0); + int x_79_phi = 0; + int2 x_110_phi = int2(0, 0); + int2 x_112_phi = int2(0, 0); + const float4 x_55 = gl_FragCoord; + const float2 x_58 = asfloat(x_6[0].xy); + const float2 x_59 = (float2(x_55.x, x_55.y) / x_58); + const int x_62 = int((x_59.x * 8.0f)); + const int x_65 = int((x_59.y * 8.0f)); + const int2 x_74 = int2(((((x_62 & 5) | (x_65 & 10)) * 8) + ((x_65 & 5) | (x_62 & 10))), 0); + x_76_phi = x_74; + x_79_phi = 0; + while (true) { + int2 x_90 = int2(0, 0); + int2 x_98 = int2(0, 0); + int x_80 = 0; + int2 x_91_phi = int2(0, 0); + int2 x_99_phi = int2(0, 0); + x_76 = x_76_phi; + const int x_79 = x_79_phi; + if ((x_79 < 100)) { + } else { + break; + } + x_91_phi = x_76; + if ((x_76.x > 0)) { + x_90 = x_76; + x_90.y = (x_76.y - 1); + x_91_phi = x_90; + } + const int2 x_91 = x_91_phi; + x_99_phi = x_91; + if ((x_91.x < 0)) { + x_98 = x_91; + x_98.y = (x_91.y + 1); + x_99_phi = x_98; + } + const int2 x_99 = x_99_phi; + int2 x_77_1 = x_99; + x_77_1.x = (x_99.x + (x_99.y / 2)); + const int2 x_77 = x_77_1; + { + x_80 = (x_79 + 1); + x_76_phi = x_77; + x_79_phi = x_80; + } + } + const int x_104 = x_76.x; + x_110_phi = x_76; + if ((x_104 < 0)) { + x_109 = x_76; + x_109.x = -(x_104); + x_110_phi = x_109; + } + x_112_phi = x_110_phi; + while (true) { + int2 x_113 = int2(0, 0); + const int2 x_112 = x_112_phi; + x_115 = x_112.x; + if ((x_115 > 15)) { + } else { + break; + } + { + x_113 = x_112; + x_113.x = asint((x_115 - asint(16))); + x_112_phi = x_113; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_120 = indexable[x_115]; + x_GLF_color = x_120; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.msl new file mode 100644 index 0000000000..e35ddd7bab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int2 x_76 = 0; + int2 x_109 = 0; + int x_115 = 0; + int2 x_76_phi = 0; + int x_79_phi = 0; + int2 x_110_phi = 0; + int2 x_112_phi = 0; + float4 const x_55 = *(tint_symbol_6); + float2 const x_58 = x_6.resolution; + float2 const x_59 = (float2(x_55.x, x_55.y) / x_58); + int const x_62 = int((x_59.x * 8.0f)); + int const x_65 = int((x_59.y * 8.0f)); + int2 const x_74 = int2(((((x_62 & 5) | (x_65 & 10)) * 8) + ((x_65 & 5) | (x_62 & 10))), 0); + x_76_phi = x_74; + x_79_phi = 0; + while (true) { + int2 x_90 = 0; + int2 x_98 = 0; + int x_80 = 0; + int2 x_91_phi = 0; + int2 x_99_phi = 0; + x_76 = x_76_phi; + int const x_79 = x_79_phi; + if ((x_79 < 100)) { + } else { + break; + } + x_91_phi = x_76; + if ((x_76.x > 0)) { + x_90 = x_76; + x_90.y = (x_76.y - 1); + x_91_phi = x_90; + } + int2 const x_91 = x_91_phi; + x_99_phi = x_91; + if ((x_91.x < 0)) { + x_98 = x_91; + x_98.y = (x_91.y + 1); + x_99_phi = x_98; + } + int2 const x_99 = x_99_phi; + int2 x_77_1 = x_99; + x_77_1.x = (x_99.x + (x_99.y / 2)); + int2 const x_77 = x_77_1; + { + x_80 = (x_79 + 1); + x_76_phi = x_77; + x_79_phi = x_80; + } + } + int const x_104 = x_76.x; + x_110_phi = x_76; + if ((x_104 < 0)) { + x_109 = x_76; + x_109.x = -(x_104); + x_110_phi = x_109; + } + int2 const x_110 = x_110_phi; + x_112_phi = x_110; + while (true) { + int2 x_113 = 0; + int2 const x_112 = x_112_phi; + x_115 = x_112.x; + if ((x_115 > 15)) { + } else { + break; + } + { + x_113 = x_112; + x_113.x = as_type((x_115 - as_type(16))); + x_112_phi = x_113; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_120 = indexable.arr[x_115]; + *(tint_symbol_7) = x_120; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..2951010a61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.spvasm @@ -0,0 +1,292 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 185 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_76 "x_76" + OpName %x_109 "x_109" + OpName %x_115 "x_115" + OpName %x_76_phi "x_76_phi" + OpName %x_79_phi "x_79_phi" + OpName %x_110_phi "x_110_phi" + OpName %x_112_phi "x_112_phi" + OpName %x_90 "x_90" + OpName %x_98 "x_98" + OpName %x_80 "x_80" + OpName %x_91_phi "x_91_phi" + OpName %x_99_phi "x_99_phi" + OpName %x_77_1 "x_77_1" + OpName %x_113 "x_113" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %151 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %153 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %154 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %155 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %157 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %158 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %159 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %160 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %161 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %162 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %164 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %166 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %167 = OpConstantComposite %_arr_v4float_uint_16 %151 %153 %154 %155 %156 %157 %158 %159 %151 %160 %161 %162 %163 %164 %165 %166 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %172 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_76 = OpVariable %_ptr_Function_v2int Function %29 + %x_109 = OpVariable %_ptr_Function_v2int Function %29 + %x_115 = OpVariable %_ptr_Function_int Function %33 + %x_76_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_79_phi = OpVariable %_ptr_Function_int Function %33 + %x_110_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_112_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_90 = OpVariable %_ptr_Function_v2int Function %29 + %x_98 = OpVariable %_ptr_Function_v2int Function %29 + %x_80 = OpVariable %_ptr_Function_int Function %33 + %x_91_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_99_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_77_1 = OpVariable %_ptr_Function_v2int Function %29 + %x_113 = OpVariable %_ptr_Function_v2int Function %29 + %38 = OpLoad %v4float %gl_FragCoord + %41 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %42 = OpLoad %v2float %41 + %43 = OpCompositeExtract %float %38 0 + %44 = OpCompositeExtract %float %38 1 + %45 = OpCompositeConstruct %v2float %43 %44 + %46 = OpFDiv %v2float %45 %42 + %48 = OpCompositeExtract %float %46 0 + %50 = OpFMul %float %48 %float_8 + %47 = OpConvertFToS %int %50 + %52 = OpCompositeExtract %float %46 1 + %53 = OpFMul %float %52 %float_8 + %51 = OpConvertFToS %int %53 + %55 = OpBitwiseAnd %int %47 %int_5 + %57 = OpBitwiseAnd %int %51 %int_10 + %58 = OpBitwiseOr %int %55 %57 + %60 = OpIMul %int %58 %int_8 + %61 = OpBitwiseAnd %int %51 %int_5 + %62 = OpBitwiseAnd %int %47 %int_10 + %63 = OpBitwiseOr %int %61 %62 + %64 = OpIAdd %int %60 %63 + %66 = OpCompositeConstruct %v2int %64 %int_0 + OpStore %x_76_phi %66 + OpStore %x_79_phi %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %76 = OpLoad %v2int %x_76_phi + OpStore %x_76 %76 + %77 = OpLoad %int %x_79_phi + %79 = OpSLessThan %bool %77 %int_100 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %68 + %81 = OpLabel + %84 = OpLoad %v2int %x_76 + OpStore %x_91_phi %84 + %85 = OpAccessChain %_ptr_Function_int %x_76 %uint_0 + %86 = OpLoad %int %85 + %87 = OpSGreaterThan %bool %86 %int_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpLoad %v2int %x_76 + OpStore %x_90 %90 + %92 = OpAccessChain %_ptr_Function_int %x_90 %uint_1 + %93 = OpAccessChain %_ptr_Function_int %x_76 %uint_1 + %94 = OpLoad %int %93 + %96 = OpISub %int %94 %int_1 + OpStore %92 %96 + %97 = OpLoad %v2int %x_90 + OpStore %x_91_phi %97 + OpBranch %88 + %88 = OpLabel + %98 = OpLoad %v2int %x_91_phi + OpStore %x_99_phi %98 + %99 = OpCompositeExtract %int %98 0 + %100 = OpSLessThan %bool %99 %int_0 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %x_98 %98 + %103 = OpAccessChain %_ptr_Function_int %x_98 %uint_1 + %104 = OpCompositeExtract %int %98 1 + %105 = OpIAdd %int %104 %int_1 + OpStore %103 %105 + %106 = OpLoad %v2int %x_98 + OpStore %x_99_phi %106 + OpBranch %101 + %101 = OpLabel + %107 = OpLoad %v2int %x_99_phi + OpStore %x_77_1 %107 + %109 = OpAccessChain %_ptr_Function_int %x_77_1 %uint_0 + %110 = OpCompositeExtract %int %107 0 + %111 = OpCompositeExtract %int %107 1 + %113 = OpSDiv %int %111 %int_2 + %114 = OpIAdd %int %110 %113 + OpStore %109 %114 + %115 = OpLoad %v2int %x_77_1 + OpBranch %69 + %69 = OpLabel + %116 = OpIAdd %int %77 %int_1 + OpStore %x_80 %116 + OpStore %x_76_phi %115 + %117 = OpLoad %int %x_80 + OpStore %x_79_phi %117 + OpBranch %67 + %68 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %x_76 %uint_0 + %119 = OpLoad %int %118 + %120 = OpLoad %v2int %x_76 + OpStore %x_110_phi %120 + %121 = OpSLessThan %bool %119 %int_0 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + %124 = OpLoad %v2int %x_76 + OpStore %x_109 %124 + %125 = OpAccessChain %_ptr_Function_int %x_109 %uint_0 + %126 = OpSNegate %int %119 + OpStore %125 %126 + %127 = OpLoad %v2int %x_109 + OpStore %x_110_phi %127 + OpBranch %122 + %122 = OpLabel + %128 = OpLoad %v2int %x_110_phi + OpStore %x_112_phi %128 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %134 = OpLoad %v2int %x_112_phi + %135 = OpCompositeExtract %int %134 0 + OpStore %x_115 %135 + %136 = OpLoad %int %x_115 + %138 = OpSGreaterThan %bool %136 %int_15 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpBranch %139 + %141 = OpLabel + OpBranch %130 + %139 = OpLabel + OpBranch %131 + %131 = OpLabel + OpStore %x_113 %134 + %142 = OpAccessChain %_ptr_Function_int %x_113 %uint_0 + %144 = OpLoad %int %x_115 + %145 = OpCopyObject %int %int_16 + %147 = OpISub %int %144 %145 + %143 = OpCopyObject %int %147 + OpStore %142 %143 + %148 = OpLoad %v2int %x_113 + OpStore %x_112_phi %148 + OpBranch %129 + %130 = OpLabel + OpStore %indexable %167 + %168 = OpLoad %int %x_115 + %170 = OpAccessChain %_ptr_Function_v4float %indexable %168 + %171 = OpLoad %v4float %170 + OpStore %x_GLF_color %171 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %172 +%tint_symbol_1 = OpFunctionParameter %main_out + %176 = OpLabel + %177 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %177 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %179 = OpLabel + %180 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %180 + %181 = OpFunctionCall %void %main_1 + %183 = OpLoad %v4float %x_GLF_color + %184 = OpCompositeConstruct %main_out %183 + %182 = OpFunctionCall %void %tint_symbol_3 %184 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..8fe4ab42a3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.spvasm.expected.wgsl @@ -0,0 +1,105 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_76 : vec2; + var x_109 : vec2; + var x_115 : i32; + var x_76_phi : vec2; + var x_79_phi : i32; + var x_110_phi : vec2; + var x_112_phi : vec2; + let x_55 : vec4 = gl_FragCoord; + let x_58 : vec2 = x_6.resolution; + let x_59 : vec2 = (vec2(x_55.x, x_55.y) / x_58); + let x_62 : i32 = i32((x_59.x * 8.0)); + let x_65 : i32 = i32((x_59.y * 8.0)); + let x_74 : vec2 = vec2(((((x_62 & 5) | (x_65 & 10)) * 8) + ((x_65 & 5) | (x_62 & 10))), 0); + x_76_phi = x_74; + x_79_phi = 0; + loop { + var x_90 : vec2; + var x_98 : vec2; + var x_80 : i32; + var x_91_phi : vec2; + var x_99_phi : vec2; + x_76 = x_76_phi; + let x_79 : i32 = x_79_phi; + if ((x_79 < 100)) { + } else { + break; + } + x_91_phi = x_76; + if ((x_76.x > 0)) { + x_90 = x_76; + x_90.y = (x_76.y - 1); + x_91_phi = x_90; + } + let x_91 : vec2 = x_91_phi; + x_99_phi = x_91; + if ((x_91.x < 0)) { + x_98 = x_91; + x_98.y = (x_91.y + 1); + x_99_phi = x_98; + } + let x_99 : vec2 = x_99_phi; + var x_77_1 : vec2 = x_99; + x_77_1.x = (x_99.x + (x_99.y / 2)); + let x_77 : vec2 = x_77_1; + + continuing { + x_80 = (x_79 + 1); + x_76_phi = x_77; + x_79_phi = x_80; + } + } + let x_104 : i32 = x_76.x; + x_110_phi = x_76; + if ((x_104 < 0)) { + x_109 = x_76; + x_109.x = -(x_104); + x_110_phi = x_109; + } + let x_110 : vec2 = x_110_phi; + x_112_phi = x_110; + loop { + var x_113 : vec2; + let x_112 : vec2 = x_112_phi; + x_115 = x_112.x; + if ((x_115 > 15)) { + } else { + break; + } + + continuing { + x_113 = x_112; + x_113.x = bitcast((x_115 - bitcast(16))); + x_112_phi = x_113; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_120 : vec4 = indexable[x_115]; + x_GLF_color = x_120; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl new file mode 100644 index 0000000000..8fe4ab42a3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl @@ -0,0 +1,105 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_76 : vec2; + var x_109 : vec2; + var x_115 : i32; + var x_76_phi : vec2; + var x_79_phi : i32; + var x_110_phi : vec2; + var x_112_phi : vec2; + let x_55 : vec4 = gl_FragCoord; + let x_58 : vec2 = x_6.resolution; + let x_59 : vec2 = (vec2(x_55.x, x_55.y) / x_58); + let x_62 : i32 = i32((x_59.x * 8.0)); + let x_65 : i32 = i32((x_59.y * 8.0)); + let x_74 : vec2 = vec2(((((x_62 & 5) | (x_65 & 10)) * 8) + ((x_65 & 5) | (x_62 & 10))), 0); + x_76_phi = x_74; + x_79_phi = 0; + loop { + var x_90 : vec2; + var x_98 : vec2; + var x_80 : i32; + var x_91_phi : vec2; + var x_99_phi : vec2; + x_76 = x_76_phi; + let x_79 : i32 = x_79_phi; + if ((x_79 < 100)) { + } else { + break; + } + x_91_phi = x_76; + if ((x_76.x > 0)) { + x_90 = x_76; + x_90.y = (x_76.y - 1); + x_91_phi = x_90; + } + let x_91 : vec2 = x_91_phi; + x_99_phi = x_91; + if ((x_91.x < 0)) { + x_98 = x_91; + x_98.y = (x_91.y + 1); + x_99_phi = x_98; + } + let x_99 : vec2 = x_99_phi; + var x_77_1 : vec2 = x_99; + x_77_1.x = (x_99.x + (x_99.y / 2)); + let x_77 : vec2 = x_77_1; + + continuing { + x_80 = (x_79 + 1); + x_76_phi = x_77; + x_79_phi = x_80; + } + } + let x_104 : i32 = x_76.x; + x_110_phi = x_76; + if ((x_104 < 0)) { + x_109 = x_76; + x_109.x = -(x_104); + x_110_phi = x_109; + } + let x_110 : vec2 = x_110_phi; + x_112_phi = x_110; + loop { + var x_113 : vec2; + let x_112 : vec2 = x_112_phi; + x_115 = x_112.x; + if ((x_115 > 15)) { + } else { + break; + } + + continuing { + x_113 = x_112; + x_113.x = bitcast((x_115 - bitcast(16))); + x_112_phi = x_113; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_120 : vec4 = indexable[x_115]; + x_GLF_color = x_120; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..d58e8dc1c3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.hlsl @@ -0,0 +1,105 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int2 x_76 = int2(0, 0); + int2 x_109 = int2(0, 0); + int x_115 = 0; + int2 x_76_phi = int2(0, 0); + int x_79_phi = 0; + int2 x_110_phi = int2(0, 0); + int2 x_112_phi = int2(0, 0); + const float4 x_55 = gl_FragCoord; + const float2 x_58 = asfloat(x_6[0].xy); + const float2 x_59 = (float2(x_55.x, x_55.y) / x_58); + const int x_62 = int((x_59.x * 8.0f)); + const int x_65 = int((x_59.y * 8.0f)); + const int2 x_74 = int2(((((x_62 & 5) | (x_65 & 10)) * 8) + ((x_65 & 5) | (x_62 & 10))), 0); + x_76_phi = x_74; + x_79_phi = 0; + while (true) { + int2 x_90 = int2(0, 0); + int2 x_98 = int2(0, 0); + int x_80 = 0; + int2 x_91_phi = int2(0, 0); + int2 x_99_phi = int2(0, 0); + x_76 = x_76_phi; + const int x_79 = x_79_phi; + if ((x_79 < 100)) { + } else { + break; + } + x_91_phi = x_76; + if ((x_76.x > 0)) { + x_90 = x_76; + x_90.y = (x_76.y - 1); + x_91_phi = x_90; + } + const int2 x_91 = x_91_phi; + x_99_phi = x_91; + if ((x_91.x < 0)) { + x_98 = x_91; + x_98.y = (x_91.y + 1); + x_99_phi = x_98; + } + const int2 x_99 = x_99_phi; + int2 x_77_1 = x_99; + x_77_1.x = (x_99.x + (x_99.y / 2)); + const int2 x_77 = x_77_1; + { + x_80 = (x_79 + 1); + x_76_phi = x_77; + x_79_phi = x_80; + } + } + const int x_104 = x_76.x; + x_110_phi = x_76; + if ((x_104 < 0)) { + x_109 = x_76; + x_109.x = -(x_104); + x_110_phi = x_109; + } + x_112_phi = x_110_phi; + while (true) { + int2 x_113 = int2(0, 0); + const int2 x_112 = x_112_phi; + x_115 = x_112.x; + if ((x_115 > 15)) { + } else { + break; + } + { + x_113 = x_112; + x_113.x = asint((x_115 - asint(16))); + x_112_phi = x_113; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_120 = indexable[x_115]; + x_GLF_color = x_120; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.msl new file mode 100644 index 0000000000..e35ddd7bab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int2 x_76 = 0; + int2 x_109 = 0; + int x_115 = 0; + int2 x_76_phi = 0; + int x_79_phi = 0; + int2 x_110_phi = 0; + int2 x_112_phi = 0; + float4 const x_55 = *(tint_symbol_6); + float2 const x_58 = x_6.resolution; + float2 const x_59 = (float2(x_55.x, x_55.y) / x_58); + int const x_62 = int((x_59.x * 8.0f)); + int const x_65 = int((x_59.y * 8.0f)); + int2 const x_74 = int2(((((x_62 & 5) | (x_65 & 10)) * 8) + ((x_65 & 5) | (x_62 & 10))), 0); + x_76_phi = x_74; + x_79_phi = 0; + while (true) { + int2 x_90 = 0; + int2 x_98 = 0; + int x_80 = 0; + int2 x_91_phi = 0; + int2 x_99_phi = 0; + x_76 = x_76_phi; + int const x_79 = x_79_phi; + if ((x_79 < 100)) { + } else { + break; + } + x_91_phi = x_76; + if ((x_76.x > 0)) { + x_90 = x_76; + x_90.y = (x_76.y - 1); + x_91_phi = x_90; + } + int2 const x_91 = x_91_phi; + x_99_phi = x_91; + if ((x_91.x < 0)) { + x_98 = x_91; + x_98.y = (x_91.y + 1); + x_99_phi = x_98; + } + int2 const x_99 = x_99_phi; + int2 x_77_1 = x_99; + x_77_1.x = (x_99.x + (x_99.y / 2)); + int2 const x_77 = x_77_1; + { + x_80 = (x_79 + 1); + x_76_phi = x_77; + x_79_phi = x_80; + } + } + int const x_104 = x_76.x; + x_110_phi = x_76; + if ((x_104 < 0)) { + x_109 = x_76; + x_109.x = -(x_104); + x_110_phi = x_109; + } + int2 const x_110 = x_110_phi; + x_112_phi = x_110; + while (true) { + int2 x_113 = 0; + int2 const x_112 = x_112_phi; + x_115 = x_112.x; + if ((x_115 > 15)) { + } else { + break; + } + { + x_113 = x_112; + x_113.x = as_type((x_115 - as_type(16))); + x_112_phi = x_113; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_120 = indexable.arr[x_115]; + *(tint_symbol_7) = x_120; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..2951010a61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.spvasm @@ -0,0 +1,292 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 185 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_76 "x_76" + OpName %x_109 "x_109" + OpName %x_115 "x_115" + OpName %x_76_phi "x_76_phi" + OpName %x_79_phi "x_79_phi" + OpName %x_110_phi "x_110_phi" + OpName %x_112_phi "x_112_phi" + OpName %x_90 "x_90" + OpName %x_98 "x_98" + OpName %x_80 "x_80" + OpName %x_91_phi "x_91_phi" + OpName %x_99_phi "x_99_phi" + OpName %x_77_1 "x_77_1" + OpName %x_113 "x_113" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %151 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %153 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %154 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %155 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %157 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %158 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %159 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %160 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %161 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %162 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %164 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %166 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %167 = OpConstantComposite %_arr_v4float_uint_16 %151 %153 %154 %155 %156 %157 %158 %159 %151 %160 %161 %162 %163 %164 %165 %166 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %172 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_76 = OpVariable %_ptr_Function_v2int Function %29 + %x_109 = OpVariable %_ptr_Function_v2int Function %29 + %x_115 = OpVariable %_ptr_Function_int Function %33 + %x_76_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_79_phi = OpVariable %_ptr_Function_int Function %33 + %x_110_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_112_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_90 = OpVariable %_ptr_Function_v2int Function %29 + %x_98 = OpVariable %_ptr_Function_v2int Function %29 + %x_80 = OpVariable %_ptr_Function_int Function %33 + %x_91_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_99_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_77_1 = OpVariable %_ptr_Function_v2int Function %29 + %x_113 = OpVariable %_ptr_Function_v2int Function %29 + %38 = OpLoad %v4float %gl_FragCoord + %41 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %42 = OpLoad %v2float %41 + %43 = OpCompositeExtract %float %38 0 + %44 = OpCompositeExtract %float %38 1 + %45 = OpCompositeConstruct %v2float %43 %44 + %46 = OpFDiv %v2float %45 %42 + %48 = OpCompositeExtract %float %46 0 + %50 = OpFMul %float %48 %float_8 + %47 = OpConvertFToS %int %50 + %52 = OpCompositeExtract %float %46 1 + %53 = OpFMul %float %52 %float_8 + %51 = OpConvertFToS %int %53 + %55 = OpBitwiseAnd %int %47 %int_5 + %57 = OpBitwiseAnd %int %51 %int_10 + %58 = OpBitwiseOr %int %55 %57 + %60 = OpIMul %int %58 %int_8 + %61 = OpBitwiseAnd %int %51 %int_5 + %62 = OpBitwiseAnd %int %47 %int_10 + %63 = OpBitwiseOr %int %61 %62 + %64 = OpIAdd %int %60 %63 + %66 = OpCompositeConstruct %v2int %64 %int_0 + OpStore %x_76_phi %66 + OpStore %x_79_phi %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %76 = OpLoad %v2int %x_76_phi + OpStore %x_76 %76 + %77 = OpLoad %int %x_79_phi + %79 = OpSLessThan %bool %77 %int_100 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %68 + %81 = OpLabel + %84 = OpLoad %v2int %x_76 + OpStore %x_91_phi %84 + %85 = OpAccessChain %_ptr_Function_int %x_76 %uint_0 + %86 = OpLoad %int %85 + %87 = OpSGreaterThan %bool %86 %int_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpLoad %v2int %x_76 + OpStore %x_90 %90 + %92 = OpAccessChain %_ptr_Function_int %x_90 %uint_1 + %93 = OpAccessChain %_ptr_Function_int %x_76 %uint_1 + %94 = OpLoad %int %93 + %96 = OpISub %int %94 %int_1 + OpStore %92 %96 + %97 = OpLoad %v2int %x_90 + OpStore %x_91_phi %97 + OpBranch %88 + %88 = OpLabel + %98 = OpLoad %v2int %x_91_phi + OpStore %x_99_phi %98 + %99 = OpCompositeExtract %int %98 0 + %100 = OpSLessThan %bool %99 %int_0 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %x_98 %98 + %103 = OpAccessChain %_ptr_Function_int %x_98 %uint_1 + %104 = OpCompositeExtract %int %98 1 + %105 = OpIAdd %int %104 %int_1 + OpStore %103 %105 + %106 = OpLoad %v2int %x_98 + OpStore %x_99_phi %106 + OpBranch %101 + %101 = OpLabel + %107 = OpLoad %v2int %x_99_phi + OpStore %x_77_1 %107 + %109 = OpAccessChain %_ptr_Function_int %x_77_1 %uint_0 + %110 = OpCompositeExtract %int %107 0 + %111 = OpCompositeExtract %int %107 1 + %113 = OpSDiv %int %111 %int_2 + %114 = OpIAdd %int %110 %113 + OpStore %109 %114 + %115 = OpLoad %v2int %x_77_1 + OpBranch %69 + %69 = OpLabel + %116 = OpIAdd %int %77 %int_1 + OpStore %x_80 %116 + OpStore %x_76_phi %115 + %117 = OpLoad %int %x_80 + OpStore %x_79_phi %117 + OpBranch %67 + %68 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %x_76 %uint_0 + %119 = OpLoad %int %118 + %120 = OpLoad %v2int %x_76 + OpStore %x_110_phi %120 + %121 = OpSLessThan %bool %119 %int_0 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + %124 = OpLoad %v2int %x_76 + OpStore %x_109 %124 + %125 = OpAccessChain %_ptr_Function_int %x_109 %uint_0 + %126 = OpSNegate %int %119 + OpStore %125 %126 + %127 = OpLoad %v2int %x_109 + OpStore %x_110_phi %127 + OpBranch %122 + %122 = OpLabel + %128 = OpLoad %v2int %x_110_phi + OpStore %x_112_phi %128 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %134 = OpLoad %v2int %x_112_phi + %135 = OpCompositeExtract %int %134 0 + OpStore %x_115 %135 + %136 = OpLoad %int %x_115 + %138 = OpSGreaterThan %bool %136 %int_15 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpBranch %139 + %141 = OpLabel + OpBranch %130 + %139 = OpLabel + OpBranch %131 + %131 = OpLabel + OpStore %x_113 %134 + %142 = OpAccessChain %_ptr_Function_int %x_113 %uint_0 + %144 = OpLoad %int %x_115 + %145 = OpCopyObject %int %int_16 + %147 = OpISub %int %144 %145 + %143 = OpCopyObject %int %147 + OpStore %142 %143 + %148 = OpLoad %v2int %x_113 + OpStore %x_112_phi %148 + OpBranch %129 + %130 = OpLabel + OpStore %indexable %167 + %168 = OpLoad %int %x_115 + %170 = OpAccessChain %_ptr_Function_v4float %indexable %168 + %171 = OpLoad %v4float %170 + OpStore %x_GLF_color %171 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %172 +%tint_symbol_1 = OpFunctionParameter %main_out + %176 = OpLabel + %177 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %177 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %179 = OpLabel + %180 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %180 + %181 = OpFunctionCall %void %main_1 + %183 = OpLoad %v4float %x_GLF_color + %184 = OpCompositeConstruct %main_out %183 + %182 = OpFunctionCall %void %tint_symbol_3 %184 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..8fe4ab42a3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/0.wgsl.expected.wgsl @@ -0,0 +1,105 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_76 : vec2; + var x_109 : vec2; + var x_115 : i32; + var x_76_phi : vec2; + var x_79_phi : i32; + var x_110_phi : vec2; + var x_112_phi : vec2; + let x_55 : vec4 = gl_FragCoord; + let x_58 : vec2 = x_6.resolution; + let x_59 : vec2 = (vec2(x_55.x, x_55.y) / x_58); + let x_62 : i32 = i32((x_59.x * 8.0)); + let x_65 : i32 = i32((x_59.y * 8.0)); + let x_74 : vec2 = vec2(((((x_62 & 5) | (x_65 & 10)) * 8) + ((x_65 & 5) | (x_62 & 10))), 0); + x_76_phi = x_74; + x_79_phi = 0; + loop { + var x_90 : vec2; + var x_98 : vec2; + var x_80 : i32; + var x_91_phi : vec2; + var x_99_phi : vec2; + x_76 = x_76_phi; + let x_79 : i32 = x_79_phi; + if ((x_79 < 100)) { + } else { + break; + } + x_91_phi = x_76; + if ((x_76.x > 0)) { + x_90 = x_76; + x_90.y = (x_76.y - 1); + x_91_phi = x_90; + } + let x_91 : vec2 = x_91_phi; + x_99_phi = x_91; + if ((x_91.x < 0)) { + x_98 = x_91; + x_98.y = (x_91.y + 1); + x_99_phi = x_98; + } + let x_99 : vec2 = x_99_phi; + var x_77_1 : vec2 = x_99; + x_77_1.x = (x_99.x + (x_99.y / 2)); + let x_77 : vec2 = x_77_1; + + continuing { + x_80 = (x_79 + 1); + x_76_phi = x_77; + x_79_phi = x_80; + } + } + let x_104 : i32 = x_76.x; + x_110_phi = x_76; + if ((x_104 < 0)) { + x_109 = x_76; + x_109.x = -(x_104); + x_110_phi = x_109; + } + let x_110 : vec2 = x_110_phi; + x_112_phi = x_110; + loop { + var x_113 : vec2; + let x_112 : vec2 = x_112_phi; + x_115 = x_112.x; + if ((x_115 > 15)) { + } else { + break; + } + + continuing { + x_113 = x_112; + x_113.x = bitcast((x_115 - bitcast(16))); + x_112_phi = x_113; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_120 : vec4 = indexable[x_115]; + x_GLF_color = x_120; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm new file mode 100644 index 0000000000..bccf1c664f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm @@ -0,0 +1,167 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %indexable "indexable" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_100 = OpConstant %int 100 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %37 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %38 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %40 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %41 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %42 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %43 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %46 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %49 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %50 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %51 = OpConstantComposite %_arr_v4float_uint_16 %35 %37 %38 %39 %40 %41 %42 %43 %35 %44 %45 %46 %47 %48 %49 %50 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0_0 = OpConstant %float 0 + %55 = OpConstantComposite %v4float %float_0_0 %float_0_0 %float_0_0 %float_0_0 + %56 = OpConstantComposite %_arr_v4float_uint_16 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 + %main = OpFunction %void None %9 + %57 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %58 = OpLoad %v4float %gl_FragCoord + %59 = OpVectorShuffle %v2float %58 %58 0 1 + %60 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %61 = OpLoad %v2float %60 + %62 = OpFDiv %v2float %59 %61 + %63 = OpCompositeExtract %float %62 0 + %64 = OpFMul %float %63 %float_8 + %65 = OpConvertFToS %int %64 + %66 = OpAccessChain %_ptr_Function__arr_v4float_uint_16 %indexable + %67 = OpCompositeExtract %float %62 1 + %68 = OpFMul %float %67 %float_8 + %69 = OpConvertFToS %int %68 + %70 = OpBitwiseAnd %int %65 %int_5 + %71 = OpBitwiseAnd %int %69 %int_10 + %72 = OpBitwiseOr %int %70 %71 + %73 = OpBitwiseAnd %int %69 %int_5 + %74 = OpBitwiseAnd %int %65 %int_10 + %75 = OpBitwiseOr %int %73 %74 + %76 = OpIMul %int %72 %int_8 + %77 = OpIAdd %int %76 %75 + %78 = OpCompositeConstruct %v2int %77 %int_0 + OpBranch %79 + %79 = OpLabel + %80 = OpPhi %v2int %78 %57 %81 %82 + %83 = OpPhi %int %int_0 %57 %84 %82 + %85 = OpSLessThan %bool %83 %int_100 + OpLoopMerge %86 %82 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpCompositeExtract %int %80 0 + %89 = OpSGreaterThan %bool %88 %int_0 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + %92 = OpCompositeExtract %int %80 1 + %93 = OpISub %int %92 %int_1 + %94 = OpCompositeInsert %v2int %93 %80 1 + OpBranch %90 + %90 = OpLabel + %95 = OpPhi %v2int %80 %87 %94 %91 + %96 = OpCompositeExtract %int %95 0 + %97 = OpSLessThan %bool %96 %int_0 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpCompositeExtract %int %95 1 + %101 = OpIAdd %int %100 %int_1 + %102 = OpCompositeInsert %v2int %101 %95 1 + OpBranch %98 + %98 = OpLabel + %103 = OpPhi %v2int %95 %90 %102 %99 + %104 = OpCompositeExtract %int %103 1 + %105 = OpSDiv %int %104 %int_2 + %106 = OpCompositeExtract %int %103 0 + %107 = OpIAdd %int %106 %105 + %81 = OpCompositeInsert %v2int %107 %103 0 + OpBranch %82 + %82 = OpLabel + %84 = OpIAdd %int %83 %int_1 + OpBranch %79 + %86 = OpLabel + %108 = OpCompositeExtract %int %80 0 + %109 = OpSLessThan %bool %108 %int_0 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpSNegate %int %108 + %113 = OpCompositeInsert %v2int %112 %80 0 + OpBranch %110 + %110 = OpLabel + %114 = OpPhi %v2int %80 %86 %113 %111 + OpBranch %115 + %115 = OpLabel + %116 = OpPhi %v2int %114 %110 %117 %118 + %119 = OpCompositeExtract %int %116 0 + %120 = OpSGreaterThan %bool %119 %int_15 + OpLoopMerge %121 %118 None + OpBranchConditional %120 %118 %121 + %118 = OpLabel + %122 = OpISub %int %119 %int_16 + %117 = OpCompositeInsert %v2int %122 %116 0 + OpBranch %115 + %121 = OpLabel + OpStore %indexable %51 + %123 = OpAccessChain %_ptr_Function_v4float %indexable %119 + %124 = OpLoad %_arr_v4float_uint_16 %66 + OpStore %66 %56 + OpStore %66 %124 + %125 = OpLoad %v4float %123 + OpStore %_GLF_color %125 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..64c4e8415e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.hlsl @@ -0,0 +1,109 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int2 x_80 = int2(0, 0); + int2 x_113 = int2(0, 0); + int x_119 = 0; + int2 x_80_phi = int2(0, 0); + int x_83_phi = 0; + int2 x_114_phi = int2(0, 0); + int2 x_116_phi = int2(0, 0); + const float4 x_58 = gl_FragCoord; + const float2 x_61 = asfloat(x_6[0].xy); + const float2 x_62 = (float2(x_58.x, x_58.y) / x_61); + const int x_65 = int((x_62.x * 8.0f)); + const int x_69 = int((x_62.y * 8.0f)); + const int2 x_78 = int2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + while (true) { + int2 x_94 = int2(0, 0); + int2 x_102 = int2(0, 0); + int x_84 = 0; + int2 x_95_phi = int2(0, 0); + int2 x_103_phi = int2(0, 0); + x_80 = x_80_phi; + const int x_83 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + const int2 x_95 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + const int2 x_103 = x_103_phi; + int2 x_81_1 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + const int2 x_81 = x_81_1; + { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + const int x_108 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + x_116_phi = x_114_phi; + while (true) { + int2 x_117 = int2(0, 0); + const int2 x_116 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + { + x_117 = x_116; + x_117.x = asint((x_119 - asint(16))); + x_116_phi = x_117; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_124[16] = indexable; + const float4 tint_symbol_6[16] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + indexable = tint_symbol_6; + indexable = x_124; + const float4 x_125 = indexable[x_119]; + x_GLF_color = x_125; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.msl new file mode 100644 index 0000000000..6b28e63809 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + tint_array_wrapper indexable = {}; + int2 x_80 = 0; + int2 x_113 = 0; + int x_119 = 0; + int2 x_80_phi = 0; + int x_83_phi = 0; + int2 x_114_phi = 0; + int2 x_116_phi = 0; + float4 const x_58 = *(tint_symbol_7); + float2 const x_61 = x_6.resolution; + float2 const x_62 = (float2(x_58.x, x_58.y) / x_61); + int const x_65 = int((x_62.x * 8.0f)); + int const x_69 = int((x_62.y * 8.0f)); + int2 const x_78 = int2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + while (true) { + int2 x_94 = 0; + int2 x_102 = 0; + int x_84 = 0; + int2 x_95_phi = 0; + int2 x_103_phi = 0; + x_80 = x_80_phi; + int const x_83 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + int2 const x_95 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + int2 const x_103 = x_103_phi; + int2 x_81_1 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + int2 const x_81 = x_81_1; + { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + int const x_108 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + int2 const x_114 = x_114_phi; + x_116_phi = x_114; + while (true) { + int2 x_117 = 0; + int2 const x_116 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + { + x_117 = x_116; + x_117.x = as_type((x_119 - as_type(16))); + x_116_phi = x_117; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + tint_array_wrapper const x_124 = indexable; + tint_array_wrapper const tint_symbol_5 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + indexable = tint_symbol_5; + indexable = x_124; + float4 const x_125 = indexable.arr[x_119]; + *(tint_symbol_8) = x_125; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_6 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..af0b70ab91 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.spvasm @@ -0,0 +1,297 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 188 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_80 "x_80" + OpName %x_113 "x_113" + OpName %x_119 "x_119" + OpName %x_80_phi "x_80_phi" + OpName %x_83_phi "x_83_phi" + OpName %x_114_phi "x_114_phi" + OpName %x_116_phi "x_116_phi" + OpName %x_94 "x_94" + OpName %x_102 "x_102" + OpName %x_84 "x_84" + OpName %x_95_phi "x_95_phi" + OpName %x_103_phi "x_103_phi" + OpName %x_81_1 "x_81_1" + OpName %x_117 "x_117" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %151 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %153 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %154 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %155 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %157 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %158 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %159 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %160 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %161 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %162 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %164 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %166 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %167 = OpConstantComposite %_arr_v4float_uint_16 %151 %153 %154 %155 %156 %157 %158 %159 %151 %160 %161 %162 %163 %164 %165 %166 + %169 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %170 = OpConstantComposite %_arr_v4float_uint_16 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %175 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_80 = OpVariable %_ptr_Function_v2int Function %29 + %x_113 = OpVariable %_ptr_Function_v2int Function %29 + %x_119 = OpVariable %_ptr_Function_int Function %33 + %x_80_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_83_phi = OpVariable %_ptr_Function_int Function %33 + %x_114_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_116_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_94 = OpVariable %_ptr_Function_v2int Function %29 + %x_102 = OpVariable %_ptr_Function_v2int Function %29 + %x_84 = OpVariable %_ptr_Function_int Function %33 + %x_95_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_103_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_81_1 = OpVariable %_ptr_Function_v2int Function %29 + %x_117 = OpVariable %_ptr_Function_v2int Function %29 + %38 = OpLoad %v4float %gl_FragCoord + %41 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %42 = OpLoad %v2float %41 + %43 = OpCompositeExtract %float %38 0 + %44 = OpCompositeExtract %float %38 1 + %45 = OpCompositeConstruct %v2float %43 %44 + %46 = OpFDiv %v2float %45 %42 + %48 = OpCompositeExtract %float %46 0 + %50 = OpFMul %float %48 %float_8 + %47 = OpConvertFToS %int %50 + %52 = OpCompositeExtract %float %46 1 + %53 = OpFMul %float %52 %float_8 + %51 = OpConvertFToS %int %53 + %55 = OpBitwiseAnd %int %47 %int_5 + %57 = OpBitwiseAnd %int %51 %int_10 + %58 = OpBitwiseOr %int %55 %57 + %60 = OpIMul %int %58 %int_8 + %61 = OpBitwiseAnd %int %51 %int_5 + %62 = OpBitwiseAnd %int %47 %int_10 + %63 = OpBitwiseOr %int %61 %62 + %64 = OpIAdd %int %60 %63 + %66 = OpCompositeConstruct %v2int %64 %int_0 + OpStore %x_80_phi %66 + OpStore %x_83_phi %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %76 = OpLoad %v2int %x_80_phi + OpStore %x_80 %76 + %77 = OpLoad %int %x_83_phi + %79 = OpSLessThan %bool %77 %int_100 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %68 + %81 = OpLabel + %84 = OpLoad %v2int %x_80 + OpStore %x_95_phi %84 + %85 = OpAccessChain %_ptr_Function_int %x_80 %uint_0 + %86 = OpLoad %int %85 + %87 = OpSGreaterThan %bool %86 %int_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpLoad %v2int %x_80 + OpStore %x_94 %90 + %92 = OpAccessChain %_ptr_Function_int %x_94 %uint_1 + %93 = OpAccessChain %_ptr_Function_int %x_80 %uint_1 + %94 = OpLoad %int %93 + %96 = OpISub %int %94 %int_1 + OpStore %92 %96 + %97 = OpLoad %v2int %x_94 + OpStore %x_95_phi %97 + OpBranch %88 + %88 = OpLabel + %98 = OpLoad %v2int %x_95_phi + OpStore %x_103_phi %98 + %99 = OpCompositeExtract %int %98 0 + %100 = OpSLessThan %bool %99 %int_0 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %x_102 %98 + %103 = OpAccessChain %_ptr_Function_int %x_102 %uint_1 + %104 = OpCompositeExtract %int %98 1 + %105 = OpIAdd %int %104 %int_1 + OpStore %103 %105 + %106 = OpLoad %v2int %x_102 + OpStore %x_103_phi %106 + OpBranch %101 + %101 = OpLabel + %107 = OpLoad %v2int %x_103_phi + OpStore %x_81_1 %107 + %109 = OpAccessChain %_ptr_Function_int %x_81_1 %uint_0 + %110 = OpCompositeExtract %int %107 0 + %111 = OpCompositeExtract %int %107 1 + %113 = OpSDiv %int %111 %int_2 + %114 = OpIAdd %int %110 %113 + OpStore %109 %114 + %115 = OpLoad %v2int %x_81_1 + OpBranch %69 + %69 = OpLabel + %116 = OpIAdd %int %77 %int_1 + OpStore %x_84 %116 + OpStore %x_80_phi %115 + %117 = OpLoad %int %x_84 + OpStore %x_83_phi %117 + OpBranch %67 + %68 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %x_80 %uint_0 + %119 = OpLoad %int %118 + %120 = OpLoad %v2int %x_80 + OpStore %x_114_phi %120 + %121 = OpSLessThan %bool %119 %int_0 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + %124 = OpLoad %v2int %x_80 + OpStore %x_113 %124 + %125 = OpAccessChain %_ptr_Function_int %x_113 %uint_0 + %126 = OpSNegate %int %119 + OpStore %125 %126 + %127 = OpLoad %v2int %x_113 + OpStore %x_114_phi %127 + OpBranch %122 + %122 = OpLabel + %128 = OpLoad %v2int %x_114_phi + OpStore %x_116_phi %128 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %134 = OpLoad %v2int %x_116_phi + %135 = OpCompositeExtract %int %134 0 + OpStore %x_119 %135 + %136 = OpLoad %int %x_119 + %138 = OpSGreaterThan %bool %136 %int_15 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpBranch %139 + %141 = OpLabel + OpBranch %130 + %139 = OpLabel + OpBranch %131 + %131 = OpLabel + OpStore %x_117 %134 + %142 = OpAccessChain %_ptr_Function_int %x_117 %uint_0 + %144 = OpLoad %int %x_119 + %145 = OpCopyObject %int %int_16 + %147 = OpISub %int %144 %145 + %143 = OpCopyObject %int %147 + OpStore %142 %143 + %148 = OpLoad %v2int %x_117 + OpStore %x_116_phi %148 + OpBranch %129 + %130 = OpLabel + OpStore %indexable %167 + %168 = OpLoad %_arr_v4float_uint_16 %indexable + OpStore %indexable %170 + OpStore %indexable %168 + %171 = OpLoad %int %x_119 + %173 = OpAccessChain %_ptr_Function_v4float %indexable %171 + %174 = OpLoad %v4float %173 + OpStore %x_GLF_color %174 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %175 +%tint_symbol_1 = OpFunctionParameter %main_out + %179 = OpLabel + %180 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %180 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %182 = OpLabel + %183 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %183 + %184 = OpFunctionCall %void %main_1 + %186 = OpLoad %v4float %x_GLF_color + %187 = OpCompositeConstruct %main_out %186 + %185 = OpFunctionCall %void %tint_symbol_3 %187 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..f0b6447e64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.spvasm.expected.wgsl @@ -0,0 +1,109 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_80 : vec2; + var x_113 : vec2; + var x_119 : i32; + var x_80_phi : vec2; + var x_83_phi : i32; + var x_114_phi : vec2; + var x_116_phi : vec2; + let x_58 : vec4 = gl_FragCoord; + let x_61 : vec2 = x_6.resolution; + let x_62 : vec2 = (vec2(x_58.x, x_58.y) / x_61); + let x_65 : i32 = i32((x_62.x * 8.0)); + let x_66 : ptr, 16>> = &(indexable); + let x_69 : i32 = i32((x_62.y * 8.0)); + let x_78 : vec2 = vec2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + loop { + var x_94 : vec2; + var x_102 : vec2; + var x_84 : i32; + var x_95_phi : vec2; + var x_103_phi : vec2; + x_80 = x_80_phi; + let x_83 : i32 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + let x_95 : vec2 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + let x_103 : vec2 = x_103_phi; + var x_81_1 : vec2 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + let x_81 : vec2 = x_81_1; + + continuing { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + let x_108 : i32 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + let x_114 : vec2 = x_114_phi; + x_116_phi = x_114; + loop { + var x_117 : vec2; + let x_116 : vec2 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + + continuing { + x_117 = x_116; + x_117.x = bitcast((x_119 - bitcast(16))); + x_116_phi = x_117; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_124 : array, 16> = *(x_66); + *(x_66) = array, 16>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + *(x_66) = x_124; + let x_125 : vec4 = indexable[x_119]; + x_GLF_color = x_125; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl new file mode 100644 index 0000000000..f0b6447e64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl @@ -0,0 +1,109 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_80 : vec2; + var x_113 : vec2; + var x_119 : i32; + var x_80_phi : vec2; + var x_83_phi : i32; + var x_114_phi : vec2; + var x_116_phi : vec2; + let x_58 : vec4 = gl_FragCoord; + let x_61 : vec2 = x_6.resolution; + let x_62 : vec2 = (vec2(x_58.x, x_58.y) / x_61); + let x_65 : i32 = i32((x_62.x * 8.0)); + let x_66 : ptr, 16>> = &(indexable); + let x_69 : i32 = i32((x_62.y * 8.0)); + let x_78 : vec2 = vec2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + loop { + var x_94 : vec2; + var x_102 : vec2; + var x_84 : i32; + var x_95_phi : vec2; + var x_103_phi : vec2; + x_80 = x_80_phi; + let x_83 : i32 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + let x_95 : vec2 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + let x_103 : vec2 = x_103_phi; + var x_81_1 : vec2 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + let x_81 : vec2 = x_81_1; + + continuing { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + let x_108 : i32 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + let x_114 : vec2 = x_114_phi; + x_116_phi = x_114; + loop { + var x_117 : vec2; + let x_116 : vec2 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + + continuing { + x_117 = x_116; + x_117.x = bitcast((x_119 - bitcast(16))); + x_116_phi = x_117; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_124 : array, 16> = *(x_66); + *(x_66) = array, 16>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + *(x_66) = x_124; + let x_125 : vec4 = indexable[x_119]; + x_GLF_color = x_125; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..64c4e8415e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.hlsl @@ -0,0 +1,109 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int2 x_80 = int2(0, 0); + int2 x_113 = int2(0, 0); + int x_119 = 0; + int2 x_80_phi = int2(0, 0); + int x_83_phi = 0; + int2 x_114_phi = int2(0, 0); + int2 x_116_phi = int2(0, 0); + const float4 x_58 = gl_FragCoord; + const float2 x_61 = asfloat(x_6[0].xy); + const float2 x_62 = (float2(x_58.x, x_58.y) / x_61); + const int x_65 = int((x_62.x * 8.0f)); + const int x_69 = int((x_62.y * 8.0f)); + const int2 x_78 = int2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + while (true) { + int2 x_94 = int2(0, 0); + int2 x_102 = int2(0, 0); + int x_84 = 0; + int2 x_95_phi = int2(0, 0); + int2 x_103_phi = int2(0, 0); + x_80 = x_80_phi; + const int x_83 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + const int2 x_95 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + const int2 x_103 = x_103_phi; + int2 x_81_1 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + const int2 x_81 = x_81_1; + { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + const int x_108 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + x_116_phi = x_114_phi; + while (true) { + int2 x_117 = int2(0, 0); + const int2 x_116 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + { + x_117 = x_116; + x_117.x = asint((x_119 - asint(16))); + x_116_phi = x_117; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_124[16] = indexable; + const float4 tint_symbol_6[16] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + indexable = tint_symbol_6; + indexable = x_124; + const float4 x_125 = indexable[x_119]; + x_GLF_color = x_125; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.msl new file mode 100644 index 0000000000..6b28e63809 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.msl @@ -0,0 +1,112 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) { + tint_array_wrapper indexable = {}; + int2 x_80 = 0; + int2 x_113 = 0; + int x_119 = 0; + int2 x_80_phi = 0; + int x_83_phi = 0; + int2 x_114_phi = 0; + int2 x_116_phi = 0; + float4 const x_58 = *(tint_symbol_7); + float2 const x_61 = x_6.resolution; + float2 const x_62 = (float2(x_58.x, x_58.y) / x_61); + int const x_65 = int((x_62.x * 8.0f)); + int const x_69 = int((x_62.y * 8.0f)); + int2 const x_78 = int2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + while (true) { + int2 x_94 = 0; + int2 x_102 = 0; + int x_84 = 0; + int2 x_95_phi = 0; + int2 x_103_phi = 0; + x_80 = x_80_phi; + int const x_83 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + int2 const x_95 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + int2 const x_103 = x_103_phi; + int2 x_81_1 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + int2 const x_81 = x_81_1; + { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + int const x_108 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + int2 const x_114 = x_114_phi; + x_116_phi = x_114; + while (true) { + int2 x_117 = 0; + int2 const x_116 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + { + x_117 = x_116; + x_117.x = as_type((x_119 - as_type(16))); + x_116_phi = x_117; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + tint_array_wrapper const x_124 = indexable; + tint_array_wrapper const tint_symbol_5 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + indexable = tint_symbol_5; + indexable = x_124; + float4 const x_125 = indexable.arr[x_119]; + *(tint_symbol_8) = x_125; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_6 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..af0b70ab91 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.spvasm @@ -0,0 +1,297 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 188 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_80 "x_80" + OpName %x_113 "x_113" + OpName %x_119 "x_119" + OpName %x_80_phi "x_80_phi" + OpName %x_83_phi "x_83_phi" + OpName %x_114_phi "x_114_phi" + OpName %x_116_phi "x_116_phi" + OpName %x_94 "x_94" + OpName %x_102 "x_102" + OpName %x_84 "x_84" + OpName %x_95_phi "x_95_phi" + OpName %x_103_phi "x_103_phi" + OpName %x_81_1 "x_81_1" + OpName %x_117 "x_117" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %151 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %153 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %154 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %155 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %157 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %158 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %159 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %160 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %161 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %162 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %164 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %166 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %167 = OpConstantComposite %_arr_v4float_uint_16 %151 %153 %154 %155 %156 %157 %158 %159 %151 %160 %161 %162 %163 %164 %165 %166 + %169 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %170 = OpConstantComposite %_arr_v4float_uint_16 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 %169 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %175 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_80 = OpVariable %_ptr_Function_v2int Function %29 + %x_113 = OpVariable %_ptr_Function_v2int Function %29 + %x_119 = OpVariable %_ptr_Function_int Function %33 + %x_80_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_83_phi = OpVariable %_ptr_Function_int Function %33 + %x_114_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_116_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_94 = OpVariable %_ptr_Function_v2int Function %29 + %x_102 = OpVariable %_ptr_Function_v2int Function %29 + %x_84 = OpVariable %_ptr_Function_int Function %33 + %x_95_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_103_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_81_1 = OpVariable %_ptr_Function_v2int Function %29 + %x_117 = OpVariable %_ptr_Function_v2int Function %29 + %38 = OpLoad %v4float %gl_FragCoord + %41 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %42 = OpLoad %v2float %41 + %43 = OpCompositeExtract %float %38 0 + %44 = OpCompositeExtract %float %38 1 + %45 = OpCompositeConstruct %v2float %43 %44 + %46 = OpFDiv %v2float %45 %42 + %48 = OpCompositeExtract %float %46 0 + %50 = OpFMul %float %48 %float_8 + %47 = OpConvertFToS %int %50 + %52 = OpCompositeExtract %float %46 1 + %53 = OpFMul %float %52 %float_8 + %51 = OpConvertFToS %int %53 + %55 = OpBitwiseAnd %int %47 %int_5 + %57 = OpBitwiseAnd %int %51 %int_10 + %58 = OpBitwiseOr %int %55 %57 + %60 = OpIMul %int %58 %int_8 + %61 = OpBitwiseAnd %int %51 %int_5 + %62 = OpBitwiseAnd %int %47 %int_10 + %63 = OpBitwiseOr %int %61 %62 + %64 = OpIAdd %int %60 %63 + %66 = OpCompositeConstruct %v2int %64 %int_0 + OpStore %x_80_phi %66 + OpStore %x_83_phi %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %76 = OpLoad %v2int %x_80_phi + OpStore %x_80 %76 + %77 = OpLoad %int %x_83_phi + %79 = OpSLessThan %bool %77 %int_100 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %68 + %81 = OpLabel + %84 = OpLoad %v2int %x_80 + OpStore %x_95_phi %84 + %85 = OpAccessChain %_ptr_Function_int %x_80 %uint_0 + %86 = OpLoad %int %85 + %87 = OpSGreaterThan %bool %86 %int_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpLoad %v2int %x_80 + OpStore %x_94 %90 + %92 = OpAccessChain %_ptr_Function_int %x_94 %uint_1 + %93 = OpAccessChain %_ptr_Function_int %x_80 %uint_1 + %94 = OpLoad %int %93 + %96 = OpISub %int %94 %int_1 + OpStore %92 %96 + %97 = OpLoad %v2int %x_94 + OpStore %x_95_phi %97 + OpBranch %88 + %88 = OpLabel + %98 = OpLoad %v2int %x_95_phi + OpStore %x_103_phi %98 + %99 = OpCompositeExtract %int %98 0 + %100 = OpSLessThan %bool %99 %int_0 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %x_102 %98 + %103 = OpAccessChain %_ptr_Function_int %x_102 %uint_1 + %104 = OpCompositeExtract %int %98 1 + %105 = OpIAdd %int %104 %int_1 + OpStore %103 %105 + %106 = OpLoad %v2int %x_102 + OpStore %x_103_phi %106 + OpBranch %101 + %101 = OpLabel + %107 = OpLoad %v2int %x_103_phi + OpStore %x_81_1 %107 + %109 = OpAccessChain %_ptr_Function_int %x_81_1 %uint_0 + %110 = OpCompositeExtract %int %107 0 + %111 = OpCompositeExtract %int %107 1 + %113 = OpSDiv %int %111 %int_2 + %114 = OpIAdd %int %110 %113 + OpStore %109 %114 + %115 = OpLoad %v2int %x_81_1 + OpBranch %69 + %69 = OpLabel + %116 = OpIAdd %int %77 %int_1 + OpStore %x_84 %116 + OpStore %x_80_phi %115 + %117 = OpLoad %int %x_84 + OpStore %x_83_phi %117 + OpBranch %67 + %68 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %x_80 %uint_0 + %119 = OpLoad %int %118 + %120 = OpLoad %v2int %x_80 + OpStore %x_114_phi %120 + %121 = OpSLessThan %bool %119 %int_0 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + %124 = OpLoad %v2int %x_80 + OpStore %x_113 %124 + %125 = OpAccessChain %_ptr_Function_int %x_113 %uint_0 + %126 = OpSNegate %int %119 + OpStore %125 %126 + %127 = OpLoad %v2int %x_113 + OpStore %x_114_phi %127 + OpBranch %122 + %122 = OpLabel + %128 = OpLoad %v2int %x_114_phi + OpStore %x_116_phi %128 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %134 = OpLoad %v2int %x_116_phi + %135 = OpCompositeExtract %int %134 0 + OpStore %x_119 %135 + %136 = OpLoad %int %x_119 + %138 = OpSGreaterThan %bool %136 %int_15 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpBranch %139 + %141 = OpLabel + OpBranch %130 + %139 = OpLabel + OpBranch %131 + %131 = OpLabel + OpStore %x_117 %134 + %142 = OpAccessChain %_ptr_Function_int %x_117 %uint_0 + %144 = OpLoad %int %x_119 + %145 = OpCopyObject %int %int_16 + %147 = OpISub %int %144 %145 + %143 = OpCopyObject %int %147 + OpStore %142 %143 + %148 = OpLoad %v2int %x_117 + OpStore %x_116_phi %148 + OpBranch %129 + %130 = OpLabel + OpStore %indexable %167 + %168 = OpLoad %_arr_v4float_uint_16 %indexable + OpStore %indexable %170 + OpStore %indexable %168 + %171 = OpLoad %int %x_119 + %173 = OpAccessChain %_ptr_Function_v4float %indexable %171 + %174 = OpLoad %v4float %173 + OpStore %x_GLF_color %174 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %175 +%tint_symbol_1 = OpFunctionParameter %main_out + %179 = OpLabel + %180 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %180 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %182 = OpLabel + %183 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %183 + %184 = OpFunctionCall %void %main_1 + %186 = OpLoad %v4float %x_GLF_color + %187 = OpCompositeConstruct %main_out %186 + %185 = OpFunctionCall %void %tint_symbol_3 %187 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..f0b6447e64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/1.wgsl.expected.wgsl @@ -0,0 +1,109 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_80 : vec2; + var x_113 : vec2; + var x_119 : i32; + var x_80_phi : vec2; + var x_83_phi : i32; + var x_114_phi : vec2; + var x_116_phi : vec2; + let x_58 : vec4 = gl_FragCoord; + let x_61 : vec2 = x_6.resolution; + let x_62 : vec2 = (vec2(x_58.x, x_58.y) / x_61); + let x_65 : i32 = i32((x_62.x * 8.0)); + let x_66 : ptr, 16>> = &(indexable); + let x_69 : i32 = i32((x_62.y * 8.0)); + let x_78 : vec2 = vec2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + loop { + var x_94 : vec2; + var x_102 : vec2; + var x_84 : i32; + var x_95_phi : vec2; + var x_103_phi : vec2; + x_80 = x_80_phi; + let x_83 : i32 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + let x_95 : vec2 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + let x_103 : vec2 = x_103_phi; + var x_81_1 : vec2 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + let x_81 : vec2 = x_81_1; + + continuing { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + let x_108 : i32 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + let x_114 : vec2 = x_114_phi; + x_116_phi = x_114; + loop { + var x_117 : vec2; + let x_116 : vec2 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + + continuing { + x_117 = x_116; + x_117.x = bitcast((x_119 - bitcast(16))); + x_116_phi = x_117; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_124 : array, 16> = *(x_66); + *(x_66) = array, 16>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + *(x_66) = x_124; + let x_125 : vec4 = indexable[x_119]; + x_GLF_color = x_125; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm new file mode 100644 index 0000000000..37d1093a2f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm @@ -0,0 +1,164 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %indexable "indexable" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_100 = OpConstant %int 100 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %37 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %38 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %39 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %40 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %41 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %42 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %43 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %46 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %49 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %50 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %51 = OpConstantComposite %_arr_v4float_uint_16 %35 %37 %38 %39 %40 %41 %42 %43 %35 %44 %45 %46 %47 %48 %49 %50 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0_0 = OpConstant %float 0 + %55 = OpConstantComposite %v4float %float_0_0 %float_0_0 %float_0_0 %float_0_0 + %56 = OpConstantComposite %_arr_v4float_uint_16 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 %55 + %main = OpFunction %void None %9 + %57 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %58 = OpLoad %v4float %gl_FragCoord + %59 = OpVectorShuffle %v2float %58 %58 0 1 + %60 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %61 = OpLoad %v2float %60 + %62 = OpFDiv %v2float %59 %61 + %63 = OpCompositeExtract %float %62 0 + %64 = OpFMul %float %63 %float_8 + %65 = OpConvertFToS %int %64 + %66 = OpAccessChain %_ptr_Function__arr_v4float_uint_16 %indexable + %67 = OpCompositeExtract %float %62 1 + %68 = OpFMul %float %67 %float_8 + %69 = OpConvertFToS %int %68 + %70 = OpBitwiseAnd %int %65 %int_5 + %71 = OpBitwiseAnd %int %69 %int_10 + %72 = OpBitwiseOr %int %70 %71 + %73 = OpBitwiseAnd %int %69 %int_5 + %74 = OpBitwiseAnd %int %65 %int_10 + %75 = OpBitwiseOr %int %73 %74 + %76 = OpIMul %int %72 %int_8 + %77 = OpIAdd %int %76 %75 + %78 = OpCompositeConstruct %v2int %77 %int_0 + OpBranch %79 + %79 = OpLabel + %80 = OpPhi %v2int %78 %57 %81 %82 + %83 = OpPhi %int %int_0 %57 %84 %82 + %85 = OpSLessThan %bool %83 %int_100 + OpLoopMerge %86 %82 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpCompositeExtract %int %80 0 + %89 = OpSGreaterThan %bool %88 %int_0 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + %92 = OpCompositeExtract %int %80 1 + %93 = OpISub %int %92 %int_1 + %94 = OpCompositeInsert %v2int %93 %80 1 + OpBranch %90 + %90 = OpLabel + %95 = OpPhi %v2int %80 %87 %94 %91 + %96 = OpCompositeExtract %int %95 0 + %97 = OpSLessThan %bool %96 %int_0 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpCompositeExtract %int %95 1 + %101 = OpIAdd %int %100 %int_1 + %102 = OpCompositeInsert %v2int %101 %95 1 + OpBranch %98 + %98 = OpLabel + %103 = OpPhi %v2int %95 %90 %102 %99 + %104 = OpCompositeExtract %int %103 1 + %105 = OpSDiv %int %104 %int_2 + %106 = OpCompositeExtract %int %103 0 + %107 = OpIAdd %int %106 %105 + %81 = OpCompositeInsert %v2int %107 %103 0 + OpBranch %82 + %82 = OpLabel + %84 = OpIAdd %int %83 %int_1 + OpBranch %79 + %86 = OpLabel + %108 = OpCompositeExtract %int %80 0 + %109 = OpSLessThan %bool %108 %int_0 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpSNegate %int %108 + %113 = OpCompositeInsert %v2int %112 %80 0 + OpBranch %110 + %110 = OpLabel + %114 = OpPhi %v2int %80 %86 %113 %111 + OpBranch %115 + %115 = OpLabel + %116 = OpPhi %v2int %114 %110 %117 %118 + %119 = OpCompositeExtract %int %116 0 + %120 = OpSGreaterThan %bool %119 %int_15 + OpLoopMerge %121 %118 None + OpBranchConditional %120 %118 %121 + %118 = OpLabel + %122 = OpISub %int %119 %int_16 + %117 = OpCompositeInsert %v2int %122 %116 0 + OpBranch %115 + %121 = OpLabel + OpStore %indexable %51 + %123 = OpAccessChain %_ptr_Function_v4float %indexable %119 + %124 = OpLoad %v4float %123 + OpStore %_GLF_color %124 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.hlsl new file mode 100644 index 0000000000..d1b1da575b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.hlsl @@ -0,0 +1,105 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int2 x_80 = int2(0, 0); + int2 x_113 = int2(0, 0); + int x_119 = 0; + int2 x_80_phi = int2(0, 0); + int x_83_phi = 0; + int2 x_114_phi = int2(0, 0); + int2 x_116_phi = int2(0, 0); + const float4 x_58 = gl_FragCoord; + const float2 x_61 = asfloat(x_6[0].xy); + const float2 x_62 = (float2(x_58.x, x_58.y) / x_61); + const int x_65 = int((x_62.x * 8.0f)); + const int x_69 = int((x_62.y * 8.0f)); + const int2 x_78 = int2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + while (true) { + int2 x_94 = int2(0, 0); + int2 x_102 = int2(0, 0); + int x_84 = 0; + int2 x_95_phi = int2(0, 0); + int2 x_103_phi = int2(0, 0); + x_80 = x_80_phi; + const int x_83 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + const int2 x_95 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + const int2 x_103 = x_103_phi; + int2 x_81_1 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + const int2 x_81 = x_81_1; + { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + const int x_108 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + x_116_phi = x_114_phi; + while (true) { + int2 x_117 = int2(0, 0); + const int2 x_116 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + { + x_117 = x_116; + x_117.x = asint((x_119 - asint(16))); + x_116_phi = x_117; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_124 = indexable[x_119]; + x_GLF_color = x_124; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.msl new file mode 100644 index 0000000000..14e3c2f75a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int2 x_80 = 0; + int2 x_113 = 0; + int x_119 = 0; + int2 x_80_phi = 0; + int x_83_phi = 0; + int2 x_114_phi = 0; + int2 x_116_phi = 0; + float4 const x_58 = *(tint_symbol_6); + float2 const x_61 = x_6.resolution; + float2 const x_62 = (float2(x_58.x, x_58.y) / x_61); + int const x_65 = int((x_62.x * 8.0f)); + int const x_69 = int((x_62.y * 8.0f)); + int2 const x_78 = int2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + while (true) { + int2 x_94 = 0; + int2 x_102 = 0; + int x_84 = 0; + int2 x_95_phi = 0; + int2 x_103_phi = 0; + x_80 = x_80_phi; + int const x_83 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + int2 const x_95 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + int2 const x_103 = x_103_phi; + int2 x_81_1 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + int2 const x_81 = x_81_1; + { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + int const x_108 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + int2 const x_114 = x_114_phi; + x_116_phi = x_114; + while (true) { + int2 x_117 = 0; + int2 const x_116 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + { + x_117 = x_116; + x_117.x = as_type((x_119 - as_type(16))); + x_116_phi = x_117; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_124 = indexable.arr[x_119]; + *(tint_symbol_7) = x_124; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.spvasm new file mode 100644 index 0000000000..657d9eb2d2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.spvasm @@ -0,0 +1,292 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 185 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_80 "x_80" + OpName %x_113 "x_113" + OpName %x_119 "x_119" + OpName %x_80_phi "x_80_phi" + OpName %x_83_phi "x_83_phi" + OpName %x_114_phi "x_114_phi" + OpName %x_116_phi "x_116_phi" + OpName %x_94 "x_94" + OpName %x_102 "x_102" + OpName %x_84 "x_84" + OpName %x_95_phi "x_95_phi" + OpName %x_103_phi "x_103_phi" + OpName %x_81_1 "x_81_1" + OpName %x_117 "x_117" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %151 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %153 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %154 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %155 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %157 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %158 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %159 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %160 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %161 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %162 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %164 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %166 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %167 = OpConstantComposite %_arr_v4float_uint_16 %151 %153 %154 %155 %156 %157 %158 %159 %151 %160 %161 %162 %163 %164 %165 %166 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %172 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_80 = OpVariable %_ptr_Function_v2int Function %29 + %x_113 = OpVariable %_ptr_Function_v2int Function %29 + %x_119 = OpVariable %_ptr_Function_int Function %33 + %x_80_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_83_phi = OpVariable %_ptr_Function_int Function %33 + %x_114_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_116_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_94 = OpVariable %_ptr_Function_v2int Function %29 + %x_102 = OpVariable %_ptr_Function_v2int Function %29 + %x_84 = OpVariable %_ptr_Function_int Function %33 + %x_95_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_103_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_81_1 = OpVariable %_ptr_Function_v2int Function %29 + %x_117 = OpVariable %_ptr_Function_v2int Function %29 + %38 = OpLoad %v4float %gl_FragCoord + %41 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %42 = OpLoad %v2float %41 + %43 = OpCompositeExtract %float %38 0 + %44 = OpCompositeExtract %float %38 1 + %45 = OpCompositeConstruct %v2float %43 %44 + %46 = OpFDiv %v2float %45 %42 + %48 = OpCompositeExtract %float %46 0 + %50 = OpFMul %float %48 %float_8 + %47 = OpConvertFToS %int %50 + %52 = OpCompositeExtract %float %46 1 + %53 = OpFMul %float %52 %float_8 + %51 = OpConvertFToS %int %53 + %55 = OpBitwiseAnd %int %47 %int_5 + %57 = OpBitwiseAnd %int %51 %int_10 + %58 = OpBitwiseOr %int %55 %57 + %60 = OpIMul %int %58 %int_8 + %61 = OpBitwiseAnd %int %51 %int_5 + %62 = OpBitwiseAnd %int %47 %int_10 + %63 = OpBitwiseOr %int %61 %62 + %64 = OpIAdd %int %60 %63 + %66 = OpCompositeConstruct %v2int %64 %int_0 + OpStore %x_80_phi %66 + OpStore %x_83_phi %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %76 = OpLoad %v2int %x_80_phi + OpStore %x_80 %76 + %77 = OpLoad %int %x_83_phi + %79 = OpSLessThan %bool %77 %int_100 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %68 + %81 = OpLabel + %84 = OpLoad %v2int %x_80 + OpStore %x_95_phi %84 + %85 = OpAccessChain %_ptr_Function_int %x_80 %uint_0 + %86 = OpLoad %int %85 + %87 = OpSGreaterThan %bool %86 %int_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpLoad %v2int %x_80 + OpStore %x_94 %90 + %92 = OpAccessChain %_ptr_Function_int %x_94 %uint_1 + %93 = OpAccessChain %_ptr_Function_int %x_80 %uint_1 + %94 = OpLoad %int %93 + %96 = OpISub %int %94 %int_1 + OpStore %92 %96 + %97 = OpLoad %v2int %x_94 + OpStore %x_95_phi %97 + OpBranch %88 + %88 = OpLabel + %98 = OpLoad %v2int %x_95_phi + OpStore %x_103_phi %98 + %99 = OpCompositeExtract %int %98 0 + %100 = OpSLessThan %bool %99 %int_0 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %x_102 %98 + %103 = OpAccessChain %_ptr_Function_int %x_102 %uint_1 + %104 = OpCompositeExtract %int %98 1 + %105 = OpIAdd %int %104 %int_1 + OpStore %103 %105 + %106 = OpLoad %v2int %x_102 + OpStore %x_103_phi %106 + OpBranch %101 + %101 = OpLabel + %107 = OpLoad %v2int %x_103_phi + OpStore %x_81_1 %107 + %109 = OpAccessChain %_ptr_Function_int %x_81_1 %uint_0 + %110 = OpCompositeExtract %int %107 0 + %111 = OpCompositeExtract %int %107 1 + %113 = OpSDiv %int %111 %int_2 + %114 = OpIAdd %int %110 %113 + OpStore %109 %114 + %115 = OpLoad %v2int %x_81_1 + OpBranch %69 + %69 = OpLabel + %116 = OpIAdd %int %77 %int_1 + OpStore %x_84 %116 + OpStore %x_80_phi %115 + %117 = OpLoad %int %x_84 + OpStore %x_83_phi %117 + OpBranch %67 + %68 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %x_80 %uint_0 + %119 = OpLoad %int %118 + %120 = OpLoad %v2int %x_80 + OpStore %x_114_phi %120 + %121 = OpSLessThan %bool %119 %int_0 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + %124 = OpLoad %v2int %x_80 + OpStore %x_113 %124 + %125 = OpAccessChain %_ptr_Function_int %x_113 %uint_0 + %126 = OpSNegate %int %119 + OpStore %125 %126 + %127 = OpLoad %v2int %x_113 + OpStore %x_114_phi %127 + OpBranch %122 + %122 = OpLabel + %128 = OpLoad %v2int %x_114_phi + OpStore %x_116_phi %128 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %134 = OpLoad %v2int %x_116_phi + %135 = OpCompositeExtract %int %134 0 + OpStore %x_119 %135 + %136 = OpLoad %int %x_119 + %138 = OpSGreaterThan %bool %136 %int_15 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpBranch %139 + %141 = OpLabel + OpBranch %130 + %139 = OpLabel + OpBranch %131 + %131 = OpLabel + OpStore %x_117 %134 + %142 = OpAccessChain %_ptr_Function_int %x_117 %uint_0 + %144 = OpLoad %int %x_119 + %145 = OpCopyObject %int %int_16 + %147 = OpISub %int %144 %145 + %143 = OpCopyObject %int %147 + OpStore %142 %143 + %148 = OpLoad %v2int %x_117 + OpStore %x_116_phi %148 + OpBranch %129 + %130 = OpLabel + OpStore %indexable %167 + %168 = OpLoad %int %x_119 + %170 = OpAccessChain %_ptr_Function_v4float %indexable %168 + %171 = OpLoad %v4float %170 + OpStore %x_GLF_color %171 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %172 +%tint_symbol_1 = OpFunctionParameter %main_out + %176 = OpLabel + %177 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %177 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %179 = OpLabel + %180 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %180 + %181 = OpFunctionCall %void %main_1 + %183 = OpLoad %v4float %x_GLF_color + %184 = OpCompositeConstruct %main_out %183 + %182 = OpFunctionCall %void %tint_symbol_3 %184 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.wgsl new file mode 100644 index 0000000000..55f9a36bc0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.spvasm.expected.wgsl @@ -0,0 +1,106 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_80 : vec2; + var x_113 : vec2; + var x_119 : i32; + var x_80_phi : vec2; + var x_83_phi : i32; + var x_114_phi : vec2; + var x_116_phi : vec2; + let x_58 : vec4 = gl_FragCoord; + let x_61 : vec2 = x_6.resolution; + let x_62 : vec2 = (vec2(x_58.x, x_58.y) / x_61); + let x_65 : i32 = i32((x_62.x * 8.0)); + let x_66 : ptr, 16>> = &(indexable); + let x_69 : i32 = i32((x_62.y * 8.0)); + let x_78 : vec2 = vec2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + loop { + var x_94 : vec2; + var x_102 : vec2; + var x_84 : i32; + var x_95_phi : vec2; + var x_103_phi : vec2; + x_80 = x_80_phi; + let x_83 : i32 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + let x_95 : vec2 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + let x_103 : vec2 = x_103_phi; + var x_81_1 : vec2 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + let x_81 : vec2 = x_81_1; + + continuing { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + let x_108 : i32 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + let x_114 : vec2 = x_114_phi; + x_116_phi = x_114; + loop { + var x_117 : vec2; + let x_116 : vec2 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + + continuing { + x_117 = x_116; + x_117.x = bitcast((x_119 - bitcast(16))); + x_116_phi = x_117; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_124 : vec4 = indexable[x_119]; + x_GLF_color = x_124; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl new file mode 100644 index 0000000000..55f9a36bc0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl @@ -0,0 +1,106 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_80 : vec2; + var x_113 : vec2; + var x_119 : i32; + var x_80_phi : vec2; + var x_83_phi : i32; + var x_114_phi : vec2; + var x_116_phi : vec2; + let x_58 : vec4 = gl_FragCoord; + let x_61 : vec2 = x_6.resolution; + let x_62 : vec2 = (vec2(x_58.x, x_58.y) / x_61); + let x_65 : i32 = i32((x_62.x * 8.0)); + let x_66 : ptr, 16>> = &(indexable); + let x_69 : i32 = i32((x_62.y * 8.0)); + let x_78 : vec2 = vec2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + loop { + var x_94 : vec2; + var x_102 : vec2; + var x_84 : i32; + var x_95_phi : vec2; + var x_103_phi : vec2; + x_80 = x_80_phi; + let x_83 : i32 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + let x_95 : vec2 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + let x_103 : vec2 = x_103_phi; + var x_81_1 : vec2 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + let x_81 : vec2 = x_81_1; + + continuing { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + let x_108 : i32 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + let x_114 : vec2 = x_114_phi; + x_116_phi = x_114; + loop { + var x_117 : vec2; + let x_116 : vec2 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + + continuing { + x_117 = x_116; + x_117.x = bitcast((x_119 - bitcast(16))); + x_116_phi = x_117; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_124 : vec4 = indexable[x_119]; + x_GLF_color = x_124; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.hlsl new file mode 100644 index 0000000000..d1b1da575b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.hlsl @@ -0,0 +1,105 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 indexable[16] = (float4[16])0; + int2 x_80 = int2(0, 0); + int2 x_113 = int2(0, 0); + int x_119 = 0; + int2 x_80_phi = int2(0, 0); + int x_83_phi = 0; + int2 x_114_phi = int2(0, 0); + int2 x_116_phi = int2(0, 0); + const float4 x_58 = gl_FragCoord; + const float2 x_61 = asfloat(x_6[0].xy); + const float2 x_62 = (float2(x_58.x, x_58.y) / x_61); + const int x_65 = int((x_62.x * 8.0f)); + const int x_69 = int((x_62.y * 8.0f)); + const int2 x_78 = int2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + while (true) { + int2 x_94 = int2(0, 0); + int2 x_102 = int2(0, 0); + int x_84 = 0; + int2 x_95_phi = int2(0, 0); + int2 x_103_phi = int2(0, 0); + x_80 = x_80_phi; + const int x_83 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + const int2 x_95 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + const int2 x_103 = x_103_phi; + int2 x_81_1 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + const int2 x_81 = x_81_1; + { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + const int x_108 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + x_116_phi = x_114_phi; + while (true) { + int2 x_117 = int2(0, 0); + const int2 x_116 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + { + x_117 = x_116; + x_117.x = asint((x_119 - asint(16))); + x_116_phi = x_117; + } + } + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_124 = indexable[x_119]; + x_GLF_color = x_124; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.msl new file mode 100644 index 0000000000..14e3c2f75a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + tint_array_wrapper indexable = {}; + int2 x_80 = 0; + int2 x_113 = 0; + int x_119 = 0; + int2 x_80_phi = 0; + int x_83_phi = 0; + int2 x_114_phi = 0; + int2 x_116_phi = 0; + float4 const x_58 = *(tint_symbol_6); + float2 const x_61 = x_6.resolution; + float2 const x_62 = (float2(x_58.x, x_58.y) / x_61); + int const x_65 = int((x_62.x * 8.0f)); + int const x_69 = int((x_62.y * 8.0f)); + int2 const x_78 = int2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + while (true) { + int2 x_94 = 0; + int2 x_102 = 0; + int x_84 = 0; + int2 x_95_phi = 0; + int2 x_103_phi = 0; + x_80 = x_80_phi; + int const x_83 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + int2 const x_95 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + int2 const x_103 = x_103_phi; + int2 x_81_1 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + int2 const x_81 = x_81_1; + { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + int const x_108 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + int2 const x_114 = x_114_phi; + x_116_phi = x_114; + while (true) { + int2 x_117 = 0; + int2 const x_116 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + { + x_117 = x_116; + x_117.x = as_type((x_119 - as_type(16))); + x_116_phi = x_117; + } + } + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_124 = indexable.arr[x_119]; + *(tint_symbol_7) = x_124; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.spvasm new file mode 100644 index 0000000000..657d9eb2d2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.spvasm @@ -0,0 +1,292 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 185 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %indexable "indexable" + OpName %x_80 "x_80" + OpName %x_113 "x_113" + OpName %x_119 "x_119" + OpName %x_80_phi "x_80_phi" + OpName %x_83_phi "x_83_phi" + OpName %x_114_phi "x_114_phi" + OpName %x_116_phi "x_116_phi" + OpName %x_94 "x_94" + OpName %x_102 "x_102" + OpName %x_84 "x_84" + OpName %x_95_phi "x_95_phi" + OpName %x_103_phi "x_103_phi" + OpName %x_81_1 "x_81_1" + OpName %x_117 "x_117" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %24 = OpConstantNull %_arr_v4float_uint_16 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %29 = OpConstantNull %v2int +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %int_5 = OpConstant %int 5 + %int_10 = OpConstant %int 10 + %int_8 = OpConstant %int 8 + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %151 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %153 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %154 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %155 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %157 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %158 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %159 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %160 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %161 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %162 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %163 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %164 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %165 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %166 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %167 = OpConstantComposite %_arr_v4float_uint_16 %151 %153 %154 %155 %156 %157 %158 %159 %151 %160 %161 %162 %163 %164 %165 %166 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %172 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %24 + %x_80 = OpVariable %_ptr_Function_v2int Function %29 + %x_113 = OpVariable %_ptr_Function_v2int Function %29 + %x_119 = OpVariable %_ptr_Function_int Function %33 + %x_80_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_83_phi = OpVariable %_ptr_Function_int Function %33 + %x_114_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_116_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_94 = OpVariable %_ptr_Function_v2int Function %29 + %x_102 = OpVariable %_ptr_Function_v2int Function %29 + %x_84 = OpVariable %_ptr_Function_int Function %33 + %x_95_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_103_phi = OpVariable %_ptr_Function_v2int Function %29 + %x_81_1 = OpVariable %_ptr_Function_v2int Function %29 + %x_117 = OpVariable %_ptr_Function_v2int Function %29 + %38 = OpLoad %v4float %gl_FragCoord + %41 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %42 = OpLoad %v2float %41 + %43 = OpCompositeExtract %float %38 0 + %44 = OpCompositeExtract %float %38 1 + %45 = OpCompositeConstruct %v2float %43 %44 + %46 = OpFDiv %v2float %45 %42 + %48 = OpCompositeExtract %float %46 0 + %50 = OpFMul %float %48 %float_8 + %47 = OpConvertFToS %int %50 + %52 = OpCompositeExtract %float %46 1 + %53 = OpFMul %float %52 %float_8 + %51 = OpConvertFToS %int %53 + %55 = OpBitwiseAnd %int %47 %int_5 + %57 = OpBitwiseAnd %int %51 %int_10 + %58 = OpBitwiseOr %int %55 %57 + %60 = OpIMul %int %58 %int_8 + %61 = OpBitwiseAnd %int %51 %int_5 + %62 = OpBitwiseAnd %int %47 %int_10 + %63 = OpBitwiseOr %int %61 %62 + %64 = OpIAdd %int %60 %63 + %66 = OpCompositeConstruct %v2int %64 %int_0 + OpStore %x_80_phi %66 + OpStore %x_83_phi %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %76 = OpLoad %v2int %x_80_phi + OpStore %x_80 %76 + %77 = OpLoad %int %x_83_phi + %79 = OpSLessThan %bool %77 %int_100 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %68 + %81 = OpLabel + %84 = OpLoad %v2int %x_80 + OpStore %x_95_phi %84 + %85 = OpAccessChain %_ptr_Function_int %x_80 %uint_0 + %86 = OpLoad %int %85 + %87 = OpSGreaterThan %bool %86 %int_0 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + %90 = OpLoad %v2int %x_80 + OpStore %x_94 %90 + %92 = OpAccessChain %_ptr_Function_int %x_94 %uint_1 + %93 = OpAccessChain %_ptr_Function_int %x_80 %uint_1 + %94 = OpLoad %int %93 + %96 = OpISub %int %94 %int_1 + OpStore %92 %96 + %97 = OpLoad %v2int %x_94 + OpStore %x_95_phi %97 + OpBranch %88 + %88 = OpLabel + %98 = OpLoad %v2int %x_95_phi + OpStore %x_103_phi %98 + %99 = OpCompositeExtract %int %98 0 + %100 = OpSLessThan %bool %99 %int_0 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %x_102 %98 + %103 = OpAccessChain %_ptr_Function_int %x_102 %uint_1 + %104 = OpCompositeExtract %int %98 1 + %105 = OpIAdd %int %104 %int_1 + OpStore %103 %105 + %106 = OpLoad %v2int %x_102 + OpStore %x_103_phi %106 + OpBranch %101 + %101 = OpLabel + %107 = OpLoad %v2int %x_103_phi + OpStore %x_81_1 %107 + %109 = OpAccessChain %_ptr_Function_int %x_81_1 %uint_0 + %110 = OpCompositeExtract %int %107 0 + %111 = OpCompositeExtract %int %107 1 + %113 = OpSDiv %int %111 %int_2 + %114 = OpIAdd %int %110 %113 + OpStore %109 %114 + %115 = OpLoad %v2int %x_81_1 + OpBranch %69 + %69 = OpLabel + %116 = OpIAdd %int %77 %int_1 + OpStore %x_84 %116 + OpStore %x_80_phi %115 + %117 = OpLoad %int %x_84 + OpStore %x_83_phi %117 + OpBranch %67 + %68 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %x_80 %uint_0 + %119 = OpLoad %int %118 + %120 = OpLoad %v2int %x_80 + OpStore %x_114_phi %120 + %121 = OpSLessThan %bool %119 %int_0 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + %124 = OpLoad %v2int %x_80 + OpStore %x_113 %124 + %125 = OpAccessChain %_ptr_Function_int %x_113 %uint_0 + %126 = OpSNegate %int %119 + OpStore %125 %126 + %127 = OpLoad %v2int %x_113 + OpStore %x_114_phi %127 + OpBranch %122 + %122 = OpLabel + %128 = OpLoad %v2int %x_114_phi + OpStore %x_116_phi %128 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %134 = OpLoad %v2int %x_116_phi + %135 = OpCompositeExtract %int %134 0 + OpStore %x_119 %135 + %136 = OpLoad %int %x_119 + %138 = OpSGreaterThan %bool %136 %int_15 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %140 = OpLabel + OpBranch %139 + %141 = OpLabel + OpBranch %130 + %139 = OpLabel + OpBranch %131 + %131 = OpLabel + OpStore %x_117 %134 + %142 = OpAccessChain %_ptr_Function_int %x_117 %uint_0 + %144 = OpLoad %int %x_119 + %145 = OpCopyObject %int %int_16 + %147 = OpISub %int %144 %145 + %143 = OpCopyObject %int %147 + OpStore %142 %143 + %148 = OpLoad %v2int %x_117 + OpStore %x_116_phi %148 + OpBranch %129 + %130 = OpLabel + OpStore %indexable %167 + %168 = OpLoad %int %x_119 + %170 = OpAccessChain %_ptr_Function_v4float %indexable %168 + %171 = OpLoad %v4float %170 + OpStore %x_GLF_color %171 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %172 +%tint_symbol_1 = OpFunctionParameter %main_out + %176 = OpLabel + %177 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %177 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %179 = OpLabel + %180 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %180 + %181 = OpFunctionCall %void %main_1 + %183 = OpLoad %v4float %x_GLF_color + %184 = OpCompositeConstruct %main_out %183 + %182 = OpFunctionCall %void %tint_symbol_3 %184 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.wgsl new file mode 100644 index 0000000000..55f9a36bc0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-orbit-Os-access-chain-mutate-pointer/2.wgsl.expected.wgsl @@ -0,0 +1,106 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var indexable : array, 16>; + var x_80 : vec2; + var x_113 : vec2; + var x_119 : i32; + var x_80_phi : vec2; + var x_83_phi : i32; + var x_114_phi : vec2; + var x_116_phi : vec2; + let x_58 : vec4 = gl_FragCoord; + let x_61 : vec2 = x_6.resolution; + let x_62 : vec2 = (vec2(x_58.x, x_58.y) / x_61); + let x_65 : i32 = i32((x_62.x * 8.0)); + let x_66 : ptr, 16>> = &(indexable); + let x_69 : i32 = i32((x_62.y * 8.0)); + let x_78 : vec2 = vec2(((((x_65 & 5) | (x_69 & 10)) * 8) + ((x_69 & 5) | (x_65 & 10))), 0); + x_80_phi = x_78; + x_83_phi = 0; + loop { + var x_94 : vec2; + var x_102 : vec2; + var x_84 : i32; + var x_95_phi : vec2; + var x_103_phi : vec2; + x_80 = x_80_phi; + let x_83 : i32 = x_83_phi; + if ((x_83 < 100)) { + } else { + break; + } + x_95_phi = x_80; + if ((x_80.x > 0)) { + x_94 = x_80; + x_94.y = (x_80.y - 1); + x_95_phi = x_94; + } + let x_95 : vec2 = x_95_phi; + x_103_phi = x_95; + if ((x_95.x < 0)) { + x_102 = x_95; + x_102.y = (x_95.y + 1); + x_103_phi = x_102; + } + let x_103 : vec2 = x_103_phi; + var x_81_1 : vec2 = x_103; + x_81_1.x = (x_103.x + (x_103.y / 2)); + let x_81 : vec2 = x_81_1; + + continuing { + x_84 = (x_83 + 1); + x_80_phi = x_81; + x_83_phi = x_84; + } + } + let x_108 : i32 = x_80.x; + x_114_phi = x_80; + if ((x_108 < 0)) { + x_113 = x_80; + x_113.x = -(x_108); + x_114_phi = x_113; + } + let x_114 : vec2 = x_114_phi; + x_116_phi = x_114; + loop { + var x_117 : vec2; + let x_116 : vec2 = x_116_phi; + x_119 = x_116.x; + if ((x_119 > 15)) { + } else { + break; + } + + continuing { + x_117 = x_116; + x_117.x = bitcast((x_119 - bitcast(16))); + x_116_phi = x_117; + } + } + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_124 : vec4 = indexable[x_119]; + x_GLF_color = x_124; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm new file mode 100644 index 0000000000..97f67890e8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm @@ -0,0 +1,304 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %177 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %float_15 = OpConstant %float 15 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %183 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %192 = OpUndef %v4float +%float_0_0666666701 = OpConstant %float 0.0666666701 + %int_0_0 = OpConstant %int 0 + %main = OpFunction %void None %8 + %195 = OpLabel + %196 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %197 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %198 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %199 = OpLoad %v4float %gl_FragCoord + %200 = OpVectorShuffle %v2float %199 %199 0 1 + %201 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %202 = OpLoad %v2float %201 + %203 = OpFDiv %v2float %200 %202 + %204 = OpCompositeExtract %float %203 0 + %205 = OpFMul %float %204 %float_256 + %206 = OpConvertFToS %int %205 + %207 = OpCompositeExtract %float %203 1 + %208 = OpFMul %float %207 %float_256 + %209 = OpConvertFToS %int %208 + %210 = OpCompositeConstruct %v2int %206 %209 + OpSelectionMerge %211 None + OpSwitch %uint_0 %212 + %212 = OpLabel + OpBranch %213 + %213 = OpLabel + %214 = OpPhi %v2int %210 %212 %215 %216 + %217 = OpCompositeExtract %int %214 1 + %218 = OpINotEqual %bool %217 %int_256 + OpLoopMerge %219 %216 None + OpBranchConditional %218 %220 %219 + %220 = OpLabel + %221 = OpCompositeExtract %int %214 0 + OpStore %196 %177 + %222 = OpAccessChain %_ptr_Function_int %196 %217 + %223 = OpLoad %int %222 + %224 = OpIAdd %int %223 %int_15 + %225 = OpSLessThan %bool %221 %224 + OpBranch %226 + %226 = OpLabel + OpSelectionMerge %227 None + OpBranchConditional %225 %228 %227 + %228 = OpLabel + OpStore %197 %177 + OpBranch %227 + %227 = OpLabel + %229 = OpAccessChain %_ptr_Function_int %197 %217 + OpSelectionMerge %230 None + OpBranchConditional %225 %231 %232 + %231 = OpLabel + %233 = OpLoad %int %229 + OpBranch %230 + %232 = OpLabel + %234 = OpCopyObject %int %int_0_0 + OpBranch %230 + %230 = OpLabel + %235 = OpPhi %int %233 %231 %234 %232 + %236 = OpISub %int %235 %int_15 + %237 = OpSGreaterThan %bool %221 %236 + OpSelectionMerge %238 None + OpBranchConditional %225 %239 %240 + %239 = OpLabel + OpBranch %238 + %240 = OpLabel + OpBranch %238 + %238 = OpLabel + %241 = OpPhi %bool %237 %239 %225 %240 + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %242 + %243 = OpLabel + OpStore %198 %177 + %244 = OpAccessChain %_ptr_Function_int %198 %217 + %245 = OpLoad %int %244 + %246 = OpISub %int %221 %245 + %247 = OpConvertSToF %float %246 + %248 = OpExtInst %float %1 FAbs %247 + %249 = OpFSub %float %float_15 %248 + %250 = OpFMul %float %249 %float_0_0666666701 + %251 = OpCompositeConstruct %v4float %250 %250 %250 %float_1 + OpBranch %219 + %242 = OpLabel + %252 = OpIAdd %int %217 %int_1 + %215 = OpCompositeInsert %v2int %252 %214 1 + OpBranch %216 + %216 = OpLabel + OpBranch %213 + %219 = OpLabel + %253 = OpPhi %v4float %192 %213 %251 %243 + %254 = OpPhi %bool %false %213 %true %243 + OpSelectionMerge %255 None + OpBranchConditional %254 %211 %255 + %255 = OpLabel + OpBranch %211 + %211 = OpLabel + %256 = OpPhi %v4float %253 %219 %183 %255 + OpStore %_GLF_color %256 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..375d7550e5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.hlsl @@ -0,0 +1,108 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_196[256] = (int[256])0; + int x_197[256] = (int[256])0; + int x_198[256] = (int[256])0; + int2 x_210 = int2(0, 0); + float4 x_251 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_253 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int2 x_214_phi = int2(0, 0); + float4 x_253_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_254_phi = false; + float4 x_256_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float4 x_199 = gl_FragCoord; + const float2 x_202 = asfloat(x_6[0].xy); + const float2 x_203 = (float2(x_199.x, x_199.y) / x_202); + x_210 = int2(int((x_203.x * 256.0f)), int((x_203.y * 256.0f))); + switch(0u) { + default: { + x_214_phi = x_210; + while (true) { + int x_233 = 0; + int x_234 = 0; + int x_235_phi = 0; + bool x_241_phi = false; + const int2 x_214 = x_214_phi; + const int x_217 = x_214.y; + x_253_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_254_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + const int x_221 = x_214.x; + const int tint_symbol_5[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_196 = tint_symbol_5; + const int x_223 = x_196[x_217]; + const bool x_225 = (x_221 < (x_223 + 15)); + if (x_225) { + const int tint_symbol_6[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_197 = tint_symbol_6; + } + if (x_225) { + x_233 = x_197[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + const bool x_237 = (x_221 > (x_235_phi - 15)); + if (x_225) { + x_241_phi = x_237; + } else { + x_241_phi = x_225; + } + if (x_241_phi) { + const int tint_symbol_7[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_198 = tint_symbol_7; + const int x_245 = x_198[x_217]; + const float x_250 = ((15.0f - abs(float((x_221 - x_245)))) * 0.06666667f); + x_251 = float4(x_250, x_250, x_250, 1.0f); + x_253_phi = x_251; + x_254_phi = true; + break; + } + int2 x_215_1 = x_214; + x_215_1.y = (x_217 + 1); + const int2 x_215 = x_215_1; + { + x_214_phi = x_215; + } + } + x_253 = x_253_phi; + const bool x_254 = x_254_phi; + x_256_phi = x_253; + if (x_254) { + break; + } + x_256_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + x_GLF_color = x_256_phi; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.msl new file mode 100644 index 0000000000..72762dcdfe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.msl @@ -0,0 +1,113 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) { + tint_array_wrapper x_196 = {}; + tint_array_wrapper x_197 = {}; + tint_array_wrapper x_198 = {}; + int2 x_210 = 0; + float4 x_251 = 0.0f; + float4 x_253 = 0.0f; + int2 x_214_phi = 0; + float4 x_253_phi = 0.0f; + bool x_254_phi = false; + float4 x_256_phi = 0.0f; + float4 const x_199 = *(tint_symbol_8); + float2 const x_202 = x_6.resolution; + float2 const x_203 = (float2(x_199.x, x_199.y) / x_202); + x_210 = int2(int((x_203.x * 256.0f)), int((x_203.y * 256.0f))); + switch(0u) { + default: { + x_214_phi = x_210; + while (true) { + int x_233 = 0; + int x_234 = 0; + int x_235_phi = 0; + bool x_241_phi = false; + int2 const x_214 = x_214_phi; + int const x_217 = x_214.y; + x_253_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_254_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + int const x_221 = x_214.x; + tint_array_wrapper const tint_symbol_4 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_196 = tint_symbol_4; + int const x_223 = x_196.arr[x_217]; + bool const x_225 = (x_221 < (x_223 + 15)); + if (x_225) { + tint_array_wrapper const tint_symbol_5 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_197 = tint_symbol_5; + } + if (x_225) { + x_233 = x_197.arr[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + int const x_235 = x_235_phi; + bool const x_237 = (x_221 > (x_235 - 15)); + if (x_225) { + x_241_phi = x_237; + } else { + x_241_phi = x_225; + } + bool const x_241 = x_241_phi; + if (x_241) { + tint_array_wrapper const tint_symbol_6 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_198 = tint_symbol_6; + int const x_245 = x_198.arr[x_217]; + float const x_250 = ((15.0f - fabs(float((x_221 - x_245)))) * 0.06666667f); + x_251 = float4(x_250, x_250, x_250, 1.0f); + x_253_phi = x_251; + x_254_phi = true; + break; + } + int2 x_215_1 = x_214; + x_215_1.y = (x_217 + 1); + int2 const x_215 = x_215_1; + { + x_214_phi = x_215; + } + } + x_253 = x_253_phi; + bool const x_254 = x_254_phi; + x_256_phi = x_253; + if (x_254) { + break; + } + x_256_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + float4 const x_256 = x_256_phi; + *(tint_symbol_9) = x_256; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_11}; + tint_symbol_2 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..cc6b7b1b17 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.spvasm @@ -0,0 +1,408 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 303 +; Schema: 0 + OpCapability Shader + %267 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_196 "x_196" + OpName %x_197 "x_197" + OpName %x_198 "x_198" + OpName %x_210 "x_210" + OpName %x_251 "x_251" + OpName %x_253 "x_253" + OpName %x_214_phi "x_214_phi" + OpName %x_253_phi "x_253_phi" + OpName %x_254_phi "x_254_phi" + OpName %x_256_phi "x_256_phi" + OpName %x_233 "x_233" + OpName %x_234 "x_234" + OpName %x_235_phi "x_235_phi" + OpName %x_241_phi "x_241_phi" + OpName %x_215_1 "x_215_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %25 = OpConstantNull %_arr_int_uint_256 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %31 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 +%_ptr_Function_int = OpTypePointer Function %int + %68 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %75 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %int_256 = OpConstant %int 256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %240 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 + %float_15 = OpConstant %float 15 +%float_0_0666666701 = OpConstant %float 0.0666666701 + %float_1 = OpConstant %float 1 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %288 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %290 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_196 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_197 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_198 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_210 = OpVariable %_ptr_Function_v2int Function %31 + %x_251 = OpVariable %_ptr_Function_v4float Function %5 + %x_253 = OpVariable %_ptr_Function_v4float Function %5 + %x_214_phi = OpVariable %_ptr_Function_v2int Function %31 + %x_253_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_254_phi = OpVariable %_ptr_Function_bool Function %40 + %x_256_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_233 = OpVariable %_ptr_Function_int Function %68 + %x_234 = OpVariable %_ptr_Function_int Function %68 + %x_235_phi = OpVariable %_ptr_Function_int Function %68 + %x_241_phi = OpVariable %_ptr_Function_bool Function %40 + %x_215_1 = OpVariable %_ptr_Function_v2int Function %31 + %42 = OpLoad %v4float %gl_FragCoord + %45 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %46 = OpLoad %v2float %45 + %47 = OpCompositeExtract %float %42 0 + %48 = OpCompositeExtract %float %42 1 + %49 = OpCompositeConstruct %v2float %47 %48 + %50 = OpFDiv %v2float %49 %46 + %52 = OpCompositeExtract %float %50 0 + %54 = OpFMul %float %52 %float_256 + %51 = OpConvertFToS %int %54 + %56 = OpCompositeExtract %float %50 1 + %57 = OpFMul %float %56 %float_256 + %55 = OpConvertFToS %int %57 + %58 = OpCompositeConstruct %v2int %51 %55 + OpStore %x_210 %58 + OpSelectionMerge %59 None + OpSwitch %uint_0 %60 + %60 = OpLabel + %61 = OpLoad %v2int %x_210 + OpStore %x_214_phi %61 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %72 = OpLoad %v2int %x_214_phi + %73 = OpCompositeExtract %int %72 1 + OpStore %x_253_phi %75 + OpStore %x_254_phi %false + %78 = OpINotEqual %bool %73 %int_256 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %81 + %80 = OpLabel + OpBranch %79 + %81 = OpLabel + OpBranch %63 + %79 = OpLabel + %82 = OpCompositeExtract %int %72 0 + OpStore %x_196 %240 + %241 = OpAccessChain %_ptr_Function_int %x_196 %73 + %242 = OpLoad %int %241 + %243 = OpIAdd %int %242 %int_15 + %244 = OpSLessThan %bool %82 %243 + OpSelectionMerge %245 None + OpBranchConditional %244 %246 %245 + %246 = OpLabel + OpStore %x_197 %240 + OpBranch %245 + %245 = OpLabel + OpSelectionMerge %247 None + OpBranchConditional %244 %248 %249 + %248 = OpLabel + %250 = OpAccessChain %_ptr_Function_int %x_197 %73 + %251 = OpLoad %int %250 + OpStore %x_233 %251 + %252 = OpLoad %int %x_233 + OpStore %x_235_phi %252 + OpBranch %247 + %249 = OpLabel + OpStore %x_234 %int_0 + %253 = OpLoad %int %x_234 + OpStore %x_235_phi %253 + OpBranch %247 + %247 = OpLabel + %254 = OpLoad %int %x_235_phi + %255 = OpISub %int %254 %int_15 + %256 = OpSGreaterThan %bool %82 %255 + OpSelectionMerge %257 None + OpBranchConditional %244 %258 %259 + %258 = OpLabel + OpStore %x_241_phi %256 + OpBranch %257 + %259 = OpLabel + OpStore %x_241_phi %244 + OpBranch %257 + %257 = OpLabel + %260 = OpLoad %bool %x_241_phi + OpSelectionMerge %261 None + OpBranchConditional %260 %262 %261 + %262 = OpLabel + OpStore %x_198 %240 + %263 = OpAccessChain %_ptr_Function_int %x_198 %73 + %264 = OpLoad %int %263 + %269 = OpISub %int %82 %264 + %268 = OpConvertSToF %float %269 + %266 = OpExtInst %float %267 FAbs %268 + %270 = OpFSub %float %float_15 %266 + %272 = OpFMul %float %270 %float_0_0666666701 + %274 = OpCompositeConstruct %v4float %272 %272 %272 %float_1 + OpStore %x_251 %274 + %275 = OpLoad %v4float %x_251 + OpStore %x_253_phi %275 + OpStore %x_254_phi %true + OpBranch %63 + %261 = OpLabel + OpStore %x_215_1 %72 + %279 = OpAccessChain %_ptr_Function_int %x_215_1 %uint_1 + %281 = OpIAdd %int %73 %int_1 + OpStore %279 %281 + %282 = OpLoad %v2int %x_215_1 + OpBranch %64 + %64 = OpLabel + OpStore %x_214_phi %282 + OpBranch %62 + %63 = OpLabel + %283 = OpLoad %v4float %x_253_phi + OpStore %x_253 %283 + %284 = OpLoad %bool %x_254_phi + %285 = OpLoad %v4float %x_253 + OpStore %x_256_phi %285 + OpSelectionMerge %286 None + OpBranchConditional %284 %287 %286 + %287 = OpLabel + OpBranch %59 + %286 = OpLabel + OpStore %x_256_phi %288 + OpBranch %59 + %59 = OpLabel + %289 = OpLoad %v4float %x_256_phi + OpStore %x_GLF_color %289 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %290 +%tint_symbol_1 = OpFunctionParameter %main_out + %294 = OpLabel + %295 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %295 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %297 = OpLabel + %298 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %298 + %299 = OpFunctionCall %void %main_1 + %301 = OpLoad %v4float %x_GLF_color + %302 = OpCompositeConstruct %main_out %301 + %300 = OpFunctionCall %void %tint_symbol_3 %302 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..43a6481d24 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.spvasm.expected.wgsl @@ -0,0 +1,106 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_196 : array; + var x_197 : array; + var x_198 : array; + var x_210 : vec2; + var x_251 : vec4; + var x_253 : vec4; + var x_214_phi : vec2; + var x_253_phi : vec4; + var x_254_phi : bool; + var x_256_phi : vec4; + let x_199 : vec4 = gl_FragCoord; + let x_202 : vec2 = x_6.resolution; + let x_203 : vec2 = (vec2(x_199.x, x_199.y) / x_202); + x_210 = vec2(i32((x_203.x * 256.0)), i32((x_203.y * 256.0))); + switch(0u) { + default: { + x_214_phi = x_210; + loop { + var x_233 : i32; + var x_234 : i32; + var x_235_phi : i32; + var x_241_phi : bool; + let x_214 : vec2 = x_214_phi; + let x_217 : i32 = x_214.y; + x_253_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_254_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + let x_221 : i32 = x_214.x; + x_196 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_223 : i32 = x_196[x_217]; + let x_225 : bool = (x_221 < (x_223 + 15)); + if (x_225) { + x_197 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + } + if (x_225) { + x_233 = x_197[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + let x_235 : i32 = x_235_phi; + let x_237 : bool = (x_221 > (x_235 - 15)); + if (x_225) { + x_241_phi = x_237; + } else { + x_241_phi = x_225; + } + let x_241 : bool = x_241_phi; + if (x_241) { + x_198 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_245 : i32 = x_198[x_217]; + let x_250 : f32 = ((15.0 - abs(f32((x_221 - x_245)))) * 0.06666667); + x_251 = vec4(x_250, x_250, x_250, 1.0); + x_253_phi = x_251; + x_254_phi = true; + break; + } + var x_215_1 : vec2 = x_214; + x_215_1.y = (x_217 + 1); + let x_215 : vec2 = x_215_1; + + continuing { + x_214_phi = x_215; + } + } + x_253 = x_253_phi; + let x_254 : bool = x_254_phi; + x_256_phi = x_253; + if (x_254) { + break; + } + x_256_phi = vec4(0.0, 0.0, 0.0, 1.0); + } + } + let x_256 : vec4 = x_256_phi; + x_GLF_color = x_256; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl new file mode 100644 index 0000000000..43a6481d24 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl @@ -0,0 +1,106 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_196 : array; + var x_197 : array; + var x_198 : array; + var x_210 : vec2; + var x_251 : vec4; + var x_253 : vec4; + var x_214_phi : vec2; + var x_253_phi : vec4; + var x_254_phi : bool; + var x_256_phi : vec4; + let x_199 : vec4 = gl_FragCoord; + let x_202 : vec2 = x_6.resolution; + let x_203 : vec2 = (vec2(x_199.x, x_199.y) / x_202); + x_210 = vec2(i32((x_203.x * 256.0)), i32((x_203.y * 256.0))); + switch(0u) { + default: { + x_214_phi = x_210; + loop { + var x_233 : i32; + var x_234 : i32; + var x_235_phi : i32; + var x_241_phi : bool; + let x_214 : vec2 = x_214_phi; + let x_217 : i32 = x_214.y; + x_253_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_254_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + let x_221 : i32 = x_214.x; + x_196 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_223 : i32 = x_196[x_217]; + let x_225 : bool = (x_221 < (x_223 + 15)); + if (x_225) { + x_197 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + } + if (x_225) { + x_233 = x_197[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + let x_235 : i32 = x_235_phi; + let x_237 : bool = (x_221 > (x_235 - 15)); + if (x_225) { + x_241_phi = x_237; + } else { + x_241_phi = x_225; + } + let x_241 : bool = x_241_phi; + if (x_241) { + x_198 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_245 : i32 = x_198[x_217]; + let x_250 : f32 = ((15.0 - abs(f32((x_221 - x_245)))) * 0.06666667); + x_251 = vec4(x_250, x_250, x_250, 1.0); + x_253_phi = x_251; + x_254_phi = true; + break; + } + var x_215_1 : vec2 = x_214; + x_215_1.y = (x_217 + 1); + let x_215 : vec2 = x_215_1; + + continuing { + x_214_phi = x_215; + } + } + x_253 = x_253_phi; + let x_254 : bool = x_254_phi; + x_256_phi = x_253; + if (x_254) { + break; + } + x_256_phi = vec4(0.0, 0.0, 0.0, 1.0); + } + } + let x_256 : vec4 = x_256_phi; + x_GLF_color = x_256; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..375d7550e5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.hlsl @@ -0,0 +1,108 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_196[256] = (int[256])0; + int x_197[256] = (int[256])0; + int x_198[256] = (int[256])0; + int2 x_210 = int2(0, 0); + float4 x_251 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_253 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int2 x_214_phi = int2(0, 0); + float4 x_253_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_254_phi = false; + float4 x_256_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float4 x_199 = gl_FragCoord; + const float2 x_202 = asfloat(x_6[0].xy); + const float2 x_203 = (float2(x_199.x, x_199.y) / x_202); + x_210 = int2(int((x_203.x * 256.0f)), int((x_203.y * 256.0f))); + switch(0u) { + default: { + x_214_phi = x_210; + while (true) { + int x_233 = 0; + int x_234 = 0; + int x_235_phi = 0; + bool x_241_phi = false; + const int2 x_214 = x_214_phi; + const int x_217 = x_214.y; + x_253_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_254_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + const int x_221 = x_214.x; + const int tint_symbol_5[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_196 = tint_symbol_5; + const int x_223 = x_196[x_217]; + const bool x_225 = (x_221 < (x_223 + 15)); + if (x_225) { + const int tint_symbol_6[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_197 = tint_symbol_6; + } + if (x_225) { + x_233 = x_197[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + const bool x_237 = (x_221 > (x_235_phi - 15)); + if (x_225) { + x_241_phi = x_237; + } else { + x_241_phi = x_225; + } + if (x_241_phi) { + const int tint_symbol_7[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_198 = tint_symbol_7; + const int x_245 = x_198[x_217]; + const float x_250 = ((15.0f - abs(float((x_221 - x_245)))) * 0.06666667f); + x_251 = float4(x_250, x_250, x_250, 1.0f); + x_253_phi = x_251; + x_254_phi = true; + break; + } + int2 x_215_1 = x_214; + x_215_1.y = (x_217 + 1); + const int2 x_215 = x_215_1; + { + x_214_phi = x_215; + } + } + x_253 = x_253_phi; + const bool x_254 = x_254_phi; + x_256_phi = x_253; + if (x_254) { + break; + } + x_256_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + x_GLF_color = x_256_phi; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.msl new file mode 100644 index 0000000000..72762dcdfe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.msl @@ -0,0 +1,113 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) { + tint_array_wrapper x_196 = {}; + tint_array_wrapper x_197 = {}; + tint_array_wrapper x_198 = {}; + int2 x_210 = 0; + float4 x_251 = 0.0f; + float4 x_253 = 0.0f; + int2 x_214_phi = 0; + float4 x_253_phi = 0.0f; + bool x_254_phi = false; + float4 x_256_phi = 0.0f; + float4 const x_199 = *(tint_symbol_8); + float2 const x_202 = x_6.resolution; + float2 const x_203 = (float2(x_199.x, x_199.y) / x_202); + x_210 = int2(int((x_203.x * 256.0f)), int((x_203.y * 256.0f))); + switch(0u) { + default: { + x_214_phi = x_210; + while (true) { + int x_233 = 0; + int x_234 = 0; + int x_235_phi = 0; + bool x_241_phi = false; + int2 const x_214 = x_214_phi; + int const x_217 = x_214.y; + x_253_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_254_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + int const x_221 = x_214.x; + tint_array_wrapper const tint_symbol_4 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_196 = tint_symbol_4; + int const x_223 = x_196.arr[x_217]; + bool const x_225 = (x_221 < (x_223 + 15)); + if (x_225) { + tint_array_wrapper const tint_symbol_5 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_197 = tint_symbol_5; + } + if (x_225) { + x_233 = x_197.arr[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + int const x_235 = x_235_phi; + bool const x_237 = (x_221 > (x_235 - 15)); + if (x_225) { + x_241_phi = x_237; + } else { + x_241_phi = x_225; + } + bool const x_241 = x_241_phi; + if (x_241) { + tint_array_wrapper const tint_symbol_6 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_198 = tint_symbol_6; + int const x_245 = x_198.arr[x_217]; + float const x_250 = ((15.0f - fabs(float((x_221 - x_245)))) * 0.06666667f); + x_251 = float4(x_250, x_250, x_250, 1.0f); + x_253_phi = x_251; + x_254_phi = true; + break; + } + int2 x_215_1 = x_214; + x_215_1.y = (x_217 + 1); + int2 const x_215 = x_215_1; + { + x_214_phi = x_215; + } + } + x_253 = x_253_phi; + bool const x_254 = x_254_phi; + x_256_phi = x_253; + if (x_254) { + break; + } + x_256_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + float4 const x_256 = x_256_phi; + *(tint_symbol_9) = x_256; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_11}; + tint_symbol_2 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc6b7b1b17 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.spvasm @@ -0,0 +1,408 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 303 +; Schema: 0 + OpCapability Shader + %267 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_196 "x_196" + OpName %x_197 "x_197" + OpName %x_198 "x_198" + OpName %x_210 "x_210" + OpName %x_251 "x_251" + OpName %x_253 "x_253" + OpName %x_214_phi "x_214_phi" + OpName %x_253_phi "x_253_phi" + OpName %x_254_phi "x_254_phi" + OpName %x_256_phi "x_256_phi" + OpName %x_233 "x_233" + OpName %x_234 "x_234" + OpName %x_235_phi "x_235_phi" + OpName %x_241_phi "x_241_phi" + OpName %x_215_1 "x_215_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %25 = OpConstantNull %_arr_int_uint_256 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %31 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 +%_ptr_Function_int = OpTypePointer Function %int + %68 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %75 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %int_256 = OpConstant %int 256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %240 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 + %float_15 = OpConstant %float 15 +%float_0_0666666701 = OpConstant %float 0.0666666701 + %float_1 = OpConstant %float 1 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %288 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %290 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_196 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_197 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_198 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_210 = OpVariable %_ptr_Function_v2int Function %31 + %x_251 = OpVariable %_ptr_Function_v4float Function %5 + %x_253 = OpVariable %_ptr_Function_v4float Function %5 + %x_214_phi = OpVariable %_ptr_Function_v2int Function %31 + %x_253_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_254_phi = OpVariable %_ptr_Function_bool Function %40 + %x_256_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_233 = OpVariable %_ptr_Function_int Function %68 + %x_234 = OpVariable %_ptr_Function_int Function %68 + %x_235_phi = OpVariable %_ptr_Function_int Function %68 + %x_241_phi = OpVariable %_ptr_Function_bool Function %40 + %x_215_1 = OpVariable %_ptr_Function_v2int Function %31 + %42 = OpLoad %v4float %gl_FragCoord + %45 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %46 = OpLoad %v2float %45 + %47 = OpCompositeExtract %float %42 0 + %48 = OpCompositeExtract %float %42 1 + %49 = OpCompositeConstruct %v2float %47 %48 + %50 = OpFDiv %v2float %49 %46 + %52 = OpCompositeExtract %float %50 0 + %54 = OpFMul %float %52 %float_256 + %51 = OpConvertFToS %int %54 + %56 = OpCompositeExtract %float %50 1 + %57 = OpFMul %float %56 %float_256 + %55 = OpConvertFToS %int %57 + %58 = OpCompositeConstruct %v2int %51 %55 + OpStore %x_210 %58 + OpSelectionMerge %59 None + OpSwitch %uint_0 %60 + %60 = OpLabel + %61 = OpLoad %v2int %x_210 + OpStore %x_214_phi %61 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %72 = OpLoad %v2int %x_214_phi + %73 = OpCompositeExtract %int %72 1 + OpStore %x_253_phi %75 + OpStore %x_254_phi %false + %78 = OpINotEqual %bool %73 %int_256 + OpSelectionMerge %79 None + OpBranchConditional %78 %80 %81 + %80 = OpLabel + OpBranch %79 + %81 = OpLabel + OpBranch %63 + %79 = OpLabel + %82 = OpCompositeExtract %int %72 0 + OpStore %x_196 %240 + %241 = OpAccessChain %_ptr_Function_int %x_196 %73 + %242 = OpLoad %int %241 + %243 = OpIAdd %int %242 %int_15 + %244 = OpSLessThan %bool %82 %243 + OpSelectionMerge %245 None + OpBranchConditional %244 %246 %245 + %246 = OpLabel + OpStore %x_197 %240 + OpBranch %245 + %245 = OpLabel + OpSelectionMerge %247 None + OpBranchConditional %244 %248 %249 + %248 = OpLabel + %250 = OpAccessChain %_ptr_Function_int %x_197 %73 + %251 = OpLoad %int %250 + OpStore %x_233 %251 + %252 = OpLoad %int %x_233 + OpStore %x_235_phi %252 + OpBranch %247 + %249 = OpLabel + OpStore %x_234 %int_0 + %253 = OpLoad %int %x_234 + OpStore %x_235_phi %253 + OpBranch %247 + %247 = OpLabel + %254 = OpLoad %int %x_235_phi + %255 = OpISub %int %254 %int_15 + %256 = OpSGreaterThan %bool %82 %255 + OpSelectionMerge %257 None + OpBranchConditional %244 %258 %259 + %258 = OpLabel + OpStore %x_241_phi %256 + OpBranch %257 + %259 = OpLabel + OpStore %x_241_phi %244 + OpBranch %257 + %257 = OpLabel + %260 = OpLoad %bool %x_241_phi + OpSelectionMerge %261 None + OpBranchConditional %260 %262 %261 + %262 = OpLabel + OpStore %x_198 %240 + %263 = OpAccessChain %_ptr_Function_int %x_198 %73 + %264 = OpLoad %int %263 + %269 = OpISub %int %82 %264 + %268 = OpConvertSToF %float %269 + %266 = OpExtInst %float %267 FAbs %268 + %270 = OpFSub %float %float_15 %266 + %272 = OpFMul %float %270 %float_0_0666666701 + %274 = OpCompositeConstruct %v4float %272 %272 %272 %float_1 + OpStore %x_251 %274 + %275 = OpLoad %v4float %x_251 + OpStore %x_253_phi %275 + OpStore %x_254_phi %true + OpBranch %63 + %261 = OpLabel + OpStore %x_215_1 %72 + %279 = OpAccessChain %_ptr_Function_int %x_215_1 %uint_1 + %281 = OpIAdd %int %73 %int_1 + OpStore %279 %281 + %282 = OpLoad %v2int %x_215_1 + OpBranch %64 + %64 = OpLabel + OpStore %x_214_phi %282 + OpBranch %62 + %63 = OpLabel + %283 = OpLoad %v4float %x_253_phi + OpStore %x_253 %283 + %284 = OpLoad %bool %x_254_phi + %285 = OpLoad %v4float %x_253 + OpStore %x_256_phi %285 + OpSelectionMerge %286 None + OpBranchConditional %284 %287 %286 + %287 = OpLabel + OpBranch %59 + %286 = OpLabel + OpStore %x_256_phi %288 + OpBranch %59 + %59 = OpLabel + %289 = OpLoad %v4float %x_256_phi + OpStore %x_GLF_color %289 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %290 +%tint_symbol_1 = OpFunctionParameter %main_out + %294 = OpLabel + %295 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %295 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %297 = OpLabel + %298 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %298 + %299 = OpFunctionCall %void %main_1 + %301 = OpLoad %v4float %x_GLF_color + %302 = OpCompositeConstruct %main_out %301 + %300 = OpFunctionCall %void %tint_symbol_3 %302 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..43a6481d24 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/1.wgsl.expected.wgsl @@ -0,0 +1,106 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_196 : array; + var x_197 : array; + var x_198 : array; + var x_210 : vec2; + var x_251 : vec4; + var x_253 : vec4; + var x_214_phi : vec2; + var x_253_phi : vec4; + var x_254_phi : bool; + var x_256_phi : vec4; + let x_199 : vec4 = gl_FragCoord; + let x_202 : vec2 = x_6.resolution; + let x_203 : vec2 = (vec2(x_199.x, x_199.y) / x_202); + x_210 = vec2(i32((x_203.x * 256.0)), i32((x_203.y * 256.0))); + switch(0u) { + default: { + x_214_phi = x_210; + loop { + var x_233 : i32; + var x_234 : i32; + var x_235_phi : i32; + var x_241_phi : bool; + let x_214 : vec2 = x_214_phi; + let x_217 : i32 = x_214.y; + x_253_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_254_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + let x_221 : i32 = x_214.x; + x_196 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_223 : i32 = x_196[x_217]; + let x_225 : bool = (x_221 < (x_223 + 15)); + if (x_225) { + x_197 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + } + if (x_225) { + x_233 = x_197[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + let x_235 : i32 = x_235_phi; + let x_237 : bool = (x_221 > (x_235 - 15)); + if (x_225) { + x_241_phi = x_237; + } else { + x_241_phi = x_225; + } + let x_241 : bool = x_241_phi; + if (x_241) { + x_198 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_245 : i32 = x_198[x_217]; + let x_250 : f32 = ((15.0 - abs(f32((x_221 - x_245)))) * 0.06666667); + x_251 = vec4(x_250, x_250, x_250, 1.0); + x_253_phi = x_251; + x_254_phi = true; + break; + } + var x_215_1 : vec2 = x_214; + x_215_1.y = (x_217 + 1); + let x_215 : vec2 = x_215_1; + + continuing { + x_214_phi = x_215; + } + } + x_253 = x_253_phi; + let x_254 : bool = x_254_phi; + x_256_phi = x_253; + if (x_254) { + break; + } + x_256_phi = vec4(0.0, 0.0, 0.0, 1.0); + } + } + let x_256 : vec4 = x_256_phi; + x_GLF_color = x_256; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm new file mode 100644 index 0000000000..00938952dd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm @@ -0,0 +1,299 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %177 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %float_15 = OpConstant %float 15 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %183 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %192 = OpUndef %v4float +%float_0_0666666701 = OpConstant %float 0.0666666701 + %int_0_0 = OpConstant %int 0 + %main = OpFunction %void None %8 + %195 = OpLabel + %196 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %197 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %198 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %199 = OpLoad %v4float %gl_FragCoord + %200 = OpVectorShuffle %v2float %199 %199 0 1 + %201 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %202 = OpLoad %v2float %201 + %203 = OpFDiv %v2float %200 %202 + %204 = OpCompositeExtract %float %203 0 + %205 = OpFMul %float %204 %float_256 + %206 = OpConvertFToS %int %205 + %207 = OpCompositeExtract %float %203 1 + %208 = OpFMul %float %207 %float_256 + %209 = OpConvertFToS %int %208 + %210 = OpCompositeConstruct %v2int %206 %209 + OpSelectionMerge %211 None + OpSwitch %uint_0 %212 + %212 = OpLabel + OpBranch %213 + %213 = OpLabel + %214 = OpPhi %v2int %210 %212 %215 %216 + %217 = OpCompositeExtract %int %214 1 + %218 = OpINotEqual %bool %217 %int_256 + OpLoopMerge %219 %216 None + OpBranchConditional %218 %220 %219 + %220 = OpLabel + %221 = OpCompositeExtract %int %214 0 + OpStore %196 %177 + %222 = OpAccessChain %_ptr_Function_int %196 %217 + %223 = OpLoad %int %222 + %224 = OpIAdd %int %223 %int_15 + %225 = OpSLessThan %bool %221 %224 + OpBranch %226 + %226 = OpLabel + OpSelectionMerge %227 None + OpBranchConditional %225 %228 %227 + %228 = OpLabel + OpStore %197 %177 + OpBranch %227 + %227 = OpLabel + %229 = OpAccessChain %_ptr_Function_int %197 %217 + OpSelectionMerge %230 None + OpBranchConditional %225 %231 %232 + %231 = OpLabel + %233 = OpLoad %int %229 + OpBranch %230 + %232 = OpLabel + %234 = OpCopyObject %int %int_0_0 + OpBranch %230 + %230 = OpLabel + %235 = OpPhi %int %233 %231 %234 %232 + %236 = OpISub %int %235 %int_15 + %237 = OpSGreaterThan %bool %221 %236 + OpBranch %238 + %238 = OpLabel + %239 = OpSelect %bool %225 %237 %225 + OpSelectionMerge %240 None + OpBranchConditional %239 %241 %240 + %241 = OpLabel + OpStore %198 %177 + %242 = OpAccessChain %_ptr_Function_int %198 %217 + %243 = OpLoad %int %242 + %244 = OpISub %int %221 %243 + %245 = OpConvertSToF %float %244 + %246 = OpExtInst %float %1 FAbs %245 + %247 = OpFSub %float %float_15 %246 + %248 = OpFMul %float %247 %float_0_0666666701 + %249 = OpCompositeConstruct %v4float %248 %248 %248 %float_1 + OpBranch %219 + %240 = OpLabel + %250 = OpIAdd %int %217 %int_1 + %215 = OpCompositeInsert %v2int %250 %214 1 + OpBranch %216 + %216 = OpLabel + OpBranch %213 + %219 = OpLabel + %251 = OpPhi %v4float %192 %213 %249 %241 + %252 = OpPhi %bool %false %213 %true %241 + OpSelectionMerge %253 None + OpBranchConditional %252 %211 %253 + %253 = OpLabel + OpBranch %211 + %211 = OpLabel + %254 = OpPhi %v4float %251 %219 %183 %253 + OpStore %_GLF_color %254 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.hlsl new file mode 100644 index 0000000000..0614b0d2a1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.hlsl @@ -0,0 +1,102 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_196[256] = (int[256])0; + int x_197[256] = (int[256])0; + int x_198[256] = (int[256])0; + int2 x_210 = int2(0, 0); + float4 x_249 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_251 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int2 x_214_phi = int2(0, 0); + float4 x_251_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_252_phi = false; + float4 x_254_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float4 x_199 = gl_FragCoord; + const float2 x_202 = asfloat(x_6[0].xy); + const float2 x_203 = (float2(x_199.x, x_199.y) / x_202); + x_210 = int2(int((x_203.x * 256.0f)), int((x_203.y * 256.0f))); + switch(0u) { + default: { + x_214_phi = x_210; + while (true) { + int x_233 = 0; + int x_234 = 0; + int x_235_phi = 0; + const int2 x_214 = x_214_phi; + const int x_217 = x_214.y; + x_251_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_252_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + const int x_221 = x_214.x; + const int tint_symbol_5[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_196 = tint_symbol_5; + const int x_223 = x_196[x_217]; + const bool x_225 = (x_221 < (x_223 + 15)); + if (x_225) { + const int tint_symbol_6[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_197 = tint_symbol_6; + } + if (x_225) { + x_233 = x_197[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + const bool x_237 = (x_221 > (x_235_phi - 15)); + if ((x_225 ? x_237 : x_225)) { + const int tint_symbol_7[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_198 = tint_symbol_7; + const int x_243 = x_198[x_217]; + const float x_248 = ((15.0f - abs(float((x_221 - x_243)))) * 0.06666667f); + x_249 = float4(x_248, x_248, x_248, 1.0f); + x_251_phi = x_249; + x_252_phi = true; + break; + } + int2 x_215_1 = x_214; + x_215_1.y = (x_217 + 1); + const int2 x_215 = x_215_1; + { + x_214_phi = x_215; + } + } + x_251 = x_251_phi; + const bool x_252 = x_252_phi; + x_254_phi = x_251; + if (x_252) { + break; + } + x_254_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + x_GLF_color = x_254_phi; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.msl new file mode 100644 index 0000000000..0b8a803b52 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.msl @@ -0,0 +1,106 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) { + tint_array_wrapper x_196 = {}; + tint_array_wrapper x_197 = {}; + tint_array_wrapper x_198 = {}; + int2 x_210 = 0; + float4 x_249 = 0.0f; + float4 x_251 = 0.0f; + int2 x_214_phi = 0; + float4 x_251_phi = 0.0f; + bool x_252_phi = false; + float4 x_254_phi = 0.0f; + float4 const x_199 = *(tint_symbol_8); + float2 const x_202 = x_6.resolution; + float2 const x_203 = (float2(x_199.x, x_199.y) / x_202); + x_210 = int2(int((x_203.x * 256.0f)), int((x_203.y * 256.0f))); + switch(0u) { + default: { + x_214_phi = x_210; + while (true) { + int x_233 = 0; + int x_234 = 0; + int x_235_phi = 0; + int2 const x_214 = x_214_phi; + int const x_217 = x_214.y; + x_251_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_252_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + int const x_221 = x_214.x; + tint_array_wrapper const tint_symbol_4 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_196 = tint_symbol_4; + int const x_223 = x_196.arr[x_217]; + bool const x_225 = (x_221 < (x_223 + 15)); + if (x_225) { + tint_array_wrapper const tint_symbol_5 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_197 = tint_symbol_5; + } + if (x_225) { + x_233 = x_197.arr[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + int const x_235 = x_235_phi; + bool const x_237 = (x_221 > (x_235 - 15)); + if (select(x_225, x_237, x_225)) { + tint_array_wrapper const tint_symbol_6 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_198 = tint_symbol_6; + int const x_243 = x_198.arr[x_217]; + float const x_248 = ((15.0f - fabs(float((x_221 - x_243)))) * 0.06666667f); + x_249 = float4(x_248, x_248, x_248, 1.0f); + x_251_phi = x_249; + x_252_phi = true; + break; + } + int2 x_215_1 = x_214; + x_215_1.y = (x_217 + 1); + int2 const x_215 = x_215_1; + { + x_214_phi = x_215; + } + } + x_251 = x_251_phi; + bool const x_252 = x_252_phi; + x_254_phi = x_251; + if (x_252) { + break; + } + x_254_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + float4 const x_254 = x_254_phi; + *(tint_symbol_9) = x_254; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_11}; + tint_symbol_2 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.spvasm new file mode 100644 index 0000000000..ace8cfbd70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.spvasm @@ -0,0 +1,397 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 299 +; Schema: 0 + OpCapability Shader + %263 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_196 "x_196" + OpName %x_197 "x_197" + OpName %x_198 "x_198" + OpName %x_210 "x_210" + OpName %x_249 "x_249" + OpName %x_251 "x_251" + OpName %x_214_phi "x_214_phi" + OpName %x_251_phi "x_251_phi" + OpName %x_252_phi "x_252_phi" + OpName %x_254_phi "x_254_phi" + OpName %x_233 "x_233" + OpName %x_234 "x_234" + OpName %x_235_phi "x_235_phi" + OpName %x_215_1 "x_215_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %25 = OpConstantNull %_arr_int_uint_256 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %31 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 +%_ptr_Function_int = OpTypePointer Function %int + %68 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %74 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %int_256 = OpConstant %int 256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %239 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 + %float_15 = OpConstant %float 15 +%float_0_0666666701 = OpConstant %float 0.0666666701 + %float_1 = OpConstant %float 1 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %284 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %286 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_196 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_197 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_198 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_210 = OpVariable %_ptr_Function_v2int Function %31 + %x_249 = OpVariable %_ptr_Function_v4float Function %5 + %x_251 = OpVariable %_ptr_Function_v4float Function %5 + %x_214_phi = OpVariable %_ptr_Function_v2int Function %31 + %x_251_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_252_phi = OpVariable %_ptr_Function_bool Function %40 + %x_254_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_233 = OpVariable %_ptr_Function_int Function %68 + %x_234 = OpVariable %_ptr_Function_int Function %68 + %x_235_phi = OpVariable %_ptr_Function_int Function %68 + %x_215_1 = OpVariable %_ptr_Function_v2int Function %31 + %42 = OpLoad %v4float %gl_FragCoord + %45 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %46 = OpLoad %v2float %45 + %47 = OpCompositeExtract %float %42 0 + %48 = OpCompositeExtract %float %42 1 + %49 = OpCompositeConstruct %v2float %47 %48 + %50 = OpFDiv %v2float %49 %46 + %52 = OpCompositeExtract %float %50 0 + %54 = OpFMul %float %52 %float_256 + %51 = OpConvertFToS %int %54 + %56 = OpCompositeExtract %float %50 1 + %57 = OpFMul %float %56 %float_256 + %55 = OpConvertFToS %int %57 + %58 = OpCompositeConstruct %v2int %51 %55 + OpStore %x_210 %58 + OpSelectionMerge %59 None + OpSwitch %uint_0 %60 + %60 = OpLabel + %61 = OpLoad %v2int %x_210 + OpStore %x_214_phi %61 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %71 = OpLoad %v2int %x_214_phi + %72 = OpCompositeExtract %int %71 1 + OpStore %x_251_phi %74 + OpStore %x_252_phi %false + %77 = OpINotEqual %bool %72 %int_256 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + OpBranch %78 + %80 = OpLabel + OpBranch %63 + %78 = OpLabel + %81 = OpCompositeExtract %int %71 0 + OpStore %x_196 %239 + %240 = OpAccessChain %_ptr_Function_int %x_196 %72 + %241 = OpLoad %int %240 + %242 = OpIAdd %int %241 %int_15 + %243 = OpSLessThan %bool %81 %242 + OpSelectionMerge %244 None + OpBranchConditional %243 %245 %244 + %245 = OpLabel + OpStore %x_197 %239 + OpBranch %244 + %244 = OpLabel + OpSelectionMerge %246 None + OpBranchConditional %243 %247 %248 + %247 = OpLabel + %249 = OpAccessChain %_ptr_Function_int %x_197 %72 + %250 = OpLoad %int %249 + OpStore %x_233 %250 + %251 = OpLoad %int %x_233 + OpStore %x_235_phi %251 + OpBranch %246 + %248 = OpLabel + OpStore %x_234 %int_0 + %252 = OpLoad %int %x_234 + OpStore %x_235_phi %252 + OpBranch %246 + %246 = OpLabel + %253 = OpLoad %int %x_235_phi + %254 = OpISub %int %253 %int_15 + %255 = OpSGreaterThan %bool %81 %254 + %256 = OpSelect %bool %243 %255 %243 + OpSelectionMerge %257 None + OpBranchConditional %256 %258 %257 + %258 = OpLabel + OpStore %x_198 %239 + %259 = OpAccessChain %_ptr_Function_int %x_198 %72 + %260 = OpLoad %int %259 + %265 = OpISub %int %81 %260 + %264 = OpConvertSToF %float %265 + %262 = OpExtInst %float %263 FAbs %264 + %266 = OpFSub %float %float_15 %262 + %268 = OpFMul %float %266 %float_0_0666666701 + %270 = OpCompositeConstruct %v4float %268 %268 %268 %float_1 + OpStore %x_249 %270 + %271 = OpLoad %v4float %x_249 + OpStore %x_251_phi %271 + OpStore %x_252_phi %true + OpBranch %63 + %257 = OpLabel + OpStore %x_215_1 %71 + %275 = OpAccessChain %_ptr_Function_int %x_215_1 %uint_1 + %277 = OpIAdd %int %72 %int_1 + OpStore %275 %277 + %278 = OpLoad %v2int %x_215_1 + OpBranch %64 + %64 = OpLabel + OpStore %x_214_phi %278 + OpBranch %62 + %63 = OpLabel + %279 = OpLoad %v4float %x_251_phi + OpStore %x_251 %279 + %280 = OpLoad %bool %x_252_phi + %281 = OpLoad %v4float %x_251 + OpStore %x_254_phi %281 + OpSelectionMerge %282 None + OpBranchConditional %280 %283 %282 + %283 = OpLabel + OpBranch %59 + %282 = OpLabel + OpStore %x_254_phi %284 + OpBranch %59 + %59 = OpLabel + %285 = OpLoad %v4float %x_254_phi + OpStore %x_GLF_color %285 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %286 +%tint_symbol_1 = OpFunctionParameter %main_out + %290 = OpLabel + %291 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %291 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %293 = OpLabel + %294 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %294 + %295 = OpFunctionCall %void %main_1 + %297 = OpLoad %v4float %x_GLF_color + %298 = OpCompositeConstruct %main_out %297 + %296 = OpFunctionCall %void %tint_symbol_3 %298 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.wgsl new file mode 100644 index 0000000000..b52da64a3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.spvasm.expected.wgsl @@ -0,0 +1,99 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_196 : array; + var x_197 : array; + var x_198 : array; + var x_210 : vec2; + var x_249 : vec4; + var x_251 : vec4; + var x_214_phi : vec2; + var x_251_phi : vec4; + var x_252_phi : bool; + var x_254_phi : vec4; + let x_199 : vec4 = gl_FragCoord; + let x_202 : vec2 = x_6.resolution; + let x_203 : vec2 = (vec2(x_199.x, x_199.y) / x_202); + x_210 = vec2(i32((x_203.x * 256.0)), i32((x_203.y * 256.0))); + switch(0u) { + default: { + x_214_phi = x_210; + loop { + var x_233 : i32; + var x_234 : i32; + var x_235_phi : i32; + let x_214 : vec2 = x_214_phi; + let x_217 : i32 = x_214.y; + x_251_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_252_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + let x_221 : i32 = x_214.x; + x_196 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_223 : i32 = x_196[x_217]; + let x_225 : bool = (x_221 < (x_223 + 15)); + if (x_225) { + x_197 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + } + if (x_225) { + x_233 = x_197[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + let x_235 : i32 = x_235_phi; + let x_237 : bool = (x_221 > (x_235 - 15)); + if (select(x_225, x_237, x_225)) { + x_198 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_243 : i32 = x_198[x_217]; + let x_248 : f32 = ((15.0 - abs(f32((x_221 - x_243)))) * 0.06666667); + x_249 = vec4(x_248, x_248, x_248, 1.0); + x_251_phi = x_249; + x_252_phi = true; + break; + } + var x_215_1 : vec2 = x_214; + x_215_1.y = (x_217 + 1); + let x_215 : vec2 = x_215_1; + + continuing { + x_214_phi = x_215; + } + } + x_251 = x_251_phi; + let x_252 : bool = x_252_phi; + x_254_phi = x_251; + if (x_252) { + break; + } + x_254_phi = vec4(0.0, 0.0, 0.0, 1.0); + } + } + let x_254 : vec4 = x_254_phi; + x_GLF_color = x_254; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl new file mode 100644 index 0000000000..b52da64a3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl @@ -0,0 +1,99 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_196 : array; + var x_197 : array; + var x_198 : array; + var x_210 : vec2; + var x_249 : vec4; + var x_251 : vec4; + var x_214_phi : vec2; + var x_251_phi : vec4; + var x_252_phi : bool; + var x_254_phi : vec4; + let x_199 : vec4 = gl_FragCoord; + let x_202 : vec2 = x_6.resolution; + let x_203 : vec2 = (vec2(x_199.x, x_199.y) / x_202); + x_210 = vec2(i32((x_203.x * 256.0)), i32((x_203.y * 256.0))); + switch(0u) { + default: { + x_214_phi = x_210; + loop { + var x_233 : i32; + var x_234 : i32; + var x_235_phi : i32; + let x_214 : vec2 = x_214_phi; + let x_217 : i32 = x_214.y; + x_251_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_252_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + let x_221 : i32 = x_214.x; + x_196 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_223 : i32 = x_196[x_217]; + let x_225 : bool = (x_221 < (x_223 + 15)); + if (x_225) { + x_197 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + } + if (x_225) { + x_233 = x_197[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + let x_235 : i32 = x_235_phi; + let x_237 : bool = (x_221 > (x_235 - 15)); + if (select(x_225, x_237, x_225)) { + x_198 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_243 : i32 = x_198[x_217]; + let x_248 : f32 = ((15.0 - abs(f32((x_221 - x_243)))) * 0.06666667); + x_249 = vec4(x_248, x_248, x_248, 1.0); + x_251_phi = x_249; + x_252_phi = true; + break; + } + var x_215_1 : vec2 = x_214; + x_215_1.y = (x_217 + 1); + let x_215 : vec2 = x_215_1; + + continuing { + x_214_phi = x_215; + } + } + x_251 = x_251_phi; + let x_252 : bool = x_252_phi; + x_254_phi = x_251; + if (x_252) { + break; + } + x_254_phi = vec4(0.0, 0.0, 0.0, 1.0); + } + } + let x_254 : vec4 = x_254_phi; + x_GLF_color = x_254; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.hlsl new file mode 100644 index 0000000000..0614b0d2a1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.hlsl @@ -0,0 +1,102 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_196[256] = (int[256])0; + int x_197[256] = (int[256])0; + int x_198[256] = (int[256])0; + int2 x_210 = int2(0, 0); + float4 x_249 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_251 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int2 x_214_phi = int2(0, 0); + float4 x_251_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + bool x_252_phi = false; + float4 x_254_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float4 x_199 = gl_FragCoord; + const float2 x_202 = asfloat(x_6[0].xy); + const float2 x_203 = (float2(x_199.x, x_199.y) / x_202); + x_210 = int2(int((x_203.x * 256.0f)), int((x_203.y * 256.0f))); + switch(0u) { + default: { + x_214_phi = x_210; + while (true) { + int x_233 = 0; + int x_234 = 0; + int x_235_phi = 0; + const int2 x_214 = x_214_phi; + const int x_217 = x_214.y; + x_251_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_252_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + const int x_221 = x_214.x; + const int tint_symbol_5[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_196 = tint_symbol_5; + const int x_223 = x_196[x_217]; + const bool x_225 = (x_221 < (x_223 + 15)); + if (x_225) { + const int tint_symbol_6[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_197 = tint_symbol_6; + } + if (x_225) { + x_233 = x_197[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + const bool x_237 = (x_221 > (x_235_phi - 15)); + if ((x_225 ? x_237 : x_225)) { + const int tint_symbol_7[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + x_198 = tint_symbol_7; + const int x_243 = x_198[x_217]; + const float x_248 = ((15.0f - abs(float((x_221 - x_243)))) * 0.06666667f); + x_249 = float4(x_248, x_248, x_248, 1.0f); + x_251_phi = x_249; + x_252_phi = true; + break; + } + int2 x_215_1 = x_214; + x_215_1.y = (x_217 + 1); + const int2 x_215 = x_215_1; + { + x_214_phi = x_215; + } + } + x_251 = x_251_phi; + const bool x_252 = x_252_phi; + x_254_phi = x_251; + if (x_252) { + break; + } + x_254_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + x_GLF_color = x_254_phi; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.msl new file mode 100644 index 0000000000..0b8a803b52 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.msl @@ -0,0 +1,106 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) { + tint_array_wrapper x_196 = {}; + tint_array_wrapper x_197 = {}; + tint_array_wrapper x_198 = {}; + int2 x_210 = 0; + float4 x_249 = 0.0f; + float4 x_251 = 0.0f; + int2 x_214_phi = 0; + float4 x_251_phi = 0.0f; + bool x_252_phi = false; + float4 x_254_phi = 0.0f; + float4 const x_199 = *(tint_symbol_8); + float2 const x_202 = x_6.resolution; + float2 const x_203 = (float2(x_199.x, x_199.y) / x_202); + x_210 = int2(int((x_203.x * 256.0f)), int((x_203.y * 256.0f))); + switch(0u) { + default: { + x_214_phi = x_210; + while (true) { + int x_233 = 0; + int x_234 = 0; + int x_235_phi = 0; + int2 const x_214 = x_214_phi; + int const x_217 = x_214.y; + x_251_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_252_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + int const x_221 = x_214.x; + tint_array_wrapper const tint_symbol_4 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_196 = tint_symbol_4; + int const x_223 = x_196.arr[x_217]; + bool const x_225 = (x_221 < (x_223 + 15)); + if (x_225) { + tint_array_wrapper const tint_symbol_5 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_197 = tint_symbol_5; + } + if (x_225) { + x_233 = x_197.arr[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + int const x_235 = x_235_phi; + bool const x_237 = (x_221 > (x_235 - 15)); + if (select(x_225, x_237, x_225)) { + tint_array_wrapper const tint_symbol_6 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + x_198 = tint_symbol_6; + int const x_243 = x_198.arr[x_217]; + float const x_248 = ((15.0f - fabs(float((x_221 - x_243)))) * 0.06666667f); + x_249 = float4(x_248, x_248, x_248, 1.0f); + x_251_phi = x_249; + x_252_phi = true; + break; + } + int2 x_215_1 = x_214; + x_215_1.y = (x_217 + 1); + int2 const x_215 = x_215_1; + { + x_214_phi = x_215; + } + } + x_251 = x_251_phi; + bool const x_252 = x_252_phi; + x_254_phi = x_251; + if (x_252) { + break; + } + x_254_phi = float4(0.0f, 0.0f, 0.0f, 1.0f); + break; + } + } + float4 const x_254 = x_254_phi; + *(tint_symbol_9) = x_254; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_11}; + tint_symbol_2 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.spvasm new file mode 100644 index 0000000000..ace8cfbd70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.spvasm @@ -0,0 +1,397 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 299 +; Schema: 0 + OpCapability Shader + %263 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_196 "x_196" + OpName %x_197 "x_197" + OpName %x_198 "x_198" + OpName %x_210 "x_210" + OpName %x_249 "x_249" + OpName %x_251 "x_251" + OpName %x_214_phi "x_214_phi" + OpName %x_251_phi "x_251_phi" + OpName %x_252_phi "x_252_phi" + OpName %x_254_phi "x_254_phi" + OpName %x_233 "x_233" + OpName %x_234 "x_234" + OpName %x_235_phi "x_235_phi" + OpName %x_215_1 "x_215_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %25 = OpConstantNull %_arr_int_uint_256 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %31 = OpConstantNull %v2int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 +%_ptr_Function_int = OpTypePointer Function %int + %68 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %74 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %int_256 = OpConstant %int 256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %239 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 + %float_15 = OpConstant %float 15 +%float_0_0666666701 = OpConstant %float 0.0666666701 + %float_1 = OpConstant %float 1 + %true = OpConstantTrue %bool + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %284 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %286 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_196 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_197 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_198 = OpVariable %_ptr_Function__arr_int_uint_256 Function %25 + %x_210 = OpVariable %_ptr_Function_v2int Function %31 + %x_249 = OpVariable %_ptr_Function_v4float Function %5 + %x_251 = OpVariable %_ptr_Function_v4float Function %5 + %x_214_phi = OpVariable %_ptr_Function_v2int Function %31 + %x_251_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_252_phi = OpVariable %_ptr_Function_bool Function %40 + %x_254_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_233 = OpVariable %_ptr_Function_int Function %68 + %x_234 = OpVariable %_ptr_Function_int Function %68 + %x_235_phi = OpVariable %_ptr_Function_int Function %68 + %x_215_1 = OpVariable %_ptr_Function_v2int Function %31 + %42 = OpLoad %v4float %gl_FragCoord + %45 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %46 = OpLoad %v2float %45 + %47 = OpCompositeExtract %float %42 0 + %48 = OpCompositeExtract %float %42 1 + %49 = OpCompositeConstruct %v2float %47 %48 + %50 = OpFDiv %v2float %49 %46 + %52 = OpCompositeExtract %float %50 0 + %54 = OpFMul %float %52 %float_256 + %51 = OpConvertFToS %int %54 + %56 = OpCompositeExtract %float %50 1 + %57 = OpFMul %float %56 %float_256 + %55 = OpConvertFToS %int %57 + %58 = OpCompositeConstruct %v2int %51 %55 + OpStore %x_210 %58 + OpSelectionMerge %59 None + OpSwitch %uint_0 %60 + %60 = OpLabel + %61 = OpLoad %v2int %x_210 + OpStore %x_214_phi %61 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %71 = OpLoad %v2int %x_214_phi + %72 = OpCompositeExtract %int %71 1 + OpStore %x_251_phi %74 + OpStore %x_252_phi %false + %77 = OpINotEqual %bool %72 %int_256 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + OpBranch %78 + %80 = OpLabel + OpBranch %63 + %78 = OpLabel + %81 = OpCompositeExtract %int %71 0 + OpStore %x_196 %239 + %240 = OpAccessChain %_ptr_Function_int %x_196 %72 + %241 = OpLoad %int %240 + %242 = OpIAdd %int %241 %int_15 + %243 = OpSLessThan %bool %81 %242 + OpSelectionMerge %244 None + OpBranchConditional %243 %245 %244 + %245 = OpLabel + OpStore %x_197 %239 + OpBranch %244 + %244 = OpLabel + OpSelectionMerge %246 None + OpBranchConditional %243 %247 %248 + %247 = OpLabel + %249 = OpAccessChain %_ptr_Function_int %x_197 %72 + %250 = OpLoad %int %249 + OpStore %x_233 %250 + %251 = OpLoad %int %x_233 + OpStore %x_235_phi %251 + OpBranch %246 + %248 = OpLabel + OpStore %x_234 %int_0 + %252 = OpLoad %int %x_234 + OpStore %x_235_phi %252 + OpBranch %246 + %246 = OpLabel + %253 = OpLoad %int %x_235_phi + %254 = OpISub %int %253 %int_15 + %255 = OpSGreaterThan %bool %81 %254 + %256 = OpSelect %bool %243 %255 %243 + OpSelectionMerge %257 None + OpBranchConditional %256 %258 %257 + %258 = OpLabel + OpStore %x_198 %239 + %259 = OpAccessChain %_ptr_Function_int %x_198 %72 + %260 = OpLoad %int %259 + %265 = OpISub %int %81 %260 + %264 = OpConvertSToF %float %265 + %262 = OpExtInst %float %263 FAbs %264 + %266 = OpFSub %float %float_15 %262 + %268 = OpFMul %float %266 %float_0_0666666701 + %270 = OpCompositeConstruct %v4float %268 %268 %268 %float_1 + OpStore %x_249 %270 + %271 = OpLoad %v4float %x_249 + OpStore %x_251_phi %271 + OpStore %x_252_phi %true + OpBranch %63 + %257 = OpLabel + OpStore %x_215_1 %71 + %275 = OpAccessChain %_ptr_Function_int %x_215_1 %uint_1 + %277 = OpIAdd %int %72 %int_1 + OpStore %275 %277 + %278 = OpLoad %v2int %x_215_1 + OpBranch %64 + %64 = OpLabel + OpStore %x_214_phi %278 + OpBranch %62 + %63 = OpLabel + %279 = OpLoad %v4float %x_251_phi + OpStore %x_251 %279 + %280 = OpLoad %bool %x_252_phi + %281 = OpLoad %v4float %x_251 + OpStore %x_254_phi %281 + OpSelectionMerge %282 None + OpBranchConditional %280 %283 %282 + %283 = OpLabel + OpBranch %59 + %282 = OpLabel + OpStore %x_254_phi %284 + OpBranch %59 + %59 = OpLabel + %285 = OpLoad %v4float %x_254_phi + OpStore %x_GLF_color %285 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %286 +%tint_symbol_1 = OpFunctionParameter %main_out + %290 = OpLabel + %291 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %291 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %293 = OpLabel + %294 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %294 + %295 = OpFunctionCall %void %main_1 + %297 = OpLoad %v4float %x_GLF_color + %298 = OpCompositeConstruct %main_out %297 + %296 = OpFunctionCall %void %tint_symbol_3 %298 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.wgsl new file mode 100644 index 0000000000..b52da64a3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-O-op-select-to-op-phi/2.wgsl.expected.wgsl @@ -0,0 +1,99 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_196 : array; + var x_197 : array; + var x_198 : array; + var x_210 : vec2; + var x_249 : vec4; + var x_251 : vec4; + var x_214_phi : vec2; + var x_251_phi : vec4; + var x_252_phi : bool; + var x_254_phi : vec4; + let x_199 : vec4 = gl_FragCoord; + let x_202 : vec2 = x_6.resolution; + let x_203 : vec2 = (vec2(x_199.x, x_199.y) / x_202); + x_210 = vec2(i32((x_203.x * 256.0)), i32((x_203.y * 256.0))); + switch(0u) { + default: { + x_214_phi = x_210; + loop { + var x_233 : i32; + var x_234 : i32; + var x_235_phi : i32; + let x_214 : vec2 = x_214_phi; + let x_217 : i32 = x_214.y; + x_251_phi = vec4(0.0, 0.0, 0.0, 0.0); + x_252_phi = false; + if ((x_217 != 256)) { + } else { + break; + } + let x_221 : i32 = x_214.x; + x_196 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_223 : i32 = x_196[x_217]; + let x_225 : bool = (x_221 < (x_223 + 15)); + if (x_225) { + x_197 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + } + if (x_225) { + x_233 = x_197[x_217]; + x_235_phi = x_233; + } else { + x_234 = 0; + x_235_phi = x_234; + } + let x_235 : i32 = x_235_phi; + let x_237 : bool = (x_221 > (x_235 - 15)); + if (select(x_225, x_237, x_225)) { + x_198 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_243 : i32 = x_198[x_217]; + let x_248 : f32 = ((15.0 - abs(f32((x_221 - x_243)))) * 0.06666667); + x_249 = vec4(x_248, x_248, x_248, 1.0); + x_251_phi = x_249; + x_252_phi = true; + break; + } + var x_215_1 : vec2 = x_214; + x_215_1.y = (x_217 + 1); + let x_215 : vec2 = x_215_1; + + continuing { + x_214_phi = x_215; + } + } + x_251 = x_251_phi; + let x_252 : bool = x_252_phi; + x_254_phi = x_251; + if (x_252) { + break; + } + x_254_phi = vec4(0.0, 0.0, 0.0, 1.0); + } + } + let x_254 : vec4 = x_254_phi; + x_GLF_color = x_254; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm new file mode 100644 index 0000000000..315763e8b4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm @@ -0,0 +1,319 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %trace_vi2_ "trace(vi2;" + OpName %pos "pos" + OpName %indexable "indexable" + OpName %indexable_0 "indexable" + OpName %p "p" + OpName %indexable_1 "indexable" + OpName %pos_0 "pos" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %ipos "ipos" + OpName %_GLF_color "_GLF_color" + OpName %param "param" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %23 = OpTypeFunction %v4float %_ptr_Function_v2int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %189 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 +%_ptr_Function_float = OpTypePointer Function %float + %float_15 = OpConstant %float 15 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %196 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %17 + %204 = OpLabel + %pos_0 = OpVariable %_ptr_Function_v2float Function + %ipos = OpVariable %_ptr_Function_v2int Function + %param = OpVariable %_ptr_Function_v2int Function + %205 = OpLoad %v4float %gl_FragCoord + %206 = OpVectorShuffle %v2float %205 %205 0 1 + %207 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %208 = OpLoad %v2float %207 + %209 = OpFDiv %v2float %206 %208 + OpStore %pos_0 %209 + %210 = OpAccessChain %_ptr_Function_float %pos_0 %uint_0 + %211 = OpLoad %float %210 + %212 = OpFMul %float %211 %float_256 + %213 = OpConvertFToS %int %212 + %214 = OpAccessChain %_ptr_Function_float %pos_0 %uint_1 + %215 = OpLoad %float %214 + %216 = OpFMul %float %215 %float_256 + %217 = OpConvertFToS %int %216 + %218 = OpCompositeConstruct %v2int %213 %217 + OpStore %ipos %218 + %219 = OpLoad %v2int %ipos + OpStore %param %219 + %220 = OpFunctionCall %v4float %trace_vi2_ %param + OpStore %_GLF_color %220 + OpReturn + OpFunctionEnd + %trace_vi2_ = OpFunction %v4float None %23 + %pos = OpFunctionParameter %_ptr_Function_v2int + %221 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_int_uint_256 Function +%indexable_0 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %p = OpVariable %_ptr_Function_float Function +%indexable_1 = OpVariable %_ptr_Function__arr_int_uint_256 Function + OpBranch %222 + %222 = OpLabel + OpLoopMerge %223 %224 None + OpBranch %225 + %225 = OpLabel + %226 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %227 = OpLoad %int %226 + %228 = OpINotEqual %bool %227 %int_256 + OpBranchConditional %228 %229 %223 + %229 = OpLabel + %230 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %231 = OpLoad %int %230 + %232 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %233 = OpLoad %int %232 + OpStore %indexable %189 + %234 = OpAccessChain %_ptr_Function_int %indexable %233 + %235 = OpLoad %int %234 + %236 = OpIAdd %int %235 %int_15 + %237 = OpSLessThan %bool %231 %236 + OpSelectionMerge %238 None + OpBranchConditional %237 %239 %238 + %239 = OpLabel + %240 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %241 = OpLoad %int %240 + %242 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %243 = OpLoad %int %242 + OpStore %indexable_0 %189 + %244 = OpAccessChain %_ptr_Function_int %indexable_0 %243 + %245 = OpLoad %int %244 + %246 = OpISub %int %245 %int_15 + %247 = OpSGreaterThan %bool %241 %246 + OpBranch %238 + %238 = OpLabel + %248 = OpPhi %bool %237 %229 %247 %239 + OpSelectionMerge %249 None + OpBranchConditional %248 %250 %249 + %250 = OpLabel + %251 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %252 = OpLoad %int %251 + %253 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %254 = OpLoad %int %253 + OpStore %indexable_1 %189 + %255 = OpAccessChain %_ptr_Function_int %indexable_1 %254 + %256 = OpLoad %int %255 + %257 = OpISub %int %252 %256 + %258 = OpConvertSToF %float %257 + %259 = OpExtInst %float %1 FAbs %258 + %260 = OpFSub %float %float_15 %259 + %261 = OpFDiv %float %260 %float_15 + OpStore %p %261 + %262 = OpLoad %float %p + %263 = OpLoad %float %p + %264 = OpLoad %float %p + %265 = OpCompositeConstruct %v4float %262 %263 %264 %float_1 + OpReturnValue %265 + %249 = OpLabel + %266 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %267 = OpLoad %int %266 + %268 = OpIAdd %int %267 %int_1 + OpStore %266 %268 + OpBranch %224 + %224 = OpLabel + OpBranch %222 + %223 = OpLabel + OpReturnValue %196 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..7b7c9a4193 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.hlsl @@ -0,0 +1,84 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float4 trace_vi2_(inout int2 pos) { + int indexable[256] = (int[256])0; + int indexable_1[256] = (int[256])0; + float p = 0.0f; + int indexable_2[256] = (int[256])0; + while (true) { + bool x_247 = false; + bool x_248_phi = false; + const int x_227 = pos.y; + if ((x_227 != 256)) { + } else { + break; + } + const int x_231 = pos.x; + const int x_233 = pos.y; + const int tint_symbol_5[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + indexable = tint_symbol_5; + const int x_235 = indexable[x_233]; + const bool x_237 = (x_231 < (x_235 + 15)); + x_248_phi = x_237; + if (x_237) { + const int x_241 = pos.x; + const int x_243 = pos.y; + const int tint_symbol_6[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + indexable_1 = tint_symbol_6; + const int x_245 = indexable_1[x_243]; + x_247 = (x_241 > (x_245 - 15)); + x_248_phi = x_247; + } + if (x_248_phi) { + const int x_252 = pos.x; + const int x_254 = pos.y; + const int tint_symbol_7[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + indexable_2 = tint_symbol_7; + const int x_256 = indexable_2[x_254]; + p = ((15.0f - abs(float((x_252 - x_256)))) / 15.0f); + return float4(p, p, p, 1.0f); + } + const int x_267 = pos.y; + pos.y = (x_267 + 1); + } + return float4(0.0f, 0.0f, 0.0f, 1.0f); +} + +void main_1() { + float2 pos_1 = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int2 param = int2(0, 0); + const float4 x_205 = gl_FragCoord; + const float2 x_208 = asfloat(x_13[0].xy); + pos_1 = (float2(x_205.x, x_205.y) / x_208); + const float x_211 = pos_1.x; + const float x_215 = pos_1.y; + ipos = int2(int((x_211 * 256.0f)), int((x_215 * 256.0f))); + param = ipos; + const float4 x_220 = trace_vi2_(param); + x_GLF_color = x_220; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.msl new file mode 100644 index 0000000000..f95df19c11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float4 trace_vi2_(thread int2* const pos) { + tint_array_wrapper indexable = {}; + tint_array_wrapper indexable_1 = {}; + float p = 0.0f; + tint_array_wrapper indexable_2 = {}; + while (true) { + bool x_247 = false; + bool x_248_phi = false; + int const x_227 = (*(pos)).y; + if ((x_227 != 256)) { + } else { + break; + } + int const x_231 = (*(pos)).x; + int const x_233 = (*(pos)).y; + tint_array_wrapper const tint_symbol_4 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + indexable = tint_symbol_4; + int const x_235 = indexable.arr[x_233]; + bool const x_237 = (x_231 < (x_235 + 15)); + x_248_phi = x_237; + if (x_237) { + int const x_241 = (*(pos)).x; + int const x_243 = (*(pos)).y; + tint_array_wrapper const tint_symbol_5 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + indexable_1 = tint_symbol_5; + int const x_245 = indexable_1.arr[x_243]; + x_247 = (x_241 > (x_245 - 15)); + x_248_phi = x_247; + } + bool const x_248 = x_248_phi; + if (x_248) { + int const x_252 = (*(pos)).x; + int const x_254 = (*(pos)).y; + tint_array_wrapper const tint_symbol_6 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + indexable_2 = tint_symbol_6; + int const x_256 = indexable_2.arr[x_254]; + p = ((15.0f - fabs(float((x_252 - x_256)))) / 15.0f); + float const x_262 = p; + float const x_263 = p; + float const x_264 = p; + return float4(x_262, x_263, x_264, 1.0f); + } + int const x_267 = (*(pos)).y; + (*(pos)).y = (x_267 + 1); + } + return float4(0.0f, 0.0f, 0.0f, 1.0f); +} + +void main_1(constant buf0& x_13, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) { + float2 pos_1 = 0.0f; + int2 ipos = 0; + int2 param = 0; + float4 const x_205 = *(tint_symbol_8); + float2 const x_208 = x_13.resolution; + pos_1 = (float2(x_205.x, x_205.y) / x_208); + float const x_211 = pos_1.x; + float const x_215 = pos_1.y; + ipos = int2(int((x_211 * 256.0f)), int((x_215 * 256.0f))); + int2 const x_219 = ipos; + param = x_219; + float4 const x_220 = trace_vi2_(&(param)); + *(tint_symbol_9) = x_220; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]]) { + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(x_13, &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_11}; + tint_symbol_2 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..1bc7c3e45e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.spvasm @@ -0,0 +1,378 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 310 +; Schema: 0 + OpCapability Shader + %247 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_13 "x_13" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %trace_vi2_ "trace_vi2_" + OpName %pos "pos" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %p "p" + OpName %indexable_2 "indexable_2" + OpName %x_247 "x_247" + OpName %x_248_phi "x_248_phi" + OpName %main_1 "main_1" + OpName %pos_1 "pos_1" + OpName %ipos "ipos" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %15 = OpTypeFunction %v4float %_ptr_Function_v2int + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %27 = OpConstantNull %_arr_int_uint_256 +%_ptr_Function_float = OpTypePointer Function %float + %31 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %uint_0 = OpConstant %uint 0 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %216 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 + %float_15 = OpConstant %float 15 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %265 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %void = OpTypeVoid + %266 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %272 = OpConstantNull %v2float + %274 = OpConstantNull %v2int +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 + %main_out = OpTypeStruct %v4float + %297 = OpTypeFunction %void %main_out + %trace_vi2_ = OpFunction %v4float None %15 + %pos = OpFunctionParameter %_ptr_Function_v2int + %21 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_int_uint_256 Function %27 +%indexable_1 = OpVariable %_ptr_Function__arr_int_uint_256 Function %27 + %p = OpVariable %_ptr_Function_float Function %31 +%indexable_2 = OpVariable %_ptr_Function__arr_int_uint_256 Function %27 + %x_247 = OpVariable %_ptr_Function_bool Function %40 + %x_248_phi = OpVariable %_ptr_Function_bool Function %40 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %45 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %46 = OpLoad %int %45 + %48 = OpINotEqual %bool %46 %int_256 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %34 + %49 = OpLabel + %54 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %55 = OpLoad %int %54 + %57 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %58 = OpLoad %int %57 + OpStore %indexable %216 + %217 = OpAccessChain %_ptr_Function_int %indexable %58 + %218 = OpLoad %int %217 + %219 = OpIAdd %int %218 %int_15 + %220 = OpSLessThan %bool %55 %219 + OpStore %x_248_phi %220 + OpSelectionMerge %221 None + OpBranchConditional %220 %222 %221 + %222 = OpLabel + %224 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %225 = OpLoad %int %224 + %227 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %228 = OpLoad %int %227 + OpStore %indexable_1 %216 + %229 = OpAccessChain %_ptr_Function_int %indexable_1 %228 + %230 = OpLoad %int %229 + %231 = OpISub %int %230 %int_15 + %232 = OpSGreaterThan %bool %225 %231 + OpStore %x_247 %232 + %233 = OpLoad %bool %x_247 + OpStore %x_248_phi %233 + OpBranch %221 + %221 = OpLabel + %234 = OpLoad %bool %x_248_phi + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %235 + %236 = OpLabel + %238 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %239 = OpLoad %int %238 + %241 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %242 = OpLoad %int %241 + OpStore %indexable_2 %216 + %243 = OpAccessChain %_ptr_Function_int %indexable_2 %242 + %244 = OpLoad %int %243 + %249 = OpISub %int %239 %244 + %248 = OpConvertSToF %float %249 + %246 = OpExtInst %float %247 FAbs %248 + %250 = OpFSub %float %float_15 %246 + %251 = OpFDiv %float %250 %float_15 + OpStore %p %251 + %252 = OpLoad %float %p + %253 = OpLoad %float %p + %254 = OpLoad %float %p + %256 = OpCompositeConstruct %v4float %252 %253 %254 %float_1 + OpReturnValue %256 + %235 = OpLabel + %258 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %259 = OpLoad %int %258 + %261 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %263 = OpIAdd %int %259 %int_1 + OpStore %261 %263 + OpBranch %35 + %35 = OpLabel + OpBranch %33 + %34 = OpLabel + OpReturnValue %265 + OpFunctionEnd + %main_1 = OpFunction %void None %266 + %269 = OpLabel + %pos_1 = OpVariable %_ptr_Function_v2float Function %272 + %ipos = OpVariable %_ptr_Function_v2int Function %274 + %param = OpVariable %_ptr_Function_v2int Function %274 + %276 = OpLoad %v4float %gl_FragCoord + %278 = OpAccessChain %_ptr_Uniform_v2float %x_13 %uint_0 + %279 = OpLoad %v2float %278 + %280 = OpCompositeExtract %float %276 0 + %281 = OpCompositeExtract %float %276 1 + %282 = OpCompositeConstruct %v2float %280 %281 + %283 = OpFDiv %v2float %282 %279 + OpStore %pos_1 %283 + %284 = OpAccessChain %_ptr_Function_float %pos_1 %uint_0 + %285 = OpLoad %float %284 + %286 = OpAccessChain %_ptr_Function_float %pos_1 %uint_1 + %287 = OpLoad %float %286 + %290 = OpFMul %float %285 %float_256 + %288 = OpConvertFToS %int %290 + %292 = OpFMul %float %287 %float_256 + %291 = OpConvertFToS %int %292 + %293 = OpCompositeConstruct %v2int %288 %291 + OpStore %ipos %293 + %294 = OpLoad %v2int %ipos + OpStore %param %294 + %295 = OpFunctionCall %v4float %trace_vi2_ %param + OpStore %x_GLF_color %295 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %297 +%tint_symbol_1 = OpFunctionParameter %main_out + %301 = OpLabel + %302 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %302 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %266 + %304 = OpLabel + %305 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %305 + %306 = OpFunctionCall %void %main_1 + %308 = OpLoad %v4float %x_GLF_color + %309 = OpCompositeConstruct %main_out %308 + %307 = OpFunctionCall %void %tint_symbol_3 %309 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..5e10336f52 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.spvasm.expected.wgsl @@ -0,0 +1,85 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_13 : buf0; + +var x_GLF_color : vec4; + +fn trace_vi2_(pos : ptr>) -> vec4 { + var indexable : array; + var indexable_1 : array; + var p : f32; + var indexable_2 : array; + loop { + var x_247 : bool; + var x_248_phi : bool; + let x_227 : i32 = (*(pos)).y; + if ((x_227 != 256)) { + } else { + break; + } + let x_231 : i32 = (*(pos)).x; + let x_233 : i32 = (*(pos)).y; + indexable = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_235 : i32 = indexable[x_233]; + let x_237 : bool = (x_231 < (x_235 + 15)); + x_248_phi = x_237; + if (x_237) { + let x_241 : i32 = (*(pos)).x; + let x_243 : i32 = (*(pos)).y; + indexable_1 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_245 : i32 = indexable_1[x_243]; + x_247 = (x_241 > (x_245 - 15)); + x_248_phi = x_247; + } + let x_248 : bool = x_248_phi; + if (x_248) { + let x_252 : i32 = (*(pos)).x; + let x_254 : i32 = (*(pos)).y; + indexable_2 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_256 : i32 = indexable_2[x_254]; + p = ((15.0 - abs(f32((x_252 - x_256)))) / 15.0); + let x_262 : f32 = p; + let x_263 : f32 = p; + let x_264 : f32 = p; + return vec4(x_262, x_263, x_264, 1.0); + } + let x_266 : ptr = &((*(pos)).y); + let x_267 : i32 = *(x_266); + *(x_266) = (x_267 + 1); + } + return vec4(0.0, 0.0, 0.0, 1.0); +} + +fn main_1() { + var pos_1 : vec2; + var ipos : vec2; + var param : vec2; + let x_205 : vec4 = gl_FragCoord; + let x_208 : vec2 = x_13.resolution; + pos_1 = (vec2(x_205.x, x_205.y) / x_208); + let x_211 : f32 = pos_1.x; + let x_215 : f32 = pos_1.y; + ipos = vec2(i32((x_211 * 256.0)), i32((x_215 * 256.0))); + let x_219 : vec2 = ipos; + param = x_219; + let x_220 : vec4 = trace_vi2_(&(param)); + x_GLF_color = x_220; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl new file mode 100644 index 0000000000..5e10336f52 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl @@ -0,0 +1,85 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_13 : buf0; + +var x_GLF_color : vec4; + +fn trace_vi2_(pos : ptr>) -> vec4 { + var indexable : array; + var indexable_1 : array; + var p : f32; + var indexable_2 : array; + loop { + var x_247 : bool; + var x_248_phi : bool; + let x_227 : i32 = (*(pos)).y; + if ((x_227 != 256)) { + } else { + break; + } + let x_231 : i32 = (*(pos)).x; + let x_233 : i32 = (*(pos)).y; + indexable = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_235 : i32 = indexable[x_233]; + let x_237 : bool = (x_231 < (x_235 + 15)); + x_248_phi = x_237; + if (x_237) { + let x_241 : i32 = (*(pos)).x; + let x_243 : i32 = (*(pos)).y; + indexable_1 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_245 : i32 = indexable_1[x_243]; + x_247 = (x_241 > (x_245 - 15)); + x_248_phi = x_247; + } + let x_248 : bool = x_248_phi; + if (x_248) { + let x_252 : i32 = (*(pos)).x; + let x_254 : i32 = (*(pos)).y; + indexable_2 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_256 : i32 = indexable_2[x_254]; + p = ((15.0 - abs(f32((x_252 - x_256)))) / 15.0); + let x_262 : f32 = p; + let x_263 : f32 = p; + let x_264 : f32 = p; + return vec4(x_262, x_263, x_264, 1.0); + } + let x_266 : ptr = &((*(pos)).y); + let x_267 : i32 = *(x_266); + *(x_266) = (x_267 + 1); + } + return vec4(0.0, 0.0, 0.0, 1.0); +} + +fn main_1() { + var pos_1 : vec2; + var ipos : vec2; + var param : vec2; + let x_205 : vec4 = gl_FragCoord; + let x_208 : vec2 = x_13.resolution; + pos_1 = (vec2(x_205.x, x_205.y) / x_208); + let x_211 : f32 = pos_1.x; + let x_215 : f32 = pos_1.y; + ipos = vec2(i32((x_211 * 256.0)), i32((x_215 * 256.0))); + let x_219 : vec2 = ipos; + param = x_219; + let x_220 : vec4 = trace_vi2_(&(param)); + x_GLF_color = x_220; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..7b7c9a4193 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.hlsl @@ -0,0 +1,84 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float4 trace_vi2_(inout int2 pos) { + int indexable[256] = (int[256])0; + int indexable_1[256] = (int[256])0; + float p = 0.0f; + int indexable_2[256] = (int[256])0; + while (true) { + bool x_247 = false; + bool x_248_phi = false; + const int x_227 = pos.y; + if ((x_227 != 256)) { + } else { + break; + } + const int x_231 = pos.x; + const int x_233 = pos.y; + const int tint_symbol_5[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + indexable = tint_symbol_5; + const int x_235 = indexable[x_233]; + const bool x_237 = (x_231 < (x_235 + 15)); + x_248_phi = x_237; + if (x_237) { + const int x_241 = pos.x; + const int x_243 = pos.y; + const int tint_symbol_6[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + indexable_1 = tint_symbol_6; + const int x_245 = indexable_1[x_243]; + x_247 = (x_241 > (x_245 - 15)); + x_248_phi = x_247; + } + if (x_248_phi) { + const int x_252 = pos.x; + const int x_254 = pos.y; + const int tint_symbol_7[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + indexable_2 = tint_symbol_7; + const int x_256 = indexable_2[x_254]; + p = ((15.0f - abs(float((x_252 - x_256)))) / 15.0f); + return float4(p, p, p, 1.0f); + } + const int x_267 = pos.y; + pos.y = (x_267 + 1); + } + return float4(0.0f, 0.0f, 0.0f, 1.0f); +} + +void main_1() { + float2 pos_1 = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int2 param = int2(0, 0); + const float4 x_205 = gl_FragCoord; + const float2 x_208 = asfloat(x_13[0].xy); + pos_1 = (float2(x_205.x, x_205.y) / x_208); + const float x_211 = pos_1.x; + const float x_215 = pos_1.y; + ipos = int2(int((x_211 * 256.0f)), int((x_215 * 256.0f))); + param = ipos; + const float4 x_220 = trace_vi2_(param); + x_GLF_color = x_220; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_8 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.msl new file mode 100644 index 0000000000..f95df19c11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.msl @@ -0,0 +1,91 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float4 trace_vi2_(thread int2* const pos) { + tint_array_wrapper indexable = {}; + tint_array_wrapper indexable_1 = {}; + float p = 0.0f; + tint_array_wrapper indexable_2 = {}; + while (true) { + bool x_247 = false; + bool x_248_phi = false; + int const x_227 = (*(pos)).y; + if ((x_227 != 256)) { + } else { + break; + } + int const x_231 = (*(pos)).x; + int const x_233 = (*(pos)).y; + tint_array_wrapper const tint_symbol_4 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + indexable = tint_symbol_4; + int const x_235 = indexable.arr[x_233]; + bool const x_237 = (x_231 < (x_235 + 15)); + x_248_phi = x_237; + if (x_237) { + int const x_241 = (*(pos)).x; + int const x_243 = (*(pos)).y; + tint_array_wrapper const tint_symbol_5 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + indexable_1 = tint_symbol_5; + int const x_245 = indexable_1.arr[x_243]; + x_247 = (x_241 > (x_245 - 15)); + x_248_phi = x_247; + } + bool const x_248 = x_248_phi; + if (x_248) { + int const x_252 = (*(pos)).x; + int const x_254 = (*(pos)).y; + tint_array_wrapper const tint_symbol_6 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + indexable_2 = tint_symbol_6; + int const x_256 = indexable_2.arr[x_254]; + p = ((15.0f - fabs(float((x_252 - x_256)))) / 15.0f); + float const x_262 = p; + float const x_263 = p; + float const x_264 = p; + return float4(x_262, x_263, x_264, 1.0f); + } + int const x_267 = (*(pos)).y; + (*(pos)).y = (x_267 + 1); + } + return float4(0.0f, 0.0f, 0.0f, 1.0f); +} + +void main_1(constant buf0& x_13, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) { + float2 pos_1 = 0.0f; + int2 ipos = 0; + int2 param = 0; + float4 const x_205 = *(tint_symbol_8); + float2 const x_208 = x_13.resolution; + pos_1 = (float2(x_205.x, x_205.y) / x_208); + float const x_211 = pos_1.x; + float const x_215 = pos_1.y; + ipos = int2(int((x_211 * 256.0f)), int((x_215 * 256.0f))); + int2 const x_219 = ipos; + param = x_219; + float4 const x_220 = trace_vi2_(&(param)); + *(tint_symbol_9) = x_220; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]]) { + thread float4 tint_symbol_10 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(x_13, &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_11}; + tint_symbol_2 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..1bc7c3e45e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.spvasm @@ -0,0 +1,378 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 310 +; Schema: 0 + OpCapability Shader + %247 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_13 "x_13" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %trace_vi2_ "trace_vi2_" + OpName %pos "pos" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %p "p" + OpName %indexable_2 "indexable_2" + OpName %x_247 "x_247" + OpName %x_248_phi "x_248_phi" + OpName %main_1 "main_1" + OpName %pos_1 "pos_1" + OpName %ipos "ipos" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %15 = OpTypeFunction %v4float %_ptr_Function_v2int + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %27 = OpConstantNull %_arr_int_uint_256 +%_ptr_Function_float = OpTypePointer Function %float + %31 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %uint_0 = OpConstant %uint 0 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %216 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 + %float_15 = OpConstant %float 15 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %265 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %void = OpTypeVoid + %266 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %272 = OpConstantNull %v2float + %274 = OpConstantNull %v2int +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 + %main_out = OpTypeStruct %v4float + %297 = OpTypeFunction %void %main_out + %trace_vi2_ = OpFunction %v4float None %15 + %pos = OpFunctionParameter %_ptr_Function_v2int + %21 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_int_uint_256 Function %27 +%indexable_1 = OpVariable %_ptr_Function__arr_int_uint_256 Function %27 + %p = OpVariable %_ptr_Function_float Function %31 +%indexable_2 = OpVariable %_ptr_Function__arr_int_uint_256 Function %27 + %x_247 = OpVariable %_ptr_Function_bool Function %40 + %x_248_phi = OpVariable %_ptr_Function_bool Function %40 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %45 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %46 = OpLoad %int %45 + %48 = OpINotEqual %bool %46 %int_256 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %34 + %49 = OpLabel + %54 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %55 = OpLoad %int %54 + %57 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %58 = OpLoad %int %57 + OpStore %indexable %216 + %217 = OpAccessChain %_ptr_Function_int %indexable %58 + %218 = OpLoad %int %217 + %219 = OpIAdd %int %218 %int_15 + %220 = OpSLessThan %bool %55 %219 + OpStore %x_248_phi %220 + OpSelectionMerge %221 None + OpBranchConditional %220 %222 %221 + %222 = OpLabel + %224 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %225 = OpLoad %int %224 + %227 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %228 = OpLoad %int %227 + OpStore %indexable_1 %216 + %229 = OpAccessChain %_ptr_Function_int %indexable_1 %228 + %230 = OpLoad %int %229 + %231 = OpISub %int %230 %int_15 + %232 = OpSGreaterThan %bool %225 %231 + OpStore %x_247 %232 + %233 = OpLoad %bool %x_247 + OpStore %x_248_phi %233 + OpBranch %221 + %221 = OpLabel + %234 = OpLoad %bool %x_248_phi + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %235 + %236 = OpLabel + %238 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %239 = OpLoad %int %238 + %241 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %242 = OpLoad %int %241 + OpStore %indexable_2 %216 + %243 = OpAccessChain %_ptr_Function_int %indexable_2 %242 + %244 = OpLoad %int %243 + %249 = OpISub %int %239 %244 + %248 = OpConvertSToF %float %249 + %246 = OpExtInst %float %247 FAbs %248 + %250 = OpFSub %float %float_15 %246 + %251 = OpFDiv %float %250 %float_15 + OpStore %p %251 + %252 = OpLoad %float %p + %253 = OpLoad %float %p + %254 = OpLoad %float %p + %256 = OpCompositeConstruct %v4float %252 %253 %254 %float_1 + OpReturnValue %256 + %235 = OpLabel + %258 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %259 = OpLoad %int %258 + %261 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %263 = OpIAdd %int %259 %int_1 + OpStore %261 %263 + OpBranch %35 + %35 = OpLabel + OpBranch %33 + %34 = OpLabel + OpReturnValue %265 + OpFunctionEnd + %main_1 = OpFunction %void None %266 + %269 = OpLabel + %pos_1 = OpVariable %_ptr_Function_v2float Function %272 + %ipos = OpVariable %_ptr_Function_v2int Function %274 + %param = OpVariable %_ptr_Function_v2int Function %274 + %276 = OpLoad %v4float %gl_FragCoord + %278 = OpAccessChain %_ptr_Uniform_v2float %x_13 %uint_0 + %279 = OpLoad %v2float %278 + %280 = OpCompositeExtract %float %276 0 + %281 = OpCompositeExtract %float %276 1 + %282 = OpCompositeConstruct %v2float %280 %281 + %283 = OpFDiv %v2float %282 %279 + OpStore %pos_1 %283 + %284 = OpAccessChain %_ptr_Function_float %pos_1 %uint_0 + %285 = OpLoad %float %284 + %286 = OpAccessChain %_ptr_Function_float %pos_1 %uint_1 + %287 = OpLoad %float %286 + %290 = OpFMul %float %285 %float_256 + %288 = OpConvertFToS %int %290 + %292 = OpFMul %float %287 %float_256 + %291 = OpConvertFToS %int %292 + %293 = OpCompositeConstruct %v2int %288 %291 + OpStore %ipos %293 + %294 = OpLoad %v2int %ipos + OpStore %param %294 + %295 = OpFunctionCall %v4float %trace_vi2_ %param + OpStore %x_GLF_color %295 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %297 +%tint_symbol_1 = OpFunctionParameter %main_out + %301 = OpLabel + %302 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %302 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %266 + %304 = OpLabel + %305 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %305 + %306 = OpFunctionCall %void %main_1 + %308 = OpLoad %v4float %x_GLF_color + %309 = OpCompositeConstruct %main_out %308 + %307 = OpFunctionCall %void %tint_symbol_3 %309 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..5e10336f52 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/0.wgsl.expected.wgsl @@ -0,0 +1,85 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_13 : buf0; + +var x_GLF_color : vec4; + +fn trace_vi2_(pos : ptr>) -> vec4 { + var indexable : array; + var indexable_1 : array; + var p : f32; + var indexable_2 : array; + loop { + var x_247 : bool; + var x_248_phi : bool; + let x_227 : i32 = (*(pos)).y; + if ((x_227 != 256)) { + } else { + break; + } + let x_231 : i32 = (*(pos)).x; + let x_233 : i32 = (*(pos)).y; + indexable = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_235 : i32 = indexable[x_233]; + let x_237 : bool = (x_231 < (x_235 + 15)); + x_248_phi = x_237; + if (x_237) { + let x_241 : i32 = (*(pos)).x; + let x_243 : i32 = (*(pos)).y; + indexable_1 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_245 : i32 = indexable_1[x_243]; + x_247 = (x_241 > (x_245 - 15)); + x_248_phi = x_247; + } + let x_248 : bool = x_248_phi; + if (x_248) { + let x_252 : i32 = (*(pos)).x; + let x_254 : i32 = (*(pos)).y; + indexable_2 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_256 : i32 = indexable_2[x_254]; + p = ((15.0 - abs(f32((x_252 - x_256)))) / 15.0); + let x_262 : f32 = p; + let x_263 : f32 = p; + let x_264 : f32 = p; + return vec4(x_262, x_263, x_264, 1.0); + } + let x_266 : ptr = &((*(pos)).y); + let x_267 : i32 = *(x_266); + *(x_266) = (x_267 + 1); + } + return vec4(0.0, 0.0, 0.0, 1.0); +} + +fn main_1() { + var pos_1 : vec2; + var ipos : vec2; + var param : vec2; + let x_205 : vec4 = gl_FragCoord; + let x_208 : vec2 = x_13.resolution; + pos_1 = (vec2(x_205.x, x_205.y) / x_208); + let x_211 : f32 = pos_1.x; + let x_215 : f32 = pos_1.y; + ipos = vec2(i32((x_211 * 256.0)), i32((x_215 * 256.0))); + let x_219 : vec2 = ipos; + param = x_219; + let x_220 : vec4 = trace_vi2_(&(param)); + x_GLF_color = x_220; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm new file mode 100644 index 0000000000..6ef1627084 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm @@ -0,0 +1,327 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %trace_vi2_ "trace(vi2;" + OpName %pos "pos" + OpName %indexable "indexable" + OpName %indexable_0 "indexable" + OpName %p "p" + OpName %indexable_1 "indexable" + OpName %pos_0 "pos" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %ipos "ipos" + OpName %_GLF_color "_GLF_color" + OpName %param "param" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %23 = OpTypeFunction %v4float %_ptr_Function_v2int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %189 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 +%_ptr_Function_float = OpTypePointer Function %float + %float_15 = OpConstant %float 15 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %196 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_0_0 = OpConstant %int 0 + %205 = OpConstantComposite %_arr_int_uint_256 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 %int_0_0 + %main = OpFunction %void None %17 + %206 = OpLabel + %pos_0 = OpVariable %_ptr_Function_v2float Function + %ipos = OpVariable %_ptr_Function_v2int Function + %param = OpVariable %_ptr_Function_v2int Function + %207 = OpLoad %v4float %gl_FragCoord + %208 = OpVectorShuffle %v2float %207 %207 0 1 + %209 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %210 = OpLoad %v2float %209 + %211 = OpFDiv %v2float %208 %210 + OpStore %pos_0 %211 + %212 = OpAccessChain %_ptr_Function_float %pos_0 %uint_0 + %213 = OpLoad %float %212 + %214 = OpFMul %float %213 %float_256 + %215 = OpConvertFToS %int %214 + %216 = OpAccessChain %_ptr_Function_float %pos_0 %uint_1 + %217 = OpLoad %float %216 + %218 = OpFMul %float %217 %float_256 + %219 = OpConvertFToS %int %218 + %220 = OpCompositeConstruct %v2int %215 %219 + OpStore %ipos %220 + %221 = OpLoad %v2int %ipos + OpStore %param %221 + %222 = OpFunctionCall %v4float %trace_vi2_ %param + OpStore %_GLF_color %222 + OpReturn + OpFunctionEnd + %trace_vi2_ = OpFunction %v4float None %23 + %pos = OpFunctionParameter %_ptr_Function_v2int + %223 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_int_uint_256 Function +%indexable_0 = OpVariable %_ptr_Function__arr_int_uint_256 Function + %p = OpVariable %_ptr_Function_float Function +%indexable_1 = OpVariable %_ptr_Function__arr_int_uint_256 Function + OpBranch %224 + %224 = OpLabel + OpLoopMerge %225 %226 None + OpBranch %227 + %227 = OpLabel + %228 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %229 = OpLoad %int %228 + %230 = OpINotEqual %bool %229 %int_256 + OpBranchConditional %230 %231 %225 + %231 = OpLabel + %232 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %233 = OpLoad %int %232 + %234 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %235 = OpLoad %int %234 + OpStore %indexable %189 + %236 = OpAccessChain %_ptr_Function_int %indexable %235 + %237 = OpLoad %int %236 + %238 = OpLoad %_arr_int_uint_256 %indexable + OpStore %indexable %205 + %239 = OpLoad %int %228 + OpStore %228 %int_0_0 + OpStore %228 %239 + OpStore %indexable %238 Volatile|Nontemporal + %240 = OpIAdd %int %237 %int_15 + %241 = OpSLessThan %bool %233 %240 + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %242 + %243 = OpLabel + %244 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %245 = OpLoad %int %244 + %246 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %247 = OpLoad %int %246 + OpStore %indexable_0 %189 + %248 = OpAccessChain %_ptr_Function_int %indexable_0 %247 + %249 = OpLoad %int %248 + %250 = OpISub %int %249 %int_15 + %251 = OpSGreaterThan %bool %245 %250 + OpBranch %242 + %242 = OpLabel + %252 = OpPhi %bool %241 %231 %251 %243 + OpSelectionMerge %253 None + OpBranchConditional %252 %254 %253 + %254 = OpLabel + %255 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %256 = OpLoad %int %255 + %257 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %258 = OpLoad %int %257 + OpStore %indexable_1 %189 + %259 = OpAccessChain %_ptr_Function_int %indexable_1 %258 + %260 = OpLoad %int %259 + %261 = OpISub %int %256 %260 + %262 = OpConvertSToF %float %261 + %263 = OpExtInst %float %1 FAbs %262 + %264 = OpFSub %float %float_15 %263 + %265 = OpFDiv %float %264 %float_15 + OpStore %p %265 + %266 = OpLoad %float %p + %267 = OpLoad %float %p + %268 = OpLoad %float %p + %269 = OpCompositeConstruct %v4float %266 %267 %268 %float_1 + OpReturnValue %269 + %253 = OpLabel + %270 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %271 = OpLoad %int %270 + %272 = OpIAdd %int %271 %int_1 + OpStore %270 %272 + OpBranch %226 + %226 = OpLabel + OpBranch %224 + %225 = OpLabel + OpReturnValue %196 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..f284cbd299 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.hlsl @@ -0,0 +1,91 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float4 trace_vi2_(inout int2 pos) { + int indexable[256] = (int[256])0; + int indexable_1[256] = (int[256])0; + float p = 0.0f; + int indexable_2[256] = (int[256])0; + while (true) { + bool x_251 = false; + bool x_252_phi = false; + const int x_229 = pos.y; + if ((x_229 != 256)) { + } else { + break; + } + const int x_233 = pos.x; + const int x_235 = pos.y; + const int tint_symbol_5[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + indexable = tint_symbol_5; + const int x_237 = indexable[x_235]; + const int x_238[256] = indexable; + const int tint_symbol_6[256] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + indexable = tint_symbol_6; + const int x_239 = pos.y; + pos.y = 0; + pos.y = x_239; + indexable = x_238; + const bool x_241 = (x_233 < (x_237 + 15)); + x_252_phi = x_241; + if (x_241) { + const int x_245 = pos.x; + const int x_247 = pos.y; + const int tint_symbol_7[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + indexable_1 = tint_symbol_7; + const int x_249 = indexable_1[x_247]; + x_251 = (x_245 > (x_249 - 15)); + x_252_phi = x_251; + } + if (x_252_phi) { + const int x_256 = pos.x; + const int x_258 = pos.y; + const int tint_symbol_8[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + indexable_2 = tint_symbol_8; + const int x_260 = indexable_2[x_258]; + p = ((15.0f - abs(float((x_256 - x_260)))) / 15.0f); + return float4(p, p, p, 1.0f); + } + const int x_271 = pos.y; + pos.y = (x_271 + 1); + } + return float4(0.0f, 0.0f, 0.0f, 1.0f); +} + +void main_1() { + float2 pos_1 = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int2 param = int2(0, 0); + const float4 x_207 = gl_FragCoord; + const float2 x_210 = asfloat(x_13[0].xy); + pos_1 = (float2(x_207.x, x_207.y) / x_210); + const float x_213 = pos_1.x; + const float x_217 = pos_1.y; + ipos = int2(int((x_213 * 256.0f)), int((x_217 * 256.0f))); + param = ipos; + const float4 x_222 = trace_vi2_(param); + x_GLF_color = x_222; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.msl new file mode 100644 index 0000000000..aa07b66433 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.msl @@ -0,0 +1,98 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float4 trace_vi2_(thread int2* const pos) { + tint_array_wrapper indexable = {}; + tint_array_wrapper indexable_1 = {}; + float p = 0.0f; + tint_array_wrapper indexable_2 = {}; + while (true) { + bool x_251 = false; + bool x_252_phi = false; + int const x_229 = (*(pos)).y; + if ((x_229 != 256)) { + } else { + break; + } + int const x_233 = (*(pos)).x; + int const x_235 = (*(pos)).y; + tint_array_wrapper const tint_symbol_4 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + indexable = tint_symbol_4; + int const x_237 = indexable.arr[x_235]; + tint_array_wrapper const x_238 = indexable; + tint_array_wrapper const tint_symbol_5 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + indexable = tint_symbol_5; + int const x_239 = (*(pos)).y; + (*(pos)).y = 0; + (*(pos)).y = x_239; + indexable = x_238; + bool const x_241 = (x_233 < (x_237 + 15)); + x_252_phi = x_241; + if (x_241) { + int const x_245 = (*(pos)).x; + int const x_247 = (*(pos)).y; + tint_array_wrapper const tint_symbol_6 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + indexable_1 = tint_symbol_6; + int const x_249 = indexable_1.arr[x_247]; + x_251 = (x_245 > (x_249 - 15)); + x_252_phi = x_251; + } + bool const x_252 = x_252_phi; + if (x_252) { + int const x_256 = (*(pos)).x; + int const x_258 = (*(pos)).y; + tint_array_wrapper const tint_symbol_7 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + indexable_2 = tint_symbol_7; + int const x_260 = indexable_2.arr[x_258]; + p = ((15.0f - fabs(float((x_256 - x_260)))) / 15.0f); + float const x_266 = p; + float const x_267 = p; + float const x_268 = p; + return float4(x_266, x_267, x_268, 1.0f); + } + int const x_271 = (*(pos)).y; + (*(pos)).y = (x_271 + 1); + } + return float4(0.0f, 0.0f, 0.0f, 1.0f); +} + +void main_1(constant buf0& x_13, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + float2 pos_1 = 0.0f; + int2 ipos = 0; + int2 param = 0; + float4 const x_207 = *(tint_symbol_9); + float2 const x_210 = x_13.resolution; + pos_1 = (float2(x_207.x, x_207.y) / x_210); + float const x_213 = pos_1.x; + float const x_217 = pos_1.y; + ipos = int2(int((x_213 * 256.0f)), int((x_217 * 256.0f))); + int2 const x_221 = ipos; + param = x_221; + float4 const x_222 = trace_vi2_(&(param)); + *(tint_symbol_10) = x_222; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_13, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..5d77d9b813 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.spvasm @@ -0,0 +1,388 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 319 +; Schema: 0 + OpCapability Shader + %256 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_13 "x_13" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %trace_vi2_ "trace_vi2_" + OpName %pos "pos" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %p "p" + OpName %indexable_2 "indexable_2" + OpName %x_251 "x_251" + OpName %x_252_phi "x_252_phi" + OpName %main_1 "main_1" + OpName %pos_1 "pos_1" + OpName %ipos "ipos" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %15 = OpTypeFunction %v4float %_ptr_Function_v2int + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %27 = OpConstantNull %_arr_int_uint_256 +%_ptr_Function_float = OpTypePointer Function %float + %31 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %uint_0 = OpConstant %uint 0 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %216 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 + %220 = OpConstantComposite %_arr_int_uint_256 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 + %float_15 = OpConstant %float 15 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %274 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %void = OpTypeVoid + %275 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %281 = OpConstantNull %v2float + %283 = OpConstantNull %v2int +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 + %main_out = OpTypeStruct %v4float + %306 = OpTypeFunction %void %main_out + %trace_vi2_ = OpFunction %v4float None %15 + %pos = OpFunctionParameter %_ptr_Function_v2int + %21 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_int_uint_256 Function %27 +%indexable_1 = OpVariable %_ptr_Function__arr_int_uint_256 Function %27 + %p = OpVariable %_ptr_Function_float Function %31 +%indexable_2 = OpVariable %_ptr_Function__arr_int_uint_256 Function %27 + %x_251 = OpVariable %_ptr_Function_bool Function %40 + %x_252_phi = OpVariable %_ptr_Function_bool Function %40 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %45 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %46 = OpLoad %int %45 + %48 = OpINotEqual %bool %46 %int_256 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %34 + %49 = OpLabel + %54 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %55 = OpLoad %int %54 + %57 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %58 = OpLoad %int %57 + OpStore %indexable %216 + %217 = OpAccessChain %_ptr_Function_int %indexable %58 + %218 = OpLoad %int %217 + %219 = OpLoad %_arr_int_uint_256 %indexable + OpStore %indexable %220 + %222 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %223 = OpLoad %int %222 + %225 = OpAccessChain %_ptr_Function_int %pos %uint_1 + OpStore %225 %int_0 + %227 = OpAccessChain %_ptr_Function_int %pos %uint_1 + OpStore %227 %223 + OpStore %indexable %219 + %228 = OpIAdd %int %218 %int_15 + %229 = OpSLessThan %bool %55 %228 + OpStore %x_252_phi %229 + OpSelectionMerge %230 None + OpBranchConditional %229 %231 %230 + %231 = OpLabel + %233 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %234 = OpLoad %int %233 + %236 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %237 = OpLoad %int %236 + OpStore %indexable_1 %216 + %238 = OpAccessChain %_ptr_Function_int %indexable_1 %237 + %239 = OpLoad %int %238 + %240 = OpISub %int %239 %int_15 + %241 = OpSGreaterThan %bool %234 %240 + OpStore %x_251 %241 + %242 = OpLoad %bool %x_251 + OpStore %x_252_phi %242 + OpBranch %230 + %230 = OpLabel + %243 = OpLoad %bool %x_252_phi + OpSelectionMerge %244 None + OpBranchConditional %243 %245 %244 + %245 = OpLabel + %247 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %248 = OpLoad %int %247 + %250 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %251 = OpLoad %int %250 + OpStore %indexable_2 %216 + %252 = OpAccessChain %_ptr_Function_int %indexable_2 %251 + %253 = OpLoad %int %252 + %258 = OpISub %int %248 %253 + %257 = OpConvertSToF %float %258 + %255 = OpExtInst %float %256 FAbs %257 + %259 = OpFSub %float %float_15 %255 + %260 = OpFDiv %float %259 %float_15 + OpStore %p %260 + %261 = OpLoad %float %p + %262 = OpLoad %float %p + %263 = OpLoad %float %p + %265 = OpCompositeConstruct %v4float %261 %262 %263 %float_1 + OpReturnValue %265 + %244 = OpLabel + %267 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %268 = OpLoad %int %267 + %270 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %272 = OpIAdd %int %268 %int_1 + OpStore %270 %272 + OpBranch %35 + %35 = OpLabel + OpBranch %33 + %34 = OpLabel + OpReturnValue %274 + OpFunctionEnd + %main_1 = OpFunction %void None %275 + %278 = OpLabel + %pos_1 = OpVariable %_ptr_Function_v2float Function %281 + %ipos = OpVariable %_ptr_Function_v2int Function %283 + %param = OpVariable %_ptr_Function_v2int Function %283 + %285 = OpLoad %v4float %gl_FragCoord + %287 = OpAccessChain %_ptr_Uniform_v2float %x_13 %uint_0 + %288 = OpLoad %v2float %287 + %289 = OpCompositeExtract %float %285 0 + %290 = OpCompositeExtract %float %285 1 + %291 = OpCompositeConstruct %v2float %289 %290 + %292 = OpFDiv %v2float %291 %288 + OpStore %pos_1 %292 + %293 = OpAccessChain %_ptr_Function_float %pos_1 %uint_0 + %294 = OpLoad %float %293 + %295 = OpAccessChain %_ptr_Function_float %pos_1 %uint_1 + %296 = OpLoad %float %295 + %299 = OpFMul %float %294 %float_256 + %297 = OpConvertFToS %int %299 + %301 = OpFMul %float %296 %float_256 + %300 = OpConvertFToS %int %301 + %302 = OpCompositeConstruct %v2int %297 %300 + OpStore %ipos %302 + %303 = OpLoad %v2int %ipos + OpStore %param %303 + %304 = OpFunctionCall %v4float %trace_vi2_ %param + OpStore %x_GLF_color %304 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %306 +%tint_symbol_1 = OpFunctionParameter %main_out + %310 = OpLabel + %311 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %311 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %275 + %313 = OpLabel + %314 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %314 + %315 = OpFunctionCall %void %main_1 + %317 = OpLoad %v4float %x_GLF_color + %318 = OpCompositeConstruct %main_out %317 + %316 = OpFunctionCall %void %tint_symbol_3 %318 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..3970047a13 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.spvasm.expected.wgsl @@ -0,0 +1,92 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_13 : buf0; + +var x_GLF_color : vec4; + +fn trace_vi2_(pos : ptr>) -> vec4 { + var indexable : array; + var indexable_1 : array; + var p : f32; + var indexable_2 : array; + loop { + var x_251 : bool; + var x_252_phi : bool; + let x_228 : ptr = &((*(pos)).y); + let x_229 : i32 = *(x_228); + if ((x_229 != 256)) { + } else { + break; + } + let x_233 : i32 = (*(pos)).x; + let x_235 : i32 = (*(pos)).y; + indexable = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_237 : i32 = indexable[x_235]; + let x_238 : array = indexable; + indexable = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + let x_239 : i32 = *(x_228); + *(x_228) = 0; + *(x_228) = x_239; + indexable = x_238; + let x_241 : bool = (x_233 < (x_237 + 15)); + x_252_phi = x_241; + if (x_241) { + let x_245 : i32 = (*(pos)).x; + let x_247 : i32 = (*(pos)).y; + indexable_1 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_249 : i32 = indexable_1[x_247]; + x_251 = (x_245 > (x_249 - 15)); + x_252_phi = x_251; + } + let x_252 : bool = x_252_phi; + if (x_252) { + let x_256 : i32 = (*(pos)).x; + let x_258 : i32 = (*(pos)).y; + indexable_2 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_260 : i32 = indexable_2[x_258]; + p = ((15.0 - abs(f32((x_256 - x_260)))) / 15.0); + let x_266 : f32 = p; + let x_267 : f32 = p; + let x_268 : f32 = p; + return vec4(x_266, x_267, x_268, 1.0); + } + let x_270 : ptr = &((*(pos)).y); + let x_271 : i32 = *(x_270); + *(x_270) = (x_271 + 1); + } + return vec4(0.0, 0.0, 0.0, 1.0); +} + +fn main_1() { + var pos_1 : vec2; + var ipos : vec2; + var param : vec2; + let x_207 : vec4 = gl_FragCoord; + let x_210 : vec2 = x_13.resolution; + pos_1 = (vec2(x_207.x, x_207.y) / x_210); + let x_213 : f32 = pos_1.x; + let x_217 : f32 = pos_1.y; + ipos = vec2(i32((x_213 * 256.0)), i32((x_217 * 256.0))); + let x_221 : vec2 = ipos; + param = x_221; + let x_222 : vec4 = trace_vi2_(&(param)); + x_GLF_color = x_222; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl new file mode 100644 index 0000000000..3970047a13 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl @@ -0,0 +1,92 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_13 : buf0; + +var x_GLF_color : vec4; + +fn trace_vi2_(pos : ptr>) -> vec4 { + var indexable : array; + var indexable_1 : array; + var p : f32; + var indexable_2 : array; + loop { + var x_251 : bool; + var x_252_phi : bool; + let x_228 : ptr = &((*(pos)).y); + let x_229 : i32 = *(x_228); + if ((x_229 != 256)) { + } else { + break; + } + let x_233 : i32 = (*(pos)).x; + let x_235 : i32 = (*(pos)).y; + indexable = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_237 : i32 = indexable[x_235]; + let x_238 : array = indexable; + indexable = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + let x_239 : i32 = *(x_228); + *(x_228) = 0; + *(x_228) = x_239; + indexable = x_238; + let x_241 : bool = (x_233 < (x_237 + 15)); + x_252_phi = x_241; + if (x_241) { + let x_245 : i32 = (*(pos)).x; + let x_247 : i32 = (*(pos)).y; + indexable_1 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_249 : i32 = indexable_1[x_247]; + x_251 = (x_245 > (x_249 - 15)); + x_252_phi = x_251; + } + let x_252 : bool = x_252_phi; + if (x_252) { + let x_256 : i32 = (*(pos)).x; + let x_258 : i32 = (*(pos)).y; + indexable_2 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_260 : i32 = indexable_2[x_258]; + p = ((15.0 - abs(f32((x_256 - x_260)))) / 15.0); + let x_266 : f32 = p; + let x_267 : f32 = p; + let x_268 : f32 = p; + return vec4(x_266, x_267, x_268, 1.0); + } + let x_270 : ptr = &((*(pos)).y); + let x_271 : i32 = *(x_270); + *(x_270) = (x_271 + 1); + } + return vec4(0.0, 0.0, 0.0, 1.0); +} + +fn main_1() { + var pos_1 : vec2; + var ipos : vec2; + var param : vec2; + let x_207 : vec4 = gl_FragCoord; + let x_210 : vec2 = x_13.resolution; + pos_1 = (vec2(x_207.x, x_207.y) / x_210); + let x_213 : f32 = pos_1.x; + let x_217 : f32 = pos_1.y; + ipos = vec2(i32((x_213 * 256.0)), i32((x_217 * 256.0))); + let x_221 : vec2 = ipos; + param = x_221; + let x_222 : vec4 = trace_vi2_(&(param)); + x_GLF_color = x_222; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..f284cbd299 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.hlsl @@ -0,0 +1,91 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float4 trace_vi2_(inout int2 pos) { + int indexable[256] = (int[256])0; + int indexable_1[256] = (int[256])0; + float p = 0.0f; + int indexable_2[256] = (int[256])0; + while (true) { + bool x_251 = false; + bool x_252_phi = false; + const int x_229 = pos.y; + if ((x_229 != 256)) { + } else { + break; + } + const int x_233 = pos.x; + const int x_235 = pos.y; + const int tint_symbol_5[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + indexable = tint_symbol_5; + const int x_237 = indexable[x_235]; + const int x_238[256] = indexable; + const int tint_symbol_6[256] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + indexable = tint_symbol_6; + const int x_239 = pos.y; + pos.y = 0; + pos.y = x_239; + indexable = x_238; + const bool x_241 = (x_233 < (x_237 + 15)); + x_252_phi = x_241; + if (x_241) { + const int x_245 = pos.x; + const int x_247 = pos.y; + const int tint_symbol_7[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + indexable_1 = tint_symbol_7; + const int x_249 = indexable_1[x_247]; + x_251 = (x_245 > (x_249 - 15)); + x_252_phi = x_251; + } + if (x_252_phi) { + const int x_256 = pos.x; + const int x_258 = pos.y; + const int tint_symbol_8[256] = {115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}; + indexable_2 = tint_symbol_8; + const int x_260 = indexable_2[x_258]; + p = ((15.0f - abs(float((x_256 - x_260)))) / 15.0f); + return float4(p, p, p, 1.0f); + } + const int x_271 = pos.y; + pos.y = (x_271 + 1); + } + return float4(0.0f, 0.0f, 0.0f, 1.0f); +} + +void main_1() { + float2 pos_1 = float2(0.0f, 0.0f); + int2 ipos = int2(0, 0); + int2 param = int2(0, 0); + const float4 x_207 = gl_FragCoord; + const float2 x_210 = asfloat(x_13[0].xy); + pos_1 = (float2(x_207.x, x_207.y) / x_210); + const float x_213 = pos_1.x; + const float x_217 = pos_1.y; + ipos = int2(int((x_213 * 256.0f)), int((x_217 * 256.0f))); + param = ipos; + const float4 x_222 = trace_vi2_(param); + x_GLF_color = x_222; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.msl new file mode 100644 index 0000000000..aa07b66433 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.msl @@ -0,0 +1,98 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + int arr[256]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float4 trace_vi2_(thread int2* const pos) { + tint_array_wrapper indexable = {}; + tint_array_wrapper indexable_1 = {}; + float p = 0.0f; + tint_array_wrapper indexable_2 = {}; + while (true) { + bool x_251 = false; + bool x_252_phi = false; + int const x_229 = (*(pos)).y; + if ((x_229 != 256)) { + } else { + break; + } + int const x_233 = (*(pos)).x; + int const x_235 = (*(pos)).y; + tint_array_wrapper const tint_symbol_4 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + indexable = tint_symbol_4; + int const x_237 = indexable.arr[x_235]; + tint_array_wrapper const x_238 = indexable; + tint_array_wrapper const tint_symbol_5 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + indexable = tint_symbol_5; + int const x_239 = (*(pos)).y; + (*(pos)).y = 0; + (*(pos)).y = x_239; + indexable = x_238; + bool const x_241 = (x_233 < (x_237 + 15)); + x_252_phi = x_241; + if (x_241) { + int const x_245 = (*(pos)).x; + int const x_247 = (*(pos)).y; + tint_array_wrapper const tint_symbol_6 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + indexable_1 = tint_symbol_6; + int const x_249 = indexable_1.arr[x_247]; + x_251 = (x_245 > (x_249 - 15)); + x_252_phi = x_251; + } + bool const x_252 = x_252_phi; + if (x_252) { + int const x_256 = (*(pos)).x; + int const x_258 = (*(pos)).y; + tint_array_wrapper const tint_symbol_7 = {.arr={115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94}}; + indexable_2 = tint_symbol_7; + int const x_260 = indexable_2.arr[x_258]; + p = ((15.0f - fabs(float((x_256 - x_260)))) / 15.0f); + float const x_266 = p; + float const x_267 = p; + float const x_268 = p; + return float4(x_266, x_267, x_268, 1.0f); + } + int const x_271 = (*(pos)).y; + (*(pos)).y = (x_271 + 1); + } + return float4(0.0f, 0.0f, 0.0f, 1.0f); +} + +void main_1(constant buf0& x_13, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + float2 pos_1 = 0.0f; + int2 ipos = 0; + int2 param = 0; + float4 const x_207 = *(tint_symbol_9); + float2 const x_210 = x_13.resolution; + pos_1 = (float2(x_207.x, x_207.y) / x_210); + float const x_213 = pos_1.x; + float const x_217 = pos_1.y; + ipos = int2(int((x_213 * 256.0f)), int((x_217 * 256.0f))); + int2 const x_221 = ipos; + param = x_221; + float4 const x_222 = trace_vi2_(&(param)); + *(tint_symbol_10) = x_222; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_13, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d77d9b813 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.spvasm @@ -0,0 +1,388 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 319 +; Schema: 0 + OpCapability Shader + %256 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_13 "x_13" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %trace_vi2_ "trace_vi2_" + OpName %pos "pos" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %p "p" + OpName %indexable_2 "indexable_2" + OpName %x_251 "x_251" + OpName %x_252_phi "x_252_phi" + OpName %main_1 "main_1" + OpName %pos_1 "pos_1" + OpName %ipos "ipos" + OpName %param "param" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_256 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %15 = OpTypeFunction %v4float %_ptr_Function_v2int + %uint = OpTypeInt 32 0 + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Function__arr_int_uint_256 = OpTypePointer Function %_arr_int_uint_256 + %27 = OpConstantNull %_arr_int_uint_256 +%_ptr_Function_float = OpTypePointer Function %float + %31 = OpConstantNull %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %uint_0 = OpConstant %uint 0 + %int_115 = OpConstant %int 115 + %int_133 = OpConstant %int 133 + %int_150 = OpConstant %int 150 + %int_164 = OpConstant %int 164 + %int_176 = OpConstant %int 176 + %int_184 = OpConstant %int 184 + %int_190 = OpConstant %int 190 + %int_192 = OpConstant %int 192 + %int_191 = OpConstant %int 191 + %int_187 = OpConstant %int 187 + %int_181 = OpConstant %int 181 + %int_172 = OpConstant %int 172 + %int_163 = OpConstant %int 163 + %int_153 = OpConstant %int 153 + %int_143 = OpConstant %int 143 + %int_134 = OpConstant %int 134 + %int_126 = OpConstant %int 126 + %int_120 = OpConstant %int 120 + %int_116 = OpConstant %int 116 + %int_114 = OpConstant %int 114 + %int_117 = OpConstant %int 117 + %int_121 = OpConstant %int 121 + %int_127 = OpConstant %int 127 + %int_141 = OpConstant %int 141 + %int_148 = OpConstant %int 148 + %int_154 = OpConstant %int 154 + %int_159 = OpConstant %int 159 + %int_162 = OpConstant %int 162 + %int_161 = OpConstant %int 161 + %int_157 = OpConstant %int 157 + %int_151 = OpConstant %int 151 + %int_124 = OpConstant %int 124 + %int_113 = OpConstant %int 113 + %int_103 = OpConstant %int 103 + %int_94 = OpConstant %int 94 + %int_87 = OpConstant %int 87 + %int_82 = OpConstant %int 82 + %int_79 = OpConstant %int 79 + %int_80 = OpConstant %int 80 + %int_84 = OpConstant %int 84 + %int_91 = OpConstant %int 91 + %int_101 = OpConstant %int 101 + %int_130 = OpConstant %int 130 + %int_146 = OpConstant %int 146 + %int_182 = OpConstant %int 182 + %int_199 = OpConstant %int 199 + %int_215 = OpConstant %int 215 + %int_229 = OpConstant %int 229 + %int_240 = OpConstant %int 240 + %int_249 = OpConstant %int 249 + %int_254 = OpConstant %int 254 + %int_250 = OpConstant %int 250 + %int_243 = OpConstant %int 243 + %int_233 = OpConstant %int 233 + %int_223 = OpConstant %int 223 + %int_212 = OpConstant %int 212 + %int_200 = OpConstant %int 200 + %int_180 = OpConstant %int 180 + %int_166 = OpConstant %int 166 + %int_169 = OpConstant %int 169 + %int_174 = OpConstant %int 174 + %int_179 = OpConstant %int 179 + %int_185 = OpConstant %int 185 + %int_193 = OpConstant %int 193 + %int_195 = OpConstant %int 195 + %int_188 = OpConstant %int 188 + %int_171 = OpConstant %int 171 + %int_149 = OpConstant %int 149 + %int_137 = OpConstant %int 137 + %int_125 = OpConstant %int 125 + %int_105 = OpConstant %int 105 + %int_97 = OpConstant %int 97 + %int_93 = OpConstant %int 93 + %int_98 = OpConstant %int 98 + %int_106 = OpConstant %int 106 + %int_145 = OpConstant %int 145 + %int_177 = OpConstant %int 177 + %int_208 = OpConstant %int 208 + %int_221 = OpConstant %int 221 + %int_231 = OpConstant %int 231 + %int_239 = OpConstant %int 239 + %int_244 = OpConstant %int 244 + %int_242 = OpConstant %int 242 + %int_236 = OpConstant %int 236 + %int_228 = OpConstant %int 228 + %int_218 = OpConstant %int 218 + %int_207 = OpConstant %int 207 + %int_194 = OpConstant %int 194 + %int_158 = OpConstant %int 158 + %int_135 = OpConstant %int 135 + %int_132 = OpConstant %int 132 + %int_131 = OpConstant %int 131 + %int_138 = OpConstant %int 138 + %int_147 = OpConstant %int 147 + %int_155 = OpConstant %int 155 + %int_152 = OpConstant %int 152 + %int_139 = OpConstant %int 139 + %int_129 = OpConstant %int 129 + %int_118 = OpConstant %int 118 + %int_68 = OpConstant %int 68 + %int_58 = OpConstant %int 58 + %int_49 = OpConstant %int 49 + %int_43 = OpConstant %int 43 + %int_40 = OpConstant %int 40 + %int_41 = OpConstant %int 41 + %int_44 = OpConstant %int 44 + %int_51 = OpConstant %int 51 + %int_61 = OpConstant %int 61 + %int_73 = OpConstant %int 73 + %int_119 = OpConstant %int 119 + %int_173 = OpConstant %int 173 + %int_186 = OpConstant %int 186 + %int_128 = OpConstant %int 128 + %int_104 = OpConstant %int 104 + %int_86 = OpConstant %int 86 + %int_81 = OpConstant %int 81 + %int_77 = OpConstant %int 77 + %int_76 = OpConstant %int 76 + %int_89 = OpConstant %int 89 + %int_102 = OpConstant %int 102 + %int_92 = OpConstant %int 92 + %int_83 = OpConstant %int 83 + %int_62 = OpConstant %int 62 + %int_50 = OpConstant %int 50 + %int_38 = OpConstant %int 38 + %int_26 = OpConstant %int 26 + %int_16 = OpConstant %int 16 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 + %int_21 = OpConstant %int 21 + %int_33 = OpConstant %int 33 + %int_48 = OpConstant %int 48 + %int_64 = OpConstant %int 64 + %int_144 = OpConstant %int 144 + %int_123 = OpConstant %int 123 + %int_112 = OpConstant %int 112 + %int_100 = OpConstant %int 100 + %int_90 = OpConstant %int 90 + %int_65 = OpConstant %int 65 + %int_67 = OpConstant %int 67 + %int_70 = OpConstant %int 70 + %int_75 = OpConstant %int 75 + %int_95 = OpConstant %int 95 + %int_88 = OpConstant %int 88 + %int_69 = OpConstant %int 69 + %int_47 = OpConstant %int 47 + %int_36 = OpConstant %int 36 + %int_18 = OpConstant %int 18 + %int_13 = OpConstant %int 13 + %int_15 = OpConstant %int 15 + %int_22 = OpConstant %int 22 + %int_32 = OpConstant %int 32 + %int_45 = OpConstant %int 45 + %int_60 = OpConstant %int 60 + %216 = OpConstantComposite %_arr_int_uint_256 %int_115 %int_133 %int_150 %int_164 %int_176 %int_184 %int_190 %int_192 %int_191 %int_187 %int_181 %int_172 %int_163 %int_153 %int_143 %int_134 %int_126 %int_120 %int_116 %int_114 %int_114 %int_117 %int_121 %int_127 %int_134 %int_141 %int_148 %int_154 %int_159 %int_162 %int_163 %int_161 %int_157 %int_151 %int_143 %int_134 %int_124 %int_113 %int_103 %int_94 %int_87 %int_82 %int_79 %int_80 %int_84 %int_91 %int_101 %int_114 %int_130 %int_146 %int_164 %int_182 %int_199 %int_215 %int_229 %int_240 %int_249 %int_254 %int_256 %int_254 %int_250 %int_243 %int_233 %int_223 %int_212 %int_200 %int_190 %int_180 %int_172 %int_166 %int_163 %int_161 %int_162 %int_164 %int_169 %int_174 %int_179 %int_185 %int_190 %int_193 %int_195 %int_195 %int_192 %int_188 %int_180 %int_171 %int_161 %int_149 %int_137 %int_125 %int_114 %int_105 %int_97 %int_93 %int_91 %int_93 %int_98 %int_106 %int_117 %int_130 %int_145 %int_161 %int_177 %int_193 %int_208 %int_221 %int_231 %int_239 %int_243 %int_244 %int_242 %int_236 %int_228 %int_218 %int_207 %int_194 %int_181 %int_169 %int_158 %int_148 %int_141 %int_135 %int_132 %int_131 %int_132 %int_135 %int_138 %int_143 %int_147 %int_151 %int_154 %int_155 %int_155 %int_152 %int_146 %int_139 %int_129 %int_118 %int_106 %int_93 %int_80 %int_68 %int_58 %int_49 %int_43 %int_40 %int_41 %int_44 %int_51 %int_61 %int_73 %int_87 %int_103 %int_119 %int_134 %int_149 %int_162 %int_173 %int_181 %int_186 %int_188 %int_186 %int_181 %int_174 %int_164 %int_153 %int_141 %int_128 %int_116 %int_104 %int_94 %int_86 %int_81 %int_77 %int_76 %int_77 %int_80 %int_84 %int_89 %int_94 %int_98 %int_102 %int_104 %int_104 %int_102 %int_98 %int_92 %int_83 %int_73 %int_62 %int_50 %int_38 %int_26 %int_16 %int_8 %int_2 %int_0 %int_0 %int_4 %int_11 %int_21 %int_33 %int_48 %int_64 %int_81 %int_98 %int_114 %int_129 %int_141 %int_151 %int_158 %int_161 %int_161 %int_158 %int_152 %int_144 %int_134 %int_123 %int_112 %int_100 %int_90 %int_81 %int_73 %int_68 %int_65 %int_65 %int_67 %int_70 %int_75 %int_81 %int_87 %int_92 %int_97 %int_101 %int_103 %int_102 %int_100 %int_95 %int_88 %int_79 %int_69 %int_58 %int_47 %int_36 %int_26 %int_18 %int_13 %int_11 %int_11 %int_15 %int_22 %int_32 %int_45 %int_60 %int_77 %int_94 + %220 = OpConstantComposite %_arr_int_uint_256 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 %int_0 + %float_15 = OpConstant %float 15 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %274 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %void = OpTypeVoid + %275 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %281 = OpConstantNull %v2float + %283 = OpConstantNull %v2int +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_256 = OpConstant %float 256 + %main_out = OpTypeStruct %v4float + %306 = OpTypeFunction %void %main_out + %trace_vi2_ = OpFunction %v4float None %15 + %pos = OpFunctionParameter %_ptr_Function_v2int + %21 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_int_uint_256 Function %27 +%indexable_1 = OpVariable %_ptr_Function__arr_int_uint_256 Function %27 + %p = OpVariable %_ptr_Function_float Function %31 +%indexable_2 = OpVariable %_ptr_Function__arr_int_uint_256 Function %27 + %x_251 = OpVariable %_ptr_Function_bool Function %40 + %x_252_phi = OpVariable %_ptr_Function_bool Function %40 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %45 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %46 = OpLoad %int %45 + %48 = OpINotEqual %bool %46 %int_256 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %34 + %49 = OpLabel + %54 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %55 = OpLoad %int %54 + %57 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %58 = OpLoad %int %57 + OpStore %indexable %216 + %217 = OpAccessChain %_ptr_Function_int %indexable %58 + %218 = OpLoad %int %217 + %219 = OpLoad %_arr_int_uint_256 %indexable + OpStore %indexable %220 + %222 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %223 = OpLoad %int %222 + %225 = OpAccessChain %_ptr_Function_int %pos %uint_1 + OpStore %225 %int_0 + %227 = OpAccessChain %_ptr_Function_int %pos %uint_1 + OpStore %227 %223 + OpStore %indexable %219 + %228 = OpIAdd %int %218 %int_15 + %229 = OpSLessThan %bool %55 %228 + OpStore %x_252_phi %229 + OpSelectionMerge %230 None + OpBranchConditional %229 %231 %230 + %231 = OpLabel + %233 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %234 = OpLoad %int %233 + %236 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %237 = OpLoad %int %236 + OpStore %indexable_1 %216 + %238 = OpAccessChain %_ptr_Function_int %indexable_1 %237 + %239 = OpLoad %int %238 + %240 = OpISub %int %239 %int_15 + %241 = OpSGreaterThan %bool %234 %240 + OpStore %x_251 %241 + %242 = OpLoad %bool %x_251 + OpStore %x_252_phi %242 + OpBranch %230 + %230 = OpLabel + %243 = OpLoad %bool %x_252_phi + OpSelectionMerge %244 None + OpBranchConditional %243 %245 %244 + %245 = OpLabel + %247 = OpAccessChain %_ptr_Function_int %pos %uint_0 + %248 = OpLoad %int %247 + %250 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %251 = OpLoad %int %250 + OpStore %indexable_2 %216 + %252 = OpAccessChain %_ptr_Function_int %indexable_2 %251 + %253 = OpLoad %int %252 + %258 = OpISub %int %248 %253 + %257 = OpConvertSToF %float %258 + %255 = OpExtInst %float %256 FAbs %257 + %259 = OpFSub %float %float_15 %255 + %260 = OpFDiv %float %259 %float_15 + OpStore %p %260 + %261 = OpLoad %float %p + %262 = OpLoad %float %p + %263 = OpLoad %float %p + %265 = OpCompositeConstruct %v4float %261 %262 %263 %float_1 + OpReturnValue %265 + %244 = OpLabel + %267 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %268 = OpLoad %int %267 + %270 = OpAccessChain %_ptr_Function_int %pos %uint_1 + %272 = OpIAdd %int %268 %int_1 + OpStore %270 %272 + OpBranch %35 + %35 = OpLabel + OpBranch %33 + %34 = OpLabel + OpReturnValue %274 + OpFunctionEnd + %main_1 = OpFunction %void None %275 + %278 = OpLabel + %pos_1 = OpVariable %_ptr_Function_v2float Function %281 + %ipos = OpVariable %_ptr_Function_v2int Function %283 + %param = OpVariable %_ptr_Function_v2int Function %283 + %285 = OpLoad %v4float %gl_FragCoord + %287 = OpAccessChain %_ptr_Uniform_v2float %x_13 %uint_0 + %288 = OpLoad %v2float %287 + %289 = OpCompositeExtract %float %285 0 + %290 = OpCompositeExtract %float %285 1 + %291 = OpCompositeConstruct %v2float %289 %290 + %292 = OpFDiv %v2float %291 %288 + OpStore %pos_1 %292 + %293 = OpAccessChain %_ptr_Function_float %pos_1 %uint_0 + %294 = OpLoad %float %293 + %295 = OpAccessChain %_ptr_Function_float %pos_1 %uint_1 + %296 = OpLoad %float %295 + %299 = OpFMul %float %294 %float_256 + %297 = OpConvertFToS %int %299 + %301 = OpFMul %float %296 %float_256 + %300 = OpConvertFToS %int %301 + %302 = OpCompositeConstruct %v2int %297 %300 + OpStore %ipos %302 + %303 = OpLoad %v2int %ipos + OpStore %param %303 + %304 = OpFunctionCall %v4float %trace_vi2_ %param + OpStore %x_GLF_color %304 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %306 +%tint_symbol_1 = OpFunctionParameter %main_out + %310 = OpLabel + %311 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %311 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %275 + %313 = OpLabel + %314 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %314 + %315 = OpFunctionCall %void %main_1 + %317 = OpLoad %v4float %x_GLF_color + %318 = OpCompositeConstruct %main_out %317 + %316 = OpFunctionCall %void %tint_symbol_3 %318 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..3970047a13 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-pillars-volatile-nontemporal-store/1.wgsl.expected.wgsl @@ -0,0 +1,92 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_13 : buf0; + +var x_GLF_color : vec4; + +fn trace_vi2_(pos : ptr>) -> vec4 { + var indexable : array; + var indexable_1 : array; + var p : f32; + var indexable_2 : array; + loop { + var x_251 : bool; + var x_252_phi : bool; + let x_228 : ptr = &((*(pos)).y); + let x_229 : i32 = *(x_228); + if ((x_229 != 256)) { + } else { + break; + } + let x_233 : i32 = (*(pos)).x; + let x_235 : i32 = (*(pos)).y; + indexable = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_237 : i32 = indexable[x_235]; + let x_238 : array = indexable; + indexable = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + let x_239 : i32 = *(x_228); + *(x_228) = 0; + *(x_228) = x_239; + indexable = x_238; + let x_241 : bool = (x_233 < (x_237 + 15)); + x_252_phi = x_241; + if (x_241) { + let x_245 : i32 = (*(pos)).x; + let x_247 : i32 = (*(pos)).y; + indexable_1 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_249 : i32 = indexable_1[x_247]; + x_251 = (x_245 > (x_249 - 15)); + x_252_phi = x_251; + } + let x_252 : bool = x_252_phi; + if (x_252) { + let x_256 : i32 = (*(pos)).x; + let x_258 : i32 = (*(pos)).y; + indexable_2 = array(115, 133, 150, 164, 176, 184, 190, 192, 191, 187, 181, 172, 163, 153, 143, 134, 126, 120, 116, 114, 114, 117, 121, 127, 134, 141, 148, 154, 159, 162, 163, 161, 157, 151, 143, 134, 124, 113, 103, 94, 87, 82, 79, 80, 84, 91, 101, 114, 130, 146, 164, 182, 199, 215, 229, 240, 249, 254, 256, 254, 250, 243, 233, 223, 212, 200, 190, 180, 172, 166, 163, 161, 162, 164, 169, 174, 179, 185, 190, 193, 195, 195, 192, 188, 180, 171, 161, 149, 137, 125, 114, 105, 97, 93, 91, 93, 98, 106, 117, 130, 145, 161, 177, 193, 208, 221, 231, 239, 243, 244, 242, 236, 228, 218, 207, 194, 181, 169, 158, 148, 141, 135, 132, 131, 132, 135, 138, 143, 147, 151, 154, 155, 155, 152, 146, 139, 129, 118, 106, 93, 80, 68, 58, 49, 43, 40, 41, 44, 51, 61, 73, 87, 103, 119, 134, 149, 162, 173, 181, 186, 188, 186, 181, 174, 164, 153, 141, 128, 116, 104, 94, 86, 81, 77, 76, 77, 80, 84, 89, 94, 98, 102, 104, 104, 102, 98, 92, 83, 73, 62, 50, 38, 26, 16, 8, 2, 0, 0, 4, 11, 21, 33, 48, 64, 81, 98, 114, 129, 141, 151, 158, 161, 161, 158, 152, 144, 134, 123, 112, 100, 90, 81, 73, 68, 65, 65, 67, 70, 75, 81, 87, 92, 97, 101, 103, 102, 100, 95, 88, 79, 69, 58, 47, 36, 26, 18, 13, 11, 11, 15, 22, 32, 45, 60, 77, 94); + let x_260 : i32 = indexable_2[x_258]; + p = ((15.0 - abs(f32((x_256 - x_260)))) / 15.0); + let x_266 : f32 = p; + let x_267 : f32 = p; + let x_268 : f32 = p; + return vec4(x_266, x_267, x_268, 1.0); + } + let x_270 : ptr = &((*(pos)).y); + let x_271 : i32 = *(x_270); + *(x_270) = (x_271 + 1); + } + return vec4(0.0, 0.0, 0.0, 1.0); +} + +fn main_1() { + var pos_1 : vec2; + var ipos : vec2; + var param : vec2; + let x_207 : vec4 = gl_FragCoord; + let x_210 : vec2 = x_13.resolution; + pos_1 = (vec2(x_207.x, x_207.y) / x_210); + let x_213 : f32 = pos_1.x; + let x_217 : f32 = pos_1.y; + ipos = vec2(i32((x_213 * 256.0)), i32((x_217 * 256.0))); + let x_221 : vec2 = ipos; + param = x_221; + let x_222 : vec4 = trace_vi2_(&(param)); + x_GLF_color = x_222; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm new file mode 100644 index 0000000000..449e485ae8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm @@ -0,0 +1,481 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %swap_i1_i1_ "swap(i1;i1;" + OpName %i "i" + OpName %j "j" + OpName %performPartition_i1_i1_ "performPartition(i1;i1;" + OpName %l "l" + OpName %h "h" + OpName %quicksort_ "quicksort(" + OpName %temp "temp" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %pivot "pivot" + OpName %i_0 "i" + OpName %j_0 "j" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %l_0 "l" + OpName %h_0 "h" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %i_1 "i" + OpName %uv "uv" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %color "color" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %35 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %38 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %39 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %int_10 = OpConstant %int 10 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %64 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %35 + %80 = OpLabel + %i_1 = OpVariable %_ptr_Function_int Function + %uv = OpVariable %_ptr_Function_v2float Function + %color = OpVariable %_ptr_Function_v3float Function + OpStore %i_1 %int_0 + OpBranch %81 + %81 = OpLabel + OpLoopMerge %82 %83 None + OpBranch %84 + %84 = OpLabel + %85 = OpLoad %int %i_1 + %86 = OpSLessThan %bool %85 %int_10 + OpBranchConditional %86 %87 %82 + %87 = OpLabel + %88 = OpLoad %int %i_1 + %89 = OpLoad %int %i_1 + %90 = OpISub %int %int_10 %89 + %91 = OpAccessChain %_ptr_Private_int %obj %int_0 %88 + OpStore %91 %90 + %92 = OpLoad %int %i_1 + %93 = OpLoad %int %i_1 + %94 = OpAccessChain %_ptr_Private_int %obj %int_0 %93 + %95 = OpLoad %int %94 + %96 = OpLoad %int %i_1 + %97 = OpAccessChain %_ptr_Private_int %obj %int_0 %96 + %98 = OpLoad %int %97 + %99 = OpIMul %int %95 %98 + %100 = OpAccessChain %_ptr_Private_int %obj %int_0 %92 + OpStore %100 %99 + OpBranch %83 + %83 = OpLabel + %101 = OpLoad %int %i_1 + %102 = OpIAdd %int %101 %int_1 + OpStore %i_1 %102 + OpBranch %81 + %82 = OpLabel + %103 = OpFunctionCall %void %quicksort_ + %104 = OpLoad %v4float %gl_FragCoord + %105 = OpVectorShuffle %v2float %104 %104 0 1 + %106 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %107 = OpLoad %v2float %106 + %108 = OpFDiv %v2float %105 %107 + OpStore %uv %108 + OpStore %color %64 + %109 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_0 + %110 = OpLoad %int %109 + %111 = OpConvertSToF %float %110 + %112 = OpAccessChain %_ptr_Function_float %color %uint_0 + %113 = OpLoad %float %112 + %114 = OpFAdd %float %113 %111 + %115 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %115 %114 + %116 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %117 = OpLoad %float %116 + %118 = OpFOrdGreaterThan %bool %117 %float_0_25 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %119 + %120 = OpLabel + %121 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_1 + %122 = OpLoad %int %121 + %123 = OpConvertSToF %float %122 + %124 = OpAccessChain %_ptr_Function_float %color %uint_0 + %125 = OpLoad %float %124 + %126 = OpFAdd %float %125 %123 + %127 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %127 %126 + OpBranch %119 + %119 = OpLabel + %128 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %129 = OpLoad %float %128 + %130 = OpFOrdGreaterThan %bool %129 %float_0_5 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %131 + %132 = OpLabel + %133 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_2 + %134 = OpLoad %int %133 + %135 = OpConvertSToF %float %134 + %136 = OpAccessChain %_ptr_Function_float %color %uint_1 + %137 = OpLoad %float %136 + %138 = OpFAdd %float %137 %135 + %139 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %139 %138 + OpBranch %131 + %131 = OpLabel + %140 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %141 = OpLoad %float %140 + %142 = OpFOrdGreaterThan %bool %141 %float_0_75 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %143 + %144 = OpLabel + %145 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_3 + %146 = OpLoad %int %145 + %147 = OpConvertSToF %float %146 + %148 = OpAccessChain %_ptr_Function_float %color %uint_2 + %149 = OpLoad %float %148 + %150 = OpFAdd %float %149 %147 + %151 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %151 %150 + OpBranch %143 + %143 = OpLabel + %152 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_4 + %153 = OpLoad %int %152 + %154 = OpConvertSToF %float %153 + %155 = OpAccessChain %_ptr_Function_float %color %uint_1 + %156 = OpLoad %float %155 + %157 = OpFAdd %float %156 %154 + %158 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %158 %157 + %159 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %160 = OpLoad %float %159 + %161 = OpFOrdGreaterThan %bool %160 %float_0_25 + OpSelectionMerge %162 None + OpBranchConditional %161 %163 %162 + %163 = OpLabel + %164 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_5 + %165 = OpLoad %int %164 + %166 = OpConvertSToF %float %165 + %167 = OpAccessChain %_ptr_Function_float %color %uint_0 + %168 = OpLoad %float %167 + %169 = OpFAdd %float %168 %166 + %170 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %170 %169 + OpBranch %162 + %162 = OpLabel + %171 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %172 = OpLoad %float %171 + %173 = OpFOrdGreaterThan %bool %172 %float_0_5 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %174 + %175 = OpLabel + %176 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_6 + %177 = OpLoad %int %176 + %178 = OpConvertSToF %float %177 + %179 = OpAccessChain %_ptr_Function_float %color %uint_1 + %180 = OpLoad %float %179 + %181 = OpFAdd %float %180 %178 + %182 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %182 %181 + OpBranch %174 + %174 = OpLabel + %183 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %184 = OpLoad %float %183 + %185 = OpFOrdGreaterThan %bool %184 %float_0_75 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %186 + %187 = OpLabel + %188 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_7 + %189 = OpLoad %int %188 + %190 = OpConvertSToF %float %189 + %191 = OpAccessChain %_ptr_Function_float %color %uint_2 + %192 = OpLoad %float %191 + %193 = OpFAdd %float %192 %190 + %194 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %194 %193 + OpBranch %186 + %186 = OpLabel + %195 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_8 + %196 = OpLoad %int %195 + %197 = OpConvertSToF %float %196 + %198 = OpAccessChain %_ptr_Function_float %color %uint_2 + %199 = OpLoad %float %198 + %200 = OpFAdd %float %199 %197 + %201 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %201 %200 + %202 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %203 = OpLoad %float %202 + %204 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %205 = OpLoad %float %204 + %206 = OpFSub %float %203 %205 + %207 = OpExtInst %float %1 FAbs %206 + %208 = OpFOrdLessThan %bool %207 %float_0_25 + OpSelectionMerge %209 None + OpBranchConditional %208 %210 %209 + %210 = OpLabel + %211 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_9 + %212 = OpLoad %int %211 + %213 = OpConvertSToF %float %212 + %214 = OpAccessChain %_ptr_Function_float %color %uint_0 + %215 = OpLoad %float %214 + %216 = OpFAdd %float %215 %213 + %217 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %217 %216 + OpBranch %209 + %209 = OpLabel + %218 = OpLoad %v3float %color + %219 = OpExtInst %v3float %1 Normalize %218 + %220 = OpCompositeExtract %float %219 0 + %221 = OpCompositeExtract %float %219 1 + %222 = OpCompositeExtract %float %219 2 + %223 = OpCompositeConstruct %v4float %220 %221 %222 %float_1 + OpStore %_GLF_color %223 + OpReturn + OpFunctionEnd +%swap_i1_i1_ = OpFunction %void None %38 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %224 = OpLabel + %temp = OpVariable %_ptr_Function_int Function + %225 = OpLoad %int %i + %226 = OpAccessChain %_ptr_Private_int %obj %int_0 %225 + %227 = OpLoad %int %226 + OpStore %temp %227 + %228 = OpLoad %int %i + %229 = OpLoad %int %j + %230 = OpAccessChain %_ptr_Private_int %obj %int_0 %229 + %231 = OpLoad %int %230 + %232 = OpAccessChain %_ptr_Private_int %obj %int_0 %228 + OpStore %232 %231 + %233 = OpLoad %int %j + %234 = OpLoad %int %temp + %235 = OpAccessChain %_ptr_Private_int %obj %int_0 %233 + OpStore %235 %234 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %39 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %236 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_int Function + %237 = OpLoad %int %h + %238 = OpAccessChain %_ptr_Private_int %obj %int_0 %237 + %239 = OpLoad %int %238 + OpStore %pivot %239 + %240 = OpLoad %int %l + %241 = OpISub %int %240 %int_1 + OpStore %i_0 %241 + %242 = OpLoad %int %l + OpStore %j_0 %242 + OpBranch %243 + %243 = OpLabel + OpLoopMerge %244 %245 None + OpBranch %246 + %246 = OpLabel + %247 = OpLoad %int %j_0 + %248 = OpLoad %int %h + %249 = OpISub %int %248 %int_1 + %250 = OpSLessThanEqual %bool %247 %249 + OpBranchConditional %250 %251 %244 + %251 = OpLabel + %252 = OpLoad %int %j_0 + %253 = OpAccessChain %_ptr_Private_int %obj %int_0 %252 + %254 = OpLoad %int %253 + %255 = OpLoad %int %pivot + %256 = OpSLessThanEqual %bool %254 %255 + OpSelectionMerge %257 None + OpBranchConditional %256 %258 %257 + %258 = OpLabel + %259 = OpLoad %int %i_0 + %260 = OpIAdd %int %259 %int_1 + OpStore %i_0 %260 + %261 = OpLoad %int %i_0 + OpStore %param %261 + %262 = OpLoad %int %j_0 + OpStore %param_0 %262 + %263 = OpFunctionCall %void %swap_i1_i1_ %param %param_0 + OpBranch %257 + %257 = OpLabel + OpBranch %245 + %245 = OpLabel + %264 = OpLoad %int %j_0 + %265 = OpIAdd %int %264 %int_1 + OpStore %j_0 %265 + OpBranch %243 + %244 = OpLabel + %266 = OpLoad %int %i_0 + %267 = OpIAdd %int %266 %int_1 + OpStore %i_0 %267 + %268 = OpLoad %int %i_0 + OpStore %param_1 %268 + %269 = OpLoad %int %h + OpStore %param_2 %269 + %270 = OpFunctionCall %void %swap_i1_i1_ %param_1 %param_2 + %271 = OpLoad %int %i_0 + OpReturnValue %271 + OpFunctionEnd + %quicksort_ = OpFunction %void None %35 + %272 = OpLabel + %l_0 = OpVariable %_ptr_Function_int Function + %h_0 = OpVariable %_ptr_Function_int Function + %top = OpVariable %_ptr_Function_int Function + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function + %p = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_int Function + %param_4 = OpVariable %_ptr_Function_int Function + OpStore %l_0 %int_0 + OpStore %h_0 %int_9 + OpStore %top %int_n1 + %273 = OpLoad %int %top + %274 = OpIAdd %int %273 %int_1 + OpStore %top %274 + %275 = OpLoad %int %l_0 + %276 = OpAccessChain %_ptr_Function_int %stack %274 + OpStore %276 %275 + %277 = OpLoad %int %top + %278 = OpIAdd %int %277 %int_1 + OpStore %top %278 + %279 = OpLoad %int %h_0 + %280 = OpAccessChain %_ptr_Function_int %stack %278 + OpStore %280 %279 + OpBranch %281 + %281 = OpLabel + OpLoopMerge %282 %283 None + OpBranch %284 + %284 = OpLabel + %285 = OpLoad %int %top + %286 = OpSGreaterThanEqual %bool %285 %int_0 + OpBranchConditional %286 %287 %282 + %287 = OpLabel + %288 = OpLoad %int %top + %289 = OpISub %int %288 %int_1 + OpStore %top %289 + %290 = OpAccessChain %_ptr_Function_int %stack %288 + %291 = OpLoad %int %290 + OpStore %h_0 %291 + %292 = OpLoad %int %top + %293 = OpISub %int %292 %int_1 + OpStore %top %293 + %294 = OpAccessChain %_ptr_Function_int %stack %292 + %295 = OpLoad %int %294 + OpStore %l_0 %295 + %296 = OpLoad %int %l_0 + OpStore %param_3 %296 + %297 = OpLoad %int %h_0 + OpStore %param_4 %297 + %298 = OpFunctionCall %int %performPartition_i1_i1_ %param_3 %param_4 + OpStore %p %298 + %299 = OpLoad %int %p + %300 = OpISub %int %299 %int_1 + %301 = OpLoad %int %l_0 + %302 = OpSGreaterThan %bool %300 %301 + OpSelectionMerge %303 None + OpBranchConditional %302 %304 %303 + %304 = OpLabel + %305 = OpLoad %int %top + %306 = OpIAdd %int %305 %int_1 + OpStore %top %306 + %307 = OpLoad %int %l_0 + %308 = OpAccessChain %_ptr_Function_int %stack %306 + OpStore %308 %307 + %309 = OpLoad %int %top + %310 = OpIAdd %int %309 %int_1 + OpStore %top %310 + %311 = OpLoad %int %p + %312 = OpISub %int %311 %int_1 + %313 = OpAccessChain %_ptr_Function_int %stack %310 + OpStore %313 %312 + OpBranch %303 + %303 = OpLabel + %314 = OpLoad %int %p + %315 = OpIAdd %int %314 %int_1 + %316 = OpLoad %int %h_0 + %317 = OpSLessThan %bool %315 %316 + OpSelectionMerge %318 None + OpBranchConditional %317 %319 %318 + %319 = OpLabel + %320 = OpLoad %int %top + %321 = OpIAdd %int %320 %int_1 + OpStore %top %321 + %322 = OpLoad %int %p + %323 = OpIAdd %int %322 %int_1 + %324 = OpAccessChain %_ptr_Function_int %stack %321 + OpStore %324 %323 + %325 = OpLoad %int %top + %326 = OpIAdd %int %325 %int_1 + OpStore %top %326 + %327 = OpLoad %int %h_0 + %328 = OpAccessChain %_ptr_Function_int %stack %326 + OpStore %328 %327 + OpBranch %318 + %318 = OpLabel + OpBranch %283 + %283 = OpLabel + OpBranch %281 + %282 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..18cfa065aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.hlsl @@ -0,0 +1,214 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_32 : register(b0, space0) { + uint4 x_32[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_225 = i; + const int x_227 = obj.numbers[x_225]; + temp = x_227; + const int x_228 = i; + const int x_229 = j; + const int x_231 = obj.numbers[x_229]; + obj.numbers[x_228] = x_231; + const int x_233 = j; + obj.numbers[x_233] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_237 = h; + const int x_239 = obj.numbers[x_237]; + pivot = x_239; + const int x_240 = l; + i_1 = (x_240 - 1); + const int x_242 = l; + j_1 = x_242; + while (true) { + const int x_247 = j_1; + const int x_248 = h; + if ((x_247 <= (x_248 - 1))) { + } else { + break; + } + const int x_254 = obj.numbers[j_1]; + if ((x_254 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + i_1 = (i_1 + 1); + param_2 = i_1; + const int x_269 = h; + param_3 = x_269; + swap_i1_i1_(param_2, param_3); + return i_1; +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_274 = (top + 1); + top = x_274; + stack[x_274] = l_1; + const int x_278 = (top + 1); + top = x_278; + stack[x_278] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_288 = top; + top = (x_288 - 1); + const int x_291 = stack[x_288]; + h_1 = x_291; + const int x_292 = top; + top = (x_292 - 1); + const int x_295 = stack[x_292]; + l_1 = x_295; + param_4 = l_1; + param_5 = h_1; + const int x_298 = performPartition_i1_i1_(param_4, param_5); + p = x_298; + if (((p - 1) > l_1)) { + const int x_306 = (top + 1); + top = x_306; + stack[x_306] = l_1; + const int x_310 = (top + 1); + top = x_310; + stack[x_310] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_321 = (top + 1); + top = x_321; + stack[x_321] = (p + 1); + const int x_326 = (top + 1); + top = x_326; + stack[x_326] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_92 = i_2; + const int x_95 = obj.numbers[i_2]; + const int x_98 = obj.numbers[i_2]; + obj.numbers[x_92] = (x_95 * x_98); + } + } + quicksort_(); + const float4 x_104 = gl_FragCoord; + const float2 x_107 = asfloat(x_32[0].xy); + uv = (float2(x_104.x, x_104.y) / x_107); + color = float3(1.0f, 2.0f, 3.0f); + const int x_110 = obj.numbers[0]; + const float x_113 = color.x; + color.x = (x_113 + float(x_110)); + const float x_117 = uv.x; + if ((x_117 > 0.25f)) { + const int x_122 = obj.numbers[1]; + const float x_125 = color.x; + color.x = (x_125 + float(x_122)); + } + const float x_129 = uv.x; + if ((x_129 > 0.5f)) { + const int x_134 = obj.numbers[2]; + const float x_137 = color.y; + color.y = (x_137 + float(x_134)); + } + const float x_141 = uv.x; + if ((x_141 > 0.75f)) { + const int x_146 = obj.numbers[3]; + const float x_149 = color.z; + color.z = (x_149 + float(x_146)); + } + const int x_153 = obj.numbers[4]; + const float x_156 = color.y; + color.y = (x_156 + float(x_153)); + const float x_160 = uv.y; + if ((x_160 > 0.25f)) { + const int x_165 = obj.numbers[5]; + const float x_168 = color.x; + color.x = (x_168 + float(x_165)); + } + const float x_172 = uv.y; + if ((x_172 > 0.5f)) { + const int x_177 = obj.numbers[6]; + const float x_180 = color.y; + color.y = (x_180 + float(x_177)); + } + const float x_184 = uv.y; + if ((x_184 > 0.75f)) { + const int x_189 = obj.numbers[7]; + const float x_192 = color.z; + color.z = (x_192 + float(x_189)); + } + const int x_196 = obj.numbers[8]; + const float x_199 = color.z; + color.z = (x_199 + float(x_196)); + const float x_203 = uv.x; + const float x_205 = uv.y; + if ((abs((x_203 - x_205)) < 0.25f)) { + const int x_212 = obj.numbers[9]; + const float x_215 = color.x; + color.x = (x_215 + float(x_212)); + } + const float3 x_219 = normalize(color); + x_GLF_color = float4(x_219.x, x_219.y, x_219.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..7cd8892031 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.msl @@ -0,0 +1,256 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_5) { + int temp = 0; + int const x_225 = *(i); + int const x_227 = (*(tint_symbol_5)).numbers.arr[x_225]; + temp = x_227; + int const x_228 = *(i); + int const x_229 = *(j); + int const x_231 = (*(tint_symbol_5)).numbers.arr[x_229]; + (*(tint_symbol_5)).numbers.arr[x_228] = x_231; + int const x_233 = *(j); + int const x_234 = temp; + (*(tint_symbol_5)).numbers.arr[x_233] = x_234; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_6) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_237 = *(h); + int const x_239 = (*(tint_symbol_6)).numbers.arr[x_237]; + pivot = x_239; + int const x_240 = *(l); + i_1 = (x_240 - 1); + int const x_242 = *(l); + j_1 = x_242; + while (true) { + int const x_247 = j_1; + int const x_248 = *(h); + if ((x_247 <= (x_248 - 1))) { + } else { + break; + } + int const x_252 = j_1; + int const x_254 = (*(tint_symbol_6)).numbers.arr[x_252]; + int const x_255 = pivot; + if ((x_254 <= x_255)) { + int const x_259 = i_1; + i_1 = (x_259 + 1); + int const x_261 = i_1; + param = x_261; + int const x_262 = j_1; + param_1 = x_262; + swap_i1_i1_(&(param), &(param_1), tint_symbol_6); + } + { + int const x_264 = j_1; + j_1 = (x_264 + 1); + } + } + int const x_266 = i_1; + i_1 = (x_266 + 1); + int const x_268 = i_1; + param_2 = x_268; + int const x_269 = *(h); + param_3 = x_269; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_6); + int const x_271 = i_1; + return x_271; +} + +void quicksort_(thread QuicksortObject* const tint_symbol_7) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_273 = top; + int const x_274 = (x_273 + 1); + top = x_274; + int const x_275 = l_1; + stack.arr[x_274] = x_275; + int const x_277 = top; + int const x_278 = (x_277 + 1); + top = x_278; + int const x_279 = h_1; + stack.arr[x_278] = x_279; + while (true) { + int const x_285 = top; + if ((x_285 >= 0)) { + } else { + break; + } + int const x_288 = top; + top = (x_288 - 1); + int const x_291 = stack.arr[x_288]; + h_1 = x_291; + int const x_292 = top; + top = (x_292 - 1); + int const x_295 = stack.arr[x_292]; + l_1 = x_295; + int const x_296 = l_1; + param_4 = x_296; + int const x_297 = h_1; + param_5 = x_297; + int const x_298 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_7); + p = x_298; + int const x_299 = p; + int const x_301 = l_1; + if (((x_299 - 1) > x_301)) { + int const x_305 = top; + int const x_306 = (x_305 + 1); + top = x_306; + int const x_307 = l_1; + stack.arr[x_306] = x_307; + int const x_309 = top; + int const x_310 = (x_309 + 1); + top = x_310; + int const x_311 = p; + stack.arr[x_310] = (x_311 - 1); + } + int const x_314 = p; + int const x_316 = h_1; + if (((x_314 + 1) < x_316)) { + int const x_320 = top; + int const x_321 = (x_320 + 1); + top = x_321; + int const x_322 = p; + stack.arr[x_321] = (x_322 + 1); + int const x_325 = top; + int const x_326 = (x_325 + 1); + top = x_326; + int const x_327 = h_1; + stack.arr[x_326] = x_327; + } + } + return; +} + +void main_1(constant buf0& x_32, thread QuicksortObject* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + i_2 = 0; + while (true) { + int const x_85 = i_2; + if ((x_85 < 10)) { + } else { + break; + } + int const x_88 = i_2; + int const x_89 = i_2; + (*(tint_symbol_8)).numbers.arr[x_88] = (10 - x_89); + int const x_92 = i_2; + int const x_93 = i_2; + int const x_95 = (*(tint_symbol_8)).numbers.arr[x_93]; + int const x_96 = i_2; + int const x_98 = (*(tint_symbol_8)).numbers.arr[x_96]; + (*(tint_symbol_8)).numbers.arr[x_92] = (x_95 * x_98); + { + int const x_101 = i_2; + i_2 = (x_101 + 1); + } + } + quicksort_(tint_symbol_8); + float4 const x_104 = *(tint_symbol_9); + float2 const x_107 = x_32.resolution; + uv = (float2(x_104.x, x_104.y) / x_107); + color = float3(1.0f, 2.0f, 3.0f); + int const x_110 = (*(tint_symbol_8)).numbers.arr[0]; + float const x_113 = color.x; + color.x = (x_113 + float(x_110)); + float const x_117 = uv.x; + if ((x_117 > 0.25f)) { + int const x_122 = (*(tint_symbol_8)).numbers.arr[1]; + float const x_125 = color.x; + color.x = (x_125 + float(x_122)); + } + float const x_129 = uv.x; + if ((x_129 > 0.5f)) { + int const x_134 = (*(tint_symbol_8)).numbers.arr[2]; + float const x_137 = color.y; + color.y = (x_137 + float(x_134)); + } + float const x_141 = uv.x; + if ((x_141 > 0.75f)) { + int const x_146 = (*(tint_symbol_8)).numbers.arr[3]; + float const x_149 = color.z; + color.z = (x_149 + float(x_146)); + } + int const x_153 = (*(tint_symbol_8)).numbers.arr[4]; + float const x_156 = color.y; + color.y = (x_156 + float(x_153)); + float const x_160 = uv.y; + if ((x_160 > 0.25f)) { + int const x_165 = (*(tint_symbol_8)).numbers.arr[5]; + float const x_168 = color.x; + color.x = (x_168 + float(x_165)); + } + float const x_172 = uv.y; + if ((x_172 > 0.5f)) { + int const x_177 = (*(tint_symbol_8)).numbers.arr[6]; + float const x_180 = color.y; + color.y = (x_180 + float(x_177)); + } + float const x_184 = uv.y; + if ((x_184 > 0.75f)) { + int const x_189 = (*(tint_symbol_8)).numbers.arr[7]; + float const x_192 = color.z; + color.z = (x_192 + float(x_189)); + } + int const x_196 = (*(tint_symbol_8)).numbers.arr[8]; + float const x_199 = color.z; + color.z = (x_199 + float(x_196)); + float const x_203 = uv.x; + float const x_205 = uv.y; + if ((fabs((x_203 - x_205)) < 0.25f)) { + int const x_212 = (*(tint_symbol_8)).numbers.arr[9]; + float const x_215 = color.x; + color.x = (x_215 + float(x_212)); + } + float3 const x_218 = color; + float3 const x_219 = normalize(x_218); + *(tint_symbol_10) = float4(x_219.x, x_219.y, x_219.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_32 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread QuicksortObject tint_symbol_12 = {}; + thread float4 tint_symbol_13 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_32, &(tint_symbol_12), &(tint_symbol_11), &(tint_symbol_13)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..dfd34c594b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.spvasm @@ -0,0 +1,541 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 374 +; Schema: 0 + OpCapability Shader + %343 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_32 "x_32" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_32 NonWritable + OpDecorate %x_32 DescriptorSet 0 + OpDecorate %x_32 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %8 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %13 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_32 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %31 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %49 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %109 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %117 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %189 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %193 = OpConstantNull %v3float + %int_10 = OpConstant %int 10 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %231 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float + %361 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %23 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %29 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %31 + %33 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Private_int %obj %uint_0 %33 + %37 = OpLoad %int %36 + OpStore %temp %37 + %39 = OpLoad %int %i + %41 = OpLoad %int %j + %42 = OpAccessChain %_ptr_Private_int %obj %uint_0 %41 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Private_int %obj %uint_0 %39 + OpStore %44 %43 + %46 = OpLoad %int %j + %47 = OpLoad %int %temp + %48 = OpAccessChain %_ptr_Private_int %obj %uint_0 %46 + OpStore %48 %47 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %49 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %53 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %31 + %i_1 = OpVariable %_ptr_Function_int Function %31 + %j_1 = OpVariable %_ptr_Function_int Function %31 + %param = OpVariable %_ptr_Function_int Function %31 + %param_1 = OpVariable %_ptr_Function_int Function %31 + %param_2 = OpVariable %_ptr_Function_int Function %31 + %param_3 = OpVariable %_ptr_Function_int Function %31 + %62 = OpLoad %int %h + %63 = OpAccessChain %_ptr_Private_int %obj %uint_0 %62 + %64 = OpLoad %int %63 + OpStore %pivot %64 + %66 = OpLoad %int %l + %68 = OpISub %int %66 %int_1 + OpStore %i_1 %68 + %70 = OpLoad %int %l + OpStore %j_1 %70 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %int %j_1 + %77 = OpLoad %int %h + %78 = OpISub %int %77 %int_1 + %79 = OpSLessThanEqual %bool %75 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %72 + %81 = OpLabel + %84 = OpLoad %int %j_1 + %85 = OpAccessChain %_ptr_Private_int %obj %uint_0 %84 + %86 = OpLoad %int %85 + %87 = OpLoad %int %pivot + %88 = OpSLessThanEqual %bool %86 %87 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + %91 = OpLoad %int %i_1 + %92 = OpIAdd %int %91 %int_1 + OpStore %i_1 %92 + %93 = OpLoad %int %i_1 + OpStore %param %93 + %94 = OpLoad %int %j_1 + OpStore %param_1 %94 + %95 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %89 + %89 = OpLabel + OpBranch %73 + %73 = OpLabel + %98 = OpLoad %int %j_1 + %99 = OpIAdd %int %98 %int_1 + OpStore %j_1 %99 + OpBranch %71 + %72 = OpLabel + %100 = OpLoad %int %i_1 + %101 = OpIAdd %int %100 %int_1 + OpStore %i_1 %101 + %102 = OpLoad %int %i_1 + OpStore %param_2 %102 + %104 = OpLoad %int %h + OpStore %param_3 %104 + %105 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %108 = OpLoad %int %i_1 + OpReturnValue %108 + OpFunctionEnd + %quicksort_ = OpFunction %void None %109 + %111 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %31 + %h_1 = OpVariable %_ptr_Function_int Function %31 + %top = OpVariable %_ptr_Function_int Function %31 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %117 + %p = OpVariable %_ptr_Function_int Function %31 + %param_4 = OpVariable %_ptr_Function_int Function %31 + %param_5 = OpVariable %_ptr_Function_int Function %31 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %124 = OpLoad %int %top + %125 = OpIAdd %int %124 %int_1 + OpStore %top %125 + %126 = OpLoad %int %l_1 + %127 = OpAccessChain %_ptr_Function_int %stack %125 + OpStore %127 %126 + %128 = OpLoad %int %top + %129 = OpIAdd %int %128 %int_1 + OpStore %top %129 + %130 = OpLoad %int %h_1 + %131 = OpAccessChain %_ptr_Function_int %stack %129 + OpStore %131 %130 + OpBranch %132 + %132 = OpLabel + OpLoopMerge %133 %134 None + OpBranch %135 + %135 = OpLabel + %136 = OpLoad %int %top + %137 = OpSGreaterThanEqual %bool %136 %int_0 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %140 + %139 = OpLabel + OpBranch %138 + %140 = OpLabel + OpBranch %133 + %138 = OpLabel + %141 = OpLoad %int %top + %142 = OpISub %int %141 %int_1 + OpStore %top %142 + %143 = OpAccessChain %_ptr_Function_int %stack %141 + %144 = OpLoad %int %143 + OpStore %h_1 %144 + %145 = OpLoad %int %top + %146 = OpISub %int %145 %int_1 + OpStore %top %146 + %147 = OpAccessChain %_ptr_Function_int %stack %145 + %148 = OpLoad %int %147 + OpStore %l_1 %148 + %149 = OpLoad %int %l_1 + OpStore %param_4 %149 + %150 = OpLoad %int %h_1 + OpStore %param_5 %150 + %151 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %151 + %154 = OpLoad %int %p + %155 = OpLoad %int %l_1 + %156 = OpISub %int %154 %int_1 + %157 = OpSGreaterThan %bool %156 %155 + OpSelectionMerge %158 None + OpBranchConditional %157 %159 %158 + %159 = OpLabel + %160 = OpLoad %int %top + %161 = OpIAdd %int %160 %int_1 + OpStore %top %161 + %162 = OpLoad %int %l_1 + %163 = OpAccessChain %_ptr_Function_int %stack %161 + OpStore %163 %162 + %164 = OpLoad %int %top + %165 = OpIAdd %int %164 %int_1 + OpStore %top %165 + %166 = OpLoad %int %p + %167 = OpAccessChain %_ptr_Function_int %stack %165 + %168 = OpISub %int %166 %int_1 + OpStore %167 %168 + OpBranch %158 + %158 = OpLabel + %169 = OpLoad %int %p + %170 = OpLoad %int %h_1 + %171 = OpIAdd %int %169 %int_1 + %172 = OpSLessThan %bool %171 %170 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %173 + %174 = OpLabel + %175 = OpLoad %int %top + %176 = OpIAdd %int %175 %int_1 + OpStore %top %176 + %177 = OpLoad %int %p + %178 = OpAccessChain %_ptr_Function_int %stack %176 + %179 = OpIAdd %int %177 %int_1 + OpStore %178 %179 + %180 = OpLoad %int %top + %181 = OpIAdd %int %180 %int_1 + OpStore %top %181 + %182 = OpLoad %int %h_1 + %183 = OpAccessChain %_ptr_Function_int %stack %181 + OpStore %183 %182 + OpBranch %173 + %173 = OpLabel + OpBranch %134 + %134 = OpLabel + OpBranch %132 + %133 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %109 + %185 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %31 + %uv = OpVariable %_ptr_Function_v2float Function %189 + %color = OpVariable %_ptr_Function_v3float Function %193 + OpStore %i_2 %int_0 + OpBranch %194 + %194 = OpLabel + OpLoopMerge %195 %196 None + OpBranch %197 + %197 = OpLabel + %198 = OpLoad %int %i_2 + %200 = OpSLessThan %bool %198 %int_10 + OpSelectionMerge %201 None + OpBranchConditional %200 %202 %203 + %202 = OpLabel + OpBranch %201 + %203 = OpLabel + OpBranch %195 + %201 = OpLabel + %204 = OpLoad %int %i_2 + %205 = OpLoad %int %i_2 + %206 = OpAccessChain %_ptr_Private_int %obj %uint_0 %204 + %207 = OpISub %int %int_10 %205 + OpStore %206 %207 + %208 = OpLoad %int %i_2 + %209 = OpLoad %int %i_2 + %210 = OpAccessChain %_ptr_Private_int %obj %uint_0 %209 + %211 = OpLoad %int %210 + %212 = OpLoad %int %i_2 + %213 = OpAccessChain %_ptr_Private_int %obj %uint_0 %212 + %214 = OpLoad %int %213 + %215 = OpAccessChain %_ptr_Private_int %obj %uint_0 %208 + %216 = OpIMul %int %211 %214 + OpStore %215 %216 + OpBranch %196 + %196 = OpLabel + %217 = OpLoad %int %i_2 + %218 = OpIAdd %int %217 %int_1 + OpStore %i_2 %218 + OpBranch %194 + %195 = OpLabel + %219 = OpFunctionCall %void %quicksort_ + %220 = OpLoad %v4float %gl_FragCoord + %222 = OpAccessChain %_ptr_Uniform_v2float %x_32 %uint_0 + %223 = OpLoad %v2float %222 + %224 = OpCompositeExtract %float %220 0 + %225 = OpCompositeExtract %float %220 1 + %226 = OpCompositeConstruct %v2float %224 %225 + %227 = OpFDiv %v2float %226 %223 + OpStore %uv %227 + OpStore %color %231 + %232 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %233 = OpLoad %int %232 + %235 = OpAccessChain %_ptr_Function_float %color %uint_0 + %236 = OpLoad %float %235 + %237 = OpAccessChain %_ptr_Function_float %color %uint_0 + %238 = OpConvertSToF %float %233 + %239 = OpFAdd %float %236 %238 + OpStore %237 %239 + %240 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %241 = OpLoad %float %240 + %243 = OpFOrdGreaterThan %bool %241 %float_0_25 + OpSelectionMerge %244 None + OpBranchConditional %243 %245 %244 + %245 = OpLabel + %246 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %247 = OpLoad %int %246 + %248 = OpAccessChain %_ptr_Function_float %color %uint_0 + %249 = OpLoad %float %248 + %250 = OpAccessChain %_ptr_Function_float %color %uint_0 + %251 = OpConvertSToF %float %247 + %252 = OpFAdd %float %249 %251 + OpStore %250 %252 + OpBranch %244 + %244 = OpLabel + %253 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %254 = OpLoad %float %253 + %256 = OpFOrdGreaterThan %bool %254 %float_0_5 + OpSelectionMerge %257 None + OpBranchConditional %256 %258 %257 + %258 = OpLabel + %260 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %261 = OpLoad %int %260 + %263 = OpAccessChain %_ptr_Function_float %color %uint_1 + %264 = OpLoad %float %263 + %265 = OpAccessChain %_ptr_Function_float %color %uint_1 + %266 = OpConvertSToF %float %261 + %267 = OpFAdd %float %264 %266 + OpStore %265 %267 + OpBranch %257 + %257 = OpLabel + %268 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %269 = OpLoad %float %268 + %271 = OpFOrdGreaterThan %bool %269 %float_0_75 + OpSelectionMerge %272 None + OpBranchConditional %271 %273 %272 + %273 = OpLabel + %275 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %276 = OpLoad %int %275 + %278 = OpAccessChain %_ptr_Function_float %color %uint_2 + %279 = OpLoad %float %278 + %280 = OpAccessChain %_ptr_Function_float %color %uint_2 + %281 = OpConvertSToF %float %276 + %282 = OpFAdd %float %279 %281 + OpStore %280 %282 + OpBranch %272 + %272 = OpLabel + %284 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %285 = OpLoad %int %284 + %286 = OpAccessChain %_ptr_Function_float %color %uint_1 + %287 = OpLoad %float %286 + %288 = OpAccessChain %_ptr_Function_float %color %uint_1 + %289 = OpConvertSToF %float %285 + %290 = OpFAdd %float %287 %289 + OpStore %288 %290 + %291 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %292 = OpLoad %float %291 + %293 = OpFOrdGreaterThan %bool %292 %float_0_25 + OpSelectionMerge %294 None + OpBranchConditional %293 %295 %294 + %295 = OpLabel + %297 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %298 = OpLoad %int %297 + %299 = OpAccessChain %_ptr_Function_float %color %uint_0 + %300 = OpLoad %float %299 + %301 = OpAccessChain %_ptr_Function_float %color %uint_0 + %302 = OpConvertSToF %float %298 + %303 = OpFAdd %float %300 %302 + OpStore %301 %303 + OpBranch %294 + %294 = OpLabel + %304 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %305 = OpLoad %float %304 + %306 = OpFOrdGreaterThan %bool %305 %float_0_5 + OpSelectionMerge %307 None + OpBranchConditional %306 %308 %307 + %308 = OpLabel + %310 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %311 = OpLoad %int %310 + %312 = OpAccessChain %_ptr_Function_float %color %uint_1 + %313 = OpLoad %float %312 + %314 = OpAccessChain %_ptr_Function_float %color %uint_1 + %315 = OpConvertSToF %float %311 + %316 = OpFAdd %float %313 %315 + OpStore %314 %316 + OpBranch %307 + %307 = OpLabel + %317 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %318 = OpLoad %float %317 + %319 = OpFOrdGreaterThan %bool %318 %float_0_75 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %320 + %321 = OpLabel + %323 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %324 = OpLoad %int %323 + %325 = OpAccessChain %_ptr_Function_float %color %uint_2 + %326 = OpLoad %float %325 + %327 = OpAccessChain %_ptr_Function_float %color %uint_2 + %328 = OpConvertSToF %float %324 + %329 = OpFAdd %float %326 %328 + OpStore %327 %329 + OpBranch %320 + %320 = OpLabel + %331 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %332 = OpLoad %int %331 + %333 = OpAccessChain %_ptr_Function_float %color %uint_2 + %334 = OpLoad %float %333 + %335 = OpAccessChain %_ptr_Function_float %color %uint_2 + %336 = OpConvertSToF %float %332 + %337 = OpFAdd %float %334 %336 + OpStore %335 %337 + %338 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %339 = OpLoad %float %338 + %340 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %341 = OpLoad %float %340 + %344 = OpFSub %float %339 %341 + %342 = OpExtInst %float %343 FAbs %344 + %345 = OpFOrdLessThan %bool %342 %float_0_25 + OpSelectionMerge %346 None + OpBranchConditional %345 %347 %346 + %347 = OpLabel + %348 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %349 = OpLoad %int %348 + %350 = OpAccessChain %_ptr_Function_float %color %uint_0 + %351 = OpLoad %float %350 + %352 = OpAccessChain %_ptr_Function_float %color %uint_0 + %353 = OpConvertSToF %float %349 + %354 = OpFAdd %float %351 %353 + OpStore %352 %354 + OpBranch %346 + %346 = OpLabel + %355 = OpLoad %v3float %color + %356 = OpExtInst %v3float %343 Normalize %355 + %357 = OpCompositeExtract %float %356 0 + %358 = OpCompositeExtract %float %356 1 + %359 = OpCompositeExtract %float %356 2 + %360 = OpCompositeConstruct %v4float %357 %358 %359 %float_1 + OpStore %x_GLF_color %360 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %361 +%tint_symbol_1 = OpFunctionParameter %main_out + %365 = OpLabel + %366 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %366 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %109 + %368 = OpLabel + %369 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %369 + %370 = OpFunctionCall %void %main_1 + %372 = OpLoad %v4float %x_GLF_color + %373 = OpCompositeConstruct %main_out %372 + %371 = OpFunctionCall %void %tint_symbol_3 %373 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..df70a1de43 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.wgsl @@ -0,0 +1,256 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_32 : buf0; + +var x_GLF_color : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_225 : i32 = *(i); + let x_227 : i32 = obj.numbers[x_225]; + temp = x_227; + let x_228 : i32 = *(i); + let x_229 : i32 = *(j); + let x_231 : i32 = obj.numbers[x_229]; + obj.numbers[x_228] = x_231; + let x_233 : i32 = *(j); + let x_234 : i32 = temp; + obj.numbers[x_233] = x_234; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_237 : i32 = *(h); + let x_239 : i32 = obj.numbers[x_237]; + pivot = x_239; + let x_240 : i32 = *(l); + i_1 = (x_240 - 1); + let x_242 : i32 = *(l); + j_1 = x_242; + loop { + let x_247 : i32 = j_1; + let x_248 : i32 = *(h); + if ((x_247 <= (x_248 - 1))) { + } else { + break; + } + let x_252 : i32 = j_1; + let x_254 : i32 = obj.numbers[x_252]; + let x_255 : i32 = pivot; + if ((x_254 <= x_255)) { + let x_259 : i32 = i_1; + i_1 = (x_259 + 1); + let x_261 : i32 = i_1; + param = x_261; + let x_262 : i32 = j_1; + param_1 = x_262; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_264 : i32 = j_1; + j_1 = (x_264 + 1); + } + } + let x_266 : i32 = i_1; + i_1 = (x_266 + 1); + let x_268 : i32 = i_1; + param_2 = x_268; + let x_269 : i32 = *(h); + param_3 = x_269; + swap_i1_i1_(&(param_2), &(param_3)); + let x_271 : i32 = i_1; + return x_271; +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_273 : i32 = top; + let x_274 : i32 = (x_273 + 1); + top = x_274; + let x_275 : i32 = l_1; + stack[x_274] = x_275; + let x_277 : i32 = top; + let x_278 : i32 = (x_277 + 1); + top = x_278; + let x_279 : i32 = h_1; + stack[x_278] = x_279; + loop { + let x_285 : i32 = top; + if ((x_285 >= 0)) { + } else { + break; + } + let x_288 : i32 = top; + top = (x_288 - 1); + let x_291 : i32 = stack[x_288]; + h_1 = x_291; + let x_292 : i32 = top; + top = (x_292 - 1); + let x_295 : i32 = stack[x_292]; + l_1 = x_295; + let x_296 : i32 = l_1; + param_4 = x_296; + let x_297 : i32 = h_1; + param_5 = x_297; + let x_298 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_298; + let x_299 : i32 = p; + let x_301 : i32 = l_1; + if (((x_299 - 1) > x_301)) { + let x_305 : i32 = top; + let x_306 : i32 = (x_305 + 1); + top = x_306; + let x_307 : i32 = l_1; + stack[x_306] = x_307; + let x_309 : i32 = top; + let x_310 : i32 = (x_309 + 1); + top = x_310; + let x_311 : i32 = p; + stack[x_310] = (x_311 - 1); + } + let x_314 : i32 = p; + let x_316 : i32 = h_1; + if (((x_314 + 1) < x_316)) { + let x_320 : i32 = top; + let x_321 : i32 = (x_320 + 1); + top = x_321; + let x_322 : i32 = p; + stack[x_321] = (x_322 + 1); + let x_325 : i32 = top; + let x_326 : i32 = (x_325 + 1); + top = x_326; + let x_327 : i32 = h_1; + stack[x_326] = x_327; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + i_2 = 0; + loop { + let x_85 : i32 = i_2; + if ((x_85 < 10)) { + } else { + break; + } + let x_88 : i32 = i_2; + let x_89 : i32 = i_2; + obj.numbers[x_88] = (10 - x_89); + let x_92 : i32 = i_2; + let x_93 : i32 = i_2; + let x_95 : i32 = obj.numbers[x_93]; + let x_96 : i32 = i_2; + let x_98 : i32 = obj.numbers[x_96]; + obj.numbers[x_92] = (x_95 * x_98); + + continuing { + let x_101 : i32 = i_2; + i_2 = (x_101 + 1); + } + } + quicksort_(); + let x_104 : vec4 = gl_FragCoord; + let x_107 : vec2 = x_32.resolution; + uv = (vec2(x_104.x, x_104.y) / x_107); + color = vec3(1.0, 2.0, 3.0); + let x_110 : i32 = obj.numbers[0]; + let x_113 : f32 = color.x; + color.x = (x_113 + f32(x_110)); + let x_117 : f32 = uv.x; + if ((x_117 > 0.25)) { + let x_122 : i32 = obj.numbers[1]; + let x_125 : f32 = color.x; + color.x = (x_125 + f32(x_122)); + } + let x_129 : f32 = uv.x; + if ((x_129 > 0.5)) { + let x_134 : i32 = obj.numbers[2]; + let x_137 : f32 = color.y; + color.y = (x_137 + f32(x_134)); + } + let x_141 : f32 = uv.x; + if ((x_141 > 0.75)) { + let x_146 : i32 = obj.numbers[3]; + let x_149 : f32 = color.z; + color.z = (x_149 + f32(x_146)); + } + let x_153 : i32 = obj.numbers[4]; + let x_156 : f32 = color.y; + color.y = (x_156 + f32(x_153)); + let x_160 : f32 = uv.y; + if ((x_160 > 0.25)) { + let x_165 : i32 = obj.numbers[5]; + let x_168 : f32 = color.x; + color.x = (x_168 + f32(x_165)); + } + let x_172 : f32 = uv.y; + if ((x_172 > 0.5)) { + let x_177 : i32 = obj.numbers[6]; + let x_180 : f32 = color.y; + color.y = (x_180 + f32(x_177)); + } + let x_184 : f32 = uv.y; + if ((x_184 > 0.75)) { + let x_189 : i32 = obj.numbers[7]; + let x_192 : f32 = color.z; + color.z = (x_192 + f32(x_189)); + } + let x_196 : i32 = obj.numbers[8]; + let x_199 : f32 = color.z; + color.z = (x_199 + f32(x_196)); + let x_203 : f32 = uv.x; + let x_205 : f32 = uv.y; + if ((abs((x_203 - x_205)) < 0.25)) { + let x_212 : i32 = obj.numbers[9]; + let x_215 : f32 = color.x; + color.x = (x_215 + f32(x_212)); + } + let x_218 : vec3 = color; + let x_219 : vec3 = normalize(x_218); + x_GLF_color = vec4(x_219.x, x_219.y, x_219.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl new file mode 100644 index 0000000000..df70a1de43 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl @@ -0,0 +1,256 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_32 : buf0; + +var x_GLF_color : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_225 : i32 = *(i); + let x_227 : i32 = obj.numbers[x_225]; + temp = x_227; + let x_228 : i32 = *(i); + let x_229 : i32 = *(j); + let x_231 : i32 = obj.numbers[x_229]; + obj.numbers[x_228] = x_231; + let x_233 : i32 = *(j); + let x_234 : i32 = temp; + obj.numbers[x_233] = x_234; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_237 : i32 = *(h); + let x_239 : i32 = obj.numbers[x_237]; + pivot = x_239; + let x_240 : i32 = *(l); + i_1 = (x_240 - 1); + let x_242 : i32 = *(l); + j_1 = x_242; + loop { + let x_247 : i32 = j_1; + let x_248 : i32 = *(h); + if ((x_247 <= (x_248 - 1))) { + } else { + break; + } + let x_252 : i32 = j_1; + let x_254 : i32 = obj.numbers[x_252]; + let x_255 : i32 = pivot; + if ((x_254 <= x_255)) { + let x_259 : i32 = i_1; + i_1 = (x_259 + 1); + let x_261 : i32 = i_1; + param = x_261; + let x_262 : i32 = j_1; + param_1 = x_262; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_264 : i32 = j_1; + j_1 = (x_264 + 1); + } + } + let x_266 : i32 = i_1; + i_1 = (x_266 + 1); + let x_268 : i32 = i_1; + param_2 = x_268; + let x_269 : i32 = *(h); + param_3 = x_269; + swap_i1_i1_(&(param_2), &(param_3)); + let x_271 : i32 = i_1; + return x_271; +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_273 : i32 = top; + let x_274 : i32 = (x_273 + 1); + top = x_274; + let x_275 : i32 = l_1; + stack[x_274] = x_275; + let x_277 : i32 = top; + let x_278 : i32 = (x_277 + 1); + top = x_278; + let x_279 : i32 = h_1; + stack[x_278] = x_279; + loop { + let x_285 : i32 = top; + if ((x_285 >= 0)) { + } else { + break; + } + let x_288 : i32 = top; + top = (x_288 - 1); + let x_291 : i32 = stack[x_288]; + h_1 = x_291; + let x_292 : i32 = top; + top = (x_292 - 1); + let x_295 : i32 = stack[x_292]; + l_1 = x_295; + let x_296 : i32 = l_1; + param_4 = x_296; + let x_297 : i32 = h_1; + param_5 = x_297; + let x_298 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_298; + let x_299 : i32 = p; + let x_301 : i32 = l_1; + if (((x_299 - 1) > x_301)) { + let x_305 : i32 = top; + let x_306 : i32 = (x_305 + 1); + top = x_306; + let x_307 : i32 = l_1; + stack[x_306] = x_307; + let x_309 : i32 = top; + let x_310 : i32 = (x_309 + 1); + top = x_310; + let x_311 : i32 = p; + stack[x_310] = (x_311 - 1); + } + let x_314 : i32 = p; + let x_316 : i32 = h_1; + if (((x_314 + 1) < x_316)) { + let x_320 : i32 = top; + let x_321 : i32 = (x_320 + 1); + top = x_321; + let x_322 : i32 = p; + stack[x_321] = (x_322 + 1); + let x_325 : i32 = top; + let x_326 : i32 = (x_325 + 1); + top = x_326; + let x_327 : i32 = h_1; + stack[x_326] = x_327; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + i_2 = 0; + loop { + let x_85 : i32 = i_2; + if ((x_85 < 10)) { + } else { + break; + } + let x_88 : i32 = i_2; + let x_89 : i32 = i_2; + obj.numbers[x_88] = (10 - x_89); + let x_92 : i32 = i_2; + let x_93 : i32 = i_2; + let x_95 : i32 = obj.numbers[x_93]; + let x_96 : i32 = i_2; + let x_98 : i32 = obj.numbers[x_96]; + obj.numbers[x_92] = (x_95 * x_98); + + continuing { + let x_101 : i32 = i_2; + i_2 = (x_101 + 1); + } + } + quicksort_(); + let x_104 : vec4 = gl_FragCoord; + let x_107 : vec2 = x_32.resolution; + uv = (vec2(x_104.x, x_104.y) / x_107); + color = vec3(1.0, 2.0, 3.0); + let x_110 : i32 = obj.numbers[0]; + let x_113 : f32 = color.x; + color.x = (x_113 + f32(x_110)); + let x_117 : f32 = uv.x; + if ((x_117 > 0.25)) { + let x_122 : i32 = obj.numbers[1]; + let x_125 : f32 = color.x; + color.x = (x_125 + f32(x_122)); + } + let x_129 : f32 = uv.x; + if ((x_129 > 0.5)) { + let x_134 : i32 = obj.numbers[2]; + let x_137 : f32 = color.y; + color.y = (x_137 + f32(x_134)); + } + let x_141 : f32 = uv.x; + if ((x_141 > 0.75)) { + let x_146 : i32 = obj.numbers[3]; + let x_149 : f32 = color.z; + color.z = (x_149 + f32(x_146)); + } + let x_153 : i32 = obj.numbers[4]; + let x_156 : f32 = color.y; + color.y = (x_156 + f32(x_153)); + let x_160 : f32 = uv.y; + if ((x_160 > 0.25)) { + let x_165 : i32 = obj.numbers[5]; + let x_168 : f32 = color.x; + color.x = (x_168 + f32(x_165)); + } + let x_172 : f32 = uv.y; + if ((x_172 > 0.5)) { + let x_177 : i32 = obj.numbers[6]; + let x_180 : f32 = color.y; + color.y = (x_180 + f32(x_177)); + } + let x_184 : f32 = uv.y; + if ((x_184 > 0.75)) { + let x_189 : i32 = obj.numbers[7]; + let x_192 : f32 = color.z; + color.z = (x_192 + f32(x_189)); + } + let x_196 : i32 = obj.numbers[8]; + let x_199 : f32 = color.z; + color.z = (x_199 + f32(x_196)); + let x_203 : f32 = uv.x; + let x_205 : f32 = uv.y; + if ((abs((x_203 - x_205)) < 0.25)) { + let x_212 : i32 = obj.numbers[9]; + let x_215 : f32 = color.x; + color.x = (x_215 + f32(x_212)); + } + let x_218 : vec3 = color; + let x_219 : vec3 = normalize(x_218); + x_GLF_color = vec4(x_219.x, x_219.y, x_219.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..18cfa065aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.hlsl @@ -0,0 +1,214 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_32 : register(b0, space0) { + uint4 x_32[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_225 = i; + const int x_227 = obj.numbers[x_225]; + temp = x_227; + const int x_228 = i; + const int x_229 = j; + const int x_231 = obj.numbers[x_229]; + obj.numbers[x_228] = x_231; + const int x_233 = j; + obj.numbers[x_233] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_237 = h; + const int x_239 = obj.numbers[x_237]; + pivot = x_239; + const int x_240 = l; + i_1 = (x_240 - 1); + const int x_242 = l; + j_1 = x_242; + while (true) { + const int x_247 = j_1; + const int x_248 = h; + if ((x_247 <= (x_248 - 1))) { + } else { + break; + } + const int x_254 = obj.numbers[j_1]; + if ((x_254 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + i_1 = (i_1 + 1); + param_2 = i_1; + const int x_269 = h; + param_3 = x_269; + swap_i1_i1_(param_2, param_3); + return i_1; +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_274 = (top + 1); + top = x_274; + stack[x_274] = l_1; + const int x_278 = (top + 1); + top = x_278; + stack[x_278] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_288 = top; + top = (x_288 - 1); + const int x_291 = stack[x_288]; + h_1 = x_291; + const int x_292 = top; + top = (x_292 - 1); + const int x_295 = stack[x_292]; + l_1 = x_295; + param_4 = l_1; + param_5 = h_1; + const int x_298 = performPartition_i1_i1_(param_4, param_5); + p = x_298; + if (((p - 1) > l_1)) { + const int x_306 = (top + 1); + top = x_306; + stack[x_306] = l_1; + const int x_310 = (top + 1); + top = x_310; + stack[x_310] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_321 = (top + 1); + top = x_321; + stack[x_321] = (p + 1); + const int x_326 = (top + 1); + top = x_326; + stack[x_326] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_92 = i_2; + const int x_95 = obj.numbers[i_2]; + const int x_98 = obj.numbers[i_2]; + obj.numbers[x_92] = (x_95 * x_98); + } + } + quicksort_(); + const float4 x_104 = gl_FragCoord; + const float2 x_107 = asfloat(x_32[0].xy); + uv = (float2(x_104.x, x_104.y) / x_107); + color = float3(1.0f, 2.0f, 3.0f); + const int x_110 = obj.numbers[0]; + const float x_113 = color.x; + color.x = (x_113 + float(x_110)); + const float x_117 = uv.x; + if ((x_117 > 0.25f)) { + const int x_122 = obj.numbers[1]; + const float x_125 = color.x; + color.x = (x_125 + float(x_122)); + } + const float x_129 = uv.x; + if ((x_129 > 0.5f)) { + const int x_134 = obj.numbers[2]; + const float x_137 = color.y; + color.y = (x_137 + float(x_134)); + } + const float x_141 = uv.x; + if ((x_141 > 0.75f)) { + const int x_146 = obj.numbers[3]; + const float x_149 = color.z; + color.z = (x_149 + float(x_146)); + } + const int x_153 = obj.numbers[4]; + const float x_156 = color.y; + color.y = (x_156 + float(x_153)); + const float x_160 = uv.y; + if ((x_160 > 0.25f)) { + const int x_165 = obj.numbers[5]; + const float x_168 = color.x; + color.x = (x_168 + float(x_165)); + } + const float x_172 = uv.y; + if ((x_172 > 0.5f)) { + const int x_177 = obj.numbers[6]; + const float x_180 = color.y; + color.y = (x_180 + float(x_177)); + } + const float x_184 = uv.y; + if ((x_184 > 0.75f)) { + const int x_189 = obj.numbers[7]; + const float x_192 = color.z; + color.z = (x_192 + float(x_189)); + } + const int x_196 = obj.numbers[8]; + const float x_199 = color.z; + color.z = (x_199 + float(x_196)); + const float x_203 = uv.x; + const float x_205 = uv.y; + if ((abs((x_203 - x_205)) < 0.25f)) { + const int x_212 = obj.numbers[9]; + const float x_215 = color.x; + color.x = (x_215 + float(x_212)); + } + const float3 x_219 = normalize(color); + x_GLF_color = float4(x_219.x, x_219.y, x_219.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..7cd8892031 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.msl @@ -0,0 +1,256 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_5) { + int temp = 0; + int const x_225 = *(i); + int const x_227 = (*(tint_symbol_5)).numbers.arr[x_225]; + temp = x_227; + int const x_228 = *(i); + int const x_229 = *(j); + int const x_231 = (*(tint_symbol_5)).numbers.arr[x_229]; + (*(tint_symbol_5)).numbers.arr[x_228] = x_231; + int const x_233 = *(j); + int const x_234 = temp; + (*(tint_symbol_5)).numbers.arr[x_233] = x_234; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_6) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_237 = *(h); + int const x_239 = (*(tint_symbol_6)).numbers.arr[x_237]; + pivot = x_239; + int const x_240 = *(l); + i_1 = (x_240 - 1); + int const x_242 = *(l); + j_1 = x_242; + while (true) { + int const x_247 = j_1; + int const x_248 = *(h); + if ((x_247 <= (x_248 - 1))) { + } else { + break; + } + int const x_252 = j_1; + int const x_254 = (*(tint_symbol_6)).numbers.arr[x_252]; + int const x_255 = pivot; + if ((x_254 <= x_255)) { + int const x_259 = i_1; + i_1 = (x_259 + 1); + int const x_261 = i_1; + param = x_261; + int const x_262 = j_1; + param_1 = x_262; + swap_i1_i1_(&(param), &(param_1), tint_symbol_6); + } + { + int const x_264 = j_1; + j_1 = (x_264 + 1); + } + } + int const x_266 = i_1; + i_1 = (x_266 + 1); + int const x_268 = i_1; + param_2 = x_268; + int const x_269 = *(h); + param_3 = x_269; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_6); + int const x_271 = i_1; + return x_271; +} + +void quicksort_(thread QuicksortObject* const tint_symbol_7) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_273 = top; + int const x_274 = (x_273 + 1); + top = x_274; + int const x_275 = l_1; + stack.arr[x_274] = x_275; + int const x_277 = top; + int const x_278 = (x_277 + 1); + top = x_278; + int const x_279 = h_1; + stack.arr[x_278] = x_279; + while (true) { + int const x_285 = top; + if ((x_285 >= 0)) { + } else { + break; + } + int const x_288 = top; + top = (x_288 - 1); + int const x_291 = stack.arr[x_288]; + h_1 = x_291; + int const x_292 = top; + top = (x_292 - 1); + int const x_295 = stack.arr[x_292]; + l_1 = x_295; + int const x_296 = l_1; + param_4 = x_296; + int const x_297 = h_1; + param_5 = x_297; + int const x_298 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_7); + p = x_298; + int const x_299 = p; + int const x_301 = l_1; + if (((x_299 - 1) > x_301)) { + int const x_305 = top; + int const x_306 = (x_305 + 1); + top = x_306; + int const x_307 = l_1; + stack.arr[x_306] = x_307; + int const x_309 = top; + int const x_310 = (x_309 + 1); + top = x_310; + int const x_311 = p; + stack.arr[x_310] = (x_311 - 1); + } + int const x_314 = p; + int const x_316 = h_1; + if (((x_314 + 1) < x_316)) { + int const x_320 = top; + int const x_321 = (x_320 + 1); + top = x_321; + int const x_322 = p; + stack.arr[x_321] = (x_322 + 1); + int const x_325 = top; + int const x_326 = (x_325 + 1); + top = x_326; + int const x_327 = h_1; + stack.arr[x_326] = x_327; + } + } + return; +} + +void main_1(constant buf0& x_32, thread QuicksortObject* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + i_2 = 0; + while (true) { + int const x_85 = i_2; + if ((x_85 < 10)) { + } else { + break; + } + int const x_88 = i_2; + int const x_89 = i_2; + (*(tint_symbol_8)).numbers.arr[x_88] = (10 - x_89); + int const x_92 = i_2; + int const x_93 = i_2; + int const x_95 = (*(tint_symbol_8)).numbers.arr[x_93]; + int const x_96 = i_2; + int const x_98 = (*(tint_symbol_8)).numbers.arr[x_96]; + (*(tint_symbol_8)).numbers.arr[x_92] = (x_95 * x_98); + { + int const x_101 = i_2; + i_2 = (x_101 + 1); + } + } + quicksort_(tint_symbol_8); + float4 const x_104 = *(tint_symbol_9); + float2 const x_107 = x_32.resolution; + uv = (float2(x_104.x, x_104.y) / x_107); + color = float3(1.0f, 2.0f, 3.0f); + int const x_110 = (*(tint_symbol_8)).numbers.arr[0]; + float const x_113 = color.x; + color.x = (x_113 + float(x_110)); + float const x_117 = uv.x; + if ((x_117 > 0.25f)) { + int const x_122 = (*(tint_symbol_8)).numbers.arr[1]; + float const x_125 = color.x; + color.x = (x_125 + float(x_122)); + } + float const x_129 = uv.x; + if ((x_129 > 0.5f)) { + int const x_134 = (*(tint_symbol_8)).numbers.arr[2]; + float const x_137 = color.y; + color.y = (x_137 + float(x_134)); + } + float const x_141 = uv.x; + if ((x_141 > 0.75f)) { + int const x_146 = (*(tint_symbol_8)).numbers.arr[3]; + float const x_149 = color.z; + color.z = (x_149 + float(x_146)); + } + int const x_153 = (*(tint_symbol_8)).numbers.arr[4]; + float const x_156 = color.y; + color.y = (x_156 + float(x_153)); + float const x_160 = uv.y; + if ((x_160 > 0.25f)) { + int const x_165 = (*(tint_symbol_8)).numbers.arr[5]; + float const x_168 = color.x; + color.x = (x_168 + float(x_165)); + } + float const x_172 = uv.y; + if ((x_172 > 0.5f)) { + int const x_177 = (*(tint_symbol_8)).numbers.arr[6]; + float const x_180 = color.y; + color.y = (x_180 + float(x_177)); + } + float const x_184 = uv.y; + if ((x_184 > 0.75f)) { + int const x_189 = (*(tint_symbol_8)).numbers.arr[7]; + float const x_192 = color.z; + color.z = (x_192 + float(x_189)); + } + int const x_196 = (*(tint_symbol_8)).numbers.arr[8]; + float const x_199 = color.z; + color.z = (x_199 + float(x_196)); + float const x_203 = uv.x; + float const x_205 = uv.y; + if ((fabs((x_203 - x_205)) < 0.25f)) { + int const x_212 = (*(tint_symbol_8)).numbers.arr[9]; + float const x_215 = color.x; + color.x = (x_215 + float(x_212)); + } + float3 const x_218 = color; + float3 const x_219 = normalize(x_218); + *(tint_symbol_10) = float4(x_219.x, x_219.y, x_219.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_32 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread QuicksortObject tint_symbol_12 = {}; + thread float4 tint_symbol_13 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_32, &(tint_symbol_12), &(tint_symbol_11), &(tint_symbol_13)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..dfd34c594b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.spvasm @@ -0,0 +1,541 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 374 +; Schema: 0 + OpCapability Shader + %343 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_32 "x_32" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_32 NonWritable + OpDecorate %x_32 DescriptorSet 0 + OpDecorate %x_32 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %8 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %13 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_32 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %31 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %49 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %109 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %117 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %189 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %193 = OpConstantNull %v3float + %int_10 = OpConstant %int 10 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %231 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float + %361 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %23 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %29 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %31 + %33 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Private_int %obj %uint_0 %33 + %37 = OpLoad %int %36 + OpStore %temp %37 + %39 = OpLoad %int %i + %41 = OpLoad %int %j + %42 = OpAccessChain %_ptr_Private_int %obj %uint_0 %41 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Private_int %obj %uint_0 %39 + OpStore %44 %43 + %46 = OpLoad %int %j + %47 = OpLoad %int %temp + %48 = OpAccessChain %_ptr_Private_int %obj %uint_0 %46 + OpStore %48 %47 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %49 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %53 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %31 + %i_1 = OpVariable %_ptr_Function_int Function %31 + %j_1 = OpVariable %_ptr_Function_int Function %31 + %param = OpVariable %_ptr_Function_int Function %31 + %param_1 = OpVariable %_ptr_Function_int Function %31 + %param_2 = OpVariable %_ptr_Function_int Function %31 + %param_3 = OpVariable %_ptr_Function_int Function %31 + %62 = OpLoad %int %h + %63 = OpAccessChain %_ptr_Private_int %obj %uint_0 %62 + %64 = OpLoad %int %63 + OpStore %pivot %64 + %66 = OpLoad %int %l + %68 = OpISub %int %66 %int_1 + OpStore %i_1 %68 + %70 = OpLoad %int %l + OpStore %j_1 %70 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %int %j_1 + %77 = OpLoad %int %h + %78 = OpISub %int %77 %int_1 + %79 = OpSLessThanEqual %bool %75 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %72 + %81 = OpLabel + %84 = OpLoad %int %j_1 + %85 = OpAccessChain %_ptr_Private_int %obj %uint_0 %84 + %86 = OpLoad %int %85 + %87 = OpLoad %int %pivot + %88 = OpSLessThanEqual %bool %86 %87 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + %91 = OpLoad %int %i_1 + %92 = OpIAdd %int %91 %int_1 + OpStore %i_1 %92 + %93 = OpLoad %int %i_1 + OpStore %param %93 + %94 = OpLoad %int %j_1 + OpStore %param_1 %94 + %95 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %89 + %89 = OpLabel + OpBranch %73 + %73 = OpLabel + %98 = OpLoad %int %j_1 + %99 = OpIAdd %int %98 %int_1 + OpStore %j_1 %99 + OpBranch %71 + %72 = OpLabel + %100 = OpLoad %int %i_1 + %101 = OpIAdd %int %100 %int_1 + OpStore %i_1 %101 + %102 = OpLoad %int %i_1 + OpStore %param_2 %102 + %104 = OpLoad %int %h + OpStore %param_3 %104 + %105 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %108 = OpLoad %int %i_1 + OpReturnValue %108 + OpFunctionEnd + %quicksort_ = OpFunction %void None %109 + %111 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %31 + %h_1 = OpVariable %_ptr_Function_int Function %31 + %top = OpVariable %_ptr_Function_int Function %31 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %117 + %p = OpVariable %_ptr_Function_int Function %31 + %param_4 = OpVariable %_ptr_Function_int Function %31 + %param_5 = OpVariable %_ptr_Function_int Function %31 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %124 = OpLoad %int %top + %125 = OpIAdd %int %124 %int_1 + OpStore %top %125 + %126 = OpLoad %int %l_1 + %127 = OpAccessChain %_ptr_Function_int %stack %125 + OpStore %127 %126 + %128 = OpLoad %int %top + %129 = OpIAdd %int %128 %int_1 + OpStore %top %129 + %130 = OpLoad %int %h_1 + %131 = OpAccessChain %_ptr_Function_int %stack %129 + OpStore %131 %130 + OpBranch %132 + %132 = OpLabel + OpLoopMerge %133 %134 None + OpBranch %135 + %135 = OpLabel + %136 = OpLoad %int %top + %137 = OpSGreaterThanEqual %bool %136 %int_0 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %140 + %139 = OpLabel + OpBranch %138 + %140 = OpLabel + OpBranch %133 + %138 = OpLabel + %141 = OpLoad %int %top + %142 = OpISub %int %141 %int_1 + OpStore %top %142 + %143 = OpAccessChain %_ptr_Function_int %stack %141 + %144 = OpLoad %int %143 + OpStore %h_1 %144 + %145 = OpLoad %int %top + %146 = OpISub %int %145 %int_1 + OpStore %top %146 + %147 = OpAccessChain %_ptr_Function_int %stack %145 + %148 = OpLoad %int %147 + OpStore %l_1 %148 + %149 = OpLoad %int %l_1 + OpStore %param_4 %149 + %150 = OpLoad %int %h_1 + OpStore %param_5 %150 + %151 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %151 + %154 = OpLoad %int %p + %155 = OpLoad %int %l_1 + %156 = OpISub %int %154 %int_1 + %157 = OpSGreaterThan %bool %156 %155 + OpSelectionMerge %158 None + OpBranchConditional %157 %159 %158 + %159 = OpLabel + %160 = OpLoad %int %top + %161 = OpIAdd %int %160 %int_1 + OpStore %top %161 + %162 = OpLoad %int %l_1 + %163 = OpAccessChain %_ptr_Function_int %stack %161 + OpStore %163 %162 + %164 = OpLoad %int %top + %165 = OpIAdd %int %164 %int_1 + OpStore %top %165 + %166 = OpLoad %int %p + %167 = OpAccessChain %_ptr_Function_int %stack %165 + %168 = OpISub %int %166 %int_1 + OpStore %167 %168 + OpBranch %158 + %158 = OpLabel + %169 = OpLoad %int %p + %170 = OpLoad %int %h_1 + %171 = OpIAdd %int %169 %int_1 + %172 = OpSLessThan %bool %171 %170 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %173 + %174 = OpLabel + %175 = OpLoad %int %top + %176 = OpIAdd %int %175 %int_1 + OpStore %top %176 + %177 = OpLoad %int %p + %178 = OpAccessChain %_ptr_Function_int %stack %176 + %179 = OpIAdd %int %177 %int_1 + OpStore %178 %179 + %180 = OpLoad %int %top + %181 = OpIAdd %int %180 %int_1 + OpStore %top %181 + %182 = OpLoad %int %h_1 + %183 = OpAccessChain %_ptr_Function_int %stack %181 + OpStore %183 %182 + OpBranch %173 + %173 = OpLabel + OpBranch %134 + %134 = OpLabel + OpBranch %132 + %133 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %109 + %185 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %31 + %uv = OpVariable %_ptr_Function_v2float Function %189 + %color = OpVariable %_ptr_Function_v3float Function %193 + OpStore %i_2 %int_0 + OpBranch %194 + %194 = OpLabel + OpLoopMerge %195 %196 None + OpBranch %197 + %197 = OpLabel + %198 = OpLoad %int %i_2 + %200 = OpSLessThan %bool %198 %int_10 + OpSelectionMerge %201 None + OpBranchConditional %200 %202 %203 + %202 = OpLabel + OpBranch %201 + %203 = OpLabel + OpBranch %195 + %201 = OpLabel + %204 = OpLoad %int %i_2 + %205 = OpLoad %int %i_2 + %206 = OpAccessChain %_ptr_Private_int %obj %uint_0 %204 + %207 = OpISub %int %int_10 %205 + OpStore %206 %207 + %208 = OpLoad %int %i_2 + %209 = OpLoad %int %i_2 + %210 = OpAccessChain %_ptr_Private_int %obj %uint_0 %209 + %211 = OpLoad %int %210 + %212 = OpLoad %int %i_2 + %213 = OpAccessChain %_ptr_Private_int %obj %uint_0 %212 + %214 = OpLoad %int %213 + %215 = OpAccessChain %_ptr_Private_int %obj %uint_0 %208 + %216 = OpIMul %int %211 %214 + OpStore %215 %216 + OpBranch %196 + %196 = OpLabel + %217 = OpLoad %int %i_2 + %218 = OpIAdd %int %217 %int_1 + OpStore %i_2 %218 + OpBranch %194 + %195 = OpLabel + %219 = OpFunctionCall %void %quicksort_ + %220 = OpLoad %v4float %gl_FragCoord + %222 = OpAccessChain %_ptr_Uniform_v2float %x_32 %uint_0 + %223 = OpLoad %v2float %222 + %224 = OpCompositeExtract %float %220 0 + %225 = OpCompositeExtract %float %220 1 + %226 = OpCompositeConstruct %v2float %224 %225 + %227 = OpFDiv %v2float %226 %223 + OpStore %uv %227 + OpStore %color %231 + %232 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %233 = OpLoad %int %232 + %235 = OpAccessChain %_ptr_Function_float %color %uint_0 + %236 = OpLoad %float %235 + %237 = OpAccessChain %_ptr_Function_float %color %uint_0 + %238 = OpConvertSToF %float %233 + %239 = OpFAdd %float %236 %238 + OpStore %237 %239 + %240 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %241 = OpLoad %float %240 + %243 = OpFOrdGreaterThan %bool %241 %float_0_25 + OpSelectionMerge %244 None + OpBranchConditional %243 %245 %244 + %245 = OpLabel + %246 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %247 = OpLoad %int %246 + %248 = OpAccessChain %_ptr_Function_float %color %uint_0 + %249 = OpLoad %float %248 + %250 = OpAccessChain %_ptr_Function_float %color %uint_0 + %251 = OpConvertSToF %float %247 + %252 = OpFAdd %float %249 %251 + OpStore %250 %252 + OpBranch %244 + %244 = OpLabel + %253 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %254 = OpLoad %float %253 + %256 = OpFOrdGreaterThan %bool %254 %float_0_5 + OpSelectionMerge %257 None + OpBranchConditional %256 %258 %257 + %258 = OpLabel + %260 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %261 = OpLoad %int %260 + %263 = OpAccessChain %_ptr_Function_float %color %uint_1 + %264 = OpLoad %float %263 + %265 = OpAccessChain %_ptr_Function_float %color %uint_1 + %266 = OpConvertSToF %float %261 + %267 = OpFAdd %float %264 %266 + OpStore %265 %267 + OpBranch %257 + %257 = OpLabel + %268 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %269 = OpLoad %float %268 + %271 = OpFOrdGreaterThan %bool %269 %float_0_75 + OpSelectionMerge %272 None + OpBranchConditional %271 %273 %272 + %273 = OpLabel + %275 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %276 = OpLoad %int %275 + %278 = OpAccessChain %_ptr_Function_float %color %uint_2 + %279 = OpLoad %float %278 + %280 = OpAccessChain %_ptr_Function_float %color %uint_2 + %281 = OpConvertSToF %float %276 + %282 = OpFAdd %float %279 %281 + OpStore %280 %282 + OpBranch %272 + %272 = OpLabel + %284 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %285 = OpLoad %int %284 + %286 = OpAccessChain %_ptr_Function_float %color %uint_1 + %287 = OpLoad %float %286 + %288 = OpAccessChain %_ptr_Function_float %color %uint_1 + %289 = OpConvertSToF %float %285 + %290 = OpFAdd %float %287 %289 + OpStore %288 %290 + %291 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %292 = OpLoad %float %291 + %293 = OpFOrdGreaterThan %bool %292 %float_0_25 + OpSelectionMerge %294 None + OpBranchConditional %293 %295 %294 + %295 = OpLabel + %297 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %298 = OpLoad %int %297 + %299 = OpAccessChain %_ptr_Function_float %color %uint_0 + %300 = OpLoad %float %299 + %301 = OpAccessChain %_ptr_Function_float %color %uint_0 + %302 = OpConvertSToF %float %298 + %303 = OpFAdd %float %300 %302 + OpStore %301 %303 + OpBranch %294 + %294 = OpLabel + %304 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %305 = OpLoad %float %304 + %306 = OpFOrdGreaterThan %bool %305 %float_0_5 + OpSelectionMerge %307 None + OpBranchConditional %306 %308 %307 + %308 = OpLabel + %310 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %311 = OpLoad %int %310 + %312 = OpAccessChain %_ptr_Function_float %color %uint_1 + %313 = OpLoad %float %312 + %314 = OpAccessChain %_ptr_Function_float %color %uint_1 + %315 = OpConvertSToF %float %311 + %316 = OpFAdd %float %313 %315 + OpStore %314 %316 + OpBranch %307 + %307 = OpLabel + %317 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %318 = OpLoad %float %317 + %319 = OpFOrdGreaterThan %bool %318 %float_0_75 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %320 + %321 = OpLabel + %323 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %324 = OpLoad %int %323 + %325 = OpAccessChain %_ptr_Function_float %color %uint_2 + %326 = OpLoad %float %325 + %327 = OpAccessChain %_ptr_Function_float %color %uint_2 + %328 = OpConvertSToF %float %324 + %329 = OpFAdd %float %326 %328 + OpStore %327 %329 + OpBranch %320 + %320 = OpLabel + %331 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %332 = OpLoad %int %331 + %333 = OpAccessChain %_ptr_Function_float %color %uint_2 + %334 = OpLoad %float %333 + %335 = OpAccessChain %_ptr_Function_float %color %uint_2 + %336 = OpConvertSToF %float %332 + %337 = OpFAdd %float %334 %336 + OpStore %335 %337 + %338 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %339 = OpLoad %float %338 + %340 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %341 = OpLoad %float %340 + %344 = OpFSub %float %339 %341 + %342 = OpExtInst %float %343 FAbs %344 + %345 = OpFOrdLessThan %bool %342 %float_0_25 + OpSelectionMerge %346 None + OpBranchConditional %345 %347 %346 + %347 = OpLabel + %348 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %349 = OpLoad %int %348 + %350 = OpAccessChain %_ptr_Function_float %color %uint_0 + %351 = OpLoad %float %350 + %352 = OpAccessChain %_ptr_Function_float %color %uint_0 + %353 = OpConvertSToF %float %349 + %354 = OpFAdd %float %351 %353 + OpStore %352 %354 + OpBranch %346 + %346 = OpLabel + %355 = OpLoad %v3float %color + %356 = OpExtInst %v3float %343 Normalize %355 + %357 = OpCompositeExtract %float %356 0 + %358 = OpCompositeExtract %float %356 1 + %359 = OpCompositeExtract %float %356 2 + %360 = OpCompositeConstruct %v4float %357 %358 %359 %float_1 + OpStore %x_GLF_color %360 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %361 +%tint_symbol_1 = OpFunctionParameter %main_out + %365 = OpLabel + %366 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %366 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %109 + %368 = OpLabel + %369 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %369 + %370 = OpFunctionCall %void %main_1 + %372 = OpLoad %v4float %x_GLF_color + %373 = OpCompositeConstruct %main_out %372 + %371 = OpFunctionCall %void %tint_symbol_3 %373 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..df70a1de43 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.wgsl @@ -0,0 +1,256 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_32 : buf0; + +var x_GLF_color : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_225 : i32 = *(i); + let x_227 : i32 = obj.numbers[x_225]; + temp = x_227; + let x_228 : i32 = *(i); + let x_229 : i32 = *(j); + let x_231 : i32 = obj.numbers[x_229]; + obj.numbers[x_228] = x_231; + let x_233 : i32 = *(j); + let x_234 : i32 = temp; + obj.numbers[x_233] = x_234; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_237 : i32 = *(h); + let x_239 : i32 = obj.numbers[x_237]; + pivot = x_239; + let x_240 : i32 = *(l); + i_1 = (x_240 - 1); + let x_242 : i32 = *(l); + j_1 = x_242; + loop { + let x_247 : i32 = j_1; + let x_248 : i32 = *(h); + if ((x_247 <= (x_248 - 1))) { + } else { + break; + } + let x_252 : i32 = j_1; + let x_254 : i32 = obj.numbers[x_252]; + let x_255 : i32 = pivot; + if ((x_254 <= x_255)) { + let x_259 : i32 = i_1; + i_1 = (x_259 + 1); + let x_261 : i32 = i_1; + param = x_261; + let x_262 : i32 = j_1; + param_1 = x_262; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_264 : i32 = j_1; + j_1 = (x_264 + 1); + } + } + let x_266 : i32 = i_1; + i_1 = (x_266 + 1); + let x_268 : i32 = i_1; + param_2 = x_268; + let x_269 : i32 = *(h); + param_3 = x_269; + swap_i1_i1_(&(param_2), &(param_3)); + let x_271 : i32 = i_1; + return x_271; +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_273 : i32 = top; + let x_274 : i32 = (x_273 + 1); + top = x_274; + let x_275 : i32 = l_1; + stack[x_274] = x_275; + let x_277 : i32 = top; + let x_278 : i32 = (x_277 + 1); + top = x_278; + let x_279 : i32 = h_1; + stack[x_278] = x_279; + loop { + let x_285 : i32 = top; + if ((x_285 >= 0)) { + } else { + break; + } + let x_288 : i32 = top; + top = (x_288 - 1); + let x_291 : i32 = stack[x_288]; + h_1 = x_291; + let x_292 : i32 = top; + top = (x_292 - 1); + let x_295 : i32 = stack[x_292]; + l_1 = x_295; + let x_296 : i32 = l_1; + param_4 = x_296; + let x_297 : i32 = h_1; + param_5 = x_297; + let x_298 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_298; + let x_299 : i32 = p; + let x_301 : i32 = l_1; + if (((x_299 - 1) > x_301)) { + let x_305 : i32 = top; + let x_306 : i32 = (x_305 + 1); + top = x_306; + let x_307 : i32 = l_1; + stack[x_306] = x_307; + let x_309 : i32 = top; + let x_310 : i32 = (x_309 + 1); + top = x_310; + let x_311 : i32 = p; + stack[x_310] = (x_311 - 1); + } + let x_314 : i32 = p; + let x_316 : i32 = h_1; + if (((x_314 + 1) < x_316)) { + let x_320 : i32 = top; + let x_321 : i32 = (x_320 + 1); + top = x_321; + let x_322 : i32 = p; + stack[x_321] = (x_322 + 1); + let x_325 : i32 = top; + let x_326 : i32 = (x_325 + 1); + top = x_326; + let x_327 : i32 = h_1; + stack[x_326] = x_327; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + i_2 = 0; + loop { + let x_85 : i32 = i_2; + if ((x_85 < 10)) { + } else { + break; + } + let x_88 : i32 = i_2; + let x_89 : i32 = i_2; + obj.numbers[x_88] = (10 - x_89); + let x_92 : i32 = i_2; + let x_93 : i32 = i_2; + let x_95 : i32 = obj.numbers[x_93]; + let x_96 : i32 = i_2; + let x_98 : i32 = obj.numbers[x_96]; + obj.numbers[x_92] = (x_95 * x_98); + + continuing { + let x_101 : i32 = i_2; + i_2 = (x_101 + 1); + } + } + quicksort_(); + let x_104 : vec4 = gl_FragCoord; + let x_107 : vec2 = x_32.resolution; + uv = (vec2(x_104.x, x_104.y) / x_107); + color = vec3(1.0, 2.0, 3.0); + let x_110 : i32 = obj.numbers[0]; + let x_113 : f32 = color.x; + color.x = (x_113 + f32(x_110)); + let x_117 : f32 = uv.x; + if ((x_117 > 0.25)) { + let x_122 : i32 = obj.numbers[1]; + let x_125 : f32 = color.x; + color.x = (x_125 + f32(x_122)); + } + let x_129 : f32 = uv.x; + if ((x_129 > 0.5)) { + let x_134 : i32 = obj.numbers[2]; + let x_137 : f32 = color.y; + color.y = (x_137 + f32(x_134)); + } + let x_141 : f32 = uv.x; + if ((x_141 > 0.75)) { + let x_146 : i32 = obj.numbers[3]; + let x_149 : f32 = color.z; + color.z = (x_149 + f32(x_146)); + } + let x_153 : i32 = obj.numbers[4]; + let x_156 : f32 = color.y; + color.y = (x_156 + f32(x_153)); + let x_160 : f32 = uv.y; + if ((x_160 > 0.25)) { + let x_165 : i32 = obj.numbers[5]; + let x_168 : f32 = color.x; + color.x = (x_168 + f32(x_165)); + } + let x_172 : f32 = uv.y; + if ((x_172 > 0.5)) { + let x_177 : i32 = obj.numbers[6]; + let x_180 : f32 = color.y; + color.y = (x_180 + f32(x_177)); + } + let x_184 : f32 = uv.y; + if ((x_184 > 0.75)) { + let x_189 : i32 = obj.numbers[7]; + let x_192 : f32 = color.z; + color.z = (x_192 + f32(x_189)); + } + let x_196 : i32 = obj.numbers[8]; + let x_199 : f32 = color.z; + color.z = (x_199 + f32(x_196)); + let x_203 : f32 = uv.x; + let x_205 : f32 = uv.y; + if ((abs((x_203 - x_205)) < 0.25)) { + let x_212 : i32 = obj.numbers[9]; + let x_215 : f32 = color.x; + color.x = (x_215 + f32(x_212)); + } + let x_218 : vec3 = color; + let x_219 : vec3 = normalize(x_218); + x_GLF_color = vec4(x_219.x, x_219.y, x_219.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm new file mode 100644 index 0000000000..10bf636b91 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm @@ -0,0 +1,486 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %swap_i1_i1_ "swap(i1;i1;" + OpName %i "i" + OpName %j "j" + OpName %performPartition_i1_i1_ "performPartition(i1;i1;" + OpName %l "l" + OpName %h "h" + OpName %quicksort_ "quicksort(" + OpName %temp "temp" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %pivot "pivot" + OpName %i_0 "i" + OpName %j_0 "j" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %l_0 "l" + OpName %h_0 "h" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %i_1 "i" + OpName %uv "uv" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %color "color" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %35 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %38 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %int_10 = OpConstant %int 10 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %63 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%mat3v3float = OpTypeMatrix %v3float 3 + %float_0 = OpConstant %float 0 + %81 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %82 = OpConstantComposite %mat3v3float %81 %81 %81 + %83 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %mat3v3float + %main = OpFunction %void None %35 + %84 = OpLabel + %i_1 = OpVariable %_ptr_Function_int Function + %uv = OpVariable %_ptr_Function_v2float Function + %color = OpVariable %_ptr_Function_v3float Function + OpStore %i_1 %int_0 + OpBranch %85 + %85 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %89 = OpLoad %int %i_1 + %90 = OpSLessThan %bool %89 %int_10 + OpBranchConditional %90 %91 %86 + %91 = OpLabel + %92 = OpLoad %int %i_1 + %93 = OpLoad %int %i_1 + %94 = OpISub %int %int_10 %93 + %95 = OpAccessChain %_ptr_Private_int %obj %int_0 %92 + OpStore %95 %94 + %96 = OpLoad %int %i_1 + %97 = OpLoad %int %i_1 + %98 = OpAccessChain %_ptr_Private_int %obj %int_0 %97 + %99 = OpLoad %int %98 + %100 = OpLoad %int %i_1 + %101 = OpAccessChain %_ptr_Private_int %obj %int_0 %100 + %102 = OpLoad %int %101 + %103 = OpIMul %int %99 %102 + %104 = OpAccessChain %_ptr_Private_int %obj %int_0 %96 + OpStore %104 %103 + OpBranch %87 + %87 = OpLabel + %105 = OpLoad %int %i_1 + %106 = OpIAdd %int %105 %int_1 + OpStore %i_1 %106 + OpBranch %85 + %86 = OpLabel + %107 = OpFunctionCall %void %quicksort_ + %108 = OpLoad %v4float %gl_FragCoord + %109 = OpVectorShuffle %v2float %108 %108 0 1 + %110 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %111 = OpLoad %v2float %110 + %112 = OpFDiv %v2float %109 %111 + OpStore %uv %112 + OpStore %color %63 + %113 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_0 + %114 = OpLoad %int %113 + %115 = OpConvertSToF %float %114 + %116 = OpAccessChain %_ptr_Function_float %color %uint_0 + %117 = OpLoad %float %116 + %118 = OpFAdd %float %117 %115 + %119 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %119 %118 + %120 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %121 = OpLoad %float %120 + %122 = OpFOrdGreaterThan %bool %121 %float_0_25 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %123 + %124 = OpLabel + %125 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_1 + %126 = OpLoad %int %125 + %127 = OpConvertSToF %float %126 + %128 = OpAccessChain %_ptr_Function_float %color %uint_0 + %129 = OpLoad %float %128 + %130 = OpFAdd %float %129 %127 + %131 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %131 %130 + OpBranch %123 + %123 = OpLabel + %132 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %133 = OpLoad %float %132 + %134 = OpFOrdGreaterThan %bool %133 %float_0_5 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %135 + %136 = OpLabel + %137 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_2 + %138 = OpLoad %int %137 + %139 = OpConvertSToF %float %138 + %140 = OpAccessChain %_ptr_Function_float %color %uint_1 + %141 = OpLoad %float %140 + %142 = OpFAdd %float %141 %139 + %143 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %143 %142 + OpBranch %135 + %135 = OpLabel + %144 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %145 = OpLoad %float %144 + %146 = OpFOrdGreaterThan %bool %145 %float_0_75 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %147 + %148 = OpLabel + %149 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_3 + %150 = OpLoad %int %149 + %151 = OpConvertSToF %float %150 + %152 = OpAccessChain %_ptr_Function_float %color %uint_2 + %153 = OpLoad %float %152 + %154 = OpFAdd %float %153 %151 + %155 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %155 %154 + OpBranch %147 + %147 = OpLabel + %156 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_4 + %157 = OpLoad %int %156 + %158 = OpConvertSToF %float %157 + %159 = OpAccessChain %_ptr_Function_float %color %uint_1 + %160 = OpLoad %float %159 + %161 = OpFAdd %float %160 %158 + %162 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %162 %161 + %163 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %164 = OpLoad %float %163 + %165 = OpFOrdGreaterThan %bool %164 %float_0_25 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %166 + %167 = OpLabel + %168 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_5 + %169 = OpLoad %int %168 + %170 = OpConvertSToF %float %169 + %171 = OpAccessChain %_ptr_Function_float %color %uint_0 + %172 = OpLoad %float %171 + %173 = OpFAdd %float %172 %170 + %174 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %174 %173 + OpBranch %166 + %166 = OpLabel + %175 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %176 = OpLoad %float %175 + %177 = OpFOrdGreaterThan %bool %176 %float_0_5 + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %178 + %179 = OpLabel + %180 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_6 + %181 = OpLoad %int %180 + %182 = OpConvertSToF %float %181 + %183 = OpAccessChain %_ptr_Function_float %color %uint_1 + %184 = OpLoad %float %183 + %185 = OpFAdd %float %184 %182 + %186 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %186 %185 + OpBranch %178 + %178 = OpLabel + %187 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %188 = OpLoad %float %187 + %189 = OpFOrdGreaterThan %bool %188 %float_0_75 + OpSelectionMerge %190 None + OpBranchConditional %189 %191 %190 + %191 = OpLabel + %192 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_7 + %193 = OpLoad %int %192 + %194 = OpConvertSToF %float %193 + %195 = OpAccessChain %_ptr_Function_float %color %uint_2 + %196 = OpLoad %float %195 + %197 = OpFAdd %float %196 %194 + %198 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %198 %197 + OpBranch %190 + %190 = OpLabel + %199 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_8 + %200 = OpLoad %int %199 + %201 = OpConvertSToF %float %200 + %202 = OpAccessChain %_ptr_Function_float %color %uint_2 + %203 = OpLoad %float %202 + %204 = OpFAdd %float %203 %201 + %205 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %205 %204 + %206 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %207 = OpLoad %float %206 + %208 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %209 = OpLoad %float %208 + %210 = OpFSub %float %207 %209 + %211 = OpExtInst %float %1 FAbs %210 + %212 = OpFOrdLessThan %bool %211 %float_0_25 + OpSelectionMerge %213 None + OpBranchConditional %212 %214 %213 + %214 = OpLabel + %215 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_9 + %216 = OpLoad %int %215 + %217 = OpConvertSToF %float %216 + %218 = OpAccessChain %_ptr_Function_float %color %uint_0 + %219 = OpLoad %float %218 + %220 = OpFAdd %float %219 %217 + %221 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %221 %220 + OpBranch %213 + %213 = OpLabel + %222 = OpLoad %v3float %color + %223 = OpExtInst %v3float %1 Normalize %222 + %224 = OpCompositeExtract %float %223 0 + %225 = OpCompositeExtract %float %223 1 + %226 = OpCompositeExtract %float %223 2 + %227 = OpCompositeConstruct %v4float %224 %225 %226 %float_1 + OpStore %_GLF_color %227 + OpReturn + OpFunctionEnd +%swap_i1_i1_ = OpFunction %void None %83 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %228 = OpFunctionParameter %mat3v3float + %229 = OpLabel + %temp = OpVariable %_ptr_Function_int Function + %230 = OpLoad %int %i + %231 = OpAccessChain %_ptr_Private_int %obj %int_0 %230 + %232 = OpLoad %int %231 + OpStore %temp %232 + %233 = OpLoad %int %i + %234 = OpLoad %int %j + %235 = OpAccessChain %_ptr_Private_int %obj %int_0 %234 + %236 = OpLoad %int %235 + %237 = OpAccessChain %_ptr_Private_int %obj %int_0 %233 + OpStore %237 %236 + %238 = OpLoad %int %j + %239 = OpLoad %int %temp + %240 = OpAccessChain %_ptr_Private_int %obj %int_0 %238 + OpStore %240 %239 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %38 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %241 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_int Function + %242 = OpLoad %int %h + %243 = OpAccessChain %_ptr_Private_int %obj %int_0 %242 + %244 = OpLoad %int %243 + OpStore %pivot %244 + %245 = OpLoad %int %l + %246 = OpISub %int %245 %int_1 + OpStore %i_0 %246 + %247 = OpLoad %int %l + OpStore %j_0 %247 + OpBranch %248 + %248 = OpLabel + OpLoopMerge %249 %250 None + OpBranch %251 + %251 = OpLabel + %252 = OpLoad %int %j_0 + %253 = OpLoad %int %h + %254 = OpISub %int %253 %int_1 + %255 = OpSLessThanEqual %bool %252 %254 + OpBranchConditional %255 %256 %249 + %256 = OpLabel + %257 = OpLoad %int %j_0 + %258 = OpAccessChain %_ptr_Private_int %obj %int_0 %257 + %259 = OpLoad %int %258 + %260 = OpLoad %int %pivot + %261 = OpSLessThanEqual %bool %259 %260 + OpSelectionMerge %262 None + OpBranchConditional %261 %263 %262 + %263 = OpLabel + %264 = OpLoad %int %i_0 + %265 = OpIAdd %int %264 %int_1 + OpStore %i_0 %265 + %266 = OpLoad %int %i_0 + OpStore %param %266 + %267 = OpLoad %int %j_0 + OpStore %param_0 %267 + %268 = OpFunctionCall %void %swap_i1_i1_ %param %param_0 %82 + OpBranch %262 + %262 = OpLabel + OpBranch %250 + %250 = OpLabel + %269 = OpLoad %int %j_0 + %270 = OpIAdd %int %269 %int_1 + OpStore %j_0 %270 + OpBranch %248 + %249 = OpLabel + %271 = OpLoad %int %i_0 + %272 = OpIAdd %int %271 %int_1 + OpStore %i_0 %272 + %273 = OpLoad %int %i_0 + OpStore %param_1 %273 + %274 = OpLoad %int %h + OpStore %param_2 %274 + %275 = OpFunctionCall %void %swap_i1_i1_ %param_1 %param_2 %82 + %276 = OpLoad %int %i_0 + OpReturnValue %276 + OpFunctionEnd + %quicksort_ = OpFunction %void None %35 + %277 = OpLabel + %l_0 = OpVariable %_ptr_Function_int Function + %h_0 = OpVariable %_ptr_Function_int Function + %top = OpVariable %_ptr_Function_int Function + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function + %p = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_int Function + %param_4 = OpVariable %_ptr_Function_int Function + OpStore %l_0 %int_0 + OpStore %h_0 %int_9 + OpStore %top %int_n1 + %278 = OpLoad %int %top + %279 = OpIAdd %int %278 %int_1 + OpStore %top %279 + %280 = OpLoad %int %l_0 + %281 = OpAccessChain %_ptr_Function_int %stack %279 + OpStore %281 %280 + %282 = OpLoad %int %top + %283 = OpIAdd %int %282 %int_1 + OpStore %top %283 + %284 = OpLoad %int %h_0 + %285 = OpAccessChain %_ptr_Function_int %stack %283 + OpStore %285 %284 + OpBranch %286 + %286 = OpLabel + OpLoopMerge %287 %288 None + OpBranch %289 + %289 = OpLabel + %290 = OpLoad %int %top + %291 = OpSGreaterThanEqual %bool %290 %int_0 + OpBranchConditional %291 %292 %287 + %292 = OpLabel + %293 = OpLoad %int %top + %294 = OpISub %int %293 %int_1 + OpStore %top %294 + %295 = OpAccessChain %_ptr_Function_int %stack %293 + %296 = OpLoad %int %295 + OpStore %h_0 %296 + %297 = OpLoad %int %top + %298 = OpISub %int %297 %int_1 + OpStore %top %298 + %299 = OpAccessChain %_ptr_Function_int %stack %297 + %300 = OpLoad %int %299 + OpStore %l_0 %300 + %301 = OpLoad %int %l_0 + OpStore %param_3 %301 + %302 = OpLoad %int %h_0 + OpStore %param_4 %302 + %303 = OpFunctionCall %int %performPartition_i1_i1_ %param_3 %param_4 + OpStore %p %303 + %304 = OpLoad %int %p + %305 = OpISub %int %304 %int_1 + %306 = OpLoad %int %l_0 + %307 = OpSGreaterThan %bool %305 %306 + OpSelectionMerge %308 None + OpBranchConditional %307 %309 %308 + %309 = OpLabel + %310 = OpLoad %int %top + %311 = OpIAdd %int %310 %int_1 + OpStore %top %311 + %312 = OpLoad %int %l_0 + %313 = OpAccessChain %_ptr_Function_int %stack %311 + OpStore %313 %312 + %314 = OpLoad %int %top + %315 = OpIAdd %int %314 %int_1 + OpStore %top %315 + %316 = OpLoad %int %p + %317 = OpISub %int %316 %int_1 + %318 = OpAccessChain %_ptr_Function_int %stack %315 + OpStore %318 %317 + OpBranch %308 + %308 = OpLabel + %319 = OpLoad %int %p + %320 = OpIAdd %int %319 %int_1 + %321 = OpLoad %int %h_0 + %322 = OpSLessThan %bool %320 %321 + OpSelectionMerge %323 None + OpBranchConditional %322 %324 %323 + %324 = OpLabel + %325 = OpLoad %int %top + %326 = OpIAdd %int %325 %int_1 + OpStore %top %326 + %327 = OpLoad %int %p + %328 = OpIAdd %int %327 %int_1 + %329 = OpAccessChain %_ptr_Function_int %stack %326 + OpStore %329 %328 + %330 = OpLoad %int %top + %331 = OpIAdd %int %330 %int_1 + OpStore %top %331 + %332 = OpLoad %int %h_0 + %333 = OpAccessChain %_ptr_Function_int %stack %331 + OpStore %333 %332 + OpBranch %323 + %323 = OpLabel + OpBranch %288 + %288 = OpLabel + OpBranch %286 + %287 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..405b0401a1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.hlsl @@ -0,0 +1,214 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_32 : register(b0, space0) { + uint4 x_32[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j, float3x3 x_228) { + int temp = 0; + const int x_230 = i; + const int x_232 = obj.numbers[x_230]; + temp = x_232; + const int x_233 = i; + const int x_234 = j; + const int x_236 = obj.numbers[x_234]; + obj.numbers[x_233] = x_236; + const int x_238 = j; + obj.numbers[x_238] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_242 = h; + const int x_244 = obj.numbers[x_242]; + pivot = x_244; + const int x_245 = l; + i_1 = (x_245 - 1); + const int x_247 = l; + j_1 = x_247; + while (true) { + const int x_252 = j_1; + const int x_253 = h; + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + const int x_259 = obj.numbers[j_1]; + if ((x_259 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1, float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f))); + } + { + j_1 = (j_1 + 1); + } + } + i_1 = (i_1 + 1); + param_2 = i_1; + const int x_274 = h; + param_3 = x_274; + swap_i1_i1_(param_2, param_3, float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f))); + return i_1; +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_279 = (top + 1); + top = x_279; + stack[x_279] = l_1; + const int x_283 = (top + 1); + top = x_283; + stack[x_283] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_293 = top; + top = (x_293 - 1); + const int x_296 = stack[x_293]; + h_1 = x_296; + const int x_297 = top; + top = (x_297 - 1); + const int x_300 = stack[x_297]; + l_1 = x_300; + param_4 = l_1; + param_5 = h_1; + const int x_303 = performPartition_i1_i1_(param_4, param_5); + p = x_303; + if (((p - 1) > l_1)) { + const int x_311 = (top + 1); + top = x_311; + stack[x_311] = l_1; + const int x_315 = (top + 1); + top = x_315; + stack[x_315] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_326 = (top + 1); + top = x_326; + stack[x_326] = (p + 1); + const int x_331 = (top + 1); + top = x_331; + stack[x_331] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_96 = i_2; + const int x_99 = obj.numbers[i_2]; + const int x_102 = obj.numbers[i_2]; + obj.numbers[x_96] = (x_99 * x_102); + } + } + quicksort_(); + const float4 x_108 = gl_FragCoord; + const float2 x_111 = asfloat(x_32[0].xy); + uv = (float2(x_108.x, x_108.y) / x_111); + color = float3(1.0f, 2.0f, 3.0f); + const int x_114 = obj.numbers[0]; + const float x_117 = color.x; + color.x = (x_117 + float(x_114)); + const float x_121 = uv.x; + if ((x_121 > 0.25f)) { + const int x_126 = obj.numbers[1]; + const float x_129 = color.x; + color.x = (x_129 + float(x_126)); + } + const float x_133 = uv.x; + if ((x_133 > 0.5f)) { + const int x_138 = obj.numbers[2]; + const float x_141 = color.y; + color.y = (x_141 + float(x_138)); + } + const float x_145 = uv.x; + if ((x_145 > 0.75f)) { + const int x_150 = obj.numbers[3]; + const float x_153 = color.z; + color.z = (x_153 + float(x_150)); + } + const int x_157 = obj.numbers[4]; + const float x_160 = color.y; + color.y = (x_160 + float(x_157)); + const float x_164 = uv.y; + if ((x_164 > 0.25f)) { + const int x_169 = obj.numbers[5]; + const float x_172 = color.x; + color.x = (x_172 + float(x_169)); + } + const float x_176 = uv.y; + if ((x_176 > 0.5f)) { + const int x_181 = obj.numbers[6]; + const float x_184 = color.y; + color.y = (x_184 + float(x_181)); + } + const float x_188 = uv.y; + if ((x_188 > 0.75f)) { + const int x_193 = obj.numbers[7]; + const float x_196 = color.z; + color.z = (x_196 + float(x_193)); + } + const int x_200 = obj.numbers[8]; + const float x_203 = color.z; + color.z = (x_203 + float(x_200)); + const float x_207 = uv.x; + const float x_209 = uv.y; + if ((abs((x_207 - x_209)) < 0.25f)) { + const int x_216 = obj.numbers[9]; + const float x_219 = color.x; + color.x = (x_219 + float(x_216)); + } + const float3 x_223 = normalize(color); + x_GLF_color = float4(x_223.x, x_223.y, x_223.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.msl new file mode 100644 index 0000000000..a97ee25fb1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.msl @@ -0,0 +1,256 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, float3x3 x_228, thread QuicksortObject* const tint_symbol_5) { + int temp = 0; + int const x_230 = *(i); + int const x_232 = (*(tint_symbol_5)).numbers.arr[x_230]; + temp = x_232; + int const x_233 = *(i); + int const x_234 = *(j); + int const x_236 = (*(tint_symbol_5)).numbers.arr[x_234]; + (*(tint_symbol_5)).numbers.arr[x_233] = x_236; + int const x_238 = *(j); + int const x_239 = temp; + (*(tint_symbol_5)).numbers.arr[x_238] = x_239; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_6) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_242 = *(h); + int const x_244 = (*(tint_symbol_6)).numbers.arr[x_242]; + pivot = x_244; + int const x_245 = *(l); + i_1 = (x_245 - 1); + int const x_247 = *(l); + j_1 = x_247; + while (true) { + int const x_252 = j_1; + int const x_253 = *(h); + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + int const x_257 = j_1; + int const x_259 = (*(tint_symbol_6)).numbers.arr[x_257]; + int const x_260 = pivot; + if ((x_259 <= x_260)) { + int const x_264 = i_1; + i_1 = (x_264 + 1); + int const x_266 = i_1; + param = x_266; + int const x_267 = j_1; + param_1 = x_267; + swap_i1_i1_(&(param), &(param_1), float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)), tint_symbol_6); + } + { + int const x_269 = j_1; + j_1 = (x_269 + 1); + } + } + int const x_271 = i_1; + i_1 = (x_271 + 1); + int const x_273 = i_1; + param_2 = x_273; + int const x_274 = *(h); + param_3 = x_274; + swap_i1_i1_(&(param_2), &(param_3), float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)), tint_symbol_6); + int const x_276 = i_1; + return x_276; +} + +void quicksort_(thread QuicksortObject* const tint_symbol_7) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_278 = top; + int const x_279 = (x_278 + 1); + top = x_279; + int const x_280 = l_1; + stack.arr[x_279] = x_280; + int const x_282 = top; + int const x_283 = (x_282 + 1); + top = x_283; + int const x_284 = h_1; + stack.arr[x_283] = x_284; + while (true) { + int const x_290 = top; + if ((x_290 >= 0)) { + } else { + break; + } + int const x_293 = top; + top = (x_293 - 1); + int const x_296 = stack.arr[x_293]; + h_1 = x_296; + int const x_297 = top; + top = (x_297 - 1); + int const x_300 = stack.arr[x_297]; + l_1 = x_300; + int const x_301 = l_1; + param_4 = x_301; + int const x_302 = h_1; + param_5 = x_302; + int const x_303 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_7); + p = x_303; + int const x_304 = p; + int const x_306 = l_1; + if (((x_304 - 1) > x_306)) { + int const x_310 = top; + int const x_311 = (x_310 + 1); + top = x_311; + int const x_312 = l_1; + stack.arr[x_311] = x_312; + int const x_314 = top; + int const x_315 = (x_314 + 1); + top = x_315; + int const x_316 = p; + stack.arr[x_315] = (x_316 - 1); + } + int const x_319 = p; + int const x_321 = h_1; + if (((x_319 + 1) < x_321)) { + int const x_325 = top; + int const x_326 = (x_325 + 1); + top = x_326; + int const x_327 = p; + stack.arr[x_326] = (x_327 + 1); + int const x_330 = top; + int const x_331 = (x_330 + 1); + top = x_331; + int const x_332 = h_1; + stack.arr[x_331] = x_332; + } + } + return; +} + +void main_1(constant buf0& x_32, thread QuicksortObject* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + i_2 = 0; + while (true) { + int const x_89 = i_2; + if ((x_89 < 10)) { + } else { + break; + } + int const x_92 = i_2; + int const x_93 = i_2; + (*(tint_symbol_8)).numbers.arr[x_92] = (10 - x_93); + int const x_96 = i_2; + int const x_97 = i_2; + int const x_99 = (*(tint_symbol_8)).numbers.arr[x_97]; + int const x_100 = i_2; + int const x_102 = (*(tint_symbol_8)).numbers.arr[x_100]; + (*(tint_symbol_8)).numbers.arr[x_96] = (x_99 * x_102); + { + int const x_105 = i_2; + i_2 = (x_105 + 1); + } + } + quicksort_(tint_symbol_8); + float4 const x_108 = *(tint_symbol_9); + float2 const x_111 = x_32.resolution; + uv = (float2(x_108.x, x_108.y) / x_111); + color = float3(1.0f, 2.0f, 3.0f); + int const x_114 = (*(tint_symbol_8)).numbers.arr[0]; + float const x_117 = color.x; + color.x = (x_117 + float(x_114)); + float const x_121 = uv.x; + if ((x_121 > 0.25f)) { + int const x_126 = (*(tint_symbol_8)).numbers.arr[1]; + float const x_129 = color.x; + color.x = (x_129 + float(x_126)); + } + float const x_133 = uv.x; + if ((x_133 > 0.5f)) { + int const x_138 = (*(tint_symbol_8)).numbers.arr[2]; + float const x_141 = color.y; + color.y = (x_141 + float(x_138)); + } + float const x_145 = uv.x; + if ((x_145 > 0.75f)) { + int const x_150 = (*(tint_symbol_8)).numbers.arr[3]; + float const x_153 = color.z; + color.z = (x_153 + float(x_150)); + } + int const x_157 = (*(tint_symbol_8)).numbers.arr[4]; + float const x_160 = color.y; + color.y = (x_160 + float(x_157)); + float const x_164 = uv.y; + if ((x_164 > 0.25f)) { + int const x_169 = (*(tint_symbol_8)).numbers.arr[5]; + float const x_172 = color.x; + color.x = (x_172 + float(x_169)); + } + float const x_176 = uv.y; + if ((x_176 > 0.5f)) { + int const x_181 = (*(tint_symbol_8)).numbers.arr[6]; + float const x_184 = color.y; + color.y = (x_184 + float(x_181)); + } + float const x_188 = uv.y; + if ((x_188 > 0.75f)) { + int const x_193 = (*(tint_symbol_8)).numbers.arr[7]; + float const x_196 = color.z; + color.z = (x_196 + float(x_193)); + } + int const x_200 = (*(tint_symbol_8)).numbers.arr[8]; + float const x_203 = color.z; + color.z = (x_203 + float(x_200)); + float const x_207 = uv.x; + float const x_209 = uv.y; + if ((fabs((x_207 - x_209)) < 0.25f)) { + int const x_216 = (*(tint_symbol_8)).numbers.arr[9]; + float const x_219 = color.x; + color.x = (x_219 + float(x_216)); + } + float3 const x_222 = color; + float3 const x_223 = normalize(x_222); + *(tint_symbol_10) = float4(x_223.x, x_223.y, x_223.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_32 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread QuicksortObject tint_symbol_12 = {}; + thread float4 tint_symbol_13 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_32, &(tint_symbol_12), &(tint_symbol_11), &(tint_symbol_13)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..2c8db032d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.spvasm @@ -0,0 +1,547 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 379 +; Schema: 0 + OpCapability Shader + %348 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_32 "x_32" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %x_228 "x_228" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_32 NonWritable + OpDecorate %x_32 DescriptorSet 0 + OpDecorate %x_32 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %8 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %13 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_32 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %mat3v3float + %34 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %52 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %102 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %103 = OpConstantComposite %mat3v3float %102 %102 %102 + %115 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %123 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %195 = OpConstantNull %v2float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %198 = OpConstantNull %v3float + %int_10 = OpConstant %int 10 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %236 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float + %366 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %23 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %x_228 = OpFunctionParameter %mat3v3float + %32 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %34 + %36 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Private_int %obj %uint_0 %36 + %40 = OpLoad %int %39 + OpStore %temp %40 + %42 = OpLoad %int %i + %44 = OpLoad %int %j + %45 = OpAccessChain %_ptr_Private_int %obj %uint_0 %44 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + OpStore %47 %46 + %49 = OpLoad %int %j + %50 = OpLoad %int %temp + %51 = OpAccessChain %_ptr_Private_int %obj %uint_0 %49 + OpStore %51 %50 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %52 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %56 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %34 + %i_1 = OpVariable %_ptr_Function_int Function %34 + %j_1 = OpVariable %_ptr_Function_int Function %34 + %param = OpVariable %_ptr_Function_int Function %34 + %param_1 = OpVariable %_ptr_Function_int Function %34 + %param_2 = OpVariable %_ptr_Function_int Function %34 + %param_3 = OpVariable %_ptr_Function_int Function %34 + %65 = OpLoad %int %h + %66 = OpAccessChain %_ptr_Private_int %obj %uint_0 %65 + %67 = OpLoad %int %66 + OpStore %pivot %67 + %69 = OpLoad %int %l + %71 = OpISub %int %69 %int_1 + OpStore %i_1 %71 + %73 = OpLoad %int %l + OpStore %j_1 %73 + OpBranch %74 + %74 = OpLabel + OpLoopMerge %75 %76 None + OpBranch %77 + %77 = OpLabel + %78 = OpLoad %int %j_1 + %80 = OpLoad %int %h + %81 = OpISub %int %80 %int_1 + %82 = OpSLessThanEqual %bool %78 %81 + OpSelectionMerge %84 None + OpBranchConditional %82 %85 %86 + %85 = OpLabel + OpBranch %84 + %86 = OpLabel + OpBranch %75 + %84 = OpLabel + %87 = OpLoad %int %j_1 + %88 = OpAccessChain %_ptr_Private_int %obj %uint_0 %87 + %89 = OpLoad %int %88 + %90 = OpLoad %int %pivot + %91 = OpSLessThanEqual %bool %89 %90 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %92 + %93 = OpLabel + %94 = OpLoad %int %i_1 + %95 = OpIAdd %int %94 %int_1 + OpStore %i_1 %95 + %96 = OpLoad %int %i_1 + OpStore %param %96 + %97 = OpLoad %int %j_1 + OpStore %param_1 %97 + %98 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 %103 + OpBranch %92 + %92 = OpLabel + OpBranch %76 + %76 = OpLabel + %104 = OpLoad %int %j_1 + %105 = OpIAdd %int %104 %int_1 + OpStore %j_1 %105 + OpBranch %74 + %75 = OpLabel + %106 = OpLoad %int %i_1 + %107 = OpIAdd %int %106 %int_1 + OpStore %i_1 %107 + %108 = OpLoad %int %i_1 + OpStore %param_2 %108 + %110 = OpLoad %int %h + OpStore %param_3 %110 + %111 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 %103 + %114 = OpLoad %int %i_1 + OpReturnValue %114 + OpFunctionEnd + %quicksort_ = OpFunction %void None %115 + %117 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %34 + %h_1 = OpVariable %_ptr_Function_int Function %34 + %top = OpVariable %_ptr_Function_int Function %34 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %123 + %p = OpVariable %_ptr_Function_int Function %34 + %param_4 = OpVariable %_ptr_Function_int Function %34 + %param_5 = OpVariable %_ptr_Function_int Function %34 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %130 = OpLoad %int %top + %131 = OpIAdd %int %130 %int_1 + OpStore %top %131 + %132 = OpLoad %int %l_1 + %133 = OpAccessChain %_ptr_Function_int %stack %131 + OpStore %133 %132 + %134 = OpLoad %int %top + %135 = OpIAdd %int %134 %int_1 + OpStore %top %135 + %136 = OpLoad %int %h_1 + %137 = OpAccessChain %_ptr_Function_int %stack %135 + OpStore %137 %136 + OpBranch %138 + %138 = OpLabel + OpLoopMerge %139 %140 None + OpBranch %141 + %141 = OpLabel + %142 = OpLoad %int %top + %143 = OpSGreaterThanEqual %bool %142 %int_0 + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %146 + %145 = OpLabel + OpBranch %144 + %146 = OpLabel + OpBranch %139 + %144 = OpLabel + %147 = OpLoad %int %top + %148 = OpISub %int %147 %int_1 + OpStore %top %148 + %149 = OpAccessChain %_ptr_Function_int %stack %147 + %150 = OpLoad %int %149 + OpStore %h_1 %150 + %151 = OpLoad %int %top + %152 = OpISub %int %151 %int_1 + OpStore %top %152 + %153 = OpAccessChain %_ptr_Function_int %stack %151 + %154 = OpLoad %int %153 + OpStore %l_1 %154 + %155 = OpLoad %int %l_1 + OpStore %param_4 %155 + %156 = OpLoad %int %h_1 + OpStore %param_5 %156 + %157 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %157 + %160 = OpLoad %int %p + %161 = OpLoad %int %l_1 + %162 = OpISub %int %160 %int_1 + %163 = OpSGreaterThan %bool %162 %161 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %164 + %165 = OpLabel + %166 = OpLoad %int %top + %167 = OpIAdd %int %166 %int_1 + OpStore %top %167 + %168 = OpLoad %int %l_1 + %169 = OpAccessChain %_ptr_Function_int %stack %167 + OpStore %169 %168 + %170 = OpLoad %int %top + %171 = OpIAdd %int %170 %int_1 + OpStore %top %171 + %172 = OpLoad %int %p + %173 = OpAccessChain %_ptr_Function_int %stack %171 + %174 = OpISub %int %172 %int_1 + OpStore %173 %174 + OpBranch %164 + %164 = OpLabel + %175 = OpLoad %int %p + %176 = OpLoad %int %h_1 + %177 = OpIAdd %int %175 %int_1 + %178 = OpSLessThan %bool %177 %176 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %179 + %180 = OpLabel + %181 = OpLoad %int %top + %182 = OpIAdd %int %181 %int_1 + OpStore %top %182 + %183 = OpLoad %int %p + %184 = OpAccessChain %_ptr_Function_int %stack %182 + %185 = OpIAdd %int %183 %int_1 + OpStore %184 %185 + %186 = OpLoad %int %top + %187 = OpIAdd %int %186 %int_1 + OpStore %top %187 + %188 = OpLoad %int %h_1 + %189 = OpAccessChain %_ptr_Function_int %stack %187 + OpStore %189 %188 + OpBranch %179 + %179 = OpLabel + OpBranch %140 + %140 = OpLabel + OpBranch %138 + %139 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %115 + %191 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %34 + %uv = OpVariable %_ptr_Function_v2float Function %195 + %color = OpVariable %_ptr_Function_v3float Function %198 + OpStore %i_2 %int_0 + OpBranch %199 + %199 = OpLabel + OpLoopMerge %200 %201 None + OpBranch %202 + %202 = OpLabel + %203 = OpLoad %int %i_2 + %205 = OpSLessThan %bool %203 %int_10 + OpSelectionMerge %206 None + OpBranchConditional %205 %207 %208 + %207 = OpLabel + OpBranch %206 + %208 = OpLabel + OpBranch %200 + %206 = OpLabel + %209 = OpLoad %int %i_2 + %210 = OpLoad %int %i_2 + %211 = OpAccessChain %_ptr_Private_int %obj %uint_0 %209 + %212 = OpISub %int %int_10 %210 + OpStore %211 %212 + %213 = OpLoad %int %i_2 + %214 = OpLoad %int %i_2 + %215 = OpAccessChain %_ptr_Private_int %obj %uint_0 %214 + %216 = OpLoad %int %215 + %217 = OpLoad %int %i_2 + %218 = OpAccessChain %_ptr_Private_int %obj %uint_0 %217 + %219 = OpLoad %int %218 + %220 = OpAccessChain %_ptr_Private_int %obj %uint_0 %213 + %221 = OpIMul %int %216 %219 + OpStore %220 %221 + OpBranch %201 + %201 = OpLabel + %222 = OpLoad %int %i_2 + %223 = OpIAdd %int %222 %int_1 + OpStore %i_2 %223 + OpBranch %199 + %200 = OpLabel + %224 = OpFunctionCall %void %quicksort_ + %225 = OpLoad %v4float %gl_FragCoord + %227 = OpAccessChain %_ptr_Uniform_v2float %x_32 %uint_0 + %228 = OpLoad %v2float %227 + %229 = OpCompositeExtract %float %225 0 + %230 = OpCompositeExtract %float %225 1 + %231 = OpCompositeConstruct %v2float %229 %230 + %232 = OpFDiv %v2float %231 %228 + OpStore %uv %232 + OpStore %color %236 + %237 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %238 = OpLoad %int %237 + %240 = OpAccessChain %_ptr_Function_float %color %uint_0 + %241 = OpLoad %float %240 + %242 = OpAccessChain %_ptr_Function_float %color %uint_0 + %243 = OpConvertSToF %float %238 + %244 = OpFAdd %float %241 %243 + OpStore %242 %244 + %245 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %246 = OpLoad %float %245 + %248 = OpFOrdGreaterThan %bool %246 %float_0_25 + OpSelectionMerge %249 None + OpBranchConditional %248 %250 %249 + %250 = OpLabel + %251 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %252 = OpLoad %int %251 + %253 = OpAccessChain %_ptr_Function_float %color %uint_0 + %254 = OpLoad %float %253 + %255 = OpAccessChain %_ptr_Function_float %color %uint_0 + %256 = OpConvertSToF %float %252 + %257 = OpFAdd %float %254 %256 + OpStore %255 %257 + OpBranch %249 + %249 = OpLabel + %258 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %259 = OpLoad %float %258 + %261 = OpFOrdGreaterThan %bool %259 %float_0_5 + OpSelectionMerge %262 None + OpBranchConditional %261 %263 %262 + %263 = OpLabel + %265 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %266 = OpLoad %int %265 + %268 = OpAccessChain %_ptr_Function_float %color %uint_1 + %269 = OpLoad %float %268 + %270 = OpAccessChain %_ptr_Function_float %color %uint_1 + %271 = OpConvertSToF %float %266 + %272 = OpFAdd %float %269 %271 + OpStore %270 %272 + OpBranch %262 + %262 = OpLabel + %273 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %274 = OpLoad %float %273 + %276 = OpFOrdGreaterThan %bool %274 %float_0_75 + OpSelectionMerge %277 None + OpBranchConditional %276 %278 %277 + %278 = OpLabel + %280 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %281 = OpLoad %int %280 + %283 = OpAccessChain %_ptr_Function_float %color %uint_2 + %284 = OpLoad %float %283 + %285 = OpAccessChain %_ptr_Function_float %color %uint_2 + %286 = OpConvertSToF %float %281 + %287 = OpFAdd %float %284 %286 + OpStore %285 %287 + OpBranch %277 + %277 = OpLabel + %289 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %290 = OpLoad %int %289 + %291 = OpAccessChain %_ptr_Function_float %color %uint_1 + %292 = OpLoad %float %291 + %293 = OpAccessChain %_ptr_Function_float %color %uint_1 + %294 = OpConvertSToF %float %290 + %295 = OpFAdd %float %292 %294 + OpStore %293 %295 + %296 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %297 = OpLoad %float %296 + %298 = OpFOrdGreaterThan %bool %297 %float_0_25 + OpSelectionMerge %299 None + OpBranchConditional %298 %300 %299 + %300 = OpLabel + %302 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %303 = OpLoad %int %302 + %304 = OpAccessChain %_ptr_Function_float %color %uint_0 + %305 = OpLoad %float %304 + %306 = OpAccessChain %_ptr_Function_float %color %uint_0 + %307 = OpConvertSToF %float %303 + %308 = OpFAdd %float %305 %307 + OpStore %306 %308 + OpBranch %299 + %299 = OpLabel + %309 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %310 = OpLoad %float %309 + %311 = OpFOrdGreaterThan %bool %310 %float_0_5 + OpSelectionMerge %312 None + OpBranchConditional %311 %313 %312 + %313 = OpLabel + %315 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %316 = OpLoad %int %315 + %317 = OpAccessChain %_ptr_Function_float %color %uint_1 + %318 = OpLoad %float %317 + %319 = OpAccessChain %_ptr_Function_float %color %uint_1 + %320 = OpConvertSToF %float %316 + %321 = OpFAdd %float %318 %320 + OpStore %319 %321 + OpBranch %312 + %312 = OpLabel + %322 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %323 = OpLoad %float %322 + %324 = OpFOrdGreaterThan %bool %323 %float_0_75 + OpSelectionMerge %325 None + OpBranchConditional %324 %326 %325 + %326 = OpLabel + %328 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %329 = OpLoad %int %328 + %330 = OpAccessChain %_ptr_Function_float %color %uint_2 + %331 = OpLoad %float %330 + %332 = OpAccessChain %_ptr_Function_float %color %uint_2 + %333 = OpConvertSToF %float %329 + %334 = OpFAdd %float %331 %333 + OpStore %332 %334 + OpBranch %325 + %325 = OpLabel + %336 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %337 = OpLoad %int %336 + %338 = OpAccessChain %_ptr_Function_float %color %uint_2 + %339 = OpLoad %float %338 + %340 = OpAccessChain %_ptr_Function_float %color %uint_2 + %341 = OpConvertSToF %float %337 + %342 = OpFAdd %float %339 %341 + OpStore %340 %342 + %343 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %344 = OpLoad %float %343 + %345 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %346 = OpLoad %float %345 + %349 = OpFSub %float %344 %346 + %347 = OpExtInst %float %348 FAbs %349 + %350 = OpFOrdLessThan %bool %347 %float_0_25 + OpSelectionMerge %351 None + OpBranchConditional %350 %352 %351 + %352 = OpLabel + %353 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %354 = OpLoad %int %353 + %355 = OpAccessChain %_ptr_Function_float %color %uint_0 + %356 = OpLoad %float %355 + %357 = OpAccessChain %_ptr_Function_float %color %uint_0 + %358 = OpConvertSToF %float %354 + %359 = OpFAdd %float %356 %358 + OpStore %357 %359 + OpBranch %351 + %351 = OpLabel + %360 = OpLoad %v3float %color + %361 = OpExtInst %v3float %348 Normalize %360 + %362 = OpCompositeExtract %float %361 0 + %363 = OpCompositeExtract %float %361 1 + %364 = OpCompositeExtract %float %361 2 + %365 = OpCompositeConstruct %v4float %362 %363 %364 %float_1 + OpStore %x_GLF_color %365 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %366 +%tint_symbol_1 = OpFunctionParameter %main_out + %370 = OpLabel + %371 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %371 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %115 + %373 = OpLabel + %374 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %374 + %375 = OpFunctionCall %void %main_1 + %377 = OpLoad %v4float %x_GLF_color + %378 = OpCompositeConstruct %main_out %377 + %376 = OpFunctionCall %void %tint_symbol_3 %378 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..af97bb81e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.wgsl @@ -0,0 +1,256 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_32 : buf0; + +var x_GLF_color : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr, x_228 : mat3x3) { + var temp : i32; + let x_230 : i32 = *(i); + let x_232 : i32 = obj.numbers[x_230]; + temp = x_232; + let x_233 : i32 = *(i); + let x_234 : i32 = *(j); + let x_236 : i32 = obj.numbers[x_234]; + obj.numbers[x_233] = x_236; + let x_238 : i32 = *(j); + let x_239 : i32 = temp; + obj.numbers[x_238] = x_239; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_242 : i32 = *(h); + let x_244 : i32 = obj.numbers[x_242]; + pivot = x_244; + let x_245 : i32 = *(l); + i_1 = (x_245 - 1); + let x_247 : i32 = *(l); + j_1 = x_247; + loop { + let x_252 : i32 = j_1; + let x_253 : i32 = *(h); + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + let x_257 : i32 = j_1; + let x_259 : i32 = obj.numbers[x_257]; + let x_260 : i32 = pivot; + if ((x_259 <= x_260)) { + let x_264 : i32 = i_1; + i_1 = (x_264 + 1); + let x_266 : i32 = i_1; + param = x_266; + let x_267 : i32 = j_1; + param_1 = x_267; + swap_i1_i1_(&(param), &(param_1), mat3x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0))); + } + + continuing { + let x_269 : i32 = j_1; + j_1 = (x_269 + 1); + } + } + let x_271 : i32 = i_1; + i_1 = (x_271 + 1); + let x_273 : i32 = i_1; + param_2 = x_273; + let x_274 : i32 = *(h); + param_3 = x_274; + swap_i1_i1_(&(param_2), &(param_3), mat3x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0))); + let x_276 : i32 = i_1; + return x_276; +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_278 : i32 = top; + let x_279 : i32 = (x_278 + 1); + top = x_279; + let x_280 : i32 = l_1; + stack[x_279] = x_280; + let x_282 : i32 = top; + let x_283 : i32 = (x_282 + 1); + top = x_283; + let x_284 : i32 = h_1; + stack[x_283] = x_284; + loop { + let x_290 : i32 = top; + if ((x_290 >= 0)) { + } else { + break; + } + let x_293 : i32 = top; + top = (x_293 - 1); + let x_296 : i32 = stack[x_293]; + h_1 = x_296; + let x_297 : i32 = top; + top = (x_297 - 1); + let x_300 : i32 = stack[x_297]; + l_1 = x_300; + let x_301 : i32 = l_1; + param_4 = x_301; + let x_302 : i32 = h_1; + param_5 = x_302; + let x_303 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_303; + let x_304 : i32 = p; + let x_306 : i32 = l_1; + if (((x_304 - 1) > x_306)) { + let x_310 : i32 = top; + let x_311 : i32 = (x_310 + 1); + top = x_311; + let x_312 : i32 = l_1; + stack[x_311] = x_312; + let x_314 : i32 = top; + let x_315 : i32 = (x_314 + 1); + top = x_315; + let x_316 : i32 = p; + stack[x_315] = (x_316 - 1); + } + let x_319 : i32 = p; + let x_321 : i32 = h_1; + if (((x_319 + 1) < x_321)) { + let x_325 : i32 = top; + let x_326 : i32 = (x_325 + 1); + top = x_326; + let x_327 : i32 = p; + stack[x_326] = (x_327 + 1); + let x_330 : i32 = top; + let x_331 : i32 = (x_330 + 1); + top = x_331; + let x_332 : i32 = h_1; + stack[x_331] = x_332; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + i_2 = 0; + loop { + let x_89 : i32 = i_2; + if ((x_89 < 10)) { + } else { + break; + } + let x_92 : i32 = i_2; + let x_93 : i32 = i_2; + obj.numbers[x_92] = (10 - x_93); + let x_96 : i32 = i_2; + let x_97 : i32 = i_2; + let x_99 : i32 = obj.numbers[x_97]; + let x_100 : i32 = i_2; + let x_102 : i32 = obj.numbers[x_100]; + obj.numbers[x_96] = (x_99 * x_102); + + continuing { + let x_105 : i32 = i_2; + i_2 = (x_105 + 1); + } + } + quicksort_(); + let x_108 : vec4 = gl_FragCoord; + let x_111 : vec2 = x_32.resolution; + uv = (vec2(x_108.x, x_108.y) / x_111); + color = vec3(1.0, 2.0, 3.0); + let x_114 : i32 = obj.numbers[0]; + let x_117 : f32 = color.x; + color.x = (x_117 + f32(x_114)); + let x_121 : f32 = uv.x; + if ((x_121 > 0.25)) { + let x_126 : i32 = obj.numbers[1]; + let x_129 : f32 = color.x; + color.x = (x_129 + f32(x_126)); + } + let x_133 : f32 = uv.x; + if ((x_133 > 0.5)) { + let x_138 : i32 = obj.numbers[2]; + let x_141 : f32 = color.y; + color.y = (x_141 + f32(x_138)); + } + let x_145 : f32 = uv.x; + if ((x_145 > 0.75)) { + let x_150 : i32 = obj.numbers[3]; + let x_153 : f32 = color.z; + color.z = (x_153 + f32(x_150)); + } + let x_157 : i32 = obj.numbers[4]; + let x_160 : f32 = color.y; + color.y = (x_160 + f32(x_157)); + let x_164 : f32 = uv.y; + if ((x_164 > 0.25)) { + let x_169 : i32 = obj.numbers[5]; + let x_172 : f32 = color.x; + color.x = (x_172 + f32(x_169)); + } + let x_176 : f32 = uv.y; + if ((x_176 > 0.5)) { + let x_181 : i32 = obj.numbers[6]; + let x_184 : f32 = color.y; + color.y = (x_184 + f32(x_181)); + } + let x_188 : f32 = uv.y; + if ((x_188 > 0.75)) { + let x_193 : i32 = obj.numbers[7]; + let x_196 : f32 = color.z; + color.z = (x_196 + f32(x_193)); + } + let x_200 : i32 = obj.numbers[8]; + let x_203 : f32 = color.z; + color.z = (x_203 + f32(x_200)); + let x_207 : f32 = uv.x; + let x_209 : f32 = uv.y; + if ((abs((x_207 - x_209)) < 0.25)) { + let x_216 : i32 = obj.numbers[9]; + let x_219 : f32 = color.x; + color.x = (x_219 + f32(x_216)); + } + let x_222 : vec3 = color; + let x_223 : vec3 = normalize(x_222); + x_GLF_color = vec4(x_223.x, x_223.y, x_223.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl new file mode 100644 index 0000000000..af97bb81e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl @@ -0,0 +1,256 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_32 : buf0; + +var x_GLF_color : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr, x_228 : mat3x3) { + var temp : i32; + let x_230 : i32 = *(i); + let x_232 : i32 = obj.numbers[x_230]; + temp = x_232; + let x_233 : i32 = *(i); + let x_234 : i32 = *(j); + let x_236 : i32 = obj.numbers[x_234]; + obj.numbers[x_233] = x_236; + let x_238 : i32 = *(j); + let x_239 : i32 = temp; + obj.numbers[x_238] = x_239; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_242 : i32 = *(h); + let x_244 : i32 = obj.numbers[x_242]; + pivot = x_244; + let x_245 : i32 = *(l); + i_1 = (x_245 - 1); + let x_247 : i32 = *(l); + j_1 = x_247; + loop { + let x_252 : i32 = j_1; + let x_253 : i32 = *(h); + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + let x_257 : i32 = j_1; + let x_259 : i32 = obj.numbers[x_257]; + let x_260 : i32 = pivot; + if ((x_259 <= x_260)) { + let x_264 : i32 = i_1; + i_1 = (x_264 + 1); + let x_266 : i32 = i_1; + param = x_266; + let x_267 : i32 = j_1; + param_1 = x_267; + swap_i1_i1_(&(param), &(param_1), mat3x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0))); + } + + continuing { + let x_269 : i32 = j_1; + j_1 = (x_269 + 1); + } + } + let x_271 : i32 = i_1; + i_1 = (x_271 + 1); + let x_273 : i32 = i_1; + param_2 = x_273; + let x_274 : i32 = *(h); + param_3 = x_274; + swap_i1_i1_(&(param_2), &(param_3), mat3x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0))); + let x_276 : i32 = i_1; + return x_276; +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_278 : i32 = top; + let x_279 : i32 = (x_278 + 1); + top = x_279; + let x_280 : i32 = l_1; + stack[x_279] = x_280; + let x_282 : i32 = top; + let x_283 : i32 = (x_282 + 1); + top = x_283; + let x_284 : i32 = h_1; + stack[x_283] = x_284; + loop { + let x_290 : i32 = top; + if ((x_290 >= 0)) { + } else { + break; + } + let x_293 : i32 = top; + top = (x_293 - 1); + let x_296 : i32 = stack[x_293]; + h_1 = x_296; + let x_297 : i32 = top; + top = (x_297 - 1); + let x_300 : i32 = stack[x_297]; + l_1 = x_300; + let x_301 : i32 = l_1; + param_4 = x_301; + let x_302 : i32 = h_1; + param_5 = x_302; + let x_303 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_303; + let x_304 : i32 = p; + let x_306 : i32 = l_1; + if (((x_304 - 1) > x_306)) { + let x_310 : i32 = top; + let x_311 : i32 = (x_310 + 1); + top = x_311; + let x_312 : i32 = l_1; + stack[x_311] = x_312; + let x_314 : i32 = top; + let x_315 : i32 = (x_314 + 1); + top = x_315; + let x_316 : i32 = p; + stack[x_315] = (x_316 - 1); + } + let x_319 : i32 = p; + let x_321 : i32 = h_1; + if (((x_319 + 1) < x_321)) { + let x_325 : i32 = top; + let x_326 : i32 = (x_325 + 1); + top = x_326; + let x_327 : i32 = p; + stack[x_326] = (x_327 + 1); + let x_330 : i32 = top; + let x_331 : i32 = (x_330 + 1); + top = x_331; + let x_332 : i32 = h_1; + stack[x_331] = x_332; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + i_2 = 0; + loop { + let x_89 : i32 = i_2; + if ((x_89 < 10)) { + } else { + break; + } + let x_92 : i32 = i_2; + let x_93 : i32 = i_2; + obj.numbers[x_92] = (10 - x_93); + let x_96 : i32 = i_2; + let x_97 : i32 = i_2; + let x_99 : i32 = obj.numbers[x_97]; + let x_100 : i32 = i_2; + let x_102 : i32 = obj.numbers[x_100]; + obj.numbers[x_96] = (x_99 * x_102); + + continuing { + let x_105 : i32 = i_2; + i_2 = (x_105 + 1); + } + } + quicksort_(); + let x_108 : vec4 = gl_FragCoord; + let x_111 : vec2 = x_32.resolution; + uv = (vec2(x_108.x, x_108.y) / x_111); + color = vec3(1.0, 2.0, 3.0); + let x_114 : i32 = obj.numbers[0]; + let x_117 : f32 = color.x; + color.x = (x_117 + f32(x_114)); + let x_121 : f32 = uv.x; + if ((x_121 > 0.25)) { + let x_126 : i32 = obj.numbers[1]; + let x_129 : f32 = color.x; + color.x = (x_129 + f32(x_126)); + } + let x_133 : f32 = uv.x; + if ((x_133 > 0.5)) { + let x_138 : i32 = obj.numbers[2]; + let x_141 : f32 = color.y; + color.y = (x_141 + f32(x_138)); + } + let x_145 : f32 = uv.x; + if ((x_145 > 0.75)) { + let x_150 : i32 = obj.numbers[3]; + let x_153 : f32 = color.z; + color.z = (x_153 + f32(x_150)); + } + let x_157 : i32 = obj.numbers[4]; + let x_160 : f32 = color.y; + color.y = (x_160 + f32(x_157)); + let x_164 : f32 = uv.y; + if ((x_164 > 0.25)) { + let x_169 : i32 = obj.numbers[5]; + let x_172 : f32 = color.x; + color.x = (x_172 + f32(x_169)); + } + let x_176 : f32 = uv.y; + if ((x_176 > 0.5)) { + let x_181 : i32 = obj.numbers[6]; + let x_184 : f32 = color.y; + color.y = (x_184 + f32(x_181)); + } + let x_188 : f32 = uv.y; + if ((x_188 > 0.75)) { + let x_193 : i32 = obj.numbers[7]; + let x_196 : f32 = color.z; + color.z = (x_196 + f32(x_193)); + } + let x_200 : i32 = obj.numbers[8]; + let x_203 : f32 = color.z; + color.z = (x_203 + f32(x_200)); + let x_207 : f32 = uv.x; + let x_209 : f32 = uv.y; + if ((abs((x_207 - x_209)) < 0.25)) { + let x_216 : i32 = obj.numbers[9]; + let x_219 : f32 = color.x; + color.x = (x_219 + f32(x_216)); + } + let x_222 : vec3 = color; + let x_223 : vec3 = normalize(x_222); + x_GLF_color = vec4(x_223.x, x_223.y, x_223.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..405b0401a1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.hlsl @@ -0,0 +1,214 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_32 : register(b0, space0) { + uint4 x_32[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j, float3x3 x_228) { + int temp = 0; + const int x_230 = i; + const int x_232 = obj.numbers[x_230]; + temp = x_232; + const int x_233 = i; + const int x_234 = j; + const int x_236 = obj.numbers[x_234]; + obj.numbers[x_233] = x_236; + const int x_238 = j; + obj.numbers[x_238] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_242 = h; + const int x_244 = obj.numbers[x_242]; + pivot = x_244; + const int x_245 = l; + i_1 = (x_245 - 1); + const int x_247 = l; + j_1 = x_247; + while (true) { + const int x_252 = j_1; + const int x_253 = h; + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + const int x_259 = obj.numbers[j_1]; + if ((x_259 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1, float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f))); + } + { + j_1 = (j_1 + 1); + } + } + i_1 = (i_1 + 1); + param_2 = i_1; + const int x_274 = h; + param_3 = x_274; + swap_i1_i1_(param_2, param_3, float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f))); + return i_1; +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_279 = (top + 1); + top = x_279; + stack[x_279] = l_1; + const int x_283 = (top + 1); + top = x_283; + stack[x_283] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_293 = top; + top = (x_293 - 1); + const int x_296 = stack[x_293]; + h_1 = x_296; + const int x_297 = top; + top = (x_297 - 1); + const int x_300 = stack[x_297]; + l_1 = x_300; + param_4 = l_1; + param_5 = h_1; + const int x_303 = performPartition_i1_i1_(param_4, param_5); + p = x_303; + if (((p - 1) > l_1)) { + const int x_311 = (top + 1); + top = x_311; + stack[x_311] = l_1; + const int x_315 = (top + 1); + top = x_315; + stack[x_315] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_326 = (top + 1); + top = x_326; + stack[x_326] = (p + 1); + const int x_331 = (top + 1); + top = x_331; + stack[x_331] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_96 = i_2; + const int x_99 = obj.numbers[i_2]; + const int x_102 = obj.numbers[i_2]; + obj.numbers[x_96] = (x_99 * x_102); + } + } + quicksort_(); + const float4 x_108 = gl_FragCoord; + const float2 x_111 = asfloat(x_32[0].xy); + uv = (float2(x_108.x, x_108.y) / x_111); + color = float3(1.0f, 2.0f, 3.0f); + const int x_114 = obj.numbers[0]; + const float x_117 = color.x; + color.x = (x_117 + float(x_114)); + const float x_121 = uv.x; + if ((x_121 > 0.25f)) { + const int x_126 = obj.numbers[1]; + const float x_129 = color.x; + color.x = (x_129 + float(x_126)); + } + const float x_133 = uv.x; + if ((x_133 > 0.5f)) { + const int x_138 = obj.numbers[2]; + const float x_141 = color.y; + color.y = (x_141 + float(x_138)); + } + const float x_145 = uv.x; + if ((x_145 > 0.75f)) { + const int x_150 = obj.numbers[3]; + const float x_153 = color.z; + color.z = (x_153 + float(x_150)); + } + const int x_157 = obj.numbers[4]; + const float x_160 = color.y; + color.y = (x_160 + float(x_157)); + const float x_164 = uv.y; + if ((x_164 > 0.25f)) { + const int x_169 = obj.numbers[5]; + const float x_172 = color.x; + color.x = (x_172 + float(x_169)); + } + const float x_176 = uv.y; + if ((x_176 > 0.5f)) { + const int x_181 = obj.numbers[6]; + const float x_184 = color.y; + color.y = (x_184 + float(x_181)); + } + const float x_188 = uv.y; + if ((x_188 > 0.75f)) { + const int x_193 = obj.numbers[7]; + const float x_196 = color.z; + color.z = (x_196 + float(x_193)); + } + const int x_200 = obj.numbers[8]; + const float x_203 = color.z; + color.z = (x_203 + float(x_200)); + const float x_207 = uv.x; + const float x_209 = uv.y; + if ((abs((x_207 - x_209)) < 0.25f)) { + const int x_216 = obj.numbers[9]; + const float x_219 = color.x; + color.x = (x_219 + float(x_216)); + } + const float3 x_223 = normalize(color); + x_GLF_color = float4(x_223.x, x_223.y, x_223.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.msl new file mode 100644 index 0000000000..a97ee25fb1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.msl @@ -0,0 +1,256 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, float3x3 x_228, thread QuicksortObject* const tint_symbol_5) { + int temp = 0; + int const x_230 = *(i); + int const x_232 = (*(tint_symbol_5)).numbers.arr[x_230]; + temp = x_232; + int const x_233 = *(i); + int const x_234 = *(j); + int const x_236 = (*(tint_symbol_5)).numbers.arr[x_234]; + (*(tint_symbol_5)).numbers.arr[x_233] = x_236; + int const x_238 = *(j); + int const x_239 = temp; + (*(tint_symbol_5)).numbers.arr[x_238] = x_239; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_6) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_242 = *(h); + int const x_244 = (*(tint_symbol_6)).numbers.arr[x_242]; + pivot = x_244; + int const x_245 = *(l); + i_1 = (x_245 - 1); + int const x_247 = *(l); + j_1 = x_247; + while (true) { + int const x_252 = j_1; + int const x_253 = *(h); + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + int const x_257 = j_1; + int const x_259 = (*(tint_symbol_6)).numbers.arr[x_257]; + int const x_260 = pivot; + if ((x_259 <= x_260)) { + int const x_264 = i_1; + i_1 = (x_264 + 1); + int const x_266 = i_1; + param = x_266; + int const x_267 = j_1; + param_1 = x_267; + swap_i1_i1_(&(param), &(param_1), float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)), tint_symbol_6); + } + { + int const x_269 = j_1; + j_1 = (x_269 + 1); + } + } + int const x_271 = i_1; + i_1 = (x_271 + 1); + int const x_273 = i_1; + param_2 = x_273; + int const x_274 = *(h); + param_3 = x_274; + swap_i1_i1_(&(param_2), &(param_3), float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)), tint_symbol_6); + int const x_276 = i_1; + return x_276; +} + +void quicksort_(thread QuicksortObject* const tint_symbol_7) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_278 = top; + int const x_279 = (x_278 + 1); + top = x_279; + int const x_280 = l_1; + stack.arr[x_279] = x_280; + int const x_282 = top; + int const x_283 = (x_282 + 1); + top = x_283; + int const x_284 = h_1; + stack.arr[x_283] = x_284; + while (true) { + int const x_290 = top; + if ((x_290 >= 0)) { + } else { + break; + } + int const x_293 = top; + top = (x_293 - 1); + int const x_296 = stack.arr[x_293]; + h_1 = x_296; + int const x_297 = top; + top = (x_297 - 1); + int const x_300 = stack.arr[x_297]; + l_1 = x_300; + int const x_301 = l_1; + param_4 = x_301; + int const x_302 = h_1; + param_5 = x_302; + int const x_303 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_7); + p = x_303; + int const x_304 = p; + int const x_306 = l_1; + if (((x_304 - 1) > x_306)) { + int const x_310 = top; + int const x_311 = (x_310 + 1); + top = x_311; + int const x_312 = l_1; + stack.arr[x_311] = x_312; + int const x_314 = top; + int const x_315 = (x_314 + 1); + top = x_315; + int const x_316 = p; + stack.arr[x_315] = (x_316 - 1); + } + int const x_319 = p; + int const x_321 = h_1; + if (((x_319 + 1) < x_321)) { + int const x_325 = top; + int const x_326 = (x_325 + 1); + top = x_326; + int const x_327 = p; + stack.arr[x_326] = (x_327 + 1); + int const x_330 = top; + int const x_331 = (x_330 + 1); + top = x_331; + int const x_332 = h_1; + stack.arr[x_331] = x_332; + } + } + return; +} + +void main_1(constant buf0& x_32, thread QuicksortObject* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + i_2 = 0; + while (true) { + int const x_89 = i_2; + if ((x_89 < 10)) { + } else { + break; + } + int const x_92 = i_2; + int const x_93 = i_2; + (*(tint_symbol_8)).numbers.arr[x_92] = (10 - x_93); + int const x_96 = i_2; + int const x_97 = i_2; + int const x_99 = (*(tint_symbol_8)).numbers.arr[x_97]; + int const x_100 = i_2; + int const x_102 = (*(tint_symbol_8)).numbers.arr[x_100]; + (*(tint_symbol_8)).numbers.arr[x_96] = (x_99 * x_102); + { + int const x_105 = i_2; + i_2 = (x_105 + 1); + } + } + quicksort_(tint_symbol_8); + float4 const x_108 = *(tint_symbol_9); + float2 const x_111 = x_32.resolution; + uv = (float2(x_108.x, x_108.y) / x_111); + color = float3(1.0f, 2.0f, 3.0f); + int const x_114 = (*(tint_symbol_8)).numbers.arr[0]; + float const x_117 = color.x; + color.x = (x_117 + float(x_114)); + float const x_121 = uv.x; + if ((x_121 > 0.25f)) { + int const x_126 = (*(tint_symbol_8)).numbers.arr[1]; + float const x_129 = color.x; + color.x = (x_129 + float(x_126)); + } + float const x_133 = uv.x; + if ((x_133 > 0.5f)) { + int const x_138 = (*(tint_symbol_8)).numbers.arr[2]; + float const x_141 = color.y; + color.y = (x_141 + float(x_138)); + } + float const x_145 = uv.x; + if ((x_145 > 0.75f)) { + int const x_150 = (*(tint_symbol_8)).numbers.arr[3]; + float const x_153 = color.z; + color.z = (x_153 + float(x_150)); + } + int const x_157 = (*(tint_symbol_8)).numbers.arr[4]; + float const x_160 = color.y; + color.y = (x_160 + float(x_157)); + float const x_164 = uv.y; + if ((x_164 > 0.25f)) { + int const x_169 = (*(tint_symbol_8)).numbers.arr[5]; + float const x_172 = color.x; + color.x = (x_172 + float(x_169)); + } + float const x_176 = uv.y; + if ((x_176 > 0.5f)) { + int const x_181 = (*(tint_symbol_8)).numbers.arr[6]; + float const x_184 = color.y; + color.y = (x_184 + float(x_181)); + } + float const x_188 = uv.y; + if ((x_188 > 0.75f)) { + int const x_193 = (*(tint_symbol_8)).numbers.arr[7]; + float const x_196 = color.z; + color.z = (x_196 + float(x_193)); + } + int const x_200 = (*(tint_symbol_8)).numbers.arr[8]; + float const x_203 = color.z; + color.z = (x_203 + float(x_200)); + float const x_207 = uv.x; + float const x_209 = uv.y; + if ((fabs((x_207 - x_209)) < 0.25f)) { + int const x_216 = (*(tint_symbol_8)).numbers.arr[9]; + float const x_219 = color.x; + color.x = (x_219 + float(x_216)); + } + float3 const x_222 = color; + float3 const x_223 = normalize(x_222); + *(tint_symbol_10) = float4(x_223.x, x_223.y, x_223.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_32 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread QuicksortObject tint_symbol_12 = {}; + thread float4 tint_symbol_13 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_32, &(tint_symbol_12), &(tint_symbol_11), &(tint_symbol_13)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c8db032d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.spvasm @@ -0,0 +1,547 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 379 +; Schema: 0 + OpCapability Shader + %348 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_32 "x_32" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %x_228 "x_228" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_32 NonWritable + OpDecorate %x_32 DescriptorSet 0 + OpDecorate %x_32 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %8 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %13 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_32 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %mat3v3float + %34 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %52 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %102 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %103 = OpConstantComposite %mat3v3float %102 %102 %102 + %115 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %123 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %195 = OpConstantNull %v2float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %198 = OpConstantNull %v3float + %int_10 = OpConstant %int 10 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %236 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float + %366 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %23 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %x_228 = OpFunctionParameter %mat3v3float + %32 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %34 + %36 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Private_int %obj %uint_0 %36 + %40 = OpLoad %int %39 + OpStore %temp %40 + %42 = OpLoad %int %i + %44 = OpLoad %int %j + %45 = OpAccessChain %_ptr_Private_int %obj %uint_0 %44 + %46 = OpLoad %int %45 + %47 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + OpStore %47 %46 + %49 = OpLoad %int %j + %50 = OpLoad %int %temp + %51 = OpAccessChain %_ptr_Private_int %obj %uint_0 %49 + OpStore %51 %50 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %52 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %56 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %34 + %i_1 = OpVariable %_ptr_Function_int Function %34 + %j_1 = OpVariable %_ptr_Function_int Function %34 + %param = OpVariable %_ptr_Function_int Function %34 + %param_1 = OpVariable %_ptr_Function_int Function %34 + %param_2 = OpVariable %_ptr_Function_int Function %34 + %param_3 = OpVariable %_ptr_Function_int Function %34 + %65 = OpLoad %int %h + %66 = OpAccessChain %_ptr_Private_int %obj %uint_0 %65 + %67 = OpLoad %int %66 + OpStore %pivot %67 + %69 = OpLoad %int %l + %71 = OpISub %int %69 %int_1 + OpStore %i_1 %71 + %73 = OpLoad %int %l + OpStore %j_1 %73 + OpBranch %74 + %74 = OpLabel + OpLoopMerge %75 %76 None + OpBranch %77 + %77 = OpLabel + %78 = OpLoad %int %j_1 + %80 = OpLoad %int %h + %81 = OpISub %int %80 %int_1 + %82 = OpSLessThanEqual %bool %78 %81 + OpSelectionMerge %84 None + OpBranchConditional %82 %85 %86 + %85 = OpLabel + OpBranch %84 + %86 = OpLabel + OpBranch %75 + %84 = OpLabel + %87 = OpLoad %int %j_1 + %88 = OpAccessChain %_ptr_Private_int %obj %uint_0 %87 + %89 = OpLoad %int %88 + %90 = OpLoad %int %pivot + %91 = OpSLessThanEqual %bool %89 %90 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %92 + %93 = OpLabel + %94 = OpLoad %int %i_1 + %95 = OpIAdd %int %94 %int_1 + OpStore %i_1 %95 + %96 = OpLoad %int %i_1 + OpStore %param %96 + %97 = OpLoad %int %j_1 + OpStore %param_1 %97 + %98 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 %103 + OpBranch %92 + %92 = OpLabel + OpBranch %76 + %76 = OpLabel + %104 = OpLoad %int %j_1 + %105 = OpIAdd %int %104 %int_1 + OpStore %j_1 %105 + OpBranch %74 + %75 = OpLabel + %106 = OpLoad %int %i_1 + %107 = OpIAdd %int %106 %int_1 + OpStore %i_1 %107 + %108 = OpLoad %int %i_1 + OpStore %param_2 %108 + %110 = OpLoad %int %h + OpStore %param_3 %110 + %111 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 %103 + %114 = OpLoad %int %i_1 + OpReturnValue %114 + OpFunctionEnd + %quicksort_ = OpFunction %void None %115 + %117 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %34 + %h_1 = OpVariable %_ptr_Function_int Function %34 + %top = OpVariable %_ptr_Function_int Function %34 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %123 + %p = OpVariable %_ptr_Function_int Function %34 + %param_4 = OpVariable %_ptr_Function_int Function %34 + %param_5 = OpVariable %_ptr_Function_int Function %34 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %130 = OpLoad %int %top + %131 = OpIAdd %int %130 %int_1 + OpStore %top %131 + %132 = OpLoad %int %l_1 + %133 = OpAccessChain %_ptr_Function_int %stack %131 + OpStore %133 %132 + %134 = OpLoad %int %top + %135 = OpIAdd %int %134 %int_1 + OpStore %top %135 + %136 = OpLoad %int %h_1 + %137 = OpAccessChain %_ptr_Function_int %stack %135 + OpStore %137 %136 + OpBranch %138 + %138 = OpLabel + OpLoopMerge %139 %140 None + OpBranch %141 + %141 = OpLabel + %142 = OpLoad %int %top + %143 = OpSGreaterThanEqual %bool %142 %int_0 + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %146 + %145 = OpLabel + OpBranch %144 + %146 = OpLabel + OpBranch %139 + %144 = OpLabel + %147 = OpLoad %int %top + %148 = OpISub %int %147 %int_1 + OpStore %top %148 + %149 = OpAccessChain %_ptr_Function_int %stack %147 + %150 = OpLoad %int %149 + OpStore %h_1 %150 + %151 = OpLoad %int %top + %152 = OpISub %int %151 %int_1 + OpStore %top %152 + %153 = OpAccessChain %_ptr_Function_int %stack %151 + %154 = OpLoad %int %153 + OpStore %l_1 %154 + %155 = OpLoad %int %l_1 + OpStore %param_4 %155 + %156 = OpLoad %int %h_1 + OpStore %param_5 %156 + %157 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %157 + %160 = OpLoad %int %p + %161 = OpLoad %int %l_1 + %162 = OpISub %int %160 %int_1 + %163 = OpSGreaterThan %bool %162 %161 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %164 + %165 = OpLabel + %166 = OpLoad %int %top + %167 = OpIAdd %int %166 %int_1 + OpStore %top %167 + %168 = OpLoad %int %l_1 + %169 = OpAccessChain %_ptr_Function_int %stack %167 + OpStore %169 %168 + %170 = OpLoad %int %top + %171 = OpIAdd %int %170 %int_1 + OpStore %top %171 + %172 = OpLoad %int %p + %173 = OpAccessChain %_ptr_Function_int %stack %171 + %174 = OpISub %int %172 %int_1 + OpStore %173 %174 + OpBranch %164 + %164 = OpLabel + %175 = OpLoad %int %p + %176 = OpLoad %int %h_1 + %177 = OpIAdd %int %175 %int_1 + %178 = OpSLessThan %bool %177 %176 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %179 + %180 = OpLabel + %181 = OpLoad %int %top + %182 = OpIAdd %int %181 %int_1 + OpStore %top %182 + %183 = OpLoad %int %p + %184 = OpAccessChain %_ptr_Function_int %stack %182 + %185 = OpIAdd %int %183 %int_1 + OpStore %184 %185 + %186 = OpLoad %int %top + %187 = OpIAdd %int %186 %int_1 + OpStore %top %187 + %188 = OpLoad %int %h_1 + %189 = OpAccessChain %_ptr_Function_int %stack %187 + OpStore %189 %188 + OpBranch %179 + %179 = OpLabel + OpBranch %140 + %140 = OpLabel + OpBranch %138 + %139 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %115 + %191 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %34 + %uv = OpVariable %_ptr_Function_v2float Function %195 + %color = OpVariable %_ptr_Function_v3float Function %198 + OpStore %i_2 %int_0 + OpBranch %199 + %199 = OpLabel + OpLoopMerge %200 %201 None + OpBranch %202 + %202 = OpLabel + %203 = OpLoad %int %i_2 + %205 = OpSLessThan %bool %203 %int_10 + OpSelectionMerge %206 None + OpBranchConditional %205 %207 %208 + %207 = OpLabel + OpBranch %206 + %208 = OpLabel + OpBranch %200 + %206 = OpLabel + %209 = OpLoad %int %i_2 + %210 = OpLoad %int %i_2 + %211 = OpAccessChain %_ptr_Private_int %obj %uint_0 %209 + %212 = OpISub %int %int_10 %210 + OpStore %211 %212 + %213 = OpLoad %int %i_2 + %214 = OpLoad %int %i_2 + %215 = OpAccessChain %_ptr_Private_int %obj %uint_0 %214 + %216 = OpLoad %int %215 + %217 = OpLoad %int %i_2 + %218 = OpAccessChain %_ptr_Private_int %obj %uint_0 %217 + %219 = OpLoad %int %218 + %220 = OpAccessChain %_ptr_Private_int %obj %uint_0 %213 + %221 = OpIMul %int %216 %219 + OpStore %220 %221 + OpBranch %201 + %201 = OpLabel + %222 = OpLoad %int %i_2 + %223 = OpIAdd %int %222 %int_1 + OpStore %i_2 %223 + OpBranch %199 + %200 = OpLabel + %224 = OpFunctionCall %void %quicksort_ + %225 = OpLoad %v4float %gl_FragCoord + %227 = OpAccessChain %_ptr_Uniform_v2float %x_32 %uint_0 + %228 = OpLoad %v2float %227 + %229 = OpCompositeExtract %float %225 0 + %230 = OpCompositeExtract %float %225 1 + %231 = OpCompositeConstruct %v2float %229 %230 + %232 = OpFDiv %v2float %231 %228 + OpStore %uv %232 + OpStore %color %236 + %237 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %238 = OpLoad %int %237 + %240 = OpAccessChain %_ptr_Function_float %color %uint_0 + %241 = OpLoad %float %240 + %242 = OpAccessChain %_ptr_Function_float %color %uint_0 + %243 = OpConvertSToF %float %238 + %244 = OpFAdd %float %241 %243 + OpStore %242 %244 + %245 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %246 = OpLoad %float %245 + %248 = OpFOrdGreaterThan %bool %246 %float_0_25 + OpSelectionMerge %249 None + OpBranchConditional %248 %250 %249 + %250 = OpLabel + %251 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %252 = OpLoad %int %251 + %253 = OpAccessChain %_ptr_Function_float %color %uint_0 + %254 = OpLoad %float %253 + %255 = OpAccessChain %_ptr_Function_float %color %uint_0 + %256 = OpConvertSToF %float %252 + %257 = OpFAdd %float %254 %256 + OpStore %255 %257 + OpBranch %249 + %249 = OpLabel + %258 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %259 = OpLoad %float %258 + %261 = OpFOrdGreaterThan %bool %259 %float_0_5 + OpSelectionMerge %262 None + OpBranchConditional %261 %263 %262 + %263 = OpLabel + %265 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %266 = OpLoad %int %265 + %268 = OpAccessChain %_ptr_Function_float %color %uint_1 + %269 = OpLoad %float %268 + %270 = OpAccessChain %_ptr_Function_float %color %uint_1 + %271 = OpConvertSToF %float %266 + %272 = OpFAdd %float %269 %271 + OpStore %270 %272 + OpBranch %262 + %262 = OpLabel + %273 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %274 = OpLoad %float %273 + %276 = OpFOrdGreaterThan %bool %274 %float_0_75 + OpSelectionMerge %277 None + OpBranchConditional %276 %278 %277 + %278 = OpLabel + %280 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %281 = OpLoad %int %280 + %283 = OpAccessChain %_ptr_Function_float %color %uint_2 + %284 = OpLoad %float %283 + %285 = OpAccessChain %_ptr_Function_float %color %uint_2 + %286 = OpConvertSToF %float %281 + %287 = OpFAdd %float %284 %286 + OpStore %285 %287 + OpBranch %277 + %277 = OpLabel + %289 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %290 = OpLoad %int %289 + %291 = OpAccessChain %_ptr_Function_float %color %uint_1 + %292 = OpLoad %float %291 + %293 = OpAccessChain %_ptr_Function_float %color %uint_1 + %294 = OpConvertSToF %float %290 + %295 = OpFAdd %float %292 %294 + OpStore %293 %295 + %296 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %297 = OpLoad %float %296 + %298 = OpFOrdGreaterThan %bool %297 %float_0_25 + OpSelectionMerge %299 None + OpBranchConditional %298 %300 %299 + %300 = OpLabel + %302 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %303 = OpLoad %int %302 + %304 = OpAccessChain %_ptr_Function_float %color %uint_0 + %305 = OpLoad %float %304 + %306 = OpAccessChain %_ptr_Function_float %color %uint_0 + %307 = OpConvertSToF %float %303 + %308 = OpFAdd %float %305 %307 + OpStore %306 %308 + OpBranch %299 + %299 = OpLabel + %309 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %310 = OpLoad %float %309 + %311 = OpFOrdGreaterThan %bool %310 %float_0_5 + OpSelectionMerge %312 None + OpBranchConditional %311 %313 %312 + %313 = OpLabel + %315 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %316 = OpLoad %int %315 + %317 = OpAccessChain %_ptr_Function_float %color %uint_1 + %318 = OpLoad %float %317 + %319 = OpAccessChain %_ptr_Function_float %color %uint_1 + %320 = OpConvertSToF %float %316 + %321 = OpFAdd %float %318 %320 + OpStore %319 %321 + OpBranch %312 + %312 = OpLabel + %322 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %323 = OpLoad %float %322 + %324 = OpFOrdGreaterThan %bool %323 %float_0_75 + OpSelectionMerge %325 None + OpBranchConditional %324 %326 %325 + %326 = OpLabel + %328 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %329 = OpLoad %int %328 + %330 = OpAccessChain %_ptr_Function_float %color %uint_2 + %331 = OpLoad %float %330 + %332 = OpAccessChain %_ptr_Function_float %color %uint_2 + %333 = OpConvertSToF %float %329 + %334 = OpFAdd %float %331 %333 + OpStore %332 %334 + OpBranch %325 + %325 = OpLabel + %336 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %337 = OpLoad %int %336 + %338 = OpAccessChain %_ptr_Function_float %color %uint_2 + %339 = OpLoad %float %338 + %340 = OpAccessChain %_ptr_Function_float %color %uint_2 + %341 = OpConvertSToF %float %337 + %342 = OpFAdd %float %339 %341 + OpStore %340 %342 + %343 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %344 = OpLoad %float %343 + %345 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %346 = OpLoad %float %345 + %349 = OpFSub %float %344 %346 + %347 = OpExtInst %float %348 FAbs %349 + %350 = OpFOrdLessThan %bool %347 %float_0_25 + OpSelectionMerge %351 None + OpBranchConditional %350 %352 %351 + %352 = OpLabel + %353 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %354 = OpLoad %int %353 + %355 = OpAccessChain %_ptr_Function_float %color %uint_0 + %356 = OpLoad %float %355 + %357 = OpAccessChain %_ptr_Function_float %color %uint_0 + %358 = OpConvertSToF %float %354 + %359 = OpFAdd %float %356 %358 + OpStore %357 %359 + OpBranch %351 + %351 = OpLabel + %360 = OpLoad %v3float %color + %361 = OpExtInst %v3float %348 Normalize %360 + %362 = OpCompositeExtract %float %361 0 + %363 = OpCompositeExtract %float %361 1 + %364 = OpCompositeExtract %float %361 2 + %365 = OpCompositeConstruct %v4float %362 %363 %364 %float_1 + OpStore %x_GLF_color %365 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %366 +%tint_symbol_1 = OpFunctionParameter %main_out + %370 = OpLabel + %371 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %371 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %115 + %373 = OpLabel + %374 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %374 + %375 = OpFunctionCall %void %main_1 + %377 = OpLoad %v4float %x_GLF_color + %378 = OpCompositeConstruct %main_out %377 + %376 = OpFunctionCall %void %tint_symbol_3 %378 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..af97bb81e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.wgsl @@ -0,0 +1,256 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_32 : buf0; + +var x_GLF_color : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr, x_228 : mat3x3) { + var temp : i32; + let x_230 : i32 = *(i); + let x_232 : i32 = obj.numbers[x_230]; + temp = x_232; + let x_233 : i32 = *(i); + let x_234 : i32 = *(j); + let x_236 : i32 = obj.numbers[x_234]; + obj.numbers[x_233] = x_236; + let x_238 : i32 = *(j); + let x_239 : i32 = temp; + obj.numbers[x_238] = x_239; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_242 : i32 = *(h); + let x_244 : i32 = obj.numbers[x_242]; + pivot = x_244; + let x_245 : i32 = *(l); + i_1 = (x_245 - 1); + let x_247 : i32 = *(l); + j_1 = x_247; + loop { + let x_252 : i32 = j_1; + let x_253 : i32 = *(h); + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + let x_257 : i32 = j_1; + let x_259 : i32 = obj.numbers[x_257]; + let x_260 : i32 = pivot; + if ((x_259 <= x_260)) { + let x_264 : i32 = i_1; + i_1 = (x_264 + 1); + let x_266 : i32 = i_1; + param = x_266; + let x_267 : i32 = j_1; + param_1 = x_267; + swap_i1_i1_(&(param), &(param_1), mat3x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0))); + } + + continuing { + let x_269 : i32 = j_1; + j_1 = (x_269 + 1); + } + } + let x_271 : i32 = i_1; + i_1 = (x_271 + 1); + let x_273 : i32 = i_1; + param_2 = x_273; + let x_274 : i32 = *(h); + param_3 = x_274; + swap_i1_i1_(&(param_2), &(param_3), mat3x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0))); + let x_276 : i32 = i_1; + return x_276; +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_278 : i32 = top; + let x_279 : i32 = (x_278 + 1); + top = x_279; + let x_280 : i32 = l_1; + stack[x_279] = x_280; + let x_282 : i32 = top; + let x_283 : i32 = (x_282 + 1); + top = x_283; + let x_284 : i32 = h_1; + stack[x_283] = x_284; + loop { + let x_290 : i32 = top; + if ((x_290 >= 0)) { + } else { + break; + } + let x_293 : i32 = top; + top = (x_293 - 1); + let x_296 : i32 = stack[x_293]; + h_1 = x_296; + let x_297 : i32 = top; + top = (x_297 - 1); + let x_300 : i32 = stack[x_297]; + l_1 = x_300; + let x_301 : i32 = l_1; + param_4 = x_301; + let x_302 : i32 = h_1; + param_5 = x_302; + let x_303 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_303; + let x_304 : i32 = p; + let x_306 : i32 = l_1; + if (((x_304 - 1) > x_306)) { + let x_310 : i32 = top; + let x_311 : i32 = (x_310 + 1); + top = x_311; + let x_312 : i32 = l_1; + stack[x_311] = x_312; + let x_314 : i32 = top; + let x_315 : i32 = (x_314 + 1); + top = x_315; + let x_316 : i32 = p; + stack[x_315] = (x_316 - 1); + } + let x_319 : i32 = p; + let x_321 : i32 = h_1; + if (((x_319 + 1) < x_321)) { + let x_325 : i32 = top; + let x_326 : i32 = (x_325 + 1); + top = x_326; + let x_327 : i32 = p; + stack[x_326] = (x_327 + 1); + let x_330 : i32 = top; + let x_331 : i32 = (x_330 + 1); + top = x_331; + let x_332 : i32 = h_1; + stack[x_331] = x_332; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + i_2 = 0; + loop { + let x_89 : i32 = i_2; + if ((x_89 < 10)) { + } else { + break; + } + let x_92 : i32 = i_2; + let x_93 : i32 = i_2; + obj.numbers[x_92] = (10 - x_93); + let x_96 : i32 = i_2; + let x_97 : i32 = i_2; + let x_99 : i32 = obj.numbers[x_97]; + let x_100 : i32 = i_2; + let x_102 : i32 = obj.numbers[x_100]; + obj.numbers[x_96] = (x_99 * x_102); + + continuing { + let x_105 : i32 = i_2; + i_2 = (x_105 + 1); + } + } + quicksort_(); + let x_108 : vec4 = gl_FragCoord; + let x_111 : vec2 = x_32.resolution; + uv = (vec2(x_108.x, x_108.y) / x_111); + color = vec3(1.0, 2.0, 3.0); + let x_114 : i32 = obj.numbers[0]; + let x_117 : f32 = color.x; + color.x = (x_117 + f32(x_114)); + let x_121 : f32 = uv.x; + if ((x_121 > 0.25)) { + let x_126 : i32 = obj.numbers[1]; + let x_129 : f32 = color.x; + color.x = (x_129 + f32(x_126)); + } + let x_133 : f32 = uv.x; + if ((x_133 > 0.5)) { + let x_138 : i32 = obj.numbers[2]; + let x_141 : f32 = color.y; + color.y = (x_141 + f32(x_138)); + } + let x_145 : f32 = uv.x; + if ((x_145 > 0.75)) { + let x_150 : i32 = obj.numbers[3]; + let x_153 : f32 = color.z; + color.z = (x_153 + f32(x_150)); + } + let x_157 : i32 = obj.numbers[4]; + let x_160 : f32 = color.y; + color.y = (x_160 + f32(x_157)); + let x_164 : f32 = uv.y; + if ((x_164 > 0.25)) { + let x_169 : i32 = obj.numbers[5]; + let x_172 : f32 = color.x; + color.x = (x_172 + f32(x_169)); + } + let x_176 : f32 = uv.y; + if ((x_176 > 0.5)) { + let x_181 : i32 = obj.numbers[6]; + let x_184 : f32 = color.y; + color.y = (x_184 + f32(x_181)); + } + let x_188 : f32 = uv.y; + if ((x_188 > 0.75)) { + let x_193 : i32 = obj.numbers[7]; + let x_196 : f32 = color.z; + color.z = (x_196 + f32(x_193)); + } + let x_200 : i32 = obj.numbers[8]; + let x_203 : f32 = color.z; + color.z = (x_203 + f32(x_200)); + let x_207 : f32 = uv.x; + let x_209 : f32 = uv.y; + if ((abs((x_207 - x_209)) < 0.25)) { + let x_216 : i32 = obj.numbers[9]; + let x_219 : f32 = color.x; + color.x = (x_219 + f32(x_216)); + } + let x_222 : vec3 = color; + let x_223 : vec3 = normalize(x_222); + x_GLF_color = vec4(x_223.x, x_223.y, x_223.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm new file mode 100644 index 0000000000..471025cb31 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm @@ -0,0 +1,193 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %true = OpConstantTrue %bool + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_8 = OpConstant %int 8 + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %30 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %31 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %32 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %34 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %37 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %39 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %41 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %43 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %44 = OpConstantComposite %_arr_v4float_uint_8 %30 %31 %32 %34 %37 %39 %41 %43 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %49 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %50 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %51 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %52 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %53 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %54 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %55 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %56 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %57 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %58 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %59 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %60 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %61 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %62 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %63 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %64 = OpConstantComposite %_arr_v4float_uint_16 %49 %50 %51 %52 %53 %54 %55 %56 %49 %57 %58 %59 %60 %61 %62 %63 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %75 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %76 = OpConstantComposite %_arr_v4float_uint_8 %75 %75 %75 %75 %75 %75 %75 %75 + %float_0_0 = OpConstant %float 0 + %78 = OpConstantComposite %v4float %float_0_0 %float_0_0 %float_0_0 %float_0_0 + %79 = OpConstantComposite %_arr_v4float_uint_8 %78 %78 %78 %78 %78 %78 %78 %78 + %main = OpFunction %void None %8 + %80 = OpLabel + %81 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %76 + %82 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function + %83 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function + %84 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function + %85 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + OpStore %81 %44 + %86 = OpLoad %_arr_v4float_uint_8 %81 + %87 = OpLoad %v4float %gl_FragCoord + %88 = OpVectorShuffle %v2float %87 %87 0 1 + %89 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %90 = OpLoad %v2float %89 + %91 = OpFDiv %v2float %88 %90 + %92 = OpVectorTimesScalar %v2float %91 %float_32 + %93 = OpExtInst %v2float %1 Floor %92 + OpBranch %94 + %94 = OpLabel + %95 = OpPhi %v4float %22 %80 %96 %97 + %98 = OpPhi %int %int_0 %80 %99 %97 + %100 = OpSLessThan %bool %98 %int_8 + OpLoopMerge %101 %97 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %82 %86 + %103 = OpAccessChain %_ptr_Function_v4float %82 %98 + %104 = OpLoad %v4float %103 + OpSelectionMerge %105 None + OpSwitch %uint_0 %106 + %106 = OpLabel + %107 = OpCompositeExtract %float %93 0 + %108 = OpCompositeExtract %float %104 0 + %109 = OpFOrdLessThan %bool %107 %108 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + OpBranch %105 + %110 = OpLabel + %112 = OpCompositeExtract %float %93 1 + %113 = OpCompositeExtract %float %104 1 + %114 = OpFOrdLessThan %bool %112 %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %115 + %116 = OpLabel + OpBranch %105 + %115 = OpLabel + %117 = OpCompositeExtract %float %104 2 + %118 = OpFAdd %float %108 %117 + %119 = OpFOrdGreaterThan %bool %107 %118 + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %120 + %121 = OpLabel + OpBranch %105 + %120 = OpLabel + %122 = OpCompositeExtract %float %104 3 + %123 = OpFAdd %float %113 %122 + %124 = OpFOrdGreaterThan %bool %112 %123 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %125 + %126 = OpLabel + OpBranch %105 + %125 = OpLabel + OpBranch %105 + %105 = OpLabel + %127 = OpPhi %bool %false %111 %false %116 %false %121 %false %126 %true %125 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %128 + %129 = OpLabel + OpStore %83 %44 + %130 = OpAccessChain %_ptr_Function_float %83 %98 %uint_0 + %131 = OpLoad %float %130 + %132 = OpConvertFToS %int %131 + OpStore %84 %44 + %133 = OpAccessChain %_ptr_Function_float %84 %98 %uint_1 + %134 = OpLoad %float %133 + %135 = OpLoad %_arr_v4float_uint_8 %81 + OpStore %81 %79 + OpStore %81 %135 + %136 = OpConvertFToS %int %134 + %137 = OpIMul %int %132 %136 + %138 = OpIMul %int %98 %int_9 + %139 = OpIAdd %int %137 %138 + %140 = OpIAdd %int %139 %int_11 + %141 = OpSMod %int %140 %int_16 + OpStore %85 %64 + %142 = OpAccessChain %_ptr_Function_v4float %85 %141 + %143 = OpLoad %v4float %142 + OpBranch %128 + %128 = OpLabel + %96 = OpPhi %v4float %95 %105 %143 %129 + OpBranch %97 + %97 = OpLabel + %99 = OpIAdd %int %98 %int_1 + OpBranch %94 + %101 = OpLabel + OpStore %_GLF_color %95 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..2846e30cf1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.hlsl @@ -0,0 +1,110 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 x_81[8] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + float4 x_82[8] = (float4[8])0; + float4 x_83[8] = (float4[8])0; + float4 x_84[8] = (float4[8])0; + float4 x_85[16] = (float4[16])0; + float4 x_95 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_95_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_98_phi = 0; + const float4 tint_symbol_5[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_81 = tint_symbol_5; + const float4 x_86[8] = x_81; + const float4 x_87 = gl_FragCoord; + const float2 x_90 = asfloat(x_6[0].xy); + const float2 x_93 = floor(((float2(x_87.x, x_87.y) / x_90) * 32.0f)); + x_95_phi = float4(0.5f, 0.5f, 1.0f, 1.0f); + x_98_phi = 0; + while (true) { + float4 x_143 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_99 = 0; + bool x_127_phi = false; + float4 x_96_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_95 = x_95_phi; + const int x_98 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + float4 x_104 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_82 = x_86; + x_104 = x_82[x_98]; + switch(0u) { + default: { + const float x_107 = x_93.x; + const float x_108 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + const float x_112 = x_93.y; + const float x_113 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + break; + } + } + const bool x_127 = x_127_phi; + x_96_phi = x_95; + if (x_127) { + const float4 tint_symbol_6[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_83 = tint_symbol_6; + const float x_131 = x_83[x_98].x; + const float4 tint_symbol_7[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_84 = tint_symbol_7; + const float x_134 = x_84[x_98].y; + const float4 x_135[8] = x_81; + const float4 tint_symbol_8[8] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + x_81 = tint_symbol_8; + x_81 = x_135; + const float4 tint_symbol_9[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + x_85 = tint_symbol_9; + x_143 = x_85[((((int(x_131) * int(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_143; + } + const float4 x_96 = x_96_phi; + { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + x_GLF_color = x_95; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_10 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_10; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.msl new file mode 100644 index 0000000000..c69c232baa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.msl @@ -0,0 +1,115 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[8]; +}; +struct tint_array_wrapper_1 { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) { + tint_array_wrapper x_81 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + tint_array_wrapper x_82 = {}; + tint_array_wrapper x_83 = {}; + tint_array_wrapper x_84 = {}; + tint_array_wrapper_1 x_85 = {}; + float4 x_95 = 0.0f; + float4 x_95_phi = 0.0f; + int x_98_phi = 0; + tint_array_wrapper const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_81 = tint_symbol_4; + tint_array_wrapper const x_86 = x_81; + float4 const x_87 = *(tint_symbol_10); + float2 const x_90 = x_6.resolution; + float2 const x_93 = floor(((float2(x_87.x, x_87.y) / x_90) * 32.0f)); + x_95_phi = float4(0.5f, 0.5f, 1.0f, 1.0f); + x_98_phi = 0; + while (true) { + float4 x_143 = 0.0f; + int x_99 = 0; + bool x_127_phi = false; + float4 x_96_phi = 0.0f; + x_95 = x_95_phi; + int const x_98 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + float4 x_104 = 0.0f; + x_82 = x_86; + x_104 = x_82.arr[x_98]; + switch(0u) { + default: { + float const x_107 = x_93.x; + float const x_108 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + float const x_112 = x_93.y; + float const x_113 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + break; + } + } + bool const x_127 = x_127_phi; + x_96_phi = x_95; + if (x_127) { + tint_array_wrapper const tint_symbol_5 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_83 = tint_symbol_5; + float const x_131 = x_83.arr[x_98].x; + tint_array_wrapper const tint_symbol_6 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_84 = tint_symbol_6; + float const x_134 = x_84.arr[x_98].y; + tint_array_wrapper const x_135 = x_81; + tint_array_wrapper const tint_symbol_7 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + x_81 = tint_symbol_7; + x_81 = x_135; + tint_array_wrapper_1 const tint_symbol_8 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + x_85 = tint_symbol_8; + x_143 = x_85.arr[((((int(x_131) * int(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_143; + } + float4 const x_96 = x_96_phi; + { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + *(tint_symbol_11) = x_95; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_12 = 0.0f; + thread float4 tint_symbol_13 = 0.0f; + tint_symbol_12 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_12), &(tint_symbol_13)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13}; + tint_symbol_2 const tint_symbol_9 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..5d0f00b481 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.spvasm @@ -0,0 +1,290 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 187 +; Schema: 0 + OpCapability Shader + %67 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_81 "x_81" + OpName %x_82 "x_82" + OpName %x_83 "x_83" + OpName %x_84 "x_84" + OpName %x_85 "x_85" + OpName %x_95 "x_95" + OpName %x_95_phi "x_95_phi" + OpName %x_98_phi "x_98_phi" + OpName %x_143 "x_143" + OpName %x_99 "x_99" + OpName %x_127_phi "x_127_phi" + OpName %x_96_phi "x_96_phi" + OpName %x_104 "x_104" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_8 ArrayStride 16 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %24 = OpConstantComposite %_arr_v4float_uint_8 %23 %23 %23 %23 %23 %23 %23 %23 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %27 = OpConstantNull %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %35 = OpConstantNull %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %42 = OpConstantNull %int + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %45 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %46 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %47 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %49 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %52 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %54 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %56 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %58 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %59 = OpConstantComposite %_arr_v4float_uint_8 %45 %46 %47 %49 %52 %54 %56 %58 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %76 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %87 = OpConstantNull %bool + %int_8 = OpConstant %int 8 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %140 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %141 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %142 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %143 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %144 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %145 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %146 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %147 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %148 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %149 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %150 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %151 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %152 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %153 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %154 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %155 = OpConstantComposite %_arr_v4float_uint_16 %140 %141 %142 %143 %144 %145 %146 %147 %140 %148 %149 %150 %151 %152 %153 %154 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %174 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_81 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_82 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_83 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_84 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_85 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %35 + %x_95 = OpVariable %_ptr_Function_v4float Function %5 + %x_95_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_98_phi = OpVariable %_ptr_Function_int Function %42 + %x_143 = OpVariable %_ptr_Function_v4float Function %5 + %x_99 = OpVariable %_ptr_Function_int Function %42 + %x_127_phi = OpVariable %_ptr_Function_bool Function %87 + %x_96_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_104 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %x_81 %24 + OpStore %x_81 %59 + %60 = OpLoad %_arr_v4float_uint_8 %x_81 + %61 = OpLoad %v4float %gl_FragCoord + %64 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %65 = OpLoad %v2float %64 + %68 = OpCompositeExtract %float %61 0 + %69 = OpCompositeExtract %float %61 1 + %70 = OpCompositeConstruct %v2float %68 %69 + %71 = OpFDiv %v2float %70 %65 + %73 = OpVectorTimesScalar %v2float %71 %float_32 + %66 = OpExtInst %v2float %67 Floor %73 + OpStore %x_95_phi %76 + OpStore %x_98_phi %int_0 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %89 = OpLoad %v4float %x_95_phi + OpStore %x_95 %89 + %90 = OpLoad %int %x_98_phi + %92 = OpSLessThan %bool %90 %int_8 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + OpBranch %93 + %95 = OpLabel + OpBranch %79 + %93 = OpLabel + OpStore %x_82 %60 + %97 = OpAccessChain %_ptr_Function_v4float %x_82 %90 + %98 = OpLoad %v4float %97 + OpStore %x_104 %98 + OpSelectionMerge %99 None + OpSwitch %uint_0 %100 + %100 = OpLabel + %101 = OpCompositeExtract %float %66 0 + %103 = OpAccessChain %_ptr_Function_float %x_104 %uint_0 + %104 = OpLoad %float %103 + %105 = OpFOrdLessThan %bool %101 %104 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %106 = OpLabel + %109 = OpCompositeExtract %float %66 1 + %111 = OpAccessChain %_ptr_Function_float %x_104 %uint_1 + %112 = OpLoad %float %111 + %113 = OpFOrdLessThan %bool %109 %112 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %114 + %115 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %114 = OpLabel + %117 = OpAccessChain %_ptr_Function_float %x_104 %uint_2 + %118 = OpLoad %float %117 + %119 = OpFAdd %float %104 %118 + %120 = OpFOrdGreaterThan %bool %101 %119 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %121 + %122 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %121 = OpLabel + %124 = OpAccessChain %_ptr_Function_float %x_104 %uint_3 + %125 = OpLoad %float %124 + %126 = OpFAdd %float %112 %125 + %127 = OpFOrdGreaterThan %bool %109 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %128 + %129 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %128 = OpLabel + OpStore %x_127_phi %true + OpBranch %99 + %99 = OpLabel + %131 = OpLoad %bool %x_127_phi + %132 = OpLoad %v4float %x_95 + OpStore %x_96_phi %132 + OpSelectionMerge %133 None + OpBranchConditional %131 %134 %133 + %134 = OpLabel + OpStore %x_83 %59 + %135 = OpAccessChain %_ptr_Function_float %x_83 %90 %uint_0 + %136 = OpLoad %float %135 + OpStore %x_84 %59 + %137 = OpAccessChain %_ptr_Function_float %x_84 %90 %uint_1 + %138 = OpLoad %float %137 + %139 = OpLoad %_arr_v4float_uint_8 %x_81 + OpStore %x_81 %24 + OpStore %x_81 %139 + OpStore %x_85 %155 + %156 = OpConvertFToS %int %136 + %157 = OpConvertFToS %int %138 + %158 = OpIMul %int %156 %157 + %160 = OpIMul %int %90 %int_9 + %161 = OpIAdd %int %158 %160 + %163 = OpIAdd %int %161 %int_11 + %165 = OpSMod %int %163 %int_16 + %166 = OpAccessChain %_ptr_Function_v4float %x_85 %165 + %167 = OpLoad %v4float %166 + OpStore %x_143 %167 + %168 = OpLoad %v4float %x_143 + OpStore %x_96_phi %168 + OpBranch %133 + %133 = OpLabel + %169 = OpLoad %v4float %x_96_phi + OpBranch %80 + %80 = OpLabel + %171 = OpIAdd %int %90 %int_1 + OpStore %x_99 %171 + OpStore %x_95_phi %169 + %172 = OpLoad %int %x_99 + OpStore %x_98_phi %172 + OpBranch %78 + %79 = OpLabel + %173 = OpLoad %v4float %x_95 + OpStore %x_GLF_color %173 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %174 +%tint_symbol_1 = OpFunctionParameter %main_out + %178 = OpLabel + %179 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %179 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %181 = OpLabel + %182 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %182 + %183 = OpFunctionCall %void %main_1 + %185 = OpLoad %v4float %x_GLF_color + %186 = OpCompositeConstruct %main_out %185 + %184 = OpFunctionCall %void %tint_symbol_3 %186 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..8f0982f88f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.spvasm.expected.wgsl @@ -0,0 +1,103 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_81 : array, 8> = array, 8>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + var x_82 : array, 8>; + var x_83 : array, 8>; + var x_84 : array, 8>; + var x_85 : array, 16>; + var x_95 : vec4; + var x_95_phi : vec4; + var x_98_phi : i32; + x_81 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_86 : array, 8> = x_81; + let x_87 : vec4 = gl_FragCoord; + let x_90 : vec2 = x_6.resolution; + let x_93 : vec2 = floor(((vec2(x_87.x, x_87.y) / x_90) * 32.0)); + x_95_phi = vec4(0.5, 0.5, 1.0, 1.0); + x_98_phi = 0; + loop { + var x_143 : vec4; + var x_99 : i32; + var x_127_phi : bool; + var x_96_phi : vec4; + x_95 = x_95_phi; + let x_98 : i32 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + var x_104 : vec4; + x_82 = x_86; + x_104 = x_82[x_98]; + switch(0u) { + default: { + let x_107 : f32 = x_93.x; + let x_108 : f32 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + let x_112 : f32 = x_93.y; + let x_113 : f32 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + } + } + let x_127 : bool = x_127_phi; + x_96_phi = x_95; + if (x_127) { + x_83 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_131 : f32 = x_83[x_98].x; + x_84 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_134 : f32 = x_84[x_98].y; + let x_135 : array, 8> = x_81; + x_81 = array, 8>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + x_81 = x_135; + x_85 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + x_143 = x_85[((((i32(x_131) * i32(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_143; + } + let x_96 : vec4 = x_96_phi; + + continuing { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + x_GLF_color = x_95; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl new file mode 100644 index 0000000000..8f0982f88f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl @@ -0,0 +1,103 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_81 : array, 8> = array, 8>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + var x_82 : array, 8>; + var x_83 : array, 8>; + var x_84 : array, 8>; + var x_85 : array, 16>; + var x_95 : vec4; + var x_95_phi : vec4; + var x_98_phi : i32; + x_81 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_86 : array, 8> = x_81; + let x_87 : vec4 = gl_FragCoord; + let x_90 : vec2 = x_6.resolution; + let x_93 : vec2 = floor(((vec2(x_87.x, x_87.y) / x_90) * 32.0)); + x_95_phi = vec4(0.5, 0.5, 1.0, 1.0); + x_98_phi = 0; + loop { + var x_143 : vec4; + var x_99 : i32; + var x_127_phi : bool; + var x_96_phi : vec4; + x_95 = x_95_phi; + let x_98 : i32 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + var x_104 : vec4; + x_82 = x_86; + x_104 = x_82[x_98]; + switch(0u) { + default: { + let x_107 : f32 = x_93.x; + let x_108 : f32 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + let x_112 : f32 = x_93.y; + let x_113 : f32 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + } + } + let x_127 : bool = x_127_phi; + x_96_phi = x_95; + if (x_127) { + x_83 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_131 : f32 = x_83[x_98].x; + x_84 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_134 : f32 = x_84[x_98].y; + let x_135 : array, 8> = x_81; + x_81 = array, 8>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + x_81 = x_135; + x_85 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + x_143 = x_85[((((i32(x_131) * i32(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_143; + } + let x_96 : vec4 = x_96_phi; + + continuing { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + x_GLF_color = x_95; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..2846e30cf1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.hlsl @@ -0,0 +1,110 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 x_81[8] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + float4 x_82[8] = (float4[8])0; + float4 x_83[8] = (float4[8])0; + float4 x_84[8] = (float4[8])0; + float4 x_85[16] = (float4[16])0; + float4 x_95 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_95_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_98_phi = 0; + const float4 tint_symbol_5[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_81 = tint_symbol_5; + const float4 x_86[8] = x_81; + const float4 x_87 = gl_FragCoord; + const float2 x_90 = asfloat(x_6[0].xy); + const float2 x_93 = floor(((float2(x_87.x, x_87.y) / x_90) * 32.0f)); + x_95_phi = float4(0.5f, 0.5f, 1.0f, 1.0f); + x_98_phi = 0; + while (true) { + float4 x_143 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_99 = 0; + bool x_127_phi = false; + float4 x_96_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_95 = x_95_phi; + const int x_98 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + float4 x_104 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_82 = x_86; + x_104 = x_82[x_98]; + switch(0u) { + default: { + const float x_107 = x_93.x; + const float x_108 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + const float x_112 = x_93.y; + const float x_113 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + break; + } + } + const bool x_127 = x_127_phi; + x_96_phi = x_95; + if (x_127) { + const float4 tint_symbol_6[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_83 = tint_symbol_6; + const float x_131 = x_83[x_98].x; + const float4 tint_symbol_7[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_84 = tint_symbol_7; + const float x_134 = x_84[x_98].y; + const float4 x_135[8] = x_81; + const float4 tint_symbol_8[8] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + x_81 = tint_symbol_8; + x_81 = x_135; + const float4 tint_symbol_9[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + x_85 = tint_symbol_9; + x_143 = x_85[((((int(x_131) * int(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_143; + } + const float4 x_96 = x_96_phi; + { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + x_GLF_color = x_95; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_10 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_10; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.msl new file mode 100644 index 0000000000..c69c232baa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.msl @@ -0,0 +1,115 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[8]; +}; +struct tint_array_wrapper_1 { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) { + tint_array_wrapper x_81 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + tint_array_wrapper x_82 = {}; + tint_array_wrapper x_83 = {}; + tint_array_wrapper x_84 = {}; + tint_array_wrapper_1 x_85 = {}; + float4 x_95 = 0.0f; + float4 x_95_phi = 0.0f; + int x_98_phi = 0; + tint_array_wrapper const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_81 = tint_symbol_4; + tint_array_wrapper const x_86 = x_81; + float4 const x_87 = *(tint_symbol_10); + float2 const x_90 = x_6.resolution; + float2 const x_93 = floor(((float2(x_87.x, x_87.y) / x_90) * 32.0f)); + x_95_phi = float4(0.5f, 0.5f, 1.0f, 1.0f); + x_98_phi = 0; + while (true) { + float4 x_143 = 0.0f; + int x_99 = 0; + bool x_127_phi = false; + float4 x_96_phi = 0.0f; + x_95 = x_95_phi; + int const x_98 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + float4 x_104 = 0.0f; + x_82 = x_86; + x_104 = x_82.arr[x_98]; + switch(0u) { + default: { + float const x_107 = x_93.x; + float const x_108 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + float const x_112 = x_93.y; + float const x_113 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + break; + } + } + bool const x_127 = x_127_phi; + x_96_phi = x_95; + if (x_127) { + tint_array_wrapper const tint_symbol_5 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_83 = tint_symbol_5; + float const x_131 = x_83.arr[x_98].x; + tint_array_wrapper const tint_symbol_6 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_84 = tint_symbol_6; + float const x_134 = x_84.arr[x_98].y; + tint_array_wrapper const x_135 = x_81; + tint_array_wrapper const tint_symbol_7 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + x_81 = tint_symbol_7; + x_81 = x_135; + tint_array_wrapper_1 const tint_symbol_8 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + x_85 = tint_symbol_8; + x_143 = x_85.arr[((((int(x_131) * int(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_143; + } + float4 const x_96 = x_96_phi; + { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + *(tint_symbol_11) = x_95; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_12 = 0.0f; + thread float4 tint_symbol_13 = 0.0f; + tint_symbol_12 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_12), &(tint_symbol_13)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13}; + tint_symbol_2 const tint_symbol_9 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d0f00b481 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.spvasm @@ -0,0 +1,290 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 187 +; Schema: 0 + OpCapability Shader + %67 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_81 "x_81" + OpName %x_82 "x_82" + OpName %x_83 "x_83" + OpName %x_84 "x_84" + OpName %x_85 "x_85" + OpName %x_95 "x_95" + OpName %x_95_phi "x_95_phi" + OpName %x_98_phi "x_98_phi" + OpName %x_143 "x_143" + OpName %x_99 "x_99" + OpName %x_127_phi "x_127_phi" + OpName %x_96_phi "x_96_phi" + OpName %x_104 "x_104" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_8 ArrayStride 16 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %24 = OpConstantComposite %_arr_v4float_uint_8 %23 %23 %23 %23 %23 %23 %23 %23 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %27 = OpConstantNull %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %35 = OpConstantNull %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %42 = OpConstantNull %int + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %45 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %46 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %47 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %49 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %52 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %54 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %56 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %58 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %59 = OpConstantComposite %_arr_v4float_uint_8 %45 %46 %47 %49 %52 %54 %56 %58 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %76 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %87 = OpConstantNull %bool + %int_8 = OpConstant %int 8 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %140 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %141 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %142 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %143 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %144 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %145 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %146 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %147 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %148 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %149 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %150 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %151 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %152 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %153 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %154 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %155 = OpConstantComposite %_arr_v4float_uint_16 %140 %141 %142 %143 %144 %145 %146 %147 %140 %148 %149 %150 %151 %152 %153 %154 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %174 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_81 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_82 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_83 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_84 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_85 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %35 + %x_95 = OpVariable %_ptr_Function_v4float Function %5 + %x_95_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_98_phi = OpVariable %_ptr_Function_int Function %42 + %x_143 = OpVariable %_ptr_Function_v4float Function %5 + %x_99 = OpVariable %_ptr_Function_int Function %42 + %x_127_phi = OpVariable %_ptr_Function_bool Function %87 + %x_96_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_104 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %x_81 %24 + OpStore %x_81 %59 + %60 = OpLoad %_arr_v4float_uint_8 %x_81 + %61 = OpLoad %v4float %gl_FragCoord + %64 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %65 = OpLoad %v2float %64 + %68 = OpCompositeExtract %float %61 0 + %69 = OpCompositeExtract %float %61 1 + %70 = OpCompositeConstruct %v2float %68 %69 + %71 = OpFDiv %v2float %70 %65 + %73 = OpVectorTimesScalar %v2float %71 %float_32 + %66 = OpExtInst %v2float %67 Floor %73 + OpStore %x_95_phi %76 + OpStore %x_98_phi %int_0 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %89 = OpLoad %v4float %x_95_phi + OpStore %x_95 %89 + %90 = OpLoad %int %x_98_phi + %92 = OpSLessThan %bool %90 %int_8 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + OpBranch %93 + %95 = OpLabel + OpBranch %79 + %93 = OpLabel + OpStore %x_82 %60 + %97 = OpAccessChain %_ptr_Function_v4float %x_82 %90 + %98 = OpLoad %v4float %97 + OpStore %x_104 %98 + OpSelectionMerge %99 None + OpSwitch %uint_0 %100 + %100 = OpLabel + %101 = OpCompositeExtract %float %66 0 + %103 = OpAccessChain %_ptr_Function_float %x_104 %uint_0 + %104 = OpLoad %float %103 + %105 = OpFOrdLessThan %bool %101 %104 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %106 = OpLabel + %109 = OpCompositeExtract %float %66 1 + %111 = OpAccessChain %_ptr_Function_float %x_104 %uint_1 + %112 = OpLoad %float %111 + %113 = OpFOrdLessThan %bool %109 %112 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %114 + %115 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %114 = OpLabel + %117 = OpAccessChain %_ptr_Function_float %x_104 %uint_2 + %118 = OpLoad %float %117 + %119 = OpFAdd %float %104 %118 + %120 = OpFOrdGreaterThan %bool %101 %119 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %121 + %122 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %121 = OpLabel + %124 = OpAccessChain %_ptr_Function_float %x_104 %uint_3 + %125 = OpLoad %float %124 + %126 = OpFAdd %float %112 %125 + %127 = OpFOrdGreaterThan %bool %109 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %128 + %129 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %128 = OpLabel + OpStore %x_127_phi %true + OpBranch %99 + %99 = OpLabel + %131 = OpLoad %bool %x_127_phi + %132 = OpLoad %v4float %x_95 + OpStore %x_96_phi %132 + OpSelectionMerge %133 None + OpBranchConditional %131 %134 %133 + %134 = OpLabel + OpStore %x_83 %59 + %135 = OpAccessChain %_ptr_Function_float %x_83 %90 %uint_0 + %136 = OpLoad %float %135 + OpStore %x_84 %59 + %137 = OpAccessChain %_ptr_Function_float %x_84 %90 %uint_1 + %138 = OpLoad %float %137 + %139 = OpLoad %_arr_v4float_uint_8 %x_81 + OpStore %x_81 %24 + OpStore %x_81 %139 + OpStore %x_85 %155 + %156 = OpConvertFToS %int %136 + %157 = OpConvertFToS %int %138 + %158 = OpIMul %int %156 %157 + %160 = OpIMul %int %90 %int_9 + %161 = OpIAdd %int %158 %160 + %163 = OpIAdd %int %161 %int_11 + %165 = OpSMod %int %163 %int_16 + %166 = OpAccessChain %_ptr_Function_v4float %x_85 %165 + %167 = OpLoad %v4float %166 + OpStore %x_143 %167 + %168 = OpLoad %v4float %x_143 + OpStore %x_96_phi %168 + OpBranch %133 + %133 = OpLabel + %169 = OpLoad %v4float %x_96_phi + OpBranch %80 + %80 = OpLabel + %171 = OpIAdd %int %90 %int_1 + OpStore %x_99 %171 + OpStore %x_95_phi %169 + %172 = OpLoad %int %x_99 + OpStore %x_98_phi %172 + OpBranch %78 + %79 = OpLabel + %173 = OpLoad %v4float %x_95 + OpStore %x_GLF_color %173 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %174 +%tint_symbol_1 = OpFunctionParameter %main_out + %178 = OpLabel + %179 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %179 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %181 = OpLabel + %182 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %182 + %183 = OpFunctionCall %void %main_1 + %185 = OpLoad %v4float %x_GLF_color + %186 = OpCompositeConstruct %main_out %185 + %184 = OpFunctionCall %void %tint_symbol_3 %186 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..8f0982f88f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/1.wgsl.expected.wgsl @@ -0,0 +1,103 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_81 : array, 8> = array, 8>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + var x_82 : array, 8>; + var x_83 : array, 8>; + var x_84 : array, 8>; + var x_85 : array, 16>; + var x_95 : vec4; + var x_95_phi : vec4; + var x_98_phi : i32; + x_81 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_86 : array, 8> = x_81; + let x_87 : vec4 = gl_FragCoord; + let x_90 : vec2 = x_6.resolution; + let x_93 : vec2 = floor(((vec2(x_87.x, x_87.y) / x_90) * 32.0)); + x_95_phi = vec4(0.5, 0.5, 1.0, 1.0); + x_98_phi = 0; + loop { + var x_143 : vec4; + var x_99 : i32; + var x_127_phi : bool; + var x_96_phi : vec4; + x_95 = x_95_phi; + let x_98 : i32 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + var x_104 : vec4; + x_82 = x_86; + x_104 = x_82[x_98]; + switch(0u) { + default: { + let x_107 : f32 = x_93.x; + let x_108 : f32 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + let x_112 : f32 = x_93.y; + let x_113 : f32 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + } + } + let x_127 : bool = x_127_phi; + x_96_phi = x_95; + if (x_127) { + x_83 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_131 : f32 = x_83[x_98].x; + x_84 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_134 : f32 = x_84[x_98].y; + let x_135 : array, 8> = x_81; + x_81 = array, 8>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + x_81 = x_135; + x_85 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + x_143 = x_85[((((i32(x_131) * i32(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_143; + } + let x_96 : vec4 = x_96_phi; + + continuing { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + x_GLF_color = x_95; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm new file mode 100644 index 0000000000..7ef0dcdba8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm @@ -0,0 +1,190 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %true = OpConstantTrue %bool + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_8 = OpConstant %int 8 + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %30 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %31 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %32 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %34 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %37 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %39 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %41 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %43 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %44 = OpConstantComposite %_arr_v4float_uint_8 %30 %31 %32 %34 %37 %39 %41 %43 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %49 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %50 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %51 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %52 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %53 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %54 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %55 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %56 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %57 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %58 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %59 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %60 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %61 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %62 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %63 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %64 = OpConstantComposite %_arr_v4float_uint_16 %49 %50 %51 %52 %53 %54 %55 %56 %49 %57 %58 %59 %60 %61 %62 %63 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %75 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %76 = OpConstantComposite %_arr_v4float_uint_8 %75 %75 %75 %75 %75 %75 %75 %75 + %float_0_0 = OpConstant %float 0 + %78 = OpConstantComposite %v4float %float_0_0 %float_0_0 %float_0_0 %float_0_0 + %79 = OpConstantComposite %_arr_v4float_uint_8 %78 %78 %78 %78 %78 %78 %78 %78 + %main = OpFunction %void None %8 + %80 = OpLabel + %81 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %76 + %82 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function + %83 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function + %84 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function + %85 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + OpStore %81 %44 + %86 = OpLoad %_arr_v4float_uint_8 %81 + %87 = OpLoad %v4float %gl_FragCoord + %88 = OpVectorShuffle %v2float %87 %87 0 1 + %89 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %90 = OpLoad %v2float %89 + %91 = OpFDiv %v2float %88 %90 + %92 = OpVectorTimesScalar %v2float %91 %float_32 + %93 = OpExtInst %v2float %1 Floor %92 + OpBranch %94 + %94 = OpLabel + %95 = OpPhi %v4float %22 %80 %96 %97 + %98 = OpPhi %int %int_0 %80 %99 %97 + %100 = OpSLessThan %bool %98 %int_8 + OpLoopMerge %101 %97 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpStore %82 %86 + %103 = OpAccessChain %_ptr_Function_v4float %82 %98 + %104 = OpLoad %v4float %103 + OpSelectionMerge %105 None + OpSwitch %uint_0 %106 + %106 = OpLabel + %107 = OpCompositeExtract %float %93 0 + %108 = OpCompositeExtract %float %104 0 + %109 = OpFOrdLessThan %bool %107 %108 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + OpBranch %105 + %110 = OpLabel + %112 = OpCompositeExtract %float %93 1 + %113 = OpCompositeExtract %float %104 1 + %114 = OpFOrdLessThan %bool %112 %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %115 + %116 = OpLabel + OpBranch %105 + %115 = OpLabel + %117 = OpCompositeExtract %float %104 2 + %118 = OpFAdd %float %108 %117 + %119 = OpFOrdGreaterThan %bool %107 %118 + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %120 + %121 = OpLabel + OpBranch %105 + %120 = OpLabel + %122 = OpCompositeExtract %float %104 3 + %123 = OpFAdd %float %113 %122 + %124 = OpFOrdGreaterThan %bool %112 %123 + OpSelectionMerge %125 None + OpBranchConditional %124 %126 %125 + %126 = OpLabel + OpBranch %105 + %125 = OpLabel + OpBranch %105 + %105 = OpLabel + %127 = OpPhi %bool %false %111 %false %116 %false %121 %false %126 %true %125 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %128 + %129 = OpLabel + OpStore %83 %44 + %130 = OpAccessChain %_ptr_Function_float %83 %98 %uint_0 + %131 = OpLoad %float %130 + %132 = OpConvertFToS %int %131 + OpStore %84 %44 + %133 = OpAccessChain %_ptr_Function_float %84 %98 %uint_1 + %134 = OpLoad %float %133 + %135 = OpConvertFToS %int %134 + %136 = OpIMul %int %132 %135 + %137 = OpIMul %int %98 %int_9 + %138 = OpIAdd %int %136 %137 + %139 = OpIAdd %int %138 %int_11 + %140 = OpSMod %int %139 %int_16 + OpStore %85 %64 + %141 = OpAccessChain %_ptr_Function_v4float %85 %140 + %142 = OpLoad %v4float %141 + OpBranch %128 + %128 = OpLabel + %96 = OpPhi %v4float %95 %105 %142 %129 + OpBranch %97 + %97 = OpLabel + %99 = OpIAdd %int %98 %int_1 + OpBranch %94 + %101 = OpLabel + OpStore %_GLF_color %95 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.hlsl new file mode 100644 index 0000000000..d50630e11b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.hlsl @@ -0,0 +1,106 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 x_81[8] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + float4 x_82[8] = (float4[8])0; + float4 x_83[8] = (float4[8])0; + float4 x_84[8] = (float4[8])0; + float4 x_85[16] = (float4[16])0; + float4 x_95 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_95_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_98_phi = 0; + const float4 tint_symbol_5[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_81 = tint_symbol_5; + const float4 x_86[8] = x_81; + const float4 x_87 = gl_FragCoord; + const float2 x_90 = asfloat(x_6[0].xy); + const float2 x_93 = floor(((float2(x_87.x, x_87.y) / x_90) * 32.0f)); + x_95_phi = float4(0.5f, 0.5f, 1.0f, 1.0f); + x_98_phi = 0; + while (true) { + float4 x_142 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_99 = 0; + bool x_127_phi = false; + float4 x_96_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_95 = x_95_phi; + const int x_98 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + float4 x_104 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_82 = x_86; + x_104 = x_82[x_98]; + switch(0u) { + default: { + const float x_107 = x_93.x; + const float x_108 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + const float x_112 = x_93.y; + const float x_113 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + break; + } + } + const bool x_127 = x_127_phi; + x_96_phi = x_95; + if (x_127) { + const float4 tint_symbol_6[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_83 = tint_symbol_6; + const float x_131 = x_83[x_98].x; + const float4 tint_symbol_7[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_84 = tint_symbol_7; + const float x_134 = x_84[x_98].y; + const float4 tint_symbol_8[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + x_85 = tint_symbol_8; + x_142 = x_85[((((int(x_131) * int(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_142; + } + const float4 x_96 = x_96_phi; + { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + x_GLF_color = x_95; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.msl new file mode 100644 index 0000000000..f5eb2e7cb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.msl @@ -0,0 +1,111 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[8]; +}; +struct tint_array_wrapper_1 { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + tint_array_wrapper x_81 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + tint_array_wrapper x_82 = {}; + tint_array_wrapper x_83 = {}; + tint_array_wrapper x_84 = {}; + tint_array_wrapper_1 x_85 = {}; + float4 x_95 = 0.0f; + float4 x_95_phi = 0.0f; + int x_98_phi = 0; + tint_array_wrapper const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_81 = tint_symbol_4; + tint_array_wrapper const x_86 = x_81; + float4 const x_87 = *(tint_symbol_9); + float2 const x_90 = x_6.resolution; + float2 const x_93 = floor(((float2(x_87.x, x_87.y) / x_90) * 32.0f)); + x_95_phi = float4(0.5f, 0.5f, 1.0f, 1.0f); + x_98_phi = 0; + while (true) { + float4 x_142 = 0.0f; + int x_99 = 0; + bool x_127_phi = false; + float4 x_96_phi = 0.0f; + x_95 = x_95_phi; + int const x_98 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + float4 x_104 = 0.0f; + x_82 = x_86; + x_104 = x_82.arr[x_98]; + switch(0u) { + default: { + float const x_107 = x_93.x; + float const x_108 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + float const x_112 = x_93.y; + float const x_113 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + break; + } + } + bool const x_127 = x_127_phi; + x_96_phi = x_95; + if (x_127) { + tint_array_wrapper const tint_symbol_5 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_83 = tint_symbol_5; + float const x_131 = x_83.arr[x_98].x; + tint_array_wrapper const tint_symbol_6 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_84 = tint_symbol_6; + float const x_134 = x_84.arr[x_98].y; + tint_array_wrapper_1 const tint_symbol_7 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + x_85 = tint_symbol_7; + x_142 = x_85.arr[((((int(x_131) * int(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_142; + } + float4 const x_96 = x_96_phi; + { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + *(tint_symbol_10) = x_95; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.spvasm new file mode 100644 index 0000000000..4ef05006a8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.spvasm @@ -0,0 +1,287 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 186 +; Schema: 0 + OpCapability Shader + %67 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_81 "x_81" + OpName %x_82 "x_82" + OpName %x_83 "x_83" + OpName %x_84 "x_84" + OpName %x_85 "x_85" + OpName %x_95 "x_95" + OpName %x_95_phi "x_95_phi" + OpName %x_98_phi "x_98_phi" + OpName %x_142 "x_142" + OpName %x_99 "x_99" + OpName %x_127_phi "x_127_phi" + OpName %x_96_phi "x_96_phi" + OpName %x_104 "x_104" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_8 ArrayStride 16 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %24 = OpConstantComposite %_arr_v4float_uint_8 %23 %23 %23 %23 %23 %23 %23 %23 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %27 = OpConstantNull %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %35 = OpConstantNull %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %42 = OpConstantNull %int + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %45 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %46 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %47 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %49 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %52 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %54 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %56 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %58 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %59 = OpConstantComposite %_arr_v4float_uint_8 %45 %46 %47 %49 %52 %54 %56 %58 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %76 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %87 = OpConstantNull %bool + %int_8 = OpConstant %int 8 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %139 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %140 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %141 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %142 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %143 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %144 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %145 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %146 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %147 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %148 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %149 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %150 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %151 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %152 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %153 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %154 = OpConstantComposite %_arr_v4float_uint_16 %139 %140 %141 %142 %143 %144 %145 %146 %139 %147 %148 %149 %150 %151 %152 %153 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %173 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_81 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_82 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_83 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_84 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_85 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %35 + %x_95 = OpVariable %_ptr_Function_v4float Function %5 + %x_95_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_98_phi = OpVariable %_ptr_Function_int Function %42 + %x_142 = OpVariable %_ptr_Function_v4float Function %5 + %x_99 = OpVariable %_ptr_Function_int Function %42 + %x_127_phi = OpVariable %_ptr_Function_bool Function %87 + %x_96_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_104 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %x_81 %24 + OpStore %x_81 %59 + %60 = OpLoad %_arr_v4float_uint_8 %x_81 + %61 = OpLoad %v4float %gl_FragCoord + %64 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %65 = OpLoad %v2float %64 + %68 = OpCompositeExtract %float %61 0 + %69 = OpCompositeExtract %float %61 1 + %70 = OpCompositeConstruct %v2float %68 %69 + %71 = OpFDiv %v2float %70 %65 + %73 = OpVectorTimesScalar %v2float %71 %float_32 + %66 = OpExtInst %v2float %67 Floor %73 + OpStore %x_95_phi %76 + OpStore %x_98_phi %int_0 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %89 = OpLoad %v4float %x_95_phi + OpStore %x_95 %89 + %90 = OpLoad %int %x_98_phi + %92 = OpSLessThan %bool %90 %int_8 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + OpBranch %93 + %95 = OpLabel + OpBranch %79 + %93 = OpLabel + OpStore %x_82 %60 + %97 = OpAccessChain %_ptr_Function_v4float %x_82 %90 + %98 = OpLoad %v4float %97 + OpStore %x_104 %98 + OpSelectionMerge %99 None + OpSwitch %uint_0 %100 + %100 = OpLabel + %101 = OpCompositeExtract %float %66 0 + %103 = OpAccessChain %_ptr_Function_float %x_104 %uint_0 + %104 = OpLoad %float %103 + %105 = OpFOrdLessThan %bool %101 %104 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %106 = OpLabel + %109 = OpCompositeExtract %float %66 1 + %111 = OpAccessChain %_ptr_Function_float %x_104 %uint_1 + %112 = OpLoad %float %111 + %113 = OpFOrdLessThan %bool %109 %112 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %114 + %115 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %114 = OpLabel + %117 = OpAccessChain %_ptr_Function_float %x_104 %uint_2 + %118 = OpLoad %float %117 + %119 = OpFAdd %float %104 %118 + %120 = OpFOrdGreaterThan %bool %101 %119 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %121 + %122 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %121 = OpLabel + %124 = OpAccessChain %_ptr_Function_float %x_104 %uint_3 + %125 = OpLoad %float %124 + %126 = OpFAdd %float %112 %125 + %127 = OpFOrdGreaterThan %bool %109 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %128 + %129 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %128 = OpLabel + OpStore %x_127_phi %true + OpBranch %99 + %99 = OpLabel + %131 = OpLoad %bool %x_127_phi + %132 = OpLoad %v4float %x_95 + OpStore %x_96_phi %132 + OpSelectionMerge %133 None + OpBranchConditional %131 %134 %133 + %134 = OpLabel + OpStore %x_83 %59 + %135 = OpAccessChain %_ptr_Function_float %x_83 %90 %uint_0 + %136 = OpLoad %float %135 + OpStore %x_84 %59 + %137 = OpAccessChain %_ptr_Function_float %x_84 %90 %uint_1 + %138 = OpLoad %float %137 + OpStore %x_85 %154 + %155 = OpConvertFToS %int %136 + %156 = OpConvertFToS %int %138 + %157 = OpIMul %int %155 %156 + %159 = OpIMul %int %90 %int_9 + %160 = OpIAdd %int %157 %159 + %162 = OpIAdd %int %160 %int_11 + %164 = OpSMod %int %162 %int_16 + %165 = OpAccessChain %_ptr_Function_v4float %x_85 %164 + %166 = OpLoad %v4float %165 + OpStore %x_142 %166 + %167 = OpLoad %v4float %x_142 + OpStore %x_96_phi %167 + OpBranch %133 + %133 = OpLabel + %168 = OpLoad %v4float %x_96_phi + OpBranch %80 + %80 = OpLabel + %170 = OpIAdd %int %90 %int_1 + OpStore %x_99 %170 + OpStore %x_95_phi %168 + %171 = OpLoad %int %x_99 + OpStore %x_98_phi %171 + OpBranch %78 + %79 = OpLabel + %172 = OpLoad %v4float %x_95 + OpStore %x_GLF_color %172 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %173 +%tint_symbol_1 = OpFunctionParameter %main_out + %177 = OpLabel + %178 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %178 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %180 = OpLabel + %181 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %181 + %182 = OpFunctionCall %void %main_1 + %184 = OpLoad %v4float %x_GLF_color + %185 = OpCompositeConstruct %main_out %184 + %183 = OpFunctionCall %void %tint_symbol_3 %185 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.wgsl new file mode 100644 index 0000000000..1bf1c72613 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.spvasm.expected.wgsl @@ -0,0 +1,100 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_81 : array, 8> = array, 8>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + var x_82 : array, 8>; + var x_83 : array, 8>; + var x_84 : array, 8>; + var x_85 : array, 16>; + var x_95 : vec4; + var x_95_phi : vec4; + var x_98_phi : i32; + x_81 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_86 : array, 8> = x_81; + let x_87 : vec4 = gl_FragCoord; + let x_90 : vec2 = x_6.resolution; + let x_93 : vec2 = floor(((vec2(x_87.x, x_87.y) / x_90) * 32.0)); + x_95_phi = vec4(0.5, 0.5, 1.0, 1.0); + x_98_phi = 0; + loop { + var x_142 : vec4; + var x_99 : i32; + var x_127_phi : bool; + var x_96_phi : vec4; + x_95 = x_95_phi; + let x_98 : i32 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + var x_104 : vec4; + x_82 = x_86; + x_104 = x_82[x_98]; + switch(0u) { + default: { + let x_107 : f32 = x_93.x; + let x_108 : f32 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + let x_112 : f32 = x_93.y; + let x_113 : f32 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + } + } + let x_127 : bool = x_127_phi; + x_96_phi = x_95; + if (x_127) { + x_83 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_131 : f32 = x_83[x_98].x; + x_84 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_134 : f32 = x_84[x_98].y; + x_85 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + x_142 = x_85[((((i32(x_131) * i32(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_142; + } + let x_96 : vec4 = x_96_phi; + + continuing { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + x_GLF_color = x_95; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl new file mode 100644 index 0000000000..1bf1c72613 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl @@ -0,0 +1,100 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_81 : array, 8> = array, 8>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + var x_82 : array, 8>; + var x_83 : array, 8>; + var x_84 : array, 8>; + var x_85 : array, 16>; + var x_95 : vec4; + var x_95_phi : vec4; + var x_98_phi : i32; + x_81 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_86 : array, 8> = x_81; + let x_87 : vec4 = gl_FragCoord; + let x_90 : vec2 = x_6.resolution; + let x_93 : vec2 = floor(((vec2(x_87.x, x_87.y) / x_90) * 32.0)); + x_95_phi = vec4(0.5, 0.5, 1.0, 1.0); + x_98_phi = 0; + loop { + var x_142 : vec4; + var x_99 : i32; + var x_127_phi : bool; + var x_96_phi : vec4; + x_95 = x_95_phi; + let x_98 : i32 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + var x_104 : vec4; + x_82 = x_86; + x_104 = x_82[x_98]; + switch(0u) { + default: { + let x_107 : f32 = x_93.x; + let x_108 : f32 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + let x_112 : f32 = x_93.y; + let x_113 : f32 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + } + } + let x_127 : bool = x_127_phi; + x_96_phi = x_95; + if (x_127) { + x_83 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_131 : f32 = x_83[x_98].x; + x_84 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_134 : f32 = x_84[x_98].y; + x_85 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + x_142 = x_85[((((i32(x_131) * i32(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_142; + } + let x_96 : vec4 = x_96_phi; + + continuing { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + x_GLF_color = x_95; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.hlsl new file mode 100644 index 0000000000..d50630e11b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.hlsl @@ -0,0 +1,106 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 x_81[8] = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}; + float4 x_82[8] = (float4[8])0; + float4 x_83[8] = (float4[8])0; + float4 x_84[8] = (float4[8])0; + float4 x_85[16] = (float4[16])0; + float4 x_95 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_95_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_98_phi = 0; + const float4 tint_symbol_5[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_81 = tint_symbol_5; + const float4 x_86[8] = x_81; + const float4 x_87 = gl_FragCoord; + const float2 x_90 = asfloat(x_6[0].xy); + const float2 x_93 = floor(((float2(x_87.x, x_87.y) / x_90) * 32.0f)); + x_95_phi = float4(0.5f, 0.5f, 1.0f, 1.0f); + x_98_phi = 0; + while (true) { + float4 x_142 = float4(0.0f, 0.0f, 0.0f, 0.0f); + int x_99 = 0; + bool x_127_phi = false; + float4 x_96_phi = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_95 = x_95_phi; + const int x_98 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + float4 x_104 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x_82 = x_86; + x_104 = x_82[x_98]; + switch(0u) { + default: { + const float x_107 = x_93.x; + const float x_108 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + const float x_112 = x_93.y; + const float x_113 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + break; + } + } + const bool x_127 = x_127_phi; + x_96_phi = x_95; + if (x_127) { + const float4 tint_symbol_6[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_83 = tint_symbol_6; + const float x_131 = x_83[x_98].x; + const float4 tint_symbol_7[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + x_84 = tint_symbol_7; + const float x_134 = x_84[x_98].y; + const float4 tint_symbol_8[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + x_85 = tint_symbol_8; + x_142 = x_85[((((int(x_131) * int(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_142; + } + const float4 x_96 = x_96_phi; + { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + x_GLF_color = x_95; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.msl new file mode 100644 index 0000000000..f5eb2e7cb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.msl @@ -0,0 +1,111 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[8]; +}; +struct tint_array_wrapper_1 { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + tint_array_wrapper x_81 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}}; + tint_array_wrapper x_82 = {}; + tint_array_wrapper x_83 = {}; + tint_array_wrapper x_84 = {}; + tint_array_wrapper_1 x_85 = {}; + float4 x_95 = 0.0f; + float4 x_95_phi = 0.0f; + int x_98_phi = 0; + tint_array_wrapper const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_81 = tint_symbol_4; + tint_array_wrapper const x_86 = x_81; + float4 const x_87 = *(tint_symbol_9); + float2 const x_90 = x_6.resolution; + float2 const x_93 = floor(((float2(x_87.x, x_87.y) / x_90) * 32.0f)); + x_95_phi = float4(0.5f, 0.5f, 1.0f, 1.0f); + x_98_phi = 0; + while (true) { + float4 x_142 = 0.0f; + int x_99 = 0; + bool x_127_phi = false; + float4 x_96_phi = 0.0f; + x_95 = x_95_phi; + int const x_98 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + float4 x_104 = 0.0f; + x_82 = x_86; + x_104 = x_82.arr[x_98]; + switch(0u) { + default: { + float const x_107 = x_93.x; + float const x_108 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + float const x_112 = x_93.y; + float const x_113 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + break; + } + } + bool const x_127 = x_127_phi; + x_96_phi = x_95; + if (x_127) { + tint_array_wrapper const tint_symbol_5 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_83 = tint_symbol_5; + float const x_131 = x_83.arr[x_98].x; + tint_array_wrapper const tint_symbol_6 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + x_84 = tint_symbol_6; + float const x_134 = x_84.arr[x_98].y; + tint_array_wrapper_1 const tint_symbol_7 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + x_85 = tint_symbol_7; + x_142 = x_85.arr[((((int(x_131) * int(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_142; + } + float4 const x_96 = x_96_phi; + { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + *(tint_symbol_10) = x_95; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_11 = gl_FragCoord_param; + main_1(x_6, &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.spvasm new file mode 100644 index 0000000000..4ef05006a8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.spvasm @@ -0,0 +1,287 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 186 +; Schema: 0 + OpCapability Shader + %67 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_81 "x_81" + OpName %x_82 "x_82" + OpName %x_83 "x_83" + OpName %x_84 "x_84" + OpName %x_85 "x_85" + OpName %x_95 "x_95" + OpName %x_95_phi "x_95_phi" + OpName %x_98_phi "x_98_phi" + OpName %x_142 "x_142" + OpName %x_99 "x_99" + OpName %x_127_phi "x_127_phi" + OpName %x_96_phi "x_96_phi" + OpName %x_104 "x_104" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_8 ArrayStride 16 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %24 = OpConstantComposite %_arr_v4float_uint_8 %23 %23 %23 %23 %23 %23 %23 %23 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %27 = OpConstantNull %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %35 = OpConstantNull %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %42 = OpConstantNull %int + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %45 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %46 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %47 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %49 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %52 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %54 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %56 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %58 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %59 = OpConstantComposite %_arr_v4float_uint_8 %45 %46 %47 %49 %52 %54 %56 %58 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %76 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %87 = OpConstantNull %bool + %int_8 = OpConstant %int 8 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %139 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %140 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %141 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %142 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %143 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %144 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %145 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %146 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %147 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %148 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %149 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %150 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %151 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %152 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %153 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %154 = OpConstantComposite %_arr_v4float_uint_16 %139 %140 %141 %142 %143 %144 %145 %146 %139 %147 %148 %149 %150 %151 %152 %153 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %173 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %x_81 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_82 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_83 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_84 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %27 + %x_85 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %35 + %x_95 = OpVariable %_ptr_Function_v4float Function %5 + %x_95_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_98_phi = OpVariable %_ptr_Function_int Function %42 + %x_142 = OpVariable %_ptr_Function_v4float Function %5 + %x_99 = OpVariable %_ptr_Function_int Function %42 + %x_127_phi = OpVariable %_ptr_Function_bool Function %87 + %x_96_phi = OpVariable %_ptr_Function_v4float Function %5 + %x_104 = OpVariable %_ptr_Function_v4float Function %5 + OpStore %x_81 %24 + OpStore %x_81 %59 + %60 = OpLoad %_arr_v4float_uint_8 %x_81 + %61 = OpLoad %v4float %gl_FragCoord + %64 = OpAccessChain %_ptr_Uniform_v2float %x_6 %uint_0 + %65 = OpLoad %v2float %64 + %68 = OpCompositeExtract %float %61 0 + %69 = OpCompositeExtract %float %61 1 + %70 = OpCompositeConstruct %v2float %68 %69 + %71 = OpFDiv %v2float %70 %65 + %73 = OpVectorTimesScalar %v2float %71 %float_32 + %66 = OpExtInst %v2float %67 Floor %73 + OpStore %x_95_phi %76 + OpStore %x_98_phi %int_0 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %89 = OpLoad %v4float %x_95_phi + OpStore %x_95 %89 + %90 = OpLoad %int %x_98_phi + %92 = OpSLessThan %bool %90 %int_8 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + OpBranch %93 + %95 = OpLabel + OpBranch %79 + %93 = OpLabel + OpStore %x_82 %60 + %97 = OpAccessChain %_ptr_Function_v4float %x_82 %90 + %98 = OpLoad %v4float %97 + OpStore %x_104 %98 + OpSelectionMerge %99 None + OpSwitch %uint_0 %100 + %100 = OpLabel + %101 = OpCompositeExtract %float %66 0 + %103 = OpAccessChain %_ptr_Function_float %x_104 %uint_0 + %104 = OpLoad %float %103 + %105 = OpFOrdLessThan %bool %101 %104 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %106 = OpLabel + %109 = OpCompositeExtract %float %66 1 + %111 = OpAccessChain %_ptr_Function_float %x_104 %uint_1 + %112 = OpLoad %float %111 + %113 = OpFOrdLessThan %bool %109 %112 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %114 + %115 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %114 = OpLabel + %117 = OpAccessChain %_ptr_Function_float %x_104 %uint_2 + %118 = OpLoad %float %117 + %119 = OpFAdd %float %104 %118 + %120 = OpFOrdGreaterThan %bool %101 %119 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %121 + %122 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %121 = OpLabel + %124 = OpAccessChain %_ptr_Function_float %x_104 %uint_3 + %125 = OpLoad %float %124 + %126 = OpFAdd %float %112 %125 + %127 = OpFOrdGreaterThan %bool %109 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %128 + %129 = OpLabel + OpStore %x_127_phi %false + OpBranch %99 + %128 = OpLabel + OpStore %x_127_phi %true + OpBranch %99 + %99 = OpLabel + %131 = OpLoad %bool %x_127_phi + %132 = OpLoad %v4float %x_95 + OpStore %x_96_phi %132 + OpSelectionMerge %133 None + OpBranchConditional %131 %134 %133 + %134 = OpLabel + OpStore %x_83 %59 + %135 = OpAccessChain %_ptr_Function_float %x_83 %90 %uint_0 + %136 = OpLoad %float %135 + OpStore %x_84 %59 + %137 = OpAccessChain %_ptr_Function_float %x_84 %90 %uint_1 + %138 = OpLoad %float %137 + OpStore %x_85 %154 + %155 = OpConvertFToS %int %136 + %156 = OpConvertFToS %int %138 + %157 = OpIMul %int %155 %156 + %159 = OpIMul %int %90 %int_9 + %160 = OpIAdd %int %157 %159 + %162 = OpIAdd %int %160 %int_11 + %164 = OpSMod %int %162 %int_16 + %165 = OpAccessChain %_ptr_Function_v4float %x_85 %164 + %166 = OpLoad %v4float %165 + OpStore %x_142 %166 + %167 = OpLoad %v4float %x_142 + OpStore %x_96_phi %167 + OpBranch %133 + %133 = OpLabel + %168 = OpLoad %v4float %x_96_phi + OpBranch %80 + %80 = OpLabel + %170 = OpIAdd %int %90 %int_1 + OpStore %x_99 %170 + OpStore %x_95_phi %168 + %171 = OpLoad %int %x_99 + OpStore %x_98_phi %171 + OpBranch %78 + %79 = OpLabel + %172 = OpLoad %v4float %x_95 + OpStore %x_GLF_color %172 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %173 +%tint_symbol_1 = OpFunctionParameter %main_out + %177 = OpLabel + %178 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %178 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %180 = OpLabel + %181 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %181 + %182 = OpFunctionCall %void %main_1 + %184 = OpLoad %v4float %x_GLF_color + %185 = OpCompositeConstruct %main_out %184 + %183 = OpFunctionCall %void %tint_symbol_3 %185 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.wgsl new file mode 100644 index 0000000000..1bf1c72613 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-rects-Os-mutate-var-push-through-var/2.wgsl.expected.wgsl @@ -0,0 +1,100 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_81 : array, 8> = array, 8>(vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0)); + var x_82 : array, 8>; + var x_83 : array, 8>; + var x_84 : array, 8>; + var x_85 : array, 16>; + var x_95 : vec4; + var x_95_phi : vec4; + var x_98_phi : i32; + x_81 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_86 : array, 8> = x_81; + let x_87 : vec4 = gl_FragCoord; + let x_90 : vec2 = x_6.resolution; + let x_93 : vec2 = floor(((vec2(x_87.x, x_87.y) / x_90) * 32.0)); + x_95_phi = vec4(0.5, 0.5, 1.0, 1.0); + x_98_phi = 0; + loop { + var x_142 : vec4; + var x_99 : i32; + var x_127_phi : bool; + var x_96_phi : vec4; + x_95 = x_95_phi; + let x_98 : i32 = x_98_phi; + if ((x_98 < 8)) { + } else { + break; + } + var x_104 : vec4; + x_82 = x_86; + x_104 = x_82[x_98]; + switch(0u) { + default: { + let x_107 : f32 = x_93.x; + let x_108 : f32 = x_104.x; + if ((x_107 < x_108)) { + x_127_phi = false; + break; + } + let x_112 : f32 = x_93.y; + let x_113 : f32 = x_104.y; + if ((x_112 < x_113)) { + x_127_phi = false; + break; + } + if ((x_107 > (x_108 + x_104.z))) { + x_127_phi = false; + break; + } + if ((x_112 > (x_113 + x_104.w))) { + x_127_phi = false; + break; + } + x_127_phi = true; + } + } + let x_127 : bool = x_127_phi; + x_96_phi = x_95; + if (x_127) { + x_83 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_131 : f32 = x_83[x_98].x; + x_84 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_134 : f32 = x_84[x_98].y; + x_85 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + x_142 = x_85[((((i32(x_131) * i32(x_134)) + (x_98 * 9)) + 11) % 16)]; + x_96_phi = x_142; + } + let x_96 : vec4 = x_96_phi; + + continuing { + x_99 = (x_98 + 1); + x_95_phi = x_96; + x_98_phi = x_99; + } + } + x_GLF_color = x_95; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm new file mode 100644 index 0000000000..81c39bdff4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm @@ -0,0 +1,684 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree "tree" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %34 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %uint_0 = OpConstant %uint 0 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool +%_ptr_Function__arr_BST_uint_10 = OpTypePointer Function %_arr_BST_uint_10 + %40 = OpUndef %int + %41 = OpConstantComposite %BST %int_9 %int_n1 %int_n1 + %42 = OpConstantComposite %BST %int_5 %int_n1 %int_n1 + %43 = OpConstantComposite %BST %int_12 %int_n1 %int_n1 + %int_3 = OpConstant %int 3 + %45 = OpConstantComposite %BST %int_15 %int_n1 %int_n1 + %int_4 = OpConstant %int 4 + %47 = OpConstantComposite %BST %int_7 %int_n1 %int_n1 + %48 = OpConstantComposite %BST %int_8 %int_n1 %int_n1 + %49 = OpConstantComposite %BST %int_2 %int_n1 %int_n1 + %50 = OpConstantComposite %BST %int_6 %int_n1 %int_n1 + %51 = OpConstantComposite %BST %int_17 %int_n1 %int_n1 + %52 = OpConstantComposite %BST %int_13 %int_n1 %int_n1 + %main = OpFunction %void None %7 + %53 = OpLabel + %tree = OpVariable %_ptr_Function__arr_BST_uint_10 Function + %54 = OpAccessChain %_ptr_Function_BST %tree %int_0 + OpStore %54 %41 + OpSelectionMerge %55 None + OpSwitch %uint_0 %56 + %56 = OpLabel + OpBranch %57 + %57 = OpLabel + %58 = OpPhi %int %int_0 %56 %59 %60 + %61 = OpSLessThanEqual %bool %58 %int_1 + OpLoopMerge %62 %60 None + OpBranchConditional %61 %63 %62 + %63 = OpLabel + %64 = OpAccessChain %_ptr_Function_int %tree %58 %int_0 + %65 = OpLoad %int %64 + %66 = OpSLessThanEqual %bool %int_5 %65 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %69 + %69 = OpLabel + %70 = OpAccessChain %_ptr_Function_int %tree %58 %int_2 + %71 = OpLoad %int %70 + %72 = OpIEqual %bool %71 %int_n1 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %75 = OpLabel + %76 = OpLoad %int %70 + OpBranch %60 + %74 = OpLabel + OpStore %70 %int_1 + %77 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %77 %42 + OpBranch %62 + %73 = OpLabel + OpUnreachable + %68 = OpLabel + %78 = OpAccessChain %_ptr_Function_int %tree %58 %int_1 + %79 = OpLoad %int %78 + %80 = OpIEqual %bool %79 %int_n1 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %83 = OpLabel + %84 = OpLoad %int %78 + OpBranch %60 + %82 = OpLabel + OpStore %78 %int_1 + %85 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %85 %42 + OpBranch %62 + %81 = OpLabel + OpUnreachable + %67 = OpLabel + OpUnreachable + %60 = OpLabel + %59 = OpPhi %int %84 %83 %76 %75 + OpBranch %57 + %62 = OpLabel + %86 = OpPhi %bool %false %57 %true %82 %true %74 + OpSelectionMerge %87 None + OpBranchConditional %86 %55 %87 + %87 = OpLabel + OpBranch %55 + %55 = OpLabel + OpSelectionMerge %88 None + OpSwitch %uint_0 %89 + %89 = OpLabel + OpBranch %90 + %90 = OpLabel + %91 = OpPhi %int %int_0 %89 %92 %93 + %94 = OpSLessThanEqual %bool %91 %int_2 + OpLoopMerge %95 %93 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + %97 = OpAccessChain %_ptr_Function_int %tree %91 %int_0 + %98 = OpLoad %int %97 + %99 = OpSLessThanEqual %bool %int_12 %98 + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %102 + %102 = OpLabel + %103 = OpAccessChain %_ptr_Function_int %tree %91 %int_2 + %104 = OpLoad %int %103 + %105 = OpIEqual %bool %104 %int_n1 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %108 + %108 = OpLabel + %109 = OpLoad %int %103 + OpBranch %93 + %107 = OpLabel + OpStore %103 %int_2 + %110 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %110 %43 + OpBranch %95 + %106 = OpLabel + OpUnreachable + %101 = OpLabel + %111 = OpAccessChain %_ptr_Function_int %tree %91 %int_1 + %112 = OpLoad %int %111 + %113 = OpIEqual %bool %112 %int_n1 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %116 + %116 = OpLabel + %117 = OpLoad %int %111 + OpBranch %93 + %115 = OpLabel + OpStore %111 %int_2 + %118 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %118 %43 + OpBranch %95 + %114 = OpLabel + OpUnreachable + %100 = OpLabel + OpUnreachable + %93 = OpLabel + %92 = OpPhi %int %117 %116 %109 %108 + OpBranch %90 + %95 = OpLabel + %119 = OpPhi %bool %false %90 %true %115 %true %107 + OpSelectionMerge %120 None + OpBranchConditional %119 %88 %120 + %120 = OpLabel + OpBranch %88 + %88 = OpLabel + OpSelectionMerge %121 None + OpSwitch %uint_0 %122 + %122 = OpLabel + OpBranch %123 + %123 = OpLabel + %124 = OpPhi %int %int_0 %122 %125 %126 + %127 = OpSLessThanEqual %bool %124 %int_3 + OpLoopMerge %128 %126 None + OpBranchConditional %127 %129 %128 + %129 = OpLabel + %130 = OpAccessChain %_ptr_Function_int %tree %124 %int_0 + %131 = OpLoad %int %130 + %132 = OpSLessThanEqual %bool %int_15 %131 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %135 + %135 = OpLabel + %136 = OpAccessChain %_ptr_Function_int %tree %124 %int_2 + %137 = OpLoad %int %136 + %138 = OpIEqual %bool %137 %int_n1 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %141 + %141 = OpLabel + %142 = OpLoad %int %136 + OpBranch %126 + %140 = OpLabel + OpStore %136 %int_3 + %143 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %143 %45 + OpBranch %128 + %139 = OpLabel + OpUnreachable + %134 = OpLabel + %144 = OpAccessChain %_ptr_Function_int %tree %124 %int_1 + %145 = OpLoad %int %144 + %146 = OpIEqual %bool %145 %int_n1 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %149 + %149 = OpLabel + %150 = OpLoad %int %144 + OpBranch %126 + %148 = OpLabel + OpStore %144 %int_3 + %151 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %151 %45 + OpBranch %128 + %147 = OpLabel + OpUnreachable + %133 = OpLabel + OpUnreachable + %126 = OpLabel + %125 = OpPhi %int %150 %149 %142 %141 + OpBranch %123 + %128 = OpLabel + %152 = OpPhi %bool %false %123 %true %148 %true %140 + OpSelectionMerge %153 None + OpBranchConditional %152 %121 %153 + %153 = OpLabel + OpBranch %121 + %121 = OpLabel + OpSelectionMerge %154 None + OpSwitch %uint_0 %155 + %155 = OpLabel + OpBranch %156 + %156 = OpLabel + %157 = OpPhi %int %int_0 %155 %158 %159 + %160 = OpSLessThanEqual %bool %157 %int_4 + OpLoopMerge %161 %159 None + OpBranchConditional %160 %162 %161 + %162 = OpLabel + %163 = OpAccessChain %_ptr_Function_int %tree %157 %int_0 + %164 = OpLoad %int %163 + %165 = OpSLessThanEqual %bool %int_7 %164 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %168 + %168 = OpLabel + %169 = OpAccessChain %_ptr_Function_int %tree %157 %int_2 + %170 = OpLoad %int %169 + %171 = OpIEqual %bool %170 %int_n1 + OpSelectionMerge %172 None + OpBranchConditional %171 %173 %174 + %174 = OpLabel + %175 = OpLoad %int %169 + OpBranch %159 + %173 = OpLabel + OpStore %169 %int_4 + %176 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %176 %47 + OpBranch %161 + %172 = OpLabel + OpUnreachable + %167 = OpLabel + %177 = OpAccessChain %_ptr_Function_int %tree %157 %int_1 + %178 = OpLoad %int %177 + %179 = OpIEqual %bool %178 %int_n1 + OpSelectionMerge %180 None + OpBranchConditional %179 %181 %182 + %182 = OpLabel + %183 = OpLoad %int %177 + OpBranch %159 + %181 = OpLabel + OpStore %177 %int_4 + %184 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %184 %47 + OpBranch %161 + %180 = OpLabel + OpUnreachable + %166 = OpLabel + OpUnreachable + %159 = OpLabel + %158 = OpPhi %int %183 %182 %175 %174 + OpBranch %156 + %161 = OpLabel + %185 = OpPhi %bool %false %156 %true %181 %true %173 + OpSelectionMerge %186 None + OpBranchConditional %185 %154 %186 + %186 = OpLabel + OpBranch %154 + %154 = OpLabel + OpSelectionMerge %187 None + OpSwitch %uint_0 %188 + %188 = OpLabel + OpBranch %189 + %189 = OpLabel + %190 = OpPhi %int %int_0 %188 %191 %192 + %193 = OpSLessThanEqual %bool %190 %int_5 + OpLoopMerge %194 %192 None + OpBranchConditional %193 %195 %194 + %195 = OpLabel + %196 = OpAccessChain %_ptr_Function_int %tree %190 %int_0 + %197 = OpLoad %int %196 + %198 = OpSLessThanEqual %bool %int_8 %197 + OpSelectionMerge %199 None + OpBranchConditional %198 %200 %201 + %201 = OpLabel + %202 = OpAccessChain %_ptr_Function_int %tree %190 %int_2 + %203 = OpLoad %int %202 + %204 = OpIEqual %bool %203 %int_n1 + OpSelectionMerge %205 None + OpBranchConditional %204 %206 %207 + %207 = OpLabel + %208 = OpLoad %int %202 + OpBranch %192 + %206 = OpLabel + OpStore %202 %int_5 + %209 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %209 %48 + OpBranch %194 + %205 = OpLabel + OpUnreachable + %200 = OpLabel + %210 = OpAccessChain %_ptr_Function_int %tree %190 %int_1 + %211 = OpLoad %int %210 + %212 = OpIEqual %bool %211 %int_n1 + OpSelectionMerge %213 None + OpBranchConditional %212 %214 %215 + %215 = OpLabel + %216 = OpLoad %int %210 + OpBranch %192 + %214 = OpLabel + OpStore %210 %int_5 + %217 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %217 %48 + OpBranch %194 + %213 = OpLabel + OpUnreachable + %199 = OpLabel + OpUnreachable + %192 = OpLabel + %191 = OpPhi %int %216 %215 %208 %207 + OpBranch %189 + %194 = OpLabel + %218 = OpPhi %bool %false %189 %true %214 %true %206 + OpSelectionMerge %219 None + OpBranchConditional %218 %187 %219 + %219 = OpLabel + OpBranch %187 + %187 = OpLabel + OpSelectionMerge %220 None + OpSwitch %uint_0 %221 + %221 = OpLabel + OpBranch %222 + %222 = OpLabel + %223 = OpPhi %int %int_0 %221 %224 %225 + %226 = OpSLessThanEqual %bool %223 %int_6 + OpLoopMerge %227 %225 None + OpBranchConditional %226 %228 %227 + %228 = OpLabel + %229 = OpAccessChain %_ptr_Function_int %tree %223 %int_0 + %230 = OpLoad %int %229 + %231 = OpSLessThanEqual %bool %int_2 %230 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %234 + %234 = OpLabel + %235 = OpAccessChain %_ptr_Function_int %tree %223 %int_2 + %236 = OpLoad %int %235 + %237 = OpIEqual %bool %236 %int_n1 + OpSelectionMerge %238 None + OpBranchConditional %237 %239 %240 + %240 = OpLabel + %241 = OpLoad %int %235 + OpBranch %225 + %239 = OpLabel + OpStore %235 %int_6 + %242 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %242 %49 + OpBranch %227 + %238 = OpLabel + OpUnreachable + %233 = OpLabel + %243 = OpAccessChain %_ptr_Function_int %tree %223 %int_1 + %244 = OpLoad %int %243 + %245 = OpIEqual %bool %244 %int_n1 + OpSelectionMerge %246 None + OpBranchConditional %245 %247 %248 + %248 = OpLabel + %249 = OpLoad %int %243 + OpBranch %225 + %247 = OpLabel + OpStore %243 %int_6 + %250 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %250 %49 + OpBranch %227 + %246 = OpLabel + OpUnreachable + %232 = OpLabel + OpUnreachable + %225 = OpLabel + %224 = OpPhi %int %249 %248 %241 %240 + OpBranch %222 + %227 = OpLabel + %251 = OpPhi %bool %false %222 %true %247 %true %239 + OpSelectionMerge %252 None + OpBranchConditional %251 %220 %252 + %252 = OpLabel + OpBranch %220 + %220 = OpLabel + OpSelectionMerge %253 None + OpSwitch %uint_0 %254 + %254 = OpLabel + OpBranch %255 + %255 = OpLabel + %256 = OpPhi %int %int_0 %254 %257 %258 + %259 = OpSLessThanEqual %bool %256 %int_7 + OpLoopMerge %260 %258 None + OpBranchConditional %259 %261 %260 + %261 = OpLabel + %262 = OpAccessChain %_ptr_Function_int %tree %256 %int_0 + %263 = OpLoad %int %262 + %264 = OpSLessThanEqual %bool %int_6 %263 + OpSelectionMerge %265 None + OpBranchConditional %264 %266 %267 + %267 = OpLabel + %268 = OpAccessChain %_ptr_Function_int %tree %256 %int_2 + %269 = OpLoad %int %268 + %270 = OpIEqual %bool %269 %int_n1 + OpSelectionMerge %271 None + OpBranchConditional %270 %272 %273 + %273 = OpLabel + %274 = OpLoad %int %268 + OpBranch %258 + %272 = OpLabel + OpStore %268 %int_7 + %275 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %275 %50 + OpBranch %260 + %271 = OpLabel + OpUnreachable + %266 = OpLabel + %276 = OpAccessChain %_ptr_Function_int %tree %256 %int_1 + %277 = OpLoad %int %276 + %278 = OpIEqual %bool %277 %int_n1 + OpSelectionMerge %279 None + OpBranchConditional %278 %280 %281 + %281 = OpLabel + %282 = OpLoad %int %276 + OpBranch %258 + %280 = OpLabel + OpStore %276 %int_7 + %283 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %283 %50 + OpBranch %260 + %279 = OpLabel + OpUnreachable + %265 = OpLabel + OpUnreachable + %258 = OpLabel + %257 = OpPhi %int %282 %281 %274 %273 + OpBranch %255 + %260 = OpLabel + %284 = OpPhi %bool %false %255 %true %280 %true %272 + OpSelectionMerge %285 None + OpBranchConditional %284 %253 %285 + %285 = OpLabel + OpBranch %253 + %253 = OpLabel + OpSelectionMerge %286 None + OpSwitch %uint_0 %287 + %287 = OpLabel + OpBranch %288 + %288 = OpLabel + %289 = OpPhi %int %int_0 %287 %290 %291 + %292 = OpSLessThanEqual %bool %289 %int_8 + OpLoopMerge %293 %291 None + OpBranchConditional %292 %294 %293 + %294 = OpLabel + %295 = OpAccessChain %_ptr_Function_int %tree %289 %int_0 + %296 = OpLoad %int %295 + %297 = OpSLessThanEqual %bool %int_17 %296 + OpSelectionMerge %298 None + OpBranchConditional %297 %299 %300 + %300 = OpLabel + %301 = OpAccessChain %_ptr_Function_int %tree %289 %int_2 + %302 = OpLoad %int %301 + %303 = OpIEqual %bool %302 %int_n1 + OpSelectionMerge %304 None + OpBranchConditional %303 %305 %306 + %306 = OpLabel + %307 = OpLoad %int %301 + OpBranch %291 + %305 = OpLabel + OpStore %301 %int_8 + %308 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %308 %51 + OpBranch %293 + %304 = OpLabel + OpUnreachable + %299 = OpLabel + %309 = OpAccessChain %_ptr_Function_int %tree %289 %int_1 + %310 = OpLoad %int %309 + %311 = OpIEqual %bool %310 %int_n1 + OpSelectionMerge %312 None + OpBranchConditional %311 %313 %314 + %314 = OpLabel + %315 = OpLoad %int %309 + OpBranch %291 + %313 = OpLabel + OpStore %309 %int_8 + %316 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %316 %51 + OpBranch %293 + %312 = OpLabel + OpUnreachable + %298 = OpLabel + OpUnreachable + %291 = OpLabel + %290 = OpPhi %int %315 %314 %307 %306 + OpBranch %288 + %293 = OpLabel + %317 = OpPhi %bool %false %288 %true %313 %true %305 + OpSelectionMerge %318 None + OpBranchConditional %317 %286 %318 + %318 = OpLabel + OpBranch %286 + %286 = OpLabel + OpSelectionMerge %319 None + OpSwitch %uint_0 %320 + %320 = OpLabel + OpBranch %321 + %321 = OpLabel + %322 = OpPhi %int %int_0 %320 %323 %324 + %325 = OpSLessThanEqual %bool %322 %int_9 + OpLoopMerge %326 %324 None + OpBranchConditional %325 %327 %326 + %327 = OpLabel + %328 = OpAccessChain %_ptr_Function_int %tree %322 %int_0 + %329 = OpLoad %int %328 + %330 = OpSLessThanEqual %bool %int_13 %329 + OpSelectionMerge %331 None + OpBranchConditional %330 %332 %333 + %333 = OpLabel + %334 = OpAccessChain %_ptr_Function_int %tree %322 %int_2 + %335 = OpLoad %int %334 + %336 = OpIEqual %bool %335 %int_n1 + OpSelectionMerge %337 None + OpBranchConditional %336 %338 %339 + %339 = OpLabel + %340 = OpLoad %int %334 + OpBranch %324 + %338 = OpLabel + OpStore %334 %int_9 + %341 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %341 %52 + OpBranch %326 + %337 = OpLabel + OpUnreachable + %332 = OpLabel + %342 = OpAccessChain %_ptr_Function_int %tree %322 %int_1 + %343 = OpLoad %int %342 + %344 = OpIEqual %bool %343 %int_n1 + OpSelectionMerge %345 None + OpBranchConditional %344 %346 %347 + %347 = OpLabel + %348 = OpLoad %int %342 + OpBranch %324 + %346 = OpLabel + OpStore %342 %int_9 + %349 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %349 %52 + OpBranch %326 + %345 = OpLabel + OpUnreachable + %331 = OpLabel + OpUnreachable + %324 = OpLabel + %323 = OpPhi %int %348 %347 %340 %339 + OpBranch %321 + %326 = OpLabel + %350 = OpPhi %bool %false %321 %true %346 %true %338 + OpSelectionMerge %351 None + OpBranchConditional %350 %319 %351 + %351 = OpLabel + OpBranch %319 + %319 = OpLabel + OpBranch %352 + %352 = OpLabel + %353 = OpPhi %int %40 %319 %354 %355 + %356 = OpPhi %int %int_0 %319 %357 %355 + %358 = OpPhi %int %int_0 %319 %359 %355 + %360 = OpSLessThan %bool %358 %int_20 + OpLoopMerge %361 %355 None + OpBranchConditional %360 %362 %361 + %362 = OpLabel + OpSelectionMerge %363 None + OpSwitch %uint_0 %364 + %364 = OpLabel + OpBranch %365 + %365 = OpLabel + %366 = OpPhi %int %int_0 %364 %367 %368 + %369 = OpINotEqual %bool %366 %int_n1 + OpLoopMerge %370 %368 None + OpBranchConditional %369 %371 %370 + %371 = OpLabel + %372 = OpAccessChain %_ptr_Function_BST %tree %366 + %373 = OpLoad %BST %372 + %374 = OpCompositeExtract %int %373 0 + %375 = OpCompositeExtract %int %373 1 + %376 = OpCompositeExtract %int %373 2 + %377 = OpIEqual %bool %374 %358 + OpSelectionMerge %378 None + OpBranchConditional %377 %379 %378 + %379 = OpLabel + OpBranch %370 + %378 = OpLabel + %380 = OpSGreaterThan %bool %358 %374 + %367 = OpSelect %int %380 %376 %375 + OpBranch %368 + %368 = OpLabel + OpBranch %365 + %370 = OpLabel + %381 = OpPhi %int %353 %365 %358 %379 + %382 = OpPhi %bool %false %365 %true %379 + OpSelectionMerge %383 None + OpBranchConditional %382 %363 %383 + %383 = OpLabel + OpBranch %363 + %363 = OpLabel + %354 = OpPhi %int %381 %370 %int_n1 %383 + OpSelectionMerge %384 None + OpSwitch %358 %385 9 %386 5 %386 12 %386 15 %386 7 %386 8 %386 2 %386 6 %386 17 %386 13 %386 + %386 = OpLabel + %387 = OpIEqual %bool %354 %358 + OpSelectionMerge %388 None + OpBranchConditional %387 %389 %388 + %389 = OpLabel + %390 = OpIAdd %int %356 %int_1 + OpBranch %388 + %388 = OpLabel + %391 = OpPhi %int %356 %386 %390 %389 + OpBranch %384 + %385 = OpLabel + %392 = OpIEqual %bool %354 %int_n1 + OpSelectionMerge %393 None + OpBranchConditional %392 %394 %393 + %394 = OpLabel + %395 = OpIAdd %int %356 %int_1 + OpBranch %393 + %393 = OpLabel + %396 = OpPhi %int %356 %385 %395 %394 + OpBranch %384 + %384 = OpLabel + %357 = OpPhi %int %396 %393 %391 %388 + OpBranch %355 + %355 = OpLabel + %359 = OpIAdd %int %358 %int_1 + OpBranch %352 + %361 = OpLabel + %397 = OpIEqual %bool %356 %int_20 + OpSelectionMerge %398 None + OpBranchConditional %397 %399 %400 + %400 = OpLabel + OpStore %_GLF_color %35 + OpBranch %398 + %399 = OpLabel + OpStore %_GLF_color %34 + OpBranch %398 + %398 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..1f593e3cf5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.hlsl @@ -0,0 +1,748 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + BST tree[10] = (BST[10])0; + int x_356 = 0; + int x_58_phi = 0; + bool x_86_phi = false; + int x_353_phi = 0; + int x_356_phi = 0; + int x_358_phi = 0; + const BST tint_symbol_2 = {9, -1, -1}; + tree[0] = tint_symbol_2; + switch(0u) { + default: { + x_58_phi = 0; + while (true) { + int x_84 = 0; + int x_76 = 0; + int x_59 = 0; + int x_59_phi = 0; + const int x_58 = x_58_phi; + x_86_phi = false; + if ((x_58 <= 1)) { + } else { + break; + } + const int x_65 = tree[x_58].data; + if ((5 <= x_65)) { + const int x_78_save = x_58; + const int x_79 = tree[x_78_save].leftIndex; + if ((x_79 == -1)) { + tree[x_78_save].leftIndex = 1; + const BST tint_symbol_3 = {5, -1, -1}; + tree[1] = tint_symbol_3; + x_86_phi = true; + break; + } else { + x_84 = tree[x_78_save].leftIndex; + x_59_phi = x_84; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + continue; + } + return; + } else { + const int x_70_save = x_58; + const int x_71 = tree[x_70_save].rightIndex; + if ((x_71 == -1)) { + tree[x_70_save].rightIndex = 1; + const BST tint_symbol_4 = {5, -1, -1}; + tree[1] = tint_symbol_4; + x_86_phi = true; + break; + } else { + x_76 = tree[x_70_save].rightIndex; + x_59_phi = x_76; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + continue; + } + return; + } + return; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + } + if (x_86_phi) { + break; + } + break; + } + } + int x_91_phi = 0; + bool x_119_phi = false; + switch(0u) { + default: { + x_91_phi = 0; + while (true) { + int x_117 = 0; + int x_109 = 0; + int x_92 = 0; + int x_92_phi = 0; + const int x_91 = x_91_phi; + x_119_phi = false; + if ((x_91 <= 2)) { + } else { + break; + } + const int x_98 = tree[x_91].data; + if ((12 <= x_98)) { + const int x_111_save = x_91; + const int x_112 = tree[x_111_save].leftIndex; + if ((x_112 == -1)) { + tree[x_111_save].leftIndex = 2; + const BST tint_symbol_5 = {12, -1, -1}; + tree[2] = tint_symbol_5; + x_119_phi = true; + break; + } else { + x_117 = tree[x_111_save].leftIndex; + x_92_phi = x_117; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + continue; + } + return; + } else { + const int x_103_save = x_91; + const int x_104 = tree[x_103_save].rightIndex; + if ((x_104 == -1)) { + tree[x_103_save].rightIndex = 2; + const BST tint_symbol_6 = {12, -1, -1}; + tree[2] = tint_symbol_6; + x_119_phi = true; + break; + } else { + x_109 = tree[x_103_save].rightIndex; + x_92_phi = x_109; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + continue; + } + return; + } + return; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + } + if (x_119_phi) { + break; + } + break; + } + } + int x_124_phi = 0; + bool x_152_phi = false; + switch(0u) { + default: { + x_124_phi = 0; + while (true) { + int x_150 = 0; + int x_142 = 0; + int x_125 = 0; + int x_125_phi = 0; + const int x_124 = x_124_phi; + x_152_phi = false; + if ((x_124 <= 3)) { + } else { + break; + } + const int x_131 = tree[x_124].data; + if ((15 <= x_131)) { + const int x_144_save = x_124; + const int x_145 = tree[x_144_save].leftIndex; + if ((x_145 == -1)) { + tree[x_144_save].leftIndex = 3; + const BST tint_symbol_7 = {15, -1, -1}; + tree[3] = tint_symbol_7; + x_152_phi = true; + break; + } else { + x_150 = tree[x_144_save].leftIndex; + x_125_phi = x_150; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + continue; + } + return; + } else { + const int x_136_save = x_124; + const int x_137 = tree[x_136_save].rightIndex; + if ((x_137 == -1)) { + tree[x_136_save].rightIndex = 3; + const BST tint_symbol_8 = {15, -1, -1}; + tree[3] = tint_symbol_8; + x_152_phi = true; + break; + } else { + x_142 = tree[x_136_save].rightIndex; + x_125_phi = x_142; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + continue; + } + return; + } + return; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + } + if (x_152_phi) { + break; + } + break; + } + } + int x_157_phi = 0; + bool x_185_phi = false; + switch(0u) { + default: { + x_157_phi = 0; + while (true) { + int x_183 = 0; + int x_175 = 0; + int x_158 = 0; + int x_158_phi = 0; + const int x_157 = x_157_phi; + x_185_phi = false; + if ((x_157 <= 4)) { + } else { + break; + } + const int x_164 = tree[x_157].data; + if ((7 <= x_164)) { + const int x_177_save = x_157; + const int x_178 = tree[x_177_save].leftIndex; + if ((x_178 == -1)) { + tree[x_177_save].leftIndex = 4; + const BST tint_symbol_9 = {7, -1, -1}; + tree[4] = tint_symbol_9; + x_185_phi = true; + break; + } else { + x_183 = tree[x_177_save].leftIndex; + x_158_phi = x_183; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + continue; + } + return; + } else { + const int x_169_save = x_157; + const int x_170 = tree[x_169_save].rightIndex; + if ((x_170 == -1)) { + tree[x_169_save].rightIndex = 4; + const BST tint_symbol_10 = {7, -1, -1}; + tree[4] = tint_symbol_10; + x_185_phi = true; + break; + } else { + x_175 = tree[x_169_save].rightIndex; + x_158_phi = x_175; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + continue; + } + return; + } + return; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + } + if (x_185_phi) { + break; + } + break; + } + } + int x_190_phi = 0; + bool x_218_phi = false; + switch(0u) { + default: { + x_190_phi = 0; + while (true) { + int x_216 = 0; + int x_208 = 0; + int x_191 = 0; + int x_191_phi = 0; + const int x_190 = x_190_phi; + x_218_phi = false; + if ((x_190 <= 5)) { + } else { + break; + } + const int x_197 = tree[x_190].data; + if ((8 <= x_197)) { + const int x_210_save = x_190; + const int x_211 = tree[x_210_save].leftIndex; + if ((x_211 == -1)) { + tree[x_210_save].leftIndex = 5; + const BST tint_symbol_11 = {8, -1, -1}; + tree[5] = tint_symbol_11; + x_218_phi = true; + break; + } else { + x_216 = tree[x_210_save].leftIndex; + x_191_phi = x_216; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + continue; + } + return; + } else { + const int x_202_save = x_190; + const int x_203 = tree[x_202_save].rightIndex; + if ((x_203 == -1)) { + tree[x_202_save].rightIndex = 5; + const BST tint_symbol_12 = {8, -1, -1}; + tree[5] = tint_symbol_12; + x_218_phi = true; + break; + } else { + x_208 = tree[x_202_save].rightIndex; + x_191_phi = x_208; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + continue; + } + return; + } + return; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + } + if (x_218_phi) { + break; + } + break; + } + } + int x_223_phi = 0; + bool x_251_phi = false; + switch(0u) { + default: { + x_223_phi = 0; + while (true) { + int x_249 = 0; + int x_241 = 0; + int x_224 = 0; + int x_224_phi = 0; + const int x_223 = x_223_phi; + x_251_phi = false; + if ((x_223 <= 6)) { + } else { + break; + } + const int x_230 = tree[x_223].data; + if ((2 <= x_230)) { + const int x_243_save = x_223; + const int x_244 = tree[x_243_save].leftIndex; + if ((x_244 == -1)) { + tree[x_243_save].leftIndex = 6; + const BST tint_symbol_13 = {2, -1, -1}; + tree[6] = tint_symbol_13; + x_251_phi = true; + break; + } else { + x_249 = tree[x_243_save].leftIndex; + x_224_phi = x_249; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + continue; + } + return; + } else { + const int x_235_save = x_223; + const int x_236 = tree[x_235_save].rightIndex; + if ((x_236 == -1)) { + tree[x_235_save].rightIndex = 6; + const BST tint_symbol_14 = {2, -1, -1}; + tree[6] = tint_symbol_14; + x_251_phi = true; + break; + } else { + x_241 = tree[x_235_save].rightIndex; + x_224_phi = x_241; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + continue; + } + return; + } + return; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + } + if (x_251_phi) { + break; + } + break; + } + } + int x_256_phi = 0; + bool x_284_phi = false; + switch(0u) { + default: { + x_256_phi = 0; + while (true) { + int x_282 = 0; + int x_274 = 0; + int x_257 = 0; + int x_257_phi = 0; + const int x_256 = x_256_phi; + x_284_phi = false; + if ((x_256 <= 7)) { + } else { + break; + } + const int x_263 = tree[x_256].data; + if ((6 <= x_263)) { + const int x_276_save = x_256; + const int x_277 = tree[x_276_save].leftIndex; + if ((x_277 == -1)) { + tree[x_276_save].leftIndex = 7; + const BST tint_symbol_15 = {6, -1, -1}; + tree[7] = tint_symbol_15; + x_284_phi = true; + break; + } else { + x_282 = tree[x_276_save].leftIndex; + x_257_phi = x_282; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + continue; + } + return; + } else { + const int x_268_save = x_256; + const int x_269 = tree[x_268_save].rightIndex; + if ((x_269 == -1)) { + tree[x_268_save].rightIndex = 7; + const BST tint_symbol_16 = {6, -1, -1}; + tree[7] = tint_symbol_16; + x_284_phi = true; + break; + } else { + x_274 = tree[x_268_save].rightIndex; + x_257_phi = x_274; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + continue; + } + return; + } + return; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + } + if (x_284_phi) { + break; + } + break; + } + } + int x_289_phi = 0; + bool x_317_phi = false; + switch(0u) { + default: { + x_289_phi = 0; + while (true) { + int x_315 = 0; + int x_307 = 0; + int x_290 = 0; + int x_290_phi = 0; + const int x_289 = x_289_phi; + x_317_phi = false; + if ((x_289 <= 8)) { + } else { + break; + } + const int x_296 = tree[x_289].data; + if ((17 <= x_296)) { + const int x_309_save = x_289; + const int x_310 = tree[x_309_save].leftIndex; + if ((x_310 == -1)) { + tree[x_309_save].leftIndex = 8; + const BST tint_symbol_17 = {17, -1, -1}; + tree[8] = tint_symbol_17; + x_317_phi = true; + break; + } else { + x_315 = tree[x_309_save].leftIndex; + x_290_phi = x_315; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + continue; + } + return; + } else { + const int x_301_save = x_289; + const int x_302 = tree[x_301_save].rightIndex; + if ((x_302 == -1)) { + tree[x_301_save].rightIndex = 8; + const BST tint_symbol_18 = {17, -1, -1}; + tree[8] = tint_symbol_18; + x_317_phi = true; + break; + } else { + x_307 = tree[x_301_save].rightIndex; + x_290_phi = x_307; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + continue; + } + return; + } + return; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + } + if (x_317_phi) { + break; + } + break; + } + } + int x_322_phi = 0; + bool x_350_phi = false; + switch(0u) { + default: { + x_322_phi = 0; + while (true) { + int x_348 = 0; + int x_340 = 0; + int x_323 = 0; + int x_323_phi = 0; + const int x_322 = x_322_phi; + x_350_phi = false; + if ((x_322 <= 9)) { + } else { + break; + } + const int x_329 = tree[x_322].data; + if ((13 <= x_329)) { + const int x_342_save = x_322; + const int x_343 = tree[x_342_save].leftIndex; + if ((x_343 == -1)) { + tree[x_342_save].leftIndex = 9; + const BST tint_symbol_19 = {13, -1, -1}; + tree[9] = tint_symbol_19; + x_350_phi = true; + break; + } else { + x_348 = tree[x_342_save].leftIndex; + x_323_phi = x_348; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + continue; + } + return; + } else { + const int x_334_save = x_322; + const int x_335 = tree[x_334_save].rightIndex; + if ((x_335 == -1)) { + tree[x_334_save].rightIndex = 9; + const BST tint_symbol_20 = {13, -1, -1}; + tree[9] = tint_symbol_20; + x_350_phi = true; + break; + } else { + x_340 = tree[x_334_save].rightIndex; + x_323_phi = x_340; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + continue; + } + return; + } + return; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + } + if (x_350_phi) { + break; + } + break; + } + } + x_353_phi = 0; + x_356_phi = 0; + x_358_phi = 0; + while (true) { + int x_381 = 0; + int x_391 = 0; + int x_396 = 0; + int x_359 = 0; + int x_354_phi = 0; + int x_357_phi = 0; + const int x_353 = x_353_phi; + x_356 = x_356_phi; + const int x_358 = x_358_phi; + if ((x_358 < 20)) { + } else { + break; + } + int x_366_phi = 0; + int x_381_phi = 0; + bool x_382_phi = false; + switch(0u) { + default: { + x_366_phi = 0; + while (true) { + const int x_366 = x_366_phi; + x_381_phi = x_353; + x_382_phi = false; + if ((x_366 != -1)) { + } else { + break; + } + const BST x_373 = tree[x_366]; + const int x_374 = x_373.data; + const int x_375 = x_373.leftIndex; + const int x_376 = x_373.rightIndex; + if ((x_374 == x_358)) { + x_381_phi = x_358; + x_382_phi = true; + break; + } + { + x_366_phi = ((x_358 > x_374) ? x_376 : x_375); + } + } + x_381 = x_381_phi; + const bool x_382 = x_382_phi; + x_354_phi = x_381; + if (x_382) { + break; + } + x_354_phi = -1; + break; + } + } + int x_354 = 0; + int x_390 = 0; + int x_395 = 0; + int x_391_phi = 0; + int x_396_phi = 0; + x_354 = x_354_phi; + switch(x_358) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_391_phi = x_356; + if ((x_354 == asint(x_358))) { + x_390 = asint((x_356 + asint(1))); + x_391_phi = x_390; + } + x_391 = x_391_phi; + x_357_phi = x_391; + break; + } + default: { + x_396_phi = x_356; + if ((x_354 == asint(-1))) { + x_395 = asint((x_356 + asint(1))); + x_396_phi = x_395; + } + x_396 = x_396_phi; + x_357_phi = x_396; + break; + } + } + const int x_357 = x_357_phi; + { + x_359 = (x_358 + 1); + x_353_phi = x_354; + x_356_phi = x_357; + x_358_phi = x_359; + } + } + if ((x_356 == asint(20))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_21 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_21; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.msl new file mode 100644 index 0000000000..752c6ed0be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.msl @@ -0,0 +1,762 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_23) { + tint_array_wrapper tree = {}; + int x_356 = 0; + int x_58_phi = 0; + bool x_86_phi = false; + int x_353_phi = 0; + int x_356_phi = 0; + int x_358_phi = 0; + BST const tint_symbol_3 = {.data=9, .leftIndex=-1, .rightIndex=-1}; + tree.arr[0] = tint_symbol_3; + switch(0u) { + default: { + x_58_phi = 0; + while (true) { + int x_84 = 0; + int x_76 = 0; + int x_59 = 0; + int x_59_phi = 0; + int const x_58 = x_58_phi; + x_86_phi = false; + if ((x_58 <= 1)) { + } else { + break; + } + int const x_65 = tree.arr[x_58].data; + if ((5 <= x_65)) { + int const x_78_save = x_58; + int const x_79 = tree.arr[x_78_save].leftIndex; + if ((x_79 == -1)) { + tree.arr[x_78_save].leftIndex = 1; + BST const tint_symbol_4 = {.data=5, .leftIndex=-1, .rightIndex=-1}; + tree.arr[1] = tint_symbol_4; + x_86_phi = true; + break; + } else { + x_84 = tree.arr[x_78_save].leftIndex; + x_59_phi = x_84; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + continue; + } + return; + } else { + int const x_70_save = x_58; + int const x_71 = tree.arr[x_70_save].rightIndex; + if ((x_71 == -1)) { + tree.arr[x_70_save].rightIndex = 1; + BST const tint_symbol_5 = {.data=5, .leftIndex=-1, .rightIndex=-1}; + tree.arr[1] = tint_symbol_5; + x_86_phi = true; + break; + } else { + x_76 = tree.arr[x_70_save].rightIndex; + x_59_phi = x_76; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + continue; + } + return; + } + return; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + } + bool const x_86 = x_86_phi; + if (x_86) { + break; + } + break; + } + } + int x_91_phi = 0; + bool x_119_phi = false; + switch(0u) { + default: { + x_91_phi = 0; + while (true) { + int x_117 = 0; + int x_109 = 0; + int x_92 = 0; + int x_92_phi = 0; + int const x_91 = x_91_phi; + x_119_phi = false; + if ((x_91 <= 2)) { + } else { + break; + } + int const x_98 = tree.arr[x_91].data; + if ((12 <= x_98)) { + int const x_111_save = x_91; + int const x_112 = tree.arr[x_111_save].leftIndex; + if ((x_112 == -1)) { + tree.arr[x_111_save].leftIndex = 2; + BST const tint_symbol_6 = {.data=12, .leftIndex=-1, .rightIndex=-1}; + tree.arr[2] = tint_symbol_6; + x_119_phi = true; + break; + } else { + x_117 = tree.arr[x_111_save].leftIndex; + x_92_phi = x_117; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + continue; + } + return; + } else { + int const x_103_save = x_91; + int const x_104 = tree.arr[x_103_save].rightIndex; + if ((x_104 == -1)) { + tree.arr[x_103_save].rightIndex = 2; + BST const tint_symbol_7 = {.data=12, .leftIndex=-1, .rightIndex=-1}; + tree.arr[2] = tint_symbol_7; + x_119_phi = true; + break; + } else { + x_109 = tree.arr[x_103_save].rightIndex; + x_92_phi = x_109; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + continue; + } + return; + } + return; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + } + bool const x_119 = x_119_phi; + if (x_119) { + break; + } + break; + } + } + int x_124_phi = 0; + bool x_152_phi = false; + switch(0u) { + default: { + x_124_phi = 0; + while (true) { + int x_150 = 0; + int x_142 = 0; + int x_125 = 0; + int x_125_phi = 0; + int const x_124 = x_124_phi; + x_152_phi = false; + if ((x_124 <= 3)) { + } else { + break; + } + int const x_131 = tree.arr[x_124].data; + if ((15 <= x_131)) { + int const x_144_save = x_124; + int const x_145 = tree.arr[x_144_save].leftIndex; + if ((x_145 == -1)) { + tree.arr[x_144_save].leftIndex = 3; + BST const tint_symbol_8 = {.data=15, .leftIndex=-1, .rightIndex=-1}; + tree.arr[3] = tint_symbol_8; + x_152_phi = true; + break; + } else { + x_150 = tree.arr[x_144_save].leftIndex; + x_125_phi = x_150; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + continue; + } + return; + } else { + int const x_136_save = x_124; + int const x_137 = tree.arr[x_136_save].rightIndex; + if ((x_137 == -1)) { + tree.arr[x_136_save].rightIndex = 3; + BST const tint_symbol_9 = {.data=15, .leftIndex=-1, .rightIndex=-1}; + tree.arr[3] = tint_symbol_9; + x_152_phi = true; + break; + } else { + x_142 = tree.arr[x_136_save].rightIndex; + x_125_phi = x_142; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + continue; + } + return; + } + return; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + } + bool const x_152 = x_152_phi; + if (x_152) { + break; + } + break; + } + } + int x_157_phi = 0; + bool x_185_phi = false; + switch(0u) { + default: { + x_157_phi = 0; + while (true) { + int x_183 = 0; + int x_175 = 0; + int x_158 = 0; + int x_158_phi = 0; + int const x_157 = x_157_phi; + x_185_phi = false; + if ((x_157 <= 4)) { + } else { + break; + } + int const x_164 = tree.arr[x_157].data; + if ((7 <= x_164)) { + int const x_177_save = x_157; + int const x_178 = tree.arr[x_177_save].leftIndex; + if ((x_178 == -1)) { + tree.arr[x_177_save].leftIndex = 4; + BST const tint_symbol_10 = {.data=7, .leftIndex=-1, .rightIndex=-1}; + tree.arr[4] = tint_symbol_10; + x_185_phi = true; + break; + } else { + x_183 = tree.arr[x_177_save].leftIndex; + x_158_phi = x_183; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + continue; + } + return; + } else { + int const x_169_save = x_157; + int const x_170 = tree.arr[x_169_save].rightIndex; + if ((x_170 == -1)) { + tree.arr[x_169_save].rightIndex = 4; + BST const tint_symbol_11 = {.data=7, .leftIndex=-1, .rightIndex=-1}; + tree.arr[4] = tint_symbol_11; + x_185_phi = true; + break; + } else { + x_175 = tree.arr[x_169_save].rightIndex; + x_158_phi = x_175; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + continue; + } + return; + } + return; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + } + bool const x_185 = x_185_phi; + if (x_185) { + break; + } + break; + } + } + int x_190_phi = 0; + bool x_218_phi = false; + switch(0u) { + default: { + x_190_phi = 0; + while (true) { + int x_216 = 0; + int x_208 = 0; + int x_191 = 0; + int x_191_phi = 0; + int const x_190 = x_190_phi; + x_218_phi = false; + if ((x_190 <= 5)) { + } else { + break; + } + int const x_197 = tree.arr[x_190].data; + if ((8 <= x_197)) { + int const x_210_save = x_190; + int const x_211 = tree.arr[x_210_save].leftIndex; + if ((x_211 == -1)) { + tree.arr[x_210_save].leftIndex = 5; + BST const tint_symbol_12 = {.data=8, .leftIndex=-1, .rightIndex=-1}; + tree.arr[5] = tint_symbol_12; + x_218_phi = true; + break; + } else { + x_216 = tree.arr[x_210_save].leftIndex; + x_191_phi = x_216; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + continue; + } + return; + } else { + int const x_202_save = x_190; + int const x_203 = tree.arr[x_202_save].rightIndex; + if ((x_203 == -1)) { + tree.arr[x_202_save].rightIndex = 5; + BST const tint_symbol_13 = {.data=8, .leftIndex=-1, .rightIndex=-1}; + tree.arr[5] = tint_symbol_13; + x_218_phi = true; + break; + } else { + x_208 = tree.arr[x_202_save].rightIndex; + x_191_phi = x_208; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + continue; + } + return; + } + return; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + } + bool const x_218 = x_218_phi; + if (x_218) { + break; + } + break; + } + } + int x_223_phi = 0; + bool x_251_phi = false; + switch(0u) { + default: { + x_223_phi = 0; + while (true) { + int x_249 = 0; + int x_241 = 0; + int x_224 = 0; + int x_224_phi = 0; + int const x_223 = x_223_phi; + x_251_phi = false; + if ((x_223 <= 6)) { + } else { + break; + } + int const x_230 = tree.arr[x_223].data; + if ((2 <= x_230)) { + int const x_243_save = x_223; + int const x_244 = tree.arr[x_243_save].leftIndex; + if ((x_244 == -1)) { + tree.arr[x_243_save].leftIndex = 6; + BST const tint_symbol_14 = {.data=2, .leftIndex=-1, .rightIndex=-1}; + tree.arr[6] = tint_symbol_14; + x_251_phi = true; + break; + } else { + x_249 = tree.arr[x_243_save].leftIndex; + x_224_phi = x_249; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + continue; + } + return; + } else { + int const x_235_save = x_223; + int const x_236 = tree.arr[x_235_save].rightIndex; + if ((x_236 == -1)) { + tree.arr[x_235_save].rightIndex = 6; + BST const tint_symbol_15 = {.data=2, .leftIndex=-1, .rightIndex=-1}; + tree.arr[6] = tint_symbol_15; + x_251_phi = true; + break; + } else { + x_241 = tree.arr[x_235_save].rightIndex; + x_224_phi = x_241; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + continue; + } + return; + } + return; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + } + bool const x_251 = x_251_phi; + if (x_251) { + break; + } + break; + } + } + int x_256_phi = 0; + bool x_284_phi = false; + switch(0u) { + default: { + x_256_phi = 0; + while (true) { + int x_282 = 0; + int x_274 = 0; + int x_257 = 0; + int x_257_phi = 0; + int const x_256 = x_256_phi; + x_284_phi = false; + if ((x_256 <= 7)) { + } else { + break; + } + int const x_263 = tree.arr[x_256].data; + if ((6 <= x_263)) { + int const x_276_save = x_256; + int const x_277 = tree.arr[x_276_save].leftIndex; + if ((x_277 == -1)) { + tree.arr[x_276_save].leftIndex = 7; + BST const tint_symbol_16 = {.data=6, .leftIndex=-1, .rightIndex=-1}; + tree.arr[7] = tint_symbol_16; + x_284_phi = true; + break; + } else { + x_282 = tree.arr[x_276_save].leftIndex; + x_257_phi = x_282; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + continue; + } + return; + } else { + int const x_268_save = x_256; + int const x_269 = tree.arr[x_268_save].rightIndex; + if ((x_269 == -1)) { + tree.arr[x_268_save].rightIndex = 7; + BST const tint_symbol_17 = {.data=6, .leftIndex=-1, .rightIndex=-1}; + tree.arr[7] = tint_symbol_17; + x_284_phi = true; + break; + } else { + x_274 = tree.arr[x_268_save].rightIndex; + x_257_phi = x_274; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + continue; + } + return; + } + return; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + } + bool const x_284 = x_284_phi; + if (x_284) { + break; + } + break; + } + } + int x_289_phi = 0; + bool x_317_phi = false; + switch(0u) { + default: { + x_289_phi = 0; + while (true) { + int x_315 = 0; + int x_307 = 0; + int x_290 = 0; + int x_290_phi = 0; + int const x_289 = x_289_phi; + x_317_phi = false; + if ((x_289 <= 8)) { + } else { + break; + } + int const x_296 = tree.arr[x_289].data; + if ((17 <= x_296)) { + int const x_309_save = x_289; + int const x_310 = tree.arr[x_309_save].leftIndex; + if ((x_310 == -1)) { + tree.arr[x_309_save].leftIndex = 8; + BST const tint_symbol_18 = {.data=17, .leftIndex=-1, .rightIndex=-1}; + tree.arr[8] = tint_symbol_18; + x_317_phi = true; + break; + } else { + x_315 = tree.arr[x_309_save].leftIndex; + x_290_phi = x_315; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + continue; + } + return; + } else { + int const x_301_save = x_289; + int const x_302 = tree.arr[x_301_save].rightIndex; + if ((x_302 == -1)) { + tree.arr[x_301_save].rightIndex = 8; + BST const tint_symbol_19 = {.data=17, .leftIndex=-1, .rightIndex=-1}; + tree.arr[8] = tint_symbol_19; + x_317_phi = true; + break; + } else { + x_307 = tree.arr[x_301_save].rightIndex; + x_290_phi = x_307; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + continue; + } + return; + } + return; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + } + bool const x_317 = x_317_phi; + if (x_317) { + break; + } + break; + } + } + int x_322_phi = 0; + bool x_350_phi = false; + switch(0u) { + default: { + x_322_phi = 0; + while (true) { + int x_348 = 0; + int x_340 = 0; + int x_323 = 0; + int x_323_phi = 0; + int const x_322 = x_322_phi; + x_350_phi = false; + if ((x_322 <= 9)) { + } else { + break; + } + int const x_329 = tree.arr[x_322].data; + if ((13 <= x_329)) { + int const x_342_save = x_322; + int const x_343 = tree.arr[x_342_save].leftIndex; + if ((x_343 == -1)) { + tree.arr[x_342_save].leftIndex = 9; + BST const tint_symbol_20 = {.data=13, .leftIndex=-1, .rightIndex=-1}; + tree.arr[9] = tint_symbol_20; + x_350_phi = true; + break; + } else { + x_348 = tree.arr[x_342_save].leftIndex; + x_323_phi = x_348; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + continue; + } + return; + } else { + int const x_334_save = x_322; + int const x_335 = tree.arr[x_334_save].rightIndex; + if ((x_335 == -1)) { + tree.arr[x_334_save].rightIndex = 9; + BST const tint_symbol_21 = {.data=13, .leftIndex=-1, .rightIndex=-1}; + tree.arr[9] = tint_symbol_21; + x_350_phi = true; + break; + } else { + x_340 = tree.arr[x_334_save].rightIndex; + x_323_phi = x_340; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + continue; + } + return; + } + return; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + } + bool const x_350 = x_350_phi; + if (x_350) { + break; + } + break; + } + } + x_353_phi = 0; + x_356_phi = 0; + x_358_phi = 0; + while (true) { + int x_381 = 0; + int x_391 = 0; + int x_396 = 0; + int x_359 = 0; + int x_354_phi = 0; + int x_357_phi = 0; + int const x_353 = x_353_phi; + x_356 = x_356_phi; + int const x_358 = x_358_phi; + if ((x_358 < 20)) { + } else { + break; + } + int x_366_phi = 0; + int x_381_phi = 0; + bool x_382_phi = false; + switch(0u) { + default: { + x_366_phi = 0; + while (true) { + int const x_366 = x_366_phi; + x_381_phi = x_353; + x_382_phi = false; + if ((x_366 != -1)) { + } else { + break; + } + BST const x_373 = tree.arr[x_366]; + int const x_374 = x_373.data; + int const x_375 = x_373.leftIndex; + int const x_376 = x_373.rightIndex; + if ((x_374 == x_358)) { + x_381_phi = x_358; + x_382_phi = true; + break; + } + { + x_366_phi = select(x_375, x_376, (x_358 > x_374)); + } + } + x_381 = x_381_phi; + bool const x_382 = x_382_phi; + x_354_phi = x_381; + if (x_382) { + break; + } + x_354_phi = -1; + break; + } + } + int x_354 = 0; + int x_390 = 0; + int x_395 = 0; + int x_391_phi = 0; + int x_396_phi = 0; + x_354 = x_354_phi; + switch(x_358) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_391_phi = x_356; + if ((x_354 == as_type(x_358))) { + x_390 = as_type((x_356 + as_type(1))); + x_391_phi = x_390; + } + x_391 = x_391_phi; + x_357_phi = x_391; + break; + } + default: { + x_396_phi = x_356; + if ((x_354 == as_type(-1))) { + x_395 = as_type((x_356 + as_type(1))); + x_396_phi = x_395; + } + x_396 = x_396_phi; + x_357_phi = x_396; + break; + } + } + int const x_357 = x_357_phi; + { + x_359 = (x_358 + 1); + x_353_phi = x_354; + x_356_phi = x_357; + x_358_phi = x_359; + } + } + if ((x_356 == as_type(20))) { + *(tint_symbol_23) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_23) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_24 = 0.0f; + main_1(&(tint_symbol_24)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_24}; + tint_symbol_1 const tint_symbol_22 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_22; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..9ea3312a6e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.spvasm @@ -0,0 +1,1166 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 619 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree "tree" + OpName %x_356 "x_356" + OpName %x_58_phi "x_58_phi" + OpName %x_86_phi "x_86_phi" + OpName %x_353_phi "x_353_phi" + OpName %x_356_phi "x_356_phi" + OpName %x_358_phi "x_358_phi" + OpName %x_84 "x_84" + OpName %x_76 "x_76" + OpName %x_59 "x_59" + OpName %x_59_phi "x_59_phi" + OpName %x_91_phi "x_91_phi" + OpName %x_119_phi "x_119_phi" + OpName %x_117 "x_117" + OpName %x_109 "x_109" + OpName %x_92 "x_92" + OpName %x_92_phi "x_92_phi" + OpName %x_124_phi "x_124_phi" + OpName %x_152_phi "x_152_phi" + OpName %x_150 "x_150" + OpName %x_142 "x_142" + OpName %x_125 "x_125" + OpName %x_125_phi "x_125_phi" + OpName %x_157_phi "x_157_phi" + OpName %x_185_phi "x_185_phi" + OpName %x_183 "x_183" + OpName %x_175 "x_175" + OpName %x_158 "x_158" + OpName %x_158_phi "x_158_phi" + OpName %x_190_phi "x_190_phi" + OpName %x_218_phi "x_218_phi" + OpName %x_216 "x_216" + OpName %x_208 "x_208" + OpName %x_191 "x_191" + OpName %x_191_phi "x_191_phi" + OpName %x_223_phi "x_223_phi" + OpName %x_251_phi "x_251_phi" + OpName %x_249 "x_249" + OpName %x_241 "x_241" + OpName %x_224 "x_224" + OpName %x_224_phi "x_224_phi" + OpName %x_256_phi "x_256_phi" + OpName %x_284_phi "x_284_phi" + OpName %x_282 "x_282" + OpName %x_274 "x_274" + OpName %x_257 "x_257" + OpName %x_257_phi "x_257_phi" + OpName %x_289_phi "x_289_phi" + OpName %x_317_phi "x_317_phi" + OpName %x_315 "x_315" + OpName %x_307 "x_307" + OpName %x_290 "x_290" + OpName %x_290_phi "x_290_phi" + OpName %x_322_phi "x_322_phi" + OpName %x_350_phi "x_350_phi" + OpName %x_348 "x_348" + OpName %x_340 "x_340" + OpName %x_323 "x_323" + OpName %x_323_phi "x_323_phi" + OpName %x_381 "x_381" + OpName %x_391 "x_391" + OpName %x_396 "x_396" + OpName %x_359 "x_359" + OpName %x_354_phi "x_354_phi" + OpName %x_357_phi "x_357_phi" + OpName %x_366_phi "x_366_phi" + OpName %x_381_phi "x_381_phi" + OpName %x_382_phi "x_382_phi" + OpName %x_354 "x_354" + OpName %x_390 "x_390" + OpName %x_395 "x_395" + OpName %x_391_phi "x_391_phi" + OpName %x_396_phi "x_396_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Function__arr_BST_uint_10 = OpTypePointer Function %_arr_BST_uint_10 + %19 = OpConstantNull %_arr_BST_uint_10 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool + %int_0 = OpConstant %int 0 +%_ptr_Function_BST = OpTypePointer Function %BST + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 + %36 = OpConstantComposite %BST %int_9 %int_n1 %int_n1 + %uint_0 = OpConstant %uint 0 + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 + %71 = OpConstantComposite %BST %int_5 %int_n1 %int_n1 + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 + %int_12 = OpConstant %int 12 + %126 = OpConstantComposite %BST %int_12 %int_n1 %int_n1 + %int_3 = OpConstant %int 3 + %int_15 = OpConstant %int 15 + %179 = OpConstantComposite %BST %int_15 %int_n1 %int_n1 + %int_4 = OpConstant %int 4 + %int_7 = OpConstant %int 7 + %232 = OpConstantComposite %BST %int_7 %int_n1 %int_n1 + %int_8 = OpConstant %int 8 + %284 = OpConstantComposite %BST %int_8 %int_n1 %int_n1 + %int_6 = OpConstant %int 6 + %336 = OpConstantComposite %BST %int_2 %int_n1 %int_n1 + %387 = OpConstantComposite %BST %int_6 %int_n1 %int_n1 + %int_17 = OpConstant %int 17 + %439 = OpConstantComposite %BST %int_17 %int_n1 %int_n1 + %int_13 = OpConstant %int 13 + %491 = OpConstantComposite %BST %int_13 %int_n1 %int_n1 + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %605 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %606 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %607 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %tree = OpVariable %_ptr_Function__arr_BST_uint_10 Function %19 + %x_356 = OpVariable %_ptr_Function_int Function %22 + %x_58_phi = OpVariable %_ptr_Function_int Function %22 + %x_86_phi = OpVariable %_ptr_Function_bool Function %27 + %x_353_phi = OpVariable %_ptr_Function_int Function %22 + %x_356_phi = OpVariable %_ptr_Function_int Function %22 + %x_358_phi = OpVariable %_ptr_Function_int Function %22 + %x_84 = OpVariable %_ptr_Function_int Function %22 + %x_76 = OpVariable %_ptr_Function_int Function %22 + %x_59 = OpVariable %_ptr_Function_int Function %22 + %x_59_phi = OpVariable %_ptr_Function_int Function %22 + %x_91_phi = OpVariable %_ptr_Function_int Function %22 + %x_119_phi = OpVariable %_ptr_Function_bool Function %27 + %x_117 = OpVariable %_ptr_Function_int Function %22 + %x_109 = OpVariable %_ptr_Function_int Function %22 + %x_92 = OpVariable %_ptr_Function_int Function %22 + %x_92_phi = OpVariable %_ptr_Function_int Function %22 + %x_124_phi = OpVariable %_ptr_Function_int Function %22 + %x_152_phi = OpVariable %_ptr_Function_bool Function %27 + %x_150 = OpVariable %_ptr_Function_int Function %22 + %x_142 = OpVariable %_ptr_Function_int Function %22 + %x_125 = OpVariable %_ptr_Function_int Function %22 + %x_125_phi = OpVariable %_ptr_Function_int Function %22 + %x_157_phi = OpVariable %_ptr_Function_int Function %22 + %x_185_phi = OpVariable %_ptr_Function_bool Function %27 + %x_183 = OpVariable %_ptr_Function_int Function %22 + %x_175 = OpVariable %_ptr_Function_int Function %22 + %x_158 = OpVariable %_ptr_Function_int Function %22 + %x_158_phi = OpVariable %_ptr_Function_int Function %22 + %x_190_phi = OpVariable %_ptr_Function_int Function %22 + %x_218_phi = OpVariable %_ptr_Function_bool Function %27 + %x_216 = OpVariable %_ptr_Function_int Function %22 + %x_208 = OpVariable %_ptr_Function_int Function %22 + %x_191 = OpVariable %_ptr_Function_int Function %22 + %x_191_phi = OpVariable %_ptr_Function_int Function %22 + %x_223_phi = OpVariable %_ptr_Function_int Function %22 + %x_251_phi = OpVariable %_ptr_Function_bool Function %27 + %x_249 = OpVariable %_ptr_Function_int Function %22 + %x_241 = OpVariable %_ptr_Function_int Function %22 + %x_224 = OpVariable %_ptr_Function_int Function %22 + %x_224_phi = OpVariable %_ptr_Function_int Function %22 + %x_256_phi = OpVariable %_ptr_Function_int Function %22 + %x_284_phi = OpVariable %_ptr_Function_bool Function %27 + %x_282 = OpVariable %_ptr_Function_int Function %22 + %x_274 = OpVariable %_ptr_Function_int Function %22 + %x_257 = OpVariable %_ptr_Function_int Function %22 + %x_257_phi = OpVariable %_ptr_Function_int Function %22 + %x_289_phi = OpVariable %_ptr_Function_int Function %22 + %x_317_phi = OpVariable %_ptr_Function_bool Function %27 + %x_315 = OpVariable %_ptr_Function_int Function %22 + %x_307 = OpVariable %_ptr_Function_int Function %22 + %x_290 = OpVariable %_ptr_Function_int Function %22 + %x_290_phi = OpVariable %_ptr_Function_int Function %22 + %x_322_phi = OpVariable %_ptr_Function_int Function %22 + %x_350_phi = OpVariable %_ptr_Function_bool Function %27 + %x_348 = OpVariable %_ptr_Function_int Function %22 + %x_340 = OpVariable %_ptr_Function_int Function %22 + %x_323 = OpVariable %_ptr_Function_int Function %22 + %x_323_phi = OpVariable %_ptr_Function_int Function %22 + %x_381 = OpVariable %_ptr_Function_int Function %22 + %x_391 = OpVariable %_ptr_Function_int Function %22 + %x_396 = OpVariable %_ptr_Function_int Function %22 + %x_359 = OpVariable %_ptr_Function_int Function %22 + %x_354_phi = OpVariable %_ptr_Function_int Function %22 + %x_357_phi = OpVariable %_ptr_Function_int Function %22 + %x_366_phi = OpVariable %_ptr_Function_int Function %22 + %x_381_phi = OpVariable %_ptr_Function_int Function %22 + %x_382_phi = OpVariable %_ptr_Function_bool Function %27 + %x_354 = OpVariable %_ptr_Function_int Function %22 + %x_390 = OpVariable %_ptr_Function_int Function %22 + %x_395 = OpVariable %_ptr_Function_int Function %22 + %x_391_phi = OpVariable %_ptr_Function_int Function %22 + %x_396_phi = OpVariable %_ptr_Function_int Function %22 + %33 = OpAccessChain %_ptr_Function_BST %tree %int_0 + OpStore %33 %36 + OpSelectionMerge %37 None + OpSwitch %uint_0 %39 + %39 = OpLabel + OpStore %x_58_phi %int_0 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %48 = OpLoad %int %x_58_phi + OpStore %x_86_phi %false + %51 = OpSLessThanEqual %bool %48 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %41 + %52 = OpLabel + %55 = OpAccessChain %_ptr_Function_int %tree %48 %uint_0 + %56 = OpLoad %int %55 + %58 = OpSLessThanEqual %bool %int_5 %56 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + %63 = OpAccessChain %_ptr_Function_int %tree %48 %uint_1 + %64 = OpLoad %int %63 + %65 = OpIEqual %bool %64 %int_n1 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %67 = OpLabel + %69 = OpAccessChain %_ptr_Function_int %tree %48 %uint_1 + OpStore %69 %int_1 + %70 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %70 %71 + OpStore %x_86_phi %true + OpBranch %41 + %68 = OpLabel + %73 = OpAccessChain %_ptr_Function_int %tree %48 %uint_1 + %74 = OpLoad %int %73 + OpStore %x_84 %74 + %75 = OpLoad %int %x_84 + OpStore %x_59_phi %75 + OpBranch %42 + %66 = OpLabel + OpReturn + %61 = OpLabel + %77 = OpAccessChain %_ptr_Function_int %tree %48 %uint_2 + %78 = OpLoad %int %77 + %79 = OpIEqual %bool %78 %int_n1 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + %83 = OpAccessChain %_ptr_Function_int %tree %48 %uint_2 + OpStore %83 %int_1 + %84 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %84 %71 + OpStore %x_86_phi %true + OpBranch %41 + %82 = OpLabel + %85 = OpAccessChain %_ptr_Function_int %tree %48 %uint_2 + %86 = OpLoad %int %85 + OpStore %x_76 %86 + %87 = OpLoad %int %x_76 + OpStore %x_59_phi %87 + OpBranch %42 + %80 = OpLabel + OpReturn + %59 = OpLabel + OpReturn + %42 = OpLabel + %88 = OpLoad %int %x_59_phi + OpStore %x_59 %88 + %89 = OpLoad %int %x_59 + OpStore %x_58_phi %89 + OpBranch %40 + %41 = OpLabel + %90 = OpLoad %bool %x_86_phi + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + OpBranch %37 + %91 = OpLabel + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %95 None + OpSwitch %uint_0 %96 + %96 = OpLabel + OpStore %x_91_phi %int_0 + OpBranch %97 + %97 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %105 = OpLoad %int %x_91_phi + OpStore %x_119_phi %false + %107 = OpSLessThanEqual %bool %105 %int_2 + OpSelectionMerge %108 None + OpBranchConditional %107 %109 %110 + %109 = OpLabel + OpBranch %108 + %110 = OpLabel + OpBranch %98 + %108 = OpLabel + %111 = OpAccessChain %_ptr_Function_int %tree %105 %uint_0 + %112 = OpLoad %int %111 + %114 = OpSLessThanEqual %bool %int_12 %112 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %117 + %116 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %tree %105 %uint_1 + %119 = OpLoad %int %118 + %120 = OpIEqual %bool %119 %int_n1 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + %124 = OpAccessChain %_ptr_Function_int %tree %105 %uint_1 + OpStore %124 %int_2 + %125 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %125 %126 + OpStore %x_119_phi %true + OpBranch %98 + %123 = OpLabel + %127 = OpAccessChain %_ptr_Function_int %tree %105 %uint_1 + %128 = OpLoad %int %127 + OpStore %x_117 %128 + %129 = OpLoad %int %x_117 + OpStore %x_92_phi %129 + OpBranch %99 + %121 = OpLabel + OpReturn + %117 = OpLabel + %130 = OpAccessChain %_ptr_Function_int %tree %105 %uint_2 + %131 = OpLoad %int %130 + %132 = OpIEqual %bool %131 %int_n1 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %135 + %134 = OpLabel + %136 = OpAccessChain %_ptr_Function_int %tree %105 %uint_2 + OpStore %136 %int_2 + %137 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %137 %126 + OpStore %x_119_phi %true + OpBranch %98 + %135 = OpLabel + %138 = OpAccessChain %_ptr_Function_int %tree %105 %uint_2 + %139 = OpLoad %int %138 + OpStore %x_109 %139 + %140 = OpLoad %int %x_109 + OpStore %x_92_phi %140 + OpBranch %99 + %133 = OpLabel + OpReturn + %115 = OpLabel + OpReturn + %99 = OpLabel + %141 = OpLoad %int %x_92_phi + OpStore %x_92 %141 + %142 = OpLoad %int %x_92 + OpStore %x_91_phi %142 + OpBranch %97 + %98 = OpLabel + %143 = OpLoad %bool %x_119_phi + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %144 + %145 = OpLabel + OpBranch %95 + %144 = OpLabel + OpBranch %95 + %95 = OpLabel + OpSelectionMerge %148 None + OpSwitch %uint_0 %149 + %149 = OpLabel + OpStore %x_124_phi %int_0 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %158 = OpLoad %int %x_124_phi + OpStore %x_152_phi %false + %160 = OpSLessThanEqual %bool %158 %int_3 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + OpBranch %161 + %163 = OpLabel + OpBranch %151 + %161 = OpLabel + %164 = OpAccessChain %_ptr_Function_int %tree %158 %uint_0 + %165 = OpLoad %int %164 + %167 = OpSLessThanEqual %bool %int_15 %165 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + %171 = OpAccessChain %_ptr_Function_int %tree %158 %uint_1 + %172 = OpLoad %int %171 + %173 = OpIEqual %bool %172 %int_n1 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %176 + %175 = OpLabel + %177 = OpAccessChain %_ptr_Function_int %tree %158 %uint_1 + OpStore %177 %int_3 + %178 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %178 %179 + OpStore %x_152_phi %true + OpBranch %151 + %176 = OpLabel + %180 = OpAccessChain %_ptr_Function_int %tree %158 %uint_1 + %181 = OpLoad %int %180 + OpStore %x_150 %181 + %182 = OpLoad %int %x_150 + OpStore %x_125_phi %182 + OpBranch %152 + %174 = OpLabel + OpReturn + %170 = OpLabel + %183 = OpAccessChain %_ptr_Function_int %tree %158 %uint_2 + %184 = OpLoad %int %183 + %185 = OpIEqual %bool %184 %int_n1 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + %189 = OpAccessChain %_ptr_Function_int %tree %158 %uint_2 + OpStore %189 %int_3 + %190 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %190 %179 + OpStore %x_152_phi %true + OpBranch %151 + %188 = OpLabel + %191 = OpAccessChain %_ptr_Function_int %tree %158 %uint_2 + %192 = OpLoad %int %191 + OpStore %x_142 %192 + %193 = OpLoad %int %x_142 + OpStore %x_125_phi %193 + OpBranch %152 + %186 = OpLabel + OpReturn + %168 = OpLabel + OpReturn + %152 = OpLabel + %194 = OpLoad %int %x_125_phi + OpStore %x_125 %194 + %195 = OpLoad %int %x_125 + OpStore %x_124_phi %195 + OpBranch %150 + %151 = OpLabel + %196 = OpLoad %bool %x_152_phi + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %197 + %198 = OpLabel + OpBranch %148 + %197 = OpLabel + OpBranch %148 + %148 = OpLabel + OpSelectionMerge %201 None + OpSwitch %uint_0 %202 + %202 = OpLabel + OpStore %x_157_phi %int_0 + OpBranch %203 + %203 = OpLabel + OpLoopMerge %204 %205 None + OpBranch %206 + %206 = OpLabel + %211 = OpLoad %int %x_157_phi + OpStore %x_185_phi %false + %213 = OpSLessThanEqual %bool %211 %int_4 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %204 + %214 = OpLabel + %217 = OpAccessChain %_ptr_Function_int %tree %211 %uint_0 + %218 = OpLoad %int %217 + %220 = OpSLessThanEqual %bool %int_7 %218 + OpSelectionMerge %221 None + OpBranchConditional %220 %222 %223 + %222 = OpLabel + %224 = OpAccessChain %_ptr_Function_int %tree %211 %uint_1 + %225 = OpLoad %int %224 + %226 = OpIEqual %bool %225 %int_n1 + OpSelectionMerge %227 None + OpBranchConditional %226 %228 %229 + %228 = OpLabel + %230 = OpAccessChain %_ptr_Function_int %tree %211 %uint_1 + OpStore %230 %int_4 + %231 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %231 %232 + OpStore %x_185_phi %true + OpBranch %204 + %229 = OpLabel + %233 = OpAccessChain %_ptr_Function_int %tree %211 %uint_1 + %234 = OpLoad %int %233 + OpStore %x_183 %234 + %235 = OpLoad %int %x_183 + OpStore %x_158_phi %235 + OpBranch %205 + %227 = OpLabel + OpReturn + %223 = OpLabel + %236 = OpAccessChain %_ptr_Function_int %tree %211 %uint_2 + %237 = OpLoad %int %236 + %238 = OpIEqual %bool %237 %int_n1 + OpSelectionMerge %239 None + OpBranchConditional %238 %240 %241 + %240 = OpLabel + %242 = OpAccessChain %_ptr_Function_int %tree %211 %uint_2 + OpStore %242 %int_4 + %243 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %243 %232 + OpStore %x_185_phi %true + OpBranch %204 + %241 = OpLabel + %244 = OpAccessChain %_ptr_Function_int %tree %211 %uint_2 + %245 = OpLoad %int %244 + OpStore %x_175 %245 + %246 = OpLoad %int %x_175 + OpStore %x_158_phi %246 + OpBranch %205 + %239 = OpLabel + OpReturn + %221 = OpLabel + OpReturn + %205 = OpLabel + %247 = OpLoad %int %x_158_phi + OpStore %x_158 %247 + %248 = OpLoad %int %x_158 + OpStore %x_157_phi %248 + OpBranch %203 + %204 = OpLabel + %249 = OpLoad %bool %x_185_phi + OpSelectionMerge %250 None + OpBranchConditional %249 %251 %250 + %251 = OpLabel + OpBranch %201 + %250 = OpLabel + OpBranch %201 + %201 = OpLabel + OpSelectionMerge %254 None + OpSwitch %uint_0 %255 + %255 = OpLabel + OpStore %x_190_phi %int_0 + OpBranch %256 + %256 = OpLabel + OpLoopMerge %257 %258 None + OpBranch %259 + %259 = OpLabel + %264 = OpLoad %int %x_190_phi + OpStore %x_218_phi %false + %265 = OpSLessThanEqual %bool %264 %int_5 + OpSelectionMerge %266 None + OpBranchConditional %265 %267 %268 + %267 = OpLabel + OpBranch %266 + %268 = OpLabel + OpBranch %257 + %266 = OpLabel + %269 = OpAccessChain %_ptr_Function_int %tree %264 %uint_0 + %270 = OpLoad %int %269 + %272 = OpSLessThanEqual %bool %int_8 %270 + OpSelectionMerge %273 None + OpBranchConditional %272 %274 %275 + %274 = OpLabel + %276 = OpAccessChain %_ptr_Function_int %tree %264 %uint_1 + %277 = OpLoad %int %276 + %278 = OpIEqual %bool %277 %int_n1 + OpSelectionMerge %279 None + OpBranchConditional %278 %280 %281 + %280 = OpLabel + %282 = OpAccessChain %_ptr_Function_int %tree %264 %uint_1 + OpStore %282 %int_5 + %283 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %283 %284 + OpStore %x_218_phi %true + OpBranch %257 + %281 = OpLabel + %285 = OpAccessChain %_ptr_Function_int %tree %264 %uint_1 + %286 = OpLoad %int %285 + OpStore %x_216 %286 + %287 = OpLoad %int %x_216 + OpStore %x_191_phi %287 + OpBranch %258 + %279 = OpLabel + OpReturn + %275 = OpLabel + %288 = OpAccessChain %_ptr_Function_int %tree %264 %uint_2 + %289 = OpLoad %int %288 + %290 = OpIEqual %bool %289 %int_n1 + OpSelectionMerge %291 None + OpBranchConditional %290 %292 %293 + %292 = OpLabel + %294 = OpAccessChain %_ptr_Function_int %tree %264 %uint_2 + OpStore %294 %int_5 + %295 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %295 %284 + OpStore %x_218_phi %true + OpBranch %257 + %293 = OpLabel + %296 = OpAccessChain %_ptr_Function_int %tree %264 %uint_2 + %297 = OpLoad %int %296 + OpStore %x_208 %297 + %298 = OpLoad %int %x_208 + OpStore %x_191_phi %298 + OpBranch %258 + %291 = OpLabel + OpReturn + %273 = OpLabel + OpReturn + %258 = OpLabel + %299 = OpLoad %int %x_191_phi + OpStore %x_191 %299 + %300 = OpLoad %int %x_191 + OpStore %x_190_phi %300 + OpBranch %256 + %257 = OpLabel + %301 = OpLoad %bool %x_218_phi + OpSelectionMerge %302 None + OpBranchConditional %301 %303 %302 + %303 = OpLabel + OpBranch %254 + %302 = OpLabel + OpBranch %254 + %254 = OpLabel + OpSelectionMerge %306 None + OpSwitch %uint_0 %307 + %307 = OpLabel + OpStore %x_223_phi %int_0 + OpBranch %308 + %308 = OpLabel + OpLoopMerge %309 %310 None + OpBranch %311 + %311 = OpLabel + %316 = OpLoad %int %x_223_phi + OpStore %x_251_phi %false + %318 = OpSLessThanEqual %bool %316 %int_6 + OpSelectionMerge %319 None + OpBranchConditional %318 %320 %321 + %320 = OpLabel + OpBranch %319 + %321 = OpLabel + OpBranch %309 + %319 = OpLabel + %322 = OpAccessChain %_ptr_Function_int %tree %316 %uint_0 + %323 = OpLoad %int %322 + %324 = OpSLessThanEqual %bool %int_2 %323 + OpSelectionMerge %325 None + OpBranchConditional %324 %326 %327 + %326 = OpLabel + %328 = OpAccessChain %_ptr_Function_int %tree %316 %uint_1 + %329 = OpLoad %int %328 + %330 = OpIEqual %bool %329 %int_n1 + OpSelectionMerge %331 None + OpBranchConditional %330 %332 %333 + %332 = OpLabel + %334 = OpAccessChain %_ptr_Function_int %tree %316 %uint_1 + OpStore %334 %int_6 + %335 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %335 %336 + OpStore %x_251_phi %true + OpBranch %309 + %333 = OpLabel + %337 = OpAccessChain %_ptr_Function_int %tree %316 %uint_1 + %338 = OpLoad %int %337 + OpStore %x_249 %338 + %339 = OpLoad %int %x_249 + OpStore %x_224_phi %339 + OpBranch %310 + %331 = OpLabel + OpReturn + %327 = OpLabel + %340 = OpAccessChain %_ptr_Function_int %tree %316 %uint_2 + %341 = OpLoad %int %340 + %342 = OpIEqual %bool %341 %int_n1 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %345 + %344 = OpLabel + %346 = OpAccessChain %_ptr_Function_int %tree %316 %uint_2 + OpStore %346 %int_6 + %347 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %347 %336 + OpStore %x_251_phi %true + OpBranch %309 + %345 = OpLabel + %348 = OpAccessChain %_ptr_Function_int %tree %316 %uint_2 + %349 = OpLoad %int %348 + OpStore %x_241 %349 + %350 = OpLoad %int %x_241 + OpStore %x_224_phi %350 + OpBranch %310 + %343 = OpLabel + OpReturn + %325 = OpLabel + OpReturn + %310 = OpLabel + %351 = OpLoad %int %x_224_phi + OpStore %x_224 %351 + %352 = OpLoad %int %x_224 + OpStore %x_223_phi %352 + OpBranch %308 + %309 = OpLabel + %353 = OpLoad %bool %x_251_phi + OpSelectionMerge %354 None + OpBranchConditional %353 %355 %354 + %355 = OpLabel + OpBranch %306 + %354 = OpLabel + OpBranch %306 + %306 = OpLabel + OpSelectionMerge %358 None + OpSwitch %uint_0 %359 + %359 = OpLabel + OpStore %x_256_phi %int_0 + OpBranch %360 + %360 = OpLabel + OpLoopMerge %361 %362 None + OpBranch %363 + %363 = OpLabel + %368 = OpLoad %int %x_256_phi + OpStore %x_284_phi %false + %369 = OpSLessThanEqual %bool %368 %int_7 + OpSelectionMerge %370 None + OpBranchConditional %369 %371 %372 + %371 = OpLabel + OpBranch %370 + %372 = OpLabel + OpBranch %361 + %370 = OpLabel + %373 = OpAccessChain %_ptr_Function_int %tree %368 %uint_0 + %374 = OpLoad %int %373 + %375 = OpSLessThanEqual %bool %int_6 %374 + OpSelectionMerge %376 None + OpBranchConditional %375 %377 %378 + %377 = OpLabel + %379 = OpAccessChain %_ptr_Function_int %tree %368 %uint_1 + %380 = OpLoad %int %379 + %381 = OpIEqual %bool %380 %int_n1 + OpSelectionMerge %382 None + OpBranchConditional %381 %383 %384 + %383 = OpLabel + %385 = OpAccessChain %_ptr_Function_int %tree %368 %uint_1 + OpStore %385 %int_7 + %386 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %386 %387 + OpStore %x_284_phi %true + OpBranch %361 + %384 = OpLabel + %388 = OpAccessChain %_ptr_Function_int %tree %368 %uint_1 + %389 = OpLoad %int %388 + OpStore %x_282 %389 + %390 = OpLoad %int %x_282 + OpStore %x_257_phi %390 + OpBranch %362 + %382 = OpLabel + OpReturn + %378 = OpLabel + %391 = OpAccessChain %_ptr_Function_int %tree %368 %uint_2 + %392 = OpLoad %int %391 + %393 = OpIEqual %bool %392 %int_n1 + OpSelectionMerge %394 None + OpBranchConditional %393 %395 %396 + %395 = OpLabel + %397 = OpAccessChain %_ptr_Function_int %tree %368 %uint_2 + OpStore %397 %int_7 + %398 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %398 %387 + OpStore %x_284_phi %true + OpBranch %361 + %396 = OpLabel + %399 = OpAccessChain %_ptr_Function_int %tree %368 %uint_2 + %400 = OpLoad %int %399 + OpStore %x_274 %400 + %401 = OpLoad %int %x_274 + OpStore %x_257_phi %401 + OpBranch %362 + %394 = OpLabel + OpReturn + %376 = OpLabel + OpReturn + %362 = OpLabel + %402 = OpLoad %int %x_257_phi + OpStore %x_257 %402 + %403 = OpLoad %int %x_257 + OpStore %x_256_phi %403 + OpBranch %360 + %361 = OpLabel + %404 = OpLoad %bool %x_284_phi + OpSelectionMerge %405 None + OpBranchConditional %404 %406 %405 + %406 = OpLabel + OpBranch %358 + %405 = OpLabel + OpBranch %358 + %358 = OpLabel + OpSelectionMerge %409 None + OpSwitch %uint_0 %410 + %410 = OpLabel + OpStore %x_289_phi %int_0 + OpBranch %411 + %411 = OpLabel + OpLoopMerge %412 %413 None + OpBranch %414 + %414 = OpLabel + %419 = OpLoad %int %x_289_phi + OpStore %x_317_phi %false + %420 = OpSLessThanEqual %bool %419 %int_8 + OpSelectionMerge %421 None + OpBranchConditional %420 %422 %423 + %422 = OpLabel + OpBranch %421 + %423 = OpLabel + OpBranch %412 + %421 = OpLabel + %424 = OpAccessChain %_ptr_Function_int %tree %419 %uint_0 + %425 = OpLoad %int %424 + %427 = OpSLessThanEqual %bool %int_17 %425 + OpSelectionMerge %428 None + OpBranchConditional %427 %429 %430 + %429 = OpLabel + %431 = OpAccessChain %_ptr_Function_int %tree %419 %uint_1 + %432 = OpLoad %int %431 + %433 = OpIEqual %bool %432 %int_n1 + OpSelectionMerge %434 None + OpBranchConditional %433 %435 %436 + %435 = OpLabel + %437 = OpAccessChain %_ptr_Function_int %tree %419 %uint_1 + OpStore %437 %int_8 + %438 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %438 %439 + OpStore %x_317_phi %true + OpBranch %412 + %436 = OpLabel + %440 = OpAccessChain %_ptr_Function_int %tree %419 %uint_1 + %441 = OpLoad %int %440 + OpStore %x_315 %441 + %442 = OpLoad %int %x_315 + OpStore %x_290_phi %442 + OpBranch %413 + %434 = OpLabel + OpReturn + %430 = OpLabel + %443 = OpAccessChain %_ptr_Function_int %tree %419 %uint_2 + %444 = OpLoad %int %443 + %445 = OpIEqual %bool %444 %int_n1 + OpSelectionMerge %446 None + OpBranchConditional %445 %447 %448 + %447 = OpLabel + %449 = OpAccessChain %_ptr_Function_int %tree %419 %uint_2 + OpStore %449 %int_8 + %450 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %450 %439 + OpStore %x_317_phi %true + OpBranch %412 + %448 = OpLabel + %451 = OpAccessChain %_ptr_Function_int %tree %419 %uint_2 + %452 = OpLoad %int %451 + OpStore %x_307 %452 + %453 = OpLoad %int %x_307 + OpStore %x_290_phi %453 + OpBranch %413 + %446 = OpLabel + OpReturn + %428 = OpLabel + OpReturn + %413 = OpLabel + %454 = OpLoad %int %x_290_phi + OpStore %x_290 %454 + %455 = OpLoad %int %x_290 + OpStore %x_289_phi %455 + OpBranch %411 + %412 = OpLabel + %456 = OpLoad %bool %x_317_phi + OpSelectionMerge %457 None + OpBranchConditional %456 %458 %457 + %458 = OpLabel + OpBranch %409 + %457 = OpLabel + OpBranch %409 + %409 = OpLabel + OpSelectionMerge %461 None + OpSwitch %uint_0 %462 + %462 = OpLabel + OpStore %x_322_phi %int_0 + OpBranch %463 + %463 = OpLabel + OpLoopMerge %464 %465 None + OpBranch %466 + %466 = OpLabel + %471 = OpLoad %int %x_322_phi + OpStore %x_350_phi %false + %472 = OpSLessThanEqual %bool %471 %int_9 + OpSelectionMerge %473 None + OpBranchConditional %472 %474 %475 + %474 = OpLabel + OpBranch %473 + %475 = OpLabel + OpBranch %464 + %473 = OpLabel + %476 = OpAccessChain %_ptr_Function_int %tree %471 %uint_0 + %477 = OpLoad %int %476 + %479 = OpSLessThanEqual %bool %int_13 %477 + OpSelectionMerge %480 None + OpBranchConditional %479 %481 %482 + %481 = OpLabel + %483 = OpAccessChain %_ptr_Function_int %tree %471 %uint_1 + %484 = OpLoad %int %483 + %485 = OpIEqual %bool %484 %int_n1 + OpSelectionMerge %486 None + OpBranchConditional %485 %487 %488 + %487 = OpLabel + %489 = OpAccessChain %_ptr_Function_int %tree %471 %uint_1 + OpStore %489 %int_9 + %490 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %490 %491 + OpStore %x_350_phi %true + OpBranch %464 + %488 = OpLabel + %492 = OpAccessChain %_ptr_Function_int %tree %471 %uint_1 + %493 = OpLoad %int %492 + OpStore %x_348 %493 + %494 = OpLoad %int %x_348 + OpStore %x_323_phi %494 + OpBranch %465 + %486 = OpLabel + OpReturn + %482 = OpLabel + %495 = OpAccessChain %_ptr_Function_int %tree %471 %uint_2 + %496 = OpLoad %int %495 + %497 = OpIEqual %bool %496 %int_n1 + OpSelectionMerge %498 None + OpBranchConditional %497 %499 %500 + %499 = OpLabel + %501 = OpAccessChain %_ptr_Function_int %tree %471 %uint_2 + OpStore %501 %int_9 + %502 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %502 %491 + OpStore %x_350_phi %true + OpBranch %464 + %500 = OpLabel + %503 = OpAccessChain %_ptr_Function_int %tree %471 %uint_2 + %504 = OpLoad %int %503 + OpStore %x_340 %504 + %505 = OpLoad %int %x_340 + OpStore %x_323_phi %505 + OpBranch %465 + %498 = OpLabel + OpReturn + %480 = OpLabel + OpReturn + %465 = OpLabel + %506 = OpLoad %int %x_323_phi + OpStore %x_323 %506 + %507 = OpLoad %int %x_323 + OpStore %x_322_phi %507 + OpBranch %463 + %464 = OpLabel + %508 = OpLoad %bool %x_350_phi + OpSelectionMerge %509 None + OpBranchConditional %508 %510 %509 + %510 = OpLabel + OpBranch %461 + %509 = OpLabel + OpBranch %461 + %461 = OpLabel + OpStore %x_353_phi %int_0 + OpStore %x_356_phi %int_0 + OpStore %x_358_phi %int_0 + OpBranch %511 + %511 = OpLabel + OpLoopMerge %512 %513 None + OpBranch %514 + %514 = OpLabel + %521 = OpLoad %int %x_353_phi + %522 = OpLoad %int %x_356_phi + OpStore %x_356 %522 + %523 = OpLoad %int %x_358_phi + %525 = OpSLessThan %bool %523 %int_20 + OpSelectionMerge %526 None + OpBranchConditional %525 %527 %528 + %527 = OpLabel + OpBranch %526 + %528 = OpLabel + OpBranch %512 + %526 = OpLabel + OpSelectionMerge %532 None + OpSwitch %uint_0 %533 + %533 = OpLabel + OpStore %x_366_phi %int_0 + OpBranch %534 + %534 = OpLabel + OpLoopMerge %535 %536 None + OpBranch %537 + %537 = OpLabel + %538 = OpLoad %int %x_366_phi + OpStore %x_381_phi %521 + OpStore %x_382_phi %false + %539 = OpINotEqual %bool %538 %int_n1 + OpSelectionMerge %540 None + OpBranchConditional %539 %541 %542 + %541 = OpLabel + OpBranch %540 + %542 = OpLabel + OpBranch %535 + %540 = OpLabel + %543 = OpAccessChain %_ptr_Function_BST %tree %538 + %544 = OpLoad %BST %543 + %545 = OpCompositeExtract %int %544 0 + %546 = OpCompositeExtract %int %544 1 + %547 = OpCompositeExtract %int %544 2 + %548 = OpIEqual %bool %545 %523 + OpSelectionMerge %549 None + OpBranchConditional %548 %550 %549 + %550 = OpLabel + OpStore %x_381_phi %523 + OpStore %x_382_phi %true + OpBranch %535 + %549 = OpLabel + OpBranch %536 + %536 = OpLabel + %552 = OpSGreaterThan %bool %523 %545 + %551 = OpSelect %int %552 %547 %546 + OpStore %x_366_phi %551 + OpBranch %534 + %535 = OpLabel + %553 = OpLoad %int %x_381_phi + OpStore %x_381 %553 + %554 = OpLoad %bool %x_382_phi + %555 = OpLoad %int %x_381 + OpStore %x_354_phi %555 + OpSelectionMerge %556 None + OpBranchConditional %554 %557 %556 + %557 = OpLabel + OpBranch %532 + %556 = OpLabel + OpStore %x_354_phi %int_n1 + OpBranch %532 + %532 = OpLabel + %563 = OpLoad %int %x_354_phi + OpStore %x_354 %563 + OpSelectionMerge %564 None + OpSwitch %523 %565 2 %566 5 %566 6 %566 7 %566 8 %566 9 %566 12 %566 13 %566 15 %566 17 %566 + %566 = OpLabel + %567 = OpLoad %int %x_356 + OpStore %x_391_phi %567 + %568 = OpLoad %int %x_354 + %569 = OpCopyObject %int %523 + %570 = OpIEqual %bool %568 %569 + OpSelectionMerge %571 None + OpBranchConditional %570 %572 %571 + %572 = OpLabel + %574 = OpLoad %int %x_356 + %575 = OpCopyObject %int %int_1 + %576 = OpIAdd %int %574 %575 + %573 = OpCopyObject %int %576 + OpStore %x_390 %573 + %577 = OpLoad %int %x_390 + OpStore %x_391_phi %577 + OpBranch %571 + %571 = OpLabel + %578 = OpLoad %int %x_391_phi + OpStore %x_391 %578 + %579 = OpLoad %int %x_391 + OpStore %x_357_phi %579 + OpBranch %564 + %565 = OpLabel + %580 = OpLoad %int %x_356 + OpStore %x_396_phi %580 + %581 = OpLoad %int %x_354 + %582 = OpCopyObject %int %int_n1 + %583 = OpIEqual %bool %581 %582 + OpSelectionMerge %584 None + OpBranchConditional %583 %585 %584 + %585 = OpLabel + %587 = OpLoad %int %x_356 + %588 = OpCopyObject %int %int_1 + %589 = OpIAdd %int %587 %588 + %586 = OpCopyObject %int %589 + OpStore %x_395 %586 + %590 = OpLoad %int %x_395 + OpStore %x_396_phi %590 + OpBranch %584 + %584 = OpLabel + %591 = OpLoad %int %x_396_phi + OpStore %x_396 %591 + %592 = OpLoad %int %x_396 + OpStore %x_357_phi %592 + OpBranch %564 + %564 = OpLabel + %593 = OpLoad %int %x_357_phi + OpBranch %513 + %513 = OpLabel + %594 = OpIAdd %int %523 %int_1 + OpStore %x_359 %594 + %595 = OpLoad %int %x_354 + OpStore %x_353_phi %595 + OpStore %x_356_phi %593 + %596 = OpLoad %int %x_359 + OpStore %x_358_phi %596 + OpBranch %511 + %512 = OpLabel + %597 = OpLoad %int %x_356 + %598 = OpCopyObject %int %int_20 + %599 = OpIEqual %bool %597 %598 + OpSelectionMerge %600 None + OpBranchConditional %599 %601 %602 + %601 = OpLabel + OpStore %x_GLF_color %605 + OpBranch %600 + %602 = OpLabel + OpStore %x_GLF_color %606 + OpBranch %600 + %600 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %607 +%tint_symbol = OpFunctionParameter %main_out + %611 = OpLabel + %612 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %612 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %614 = OpLabel + %615 = OpFunctionCall %void %main_1 + %617 = OpLoad %v4float %x_GLF_color + %618 = OpCompositeConstruct %main_out %617 + %616 = OpFunctionCall %void %tint_symbol_2 %618 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..76d569eae2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.wgsl @@ -0,0 +1,653 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var x_GLF_color : vec4; + +fn main_1() { + var tree : array; + var x_356 : i32; + var x_58_phi : i32; + var x_86_phi : bool; + var x_353_phi : i32; + var x_356_phi : i32; + var x_358_phi : i32; + tree[0] = BST(9, -1, -1); + switch(0u) { + default: { + x_58_phi = 0; + loop { + var x_84 : i32; + var x_76 : i32; + var x_59 : i32; + var x_59_phi : i32; + let x_58 : i32 = x_58_phi; + x_86_phi = false; + if ((x_58 <= 1)) { + } else { + break; + } + let x_65 : i32 = tree[x_58].data; + if ((5 <= x_65)) { + let x_78 : ptr = &(tree[x_58].leftIndex); + let x_79 : i32 = *(x_78); + if ((x_79 == -1)) { + *(x_78) = 1; + tree[1] = BST(5, -1, -1); + x_86_phi = true; + break; + } else { + x_84 = *(x_78); + x_59_phi = x_84; + continue; + } + return; + } else { + let x_70 : ptr = &(tree[x_58].rightIndex); + let x_71 : i32 = *(x_70); + if ((x_71 == -1)) { + *(x_70) = 1; + tree[1] = BST(5, -1, -1); + x_86_phi = true; + break; + } else { + x_76 = *(x_70); + x_59_phi = x_76; + continue; + } + return; + } + return; + + continuing { + x_59 = x_59_phi; + x_58_phi = x_59; + } + } + let x_86 : bool = x_86_phi; + if (x_86) { + break; + } + } + } + var x_91_phi : i32; + var x_119_phi : bool; + switch(0u) { + default: { + x_91_phi = 0; + loop { + var x_117 : i32; + var x_109 : i32; + var x_92 : i32; + var x_92_phi : i32; + let x_91 : i32 = x_91_phi; + x_119_phi = false; + if ((x_91 <= 2)) { + } else { + break; + } + let x_98 : i32 = tree[x_91].data; + if ((12 <= x_98)) { + let x_111 : ptr = &(tree[x_91].leftIndex); + let x_112 : i32 = *(x_111); + if ((x_112 == -1)) { + *(x_111) = 2; + tree[2] = BST(12, -1, -1); + x_119_phi = true; + break; + } else { + x_117 = *(x_111); + x_92_phi = x_117; + continue; + } + return; + } else { + let x_103 : ptr = &(tree[x_91].rightIndex); + let x_104 : i32 = *(x_103); + if ((x_104 == -1)) { + *(x_103) = 2; + tree[2] = BST(12, -1, -1); + x_119_phi = true; + break; + } else { + x_109 = *(x_103); + x_92_phi = x_109; + continue; + } + return; + } + return; + + continuing { + x_92 = x_92_phi; + x_91_phi = x_92; + } + } + let x_119 : bool = x_119_phi; + if (x_119) { + break; + } + } + } + var x_124_phi : i32; + var x_152_phi : bool; + switch(0u) { + default: { + x_124_phi = 0; + loop { + var x_150 : i32; + var x_142 : i32; + var x_125 : i32; + var x_125_phi : i32; + let x_124 : i32 = x_124_phi; + x_152_phi = false; + if ((x_124 <= 3)) { + } else { + break; + } + let x_131 : i32 = tree[x_124].data; + if ((15 <= x_131)) { + let x_144 : ptr = &(tree[x_124].leftIndex); + let x_145 : i32 = *(x_144); + if ((x_145 == -1)) { + *(x_144) = 3; + tree[3] = BST(15, -1, -1); + x_152_phi = true; + break; + } else { + x_150 = *(x_144); + x_125_phi = x_150; + continue; + } + return; + } else { + let x_136 : ptr = &(tree[x_124].rightIndex); + let x_137 : i32 = *(x_136); + if ((x_137 == -1)) { + *(x_136) = 3; + tree[3] = BST(15, -1, -1); + x_152_phi = true; + break; + } else { + x_142 = *(x_136); + x_125_phi = x_142; + continue; + } + return; + } + return; + + continuing { + x_125 = x_125_phi; + x_124_phi = x_125; + } + } + let x_152 : bool = x_152_phi; + if (x_152) { + break; + } + } + } + var x_157_phi : i32; + var x_185_phi : bool; + switch(0u) { + default: { + x_157_phi = 0; + loop { + var x_183 : i32; + var x_175 : i32; + var x_158 : i32; + var x_158_phi : i32; + let x_157 : i32 = x_157_phi; + x_185_phi = false; + if ((x_157 <= 4)) { + } else { + break; + } + let x_164 : i32 = tree[x_157].data; + if ((7 <= x_164)) { + let x_177 : ptr = &(tree[x_157].leftIndex); + let x_178 : i32 = *(x_177); + if ((x_178 == -1)) { + *(x_177) = 4; + tree[4] = BST(7, -1, -1); + x_185_phi = true; + break; + } else { + x_183 = *(x_177); + x_158_phi = x_183; + continue; + } + return; + } else { + let x_169 : ptr = &(tree[x_157].rightIndex); + let x_170 : i32 = *(x_169); + if ((x_170 == -1)) { + *(x_169) = 4; + tree[4] = BST(7, -1, -1); + x_185_phi = true; + break; + } else { + x_175 = *(x_169); + x_158_phi = x_175; + continue; + } + return; + } + return; + + continuing { + x_158 = x_158_phi; + x_157_phi = x_158; + } + } + let x_185 : bool = x_185_phi; + if (x_185) { + break; + } + } + } + var x_190_phi : i32; + var x_218_phi : bool; + switch(0u) { + default: { + x_190_phi = 0; + loop { + var x_216 : i32; + var x_208 : i32; + var x_191 : i32; + var x_191_phi : i32; + let x_190 : i32 = x_190_phi; + x_218_phi = false; + if ((x_190 <= 5)) { + } else { + break; + } + let x_197 : i32 = tree[x_190].data; + if ((8 <= x_197)) { + let x_210 : ptr = &(tree[x_190].leftIndex); + let x_211 : i32 = *(x_210); + if ((x_211 == -1)) { + *(x_210) = 5; + tree[5] = BST(8, -1, -1); + x_218_phi = true; + break; + } else { + x_216 = *(x_210); + x_191_phi = x_216; + continue; + } + return; + } else { + let x_202 : ptr = &(tree[x_190].rightIndex); + let x_203 : i32 = *(x_202); + if ((x_203 == -1)) { + *(x_202) = 5; + tree[5] = BST(8, -1, -1); + x_218_phi = true; + break; + } else { + x_208 = *(x_202); + x_191_phi = x_208; + continue; + } + return; + } + return; + + continuing { + x_191 = x_191_phi; + x_190_phi = x_191; + } + } + let x_218 : bool = x_218_phi; + if (x_218) { + break; + } + } + } + var x_223_phi : i32; + var x_251_phi : bool; + switch(0u) { + default: { + x_223_phi = 0; + loop { + var x_249 : i32; + var x_241 : i32; + var x_224 : i32; + var x_224_phi : i32; + let x_223 : i32 = x_223_phi; + x_251_phi = false; + if ((x_223 <= 6)) { + } else { + break; + } + let x_230 : i32 = tree[x_223].data; + if ((2 <= x_230)) { + let x_243 : ptr = &(tree[x_223].leftIndex); + let x_244 : i32 = *(x_243); + if ((x_244 == -1)) { + *(x_243) = 6; + tree[6] = BST(2, -1, -1); + x_251_phi = true; + break; + } else { + x_249 = *(x_243); + x_224_phi = x_249; + continue; + } + return; + } else { + let x_235 : ptr = &(tree[x_223].rightIndex); + let x_236 : i32 = *(x_235); + if ((x_236 == -1)) { + *(x_235) = 6; + tree[6] = BST(2, -1, -1); + x_251_phi = true; + break; + } else { + x_241 = *(x_235); + x_224_phi = x_241; + continue; + } + return; + } + return; + + continuing { + x_224 = x_224_phi; + x_223_phi = x_224; + } + } + let x_251 : bool = x_251_phi; + if (x_251) { + break; + } + } + } + var x_256_phi : i32; + var x_284_phi : bool; + switch(0u) { + default: { + x_256_phi = 0; + loop { + var x_282 : i32; + var x_274 : i32; + var x_257 : i32; + var x_257_phi : i32; + let x_256 : i32 = x_256_phi; + x_284_phi = false; + if ((x_256 <= 7)) { + } else { + break; + } + let x_263 : i32 = tree[x_256].data; + if ((6 <= x_263)) { + let x_276 : ptr = &(tree[x_256].leftIndex); + let x_277 : i32 = *(x_276); + if ((x_277 == -1)) { + *(x_276) = 7; + tree[7] = BST(6, -1, -1); + x_284_phi = true; + break; + } else { + x_282 = *(x_276); + x_257_phi = x_282; + continue; + } + return; + } else { + let x_268 : ptr = &(tree[x_256].rightIndex); + let x_269 : i32 = *(x_268); + if ((x_269 == -1)) { + *(x_268) = 7; + tree[7] = BST(6, -1, -1); + x_284_phi = true; + break; + } else { + x_274 = *(x_268); + x_257_phi = x_274; + continue; + } + return; + } + return; + + continuing { + x_257 = x_257_phi; + x_256_phi = x_257; + } + } + let x_284 : bool = x_284_phi; + if (x_284) { + break; + } + } + } + var x_289_phi : i32; + var x_317_phi : bool; + switch(0u) { + default: { + x_289_phi = 0; + loop { + var x_315 : i32; + var x_307 : i32; + var x_290 : i32; + var x_290_phi : i32; + let x_289 : i32 = x_289_phi; + x_317_phi = false; + if ((x_289 <= 8)) { + } else { + break; + } + let x_296 : i32 = tree[x_289].data; + if ((17 <= x_296)) { + let x_309 : ptr = &(tree[x_289].leftIndex); + let x_310 : i32 = *(x_309); + if ((x_310 == -1)) { + *(x_309) = 8; + tree[8] = BST(17, -1, -1); + x_317_phi = true; + break; + } else { + x_315 = *(x_309); + x_290_phi = x_315; + continue; + } + return; + } else { + let x_301 : ptr = &(tree[x_289].rightIndex); + let x_302 : i32 = *(x_301); + if ((x_302 == -1)) { + *(x_301) = 8; + tree[8] = BST(17, -1, -1); + x_317_phi = true; + break; + } else { + x_307 = *(x_301); + x_290_phi = x_307; + continue; + } + return; + } + return; + + continuing { + x_290 = x_290_phi; + x_289_phi = x_290; + } + } + let x_317 : bool = x_317_phi; + if (x_317) { + break; + } + } + } + var x_322_phi : i32; + var x_350_phi : bool; + switch(0u) { + default: { + x_322_phi = 0; + loop { + var x_348 : i32; + var x_340 : i32; + var x_323 : i32; + var x_323_phi : i32; + let x_322 : i32 = x_322_phi; + x_350_phi = false; + if ((x_322 <= 9)) { + } else { + break; + } + let x_329 : i32 = tree[x_322].data; + if ((13 <= x_329)) { + let x_342 : ptr = &(tree[x_322].leftIndex); + let x_343 : i32 = *(x_342); + if ((x_343 == -1)) { + *(x_342) = 9; + tree[9] = BST(13, -1, -1); + x_350_phi = true; + break; + } else { + x_348 = *(x_342); + x_323_phi = x_348; + continue; + } + return; + } else { + let x_334 : ptr = &(tree[x_322].rightIndex); + let x_335 : i32 = *(x_334); + if ((x_335 == -1)) { + *(x_334) = 9; + tree[9] = BST(13, -1, -1); + x_350_phi = true; + break; + } else { + x_340 = *(x_334); + x_323_phi = x_340; + continue; + } + return; + } + return; + + continuing { + x_323 = x_323_phi; + x_322_phi = x_323; + } + } + let x_350 : bool = x_350_phi; + if (x_350) { + break; + } + } + } + x_353_phi = 0; + x_356_phi = 0; + x_358_phi = 0; + loop { + var x_381 : i32; + var x_391 : i32; + var x_396 : i32; + var x_359 : i32; + var x_354_phi : i32; + var x_357_phi : i32; + let x_353 : i32 = x_353_phi; + x_356 = x_356_phi; + let x_358 : i32 = x_358_phi; + if ((x_358 < 20)) { + } else { + break; + } + var x_366_phi : i32; + var x_381_phi : i32; + var x_382_phi : bool; + switch(0u) { + default: { + x_366_phi = 0; + loop { + let x_366 : i32 = x_366_phi; + x_381_phi = x_353; + x_382_phi = false; + if ((x_366 != -1)) { + } else { + break; + } + let x_373 : BST = tree[x_366]; + let x_374 : i32 = x_373.data; + let x_375 : i32 = x_373.leftIndex; + let x_376 : i32 = x_373.rightIndex; + if ((x_374 == x_358)) { + x_381_phi = x_358; + x_382_phi = true; + break; + } + + continuing { + x_366_phi = select(x_375, x_376, (x_358 > x_374)); + } + } + x_381 = x_381_phi; + let x_382 : bool = x_382_phi; + x_354_phi = x_381; + if (x_382) { + break; + } + x_354_phi = -1; + } + } + var x_354 : i32; + var x_390 : i32; + var x_395 : i32; + var x_391_phi : i32; + var x_396_phi : i32; + x_354 = x_354_phi; + switch(x_358) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + x_391_phi = x_356; + if ((x_354 == bitcast(x_358))) { + x_390 = bitcast((x_356 + bitcast(1))); + x_391_phi = x_390; + } + x_391 = x_391_phi; + x_357_phi = x_391; + } + default: { + x_396_phi = x_356; + if ((x_354 == bitcast(-1))) { + x_395 = bitcast((x_356 + bitcast(1))); + x_396_phi = x_395; + } + x_396 = x_396_phi; + x_357_phi = x_396; + } + } + let x_357 : i32 = x_357_phi; + + continuing { + x_359 = (x_358 + 1); + x_353_phi = x_354; + x_356_phi = x_357; + x_358_phi = x_359; + } + } + if ((x_356 == bitcast(20))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl new file mode 100644 index 0000000000..76d569eae2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl @@ -0,0 +1,653 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var x_GLF_color : vec4; + +fn main_1() { + var tree : array; + var x_356 : i32; + var x_58_phi : i32; + var x_86_phi : bool; + var x_353_phi : i32; + var x_356_phi : i32; + var x_358_phi : i32; + tree[0] = BST(9, -1, -1); + switch(0u) { + default: { + x_58_phi = 0; + loop { + var x_84 : i32; + var x_76 : i32; + var x_59 : i32; + var x_59_phi : i32; + let x_58 : i32 = x_58_phi; + x_86_phi = false; + if ((x_58 <= 1)) { + } else { + break; + } + let x_65 : i32 = tree[x_58].data; + if ((5 <= x_65)) { + let x_78 : ptr = &(tree[x_58].leftIndex); + let x_79 : i32 = *(x_78); + if ((x_79 == -1)) { + *(x_78) = 1; + tree[1] = BST(5, -1, -1); + x_86_phi = true; + break; + } else { + x_84 = *(x_78); + x_59_phi = x_84; + continue; + } + return; + } else { + let x_70 : ptr = &(tree[x_58].rightIndex); + let x_71 : i32 = *(x_70); + if ((x_71 == -1)) { + *(x_70) = 1; + tree[1] = BST(5, -1, -1); + x_86_phi = true; + break; + } else { + x_76 = *(x_70); + x_59_phi = x_76; + continue; + } + return; + } + return; + + continuing { + x_59 = x_59_phi; + x_58_phi = x_59; + } + } + let x_86 : bool = x_86_phi; + if (x_86) { + break; + } + } + } + var x_91_phi : i32; + var x_119_phi : bool; + switch(0u) { + default: { + x_91_phi = 0; + loop { + var x_117 : i32; + var x_109 : i32; + var x_92 : i32; + var x_92_phi : i32; + let x_91 : i32 = x_91_phi; + x_119_phi = false; + if ((x_91 <= 2)) { + } else { + break; + } + let x_98 : i32 = tree[x_91].data; + if ((12 <= x_98)) { + let x_111 : ptr = &(tree[x_91].leftIndex); + let x_112 : i32 = *(x_111); + if ((x_112 == -1)) { + *(x_111) = 2; + tree[2] = BST(12, -1, -1); + x_119_phi = true; + break; + } else { + x_117 = *(x_111); + x_92_phi = x_117; + continue; + } + return; + } else { + let x_103 : ptr = &(tree[x_91].rightIndex); + let x_104 : i32 = *(x_103); + if ((x_104 == -1)) { + *(x_103) = 2; + tree[2] = BST(12, -1, -1); + x_119_phi = true; + break; + } else { + x_109 = *(x_103); + x_92_phi = x_109; + continue; + } + return; + } + return; + + continuing { + x_92 = x_92_phi; + x_91_phi = x_92; + } + } + let x_119 : bool = x_119_phi; + if (x_119) { + break; + } + } + } + var x_124_phi : i32; + var x_152_phi : bool; + switch(0u) { + default: { + x_124_phi = 0; + loop { + var x_150 : i32; + var x_142 : i32; + var x_125 : i32; + var x_125_phi : i32; + let x_124 : i32 = x_124_phi; + x_152_phi = false; + if ((x_124 <= 3)) { + } else { + break; + } + let x_131 : i32 = tree[x_124].data; + if ((15 <= x_131)) { + let x_144 : ptr = &(tree[x_124].leftIndex); + let x_145 : i32 = *(x_144); + if ((x_145 == -1)) { + *(x_144) = 3; + tree[3] = BST(15, -1, -1); + x_152_phi = true; + break; + } else { + x_150 = *(x_144); + x_125_phi = x_150; + continue; + } + return; + } else { + let x_136 : ptr = &(tree[x_124].rightIndex); + let x_137 : i32 = *(x_136); + if ((x_137 == -1)) { + *(x_136) = 3; + tree[3] = BST(15, -1, -1); + x_152_phi = true; + break; + } else { + x_142 = *(x_136); + x_125_phi = x_142; + continue; + } + return; + } + return; + + continuing { + x_125 = x_125_phi; + x_124_phi = x_125; + } + } + let x_152 : bool = x_152_phi; + if (x_152) { + break; + } + } + } + var x_157_phi : i32; + var x_185_phi : bool; + switch(0u) { + default: { + x_157_phi = 0; + loop { + var x_183 : i32; + var x_175 : i32; + var x_158 : i32; + var x_158_phi : i32; + let x_157 : i32 = x_157_phi; + x_185_phi = false; + if ((x_157 <= 4)) { + } else { + break; + } + let x_164 : i32 = tree[x_157].data; + if ((7 <= x_164)) { + let x_177 : ptr = &(tree[x_157].leftIndex); + let x_178 : i32 = *(x_177); + if ((x_178 == -1)) { + *(x_177) = 4; + tree[4] = BST(7, -1, -1); + x_185_phi = true; + break; + } else { + x_183 = *(x_177); + x_158_phi = x_183; + continue; + } + return; + } else { + let x_169 : ptr = &(tree[x_157].rightIndex); + let x_170 : i32 = *(x_169); + if ((x_170 == -1)) { + *(x_169) = 4; + tree[4] = BST(7, -1, -1); + x_185_phi = true; + break; + } else { + x_175 = *(x_169); + x_158_phi = x_175; + continue; + } + return; + } + return; + + continuing { + x_158 = x_158_phi; + x_157_phi = x_158; + } + } + let x_185 : bool = x_185_phi; + if (x_185) { + break; + } + } + } + var x_190_phi : i32; + var x_218_phi : bool; + switch(0u) { + default: { + x_190_phi = 0; + loop { + var x_216 : i32; + var x_208 : i32; + var x_191 : i32; + var x_191_phi : i32; + let x_190 : i32 = x_190_phi; + x_218_phi = false; + if ((x_190 <= 5)) { + } else { + break; + } + let x_197 : i32 = tree[x_190].data; + if ((8 <= x_197)) { + let x_210 : ptr = &(tree[x_190].leftIndex); + let x_211 : i32 = *(x_210); + if ((x_211 == -1)) { + *(x_210) = 5; + tree[5] = BST(8, -1, -1); + x_218_phi = true; + break; + } else { + x_216 = *(x_210); + x_191_phi = x_216; + continue; + } + return; + } else { + let x_202 : ptr = &(tree[x_190].rightIndex); + let x_203 : i32 = *(x_202); + if ((x_203 == -1)) { + *(x_202) = 5; + tree[5] = BST(8, -1, -1); + x_218_phi = true; + break; + } else { + x_208 = *(x_202); + x_191_phi = x_208; + continue; + } + return; + } + return; + + continuing { + x_191 = x_191_phi; + x_190_phi = x_191; + } + } + let x_218 : bool = x_218_phi; + if (x_218) { + break; + } + } + } + var x_223_phi : i32; + var x_251_phi : bool; + switch(0u) { + default: { + x_223_phi = 0; + loop { + var x_249 : i32; + var x_241 : i32; + var x_224 : i32; + var x_224_phi : i32; + let x_223 : i32 = x_223_phi; + x_251_phi = false; + if ((x_223 <= 6)) { + } else { + break; + } + let x_230 : i32 = tree[x_223].data; + if ((2 <= x_230)) { + let x_243 : ptr = &(tree[x_223].leftIndex); + let x_244 : i32 = *(x_243); + if ((x_244 == -1)) { + *(x_243) = 6; + tree[6] = BST(2, -1, -1); + x_251_phi = true; + break; + } else { + x_249 = *(x_243); + x_224_phi = x_249; + continue; + } + return; + } else { + let x_235 : ptr = &(tree[x_223].rightIndex); + let x_236 : i32 = *(x_235); + if ((x_236 == -1)) { + *(x_235) = 6; + tree[6] = BST(2, -1, -1); + x_251_phi = true; + break; + } else { + x_241 = *(x_235); + x_224_phi = x_241; + continue; + } + return; + } + return; + + continuing { + x_224 = x_224_phi; + x_223_phi = x_224; + } + } + let x_251 : bool = x_251_phi; + if (x_251) { + break; + } + } + } + var x_256_phi : i32; + var x_284_phi : bool; + switch(0u) { + default: { + x_256_phi = 0; + loop { + var x_282 : i32; + var x_274 : i32; + var x_257 : i32; + var x_257_phi : i32; + let x_256 : i32 = x_256_phi; + x_284_phi = false; + if ((x_256 <= 7)) { + } else { + break; + } + let x_263 : i32 = tree[x_256].data; + if ((6 <= x_263)) { + let x_276 : ptr = &(tree[x_256].leftIndex); + let x_277 : i32 = *(x_276); + if ((x_277 == -1)) { + *(x_276) = 7; + tree[7] = BST(6, -1, -1); + x_284_phi = true; + break; + } else { + x_282 = *(x_276); + x_257_phi = x_282; + continue; + } + return; + } else { + let x_268 : ptr = &(tree[x_256].rightIndex); + let x_269 : i32 = *(x_268); + if ((x_269 == -1)) { + *(x_268) = 7; + tree[7] = BST(6, -1, -1); + x_284_phi = true; + break; + } else { + x_274 = *(x_268); + x_257_phi = x_274; + continue; + } + return; + } + return; + + continuing { + x_257 = x_257_phi; + x_256_phi = x_257; + } + } + let x_284 : bool = x_284_phi; + if (x_284) { + break; + } + } + } + var x_289_phi : i32; + var x_317_phi : bool; + switch(0u) { + default: { + x_289_phi = 0; + loop { + var x_315 : i32; + var x_307 : i32; + var x_290 : i32; + var x_290_phi : i32; + let x_289 : i32 = x_289_phi; + x_317_phi = false; + if ((x_289 <= 8)) { + } else { + break; + } + let x_296 : i32 = tree[x_289].data; + if ((17 <= x_296)) { + let x_309 : ptr = &(tree[x_289].leftIndex); + let x_310 : i32 = *(x_309); + if ((x_310 == -1)) { + *(x_309) = 8; + tree[8] = BST(17, -1, -1); + x_317_phi = true; + break; + } else { + x_315 = *(x_309); + x_290_phi = x_315; + continue; + } + return; + } else { + let x_301 : ptr = &(tree[x_289].rightIndex); + let x_302 : i32 = *(x_301); + if ((x_302 == -1)) { + *(x_301) = 8; + tree[8] = BST(17, -1, -1); + x_317_phi = true; + break; + } else { + x_307 = *(x_301); + x_290_phi = x_307; + continue; + } + return; + } + return; + + continuing { + x_290 = x_290_phi; + x_289_phi = x_290; + } + } + let x_317 : bool = x_317_phi; + if (x_317) { + break; + } + } + } + var x_322_phi : i32; + var x_350_phi : bool; + switch(0u) { + default: { + x_322_phi = 0; + loop { + var x_348 : i32; + var x_340 : i32; + var x_323 : i32; + var x_323_phi : i32; + let x_322 : i32 = x_322_phi; + x_350_phi = false; + if ((x_322 <= 9)) { + } else { + break; + } + let x_329 : i32 = tree[x_322].data; + if ((13 <= x_329)) { + let x_342 : ptr = &(tree[x_322].leftIndex); + let x_343 : i32 = *(x_342); + if ((x_343 == -1)) { + *(x_342) = 9; + tree[9] = BST(13, -1, -1); + x_350_phi = true; + break; + } else { + x_348 = *(x_342); + x_323_phi = x_348; + continue; + } + return; + } else { + let x_334 : ptr = &(tree[x_322].rightIndex); + let x_335 : i32 = *(x_334); + if ((x_335 == -1)) { + *(x_334) = 9; + tree[9] = BST(13, -1, -1); + x_350_phi = true; + break; + } else { + x_340 = *(x_334); + x_323_phi = x_340; + continue; + } + return; + } + return; + + continuing { + x_323 = x_323_phi; + x_322_phi = x_323; + } + } + let x_350 : bool = x_350_phi; + if (x_350) { + break; + } + } + } + x_353_phi = 0; + x_356_phi = 0; + x_358_phi = 0; + loop { + var x_381 : i32; + var x_391 : i32; + var x_396 : i32; + var x_359 : i32; + var x_354_phi : i32; + var x_357_phi : i32; + let x_353 : i32 = x_353_phi; + x_356 = x_356_phi; + let x_358 : i32 = x_358_phi; + if ((x_358 < 20)) { + } else { + break; + } + var x_366_phi : i32; + var x_381_phi : i32; + var x_382_phi : bool; + switch(0u) { + default: { + x_366_phi = 0; + loop { + let x_366 : i32 = x_366_phi; + x_381_phi = x_353; + x_382_phi = false; + if ((x_366 != -1)) { + } else { + break; + } + let x_373 : BST = tree[x_366]; + let x_374 : i32 = x_373.data; + let x_375 : i32 = x_373.leftIndex; + let x_376 : i32 = x_373.rightIndex; + if ((x_374 == x_358)) { + x_381_phi = x_358; + x_382_phi = true; + break; + } + + continuing { + x_366_phi = select(x_375, x_376, (x_358 > x_374)); + } + } + x_381 = x_381_phi; + let x_382 : bool = x_382_phi; + x_354_phi = x_381; + if (x_382) { + break; + } + x_354_phi = -1; + } + } + var x_354 : i32; + var x_390 : i32; + var x_395 : i32; + var x_391_phi : i32; + var x_396_phi : i32; + x_354 = x_354_phi; + switch(x_358) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + x_391_phi = x_356; + if ((x_354 == bitcast(x_358))) { + x_390 = bitcast((x_356 + bitcast(1))); + x_391_phi = x_390; + } + x_391 = x_391_phi; + x_357_phi = x_391; + } + default: { + x_396_phi = x_356; + if ((x_354 == bitcast(-1))) { + x_395 = bitcast((x_356 + bitcast(1))); + x_396_phi = x_395; + } + x_396 = x_396_phi; + x_357_phi = x_396; + } + } + let x_357 : i32 = x_357_phi; + + continuing { + x_359 = (x_358 + 1); + x_353_phi = x_354; + x_356_phi = x_357; + x_358_phi = x_359; + } + } + if ((x_356 == bitcast(20))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..1f593e3cf5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.hlsl @@ -0,0 +1,748 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + BST tree[10] = (BST[10])0; + int x_356 = 0; + int x_58_phi = 0; + bool x_86_phi = false; + int x_353_phi = 0; + int x_356_phi = 0; + int x_358_phi = 0; + const BST tint_symbol_2 = {9, -1, -1}; + tree[0] = tint_symbol_2; + switch(0u) { + default: { + x_58_phi = 0; + while (true) { + int x_84 = 0; + int x_76 = 0; + int x_59 = 0; + int x_59_phi = 0; + const int x_58 = x_58_phi; + x_86_phi = false; + if ((x_58 <= 1)) { + } else { + break; + } + const int x_65 = tree[x_58].data; + if ((5 <= x_65)) { + const int x_78_save = x_58; + const int x_79 = tree[x_78_save].leftIndex; + if ((x_79 == -1)) { + tree[x_78_save].leftIndex = 1; + const BST tint_symbol_3 = {5, -1, -1}; + tree[1] = tint_symbol_3; + x_86_phi = true; + break; + } else { + x_84 = tree[x_78_save].leftIndex; + x_59_phi = x_84; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + continue; + } + return; + } else { + const int x_70_save = x_58; + const int x_71 = tree[x_70_save].rightIndex; + if ((x_71 == -1)) { + tree[x_70_save].rightIndex = 1; + const BST tint_symbol_4 = {5, -1, -1}; + tree[1] = tint_symbol_4; + x_86_phi = true; + break; + } else { + x_76 = tree[x_70_save].rightIndex; + x_59_phi = x_76; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + continue; + } + return; + } + return; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + } + if (x_86_phi) { + break; + } + break; + } + } + int x_91_phi = 0; + bool x_119_phi = false; + switch(0u) { + default: { + x_91_phi = 0; + while (true) { + int x_117 = 0; + int x_109 = 0; + int x_92 = 0; + int x_92_phi = 0; + const int x_91 = x_91_phi; + x_119_phi = false; + if ((x_91 <= 2)) { + } else { + break; + } + const int x_98 = tree[x_91].data; + if ((12 <= x_98)) { + const int x_111_save = x_91; + const int x_112 = tree[x_111_save].leftIndex; + if ((x_112 == -1)) { + tree[x_111_save].leftIndex = 2; + const BST tint_symbol_5 = {12, -1, -1}; + tree[2] = tint_symbol_5; + x_119_phi = true; + break; + } else { + x_117 = tree[x_111_save].leftIndex; + x_92_phi = x_117; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + continue; + } + return; + } else { + const int x_103_save = x_91; + const int x_104 = tree[x_103_save].rightIndex; + if ((x_104 == -1)) { + tree[x_103_save].rightIndex = 2; + const BST tint_symbol_6 = {12, -1, -1}; + tree[2] = tint_symbol_6; + x_119_phi = true; + break; + } else { + x_109 = tree[x_103_save].rightIndex; + x_92_phi = x_109; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + continue; + } + return; + } + return; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + } + if (x_119_phi) { + break; + } + break; + } + } + int x_124_phi = 0; + bool x_152_phi = false; + switch(0u) { + default: { + x_124_phi = 0; + while (true) { + int x_150 = 0; + int x_142 = 0; + int x_125 = 0; + int x_125_phi = 0; + const int x_124 = x_124_phi; + x_152_phi = false; + if ((x_124 <= 3)) { + } else { + break; + } + const int x_131 = tree[x_124].data; + if ((15 <= x_131)) { + const int x_144_save = x_124; + const int x_145 = tree[x_144_save].leftIndex; + if ((x_145 == -1)) { + tree[x_144_save].leftIndex = 3; + const BST tint_symbol_7 = {15, -1, -1}; + tree[3] = tint_symbol_7; + x_152_phi = true; + break; + } else { + x_150 = tree[x_144_save].leftIndex; + x_125_phi = x_150; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + continue; + } + return; + } else { + const int x_136_save = x_124; + const int x_137 = tree[x_136_save].rightIndex; + if ((x_137 == -1)) { + tree[x_136_save].rightIndex = 3; + const BST tint_symbol_8 = {15, -1, -1}; + tree[3] = tint_symbol_8; + x_152_phi = true; + break; + } else { + x_142 = tree[x_136_save].rightIndex; + x_125_phi = x_142; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + continue; + } + return; + } + return; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + } + if (x_152_phi) { + break; + } + break; + } + } + int x_157_phi = 0; + bool x_185_phi = false; + switch(0u) { + default: { + x_157_phi = 0; + while (true) { + int x_183 = 0; + int x_175 = 0; + int x_158 = 0; + int x_158_phi = 0; + const int x_157 = x_157_phi; + x_185_phi = false; + if ((x_157 <= 4)) { + } else { + break; + } + const int x_164 = tree[x_157].data; + if ((7 <= x_164)) { + const int x_177_save = x_157; + const int x_178 = tree[x_177_save].leftIndex; + if ((x_178 == -1)) { + tree[x_177_save].leftIndex = 4; + const BST tint_symbol_9 = {7, -1, -1}; + tree[4] = tint_symbol_9; + x_185_phi = true; + break; + } else { + x_183 = tree[x_177_save].leftIndex; + x_158_phi = x_183; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + continue; + } + return; + } else { + const int x_169_save = x_157; + const int x_170 = tree[x_169_save].rightIndex; + if ((x_170 == -1)) { + tree[x_169_save].rightIndex = 4; + const BST tint_symbol_10 = {7, -1, -1}; + tree[4] = tint_symbol_10; + x_185_phi = true; + break; + } else { + x_175 = tree[x_169_save].rightIndex; + x_158_phi = x_175; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + continue; + } + return; + } + return; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + } + if (x_185_phi) { + break; + } + break; + } + } + int x_190_phi = 0; + bool x_218_phi = false; + switch(0u) { + default: { + x_190_phi = 0; + while (true) { + int x_216 = 0; + int x_208 = 0; + int x_191 = 0; + int x_191_phi = 0; + const int x_190 = x_190_phi; + x_218_phi = false; + if ((x_190 <= 5)) { + } else { + break; + } + const int x_197 = tree[x_190].data; + if ((8 <= x_197)) { + const int x_210_save = x_190; + const int x_211 = tree[x_210_save].leftIndex; + if ((x_211 == -1)) { + tree[x_210_save].leftIndex = 5; + const BST tint_symbol_11 = {8, -1, -1}; + tree[5] = tint_symbol_11; + x_218_phi = true; + break; + } else { + x_216 = tree[x_210_save].leftIndex; + x_191_phi = x_216; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + continue; + } + return; + } else { + const int x_202_save = x_190; + const int x_203 = tree[x_202_save].rightIndex; + if ((x_203 == -1)) { + tree[x_202_save].rightIndex = 5; + const BST tint_symbol_12 = {8, -1, -1}; + tree[5] = tint_symbol_12; + x_218_phi = true; + break; + } else { + x_208 = tree[x_202_save].rightIndex; + x_191_phi = x_208; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + continue; + } + return; + } + return; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + } + if (x_218_phi) { + break; + } + break; + } + } + int x_223_phi = 0; + bool x_251_phi = false; + switch(0u) { + default: { + x_223_phi = 0; + while (true) { + int x_249 = 0; + int x_241 = 0; + int x_224 = 0; + int x_224_phi = 0; + const int x_223 = x_223_phi; + x_251_phi = false; + if ((x_223 <= 6)) { + } else { + break; + } + const int x_230 = tree[x_223].data; + if ((2 <= x_230)) { + const int x_243_save = x_223; + const int x_244 = tree[x_243_save].leftIndex; + if ((x_244 == -1)) { + tree[x_243_save].leftIndex = 6; + const BST tint_symbol_13 = {2, -1, -1}; + tree[6] = tint_symbol_13; + x_251_phi = true; + break; + } else { + x_249 = tree[x_243_save].leftIndex; + x_224_phi = x_249; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + continue; + } + return; + } else { + const int x_235_save = x_223; + const int x_236 = tree[x_235_save].rightIndex; + if ((x_236 == -1)) { + tree[x_235_save].rightIndex = 6; + const BST tint_symbol_14 = {2, -1, -1}; + tree[6] = tint_symbol_14; + x_251_phi = true; + break; + } else { + x_241 = tree[x_235_save].rightIndex; + x_224_phi = x_241; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + continue; + } + return; + } + return; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + } + if (x_251_phi) { + break; + } + break; + } + } + int x_256_phi = 0; + bool x_284_phi = false; + switch(0u) { + default: { + x_256_phi = 0; + while (true) { + int x_282 = 0; + int x_274 = 0; + int x_257 = 0; + int x_257_phi = 0; + const int x_256 = x_256_phi; + x_284_phi = false; + if ((x_256 <= 7)) { + } else { + break; + } + const int x_263 = tree[x_256].data; + if ((6 <= x_263)) { + const int x_276_save = x_256; + const int x_277 = tree[x_276_save].leftIndex; + if ((x_277 == -1)) { + tree[x_276_save].leftIndex = 7; + const BST tint_symbol_15 = {6, -1, -1}; + tree[7] = tint_symbol_15; + x_284_phi = true; + break; + } else { + x_282 = tree[x_276_save].leftIndex; + x_257_phi = x_282; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + continue; + } + return; + } else { + const int x_268_save = x_256; + const int x_269 = tree[x_268_save].rightIndex; + if ((x_269 == -1)) { + tree[x_268_save].rightIndex = 7; + const BST tint_symbol_16 = {6, -1, -1}; + tree[7] = tint_symbol_16; + x_284_phi = true; + break; + } else { + x_274 = tree[x_268_save].rightIndex; + x_257_phi = x_274; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + continue; + } + return; + } + return; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + } + if (x_284_phi) { + break; + } + break; + } + } + int x_289_phi = 0; + bool x_317_phi = false; + switch(0u) { + default: { + x_289_phi = 0; + while (true) { + int x_315 = 0; + int x_307 = 0; + int x_290 = 0; + int x_290_phi = 0; + const int x_289 = x_289_phi; + x_317_phi = false; + if ((x_289 <= 8)) { + } else { + break; + } + const int x_296 = tree[x_289].data; + if ((17 <= x_296)) { + const int x_309_save = x_289; + const int x_310 = tree[x_309_save].leftIndex; + if ((x_310 == -1)) { + tree[x_309_save].leftIndex = 8; + const BST tint_symbol_17 = {17, -1, -1}; + tree[8] = tint_symbol_17; + x_317_phi = true; + break; + } else { + x_315 = tree[x_309_save].leftIndex; + x_290_phi = x_315; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + continue; + } + return; + } else { + const int x_301_save = x_289; + const int x_302 = tree[x_301_save].rightIndex; + if ((x_302 == -1)) { + tree[x_301_save].rightIndex = 8; + const BST tint_symbol_18 = {17, -1, -1}; + tree[8] = tint_symbol_18; + x_317_phi = true; + break; + } else { + x_307 = tree[x_301_save].rightIndex; + x_290_phi = x_307; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + continue; + } + return; + } + return; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + } + if (x_317_phi) { + break; + } + break; + } + } + int x_322_phi = 0; + bool x_350_phi = false; + switch(0u) { + default: { + x_322_phi = 0; + while (true) { + int x_348 = 0; + int x_340 = 0; + int x_323 = 0; + int x_323_phi = 0; + const int x_322 = x_322_phi; + x_350_phi = false; + if ((x_322 <= 9)) { + } else { + break; + } + const int x_329 = tree[x_322].data; + if ((13 <= x_329)) { + const int x_342_save = x_322; + const int x_343 = tree[x_342_save].leftIndex; + if ((x_343 == -1)) { + tree[x_342_save].leftIndex = 9; + const BST tint_symbol_19 = {13, -1, -1}; + tree[9] = tint_symbol_19; + x_350_phi = true; + break; + } else { + x_348 = tree[x_342_save].leftIndex; + x_323_phi = x_348; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + continue; + } + return; + } else { + const int x_334_save = x_322; + const int x_335 = tree[x_334_save].rightIndex; + if ((x_335 == -1)) { + tree[x_334_save].rightIndex = 9; + const BST tint_symbol_20 = {13, -1, -1}; + tree[9] = tint_symbol_20; + x_350_phi = true; + break; + } else { + x_340 = tree[x_334_save].rightIndex; + x_323_phi = x_340; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + continue; + } + return; + } + return; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + } + if (x_350_phi) { + break; + } + break; + } + } + x_353_phi = 0; + x_356_phi = 0; + x_358_phi = 0; + while (true) { + int x_381 = 0; + int x_391 = 0; + int x_396 = 0; + int x_359 = 0; + int x_354_phi = 0; + int x_357_phi = 0; + const int x_353 = x_353_phi; + x_356 = x_356_phi; + const int x_358 = x_358_phi; + if ((x_358 < 20)) { + } else { + break; + } + int x_366_phi = 0; + int x_381_phi = 0; + bool x_382_phi = false; + switch(0u) { + default: { + x_366_phi = 0; + while (true) { + const int x_366 = x_366_phi; + x_381_phi = x_353; + x_382_phi = false; + if ((x_366 != -1)) { + } else { + break; + } + const BST x_373 = tree[x_366]; + const int x_374 = x_373.data; + const int x_375 = x_373.leftIndex; + const int x_376 = x_373.rightIndex; + if ((x_374 == x_358)) { + x_381_phi = x_358; + x_382_phi = true; + break; + } + { + x_366_phi = ((x_358 > x_374) ? x_376 : x_375); + } + } + x_381 = x_381_phi; + const bool x_382 = x_382_phi; + x_354_phi = x_381; + if (x_382) { + break; + } + x_354_phi = -1; + break; + } + } + int x_354 = 0; + int x_390 = 0; + int x_395 = 0; + int x_391_phi = 0; + int x_396_phi = 0; + x_354 = x_354_phi; + switch(x_358) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_391_phi = x_356; + if ((x_354 == asint(x_358))) { + x_390 = asint((x_356 + asint(1))); + x_391_phi = x_390; + } + x_391 = x_391_phi; + x_357_phi = x_391; + break; + } + default: { + x_396_phi = x_356; + if ((x_354 == asint(-1))) { + x_395 = asint((x_356 + asint(1))); + x_396_phi = x_395; + } + x_396 = x_396_phi; + x_357_phi = x_396; + break; + } + } + const int x_357 = x_357_phi; + { + x_359 = (x_358 + 1); + x_353_phi = x_354; + x_356_phi = x_357; + x_358_phi = x_359; + } + } + if ((x_356 == asint(20))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_21 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_21; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.msl new file mode 100644 index 0000000000..752c6ed0be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.msl @@ -0,0 +1,762 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_23) { + tint_array_wrapper tree = {}; + int x_356 = 0; + int x_58_phi = 0; + bool x_86_phi = false; + int x_353_phi = 0; + int x_356_phi = 0; + int x_358_phi = 0; + BST const tint_symbol_3 = {.data=9, .leftIndex=-1, .rightIndex=-1}; + tree.arr[0] = tint_symbol_3; + switch(0u) { + default: { + x_58_phi = 0; + while (true) { + int x_84 = 0; + int x_76 = 0; + int x_59 = 0; + int x_59_phi = 0; + int const x_58 = x_58_phi; + x_86_phi = false; + if ((x_58 <= 1)) { + } else { + break; + } + int const x_65 = tree.arr[x_58].data; + if ((5 <= x_65)) { + int const x_78_save = x_58; + int const x_79 = tree.arr[x_78_save].leftIndex; + if ((x_79 == -1)) { + tree.arr[x_78_save].leftIndex = 1; + BST const tint_symbol_4 = {.data=5, .leftIndex=-1, .rightIndex=-1}; + tree.arr[1] = tint_symbol_4; + x_86_phi = true; + break; + } else { + x_84 = tree.arr[x_78_save].leftIndex; + x_59_phi = x_84; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + continue; + } + return; + } else { + int const x_70_save = x_58; + int const x_71 = tree.arr[x_70_save].rightIndex; + if ((x_71 == -1)) { + tree.arr[x_70_save].rightIndex = 1; + BST const tint_symbol_5 = {.data=5, .leftIndex=-1, .rightIndex=-1}; + tree.arr[1] = tint_symbol_5; + x_86_phi = true; + break; + } else { + x_76 = tree.arr[x_70_save].rightIndex; + x_59_phi = x_76; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + continue; + } + return; + } + return; + { + x_59 = x_59_phi; + x_58_phi = x_59; + } + } + bool const x_86 = x_86_phi; + if (x_86) { + break; + } + break; + } + } + int x_91_phi = 0; + bool x_119_phi = false; + switch(0u) { + default: { + x_91_phi = 0; + while (true) { + int x_117 = 0; + int x_109 = 0; + int x_92 = 0; + int x_92_phi = 0; + int const x_91 = x_91_phi; + x_119_phi = false; + if ((x_91 <= 2)) { + } else { + break; + } + int const x_98 = tree.arr[x_91].data; + if ((12 <= x_98)) { + int const x_111_save = x_91; + int const x_112 = tree.arr[x_111_save].leftIndex; + if ((x_112 == -1)) { + tree.arr[x_111_save].leftIndex = 2; + BST const tint_symbol_6 = {.data=12, .leftIndex=-1, .rightIndex=-1}; + tree.arr[2] = tint_symbol_6; + x_119_phi = true; + break; + } else { + x_117 = tree.arr[x_111_save].leftIndex; + x_92_phi = x_117; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + continue; + } + return; + } else { + int const x_103_save = x_91; + int const x_104 = tree.arr[x_103_save].rightIndex; + if ((x_104 == -1)) { + tree.arr[x_103_save].rightIndex = 2; + BST const tint_symbol_7 = {.data=12, .leftIndex=-1, .rightIndex=-1}; + tree.arr[2] = tint_symbol_7; + x_119_phi = true; + break; + } else { + x_109 = tree.arr[x_103_save].rightIndex; + x_92_phi = x_109; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + continue; + } + return; + } + return; + { + x_92 = x_92_phi; + x_91_phi = x_92; + } + } + bool const x_119 = x_119_phi; + if (x_119) { + break; + } + break; + } + } + int x_124_phi = 0; + bool x_152_phi = false; + switch(0u) { + default: { + x_124_phi = 0; + while (true) { + int x_150 = 0; + int x_142 = 0; + int x_125 = 0; + int x_125_phi = 0; + int const x_124 = x_124_phi; + x_152_phi = false; + if ((x_124 <= 3)) { + } else { + break; + } + int const x_131 = tree.arr[x_124].data; + if ((15 <= x_131)) { + int const x_144_save = x_124; + int const x_145 = tree.arr[x_144_save].leftIndex; + if ((x_145 == -1)) { + tree.arr[x_144_save].leftIndex = 3; + BST const tint_symbol_8 = {.data=15, .leftIndex=-1, .rightIndex=-1}; + tree.arr[3] = tint_symbol_8; + x_152_phi = true; + break; + } else { + x_150 = tree.arr[x_144_save].leftIndex; + x_125_phi = x_150; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + continue; + } + return; + } else { + int const x_136_save = x_124; + int const x_137 = tree.arr[x_136_save].rightIndex; + if ((x_137 == -1)) { + tree.arr[x_136_save].rightIndex = 3; + BST const tint_symbol_9 = {.data=15, .leftIndex=-1, .rightIndex=-1}; + tree.arr[3] = tint_symbol_9; + x_152_phi = true; + break; + } else { + x_142 = tree.arr[x_136_save].rightIndex; + x_125_phi = x_142; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + continue; + } + return; + } + return; + { + x_125 = x_125_phi; + x_124_phi = x_125; + } + } + bool const x_152 = x_152_phi; + if (x_152) { + break; + } + break; + } + } + int x_157_phi = 0; + bool x_185_phi = false; + switch(0u) { + default: { + x_157_phi = 0; + while (true) { + int x_183 = 0; + int x_175 = 0; + int x_158 = 0; + int x_158_phi = 0; + int const x_157 = x_157_phi; + x_185_phi = false; + if ((x_157 <= 4)) { + } else { + break; + } + int const x_164 = tree.arr[x_157].data; + if ((7 <= x_164)) { + int const x_177_save = x_157; + int const x_178 = tree.arr[x_177_save].leftIndex; + if ((x_178 == -1)) { + tree.arr[x_177_save].leftIndex = 4; + BST const tint_symbol_10 = {.data=7, .leftIndex=-1, .rightIndex=-1}; + tree.arr[4] = tint_symbol_10; + x_185_phi = true; + break; + } else { + x_183 = tree.arr[x_177_save].leftIndex; + x_158_phi = x_183; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + continue; + } + return; + } else { + int const x_169_save = x_157; + int const x_170 = tree.arr[x_169_save].rightIndex; + if ((x_170 == -1)) { + tree.arr[x_169_save].rightIndex = 4; + BST const tint_symbol_11 = {.data=7, .leftIndex=-1, .rightIndex=-1}; + tree.arr[4] = tint_symbol_11; + x_185_phi = true; + break; + } else { + x_175 = tree.arr[x_169_save].rightIndex; + x_158_phi = x_175; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + continue; + } + return; + } + return; + { + x_158 = x_158_phi; + x_157_phi = x_158; + } + } + bool const x_185 = x_185_phi; + if (x_185) { + break; + } + break; + } + } + int x_190_phi = 0; + bool x_218_phi = false; + switch(0u) { + default: { + x_190_phi = 0; + while (true) { + int x_216 = 0; + int x_208 = 0; + int x_191 = 0; + int x_191_phi = 0; + int const x_190 = x_190_phi; + x_218_phi = false; + if ((x_190 <= 5)) { + } else { + break; + } + int const x_197 = tree.arr[x_190].data; + if ((8 <= x_197)) { + int const x_210_save = x_190; + int const x_211 = tree.arr[x_210_save].leftIndex; + if ((x_211 == -1)) { + tree.arr[x_210_save].leftIndex = 5; + BST const tint_symbol_12 = {.data=8, .leftIndex=-1, .rightIndex=-1}; + tree.arr[5] = tint_symbol_12; + x_218_phi = true; + break; + } else { + x_216 = tree.arr[x_210_save].leftIndex; + x_191_phi = x_216; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + continue; + } + return; + } else { + int const x_202_save = x_190; + int const x_203 = tree.arr[x_202_save].rightIndex; + if ((x_203 == -1)) { + tree.arr[x_202_save].rightIndex = 5; + BST const tint_symbol_13 = {.data=8, .leftIndex=-1, .rightIndex=-1}; + tree.arr[5] = tint_symbol_13; + x_218_phi = true; + break; + } else { + x_208 = tree.arr[x_202_save].rightIndex; + x_191_phi = x_208; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + continue; + } + return; + } + return; + { + x_191 = x_191_phi; + x_190_phi = x_191; + } + } + bool const x_218 = x_218_phi; + if (x_218) { + break; + } + break; + } + } + int x_223_phi = 0; + bool x_251_phi = false; + switch(0u) { + default: { + x_223_phi = 0; + while (true) { + int x_249 = 0; + int x_241 = 0; + int x_224 = 0; + int x_224_phi = 0; + int const x_223 = x_223_phi; + x_251_phi = false; + if ((x_223 <= 6)) { + } else { + break; + } + int const x_230 = tree.arr[x_223].data; + if ((2 <= x_230)) { + int const x_243_save = x_223; + int const x_244 = tree.arr[x_243_save].leftIndex; + if ((x_244 == -1)) { + tree.arr[x_243_save].leftIndex = 6; + BST const tint_symbol_14 = {.data=2, .leftIndex=-1, .rightIndex=-1}; + tree.arr[6] = tint_symbol_14; + x_251_phi = true; + break; + } else { + x_249 = tree.arr[x_243_save].leftIndex; + x_224_phi = x_249; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + continue; + } + return; + } else { + int const x_235_save = x_223; + int const x_236 = tree.arr[x_235_save].rightIndex; + if ((x_236 == -1)) { + tree.arr[x_235_save].rightIndex = 6; + BST const tint_symbol_15 = {.data=2, .leftIndex=-1, .rightIndex=-1}; + tree.arr[6] = tint_symbol_15; + x_251_phi = true; + break; + } else { + x_241 = tree.arr[x_235_save].rightIndex; + x_224_phi = x_241; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + continue; + } + return; + } + return; + { + x_224 = x_224_phi; + x_223_phi = x_224; + } + } + bool const x_251 = x_251_phi; + if (x_251) { + break; + } + break; + } + } + int x_256_phi = 0; + bool x_284_phi = false; + switch(0u) { + default: { + x_256_phi = 0; + while (true) { + int x_282 = 0; + int x_274 = 0; + int x_257 = 0; + int x_257_phi = 0; + int const x_256 = x_256_phi; + x_284_phi = false; + if ((x_256 <= 7)) { + } else { + break; + } + int const x_263 = tree.arr[x_256].data; + if ((6 <= x_263)) { + int const x_276_save = x_256; + int const x_277 = tree.arr[x_276_save].leftIndex; + if ((x_277 == -1)) { + tree.arr[x_276_save].leftIndex = 7; + BST const tint_symbol_16 = {.data=6, .leftIndex=-1, .rightIndex=-1}; + tree.arr[7] = tint_symbol_16; + x_284_phi = true; + break; + } else { + x_282 = tree.arr[x_276_save].leftIndex; + x_257_phi = x_282; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + continue; + } + return; + } else { + int const x_268_save = x_256; + int const x_269 = tree.arr[x_268_save].rightIndex; + if ((x_269 == -1)) { + tree.arr[x_268_save].rightIndex = 7; + BST const tint_symbol_17 = {.data=6, .leftIndex=-1, .rightIndex=-1}; + tree.arr[7] = tint_symbol_17; + x_284_phi = true; + break; + } else { + x_274 = tree.arr[x_268_save].rightIndex; + x_257_phi = x_274; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + continue; + } + return; + } + return; + { + x_257 = x_257_phi; + x_256_phi = x_257; + } + } + bool const x_284 = x_284_phi; + if (x_284) { + break; + } + break; + } + } + int x_289_phi = 0; + bool x_317_phi = false; + switch(0u) { + default: { + x_289_phi = 0; + while (true) { + int x_315 = 0; + int x_307 = 0; + int x_290 = 0; + int x_290_phi = 0; + int const x_289 = x_289_phi; + x_317_phi = false; + if ((x_289 <= 8)) { + } else { + break; + } + int const x_296 = tree.arr[x_289].data; + if ((17 <= x_296)) { + int const x_309_save = x_289; + int const x_310 = tree.arr[x_309_save].leftIndex; + if ((x_310 == -1)) { + tree.arr[x_309_save].leftIndex = 8; + BST const tint_symbol_18 = {.data=17, .leftIndex=-1, .rightIndex=-1}; + tree.arr[8] = tint_symbol_18; + x_317_phi = true; + break; + } else { + x_315 = tree.arr[x_309_save].leftIndex; + x_290_phi = x_315; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + continue; + } + return; + } else { + int const x_301_save = x_289; + int const x_302 = tree.arr[x_301_save].rightIndex; + if ((x_302 == -1)) { + tree.arr[x_301_save].rightIndex = 8; + BST const tint_symbol_19 = {.data=17, .leftIndex=-1, .rightIndex=-1}; + tree.arr[8] = tint_symbol_19; + x_317_phi = true; + break; + } else { + x_307 = tree.arr[x_301_save].rightIndex; + x_290_phi = x_307; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + continue; + } + return; + } + return; + { + x_290 = x_290_phi; + x_289_phi = x_290; + } + } + bool const x_317 = x_317_phi; + if (x_317) { + break; + } + break; + } + } + int x_322_phi = 0; + bool x_350_phi = false; + switch(0u) { + default: { + x_322_phi = 0; + while (true) { + int x_348 = 0; + int x_340 = 0; + int x_323 = 0; + int x_323_phi = 0; + int const x_322 = x_322_phi; + x_350_phi = false; + if ((x_322 <= 9)) { + } else { + break; + } + int const x_329 = tree.arr[x_322].data; + if ((13 <= x_329)) { + int const x_342_save = x_322; + int const x_343 = tree.arr[x_342_save].leftIndex; + if ((x_343 == -1)) { + tree.arr[x_342_save].leftIndex = 9; + BST const tint_symbol_20 = {.data=13, .leftIndex=-1, .rightIndex=-1}; + tree.arr[9] = tint_symbol_20; + x_350_phi = true; + break; + } else { + x_348 = tree.arr[x_342_save].leftIndex; + x_323_phi = x_348; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + continue; + } + return; + } else { + int const x_334_save = x_322; + int const x_335 = tree.arr[x_334_save].rightIndex; + if ((x_335 == -1)) { + tree.arr[x_334_save].rightIndex = 9; + BST const tint_symbol_21 = {.data=13, .leftIndex=-1, .rightIndex=-1}; + tree.arr[9] = tint_symbol_21; + x_350_phi = true; + break; + } else { + x_340 = tree.arr[x_334_save].rightIndex; + x_323_phi = x_340; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + continue; + } + return; + } + return; + { + x_323 = x_323_phi; + x_322_phi = x_323; + } + } + bool const x_350 = x_350_phi; + if (x_350) { + break; + } + break; + } + } + x_353_phi = 0; + x_356_phi = 0; + x_358_phi = 0; + while (true) { + int x_381 = 0; + int x_391 = 0; + int x_396 = 0; + int x_359 = 0; + int x_354_phi = 0; + int x_357_phi = 0; + int const x_353 = x_353_phi; + x_356 = x_356_phi; + int const x_358 = x_358_phi; + if ((x_358 < 20)) { + } else { + break; + } + int x_366_phi = 0; + int x_381_phi = 0; + bool x_382_phi = false; + switch(0u) { + default: { + x_366_phi = 0; + while (true) { + int const x_366 = x_366_phi; + x_381_phi = x_353; + x_382_phi = false; + if ((x_366 != -1)) { + } else { + break; + } + BST const x_373 = tree.arr[x_366]; + int const x_374 = x_373.data; + int const x_375 = x_373.leftIndex; + int const x_376 = x_373.rightIndex; + if ((x_374 == x_358)) { + x_381_phi = x_358; + x_382_phi = true; + break; + } + { + x_366_phi = select(x_375, x_376, (x_358 > x_374)); + } + } + x_381 = x_381_phi; + bool const x_382 = x_382_phi; + x_354_phi = x_381; + if (x_382) { + break; + } + x_354_phi = -1; + break; + } + } + int x_354 = 0; + int x_390 = 0; + int x_395 = 0; + int x_391_phi = 0; + int x_396_phi = 0; + x_354 = x_354_phi; + switch(x_358) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_391_phi = x_356; + if ((x_354 == as_type(x_358))) { + x_390 = as_type((x_356 + as_type(1))); + x_391_phi = x_390; + } + x_391 = x_391_phi; + x_357_phi = x_391; + break; + } + default: { + x_396_phi = x_356; + if ((x_354 == as_type(-1))) { + x_395 = as_type((x_356 + as_type(1))); + x_396_phi = x_395; + } + x_396 = x_396_phi; + x_357_phi = x_396; + break; + } + } + int const x_357 = x_357_phi; + { + x_359 = (x_358 + 1); + x_353_phi = x_354; + x_356_phi = x_357; + x_358_phi = x_359; + } + } + if ((x_356 == as_type(20))) { + *(tint_symbol_23) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_23) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_24 = 0.0f; + main_1(&(tint_symbol_24)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_24}; + tint_symbol_1 const tint_symbol_22 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_22; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..9ea3312a6e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.spvasm @@ -0,0 +1,1166 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 619 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree "tree" + OpName %x_356 "x_356" + OpName %x_58_phi "x_58_phi" + OpName %x_86_phi "x_86_phi" + OpName %x_353_phi "x_353_phi" + OpName %x_356_phi "x_356_phi" + OpName %x_358_phi "x_358_phi" + OpName %x_84 "x_84" + OpName %x_76 "x_76" + OpName %x_59 "x_59" + OpName %x_59_phi "x_59_phi" + OpName %x_91_phi "x_91_phi" + OpName %x_119_phi "x_119_phi" + OpName %x_117 "x_117" + OpName %x_109 "x_109" + OpName %x_92 "x_92" + OpName %x_92_phi "x_92_phi" + OpName %x_124_phi "x_124_phi" + OpName %x_152_phi "x_152_phi" + OpName %x_150 "x_150" + OpName %x_142 "x_142" + OpName %x_125 "x_125" + OpName %x_125_phi "x_125_phi" + OpName %x_157_phi "x_157_phi" + OpName %x_185_phi "x_185_phi" + OpName %x_183 "x_183" + OpName %x_175 "x_175" + OpName %x_158 "x_158" + OpName %x_158_phi "x_158_phi" + OpName %x_190_phi "x_190_phi" + OpName %x_218_phi "x_218_phi" + OpName %x_216 "x_216" + OpName %x_208 "x_208" + OpName %x_191 "x_191" + OpName %x_191_phi "x_191_phi" + OpName %x_223_phi "x_223_phi" + OpName %x_251_phi "x_251_phi" + OpName %x_249 "x_249" + OpName %x_241 "x_241" + OpName %x_224 "x_224" + OpName %x_224_phi "x_224_phi" + OpName %x_256_phi "x_256_phi" + OpName %x_284_phi "x_284_phi" + OpName %x_282 "x_282" + OpName %x_274 "x_274" + OpName %x_257 "x_257" + OpName %x_257_phi "x_257_phi" + OpName %x_289_phi "x_289_phi" + OpName %x_317_phi "x_317_phi" + OpName %x_315 "x_315" + OpName %x_307 "x_307" + OpName %x_290 "x_290" + OpName %x_290_phi "x_290_phi" + OpName %x_322_phi "x_322_phi" + OpName %x_350_phi "x_350_phi" + OpName %x_348 "x_348" + OpName %x_340 "x_340" + OpName %x_323 "x_323" + OpName %x_323_phi "x_323_phi" + OpName %x_381 "x_381" + OpName %x_391 "x_391" + OpName %x_396 "x_396" + OpName %x_359 "x_359" + OpName %x_354_phi "x_354_phi" + OpName %x_357_phi "x_357_phi" + OpName %x_366_phi "x_366_phi" + OpName %x_381_phi "x_381_phi" + OpName %x_382_phi "x_382_phi" + OpName %x_354 "x_354" + OpName %x_390 "x_390" + OpName %x_395 "x_395" + OpName %x_391_phi "x_391_phi" + OpName %x_396_phi "x_396_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Function__arr_BST_uint_10 = OpTypePointer Function %_arr_BST_uint_10 + %19 = OpConstantNull %_arr_BST_uint_10 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %27 = OpConstantNull %bool + %int_0 = OpConstant %int 0 +%_ptr_Function_BST = OpTypePointer Function %BST + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 + %36 = OpConstantComposite %BST %int_9 %int_n1 %int_n1 + %uint_0 = OpConstant %uint 0 + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 + %71 = OpConstantComposite %BST %int_5 %int_n1 %int_n1 + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 + %int_2 = OpConstant %int 2 + %int_12 = OpConstant %int 12 + %126 = OpConstantComposite %BST %int_12 %int_n1 %int_n1 + %int_3 = OpConstant %int 3 + %int_15 = OpConstant %int 15 + %179 = OpConstantComposite %BST %int_15 %int_n1 %int_n1 + %int_4 = OpConstant %int 4 + %int_7 = OpConstant %int 7 + %232 = OpConstantComposite %BST %int_7 %int_n1 %int_n1 + %int_8 = OpConstant %int 8 + %284 = OpConstantComposite %BST %int_8 %int_n1 %int_n1 + %int_6 = OpConstant %int 6 + %336 = OpConstantComposite %BST %int_2 %int_n1 %int_n1 + %387 = OpConstantComposite %BST %int_6 %int_n1 %int_n1 + %int_17 = OpConstant %int 17 + %439 = OpConstantComposite %BST %int_17 %int_n1 %int_n1 + %int_13 = OpConstant %int 13 + %491 = OpConstantComposite %BST %int_13 %int_n1 %int_n1 + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %605 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %606 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %607 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %tree = OpVariable %_ptr_Function__arr_BST_uint_10 Function %19 + %x_356 = OpVariable %_ptr_Function_int Function %22 + %x_58_phi = OpVariable %_ptr_Function_int Function %22 + %x_86_phi = OpVariable %_ptr_Function_bool Function %27 + %x_353_phi = OpVariable %_ptr_Function_int Function %22 + %x_356_phi = OpVariable %_ptr_Function_int Function %22 + %x_358_phi = OpVariable %_ptr_Function_int Function %22 + %x_84 = OpVariable %_ptr_Function_int Function %22 + %x_76 = OpVariable %_ptr_Function_int Function %22 + %x_59 = OpVariable %_ptr_Function_int Function %22 + %x_59_phi = OpVariable %_ptr_Function_int Function %22 + %x_91_phi = OpVariable %_ptr_Function_int Function %22 + %x_119_phi = OpVariable %_ptr_Function_bool Function %27 + %x_117 = OpVariable %_ptr_Function_int Function %22 + %x_109 = OpVariable %_ptr_Function_int Function %22 + %x_92 = OpVariable %_ptr_Function_int Function %22 + %x_92_phi = OpVariable %_ptr_Function_int Function %22 + %x_124_phi = OpVariable %_ptr_Function_int Function %22 + %x_152_phi = OpVariable %_ptr_Function_bool Function %27 + %x_150 = OpVariable %_ptr_Function_int Function %22 + %x_142 = OpVariable %_ptr_Function_int Function %22 + %x_125 = OpVariable %_ptr_Function_int Function %22 + %x_125_phi = OpVariable %_ptr_Function_int Function %22 + %x_157_phi = OpVariable %_ptr_Function_int Function %22 + %x_185_phi = OpVariable %_ptr_Function_bool Function %27 + %x_183 = OpVariable %_ptr_Function_int Function %22 + %x_175 = OpVariable %_ptr_Function_int Function %22 + %x_158 = OpVariable %_ptr_Function_int Function %22 + %x_158_phi = OpVariable %_ptr_Function_int Function %22 + %x_190_phi = OpVariable %_ptr_Function_int Function %22 + %x_218_phi = OpVariable %_ptr_Function_bool Function %27 + %x_216 = OpVariable %_ptr_Function_int Function %22 + %x_208 = OpVariable %_ptr_Function_int Function %22 + %x_191 = OpVariable %_ptr_Function_int Function %22 + %x_191_phi = OpVariable %_ptr_Function_int Function %22 + %x_223_phi = OpVariable %_ptr_Function_int Function %22 + %x_251_phi = OpVariable %_ptr_Function_bool Function %27 + %x_249 = OpVariable %_ptr_Function_int Function %22 + %x_241 = OpVariable %_ptr_Function_int Function %22 + %x_224 = OpVariable %_ptr_Function_int Function %22 + %x_224_phi = OpVariable %_ptr_Function_int Function %22 + %x_256_phi = OpVariable %_ptr_Function_int Function %22 + %x_284_phi = OpVariable %_ptr_Function_bool Function %27 + %x_282 = OpVariable %_ptr_Function_int Function %22 + %x_274 = OpVariable %_ptr_Function_int Function %22 + %x_257 = OpVariable %_ptr_Function_int Function %22 + %x_257_phi = OpVariable %_ptr_Function_int Function %22 + %x_289_phi = OpVariable %_ptr_Function_int Function %22 + %x_317_phi = OpVariable %_ptr_Function_bool Function %27 + %x_315 = OpVariable %_ptr_Function_int Function %22 + %x_307 = OpVariable %_ptr_Function_int Function %22 + %x_290 = OpVariable %_ptr_Function_int Function %22 + %x_290_phi = OpVariable %_ptr_Function_int Function %22 + %x_322_phi = OpVariable %_ptr_Function_int Function %22 + %x_350_phi = OpVariable %_ptr_Function_bool Function %27 + %x_348 = OpVariable %_ptr_Function_int Function %22 + %x_340 = OpVariable %_ptr_Function_int Function %22 + %x_323 = OpVariable %_ptr_Function_int Function %22 + %x_323_phi = OpVariable %_ptr_Function_int Function %22 + %x_381 = OpVariable %_ptr_Function_int Function %22 + %x_391 = OpVariable %_ptr_Function_int Function %22 + %x_396 = OpVariable %_ptr_Function_int Function %22 + %x_359 = OpVariable %_ptr_Function_int Function %22 + %x_354_phi = OpVariable %_ptr_Function_int Function %22 + %x_357_phi = OpVariable %_ptr_Function_int Function %22 + %x_366_phi = OpVariable %_ptr_Function_int Function %22 + %x_381_phi = OpVariable %_ptr_Function_int Function %22 + %x_382_phi = OpVariable %_ptr_Function_bool Function %27 + %x_354 = OpVariable %_ptr_Function_int Function %22 + %x_390 = OpVariable %_ptr_Function_int Function %22 + %x_395 = OpVariable %_ptr_Function_int Function %22 + %x_391_phi = OpVariable %_ptr_Function_int Function %22 + %x_396_phi = OpVariable %_ptr_Function_int Function %22 + %33 = OpAccessChain %_ptr_Function_BST %tree %int_0 + OpStore %33 %36 + OpSelectionMerge %37 None + OpSwitch %uint_0 %39 + %39 = OpLabel + OpStore %x_58_phi %int_0 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %48 = OpLoad %int %x_58_phi + OpStore %x_86_phi %false + %51 = OpSLessThanEqual %bool %48 %int_1 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %41 + %52 = OpLabel + %55 = OpAccessChain %_ptr_Function_int %tree %48 %uint_0 + %56 = OpLoad %int %55 + %58 = OpSLessThanEqual %bool %int_5 %56 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + %63 = OpAccessChain %_ptr_Function_int %tree %48 %uint_1 + %64 = OpLoad %int %63 + %65 = OpIEqual %bool %64 %int_n1 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %67 = OpLabel + %69 = OpAccessChain %_ptr_Function_int %tree %48 %uint_1 + OpStore %69 %int_1 + %70 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %70 %71 + OpStore %x_86_phi %true + OpBranch %41 + %68 = OpLabel + %73 = OpAccessChain %_ptr_Function_int %tree %48 %uint_1 + %74 = OpLoad %int %73 + OpStore %x_84 %74 + %75 = OpLoad %int %x_84 + OpStore %x_59_phi %75 + OpBranch %42 + %66 = OpLabel + OpReturn + %61 = OpLabel + %77 = OpAccessChain %_ptr_Function_int %tree %48 %uint_2 + %78 = OpLoad %int %77 + %79 = OpIEqual %bool %78 %int_n1 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + %83 = OpAccessChain %_ptr_Function_int %tree %48 %uint_2 + OpStore %83 %int_1 + %84 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %84 %71 + OpStore %x_86_phi %true + OpBranch %41 + %82 = OpLabel + %85 = OpAccessChain %_ptr_Function_int %tree %48 %uint_2 + %86 = OpLoad %int %85 + OpStore %x_76 %86 + %87 = OpLoad %int %x_76 + OpStore %x_59_phi %87 + OpBranch %42 + %80 = OpLabel + OpReturn + %59 = OpLabel + OpReturn + %42 = OpLabel + %88 = OpLoad %int %x_59_phi + OpStore %x_59 %88 + %89 = OpLoad %int %x_59 + OpStore %x_58_phi %89 + OpBranch %40 + %41 = OpLabel + %90 = OpLoad %bool %x_86_phi + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + OpBranch %37 + %91 = OpLabel + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %95 None + OpSwitch %uint_0 %96 + %96 = OpLabel + OpStore %x_91_phi %int_0 + OpBranch %97 + %97 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %105 = OpLoad %int %x_91_phi + OpStore %x_119_phi %false + %107 = OpSLessThanEqual %bool %105 %int_2 + OpSelectionMerge %108 None + OpBranchConditional %107 %109 %110 + %109 = OpLabel + OpBranch %108 + %110 = OpLabel + OpBranch %98 + %108 = OpLabel + %111 = OpAccessChain %_ptr_Function_int %tree %105 %uint_0 + %112 = OpLoad %int %111 + %114 = OpSLessThanEqual %bool %int_12 %112 + OpSelectionMerge %115 None + OpBranchConditional %114 %116 %117 + %116 = OpLabel + %118 = OpAccessChain %_ptr_Function_int %tree %105 %uint_1 + %119 = OpLoad %int %118 + %120 = OpIEqual %bool %119 %int_n1 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %123 + %122 = OpLabel + %124 = OpAccessChain %_ptr_Function_int %tree %105 %uint_1 + OpStore %124 %int_2 + %125 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %125 %126 + OpStore %x_119_phi %true + OpBranch %98 + %123 = OpLabel + %127 = OpAccessChain %_ptr_Function_int %tree %105 %uint_1 + %128 = OpLoad %int %127 + OpStore %x_117 %128 + %129 = OpLoad %int %x_117 + OpStore %x_92_phi %129 + OpBranch %99 + %121 = OpLabel + OpReturn + %117 = OpLabel + %130 = OpAccessChain %_ptr_Function_int %tree %105 %uint_2 + %131 = OpLoad %int %130 + %132 = OpIEqual %bool %131 %int_n1 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %135 + %134 = OpLabel + %136 = OpAccessChain %_ptr_Function_int %tree %105 %uint_2 + OpStore %136 %int_2 + %137 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %137 %126 + OpStore %x_119_phi %true + OpBranch %98 + %135 = OpLabel + %138 = OpAccessChain %_ptr_Function_int %tree %105 %uint_2 + %139 = OpLoad %int %138 + OpStore %x_109 %139 + %140 = OpLoad %int %x_109 + OpStore %x_92_phi %140 + OpBranch %99 + %133 = OpLabel + OpReturn + %115 = OpLabel + OpReturn + %99 = OpLabel + %141 = OpLoad %int %x_92_phi + OpStore %x_92 %141 + %142 = OpLoad %int %x_92 + OpStore %x_91_phi %142 + OpBranch %97 + %98 = OpLabel + %143 = OpLoad %bool %x_119_phi + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %144 + %145 = OpLabel + OpBranch %95 + %144 = OpLabel + OpBranch %95 + %95 = OpLabel + OpSelectionMerge %148 None + OpSwitch %uint_0 %149 + %149 = OpLabel + OpStore %x_124_phi %int_0 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %158 = OpLoad %int %x_124_phi + OpStore %x_152_phi %false + %160 = OpSLessThanEqual %bool %158 %int_3 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + OpBranch %161 + %163 = OpLabel + OpBranch %151 + %161 = OpLabel + %164 = OpAccessChain %_ptr_Function_int %tree %158 %uint_0 + %165 = OpLoad %int %164 + %167 = OpSLessThanEqual %bool %int_15 %165 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + %171 = OpAccessChain %_ptr_Function_int %tree %158 %uint_1 + %172 = OpLoad %int %171 + %173 = OpIEqual %bool %172 %int_n1 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %176 + %175 = OpLabel + %177 = OpAccessChain %_ptr_Function_int %tree %158 %uint_1 + OpStore %177 %int_3 + %178 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %178 %179 + OpStore %x_152_phi %true + OpBranch %151 + %176 = OpLabel + %180 = OpAccessChain %_ptr_Function_int %tree %158 %uint_1 + %181 = OpLoad %int %180 + OpStore %x_150 %181 + %182 = OpLoad %int %x_150 + OpStore %x_125_phi %182 + OpBranch %152 + %174 = OpLabel + OpReturn + %170 = OpLabel + %183 = OpAccessChain %_ptr_Function_int %tree %158 %uint_2 + %184 = OpLoad %int %183 + %185 = OpIEqual %bool %184 %int_n1 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + %189 = OpAccessChain %_ptr_Function_int %tree %158 %uint_2 + OpStore %189 %int_3 + %190 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %190 %179 + OpStore %x_152_phi %true + OpBranch %151 + %188 = OpLabel + %191 = OpAccessChain %_ptr_Function_int %tree %158 %uint_2 + %192 = OpLoad %int %191 + OpStore %x_142 %192 + %193 = OpLoad %int %x_142 + OpStore %x_125_phi %193 + OpBranch %152 + %186 = OpLabel + OpReturn + %168 = OpLabel + OpReturn + %152 = OpLabel + %194 = OpLoad %int %x_125_phi + OpStore %x_125 %194 + %195 = OpLoad %int %x_125 + OpStore %x_124_phi %195 + OpBranch %150 + %151 = OpLabel + %196 = OpLoad %bool %x_152_phi + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %197 + %198 = OpLabel + OpBranch %148 + %197 = OpLabel + OpBranch %148 + %148 = OpLabel + OpSelectionMerge %201 None + OpSwitch %uint_0 %202 + %202 = OpLabel + OpStore %x_157_phi %int_0 + OpBranch %203 + %203 = OpLabel + OpLoopMerge %204 %205 None + OpBranch %206 + %206 = OpLabel + %211 = OpLoad %int %x_157_phi + OpStore %x_185_phi %false + %213 = OpSLessThanEqual %bool %211 %int_4 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %204 + %214 = OpLabel + %217 = OpAccessChain %_ptr_Function_int %tree %211 %uint_0 + %218 = OpLoad %int %217 + %220 = OpSLessThanEqual %bool %int_7 %218 + OpSelectionMerge %221 None + OpBranchConditional %220 %222 %223 + %222 = OpLabel + %224 = OpAccessChain %_ptr_Function_int %tree %211 %uint_1 + %225 = OpLoad %int %224 + %226 = OpIEqual %bool %225 %int_n1 + OpSelectionMerge %227 None + OpBranchConditional %226 %228 %229 + %228 = OpLabel + %230 = OpAccessChain %_ptr_Function_int %tree %211 %uint_1 + OpStore %230 %int_4 + %231 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %231 %232 + OpStore %x_185_phi %true + OpBranch %204 + %229 = OpLabel + %233 = OpAccessChain %_ptr_Function_int %tree %211 %uint_1 + %234 = OpLoad %int %233 + OpStore %x_183 %234 + %235 = OpLoad %int %x_183 + OpStore %x_158_phi %235 + OpBranch %205 + %227 = OpLabel + OpReturn + %223 = OpLabel + %236 = OpAccessChain %_ptr_Function_int %tree %211 %uint_2 + %237 = OpLoad %int %236 + %238 = OpIEqual %bool %237 %int_n1 + OpSelectionMerge %239 None + OpBranchConditional %238 %240 %241 + %240 = OpLabel + %242 = OpAccessChain %_ptr_Function_int %tree %211 %uint_2 + OpStore %242 %int_4 + %243 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %243 %232 + OpStore %x_185_phi %true + OpBranch %204 + %241 = OpLabel + %244 = OpAccessChain %_ptr_Function_int %tree %211 %uint_2 + %245 = OpLoad %int %244 + OpStore %x_175 %245 + %246 = OpLoad %int %x_175 + OpStore %x_158_phi %246 + OpBranch %205 + %239 = OpLabel + OpReturn + %221 = OpLabel + OpReturn + %205 = OpLabel + %247 = OpLoad %int %x_158_phi + OpStore %x_158 %247 + %248 = OpLoad %int %x_158 + OpStore %x_157_phi %248 + OpBranch %203 + %204 = OpLabel + %249 = OpLoad %bool %x_185_phi + OpSelectionMerge %250 None + OpBranchConditional %249 %251 %250 + %251 = OpLabel + OpBranch %201 + %250 = OpLabel + OpBranch %201 + %201 = OpLabel + OpSelectionMerge %254 None + OpSwitch %uint_0 %255 + %255 = OpLabel + OpStore %x_190_phi %int_0 + OpBranch %256 + %256 = OpLabel + OpLoopMerge %257 %258 None + OpBranch %259 + %259 = OpLabel + %264 = OpLoad %int %x_190_phi + OpStore %x_218_phi %false + %265 = OpSLessThanEqual %bool %264 %int_5 + OpSelectionMerge %266 None + OpBranchConditional %265 %267 %268 + %267 = OpLabel + OpBranch %266 + %268 = OpLabel + OpBranch %257 + %266 = OpLabel + %269 = OpAccessChain %_ptr_Function_int %tree %264 %uint_0 + %270 = OpLoad %int %269 + %272 = OpSLessThanEqual %bool %int_8 %270 + OpSelectionMerge %273 None + OpBranchConditional %272 %274 %275 + %274 = OpLabel + %276 = OpAccessChain %_ptr_Function_int %tree %264 %uint_1 + %277 = OpLoad %int %276 + %278 = OpIEqual %bool %277 %int_n1 + OpSelectionMerge %279 None + OpBranchConditional %278 %280 %281 + %280 = OpLabel + %282 = OpAccessChain %_ptr_Function_int %tree %264 %uint_1 + OpStore %282 %int_5 + %283 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %283 %284 + OpStore %x_218_phi %true + OpBranch %257 + %281 = OpLabel + %285 = OpAccessChain %_ptr_Function_int %tree %264 %uint_1 + %286 = OpLoad %int %285 + OpStore %x_216 %286 + %287 = OpLoad %int %x_216 + OpStore %x_191_phi %287 + OpBranch %258 + %279 = OpLabel + OpReturn + %275 = OpLabel + %288 = OpAccessChain %_ptr_Function_int %tree %264 %uint_2 + %289 = OpLoad %int %288 + %290 = OpIEqual %bool %289 %int_n1 + OpSelectionMerge %291 None + OpBranchConditional %290 %292 %293 + %292 = OpLabel + %294 = OpAccessChain %_ptr_Function_int %tree %264 %uint_2 + OpStore %294 %int_5 + %295 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %295 %284 + OpStore %x_218_phi %true + OpBranch %257 + %293 = OpLabel + %296 = OpAccessChain %_ptr_Function_int %tree %264 %uint_2 + %297 = OpLoad %int %296 + OpStore %x_208 %297 + %298 = OpLoad %int %x_208 + OpStore %x_191_phi %298 + OpBranch %258 + %291 = OpLabel + OpReturn + %273 = OpLabel + OpReturn + %258 = OpLabel + %299 = OpLoad %int %x_191_phi + OpStore %x_191 %299 + %300 = OpLoad %int %x_191 + OpStore %x_190_phi %300 + OpBranch %256 + %257 = OpLabel + %301 = OpLoad %bool %x_218_phi + OpSelectionMerge %302 None + OpBranchConditional %301 %303 %302 + %303 = OpLabel + OpBranch %254 + %302 = OpLabel + OpBranch %254 + %254 = OpLabel + OpSelectionMerge %306 None + OpSwitch %uint_0 %307 + %307 = OpLabel + OpStore %x_223_phi %int_0 + OpBranch %308 + %308 = OpLabel + OpLoopMerge %309 %310 None + OpBranch %311 + %311 = OpLabel + %316 = OpLoad %int %x_223_phi + OpStore %x_251_phi %false + %318 = OpSLessThanEqual %bool %316 %int_6 + OpSelectionMerge %319 None + OpBranchConditional %318 %320 %321 + %320 = OpLabel + OpBranch %319 + %321 = OpLabel + OpBranch %309 + %319 = OpLabel + %322 = OpAccessChain %_ptr_Function_int %tree %316 %uint_0 + %323 = OpLoad %int %322 + %324 = OpSLessThanEqual %bool %int_2 %323 + OpSelectionMerge %325 None + OpBranchConditional %324 %326 %327 + %326 = OpLabel + %328 = OpAccessChain %_ptr_Function_int %tree %316 %uint_1 + %329 = OpLoad %int %328 + %330 = OpIEqual %bool %329 %int_n1 + OpSelectionMerge %331 None + OpBranchConditional %330 %332 %333 + %332 = OpLabel + %334 = OpAccessChain %_ptr_Function_int %tree %316 %uint_1 + OpStore %334 %int_6 + %335 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %335 %336 + OpStore %x_251_phi %true + OpBranch %309 + %333 = OpLabel + %337 = OpAccessChain %_ptr_Function_int %tree %316 %uint_1 + %338 = OpLoad %int %337 + OpStore %x_249 %338 + %339 = OpLoad %int %x_249 + OpStore %x_224_phi %339 + OpBranch %310 + %331 = OpLabel + OpReturn + %327 = OpLabel + %340 = OpAccessChain %_ptr_Function_int %tree %316 %uint_2 + %341 = OpLoad %int %340 + %342 = OpIEqual %bool %341 %int_n1 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %345 + %344 = OpLabel + %346 = OpAccessChain %_ptr_Function_int %tree %316 %uint_2 + OpStore %346 %int_6 + %347 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %347 %336 + OpStore %x_251_phi %true + OpBranch %309 + %345 = OpLabel + %348 = OpAccessChain %_ptr_Function_int %tree %316 %uint_2 + %349 = OpLoad %int %348 + OpStore %x_241 %349 + %350 = OpLoad %int %x_241 + OpStore %x_224_phi %350 + OpBranch %310 + %343 = OpLabel + OpReturn + %325 = OpLabel + OpReturn + %310 = OpLabel + %351 = OpLoad %int %x_224_phi + OpStore %x_224 %351 + %352 = OpLoad %int %x_224 + OpStore %x_223_phi %352 + OpBranch %308 + %309 = OpLabel + %353 = OpLoad %bool %x_251_phi + OpSelectionMerge %354 None + OpBranchConditional %353 %355 %354 + %355 = OpLabel + OpBranch %306 + %354 = OpLabel + OpBranch %306 + %306 = OpLabel + OpSelectionMerge %358 None + OpSwitch %uint_0 %359 + %359 = OpLabel + OpStore %x_256_phi %int_0 + OpBranch %360 + %360 = OpLabel + OpLoopMerge %361 %362 None + OpBranch %363 + %363 = OpLabel + %368 = OpLoad %int %x_256_phi + OpStore %x_284_phi %false + %369 = OpSLessThanEqual %bool %368 %int_7 + OpSelectionMerge %370 None + OpBranchConditional %369 %371 %372 + %371 = OpLabel + OpBranch %370 + %372 = OpLabel + OpBranch %361 + %370 = OpLabel + %373 = OpAccessChain %_ptr_Function_int %tree %368 %uint_0 + %374 = OpLoad %int %373 + %375 = OpSLessThanEqual %bool %int_6 %374 + OpSelectionMerge %376 None + OpBranchConditional %375 %377 %378 + %377 = OpLabel + %379 = OpAccessChain %_ptr_Function_int %tree %368 %uint_1 + %380 = OpLoad %int %379 + %381 = OpIEqual %bool %380 %int_n1 + OpSelectionMerge %382 None + OpBranchConditional %381 %383 %384 + %383 = OpLabel + %385 = OpAccessChain %_ptr_Function_int %tree %368 %uint_1 + OpStore %385 %int_7 + %386 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %386 %387 + OpStore %x_284_phi %true + OpBranch %361 + %384 = OpLabel + %388 = OpAccessChain %_ptr_Function_int %tree %368 %uint_1 + %389 = OpLoad %int %388 + OpStore %x_282 %389 + %390 = OpLoad %int %x_282 + OpStore %x_257_phi %390 + OpBranch %362 + %382 = OpLabel + OpReturn + %378 = OpLabel + %391 = OpAccessChain %_ptr_Function_int %tree %368 %uint_2 + %392 = OpLoad %int %391 + %393 = OpIEqual %bool %392 %int_n1 + OpSelectionMerge %394 None + OpBranchConditional %393 %395 %396 + %395 = OpLabel + %397 = OpAccessChain %_ptr_Function_int %tree %368 %uint_2 + OpStore %397 %int_7 + %398 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %398 %387 + OpStore %x_284_phi %true + OpBranch %361 + %396 = OpLabel + %399 = OpAccessChain %_ptr_Function_int %tree %368 %uint_2 + %400 = OpLoad %int %399 + OpStore %x_274 %400 + %401 = OpLoad %int %x_274 + OpStore %x_257_phi %401 + OpBranch %362 + %394 = OpLabel + OpReturn + %376 = OpLabel + OpReturn + %362 = OpLabel + %402 = OpLoad %int %x_257_phi + OpStore %x_257 %402 + %403 = OpLoad %int %x_257 + OpStore %x_256_phi %403 + OpBranch %360 + %361 = OpLabel + %404 = OpLoad %bool %x_284_phi + OpSelectionMerge %405 None + OpBranchConditional %404 %406 %405 + %406 = OpLabel + OpBranch %358 + %405 = OpLabel + OpBranch %358 + %358 = OpLabel + OpSelectionMerge %409 None + OpSwitch %uint_0 %410 + %410 = OpLabel + OpStore %x_289_phi %int_0 + OpBranch %411 + %411 = OpLabel + OpLoopMerge %412 %413 None + OpBranch %414 + %414 = OpLabel + %419 = OpLoad %int %x_289_phi + OpStore %x_317_phi %false + %420 = OpSLessThanEqual %bool %419 %int_8 + OpSelectionMerge %421 None + OpBranchConditional %420 %422 %423 + %422 = OpLabel + OpBranch %421 + %423 = OpLabel + OpBranch %412 + %421 = OpLabel + %424 = OpAccessChain %_ptr_Function_int %tree %419 %uint_0 + %425 = OpLoad %int %424 + %427 = OpSLessThanEqual %bool %int_17 %425 + OpSelectionMerge %428 None + OpBranchConditional %427 %429 %430 + %429 = OpLabel + %431 = OpAccessChain %_ptr_Function_int %tree %419 %uint_1 + %432 = OpLoad %int %431 + %433 = OpIEqual %bool %432 %int_n1 + OpSelectionMerge %434 None + OpBranchConditional %433 %435 %436 + %435 = OpLabel + %437 = OpAccessChain %_ptr_Function_int %tree %419 %uint_1 + OpStore %437 %int_8 + %438 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %438 %439 + OpStore %x_317_phi %true + OpBranch %412 + %436 = OpLabel + %440 = OpAccessChain %_ptr_Function_int %tree %419 %uint_1 + %441 = OpLoad %int %440 + OpStore %x_315 %441 + %442 = OpLoad %int %x_315 + OpStore %x_290_phi %442 + OpBranch %413 + %434 = OpLabel + OpReturn + %430 = OpLabel + %443 = OpAccessChain %_ptr_Function_int %tree %419 %uint_2 + %444 = OpLoad %int %443 + %445 = OpIEqual %bool %444 %int_n1 + OpSelectionMerge %446 None + OpBranchConditional %445 %447 %448 + %447 = OpLabel + %449 = OpAccessChain %_ptr_Function_int %tree %419 %uint_2 + OpStore %449 %int_8 + %450 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %450 %439 + OpStore %x_317_phi %true + OpBranch %412 + %448 = OpLabel + %451 = OpAccessChain %_ptr_Function_int %tree %419 %uint_2 + %452 = OpLoad %int %451 + OpStore %x_307 %452 + %453 = OpLoad %int %x_307 + OpStore %x_290_phi %453 + OpBranch %413 + %446 = OpLabel + OpReturn + %428 = OpLabel + OpReturn + %413 = OpLabel + %454 = OpLoad %int %x_290_phi + OpStore %x_290 %454 + %455 = OpLoad %int %x_290 + OpStore %x_289_phi %455 + OpBranch %411 + %412 = OpLabel + %456 = OpLoad %bool %x_317_phi + OpSelectionMerge %457 None + OpBranchConditional %456 %458 %457 + %458 = OpLabel + OpBranch %409 + %457 = OpLabel + OpBranch %409 + %409 = OpLabel + OpSelectionMerge %461 None + OpSwitch %uint_0 %462 + %462 = OpLabel + OpStore %x_322_phi %int_0 + OpBranch %463 + %463 = OpLabel + OpLoopMerge %464 %465 None + OpBranch %466 + %466 = OpLabel + %471 = OpLoad %int %x_322_phi + OpStore %x_350_phi %false + %472 = OpSLessThanEqual %bool %471 %int_9 + OpSelectionMerge %473 None + OpBranchConditional %472 %474 %475 + %474 = OpLabel + OpBranch %473 + %475 = OpLabel + OpBranch %464 + %473 = OpLabel + %476 = OpAccessChain %_ptr_Function_int %tree %471 %uint_0 + %477 = OpLoad %int %476 + %479 = OpSLessThanEqual %bool %int_13 %477 + OpSelectionMerge %480 None + OpBranchConditional %479 %481 %482 + %481 = OpLabel + %483 = OpAccessChain %_ptr_Function_int %tree %471 %uint_1 + %484 = OpLoad %int %483 + %485 = OpIEqual %bool %484 %int_n1 + OpSelectionMerge %486 None + OpBranchConditional %485 %487 %488 + %487 = OpLabel + %489 = OpAccessChain %_ptr_Function_int %tree %471 %uint_1 + OpStore %489 %int_9 + %490 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %490 %491 + OpStore %x_350_phi %true + OpBranch %464 + %488 = OpLabel + %492 = OpAccessChain %_ptr_Function_int %tree %471 %uint_1 + %493 = OpLoad %int %492 + OpStore %x_348 %493 + %494 = OpLoad %int %x_348 + OpStore %x_323_phi %494 + OpBranch %465 + %486 = OpLabel + OpReturn + %482 = OpLabel + %495 = OpAccessChain %_ptr_Function_int %tree %471 %uint_2 + %496 = OpLoad %int %495 + %497 = OpIEqual %bool %496 %int_n1 + OpSelectionMerge %498 None + OpBranchConditional %497 %499 %500 + %499 = OpLabel + %501 = OpAccessChain %_ptr_Function_int %tree %471 %uint_2 + OpStore %501 %int_9 + %502 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %502 %491 + OpStore %x_350_phi %true + OpBranch %464 + %500 = OpLabel + %503 = OpAccessChain %_ptr_Function_int %tree %471 %uint_2 + %504 = OpLoad %int %503 + OpStore %x_340 %504 + %505 = OpLoad %int %x_340 + OpStore %x_323_phi %505 + OpBranch %465 + %498 = OpLabel + OpReturn + %480 = OpLabel + OpReturn + %465 = OpLabel + %506 = OpLoad %int %x_323_phi + OpStore %x_323 %506 + %507 = OpLoad %int %x_323 + OpStore %x_322_phi %507 + OpBranch %463 + %464 = OpLabel + %508 = OpLoad %bool %x_350_phi + OpSelectionMerge %509 None + OpBranchConditional %508 %510 %509 + %510 = OpLabel + OpBranch %461 + %509 = OpLabel + OpBranch %461 + %461 = OpLabel + OpStore %x_353_phi %int_0 + OpStore %x_356_phi %int_0 + OpStore %x_358_phi %int_0 + OpBranch %511 + %511 = OpLabel + OpLoopMerge %512 %513 None + OpBranch %514 + %514 = OpLabel + %521 = OpLoad %int %x_353_phi + %522 = OpLoad %int %x_356_phi + OpStore %x_356 %522 + %523 = OpLoad %int %x_358_phi + %525 = OpSLessThan %bool %523 %int_20 + OpSelectionMerge %526 None + OpBranchConditional %525 %527 %528 + %527 = OpLabel + OpBranch %526 + %528 = OpLabel + OpBranch %512 + %526 = OpLabel + OpSelectionMerge %532 None + OpSwitch %uint_0 %533 + %533 = OpLabel + OpStore %x_366_phi %int_0 + OpBranch %534 + %534 = OpLabel + OpLoopMerge %535 %536 None + OpBranch %537 + %537 = OpLabel + %538 = OpLoad %int %x_366_phi + OpStore %x_381_phi %521 + OpStore %x_382_phi %false + %539 = OpINotEqual %bool %538 %int_n1 + OpSelectionMerge %540 None + OpBranchConditional %539 %541 %542 + %541 = OpLabel + OpBranch %540 + %542 = OpLabel + OpBranch %535 + %540 = OpLabel + %543 = OpAccessChain %_ptr_Function_BST %tree %538 + %544 = OpLoad %BST %543 + %545 = OpCompositeExtract %int %544 0 + %546 = OpCompositeExtract %int %544 1 + %547 = OpCompositeExtract %int %544 2 + %548 = OpIEqual %bool %545 %523 + OpSelectionMerge %549 None + OpBranchConditional %548 %550 %549 + %550 = OpLabel + OpStore %x_381_phi %523 + OpStore %x_382_phi %true + OpBranch %535 + %549 = OpLabel + OpBranch %536 + %536 = OpLabel + %552 = OpSGreaterThan %bool %523 %545 + %551 = OpSelect %int %552 %547 %546 + OpStore %x_366_phi %551 + OpBranch %534 + %535 = OpLabel + %553 = OpLoad %int %x_381_phi + OpStore %x_381 %553 + %554 = OpLoad %bool %x_382_phi + %555 = OpLoad %int %x_381 + OpStore %x_354_phi %555 + OpSelectionMerge %556 None + OpBranchConditional %554 %557 %556 + %557 = OpLabel + OpBranch %532 + %556 = OpLabel + OpStore %x_354_phi %int_n1 + OpBranch %532 + %532 = OpLabel + %563 = OpLoad %int %x_354_phi + OpStore %x_354 %563 + OpSelectionMerge %564 None + OpSwitch %523 %565 2 %566 5 %566 6 %566 7 %566 8 %566 9 %566 12 %566 13 %566 15 %566 17 %566 + %566 = OpLabel + %567 = OpLoad %int %x_356 + OpStore %x_391_phi %567 + %568 = OpLoad %int %x_354 + %569 = OpCopyObject %int %523 + %570 = OpIEqual %bool %568 %569 + OpSelectionMerge %571 None + OpBranchConditional %570 %572 %571 + %572 = OpLabel + %574 = OpLoad %int %x_356 + %575 = OpCopyObject %int %int_1 + %576 = OpIAdd %int %574 %575 + %573 = OpCopyObject %int %576 + OpStore %x_390 %573 + %577 = OpLoad %int %x_390 + OpStore %x_391_phi %577 + OpBranch %571 + %571 = OpLabel + %578 = OpLoad %int %x_391_phi + OpStore %x_391 %578 + %579 = OpLoad %int %x_391 + OpStore %x_357_phi %579 + OpBranch %564 + %565 = OpLabel + %580 = OpLoad %int %x_356 + OpStore %x_396_phi %580 + %581 = OpLoad %int %x_354 + %582 = OpCopyObject %int %int_n1 + %583 = OpIEqual %bool %581 %582 + OpSelectionMerge %584 None + OpBranchConditional %583 %585 %584 + %585 = OpLabel + %587 = OpLoad %int %x_356 + %588 = OpCopyObject %int %int_1 + %589 = OpIAdd %int %587 %588 + %586 = OpCopyObject %int %589 + OpStore %x_395 %586 + %590 = OpLoad %int %x_395 + OpStore %x_396_phi %590 + OpBranch %584 + %584 = OpLabel + %591 = OpLoad %int %x_396_phi + OpStore %x_396 %591 + %592 = OpLoad %int %x_396 + OpStore %x_357_phi %592 + OpBranch %564 + %564 = OpLabel + %593 = OpLoad %int %x_357_phi + OpBranch %513 + %513 = OpLabel + %594 = OpIAdd %int %523 %int_1 + OpStore %x_359 %594 + %595 = OpLoad %int %x_354 + OpStore %x_353_phi %595 + OpStore %x_356_phi %593 + %596 = OpLoad %int %x_359 + OpStore %x_358_phi %596 + OpBranch %511 + %512 = OpLabel + %597 = OpLoad %int %x_356 + %598 = OpCopyObject %int %int_20 + %599 = OpIEqual %bool %597 %598 + OpSelectionMerge %600 None + OpBranchConditional %599 %601 %602 + %601 = OpLabel + OpStore %x_GLF_color %605 + OpBranch %600 + %602 = OpLabel + OpStore %x_GLF_color %606 + OpBranch %600 + %600 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %607 +%tint_symbol = OpFunctionParameter %main_out + %611 = OpLabel + %612 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %612 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %614 = OpLabel + %615 = OpFunctionCall %void %main_1 + %617 = OpLoad %v4float %x_GLF_color + %618 = OpCompositeConstruct %main_out %617 + %616 = OpFunctionCall %void %tint_symbol_2 %618 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..76d569eae2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.wgsl @@ -0,0 +1,653 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var x_GLF_color : vec4; + +fn main_1() { + var tree : array; + var x_356 : i32; + var x_58_phi : i32; + var x_86_phi : bool; + var x_353_phi : i32; + var x_356_phi : i32; + var x_358_phi : i32; + tree[0] = BST(9, -1, -1); + switch(0u) { + default: { + x_58_phi = 0; + loop { + var x_84 : i32; + var x_76 : i32; + var x_59 : i32; + var x_59_phi : i32; + let x_58 : i32 = x_58_phi; + x_86_phi = false; + if ((x_58 <= 1)) { + } else { + break; + } + let x_65 : i32 = tree[x_58].data; + if ((5 <= x_65)) { + let x_78 : ptr = &(tree[x_58].leftIndex); + let x_79 : i32 = *(x_78); + if ((x_79 == -1)) { + *(x_78) = 1; + tree[1] = BST(5, -1, -1); + x_86_phi = true; + break; + } else { + x_84 = *(x_78); + x_59_phi = x_84; + continue; + } + return; + } else { + let x_70 : ptr = &(tree[x_58].rightIndex); + let x_71 : i32 = *(x_70); + if ((x_71 == -1)) { + *(x_70) = 1; + tree[1] = BST(5, -1, -1); + x_86_phi = true; + break; + } else { + x_76 = *(x_70); + x_59_phi = x_76; + continue; + } + return; + } + return; + + continuing { + x_59 = x_59_phi; + x_58_phi = x_59; + } + } + let x_86 : bool = x_86_phi; + if (x_86) { + break; + } + } + } + var x_91_phi : i32; + var x_119_phi : bool; + switch(0u) { + default: { + x_91_phi = 0; + loop { + var x_117 : i32; + var x_109 : i32; + var x_92 : i32; + var x_92_phi : i32; + let x_91 : i32 = x_91_phi; + x_119_phi = false; + if ((x_91 <= 2)) { + } else { + break; + } + let x_98 : i32 = tree[x_91].data; + if ((12 <= x_98)) { + let x_111 : ptr = &(tree[x_91].leftIndex); + let x_112 : i32 = *(x_111); + if ((x_112 == -1)) { + *(x_111) = 2; + tree[2] = BST(12, -1, -1); + x_119_phi = true; + break; + } else { + x_117 = *(x_111); + x_92_phi = x_117; + continue; + } + return; + } else { + let x_103 : ptr = &(tree[x_91].rightIndex); + let x_104 : i32 = *(x_103); + if ((x_104 == -1)) { + *(x_103) = 2; + tree[2] = BST(12, -1, -1); + x_119_phi = true; + break; + } else { + x_109 = *(x_103); + x_92_phi = x_109; + continue; + } + return; + } + return; + + continuing { + x_92 = x_92_phi; + x_91_phi = x_92; + } + } + let x_119 : bool = x_119_phi; + if (x_119) { + break; + } + } + } + var x_124_phi : i32; + var x_152_phi : bool; + switch(0u) { + default: { + x_124_phi = 0; + loop { + var x_150 : i32; + var x_142 : i32; + var x_125 : i32; + var x_125_phi : i32; + let x_124 : i32 = x_124_phi; + x_152_phi = false; + if ((x_124 <= 3)) { + } else { + break; + } + let x_131 : i32 = tree[x_124].data; + if ((15 <= x_131)) { + let x_144 : ptr = &(tree[x_124].leftIndex); + let x_145 : i32 = *(x_144); + if ((x_145 == -1)) { + *(x_144) = 3; + tree[3] = BST(15, -1, -1); + x_152_phi = true; + break; + } else { + x_150 = *(x_144); + x_125_phi = x_150; + continue; + } + return; + } else { + let x_136 : ptr = &(tree[x_124].rightIndex); + let x_137 : i32 = *(x_136); + if ((x_137 == -1)) { + *(x_136) = 3; + tree[3] = BST(15, -1, -1); + x_152_phi = true; + break; + } else { + x_142 = *(x_136); + x_125_phi = x_142; + continue; + } + return; + } + return; + + continuing { + x_125 = x_125_phi; + x_124_phi = x_125; + } + } + let x_152 : bool = x_152_phi; + if (x_152) { + break; + } + } + } + var x_157_phi : i32; + var x_185_phi : bool; + switch(0u) { + default: { + x_157_phi = 0; + loop { + var x_183 : i32; + var x_175 : i32; + var x_158 : i32; + var x_158_phi : i32; + let x_157 : i32 = x_157_phi; + x_185_phi = false; + if ((x_157 <= 4)) { + } else { + break; + } + let x_164 : i32 = tree[x_157].data; + if ((7 <= x_164)) { + let x_177 : ptr = &(tree[x_157].leftIndex); + let x_178 : i32 = *(x_177); + if ((x_178 == -1)) { + *(x_177) = 4; + tree[4] = BST(7, -1, -1); + x_185_phi = true; + break; + } else { + x_183 = *(x_177); + x_158_phi = x_183; + continue; + } + return; + } else { + let x_169 : ptr = &(tree[x_157].rightIndex); + let x_170 : i32 = *(x_169); + if ((x_170 == -1)) { + *(x_169) = 4; + tree[4] = BST(7, -1, -1); + x_185_phi = true; + break; + } else { + x_175 = *(x_169); + x_158_phi = x_175; + continue; + } + return; + } + return; + + continuing { + x_158 = x_158_phi; + x_157_phi = x_158; + } + } + let x_185 : bool = x_185_phi; + if (x_185) { + break; + } + } + } + var x_190_phi : i32; + var x_218_phi : bool; + switch(0u) { + default: { + x_190_phi = 0; + loop { + var x_216 : i32; + var x_208 : i32; + var x_191 : i32; + var x_191_phi : i32; + let x_190 : i32 = x_190_phi; + x_218_phi = false; + if ((x_190 <= 5)) { + } else { + break; + } + let x_197 : i32 = tree[x_190].data; + if ((8 <= x_197)) { + let x_210 : ptr = &(tree[x_190].leftIndex); + let x_211 : i32 = *(x_210); + if ((x_211 == -1)) { + *(x_210) = 5; + tree[5] = BST(8, -1, -1); + x_218_phi = true; + break; + } else { + x_216 = *(x_210); + x_191_phi = x_216; + continue; + } + return; + } else { + let x_202 : ptr = &(tree[x_190].rightIndex); + let x_203 : i32 = *(x_202); + if ((x_203 == -1)) { + *(x_202) = 5; + tree[5] = BST(8, -1, -1); + x_218_phi = true; + break; + } else { + x_208 = *(x_202); + x_191_phi = x_208; + continue; + } + return; + } + return; + + continuing { + x_191 = x_191_phi; + x_190_phi = x_191; + } + } + let x_218 : bool = x_218_phi; + if (x_218) { + break; + } + } + } + var x_223_phi : i32; + var x_251_phi : bool; + switch(0u) { + default: { + x_223_phi = 0; + loop { + var x_249 : i32; + var x_241 : i32; + var x_224 : i32; + var x_224_phi : i32; + let x_223 : i32 = x_223_phi; + x_251_phi = false; + if ((x_223 <= 6)) { + } else { + break; + } + let x_230 : i32 = tree[x_223].data; + if ((2 <= x_230)) { + let x_243 : ptr = &(tree[x_223].leftIndex); + let x_244 : i32 = *(x_243); + if ((x_244 == -1)) { + *(x_243) = 6; + tree[6] = BST(2, -1, -1); + x_251_phi = true; + break; + } else { + x_249 = *(x_243); + x_224_phi = x_249; + continue; + } + return; + } else { + let x_235 : ptr = &(tree[x_223].rightIndex); + let x_236 : i32 = *(x_235); + if ((x_236 == -1)) { + *(x_235) = 6; + tree[6] = BST(2, -1, -1); + x_251_phi = true; + break; + } else { + x_241 = *(x_235); + x_224_phi = x_241; + continue; + } + return; + } + return; + + continuing { + x_224 = x_224_phi; + x_223_phi = x_224; + } + } + let x_251 : bool = x_251_phi; + if (x_251) { + break; + } + } + } + var x_256_phi : i32; + var x_284_phi : bool; + switch(0u) { + default: { + x_256_phi = 0; + loop { + var x_282 : i32; + var x_274 : i32; + var x_257 : i32; + var x_257_phi : i32; + let x_256 : i32 = x_256_phi; + x_284_phi = false; + if ((x_256 <= 7)) { + } else { + break; + } + let x_263 : i32 = tree[x_256].data; + if ((6 <= x_263)) { + let x_276 : ptr = &(tree[x_256].leftIndex); + let x_277 : i32 = *(x_276); + if ((x_277 == -1)) { + *(x_276) = 7; + tree[7] = BST(6, -1, -1); + x_284_phi = true; + break; + } else { + x_282 = *(x_276); + x_257_phi = x_282; + continue; + } + return; + } else { + let x_268 : ptr = &(tree[x_256].rightIndex); + let x_269 : i32 = *(x_268); + if ((x_269 == -1)) { + *(x_268) = 7; + tree[7] = BST(6, -1, -1); + x_284_phi = true; + break; + } else { + x_274 = *(x_268); + x_257_phi = x_274; + continue; + } + return; + } + return; + + continuing { + x_257 = x_257_phi; + x_256_phi = x_257; + } + } + let x_284 : bool = x_284_phi; + if (x_284) { + break; + } + } + } + var x_289_phi : i32; + var x_317_phi : bool; + switch(0u) { + default: { + x_289_phi = 0; + loop { + var x_315 : i32; + var x_307 : i32; + var x_290 : i32; + var x_290_phi : i32; + let x_289 : i32 = x_289_phi; + x_317_phi = false; + if ((x_289 <= 8)) { + } else { + break; + } + let x_296 : i32 = tree[x_289].data; + if ((17 <= x_296)) { + let x_309 : ptr = &(tree[x_289].leftIndex); + let x_310 : i32 = *(x_309); + if ((x_310 == -1)) { + *(x_309) = 8; + tree[8] = BST(17, -1, -1); + x_317_phi = true; + break; + } else { + x_315 = *(x_309); + x_290_phi = x_315; + continue; + } + return; + } else { + let x_301 : ptr = &(tree[x_289].rightIndex); + let x_302 : i32 = *(x_301); + if ((x_302 == -1)) { + *(x_301) = 8; + tree[8] = BST(17, -1, -1); + x_317_phi = true; + break; + } else { + x_307 = *(x_301); + x_290_phi = x_307; + continue; + } + return; + } + return; + + continuing { + x_290 = x_290_phi; + x_289_phi = x_290; + } + } + let x_317 : bool = x_317_phi; + if (x_317) { + break; + } + } + } + var x_322_phi : i32; + var x_350_phi : bool; + switch(0u) { + default: { + x_322_phi = 0; + loop { + var x_348 : i32; + var x_340 : i32; + var x_323 : i32; + var x_323_phi : i32; + let x_322 : i32 = x_322_phi; + x_350_phi = false; + if ((x_322 <= 9)) { + } else { + break; + } + let x_329 : i32 = tree[x_322].data; + if ((13 <= x_329)) { + let x_342 : ptr = &(tree[x_322].leftIndex); + let x_343 : i32 = *(x_342); + if ((x_343 == -1)) { + *(x_342) = 9; + tree[9] = BST(13, -1, -1); + x_350_phi = true; + break; + } else { + x_348 = *(x_342); + x_323_phi = x_348; + continue; + } + return; + } else { + let x_334 : ptr = &(tree[x_322].rightIndex); + let x_335 : i32 = *(x_334); + if ((x_335 == -1)) { + *(x_334) = 9; + tree[9] = BST(13, -1, -1); + x_350_phi = true; + break; + } else { + x_340 = *(x_334); + x_323_phi = x_340; + continue; + } + return; + } + return; + + continuing { + x_323 = x_323_phi; + x_322_phi = x_323; + } + } + let x_350 : bool = x_350_phi; + if (x_350) { + break; + } + } + } + x_353_phi = 0; + x_356_phi = 0; + x_358_phi = 0; + loop { + var x_381 : i32; + var x_391 : i32; + var x_396 : i32; + var x_359 : i32; + var x_354_phi : i32; + var x_357_phi : i32; + let x_353 : i32 = x_353_phi; + x_356 = x_356_phi; + let x_358 : i32 = x_358_phi; + if ((x_358 < 20)) { + } else { + break; + } + var x_366_phi : i32; + var x_381_phi : i32; + var x_382_phi : bool; + switch(0u) { + default: { + x_366_phi = 0; + loop { + let x_366 : i32 = x_366_phi; + x_381_phi = x_353; + x_382_phi = false; + if ((x_366 != -1)) { + } else { + break; + } + let x_373 : BST = tree[x_366]; + let x_374 : i32 = x_373.data; + let x_375 : i32 = x_373.leftIndex; + let x_376 : i32 = x_373.rightIndex; + if ((x_374 == x_358)) { + x_381_phi = x_358; + x_382_phi = true; + break; + } + + continuing { + x_366_phi = select(x_375, x_376, (x_358 > x_374)); + } + } + x_381 = x_381_phi; + let x_382 : bool = x_382_phi; + x_354_phi = x_381; + if (x_382) { + break; + } + x_354_phi = -1; + } + } + var x_354 : i32; + var x_390 : i32; + var x_395 : i32; + var x_391_phi : i32; + var x_396_phi : i32; + x_354 = x_354_phi; + switch(x_358) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + x_391_phi = x_356; + if ((x_354 == bitcast(x_358))) { + x_390 = bitcast((x_356 + bitcast(1))); + x_391_phi = x_390; + } + x_391 = x_391_phi; + x_357_phi = x_391; + } + default: { + x_396_phi = x_356; + if ((x_354 == bitcast(-1))) { + x_395 = bitcast((x_356 + bitcast(1))); + x_396_phi = x_395; + } + x_396 = x_396_phi; + x_357_phi = x_396; + } + } + let x_357 : i32 = x_357_phi; + + continuing { + x_359 = (x_358 + 1); + x_353_phi = x_354; + x_356_phi = x_357; + x_358_phi = x_359; + } + } + if ((x_356 == bitcast(20))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm new file mode 100644 index 0000000000..235ec037e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm @@ -0,0 +1,1053 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree "tree" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_0 = OpConstant %uint 0 + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool +%_ptr_Function__arr_BST_uint_10 = OpTypePointer Function %_arr_BST_uint_10 + %49 = OpUndef %int + %50 = OpConstantComposite %BST %int_9 %int_n1 %int_n1 + %51 = OpConstantComposite %BST %int_5 %int_n1 %int_n1 + %int_3 = OpConstant %int 3 + %53 = OpConstantComposite %BST %int_12 %int_n1 %int_n1 + %54 = OpConstantComposite %BST %int_15 %int_n1 %int_n1 + %int_4 = OpConstant %int 4 + %56 = OpConstantComposite %BST %int_7 %int_n1 %int_n1 + %57 = OpConstantComposite %BST %int_8 %int_n1 %int_n1 + %58 = OpConstantComposite %BST %int_2 %int_n1 %int_n1 + %59 = OpConstantComposite %BST %int_6 %int_n1 %int_n1 + %60 = OpConstantComposite %BST %int_17 %int_n1 %int_n1 + %61 = OpConstantComposite %BST %int_13 %int_n1 %int_n1 + %main = OpFunction %void None %10 + %62 = OpLabel + %tree = OpVariable %_ptr_Function__arr_BST_uint_10 Function + %63 = OpAccessChain %_ptr_Function_BST %tree %int_0 + OpStore %63 %50 + OpSelectionMerge %64 None + OpSwitch %uint_0 %65 + %65 = OpLabel + OpBranch %66 + %66 = OpLabel + %67 = OpPhi %bool %false %65 %68 %69 + %70 = OpPhi %int %int_0 %65 %71 %69 + %72 = OpSLessThanEqual %bool %70 %int_1 + OpLoopMerge %73 %69 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpAccessChain %_ptr_Function_int %tree %70 %int_0 + %76 = OpLoad %int %75 + %77 = OpSLessThanEqual %bool %int_5 %76 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %80 = OpLabel + %81 = OpAccessChain %_ptr_Function_int %tree %70 %int_2 + %82 = OpLoad %int %81 + %83 = OpIEqual %bool %82 %int_n1 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %86 = OpLabel + %87 = OpLoad %int %81 + OpBranch %69 + %85 = OpLabel + OpStore %81 %int_1 + %88 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %88 %51 + OpBranch %73 + %84 = OpLabel + OpUnreachable + %79 = OpLabel + %89 = OpAccessChain %_ptr_Function_int %tree %70 %int_1 + %90 = OpLoad %int %89 + %91 = OpIEqual %bool %90 %int_n1 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %94 + %94 = OpLabel + %95 = OpLoad %int %89 + OpBranch %69 + %93 = OpLabel + %96 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %97 = OpLoad %float %96 + %98 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %99 = OpLoad %float %98 + %100 = OpFOrdLessThan %bool %97 %99 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + OpBranch %103 + %103 = OpLabel + OpLoopMerge %104 %105 None + OpBranch %106 + %106 = OpLabel + OpKill + %105 = OpLabel + OpBranch %103 + %104 = OpLabel + OpUnreachable + %101 = OpLabel + OpStore %89 %int_1 + %107 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %107 %51 + OpBranch %108 + %108 = OpLabel + %109 = OpConvertFToS %int %97 + %110 = OpSLessThan %bool %int_0 %109 + OpLoopMerge %111 %112 None + OpBranchConditional %110 %113 %111 + %113 = OpLabel + OpBranch %111 + %112 = OpLabel + OpBranch %108 + %111 = OpLabel + %114 = OpPhi %bool %67 %108 %true %113 + OpSelectionMerge %115 None + OpBranchConditional %114 %73 %115 + %115 = OpLabel + OpBranch %92 + %92 = OpLabel + OpBranch %78 + %78 = OpLabel + OpBranch %69 + %69 = OpLabel + %68 = OpPhi %bool %67 %94 %67 %86 %114 %78 + %71 = OpPhi %int %95 %94 %87 %86 %70 %78 + OpBranch %66 + %73 = OpLabel + %116 = OpPhi %bool %67 %66 %114 %111 %true %85 + OpSelectionMerge %117 None + OpBranchConditional %116 %64 %117 + %117 = OpLabel + OpBranch %64 + %64 = OpLabel + OpBranch %118 + %118 = OpLabel + %119 = OpPhi %int %int_0 %64 %120 %121 + OpLoopMerge %122 %121 None + OpBranch %123 + %123 = OpLabel + %124 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %125 = OpLoad %float %124 + %126 = OpFOrdLessThan %bool %125 %float_0 + %127 = OpLogicalNot %bool %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %128 + %129 = OpLabel + %130 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %131 = OpLoad %float %130 + %132 = OpConvertFToS %int %131 + %133 = OpINotEqual %bool %119 %132 + OpBranch %128 + %128 = OpLabel + %134 = OpPhi %bool %126 %123 %133 %129 + OpBranchConditional %134 %135 %122 + %135 = OpLabel + OpSelectionMerge %136 None + OpSwitch %uint_0 %137 + %137 = OpLabel + OpBranch %138 + %138 = OpLabel + %139 = OpPhi %bool %false %137 %140 %141 + %142 = OpPhi %int %int_0 %137 %143 %141 + %144 = OpSLessThanEqual %bool %142 %int_2 + OpLoopMerge %145 %141 None + OpBranchConditional %144 %146 %145 + %146 = OpLabel + %147 = OpAccessChain %_ptr_Function_int %tree %142 %int_0 + %148 = OpLoad %int %147 + %149 = OpSLessThanEqual %bool %int_12 %148 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %152 + %152 = OpLabel + %153 = OpAccessChain %_ptr_Function_int %tree %142 %int_2 + %154 = OpLoad %int %153 + %155 = OpIEqual %bool %154 %int_n1 + OpSelectionMerge %156 None + OpBranchConditional %155 %157 %158 + %158 = OpLabel + %159 = OpLoad %int %153 + OpBranch %141 + %157 = OpLabel + OpStore %153 %int_2 + %160 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %160 %53 + OpBranch %145 + %156 = OpLabel + OpUnreachable + %151 = OpLabel + %161 = OpAccessChain %_ptr_Function_int %tree %142 %int_1 + %162 = OpLoad %int %161 + %163 = OpIEqual %bool %162 %int_n1 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %166 + %166 = OpLabel + %167 = OpLoad %int %161 + OpBranch %141 + %165 = OpLabel + %168 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %169 = OpLoad %float %168 + %170 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %171 = OpLoad %float %170 + %172 = OpFOrdLessThan %bool %169 %171 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %173 + %174 = OpLabel + OpBranch %175 + %175 = OpLabel + OpLoopMerge %176 %177 None + OpBranch %178 + %178 = OpLabel + OpKill + %177 = OpLabel + OpBranch %175 + %176 = OpLabel + OpUnreachable + %173 = OpLabel + OpStore %161 %int_2 + %179 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %179 %53 + OpBranch %180 + %180 = OpLabel + %181 = OpConvertFToS %int %169 + %182 = OpSLessThan %bool %int_0 %181 + OpLoopMerge %183 %184 None + OpBranchConditional %182 %185 %183 + %185 = OpLabel + OpBranch %183 + %184 = OpLabel + OpBranch %180 + %183 = OpLabel + %186 = OpPhi %bool %139 %180 %true %185 + OpSelectionMerge %187 None + OpBranchConditional %186 %145 %187 + %187 = OpLabel + OpBranch %164 + %164 = OpLabel + OpBranch %150 + %150 = OpLabel + OpBranch %141 + %141 = OpLabel + %140 = OpPhi %bool %139 %166 %139 %158 %186 %150 + %143 = OpPhi %int %167 %166 %159 %158 %142 %150 + OpBranch %138 + %145 = OpLabel + %188 = OpPhi %bool %139 %138 %186 %183 %true %157 + OpSelectionMerge %189 None + OpBranchConditional %188 %136 %189 + %189 = OpLabel + OpBranch %136 + %136 = OpLabel + OpBranch %121 + %121 = OpLabel + %120 = OpIAdd %int %119 %int_1 + OpBranch %118 + %122 = OpLabel + OpSelectionMerge %190 None + OpSwitch %uint_0 %191 + %191 = OpLabel + OpBranch %192 + %192 = OpLabel + %193 = OpPhi %bool %false %191 %194 %195 + %196 = OpPhi %int %int_0 %191 %197 %195 + %198 = OpSLessThanEqual %bool %196 %int_3 + OpLoopMerge %199 %195 None + OpBranchConditional %198 %200 %199 + %200 = OpLabel + %201 = OpAccessChain %_ptr_Function_int %tree %196 %int_0 + %202 = OpLoad %int %201 + %203 = OpSLessThanEqual %bool %int_15 %202 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %206 + %206 = OpLabel + %207 = OpAccessChain %_ptr_Function_int %tree %196 %int_2 + %208 = OpLoad %int %207 + %209 = OpIEqual %bool %208 %int_n1 + OpSelectionMerge %210 None + OpBranchConditional %209 %211 %212 + %212 = OpLabel + %213 = OpLoad %int %207 + OpBranch %195 + %211 = OpLabel + OpStore %207 %int_3 + %214 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %214 %54 + OpBranch %199 + %210 = OpLabel + OpUnreachable + %205 = OpLabel + %215 = OpAccessChain %_ptr_Function_int %tree %196 %int_1 + %216 = OpLoad %int %215 + %217 = OpIEqual %bool %216 %int_n1 + OpSelectionMerge %218 None + OpBranchConditional %217 %219 %220 + %220 = OpLabel + %221 = OpLoad %int %215 + OpBranch %195 + %219 = OpLabel + %222 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %223 = OpLoad %float %222 + %224 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %225 = OpLoad %float %224 + %226 = OpFOrdLessThan %bool %223 %225 + OpSelectionMerge %227 None + OpBranchConditional %226 %228 %227 + %228 = OpLabel + OpBranch %229 + %229 = OpLabel + OpLoopMerge %230 %231 None + OpBranch %232 + %232 = OpLabel + OpKill + %231 = OpLabel + OpBranch %229 + %230 = OpLabel + OpUnreachable + %227 = OpLabel + OpStore %215 %int_3 + %233 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %233 %54 + OpBranch %234 + %234 = OpLabel + %235 = OpConvertFToS %int %223 + %236 = OpSLessThan %bool %int_0 %235 + OpLoopMerge %237 %238 None + OpBranchConditional %236 %239 %237 + %239 = OpLabel + OpBranch %237 + %238 = OpLabel + OpBranch %234 + %237 = OpLabel + %240 = OpPhi %bool %193 %234 %true %239 + OpSelectionMerge %241 None + OpBranchConditional %240 %199 %241 + %241 = OpLabel + OpBranch %218 + %218 = OpLabel + OpBranch %204 + %204 = OpLabel + OpBranch %195 + %195 = OpLabel + %194 = OpPhi %bool %193 %220 %193 %212 %240 %204 + %197 = OpPhi %int %221 %220 %213 %212 %196 %204 + OpBranch %192 + %199 = OpLabel + %242 = OpPhi %bool %193 %192 %240 %237 %true %211 + OpSelectionMerge %243 None + OpBranchConditional %242 %190 %243 + %243 = OpLabel + OpBranch %190 + %190 = OpLabel + OpSelectionMerge %244 None + OpSwitch %uint_0 %245 + %245 = OpLabel + OpBranch %246 + %246 = OpLabel + %247 = OpPhi %bool %false %245 %248 %249 + %250 = OpPhi %int %int_0 %245 %251 %249 + %252 = OpSLessThanEqual %bool %250 %int_4 + OpLoopMerge %253 %249 None + OpBranchConditional %252 %254 %253 + %254 = OpLabel + %255 = OpAccessChain %_ptr_Function_int %tree %250 %int_0 + %256 = OpLoad %int %255 + %257 = OpSLessThanEqual %bool %int_7 %256 + OpSelectionMerge %258 None + OpBranchConditional %257 %259 %260 + %260 = OpLabel + %261 = OpAccessChain %_ptr_Function_int %tree %250 %int_2 + %262 = OpLoad %int %261 + %263 = OpIEqual %bool %262 %int_n1 + OpSelectionMerge %264 None + OpBranchConditional %263 %265 %266 + %266 = OpLabel + %267 = OpLoad %int %261 + OpBranch %249 + %265 = OpLabel + OpStore %261 %int_4 + %268 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %268 %56 + OpBranch %253 + %264 = OpLabel + OpUnreachable + %259 = OpLabel + %269 = OpAccessChain %_ptr_Function_int %tree %250 %int_1 + %270 = OpLoad %int %269 + %271 = OpIEqual %bool %270 %int_n1 + OpSelectionMerge %272 None + OpBranchConditional %271 %273 %274 + %274 = OpLabel + %275 = OpLoad %int %269 + OpBranch %249 + %273 = OpLabel + %276 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %277 = OpLoad %float %276 + %278 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %279 = OpLoad %float %278 + %280 = OpFOrdLessThan %bool %277 %279 + OpSelectionMerge %281 None + OpBranchConditional %280 %282 %281 + %282 = OpLabel + OpBranch %283 + %283 = OpLabel + OpLoopMerge %284 %285 None + OpBranch %286 + %286 = OpLabel + OpKill + %285 = OpLabel + OpBranch %283 + %284 = OpLabel + OpUnreachable + %281 = OpLabel + OpStore %269 %int_4 + %287 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %287 %56 + OpBranch %288 + %288 = OpLabel + %289 = OpConvertFToS %int %277 + %290 = OpSLessThan %bool %int_0 %289 + OpLoopMerge %291 %292 None + OpBranchConditional %290 %293 %291 + %293 = OpLabel + OpBranch %291 + %292 = OpLabel + OpBranch %288 + %291 = OpLabel + %294 = OpPhi %bool %247 %288 %true %293 + OpSelectionMerge %295 None + OpBranchConditional %294 %253 %295 + %295 = OpLabel + OpBranch %272 + %272 = OpLabel + OpBranch %258 + %258 = OpLabel + OpBranch %249 + %249 = OpLabel + %248 = OpPhi %bool %247 %274 %247 %266 %294 %258 + %251 = OpPhi %int %275 %274 %267 %266 %250 %258 + OpBranch %246 + %253 = OpLabel + %296 = OpPhi %bool %247 %246 %294 %291 %true %265 + OpSelectionMerge %297 None + OpBranchConditional %296 %244 %297 + %297 = OpLabel + OpBranch %244 + %244 = OpLabel + OpSelectionMerge %298 None + OpSwitch %uint_0 %299 + %299 = OpLabel + OpBranch %300 + %300 = OpLabel + %301 = OpPhi %bool %false %299 %302 %303 + %304 = OpPhi %int %int_0 %299 %305 %303 + %306 = OpSLessThanEqual %bool %304 %int_5 + OpLoopMerge %307 %303 None + OpBranchConditional %306 %308 %307 + %308 = OpLabel + %309 = OpAccessChain %_ptr_Function_int %tree %304 %int_0 + %310 = OpLoad %int %309 + %311 = OpSLessThanEqual %bool %int_8 %310 + OpSelectionMerge %312 None + OpBranchConditional %311 %313 %314 + %314 = OpLabel + %315 = OpAccessChain %_ptr_Function_int %tree %304 %int_2 + %316 = OpLoad %int %315 + %317 = OpIEqual %bool %316 %int_n1 + OpSelectionMerge %318 None + OpBranchConditional %317 %319 %320 + %320 = OpLabel + %321 = OpLoad %int %315 + OpBranch %303 + %319 = OpLabel + OpStore %315 %int_5 + %322 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %322 %57 + OpBranch %307 + %318 = OpLabel + OpUnreachable + %313 = OpLabel + %323 = OpAccessChain %_ptr_Function_int %tree %304 %int_1 + %324 = OpLoad %int %323 + %325 = OpIEqual %bool %324 %int_n1 + OpSelectionMerge %326 None + OpBranchConditional %325 %327 %328 + %328 = OpLabel + %329 = OpLoad %int %323 + OpBranch %303 + %327 = OpLabel + %330 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %331 = OpLoad %float %330 + %332 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %333 = OpLoad %float %332 + %334 = OpFOrdLessThan %bool %331 %333 + OpSelectionMerge %335 None + OpBranchConditional %334 %336 %335 + %336 = OpLabel + OpBranch %337 + %337 = OpLabel + OpLoopMerge %338 %339 None + OpBranch %340 + %340 = OpLabel + OpKill + %339 = OpLabel + OpBranch %337 + %338 = OpLabel + OpUnreachable + %335 = OpLabel + OpStore %323 %int_5 + %341 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %341 %57 + OpBranch %342 + %342 = OpLabel + %343 = OpConvertFToS %int %331 + %344 = OpSLessThan %bool %int_0 %343 + OpLoopMerge %345 %346 None + OpBranchConditional %344 %347 %345 + %347 = OpLabel + OpBranch %345 + %346 = OpLabel + OpBranch %342 + %345 = OpLabel + %348 = OpPhi %bool %301 %342 %true %347 + OpSelectionMerge %349 None + OpBranchConditional %348 %307 %349 + %349 = OpLabel + OpBranch %326 + %326 = OpLabel + OpBranch %312 + %312 = OpLabel + OpBranch %303 + %303 = OpLabel + %302 = OpPhi %bool %301 %328 %301 %320 %348 %312 + %305 = OpPhi %int %329 %328 %321 %320 %304 %312 + OpBranch %300 + %307 = OpLabel + %350 = OpPhi %bool %301 %300 %348 %345 %true %319 + OpSelectionMerge %351 None + OpBranchConditional %350 %298 %351 + %351 = OpLabel + OpBranch %298 + %298 = OpLabel + OpSelectionMerge %352 None + OpSwitch %uint_0 %353 + %353 = OpLabel + OpBranch %354 + %354 = OpLabel + %355 = OpPhi %bool %false %353 %356 %357 + %358 = OpPhi %int %int_0 %353 %359 %357 + %360 = OpSLessThanEqual %bool %358 %int_6 + OpLoopMerge %361 %357 None + OpBranchConditional %360 %362 %361 + %362 = OpLabel + %363 = OpAccessChain %_ptr_Function_int %tree %358 %int_0 + %364 = OpLoad %int %363 + %365 = OpSLessThanEqual %bool %int_2 %364 + OpSelectionMerge %366 None + OpBranchConditional %365 %367 %368 + %368 = OpLabel + %369 = OpAccessChain %_ptr_Function_int %tree %358 %int_2 + %370 = OpLoad %int %369 + %371 = OpIEqual %bool %370 %int_n1 + OpSelectionMerge %372 None + OpBranchConditional %371 %373 %374 + %374 = OpLabel + %375 = OpLoad %int %369 + OpBranch %357 + %373 = OpLabel + OpStore %369 %int_6 + %376 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %376 %58 + OpBranch %361 + %372 = OpLabel + OpUnreachable + %367 = OpLabel + %377 = OpAccessChain %_ptr_Function_int %tree %358 %int_1 + %378 = OpLoad %int %377 + %379 = OpIEqual %bool %378 %int_n1 + OpSelectionMerge %380 None + OpBranchConditional %379 %381 %382 + %382 = OpLabel + %383 = OpLoad %int %377 + OpBranch %357 + %381 = OpLabel + %384 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %385 = OpLoad %float %384 + %386 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %387 = OpLoad %float %386 + %388 = OpFOrdLessThan %bool %385 %387 + OpSelectionMerge %389 None + OpBranchConditional %388 %390 %389 + %390 = OpLabel + OpBranch %391 + %391 = OpLabel + OpLoopMerge %392 %393 None + OpBranch %394 + %394 = OpLabel + OpKill + %393 = OpLabel + OpBranch %391 + %392 = OpLabel + OpUnreachable + %389 = OpLabel + OpStore %377 %int_6 + %395 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %395 %58 + OpBranch %396 + %396 = OpLabel + %397 = OpConvertFToS %int %385 + %398 = OpSLessThan %bool %int_0 %397 + OpLoopMerge %399 %400 None + OpBranchConditional %398 %401 %399 + %401 = OpLabel + OpBranch %399 + %400 = OpLabel + OpBranch %396 + %399 = OpLabel + %402 = OpPhi %bool %355 %396 %true %401 + OpSelectionMerge %403 None + OpBranchConditional %402 %361 %403 + %403 = OpLabel + OpBranch %380 + %380 = OpLabel + OpBranch %366 + %366 = OpLabel + OpBranch %357 + %357 = OpLabel + %356 = OpPhi %bool %355 %382 %355 %374 %402 %366 + %359 = OpPhi %int %383 %382 %375 %374 %358 %366 + OpBranch %354 + %361 = OpLabel + %404 = OpPhi %bool %355 %354 %402 %399 %true %373 + OpSelectionMerge %405 None + OpBranchConditional %404 %352 %405 + %405 = OpLabel + OpBranch %352 + %352 = OpLabel + OpSelectionMerge %406 None + OpSwitch %uint_0 %407 + %407 = OpLabel + OpBranch %408 + %408 = OpLabel + %409 = OpPhi %bool %false %407 %410 %411 + %412 = OpPhi %int %int_0 %407 %413 %411 + %414 = OpSLessThanEqual %bool %412 %int_7 + OpLoopMerge %415 %411 None + OpBranchConditional %414 %416 %415 + %416 = OpLabel + %417 = OpAccessChain %_ptr_Function_int %tree %412 %int_0 + %418 = OpLoad %int %417 + %419 = OpSLessThanEqual %bool %int_6 %418 + OpSelectionMerge %420 None + OpBranchConditional %419 %421 %422 + %422 = OpLabel + %423 = OpAccessChain %_ptr_Function_int %tree %412 %int_2 + %424 = OpLoad %int %423 + %425 = OpIEqual %bool %424 %int_n1 + OpSelectionMerge %426 None + OpBranchConditional %425 %427 %428 + %428 = OpLabel + %429 = OpLoad %int %423 + OpBranch %411 + %427 = OpLabel + OpStore %423 %int_7 + %430 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %430 %59 + OpBranch %415 + %426 = OpLabel + OpUnreachable + %421 = OpLabel + %431 = OpAccessChain %_ptr_Function_int %tree %412 %int_1 + %432 = OpLoad %int %431 + %433 = OpIEqual %bool %432 %int_n1 + OpSelectionMerge %434 None + OpBranchConditional %433 %435 %436 + %436 = OpLabel + %437 = OpLoad %int %431 + OpBranch %411 + %435 = OpLabel + %438 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %439 = OpLoad %float %438 + %440 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %441 = OpLoad %float %440 + %442 = OpFOrdLessThan %bool %439 %441 + OpSelectionMerge %443 None + OpBranchConditional %442 %444 %443 + %444 = OpLabel + OpBranch %445 + %445 = OpLabel + OpLoopMerge %446 %447 None + OpBranch %448 + %448 = OpLabel + OpKill + %447 = OpLabel + OpBranch %445 + %446 = OpLabel + OpUnreachable + %443 = OpLabel + OpStore %431 %int_7 + %449 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %449 %59 + OpBranch %450 + %450 = OpLabel + %451 = OpConvertFToS %int %439 + %452 = OpSLessThan %bool %int_0 %451 + OpLoopMerge %453 %454 None + OpBranchConditional %452 %455 %453 + %455 = OpLabel + OpBranch %453 + %454 = OpLabel + OpBranch %450 + %453 = OpLabel + %456 = OpPhi %bool %409 %450 %true %455 + OpSelectionMerge %457 None + OpBranchConditional %456 %415 %457 + %457 = OpLabel + OpBranch %434 + %434 = OpLabel + OpBranch %420 + %420 = OpLabel + OpBranch %411 + %411 = OpLabel + %410 = OpPhi %bool %409 %436 %409 %428 %456 %420 + %413 = OpPhi %int %437 %436 %429 %428 %412 %420 + OpBranch %408 + %415 = OpLabel + %458 = OpPhi %bool %409 %408 %456 %453 %true %427 + OpSelectionMerge %459 None + OpBranchConditional %458 %406 %459 + %459 = OpLabel + OpBranch %406 + %406 = OpLabel + OpSelectionMerge %460 None + OpSwitch %uint_0 %461 + %461 = OpLabel + OpBranch %462 + %462 = OpLabel + %463 = OpPhi %bool %false %461 %464 %465 + %466 = OpPhi %int %int_0 %461 %467 %465 + %468 = OpSLessThanEqual %bool %466 %int_8 + OpLoopMerge %469 %465 None + OpBranchConditional %468 %470 %469 + %470 = OpLabel + %471 = OpAccessChain %_ptr_Function_int %tree %466 %int_0 + %472 = OpLoad %int %471 + %473 = OpSLessThanEqual %bool %int_17 %472 + OpSelectionMerge %474 None + OpBranchConditional %473 %475 %476 + %476 = OpLabel + %477 = OpAccessChain %_ptr_Function_int %tree %466 %int_2 + %478 = OpLoad %int %477 + %479 = OpIEqual %bool %478 %int_n1 + OpSelectionMerge %480 None + OpBranchConditional %479 %481 %482 + %482 = OpLabel + %483 = OpLoad %int %477 + OpBranch %465 + %481 = OpLabel + OpStore %477 %int_8 + %484 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %484 %60 + OpBranch %469 + %480 = OpLabel + OpUnreachable + %475 = OpLabel + %485 = OpAccessChain %_ptr_Function_int %tree %466 %int_1 + %486 = OpLoad %int %485 + %487 = OpIEqual %bool %486 %int_n1 + OpSelectionMerge %488 None + OpBranchConditional %487 %489 %490 + %490 = OpLabel + %491 = OpLoad %int %485 + OpBranch %465 + %489 = OpLabel + %492 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %493 = OpLoad %float %492 + %494 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %495 = OpLoad %float %494 + %496 = OpFOrdLessThan %bool %493 %495 + OpSelectionMerge %497 None + OpBranchConditional %496 %498 %497 + %498 = OpLabel + OpBranch %499 + %499 = OpLabel + OpLoopMerge %500 %501 None + OpBranch %502 + %502 = OpLabel + OpKill + %501 = OpLabel + OpBranch %499 + %500 = OpLabel + OpUnreachable + %497 = OpLabel + OpStore %485 %int_8 + %503 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %503 %60 + OpBranch %504 + %504 = OpLabel + %505 = OpConvertFToS %int %493 + %506 = OpSLessThan %bool %int_0 %505 + OpLoopMerge %507 %508 None + OpBranchConditional %506 %509 %507 + %509 = OpLabel + OpBranch %507 + %508 = OpLabel + OpBranch %504 + %507 = OpLabel + %510 = OpPhi %bool %463 %504 %true %509 + OpSelectionMerge %511 None + OpBranchConditional %510 %469 %511 + %511 = OpLabel + OpBranch %488 + %488 = OpLabel + OpBranch %474 + %474 = OpLabel + OpBranch %465 + %465 = OpLabel + %464 = OpPhi %bool %463 %490 %463 %482 %510 %474 + %467 = OpPhi %int %491 %490 %483 %482 %466 %474 + OpBranch %462 + %469 = OpLabel + %512 = OpPhi %bool %463 %462 %510 %507 %true %481 + OpSelectionMerge %513 None + OpBranchConditional %512 %460 %513 + %513 = OpLabel + OpBranch %460 + %460 = OpLabel + OpSelectionMerge %514 None + OpSwitch %uint_0 %515 + %515 = OpLabel + OpBranch %516 + %516 = OpLabel + %517 = OpPhi %bool %false %515 %518 %519 + %520 = OpPhi %int %int_0 %515 %521 %519 + %522 = OpSLessThanEqual %bool %520 %int_9 + OpLoopMerge %523 %519 None + OpBranchConditional %522 %524 %523 + %524 = OpLabel + %525 = OpAccessChain %_ptr_Function_int %tree %520 %int_0 + %526 = OpLoad %int %525 + %527 = OpSLessThanEqual %bool %int_13 %526 + OpSelectionMerge %528 None + OpBranchConditional %527 %529 %530 + %530 = OpLabel + %531 = OpAccessChain %_ptr_Function_int %tree %520 %int_2 + %532 = OpLoad %int %531 + %533 = OpIEqual %bool %532 %int_n1 + OpSelectionMerge %534 None + OpBranchConditional %533 %535 %536 + %536 = OpLabel + %537 = OpLoad %int %531 + OpBranch %519 + %535 = OpLabel + OpStore %531 %int_9 + %538 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %538 %61 + OpBranch %523 + %534 = OpLabel + OpUnreachable + %529 = OpLabel + %539 = OpAccessChain %_ptr_Function_int %tree %520 %int_1 + %540 = OpLoad %int %539 + %541 = OpIEqual %bool %540 %int_n1 + OpSelectionMerge %542 None + OpBranchConditional %541 %543 %544 + %544 = OpLabel + %545 = OpLoad %int %539 + OpBranch %519 + %543 = OpLabel + %546 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %547 = OpLoad %float %546 + %548 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %549 = OpLoad %float %548 + %550 = OpFOrdLessThan %bool %547 %549 + OpSelectionMerge %551 None + OpBranchConditional %550 %552 %551 + %552 = OpLabel + OpBranch %553 + %553 = OpLabel + OpLoopMerge %554 %555 None + OpBranch %556 + %556 = OpLabel + OpKill + %555 = OpLabel + OpBranch %553 + %554 = OpLabel + OpUnreachable + %551 = OpLabel + OpStore %539 %int_9 + %557 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %557 %61 + OpBranch %558 + %558 = OpLabel + %559 = OpConvertFToS %int %547 + %560 = OpSLessThan %bool %int_0 %559 + OpLoopMerge %561 %562 None + OpBranchConditional %560 %563 %561 + %563 = OpLabel + OpBranch %561 + %562 = OpLabel + OpBranch %558 + %561 = OpLabel + %564 = OpPhi %bool %517 %558 %true %563 + OpSelectionMerge %565 None + OpBranchConditional %564 %523 %565 + %565 = OpLabel + OpBranch %542 + %542 = OpLabel + OpBranch %528 + %528 = OpLabel + OpBranch %519 + %519 = OpLabel + %518 = OpPhi %bool %517 %544 %517 %536 %564 %528 + %521 = OpPhi %int %545 %544 %537 %536 %520 %528 + OpBranch %516 + %523 = OpLabel + %566 = OpPhi %bool %517 %516 %564 %561 %true %535 + OpSelectionMerge %567 None + OpBranchConditional %566 %514 %567 + %567 = OpLabel + OpBranch %514 + %514 = OpLabel + OpBranch %568 + %568 = OpLabel + %569 = OpPhi %int %49 %514 %570 %571 + %572 = OpPhi %int %int_0 %514 %573 %571 + %574 = OpPhi %int %int_0 %514 %575 %571 + %576 = OpSLessThan %bool %574 %int_20 + OpLoopMerge %577 %571 None + OpBranchConditional %576 %578 %577 + %578 = OpLabel + OpSelectionMerge %579 None + OpSwitch %uint_0 %580 + %580 = OpLabel + OpBranch %581 + %581 = OpLabel + %582 = OpPhi %int %int_0 %580 %583 %584 + %585 = OpINotEqual %bool %582 %int_n1 + OpLoopMerge %586 %584 None + OpBranchConditional %585 %587 %586 + %587 = OpLabel + %588 = OpAccessChain %_ptr_Function_BST %tree %582 + %589 = OpLoad %BST %588 + %590 = OpCompositeExtract %int %589 0 + %591 = OpCompositeExtract %int %589 1 + %592 = OpCompositeExtract %int %589 2 + %593 = OpIEqual %bool %590 %574 + OpSelectionMerge %594 None + OpBranchConditional %593 %595 %594 + %595 = OpLabel + OpBranch %586 + %594 = OpLabel + %596 = OpSGreaterThan %bool %574 %590 + %583 = OpSelect %int %596 %592 %591 + OpBranch %584 + %584 = OpLabel + OpBranch %581 + %586 = OpLabel + %597 = OpPhi %int %569 %581 %574 %595 + %598 = OpPhi %bool %false %581 %true %595 + OpSelectionMerge %599 None + OpBranchConditional %598 %579 %599 + %599 = OpLabel + OpBranch %579 + %579 = OpLabel + %570 = OpPhi %int %597 %586 %int_n1 %599 + OpSelectionMerge %600 None + OpSwitch %574 %601 9 %602 5 %602 12 %602 15 %602 7 %602 8 %602 2 %602 6 %602 17 %602 13 %602 + %602 = OpLabel + %603 = OpIEqual %bool %570 %574 + OpSelectionMerge %604 None + OpBranchConditional %603 %605 %604 + %605 = OpLabel + %606 = OpIAdd %int %572 %int_1 + OpBranch %604 + %604 = OpLabel + %607 = OpPhi %int %572 %602 %606 %605 + OpBranch %600 + %601 = OpLabel + %608 = OpIEqual %bool %570 %int_n1 + OpSelectionMerge %609 None + OpBranchConditional %608 %610 %609 + %610 = OpLabel + %611 = OpIAdd %int %572 %int_1 + OpBranch %609 + %609 = OpLabel + %612 = OpPhi %int %572 %601 %611 %610 + OpBranch %600 + %600 = OpLabel + %573 = OpPhi %int %612 %609 %607 %604 + OpBranch %571 + %571 = OpLabel + %575 = OpIAdd %int %574 %int_1 + OpBranch %568 + %577 = OpLabel + %613 = OpIEqual %bool %572 %int_20 + OpSelectionMerge %614 None + OpBranchConditional %613 %615 %616 + %616 = OpLabel + OpStore %_GLF_color %45 + OpBranch %614 + %615 = OpLabel + OpStore %_GLF_color %44 + OpBranch %614 + %614 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.hlsl new file mode 100755 index 0000000000..5e07bc7391 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.hlsl @@ -0,0 +1,1151 @@ +SKIP: FAILED + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + BST tree[10] = (BST[10])0; + bool x_67 = false; + bool x_114 = false; + int x_572 = 0; + bool x_67_phi = false; + int x_70_phi = 0; + bool x_116_phi = false; + int x_119_phi = 0; + int x_569_phi = 0; + int x_572_phi = 0; + int x_574_phi = 0; + const BST tint_symbol_5 = {9, -1, -1}; + tree[0] = tint_symbol_5; + switch(0u) { + default: { + x_67_phi = false; + x_70_phi = 0; + while (true) { + int x_95 = 0; + int x_87 = 0; + bool x_68 = false; + int x_71 = 0; + bool x_68_phi = false; + int x_71_phi = 0; + x_67 = x_67_phi; + const int x_70 = x_70_phi; + x_116_phi = x_67; + if ((x_70 <= 1)) { + } else { + break; + } + const int x_76 = tree[x_70].data; + if ((5 <= x_76)) { + bool x_114_phi = false; + const int x_89_save = x_70; + const int x_90 = tree[x_89_save].leftIndex; + if ((x_90 == -1)) { + const float x_97 = asfloat(x_8[0].y); + const float x_99 = asfloat(x_8[0].x); + if ((x_97 < x_99)) { + while (true) { + discard; + } + return; + } + tree[x_89_save].leftIndex = 1; + const BST tint_symbol_6 = {5, -1, -1}; + tree[1] = tint_symbol_6; + while (true) { + x_114_phi = x_67; + if ((0 < int(x_97))) { + } else { + break; + } + x_114_phi = true; + break; + } + x_114 = x_114_phi; + x_116_phi = x_114; + if (x_114) { + break; + } + } else { + x_95 = tree[x_89_save].leftIndex; + x_68_phi = x_67; + x_71_phi = x_95; + { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + continue; + } + } else { + const int x_81_save = x_70; + const int x_82 = tree[x_81_save].rightIndex; + if ((x_82 == -1)) { + tree[x_81_save].rightIndex = 1; + const BST tint_symbol_7 = {5, -1, -1}; + tree[1] = tint_symbol_7; + x_116_phi = true; + break; + } else { + x_87 = tree[x_81_save].rightIndex; + x_68_phi = x_67; + x_71_phi = x_87; + { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + continue; + } + return; + } + x_68_phi = x_114; + x_71_phi = x_70; + { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + } + if (x_116_phi) { + break; + } + break; + } + } + x_119_phi = 0; + while (true) { + bool x_133 = false; + int x_120 = 0; + bool x_134_phi = false; + const int x_119 = x_119_phi; + const float x_125 = gl_FragCoord.y; + const bool x_126 = (x_125 < 0.0f); + x_134_phi = x_126; + if (!(x_126)) { + const float x_131 = asfloat(x_8[0].y); + x_133 = (x_119 != int(x_131)); + x_134_phi = x_133; + } + if (x_134_phi) { + } else { + break; + } + bool x_139 = false; + bool x_186 = false; + bool x_139_phi = false; + int x_142_phi = 0; + bool x_188_phi = false; + switch(0u) { + default: { + x_139_phi = false; + x_142_phi = 0; + while (true) { + int x_167 = 0; + int x_159 = 0; + bool x_140 = false; + int x_143 = 0; + bool x_140_phi = false; + int x_143_phi = 0; + x_139 = x_139_phi; + const int x_142 = x_142_phi; + x_188_phi = x_139; + if ((x_142 <= 2)) { + } else { + break; + } + const int x_148 = tree[x_142].data; + if ((12 <= x_148)) { + bool x_186_phi = false; + const int x_161_save = x_142; + const int x_162 = tree[x_161_save].leftIndex; + if ((x_162 == -1)) { + const float x_169 = asfloat(x_8[0].y); + const float x_171 = asfloat(x_8[0].x); + if ((x_169 < x_171)) { + while (true) { + discard; + } + return; + } + tree[x_161_save].leftIndex = 2; + const BST tint_symbol_8 = {12, -1, -1}; + tree[2] = tint_symbol_8; + while (true) { + x_186_phi = x_139; + if ((0 < int(x_169))) { + } else { + break; + } + x_186_phi = true; + break; + } + x_186 = x_186_phi; + x_188_phi = x_186; + if (x_186) { + break; + } + } else { + x_167 = tree[x_161_save].leftIndex; + x_140_phi = x_139; + x_143_phi = x_167; + { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + continue; + } + } else { + const int x_153_save = x_142; + const int x_154 = tree[x_153_save].rightIndex; + if ((x_154 == -1)) { + tree[x_153_save].rightIndex = 2; + const BST tint_symbol_9 = {12, -1, -1}; + tree[2] = tint_symbol_9; + x_188_phi = true; + break; + } else { + x_159 = tree[x_153_save].rightIndex; + x_140_phi = x_139; + x_143_phi = x_159; + { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + continue; + } + return; + } + x_140_phi = x_186; + x_143_phi = x_142; + { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + } + if (x_188_phi) { + break; + } + break; + } + } + { + x_120 = (x_119 + 1); + x_119_phi = x_120; + } + } + bool x_193 = false; + bool x_240 = false; + bool x_193_phi = false; + int x_196_phi = 0; + bool x_242_phi = false; + switch(0u) { + default: { + x_193_phi = false; + x_196_phi = 0; + while (true) { + int x_221 = 0; + int x_213 = 0; + bool x_194 = false; + int x_197 = 0; + bool x_194_phi = false; + int x_197_phi = 0; + x_193 = x_193_phi; + const int x_196 = x_196_phi; + x_242_phi = x_193; + if ((x_196 <= 3)) { + } else { + break; + } + const int x_202 = tree[x_196].data; + if ((15 <= x_202)) { + bool x_240_phi = false; + const int x_215_save = x_196; + const int x_216 = tree[x_215_save].leftIndex; + if ((x_216 == -1)) { + const float x_223 = asfloat(x_8[0].y); + const float x_225 = asfloat(x_8[0].x); + if ((x_223 < x_225)) { + while (true) { + discard; + } + return; + } + tree[x_215_save].leftIndex = 3; + const BST tint_symbol_10 = {15, -1, -1}; + tree[3] = tint_symbol_10; + while (true) { + x_240_phi = x_193; + if ((0 < int(x_223))) { + } else { + break; + } + x_240_phi = true; + break; + } + x_240 = x_240_phi; + x_242_phi = x_240; + if (x_240) { + break; + } + } else { + x_221 = tree[x_215_save].leftIndex; + x_194_phi = x_193; + x_197_phi = x_221; + { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + continue; + } + } else { + const int x_207_save = x_196; + const int x_208 = tree[x_207_save].rightIndex; + if ((x_208 == -1)) { + tree[x_207_save].rightIndex = 3; + const BST tint_symbol_11 = {15, -1, -1}; + tree[3] = tint_symbol_11; + x_242_phi = true; + break; + } else { + x_213 = tree[x_207_save].rightIndex; + x_194_phi = x_193; + x_197_phi = x_213; + { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + continue; + } + return; + } + x_194_phi = x_240; + x_197_phi = x_196; + { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + } + if (x_242_phi) { + break; + } + break; + } + } + bool x_247 = false; + bool x_294 = false; + bool x_247_phi = false; + int x_250_phi = 0; + bool x_296_phi = false; + switch(0u) { + default: { + x_247_phi = false; + x_250_phi = 0; + while (true) { + int x_275 = 0; + int x_267 = 0; + bool x_248 = false; + int x_251 = 0; + bool x_248_phi = false; + int x_251_phi = 0; + x_247 = x_247_phi; + const int x_250 = x_250_phi; + x_296_phi = x_247; + if ((x_250 <= 4)) { + } else { + break; + } + const int x_256 = tree[x_250].data; + if ((7 <= x_256)) { + bool x_294_phi = false; + const int x_269_save = x_250; + const int x_270 = tree[x_269_save].leftIndex; + if ((x_270 == -1)) { + const float x_277 = asfloat(x_8[0].y); + const float x_279 = asfloat(x_8[0].x); + if ((x_277 < x_279)) { + while (true) { + discard; + } + return; + } + tree[x_269_save].leftIndex = 4; + const BST tint_symbol_12 = {7, -1, -1}; + tree[4] = tint_symbol_12; + while (true) { + x_294_phi = x_247; + if ((0 < int(x_277))) { + } else { + break; + } + x_294_phi = true; + break; + } + x_294 = x_294_phi; + x_296_phi = x_294; + if (x_294) { + break; + } + } else { + x_275 = tree[x_269_save].leftIndex; + x_248_phi = x_247; + x_251_phi = x_275; + { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + continue; + } + } else { + const int x_261_save = x_250; + const int x_262 = tree[x_261_save].rightIndex; + if ((x_262 == -1)) { + tree[x_261_save].rightIndex = 4; + const BST tint_symbol_13 = {7, -1, -1}; + tree[4] = tint_symbol_13; + x_296_phi = true; + break; + } else { + x_267 = tree[x_261_save].rightIndex; + x_248_phi = x_247; + x_251_phi = x_267; + { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + continue; + } + return; + } + x_248_phi = x_294; + x_251_phi = x_250; + { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + } + if (x_296_phi) { + break; + } + break; + } + } + bool x_301 = false; + bool x_348 = false; + bool x_301_phi = false; + int x_304_phi = 0; + bool x_350_phi = false; + switch(0u) { + default: { + x_301_phi = false; + x_304_phi = 0; + while (true) { + int x_329 = 0; + int x_321 = 0; + bool x_302 = false; + int x_305 = 0; + bool x_302_phi = false; + int x_305_phi = 0; + x_301 = x_301_phi; + const int x_304 = x_304_phi; + x_350_phi = x_301; + if ((x_304 <= 5)) { + } else { + break; + } + const int x_310 = tree[x_304].data; + if ((8 <= x_310)) { + bool x_348_phi = false; + const int x_323_save = x_304; + const int x_324 = tree[x_323_save].leftIndex; + if ((x_324 == -1)) { + const float x_331 = asfloat(x_8[0].y); + const float x_333 = asfloat(x_8[0].x); + if ((x_331 < x_333)) { + while (true) { + discard; + } + return; + } + tree[x_323_save].leftIndex = 5; + const BST tint_symbol_14 = {8, -1, -1}; + tree[5] = tint_symbol_14; + while (true) { + x_348_phi = x_301; + if ((0 < int(x_331))) { + } else { + break; + } + x_348_phi = true; + break; + } + x_348 = x_348_phi; + x_350_phi = x_348; + if (x_348) { + break; + } + } else { + x_329 = tree[x_323_save].leftIndex; + x_302_phi = x_301; + x_305_phi = x_329; + { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + continue; + } + } else { + const int x_315_save = x_304; + const int x_316 = tree[x_315_save].rightIndex; + if ((x_316 == -1)) { + tree[x_315_save].rightIndex = 5; + const BST tint_symbol_15 = {8, -1, -1}; + tree[5] = tint_symbol_15; + x_350_phi = true; + break; + } else { + x_321 = tree[x_315_save].rightIndex; + x_302_phi = x_301; + x_305_phi = x_321; + { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + continue; + } + return; + } + x_302_phi = x_348; + x_305_phi = x_304; + { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + } + if (x_350_phi) { + break; + } + break; + } + } + bool x_355 = false; + bool x_402 = false; + bool x_355_phi = false; + int x_358_phi = 0; + bool x_404_phi = false; + switch(0u) { + default: { + x_355_phi = false; + x_358_phi = 0; + while (true) { + int x_383 = 0; + int x_375 = 0; + bool x_356 = false; + int x_359 = 0; + bool x_356_phi = false; + int x_359_phi = 0; + x_355 = x_355_phi; + const int x_358 = x_358_phi; + x_404_phi = x_355; + if ((x_358 <= 6)) { + } else { + break; + } + const int x_364 = tree[x_358].data; + if ((2 <= x_364)) { + bool x_402_phi = false; + const int x_377_save = x_358; + const int x_378 = tree[x_377_save].leftIndex; + if ((x_378 == -1)) { + const float x_385 = asfloat(x_8[0].y); + const float x_387 = asfloat(x_8[0].x); + if ((x_385 < x_387)) { + while (true) { + discard; + } + return; + } + tree[x_377_save].leftIndex = 6; + const BST tint_symbol_16 = {2, -1, -1}; + tree[6] = tint_symbol_16; + while (true) { + x_402_phi = x_355; + if ((0 < int(x_385))) { + } else { + break; + } + x_402_phi = true; + break; + } + x_402 = x_402_phi; + x_404_phi = x_402; + if (x_402) { + break; + } + } else { + x_383 = tree[x_377_save].leftIndex; + x_356_phi = x_355; + x_359_phi = x_383; + { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + continue; + } + } else { + const int x_369_save = x_358; + const int x_370 = tree[x_369_save].rightIndex; + if ((x_370 == -1)) { + tree[x_369_save].rightIndex = 6; + const BST tint_symbol_17 = {2, -1, -1}; + tree[6] = tint_symbol_17; + x_404_phi = true; + break; + } else { + x_375 = tree[x_369_save].rightIndex; + x_356_phi = x_355; + x_359_phi = x_375; + { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + continue; + } + return; + } + x_356_phi = x_402; + x_359_phi = x_358; + { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + } + if (x_404_phi) { + break; + } + break; + } + } + bool x_409 = false; + bool x_456 = false; + bool x_409_phi = false; + int x_412_phi = 0; + bool x_458_phi = false; + switch(0u) { + default: { + x_409_phi = false; + x_412_phi = 0; + while (true) { + int x_437 = 0; + int x_429 = 0; + bool x_410 = false; + int x_413 = 0; + bool x_410_phi = false; + int x_413_phi = 0; + x_409 = x_409_phi; + const int x_412 = x_412_phi; + x_458_phi = x_409; + if ((x_412 <= 7)) { + } else { + break; + } + const int x_418 = tree[x_412].data; + if ((6 <= x_418)) { + bool x_456_phi = false; + const int x_431_save = x_412; + const int x_432 = tree[x_431_save].leftIndex; + if ((x_432 == -1)) { + const float x_439 = asfloat(x_8[0].y); + const float x_441 = asfloat(x_8[0].x); + if ((x_439 < x_441)) { + while (true) { + discard; + } + return; + } + tree[x_431_save].leftIndex = 7; + const BST tint_symbol_18 = {6, -1, -1}; + tree[7] = tint_symbol_18; + while (true) { + x_456_phi = x_409; + if ((0 < int(x_439))) { + } else { + break; + } + x_456_phi = true; + break; + } + x_456 = x_456_phi; + x_458_phi = x_456; + if (x_456) { + break; + } + } else { + x_437 = tree[x_431_save].leftIndex; + x_410_phi = x_409; + x_413_phi = x_437; + { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + continue; + } + } else { + const int x_423_save = x_412; + const int x_424 = tree[x_423_save].rightIndex; + if ((x_424 == -1)) { + tree[x_423_save].rightIndex = 7; + const BST tint_symbol_19 = {6, -1, -1}; + tree[7] = tint_symbol_19; + x_458_phi = true; + break; + } else { + x_429 = tree[x_423_save].rightIndex; + x_410_phi = x_409; + x_413_phi = x_429; + { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + continue; + } + return; + } + x_410_phi = x_456; + x_413_phi = x_412; + { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + } + if (x_458_phi) { + break; + } + break; + } + } + bool x_463 = false; + bool x_510 = false; + bool x_463_phi = false; + int x_466_phi = 0; + bool x_512_phi = false; + switch(0u) { + default: { + x_463_phi = false; + x_466_phi = 0; + while (true) { + int x_491 = 0; + int x_483 = 0; + bool x_464 = false; + int x_467 = 0; + bool x_464_phi = false; + int x_467_phi = 0; + x_463 = x_463_phi; + const int x_466 = x_466_phi; + x_512_phi = x_463; + if ((x_466 <= 8)) { + } else { + break; + } + const int x_472 = tree[x_466].data; + if ((17 <= x_472)) { + bool x_510_phi = false; + const int x_485_save = x_466; + const int x_486 = tree[x_485_save].leftIndex; + if ((x_486 == -1)) { + const float x_493 = asfloat(x_8[0].y); + const float x_495 = asfloat(x_8[0].x); + if ((x_493 < x_495)) { + while (true) { + discard; + } + return; + } + tree[x_485_save].leftIndex = 8; + const BST tint_symbol_20 = {17, -1, -1}; + tree[8] = tint_symbol_20; + while (true) { + x_510_phi = x_463; + if ((0 < int(x_493))) { + } else { + break; + } + x_510_phi = true; + break; + } + x_510 = x_510_phi; + x_512_phi = x_510; + if (x_510) { + break; + } + } else { + x_491 = tree[x_485_save].leftIndex; + x_464_phi = x_463; + x_467_phi = x_491; + { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + continue; + } + } else { + const int x_477_save = x_466; + const int x_478 = tree[x_477_save].rightIndex; + if ((x_478 == -1)) { + tree[x_477_save].rightIndex = 8; + const BST tint_symbol_21 = {17, -1, -1}; + tree[8] = tint_symbol_21; + x_512_phi = true; + break; + } else { + x_483 = tree[x_477_save].rightIndex; + x_464_phi = x_463; + x_467_phi = x_483; + { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + continue; + } + return; + } + x_464_phi = x_510; + x_467_phi = x_466; + { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + } + if (x_512_phi) { + break; + } + break; + } + } + bool x_517 = false; + bool x_564 = false; + bool x_517_phi = false; + int x_520_phi = 0; + bool x_566_phi = false; + switch(0u) { + default: { + x_517_phi = false; + x_520_phi = 0; + while (true) { + int x_545 = 0; + int x_537 = 0; + bool x_518 = false; + int x_521 = 0; + bool x_518_phi = false; + int x_521_phi = 0; + x_517 = x_517_phi; + const int x_520 = x_520_phi; + x_566_phi = x_517; + if ((x_520 <= 9)) { + } else { + break; + } + const int x_526 = tree[x_520].data; + if ((13 <= x_526)) { + bool x_564_phi = false; + const int x_539_save = x_520; + const int x_540 = tree[x_539_save].leftIndex; + if ((x_540 == -1)) { + const float x_547 = asfloat(x_8[0].y); + const float x_549 = asfloat(x_8[0].x); + if ((x_547 < x_549)) { + while (true) { + discard; + } + return; + } + tree[x_539_save].leftIndex = 9; + const BST tint_symbol_22 = {13, -1, -1}; + tree[9] = tint_symbol_22; + while (true) { + x_564_phi = x_517; + if ((0 < int(x_547))) { + } else { + break; + } + x_564_phi = true; + break; + } + x_564 = x_564_phi; + x_566_phi = x_564; + if (x_564) { + break; + } + } else { + x_545 = tree[x_539_save].leftIndex; + x_518_phi = x_517; + x_521_phi = x_545; + { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + continue; + } + } else { + const int x_531_save = x_520; + const int x_532 = tree[x_531_save].rightIndex; + if ((x_532 == -1)) { + tree[x_531_save].rightIndex = 9; + const BST tint_symbol_23 = {13, -1, -1}; + tree[9] = tint_symbol_23; + x_566_phi = true; + break; + } else { + x_537 = tree[x_531_save].rightIndex; + x_518_phi = x_517; + x_521_phi = x_537; + { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + continue; + } + return; + } + x_518_phi = x_564; + x_521_phi = x_520; + { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + } + if (x_566_phi) { + break; + } + break; + } + } + x_569_phi = 0; + x_572_phi = 0; + x_574_phi = 0; + while (true) { + int x_597 = 0; + int x_607 = 0; + int x_612 = 0; + int x_575 = 0; + int x_570_phi = 0; + int x_573_phi = 0; + const int x_569 = x_569_phi; + x_572 = x_572_phi; + const int x_574 = x_574_phi; + if ((x_574 < 20)) { + } else { + break; + } + int x_582_phi = 0; + int x_597_phi = 0; + bool x_598_phi = false; + switch(0u) { + default: { + x_582_phi = 0; + while (true) { + const int x_582 = x_582_phi; + x_597_phi = x_569; + x_598_phi = false; + if ((x_582 != -1)) { + } else { + break; + } + const BST x_589 = tree[x_582]; + const int x_590 = x_589.data; + const int x_591 = x_589.leftIndex; + const int x_592 = x_589.rightIndex; + if ((x_590 == x_574)) { + x_597_phi = x_574; + x_598_phi = true; + break; + } + { + x_582_phi = ((x_574 > x_590) ? x_592 : x_591); + } + } + x_597 = x_597_phi; + const bool x_598 = x_598_phi; + x_570_phi = x_597; + if (x_598) { + break; + } + x_570_phi = -1; + break; + } + } + int x_570 = 0; + int x_606 = 0; + int x_611 = 0; + int x_607_phi = 0; + int x_612_phi = 0; + x_570 = x_570_phi; + switch(x_574) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_607_phi = x_572; + if ((x_570 == asint(x_574))) { + x_606 = asint((x_572 + asint(1))); + x_607_phi = x_606; + } + x_607 = x_607_phi; + x_573_phi = x_607; + break; + } + default: { + x_612_phi = x_572; + if ((x_570 == asint(-1))) { + x_611 = asint((x_572 + asint(1))); + x_612_phi = x_611; + } + x_612 = x_612_phi; + x_573_phi = x_612; + break; + } + } + const int x_573 = x_573_phi; + { + x_575 = (x_574 + 1); + x_569_phi = x_570; + x_572_phi = x_573; + x_574_phi = x_575; + } + } + if ((x_572 == asint(20))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_24 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_24; +} +T:\tmp\ulw.0:1053:20: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] + if ((x_570 == asint(x_574))) { + ~~~~~~^~~~~~~~~~~~~~~ +T:\tmp\ulw.0:1053:20: note: remove extraneous parentheses around the comparison to silence this warning + if ((x_570 == asint(x_574))) { + ~ ^ ~ +T:\tmp\ulw.0:1053:20: note: use '=' to turn this equality comparison into an assignment + if ((x_570 == asint(x_574))) { + ^~ + = +T:\tmp\ulw.0:1063:20: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] + if ((x_570 == asint(-1))) { + ~~~~~~^~~~~~~~~~~~ +T:\tmp\ulw.0:1063:20: note: remove extraneous parentheses around the comparison to silence this warning + if ((x_570 == asint(-1))) { + ~ ^ ~ +T:\tmp\ulw.0:1063:20: note: use '=' to turn this equality comparison into an assignment + if ((x_570 == asint(-1))) { + ^~ + = +T:\tmp\ulw.0:1080:14: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] + if ((x_572 == asint(20))) { + ~~~~~~^~~~~~~~~~~~ +T:\tmp\ulw.0:1080:14: note: remove extraneous parentheses around the comparison to silence this warning + if ((x_572 == asint(20))) { + ~ ^ ~ +T:\tmp\ulw.0:1080:14: note: use '=' to turn this equality comparison into an assignment + if ((x_572 == asint(20))) { + ^~ + = +error: validation errors +T:\tmp\ulw.0:1098: error: Loop must have break. +T:\tmp\ulw.0:1098: error: Loop must have break. +T:\tmp\ulw.0:1098: error: Loop must have break. +T:\tmp\ulw.0:1098: error: Loop must have break. +T:\tmp\ulw.0:1098: error: Loop must have break. +T:\tmp\ulw.0:1098: error: Loop must have break. +T:\tmp\ulw.0:1098: error: Loop must have break. +T:\tmp\ulw.0:1098: error: Loop must have break. +T:\tmp\ulw.0:1098: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.msl new file mode 100644 index 0000000000..5025022f26 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.msl @@ -0,0 +1,1116 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_24, thread float4* const tint_symbol_25) { + tint_array_wrapper tree = {}; + bool x_67 = false; + bool x_114 = false; + int x_572 = 0; + bool x_67_phi = false; + int x_70_phi = 0; + bool x_116_phi = false; + int x_119_phi = 0; + int x_569_phi = 0; + int x_572_phi = 0; + int x_574_phi = 0; + BST const tint_symbol_4 = {.data=9, .leftIndex=-1, .rightIndex=-1}; + tree.arr[0] = tint_symbol_4; + switch(0u) { + default: { + x_67_phi = false; + x_70_phi = 0; + while (true) { + int x_95 = 0; + int x_87 = 0; + bool x_68 = false; + int x_71 = 0; + bool x_68_phi = false; + int x_71_phi = 0; + x_67 = x_67_phi; + int const x_70 = x_70_phi; + x_116_phi = x_67; + if ((x_70 <= 1)) { + } else { + break; + } + int const x_76 = tree.arr[x_70].data; + if ((5 <= x_76)) { + bool x_114_phi = false; + int const x_89_save = x_70; + int const x_90 = tree.arr[x_89_save].leftIndex; + if ((x_90 == -1)) { + float const x_97 = x_8.injectionSwitch.y; + float const x_99 = x_8.injectionSwitch.x; + if ((x_97 < x_99)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_89_save].leftIndex = 1; + BST const tint_symbol_5 = {.data=5, .leftIndex=-1, .rightIndex=-1}; + tree.arr[1] = tint_symbol_5; + while (true) { + x_114_phi = x_67; + if ((0 < int(x_97))) { + } else { + break; + } + x_114_phi = true; + break; + } + x_114 = x_114_phi; + x_116_phi = x_114; + if (x_114) { + break; + } + } else { + x_95 = tree.arr[x_89_save].leftIndex; + x_68_phi = x_67; + x_71_phi = x_95; + { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + continue; + } + } else { + int const x_81_save = x_70; + int const x_82 = tree.arr[x_81_save].rightIndex; + if ((x_82 == -1)) { + tree.arr[x_81_save].rightIndex = 1; + BST const tint_symbol_6 = {.data=5, .leftIndex=-1, .rightIndex=-1}; + tree.arr[1] = tint_symbol_6; + x_116_phi = true; + break; + } else { + x_87 = tree.arr[x_81_save].rightIndex; + x_68_phi = x_67; + x_71_phi = x_87; + { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + continue; + } + return; + } + x_68_phi = x_114; + x_71_phi = x_70; + { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + } + bool const x_116 = x_116_phi; + if (x_116) { + break; + } + break; + } + } + x_119_phi = 0; + while (true) { + bool x_133 = false; + int x_120 = 0; + bool x_134_phi = false; + int const x_119 = x_119_phi; + float const x_125 = (*(tint_symbol_24)).y; + bool const x_126 = (x_125 < 0.0f); + x_134_phi = x_126; + if (!(x_126)) { + float const x_131 = x_8.injectionSwitch.y; + x_133 = (x_119 != int(x_131)); + x_134_phi = x_133; + } + bool const x_134 = x_134_phi; + if (x_134) { + } else { + break; + } + bool x_139 = false; + bool x_186 = false; + bool x_139_phi = false; + int x_142_phi = 0; + bool x_188_phi = false; + switch(0u) { + default: { + x_139_phi = false; + x_142_phi = 0; + while (true) { + int x_167 = 0; + int x_159 = 0; + bool x_140 = false; + int x_143 = 0; + bool x_140_phi = false; + int x_143_phi = 0; + x_139 = x_139_phi; + int const x_142 = x_142_phi; + x_188_phi = x_139; + if ((x_142 <= 2)) { + } else { + break; + } + int const x_148 = tree.arr[x_142].data; + if ((12 <= x_148)) { + bool x_186_phi = false; + int const x_161_save = x_142; + int const x_162 = tree.arr[x_161_save].leftIndex; + if ((x_162 == -1)) { + float const x_169 = x_8.injectionSwitch.y; + float const x_171 = x_8.injectionSwitch.x; + if ((x_169 < x_171)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_161_save].leftIndex = 2; + BST const tint_symbol_7 = {.data=12, .leftIndex=-1, .rightIndex=-1}; + tree.arr[2] = tint_symbol_7; + while (true) { + x_186_phi = x_139; + if ((0 < int(x_169))) { + } else { + break; + } + x_186_phi = true; + break; + } + x_186 = x_186_phi; + x_188_phi = x_186; + if (x_186) { + break; + } + } else { + x_167 = tree.arr[x_161_save].leftIndex; + x_140_phi = x_139; + x_143_phi = x_167; + { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + continue; + } + } else { + int const x_153_save = x_142; + int const x_154 = tree.arr[x_153_save].rightIndex; + if ((x_154 == -1)) { + tree.arr[x_153_save].rightIndex = 2; + BST const tint_symbol_8 = {.data=12, .leftIndex=-1, .rightIndex=-1}; + tree.arr[2] = tint_symbol_8; + x_188_phi = true; + break; + } else { + x_159 = tree.arr[x_153_save].rightIndex; + x_140_phi = x_139; + x_143_phi = x_159; + { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + continue; + } + return; + } + x_140_phi = x_186; + x_143_phi = x_142; + { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + } + bool const x_188 = x_188_phi; + if (x_188) { + break; + } + break; + } + } + { + x_120 = (x_119 + 1); + x_119_phi = x_120; + } + } + bool x_193 = false; + bool x_240 = false; + bool x_193_phi = false; + int x_196_phi = 0; + bool x_242_phi = false; + switch(0u) { + default: { + x_193_phi = false; + x_196_phi = 0; + while (true) { + int x_221 = 0; + int x_213 = 0; + bool x_194 = false; + int x_197 = 0; + bool x_194_phi = false; + int x_197_phi = 0; + x_193 = x_193_phi; + int const x_196 = x_196_phi; + x_242_phi = x_193; + if ((x_196 <= 3)) { + } else { + break; + } + int const x_202 = tree.arr[x_196].data; + if ((15 <= x_202)) { + bool x_240_phi = false; + int const x_215_save = x_196; + int const x_216 = tree.arr[x_215_save].leftIndex; + if ((x_216 == -1)) { + float const x_223 = x_8.injectionSwitch.y; + float const x_225 = x_8.injectionSwitch.x; + if ((x_223 < x_225)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_215_save].leftIndex = 3; + BST const tint_symbol_9 = {.data=15, .leftIndex=-1, .rightIndex=-1}; + tree.arr[3] = tint_symbol_9; + while (true) { + x_240_phi = x_193; + if ((0 < int(x_223))) { + } else { + break; + } + x_240_phi = true; + break; + } + x_240 = x_240_phi; + x_242_phi = x_240; + if (x_240) { + break; + } + } else { + x_221 = tree.arr[x_215_save].leftIndex; + x_194_phi = x_193; + x_197_phi = x_221; + { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + continue; + } + } else { + int const x_207_save = x_196; + int const x_208 = tree.arr[x_207_save].rightIndex; + if ((x_208 == -1)) { + tree.arr[x_207_save].rightIndex = 3; + BST const tint_symbol_10 = {.data=15, .leftIndex=-1, .rightIndex=-1}; + tree.arr[3] = tint_symbol_10; + x_242_phi = true; + break; + } else { + x_213 = tree.arr[x_207_save].rightIndex; + x_194_phi = x_193; + x_197_phi = x_213; + { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + continue; + } + return; + } + x_194_phi = x_240; + x_197_phi = x_196; + { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + } + bool const x_242 = x_242_phi; + if (x_242) { + break; + } + break; + } + } + bool x_247 = false; + bool x_294 = false; + bool x_247_phi = false; + int x_250_phi = 0; + bool x_296_phi = false; + switch(0u) { + default: { + x_247_phi = false; + x_250_phi = 0; + while (true) { + int x_275 = 0; + int x_267 = 0; + bool x_248 = false; + int x_251 = 0; + bool x_248_phi = false; + int x_251_phi = 0; + x_247 = x_247_phi; + int const x_250 = x_250_phi; + x_296_phi = x_247; + if ((x_250 <= 4)) { + } else { + break; + } + int const x_256 = tree.arr[x_250].data; + if ((7 <= x_256)) { + bool x_294_phi = false; + int const x_269_save = x_250; + int const x_270 = tree.arr[x_269_save].leftIndex; + if ((x_270 == -1)) { + float const x_277 = x_8.injectionSwitch.y; + float const x_279 = x_8.injectionSwitch.x; + if ((x_277 < x_279)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_269_save].leftIndex = 4; + BST const tint_symbol_11 = {.data=7, .leftIndex=-1, .rightIndex=-1}; + tree.arr[4] = tint_symbol_11; + while (true) { + x_294_phi = x_247; + if ((0 < int(x_277))) { + } else { + break; + } + x_294_phi = true; + break; + } + x_294 = x_294_phi; + x_296_phi = x_294; + if (x_294) { + break; + } + } else { + x_275 = tree.arr[x_269_save].leftIndex; + x_248_phi = x_247; + x_251_phi = x_275; + { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + continue; + } + } else { + int const x_261_save = x_250; + int const x_262 = tree.arr[x_261_save].rightIndex; + if ((x_262 == -1)) { + tree.arr[x_261_save].rightIndex = 4; + BST const tint_symbol_12 = {.data=7, .leftIndex=-1, .rightIndex=-1}; + tree.arr[4] = tint_symbol_12; + x_296_phi = true; + break; + } else { + x_267 = tree.arr[x_261_save].rightIndex; + x_248_phi = x_247; + x_251_phi = x_267; + { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + continue; + } + return; + } + x_248_phi = x_294; + x_251_phi = x_250; + { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + } + bool const x_296 = x_296_phi; + if (x_296) { + break; + } + break; + } + } + bool x_301 = false; + bool x_348 = false; + bool x_301_phi = false; + int x_304_phi = 0; + bool x_350_phi = false; + switch(0u) { + default: { + x_301_phi = false; + x_304_phi = 0; + while (true) { + int x_329 = 0; + int x_321 = 0; + bool x_302 = false; + int x_305 = 0; + bool x_302_phi = false; + int x_305_phi = 0; + x_301 = x_301_phi; + int const x_304 = x_304_phi; + x_350_phi = x_301; + if ((x_304 <= 5)) { + } else { + break; + } + int const x_310 = tree.arr[x_304].data; + if ((8 <= x_310)) { + bool x_348_phi = false; + int const x_323_save = x_304; + int const x_324 = tree.arr[x_323_save].leftIndex; + if ((x_324 == -1)) { + float const x_331 = x_8.injectionSwitch.y; + float const x_333 = x_8.injectionSwitch.x; + if ((x_331 < x_333)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_323_save].leftIndex = 5; + BST const tint_symbol_13 = {.data=8, .leftIndex=-1, .rightIndex=-1}; + tree.arr[5] = tint_symbol_13; + while (true) { + x_348_phi = x_301; + if ((0 < int(x_331))) { + } else { + break; + } + x_348_phi = true; + break; + } + x_348 = x_348_phi; + x_350_phi = x_348; + if (x_348) { + break; + } + } else { + x_329 = tree.arr[x_323_save].leftIndex; + x_302_phi = x_301; + x_305_phi = x_329; + { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + continue; + } + } else { + int const x_315_save = x_304; + int const x_316 = tree.arr[x_315_save].rightIndex; + if ((x_316 == -1)) { + tree.arr[x_315_save].rightIndex = 5; + BST const tint_symbol_14 = {.data=8, .leftIndex=-1, .rightIndex=-1}; + tree.arr[5] = tint_symbol_14; + x_350_phi = true; + break; + } else { + x_321 = tree.arr[x_315_save].rightIndex; + x_302_phi = x_301; + x_305_phi = x_321; + { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + continue; + } + return; + } + x_302_phi = x_348; + x_305_phi = x_304; + { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + } + bool const x_350 = x_350_phi; + if (x_350) { + break; + } + break; + } + } + bool x_355 = false; + bool x_402 = false; + bool x_355_phi = false; + int x_358_phi = 0; + bool x_404_phi = false; + switch(0u) { + default: { + x_355_phi = false; + x_358_phi = 0; + while (true) { + int x_383 = 0; + int x_375 = 0; + bool x_356 = false; + int x_359 = 0; + bool x_356_phi = false; + int x_359_phi = 0; + x_355 = x_355_phi; + int const x_358 = x_358_phi; + x_404_phi = x_355; + if ((x_358 <= 6)) { + } else { + break; + } + int const x_364 = tree.arr[x_358].data; + if ((2 <= x_364)) { + bool x_402_phi = false; + int const x_377_save = x_358; + int const x_378 = tree.arr[x_377_save].leftIndex; + if ((x_378 == -1)) { + float const x_385 = x_8.injectionSwitch.y; + float const x_387 = x_8.injectionSwitch.x; + if ((x_385 < x_387)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_377_save].leftIndex = 6; + BST const tint_symbol_15 = {.data=2, .leftIndex=-1, .rightIndex=-1}; + tree.arr[6] = tint_symbol_15; + while (true) { + x_402_phi = x_355; + if ((0 < int(x_385))) { + } else { + break; + } + x_402_phi = true; + break; + } + x_402 = x_402_phi; + x_404_phi = x_402; + if (x_402) { + break; + } + } else { + x_383 = tree.arr[x_377_save].leftIndex; + x_356_phi = x_355; + x_359_phi = x_383; + { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + continue; + } + } else { + int const x_369_save = x_358; + int const x_370 = tree.arr[x_369_save].rightIndex; + if ((x_370 == -1)) { + tree.arr[x_369_save].rightIndex = 6; + BST const tint_symbol_16 = {.data=2, .leftIndex=-1, .rightIndex=-1}; + tree.arr[6] = tint_symbol_16; + x_404_phi = true; + break; + } else { + x_375 = tree.arr[x_369_save].rightIndex; + x_356_phi = x_355; + x_359_phi = x_375; + { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + continue; + } + return; + } + x_356_phi = x_402; + x_359_phi = x_358; + { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + } + bool const x_404 = x_404_phi; + if (x_404) { + break; + } + break; + } + } + bool x_409 = false; + bool x_456 = false; + bool x_409_phi = false; + int x_412_phi = 0; + bool x_458_phi = false; + switch(0u) { + default: { + x_409_phi = false; + x_412_phi = 0; + while (true) { + int x_437 = 0; + int x_429 = 0; + bool x_410 = false; + int x_413 = 0; + bool x_410_phi = false; + int x_413_phi = 0; + x_409 = x_409_phi; + int const x_412 = x_412_phi; + x_458_phi = x_409; + if ((x_412 <= 7)) { + } else { + break; + } + int const x_418 = tree.arr[x_412].data; + if ((6 <= x_418)) { + bool x_456_phi = false; + int const x_431_save = x_412; + int const x_432 = tree.arr[x_431_save].leftIndex; + if ((x_432 == -1)) { + float const x_439 = x_8.injectionSwitch.y; + float const x_441 = x_8.injectionSwitch.x; + if ((x_439 < x_441)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_431_save].leftIndex = 7; + BST const tint_symbol_17 = {.data=6, .leftIndex=-1, .rightIndex=-1}; + tree.arr[7] = tint_symbol_17; + while (true) { + x_456_phi = x_409; + if ((0 < int(x_439))) { + } else { + break; + } + x_456_phi = true; + break; + } + x_456 = x_456_phi; + x_458_phi = x_456; + if (x_456) { + break; + } + } else { + x_437 = tree.arr[x_431_save].leftIndex; + x_410_phi = x_409; + x_413_phi = x_437; + { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + continue; + } + } else { + int const x_423_save = x_412; + int const x_424 = tree.arr[x_423_save].rightIndex; + if ((x_424 == -1)) { + tree.arr[x_423_save].rightIndex = 7; + BST const tint_symbol_18 = {.data=6, .leftIndex=-1, .rightIndex=-1}; + tree.arr[7] = tint_symbol_18; + x_458_phi = true; + break; + } else { + x_429 = tree.arr[x_423_save].rightIndex; + x_410_phi = x_409; + x_413_phi = x_429; + { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + continue; + } + return; + } + x_410_phi = x_456; + x_413_phi = x_412; + { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + } + bool const x_458 = x_458_phi; + if (x_458) { + break; + } + break; + } + } + bool x_463 = false; + bool x_510 = false; + bool x_463_phi = false; + int x_466_phi = 0; + bool x_512_phi = false; + switch(0u) { + default: { + x_463_phi = false; + x_466_phi = 0; + while (true) { + int x_491 = 0; + int x_483 = 0; + bool x_464 = false; + int x_467 = 0; + bool x_464_phi = false; + int x_467_phi = 0; + x_463 = x_463_phi; + int const x_466 = x_466_phi; + x_512_phi = x_463; + if ((x_466 <= 8)) { + } else { + break; + } + int const x_472 = tree.arr[x_466].data; + if ((17 <= x_472)) { + bool x_510_phi = false; + int const x_485_save = x_466; + int const x_486 = tree.arr[x_485_save].leftIndex; + if ((x_486 == -1)) { + float const x_493 = x_8.injectionSwitch.y; + float const x_495 = x_8.injectionSwitch.x; + if ((x_493 < x_495)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_485_save].leftIndex = 8; + BST const tint_symbol_19 = {.data=17, .leftIndex=-1, .rightIndex=-1}; + tree.arr[8] = tint_symbol_19; + while (true) { + x_510_phi = x_463; + if ((0 < int(x_493))) { + } else { + break; + } + x_510_phi = true; + break; + } + x_510 = x_510_phi; + x_512_phi = x_510; + if (x_510) { + break; + } + } else { + x_491 = tree.arr[x_485_save].leftIndex; + x_464_phi = x_463; + x_467_phi = x_491; + { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + continue; + } + } else { + int const x_477_save = x_466; + int const x_478 = tree.arr[x_477_save].rightIndex; + if ((x_478 == -1)) { + tree.arr[x_477_save].rightIndex = 8; + BST const tint_symbol_20 = {.data=17, .leftIndex=-1, .rightIndex=-1}; + tree.arr[8] = tint_symbol_20; + x_512_phi = true; + break; + } else { + x_483 = tree.arr[x_477_save].rightIndex; + x_464_phi = x_463; + x_467_phi = x_483; + { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + continue; + } + return; + } + x_464_phi = x_510; + x_467_phi = x_466; + { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + } + bool const x_512 = x_512_phi; + if (x_512) { + break; + } + break; + } + } + bool x_517 = false; + bool x_564 = false; + bool x_517_phi = false; + int x_520_phi = 0; + bool x_566_phi = false; + switch(0u) { + default: { + x_517_phi = false; + x_520_phi = 0; + while (true) { + int x_545 = 0; + int x_537 = 0; + bool x_518 = false; + int x_521 = 0; + bool x_518_phi = false; + int x_521_phi = 0; + x_517 = x_517_phi; + int const x_520 = x_520_phi; + x_566_phi = x_517; + if ((x_520 <= 9)) { + } else { + break; + } + int const x_526 = tree.arr[x_520].data; + if ((13 <= x_526)) { + bool x_564_phi = false; + int const x_539_save = x_520; + int const x_540 = tree.arr[x_539_save].leftIndex; + if ((x_540 == -1)) { + float const x_547 = x_8.injectionSwitch.y; + float const x_549 = x_8.injectionSwitch.x; + if ((x_547 < x_549)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_539_save].leftIndex = 9; + BST const tint_symbol_21 = {.data=13, .leftIndex=-1, .rightIndex=-1}; + tree.arr[9] = tint_symbol_21; + while (true) { + x_564_phi = x_517; + if ((0 < int(x_547))) { + } else { + break; + } + x_564_phi = true; + break; + } + x_564 = x_564_phi; + x_566_phi = x_564; + if (x_564) { + break; + } + } else { + x_545 = tree.arr[x_539_save].leftIndex; + x_518_phi = x_517; + x_521_phi = x_545; + { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + continue; + } + } else { + int const x_531_save = x_520; + int const x_532 = tree.arr[x_531_save].rightIndex; + if ((x_532 == -1)) { + tree.arr[x_531_save].rightIndex = 9; + BST const tint_symbol_22 = {.data=13, .leftIndex=-1, .rightIndex=-1}; + tree.arr[9] = tint_symbol_22; + x_566_phi = true; + break; + } else { + x_537 = tree.arr[x_531_save].rightIndex; + x_518_phi = x_517; + x_521_phi = x_537; + { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + continue; + } + return; + } + x_518_phi = x_564; + x_521_phi = x_520; + { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + } + bool const x_566 = x_566_phi; + if (x_566) { + break; + } + break; + } + } + x_569_phi = 0; + x_572_phi = 0; + x_574_phi = 0; + while (true) { + int x_597 = 0; + int x_607 = 0; + int x_612 = 0; + int x_575 = 0; + int x_570_phi = 0; + int x_573_phi = 0; + int const x_569 = x_569_phi; + x_572 = x_572_phi; + int const x_574 = x_574_phi; + if ((x_574 < 20)) { + } else { + break; + } + int x_582_phi = 0; + int x_597_phi = 0; + bool x_598_phi = false; + switch(0u) { + default: { + x_582_phi = 0; + while (true) { + int const x_582 = x_582_phi; + x_597_phi = x_569; + x_598_phi = false; + if ((x_582 != -1)) { + } else { + break; + } + BST const x_589 = tree.arr[x_582]; + int const x_590 = x_589.data; + int const x_591 = x_589.leftIndex; + int const x_592 = x_589.rightIndex; + if ((x_590 == x_574)) { + x_597_phi = x_574; + x_598_phi = true; + break; + } + { + x_582_phi = select(x_591, x_592, (x_574 > x_590)); + } + } + x_597 = x_597_phi; + bool const x_598 = x_598_phi; + x_570_phi = x_597; + if (x_598) { + break; + } + x_570_phi = -1; + break; + } + } + int x_570 = 0; + int x_606 = 0; + int x_611 = 0; + int x_607_phi = 0; + int x_612_phi = 0; + x_570 = x_570_phi; + switch(x_574) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_607_phi = x_572; + if ((x_570 == as_type(x_574))) { + x_606 = as_type((x_572 + as_type(1))); + x_607_phi = x_606; + } + x_607 = x_607_phi; + x_573_phi = x_607; + break; + } + default: { + x_612_phi = x_572; + if ((x_570 == as_type(-1))) { + x_611 = as_type((x_572 + as_type(1))); + x_612_phi = x_611; + } + x_612 = x_612_phi; + x_573_phi = x_612; + break; + } + } + int const x_573 = x_573_phi; + { + x_575 = (x_574 + 1); + x_569_phi = x_570; + x_572_phi = x_573; + x_574_phi = x_575; + } + } + if ((x_572 == as_type(20))) { + *(tint_symbol_25) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_25) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_26 = 0.0f; + thread float4 tint_symbol_27 = 0.0f; + tint_symbol_26 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_26), &(tint_symbol_27)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_27}; + tint_symbol_2 const tint_symbol_23 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_23; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..41d75a5c09 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.spvasm @@ -0,0 +1,1920 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 1006 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree "tree" + OpName %x_67 "x_67" + OpName %x_114 "x_114" + OpName %x_572 "x_572" + OpName %x_67_phi "x_67_phi" + OpName %x_70_phi "x_70_phi" + OpName %x_116_phi "x_116_phi" + OpName %x_119_phi "x_119_phi" + OpName %x_569_phi "x_569_phi" + OpName %x_572_phi "x_572_phi" + OpName %x_574_phi "x_574_phi" + OpName %x_95 "x_95" + OpName %x_87 "x_87" + OpName %x_68 "x_68" + OpName %x_71 "x_71" + OpName %x_68_phi "x_68_phi" + OpName %x_71_phi "x_71_phi" + OpName %x_114_phi "x_114_phi" + OpName %x_133 "x_133" + OpName %x_120 "x_120" + OpName %x_134_phi "x_134_phi" + OpName %x_139 "x_139" + OpName %x_186 "x_186" + OpName %x_139_phi "x_139_phi" + OpName %x_142_phi "x_142_phi" + OpName %x_188_phi "x_188_phi" + OpName %x_167 "x_167" + OpName %x_159 "x_159" + OpName %x_140 "x_140" + OpName %x_143 "x_143" + OpName %x_140_phi "x_140_phi" + OpName %x_143_phi "x_143_phi" + OpName %x_186_phi "x_186_phi" + OpName %x_193 "x_193" + OpName %x_240 "x_240" + OpName %x_193_phi "x_193_phi" + OpName %x_196_phi "x_196_phi" + OpName %x_242_phi "x_242_phi" + OpName %x_221 "x_221" + OpName %x_213 "x_213" + OpName %x_194 "x_194" + OpName %x_197 "x_197" + OpName %x_194_phi "x_194_phi" + OpName %x_197_phi "x_197_phi" + OpName %x_240_phi "x_240_phi" + OpName %x_247 "x_247" + OpName %x_294 "x_294" + OpName %x_247_phi "x_247_phi" + OpName %x_250_phi "x_250_phi" + OpName %x_296_phi "x_296_phi" + OpName %x_275 "x_275" + OpName %x_267 "x_267" + OpName %x_248 "x_248" + OpName %x_251 "x_251" + OpName %x_248_phi "x_248_phi" + OpName %x_251_phi "x_251_phi" + OpName %x_294_phi "x_294_phi" + OpName %x_301 "x_301" + OpName %x_348 "x_348" + OpName %x_301_phi "x_301_phi" + OpName %x_304_phi "x_304_phi" + OpName %x_350_phi "x_350_phi" + OpName %x_329 "x_329" + OpName %x_321 "x_321" + OpName %x_302 "x_302" + OpName %x_305 "x_305" + OpName %x_302_phi "x_302_phi" + OpName %x_305_phi "x_305_phi" + OpName %x_348_phi "x_348_phi" + OpName %x_355 "x_355" + OpName %x_402 "x_402" + OpName %x_355_phi "x_355_phi" + OpName %x_358_phi "x_358_phi" + OpName %x_404_phi "x_404_phi" + OpName %x_383 "x_383" + OpName %x_375 "x_375" + OpName %x_356 "x_356" + OpName %x_359 "x_359" + OpName %x_356_phi "x_356_phi" + OpName %x_359_phi "x_359_phi" + OpName %x_402_phi "x_402_phi" + OpName %x_409 "x_409" + OpName %x_456 "x_456" + OpName %x_409_phi "x_409_phi" + OpName %x_412_phi "x_412_phi" + OpName %x_458_phi "x_458_phi" + OpName %x_437 "x_437" + OpName %x_429 "x_429" + OpName %x_410 "x_410" + OpName %x_413 "x_413" + OpName %x_410_phi "x_410_phi" + OpName %x_413_phi "x_413_phi" + OpName %x_456_phi "x_456_phi" + OpName %x_463 "x_463" + OpName %x_510 "x_510" + OpName %x_463_phi "x_463_phi" + OpName %x_466_phi "x_466_phi" + OpName %x_512_phi "x_512_phi" + OpName %x_491 "x_491" + OpName %x_483 "x_483" + OpName %x_464 "x_464" + OpName %x_467 "x_467" + OpName %x_464_phi "x_464_phi" + OpName %x_467_phi "x_467_phi" + OpName %x_510_phi "x_510_phi" + OpName %x_517 "x_517" + OpName %x_564 "x_564" + OpName %x_517_phi "x_517_phi" + OpName %x_520_phi "x_520_phi" + OpName %x_566_phi "x_566_phi" + OpName %x_545 "x_545" + OpName %x_537 "x_537" + OpName %x_518 "x_518" + OpName %x_521 "x_521" + OpName %x_518_phi "x_518_phi" + OpName %x_521_phi "x_521_phi" + OpName %x_564_phi "x_564_phi" + OpName %x_597 "x_597" + OpName %x_607 "x_607" + OpName %x_612 "x_612" + OpName %x_575 "x_575" + OpName %x_570_phi "x_570_phi" + OpName %x_573_phi "x_573_phi" + OpName %x_582_phi "x_582_phi" + OpName %x_597_phi "x_597_phi" + OpName %x_598_phi "x_598_phi" + OpName %x_570 "x_570" + OpName %x_606 "x_606" + OpName %x_611 "x_611" + OpName %x_607_phi "x_607_phi" + OpName %x_612_phi "x_612_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Function__arr_BST_uint_10 = OpTypePointer Function %_arr_BST_uint_10 + %26 = OpConstantNull %_arr_BST_uint_10 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %30 = OpConstantNull %bool +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %int_0 = OpConstant %int 0 +%_ptr_Function_BST = OpTypePointer Function %BST + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 + %47 = OpConstantComposite %BST %int_9 %int_n1 %int_n1 + %uint_0 = OpConstant %uint 0 + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %99 = OpConstantComposite %BST %int_5 %int_n1 %int_n1 + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %int_12 = OpConstant %int 12 + %218 = OpConstantComposite %BST %int_12 %int_n1 %int_n1 + %int_3 = OpConstant %int 3 + %int_15 = OpConstant %int 15 + %312 = OpConstantComposite %BST %int_15 %int_n1 %int_n1 + %int_4 = OpConstant %int 4 + %int_7 = OpConstant %int 7 + %404 = OpConstantComposite %BST %int_7 %int_n1 %int_n1 + %int_8 = OpConstant %int 8 + %495 = OpConstantComposite %BST %int_8 %int_n1 %int_n1 + %int_6 = OpConstant %int 6 + %586 = OpConstantComposite %BST %int_2 %int_n1 %int_n1 + %676 = OpConstantComposite %BST %int_6 %int_n1 %int_n1 + %int_17 = OpConstant %int 17 + %767 = OpConstantComposite %BST %int_17 %int_n1 %int_n1 + %int_13 = OpConstant %int 13 + %858 = OpConstantComposite %BST %int_13 %int_n1 %int_n1 + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %991 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %992 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %993 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %tree = OpVariable %_ptr_Function__arr_BST_uint_10 Function %26 + %x_67 = OpVariable %_ptr_Function_bool Function %30 + %x_114 = OpVariable %_ptr_Function_bool Function %30 + %x_572 = OpVariable %_ptr_Function_int Function %34 + %x_67_phi = OpVariable %_ptr_Function_bool Function %30 + %x_70_phi = OpVariable %_ptr_Function_int Function %34 + %x_116_phi = OpVariable %_ptr_Function_bool Function %30 + %x_119_phi = OpVariable %_ptr_Function_int Function %34 + %x_569_phi = OpVariable %_ptr_Function_int Function %34 + %x_572_phi = OpVariable %_ptr_Function_int Function %34 + %x_574_phi = OpVariable %_ptr_Function_int Function %34 + %x_95 = OpVariable %_ptr_Function_int Function %34 + %x_87 = OpVariable %_ptr_Function_int Function %34 + %x_68 = OpVariable %_ptr_Function_bool Function %30 + %x_71 = OpVariable %_ptr_Function_int Function %34 + %x_68_phi = OpVariable %_ptr_Function_bool Function %30 + %x_71_phi = OpVariable %_ptr_Function_int Function %34 + %x_114_phi = OpVariable %_ptr_Function_bool Function %30 + %x_133 = OpVariable %_ptr_Function_bool Function %30 + %x_120 = OpVariable %_ptr_Function_int Function %34 + %x_134_phi = OpVariable %_ptr_Function_bool Function %30 + %x_139 = OpVariable %_ptr_Function_bool Function %30 + %x_186 = OpVariable %_ptr_Function_bool Function %30 + %x_139_phi = OpVariable %_ptr_Function_bool Function %30 + %x_142_phi = OpVariable %_ptr_Function_int Function %34 + %x_188_phi = OpVariable %_ptr_Function_bool Function %30 + %x_167 = OpVariable %_ptr_Function_int Function %34 + %x_159 = OpVariable %_ptr_Function_int Function %34 + %x_140 = OpVariable %_ptr_Function_bool Function %30 + %x_143 = OpVariable %_ptr_Function_int Function %34 + %x_140_phi = OpVariable %_ptr_Function_bool Function %30 + %x_143_phi = OpVariable %_ptr_Function_int Function %34 + %x_186_phi = OpVariable %_ptr_Function_bool Function %30 + %x_193 = OpVariable %_ptr_Function_bool Function %30 + %x_240 = OpVariable %_ptr_Function_bool Function %30 + %x_193_phi = OpVariable %_ptr_Function_bool Function %30 + %x_196_phi = OpVariable %_ptr_Function_int Function %34 + %x_242_phi = OpVariable %_ptr_Function_bool Function %30 + %x_221 = OpVariable %_ptr_Function_int Function %34 + %x_213 = OpVariable %_ptr_Function_int Function %34 + %x_194 = OpVariable %_ptr_Function_bool Function %30 + %x_197 = OpVariable %_ptr_Function_int Function %34 + %x_194_phi = OpVariable %_ptr_Function_bool Function %30 + %x_197_phi = OpVariable %_ptr_Function_int Function %34 + %x_240_phi = OpVariable %_ptr_Function_bool Function %30 + %x_247 = OpVariable %_ptr_Function_bool Function %30 + %x_294 = OpVariable %_ptr_Function_bool Function %30 + %x_247_phi = OpVariable %_ptr_Function_bool Function %30 + %x_250_phi = OpVariable %_ptr_Function_int Function %34 + %x_296_phi = OpVariable %_ptr_Function_bool Function %30 + %x_275 = OpVariable %_ptr_Function_int Function %34 + %x_267 = OpVariable %_ptr_Function_int Function %34 + %x_248 = OpVariable %_ptr_Function_bool Function %30 + %x_251 = OpVariable %_ptr_Function_int Function %34 + %x_248_phi = OpVariable %_ptr_Function_bool Function %30 + %x_251_phi = OpVariable %_ptr_Function_int Function %34 + %x_294_phi = OpVariable %_ptr_Function_bool Function %30 + %x_301 = OpVariable %_ptr_Function_bool Function %30 + %x_348 = OpVariable %_ptr_Function_bool Function %30 + %x_301_phi = OpVariable %_ptr_Function_bool Function %30 + %x_304_phi = OpVariable %_ptr_Function_int Function %34 + %x_350_phi = OpVariable %_ptr_Function_bool Function %30 + %x_329 = OpVariable %_ptr_Function_int Function %34 + %x_321 = OpVariable %_ptr_Function_int Function %34 + %x_302 = OpVariable %_ptr_Function_bool Function %30 + %x_305 = OpVariable %_ptr_Function_int Function %34 + %x_302_phi = OpVariable %_ptr_Function_bool Function %30 + %x_305_phi = OpVariable %_ptr_Function_int Function %34 + %x_348_phi = OpVariable %_ptr_Function_bool Function %30 + %x_355 = OpVariable %_ptr_Function_bool Function %30 + %x_402 = OpVariable %_ptr_Function_bool Function %30 + %x_355_phi = OpVariable %_ptr_Function_bool Function %30 + %x_358_phi = OpVariable %_ptr_Function_int Function %34 + %x_404_phi = OpVariable %_ptr_Function_bool Function %30 + %x_383 = OpVariable %_ptr_Function_int Function %34 + %x_375 = OpVariable %_ptr_Function_int Function %34 + %x_356 = OpVariable %_ptr_Function_bool Function %30 + %x_359 = OpVariable %_ptr_Function_int Function %34 + %x_356_phi = OpVariable %_ptr_Function_bool Function %30 + %x_359_phi = OpVariable %_ptr_Function_int Function %34 + %x_402_phi = OpVariable %_ptr_Function_bool Function %30 + %x_409 = OpVariable %_ptr_Function_bool Function %30 + %x_456 = OpVariable %_ptr_Function_bool Function %30 + %x_409_phi = OpVariable %_ptr_Function_bool Function %30 + %x_412_phi = OpVariable %_ptr_Function_int Function %34 + %x_458_phi = OpVariable %_ptr_Function_bool Function %30 + %x_437 = OpVariable %_ptr_Function_int Function %34 + %x_429 = OpVariable %_ptr_Function_int Function %34 + %x_410 = OpVariable %_ptr_Function_bool Function %30 + %x_413 = OpVariable %_ptr_Function_int Function %34 + %x_410_phi = OpVariable %_ptr_Function_bool Function %30 + %x_413_phi = OpVariable %_ptr_Function_int Function %34 + %x_456_phi = OpVariable %_ptr_Function_bool Function %30 + %x_463 = OpVariable %_ptr_Function_bool Function %30 + %x_510 = OpVariable %_ptr_Function_bool Function %30 + %x_463_phi = OpVariable %_ptr_Function_bool Function %30 + %x_466_phi = OpVariable %_ptr_Function_int Function %34 + %x_512_phi = OpVariable %_ptr_Function_bool Function %30 + %x_491 = OpVariable %_ptr_Function_int Function %34 + %x_483 = OpVariable %_ptr_Function_int Function %34 + %x_464 = OpVariable %_ptr_Function_bool Function %30 + %x_467 = OpVariable %_ptr_Function_int Function %34 + %x_464_phi = OpVariable %_ptr_Function_bool Function %30 + %x_467_phi = OpVariable %_ptr_Function_int Function %34 + %x_510_phi = OpVariable %_ptr_Function_bool Function %30 + %x_517 = OpVariable %_ptr_Function_bool Function %30 + %x_564 = OpVariable %_ptr_Function_bool Function %30 + %x_517_phi = OpVariable %_ptr_Function_bool Function %30 + %x_520_phi = OpVariable %_ptr_Function_int Function %34 + %x_566_phi = OpVariable %_ptr_Function_bool Function %30 + %x_545 = OpVariable %_ptr_Function_int Function %34 + %x_537 = OpVariable %_ptr_Function_int Function %34 + %x_518 = OpVariable %_ptr_Function_bool Function %30 + %x_521 = OpVariable %_ptr_Function_int Function %34 + %x_518_phi = OpVariable %_ptr_Function_bool Function %30 + %x_521_phi = OpVariable %_ptr_Function_int Function %34 + %x_564_phi = OpVariable %_ptr_Function_bool Function %30 + %x_597 = OpVariable %_ptr_Function_int Function %34 + %x_607 = OpVariable %_ptr_Function_int Function %34 + %x_612 = OpVariable %_ptr_Function_int Function %34 + %x_575 = OpVariable %_ptr_Function_int Function %34 + %x_570_phi = OpVariable %_ptr_Function_int Function %34 + %x_573_phi = OpVariable %_ptr_Function_int Function %34 + %x_582_phi = OpVariable %_ptr_Function_int Function %34 + %x_597_phi = OpVariable %_ptr_Function_int Function %34 + %x_598_phi = OpVariable %_ptr_Function_bool Function %30 + %x_570 = OpVariable %_ptr_Function_int Function %34 + %x_606 = OpVariable %_ptr_Function_int Function %34 + %x_611 = OpVariable %_ptr_Function_int Function %34 + %x_607_phi = OpVariable %_ptr_Function_int Function %34 + %x_612_phi = OpVariable %_ptr_Function_int Function %34 + %44 = OpAccessChain %_ptr_Function_BST %tree %int_0 + OpStore %44 %47 + OpSelectionMerge %48 None + OpSwitch %uint_0 %50 + %50 = OpLabel + OpStore %x_67_phi %false + OpStore %x_70_phi %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %62 = OpLoad %bool %x_67_phi + OpStore %x_67 %62 + %63 = OpLoad %int %x_70_phi + %64 = OpLoad %bool %x_67 + OpStore %x_116_phi %64 + %66 = OpSLessThanEqual %bool %63 %int_1 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %53 + %67 = OpLabel + %70 = OpAccessChain %_ptr_Function_int %tree %63 %uint_0 + %71 = OpLoad %int %70 + %73 = OpSLessThanEqual %bool %int_5 %71 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %79 = OpAccessChain %_ptr_Function_int %tree %63 %uint_1 + %80 = OpLoad %int %79 + %81 = OpIEqual %bool %80 %int_n1 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %89 = OpLoad %float %88 + %90 = OpFOrdLessThan %bool %87 %89 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + OpBranch %93 + %93 = OpLabel + OpLoopMerge %94 %95 None + OpBranch %96 + %96 = OpLabel + OpKill + %95 = OpLabel + OpBranch %93 + %94 = OpLabel + OpReturn + %91 = OpLabel + %97 = OpAccessChain %_ptr_Function_int %tree %63 %uint_1 + OpStore %97 %int_1 + %98 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %98 %99 + OpBranch %100 + %100 = OpLabel + OpLoopMerge %101 %102 None + OpBranch %103 + %103 = OpLabel + %104 = OpLoad %bool %x_67 + OpStore %x_114_phi %104 + %105 = OpConvertFToS %int %87 + %106 = OpSLessThan %bool %int_0 %105 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %109 + %108 = OpLabel + OpBranch %107 + %109 = OpLabel + OpBranch %101 + %107 = OpLabel + OpStore %x_114_phi %true + OpBranch %101 + %102 = OpLabel + OpBranch %100 + %101 = OpLabel + %111 = OpLoad %bool %x_114_phi + OpStore %x_114 %111 + %112 = OpLoad %bool %x_114 + OpStore %x_116_phi %112 + %113 = OpLoad %bool %x_114 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %114 + %115 = OpLabel + OpBranch %53 + %114 = OpLabel + OpBranch %82 + %84 = OpLabel + %116 = OpAccessChain %_ptr_Function_int %tree %63 %uint_1 + %117 = OpLoad %int %116 + OpStore %x_95 %117 + %118 = OpLoad %bool %x_67 + OpStore %x_68_phi %118 + %119 = OpLoad %int %x_95 + OpStore %x_71_phi %119 + OpBranch %54 + %82 = OpLabel + OpBranch %74 + %76 = OpLabel + %121 = OpAccessChain %_ptr_Function_int %tree %63 %uint_2 + %122 = OpLoad %int %121 + %123 = OpIEqual %bool %122 %int_n1 + OpSelectionMerge %124 None + OpBranchConditional %123 %125 %126 + %125 = OpLabel + %127 = OpAccessChain %_ptr_Function_int %tree %63 %uint_2 + OpStore %127 %int_1 + %128 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %128 %99 + OpStore %x_116_phi %true + OpBranch %53 + %126 = OpLabel + %129 = OpAccessChain %_ptr_Function_int %tree %63 %uint_2 + %130 = OpLoad %int %129 + OpStore %x_87 %130 + %131 = OpLoad %bool %x_67 + OpStore %x_68_phi %131 + %132 = OpLoad %int %x_87 + OpStore %x_71_phi %132 + OpBranch %54 + %124 = OpLabel + OpReturn + %74 = OpLabel + %133 = OpLoad %bool %x_114 + OpStore %x_68_phi %133 + OpStore %x_71_phi %63 + OpBranch %54 + %54 = OpLabel + %134 = OpLoad %bool %x_68_phi + OpStore %x_68 %134 + %135 = OpLoad %int %x_71_phi + OpStore %x_71 %135 + %136 = OpLoad %bool %x_68 + OpStore %x_67_phi %136 + %137 = OpLoad %int %x_71 + OpStore %x_70_phi %137 + OpBranch %52 + %53 = OpLabel + %138 = OpLoad %bool %x_116_phi + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + OpBranch %48 + %139 = OpLabel + OpBranch %48 + %48 = OpLabel + OpStore %x_119_phi %int_0 + OpBranch %141 + %141 = OpLabel + OpLoopMerge %142 %143 None + OpBranch %144 + %144 = OpLabel + %148 = OpLoad %int %x_119_phi + %150 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %151 = OpLoad %float %150 + %153 = OpFOrdLessThan %bool %151 %float_0 + OpStore %x_134_phi %153 + %154 = OpLogicalNot %bool %153 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %155 + %156 = OpLabel + %157 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %158 = OpLoad %float %157 + %159 = OpConvertFToS %int %158 + %160 = OpINotEqual %bool %148 %159 + OpStore %x_133 %160 + %161 = OpLoad %bool %x_133 + OpStore %x_134_phi %161 + OpBranch %155 + %155 = OpLabel + %162 = OpLoad %bool %x_134_phi + OpSelectionMerge %163 None + OpBranchConditional %162 %164 %165 + %164 = OpLabel + OpBranch %163 + %165 = OpLabel + OpBranch %142 + %163 = OpLabel + OpSelectionMerge %171 None + OpSwitch %uint_0 %172 + %172 = OpLabel + OpStore %x_139_phi %false + OpStore %x_142_phi %int_0 + OpBranch %173 + %173 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %183 = OpLoad %bool %x_139_phi + OpStore %x_139 %183 + %184 = OpLoad %int %x_142_phi + %185 = OpLoad %bool %x_139 + OpStore %x_188_phi %185 + %187 = OpSLessThanEqual %bool %184 %int_2 + OpSelectionMerge %188 None + OpBranchConditional %187 %189 %190 + %189 = OpLabel + OpBranch %188 + %190 = OpLabel + OpBranch %174 + %188 = OpLabel + %191 = OpAccessChain %_ptr_Function_int %tree %184 %uint_0 + %192 = OpLoad %int %191 + %194 = OpSLessThanEqual %bool %int_12 %192 + OpSelectionMerge %195 None + OpBranchConditional %194 %196 %197 + %196 = OpLabel + %199 = OpAccessChain %_ptr_Function_int %tree %184 %uint_1 + %200 = OpLoad %int %199 + %201 = OpIEqual %bool %200 %int_n1 + OpSelectionMerge %202 None + OpBranchConditional %201 %203 %204 + %203 = OpLabel + %205 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %206 = OpLoad %float %205 + %207 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %208 = OpLoad %float %207 + %209 = OpFOrdLessThan %bool %206 %208 + OpSelectionMerge %210 None + OpBranchConditional %209 %211 %210 + %211 = OpLabel + OpBranch %212 + %212 = OpLabel + OpLoopMerge %213 %214 None + OpBranch %215 + %215 = OpLabel + OpKill + %214 = OpLabel + OpBranch %212 + %213 = OpLabel + OpReturn + %210 = OpLabel + %216 = OpAccessChain %_ptr_Function_int %tree %184 %uint_1 + OpStore %216 %int_2 + %217 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %217 %218 + OpBranch %219 + %219 = OpLabel + OpLoopMerge %220 %221 None + OpBranch %222 + %222 = OpLabel + %223 = OpLoad %bool %x_139 + OpStore %x_186_phi %223 + %224 = OpConvertFToS %int %206 + %225 = OpSLessThan %bool %int_0 %224 + OpSelectionMerge %226 None + OpBranchConditional %225 %227 %228 + %227 = OpLabel + OpBranch %226 + %228 = OpLabel + OpBranch %220 + %226 = OpLabel + OpStore %x_186_phi %true + OpBranch %220 + %221 = OpLabel + OpBranch %219 + %220 = OpLabel + %229 = OpLoad %bool %x_186_phi + OpStore %x_186 %229 + %230 = OpLoad %bool %x_186 + OpStore %x_188_phi %230 + %231 = OpLoad %bool %x_186 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %232 + %233 = OpLabel + OpBranch %174 + %232 = OpLabel + OpBranch %202 + %204 = OpLabel + %234 = OpAccessChain %_ptr_Function_int %tree %184 %uint_1 + %235 = OpLoad %int %234 + OpStore %x_167 %235 + %236 = OpLoad %bool %x_139 + OpStore %x_140_phi %236 + %237 = OpLoad %int %x_167 + OpStore %x_143_phi %237 + OpBranch %175 + %202 = OpLabel + OpBranch %195 + %197 = OpLabel + %238 = OpAccessChain %_ptr_Function_int %tree %184 %uint_2 + %239 = OpLoad %int %238 + %240 = OpIEqual %bool %239 %int_n1 + OpSelectionMerge %241 None + OpBranchConditional %240 %242 %243 + %242 = OpLabel + %244 = OpAccessChain %_ptr_Function_int %tree %184 %uint_2 + OpStore %244 %int_2 + %245 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %245 %218 + OpStore %x_188_phi %true + OpBranch %174 + %243 = OpLabel + %246 = OpAccessChain %_ptr_Function_int %tree %184 %uint_2 + %247 = OpLoad %int %246 + OpStore %x_159 %247 + %248 = OpLoad %bool %x_139 + OpStore %x_140_phi %248 + %249 = OpLoad %int %x_159 + OpStore %x_143_phi %249 + OpBranch %175 + %241 = OpLabel + OpReturn + %195 = OpLabel + %250 = OpLoad %bool %x_186 + OpStore %x_140_phi %250 + OpStore %x_143_phi %184 + OpBranch %175 + %175 = OpLabel + %251 = OpLoad %bool %x_140_phi + OpStore %x_140 %251 + %252 = OpLoad %int %x_143_phi + OpStore %x_143 %252 + %253 = OpLoad %bool %x_140 + OpStore %x_139_phi %253 + %254 = OpLoad %int %x_143 + OpStore %x_142_phi %254 + OpBranch %173 + %174 = OpLabel + %255 = OpLoad %bool %x_188_phi + OpSelectionMerge %256 None + OpBranchConditional %255 %257 %256 + %257 = OpLabel + OpBranch %171 + %256 = OpLabel + OpBranch %171 + %171 = OpLabel + OpBranch %143 + %143 = OpLabel + %258 = OpIAdd %int %148 %int_1 + OpStore %x_120 %258 + %259 = OpLoad %int %x_120 + OpStore %x_119_phi %259 + OpBranch %141 + %142 = OpLabel + OpSelectionMerge %265 None + OpSwitch %uint_0 %266 + %266 = OpLabel + OpStore %x_193_phi %false + OpStore %x_196_phi %int_0 + OpBranch %267 + %267 = OpLabel + OpLoopMerge %268 %269 None + OpBranch %270 + %270 = OpLabel + %277 = OpLoad %bool %x_193_phi + OpStore %x_193 %277 + %278 = OpLoad %int %x_196_phi + %279 = OpLoad %bool %x_193 + OpStore %x_242_phi %279 + %281 = OpSLessThanEqual %bool %278 %int_3 + OpSelectionMerge %282 None + OpBranchConditional %281 %283 %284 + %283 = OpLabel + OpBranch %282 + %284 = OpLabel + OpBranch %268 + %282 = OpLabel + %285 = OpAccessChain %_ptr_Function_int %tree %278 %uint_0 + %286 = OpLoad %int %285 + %288 = OpSLessThanEqual %bool %int_15 %286 + OpSelectionMerge %289 None + OpBranchConditional %288 %290 %291 + %290 = OpLabel + %293 = OpAccessChain %_ptr_Function_int %tree %278 %uint_1 + %294 = OpLoad %int %293 + %295 = OpIEqual %bool %294 %int_n1 + OpSelectionMerge %296 None + OpBranchConditional %295 %297 %298 + %297 = OpLabel + %299 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %300 = OpLoad %float %299 + %301 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %302 = OpLoad %float %301 + %303 = OpFOrdLessThan %bool %300 %302 + OpSelectionMerge %304 None + OpBranchConditional %303 %305 %304 + %305 = OpLabel + OpBranch %306 + %306 = OpLabel + OpLoopMerge %307 %308 None + OpBranch %309 + %309 = OpLabel + OpKill + %308 = OpLabel + OpBranch %306 + %307 = OpLabel + OpReturn + %304 = OpLabel + %310 = OpAccessChain %_ptr_Function_int %tree %278 %uint_1 + OpStore %310 %int_3 + %311 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %311 %312 + OpBranch %313 + %313 = OpLabel + OpLoopMerge %314 %315 None + OpBranch %316 + %316 = OpLabel + %317 = OpLoad %bool %x_193 + OpStore %x_240_phi %317 + %318 = OpConvertFToS %int %300 + %319 = OpSLessThan %bool %int_0 %318 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %322 + %321 = OpLabel + OpBranch %320 + %322 = OpLabel + OpBranch %314 + %320 = OpLabel + OpStore %x_240_phi %true + OpBranch %314 + %315 = OpLabel + OpBranch %313 + %314 = OpLabel + %323 = OpLoad %bool %x_240_phi + OpStore %x_240 %323 + %324 = OpLoad %bool %x_240 + OpStore %x_242_phi %324 + %325 = OpLoad %bool %x_240 + OpSelectionMerge %326 None + OpBranchConditional %325 %327 %326 + %327 = OpLabel + OpBranch %268 + %326 = OpLabel + OpBranch %296 + %298 = OpLabel + %328 = OpAccessChain %_ptr_Function_int %tree %278 %uint_1 + %329 = OpLoad %int %328 + OpStore %x_221 %329 + %330 = OpLoad %bool %x_193 + OpStore %x_194_phi %330 + %331 = OpLoad %int %x_221 + OpStore %x_197_phi %331 + OpBranch %269 + %296 = OpLabel + OpBranch %289 + %291 = OpLabel + %332 = OpAccessChain %_ptr_Function_int %tree %278 %uint_2 + %333 = OpLoad %int %332 + %334 = OpIEqual %bool %333 %int_n1 + OpSelectionMerge %335 None + OpBranchConditional %334 %336 %337 + %336 = OpLabel + %338 = OpAccessChain %_ptr_Function_int %tree %278 %uint_2 + OpStore %338 %int_3 + %339 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %339 %312 + OpStore %x_242_phi %true + OpBranch %268 + %337 = OpLabel + %340 = OpAccessChain %_ptr_Function_int %tree %278 %uint_2 + %341 = OpLoad %int %340 + OpStore %x_213 %341 + %342 = OpLoad %bool %x_193 + OpStore %x_194_phi %342 + %343 = OpLoad %int %x_213 + OpStore %x_197_phi %343 + OpBranch %269 + %335 = OpLabel + OpReturn + %289 = OpLabel + %344 = OpLoad %bool %x_240 + OpStore %x_194_phi %344 + OpStore %x_197_phi %278 + OpBranch %269 + %269 = OpLabel + %345 = OpLoad %bool %x_194_phi + OpStore %x_194 %345 + %346 = OpLoad %int %x_197_phi + OpStore %x_197 %346 + %347 = OpLoad %bool %x_194 + OpStore %x_193_phi %347 + %348 = OpLoad %int %x_197 + OpStore %x_196_phi %348 + OpBranch %267 + %268 = OpLabel + %349 = OpLoad %bool %x_242_phi + OpSelectionMerge %350 None + OpBranchConditional %349 %351 %350 + %351 = OpLabel + OpBranch %265 + %350 = OpLabel + OpBranch %265 + %265 = OpLabel + OpSelectionMerge %357 None + OpSwitch %uint_0 %358 + %358 = OpLabel + OpStore %x_247_phi %false + OpStore %x_250_phi %int_0 + OpBranch %359 + %359 = OpLabel + OpLoopMerge %360 %361 None + OpBranch %362 + %362 = OpLabel + %369 = OpLoad %bool %x_247_phi + OpStore %x_247 %369 + %370 = OpLoad %int %x_250_phi + %371 = OpLoad %bool %x_247 + OpStore %x_296_phi %371 + %373 = OpSLessThanEqual %bool %370 %int_4 + OpSelectionMerge %374 None + OpBranchConditional %373 %375 %376 + %375 = OpLabel + OpBranch %374 + %376 = OpLabel + OpBranch %360 + %374 = OpLabel + %377 = OpAccessChain %_ptr_Function_int %tree %370 %uint_0 + %378 = OpLoad %int %377 + %380 = OpSLessThanEqual %bool %int_7 %378 + OpSelectionMerge %381 None + OpBranchConditional %380 %382 %383 + %382 = OpLabel + %385 = OpAccessChain %_ptr_Function_int %tree %370 %uint_1 + %386 = OpLoad %int %385 + %387 = OpIEqual %bool %386 %int_n1 + OpSelectionMerge %388 None + OpBranchConditional %387 %389 %390 + %389 = OpLabel + %391 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %392 = OpLoad %float %391 + %393 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %394 = OpLoad %float %393 + %395 = OpFOrdLessThan %bool %392 %394 + OpSelectionMerge %396 None + OpBranchConditional %395 %397 %396 + %397 = OpLabel + OpBranch %398 + %398 = OpLabel + OpLoopMerge %399 %400 None + OpBranch %401 + %401 = OpLabel + OpKill + %400 = OpLabel + OpBranch %398 + %399 = OpLabel + OpReturn + %396 = OpLabel + %402 = OpAccessChain %_ptr_Function_int %tree %370 %uint_1 + OpStore %402 %int_4 + %403 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %403 %404 + OpBranch %405 + %405 = OpLabel + OpLoopMerge %406 %407 None + OpBranch %408 + %408 = OpLabel + %409 = OpLoad %bool %x_247 + OpStore %x_294_phi %409 + %410 = OpConvertFToS %int %392 + %411 = OpSLessThan %bool %int_0 %410 + OpSelectionMerge %412 None + OpBranchConditional %411 %413 %414 + %413 = OpLabel + OpBranch %412 + %414 = OpLabel + OpBranch %406 + %412 = OpLabel + OpStore %x_294_phi %true + OpBranch %406 + %407 = OpLabel + OpBranch %405 + %406 = OpLabel + %415 = OpLoad %bool %x_294_phi + OpStore %x_294 %415 + %416 = OpLoad %bool %x_294 + OpStore %x_296_phi %416 + %417 = OpLoad %bool %x_294 + OpSelectionMerge %418 None + OpBranchConditional %417 %419 %418 + %419 = OpLabel + OpBranch %360 + %418 = OpLabel + OpBranch %388 + %390 = OpLabel + %420 = OpAccessChain %_ptr_Function_int %tree %370 %uint_1 + %421 = OpLoad %int %420 + OpStore %x_275 %421 + %422 = OpLoad %bool %x_247 + OpStore %x_248_phi %422 + %423 = OpLoad %int %x_275 + OpStore %x_251_phi %423 + OpBranch %361 + %388 = OpLabel + OpBranch %381 + %383 = OpLabel + %424 = OpAccessChain %_ptr_Function_int %tree %370 %uint_2 + %425 = OpLoad %int %424 + %426 = OpIEqual %bool %425 %int_n1 + OpSelectionMerge %427 None + OpBranchConditional %426 %428 %429 + %428 = OpLabel + %430 = OpAccessChain %_ptr_Function_int %tree %370 %uint_2 + OpStore %430 %int_4 + %431 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %431 %404 + OpStore %x_296_phi %true + OpBranch %360 + %429 = OpLabel + %432 = OpAccessChain %_ptr_Function_int %tree %370 %uint_2 + %433 = OpLoad %int %432 + OpStore %x_267 %433 + %434 = OpLoad %bool %x_247 + OpStore %x_248_phi %434 + %435 = OpLoad %int %x_267 + OpStore %x_251_phi %435 + OpBranch %361 + %427 = OpLabel + OpReturn + %381 = OpLabel + %436 = OpLoad %bool %x_294 + OpStore %x_248_phi %436 + OpStore %x_251_phi %370 + OpBranch %361 + %361 = OpLabel + %437 = OpLoad %bool %x_248_phi + OpStore %x_248 %437 + %438 = OpLoad %int %x_251_phi + OpStore %x_251 %438 + %439 = OpLoad %bool %x_248 + OpStore %x_247_phi %439 + %440 = OpLoad %int %x_251 + OpStore %x_250_phi %440 + OpBranch %359 + %360 = OpLabel + %441 = OpLoad %bool %x_296_phi + OpSelectionMerge %442 None + OpBranchConditional %441 %443 %442 + %443 = OpLabel + OpBranch %357 + %442 = OpLabel + OpBranch %357 + %357 = OpLabel + OpSelectionMerge %449 None + OpSwitch %uint_0 %450 + %450 = OpLabel + OpStore %x_301_phi %false + OpStore %x_304_phi %int_0 + OpBranch %451 + %451 = OpLabel + OpLoopMerge %452 %453 None + OpBranch %454 + %454 = OpLabel + %461 = OpLoad %bool %x_301_phi + OpStore %x_301 %461 + %462 = OpLoad %int %x_304_phi + %463 = OpLoad %bool %x_301 + OpStore %x_350_phi %463 + %464 = OpSLessThanEqual %bool %462 %int_5 + OpSelectionMerge %465 None + OpBranchConditional %464 %466 %467 + %466 = OpLabel + OpBranch %465 + %467 = OpLabel + OpBranch %452 + %465 = OpLabel + %468 = OpAccessChain %_ptr_Function_int %tree %462 %uint_0 + %469 = OpLoad %int %468 + %471 = OpSLessThanEqual %bool %int_8 %469 + OpSelectionMerge %472 None + OpBranchConditional %471 %473 %474 + %473 = OpLabel + %476 = OpAccessChain %_ptr_Function_int %tree %462 %uint_1 + %477 = OpLoad %int %476 + %478 = OpIEqual %bool %477 %int_n1 + OpSelectionMerge %479 None + OpBranchConditional %478 %480 %481 + %480 = OpLabel + %482 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %483 = OpLoad %float %482 + %484 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %485 = OpLoad %float %484 + %486 = OpFOrdLessThan %bool %483 %485 + OpSelectionMerge %487 None + OpBranchConditional %486 %488 %487 + %488 = OpLabel + OpBranch %489 + %489 = OpLabel + OpLoopMerge %490 %491 None + OpBranch %492 + %492 = OpLabel + OpKill + %491 = OpLabel + OpBranch %489 + %490 = OpLabel + OpReturn + %487 = OpLabel + %493 = OpAccessChain %_ptr_Function_int %tree %462 %uint_1 + OpStore %493 %int_5 + %494 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %494 %495 + OpBranch %496 + %496 = OpLabel + OpLoopMerge %497 %498 None + OpBranch %499 + %499 = OpLabel + %500 = OpLoad %bool %x_301 + OpStore %x_348_phi %500 + %501 = OpConvertFToS %int %483 + %502 = OpSLessThan %bool %int_0 %501 + OpSelectionMerge %503 None + OpBranchConditional %502 %504 %505 + %504 = OpLabel + OpBranch %503 + %505 = OpLabel + OpBranch %497 + %503 = OpLabel + OpStore %x_348_phi %true + OpBranch %497 + %498 = OpLabel + OpBranch %496 + %497 = OpLabel + %506 = OpLoad %bool %x_348_phi + OpStore %x_348 %506 + %507 = OpLoad %bool %x_348 + OpStore %x_350_phi %507 + %508 = OpLoad %bool %x_348 + OpSelectionMerge %509 None + OpBranchConditional %508 %510 %509 + %510 = OpLabel + OpBranch %452 + %509 = OpLabel + OpBranch %479 + %481 = OpLabel + %511 = OpAccessChain %_ptr_Function_int %tree %462 %uint_1 + %512 = OpLoad %int %511 + OpStore %x_329 %512 + %513 = OpLoad %bool %x_301 + OpStore %x_302_phi %513 + %514 = OpLoad %int %x_329 + OpStore %x_305_phi %514 + OpBranch %453 + %479 = OpLabel + OpBranch %472 + %474 = OpLabel + %515 = OpAccessChain %_ptr_Function_int %tree %462 %uint_2 + %516 = OpLoad %int %515 + %517 = OpIEqual %bool %516 %int_n1 + OpSelectionMerge %518 None + OpBranchConditional %517 %519 %520 + %519 = OpLabel + %521 = OpAccessChain %_ptr_Function_int %tree %462 %uint_2 + OpStore %521 %int_5 + %522 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %522 %495 + OpStore %x_350_phi %true + OpBranch %452 + %520 = OpLabel + %523 = OpAccessChain %_ptr_Function_int %tree %462 %uint_2 + %524 = OpLoad %int %523 + OpStore %x_321 %524 + %525 = OpLoad %bool %x_301 + OpStore %x_302_phi %525 + %526 = OpLoad %int %x_321 + OpStore %x_305_phi %526 + OpBranch %453 + %518 = OpLabel + OpReturn + %472 = OpLabel + %527 = OpLoad %bool %x_348 + OpStore %x_302_phi %527 + OpStore %x_305_phi %462 + OpBranch %453 + %453 = OpLabel + %528 = OpLoad %bool %x_302_phi + OpStore %x_302 %528 + %529 = OpLoad %int %x_305_phi + OpStore %x_305 %529 + %530 = OpLoad %bool %x_302 + OpStore %x_301_phi %530 + %531 = OpLoad %int %x_305 + OpStore %x_304_phi %531 + OpBranch %451 + %452 = OpLabel + %532 = OpLoad %bool %x_350_phi + OpSelectionMerge %533 None + OpBranchConditional %532 %534 %533 + %534 = OpLabel + OpBranch %449 + %533 = OpLabel + OpBranch %449 + %449 = OpLabel + OpSelectionMerge %540 None + OpSwitch %uint_0 %541 + %541 = OpLabel + OpStore %x_355_phi %false + OpStore %x_358_phi %int_0 + OpBranch %542 + %542 = OpLabel + OpLoopMerge %543 %544 None + OpBranch %545 + %545 = OpLabel + %552 = OpLoad %bool %x_355_phi + OpStore %x_355 %552 + %553 = OpLoad %int %x_358_phi + %554 = OpLoad %bool %x_355 + OpStore %x_404_phi %554 + %556 = OpSLessThanEqual %bool %553 %int_6 + OpSelectionMerge %557 None + OpBranchConditional %556 %558 %559 + %558 = OpLabel + OpBranch %557 + %559 = OpLabel + OpBranch %543 + %557 = OpLabel + %560 = OpAccessChain %_ptr_Function_int %tree %553 %uint_0 + %561 = OpLoad %int %560 + %562 = OpSLessThanEqual %bool %int_2 %561 + OpSelectionMerge %563 None + OpBranchConditional %562 %564 %565 + %564 = OpLabel + %567 = OpAccessChain %_ptr_Function_int %tree %553 %uint_1 + %568 = OpLoad %int %567 + %569 = OpIEqual %bool %568 %int_n1 + OpSelectionMerge %570 None + OpBranchConditional %569 %571 %572 + %571 = OpLabel + %573 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %574 = OpLoad %float %573 + %575 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %576 = OpLoad %float %575 + %577 = OpFOrdLessThan %bool %574 %576 + OpSelectionMerge %578 None + OpBranchConditional %577 %579 %578 + %579 = OpLabel + OpBranch %580 + %580 = OpLabel + OpLoopMerge %581 %582 None + OpBranch %583 + %583 = OpLabel + OpKill + %582 = OpLabel + OpBranch %580 + %581 = OpLabel + OpReturn + %578 = OpLabel + %584 = OpAccessChain %_ptr_Function_int %tree %553 %uint_1 + OpStore %584 %int_6 + %585 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %585 %586 + OpBranch %587 + %587 = OpLabel + OpLoopMerge %588 %589 None + OpBranch %590 + %590 = OpLabel + %591 = OpLoad %bool %x_355 + OpStore %x_402_phi %591 + %592 = OpConvertFToS %int %574 + %593 = OpSLessThan %bool %int_0 %592 + OpSelectionMerge %594 None + OpBranchConditional %593 %595 %596 + %595 = OpLabel + OpBranch %594 + %596 = OpLabel + OpBranch %588 + %594 = OpLabel + OpStore %x_402_phi %true + OpBranch %588 + %589 = OpLabel + OpBranch %587 + %588 = OpLabel + %597 = OpLoad %bool %x_402_phi + OpStore %x_402 %597 + %598 = OpLoad %bool %x_402 + OpStore %x_404_phi %598 + %599 = OpLoad %bool %x_402 + OpSelectionMerge %600 None + OpBranchConditional %599 %601 %600 + %601 = OpLabel + OpBranch %543 + %600 = OpLabel + OpBranch %570 + %572 = OpLabel + %602 = OpAccessChain %_ptr_Function_int %tree %553 %uint_1 + %603 = OpLoad %int %602 + OpStore %x_383 %603 + %604 = OpLoad %bool %x_355 + OpStore %x_356_phi %604 + %605 = OpLoad %int %x_383 + OpStore %x_359_phi %605 + OpBranch %544 + %570 = OpLabel + OpBranch %563 + %565 = OpLabel + %606 = OpAccessChain %_ptr_Function_int %tree %553 %uint_2 + %607 = OpLoad %int %606 + %608 = OpIEqual %bool %607 %int_n1 + OpSelectionMerge %609 None + OpBranchConditional %608 %610 %611 + %610 = OpLabel + %612 = OpAccessChain %_ptr_Function_int %tree %553 %uint_2 + OpStore %612 %int_6 + %613 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %613 %586 + OpStore %x_404_phi %true + OpBranch %543 + %611 = OpLabel + %614 = OpAccessChain %_ptr_Function_int %tree %553 %uint_2 + %615 = OpLoad %int %614 + OpStore %x_375 %615 + %616 = OpLoad %bool %x_355 + OpStore %x_356_phi %616 + %617 = OpLoad %int %x_375 + OpStore %x_359_phi %617 + OpBranch %544 + %609 = OpLabel + OpReturn + %563 = OpLabel + %618 = OpLoad %bool %x_402 + OpStore %x_356_phi %618 + OpStore %x_359_phi %553 + OpBranch %544 + %544 = OpLabel + %619 = OpLoad %bool %x_356_phi + OpStore %x_356 %619 + %620 = OpLoad %int %x_359_phi + OpStore %x_359 %620 + %621 = OpLoad %bool %x_356 + OpStore %x_355_phi %621 + %622 = OpLoad %int %x_359 + OpStore %x_358_phi %622 + OpBranch %542 + %543 = OpLabel + %623 = OpLoad %bool %x_404_phi + OpSelectionMerge %624 None + OpBranchConditional %623 %625 %624 + %625 = OpLabel + OpBranch %540 + %624 = OpLabel + OpBranch %540 + %540 = OpLabel + OpSelectionMerge %631 None + OpSwitch %uint_0 %632 + %632 = OpLabel + OpStore %x_409_phi %false + OpStore %x_412_phi %int_0 + OpBranch %633 + %633 = OpLabel + OpLoopMerge %634 %635 None + OpBranch %636 + %636 = OpLabel + %643 = OpLoad %bool %x_409_phi + OpStore %x_409 %643 + %644 = OpLoad %int %x_412_phi + %645 = OpLoad %bool %x_409 + OpStore %x_458_phi %645 + %646 = OpSLessThanEqual %bool %644 %int_7 + OpSelectionMerge %647 None + OpBranchConditional %646 %648 %649 + %648 = OpLabel + OpBranch %647 + %649 = OpLabel + OpBranch %634 + %647 = OpLabel + %650 = OpAccessChain %_ptr_Function_int %tree %644 %uint_0 + %651 = OpLoad %int %650 + %652 = OpSLessThanEqual %bool %int_6 %651 + OpSelectionMerge %653 None + OpBranchConditional %652 %654 %655 + %654 = OpLabel + %657 = OpAccessChain %_ptr_Function_int %tree %644 %uint_1 + %658 = OpLoad %int %657 + %659 = OpIEqual %bool %658 %int_n1 + OpSelectionMerge %660 None + OpBranchConditional %659 %661 %662 + %661 = OpLabel + %663 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %664 = OpLoad %float %663 + %665 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %666 = OpLoad %float %665 + %667 = OpFOrdLessThan %bool %664 %666 + OpSelectionMerge %668 None + OpBranchConditional %667 %669 %668 + %669 = OpLabel + OpBranch %670 + %670 = OpLabel + OpLoopMerge %671 %672 None + OpBranch %673 + %673 = OpLabel + OpKill + %672 = OpLabel + OpBranch %670 + %671 = OpLabel + OpReturn + %668 = OpLabel + %674 = OpAccessChain %_ptr_Function_int %tree %644 %uint_1 + OpStore %674 %int_7 + %675 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %675 %676 + OpBranch %677 + %677 = OpLabel + OpLoopMerge %678 %679 None + OpBranch %680 + %680 = OpLabel + %681 = OpLoad %bool %x_409 + OpStore %x_456_phi %681 + %682 = OpConvertFToS %int %664 + %683 = OpSLessThan %bool %int_0 %682 + OpSelectionMerge %684 None + OpBranchConditional %683 %685 %686 + %685 = OpLabel + OpBranch %684 + %686 = OpLabel + OpBranch %678 + %684 = OpLabel + OpStore %x_456_phi %true + OpBranch %678 + %679 = OpLabel + OpBranch %677 + %678 = OpLabel + %687 = OpLoad %bool %x_456_phi + OpStore %x_456 %687 + %688 = OpLoad %bool %x_456 + OpStore %x_458_phi %688 + %689 = OpLoad %bool %x_456 + OpSelectionMerge %690 None + OpBranchConditional %689 %691 %690 + %691 = OpLabel + OpBranch %634 + %690 = OpLabel + OpBranch %660 + %662 = OpLabel + %692 = OpAccessChain %_ptr_Function_int %tree %644 %uint_1 + %693 = OpLoad %int %692 + OpStore %x_437 %693 + %694 = OpLoad %bool %x_409 + OpStore %x_410_phi %694 + %695 = OpLoad %int %x_437 + OpStore %x_413_phi %695 + OpBranch %635 + %660 = OpLabel + OpBranch %653 + %655 = OpLabel + %696 = OpAccessChain %_ptr_Function_int %tree %644 %uint_2 + %697 = OpLoad %int %696 + %698 = OpIEqual %bool %697 %int_n1 + OpSelectionMerge %699 None + OpBranchConditional %698 %700 %701 + %700 = OpLabel + %702 = OpAccessChain %_ptr_Function_int %tree %644 %uint_2 + OpStore %702 %int_7 + %703 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %703 %676 + OpStore %x_458_phi %true + OpBranch %634 + %701 = OpLabel + %704 = OpAccessChain %_ptr_Function_int %tree %644 %uint_2 + %705 = OpLoad %int %704 + OpStore %x_429 %705 + %706 = OpLoad %bool %x_409 + OpStore %x_410_phi %706 + %707 = OpLoad %int %x_429 + OpStore %x_413_phi %707 + OpBranch %635 + %699 = OpLabel + OpReturn + %653 = OpLabel + %708 = OpLoad %bool %x_456 + OpStore %x_410_phi %708 + OpStore %x_413_phi %644 + OpBranch %635 + %635 = OpLabel + %709 = OpLoad %bool %x_410_phi + OpStore %x_410 %709 + %710 = OpLoad %int %x_413_phi + OpStore %x_413 %710 + %711 = OpLoad %bool %x_410 + OpStore %x_409_phi %711 + %712 = OpLoad %int %x_413 + OpStore %x_412_phi %712 + OpBranch %633 + %634 = OpLabel + %713 = OpLoad %bool %x_458_phi + OpSelectionMerge %714 None + OpBranchConditional %713 %715 %714 + %715 = OpLabel + OpBranch %631 + %714 = OpLabel + OpBranch %631 + %631 = OpLabel + OpSelectionMerge %721 None + OpSwitch %uint_0 %722 + %722 = OpLabel + OpStore %x_463_phi %false + OpStore %x_466_phi %int_0 + OpBranch %723 + %723 = OpLabel + OpLoopMerge %724 %725 None + OpBranch %726 + %726 = OpLabel + %733 = OpLoad %bool %x_463_phi + OpStore %x_463 %733 + %734 = OpLoad %int %x_466_phi + %735 = OpLoad %bool %x_463 + OpStore %x_512_phi %735 + %736 = OpSLessThanEqual %bool %734 %int_8 + OpSelectionMerge %737 None + OpBranchConditional %736 %738 %739 + %738 = OpLabel + OpBranch %737 + %739 = OpLabel + OpBranch %724 + %737 = OpLabel + %740 = OpAccessChain %_ptr_Function_int %tree %734 %uint_0 + %741 = OpLoad %int %740 + %743 = OpSLessThanEqual %bool %int_17 %741 + OpSelectionMerge %744 None + OpBranchConditional %743 %745 %746 + %745 = OpLabel + %748 = OpAccessChain %_ptr_Function_int %tree %734 %uint_1 + %749 = OpLoad %int %748 + %750 = OpIEqual %bool %749 %int_n1 + OpSelectionMerge %751 None + OpBranchConditional %750 %752 %753 + %752 = OpLabel + %754 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %755 = OpLoad %float %754 + %756 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %757 = OpLoad %float %756 + %758 = OpFOrdLessThan %bool %755 %757 + OpSelectionMerge %759 None + OpBranchConditional %758 %760 %759 + %760 = OpLabel + OpBranch %761 + %761 = OpLabel + OpLoopMerge %762 %763 None + OpBranch %764 + %764 = OpLabel + OpKill + %763 = OpLabel + OpBranch %761 + %762 = OpLabel + OpReturn + %759 = OpLabel + %765 = OpAccessChain %_ptr_Function_int %tree %734 %uint_1 + OpStore %765 %int_8 + %766 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %766 %767 + OpBranch %768 + %768 = OpLabel + OpLoopMerge %769 %770 None + OpBranch %771 + %771 = OpLabel + %772 = OpLoad %bool %x_463 + OpStore %x_510_phi %772 + %773 = OpConvertFToS %int %755 + %774 = OpSLessThan %bool %int_0 %773 + OpSelectionMerge %775 None + OpBranchConditional %774 %776 %777 + %776 = OpLabel + OpBranch %775 + %777 = OpLabel + OpBranch %769 + %775 = OpLabel + OpStore %x_510_phi %true + OpBranch %769 + %770 = OpLabel + OpBranch %768 + %769 = OpLabel + %778 = OpLoad %bool %x_510_phi + OpStore %x_510 %778 + %779 = OpLoad %bool %x_510 + OpStore %x_512_phi %779 + %780 = OpLoad %bool %x_510 + OpSelectionMerge %781 None + OpBranchConditional %780 %782 %781 + %782 = OpLabel + OpBranch %724 + %781 = OpLabel + OpBranch %751 + %753 = OpLabel + %783 = OpAccessChain %_ptr_Function_int %tree %734 %uint_1 + %784 = OpLoad %int %783 + OpStore %x_491 %784 + %785 = OpLoad %bool %x_463 + OpStore %x_464_phi %785 + %786 = OpLoad %int %x_491 + OpStore %x_467_phi %786 + OpBranch %725 + %751 = OpLabel + OpBranch %744 + %746 = OpLabel + %787 = OpAccessChain %_ptr_Function_int %tree %734 %uint_2 + %788 = OpLoad %int %787 + %789 = OpIEqual %bool %788 %int_n1 + OpSelectionMerge %790 None + OpBranchConditional %789 %791 %792 + %791 = OpLabel + %793 = OpAccessChain %_ptr_Function_int %tree %734 %uint_2 + OpStore %793 %int_8 + %794 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %794 %767 + OpStore %x_512_phi %true + OpBranch %724 + %792 = OpLabel + %795 = OpAccessChain %_ptr_Function_int %tree %734 %uint_2 + %796 = OpLoad %int %795 + OpStore %x_483 %796 + %797 = OpLoad %bool %x_463 + OpStore %x_464_phi %797 + %798 = OpLoad %int %x_483 + OpStore %x_467_phi %798 + OpBranch %725 + %790 = OpLabel + OpReturn + %744 = OpLabel + %799 = OpLoad %bool %x_510 + OpStore %x_464_phi %799 + OpStore %x_467_phi %734 + OpBranch %725 + %725 = OpLabel + %800 = OpLoad %bool %x_464_phi + OpStore %x_464 %800 + %801 = OpLoad %int %x_467_phi + OpStore %x_467 %801 + %802 = OpLoad %bool %x_464 + OpStore %x_463_phi %802 + %803 = OpLoad %int %x_467 + OpStore %x_466_phi %803 + OpBranch %723 + %724 = OpLabel + %804 = OpLoad %bool %x_512_phi + OpSelectionMerge %805 None + OpBranchConditional %804 %806 %805 + %806 = OpLabel + OpBranch %721 + %805 = OpLabel + OpBranch %721 + %721 = OpLabel + OpSelectionMerge %812 None + OpSwitch %uint_0 %813 + %813 = OpLabel + OpStore %x_517_phi %false + OpStore %x_520_phi %int_0 + OpBranch %814 + %814 = OpLabel + OpLoopMerge %815 %816 None + OpBranch %817 + %817 = OpLabel + %824 = OpLoad %bool %x_517_phi + OpStore %x_517 %824 + %825 = OpLoad %int %x_520_phi + %826 = OpLoad %bool %x_517 + OpStore %x_566_phi %826 + %827 = OpSLessThanEqual %bool %825 %int_9 + OpSelectionMerge %828 None + OpBranchConditional %827 %829 %830 + %829 = OpLabel + OpBranch %828 + %830 = OpLabel + OpBranch %815 + %828 = OpLabel + %831 = OpAccessChain %_ptr_Function_int %tree %825 %uint_0 + %832 = OpLoad %int %831 + %834 = OpSLessThanEqual %bool %int_13 %832 + OpSelectionMerge %835 None + OpBranchConditional %834 %836 %837 + %836 = OpLabel + %839 = OpAccessChain %_ptr_Function_int %tree %825 %uint_1 + %840 = OpLoad %int %839 + %841 = OpIEqual %bool %840 %int_n1 + OpSelectionMerge %842 None + OpBranchConditional %841 %843 %844 + %843 = OpLabel + %845 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %846 = OpLoad %float %845 + %847 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %848 = OpLoad %float %847 + %849 = OpFOrdLessThan %bool %846 %848 + OpSelectionMerge %850 None + OpBranchConditional %849 %851 %850 + %851 = OpLabel + OpBranch %852 + %852 = OpLabel + OpLoopMerge %853 %854 None + OpBranch %855 + %855 = OpLabel + OpKill + %854 = OpLabel + OpBranch %852 + %853 = OpLabel + OpReturn + %850 = OpLabel + %856 = OpAccessChain %_ptr_Function_int %tree %825 %uint_1 + OpStore %856 %int_9 + %857 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %857 %858 + OpBranch %859 + %859 = OpLabel + OpLoopMerge %860 %861 None + OpBranch %862 + %862 = OpLabel + %863 = OpLoad %bool %x_517 + OpStore %x_564_phi %863 + %864 = OpConvertFToS %int %846 + %865 = OpSLessThan %bool %int_0 %864 + OpSelectionMerge %866 None + OpBranchConditional %865 %867 %868 + %867 = OpLabel + OpBranch %866 + %868 = OpLabel + OpBranch %860 + %866 = OpLabel + OpStore %x_564_phi %true + OpBranch %860 + %861 = OpLabel + OpBranch %859 + %860 = OpLabel + %869 = OpLoad %bool %x_564_phi + OpStore %x_564 %869 + %870 = OpLoad %bool %x_564 + OpStore %x_566_phi %870 + %871 = OpLoad %bool %x_564 + OpSelectionMerge %872 None + OpBranchConditional %871 %873 %872 + %873 = OpLabel + OpBranch %815 + %872 = OpLabel + OpBranch %842 + %844 = OpLabel + %874 = OpAccessChain %_ptr_Function_int %tree %825 %uint_1 + %875 = OpLoad %int %874 + OpStore %x_545 %875 + %876 = OpLoad %bool %x_517 + OpStore %x_518_phi %876 + %877 = OpLoad %int %x_545 + OpStore %x_521_phi %877 + OpBranch %816 + %842 = OpLabel + OpBranch %835 + %837 = OpLabel + %878 = OpAccessChain %_ptr_Function_int %tree %825 %uint_2 + %879 = OpLoad %int %878 + %880 = OpIEqual %bool %879 %int_n1 + OpSelectionMerge %881 None + OpBranchConditional %880 %882 %883 + %882 = OpLabel + %884 = OpAccessChain %_ptr_Function_int %tree %825 %uint_2 + OpStore %884 %int_9 + %885 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %885 %858 + OpStore %x_566_phi %true + OpBranch %815 + %883 = OpLabel + %886 = OpAccessChain %_ptr_Function_int %tree %825 %uint_2 + %887 = OpLoad %int %886 + OpStore %x_537 %887 + %888 = OpLoad %bool %x_517 + OpStore %x_518_phi %888 + %889 = OpLoad %int %x_537 + OpStore %x_521_phi %889 + OpBranch %816 + %881 = OpLabel + OpReturn + %835 = OpLabel + %890 = OpLoad %bool %x_564 + OpStore %x_518_phi %890 + OpStore %x_521_phi %825 + OpBranch %816 + %816 = OpLabel + %891 = OpLoad %bool %x_518_phi + OpStore %x_518 %891 + %892 = OpLoad %int %x_521_phi + OpStore %x_521 %892 + %893 = OpLoad %bool %x_518 + OpStore %x_517_phi %893 + %894 = OpLoad %int %x_521 + OpStore %x_520_phi %894 + OpBranch %814 + %815 = OpLabel + %895 = OpLoad %bool %x_566_phi + OpSelectionMerge %896 None + OpBranchConditional %895 %897 %896 + %897 = OpLabel + OpBranch %812 + %896 = OpLabel + OpBranch %812 + %812 = OpLabel + OpStore %x_569_phi %int_0 + OpStore %x_572_phi %int_0 + OpStore %x_574_phi %int_0 + OpBranch %898 + %898 = OpLabel + OpLoopMerge %899 %900 None + OpBranch %901 + %901 = OpLabel + %908 = OpLoad %int %x_569_phi + %909 = OpLoad %int %x_572_phi + OpStore %x_572 %909 + %910 = OpLoad %int %x_574_phi + %912 = OpSLessThan %bool %910 %int_20 + OpSelectionMerge %913 None + OpBranchConditional %912 %914 %915 + %914 = OpLabel + OpBranch %913 + %915 = OpLabel + OpBranch %899 + %913 = OpLabel + OpSelectionMerge %919 None + OpSwitch %uint_0 %920 + %920 = OpLabel + OpStore %x_582_phi %int_0 + OpBranch %921 + %921 = OpLabel + OpLoopMerge %922 %923 None + OpBranch %924 + %924 = OpLabel + %925 = OpLoad %int %x_582_phi + OpStore %x_597_phi %908 + OpStore %x_598_phi %false + %926 = OpINotEqual %bool %925 %int_n1 + OpSelectionMerge %927 None + OpBranchConditional %926 %928 %929 + %928 = OpLabel + OpBranch %927 + %929 = OpLabel + OpBranch %922 + %927 = OpLabel + %930 = OpAccessChain %_ptr_Function_BST %tree %925 + %931 = OpLoad %BST %930 + %932 = OpCompositeExtract %int %931 0 + %933 = OpCompositeExtract %int %931 1 + %934 = OpCompositeExtract %int %931 2 + %935 = OpIEqual %bool %932 %910 + OpSelectionMerge %936 None + OpBranchConditional %935 %937 %936 + %937 = OpLabel + OpStore %x_597_phi %910 + OpStore %x_598_phi %true + OpBranch %922 + %936 = OpLabel + OpBranch %923 + %923 = OpLabel + %939 = OpSGreaterThan %bool %910 %932 + %938 = OpSelect %int %939 %934 %933 + OpStore %x_582_phi %938 + OpBranch %921 + %922 = OpLabel + %940 = OpLoad %int %x_597_phi + OpStore %x_597 %940 + %941 = OpLoad %bool %x_598_phi + %942 = OpLoad %int %x_597 + OpStore %x_570_phi %942 + OpSelectionMerge %943 None + OpBranchConditional %941 %944 %943 + %944 = OpLabel + OpBranch %919 + %943 = OpLabel + OpStore %x_570_phi %int_n1 + OpBranch %919 + %919 = OpLabel + %950 = OpLoad %int %x_570_phi + OpStore %x_570 %950 + OpSelectionMerge %951 None + OpSwitch %910 %952 2 %953 5 %953 6 %953 7 %953 8 %953 9 %953 12 %953 13 %953 15 %953 17 %953 + %953 = OpLabel + %954 = OpLoad %int %x_572 + OpStore %x_607_phi %954 + %955 = OpLoad %int %x_570 + %956 = OpCopyObject %int %910 + %957 = OpIEqual %bool %955 %956 + OpSelectionMerge %958 None + OpBranchConditional %957 %959 %958 + %959 = OpLabel + %961 = OpLoad %int %x_572 + %962 = OpCopyObject %int %int_1 + %963 = OpIAdd %int %961 %962 + %960 = OpCopyObject %int %963 + OpStore %x_606 %960 + %964 = OpLoad %int %x_606 + OpStore %x_607_phi %964 + OpBranch %958 + %958 = OpLabel + %965 = OpLoad %int %x_607_phi + OpStore %x_607 %965 + %966 = OpLoad %int %x_607 + OpStore %x_573_phi %966 + OpBranch %951 + %952 = OpLabel + %967 = OpLoad %int %x_572 + OpStore %x_612_phi %967 + %968 = OpLoad %int %x_570 + %969 = OpCopyObject %int %int_n1 + %970 = OpIEqual %bool %968 %969 + OpSelectionMerge %971 None + OpBranchConditional %970 %972 %971 + %972 = OpLabel + %974 = OpLoad %int %x_572 + %975 = OpCopyObject %int %int_1 + %976 = OpIAdd %int %974 %975 + %973 = OpCopyObject %int %976 + OpStore %x_611 %973 + %977 = OpLoad %int %x_611 + OpStore %x_612_phi %977 + OpBranch %971 + %971 = OpLabel + %978 = OpLoad %int %x_612_phi + OpStore %x_612 %978 + %979 = OpLoad %int %x_612 + OpStore %x_573_phi %979 + OpBranch %951 + %951 = OpLabel + %980 = OpLoad %int %x_573_phi + OpBranch %900 + %900 = OpLabel + %981 = OpIAdd %int %910 %int_1 + OpStore %x_575 %981 + %982 = OpLoad %int %x_570 + OpStore %x_569_phi %982 + OpStore %x_572_phi %980 + %983 = OpLoad %int %x_575 + OpStore %x_574_phi %983 + OpBranch %898 + %899 = OpLabel + %984 = OpLoad %int %x_572 + %985 = OpCopyObject %int %int_20 + %986 = OpIEqual %bool %984 %985 + OpSelectionMerge %987 None + OpBranchConditional %986 %988 %989 + %988 = OpLabel + OpStore %x_GLF_color %991 + OpBranch %987 + %989 = OpLabel + OpStore %x_GLF_color %992 + OpBranch %987 + %987 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %993 +%tint_symbol_1 = OpFunctionParameter %main_out + %997 = OpLabel + %998 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %998 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %1000 = OpLabel + %1001 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %1001 + %1002 = OpFunctionCall %void %main_1 + %1004 = OpLoad %v4float %x_GLF_color + %1005 = OpCompositeConstruct %main_out %1004 + %1003 = OpFunctionCall %void %tint_symbol_3 %1005 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..c4e135aa15 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.wgsl @@ -0,0 +1,977 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var tree : array; + var x_67 : bool; + var x_114 : bool; + var x_572 : i32; + var x_67_phi : bool; + var x_70_phi : i32; + var x_116_phi : bool; + var x_119_phi : i32; + var x_569_phi : i32; + var x_572_phi : i32; + var x_574_phi : i32; + tree[0] = BST(9, -1, -1); + switch(0u) { + default: { + x_67_phi = false; + x_70_phi = 0; + loop { + var x_95 : i32; + var x_87 : i32; + var x_68 : bool; + var x_71 : i32; + var x_68_phi : bool; + var x_71_phi : i32; + x_67 = x_67_phi; + let x_70 : i32 = x_70_phi; + x_116_phi = x_67; + if ((x_70 <= 1)) { + } else { + break; + } + let x_76 : i32 = tree[x_70].data; + if ((5 <= x_76)) { + var x_114_phi : bool; + let x_89 : ptr = &(tree[x_70].leftIndex); + let x_90 : i32 = *(x_89); + if ((x_90 == -1)) { + let x_97 : f32 = x_8.injectionSwitch.y; + let x_99 : f32 = x_8.injectionSwitch.x; + if ((x_97 < x_99)) { + loop { + discard; + } + return; + } + *(x_89) = 1; + tree[1] = BST(5, -1, -1); + loop { + x_114_phi = x_67; + if ((0 < i32(x_97))) { + } else { + break; + } + x_114_phi = true; + break; + } + x_114 = x_114_phi; + x_116_phi = x_114; + if (x_114) { + break; + } + } else { + x_95 = *(x_89); + x_68_phi = x_67; + x_71_phi = x_95; + continue; + } + } else { + let x_81 : ptr = &(tree[x_70].rightIndex); + let x_82 : i32 = *(x_81); + if ((x_82 == -1)) { + *(x_81) = 1; + tree[1] = BST(5, -1, -1); + x_116_phi = true; + break; + } else { + x_87 = *(x_81); + x_68_phi = x_67; + x_71_phi = x_87; + continue; + } + return; + } + x_68_phi = x_114; + x_71_phi = x_70; + + continuing { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + } + let x_116 : bool = x_116_phi; + if (x_116) { + break; + } + } + } + x_119_phi = 0; + loop { + var x_133 : bool; + var x_120 : i32; + var x_134_phi : bool; + let x_119 : i32 = x_119_phi; + let x_125 : f32 = gl_FragCoord.y; + let x_126 : bool = (x_125 < 0.0); + x_134_phi = x_126; + if (!(x_126)) { + let x_131 : f32 = x_8.injectionSwitch.y; + x_133 = (x_119 != i32(x_131)); + x_134_phi = x_133; + } + let x_134 : bool = x_134_phi; + if (x_134) { + } else { + break; + } + var x_139 : bool; + var x_186 : bool; + var x_139_phi : bool; + var x_142_phi : i32; + var x_188_phi : bool; + switch(0u) { + default: { + x_139_phi = false; + x_142_phi = 0; + loop { + var x_167 : i32; + var x_159 : i32; + var x_140 : bool; + var x_143 : i32; + var x_140_phi : bool; + var x_143_phi : i32; + x_139 = x_139_phi; + let x_142 : i32 = x_142_phi; + x_188_phi = x_139; + if ((x_142 <= 2)) { + } else { + break; + } + let x_148 : i32 = tree[x_142].data; + if ((12 <= x_148)) { + var x_186_phi : bool; + let x_161 : ptr = &(tree[x_142].leftIndex); + let x_162 : i32 = *(x_161); + if ((x_162 == -1)) { + let x_169 : f32 = x_8.injectionSwitch.y; + let x_171 : f32 = x_8.injectionSwitch.x; + if ((x_169 < x_171)) { + loop { + discard; + } + return; + } + *(x_161) = 2; + tree[2] = BST(12, -1, -1); + loop { + x_186_phi = x_139; + if ((0 < i32(x_169))) { + } else { + break; + } + x_186_phi = true; + break; + } + x_186 = x_186_phi; + x_188_phi = x_186; + if (x_186) { + break; + } + } else { + x_167 = *(x_161); + x_140_phi = x_139; + x_143_phi = x_167; + continue; + } + } else { + let x_153 : ptr = &(tree[x_142].rightIndex); + let x_154 : i32 = *(x_153); + if ((x_154 == -1)) { + *(x_153) = 2; + tree[2] = BST(12, -1, -1); + x_188_phi = true; + break; + } else { + x_159 = *(x_153); + x_140_phi = x_139; + x_143_phi = x_159; + continue; + } + return; + } + x_140_phi = x_186; + x_143_phi = x_142; + + continuing { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + } + let x_188 : bool = x_188_phi; + if (x_188) { + break; + } + } + } + + continuing { + x_120 = (x_119 + 1); + x_119_phi = x_120; + } + } + var x_193 : bool; + var x_240 : bool; + var x_193_phi : bool; + var x_196_phi : i32; + var x_242_phi : bool; + switch(0u) { + default: { + x_193_phi = false; + x_196_phi = 0; + loop { + var x_221 : i32; + var x_213 : i32; + var x_194 : bool; + var x_197 : i32; + var x_194_phi : bool; + var x_197_phi : i32; + x_193 = x_193_phi; + let x_196 : i32 = x_196_phi; + x_242_phi = x_193; + if ((x_196 <= 3)) { + } else { + break; + } + let x_202 : i32 = tree[x_196].data; + if ((15 <= x_202)) { + var x_240_phi : bool; + let x_215 : ptr = &(tree[x_196].leftIndex); + let x_216 : i32 = *(x_215); + if ((x_216 == -1)) { + let x_223 : f32 = x_8.injectionSwitch.y; + let x_225 : f32 = x_8.injectionSwitch.x; + if ((x_223 < x_225)) { + loop { + discard; + } + return; + } + *(x_215) = 3; + tree[3] = BST(15, -1, -1); + loop { + x_240_phi = x_193; + if ((0 < i32(x_223))) { + } else { + break; + } + x_240_phi = true; + break; + } + x_240 = x_240_phi; + x_242_phi = x_240; + if (x_240) { + break; + } + } else { + x_221 = *(x_215); + x_194_phi = x_193; + x_197_phi = x_221; + continue; + } + } else { + let x_207 : ptr = &(tree[x_196].rightIndex); + let x_208 : i32 = *(x_207); + if ((x_208 == -1)) { + *(x_207) = 3; + tree[3] = BST(15, -1, -1); + x_242_phi = true; + break; + } else { + x_213 = *(x_207); + x_194_phi = x_193; + x_197_phi = x_213; + continue; + } + return; + } + x_194_phi = x_240; + x_197_phi = x_196; + + continuing { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + } + let x_242 : bool = x_242_phi; + if (x_242) { + break; + } + } + } + var x_247 : bool; + var x_294 : bool; + var x_247_phi : bool; + var x_250_phi : i32; + var x_296_phi : bool; + switch(0u) { + default: { + x_247_phi = false; + x_250_phi = 0; + loop { + var x_275 : i32; + var x_267 : i32; + var x_248 : bool; + var x_251 : i32; + var x_248_phi : bool; + var x_251_phi : i32; + x_247 = x_247_phi; + let x_250 : i32 = x_250_phi; + x_296_phi = x_247; + if ((x_250 <= 4)) { + } else { + break; + } + let x_256 : i32 = tree[x_250].data; + if ((7 <= x_256)) { + var x_294_phi : bool; + let x_269 : ptr = &(tree[x_250].leftIndex); + let x_270 : i32 = *(x_269); + if ((x_270 == -1)) { + let x_277 : f32 = x_8.injectionSwitch.y; + let x_279 : f32 = x_8.injectionSwitch.x; + if ((x_277 < x_279)) { + loop { + discard; + } + return; + } + *(x_269) = 4; + tree[4] = BST(7, -1, -1); + loop { + x_294_phi = x_247; + if ((0 < i32(x_277))) { + } else { + break; + } + x_294_phi = true; + break; + } + x_294 = x_294_phi; + x_296_phi = x_294; + if (x_294) { + break; + } + } else { + x_275 = *(x_269); + x_248_phi = x_247; + x_251_phi = x_275; + continue; + } + } else { + let x_261 : ptr = &(tree[x_250].rightIndex); + let x_262 : i32 = *(x_261); + if ((x_262 == -1)) { + *(x_261) = 4; + tree[4] = BST(7, -1, -1); + x_296_phi = true; + break; + } else { + x_267 = *(x_261); + x_248_phi = x_247; + x_251_phi = x_267; + continue; + } + return; + } + x_248_phi = x_294; + x_251_phi = x_250; + + continuing { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + } + let x_296 : bool = x_296_phi; + if (x_296) { + break; + } + } + } + var x_301 : bool; + var x_348 : bool; + var x_301_phi : bool; + var x_304_phi : i32; + var x_350_phi : bool; + switch(0u) { + default: { + x_301_phi = false; + x_304_phi = 0; + loop { + var x_329 : i32; + var x_321 : i32; + var x_302 : bool; + var x_305 : i32; + var x_302_phi : bool; + var x_305_phi : i32; + x_301 = x_301_phi; + let x_304 : i32 = x_304_phi; + x_350_phi = x_301; + if ((x_304 <= 5)) { + } else { + break; + } + let x_310 : i32 = tree[x_304].data; + if ((8 <= x_310)) { + var x_348_phi : bool; + let x_323 : ptr = &(tree[x_304].leftIndex); + let x_324 : i32 = *(x_323); + if ((x_324 == -1)) { + let x_331 : f32 = x_8.injectionSwitch.y; + let x_333 : f32 = x_8.injectionSwitch.x; + if ((x_331 < x_333)) { + loop { + discard; + } + return; + } + *(x_323) = 5; + tree[5] = BST(8, -1, -1); + loop { + x_348_phi = x_301; + if ((0 < i32(x_331))) { + } else { + break; + } + x_348_phi = true; + break; + } + x_348 = x_348_phi; + x_350_phi = x_348; + if (x_348) { + break; + } + } else { + x_329 = *(x_323); + x_302_phi = x_301; + x_305_phi = x_329; + continue; + } + } else { + let x_315 : ptr = &(tree[x_304].rightIndex); + let x_316 : i32 = *(x_315); + if ((x_316 == -1)) { + *(x_315) = 5; + tree[5] = BST(8, -1, -1); + x_350_phi = true; + break; + } else { + x_321 = *(x_315); + x_302_phi = x_301; + x_305_phi = x_321; + continue; + } + return; + } + x_302_phi = x_348; + x_305_phi = x_304; + + continuing { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + } + let x_350 : bool = x_350_phi; + if (x_350) { + break; + } + } + } + var x_355 : bool; + var x_402 : bool; + var x_355_phi : bool; + var x_358_phi : i32; + var x_404_phi : bool; + switch(0u) { + default: { + x_355_phi = false; + x_358_phi = 0; + loop { + var x_383 : i32; + var x_375 : i32; + var x_356 : bool; + var x_359 : i32; + var x_356_phi : bool; + var x_359_phi : i32; + x_355 = x_355_phi; + let x_358 : i32 = x_358_phi; + x_404_phi = x_355; + if ((x_358 <= 6)) { + } else { + break; + } + let x_364 : i32 = tree[x_358].data; + if ((2 <= x_364)) { + var x_402_phi : bool; + let x_377 : ptr = &(tree[x_358].leftIndex); + let x_378 : i32 = *(x_377); + if ((x_378 == -1)) { + let x_385 : f32 = x_8.injectionSwitch.y; + let x_387 : f32 = x_8.injectionSwitch.x; + if ((x_385 < x_387)) { + loop { + discard; + } + return; + } + *(x_377) = 6; + tree[6] = BST(2, -1, -1); + loop { + x_402_phi = x_355; + if ((0 < i32(x_385))) { + } else { + break; + } + x_402_phi = true; + break; + } + x_402 = x_402_phi; + x_404_phi = x_402; + if (x_402) { + break; + } + } else { + x_383 = *(x_377); + x_356_phi = x_355; + x_359_phi = x_383; + continue; + } + } else { + let x_369 : ptr = &(tree[x_358].rightIndex); + let x_370 : i32 = *(x_369); + if ((x_370 == -1)) { + *(x_369) = 6; + tree[6] = BST(2, -1, -1); + x_404_phi = true; + break; + } else { + x_375 = *(x_369); + x_356_phi = x_355; + x_359_phi = x_375; + continue; + } + return; + } + x_356_phi = x_402; + x_359_phi = x_358; + + continuing { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + } + let x_404 : bool = x_404_phi; + if (x_404) { + break; + } + } + } + var x_409 : bool; + var x_456 : bool; + var x_409_phi : bool; + var x_412_phi : i32; + var x_458_phi : bool; + switch(0u) { + default: { + x_409_phi = false; + x_412_phi = 0; + loop { + var x_437 : i32; + var x_429 : i32; + var x_410 : bool; + var x_413 : i32; + var x_410_phi : bool; + var x_413_phi : i32; + x_409 = x_409_phi; + let x_412 : i32 = x_412_phi; + x_458_phi = x_409; + if ((x_412 <= 7)) { + } else { + break; + } + let x_418 : i32 = tree[x_412].data; + if ((6 <= x_418)) { + var x_456_phi : bool; + let x_431 : ptr = &(tree[x_412].leftIndex); + let x_432 : i32 = *(x_431); + if ((x_432 == -1)) { + let x_439 : f32 = x_8.injectionSwitch.y; + let x_441 : f32 = x_8.injectionSwitch.x; + if ((x_439 < x_441)) { + loop { + discard; + } + return; + } + *(x_431) = 7; + tree[7] = BST(6, -1, -1); + loop { + x_456_phi = x_409; + if ((0 < i32(x_439))) { + } else { + break; + } + x_456_phi = true; + break; + } + x_456 = x_456_phi; + x_458_phi = x_456; + if (x_456) { + break; + } + } else { + x_437 = *(x_431); + x_410_phi = x_409; + x_413_phi = x_437; + continue; + } + } else { + let x_423 : ptr = &(tree[x_412].rightIndex); + let x_424 : i32 = *(x_423); + if ((x_424 == -1)) { + *(x_423) = 7; + tree[7] = BST(6, -1, -1); + x_458_phi = true; + break; + } else { + x_429 = *(x_423); + x_410_phi = x_409; + x_413_phi = x_429; + continue; + } + return; + } + x_410_phi = x_456; + x_413_phi = x_412; + + continuing { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + } + let x_458 : bool = x_458_phi; + if (x_458) { + break; + } + } + } + var x_463 : bool; + var x_510 : bool; + var x_463_phi : bool; + var x_466_phi : i32; + var x_512_phi : bool; + switch(0u) { + default: { + x_463_phi = false; + x_466_phi = 0; + loop { + var x_491 : i32; + var x_483 : i32; + var x_464 : bool; + var x_467 : i32; + var x_464_phi : bool; + var x_467_phi : i32; + x_463 = x_463_phi; + let x_466 : i32 = x_466_phi; + x_512_phi = x_463; + if ((x_466 <= 8)) { + } else { + break; + } + let x_472 : i32 = tree[x_466].data; + if ((17 <= x_472)) { + var x_510_phi : bool; + let x_485 : ptr = &(tree[x_466].leftIndex); + let x_486 : i32 = *(x_485); + if ((x_486 == -1)) { + let x_493 : f32 = x_8.injectionSwitch.y; + let x_495 : f32 = x_8.injectionSwitch.x; + if ((x_493 < x_495)) { + loop { + discard; + } + return; + } + *(x_485) = 8; + tree[8] = BST(17, -1, -1); + loop { + x_510_phi = x_463; + if ((0 < i32(x_493))) { + } else { + break; + } + x_510_phi = true; + break; + } + x_510 = x_510_phi; + x_512_phi = x_510; + if (x_510) { + break; + } + } else { + x_491 = *(x_485); + x_464_phi = x_463; + x_467_phi = x_491; + continue; + } + } else { + let x_477 : ptr = &(tree[x_466].rightIndex); + let x_478 : i32 = *(x_477); + if ((x_478 == -1)) { + *(x_477) = 8; + tree[8] = BST(17, -1, -1); + x_512_phi = true; + break; + } else { + x_483 = *(x_477); + x_464_phi = x_463; + x_467_phi = x_483; + continue; + } + return; + } + x_464_phi = x_510; + x_467_phi = x_466; + + continuing { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + } + let x_512 : bool = x_512_phi; + if (x_512) { + break; + } + } + } + var x_517 : bool; + var x_564 : bool; + var x_517_phi : bool; + var x_520_phi : i32; + var x_566_phi : bool; + switch(0u) { + default: { + x_517_phi = false; + x_520_phi = 0; + loop { + var x_545 : i32; + var x_537 : i32; + var x_518 : bool; + var x_521 : i32; + var x_518_phi : bool; + var x_521_phi : i32; + x_517 = x_517_phi; + let x_520 : i32 = x_520_phi; + x_566_phi = x_517; + if ((x_520 <= 9)) { + } else { + break; + } + let x_526 : i32 = tree[x_520].data; + if ((13 <= x_526)) { + var x_564_phi : bool; + let x_539 : ptr = &(tree[x_520].leftIndex); + let x_540 : i32 = *(x_539); + if ((x_540 == -1)) { + let x_547 : f32 = x_8.injectionSwitch.y; + let x_549 : f32 = x_8.injectionSwitch.x; + if ((x_547 < x_549)) { + loop { + discard; + } + return; + } + *(x_539) = 9; + tree[9] = BST(13, -1, -1); + loop { + x_564_phi = x_517; + if ((0 < i32(x_547))) { + } else { + break; + } + x_564_phi = true; + break; + } + x_564 = x_564_phi; + x_566_phi = x_564; + if (x_564) { + break; + } + } else { + x_545 = *(x_539); + x_518_phi = x_517; + x_521_phi = x_545; + continue; + } + } else { + let x_531 : ptr = &(tree[x_520].rightIndex); + let x_532 : i32 = *(x_531); + if ((x_532 == -1)) { + *(x_531) = 9; + tree[9] = BST(13, -1, -1); + x_566_phi = true; + break; + } else { + x_537 = *(x_531); + x_518_phi = x_517; + x_521_phi = x_537; + continue; + } + return; + } + x_518_phi = x_564; + x_521_phi = x_520; + + continuing { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + } + let x_566 : bool = x_566_phi; + if (x_566) { + break; + } + } + } + x_569_phi = 0; + x_572_phi = 0; + x_574_phi = 0; + loop { + var x_597 : i32; + var x_607 : i32; + var x_612 : i32; + var x_575 : i32; + var x_570_phi : i32; + var x_573_phi : i32; + let x_569 : i32 = x_569_phi; + x_572 = x_572_phi; + let x_574 : i32 = x_574_phi; + if ((x_574 < 20)) { + } else { + break; + } + var x_582_phi : i32; + var x_597_phi : i32; + var x_598_phi : bool; + switch(0u) { + default: { + x_582_phi = 0; + loop { + let x_582 : i32 = x_582_phi; + x_597_phi = x_569; + x_598_phi = false; + if ((x_582 != -1)) { + } else { + break; + } + let x_589 : BST = tree[x_582]; + let x_590 : i32 = x_589.data; + let x_591 : i32 = x_589.leftIndex; + let x_592 : i32 = x_589.rightIndex; + if ((x_590 == x_574)) { + x_597_phi = x_574; + x_598_phi = true; + break; + } + + continuing { + x_582_phi = select(x_591, x_592, (x_574 > x_590)); + } + } + x_597 = x_597_phi; + let x_598 : bool = x_598_phi; + x_570_phi = x_597; + if (x_598) { + break; + } + x_570_phi = -1; + } + } + var x_570 : i32; + var x_606 : i32; + var x_611 : i32; + var x_607_phi : i32; + var x_612_phi : i32; + x_570 = x_570_phi; + switch(x_574) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + x_607_phi = x_572; + if ((x_570 == bitcast(x_574))) { + x_606 = bitcast((x_572 + bitcast(1))); + x_607_phi = x_606; + } + x_607 = x_607_phi; + x_573_phi = x_607; + } + default: { + x_612_phi = x_572; + if ((x_570 == bitcast(-1))) { + x_611 = bitcast((x_572 + bitcast(1))); + x_612_phi = x_611; + } + x_612 = x_612_phi; + x_573_phi = x_612; + } + } + let x_573 : i32 = x_573_phi; + + continuing { + x_575 = (x_574 + 1); + x_569_phi = x_570; + x_572_phi = x_573; + x_574_phi = x_575; + } + } + if ((x_572 == bitcast(20))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl new file mode 100644 index 0000000000..c4e135aa15 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl @@ -0,0 +1,977 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var tree : array; + var x_67 : bool; + var x_114 : bool; + var x_572 : i32; + var x_67_phi : bool; + var x_70_phi : i32; + var x_116_phi : bool; + var x_119_phi : i32; + var x_569_phi : i32; + var x_572_phi : i32; + var x_574_phi : i32; + tree[0] = BST(9, -1, -1); + switch(0u) { + default: { + x_67_phi = false; + x_70_phi = 0; + loop { + var x_95 : i32; + var x_87 : i32; + var x_68 : bool; + var x_71 : i32; + var x_68_phi : bool; + var x_71_phi : i32; + x_67 = x_67_phi; + let x_70 : i32 = x_70_phi; + x_116_phi = x_67; + if ((x_70 <= 1)) { + } else { + break; + } + let x_76 : i32 = tree[x_70].data; + if ((5 <= x_76)) { + var x_114_phi : bool; + let x_89 : ptr = &(tree[x_70].leftIndex); + let x_90 : i32 = *(x_89); + if ((x_90 == -1)) { + let x_97 : f32 = x_8.injectionSwitch.y; + let x_99 : f32 = x_8.injectionSwitch.x; + if ((x_97 < x_99)) { + loop { + discard; + } + return; + } + *(x_89) = 1; + tree[1] = BST(5, -1, -1); + loop { + x_114_phi = x_67; + if ((0 < i32(x_97))) { + } else { + break; + } + x_114_phi = true; + break; + } + x_114 = x_114_phi; + x_116_phi = x_114; + if (x_114) { + break; + } + } else { + x_95 = *(x_89); + x_68_phi = x_67; + x_71_phi = x_95; + continue; + } + } else { + let x_81 : ptr = &(tree[x_70].rightIndex); + let x_82 : i32 = *(x_81); + if ((x_82 == -1)) { + *(x_81) = 1; + tree[1] = BST(5, -1, -1); + x_116_phi = true; + break; + } else { + x_87 = *(x_81); + x_68_phi = x_67; + x_71_phi = x_87; + continue; + } + return; + } + x_68_phi = x_114; + x_71_phi = x_70; + + continuing { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + } + let x_116 : bool = x_116_phi; + if (x_116) { + break; + } + } + } + x_119_phi = 0; + loop { + var x_133 : bool; + var x_120 : i32; + var x_134_phi : bool; + let x_119 : i32 = x_119_phi; + let x_125 : f32 = gl_FragCoord.y; + let x_126 : bool = (x_125 < 0.0); + x_134_phi = x_126; + if (!(x_126)) { + let x_131 : f32 = x_8.injectionSwitch.y; + x_133 = (x_119 != i32(x_131)); + x_134_phi = x_133; + } + let x_134 : bool = x_134_phi; + if (x_134) { + } else { + break; + } + var x_139 : bool; + var x_186 : bool; + var x_139_phi : bool; + var x_142_phi : i32; + var x_188_phi : bool; + switch(0u) { + default: { + x_139_phi = false; + x_142_phi = 0; + loop { + var x_167 : i32; + var x_159 : i32; + var x_140 : bool; + var x_143 : i32; + var x_140_phi : bool; + var x_143_phi : i32; + x_139 = x_139_phi; + let x_142 : i32 = x_142_phi; + x_188_phi = x_139; + if ((x_142 <= 2)) { + } else { + break; + } + let x_148 : i32 = tree[x_142].data; + if ((12 <= x_148)) { + var x_186_phi : bool; + let x_161 : ptr = &(tree[x_142].leftIndex); + let x_162 : i32 = *(x_161); + if ((x_162 == -1)) { + let x_169 : f32 = x_8.injectionSwitch.y; + let x_171 : f32 = x_8.injectionSwitch.x; + if ((x_169 < x_171)) { + loop { + discard; + } + return; + } + *(x_161) = 2; + tree[2] = BST(12, -1, -1); + loop { + x_186_phi = x_139; + if ((0 < i32(x_169))) { + } else { + break; + } + x_186_phi = true; + break; + } + x_186 = x_186_phi; + x_188_phi = x_186; + if (x_186) { + break; + } + } else { + x_167 = *(x_161); + x_140_phi = x_139; + x_143_phi = x_167; + continue; + } + } else { + let x_153 : ptr = &(tree[x_142].rightIndex); + let x_154 : i32 = *(x_153); + if ((x_154 == -1)) { + *(x_153) = 2; + tree[2] = BST(12, -1, -1); + x_188_phi = true; + break; + } else { + x_159 = *(x_153); + x_140_phi = x_139; + x_143_phi = x_159; + continue; + } + return; + } + x_140_phi = x_186; + x_143_phi = x_142; + + continuing { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + } + let x_188 : bool = x_188_phi; + if (x_188) { + break; + } + } + } + + continuing { + x_120 = (x_119 + 1); + x_119_phi = x_120; + } + } + var x_193 : bool; + var x_240 : bool; + var x_193_phi : bool; + var x_196_phi : i32; + var x_242_phi : bool; + switch(0u) { + default: { + x_193_phi = false; + x_196_phi = 0; + loop { + var x_221 : i32; + var x_213 : i32; + var x_194 : bool; + var x_197 : i32; + var x_194_phi : bool; + var x_197_phi : i32; + x_193 = x_193_phi; + let x_196 : i32 = x_196_phi; + x_242_phi = x_193; + if ((x_196 <= 3)) { + } else { + break; + } + let x_202 : i32 = tree[x_196].data; + if ((15 <= x_202)) { + var x_240_phi : bool; + let x_215 : ptr = &(tree[x_196].leftIndex); + let x_216 : i32 = *(x_215); + if ((x_216 == -1)) { + let x_223 : f32 = x_8.injectionSwitch.y; + let x_225 : f32 = x_8.injectionSwitch.x; + if ((x_223 < x_225)) { + loop { + discard; + } + return; + } + *(x_215) = 3; + tree[3] = BST(15, -1, -1); + loop { + x_240_phi = x_193; + if ((0 < i32(x_223))) { + } else { + break; + } + x_240_phi = true; + break; + } + x_240 = x_240_phi; + x_242_phi = x_240; + if (x_240) { + break; + } + } else { + x_221 = *(x_215); + x_194_phi = x_193; + x_197_phi = x_221; + continue; + } + } else { + let x_207 : ptr = &(tree[x_196].rightIndex); + let x_208 : i32 = *(x_207); + if ((x_208 == -1)) { + *(x_207) = 3; + tree[3] = BST(15, -1, -1); + x_242_phi = true; + break; + } else { + x_213 = *(x_207); + x_194_phi = x_193; + x_197_phi = x_213; + continue; + } + return; + } + x_194_phi = x_240; + x_197_phi = x_196; + + continuing { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + } + let x_242 : bool = x_242_phi; + if (x_242) { + break; + } + } + } + var x_247 : bool; + var x_294 : bool; + var x_247_phi : bool; + var x_250_phi : i32; + var x_296_phi : bool; + switch(0u) { + default: { + x_247_phi = false; + x_250_phi = 0; + loop { + var x_275 : i32; + var x_267 : i32; + var x_248 : bool; + var x_251 : i32; + var x_248_phi : bool; + var x_251_phi : i32; + x_247 = x_247_phi; + let x_250 : i32 = x_250_phi; + x_296_phi = x_247; + if ((x_250 <= 4)) { + } else { + break; + } + let x_256 : i32 = tree[x_250].data; + if ((7 <= x_256)) { + var x_294_phi : bool; + let x_269 : ptr = &(tree[x_250].leftIndex); + let x_270 : i32 = *(x_269); + if ((x_270 == -1)) { + let x_277 : f32 = x_8.injectionSwitch.y; + let x_279 : f32 = x_8.injectionSwitch.x; + if ((x_277 < x_279)) { + loop { + discard; + } + return; + } + *(x_269) = 4; + tree[4] = BST(7, -1, -1); + loop { + x_294_phi = x_247; + if ((0 < i32(x_277))) { + } else { + break; + } + x_294_phi = true; + break; + } + x_294 = x_294_phi; + x_296_phi = x_294; + if (x_294) { + break; + } + } else { + x_275 = *(x_269); + x_248_phi = x_247; + x_251_phi = x_275; + continue; + } + } else { + let x_261 : ptr = &(tree[x_250].rightIndex); + let x_262 : i32 = *(x_261); + if ((x_262 == -1)) { + *(x_261) = 4; + tree[4] = BST(7, -1, -1); + x_296_phi = true; + break; + } else { + x_267 = *(x_261); + x_248_phi = x_247; + x_251_phi = x_267; + continue; + } + return; + } + x_248_phi = x_294; + x_251_phi = x_250; + + continuing { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + } + let x_296 : bool = x_296_phi; + if (x_296) { + break; + } + } + } + var x_301 : bool; + var x_348 : bool; + var x_301_phi : bool; + var x_304_phi : i32; + var x_350_phi : bool; + switch(0u) { + default: { + x_301_phi = false; + x_304_phi = 0; + loop { + var x_329 : i32; + var x_321 : i32; + var x_302 : bool; + var x_305 : i32; + var x_302_phi : bool; + var x_305_phi : i32; + x_301 = x_301_phi; + let x_304 : i32 = x_304_phi; + x_350_phi = x_301; + if ((x_304 <= 5)) { + } else { + break; + } + let x_310 : i32 = tree[x_304].data; + if ((8 <= x_310)) { + var x_348_phi : bool; + let x_323 : ptr = &(tree[x_304].leftIndex); + let x_324 : i32 = *(x_323); + if ((x_324 == -1)) { + let x_331 : f32 = x_8.injectionSwitch.y; + let x_333 : f32 = x_8.injectionSwitch.x; + if ((x_331 < x_333)) { + loop { + discard; + } + return; + } + *(x_323) = 5; + tree[5] = BST(8, -1, -1); + loop { + x_348_phi = x_301; + if ((0 < i32(x_331))) { + } else { + break; + } + x_348_phi = true; + break; + } + x_348 = x_348_phi; + x_350_phi = x_348; + if (x_348) { + break; + } + } else { + x_329 = *(x_323); + x_302_phi = x_301; + x_305_phi = x_329; + continue; + } + } else { + let x_315 : ptr = &(tree[x_304].rightIndex); + let x_316 : i32 = *(x_315); + if ((x_316 == -1)) { + *(x_315) = 5; + tree[5] = BST(8, -1, -1); + x_350_phi = true; + break; + } else { + x_321 = *(x_315); + x_302_phi = x_301; + x_305_phi = x_321; + continue; + } + return; + } + x_302_phi = x_348; + x_305_phi = x_304; + + continuing { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + } + let x_350 : bool = x_350_phi; + if (x_350) { + break; + } + } + } + var x_355 : bool; + var x_402 : bool; + var x_355_phi : bool; + var x_358_phi : i32; + var x_404_phi : bool; + switch(0u) { + default: { + x_355_phi = false; + x_358_phi = 0; + loop { + var x_383 : i32; + var x_375 : i32; + var x_356 : bool; + var x_359 : i32; + var x_356_phi : bool; + var x_359_phi : i32; + x_355 = x_355_phi; + let x_358 : i32 = x_358_phi; + x_404_phi = x_355; + if ((x_358 <= 6)) { + } else { + break; + } + let x_364 : i32 = tree[x_358].data; + if ((2 <= x_364)) { + var x_402_phi : bool; + let x_377 : ptr = &(tree[x_358].leftIndex); + let x_378 : i32 = *(x_377); + if ((x_378 == -1)) { + let x_385 : f32 = x_8.injectionSwitch.y; + let x_387 : f32 = x_8.injectionSwitch.x; + if ((x_385 < x_387)) { + loop { + discard; + } + return; + } + *(x_377) = 6; + tree[6] = BST(2, -1, -1); + loop { + x_402_phi = x_355; + if ((0 < i32(x_385))) { + } else { + break; + } + x_402_phi = true; + break; + } + x_402 = x_402_phi; + x_404_phi = x_402; + if (x_402) { + break; + } + } else { + x_383 = *(x_377); + x_356_phi = x_355; + x_359_phi = x_383; + continue; + } + } else { + let x_369 : ptr = &(tree[x_358].rightIndex); + let x_370 : i32 = *(x_369); + if ((x_370 == -1)) { + *(x_369) = 6; + tree[6] = BST(2, -1, -1); + x_404_phi = true; + break; + } else { + x_375 = *(x_369); + x_356_phi = x_355; + x_359_phi = x_375; + continue; + } + return; + } + x_356_phi = x_402; + x_359_phi = x_358; + + continuing { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + } + let x_404 : bool = x_404_phi; + if (x_404) { + break; + } + } + } + var x_409 : bool; + var x_456 : bool; + var x_409_phi : bool; + var x_412_phi : i32; + var x_458_phi : bool; + switch(0u) { + default: { + x_409_phi = false; + x_412_phi = 0; + loop { + var x_437 : i32; + var x_429 : i32; + var x_410 : bool; + var x_413 : i32; + var x_410_phi : bool; + var x_413_phi : i32; + x_409 = x_409_phi; + let x_412 : i32 = x_412_phi; + x_458_phi = x_409; + if ((x_412 <= 7)) { + } else { + break; + } + let x_418 : i32 = tree[x_412].data; + if ((6 <= x_418)) { + var x_456_phi : bool; + let x_431 : ptr = &(tree[x_412].leftIndex); + let x_432 : i32 = *(x_431); + if ((x_432 == -1)) { + let x_439 : f32 = x_8.injectionSwitch.y; + let x_441 : f32 = x_8.injectionSwitch.x; + if ((x_439 < x_441)) { + loop { + discard; + } + return; + } + *(x_431) = 7; + tree[7] = BST(6, -1, -1); + loop { + x_456_phi = x_409; + if ((0 < i32(x_439))) { + } else { + break; + } + x_456_phi = true; + break; + } + x_456 = x_456_phi; + x_458_phi = x_456; + if (x_456) { + break; + } + } else { + x_437 = *(x_431); + x_410_phi = x_409; + x_413_phi = x_437; + continue; + } + } else { + let x_423 : ptr = &(tree[x_412].rightIndex); + let x_424 : i32 = *(x_423); + if ((x_424 == -1)) { + *(x_423) = 7; + tree[7] = BST(6, -1, -1); + x_458_phi = true; + break; + } else { + x_429 = *(x_423); + x_410_phi = x_409; + x_413_phi = x_429; + continue; + } + return; + } + x_410_phi = x_456; + x_413_phi = x_412; + + continuing { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + } + let x_458 : bool = x_458_phi; + if (x_458) { + break; + } + } + } + var x_463 : bool; + var x_510 : bool; + var x_463_phi : bool; + var x_466_phi : i32; + var x_512_phi : bool; + switch(0u) { + default: { + x_463_phi = false; + x_466_phi = 0; + loop { + var x_491 : i32; + var x_483 : i32; + var x_464 : bool; + var x_467 : i32; + var x_464_phi : bool; + var x_467_phi : i32; + x_463 = x_463_phi; + let x_466 : i32 = x_466_phi; + x_512_phi = x_463; + if ((x_466 <= 8)) { + } else { + break; + } + let x_472 : i32 = tree[x_466].data; + if ((17 <= x_472)) { + var x_510_phi : bool; + let x_485 : ptr = &(tree[x_466].leftIndex); + let x_486 : i32 = *(x_485); + if ((x_486 == -1)) { + let x_493 : f32 = x_8.injectionSwitch.y; + let x_495 : f32 = x_8.injectionSwitch.x; + if ((x_493 < x_495)) { + loop { + discard; + } + return; + } + *(x_485) = 8; + tree[8] = BST(17, -1, -1); + loop { + x_510_phi = x_463; + if ((0 < i32(x_493))) { + } else { + break; + } + x_510_phi = true; + break; + } + x_510 = x_510_phi; + x_512_phi = x_510; + if (x_510) { + break; + } + } else { + x_491 = *(x_485); + x_464_phi = x_463; + x_467_phi = x_491; + continue; + } + } else { + let x_477 : ptr = &(tree[x_466].rightIndex); + let x_478 : i32 = *(x_477); + if ((x_478 == -1)) { + *(x_477) = 8; + tree[8] = BST(17, -1, -1); + x_512_phi = true; + break; + } else { + x_483 = *(x_477); + x_464_phi = x_463; + x_467_phi = x_483; + continue; + } + return; + } + x_464_phi = x_510; + x_467_phi = x_466; + + continuing { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + } + let x_512 : bool = x_512_phi; + if (x_512) { + break; + } + } + } + var x_517 : bool; + var x_564 : bool; + var x_517_phi : bool; + var x_520_phi : i32; + var x_566_phi : bool; + switch(0u) { + default: { + x_517_phi = false; + x_520_phi = 0; + loop { + var x_545 : i32; + var x_537 : i32; + var x_518 : bool; + var x_521 : i32; + var x_518_phi : bool; + var x_521_phi : i32; + x_517 = x_517_phi; + let x_520 : i32 = x_520_phi; + x_566_phi = x_517; + if ((x_520 <= 9)) { + } else { + break; + } + let x_526 : i32 = tree[x_520].data; + if ((13 <= x_526)) { + var x_564_phi : bool; + let x_539 : ptr = &(tree[x_520].leftIndex); + let x_540 : i32 = *(x_539); + if ((x_540 == -1)) { + let x_547 : f32 = x_8.injectionSwitch.y; + let x_549 : f32 = x_8.injectionSwitch.x; + if ((x_547 < x_549)) { + loop { + discard; + } + return; + } + *(x_539) = 9; + tree[9] = BST(13, -1, -1); + loop { + x_564_phi = x_517; + if ((0 < i32(x_547))) { + } else { + break; + } + x_564_phi = true; + break; + } + x_564 = x_564_phi; + x_566_phi = x_564; + if (x_564) { + break; + } + } else { + x_545 = *(x_539); + x_518_phi = x_517; + x_521_phi = x_545; + continue; + } + } else { + let x_531 : ptr = &(tree[x_520].rightIndex); + let x_532 : i32 = *(x_531); + if ((x_532 == -1)) { + *(x_531) = 9; + tree[9] = BST(13, -1, -1); + x_566_phi = true; + break; + } else { + x_537 = *(x_531); + x_518_phi = x_517; + x_521_phi = x_537; + continue; + } + return; + } + x_518_phi = x_564; + x_521_phi = x_520; + + continuing { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + } + let x_566 : bool = x_566_phi; + if (x_566) { + break; + } + } + } + x_569_phi = 0; + x_572_phi = 0; + x_574_phi = 0; + loop { + var x_597 : i32; + var x_607 : i32; + var x_612 : i32; + var x_575 : i32; + var x_570_phi : i32; + var x_573_phi : i32; + let x_569 : i32 = x_569_phi; + x_572 = x_572_phi; + let x_574 : i32 = x_574_phi; + if ((x_574 < 20)) { + } else { + break; + } + var x_582_phi : i32; + var x_597_phi : i32; + var x_598_phi : bool; + switch(0u) { + default: { + x_582_phi = 0; + loop { + let x_582 : i32 = x_582_phi; + x_597_phi = x_569; + x_598_phi = false; + if ((x_582 != -1)) { + } else { + break; + } + let x_589 : BST = tree[x_582]; + let x_590 : i32 = x_589.data; + let x_591 : i32 = x_589.leftIndex; + let x_592 : i32 = x_589.rightIndex; + if ((x_590 == x_574)) { + x_597_phi = x_574; + x_598_phi = true; + break; + } + + continuing { + x_582_phi = select(x_591, x_592, (x_574 > x_590)); + } + } + x_597 = x_597_phi; + let x_598 : bool = x_598_phi; + x_570_phi = x_597; + if (x_598) { + break; + } + x_570_phi = -1; + } + } + var x_570 : i32; + var x_606 : i32; + var x_611 : i32; + var x_607_phi : i32; + var x_612_phi : i32; + x_570 = x_570_phi; + switch(x_574) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + x_607_phi = x_572; + if ((x_570 == bitcast(x_574))) { + x_606 = bitcast((x_572 + bitcast(1))); + x_607_phi = x_606; + } + x_607 = x_607_phi; + x_573_phi = x_607; + } + default: { + x_612_phi = x_572; + if ((x_570 == bitcast(-1))) { + x_611 = bitcast((x_572 + bitcast(1))); + x_612_phi = x_611; + } + x_612 = x_612_phi; + x_573_phi = x_612; + } + } + let x_573 : i32 = x_573_phi; + + continuing { + x_575 = (x_574 + 1); + x_569_phi = x_570; + x_572_phi = x_573; + x_574_phi = x_575; + } + } + if ((x_572 == bitcast(20))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.hlsl new file mode 100755 index 0000000000..46480e1b9d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.hlsl @@ -0,0 +1,1151 @@ +SKIP: FAILED + +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + BST tree[10] = (BST[10])0; + bool x_67 = false; + bool x_114 = false; + int x_572 = 0; + bool x_67_phi = false; + int x_70_phi = 0; + bool x_116_phi = false; + int x_119_phi = 0; + int x_569_phi = 0; + int x_572_phi = 0; + int x_574_phi = 0; + const BST tint_symbol_5 = {9, -1, -1}; + tree[0] = tint_symbol_5; + switch(0u) { + default: { + x_67_phi = false; + x_70_phi = 0; + while (true) { + int x_95 = 0; + int x_87 = 0; + bool x_68 = false; + int x_71 = 0; + bool x_68_phi = false; + int x_71_phi = 0; + x_67 = x_67_phi; + const int x_70 = x_70_phi; + x_116_phi = x_67; + if ((x_70 <= 1)) { + } else { + break; + } + const int x_76 = tree[x_70].data; + if ((5 <= x_76)) { + bool x_114_phi = false; + const int x_89_save = x_70; + const int x_90 = tree[x_89_save].leftIndex; + if ((x_90 == -1)) { + const float x_97 = asfloat(x_8[0].y); + const float x_99 = asfloat(x_8[0].x); + if ((x_97 < x_99)) { + while (true) { + discard; + } + return; + } + tree[x_89_save].leftIndex = 1; + const BST tint_symbol_6 = {5, -1, -1}; + tree[1] = tint_symbol_6; + while (true) { + x_114_phi = x_67; + if ((0 < int(x_97))) { + } else { + break; + } + x_114_phi = true; + break; + } + x_114 = x_114_phi; + x_116_phi = x_114; + if (x_114) { + break; + } + } else { + x_95 = tree[x_89_save].leftIndex; + x_68_phi = x_67; + x_71_phi = x_95; + { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + continue; + } + } else { + const int x_81_save = x_70; + const int x_82 = tree[x_81_save].rightIndex; + if ((x_82 == -1)) { + tree[x_81_save].rightIndex = 1; + const BST tint_symbol_7 = {5, -1, -1}; + tree[1] = tint_symbol_7; + x_116_phi = true; + break; + } else { + x_87 = tree[x_81_save].rightIndex; + x_68_phi = x_67; + x_71_phi = x_87; + { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + continue; + } + return; + } + x_68_phi = x_114; + x_71_phi = x_70; + { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + } + if (x_116_phi) { + break; + } + break; + } + } + x_119_phi = 0; + while (true) { + bool x_133 = false; + int x_120 = 0; + bool x_134_phi = false; + const int x_119 = x_119_phi; + const float x_125 = gl_FragCoord.y; + const bool x_126 = (x_125 < 0.0f); + x_134_phi = x_126; + if (!(x_126)) { + const float x_131 = asfloat(x_8[0].y); + x_133 = (x_119 != int(x_131)); + x_134_phi = x_133; + } + if (x_134_phi) { + } else { + break; + } + bool x_139 = false; + bool x_186 = false; + bool x_139_phi = false; + int x_142_phi = 0; + bool x_188_phi = false; + switch(0u) { + default: { + x_139_phi = false; + x_142_phi = 0; + while (true) { + int x_167 = 0; + int x_159 = 0; + bool x_140 = false; + int x_143 = 0; + bool x_140_phi = false; + int x_143_phi = 0; + x_139 = x_139_phi; + const int x_142 = x_142_phi; + x_188_phi = x_139; + if ((x_142 <= 2)) { + } else { + break; + } + const int x_148 = tree[x_142].data; + if ((12 <= x_148)) { + bool x_186_phi = false; + const int x_161_save = x_142; + const int x_162 = tree[x_161_save].leftIndex; + if ((x_162 == -1)) { + const float x_169 = asfloat(x_8[0].y); + const float x_171 = asfloat(x_8[0].x); + if ((x_169 < x_171)) { + while (true) { + discard; + } + return; + } + tree[x_161_save].leftIndex = 2; + const BST tint_symbol_8 = {12, -1, -1}; + tree[2] = tint_symbol_8; + while (true) { + x_186_phi = x_139; + if ((0 < int(x_169))) { + } else { + break; + } + x_186_phi = true; + break; + } + x_186 = x_186_phi; + x_188_phi = x_186; + if (x_186) { + break; + } + } else { + x_167 = tree[x_161_save].leftIndex; + x_140_phi = x_139; + x_143_phi = x_167; + { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + continue; + } + } else { + const int x_153_save = x_142; + const int x_154 = tree[x_153_save].rightIndex; + if ((x_154 == -1)) { + tree[x_153_save].rightIndex = 2; + const BST tint_symbol_9 = {12, -1, -1}; + tree[2] = tint_symbol_9; + x_188_phi = true; + break; + } else { + x_159 = tree[x_153_save].rightIndex; + x_140_phi = x_139; + x_143_phi = x_159; + { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + continue; + } + return; + } + x_140_phi = x_186; + x_143_phi = x_142; + { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + } + if (x_188_phi) { + break; + } + break; + } + } + { + x_120 = (x_119 + 1); + x_119_phi = x_120; + } + } + bool x_193 = false; + bool x_240 = false; + bool x_193_phi = false; + int x_196_phi = 0; + bool x_242_phi = false; + switch(0u) { + default: { + x_193_phi = false; + x_196_phi = 0; + while (true) { + int x_221 = 0; + int x_213 = 0; + bool x_194 = false; + int x_197 = 0; + bool x_194_phi = false; + int x_197_phi = 0; + x_193 = x_193_phi; + const int x_196 = x_196_phi; + x_242_phi = x_193; + if ((x_196 <= 3)) { + } else { + break; + } + const int x_202 = tree[x_196].data; + if ((15 <= x_202)) { + bool x_240_phi = false; + const int x_215_save = x_196; + const int x_216 = tree[x_215_save].leftIndex; + if ((x_216 == -1)) { + const float x_223 = asfloat(x_8[0].y); + const float x_225 = asfloat(x_8[0].x); + if ((x_223 < x_225)) { + while (true) { + discard; + } + return; + } + tree[x_215_save].leftIndex = 3; + const BST tint_symbol_10 = {15, -1, -1}; + tree[3] = tint_symbol_10; + while (true) { + x_240_phi = x_193; + if ((0 < int(x_223))) { + } else { + break; + } + x_240_phi = true; + break; + } + x_240 = x_240_phi; + x_242_phi = x_240; + if (x_240) { + break; + } + } else { + x_221 = tree[x_215_save].leftIndex; + x_194_phi = x_193; + x_197_phi = x_221; + { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + continue; + } + } else { + const int x_207_save = x_196; + const int x_208 = tree[x_207_save].rightIndex; + if ((x_208 == -1)) { + tree[x_207_save].rightIndex = 3; + const BST tint_symbol_11 = {15, -1, -1}; + tree[3] = tint_symbol_11; + x_242_phi = true; + break; + } else { + x_213 = tree[x_207_save].rightIndex; + x_194_phi = x_193; + x_197_phi = x_213; + { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + continue; + } + return; + } + x_194_phi = x_240; + x_197_phi = x_196; + { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + } + if (x_242_phi) { + break; + } + break; + } + } + bool x_247 = false; + bool x_294 = false; + bool x_247_phi = false; + int x_250_phi = 0; + bool x_296_phi = false; + switch(0u) { + default: { + x_247_phi = false; + x_250_phi = 0; + while (true) { + int x_275 = 0; + int x_267 = 0; + bool x_248 = false; + int x_251 = 0; + bool x_248_phi = false; + int x_251_phi = 0; + x_247 = x_247_phi; + const int x_250 = x_250_phi; + x_296_phi = x_247; + if ((x_250 <= 4)) { + } else { + break; + } + const int x_256 = tree[x_250].data; + if ((7 <= x_256)) { + bool x_294_phi = false; + const int x_269_save = x_250; + const int x_270 = tree[x_269_save].leftIndex; + if ((x_270 == -1)) { + const float x_277 = asfloat(x_8[0].y); + const float x_279 = asfloat(x_8[0].x); + if ((x_277 < x_279)) { + while (true) { + discard; + } + return; + } + tree[x_269_save].leftIndex = 4; + const BST tint_symbol_12 = {7, -1, -1}; + tree[4] = tint_symbol_12; + while (true) { + x_294_phi = x_247; + if ((0 < int(x_277))) { + } else { + break; + } + x_294_phi = true; + break; + } + x_294 = x_294_phi; + x_296_phi = x_294; + if (x_294) { + break; + } + } else { + x_275 = tree[x_269_save].leftIndex; + x_248_phi = x_247; + x_251_phi = x_275; + { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + continue; + } + } else { + const int x_261_save = x_250; + const int x_262 = tree[x_261_save].rightIndex; + if ((x_262 == -1)) { + tree[x_261_save].rightIndex = 4; + const BST tint_symbol_13 = {7, -1, -1}; + tree[4] = tint_symbol_13; + x_296_phi = true; + break; + } else { + x_267 = tree[x_261_save].rightIndex; + x_248_phi = x_247; + x_251_phi = x_267; + { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + continue; + } + return; + } + x_248_phi = x_294; + x_251_phi = x_250; + { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + } + if (x_296_phi) { + break; + } + break; + } + } + bool x_301 = false; + bool x_348 = false; + bool x_301_phi = false; + int x_304_phi = 0; + bool x_350_phi = false; + switch(0u) { + default: { + x_301_phi = false; + x_304_phi = 0; + while (true) { + int x_329 = 0; + int x_321 = 0; + bool x_302 = false; + int x_305 = 0; + bool x_302_phi = false; + int x_305_phi = 0; + x_301 = x_301_phi; + const int x_304 = x_304_phi; + x_350_phi = x_301; + if ((x_304 <= 5)) { + } else { + break; + } + const int x_310 = tree[x_304].data; + if ((8 <= x_310)) { + bool x_348_phi = false; + const int x_323_save = x_304; + const int x_324 = tree[x_323_save].leftIndex; + if ((x_324 == -1)) { + const float x_331 = asfloat(x_8[0].y); + const float x_333 = asfloat(x_8[0].x); + if ((x_331 < x_333)) { + while (true) { + discard; + } + return; + } + tree[x_323_save].leftIndex = 5; + const BST tint_symbol_14 = {8, -1, -1}; + tree[5] = tint_symbol_14; + while (true) { + x_348_phi = x_301; + if ((0 < int(x_331))) { + } else { + break; + } + x_348_phi = true; + break; + } + x_348 = x_348_phi; + x_350_phi = x_348; + if (x_348) { + break; + } + } else { + x_329 = tree[x_323_save].leftIndex; + x_302_phi = x_301; + x_305_phi = x_329; + { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + continue; + } + } else { + const int x_315_save = x_304; + const int x_316 = tree[x_315_save].rightIndex; + if ((x_316 == -1)) { + tree[x_315_save].rightIndex = 5; + const BST tint_symbol_15 = {8, -1, -1}; + tree[5] = tint_symbol_15; + x_350_phi = true; + break; + } else { + x_321 = tree[x_315_save].rightIndex; + x_302_phi = x_301; + x_305_phi = x_321; + { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + continue; + } + return; + } + x_302_phi = x_348; + x_305_phi = x_304; + { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + } + if (x_350_phi) { + break; + } + break; + } + } + bool x_355 = false; + bool x_402 = false; + bool x_355_phi = false; + int x_358_phi = 0; + bool x_404_phi = false; + switch(0u) { + default: { + x_355_phi = false; + x_358_phi = 0; + while (true) { + int x_383 = 0; + int x_375 = 0; + bool x_356 = false; + int x_359 = 0; + bool x_356_phi = false; + int x_359_phi = 0; + x_355 = x_355_phi; + const int x_358 = x_358_phi; + x_404_phi = x_355; + if ((x_358 <= 6)) { + } else { + break; + } + const int x_364 = tree[x_358].data; + if ((2 <= x_364)) { + bool x_402_phi = false; + const int x_377_save = x_358; + const int x_378 = tree[x_377_save].leftIndex; + if ((x_378 == -1)) { + const float x_385 = asfloat(x_8[0].y); + const float x_387 = asfloat(x_8[0].x); + if ((x_385 < x_387)) { + while (true) { + discard; + } + return; + } + tree[x_377_save].leftIndex = 6; + const BST tint_symbol_16 = {2, -1, -1}; + tree[6] = tint_symbol_16; + while (true) { + x_402_phi = x_355; + if ((0 < int(x_385))) { + } else { + break; + } + x_402_phi = true; + break; + } + x_402 = x_402_phi; + x_404_phi = x_402; + if (x_402) { + break; + } + } else { + x_383 = tree[x_377_save].leftIndex; + x_356_phi = x_355; + x_359_phi = x_383; + { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + continue; + } + } else { + const int x_369_save = x_358; + const int x_370 = tree[x_369_save].rightIndex; + if ((x_370 == -1)) { + tree[x_369_save].rightIndex = 6; + const BST tint_symbol_17 = {2, -1, -1}; + tree[6] = tint_symbol_17; + x_404_phi = true; + break; + } else { + x_375 = tree[x_369_save].rightIndex; + x_356_phi = x_355; + x_359_phi = x_375; + { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + continue; + } + return; + } + x_356_phi = x_402; + x_359_phi = x_358; + { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + } + if (x_404_phi) { + break; + } + break; + } + } + bool x_409 = false; + bool x_456 = false; + bool x_409_phi = false; + int x_412_phi = 0; + bool x_458_phi = false; + switch(0u) { + default: { + x_409_phi = false; + x_412_phi = 0; + while (true) { + int x_437 = 0; + int x_429 = 0; + bool x_410 = false; + int x_413 = 0; + bool x_410_phi = false; + int x_413_phi = 0; + x_409 = x_409_phi; + const int x_412 = x_412_phi; + x_458_phi = x_409; + if ((x_412 <= 7)) { + } else { + break; + } + const int x_418 = tree[x_412].data; + if ((6 <= x_418)) { + bool x_456_phi = false; + const int x_431_save = x_412; + const int x_432 = tree[x_431_save].leftIndex; + if ((x_432 == -1)) { + const float x_439 = asfloat(x_8[0].y); + const float x_441 = asfloat(x_8[0].x); + if ((x_439 < x_441)) { + while (true) { + discard; + } + return; + } + tree[x_431_save].leftIndex = 7; + const BST tint_symbol_18 = {6, -1, -1}; + tree[7] = tint_symbol_18; + while (true) { + x_456_phi = x_409; + if ((0 < int(x_439))) { + } else { + break; + } + x_456_phi = true; + break; + } + x_456 = x_456_phi; + x_458_phi = x_456; + if (x_456) { + break; + } + } else { + x_437 = tree[x_431_save].leftIndex; + x_410_phi = x_409; + x_413_phi = x_437; + { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + continue; + } + } else { + const int x_423_save = x_412; + const int x_424 = tree[x_423_save].rightIndex; + if ((x_424 == -1)) { + tree[x_423_save].rightIndex = 7; + const BST tint_symbol_19 = {6, -1, -1}; + tree[7] = tint_symbol_19; + x_458_phi = true; + break; + } else { + x_429 = tree[x_423_save].rightIndex; + x_410_phi = x_409; + x_413_phi = x_429; + { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + continue; + } + return; + } + x_410_phi = x_456; + x_413_phi = x_412; + { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + } + if (x_458_phi) { + break; + } + break; + } + } + bool x_463 = false; + bool x_510 = false; + bool x_463_phi = false; + int x_466_phi = 0; + bool x_512_phi = false; + switch(0u) { + default: { + x_463_phi = false; + x_466_phi = 0; + while (true) { + int x_491 = 0; + int x_483 = 0; + bool x_464 = false; + int x_467 = 0; + bool x_464_phi = false; + int x_467_phi = 0; + x_463 = x_463_phi; + const int x_466 = x_466_phi; + x_512_phi = x_463; + if ((x_466 <= 8)) { + } else { + break; + } + const int x_472 = tree[x_466].data; + if ((17 <= x_472)) { + bool x_510_phi = false; + const int x_485_save = x_466; + const int x_486 = tree[x_485_save].leftIndex; + if ((x_486 == -1)) { + const float x_493 = asfloat(x_8[0].y); + const float x_495 = asfloat(x_8[0].x); + if ((x_493 < x_495)) { + while (true) { + discard; + } + return; + } + tree[x_485_save].leftIndex = 8; + const BST tint_symbol_20 = {17, -1, -1}; + tree[8] = tint_symbol_20; + while (true) { + x_510_phi = x_463; + if ((0 < int(x_493))) { + } else { + break; + } + x_510_phi = true; + break; + } + x_510 = x_510_phi; + x_512_phi = x_510; + if (x_510) { + break; + } + } else { + x_491 = tree[x_485_save].leftIndex; + x_464_phi = x_463; + x_467_phi = x_491; + { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + continue; + } + } else { + const int x_477_save = x_466; + const int x_478 = tree[x_477_save].rightIndex; + if ((x_478 == -1)) { + tree[x_477_save].rightIndex = 8; + const BST tint_symbol_21 = {17, -1, -1}; + tree[8] = tint_symbol_21; + x_512_phi = true; + break; + } else { + x_483 = tree[x_477_save].rightIndex; + x_464_phi = x_463; + x_467_phi = x_483; + { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + continue; + } + return; + } + x_464_phi = x_510; + x_467_phi = x_466; + { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + } + if (x_512_phi) { + break; + } + break; + } + } + bool x_517 = false; + bool x_564 = false; + bool x_517_phi = false; + int x_520_phi = 0; + bool x_566_phi = false; + switch(0u) { + default: { + x_517_phi = false; + x_520_phi = 0; + while (true) { + int x_545 = 0; + int x_537 = 0; + bool x_518 = false; + int x_521 = 0; + bool x_518_phi = false; + int x_521_phi = 0; + x_517 = x_517_phi; + const int x_520 = x_520_phi; + x_566_phi = x_517; + if ((x_520 <= 9)) { + } else { + break; + } + const int x_526 = tree[x_520].data; + if ((13 <= x_526)) { + bool x_564_phi = false; + const int x_539_save = x_520; + const int x_540 = tree[x_539_save].leftIndex; + if ((x_540 == -1)) { + const float x_547 = asfloat(x_8[0].y); + const float x_549 = asfloat(x_8[0].x); + if ((x_547 < x_549)) { + while (true) { + discard; + } + return; + } + tree[x_539_save].leftIndex = 9; + const BST tint_symbol_22 = {13, -1, -1}; + tree[9] = tint_symbol_22; + while (true) { + x_564_phi = x_517; + if ((0 < int(x_547))) { + } else { + break; + } + x_564_phi = true; + break; + } + x_564 = x_564_phi; + x_566_phi = x_564; + if (x_564) { + break; + } + } else { + x_545 = tree[x_539_save].leftIndex; + x_518_phi = x_517; + x_521_phi = x_545; + { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + continue; + } + } else { + const int x_531_save = x_520; + const int x_532 = tree[x_531_save].rightIndex; + if ((x_532 == -1)) { + tree[x_531_save].rightIndex = 9; + const BST tint_symbol_23 = {13, -1, -1}; + tree[9] = tint_symbol_23; + x_566_phi = true; + break; + } else { + x_537 = tree[x_531_save].rightIndex; + x_518_phi = x_517; + x_521_phi = x_537; + { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + continue; + } + return; + } + x_518_phi = x_564; + x_521_phi = x_520; + { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + } + if (x_566_phi) { + break; + } + break; + } + } + x_569_phi = 0; + x_572_phi = 0; + x_574_phi = 0; + while (true) { + int x_597 = 0; + int x_607 = 0; + int x_612 = 0; + int x_575 = 0; + int x_570_phi = 0; + int x_573_phi = 0; + const int x_569 = x_569_phi; + x_572 = x_572_phi; + const int x_574 = x_574_phi; + if ((x_574 < 20)) { + } else { + break; + } + int x_582_phi = 0; + int x_597_phi = 0; + bool x_598_phi = false; + switch(0u) { + default: { + x_582_phi = 0; + while (true) { + const int x_582 = x_582_phi; + x_597_phi = x_569; + x_598_phi = false; + if ((x_582 != -1)) { + } else { + break; + } + const BST x_589 = tree[x_582]; + const int x_590 = x_589.data; + const int x_591 = x_589.leftIndex; + const int x_592 = x_589.rightIndex; + if ((x_590 == x_574)) { + x_597_phi = x_574; + x_598_phi = true; + break; + } + { + x_582_phi = ((x_574 > x_590) ? x_592 : x_591); + } + } + x_597 = x_597_phi; + const bool x_598 = x_598_phi; + x_570_phi = x_597; + if (x_598) { + break; + } + x_570_phi = -1; + break; + } + } + int x_570 = 0; + int x_606 = 0; + int x_611 = 0; + int x_607_phi = 0; + int x_612_phi = 0; + x_570 = x_570_phi; + switch(x_574) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_607_phi = x_572; + if ((x_570 == asint(x_574))) { + x_606 = asint((x_572 + asint(1))); + x_607_phi = x_606; + } + x_607 = x_607_phi; + x_573_phi = x_607; + break; + } + default: { + x_612_phi = x_572; + if ((x_570 == asint(-1))) { + x_611 = asint((x_572 + asint(1))); + x_612_phi = x_611; + } + x_612 = x_612_phi; + x_573_phi = x_612; + break; + } + } + const int x_573 = x_573_phi; + { + x_575 = (x_574 + 1); + x_569_phi = x_570; + x_572_phi = x_573; + x_574_phi = x_575; + } + } + if ((x_572 == asint(20))) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_24 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_24; +} +T:\tmp\uq0.0:1053:20: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] + if ((x_570 == asint(x_574))) { + ~~~~~~^~~~~~~~~~~~~~~ +T:\tmp\uq0.0:1053:20: note: remove extraneous parentheses around the comparison to silence this warning + if ((x_570 == asint(x_574))) { + ~ ^ ~ +T:\tmp\uq0.0:1053:20: note: use '=' to turn this equality comparison into an assignment + if ((x_570 == asint(x_574))) { + ^~ + = +T:\tmp\uq0.0:1063:20: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] + if ((x_570 == asint(-1))) { + ~~~~~~^~~~~~~~~~~~ +T:\tmp\uq0.0:1063:20: note: remove extraneous parentheses around the comparison to silence this warning + if ((x_570 == asint(-1))) { + ~ ^ ~ +T:\tmp\uq0.0:1063:20: note: use '=' to turn this equality comparison into an assignment + if ((x_570 == asint(-1))) { + ^~ + = +T:\tmp\uq0.0:1080:14: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] + if ((x_572 == asint(20))) { + ~~~~~~^~~~~~~~~~~~ +T:\tmp\uq0.0:1080:14: note: remove extraneous parentheses around the comparison to silence this warning + if ((x_572 == asint(20))) { + ~ ^ ~ +T:\tmp\uq0.0:1080:14: note: use '=' to turn this equality comparison into an assignment + if ((x_572 == asint(20))) { + ^~ + = +error: validation errors +T:\tmp\uq0.0:1098: error: Loop must have break. +T:\tmp\uq0.0:1098: error: Loop must have break. +T:\tmp\uq0.0:1098: error: Loop must have break. +T:\tmp\uq0.0:1098: error: Loop must have break. +T:\tmp\uq0.0:1098: error: Loop must have break. +T:\tmp\uq0.0:1098: error: Loop must have break. +T:\tmp\uq0.0:1098: error: Loop must have break. +T:\tmp\uq0.0:1098: error: Loop must have break. +T:\tmp\uq0.0:1098: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.msl new file mode 100644 index 0000000000..5025022f26 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.msl @@ -0,0 +1,1116 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_24, thread float4* const tint_symbol_25) { + tint_array_wrapper tree = {}; + bool x_67 = false; + bool x_114 = false; + int x_572 = 0; + bool x_67_phi = false; + int x_70_phi = 0; + bool x_116_phi = false; + int x_119_phi = 0; + int x_569_phi = 0; + int x_572_phi = 0; + int x_574_phi = 0; + BST const tint_symbol_4 = {.data=9, .leftIndex=-1, .rightIndex=-1}; + tree.arr[0] = tint_symbol_4; + switch(0u) { + default: { + x_67_phi = false; + x_70_phi = 0; + while (true) { + int x_95 = 0; + int x_87 = 0; + bool x_68 = false; + int x_71 = 0; + bool x_68_phi = false; + int x_71_phi = 0; + x_67 = x_67_phi; + int const x_70 = x_70_phi; + x_116_phi = x_67; + if ((x_70 <= 1)) { + } else { + break; + } + int const x_76 = tree.arr[x_70].data; + if ((5 <= x_76)) { + bool x_114_phi = false; + int const x_89_save = x_70; + int const x_90 = tree.arr[x_89_save].leftIndex; + if ((x_90 == -1)) { + float const x_97 = x_8.injectionSwitch.y; + float const x_99 = x_8.injectionSwitch.x; + if ((x_97 < x_99)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_89_save].leftIndex = 1; + BST const tint_symbol_5 = {.data=5, .leftIndex=-1, .rightIndex=-1}; + tree.arr[1] = tint_symbol_5; + while (true) { + x_114_phi = x_67; + if ((0 < int(x_97))) { + } else { + break; + } + x_114_phi = true; + break; + } + x_114 = x_114_phi; + x_116_phi = x_114; + if (x_114) { + break; + } + } else { + x_95 = tree.arr[x_89_save].leftIndex; + x_68_phi = x_67; + x_71_phi = x_95; + { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + continue; + } + } else { + int const x_81_save = x_70; + int const x_82 = tree.arr[x_81_save].rightIndex; + if ((x_82 == -1)) { + tree.arr[x_81_save].rightIndex = 1; + BST const tint_symbol_6 = {.data=5, .leftIndex=-1, .rightIndex=-1}; + tree.arr[1] = tint_symbol_6; + x_116_phi = true; + break; + } else { + x_87 = tree.arr[x_81_save].rightIndex; + x_68_phi = x_67; + x_71_phi = x_87; + { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + continue; + } + return; + } + x_68_phi = x_114; + x_71_phi = x_70; + { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + } + bool const x_116 = x_116_phi; + if (x_116) { + break; + } + break; + } + } + x_119_phi = 0; + while (true) { + bool x_133 = false; + int x_120 = 0; + bool x_134_phi = false; + int const x_119 = x_119_phi; + float const x_125 = (*(tint_symbol_24)).y; + bool const x_126 = (x_125 < 0.0f); + x_134_phi = x_126; + if (!(x_126)) { + float const x_131 = x_8.injectionSwitch.y; + x_133 = (x_119 != int(x_131)); + x_134_phi = x_133; + } + bool const x_134 = x_134_phi; + if (x_134) { + } else { + break; + } + bool x_139 = false; + bool x_186 = false; + bool x_139_phi = false; + int x_142_phi = 0; + bool x_188_phi = false; + switch(0u) { + default: { + x_139_phi = false; + x_142_phi = 0; + while (true) { + int x_167 = 0; + int x_159 = 0; + bool x_140 = false; + int x_143 = 0; + bool x_140_phi = false; + int x_143_phi = 0; + x_139 = x_139_phi; + int const x_142 = x_142_phi; + x_188_phi = x_139; + if ((x_142 <= 2)) { + } else { + break; + } + int const x_148 = tree.arr[x_142].data; + if ((12 <= x_148)) { + bool x_186_phi = false; + int const x_161_save = x_142; + int const x_162 = tree.arr[x_161_save].leftIndex; + if ((x_162 == -1)) { + float const x_169 = x_8.injectionSwitch.y; + float const x_171 = x_8.injectionSwitch.x; + if ((x_169 < x_171)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_161_save].leftIndex = 2; + BST const tint_symbol_7 = {.data=12, .leftIndex=-1, .rightIndex=-1}; + tree.arr[2] = tint_symbol_7; + while (true) { + x_186_phi = x_139; + if ((0 < int(x_169))) { + } else { + break; + } + x_186_phi = true; + break; + } + x_186 = x_186_phi; + x_188_phi = x_186; + if (x_186) { + break; + } + } else { + x_167 = tree.arr[x_161_save].leftIndex; + x_140_phi = x_139; + x_143_phi = x_167; + { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + continue; + } + } else { + int const x_153_save = x_142; + int const x_154 = tree.arr[x_153_save].rightIndex; + if ((x_154 == -1)) { + tree.arr[x_153_save].rightIndex = 2; + BST const tint_symbol_8 = {.data=12, .leftIndex=-1, .rightIndex=-1}; + tree.arr[2] = tint_symbol_8; + x_188_phi = true; + break; + } else { + x_159 = tree.arr[x_153_save].rightIndex; + x_140_phi = x_139; + x_143_phi = x_159; + { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + continue; + } + return; + } + x_140_phi = x_186; + x_143_phi = x_142; + { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + } + bool const x_188 = x_188_phi; + if (x_188) { + break; + } + break; + } + } + { + x_120 = (x_119 + 1); + x_119_phi = x_120; + } + } + bool x_193 = false; + bool x_240 = false; + bool x_193_phi = false; + int x_196_phi = 0; + bool x_242_phi = false; + switch(0u) { + default: { + x_193_phi = false; + x_196_phi = 0; + while (true) { + int x_221 = 0; + int x_213 = 0; + bool x_194 = false; + int x_197 = 0; + bool x_194_phi = false; + int x_197_phi = 0; + x_193 = x_193_phi; + int const x_196 = x_196_phi; + x_242_phi = x_193; + if ((x_196 <= 3)) { + } else { + break; + } + int const x_202 = tree.arr[x_196].data; + if ((15 <= x_202)) { + bool x_240_phi = false; + int const x_215_save = x_196; + int const x_216 = tree.arr[x_215_save].leftIndex; + if ((x_216 == -1)) { + float const x_223 = x_8.injectionSwitch.y; + float const x_225 = x_8.injectionSwitch.x; + if ((x_223 < x_225)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_215_save].leftIndex = 3; + BST const tint_symbol_9 = {.data=15, .leftIndex=-1, .rightIndex=-1}; + tree.arr[3] = tint_symbol_9; + while (true) { + x_240_phi = x_193; + if ((0 < int(x_223))) { + } else { + break; + } + x_240_phi = true; + break; + } + x_240 = x_240_phi; + x_242_phi = x_240; + if (x_240) { + break; + } + } else { + x_221 = tree.arr[x_215_save].leftIndex; + x_194_phi = x_193; + x_197_phi = x_221; + { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + continue; + } + } else { + int const x_207_save = x_196; + int const x_208 = tree.arr[x_207_save].rightIndex; + if ((x_208 == -1)) { + tree.arr[x_207_save].rightIndex = 3; + BST const tint_symbol_10 = {.data=15, .leftIndex=-1, .rightIndex=-1}; + tree.arr[3] = tint_symbol_10; + x_242_phi = true; + break; + } else { + x_213 = tree.arr[x_207_save].rightIndex; + x_194_phi = x_193; + x_197_phi = x_213; + { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + continue; + } + return; + } + x_194_phi = x_240; + x_197_phi = x_196; + { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + } + bool const x_242 = x_242_phi; + if (x_242) { + break; + } + break; + } + } + bool x_247 = false; + bool x_294 = false; + bool x_247_phi = false; + int x_250_phi = 0; + bool x_296_phi = false; + switch(0u) { + default: { + x_247_phi = false; + x_250_phi = 0; + while (true) { + int x_275 = 0; + int x_267 = 0; + bool x_248 = false; + int x_251 = 0; + bool x_248_phi = false; + int x_251_phi = 0; + x_247 = x_247_phi; + int const x_250 = x_250_phi; + x_296_phi = x_247; + if ((x_250 <= 4)) { + } else { + break; + } + int const x_256 = tree.arr[x_250].data; + if ((7 <= x_256)) { + bool x_294_phi = false; + int const x_269_save = x_250; + int const x_270 = tree.arr[x_269_save].leftIndex; + if ((x_270 == -1)) { + float const x_277 = x_8.injectionSwitch.y; + float const x_279 = x_8.injectionSwitch.x; + if ((x_277 < x_279)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_269_save].leftIndex = 4; + BST const tint_symbol_11 = {.data=7, .leftIndex=-1, .rightIndex=-1}; + tree.arr[4] = tint_symbol_11; + while (true) { + x_294_phi = x_247; + if ((0 < int(x_277))) { + } else { + break; + } + x_294_phi = true; + break; + } + x_294 = x_294_phi; + x_296_phi = x_294; + if (x_294) { + break; + } + } else { + x_275 = tree.arr[x_269_save].leftIndex; + x_248_phi = x_247; + x_251_phi = x_275; + { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + continue; + } + } else { + int const x_261_save = x_250; + int const x_262 = tree.arr[x_261_save].rightIndex; + if ((x_262 == -1)) { + tree.arr[x_261_save].rightIndex = 4; + BST const tint_symbol_12 = {.data=7, .leftIndex=-1, .rightIndex=-1}; + tree.arr[4] = tint_symbol_12; + x_296_phi = true; + break; + } else { + x_267 = tree.arr[x_261_save].rightIndex; + x_248_phi = x_247; + x_251_phi = x_267; + { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + continue; + } + return; + } + x_248_phi = x_294; + x_251_phi = x_250; + { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + } + bool const x_296 = x_296_phi; + if (x_296) { + break; + } + break; + } + } + bool x_301 = false; + bool x_348 = false; + bool x_301_phi = false; + int x_304_phi = 0; + bool x_350_phi = false; + switch(0u) { + default: { + x_301_phi = false; + x_304_phi = 0; + while (true) { + int x_329 = 0; + int x_321 = 0; + bool x_302 = false; + int x_305 = 0; + bool x_302_phi = false; + int x_305_phi = 0; + x_301 = x_301_phi; + int const x_304 = x_304_phi; + x_350_phi = x_301; + if ((x_304 <= 5)) { + } else { + break; + } + int const x_310 = tree.arr[x_304].data; + if ((8 <= x_310)) { + bool x_348_phi = false; + int const x_323_save = x_304; + int const x_324 = tree.arr[x_323_save].leftIndex; + if ((x_324 == -1)) { + float const x_331 = x_8.injectionSwitch.y; + float const x_333 = x_8.injectionSwitch.x; + if ((x_331 < x_333)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_323_save].leftIndex = 5; + BST const tint_symbol_13 = {.data=8, .leftIndex=-1, .rightIndex=-1}; + tree.arr[5] = tint_symbol_13; + while (true) { + x_348_phi = x_301; + if ((0 < int(x_331))) { + } else { + break; + } + x_348_phi = true; + break; + } + x_348 = x_348_phi; + x_350_phi = x_348; + if (x_348) { + break; + } + } else { + x_329 = tree.arr[x_323_save].leftIndex; + x_302_phi = x_301; + x_305_phi = x_329; + { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + continue; + } + } else { + int const x_315_save = x_304; + int const x_316 = tree.arr[x_315_save].rightIndex; + if ((x_316 == -1)) { + tree.arr[x_315_save].rightIndex = 5; + BST const tint_symbol_14 = {.data=8, .leftIndex=-1, .rightIndex=-1}; + tree.arr[5] = tint_symbol_14; + x_350_phi = true; + break; + } else { + x_321 = tree.arr[x_315_save].rightIndex; + x_302_phi = x_301; + x_305_phi = x_321; + { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + continue; + } + return; + } + x_302_phi = x_348; + x_305_phi = x_304; + { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + } + bool const x_350 = x_350_phi; + if (x_350) { + break; + } + break; + } + } + bool x_355 = false; + bool x_402 = false; + bool x_355_phi = false; + int x_358_phi = 0; + bool x_404_phi = false; + switch(0u) { + default: { + x_355_phi = false; + x_358_phi = 0; + while (true) { + int x_383 = 0; + int x_375 = 0; + bool x_356 = false; + int x_359 = 0; + bool x_356_phi = false; + int x_359_phi = 0; + x_355 = x_355_phi; + int const x_358 = x_358_phi; + x_404_phi = x_355; + if ((x_358 <= 6)) { + } else { + break; + } + int const x_364 = tree.arr[x_358].data; + if ((2 <= x_364)) { + bool x_402_phi = false; + int const x_377_save = x_358; + int const x_378 = tree.arr[x_377_save].leftIndex; + if ((x_378 == -1)) { + float const x_385 = x_8.injectionSwitch.y; + float const x_387 = x_8.injectionSwitch.x; + if ((x_385 < x_387)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_377_save].leftIndex = 6; + BST const tint_symbol_15 = {.data=2, .leftIndex=-1, .rightIndex=-1}; + tree.arr[6] = tint_symbol_15; + while (true) { + x_402_phi = x_355; + if ((0 < int(x_385))) { + } else { + break; + } + x_402_phi = true; + break; + } + x_402 = x_402_phi; + x_404_phi = x_402; + if (x_402) { + break; + } + } else { + x_383 = tree.arr[x_377_save].leftIndex; + x_356_phi = x_355; + x_359_phi = x_383; + { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + continue; + } + } else { + int const x_369_save = x_358; + int const x_370 = tree.arr[x_369_save].rightIndex; + if ((x_370 == -1)) { + tree.arr[x_369_save].rightIndex = 6; + BST const tint_symbol_16 = {.data=2, .leftIndex=-1, .rightIndex=-1}; + tree.arr[6] = tint_symbol_16; + x_404_phi = true; + break; + } else { + x_375 = tree.arr[x_369_save].rightIndex; + x_356_phi = x_355; + x_359_phi = x_375; + { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + continue; + } + return; + } + x_356_phi = x_402; + x_359_phi = x_358; + { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + } + bool const x_404 = x_404_phi; + if (x_404) { + break; + } + break; + } + } + bool x_409 = false; + bool x_456 = false; + bool x_409_phi = false; + int x_412_phi = 0; + bool x_458_phi = false; + switch(0u) { + default: { + x_409_phi = false; + x_412_phi = 0; + while (true) { + int x_437 = 0; + int x_429 = 0; + bool x_410 = false; + int x_413 = 0; + bool x_410_phi = false; + int x_413_phi = 0; + x_409 = x_409_phi; + int const x_412 = x_412_phi; + x_458_phi = x_409; + if ((x_412 <= 7)) { + } else { + break; + } + int const x_418 = tree.arr[x_412].data; + if ((6 <= x_418)) { + bool x_456_phi = false; + int const x_431_save = x_412; + int const x_432 = tree.arr[x_431_save].leftIndex; + if ((x_432 == -1)) { + float const x_439 = x_8.injectionSwitch.y; + float const x_441 = x_8.injectionSwitch.x; + if ((x_439 < x_441)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_431_save].leftIndex = 7; + BST const tint_symbol_17 = {.data=6, .leftIndex=-1, .rightIndex=-1}; + tree.arr[7] = tint_symbol_17; + while (true) { + x_456_phi = x_409; + if ((0 < int(x_439))) { + } else { + break; + } + x_456_phi = true; + break; + } + x_456 = x_456_phi; + x_458_phi = x_456; + if (x_456) { + break; + } + } else { + x_437 = tree.arr[x_431_save].leftIndex; + x_410_phi = x_409; + x_413_phi = x_437; + { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + continue; + } + } else { + int const x_423_save = x_412; + int const x_424 = tree.arr[x_423_save].rightIndex; + if ((x_424 == -1)) { + tree.arr[x_423_save].rightIndex = 7; + BST const tint_symbol_18 = {.data=6, .leftIndex=-1, .rightIndex=-1}; + tree.arr[7] = tint_symbol_18; + x_458_phi = true; + break; + } else { + x_429 = tree.arr[x_423_save].rightIndex; + x_410_phi = x_409; + x_413_phi = x_429; + { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + continue; + } + return; + } + x_410_phi = x_456; + x_413_phi = x_412; + { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + } + bool const x_458 = x_458_phi; + if (x_458) { + break; + } + break; + } + } + bool x_463 = false; + bool x_510 = false; + bool x_463_phi = false; + int x_466_phi = 0; + bool x_512_phi = false; + switch(0u) { + default: { + x_463_phi = false; + x_466_phi = 0; + while (true) { + int x_491 = 0; + int x_483 = 0; + bool x_464 = false; + int x_467 = 0; + bool x_464_phi = false; + int x_467_phi = 0; + x_463 = x_463_phi; + int const x_466 = x_466_phi; + x_512_phi = x_463; + if ((x_466 <= 8)) { + } else { + break; + } + int const x_472 = tree.arr[x_466].data; + if ((17 <= x_472)) { + bool x_510_phi = false; + int const x_485_save = x_466; + int const x_486 = tree.arr[x_485_save].leftIndex; + if ((x_486 == -1)) { + float const x_493 = x_8.injectionSwitch.y; + float const x_495 = x_8.injectionSwitch.x; + if ((x_493 < x_495)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_485_save].leftIndex = 8; + BST const tint_symbol_19 = {.data=17, .leftIndex=-1, .rightIndex=-1}; + tree.arr[8] = tint_symbol_19; + while (true) { + x_510_phi = x_463; + if ((0 < int(x_493))) { + } else { + break; + } + x_510_phi = true; + break; + } + x_510 = x_510_phi; + x_512_phi = x_510; + if (x_510) { + break; + } + } else { + x_491 = tree.arr[x_485_save].leftIndex; + x_464_phi = x_463; + x_467_phi = x_491; + { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + continue; + } + } else { + int const x_477_save = x_466; + int const x_478 = tree.arr[x_477_save].rightIndex; + if ((x_478 == -1)) { + tree.arr[x_477_save].rightIndex = 8; + BST const tint_symbol_20 = {.data=17, .leftIndex=-1, .rightIndex=-1}; + tree.arr[8] = tint_symbol_20; + x_512_phi = true; + break; + } else { + x_483 = tree.arr[x_477_save].rightIndex; + x_464_phi = x_463; + x_467_phi = x_483; + { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + continue; + } + return; + } + x_464_phi = x_510; + x_467_phi = x_466; + { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + } + bool const x_512 = x_512_phi; + if (x_512) { + break; + } + break; + } + } + bool x_517 = false; + bool x_564 = false; + bool x_517_phi = false; + int x_520_phi = 0; + bool x_566_phi = false; + switch(0u) { + default: { + x_517_phi = false; + x_520_phi = 0; + while (true) { + int x_545 = 0; + int x_537 = 0; + bool x_518 = false; + int x_521 = 0; + bool x_518_phi = false; + int x_521_phi = 0; + x_517 = x_517_phi; + int const x_520 = x_520_phi; + x_566_phi = x_517; + if ((x_520 <= 9)) { + } else { + break; + } + int const x_526 = tree.arr[x_520].data; + if ((13 <= x_526)) { + bool x_564_phi = false; + int const x_539_save = x_520; + int const x_540 = tree.arr[x_539_save].leftIndex; + if ((x_540 == -1)) { + float const x_547 = x_8.injectionSwitch.y; + float const x_549 = x_8.injectionSwitch.x; + if ((x_547 < x_549)) { + while (true) { + discard_fragment(); + } + return; + } + tree.arr[x_539_save].leftIndex = 9; + BST const tint_symbol_21 = {.data=13, .leftIndex=-1, .rightIndex=-1}; + tree.arr[9] = tint_symbol_21; + while (true) { + x_564_phi = x_517; + if ((0 < int(x_547))) { + } else { + break; + } + x_564_phi = true; + break; + } + x_564 = x_564_phi; + x_566_phi = x_564; + if (x_564) { + break; + } + } else { + x_545 = tree.arr[x_539_save].leftIndex; + x_518_phi = x_517; + x_521_phi = x_545; + { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + continue; + } + } else { + int const x_531_save = x_520; + int const x_532 = tree.arr[x_531_save].rightIndex; + if ((x_532 == -1)) { + tree.arr[x_531_save].rightIndex = 9; + BST const tint_symbol_22 = {.data=13, .leftIndex=-1, .rightIndex=-1}; + tree.arr[9] = tint_symbol_22; + x_566_phi = true; + break; + } else { + x_537 = tree.arr[x_531_save].rightIndex; + x_518_phi = x_517; + x_521_phi = x_537; + { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + continue; + } + return; + } + x_518_phi = x_564; + x_521_phi = x_520; + { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + } + bool const x_566 = x_566_phi; + if (x_566) { + break; + } + break; + } + } + x_569_phi = 0; + x_572_phi = 0; + x_574_phi = 0; + while (true) { + int x_597 = 0; + int x_607 = 0; + int x_612 = 0; + int x_575 = 0; + int x_570_phi = 0; + int x_573_phi = 0; + int const x_569 = x_569_phi; + x_572 = x_572_phi; + int const x_574 = x_574_phi; + if ((x_574 < 20)) { + } else { + break; + } + int x_582_phi = 0; + int x_597_phi = 0; + bool x_598_phi = false; + switch(0u) { + default: { + x_582_phi = 0; + while (true) { + int const x_582 = x_582_phi; + x_597_phi = x_569; + x_598_phi = false; + if ((x_582 != -1)) { + } else { + break; + } + BST const x_589 = tree.arr[x_582]; + int const x_590 = x_589.data; + int const x_591 = x_589.leftIndex; + int const x_592 = x_589.rightIndex; + if ((x_590 == x_574)) { + x_597_phi = x_574; + x_598_phi = true; + break; + } + { + x_582_phi = select(x_591, x_592, (x_574 > x_590)); + } + } + x_597 = x_597_phi; + bool const x_598 = x_598_phi; + x_570_phi = x_597; + if (x_598) { + break; + } + x_570_phi = -1; + break; + } + } + int x_570 = 0; + int x_606 = 0; + int x_611 = 0; + int x_607_phi = 0; + int x_612_phi = 0; + x_570 = x_570_phi; + switch(x_574) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + x_607_phi = x_572; + if ((x_570 == as_type(x_574))) { + x_606 = as_type((x_572 + as_type(1))); + x_607_phi = x_606; + } + x_607 = x_607_phi; + x_573_phi = x_607; + break; + } + default: { + x_612_phi = x_572; + if ((x_570 == as_type(-1))) { + x_611 = as_type((x_572 + as_type(1))); + x_612_phi = x_611; + } + x_612 = x_612_phi; + x_573_phi = x_612; + break; + } + } + int const x_573 = x_573_phi; + { + x_575 = (x_574 + 1); + x_569_phi = x_570; + x_572_phi = x_573; + x_574_phi = x_575; + } + } + if ((x_572 == as_type(20))) { + *(tint_symbol_25) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_25) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_26 = 0.0f; + thread float4 tint_symbol_27 = 0.0f; + tint_symbol_26 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_26), &(tint_symbol_27)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_27}; + tint_symbol_2 const tint_symbol_23 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_23; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..41d75a5c09 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.spvasm @@ -0,0 +1,1920 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 1006 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree "tree" + OpName %x_67 "x_67" + OpName %x_114 "x_114" + OpName %x_572 "x_572" + OpName %x_67_phi "x_67_phi" + OpName %x_70_phi "x_70_phi" + OpName %x_116_phi "x_116_phi" + OpName %x_119_phi "x_119_phi" + OpName %x_569_phi "x_569_phi" + OpName %x_572_phi "x_572_phi" + OpName %x_574_phi "x_574_phi" + OpName %x_95 "x_95" + OpName %x_87 "x_87" + OpName %x_68 "x_68" + OpName %x_71 "x_71" + OpName %x_68_phi "x_68_phi" + OpName %x_71_phi "x_71_phi" + OpName %x_114_phi "x_114_phi" + OpName %x_133 "x_133" + OpName %x_120 "x_120" + OpName %x_134_phi "x_134_phi" + OpName %x_139 "x_139" + OpName %x_186 "x_186" + OpName %x_139_phi "x_139_phi" + OpName %x_142_phi "x_142_phi" + OpName %x_188_phi "x_188_phi" + OpName %x_167 "x_167" + OpName %x_159 "x_159" + OpName %x_140 "x_140" + OpName %x_143 "x_143" + OpName %x_140_phi "x_140_phi" + OpName %x_143_phi "x_143_phi" + OpName %x_186_phi "x_186_phi" + OpName %x_193 "x_193" + OpName %x_240 "x_240" + OpName %x_193_phi "x_193_phi" + OpName %x_196_phi "x_196_phi" + OpName %x_242_phi "x_242_phi" + OpName %x_221 "x_221" + OpName %x_213 "x_213" + OpName %x_194 "x_194" + OpName %x_197 "x_197" + OpName %x_194_phi "x_194_phi" + OpName %x_197_phi "x_197_phi" + OpName %x_240_phi "x_240_phi" + OpName %x_247 "x_247" + OpName %x_294 "x_294" + OpName %x_247_phi "x_247_phi" + OpName %x_250_phi "x_250_phi" + OpName %x_296_phi "x_296_phi" + OpName %x_275 "x_275" + OpName %x_267 "x_267" + OpName %x_248 "x_248" + OpName %x_251 "x_251" + OpName %x_248_phi "x_248_phi" + OpName %x_251_phi "x_251_phi" + OpName %x_294_phi "x_294_phi" + OpName %x_301 "x_301" + OpName %x_348 "x_348" + OpName %x_301_phi "x_301_phi" + OpName %x_304_phi "x_304_phi" + OpName %x_350_phi "x_350_phi" + OpName %x_329 "x_329" + OpName %x_321 "x_321" + OpName %x_302 "x_302" + OpName %x_305 "x_305" + OpName %x_302_phi "x_302_phi" + OpName %x_305_phi "x_305_phi" + OpName %x_348_phi "x_348_phi" + OpName %x_355 "x_355" + OpName %x_402 "x_402" + OpName %x_355_phi "x_355_phi" + OpName %x_358_phi "x_358_phi" + OpName %x_404_phi "x_404_phi" + OpName %x_383 "x_383" + OpName %x_375 "x_375" + OpName %x_356 "x_356" + OpName %x_359 "x_359" + OpName %x_356_phi "x_356_phi" + OpName %x_359_phi "x_359_phi" + OpName %x_402_phi "x_402_phi" + OpName %x_409 "x_409" + OpName %x_456 "x_456" + OpName %x_409_phi "x_409_phi" + OpName %x_412_phi "x_412_phi" + OpName %x_458_phi "x_458_phi" + OpName %x_437 "x_437" + OpName %x_429 "x_429" + OpName %x_410 "x_410" + OpName %x_413 "x_413" + OpName %x_410_phi "x_410_phi" + OpName %x_413_phi "x_413_phi" + OpName %x_456_phi "x_456_phi" + OpName %x_463 "x_463" + OpName %x_510 "x_510" + OpName %x_463_phi "x_463_phi" + OpName %x_466_phi "x_466_phi" + OpName %x_512_phi "x_512_phi" + OpName %x_491 "x_491" + OpName %x_483 "x_483" + OpName %x_464 "x_464" + OpName %x_467 "x_467" + OpName %x_464_phi "x_464_phi" + OpName %x_467_phi "x_467_phi" + OpName %x_510_phi "x_510_phi" + OpName %x_517 "x_517" + OpName %x_564 "x_564" + OpName %x_517_phi "x_517_phi" + OpName %x_520_phi "x_520_phi" + OpName %x_566_phi "x_566_phi" + OpName %x_545 "x_545" + OpName %x_537 "x_537" + OpName %x_518 "x_518" + OpName %x_521 "x_521" + OpName %x_518_phi "x_518_phi" + OpName %x_521_phi "x_521_phi" + OpName %x_564_phi "x_564_phi" + OpName %x_597 "x_597" + OpName %x_607 "x_607" + OpName %x_612 "x_612" + OpName %x_575 "x_575" + OpName %x_570_phi "x_570_phi" + OpName %x_573_phi "x_573_phi" + OpName %x_582_phi "x_582_phi" + OpName %x_597_phi "x_597_phi" + OpName %x_598_phi "x_598_phi" + OpName %x_570 "x_570" + OpName %x_606 "x_606" + OpName %x_611 "x_611" + OpName %x_607_phi "x_607_phi" + OpName %x_612_phi "x_612_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Function__arr_BST_uint_10 = OpTypePointer Function %_arr_BST_uint_10 + %26 = OpConstantNull %_arr_BST_uint_10 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %30 = OpConstantNull %bool +%_ptr_Function_int = OpTypePointer Function %int + %34 = OpConstantNull %int + %int_0 = OpConstant %int 0 +%_ptr_Function_BST = OpTypePointer Function %BST + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 + %47 = OpConstantComposite %BST %int_9 %int_n1 %int_n1 + %uint_0 = OpConstant %uint 0 + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %99 = OpConstantComposite %BST %int_5 %int_n1 %int_n1 + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %int_12 = OpConstant %int 12 + %218 = OpConstantComposite %BST %int_12 %int_n1 %int_n1 + %int_3 = OpConstant %int 3 + %int_15 = OpConstant %int 15 + %312 = OpConstantComposite %BST %int_15 %int_n1 %int_n1 + %int_4 = OpConstant %int 4 + %int_7 = OpConstant %int 7 + %404 = OpConstantComposite %BST %int_7 %int_n1 %int_n1 + %int_8 = OpConstant %int 8 + %495 = OpConstantComposite %BST %int_8 %int_n1 %int_n1 + %int_6 = OpConstant %int 6 + %586 = OpConstantComposite %BST %int_2 %int_n1 %int_n1 + %676 = OpConstantComposite %BST %int_6 %int_n1 %int_n1 + %int_17 = OpConstant %int 17 + %767 = OpConstantComposite %BST %int_17 %int_n1 %int_n1 + %int_13 = OpConstant %int 13 + %858 = OpConstantComposite %BST %int_13 %int_n1 %int_n1 + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %991 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %992 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %993 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %tree = OpVariable %_ptr_Function__arr_BST_uint_10 Function %26 + %x_67 = OpVariable %_ptr_Function_bool Function %30 + %x_114 = OpVariable %_ptr_Function_bool Function %30 + %x_572 = OpVariable %_ptr_Function_int Function %34 + %x_67_phi = OpVariable %_ptr_Function_bool Function %30 + %x_70_phi = OpVariable %_ptr_Function_int Function %34 + %x_116_phi = OpVariable %_ptr_Function_bool Function %30 + %x_119_phi = OpVariable %_ptr_Function_int Function %34 + %x_569_phi = OpVariable %_ptr_Function_int Function %34 + %x_572_phi = OpVariable %_ptr_Function_int Function %34 + %x_574_phi = OpVariable %_ptr_Function_int Function %34 + %x_95 = OpVariable %_ptr_Function_int Function %34 + %x_87 = OpVariable %_ptr_Function_int Function %34 + %x_68 = OpVariable %_ptr_Function_bool Function %30 + %x_71 = OpVariable %_ptr_Function_int Function %34 + %x_68_phi = OpVariable %_ptr_Function_bool Function %30 + %x_71_phi = OpVariable %_ptr_Function_int Function %34 + %x_114_phi = OpVariable %_ptr_Function_bool Function %30 + %x_133 = OpVariable %_ptr_Function_bool Function %30 + %x_120 = OpVariable %_ptr_Function_int Function %34 + %x_134_phi = OpVariable %_ptr_Function_bool Function %30 + %x_139 = OpVariable %_ptr_Function_bool Function %30 + %x_186 = OpVariable %_ptr_Function_bool Function %30 + %x_139_phi = OpVariable %_ptr_Function_bool Function %30 + %x_142_phi = OpVariable %_ptr_Function_int Function %34 + %x_188_phi = OpVariable %_ptr_Function_bool Function %30 + %x_167 = OpVariable %_ptr_Function_int Function %34 + %x_159 = OpVariable %_ptr_Function_int Function %34 + %x_140 = OpVariable %_ptr_Function_bool Function %30 + %x_143 = OpVariable %_ptr_Function_int Function %34 + %x_140_phi = OpVariable %_ptr_Function_bool Function %30 + %x_143_phi = OpVariable %_ptr_Function_int Function %34 + %x_186_phi = OpVariable %_ptr_Function_bool Function %30 + %x_193 = OpVariable %_ptr_Function_bool Function %30 + %x_240 = OpVariable %_ptr_Function_bool Function %30 + %x_193_phi = OpVariable %_ptr_Function_bool Function %30 + %x_196_phi = OpVariable %_ptr_Function_int Function %34 + %x_242_phi = OpVariable %_ptr_Function_bool Function %30 + %x_221 = OpVariable %_ptr_Function_int Function %34 + %x_213 = OpVariable %_ptr_Function_int Function %34 + %x_194 = OpVariable %_ptr_Function_bool Function %30 + %x_197 = OpVariable %_ptr_Function_int Function %34 + %x_194_phi = OpVariable %_ptr_Function_bool Function %30 + %x_197_phi = OpVariable %_ptr_Function_int Function %34 + %x_240_phi = OpVariable %_ptr_Function_bool Function %30 + %x_247 = OpVariable %_ptr_Function_bool Function %30 + %x_294 = OpVariable %_ptr_Function_bool Function %30 + %x_247_phi = OpVariable %_ptr_Function_bool Function %30 + %x_250_phi = OpVariable %_ptr_Function_int Function %34 + %x_296_phi = OpVariable %_ptr_Function_bool Function %30 + %x_275 = OpVariable %_ptr_Function_int Function %34 + %x_267 = OpVariable %_ptr_Function_int Function %34 + %x_248 = OpVariable %_ptr_Function_bool Function %30 + %x_251 = OpVariable %_ptr_Function_int Function %34 + %x_248_phi = OpVariable %_ptr_Function_bool Function %30 + %x_251_phi = OpVariable %_ptr_Function_int Function %34 + %x_294_phi = OpVariable %_ptr_Function_bool Function %30 + %x_301 = OpVariable %_ptr_Function_bool Function %30 + %x_348 = OpVariable %_ptr_Function_bool Function %30 + %x_301_phi = OpVariable %_ptr_Function_bool Function %30 + %x_304_phi = OpVariable %_ptr_Function_int Function %34 + %x_350_phi = OpVariable %_ptr_Function_bool Function %30 + %x_329 = OpVariable %_ptr_Function_int Function %34 + %x_321 = OpVariable %_ptr_Function_int Function %34 + %x_302 = OpVariable %_ptr_Function_bool Function %30 + %x_305 = OpVariable %_ptr_Function_int Function %34 + %x_302_phi = OpVariable %_ptr_Function_bool Function %30 + %x_305_phi = OpVariable %_ptr_Function_int Function %34 + %x_348_phi = OpVariable %_ptr_Function_bool Function %30 + %x_355 = OpVariable %_ptr_Function_bool Function %30 + %x_402 = OpVariable %_ptr_Function_bool Function %30 + %x_355_phi = OpVariable %_ptr_Function_bool Function %30 + %x_358_phi = OpVariable %_ptr_Function_int Function %34 + %x_404_phi = OpVariable %_ptr_Function_bool Function %30 + %x_383 = OpVariable %_ptr_Function_int Function %34 + %x_375 = OpVariable %_ptr_Function_int Function %34 + %x_356 = OpVariable %_ptr_Function_bool Function %30 + %x_359 = OpVariable %_ptr_Function_int Function %34 + %x_356_phi = OpVariable %_ptr_Function_bool Function %30 + %x_359_phi = OpVariable %_ptr_Function_int Function %34 + %x_402_phi = OpVariable %_ptr_Function_bool Function %30 + %x_409 = OpVariable %_ptr_Function_bool Function %30 + %x_456 = OpVariable %_ptr_Function_bool Function %30 + %x_409_phi = OpVariable %_ptr_Function_bool Function %30 + %x_412_phi = OpVariable %_ptr_Function_int Function %34 + %x_458_phi = OpVariable %_ptr_Function_bool Function %30 + %x_437 = OpVariable %_ptr_Function_int Function %34 + %x_429 = OpVariable %_ptr_Function_int Function %34 + %x_410 = OpVariable %_ptr_Function_bool Function %30 + %x_413 = OpVariable %_ptr_Function_int Function %34 + %x_410_phi = OpVariable %_ptr_Function_bool Function %30 + %x_413_phi = OpVariable %_ptr_Function_int Function %34 + %x_456_phi = OpVariable %_ptr_Function_bool Function %30 + %x_463 = OpVariable %_ptr_Function_bool Function %30 + %x_510 = OpVariable %_ptr_Function_bool Function %30 + %x_463_phi = OpVariable %_ptr_Function_bool Function %30 + %x_466_phi = OpVariable %_ptr_Function_int Function %34 + %x_512_phi = OpVariable %_ptr_Function_bool Function %30 + %x_491 = OpVariable %_ptr_Function_int Function %34 + %x_483 = OpVariable %_ptr_Function_int Function %34 + %x_464 = OpVariable %_ptr_Function_bool Function %30 + %x_467 = OpVariable %_ptr_Function_int Function %34 + %x_464_phi = OpVariable %_ptr_Function_bool Function %30 + %x_467_phi = OpVariable %_ptr_Function_int Function %34 + %x_510_phi = OpVariable %_ptr_Function_bool Function %30 + %x_517 = OpVariable %_ptr_Function_bool Function %30 + %x_564 = OpVariable %_ptr_Function_bool Function %30 + %x_517_phi = OpVariable %_ptr_Function_bool Function %30 + %x_520_phi = OpVariable %_ptr_Function_int Function %34 + %x_566_phi = OpVariable %_ptr_Function_bool Function %30 + %x_545 = OpVariable %_ptr_Function_int Function %34 + %x_537 = OpVariable %_ptr_Function_int Function %34 + %x_518 = OpVariable %_ptr_Function_bool Function %30 + %x_521 = OpVariable %_ptr_Function_int Function %34 + %x_518_phi = OpVariable %_ptr_Function_bool Function %30 + %x_521_phi = OpVariable %_ptr_Function_int Function %34 + %x_564_phi = OpVariable %_ptr_Function_bool Function %30 + %x_597 = OpVariable %_ptr_Function_int Function %34 + %x_607 = OpVariable %_ptr_Function_int Function %34 + %x_612 = OpVariable %_ptr_Function_int Function %34 + %x_575 = OpVariable %_ptr_Function_int Function %34 + %x_570_phi = OpVariable %_ptr_Function_int Function %34 + %x_573_phi = OpVariable %_ptr_Function_int Function %34 + %x_582_phi = OpVariable %_ptr_Function_int Function %34 + %x_597_phi = OpVariable %_ptr_Function_int Function %34 + %x_598_phi = OpVariable %_ptr_Function_bool Function %30 + %x_570 = OpVariable %_ptr_Function_int Function %34 + %x_606 = OpVariable %_ptr_Function_int Function %34 + %x_611 = OpVariable %_ptr_Function_int Function %34 + %x_607_phi = OpVariable %_ptr_Function_int Function %34 + %x_612_phi = OpVariable %_ptr_Function_int Function %34 + %44 = OpAccessChain %_ptr_Function_BST %tree %int_0 + OpStore %44 %47 + OpSelectionMerge %48 None + OpSwitch %uint_0 %50 + %50 = OpLabel + OpStore %x_67_phi %false + OpStore %x_70_phi %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %62 = OpLoad %bool %x_67_phi + OpStore %x_67 %62 + %63 = OpLoad %int %x_70_phi + %64 = OpLoad %bool %x_67 + OpStore %x_116_phi %64 + %66 = OpSLessThanEqual %bool %63 %int_1 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %53 + %67 = OpLabel + %70 = OpAccessChain %_ptr_Function_int %tree %63 %uint_0 + %71 = OpLoad %int %70 + %73 = OpSLessThanEqual %bool %int_5 %71 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %79 = OpAccessChain %_ptr_Function_int %tree %63 %uint_1 + %80 = OpLoad %int %79 + %81 = OpIEqual %bool %80 %int_n1 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + %86 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %89 = OpLoad %float %88 + %90 = OpFOrdLessThan %bool %87 %89 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + OpBranch %93 + %93 = OpLabel + OpLoopMerge %94 %95 None + OpBranch %96 + %96 = OpLabel + OpKill + %95 = OpLabel + OpBranch %93 + %94 = OpLabel + OpReturn + %91 = OpLabel + %97 = OpAccessChain %_ptr_Function_int %tree %63 %uint_1 + OpStore %97 %int_1 + %98 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %98 %99 + OpBranch %100 + %100 = OpLabel + OpLoopMerge %101 %102 None + OpBranch %103 + %103 = OpLabel + %104 = OpLoad %bool %x_67 + OpStore %x_114_phi %104 + %105 = OpConvertFToS %int %87 + %106 = OpSLessThan %bool %int_0 %105 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %109 + %108 = OpLabel + OpBranch %107 + %109 = OpLabel + OpBranch %101 + %107 = OpLabel + OpStore %x_114_phi %true + OpBranch %101 + %102 = OpLabel + OpBranch %100 + %101 = OpLabel + %111 = OpLoad %bool %x_114_phi + OpStore %x_114 %111 + %112 = OpLoad %bool %x_114 + OpStore %x_116_phi %112 + %113 = OpLoad %bool %x_114 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %114 + %115 = OpLabel + OpBranch %53 + %114 = OpLabel + OpBranch %82 + %84 = OpLabel + %116 = OpAccessChain %_ptr_Function_int %tree %63 %uint_1 + %117 = OpLoad %int %116 + OpStore %x_95 %117 + %118 = OpLoad %bool %x_67 + OpStore %x_68_phi %118 + %119 = OpLoad %int %x_95 + OpStore %x_71_phi %119 + OpBranch %54 + %82 = OpLabel + OpBranch %74 + %76 = OpLabel + %121 = OpAccessChain %_ptr_Function_int %tree %63 %uint_2 + %122 = OpLoad %int %121 + %123 = OpIEqual %bool %122 %int_n1 + OpSelectionMerge %124 None + OpBranchConditional %123 %125 %126 + %125 = OpLabel + %127 = OpAccessChain %_ptr_Function_int %tree %63 %uint_2 + OpStore %127 %int_1 + %128 = OpAccessChain %_ptr_Function_BST %tree %int_1 + OpStore %128 %99 + OpStore %x_116_phi %true + OpBranch %53 + %126 = OpLabel + %129 = OpAccessChain %_ptr_Function_int %tree %63 %uint_2 + %130 = OpLoad %int %129 + OpStore %x_87 %130 + %131 = OpLoad %bool %x_67 + OpStore %x_68_phi %131 + %132 = OpLoad %int %x_87 + OpStore %x_71_phi %132 + OpBranch %54 + %124 = OpLabel + OpReturn + %74 = OpLabel + %133 = OpLoad %bool %x_114 + OpStore %x_68_phi %133 + OpStore %x_71_phi %63 + OpBranch %54 + %54 = OpLabel + %134 = OpLoad %bool %x_68_phi + OpStore %x_68 %134 + %135 = OpLoad %int %x_71_phi + OpStore %x_71 %135 + %136 = OpLoad %bool %x_68 + OpStore %x_67_phi %136 + %137 = OpLoad %int %x_71 + OpStore %x_70_phi %137 + OpBranch %52 + %53 = OpLabel + %138 = OpLoad %bool %x_116_phi + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + OpBranch %48 + %139 = OpLabel + OpBranch %48 + %48 = OpLabel + OpStore %x_119_phi %int_0 + OpBranch %141 + %141 = OpLabel + OpLoopMerge %142 %143 None + OpBranch %144 + %144 = OpLabel + %148 = OpLoad %int %x_119_phi + %150 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %151 = OpLoad %float %150 + %153 = OpFOrdLessThan %bool %151 %float_0 + OpStore %x_134_phi %153 + %154 = OpLogicalNot %bool %153 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %155 + %156 = OpLabel + %157 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %158 = OpLoad %float %157 + %159 = OpConvertFToS %int %158 + %160 = OpINotEqual %bool %148 %159 + OpStore %x_133 %160 + %161 = OpLoad %bool %x_133 + OpStore %x_134_phi %161 + OpBranch %155 + %155 = OpLabel + %162 = OpLoad %bool %x_134_phi + OpSelectionMerge %163 None + OpBranchConditional %162 %164 %165 + %164 = OpLabel + OpBranch %163 + %165 = OpLabel + OpBranch %142 + %163 = OpLabel + OpSelectionMerge %171 None + OpSwitch %uint_0 %172 + %172 = OpLabel + OpStore %x_139_phi %false + OpStore %x_142_phi %int_0 + OpBranch %173 + %173 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %183 = OpLoad %bool %x_139_phi + OpStore %x_139 %183 + %184 = OpLoad %int %x_142_phi + %185 = OpLoad %bool %x_139 + OpStore %x_188_phi %185 + %187 = OpSLessThanEqual %bool %184 %int_2 + OpSelectionMerge %188 None + OpBranchConditional %187 %189 %190 + %189 = OpLabel + OpBranch %188 + %190 = OpLabel + OpBranch %174 + %188 = OpLabel + %191 = OpAccessChain %_ptr_Function_int %tree %184 %uint_0 + %192 = OpLoad %int %191 + %194 = OpSLessThanEqual %bool %int_12 %192 + OpSelectionMerge %195 None + OpBranchConditional %194 %196 %197 + %196 = OpLabel + %199 = OpAccessChain %_ptr_Function_int %tree %184 %uint_1 + %200 = OpLoad %int %199 + %201 = OpIEqual %bool %200 %int_n1 + OpSelectionMerge %202 None + OpBranchConditional %201 %203 %204 + %203 = OpLabel + %205 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %206 = OpLoad %float %205 + %207 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %208 = OpLoad %float %207 + %209 = OpFOrdLessThan %bool %206 %208 + OpSelectionMerge %210 None + OpBranchConditional %209 %211 %210 + %211 = OpLabel + OpBranch %212 + %212 = OpLabel + OpLoopMerge %213 %214 None + OpBranch %215 + %215 = OpLabel + OpKill + %214 = OpLabel + OpBranch %212 + %213 = OpLabel + OpReturn + %210 = OpLabel + %216 = OpAccessChain %_ptr_Function_int %tree %184 %uint_1 + OpStore %216 %int_2 + %217 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %217 %218 + OpBranch %219 + %219 = OpLabel + OpLoopMerge %220 %221 None + OpBranch %222 + %222 = OpLabel + %223 = OpLoad %bool %x_139 + OpStore %x_186_phi %223 + %224 = OpConvertFToS %int %206 + %225 = OpSLessThan %bool %int_0 %224 + OpSelectionMerge %226 None + OpBranchConditional %225 %227 %228 + %227 = OpLabel + OpBranch %226 + %228 = OpLabel + OpBranch %220 + %226 = OpLabel + OpStore %x_186_phi %true + OpBranch %220 + %221 = OpLabel + OpBranch %219 + %220 = OpLabel + %229 = OpLoad %bool %x_186_phi + OpStore %x_186 %229 + %230 = OpLoad %bool %x_186 + OpStore %x_188_phi %230 + %231 = OpLoad %bool %x_186 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %232 + %233 = OpLabel + OpBranch %174 + %232 = OpLabel + OpBranch %202 + %204 = OpLabel + %234 = OpAccessChain %_ptr_Function_int %tree %184 %uint_1 + %235 = OpLoad %int %234 + OpStore %x_167 %235 + %236 = OpLoad %bool %x_139 + OpStore %x_140_phi %236 + %237 = OpLoad %int %x_167 + OpStore %x_143_phi %237 + OpBranch %175 + %202 = OpLabel + OpBranch %195 + %197 = OpLabel + %238 = OpAccessChain %_ptr_Function_int %tree %184 %uint_2 + %239 = OpLoad %int %238 + %240 = OpIEqual %bool %239 %int_n1 + OpSelectionMerge %241 None + OpBranchConditional %240 %242 %243 + %242 = OpLabel + %244 = OpAccessChain %_ptr_Function_int %tree %184 %uint_2 + OpStore %244 %int_2 + %245 = OpAccessChain %_ptr_Function_BST %tree %int_2 + OpStore %245 %218 + OpStore %x_188_phi %true + OpBranch %174 + %243 = OpLabel + %246 = OpAccessChain %_ptr_Function_int %tree %184 %uint_2 + %247 = OpLoad %int %246 + OpStore %x_159 %247 + %248 = OpLoad %bool %x_139 + OpStore %x_140_phi %248 + %249 = OpLoad %int %x_159 + OpStore %x_143_phi %249 + OpBranch %175 + %241 = OpLabel + OpReturn + %195 = OpLabel + %250 = OpLoad %bool %x_186 + OpStore %x_140_phi %250 + OpStore %x_143_phi %184 + OpBranch %175 + %175 = OpLabel + %251 = OpLoad %bool %x_140_phi + OpStore %x_140 %251 + %252 = OpLoad %int %x_143_phi + OpStore %x_143 %252 + %253 = OpLoad %bool %x_140 + OpStore %x_139_phi %253 + %254 = OpLoad %int %x_143 + OpStore %x_142_phi %254 + OpBranch %173 + %174 = OpLabel + %255 = OpLoad %bool %x_188_phi + OpSelectionMerge %256 None + OpBranchConditional %255 %257 %256 + %257 = OpLabel + OpBranch %171 + %256 = OpLabel + OpBranch %171 + %171 = OpLabel + OpBranch %143 + %143 = OpLabel + %258 = OpIAdd %int %148 %int_1 + OpStore %x_120 %258 + %259 = OpLoad %int %x_120 + OpStore %x_119_phi %259 + OpBranch %141 + %142 = OpLabel + OpSelectionMerge %265 None + OpSwitch %uint_0 %266 + %266 = OpLabel + OpStore %x_193_phi %false + OpStore %x_196_phi %int_0 + OpBranch %267 + %267 = OpLabel + OpLoopMerge %268 %269 None + OpBranch %270 + %270 = OpLabel + %277 = OpLoad %bool %x_193_phi + OpStore %x_193 %277 + %278 = OpLoad %int %x_196_phi + %279 = OpLoad %bool %x_193 + OpStore %x_242_phi %279 + %281 = OpSLessThanEqual %bool %278 %int_3 + OpSelectionMerge %282 None + OpBranchConditional %281 %283 %284 + %283 = OpLabel + OpBranch %282 + %284 = OpLabel + OpBranch %268 + %282 = OpLabel + %285 = OpAccessChain %_ptr_Function_int %tree %278 %uint_0 + %286 = OpLoad %int %285 + %288 = OpSLessThanEqual %bool %int_15 %286 + OpSelectionMerge %289 None + OpBranchConditional %288 %290 %291 + %290 = OpLabel + %293 = OpAccessChain %_ptr_Function_int %tree %278 %uint_1 + %294 = OpLoad %int %293 + %295 = OpIEqual %bool %294 %int_n1 + OpSelectionMerge %296 None + OpBranchConditional %295 %297 %298 + %297 = OpLabel + %299 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %300 = OpLoad %float %299 + %301 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %302 = OpLoad %float %301 + %303 = OpFOrdLessThan %bool %300 %302 + OpSelectionMerge %304 None + OpBranchConditional %303 %305 %304 + %305 = OpLabel + OpBranch %306 + %306 = OpLabel + OpLoopMerge %307 %308 None + OpBranch %309 + %309 = OpLabel + OpKill + %308 = OpLabel + OpBranch %306 + %307 = OpLabel + OpReturn + %304 = OpLabel + %310 = OpAccessChain %_ptr_Function_int %tree %278 %uint_1 + OpStore %310 %int_3 + %311 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %311 %312 + OpBranch %313 + %313 = OpLabel + OpLoopMerge %314 %315 None + OpBranch %316 + %316 = OpLabel + %317 = OpLoad %bool %x_193 + OpStore %x_240_phi %317 + %318 = OpConvertFToS %int %300 + %319 = OpSLessThan %bool %int_0 %318 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %322 + %321 = OpLabel + OpBranch %320 + %322 = OpLabel + OpBranch %314 + %320 = OpLabel + OpStore %x_240_phi %true + OpBranch %314 + %315 = OpLabel + OpBranch %313 + %314 = OpLabel + %323 = OpLoad %bool %x_240_phi + OpStore %x_240 %323 + %324 = OpLoad %bool %x_240 + OpStore %x_242_phi %324 + %325 = OpLoad %bool %x_240 + OpSelectionMerge %326 None + OpBranchConditional %325 %327 %326 + %327 = OpLabel + OpBranch %268 + %326 = OpLabel + OpBranch %296 + %298 = OpLabel + %328 = OpAccessChain %_ptr_Function_int %tree %278 %uint_1 + %329 = OpLoad %int %328 + OpStore %x_221 %329 + %330 = OpLoad %bool %x_193 + OpStore %x_194_phi %330 + %331 = OpLoad %int %x_221 + OpStore %x_197_phi %331 + OpBranch %269 + %296 = OpLabel + OpBranch %289 + %291 = OpLabel + %332 = OpAccessChain %_ptr_Function_int %tree %278 %uint_2 + %333 = OpLoad %int %332 + %334 = OpIEqual %bool %333 %int_n1 + OpSelectionMerge %335 None + OpBranchConditional %334 %336 %337 + %336 = OpLabel + %338 = OpAccessChain %_ptr_Function_int %tree %278 %uint_2 + OpStore %338 %int_3 + %339 = OpAccessChain %_ptr_Function_BST %tree %int_3 + OpStore %339 %312 + OpStore %x_242_phi %true + OpBranch %268 + %337 = OpLabel + %340 = OpAccessChain %_ptr_Function_int %tree %278 %uint_2 + %341 = OpLoad %int %340 + OpStore %x_213 %341 + %342 = OpLoad %bool %x_193 + OpStore %x_194_phi %342 + %343 = OpLoad %int %x_213 + OpStore %x_197_phi %343 + OpBranch %269 + %335 = OpLabel + OpReturn + %289 = OpLabel + %344 = OpLoad %bool %x_240 + OpStore %x_194_phi %344 + OpStore %x_197_phi %278 + OpBranch %269 + %269 = OpLabel + %345 = OpLoad %bool %x_194_phi + OpStore %x_194 %345 + %346 = OpLoad %int %x_197_phi + OpStore %x_197 %346 + %347 = OpLoad %bool %x_194 + OpStore %x_193_phi %347 + %348 = OpLoad %int %x_197 + OpStore %x_196_phi %348 + OpBranch %267 + %268 = OpLabel + %349 = OpLoad %bool %x_242_phi + OpSelectionMerge %350 None + OpBranchConditional %349 %351 %350 + %351 = OpLabel + OpBranch %265 + %350 = OpLabel + OpBranch %265 + %265 = OpLabel + OpSelectionMerge %357 None + OpSwitch %uint_0 %358 + %358 = OpLabel + OpStore %x_247_phi %false + OpStore %x_250_phi %int_0 + OpBranch %359 + %359 = OpLabel + OpLoopMerge %360 %361 None + OpBranch %362 + %362 = OpLabel + %369 = OpLoad %bool %x_247_phi + OpStore %x_247 %369 + %370 = OpLoad %int %x_250_phi + %371 = OpLoad %bool %x_247 + OpStore %x_296_phi %371 + %373 = OpSLessThanEqual %bool %370 %int_4 + OpSelectionMerge %374 None + OpBranchConditional %373 %375 %376 + %375 = OpLabel + OpBranch %374 + %376 = OpLabel + OpBranch %360 + %374 = OpLabel + %377 = OpAccessChain %_ptr_Function_int %tree %370 %uint_0 + %378 = OpLoad %int %377 + %380 = OpSLessThanEqual %bool %int_7 %378 + OpSelectionMerge %381 None + OpBranchConditional %380 %382 %383 + %382 = OpLabel + %385 = OpAccessChain %_ptr_Function_int %tree %370 %uint_1 + %386 = OpLoad %int %385 + %387 = OpIEqual %bool %386 %int_n1 + OpSelectionMerge %388 None + OpBranchConditional %387 %389 %390 + %389 = OpLabel + %391 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %392 = OpLoad %float %391 + %393 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %394 = OpLoad %float %393 + %395 = OpFOrdLessThan %bool %392 %394 + OpSelectionMerge %396 None + OpBranchConditional %395 %397 %396 + %397 = OpLabel + OpBranch %398 + %398 = OpLabel + OpLoopMerge %399 %400 None + OpBranch %401 + %401 = OpLabel + OpKill + %400 = OpLabel + OpBranch %398 + %399 = OpLabel + OpReturn + %396 = OpLabel + %402 = OpAccessChain %_ptr_Function_int %tree %370 %uint_1 + OpStore %402 %int_4 + %403 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %403 %404 + OpBranch %405 + %405 = OpLabel + OpLoopMerge %406 %407 None + OpBranch %408 + %408 = OpLabel + %409 = OpLoad %bool %x_247 + OpStore %x_294_phi %409 + %410 = OpConvertFToS %int %392 + %411 = OpSLessThan %bool %int_0 %410 + OpSelectionMerge %412 None + OpBranchConditional %411 %413 %414 + %413 = OpLabel + OpBranch %412 + %414 = OpLabel + OpBranch %406 + %412 = OpLabel + OpStore %x_294_phi %true + OpBranch %406 + %407 = OpLabel + OpBranch %405 + %406 = OpLabel + %415 = OpLoad %bool %x_294_phi + OpStore %x_294 %415 + %416 = OpLoad %bool %x_294 + OpStore %x_296_phi %416 + %417 = OpLoad %bool %x_294 + OpSelectionMerge %418 None + OpBranchConditional %417 %419 %418 + %419 = OpLabel + OpBranch %360 + %418 = OpLabel + OpBranch %388 + %390 = OpLabel + %420 = OpAccessChain %_ptr_Function_int %tree %370 %uint_1 + %421 = OpLoad %int %420 + OpStore %x_275 %421 + %422 = OpLoad %bool %x_247 + OpStore %x_248_phi %422 + %423 = OpLoad %int %x_275 + OpStore %x_251_phi %423 + OpBranch %361 + %388 = OpLabel + OpBranch %381 + %383 = OpLabel + %424 = OpAccessChain %_ptr_Function_int %tree %370 %uint_2 + %425 = OpLoad %int %424 + %426 = OpIEqual %bool %425 %int_n1 + OpSelectionMerge %427 None + OpBranchConditional %426 %428 %429 + %428 = OpLabel + %430 = OpAccessChain %_ptr_Function_int %tree %370 %uint_2 + OpStore %430 %int_4 + %431 = OpAccessChain %_ptr_Function_BST %tree %int_4 + OpStore %431 %404 + OpStore %x_296_phi %true + OpBranch %360 + %429 = OpLabel + %432 = OpAccessChain %_ptr_Function_int %tree %370 %uint_2 + %433 = OpLoad %int %432 + OpStore %x_267 %433 + %434 = OpLoad %bool %x_247 + OpStore %x_248_phi %434 + %435 = OpLoad %int %x_267 + OpStore %x_251_phi %435 + OpBranch %361 + %427 = OpLabel + OpReturn + %381 = OpLabel + %436 = OpLoad %bool %x_294 + OpStore %x_248_phi %436 + OpStore %x_251_phi %370 + OpBranch %361 + %361 = OpLabel + %437 = OpLoad %bool %x_248_phi + OpStore %x_248 %437 + %438 = OpLoad %int %x_251_phi + OpStore %x_251 %438 + %439 = OpLoad %bool %x_248 + OpStore %x_247_phi %439 + %440 = OpLoad %int %x_251 + OpStore %x_250_phi %440 + OpBranch %359 + %360 = OpLabel + %441 = OpLoad %bool %x_296_phi + OpSelectionMerge %442 None + OpBranchConditional %441 %443 %442 + %443 = OpLabel + OpBranch %357 + %442 = OpLabel + OpBranch %357 + %357 = OpLabel + OpSelectionMerge %449 None + OpSwitch %uint_0 %450 + %450 = OpLabel + OpStore %x_301_phi %false + OpStore %x_304_phi %int_0 + OpBranch %451 + %451 = OpLabel + OpLoopMerge %452 %453 None + OpBranch %454 + %454 = OpLabel + %461 = OpLoad %bool %x_301_phi + OpStore %x_301 %461 + %462 = OpLoad %int %x_304_phi + %463 = OpLoad %bool %x_301 + OpStore %x_350_phi %463 + %464 = OpSLessThanEqual %bool %462 %int_5 + OpSelectionMerge %465 None + OpBranchConditional %464 %466 %467 + %466 = OpLabel + OpBranch %465 + %467 = OpLabel + OpBranch %452 + %465 = OpLabel + %468 = OpAccessChain %_ptr_Function_int %tree %462 %uint_0 + %469 = OpLoad %int %468 + %471 = OpSLessThanEqual %bool %int_8 %469 + OpSelectionMerge %472 None + OpBranchConditional %471 %473 %474 + %473 = OpLabel + %476 = OpAccessChain %_ptr_Function_int %tree %462 %uint_1 + %477 = OpLoad %int %476 + %478 = OpIEqual %bool %477 %int_n1 + OpSelectionMerge %479 None + OpBranchConditional %478 %480 %481 + %480 = OpLabel + %482 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %483 = OpLoad %float %482 + %484 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %485 = OpLoad %float %484 + %486 = OpFOrdLessThan %bool %483 %485 + OpSelectionMerge %487 None + OpBranchConditional %486 %488 %487 + %488 = OpLabel + OpBranch %489 + %489 = OpLabel + OpLoopMerge %490 %491 None + OpBranch %492 + %492 = OpLabel + OpKill + %491 = OpLabel + OpBranch %489 + %490 = OpLabel + OpReturn + %487 = OpLabel + %493 = OpAccessChain %_ptr_Function_int %tree %462 %uint_1 + OpStore %493 %int_5 + %494 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %494 %495 + OpBranch %496 + %496 = OpLabel + OpLoopMerge %497 %498 None + OpBranch %499 + %499 = OpLabel + %500 = OpLoad %bool %x_301 + OpStore %x_348_phi %500 + %501 = OpConvertFToS %int %483 + %502 = OpSLessThan %bool %int_0 %501 + OpSelectionMerge %503 None + OpBranchConditional %502 %504 %505 + %504 = OpLabel + OpBranch %503 + %505 = OpLabel + OpBranch %497 + %503 = OpLabel + OpStore %x_348_phi %true + OpBranch %497 + %498 = OpLabel + OpBranch %496 + %497 = OpLabel + %506 = OpLoad %bool %x_348_phi + OpStore %x_348 %506 + %507 = OpLoad %bool %x_348 + OpStore %x_350_phi %507 + %508 = OpLoad %bool %x_348 + OpSelectionMerge %509 None + OpBranchConditional %508 %510 %509 + %510 = OpLabel + OpBranch %452 + %509 = OpLabel + OpBranch %479 + %481 = OpLabel + %511 = OpAccessChain %_ptr_Function_int %tree %462 %uint_1 + %512 = OpLoad %int %511 + OpStore %x_329 %512 + %513 = OpLoad %bool %x_301 + OpStore %x_302_phi %513 + %514 = OpLoad %int %x_329 + OpStore %x_305_phi %514 + OpBranch %453 + %479 = OpLabel + OpBranch %472 + %474 = OpLabel + %515 = OpAccessChain %_ptr_Function_int %tree %462 %uint_2 + %516 = OpLoad %int %515 + %517 = OpIEqual %bool %516 %int_n1 + OpSelectionMerge %518 None + OpBranchConditional %517 %519 %520 + %519 = OpLabel + %521 = OpAccessChain %_ptr_Function_int %tree %462 %uint_2 + OpStore %521 %int_5 + %522 = OpAccessChain %_ptr_Function_BST %tree %int_5 + OpStore %522 %495 + OpStore %x_350_phi %true + OpBranch %452 + %520 = OpLabel + %523 = OpAccessChain %_ptr_Function_int %tree %462 %uint_2 + %524 = OpLoad %int %523 + OpStore %x_321 %524 + %525 = OpLoad %bool %x_301 + OpStore %x_302_phi %525 + %526 = OpLoad %int %x_321 + OpStore %x_305_phi %526 + OpBranch %453 + %518 = OpLabel + OpReturn + %472 = OpLabel + %527 = OpLoad %bool %x_348 + OpStore %x_302_phi %527 + OpStore %x_305_phi %462 + OpBranch %453 + %453 = OpLabel + %528 = OpLoad %bool %x_302_phi + OpStore %x_302 %528 + %529 = OpLoad %int %x_305_phi + OpStore %x_305 %529 + %530 = OpLoad %bool %x_302 + OpStore %x_301_phi %530 + %531 = OpLoad %int %x_305 + OpStore %x_304_phi %531 + OpBranch %451 + %452 = OpLabel + %532 = OpLoad %bool %x_350_phi + OpSelectionMerge %533 None + OpBranchConditional %532 %534 %533 + %534 = OpLabel + OpBranch %449 + %533 = OpLabel + OpBranch %449 + %449 = OpLabel + OpSelectionMerge %540 None + OpSwitch %uint_0 %541 + %541 = OpLabel + OpStore %x_355_phi %false + OpStore %x_358_phi %int_0 + OpBranch %542 + %542 = OpLabel + OpLoopMerge %543 %544 None + OpBranch %545 + %545 = OpLabel + %552 = OpLoad %bool %x_355_phi + OpStore %x_355 %552 + %553 = OpLoad %int %x_358_phi + %554 = OpLoad %bool %x_355 + OpStore %x_404_phi %554 + %556 = OpSLessThanEqual %bool %553 %int_6 + OpSelectionMerge %557 None + OpBranchConditional %556 %558 %559 + %558 = OpLabel + OpBranch %557 + %559 = OpLabel + OpBranch %543 + %557 = OpLabel + %560 = OpAccessChain %_ptr_Function_int %tree %553 %uint_0 + %561 = OpLoad %int %560 + %562 = OpSLessThanEqual %bool %int_2 %561 + OpSelectionMerge %563 None + OpBranchConditional %562 %564 %565 + %564 = OpLabel + %567 = OpAccessChain %_ptr_Function_int %tree %553 %uint_1 + %568 = OpLoad %int %567 + %569 = OpIEqual %bool %568 %int_n1 + OpSelectionMerge %570 None + OpBranchConditional %569 %571 %572 + %571 = OpLabel + %573 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %574 = OpLoad %float %573 + %575 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %576 = OpLoad %float %575 + %577 = OpFOrdLessThan %bool %574 %576 + OpSelectionMerge %578 None + OpBranchConditional %577 %579 %578 + %579 = OpLabel + OpBranch %580 + %580 = OpLabel + OpLoopMerge %581 %582 None + OpBranch %583 + %583 = OpLabel + OpKill + %582 = OpLabel + OpBranch %580 + %581 = OpLabel + OpReturn + %578 = OpLabel + %584 = OpAccessChain %_ptr_Function_int %tree %553 %uint_1 + OpStore %584 %int_6 + %585 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %585 %586 + OpBranch %587 + %587 = OpLabel + OpLoopMerge %588 %589 None + OpBranch %590 + %590 = OpLabel + %591 = OpLoad %bool %x_355 + OpStore %x_402_phi %591 + %592 = OpConvertFToS %int %574 + %593 = OpSLessThan %bool %int_0 %592 + OpSelectionMerge %594 None + OpBranchConditional %593 %595 %596 + %595 = OpLabel + OpBranch %594 + %596 = OpLabel + OpBranch %588 + %594 = OpLabel + OpStore %x_402_phi %true + OpBranch %588 + %589 = OpLabel + OpBranch %587 + %588 = OpLabel + %597 = OpLoad %bool %x_402_phi + OpStore %x_402 %597 + %598 = OpLoad %bool %x_402 + OpStore %x_404_phi %598 + %599 = OpLoad %bool %x_402 + OpSelectionMerge %600 None + OpBranchConditional %599 %601 %600 + %601 = OpLabel + OpBranch %543 + %600 = OpLabel + OpBranch %570 + %572 = OpLabel + %602 = OpAccessChain %_ptr_Function_int %tree %553 %uint_1 + %603 = OpLoad %int %602 + OpStore %x_383 %603 + %604 = OpLoad %bool %x_355 + OpStore %x_356_phi %604 + %605 = OpLoad %int %x_383 + OpStore %x_359_phi %605 + OpBranch %544 + %570 = OpLabel + OpBranch %563 + %565 = OpLabel + %606 = OpAccessChain %_ptr_Function_int %tree %553 %uint_2 + %607 = OpLoad %int %606 + %608 = OpIEqual %bool %607 %int_n1 + OpSelectionMerge %609 None + OpBranchConditional %608 %610 %611 + %610 = OpLabel + %612 = OpAccessChain %_ptr_Function_int %tree %553 %uint_2 + OpStore %612 %int_6 + %613 = OpAccessChain %_ptr_Function_BST %tree %int_6 + OpStore %613 %586 + OpStore %x_404_phi %true + OpBranch %543 + %611 = OpLabel + %614 = OpAccessChain %_ptr_Function_int %tree %553 %uint_2 + %615 = OpLoad %int %614 + OpStore %x_375 %615 + %616 = OpLoad %bool %x_355 + OpStore %x_356_phi %616 + %617 = OpLoad %int %x_375 + OpStore %x_359_phi %617 + OpBranch %544 + %609 = OpLabel + OpReturn + %563 = OpLabel + %618 = OpLoad %bool %x_402 + OpStore %x_356_phi %618 + OpStore %x_359_phi %553 + OpBranch %544 + %544 = OpLabel + %619 = OpLoad %bool %x_356_phi + OpStore %x_356 %619 + %620 = OpLoad %int %x_359_phi + OpStore %x_359 %620 + %621 = OpLoad %bool %x_356 + OpStore %x_355_phi %621 + %622 = OpLoad %int %x_359 + OpStore %x_358_phi %622 + OpBranch %542 + %543 = OpLabel + %623 = OpLoad %bool %x_404_phi + OpSelectionMerge %624 None + OpBranchConditional %623 %625 %624 + %625 = OpLabel + OpBranch %540 + %624 = OpLabel + OpBranch %540 + %540 = OpLabel + OpSelectionMerge %631 None + OpSwitch %uint_0 %632 + %632 = OpLabel + OpStore %x_409_phi %false + OpStore %x_412_phi %int_0 + OpBranch %633 + %633 = OpLabel + OpLoopMerge %634 %635 None + OpBranch %636 + %636 = OpLabel + %643 = OpLoad %bool %x_409_phi + OpStore %x_409 %643 + %644 = OpLoad %int %x_412_phi + %645 = OpLoad %bool %x_409 + OpStore %x_458_phi %645 + %646 = OpSLessThanEqual %bool %644 %int_7 + OpSelectionMerge %647 None + OpBranchConditional %646 %648 %649 + %648 = OpLabel + OpBranch %647 + %649 = OpLabel + OpBranch %634 + %647 = OpLabel + %650 = OpAccessChain %_ptr_Function_int %tree %644 %uint_0 + %651 = OpLoad %int %650 + %652 = OpSLessThanEqual %bool %int_6 %651 + OpSelectionMerge %653 None + OpBranchConditional %652 %654 %655 + %654 = OpLabel + %657 = OpAccessChain %_ptr_Function_int %tree %644 %uint_1 + %658 = OpLoad %int %657 + %659 = OpIEqual %bool %658 %int_n1 + OpSelectionMerge %660 None + OpBranchConditional %659 %661 %662 + %661 = OpLabel + %663 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %664 = OpLoad %float %663 + %665 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %666 = OpLoad %float %665 + %667 = OpFOrdLessThan %bool %664 %666 + OpSelectionMerge %668 None + OpBranchConditional %667 %669 %668 + %669 = OpLabel + OpBranch %670 + %670 = OpLabel + OpLoopMerge %671 %672 None + OpBranch %673 + %673 = OpLabel + OpKill + %672 = OpLabel + OpBranch %670 + %671 = OpLabel + OpReturn + %668 = OpLabel + %674 = OpAccessChain %_ptr_Function_int %tree %644 %uint_1 + OpStore %674 %int_7 + %675 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %675 %676 + OpBranch %677 + %677 = OpLabel + OpLoopMerge %678 %679 None + OpBranch %680 + %680 = OpLabel + %681 = OpLoad %bool %x_409 + OpStore %x_456_phi %681 + %682 = OpConvertFToS %int %664 + %683 = OpSLessThan %bool %int_0 %682 + OpSelectionMerge %684 None + OpBranchConditional %683 %685 %686 + %685 = OpLabel + OpBranch %684 + %686 = OpLabel + OpBranch %678 + %684 = OpLabel + OpStore %x_456_phi %true + OpBranch %678 + %679 = OpLabel + OpBranch %677 + %678 = OpLabel + %687 = OpLoad %bool %x_456_phi + OpStore %x_456 %687 + %688 = OpLoad %bool %x_456 + OpStore %x_458_phi %688 + %689 = OpLoad %bool %x_456 + OpSelectionMerge %690 None + OpBranchConditional %689 %691 %690 + %691 = OpLabel + OpBranch %634 + %690 = OpLabel + OpBranch %660 + %662 = OpLabel + %692 = OpAccessChain %_ptr_Function_int %tree %644 %uint_1 + %693 = OpLoad %int %692 + OpStore %x_437 %693 + %694 = OpLoad %bool %x_409 + OpStore %x_410_phi %694 + %695 = OpLoad %int %x_437 + OpStore %x_413_phi %695 + OpBranch %635 + %660 = OpLabel + OpBranch %653 + %655 = OpLabel + %696 = OpAccessChain %_ptr_Function_int %tree %644 %uint_2 + %697 = OpLoad %int %696 + %698 = OpIEqual %bool %697 %int_n1 + OpSelectionMerge %699 None + OpBranchConditional %698 %700 %701 + %700 = OpLabel + %702 = OpAccessChain %_ptr_Function_int %tree %644 %uint_2 + OpStore %702 %int_7 + %703 = OpAccessChain %_ptr_Function_BST %tree %int_7 + OpStore %703 %676 + OpStore %x_458_phi %true + OpBranch %634 + %701 = OpLabel + %704 = OpAccessChain %_ptr_Function_int %tree %644 %uint_2 + %705 = OpLoad %int %704 + OpStore %x_429 %705 + %706 = OpLoad %bool %x_409 + OpStore %x_410_phi %706 + %707 = OpLoad %int %x_429 + OpStore %x_413_phi %707 + OpBranch %635 + %699 = OpLabel + OpReturn + %653 = OpLabel + %708 = OpLoad %bool %x_456 + OpStore %x_410_phi %708 + OpStore %x_413_phi %644 + OpBranch %635 + %635 = OpLabel + %709 = OpLoad %bool %x_410_phi + OpStore %x_410 %709 + %710 = OpLoad %int %x_413_phi + OpStore %x_413 %710 + %711 = OpLoad %bool %x_410 + OpStore %x_409_phi %711 + %712 = OpLoad %int %x_413 + OpStore %x_412_phi %712 + OpBranch %633 + %634 = OpLabel + %713 = OpLoad %bool %x_458_phi + OpSelectionMerge %714 None + OpBranchConditional %713 %715 %714 + %715 = OpLabel + OpBranch %631 + %714 = OpLabel + OpBranch %631 + %631 = OpLabel + OpSelectionMerge %721 None + OpSwitch %uint_0 %722 + %722 = OpLabel + OpStore %x_463_phi %false + OpStore %x_466_phi %int_0 + OpBranch %723 + %723 = OpLabel + OpLoopMerge %724 %725 None + OpBranch %726 + %726 = OpLabel + %733 = OpLoad %bool %x_463_phi + OpStore %x_463 %733 + %734 = OpLoad %int %x_466_phi + %735 = OpLoad %bool %x_463 + OpStore %x_512_phi %735 + %736 = OpSLessThanEqual %bool %734 %int_8 + OpSelectionMerge %737 None + OpBranchConditional %736 %738 %739 + %738 = OpLabel + OpBranch %737 + %739 = OpLabel + OpBranch %724 + %737 = OpLabel + %740 = OpAccessChain %_ptr_Function_int %tree %734 %uint_0 + %741 = OpLoad %int %740 + %743 = OpSLessThanEqual %bool %int_17 %741 + OpSelectionMerge %744 None + OpBranchConditional %743 %745 %746 + %745 = OpLabel + %748 = OpAccessChain %_ptr_Function_int %tree %734 %uint_1 + %749 = OpLoad %int %748 + %750 = OpIEqual %bool %749 %int_n1 + OpSelectionMerge %751 None + OpBranchConditional %750 %752 %753 + %752 = OpLabel + %754 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %755 = OpLoad %float %754 + %756 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %757 = OpLoad %float %756 + %758 = OpFOrdLessThan %bool %755 %757 + OpSelectionMerge %759 None + OpBranchConditional %758 %760 %759 + %760 = OpLabel + OpBranch %761 + %761 = OpLabel + OpLoopMerge %762 %763 None + OpBranch %764 + %764 = OpLabel + OpKill + %763 = OpLabel + OpBranch %761 + %762 = OpLabel + OpReturn + %759 = OpLabel + %765 = OpAccessChain %_ptr_Function_int %tree %734 %uint_1 + OpStore %765 %int_8 + %766 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %766 %767 + OpBranch %768 + %768 = OpLabel + OpLoopMerge %769 %770 None + OpBranch %771 + %771 = OpLabel + %772 = OpLoad %bool %x_463 + OpStore %x_510_phi %772 + %773 = OpConvertFToS %int %755 + %774 = OpSLessThan %bool %int_0 %773 + OpSelectionMerge %775 None + OpBranchConditional %774 %776 %777 + %776 = OpLabel + OpBranch %775 + %777 = OpLabel + OpBranch %769 + %775 = OpLabel + OpStore %x_510_phi %true + OpBranch %769 + %770 = OpLabel + OpBranch %768 + %769 = OpLabel + %778 = OpLoad %bool %x_510_phi + OpStore %x_510 %778 + %779 = OpLoad %bool %x_510 + OpStore %x_512_phi %779 + %780 = OpLoad %bool %x_510 + OpSelectionMerge %781 None + OpBranchConditional %780 %782 %781 + %782 = OpLabel + OpBranch %724 + %781 = OpLabel + OpBranch %751 + %753 = OpLabel + %783 = OpAccessChain %_ptr_Function_int %tree %734 %uint_1 + %784 = OpLoad %int %783 + OpStore %x_491 %784 + %785 = OpLoad %bool %x_463 + OpStore %x_464_phi %785 + %786 = OpLoad %int %x_491 + OpStore %x_467_phi %786 + OpBranch %725 + %751 = OpLabel + OpBranch %744 + %746 = OpLabel + %787 = OpAccessChain %_ptr_Function_int %tree %734 %uint_2 + %788 = OpLoad %int %787 + %789 = OpIEqual %bool %788 %int_n1 + OpSelectionMerge %790 None + OpBranchConditional %789 %791 %792 + %791 = OpLabel + %793 = OpAccessChain %_ptr_Function_int %tree %734 %uint_2 + OpStore %793 %int_8 + %794 = OpAccessChain %_ptr_Function_BST %tree %int_8 + OpStore %794 %767 + OpStore %x_512_phi %true + OpBranch %724 + %792 = OpLabel + %795 = OpAccessChain %_ptr_Function_int %tree %734 %uint_2 + %796 = OpLoad %int %795 + OpStore %x_483 %796 + %797 = OpLoad %bool %x_463 + OpStore %x_464_phi %797 + %798 = OpLoad %int %x_483 + OpStore %x_467_phi %798 + OpBranch %725 + %790 = OpLabel + OpReturn + %744 = OpLabel + %799 = OpLoad %bool %x_510 + OpStore %x_464_phi %799 + OpStore %x_467_phi %734 + OpBranch %725 + %725 = OpLabel + %800 = OpLoad %bool %x_464_phi + OpStore %x_464 %800 + %801 = OpLoad %int %x_467_phi + OpStore %x_467 %801 + %802 = OpLoad %bool %x_464 + OpStore %x_463_phi %802 + %803 = OpLoad %int %x_467 + OpStore %x_466_phi %803 + OpBranch %723 + %724 = OpLabel + %804 = OpLoad %bool %x_512_phi + OpSelectionMerge %805 None + OpBranchConditional %804 %806 %805 + %806 = OpLabel + OpBranch %721 + %805 = OpLabel + OpBranch %721 + %721 = OpLabel + OpSelectionMerge %812 None + OpSwitch %uint_0 %813 + %813 = OpLabel + OpStore %x_517_phi %false + OpStore %x_520_phi %int_0 + OpBranch %814 + %814 = OpLabel + OpLoopMerge %815 %816 None + OpBranch %817 + %817 = OpLabel + %824 = OpLoad %bool %x_517_phi + OpStore %x_517 %824 + %825 = OpLoad %int %x_520_phi + %826 = OpLoad %bool %x_517 + OpStore %x_566_phi %826 + %827 = OpSLessThanEqual %bool %825 %int_9 + OpSelectionMerge %828 None + OpBranchConditional %827 %829 %830 + %829 = OpLabel + OpBranch %828 + %830 = OpLabel + OpBranch %815 + %828 = OpLabel + %831 = OpAccessChain %_ptr_Function_int %tree %825 %uint_0 + %832 = OpLoad %int %831 + %834 = OpSLessThanEqual %bool %int_13 %832 + OpSelectionMerge %835 None + OpBranchConditional %834 %836 %837 + %836 = OpLabel + %839 = OpAccessChain %_ptr_Function_int %tree %825 %uint_1 + %840 = OpLoad %int %839 + %841 = OpIEqual %bool %840 %int_n1 + OpSelectionMerge %842 None + OpBranchConditional %841 %843 %844 + %843 = OpLabel + %845 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %846 = OpLoad %float %845 + %847 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %848 = OpLoad %float %847 + %849 = OpFOrdLessThan %bool %846 %848 + OpSelectionMerge %850 None + OpBranchConditional %849 %851 %850 + %851 = OpLabel + OpBranch %852 + %852 = OpLabel + OpLoopMerge %853 %854 None + OpBranch %855 + %855 = OpLabel + OpKill + %854 = OpLabel + OpBranch %852 + %853 = OpLabel + OpReturn + %850 = OpLabel + %856 = OpAccessChain %_ptr_Function_int %tree %825 %uint_1 + OpStore %856 %int_9 + %857 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %857 %858 + OpBranch %859 + %859 = OpLabel + OpLoopMerge %860 %861 None + OpBranch %862 + %862 = OpLabel + %863 = OpLoad %bool %x_517 + OpStore %x_564_phi %863 + %864 = OpConvertFToS %int %846 + %865 = OpSLessThan %bool %int_0 %864 + OpSelectionMerge %866 None + OpBranchConditional %865 %867 %868 + %867 = OpLabel + OpBranch %866 + %868 = OpLabel + OpBranch %860 + %866 = OpLabel + OpStore %x_564_phi %true + OpBranch %860 + %861 = OpLabel + OpBranch %859 + %860 = OpLabel + %869 = OpLoad %bool %x_564_phi + OpStore %x_564 %869 + %870 = OpLoad %bool %x_564 + OpStore %x_566_phi %870 + %871 = OpLoad %bool %x_564 + OpSelectionMerge %872 None + OpBranchConditional %871 %873 %872 + %873 = OpLabel + OpBranch %815 + %872 = OpLabel + OpBranch %842 + %844 = OpLabel + %874 = OpAccessChain %_ptr_Function_int %tree %825 %uint_1 + %875 = OpLoad %int %874 + OpStore %x_545 %875 + %876 = OpLoad %bool %x_517 + OpStore %x_518_phi %876 + %877 = OpLoad %int %x_545 + OpStore %x_521_phi %877 + OpBranch %816 + %842 = OpLabel + OpBranch %835 + %837 = OpLabel + %878 = OpAccessChain %_ptr_Function_int %tree %825 %uint_2 + %879 = OpLoad %int %878 + %880 = OpIEqual %bool %879 %int_n1 + OpSelectionMerge %881 None + OpBranchConditional %880 %882 %883 + %882 = OpLabel + %884 = OpAccessChain %_ptr_Function_int %tree %825 %uint_2 + OpStore %884 %int_9 + %885 = OpAccessChain %_ptr_Function_BST %tree %int_9 + OpStore %885 %858 + OpStore %x_566_phi %true + OpBranch %815 + %883 = OpLabel + %886 = OpAccessChain %_ptr_Function_int %tree %825 %uint_2 + %887 = OpLoad %int %886 + OpStore %x_537 %887 + %888 = OpLoad %bool %x_517 + OpStore %x_518_phi %888 + %889 = OpLoad %int %x_537 + OpStore %x_521_phi %889 + OpBranch %816 + %881 = OpLabel + OpReturn + %835 = OpLabel + %890 = OpLoad %bool %x_564 + OpStore %x_518_phi %890 + OpStore %x_521_phi %825 + OpBranch %816 + %816 = OpLabel + %891 = OpLoad %bool %x_518_phi + OpStore %x_518 %891 + %892 = OpLoad %int %x_521_phi + OpStore %x_521 %892 + %893 = OpLoad %bool %x_518 + OpStore %x_517_phi %893 + %894 = OpLoad %int %x_521 + OpStore %x_520_phi %894 + OpBranch %814 + %815 = OpLabel + %895 = OpLoad %bool %x_566_phi + OpSelectionMerge %896 None + OpBranchConditional %895 %897 %896 + %897 = OpLabel + OpBranch %812 + %896 = OpLabel + OpBranch %812 + %812 = OpLabel + OpStore %x_569_phi %int_0 + OpStore %x_572_phi %int_0 + OpStore %x_574_phi %int_0 + OpBranch %898 + %898 = OpLabel + OpLoopMerge %899 %900 None + OpBranch %901 + %901 = OpLabel + %908 = OpLoad %int %x_569_phi + %909 = OpLoad %int %x_572_phi + OpStore %x_572 %909 + %910 = OpLoad %int %x_574_phi + %912 = OpSLessThan %bool %910 %int_20 + OpSelectionMerge %913 None + OpBranchConditional %912 %914 %915 + %914 = OpLabel + OpBranch %913 + %915 = OpLabel + OpBranch %899 + %913 = OpLabel + OpSelectionMerge %919 None + OpSwitch %uint_0 %920 + %920 = OpLabel + OpStore %x_582_phi %int_0 + OpBranch %921 + %921 = OpLabel + OpLoopMerge %922 %923 None + OpBranch %924 + %924 = OpLabel + %925 = OpLoad %int %x_582_phi + OpStore %x_597_phi %908 + OpStore %x_598_phi %false + %926 = OpINotEqual %bool %925 %int_n1 + OpSelectionMerge %927 None + OpBranchConditional %926 %928 %929 + %928 = OpLabel + OpBranch %927 + %929 = OpLabel + OpBranch %922 + %927 = OpLabel + %930 = OpAccessChain %_ptr_Function_BST %tree %925 + %931 = OpLoad %BST %930 + %932 = OpCompositeExtract %int %931 0 + %933 = OpCompositeExtract %int %931 1 + %934 = OpCompositeExtract %int %931 2 + %935 = OpIEqual %bool %932 %910 + OpSelectionMerge %936 None + OpBranchConditional %935 %937 %936 + %937 = OpLabel + OpStore %x_597_phi %910 + OpStore %x_598_phi %true + OpBranch %922 + %936 = OpLabel + OpBranch %923 + %923 = OpLabel + %939 = OpSGreaterThan %bool %910 %932 + %938 = OpSelect %int %939 %934 %933 + OpStore %x_582_phi %938 + OpBranch %921 + %922 = OpLabel + %940 = OpLoad %int %x_597_phi + OpStore %x_597 %940 + %941 = OpLoad %bool %x_598_phi + %942 = OpLoad %int %x_597 + OpStore %x_570_phi %942 + OpSelectionMerge %943 None + OpBranchConditional %941 %944 %943 + %944 = OpLabel + OpBranch %919 + %943 = OpLabel + OpStore %x_570_phi %int_n1 + OpBranch %919 + %919 = OpLabel + %950 = OpLoad %int %x_570_phi + OpStore %x_570 %950 + OpSelectionMerge %951 None + OpSwitch %910 %952 2 %953 5 %953 6 %953 7 %953 8 %953 9 %953 12 %953 13 %953 15 %953 17 %953 + %953 = OpLabel + %954 = OpLoad %int %x_572 + OpStore %x_607_phi %954 + %955 = OpLoad %int %x_570 + %956 = OpCopyObject %int %910 + %957 = OpIEqual %bool %955 %956 + OpSelectionMerge %958 None + OpBranchConditional %957 %959 %958 + %959 = OpLabel + %961 = OpLoad %int %x_572 + %962 = OpCopyObject %int %int_1 + %963 = OpIAdd %int %961 %962 + %960 = OpCopyObject %int %963 + OpStore %x_606 %960 + %964 = OpLoad %int %x_606 + OpStore %x_607_phi %964 + OpBranch %958 + %958 = OpLabel + %965 = OpLoad %int %x_607_phi + OpStore %x_607 %965 + %966 = OpLoad %int %x_607 + OpStore %x_573_phi %966 + OpBranch %951 + %952 = OpLabel + %967 = OpLoad %int %x_572 + OpStore %x_612_phi %967 + %968 = OpLoad %int %x_570 + %969 = OpCopyObject %int %int_n1 + %970 = OpIEqual %bool %968 %969 + OpSelectionMerge %971 None + OpBranchConditional %970 %972 %971 + %972 = OpLabel + %974 = OpLoad %int %x_572 + %975 = OpCopyObject %int %int_1 + %976 = OpIAdd %int %974 %975 + %973 = OpCopyObject %int %976 + OpStore %x_611 %973 + %977 = OpLoad %int %x_611 + OpStore %x_612_phi %977 + OpBranch %971 + %971 = OpLabel + %978 = OpLoad %int %x_612_phi + OpStore %x_612 %978 + %979 = OpLoad %int %x_612 + OpStore %x_573_phi %979 + OpBranch %951 + %951 = OpLabel + %980 = OpLoad %int %x_573_phi + OpBranch %900 + %900 = OpLabel + %981 = OpIAdd %int %910 %int_1 + OpStore %x_575 %981 + %982 = OpLoad %int %x_570 + OpStore %x_569_phi %982 + OpStore %x_572_phi %980 + %983 = OpLoad %int %x_575 + OpStore %x_574_phi %983 + OpBranch %898 + %899 = OpLabel + %984 = OpLoad %int %x_572 + %985 = OpCopyObject %int %int_20 + %986 = OpIEqual %bool %984 %985 + OpSelectionMerge %987 None + OpBranchConditional %986 %988 %989 + %988 = OpLabel + OpStore %x_GLF_color %991 + OpBranch %987 + %989 = OpLabel + OpStore %x_GLF_color %992 + OpBranch %987 + %987 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %993 +%tint_symbol_1 = OpFunctionParameter %main_out + %997 = OpLabel + %998 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %998 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %1000 = OpLabel + %1001 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %1001 + %1002 = OpFunctionCall %void %main_1 + %1004 = OpLoad %v4float %x_GLF_color + %1005 = OpCompositeConstruct %main_out %1004 + %1003 = OpFunctionCall %void %tint_symbol_3 %1005 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4e135aa15 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.wgsl @@ -0,0 +1,977 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var tree : array; + var x_67 : bool; + var x_114 : bool; + var x_572 : i32; + var x_67_phi : bool; + var x_70_phi : i32; + var x_116_phi : bool; + var x_119_phi : i32; + var x_569_phi : i32; + var x_572_phi : i32; + var x_574_phi : i32; + tree[0] = BST(9, -1, -1); + switch(0u) { + default: { + x_67_phi = false; + x_70_phi = 0; + loop { + var x_95 : i32; + var x_87 : i32; + var x_68 : bool; + var x_71 : i32; + var x_68_phi : bool; + var x_71_phi : i32; + x_67 = x_67_phi; + let x_70 : i32 = x_70_phi; + x_116_phi = x_67; + if ((x_70 <= 1)) { + } else { + break; + } + let x_76 : i32 = tree[x_70].data; + if ((5 <= x_76)) { + var x_114_phi : bool; + let x_89 : ptr = &(tree[x_70].leftIndex); + let x_90 : i32 = *(x_89); + if ((x_90 == -1)) { + let x_97 : f32 = x_8.injectionSwitch.y; + let x_99 : f32 = x_8.injectionSwitch.x; + if ((x_97 < x_99)) { + loop { + discard; + } + return; + } + *(x_89) = 1; + tree[1] = BST(5, -1, -1); + loop { + x_114_phi = x_67; + if ((0 < i32(x_97))) { + } else { + break; + } + x_114_phi = true; + break; + } + x_114 = x_114_phi; + x_116_phi = x_114; + if (x_114) { + break; + } + } else { + x_95 = *(x_89); + x_68_phi = x_67; + x_71_phi = x_95; + continue; + } + } else { + let x_81 : ptr = &(tree[x_70].rightIndex); + let x_82 : i32 = *(x_81); + if ((x_82 == -1)) { + *(x_81) = 1; + tree[1] = BST(5, -1, -1); + x_116_phi = true; + break; + } else { + x_87 = *(x_81); + x_68_phi = x_67; + x_71_phi = x_87; + continue; + } + return; + } + x_68_phi = x_114; + x_71_phi = x_70; + + continuing { + x_68 = x_68_phi; + x_71 = x_71_phi; + x_67_phi = x_68; + x_70_phi = x_71; + } + } + let x_116 : bool = x_116_phi; + if (x_116) { + break; + } + } + } + x_119_phi = 0; + loop { + var x_133 : bool; + var x_120 : i32; + var x_134_phi : bool; + let x_119 : i32 = x_119_phi; + let x_125 : f32 = gl_FragCoord.y; + let x_126 : bool = (x_125 < 0.0); + x_134_phi = x_126; + if (!(x_126)) { + let x_131 : f32 = x_8.injectionSwitch.y; + x_133 = (x_119 != i32(x_131)); + x_134_phi = x_133; + } + let x_134 : bool = x_134_phi; + if (x_134) { + } else { + break; + } + var x_139 : bool; + var x_186 : bool; + var x_139_phi : bool; + var x_142_phi : i32; + var x_188_phi : bool; + switch(0u) { + default: { + x_139_phi = false; + x_142_phi = 0; + loop { + var x_167 : i32; + var x_159 : i32; + var x_140 : bool; + var x_143 : i32; + var x_140_phi : bool; + var x_143_phi : i32; + x_139 = x_139_phi; + let x_142 : i32 = x_142_phi; + x_188_phi = x_139; + if ((x_142 <= 2)) { + } else { + break; + } + let x_148 : i32 = tree[x_142].data; + if ((12 <= x_148)) { + var x_186_phi : bool; + let x_161 : ptr = &(tree[x_142].leftIndex); + let x_162 : i32 = *(x_161); + if ((x_162 == -1)) { + let x_169 : f32 = x_8.injectionSwitch.y; + let x_171 : f32 = x_8.injectionSwitch.x; + if ((x_169 < x_171)) { + loop { + discard; + } + return; + } + *(x_161) = 2; + tree[2] = BST(12, -1, -1); + loop { + x_186_phi = x_139; + if ((0 < i32(x_169))) { + } else { + break; + } + x_186_phi = true; + break; + } + x_186 = x_186_phi; + x_188_phi = x_186; + if (x_186) { + break; + } + } else { + x_167 = *(x_161); + x_140_phi = x_139; + x_143_phi = x_167; + continue; + } + } else { + let x_153 : ptr = &(tree[x_142].rightIndex); + let x_154 : i32 = *(x_153); + if ((x_154 == -1)) { + *(x_153) = 2; + tree[2] = BST(12, -1, -1); + x_188_phi = true; + break; + } else { + x_159 = *(x_153); + x_140_phi = x_139; + x_143_phi = x_159; + continue; + } + return; + } + x_140_phi = x_186; + x_143_phi = x_142; + + continuing { + x_140 = x_140_phi; + x_143 = x_143_phi; + x_139_phi = x_140; + x_142_phi = x_143; + } + } + let x_188 : bool = x_188_phi; + if (x_188) { + break; + } + } + } + + continuing { + x_120 = (x_119 + 1); + x_119_phi = x_120; + } + } + var x_193 : bool; + var x_240 : bool; + var x_193_phi : bool; + var x_196_phi : i32; + var x_242_phi : bool; + switch(0u) { + default: { + x_193_phi = false; + x_196_phi = 0; + loop { + var x_221 : i32; + var x_213 : i32; + var x_194 : bool; + var x_197 : i32; + var x_194_phi : bool; + var x_197_phi : i32; + x_193 = x_193_phi; + let x_196 : i32 = x_196_phi; + x_242_phi = x_193; + if ((x_196 <= 3)) { + } else { + break; + } + let x_202 : i32 = tree[x_196].data; + if ((15 <= x_202)) { + var x_240_phi : bool; + let x_215 : ptr = &(tree[x_196].leftIndex); + let x_216 : i32 = *(x_215); + if ((x_216 == -1)) { + let x_223 : f32 = x_8.injectionSwitch.y; + let x_225 : f32 = x_8.injectionSwitch.x; + if ((x_223 < x_225)) { + loop { + discard; + } + return; + } + *(x_215) = 3; + tree[3] = BST(15, -1, -1); + loop { + x_240_phi = x_193; + if ((0 < i32(x_223))) { + } else { + break; + } + x_240_phi = true; + break; + } + x_240 = x_240_phi; + x_242_phi = x_240; + if (x_240) { + break; + } + } else { + x_221 = *(x_215); + x_194_phi = x_193; + x_197_phi = x_221; + continue; + } + } else { + let x_207 : ptr = &(tree[x_196].rightIndex); + let x_208 : i32 = *(x_207); + if ((x_208 == -1)) { + *(x_207) = 3; + tree[3] = BST(15, -1, -1); + x_242_phi = true; + break; + } else { + x_213 = *(x_207); + x_194_phi = x_193; + x_197_phi = x_213; + continue; + } + return; + } + x_194_phi = x_240; + x_197_phi = x_196; + + continuing { + x_194 = x_194_phi; + x_197 = x_197_phi; + x_193_phi = x_194; + x_196_phi = x_197; + } + } + let x_242 : bool = x_242_phi; + if (x_242) { + break; + } + } + } + var x_247 : bool; + var x_294 : bool; + var x_247_phi : bool; + var x_250_phi : i32; + var x_296_phi : bool; + switch(0u) { + default: { + x_247_phi = false; + x_250_phi = 0; + loop { + var x_275 : i32; + var x_267 : i32; + var x_248 : bool; + var x_251 : i32; + var x_248_phi : bool; + var x_251_phi : i32; + x_247 = x_247_phi; + let x_250 : i32 = x_250_phi; + x_296_phi = x_247; + if ((x_250 <= 4)) { + } else { + break; + } + let x_256 : i32 = tree[x_250].data; + if ((7 <= x_256)) { + var x_294_phi : bool; + let x_269 : ptr = &(tree[x_250].leftIndex); + let x_270 : i32 = *(x_269); + if ((x_270 == -1)) { + let x_277 : f32 = x_8.injectionSwitch.y; + let x_279 : f32 = x_8.injectionSwitch.x; + if ((x_277 < x_279)) { + loop { + discard; + } + return; + } + *(x_269) = 4; + tree[4] = BST(7, -1, -1); + loop { + x_294_phi = x_247; + if ((0 < i32(x_277))) { + } else { + break; + } + x_294_phi = true; + break; + } + x_294 = x_294_phi; + x_296_phi = x_294; + if (x_294) { + break; + } + } else { + x_275 = *(x_269); + x_248_phi = x_247; + x_251_phi = x_275; + continue; + } + } else { + let x_261 : ptr = &(tree[x_250].rightIndex); + let x_262 : i32 = *(x_261); + if ((x_262 == -1)) { + *(x_261) = 4; + tree[4] = BST(7, -1, -1); + x_296_phi = true; + break; + } else { + x_267 = *(x_261); + x_248_phi = x_247; + x_251_phi = x_267; + continue; + } + return; + } + x_248_phi = x_294; + x_251_phi = x_250; + + continuing { + x_248 = x_248_phi; + x_251 = x_251_phi; + x_247_phi = x_248; + x_250_phi = x_251; + } + } + let x_296 : bool = x_296_phi; + if (x_296) { + break; + } + } + } + var x_301 : bool; + var x_348 : bool; + var x_301_phi : bool; + var x_304_phi : i32; + var x_350_phi : bool; + switch(0u) { + default: { + x_301_phi = false; + x_304_phi = 0; + loop { + var x_329 : i32; + var x_321 : i32; + var x_302 : bool; + var x_305 : i32; + var x_302_phi : bool; + var x_305_phi : i32; + x_301 = x_301_phi; + let x_304 : i32 = x_304_phi; + x_350_phi = x_301; + if ((x_304 <= 5)) { + } else { + break; + } + let x_310 : i32 = tree[x_304].data; + if ((8 <= x_310)) { + var x_348_phi : bool; + let x_323 : ptr = &(tree[x_304].leftIndex); + let x_324 : i32 = *(x_323); + if ((x_324 == -1)) { + let x_331 : f32 = x_8.injectionSwitch.y; + let x_333 : f32 = x_8.injectionSwitch.x; + if ((x_331 < x_333)) { + loop { + discard; + } + return; + } + *(x_323) = 5; + tree[5] = BST(8, -1, -1); + loop { + x_348_phi = x_301; + if ((0 < i32(x_331))) { + } else { + break; + } + x_348_phi = true; + break; + } + x_348 = x_348_phi; + x_350_phi = x_348; + if (x_348) { + break; + } + } else { + x_329 = *(x_323); + x_302_phi = x_301; + x_305_phi = x_329; + continue; + } + } else { + let x_315 : ptr = &(tree[x_304].rightIndex); + let x_316 : i32 = *(x_315); + if ((x_316 == -1)) { + *(x_315) = 5; + tree[5] = BST(8, -1, -1); + x_350_phi = true; + break; + } else { + x_321 = *(x_315); + x_302_phi = x_301; + x_305_phi = x_321; + continue; + } + return; + } + x_302_phi = x_348; + x_305_phi = x_304; + + continuing { + x_302 = x_302_phi; + x_305 = x_305_phi; + x_301_phi = x_302; + x_304_phi = x_305; + } + } + let x_350 : bool = x_350_phi; + if (x_350) { + break; + } + } + } + var x_355 : bool; + var x_402 : bool; + var x_355_phi : bool; + var x_358_phi : i32; + var x_404_phi : bool; + switch(0u) { + default: { + x_355_phi = false; + x_358_phi = 0; + loop { + var x_383 : i32; + var x_375 : i32; + var x_356 : bool; + var x_359 : i32; + var x_356_phi : bool; + var x_359_phi : i32; + x_355 = x_355_phi; + let x_358 : i32 = x_358_phi; + x_404_phi = x_355; + if ((x_358 <= 6)) { + } else { + break; + } + let x_364 : i32 = tree[x_358].data; + if ((2 <= x_364)) { + var x_402_phi : bool; + let x_377 : ptr = &(tree[x_358].leftIndex); + let x_378 : i32 = *(x_377); + if ((x_378 == -1)) { + let x_385 : f32 = x_8.injectionSwitch.y; + let x_387 : f32 = x_8.injectionSwitch.x; + if ((x_385 < x_387)) { + loop { + discard; + } + return; + } + *(x_377) = 6; + tree[6] = BST(2, -1, -1); + loop { + x_402_phi = x_355; + if ((0 < i32(x_385))) { + } else { + break; + } + x_402_phi = true; + break; + } + x_402 = x_402_phi; + x_404_phi = x_402; + if (x_402) { + break; + } + } else { + x_383 = *(x_377); + x_356_phi = x_355; + x_359_phi = x_383; + continue; + } + } else { + let x_369 : ptr = &(tree[x_358].rightIndex); + let x_370 : i32 = *(x_369); + if ((x_370 == -1)) { + *(x_369) = 6; + tree[6] = BST(2, -1, -1); + x_404_phi = true; + break; + } else { + x_375 = *(x_369); + x_356_phi = x_355; + x_359_phi = x_375; + continue; + } + return; + } + x_356_phi = x_402; + x_359_phi = x_358; + + continuing { + x_356 = x_356_phi; + x_359 = x_359_phi; + x_355_phi = x_356; + x_358_phi = x_359; + } + } + let x_404 : bool = x_404_phi; + if (x_404) { + break; + } + } + } + var x_409 : bool; + var x_456 : bool; + var x_409_phi : bool; + var x_412_phi : i32; + var x_458_phi : bool; + switch(0u) { + default: { + x_409_phi = false; + x_412_phi = 0; + loop { + var x_437 : i32; + var x_429 : i32; + var x_410 : bool; + var x_413 : i32; + var x_410_phi : bool; + var x_413_phi : i32; + x_409 = x_409_phi; + let x_412 : i32 = x_412_phi; + x_458_phi = x_409; + if ((x_412 <= 7)) { + } else { + break; + } + let x_418 : i32 = tree[x_412].data; + if ((6 <= x_418)) { + var x_456_phi : bool; + let x_431 : ptr = &(tree[x_412].leftIndex); + let x_432 : i32 = *(x_431); + if ((x_432 == -1)) { + let x_439 : f32 = x_8.injectionSwitch.y; + let x_441 : f32 = x_8.injectionSwitch.x; + if ((x_439 < x_441)) { + loop { + discard; + } + return; + } + *(x_431) = 7; + tree[7] = BST(6, -1, -1); + loop { + x_456_phi = x_409; + if ((0 < i32(x_439))) { + } else { + break; + } + x_456_phi = true; + break; + } + x_456 = x_456_phi; + x_458_phi = x_456; + if (x_456) { + break; + } + } else { + x_437 = *(x_431); + x_410_phi = x_409; + x_413_phi = x_437; + continue; + } + } else { + let x_423 : ptr = &(tree[x_412].rightIndex); + let x_424 : i32 = *(x_423); + if ((x_424 == -1)) { + *(x_423) = 7; + tree[7] = BST(6, -1, -1); + x_458_phi = true; + break; + } else { + x_429 = *(x_423); + x_410_phi = x_409; + x_413_phi = x_429; + continue; + } + return; + } + x_410_phi = x_456; + x_413_phi = x_412; + + continuing { + x_410 = x_410_phi; + x_413 = x_413_phi; + x_409_phi = x_410; + x_412_phi = x_413; + } + } + let x_458 : bool = x_458_phi; + if (x_458) { + break; + } + } + } + var x_463 : bool; + var x_510 : bool; + var x_463_phi : bool; + var x_466_phi : i32; + var x_512_phi : bool; + switch(0u) { + default: { + x_463_phi = false; + x_466_phi = 0; + loop { + var x_491 : i32; + var x_483 : i32; + var x_464 : bool; + var x_467 : i32; + var x_464_phi : bool; + var x_467_phi : i32; + x_463 = x_463_phi; + let x_466 : i32 = x_466_phi; + x_512_phi = x_463; + if ((x_466 <= 8)) { + } else { + break; + } + let x_472 : i32 = tree[x_466].data; + if ((17 <= x_472)) { + var x_510_phi : bool; + let x_485 : ptr = &(tree[x_466].leftIndex); + let x_486 : i32 = *(x_485); + if ((x_486 == -1)) { + let x_493 : f32 = x_8.injectionSwitch.y; + let x_495 : f32 = x_8.injectionSwitch.x; + if ((x_493 < x_495)) { + loop { + discard; + } + return; + } + *(x_485) = 8; + tree[8] = BST(17, -1, -1); + loop { + x_510_phi = x_463; + if ((0 < i32(x_493))) { + } else { + break; + } + x_510_phi = true; + break; + } + x_510 = x_510_phi; + x_512_phi = x_510; + if (x_510) { + break; + } + } else { + x_491 = *(x_485); + x_464_phi = x_463; + x_467_phi = x_491; + continue; + } + } else { + let x_477 : ptr = &(tree[x_466].rightIndex); + let x_478 : i32 = *(x_477); + if ((x_478 == -1)) { + *(x_477) = 8; + tree[8] = BST(17, -1, -1); + x_512_phi = true; + break; + } else { + x_483 = *(x_477); + x_464_phi = x_463; + x_467_phi = x_483; + continue; + } + return; + } + x_464_phi = x_510; + x_467_phi = x_466; + + continuing { + x_464 = x_464_phi; + x_467 = x_467_phi; + x_463_phi = x_464; + x_466_phi = x_467; + } + } + let x_512 : bool = x_512_phi; + if (x_512) { + break; + } + } + } + var x_517 : bool; + var x_564 : bool; + var x_517_phi : bool; + var x_520_phi : i32; + var x_566_phi : bool; + switch(0u) { + default: { + x_517_phi = false; + x_520_phi = 0; + loop { + var x_545 : i32; + var x_537 : i32; + var x_518 : bool; + var x_521 : i32; + var x_518_phi : bool; + var x_521_phi : i32; + x_517 = x_517_phi; + let x_520 : i32 = x_520_phi; + x_566_phi = x_517; + if ((x_520 <= 9)) { + } else { + break; + } + let x_526 : i32 = tree[x_520].data; + if ((13 <= x_526)) { + var x_564_phi : bool; + let x_539 : ptr = &(tree[x_520].leftIndex); + let x_540 : i32 = *(x_539); + if ((x_540 == -1)) { + let x_547 : f32 = x_8.injectionSwitch.y; + let x_549 : f32 = x_8.injectionSwitch.x; + if ((x_547 < x_549)) { + loop { + discard; + } + return; + } + *(x_539) = 9; + tree[9] = BST(13, -1, -1); + loop { + x_564_phi = x_517; + if ((0 < i32(x_547))) { + } else { + break; + } + x_564_phi = true; + break; + } + x_564 = x_564_phi; + x_566_phi = x_564; + if (x_564) { + break; + } + } else { + x_545 = *(x_539); + x_518_phi = x_517; + x_521_phi = x_545; + continue; + } + } else { + let x_531 : ptr = &(tree[x_520].rightIndex); + let x_532 : i32 = *(x_531); + if ((x_532 == -1)) { + *(x_531) = 9; + tree[9] = BST(13, -1, -1); + x_566_phi = true; + break; + } else { + x_537 = *(x_531); + x_518_phi = x_517; + x_521_phi = x_537; + continue; + } + return; + } + x_518_phi = x_564; + x_521_phi = x_520; + + continuing { + x_518 = x_518_phi; + x_521 = x_521_phi; + x_517_phi = x_518; + x_520_phi = x_521; + } + } + let x_566 : bool = x_566_phi; + if (x_566) { + break; + } + } + } + x_569_phi = 0; + x_572_phi = 0; + x_574_phi = 0; + loop { + var x_597 : i32; + var x_607 : i32; + var x_612 : i32; + var x_575 : i32; + var x_570_phi : i32; + var x_573_phi : i32; + let x_569 : i32 = x_569_phi; + x_572 = x_572_phi; + let x_574 : i32 = x_574_phi; + if ((x_574 < 20)) { + } else { + break; + } + var x_582_phi : i32; + var x_597_phi : i32; + var x_598_phi : bool; + switch(0u) { + default: { + x_582_phi = 0; + loop { + let x_582 : i32 = x_582_phi; + x_597_phi = x_569; + x_598_phi = false; + if ((x_582 != -1)) { + } else { + break; + } + let x_589 : BST = tree[x_582]; + let x_590 : i32 = x_589.data; + let x_591 : i32 = x_589.leftIndex; + let x_592 : i32 = x_589.rightIndex; + if ((x_590 == x_574)) { + x_597_phi = x_574; + x_598_phi = true; + break; + } + + continuing { + x_582_phi = select(x_591, x_592, (x_574 > x_590)); + } + } + x_597 = x_597_phi; + let x_598 : bool = x_598_phi; + x_570_phi = x_597; + if (x_598) { + break; + } + x_570_phi = -1; + } + } + var x_570 : i32; + var x_606 : i32; + var x_611 : i32; + var x_607_phi : i32; + var x_612_phi : i32; + x_570 = x_570_phi; + switch(x_574) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + x_607_phi = x_572; + if ((x_570 == bitcast(x_574))) { + x_606 = bitcast((x_572 + bitcast(1))); + x_607_phi = x_606; + } + x_607 = x_607_phi; + x_573_phi = x_607; + } + default: { + x_612_phi = x_572; + if ((x_570 == bitcast(-1))) { + x_611 = bitcast((x_572 + bitcast(1))); + x_612_phi = x_611; + } + x_612 = x_612_phi; + x_573_phi = x_612; + } + } + let x_573 : i32 = x_573_phi; + + continuing { + x_575 = (x_574 + 1); + x_569_phi = x_570; + x_572_phi = x_573; + x_574_phi = x_575; + } + } + if ((x_572 == bitcast(20))) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm new file mode 100644 index 0000000000..bcde2cd502 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm @@ -0,0 +1,420 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode(struct-BST-i1-i1-i11;i1;" + OpName %tree "tree" + OpName %data "data" + OpName %insert_i1_i1_ "insert(i1;i1;" + OpName %treeIndex "treeIndex" + OpName %data_0 "data" + OpName %search_i1_ "search(i1;" + OpName %target "target" + OpName %baseIndex "baseIndex" + OpName %tree_0 "tree" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %treeIndex_0 "treeIndex" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %param_5 "param" + OpName %param_6 "param" + OpName %param_7 "param" + OpName %param_8 "param" + OpName %param_9 "param" + OpName %param_10 "param" + OpName %param_11 "param" + OpName %param_12 "param" + OpName %param_13 "param" + OpName %param_14 "param" + OpName %param_15 "param" + OpName %param_16 "param" + OpName %param_17 "param" + OpName %param_18 "param" + OpName %param_19 "param" + OpName %param_20 "param" + OpName %param_21 "param" + OpName %param_22 "param" + OpName %count "count" + OpName %i "i" + OpName %result "result" + OpName %param_23 "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %47 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %51 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %52 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %53 = OpTypeFunction %int %_ptr_Function_int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %tree_0 = OpVariable %_ptr_Private__arr_BST_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %80 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %81 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main = OpFunction %void None %47 + %82 = OpLabel +%treeIndex_0 = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_BST Function + %param_4 = OpVariable %_ptr_Function_int Function + %param_5 = OpVariable %_ptr_Function_int Function + %param_6 = OpVariable %_ptr_Function_int Function + %param_7 = OpVariable %_ptr_Function_int Function + %param_8 = OpVariable %_ptr_Function_int Function + %param_9 = OpVariable %_ptr_Function_int Function + %param_10 = OpVariable %_ptr_Function_int Function + %param_11 = OpVariable %_ptr_Function_int Function + %param_12 = OpVariable %_ptr_Function_int Function + %param_13 = OpVariable %_ptr_Function_int Function + %param_14 = OpVariable %_ptr_Function_int Function + %param_15 = OpVariable %_ptr_Function_int Function + %param_16 = OpVariable %_ptr_Function_int Function + %param_17 = OpVariable %_ptr_Function_int Function + %param_18 = OpVariable %_ptr_Function_int Function + %param_19 = OpVariable %_ptr_Function_int Function + %param_20 = OpVariable %_ptr_Function_int Function + %param_21 = OpVariable %_ptr_Function_int Function + %param_22 = OpVariable %_ptr_Function_int Function + %count = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %result = OpVariable %_ptr_Function_int Function + %param_23 = OpVariable %_ptr_Function_int Function + OpStore %treeIndex_0 %int_0 + %83 = OpAccessChain %_ptr_Private_BST %tree_0 %int_0 + %84 = OpLoad %BST %83 + OpStore %param_3 %84 + OpStore %param_4 %int_9 + %85 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_3 %param_4 + %86 = OpLoad %BST %param_3 + %87 = OpAccessChain %_ptr_Private_BST %tree_0 %int_0 + OpStore %87 %86 + %88 = OpLoad %int %treeIndex_0 + %89 = OpIAdd %int %88 %int_1 + OpStore %treeIndex_0 %89 + %90 = OpLoad %int %treeIndex_0 + OpStore %param_5 %90 + OpStore %param_6 %int_5 + %91 = OpFunctionCall %void %insert_i1_i1_ %param_5 %param_6 + %92 = OpLoad %int %treeIndex_0 + %93 = OpIAdd %int %92 %int_1 + OpStore %treeIndex_0 %93 + %94 = OpLoad %int %treeIndex_0 + OpStore %param_7 %94 + OpStore %param_8 %int_12 + %95 = OpFunctionCall %void %insert_i1_i1_ %param_7 %param_8 + %96 = OpLoad %int %treeIndex_0 + %97 = OpIAdd %int %96 %int_1 + OpStore %treeIndex_0 %97 + %98 = OpLoad %int %treeIndex_0 + OpStore %param_9 %98 + OpStore %param_10 %int_15 + %99 = OpFunctionCall %void %insert_i1_i1_ %param_9 %param_10 + %100 = OpLoad %int %treeIndex_0 + %101 = OpIAdd %int %100 %int_1 + OpStore %treeIndex_0 %101 + %102 = OpLoad %int %treeIndex_0 + OpStore %param_11 %102 + OpStore %param_12 %int_7 + %103 = OpFunctionCall %void %insert_i1_i1_ %param_11 %param_12 + %104 = OpLoad %int %treeIndex_0 + %105 = OpIAdd %int %104 %int_1 + OpStore %treeIndex_0 %105 + %106 = OpLoad %int %treeIndex_0 + OpStore %param_13 %106 + OpStore %param_14 %int_8 + %107 = OpFunctionCall %void %insert_i1_i1_ %param_13 %param_14 + %108 = OpLoad %int %treeIndex_0 + %109 = OpIAdd %int %108 %int_1 + OpStore %treeIndex_0 %109 + %110 = OpLoad %int %treeIndex_0 + OpStore %param_15 %110 + OpStore %param_16 %int_2 + %111 = OpFunctionCall %void %insert_i1_i1_ %param_15 %param_16 + %112 = OpLoad %int %treeIndex_0 + %113 = OpIAdd %int %112 %int_1 + OpStore %treeIndex_0 %113 + %114 = OpLoad %int %treeIndex_0 + OpStore %param_17 %114 + OpStore %param_18 %int_6 + %115 = OpFunctionCall %void %insert_i1_i1_ %param_17 %param_18 + %116 = OpLoad %int %treeIndex_0 + %117 = OpIAdd %int %116 %int_1 + OpStore %treeIndex_0 %117 + %118 = OpLoad %int %treeIndex_0 + OpStore %param_19 %118 + OpStore %param_20 %int_17 + %119 = OpFunctionCall %void %insert_i1_i1_ %param_19 %param_20 + %120 = OpLoad %int %treeIndex_0 + %121 = OpIAdd %int %120 %int_1 + OpStore %treeIndex_0 %121 + %122 = OpLoad %int %treeIndex_0 + OpStore %param_21 %122 + OpStore %param_22 %int_13 + %123 = OpFunctionCall %void %insert_i1_i1_ %param_21 %param_22 + OpStore %count %int_0 + OpStore %i %int_0 + OpBranch %124 + %124 = OpLabel + OpLoopMerge %125 %126 None + OpBranch %127 + %127 = OpLabel + %128 = OpLoad %int %i + %129 = OpSLessThan %bool %128 %int_20 + OpBranchConditional %129 %130 %125 + %130 = OpLabel + %131 = OpLoad %int %i + OpStore %param_23 %131 + %132 = OpFunctionCall %int %search_i1_ %param_23 + OpStore %result %132 + %133 = OpLoad %int %i + OpSelectionMerge %134 None + OpSwitch %133 %135 9 %136 5 %136 12 %136 15 %136 7 %136 8 %136 2 %136 6 %136 17 %136 13 %136 + %135 = OpLabel + %137 = OpLoad %int %result + %138 = OpIEqual %bool %137 %int_n1 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpLoad %int %count + %142 = OpIAdd %int %141 %int_1 + OpStore %count %142 + OpBranch %139 + %139 = OpLabel + OpBranch %134 + %136 = OpLabel + %143 = OpLoad %int %result + %144 = OpLoad %int %i + %145 = OpIEqual %bool %143 %144 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %148 = OpLoad %int %count + %149 = OpIAdd %int %148 %int_1 + OpStore %count %149 + OpBranch %146 + %146 = OpLabel + OpBranch %134 + %134 = OpLabel + OpBranch %126 + %126 = OpLabel + %150 = OpLoad %int %i + %151 = OpIAdd %int %150 %int_1 + OpStore %i %151 + OpBranch %124 + %125 = OpLabel + %152 = OpLoad %int %count + %153 = OpIEqual %bool %152 %int_20 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + OpStore %_GLF_color %80 + OpBranch %154 + %156 = OpLabel + OpStore %_GLF_color %81 + OpBranch %154 + %154 = OpLabel + OpReturn + OpFunctionEnd +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %51 + %tree = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %157 = OpLabel + %158 = OpLoad %int %data + %159 = OpAccessChain %_ptr_Function_int %tree %int_0 + OpStore %159 %158 + %160 = OpAccessChain %_ptr_Function_int %tree %int_1 + OpStore %160 %int_n1 + %161 = OpAccessChain %_ptr_Function_int %tree %int_2 + OpStore %161 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %52 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_0 = OpFunctionParameter %_ptr_Function_int + %162 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_BST Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_BST Function + %param_2 = OpVariable %_ptr_Function_int Function + OpStore %baseIndex %int_0 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %164 %165 None + OpBranch %166 + %166 = OpLabel + %167 = OpLoad %int %baseIndex + %168 = OpLoad %int %treeIndex + %169 = OpSLessThanEqual %bool %167 %168 + OpBranchConditional %169 %170 %164 + %170 = OpLabel + %171 = OpLoad %int %data_0 + %172 = OpLoad %int %baseIndex + %173 = OpAccessChain %_ptr_Private_int %tree_0 %172 %int_0 + %174 = OpLoad %int %173 + %175 = OpSLessThanEqual %bool %171 %174 + OpSelectionMerge %176 None + OpBranchConditional %175 %177 %178 + %177 = OpLabel + %179 = OpLoad %int %baseIndex + %180 = OpAccessChain %_ptr_Private_int %tree_0 %179 %int_1 + %181 = OpLoad %int %180 + %182 = OpIEqual %bool %181 %int_n1 + OpSelectionMerge %183 None + OpBranchConditional %182 %184 %185 + %184 = OpLabel + %186 = OpLoad %int %baseIndex + %187 = OpLoad %int %treeIndex + %188 = OpAccessChain %_ptr_Private_int %tree_0 %186 %int_1 + OpStore %188 %187 + %189 = OpLoad %int %treeIndex + %190 = OpAccessChain %_ptr_Private_BST %tree_0 %189 + %191 = OpLoad %BST %190 + OpStore %param %191 + %192 = OpLoad %int %data_0 + OpStore %param_0 %192 + %193 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_0 + %194 = OpLoad %BST %param + %195 = OpAccessChain %_ptr_Private_BST %tree_0 %189 + OpStore %195 %194 + OpReturn + %185 = OpLabel + %196 = OpLoad %int %baseIndex + %197 = OpAccessChain %_ptr_Private_int %tree_0 %196 %int_1 + %198 = OpLoad %int %197 + OpStore %baseIndex %198 + OpBranch %165 + %183 = OpLabel + OpUnreachable + %178 = OpLabel + %199 = OpLoad %int %baseIndex + %200 = OpAccessChain %_ptr_Private_int %tree_0 %199 %int_2 + %201 = OpLoad %int %200 + %202 = OpIEqual %bool %201 %int_n1 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %205 + %204 = OpLabel + %206 = OpLoad %int %baseIndex + %207 = OpLoad %int %treeIndex + %208 = OpAccessChain %_ptr_Private_int %tree_0 %206 %int_2 + OpStore %208 %207 + %209 = OpLoad %int %treeIndex + %210 = OpAccessChain %_ptr_Private_BST %tree_0 %209 + %211 = OpLoad %BST %210 + OpStore %param_1 %211 + %212 = OpLoad %int %data_0 + OpStore %param_2 %212 + %213 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_1 %param_2 + %214 = OpLoad %BST %param_1 + %215 = OpAccessChain %_ptr_Private_BST %tree_0 %209 + OpStore %215 %214 + OpReturn + %205 = OpLabel + %216 = OpLoad %int %baseIndex + %217 = OpAccessChain %_ptr_Private_int %tree_0 %216 %int_2 + %218 = OpLoad %int %217 + OpStore %baseIndex %218 + OpBranch %165 + %203 = OpLabel + OpUnreachable + %176 = OpLabel + OpUnreachable + %165 = OpLabel + OpBranch %163 + %164 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %53 + %target = OpFunctionParameter %_ptr_Function_int + %219 = OpLabel + %index = OpVariable %_ptr_Function_int Function +%currentNode = OpVariable %_ptr_Function_BST Function + %220 = OpVariable %_ptr_Function_int Function + OpStore %index %int_0 + OpBranch %221 + %221 = OpLabel + OpLoopMerge %222 %223 None + OpBranch %224 + %224 = OpLabel + %225 = OpLoad %int %index + %226 = OpINotEqual %bool %225 %int_n1 + OpBranchConditional %226 %227 %222 + %227 = OpLabel + %228 = OpLoad %int %index + %229 = OpAccessChain %_ptr_Private_BST %tree_0 %228 + %230 = OpLoad %BST %229 + OpStore %currentNode %230 + %231 = OpAccessChain %_ptr_Function_int %currentNode %int_0 + %232 = OpLoad %int %231 + %233 = OpLoad %int %target + %234 = OpIEqual %bool %232 %233 + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %235 + %236 = OpLabel + %237 = OpLoad %int %target + OpReturnValue %237 + %235 = OpLabel + %238 = OpLoad %int %target + %239 = OpAccessChain %_ptr_Function_int %currentNode %int_0 + %240 = OpLoad %int %239 + %241 = OpSGreaterThan %bool %238 %240 + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %244 + %243 = OpLabel + %245 = OpAccessChain %_ptr_Function_int %currentNode %int_2 + %246 = OpLoad %int %245 + OpStore %220 %246 + OpBranch %242 + %244 = OpLabel + %247 = OpAccessChain %_ptr_Function_int %currentNode %int_1 + %248 = OpLoad %int %247 + OpStore %220 %248 + OpBranch %242 + %242 = OpLabel + %249 = OpLoad %int %220 + OpStore %index %249 + OpBranch %223 + %223 = OpLabel + OpBranch %221 + %222 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..bc5fdac8f1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.hlsl @@ -0,0 +1,232 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree_1[10] = (BST[10])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_158 = data; + tree.data = x_158; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + while (true) { + const int x_167 = baseIndex; + const int x_168 = treeIndex; + if ((x_167 <= x_168)) { + } else { + break; + } + const int x_171 = data_1; + const int x_174 = tree_1[baseIndex].data; + if ((x_171 <= x_174)) { + const int x_181 = tree_1[baseIndex].leftIndex; + if ((x_181 == -1)) { + const int x_186 = baseIndex; + const int x_187 = treeIndex; + tree_1[x_186].leftIndex = x_187; + const int x_189 = treeIndex; + const BST x_191 = tree_1[x_189]; + param = x_191; + const int x_192 = data_1; + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_189] = param; + return; + } else { + const int x_198 = tree_1[baseIndex].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + const int x_201 = tree_1[baseIndex].rightIndex; + if ((x_201 == -1)) { + const int x_206 = baseIndex; + const int x_207 = treeIndex; + tree_1[x_206].rightIndex = x_207; + const int x_209 = treeIndex; + const BST x_211 = tree_1[x_209]; + param_2 = x_211; + const int x_212 = data_1; + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_209] = param_2; + return; + } else { + const int x_218 = tree_1[baseIndex].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_220 = 0; + index = 0; + while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_230 = tree_1[index]; + currentNode = x_230; + const int x_232 = currentNode.data; + const int x_233 = target; + if ((x_232 == x_233)) { + const int x_237 = target; + return x_237; + } + const int x_238 = target; + const int x_240 = currentNode.data; + if ((x_238 > x_240)) { + const int x_246 = currentNode.rightIndex; + x_220 = x_246; + } else { + const int x_248 = currentNode.leftIndex; + x_220 = x_248; + } + index = x_220; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_84 = tree_1[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree_1[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + for(; (i < 20); i = (i + 1)) { + param_24 = i; + const int x_132 = search_i1_(param_24); + result = x_132; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.msl new file mode 100644 index 0000000000..f509724732 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.msl @@ -0,0 +1,281 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const tree, thread int* const data) { + int const x_158 = *(data); + (*(tree)).data = x_158; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_4) { + int baseIndex = 0; + BST param = {}; + int param_1 = 0; + BST param_2 = {}; + int param_3 = 0; + baseIndex = 0; + while (true) { + int const x_167 = baseIndex; + int const x_168 = *(treeIndex); + if ((x_167 <= x_168)) { + } else { + break; + } + int const x_171 = *(data_1); + int const x_172 = baseIndex; + int const x_174 = (*(tint_symbol_4)).arr[x_172].data; + if ((x_171 <= x_174)) { + int const x_179 = baseIndex; + int const x_181 = (*(tint_symbol_4)).arr[x_179].leftIndex; + if ((x_181 == -1)) { + int const x_186 = baseIndex; + int const x_187 = *(treeIndex); + (*(tint_symbol_4)).arr[x_186].leftIndex = x_187; + int const x_189 = *(treeIndex); + BST const x_191 = (*(tint_symbol_4)).arr[x_189]; + param = x_191; + int const x_192 = *(data_1); + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + BST const x_194 = param; + (*(tint_symbol_4)).arr[x_189] = x_194; + return; + } else { + int const x_196 = baseIndex; + int const x_198 = (*(tint_symbol_4)).arr[x_196].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + int const x_199 = baseIndex; + int const x_201 = (*(tint_symbol_4)).arr[x_199].rightIndex; + if ((x_201 == -1)) { + int const x_206 = baseIndex; + int const x_207 = *(treeIndex); + (*(tint_symbol_4)).arr[x_206].rightIndex = x_207; + int const x_209 = *(treeIndex); + BST const x_211 = (*(tint_symbol_4)).arr[x_209]; + param_2 = x_211; + int const x_212 = *(data_1); + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + BST const x_214 = param_2; + (*(tint_symbol_4)).arr[x_209] = x_214; + return; + } else { + int const x_216 = baseIndex; + int const x_218 = (*(tint_symbol_4)).arr[x_216].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_5) { + int index = 0; + BST currentNode = {}; + int x_220 = 0; + index = 0; + while (true) { + int const x_225 = index; + if ((x_225 != -1)) { + } else { + break; + } + int const x_228 = index; + BST const x_230 = (*(tint_symbol_5)).arr[x_228]; + currentNode = x_230; + int const x_232 = currentNode.data; + int const x_233 = *(target); + if ((x_232 == x_233)) { + int const x_237 = *(target); + return x_237; + } + int const x_238 = *(target); + int const x_240 = currentNode.data; + if ((x_238 > x_240)) { + int const x_246 = currentNode.rightIndex; + x_220 = x_246; + } else { + int const x_248 = currentNode.leftIndex; + x_220 = x_248; + } + int const x_249 = x_220; + index = x_249; + } + return -1; +} + +void main_1(thread tint_array_wrapper* const tint_symbol_6, thread float4* const tint_symbol_7) { + int treeIndex_1 = 0; + BST param_4 = {}; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + BST const x_84 = (*(tint_symbol_6)).arr[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + BST const x_86 = param_4; + (*(tint_symbol_6)).arr[0] = x_86; + int const x_88 = treeIndex_1; + treeIndex_1 = (x_88 + 1); + int const x_90 = treeIndex_1; + param_6 = x_90; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7), tint_symbol_6); + int const x_92 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + int const x_94 = treeIndex_1; + param_8 = x_94; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9), tint_symbol_6); + int const x_96 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + int const x_98 = treeIndex_1; + param_10 = x_98; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11), tint_symbol_6); + int const x_100 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + int const x_102 = treeIndex_1; + param_12 = x_102; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13), tint_symbol_6); + int const x_104 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + int const x_106 = treeIndex_1; + param_14 = x_106; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15), tint_symbol_6); + int const x_108 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + int const x_110 = treeIndex_1; + param_16 = x_110; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17), tint_symbol_6); + int const x_112 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + int const x_114 = treeIndex_1; + param_18 = x_114; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19), tint_symbol_6); + int const x_116 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + int const x_118 = treeIndex_1; + param_20 = x_118; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21), tint_symbol_6); + int const x_120 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + int const x_122 = treeIndex_1; + param_22 = x_122; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23), tint_symbol_6); + count = 0; + i = 0; + while (true) { + int const x_128 = i; + if ((x_128 < 20)) { + } else { + break; + } + int const x_131 = i; + param_24 = x_131; + int const x_132 = search_i1_(&(param_24), tint_symbol_6); + result = x_132; + int const x_133 = i; + switch(x_133) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + int const x_143 = result; + int const x_144 = i; + if ((x_143 == x_144)) { + int const x_148 = count; + count = (x_148 + 1); + } + break; + } + default: { + int const x_137 = result; + if ((x_137 == -1)) { + int const x_141 = count; + count = (x_141 + 1); + } + break; + } + } + { + int const x_150 = i; + i = (x_150 + 1); + } + } + int const x_152 = count; + if ((x_152 == 20)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread tint_array_wrapper tint_symbol_8 = {}; + thread float4 tint_symbol_9 = 0.0f; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..3d85c3b788 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.spvasm @@ -0,0 +1,476 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 316 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree_1 "tree_1" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode_struct_BST_i1_i1_i11_i1_" + OpName %tree "tree" + OpName %data "data" + OpName %insert_i1_i1_ "insert_i1_i1_" + OpName %treeIndex "treeIndex" + OpName %data_1 "data_1" + OpName %baseIndex "baseIndex" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %search_i1_ "search_i1_" + OpName %target "target" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %x_220 "x_220" + OpName %main_1 "main_1" + OpName %treeIndex_1 "treeIndex_1" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %param_10 "param_10" + OpName %param_11 "param_11" + OpName %param_12 "param_12" + OpName %param_13 "param_13" + OpName %param_14 "param_14" + OpName %param_15 "param_15" + OpName %param_16 "param_16" + OpName %param_17 "param_17" + OpName %param_18 "param_18" + OpName %param_19 "param_19" + OpName %param_20 "param_20" + OpName %param_21 "param_21" + OpName %param_22 "param_22" + OpName %param_23 "param_23" + OpName %count "count" + OpName %i "i" + OpName %result "result" + OpName %param_24 "param_24" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %8 = OpConstantNull %_arr_BST_uint_10 + %tree_1 = OpVariable %_ptr_Private__arr_BST_uint_10 Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %16 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int_n1 = OpConstant %int -1 + %uint_2 = OpConstant %uint 2 + %36 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %42 = OpConstantNull %int + %44 = OpConstantNull %BST + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %122 = OpTypeFunction %int %_ptr_Function_int + %163 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %302 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %303 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %304 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %16 + %tree = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %23 = OpLabel + %25 = OpLoad %int %data + %28 = OpAccessChain %_ptr_Function_int %tree %uint_0 + OpStore %28 %25 + %31 = OpAccessChain %_ptr_Function_int %tree %uint_1 + OpStore %31 %int_n1 + %35 = OpAccessChain %_ptr_Function_int %tree %uint_2 + OpStore %35 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %36 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_1 = OpFunctionParameter %_ptr_Function_int + %40 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function %42 + %param = OpVariable %_ptr_Function_BST Function %44 + %param_1 = OpVariable %_ptr_Function_int Function %42 + %param_2 = OpVariable %_ptr_Function_BST Function %44 + %param_3 = OpVariable %_ptr_Function_int Function %42 + OpStore %baseIndex %int_0 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %int %baseIndex + %55 = OpLoad %int %treeIndex + %56 = OpSLessThanEqual %bool %53 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %50 + %58 = OpLabel + %62 = OpLoad %int %data_1 + %63 = OpLoad %int %baseIndex + %65 = OpAccessChain %_ptr_Private_int %tree_1 %63 %uint_0 + %66 = OpLoad %int %65 + %67 = OpSLessThanEqual %bool %62 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %71 = OpLoad %int %baseIndex + %72 = OpAccessChain %_ptr_Private_int %tree_1 %71 %uint_1 + %73 = OpLoad %int %72 + %74 = OpIEqual %bool %73 %int_n1 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + %78 = OpLoad %int %baseIndex + %80 = OpLoad %int %treeIndex + %81 = OpAccessChain %_ptr_Private_int %tree_1 %78 %uint_1 + OpStore %81 %80 + %83 = OpLoad %int %treeIndex + %85 = OpAccessChain %_ptr_Private_BST %tree_1 %83 + %86 = OpLoad %BST %85 + OpStore %param %86 + %88 = OpLoad %int %data_1 + OpStore %param_1 %88 + %89 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_1 + %92 = OpLoad %BST %param + %93 = OpAccessChain %_ptr_Private_BST %tree_1 %83 + OpStore %93 %92 + OpReturn + %77 = OpLabel + %94 = OpLoad %int %baseIndex + %95 = OpAccessChain %_ptr_Private_int %tree_1 %94 %uint_1 + %96 = OpLoad %int %95 + OpStore %baseIndex %96 + OpBranch %51 + %75 = OpLabel + OpReturn + %70 = OpLabel + %97 = OpLoad %int %baseIndex + %98 = OpAccessChain %_ptr_Private_int %tree_1 %97 %uint_2 + %99 = OpLoad %int %98 + %100 = OpIEqual %bool %99 %int_n1 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %103 + %102 = OpLabel + %104 = OpLoad %int %baseIndex + %106 = OpLoad %int %treeIndex + %107 = OpAccessChain %_ptr_Private_int %tree_1 %104 %uint_2 + OpStore %107 %106 + %109 = OpLoad %int %treeIndex + %110 = OpAccessChain %_ptr_Private_BST %tree_1 %109 + %111 = OpLoad %BST %110 + OpStore %param_2 %111 + %113 = OpLoad %int %data_1 + OpStore %param_3 %113 + %114 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_2 %param_3 + %117 = OpLoad %BST %param_2 + %118 = OpAccessChain %_ptr_Private_BST %tree_1 %109 + OpStore %118 %117 + OpReturn + %103 = OpLabel + %119 = OpLoad %int %baseIndex + %120 = OpAccessChain %_ptr_Private_int %tree_1 %119 %uint_2 + %121 = OpLoad %int %120 + OpStore %baseIndex %121 + OpBranch %51 + %101 = OpLabel + OpReturn + %68 = OpLabel + OpReturn + %51 = OpLabel + OpBranch %49 + %50 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %122 + %target = OpFunctionParameter %_ptr_Function_int + %125 = OpLabel + %index = OpVariable %_ptr_Function_int Function %42 +%currentNode = OpVariable %_ptr_Function_BST Function %44 + %x_220 = OpVariable %_ptr_Function_int Function %42 + OpStore %index %int_0 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %133 = OpLoad %int %index + %134 = OpINotEqual %bool %133 %int_n1 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 + %136 = OpLabel + OpBranch %135 + %137 = OpLabel + OpBranch %130 + %135 = OpLabel + %138 = OpLoad %int %index + %139 = OpAccessChain %_ptr_Private_BST %tree_1 %138 + %140 = OpLoad %BST %139 + OpStore %currentNode %140 + %141 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %142 = OpLoad %int %141 + %144 = OpLoad %int %target + %145 = OpIEqual %bool %142 %144 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %149 = OpLoad %int %target + OpReturnValue %149 + %146 = OpLabel + %151 = OpLoad %int %target + %152 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %153 = OpLoad %int %152 + %154 = OpSGreaterThan %bool %151 %153 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %157 + %156 = OpLabel + %158 = OpAccessChain %_ptr_Function_int %currentNode %uint_2 + %159 = OpLoad %int %158 + OpStore %x_220 %159 + OpBranch %155 + %157 = OpLabel + %160 = OpAccessChain %_ptr_Function_int %currentNode %uint_1 + %161 = OpLoad %int %160 + OpStore %x_220 %161 + OpBranch %155 + %155 = OpLabel + %162 = OpLoad %int %x_220 + OpStore %index %162 + OpBranch %131 + %131 = OpLabel + OpBranch %129 + %130 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd + %main_1 = OpFunction %void None %163 + %165 = OpLabel +%treeIndex_1 = OpVariable %_ptr_Function_int Function %42 + %param_4 = OpVariable %_ptr_Function_BST Function %44 + %param_5 = OpVariable %_ptr_Function_int Function %42 + %param_6 = OpVariable %_ptr_Function_int Function %42 + %param_7 = OpVariable %_ptr_Function_int Function %42 + %param_8 = OpVariable %_ptr_Function_int Function %42 + %param_9 = OpVariable %_ptr_Function_int Function %42 + %param_10 = OpVariable %_ptr_Function_int Function %42 + %param_11 = OpVariable %_ptr_Function_int Function %42 + %param_12 = OpVariable %_ptr_Function_int Function %42 + %param_13 = OpVariable %_ptr_Function_int Function %42 + %param_14 = OpVariable %_ptr_Function_int Function %42 + %param_15 = OpVariable %_ptr_Function_int Function %42 + %param_16 = OpVariable %_ptr_Function_int Function %42 + %param_17 = OpVariable %_ptr_Function_int Function %42 + %param_18 = OpVariable %_ptr_Function_int Function %42 + %param_19 = OpVariable %_ptr_Function_int Function %42 + %param_20 = OpVariable %_ptr_Function_int Function %42 + %param_21 = OpVariable %_ptr_Function_int Function %42 + %param_22 = OpVariable %_ptr_Function_int Function %42 + %param_23 = OpVariable %_ptr_Function_int Function %42 + %count = OpVariable %_ptr_Function_int Function %42 + %i = OpVariable %_ptr_Function_int Function %42 + %result = OpVariable %_ptr_Function_int Function %42 + %param_24 = OpVariable %_ptr_Function_int Function %42 + OpStore %treeIndex_1 %int_0 + %191 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + %192 = OpLoad %BST %191 + OpStore %param_4 %192 + OpStore %param_5 %int_9 + %194 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_4 %param_5 + %197 = OpLoad %BST %param_4 + %198 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + OpStore %198 %197 + %199 = OpLoad %int %treeIndex_1 + %201 = OpIAdd %int %199 %int_1 + OpStore %treeIndex_1 %201 + %202 = OpLoad %int %treeIndex_1 + OpStore %param_6 %202 + OpStore %param_7 %int_5 + %204 = OpFunctionCall %void %insert_i1_i1_ %param_6 %param_7 + %207 = OpLoad %int %treeIndex_1 + %208 = OpIAdd %int %207 %int_1 + OpStore %treeIndex_1 %208 + %209 = OpLoad %int %treeIndex_1 + OpStore %param_8 %209 + OpStore %param_9 %int_12 + %211 = OpFunctionCall %void %insert_i1_i1_ %param_8 %param_9 + %214 = OpLoad %int %treeIndex_1 + %215 = OpIAdd %int %214 %int_1 + OpStore %treeIndex_1 %215 + %216 = OpLoad %int %treeIndex_1 + OpStore %param_10 %216 + OpStore %param_11 %int_15 + %218 = OpFunctionCall %void %insert_i1_i1_ %param_10 %param_11 + %221 = OpLoad %int %treeIndex_1 + %222 = OpIAdd %int %221 %int_1 + OpStore %treeIndex_1 %222 + %223 = OpLoad %int %treeIndex_1 + OpStore %param_12 %223 + OpStore %param_13 %int_7 + %225 = OpFunctionCall %void %insert_i1_i1_ %param_12 %param_13 + %228 = OpLoad %int %treeIndex_1 + %229 = OpIAdd %int %228 %int_1 + OpStore %treeIndex_1 %229 + %230 = OpLoad %int %treeIndex_1 + OpStore %param_14 %230 + OpStore %param_15 %int_8 + %232 = OpFunctionCall %void %insert_i1_i1_ %param_14 %param_15 + %235 = OpLoad %int %treeIndex_1 + %236 = OpIAdd %int %235 %int_1 + OpStore %treeIndex_1 %236 + %237 = OpLoad %int %treeIndex_1 + OpStore %param_16 %237 + OpStore %param_17 %int_2 + %239 = OpFunctionCall %void %insert_i1_i1_ %param_16 %param_17 + %242 = OpLoad %int %treeIndex_1 + %243 = OpIAdd %int %242 %int_1 + OpStore %treeIndex_1 %243 + %244 = OpLoad %int %treeIndex_1 + OpStore %param_18 %244 + OpStore %param_19 %int_6 + %246 = OpFunctionCall %void %insert_i1_i1_ %param_18 %param_19 + %249 = OpLoad %int %treeIndex_1 + %250 = OpIAdd %int %249 %int_1 + OpStore %treeIndex_1 %250 + %251 = OpLoad %int %treeIndex_1 + OpStore %param_20 %251 + OpStore %param_21 %int_17 + %253 = OpFunctionCall %void %insert_i1_i1_ %param_20 %param_21 + %256 = OpLoad %int %treeIndex_1 + %257 = OpIAdd %int %256 %int_1 + OpStore %treeIndex_1 %257 + %258 = OpLoad %int %treeIndex_1 + OpStore %param_22 %258 + OpStore %param_23 %int_13 + %260 = OpFunctionCall %void %insert_i1_i1_ %param_22 %param_23 + OpStore %count %int_0 + OpStore %i %int_0 + OpBranch %263 + %263 = OpLabel + OpLoopMerge %264 %265 None + OpBranch %266 + %266 = OpLabel + %267 = OpLoad %int %i + %269 = OpSLessThan %bool %267 %int_20 + OpSelectionMerge %270 None + OpBranchConditional %269 %271 %272 + %271 = OpLabel + OpBranch %270 + %272 = OpLabel + OpBranch %264 + %270 = OpLabel + %273 = OpLoad %int %i + OpStore %param_24 %273 + %274 = OpFunctionCall %int %search_i1_ %param_24 + OpStore %result %274 + %276 = OpLoad %int %i + OpSelectionMerge %277 None + OpSwitch %276 %278 2 %279 5 %279 6 %279 7 %279 8 %279 9 %279 12 %279 13 %279 15 %279 17 %279 + %279 = OpLabel + %280 = OpLoad %int %result + %281 = OpLoad %int %i + %282 = OpIEqual %bool %280 %281 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %283 + %284 = OpLabel + %285 = OpLoad %int %count + %286 = OpIAdd %int %285 %int_1 + OpStore %count %286 + OpBranch %283 + %283 = OpLabel + OpBranch %277 + %278 = OpLabel + %287 = OpLoad %int %result + %288 = OpIEqual %bool %287 %int_n1 + OpSelectionMerge %289 None + OpBranchConditional %288 %290 %289 + %290 = OpLabel + %291 = OpLoad %int %count + %292 = OpIAdd %int %291 %int_1 + OpStore %count %292 + OpBranch %289 + %289 = OpLabel + OpBranch %277 + %277 = OpLabel + OpBranch %265 + %265 = OpLabel + %293 = OpLoad %int %i + %294 = OpIAdd %int %293 %int_1 + OpStore %i %294 + OpBranch %263 + %264 = OpLabel + %295 = OpLoad %int %count + %296 = OpIEqual %bool %295 %int_20 + OpSelectionMerge %297 None + OpBranchConditional %296 %298 %299 + %298 = OpLabel + OpStore %x_GLF_color %302 + OpBranch %297 + %299 = OpLabel + OpStore %x_GLF_color %303 + OpBranch %297 + %297 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %304 +%tint_symbol = OpFunctionParameter %main_out + %308 = OpLabel + %309 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %309 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %163 + %311 = OpLabel + %312 = OpFunctionCall %void %main_1 + %314 = OpLoad %v4float %x_GLF_color + %315 = OpCompositeConstruct %main_out %314 + %313 = OpFunctionCall %void %tint_symbol_2 %315 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..0016d4c9ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.wgsl @@ -0,0 +1,264 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var tree_1 : array; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(tree : ptr, data : ptr) { + let x_158 : i32 = *(data); + (*(tree)).data = x_158; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_167 : i32 = baseIndex; + let x_168 : i32 = *(treeIndex); + if ((x_167 <= x_168)) { + } else { + break; + } + let x_171 : i32 = *(data_1); + let x_172 : i32 = baseIndex; + let x_174 : i32 = tree_1[x_172].data; + if ((x_171 <= x_174)) { + let x_179 : i32 = baseIndex; + let x_181 : i32 = tree_1[x_179].leftIndex; + if ((x_181 == -1)) { + let x_186 : i32 = baseIndex; + let x_187 : i32 = *(treeIndex); + tree_1[x_186].leftIndex = x_187; + let x_189 : i32 = *(treeIndex); + let x_191 : BST = tree_1[x_189]; + param = x_191; + let x_192 : i32 = *(data_1); + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_194 : BST = param; + tree_1[x_189] = x_194; + return; + } else { + let x_196 : i32 = baseIndex; + let x_198 : i32 = tree_1[x_196].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + let x_199 : i32 = baseIndex; + let x_201 : i32 = tree_1[x_199].rightIndex; + if ((x_201 == -1)) { + let x_206 : i32 = baseIndex; + let x_207 : i32 = *(treeIndex); + tree_1[x_206].rightIndex = x_207; + let x_209 : i32 = *(treeIndex); + let x_211 : BST = tree_1[x_209]; + param_2 = x_211; + let x_212 : i32 = *(data_1); + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_214 : BST = param_2; + tree_1[x_209] = x_214; + return; + } else { + let x_216 : i32 = baseIndex; + let x_218 : i32 = tree_1[x_216].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_220 : i32; + index = 0; + loop { + let x_225 : i32 = index; + if ((x_225 != -1)) { + } else { + break; + } + let x_228 : i32 = index; + let x_230 : BST = tree_1[x_228]; + currentNode = x_230; + let x_232 : i32 = currentNode.data; + let x_233 : i32 = *(target); + if ((x_232 == x_233)) { + let x_237 : i32 = *(target); + return x_237; + } + let x_238 : i32 = *(target); + let x_240 : i32 = currentNode.data; + if ((x_238 > x_240)) { + let x_246 : i32 = currentNode.rightIndex; + x_220 = x_246; + } else { + let x_248 : i32 = currentNode.leftIndex; + x_220 = x_248; + } + let x_249 : i32 = x_220; + index = x_249; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var count : i32; + var i : i32; + var result : i32; + var param_24 : i32; + treeIndex_1 = 0; + let x_84 : BST = tree_1[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_86 : BST = param_4; + tree_1[0] = x_86; + let x_88 : i32 = treeIndex_1; + treeIndex_1 = (x_88 + 1); + let x_90 : i32 = treeIndex_1; + param_6 = x_90; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_92 : i32 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + let x_94 : i32 = treeIndex_1; + param_8 = x_94; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_96 : i32 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + let x_98 : i32 = treeIndex_1; + param_10 = x_98; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_100 : i32 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + let x_102 : i32 = treeIndex_1; + param_12 = x_102; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_104 : i32 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + let x_106 : i32 = treeIndex_1; + param_14 = x_106; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_108 : i32 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + let x_110 : i32 = treeIndex_1; + param_16 = x_110; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_112 : i32 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + let x_114 : i32 = treeIndex_1; + param_18 = x_114; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_116 : i32 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + let x_118 : i32 = treeIndex_1; + param_20 = x_118; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_120 : i32 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + let x_122 : i32 = treeIndex_1; + param_22 = x_122; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + count = 0; + i = 0; + loop { + let x_128 : i32 = i; + if ((x_128 < 20)) { + } else { + break; + } + let x_131 : i32 = i; + param_24 = x_131; + let x_132 : i32 = search_i1_(&(param_24)); + result = x_132; + let x_133 : i32 = i; + switch(x_133) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_143 : i32 = result; + let x_144 : i32 = i; + if ((x_143 == x_144)) { + let x_148 : i32 = count; + count = (x_148 + 1); + } + } + default: { + let x_137 : i32 = result; + if ((x_137 == -1)) { + let x_141 : i32 = count; + count = (x_141 + 1); + } + } + } + + continuing { + let x_150 : i32 = i; + i = (x_150 + 1); + } + } + let x_152 : i32 = count; + if ((x_152 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl new file mode 100644 index 0000000000..0016d4c9ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl @@ -0,0 +1,264 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var tree_1 : array; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(tree : ptr, data : ptr) { + let x_158 : i32 = *(data); + (*(tree)).data = x_158; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_167 : i32 = baseIndex; + let x_168 : i32 = *(treeIndex); + if ((x_167 <= x_168)) { + } else { + break; + } + let x_171 : i32 = *(data_1); + let x_172 : i32 = baseIndex; + let x_174 : i32 = tree_1[x_172].data; + if ((x_171 <= x_174)) { + let x_179 : i32 = baseIndex; + let x_181 : i32 = tree_1[x_179].leftIndex; + if ((x_181 == -1)) { + let x_186 : i32 = baseIndex; + let x_187 : i32 = *(treeIndex); + tree_1[x_186].leftIndex = x_187; + let x_189 : i32 = *(treeIndex); + let x_191 : BST = tree_1[x_189]; + param = x_191; + let x_192 : i32 = *(data_1); + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_194 : BST = param; + tree_1[x_189] = x_194; + return; + } else { + let x_196 : i32 = baseIndex; + let x_198 : i32 = tree_1[x_196].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + let x_199 : i32 = baseIndex; + let x_201 : i32 = tree_1[x_199].rightIndex; + if ((x_201 == -1)) { + let x_206 : i32 = baseIndex; + let x_207 : i32 = *(treeIndex); + tree_1[x_206].rightIndex = x_207; + let x_209 : i32 = *(treeIndex); + let x_211 : BST = tree_1[x_209]; + param_2 = x_211; + let x_212 : i32 = *(data_1); + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_214 : BST = param_2; + tree_1[x_209] = x_214; + return; + } else { + let x_216 : i32 = baseIndex; + let x_218 : i32 = tree_1[x_216].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_220 : i32; + index = 0; + loop { + let x_225 : i32 = index; + if ((x_225 != -1)) { + } else { + break; + } + let x_228 : i32 = index; + let x_230 : BST = tree_1[x_228]; + currentNode = x_230; + let x_232 : i32 = currentNode.data; + let x_233 : i32 = *(target); + if ((x_232 == x_233)) { + let x_237 : i32 = *(target); + return x_237; + } + let x_238 : i32 = *(target); + let x_240 : i32 = currentNode.data; + if ((x_238 > x_240)) { + let x_246 : i32 = currentNode.rightIndex; + x_220 = x_246; + } else { + let x_248 : i32 = currentNode.leftIndex; + x_220 = x_248; + } + let x_249 : i32 = x_220; + index = x_249; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var count : i32; + var i : i32; + var result : i32; + var param_24 : i32; + treeIndex_1 = 0; + let x_84 : BST = tree_1[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_86 : BST = param_4; + tree_1[0] = x_86; + let x_88 : i32 = treeIndex_1; + treeIndex_1 = (x_88 + 1); + let x_90 : i32 = treeIndex_1; + param_6 = x_90; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_92 : i32 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + let x_94 : i32 = treeIndex_1; + param_8 = x_94; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_96 : i32 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + let x_98 : i32 = treeIndex_1; + param_10 = x_98; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_100 : i32 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + let x_102 : i32 = treeIndex_1; + param_12 = x_102; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_104 : i32 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + let x_106 : i32 = treeIndex_1; + param_14 = x_106; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_108 : i32 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + let x_110 : i32 = treeIndex_1; + param_16 = x_110; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_112 : i32 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + let x_114 : i32 = treeIndex_1; + param_18 = x_114; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_116 : i32 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + let x_118 : i32 = treeIndex_1; + param_20 = x_118; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_120 : i32 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + let x_122 : i32 = treeIndex_1; + param_22 = x_122; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + count = 0; + i = 0; + loop { + let x_128 : i32 = i; + if ((x_128 < 20)) { + } else { + break; + } + let x_131 : i32 = i; + param_24 = x_131; + let x_132 : i32 = search_i1_(&(param_24)); + result = x_132; + let x_133 : i32 = i; + switch(x_133) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_143 : i32 = result; + let x_144 : i32 = i; + if ((x_143 == x_144)) { + let x_148 : i32 = count; + count = (x_148 + 1); + } + } + default: { + let x_137 : i32 = result; + if ((x_137 == -1)) { + let x_141 : i32 = count; + count = (x_141 + 1); + } + } + } + + continuing { + let x_150 : i32 = i; + i = (x_150 + 1); + } + } + let x_152 : i32 = count; + if ((x_152 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..bc5fdac8f1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.hlsl @@ -0,0 +1,232 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree_1[10] = (BST[10])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_158 = data; + tree.data = x_158; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + while (true) { + const int x_167 = baseIndex; + const int x_168 = treeIndex; + if ((x_167 <= x_168)) { + } else { + break; + } + const int x_171 = data_1; + const int x_174 = tree_1[baseIndex].data; + if ((x_171 <= x_174)) { + const int x_181 = tree_1[baseIndex].leftIndex; + if ((x_181 == -1)) { + const int x_186 = baseIndex; + const int x_187 = treeIndex; + tree_1[x_186].leftIndex = x_187; + const int x_189 = treeIndex; + const BST x_191 = tree_1[x_189]; + param = x_191; + const int x_192 = data_1; + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_189] = param; + return; + } else { + const int x_198 = tree_1[baseIndex].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + const int x_201 = tree_1[baseIndex].rightIndex; + if ((x_201 == -1)) { + const int x_206 = baseIndex; + const int x_207 = treeIndex; + tree_1[x_206].rightIndex = x_207; + const int x_209 = treeIndex; + const BST x_211 = tree_1[x_209]; + param_2 = x_211; + const int x_212 = data_1; + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_209] = param_2; + return; + } else { + const int x_218 = tree_1[baseIndex].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_220 = 0; + index = 0; + while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_230 = tree_1[index]; + currentNode = x_230; + const int x_232 = currentNode.data; + const int x_233 = target; + if ((x_232 == x_233)) { + const int x_237 = target; + return x_237; + } + const int x_238 = target; + const int x_240 = currentNode.data; + if ((x_238 > x_240)) { + const int x_246 = currentNode.rightIndex; + x_220 = x_246; + } else { + const int x_248 = currentNode.leftIndex; + x_220 = x_248; + } + index = x_220; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_84 = tree_1[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree_1[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + for(; (i < 20); i = (i + 1)) { + param_24 = i; + const int x_132 = search_i1_(param_24); + result = x_132; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.msl new file mode 100644 index 0000000000..f509724732 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.msl @@ -0,0 +1,281 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const tree, thread int* const data) { + int const x_158 = *(data); + (*(tree)).data = x_158; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_4) { + int baseIndex = 0; + BST param = {}; + int param_1 = 0; + BST param_2 = {}; + int param_3 = 0; + baseIndex = 0; + while (true) { + int const x_167 = baseIndex; + int const x_168 = *(treeIndex); + if ((x_167 <= x_168)) { + } else { + break; + } + int const x_171 = *(data_1); + int const x_172 = baseIndex; + int const x_174 = (*(tint_symbol_4)).arr[x_172].data; + if ((x_171 <= x_174)) { + int const x_179 = baseIndex; + int const x_181 = (*(tint_symbol_4)).arr[x_179].leftIndex; + if ((x_181 == -1)) { + int const x_186 = baseIndex; + int const x_187 = *(treeIndex); + (*(tint_symbol_4)).arr[x_186].leftIndex = x_187; + int const x_189 = *(treeIndex); + BST const x_191 = (*(tint_symbol_4)).arr[x_189]; + param = x_191; + int const x_192 = *(data_1); + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + BST const x_194 = param; + (*(tint_symbol_4)).arr[x_189] = x_194; + return; + } else { + int const x_196 = baseIndex; + int const x_198 = (*(tint_symbol_4)).arr[x_196].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + int const x_199 = baseIndex; + int const x_201 = (*(tint_symbol_4)).arr[x_199].rightIndex; + if ((x_201 == -1)) { + int const x_206 = baseIndex; + int const x_207 = *(treeIndex); + (*(tint_symbol_4)).arr[x_206].rightIndex = x_207; + int const x_209 = *(treeIndex); + BST const x_211 = (*(tint_symbol_4)).arr[x_209]; + param_2 = x_211; + int const x_212 = *(data_1); + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + BST const x_214 = param_2; + (*(tint_symbol_4)).arr[x_209] = x_214; + return; + } else { + int const x_216 = baseIndex; + int const x_218 = (*(tint_symbol_4)).arr[x_216].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_5) { + int index = 0; + BST currentNode = {}; + int x_220 = 0; + index = 0; + while (true) { + int const x_225 = index; + if ((x_225 != -1)) { + } else { + break; + } + int const x_228 = index; + BST const x_230 = (*(tint_symbol_5)).arr[x_228]; + currentNode = x_230; + int const x_232 = currentNode.data; + int const x_233 = *(target); + if ((x_232 == x_233)) { + int const x_237 = *(target); + return x_237; + } + int const x_238 = *(target); + int const x_240 = currentNode.data; + if ((x_238 > x_240)) { + int const x_246 = currentNode.rightIndex; + x_220 = x_246; + } else { + int const x_248 = currentNode.leftIndex; + x_220 = x_248; + } + int const x_249 = x_220; + index = x_249; + } + return -1; +} + +void main_1(thread tint_array_wrapper* const tint_symbol_6, thread float4* const tint_symbol_7) { + int treeIndex_1 = 0; + BST param_4 = {}; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + BST const x_84 = (*(tint_symbol_6)).arr[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + BST const x_86 = param_4; + (*(tint_symbol_6)).arr[0] = x_86; + int const x_88 = treeIndex_1; + treeIndex_1 = (x_88 + 1); + int const x_90 = treeIndex_1; + param_6 = x_90; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7), tint_symbol_6); + int const x_92 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + int const x_94 = treeIndex_1; + param_8 = x_94; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9), tint_symbol_6); + int const x_96 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + int const x_98 = treeIndex_1; + param_10 = x_98; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11), tint_symbol_6); + int const x_100 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + int const x_102 = treeIndex_1; + param_12 = x_102; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13), tint_symbol_6); + int const x_104 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + int const x_106 = treeIndex_1; + param_14 = x_106; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15), tint_symbol_6); + int const x_108 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + int const x_110 = treeIndex_1; + param_16 = x_110; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17), tint_symbol_6); + int const x_112 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + int const x_114 = treeIndex_1; + param_18 = x_114; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19), tint_symbol_6); + int const x_116 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + int const x_118 = treeIndex_1; + param_20 = x_118; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21), tint_symbol_6); + int const x_120 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + int const x_122 = treeIndex_1; + param_22 = x_122; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23), tint_symbol_6); + count = 0; + i = 0; + while (true) { + int const x_128 = i; + if ((x_128 < 20)) { + } else { + break; + } + int const x_131 = i; + param_24 = x_131; + int const x_132 = search_i1_(&(param_24), tint_symbol_6); + result = x_132; + int const x_133 = i; + switch(x_133) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + int const x_143 = result; + int const x_144 = i; + if ((x_143 == x_144)) { + int const x_148 = count; + count = (x_148 + 1); + } + break; + } + default: { + int const x_137 = result; + if ((x_137 == -1)) { + int const x_141 = count; + count = (x_141 + 1); + } + break; + } + } + { + int const x_150 = i; + i = (x_150 + 1); + } + } + int const x_152 = count; + if ((x_152 == 20)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread tint_array_wrapper tint_symbol_8 = {}; + thread float4 tint_symbol_9 = 0.0f; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..3d85c3b788 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.spvasm @@ -0,0 +1,476 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 316 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree_1 "tree_1" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode_struct_BST_i1_i1_i11_i1_" + OpName %tree "tree" + OpName %data "data" + OpName %insert_i1_i1_ "insert_i1_i1_" + OpName %treeIndex "treeIndex" + OpName %data_1 "data_1" + OpName %baseIndex "baseIndex" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %search_i1_ "search_i1_" + OpName %target "target" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %x_220 "x_220" + OpName %main_1 "main_1" + OpName %treeIndex_1 "treeIndex_1" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %param_10 "param_10" + OpName %param_11 "param_11" + OpName %param_12 "param_12" + OpName %param_13 "param_13" + OpName %param_14 "param_14" + OpName %param_15 "param_15" + OpName %param_16 "param_16" + OpName %param_17 "param_17" + OpName %param_18 "param_18" + OpName %param_19 "param_19" + OpName %param_20 "param_20" + OpName %param_21 "param_21" + OpName %param_22 "param_22" + OpName %param_23 "param_23" + OpName %count "count" + OpName %i "i" + OpName %result "result" + OpName %param_24 "param_24" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %8 = OpConstantNull %_arr_BST_uint_10 + %tree_1 = OpVariable %_ptr_Private__arr_BST_uint_10 Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %16 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int_n1 = OpConstant %int -1 + %uint_2 = OpConstant %uint 2 + %36 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %42 = OpConstantNull %int + %44 = OpConstantNull %BST + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %122 = OpTypeFunction %int %_ptr_Function_int + %163 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %302 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %303 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %304 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %16 + %tree = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %23 = OpLabel + %25 = OpLoad %int %data + %28 = OpAccessChain %_ptr_Function_int %tree %uint_0 + OpStore %28 %25 + %31 = OpAccessChain %_ptr_Function_int %tree %uint_1 + OpStore %31 %int_n1 + %35 = OpAccessChain %_ptr_Function_int %tree %uint_2 + OpStore %35 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %36 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_1 = OpFunctionParameter %_ptr_Function_int + %40 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function %42 + %param = OpVariable %_ptr_Function_BST Function %44 + %param_1 = OpVariable %_ptr_Function_int Function %42 + %param_2 = OpVariable %_ptr_Function_BST Function %44 + %param_3 = OpVariable %_ptr_Function_int Function %42 + OpStore %baseIndex %int_0 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %int %baseIndex + %55 = OpLoad %int %treeIndex + %56 = OpSLessThanEqual %bool %53 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %50 + %58 = OpLabel + %62 = OpLoad %int %data_1 + %63 = OpLoad %int %baseIndex + %65 = OpAccessChain %_ptr_Private_int %tree_1 %63 %uint_0 + %66 = OpLoad %int %65 + %67 = OpSLessThanEqual %bool %62 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %71 = OpLoad %int %baseIndex + %72 = OpAccessChain %_ptr_Private_int %tree_1 %71 %uint_1 + %73 = OpLoad %int %72 + %74 = OpIEqual %bool %73 %int_n1 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + %78 = OpLoad %int %baseIndex + %80 = OpLoad %int %treeIndex + %81 = OpAccessChain %_ptr_Private_int %tree_1 %78 %uint_1 + OpStore %81 %80 + %83 = OpLoad %int %treeIndex + %85 = OpAccessChain %_ptr_Private_BST %tree_1 %83 + %86 = OpLoad %BST %85 + OpStore %param %86 + %88 = OpLoad %int %data_1 + OpStore %param_1 %88 + %89 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_1 + %92 = OpLoad %BST %param + %93 = OpAccessChain %_ptr_Private_BST %tree_1 %83 + OpStore %93 %92 + OpReturn + %77 = OpLabel + %94 = OpLoad %int %baseIndex + %95 = OpAccessChain %_ptr_Private_int %tree_1 %94 %uint_1 + %96 = OpLoad %int %95 + OpStore %baseIndex %96 + OpBranch %51 + %75 = OpLabel + OpReturn + %70 = OpLabel + %97 = OpLoad %int %baseIndex + %98 = OpAccessChain %_ptr_Private_int %tree_1 %97 %uint_2 + %99 = OpLoad %int %98 + %100 = OpIEqual %bool %99 %int_n1 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %103 + %102 = OpLabel + %104 = OpLoad %int %baseIndex + %106 = OpLoad %int %treeIndex + %107 = OpAccessChain %_ptr_Private_int %tree_1 %104 %uint_2 + OpStore %107 %106 + %109 = OpLoad %int %treeIndex + %110 = OpAccessChain %_ptr_Private_BST %tree_1 %109 + %111 = OpLoad %BST %110 + OpStore %param_2 %111 + %113 = OpLoad %int %data_1 + OpStore %param_3 %113 + %114 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_2 %param_3 + %117 = OpLoad %BST %param_2 + %118 = OpAccessChain %_ptr_Private_BST %tree_1 %109 + OpStore %118 %117 + OpReturn + %103 = OpLabel + %119 = OpLoad %int %baseIndex + %120 = OpAccessChain %_ptr_Private_int %tree_1 %119 %uint_2 + %121 = OpLoad %int %120 + OpStore %baseIndex %121 + OpBranch %51 + %101 = OpLabel + OpReturn + %68 = OpLabel + OpReturn + %51 = OpLabel + OpBranch %49 + %50 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %122 + %target = OpFunctionParameter %_ptr_Function_int + %125 = OpLabel + %index = OpVariable %_ptr_Function_int Function %42 +%currentNode = OpVariable %_ptr_Function_BST Function %44 + %x_220 = OpVariable %_ptr_Function_int Function %42 + OpStore %index %int_0 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %133 = OpLoad %int %index + %134 = OpINotEqual %bool %133 %int_n1 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 + %136 = OpLabel + OpBranch %135 + %137 = OpLabel + OpBranch %130 + %135 = OpLabel + %138 = OpLoad %int %index + %139 = OpAccessChain %_ptr_Private_BST %tree_1 %138 + %140 = OpLoad %BST %139 + OpStore %currentNode %140 + %141 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %142 = OpLoad %int %141 + %144 = OpLoad %int %target + %145 = OpIEqual %bool %142 %144 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %149 = OpLoad %int %target + OpReturnValue %149 + %146 = OpLabel + %151 = OpLoad %int %target + %152 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %153 = OpLoad %int %152 + %154 = OpSGreaterThan %bool %151 %153 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %157 + %156 = OpLabel + %158 = OpAccessChain %_ptr_Function_int %currentNode %uint_2 + %159 = OpLoad %int %158 + OpStore %x_220 %159 + OpBranch %155 + %157 = OpLabel + %160 = OpAccessChain %_ptr_Function_int %currentNode %uint_1 + %161 = OpLoad %int %160 + OpStore %x_220 %161 + OpBranch %155 + %155 = OpLabel + %162 = OpLoad %int %x_220 + OpStore %index %162 + OpBranch %131 + %131 = OpLabel + OpBranch %129 + %130 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd + %main_1 = OpFunction %void None %163 + %165 = OpLabel +%treeIndex_1 = OpVariable %_ptr_Function_int Function %42 + %param_4 = OpVariable %_ptr_Function_BST Function %44 + %param_5 = OpVariable %_ptr_Function_int Function %42 + %param_6 = OpVariable %_ptr_Function_int Function %42 + %param_7 = OpVariable %_ptr_Function_int Function %42 + %param_8 = OpVariable %_ptr_Function_int Function %42 + %param_9 = OpVariable %_ptr_Function_int Function %42 + %param_10 = OpVariable %_ptr_Function_int Function %42 + %param_11 = OpVariable %_ptr_Function_int Function %42 + %param_12 = OpVariable %_ptr_Function_int Function %42 + %param_13 = OpVariable %_ptr_Function_int Function %42 + %param_14 = OpVariable %_ptr_Function_int Function %42 + %param_15 = OpVariable %_ptr_Function_int Function %42 + %param_16 = OpVariable %_ptr_Function_int Function %42 + %param_17 = OpVariable %_ptr_Function_int Function %42 + %param_18 = OpVariable %_ptr_Function_int Function %42 + %param_19 = OpVariable %_ptr_Function_int Function %42 + %param_20 = OpVariable %_ptr_Function_int Function %42 + %param_21 = OpVariable %_ptr_Function_int Function %42 + %param_22 = OpVariable %_ptr_Function_int Function %42 + %param_23 = OpVariable %_ptr_Function_int Function %42 + %count = OpVariable %_ptr_Function_int Function %42 + %i = OpVariable %_ptr_Function_int Function %42 + %result = OpVariable %_ptr_Function_int Function %42 + %param_24 = OpVariable %_ptr_Function_int Function %42 + OpStore %treeIndex_1 %int_0 + %191 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + %192 = OpLoad %BST %191 + OpStore %param_4 %192 + OpStore %param_5 %int_9 + %194 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_4 %param_5 + %197 = OpLoad %BST %param_4 + %198 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + OpStore %198 %197 + %199 = OpLoad %int %treeIndex_1 + %201 = OpIAdd %int %199 %int_1 + OpStore %treeIndex_1 %201 + %202 = OpLoad %int %treeIndex_1 + OpStore %param_6 %202 + OpStore %param_7 %int_5 + %204 = OpFunctionCall %void %insert_i1_i1_ %param_6 %param_7 + %207 = OpLoad %int %treeIndex_1 + %208 = OpIAdd %int %207 %int_1 + OpStore %treeIndex_1 %208 + %209 = OpLoad %int %treeIndex_1 + OpStore %param_8 %209 + OpStore %param_9 %int_12 + %211 = OpFunctionCall %void %insert_i1_i1_ %param_8 %param_9 + %214 = OpLoad %int %treeIndex_1 + %215 = OpIAdd %int %214 %int_1 + OpStore %treeIndex_1 %215 + %216 = OpLoad %int %treeIndex_1 + OpStore %param_10 %216 + OpStore %param_11 %int_15 + %218 = OpFunctionCall %void %insert_i1_i1_ %param_10 %param_11 + %221 = OpLoad %int %treeIndex_1 + %222 = OpIAdd %int %221 %int_1 + OpStore %treeIndex_1 %222 + %223 = OpLoad %int %treeIndex_1 + OpStore %param_12 %223 + OpStore %param_13 %int_7 + %225 = OpFunctionCall %void %insert_i1_i1_ %param_12 %param_13 + %228 = OpLoad %int %treeIndex_1 + %229 = OpIAdd %int %228 %int_1 + OpStore %treeIndex_1 %229 + %230 = OpLoad %int %treeIndex_1 + OpStore %param_14 %230 + OpStore %param_15 %int_8 + %232 = OpFunctionCall %void %insert_i1_i1_ %param_14 %param_15 + %235 = OpLoad %int %treeIndex_1 + %236 = OpIAdd %int %235 %int_1 + OpStore %treeIndex_1 %236 + %237 = OpLoad %int %treeIndex_1 + OpStore %param_16 %237 + OpStore %param_17 %int_2 + %239 = OpFunctionCall %void %insert_i1_i1_ %param_16 %param_17 + %242 = OpLoad %int %treeIndex_1 + %243 = OpIAdd %int %242 %int_1 + OpStore %treeIndex_1 %243 + %244 = OpLoad %int %treeIndex_1 + OpStore %param_18 %244 + OpStore %param_19 %int_6 + %246 = OpFunctionCall %void %insert_i1_i1_ %param_18 %param_19 + %249 = OpLoad %int %treeIndex_1 + %250 = OpIAdd %int %249 %int_1 + OpStore %treeIndex_1 %250 + %251 = OpLoad %int %treeIndex_1 + OpStore %param_20 %251 + OpStore %param_21 %int_17 + %253 = OpFunctionCall %void %insert_i1_i1_ %param_20 %param_21 + %256 = OpLoad %int %treeIndex_1 + %257 = OpIAdd %int %256 %int_1 + OpStore %treeIndex_1 %257 + %258 = OpLoad %int %treeIndex_1 + OpStore %param_22 %258 + OpStore %param_23 %int_13 + %260 = OpFunctionCall %void %insert_i1_i1_ %param_22 %param_23 + OpStore %count %int_0 + OpStore %i %int_0 + OpBranch %263 + %263 = OpLabel + OpLoopMerge %264 %265 None + OpBranch %266 + %266 = OpLabel + %267 = OpLoad %int %i + %269 = OpSLessThan %bool %267 %int_20 + OpSelectionMerge %270 None + OpBranchConditional %269 %271 %272 + %271 = OpLabel + OpBranch %270 + %272 = OpLabel + OpBranch %264 + %270 = OpLabel + %273 = OpLoad %int %i + OpStore %param_24 %273 + %274 = OpFunctionCall %int %search_i1_ %param_24 + OpStore %result %274 + %276 = OpLoad %int %i + OpSelectionMerge %277 None + OpSwitch %276 %278 2 %279 5 %279 6 %279 7 %279 8 %279 9 %279 12 %279 13 %279 15 %279 17 %279 + %279 = OpLabel + %280 = OpLoad %int %result + %281 = OpLoad %int %i + %282 = OpIEqual %bool %280 %281 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %283 + %284 = OpLabel + %285 = OpLoad %int %count + %286 = OpIAdd %int %285 %int_1 + OpStore %count %286 + OpBranch %283 + %283 = OpLabel + OpBranch %277 + %278 = OpLabel + %287 = OpLoad %int %result + %288 = OpIEqual %bool %287 %int_n1 + OpSelectionMerge %289 None + OpBranchConditional %288 %290 %289 + %290 = OpLabel + %291 = OpLoad %int %count + %292 = OpIAdd %int %291 %int_1 + OpStore %count %292 + OpBranch %289 + %289 = OpLabel + OpBranch %277 + %277 = OpLabel + OpBranch %265 + %265 = OpLabel + %293 = OpLoad %int %i + %294 = OpIAdd %int %293 %int_1 + OpStore %i %294 + OpBranch %263 + %264 = OpLabel + %295 = OpLoad %int %count + %296 = OpIEqual %bool %295 %int_20 + OpSelectionMerge %297 None + OpBranchConditional %296 %298 %299 + %298 = OpLabel + OpStore %x_GLF_color %302 + OpBranch %297 + %299 = OpLabel + OpStore %x_GLF_color %303 + OpBranch %297 + %297 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %304 +%tint_symbol = OpFunctionParameter %main_out + %308 = OpLabel + %309 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %309 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %163 + %311 = OpLabel + %312 = OpFunctionCall %void %main_1 + %314 = OpLoad %v4float %x_GLF_color + %315 = OpCompositeConstruct %main_out %314 + %313 = OpFunctionCall %void %tint_symbol_2 %315 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..0016d4c9ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.wgsl @@ -0,0 +1,264 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var tree_1 : array; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(tree : ptr, data : ptr) { + let x_158 : i32 = *(data); + (*(tree)).data = x_158; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_167 : i32 = baseIndex; + let x_168 : i32 = *(treeIndex); + if ((x_167 <= x_168)) { + } else { + break; + } + let x_171 : i32 = *(data_1); + let x_172 : i32 = baseIndex; + let x_174 : i32 = tree_1[x_172].data; + if ((x_171 <= x_174)) { + let x_179 : i32 = baseIndex; + let x_181 : i32 = tree_1[x_179].leftIndex; + if ((x_181 == -1)) { + let x_186 : i32 = baseIndex; + let x_187 : i32 = *(treeIndex); + tree_1[x_186].leftIndex = x_187; + let x_189 : i32 = *(treeIndex); + let x_191 : BST = tree_1[x_189]; + param = x_191; + let x_192 : i32 = *(data_1); + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_194 : BST = param; + tree_1[x_189] = x_194; + return; + } else { + let x_196 : i32 = baseIndex; + let x_198 : i32 = tree_1[x_196].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + let x_199 : i32 = baseIndex; + let x_201 : i32 = tree_1[x_199].rightIndex; + if ((x_201 == -1)) { + let x_206 : i32 = baseIndex; + let x_207 : i32 = *(treeIndex); + tree_1[x_206].rightIndex = x_207; + let x_209 : i32 = *(treeIndex); + let x_211 : BST = tree_1[x_209]; + param_2 = x_211; + let x_212 : i32 = *(data_1); + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_214 : BST = param_2; + tree_1[x_209] = x_214; + return; + } else { + let x_216 : i32 = baseIndex; + let x_218 : i32 = tree_1[x_216].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_220 : i32; + index = 0; + loop { + let x_225 : i32 = index; + if ((x_225 != -1)) { + } else { + break; + } + let x_228 : i32 = index; + let x_230 : BST = tree_1[x_228]; + currentNode = x_230; + let x_232 : i32 = currentNode.data; + let x_233 : i32 = *(target); + if ((x_232 == x_233)) { + let x_237 : i32 = *(target); + return x_237; + } + let x_238 : i32 = *(target); + let x_240 : i32 = currentNode.data; + if ((x_238 > x_240)) { + let x_246 : i32 = currentNode.rightIndex; + x_220 = x_246; + } else { + let x_248 : i32 = currentNode.leftIndex; + x_220 = x_248; + } + let x_249 : i32 = x_220; + index = x_249; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var count : i32; + var i : i32; + var result : i32; + var param_24 : i32; + treeIndex_1 = 0; + let x_84 : BST = tree_1[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_86 : BST = param_4; + tree_1[0] = x_86; + let x_88 : i32 = treeIndex_1; + treeIndex_1 = (x_88 + 1); + let x_90 : i32 = treeIndex_1; + param_6 = x_90; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_92 : i32 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + let x_94 : i32 = treeIndex_1; + param_8 = x_94; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_96 : i32 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + let x_98 : i32 = treeIndex_1; + param_10 = x_98; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_100 : i32 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + let x_102 : i32 = treeIndex_1; + param_12 = x_102; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_104 : i32 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + let x_106 : i32 = treeIndex_1; + param_14 = x_106; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_108 : i32 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + let x_110 : i32 = treeIndex_1; + param_16 = x_110; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_112 : i32 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + let x_114 : i32 = treeIndex_1; + param_18 = x_114; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_116 : i32 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + let x_118 : i32 = treeIndex_1; + param_20 = x_118; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_120 : i32 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + let x_122 : i32 = treeIndex_1; + param_22 = x_122; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + count = 0; + i = 0; + loop { + let x_128 : i32 = i; + if ((x_128 < 20)) { + } else { + break; + } + let x_131 : i32 = i; + param_24 = x_131; + let x_132 : i32 = search_i1_(&(param_24)); + result = x_132; + let x_133 : i32 = i; + switch(x_133) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_143 : i32 = result; + let x_144 : i32 = i; + if ((x_143 == x_144)) { + let x_148 : i32 = count; + count = (x_148 + 1); + } + } + default: { + let x_137 : i32 = result; + if ((x_137 == -1)) { + let x_141 : i32 = count; + count = (x_141 + 1); + } + } + } + + continuing { + let x_150 : i32 = i; + i = (x_150 + 1); + } + } + let x_152 : i32 = count; + if ((x_152 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm new file mode 100644 index 0000000000..e38765c1dc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm @@ -0,0 +1,436 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode(struct-BST-i1-i1-i11;i1;" + OpName %tree "tree" + OpName %data "data" + OpName %insert_i1_i1_ "insert(i1;i1;" + OpName %treeIndex "treeIndex" + OpName %data_0 "data" + OpName %search_i1_ "search(i1;" + OpName %target "target" + OpName %baseIndex "baseIndex" + OpName %tree_0 "tree" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %treeIndex_0 "treeIndex" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %param_5 "param" + OpName %param_6 "param" + OpName %param_7 "param" + OpName %param_8 "param" + OpName %param_9 "param" + OpName %param_10 "param" + OpName %param_11 "param" + OpName %param_12 "param" + OpName %param_13 "param" + OpName %param_14 "param" + OpName %param_15 "param" + OpName %param_16 "param" + OpName %param_17 "param" + OpName %param_18 "param" + OpName %param_19 "param" + OpName %param_20 "param" + OpName %param_21 "param" + OpName %param_22 "param" + OpName %count "count" + OpName %i "i" + OpName %result "result" + OpName %param_23 "param" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %48 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %52 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %53 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %54 = OpTypeFunction %int %_ptr_Function_int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %tree_0 = OpVariable %_ptr_Private__arr_BST_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %84 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %85 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main = OpFunction %void None %48 + %86 = OpLabel +%treeIndex_0 = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_BST Function + %param_4 = OpVariable %_ptr_Function_int Function + %param_5 = OpVariable %_ptr_Function_int Function + %param_6 = OpVariable %_ptr_Function_int Function + %param_7 = OpVariable %_ptr_Function_int Function + %param_8 = OpVariable %_ptr_Function_int Function + %param_9 = OpVariable %_ptr_Function_int Function + %param_10 = OpVariable %_ptr_Function_int Function + %param_11 = OpVariable %_ptr_Function_int Function + %param_12 = OpVariable %_ptr_Function_int Function + %param_13 = OpVariable %_ptr_Function_int Function + %param_14 = OpVariable %_ptr_Function_int Function + %param_15 = OpVariable %_ptr_Function_int Function + %param_16 = OpVariable %_ptr_Function_int Function + %param_17 = OpVariable %_ptr_Function_int Function + %param_18 = OpVariable %_ptr_Function_int Function + %param_19 = OpVariable %_ptr_Function_int Function + %param_20 = OpVariable %_ptr_Function_int Function + %param_21 = OpVariable %_ptr_Function_int Function + %param_22 = OpVariable %_ptr_Function_int Function + %count = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %result = OpVariable %_ptr_Function_int Function + %param_23 = OpVariable %_ptr_Function_int Function + OpStore %treeIndex_0 %int_0 + %87 = OpAccessChain %_ptr_Private_BST %tree_0 %int_0 + %88 = OpLoad %BST %87 + OpStore %param_3 %88 + OpStore %param_4 %int_9 + %89 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_3 %param_4 + %90 = OpLoad %BST %param_3 + %91 = OpAccessChain %_ptr_Private_BST %tree_0 %int_0 + OpStore %91 %90 + %92 = OpLoad %int %treeIndex_0 + %93 = OpIAdd %int %92 %int_1 + OpStore %treeIndex_0 %93 + %94 = OpLoad %int %treeIndex_0 + OpStore %param_5 %94 + OpStore %param_6 %int_5 + %95 = OpFunctionCall %void %insert_i1_i1_ %param_5 %param_6 + %96 = OpLoad %int %treeIndex_0 + %97 = OpIAdd %int %96 %int_1 + OpStore %treeIndex_0 %97 + %98 = OpLoad %int %treeIndex_0 + OpStore %param_7 %98 + OpStore %param_8 %int_12 + %99 = OpFunctionCall %void %insert_i1_i1_ %param_7 %param_8 + %100 = OpLoad %int %treeIndex_0 + %101 = OpIAdd %int %100 %int_1 + OpStore %treeIndex_0 %101 + %102 = OpLoad %int %treeIndex_0 + OpStore %param_9 %102 + OpStore %param_10 %int_15 + %103 = OpFunctionCall %void %insert_i1_i1_ %param_9 %param_10 + %104 = OpLoad %int %treeIndex_0 + %105 = OpIAdd %int %104 %int_1 + OpStore %treeIndex_0 %105 + %106 = OpLoad %int %treeIndex_0 + OpStore %param_11 %106 + OpStore %param_12 %int_7 + %107 = OpFunctionCall %void %insert_i1_i1_ %param_11 %param_12 + %108 = OpLoad %int %treeIndex_0 + %109 = OpIAdd %int %108 %int_1 + OpStore %treeIndex_0 %109 + %110 = OpLoad %int %treeIndex_0 + OpStore %param_13 %110 + OpStore %param_14 %int_8 + %111 = OpFunctionCall %void %insert_i1_i1_ %param_13 %param_14 + %112 = OpLoad %int %treeIndex_0 + %113 = OpIAdd %int %112 %int_1 + OpStore %treeIndex_0 %113 + %114 = OpLoad %int %treeIndex_0 + OpStore %param_15 %114 + OpStore %param_16 %int_2 + %115 = OpFunctionCall %void %insert_i1_i1_ %param_15 %param_16 + %116 = OpLoad %int %treeIndex_0 + %117 = OpIAdd %int %116 %int_1 + OpStore %treeIndex_0 %117 + %118 = OpLoad %int %treeIndex_0 + OpStore %param_17 %118 + OpStore %param_18 %int_6 + %119 = OpFunctionCall %void %insert_i1_i1_ %param_17 %param_18 + %120 = OpLoad %int %treeIndex_0 + %121 = OpIAdd %int %120 %int_1 + OpStore %treeIndex_0 %121 + %122 = OpLoad %int %treeIndex_0 + OpStore %param_19 %122 + OpStore %param_20 %int_17 + %123 = OpFunctionCall %void %insert_i1_i1_ %param_19 %param_20 + %124 = OpLoad %int %treeIndex_0 + %125 = OpIAdd %int %124 %int_1 + OpStore %treeIndex_0 %125 + %126 = OpLoad %int %treeIndex_0 + OpStore %param_21 %126 + OpStore %param_22 %int_13 + %127 = OpFunctionCall %void %insert_i1_i1_ %param_21 %param_22 + OpStore %count %int_0 + OpStore %i %int_0 + OpBranch %128 + %128 = OpLabel + OpLoopMerge %129 %130 None + OpBranch %131 + %131 = OpLabel + %132 = OpLoad %int %i + %133 = OpSLessThan %bool %132 %int_20 + OpBranchConditional %133 %134 %129 + %134 = OpLabel + %135 = OpLoad %int %i + OpStore %param_23 %135 + %136 = OpFunctionCall %int %search_i1_ %param_23 + OpStore %result %136 + %137 = OpLoad %int %i + OpSelectionMerge %138 None + OpSwitch %137 %139 9 %140 5 %140 12 %140 15 %140 7 %140 8 %140 2 %140 6 %140 17 %140 13 %140 + %139 = OpLabel + %141 = OpLoad %int %result + %142 = OpIEqual %bool %141 %int_n1 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %143 + %144 = OpLabel + %145 = OpLoad %int %count + %146 = OpIAdd %int %145 %int_1 + OpStore %count %146 + OpBranch %143 + %143 = OpLabel + OpBranch %138 + %140 = OpLabel + %147 = OpLoad %int %result + %148 = OpLoad %int %i + %149 = OpIEqual %bool %147 %148 + %150 = OpLogicalNot %bool %149 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %151 + %152 = OpLabel + %153 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %154 = OpLoad %float %153 + %155 = OpFOrdLessThan %bool %154 %float_0 + OpBranch %151 + %151 = OpLabel + %156 = OpPhi %bool %149 %140 %155 %152 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %157 + %158 = OpLabel + %159 = OpLoad %int %count + %160 = OpIAdd %int %159 %int_1 + OpStore %count %160 + OpBranch %157 + %157 = OpLabel + OpBranch %138 + %138 = OpLabel + OpBranch %130 + %130 = OpLabel + %161 = OpLoad %int %i + %162 = OpIAdd %int %161 %int_1 + OpStore %i %162 + OpBranch %128 + %129 = OpLabel + %163 = OpLoad %int %count + %164 = OpIEqual %bool %163 %int_20 + OpSelectionMerge %165 None + OpBranchConditional %164 %166 %167 + %166 = OpLabel + OpStore %_GLF_color %84 + OpBranch %165 + %167 = OpLabel + OpStore %_GLF_color %85 + OpBranch %165 + %165 = OpLabel + OpReturn + OpFunctionEnd +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %52 + %tree = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %168 = OpLabel + %169 = OpLoad %int %data + %170 = OpAccessChain %_ptr_Function_int %tree %int_0 + OpStore %170 %169 + %171 = OpAccessChain %_ptr_Function_int %tree %int_1 + OpStore %171 %int_n1 + %172 = OpAccessChain %_ptr_Function_int %tree %int_2 + OpStore %172 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %53 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_0 = OpFunctionParameter %_ptr_Function_int + %173 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_BST Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_BST Function + %param_2 = OpVariable %_ptr_Function_int Function + OpStore %baseIndex %int_0 + OpBranch %174 + %174 = OpLabel + OpLoopMerge %175 %176 None + OpBranch %177 + %177 = OpLabel + %178 = OpLoad %int %baseIndex + %179 = OpLoad %int %treeIndex + %180 = OpSLessThanEqual %bool %178 %179 + OpBranchConditional %180 %181 %175 + %181 = OpLabel + %182 = OpLoad %int %data_0 + %183 = OpLoad %int %baseIndex + %184 = OpAccessChain %_ptr_Private_int %tree_0 %183 %int_0 + %185 = OpLoad %int %184 + %186 = OpSLessThanEqual %bool %182 %185 + OpSelectionMerge %187 None + OpBranchConditional %186 %188 %189 + %188 = OpLabel + %190 = OpLoad %int %baseIndex + %191 = OpAccessChain %_ptr_Private_int %tree_0 %190 %int_1 + %192 = OpLoad %int %191 + %193 = OpIEqual %bool %192 %int_n1 + OpSelectionMerge %194 None + OpBranchConditional %193 %195 %196 + %195 = OpLabel + %197 = OpLoad %int %baseIndex + %198 = OpLoad %int %treeIndex + %199 = OpAccessChain %_ptr_Private_int %tree_0 %197 %int_1 + OpStore %199 %198 + %200 = OpLoad %int %treeIndex + %201 = OpAccessChain %_ptr_Private_BST %tree_0 %200 + %202 = OpLoad %BST %201 + OpStore %param %202 + %203 = OpLoad %int %data_0 + OpStore %param_0 %203 + %204 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_0 + %205 = OpLoad %BST %param + %206 = OpAccessChain %_ptr_Private_BST %tree_0 %200 + OpStore %206 %205 + OpReturn + %196 = OpLabel + %207 = OpLoad %int %baseIndex + %208 = OpAccessChain %_ptr_Private_int %tree_0 %207 %int_1 + %209 = OpLoad %int %208 + OpStore %baseIndex %209 + OpBranch %176 + %194 = OpLabel + OpUnreachable + %189 = OpLabel + %210 = OpLoad %int %baseIndex + %211 = OpAccessChain %_ptr_Private_int %tree_0 %210 %int_2 + %212 = OpLoad %int %211 + %213 = OpIEqual %bool %212 %int_n1 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + %217 = OpLoad %int %baseIndex + %218 = OpLoad %int %treeIndex + %219 = OpAccessChain %_ptr_Private_int %tree_0 %217 %int_2 + OpStore %219 %218 + %220 = OpLoad %int %treeIndex + %221 = OpAccessChain %_ptr_Private_BST %tree_0 %220 + %222 = OpLoad %BST %221 + OpStore %param_1 %222 + %223 = OpLoad %int %data_0 + OpStore %param_2 %223 + %224 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_1 %param_2 + %225 = OpLoad %BST %param_1 + %226 = OpAccessChain %_ptr_Private_BST %tree_0 %220 + OpStore %226 %225 + OpReturn + %216 = OpLabel + %227 = OpLoad %int %baseIndex + %228 = OpAccessChain %_ptr_Private_int %tree_0 %227 %int_2 + %229 = OpLoad %int %228 + OpStore %baseIndex %229 + OpBranch %176 + %214 = OpLabel + OpUnreachable + %187 = OpLabel + OpUnreachable + %176 = OpLabel + OpBranch %174 + %175 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %54 + %target = OpFunctionParameter %_ptr_Function_int + %230 = OpLabel + %index = OpVariable %_ptr_Function_int Function +%currentNode = OpVariable %_ptr_Function_BST Function + %231 = OpVariable %_ptr_Function_int Function + OpStore %index %int_0 + OpBranch %232 + %232 = OpLabel + OpLoopMerge %233 %234 None + OpBranch %235 + %235 = OpLabel + %236 = OpLoad %int %index + %237 = OpINotEqual %bool %236 %int_n1 + OpBranchConditional %237 %238 %233 + %238 = OpLabel + %239 = OpLoad %int %index + %240 = OpAccessChain %_ptr_Private_BST %tree_0 %239 + %241 = OpLoad %BST %240 + OpStore %currentNode %241 + %242 = OpAccessChain %_ptr_Function_int %currentNode %int_0 + %243 = OpLoad %int %242 + %244 = OpLoad %int %target + %245 = OpIEqual %bool %243 %244 + OpSelectionMerge %246 None + OpBranchConditional %245 %247 %246 + %247 = OpLabel + %248 = OpLoad %int %target + OpReturnValue %248 + %246 = OpLabel + %249 = OpLoad %int %target + %250 = OpAccessChain %_ptr_Function_int %currentNode %int_0 + %251 = OpLoad %int %250 + %252 = OpSGreaterThan %bool %249 %251 + OpSelectionMerge %253 None + OpBranchConditional %252 %254 %255 + %254 = OpLabel + %256 = OpAccessChain %_ptr_Function_int %currentNode %int_2 + %257 = OpLoad %int %256 + OpStore %231 %257 + OpBranch %253 + %255 = OpLabel + %258 = OpAccessChain %_ptr_Function_int %currentNode %int_1 + %259 = OpLoad %int %258 + OpStore %231 %259 + OpBranch %253 + %253 = OpLabel + %260 = OpLoad %int %231 + OpStore %index %260 + OpBranch %234 + %234 = OpLabel + OpBranch %232 + %233 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..d3b022e76d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.hlsl @@ -0,0 +1,247 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree_1[10] = (BST[10])0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_169 = data; + tree.data = x_169; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + while (true) { + const int x_178 = baseIndex; + const int x_179 = treeIndex; + if ((x_178 <= x_179)) { + } else { + break; + } + const int x_182 = data_1; + const int x_185 = tree_1[baseIndex].data; + if ((x_182 <= x_185)) { + const int x_192 = tree_1[baseIndex].leftIndex; + if ((x_192 == -1)) { + const int x_197 = baseIndex; + const int x_198 = treeIndex; + tree_1[x_197].leftIndex = x_198; + const int x_200 = treeIndex; + const BST x_202 = tree_1[x_200]; + param = x_202; + const int x_203 = data_1; + param_1 = x_203; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_200] = param; + return; + } else { + const int x_209 = tree_1[baseIndex].leftIndex; + baseIndex = x_209; + continue; + } + return; + } else { + const int x_212 = tree_1[baseIndex].rightIndex; + if ((x_212 == -1)) { + const int x_217 = baseIndex; + const int x_218 = treeIndex; + tree_1[x_217].rightIndex = x_218; + const int x_220 = treeIndex; + const BST x_222 = tree_1[x_220]; + param_2 = x_222; + const int x_223 = data_1; + param_3 = x_223; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_220] = param_2; + return; + } else { + const int x_229 = tree_1[baseIndex].rightIndex; + baseIndex = x_229; + continue; + } + return; + } + return; + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_231 = 0; + index = 0; + while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_241 = tree_1[index]; + currentNode = x_241; + const int x_243 = currentNode.data; + const int x_244 = target; + if ((x_243 == x_244)) { + const int x_248 = target; + return x_248; + } + const int x_249 = target; + const int x_251 = currentNode.data; + if ((x_249 > x_251)) { + const int x_257 = currentNode.rightIndex; + x_231 = x_257; + } else { + const int x_259 = currentNode.leftIndex; + x_231 = x_259; + } + index = x_231; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_88 = tree_1[0]; + param_4 = x_88; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree_1[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + for(; (i < 20); i = (i + 1)) { + bool x_155 = false; + bool x_156_phi = false; + param_24 = i; + const int x_136 = search_i1_(param_24); + result = x_136; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + const bool x_149 = (result == i); + x_156_phi = x_149; + if (!(x_149)) { + const float x_154 = gl_FragCoord.x; + x_155 = (x_154 < 0.0f); + x_156_phi = x_155; + } + if (x_156_phi) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.msl new file mode 100644 index 0000000000..80d83c81fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.msl @@ -0,0 +1,293 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const tree, thread int* const data) { + int const x_169 = *(data); + (*(tree)).data = x_169; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_5) { + int baseIndex = 0; + BST param = {}; + int param_1 = 0; + BST param_2 = {}; + int param_3 = 0; + baseIndex = 0; + while (true) { + int const x_178 = baseIndex; + int const x_179 = *(treeIndex); + if ((x_178 <= x_179)) { + } else { + break; + } + int const x_182 = *(data_1); + int const x_183 = baseIndex; + int const x_185 = (*(tint_symbol_5)).arr[x_183].data; + if ((x_182 <= x_185)) { + int const x_190 = baseIndex; + int const x_192 = (*(tint_symbol_5)).arr[x_190].leftIndex; + if ((x_192 == -1)) { + int const x_197 = baseIndex; + int const x_198 = *(treeIndex); + (*(tint_symbol_5)).arr[x_197].leftIndex = x_198; + int const x_200 = *(treeIndex); + BST const x_202 = (*(tint_symbol_5)).arr[x_200]; + param = x_202; + int const x_203 = *(data_1); + param_1 = x_203; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + BST const x_205 = param; + (*(tint_symbol_5)).arr[x_200] = x_205; + return; + } else { + int const x_207 = baseIndex; + int const x_209 = (*(tint_symbol_5)).arr[x_207].leftIndex; + baseIndex = x_209; + continue; + } + return; + } else { + int const x_210 = baseIndex; + int const x_212 = (*(tint_symbol_5)).arr[x_210].rightIndex; + if ((x_212 == -1)) { + int const x_217 = baseIndex; + int const x_218 = *(treeIndex); + (*(tint_symbol_5)).arr[x_217].rightIndex = x_218; + int const x_220 = *(treeIndex); + BST const x_222 = (*(tint_symbol_5)).arr[x_220]; + param_2 = x_222; + int const x_223 = *(data_1); + param_3 = x_223; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + BST const x_225 = param_2; + (*(tint_symbol_5)).arr[x_220] = x_225; + return; + } else { + int const x_227 = baseIndex; + int const x_229 = (*(tint_symbol_5)).arr[x_227].rightIndex; + baseIndex = x_229; + continue; + } + return; + } + return; + } + return; +} + +int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_6) { + int index = 0; + BST currentNode = {}; + int x_231 = 0; + index = 0; + while (true) { + int const x_236 = index; + if ((x_236 != -1)) { + } else { + break; + } + int const x_239 = index; + BST const x_241 = (*(tint_symbol_6)).arr[x_239]; + currentNode = x_241; + int const x_243 = currentNode.data; + int const x_244 = *(target); + if ((x_243 == x_244)) { + int const x_248 = *(target); + return x_248; + } + int const x_249 = *(target); + int const x_251 = currentNode.data; + if ((x_249 > x_251)) { + int const x_257 = currentNode.rightIndex; + x_231 = x_257; + } else { + int const x_259 = currentNode.leftIndex; + x_231 = x_259; + } + int const x_260 = x_231; + index = x_260; + } + return -1; +} + +void main_1(thread tint_array_wrapper* const tint_symbol_7, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) { + int treeIndex_1 = 0; + BST param_4 = {}; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + BST const x_88 = (*(tint_symbol_7)).arr[0]; + param_4 = x_88; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + BST const x_90 = param_4; + (*(tint_symbol_7)).arr[0] = x_90; + int const x_92 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + int const x_94 = treeIndex_1; + param_6 = x_94; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7), tint_symbol_7); + int const x_96 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + int const x_98 = treeIndex_1; + param_8 = x_98; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9), tint_symbol_7); + int const x_100 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + int const x_102 = treeIndex_1; + param_10 = x_102; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11), tint_symbol_7); + int const x_104 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + int const x_106 = treeIndex_1; + param_12 = x_106; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13), tint_symbol_7); + int const x_108 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + int const x_110 = treeIndex_1; + param_14 = x_110; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15), tint_symbol_7); + int const x_112 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + int const x_114 = treeIndex_1; + param_16 = x_114; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17), tint_symbol_7); + int const x_116 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + int const x_118 = treeIndex_1; + param_18 = x_118; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19), tint_symbol_7); + int const x_120 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + int const x_122 = treeIndex_1; + param_20 = x_122; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21), tint_symbol_7); + int const x_124 = treeIndex_1; + treeIndex_1 = (x_124 + 1); + int const x_126 = treeIndex_1; + param_22 = x_126; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23), tint_symbol_7); + count = 0; + i = 0; + while (true) { + int const x_132 = i; + if ((x_132 < 20)) { + } else { + break; + } + bool x_155 = false; + bool x_156_phi = false; + int const x_135 = i; + param_24 = x_135; + int const x_136 = search_i1_(&(param_24), tint_symbol_7); + result = x_136; + int const x_137 = i; + switch(x_137) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + int const x_147 = result; + int const x_148 = i; + bool const x_149 = (x_147 == x_148); + x_156_phi = x_149; + if (!(x_149)) { + float const x_154 = (*(tint_symbol_8)).x; + x_155 = (x_154 < 0.0f); + x_156_phi = x_155; + } + bool const x_156 = x_156_phi; + if (x_156) { + int const x_159 = count; + count = (x_159 + 1); + } + break; + } + default: { + int const x_141 = result; + if ((x_141 == -1)) { + int const x_145 = count; + count = (x_145 + 1); + } + break; + } + } + { + int const x_161 = i; + i = (x_161 + 1); + } + } + int const x_163 = count; + if ((x_163 == 20)) { + *(tint_symbol_9) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_9) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_10 = 0.0f; + thread tint_array_wrapper tint_symbol_11 = {}; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(&(tint_symbol_11), &(tint_symbol_10), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..b62cb2f27c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.spvasm @@ -0,0 +1,505 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 333 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree_1 "tree_1" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode_struct_BST_i1_i1_i11_i1_" + OpName %tree "tree" + OpName %data "data" + OpName %insert_i1_i1_ "insert_i1_i1_" + OpName %treeIndex "treeIndex" + OpName %data_1 "data_1" + OpName %baseIndex "baseIndex" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %search_i1_ "search_i1_" + OpName %target "target" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %x_231 "x_231" + OpName %main_1 "main_1" + OpName %treeIndex_1 "treeIndex_1" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %param_10 "param_10" + OpName %param_11 "param_11" + OpName %param_12 "param_12" + OpName %param_13 "param_13" + OpName %param_14 "param_14" + OpName %param_15 "param_15" + OpName %param_16 "param_16" + OpName %param_17 "param_17" + OpName %param_18 "param_18" + OpName %param_19 "param_19" + OpName %param_20 "param_20" + OpName %param_21 "param_21" + OpName %param_22 "param_22" + OpName %param_23 "param_23" + OpName %count "count" + OpName %i "i" + OpName %result "result" + OpName %param_24 "param_24" + OpName %x_155 "x_155" + OpName %x_156_phi "x_156_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %8 = OpConstantNull %_arr_BST_uint_10 + %tree_1 = OpVariable %_ptr_Private__arr_BST_uint_10 Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %13 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int_n1 = OpConstant %int -1 + %uint_2 = OpConstant %uint 2 + %39 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %45 = OpConstantNull %int + %47 = OpConstantNull %BST + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %125 = OpTypeFunction %int %_ptr_Function_int + %166 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 +%_ptr_Function_bool = OpTypePointer Function %bool + %278 = OpConstantNull %bool +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %318 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %319 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %320 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %19 + %tree = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %26 = OpLabel + %28 = OpLoad %int %data + %31 = OpAccessChain %_ptr_Function_int %tree %uint_0 + OpStore %31 %28 + %34 = OpAccessChain %_ptr_Function_int %tree %uint_1 + OpStore %34 %int_n1 + %38 = OpAccessChain %_ptr_Function_int %tree %uint_2 + OpStore %38 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %39 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_1 = OpFunctionParameter %_ptr_Function_int + %43 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function %45 + %param = OpVariable %_ptr_Function_BST Function %47 + %param_1 = OpVariable %_ptr_Function_int Function %45 + %param_2 = OpVariable %_ptr_Function_BST Function %47 + %param_3 = OpVariable %_ptr_Function_int Function %45 + OpStore %baseIndex %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %baseIndex + %58 = OpLoad %int %treeIndex + %59 = OpSLessThanEqual %bool %56 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %53 + %61 = OpLabel + %65 = OpLoad %int %data_1 + %66 = OpLoad %int %baseIndex + %68 = OpAccessChain %_ptr_Private_int %tree_1 %66 %uint_0 + %69 = OpLoad %int %68 + %70 = OpSLessThanEqual %bool %65 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %baseIndex + %75 = OpAccessChain %_ptr_Private_int %tree_1 %74 %uint_1 + %76 = OpLoad %int %75 + %77 = OpIEqual %bool %76 %int_n1 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + %81 = OpLoad %int %baseIndex + %83 = OpLoad %int %treeIndex + %84 = OpAccessChain %_ptr_Private_int %tree_1 %81 %uint_1 + OpStore %84 %83 + %86 = OpLoad %int %treeIndex + %88 = OpAccessChain %_ptr_Private_BST %tree_1 %86 + %89 = OpLoad %BST %88 + OpStore %param %89 + %91 = OpLoad %int %data_1 + OpStore %param_1 %91 + %92 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_1 + %95 = OpLoad %BST %param + %96 = OpAccessChain %_ptr_Private_BST %tree_1 %86 + OpStore %96 %95 + OpReturn + %80 = OpLabel + %97 = OpLoad %int %baseIndex + %98 = OpAccessChain %_ptr_Private_int %tree_1 %97 %uint_1 + %99 = OpLoad %int %98 + OpStore %baseIndex %99 + OpBranch %54 + %78 = OpLabel + OpReturn + %73 = OpLabel + %100 = OpLoad %int %baseIndex + %101 = OpAccessChain %_ptr_Private_int %tree_1 %100 %uint_2 + %102 = OpLoad %int %101 + %103 = OpIEqual %bool %102 %int_n1 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %106 + %105 = OpLabel + %107 = OpLoad %int %baseIndex + %109 = OpLoad %int %treeIndex + %110 = OpAccessChain %_ptr_Private_int %tree_1 %107 %uint_2 + OpStore %110 %109 + %112 = OpLoad %int %treeIndex + %113 = OpAccessChain %_ptr_Private_BST %tree_1 %112 + %114 = OpLoad %BST %113 + OpStore %param_2 %114 + %116 = OpLoad %int %data_1 + OpStore %param_3 %116 + %117 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_2 %param_3 + %120 = OpLoad %BST %param_2 + %121 = OpAccessChain %_ptr_Private_BST %tree_1 %112 + OpStore %121 %120 + OpReturn + %106 = OpLabel + %122 = OpLoad %int %baseIndex + %123 = OpAccessChain %_ptr_Private_int %tree_1 %122 %uint_2 + %124 = OpLoad %int %123 + OpStore %baseIndex %124 + OpBranch %54 + %104 = OpLabel + OpReturn + %71 = OpLabel + OpReturn + %54 = OpLabel + OpBranch %52 + %53 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %125 + %target = OpFunctionParameter %_ptr_Function_int + %128 = OpLabel + %index = OpVariable %_ptr_Function_int Function %45 +%currentNode = OpVariable %_ptr_Function_BST Function %47 + %x_231 = OpVariable %_ptr_Function_int Function %45 + OpStore %index %int_0 + OpBranch %132 + %132 = OpLabel + OpLoopMerge %133 %134 None + OpBranch %135 + %135 = OpLabel + %136 = OpLoad %int %index + %137 = OpINotEqual %bool %136 %int_n1 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %140 + %139 = OpLabel + OpBranch %138 + %140 = OpLabel + OpBranch %133 + %138 = OpLabel + %141 = OpLoad %int %index + %142 = OpAccessChain %_ptr_Private_BST %tree_1 %141 + %143 = OpLoad %BST %142 + OpStore %currentNode %143 + %144 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %145 = OpLoad %int %144 + %147 = OpLoad %int %target + %148 = OpIEqual %bool %145 %147 + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %149 + %150 = OpLabel + %152 = OpLoad %int %target + OpReturnValue %152 + %149 = OpLabel + %154 = OpLoad %int %target + %155 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %156 = OpLoad %int %155 + %157 = OpSGreaterThan %bool %154 %156 + OpSelectionMerge %158 None + OpBranchConditional %157 %159 %160 + %159 = OpLabel + %161 = OpAccessChain %_ptr_Function_int %currentNode %uint_2 + %162 = OpLoad %int %161 + OpStore %x_231 %162 + OpBranch %158 + %160 = OpLabel + %163 = OpAccessChain %_ptr_Function_int %currentNode %uint_1 + %164 = OpLoad %int %163 + OpStore %x_231 %164 + OpBranch %158 + %158 = OpLabel + %165 = OpLoad %int %x_231 + OpStore %index %165 + OpBranch %134 + %134 = OpLabel + OpBranch %132 + %133 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd + %main_1 = OpFunction %void None %166 + %168 = OpLabel +%treeIndex_1 = OpVariable %_ptr_Function_int Function %45 + %param_4 = OpVariable %_ptr_Function_BST Function %47 + %param_5 = OpVariable %_ptr_Function_int Function %45 + %param_6 = OpVariable %_ptr_Function_int Function %45 + %param_7 = OpVariable %_ptr_Function_int Function %45 + %param_8 = OpVariable %_ptr_Function_int Function %45 + %param_9 = OpVariable %_ptr_Function_int Function %45 + %param_10 = OpVariable %_ptr_Function_int Function %45 + %param_11 = OpVariable %_ptr_Function_int Function %45 + %param_12 = OpVariable %_ptr_Function_int Function %45 + %param_13 = OpVariable %_ptr_Function_int Function %45 + %param_14 = OpVariable %_ptr_Function_int Function %45 + %param_15 = OpVariable %_ptr_Function_int Function %45 + %param_16 = OpVariable %_ptr_Function_int Function %45 + %param_17 = OpVariable %_ptr_Function_int Function %45 + %param_18 = OpVariable %_ptr_Function_int Function %45 + %param_19 = OpVariable %_ptr_Function_int Function %45 + %param_20 = OpVariable %_ptr_Function_int Function %45 + %param_21 = OpVariable %_ptr_Function_int Function %45 + %param_22 = OpVariable %_ptr_Function_int Function %45 + %param_23 = OpVariable %_ptr_Function_int Function %45 + %count = OpVariable %_ptr_Function_int Function %45 + %i = OpVariable %_ptr_Function_int Function %45 + %result = OpVariable %_ptr_Function_int Function %45 + %param_24 = OpVariable %_ptr_Function_int Function %45 + %x_155 = OpVariable %_ptr_Function_bool Function %278 + %x_156_phi = OpVariable %_ptr_Function_bool Function %278 + OpStore %treeIndex_1 %int_0 + %194 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + %195 = OpLoad %BST %194 + OpStore %param_4 %195 + OpStore %param_5 %int_9 + %197 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_4 %param_5 + %200 = OpLoad %BST %param_4 + %201 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + OpStore %201 %200 + %202 = OpLoad %int %treeIndex_1 + %204 = OpIAdd %int %202 %int_1 + OpStore %treeIndex_1 %204 + %205 = OpLoad %int %treeIndex_1 + OpStore %param_6 %205 + OpStore %param_7 %int_5 + %207 = OpFunctionCall %void %insert_i1_i1_ %param_6 %param_7 + %210 = OpLoad %int %treeIndex_1 + %211 = OpIAdd %int %210 %int_1 + OpStore %treeIndex_1 %211 + %212 = OpLoad %int %treeIndex_1 + OpStore %param_8 %212 + OpStore %param_9 %int_12 + %214 = OpFunctionCall %void %insert_i1_i1_ %param_8 %param_9 + %217 = OpLoad %int %treeIndex_1 + %218 = OpIAdd %int %217 %int_1 + OpStore %treeIndex_1 %218 + %219 = OpLoad %int %treeIndex_1 + OpStore %param_10 %219 + OpStore %param_11 %int_15 + %221 = OpFunctionCall %void %insert_i1_i1_ %param_10 %param_11 + %224 = OpLoad %int %treeIndex_1 + %225 = OpIAdd %int %224 %int_1 + OpStore %treeIndex_1 %225 + %226 = OpLoad %int %treeIndex_1 + OpStore %param_12 %226 + OpStore %param_13 %int_7 + %228 = OpFunctionCall %void %insert_i1_i1_ %param_12 %param_13 + %231 = OpLoad %int %treeIndex_1 + %232 = OpIAdd %int %231 %int_1 + OpStore %treeIndex_1 %232 + %233 = OpLoad %int %treeIndex_1 + OpStore %param_14 %233 + OpStore %param_15 %int_8 + %235 = OpFunctionCall %void %insert_i1_i1_ %param_14 %param_15 + %238 = OpLoad %int %treeIndex_1 + %239 = OpIAdd %int %238 %int_1 + OpStore %treeIndex_1 %239 + %240 = OpLoad %int %treeIndex_1 + OpStore %param_16 %240 + OpStore %param_17 %int_2 + %242 = OpFunctionCall %void %insert_i1_i1_ %param_16 %param_17 + %245 = OpLoad %int %treeIndex_1 + %246 = OpIAdd %int %245 %int_1 + OpStore %treeIndex_1 %246 + %247 = OpLoad %int %treeIndex_1 + OpStore %param_18 %247 + OpStore %param_19 %int_6 + %249 = OpFunctionCall %void %insert_i1_i1_ %param_18 %param_19 + %252 = OpLoad %int %treeIndex_1 + %253 = OpIAdd %int %252 %int_1 + OpStore %treeIndex_1 %253 + %254 = OpLoad %int %treeIndex_1 + OpStore %param_20 %254 + OpStore %param_21 %int_17 + %256 = OpFunctionCall %void %insert_i1_i1_ %param_20 %param_21 + %259 = OpLoad %int %treeIndex_1 + %260 = OpIAdd %int %259 %int_1 + OpStore %treeIndex_1 %260 + %261 = OpLoad %int %treeIndex_1 + OpStore %param_22 %261 + OpStore %param_23 %int_13 + %263 = OpFunctionCall %void %insert_i1_i1_ %param_22 %param_23 + OpStore %count %int_0 + OpStore %i %int_0 + OpBranch %266 + %266 = OpLabel + OpLoopMerge %267 %268 None + OpBranch %269 + %269 = OpLabel + %270 = OpLoad %int %i + %272 = OpSLessThan %bool %270 %int_20 + OpSelectionMerge %273 None + OpBranchConditional %272 %274 %275 + %274 = OpLabel + OpBranch %273 + %275 = OpLabel + OpBranch %267 + %273 = OpLabel + %280 = OpLoad %int %i + OpStore %param_24 %280 + %281 = OpFunctionCall %int %search_i1_ %param_24 + OpStore %result %281 + %283 = OpLoad %int %i + OpSelectionMerge %284 None + OpSwitch %283 %285 2 %286 5 %286 6 %286 7 %286 8 %286 9 %286 12 %286 13 %286 15 %286 17 %286 + %286 = OpLabel + %287 = OpLoad %int %result + %288 = OpLoad %int %i + %289 = OpIEqual %bool %287 %288 + OpStore %x_156_phi %289 + %290 = OpLogicalNot %bool %289 + OpSelectionMerge %291 None + OpBranchConditional %290 %292 %291 + %292 = OpLabel + %294 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %295 = OpLoad %float %294 + %297 = OpFOrdLessThan %bool %295 %float_0 + OpStore %x_155 %297 + %298 = OpLoad %bool %x_155 + OpStore %x_156_phi %298 + OpBranch %291 + %291 = OpLabel + %299 = OpLoad %bool %x_156_phi + OpSelectionMerge %300 None + OpBranchConditional %299 %301 %300 + %301 = OpLabel + %302 = OpLoad %int %count + %303 = OpIAdd %int %302 %int_1 + OpStore %count %303 + OpBranch %300 + %300 = OpLabel + OpBranch %284 + %285 = OpLabel + %304 = OpLoad %int %result + %305 = OpIEqual %bool %304 %int_n1 + OpSelectionMerge %306 None + OpBranchConditional %305 %307 %306 + %307 = OpLabel + %308 = OpLoad %int %count + %309 = OpIAdd %int %308 %int_1 + OpStore %count %309 + OpBranch %306 + %306 = OpLabel + OpBranch %284 + %284 = OpLabel + OpBranch %268 + %268 = OpLabel + %310 = OpLoad %int %i + %311 = OpIAdd %int %310 %int_1 + OpStore %i %311 + OpBranch %266 + %267 = OpLabel + %312 = OpLoad %int %count + %313 = OpIEqual %bool %312 %int_20 + OpSelectionMerge %314 None + OpBranchConditional %313 %315 %316 + %315 = OpLabel + OpStore %x_GLF_color %318 + OpBranch %314 + %316 = OpLabel + OpStore %x_GLF_color %319 + OpBranch %314 + %314 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %320 +%tint_symbol_1 = OpFunctionParameter %main_out + %324 = OpLabel + %325 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %325 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %166 + %327 = OpLabel + %328 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %328 + %329 = OpFunctionCall %void %main_1 + %331 = OpLoad %v4float %x_GLF_color + %332 = OpCompositeConstruct %main_out %331 + %330 = OpFunctionCall %void %tint_symbol_3 %332 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..4d268f6d6b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.wgsl @@ -0,0 +1,277 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var tree_1 : array; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(tree : ptr, data : ptr) { + let x_169 : i32 = *(data); + (*(tree)).data = x_169; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_178 : i32 = baseIndex; + let x_179 : i32 = *(treeIndex); + if ((x_178 <= x_179)) { + } else { + break; + } + let x_182 : i32 = *(data_1); + let x_183 : i32 = baseIndex; + let x_185 : i32 = tree_1[x_183].data; + if ((x_182 <= x_185)) { + let x_190 : i32 = baseIndex; + let x_192 : i32 = tree_1[x_190].leftIndex; + if ((x_192 == -1)) { + let x_197 : i32 = baseIndex; + let x_198 : i32 = *(treeIndex); + tree_1[x_197].leftIndex = x_198; + let x_200 : i32 = *(treeIndex); + let x_202 : BST = tree_1[x_200]; + param = x_202; + let x_203 : i32 = *(data_1); + param_1 = x_203; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_205 : BST = param; + tree_1[x_200] = x_205; + return; + } else { + let x_207 : i32 = baseIndex; + let x_209 : i32 = tree_1[x_207].leftIndex; + baseIndex = x_209; + continue; + } + return; + } else { + let x_210 : i32 = baseIndex; + let x_212 : i32 = tree_1[x_210].rightIndex; + if ((x_212 == -1)) { + let x_217 : i32 = baseIndex; + let x_218 : i32 = *(treeIndex); + tree_1[x_217].rightIndex = x_218; + let x_220 : i32 = *(treeIndex); + let x_222 : BST = tree_1[x_220]; + param_2 = x_222; + let x_223 : i32 = *(data_1); + param_3 = x_223; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_225 : BST = param_2; + tree_1[x_220] = x_225; + return; + } else { + let x_227 : i32 = baseIndex; + let x_229 : i32 = tree_1[x_227].rightIndex; + baseIndex = x_229; + continue; + } + return; + } + return; + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_231 : i32; + index = 0; + loop { + let x_236 : i32 = index; + if ((x_236 != -1)) { + } else { + break; + } + let x_239 : i32 = index; + let x_241 : BST = tree_1[x_239]; + currentNode = x_241; + let x_243 : i32 = currentNode.data; + let x_244 : i32 = *(target); + if ((x_243 == x_244)) { + let x_248 : i32 = *(target); + return x_248; + } + let x_249 : i32 = *(target); + let x_251 : i32 = currentNode.data; + if ((x_249 > x_251)) { + let x_257 : i32 = currentNode.rightIndex; + x_231 = x_257; + } else { + let x_259 : i32 = currentNode.leftIndex; + x_231 = x_259; + } + let x_260 : i32 = x_231; + index = x_260; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var count : i32; + var i : i32; + var result : i32; + var param_24 : i32; + treeIndex_1 = 0; + let x_88 : BST = tree_1[0]; + param_4 = x_88; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_90 : BST = param_4; + tree_1[0] = x_90; + let x_92 : i32 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + let x_94 : i32 = treeIndex_1; + param_6 = x_94; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_96 : i32 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + let x_98 : i32 = treeIndex_1; + param_8 = x_98; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_100 : i32 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + let x_102 : i32 = treeIndex_1; + param_10 = x_102; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_104 : i32 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + let x_106 : i32 = treeIndex_1; + param_12 = x_106; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_108 : i32 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + let x_110 : i32 = treeIndex_1; + param_14 = x_110; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_112 : i32 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + let x_114 : i32 = treeIndex_1; + param_16 = x_114; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_116 : i32 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + let x_118 : i32 = treeIndex_1; + param_18 = x_118; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_120 : i32 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + let x_122 : i32 = treeIndex_1; + param_20 = x_122; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_124 : i32 = treeIndex_1; + treeIndex_1 = (x_124 + 1); + let x_126 : i32 = treeIndex_1; + param_22 = x_126; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + count = 0; + i = 0; + loop { + let x_132 : i32 = i; + if ((x_132 < 20)) { + } else { + break; + } + var x_155 : bool; + var x_156_phi : bool; + let x_135 : i32 = i; + param_24 = x_135; + let x_136 : i32 = search_i1_(&(param_24)); + result = x_136; + let x_137 : i32 = i; + switch(x_137) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_147 : i32 = result; + let x_148 : i32 = i; + let x_149 : bool = (x_147 == x_148); + x_156_phi = x_149; + if (!(x_149)) { + let x_154 : f32 = gl_FragCoord.x; + x_155 = (x_154 < 0.0); + x_156_phi = x_155; + } + let x_156 : bool = x_156_phi; + if (x_156) { + let x_159 : i32 = count; + count = (x_159 + 1); + } + } + default: { + let x_141 : i32 = result; + if ((x_141 == -1)) { + let x_145 : i32 = count; + count = (x_145 + 1); + } + } + } + + continuing { + let x_161 : i32 = i; + i = (x_161 + 1); + } + } + let x_163 : i32 = count; + if ((x_163 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl new file mode 100644 index 0000000000..4d268f6d6b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl @@ -0,0 +1,277 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var tree_1 : array; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(tree : ptr, data : ptr) { + let x_169 : i32 = *(data); + (*(tree)).data = x_169; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_178 : i32 = baseIndex; + let x_179 : i32 = *(treeIndex); + if ((x_178 <= x_179)) { + } else { + break; + } + let x_182 : i32 = *(data_1); + let x_183 : i32 = baseIndex; + let x_185 : i32 = tree_1[x_183].data; + if ((x_182 <= x_185)) { + let x_190 : i32 = baseIndex; + let x_192 : i32 = tree_1[x_190].leftIndex; + if ((x_192 == -1)) { + let x_197 : i32 = baseIndex; + let x_198 : i32 = *(treeIndex); + tree_1[x_197].leftIndex = x_198; + let x_200 : i32 = *(treeIndex); + let x_202 : BST = tree_1[x_200]; + param = x_202; + let x_203 : i32 = *(data_1); + param_1 = x_203; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_205 : BST = param; + tree_1[x_200] = x_205; + return; + } else { + let x_207 : i32 = baseIndex; + let x_209 : i32 = tree_1[x_207].leftIndex; + baseIndex = x_209; + continue; + } + return; + } else { + let x_210 : i32 = baseIndex; + let x_212 : i32 = tree_1[x_210].rightIndex; + if ((x_212 == -1)) { + let x_217 : i32 = baseIndex; + let x_218 : i32 = *(treeIndex); + tree_1[x_217].rightIndex = x_218; + let x_220 : i32 = *(treeIndex); + let x_222 : BST = tree_1[x_220]; + param_2 = x_222; + let x_223 : i32 = *(data_1); + param_3 = x_223; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_225 : BST = param_2; + tree_1[x_220] = x_225; + return; + } else { + let x_227 : i32 = baseIndex; + let x_229 : i32 = tree_1[x_227].rightIndex; + baseIndex = x_229; + continue; + } + return; + } + return; + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_231 : i32; + index = 0; + loop { + let x_236 : i32 = index; + if ((x_236 != -1)) { + } else { + break; + } + let x_239 : i32 = index; + let x_241 : BST = tree_1[x_239]; + currentNode = x_241; + let x_243 : i32 = currentNode.data; + let x_244 : i32 = *(target); + if ((x_243 == x_244)) { + let x_248 : i32 = *(target); + return x_248; + } + let x_249 : i32 = *(target); + let x_251 : i32 = currentNode.data; + if ((x_249 > x_251)) { + let x_257 : i32 = currentNode.rightIndex; + x_231 = x_257; + } else { + let x_259 : i32 = currentNode.leftIndex; + x_231 = x_259; + } + let x_260 : i32 = x_231; + index = x_260; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var count : i32; + var i : i32; + var result : i32; + var param_24 : i32; + treeIndex_1 = 0; + let x_88 : BST = tree_1[0]; + param_4 = x_88; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_90 : BST = param_4; + tree_1[0] = x_90; + let x_92 : i32 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + let x_94 : i32 = treeIndex_1; + param_6 = x_94; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_96 : i32 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + let x_98 : i32 = treeIndex_1; + param_8 = x_98; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_100 : i32 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + let x_102 : i32 = treeIndex_1; + param_10 = x_102; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_104 : i32 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + let x_106 : i32 = treeIndex_1; + param_12 = x_106; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_108 : i32 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + let x_110 : i32 = treeIndex_1; + param_14 = x_110; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_112 : i32 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + let x_114 : i32 = treeIndex_1; + param_16 = x_114; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_116 : i32 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + let x_118 : i32 = treeIndex_1; + param_18 = x_118; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_120 : i32 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + let x_122 : i32 = treeIndex_1; + param_20 = x_122; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_124 : i32 = treeIndex_1; + treeIndex_1 = (x_124 + 1); + let x_126 : i32 = treeIndex_1; + param_22 = x_126; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + count = 0; + i = 0; + loop { + let x_132 : i32 = i; + if ((x_132 < 20)) { + } else { + break; + } + var x_155 : bool; + var x_156_phi : bool; + let x_135 : i32 = i; + param_24 = x_135; + let x_136 : i32 = search_i1_(&(param_24)); + result = x_136; + let x_137 : i32 = i; + switch(x_137) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_147 : i32 = result; + let x_148 : i32 = i; + let x_149 : bool = (x_147 == x_148); + x_156_phi = x_149; + if (!(x_149)) { + let x_154 : f32 = gl_FragCoord.x; + x_155 = (x_154 < 0.0); + x_156_phi = x_155; + } + let x_156 : bool = x_156_phi; + if (x_156) { + let x_159 : i32 = count; + count = (x_159 + 1); + } + } + default: { + let x_141 : i32 = result; + if ((x_141 == -1)) { + let x_145 : i32 = count; + count = (x_145 + 1); + } + } + } + + continuing { + let x_161 : i32 = i; + i = (x_161 + 1); + } + } + let x_163 : i32 = count; + if ((x_163 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..d3b022e76d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.hlsl @@ -0,0 +1,247 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree_1[10] = (BST[10])0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_169 = data; + tree.data = x_169; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + while (true) { + const int x_178 = baseIndex; + const int x_179 = treeIndex; + if ((x_178 <= x_179)) { + } else { + break; + } + const int x_182 = data_1; + const int x_185 = tree_1[baseIndex].data; + if ((x_182 <= x_185)) { + const int x_192 = tree_1[baseIndex].leftIndex; + if ((x_192 == -1)) { + const int x_197 = baseIndex; + const int x_198 = treeIndex; + tree_1[x_197].leftIndex = x_198; + const int x_200 = treeIndex; + const BST x_202 = tree_1[x_200]; + param = x_202; + const int x_203 = data_1; + param_1 = x_203; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_200] = param; + return; + } else { + const int x_209 = tree_1[baseIndex].leftIndex; + baseIndex = x_209; + continue; + } + return; + } else { + const int x_212 = tree_1[baseIndex].rightIndex; + if ((x_212 == -1)) { + const int x_217 = baseIndex; + const int x_218 = treeIndex; + tree_1[x_217].rightIndex = x_218; + const int x_220 = treeIndex; + const BST x_222 = tree_1[x_220]; + param_2 = x_222; + const int x_223 = data_1; + param_3 = x_223; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_220] = param_2; + return; + } else { + const int x_229 = tree_1[baseIndex].rightIndex; + baseIndex = x_229; + continue; + } + return; + } + return; + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_231 = 0; + index = 0; + while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_241 = tree_1[index]; + currentNode = x_241; + const int x_243 = currentNode.data; + const int x_244 = target; + if ((x_243 == x_244)) { + const int x_248 = target; + return x_248; + } + const int x_249 = target; + const int x_251 = currentNode.data; + if ((x_249 > x_251)) { + const int x_257 = currentNode.rightIndex; + x_231 = x_257; + } else { + const int x_259 = currentNode.leftIndex; + x_231 = x_259; + } + index = x_231; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_88 = tree_1[0]; + param_4 = x_88; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree_1[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + for(; (i < 20); i = (i + 1)) { + bool x_155 = false; + bool x_156_phi = false; + param_24 = i; + const int x_136 = search_i1_(param_24); + result = x_136; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + const bool x_149 = (result == i); + x_156_phi = x_149; + if (!(x_149)) { + const float x_154 = gl_FragCoord.x; + x_155 = (x_154 < 0.0f); + x_156_phi = x_155; + } + if (x_156_phi) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.msl new file mode 100644 index 0000000000..80d83c81fa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.msl @@ -0,0 +1,293 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const tree, thread int* const data) { + int const x_169 = *(data); + (*(tree)).data = x_169; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_5) { + int baseIndex = 0; + BST param = {}; + int param_1 = 0; + BST param_2 = {}; + int param_3 = 0; + baseIndex = 0; + while (true) { + int const x_178 = baseIndex; + int const x_179 = *(treeIndex); + if ((x_178 <= x_179)) { + } else { + break; + } + int const x_182 = *(data_1); + int const x_183 = baseIndex; + int const x_185 = (*(tint_symbol_5)).arr[x_183].data; + if ((x_182 <= x_185)) { + int const x_190 = baseIndex; + int const x_192 = (*(tint_symbol_5)).arr[x_190].leftIndex; + if ((x_192 == -1)) { + int const x_197 = baseIndex; + int const x_198 = *(treeIndex); + (*(tint_symbol_5)).arr[x_197].leftIndex = x_198; + int const x_200 = *(treeIndex); + BST const x_202 = (*(tint_symbol_5)).arr[x_200]; + param = x_202; + int const x_203 = *(data_1); + param_1 = x_203; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + BST const x_205 = param; + (*(tint_symbol_5)).arr[x_200] = x_205; + return; + } else { + int const x_207 = baseIndex; + int const x_209 = (*(tint_symbol_5)).arr[x_207].leftIndex; + baseIndex = x_209; + continue; + } + return; + } else { + int const x_210 = baseIndex; + int const x_212 = (*(tint_symbol_5)).arr[x_210].rightIndex; + if ((x_212 == -1)) { + int const x_217 = baseIndex; + int const x_218 = *(treeIndex); + (*(tint_symbol_5)).arr[x_217].rightIndex = x_218; + int const x_220 = *(treeIndex); + BST const x_222 = (*(tint_symbol_5)).arr[x_220]; + param_2 = x_222; + int const x_223 = *(data_1); + param_3 = x_223; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + BST const x_225 = param_2; + (*(tint_symbol_5)).arr[x_220] = x_225; + return; + } else { + int const x_227 = baseIndex; + int const x_229 = (*(tint_symbol_5)).arr[x_227].rightIndex; + baseIndex = x_229; + continue; + } + return; + } + return; + } + return; +} + +int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_6) { + int index = 0; + BST currentNode = {}; + int x_231 = 0; + index = 0; + while (true) { + int const x_236 = index; + if ((x_236 != -1)) { + } else { + break; + } + int const x_239 = index; + BST const x_241 = (*(tint_symbol_6)).arr[x_239]; + currentNode = x_241; + int const x_243 = currentNode.data; + int const x_244 = *(target); + if ((x_243 == x_244)) { + int const x_248 = *(target); + return x_248; + } + int const x_249 = *(target); + int const x_251 = currentNode.data; + if ((x_249 > x_251)) { + int const x_257 = currentNode.rightIndex; + x_231 = x_257; + } else { + int const x_259 = currentNode.leftIndex; + x_231 = x_259; + } + int const x_260 = x_231; + index = x_260; + } + return -1; +} + +void main_1(thread tint_array_wrapper* const tint_symbol_7, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) { + int treeIndex_1 = 0; + BST param_4 = {}; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + BST const x_88 = (*(tint_symbol_7)).arr[0]; + param_4 = x_88; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + BST const x_90 = param_4; + (*(tint_symbol_7)).arr[0] = x_90; + int const x_92 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + int const x_94 = treeIndex_1; + param_6 = x_94; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7), tint_symbol_7); + int const x_96 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + int const x_98 = treeIndex_1; + param_8 = x_98; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9), tint_symbol_7); + int const x_100 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + int const x_102 = treeIndex_1; + param_10 = x_102; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11), tint_symbol_7); + int const x_104 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + int const x_106 = treeIndex_1; + param_12 = x_106; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13), tint_symbol_7); + int const x_108 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + int const x_110 = treeIndex_1; + param_14 = x_110; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15), tint_symbol_7); + int const x_112 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + int const x_114 = treeIndex_1; + param_16 = x_114; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17), tint_symbol_7); + int const x_116 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + int const x_118 = treeIndex_1; + param_18 = x_118; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19), tint_symbol_7); + int const x_120 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + int const x_122 = treeIndex_1; + param_20 = x_122; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21), tint_symbol_7); + int const x_124 = treeIndex_1; + treeIndex_1 = (x_124 + 1); + int const x_126 = treeIndex_1; + param_22 = x_126; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23), tint_symbol_7); + count = 0; + i = 0; + while (true) { + int const x_132 = i; + if ((x_132 < 20)) { + } else { + break; + } + bool x_155 = false; + bool x_156_phi = false; + int const x_135 = i; + param_24 = x_135; + int const x_136 = search_i1_(&(param_24), tint_symbol_7); + result = x_136; + int const x_137 = i; + switch(x_137) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + int const x_147 = result; + int const x_148 = i; + bool const x_149 = (x_147 == x_148); + x_156_phi = x_149; + if (!(x_149)) { + float const x_154 = (*(tint_symbol_8)).x; + x_155 = (x_154 < 0.0f); + x_156_phi = x_155; + } + bool const x_156 = x_156_phi; + if (x_156) { + int const x_159 = count; + count = (x_159 + 1); + } + break; + } + default: { + int const x_141 = result; + if ((x_141 == -1)) { + int const x_145 = count; + count = (x_145 + 1); + } + break; + } + } + { + int const x_161 = i; + i = (x_161 + 1); + } + } + int const x_163 = count; + if ((x_163 == 20)) { + *(tint_symbol_9) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_9) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_10 = 0.0f; + thread tint_array_wrapper tint_symbol_11 = {}; + thread float4 tint_symbol_12 = 0.0f; + tint_symbol_10 = gl_FragCoord_param; + main_1(&(tint_symbol_11), &(tint_symbol_10), &(tint_symbol_12)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..b62cb2f27c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.spvasm @@ -0,0 +1,505 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 333 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree_1 "tree_1" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode_struct_BST_i1_i1_i11_i1_" + OpName %tree "tree" + OpName %data "data" + OpName %insert_i1_i1_ "insert_i1_i1_" + OpName %treeIndex "treeIndex" + OpName %data_1 "data_1" + OpName %baseIndex "baseIndex" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %search_i1_ "search_i1_" + OpName %target "target" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %x_231 "x_231" + OpName %main_1 "main_1" + OpName %treeIndex_1 "treeIndex_1" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %param_10 "param_10" + OpName %param_11 "param_11" + OpName %param_12 "param_12" + OpName %param_13 "param_13" + OpName %param_14 "param_14" + OpName %param_15 "param_15" + OpName %param_16 "param_16" + OpName %param_17 "param_17" + OpName %param_18 "param_18" + OpName %param_19 "param_19" + OpName %param_20 "param_20" + OpName %param_21 "param_21" + OpName %param_22 "param_22" + OpName %param_23 "param_23" + OpName %count "count" + OpName %i "i" + OpName %result "result" + OpName %param_24 "param_24" + OpName %x_155 "x_155" + OpName %x_156_phi "x_156_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %8 = OpConstantNull %_arr_BST_uint_10 + %tree_1 = OpVariable %_ptr_Private__arr_BST_uint_10 Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %13 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int_n1 = OpConstant %int -1 + %uint_2 = OpConstant %uint 2 + %39 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %45 = OpConstantNull %int + %47 = OpConstantNull %BST + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %125 = OpTypeFunction %int %_ptr_Function_int + %166 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 +%_ptr_Function_bool = OpTypePointer Function %bool + %278 = OpConstantNull %bool +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %318 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %319 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %320 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %19 + %tree = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %26 = OpLabel + %28 = OpLoad %int %data + %31 = OpAccessChain %_ptr_Function_int %tree %uint_0 + OpStore %31 %28 + %34 = OpAccessChain %_ptr_Function_int %tree %uint_1 + OpStore %34 %int_n1 + %38 = OpAccessChain %_ptr_Function_int %tree %uint_2 + OpStore %38 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %39 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_1 = OpFunctionParameter %_ptr_Function_int + %43 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function %45 + %param = OpVariable %_ptr_Function_BST Function %47 + %param_1 = OpVariable %_ptr_Function_int Function %45 + %param_2 = OpVariable %_ptr_Function_BST Function %47 + %param_3 = OpVariable %_ptr_Function_int Function %45 + OpStore %baseIndex %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %baseIndex + %58 = OpLoad %int %treeIndex + %59 = OpSLessThanEqual %bool %56 %58 + OpSelectionMerge %61 None + OpBranchConditional %59 %62 %63 + %62 = OpLabel + OpBranch %61 + %63 = OpLabel + OpBranch %53 + %61 = OpLabel + %65 = OpLoad %int %data_1 + %66 = OpLoad %int %baseIndex + %68 = OpAccessChain %_ptr_Private_int %tree_1 %66 %uint_0 + %69 = OpLoad %int %68 + %70 = OpSLessThanEqual %bool %65 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %baseIndex + %75 = OpAccessChain %_ptr_Private_int %tree_1 %74 %uint_1 + %76 = OpLoad %int %75 + %77 = OpIEqual %bool %76 %int_n1 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + %81 = OpLoad %int %baseIndex + %83 = OpLoad %int %treeIndex + %84 = OpAccessChain %_ptr_Private_int %tree_1 %81 %uint_1 + OpStore %84 %83 + %86 = OpLoad %int %treeIndex + %88 = OpAccessChain %_ptr_Private_BST %tree_1 %86 + %89 = OpLoad %BST %88 + OpStore %param %89 + %91 = OpLoad %int %data_1 + OpStore %param_1 %91 + %92 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_1 + %95 = OpLoad %BST %param + %96 = OpAccessChain %_ptr_Private_BST %tree_1 %86 + OpStore %96 %95 + OpReturn + %80 = OpLabel + %97 = OpLoad %int %baseIndex + %98 = OpAccessChain %_ptr_Private_int %tree_1 %97 %uint_1 + %99 = OpLoad %int %98 + OpStore %baseIndex %99 + OpBranch %54 + %78 = OpLabel + OpReturn + %73 = OpLabel + %100 = OpLoad %int %baseIndex + %101 = OpAccessChain %_ptr_Private_int %tree_1 %100 %uint_2 + %102 = OpLoad %int %101 + %103 = OpIEqual %bool %102 %int_n1 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %106 + %105 = OpLabel + %107 = OpLoad %int %baseIndex + %109 = OpLoad %int %treeIndex + %110 = OpAccessChain %_ptr_Private_int %tree_1 %107 %uint_2 + OpStore %110 %109 + %112 = OpLoad %int %treeIndex + %113 = OpAccessChain %_ptr_Private_BST %tree_1 %112 + %114 = OpLoad %BST %113 + OpStore %param_2 %114 + %116 = OpLoad %int %data_1 + OpStore %param_3 %116 + %117 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_2 %param_3 + %120 = OpLoad %BST %param_2 + %121 = OpAccessChain %_ptr_Private_BST %tree_1 %112 + OpStore %121 %120 + OpReturn + %106 = OpLabel + %122 = OpLoad %int %baseIndex + %123 = OpAccessChain %_ptr_Private_int %tree_1 %122 %uint_2 + %124 = OpLoad %int %123 + OpStore %baseIndex %124 + OpBranch %54 + %104 = OpLabel + OpReturn + %71 = OpLabel + OpReturn + %54 = OpLabel + OpBranch %52 + %53 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %125 + %target = OpFunctionParameter %_ptr_Function_int + %128 = OpLabel + %index = OpVariable %_ptr_Function_int Function %45 +%currentNode = OpVariable %_ptr_Function_BST Function %47 + %x_231 = OpVariable %_ptr_Function_int Function %45 + OpStore %index %int_0 + OpBranch %132 + %132 = OpLabel + OpLoopMerge %133 %134 None + OpBranch %135 + %135 = OpLabel + %136 = OpLoad %int %index + %137 = OpINotEqual %bool %136 %int_n1 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %140 + %139 = OpLabel + OpBranch %138 + %140 = OpLabel + OpBranch %133 + %138 = OpLabel + %141 = OpLoad %int %index + %142 = OpAccessChain %_ptr_Private_BST %tree_1 %141 + %143 = OpLoad %BST %142 + OpStore %currentNode %143 + %144 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %145 = OpLoad %int %144 + %147 = OpLoad %int %target + %148 = OpIEqual %bool %145 %147 + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %149 + %150 = OpLabel + %152 = OpLoad %int %target + OpReturnValue %152 + %149 = OpLabel + %154 = OpLoad %int %target + %155 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %156 = OpLoad %int %155 + %157 = OpSGreaterThan %bool %154 %156 + OpSelectionMerge %158 None + OpBranchConditional %157 %159 %160 + %159 = OpLabel + %161 = OpAccessChain %_ptr_Function_int %currentNode %uint_2 + %162 = OpLoad %int %161 + OpStore %x_231 %162 + OpBranch %158 + %160 = OpLabel + %163 = OpAccessChain %_ptr_Function_int %currentNode %uint_1 + %164 = OpLoad %int %163 + OpStore %x_231 %164 + OpBranch %158 + %158 = OpLabel + %165 = OpLoad %int %x_231 + OpStore %index %165 + OpBranch %134 + %134 = OpLabel + OpBranch %132 + %133 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd + %main_1 = OpFunction %void None %166 + %168 = OpLabel +%treeIndex_1 = OpVariable %_ptr_Function_int Function %45 + %param_4 = OpVariable %_ptr_Function_BST Function %47 + %param_5 = OpVariable %_ptr_Function_int Function %45 + %param_6 = OpVariable %_ptr_Function_int Function %45 + %param_7 = OpVariable %_ptr_Function_int Function %45 + %param_8 = OpVariable %_ptr_Function_int Function %45 + %param_9 = OpVariable %_ptr_Function_int Function %45 + %param_10 = OpVariable %_ptr_Function_int Function %45 + %param_11 = OpVariable %_ptr_Function_int Function %45 + %param_12 = OpVariable %_ptr_Function_int Function %45 + %param_13 = OpVariable %_ptr_Function_int Function %45 + %param_14 = OpVariable %_ptr_Function_int Function %45 + %param_15 = OpVariable %_ptr_Function_int Function %45 + %param_16 = OpVariable %_ptr_Function_int Function %45 + %param_17 = OpVariable %_ptr_Function_int Function %45 + %param_18 = OpVariable %_ptr_Function_int Function %45 + %param_19 = OpVariable %_ptr_Function_int Function %45 + %param_20 = OpVariable %_ptr_Function_int Function %45 + %param_21 = OpVariable %_ptr_Function_int Function %45 + %param_22 = OpVariable %_ptr_Function_int Function %45 + %param_23 = OpVariable %_ptr_Function_int Function %45 + %count = OpVariable %_ptr_Function_int Function %45 + %i = OpVariable %_ptr_Function_int Function %45 + %result = OpVariable %_ptr_Function_int Function %45 + %param_24 = OpVariable %_ptr_Function_int Function %45 + %x_155 = OpVariable %_ptr_Function_bool Function %278 + %x_156_phi = OpVariable %_ptr_Function_bool Function %278 + OpStore %treeIndex_1 %int_0 + %194 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + %195 = OpLoad %BST %194 + OpStore %param_4 %195 + OpStore %param_5 %int_9 + %197 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_4 %param_5 + %200 = OpLoad %BST %param_4 + %201 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + OpStore %201 %200 + %202 = OpLoad %int %treeIndex_1 + %204 = OpIAdd %int %202 %int_1 + OpStore %treeIndex_1 %204 + %205 = OpLoad %int %treeIndex_1 + OpStore %param_6 %205 + OpStore %param_7 %int_5 + %207 = OpFunctionCall %void %insert_i1_i1_ %param_6 %param_7 + %210 = OpLoad %int %treeIndex_1 + %211 = OpIAdd %int %210 %int_1 + OpStore %treeIndex_1 %211 + %212 = OpLoad %int %treeIndex_1 + OpStore %param_8 %212 + OpStore %param_9 %int_12 + %214 = OpFunctionCall %void %insert_i1_i1_ %param_8 %param_9 + %217 = OpLoad %int %treeIndex_1 + %218 = OpIAdd %int %217 %int_1 + OpStore %treeIndex_1 %218 + %219 = OpLoad %int %treeIndex_1 + OpStore %param_10 %219 + OpStore %param_11 %int_15 + %221 = OpFunctionCall %void %insert_i1_i1_ %param_10 %param_11 + %224 = OpLoad %int %treeIndex_1 + %225 = OpIAdd %int %224 %int_1 + OpStore %treeIndex_1 %225 + %226 = OpLoad %int %treeIndex_1 + OpStore %param_12 %226 + OpStore %param_13 %int_7 + %228 = OpFunctionCall %void %insert_i1_i1_ %param_12 %param_13 + %231 = OpLoad %int %treeIndex_1 + %232 = OpIAdd %int %231 %int_1 + OpStore %treeIndex_1 %232 + %233 = OpLoad %int %treeIndex_1 + OpStore %param_14 %233 + OpStore %param_15 %int_8 + %235 = OpFunctionCall %void %insert_i1_i1_ %param_14 %param_15 + %238 = OpLoad %int %treeIndex_1 + %239 = OpIAdd %int %238 %int_1 + OpStore %treeIndex_1 %239 + %240 = OpLoad %int %treeIndex_1 + OpStore %param_16 %240 + OpStore %param_17 %int_2 + %242 = OpFunctionCall %void %insert_i1_i1_ %param_16 %param_17 + %245 = OpLoad %int %treeIndex_1 + %246 = OpIAdd %int %245 %int_1 + OpStore %treeIndex_1 %246 + %247 = OpLoad %int %treeIndex_1 + OpStore %param_18 %247 + OpStore %param_19 %int_6 + %249 = OpFunctionCall %void %insert_i1_i1_ %param_18 %param_19 + %252 = OpLoad %int %treeIndex_1 + %253 = OpIAdd %int %252 %int_1 + OpStore %treeIndex_1 %253 + %254 = OpLoad %int %treeIndex_1 + OpStore %param_20 %254 + OpStore %param_21 %int_17 + %256 = OpFunctionCall %void %insert_i1_i1_ %param_20 %param_21 + %259 = OpLoad %int %treeIndex_1 + %260 = OpIAdd %int %259 %int_1 + OpStore %treeIndex_1 %260 + %261 = OpLoad %int %treeIndex_1 + OpStore %param_22 %261 + OpStore %param_23 %int_13 + %263 = OpFunctionCall %void %insert_i1_i1_ %param_22 %param_23 + OpStore %count %int_0 + OpStore %i %int_0 + OpBranch %266 + %266 = OpLabel + OpLoopMerge %267 %268 None + OpBranch %269 + %269 = OpLabel + %270 = OpLoad %int %i + %272 = OpSLessThan %bool %270 %int_20 + OpSelectionMerge %273 None + OpBranchConditional %272 %274 %275 + %274 = OpLabel + OpBranch %273 + %275 = OpLabel + OpBranch %267 + %273 = OpLabel + %280 = OpLoad %int %i + OpStore %param_24 %280 + %281 = OpFunctionCall %int %search_i1_ %param_24 + OpStore %result %281 + %283 = OpLoad %int %i + OpSelectionMerge %284 None + OpSwitch %283 %285 2 %286 5 %286 6 %286 7 %286 8 %286 9 %286 12 %286 13 %286 15 %286 17 %286 + %286 = OpLabel + %287 = OpLoad %int %result + %288 = OpLoad %int %i + %289 = OpIEqual %bool %287 %288 + OpStore %x_156_phi %289 + %290 = OpLogicalNot %bool %289 + OpSelectionMerge %291 None + OpBranchConditional %290 %292 %291 + %292 = OpLabel + %294 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %295 = OpLoad %float %294 + %297 = OpFOrdLessThan %bool %295 %float_0 + OpStore %x_155 %297 + %298 = OpLoad %bool %x_155 + OpStore %x_156_phi %298 + OpBranch %291 + %291 = OpLabel + %299 = OpLoad %bool %x_156_phi + OpSelectionMerge %300 None + OpBranchConditional %299 %301 %300 + %301 = OpLabel + %302 = OpLoad %int %count + %303 = OpIAdd %int %302 %int_1 + OpStore %count %303 + OpBranch %300 + %300 = OpLabel + OpBranch %284 + %285 = OpLabel + %304 = OpLoad %int %result + %305 = OpIEqual %bool %304 %int_n1 + OpSelectionMerge %306 None + OpBranchConditional %305 %307 %306 + %307 = OpLabel + %308 = OpLoad %int %count + %309 = OpIAdd %int %308 %int_1 + OpStore %count %309 + OpBranch %306 + %306 = OpLabel + OpBranch %284 + %284 = OpLabel + OpBranch %268 + %268 = OpLabel + %310 = OpLoad %int %i + %311 = OpIAdd %int %310 %int_1 + OpStore %i %311 + OpBranch %266 + %267 = OpLabel + %312 = OpLoad %int %count + %313 = OpIEqual %bool %312 %int_20 + OpSelectionMerge %314 None + OpBranchConditional %313 %315 %316 + %315 = OpLabel + OpStore %x_GLF_color %318 + OpBranch %314 + %316 = OpLabel + OpStore %x_GLF_color %319 + OpBranch %314 + %314 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %320 +%tint_symbol_1 = OpFunctionParameter %main_out + %324 = OpLabel + %325 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %325 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %166 + %327 = OpLabel + %328 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %328 + %329 = OpFunctionCall %void %main_1 + %331 = OpLoad %v4float %x_GLF_color + %332 = OpCompositeConstruct %main_out %331 + %330 = OpFunctionCall %void %tint_symbol_3 %332 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..4d268f6d6b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.wgsl @@ -0,0 +1,277 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var tree_1 : array; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(tree : ptr, data : ptr) { + let x_169 : i32 = *(data); + (*(tree)).data = x_169; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_178 : i32 = baseIndex; + let x_179 : i32 = *(treeIndex); + if ((x_178 <= x_179)) { + } else { + break; + } + let x_182 : i32 = *(data_1); + let x_183 : i32 = baseIndex; + let x_185 : i32 = tree_1[x_183].data; + if ((x_182 <= x_185)) { + let x_190 : i32 = baseIndex; + let x_192 : i32 = tree_1[x_190].leftIndex; + if ((x_192 == -1)) { + let x_197 : i32 = baseIndex; + let x_198 : i32 = *(treeIndex); + tree_1[x_197].leftIndex = x_198; + let x_200 : i32 = *(treeIndex); + let x_202 : BST = tree_1[x_200]; + param = x_202; + let x_203 : i32 = *(data_1); + param_1 = x_203; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_205 : BST = param; + tree_1[x_200] = x_205; + return; + } else { + let x_207 : i32 = baseIndex; + let x_209 : i32 = tree_1[x_207].leftIndex; + baseIndex = x_209; + continue; + } + return; + } else { + let x_210 : i32 = baseIndex; + let x_212 : i32 = tree_1[x_210].rightIndex; + if ((x_212 == -1)) { + let x_217 : i32 = baseIndex; + let x_218 : i32 = *(treeIndex); + tree_1[x_217].rightIndex = x_218; + let x_220 : i32 = *(treeIndex); + let x_222 : BST = tree_1[x_220]; + param_2 = x_222; + let x_223 : i32 = *(data_1); + param_3 = x_223; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_225 : BST = param_2; + tree_1[x_220] = x_225; + return; + } else { + let x_227 : i32 = baseIndex; + let x_229 : i32 = tree_1[x_227].rightIndex; + baseIndex = x_229; + continue; + } + return; + } + return; + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_231 : i32; + index = 0; + loop { + let x_236 : i32 = index; + if ((x_236 != -1)) { + } else { + break; + } + let x_239 : i32 = index; + let x_241 : BST = tree_1[x_239]; + currentNode = x_241; + let x_243 : i32 = currentNode.data; + let x_244 : i32 = *(target); + if ((x_243 == x_244)) { + let x_248 : i32 = *(target); + return x_248; + } + let x_249 : i32 = *(target); + let x_251 : i32 = currentNode.data; + if ((x_249 > x_251)) { + let x_257 : i32 = currentNode.rightIndex; + x_231 = x_257; + } else { + let x_259 : i32 = currentNode.leftIndex; + x_231 = x_259; + } + let x_260 : i32 = x_231; + index = x_260; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var count : i32; + var i : i32; + var result : i32; + var param_24 : i32; + treeIndex_1 = 0; + let x_88 : BST = tree_1[0]; + param_4 = x_88; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_90 : BST = param_4; + tree_1[0] = x_90; + let x_92 : i32 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + let x_94 : i32 = treeIndex_1; + param_6 = x_94; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_96 : i32 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + let x_98 : i32 = treeIndex_1; + param_8 = x_98; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_100 : i32 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + let x_102 : i32 = treeIndex_1; + param_10 = x_102; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_104 : i32 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + let x_106 : i32 = treeIndex_1; + param_12 = x_106; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_108 : i32 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + let x_110 : i32 = treeIndex_1; + param_14 = x_110; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_112 : i32 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + let x_114 : i32 = treeIndex_1; + param_16 = x_114; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_116 : i32 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + let x_118 : i32 = treeIndex_1; + param_18 = x_118; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_120 : i32 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + let x_122 : i32 = treeIndex_1; + param_20 = x_122; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_124 : i32 = treeIndex_1; + treeIndex_1 = (x_124 + 1); + let x_126 : i32 = treeIndex_1; + param_22 = x_126; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + count = 0; + i = 0; + loop { + let x_132 : i32 = i; + if ((x_132 < 20)) { + } else { + break; + } + var x_155 : bool; + var x_156_phi : bool; + let x_135 : i32 = i; + param_24 = x_135; + let x_136 : i32 = search_i1_(&(param_24)); + result = x_136; + let x_137 : i32 = i; + switch(x_137) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_147 : i32 = result; + let x_148 : i32 = i; + let x_149 : bool = (x_147 == x_148); + x_156_phi = x_149; + if (!(x_149)) { + let x_154 : f32 = gl_FragCoord.x; + x_155 = (x_154 < 0.0); + x_156_phi = x_155; + } + let x_156 : bool = x_156_phi; + if (x_156) { + let x_159 : i32 = count; + count = (x_159 + 1); + } + } + default: { + let x_141 : i32 = result; + if ((x_141 == -1)) { + let x_145 : i32 = count; + count = (x_145 + 1); + } + } + } + + continuing { + let x_161 : i32 = i; + i = (x_161 + 1); + } + } + let x_163 : i32 = count; + if ((x_163 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm new file mode 100644 index 0000000000..be49363a34 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm @@ -0,0 +1,483 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode(struct-BST-i1-i1-i11;i1;" + OpName %tree "tree" + OpName %data "data" + OpName %insert_i1_i1_ "insert(i1;i1;" + OpName %treeIndex "treeIndex" + OpName %data_0 "data" + OpName %search_i1_ "search(i1;" + OpName %target "target" + OpName %baseIndex "baseIndex" + OpName %tree_0 "tree" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %treeIndex_0 "treeIndex" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %param_5 "param" + OpName %param_6 "param" + OpName %param_7 "param" + OpName %param_8 "param" + OpName %param_9 "param" + OpName %param_10 "param" + OpName %param_11 "param" + OpName %param_12 "param" + OpName %param_13 "param" + OpName %param_14 "param" + OpName %param_15 "param" + OpName %param_16 "param" + OpName %param_17 "param" + OpName %param_18 "param" + OpName %param_19 "param" + OpName %param_20 "param" + OpName %param_21 "param" + OpName %param_22 "param" + OpName %count "count" + OpName %i "i" + OpName %result "result" + OpName %param_23 "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %49 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %53 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %54 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %55 = OpTypeFunction %int %_ptr_Function_int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %tree_0 = OpVariable %_ptr_Private__arr_BST_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 +%_ptr_Private_BST = OpTypePointer Private %BST + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %87 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %88 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main = OpFunction %void None %49 + %89 = OpLabel +%treeIndex_0 = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_BST Function + %param_4 = OpVariable %_ptr_Function_int Function + %param_5 = OpVariable %_ptr_Function_int Function + %param_6 = OpVariable %_ptr_Function_int Function + %param_7 = OpVariable %_ptr_Function_int Function + %param_8 = OpVariable %_ptr_Function_int Function + %param_9 = OpVariable %_ptr_Function_int Function + %param_10 = OpVariable %_ptr_Function_int Function + %param_11 = OpVariable %_ptr_Function_int Function + %param_12 = OpVariable %_ptr_Function_int Function + %param_13 = OpVariable %_ptr_Function_int Function + %param_14 = OpVariable %_ptr_Function_int Function + %param_15 = OpVariable %_ptr_Function_int Function + %param_16 = OpVariable %_ptr_Function_int Function + %param_17 = OpVariable %_ptr_Function_int Function + %param_18 = OpVariable %_ptr_Function_int Function + %param_19 = OpVariable %_ptr_Function_int Function + %param_20 = OpVariable %_ptr_Function_int Function + %param_21 = OpVariable %_ptr_Function_int Function + %param_22 = OpVariable %_ptr_Function_int Function + %count = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %result = OpVariable %_ptr_Function_int Function + %param_23 = OpVariable %_ptr_Function_int Function + OpStore %treeIndex_0 %int_0 + %90 = OpAccessChain %_ptr_Private_BST %tree_0 %int_0 + %91 = OpLoad %BST %90 + OpStore %param_3 %91 + OpStore %param_4 %int_9 + %92 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_3 %param_4 + %93 = OpLoad %BST %param_3 + %94 = OpAccessChain %_ptr_Private_BST %tree_0 %int_0 + OpStore %94 %93 + %95 = OpLoad %int %treeIndex_0 + %96 = OpIAdd %int %95 %int_1 + OpStore %treeIndex_0 %96 + %97 = OpLoad %int %treeIndex_0 + OpStore %param_5 %97 + OpStore %param_6 %int_5 + %98 = OpFunctionCall %void %insert_i1_i1_ %param_5 %param_6 + %99 = OpLoad %int %treeIndex_0 + %100 = OpIAdd %int %99 %int_1 + OpStore %treeIndex_0 %100 + %101 = OpLoad %int %treeIndex_0 + OpStore %param_7 %101 + OpStore %param_8 %int_12 + %102 = OpFunctionCall %void %insert_i1_i1_ %param_7 %param_8 + %103 = OpLoad %int %treeIndex_0 + %104 = OpIAdd %int %103 %int_1 + OpStore %treeIndex_0 %104 + %105 = OpLoad %int %treeIndex_0 + OpStore %param_9 %105 + OpStore %param_10 %int_15 + %106 = OpFunctionCall %void %insert_i1_i1_ %param_9 %param_10 + %107 = OpLoad %int %treeIndex_0 + %108 = OpIAdd %int %107 %int_1 + OpStore %treeIndex_0 %108 + %109 = OpLoad %int %treeIndex_0 + OpStore %param_11 %109 + OpStore %param_12 %int_7 + %110 = OpFunctionCall %void %insert_i1_i1_ %param_11 %param_12 + %111 = OpLoad %int %treeIndex_0 + %112 = OpIAdd %int %111 %int_1 + OpStore %treeIndex_0 %112 + %113 = OpLoad %int %treeIndex_0 + OpStore %param_13 %113 + OpStore %param_14 %int_8 + %114 = OpFunctionCall %void %insert_i1_i1_ %param_13 %param_14 + %115 = OpLoad %int %treeIndex_0 + %116 = OpIAdd %int %115 %int_1 + OpStore %treeIndex_0 %116 + %117 = OpLoad %int %treeIndex_0 + OpStore %param_15 %117 + OpStore %param_16 %int_2 + %118 = OpFunctionCall %void %insert_i1_i1_ %param_15 %param_16 + %119 = OpLoad %int %treeIndex_0 + %120 = OpIAdd %int %119 %int_1 + OpStore %treeIndex_0 %120 + %121 = OpLoad %int %treeIndex_0 + OpStore %param_17 %121 + OpStore %param_18 %int_6 + %122 = OpFunctionCall %void %insert_i1_i1_ %param_17 %param_18 + %123 = OpLoad %int %treeIndex_0 + %124 = OpIAdd %int %123 %int_1 + OpStore %treeIndex_0 %124 + %125 = OpLoad %int %treeIndex_0 + OpStore %param_19 %125 + OpStore %param_20 %int_17 + %126 = OpFunctionCall %void %insert_i1_i1_ %param_19 %param_20 + %127 = OpLoad %int %treeIndex_0 + %128 = OpIAdd %int %127 %int_1 + OpStore %treeIndex_0 %128 + %129 = OpLoad %int %treeIndex_0 + OpStore %param_21 %129 + OpStore %param_22 %int_13 + %130 = OpFunctionCall %void %insert_i1_i1_ %param_21 %param_22 + OpStore %count %int_0 + OpStore %i %int_0 + OpBranch %131 + %131 = OpLabel + OpLoopMerge %132 %133 None + OpBranch %134 + %134 = OpLabel + %135 = OpLoad %int %i + %136 = OpSLessThan %bool %135 %int_20 + OpBranchConditional %136 %137 %132 + %137 = OpLabel + %138 = OpLoad %int %i + OpStore %param_23 %138 + %139 = OpFunctionCall %int %search_i1_ %param_23 + OpStore %result %139 + %140 = OpLoad %int %i + OpSelectionMerge %141 None + OpSwitch %140 %142 9 %143 5 %143 12 %143 15 %143 7 %143 8 %143 2 %143 6 %143 17 %143 13 %143 + %142 = OpLabel + %144 = OpLoad %int %result + %145 = OpIEqual %bool %144 %int_n1 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %148 = OpLoad %int %count + %149 = OpIAdd %int %148 %int_1 + OpStore %count %149 + OpBranch %146 + %146 = OpLabel + OpBranch %141 + %143 = OpLabel + %150 = OpLoad %int %result + %151 = OpLoad %int %i + %152 = OpIEqual %bool %150 %151 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + %155 = OpLoad %int %count + %156 = OpIAdd %int %155 %int_1 + OpStore %count %156 + OpBranch %153 + %153 = OpLabel + OpBranch %141 + %141 = OpLabel + OpBranch %133 + %133 = OpLabel + %157 = OpLoad %int %i + %158 = OpIAdd %int %157 %int_1 + OpStore %i %158 + OpBranch %131 + %132 = OpLabel + %159 = OpLoad %int %count + %160 = OpIEqual %bool %159 %int_20 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + OpStore %_GLF_color %87 + OpBranch %161 + %163 = OpLabel + OpStore %_GLF_color %88 + OpBranch %161 + %161 = OpLabel + OpReturn + OpFunctionEnd +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %53 + %tree = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %164 = OpLabel + %165 = OpLoad %int %data + %166 = OpAccessChain %_ptr_Function_int %tree %int_0 + OpStore %166 %165 + %167 = OpAccessChain %_ptr_Function_int %tree %int_1 + OpStore %167 %int_n1 + %168 = OpAccessChain %_ptr_Function_int %tree %int_2 + OpStore %168 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %54 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_0 = OpFunctionParameter %_ptr_Function_int + %169 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_BST Function + %param_0 = OpVariable %_ptr_Function_int Function + %170 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_BST Function + %param_2 = OpVariable %_ptr_Function_int Function + OpStore %baseIndex %int_0 + OpBranch %171 + %171 = OpLabel + OpLoopMerge %172 %173 None + OpBranch %174 + %174 = OpLabel + %175 = OpLoad %int %baseIndex + %176 = OpLoad %int %treeIndex + %177 = OpSLessThanEqual %bool %175 %176 + OpBranchConditional %177 %178 %172 + %178 = OpLabel + %179 = OpLoad %int %data_0 + %180 = OpLoad %int %baseIndex + %181 = OpAccessChain %_ptr_Private_int %tree_0 %180 %int_0 + %182 = OpLoad %int %181 + %183 = OpSLessThanEqual %bool %179 %182 + OpSelectionMerge %184 None + OpBranchConditional %183 %185 %186 + %185 = OpLabel + %187 = OpLoad %int %baseIndex + %188 = OpAccessChain %_ptr_Private_int %tree_0 %187 %int_1 + %189 = OpLoad %int %188 + %190 = OpIEqual %bool %189 %int_n1 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %193 + %192 = OpLabel + %194 = OpLoad %int %baseIndex + %195 = OpLoad %int %treeIndex + %196 = OpAccessChain %_ptr_Private_int %tree_0 %194 %int_1 + OpStore %196 %195 + %197 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %198 = OpLoad %float %197 + %199 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %200 = OpLoad %float %199 + %201 = OpFOrdLessThan %bool %198 %200 + OpSelectionMerge %202 None + OpBranchConditional %201 %203 %202 + %203 = OpLabel + %204 = OpLoad %int %treeIndex + %205 = OpAccessChain %_ptr_Private_BST %tree_0 %204 + %206 = OpLoad %BST %205 + OpStore %param %206 + %207 = OpLoad %int %data_0 + OpStore %param_0 %207 + %208 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_0 + %209 = OpLoad %BST %param + %210 = OpAccessChain %_ptr_Private_BST %tree_0 %204 + OpStore %210 %209 + OpBranch %202 + %202 = OpLabel + %211 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %212 = OpLoad %float %211 + %213 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %214 = OpLoad %float %213 + %215 = OpFOrdLessThan %bool %212 %214 + OpSelectionMerge %216 None + OpBranchConditional %215 %217 %216 + %217 = OpLabel + OpReturn + %216 = OpLabel + OpBranch %191 + %193 = OpLabel + %218 = OpLoad %int %baseIndex + %219 = OpAccessChain %_ptr_Private_int %tree_0 %218 %int_1 + %220 = OpLoad %int %219 + OpStore %baseIndex %220 + OpBranch %173 + %191 = OpLabel + OpBranch %184 + %186 = OpLabel + %221 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %222 = OpLoad %float %221 + %223 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %224 = OpLoad %float %223 + %225 = OpFOrdLessThan %bool %222 %224 + OpSelectionMerge %226 None + OpBranchConditional %225 %227 %228 + %227 = OpLabel + %229 = OpLoad %int %baseIndex + %230 = OpAccessChain %_ptr_Private_int %tree_0 %229 %int_2 + %231 = OpLoad %int %230 + OpStore %170 %231 + OpBranch %226 + %228 = OpLabel + %232 = OpLoad %int %baseIndex + %233 = OpAccessChain %_ptr_Private_int %tree_0 %232 %int_2 + %234 = OpLoad %int %233 + OpStore %170 %234 + OpBranch %226 + %226 = OpLabel + %235 = OpLoad %int %170 + %236 = OpIEqual %bool %235 %int_n1 + OpSelectionMerge %237 None + OpBranchConditional %236 %238 %239 + %238 = OpLabel + %240 = OpLoad %int %baseIndex + %241 = OpLoad %int %treeIndex + %242 = OpAccessChain %_ptr_Private_int %tree_0 %240 %int_2 + OpStore %242 %241 + %243 = OpLoad %int %treeIndex + %244 = OpAccessChain %_ptr_Private_BST %tree_0 %243 + %245 = OpLoad %BST %244 + OpStore %param_1 %245 + %246 = OpLoad %int %data_0 + OpStore %param_2 %246 + %247 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_1 %param_2 + %248 = OpLoad %BST %param_1 + %249 = OpAccessChain %_ptr_Private_BST %tree_0 %243 + OpStore %249 %248 + OpReturn + %239 = OpLabel + %250 = OpLoad %int %baseIndex + %251 = OpAccessChain %_ptr_Private_int %tree_0 %250 %int_2 + %252 = OpLoad %int %251 + OpStore %baseIndex %252 + OpBranch %173 + %237 = OpLabel + OpUnreachable + %184 = OpLabel + %253 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %254 = OpLoad %float %253 + %255 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %256 = OpLoad %float %255 + %257 = OpFOrdGreaterThan %bool %254 %256 + OpSelectionMerge %258 None + OpBranchConditional %257 %259 %258 + %259 = OpLabel + OpReturn + %258 = OpLabel + OpBranch %173 + %173 = OpLabel + OpBranch %171 + %172 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %55 + %target = OpFunctionParameter %_ptr_Function_int + %260 = OpLabel + %index = OpVariable %_ptr_Function_int Function +%currentNode = OpVariable %_ptr_Function_BST Function + %261 = OpVariable %_ptr_Function_int Function + OpStore %index %int_0 + OpBranch %262 + %262 = OpLabel + OpLoopMerge %263 %264 None + OpBranch %265 + %265 = OpLabel + %266 = OpLoad %int %index + %267 = OpINotEqual %bool %266 %int_n1 + OpBranchConditional %267 %268 %263 + %268 = OpLabel + %269 = OpLoad %int %index + %270 = OpAccessChain %_ptr_Private_BST %tree_0 %269 + %271 = OpLoad %BST %270 + OpStore %currentNode %271 + %272 = OpAccessChain %_ptr_Function_int %currentNode %int_0 + %273 = OpLoad %int %272 + %274 = OpLoad %int %target + %275 = OpIEqual %bool %273 %274 + OpSelectionMerge %276 None + OpBranchConditional %275 %277 %276 + %277 = OpLabel + %278 = OpLoad %int %target + OpReturnValue %278 + %276 = OpLabel + %279 = OpLoad %int %target + %280 = OpAccessChain %_ptr_Function_int %currentNode %int_0 + %281 = OpLoad %int %280 + %282 = OpSGreaterThan %bool %279 %281 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %285 + %284 = OpLabel + %286 = OpAccessChain %_ptr_Function_int %currentNode %int_2 + %287 = OpLoad %int %286 + OpStore %261 %287 + OpBranch %283 + %285 = OpLabel + %288 = OpAccessChain %_ptr_Function_int %currentNode %int_1 + %289 = OpLoad %int %288 + OpStore %261 %289 + OpBranch %283 + %283 = OpLabel + %290 = OpLoad %int %261 + OpStore %index %290 + OpBranch %264 + %264 = OpLabel + OpBranch %262 + %263 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..11cdc01241 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.hlsl @@ -0,0 +1,255 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree_1[10] = (BST[10])0; +cbuffer cbuffer_x_16 : register(b0, space0) { + uint4 x_16[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_165 = data; + tree.data = x_165; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + int x_170 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + while (true) { + const int x_175 = baseIndex; + const int x_176 = treeIndex; + if ((x_175 <= x_176)) { + } else { + break; + } + const int x_179 = data_1; + const int x_182 = tree_1[baseIndex].data; + if ((x_179 <= x_182)) { + const int x_189 = tree_1[baseIndex].leftIndex; + if ((x_189 == -1)) { + const int x_194 = baseIndex; + const int x_195 = treeIndex; + tree_1[x_194].leftIndex = x_195; + const float x_198 = asfloat(x_16[0].x); + const float x_200 = asfloat(x_16[0].y); + if ((x_198 < x_200)) { + const int x_204 = treeIndex; + const BST x_206 = tree_1[x_204]; + param = x_206; + const int x_207 = data_1; + param_1 = x_207; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_204] = param; + } + const float x_212 = asfloat(x_16[0].x); + const float x_214 = asfloat(x_16[0].y); + if ((x_212 < x_214)) { + return; + } + } else { + const int x_220 = tree_1[baseIndex].leftIndex; + baseIndex = x_220; + continue; + } + } else { + const float x_222 = asfloat(x_16[0].x); + const float x_224 = asfloat(x_16[0].y); + if ((x_222 < x_224)) { + const int x_231 = tree_1[baseIndex].rightIndex; + x_170 = x_231; + } else { + const int x_234 = tree_1[baseIndex].rightIndex; + x_170 = x_234; + } + if ((x_170 == -1)) { + const int x_240 = baseIndex; + const int x_241 = treeIndex; + tree_1[x_240].rightIndex = x_241; + const int x_243 = treeIndex; + const BST x_245 = tree_1[x_243]; + param_2 = x_245; + const int x_246 = data_1; + param_3 = x_246; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_243] = param_2; + return; + } else { + const int x_252 = tree_1[baseIndex].rightIndex; + baseIndex = x_252; + continue; + } + return; + } + const float x_254 = asfloat(x_16[0].x); + const float x_256 = asfloat(x_16[0].y); + if ((x_254 > x_256)) { + return; + } + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_261 = 0; + index = 0; + while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_271 = tree_1[index]; + currentNode = x_271; + const int x_273 = currentNode.data; + const int x_274 = target; + if ((x_273 == x_274)) { + const int x_278 = target; + return x_278; + } + const int x_279 = target; + const int x_281 = currentNode.data; + if ((x_279 > x_281)) { + const int x_287 = currentNode.rightIndex; + x_261 = x_287; + } else { + const int x_289 = currentNode.leftIndex; + x_261 = x_289; + } + index = x_261; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_91 = tree_1[0]; + param_4 = x_91; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree_1[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + for(; (i < 20); i = (i + 1)) { + param_24 = i; + const int x_139 = search_i1_(param_24); + result = x_139; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.msl new file mode 100644 index 0000000000..17bc280ecd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.msl @@ -0,0 +1,306 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const tree, thread int* const data) { + int const x_165 = *(data); + (*(tree)).data = x_165; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +void insert_i1_i1_(constant buf0& x_16, thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_4) { + int baseIndex = 0; + BST param = {}; + int param_1 = 0; + int x_170 = 0; + BST param_2 = {}; + int param_3 = 0; + baseIndex = 0; + while (true) { + int const x_175 = baseIndex; + int const x_176 = *(treeIndex); + if ((x_175 <= x_176)) { + } else { + break; + } + int const x_179 = *(data_1); + int const x_180 = baseIndex; + int const x_182 = (*(tint_symbol_4)).arr[x_180].data; + if ((x_179 <= x_182)) { + int const x_187 = baseIndex; + int const x_189 = (*(tint_symbol_4)).arr[x_187].leftIndex; + if ((x_189 == -1)) { + int const x_194 = baseIndex; + int const x_195 = *(treeIndex); + (*(tint_symbol_4)).arr[x_194].leftIndex = x_195; + float const x_198 = x_16.injectionSwitch.x; + float const x_200 = x_16.injectionSwitch.y; + if ((x_198 < x_200)) { + int const x_204 = *(treeIndex); + BST const x_206 = (*(tint_symbol_4)).arr[x_204]; + param = x_206; + int const x_207 = *(data_1); + param_1 = x_207; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + BST const x_209 = param; + (*(tint_symbol_4)).arr[x_204] = x_209; + } + float const x_212 = x_16.injectionSwitch.x; + float const x_214 = x_16.injectionSwitch.y; + if ((x_212 < x_214)) { + return; + } + } else { + int const x_218 = baseIndex; + int const x_220 = (*(tint_symbol_4)).arr[x_218].leftIndex; + baseIndex = x_220; + continue; + } + } else { + float const x_222 = x_16.injectionSwitch.x; + float const x_224 = x_16.injectionSwitch.y; + if ((x_222 < x_224)) { + int const x_229 = baseIndex; + int const x_231 = (*(tint_symbol_4)).arr[x_229].rightIndex; + x_170 = x_231; + } else { + int const x_232 = baseIndex; + int const x_234 = (*(tint_symbol_4)).arr[x_232].rightIndex; + x_170 = x_234; + } + int const x_235 = x_170; + if ((x_235 == -1)) { + int const x_240 = baseIndex; + int const x_241 = *(treeIndex); + (*(tint_symbol_4)).arr[x_240].rightIndex = x_241; + int const x_243 = *(treeIndex); + BST const x_245 = (*(tint_symbol_4)).arr[x_243]; + param_2 = x_245; + int const x_246 = *(data_1); + param_3 = x_246; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + BST const x_248 = param_2; + (*(tint_symbol_4)).arr[x_243] = x_248; + return; + } else { + int const x_250 = baseIndex; + int const x_252 = (*(tint_symbol_4)).arr[x_250].rightIndex; + baseIndex = x_252; + continue; + } + return; + } + float const x_254 = x_16.injectionSwitch.x; + float const x_256 = x_16.injectionSwitch.y; + if ((x_254 > x_256)) { + return; + } + } + return; +} + +int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_5) { + int index = 0; + BST currentNode = {}; + int x_261 = 0; + index = 0; + while (true) { + int const x_266 = index; + if ((x_266 != -1)) { + } else { + break; + } + int const x_269 = index; + BST const x_271 = (*(tint_symbol_5)).arr[x_269]; + currentNode = x_271; + int const x_273 = currentNode.data; + int const x_274 = *(target); + if ((x_273 == x_274)) { + int const x_278 = *(target); + return x_278; + } + int const x_279 = *(target); + int const x_281 = currentNode.data; + if ((x_279 > x_281)) { + int const x_287 = currentNode.rightIndex; + x_261 = x_287; + } else { + int const x_289 = currentNode.leftIndex; + x_261 = x_289; + } + int const x_290 = x_261; + index = x_290; + } + return -1; +} + +void main_1(constant buf0& x_16, thread tint_array_wrapper* const tint_symbol_6, thread float4* const tint_symbol_7) { + int treeIndex_1 = 0; + BST param_4 = {}; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + BST const x_91 = (*(tint_symbol_6)).arr[0]; + param_4 = x_91; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + BST const x_93 = param_4; + (*(tint_symbol_6)).arr[0] = x_93; + int const x_95 = treeIndex_1; + treeIndex_1 = (x_95 + 1); + int const x_97 = treeIndex_1; + param_6 = x_97; + param_7 = 5; + insert_i1_i1_(x_16, &(param_6), &(param_7), tint_symbol_6); + int const x_99 = treeIndex_1; + treeIndex_1 = (x_99 + 1); + int const x_101 = treeIndex_1; + param_8 = x_101; + param_9 = 12; + insert_i1_i1_(x_16, &(param_8), &(param_9), tint_symbol_6); + int const x_103 = treeIndex_1; + treeIndex_1 = (x_103 + 1); + int const x_105 = treeIndex_1; + param_10 = x_105; + param_11 = 15; + insert_i1_i1_(x_16, &(param_10), &(param_11), tint_symbol_6); + int const x_107 = treeIndex_1; + treeIndex_1 = (x_107 + 1); + int const x_109 = treeIndex_1; + param_12 = x_109; + param_13 = 7; + insert_i1_i1_(x_16, &(param_12), &(param_13), tint_symbol_6); + int const x_111 = treeIndex_1; + treeIndex_1 = (x_111 + 1); + int const x_113 = treeIndex_1; + param_14 = x_113; + param_15 = 8; + insert_i1_i1_(x_16, &(param_14), &(param_15), tint_symbol_6); + int const x_115 = treeIndex_1; + treeIndex_1 = (x_115 + 1); + int const x_117 = treeIndex_1; + param_16 = x_117; + param_17 = 2; + insert_i1_i1_(x_16, &(param_16), &(param_17), tint_symbol_6); + int const x_119 = treeIndex_1; + treeIndex_1 = (x_119 + 1); + int const x_121 = treeIndex_1; + param_18 = x_121; + param_19 = 6; + insert_i1_i1_(x_16, &(param_18), &(param_19), tint_symbol_6); + int const x_123 = treeIndex_1; + treeIndex_1 = (x_123 + 1); + int const x_125 = treeIndex_1; + param_20 = x_125; + param_21 = 17; + insert_i1_i1_(x_16, &(param_20), &(param_21), tint_symbol_6); + int const x_127 = treeIndex_1; + treeIndex_1 = (x_127 + 1); + int const x_129 = treeIndex_1; + param_22 = x_129; + param_23 = 13; + insert_i1_i1_(x_16, &(param_22), &(param_23), tint_symbol_6); + count = 0; + i = 0; + while (true) { + int const x_135 = i; + if ((x_135 < 20)) { + } else { + break; + } + int const x_138 = i; + param_24 = x_138; + int const x_139 = search_i1_(&(param_24), tint_symbol_6); + result = x_139; + int const x_140 = i; + switch(x_140) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + int const x_150 = result; + int const x_151 = i; + if ((x_150 == x_151)) { + int const x_155 = count; + count = (x_155 + 1); + } + break; + } + default: { + int const x_144 = result; + if ((x_144 == -1)) { + int const x_148 = count; + count = (x_148 + 1); + } + break; + } + } + { + int const x_157 = i; + i = (x_157 + 1); + } + } + int const x_159 = count; + if ((x_159 == 20)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_16 [[buffer(0)]]) { + thread tint_array_wrapper tint_symbol_8 = {}; + thread float4 tint_symbol_9 = 0.0f; + main_1(x_16, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..990bb9a647 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.spvasm @@ -0,0 +1,539 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 355 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree_1 "tree_1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_16 "x_16" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode_struct_BST_i1_i1_i11_i1_" + OpName %tree "tree" + OpName %data "data" + OpName %insert_i1_i1_ "insert_i1_i1_" + OpName %treeIndex "treeIndex" + OpName %data_1 "data_1" + OpName %baseIndex "baseIndex" + OpName %param "param" + OpName %param_1 "param_1" + OpName %x_170 "x_170" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %search_i1_ "search_i1_" + OpName %target "target" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %x_261 "x_261" + OpName %main_1 "main_1" + OpName %treeIndex_1 "treeIndex_1" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %param_10 "param_10" + OpName %param_11 "param_11" + OpName %param_12 "param_12" + OpName %param_13 "param_13" + OpName %param_14 "param_14" + OpName %param_15 "param_15" + OpName %param_16 "param_16" + OpName %param_17 "param_17" + OpName %param_18 "param_18" + OpName %param_19 "param_19" + OpName %param_20 "param_20" + OpName %param_21 "param_21" + OpName %param_22 "param_22" + OpName %param_23 "param_23" + OpName %count "count" + OpName %i "i" + OpName %result "result" + OpName %param_24 "param_24" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_16 NonWritable + OpDecorate %x_16 DescriptorSet 0 + OpDecorate %x_16 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %8 = OpConstantNull %_arr_BST_uint_10 + %tree_1 = OpVariable %_ptr_Private__arr_BST_uint_10 Private %8 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_16 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int_n1 = OpConstant %int -1 + %uint_2 = OpConstant %uint 2 + %40 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %46 = OpConstantNull %int + %48 = OpConstantNull %BST + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_BST = OpTypePointer Private %BST + %161 = OpTypeFunction %int %_ptr_Function_int + %202 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %341 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %342 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %343 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %20 + %tree = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %27 = OpLabel + %29 = OpLoad %int %data + %32 = OpAccessChain %_ptr_Function_int %tree %uint_0 + OpStore %32 %29 + %35 = OpAccessChain %_ptr_Function_int %tree %uint_1 + OpStore %35 %int_n1 + %39 = OpAccessChain %_ptr_Function_int %tree %uint_2 + OpStore %39 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %40 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_1 = OpFunctionParameter %_ptr_Function_int + %44 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function %46 + %param = OpVariable %_ptr_Function_BST Function %48 + %param_1 = OpVariable %_ptr_Function_int Function %46 + %x_170 = OpVariable %_ptr_Function_int Function %46 + %param_2 = OpVariable %_ptr_Function_BST Function %48 + %param_3 = OpVariable %_ptr_Function_int Function %46 + OpStore %baseIndex %int_0 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %int %baseIndex + %60 = OpLoad %int %treeIndex + %61 = OpSLessThanEqual %bool %58 %60 + OpSelectionMerge %63 None + OpBranchConditional %61 %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %55 + %63 = OpLabel + %67 = OpLoad %int %data_1 + %68 = OpLoad %int %baseIndex + %70 = OpAccessChain %_ptr_Private_int %tree_1 %68 %uint_0 + %71 = OpLoad %int %70 + %72 = OpSLessThanEqual %bool %67 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + %76 = OpLoad %int %baseIndex + %77 = OpAccessChain %_ptr_Private_int %tree_1 %76 %uint_1 + %78 = OpLoad %int %77 + %79 = OpIEqual %bool %78 %int_n1 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + %83 = OpLoad %int %baseIndex + %85 = OpLoad %int %treeIndex + %86 = OpAccessChain %_ptr_Private_int %tree_1 %83 %uint_1 + OpStore %86 %85 + %88 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_0 + %89 = OpLoad %float %88 + %90 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_1 + %91 = OpLoad %float %90 + %92 = OpFOrdLessThan %bool %89 %91 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + %96 = OpLoad %int %treeIndex + %98 = OpAccessChain %_ptr_Private_BST %tree_1 %96 + %99 = OpLoad %BST %98 + OpStore %param %99 + %101 = OpLoad %int %data_1 + OpStore %param_1 %101 + %102 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_1 + %105 = OpLoad %BST %param + %106 = OpAccessChain %_ptr_Private_BST %tree_1 %96 + OpStore %106 %105 + OpBranch %93 + %93 = OpLabel + %107 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_0 + %108 = OpLoad %float %107 + %109 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_1 + %110 = OpLoad %float %109 + %111 = OpFOrdLessThan %bool %108 %110 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %112 + %113 = OpLabel + OpReturn + %112 = OpLabel + OpBranch %80 + %82 = OpLabel + %114 = OpLoad %int %baseIndex + %115 = OpAccessChain %_ptr_Private_int %tree_1 %114 %uint_1 + %116 = OpLoad %int %115 + OpStore %baseIndex %116 + OpBranch %56 + %80 = OpLabel + OpBranch %73 + %75 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_0 + %118 = OpLoad %float %117 + %119 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_1 + %120 = OpLoad %float %119 + %121 = OpFOrdLessThan %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + %125 = OpLoad %int %baseIndex + %126 = OpAccessChain %_ptr_Private_int %tree_1 %125 %uint_2 + %127 = OpLoad %int %126 + OpStore %x_170 %127 + OpBranch %122 + %124 = OpLabel + %128 = OpLoad %int %baseIndex + %129 = OpAccessChain %_ptr_Private_int %tree_1 %128 %uint_2 + %130 = OpLoad %int %129 + OpStore %x_170 %130 + OpBranch %122 + %122 = OpLabel + %131 = OpLoad %int %x_170 + %132 = OpIEqual %bool %131 %int_n1 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %135 + %134 = OpLabel + %136 = OpLoad %int %baseIndex + %138 = OpLoad %int %treeIndex + %139 = OpAccessChain %_ptr_Private_int %tree_1 %136 %uint_2 + OpStore %139 %138 + %141 = OpLoad %int %treeIndex + %142 = OpAccessChain %_ptr_Private_BST %tree_1 %141 + %143 = OpLoad %BST %142 + OpStore %param_2 %143 + %145 = OpLoad %int %data_1 + OpStore %param_3 %145 + %146 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_2 %param_3 + %149 = OpLoad %BST %param_2 + %150 = OpAccessChain %_ptr_Private_BST %tree_1 %141 + OpStore %150 %149 + OpReturn + %135 = OpLabel + %151 = OpLoad %int %baseIndex + %152 = OpAccessChain %_ptr_Private_int %tree_1 %151 %uint_2 + %153 = OpLoad %int %152 + OpStore %baseIndex %153 + OpBranch %56 + %133 = OpLabel + OpReturn + %73 = OpLabel + %154 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_0 + %155 = OpLoad %float %154 + %156 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_1 + %157 = OpLoad %float %156 + %158 = OpFOrdGreaterThan %bool %155 %157 + OpSelectionMerge %159 None + OpBranchConditional %158 %160 %159 + %160 = OpLabel + OpReturn + %159 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %54 + %55 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %161 + %target = OpFunctionParameter %_ptr_Function_int + %164 = OpLabel + %index = OpVariable %_ptr_Function_int Function %46 +%currentNode = OpVariable %_ptr_Function_BST Function %48 + %x_261 = OpVariable %_ptr_Function_int Function %46 + OpStore %index %int_0 + OpBranch %168 + %168 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %172 = OpLoad %int %index + %173 = OpINotEqual %bool %172 %int_n1 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %176 + %175 = OpLabel + OpBranch %174 + %176 = OpLabel + OpBranch %169 + %174 = OpLabel + %177 = OpLoad %int %index + %178 = OpAccessChain %_ptr_Private_BST %tree_1 %177 + %179 = OpLoad %BST %178 + OpStore %currentNode %179 + %180 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %181 = OpLoad %int %180 + %183 = OpLoad %int %target + %184 = OpIEqual %bool %181 %183 + OpSelectionMerge %185 None + OpBranchConditional %184 %186 %185 + %186 = OpLabel + %188 = OpLoad %int %target + OpReturnValue %188 + %185 = OpLabel + %190 = OpLoad %int %target + %191 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %192 = OpLoad %int %191 + %193 = OpSGreaterThan %bool %190 %192 + OpSelectionMerge %194 None + OpBranchConditional %193 %195 %196 + %195 = OpLabel + %197 = OpAccessChain %_ptr_Function_int %currentNode %uint_2 + %198 = OpLoad %int %197 + OpStore %x_261 %198 + OpBranch %194 + %196 = OpLabel + %199 = OpAccessChain %_ptr_Function_int %currentNode %uint_1 + %200 = OpLoad %int %199 + OpStore %x_261 %200 + OpBranch %194 + %194 = OpLabel + %201 = OpLoad %int %x_261 + OpStore %index %201 + OpBranch %170 + %170 = OpLabel + OpBranch %168 + %169 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd + %main_1 = OpFunction %void None %202 + %204 = OpLabel +%treeIndex_1 = OpVariable %_ptr_Function_int Function %46 + %param_4 = OpVariable %_ptr_Function_BST Function %48 + %param_5 = OpVariable %_ptr_Function_int Function %46 + %param_6 = OpVariable %_ptr_Function_int Function %46 + %param_7 = OpVariable %_ptr_Function_int Function %46 + %param_8 = OpVariable %_ptr_Function_int Function %46 + %param_9 = OpVariable %_ptr_Function_int Function %46 + %param_10 = OpVariable %_ptr_Function_int Function %46 + %param_11 = OpVariable %_ptr_Function_int Function %46 + %param_12 = OpVariable %_ptr_Function_int Function %46 + %param_13 = OpVariable %_ptr_Function_int Function %46 + %param_14 = OpVariable %_ptr_Function_int Function %46 + %param_15 = OpVariable %_ptr_Function_int Function %46 + %param_16 = OpVariable %_ptr_Function_int Function %46 + %param_17 = OpVariable %_ptr_Function_int Function %46 + %param_18 = OpVariable %_ptr_Function_int Function %46 + %param_19 = OpVariable %_ptr_Function_int Function %46 + %param_20 = OpVariable %_ptr_Function_int Function %46 + %param_21 = OpVariable %_ptr_Function_int Function %46 + %param_22 = OpVariable %_ptr_Function_int Function %46 + %param_23 = OpVariable %_ptr_Function_int Function %46 + %count = OpVariable %_ptr_Function_int Function %46 + %i = OpVariable %_ptr_Function_int Function %46 + %result = OpVariable %_ptr_Function_int Function %46 + %param_24 = OpVariable %_ptr_Function_int Function %46 + OpStore %treeIndex_1 %int_0 + %230 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + %231 = OpLoad %BST %230 + OpStore %param_4 %231 + OpStore %param_5 %int_9 + %233 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_4 %param_5 + %236 = OpLoad %BST %param_4 + %237 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + OpStore %237 %236 + %238 = OpLoad %int %treeIndex_1 + %240 = OpIAdd %int %238 %int_1 + OpStore %treeIndex_1 %240 + %241 = OpLoad %int %treeIndex_1 + OpStore %param_6 %241 + OpStore %param_7 %int_5 + %243 = OpFunctionCall %void %insert_i1_i1_ %param_6 %param_7 + %246 = OpLoad %int %treeIndex_1 + %247 = OpIAdd %int %246 %int_1 + OpStore %treeIndex_1 %247 + %248 = OpLoad %int %treeIndex_1 + OpStore %param_8 %248 + OpStore %param_9 %int_12 + %250 = OpFunctionCall %void %insert_i1_i1_ %param_8 %param_9 + %253 = OpLoad %int %treeIndex_1 + %254 = OpIAdd %int %253 %int_1 + OpStore %treeIndex_1 %254 + %255 = OpLoad %int %treeIndex_1 + OpStore %param_10 %255 + OpStore %param_11 %int_15 + %257 = OpFunctionCall %void %insert_i1_i1_ %param_10 %param_11 + %260 = OpLoad %int %treeIndex_1 + %261 = OpIAdd %int %260 %int_1 + OpStore %treeIndex_1 %261 + %262 = OpLoad %int %treeIndex_1 + OpStore %param_12 %262 + OpStore %param_13 %int_7 + %264 = OpFunctionCall %void %insert_i1_i1_ %param_12 %param_13 + %267 = OpLoad %int %treeIndex_1 + %268 = OpIAdd %int %267 %int_1 + OpStore %treeIndex_1 %268 + %269 = OpLoad %int %treeIndex_1 + OpStore %param_14 %269 + OpStore %param_15 %int_8 + %271 = OpFunctionCall %void %insert_i1_i1_ %param_14 %param_15 + %274 = OpLoad %int %treeIndex_1 + %275 = OpIAdd %int %274 %int_1 + OpStore %treeIndex_1 %275 + %276 = OpLoad %int %treeIndex_1 + OpStore %param_16 %276 + OpStore %param_17 %int_2 + %278 = OpFunctionCall %void %insert_i1_i1_ %param_16 %param_17 + %281 = OpLoad %int %treeIndex_1 + %282 = OpIAdd %int %281 %int_1 + OpStore %treeIndex_1 %282 + %283 = OpLoad %int %treeIndex_1 + OpStore %param_18 %283 + OpStore %param_19 %int_6 + %285 = OpFunctionCall %void %insert_i1_i1_ %param_18 %param_19 + %288 = OpLoad %int %treeIndex_1 + %289 = OpIAdd %int %288 %int_1 + OpStore %treeIndex_1 %289 + %290 = OpLoad %int %treeIndex_1 + OpStore %param_20 %290 + OpStore %param_21 %int_17 + %292 = OpFunctionCall %void %insert_i1_i1_ %param_20 %param_21 + %295 = OpLoad %int %treeIndex_1 + %296 = OpIAdd %int %295 %int_1 + OpStore %treeIndex_1 %296 + %297 = OpLoad %int %treeIndex_1 + OpStore %param_22 %297 + OpStore %param_23 %int_13 + %299 = OpFunctionCall %void %insert_i1_i1_ %param_22 %param_23 + OpStore %count %int_0 + OpStore %i %int_0 + OpBranch %302 + %302 = OpLabel + OpLoopMerge %303 %304 None + OpBranch %305 + %305 = OpLabel + %306 = OpLoad %int %i + %308 = OpSLessThan %bool %306 %int_20 + OpSelectionMerge %309 None + OpBranchConditional %308 %310 %311 + %310 = OpLabel + OpBranch %309 + %311 = OpLabel + OpBranch %303 + %309 = OpLabel + %312 = OpLoad %int %i + OpStore %param_24 %312 + %313 = OpFunctionCall %int %search_i1_ %param_24 + OpStore %result %313 + %315 = OpLoad %int %i + OpSelectionMerge %316 None + OpSwitch %315 %317 2 %318 5 %318 6 %318 7 %318 8 %318 9 %318 12 %318 13 %318 15 %318 17 %318 + %318 = OpLabel + %319 = OpLoad %int %result + %320 = OpLoad %int %i + %321 = OpIEqual %bool %319 %320 + OpSelectionMerge %322 None + OpBranchConditional %321 %323 %322 + %323 = OpLabel + %324 = OpLoad %int %count + %325 = OpIAdd %int %324 %int_1 + OpStore %count %325 + OpBranch %322 + %322 = OpLabel + OpBranch %316 + %317 = OpLabel + %326 = OpLoad %int %result + %327 = OpIEqual %bool %326 %int_n1 + OpSelectionMerge %328 None + OpBranchConditional %327 %329 %328 + %329 = OpLabel + %330 = OpLoad %int %count + %331 = OpIAdd %int %330 %int_1 + OpStore %count %331 + OpBranch %328 + %328 = OpLabel + OpBranch %316 + %316 = OpLabel + OpBranch %304 + %304 = OpLabel + %332 = OpLoad %int %i + %333 = OpIAdd %int %332 %int_1 + OpStore %i %333 + OpBranch %302 + %303 = OpLabel + %334 = OpLoad %int %count + %335 = OpIEqual %bool %334 %int_20 + OpSelectionMerge %336 None + OpBranchConditional %335 %337 %338 + %337 = OpLabel + OpStore %x_GLF_color %341 + OpBranch %336 + %338 = OpLabel + OpStore %x_GLF_color %342 + OpBranch %336 + %336 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %343 +%tint_symbol = OpFunctionParameter %main_out + %347 = OpLabel + %348 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %348 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %202 + %350 = OpLabel + %351 = OpFunctionCall %void %main_1 + %353 = OpLoad %v4float %x_GLF_color + %354 = OpCompositeConstruct %main_out %353 + %352 = OpFunctionCall %void %tint_symbol_2 %354 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..06f95bb861 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.spvasm.expected.wgsl @@ -0,0 +1,293 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var tree_1 : array; + +[[group(0), binding(0)]] var x_16 : buf0; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(tree : ptr, data : ptr) { + let x_165 : i32 = *(data); + (*(tree)).data = x_165; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var x_170 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_175 : i32 = baseIndex; + let x_176 : i32 = *(treeIndex); + if ((x_175 <= x_176)) { + } else { + break; + } + let x_179 : i32 = *(data_1); + let x_180 : i32 = baseIndex; + let x_182 : i32 = tree_1[x_180].data; + if ((x_179 <= x_182)) { + let x_187 : i32 = baseIndex; + let x_189 : i32 = tree_1[x_187].leftIndex; + if ((x_189 == -1)) { + let x_194 : i32 = baseIndex; + let x_195 : i32 = *(treeIndex); + tree_1[x_194].leftIndex = x_195; + let x_198 : f32 = x_16.injectionSwitch.x; + let x_200 : f32 = x_16.injectionSwitch.y; + if ((x_198 < x_200)) { + let x_204 : i32 = *(treeIndex); + let x_206 : BST = tree_1[x_204]; + param = x_206; + let x_207 : i32 = *(data_1); + param_1 = x_207; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_209 : BST = param; + tree_1[x_204] = x_209; + } + let x_212 : f32 = x_16.injectionSwitch.x; + let x_214 : f32 = x_16.injectionSwitch.y; + if ((x_212 < x_214)) { + return; + } + } else { + let x_218 : i32 = baseIndex; + let x_220 : i32 = tree_1[x_218].leftIndex; + baseIndex = x_220; + continue; + } + } else { + let x_222 : f32 = x_16.injectionSwitch.x; + let x_224 : f32 = x_16.injectionSwitch.y; + if ((x_222 < x_224)) { + let x_229 : i32 = baseIndex; + let x_231 : i32 = tree_1[x_229].rightIndex; + x_170 = x_231; + } else { + let x_232 : i32 = baseIndex; + let x_234 : i32 = tree_1[x_232].rightIndex; + x_170 = x_234; + } + let x_235 : i32 = x_170; + if ((x_235 == -1)) { + let x_240 : i32 = baseIndex; + let x_241 : i32 = *(treeIndex); + tree_1[x_240].rightIndex = x_241; + let x_243 : i32 = *(treeIndex); + let x_245 : BST = tree_1[x_243]; + param_2 = x_245; + let x_246 : i32 = *(data_1); + param_3 = x_246; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_248 : BST = param_2; + tree_1[x_243] = x_248; + return; + } else { + let x_250 : i32 = baseIndex; + let x_252 : i32 = tree_1[x_250].rightIndex; + baseIndex = x_252; + continue; + } + return; + } + let x_254 : f32 = x_16.injectionSwitch.x; + let x_256 : f32 = x_16.injectionSwitch.y; + if ((x_254 > x_256)) { + return; + } + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_261 : i32; + index = 0; + loop { + let x_266 : i32 = index; + if ((x_266 != -1)) { + } else { + break; + } + let x_269 : i32 = index; + let x_271 : BST = tree_1[x_269]; + currentNode = x_271; + let x_273 : i32 = currentNode.data; + let x_274 : i32 = *(target); + if ((x_273 == x_274)) { + let x_278 : i32 = *(target); + return x_278; + } + let x_279 : i32 = *(target); + let x_281 : i32 = currentNode.data; + if ((x_279 > x_281)) { + let x_287 : i32 = currentNode.rightIndex; + x_261 = x_287; + } else { + let x_289 : i32 = currentNode.leftIndex; + x_261 = x_289; + } + let x_290 : i32 = x_261; + index = x_290; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var count : i32; + var i : i32; + var result : i32; + var param_24 : i32; + treeIndex_1 = 0; + let x_91 : BST = tree_1[0]; + param_4 = x_91; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_93 : BST = param_4; + tree_1[0] = x_93; + let x_95 : i32 = treeIndex_1; + treeIndex_1 = (x_95 + 1); + let x_97 : i32 = treeIndex_1; + param_6 = x_97; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_99 : i32 = treeIndex_1; + treeIndex_1 = (x_99 + 1); + let x_101 : i32 = treeIndex_1; + param_8 = x_101; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_103 : i32 = treeIndex_1; + treeIndex_1 = (x_103 + 1); + let x_105 : i32 = treeIndex_1; + param_10 = x_105; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_107 : i32 = treeIndex_1; + treeIndex_1 = (x_107 + 1); + let x_109 : i32 = treeIndex_1; + param_12 = x_109; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_111 : i32 = treeIndex_1; + treeIndex_1 = (x_111 + 1); + let x_113 : i32 = treeIndex_1; + param_14 = x_113; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_115 : i32 = treeIndex_1; + treeIndex_1 = (x_115 + 1); + let x_117 : i32 = treeIndex_1; + param_16 = x_117; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_119 : i32 = treeIndex_1; + treeIndex_1 = (x_119 + 1); + let x_121 : i32 = treeIndex_1; + param_18 = x_121; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_123 : i32 = treeIndex_1; + treeIndex_1 = (x_123 + 1); + let x_125 : i32 = treeIndex_1; + param_20 = x_125; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_127 : i32 = treeIndex_1; + treeIndex_1 = (x_127 + 1); + let x_129 : i32 = treeIndex_1; + param_22 = x_129; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + count = 0; + i = 0; + loop { + let x_135 : i32 = i; + if ((x_135 < 20)) { + } else { + break; + } + let x_138 : i32 = i; + param_24 = x_138; + let x_139 : i32 = search_i1_(&(param_24)); + result = x_139; + let x_140 : i32 = i; + switch(x_140) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_150 : i32 = result; + let x_151 : i32 = i; + if ((x_150 == x_151)) { + let x_155 : i32 = count; + count = (x_155 + 1); + } + } + default: { + let x_144 : i32 = result; + if ((x_144 == -1)) { + let x_148 : i32 = count; + count = (x_148 + 1); + } + } + } + + continuing { + let x_157 : i32 = i; + i = (x_157 + 1); + } + } + let x_159 : i32 = count; + if ((x_159 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl new file mode 100644 index 0000000000..06f95bb861 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl @@ -0,0 +1,293 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var tree_1 : array; + +[[group(0), binding(0)]] var x_16 : buf0; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(tree : ptr, data : ptr) { + let x_165 : i32 = *(data); + (*(tree)).data = x_165; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var x_170 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_175 : i32 = baseIndex; + let x_176 : i32 = *(treeIndex); + if ((x_175 <= x_176)) { + } else { + break; + } + let x_179 : i32 = *(data_1); + let x_180 : i32 = baseIndex; + let x_182 : i32 = tree_1[x_180].data; + if ((x_179 <= x_182)) { + let x_187 : i32 = baseIndex; + let x_189 : i32 = tree_1[x_187].leftIndex; + if ((x_189 == -1)) { + let x_194 : i32 = baseIndex; + let x_195 : i32 = *(treeIndex); + tree_1[x_194].leftIndex = x_195; + let x_198 : f32 = x_16.injectionSwitch.x; + let x_200 : f32 = x_16.injectionSwitch.y; + if ((x_198 < x_200)) { + let x_204 : i32 = *(treeIndex); + let x_206 : BST = tree_1[x_204]; + param = x_206; + let x_207 : i32 = *(data_1); + param_1 = x_207; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_209 : BST = param; + tree_1[x_204] = x_209; + } + let x_212 : f32 = x_16.injectionSwitch.x; + let x_214 : f32 = x_16.injectionSwitch.y; + if ((x_212 < x_214)) { + return; + } + } else { + let x_218 : i32 = baseIndex; + let x_220 : i32 = tree_1[x_218].leftIndex; + baseIndex = x_220; + continue; + } + } else { + let x_222 : f32 = x_16.injectionSwitch.x; + let x_224 : f32 = x_16.injectionSwitch.y; + if ((x_222 < x_224)) { + let x_229 : i32 = baseIndex; + let x_231 : i32 = tree_1[x_229].rightIndex; + x_170 = x_231; + } else { + let x_232 : i32 = baseIndex; + let x_234 : i32 = tree_1[x_232].rightIndex; + x_170 = x_234; + } + let x_235 : i32 = x_170; + if ((x_235 == -1)) { + let x_240 : i32 = baseIndex; + let x_241 : i32 = *(treeIndex); + tree_1[x_240].rightIndex = x_241; + let x_243 : i32 = *(treeIndex); + let x_245 : BST = tree_1[x_243]; + param_2 = x_245; + let x_246 : i32 = *(data_1); + param_3 = x_246; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_248 : BST = param_2; + tree_1[x_243] = x_248; + return; + } else { + let x_250 : i32 = baseIndex; + let x_252 : i32 = tree_1[x_250].rightIndex; + baseIndex = x_252; + continue; + } + return; + } + let x_254 : f32 = x_16.injectionSwitch.x; + let x_256 : f32 = x_16.injectionSwitch.y; + if ((x_254 > x_256)) { + return; + } + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_261 : i32; + index = 0; + loop { + let x_266 : i32 = index; + if ((x_266 != -1)) { + } else { + break; + } + let x_269 : i32 = index; + let x_271 : BST = tree_1[x_269]; + currentNode = x_271; + let x_273 : i32 = currentNode.data; + let x_274 : i32 = *(target); + if ((x_273 == x_274)) { + let x_278 : i32 = *(target); + return x_278; + } + let x_279 : i32 = *(target); + let x_281 : i32 = currentNode.data; + if ((x_279 > x_281)) { + let x_287 : i32 = currentNode.rightIndex; + x_261 = x_287; + } else { + let x_289 : i32 = currentNode.leftIndex; + x_261 = x_289; + } + let x_290 : i32 = x_261; + index = x_290; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var count : i32; + var i : i32; + var result : i32; + var param_24 : i32; + treeIndex_1 = 0; + let x_91 : BST = tree_1[0]; + param_4 = x_91; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_93 : BST = param_4; + tree_1[0] = x_93; + let x_95 : i32 = treeIndex_1; + treeIndex_1 = (x_95 + 1); + let x_97 : i32 = treeIndex_1; + param_6 = x_97; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_99 : i32 = treeIndex_1; + treeIndex_1 = (x_99 + 1); + let x_101 : i32 = treeIndex_1; + param_8 = x_101; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_103 : i32 = treeIndex_1; + treeIndex_1 = (x_103 + 1); + let x_105 : i32 = treeIndex_1; + param_10 = x_105; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_107 : i32 = treeIndex_1; + treeIndex_1 = (x_107 + 1); + let x_109 : i32 = treeIndex_1; + param_12 = x_109; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_111 : i32 = treeIndex_1; + treeIndex_1 = (x_111 + 1); + let x_113 : i32 = treeIndex_1; + param_14 = x_113; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_115 : i32 = treeIndex_1; + treeIndex_1 = (x_115 + 1); + let x_117 : i32 = treeIndex_1; + param_16 = x_117; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_119 : i32 = treeIndex_1; + treeIndex_1 = (x_119 + 1); + let x_121 : i32 = treeIndex_1; + param_18 = x_121; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_123 : i32 = treeIndex_1; + treeIndex_1 = (x_123 + 1); + let x_125 : i32 = treeIndex_1; + param_20 = x_125; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_127 : i32 = treeIndex_1; + treeIndex_1 = (x_127 + 1); + let x_129 : i32 = treeIndex_1; + param_22 = x_129; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + count = 0; + i = 0; + loop { + let x_135 : i32 = i; + if ((x_135 < 20)) { + } else { + break; + } + let x_138 : i32 = i; + param_24 = x_138; + let x_139 : i32 = search_i1_(&(param_24)); + result = x_139; + let x_140 : i32 = i; + switch(x_140) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_150 : i32 = result; + let x_151 : i32 = i; + if ((x_150 == x_151)) { + let x_155 : i32 = count; + count = (x_155 + 1); + } + } + default: { + let x_144 : i32 = result; + if ((x_144 == -1)) { + let x_148 : i32 = count; + count = (x_148 + 1); + } + } + } + + continuing { + let x_157 : i32 = i; + i = (x_157 + 1); + } + } + let x_159 : i32 = count; + if ((x_159 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..11cdc01241 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.hlsl @@ -0,0 +1,255 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree_1[10] = (BST[10])0; +cbuffer cbuffer_x_16 : register(b0, space0) { + uint4 x_16[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_165 = data; + tree.data = x_165; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + int x_170 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + while (true) { + const int x_175 = baseIndex; + const int x_176 = treeIndex; + if ((x_175 <= x_176)) { + } else { + break; + } + const int x_179 = data_1; + const int x_182 = tree_1[baseIndex].data; + if ((x_179 <= x_182)) { + const int x_189 = tree_1[baseIndex].leftIndex; + if ((x_189 == -1)) { + const int x_194 = baseIndex; + const int x_195 = treeIndex; + tree_1[x_194].leftIndex = x_195; + const float x_198 = asfloat(x_16[0].x); + const float x_200 = asfloat(x_16[0].y); + if ((x_198 < x_200)) { + const int x_204 = treeIndex; + const BST x_206 = tree_1[x_204]; + param = x_206; + const int x_207 = data_1; + param_1 = x_207; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_204] = param; + } + const float x_212 = asfloat(x_16[0].x); + const float x_214 = asfloat(x_16[0].y); + if ((x_212 < x_214)) { + return; + } + } else { + const int x_220 = tree_1[baseIndex].leftIndex; + baseIndex = x_220; + continue; + } + } else { + const float x_222 = asfloat(x_16[0].x); + const float x_224 = asfloat(x_16[0].y); + if ((x_222 < x_224)) { + const int x_231 = tree_1[baseIndex].rightIndex; + x_170 = x_231; + } else { + const int x_234 = tree_1[baseIndex].rightIndex; + x_170 = x_234; + } + if ((x_170 == -1)) { + const int x_240 = baseIndex; + const int x_241 = treeIndex; + tree_1[x_240].rightIndex = x_241; + const int x_243 = treeIndex; + const BST x_245 = tree_1[x_243]; + param_2 = x_245; + const int x_246 = data_1; + param_3 = x_246; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_243] = param_2; + return; + } else { + const int x_252 = tree_1[baseIndex].rightIndex; + baseIndex = x_252; + continue; + } + return; + } + const float x_254 = asfloat(x_16[0].x); + const float x_256 = asfloat(x_16[0].y); + if ((x_254 > x_256)) { + return; + } + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_261 = 0; + index = 0; + while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_271 = tree_1[index]; + currentNode = x_271; + const int x_273 = currentNode.data; + const int x_274 = target; + if ((x_273 == x_274)) { + const int x_278 = target; + return x_278; + } + const int x_279 = target; + const int x_281 = currentNode.data; + if ((x_279 > x_281)) { + const int x_287 = currentNode.rightIndex; + x_261 = x_287; + } else { + const int x_289 = currentNode.leftIndex; + x_261 = x_289; + } + index = x_261; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_91 = tree_1[0]; + param_4 = x_91; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree_1[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + for(; (i < 20); i = (i + 1)) { + param_24 = i; + const int x_139 = search_i1_(param_24); + result = x_139; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.msl new file mode 100644 index 0000000000..17bc280ecd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.msl @@ -0,0 +1,306 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const tree, thread int* const data) { + int const x_165 = *(data); + (*(tree)).data = x_165; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +void insert_i1_i1_(constant buf0& x_16, thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_4) { + int baseIndex = 0; + BST param = {}; + int param_1 = 0; + int x_170 = 0; + BST param_2 = {}; + int param_3 = 0; + baseIndex = 0; + while (true) { + int const x_175 = baseIndex; + int const x_176 = *(treeIndex); + if ((x_175 <= x_176)) { + } else { + break; + } + int const x_179 = *(data_1); + int const x_180 = baseIndex; + int const x_182 = (*(tint_symbol_4)).arr[x_180].data; + if ((x_179 <= x_182)) { + int const x_187 = baseIndex; + int const x_189 = (*(tint_symbol_4)).arr[x_187].leftIndex; + if ((x_189 == -1)) { + int const x_194 = baseIndex; + int const x_195 = *(treeIndex); + (*(tint_symbol_4)).arr[x_194].leftIndex = x_195; + float const x_198 = x_16.injectionSwitch.x; + float const x_200 = x_16.injectionSwitch.y; + if ((x_198 < x_200)) { + int const x_204 = *(treeIndex); + BST const x_206 = (*(tint_symbol_4)).arr[x_204]; + param = x_206; + int const x_207 = *(data_1); + param_1 = x_207; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + BST const x_209 = param; + (*(tint_symbol_4)).arr[x_204] = x_209; + } + float const x_212 = x_16.injectionSwitch.x; + float const x_214 = x_16.injectionSwitch.y; + if ((x_212 < x_214)) { + return; + } + } else { + int const x_218 = baseIndex; + int const x_220 = (*(tint_symbol_4)).arr[x_218].leftIndex; + baseIndex = x_220; + continue; + } + } else { + float const x_222 = x_16.injectionSwitch.x; + float const x_224 = x_16.injectionSwitch.y; + if ((x_222 < x_224)) { + int const x_229 = baseIndex; + int const x_231 = (*(tint_symbol_4)).arr[x_229].rightIndex; + x_170 = x_231; + } else { + int const x_232 = baseIndex; + int const x_234 = (*(tint_symbol_4)).arr[x_232].rightIndex; + x_170 = x_234; + } + int const x_235 = x_170; + if ((x_235 == -1)) { + int const x_240 = baseIndex; + int const x_241 = *(treeIndex); + (*(tint_symbol_4)).arr[x_240].rightIndex = x_241; + int const x_243 = *(treeIndex); + BST const x_245 = (*(tint_symbol_4)).arr[x_243]; + param_2 = x_245; + int const x_246 = *(data_1); + param_3 = x_246; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + BST const x_248 = param_2; + (*(tint_symbol_4)).arr[x_243] = x_248; + return; + } else { + int const x_250 = baseIndex; + int const x_252 = (*(tint_symbol_4)).arr[x_250].rightIndex; + baseIndex = x_252; + continue; + } + return; + } + float const x_254 = x_16.injectionSwitch.x; + float const x_256 = x_16.injectionSwitch.y; + if ((x_254 > x_256)) { + return; + } + } + return; +} + +int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_5) { + int index = 0; + BST currentNode = {}; + int x_261 = 0; + index = 0; + while (true) { + int const x_266 = index; + if ((x_266 != -1)) { + } else { + break; + } + int const x_269 = index; + BST const x_271 = (*(tint_symbol_5)).arr[x_269]; + currentNode = x_271; + int const x_273 = currentNode.data; + int const x_274 = *(target); + if ((x_273 == x_274)) { + int const x_278 = *(target); + return x_278; + } + int const x_279 = *(target); + int const x_281 = currentNode.data; + if ((x_279 > x_281)) { + int const x_287 = currentNode.rightIndex; + x_261 = x_287; + } else { + int const x_289 = currentNode.leftIndex; + x_261 = x_289; + } + int const x_290 = x_261; + index = x_290; + } + return -1; +} + +void main_1(constant buf0& x_16, thread tint_array_wrapper* const tint_symbol_6, thread float4* const tint_symbol_7) { + int treeIndex_1 = 0; + BST param_4 = {}; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + BST const x_91 = (*(tint_symbol_6)).arr[0]; + param_4 = x_91; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + BST const x_93 = param_4; + (*(tint_symbol_6)).arr[0] = x_93; + int const x_95 = treeIndex_1; + treeIndex_1 = (x_95 + 1); + int const x_97 = treeIndex_1; + param_6 = x_97; + param_7 = 5; + insert_i1_i1_(x_16, &(param_6), &(param_7), tint_symbol_6); + int const x_99 = treeIndex_1; + treeIndex_1 = (x_99 + 1); + int const x_101 = treeIndex_1; + param_8 = x_101; + param_9 = 12; + insert_i1_i1_(x_16, &(param_8), &(param_9), tint_symbol_6); + int const x_103 = treeIndex_1; + treeIndex_1 = (x_103 + 1); + int const x_105 = treeIndex_1; + param_10 = x_105; + param_11 = 15; + insert_i1_i1_(x_16, &(param_10), &(param_11), tint_symbol_6); + int const x_107 = treeIndex_1; + treeIndex_1 = (x_107 + 1); + int const x_109 = treeIndex_1; + param_12 = x_109; + param_13 = 7; + insert_i1_i1_(x_16, &(param_12), &(param_13), tint_symbol_6); + int const x_111 = treeIndex_1; + treeIndex_1 = (x_111 + 1); + int const x_113 = treeIndex_1; + param_14 = x_113; + param_15 = 8; + insert_i1_i1_(x_16, &(param_14), &(param_15), tint_symbol_6); + int const x_115 = treeIndex_1; + treeIndex_1 = (x_115 + 1); + int const x_117 = treeIndex_1; + param_16 = x_117; + param_17 = 2; + insert_i1_i1_(x_16, &(param_16), &(param_17), tint_symbol_6); + int const x_119 = treeIndex_1; + treeIndex_1 = (x_119 + 1); + int const x_121 = treeIndex_1; + param_18 = x_121; + param_19 = 6; + insert_i1_i1_(x_16, &(param_18), &(param_19), tint_symbol_6); + int const x_123 = treeIndex_1; + treeIndex_1 = (x_123 + 1); + int const x_125 = treeIndex_1; + param_20 = x_125; + param_21 = 17; + insert_i1_i1_(x_16, &(param_20), &(param_21), tint_symbol_6); + int const x_127 = treeIndex_1; + treeIndex_1 = (x_127 + 1); + int const x_129 = treeIndex_1; + param_22 = x_129; + param_23 = 13; + insert_i1_i1_(x_16, &(param_22), &(param_23), tint_symbol_6); + count = 0; + i = 0; + while (true) { + int const x_135 = i; + if ((x_135 < 20)) { + } else { + break; + } + int const x_138 = i; + param_24 = x_138; + int const x_139 = search_i1_(&(param_24), tint_symbol_6); + result = x_139; + int const x_140 = i; + switch(x_140) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + int const x_150 = result; + int const x_151 = i; + if ((x_150 == x_151)) { + int const x_155 = count; + count = (x_155 + 1); + } + break; + } + default: { + int const x_144 = result; + if ((x_144 == -1)) { + int const x_148 = count; + count = (x_148 + 1); + } + break; + } + } + { + int const x_157 = i; + i = (x_157 + 1); + } + } + int const x_159 = count; + if ((x_159 == 20)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_16 [[buffer(0)]]) { + thread tint_array_wrapper tint_symbol_8 = {}; + thread float4 tint_symbol_9 = 0.0f; + main_1(x_16, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..990bb9a647 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.spvasm @@ -0,0 +1,539 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 355 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree_1 "tree_1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_16 "x_16" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode_struct_BST_i1_i1_i11_i1_" + OpName %tree "tree" + OpName %data "data" + OpName %insert_i1_i1_ "insert_i1_i1_" + OpName %treeIndex "treeIndex" + OpName %data_1 "data_1" + OpName %baseIndex "baseIndex" + OpName %param "param" + OpName %param_1 "param_1" + OpName %x_170 "x_170" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %search_i1_ "search_i1_" + OpName %target "target" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %x_261 "x_261" + OpName %main_1 "main_1" + OpName %treeIndex_1 "treeIndex_1" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %param_10 "param_10" + OpName %param_11 "param_11" + OpName %param_12 "param_12" + OpName %param_13 "param_13" + OpName %param_14 "param_14" + OpName %param_15 "param_15" + OpName %param_16 "param_16" + OpName %param_17 "param_17" + OpName %param_18 "param_18" + OpName %param_19 "param_19" + OpName %param_20 "param_20" + OpName %param_21 "param_21" + OpName %param_22 "param_22" + OpName %param_23 "param_23" + OpName %count "count" + OpName %i "i" + OpName %result "result" + OpName %param_24 "param_24" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_16 NonWritable + OpDecorate %x_16 DescriptorSet 0 + OpDecorate %x_16 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %8 = OpConstantNull %_arr_BST_uint_10 + %tree_1 = OpVariable %_ptr_Private__arr_BST_uint_10 Private %8 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_16 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int_n1 = OpConstant %int -1 + %uint_2 = OpConstant %uint 2 + %40 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %46 = OpConstantNull %int + %48 = OpConstantNull %BST + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_BST = OpTypePointer Private %BST + %161 = OpTypeFunction %int %_ptr_Function_int + %202 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %341 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %342 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %343 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %20 + %tree = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %27 = OpLabel + %29 = OpLoad %int %data + %32 = OpAccessChain %_ptr_Function_int %tree %uint_0 + OpStore %32 %29 + %35 = OpAccessChain %_ptr_Function_int %tree %uint_1 + OpStore %35 %int_n1 + %39 = OpAccessChain %_ptr_Function_int %tree %uint_2 + OpStore %39 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %40 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_1 = OpFunctionParameter %_ptr_Function_int + %44 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function %46 + %param = OpVariable %_ptr_Function_BST Function %48 + %param_1 = OpVariable %_ptr_Function_int Function %46 + %x_170 = OpVariable %_ptr_Function_int Function %46 + %param_2 = OpVariable %_ptr_Function_BST Function %48 + %param_3 = OpVariable %_ptr_Function_int Function %46 + OpStore %baseIndex %int_0 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %int %baseIndex + %60 = OpLoad %int %treeIndex + %61 = OpSLessThanEqual %bool %58 %60 + OpSelectionMerge %63 None + OpBranchConditional %61 %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %55 + %63 = OpLabel + %67 = OpLoad %int %data_1 + %68 = OpLoad %int %baseIndex + %70 = OpAccessChain %_ptr_Private_int %tree_1 %68 %uint_0 + %71 = OpLoad %int %70 + %72 = OpSLessThanEqual %bool %67 %71 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + %76 = OpLoad %int %baseIndex + %77 = OpAccessChain %_ptr_Private_int %tree_1 %76 %uint_1 + %78 = OpLoad %int %77 + %79 = OpIEqual %bool %78 %int_n1 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + %83 = OpLoad %int %baseIndex + %85 = OpLoad %int %treeIndex + %86 = OpAccessChain %_ptr_Private_int %tree_1 %83 %uint_1 + OpStore %86 %85 + %88 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_0 + %89 = OpLoad %float %88 + %90 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_1 + %91 = OpLoad %float %90 + %92 = OpFOrdLessThan %bool %89 %91 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %93 + %94 = OpLabel + %96 = OpLoad %int %treeIndex + %98 = OpAccessChain %_ptr_Private_BST %tree_1 %96 + %99 = OpLoad %BST %98 + OpStore %param %99 + %101 = OpLoad %int %data_1 + OpStore %param_1 %101 + %102 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_1 + %105 = OpLoad %BST %param + %106 = OpAccessChain %_ptr_Private_BST %tree_1 %96 + OpStore %106 %105 + OpBranch %93 + %93 = OpLabel + %107 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_0 + %108 = OpLoad %float %107 + %109 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_1 + %110 = OpLoad %float %109 + %111 = OpFOrdLessThan %bool %108 %110 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %112 + %113 = OpLabel + OpReturn + %112 = OpLabel + OpBranch %80 + %82 = OpLabel + %114 = OpLoad %int %baseIndex + %115 = OpAccessChain %_ptr_Private_int %tree_1 %114 %uint_1 + %116 = OpLoad %int %115 + OpStore %baseIndex %116 + OpBranch %56 + %80 = OpLabel + OpBranch %73 + %75 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_0 + %118 = OpLoad %float %117 + %119 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_1 + %120 = OpLoad %float %119 + %121 = OpFOrdLessThan %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + %125 = OpLoad %int %baseIndex + %126 = OpAccessChain %_ptr_Private_int %tree_1 %125 %uint_2 + %127 = OpLoad %int %126 + OpStore %x_170 %127 + OpBranch %122 + %124 = OpLabel + %128 = OpLoad %int %baseIndex + %129 = OpAccessChain %_ptr_Private_int %tree_1 %128 %uint_2 + %130 = OpLoad %int %129 + OpStore %x_170 %130 + OpBranch %122 + %122 = OpLabel + %131 = OpLoad %int %x_170 + %132 = OpIEqual %bool %131 %int_n1 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %135 + %134 = OpLabel + %136 = OpLoad %int %baseIndex + %138 = OpLoad %int %treeIndex + %139 = OpAccessChain %_ptr_Private_int %tree_1 %136 %uint_2 + OpStore %139 %138 + %141 = OpLoad %int %treeIndex + %142 = OpAccessChain %_ptr_Private_BST %tree_1 %141 + %143 = OpLoad %BST %142 + OpStore %param_2 %143 + %145 = OpLoad %int %data_1 + OpStore %param_3 %145 + %146 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_2 %param_3 + %149 = OpLoad %BST %param_2 + %150 = OpAccessChain %_ptr_Private_BST %tree_1 %141 + OpStore %150 %149 + OpReturn + %135 = OpLabel + %151 = OpLoad %int %baseIndex + %152 = OpAccessChain %_ptr_Private_int %tree_1 %151 %uint_2 + %153 = OpLoad %int %152 + OpStore %baseIndex %153 + OpBranch %56 + %133 = OpLabel + OpReturn + %73 = OpLabel + %154 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_0 + %155 = OpLoad %float %154 + %156 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_1 + %157 = OpLoad %float %156 + %158 = OpFOrdGreaterThan %bool %155 %157 + OpSelectionMerge %159 None + OpBranchConditional %158 %160 %159 + %160 = OpLabel + OpReturn + %159 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranch %54 + %55 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %161 + %target = OpFunctionParameter %_ptr_Function_int + %164 = OpLabel + %index = OpVariable %_ptr_Function_int Function %46 +%currentNode = OpVariable %_ptr_Function_BST Function %48 + %x_261 = OpVariable %_ptr_Function_int Function %46 + OpStore %index %int_0 + OpBranch %168 + %168 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %172 = OpLoad %int %index + %173 = OpINotEqual %bool %172 %int_n1 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %176 + %175 = OpLabel + OpBranch %174 + %176 = OpLabel + OpBranch %169 + %174 = OpLabel + %177 = OpLoad %int %index + %178 = OpAccessChain %_ptr_Private_BST %tree_1 %177 + %179 = OpLoad %BST %178 + OpStore %currentNode %179 + %180 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %181 = OpLoad %int %180 + %183 = OpLoad %int %target + %184 = OpIEqual %bool %181 %183 + OpSelectionMerge %185 None + OpBranchConditional %184 %186 %185 + %186 = OpLabel + %188 = OpLoad %int %target + OpReturnValue %188 + %185 = OpLabel + %190 = OpLoad %int %target + %191 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %192 = OpLoad %int %191 + %193 = OpSGreaterThan %bool %190 %192 + OpSelectionMerge %194 None + OpBranchConditional %193 %195 %196 + %195 = OpLabel + %197 = OpAccessChain %_ptr_Function_int %currentNode %uint_2 + %198 = OpLoad %int %197 + OpStore %x_261 %198 + OpBranch %194 + %196 = OpLabel + %199 = OpAccessChain %_ptr_Function_int %currentNode %uint_1 + %200 = OpLoad %int %199 + OpStore %x_261 %200 + OpBranch %194 + %194 = OpLabel + %201 = OpLoad %int %x_261 + OpStore %index %201 + OpBranch %170 + %170 = OpLabel + OpBranch %168 + %169 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd + %main_1 = OpFunction %void None %202 + %204 = OpLabel +%treeIndex_1 = OpVariable %_ptr_Function_int Function %46 + %param_4 = OpVariable %_ptr_Function_BST Function %48 + %param_5 = OpVariable %_ptr_Function_int Function %46 + %param_6 = OpVariable %_ptr_Function_int Function %46 + %param_7 = OpVariable %_ptr_Function_int Function %46 + %param_8 = OpVariable %_ptr_Function_int Function %46 + %param_9 = OpVariable %_ptr_Function_int Function %46 + %param_10 = OpVariable %_ptr_Function_int Function %46 + %param_11 = OpVariable %_ptr_Function_int Function %46 + %param_12 = OpVariable %_ptr_Function_int Function %46 + %param_13 = OpVariable %_ptr_Function_int Function %46 + %param_14 = OpVariable %_ptr_Function_int Function %46 + %param_15 = OpVariable %_ptr_Function_int Function %46 + %param_16 = OpVariable %_ptr_Function_int Function %46 + %param_17 = OpVariable %_ptr_Function_int Function %46 + %param_18 = OpVariable %_ptr_Function_int Function %46 + %param_19 = OpVariable %_ptr_Function_int Function %46 + %param_20 = OpVariable %_ptr_Function_int Function %46 + %param_21 = OpVariable %_ptr_Function_int Function %46 + %param_22 = OpVariable %_ptr_Function_int Function %46 + %param_23 = OpVariable %_ptr_Function_int Function %46 + %count = OpVariable %_ptr_Function_int Function %46 + %i = OpVariable %_ptr_Function_int Function %46 + %result = OpVariable %_ptr_Function_int Function %46 + %param_24 = OpVariable %_ptr_Function_int Function %46 + OpStore %treeIndex_1 %int_0 + %230 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + %231 = OpLoad %BST %230 + OpStore %param_4 %231 + OpStore %param_5 %int_9 + %233 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_4 %param_5 + %236 = OpLoad %BST %param_4 + %237 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + OpStore %237 %236 + %238 = OpLoad %int %treeIndex_1 + %240 = OpIAdd %int %238 %int_1 + OpStore %treeIndex_1 %240 + %241 = OpLoad %int %treeIndex_1 + OpStore %param_6 %241 + OpStore %param_7 %int_5 + %243 = OpFunctionCall %void %insert_i1_i1_ %param_6 %param_7 + %246 = OpLoad %int %treeIndex_1 + %247 = OpIAdd %int %246 %int_1 + OpStore %treeIndex_1 %247 + %248 = OpLoad %int %treeIndex_1 + OpStore %param_8 %248 + OpStore %param_9 %int_12 + %250 = OpFunctionCall %void %insert_i1_i1_ %param_8 %param_9 + %253 = OpLoad %int %treeIndex_1 + %254 = OpIAdd %int %253 %int_1 + OpStore %treeIndex_1 %254 + %255 = OpLoad %int %treeIndex_1 + OpStore %param_10 %255 + OpStore %param_11 %int_15 + %257 = OpFunctionCall %void %insert_i1_i1_ %param_10 %param_11 + %260 = OpLoad %int %treeIndex_1 + %261 = OpIAdd %int %260 %int_1 + OpStore %treeIndex_1 %261 + %262 = OpLoad %int %treeIndex_1 + OpStore %param_12 %262 + OpStore %param_13 %int_7 + %264 = OpFunctionCall %void %insert_i1_i1_ %param_12 %param_13 + %267 = OpLoad %int %treeIndex_1 + %268 = OpIAdd %int %267 %int_1 + OpStore %treeIndex_1 %268 + %269 = OpLoad %int %treeIndex_1 + OpStore %param_14 %269 + OpStore %param_15 %int_8 + %271 = OpFunctionCall %void %insert_i1_i1_ %param_14 %param_15 + %274 = OpLoad %int %treeIndex_1 + %275 = OpIAdd %int %274 %int_1 + OpStore %treeIndex_1 %275 + %276 = OpLoad %int %treeIndex_1 + OpStore %param_16 %276 + OpStore %param_17 %int_2 + %278 = OpFunctionCall %void %insert_i1_i1_ %param_16 %param_17 + %281 = OpLoad %int %treeIndex_1 + %282 = OpIAdd %int %281 %int_1 + OpStore %treeIndex_1 %282 + %283 = OpLoad %int %treeIndex_1 + OpStore %param_18 %283 + OpStore %param_19 %int_6 + %285 = OpFunctionCall %void %insert_i1_i1_ %param_18 %param_19 + %288 = OpLoad %int %treeIndex_1 + %289 = OpIAdd %int %288 %int_1 + OpStore %treeIndex_1 %289 + %290 = OpLoad %int %treeIndex_1 + OpStore %param_20 %290 + OpStore %param_21 %int_17 + %292 = OpFunctionCall %void %insert_i1_i1_ %param_20 %param_21 + %295 = OpLoad %int %treeIndex_1 + %296 = OpIAdd %int %295 %int_1 + OpStore %treeIndex_1 %296 + %297 = OpLoad %int %treeIndex_1 + OpStore %param_22 %297 + OpStore %param_23 %int_13 + %299 = OpFunctionCall %void %insert_i1_i1_ %param_22 %param_23 + OpStore %count %int_0 + OpStore %i %int_0 + OpBranch %302 + %302 = OpLabel + OpLoopMerge %303 %304 None + OpBranch %305 + %305 = OpLabel + %306 = OpLoad %int %i + %308 = OpSLessThan %bool %306 %int_20 + OpSelectionMerge %309 None + OpBranchConditional %308 %310 %311 + %310 = OpLabel + OpBranch %309 + %311 = OpLabel + OpBranch %303 + %309 = OpLabel + %312 = OpLoad %int %i + OpStore %param_24 %312 + %313 = OpFunctionCall %int %search_i1_ %param_24 + OpStore %result %313 + %315 = OpLoad %int %i + OpSelectionMerge %316 None + OpSwitch %315 %317 2 %318 5 %318 6 %318 7 %318 8 %318 9 %318 12 %318 13 %318 15 %318 17 %318 + %318 = OpLabel + %319 = OpLoad %int %result + %320 = OpLoad %int %i + %321 = OpIEqual %bool %319 %320 + OpSelectionMerge %322 None + OpBranchConditional %321 %323 %322 + %323 = OpLabel + %324 = OpLoad %int %count + %325 = OpIAdd %int %324 %int_1 + OpStore %count %325 + OpBranch %322 + %322 = OpLabel + OpBranch %316 + %317 = OpLabel + %326 = OpLoad %int %result + %327 = OpIEqual %bool %326 %int_n1 + OpSelectionMerge %328 None + OpBranchConditional %327 %329 %328 + %329 = OpLabel + %330 = OpLoad %int %count + %331 = OpIAdd %int %330 %int_1 + OpStore %count %331 + OpBranch %328 + %328 = OpLabel + OpBranch %316 + %316 = OpLabel + OpBranch %304 + %304 = OpLabel + %332 = OpLoad %int %i + %333 = OpIAdd %int %332 %int_1 + OpStore %i %333 + OpBranch %302 + %303 = OpLabel + %334 = OpLoad %int %count + %335 = OpIEqual %bool %334 %int_20 + OpSelectionMerge %336 None + OpBranchConditional %335 %337 %338 + %337 = OpLabel + OpStore %x_GLF_color %341 + OpBranch %336 + %338 = OpLabel + OpStore %x_GLF_color %342 + OpBranch %336 + %336 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %343 +%tint_symbol = OpFunctionParameter %main_out + %347 = OpLabel + %348 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %348 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %202 + %350 = OpLabel + %351 = OpFunctionCall %void %main_1 + %353 = OpLoad %v4float %x_GLF_color + %354 = OpCompositeConstruct %main_out %353 + %352 = OpFunctionCall %void %tint_symbol_2 %354 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..06f95bb861 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-nested-if-and-conditional/1.wgsl.expected.wgsl @@ -0,0 +1,293 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var tree_1 : array; + +[[group(0), binding(0)]] var x_16 : buf0; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(tree : ptr, data : ptr) { + let x_165 : i32 = *(data); + (*(tree)).data = x_165; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var x_170 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_175 : i32 = baseIndex; + let x_176 : i32 = *(treeIndex); + if ((x_175 <= x_176)) { + } else { + break; + } + let x_179 : i32 = *(data_1); + let x_180 : i32 = baseIndex; + let x_182 : i32 = tree_1[x_180].data; + if ((x_179 <= x_182)) { + let x_187 : i32 = baseIndex; + let x_189 : i32 = tree_1[x_187].leftIndex; + if ((x_189 == -1)) { + let x_194 : i32 = baseIndex; + let x_195 : i32 = *(treeIndex); + tree_1[x_194].leftIndex = x_195; + let x_198 : f32 = x_16.injectionSwitch.x; + let x_200 : f32 = x_16.injectionSwitch.y; + if ((x_198 < x_200)) { + let x_204 : i32 = *(treeIndex); + let x_206 : BST = tree_1[x_204]; + param = x_206; + let x_207 : i32 = *(data_1); + param_1 = x_207; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_209 : BST = param; + tree_1[x_204] = x_209; + } + let x_212 : f32 = x_16.injectionSwitch.x; + let x_214 : f32 = x_16.injectionSwitch.y; + if ((x_212 < x_214)) { + return; + } + } else { + let x_218 : i32 = baseIndex; + let x_220 : i32 = tree_1[x_218].leftIndex; + baseIndex = x_220; + continue; + } + } else { + let x_222 : f32 = x_16.injectionSwitch.x; + let x_224 : f32 = x_16.injectionSwitch.y; + if ((x_222 < x_224)) { + let x_229 : i32 = baseIndex; + let x_231 : i32 = tree_1[x_229].rightIndex; + x_170 = x_231; + } else { + let x_232 : i32 = baseIndex; + let x_234 : i32 = tree_1[x_232].rightIndex; + x_170 = x_234; + } + let x_235 : i32 = x_170; + if ((x_235 == -1)) { + let x_240 : i32 = baseIndex; + let x_241 : i32 = *(treeIndex); + tree_1[x_240].rightIndex = x_241; + let x_243 : i32 = *(treeIndex); + let x_245 : BST = tree_1[x_243]; + param_2 = x_245; + let x_246 : i32 = *(data_1); + param_3 = x_246; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_248 : BST = param_2; + tree_1[x_243] = x_248; + return; + } else { + let x_250 : i32 = baseIndex; + let x_252 : i32 = tree_1[x_250].rightIndex; + baseIndex = x_252; + continue; + } + return; + } + let x_254 : f32 = x_16.injectionSwitch.x; + let x_256 : f32 = x_16.injectionSwitch.y; + if ((x_254 > x_256)) { + return; + } + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_261 : i32; + index = 0; + loop { + let x_266 : i32 = index; + if ((x_266 != -1)) { + } else { + break; + } + let x_269 : i32 = index; + let x_271 : BST = tree_1[x_269]; + currentNode = x_271; + let x_273 : i32 = currentNode.data; + let x_274 : i32 = *(target); + if ((x_273 == x_274)) { + let x_278 : i32 = *(target); + return x_278; + } + let x_279 : i32 = *(target); + let x_281 : i32 = currentNode.data; + if ((x_279 > x_281)) { + let x_287 : i32 = currentNode.rightIndex; + x_261 = x_287; + } else { + let x_289 : i32 = currentNode.leftIndex; + x_261 = x_289; + } + let x_290 : i32 = x_261; + index = x_290; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var count : i32; + var i : i32; + var result : i32; + var param_24 : i32; + treeIndex_1 = 0; + let x_91 : BST = tree_1[0]; + param_4 = x_91; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_93 : BST = param_4; + tree_1[0] = x_93; + let x_95 : i32 = treeIndex_1; + treeIndex_1 = (x_95 + 1); + let x_97 : i32 = treeIndex_1; + param_6 = x_97; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_99 : i32 = treeIndex_1; + treeIndex_1 = (x_99 + 1); + let x_101 : i32 = treeIndex_1; + param_8 = x_101; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_103 : i32 = treeIndex_1; + treeIndex_1 = (x_103 + 1); + let x_105 : i32 = treeIndex_1; + param_10 = x_105; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_107 : i32 = treeIndex_1; + treeIndex_1 = (x_107 + 1); + let x_109 : i32 = treeIndex_1; + param_12 = x_109; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_111 : i32 = treeIndex_1; + treeIndex_1 = (x_111 + 1); + let x_113 : i32 = treeIndex_1; + param_14 = x_113; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_115 : i32 = treeIndex_1; + treeIndex_1 = (x_115 + 1); + let x_117 : i32 = treeIndex_1; + param_16 = x_117; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_119 : i32 = treeIndex_1; + treeIndex_1 = (x_119 + 1); + let x_121 : i32 = treeIndex_1; + param_18 = x_121; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_123 : i32 = treeIndex_1; + treeIndex_1 = (x_123 + 1); + let x_125 : i32 = treeIndex_1; + param_20 = x_125; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_127 : i32 = treeIndex_1; + treeIndex_1 = (x_127 + 1); + let x_129 : i32 = treeIndex_1; + param_22 = x_129; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + count = 0; + i = 0; + loop { + let x_135 : i32 = i; + if ((x_135 < 20)) { + } else { + break; + } + let x_138 : i32 = i; + param_24 = x_138; + let x_139 : i32 = search_i1_(&(param_24)); + result = x_139; + let x_140 : i32 = i; + switch(x_140) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_150 : i32 = result; + let x_151 : i32 = i; + if ((x_150 == x_151)) { + let x_155 : i32 = count; + count = (x_155 + 1); + } + } + default: { + let x_144 : i32 = result; + if ((x_144 == -1)) { + let x_148 : i32 = count; + count = (x_148 + 1); + } + } + } + + continuing { + let x_157 : i32 = i; + i = (x_157 + 1); + } + } + let x_159 : i32 = count; + if ((x_159 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm new file mode 100644 index 0000000000..6c9029f2b4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm @@ -0,0 +1,420 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode(struct-BST-i1-i1-i11;i1;" + OpName %node "node" + OpName %data "data" + OpName %insert_i1_i1_ "insert(i1;i1;" + OpName %treeIndex "treeIndex" + OpName %data_0 "data" + OpName %search_i1_ "search(i1;" + OpName %target "target" + OpName %baseIndex "baseIndex" + OpName %tree "tree" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %treeIndex_0 "treeIndex" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %param_5 "param" + OpName %param_6 "param" + OpName %param_7 "param" + OpName %param_8 "param" + OpName %param_9 "param" + OpName %param_10 "param" + OpName %param_11 "param" + OpName %param_12 "param" + OpName %param_13 "param" + OpName %param_14 "param" + OpName %param_15 "param" + OpName %param_16 "param" + OpName %param_17 "param" + OpName %param_18 "param" + OpName %param_19 "param" + OpName %param_20 "param" + OpName %param_21 "param" + OpName %param_22 "param" + OpName %count "count" + OpName %i "i" + OpName %result "result" + OpName %param_23 "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %47 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %51 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %52 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %53 = OpTypeFunction %int %_ptr_Function_int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %tree = OpVariable %_ptr_Private__arr_BST_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %80 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %81 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main = OpFunction %void None %47 + %82 = OpLabel +%treeIndex_0 = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_BST Function + %param_4 = OpVariable %_ptr_Function_int Function + %param_5 = OpVariable %_ptr_Function_int Function + %param_6 = OpVariable %_ptr_Function_int Function + %param_7 = OpVariable %_ptr_Function_int Function + %param_8 = OpVariable %_ptr_Function_int Function + %param_9 = OpVariable %_ptr_Function_int Function + %param_10 = OpVariable %_ptr_Function_int Function + %param_11 = OpVariable %_ptr_Function_int Function + %param_12 = OpVariable %_ptr_Function_int Function + %param_13 = OpVariable %_ptr_Function_int Function + %param_14 = OpVariable %_ptr_Function_int Function + %param_15 = OpVariable %_ptr_Function_int Function + %param_16 = OpVariable %_ptr_Function_int Function + %param_17 = OpVariable %_ptr_Function_int Function + %param_18 = OpVariable %_ptr_Function_int Function + %param_19 = OpVariable %_ptr_Function_int Function + %param_20 = OpVariable %_ptr_Function_int Function + %param_21 = OpVariable %_ptr_Function_int Function + %param_22 = OpVariable %_ptr_Function_int Function + %count = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %result = OpVariable %_ptr_Function_int Function + %param_23 = OpVariable %_ptr_Function_int Function + OpStore %treeIndex_0 %int_0 + %83 = OpAccessChain %_ptr_Private_BST %tree %int_0 + %84 = OpLoad %BST %83 + OpStore %param_3 %84 + OpStore %param_4 %int_9 + %85 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_3 %param_4 + %86 = OpLoad %BST %param_3 + %87 = OpAccessChain %_ptr_Private_BST %tree %int_0 + OpStore %87 %86 + %88 = OpLoad %int %treeIndex_0 + %89 = OpIAdd %int %88 %int_1 + OpStore %treeIndex_0 %89 + %90 = OpLoad %int %treeIndex_0 + OpStore %param_5 %90 + OpStore %param_6 %int_5 + %91 = OpFunctionCall %void %insert_i1_i1_ %param_5 %param_6 + %92 = OpLoad %int %treeIndex_0 + %93 = OpIAdd %int %92 %int_1 + OpStore %treeIndex_0 %93 + %94 = OpLoad %int %treeIndex_0 + OpStore %param_7 %94 + OpStore %param_8 %int_12 + %95 = OpFunctionCall %void %insert_i1_i1_ %param_7 %param_8 + %96 = OpLoad %int %treeIndex_0 + %97 = OpIAdd %int %96 %int_1 + OpStore %treeIndex_0 %97 + %98 = OpLoad %int %treeIndex_0 + OpStore %param_9 %98 + OpStore %param_10 %int_15 + %99 = OpFunctionCall %void %insert_i1_i1_ %param_9 %param_10 + %100 = OpLoad %int %treeIndex_0 + %101 = OpIAdd %int %100 %int_1 + OpStore %treeIndex_0 %101 + %102 = OpLoad %int %treeIndex_0 + OpStore %param_11 %102 + OpStore %param_12 %int_7 + %103 = OpFunctionCall %void %insert_i1_i1_ %param_11 %param_12 + %104 = OpLoad %int %treeIndex_0 + %105 = OpIAdd %int %104 %int_1 + OpStore %treeIndex_0 %105 + %106 = OpLoad %int %treeIndex_0 + OpStore %param_13 %106 + OpStore %param_14 %int_8 + %107 = OpFunctionCall %void %insert_i1_i1_ %param_13 %param_14 + %108 = OpLoad %int %treeIndex_0 + %109 = OpIAdd %int %108 %int_1 + OpStore %treeIndex_0 %109 + %110 = OpLoad %int %treeIndex_0 + OpStore %param_15 %110 + OpStore %param_16 %int_2 + %111 = OpFunctionCall %void %insert_i1_i1_ %param_15 %param_16 + %112 = OpLoad %int %treeIndex_0 + %113 = OpIAdd %int %112 %int_1 + OpStore %treeIndex_0 %113 + %114 = OpLoad %int %treeIndex_0 + OpStore %param_17 %114 + OpStore %param_18 %int_6 + %115 = OpFunctionCall %void %insert_i1_i1_ %param_17 %param_18 + %116 = OpLoad %int %treeIndex_0 + %117 = OpIAdd %int %116 %int_1 + OpStore %treeIndex_0 %117 + %118 = OpLoad %int %treeIndex_0 + OpStore %param_19 %118 + OpStore %param_20 %int_17 + %119 = OpFunctionCall %void %insert_i1_i1_ %param_19 %param_20 + %120 = OpLoad %int %treeIndex_0 + %121 = OpIAdd %int %120 %int_1 + OpStore %treeIndex_0 %121 + %122 = OpLoad %int %treeIndex_0 + OpStore %param_21 %122 + OpStore %param_22 %int_13 + %123 = OpFunctionCall %void %insert_i1_i1_ %param_21 %param_22 + OpStore %count %int_0 + OpStore %i %int_0 + OpBranch %124 + %124 = OpLabel + OpLoopMerge %125 %126 None + OpBranch %127 + %127 = OpLabel + %128 = OpLoad %int %i + %129 = OpSLessThan %bool %128 %int_20 + OpBranchConditional %129 %130 %125 + %130 = OpLabel + %131 = OpLoad %int %i + OpStore %param_23 %131 + %132 = OpFunctionCall %int %search_i1_ %param_23 + OpStore %result %132 + %133 = OpLoad %int %i + OpSelectionMerge %134 None + OpSwitch %133 %135 9 %136 5 %136 12 %136 15 %136 7 %136 8 %136 2 %136 6 %136 17 %136 13 %136 + %135 = OpLabel + %137 = OpLoad %int %result + %138 = OpIEqual %bool %137 %int_n1 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpLoad %int %count + %142 = OpIAdd %int %141 %int_1 + OpStore %count %142 + OpBranch %139 + %139 = OpLabel + OpBranch %134 + %136 = OpLabel + %143 = OpLoad %int %result + %144 = OpLoad %int %i + %145 = OpIEqual %bool %143 %144 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %148 = OpLoad %int %count + %149 = OpIAdd %int %148 %int_1 + OpStore %count %149 + OpBranch %146 + %146 = OpLabel + OpBranch %134 + %134 = OpLabel + OpBranch %126 + %126 = OpLabel + %150 = OpLoad %int %i + %151 = OpIAdd %int %150 %int_1 + OpStore %i %151 + OpBranch %124 + %125 = OpLabel + %152 = OpLoad %int %count + %153 = OpIEqual %bool %152 %int_20 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + OpStore %_GLF_color %80 + OpBranch %154 + %156 = OpLabel + OpStore %_GLF_color %81 + OpBranch %154 + %154 = OpLabel + OpReturn + OpFunctionEnd +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %51 + %node = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %157 = OpLabel + %158 = OpLoad %int %data + %159 = OpAccessChain %_ptr_Function_int %node %int_0 + OpStore %159 %158 + %160 = OpAccessChain %_ptr_Function_int %node %int_1 + OpStore %160 %int_n1 + %161 = OpAccessChain %_ptr_Function_int %node %int_2 + OpStore %161 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %52 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_0 = OpFunctionParameter %_ptr_Function_int + %162 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_BST Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_BST Function + %param_2 = OpVariable %_ptr_Function_int Function + OpStore %baseIndex %int_0 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %164 %165 None + OpBranch %166 + %166 = OpLabel + %167 = OpLoad %int %baseIndex + %168 = OpLoad %int %treeIndex + %169 = OpSLessThanEqual %bool %167 %168 + OpBranchConditional %169 %170 %164 + %170 = OpLabel + %171 = OpLoad %int %data_0 + %172 = OpLoad %int %baseIndex + %173 = OpAccessChain %_ptr_Private_int %tree %172 %int_0 + %174 = OpLoad %int %173 + %175 = OpSLessThanEqual %bool %171 %174 + OpSelectionMerge %176 None + OpBranchConditional %175 %177 %178 + %177 = OpLabel + %179 = OpLoad %int %baseIndex + %180 = OpAccessChain %_ptr_Private_int %tree %179 %int_1 + %181 = OpLoad %int %180 + %182 = OpIEqual %bool %181 %int_n1 + OpSelectionMerge %183 None + OpBranchConditional %182 %184 %185 + %184 = OpLabel + %186 = OpLoad %int %baseIndex + %187 = OpLoad %int %treeIndex + %188 = OpAccessChain %_ptr_Private_int %tree %186 %int_1 + OpStore %188 %187 + %189 = OpLoad %int %treeIndex + %190 = OpAccessChain %_ptr_Private_BST %tree %189 + %191 = OpLoad %BST %190 + OpStore %param %191 + %192 = OpLoad %int %data_0 + OpStore %param_0 %192 + %193 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_0 + %194 = OpLoad %BST %param + %195 = OpAccessChain %_ptr_Private_BST %tree %189 + OpStore %195 %194 + OpReturn + %185 = OpLabel + %196 = OpLoad %int %baseIndex + %197 = OpAccessChain %_ptr_Private_int %tree %196 %int_1 + %198 = OpLoad %int %197 + OpStore %baseIndex %198 + OpBranch %165 + %183 = OpLabel + OpUnreachable + %178 = OpLabel + %199 = OpLoad %int %baseIndex + %200 = OpAccessChain %_ptr_Private_int %tree %199 %int_2 + %201 = OpLoad %int %200 + %202 = OpIEqual %bool %201 %int_n1 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %205 + %204 = OpLabel + %206 = OpLoad %int %baseIndex + %207 = OpLoad %int %treeIndex + %208 = OpAccessChain %_ptr_Private_int %tree %206 %int_2 + OpStore %208 %207 + %209 = OpLoad %int %treeIndex + %210 = OpAccessChain %_ptr_Private_BST %tree %209 + %211 = OpLoad %BST %210 + OpStore %param_1 %211 + %212 = OpLoad %int %data_0 + OpStore %param_2 %212 + %213 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_1 %param_2 + %214 = OpLoad %BST %param_1 + %215 = OpAccessChain %_ptr_Private_BST %tree %209 + OpStore %215 %214 + OpReturn + %205 = OpLabel + %216 = OpLoad %int %baseIndex + %217 = OpAccessChain %_ptr_Private_int %tree %216 %int_2 + %218 = OpLoad %int %217 + OpStore %baseIndex %218 + OpBranch %165 + %203 = OpLabel + OpUnreachable + %176 = OpLabel + OpUnreachable + %165 = OpLabel + OpBranch %163 + %164 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %53 + %target = OpFunctionParameter %_ptr_Function_int + %219 = OpLabel + %index = OpVariable %_ptr_Function_int Function +%currentNode = OpVariable %_ptr_Function_BST Function + %220 = OpVariable %_ptr_Function_int Function + OpStore %index %int_0 + OpBranch %221 + %221 = OpLabel + OpLoopMerge %222 %223 None + OpBranch %224 + %224 = OpLabel + %225 = OpLoad %int %index + %226 = OpINotEqual %bool %225 %int_n1 + OpBranchConditional %226 %227 %222 + %227 = OpLabel + %228 = OpLoad %int %index + %229 = OpAccessChain %_ptr_Private_BST %tree %228 + %230 = OpLoad %BST %229 + OpStore %currentNode %230 + %231 = OpAccessChain %_ptr_Function_int %currentNode %int_0 + %232 = OpLoad %int %231 + %233 = OpLoad %int %target + %234 = OpIEqual %bool %232 %233 + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %235 + %236 = OpLabel + %237 = OpLoad %int %target + OpReturnValue %237 + %235 = OpLabel + %238 = OpLoad %int %target + %239 = OpAccessChain %_ptr_Function_int %currentNode %int_0 + %240 = OpLoad %int %239 + %241 = OpSGreaterThan %bool %238 %240 + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %244 + %243 = OpLabel + %245 = OpAccessChain %_ptr_Function_int %currentNode %int_2 + %246 = OpLoad %int %245 + OpStore %220 %246 + OpBranch %242 + %244 = OpLabel + %247 = OpAccessChain %_ptr_Function_int %currentNode %int_1 + %248 = OpLoad %int %247 + OpStore %220 %248 + OpBranch %242 + %242 = OpLabel + %249 = OpLoad %int %220 + OpStore %index %249 + OpBranch %223 + %223 = OpLabel + OpBranch %221 + %222 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..1a82ba823b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.hlsl @@ -0,0 +1,232 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree[10] = (BST[10])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) { + const int x_158 = data; + node.data = x_158; + node.leftIndex = -1; + node.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + while (true) { + const int x_167 = baseIndex; + const int x_168 = treeIndex; + if ((x_167 <= x_168)) { + } else { + break; + } + const int x_171 = data_1; + const int x_174 = tree[baseIndex].data; + if ((x_171 <= x_174)) { + const int x_181 = tree[baseIndex].leftIndex; + if ((x_181 == -1)) { + const int x_186 = baseIndex; + const int x_187 = treeIndex; + tree[x_186].leftIndex = x_187; + const int x_189 = treeIndex; + const BST x_191 = tree[x_189]; + param = x_191; + const int x_192 = data_1; + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree[x_189] = param; + return; + } else { + const int x_198 = tree[baseIndex].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + const int x_201 = tree[baseIndex].rightIndex; + if ((x_201 == -1)) { + const int x_206 = baseIndex; + const int x_207 = treeIndex; + tree[x_206].rightIndex = x_207; + const int x_209 = treeIndex; + const BST x_211 = tree[x_209]; + param_2 = x_211; + const int x_212 = data_1; + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree[x_209] = param_2; + return; + } else { + const int x_218 = tree[baseIndex].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_220 = 0; + index = 0; + while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_230 = tree[index]; + currentNode = x_230; + const int x_232 = currentNode.data; + const int x_233 = target; + if ((x_232 == x_233)) { + const int x_237 = target; + return x_237; + } + const int x_238 = target; + const int x_240 = currentNode.data; + if ((x_238 > x_240)) { + const int x_246 = currentNode.rightIndex; + x_220 = x_246; + } else { + const int x_248 = currentNode.leftIndex; + x_220 = x_248; + } + index = x_220; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_84 = tree[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + for(; (i < 20); i = (i + 1)) { + param_24 = i; + const int x_132 = search_i1_(param_24); + result = x_132; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..02ef450e82 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.msl @@ -0,0 +1,281 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const node, thread int* const data) { + int const x_158 = *(data); + (*(node)).data = x_158; + (*(node)).leftIndex = -1; + (*(node)).rightIndex = -1; + return; +} + +void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_4) { + int baseIndex = 0; + BST param = {}; + int param_1 = 0; + BST param_2 = {}; + int param_3 = 0; + baseIndex = 0; + while (true) { + int const x_167 = baseIndex; + int const x_168 = *(treeIndex); + if ((x_167 <= x_168)) { + } else { + break; + } + int const x_171 = *(data_1); + int const x_172 = baseIndex; + int const x_174 = (*(tint_symbol_4)).arr[x_172].data; + if ((x_171 <= x_174)) { + int const x_179 = baseIndex; + int const x_181 = (*(tint_symbol_4)).arr[x_179].leftIndex; + if ((x_181 == -1)) { + int const x_186 = baseIndex; + int const x_187 = *(treeIndex); + (*(tint_symbol_4)).arr[x_186].leftIndex = x_187; + int const x_189 = *(treeIndex); + BST const x_191 = (*(tint_symbol_4)).arr[x_189]; + param = x_191; + int const x_192 = *(data_1); + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + BST const x_194 = param; + (*(tint_symbol_4)).arr[x_189] = x_194; + return; + } else { + int const x_196 = baseIndex; + int const x_198 = (*(tint_symbol_4)).arr[x_196].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + int const x_199 = baseIndex; + int const x_201 = (*(tint_symbol_4)).arr[x_199].rightIndex; + if ((x_201 == -1)) { + int const x_206 = baseIndex; + int const x_207 = *(treeIndex); + (*(tint_symbol_4)).arr[x_206].rightIndex = x_207; + int const x_209 = *(treeIndex); + BST const x_211 = (*(tint_symbol_4)).arr[x_209]; + param_2 = x_211; + int const x_212 = *(data_1); + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + BST const x_214 = param_2; + (*(tint_symbol_4)).arr[x_209] = x_214; + return; + } else { + int const x_216 = baseIndex; + int const x_218 = (*(tint_symbol_4)).arr[x_216].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_5) { + int index = 0; + BST currentNode = {}; + int x_220 = 0; + index = 0; + while (true) { + int const x_225 = index; + if ((x_225 != -1)) { + } else { + break; + } + int const x_228 = index; + BST const x_230 = (*(tint_symbol_5)).arr[x_228]; + currentNode = x_230; + int const x_232 = currentNode.data; + int const x_233 = *(target); + if ((x_232 == x_233)) { + int const x_237 = *(target); + return x_237; + } + int const x_238 = *(target); + int const x_240 = currentNode.data; + if ((x_238 > x_240)) { + int const x_246 = currentNode.rightIndex; + x_220 = x_246; + } else { + int const x_248 = currentNode.leftIndex; + x_220 = x_248; + } + int const x_249 = x_220; + index = x_249; + } + return -1; +} + +void main_1(thread tint_array_wrapper* const tint_symbol_6, thread float4* const tint_symbol_7) { + int treeIndex_1 = 0; + BST param_4 = {}; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + BST const x_84 = (*(tint_symbol_6)).arr[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + BST const x_86 = param_4; + (*(tint_symbol_6)).arr[0] = x_86; + int const x_88 = treeIndex_1; + treeIndex_1 = (x_88 + 1); + int const x_90 = treeIndex_1; + param_6 = x_90; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7), tint_symbol_6); + int const x_92 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + int const x_94 = treeIndex_1; + param_8 = x_94; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9), tint_symbol_6); + int const x_96 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + int const x_98 = treeIndex_1; + param_10 = x_98; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11), tint_symbol_6); + int const x_100 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + int const x_102 = treeIndex_1; + param_12 = x_102; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13), tint_symbol_6); + int const x_104 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + int const x_106 = treeIndex_1; + param_14 = x_106; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15), tint_symbol_6); + int const x_108 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + int const x_110 = treeIndex_1; + param_16 = x_110; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17), tint_symbol_6); + int const x_112 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + int const x_114 = treeIndex_1; + param_18 = x_114; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19), tint_symbol_6); + int const x_116 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + int const x_118 = treeIndex_1; + param_20 = x_118; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21), tint_symbol_6); + int const x_120 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + int const x_122 = treeIndex_1; + param_22 = x_122; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23), tint_symbol_6); + count = 0; + i = 0; + while (true) { + int const x_128 = i; + if ((x_128 < 20)) { + } else { + break; + } + int const x_131 = i; + param_24 = x_131; + int const x_132 = search_i1_(&(param_24), tint_symbol_6); + result = x_132; + int const x_133 = i; + switch(x_133) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + int const x_143 = result; + int const x_144 = i; + if ((x_143 == x_144)) { + int const x_148 = count; + count = (x_148 + 1); + } + break; + } + default: { + int const x_137 = result; + if ((x_137 == -1)) { + int const x_141 = count; + count = (x_141 + 1); + } + break; + } + } + { + int const x_150 = i; + i = (x_150 + 1); + } + } + int const x_152 = count; + if ((x_152 == 20)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread tint_array_wrapper tint_symbol_8 = {}; + thread float4 tint_symbol_9 = 0.0f; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..68b226ddee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.spvasm @@ -0,0 +1,476 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 316 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree "tree" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode_struct_BST_i1_i1_i11_i1_" + OpName %node "node" + OpName %data "data" + OpName %insert_i1_i1_ "insert_i1_i1_" + OpName %treeIndex "treeIndex" + OpName %data_1 "data_1" + OpName %baseIndex "baseIndex" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %search_i1_ "search_i1_" + OpName %target "target" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %x_220 "x_220" + OpName %main_1 "main_1" + OpName %treeIndex_1 "treeIndex_1" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %param_10 "param_10" + OpName %param_11 "param_11" + OpName %param_12 "param_12" + OpName %param_13 "param_13" + OpName %param_14 "param_14" + OpName %param_15 "param_15" + OpName %param_16 "param_16" + OpName %param_17 "param_17" + OpName %param_18 "param_18" + OpName %param_19 "param_19" + OpName %param_20 "param_20" + OpName %param_21 "param_21" + OpName %param_22 "param_22" + OpName %param_23 "param_23" + OpName %count "count" + OpName %i "i" + OpName %result "result" + OpName %param_24 "param_24" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %8 = OpConstantNull %_arr_BST_uint_10 + %tree = OpVariable %_ptr_Private__arr_BST_uint_10 Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %16 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int_n1 = OpConstant %int -1 + %uint_2 = OpConstant %uint 2 + %36 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %42 = OpConstantNull %int + %44 = OpConstantNull %BST + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %122 = OpTypeFunction %int %_ptr_Function_int + %163 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %302 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %303 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %304 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %16 + %node = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %23 = OpLabel + %25 = OpLoad %int %data + %28 = OpAccessChain %_ptr_Function_int %node %uint_0 + OpStore %28 %25 + %31 = OpAccessChain %_ptr_Function_int %node %uint_1 + OpStore %31 %int_n1 + %35 = OpAccessChain %_ptr_Function_int %node %uint_2 + OpStore %35 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %36 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_1 = OpFunctionParameter %_ptr_Function_int + %40 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function %42 + %param = OpVariable %_ptr_Function_BST Function %44 + %param_1 = OpVariable %_ptr_Function_int Function %42 + %param_2 = OpVariable %_ptr_Function_BST Function %44 + %param_3 = OpVariable %_ptr_Function_int Function %42 + OpStore %baseIndex %int_0 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %int %baseIndex + %55 = OpLoad %int %treeIndex + %56 = OpSLessThanEqual %bool %53 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %50 + %58 = OpLabel + %62 = OpLoad %int %data_1 + %63 = OpLoad %int %baseIndex + %65 = OpAccessChain %_ptr_Private_int %tree %63 %uint_0 + %66 = OpLoad %int %65 + %67 = OpSLessThanEqual %bool %62 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %71 = OpLoad %int %baseIndex + %72 = OpAccessChain %_ptr_Private_int %tree %71 %uint_1 + %73 = OpLoad %int %72 + %74 = OpIEqual %bool %73 %int_n1 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + %78 = OpLoad %int %baseIndex + %80 = OpLoad %int %treeIndex + %81 = OpAccessChain %_ptr_Private_int %tree %78 %uint_1 + OpStore %81 %80 + %83 = OpLoad %int %treeIndex + %85 = OpAccessChain %_ptr_Private_BST %tree %83 + %86 = OpLoad %BST %85 + OpStore %param %86 + %88 = OpLoad %int %data_1 + OpStore %param_1 %88 + %89 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_1 + %92 = OpLoad %BST %param + %93 = OpAccessChain %_ptr_Private_BST %tree %83 + OpStore %93 %92 + OpReturn + %77 = OpLabel + %94 = OpLoad %int %baseIndex + %95 = OpAccessChain %_ptr_Private_int %tree %94 %uint_1 + %96 = OpLoad %int %95 + OpStore %baseIndex %96 + OpBranch %51 + %75 = OpLabel + OpReturn + %70 = OpLabel + %97 = OpLoad %int %baseIndex + %98 = OpAccessChain %_ptr_Private_int %tree %97 %uint_2 + %99 = OpLoad %int %98 + %100 = OpIEqual %bool %99 %int_n1 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %103 + %102 = OpLabel + %104 = OpLoad %int %baseIndex + %106 = OpLoad %int %treeIndex + %107 = OpAccessChain %_ptr_Private_int %tree %104 %uint_2 + OpStore %107 %106 + %109 = OpLoad %int %treeIndex + %110 = OpAccessChain %_ptr_Private_BST %tree %109 + %111 = OpLoad %BST %110 + OpStore %param_2 %111 + %113 = OpLoad %int %data_1 + OpStore %param_3 %113 + %114 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_2 %param_3 + %117 = OpLoad %BST %param_2 + %118 = OpAccessChain %_ptr_Private_BST %tree %109 + OpStore %118 %117 + OpReturn + %103 = OpLabel + %119 = OpLoad %int %baseIndex + %120 = OpAccessChain %_ptr_Private_int %tree %119 %uint_2 + %121 = OpLoad %int %120 + OpStore %baseIndex %121 + OpBranch %51 + %101 = OpLabel + OpReturn + %68 = OpLabel + OpReturn + %51 = OpLabel + OpBranch %49 + %50 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %122 + %target = OpFunctionParameter %_ptr_Function_int + %125 = OpLabel + %index = OpVariable %_ptr_Function_int Function %42 +%currentNode = OpVariable %_ptr_Function_BST Function %44 + %x_220 = OpVariable %_ptr_Function_int Function %42 + OpStore %index %int_0 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %133 = OpLoad %int %index + %134 = OpINotEqual %bool %133 %int_n1 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 + %136 = OpLabel + OpBranch %135 + %137 = OpLabel + OpBranch %130 + %135 = OpLabel + %138 = OpLoad %int %index + %139 = OpAccessChain %_ptr_Private_BST %tree %138 + %140 = OpLoad %BST %139 + OpStore %currentNode %140 + %141 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %142 = OpLoad %int %141 + %144 = OpLoad %int %target + %145 = OpIEqual %bool %142 %144 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %149 = OpLoad %int %target + OpReturnValue %149 + %146 = OpLabel + %151 = OpLoad %int %target + %152 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %153 = OpLoad %int %152 + %154 = OpSGreaterThan %bool %151 %153 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %157 + %156 = OpLabel + %158 = OpAccessChain %_ptr_Function_int %currentNode %uint_2 + %159 = OpLoad %int %158 + OpStore %x_220 %159 + OpBranch %155 + %157 = OpLabel + %160 = OpAccessChain %_ptr_Function_int %currentNode %uint_1 + %161 = OpLoad %int %160 + OpStore %x_220 %161 + OpBranch %155 + %155 = OpLabel + %162 = OpLoad %int %x_220 + OpStore %index %162 + OpBranch %131 + %131 = OpLabel + OpBranch %129 + %130 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd + %main_1 = OpFunction %void None %163 + %165 = OpLabel +%treeIndex_1 = OpVariable %_ptr_Function_int Function %42 + %param_4 = OpVariable %_ptr_Function_BST Function %44 + %param_5 = OpVariable %_ptr_Function_int Function %42 + %param_6 = OpVariable %_ptr_Function_int Function %42 + %param_7 = OpVariable %_ptr_Function_int Function %42 + %param_8 = OpVariable %_ptr_Function_int Function %42 + %param_9 = OpVariable %_ptr_Function_int Function %42 + %param_10 = OpVariable %_ptr_Function_int Function %42 + %param_11 = OpVariable %_ptr_Function_int Function %42 + %param_12 = OpVariable %_ptr_Function_int Function %42 + %param_13 = OpVariable %_ptr_Function_int Function %42 + %param_14 = OpVariable %_ptr_Function_int Function %42 + %param_15 = OpVariable %_ptr_Function_int Function %42 + %param_16 = OpVariable %_ptr_Function_int Function %42 + %param_17 = OpVariable %_ptr_Function_int Function %42 + %param_18 = OpVariable %_ptr_Function_int Function %42 + %param_19 = OpVariable %_ptr_Function_int Function %42 + %param_20 = OpVariable %_ptr_Function_int Function %42 + %param_21 = OpVariable %_ptr_Function_int Function %42 + %param_22 = OpVariable %_ptr_Function_int Function %42 + %param_23 = OpVariable %_ptr_Function_int Function %42 + %count = OpVariable %_ptr_Function_int Function %42 + %i = OpVariable %_ptr_Function_int Function %42 + %result = OpVariable %_ptr_Function_int Function %42 + %param_24 = OpVariable %_ptr_Function_int Function %42 + OpStore %treeIndex_1 %int_0 + %191 = OpAccessChain %_ptr_Private_BST %tree %int_0 + %192 = OpLoad %BST %191 + OpStore %param_4 %192 + OpStore %param_5 %int_9 + %194 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_4 %param_5 + %197 = OpLoad %BST %param_4 + %198 = OpAccessChain %_ptr_Private_BST %tree %int_0 + OpStore %198 %197 + %199 = OpLoad %int %treeIndex_1 + %201 = OpIAdd %int %199 %int_1 + OpStore %treeIndex_1 %201 + %202 = OpLoad %int %treeIndex_1 + OpStore %param_6 %202 + OpStore %param_7 %int_5 + %204 = OpFunctionCall %void %insert_i1_i1_ %param_6 %param_7 + %207 = OpLoad %int %treeIndex_1 + %208 = OpIAdd %int %207 %int_1 + OpStore %treeIndex_1 %208 + %209 = OpLoad %int %treeIndex_1 + OpStore %param_8 %209 + OpStore %param_9 %int_12 + %211 = OpFunctionCall %void %insert_i1_i1_ %param_8 %param_9 + %214 = OpLoad %int %treeIndex_1 + %215 = OpIAdd %int %214 %int_1 + OpStore %treeIndex_1 %215 + %216 = OpLoad %int %treeIndex_1 + OpStore %param_10 %216 + OpStore %param_11 %int_15 + %218 = OpFunctionCall %void %insert_i1_i1_ %param_10 %param_11 + %221 = OpLoad %int %treeIndex_1 + %222 = OpIAdd %int %221 %int_1 + OpStore %treeIndex_1 %222 + %223 = OpLoad %int %treeIndex_1 + OpStore %param_12 %223 + OpStore %param_13 %int_7 + %225 = OpFunctionCall %void %insert_i1_i1_ %param_12 %param_13 + %228 = OpLoad %int %treeIndex_1 + %229 = OpIAdd %int %228 %int_1 + OpStore %treeIndex_1 %229 + %230 = OpLoad %int %treeIndex_1 + OpStore %param_14 %230 + OpStore %param_15 %int_8 + %232 = OpFunctionCall %void %insert_i1_i1_ %param_14 %param_15 + %235 = OpLoad %int %treeIndex_1 + %236 = OpIAdd %int %235 %int_1 + OpStore %treeIndex_1 %236 + %237 = OpLoad %int %treeIndex_1 + OpStore %param_16 %237 + OpStore %param_17 %int_2 + %239 = OpFunctionCall %void %insert_i1_i1_ %param_16 %param_17 + %242 = OpLoad %int %treeIndex_1 + %243 = OpIAdd %int %242 %int_1 + OpStore %treeIndex_1 %243 + %244 = OpLoad %int %treeIndex_1 + OpStore %param_18 %244 + OpStore %param_19 %int_6 + %246 = OpFunctionCall %void %insert_i1_i1_ %param_18 %param_19 + %249 = OpLoad %int %treeIndex_1 + %250 = OpIAdd %int %249 %int_1 + OpStore %treeIndex_1 %250 + %251 = OpLoad %int %treeIndex_1 + OpStore %param_20 %251 + OpStore %param_21 %int_17 + %253 = OpFunctionCall %void %insert_i1_i1_ %param_20 %param_21 + %256 = OpLoad %int %treeIndex_1 + %257 = OpIAdd %int %256 %int_1 + OpStore %treeIndex_1 %257 + %258 = OpLoad %int %treeIndex_1 + OpStore %param_22 %258 + OpStore %param_23 %int_13 + %260 = OpFunctionCall %void %insert_i1_i1_ %param_22 %param_23 + OpStore %count %int_0 + OpStore %i %int_0 + OpBranch %263 + %263 = OpLabel + OpLoopMerge %264 %265 None + OpBranch %266 + %266 = OpLabel + %267 = OpLoad %int %i + %269 = OpSLessThan %bool %267 %int_20 + OpSelectionMerge %270 None + OpBranchConditional %269 %271 %272 + %271 = OpLabel + OpBranch %270 + %272 = OpLabel + OpBranch %264 + %270 = OpLabel + %273 = OpLoad %int %i + OpStore %param_24 %273 + %274 = OpFunctionCall %int %search_i1_ %param_24 + OpStore %result %274 + %276 = OpLoad %int %i + OpSelectionMerge %277 None + OpSwitch %276 %278 2 %279 5 %279 6 %279 7 %279 8 %279 9 %279 12 %279 13 %279 15 %279 17 %279 + %279 = OpLabel + %280 = OpLoad %int %result + %281 = OpLoad %int %i + %282 = OpIEqual %bool %280 %281 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %283 + %284 = OpLabel + %285 = OpLoad %int %count + %286 = OpIAdd %int %285 %int_1 + OpStore %count %286 + OpBranch %283 + %283 = OpLabel + OpBranch %277 + %278 = OpLabel + %287 = OpLoad %int %result + %288 = OpIEqual %bool %287 %int_n1 + OpSelectionMerge %289 None + OpBranchConditional %288 %290 %289 + %290 = OpLabel + %291 = OpLoad %int %count + %292 = OpIAdd %int %291 %int_1 + OpStore %count %292 + OpBranch %289 + %289 = OpLabel + OpBranch %277 + %277 = OpLabel + OpBranch %265 + %265 = OpLabel + %293 = OpLoad %int %i + %294 = OpIAdd %int %293 %int_1 + OpStore %i %294 + OpBranch %263 + %264 = OpLabel + %295 = OpLoad %int %count + %296 = OpIEqual %bool %295 %int_20 + OpSelectionMerge %297 None + OpBranchConditional %296 %298 %299 + %298 = OpLabel + OpStore %x_GLF_color %302 + OpBranch %297 + %299 = OpLabel + OpStore %x_GLF_color %303 + OpBranch %297 + %297 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %304 +%tint_symbol = OpFunctionParameter %main_out + %308 = OpLabel + %309 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %309 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %163 + %311 = OpLabel + %312 = OpFunctionCall %void %main_1 + %314 = OpLoad %v4float %x_GLF_color + %315 = OpCompositeConstruct %main_out %314 + %313 = OpFunctionCall %void %tint_symbol_2 %315 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..19d6c9d74f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.wgsl @@ -0,0 +1,264 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var tree : array; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(node : ptr, data : ptr) { + let x_158 : i32 = *(data); + (*(node)).data = x_158; + (*(node)).leftIndex = -1; + (*(node)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_167 : i32 = baseIndex; + let x_168 : i32 = *(treeIndex); + if ((x_167 <= x_168)) { + } else { + break; + } + let x_171 : i32 = *(data_1); + let x_172 : i32 = baseIndex; + let x_174 : i32 = tree[x_172].data; + if ((x_171 <= x_174)) { + let x_179 : i32 = baseIndex; + let x_181 : i32 = tree[x_179].leftIndex; + if ((x_181 == -1)) { + let x_186 : i32 = baseIndex; + let x_187 : i32 = *(treeIndex); + tree[x_186].leftIndex = x_187; + let x_189 : i32 = *(treeIndex); + let x_191 : BST = tree[x_189]; + param = x_191; + let x_192 : i32 = *(data_1); + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_194 : BST = param; + tree[x_189] = x_194; + return; + } else { + let x_196 : i32 = baseIndex; + let x_198 : i32 = tree[x_196].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + let x_199 : i32 = baseIndex; + let x_201 : i32 = tree[x_199].rightIndex; + if ((x_201 == -1)) { + let x_206 : i32 = baseIndex; + let x_207 : i32 = *(treeIndex); + tree[x_206].rightIndex = x_207; + let x_209 : i32 = *(treeIndex); + let x_211 : BST = tree[x_209]; + param_2 = x_211; + let x_212 : i32 = *(data_1); + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_214 : BST = param_2; + tree[x_209] = x_214; + return; + } else { + let x_216 : i32 = baseIndex; + let x_218 : i32 = tree[x_216].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_220 : i32; + index = 0; + loop { + let x_225 : i32 = index; + if ((x_225 != -1)) { + } else { + break; + } + let x_228 : i32 = index; + let x_230 : BST = tree[x_228]; + currentNode = x_230; + let x_232 : i32 = currentNode.data; + let x_233 : i32 = *(target); + if ((x_232 == x_233)) { + let x_237 : i32 = *(target); + return x_237; + } + let x_238 : i32 = *(target); + let x_240 : i32 = currentNode.data; + if ((x_238 > x_240)) { + let x_246 : i32 = currentNode.rightIndex; + x_220 = x_246; + } else { + let x_248 : i32 = currentNode.leftIndex; + x_220 = x_248; + } + let x_249 : i32 = x_220; + index = x_249; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var count : i32; + var i : i32; + var result : i32; + var param_24 : i32; + treeIndex_1 = 0; + let x_84 : BST = tree[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_86 : BST = param_4; + tree[0] = x_86; + let x_88 : i32 = treeIndex_1; + treeIndex_1 = (x_88 + 1); + let x_90 : i32 = treeIndex_1; + param_6 = x_90; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_92 : i32 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + let x_94 : i32 = treeIndex_1; + param_8 = x_94; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_96 : i32 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + let x_98 : i32 = treeIndex_1; + param_10 = x_98; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_100 : i32 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + let x_102 : i32 = treeIndex_1; + param_12 = x_102; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_104 : i32 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + let x_106 : i32 = treeIndex_1; + param_14 = x_106; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_108 : i32 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + let x_110 : i32 = treeIndex_1; + param_16 = x_110; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_112 : i32 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + let x_114 : i32 = treeIndex_1; + param_18 = x_114; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_116 : i32 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + let x_118 : i32 = treeIndex_1; + param_20 = x_118; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_120 : i32 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + let x_122 : i32 = treeIndex_1; + param_22 = x_122; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + count = 0; + i = 0; + loop { + let x_128 : i32 = i; + if ((x_128 < 20)) { + } else { + break; + } + let x_131 : i32 = i; + param_24 = x_131; + let x_132 : i32 = search_i1_(&(param_24)); + result = x_132; + let x_133 : i32 = i; + switch(x_133) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_143 : i32 = result; + let x_144 : i32 = i; + if ((x_143 == x_144)) { + let x_148 : i32 = count; + count = (x_148 + 1); + } + } + default: { + let x_137 : i32 = result; + if ((x_137 == -1)) { + let x_141 : i32 = count; + count = (x_141 + 1); + } + } + } + + continuing { + let x_150 : i32 = i; + i = (x_150 + 1); + } + } + let x_152 : i32 = count; + if ((x_152 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl new file mode 100644 index 0000000000..19d6c9d74f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl @@ -0,0 +1,264 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var tree : array; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(node : ptr, data : ptr) { + let x_158 : i32 = *(data); + (*(node)).data = x_158; + (*(node)).leftIndex = -1; + (*(node)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_167 : i32 = baseIndex; + let x_168 : i32 = *(treeIndex); + if ((x_167 <= x_168)) { + } else { + break; + } + let x_171 : i32 = *(data_1); + let x_172 : i32 = baseIndex; + let x_174 : i32 = tree[x_172].data; + if ((x_171 <= x_174)) { + let x_179 : i32 = baseIndex; + let x_181 : i32 = tree[x_179].leftIndex; + if ((x_181 == -1)) { + let x_186 : i32 = baseIndex; + let x_187 : i32 = *(treeIndex); + tree[x_186].leftIndex = x_187; + let x_189 : i32 = *(treeIndex); + let x_191 : BST = tree[x_189]; + param = x_191; + let x_192 : i32 = *(data_1); + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_194 : BST = param; + tree[x_189] = x_194; + return; + } else { + let x_196 : i32 = baseIndex; + let x_198 : i32 = tree[x_196].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + let x_199 : i32 = baseIndex; + let x_201 : i32 = tree[x_199].rightIndex; + if ((x_201 == -1)) { + let x_206 : i32 = baseIndex; + let x_207 : i32 = *(treeIndex); + tree[x_206].rightIndex = x_207; + let x_209 : i32 = *(treeIndex); + let x_211 : BST = tree[x_209]; + param_2 = x_211; + let x_212 : i32 = *(data_1); + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_214 : BST = param_2; + tree[x_209] = x_214; + return; + } else { + let x_216 : i32 = baseIndex; + let x_218 : i32 = tree[x_216].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_220 : i32; + index = 0; + loop { + let x_225 : i32 = index; + if ((x_225 != -1)) { + } else { + break; + } + let x_228 : i32 = index; + let x_230 : BST = tree[x_228]; + currentNode = x_230; + let x_232 : i32 = currentNode.data; + let x_233 : i32 = *(target); + if ((x_232 == x_233)) { + let x_237 : i32 = *(target); + return x_237; + } + let x_238 : i32 = *(target); + let x_240 : i32 = currentNode.data; + if ((x_238 > x_240)) { + let x_246 : i32 = currentNode.rightIndex; + x_220 = x_246; + } else { + let x_248 : i32 = currentNode.leftIndex; + x_220 = x_248; + } + let x_249 : i32 = x_220; + index = x_249; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var count : i32; + var i : i32; + var result : i32; + var param_24 : i32; + treeIndex_1 = 0; + let x_84 : BST = tree[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_86 : BST = param_4; + tree[0] = x_86; + let x_88 : i32 = treeIndex_1; + treeIndex_1 = (x_88 + 1); + let x_90 : i32 = treeIndex_1; + param_6 = x_90; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_92 : i32 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + let x_94 : i32 = treeIndex_1; + param_8 = x_94; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_96 : i32 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + let x_98 : i32 = treeIndex_1; + param_10 = x_98; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_100 : i32 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + let x_102 : i32 = treeIndex_1; + param_12 = x_102; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_104 : i32 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + let x_106 : i32 = treeIndex_1; + param_14 = x_106; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_108 : i32 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + let x_110 : i32 = treeIndex_1; + param_16 = x_110; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_112 : i32 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + let x_114 : i32 = treeIndex_1; + param_18 = x_114; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_116 : i32 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + let x_118 : i32 = treeIndex_1; + param_20 = x_118; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_120 : i32 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + let x_122 : i32 = treeIndex_1; + param_22 = x_122; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + count = 0; + i = 0; + loop { + let x_128 : i32 = i; + if ((x_128 < 20)) { + } else { + break; + } + let x_131 : i32 = i; + param_24 = x_131; + let x_132 : i32 = search_i1_(&(param_24)); + result = x_132; + let x_133 : i32 = i; + switch(x_133) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_143 : i32 = result; + let x_144 : i32 = i; + if ((x_143 == x_144)) { + let x_148 : i32 = count; + count = (x_148 + 1); + } + } + default: { + let x_137 : i32 = result; + if ((x_137 == -1)) { + let x_141 : i32 = count; + count = (x_141 + 1); + } + } + } + + continuing { + let x_150 : i32 = i; + i = (x_150 + 1); + } + } + let x_152 : i32 = count; + if ((x_152 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..1a82ba823b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.hlsl @@ -0,0 +1,232 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static BST tree[10] = (BST[10])0; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) { + const int x_158 = data; + node.data = x_158; + node.leftIndex = -1; + node.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + while (true) { + const int x_167 = baseIndex; + const int x_168 = treeIndex; + if ((x_167 <= x_168)) { + } else { + break; + } + const int x_171 = data_1; + const int x_174 = tree[baseIndex].data; + if ((x_171 <= x_174)) { + const int x_181 = tree[baseIndex].leftIndex; + if ((x_181 == -1)) { + const int x_186 = baseIndex; + const int x_187 = treeIndex; + tree[x_186].leftIndex = x_187; + const int x_189 = treeIndex; + const BST x_191 = tree[x_189]; + param = x_191; + const int x_192 = data_1; + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree[x_189] = param; + return; + } else { + const int x_198 = tree[baseIndex].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + const int x_201 = tree[baseIndex].rightIndex; + if ((x_201 == -1)) { + const int x_206 = baseIndex; + const int x_207 = treeIndex; + tree[x_206].rightIndex = x_207; + const int x_209 = treeIndex; + const BST x_211 = tree[x_209]; + param_2 = x_211; + const int x_212 = data_1; + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree[x_209] = param_2; + return; + } else { + const int x_218 = tree[baseIndex].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_220 = 0; + index = 0; + while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_230 = tree[index]; + currentNode = x_230; + const int x_232 = currentNode.data; + const int x_233 = target; + if ((x_232 == x_233)) { + const int x_237 = target; + return x_237; + } + const int x_238 = target; + const int x_240 = currentNode.data; + if ((x_238 > x_240)) { + const int x_246 = currentNode.rightIndex; + x_220 = x_246; + } else { + const int x_248 = currentNode.leftIndex; + x_220 = x_248; + } + index = x_220; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + const BST x_84 = tree[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + count = 0; + i = 0; + { + for(; (i < 20); i = (i + 1)) { + param_24 = i; + const int x_132 = search_i1_(param_24); + result = x_132; + switch(i) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..02ef450e82 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.msl @@ -0,0 +1,281 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const node, thread int* const data) { + int const x_158 = *(data); + (*(node)).data = x_158; + (*(node)).leftIndex = -1; + (*(node)).rightIndex = -1; + return; +} + +void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_4) { + int baseIndex = 0; + BST param = {}; + int param_1 = 0; + BST param_2 = {}; + int param_3 = 0; + baseIndex = 0; + while (true) { + int const x_167 = baseIndex; + int const x_168 = *(treeIndex); + if ((x_167 <= x_168)) { + } else { + break; + } + int const x_171 = *(data_1); + int const x_172 = baseIndex; + int const x_174 = (*(tint_symbol_4)).arr[x_172].data; + if ((x_171 <= x_174)) { + int const x_179 = baseIndex; + int const x_181 = (*(tint_symbol_4)).arr[x_179].leftIndex; + if ((x_181 == -1)) { + int const x_186 = baseIndex; + int const x_187 = *(treeIndex); + (*(tint_symbol_4)).arr[x_186].leftIndex = x_187; + int const x_189 = *(treeIndex); + BST const x_191 = (*(tint_symbol_4)).arr[x_189]; + param = x_191; + int const x_192 = *(data_1); + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + BST const x_194 = param; + (*(tint_symbol_4)).arr[x_189] = x_194; + return; + } else { + int const x_196 = baseIndex; + int const x_198 = (*(tint_symbol_4)).arr[x_196].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + int const x_199 = baseIndex; + int const x_201 = (*(tint_symbol_4)).arr[x_199].rightIndex; + if ((x_201 == -1)) { + int const x_206 = baseIndex; + int const x_207 = *(treeIndex); + (*(tint_symbol_4)).arr[x_206].rightIndex = x_207; + int const x_209 = *(treeIndex); + BST const x_211 = (*(tint_symbol_4)).arr[x_209]; + param_2 = x_211; + int const x_212 = *(data_1); + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + BST const x_214 = param_2; + (*(tint_symbol_4)).arr[x_209] = x_214; + return; + } else { + int const x_216 = baseIndex; + int const x_218 = (*(tint_symbol_4)).arr[x_216].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_5) { + int index = 0; + BST currentNode = {}; + int x_220 = 0; + index = 0; + while (true) { + int const x_225 = index; + if ((x_225 != -1)) { + } else { + break; + } + int const x_228 = index; + BST const x_230 = (*(tint_symbol_5)).arr[x_228]; + currentNode = x_230; + int const x_232 = currentNode.data; + int const x_233 = *(target); + if ((x_232 == x_233)) { + int const x_237 = *(target); + return x_237; + } + int const x_238 = *(target); + int const x_240 = currentNode.data; + if ((x_238 > x_240)) { + int const x_246 = currentNode.rightIndex; + x_220 = x_246; + } else { + int const x_248 = currentNode.leftIndex; + x_220 = x_248; + } + int const x_249 = x_220; + index = x_249; + } + return -1; +} + +void main_1(thread tint_array_wrapper* const tint_symbol_6, thread float4* const tint_symbol_7) { + int treeIndex_1 = 0; + BST param_4 = {}; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int count = 0; + int i = 0; + int result = 0; + int param_24 = 0; + treeIndex_1 = 0; + BST const x_84 = (*(tint_symbol_6)).arr[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + BST const x_86 = param_4; + (*(tint_symbol_6)).arr[0] = x_86; + int const x_88 = treeIndex_1; + treeIndex_1 = (x_88 + 1); + int const x_90 = treeIndex_1; + param_6 = x_90; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7), tint_symbol_6); + int const x_92 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + int const x_94 = treeIndex_1; + param_8 = x_94; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9), tint_symbol_6); + int const x_96 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + int const x_98 = treeIndex_1; + param_10 = x_98; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11), tint_symbol_6); + int const x_100 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + int const x_102 = treeIndex_1; + param_12 = x_102; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13), tint_symbol_6); + int const x_104 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + int const x_106 = treeIndex_1; + param_14 = x_106; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15), tint_symbol_6); + int const x_108 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + int const x_110 = treeIndex_1; + param_16 = x_110; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17), tint_symbol_6); + int const x_112 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + int const x_114 = treeIndex_1; + param_18 = x_114; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19), tint_symbol_6); + int const x_116 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + int const x_118 = treeIndex_1; + param_20 = x_118; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21), tint_symbol_6); + int const x_120 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + int const x_122 = treeIndex_1; + param_22 = x_122; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23), tint_symbol_6); + count = 0; + i = 0; + while (true) { + int const x_128 = i; + if ((x_128 < 20)) { + } else { + break; + } + int const x_131 = i; + param_24 = x_131; + int const x_132 = search_i1_(&(param_24), tint_symbol_6); + result = x_132; + int const x_133 = i; + switch(x_133) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + int const x_143 = result; + int const x_144 = i; + if ((x_143 == x_144)) { + int const x_148 = count; + count = (x_148 + 1); + } + break; + } + default: { + int const x_137 = result; + if ((x_137 == -1)) { + int const x_141 = count; + count = (x_141 + 1); + } + break; + } + } + { + int const x_150 = i; + i = (x_150 + 1); + } + } + int const x_152 = count; + if ((x_152 == 20)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread tint_array_wrapper tint_symbol_8 = {}; + thread float4 tint_symbol_9 = 0.0f; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..68b226ddee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.spvasm @@ -0,0 +1,476 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 316 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree "tree" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode_struct_BST_i1_i1_i11_i1_" + OpName %node "node" + OpName %data "data" + OpName %insert_i1_i1_ "insert_i1_i1_" + OpName %treeIndex "treeIndex" + OpName %data_1 "data_1" + OpName %baseIndex "baseIndex" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %search_i1_ "search_i1_" + OpName %target "target" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %x_220 "x_220" + OpName %main_1 "main_1" + OpName %treeIndex_1 "treeIndex_1" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %param_10 "param_10" + OpName %param_11 "param_11" + OpName %param_12 "param_12" + OpName %param_13 "param_13" + OpName %param_14 "param_14" + OpName %param_15 "param_15" + OpName %param_16 "param_16" + OpName %param_17 "param_17" + OpName %param_18 "param_18" + OpName %param_19 "param_19" + OpName %param_20 "param_20" + OpName %param_21 "param_21" + OpName %param_22 "param_22" + OpName %param_23 "param_23" + OpName %count "count" + OpName %i "i" + OpName %result "result" + OpName %param_24 "param_24" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %8 = OpConstantNull %_arr_BST_uint_10 + %tree = OpVariable %_ptr_Private__arr_BST_uint_10 Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %16 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int_n1 = OpConstant %int -1 + %uint_2 = OpConstant %uint 2 + %36 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %42 = OpConstantNull %int + %44 = OpConstantNull %BST + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %122 = OpTypeFunction %int %_ptr_Function_int + %163 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %302 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %303 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %304 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %16 + %node = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %23 = OpLabel + %25 = OpLoad %int %data + %28 = OpAccessChain %_ptr_Function_int %node %uint_0 + OpStore %28 %25 + %31 = OpAccessChain %_ptr_Function_int %node %uint_1 + OpStore %31 %int_n1 + %35 = OpAccessChain %_ptr_Function_int %node %uint_2 + OpStore %35 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %36 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_1 = OpFunctionParameter %_ptr_Function_int + %40 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function %42 + %param = OpVariable %_ptr_Function_BST Function %44 + %param_1 = OpVariable %_ptr_Function_int Function %42 + %param_2 = OpVariable %_ptr_Function_BST Function %44 + %param_3 = OpVariable %_ptr_Function_int Function %42 + OpStore %baseIndex %int_0 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %50 %51 None + OpBranch %52 + %52 = OpLabel + %53 = OpLoad %int %baseIndex + %55 = OpLoad %int %treeIndex + %56 = OpSLessThanEqual %bool %53 %55 + OpSelectionMerge %58 None + OpBranchConditional %56 %59 %60 + %59 = OpLabel + OpBranch %58 + %60 = OpLabel + OpBranch %50 + %58 = OpLabel + %62 = OpLoad %int %data_1 + %63 = OpLoad %int %baseIndex + %65 = OpAccessChain %_ptr_Private_int %tree %63 %uint_0 + %66 = OpLoad %int %65 + %67 = OpSLessThanEqual %bool %62 %66 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %71 = OpLoad %int %baseIndex + %72 = OpAccessChain %_ptr_Private_int %tree %71 %uint_1 + %73 = OpLoad %int %72 + %74 = OpIEqual %bool %73 %int_n1 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + %78 = OpLoad %int %baseIndex + %80 = OpLoad %int %treeIndex + %81 = OpAccessChain %_ptr_Private_int %tree %78 %uint_1 + OpStore %81 %80 + %83 = OpLoad %int %treeIndex + %85 = OpAccessChain %_ptr_Private_BST %tree %83 + %86 = OpLoad %BST %85 + OpStore %param %86 + %88 = OpLoad %int %data_1 + OpStore %param_1 %88 + %89 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_1 + %92 = OpLoad %BST %param + %93 = OpAccessChain %_ptr_Private_BST %tree %83 + OpStore %93 %92 + OpReturn + %77 = OpLabel + %94 = OpLoad %int %baseIndex + %95 = OpAccessChain %_ptr_Private_int %tree %94 %uint_1 + %96 = OpLoad %int %95 + OpStore %baseIndex %96 + OpBranch %51 + %75 = OpLabel + OpReturn + %70 = OpLabel + %97 = OpLoad %int %baseIndex + %98 = OpAccessChain %_ptr_Private_int %tree %97 %uint_2 + %99 = OpLoad %int %98 + %100 = OpIEqual %bool %99 %int_n1 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %103 + %102 = OpLabel + %104 = OpLoad %int %baseIndex + %106 = OpLoad %int %treeIndex + %107 = OpAccessChain %_ptr_Private_int %tree %104 %uint_2 + OpStore %107 %106 + %109 = OpLoad %int %treeIndex + %110 = OpAccessChain %_ptr_Private_BST %tree %109 + %111 = OpLoad %BST %110 + OpStore %param_2 %111 + %113 = OpLoad %int %data_1 + OpStore %param_3 %113 + %114 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_2 %param_3 + %117 = OpLoad %BST %param_2 + %118 = OpAccessChain %_ptr_Private_BST %tree %109 + OpStore %118 %117 + OpReturn + %103 = OpLabel + %119 = OpLoad %int %baseIndex + %120 = OpAccessChain %_ptr_Private_int %tree %119 %uint_2 + %121 = OpLoad %int %120 + OpStore %baseIndex %121 + OpBranch %51 + %101 = OpLabel + OpReturn + %68 = OpLabel + OpReturn + %51 = OpLabel + OpBranch %49 + %50 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %122 + %target = OpFunctionParameter %_ptr_Function_int + %125 = OpLabel + %index = OpVariable %_ptr_Function_int Function %42 +%currentNode = OpVariable %_ptr_Function_BST Function %44 + %x_220 = OpVariable %_ptr_Function_int Function %42 + OpStore %index %int_0 + OpBranch %129 + %129 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %133 = OpLoad %int %index + %134 = OpINotEqual %bool %133 %int_n1 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 + %136 = OpLabel + OpBranch %135 + %137 = OpLabel + OpBranch %130 + %135 = OpLabel + %138 = OpLoad %int %index + %139 = OpAccessChain %_ptr_Private_BST %tree %138 + %140 = OpLoad %BST %139 + OpStore %currentNode %140 + %141 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %142 = OpLoad %int %141 + %144 = OpLoad %int %target + %145 = OpIEqual %bool %142 %144 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %149 = OpLoad %int %target + OpReturnValue %149 + %146 = OpLabel + %151 = OpLoad %int %target + %152 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %153 = OpLoad %int %152 + %154 = OpSGreaterThan %bool %151 %153 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %157 + %156 = OpLabel + %158 = OpAccessChain %_ptr_Function_int %currentNode %uint_2 + %159 = OpLoad %int %158 + OpStore %x_220 %159 + OpBranch %155 + %157 = OpLabel + %160 = OpAccessChain %_ptr_Function_int %currentNode %uint_1 + %161 = OpLoad %int %160 + OpStore %x_220 %161 + OpBranch %155 + %155 = OpLabel + %162 = OpLoad %int %x_220 + OpStore %index %162 + OpBranch %131 + %131 = OpLabel + OpBranch %129 + %130 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd + %main_1 = OpFunction %void None %163 + %165 = OpLabel +%treeIndex_1 = OpVariable %_ptr_Function_int Function %42 + %param_4 = OpVariable %_ptr_Function_BST Function %44 + %param_5 = OpVariable %_ptr_Function_int Function %42 + %param_6 = OpVariable %_ptr_Function_int Function %42 + %param_7 = OpVariable %_ptr_Function_int Function %42 + %param_8 = OpVariable %_ptr_Function_int Function %42 + %param_9 = OpVariable %_ptr_Function_int Function %42 + %param_10 = OpVariable %_ptr_Function_int Function %42 + %param_11 = OpVariable %_ptr_Function_int Function %42 + %param_12 = OpVariable %_ptr_Function_int Function %42 + %param_13 = OpVariable %_ptr_Function_int Function %42 + %param_14 = OpVariable %_ptr_Function_int Function %42 + %param_15 = OpVariable %_ptr_Function_int Function %42 + %param_16 = OpVariable %_ptr_Function_int Function %42 + %param_17 = OpVariable %_ptr_Function_int Function %42 + %param_18 = OpVariable %_ptr_Function_int Function %42 + %param_19 = OpVariable %_ptr_Function_int Function %42 + %param_20 = OpVariable %_ptr_Function_int Function %42 + %param_21 = OpVariable %_ptr_Function_int Function %42 + %param_22 = OpVariable %_ptr_Function_int Function %42 + %param_23 = OpVariable %_ptr_Function_int Function %42 + %count = OpVariable %_ptr_Function_int Function %42 + %i = OpVariable %_ptr_Function_int Function %42 + %result = OpVariable %_ptr_Function_int Function %42 + %param_24 = OpVariable %_ptr_Function_int Function %42 + OpStore %treeIndex_1 %int_0 + %191 = OpAccessChain %_ptr_Private_BST %tree %int_0 + %192 = OpLoad %BST %191 + OpStore %param_4 %192 + OpStore %param_5 %int_9 + %194 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_4 %param_5 + %197 = OpLoad %BST %param_4 + %198 = OpAccessChain %_ptr_Private_BST %tree %int_0 + OpStore %198 %197 + %199 = OpLoad %int %treeIndex_1 + %201 = OpIAdd %int %199 %int_1 + OpStore %treeIndex_1 %201 + %202 = OpLoad %int %treeIndex_1 + OpStore %param_6 %202 + OpStore %param_7 %int_5 + %204 = OpFunctionCall %void %insert_i1_i1_ %param_6 %param_7 + %207 = OpLoad %int %treeIndex_1 + %208 = OpIAdd %int %207 %int_1 + OpStore %treeIndex_1 %208 + %209 = OpLoad %int %treeIndex_1 + OpStore %param_8 %209 + OpStore %param_9 %int_12 + %211 = OpFunctionCall %void %insert_i1_i1_ %param_8 %param_9 + %214 = OpLoad %int %treeIndex_1 + %215 = OpIAdd %int %214 %int_1 + OpStore %treeIndex_1 %215 + %216 = OpLoad %int %treeIndex_1 + OpStore %param_10 %216 + OpStore %param_11 %int_15 + %218 = OpFunctionCall %void %insert_i1_i1_ %param_10 %param_11 + %221 = OpLoad %int %treeIndex_1 + %222 = OpIAdd %int %221 %int_1 + OpStore %treeIndex_1 %222 + %223 = OpLoad %int %treeIndex_1 + OpStore %param_12 %223 + OpStore %param_13 %int_7 + %225 = OpFunctionCall %void %insert_i1_i1_ %param_12 %param_13 + %228 = OpLoad %int %treeIndex_1 + %229 = OpIAdd %int %228 %int_1 + OpStore %treeIndex_1 %229 + %230 = OpLoad %int %treeIndex_1 + OpStore %param_14 %230 + OpStore %param_15 %int_8 + %232 = OpFunctionCall %void %insert_i1_i1_ %param_14 %param_15 + %235 = OpLoad %int %treeIndex_1 + %236 = OpIAdd %int %235 %int_1 + OpStore %treeIndex_1 %236 + %237 = OpLoad %int %treeIndex_1 + OpStore %param_16 %237 + OpStore %param_17 %int_2 + %239 = OpFunctionCall %void %insert_i1_i1_ %param_16 %param_17 + %242 = OpLoad %int %treeIndex_1 + %243 = OpIAdd %int %242 %int_1 + OpStore %treeIndex_1 %243 + %244 = OpLoad %int %treeIndex_1 + OpStore %param_18 %244 + OpStore %param_19 %int_6 + %246 = OpFunctionCall %void %insert_i1_i1_ %param_18 %param_19 + %249 = OpLoad %int %treeIndex_1 + %250 = OpIAdd %int %249 %int_1 + OpStore %treeIndex_1 %250 + %251 = OpLoad %int %treeIndex_1 + OpStore %param_20 %251 + OpStore %param_21 %int_17 + %253 = OpFunctionCall %void %insert_i1_i1_ %param_20 %param_21 + %256 = OpLoad %int %treeIndex_1 + %257 = OpIAdd %int %256 %int_1 + OpStore %treeIndex_1 %257 + %258 = OpLoad %int %treeIndex_1 + OpStore %param_22 %258 + OpStore %param_23 %int_13 + %260 = OpFunctionCall %void %insert_i1_i1_ %param_22 %param_23 + OpStore %count %int_0 + OpStore %i %int_0 + OpBranch %263 + %263 = OpLabel + OpLoopMerge %264 %265 None + OpBranch %266 + %266 = OpLabel + %267 = OpLoad %int %i + %269 = OpSLessThan %bool %267 %int_20 + OpSelectionMerge %270 None + OpBranchConditional %269 %271 %272 + %271 = OpLabel + OpBranch %270 + %272 = OpLabel + OpBranch %264 + %270 = OpLabel + %273 = OpLoad %int %i + OpStore %param_24 %273 + %274 = OpFunctionCall %int %search_i1_ %param_24 + OpStore %result %274 + %276 = OpLoad %int %i + OpSelectionMerge %277 None + OpSwitch %276 %278 2 %279 5 %279 6 %279 7 %279 8 %279 9 %279 12 %279 13 %279 15 %279 17 %279 + %279 = OpLabel + %280 = OpLoad %int %result + %281 = OpLoad %int %i + %282 = OpIEqual %bool %280 %281 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %283 + %284 = OpLabel + %285 = OpLoad %int %count + %286 = OpIAdd %int %285 %int_1 + OpStore %count %286 + OpBranch %283 + %283 = OpLabel + OpBranch %277 + %278 = OpLabel + %287 = OpLoad %int %result + %288 = OpIEqual %bool %287 %int_n1 + OpSelectionMerge %289 None + OpBranchConditional %288 %290 %289 + %290 = OpLabel + %291 = OpLoad %int %count + %292 = OpIAdd %int %291 %int_1 + OpStore %count %292 + OpBranch %289 + %289 = OpLabel + OpBranch %277 + %277 = OpLabel + OpBranch %265 + %265 = OpLabel + %293 = OpLoad %int %i + %294 = OpIAdd %int %293 %int_1 + OpStore %i %294 + OpBranch %263 + %264 = OpLabel + %295 = OpLoad %int %count + %296 = OpIEqual %bool %295 %int_20 + OpSelectionMerge %297 None + OpBranchConditional %296 %298 %299 + %298 = OpLabel + OpStore %x_GLF_color %302 + OpBranch %297 + %299 = OpLabel + OpStore %x_GLF_color %303 + OpBranch %297 + %297 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %304 +%tint_symbol = OpFunctionParameter %main_out + %308 = OpLabel + %309 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %309 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %163 + %311 = OpLabel + %312 = OpFunctionCall %void %main_1 + %314 = OpLoad %v4float %x_GLF_color + %315 = OpCompositeConstruct %main_out %314 + %313 = OpFunctionCall %void %tint_symbol_2 %315 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..19d6c9d74f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.wgsl @@ -0,0 +1,264 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var tree : array; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(node : ptr, data : ptr) { + let x_158 : i32 = *(data); + (*(node)).data = x_158; + (*(node)).leftIndex = -1; + (*(node)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_167 : i32 = baseIndex; + let x_168 : i32 = *(treeIndex); + if ((x_167 <= x_168)) { + } else { + break; + } + let x_171 : i32 = *(data_1); + let x_172 : i32 = baseIndex; + let x_174 : i32 = tree[x_172].data; + if ((x_171 <= x_174)) { + let x_179 : i32 = baseIndex; + let x_181 : i32 = tree[x_179].leftIndex; + if ((x_181 == -1)) { + let x_186 : i32 = baseIndex; + let x_187 : i32 = *(treeIndex); + tree[x_186].leftIndex = x_187; + let x_189 : i32 = *(treeIndex); + let x_191 : BST = tree[x_189]; + param = x_191; + let x_192 : i32 = *(data_1); + param_1 = x_192; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_194 : BST = param; + tree[x_189] = x_194; + return; + } else { + let x_196 : i32 = baseIndex; + let x_198 : i32 = tree[x_196].leftIndex; + baseIndex = x_198; + continue; + } + return; + } else { + let x_199 : i32 = baseIndex; + let x_201 : i32 = tree[x_199].rightIndex; + if ((x_201 == -1)) { + let x_206 : i32 = baseIndex; + let x_207 : i32 = *(treeIndex); + tree[x_206].rightIndex = x_207; + let x_209 : i32 = *(treeIndex); + let x_211 : BST = tree[x_209]; + param_2 = x_211; + let x_212 : i32 = *(data_1); + param_3 = x_212; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_214 : BST = param_2; + tree[x_209] = x_214; + return; + } else { + let x_216 : i32 = baseIndex; + let x_218 : i32 = tree[x_216].rightIndex; + baseIndex = x_218; + continue; + } + return; + } + return; + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_220 : i32; + index = 0; + loop { + let x_225 : i32 = index; + if ((x_225 != -1)) { + } else { + break; + } + let x_228 : i32 = index; + let x_230 : BST = tree[x_228]; + currentNode = x_230; + let x_232 : i32 = currentNode.data; + let x_233 : i32 = *(target); + if ((x_232 == x_233)) { + let x_237 : i32 = *(target); + return x_237; + } + let x_238 : i32 = *(target); + let x_240 : i32 = currentNode.data; + if ((x_238 > x_240)) { + let x_246 : i32 = currentNode.rightIndex; + x_220 = x_246; + } else { + let x_248 : i32 = currentNode.leftIndex; + x_220 = x_248; + } + let x_249 : i32 = x_220; + index = x_249; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var count : i32; + var i : i32; + var result : i32; + var param_24 : i32; + treeIndex_1 = 0; + let x_84 : BST = tree[0]; + param_4 = x_84; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_86 : BST = param_4; + tree[0] = x_86; + let x_88 : i32 = treeIndex_1; + treeIndex_1 = (x_88 + 1); + let x_90 : i32 = treeIndex_1; + param_6 = x_90; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_92 : i32 = treeIndex_1; + treeIndex_1 = (x_92 + 1); + let x_94 : i32 = treeIndex_1; + param_8 = x_94; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_96 : i32 = treeIndex_1; + treeIndex_1 = (x_96 + 1); + let x_98 : i32 = treeIndex_1; + param_10 = x_98; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_100 : i32 = treeIndex_1; + treeIndex_1 = (x_100 + 1); + let x_102 : i32 = treeIndex_1; + param_12 = x_102; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_104 : i32 = treeIndex_1; + treeIndex_1 = (x_104 + 1); + let x_106 : i32 = treeIndex_1; + param_14 = x_106; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_108 : i32 = treeIndex_1; + treeIndex_1 = (x_108 + 1); + let x_110 : i32 = treeIndex_1; + param_16 = x_110; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_112 : i32 = treeIndex_1; + treeIndex_1 = (x_112 + 1); + let x_114 : i32 = treeIndex_1; + param_18 = x_114; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_116 : i32 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + let x_118 : i32 = treeIndex_1; + param_20 = x_118; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_120 : i32 = treeIndex_1; + treeIndex_1 = (x_120 + 1); + let x_122 : i32 = treeIndex_1; + param_22 = x_122; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + count = 0; + i = 0; + loop { + let x_128 : i32 = i; + if ((x_128 < 20)) { + } else { + break; + } + let x_131 : i32 = i; + param_24 = x_131; + let x_132 : i32 = search_i1_(&(param_24)); + result = x_132; + let x_133 : i32 = i; + switch(x_133) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_143 : i32 = result; + let x_144 : i32 = i; + if ((x_143 == x_144)) { + let x_148 : i32 = count; + count = (x_148 + 1); + } + } + default: { + let x_137 : i32 = result; + if ((x_137 == -1)) { + let x_141 : i32 = count; + count = (x_141 + 1); + } + } + } + + continuing { + let x_150 : i32 = i; + i = (x_150 + 1); + } + } + let x_152 : i32 = count; + if ((x_152 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm new file mode 100644 index 0000000000..ef62d6c40c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm @@ -0,0 +1,508 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %identity_i1_ "identity(i1;" + OpName %a "a" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode(struct-BST-i1-i1-i11;i1;" + OpName %node "node" + OpName %data "data" + OpName %insert_i1_i1_ "insert(i1;i1;" + OpName %treeIndex "treeIndex" + OpName %data_0 "data" + OpName %search_i1_ "search(i1;" + OpName %target "target" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %baseIndex "baseIndex" + OpName %tree "tree" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %treeIndex_0 "treeIndex" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %param_5 "param" + OpName %param_6 "param" + OpName %param_7 "param" + OpName %param_8 "param" + OpName %param_9 "param" + OpName %param_10 "param" + OpName %param_11 "param" + OpName %param_12 "param" + OpName %param_13 "param" + OpName %param_14 "param" + OpName %param_15 "param" + OpName %param_16 "param" + OpName %param_17 "param" + OpName %param_18 "param" + OpName %param_19 "param" + OpName %param_20 "param" + OpName %param_21 "param" + OpName %param_22 "param" + OpName %pp "pp" + OpName %looplimiter0 "looplimiter0" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %param_23 "param" + OpName %count "count" + OpName %i_0 "i" + OpName %result "result" + OpName %param_24 "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %57 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %60 = OpTypeFunction %int %_ptr_Function_int + %BST = OpTypeStruct %int %int %int +%_ptr_Function_BST = OpTypePointer Function %BST + %62 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %63 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %bool = OpTypeBool +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %tree = OpVariable %_ptr_Private__arr_BST_uint_10 Private +%_ptr_Private_BST = OpTypePointer Private %BST + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_10000 = OpConstant %int 10000 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_20 = OpConstant %int 20 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %97 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %98 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main = OpFunction %void None %57 + %99 = OpLabel +%treeIndex_0 = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_BST Function + %param_4 = OpVariable %_ptr_Function_int Function + %param_5 = OpVariable %_ptr_Function_int Function + %param_6 = OpVariable %_ptr_Function_int Function + %param_7 = OpVariable %_ptr_Function_int Function + %param_8 = OpVariable %_ptr_Function_int Function + %param_9 = OpVariable %_ptr_Function_int Function + %param_10 = OpVariable %_ptr_Function_int Function + %param_11 = OpVariable %_ptr_Function_int Function + %param_12 = OpVariable %_ptr_Function_int Function + %param_13 = OpVariable %_ptr_Function_int Function + %param_14 = OpVariable %_ptr_Function_int Function + %param_15 = OpVariable %_ptr_Function_int Function + %param_16 = OpVariable %_ptr_Function_int Function + %param_17 = OpVariable %_ptr_Function_int Function + %param_18 = OpVariable %_ptr_Function_int Function + %param_19 = OpVariable %_ptr_Function_int Function + %param_20 = OpVariable %_ptr_Function_int Function + %param_21 = OpVariable %_ptr_Function_int Function + %param_22 = OpVariable %_ptr_Function_int Function + %pp = OpVariable %_ptr_Function_int Function +%looplimiter0 = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %param_23 = OpVariable %_ptr_Function_int Function + %count = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %result = OpVariable %_ptr_Function_int Function + %param_24 = OpVariable %_ptr_Function_int Function + OpStore %treeIndex_0 %int_0 + %100 = OpAccessChain %_ptr_Private_BST %tree %int_0 + %101 = OpLoad %BST %100 + OpStore %param_3 %101 + OpStore %param_4 %int_9 + %102 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_3 %param_4 + %103 = OpLoad %BST %param_3 + %104 = OpAccessChain %_ptr_Private_BST %tree %int_0 + OpStore %104 %103 + %105 = OpLoad %int %treeIndex_0 + %106 = OpIAdd %int %105 %int_1 + OpStore %treeIndex_0 %106 + %107 = OpLoad %int %treeIndex_0 + OpStore %param_5 %107 + OpStore %param_6 %int_5 + %108 = OpFunctionCall %void %insert_i1_i1_ %param_5 %param_6 + %109 = OpLoad %int %treeIndex_0 + %110 = OpIAdd %int %109 %int_1 + OpStore %treeIndex_0 %110 + %111 = OpLoad %int %treeIndex_0 + OpStore %param_7 %111 + OpStore %param_8 %int_12 + %112 = OpFunctionCall %void %insert_i1_i1_ %param_7 %param_8 + %113 = OpLoad %int %treeIndex_0 + %114 = OpIAdd %int %113 %int_1 + OpStore %treeIndex_0 %114 + %115 = OpLoad %int %treeIndex_0 + OpStore %param_9 %115 + OpStore %param_10 %int_15 + %116 = OpFunctionCall %void %insert_i1_i1_ %param_9 %param_10 + %117 = OpLoad %int %treeIndex_0 + %118 = OpIAdd %int %117 %int_1 + OpStore %treeIndex_0 %118 + %119 = OpLoad %int %treeIndex_0 + OpStore %param_11 %119 + OpStore %param_12 %int_7 + %120 = OpFunctionCall %void %insert_i1_i1_ %param_11 %param_12 + %121 = OpLoad %int %treeIndex_0 + %122 = OpIAdd %int %121 %int_1 + OpStore %treeIndex_0 %122 + %123 = OpLoad %int %treeIndex_0 + OpStore %param_13 %123 + OpStore %param_14 %int_8 + %124 = OpFunctionCall %void %insert_i1_i1_ %param_13 %param_14 + %125 = OpLoad %int %treeIndex_0 + %126 = OpIAdd %int %125 %int_1 + OpStore %treeIndex_0 %126 + %127 = OpLoad %int %treeIndex_0 + OpStore %param_15 %127 + OpStore %param_16 %int_2 + %128 = OpFunctionCall %void %insert_i1_i1_ %param_15 %param_16 + %129 = OpLoad %int %treeIndex_0 + %130 = OpIAdd %int %129 %int_1 + OpStore %treeIndex_0 %130 + %131 = OpLoad %int %treeIndex_0 + OpStore %param_17 %131 + OpStore %param_18 %int_6 + %132 = OpFunctionCall %void %insert_i1_i1_ %param_17 %param_18 + %133 = OpLoad %int %treeIndex_0 + %134 = OpIAdd %int %133 %int_1 + OpStore %treeIndex_0 %134 + %135 = OpLoad %int %treeIndex_0 + OpStore %param_19 %135 + OpStore %param_20 %int_17 + %136 = OpFunctionCall %void %insert_i1_i1_ %param_19 %param_20 + %137 = OpLoad %int %treeIndex_0 + %138 = OpIAdd %int %137 %int_1 + OpStore %treeIndex_0 %138 + %139 = OpLoad %int %treeIndex_0 + OpStore %param_21 %139 + OpStore %param_22 %int_13 + %140 = OpFunctionCall %void %insert_i1_i1_ %param_21 %param_22 + OpStore %pp %int_0 + OpStore %looplimiter0 %int_0 + OpStore %i %int_0 + OpBranch %141 + %141 = OpLabel + OpLoopMerge %142 %143 None + OpBranch %144 + %144 = OpLabel + %145 = OpLoad %int %i + %146 = OpSLessThan %bool %145 %int_10000 + OpBranchConditional %146 %147 %142 + %147 = OpLabel + %148 = OpLoad %int %looplimiter0 + %149 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %150 = OpLoad %float %149 + %151 = OpConvertFToS %int %150 + %152 = OpSGreaterThanEqual %bool %148 %151 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + %155 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %156 = OpLoad %float %155 + %157 = OpConvertFToS %int %156 + %158 = OpIAdd %int %int_1 %157 + OpStore %param_23 %158 + %159 = OpFunctionCall %int %identity_i1_ %param_23 + OpStore %pp %159 + OpBranch %142 + %153 = OpLabel + %160 = OpLoad %int %looplimiter0 + %161 = OpIAdd %int %160 %int_1 + OpStore %looplimiter0 %161 + OpBranch %143 + %143 = OpLabel + %162 = OpLoad %int %i + %163 = OpIAdd %int %162 %int_1 + OpStore %i %163 + OpBranch %141 + %142 = OpLabel + %164 = OpLoad %int %pp + %165 = OpINotEqual %bool %164 %int_2 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %166 + %167 = OpLabel + OpReturn + %166 = OpLabel + OpStore %count %int_0 + OpStore %i_0 %int_0 + OpBranch %168 + %168 = OpLabel + OpLoopMerge %169 %170 None + OpBranch %171 + %171 = OpLabel + %172 = OpLoad %int %i_0 + %173 = OpSLessThan %bool %172 %int_20 + OpBranchConditional %173 %174 %169 + %174 = OpLabel + %175 = OpLoad %int %i_0 + OpStore %param_24 %175 + %176 = OpFunctionCall %int %search_i1_ %param_24 + OpStore %result %176 + %177 = OpLoad %int %i_0 + OpSelectionMerge %178 None + OpSwitch %177 %179 9 %180 5 %180 12 %180 15 %180 7 %180 8 %180 2 %180 6 %180 17 %180 13 %180 + %179 = OpLabel + %181 = OpLoad %int %result + %182 = OpIEqual %bool %181 %int_n1 + OpSelectionMerge %183 None + OpBranchConditional %182 %184 %183 + %184 = OpLabel + %185 = OpLoad %int %count + %186 = OpIAdd %int %185 %int_1 + OpStore %count %186 + OpBranch %183 + %183 = OpLabel + OpBranch %178 + %180 = OpLabel + %187 = OpLoad %int %result + %188 = OpLoad %int %i_0 + %189 = OpIEqual %bool %187 %188 + OpSelectionMerge %190 None + OpBranchConditional %189 %191 %190 + %191 = OpLabel + %192 = OpLoad %int %count + %193 = OpIAdd %int %192 %int_1 + OpStore %count %193 + OpBranch %190 + %190 = OpLabel + OpBranch %178 + %178 = OpLabel + OpBranch %170 + %170 = OpLabel + %194 = OpLoad %int %i_0 + %195 = OpIAdd %int %194 %int_1 + OpStore %i_0 %195 + OpBranch %168 + %169 = OpLabel + %196 = OpLoad %int %count + %197 = OpIEqual %bool %196 %int_20 + OpSelectionMerge %198 None + OpBranchConditional %197 %199 %200 + %199 = OpLabel + OpStore %_GLF_color %97 + OpBranch %198 + %200 = OpLabel + OpStore %_GLF_color %98 + OpBranch %198 + %198 = OpLabel + OpReturn + OpFunctionEnd +%identity_i1_ = OpFunction %int None %60 + %a = OpFunctionParameter %_ptr_Function_int + %201 = OpLabel + %202 = OpLoad %int %a + %203 = OpLoad %int %a + %204 = OpAccessChain %_ptr_Private_int %obj %int_0 %202 + OpStore %204 %203 + %205 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_2 + %206 = OpLoad %int %205 + OpReturnValue %206 + OpFunctionEnd +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %62 + %node = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %207 = OpLabel + %208 = OpLoad %int %data + %209 = OpAccessChain %_ptr_Function_int %node %int_0 + OpStore %209 %208 + %210 = OpAccessChain %_ptr_Function_int %node %int_1 + OpStore %210 %int_n1 + %211 = OpAccessChain %_ptr_Function_int %node %int_2 + OpStore %211 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %63 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_0 = OpFunctionParameter %_ptr_Function_int + %212 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_BST Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_BST Function + %param_2 = OpVariable %_ptr_Function_int Function + OpStore %baseIndex %int_0 + OpBranch %213 + %213 = OpLabel + OpLoopMerge %214 %215 None + OpBranch %216 + %216 = OpLabel + %217 = OpLoad %int %baseIndex + %218 = OpLoad %int %treeIndex + %219 = OpSLessThanEqual %bool %217 %218 + OpBranchConditional %219 %220 %214 + %220 = OpLabel + %221 = OpLoad %int %data_0 + %222 = OpLoad %int %baseIndex + %223 = OpAccessChain %_ptr_Private_int %tree %222 %int_0 + %224 = OpLoad %int %223 + %225 = OpSLessThanEqual %bool %221 %224 + OpSelectionMerge %226 None + OpBranchConditional %225 %227 %228 + %227 = OpLabel + %229 = OpLoad %int %baseIndex + %230 = OpAccessChain %_ptr_Private_int %tree %229 %int_1 + %231 = OpLoad %int %230 + %232 = OpIEqual %bool %231 %int_n1 + OpSelectionMerge %233 None + OpBranchConditional %232 %234 %235 + %234 = OpLabel + %236 = OpLoad %int %baseIndex + %237 = OpLoad %int %treeIndex + %238 = OpAccessChain %_ptr_Private_int %tree %236 %int_1 + OpStore %238 %237 + %239 = OpLoad %int %treeIndex + %240 = OpAccessChain %_ptr_Private_BST %tree %239 + %241 = OpLoad %BST %240 + OpStore %param %241 + %242 = OpLoad %int %data_0 + OpStore %param_0 %242 + %243 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_0 + %244 = OpLoad %BST %param + %245 = OpAccessChain %_ptr_Private_BST %tree %239 + OpStore %245 %244 + OpReturn + %235 = OpLabel + %246 = OpLoad %int %baseIndex + %247 = OpAccessChain %_ptr_Private_int %tree %246 %int_1 + %248 = OpLoad %int %247 + OpStore %baseIndex %248 + OpBranch %215 + %233 = OpLabel + OpUnreachable + %228 = OpLabel + %249 = OpLoad %int %baseIndex + %250 = OpAccessChain %_ptr_Private_int %tree %249 %int_2 + %251 = OpLoad %int %250 + %252 = OpIEqual %bool %251 %int_n1 + OpSelectionMerge %253 None + OpBranchConditional %252 %254 %255 + %254 = OpLabel + %256 = OpLoad %int %baseIndex + %257 = OpLoad %int %treeIndex + %258 = OpAccessChain %_ptr_Private_int %tree %256 %int_2 + OpStore %258 %257 + %259 = OpLoad %int %treeIndex + %260 = OpAccessChain %_ptr_Private_BST %tree %259 + %261 = OpLoad %BST %260 + OpStore %param_1 %261 + %262 = OpLoad %int %data_0 + OpStore %param_2 %262 + %263 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_1 %param_2 + %264 = OpLoad %BST %param_1 + %265 = OpAccessChain %_ptr_Private_BST %tree %259 + OpStore %265 %264 + OpReturn + %255 = OpLabel + %266 = OpLoad %int %baseIndex + %267 = OpAccessChain %_ptr_Private_int %tree %266 %int_2 + %268 = OpLoad %int %267 + OpStore %baseIndex %268 + OpBranch %215 + %253 = OpLabel + OpUnreachable + %226 = OpLabel + OpUnreachable + %215 = OpLabel + OpBranch %213 + %214 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %60 + %target = OpFunctionParameter %_ptr_Function_int + %269 = OpLabel + %index = OpVariable %_ptr_Function_int Function +%currentNode = OpVariable %_ptr_Function_BST Function + %270 = OpVariable %_ptr_Function_int Function + OpStore %index %int_0 + OpBranch %271 + %271 = OpLabel + OpLoopMerge %272 %273 None + OpBranch %274 + %274 = OpLabel + %275 = OpLoad %int %index + %276 = OpINotEqual %bool %275 %int_n1 + OpBranchConditional %276 %277 %272 + %277 = OpLabel + %278 = OpLoad %int %index + %279 = OpAccessChain %_ptr_Private_BST %tree %278 + %280 = OpLoad %BST %279 + OpStore %currentNode %280 + %281 = OpAccessChain %_ptr_Function_int %currentNode %int_0 + %282 = OpLoad %int %281 + %283 = OpLoad %int %target + %284 = OpIEqual %bool %282 %283 + OpSelectionMerge %285 None + OpBranchConditional %284 %286 %285 + %286 = OpLabel + %287 = OpLoad %int %target + OpReturnValue %287 + %285 = OpLabel + %288 = OpLoad %int %target + %289 = OpAccessChain %_ptr_Function_int %currentNode %int_0 + %290 = OpLoad %int %289 + %291 = OpSGreaterThan %bool %288 %290 + OpSelectionMerge %292 None + OpBranchConditional %291 %293 %294 + %293 = OpLabel + %295 = OpAccessChain %_ptr_Function_int %currentNode %int_2 + %296 = OpLoad %int %295 + OpStore %270 %296 + OpBranch %292 + %294 = OpLabel + %297 = OpAccessChain %_ptr_Function_int %currentNode %int_1 + %298 = OpLoad %int %297 + OpStore %270 %298 + OpBranch %292 + %292 = OpLabel + %299 = OpLoad %int %270 + OpStore %index %299 + OpBranch %273 + %273 = OpLabel + OpBranch %271 + %272 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..ece942a82b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.hlsl @@ -0,0 +1,271 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static BST tree[10] = (BST[10])0; +cbuffer cbuffer_x_50 : register(b0, space0) { + uint4 x_50[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) { + const int x_208 = data; + node.data = x_208; + node.leftIndex = -1; + node.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + while (true) { + const int x_217 = baseIndex; + const int x_218 = treeIndex; + if ((x_217 <= x_218)) { + } else { + break; + } + const int x_221 = data_1; + const int x_224 = tree[baseIndex].data; + if ((x_221 <= x_224)) { + const int x_231 = tree[baseIndex].leftIndex; + if ((x_231 == -1)) { + const int x_236 = baseIndex; + const int x_237 = treeIndex; + tree[x_236].leftIndex = x_237; + const int x_239 = treeIndex; + const BST x_241 = tree[x_239]; + param = x_241; + const int x_242 = data_1; + param_1 = x_242; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree[x_239] = param; + return; + } else { + const int x_248 = tree[baseIndex].leftIndex; + baseIndex = x_248; + continue; + } + return; + } else { + const int x_251 = tree[baseIndex].rightIndex; + if ((x_251 == -1)) { + const int x_256 = baseIndex; + const int x_257 = treeIndex; + tree[x_256].rightIndex = x_257; + const int x_259 = treeIndex; + const BST x_261 = tree[x_259]; + param_2 = x_261; + const int x_262 = data_1; + param_3 = x_262; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree[x_259] = param_2; + return; + } else { + const int x_268 = tree[baseIndex].rightIndex; + baseIndex = x_268; + continue; + } + return; + } + return; + } + return; +} + +int identity_i1_(inout int a) { + const int x_202 = a; + const int x_203 = a; + obj.numbers[x_202] = x_203; + const int x_206 = obj.numbers[2]; + return x_206; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_270 = 0; + index = 0; + while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_280 = tree[index]; + currentNode = x_280; + const int x_282 = currentNode.data; + const int x_283 = target; + if ((x_282 == x_283)) { + const int x_287 = target; + return x_287; + } + const int x_288 = target; + const int x_290 = currentNode.data; + if ((x_288 > x_290)) { + const int x_296 = currentNode.rightIndex; + x_270 = x_296; + } else { + const int x_298 = currentNode.leftIndex; + x_270 = x_298; + } + index = x_270; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int pp = 0; + int looplimiter0 = 0; + int i = 0; + int param_24 = 0; + int count = 0; + int i_1 = 0; + int result = 0; + int param_25 = 0; + treeIndex_1 = 0; + const BST x_101 = tree[0]; + param_4 = x_101; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + pp = 0; + looplimiter0 = 0; + i = 0; + { + for(; (i < 10000); i = (i + 1)) { + const int x_148 = looplimiter0; + const float x_150 = asfloat(x_50[0].y); + if ((x_148 >= int(x_150))) { + const float x_156 = asfloat(x_50[0].y); + param_24 = (1 + int(x_156)); + const int x_159 = identity_i1_(param_24); + pp = x_159; + break; + } + looplimiter0 = (looplimiter0 + 1); + } + } + if ((pp != 2)) { + return; + } + count = 0; + i_1 = 0; + { + for(; (i_1 < 20); i_1 = (i_1 + 1)) { + param_25 = i_1; + const int x_176 = search_i1_(param_25); + result = x_176; + switch(i_1) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i_1)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.msl new file mode 100644 index 0000000000..c0e8e435e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.msl @@ -0,0 +1,332 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper_1 { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const node, thread int* const data) { + int const x_208 = *(data); + (*(node)).data = x_208; + (*(node)).leftIndex = -1; + (*(node)).rightIndex = -1; + return; +} + +void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper_1* const tint_symbol_4) { + int baseIndex = 0; + BST param = {}; + int param_1 = 0; + BST param_2 = {}; + int param_3 = 0; + baseIndex = 0; + while (true) { + int const x_217 = baseIndex; + int const x_218 = *(treeIndex); + if ((x_217 <= x_218)) { + } else { + break; + } + int const x_221 = *(data_1); + int const x_222 = baseIndex; + int const x_224 = (*(tint_symbol_4)).arr[x_222].data; + if ((x_221 <= x_224)) { + int const x_229 = baseIndex; + int const x_231 = (*(tint_symbol_4)).arr[x_229].leftIndex; + if ((x_231 == -1)) { + int const x_236 = baseIndex; + int const x_237 = *(treeIndex); + (*(tint_symbol_4)).arr[x_236].leftIndex = x_237; + int const x_239 = *(treeIndex); + BST const x_241 = (*(tint_symbol_4)).arr[x_239]; + param = x_241; + int const x_242 = *(data_1); + param_1 = x_242; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + BST const x_244 = param; + (*(tint_symbol_4)).arr[x_239] = x_244; + return; + } else { + int const x_246 = baseIndex; + int const x_248 = (*(tint_symbol_4)).arr[x_246].leftIndex; + baseIndex = x_248; + continue; + } + return; + } else { + int const x_249 = baseIndex; + int const x_251 = (*(tint_symbol_4)).arr[x_249].rightIndex; + if ((x_251 == -1)) { + int const x_256 = baseIndex; + int const x_257 = *(treeIndex); + (*(tint_symbol_4)).arr[x_256].rightIndex = x_257; + int const x_259 = *(treeIndex); + BST const x_261 = (*(tint_symbol_4)).arr[x_259]; + param_2 = x_261; + int const x_262 = *(data_1); + param_3 = x_262; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + BST const x_264 = param_2; + (*(tint_symbol_4)).arr[x_259] = x_264; + return; + } else { + int const x_266 = baseIndex; + int const x_268 = (*(tint_symbol_4)).arr[x_266].rightIndex; + baseIndex = x_268; + continue; + } + return; + } + return; + } + return; +} + +int identity_i1_(thread int* const a, thread QuicksortObject* const tint_symbol_5) { + int const x_202 = *(a); + int const x_203 = *(a); + (*(tint_symbol_5)).numbers.arr[x_202] = x_203; + int const x_206 = (*(tint_symbol_5)).numbers.arr[2]; + return x_206; +} + +int search_i1_(thread int* const target, thread tint_array_wrapper_1* const tint_symbol_6) { + int index = 0; + BST currentNode = {}; + int x_270 = 0; + index = 0; + while (true) { + int const x_275 = index; + if ((x_275 != -1)) { + } else { + break; + } + int const x_278 = index; + BST const x_280 = (*(tint_symbol_6)).arr[x_278]; + currentNode = x_280; + int const x_282 = currentNode.data; + int const x_283 = *(target); + if ((x_282 == x_283)) { + int const x_287 = *(target); + return x_287; + } + int const x_288 = *(target); + int const x_290 = currentNode.data; + if ((x_288 > x_290)) { + int const x_296 = currentNode.rightIndex; + x_270 = x_296; + } else { + int const x_298 = currentNode.leftIndex; + x_270 = x_298; + } + int const x_299 = x_270; + index = x_299; + } + return -1; +} + +void main_1(constant buf0& x_50, thread tint_array_wrapper_1* const tint_symbol_7, thread QuicksortObject* const tint_symbol_8, thread float4* const tint_symbol_9) { + int treeIndex_1 = 0; + BST param_4 = {}; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int pp = 0; + int looplimiter0 = 0; + int i = 0; + int param_24 = 0; + int count = 0; + int i_1 = 0; + int result = 0; + int param_25 = 0; + treeIndex_1 = 0; + BST const x_101 = (*(tint_symbol_7)).arr[0]; + param_4 = x_101; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + BST const x_103 = param_4; + (*(tint_symbol_7)).arr[0] = x_103; + int const x_105 = treeIndex_1; + treeIndex_1 = (x_105 + 1); + int const x_107 = treeIndex_1; + param_6 = x_107; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7), tint_symbol_7); + int const x_109 = treeIndex_1; + treeIndex_1 = (x_109 + 1); + int const x_111 = treeIndex_1; + param_8 = x_111; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9), tint_symbol_7); + int const x_113 = treeIndex_1; + treeIndex_1 = (x_113 + 1); + int const x_115 = treeIndex_1; + param_10 = x_115; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11), tint_symbol_7); + int const x_117 = treeIndex_1; + treeIndex_1 = (x_117 + 1); + int const x_119 = treeIndex_1; + param_12 = x_119; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13), tint_symbol_7); + int const x_121 = treeIndex_1; + treeIndex_1 = (x_121 + 1); + int const x_123 = treeIndex_1; + param_14 = x_123; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15), tint_symbol_7); + int const x_125 = treeIndex_1; + treeIndex_1 = (x_125 + 1); + int const x_127 = treeIndex_1; + param_16 = x_127; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17), tint_symbol_7); + int const x_129 = treeIndex_1; + treeIndex_1 = (x_129 + 1); + int const x_131 = treeIndex_1; + param_18 = x_131; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19), tint_symbol_7); + int const x_133 = treeIndex_1; + treeIndex_1 = (x_133 + 1); + int const x_135 = treeIndex_1; + param_20 = x_135; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21), tint_symbol_7); + int const x_137 = treeIndex_1; + treeIndex_1 = (x_137 + 1); + int const x_139 = treeIndex_1; + param_22 = x_139; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23), tint_symbol_7); + pp = 0; + looplimiter0 = 0; + i = 0; + while (true) { + int const x_145 = i; + if ((x_145 < 10000)) { + } else { + break; + } + int const x_148 = looplimiter0; + float const x_150 = x_50.injectionSwitch.y; + if ((x_148 >= int(x_150))) { + float const x_156 = x_50.injectionSwitch.y; + param_24 = (1 + int(x_156)); + int const x_159 = identity_i1_(&(param_24), tint_symbol_8); + pp = x_159; + break; + } + int const x_160 = looplimiter0; + looplimiter0 = (x_160 + 1); + { + int const x_162 = i; + i = (x_162 + 1); + } + } + int const x_164 = pp; + if ((x_164 != 2)) { + return; + } + count = 0; + i_1 = 0; + while (true) { + int const x_172 = i_1; + if ((x_172 < 20)) { + } else { + break; + } + int const x_175 = i_1; + param_25 = x_175; + int const x_176 = search_i1_(&(param_25), tint_symbol_7); + result = x_176; + int const x_177 = i_1; + switch(x_177) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + int const x_187 = result; + int const x_188 = i_1; + if ((x_187 == x_188)) { + int const x_192 = count; + count = (x_192 + 1); + } + break; + } + default: { + int const x_181 = result; + if ((x_181 == -1)) { + int const x_185 = count; + count = (x_185 + 1); + } + break; + } + } + { + int const x_194 = i_1; + i_1 = (x_194 + 1); + } + } + int const x_196 = count; + if ((x_196 == 20)) { + *(tint_symbol_9) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_9) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_50 [[buffer(0)]]) { + thread tint_array_wrapper_1 tint_symbol_10 = {}; + thread QuicksortObject tint_symbol_11 = {}; + thread float4 tint_symbol_12 = 0.0f; + main_1(x_50, &(tint_symbol_10), &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..885a0bad6f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.spvasm @@ -0,0 +1,572 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 371 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree "tree" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_50 "x_50" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode_struct_BST_i1_i1_i11_i1_" + OpName %node "node" + OpName %data "data" + OpName %insert_i1_i1_ "insert_i1_i1_" + OpName %treeIndex "treeIndex" + OpName %data_1 "data_1" + OpName %baseIndex "baseIndex" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %identity_i1_ "identity_i1_" + OpName %a "a" + OpName %search_i1_ "search_i1_" + OpName %target "target" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %x_270 "x_270" + OpName %main_1 "main_1" + OpName %treeIndex_1 "treeIndex_1" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %param_10 "param_10" + OpName %param_11 "param_11" + OpName %param_12 "param_12" + OpName %param_13 "param_13" + OpName %param_14 "param_14" + OpName %param_15 "param_15" + OpName %param_16 "param_16" + OpName %param_17 "param_17" + OpName %param_18 "param_18" + OpName %param_19 "param_19" + OpName %param_20 "param_20" + OpName %param_21 "param_21" + OpName %param_22 "param_22" + OpName %param_23 "param_23" + OpName %pp "pp" + OpName %looplimiter0 "looplimiter0" + OpName %i "i" + OpName %param_24 "param_24" + OpName %count "count" + OpName %i_1 "i_1" + OpName %result "result" + OpName %param_25 "param_25" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_50 NonWritable + OpDecorate %x_50 DescriptorSet 0 + OpDecorate %x_50 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %8 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %8 + %BST = OpTypeStruct %int %int %int +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %13 = OpConstantNull %_arr_BST_uint_10 + %tree = OpVariable %_ptr_Private__arr_BST_uint_10 Private %13 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_50 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %22 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %22 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %22 + %void = OpTypeVoid +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int_n1 = OpConstant %int -1 + %uint_2 = OpConstant %uint 2 + %45 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %51 = OpConstantNull %int + %53 = OpConstantNull %BST + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %131 = OpTypeFunction %int %_ptr_Function_int + %int_2 = OpConstant %int 2 + %183 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_10000 = OpConstant %int 10000 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %357 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %358 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %359 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %25 + %node = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %32 = OpLabel + %34 = OpLoad %int %data + %37 = OpAccessChain %_ptr_Function_int %node %uint_0 + OpStore %37 %34 + %40 = OpAccessChain %_ptr_Function_int %node %uint_1 + OpStore %40 %int_n1 + %44 = OpAccessChain %_ptr_Function_int %node %uint_2 + OpStore %44 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %45 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_1 = OpFunctionParameter %_ptr_Function_int + %49 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function %51 + %param = OpVariable %_ptr_Function_BST Function %53 + %param_1 = OpVariable %_ptr_Function_int Function %51 + %param_2 = OpVariable %_ptr_Function_BST Function %53 + %param_3 = OpVariable %_ptr_Function_int Function %51 + OpStore %baseIndex %int_0 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %62 = OpLoad %int %baseIndex + %64 = OpLoad %int %treeIndex + %65 = OpSLessThanEqual %bool %62 %64 + OpSelectionMerge %67 None + OpBranchConditional %65 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %59 + %67 = OpLabel + %71 = OpLoad %int %data_1 + %72 = OpLoad %int %baseIndex + %74 = OpAccessChain %_ptr_Private_int %tree %72 %uint_0 + %75 = OpLoad %int %74 + %76 = OpSLessThanEqual %bool %71 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + %80 = OpLoad %int %baseIndex + %81 = OpAccessChain %_ptr_Private_int %tree %80 %uint_1 + %82 = OpLoad %int %81 + %83 = OpIEqual %bool %82 %int_n1 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + %87 = OpLoad %int %baseIndex + %89 = OpLoad %int %treeIndex + %90 = OpAccessChain %_ptr_Private_int %tree %87 %uint_1 + OpStore %90 %89 + %92 = OpLoad %int %treeIndex + %94 = OpAccessChain %_ptr_Private_BST %tree %92 + %95 = OpLoad %BST %94 + OpStore %param %95 + %97 = OpLoad %int %data_1 + OpStore %param_1 %97 + %98 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_1 + %101 = OpLoad %BST %param + %102 = OpAccessChain %_ptr_Private_BST %tree %92 + OpStore %102 %101 + OpReturn + %86 = OpLabel + %103 = OpLoad %int %baseIndex + %104 = OpAccessChain %_ptr_Private_int %tree %103 %uint_1 + %105 = OpLoad %int %104 + OpStore %baseIndex %105 + OpBranch %60 + %84 = OpLabel + OpReturn + %79 = OpLabel + %106 = OpLoad %int %baseIndex + %107 = OpAccessChain %_ptr_Private_int %tree %106 %uint_2 + %108 = OpLoad %int %107 + %109 = OpIEqual %bool %108 %int_n1 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %112 + %111 = OpLabel + %113 = OpLoad %int %baseIndex + %115 = OpLoad %int %treeIndex + %116 = OpAccessChain %_ptr_Private_int %tree %113 %uint_2 + OpStore %116 %115 + %118 = OpLoad %int %treeIndex + %119 = OpAccessChain %_ptr_Private_BST %tree %118 + %120 = OpLoad %BST %119 + OpStore %param_2 %120 + %122 = OpLoad %int %data_1 + OpStore %param_3 %122 + %123 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_2 %param_3 + %126 = OpLoad %BST %param_2 + %127 = OpAccessChain %_ptr_Private_BST %tree %118 + OpStore %127 %126 + OpReturn + %112 = OpLabel + %128 = OpLoad %int %baseIndex + %129 = OpAccessChain %_ptr_Private_int %tree %128 %uint_2 + %130 = OpLoad %int %129 + OpStore %baseIndex %130 + OpBranch %60 + %110 = OpLabel + OpReturn + %77 = OpLabel + OpReturn + %60 = OpLabel + OpBranch %58 + %59 = OpLabel + OpReturn + OpFunctionEnd +%identity_i1_ = OpFunction %int None %131 + %a = OpFunctionParameter %_ptr_Function_int + %134 = OpLabel + %136 = OpLoad %int %a + %138 = OpLoad %int %a + %139 = OpAccessChain %_ptr_Private_int %obj %uint_0 %136 + OpStore %139 %138 + %141 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %142 = OpLoad %int %141 + OpReturnValue %142 + OpFunctionEnd + %search_i1_ = OpFunction %int None %131 + %target = OpFunctionParameter %_ptr_Function_int + %145 = OpLabel + %index = OpVariable %_ptr_Function_int Function %51 +%currentNode = OpVariable %_ptr_Function_BST Function %53 + %x_270 = OpVariable %_ptr_Function_int Function %51 + OpStore %index %int_0 + OpBranch %149 + %149 = OpLabel + OpLoopMerge %150 %151 None + OpBranch %152 + %152 = OpLabel + %153 = OpLoad %int %index + %154 = OpINotEqual %bool %153 %int_n1 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %157 + %156 = OpLabel + OpBranch %155 + %157 = OpLabel + OpBranch %150 + %155 = OpLabel + %158 = OpLoad %int %index + %159 = OpAccessChain %_ptr_Private_BST %tree %158 + %160 = OpLoad %BST %159 + OpStore %currentNode %160 + %161 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %162 = OpLoad %int %161 + %164 = OpLoad %int %target + %165 = OpIEqual %bool %162 %164 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %166 + %167 = OpLabel + %169 = OpLoad %int %target + OpReturnValue %169 + %166 = OpLabel + %171 = OpLoad %int %target + %172 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %173 = OpLoad %int %172 + %174 = OpSGreaterThan %bool %171 %173 + OpSelectionMerge %175 None + OpBranchConditional %174 %176 %177 + %176 = OpLabel + %178 = OpAccessChain %_ptr_Function_int %currentNode %uint_2 + %179 = OpLoad %int %178 + OpStore %x_270 %179 + OpBranch %175 + %177 = OpLabel + %180 = OpAccessChain %_ptr_Function_int %currentNode %uint_1 + %181 = OpLoad %int %180 + OpStore %x_270 %181 + OpBranch %175 + %175 = OpLabel + %182 = OpLoad %int %x_270 + OpStore %index %182 + OpBranch %151 + %151 = OpLabel + OpBranch %149 + %150 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd + %main_1 = OpFunction %void None %183 + %185 = OpLabel +%treeIndex_1 = OpVariable %_ptr_Function_int Function %51 + %param_4 = OpVariable %_ptr_Function_BST Function %53 + %param_5 = OpVariable %_ptr_Function_int Function %51 + %param_6 = OpVariable %_ptr_Function_int Function %51 + %param_7 = OpVariable %_ptr_Function_int Function %51 + %param_8 = OpVariable %_ptr_Function_int Function %51 + %param_9 = OpVariable %_ptr_Function_int Function %51 + %param_10 = OpVariable %_ptr_Function_int Function %51 + %param_11 = OpVariable %_ptr_Function_int Function %51 + %param_12 = OpVariable %_ptr_Function_int Function %51 + %param_13 = OpVariable %_ptr_Function_int Function %51 + %param_14 = OpVariable %_ptr_Function_int Function %51 + %param_15 = OpVariable %_ptr_Function_int Function %51 + %param_16 = OpVariable %_ptr_Function_int Function %51 + %param_17 = OpVariable %_ptr_Function_int Function %51 + %param_18 = OpVariable %_ptr_Function_int Function %51 + %param_19 = OpVariable %_ptr_Function_int Function %51 + %param_20 = OpVariable %_ptr_Function_int Function %51 + %param_21 = OpVariable %_ptr_Function_int Function %51 + %param_22 = OpVariable %_ptr_Function_int Function %51 + %param_23 = OpVariable %_ptr_Function_int Function %51 + %pp = OpVariable %_ptr_Function_int Function %51 +%looplimiter0 = OpVariable %_ptr_Function_int Function %51 + %i = OpVariable %_ptr_Function_int Function %51 + %param_24 = OpVariable %_ptr_Function_int Function %51 + %count = OpVariable %_ptr_Function_int Function %51 + %i_1 = OpVariable %_ptr_Function_int Function %51 + %result = OpVariable %_ptr_Function_int Function %51 + %param_25 = OpVariable %_ptr_Function_int Function %51 + OpStore %treeIndex_1 %int_0 + %215 = OpAccessChain %_ptr_Private_BST %tree %int_0 + %216 = OpLoad %BST %215 + OpStore %param_4 %216 + OpStore %param_5 %int_9 + %218 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_4 %param_5 + %221 = OpLoad %BST %param_4 + %222 = OpAccessChain %_ptr_Private_BST %tree %int_0 + OpStore %222 %221 + %223 = OpLoad %int %treeIndex_1 + %225 = OpIAdd %int %223 %int_1 + OpStore %treeIndex_1 %225 + %226 = OpLoad %int %treeIndex_1 + OpStore %param_6 %226 + OpStore %param_7 %int_5 + %228 = OpFunctionCall %void %insert_i1_i1_ %param_6 %param_7 + %231 = OpLoad %int %treeIndex_1 + %232 = OpIAdd %int %231 %int_1 + OpStore %treeIndex_1 %232 + %233 = OpLoad %int %treeIndex_1 + OpStore %param_8 %233 + OpStore %param_9 %int_12 + %235 = OpFunctionCall %void %insert_i1_i1_ %param_8 %param_9 + %238 = OpLoad %int %treeIndex_1 + %239 = OpIAdd %int %238 %int_1 + OpStore %treeIndex_1 %239 + %240 = OpLoad %int %treeIndex_1 + OpStore %param_10 %240 + OpStore %param_11 %int_15 + %242 = OpFunctionCall %void %insert_i1_i1_ %param_10 %param_11 + %245 = OpLoad %int %treeIndex_1 + %246 = OpIAdd %int %245 %int_1 + OpStore %treeIndex_1 %246 + %247 = OpLoad %int %treeIndex_1 + OpStore %param_12 %247 + OpStore %param_13 %int_7 + %249 = OpFunctionCall %void %insert_i1_i1_ %param_12 %param_13 + %252 = OpLoad %int %treeIndex_1 + %253 = OpIAdd %int %252 %int_1 + OpStore %treeIndex_1 %253 + %254 = OpLoad %int %treeIndex_1 + OpStore %param_14 %254 + OpStore %param_15 %int_8 + %256 = OpFunctionCall %void %insert_i1_i1_ %param_14 %param_15 + %259 = OpLoad %int %treeIndex_1 + %260 = OpIAdd %int %259 %int_1 + OpStore %treeIndex_1 %260 + %261 = OpLoad %int %treeIndex_1 + OpStore %param_16 %261 + OpStore %param_17 %int_2 + %262 = OpFunctionCall %void %insert_i1_i1_ %param_16 %param_17 + %265 = OpLoad %int %treeIndex_1 + %266 = OpIAdd %int %265 %int_1 + OpStore %treeIndex_1 %266 + %267 = OpLoad %int %treeIndex_1 + OpStore %param_18 %267 + OpStore %param_19 %int_6 + %269 = OpFunctionCall %void %insert_i1_i1_ %param_18 %param_19 + %272 = OpLoad %int %treeIndex_1 + %273 = OpIAdd %int %272 %int_1 + OpStore %treeIndex_1 %273 + %274 = OpLoad %int %treeIndex_1 + OpStore %param_20 %274 + OpStore %param_21 %int_17 + %276 = OpFunctionCall %void %insert_i1_i1_ %param_20 %param_21 + %279 = OpLoad %int %treeIndex_1 + %280 = OpIAdd %int %279 %int_1 + OpStore %treeIndex_1 %280 + %281 = OpLoad %int %treeIndex_1 + OpStore %param_22 %281 + OpStore %param_23 %int_13 + %283 = OpFunctionCall %void %insert_i1_i1_ %param_22 %param_23 + OpStore %pp %int_0 + OpStore %looplimiter0 %int_0 + OpStore %i %int_0 + OpBranch %286 + %286 = OpLabel + OpLoopMerge %287 %288 None + OpBranch %289 + %289 = OpLabel + %290 = OpLoad %int %i + %292 = OpSLessThan %bool %290 %int_10000 + OpSelectionMerge %293 None + OpBranchConditional %292 %294 %295 + %294 = OpLabel + OpBranch %293 + %295 = OpLabel + OpBranch %287 + %293 = OpLabel + %296 = OpLoad %int %looplimiter0 + %298 = OpAccessChain %_ptr_Uniform_float %x_50 %uint_0 %uint_1 + %299 = OpLoad %float %298 + %300 = OpConvertFToS %int %299 + %301 = OpSGreaterThanEqual %bool %296 %300 + OpSelectionMerge %302 None + OpBranchConditional %301 %303 %302 + %303 = OpLabel + %304 = OpAccessChain %_ptr_Uniform_float %x_50 %uint_0 %uint_1 + %305 = OpLoad %float %304 + %306 = OpConvertFToS %int %305 + %307 = OpIAdd %int %int_1 %306 + OpStore %param_24 %307 + %308 = OpFunctionCall %int %identity_i1_ %param_24 + OpStore %pp %308 + OpBranch %287 + %302 = OpLabel + %310 = OpLoad %int %looplimiter0 + %311 = OpIAdd %int %310 %int_1 + OpStore %looplimiter0 %311 + OpBranch %288 + %288 = OpLabel + %312 = OpLoad %int %i + %313 = OpIAdd %int %312 %int_1 + OpStore %i %313 + OpBranch %286 + %287 = OpLabel + %314 = OpLoad %int %pp + %315 = OpINotEqual %bool %314 %int_2 + OpSelectionMerge %316 None + OpBranchConditional %315 %317 %316 + %317 = OpLabel + OpReturn + %316 = OpLabel + OpStore %count %int_0 + OpStore %i_1 %int_0 + OpBranch %318 + %318 = OpLabel + OpLoopMerge %319 %320 None + OpBranch %321 + %321 = OpLabel + %322 = OpLoad %int %i_1 + %324 = OpSLessThan %bool %322 %int_20 + OpSelectionMerge %325 None + OpBranchConditional %324 %326 %327 + %326 = OpLabel + OpBranch %325 + %327 = OpLabel + OpBranch %319 + %325 = OpLabel + %328 = OpLoad %int %i_1 + OpStore %param_25 %328 + %329 = OpFunctionCall %int %search_i1_ %param_25 + OpStore %result %329 + %331 = OpLoad %int %i_1 + OpSelectionMerge %332 None + OpSwitch %331 %333 2 %334 5 %334 6 %334 7 %334 8 %334 9 %334 12 %334 13 %334 15 %334 17 %334 + %334 = OpLabel + %335 = OpLoad %int %result + %336 = OpLoad %int %i_1 + %337 = OpIEqual %bool %335 %336 + OpSelectionMerge %338 None + OpBranchConditional %337 %339 %338 + %339 = OpLabel + %340 = OpLoad %int %count + %341 = OpIAdd %int %340 %int_1 + OpStore %count %341 + OpBranch %338 + %338 = OpLabel + OpBranch %332 + %333 = OpLabel + %342 = OpLoad %int %result + %343 = OpIEqual %bool %342 %int_n1 + OpSelectionMerge %344 None + OpBranchConditional %343 %345 %344 + %345 = OpLabel + %346 = OpLoad %int %count + %347 = OpIAdd %int %346 %int_1 + OpStore %count %347 + OpBranch %344 + %344 = OpLabel + OpBranch %332 + %332 = OpLabel + OpBranch %320 + %320 = OpLabel + %348 = OpLoad %int %i_1 + %349 = OpIAdd %int %348 %int_1 + OpStore %i_1 %349 + OpBranch %318 + %319 = OpLabel + %350 = OpLoad %int %count + %351 = OpIEqual %bool %350 %int_20 + OpSelectionMerge %352 None + OpBranchConditional %351 %353 %354 + %353 = OpLabel + OpStore %x_GLF_color %357 + OpBranch %352 + %354 = OpLabel + OpStore %x_GLF_color %358 + OpBranch %352 + %352 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %359 +%tint_symbol = OpFunctionParameter %main_out + %363 = OpLabel + %364 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %364 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %183 + %366 = OpLabel + %367 = OpFunctionCall %void %main_1 + %369 = OpLoad %v4float %x_GLF_color + %370 = OpCompositeConstruct %main_out %369 + %368 = OpFunctionCall %void %tint_symbol_2 %370 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..cd61e29908 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.wgsl @@ -0,0 +1,319 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var obj : QuicksortObject; + +var tree : array; + +[[group(0), binding(0)]] var x_50 : buf0; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(node : ptr, data : ptr) { + let x_208 : i32 = *(data); + (*(node)).data = x_208; + (*(node)).leftIndex = -1; + (*(node)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_217 : i32 = baseIndex; + let x_218 : i32 = *(treeIndex); + if ((x_217 <= x_218)) { + } else { + break; + } + let x_221 : i32 = *(data_1); + let x_222 : i32 = baseIndex; + let x_224 : i32 = tree[x_222].data; + if ((x_221 <= x_224)) { + let x_229 : i32 = baseIndex; + let x_231 : i32 = tree[x_229].leftIndex; + if ((x_231 == -1)) { + let x_236 : i32 = baseIndex; + let x_237 : i32 = *(treeIndex); + tree[x_236].leftIndex = x_237; + let x_239 : i32 = *(treeIndex); + let x_241 : BST = tree[x_239]; + param = x_241; + let x_242 : i32 = *(data_1); + param_1 = x_242; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_244 : BST = param; + tree[x_239] = x_244; + return; + } else { + let x_246 : i32 = baseIndex; + let x_248 : i32 = tree[x_246].leftIndex; + baseIndex = x_248; + continue; + } + return; + } else { + let x_249 : i32 = baseIndex; + let x_251 : i32 = tree[x_249].rightIndex; + if ((x_251 == -1)) { + let x_256 : i32 = baseIndex; + let x_257 : i32 = *(treeIndex); + tree[x_256].rightIndex = x_257; + let x_259 : i32 = *(treeIndex); + let x_261 : BST = tree[x_259]; + param_2 = x_261; + let x_262 : i32 = *(data_1); + param_3 = x_262; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_264 : BST = param_2; + tree[x_259] = x_264; + return; + } else { + let x_266 : i32 = baseIndex; + let x_268 : i32 = tree[x_266].rightIndex; + baseIndex = x_268; + continue; + } + return; + } + return; + } + return; +} + +fn identity_i1_(a : ptr) -> i32 { + let x_202 : i32 = *(a); + let x_203 : i32 = *(a); + obj.numbers[x_202] = x_203; + let x_206 : i32 = obj.numbers[2]; + return x_206; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_270 : i32; + index = 0; + loop { + let x_275 : i32 = index; + if ((x_275 != -1)) { + } else { + break; + } + let x_278 : i32 = index; + let x_280 : BST = tree[x_278]; + currentNode = x_280; + let x_282 : i32 = currentNode.data; + let x_283 : i32 = *(target); + if ((x_282 == x_283)) { + let x_287 : i32 = *(target); + return x_287; + } + let x_288 : i32 = *(target); + let x_290 : i32 = currentNode.data; + if ((x_288 > x_290)) { + let x_296 : i32 = currentNode.rightIndex; + x_270 = x_296; + } else { + let x_298 : i32 = currentNode.leftIndex; + x_270 = x_298; + } + let x_299 : i32 = x_270; + index = x_299; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var pp : i32; + var looplimiter0 : i32; + var i : i32; + var param_24 : i32; + var count : i32; + var i_1 : i32; + var result : i32; + var param_25 : i32; + treeIndex_1 = 0; + let x_101 : BST = tree[0]; + param_4 = x_101; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_103 : BST = param_4; + tree[0] = x_103; + let x_105 : i32 = treeIndex_1; + treeIndex_1 = (x_105 + 1); + let x_107 : i32 = treeIndex_1; + param_6 = x_107; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_109 : i32 = treeIndex_1; + treeIndex_1 = (x_109 + 1); + let x_111 : i32 = treeIndex_1; + param_8 = x_111; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_113 : i32 = treeIndex_1; + treeIndex_1 = (x_113 + 1); + let x_115 : i32 = treeIndex_1; + param_10 = x_115; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_117 : i32 = treeIndex_1; + treeIndex_1 = (x_117 + 1); + let x_119 : i32 = treeIndex_1; + param_12 = x_119; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_121 : i32 = treeIndex_1; + treeIndex_1 = (x_121 + 1); + let x_123 : i32 = treeIndex_1; + param_14 = x_123; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_125 : i32 = treeIndex_1; + treeIndex_1 = (x_125 + 1); + let x_127 : i32 = treeIndex_1; + param_16 = x_127; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_129 : i32 = treeIndex_1; + treeIndex_1 = (x_129 + 1); + let x_131 : i32 = treeIndex_1; + param_18 = x_131; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_133 : i32 = treeIndex_1; + treeIndex_1 = (x_133 + 1); + let x_135 : i32 = treeIndex_1; + param_20 = x_135; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_137 : i32 = treeIndex_1; + treeIndex_1 = (x_137 + 1); + let x_139 : i32 = treeIndex_1; + param_22 = x_139; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + pp = 0; + looplimiter0 = 0; + i = 0; + loop { + let x_145 : i32 = i; + if ((x_145 < 10000)) { + } else { + break; + } + let x_148 : i32 = looplimiter0; + let x_150 : f32 = x_50.injectionSwitch.y; + if ((x_148 >= i32(x_150))) { + let x_156 : f32 = x_50.injectionSwitch.y; + param_24 = (1 + i32(x_156)); + let x_159 : i32 = identity_i1_(&(param_24)); + pp = x_159; + break; + } + let x_160 : i32 = looplimiter0; + looplimiter0 = (x_160 + 1); + + continuing { + let x_162 : i32 = i; + i = (x_162 + 1); + } + } + let x_164 : i32 = pp; + if ((x_164 != 2)) { + return; + } + count = 0; + i_1 = 0; + loop { + let x_172 : i32 = i_1; + if ((x_172 < 20)) { + } else { + break; + } + let x_175 : i32 = i_1; + param_25 = x_175; + let x_176 : i32 = search_i1_(&(param_25)); + result = x_176; + let x_177 : i32 = i_1; + switch(x_177) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_187 : i32 = result; + let x_188 : i32 = i_1; + if ((x_187 == x_188)) { + let x_192 : i32 = count; + count = (x_192 + 1); + } + } + default: { + let x_181 : i32 = result; + if ((x_181 == -1)) { + let x_185 : i32 = count; + count = (x_185 + 1); + } + } + } + + continuing { + let x_194 : i32 = i_1; + i_1 = (x_194 + 1); + } + } + let x_196 : i32 = count; + if ((x_196 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl new file mode 100644 index 0000000000..cd61e29908 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl @@ -0,0 +1,319 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var obj : QuicksortObject; + +var tree : array; + +[[group(0), binding(0)]] var x_50 : buf0; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(node : ptr, data : ptr) { + let x_208 : i32 = *(data); + (*(node)).data = x_208; + (*(node)).leftIndex = -1; + (*(node)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_217 : i32 = baseIndex; + let x_218 : i32 = *(treeIndex); + if ((x_217 <= x_218)) { + } else { + break; + } + let x_221 : i32 = *(data_1); + let x_222 : i32 = baseIndex; + let x_224 : i32 = tree[x_222].data; + if ((x_221 <= x_224)) { + let x_229 : i32 = baseIndex; + let x_231 : i32 = tree[x_229].leftIndex; + if ((x_231 == -1)) { + let x_236 : i32 = baseIndex; + let x_237 : i32 = *(treeIndex); + tree[x_236].leftIndex = x_237; + let x_239 : i32 = *(treeIndex); + let x_241 : BST = tree[x_239]; + param = x_241; + let x_242 : i32 = *(data_1); + param_1 = x_242; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_244 : BST = param; + tree[x_239] = x_244; + return; + } else { + let x_246 : i32 = baseIndex; + let x_248 : i32 = tree[x_246].leftIndex; + baseIndex = x_248; + continue; + } + return; + } else { + let x_249 : i32 = baseIndex; + let x_251 : i32 = tree[x_249].rightIndex; + if ((x_251 == -1)) { + let x_256 : i32 = baseIndex; + let x_257 : i32 = *(treeIndex); + tree[x_256].rightIndex = x_257; + let x_259 : i32 = *(treeIndex); + let x_261 : BST = tree[x_259]; + param_2 = x_261; + let x_262 : i32 = *(data_1); + param_3 = x_262; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_264 : BST = param_2; + tree[x_259] = x_264; + return; + } else { + let x_266 : i32 = baseIndex; + let x_268 : i32 = tree[x_266].rightIndex; + baseIndex = x_268; + continue; + } + return; + } + return; + } + return; +} + +fn identity_i1_(a : ptr) -> i32 { + let x_202 : i32 = *(a); + let x_203 : i32 = *(a); + obj.numbers[x_202] = x_203; + let x_206 : i32 = obj.numbers[2]; + return x_206; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_270 : i32; + index = 0; + loop { + let x_275 : i32 = index; + if ((x_275 != -1)) { + } else { + break; + } + let x_278 : i32 = index; + let x_280 : BST = tree[x_278]; + currentNode = x_280; + let x_282 : i32 = currentNode.data; + let x_283 : i32 = *(target); + if ((x_282 == x_283)) { + let x_287 : i32 = *(target); + return x_287; + } + let x_288 : i32 = *(target); + let x_290 : i32 = currentNode.data; + if ((x_288 > x_290)) { + let x_296 : i32 = currentNode.rightIndex; + x_270 = x_296; + } else { + let x_298 : i32 = currentNode.leftIndex; + x_270 = x_298; + } + let x_299 : i32 = x_270; + index = x_299; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var pp : i32; + var looplimiter0 : i32; + var i : i32; + var param_24 : i32; + var count : i32; + var i_1 : i32; + var result : i32; + var param_25 : i32; + treeIndex_1 = 0; + let x_101 : BST = tree[0]; + param_4 = x_101; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_103 : BST = param_4; + tree[0] = x_103; + let x_105 : i32 = treeIndex_1; + treeIndex_1 = (x_105 + 1); + let x_107 : i32 = treeIndex_1; + param_6 = x_107; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_109 : i32 = treeIndex_1; + treeIndex_1 = (x_109 + 1); + let x_111 : i32 = treeIndex_1; + param_8 = x_111; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_113 : i32 = treeIndex_1; + treeIndex_1 = (x_113 + 1); + let x_115 : i32 = treeIndex_1; + param_10 = x_115; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_117 : i32 = treeIndex_1; + treeIndex_1 = (x_117 + 1); + let x_119 : i32 = treeIndex_1; + param_12 = x_119; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_121 : i32 = treeIndex_1; + treeIndex_1 = (x_121 + 1); + let x_123 : i32 = treeIndex_1; + param_14 = x_123; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_125 : i32 = treeIndex_1; + treeIndex_1 = (x_125 + 1); + let x_127 : i32 = treeIndex_1; + param_16 = x_127; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_129 : i32 = treeIndex_1; + treeIndex_1 = (x_129 + 1); + let x_131 : i32 = treeIndex_1; + param_18 = x_131; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_133 : i32 = treeIndex_1; + treeIndex_1 = (x_133 + 1); + let x_135 : i32 = treeIndex_1; + param_20 = x_135; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_137 : i32 = treeIndex_1; + treeIndex_1 = (x_137 + 1); + let x_139 : i32 = treeIndex_1; + param_22 = x_139; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + pp = 0; + looplimiter0 = 0; + i = 0; + loop { + let x_145 : i32 = i; + if ((x_145 < 10000)) { + } else { + break; + } + let x_148 : i32 = looplimiter0; + let x_150 : f32 = x_50.injectionSwitch.y; + if ((x_148 >= i32(x_150))) { + let x_156 : f32 = x_50.injectionSwitch.y; + param_24 = (1 + i32(x_156)); + let x_159 : i32 = identity_i1_(&(param_24)); + pp = x_159; + break; + } + let x_160 : i32 = looplimiter0; + looplimiter0 = (x_160 + 1); + + continuing { + let x_162 : i32 = i; + i = (x_162 + 1); + } + } + let x_164 : i32 = pp; + if ((x_164 != 2)) { + return; + } + count = 0; + i_1 = 0; + loop { + let x_172 : i32 = i_1; + if ((x_172 < 20)) { + } else { + break; + } + let x_175 : i32 = i_1; + param_25 = x_175; + let x_176 : i32 = search_i1_(&(param_25)); + result = x_176; + let x_177 : i32 = i_1; + switch(x_177) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_187 : i32 = result; + let x_188 : i32 = i_1; + if ((x_187 == x_188)) { + let x_192 : i32 = count; + count = (x_192 + 1); + } + } + default: { + let x_181 : i32 = result; + if ((x_181 == -1)) { + let x_185 : i32 = count; + count = (x_185 + 1); + } + } + } + + continuing { + let x_194 : i32 = i_1; + i_1 = (x_194 + 1); + } + } + let x_196 : i32 = count; + if ((x_196 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..ece942a82b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.hlsl @@ -0,0 +1,271 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static BST tree[10] = (BST[10])0; +cbuffer cbuffer_x_50 : register(b0, space0) { + uint4 x_50[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) { + const int x_208 = data; + node.data = x_208; + node.leftIndex = -1; + node.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + baseIndex = 0; + while (true) { + const int x_217 = baseIndex; + const int x_218 = treeIndex; + if ((x_217 <= x_218)) { + } else { + break; + } + const int x_221 = data_1; + const int x_224 = tree[baseIndex].data; + if ((x_221 <= x_224)) { + const int x_231 = tree[baseIndex].leftIndex; + if ((x_231 == -1)) { + const int x_236 = baseIndex; + const int x_237 = treeIndex; + tree[x_236].leftIndex = x_237; + const int x_239 = treeIndex; + const BST x_241 = tree[x_239]; + param = x_241; + const int x_242 = data_1; + param_1 = x_242; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree[x_239] = param; + return; + } else { + const int x_248 = tree[baseIndex].leftIndex; + baseIndex = x_248; + continue; + } + return; + } else { + const int x_251 = tree[baseIndex].rightIndex; + if ((x_251 == -1)) { + const int x_256 = baseIndex; + const int x_257 = treeIndex; + tree[x_256].rightIndex = x_257; + const int x_259 = treeIndex; + const BST x_261 = tree[x_259]; + param_2 = x_261; + const int x_262 = data_1; + param_3 = x_262; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree[x_259] = param_2; + return; + } else { + const int x_268 = tree[baseIndex].rightIndex; + baseIndex = x_268; + continue; + } + return; + } + return; + } + return; +} + +int identity_i1_(inout int a) { + const int x_202 = a; + const int x_203 = a; + obj.numbers[x_202] = x_203; + const int x_206 = obj.numbers[2]; + return x_206; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_270 = 0; + index = 0; + while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_280 = tree[index]; + currentNode = x_280; + const int x_282 = currentNode.data; + const int x_283 = target; + if ((x_282 == x_283)) { + const int x_287 = target; + return x_287; + } + const int x_288 = target; + const int x_290 = currentNode.data; + if ((x_288 > x_290)) { + const int x_296 = currentNode.rightIndex; + x_270 = x_296; + } else { + const int x_298 = currentNode.leftIndex; + x_270 = x_298; + } + index = x_270; + } + return -1; +} + +void main_1() { + int treeIndex_1 = 0; + BST param_4 = (BST)0; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int pp = 0; + int looplimiter0 = 0; + int i = 0; + int param_24 = 0; + int count = 0; + int i_1 = 0; + int result = 0; + int param_25 = 0; + treeIndex_1 = 0; + const BST x_101 = tree[0]; + param_4 = x_101; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5); + tree[0] = param_4; + treeIndex_1 = (treeIndex_1 + 1); + param_6 = treeIndex_1; + param_7 = 5; + insert_i1_i1_(param_6, param_7); + treeIndex_1 = (treeIndex_1 + 1); + param_8 = treeIndex_1; + param_9 = 12; + insert_i1_i1_(param_8, param_9); + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 15; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + param_12 = treeIndex_1; + param_13 = 7; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 8; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 2; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 6; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 17; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 13; + insert_i1_i1_(param_22, param_23); + pp = 0; + looplimiter0 = 0; + i = 0; + { + for(; (i < 10000); i = (i + 1)) { + const int x_148 = looplimiter0; + const float x_150 = asfloat(x_50[0].y); + if ((x_148 >= int(x_150))) { + const float x_156 = asfloat(x_50[0].y); + param_24 = (1 + int(x_156)); + const int x_159 = identity_i1_(param_24); + pp = x_159; + break; + } + looplimiter0 = (looplimiter0 + 1); + } + } + if ((pp != 2)) { + return; + } + count = 0; + i_1 = 0; + { + for(; (i_1 < 20); i_1 = (i_1 + 1)) { + param_25 = i_1; + const int x_176 = search_i1_(param_25); + result = x_176; + switch(i_1) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + if ((result == i_1)) { + count = (count + 1); + } + break; + } + default: { + if ((result == -1)) { + count = (count + 1); + } + break; + } + } + } + } + if ((count == 20)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.msl new file mode 100644 index 0000000000..c0e8e435e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.msl @@ -0,0 +1,332 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper_1 { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const node, thread int* const data) { + int const x_208 = *(data); + (*(node)).data = x_208; + (*(node)).leftIndex = -1; + (*(node)).rightIndex = -1; + return; +} + +void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper_1* const tint_symbol_4) { + int baseIndex = 0; + BST param = {}; + int param_1 = 0; + BST param_2 = {}; + int param_3 = 0; + baseIndex = 0; + while (true) { + int const x_217 = baseIndex; + int const x_218 = *(treeIndex); + if ((x_217 <= x_218)) { + } else { + break; + } + int const x_221 = *(data_1); + int const x_222 = baseIndex; + int const x_224 = (*(tint_symbol_4)).arr[x_222].data; + if ((x_221 <= x_224)) { + int const x_229 = baseIndex; + int const x_231 = (*(tint_symbol_4)).arr[x_229].leftIndex; + if ((x_231 == -1)) { + int const x_236 = baseIndex; + int const x_237 = *(treeIndex); + (*(tint_symbol_4)).arr[x_236].leftIndex = x_237; + int const x_239 = *(treeIndex); + BST const x_241 = (*(tint_symbol_4)).arr[x_239]; + param = x_241; + int const x_242 = *(data_1); + param_1 = x_242; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + BST const x_244 = param; + (*(tint_symbol_4)).arr[x_239] = x_244; + return; + } else { + int const x_246 = baseIndex; + int const x_248 = (*(tint_symbol_4)).arr[x_246].leftIndex; + baseIndex = x_248; + continue; + } + return; + } else { + int const x_249 = baseIndex; + int const x_251 = (*(tint_symbol_4)).arr[x_249].rightIndex; + if ((x_251 == -1)) { + int const x_256 = baseIndex; + int const x_257 = *(treeIndex); + (*(tint_symbol_4)).arr[x_256].rightIndex = x_257; + int const x_259 = *(treeIndex); + BST const x_261 = (*(tint_symbol_4)).arr[x_259]; + param_2 = x_261; + int const x_262 = *(data_1); + param_3 = x_262; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + BST const x_264 = param_2; + (*(tint_symbol_4)).arr[x_259] = x_264; + return; + } else { + int const x_266 = baseIndex; + int const x_268 = (*(tint_symbol_4)).arr[x_266].rightIndex; + baseIndex = x_268; + continue; + } + return; + } + return; + } + return; +} + +int identity_i1_(thread int* const a, thread QuicksortObject* const tint_symbol_5) { + int const x_202 = *(a); + int const x_203 = *(a); + (*(tint_symbol_5)).numbers.arr[x_202] = x_203; + int const x_206 = (*(tint_symbol_5)).numbers.arr[2]; + return x_206; +} + +int search_i1_(thread int* const target, thread tint_array_wrapper_1* const tint_symbol_6) { + int index = 0; + BST currentNode = {}; + int x_270 = 0; + index = 0; + while (true) { + int const x_275 = index; + if ((x_275 != -1)) { + } else { + break; + } + int const x_278 = index; + BST const x_280 = (*(tint_symbol_6)).arr[x_278]; + currentNode = x_280; + int const x_282 = currentNode.data; + int const x_283 = *(target); + if ((x_282 == x_283)) { + int const x_287 = *(target); + return x_287; + } + int const x_288 = *(target); + int const x_290 = currentNode.data; + if ((x_288 > x_290)) { + int const x_296 = currentNode.rightIndex; + x_270 = x_296; + } else { + int const x_298 = currentNode.leftIndex; + x_270 = x_298; + } + int const x_299 = x_270; + index = x_299; + } + return -1; +} + +void main_1(constant buf0& x_50, thread tint_array_wrapper_1* const tint_symbol_7, thread QuicksortObject* const tint_symbol_8, thread float4* const tint_symbol_9) { + int treeIndex_1 = 0; + BST param_4 = {}; + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + int param_8 = 0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int pp = 0; + int looplimiter0 = 0; + int i = 0; + int param_24 = 0; + int count = 0; + int i_1 = 0; + int result = 0; + int param_25 = 0; + treeIndex_1 = 0; + BST const x_101 = (*(tint_symbol_7)).arr[0]; + param_4 = x_101; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + BST const x_103 = param_4; + (*(tint_symbol_7)).arr[0] = x_103; + int const x_105 = treeIndex_1; + treeIndex_1 = (x_105 + 1); + int const x_107 = treeIndex_1; + param_6 = x_107; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7), tint_symbol_7); + int const x_109 = treeIndex_1; + treeIndex_1 = (x_109 + 1); + int const x_111 = treeIndex_1; + param_8 = x_111; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9), tint_symbol_7); + int const x_113 = treeIndex_1; + treeIndex_1 = (x_113 + 1); + int const x_115 = treeIndex_1; + param_10 = x_115; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11), tint_symbol_7); + int const x_117 = treeIndex_1; + treeIndex_1 = (x_117 + 1); + int const x_119 = treeIndex_1; + param_12 = x_119; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13), tint_symbol_7); + int const x_121 = treeIndex_1; + treeIndex_1 = (x_121 + 1); + int const x_123 = treeIndex_1; + param_14 = x_123; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15), tint_symbol_7); + int const x_125 = treeIndex_1; + treeIndex_1 = (x_125 + 1); + int const x_127 = treeIndex_1; + param_16 = x_127; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17), tint_symbol_7); + int const x_129 = treeIndex_1; + treeIndex_1 = (x_129 + 1); + int const x_131 = treeIndex_1; + param_18 = x_131; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19), tint_symbol_7); + int const x_133 = treeIndex_1; + treeIndex_1 = (x_133 + 1); + int const x_135 = treeIndex_1; + param_20 = x_135; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21), tint_symbol_7); + int const x_137 = treeIndex_1; + treeIndex_1 = (x_137 + 1); + int const x_139 = treeIndex_1; + param_22 = x_139; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23), tint_symbol_7); + pp = 0; + looplimiter0 = 0; + i = 0; + while (true) { + int const x_145 = i; + if ((x_145 < 10000)) { + } else { + break; + } + int const x_148 = looplimiter0; + float const x_150 = x_50.injectionSwitch.y; + if ((x_148 >= int(x_150))) { + float const x_156 = x_50.injectionSwitch.y; + param_24 = (1 + int(x_156)); + int const x_159 = identity_i1_(&(param_24), tint_symbol_8); + pp = x_159; + break; + } + int const x_160 = looplimiter0; + looplimiter0 = (x_160 + 1); + { + int const x_162 = i; + i = (x_162 + 1); + } + } + int const x_164 = pp; + if ((x_164 != 2)) { + return; + } + count = 0; + i_1 = 0; + while (true) { + int const x_172 = i_1; + if ((x_172 < 20)) { + } else { + break; + } + int const x_175 = i_1; + param_25 = x_175; + int const x_176 = search_i1_(&(param_25), tint_symbol_7); + result = x_176; + int const x_177 = i_1; + switch(x_177) { + case 2: + case 5: + case 6: + case 7: + case 8: + case 9: + case 12: + case 13: + case 15: + case 17: { + int const x_187 = result; + int const x_188 = i_1; + if ((x_187 == x_188)) { + int const x_192 = count; + count = (x_192 + 1); + } + break; + } + default: { + int const x_181 = result; + if ((x_181 == -1)) { + int const x_185 = count; + count = (x_185 + 1); + } + break; + } + } + { + int const x_194 = i_1; + i_1 = (x_194 + 1); + } + } + int const x_196 = count; + if ((x_196 == 20)) { + *(tint_symbol_9) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_9) = float4(0.0f, 0.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_50 [[buffer(0)]]) { + thread tint_array_wrapper_1 tint_symbol_10 = {}; + thread QuicksortObject tint_symbol_11 = {}; + thread float4 tint_symbol_12 = 0.0f; + main_1(x_50, &(tint_symbol_10), &(tint_symbol_11), &(tint_symbol_12)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_12}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..885a0bad6f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.spvasm @@ -0,0 +1,572 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 371 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree "tree" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_50 "x_50" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode_struct_BST_i1_i1_i11_i1_" + OpName %node "node" + OpName %data "data" + OpName %insert_i1_i1_ "insert_i1_i1_" + OpName %treeIndex "treeIndex" + OpName %data_1 "data_1" + OpName %baseIndex "baseIndex" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %identity_i1_ "identity_i1_" + OpName %a "a" + OpName %search_i1_ "search_i1_" + OpName %target "target" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %x_270 "x_270" + OpName %main_1 "main_1" + OpName %treeIndex_1 "treeIndex_1" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %param_10 "param_10" + OpName %param_11 "param_11" + OpName %param_12 "param_12" + OpName %param_13 "param_13" + OpName %param_14 "param_14" + OpName %param_15 "param_15" + OpName %param_16 "param_16" + OpName %param_17 "param_17" + OpName %param_18 "param_18" + OpName %param_19 "param_19" + OpName %param_20 "param_20" + OpName %param_21 "param_21" + OpName %param_22 "param_22" + OpName %param_23 "param_23" + OpName %pp "pp" + OpName %looplimiter0 "looplimiter0" + OpName %i "i" + OpName %param_24 "param_24" + OpName %count "count" + OpName %i_1 "i_1" + OpName %result "result" + OpName %param_25 "param_25" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_50 NonWritable + OpDecorate %x_50 DescriptorSet 0 + OpDecorate %x_50 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %8 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %8 + %BST = OpTypeStruct %int %int %int +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %13 = OpConstantNull %_arr_BST_uint_10 + %tree = OpVariable %_ptr_Private__arr_BST_uint_10 Private %13 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_50 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %22 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %22 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %22 + %void = OpTypeVoid +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %25 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int_n1 = OpConstant %int -1 + %uint_2 = OpConstant %uint 2 + %45 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %51 = OpConstantNull %int + %53 = OpConstantNull %BST + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %131 = OpTypeFunction %int %_ptr_Function_int + %int_2 = OpConstant %int 2 + %183 = OpTypeFunction %void + %int_9 = OpConstant %int 9 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_12 = OpConstant %int 12 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %int_6 = OpConstant %int 6 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %int_10000 = OpConstant %int 10000 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %357 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %358 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %359 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %25 + %node = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %32 = OpLabel + %34 = OpLoad %int %data + %37 = OpAccessChain %_ptr_Function_int %node %uint_0 + OpStore %37 %34 + %40 = OpAccessChain %_ptr_Function_int %node %uint_1 + OpStore %40 %int_n1 + %44 = OpAccessChain %_ptr_Function_int %node %uint_2 + OpStore %44 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %45 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_1 = OpFunctionParameter %_ptr_Function_int + %49 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function %51 + %param = OpVariable %_ptr_Function_BST Function %53 + %param_1 = OpVariable %_ptr_Function_int Function %51 + %param_2 = OpVariable %_ptr_Function_BST Function %53 + %param_3 = OpVariable %_ptr_Function_int Function %51 + OpStore %baseIndex %int_0 + OpBranch %58 + %58 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %62 = OpLoad %int %baseIndex + %64 = OpLoad %int %treeIndex + %65 = OpSLessThanEqual %bool %62 %64 + OpSelectionMerge %67 None + OpBranchConditional %65 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %59 + %67 = OpLabel + %71 = OpLoad %int %data_1 + %72 = OpLoad %int %baseIndex + %74 = OpAccessChain %_ptr_Private_int %tree %72 %uint_0 + %75 = OpLoad %int %74 + %76 = OpSLessThanEqual %bool %71 %75 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %79 + %78 = OpLabel + %80 = OpLoad %int %baseIndex + %81 = OpAccessChain %_ptr_Private_int %tree %80 %uint_1 + %82 = OpLoad %int %81 + %83 = OpIEqual %bool %82 %int_n1 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + %87 = OpLoad %int %baseIndex + %89 = OpLoad %int %treeIndex + %90 = OpAccessChain %_ptr_Private_int %tree %87 %uint_1 + OpStore %90 %89 + %92 = OpLoad %int %treeIndex + %94 = OpAccessChain %_ptr_Private_BST %tree %92 + %95 = OpLoad %BST %94 + OpStore %param %95 + %97 = OpLoad %int %data_1 + OpStore %param_1 %97 + %98 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_1 + %101 = OpLoad %BST %param + %102 = OpAccessChain %_ptr_Private_BST %tree %92 + OpStore %102 %101 + OpReturn + %86 = OpLabel + %103 = OpLoad %int %baseIndex + %104 = OpAccessChain %_ptr_Private_int %tree %103 %uint_1 + %105 = OpLoad %int %104 + OpStore %baseIndex %105 + OpBranch %60 + %84 = OpLabel + OpReturn + %79 = OpLabel + %106 = OpLoad %int %baseIndex + %107 = OpAccessChain %_ptr_Private_int %tree %106 %uint_2 + %108 = OpLoad %int %107 + %109 = OpIEqual %bool %108 %int_n1 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %112 + %111 = OpLabel + %113 = OpLoad %int %baseIndex + %115 = OpLoad %int %treeIndex + %116 = OpAccessChain %_ptr_Private_int %tree %113 %uint_2 + OpStore %116 %115 + %118 = OpLoad %int %treeIndex + %119 = OpAccessChain %_ptr_Private_BST %tree %118 + %120 = OpLoad %BST %119 + OpStore %param_2 %120 + %122 = OpLoad %int %data_1 + OpStore %param_3 %122 + %123 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_2 %param_3 + %126 = OpLoad %BST %param_2 + %127 = OpAccessChain %_ptr_Private_BST %tree %118 + OpStore %127 %126 + OpReturn + %112 = OpLabel + %128 = OpLoad %int %baseIndex + %129 = OpAccessChain %_ptr_Private_int %tree %128 %uint_2 + %130 = OpLoad %int %129 + OpStore %baseIndex %130 + OpBranch %60 + %110 = OpLabel + OpReturn + %77 = OpLabel + OpReturn + %60 = OpLabel + OpBranch %58 + %59 = OpLabel + OpReturn + OpFunctionEnd +%identity_i1_ = OpFunction %int None %131 + %a = OpFunctionParameter %_ptr_Function_int + %134 = OpLabel + %136 = OpLoad %int %a + %138 = OpLoad %int %a + %139 = OpAccessChain %_ptr_Private_int %obj %uint_0 %136 + OpStore %139 %138 + %141 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %142 = OpLoad %int %141 + OpReturnValue %142 + OpFunctionEnd + %search_i1_ = OpFunction %int None %131 + %target = OpFunctionParameter %_ptr_Function_int + %145 = OpLabel + %index = OpVariable %_ptr_Function_int Function %51 +%currentNode = OpVariable %_ptr_Function_BST Function %53 + %x_270 = OpVariable %_ptr_Function_int Function %51 + OpStore %index %int_0 + OpBranch %149 + %149 = OpLabel + OpLoopMerge %150 %151 None + OpBranch %152 + %152 = OpLabel + %153 = OpLoad %int %index + %154 = OpINotEqual %bool %153 %int_n1 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %157 + %156 = OpLabel + OpBranch %155 + %157 = OpLabel + OpBranch %150 + %155 = OpLabel + %158 = OpLoad %int %index + %159 = OpAccessChain %_ptr_Private_BST %tree %158 + %160 = OpLoad %BST %159 + OpStore %currentNode %160 + %161 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %162 = OpLoad %int %161 + %164 = OpLoad %int %target + %165 = OpIEqual %bool %162 %164 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %166 + %167 = OpLabel + %169 = OpLoad %int %target + OpReturnValue %169 + %166 = OpLabel + %171 = OpLoad %int %target + %172 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %173 = OpLoad %int %172 + %174 = OpSGreaterThan %bool %171 %173 + OpSelectionMerge %175 None + OpBranchConditional %174 %176 %177 + %176 = OpLabel + %178 = OpAccessChain %_ptr_Function_int %currentNode %uint_2 + %179 = OpLoad %int %178 + OpStore %x_270 %179 + OpBranch %175 + %177 = OpLabel + %180 = OpAccessChain %_ptr_Function_int %currentNode %uint_1 + %181 = OpLoad %int %180 + OpStore %x_270 %181 + OpBranch %175 + %175 = OpLabel + %182 = OpLoad %int %x_270 + OpStore %index %182 + OpBranch %151 + %151 = OpLabel + OpBranch %149 + %150 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd + %main_1 = OpFunction %void None %183 + %185 = OpLabel +%treeIndex_1 = OpVariable %_ptr_Function_int Function %51 + %param_4 = OpVariable %_ptr_Function_BST Function %53 + %param_5 = OpVariable %_ptr_Function_int Function %51 + %param_6 = OpVariable %_ptr_Function_int Function %51 + %param_7 = OpVariable %_ptr_Function_int Function %51 + %param_8 = OpVariable %_ptr_Function_int Function %51 + %param_9 = OpVariable %_ptr_Function_int Function %51 + %param_10 = OpVariable %_ptr_Function_int Function %51 + %param_11 = OpVariable %_ptr_Function_int Function %51 + %param_12 = OpVariable %_ptr_Function_int Function %51 + %param_13 = OpVariable %_ptr_Function_int Function %51 + %param_14 = OpVariable %_ptr_Function_int Function %51 + %param_15 = OpVariable %_ptr_Function_int Function %51 + %param_16 = OpVariable %_ptr_Function_int Function %51 + %param_17 = OpVariable %_ptr_Function_int Function %51 + %param_18 = OpVariable %_ptr_Function_int Function %51 + %param_19 = OpVariable %_ptr_Function_int Function %51 + %param_20 = OpVariable %_ptr_Function_int Function %51 + %param_21 = OpVariable %_ptr_Function_int Function %51 + %param_22 = OpVariable %_ptr_Function_int Function %51 + %param_23 = OpVariable %_ptr_Function_int Function %51 + %pp = OpVariable %_ptr_Function_int Function %51 +%looplimiter0 = OpVariable %_ptr_Function_int Function %51 + %i = OpVariable %_ptr_Function_int Function %51 + %param_24 = OpVariable %_ptr_Function_int Function %51 + %count = OpVariable %_ptr_Function_int Function %51 + %i_1 = OpVariable %_ptr_Function_int Function %51 + %result = OpVariable %_ptr_Function_int Function %51 + %param_25 = OpVariable %_ptr_Function_int Function %51 + OpStore %treeIndex_1 %int_0 + %215 = OpAccessChain %_ptr_Private_BST %tree %int_0 + %216 = OpLoad %BST %215 + OpStore %param_4 %216 + OpStore %param_5 %int_9 + %218 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_4 %param_5 + %221 = OpLoad %BST %param_4 + %222 = OpAccessChain %_ptr_Private_BST %tree %int_0 + OpStore %222 %221 + %223 = OpLoad %int %treeIndex_1 + %225 = OpIAdd %int %223 %int_1 + OpStore %treeIndex_1 %225 + %226 = OpLoad %int %treeIndex_1 + OpStore %param_6 %226 + OpStore %param_7 %int_5 + %228 = OpFunctionCall %void %insert_i1_i1_ %param_6 %param_7 + %231 = OpLoad %int %treeIndex_1 + %232 = OpIAdd %int %231 %int_1 + OpStore %treeIndex_1 %232 + %233 = OpLoad %int %treeIndex_1 + OpStore %param_8 %233 + OpStore %param_9 %int_12 + %235 = OpFunctionCall %void %insert_i1_i1_ %param_8 %param_9 + %238 = OpLoad %int %treeIndex_1 + %239 = OpIAdd %int %238 %int_1 + OpStore %treeIndex_1 %239 + %240 = OpLoad %int %treeIndex_1 + OpStore %param_10 %240 + OpStore %param_11 %int_15 + %242 = OpFunctionCall %void %insert_i1_i1_ %param_10 %param_11 + %245 = OpLoad %int %treeIndex_1 + %246 = OpIAdd %int %245 %int_1 + OpStore %treeIndex_1 %246 + %247 = OpLoad %int %treeIndex_1 + OpStore %param_12 %247 + OpStore %param_13 %int_7 + %249 = OpFunctionCall %void %insert_i1_i1_ %param_12 %param_13 + %252 = OpLoad %int %treeIndex_1 + %253 = OpIAdd %int %252 %int_1 + OpStore %treeIndex_1 %253 + %254 = OpLoad %int %treeIndex_1 + OpStore %param_14 %254 + OpStore %param_15 %int_8 + %256 = OpFunctionCall %void %insert_i1_i1_ %param_14 %param_15 + %259 = OpLoad %int %treeIndex_1 + %260 = OpIAdd %int %259 %int_1 + OpStore %treeIndex_1 %260 + %261 = OpLoad %int %treeIndex_1 + OpStore %param_16 %261 + OpStore %param_17 %int_2 + %262 = OpFunctionCall %void %insert_i1_i1_ %param_16 %param_17 + %265 = OpLoad %int %treeIndex_1 + %266 = OpIAdd %int %265 %int_1 + OpStore %treeIndex_1 %266 + %267 = OpLoad %int %treeIndex_1 + OpStore %param_18 %267 + OpStore %param_19 %int_6 + %269 = OpFunctionCall %void %insert_i1_i1_ %param_18 %param_19 + %272 = OpLoad %int %treeIndex_1 + %273 = OpIAdd %int %272 %int_1 + OpStore %treeIndex_1 %273 + %274 = OpLoad %int %treeIndex_1 + OpStore %param_20 %274 + OpStore %param_21 %int_17 + %276 = OpFunctionCall %void %insert_i1_i1_ %param_20 %param_21 + %279 = OpLoad %int %treeIndex_1 + %280 = OpIAdd %int %279 %int_1 + OpStore %treeIndex_1 %280 + %281 = OpLoad %int %treeIndex_1 + OpStore %param_22 %281 + OpStore %param_23 %int_13 + %283 = OpFunctionCall %void %insert_i1_i1_ %param_22 %param_23 + OpStore %pp %int_0 + OpStore %looplimiter0 %int_0 + OpStore %i %int_0 + OpBranch %286 + %286 = OpLabel + OpLoopMerge %287 %288 None + OpBranch %289 + %289 = OpLabel + %290 = OpLoad %int %i + %292 = OpSLessThan %bool %290 %int_10000 + OpSelectionMerge %293 None + OpBranchConditional %292 %294 %295 + %294 = OpLabel + OpBranch %293 + %295 = OpLabel + OpBranch %287 + %293 = OpLabel + %296 = OpLoad %int %looplimiter0 + %298 = OpAccessChain %_ptr_Uniform_float %x_50 %uint_0 %uint_1 + %299 = OpLoad %float %298 + %300 = OpConvertFToS %int %299 + %301 = OpSGreaterThanEqual %bool %296 %300 + OpSelectionMerge %302 None + OpBranchConditional %301 %303 %302 + %303 = OpLabel + %304 = OpAccessChain %_ptr_Uniform_float %x_50 %uint_0 %uint_1 + %305 = OpLoad %float %304 + %306 = OpConvertFToS %int %305 + %307 = OpIAdd %int %int_1 %306 + OpStore %param_24 %307 + %308 = OpFunctionCall %int %identity_i1_ %param_24 + OpStore %pp %308 + OpBranch %287 + %302 = OpLabel + %310 = OpLoad %int %looplimiter0 + %311 = OpIAdd %int %310 %int_1 + OpStore %looplimiter0 %311 + OpBranch %288 + %288 = OpLabel + %312 = OpLoad %int %i + %313 = OpIAdd %int %312 %int_1 + OpStore %i %313 + OpBranch %286 + %287 = OpLabel + %314 = OpLoad %int %pp + %315 = OpINotEqual %bool %314 %int_2 + OpSelectionMerge %316 None + OpBranchConditional %315 %317 %316 + %317 = OpLabel + OpReturn + %316 = OpLabel + OpStore %count %int_0 + OpStore %i_1 %int_0 + OpBranch %318 + %318 = OpLabel + OpLoopMerge %319 %320 None + OpBranch %321 + %321 = OpLabel + %322 = OpLoad %int %i_1 + %324 = OpSLessThan %bool %322 %int_20 + OpSelectionMerge %325 None + OpBranchConditional %324 %326 %327 + %326 = OpLabel + OpBranch %325 + %327 = OpLabel + OpBranch %319 + %325 = OpLabel + %328 = OpLoad %int %i_1 + OpStore %param_25 %328 + %329 = OpFunctionCall %int %search_i1_ %param_25 + OpStore %result %329 + %331 = OpLoad %int %i_1 + OpSelectionMerge %332 None + OpSwitch %331 %333 2 %334 5 %334 6 %334 7 %334 8 %334 9 %334 12 %334 13 %334 15 %334 17 %334 + %334 = OpLabel + %335 = OpLoad %int %result + %336 = OpLoad %int %i_1 + %337 = OpIEqual %bool %335 %336 + OpSelectionMerge %338 None + OpBranchConditional %337 %339 %338 + %339 = OpLabel + %340 = OpLoad %int %count + %341 = OpIAdd %int %340 %int_1 + OpStore %count %341 + OpBranch %338 + %338 = OpLabel + OpBranch %332 + %333 = OpLabel + %342 = OpLoad %int %result + %343 = OpIEqual %bool %342 %int_n1 + OpSelectionMerge %344 None + OpBranchConditional %343 %345 %344 + %345 = OpLabel + %346 = OpLoad %int %count + %347 = OpIAdd %int %346 %int_1 + OpStore %count %347 + OpBranch %344 + %344 = OpLabel + OpBranch %332 + %332 = OpLabel + OpBranch %320 + %320 = OpLabel + %348 = OpLoad %int %i_1 + %349 = OpIAdd %int %348 %int_1 + OpStore %i_1 %349 + OpBranch %318 + %319 = OpLabel + %350 = OpLoad %int %count + %351 = OpIEqual %bool %350 %int_20 + OpSelectionMerge %352 None + OpBranchConditional %351 %353 %354 + %353 = OpLabel + OpStore %x_GLF_color %357 + OpBranch %352 + %354 = OpLabel + OpStore %x_GLF_color %358 + OpBranch %352 + %352 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %359 +%tint_symbol = OpFunctionParameter %main_out + %363 = OpLabel + %364 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %364 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %183 + %366 = OpLabel + %367 = OpFunctionCall %void %main_1 + %369 = OpLoad %v4float %x_GLF_color + %370 = OpCompositeConstruct %main_out %369 + %368 = OpFunctionCall %void %tint_symbol_2 %370 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..cd61e29908 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.wgsl @@ -0,0 +1,319 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var obj : QuicksortObject; + +var tree : array; + +[[group(0), binding(0)]] var x_50 : buf0; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(node : ptr, data : ptr) { + let x_208 : i32 = *(data); + (*(node)).data = x_208; + (*(node)).leftIndex = -1; + (*(node)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + baseIndex = 0; + loop { + let x_217 : i32 = baseIndex; + let x_218 : i32 = *(treeIndex); + if ((x_217 <= x_218)) { + } else { + break; + } + let x_221 : i32 = *(data_1); + let x_222 : i32 = baseIndex; + let x_224 : i32 = tree[x_222].data; + if ((x_221 <= x_224)) { + let x_229 : i32 = baseIndex; + let x_231 : i32 = tree[x_229].leftIndex; + if ((x_231 == -1)) { + let x_236 : i32 = baseIndex; + let x_237 : i32 = *(treeIndex); + tree[x_236].leftIndex = x_237; + let x_239 : i32 = *(treeIndex); + let x_241 : BST = tree[x_239]; + param = x_241; + let x_242 : i32 = *(data_1); + param_1 = x_242; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_244 : BST = param; + tree[x_239] = x_244; + return; + } else { + let x_246 : i32 = baseIndex; + let x_248 : i32 = tree[x_246].leftIndex; + baseIndex = x_248; + continue; + } + return; + } else { + let x_249 : i32 = baseIndex; + let x_251 : i32 = tree[x_249].rightIndex; + if ((x_251 == -1)) { + let x_256 : i32 = baseIndex; + let x_257 : i32 = *(treeIndex); + tree[x_256].rightIndex = x_257; + let x_259 : i32 = *(treeIndex); + let x_261 : BST = tree[x_259]; + param_2 = x_261; + let x_262 : i32 = *(data_1); + param_3 = x_262; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_264 : BST = param_2; + tree[x_259] = x_264; + return; + } else { + let x_266 : i32 = baseIndex; + let x_268 : i32 = tree[x_266].rightIndex; + baseIndex = x_268; + continue; + } + return; + } + return; + } + return; +} + +fn identity_i1_(a : ptr) -> i32 { + let x_202 : i32 = *(a); + let x_203 : i32 = *(a); + obj.numbers[x_202] = x_203; + let x_206 : i32 = obj.numbers[2]; + return x_206; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_270 : i32; + index = 0; + loop { + let x_275 : i32 = index; + if ((x_275 != -1)) { + } else { + break; + } + let x_278 : i32 = index; + let x_280 : BST = tree[x_278]; + currentNode = x_280; + let x_282 : i32 = currentNode.data; + let x_283 : i32 = *(target); + if ((x_282 == x_283)) { + let x_287 : i32 = *(target); + return x_287; + } + let x_288 : i32 = *(target); + let x_290 : i32 = currentNode.data; + if ((x_288 > x_290)) { + let x_296 : i32 = currentNode.rightIndex; + x_270 = x_296; + } else { + let x_298 : i32 = currentNode.leftIndex; + x_270 = x_298; + } + let x_299 : i32 = x_270; + index = x_299; + } + return -1; +} + +fn main_1() { + var treeIndex_1 : i32; + var param_4 : BST; + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + var param_8 : i32; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var pp : i32; + var looplimiter0 : i32; + var i : i32; + var param_24 : i32; + var count : i32; + var i_1 : i32; + var result : i32; + var param_25 : i32; + treeIndex_1 = 0; + let x_101 : BST = tree[0]; + param_4 = x_101; + param_5 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5)); + let x_103 : BST = param_4; + tree[0] = x_103; + let x_105 : i32 = treeIndex_1; + treeIndex_1 = (x_105 + 1); + let x_107 : i32 = treeIndex_1; + param_6 = x_107; + param_7 = 5; + insert_i1_i1_(&(param_6), &(param_7)); + let x_109 : i32 = treeIndex_1; + treeIndex_1 = (x_109 + 1); + let x_111 : i32 = treeIndex_1; + param_8 = x_111; + param_9 = 12; + insert_i1_i1_(&(param_8), &(param_9)); + let x_113 : i32 = treeIndex_1; + treeIndex_1 = (x_113 + 1); + let x_115 : i32 = treeIndex_1; + param_10 = x_115; + param_11 = 15; + insert_i1_i1_(&(param_10), &(param_11)); + let x_117 : i32 = treeIndex_1; + treeIndex_1 = (x_117 + 1); + let x_119 : i32 = treeIndex_1; + param_12 = x_119; + param_13 = 7; + insert_i1_i1_(&(param_12), &(param_13)); + let x_121 : i32 = treeIndex_1; + treeIndex_1 = (x_121 + 1); + let x_123 : i32 = treeIndex_1; + param_14 = x_123; + param_15 = 8; + insert_i1_i1_(&(param_14), &(param_15)); + let x_125 : i32 = treeIndex_1; + treeIndex_1 = (x_125 + 1); + let x_127 : i32 = treeIndex_1; + param_16 = x_127; + param_17 = 2; + insert_i1_i1_(&(param_16), &(param_17)); + let x_129 : i32 = treeIndex_1; + treeIndex_1 = (x_129 + 1); + let x_131 : i32 = treeIndex_1; + param_18 = x_131; + param_19 = 6; + insert_i1_i1_(&(param_18), &(param_19)); + let x_133 : i32 = treeIndex_1; + treeIndex_1 = (x_133 + 1); + let x_135 : i32 = treeIndex_1; + param_20 = x_135; + param_21 = 17; + insert_i1_i1_(&(param_20), &(param_21)); + let x_137 : i32 = treeIndex_1; + treeIndex_1 = (x_137 + 1); + let x_139 : i32 = treeIndex_1; + param_22 = x_139; + param_23 = 13; + insert_i1_i1_(&(param_22), &(param_23)); + pp = 0; + looplimiter0 = 0; + i = 0; + loop { + let x_145 : i32 = i; + if ((x_145 < 10000)) { + } else { + break; + } + let x_148 : i32 = looplimiter0; + let x_150 : f32 = x_50.injectionSwitch.y; + if ((x_148 >= i32(x_150))) { + let x_156 : f32 = x_50.injectionSwitch.y; + param_24 = (1 + i32(x_156)); + let x_159 : i32 = identity_i1_(&(param_24)); + pp = x_159; + break; + } + let x_160 : i32 = looplimiter0; + looplimiter0 = (x_160 + 1); + + continuing { + let x_162 : i32 = i; + i = (x_162 + 1); + } + } + let x_164 : i32 = pp; + if ((x_164 != 2)) { + return; + } + count = 0; + i_1 = 0; + loop { + let x_172 : i32 = i_1; + if ((x_172 < 20)) { + } else { + break; + } + let x_175 : i32 = i_1; + param_25 = x_175; + let x_176 : i32 = search_i1_(&(param_25)); + result = x_176; + let x_177 : i32 = i_1; + switch(x_177) { + case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: { + let x_187 : i32 = result; + let x_188 : i32 = i_1; + if ((x_187 == x_188)) { + let x_192 : i32 = count; + count = (x_192 + 1); + } + } + default: { + let x_181 : i32 = result; + if ((x_181 == -1)) { + let x_185 : i32 = count; + count = (x_185 + 1); + } + } + } + + continuing { + let x_194 : i32 = i_1; + i_1 = (x_194 + 1); + } + } + let x_196 : i32 = count; + if ((x_196 == 20)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm new file mode 100644 index 0000000000..d5a25f6a11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm @@ -0,0 +1,153 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %collatz_i1_ "collatz(i1;" + OpName %v "v" + OpName %count "count" + OpName %lin "lin" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %v_0 "v" + OpName %_GLF_color "_GLF_color" + OpName %param "param" + OpName %indexable "indexable" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpTypeFunction %int %_ptr_Function_int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_8 = OpConstant %int 8 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %42 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %44 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %46 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %48 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %49 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %50 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %51 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %52 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %53 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %54 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %55 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %56 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %57 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %58 = OpConstantComposite %_arr_v4float_uint_16 %42 %44 %45 %46 %47 %48 %49 %50 %42 %51 %52 %53 %54 %55 %56 %57 + %int_16 = OpConstant %int 16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main = OpFunction %void None %15 + %62 = OpLabel + %lin = OpVariable %_ptr_Function_v2float Function + %v_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %63 = OpLoad %v4float %gl_FragCoord + %64 = OpVectorShuffle %v2float %63 %63 0 1 + %65 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %66 = OpLoad %v2float %65 + %67 = OpFDiv %v2float %64 %66 + OpStore %lin %67 + %68 = OpLoad %v2float %lin + %69 = OpVectorTimesScalar %v2float %68 %float_8 + %70 = OpExtInst %v2float %1 Floor %69 + OpStore %lin %70 + %71 = OpAccessChain %_ptr_Function_float %lin %uint_0 + %72 = OpLoad %float %71 + %73 = OpConvertFToS %int %72 + %74 = OpIMul %int %73 %int_8 + %75 = OpAccessChain %_ptr_Function_float %lin %uint_1 + %76 = OpLoad %float %75 + %77 = OpConvertFToS %int %76 + %78 = OpIAdd %int %74 %77 + OpStore %v_0 %78 + %79 = OpLoad %int %v_0 + OpStore %param %79 + %80 = OpFunctionCall %int %collatz_i1_ %param + %81 = OpSMod %int %80 %int_16 + OpStore %indexable %58 + %82 = OpAccessChain %_ptr_Function_v4float %indexable %81 + %83 = OpLoad %v4float %82 + OpStore %_GLF_color %83 + OpReturn + OpFunctionEnd +%collatz_i1_ = OpFunction %int None %18 + %v = OpFunctionParameter %_ptr_Function_int + %84 = OpLabel + %count = OpVariable %_ptr_Function_int Function + OpStore %count %int_0 + OpBranch %85 + %85 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %89 = OpLoad %int %v + %90 = OpSGreaterThan %bool %89 %int_1 + OpBranchConditional %90 %91 %86 + %91 = OpLabel + %92 = OpLoad %int %v + %93 = OpBitwiseAnd %int %92 %int_1 + %94 = OpIEqual %bool %93 %int_1 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %97 + %96 = OpLabel + %98 = OpLoad %int %v + %99 = OpIMul %int %int_3 %98 + %100 = OpIAdd %int %99 %int_1 + OpStore %v %100 + OpBranch %95 + %97 = OpLabel + %101 = OpLoad %int %v + %102 = OpSDiv %int %101 %int_2 + OpStore %v %102 + OpBranch %95 + %95 = OpLabel + %103 = OpLoad %int %count + %104 = OpIAdd %int %103 %int_1 + OpStore %count %104 + OpBranch %87 + %87 = OpLabel + OpBranch %85 + %86 = OpLabel + %105 = OpLoad %int %count + OpReturnValue %105 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..b305371d3d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.hlsl @@ -0,0 +1,67 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int collatz_i1_(inout int v) { + int count = 0; + count = 0; + while (true) { + const int x_89 = v; + if ((x_89 > 1)) { + } else { + break; + } + const int x_92 = v; + if (((x_92 & 1) == 1)) { + const int x_98 = v; + v = ((3 * x_98) + 1); + } else { + const int x_101 = v; + v = (x_101 / 2); + } + count = (count + 1); + } + return count; +} + +void main_1() { + float2 lin = float2(0.0f, 0.0f); + int v_1 = 0; + int param = 0; + float4 indexable[16] = (float4[16])0; + const float4 x_63 = gl_FragCoord; + const float2 x_66 = asfloat(x_10[0].xy); + lin = (float2(x_63.x, x_63.y) / x_66); + lin = floor((lin * 8.0f)); + const float x_72 = lin.x; + const float x_76 = lin.y; + v_1 = ((int(x_72) * 8) + int(x_76)); + param = v_1; + const int x_80 = collatz_i1_(param); + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_83 = indexable[(x_80 % 16)]; + x_GLF_color = x_83; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.msl new file mode 100644 index 0000000000..94420a4897 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.msl @@ -0,0 +1,73 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int collatz_i1_(thread int* const v) { + int count = 0; + count = 0; + while (true) { + int const x_89 = *(v); + if ((x_89 > 1)) { + } else { + break; + } + int const x_92 = *(v); + if (((x_92 & 1) == 1)) { + int const x_98 = *(v); + *(v) = ((3 * x_98) + 1); + } else { + int const x_101 = *(v); + *(v) = (x_101 / 2); + } + int const x_103 = count; + count = (x_103 + 1); + } + int const x_105 = count; + return x_105; +} + +void main_1(constant buf0& x_10, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float2 lin = 0.0f; + int v_1 = 0; + int param = 0; + tint_array_wrapper indexable = {}; + float4 const x_63 = *(tint_symbol_6); + float2 const x_66 = x_10.resolution; + lin = (float2(x_63.x, x_63.y) / x_66); + float2 const x_68 = lin; + lin = floor((x_68 * 8.0f)); + float const x_72 = lin.x; + float const x_76 = lin.y; + v_1 = ((int(x_72) * 8) + int(x_76)); + int const x_79 = v_1; + param = x_79; + int const x_80 = collatz_i1_(&(param)); + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_83 = indexable.arr[(x_80 % 16)]; + *(tint_symbol_7) = x_83; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_10, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..d892d09edc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.spvasm @@ -0,0 +1,200 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 137 +; Schema: 0 + OpCapability Shader + %83 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %collatz_i1_ "collatz_i1_" + OpName %v "v" + OpName %count "count" + OpName %main_1 "main_1" + OpName %lin "lin" + OpName %v_1 "v_1" + OpName %param "param" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpTypeFunction %int %_ptr_Function_int + %22 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %void = OpTypeVoid + %57 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %63 = OpConstantNull %v2float + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %71 = OpConstantNull %_arr_v4float_uint_16 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %int_8 = OpConstant %int 8 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %102 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %104 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %105 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %106 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %107 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %108 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %109 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %110 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %111 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %112 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %113 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %114 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %115 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %116 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %117 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %118 = OpConstantComposite %_arr_v4float_uint_16 %102 %104 %105 %106 %107 %108 %109 %110 %102 %111 %112 %113 %114 %115 %116 %117 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %124 = OpTypeFunction %void %main_out +%collatz_i1_ = OpFunction %int None %15 + %v = OpFunctionParameter %_ptr_Function_int + %20 = OpLabel + %count = OpVariable %_ptr_Function_int Function %22 + OpStore %count %int_0 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %29 = OpLoad %int %v + %31 = OpSGreaterThan %bool %29 %int_1 + OpSelectionMerge %33 None + OpBranchConditional %31 %34 %35 + %34 = OpLabel + OpBranch %33 + %35 = OpLabel + OpBranch %25 + %33 = OpLabel + %37 = OpLoad %int %v + %38 = OpBitwiseAnd %int %37 %int_1 + %39 = OpIEqual %bool %38 %int_1 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %42 + %41 = OpLabel + %44 = OpLoad %int %v + %47 = OpIMul %int %int_3 %44 + %48 = OpIAdd %int %47 %int_1 + OpStore %v %48 + OpBranch %40 + %42 = OpLabel + %50 = OpLoad %int %v + %53 = OpSDiv %int %50 %int_2 + OpStore %v %53 + OpBranch %40 + %40 = OpLabel + %54 = OpLoad %int %count + %55 = OpIAdd %int %54 %int_1 + OpStore %count %55 + OpBranch %26 + %26 = OpLabel + OpBranch %24 + %25 = OpLabel + %56 = OpLoad %int %count + OpReturnValue %56 + OpFunctionEnd + %main_1 = OpFunction %void None %57 + %60 = OpLabel + %lin = OpVariable %_ptr_Function_v2float Function %63 + %v_1 = OpVariable %_ptr_Function_int Function %22 + %param = OpVariable %_ptr_Function_int Function %22 + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %71 + %72 = OpLoad %v4float %gl_FragCoord + %75 = OpAccessChain %_ptr_Uniform_v2float %x_10 %uint_0 + %76 = OpLoad %v2float %75 + %77 = OpCompositeExtract %float %72 0 + %78 = OpCompositeExtract %float %72 1 + %79 = OpCompositeConstruct %v2float %77 %78 + %80 = OpFDiv %v2float %79 %76 + OpStore %lin %80 + %81 = OpLoad %v2float %lin + %85 = OpVectorTimesScalar %v2float %81 %float_8 + %82 = OpExtInst %v2float %83 Floor %85 + OpStore %lin %82 + %87 = OpAccessChain %_ptr_Function_float %lin %uint_0 + %88 = OpLoad %float %87 + %90 = OpAccessChain %_ptr_Function_float %lin %uint_1 + %91 = OpLoad %float %90 + %92 = OpConvertFToS %int %88 + %94 = OpIMul %int %92 %int_8 + %95 = OpConvertFToS %int %91 + %96 = OpIAdd %int %94 %95 + OpStore %v_1 %96 + %97 = OpLoad %int %v_1 + OpStore %param %97 + %98 = OpFunctionCall %int %collatz_i1_ %param + OpStore %indexable %118 + %120 = OpSMod %int %98 %int_16 + %122 = OpAccessChain %_ptr_Function_v4float %indexable %120 + %123 = OpLoad %v4float %122 + OpStore %x_GLF_color %123 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %124 +%tint_symbol_1 = OpFunctionParameter %main_out + %128 = OpLabel + %129 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %129 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %57 + %131 = OpLabel + %132 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %132 + %133 = OpFunctionCall %void %main_1 + %135 = OpLoad %v4float %x_GLF_color + %136 = OpCompositeConstruct %main_out %135 + %134 = OpFunctionCall %void %tint_symbol_3 %136 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..10f5505748 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.spvasm.expected.wgsl @@ -0,0 +1,68 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn collatz_i1_(v : ptr) -> i32 { + var count : i32; + count = 0; + loop { + let x_89 : i32 = *(v); + if ((x_89 > 1)) { + } else { + break; + } + let x_92 : i32 = *(v); + if (((x_92 & 1) == 1)) { + let x_98 : i32 = *(v); + *(v) = ((3 * x_98) + 1); + } else { + let x_101 : i32 = *(v); + *(v) = (x_101 / 2); + } + let x_103 : i32 = count; + count = (x_103 + 1); + } + let x_105 : i32 = count; + return x_105; +} + +fn main_1() { + var lin : vec2; + var v_1 : i32; + var param : i32; + var indexable : array, 16>; + let x_63 : vec4 = gl_FragCoord; + let x_66 : vec2 = x_10.resolution; + lin = (vec2(x_63.x, x_63.y) / x_66); + let x_68 : vec2 = lin; + lin = floor((x_68 * 8.0)); + let x_72 : f32 = lin.x; + let x_76 : f32 = lin.y; + v_1 = ((i32(x_72) * 8) + i32(x_76)); + let x_79 : i32 = v_1; + param = x_79; + let x_80 : i32 = collatz_i1_(&(param)); + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_83 : vec4 = indexable[(x_80 % 16)]; + x_GLF_color = x_83; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl new file mode 100644 index 0000000000..10f5505748 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl @@ -0,0 +1,68 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn collatz_i1_(v : ptr) -> i32 { + var count : i32; + count = 0; + loop { + let x_89 : i32 = *(v); + if ((x_89 > 1)) { + } else { + break; + } + let x_92 : i32 = *(v); + if (((x_92 & 1) == 1)) { + let x_98 : i32 = *(v); + *(v) = ((3 * x_98) + 1); + } else { + let x_101 : i32 = *(v); + *(v) = (x_101 / 2); + } + let x_103 : i32 = count; + count = (x_103 + 1); + } + let x_105 : i32 = count; + return x_105; +} + +fn main_1() { + var lin : vec2; + var v_1 : i32; + var param : i32; + var indexable : array, 16>; + let x_63 : vec4 = gl_FragCoord; + let x_66 : vec2 = x_10.resolution; + lin = (vec2(x_63.x, x_63.y) / x_66); + let x_68 : vec2 = lin; + lin = floor((x_68 * 8.0)); + let x_72 : f32 = lin.x; + let x_76 : f32 = lin.y; + v_1 = ((i32(x_72) * 8) + i32(x_76)); + let x_79 : i32 = v_1; + param = x_79; + let x_80 : i32 = collatz_i1_(&(param)); + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_83 : vec4 = indexable[(x_80 % 16)]; + x_GLF_color = x_83; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..b305371d3d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.hlsl @@ -0,0 +1,67 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int collatz_i1_(inout int v) { + int count = 0; + count = 0; + while (true) { + const int x_89 = v; + if ((x_89 > 1)) { + } else { + break; + } + const int x_92 = v; + if (((x_92 & 1) == 1)) { + const int x_98 = v; + v = ((3 * x_98) + 1); + } else { + const int x_101 = v; + v = (x_101 / 2); + } + count = (count + 1); + } + return count; +} + +void main_1() { + float2 lin = float2(0.0f, 0.0f); + int v_1 = 0; + int param = 0; + float4 indexable[16] = (float4[16])0; + const float4 x_63 = gl_FragCoord; + const float2 x_66 = asfloat(x_10[0].xy); + lin = (float2(x_63.x, x_63.y) / x_66); + lin = floor((lin * 8.0f)); + const float x_72 = lin.x; + const float x_76 = lin.y; + v_1 = ((int(x_72) * 8) + int(x_76)); + param = v_1; + const int x_80 = collatz_i1_(param); + const float4 tint_symbol_5[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable = tint_symbol_5; + const float4 x_83 = indexable[(x_80 % 16)]; + x_GLF_color = x_83; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.msl new file mode 100644 index 0000000000..94420a4897 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.msl @@ -0,0 +1,73 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int collatz_i1_(thread int* const v) { + int count = 0; + count = 0; + while (true) { + int const x_89 = *(v); + if ((x_89 > 1)) { + } else { + break; + } + int const x_92 = *(v); + if (((x_92 & 1) == 1)) { + int const x_98 = *(v); + *(v) = ((3 * x_98) + 1); + } else { + int const x_101 = *(v); + *(v) = (x_101 / 2); + } + int const x_103 = count; + count = (x_103 + 1); + } + int const x_105 = count; + return x_105; +} + +void main_1(constant buf0& x_10, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float2 lin = 0.0f; + int v_1 = 0; + int param = 0; + tint_array_wrapper indexable = {}; + float4 const x_63 = *(tint_symbol_6); + float2 const x_66 = x_10.resolution; + lin = (float2(x_63.x, x_63.y) / x_66); + float2 const x_68 = lin; + lin = floor((x_68 * 8.0f)); + float const x_72 = lin.x; + float const x_76 = lin.y; + v_1 = ((int(x_72) * 8) + int(x_76)); + int const x_79 = v_1; + param = x_79; + int const x_80 = collatz_i1_(&(param)); + tint_array_wrapper const tint_symbol_4 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable = tint_symbol_4; + float4 const x_83 = indexable.arr[(x_80 % 16)]; + *(tint_symbol_7) = x_83; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_10, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..d892d09edc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.spvasm @@ -0,0 +1,200 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 137 +; Schema: 0 + OpCapability Shader + %83 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %collatz_i1_ "collatz_i1_" + OpName %v "v" + OpName %count "count" + OpName %main_1 "main_1" + OpName %lin "lin" + OpName %v_1 "v_1" + OpName %param "param" + OpName %indexable "indexable" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpTypeFunction %int %_ptr_Function_int + %22 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %void = OpTypeVoid + %57 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float + %63 = OpConstantNull %v2float + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %71 = OpConstantNull %_arr_v4float_uint_16 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_8 = OpConstant %float 8 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %int_8 = OpConstant %int 8 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %102 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %104 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %105 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %106 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %107 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %108 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %109 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %110 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %111 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %112 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %113 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %114 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %115 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %116 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %117 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %118 = OpConstantComposite %_arr_v4float_uint_16 %102 %104 %105 %106 %107 %108 %109 %110 %102 %111 %112 %113 %114 %115 %116 %117 + %int_16 = OpConstant %int 16 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %124 = OpTypeFunction %void %main_out +%collatz_i1_ = OpFunction %int None %15 + %v = OpFunctionParameter %_ptr_Function_int + %20 = OpLabel + %count = OpVariable %_ptr_Function_int Function %22 + OpStore %count %int_0 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %29 = OpLoad %int %v + %31 = OpSGreaterThan %bool %29 %int_1 + OpSelectionMerge %33 None + OpBranchConditional %31 %34 %35 + %34 = OpLabel + OpBranch %33 + %35 = OpLabel + OpBranch %25 + %33 = OpLabel + %37 = OpLoad %int %v + %38 = OpBitwiseAnd %int %37 %int_1 + %39 = OpIEqual %bool %38 %int_1 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %42 + %41 = OpLabel + %44 = OpLoad %int %v + %47 = OpIMul %int %int_3 %44 + %48 = OpIAdd %int %47 %int_1 + OpStore %v %48 + OpBranch %40 + %42 = OpLabel + %50 = OpLoad %int %v + %53 = OpSDiv %int %50 %int_2 + OpStore %v %53 + OpBranch %40 + %40 = OpLabel + %54 = OpLoad %int %count + %55 = OpIAdd %int %54 %int_1 + OpStore %count %55 + OpBranch %26 + %26 = OpLabel + OpBranch %24 + %25 = OpLabel + %56 = OpLoad %int %count + OpReturnValue %56 + OpFunctionEnd + %main_1 = OpFunction %void None %57 + %60 = OpLabel + %lin = OpVariable %_ptr_Function_v2float Function %63 + %v_1 = OpVariable %_ptr_Function_int Function %22 + %param = OpVariable %_ptr_Function_int Function %22 + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %71 + %72 = OpLoad %v4float %gl_FragCoord + %75 = OpAccessChain %_ptr_Uniform_v2float %x_10 %uint_0 + %76 = OpLoad %v2float %75 + %77 = OpCompositeExtract %float %72 0 + %78 = OpCompositeExtract %float %72 1 + %79 = OpCompositeConstruct %v2float %77 %78 + %80 = OpFDiv %v2float %79 %76 + OpStore %lin %80 + %81 = OpLoad %v2float %lin + %85 = OpVectorTimesScalar %v2float %81 %float_8 + %82 = OpExtInst %v2float %83 Floor %85 + OpStore %lin %82 + %87 = OpAccessChain %_ptr_Function_float %lin %uint_0 + %88 = OpLoad %float %87 + %90 = OpAccessChain %_ptr_Function_float %lin %uint_1 + %91 = OpLoad %float %90 + %92 = OpConvertFToS %int %88 + %94 = OpIMul %int %92 %int_8 + %95 = OpConvertFToS %int %91 + %96 = OpIAdd %int %94 %95 + OpStore %v_1 %96 + %97 = OpLoad %int %v_1 + OpStore %param %97 + %98 = OpFunctionCall %int %collatz_i1_ %param + OpStore %indexable %118 + %120 = OpSMod %int %98 %int_16 + %122 = OpAccessChain %_ptr_Function_v4float %indexable %120 + %123 = OpLoad %v4float %122 + OpStore %x_GLF_color %123 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %124 +%tint_symbol_1 = OpFunctionParameter %main_out + %128 = OpLabel + %129 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %129 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %57 + %131 = OpLabel + %132 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %132 + %133 = OpFunctionCall %void %main_1 + %135 = OpLoad %v4float %x_GLF_color + %136 = OpCompositeConstruct %main_out %135 + %134 = OpFunctionCall %void %tint_symbol_3 %136 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..10f5505748 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-collatz-push-constant-with-nested-min-max/0.wgsl.expected.wgsl @@ -0,0 +1,68 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn collatz_i1_(v : ptr) -> i32 { + var count : i32; + count = 0; + loop { + let x_89 : i32 = *(v); + if ((x_89 > 1)) { + } else { + break; + } + let x_92 : i32 = *(v); + if (((x_92 & 1) == 1)) { + let x_98 : i32 = *(v); + *(v) = ((3 * x_98) + 1); + } else { + let x_101 : i32 = *(v); + *(v) = (x_101 / 2); + } + let x_103 : i32 = count; + count = (x_103 + 1); + } + let x_105 : i32 = count; + return x_105; +} + +fn main_1() { + var lin : vec2; + var v_1 : i32; + var param : i32; + var indexable : array, 16>; + let x_63 : vec4 = gl_FragCoord; + let x_66 : vec2 = x_10.resolution; + lin = (vec2(x_63.x, x_63.y) / x_66); + let x_68 : vec2 = lin; + lin = floor((x_68 * 8.0)); + let x_72 : f32 = lin.x; + let x_76 : f32 = lin.y; + v_1 = ((i32(x_72) * 8) + i32(x_76)); + let x_79 : i32 = v_1; + param = x_79; + let x_80 : i32 = collatz_i1_(&(param)); + indexable = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_83 : vec4 = indexable[(x_80 % 16)]; + x_GLF_color = x_83; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm new file mode 100644 index 0000000000..9c84386a54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm @@ -0,0 +1,263 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %_ "" + OpName %c "c" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %__0 "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_n0_5 = OpConstant %float -0.5 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %35 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %46 = OpUndef %float +%float_0_125 = OpConstant %float 0.125 + %main = OpFunction %void None %11 + %48 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function + OpStore %c %35 + %49 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %50 = OpLoad %float %49 + %51 = OpFMul %float %50 %float_0_125 + %52 = OpExtInst %float %1 Round %51 + %53 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %54 = OpLoad %float %53 + OpSelectionMerge %55 None + OpSwitch %uint_0 %56 + %56 = OpLabel + OpBranch %57 + %57 = OpLabel + %58 = OpPhi %float %float_n0_5 %56 %59 %60 + %61 = OpPhi %int %int_1 %56 %62 %60 + %63 = OpSLessThan %bool %61 %int_800 + OpLoopMerge %64 %60 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + %66 = OpSMod %int %61 %int_32 + %67 = OpIEqual %bool %66 %int_0 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + %71 = OpFAdd %float %58 %float_0_400000006 + OpBranch %68 + %70 = OpLabel + %72 = OpConvertSToF %float %61 + %73 = OpExtInst %float %1 Round %52 + %74 = OpFMod %float %72 %73 + %75 = OpFOrdLessThanEqual %bool %74 %float_0_00999999978 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %76 + %77 = OpLabel + %78 = OpFAdd %float %58 %float_100 + OpBranch %76 + %76 = OpLabel + %79 = OpPhi %float %58 %70 %78 %77 + %80 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %83 = OpLoad %float %82 + %84 = OpFOrdGreaterThan %bool %81 %83 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + OpKill + %85 = OpLabel + OpBranch %68 + %68 = OpLabel + %59 = OpPhi %float %71 %69 %79 %85 + %87 = OpConvertSToF %float %61 + %88 = OpFOrdGreaterThanEqual %bool %87 %54 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + OpBranch %64 + %89 = OpLabel + OpBranch %60 + %60 = OpLabel + %62 = OpIAdd %int %61 %int_1 + OpBranch %57 + %64 = OpLabel + %91 = OpPhi %float %46 %57 %59 %90 + %92 = OpPhi %float %58 %57 %59 %90 + %93 = OpPhi %bool %false %57 %true %90 + OpSelectionMerge %94 None + OpBranchConditional %93 %55 %94 + %94 = OpLabel + OpBranch %55 + %55 = OpLabel + %95 = OpPhi %float %91 %64 %92 %94 + %96 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %96 %95 + %97 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %98 = OpLoad %float %97 + OpSelectionMerge %99 None + OpSwitch %uint_0 %100 + %100 = OpLabel + OpBranch %101 + %101 = OpLabel + %102 = OpPhi %float %float_n0_5 %100 %103 %104 + %105 = OpPhi %int %int_1 %100 %106 %104 + %107 = OpSLessThan %bool %105 %int_800 + OpLoopMerge %108 %104 None + OpBranchConditional %107 %109 %108 + %109 = OpLabel + %110 = OpSMod %int %105 %int_32 + %111 = OpIEqual %bool %110 %int_0 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %114 + %113 = OpLabel + %115 = OpFAdd %float %102 %float_0_400000006 + OpBranch %112 + %114 = OpLabel + %116 = OpConvertSToF %float %105 + %117 = OpExtInst %float %1 Round %52 + %118 = OpFMod %float %116 %117 + %119 = OpFOrdLessThanEqual %bool %118 %float_0_00999999978 + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %120 + %121 = OpLabel + %122 = OpFAdd %float %102 %float_100 + OpBranch %120 + %120 = OpLabel + %123 = OpPhi %float %102 %114 %122 %121 + %124 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %125 = OpLoad %float %124 + %126 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %127 = OpLoad %float %126 + %128 = OpFOrdGreaterThan %bool %125 %127 + OpSelectionMerge %129 None + OpBranchConditional %128 %130 %129 + %130 = OpLabel + OpKill + %129 = OpLabel + OpBranch %112 + %112 = OpLabel + %103 = OpPhi %float %115 %113 %123 %129 + %131 = OpConvertSToF %float %105 + %132 = OpFOrdGreaterThanEqual %bool %131 %98 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %133 + %134 = OpLabel + OpBranch %108 + %133 = OpLabel + OpBranch %104 + %104 = OpLabel + %106 = OpIAdd %int %105 %int_1 + OpBranch %101 + %108 = OpLabel + %135 = OpPhi %float %46 %101 %103 %134 + %136 = OpPhi %float %102 %101 %103 %134 + %137 = OpPhi %bool %false %101 %true %134 + OpSelectionMerge %138 None + OpBranchConditional %137 %99 %138 + %138 = OpLabel + OpBranch %99 + %99 = OpLabel + %139 = OpPhi %float %135 %108 %136 %138 + %140 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %140 %139 + %141 = OpLoad %float %96 + %142 = OpLoad %float %140 + %143 = OpFAdd %float %141 %142 + %144 = OpAccessChain %_ptr_Function_float %c %uint_2 + OpStore %144 %143 + OpBranch %145 + %145 = OpLabel + %146 = OpPhi %int %int_0 %99 %147 %148 + %149 = OpSLessThan %bool %146 %int_3 + OpLoopMerge %150 %148 None + OpBranchConditional %149 %151 %150 + %151 = OpLabel + %152 = OpAccessChain %_ptr_Function_float %c %146 + %153 = OpLoad %float %152 + %154 = OpFOrdGreaterThanEqual %bool %153 %float_1 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %155 + %156 = OpLabel + %157 = OpLoad %float %152 + %158 = OpLoad %float %152 + %159 = OpFMul %float %157 %158 + OpStore %152 %159 + %160 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %161 = OpLoad %float %160 + %162 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %163 = OpLoad %float %162 + %164 = OpFOrdGreaterThan %bool %161 %163 + OpSelectionMerge %165 None + OpBranchConditional %164 %166 %165 + %166 = OpLabel + OpKill + %165 = OpLabel + OpBranch %155 + %155 = OpLabel + OpBranch %148 + %148 = OpLabel + %147 = OpIAdd %int %146 %int_1 + OpBranch %145 + %150 = OpLabel + %167 = OpLoad %v3float %c + %168 = OpExtInst %v3float %1 FAbs %167 + %169 = OpExtInst %v3float %1 Normalize %168 + %170 = OpCompositeExtract %float %169 0 + %171 = OpCompositeExtract %float %169 1 + %172 = OpCompositeExtract %float %169 2 + %173 = OpCompositeConstruct %v4float %170 %171 %172 %float_1 + OpStore %_GLF_color %173 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..1b409b0e37 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.hlsl @@ -0,0 +1,220 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float x_54 = 0.0f; + float x_58 = 0.0f; + float x_59 = 0.0f; + float x_91 = 0.0f; + float x_92 = 0.0f; + float x_135 = 0.0f; + float x_136 = 0.0f; + float x_58_phi = 0.0f; + int x_61_phi = 0; + float x_91_phi = 0.0f; + float x_92_phi = 0.0f; + bool x_93_phi = false; + float x_95_phi = 0.0f; + float x_139_phi = 0.0f; + int x_146_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_50 = asfloat(x_9[0].x); + const float x_52 = round((x_50 * 0.125f)); + x_54 = gl_FragCoord.x; + switch(0u) { + default: { + x_58_phi = -0.5f; + x_61_phi = 1; + while (true) { + float x_71 = 0.0f; + float x_79 = 0.0f; + int x_62 = 0; + float x_59_phi = 0.0f; + x_58 = x_58_phi; + const int x_61 = x_61_phi; + x_91_phi = 0.0f; + x_92_phi = x_58; + x_93_phi = false; + if ((x_61 < 800)) { + } else { + break; + } + float x_78 = 0.0f; + float x_79_phi = 0.0f; + if (((x_61 % 32) == 0)) { + x_71 = (x_58 + 0.400000006f); + x_59_phi = x_71; + } else { + x_79_phi = x_58; + if (((float(x_61) % round(x_52)) <= 0.01f)) { + x_78 = (x_58 + 100.0f); + x_79_phi = x_78; + } + x_79 = x_79_phi; + const float x_81 = asfloat(x_6[0].x); + const float x_83 = asfloat(x_6[0].y); + if ((x_81 > x_83)) { + discard; + } + x_59_phi = x_79; + } + x_59 = x_59_phi; + if ((float(x_61) >= x_54)) { + x_91_phi = x_59; + x_92_phi = x_59; + x_93_phi = true; + break; + } + { + x_62 = (x_61 + 1); + x_58_phi = x_59; + x_61_phi = x_62; + } + } + x_91 = x_91_phi; + x_92 = x_92_phi; + const bool x_93 = x_93_phi; + x_95_phi = x_91; + if (x_93) { + break; + } + x_95_phi = x_92; + break; + } + } + float x_98 = 0.0f; + float x_102 = 0.0f; + float x_103 = 0.0f; + float x_102_phi = 0.0f; + int x_105_phi = 0; + float x_135_phi = 0.0f; + float x_136_phi = 0.0f; + bool x_137_phi = false; + const float x_95 = x_95_phi; + c.x = x_95; + x_98 = gl_FragCoord.y; + switch(0u) { + default: { + x_102_phi = -0.5f; + x_105_phi = 1; + while (true) { + float x_115 = 0.0f; + float x_123 = 0.0f; + int x_106 = 0; + float x_103_phi = 0.0f; + x_102 = x_102_phi; + const int x_105 = x_105_phi; + x_135_phi = 0.0f; + x_136_phi = x_102; + x_137_phi = false; + if ((x_105 < 800)) { + } else { + break; + } + float x_122 = 0.0f; + float x_123_phi = 0.0f; + if (((x_105 % 32) == 0)) { + x_115 = (x_102 + 0.400000006f); + x_103_phi = x_115; + } else { + x_123_phi = x_102; + if (((float(x_105) % round(x_52)) <= 0.01f)) { + x_122 = (x_102 + 100.0f); + x_123_phi = x_122; + } + x_123 = x_123_phi; + const float x_125 = asfloat(x_6[0].x); + const float x_127 = asfloat(x_6[0].y); + if ((x_125 > x_127)) { + discard; + } + x_103_phi = x_123; + } + x_103 = x_103_phi; + if ((float(x_105) >= x_98)) { + x_135_phi = x_103; + x_136_phi = x_103; + x_137_phi = true; + break; + } + { + x_106 = (x_105 + 1); + x_102_phi = x_103; + x_105_phi = x_106; + } + } + x_135 = x_135_phi; + x_136 = x_136_phi; + const bool x_137 = x_137_phi; + x_139_phi = x_135; + if (x_137) { + break; + } + x_139_phi = x_136; + break; + } + } + const float x_139 = x_139_phi; + c.y = x_139; + const float x_141 = c.x; + const float x_142 = c.y; + c.z = (x_141 + x_142); + x_146_phi = 0; + while (true) { + int x_147 = 0; + const int x_146 = x_146_phi; + if ((x_146 < 3)) { + } else { + break; + } + const int x_152_save = x_146; + const float x_153 = c[x_152_save]; + if ((x_153 >= 1.0f)) { + const float x_157 = c[x_152_save]; + const float x_158 = c[x_152_save]; + set_float3(c, x_152_save, (x_157 * x_158)); + const float x_161 = asfloat(x_6[0].x); + const float x_163 = asfloat(x_6[0].y); + if ((x_161 > x_163)) { + discard; + } + } + { + x_147 = (x_146 + 1); + x_146_phi = x_147; + } + } + const float3 x_169 = normalize(abs(c)); + x_GLF_color = float4(x_169.x, x_169.y, x_169.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.msl new file mode 100755 index 0000000000..81d5bd8573 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.msl @@ -0,0 +1,226 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_9, constant buf1& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float x_54 = 0.0f; + float x_58 = 0.0f; + float x_59 = 0.0f; + float x_91 = 0.0f; + float x_92 = 0.0f; + float x_135 = 0.0f; + float x_136 = 0.0f; + float x_58_phi = 0.0f; + int x_61_phi = 0; + float x_91_phi = 0.0f; + float x_92_phi = 0.0f; + bool x_93_phi = false; + float x_95_phi = 0.0f; + float x_139_phi = 0.0f; + int x_146_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_50 = x_9.resolution.x; + float const x_52 = rint((x_50 * 0.125f)); + x_54 = (*(tint_symbol_5)).x; + switch(0u) { + default: { + x_58_phi = -0.5f; + x_61_phi = 1; + while (true) { + float x_71 = 0.0f; + float x_79 = 0.0f; + int x_62 = 0; + float x_59_phi = 0.0f; + x_58 = x_58_phi; + int const x_61 = x_61_phi; + x_91_phi = 0.0f; + x_92_phi = x_58; + x_93_phi = false; + if ((x_61 < 800)) { + } else { + break; + } + float x_78 = 0.0f; + float x_79_phi = 0.0f; + if (((x_61 % 32) == 0)) { + x_71 = (x_58 + 0.400000006f); + x_59_phi = x_71; + } else { + x_79_phi = x_58; + if (((float(x_61) % rint(x_52)) <= 0.01f)) { + x_78 = (x_58 + 100.0f); + x_79_phi = x_78; + } + x_79 = x_79_phi; + float const x_81 = x_6.injectionSwitch.x; + float const x_83 = x_6.injectionSwitch.y; + if ((x_81 > x_83)) { + discard_fragment(); + } + x_59_phi = x_79; + } + x_59 = x_59_phi; + if ((float(x_61) >= x_54)) { + x_91_phi = x_59; + x_92_phi = x_59; + x_93_phi = true; + break; + } + { + x_62 = (x_61 + 1); + x_58_phi = x_59; + x_61_phi = x_62; + } + } + x_91 = x_91_phi; + x_92 = x_92_phi; + bool const x_93 = x_93_phi; + x_95_phi = x_91; + if (x_93) { + break; + } + x_95_phi = x_92; + break; + } + } + float x_98 = 0.0f; + float x_102 = 0.0f; + float x_103 = 0.0f; + float x_102_phi = 0.0f; + int x_105_phi = 0; + float x_135_phi = 0.0f; + float x_136_phi = 0.0f; + bool x_137_phi = false; + float const x_95 = x_95_phi; + c.x = x_95; + x_98 = (*(tint_symbol_5)).y; + switch(0u) { + default: { + x_102_phi = -0.5f; + x_105_phi = 1; + while (true) { + float x_115 = 0.0f; + float x_123 = 0.0f; + int x_106 = 0; + float x_103_phi = 0.0f; + x_102 = x_102_phi; + int const x_105 = x_105_phi; + x_135_phi = 0.0f; + x_136_phi = x_102; + x_137_phi = false; + if ((x_105 < 800)) { + } else { + break; + } + float x_122 = 0.0f; + float x_123_phi = 0.0f; + if (((x_105 % 32) == 0)) { + x_115 = (x_102 + 0.400000006f); + x_103_phi = x_115; + } else { + x_123_phi = x_102; + if (((float(x_105) % rint(x_52)) <= 0.01f)) { + x_122 = (x_102 + 100.0f); + x_123_phi = x_122; + } + x_123 = x_123_phi; + float const x_125 = x_6.injectionSwitch.x; + float const x_127 = x_6.injectionSwitch.y; + if ((x_125 > x_127)) { + discard_fragment(); + } + x_103_phi = x_123; + } + x_103 = x_103_phi; + if ((float(x_105) >= x_98)) { + x_135_phi = x_103; + x_136_phi = x_103; + x_137_phi = true; + break; + } + { + x_106 = (x_105 + 1); + x_102_phi = x_103; + x_105_phi = x_106; + } + } + x_135 = x_135_phi; + x_136 = x_136_phi; + bool const x_137 = x_137_phi; + x_139_phi = x_135; + if (x_137) { + break; + } + x_139_phi = x_136; + break; + } + } + float const x_139 = x_139_phi; + c.y = x_139; + float const x_141 = c.x; + float const x_142 = c.y; + c.z = (x_141 + x_142); + x_146_phi = 0; + while (true) { + int x_147 = 0; + int const x_146 = x_146_phi; + if ((x_146 < 3)) { + } else { + break; + } + int const x_152_save = x_146; + float const x_153 = c[x_152_save]; + if ((x_153 >= 1.0f)) { + float const x_157 = c[x_152_save]; + float const x_158 = c[x_152_save]; + c[x_152_save] = (x_157 * x_158); + float const x_161 = x_6.injectionSwitch.x; + float const x_163 = x_6.injectionSwitch.y; + if ((x_161 > x_163)) { + discard_fragment(); + } + } + { + x_147 = (x_146 + 1); + x_146_phi = x_147; + } + } + float3 const x_167 = c; + float3 const x_169 = normalize(fabs(x_167)); + *(tint_symbol_6) = float4(x_169.x, x_169.y, x_169.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_9 [[buffer(0)]], constant buf1& x_6 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_9, x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\u4dc.0.metal:63:29: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_61) % rint(x_52)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~ +T:\tmp\u4dc.0.metal:135:30: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_105) % rint(x_52)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~ +2 errors generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..585bfcd4b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.spvasm @@ -0,0 +1,490 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 278 +; Schema: 0 + OpCapability Shader + %59 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_9 "x_9" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %c "c" + OpName %x_54 "x_54" + OpName %x_58 "x_58" + OpName %x_59 "x_59" + OpName %x_91 "x_91" + OpName %x_92 "x_92" + OpName %x_135 "x_135" + OpName %x_136 "x_136" + OpName %x_58_phi "x_58_phi" + OpName %x_61_phi "x_61_phi" + OpName %x_91_phi "x_91_phi" + OpName %x_92_phi "x_92_phi" + OpName %x_93_phi "x_93_phi" + OpName %x_95_phi "x_95_phi" + OpName %x_139_phi "x_139_phi" + OpName %x_146_phi "x_146_phi" + OpName %x_71 "x_71" + OpName %x_79 "x_79" + OpName %x_62 "x_62" + OpName %x_59_phi "x_59_phi" + OpName %x_78 "x_78" + OpName %x_79_phi "x_79_phi" + OpName %x_98 "x_98" + OpName %x_102 "x_102" + OpName %x_103 "x_103" + OpName %x_102_phi "x_102_phi" + OpName %x_105_phi "x_105_phi" + OpName %x_135_phi "x_135_phi" + OpName %x_136_phi "x_136_phi" + OpName %x_137_phi "x_137_phi" + OpName %x_115 "x_115" + OpName %x_123 "x_123" + OpName %x_106 "x_106" + OpName %x_103_phi "x_103_phi" + OpName %x_122 "x_122" + OpName %x_123_phi "x_123_phi" + OpName %x_147 "x_147" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %25 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %39 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %45 = OpConstantNull %bool + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %52 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0_125 = OpConstant %float 0.125 +%_ptr_Private_float = OpTypePointer Private %float + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %int_800 = OpConstant %int 800 + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %uint_1 = OpConstant %uint 1 + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %265 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %25 + %x_54 = OpVariable %_ptr_Function_float Function %28 + %x_58 = OpVariable %_ptr_Function_float Function %28 + %x_59 = OpVariable %_ptr_Function_float Function %28 + %x_91 = OpVariable %_ptr_Function_float Function %28 + %x_92 = OpVariable %_ptr_Function_float Function %28 + %x_135 = OpVariable %_ptr_Function_float Function %28 + %x_136 = OpVariable %_ptr_Function_float Function %28 + %x_58_phi = OpVariable %_ptr_Function_float Function %28 + %x_61_phi = OpVariable %_ptr_Function_int Function %39 + %x_91_phi = OpVariable %_ptr_Function_float Function %28 + %x_92_phi = OpVariable %_ptr_Function_float Function %28 + %x_93_phi = OpVariable %_ptr_Function_bool Function %45 + %x_95_phi = OpVariable %_ptr_Function_float Function %28 + %x_139_phi = OpVariable %_ptr_Function_float Function %28 + %x_146_phi = OpVariable %_ptr_Function_int Function %39 + %x_71 = OpVariable %_ptr_Function_float Function %28 + %x_79 = OpVariable %_ptr_Function_float Function %28 + %x_62 = OpVariable %_ptr_Function_int Function %39 + %x_59_phi = OpVariable %_ptr_Function_float Function %28 + %x_78 = OpVariable %_ptr_Function_float Function %28 + %x_79_phi = OpVariable %_ptr_Function_float Function %28 + %x_98 = OpVariable %_ptr_Function_float Function %28 + %x_102 = OpVariable %_ptr_Function_float Function %28 + %x_103 = OpVariable %_ptr_Function_float Function %28 + %x_102_phi = OpVariable %_ptr_Function_float Function %28 + %x_105_phi = OpVariable %_ptr_Function_int Function %39 + %x_135_phi = OpVariable %_ptr_Function_float Function %28 + %x_136_phi = OpVariable %_ptr_Function_float Function %28 + %x_137_phi = OpVariable %_ptr_Function_bool Function %45 + %x_115 = OpVariable %_ptr_Function_float Function %28 + %x_123 = OpVariable %_ptr_Function_float Function %28 + %x_106 = OpVariable %_ptr_Function_int Function %39 + %x_103_phi = OpVariable %_ptr_Function_float Function %28 + %x_122 = OpVariable %_ptr_Function_float Function %28 + %x_123_phi = OpVariable %_ptr_Function_float Function %28 + %x_147 = OpVariable %_ptr_Function_int Function %39 + OpStore %c %52 + %56 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %57 = OpLoad %float %56 + %61 = OpFMul %float %57 %float_0_125 + %58 = OpExtInst %float %59 RoundEven %61 + %63 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %64 = OpLoad %float %63 + OpStore %x_54 %64 + OpSelectionMerge %65 None + OpSwitch %uint_0 %66 + %66 = OpLabel + OpStore %x_58_phi %float_n0_5 + OpStore %x_61_phi %int_1 + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %77 = OpLoad %float %x_58_phi + OpStore %x_58 %77 + %78 = OpLoad %int %x_61_phi + OpStore %x_91_phi %float_0 + %80 = OpLoad %float %x_58 + OpStore %x_92_phi %80 + OpStore %x_93_phi %false + %83 = OpSLessThan %bool %78 %int_800 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + OpBranch %84 + %86 = OpLabel + OpBranch %70 + %84 = OpLabel + %90 = OpSMod %int %78 %int_32 + %92 = OpIEqual %bool %90 %int_0 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + %96 = OpLoad %float %x_58 + %98 = OpFAdd %float %96 %float_0_400000006 + OpStore %x_71 %98 + %99 = OpLoad %float %x_71 + OpStore %x_59_phi %99 + OpBranch %93 + %95 = OpLabel + %100 = OpLoad %float %x_58 + OpStore %x_79_phi %100 + %101 = OpConvertSToF %float %78 + %102 = OpExtInst %float %59 RoundEven %58 + %103 = OpFMod %float %101 %102 + %105 = OpFOrdLessThanEqual %bool %103 %float_0_00999999978 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + %108 = OpLoad %float %x_58 + %110 = OpFAdd %float %108 %float_100 + OpStore %x_78 %110 + %111 = OpLoad %float %x_78 + OpStore %x_79_phi %111 + OpBranch %106 + %106 = OpLabel + %112 = OpLoad %float %x_79_phi + OpStore %x_79 %112 + %113 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %114 = OpLoad %float %113 + %116 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %117 = OpLoad %float %116 + %118 = OpFOrdGreaterThan %bool %114 %117 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %119 + %120 = OpLabel + OpKill + %119 = OpLabel + %121 = OpLoad %float %x_79 + OpStore %x_59_phi %121 + OpBranch %93 + %93 = OpLabel + %122 = OpLoad %float %x_59_phi + OpStore %x_59 %122 + %123 = OpConvertSToF %float %78 + %124 = OpLoad %float %x_54 + %125 = OpFOrdGreaterThanEqual %bool %123 %124 + OpSelectionMerge %126 None + OpBranchConditional %125 %127 %126 + %127 = OpLabel + %128 = OpLoad %float %x_59 + OpStore %x_91_phi %128 + %129 = OpLoad %float %x_59 + OpStore %x_92_phi %129 + OpStore %x_93_phi %true + OpBranch %70 + %126 = OpLabel + OpBranch %71 + %71 = OpLabel + %131 = OpIAdd %int %78 %int_1 + OpStore %x_62 %131 + %132 = OpLoad %float %x_59 + OpStore %x_58_phi %132 + %133 = OpLoad %int %x_62 + OpStore %x_61_phi %133 + OpBranch %69 + %70 = OpLabel + %134 = OpLoad %float %x_91_phi + OpStore %x_91 %134 + %135 = OpLoad %float %x_92_phi + OpStore %x_92 %135 + %136 = OpLoad %bool %x_93_phi + %137 = OpLoad %float %x_91 + OpStore %x_95_phi %137 + OpSelectionMerge %138 None + OpBranchConditional %136 %139 %138 + %139 = OpLabel + OpBranch %65 + %138 = OpLabel + %140 = OpLoad %float %x_92 + OpStore %x_95_phi %140 + OpBranch %65 + %65 = OpLabel + %149 = OpLoad %float %x_95_phi + %150 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %150 %149 + %151 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %152 = OpLoad %float %151 + OpStore %x_98 %152 + OpSelectionMerge %153 None + OpSwitch %uint_0 %154 + %154 = OpLabel + OpStore %x_102_phi %float_n0_5 + OpStore %x_105_phi %int_1 + OpBranch %155 + %155 = OpLabel + OpLoopMerge %156 %157 None + OpBranch %158 + %158 = OpLabel + %163 = OpLoad %float %x_102_phi + OpStore %x_102 %163 + %164 = OpLoad %int %x_105_phi + OpStore %x_135_phi %float_0 + %165 = OpLoad %float %x_102 + OpStore %x_136_phi %165 + OpStore %x_137_phi %false + %166 = OpSLessThan %bool %164 %int_800 + OpSelectionMerge %167 None + OpBranchConditional %166 %168 %169 + %168 = OpLabel + OpBranch %167 + %169 = OpLabel + OpBranch %156 + %167 = OpLabel + %172 = OpSMod %int %164 %int_32 + %173 = OpIEqual %bool %172 %int_0 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %176 + %175 = OpLabel + %177 = OpLoad %float %x_102 + %178 = OpFAdd %float %177 %float_0_400000006 + OpStore %x_115 %178 + %179 = OpLoad %float %x_115 + OpStore %x_103_phi %179 + OpBranch %174 + %176 = OpLabel + %180 = OpLoad %float %x_102 + OpStore %x_123_phi %180 + %181 = OpConvertSToF %float %164 + %182 = OpExtInst %float %59 RoundEven %58 + %183 = OpFMod %float %181 %182 + %184 = OpFOrdLessThanEqual %bool %183 %float_0_00999999978 + OpSelectionMerge %185 None + OpBranchConditional %184 %186 %185 + %186 = OpLabel + %187 = OpLoad %float %x_102 + %188 = OpFAdd %float %187 %float_100 + OpStore %x_122 %188 + %189 = OpLoad %float %x_122 + OpStore %x_123_phi %189 + OpBranch %185 + %185 = OpLabel + %190 = OpLoad %float %x_123_phi + OpStore %x_123 %190 + %191 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %192 = OpLoad %float %191 + %193 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %194 = OpLoad %float %193 + %195 = OpFOrdGreaterThan %bool %192 %194 + OpSelectionMerge %196 None + OpBranchConditional %195 %197 %196 + %197 = OpLabel + OpKill + %196 = OpLabel + %198 = OpLoad %float %x_123 + OpStore %x_103_phi %198 + OpBranch %174 + %174 = OpLabel + %199 = OpLoad %float %x_103_phi + OpStore %x_103 %199 + %200 = OpConvertSToF %float %164 + %201 = OpLoad %float %x_98 + %202 = OpFOrdGreaterThanEqual %bool %200 %201 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %203 + %204 = OpLabel + %205 = OpLoad %float %x_103 + OpStore %x_135_phi %205 + %206 = OpLoad %float %x_103 + OpStore %x_136_phi %206 + OpStore %x_137_phi %true + OpBranch %156 + %203 = OpLabel + OpBranch %157 + %157 = OpLabel + %207 = OpIAdd %int %164 %int_1 + OpStore %x_106 %207 + %208 = OpLoad %float %x_103 + OpStore %x_102_phi %208 + %209 = OpLoad %int %x_106 + OpStore %x_105_phi %209 + OpBranch %155 + %156 = OpLabel + %210 = OpLoad %float %x_135_phi + OpStore %x_135 %210 + %211 = OpLoad %float %x_136_phi + OpStore %x_136 %211 + %212 = OpLoad %bool %x_137_phi + %213 = OpLoad %float %x_135 + OpStore %x_139_phi %213 + OpSelectionMerge %214 None + OpBranchConditional %212 %215 %214 + %215 = OpLabel + OpBranch %153 + %214 = OpLabel + %216 = OpLoad %float %x_136 + OpStore %x_139_phi %216 + OpBranch %153 + %153 = OpLabel + %217 = OpLoad %float %x_139_phi + %218 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %218 %217 + %219 = OpAccessChain %_ptr_Function_float %c %uint_0 + %220 = OpLoad %float %219 + %221 = OpAccessChain %_ptr_Function_float %c %uint_1 + %222 = OpLoad %float %221 + %224 = OpAccessChain %_ptr_Function_float %c %uint_2 + %225 = OpFAdd %float %220 %222 + OpStore %224 %225 + OpStore %x_146_phi %int_0 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %227 %228 None + OpBranch %229 + %229 = OpLabel + %231 = OpLoad %int %x_146_phi + %233 = OpSLessThan %bool %231 %int_3 + OpSelectionMerge %234 None + OpBranchConditional %233 %235 %236 + %235 = OpLabel + OpBranch %234 + %236 = OpLabel + OpBranch %227 + %234 = OpLabel + %237 = OpAccessChain %_ptr_Function_float %c %231 + %238 = OpLoad %float %237 + %240 = OpFOrdGreaterThanEqual %bool %238 %float_1 + OpSelectionMerge %241 None + OpBranchConditional %240 %242 %241 + %242 = OpLabel + %243 = OpAccessChain %_ptr_Function_float %c %231 + %244 = OpLoad %float %243 + %245 = OpAccessChain %_ptr_Function_float %c %231 + %246 = OpLoad %float %245 + %247 = OpAccessChain %_ptr_Function_float %c %231 + %248 = OpFMul %float %244 %246 + OpStore %247 %248 + %249 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %250 = OpLoad %float %249 + %251 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %252 = OpLoad %float %251 + %253 = OpFOrdGreaterThan %bool %250 %252 + OpSelectionMerge %254 None + OpBranchConditional %253 %255 %254 + %255 = OpLabel + OpKill + %254 = OpLabel + OpBranch %241 + %241 = OpLabel + OpBranch %228 + %228 = OpLabel + %256 = OpIAdd %int %231 %int_1 + OpStore %x_147 %256 + %257 = OpLoad %int %x_147 + OpStore %x_146_phi %257 + OpBranch %226 + %227 = OpLabel + %258 = OpLoad %v3float %c + %260 = OpExtInst %v3float %59 FAbs %258 + %259 = OpExtInst %v3float %59 Normalize %260 + %261 = OpCompositeExtract %float %259 0 + %262 = OpCompositeExtract %float %259 1 + %263 = OpCompositeExtract %float %259 2 + %264 = OpCompositeConstruct %v4float %261 %262 %263 %float_1 + OpStore %x_GLF_color %264 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %265 +%tint_symbol_1 = OpFunctionParameter %main_out + %269 = OpLabel + %270 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %270 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %272 = OpLabel + %273 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %273 + %274 = OpFunctionCall %void %main_1 + %276 = OpLoad %v4float %x_GLF_color + %277 = OpCompositeConstruct %main_out %276 + %275 = OpFunctionCall %void %tint_symbol_3 %277 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..5688188242 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.spvasm.expected.wgsl @@ -0,0 +1,222 @@ +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec3; + var x_54 : f32; + var x_58 : f32; + var x_59 : f32; + var x_91 : f32; + var x_92 : f32; + var x_135 : f32; + var x_136 : f32; + var x_58_phi : f32; + var x_61_phi : i32; + var x_91_phi : f32; + var x_92_phi : f32; + var x_93_phi : bool; + var x_95_phi : f32; + var x_139_phi : f32; + var x_146_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_50 : f32 = x_9.resolution.x; + let x_52 : f32 = round((x_50 * 0.125)); + x_54 = gl_FragCoord.x; + switch(0u) { + default: { + x_58_phi = -0.5; + x_61_phi = 1; + loop { + var x_71 : f32; + var x_79 : f32; + var x_62 : i32; + var x_59_phi : f32; + x_58 = x_58_phi; + let x_61 : i32 = x_61_phi; + x_91_phi = 0.0; + x_92_phi = x_58; + x_93_phi = false; + if ((x_61 < 800)) { + } else { + break; + } + var x_78 : f32; + var x_79_phi : f32; + if (((x_61 % 32) == 0)) { + x_71 = (x_58 + 0.400000006); + x_59_phi = x_71; + } else { + x_79_phi = x_58; + if (((f32(x_61) % round(x_52)) <= 0.01)) { + x_78 = (x_58 + 100.0); + x_79_phi = x_78; + } + x_79 = x_79_phi; + let x_81 : f32 = x_6.injectionSwitch.x; + let x_83 : f32 = x_6.injectionSwitch.y; + if ((x_81 > x_83)) { + discard; + } + x_59_phi = x_79; + } + x_59 = x_59_phi; + if ((f32(x_61) >= x_54)) { + x_91_phi = x_59; + x_92_phi = x_59; + x_93_phi = true; + break; + } + + continuing { + x_62 = (x_61 + 1); + x_58_phi = x_59; + x_61_phi = x_62; + } + } + x_91 = x_91_phi; + x_92 = x_92_phi; + let x_93 : bool = x_93_phi; + x_95_phi = x_91; + if (x_93) { + break; + } + x_95_phi = x_92; + } + } + var x_98 : f32; + var x_102 : f32; + var x_103 : f32; + var x_102_phi : f32; + var x_105_phi : i32; + var x_135_phi : f32; + var x_136_phi : f32; + var x_137_phi : bool; + let x_95 : f32 = x_95_phi; + let x_96 : ptr = &(c.x); + *(x_96) = x_95; + x_98 = gl_FragCoord.y; + switch(0u) { + default: { + x_102_phi = -0.5; + x_105_phi = 1; + loop { + var x_115 : f32; + var x_123 : f32; + var x_106 : i32; + var x_103_phi : f32; + x_102 = x_102_phi; + let x_105 : i32 = x_105_phi; + x_135_phi = 0.0; + x_136_phi = x_102; + x_137_phi = false; + if ((x_105 < 800)) { + } else { + break; + } + var x_122 : f32; + var x_123_phi : f32; + if (((x_105 % 32) == 0)) { + x_115 = (x_102 + 0.400000006); + x_103_phi = x_115; + } else { + x_123_phi = x_102; + if (((f32(x_105) % round(x_52)) <= 0.01)) { + x_122 = (x_102 + 100.0); + x_123_phi = x_122; + } + x_123 = x_123_phi; + let x_125 : f32 = x_6.injectionSwitch.x; + let x_127 : f32 = x_6.injectionSwitch.y; + if ((x_125 > x_127)) { + discard; + } + x_103_phi = x_123; + } + x_103 = x_103_phi; + if ((f32(x_105) >= x_98)) { + x_135_phi = x_103; + x_136_phi = x_103; + x_137_phi = true; + break; + } + + continuing { + x_106 = (x_105 + 1); + x_102_phi = x_103; + x_105_phi = x_106; + } + } + x_135 = x_135_phi; + x_136 = x_136_phi; + let x_137 : bool = x_137_phi; + x_139_phi = x_135; + if (x_137) { + break; + } + x_139_phi = x_136; + } + } + let x_139 : f32 = x_139_phi; + let x_140 : ptr = &(c.y); + *(x_140) = x_139; + let x_141 : f32 = *(x_96); + let x_142 : f32 = *(x_140); + c.z = (x_141 + x_142); + x_146_phi = 0; + loop { + var x_147 : i32; + let x_146 : i32 = x_146_phi; + if ((x_146 < 3)) { + } else { + break; + } + let x_152 : ptr = &(c[x_146]); + let x_153 : f32 = *(x_152); + if ((x_153 >= 1.0)) { + let x_157 : f32 = *(x_152); + let x_158 : f32 = *(x_152); + *(x_152) = (x_157 * x_158); + let x_161 : f32 = x_6.injectionSwitch.x; + let x_163 : f32 = x_6.injectionSwitch.y; + if ((x_161 > x_163)) { + discard; + } + } + + continuing { + x_147 = (x_146 + 1); + x_146_phi = x_147; + } + } + let x_167 : vec3 = c; + let x_169 : vec3 = normalize(abs(x_167)); + x_GLF_color = vec4(x_169.x, x_169.y, x_169.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl new file mode 100644 index 0000000000..5688188242 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl @@ -0,0 +1,222 @@ +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec3; + var x_54 : f32; + var x_58 : f32; + var x_59 : f32; + var x_91 : f32; + var x_92 : f32; + var x_135 : f32; + var x_136 : f32; + var x_58_phi : f32; + var x_61_phi : i32; + var x_91_phi : f32; + var x_92_phi : f32; + var x_93_phi : bool; + var x_95_phi : f32; + var x_139_phi : f32; + var x_146_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_50 : f32 = x_9.resolution.x; + let x_52 : f32 = round((x_50 * 0.125)); + x_54 = gl_FragCoord.x; + switch(0u) { + default: { + x_58_phi = -0.5; + x_61_phi = 1; + loop { + var x_71 : f32; + var x_79 : f32; + var x_62 : i32; + var x_59_phi : f32; + x_58 = x_58_phi; + let x_61 : i32 = x_61_phi; + x_91_phi = 0.0; + x_92_phi = x_58; + x_93_phi = false; + if ((x_61 < 800)) { + } else { + break; + } + var x_78 : f32; + var x_79_phi : f32; + if (((x_61 % 32) == 0)) { + x_71 = (x_58 + 0.400000006); + x_59_phi = x_71; + } else { + x_79_phi = x_58; + if (((f32(x_61) % round(x_52)) <= 0.01)) { + x_78 = (x_58 + 100.0); + x_79_phi = x_78; + } + x_79 = x_79_phi; + let x_81 : f32 = x_6.injectionSwitch.x; + let x_83 : f32 = x_6.injectionSwitch.y; + if ((x_81 > x_83)) { + discard; + } + x_59_phi = x_79; + } + x_59 = x_59_phi; + if ((f32(x_61) >= x_54)) { + x_91_phi = x_59; + x_92_phi = x_59; + x_93_phi = true; + break; + } + + continuing { + x_62 = (x_61 + 1); + x_58_phi = x_59; + x_61_phi = x_62; + } + } + x_91 = x_91_phi; + x_92 = x_92_phi; + let x_93 : bool = x_93_phi; + x_95_phi = x_91; + if (x_93) { + break; + } + x_95_phi = x_92; + } + } + var x_98 : f32; + var x_102 : f32; + var x_103 : f32; + var x_102_phi : f32; + var x_105_phi : i32; + var x_135_phi : f32; + var x_136_phi : f32; + var x_137_phi : bool; + let x_95 : f32 = x_95_phi; + let x_96 : ptr = &(c.x); + *(x_96) = x_95; + x_98 = gl_FragCoord.y; + switch(0u) { + default: { + x_102_phi = -0.5; + x_105_phi = 1; + loop { + var x_115 : f32; + var x_123 : f32; + var x_106 : i32; + var x_103_phi : f32; + x_102 = x_102_phi; + let x_105 : i32 = x_105_phi; + x_135_phi = 0.0; + x_136_phi = x_102; + x_137_phi = false; + if ((x_105 < 800)) { + } else { + break; + } + var x_122 : f32; + var x_123_phi : f32; + if (((x_105 % 32) == 0)) { + x_115 = (x_102 + 0.400000006); + x_103_phi = x_115; + } else { + x_123_phi = x_102; + if (((f32(x_105) % round(x_52)) <= 0.01)) { + x_122 = (x_102 + 100.0); + x_123_phi = x_122; + } + x_123 = x_123_phi; + let x_125 : f32 = x_6.injectionSwitch.x; + let x_127 : f32 = x_6.injectionSwitch.y; + if ((x_125 > x_127)) { + discard; + } + x_103_phi = x_123; + } + x_103 = x_103_phi; + if ((f32(x_105) >= x_98)) { + x_135_phi = x_103; + x_136_phi = x_103; + x_137_phi = true; + break; + } + + continuing { + x_106 = (x_105 + 1); + x_102_phi = x_103; + x_105_phi = x_106; + } + } + x_135 = x_135_phi; + x_136 = x_136_phi; + let x_137 : bool = x_137_phi; + x_139_phi = x_135; + if (x_137) { + break; + } + x_139_phi = x_136; + } + } + let x_139 : f32 = x_139_phi; + let x_140 : ptr = &(c.y); + *(x_140) = x_139; + let x_141 : f32 = *(x_96); + let x_142 : f32 = *(x_140); + c.z = (x_141 + x_142); + x_146_phi = 0; + loop { + var x_147 : i32; + let x_146 : i32 = x_146_phi; + if ((x_146 < 3)) { + } else { + break; + } + let x_152 : ptr = &(c[x_146]); + let x_153 : f32 = *(x_152); + if ((x_153 >= 1.0)) { + let x_157 : f32 = *(x_152); + let x_158 : f32 = *(x_152); + *(x_152) = (x_157 * x_158); + let x_161 : f32 = x_6.injectionSwitch.x; + let x_163 : f32 = x_6.injectionSwitch.y; + if ((x_161 > x_163)) { + discard; + } + } + + continuing { + x_147 = (x_146 + 1); + x_146_phi = x_147; + } + } + let x_167 : vec3 = c; + let x_169 : vec3 = normalize(abs(x_167)); + x_GLF_color = vec4(x_169.x, x_169.y, x_169.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..1b409b0e37 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.hlsl @@ -0,0 +1,220 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_6 : register(b1, space0) { + uint4 x_6[1]; +}; +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float x_54 = 0.0f; + float x_58 = 0.0f; + float x_59 = 0.0f; + float x_91 = 0.0f; + float x_92 = 0.0f; + float x_135 = 0.0f; + float x_136 = 0.0f; + float x_58_phi = 0.0f; + int x_61_phi = 0; + float x_91_phi = 0.0f; + float x_92_phi = 0.0f; + bool x_93_phi = false; + float x_95_phi = 0.0f; + float x_139_phi = 0.0f; + int x_146_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_50 = asfloat(x_9[0].x); + const float x_52 = round((x_50 * 0.125f)); + x_54 = gl_FragCoord.x; + switch(0u) { + default: { + x_58_phi = -0.5f; + x_61_phi = 1; + while (true) { + float x_71 = 0.0f; + float x_79 = 0.0f; + int x_62 = 0; + float x_59_phi = 0.0f; + x_58 = x_58_phi; + const int x_61 = x_61_phi; + x_91_phi = 0.0f; + x_92_phi = x_58; + x_93_phi = false; + if ((x_61 < 800)) { + } else { + break; + } + float x_78 = 0.0f; + float x_79_phi = 0.0f; + if (((x_61 % 32) == 0)) { + x_71 = (x_58 + 0.400000006f); + x_59_phi = x_71; + } else { + x_79_phi = x_58; + if (((float(x_61) % round(x_52)) <= 0.01f)) { + x_78 = (x_58 + 100.0f); + x_79_phi = x_78; + } + x_79 = x_79_phi; + const float x_81 = asfloat(x_6[0].x); + const float x_83 = asfloat(x_6[0].y); + if ((x_81 > x_83)) { + discard; + } + x_59_phi = x_79; + } + x_59 = x_59_phi; + if ((float(x_61) >= x_54)) { + x_91_phi = x_59; + x_92_phi = x_59; + x_93_phi = true; + break; + } + { + x_62 = (x_61 + 1); + x_58_phi = x_59; + x_61_phi = x_62; + } + } + x_91 = x_91_phi; + x_92 = x_92_phi; + const bool x_93 = x_93_phi; + x_95_phi = x_91; + if (x_93) { + break; + } + x_95_phi = x_92; + break; + } + } + float x_98 = 0.0f; + float x_102 = 0.0f; + float x_103 = 0.0f; + float x_102_phi = 0.0f; + int x_105_phi = 0; + float x_135_phi = 0.0f; + float x_136_phi = 0.0f; + bool x_137_phi = false; + const float x_95 = x_95_phi; + c.x = x_95; + x_98 = gl_FragCoord.y; + switch(0u) { + default: { + x_102_phi = -0.5f; + x_105_phi = 1; + while (true) { + float x_115 = 0.0f; + float x_123 = 0.0f; + int x_106 = 0; + float x_103_phi = 0.0f; + x_102 = x_102_phi; + const int x_105 = x_105_phi; + x_135_phi = 0.0f; + x_136_phi = x_102; + x_137_phi = false; + if ((x_105 < 800)) { + } else { + break; + } + float x_122 = 0.0f; + float x_123_phi = 0.0f; + if (((x_105 % 32) == 0)) { + x_115 = (x_102 + 0.400000006f); + x_103_phi = x_115; + } else { + x_123_phi = x_102; + if (((float(x_105) % round(x_52)) <= 0.01f)) { + x_122 = (x_102 + 100.0f); + x_123_phi = x_122; + } + x_123 = x_123_phi; + const float x_125 = asfloat(x_6[0].x); + const float x_127 = asfloat(x_6[0].y); + if ((x_125 > x_127)) { + discard; + } + x_103_phi = x_123; + } + x_103 = x_103_phi; + if ((float(x_105) >= x_98)) { + x_135_phi = x_103; + x_136_phi = x_103; + x_137_phi = true; + break; + } + { + x_106 = (x_105 + 1); + x_102_phi = x_103; + x_105_phi = x_106; + } + } + x_135 = x_135_phi; + x_136 = x_136_phi; + const bool x_137 = x_137_phi; + x_139_phi = x_135; + if (x_137) { + break; + } + x_139_phi = x_136; + break; + } + } + const float x_139 = x_139_phi; + c.y = x_139; + const float x_141 = c.x; + const float x_142 = c.y; + c.z = (x_141 + x_142); + x_146_phi = 0; + while (true) { + int x_147 = 0; + const int x_146 = x_146_phi; + if ((x_146 < 3)) { + } else { + break; + } + const int x_152_save = x_146; + const float x_153 = c[x_152_save]; + if ((x_153 >= 1.0f)) { + const float x_157 = c[x_152_save]; + const float x_158 = c[x_152_save]; + set_float3(c, x_152_save, (x_157 * x_158)); + const float x_161 = asfloat(x_6[0].x); + const float x_163 = asfloat(x_6[0].y); + if ((x_161 > x_163)) { + discard; + } + } + { + x_147 = (x_146 + 1); + x_146_phi = x_147; + } + } + const float3 x_169 = normalize(abs(c)); + x_GLF_color = float4(x_169.x, x_169.y, x_169.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.msl new file mode 100755 index 0000000000..1f4f5282ef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.msl @@ -0,0 +1,226 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_9, constant buf1& x_6, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float x_54 = 0.0f; + float x_58 = 0.0f; + float x_59 = 0.0f; + float x_91 = 0.0f; + float x_92 = 0.0f; + float x_135 = 0.0f; + float x_136 = 0.0f; + float x_58_phi = 0.0f; + int x_61_phi = 0; + float x_91_phi = 0.0f; + float x_92_phi = 0.0f; + bool x_93_phi = false; + float x_95_phi = 0.0f; + float x_139_phi = 0.0f; + int x_146_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_50 = x_9.resolution.x; + float const x_52 = rint((x_50 * 0.125f)); + x_54 = (*(tint_symbol_5)).x; + switch(0u) { + default: { + x_58_phi = -0.5f; + x_61_phi = 1; + while (true) { + float x_71 = 0.0f; + float x_79 = 0.0f; + int x_62 = 0; + float x_59_phi = 0.0f; + x_58 = x_58_phi; + int const x_61 = x_61_phi; + x_91_phi = 0.0f; + x_92_phi = x_58; + x_93_phi = false; + if ((x_61 < 800)) { + } else { + break; + } + float x_78 = 0.0f; + float x_79_phi = 0.0f; + if (((x_61 % 32) == 0)) { + x_71 = (x_58 + 0.400000006f); + x_59_phi = x_71; + } else { + x_79_phi = x_58; + if (((float(x_61) % rint(x_52)) <= 0.01f)) { + x_78 = (x_58 + 100.0f); + x_79_phi = x_78; + } + x_79 = x_79_phi; + float const x_81 = x_6.injectionSwitch.x; + float const x_83 = x_6.injectionSwitch.y; + if ((x_81 > x_83)) { + discard_fragment(); + } + x_59_phi = x_79; + } + x_59 = x_59_phi; + if ((float(x_61) >= x_54)) { + x_91_phi = x_59; + x_92_phi = x_59; + x_93_phi = true; + break; + } + { + x_62 = (x_61 + 1); + x_58_phi = x_59; + x_61_phi = x_62; + } + } + x_91 = x_91_phi; + x_92 = x_92_phi; + bool const x_93 = x_93_phi; + x_95_phi = x_91; + if (x_93) { + break; + } + x_95_phi = x_92; + break; + } + } + float x_98 = 0.0f; + float x_102 = 0.0f; + float x_103 = 0.0f; + float x_102_phi = 0.0f; + int x_105_phi = 0; + float x_135_phi = 0.0f; + float x_136_phi = 0.0f; + bool x_137_phi = false; + float const x_95 = x_95_phi; + c.x = x_95; + x_98 = (*(tint_symbol_5)).y; + switch(0u) { + default: { + x_102_phi = -0.5f; + x_105_phi = 1; + while (true) { + float x_115 = 0.0f; + float x_123 = 0.0f; + int x_106 = 0; + float x_103_phi = 0.0f; + x_102 = x_102_phi; + int const x_105 = x_105_phi; + x_135_phi = 0.0f; + x_136_phi = x_102; + x_137_phi = false; + if ((x_105 < 800)) { + } else { + break; + } + float x_122 = 0.0f; + float x_123_phi = 0.0f; + if (((x_105 % 32) == 0)) { + x_115 = (x_102 + 0.400000006f); + x_103_phi = x_115; + } else { + x_123_phi = x_102; + if (((float(x_105) % rint(x_52)) <= 0.01f)) { + x_122 = (x_102 + 100.0f); + x_123_phi = x_122; + } + x_123 = x_123_phi; + float const x_125 = x_6.injectionSwitch.x; + float const x_127 = x_6.injectionSwitch.y; + if ((x_125 > x_127)) { + discard_fragment(); + } + x_103_phi = x_123; + } + x_103 = x_103_phi; + if ((float(x_105) >= x_98)) { + x_135_phi = x_103; + x_136_phi = x_103; + x_137_phi = true; + break; + } + { + x_106 = (x_105 + 1); + x_102_phi = x_103; + x_105_phi = x_106; + } + } + x_135 = x_135_phi; + x_136 = x_136_phi; + bool const x_137 = x_137_phi; + x_139_phi = x_135; + if (x_137) { + break; + } + x_139_phi = x_136; + break; + } + } + float const x_139 = x_139_phi; + c.y = x_139; + float const x_141 = c.x; + float const x_142 = c.y; + c.z = (x_141 + x_142); + x_146_phi = 0; + while (true) { + int x_147 = 0; + int const x_146 = x_146_phi; + if ((x_146 < 3)) { + } else { + break; + } + int const x_152_save = x_146; + float const x_153 = c[x_152_save]; + if ((x_153 >= 1.0f)) { + float const x_157 = c[x_152_save]; + float const x_158 = c[x_152_save]; + c[x_152_save] = (x_157 * x_158); + float const x_161 = x_6.injectionSwitch.x; + float const x_163 = x_6.injectionSwitch.y; + if ((x_161 > x_163)) { + discard_fragment(); + } + } + { + x_147 = (x_146 + 1); + x_146_phi = x_147; + } + } + float3 const x_167 = c; + float3 const x_169 = normalize(fabs(x_167)); + *(tint_symbol_6) = float4(x_169.x, x_169.y, x_169.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_9 [[buffer(0)]], constant buf1& x_6 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_9, x_6, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\ucz4.0.metal:63:29: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_61) % rint(x_52)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~ +T:\tmp\ucz4.0.metal:135:30: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_105) % rint(x_52)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~ +2 errors generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..585bfcd4b5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.spvasm @@ -0,0 +1,490 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 278 +; Schema: 0 + OpCapability Shader + %59 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_9 "x_9" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %c "c" + OpName %x_54 "x_54" + OpName %x_58 "x_58" + OpName %x_59 "x_59" + OpName %x_91 "x_91" + OpName %x_92 "x_92" + OpName %x_135 "x_135" + OpName %x_136 "x_136" + OpName %x_58_phi "x_58_phi" + OpName %x_61_phi "x_61_phi" + OpName %x_91_phi "x_91_phi" + OpName %x_92_phi "x_92_phi" + OpName %x_93_phi "x_93_phi" + OpName %x_95_phi "x_95_phi" + OpName %x_139_phi "x_139_phi" + OpName %x_146_phi "x_146_phi" + OpName %x_71 "x_71" + OpName %x_79 "x_79" + OpName %x_62 "x_62" + OpName %x_59_phi "x_59_phi" + OpName %x_78 "x_78" + OpName %x_79_phi "x_79_phi" + OpName %x_98 "x_98" + OpName %x_102 "x_102" + OpName %x_103 "x_103" + OpName %x_102_phi "x_102_phi" + OpName %x_105_phi "x_105_phi" + OpName %x_135_phi "x_135_phi" + OpName %x_136_phi "x_136_phi" + OpName %x_137_phi "x_137_phi" + OpName %x_115 "x_115" + OpName %x_123 "x_123" + OpName %x_106 "x_106" + OpName %x_103_phi "x_103_phi" + OpName %x_122 "x_122" + OpName %x_123_phi "x_123_phi" + OpName %x_147 "x_147" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_6 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %25 = OpConstantNull %v3float +%_ptr_Function_float = OpTypePointer Function %float + %28 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %39 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %45 = OpConstantNull %bool + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %52 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0_125 = OpConstant %float 0.125 +%_ptr_Private_float = OpTypePointer Private %float + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %int_800 = OpConstant %int 800 + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %uint_1 = OpConstant %uint 1 + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %265 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %18 + %21 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %25 + %x_54 = OpVariable %_ptr_Function_float Function %28 + %x_58 = OpVariable %_ptr_Function_float Function %28 + %x_59 = OpVariable %_ptr_Function_float Function %28 + %x_91 = OpVariable %_ptr_Function_float Function %28 + %x_92 = OpVariable %_ptr_Function_float Function %28 + %x_135 = OpVariable %_ptr_Function_float Function %28 + %x_136 = OpVariable %_ptr_Function_float Function %28 + %x_58_phi = OpVariable %_ptr_Function_float Function %28 + %x_61_phi = OpVariable %_ptr_Function_int Function %39 + %x_91_phi = OpVariable %_ptr_Function_float Function %28 + %x_92_phi = OpVariable %_ptr_Function_float Function %28 + %x_93_phi = OpVariable %_ptr_Function_bool Function %45 + %x_95_phi = OpVariable %_ptr_Function_float Function %28 + %x_139_phi = OpVariable %_ptr_Function_float Function %28 + %x_146_phi = OpVariable %_ptr_Function_int Function %39 + %x_71 = OpVariable %_ptr_Function_float Function %28 + %x_79 = OpVariable %_ptr_Function_float Function %28 + %x_62 = OpVariable %_ptr_Function_int Function %39 + %x_59_phi = OpVariable %_ptr_Function_float Function %28 + %x_78 = OpVariable %_ptr_Function_float Function %28 + %x_79_phi = OpVariable %_ptr_Function_float Function %28 + %x_98 = OpVariable %_ptr_Function_float Function %28 + %x_102 = OpVariable %_ptr_Function_float Function %28 + %x_103 = OpVariable %_ptr_Function_float Function %28 + %x_102_phi = OpVariable %_ptr_Function_float Function %28 + %x_105_phi = OpVariable %_ptr_Function_int Function %39 + %x_135_phi = OpVariable %_ptr_Function_float Function %28 + %x_136_phi = OpVariable %_ptr_Function_float Function %28 + %x_137_phi = OpVariable %_ptr_Function_bool Function %45 + %x_115 = OpVariable %_ptr_Function_float Function %28 + %x_123 = OpVariable %_ptr_Function_float Function %28 + %x_106 = OpVariable %_ptr_Function_int Function %39 + %x_103_phi = OpVariable %_ptr_Function_float Function %28 + %x_122 = OpVariable %_ptr_Function_float Function %28 + %x_123_phi = OpVariable %_ptr_Function_float Function %28 + %x_147 = OpVariable %_ptr_Function_int Function %39 + OpStore %c %52 + %56 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %57 = OpLoad %float %56 + %61 = OpFMul %float %57 %float_0_125 + %58 = OpExtInst %float %59 RoundEven %61 + %63 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %64 = OpLoad %float %63 + OpStore %x_54 %64 + OpSelectionMerge %65 None + OpSwitch %uint_0 %66 + %66 = OpLabel + OpStore %x_58_phi %float_n0_5 + OpStore %x_61_phi %int_1 + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %77 = OpLoad %float %x_58_phi + OpStore %x_58 %77 + %78 = OpLoad %int %x_61_phi + OpStore %x_91_phi %float_0 + %80 = OpLoad %float %x_58 + OpStore %x_92_phi %80 + OpStore %x_93_phi %false + %83 = OpSLessThan %bool %78 %int_800 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + OpBranch %84 + %86 = OpLabel + OpBranch %70 + %84 = OpLabel + %90 = OpSMod %int %78 %int_32 + %92 = OpIEqual %bool %90 %int_0 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + %96 = OpLoad %float %x_58 + %98 = OpFAdd %float %96 %float_0_400000006 + OpStore %x_71 %98 + %99 = OpLoad %float %x_71 + OpStore %x_59_phi %99 + OpBranch %93 + %95 = OpLabel + %100 = OpLoad %float %x_58 + OpStore %x_79_phi %100 + %101 = OpConvertSToF %float %78 + %102 = OpExtInst %float %59 RoundEven %58 + %103 = OpFMod %float %101 %102 + %105 = OpFOrdLessThanEqual %bool %103 %float_0_00999999978 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + %108 = OpLoad %float %x_58 + %110 = OpFAdd %float %108 %float_100 + OpStore %x_78 %110 + %111 = OpLoad %float %x_78 + OpStore %x_79_phi %111 + OpBranch %106 + %106 = OpLabel + %112 = OpLoad %float %x_79_phi + OpStore %x_79 %112 + %113 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %114 = OpLoad %float %113 + %116 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %117 = OpLoad %float %116 + %118 = OpFOrdGreaterThan %bool %114 %117 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %119 + %120 = OpLabel + OpKill + %119 = OpLabel + %121 = OpLoad %float %x_79 + OpStore %x_59_phi %121 + OpBranch %93 + %93 = OpLabel + %122 = OpLoad %float %x_59_phi + OpStore %x_59 %122 + %123 = OpConvertSToF %float %78 + %124 = OpLoad %float %x_54 + %125 = OpFOrdGreaterThanEqual %bool %123 %124 + OpSelectionMerge %126 None + OpBranchConditional %125 %127 %126 + %127 = OpLabel + %128 = OpLoad %float %x_59 + OpStore %x_91_phi %128 + %129 = OpLoad %float %x_59 + OpStore %x_92_phi %129 + OpStore %x_93_phi %true + OpBranch %70 + %126 = OpLabel + OpBranch %71 + %71 = OpLabel + %131 = OpIAdd %int %78 %int_1 + OpStore %x_62 %131 + %132 = OpLoad %float %x_59 + OpStore %x_58_phi %132 + %133 = OpLoad %int %x_62 + OpStore %x_61_phi %133 + OpBranch %69 + %70 = OpLabel + %134 = OpLoad %float %x_91_phi + OpStore %x_91 %134 + %135 = OpLoad %float %x_92_phi + OpStore %x_92 %135 + %136 = OpLoad %bool %x_93_phi + %137 = OpLoad %float %x_91 + OpStore %x_95_phi %137 + OpSelectionMerge %138 None + OpBranchConditional %136 %139 %138 + %139 = OpLabel + OpBranch %65 + %138 = OpLabel + %140 = OpLoad %float %x_92 + OpStore %x_95_phi %140 + OpBranch %65 + %65 = OpLabel + %149 = OpLoad %float %x_95_phi + %150 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %150 %149 + %151 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %152 = OpLoad %float %151 + OpStore %x_98 %152 + OpSelectionMerge %153 None + OpSwitch %uint_0 %154 + %154 = OpLabel + OpStore %x_102_phi %float_n0_5 + OpStore %x_105_phi %int_1 + OpBranch %155 + %155 = OpLabel + OpLoopMerge %156 %157 None + OpBranch %158 + %158 = OpLabel + %163 = OpLoad %float %x_102_phi + OpStore %x_102 %163 + %164 = OpLoad %int %x_105_phi + OpStore %x_135_phi %float_0 + %165 = OpLoad %float %x_102 + OpStore %x_136_phi %165 + OpStore %x_137_phi %false + %166 = OpSLessThan %bool %164 %int_800 + OpSelectionMerge %167 None + OpBranchConditional %166 %168 %169 + %168 = OpLabel + OpBranch %167 + %169 = OpLabel + OpBranch %156 + %167 = OpLabel + %172 = OpSMod %int %164 %int_32 + %173 = OpIEqual %bool %172 %int_0 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %176 + %175 = OpLabel + %177 = OpLoad %float %x_102 + %178 = OpFAdd %float %177 %float_0_400000006 + OpStore %x_115 %178 + %179 = OpLoad %float %x_115 + OpStore %x_103_phi %179 + OpBranch %174 + %176 = OpLabel + %180 = OpLoad %float %x_102 + OpStore %x_123_phi %180 + %181 = OpConvertSToF %float %164 + %182 = OpExtInst %float %59 RoundEven %58 + %183 = OpFMod %float %181 %182 + %184 = OpFOrdLessThanEqual %bool %183 %float_0_00999999978 + OpSelectionMerge %185 None + OpBranchConditional %184 %186 %185 + %186 = OpLabel + %187 = OpLoad %float %x_102 + %188 = OpFAdd %float %187 %float_100 + OpStore %x_122 %188 + %189 = OpLoad %float %x_122 + OpStore %x_123_phi %189 + OpBranch %185 + %185 = OpLabel + %190 = OpLoad %float %x_123_phi + OpStore %x_123 %190 + %191 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %192 = OpLoad %float %191 + %193 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %194 = OpLoad %float %193 + %195 = OpFOrdGreaterThan %bool %192 %194 + OpSelectionMerge %196 None + OpBranchConditional %195 %197 %196 + %197 = OpLabel + OpKill + %196 = OpLabel + %198 = OpLoad %float %x_123 + OpStore %x_103_phi %198 + OpBranch %174 + %174 = OpLabel + %199 = OpLoad %float %x_103_phi + OpStore %x_103 %199 + %200 = OpConvertSToF %float %164 + %201 = OpLoad %float %x_98 + %202 = OpFOrdGreaterThanEqual %bool %200 %201 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %203 + %204 = OpLabel + %205 = OpLoad %float %x_103 + OpStore %x_135_phi %205 + %206 = OpLoad %float %x_103 + OpStore %x_136_phi %206 + OpStore %x_137_phi %true + OpBranch %156 + %203 = OpLabel + OpBranch %157 + %157 = OpLabel + %207 = OpIAdd %int %164 %int_1 + OpStore %x_106 %207 + %208 = OpLoad %float %x_103 + OpStore %x_102_phi %208 + %209 = OpLoad %int %x_106 + OpStore %x_105_phi %209 + OpBranch %155 + %156 = OpLabel + %210 = OpLoad %float %x_135_phi + OpStore %x_135 %210 + %211 = OpLoad %float %x_136_phi + OpStore %x_136 %211 + %212 = OpLoad %bool %x_137_phi + %213 = OpLoad %float %x_135 + OpStore %x_139_phi %213 + OpSelectionMerge %214 None + OpBranchConditional %212 %215 %214 + %215 = OpLabel + OpBranch %153 + %214 = OpLabel + %216 = OpLoad %float %x_136 + OpStore %x_139_phi %216 + OpBranch %153 + %153 = OpLabel + %217 = OpLoad %float %x_139_phi + %218 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %218 %217 + %219 = OpAccessChain %_ptr_Function_float %c %uint_0 + %220 = OpLoad %float %219 + %221 = OpAccessChain %_ptr_Function_float %c %uint_1 + %222 = OpLoad %float %221 + %224 = OpAccessChain %_ptr_Function_float %c %uint_2 + %225 = OpFAdd %float %220 %222 + OpStore %224 %225 + OpStore %x_146_phi %int_0 + OpBranch %226 + %226 = OpLabel + OpLoopMerge %227 %228 None + OpBranch %229 + %229 = OpLabel + %231 = OpLoad %int %x_146_phi + %233 = OpSLessThan %bool %231 %int_3 + OpSelectionMerge %234 None + OpBranchConditional %233 %235 %236 + %235 = OpLabel + OpBranch %234 + %236 = OpLabel + OpBranch %227 + %234 = OpLabel + %237 = OpAccessChain %_ptr_Function_float %c %231 + %238 = OpLoad %float %237 + %240 = OpFOrdGreaterThanEqual %bool %238 %float_1 + OpSelectionMerge %241 None + OpBranchConditional %240 %242 %241 + %242 = OpLabel + %243 = OpAccessChain %_ptr_Function_float %c %231 + %244 = OpLoad %float %243 + %245 = OpAccessChain %_ptr_Function_float %c %231 + %246 = OpLoad %float %245 + %247 = OpAccessChain %_ptr_Function_float %c %231 + %248 = OpFMul %float %244 %246 + OpStore %247 %248 + %249 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %250 = OpLoad %float %249 + %251 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %252 = OpLoad %float %251 + %253 = OpFOrdGreaterThan %bool %250 %252 + OpSelectionMerge %254 None + OpBranchConditional %253 %255 %254 + %255 = OpLabel + OpKill + %254 = OpLabel + OpBranch %241 + %241 = OpLabel + OpBranch %228 + %228 = OpLabel + %256 = OpIAdd %int %231 %int_1 + OpStore %x_147 %256 + %257 = OpLoad %int %x_147 + OpStore %x_146_phi %257 + OpBranch %226 + %227 = OpLabel + %258 = OpLoad %v3float %c + %260 = OpExtInst %v3float %59 FAbs %258 + %259 = OpExtInst %v3float %59 Normalize %260 + %261 = OpCompositeExtract %float %259 0 + %262 = OpCompositeExtract %float %259 1 + %263 = OpCompositeExtract %float %259 2 + %264 = OpCompositeConstruct %v4float %261 %262 %263 %float_1 + OpStore %x_GLF_color %264 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %265 +%tint_symbol_1 = OpFunctionParameter %main_out + %269 = OpLabel + %270 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %270 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %18 + %272 = OpLabel + %273 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %273 + %274 = OpFunctionCall %void %main_1 + %276 = OpLoad %v4float %x_GLF_color + %277 = OpCompositeConstruct %main_out %276 + %275 = OpFunctionCall %void %tint_symbol_3 %277 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..5688188242 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-double-always-false-discard/1.wgsl.expected.wgsl @@ -0,0 +1,222 @@ +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(1)]] var x_6 : buf1; + +[[group(0), binding(0)]] var x_9 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var c : vec3; + var x_54 : f32; + var x_58 : f32; + var x_59 : f32; + var x_91 : f32; + var x_92 : f32; + var x_135 : f32; + var x_136 : f32; + var x_58_phi : f32; + var x_61_phi : i32; + var x_91_phi : f32; + var x_92_phi : f32; + var x_93_phi : bool; + var x_95_phi : f32; + var x_139_phi : f32; + var x_146_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_50 : f32 = x_9.resolution.x; + let x_52 : f32 = round((x_50 * 0.125)); + x_54 = gl_FragCoord.x; + switch(0u) { + default: { + x_58_phi = -0.5; + x_61_phi = 1; + loop { + var x_71 : f32; + var x_79 : f32; + var x_62 : i32; + var x_59_phi : f32; + x_58 = x_58_phi; + let x_61 : i32 = x_61_phi; + x_91_phi = 0.0; + x_92_phi = x_58; + x_93_phi = false; + if ((x_61 < 800)) { + } else { + break; + } + var x_78 : f32; + var x_79_phi : f32; + if (((x_61 % 32) == 0)) { + x_71 = (x_58 + 0.400000006); + x_59_phi = x_71; + } else { + x_79_phi = x_58; + if (((f32(x_61) % round(x_52)) <= 0.01)) { + x_78 = (x_58 + 100.0); + x_79_phi = x_78; + } + x_79 = x_79_phi; + let x_81 : f32 = x_6.injectionSwitch.x; + let x_83 : f32 = x_6.injectionSwitch.y; + if ((x_81 > x_83)) { + discard; + } + x_59_phi = x_79; + } + x_59 = x_59_phi; + if ((f32(x_61) >= x_54)) { + x_91_phi = x_59; + x_92_phi = x_59; + x_93_phi = true; + break; + } + + continuing { + x_62 = (x_61 + 1); + x_58_phi = x_59; + x_61_phi = x_62; + } + } + x_91 = x_91_phi; + x_92 = x_92_phi; + let x_93 : bool = x_93_phi; + x_95_phi = x_91; + if (x_93) { + break; + } + x_95_phi = x_92; + } + } + var x_98 : f32; + var x_102 : f32; + var x_103 : f32; + var x_102_phi : f32; + var x_105_phi : i32; + var x_135_phi : f32; + var x_136_phi : f32; + var x_137_phi : bool; + let x_95 : f32 = x_95_phi; + let x_96 : ptr = &(c.x); + *(x_96) = x_95; + x_98 = gl_FragCoord.y; + switch(0u) { + default: { + x_102_phi = -0.5; + x_105_phi = 1; + loop { + var x_115 : f32; + var x_123 : f32; + var x_106 : i32; + var x_103_phi : f32; + x_102 = x_102_phi; + let x_105 : i32 = x_105_phi; + x_135_phi = 0.0; + x_136_phi = x_102; + x_137_phi = false; + if ((x_105 < 800)) { + } else { + break; + } + var x_122 : f32; + var x_123_phi : f32; + if (((x_105 % 32) == 0)) { + x_115 = (x_102 + 0.400000006); + x_103_phi = x_115; + } else { + x_123_phi = x_102; + if (((f32(x_105) % round(x_52)) <= 0.01)) { + x_122 = (x_102 + 100.0); + x_123_phi = x_122; + } + x_123 = x_123_phi; + let x_125 : f32 = x_6.injectionSwitch.x; + let x_127 : f32 = x_6.injectionSwitch.y; + if ((x_125 > x_127)) { + discard; + } + x_103_phi = x_123; + } + x_103 = x_103_phi; + if ((f32(x_105) >= x_98)) { + x_135_phi = x_103; + x_136_phi = x_103; + x_137_phi = true; + break; + } + + continuing { + x_106 = (x_105 + 1); + x_102_phi = x_103; + x_105_phi = x_106; + } + } + x_135 = x_135_phi; + x_136 = x_136_phi; + let x_137 : bool = x_137_phi; + x_139_phi = x_135; + if (x_137) { + break; + } + x_139_phi = x_136; + } + } + let x_139 : f32 = x_139_phi; + let x_140 : ptr = &(c.y); + *(x_140) = x_139; + let x_141 : f32 = *(x_96); + let x_142 : f32 = *(x_140); + c.z = (x_141 + x_142); + x_146_phi = 0; + loop { + var x_147 : i32; + let x_146 : i32 = x_146_phi; + if ((x_146 < 3)) { + } else { + break; + } + let x_152 : ptr = &(c[x_146]); + let x_153 : f32 = *(x_152); + if ((x_153 >= 1.0)) { + let x_157 : f32 = *(x_152); + let x_158 : f32 = *(x_152); + *(x_152) = (x_157 * x_158); + let x_161 : f32 = x_6.injectionSwitch.x; + let x_163 : f32 = x_6.injectionSwitch.y; + if ((x_161 > x_163)) { + discard; + } + } + + continuing { + x_147 = (x_146 + 1); + x_146_phi = x_147; + } + } + let x_167 : vec3 = c; + let x_169 : vec3 = normalize(abs(x_167)); + x_GLF_color = vec4(x_169.x, x_169.y, x_169.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm new file mode 100644 index 0000000000..ff93ffd456 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm @@ -0,0 +1,217 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %compute_value_f1_f1_ "compute_value(f1;f1;" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %result "result" + OpName %i "i" + OpName %c "c" + OpName %thirty_two_0 "thirty_two" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %i_0 "i" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %23 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %float_n0_5 = OpConstant %float -0.5 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %40 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %20 + %54 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function +%thirty_two_0 = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_float Function + %param_1 = OpVariable %_ptr_Function_float Function + %param_2 = OpVariable %_ptr_Function_float Function + %i_0 = OpVariable %_ptr_Function_int Function + OpStore %c %40 + %55 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %56 = OpLoad %float %55 + %57 = OpFDiv %float %56 %float_8 + %58 = OpExtInst %float %1 Round %57 + OpStore %thirty_two_0 %58 + %59 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %60 = OpLoad %float %59 + OpStore %param %60 + %61 = OpLoad %float %thirty_two_0 + OpStore %param_0 %61 + %62 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_0 + %63 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %63 %62 + %64 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %65 = OpLoad %float %64 + OpStore %param_1 %65 + %66 = OpLoad %float %thirty_two_0 + OpStore %param_2 %66 + %67 = OpFunctionCall %float %compute_value_f1_f1_ %param_1 %param_2 + %68 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %68 %67 + %69 = OpAccessChain %_ptr_Function_float %c %uint_0 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Function_float %c %uint_1 + %72 = OpLoad %float %71 + %73 = OpFAdd %float %70 %72 + %74 = OpAccessChain %_ptr_Function_float %c %uint_2 + OpStore %74 %73 + OpStore %i_0 %int_0 + OpBranch %75 + %75 = OpLabel + OpLoopMerge %76 %77 None + OpBranch %78 + %78 = OpLabel + %79 = OpLoad %int %i_0 + %80 = OpSLessThan %bool %79 %int_3 + OpBranchConditional %80 %81 %76 + %81 = OpLabel + %82 = OpLoad %int %i_0 + %83 = OpAccessChain %_ptr_Function_float %c %82 + %84 = OpLoad %float %83 + %85 = OpFOrdGreaterThanEqual %bool %84 %float_1 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %86 + %87 = OpLabel + %88 = OpLoad %int %i_0 + %89 = OpLoad %int %i_0 + %90 = OpAccessChain %_ptr_Function_float %c %89 + %91 = OpLoad %float %90 + %92 = OpLoad %int %i_0 + %93 = OpAccessChain %_ptr_Function_float %c %92 + %94 = OpLoad %float %93 + %95 = OpFMul %float %91 %94 + %96 = OpAccessChain %_ptr_Function_float %c %88 + OpStore %96 %95 + OpBranch %86 + %86 = OpLabel + OpBranch %77 + %77 = OpLabel + %97 = OpLoad %int %i_0 + %98 = OpIAdd %int %97 %int_1 + OpStore %i_0 %98 + OpBranch %75 + %76 = OpLabel + %99 = OpLoad %v3float %c + %100 = OpExtInst %v3float %1 FAbs %99 + %101 = OpExtInst %v3float %1 Normalize %100 + %102 = OpCompositeExtract %float %101 0 + %103 = OpCompositeExtract %float %101 1 + %104 = OpCompositeExtract %float %101 2 + %105 = OpCompositeConstruct %v4float %102 %103 %104 %float_1 + OpStore %_GLF_color %105 + OpReturn + OpFunctionEnd +%compute_value_f1_f1_ = OpFunction %float None %23 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %106 = OpLabel + %result = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + OpStore %result %float_n0_5 + OpStore %i %int_1 + OpBranch %107 + %107 = OpLabel + OpLoopMerge %108 %109 None + OpBranch %110 + %110 = OpLabel + %111 = OpLoad %int %i + %112 = OpSLessThan %bool %111 %int_800 + OpBranchConditional %112 %113 %108 + %113 = OpLabel + %114 = OpLoad %int %i + %115 = OpSMod %int %114 %int_32 + %116 = OpIEqual %bool %115 %int_0 + OpSelectionMerge %117 None + OpBranchConditional %116 %118 %119 + %118 = OpLabel + %120 = OpLoad %float %result + %121 = OpFAdd %float %120 %float_0_400000006 + OpStore %result %121 + OpBranch %117 + %119 = OpLabel + %122 = OpLoad %int %i + %123 = OpConvertSToF %float %122 + %124 = OpLoad %float %thirty_two + %125 = OpExtInst %float %1 Round %124 + %126 = OpFMod %float %123 %125 + %127 = OpFOrdLessThanEqual %bool %126 %float_0_00999999978 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %128 + %129 = OpLabel + %130 = OpLoad %float %result + %131 = OpFAdd %float %130 %float_100 + OpStore %result %131 + OpBranch %128 + %128 = OpLabel + OpBranch %117 + %117 = OpLabel + %132 = OpLoad %int %i + %133 = OpConvertSToF %float %132 + %134 = OpLoad %float %limit + %135 = OpFOrdGreaterThanEqual %bool %133 %134 + OpSelectionMerge %136 None + OpBranchConditional %135 %137 %136 + %137 = OpLabel + %138 = OpLoad %float %result + OpReturnValue %138 + %136 = OpLabel + OpBranch %109 + %109 = OpLabel + %139 = OpLoad %int %i + %140 = OpIAdd %int %139 %int_1 + OpStore %i %140 + OpBranch %107 + %108 = OpLabel + %141 = OpLoad %float %result + OpReturnValue %141 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..7295dbb849 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.hlsl @@ -0,0 +1,95 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float compute_value_f1_f1_(inout float limit, inout float thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + { + for(; (i < 800); i = (i + 1)) { + if (((i % 32) == 0)) { + result = (result + 0.400000006f); + } else { + const int x_122 = i; + const float x_124 = thirty_two; + if (((float(x_122) % round(x_124)) <= 0.01f)) { + result = (result + 100.0f); + } + } + const int x_132 = i; + const float x_134 = limit; + if ((float(x_132) >= x_134)) { + return result; + } + } + } + return result; +} + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int i_1 = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_56 = asfloat(x_13[0].x); + thirty_two_1 = round((x_56 / 8.0f)); + const float x_60 = gl_FragCoord.x; + param = x_60; + param_1 = thirty_two_1; + const float x_62 = compute_value_f1_f1_(param, param_1); + c.x = x_62; + const float x_65 = gl_FragCoord.y; + param_2 = x_65; + param_3 = thirty_two_1; + const float x_67 = compute_value_f1_f1_(param_2, param_3); + c.y = x_67; + const float x_70 = c.x; + const float x_72 = c.y; + c.z = (x_70 + x_72); + i_1 = 0; + { + for(; (i_1 < 3); i_1 = (i_1 + 1)) { + const float x_84 = c[i_1]; + if ((x_84 >= 1.0f)) { + const int x_88 = i_1; + const float x_91 = c[i_1]; + const float x_94 = c[i_1]; + set_float3(c, x_88, (x_91 * x_94)); + } + } + } + const float3 x_101 = normalize(abs(c)); + x_GLF_color = float4(x_101.x, x_101.y, x_101.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.msl new file mode 100755 index 0000000000..51d7aa0f8c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.msl @@ -0,0 +1,122 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float compute_value_f1_f1_(thread float* const limit, thread float* const thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + while (true) { + int const x_111 = i; + if ((x_111 < 800)) { + } else { + break; + } + int const x_114 = i; + if (((x_114 % 32) == 0)) { + float const x_120 = result; + result = (x_120 + 0.400000006f); + } else { + int const x_122 = i; + float const x_124 = *(thirty_two); + if (((float(x_122) % rint(x_124)) <= 0.01f)) { + float const x_130 = result; + result = (x_130 + 100.0f); + } + } + int const x_132 = i; + float const x_134 = *(limit); + if ((float(x_132) >= x_134)) { + float const x_138 = result; + return x_138; + } + { + int const x_139 = i; + i = (x_139 + 1); + } + } + float const x_141 = result; + return x_141; +} + +void main_1(constant buf0& x_13, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int i_1 = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_56 = x_13.resolution.x; + thirty_two_1 = rint((x_56 / 8.0f)); + float const x_60 = (*(tint_symbol_5)).x; + param = x_60; + float const x_61 = thirty_two_1; + param_1 = x_61; + float const x_62 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_62; + float const x_65 = (*(tint_symbol_5)).y; + param_2 = x_65; + float const x_66 = thirty_two_1; + param_3 = x_66; + float const x_67 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_67; + float const x_70 = c.x; + float const x_72 = c.y; + c.z = (x_70 + x_72); + i_1 = 0; + while (true) { + int const x_79 = i_1; + if ((x_79 < 3)) { + } else { + break; + } + int const x_82 = i_1; + float const x_84 = c[x_82]; + if ((x_84 >= 1.0f)) { + int const x_88 = i_1; + int const x_89 = i_1; + float const x_91 = c[x_89]; + int const x_92 = i_1; + float const x_94 = c[x_92]; + c[x_88] = (x_91 * x_94); + } + { + int const x_97 = i_1; + i_1 = (x_97 + 1); + } + } + float3 const x_99 = c; + float3 const x_101 = normalize(fabs(x_99)); + *(tint_symbol_6) = float4(x_101.x, x_101.y, x_101.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_13, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\ufic.0.metal:32:26: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_122) % rint(x_124)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..15ed885391 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.spvasm @@ -0,0 +1,266 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 172 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_13 "x_13" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %compute_value_f1_f1_ "compute_value_f1_f1_" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %result "result" + OpName %i "i" + OpName %main_1 "main_1" + OpName %c "c" + OpName %thirty_two_1 "thirty_two_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %22 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %void = OpTypeVoid + %76 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %83 = OpConstantNull %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %93 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %159 = OpTypeFunction %void %main_out +%compute_value_f1_f1_ = OpFunction %float None %15 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %20 = OpLabel + %result = OpVariable %_ptr_Function_float Function %22 + %i = OpVariable %_ptr_Function_int Function %26 + OpStore %result %float_n0_5 + OpStore %i %int_1 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %i + %35 = OpSLessThan %bool %33 %int_800 + OpSelectionMerge %37 None + OpBranchConditional %35 %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + OpBranch %30 + %37 = OpLabel + %40 = OpLoad %int %i + %42 = OpSMod %int %40 %int_32 + %44 = OpIEqual %bool %42 %int_0 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + %48 = OpLoad %float %result + %50 = OpFAdd %float %48 %float_0_400000006 + OpStore %result %50 + OpBranch %45 + %47 = OpLabel + %51 = OpLoad %int %i + %53 = OpLoad %float %thirty_two + %54 = OpConvertSToF %float %51 + %55 = OpExtInst %float %56 RoundEven %53 + %57 = OpFMod %float %54 %55 + %59 = OpFOrdLessThanEqual %bool %57 %float_0_00999999978 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %60 + %61 = OpLabel + %62 = OpLoad %float %result + %64 = OpFAdd %float %62 %float_100 + OpStore %result %64 + OpBranch %60 + %60 = OpLabel + OpBranch %45 + %45 = OpLabel + %65 = OpLoad %int %i + %67 = OpLoad %float %limit + %68 = OpConvertSToF %float %65 + %69 = OpFOrdGreaterThanEqual %bool %68 %67 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpLoad %float %result + OpReturnValue %72 + %70 = OpLabel + OpBranch %31 + %31 = OpLabel + %73 = OpLoad %int %i + %74 = OpIAdd %int %73 %int_1 + OpStore %i %74 + OpBranch %29 + %30 = OpLabel + %75 = OpLoad %float %result + OpReturnValue %75 + OpFunctionEnd + %main_1 = OpFunction %void None %76 + %79 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %83 +%thirty_two_1 = OpVariable %_ptr_Function_float Function %22 + %param = OpVariable %_ptr_Function_float Function %22 + %param_1 = OpVariable %_ptr_Function_float Function %22 + %param_2 = OpVariable %_ptr_Function_float Function %22 + %param_3 = OpVariable %_ptr_Function_float Function %22 + %i_1 = OpVariable %_ptr_Function_int Function %26 + OpStore %c %93 + %97 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0 + %98 = OpLoad %float %97 + %100 = OpFDiv %float %98 %float_8 + %99 = OpExtInst %float %56 RoundEven %100 + OpStore %thirty_two_1 %99 + %102 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %103 = OpLoad %float %102 + OpStore %param %103 + %104 = OpLoad %float %thirty_two_1 + OpStore %param_1 %104 + %105 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1 + %108 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %108 %105 + %110 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %111 = OpLoad %float %110 + OpStore %param_2 %111 + %112 = OpLoad %float %thirty_two_1 + OpStore %param_3 %112 + %113 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3 + %116 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %116 %113 + %117 = OpAccessChain %_ptr_Function_float %c %uint_0 + %118 = OpLoad %float %117 + %119 = OpAccessChain %_ptr_Function_float %c %uint_1 + %120 = OpLoad %float %119 + %122 = OpAccessChain %_ptr_Function_float %c %uint_2 + %123 = OpFAdd %float %118 %120 + OpStore %122 %123 + OpStore %i_1 %int_0 + OpBranch %124 + %124 = OpLabel + OpLoopMerge %125 %126 None + OpBranch %127 + %127 = OpLabel + %128 = OpLoad %int %i_1 + %130 = OpSLessThan %bool %128 %int_3 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %133 + %132 = OpLabel + OpBranch %131 + %133 = OpLabel + OpBranch %125 + %131 = OpLabel + %134 = OpLoad %int %i_1 + %135 = OpAccessChain %_ptr_Function_float %c %134 + %136 = OpLoad %float %135 + %138 = OpFOrdGreaterThanEqual %bool %136 %float_1 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpLoad %int %i_1 + %142 = OpLoad %int %i_1 + %143 = OpAccessChain %_ptr_Function_float %c %142 + %144 = OpLoad %float %143 + %145 = OpLoad %int %i_1 + %146 = OpAccessChain %_ptr_Function_float %c %145 + %147 = OpLoad %float %146 + %148 = OpAccessChain %_ptr_Function_float %c %141 + %149 = OpFMul %float %144 %147 + OpStore %148 %149 + OpBranch %139 + %139 = OpLabel + OpBranch %126 + %126 = OpLabel + %150 = OpLoad %int %i_1 + %151 = OpIAdd %int %150 %int_1 + OpStore %i_1 %151 + OpBranch %124 + %125 = OpLabel + %152 = OpLoad %v3float %c + %154 = OpExtInst %v3float %56 FAbs %152 + %153 = OpExtInst %v3float %56 Normalize %154 + %155 = OpCompositeExtract %float %153 0 + %156 = OpCompositeExtract %float %153 1 + %157 = OpCompositeExtract %float %153 2 + %158 = OpCompositeConstruct %v4float %155 %156 %157 %float_1 + OpStore %x_GLF_color %158 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %159 +%tint_symbol_1 = OpFunctionParameter %main_out + %163 = OpLabel + %164 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %164 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %76 + %166 = OpLabel + %167 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %167 + %168 = OpFunctionCall %void %main_1 + %170 = OpLoad %v4float %x_GLF_color + %171 = OpCompositeConstruct %main_out %170 + %169 = OpFunctionCall %void %tint_symbol_3 %171 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..82eab45fc4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.spvasm.expected.wgsl @@ -0,0 +1,116 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_13 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var result : f32; + var i : i32; + result = -0.5; + i = 1; + loop { + let x_111 : i32 = i; + if ((x_111 < 800)) { + } else { + break; + } + let x_114 : i32 = i; + if (((x_114 % 32) == 0)) { + let x_120 : f32 = result; + result = (x_120 + 0.400000006); + } else { + let x_122 : i32 = i; + let x_124 : f32 = *(thirty_two); + if (((f32(x_122) % round(x_124)) <= 0.01)) { + let x_130 : f32 = result; + result = (x_130 + 100.0); + } + } + let x_132 : i32 = i; + let x_134 : f32 = *(limit); + if ((f32(x_132) >= x_134)) { + let x_138 : f32 = result; + return x_138; + } + + continuing { + let x_139 : i32 = i; + i = (x_139 + 1); + } + } + let x_141 : f32 = result; + return x_141; +} + +fn main_1() { + var c : vec3; + var thirty_two_1 : f32; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var i_1 : i32; + c = vec3(7.0, 8.0, 9.0); + let x_56 : f32 = x_13.resolution.x; + thirty_two_1 = round((x_56 / 8.0)); + let x_60 : f32 = gl_FragCoord.x; + param = x_60; + let x_61 : f32 = thirty_two_1; + param_1 = x_61; + let x_62 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_62; + let x_65 : f32 = gl_FragCoord.y; + param_2 = x_65; + let x_66 : f32 = thirty_two_1; + param_3 = x_66; + let x_67 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_67; + let x_70 : f32 = c.x; + let x_72 : f32 = c.y; + c.z = (x_70 + x_72); + i_1 = 0; + loop { + let x_79 : i32 = i_1; + if ((x_79 < 3)) { + } else { + break; + } + let x_82 : i32 = i_1; + let x_84 : f32 = c[x_82]; + if ((x_84 >= 1.0)) { + let x_88 : i32 = i_1; + let x_89 : i32 = i_1; + let x_91 : f32 = c[x_89]; + let x_92 : i32 = i_1; + let x_94 : f32 = c[x_92]; + c[x_88] = (x_91 * x_94); + } + + continuing { + let x_97 : i32 = i_1; + i_1 = (x_97 + 1); + } + } + let x_99 : vec3 = c; + let x_101 : vec3 = normalize(abs(x_99)); + x_GLF_color = vec4(x_101.x, x_101.y, x_101.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl new file mode 100644 index 0000000000..82eab45fc4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl @@ -0,0 +1,116 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_13 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var result : f32; + var i : i32; + result = -0.5; + i = 1; + loop { + let x_111 : i32 = i; + if ((x_111 < 800)) { + } else { + break; + } + let x_114 : i32 = i; + if (((x_114 % 32) == 0)) { + let x_120 : f32 = result; + result = (x_120 + 0.400000006); + } else { + let x_122 : i32 = i; + let x_124 : f32 = *(thirty_two); + if (((f32(x_122) % round(x_124)) <= 0.01)) { + let x_130 : f32 = result; + result = (x_130 + 100.0); + } + } + let x_132 : i32 = i; + let x_134 : f32 = *(limit); + if ((f32(x_132) >= x_134)) { + let x_138 : f32 = result; + return x_138; + } + + continuing { + let x_139 : i32 = i; + i = (x_139 + 1); + } + } + let x_141 : f32 = result; + return x_141; +} + +fn main_1() { + var c : vec3; + var thirty_two_1 : f32; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var i_1 : i32; + c = vec3(7.0, 8.0, 9.0); + let x_56 : f32 = x_13.resolution.x; + thirty_two_1 = round((x_56 / 8.0)); + let x_60 : f32 = gl_FragCoord.x; + param = x_60; + let x_61 : f32 = thirty_two_1; + param_1 = x_61; + let x_62 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_62; + let x_65 : f32 = gl_FragCoord.y; + param_2 = x_65; + let x_66 : f32 = thirty_two_1; + param_3 = x_66; + let x_67 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_67; + let x_70 : f32 = c.x; + let x_72 : f32 = c.y; + c.z = (x_70 + x_72); + i_1 = 0; + loop { + let x_79 : i32 = i_1; + if ((x_79 < 3)) { + } else { + break; + } + let x_82 : i32 = i_1; + let x_84 : f32 = c[x_82]; + if ((x_84 >= 1.0)) { + let x_88 : i32 = i_1; + let x_89 : i32 = i_1; + let x_91 : f32 = c[x_89]; + let x_92 : i32 = i_1; + let x_94 : f32 = c[x_92]; + c[x_88] = (x_91 * x_94); + } + + continuing { + let x_97 : i32 = i_1; + i_1 = (x_97 + 1); + } + } + let x_99 : vec3 = c; + let x_101 : vec3 = normalize(abs(x_99)); + x_GLF_color = vec4(x_101.x, x_101.y, x_101.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..7295dbb849 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.hlsl @@ -0,0 +1,95 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float compute_value_f1_f1_(inout float limit, inout float thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + { + for(; (i < 800); i = (i + 1)) { + if (((i % 32) == 0)) { + result = (result + 0.400000006f); + } else { + const int x_122 = i; + const float x_124 = thirty_two; + if (((float(x_122) % round(x_124)) <= 0.01f)) { + result = (result + 100.0f); + } + } + const int x_132 = i; + const float x_134 = limit; + if ((float(x_132) >= x_134)) { + return result; + } + } + } + return result; +} + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int i_1 = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_56 = asfloat(x_13[0].x); + thirty_two_1 = round((x_56 / 8.0f)); + const float x_60 = gl_FragCoord.x; + param = x_60; + param_1 = thirty_two_1; + const float x_62 = compute_value_f1_f1_(param, param_1); + c.x = x_62; + const float x_65 = gl_FragCoord.y; + param_2 = x_65; + param_3 = thirty_two_1; + const float x_67 = compute_value_f1_f1_(param_2, param_3); + c.y = x_67; + const float x_70 = c.x; + const float x_72 = c.y; + c.z = (x_70 + x_72); + i_1 = 0; + { + for(; (i_1 < 3); i_1 = (i_1 + 1)) { + const float x_84 = c[i_1]; + if ((x_84 >= 1.0f)) { + const int x_88 = i_1; + const float x_91 = c[i_1]; + const float x_94 = c[i_1]; + set_float3(c, x_88, (x_91 * x_94)); + } + } + } + const float3 x_101 = normalize(abs(c)); + x_GLF_color = float4(x_101.x, x_101.y, x_101.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.msl new file mode 100755 index 0000000000..e209f7292e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.msl @@ -0,0 +1,122 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float compute_value_f1_f1_(thread float* const limit, thread float* const thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + while (true) { + int const x_111 = i; + if ((x_111 < 800)) { + } else { + break; + } + int const x_114 = i; + if (((x_114 % 32) == 0)) { + float const x_120 = result; + result = (x_120 + 0.400000006f); + } else { + int const x_122 = i; + float const x_124 = *(thirty_two); + if (((float(x_122) % rint(x_124)) <= 0.01f)) { + float const x_130 = result; + result = (x_130 + 100.0f); + } + } + int const x_132 = i; + float const x_134 = *(limit); + if ((float(x_132) >= x_134)) { + float const x_138 = result; + return x_138; + } + { + int const x_139 = i; + i = (x_139 + 1); + } + } + float const x_141 = result; + return x_141; +} + +void main_1(constant buf0& x_13, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int i_1 = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_56 = x_13.resolution.x; + thirty_two_1 = rint((x_56 / 8.0f)); + float const x_60 = (*(tint_symbol_5)).x; + param = x_60; + float const x_61 = thirty_two_1; + param_1 = x_61; + float const x_62 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_62; + float const x_65 = (*(tint_symbol_5)).y; + param_2 = x_65; + float const x_66 = thirty_two_1; + param_3 = x_66; + float const x_67 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_67; + float const x_70 = c.x; + float const x_72 = c.y; + c.z = (x_70 + x_72); + i_1 = 0; + while (true) { + int const x_79 = i_1; + if ((x_79 < 3)) { + } else { + break; + } + int const x_82 = i_1; + float const x_84 = c[x_82]; + if ((x_84 >= 1.0f)) { + int const x_88 = i_1; + int const x_89 = i_1; + float const x_91 = c[x_89]; + int const x_92 = i_1; + float const x_94 = c[x_92]; + c[x_88] = (x_91 * x_94); + } + { + int const x_97 = i_1; + i_1 = (x_97 + 1); + } + } + float3 const x_99 = c; + float3 const x_101 = normalize(fabs(x_99)); + *(tint_symbol_6) = float4(x_101.x, x_101.y, x_101.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_13, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\u2a4.0.metal:32:26: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_122) % rint(x_124)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..15ed885391 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.spvasm @@ -0,0 +1,266 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 172 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_13 "x_13" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %compute_value_f1_f1_ "compute_value_f1_f1_" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %result "result" + OpName %i "i" + OpName %main_1 "main_1" + OpName %c "c" + OpName %thirty_two_1 "thirty_two_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %22 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %void = OpTypeVoid + %76 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %83 = OpConstantNull %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %93 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %159 = OpTypeFunction %void %main_out +%compute_value_f1_f1_ = OpFunction %float None %15 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %20 = OpLabel + %result = OpVariable %_ptr_Function_float Function %22 + %i = OpVariable %_ptr_Function_int Function %26 + OpStore %result %float_n0_5 + OpStore %i %int_1 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %i + %35 = OpSLessThan %bool %33 %int_800 + OpSelectionMerge %37 None + OpBranchConditional %35 %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + OpBranch %30 + %37 = OpLabel + %40 = OpLoad %int %i + %42 = OpSMod %int %40 %int_32 + %44 = OpIEqual %bool %42 %int_0 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + %48 = OpLoad %float %result + %50 = OpFAdd %float %48 %float_0_400000006 + OpStore %result %50 + OpBranch %45 + %47 = OpLabel + %51 = OpLoad %int %i + %53 = OpLoad %float %thirty_two + %54 = OpConvertSToF %float %51 + %55 = OpExtInst %float %56 RoundEven %53 + %57 = OpFMod %float %54 %55 + %59 = OpFOrdLessThanEqual %bool %57 %float_0_00999999978 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %60 + %61 = OpLabel + %62 = OpLoad %float %result + %64 = OpFAdd %float %62 %float_100 + OpStore %result %64 + OpBranch %60 + %60 = OpLabel + OpBranch %45 + %45 = OpLabel + %65 = OpLoad %int %i + %67 = OpLoad %float %limit + %68 = OpConvertSToF %float %65 + %69 = OpFOrdGreaterThanEqual %bool %68 %67 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpLoad %float %result + OpReturnValue %72 + %70 = OpLabel + OpBranch %31 + %31 = OpLabel + %73 = OpLoad %int %i + %74 = OpIAdd %int %73 %int_1 + OpStore %i %74 + OpBranch %29 + %30 = OpLabel + %75 = OpLoad %float %result + OpReturnValue %75 + OpFunctionEnd + %main_1 = OpFunction %void None %76 + %79 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %83 +%thirty_two_1 = OpVariable %_ptr_Function_float Function %22 + %param = OpVariable %_ptr_Function_float Function %22 + %param_1 = OpVariable %_ptr_Function_float Function %22 + %param_2 = OpVariable %_ptr_Function_float Function %22 + %param_3 = OpVariable %_ptr_Function_float Function %22 + %i_1 = OpVariable %_ptr_Function_int Function %26 + OpStore %c %93 + %97 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0 + %98 = OpLoad %float %97 + %100 = OpFDiv %float %98 %float_8 + %99 = OpExtInst %float %56 RoundEven %100 + OpStore %thirty_two_1 %99 + %102 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %103 = OpLoad %float %102 + OpStore %param %103 + %104 = OpLoad %float %thirty_two_1 + OpStore %param_1 %104 + %105 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1 + %108 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %108 %105 + %110 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %111 = OpLoad %float %110 + OpStore %param_2 %111 + %112 = OpLoad %float %thirty_two_1 + OpStore %param_3 %112 + %113 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3 + %116 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %116 %113 + %117 = OpAccessChain %_ptr_Function_float %c %uint_0 + %118 = OpLoad %float %117 + %119 = OpAccessChain %_ptr_Function_float %c %uint_1 + %120 = OpLoad %float %119 + %122 = OpAccessChain %_ptr_Function_float %c %uint_2 + %123 = OpFAdd %float %118 %120 + OpStore %122 %123 + OpStore %i_1 %int_0 + OpBranch %124 + %124 = OpLabel + OpLoopMerge %125 %126 None + OpBranch %127 + %127 = OpLabel + %128 = OpLoad %int %i_1 + %130 = OpSLessThan %bool %128 %int_3 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %133 + %132 = OpLabel + OpBranch %131 + %133 = OpLabel + OpBranch %125 + %131 = OpLabel + %134 = OpLoad %int %i_1 + %135 = OpAccessChain %_ptr_Function_float %c %134 + %136 = OpLoad %float %135 + %138 = OpFOrdGreaterThanEqual %bool %136 %float_1 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpLoad %int %i_1 + %142 = OpLoad %int %i_1 + %143 = OpAccessChain %_ptr_Function_float %c %142 + %144 = OpLoad %float %143 + %145 = OpLoad %int %i_1 + %146 = OpAccessChain %_ptr_Function_float %c %145 + %147 = OpLoad %float %146 + %148 = OpAccessChain %_ptr_Function_float %c %141 + %149 = OpFMul %float %144 %147 + OpStore %148 %149 + OpBranch %139 + %139 = OpLabel + OpBranch %126 + %126 = OpLabel + %150 = OpLoad %int %i_1 + %151 = OpIAdd %int %150 %int_1 + OpStore %i_1 %151 + OpBranch %124 + %125 = OpLabel + %152 = OpLoad %v3float %c + %154 = OpExtInst %v3float %56 FAbs %152 + %153 = OpExtInst %v3float %56 Normalize %154 + %155 = OpCompositeExtract %float %153 0 + %156 = OpCompositeExtract %float %153 1 + %157 = OpCompositeExtract %float %153 2 + %158 = OpCompositeConstruct %v4float %155 %156 %157 %float_1 + OpStore %x_GLF_color %158 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %159 +%tint_symbol_1 = OpFunctionParameter %main_out + %163 = OpLabel + %164 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %164 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %76 + %166 = OpLabel + %167 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %167 + %168 = OpFunctionCall %void %main_1 + %170 = OpLoad %v4float %x_GLF_color + %171 = OpCompositeConstruct %main_out %170 + %169 = OpFunctionCall %void %tint_symbol_3 %171 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..82eab45fc4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-float-mat-determinant-clamp/0.wgsl.expected.wgsl @@ -0,0 +1,116 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_13 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var result : f32; + var i : i32; + result = -0.5; + i = 1; + loop { + let x_111 : i32 = i; + if ((x_111 < 800)) { + } else { + break; + } + let x_114 : i32 = i; + if (((x_114 % 32) == 0)) { + let x_120 : f32 = result; + result = (x_120 + 0.400000006); + } else { + let x_122 : i32 = i; + let x_124 : f32 = *(thirty_two); + if (((f32(x_122) % round(x_124)) <= 0.01)) { + let x_130 : f32 = result; + result = (x_130 + 100.0); + } + } + let x_132 : i32 = i; + let x_134 : f32 = *(limit); + if ((f32(x_132) >= x_134)) { + let x_138 : f32 = result; + return x_138; + } + + continuing { + let x_139 : i32 = i; + i = (x_139 + 1); + } + } + let x_141 : f32 = result; + return x_141; +} + +fn main_1() { + var c : vec3; + var thirty_two_1 : f32; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var i_1 : i32; + c = vec3(7.0, 8.0, 9.0); + let x_56 : f32 = x_13.resolution.x; + thirty_two_1 = round((x_56 / 8.0)); + let x_60 : f32 = gl_FragCoord.x; + param = x_60; + let x_61 : f32 = thirty_two_1; + param_1 = x_61; + let x_62 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_62; + let x_65 : f32 = gl_FragCoord.y; + param_2 = x_65; + let x_66 : f32 = thirty_two_1; + param_3 = x_66; + let x_67 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_67; + let x_70 : f32 = c.x; + let x_72 : f32 = c.y; + c.z = (x_70 + x_72); + i_1 = 0; + loop { + let x_79 : i32 = i_1; + if ((x_79 < 3)) { + } else { + break; + } + let x_82 : i32 = i_1; + let x_84 : f32 = c[x_82]; + if ((x_84 >= 1.0)) { + let x_88 : i32 = i_1; + let x_89 : i32 = i_1; + let x_91 : f32 = c[x_89]; + let x_92 : i32 = i_1; + let x_94 : f32 = c[x_92]; + c[x_88] = (x_91 * x_94); + } + + continuing { + let x_97 : i32 = i_1; + i_1 = (x_97 + 1); + } + } + let x_99 : vec3 = c; + let x_101 : vec3 = normalize(abs(x_99)); + x_GLF_color = vec4(x_101.x, x_101.y, x_101.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm new file mode 100644 index 0000000000..7200b4f217 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm @@ -0,0 +1,244 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %compute_value_f1_f1_ "compute_value(f1;f1;" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %result "result" + OpName %i "i" + OpName %c "c" + OpName %thirty_two_0 "thirty_two" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %i_0 "i" + OpName %_GLF_color "_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %__0 "" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %22 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %25 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %float_n0_5 = OpConstant %float -0.5 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %42 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %main = OpFunction %void None %22 + %57 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function +%thirty_two_0 = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_float Function + %param_1 = OpVariable %_ptr_Function_float Function + %param_2 = OpVariable %_ptr_Function_float Function + %i_0 = OpVariable %_ptr_Function_int Function + %58 = OpVariable %_ptr_Function_v3float Function + OpStore %c %42 + %59 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %60 = OpLoad %float %59 + %61 = OpFDiv %float %60 %float_8 + %62 = OpExtInst %float %1 Round %61 + OpStore %thirty_two_0 %62 + %63 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %64 = OpLoad %float %63 + OpStore %param %64 + %65 = OpLoad %float %thirty_two_0 + OpStore %param_0 %65 + %66 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_0 + %67 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %67 %66 + %68 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %69 = OpLoad %float %68 + OpStore %param_1 %69 + %70 = OpLoad %float %thirty_two_0 + OpStore %param_2 %70 + %71 = OpFunctionCall %float %compute_value_f1_f1_ %param_1 %param_2 + %72 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %72 %71 + %73 = OpAccessChain %_ptr_Function_float %c %uint_0 + %74 = OpLoad %float %73 + %75 = OpAccessChain %_ptr_Function_float %c %uint_1 + %76 = OpLoad %float %75 + %77 = OpFAdd %float %74 %76 + %78 = OpAccessChain %_ptr_Function_float %c %uint_2 + OpStore %78 %77 + OpStore %i_0 %int_0 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %83 = OpLoad %int %i_0 + %84 = OpSLessThan %bool %83 %int_3 + OpBranchConditional %84 %85 %80 + %85 = OpLabel + %86 = OpLoad %int %i_0 + %87 = OpAccessChain %_ptr_Function_float %c %86 + %88 = OpLoad %float %87 + %89 = OpFOrdGreaterThanEqual %bool %88 %float_1 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + %92 = OpLoad %int %i_0 + %93 = OpLoad %int %i_0 + %94 = OpAccessChain %_ptr_Function_float %c %93 + %95 = OpLoad %float %94 + %96 = OpLoad %int %i_0 + %97 = OpAccessChain %_ptr_Function_float %c %96 + %98 = OpLoad %float %97 + %99 = OpFMul %float %95 %98 + %100 = OpAccessChain %_ptr_Function_float %c %92 + OpStore %100 %99 + OpBranch %90 + %90 = OpLabel + OpBranch %81 + %81 = OpLabel + %101 = OpLoad %int %i_0 + %102 = OpIAdd %int %101 %int_1 + OpStore %i_0 %102 + OpBranch %79 + %80 = OpLabel + %103 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %104 = OpLoad %float %103 + %105 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %106 = OpLoad %float %105 + %107 = OpFOrdLessThan %bool %104 %106 + OpSelectionMerge %108 None + OpBranchConditional %107 %109 %110 + %109 = OpLabel + %111 = OpLoad %v3float %c + %112 = OpExtInst %v3float %1 FAbs %111 + OpStore %58 %112 + OpBranch %108 + %110 = OpLabel + %113 = OpLoad %v3float %c + OpStore %58 %113 + OpBranch %108 + %108 = OpLabel + %114 = OpLoad %v3float %58 + %115 = OpExtInst %v3float %1 Normalize %114 + %116 = OpCompositeExtract %float %115 0 + %117 = OpCompositeExtract %float %115 1 + %118 = OpCompositeExtract %float %115 2 + %119 = OpCompositeConstruct %v4float %116 %117 %118 %float_1 + OpStore %_GLF_color %119 + OpReturn + OpFunctionEnd +%compute_value_f1_f1_ = OpFunction %float None %25 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %120 = OpLabel + %result = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + OpStore %result %float_n0_5 + OpStore %i %int_1 + OpBranch %121 + %121 = OpLabel + OpLoopMerge %122 %123 None + OpBranch %124 + %124 = OpLabel + %125 = OpLoad %int %i + %126 = OpSLessThan %bool %125 %int_800 + OpBranchConditional %126 %127 %122 + %127 = OpLabel + %128 = OpLoad %int %i + %129 = OpSMod %int %128 %int_32 + %130 = OpIEqual %bool %129 %int_0 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %133 + %132 = OpLabel + %134 = OpLoad %float %result + %135 = OpFAdd %float %134 %float_0_400000006 + OpStore %result %135 + OpBranch %131 + %133 = OpLabel + %136 = OpLoad %int %i + %137 = OpConvertSToF %float %136 + %138 = OpLoad %float %thirty_two + %139 = OpExtInst %float %1 Round %138 + %140 = OpFMod %float %137 %139 + %141 = OpFOrdLessThanEqual %bool %140 %float_0_00999999978 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %142 + %143 = OpLabel + %144 = OpLoad %float %result + %145 = OpFAdd %float %144 %float_100 + OpStore %result %145 + OpBranch %142 + %142 = OpLabel + OpBranch %131 + %131 = OpLabel + %146 = OpLoad %int %i + %147 = OpConvertSToF %float %146 + %148 = OpLoad %float %limit + %149 = OpFOrdGreaterThanEqual %bool %147 %148 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %150 + %151 = OpLabel + %152 = OpLoad %float %result + OpReturnValue %152 + %150 = OpLabel + OpBranch %123 + %123 = OpLabel + %153 = OpLoad %int %i + %154 = OpIAdd %int %153 %int_1 + OpStore %i %154 + OpBranch %121 + %122 = OpLabel + %155 = OpLoad %float %result + OpReturnValue %155 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..91938cde6e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.hlsl @@ -0,0 +1,106 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_20 : register(b1, space0) { + uint4 x_20[1]; +}; + +float compute_value_f1_f1_(inout float limit, inout float thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + { + for(; (i < 800); i = (i + 1)) { + if (((i % 32) == 0)) { + result = (result + 0.400000006f); + } else { + const int x_136 = i; + const float x_138 = thirty_two; + if (((float(x_136) % round(x_138)) <= 0.01f)) { + result = (result + 100.0f); + } + } + const int x_146 = i; + const float x_148 = limit; + if ((float(x_146) >= x_148)) { + return result; + } + } + } + return result; +} + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int i_1 = 0; + float3 x_58 = float3(0.0f, 0.0f, 0.0f); + c = float3(7.0f, 8.0f, 9.0f); + const float x_60 = asfloat(x_13[0].x); + thirty_two_1 = round((x_60 / 8.0f)); + const float x_64 = gl_FragCoord.x; + param = x_64; + param_1 = thirty_two_1; + const float x_66 = compute_value_f1_f1_(param, param_1); + c.x = x_66; + const float x_69 = gl_FragCoord.y; + param_2 = x_69; + param_3 = thirty_two_1; + const float x_71 = compute_value_f1_f1_(param_2, param_3); + c.y = x_71; + const float x_74 = c.x; + const float x_76 = c.y; + c.z = (x_74 + x_76); + i_1 = 0; + { + for(; (i_1 < 3); i_1 = (i_1 + 1)) { + const float x_88 = c[i_1]; + if ((x_88 >= 1.0f)) { + const int x_92 = i_1; + const float x_95 = c[i_1]; + const float x_98 = c[i_1]; + set_float3(c, x_92, (x_95 * x_98)); + } + } + } + const float x_104 = asfloat(x_20[0].x); + const float x_106 = asfloat(x_20[0].y); + if ((x_104 < x_106)) { + x_58 = abs(c); + } else { + x_58 = c; + } + const float3 x_115 = normalize(x_58); + x_GLF_color = float4(x_115.x, x_115.y, x_115.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.msl new file mode 100755 index 0000000000..6f17012f09 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.msl @@ -0,0 +1,135 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float compute_value_f1_f1_(thread float* const limit, thread float* const thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + while (true) { + int const x_125 = i; + if ((x_125 < 800)) { + } else { + break; + } + int const x_128 = i; + if (((x_128 % 32) == 0)) { + float const x_134 = result; + result = (x_134 + 0.400000006f); + } else { + int const x_136 = i; + float const x_138 = *(thirty_two); + if (((float(x_136) % rint(x_138)) <= 0.01f)) { + float const x_144 = result; + result = (x_144 + 100.0f); + } + } + int const x_146 = i; + float const x_148 = *(limit); + if ((float(x_146) >= x_148)) { + float const x_152 = result; + return x_152; + } + { + int const x_153 = i; + i = (x_153 + 1); + } + } + float const x_155 = result; + return x_155; +} + +void main_1(constant buf0& x_13, constant buf1& x_20, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int i_1 = 0; + float3 x_58 = 0.0f; + c = float3(7.0f, 8.0f, 9.0f); + float const x_60 = x_13.resolution.x; + thirty_two_1 = rint((x_60 / 8.0f)); + float const x_64 = (*(tint_symbol_5)).x; + param = x_64; + float const x_65 = thirty_two_1; + param_1 = x_65; + float const x_66 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_66; + float const x_69 = (*(tint_symbol_5)).y; + param_2 = x_69; + float const x_70 = thirty_two_1; + param_3 = x_70; + float const x_71 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_71; + float const x_74 = c.x; + float const x_76 = c.y; + c.z = (x_74 + x_76); + i_1 = 0; + while (true) { + int const x_83 = i_1; + if ((x_83 < 3)) { + } else { + break; + } + int const x_86 = i_1; + float const x_88 = c[x_86]; + if ((x_88 >= 1.0f)) { + int const x_92 = i_1; + int const x_93 = i_1; + float const x_95 = c[x_93]; + int const x_96 = i_1; + float const x_98 = c[x_96]; + c[x_92] = (x_95 * x_98); + } + { + int const x_101 = i_1; + i_1 = (x_101 + 1); + } + } + float const x_104 = x_20.injectionSwitch.x; + float const x_106 = x_20.injectionSwitch.y; + if ((x_104 < x_106)) { + float3 const x_111 = c; + x_58 = fabs(x_111); + } else { + float3 const x_113 = c; + x_58 = x_113; + } + float3 const x_114 = x_58; + float3 const x_115 = normalize(x_114); + *(tint_symbol_6) = float4(x_115.x, x_115.y, x_115.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]], constant buf1& x_20 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_13, x_20, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\u8uo.0.metal:35:26: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_136) % rint(x_138)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..91ba40fbfe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.spvasm @@ -0,0 +1,295 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 186 +; Schema: 0 + OpCapability Shader + %59 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_13 "x_13" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_20 "x_20" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %compute_value_f1_f1_ "compute_value_f1_f1_" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %result "result" + OpName %i "i" + OpName %main_1 "main_1" + OpName %c "c" + OpName %thirty_two_1 "thirty_two_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %i_1 "i_1" + OpName %x_58 "x_58" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_20 NonWritable + OpDecorate %x_20 DescriptorSet 0 + OpDecorate %x_20 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_20 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %25 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %void = OpTypeVoid + %79 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %86 = OpConstantNull %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %97 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %173 = OpTypeFunction %void %main_out +%compute_value_f1_f1_ = OpFunction %float None %18 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %23 = OpLabel + %result = OpVariable %_ptr_Function_float Function %25 + %i = OpVariable %_ptr_Function_int Function %29 + OpStore %result %float_n0_5 + OpStore %i %int_1 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %38 = OpSLessThan %bool %36 %int_800 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %33 + %40 = OpLabel + %43 = OpLoad %int %i + %45 = OpSMod %int %43 %int_32 + %47 = OpIEqual %bool %45 %int_0 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + %51 = OpLoad %float %result + %53 = OpFAdd %float %51 %float_0_400000006 + OpStore %result %53 + OpBranch %48 + %50 = OpLabel + %54 = OpLoad %int %i + %56 = OpLoad %float %thirty_two + %57 = OpConvertSToF %float %54 + %58 = OpExtInst %float %59 RoundEven %56 + %60 = OpFMod %float %57 %58 + %62 = OpFOrdLessThanEqual %bool %60 %float_0_00999999978 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + %65 = OpLoad %float %result + %67 = OpFAdd %float %65 %float_100 + OpStore %result %67 + OpBranch %63 + %63 = OpLabel + OpBranch %48 + %48 = OpLabel + %68 = OpLoad %int %i + %70 = OpLoad %float %limit + %71 = OpConvertSToF %float %68 + %72 = OpFOrdGreaterThanEqual %bool %71 %70 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpLoad %float %result + OpReturnValue %75 + %73 = OpLabel + OpBranch %34 + %34 = OpLabel + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + OpBranch %32 + %33 = OpLabel + %78 = OpLoad %float %result + OpReturnValue %78 + OpFunctionEnd + %main_1 = OpFunction %void None %79 + %82 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %86 +%thirty_two_1 = OpVariable %_ptr_Function_float Function %25 + %param = OpVariable %_ptr_Function_float Function %25 + %param_1 = OpVariable %_ptr_Function_float Function %25 + %param_2 = OpVariable %_ptr_Function_float Function %25 + %param_3 = OpVariable %_ptr_Function_float Function %25 + %i_1 = OpVariable %_ptr_Function_int Function %29 + %x_58 = OpVariable %_ptr_Function_v3float Function %86 + OpStore %c %97 + %101 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0 + %102 = OpLoad %float %101 + %104 = OpFDiv %float %102 %float_8 + %103 = OpExtInst %float %59 RoundEven %104 + OpStore %thirty_two_1 %103 + %106 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %107 = OpLoad %float %106 + OpStore %param %107 + %108 = OpLoad %float %thirty_two_1 + OpStore %param_1 %108 + %109 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1 + %112 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %112 %109 + %114 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %115 = OpLoad %float %114 + OpStore %param_2 %115 + %116 = OpLoad %float %thirty_two_1 + OpStore %param_3 %116 + %117 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3 + %120 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %120 %117 + %121 = OpAccessChain %_ptr_Function_float %c %uint_0 + %122 = OpLoad %float %121 + %123 = OpAccessChain %_ptr_Function_float %c %uint_1 + %124 = OpLoad %float %123 + %126 = OpAccessChain %_ptr_Function_float %c %uint_2 + %127 = OpFAdd %float %122 %124 + OpStore %126 %127 + OpStore %i_1 %int_0 + OpBranch %128 + %128 = OpLabel + OpLoopMerge %129 %130 None + OpBranch %131 + %131 = OpLabel + %132 = OpLoad %int %i_1 + %134 = OpSLessThan %bool %132 %int_3 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 + %136 = OpLabel + OpBranch %135 + %137 = OpLabel + OpBranch %129 + %135 = OpLabel + %138 = OpLoad %int %i_1 + %139 = OpAccessChain %_ptr_Function_float %c %138 + %140 = OpLoad %float %139 + %142 = OpFOrdGreaterThanEqual %bool %140 %float_1 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %143 + %144 = OpLabel + %145 = OpLoad %int %i_1 + %146 = OpLoad %int %i_1 + %147 = OpAccessChain %_ptr_Function_float %c %146 + %148 = OpLoad %float %147 + %149 = OpLoad %int %i_1 + %150 = OpAccessChain %_ptr_Function_float %c %149 + %151 = OpLoad %float %150 + %152 = OpAccessChain %_ptr_Function_float %c %145 + %153 = OpFMul %float %148 %151 + OpStore %152 %153 + OpBranch %143 + %143 = OpLabel + OpBranch %130 + %130 = OpLabel + %154 = OpLoad %int %i_1 + %155 = OpIAdd %int %154 %int_1 + OpStore %i_1 %155 + OpBranch %128 + %129 = OpLabel + %156 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 %uint_0 + %157 = OpLoad %float %156 + %158 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 %uint_1 + %159 = OpLoad %float %158 + %160 = OpFOrdLessThan %bool %157 %159 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + %164 = OpLoad %v3float %c + %165 = OpExtInst %v3float %59 FAbs %164 + OpStore %x_58 %165 + OpBranch %161 + %163 = OpLabel + %166 = OpLoad %v3float %c + OpStore %x_58 %166 + OpBranch %161 + %161 = OpLabel + %167 = OpLoad %v3float %x_58 + %168 = OpExtInst %v3float %59 Normalize %167 + %169 = OpCompositeExtract %float %168 0 + %170 = OpCompositeExtract %float %168 1 + %171 = OpCompositeExtract %float %168 2 + %172 = OpCompositeConstruct %v4float %169 %170 %171 %float_1 + OpStore %x_GLF_color %172 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %173 +%tint_symbol_1 = OpFunctionParameter %main_out + %177 = OpLabel + %178 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %178 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %79 + %180 = OpLabel + %181 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %181 + %182 = OpFunctionCall %void %main_1 + %184 = OpLoad %v4float %x_GLF_color + %185 = OpCompositeConstruct %main_out %184 + %183 = OpFunctionCall %void %tint_symbol_3 %185 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..60de1ab83f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.spvasm.expected.wgsl @@ -0,0 +1,133 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_13 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_20 : buf1; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var result : f32; + var i : i32; + result = -0.5; + i = 1; + loop { + let x_125 : i32 = i; + if ((x_125 < 800)) { + } else { + break; + } + let x_128 : i32 = i; + if (((x_128 % 32) == 0)) { + let x_134 : f32 = result; + result = (x_134 + 0.400000006); + } else { + let x_136 : i32 = i; + let x_138 : f32 = *(thirty_two); + if (((f32(x_136) % round(x_138)) <= 0.01)) { + let x_144 : f32 = result; + result = (x_144 + 100.0); + } + } + let x_146 : i32 = i; + let x_148 : f32 = *(limit); + if ((f32(x_146) >= x_148)) { + let x_152 : f32 = result; + return x_152; + } + + continuing { + let x_153 : i32 = i; + i = (x_153 + 1); + } + } + let x_155 : f32 = result; + return x_155; +} + +fn main_1() { + var c : vec3; + var thirty_two_1 : f32; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var i_1 : i32; + var x_58 : vec3; + c = vec3(7.0, 8.0, 9.0); + let x_60 : f32 = x_13.resolution.x; + thirty_two_1 = round((x_60 / 8.0)); + let x_64 : f32 = gl_FragCoord.x; + param = x_64; + let x_65 : f32 = thirty_two_1; + param_1 = x_65; + let x_66 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_66; + let x_69 : f32 = gl_FragCoord.y; + param_2 = x_69; + let x_70 : f32 = thirty_two_1; + param_3 = x_70; + let x_71 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_71; + let x_74 : f32 = c.x; + let x_76 : f32 = c.y; + c.z = (x_74 + x_76); + i_1 = 0; + loop { + let x_83 : i32 = i_1; + if ((x_83 < 3)) { + } else { + break; + } + let x_86 : i32 = i_1; + let x_88 : f32 = c[x_86]; + if ((x_88 >= 1.0)) { + let x_92 : i32 = i_1; + let x_93 : i32 = i_1; + let x_95 : f32 = c[x_93]; + let x_96 : i32 = i_1; + let x_98 : f32 = c[x_96]; + c[x_92] = (x_95 * x_98); + } + + continuing { + let x_101 : i32 = i_1; + i_1 = (x_101 + 1); + } + } + let x_104 : f32 = x_20.injectionSwitch.x; + let x_106 : f32 = x_20.injectionSwitch.y; + if ((x_104 < x_106)) { + let x_111 : vec3 = c; + x_58 = abs(x_111); + } else { + let x_113 : vec3 = c; + x_58 = x_113; + } + let x_114 : vec3 = x_58; + let x_115 : vec3 = normalize(x_114); + x_GLF_color = vec4(x_115.x, x_115.y, x_115.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl new file mode 100644 index 0000000000..60de1ab83f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl @@ -0,0 +1,133 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_13 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_20 : buf1; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var result : f32; + var i : i32; + result = -0.5; + i = 1; + loop { + let x_125 : i32 = i; + if ((x_125 < 800)) { + } else { + break; + } + let x_128 : i32 = i; + if (((x_128 % 32) == 0)) { + let x_134 : f32 = result; + result = (x_134 + 0.400000006); + } else { + let x_136 : i32 = i; + let x_138 : f32 = *(thirty_two); + if (((f32(x_136) % round(x_138)) <= 0.01)) { + let x_144 : f32 = result; + result = (x_144 + 100.0); + } + } + let x_146 : i32 = i; + let x_148 : f32 = *(limit); + if ((f32(x_146) >= x_148)) { + let x_152 : f32 = result; + return x_152; + } + + continuing { + let x_153 : i32 = i; + i = (x_153 + 1); + } + } + let x_155 : f32 = result; + return x_155; +} + +fn main_1() { + var c : vec3; + var thirty_two_1 : f32; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var i_1 : i32; + var x_58 : vec3; + c = vec3(7.0, 8.0, 9.0); + let x_60 : f32 = x_13.resolution.x; + thirty_two_1 = round((x_60 / 8.0)); + let x_64 : f32 = gl_FragCoord.x; + param = x_64; + let x_65 : f32 = thirty_two_1; + param_1 = x_65; + let x_66 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_66; + let x_69 : f32 = gl_FragCoord.y; + param_2 = x_69; + let x_70 : f32 = thirty_two_1; + param_3 = x_70; + let x_71 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_71; + let x_74 : f32 = c.x; + let x_76 : f32 = c.y; + c.z = (x_74 + x_76); + i_1 = 0; + loop { + let x_83 : i32 = i_1; + if ((x_83 < 3)) { + } else { + break; + } + let x_86 : i32 = i_1; + let x_88 : f32 = c[x_86]; + if ((x_88 >= 1.0)) { + let x_92 : i32 = i_1; + let x_93 : i32 = i_1; + let x_95 : f32 = c[x_93]; + let x_96 : i32 = i_1; + let x_98 : f32 = c[x_96]; + c[x_92] = (x_95 * x_98); + } + + continuing { + let x_101 : i32 = i_1; + i_1 = (x_101 + 1); + } + } + let x_104 : f32 = x_20.injectionSwitch.x; + let x_106 : f32 = x_20.injectionSwitch.y; + if ((x_104 < x_106)) { + let x_111 : vec3 = c; + x_58 = abs(x_111); + } else { + let x_113 : vec3 = c; + x_58 = x_113; + } + let x_114 : vec3 = x_58; + let x_115 : vec3 = normalize(x_114); + x_GLF_color = vec4(x_115.x, x_115.y, x_115.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..91938cde6e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.hlsl @@ -0,0 +1,106 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_20 : register(b1, space0) { + uint4 x_20[1]; +}; + +float compute_value_f1_f1_(inout float limit, inout float thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + { + for(; (i < 800); i = (i + 1)) { + if (((i % 32) == 0)) { + result = (result + 0.400000006f); + } else { + const int x_136 = i; + const float x_138 = thirty_two; + if (((float(x_136) % round(x_138)) <= 0.01f)) { + result = (result + 100.0f); + } + } + const int x_146 = i; + const float x_148 = limit; + if ((float(x_146) >= x_148)) { + return result; + } + } + } + return result; +} + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int i_1 = 0; + float3 x_58 = float3(0.0f, 0.0f, 0.0f); + c = float3(7.0f, 8.0f, 9.0f); + const float x_60 = asfloat(x_13[0].x); + thirty_two_1 = round((x_60 / 8.0f)); + const float x_64 = gl_FragCoord.x; + param = x_64; + param_1 = thirty_two_1; + const float x_66 = compute_value_f1_f1_(param, param_1); + c.x = x_66; + const float x_69 = gl_FragCoord.y; + param_2 = x_69; + param_3 = thirty_two_1; + const float x_71 = compute_value_f1_f1_(param_2, param_3); + c.y = x_71; + const float x_74 = c.x; + const float x_76 = c.y; + c.z = (x_74 + x_76); + i_1 = 0; + { + for(; (i_1 < 3); i_1 = (i_1 + 1)) { + const float x_88 = c[i_1]; + if ((x_88 >= 1.0f)) { + const int x_92 = i_1; + const float x_95 = c[i_1]; + const float x_98 = c[i_1]; + set_float3(c, x_92, (x_95 * x_98)); + } + } + } + const float x_104 = asfloat(x_20[0].x); + const float x_106 = asfloat(x_20[0].y); + if ((x_104 < x_106)) { + x_58 = abs(c); + } else { + x_58 = c; + } + const float3 x_115 = normalize(x_58); + x_GLF_color = float4(x_115.x, x_115.y, x_115.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.msl new file mode 100755 index 0000000000..d03ce1e114 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.msl @@ -0,0 +1,135 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float compute_value_f1_f1_(thread float* const limit, thread float* const thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + while (true) { + int const x_125 = i; + if ((x_125 < 800)) { + } else { + break; + } + int const x_128 = i; + if (((x_128 % 32) == 0)) { + float const x_134 = result; + result = (x_134 + 0.400000006f); + } else { + int const x_136 = i; + float const x_138 = *(thirty_two); + if (((float(x_136) % rint(x_138)) <= 0.01f)) { + float const x_144 = result; + result = (x_144 + 100.0f); + } + } + int const x_146 = i; + float const x_148 = *(limit); + if ((float(x_146) >= x_148)) { + float const x_152 = result; + return x_152; + } + { + int const x_153 = i; + i = (x_153 + 1); + } + } + float const x_155 = result; + return x_155; +} + +void main_1(constant buf0& x_13, constant buf1& x_20, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int i_1 = 0; + float3 x_58 = 0.0f; + c = float3(7.0f, 8.0f, 9.0f); + float const x_60 = x_13.resolution.x; + thirty_two_1 = rint((x_60 / 8.0f)); + float const x_64 = (*(tint_symbol_5)).x; + param = x_64; + float const x_65 = thirty_two_1; + param_1 = x_65; + float const x_66 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_66; + float const x_69 = (*(tint_symbol_5)).y; + param_2 = x_69; + float const x_70 = thirty_two_1; + param_3 = x_70; + float const x_71 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_71; + float const x_74 = c.x; + float const x_76 = c.y; + c.z = (x_74 + x_76); + i_1 = 0; + while (true) { + int const x_83 = i_1; + if ((x_83 < 3)) { + } else { + break; + } + int const x_86 = i_1; + float const x_88 = c[x_86]; + if ((x_88 >= 1.0f)) { + int const x_92 = i_1; + int const x_93 = i_1; + float const x_95 = c[x_93]; + int const x_96 = i_1; + float const x_98 = c[x_96]; + c[x_92] = (x_95 * x_98); + } + { + int const x_101 = i_1; + i_1 = (x_101 + 1); + } + } + float const x_104 = x_20.injectionSwitch.x; + float const x_106 = x_20.injectionSwitch.y; + if ((x_104 < x_106)) { + float3 const x_111 = c; + x_58 = fabs(x_111); + } else { + float3 const x_113 = c; + x_58 = x_113; + } + float3 const x_114 = x_58; + float3 const x_115 = normalize(x_114); + *(tint_symbol_6) = float4(x_115.x, x_115.y, x_115.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]], constant buf1& x_20 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_13, x_20, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\uf2s.0.metal:35:26: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_136) % rint(x_138)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..91ba40fbfe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.spvasm @@ -0,0 +1,295 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 186 +; Schema: 0 + OpCapability Shader + %59 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_13 "x_13" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_20 "x_20" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %compute_value_f1_f1_ "compute_value_f1_f1_" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %result "result" + OpName %i "i" + OpName %main_1 "main_1" + OpName %c "c" + OpName %thirty_two_1 "thirty_two_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %i_1 "i_1" + OpName %x_58 "x_58" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_20 NonWritable + OpDecorate %x_20 DescriptorSet 0 + OpDecorate %x_20 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_20 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %25 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %void = OpTypeVoid + %79 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %86 = OpConstantNull %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %97 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %173 = OpTypeFunction %void %main_out +%compute_value_f1_f1_ = OpFunction %float None %18 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %23 = OpLabel + %result = OpVariable %_ptr_Function_float Function %25 + %i = OpVariable %_ptr_Function_int Function %29 + OpStore %result %float_n0_5 + OpStore %i %int_1 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %38 = OpSLessThan %bool %36 %int_800 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %33 + %40 = OpLabel + %43 = OpLoad %int %i + %45 = OpSMod %int %43 %int_32 + %47 = OpIEqual %bool %45 %int_0 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + %51 = OpLoad %float %result + %53 = OpFAdd %float %51 %float_0_400000006 + OpStore %result %53 + OpBranch %48 + %50 = OpLabel + %54 = OpLoad %int %i + %56 = OpLoad %float %thirty_two + %57 = OpConvertSToF %float %54 + %58 = OpExtInst %float %59 RoundEven %56 + %60 = OpFMod %float %57 %58 + %62 = OpFOrdLessThanEqual %bool %60 %float_0_00999999978 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + %65 = OpLoad %float %result + %67 = OpFAdd %float %65 %float_100 + OpStore %result %67 + OpBranch %63 + %63 = OpLabel + OpBranch %48 + %48 = OpLabel + %68 = OpLoad %int %i + %70 = OpLoad %float %limit + %71 = OpConvertSToF %float %68 + %72 = OpFOrdGreaterThanEqual %bool %71 %70 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpLoad %float %result + OpReturnValue %75 + %73 = OpLabel + OpBranch %34 + %34 = OpLabel + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + OpBranch %32 + %33 = OpLabel + %78 = OpLoad %float %result + OpReturnValue %78 + OpFunctionEnd + %main_1 = OpFunction %void None %79 + %82 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %86 +%thirty_two_1 = OpVariable %_ptr_Function_float Function %25 + %param = OpVariable %_ptr_Function_float Function %25 + %param_1 = OpVariable %_ptr_Function_float Function %25 + %param_2 = OpVariable %_ptr_Function_float Function %25 + %param_3 = OpVariable %_ptr_Function_float Function %25 + %i_1 = OpVariable %_ptr_Function_int Function %29 + %x_58 = OpVariable %_ptr_Function_v3float Function %86 + OpStore %c %97 + %101 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0 + %102 = OpLoad %float %101 + %104 = OpFDiv %float %102 %float_8 + %103 = OpExtInst %float %59 RoundEven %104 + OpStore %thirty_two_1 %103 + %106 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %107 = OpLoad %float %106 + OpStore %param %107 + %108 = OpLoad %float %thirty_two_1 + OpStore %param_1 %108 + %109 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1 + %112 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %112 %109 + %114 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %115 = OpLoad %float %114 + OpStore %param_2 %115 + %116 = OpLoad %float %thirty_two_1 + OpStore %param_3 %116 + %117 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3 + %120 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %120 %117 + %121 = OpAccessChain %_ptr_Function_float %c %uint_0 + %122 = OpLoad %float %121 + %123 = OpAccessChain %_ptr_Function_float %c %uint_1 + %124 = OpLoad %float %123 + %126 = OpAccessChain %_ptr_Function_float %c %uint_2 + %127 = OpFAdd %float %122 %124 + OpStore %126 %127 + OpStore %i_1 %int_0 + OpBranch %128 + %128 = OpLabel + OpLoopMerge %129 %130 None + OpBranch %131 + %131 = OpLabel + %132 = OpLoad %int %i_1 + %134 = OpSLessThan %bool %132 %int_3 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 + %136 = OpLabel + OpBranch %135 + %137 = OpLabel + OpBranch %129 + %135 = OpLabel + %138 = OpLoad %int %i_1 + %139 = OpAccessChain %_ptr_Function_float %c %138 + %140 = OpLoad %float %139 + %142 = OpFOrdGreaterThanEqual %bool %140 %float_1 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %143 + %144 = OpLabel + %145 = OpLoad %int %i_1 + %146 = OpLoad %int %i_1 + %147 = OpAccessChain %_ptr_Function_float %c %146 + %148 = OpLoad %float %147 + %149 = OpLoad %int %i_1 + %150 = OpAccessChain %_ptr_Function_float %c %149 + %151 = OpLoad %float %150 + %152 = OpAccessChain %_ptr_Function_float %c %145 + %153 = OpFMul %float %148 %151 + OpStore %152 %153 + OpBranch %143 + %143 = OpLabel + OpBranch %130 + %130 = OpLabel + %154 = OpLoad %int %i_1 + %155 = OpIAdd %int %154 %int_1 + OpStore %i_1 %155 + OpBranch %128 + %129 = OpLabel + %156 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 %uint_0 + %157 = OpLoad %float %156 + %158 = OpAccessChain %_ptr_Uniform_float %x_20 %uint_0 %uint_1 + %159 = OpLoad %float %158 + %160 = OpFOrdLessThan %bool %157 %159 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %163 + %162 = OpLabel + %164 = OpLoad %v3float %c + %165 = OpExtInst %v3float %59 FAbs %164 + OpStore %x_58 %165 + OpBranch %161 + %163 = OpLabel + %166 = OpLoad %v3float %c + OpStore %x_58 %166 + OpBranch %161 + %161 = OpLabel + %167 = OpLoad %v3float %x_58 + %168 = OpExtInst %v3float %59 Normalize %167 + %169 = OpCompositeExtract %float %168 0 + %170 = OpCompositeExtract %float %168 1 + %171 = OpCompositeExtract %float %168 2 + %172 = OpCompositeConstruct %v4float %169 %170 %171 %float_1 + OpStore %x_GLF_color %172 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %173 +%tint_symbol_1 = OpFunctionParameter %main_out + %177 = OpLabel + %178 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %178 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %79 + %180 = OpLabel + %181 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %181 + %182 = OpFunctionCall %void %main_1 + %184 = OpLoad %v4float %x_GLF_color + %185 = OpCompositeConstruct %main_out %184 + %183 = OpFunctionCall %void %tint_symbol_3 %185 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..60de1ab83f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-injected-conditional-true/1.wgsl.expected.wgsl @@ -0,0 +1,133 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_13 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +[[group(0), binding(1)]] var x_20 : buf1; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var result : f32; + var i : i32; + result = -0.5; + i = 1; + loop { + let x_125 : i32 = i; + if ((x_125 < 800)) { + } else { + break; + } + let x_128 : i32 = i; + if (((x_128 % 32) == 0)) { + let x_134 : f32 = result; + result = (x_134 + 0.400000006); + } else { + let x_136 : i32 = i; + let x_138 : f32 = *(thirty_two); + if (((f32(x_136) % round(x_138)) <= 0.01)) { + let x_144 : f32 = result; + result = (x_144 + 100.0); + } + } + let x_146 : i32 = i; + let x_148 : f32 = *(limit); + if ((f32(x_146) >= x_148)) { + let x_152 : f32 = result; + return x_152; + } + + continuing { + let x_153 : i32 = i; + i = (x_153 + 1); + } + } + let x_155 : f32 = result; + return x_155; +} + +fn main_1() { + var c : vec3; + var thirty_two_1 : f32; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var i_1 : i32; + var x_58 : vec3; + c = vec3(7.0, 8.0, 9.0); + let x_60 : f32 = x_13.resolution.x; + thirty_two_1 = round((x_60 / 8.0)); + let x_64 : f32 = gl_FragCoord.x; + param = x_64; + let x_65 : f32 = thirty_two_1; + param_1 = x_65; + let x_66 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_66; + let x_69 : f32 = gl_FragCoord.y; + param_2 = x_69; + let x_70 : f32 = thirty_two_1; + param_3 = x_70; + let x_71 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_71; + let x_74 : f32 = c.x; + let x_76 : f32 = c.y; + c.z = (x_74 + x_76); + i_1 = 0; + loop { + let x_83 : i32 = i_1; + if ((x_83 < 3)) { + } else { + break; + } + let x_86 : i32 = i_1; + let x_88 : f32 = c[x_86]; + if ((x_88 >= 1.0)) { + let x_92 : i32 = i_1; + let x_93 : i32 = i_1; + let x_95 : f32 = c[x_93]; + let x_96 : i32 = i_1; + let x_98 : f32 = c[x_96]; + c[x_92] = (x_95 * x_98); + } + + continuing { + let x_101 : i32 = i_1; + i_1 = (x_101 + 1); + } + } + let x_104 : f32 = x_20.injectionSwitch.x; + let x_106 : f32 = x_20.injectionSwitch.y; + if ((x_104 < x_106)) { + let x_111 : vec3 = c; + x_58 = abs(x_111); + } else { + let x_113 : vec3 = c; + x_58 = x_113; + } + let x_114 : vec3 = x_58; + let x_115 : vec3 = normalize(x_114); + x_GLF_color = vec4(x_115.x, x_115.y, x_115.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm new file mode 100644 index 0000000000..b9364132eb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm @@ -0,0 +1,180 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %compute_value_f1_f1_ "compute_value(f1;f1;" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %c "c" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %19 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %float_n0_5 = OpConstant %float -0.5 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %35 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%float_0_125 = OpConstant %float 0.125 + %main = OpFunction %void None %16 + %50 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_float Function + %param_1 = OpVariable %_ptr_Function_float Function + %param_2 = OpVariable %_ptr_Function_float Function + OpStore %c %35 + %51 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %52 = OpLoad %float %51 + %53 = OpFMul %float %52 %float_0_125 + %54 = OpExtInst %float %1 Round %53 + %55 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %56 = OpLoad %float %55 + OpStore %param %56 + OpStore %param_0 %54 + %57 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_0 + %58 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %58 %57 + %59 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %60 = OpLoad %float %59 + OpStore %param_1 %60 + OpStore %param_2 %54 + %61 = OpFunctionCall %float %compute_value_f1_f1_ %param_1 %param_2 + %62 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %62 %61 + %63 = OpLoad %float %58 + %64 = OpLoad %float %62 + %65 = OpFAdd %float %63 %64 + %66 = OpAccessChain %_ptr_Function_float %c %uint_2 + OpStore %66 %65 + OpBranch %67 + %67 = OpLabel + %68 = OpPhi %int %int_0 %50 %69 %70 + %71 = OpSLessThan %bool %68 %int_3 + OpLoopMerge %72 %70 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + %74 = OpAccessChain %_ptr_Function_float %c %68 + %75 = OpLoad %float %74 + %76 = OpFOrdGreaterThanEqual %bool %75 %float_1 + OpSelectionMerge %77 None + OpBranchConditional %76 %78 %77 + %78 = OpLabel + %79 = OpLoad %float %74 + %80 = OpLoad %float %74 + %81 = OpFMul %float %79 %80 + OpStore %74 %81 + OpBranch %77 + %77 = OpLabel + OpBranch %70 + %70 = OpLabel + %69 = OpIAdd %int %68 %int_1 + OpBranch %67 + %72 = OpLabel + %82 = OpLoad %v3float %c + %83 = OpExtInst %v3float %1 FAbs %82 + %84 = OpExtInst %v3float %1 Normalize %83 + %85 = OpCompositeExtract %float %84 0 + %86 = OpCompositeExtract %float %84 1 + %87 = OpCompositeExtract %float %84 2 + %88 = OpCompositeConstruct %v4float %85 %86 %87 %float_1 + OpStore %_GLF_color %88 + OpReturn + OpFunctionEnd +%compute_value_f1_f1_ = OpFunction %float None %19 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %89 = OpLabel + OpBranch %90 + %90 = OpLabel + %91 = OpPhi %float %float_n0_5 %89 %92 %93 + %94 = OpPhi %int %int_1 %89 %95 %93 + %96 = OpSLessThan %bool %94 %int_800 + OpLoopMerge %97 %93 None + OpBranchConditional %96 %98 %97 + %98 = OpLabel + %99 = OpSMod %int %94 %int_32 + %100 = OpIEqual %bool %99 %int_0 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %103 + %102 = OpLabel + %104 = OpFAdd %float %91 %float_0_400000006 + OpBranch %101 + %103 = OpLabel + %105 = OpConvertSToF %float %94 + %106 = OpLoad %float %thirty_two + %107 = OpExtInst %float %1 Round %106 + %108 = OpFMod %float %105 %107 + %109 = OpFOrdLessThanEqual %bool %108 %float_0_00999999978 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpFAdd %float %91 %float_100 + OpBranch %110 + %110 = OpLabel + %113 = OpPhi %float %91 %103 %112 %111 + OpBranch %101 + %101 = OpLabel + %92 = OpPhi %float %104 %102 %113 %110 + %114 = OpConvertSToF %float %94 + %115 = OpLoad %float %limit + %116 = OpFOrdGreaterThanEqual %bool %114 %115 + OpSelectionMerge %117 None + OpBranchConditional %116 %118 %117 + %118 = OpLabel + OpReturnValue %92 + %117 = OpLabel + OpBranch %93 + %93 = OpLabel + %95 = OpIAdd %int %94 %int_1 + OpBranch %90 + %97 = OpLabel + OpReturnValue %91 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..125f7d988e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.hlsl @@ -0,0 +1,123 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float compute_value_f1_f1_(inout float limit, inout float thirty_two) { + float x_91 = 0.0f; + float x_91_phi = 0.0f; + int x_94_phi = 0; + x_91_phi = -0.5f; + x_94_phi = 1; + while (true) { + float x_104 = 0.0f; + float x_113 = 0.0f; + int x_95 = 0; + float x_92_phi = 0.0f; + x_91 = x_91_phi; + const int x_94 = x_94_phi; + if ((x_94 < 800)) { + } else { + break; + } + float x_112 = 0.0f; + float x_113_phi = 0.0f; + if (((x_94 % 32) == 0)) { + x_104 = (x_91 + 0.400000006f); + x_92_phi = x_104; + } else { + const float x_106 = thirty_two; + x_113_phi = x_91; + if (((float(x_94) % round(x_106)) <= 0.01f)) { + x_112 = (x_91 + 100.0f); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_92_phi = x_113; + } + float x_92 = 0.0f; + x_92 = x_92_phi; + const float x_115 = limit; + if ((float(x_94) >= x_115)) { + return x_92; + } + { + x_95 = (x_94 + 1); + x_91_phi = x_92; + x_94_phi = x_95; + } + } + return x_91; +} + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int x_68_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_52 = asfloat(x_10[0].x); + const float x_54 = round((x_52 * 0.125f)); + const float x_56 = gl_FragCoord.x; + param = x_56; + param_1 = x_54; + const float x_57 = compute_value_f1_f1_(param, param_1); + c.x = x_57; + const float x_60 = gl_FragCoord.y; + param_2 = x_60; + param_3 = x_54; + const float x_61 = compute_value_f1_f1_(param_2, param_3); + c.y = x_61; + const float x_63 = c.x; + const float x_64 = c.y; + c.z = (x_63 + x_64); + x_68_phi = 0; + while (true) { + int x_69 = 0; + const int x_68 = x_68_phi; + if ((x_68 < 3)) { + } else { + break; + } + const int x_74_save = x_68; + const float x_75 = c[x_74_save]; + if ((x_75 >= 1.0f)) { + const float x_79 = c[x_74_save]; + const float x_80 = c[x_74_save]; + set_float3(c, x_74_save, (x_79 * x_80)); + } + { + x_69 = (x_68 + 1); + x_68_phi = x_69; + } + } + const float3 x_84 = normalize(abs(c)); + x_GLF_color = float4(x_84.x, x_84.y, x_84.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.msl new file mode 100755 index 0000000000..798c22142d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.msl @@ -0,0 +1,126 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float compute_value_f1_f1_(thread float* const limit, thread float* const thirty_two) { + float x_91 = 0.0f; + float x_91_phi = 0.0f; + int x_94_phi = 0; + x_91_phi = -0.5f; + x_94_phi = 1; + while (true) { + float x_104 = 0.0f; + float x_113 = 0.0f; + int x_95 = 0; + float x_92_phi = 0.0f; + x_91 = x_91_phi; + int const x_94 = x_94_phi; + if ((x_94 < 800)) { + } else { + break; + } + float x_112 = 0.0f; + float x_113_phi = 0.0f; + if (((x_94 % 32) == 0)) { + x_104 = (x_91 + 0.400000006f); + x_92_phi = x_104; + } else { + float const x_106 = *(thirty_two); + x_113_phi = x_91; + if (((float(x_94) % rint(x_106)) <= 0.01f)) { + x_112 = (x_91 + 100.0f); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_92_phi = x_113; + } + float x_92 = 0.0f; + x_92 = x_92_phi; + float const x_115 = *(limit); + if ((float(x_94) >= x_115)) { + return x_92; + } + { + x_95 = (x_94 + 1); + x_91_phi = x_92; + x_94_phi = x_95; + } + } + return x_91; +} + +void main_1(constant buf0& x_10, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int x_68_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_52 = x_10.resolution.x; + float const x_54 = rint((x_52 * 0.125f)); + float const x_56 = (*(tint_symbol_5)).x; + param = x_56; + param_1 = x_54; + float const x_57 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_57; + float const x_60 = (*(tint_symbol_5)).y; + param_2 = x_60; + param_3 = x_54; + float const x_61 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_61; + float const x_63 = c.x; + float const x_64 = c.y; + c.z = (x_63 + x_64); + x_68_phi = 0; + while (true) { + int x_69 = 0; + int const x_68 = x_68_phi; + if ((x_68 < 3)) { + } else { + break; + } + int const x_74_save = x_68; + float const x_75 = c[x_74_save]; + if ((x_75 >= 1.0f)) { + float const x_79 = c[x_74_save]; + float const x_80 = c[x_74_save]; + c[x_74_save] = (x_79 * x_80); + } + { + x_69 = (x_68 + 1); + x_68_phi = x_69; + } + } + float3 const x_82 = c; + float3 const x_84 = normalize(fabs(x_82)); + *(tint_symbol_6) = float4(x_84.x, x_84.y, x_84.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_10, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\u26w.0.metal:39:25: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_94) % rint(x_106)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..42303b9029 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.spvasm @@ -0,0 +1,291 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 180 +; Schema: 0 + OpCapability Shader + %64 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_10 "x_10" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %compute_value_f1_f1_ "compute_value_f1_f1_" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %x_91 "x_91" + OpName %x_91_phi "x_91_phi" + OpName %x_94_phi "x_94_phi" + OpName %x_104 "x_104" + OpName %x_113 "x_113" + OpName %x_95 "x_95" + OpName %x_92_phi "x_92_phi" + OpName %x_112 "x_112" + OpName %x_113_phi "x_113_phi" + OpName %x_92 "x_92" + OpName %main_1 "main_1" + OpName %c "c" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %x_68_phi "x_68_phi" + OpName %x_69 "x_69" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %22 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %void = OpTypeVoid + %89 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %96 = OpConstantNull %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %105 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0_125 = OpConstant %float 0.125 +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %167 = OpTypeFunction %void %main_out +%compute_value_f1_f1_ = OpFunction %float None %15 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %20 = OpLabel + %x_91 = OpVariable %_ptr_Function_float Function %22 + %x_91_phi = OpVariable %_ptr_Function_float Function %22 + %x_94_phi = OpVariable %_ptr_Function_int Function %27 + %x_104 = OpVariable %_ptr_Function_float Function %22 + %x_113 = OpVariable %_ptr_Function_float Function %22 + %x_95 = OpVariable %_ptr_Function_int Function %27 + %x_92_phi = OpVariable %_ptr_Function_float Function %22 + %x_112 = OpVariable %_ptr_Function_float Function %22 + %x_113_phi = OpVariable %_ptr_Function_float Function %22 + %x_92 = OpVariable %_ptr_Function_float Function %22 + OpStore %x_91_phi %float_n0_5 + OpStore %x_94_phi %int_1 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %38 = OpLoad %float %x_91_phi + OpStore %x_91 %38 + %39 = OpLoad %int %x_94_phi + %41 = OpSLessThan %bool %39 %int_800 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %31 + %43 = OpLabel + %49 = OpSMod %int %39 %int_32 + %51 = OpIEqual %bool %49 %int_0 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + %55 = OpLoad %float %x_91 + %57 = OpFAdd %float %55 %float_0_400000006 + OpStore %x_104 %57 + %58 = OpLoad %float %x_104 + OpStore %x_92_phi %58 + OpBranch %52 + %54 = OpLabel + %60 = OpLoad %float %thirty_two + %61 = OpLoad %float %x_91 + OpStore %x_113_phi %61 + %62 = OpConvertSToF %float %39 + %63 = OpExtInst %float %64 RoundEven %60 + %65 = OpFMod %float %62 %63 + %67 = OpFOrdLessThanEqual %bool %65 %float_0_00999999978 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + %70 = OpLoad %float %x_91 + %72 = OpFAdd %float %70 %float_100 + OpStore %x_112 %72 + %73 = OpLoad %float %x_112 + OpStore %x_113_phi %73 + OpBranch %68 + %68 = OpLabel + %74 = OpLoad %float %x_113_phi + OpStore %x_113 %74 + %75 = OpLoad %float %x_113 + OpStore %x_92_phi %75 + OpBranch %52 + %52 = OpLabel + %77 = OpLoad %float %x_92_phi + OpStore %x_92 %77 + %79 = OpLoad %float %limit + %80 = OpConvertSToF %float %39 + %81 = OpFOrdGreaterThanEqual %bool %80 %79 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %82 + %83 = OpLabel + %84 = OpLoad %float %x_92 + OpReturnValue %84 + %82 = OpLabel + OpBranch %32 + %32 = OpLabel + %85 = OpIAdd %int %39 %int_1 + OpStore %x_95 %85 + %86 = OpLoad %float %x_92 + OpStore %x_91_phi %86 + %87 = OpLoad %int %x_95 + OpStore %x_94_phi %87 + OpBranch %30 + %31 = OpLabel + %88 = OpLoad %float %x_91 + OpReturnValue %88 + OpFunctionEnd + %main_1 = OpFunction %void None %89 + %92 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %96 + %param = OpVariable %_ptr_Function_float Function %22 + %param_1 = OpVariable %_ptr_Function_float Function %22 + %param_2 = OpVariable %_ptr_Function_float Function %22 + %param_3 = OpVariable %_ptr_Function_float Function %22 + %x_68_phi = OpVariable %_ptr_Function_int Function %27 + %x_69 = OpVariable %_ptr_Function_int Function %27 + OpStore %c %105 + %109 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0 + %110 = OpLoad %float %109 + %113 = OpFMul %float %110 %float_0_125 + %111 = OpExtInst %float %64 RoundEven %113 + %115 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %116 = OpLoad %float %115 + OpStore %param %116 + OpStore %param_1 %111 + %117 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1 + %120 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %120 %117 + %122 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %123 = OpLoad %float %122 + OpStore %param_2 %123 + OpStore %param_3 %111 + %124 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3 + %127 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %127 %124 + %128 = OpAccessChain %_ptr_Function_float %c %uint_0 + %129 = OpLoad %float %128 + %130 = OpAccessChain %_ptr_Function_float %c %uint_1 + %131 = OpLoad %float %130 + %133 = OpAccessChain %_ptr_Function_float %c %uint_2 + %134 = OpFAdd %float %129 %131 + OpStore %133 %134 + OpStore %x_68_phi %int_0 + OpBranch %135 + %135 = OpLabel + OpLoopMerge %136 %137 None + OpBranch %138 + %138 = OpLabel + %140 = OpLoad %int %x_68_phi + %142 = OpSLessThan %bool %140 %int_3 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %145 + %144 = OpLabel + OpBranch %143 + %145 = OpLabel + OpBranch %136 + %143 = OpLabel + %146 = OpAccessChain %_ptr_Function_float %c %140 + %147 = OpLoad %float %146 + %149 = OpFOrdGreaterThanEqual %bool %147 %float_1 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %150 + %151 = OpLabel + %152 = OpAccessChain %_ptr_Function_float %c %140 + %153 = OpLoad %float %152 + %154 = OpAccessChain %_ptr_Function_float %c %140 + %155 = OpLoad %float %154 + %156 = OpAccessChain %_ptr_Function_float %c %140 + %157 = OpFMul %float %153 %155 + OpStore %156 %157 + OpBranch %150 + %150 = OpLabel + OpBranch %137 + %137 = OpLabel + %158 = OpIAdd %int %140 %int_1 + OpStore %x_69 %158 + %159 = OpLoad %int %x_69 + OpStore %x_68_phi %159 + OpBranch %135 + %136 = OpLabel + %160 = OpLoad %v3float %c + %162 = OpExtInst %v3float %64 FAbs %160 + %161 = OpExtInst %v3float %64 Normalize %162 + %163 = OpCompositeExtract %float %161 0 + %164 = OpCompositeExtract %float %161 1 + %165 = OpCompositeExtract %float %161 2 + %166 = OpCompositeConstruct %v4float %163 %164 %165 %float_1 + OpStore %x_GLF_color %166 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %167 +%tint_symbol_1 = OpFunctionParameter %main_out + %171 = OpLabel + %172 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %172 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %89 + %174 = OpLabel + %175 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %175 + %176 = OpFunctionCall %void %main_1 + %178 = OpLoad %v4float %x_GLF_color + %179 = OpCompositeConstruct %main_out %178 + %177 = OpFunctionCall %void %tint_symbol_3 %179 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ba37d915bc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.spvasm.expected.wgsl @@ -0,0 +1,122 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_10 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var x_91 : f32; + var x_91_phi : f32; + var x_94_phi : i32; + x_91_phi = -0.5; + x_94_phi = 1; + loop { + var x_104 : f32; + var x_113 : f32; + var x_95 : i32; + var x_92_phi : f32; + x_91 = x_91_phi; + let x_94 : i32 = x_94_phi; + if ((x_94 < 800)) { + } else { + break; + } + var x_112 : f32; + var x_113_phi : f32; + if (((x_94 % 32) == 0)) { + x_104 = (x_91 + 0.400000006); + x_92_phi = x_104; + } else { + let x_106 : f32 = *(thirty_two); + x_113_phi = x_91; + if (((f32(x_94) % round(x_106)) <= 0.01)) { + x_112 = (x_91 + 100.0); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_92_phi = x_113; + } + var x_92 : f32; + x_92 = x_92_phi; + let x_115 : f32 = *(limit); + if ((f32(x_94) >= x_115)) { + return x_92; + } + + continuing { + x_95 = (x_94 + 1); + x_91_phi = x_92; + x_94_phi = x_95; + } + } + return x_91; +} + +fn main_1() { + var c : vec3; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var x_68_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_52 : f32 = x_10.resolution.x; + let x_54 : f32 = round((x_52 * 0.125)); + let x_56 : f32 = gl_FragCoord.x; + param = x_56; + param_1 = x_54; + let x_57 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + let x_58 : ptr = &(c.x); + *(x_58) = x_57; + let x_60 : f32 = gl_FragCoord.y; + param_2 = x_60; + param_3 = x_54; + let x_61 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + let x_62 : ptr = &(c.y); + *(x_62) = x_61; + let x_63 : f32 = *(x_58); + let x_64 : f32 = *(x_62); + c.z = (x_63 + x_64); + x_68_phi = 0; + loop { + var x_69 : i32; + let x_68 : i32 = x_68_phi; + if ((x_68 < 3)) { + } else { + break; + } + let x_74 : ptr = &(c[x_68]); + let x_75 : f32 = *(x_74); + if ((x_75 >= 1.0)) { + let x_79 : f32 = *(x_74); + let x_80 : f32 = *(x_74); + *(x_74) = (x_79 * x_80); + } + + continuing { + x_69 = (x_68 + 1); + x_68_phi = x_69; + } + } + let x_82 : vec3 = c; + let x_84 : vec3 = normalize(abs(x_82)); + x_GLF_color = vec4(x_84.x, x_84.y, x_84.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl new file mode 100644 index 0000000000..ba37d915bc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl @@ -0,0 +1,122 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_10 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var x_91 : f32; + var x_91_phi : f32; + var x_94_phi : i32; + x_91_phi = -0.5; + x_94_phi = 1; + loop { + var x_104 : f32; + var x_113 : f32; + var x_95 : i32; + var x_92_phi : f32; + x_91 = x_91_phi; + let x_94 : i32 = x_94_phi; + if ((x_94 < 800)) { + } else { + break; + } + var x_112 : f32; + var x_113_phi : f32; + if (((x_94 % 32) == 0)) { + x_104 = (x_91 + 0.400000006); + x_92_phi = x_104; + } else { + let x_106 : f32 = *(thirty_two); + x_113_phi = x_91; + if (((f32(x_94) % round(x_106)) <= 0.01)) { + x_112 = (x_91 + 100.0); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_92_phi = x_113; + } + var x_92 : f32; + x_92 = x_92_phi; + let x_115 : f32 = *(limit); + if ((f32(x_94) >= x_115)) { + return x_92; + } + + continuing { + x_95 = (x_94 + 1); + x_91_phi = x_92; + x_94_phi = x_95; + } + } + return x_91; +} + +fn main_1() { + var c : vec3; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var x_68_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_52 : f32 = x_10.resolution.x; + let x_54 : f32 = round((x_52 * 0.125)); + let x_56 : f32 = gl_FragCoord.x; + param = x_56; + param_1 = x_54; + let x_57 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + let x_58 : ptr = &(c.x); + *(x_58) = x_57; + let x_60 : f32 = gl_FragCoord.y; + param_2 = x_60; + param_3 = x_54; + let x_61 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + let x_62 : ptr = &(c.y); + *(x_62) = x_61; + let x_63 : f32 = *(x_58); + let x_64 : f32 = *(x_62); + c.z = (x_63 + x_64); + x_68_phi = 0; + loop { + var x_69 : i32; + let x_68 : i32 = x_68_phi; + if ((x_68 < 3)) { + } else { + break; + } + let x_74 : ptr = &(c[x_68]); + let x_75 : f32 = *(x_74); + if ((x_75 >= 1.0)) { + let x_79 : f32 = *(x_74); + let x_80 : f32 = *(x_74); + *(x_74) = (x_79 * x_80); + } + + continuing { + x_69 = (x_68 + 1); + x_68_phi = x_69; + } + } + let x_82 : vec3 = c; + let x_84 : vec3 = normalize(abs(x_82)); + x_GLF_color = vec4(x_84.x, x_84.y, x_84.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..125f7d988e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.hlsl @@ -0,0 +1,123 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float compute_value_f1_f1_(inout float limit, inout float thirty_two) { + float x_91 = 0.0f; + float x_91_phi = 0.0f; + int x_94_phi = 0; + x_91_phi = -0.5f; + x_94_phi = 1; + while (true) { + float x_104 = 0.0f; + float x_113 = 0.0f; + int x_95 = 0; + float x_92_phi = 0.0f; + x_91 = x_91_phi; + const int x_94 = x_94_phi; + if ((x_94 < 800)) { + } else { + break; + } + float x_112 = 0.0f; + float x_113_phi = 0.0f; + if (((x_94 % 32) == 0)) { + x_104 = (x_91 + 0.400000006f); + x_92_phi = x_104; + } else { + const float x_106 = thirty_two; + x_113_phi = x_91; + if (((float(x_94) % round(x_106)) <= 0.01f)) { + x_112 = (x_91 + 100.0f); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_92_phi = x_113; + } + float x_92 = 0.0f; + x_92 = x_92_phi; + const float x_115 = limit; + if ((float(x_94) >= x_115)) { + return x_92; + } + { + x_95 = (x_94 + 1); + x_91_phi = x_92; + x_94_phi = x_95; + } + } + return x_91; +} + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int x_68_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_52 = asfloat(x_10[0].x); + const float x_54 = round((x_52 * 0.125f)); + const float x_56 = gl_FragCoord.x; + param = x_56; + param_1 = x_54; + const float x_57 = compute_value_f1_f1_(param, param_1); + c.x = x_57; + const float x_60 = gl_FragCoord.y; + param_2 = x_60; + param_3 = x_54; + const float x_61 = compute_value_f1_f1_(param_2, param_3); + c.y = x_61; + const float x_63 = c.x; + const float x_64 = c.y; + c.z = (x_63 + x_64); + x_68_phi = 0; + while (true) { + int x_69 = 0; + const int x_68 = x_68_phi; + if ((x_68 < 3)) { + } else { + break; + } + const int x_74_save = x_68; + const float x_75 = c[x_74_save]; + if ((x_75 >= 1.0f)) { + const float x_79 = c[x_74_save]; + const float x_80 = c[x_74_save]; + set_float3(c, x_74_save, (x_79 * x_80)); + } + { + x_69 = (x_68 + 1); + x_68_phi = x_69; + } + } + const float3 x_84 = normalize(abs(c)); + x_GLF_color = float4(x_84.x, x_84.y, x_84.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.msl new file mode 100755 index 0000000000..5ee750f283 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.msl @@ -0,0 +1,126 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float compute_value_f1_f1_(thread float* const limit, thread float* const thirty_two) { + float x_91 = 0.0f; + float x_91_phi = 0.0f; + int x_94_phi = 0; + x_91_phi = -0.5f; + x_94_phi = 1; + while (true) { + float x_104 = 0.0f; + float x_113 = 0.0f; + int x_95 = 0; + float x_92_phi = 0.0f; + x_91 = x_91_phi; + int const x_94 = x_94_phi; + if ((x_94 < 800)) { + } else { + break; + } + float x_112 = 0.0f; + float x_113_phi = 0.0f; + if (((x_94 % 32) == 0)) { + x_104 = (x_91 + 0.400000006f); + x_92_phi = x_104; + } else { + float const x_106 = *(thirty_two); + x_113_phi = x_91; + if (((float(x_94) % rint(x_106)) <= 0.01f)) { + x_112 = (x_91 + 100.0f); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_92_phi = x_113; + } + float x_92 = 0.0f; + x_92 = x_92_phi; + float const x_115 = *(limit); + if ((float(x_94) >= x_115)) { + return x_92; + } + { + x_95 = (x_94 + 1); + x_91_phi = x_92; + x_94_phi = x_95; + } + } + return x_91; +} + +void main_1(constant buf0& x_10, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int x_68_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_52 = x_10.resolution.x; + float const x_54 = rint((x_52 * 0.125f)); + float const x_56 = (*(tint_symbol_5)).x; + param = x_56; + param_1 = x_54; + float const x_57 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_57; + float const x_60 = (*(tint_symbol_5)).y; + param_2 = x_60; + param_3 = x_54; + float const x_61 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_61; + float const x_63 = c.x; + float const x_64 = c.y; + c.z = (x_63 + x_64); + x_68_phi = 0; + while (true) { + int x_69 = 0; + int const x_68 = x_68_phi; + if ((x_68 < 3)) { + } else { + break; + } + int const x_74_save = x_68; + float const x_75 = c[x_74_save]; + if ((x_75 >= 1.0f)) { + float const x_79 = c[x_74_save]; + float const x_80 = c[x_74_save]; + c[x_74_save] = (x_79 * x_80); + } + { + x_69 = (x_68 + 1); + x_68_phi = x_69; + } + } + float3 const x_82 = c; + float3 const x_84 = normalize(fabs(x_82)); + *(tint_symbol_6) = float4(x_84.x, x_84.y, x_84.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_10, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\u8cs.0.metal:39:25: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_94) % rint(x_106)) <= 0.01f)) { + ~~~~~~~~~~~ ^ ~~~~~~~~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..42303b9029 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.spvasm @@ -0,0 +1,291 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 180 +; Schema: 0 + OpCapability Shader + %64 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_10 "x_10" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %compute_value_f1_f1_ "compute_value_f1_f1_" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %x_91 "x_91" + OpName %x_91_phi "x_91_phi" + OpName %x_94_phi "x_94_phi" + OpName %x_104 "x_104" + OpName %x_113 "x_113" + OpName %x_95 "x_95" + OpName %x_92_phi "x_92_phi" + OpName %x_112 "x_112" + OpName %x_113_phi "x_113_phi" + OpName %x_92 "x_92" + OpName %main_1 "main_1" + OpName %c "c" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %x_68_phi "x_68_phi" + OpName %x_69 "x_69" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %22 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %27 = OpConstantNull %int + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %void = OpTypeVoid + %89 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %96 = OpConstantNull %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %105 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0_125 = OpConstant %float 0.125 +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %167 = OpTypeFunction %void %main_out +%compute_value_f1_f1_ = OpFunction %float None %15 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %20 = OpLabel + %x_91 = OpVariable %_ptr_Function_float Function %22 + %x_91_phi = OpVariable %_ptr_Function_float Function %22 + %x_94_phi = OpVariable %_ptr_Function_int Function %27 + %x_104 = OpVariable %_ptr_Function_float Function %22 + %x_113 = OpVariable %_ptr_Function_float Function %22 + %x_95 = OpVariable %_ptr_Function_int Function %27 + %x_92_phi = OpVariable %_ptr_Function_float Function %22 + %x_112 = OpVariable %_ptr_Function_float Function %22 + %x_113_phi = OpVariable %_ptr_Function_float Function %22 + %x_92 = OpVariable %_ptr_Function_float Function %22 + OpStore %x_91_phi %float_n0_5 + OpStore %x_94_phi %int_1 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %38 = OpLoad %float %x_91_phi + OpStore %x_91 %38 + %39 = OpLoad %int %x_94_phi + %41 = OpSLessThan %bool %39 %int_800 + OpSelectionMerge %43 None + OpBranchConditional %41 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %31 + %43 = OpLabel + %49 = OpSMod %int %39 %int_32 + %51 = OpIEqual %bool %49 %int_0 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + %55 = OpLoad %float %x_91 + %57 = OpFAdd %float %55 %float_0_400000006 + OpStore %x_104 %57 + %58 = OpLoad %float %x_104 + OpStore %x_92_phi %58 + OpBranch %52 + %54 = OpLabel + %60 = OpLoad %float %thirty_two + %61 = OpLoad %float %x_91 + OpStore %x_113_phi %61 + %62 = OpConvertSToF %float %39 + %63 = OpExtInst %float %64 RoundEven %60 + %65 = OpFMod %float %62 %63 + %67 = OpFOrdLessThanEqual %bool %65 %float_0_00999999978 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + %70 = OpLoad %float %x_91 + %72 = OpFAdd %float %70 %float_100 + OpStore %x_112 %72 + %73 = OpLoad %float %x_112 + OpStore %x_113_phi %73 + OpBranch %68 + %68 = OpLabel + %74 = OpLoad %float %x_113_phi + OpStore %x_113 %74 + %75 = OpLoad %float %x_113 + OpStore %x_92_phi %75 + OpBranch %52 + %52 = OpLabel + %77 = OpLoad %float %x_92_phi + OpStore %x_92 %77 + %79 = OpLoad %float %limit + %80 = OpConvertSToF %float %39 + %81 = OpFOrdGreaterThanEqual %bool %80 %79 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %82 + %83 = OpLabel + %84 = OpLoad %float %x_92 + OpReturnValue %84 + %82 = OpLabel + OpBranch %32 + %32 = OpLabel + %85 = OpIAdd %int %39 %int_1 + OpStore %x_95 %85 + %86 = OpLoad %float %x_92 + OpStore %x_91_phi %86 + %87 = OpLoad %int %x_95 + OpStore %x_94_phi %87 + OpBranch %30 + %31 = OpLabel + %88 = OpLoad %float %x_91 + OpReturnValue %88 + OpFunctionEnd + %main_1 = OpFunction %void None %89 + %92 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %96 + %param = OpVariable %_ptr_Function_float Function %22 + %param_1 = OpVariable %_ptr_Function_float Function %22 + %param_2 = OpVariable %_ptr_Function_float Function %22 + %param_3 = OpVariable %_ptr_Function_float Function %22 + %x_68_phi = OpVariable %_ptr_Function_int Function %27 + %x_69 = OpVariable %_ptr_Function_int Function %27 + OpStore %c %105 + %109 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0 + %110 = OpLoad %float %109 + %113 = OpFMul %float %110 %float_0_125 + %111 = OpExtInst %float %64 RoundEven %113 + %115 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %116 = OpLoad %float %115 + OpStore %param %116 + OpStore %param_1 %111 + %117 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1 + %120 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %120 %117 + %122 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %123 = OpLoad %float %122 + OpStore %param_2 %123 + OpStore %param_3 %111 + %124 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3 + %127 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %127 %124 + %128 = OpAccessChain %_ptr_Function_float %c %uint_0 + %129 = OpLoad %float %128 + %130 = OpAccessChain %_ptr_Function_float %c %uint_1 + %131 = OpLoad %float %130 + %133 = OpAccessChain %_ptr_Function_float %c %uint_2 + %134 = OpFAdd %float %129 %131 + OpStore %133 %134 + OpStore %x_68_phi %int_0 + OpBranch %135 + %135 = OpLabel + OpLoopMerge %136 %137 None + OpBranch %138 + %138 = OpLabel + %140 = OpLoad %int %x_68_phi + %142 = OpSLessThan %bool %140 %int_3 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %145 + %144 = OpLabel + OpBranch %143 + %145 = OpLabel + OpBranch %136 + %143 = OpLabel + %146 = OpAccessChain %_ptr_Function_float %c %140 + %147 = OpLoad %float %146 + %149 = OpFOrdGreaterThanEqual %bool %147 %float_1 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %150 + %151 = OpLabel + %152 = OpAccessChain %_ptr_Function_float %c %140 + %153 = OpLoad %float %152 + %154 = OpAccessChain %_ptr_Function_float %c %140 + %155 = OpLoad %float %154 + %156 = OpAccessChain %_ptr_Function_float %c %140 + %157 = OpFMul %float %153 %155 + OpStore %156 %157 + OpBranch %150 + %150 = OpLabel + OpBranch %137 + %137 = OpLabel + %158 = OpIAdd %int %140 %int_1 + OpStore %x_69 %158 + %159 = OpLoad %int %x_69 + OpStore %x_68_phi %159 + OpBranch %135 + %136 = OpLabel + %160 = OpLoad %v3float %c + %162 = OpExtInst %v3float %64 FAbs %160 + %161 = OpExtInst %v3float %64 Normalize %162 + %163 = OpCompositeExtract %float %161 0 + %164 = OpCompositeExtract %float %161 1 + %165 = OpCompositeExtract %float %161 2 + %166 = OpCompositeConstruct %v4float %163 %164 %165 %float_1 + OpStore %x_GLF_color %166 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %167 +%tint_symbol_1 = OpFunctionParameter %main_out + %171 = OpLabel + %172 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %172 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %89 + %174 = OpLabel + %175 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %175 + %176 = OpFunctionCall %void %main_1 + %178 = OpLoad %v4float %x_GLF_color + %179 = OpCompositeConstruct %main_out %178 + %177 = OpFunctionCall %void %tint_symbol_3 %179 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ba37d915bc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/0-opt.wgsl.expected.wgsl @@ -0,0 +1,122 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_10 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var x_91 : f32; + var x_91_phi : f32; + var x_94_phi : i32; + x_91_phi = -0.5; + x_94_phi = 1; + loop { + var x_104 : f32; + var x_113 : f32; + var x_95 : i32; + var x_92_phi : f32; + x_91 = x_91_phi; + let x_94 : i32 = x_94_phi; + if ((x_94 < 800)) { + } else { + break; + } + var x_112 : f32; + var x_113_phi : f32; + if (((x_94 % 32) == 0)) { + x_104 = (x_91 + 0.400000006); + x_92_phi = x_104; + } else { + let x_106 : f32 = *(thirty_two); + x_113_phi = x_91; + if (((f32(x_94) % round(x_106)) <= 0.01)) { + x_112 = (x_91 + 100.0); + x_113_phi = x_112; + } + x_113 = x_113_phi; + x_92_phi = x_113; + } + var x_92 : f32; + x_92 = x_92_phi; + let x_115 : f32 = *(limit); + if ((f32(x_94) >= x_115)) { + return x_92; + } + + continuing { + x_95 = (x_94 + 1); + x_91_phi = x_92; + x_94_phi = x_95; + } + } + return x_91; +} + +fn main_1() { + var c : vec3; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var x_68_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_52 : f32 = x_10.resolution.x; + let x_54 : f32 = round((x_52 * 0.125)); + let x_56 : f32 = gl_FragCoord.x; + param = x_56; + param_1 = x_54; + let x_57 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + let x_58 : ptr = &(c.x); + *(x_58) = x_57; + let x_60 : f32 = gl_FragCoord.y; + param_2 = x_60; + param_3 = x_54; + let x_61 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + let x_62 : ptr = &(c.y); + *(x_62) = x_61; + let x_63 : f32 = *(x_58); + let x_64 : f32 = *(x_62); + c.z = (x_63 + x_64); + x_68_phi = 0; + loop { + var x_69 : i32; + let x_68 : i32 = x_68_phi; + if ((x_68 < 3)) { + } else { + break; + } + let x_74 : ptr = &(c[x_68]); + let x_75 : f32 = *(x_74); + if ((x_75 >= 1.0)) { + let x_79 : f32 = *(x_74); + let x_80 : f32 = *(x_74); + *(x_74) = (x_79 * x_80); + } + + continuing { + x_69 = (x_68 + 1); + x_68_phi = x_69; + } + } + let x_82 : vec3 = c; + let x_84 : vec3 = normalize(abs(x_82)); + x_GLF_color = vec4(x_84.x, x_84.y, x_84.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm new file mode 100644 index 0000000000..6ff67b14e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm @@ -0,0 +1,204 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %compute_value_f1_f1_ "compute_value(f1;f1;" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %c "c" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %__0 "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %21 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %float_n0_5 = OpConstant %float -0.5 + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %37 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%float_0_125 = OpConstant %float 0.125 + %main = OpFunction %void None %18 + %53 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_float Function + %param_1 = OpVariable %_ptr_Function_float Function + %param_2 = OpVariable %_ptr_Function_float Function + %54 = OpVariable %_ptr_Function_v3float Function + OpStore %c %37 + %55 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %56 = OpLoad %float %55 + %57 = OpFMul %float %56 %float_0_125 + %58 = OpExtInst %float %1 Round %57 + %59 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %60 = OpLoad %float %59 + OpStore %param %60 + OpStore %param_0 %58 + %61 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_0 + %62 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %62 %61 + %63 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %64 = OpLoad %float %63 + OpStore %param_1 %64 + OpStore %param_2 %58 + %65 = OpFunctionCall %float %compute_value_f1_f1_ %param_1 %param_2 + %66 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %66 %65 + %67 = OpLoad %float %62 + %68 = OpLoad %v3float %c + OpStore %54 %68 + %69 = OpAccessChain %_ptr_Function_float %54 %uint_1 + %70 = OpLoad %float %69 + %71 = OpFAdd %float %67 %70 + %72 = OpAccessChain %_ptr_Function_float %c %uint_2 + OpStore %72 %71 + OpBranch %73 + %73 = OpLabel + %74 = OpPhi %int %int_0 %53 %75 %76 + %77 = OpSLessThan %bool %74 %int_3 + OpLoopMerge %78 %76 None + OpBranchConditional %77 %79 %78 + %79 = OpLabel + %80 = OpAccessChain %_ptr_Function_float %c %74 + %81 = OpLoad %float %80 + %82 = OpFOrdGreaterThanEqual %bool %81 %float_1 + OpSelectionMerge %83 None + OpBranchConditional %82 %84 %83 + %84 = OpLabel + %85 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %86 = OpLoad %float %85 + %87 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %88 = OpLoad %float %87 + %89 = OpFOrdGreaterThan %bool %86 %88 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + OpKill + %90 = OpLabel + %92 = OpLoad %float %80 + %93 = OpLoad %float %80 + %94 = OpFMul %float %92 %93 + OpStore %80 %94 + OpBranch %83 + %83 = OpLabel + OpBranch %76 + %76 = OpLabel + %75 = OpIAdd %int %74 %int_1 + OpBranch %73 + %78 = OpLabel + %95 = OpLoad %v3float %c + %96 = OpExtInst %v3float %1 FAbs %95 + %97 = OpExtInst %v3float %1 Normalize %96 + %98 = OpCompositeExtract %float %97 0 + %99 = OpCompositeExtract %float %97 1 + %100 = OpCompositeExtract %float %97 2 + %101 = OpCompositeConstruct %v4float %98 %99 %100 %float_1 + OpStore %_GLF_color %101 + OpReturn + OpFunctionEnd +%compute_value_f1_f1_ = OpFunction %float None %21 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %102 = OpLabel + OpBranch %103 + %103 = OpLabel + %104 = OpPhi %float %float_n0_5 %102 %105 %106 + %107 = OpPhi %int %int_1 %102 %108 %106 + %109 = OpSLessThan %bool %107 %int_800 + OpLoopMerge %110 %106 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + %112 = OpSMod %int %107 %int_32 + %113 = OpIEqual %bool %112 %int_0 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %116 + %116 = OpLabel + %117 = OpConvertSToF %float %107 + %118 = OpLoad %float %thirty_two + %119 = OpExtInst %float %1 Round %118 + %120 = OpFMod %float %117 %119 + %121 = OpFOrdLessThanEqual %bool %120 %float_0_00999999978 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + %124 = OpFAdd %float %104 %float_100 + OpBranch %122 + %122 = OpLabel + %125 = OpPhi %float %104 %116 %124 %123 + OpBranch %114 + %115 = OpLabel + %126 = OpFAdd %float %104 %float_0_400000006 + OpBranch %114 + %114 = OpLabel + %105 = OpPhi %float %126 %115 %125 %122 + %127 = OpConvertSToF %float %107 + %128 = OpLoad %float %limit + %129 = OpFOrdGreaterThanEqual %bool %127 %128 + OpSelectionMerge %130 None + OpBranchConditional %129 %131 %130 + %131 = OpLabel + OpReturnValue %105 + %130 = OpLabel + OpBranch %106 + %106 = OpLabel + %108 = OpIAdd %int %107 %int_1 + OpBranch %103 + %110 = OpLabel + OpReturnValue %104 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..3a417dfd0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.hlsl @@ -0,0 +1,133 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_16 : register(b1, space0) { + uint4 x_16[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float compute_value_f1_f1_(inout float limit, inout float thirty_two) { + float x_104 = 0.0f; + float x_104_phi = 0.0f; + int x_107_phi = 0; + x_104_phi = -0.5f; + x_107_phi = 1; + while (true) { + float x_126 = 0.0f; + float x_125 = 0.0f; + int x_108 = 0; + float x_105_phi = 0.0f; + x_104 = x_104_phi; + const int x_107 = x_107_phi; + if ((x_107 < 800)) { + } else { + break; + } + float x_124 = 0.0f; + float x_125_phi = 0.0f; + if (((x_107 % 32) == 0)) { + x_126 = (x_104 + 0.400000006f); + x_105_phi = x_126; + } else { + const float x_118 = thirty_two; + x_125_phi = x_104; + if (((float(x_107) % round(x_118)) <= 0.01f)) { + x_124 = (x_104 + 100.0f); + x_125_phi = x_124; + } + x_125 = x_125_phi; + x_105_phi = x_125; + } + float x_105 = 0.0f; + x_105 = x_105_phi; + const float x_128 = limit; + if ((float(x_107) >= x_128)) { + return x_105; + } + { + x_108 = (x_107 + 1); + x_104_phi = x_105; + x_107_phi = x_108; + } + } + return x_104; +} + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + float3 x_54 = float3(0.0f, 0.0f, 0.0f); + int x_74_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_56 = asfloat(x_10[0].x); + const float x_58 = round((x_56 * 0.125f)); + const float x_60 = gl_FragCoord.x; + param = x_60; + param_1 = x_58; + const float x_61 = compute_value_f1_f1_(param, param_1); + c.x = x_61; + const float x_64 = gl_FragCoord.y; + param_2 = x_64; + param_3 = x_58; + const float x_65 = compute_value_f1_f1_(param_2, param_3); + c.y = x_65; + const float x_67 = c.x; + x_54 = c; + const float x_70 = x_54.y; + c.z = (x_67 + x_70); + x_74_phi = 0; + while (true) { + int x_75 = 0; + const int x_74 = x_74_phi; + if ((x_74 < 3)) { + } else { + break; + } + const int x_80_save = x_74; + const float x_81 = c[x_80_save]; + if ((x_81 >= 1.0f)) { + const float x_86 = asfloat(x_16[0].x); + const float x_88 = asfloat(x_16[0].y); + if ((x_86 > x_88)) { + discard; + } + const float x_92 = c[x_80_save]; + const float x_93 = c[x_80_save]; + set_float3(c, x_80_save, (x_92 * x_93)); + } + { + x_75 = (x_74 + 1); + x_74_phi = x_75; + } + } + const float3 x_97 = normalize(abs(c)); + x_GLF_color = float4(x_97.x, x_97.y, x_97.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.msl new file mode 100755 index 0000000000..45c08aeeac --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.msl @@ -0,0 +1,137 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float compute_value_f1_f1_(thread float* const limit, thread float* const thirty_two) { + float x_104 = 0.0f; + float x_104_phi = 0.0f; + int x_107_phi = 0; + x_104_phi = -0.5f; + x_107_phi = 1; + while (true) { + float x_126 = 0.0f; + float x_125 = 0.0f; + int x_108 = 0; + float x_105_phi = 0.0f; + x_104 = x_104_phi; + int const x_107 = x_107_phi; + if ((x_107 < 800)) { + } else { + break; + } + float x_124 = 0.0f; + float x_125_phi = 0.0f; + if (((x_107 % 32) == 0)) { + x_126 = (x_104 + 0.400000006f); + x_105_phi = x_126; + } else { + float const x_118 = *(thirty_two); + x_125_phi = x_104; + if (((float(x_107) % rint(x_118)) <= 0.01f)) { + x_124 = (x_104 + 100.0f); + x_125_phi = x_124; + } + x_125 = x_125_phi; + x_105_phi = x_125; + } + float x_105 = 0.0f; + x_105 = x_105_phi; + float const x_128 = *(limit); + if ((float(x_107) >= x_128)) { + return x_105; + } + { + x_108 = (x_107 + 1); + x_104_phi = x_105; + x_107_phi = x_108; + } + } + return x_104; +} + +void main_1(constant buf0& x_10, constant buf1& x_16, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + float3 x_54 = 0.0f; + int x_74_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_56 = x_10.resolution.x; + float const x_58 = rint((x_56 * 0.125f)); + float const x_60 = (*(tint_symbol_5)).x; + param = x_60; + param_1 = x_58; + float const x_61 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_61; + float const x_64 = (*(tint_symbol_5)).y; + param_2 = x_64; + param_3 = x_58; + float const x_65 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_65; + float const x_67 = c.x; + float3 const x_68 = c; + x_54 = x_68; + float const x_70 = x_54.y; + c.z = (x_67 + x_70); + x_74_phi = 0; + while (true) { + int x_75 = 0; + int const x_74 = x_74_phi; + if ((x_74 < 3)) { + } else { + break; + } + int const x_80_save = x_74; + float const x_81 = c[x_80_save]; + if ((x_81 >= 1.0f)) { + float const x_86 = x_16.injectionSwitch.x; + float const x_88 = x_16.injectionSwitch.y; + if ((x_86 > x_88)) { + discard_fragment(); + } + float const x_92 = c[x_80_save]; + float const x_93 = c[x_80_save]; + c[x_80_save] = (x_92 * x_93); + } + { + x_75 = (x_74 + 1); + x_74_phi = x_75; + } + } + float3 const x_95 = c; + float3 const x_97 = normalize(fabs(x_95)); + *(tint_symbol_6) = float4(x_97.x, x_97.y, x_97.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_10 [[buffer(0)]], constant buf1& x_16 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_10, x_16, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\ufno.0.metal:42:26: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_107) % rint(x_118)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..d6225453c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.spvasm @@ -0,0 +1,316 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 192 +; Schema: 0 + OpCapability Shader + %67 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_10 "x_10" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_16 "x_16" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %compute_value_f1_f1_ "compute_value_f1_f1_" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %x_104 "x_104" + OpName %x_104_phi "x_104_phi" + OpName %x_107_phi "x_107_phi" + OpName %x_126 "x_126" + OpName %x_125 "x_125" + OpName %x_108 "x_108" + OpName %x_105_phi "x_105_phi" + OpName %x_124 "x_124" + OpName %x_125_phi "x_125_phi" + OpName %x_105 "x_105" + OpName %main_1 "main_1" + OpName %c "c" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %x_54 "x_54" + OpName %x_74_phi "x_74_phi" + OpName %x_75 "x_75" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_16 NonWritable + OpDecorate %x_16 DescriptorSet 0 + OpDecorate %x_16 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_16 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %25 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %void = OpTypeVoid + %92 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %99 = OpConstantNull %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %109 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0_125 = OpConstant %float 0.125 +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %179 = OpTypeFunction %void %main_out +%compute_value_f1_f1_ = OpFunction %float None %18 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %23 = OpLabel + %x_104 = OpVariable %_ptr_Function_float Function %25 + %x_104_phi = OpVariable %_ptr_Function_float Function %25 + %x_107_phi = OpVariable %_ptr_Function_int Function %30 + %x_126 = OpVariable %_ptr_Function_float Function %25 + %x_125 = OpVariable %_ptr_Function_float Function %25 + %x_108 = OpVariable %_ptr_Function_int Function %30 + %x_105_phi = OpVariable %_ptr_Function_float Function %25 + %x_124 = OpVariable %_ptr_Function_float Function %25 + %x_125_phi = OpVariable %_ptr_Function_float Function %25 + %x_105 = OpVariable %_ptr_Function_float Function %25 + OpStore %x_104_phi %float_n0_5 + OpStore %x_107_phi %int_1 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %41 = OpLoad %float %x_104_phi + OpStore %x_104 %41 + %42 = OpLoad %int %x_107_phi + %44 = OpSLessThan %bool %42 %int_800 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %34 + %46 = OpLabel + %52 = OpSMod %int %42 %int_32 + %54 = OpIEqual %bool %52 %int_0 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + %58 = OpLoad %float %x_104 + %60 = OpFAdd %float %58 %float_0_400000006 + OpStore %x_126 %60 + %61 = OpLoad %float %x_126 + OpStore %x_105_phi %61 + OpBranch %55 + %57 = OpLabel + %63 = OpLoad %float %thirty_two + %64 = OpLoad %float %x_104 + OpStore %x_125_phi %64 + %65 = OpConvertSToF %float %42 + %66 = OpExtInst %float %67 RoundEven %63 + %68 = OpFMod %float %65 %66 + %70 = OpFOrdLessThanEqual %bool %68 %float_0_00999999978 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %73 = OpLoad %float %x_104 + %75 = OpFAdd %float %73 %float_100 + OpStore %x_124 %75 + %76 = OpLoad %float %x_124 + OpStore %x_125_phi %76 + OpBranch %71 + %71 = OpLabel + %77 = OpLoad %float %x_125_phi + OpStore %x_125 %77 + %78 = OpLoad %float %x_125 + OpStore %x_105_phi %78 + OpBranch %55 + %55 = OpLabel + %80 = OpLoad %float %x_105_phi + OpStore %x_105 %80 + %82 = OpLoad %float %limit + %83 = OpConvertSToF %float %42 + %84 = OpFOrdGreaterThanEqual %bool %83 %82 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + %87 = OpLoad %float %x_105 + OpReturnValue %87 + %85 = OpLabel + OpBranch %35 + %35 = OpLabel + %88 = OpIAdd %int %42 %int_1 + OpStore %x_108 %88 + %89 = OpLoad %float %x_105 + OpStore %x_104_phi %89 + %90 = OpLoad %int %x_108 + OpStore %x_107_phi %90 + OpBranch %33 + %34 = OpLabel + %91 = OpLoad %float %x_104 + OpReturnValue %91 + OpFunctionEnd + %main_1 = OpFunction %void None %92 + %95 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %99 + %param = OpVariable %_ptr_Function_float Function %25 + %param_1 = OpVariable %_ptr_Function_float Function %25 + %param_2 = OpVariable %_ptr_Function_float Function %25 + %param_3 = OpVariable %_ptr_Function_float Function %25 + %x_54 = OpVariable %_ptr_Function_v3float Function %99 + %x_74_phi = OpVariable %_ptr_Function_int Function %30 + %x_75 = OpVariable %_ptr_Function_int Function %30 + OpStore %c %109 + %113 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0 + %114 = OpLoad %float %113 + %117 = OpFMul %float %114 %float_0_125 + %115 = OpExtInst %float %67 RoundEven %117 + %119 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %120 = OpLoad %float %119 + OpStore %param %120 + OpStore %param_1 %115 + %121 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1 + %124 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %124 %121 + %126 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %127 = OpLoad %float %126 + OpStore %param_2 %127 + OpStore %param_3 %115 + %128 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3 + %131 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %131 %128 + %132 = OpAccessChain %_ptr_Function_float %c %uint_0 + %133 = OpLoad %float %132 + %134 = OpLoad %v3float %c + OpStore %x_54 %134 + %135 = OpAccessChain %_ptr_Function_float %x_54 %uint_1 + %136 = OpLoad %float %135 + %138 = OpAccessChain %_ptr_Function_float %c %uint_2 + %139 = OpFAdd %float %133 %136 + OpStore %138 %139 + OpStore %x_74_phi %int_0 + OpBranch %140 + %140 = OpLabel + OpLoopMerge %141 %142 None + OpBranch %143 + %143 = OpLabel + %145 = OpLoad %int %x_74_phi + %147 = OpSLessThan %bool %145 %int_3 + OpSelectionMerge %148 None + OpBranchConditional %147 %149 %150 + %149 = OpLabel + OpBranch %148 + %150 = OpLabel + OpBranch %141 + %148 = OpLabel + %151 = OpAccessChain %_ptr_Function_float %c %145 + %152 = OpLoad %float %151 + %154 = OpFOrdGreaterThanEqual %bool %152 %float_1 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %155 + %156 = OpLabel + %157 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_0 + %158 = OpLoad %float %157 + %159 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_1 + %160 = OpLoad %float %159 + %161 = OpFOrdGreaterThan %bool %158 %160 + OpSelectionMerge %162 None + OpBranchConditional %161 %163 %162 + %163 = OpLabel + OpKill + %162 = OpLabel + %164 = OpAccessChain %_ptr_Function_float %c %145 + %165 = OpLoad %float %164 + %166 = OpAccessChain %_ptr_Function_float %c %145 + %167 = OpLoad %float %166 + %168 = OpAccessChain %_ptr_Function_float %c %145 + %169 = OpFMul %float %165 %167 + OpStore %168 %169 + OpBranch %155 + %155 = OpLabel + OpBranch %142 + %142 = OpLabel + %170 = OpIAdd %int %145 %int_1 + OpStore %x_75 %170 + %171 = OpLoad %int %x_75 + OpStore %x_74_phi %171 + OpBranch %140 + %141 = OpLabel + %172 = OpLoad %v3float %c + %174 = OpExtInst %v3float %67 FAbs %172 + %173 = OpExtInst %v3float %67 Normalize %174 + %175 = OpCompositeExtract %float %173 0 + %176 = OpCompositeExtract %float %173 1 + %177 = OpCompositeExtract %float %173 2 + %178 = OpCompositeConstruct %v4float %175 %176 %177 %float_1 + OpStore %x_GLF_color %178 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %179 +%tint_symbol_1 = OpFunctionParameter %main_out + %183 = OpLabel + %184 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %184 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %92 + %186 = OpLabel + %187 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %187 + %188 = OpFunctionCall %void %main_1 + %190 = OpLoad %v4float %x_GLF_color + %191 = OpCompositeConstruct %main_out %190 + %189 = OpFunctionCall %void %tint_symbol_3 %191 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..57edb9b503 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.spvasm.expected.wgsl @@ -0,0 +1,136 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_10 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_16 : buf1; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var x_104 : f32; + var x_104_phi : f32; + var x_107_phi : i32; + x_104_phi = -0.5; + x_107_phi = 1; + loop { + var x_126 : f32; + var x_125 : f32; + var x_108 : i32; + var x_105_phi : f32; + x_104 = x_104_phi; + let x_107 : i32 = x_107_phi; + if ((x_107 < 800)) { + } else { + break; + } + var x_124 : f32; + var x_125_phi : f32; + if (((x_107 % 32) == 0)) { + x_126 = (x_104 + 0.400000006); + x_105_phi = x_126; + } else { + let x_118 : f32 = *(thirty_two); + x_125_phi = x_104; + if (((f32(x_107) % round(x_118)) <= 0.01)) { + x_124 = (x_104 + 100.0); + x_125_phi = x_124; + } + x_125 = x_125_phi; + x_105_phi = x_125; + } + var x_105 : f32; + x_105 = x_105_phi; + let x_128 : f32 = *(limit); + if ((f32(x_107) >= x_128)) { + return x_105; + } + + continuing { + x_108 = (x_107 + 1); + x_104_phi = x_105; + x_107_phi = x_108; + } + } + return x_104; +} + +fn main_1() { + var c : vec3; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var x_54 : vec3; + var x_74_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_56 : f32 = x_10.resolution.x; + let x_58 : f32 = round((x_56 * 0.125)); + let x_60 : f32 = gl_FragCoord.x; + param = x_60; + param_1 = x_58; + let x_61 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + let x_62 : ptr = &(c.x); + *(x_62) = x_61; + let x_64 : f32 = gl_FragCoord.y; + param_2 = x_64; + param_3 = x_58; + let x_65 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_65; + let x_67 : f32 = *(x_62); + let x_68 : vec3 = c; + x_54 = x_68; + let x_70 : f32 = x_54.y; + c.z = (x_67 + x_70); + x_74_phi = 0; + loop { + var x_75 : i32; + let x_74 : i32 = x_74_phi; + if ((x_74 < 3)) { + } else { + break; + } + let x_80 : ptr = &(c[x_74]); + let x_81 : f32 = *(x_80); + if ((x_81 >= 1.0)) { + let x_86 : f32 = x_16.injectionSwitch.x; + let x_88 : f32 = x_16.injectionSwitch.y; + if ((x_86 > x_88)) { + discard; + } + let x_92 : f32 = *(x_80); + let x_93 : f32 = *(x_80); + *(x_80) = (x_92 * x_93); + } + + continuing { + x_75 = (x_74 + 1); + x_74_phi = x_75; + } + } + let x_95 : vec3 = c; + let x_97 : vec3 = normalize(abs(x_95)); + x_GLF_color = vec4(x_97.x, x_97.y, x_97.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl new file mode 100644 index 0000000000..57edb9b503 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl @@ -0,0 +1,136 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_10 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_16 : buf1; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var x_104 : f32; + var x_104_phi : f32; + var x_107_phi : i32; + x_104_phi = -0.5; + x_107_phi = 1; + loop { + var x_126 : f32; + var x_125 : f32; + var x_108 : i32; + var x_105_phi : f32; + x_104 = x_104_phi; + let x_107 : i32 = x_107_phi; + if ((x_107 < 800)) { + } else { + break; + } + var x_124 : f32; + var x_125_phi : f32; + if (((x_107 % 32) == 0)) { + x_126 = (x_104 + 0.400000006); + x_105_phi = x_126; + } else { + let x_118 : f32 = *(thirty_two); + x_125_phi = x_104; + if (((f32(x_107) % round(x_118)) <= 0.01)) { + x_124 = (x_104 + 100.0); + x_125_phi = x_124; + } + x_125 = x_125_phi; + x_105_phi = x_125; + } + var x_105 : f32; + x_105 = x_105_phi; + let x_128 : f32 = *(limit); + if ((f32(x_107) >= x_128)) { + return x_105; + } + + continuing { + x_108 = (x_107 + 1); + x_104_phi = x_105; + x_107_phi = x_108; + } + } + return x_104; +} + +fn main_1() { + var c : vec3; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var x_54 : vec3; + var x_74_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_56 : f32 = x_10.resolution.x; + let x_58 : f32 = round((x_56 * 0.125)); + let x_60 : f32 = gl_FragCoord.x; + param = x_60; + param_1 = x_58; + let x_61 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + let x_62 : ptr = &(c.x); + *(x_62) = x_61; + let x_64 : f32 = gl_FragCoord.y; + param_2 = x_64; + param_3 = x_58; + let x_65 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_65; + let x_67 : f32 = *(x_62); + let x_68 : vec3 = c; + x_54 = x_68; + let x_70 : f32 = x_54.y; + c.z = (x_67 + x_70); + x_74_phi = 0; + loop { + var x_75 : i32; + let x_74 : i32 = x_74_phi; + if ((x_74 < 3)) { + } else { + break; + } + let x_80 : ptr = &(c[x_74]); + let x_81 : f32 = *(x_80); + if ((x_81 >= 1.0)) { + let x_86 : f32 = x_16.injectionSwitch.x; + let x_88 : f32 = x_16.injectionSwitch.y; + if ((x_86 > x_88)) { + discard; + } + let x_92 : f32 = *(x_80); + let x_93 : f32 = *(x_80); + *(x_80) = (x_92 * x_93); + } + + continuing { + x_75 = (x_74 + 1); + x_74_phi = x_75; + } + } + let x_95 : vec3 = c; + let x_97 : vec3 = normalize(abs(x_95)); + x_GLF_color = vec4(x_97.x, x_97.y, x_97.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..3a417dfd0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.hlsl @@ -0,0 +1,133 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_16 : register(b1, space0) { + uint4 x_16[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float compute_value_f1_f1_(inout float limit, inout float thirty_two) { + float x_104 = 0.0f; + float x_104_phi = 0.0f; + int x_107_phi = 0; + x_104_phi = -0.5f; + x_107_phi = 1; + while (true) { + float x_126 = 0.0f; + float x_125 = 0.0f; + int x_108 = 0; + float x_105_phi = 0.0f; + x_104 = x_104_phi; + const int x_107 = x_107_phi; + if ((x_107 < 800)) { + } else { + break; + } + float x_124 = 0.0f; + float x_125_phi = 0.0f; + if (((x_107 % 32) == 0)) { + x_126 = (x_104 + 0.400000006f); + x_105_phi = x_126; + } else { + const float x_118 = thirty_two; + x_125_phi = x_104; + if (((float(x_107) % round(x_118)) <= 0.01f)) { + x_124 = (x_104 + 100.0f); + x_125_phi = x_124; + } + x_125 = x_125_phi; + x_105_phi = x_125; + } + float x_105 = 0.0f; + x_105 = x_105_phi; + const float x_128 = limit; + if ((float(x_107) >= x_128)) { + return x_105; + } + { + x_108 = (x_107 + 1); + x_104_phi = x_105; + x_107_phi = x_108; + } + } + return x_104; +} + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + float3 x_54 = float3(0.0f, 0.0f, 0.0f); + int x_74_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_56 = asfloat(x_10[0].x); + const float x_58 = round((x_56 * 0.125f)); + const float x_60 = gl_FragCoord.x; + param = x_60; + param_1 = x_58; + const float x_61 = compute_value_f1_f1_(param, param_1); + c.x = x_61; + const float x_64 = gl_FragCoord.y; + param_2 = x_64; + param_3 = x_58; + const float x_65 = compute_value_f1_f1_(param_2, param_3); + c.y = x_65; + const float x_67 = c.x; + x_54 = c; + const float x_70 = x_54.y; + c.z = (x_67 + x_70); + x_74_phi = 0; + while (true) { + int x_75 = 0; + const int x_74 = x_74_phi; + if ((x_74 < 3)) { + } else { + break; + } + const int x_80_save = x_74; + const float x_81 = c[x_80_save]; + if ((x_81 >= 1.0f)) { + const float x_86 = asfloat(x_16[0].x); + const float x_88 = asfloat(x_16[0].y); + if ((x_86 > x_88)) { + discard; + } + const float x_92 = c[x_80_save]; + const float x_93 = c[x_80_save]; + set_float3(c, x_80_save, (x_92 * x_93)); + } + { + x_75 = (x_74 + 1); + x_74_phi = x_75; + } + } + const float3 x_97 = normalize(abs(c)); + x_GLF_color = float4(x_97.x, x_97.y, x_97.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.msl new file mode 100755 index 0000000000..12d7016bf6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.msl @@ -0,0 +1,137 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float compute_value_f1_f1_(thread float* const limit, thread float* const thirty_two) { + float x_104 = 0.0f; + float x_104_phi = 0.0f; + int x_107_phi = 0; + x_104_phi = -0.5f; + x_107_phi = 1; + while (true) { + float x_126 = 0.0f; + float x_125 = 0.0f; + int x_108 = 0; + float x_105_phi = 0.0f; + x_104 = x_104_phi; + int const x_107 = x_107_phi; + if ((x_107 < 800)) { + } else { + break; + } + float x_124 = 0.0f; + float x_125_phi = 0.0f; + if (((x_107 % 32) == 0)) { + x_126 = (x_104 + 0.400000006f); + x_105_phi = x_126; + } else { + float const x_118 = *(thirty_two); + x_125_phi = x_104; + if (((float(x_107) % rint(x_118)) <= 0.01f)) { + x_124 = (x_104 + 100.0f); + x_125_phi = x_124; + } + x_125 = x_125_phi; + x_105_phi = x_125; + } + float x_105 = 0.0f; + x_105 = x_105_phi; + float const x_128 = *(limit); + if ((float(x_107) >= x_128)) { + return x_105; + } + { + x_108 = (x_107 + 1); + x_104_phi = x_105; + x_107_phi = x_108; + } + } + return x_104; +} + +void main_1(constant buf0& x_10, constant buf1& x_16, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + float3 x_54 = 0.0f; + int x_74_phi = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_56 = x_10.resolution.x; + float const x_58 = rint((x_56 * 0.125f)); + float const x_60 = (*(tint_symbol_5)).x; + param = x_60; + param_1 = x_58; + float const x_61 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_61; + float const x_64 = (*(tint_symbol_5)).y; + param_2 = x_64; + param_3 = x_58; + float const x_65 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_65; + float const x_67 = c.x; + float3 const x_68 = c; + x_54 = x_68; + float const x_70 = x_54.y; + c.z = (x_67 + x_70); + x_74_phi = 0; + while (true) { + int x_75 = 0; + int const x_74 = x_74_phi; + if ((x_74 < 3)) { + } else { + break; + } + int const x_80_save = x_74; + float const x_81 = c[x_80_save]; + if ((x_81 >= 1.0f)) { + float const x_86 = x_16.injectionSwitch.x; + float const x_88 = x_16.injectionSwitch.y; + if ((x_86 > x_88)) { + discard_fragment(); + } + float const x_92 = c[x_80_save]; + float const x_93 = c[x_80_save]; + c[x_80_save] = (x_92 * x_93); + } + { + x_75 = (x_74 + 1); + x_74_phi = x_75; + } + } + float3 const x_95 = c; + float3 const x_97 = normalize(fabs(x_95)); + *(tint_symbol_6) = float4(x_97.x, x_97.y, x_97.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_10 [[buffer(0)]], constant buf1& x_16 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_10, x_16, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\uq0.0.metal:42:26: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_107) % rint(x_118)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..d6225453c2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.spvasm @@ -0,0 +1,316 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 192 +; Schema: 0 + OpCapability Shader + %67 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_10 "x_10" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_16 "x_16" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %compute_value_f1_f1_ "compute_value_f1_f1_" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %x_104 "x_104" + OpName %x_104_phi "x_104_phi" + OpName %x_107_phi "x_107_phi" + OpName %x_126 "x_126" + OpName %x_125 "x_125" + OpName %x_108 "x_108" + OpName %x_105_phi "x_105_phi" + OpName %x_124 "x_124" + OpName %x_125_phi "x_125_phi" + OpName %x_105 "x_105" + OpName %main_1 "main_1" + OpName %c "c" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %x_54 "x_54" + OpName %x_74_phi "x_74_phi" + OpName %x_75 "x_75" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_16 NonWritable + OpDecorate %x_16 DescriptorSet 0 + OpDecorate %x_16 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_16 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %25 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %void = OpTypeVoid + %92 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %99 = OpConstantNull %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %109 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%float_0_125 = OpConstant %float 0.125 +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %179 = OpTypeFunction %void %main_out +%compute_value_f1_f1_ = OpFunction %float None %18 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %23 = OpLabel + %x_104 = OpVariable %_ptr_Function_float Function %25 + %x_104_phi = OpVariable %_ptr_Function_float Function %25 + %x_107_phi = OpVariable %_ptr_Function_int Function %30 + %x_126 = OpVariable %_ptr_Function_float Function %25 + %x_125 = OpVariable %_ptr_Function_float Function %25 + %x_108 = OpVariable %_ptr_Function_int Function %30 + %x_105_phi = OpVariable %_ptr_Function_float Function %25 + %x_124 = OpVariable %_ptr_Function_float Function %25 + %x_125_phi = OpVariable %_ptr_Function_float Function %25 + %x_105 = OpVariable %_ptr_Function_float Function %25 + OpStore %x_104_phi %float_n0_5 + OpStore %x_107_phi %int_1 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %41 = OpLoad %float %x_104_phi + OpStore %x_104 %41 + %42 = OpLoad %int %x_107_phi + %44 = OpSLessThan %bool %42 %int_800 + OpSelectionMerge %46 None + OpBranchConditional %44 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %34 + %46 = OpLabel + %52 = OpSMod %int %42 %int_32 + %54 = OpIEqual %bool %52 %int_0 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + %58 = OpLoad %float %x_104 + %60 = OpFAdd %float %58 %float_0_400000006 + OpStore %x_126 %60 + %61 = OpLoad %float %x_126 + OpStore %x_105_phi %61 + OpBranch %55 + %57 = OpLabel + %63 = OpLoad %float %thirty_two + %64 = OpLoad %float %x_104 + OpStore %x_125_phi %64 + %65 = OpConvertSToF %float %42 + %66 = OpExtInst %float %67 RoundEven %63 + %68 = OpFMod %float %65 %66 + %70 = OpFOrdLessThanEqual %bool %68 %float_0_00999999978 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %71 + %72 = OpLabel + %73 = OpLoad %float %x_104 + %75 = OpFAdd %float %73 %float_100 + OpStore %x_124 %75 + %76 = OpLoad %float %x_124 + OpStore %x_125_phi %76 + OpBranch %71 + %71 = OpLabel + %77 = OpLoad %float %x_125_phi + OpStore %x_125 %77 + %78 = OpLoad %float %x_125 + OpStore %x_105_phi %78 + OpBranch %55 + %55 = OpLabel + %80 = OpLoad %float %x_105_phi + OpStore %x_105 %80 + %82 = OpLoad %float %limit + %83 = OpConvertSToF %float %42 + %84 = OpFOrdGreaterThanEqual %bool %83 %82 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + %87 = OpLoad %float %x_105 + OpReturnValue %87 + %85 = OpLabel + OpBranch %35 + %35 = OpLabel + %88 = OpIAdd %int %42 %int_1 + OpStore %x_108 %88 + %89 = OpLoad %float %x_105 + OpStore %x_104_phi %89 + %90 = OpLoad %int %x_108 + OpStore %x_107_phi %90 + OpBranch %33 + %34 = OpLabel + %91 = OpLoad %float %x_104 + OpReturnValue %91 + OpFunctionEnd + %main_1 = OpFunction %void None %92 + %95 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %99 + %param = OpVariable %_ptr_Function_float Function %25 + %param_1 = OpVariable %_ptr_Function_float Function %25 + %param_2 = OpVariable %_ptr_Function_float Function %25 + %param_3 = OpVariable %_ptr_Function_float Function %25 + %x_54 = OpVariable %_ptr_Function_v3float Function %99 + %x_74_phi = OpVariable %_ptr_Function_int Function %30 + %x_75 = OpVariable %_ptr_Function_int Function %30 + OpStore %c %109 + %113 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0 + %114 = OpLoad %float %113 + %117 = OpFMul %float %114 %float_0_125 + %115 = OpExtInst %float %67 RoundEven %117 + %119 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %120 = OpLoad %float %119 + OpStore %param %120 + OpStore %param_1 %115 + %121 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1 + %124 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %124 %121 + %126 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %127 = OpLoad %float %126 + OpStore %param_2 %127 + OpStore %param_3 %115 + %128 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3 + %131 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %131 %128 + %132 = OpAccessChain %_ptr_Function_float %c %uint_0 + %133 = OpLoad %float %132 + %134 = OpLoad %v3float %c + OpStore %x_54 %134 + %135 = OpAccessChain %_ptr_Function_float %x_54 %uint_1 + %136 = OpLoad %float %135 + %138 = OpAccessChain %_ptr_Function_float %c %uint_2 + %139 = OpFAdd %float %133 %136 + OpStore %138 %139 + OpStore %x_74_phi %int_0 + OpBranch %140 + %140 = OpLabel + OpLoopMerge %141 %142 None + OpBranch %143 + %143 = OpLabel + %145 = OpLoad %int %x_74_phi + %147 = OpSLessThan %bool %145 %int_3 + OpSelectionMerge %148 None + OpBranchConditional %147 %149 %150 + %149 = OpLabel + OpBranch %148 + %150 = OpLabel + OpBranch %141 + %148 = OpLabel + %151 = OpAccessChain %_ptr_Function_float %c %145 + %152 = OpLoad %float %151 + %154 = OpFOrdGreaterThanEqual %bool %152 %float_1 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %155 + %156 = OpLabel + %157 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_0 + %158 = OpLoad %float %157 + %159 = OpAccessChain %_ptr_Uniform_float %x_16 %uint_0 %uint_1 + %160 = OpLoad %float %159 + %161 = OpFOrdGreaterThan %bool %158 %160 + OpSelectionMerge %162 None + OpBranchConditional %161 %163 %162 + %163 = OpLabel + OpKill + %162 = OpLabel + %164 = OpAccessChain %_ptr_Function_float %c %145 + %165 = OpLoad %float %164 + %166 = OpAccessChain %_ptr_Function_float %c %145 + %167 = OpLoad %float %166 + %168 = OpAccessChain %_ptr_Function_float %c %145 + %169 = OpFMul %float %165 %167 + OpStore %168 %169 + OpBranch %155 + %155 = OpLabel + OpBranch %142 + %142 = OpLabel + %170 = OpIAdd %int %145 %int_1 + OpStore %x_75 %170 + %171 = OpLoad %int %x_75 + OpStore %x_74_phi %171 + OpBranch %140 + %141 = OpLabel + %172 = OpLoad %v3float %c + %174 = OpExtInst %v3float %67 FAbs %172 + %173 = OpExtInst %v3float %67 Normalize %174 + %175 = OpCompositeExtract %float %173 0 + %176 = OpCompositeExtract %float %173 1 + %177 = OpCompositeExtract %float %173 2 + %178 = OpCompositeConstruct %v4float %175 %176 %177 %float_1 + OpStore %x_GLF_color %178 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %179 +%tint_symbol_1 = OpFunctionParameter %main_out + %183 = OpLabel + %184 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %184 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %92 + %186 = OpLabel + %187 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %187 + %188 = OpFunctionCall %void %main_1 + %190 = OpLoad %v4float %x_GLF_color + %191 = OpCompositeConstruct %main_out %190 + %189 = OpFunctionCall %void %tint_symbol_3 %191 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..57edb9b503 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-divided-1/1.wgsl.expected.wgsl @@ -0,0 +1,136 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_10 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_16 : buf1; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var x_104 : f32; + var x_104_phi : f32; + var x_107_phi : i32; + x_104_phi = -0.5; + x_107_phi = 1; + loop { + var x_126 : f32; + var x_125 : f32; + var x_108 : i32; + var x_105_phi : f32; + x_104 = x_104_phi; + let x_107 : i32 = x_107_phi; + if ((x_107 < 800)) { + } else { + break; + } + var x_124 : f32; + var x_125_phi : f32; + if (((x_107 % 32) == 0)) { + x_126 = (x_104 + 0.400000006); + x_105_phi = x_126; + } else { + let x_118 : f32 = *(thirty_two); + x_125_phi = x_104; + if (((f32(x_107) % round(x_118)) <= 0.01)) { + x_124 = (x_104 + 100.0); + x_125_phi = x_124; + } + x_125 = x_125_phi; + x_105_phi = x_125; + } + var x_105 : f32; + x_105 = x_105_phi; + let x_128 : f32 = *(limit); + if ((f32(x_107) >= x_128)) { + return x_105; + } + + continuing { + x_108 = (x_107 + 1); + x_104_phi = x_105; + x_107_phi = x_108; + } + } + return x_104; +} + +fn main_1() { + var c : vec3; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var x_54 : vec3; + var x_74_phi : i32; + c = vec3(7.0, 8.0, 9.0); + let x_56 : f32 = x_10.resolution.x; + let x_58 : f32 = round((x_56 * 0.125)); + let x_60 : f32 = gl_FragCoord.x; + param = x_60; + param_1 = x_58; + let x_61 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + let x_62 : ptr = &(c.x); + *(x_62) = x_61; + let x_64 : f32 = gl_FragCoord.y; + param_2 = x_64; + param_3 = x_58; + let x_65 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_65; + let x_67 : f32 = *(x_62); + let x_68 : vec3 = c; + x_54 = x_68; + let x_70 : f32 = x_54.y; + c.z = (x_67 + x_70); + x_74_phi = 0; + loop { + var x_75 : i32; + let x_74 : i32 = x_74_phi; + if ((x_74 < 3)) { + } else { + break; + } + let x_80 : ptr = &(c[x_74]); + let x_81 : f32 = *(x_80); + if ((x_81 >= 1.0)) { + let x_86 : f32 = x_16.injectionSwitch.x; + let x_88 : f32 = x_16.injectionSwitch.y; + if ((x_86 > x_88)) { + discard; + } + let x_92 : f32 = *(x_80); + let x_93 : f32 = *(x_80); + *(x_80) = (x_92 * x_93); + } + + continuing { + x_75 = (x_74 + 1); + x_74_phi = x_75; + } + } + let x_95 : vec3 = c; + let x_97 : vec3 = normalize(abs(x_95)); + x_GLF_color = vec4(x_97.x, x_97.y, x_97.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm new file mode 100644 index 0000000000..9ae0514be5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm @@ -0,0 +1,275 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %compute_value_f1_f1_ "compute_value(f1;f1;" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %result "result" + OpName %i "i" + OpName %c "c" + OpName %thirty_two_0 "thirty_two" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %__0 "" + OpName %i_0 "i" + OpName %j "j" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %float_n0_5 = OpConstant %float -0.5 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %43 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 + %true = OpConstantTrue %bool + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %23 + %60 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function +%thirty_two_0 = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_float Function + %param_1 = OpVariable %_ptr_Function_float Function + %param_2 = OpVariable %_ptr_Function_float Function + %61 = OpVariable %_ptr_Function_v3float Function + %i_0 = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_float Function + OpStore %c %43 + %62 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %63 = OpLoad %float %62 + %64 = OpFDiv %float %63 %float_8 + %65 = OpExtInst %float %1 Round %64 + OpStore %thirty_two_0 %65 + %66 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %67 = OpLoad %float %66 + OpStore %param %67 + %68 = OpLoad %float %thirty_two_0 + OpStore %param_0 %68 + %69 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_0 + %70 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %70 %69 + %71 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %72 = OpLoad %float %71 + OpStore %param_1 %72 + %73 = OpLoad %float %thirty_two_0 + OpStore %param_2 %73 + %74 = OpFunctionCall %float %compute_value_f1_f1_ %param_1 %param_2 + %75 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %75 %74 + %76 = OpAccessChain %_ptr_Function_float %c %uint_0 + %77 = OpLoad %float %76 + OpSelectionMerge %78 None + OpBranchConditional %true %79 %80 + %79 = OpLabel + %81 = OpLoad %v3float %c + OpStore %61 %81 + OpBranch %78 + %80 = OpLabel + %82 = OpLoad %v3float %c + %83 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %84 = OpLoad %float %83 + %85 = OpVectorTimesScalar %v3float %82 %84 + OpStore %61 %85 + OpBranch %78 + %78 = OpLabel + %86 = OpAccessChain %_ptr_Function_float %61 %uint_1 + %87 = OpLoad %float %86 + %88 = OpFAdd %float %77 %87 + %89 = OpAccessChain %_ptr_Function_float %c %uint_2 + OpStore %89 %88 + OpStore %i_0 %int_0 + OpBranch %90 + %90 = OpLabel + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %94 = OpLoad %int %i_0 + %95 = OpSLessThan %bool %94 %int_3 + OpBranchConditional %95 %96 %91 + %96 = OpLabel + %97 = OpLoad %int %i_0 + %98 = OpAccessChain %_ptr_Function_float %c %97 + %99 = OpLoad %float %98 + %100 = OpFOrdGreaterThanEqual %bool %99 %float_1 + OpSelectionMerge %101 None + OpBranchConditional %100 %102 %101 + %102 = OpLabel + %103 = OpLoad %int %i_0 + %104 = OpLoad %int %i_0 + %105 = OpAccessChain %_ptr_Function_float %c %104 + %106 = OpLoad %float %105 + %107 = OpLoad %int %i_0 + %108 = OpAccessChain %_ptr_Function_float %c %107 + %109 = OpLoad %float %108 + %110 = OpFMul %float %106 %109 + %111 = OpAccessChain %_ptr_Function_float %c %103 + OpStore %111 %110 + OpBranch %101 + %101 = OpLabel + OpStore %j %float_0 + OpBranch %112 + %112 = OpLabel + OpLoopMerge %113 %114 None + OpBranch %115 + %115 = OpLabel + %116 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %117 = OpLoad %float %116 + %118 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %119 = OpLoad %float %118 + %120 = OpFOrdGreaterThan %bool %117 %119 + OpBranchConditional %120 %121 %113 + %121 = OpLabel + %122 = OpLoad %float %j + %123 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %124 = OpLoad %float %123 + %125 = OpFOrdGreaterThanEqual %bool %122 %124 + OpSelectionMerge %126 None + OpBranchConditional %125 %127 %126 + %127 = OpLabel + OpBranch %113 + %126 = OpLabel + %128 = OpLoad %float %j + %129 = OpFAdd %float %128 %float_1 + OpStore %j %129 + OpBranch %114 + %114 = OpLabel + OpBranch %112 + %113 = OpLabel + OpBranch %92 + %92 = OpLabel + %130 = OpLoad %int %i_0 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_0 %131 + OpBranch %90 + %91 = OpLabel + %132 = OpLoad %v3float %c + %133 = OpExtInst %v3float %1 FAbs %132 + %134 = OpExtInst %v3float %1 Normalize %133 + %135 = OpCompositeExtract %float %134 0 + %136 = OpCompositeExtract %float %134 1 + %137 = OpCompositeExtract %float %134 2 + %138 = OpCompositeConstruct %v4float %135 %136 %137 %float_1 + OpStore %_GLF_color %138 + OpReturn + OpFunctionEnd +%compute_value_f1_f1_ = OpFunction %float None %26 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %139 = OpLabel + %result = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + OpStore %result %float_n0_5 + OpStore %i %int_1 + OpBranch %140 + %140 = OpLabel + OpLoopMerge %141 %142 None + OpBranch %143 + %143 = OpLabel + %144 = OpLoad %int %i + %145 = OpSLessThan %bool %144 %int_800 + OpBranchConditional %145 %146 %141 + %146 = OpLabel + %147 = OpLoad %int %i + %148 = OpSMod %int %147 %int_32 + %149 = OpIEqual %bool %148 %int_0 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %152 + %151 = OpLabel + %153 = OpLoad %float %result + %154 = OpFAdd %float %153 %float_0_400000006 + OpStore %result %154 + OpBranch %150 + %152 = OpLabel + %155 = OpLoad %int %i + %156 = OpConvertSToF %float %155 + %157 = OpLoad %float %thirty_two + %158 = OpExtInst %float %1 Round %157 + %159 = OpFMod %float %156 %158 + %160 = OpFOrdLessThanEqual %bool %159 %float_0_00999999978 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %161 + %162 = OpLabel + %163 = OpLoad %float %result + %164 = OpFAdd %float %163 %float_100 + OpStore %result %164 + OpBranch %161 + %161 = OpLabel + OpBranch %150 + %150 = OpLabel + %165 = OpLoad %int %i + %166 = OpConvertSToF %float %165 + %167 = OpLoad %float %limit + %168 = OpFOrdGreaterThanEqual %bool %166 %167 + OpSelectionMerge %169 None + OpBranchConditional %168 %170 %169 + %170 = OpLabel + %171 = OpLoad %float %result + OpReturnValue %171 + %169 = OpLabel + OpBranch %142 + %142 = OpLabel + %172 = OpLoad %int %i + %173 = OpIAdd %int %172 %int_1 + OpStore %i %173 + OpBranch %140 + %141 = OpLabel + %174 = OpLoad %float %result + OpReturnValue %174 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..8f3bad1342 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.hlsl @@ -0,0 +1,122 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_19 : register(b1, space0) { + uint4 x_19[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float compute_value_f1_f1_(inout float limit, inout float thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + { + for(; (i < 800); i = (i + 1)) { + if (((i % 32) == 0)) { + result = (result + 0.400000006f); + } else { + const int x_155 = i; + const float x_157 = thirty_two; + if (((float(x_155) % round(x_157)) <= 0.01f)) { + result = (result + 100.0f); + } + } + const int x_165 = i; + const float x_167 = limit; + if ((float(x_165) >= x_167)) { + return result; + } + } + } + return result; +} + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + float3 x_61 = float3(0.0f, 0.0f, 0.0f); + int i_1 = 0; + float j = 0.0f; + c = float3(7.0f, 8.0f, 9.0f); + const float x_63 = asfloat(x_13[0].x); + thirty_two_1 = round((x_63 / 8.0f)); + const float x_67 = gl_FragCoord.x; + param = x_67; + param_1 = thirty_two_1; + const float x_69 = compute_value_f1_f1_(param, param_1); + c.x = x_69; + const float x_72 = gl_FragCoord.y; + param_2 = x_72; + param_3 = thirty_two_1; + const float x_74 = compute_value_f1_f1_(param_2, param_3); + c.y = x_74; + const float x_77 = c.x; + if (true) { + x_61 = c; + } else { + const float3 x_82 = c; + const float x_84 = asfloat(x_19[0].x); + x_61 = (x_82 * x_84); + } + const float x_87 = x_61.y; + c.z = (x_77 + x_87); + i_1 = 0; + { + for(; (i_1 < 3); i_1 = (i_1 + 1)) { + const float x_99 = c[i_1]; + if ((x_99 >= 1.0f)) { + const int x_103 = i_1; + const float x_106 = c[i_1]; + const float x_109 = c[i_1]; + set_float3(c, x_103, (x_106 * x_109)); + } + j = 0.0f; + while (true) { + const float x_117 = asfloat(x_19[0].x); + const float x_119 = asfloat(x_19[0].y); + if ((x_117 > x_119)) { + } else { + break; + } + const float x_122 = j; + const float x_124 = asfloat(x_19[0].x); + if ((x_122 >= x_124)) { + break; + } + j = (j + 1.0f); + } + } + } + const float3 x_134 = normalize(abs(c)); + x_GLF_color = float4(x_134.x, x_134.y, x_134.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.msl new file mode 100755 index 0000000000..721f3ab5ec --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.msl @@ -0,0 +1,151 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float compute_value_f1_f1_(thread float* const limit, thread float* const thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + while (true) { + int const x_144 = i; + if ((x_144 < 800)) { + } else { + break; + } + int const x_147 = i; + if (((x_147 % 32) == 0)) { + float const x_153 = result; + result = (x_153 + 0.400000006f); + } else { + int const x_155 = i; + float const x_157 = *(thirty_two); + if (((float(x_155) % rint(x_157)) <= 0.01f)) { + float const x_163 = result; + result = (x_163 + 100.0f); + } + } + int const x_165 = i; + float const x_167 = *(limit); + if ((float(x_165) >= x_167)) { + float const x_171 = result; + return x_171; + } + { + int const x_172 = i; + i = (x_172 + 1); + } + } + float const x_174 = result; + return x_174; +} + +void main_1(constant buf0& x_13, constant buf1& x_19, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + float3 x_61 = 0.0f; + int i_1 = 0; + float j = 0.0f; + c = float3(7.0f, 8.0f, 9.0f); + float const x_63 = x_13.resolution.x; + thirty_two_1 = rint((x_63 / 8.0f)); + float const x_67 = (*(tint_symbol_5)).x; + param = x_67; + float const x_68 = thirty_two_1; + param_1 = x_68; + float const x_69 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_69; + float const x_72 = (*(tint_symbol_5)).y; + param_2 = x_72; + float const x_73 = thirty_two_1; + param_3 = x_73; + float const x_74 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_74; + float const x_77 = c.x; + if (true) { + float3 const x_81 = c; + x_61 = x_81; + } else { + float3 const x_82 = c; + float const x_84 = x_19.injectionSwitch.x; + x_61 = (x_82 * x_84); + } + float const x_87 = x_61.y; + c.z = (x_77 + x_87); + i_1 = 0; + while (true) { + int const x_94 = i_1; + if ((x_94 < 3)) { + } else { + break; + } + int const x_97 = i_1; + float const x_99 = c[x_97]; + if ((x_99 >= 1.0f)) { + int const x_103 = i_1; + int const x_104 = i_1; + float const x_106 = c[x_104]; + int const x_107 = i_1; + float const x_109 = c[x_107]; + c[x_103] = (x_106 * x_109); + } + j = 0.0f; + while (true) { + float const x_117 = x_19.injectionSwitch.x; + float const x_119 = x_19.injectionSwitch.y; + if ((x_117 > x_119)) { + } else { + break; + } + float const x_122 = j; + float const x_124 = x_19.injectionSwitch.x; + if ((x_122 >= x_124)) { + break; + } + float const x_128 = j; + j = (x_128 + 1.0f); + } + { + int const x_130 = i_1; + i_1 = (x_130 + 1); + } + } + float3 const x_132 = c; + float3 const x_134 = normalize(fabs(x_132)); + *(tint_symbol_6) = float4(x_134.x, x_134.y, x_134.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]], constant buf1& x_19 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_13, x_19, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\ufhc.0.metal:35:26: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_155) % rint(x_157)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..304913e864 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.spvasm @@ -0,0 +1,331 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 207 +; Schema: 0 + OpCapability Shader + %59 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_13 "x_13" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_19 "x_19" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %compute_value_f1_f1_ "compute_value_f1_f1_" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %result "result" + OpName %i "i" + OpName %main_1 "main_1" + OpName %c "c" + OpName %thirty_two_1 "thirty_two_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %x_61 "x_61" + OpName %i_1 "i_1" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_19 NonWritable + OpDecorate %x_19 DescriptorSet 0 + OpDecorate %x_19 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_19 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %25 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %void = OpTypeVoid + %79 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %86 = OpConstantNull %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %98 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %194 = OpTypeFunction %void %main_out +%compute_value_f1_f1_ = OpFunction %float None %18 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %23 = OpLabel + %result = OpVariable %_ptr_Function_float Function %25 + %i = OpVariable %_ptr_Function_int Function %29 + OpStore %result %float_n0_5 + OpStore %i %int_1 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %38 = OpSLessThan %bool %36 %int_800 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %33 + %40 = OpLabel + %43 = OpLoad %int %i + %45 = OpSMod %int %43 %int_32 + %47 = OpIEqual %bool %45 %int_0 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + %51 = OpLoad %float %result + %53 = OpFAdd %float %51 %float_0_400000006 + OpStore %result %53 + OpBranch %48 + %50 = OpLabel + %54 = OpLoad %int %i + %56 = OpLoad %float %thirty_two + %57 = OpConvertSToF %float %54 + %58 = OpExtInst %float %59 RoundEven %56 + %60 = OpFMod %float %57 %58 + %62 = OpFOrdLessThanEqual %bool %60 %float_0_00999999978 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + %65 = OpLoad %float %result + %67 = OpFAdd %float %65 %float_100 + OpStore %result %67 + OpBranch %63 + %63 = OpLabel + OpBranch %48 + %48 = OpLabel + %68 = OpLoad %int %i + %70 = OpLoad %float %limit + %71 = OpConvertSToF %float %68 + %72 = OpFOrdGreaterThanEqual %bool %71 %70 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpLoad %float %result + OpReturnValue %75 + %73 = OpLabel + OpBranch %34 + %34 = OpLabel + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + OpBranch %32 + %33 = OpLabel + %78 = OpLoad %float %result + OpReturnValue %78 + OpFunctionEnd + %main_1 = OpFunction %void None %79 + %82 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %86 +%thirty_two_1 = OpVariable %_ptr_Function_float Function %25 + %param = OpVariable %_ptr_Function_float Function %25 + %param_1 = OpVariable %_ptr_Function_float Function %25 + %param_2 = OpVariable %_ptr_Function_float Function %25 + %param_3 = OpVariable %_ptr_Function_float Function %25 + %x_61 = OpVariable %_ptr_Function_v3float Function %86 + %i_1 = OpVariable %_ptr_Function_int Function %29 + %j = OpVariable %_ptr_Function_float Function %25 + OpStore %c %98 + %102 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0 + %103 = OpLoad %float %102 + %105 = OpFDiv %float %103 %float_8 + %104 = OpExtInst %float %59 RoundEven %105 + OpStore %thirty_two_1 %104 + %107 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %108 = OpLoad %float %107 + OpStore %param %108 + %109 = OpLoad %float %thirty_two_1 + OpStore %param_1 %109 + %110 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1 + %113 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %113 %110 + %115 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %116 = OpLoad %float %115 + OpStore %param_2 %116 + %117 = OpLoad %float %thirty_two_1 + OpStore %param_3 %117 + %118 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3 + %121 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %121 %118 + %122 = OpAccessChain %_ptr_Function_float %c %uint_0 + %123 = OpLoad %float %122 + OpSelectionMerge %125 None + OpBranchConditional %true %126 %127 + %126 = OpLabel + %128 = OpLoad %v3float %c + OpStore %x_61 %128 + OpBranch %125 + %127 = OpLabel + %129 = OpLoad %v3float %c + %130 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_0 + %131 = OpLoad %float %130 + %132 = OpVectorTimesScalar %v3float %129 %131 + OpStore %x_61 %132 + OpBranch %125 + %125 = OpLabel + %133 = OpAccessChain %_ptr_Function_float %x_61 %uint_1 + %134 = OpLoad %float %133 + %136 = OpAccessChain %_ptr_Function_float %c %uint_2 + %137 = OpFAdd %float %123 %134 + OpStore %136 %137 + OpStore %i_1 %int_0 + OpBranch %138 + %138 = OpLabel + OpLoopMerge %139 %140 None + OpBranch %141 + %141 = OpLabel + %142 = OpLoad %int %i_1 + %144 = OpSLessThan %bool %142 %int_3 + OpSelectionMerge %145 None + OpBranchConditional %144 %146 %147 + %146 = OpLabel + OpBranch %145 + %147 = OpLabel + OpBranch %139 + %145 = OpLabel + %148 = OpLoad %int %i_1 + %149 = OpAccessChain %_ptr_Function_float %c %148 + %150 = OpLoad %float %149 + %152 = OpFOrdGreaterThanEqual %bool %150 %float_1 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + %155 = OpLoad %int %i_1 + %156 = OpLoad %int %i_1 + %157 = OpAccessChain %_ptr_Function_float %c %156 + %158 = OpLoad %float %157 + %159 = OpLoad %int %i_1 + %160 = OpAccessChain %_ptr_Function_float %c %159 + %161 = OpLoad %float %160 + %162 = OpAccessChain %_ptr_Function_float %c %155 + %163 = OpFMul %float %158 %161 + OpStore %162 %163 + OpBranch %153 + %153 = OpLabel + OpStore %j %float_0 + OpBranch %165 + %165 = OpLabel + OpLoopMerge %166 %167 None + OpBranch %168 + %168 = OpLabel + %169 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_0 + %170 = OpLoad %float %169 + %171 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_1 + %172 = OpLoad %float %171 + %173 = OpFOrdGreaterThan %bool %170 %172 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %176 + %175 = OpLabel + OpBranch %174 + %176 = OpLabel + OpBranch %166 + %174 = OpLabel + %177 = OpLoad %float %j + %178 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_0 + %179 = OpLoad %float %178 + %180 = OpFOrdGreaterThanEqual %bool %177 %179 + OpSelectionMerge %181 None + OpBranchConditional %180 %182 %181 + %182 = OpLabel + OpBranch %166 + %181 = OpLabel + %183 = OpLoad %float %j + %184 = OpFAdd %float %183 %float_1 + OpStore %j %184 + OpBranch %167 + %167 = OpLabel + OpBranch %165 + %166 = OpLabel + OpBranch %140 + %140 = OpLabel + %185 = OpLoad %int %i_1 + %186 = OpIAdd %int %185 %int_1 + OpStore %i_1 %186 + OpBranch %138 + %139 = OpLabel + %187 = OpLoad %v3float %c + %189 = OpExtInst %v3float %59 FAbs %187 + %188 = OpExtInst %v3float %59 Normalize %189 + %190 = OpCompositeExtract %float %188 0 + %191 = OpCompositeExtract %float %188 1 + %192 = OpCompositeExtract %float %188 2 + %193 = OpCompositeConstruct %v4float %190 %191 %192 %float_1 + OpStore %x_GLF_color %193 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %194 +%tint_symbol_1 = OpFunctionParameter %main_out + %198 = OpLabel + %199 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %199 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %79 + %201 = OpLabel + %202 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %202 + %203 = OpFunctionCall %void %main_1 + %205 = OpLoad %v4float %x_GLF_color + %206 = OpCompositeConstruct %main_out %205 + %204 = OpFunctionCall %void %tint_symbol_3 %206 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..97ffaf9355 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.spvasm.expected.wgsl @@ -0,0 +1,149 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_13 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_19 : buf1; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var result : f32; + var i : i32; + result = -0.5; + i = 1; + loop { + let x_144 : i32 = i; + if ((x_144 < 800)) { + } else { + break; + } + let x_147 : i32 = i; + if (((x_147 % 32) == 0)) { + let x_153 : f32 = result; + result = (x_153 + 0.400000006); + } else { + let x_155 : i32 = i; + let x_157 : f32 = *(thirty_two); + if (((f32(x_155) % round(x_157)) <= 0.01)) { + let x_163 : f32 = result; + result = (x_163 + 100.0); + } + } + let x_165 : i32 = i; + let x_167 : f32 = *(limit); + if ((f32(x_165) >= x_167)) { + let x_171 : f32 = result; + return x_171; + } + + continuing { + let x_172 : i32 = i; + i = (x_172 + 1); + } + } + let x_174 : f32 = result; + return x_174; +} + +fn main_1() { + var c : vec3; + var thirty_two_1 : f32; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var x_61 : vec3; + var i_1 : i32; + var j : f32; + c = vec3(7.0, 8.0, 9.0); + let x_63 : f32 = x_13.resolution.x; + thirty_two_1 = round((x_63 / 8.0)); + let x_67 : f32 = gl_FragCoord.x; + param = x_67; + let x_68 : f32 = thirty_two_1; + param_1 = x_68; + let x_69 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_69; + let x_72 : f32 = gl_FragCoord.y; + param_2 = x_72; + let x_73 : f32 = thirty_two_1; + param_3 = x_73; + let x_74 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_74; + let x_77 : f32 = c.x; + if (true) { + let x_81 : vec3 = c; + x_61 = x_81; + } else { + let x_82 : vec3 = c; + let x_84 : f32 = x_19.injectionSwitch.x; + x_61 = (x_82 * x_84); + } + let x_87 : f32 = x_61.y; + c.z = (x_77 + x_87); + i_1 = 0; + loop { + let x_94 : i32 = i_1; + if ((x_94 < 3)) { + } else { + break; + } + let x_97 : i32 = i_1; + let x_99 : f32 = c[x_97]; + if ((x_99 >= 1.0)) { + let x_103 : i32 = i_1; + let x_104 : i32 = i_1; + let x_106 : f32 = c[x_104]; + let x_107 : i32 = i_1; + let x_109 : f32 = c[x_107]; + c[x_103] = (x_106 * x_109); + } + j = 0.0; + loop { + let x_117 : f32 = x_19.injectionSwitch.x; + let x_119 : f32 = x_19.injectionSwitch.y; + if ((x_117 > x_119)) { + } else { + break; + } + let x_122 : f32 = j; + let x_124 : f32 = x_19.injectionSwitch.x; + if ((x_122 >= x_124)) { + break; + } + let x_128 : f32 = j; + j = (x_128 + 1.0); + } + + continuing { + let x_130 : i32 = i_1; + i_1 = (x_130 + 1); + } + } + let x_132 : vec3 = c; + let x_134 : vec3 = normalize(abs(x_132)); + x_GLF_color = vec4(x_134.x, x_134.y, x_134.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl new file mode 100644 index 0000000000..97ffaf9355 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl @@ -0,0 +1,149 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_13 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_19 : buf1; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var result : f32; + var i : i32; + result = -0.5; + i = 1; + loop { + let x_144 : i32 = i; + if ((x_144 < 800)) { + } else { + break; + } + let x_147 : i32 = i; + if (((x_147 % 32) == 0)) { + let x_153 : f32 = result; + result = (x_153 + 0.400000006); + } else { + let x_155 : i32 = i; + let x_157 : f32 = *(thirty_two); + if (((f32(x_155) % round(x_157)) <= 0.01)) { + let x_163 : f32 = result; + result = (x_163 + 100.0); + } + } + let x_165 : i32 = i; + let x_167 : f32 = *(limit); + if ((f32(x_165) >= x_167)) { + let x_171 : f32 = result; + return x_171; + } + + continuing { + let x_172 : i32 = i; + i = (x_172 + 1); + } + } + let x_174 : f32 = result; + return x_174; +} + +fn main_1() { + var c : vec3; + var thirty_two_1 : f32; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var x_61 : vec3; + var i_1 : i32; + var j : f32; + c = vec3(7.0, 8.0, 9.0); + let x_63 : f32 = x_13.resolution.x; + thirty_two_1 = round((x_63 / 8.0)); + let x_67 : f32 = gl_FragCoord.x; + param = x_67; + let x_68 : f32 = thirty_two_1; + param_1 = x_68; + let x_69 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_69; + let x_72 : f32 = gl_FragCoord.y; + param_2 = x_72; + let x_73 : f32 = thirty_two_1; + param_3 = x_73; + let x_74 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_74; + let x_77 : f32 = c.x; + if (true) { + let x_81 : vec3 = c; + x_61 = x_81; + } else { + let x_82 : vec3 = c; + let x_84 : f32 = x_19.injectionSwitch.x; + x_61 = (x_82 * x_84); + } + let x_87 : f32 = x_61.y; + c.z = (x_77 + x_87); + i_1 = 0; + loop { + let x_94 : i32 = i_1; + if ((x_94 < 3)) { + } else { + break; + } + let x_97 : i32 = i_1; + let x_99 : f32 = c[x_97]; + if ((x_99 >= 1.0)) { + let x_103 : i32 = i_1; + let x_104 : i32 = i_1; + let x_106 : f32 = c[x_104]; + let x_107 : i32 = i_1; + let x_109 : f32 = c[x_107]; + c[x_103] = (x_106 * x_109); + } + j = 0.0; + loop { + let x_117 : f32 = x_19.injectionSwitch.x; + let x_119 : f32 = x_19.injectionSwitch.y; + if ((x_117 > x_119)) { + } else { + break; + } + let x_122 : f32 = j; + let x_124 : f32 = x_19.injectionSwitch.x; + if ((x_122 >= x_124)) { + break; + } + let x_128 : f32 = j; + j = (x_128 + 1.0); + } + + continuing { + let x_130 : i32 = i_1; + i_1 = (x_130 + 1); + } + } + let x_132 : vec3 = c; + let x_134 : vec3 = normalize(abs(x_132)); + x_GLF_color = vec4(x_134.x, x_134.y, x_134.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..8f3bad1342 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.hlsl @@ -0,0 +1,122 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_19 : register(b1, space0) { + uint4 x_19[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float compute_value_f1_f1_(inout float limit, inout float thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + { + for(; (i < 800); i = (i + 1)) { + if (((i % 32) == 0)) { + result = (result + 0.400000006f); + } else { + const int x_155 = i; + const float x_157 = thirty_two; + if (((float(x_155) % round(x_157)) <= 0.01f)) { + result = (result + 100.0f); + } + } + const int x_165 = i; + const float x_167 = limit; + if ((float(x_165) >= x_167)) { + return result; + } + } + } + return result; +} + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + float3 x_61 = float3(0.0f, 0.0f, 0.0f); + int i_1 = 0; + float j = 0.0f; + c = float3(7.0f, 8.0f, 9.0f); + const float x_63 = asfloat(x_13[0].x); + thirty_two_1 = round((x_63 / 8.0f)); + const float x_67 = gl_FragCoord.x; + param = x_67; + param_1 = thirty_two_1; + const float x_69 = compute_value_f1_f1_(param, param_1); + c.x = x_69; + const float x_72 = gl_FragCoord.y; + param_2 = x_72; + param_3 = thirty_two_1; + const float x_74 = compute_value_f1_f1_(param_2, param_3); + c.y = x_74; + const float x_77 = c.x; + if (true) { + x_61 = c; + } else { + const float3 x_82 = c; + const float x_84 = asfloat(x_19[0].x); + x_61 = (x_82 * x_84); + } + const float x_87 = x_61.y; + c.z = (x_77 + x_87); + i_1 = 0; + { + for(; (i_1 < 3); i_1 = (i_1 + 1)) { + const float x_99 = c[i_1]; + if ((x_99 >= 1.0f)) { + const int x_103 = i_1; + const float x_106 = c[i_1]; + const float x_109 = c[i_1]; + set_float3(c, x_103, (x_106 * x_109)); + } + j = 0.0f; + while (true) { + const float x_117 = asfloat(x_19[0].x); + const float x_119 = asfloat(x_19[0].y); + if ((x_117 > x_119)) { + } else { + break; + } + const float x_122 = j; + const float x_124 = asfloat(x_19[0].x); + if ((x_122 >= x_124)) { + break; + } + j = (j + 1.0f); + } + } + } + const float3 x_134 = normalize(abs(c)); + x_GLF_color = float4(x_134.x, x_134.y, x_134.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.msl new file mode 100755 index 0000000000..2641e759c5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.msl @@ -0,0 +1,151 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float compute_value_f1_f1_(thread float* const limit, thread float* const thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + while (true) { + int const x_144 = i; + if ((x_144 < 800)) { + } else { + break; + } + int const x_147 = i; + if (((x_147 % 32) == 0)) { + float const x_153 = result; + result = (x_153 + 0.400000006f); + } else { + int const x_155 = i; + float const x_157 = *(thirty_two); + if (((float(x_155) % rint(x_157)) <= 0.01f)) { + float const x_163 = result; + result = (x_163 + 100.0f); + } + } + int const x_165 = i; + float const x_167 = *(limit); + if ((float(x_165) >= x_167)) { + float const x_171 = result; + return x_171; + } + { + int const x_172 = i; + i = (x_172 + 1); + } + } + float const x_174 = result; + return x_174; +} + +void main_1(constant buf0& x_13, constant buf1& x_19, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + float3 x_61 = 0.0f; + int i_1 = 0; + float j = 0.0f; + c = float3(7.0f, 8.0f, 9.0f); + float const x_63 = x_13.resolution.x; + thirty_two_1 = rint((x_63 / 8.0f)); + float const x_67 = (*(tint_symbol_5)).x; + param = x_67; + float const x_68 = thirty_two_1; + param_1 = x_68; + float const x_69 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_69; + float const x_72 = (*(tint_symbol_5)).y; + param_2 = x_72; + float const x_73 = thirty_two_1; + param_3 = x_73; + float const x_74 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_74; + float const x_77 = c.x; + if (true) { + float3 const x_81 = c; + x_61 = x_81; + } else { + float3 const x_82 = c; + float const x_84 = x_19.injectionSwitch.x; + x_61 = (x_82 * x_84); + } + float const x_87 = x_61.y; + c.z = (x_77 + x_87); + i_1 = 0; + while (true) { + int const x_94 = i_1; + if ((x_94 < 3)) { + } else { + break; + } + int const x_97 = i_1; + float const x_99 = c[x_97]; + if ((x_99 >= 1.0f)) { + int const x_103 = i_1; + int const x_104 = i_1; + float const x_106 = c[x_104]; + int const x_107 = i_1; + float const x_109 = c[x_107]; + c[x_103] = (x_106 * x_109); + } + j = 0.0f; + while (true) { + float const x_117 = x_19.injectionSwitch.x; + float const x_119 = x_19.injectionSwitch.y; + if ((x_117 > x_119)) { + } else { + break; + } + float const x_122 = j; + float const x_124 = x_19.injectionSwitch.x; + if ((x_122 >= x_124)) { + break; + } + float const x_128 = j; + j = (x_128 + 1.0f); + } + { + int const x_130 = i_1; + i_1 = (x_130 + 1); + } + } + float3 const x_132 = c; + float3 const x_134 = normalize(fabs(x_132)); + *(tint_symbol_6) = float4(x_134.x, x_134.y, x_134.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]], constant buf1& x_19 [[buffer(1)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_13, x_19, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\u7k8.0.metal:35:26: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_155) % rint(x_157)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..304913e864 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.spvasm @@ -0,0 +1,331 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 207 +; Schema: 0 + OpCapability Shader + %59 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_13 "x_13" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_19 "x_19" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %compute_value_f1_f1_ "compute_value_f1_f1_" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %result "result" + OpName %i "i" + OpName %main_1 "main_1" + OpName %c "c" + OpName %thirty_two_1 "thirty_two_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %x_61 "x_61" + OpName %i_1 "i_1" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_19 NonWritable + OpDecorate %x_19 DescriptorSet 0 + OpDecorate %x_19 Binding 1 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_19 = OpVariable %_ptr_Uniform_buf1 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %25 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpConstantNull %int + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %void = OpTypeVoid + %79 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %86 = OpConstantNull %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %98 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 + %true = OpConstantTrue %bool + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %194 = OpTypeFunction %void %main_out +%compute_value_f1_f1_ = OpFunction %float None %18 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %23 = OpLabel + %result = OpVariable %_ptr_Function_float Function %25 + %i = OpVariable %_ptr_Function_int Function %29 + OpStore %result %float_n0_5 + OpStore %i %int_1 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %36 = OpLoad %int %i + %38 = OpSLessThan %bool %36 %int_800 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %33 + %40 = OpLabel + %43 = OpLoad %int %i + %45 = OpSMod %int %43 %int_32 + %47 = OpIEqual %bool %45 %int_0 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %50 + %49 = OpLabel + %51 = OpLoad %float %result + %53 = OpFAdd %float %51 %float_0_400000006 + OpStore %result %53 + OpBranch %48 + %50 = OpLabel + %54 = OpLoad %int %i + %56 = OpLoad %float %thirty_two + %57 = OpConvertSToF %float %54 + %58 = OpExtInst %float %59 RoundEven %56 + %60 = OpFMod %float %57 %58 + %62 = OpFOrdLessThanEqual %bool %60 %float_0_00999999978 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %63 + %64 = OpLabel + %65 = OpLoad %float %result + %67 = OpFAdd %float %65 %float_100 + OpStore %result %67 + OpBranch %63 + %63 = OpLabel + OpBranch %48 + %48 = OpLabel + %68 = OpLoad %int %i + %70 = OpLoad %float %limit + %71 = OpConvertSToF %float %68 + %72 = OpFOrdGreaterThanEqual %bool %71 %70 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %73 + %74 = OpLabel + %75 = OpLoad %float %result + OpReturnValue %75 + %73 = OpLabel + OpBranch %34 + %34 = OpLabel + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + OpBranch %32 + %33 = OpLabel + %78 = OpLoad %float %result + OpReturnValue %78 + OpFunctionEnd + %main_1 = OpFunction %void None %79 + %82 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %86 +%thirty_two_1 = OpVariable %_ptr_Function_float Function %25 + %param = OpVariable %_ptr_Function_float Function %25 + %param_1 = OpVariable %_ptr_Function_float Function %25 + %param_2 = OpVariable %_ptr_Function_float Function %25 + %param_3 = OpVariable %_ptr_Function_float Function %25 + %x_61 = OpVariable %_ptr_Function_v3float Function %86 + %i_1 = OpVariable %_ptr_Function_int Function %29 + %j = OpVariable %_ptr_Function_float Function %25 + OpStore %c %98 + %102 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0 + %103 = OpLoad %float %102 + %105 = OpFDiv %float %103 %float_8 + %104 = OpExtInst %float %59 RoundEven %105 + OpStore %thirty_two_1 %104 + %107 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %108 = OpLoad %float %107 + OpStore %param %108 + %109 = OpLoad %float %thirty_two_1 + OpStore %param_1 %109 + %110 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1 + %113 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %113 %110 + %115 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %116 = OpLoad %float %115 + OpStore %param_2 %116 + %117 = OpLoad %float %thirty_two_1 + OpStore %param_3 %117 + %118 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3 + %121 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %121 %118 + %122 = OpAccessChain %_ptr_Function_float %c %uint_0 + %123 = OpLoad %float %122 + OpSelectionMerge %125 None + OpBranchConditional %true %126 %127 + %126 = OpLabel + %128 = OpLoad %v3float %c + OpStore %x_61 %128 + OpBranch %125 + %127 = OpLabel + %129 = OpLoad %v3float %c + %130 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_0 + %131 = OpLoad %float %130 + %132 = OpVectorTimesScalar %v3float %129 %131 + OpStore %x_61 %132 + OpBranch %125 + %125 = OpLabel + %133 = OpAccessChain %_ptr_Function_float %x_61 %uint_1 + %134 = OpLoad %float %133 + %136 = OpAccessChain %_ptr_Function_float %c %uint_2 + %137 = OpFAdd %float %123 %134 + OpStore %136 %137 + OpStore %i_1 %int_0 + OpBranch %138 + %138 = OpLabel + OpLoopMerge %139 %140 None + OpBranch %141 + %141 = OpLabel + %142 = OpLoad %int %i_1 + %144 = OpSLessThan %bool %142 %int_3 + OpSelectionMerge %145 None + OpBranchConditional %144 %146 %147 + %146 = OpLabel + OpBranch %145 + %147 = OpLabel + OpBranch %139 + %145 = OpLabel + %148 = OpLoad %int %i_1 + %149 = OpAccessChain %_ptr_Function_float %c %148 + %150 = OpLoad %float %149 + %152 = OpFOrdGreaterThanEqual %bool %150 %float_1 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + %155 = OpLoad %int %i_1 + %156 = OpLoad %int %i_1 + %157 = OpAccessChain %_ptr_Function_float %c %156 + %158 = OpLoad %float %157 + %159 = OpLoad %int %i_1 + %160 = OpAccessChain %_ptr_Function_float %c %159 + %161 = OpLoad %float %160 + %162 = OpAccessChain %_ptr_Function_float %c %155 + %163 = OpFMul %float %158 %161 + OpStore %162 %163 + OpBranch %153 + %153 = OpLabel + OpStore %j %float_0 + OpBranch %165 + %165 = OpLabel + OpLoopMerge %166 %167 None + OpBranch %168 + %168 = OpLabel + %169 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_0 + %170 = OpLoad %float %169 + %171 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_1 + %172 = OpLoad %float %171 + %173 = OpFOrdGreaterThan %bool %170 %172 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %176 + %175 = OpLabel + OpBranch %174 + %176 = OpLabel + OpBranch %166 + %174 = OpLabel + %177 = OpLoad %float %j + %178 = OpAccessChain %_ptr_Uniform_float %x_19 %uint_0 %uint_0 + %179 = OpLoad %float %178 + %180 = OpFOrdGreaterThanEqual %bool %177 %179 + OpSelectionMerge %181 None + OpBranchConditional %180 %182 %181 + %182 = OpLabel + OpBranch %166 + %181 = OpLabel + %183 = OpLoad %float %j + %184 = OpFAdd %float %183 %float_1 + OpStore %j %184 + OpBranch %167 + %167 = OpLabel + OpBranch %165 + %166 = OpLabel + OpBranch %140 + %140 = OpLabel + %185 = OpLoad %int %i_1 + %186 = OpIAdd %int %185 %int_1 + OpStore %i_1 %186 + OpBranch %138 + %139 = OpLabel + %187 = OpLoad %v3float %c + %189 = OpExtInst %v3float %59 FAbs %187 + %188 = OpExtInst %v3float %59 Normalize %189 + %190 = OpCompositeExtract %float %188 0 + %191 = OpCompositeExtract %float %188 1 + %192 = OpCompositeExtract %float %188 2 + %193 = OpCompositeConstruct %v4float %190 %191 %192 %float_1 + OpStore %x_GLF_color %193 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %194 +%tint_symbol_1 = OpFunctionParameter %main_out + %198 = OpLabel + %199 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %199 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %79 + %201 = OpLabel + %202 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %202 + %203 = OpFunctionCall %void %main_1 + %205 = OpLoad %v4float %x_GLF_color + %206 = OpCompositeConstruct %main_out %205 + %204 = OpFunctionCall %void %tint_symbol_3 %206 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..97ffaf9355 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-true-conditional-simple-loop/1.wgsl.expected.wgsl @@ -0,0 +1,149 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_13 : buf0; + +var gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_19 : buf1; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var result : f32; + var i : i32; + result = -0.5; + i = 1; + loop { + let x_144 : i32 = i; + if ((x_144 < 800)) { + } else { + break; + } + let x_147 : i32 = i; + if (((x_147 % 32) == 0)) { + let x_153 : f32 = result; + result = (x_153 + 0.400000006); + } else { + let x_155 : i32 = i; + let x_157 : f32 = *(thirty_two); + if (((f32(x_155) % round(x_157)) <= 0.01)) { + let x_163 : f32 = result; + result = (x_163 + 100.0); + } + } + let x_165 : i32 = i; + let x_167 : f32 = *(limit); + if ((f32(x_165) >= x_167)) { + let x_171 : f32 = result; + return x_171; + } + + continuing { + let x_172 : i32 = i; + i = (x_172 + 1); + } + } + let x_174 : f32 = result; + return x_174; +} + +fn main_1() { + var c : vec3; + var thirty_two_1 : f32; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var x_61 : vec3; + var i_1 : i32; + var j : f32; + c = vec3(7.0, 8.0, 9.0); + let x_63 : f32 = x_13.resolution.x; + thirty_two_1 = round((x_63 / 8.0)); + let x_67 : f32 = gl_FragCoord.x; + param = x_67; + let x_68 : f32 = thirty_two_1; + param_1 = x_68; + let x_69 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_69; + let x_72 : f32 = gl_FragCoord.y; + param_2 = x_72; + let x_73 : f32 = thirty_two_1; + param_3 = x_73; + let x_74 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_74; + let x_77 : f32 = c.x; + if (true) { + let x_81 : vec3 = c; + x_61 = x_81; + } else { + let x_82 : vec3 = c; + let x_84 : f32 = x_19.injectionSwitch.x; + x_61 = (x_82 * x_84); + } + let x_87 : f32 = x_61.y; + c.z = (x_77 + x_87); + i_1 = 0; + loop { + let x_94 : i32 = i_1; + if ((x_94 < 3)) { + } else { + break; + } + let x_97 : i32 = i_1; + let x_99 : f32 = c[x_97]; + if ((x_99 >= 1.0)) { + let x_103 : i32 = i_1; + let x_104 : i32 = i_1; + let x_106 : f32 = c[x_104]; + let x_107 : i32 = i_1; + let x_109 : f32 = c[x_107]; + c[x_103] = (x_106 * x_109); + } + j = 0.0; + loop { + let x_117 : f32 = x_19.injectionSwitch.x; + let x_119 : f32 = x_19.injectionSwitch.y; + if ((x_117 > x_119)) { + } else { + break; + } + let x_122 : f32 = j; + let x_124 : f32 = x_19.injectionSwitch.x; + if ((x_122 >= x_124)) { + break; + } + let x_128 : f32 = j; + j = (x_128 + 1.0); + } + + continuing { + let x_130 : i32 = i_1; + i_1 = (x_130 + 1); + } + } + let x_132 : vec3 = c; + let x_134 : vec3 = normalize(abs(x_132)); + x_GLF_color = vec4(x_134.x, x_134.y, x_134.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm new file mode 100644 index 0000000000..5b2b65bd64 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm @@ -0,0 +1,245 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %compute_value_f1_f1_ "compute_value(f1;f1;" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %result "result" + OpName %i "i" + OpName %c "c" + OpName %thirty_two_0 "thirty_two" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %i_0 "i" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %23 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %float_n0_5 = OpConstant %float -0.5 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %40 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%mat3v3float = OpTypeMatrix %v3float 3 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %53 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %54 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %55 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %56 = OpConstantComposite %mat3v3float %53 %54 %55 +%mat4v2float = OpTypeMatrix %v2float 4 + %uint_2 = OpConstant %uint 2 + %int_3 = OpConstant %int 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %20 + %61 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function +%thirty_two_0 = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_float Function + %param_1 = OpVariable %_ptr_Function_float Function + %param_2 = OpVariable %_ptr_Function_float Function + %i_0 = OpVariable %_ptr_Function_int Function + OpStore %c %40 + %62 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %63 = OpLoad %float %62 + %64 = OpFDiv %float %63 %float_8 + %65 = OpExtInst %float %1 Round %64 + OpStore %thirty_two_0 %65 + %66 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %67 = OpLoad %float %66 + OpStore %param %67 + %68 = OpLoad %float %thirty_two_0 + OpStore %param_0 %68 + %69 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_0 + %70 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %70 %69 + %71 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %72 = OpLoad %float %71 + OpStore %param_1 %72 + %73 = OpLoad %float %thirty_two_0 + OpStore %param_2 %73 + %74 = OpFunctionCall %float %compute_value_f1_f1_ %param_1 %param_2 + %75 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %75 %74 + %76 = OpLoad %v3float %c + %77 = OpVectorTimesMatrix %v3float %76 %56 + %78 = OpCompositeExtract %float %77 0 + %79 = OpLoad %v3float %c + %80 = OpCompositeExtract %float %79 0 + %81 = OpCompositeExtract %float %79 1 + %82 = OpCompositeExtract %float %79 2 + %83 = OpCompositeConstruct %v2float %80 %81 + %84 = OpCompositeConstruct %v2float %82 %float_1 + %85 = OpCompositeConstruct %v2float %float_1 %float_0 + %86 = OpCompositeConstruct %v2float %float_1 %float_0 + %87 = OpCompositeConstruct %mat4v2float %83 %84 %85 %86 + %88 = OpCompositeExtract %float %87 0 0 + %89 = OpCompositeExtract %float %87 0 1 + %90 = OpCompositeExtract %float %87 1 0 + %91 = OpCompositeConstruct %v3float %88 %89 %90 + %92 = OpCompositeExtract %float %91 1 + %93 = OpFAdd %float %78 %92 + %94 = OpAccessChain %_ptr_Function_float %c %uint_2 + OpStore %94 %93 + OpStore %i_0 %int_0 + OpBranch %95 + %95 = OpLabel + OpLoopMerge %96 %97 None + OpBranch %98 + %98 = OpLabel + %99 = OpLoad %int %i_0 + %100 = OpSLessThan %bool %99 %int_3 + OpBranchConditional %100 %101 %96 + %101 = OpLabel + %102 = OpLoad %int %i_0 + %103 = OpAccessChain %_ptr_Function_float %c %102 + %104 = OpLoad %float %103 + %105 = OpFOrdGreaterThanEqual %bool %104 %float_1 + OpSelectionMerge %106 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + %108 = OpLoad %int %i_0 + %109 = OpLoad %int %i_0 + %110 = OpAccessChain %_ptr_Function_float %c %109 + %111 = OpLoad %float %110 + %112 = OpLoad %int %i_0 + %113 = OpAccessChain %_ptr_Function_float %c %112 + %114 = OpLoad %float %113 + %115 = OpFMul %float %111 %114 + %116 = OpAccessChain %_ptr_Function_float %c %108 + OpStore %116 %115 + %117 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %118 = OpLoad %float %117 + %119 = OpFOrdLessThan %bool %118 %float_0 + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %120 + %121 = OpLabel + OpBranch %96 + %120 = OpLabel + OpBranch %106 + %106 = OpLabel + OpBranch %97 + %97 = OpLabel + %122 = OpLoad %int %i_0 + %123 = OpIAdd %int %122 %int_1 + OpStore %i_0 %123 + OpBranch %95 + %96 = OpLabel + %124 = OpLoad %v3float %c + %125 = OpExtInst %v3float %1 FAbs %124 + %126 = OpExtInst %v3float %1 Normalize %125 + %127 = OpCompositeExtract %float %126 0 + %128 = OpCompositeExtract %float %126 1 + %129 = OpCompositeExtract %float %126 2 + %130 = OpCompositeConstruct %v4float %127 %128 %129 %float_1 + OpStore %_GLF_color %130 + OpReturn + OpFunctionEnd +%compute_value_f1_f1_ = OpFunction %float None %23 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %131 = OpLabel + %result = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + OpStore %result %float_n0_5 + OpStore %i %int_1 + OpBranch %132 + %132 = OpLabel + OpLoopMerge %133 %134 None + OpBranch %135 + %135 = OpLabel + %136 = OpLoad %int %i + %137 = OpSLessThan %bool %136 %int_800 + OpBranchConditional %137 %138 %133 + %138 = OpLabel + %139 = OpLoad %int %i + %140 = OpSMod %int %139 %int_32 + %141 = OpIEqual %bool %140 %int_0 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %144 + %143 = OpLabel + %145 = OpLoad %float %result + %146 = OpFAdd %float %145 %float_0_400000006 + OpStore %result %146 + OpBranch %142 + %144 = OpLabel + %147 = OpLoad %int %i + %148 = OpConvertSToF %float %147 + %149 = OpLoad %float %thirty_two + %150 = OpExtInst %float %1 Round %149 + %151 = OpFMod %float %148 %150 + %152 = OpFOrdLessThanEqual %bool %151 %float_0_00999999978 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + %155 = OpLoad %float %result + %156 = OpFAdd %float %155 %float_100 + OpStore %result %156 + OpBranch %153 + %153 = OpLabel + OpBranch %142 + %142 = OpLabel + %157 = OpLoad %int %i + %158 = OpConvertSToF %float %157 + %159 = OpLoad %float %limit + %160 = OpFOrdGreaterThanEqual %bool %158 %159 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %161 + %162 = OpLabel + %163 = OpLoad %float %result + OpReturnValue %163 + %161 = OpLabel + OpBranch %134 + %134 = OpLabel + %164 = OpLoad %int %i + %165 = OpIAdd %int %164 %int_1 + OpStore %i %165 + OpBranch %132 + %133 = OpLabel + %166 = OpLoad %float %result + OpReturnValue %166 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..20808b2648 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.hlsl @@ -0,0 +1,100 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float compute_value_f1_f1_(inout float limit, inout float thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + { + for(; (i < 800); i = (i + 1)) { + if (((i % 32) == 0)) { + result = (result + 0.400000006f); + } else { + const int x_147 = i; + const float x_149 = thirty_two; + if (((float(x_147) % round(x_149)) <= 0.01f)) { + result = (result + 100.0f); + } + } + const int x_157 = i; + const float x_159 = limit; + if ((float(x_157) >= x_159)) { + return result; + } + } + } + return result; +} + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int i_1 = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_63 = asfloat(x_13[0].x); + thirty_two_1 = round((x_63 / 8.0f)); + const float x_67 = gl_FragCoord.x; + param = x_67; + param_1 = thirty_two_1; + const float x_69 = compute_value_f1_f1_(param, param_1); + c.x = x_69; + const float x_72 = gl_FragCoord.y; + param_2 = x_72; + param_3 = thirty_two_1; + const float x_74 = compute_value_f1_f1_(param_2, param_3); + c.y = x_74; + const float3 x_76 = c; + const float3 x_79 = c; + const float4x2 x_87 = float4x2(float2(x_79.x, x_79.y), float2(x_79.z, 1.0f), float2(1.0f, 0.0f), float2(1.0f, 0.0f)); + c.z = (mul(float3x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f)), x_76).x + float3(x_87[0u].x, x_87[0u].y, x_87[1u].x).y); + i_1 = 0; + { + for(; (i_1 < 3); i_1 = (i_1 + 1)) { + const float x_104 = c[i_1]; + if ((x_104 >= 1.0f)) { + const int x_108 = i_1; + const float x_111 = c[i_1]; + const float x_114 = c[i_1]; + set_float3(c, x_108, (x_111 * x_114)); + const float x_118 = gl_FragCoord.y; + if ((x_118 < 0.0f)) { + break; + } + } + } + } + const float3 x_126 = normalize(abs(c)); + x_GLF_color = float4(x_126.x, x_126.y, x_126.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.msl new file mode 100755 index 0000000000..223b0b5ec2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.msl @@ -0,0 +1,127 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float compute_value_f1_f1_(thread float* const limit, thread float* const thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + while (true) { + int const x_136 = i; + if ((x_136 < 800)) { + } else { + break; + } + int const x_139 = i; + if (((x_139 % 32) == 0)) { + float const x_145 = result; + result = (x_145 + 0.400000006f); + } else { + int const x_147 = i; + float const x_149 = *(thirty_two); + if (((float(x_147) % rint(x_149)) <= 0.01f)) { + float const x_155 = result; + result = (x_155 + 100.0f); + } + } + int const x_157 = i; + float const x_159 = *(limit); + if ((float(x_157) >= x_159)) { + float const x_163 = result; + return x_163; + } + { + int const x_164 = i; + i = (x_164 + 1); + } + } + float const x_166 = result; + return x_166; +} + +void main_1(constant buf0& x_13, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int i_1 = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_63 = x_13.resolution.x; + thirty_two_1 = rint((x_63 / 8.0f)); + float const x_67 = (*(tint_symbol_5)).x; + param = x_67; + float const x_68 = thirty_two_1; + param_1 = x_68; + float const x_69 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_69; + float const x_72 = (*(tint_symbol_5)).y; + param_2 = x_72; + float const x_73 = thirty_two_1; + param_3 = x_73; + float const x_74 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_74; + float3 const x_76 = c; + float3 const x_79 = c; + float4x2 const x_87 = float4x2(float2(x_79.x, x_79.y), float2(x_79.z, 1.0f), float2(1.0f, 0.0f), float2(1.0f, 0.0f)); + c.z = (((x_76 * float3x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f)))).x + float3(x_87[0u].x, x_87[0u].y, x_87[1u].x).y); + i_1 = 0; + while (true) { + int const x_99 = i_1; + if ((x_99 < 3)) { + } else { + break; + } + int const x_102 = i_1; + float const x_104 = c[x_102]; + if ((x_104 >= 1.0f)) { + int const x_108 = i_1; + int const x_109 = i_1; + float const x_111 = c[x_109]; + int const x_112 = i_1; + float const x_114 = c[x_112]; + c[x_108] = (x_111 * x_114); + float const x_118 = (*(tint_symbol_5)).y; + if ((x_118 < 0.0f)) { + break; + } + } + { + int const x_122 = i_1; + i_1 = (x_122 + 1); + } + } + float3 const x_124 = c; + float3 const x_126 = normalize(fabs(x_124)); + *(tint_symbol_6) = float4(x_126.x, x_126.y, x_126.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_13, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\uajw.0.metal:32:26: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_147) % rint(x_149)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..8feef9e999 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.spvasm @@ -0,0 +1,296 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 199 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_13 "x_13" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %compute_value_f1_f1_ "compute_value_f1_f1_" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %result "result" + OpName %i "i" + OpName %main_1 "main_1" + OpName %c "c" + OpName %thirty_two_1 "thirty_two_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %22 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %void = OpTypeVoid + %76 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %83 = OpConstantNull %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %93 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 +%mat4v2float = OpTypeMatrix %v2float 4 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %127 = OpConstantComposite %v2float %float_1 %float_0 + %uint_2 = OpConstant %uint 2 +%mat3v3float = OpTypeMatrix %v3float 3 + %132 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %133 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %134 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %135 = OpConstantComposite %mat3v3float %132 %133 %134 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %186 = OpTypeFunction %void %main_out +%compute_value_f1_f1_ = OpFunction %float None %15 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %20 = OpLabel + %result = OpVariable %_ptr_Function_float Function %22 + %i = OpVariable %_ptr_Function_int Function %26 + OpStore %result %float_n0_5 + OpStore %i %int_1 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %i + %35 = OpSLessThan %bool %33 %int_800 + OpSelectionMerge %37 None + OpBranchConditional %35 %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + OpBranch %30 + %37 = OpLabel + %40 = OpLoad %int %i + %42 = OpSMod %int %40 %int_32 + %44 = OpIEqual %bool %42 %int_0 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + %48 = OpLoad %float %result + %50 = OpFAdd %float %48 %float_0_400000006 + OpStore %result %50 + OpBranch %45 + %47 = OpLabel + %51 = OpLoad %int %i + %53 = OpLoad %float %thirty_two + %54 = OpConvertSToF %float %51 + %55 = OpExtInst %float %56 RoundEven %53 + %57 = OpFMod %float %54 %55 + %59 = OpFOrdLessThanEqual %bool %57 %float_0_00999999978 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %60 + %61 = OpLabel + %62 = OpLoad %float %result + %64 = OpFAdd %float %62 %float_100 + OpStore %result %64 + OpBranch %60 + %60 = OpLabel + OpBranch %45 + %45 = OpLabel + %65 = OpLoad %int %i + %67 = OpLoad %float %limit + %68 = OpConvertSToF %float %65 + %69 = OpFOrdGreaterThanEqual %bool %68 %67 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpLoad %float %result + OpReturnValue %72 + %70 = OpLabel + OpBranch %31 + %31 = OpLabel + %73 = OpLoad %int %i + %74 = OpIAdd %int %73 %int_1 + OpStore %i %74 + OpBranch %29 + %30 = OpLabel + %75 = OpLoad %float %result + OpReturnValue %75 + OpFunctionEnd + %main_1 = OpFunction %void None %76 + %79 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %83 +%thirty_two_1 = OpVariable %_ptr_Function_float Function %22 + %param = OpVariable %_ptr_Function_float Function %22 + %param_1 = OpVariable %_ptr_Function_float Function %22 + %param_2 = OpVariable %_ptr_Function_float Function %22 + %param_3 = OpVariable %_ptr_Function_float Function %22 + %i_1 = OpVariable %_ptr_Function_int Function %26 + OpStore %c %93 + %97 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0 + %98 = OpLoad %float %97 + %100 = OpFDiv %float %98 %float_8 + %99 = OpExtInst %float %56 RoundEven %100 + OpStore %thirty_two_1 %99 + %102 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %103 = OpLoad %float %102 + OpStore %param %103 + %104 = OpLoad %float %thirty_two_1 + OpStore %param_1 %104 + %105 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1 + %108 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %108 %105 + %110 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %111 = OpLoad %float %110 + OpStore %param_2 %111 + %112 = OpLoad %float %thirty_two_1 + OpStore %param_3 %112 + %113 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3 + %116 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %116 %113 + %117 = OpLoad %v3float %c + %118 = OpLoad %v3float %c + %120 = OpCompositeExtract %float %118 0 + %121 = OpCompositeExtract %float %118 1 + %122 = OpCompositeConstruct %v2float %120 %121 + %123 = OpCompositeExtract %float %118 2 + %125 = OpCompositeConstruct %v2float %123 %float_1 + %128 = OpCompositeConstruct %mat4v2float %122 %125 %127 %127 + %130 = OpAccessChain %_ptr_Function_float %c %uint_2 + %136 = OpVectorTimesMatrix %v3float %117 %135 + %137 = OpCompositeExtract %float %136 0 + %138 = OpCompositeExtract %v2float %128 0 + %139 = OpCompositeExtract %float %138 0 + %140 = OpCompositeExtract %v2float %128 0 + %141 = OpCompositeExtract %float %140 1 + %142 = OpCompositeExtract %v2float %128 1 + %143 = OpCompositeExtract %float %142 0 + %144 = OpCompositeConstruct %v3float %139 %141 %143 + %145 = OpCompositeExtract %float %144 1 + %146 = OpFAdd %float %137 %145 + OpStore %130 %146 + OpStore %i_1 %int_0 + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %151 = OpLoad %int %i_1 + %153 = OpSLessThan %bool %151 %int_3 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + OpBranch %154 + %156 = OpLabel + OpBranch %148 + %154 = OpLabel + %157 = OpLoad %int %i_1 + %158 = OpAccessChain %_ptr_Function_float %c %157 + %159 = OpLoad %float %158 + %160 = OpFOrdGreaterThanEqual %bool %159 %float_1 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %161 + %162 = OpLabel + %163 = OpLoad %int %i_1 + %164 = OpLoad %int %i_1 + %165 = OpAccessChain %_ptr_Function_float %c %164 + %166 = OpLoad %float %165 + %167 = OpLoad %int %i_1 + %168 = OpAccessChain %_ptr_Function_float %c %167 + %169 = OpLoad %float %168 + %170 = OpAccessChain %_ptr_Function_float %c %163 + %171 = OpFMul %float %166 %169 + OpStore %170 %171 + %172 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %173 = OpLoad %float %172 + %174 = OpFOrdLessThan %bool %173 %float_0 + OpSelectionMerge %175 None + OpBranchConditional %174 %176 %175 + %176 = OpLabel + OpBranch %148 + %175 = OpLabel + OpBranch %161 + %161 = OpLabel + OpBranch %149 + %149 = OpLabel + %177 = OpLoad %int %i_1 + %178 = OpIAdd %int %177 %int_1 + OpStore %i_1 %178 + OpBranch %147 + %148 = OpLabel + %179 = OpLoad %v3float %c + %181 = OpExtInst %v3float %56 FAbs %179 + %180 = OpExtInst %v3float %56 Normalize %181 + %182 = OpCompositeExtract %float %180 0 + %183 = OpCompositeExtract %float %180 1 + %184 = OpCompositeExtract %float %180 2 + %185 = OpCompositeConstruct %v4float %182 %183 %184 %float_1 + OpStore %x_GLF_color %185 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %186 +%tint_symbol_1 = OpFunctionParameter %main_out + %190 = OpLabel + %191 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %191 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %76 + %193 = OpLabel + %194 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %194 + %195 = OpFunctionCall %void %main_1 + %197 = OpLoad %v4float %x_GLF_color + %198 = OpCompositeConstruct %main_out %197 + %196 = OpFunctionCall %void %tint_symbol_3 %198 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..ee165485a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.spvasm.expected.wgsl @@ -0,0 +1,121 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_13 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var result : f32; + var i : i32; + result = -0.5; + i = 1; + loop { + let x_136 : i32 = i; + if ((x_136 < 800)) { + } else { + break; + } + let x_139 : i32 = i; + if (((x_139 % 32) == 0)) { + let x_145 : f32 = result; + result = (x_145 + 0.400000006); + } else { + let x_147 : i32 = i; + let x_149 : f32 = *(thirty_two); + if (((f32(x_147) % round(x_149)) <= 0.01)) { + let x_155 : f32 = result; + result = (x_155 + 100.0); + } + } + let x_157 : i32 = i; + let x_159 : f32 = *(limit); + if ((f32(x_157) >= x_159)) { + let x_163 : f32 = result; + return x_163; + } + + continuing { + let x_164 : i32 = i; + i = (x_164 + 1); + } + } + let x_166 : f32 = result; + return x_166; +} + +fn main_1() { + var c : vec3; + var thirty_two_1 : f32; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var i_1 : i32; + c = vec3(7.0, 8.0, 9.0); + let x_63 : f32 = x_13.resolution.x; + thirty_two_1 = round((x_63 / 8.0)); + let x_67 : f32 = gl_FragCoord.x; + param = x_67; + let x_68 : f32 = thirty_two_1; + param_1 = x_68; + let x_69 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_69; + let x_72 : f32 = gl_FragCoord.y; + param_2 = x_72; + let x_73 : f32 = thirty_two_1; + param_3 = x_73; + let x_74 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_74; + let x_76 : vec3 = c; + let x_79 : vec3 = c; + let x_87 : mat4x2 = mat4x2(vec2(x_79.x, x_79.y), vec2(x_79.z, 1.0), vec2(1.0, 0.0), vec2(1.0, 0.0)); + c.z = (((x_76 * mat3x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0)))).x + vec3(x_87[0u].x, x_87[0u].y, x_87[1u].x).y); + i_1 = 0; + loop { + let x_99 : i32 = i_1; + if ((x_99 < 3)) { + } else { + break; + } + let x_102 : i32 = i_1; + let x_104 : f32 = c[x_102]; + if ((x_104 >= 1.0)) { + let x_108 : i32 = i_1; + let x_109 : i32 = i_1; + let x_111 : f32 = c[x_109]; + let x_112 : i32 = i_1; + let x_114 : f32 = c[x_112]; + c[x_108] = (x_111 * x_114); + let x_118 : f32 = gl_FragCoord.y; + if ((x_118 < 0.0)) { + break; + } + } + + continuing { + let x_122 : i32 = i_1; + i_1 = (x_122 + 1); + } + } + let x_124 : vec3 = c; + let x_126 : vec3 = normalize(abs(x_124)); + x_GLF_color = vec4(x_126.x, x_126.y, x_126.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl new file mode 100644 index 0000000000..ee165485a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl @@ -0,0 +1,121 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_13 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var result : f32; + var i : i32; + result = -0.5; + i = 1; + loop { + let x_136 : i32 = i; + if ((x_136 < 800)) { + } else { + break; + } + let x_139 : i32 = i; + if (((x_139 % 32) == 0)) { + let x_145 : f32 = result; + result = (x_145 + 0.400000006); + } else { + let x_147 : i32 = i; + let x_149 : f32 = *(thirty_two); + if (((f32(x_147) % round(x_149)) <= 0.01)) { + let x_155 : f32 = result; + result = (x_155 + 100.0); + } + } + let x_157 : i32 = i; + let x_159 : f32 = *(limit); + if ((f32(x_157) >= x_159)) { + let x_163 : f32 = result; + return x_163; + } + + continuing { + let x_164 : i32 = i; + i = (x_164 + 1); + } + } + let x_166 : f32 = result; + return x_166; +} + +fn main_1() { + var c : vec3; + var thirty_two_1 : f32; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var i_1 : i32; + c = vec3(7.0, 8.0, 9.0); + let x_63 : f32 = x_13.resolution.x; + thirty_two_1 = round((x_63 / 8.0)); + let x_67 : f32 = gl_FragCoord.x; + param = x_67; + let x_68 : f32 = thirty_two_1; + param_1 = x_68; + let x_69 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_69; + let x_72 : f32 = gl_FragCoord.y; + param_2 = x_72; + let x_73 : f32 = thirty_two_1; + param_3 = x_73; + let x_74 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_74; + let x_76 : vec3 = c; + let x_79 : vec3 = c; + let x_87 : mat4x2 = mat4x2(vec2(x_79.x, x_79.y), vec2(x_79.z, 1.0), vec2(1.0, 0.0), vec2(1.0, 0.0)); + c.z = (((x_76 * mat3x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0)))).x + vec3(x_87[0u].x, x_87[0u].y, x_87[1u].x).y); + i_1 = 0; + loop { + let x_99 : i32 = i_1; + if ((x_99 < 3)) { + } else { + break; + } + let x_102 : i32 = i_1; + let x_104 : f32 = c[x_102]; + if ((x_104 >= 1.0)) { + let x_108 : i32 = i_1; + let x_109 : i32 = i_1; + let x_111 : f32 = c[x_109]; + let x_112 : i32 = i_1; + let x_114 : f32 = c[x_112]; + c[x_108] = (x_111 * x_114); + let x_118 : f32 = gl_FragCoord.y; + if ((x_118 < 0.0)) { + break; + } + } + + continuing { + let x_122 : i32 = i_1; + i_1 = (x_122 + 1); + } + } + let x_124 : vec3 = c; + let x_126 : vec3 = normalize(abs(x_124)); + x_GLF_color = vec4(x_126.x, x_126.y, x_126.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..20808b2648 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.hlsl @@ -0,0 +1,100 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_13 : register(b0, space0) { + uint4 x_13[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float compute_value_f1_f1_(inout float limit, inout float thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + { + for(; (i < 800); i = (i + 1)) { + if (((i % 32) == 0)) { + result = (result + 0.400000006f); + } else { + const int x_147 = i; + const float x_149 = thirty_two; + if (((float(x_147) % round(x_149)) <= 0.01f)) { + result = (result + 100.0f); + } + } + const int x_157 = i; + const float x_159 = limit; + if ((float(x_157) >= x_159)) { + return result; + } + } + } + return result; +} + +void main_1() { + float3 c = float3(0.0f, 0.0f, 0.0f); + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int i_1 = 0; + c = float3(7.0f, 8.0f, 9.0f); + const float x_63 = asfloat(x_13[0].x); + thirty_two_1 = round((x_63 / 8.0f)); + const float x_67 = gl_FragCoord.x; + param = x_67; + param_1 = thirty_two_1; + const float x_69 = compute_value_f1_f1_(param, param_1); + c.x = x_69; + const float x_72 = gl_FragCoord.y; + param_2 = x_72; + param_3 = thirty_two_1; + const float x_74 = compute_value_f1_f1_(param_2, param_3); + c.y = x_74; + const float3 x_76 = c; + const float3 x_79 = c; + const float4x2 x_87 = float4x2(float2(x_79.x, x_79.y), float2(x_79.z, 1.0f), float2(1.0f, 0.0f), float2(1.0f, 0.0f)); + c.z = (mul(float3x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f)), x_76).x + float3(x_87[0u].x, x_87[0u].y, x_87[1u].x).y); + i_1 = 0; + { + for(; (i_1 < 3); i_1 = (i_1 + 1)) { + const float x_104 = c[i_1]; + if ((x_104 >= 1.0f)) { + const int x_108 = i_1; + const float x_111 = c[i_1]; + const float x_114 = c[i_1]; + set_float3(c, x_108, (x_111 * x_114)); + const float x_118 = gl_FragCoord.y; + if ((x_118 < 0.0f)) { + break; + } + } + } + } + const float3 x_126 = normalize(abs(c)); + x_GLF_color = float4(x_126.x, x_126.y, x_126.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.msl new file mode 100755 index 0000000000..4db0bfd379 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.msl @@ -0,0 +1,127 @@ +SKIP: FAILED + +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float compute_value_f1_f1_(thread float* const limit, thread float* const thirty_two) { + float result = 0.0f; + int i = 0; + result = -0.5f; + i = 1; + while (true) { + int const x_136 = i; + if ((x_136 < 800)) { + } else { + break; + } + int const x_139 = i; + if (((x_139 % 32) == 0)) { + float const x_145 = result; + result = (x_145 + 0.400000006f); + } else { + int const x_147 = i; + float const x_149 = *(thirty_two); + if (((float(x_147) % rint(x_149)) <= 0.01f)) { + float const x_155 = result; + result = (x_155 + 100.0f); + } + } + int const x_157 = i; + float const x_159 = *(limit); + if ((float(x_157) >= x_159)) { + float const x_163 = result; + return x_163; + } + { + int const x_164 = i; + i = (x_164 + 1); + } + } + float const x_166 = result; + return x_166; +} + +void main_1(constant buf0& x_13, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float3 c = 0.0f; + float thirty_two_1 = 0.0f; + float param = 0.0f; + float param_1 = 0.0f; + float param_2 = 0.0f; + float param_3 = 0.0f; + int i_1 = 0; + c = float3(7.0f, 8.0f, 9.0f); + float const x_63 = x_13.resolution.x; + thirty_two_1 = rint((x_63 / 8.0f)); + float const x_67 = (*(tint_symbol_5)).x; + param = x_67; + float const x_68 = thirty_two_1; + param_1 = x_68; + float const x_69 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_69; + float const x_72 = (*(tint_symbol_5)).y; + param_2 = x_72; + float const x_73 = thirty_two_1; + param_3 = x_73; + float const x_74 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_74; + float3 const x_76 = c; + float3 const x_79 = c; + float4x2 const x_87 = float4x2(float2(x_79.x, x_79.y), float2(x_79.z, 1.0f), float2(1.0f, 0.0f), float2(1.0f, 0.0f)); + c.z = (((x_76 * float3x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f)))).x + float3(x_87[0u].x, x_87[0u].y, x_87[1u].x).y); + i_1 = 0; + while (true) { + int const x_99 = i_1; + if ((x_99 < 3)) { + } else { + break; + } + int const x_102 = i_1; + float const x_104 = c[x_102]; + if ((x_104 >= 1.0f)) { + int const x_108 = i_1; + int const x_109 = i_1; + float const x_111 = c[x_109]; + int const x_112 = i_1; + float const x_114 = c[x_112]; + c[x_108] = (x_111 * x_114); + float const x_118 = (*(tint_symbol_5)).y; + if ((x_118 < 0.0f)) { + break; + } + } + { + int const x_122 = i_1; + i_1 = (x_122 + 1); + } + } + float3 const x_124 = c; + float3 const x_126 = normalize(fabs(x_124)); + *(tint_symbol_6) = float4(x_126.x, x_126.y, x_126.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_13, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + +T:\tmp\uet8.0.metal:32:26: error: invalid operands to binary expression ('float' and 'float') + if (((float(x_147) % rint(x_149)) <= 0.01f)) { + ~~~~~~~~~~~~ ^ ~~~~~~~~~~~ +1 error generated. + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..8feef9e999 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.spvasm @@ -0,0 +1,296 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 199 +; Schema: 0 + OpCapability Shader + %56 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_13 "x_13" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %compute_value_f1_f1_ "compute_value_f1_f1_" + OpName %limit "limit" + OpName %thirty_two "thirty_two" + OpName %result "result" + OpName %i "i" + OpName %main_1 "main_1" + OpName %c "c" + OpName %thirty_two_1 "thirty_two_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_13 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_float = OpTypePointer Function %float + %15 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %22 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %float_n0_5 = OpConstant %float -0.5 + %int_1 = OpConstant %int 1 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_32 = OpConstant %int 32 + %int_0 = OpConstant %int 0 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %float_100 = OpConstant %float 100 + %void = OpTypeVoid + %76 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %83 = OpConstantNull %v3float + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %93 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 +%mat4v2float = OpTypeMatrix %v2float 4 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %127 = OpConstantComposite %v2float %float_1 %float_0 + %uint_2 = OpConstant %uint 2 +%mat3v3float = OpTypeMatrix %v3float 3 + %132 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %133 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %134 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %135 = OpConstantComposite %mat3v3float %132 %133 %134 + %int_3 = OpConstant %int 3 + %main_out = OpTypeStruct %v4float + %186 = OpTypeFunction %void %main_out +%compute_value_f1_f1_ = OpFunction %float None %15 + %limit = OpFunctionParameter %_ptr_Function_float + %thirty_two = OpFunctionParameter %_ptr_Function_float + %20 = OpLabel + %result = OpVariable %_ptr_Function_float Function %22 + %i = OpVariable %_ptr_Function_int Function %26 + OpStore %result %float_n0_5 + OpStore %i %int_1 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %i + %35 = OpSLessThan %bool %33 %int_800 + OpSelectionMerge %37 None + OpBranchConditional %35 %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + OpBranch %30 + %37 = OpLabel + %40 = OpLoad %int %i + %42 = OpSMod %int %40 %int_32 + %44 = OpIEqual %bool %42 %int_0 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + %48 = OpLoad %float %result + %50 = OpFAdd %float %48 %float_0_400000006 + OpStore %result %50 + OpBranch %45 + %47 = OpLabel + %51 = OpLoad %int %i + %53 = OpLoad %float %thirty_two + %54 = OpConvertSToF %float %51 + %55 = OpExtInst %float %56 RoundEven %53 + %57 = OpFMod %float %54 %55 + %59 = OpFOrdLessThanEqual %bool %57 %float_0_00999999978 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %60 + %61 = OpLabel + %62 = OpLoad %float %result + %64 = OpFAdd %float %62 %float_100 + OpStore %result %64 + OpBranch %60 + %60 = OpLabel + OpBranch %45 + %45 = OpLabel + %65 = OpLoad %int %i + %67 = OpLoad %float %limit + %68 = OpConvertSToF %float %65 + %69 = OpFOrdGreaterThanEqual %bool %68 %67 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %70 + %71 = OpLabel + %72 = OpLoad %float %result + OpReturnValue %72 + %70 = OpLabel + OpBranch %31 + %31 = OpLabel + %73 = OpLoad %int %i + %74 = OpIAdd %int %73 %int_1 + OpStore %i %74 + OpBranch %29 + %30 = OpLabel + %75 = OpLoad %float %result + OpReturnValue %75 + OpFunctionEnd + %main_1 = OpFunction %void None %76 + %79 = OpLabel + %c = OpVariable %_ptr_Function_v3float Function %83 +%thirty_two_1 = OpVariable %_ptr_Function_float Function %22 + %param = OpVariable %_ptr_Function_float Function %22 + %param_1 = OpVariable %_ptr_Function_float Function %22 + %param_2 = OpVariable %_ptr_Function_float Function %22 + %param_3 = OpVariable %_ptr_Function_float Function %22 + %i_1 = OpVariable %_ptr_Function_int Function %26 + OpStore %c %93 + %97 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0 + %98 = OpLoad %float %97 + %100 = OpFDiv %float %98 %float_8 + %99 = OpExtInst %float %56 RoundEven %100 + OpStore %thirty_two_1 %99 + %102 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %103 = OpLoad %float %102 + OpStore %param %103 + %104 = OpLoad %float %thirty_two_1 + OpStore %param_1 %104 + %105 = OpFunctionCall %float %compute_value_f1_f1_ %param %param_1 + %108 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %108 %105 + %110 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %111 = OpLoad %float %110 + OpStore %param_2 %111 + %112 = OpLoad %float %thirty_two_1 + OpStore %param_3 %112 + %113 = OpFunctionCall %float %compute_value_f1_f1_ %param_2 %param_3 + %116 = OpAccessChain %_ptr_Function_float %c %uint_1 + OpStore %116 %113 + %117 = OpLoad %v3float %c + %118 = OpLoad %v3float %c + %120 = OpCompositeExtract %float %118 0 + %121 = OpCompositeExtract %float %118 1 + %122 = OpCompositeConstruct %v2float %120 %121 + %123 = OpCompositeExtract %float %118 2 + %125 = OpCompositeConstruct %v2float %123 %float_1 + %128 = OpCompositeConstruct %mat4v2float %122 %125 %127 %127 + %130 = OpAccessChain %_ptr_Function_float %c %uint_2 + %136 = OpVectorTimesMatrix %v3float %117 %135 + %137 = OpCompositeExtract %float %136 0 + %138 = OpCompositeExtract %v2float %128 0 + %139 = OpCompositeExtract %float %138 0 + %140 = OpCompositeExtract %v2float %128 0 + %141 = OpCompositeExtract %float %140 1 + %142 = OpCompositeExtract %v2float %128 1 + %143 = OpCompositeExtract %float %142 0 + %144 = OpCompositeConstruct %v3float %139 %141 %143 + %145 = OpCompositeExtract %float %144 1 + %146 = OpFAdd %float %137 %145 + OpStore %130 %146 + OpStore %i_1 %int_0 + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %151 = OpLoad %int %i_1 + %153 = OpSLessThan %bool %151 %int_3 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + OpBranch %154 + %156 = OpLabel + OpBranch %148 + %154 = OpLabel + %157 = OpLoad %int %i_1 + %158 = OpAccessChain %_ptr_Function_float %c %157 + %159 = OpLoad %float %158 + %160 = OpFOrdGreaterThanEqual %bool %159 %float_1 + OpSelectionMerge %161 None + OpBranchConditional %160 %162 %161 + %162 = OpLabel + %163 = OpLoad %int %i_1 + %164 = OpLoad %int %i_1 + %165 = OpAccessChain %_ptr_Function_float %c %164 + %166 = OpLoad %float %165 + %167 = OpLoad %int %i_1 + %168 = OpAccessChain %_ptr_Function_float %c %167 + %169 = OpLoad %float %168 + %170 = OpAccessChain %_ptr_Function_float %c %163 + %171 = OpFMul %float %166 %169 + OpStore %170 %171 + %172 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %173 = OpLoad %float %172 + %174 = OpFOrdLessThan %bool %173 %float_0 + OpSelectionMerge %175 None + OpBranchConditional %174 %176 %175 + %176 = OpLabel + OpBranch %148 + %175 = OpLabel + OpBranch %161 + %161 = OpLabel + OpBranch %149 + %149 = OpLabel + %177 = OpLoad %int %i_1 + %178 = OpIAdd %int %177 %int_1 + OpStore %i_1 %178 + OpBranch %147 + %148 = OpLabel + %179 = OpLoad %v3float %c + %181 = OpExtInst %v3float %56 FAbs %179 + %180 = OpExtInst %v3float %56 Normalize %181 + %182 = OpCompositeExtract %float %180 0 + %183 = OpCompositeExtract %float %180 1 + %184 = OpCompositeExtract %float %180 2 + %185 = OpCompositeConstruct %v4float %182 %183 %184 %float_1 + OpStore %x_GLF_color %185 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %186 +%tint_symbol_1 = OpFunctionParameter %main_out + %190 = OpLabel + %191 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %191 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %76 + %193 = OpLabel + %194 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %194 + %195 = OpFunctionCall %void %main_1 + %197 = OpLoad %v4float %x_GLF_color + %198 = OpCompositeConstruct %main_out %197 + %196 = OpFunctionCall %void %tint_symbol_3 %198 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee165485a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-colorgrid-modulo-vec3-values-from-matrix/1.wgsl.expected.wgsl @@ -0,0 +1,121 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_13 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn compute_value_f1_f1_(limit : ptr, thirty_two : ptr) -> f32 { + var result : f32; + var i : i32; + result = -0.5; + i = 1; + loop { + let x_136 : i32 = i; + if ((x_136 < 800)) { + } else { + break; + } + let x_139 : i32 = i; + if (((x_139 % 32) == 0)) { + let x_145 : f32 = result; + result = (x_145 + 0.400000006); + } else { + let x_147 : i32 = i; + let x_149 : f32 = *(thirty_two); + if (((f32(x_147) % round(x_149)) <= 0.01)) { + let x_155 : f32 = result; + result = (x_155 + 100.0); + } + } + let x_157 : i32 = i; + let x_159 : f32 = *(limit); + if ((f32(x_157) >= x_159)) { + let x_163 : f32 = result; + return x_163; + } + + continuing { + let x_164 : i32 = i; + i = (x_164 + 1); + } + } + let x_166 : f32 = result; + return x_166; +} + +fn main_1() { + var c : vec3; + var thirty_two_1 : f32; + var param : f32; + var param_1 : f32; + var param_2 : f32; + var param_3 : f32; + var i_1 : i32; + c = vec3(7.0, 8.0, 9.0); + let x_63 : f32 = x_13.resolution.x; + thirty_two_1 = round((x_63 / 8.0)); + let x_67 : f32 = gl_FragCoord.x; + param = x_67; + let x_68 : f32 = thirty_two_1; + param_1 = x_68; + let x_69 : f32 = compute_value_f1_f1_(&(param), &(param_1)); + c.x = x_69; + let x_72 : f32 = gl_FragCoord.y; + param_2 = x_72; + let x_73 : f32 = thirty_two_1; + param_3 = x_73; + let x_74 : f32 = compute_value_f1_f1_(&(param_2), &(param_3)); + c.y = x_74; + let x_76 : vec3 = c; + let x_79 : vec3 = c; + let x_87 : mat4x2 = mat4x2(vec2(x_79.x, x_79.y), vec2(x_79.z, 1.0), vec2(1.0, 0.0), vec2(1.0, 0.0)); + c.z = (((x_76 * mat3x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0)))).x + vec3(x_87[0u].x, x_87[0u].y, x_87[1u].x).y); + i_1 = 0; + loop { + let x_99 : i32 = i_1; + if ((x_99 < 3)) { + } else { + break; + } + let x_102 : i32 = i_1; + let x_104 : f32 = c[x_102]; + if ((x_104 >= 1.0)) { + let x_108 : i32 = i_1; + let x_109 : i32 = i_1; + let x_111 : f32 = c[x_109]; + let x_112 : i32 = i_1; + let x_114 : f32 = c[x_112]; + c[x_108] = (x_111 * x_114); + let x_118 : f32 = gl_FragCoord.y; + if ((x_118 < 0.0)) { + break; + } + } + + continuing { + let x_122 : i32 = i_1; + i_1 = (x_122 + 1); + } + } + let x_124 : vec3 = c; + let x_126 : vec3 = normalize(abs(x_124)); + x_GLF_color = vec4(x_126.x, x_126.y, x_126.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm new file mode 100644 index 0000000000..9408cfaeed --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm @@ -0,0 +1,617 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %merge_i1_i1_i1_ "merge(i1;i1;i1;" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %func_i1_i1_ "func(i1;i1;" + OpName %m "m" + OpName %high "high" + OpName %mergeSort_ "mergeSort(" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %temp "temp" + OpName %i_0 "i" + OpName %x "x" + OpName %gl_FragCoord "gl_FragCoord" + OpName %low "low" + OpName %high_0 "high" + OpName %m_0 "m" + OpName %i_1 "i" + OpName %from_0 "from" + OpName %mid_0 "mid" + OpName %to_0 "to" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %param_3 "param" + OpName %i_2 "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %j_0 "j" + OpName %grey "grey" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %38 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %41 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %42 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private + %int_10 = OpConstant %int 10 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_2 = OpConstant %int 2 + %int_9 = OpConstant %int 9 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %uint_1 = OpConstant %uint 1 + %int_30 = OpConstant %int 30 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %38 + %91 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %grey = OpVariable %_ptr_Function_float Function + %92 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %93 = OpLoad %float %92 + %94 = OpConvertFToS %int %93 + OpStore %i_2 %94 + OpBranch %95 + %95 = OpLabel + OpLoopMerge %96 %97 None + OpBranch %98 + %98 = OpLabel + %99 = OpLoad %int %i_2 + OpSelectionMerge %100 None + OpSwitch %99 %100 0 %101 1 %102 2 %103 3 %104 4 %105 5 %106 6 %107 7 %108 8 %109 9 %110 + %101 = OpLabel + %111 = OpLoad %int %i_2 + %112 = OpAccessChain %_ptr_Private_int %data %111 + OpStore %112 %int_4 + OpBranch %100 + %102 = OpLabel + %113 = OpLoad %int %i_2 + %114 = OpAccessChain %_ptr_Private_int %data %113 + OpStore %114 %int_3 + OpBranch %100 + %103 = OpLabel + %115 = OpLoad %int %i_2 + %116 = OpAccessChain %_ptr_Private_int %data %115 + OpStore %116 %int_2 + OpBranch %100 + %104 = OpLabel + %117 = OpLoad %int %i_2 + %118 = OpAccessChain %_ptr_Private_int %data %117 + OpStore %118 %int_1 + OpBranch %100 + %105 = OpLabel + %119 = OpLoad %int %i_2 + %120 = OpAccessChain %_ptr_Private_int %data %119 + OpStore %120 %int_0 + OpBranch %100 + %106 = OpLabel + %121 = OpLoad %int %i_2 + %122 = OpAccessChain %_ptr_Private_int %data %121 + OpStore %122 %int_n1 + OpBranch %100 + %107 = OpLabel + %123 = OpLoad %int %i_2 + %124 = OpAccessChain %_ptr_Private_int %data %123 + OpStore %124 %int_n2 + OpBranch %100 + %108 = OpLabel + %125 = OpLoad %int %i_2 + %126 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %126 %int_n3 + OpBranch %100 + %109 = OpLabel + %127 = OpLoad %int %i_2 + %128 = OpAccessChain %_ptr_Private_int %data %127 + OpStore %128 %int_n4 + OpBranch %100 + %110 = OpLabel + %129 = OpLoad %int %i_2 + %130 = OpAccessChain %_ptr_Private_int %data %129 + OpStore %130 %int_n5 + OpBranch %100 + %100 = OpLabel + %131 = OpLoad %int %i_2 + %132 = OpIAdd %int %131 %int_1 + OpStore %i_2 %132 + OpBranch %97 + %97 = OpLabel + %133 = OpLoad %int %i_2 + %134 = OpSLessThan %bool %133 %int_10 + OpBranchConditional %134 %95 %96 + %96 = OpLabel + OpStore %j_0 %int_0 + OpBranch %135 + %135 = OpLabel + OpLoopMerge %136 %137 None + OpBranch %138 + %138 = OpLabel + %139 = OpLoad %int %j_0 + %140 = OpSLessThan %bool %139 %int_10 + OpBranchConditional %140 %141 %136 + %141 = OpLabel + %142 = OpLoad %int %j_0 + %143 = OpLoad %int %j_0 + %144 = OpAccessChain %_ptr_Private_int %data %143 + %145 = OpLoad %int %144 + %146 = OpAccessChain %_ptr_Private_int %temp %142 + OpStore %146 %145 + OpBranch %137 + %137 = OpLabel + %147 = OpLoad %int %j_0 + %148 = OpIAdd %int %147 %int_1 + OpStore %j_0 %148 + OpBranch %135 + %136 = OpLabel + %149 = OpFunctionCall %void %mergeSort_ + %150 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %151 = OpLoad %float %150 + %152 = OpConvertFToS %int %151 + %153 = OpSLessThan %bool %152 %int_30 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + %157 = OpAccessChain %_ptr_Private_int %data %int_0 + %158 = OpLoad %int %157 + %159 = OpConvertSToF %float %158 + %160 = OpFDiv %float %159 %float_10 + %161 = OpFAdd %float %float_0_5 %160 + OpStore %grey %161 + OpBranch %154 + %156 = OpLabel + %162 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %163 = OpLoad %float %162 + %164 = OpConvertFToS %int %163 + %165 = OpSLessThan %bool %164 %int_60 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %168 + %167 = OpLabel + %169 = OpAccessChain %_ptr_Private_int %data %int_1 + %170 = OpLoad %int %169 + %171 = OpConvertSToF %float %170 + %172 = OpFDiv %float %171 %float_10 + %173 = OpFAdd %float %float_0_5 %172 + OpStore %grey %173 + OpBranch %166 + %168 = OpLabel + %174 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %175 = OpLoad %float %174 + %176 = OpConvertFToS %int %175 + %177 = OpSLessThan %bool %176 %int_90 + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %180 + %179 = OpLabel + %181 = OpAccessChain %_ptr_Private_int %data %int_2 + %182 = OpLoad %int %181 + %183 = OpConvertSToF %float %182 + %184 = OpFDiv %float %183 %float_10 + %185 = OpFAdd %float %float_0_5 %184 + OpStore %grey %185 + OpBranch %178 + %180 = OpLabel + %186 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %187 = OpLoad %float %186 + %188 = OpConvertFToS %int %187 + %189 = OpSLessThan %bool %188 %int_120 + OpSelectionMerge %190 None + OpBranchConditional %189 %191 %192 + %191 = OpLabel + %193 = OpAccessChain %_ptr_Private_int %data %int_3 + %194 = OpLoad %int %193 + %195 = OpConvertSToF %float %194 + %196 = OpFDiv %float %195 %float_10 + %197 = OpFAdd %float %float_0_5 %196 + OpStore %grey %197 + OpBranch %190 + %192 = OpLabel + %198 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %199 = OpLoad %float %198 + %200 = OpConvertFToS %int %199 + %201 = OpSLessThan %bool %200 %int_150 + OpSelectionMerge %202 None + OpBranchConditional %201 %203 %204 + %203 = OpLabel + OpKill + %204 = OpLabel + %205 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %206 = OpLoad %float %205 + %207 = OpConvertFToS %int %206 + %208 = OpSLessThan %bool %207 %int_180 + OpSelectionMerge %209 None + OpBranchConditional %208 %210 %211 + %210 = OpLabel + %212 = OpAccessChain %_ptr_Private_int %data %int_5 + %213 = OpLoad %int %212 + %214 = OpConvertSToF %float %213 + %215 = OpFDiv %float %214 %float_10 + %216 = OpFAdd %float %float_0_5 %215 + OpStore %grey %216 + OpBranch %209 + %211 = OpLabel + %217 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %218 = OpLoad %float %217 + %219 = OpConvertFToS %int %218 + %220 = OpSLessThan %bool %219 %int_210 + OpSelectionMerge %221 None + OpBranchConditional %220 %222 %223 + %222 = OpLabel + %224 = OpAccessChain %_ptr_Private_int %data %int_6 + %225 = OpLoad %int %224 + %226 = OpConvertSToF %float %225 + %227 = OpFDiv %float %226 %float_10 + %228 = OpFAdd %float %float_0_5 %227 + OpStore %grey %228 + OpBranch %221 + %223 = OpLabel + %229 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %230 = OpLoad %float %229 + %231 = OpConvertFToS %int %230 + %232 = OpSLessThan %bool %231 %int_240 + OpSelectionMerge %233 None + OpBranchConditional %232 %234 %235 + %234 = OpLabel + %236 = OpAccessChain %_ptr_Private_int %data %int_7 + %237 = OpLoad %int %236 + %238 = OpConvertSToF %float %237 + %239 = OpFDiv %float %238 %float_10 + %240 = OpFAdd %float %float_0_5 %239 + OpStore %grey %240 + OpBranch %233 + %235 = OpLabel + %241 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %242 = OpLoad %float %241 + %243 = OpConvertFToS %int %242 + %244 = OpSLessThan %bool %243 %int_270 + OpSelectionMerge %245 None + OpBranchConditional %244 %246 %247 + %246 = OpLabel + %248 = OpAccessChain %_ptr_Private_int %data %int_8 + %249 = OpLoad %int %248 + %250 = OpConvertSToF %float %249 + %251 = OpFDiv %float %250 %float_10 + %252 = OpFAdd %float %float_0_5 %251 + OpStore %grey %252 + OpBranch %245 + %247 = OpLabel + OpKill + %245 = OpLabel + OpBranch %233 + %233 = OpLabel + OpBranch %221 + %221 = OpLabel + OpBranch %209 + %209 = OpLabel + OpBranch %202 + %202 = OpLabel + OpBranch %190 + %190 = OpLabel + OpBranch %178 + %178 = OpLabel + OpBranch %166 + %166 = OpLabel + OpBranch %154 + %154 = OpLabel + %253 = OpLoad %float %grey + %254 = OpCompositeConstruct %v3float %253 %253 %253 + %255 = OpCompositeExtract %float %254 0 + %256 = OpCompositeExtract %float %254 1 + %257 = OpCompositeExtract %float %254 2 + %258 = OpCompositeConstruct %v4float %255 %256 %257 %float_1 + OpStore %_GLF_color %258 + OpReturn + OpFunctionEnd +%merge_i1_i1_i1_ = OpFunction %void None %41 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %259 = OpLabel + %k = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %260 = OpLoad %int %from + OpStore %k %260 + %261 = OpLoad %int %from + OpStore %i %261 + %262 = OpLoad %int %mid + %263 = OpIAdd %int %262 %int_1 + OpStore %j %263 + OpBranch %264 + %264 = OpLabel + OpLoopMerge %265 %266 None + OpBranch %267 + %267 = OpLabel + %268 = OpLoad %int %i + %269 = OpLoad %int %mid + %270 = OpSLessThanEqual %bool %268 %269 + %271 = OpLoad %int %j + %272 = OpLoad %int %to + %273 = OpSLessThanEqual %bool %271 %272 + %274 = OpLogicalAnd %bool %270 %273 + OpBranchConditional %274 %275 %265 + %275 = OpLabel + %276 = OpLoad %int %i + %277 = OpAccessChain %_ptr_Private_int %data %276 + %278 = OpLoad %int %277 + %279 = OpLoad %int %j + %280 = OpAccessChain %_ptr_Private_int %data %279 + %281 = OpLoad %int %280 + %282 = OpSLessThan %bool %278 %281 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %285 + %284 = OpLabel + %286 = OpLoad %int %k + %287 = OpIAdd %int %286 %int_1 + OpStore %k %287 + %288 = OpLoad %int %i + %289 = OpIAdd %int %288 %int_1 + OpStore %i %289 + %290 = OpAccessChain %_ptr_Private_int %data %288 + %291 = OpLoad %int %290 + %292 = OpAccessChain %_ptr_Private_int %temp %286 + OpStore %292 %291 + OpBranch %283 + %285 = OpLabel + %293 = OpLoad %int %k + %294 = OpIAdd %int %293 %int_1 + OpStore %k %294 + %295 = OpLoad %int %j + %296 = OpIAdd %int %295 %int_1 + OpStore %j %296 + %297 = OpAccessChain %_ptr_Private_int %data %295 + %298 = OpLoad %int %297 + %299 = OpAccessChain %_ptr_Private_int %temp %293 + OpStore %299 %298 + OpBranch %283 + %283 = OpLabel + OpBranch %266 + %266 = OpLabel + OpBranch %264 + %265 = OpLabel + OpBranch %300 + %300 = OpLabel + OpLoopMerge %301 %302 None + OpBranch %303 + %303 = OpLabel + %304 = OpLoad %int %i + %305 = OpSLessThan %bool %304 %int_10 + %306 = OpLoad %int %i + %307 = OpLoad %int %mid + %308 = OpSLessThanEqual %bool %306 %307 + %309 = OpLogicalAnd %bool %305 %308 + OpBranchConditional %309 %310 %301 + %310 = OpLabel + %311 = OpLoad %int %k + %312 = OpIAdd %int %311 %int_1 + OpStore %k %312 + %313 = OpLoad %int %i + %314 = OpIAdd %int %313 %int_1 + OpStore %i %314 + %315 = OpAccessChain %_ptr_Private_int %data %313 + %316 = OpLoad %int %315 + %317 = OpAccessChain %_ptr_Private_int %temp %311 + OpStore %317 %316 + OpBranch %302 + %302 = OpLabel + OpBranch %300 + %301 = OpLabel + %318 = OpLoad %int %from + OpStore %i_0 %318 + OpBranch %319 + %319 = OpLabel + OpLoopMerge %320 %321 None + OpBranch %322 + %322 = OpLabel + %323 = OpLoad %int %i_0 + %324 = OpLoad %int %to + %325 = OpSLessThanEqual %bool %323 %324 + OpBranchConditional %325 %326 %320 + %326 = OpLabel + %327 = OpLoad %int %i_0 + %328 = OpLoad %int %i_0 + %329 = OpAccessChain %_ptr_Private_int %temp %328 + %330 = OpLoad %int %329 + %331 = OpAccessChain %_ptr_Private_int %data %327 + OpStore %331 %330 + OpBranch %321 + %321 = OpLabel + %332 = OpLoad %int %i_0 + %333 = OpIAdd %int %332 %int_1 + OpStore %i_0 %333 + OpBranch %319 + %320 = OpLabel + OpReturn + OpFunctionEnd +%func_i1_i1_ = OpFunction %int None %42 + %m = OpFunctionParameter %_ptr_Function_int + %high = OpFunctionParameter %_ptr_Function_int + %334 = OpLabel + %x = OpVariable %_ptr_Function_int Function + %335 = OpVariable %_ptr_Function_int Function + %336 = OpVariable %_ptr_Function_int Function + %337 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %338 = OpLoad %float %337 + %339 = OpFOrdGreaterThanEqual %bool %338 %float_0 + OpSelectionMerge %340 None + OpBranchConditional %339 %341 %342 + %341 = OpLabel + OpSelectionMerge %343 None + OpBranchConditional %false %344 %345 + %344 = OpLabel + %346 = OpLoad %int %high + %347 = OpShiftLeftLogical %int %346 %int_0 + OpStore %336 %347 + OpBranch %343 + %345 = OpLabel + OpStore %336 %int_4 + OpBranch %343 + %343 = OpLabel + %348 = OpLoad %int %336 + %349 = OpShiftLeftLogical %int %int_1 %348 + OpStore %335 %349 + OpBranch %340 + %342 = OpLabel + OpStore %335 %int_1 + OpBranch %340 + %340 = OpLabel + %350 = OpLoad %int %335 + OpStore %x %350 + %351 = OpLoad %int %x + %352 = OpShiftRightArithmetic %int %351 %int_4 + OpStore %x %352 + %353 = OpLoad %int %m + %354 = OpIMul %int %int_2 %353 + %355 = OpLoad %int %m + %356 = OpIMul %int %int_2 %355 + %357 = OpLoad %int %m + %358 = OpIMul %int %int_2 %357 + %359 = OpLoad %int %x + %360 = OpSDiv %int %358 %359 + %361 = OpExtInst %int %1 SClamp %354 %356 %360 + OpReturnValue %361 + OpFunctionEnd + %mergeSort_ = OpFunction %void None %38 + %362 = OpLabel + %low = OpVariable %_ptr_Function_int Function + %high_0 = OpVariable %_ptr_Function_int Function + %m_0 = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %from_0 = OpVariable %_ptr_Function_int Function + %mid_0 = OpVariable %_ptr_Function_int Function + %to_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_int Function + OpStore %low %int_0 + OpStore %high_0 %int_9 + OpStore %m_0 %int_1 + OpBranch %363 + %363 = OpLabel + OpLoopMerge %364 %365 None + OpBranch %366 + %366 = OpLabel + %367 = OpLoad %int %m_0 + %368 = OpLoad %int %high_0 + %369 = OpSLessThanEqual %bool %367 %368 + OpBranchConditional %369 %370 %364 + %370 = OpLabel + %371 = OpLoad %int %low + OpStore %i_1 %371 + OpBranch %372 + %372 = OpLabel + OpLoopMerge %373 %374 None + OpBranch %375 + %375 = OpLabel + %376 = OpLoad %int %i_1 + %377 = OpLoad %int %high_0 + %378 = OpSLessThan %bool %376 %377 + OpBranchConditional %378 %379 %373 + %379 = OpLabel + %380 = OpLoad %int %i_1 + OpStore %from_0 %380 + %381 = OpLoad %int %i_1 + %382 = OpLoad %int %m_0 + %383 = OpIAdd %int %381 %382 + %384 = OpISub %int %383 %int_1 + OpStore %mid_0 %384 + %385 = OpLoad %int %i_1 + %386 = OpLoad %int %m_0 + %387 = OpIMul %int %int_2 %386 + %388 = OpIAdd %int %385 %387 + %389 = OpISub %int %388 %int_1 + %390 = OpLoad %int %high_0 + %391 = OpExtInst %int %1 SMin %389 %390 + OpStore %to_0 %391 + %392 = OpLoad %int %from_0 + OpStore %param %392 + %393 = OpLoad %int %mid_0 + OpStore %param_0 %393 + %394 = OpLoad %int %to_0 + OpStore %param_1 %394 + %395 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_0 %param_1 + OpBranch %374 + %374 = OpLabel + %396 = OpLoad %int %m_0 + OpStore %param_2 %396 + %397 = OpLoad %int %high_0 + OpStore %param_3 %397 + %398 = OpFunctionCall %int %func_i1_i1_ %param_2 %param_3 + %399 = OpLoad %int %i_1 + %400 = OpIAdd %int %399 %398 + OpStore %i_1 %400 + OpBranch %372 + %373 = OpLabel + OpBranch %365 + %365 = OpLabel + %401 = OpLoad %int %m_0 + %402 = OpIMul %int %int_2 %401 + OpStore %m_0 %402 + OpBranch %363 + %364 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..edd60f7c70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.hlsl @@ -0,0 +1,302 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_34 : register(b0, space0) { + uint4 x_34[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_260 = from; + k = x_260; + const int x_261 = from; + i = x_261; + const int x_262 = mid; + j = (x_262 + 1); + while (true) { + const int x_268 = i; + const int x_269 = mid; + const int x_271 = j; + const int x_272 = to; + bool tint_tmp = (x_268 <= x_269); + if (tint_tmp) { + tint_tmp = (x_271 <= x_272); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_278 = data[i]; + const int x_281 = data[j]; + if ((x_278 < x_281)) { + const int x_286 = k; + k = (x_286 + 1); + const int x_288 = i; + i = (x_288 + 1); + const int x_291 = data[x_288]; + temp[x_286] = x_291; + } else { + const int x_293 = k; + k = (x_293 + 1); + const int x_295 = j; + j = (x_295 + 1); + const int x_298 = data[x_295]; + temp[x_293] = x_298; + } + } + while (true) { + const int x_304 = i; + const int x_306 = i; + const int x_307 = mid; + bool tint_tmp_1 = (x_304 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_306 <= x_307); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_311 = k; + k = (x_311 + 1); + const int x_313 = i; + i = (x_313 + 1); + const int x_316 = data[x_313]; + temp[x_311] = x_316; + } + const int x_318 = from; + i_1 = x_318; + while (true) { + const int x_323 = i_1; + const int x_324 = to; + if ((x_323 <= x_324)) { + } else { + break; + } + const int x_327 = i_1; + const int x_330 = temp[i_1]; + data[x_327] = x_330; + { + i_1 = (i_1 + 1); + } + } + return; +} + +int func_i1_i1_(inout int m, inout int high) { + int x = 0; + int x_335 = 0; + int x_336 = 0; + const float x_338 = gl_FragCoord.x; + if ((x_338 >= 0.0f)) { + if (false) { + const int x_346 = high; + x_336 = (x_346 << asuint(0)); + } else { + x_336 = 4; + } + x_335 = (1 << asuint(x_336)); + } else { + x_335 = 1; + } + x = x_335; + x = (x >> asuint(4)); + const int x_353 = m; + const int x_355 = m; + const int x_357 = m; + return clamp((2 * x_353), (2 * x_355), ((2 * x_357) / x)); +} + +void mergeSort_() { + int low = 0; + int high_1 = 0; + int m_1 = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int param_4 = 0; + low = 0; + high_1 = 9; + m_1 = 1; + { + for(; (m_1 <= high_1); m_1 = (2 * m_1)) { + i_2 = low; + while (true) { + if ((i_2 < high_1)) { + } else { + break; + } + from_1 = i_2; + mid_1 = ((i_2 + m_1) - 1); + to_1 = min(((i_2 + (2 * m_1)) - 1), high_1); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + { + param_3 = m_1; + param_4 = high_1; + const int x_398 = func_i1_i1_(param_3, param_4); + i_2 = (i_2 + x_398); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_93 = asfloat(x_34[0].x); + i_3 = int(x_93); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_142 = j_1; + const int x_145 = data[j_1]; + temp[x_142] = x_145; + } + } + mergeSort_(); + const float x_151 = gl_FragCoord.y; + if ((int(x_151) < 30)) { + const int x_158 = data[0]; + grey = (0.5f + (float(x_158) / 10.0f)); + } else { + const float x_163 = gl_FragCoord.y; + if ((int(x_163) < 60)) { + const int x_170 = data[1]; + grey = (0.5f + (float(x_170) / 10.0f)); + } else { + const float x_175 = gl_FragCoord.y; + if ((int(x_175) < 90)) { + const int x_182 = data[2]; + grey = (0.5f + (float(x_182) / 10.0f)); + } else { + const float x_187 = gl_FragCoord.y; + if ((int(x_187) < 120)) { + const int x_194 = data[3]; + grey = (0.5f + (float(x_194) / 10.0f)); + } else { + const float x_199 = gl_FragCoord.y; + if ((int(x_199) < 150)) { + discard; + } else { + const float x_206 = gl_FragCoord.y; + if ((int(x_206) < 180)) { + const int x_213 = data[5]; + grey = (0.5f + (float(x_213) / 10.0f)); + } else { + const float x_218 = gl_FragCoord.y; + if ((int(x_218) < 210)) { + const int x_225 = data[6]; + grey = (0.5f + (float(x_225) / 10.0f)); + } else { + const float x_230 = gl_FragCoord.y; + if ((int(x_230) < 240)) { + const int x_237 = data[7]; + grey = (0.5f + (float(x_237) / 10.0f)); + } else { + const float x_242 = gl_FragCoord.y; + if ((int(x_242) < 270)) { + const int x_249 = data[8]; + grey = (0.5f + (float(x_249) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_253 = grey; + const float3 x_254 = float3(x_253, x_253, x_253); + x_GLF_color = float4(x_254.x, x_254.y, x_254.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.msl new file mode 100644 index 0000000000..eb075ffaee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.msl @@ -0,0 +1,348 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_260 = *(from); + k = x_260; + int const x_261 = *(from); + i = x_261; + int const x_262 = *(mid); + j = (x_262 + 1); + while (true) { + int const x_268 = i; + int const x_269 = *(mid); + int const x_271 = j; + int const x_272 = *(to); + if (((x_268 <= x_269) && (x_271 <= x_272))) { + } else { + break; + } + int const x_276 = i; + int const x_278 = (*(tint_symbol_5)).arr[x_276]; + int const x_279 = j; + int const x_281 = (*(tint_symbol_5)).arr[x_279]; + if ((x_278 < x_281)) { + int const x_286 = k; + k = (x_286 + 1); + int const x_288 = i; + i = (x_288 + 1); + int const x_291 = (*(tint_symbol_5)).arr[x_288]; + (*(tint_symbol_6)).arr[x_286] = x_291; + } else { + int const x_293 = k; + k = (x_293 + 1); + int const x_295 = j; + j = (x_295 + 1); + int const x_298 = (*(tint_symbol_5)).arr[x_295]; + (*(tint_symbol_6)).arr[x_293] = x_298; + } + } + while (true) { + int const x_304 = i; + int const x_306 = i; + int const x_307 = *(mid); + if (((x_304 < 10) && (x_306 <= x_307))) { + } else { + break; + } + int const x_311 = k; + k = (x_311 + 1); + int const x_313 = i; + i = (x_313 + 1); + int const x_316 = (*(tint_symbol_5)).arr[x_313]; + (*(tint_symbol_6)).arr[x_311] = x_316; + } + int const x_318 = *(from); + i_1 = x_318; + while (true) { + int const x_323 = i_1; + int const x_324 = *(to); + if ((x_323 <= x_324)) { + } else { + break; + } + int const x_327 = i_1; + int const x_328 = i_1; + int const x_330 = (*(tint_symbol_6)).arr[x_328]; + (*(tint_symbol_5)).arr[x_327] = x_330; + { + int const x_332 = i_1; + i_1 = (x_332 + 1); + } + } + return; +} + +int func_i1_i1_(thread int* const m, thread int* const high, thread float4* const tint_symbol_7) { + int x = 0; + int x_335 = 0; + int x_336 = 0; + float const x_338 = (*(tint_symbol_7)).x; + if ((x_338 >= 0.0f)) { + if (false) { + int const x_346 = *(high); + x_336 = (x_346 << as_type(0)); + } else { + x_336 = 4; + } + int const x_348 = x_336; + x_335 = (1 << as_type(x_348)); + } else { + x_335 = 1; + } + int const x_350 = x_335; + x = x_350; + int const x_351 = x; + x = (x_351 >> as_type(4)); + int const x_353 = *(m); + int const x_355 = *(m); + int const x_357 = *(m); + int const x_359 = x; + return clamp((2 * x_353), (2 * x_355), ((2 * x_357) / x_359)); +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_8, thread tint_array_wrapper* const tint_symbol_9, thread float4* const tint_symbol_10) { + int low = 0; + int high_1 = 0; + int m_1 = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int param_4 = 0; + low = 0; + high_1 = 9; + m_1 = 1; + while (true) { + int const x_367 = m_1; + int const x_368 = high_1; + if ((x_367 <= x_368)) { + } else { + break; + } + int const x_371 = low; + i_2 = x_371; + while (true) { + int const x_376 = i_2; + int const x_377 = high_1; + if ((x_376 < x_377)) { + } else { + break; + } + int const x_380 = i_2; + from_1 = x_380; + int const x_381 = i_2; + int const x_382 = m_1; + mid_1 = ((x_381 + x_382) - 1); + int const x_385 = i_2; + int const x_386 = m_1; + int const x_390 = high_1; + to_1 = min(((x_385 + (2 * x_386)) - 1), x_390); + int const x_392 = from_1; + param = x_392; + int const x_393 = mid_1; + param_1 = x_393; + int const x_394 = to_1; + param_2 = x_394; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_8, tint_symbol_9); + { + int const x_396 = m_1; + param_3 = x_396; + int const x_397 = high_1; + param_4 = x_397; + int const x_398 = func_i1_i1_(&(param_3), &(param_4), tint_symbol_10); + int const x_399 = i_2; + i_2 = (x_399 + x_398); + } + } + { + int const x_401 = m_1; + m_1 = (2 * x_401); + } + } + return; +} + +void main_1(constant buf0& x_34, thread tint_array_wrapper* const tint_symbol_11, thread tint_array_wrapper* const tint_symbol_12, thread float4* const tint_symbol_13, thread float4* const tint_symbol_14) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_93 = x_34.injectionSwitch.x; + i_3 = int(x_93); + while (true) { + int const x_99 = i_3; + switch(x_99) { + case 9: { + int const x_129 = i_3; + (*(tint_symbol_11)).arr[x_129] = -5; + break; + } + case 8: { + int const x_127 = i_3; + (*(tint_symbol_11)).arr[x_127] = -4; + break; + } + case 7: { + int const x_125 = i_3; + (*(tint_symbol_11)).arr[x_125] = -3; + break; + } + case 6: { + int const x_123 = i_3; + (*(tint_symbol_11)).arr[x_123] = -2; + break; + } + case 5: { + int const x_121 = i_3; + (*(tint_symbol_11)).arr[x_121] = -1; + break; + } + case 4: { + int const x_119 = i_3; + (*(tint_symbol_11)).arr[x_119] = 0; + break; + } + case 3: { + int const x_117 = i_3; + (*(tint_symbol_11)).arr[x_117] = 1; + break; + } + case 2: { + int const x_115 = i_3; + (*(tint_symbol_11)).arr[x_115] = 2; + break; + } + case 1: { + int const x_113 = i_3; + (*(tint_symbol_11)).arr[x_113] = 3; + break; + } + case 0: { + int const x_111 = i_3; + (*(tint_symbol_11)).arr[x_111] = 4; + break; + } + default: { + break; + } + } + int const x_131 = i_3; + i_3 = (x_131 + 1); + { + int const x_133 = i_3; + if ((x_133 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_139 = j_1; + if ((x_139 < 10)) { + } else { + break; + } + int const x_142 = j_1; + int const x_143 = j_1; + int const x_145 = (*(tint_symbol_11)).arr[x_143]; + (*(tint_symbol_12)).arr[x_142] = x_145; + { + int const x_147 = j_1; + j_1 = (x_147 + 1); + } + } + mergeSort_(tint_symbol_11, tint_symbol_12, tint_symbol_13); + float const x_151 = (*(tint_symbol_13)).y; + if ((int(x_151) < 30)) { + int const x_158 = (*(tint_symbol_11)).arr[0]; + grey = (0.5f + (float(x_158) / 10.0f)); + } else { + float const x_163 = (*(tint_symbol_13)).y; + if ((int(x_163) < 60)) { + int const x_170 = (*(tint_symbol_11)).arr[1]; + grey = (0.5f + (float(x_170) / 10.0f)); + } else { + float const x_175 = (*(tint_symbol_13)).y; + if ((int(x_175) < 90)) { + int const x_182 = (*(tint_symbol_11)).arr[2]; + grey = (0.5f + (float(x_182) / 10.0f)); + } else { + float const x_187 = (*(tint_symbol_13)).y; + if ((int(x_187) < 120)) { + int const x_194 = (*(tint_symbol_11)).arr[3]; + grey = (0.5f + (float(x_194) / 10.0f)); + } else { + float const x_199 = (*(tint_symbol_13)).y; + if ((int(x_199) < 150)) { + discard_fragment(); + } else { + float const x_206 = (*(tint_symbol_13)).y; + if ((int(x_206) < 180)) { + int const x_213 = (*(tint_symbol_11)).arr[5]; + grey = (0.5f + (float(x_213) / 10.0f)); + } else { + float const x_218 = (*(tint_symbol_13)).y; + if ((int(x_218) < 210)) { + int const x_225 = (*(tint_symbol_11)).arr[6]; + grey = (0.5f + (float(x_225) / 10.0f)); + } else { + float const x_230 = (*(tint_symbol_13)).y; + if ((int(x_230) < 240)) { + int const x_237 = (*(tint_symbol_11)).arr[7]; + grey = (0.5f + (float(x_237) / 10.0f)); + } else { + float const x_242 = (*(tint_symbol_13)).y; + if ((int(x_242) < 270)) { + int const x_249 = (*(tint_symbol_11)).arr[8]; + grey = (0.5f + (float(x_249) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_253 = grey; + float3 const x_254 = float3(x_253, x_253, x_253); + *(tint_symbol_14) = float4(x_254.x, x_254.y, x_254.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_34 [[buffer(0)]]) { + thread float4 tint_symbol_15 = 0.0f; + thread tint_array_wrapper tint_symbol_16 = {}; + thread tint_array_wrapper tint_symbol_17 = {}; + thread float4 tint_symbol_18 = 0.0f; + tint_symbol_15 = gl_FragCoord_param; + main_1(x_34, &(tint_symbol_16), &(tint_symbol_17), &(tint_symbol_15), &(tint_symbol_18)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_18}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..6248b33ed0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.spvasm @@ -0,0 +1,716 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 463 +; Schema: 0 + OpCapability Shader + %174 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_34 "x_34" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %func_i1_i1_ "func_i1_i1_" + OpName %m "m" + OpName %high "high" + OpName %x "x" + OpName %x_335 "x_335" + OpName %x_336 "x_336" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high_1 "high_1" + OpName %m_1 "m_1" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %param_4 "param_4" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_34 NonWritable + OpDecorate %x_34 DescriptorSet 0 + OpDecorate %x_34 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %13 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_34 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %132 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_2 = OpConstant %int 2 + %180 = OpTypeFunction %void + %int_9 = OpConstant %int 9 +%_ptr_Function_float = OpTypePointer Function %float + %251 = OpConstantNull %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %uint_1 = OpConstant %uint 1 + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %450 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpLoad %int %mid + %51 = OpLoad %int %j + %53 = OpLoad %int %to + %54 = OpSLessThanEqual %bool %48 %50 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %58 = OpSLessThanEqual %bool %51 %53 + OpBranch %56 + %56 = OpLabel + %59 = OpPhi %bool %54 %47 %58 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %45 + %60 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Private_int %data %63 + %66 = OpLoad %int %65 + %67 = OpLoad %int %j + %68 = OpAccessChain %_ptr_Private_int %data %67 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %k + %75 = OpIAdd %int %74 %int_1 + OpStore %k %75 + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + %78 = OpAccessChain %_ptr_Private_int %data %76 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Private_int %temp %74 + OpStore %80 %79 + OpBranch %71 + %73 = OpLabel + %81 = OpLoad %int %k + %82 = OpIAdd %int %81 %int_1 + OpStore %k %82 + %83 = OpLoad %int %j + %84 = OpIAdd %int %83 %int_1 + OpStore %j %84 + %85 = OpAccessChain %_ptr_Private_int %data %83 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Private_int %temp %81 + OpStore %87 %86 + OpBranch %71 + %71 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpLoad %int %i + %95 = OpLoad %int %mid + %97 = OpSLessThan %bool %92 %int_10 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSLessThanEqual %bool %93 %95 + OpBranch %98 + %98 = OpLabel + %101 = OpPhi %bool %97 %91 %100 %99 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpBranch %102 + %104 = OpLabel + OpBranch %89 + %102 = OpLabel + %105 = OpLoad %int %k + %106 = OpIAdd %int %105 %int_1 + OpStore %k %106 + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + %109 = OpAccessChain %_ptr_Private_int %data %107 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Private_int %temp %105 + OpStore %111 %110 + OpBranch %90 + %90 = OpLabel + OpBranch %88 + %89 = OpLabel + %113 = OpLoad %int %from + OpStore %i_1 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpLoad %int %to + %121 = OpSLessThanEqual %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + OpBranch %122 + %124 = OpLabel + OpBranch %115 + %122 = OpLabel + %125 = OpLoad %int %i_1 + %126 = OpLoad %int %i_1 + %127 = OpAccessChain %_ptr_Private_int %temp %126 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %129 %128 + OpBranch %116 + %116 = OpLabel + %130 = OpLoad %int %i_1 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_1 %131 + OpBranch %114 + %115 = OpLabel + OpReturn + OpFunctionEnd +%func_i1_i1_ = OpFunction %int None %132 + %m = OpFunctionParameter %_ptr_Function_int + %high = OpFunctionParameter %_ptr_Function_int + %136 = OpLabel + %x = OpVariable %_ptr_Function_int Function %32 + %x_335 = OpVariable %_ptr_Function_int Function %32 + %x_336 = OpVariable %_ptr_Function_int Function %32 + %142 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %143 = OpLoad %float %142 + %145 = OpFOrdGreaterThanEqual %bool %143 %float_0 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %148 + %147 = OpLabel + OpSelectionMerge %150 None + OpBranchConditional %false %151 %152 + %151 = OpLabel + %154 = OpLoad %int %high + %155 = OpBitcast %uint %int_0 + %157 = OpShiftLeftLogical %int %154 %155 + OpStore %x_336 %157 + OpBranch %150 + %152 = OpLabel + OpStore %x_336 %int_4 + OpBranch %150 + %150 = OpLabel + %159 = OpLoad %int %x_336 + %160 = OpBitcast %uint %159 + %161 = OpShiftLeftLogical %int %int_1 %160 + OpStore %x_335 %161 + OpBranch %146 + %148 = OpLabel + OpStore %x_335 %int_1 + OpBranch %146 + %146 = OpLabel + %162 = OpLoad %int %x_335 + OpStore %x %162 + %163 = OpLoad %int %x + %164 = OpBitcast %uint %int_4 + %165 = OpShiftRightArithmetic %int %163 %164 + OpStore %x %165 + %167 = OpLoad %int %m + %169 = OpLoad %int %m + %171 = OpLoad %int %m + %172 = OpLoad %int %x + %176 = OpIMul %int %int_2 %167 + %177 = OpIMul %int %int_2 %169 + %178 = OpIMul %int %int_2 %171 + %179 = OpSDiv %int %178 %172 + %173 = OpExtInst %int %174 SClamp %176 %177 %179 + OpReturnValue %173 + OpFunctionEnd + %mergeSort_ = OpFunction %void None %180 + %182 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high_1 = OpVariable %_ptr_Function_int Function %32 + %m_1 = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + %param_3 = OpVariable %_ptr_Function_int Function %32 + %param_4 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high_1 %int_9 + OpStore %m_1 %int_1 + OpBranch %196 + %196 = OpLabel + OpLoopMerge %197 %198 None + OpBranch %199 + %199 = OpLabel + %200 = OpLoad %int %m_1 + %201 = OpLoad %int %high_1 + %202 = OpSLessThanEqual %bool %200 %201 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %205 + %204 = OpLabel + OpBranch %203 + %205 = OpLabel + OpBranch %197 + %203 = OpLabel + %206 = OpLoad %int %low + OpStore %i_2 %206 + OpBranch %207 + %207 = OpLabel + OpLoopMerge %208 %209 None + OpBranch %210 + %210 = OpLabel + %211 = OpLoad %int %i_2 + %212 = OpLoad %int %high_1 + %213 = OpSLessThan %bool %211 %212 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %208 + %214 = OpLabel + %217 = OpLoad %int %i_2 + OpStore %from_1 %217 + %218 = OpLoad %int %i_2 + %219 = OpLoad %int %m_1 + %220 = OpIAdd %int %218 %219 + %221 = OpISub %int %220 %int_1 + OpStore %mid_1 %221 + %222 = OpLoad %int %i_2 + %223 = OpLoad %int %m_1 + %224 = OpLoad %int %high_1 + %226 = OpIMul %int %int_2 %223 + %227 = OpIAdd %int %222 %226 + %228 = OpISub %int %227 %int_1 + %225 = OpExtInst %int %174 SMin %228 %224 + OpStore %to_1 %225 + %229 = OpLoad %int %from_1 + OpStore %param %229 + %230 = OpLoad %int %mid_1 + OpStore %param_1 %230 + %231 = OpLoad %int %to_1 + OpStore %param_2 %231 + %232 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %209 + %209 = OpLabel + %236 = OpLoad %int %m_1 + OpStore %param_3 %236 + %237 = OpLoad %int %high_1 + OpStore %param_4 %237 + %238 = OpFunctionCall %int %func_i1_i1_ %param_3 %param_4 + %241 = OpLoad %int %i_2 + %242 = OpIAdd %int %241 %238 + OpStore %i_2 %242 + OpBranch %207 + %208 = OpLabel + OpBranch %198 + %198 = OpLabel + %243 = OpLoad %int %m_1 + %244 = OpIMul %int %int_2 %243 + OpStore %m_1 %244 + OpBranch %196 + %197 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %180 + %246 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %251 + %253 = OpAccessChain %_ptr_Uniform_float %x_34 %uint_0 %uint_0 + %254 = OpLoad %float %253 + %255 = OpConvertFToS %int %254 + OpStore %i_3 %255 + OpBranch %256 + %256 = OpLabel + OpLoopMerge %257 %258 None + OpBranch %259 + %259 = OpLabel + %260 = OpLoad %int %i_3 + OpSelectionMerge %261 None + OpSwitch %260 %262 9 %263 8 %264 7 %265 6 %266 5 %267 4 %268 3 %269 2 %270 1 %271 0 %272 + %263 = OpLabel + %273 = OpLoad %int %i_3 + %274 = OpAccessChain %_ptr_Private_int %data %273 + OpStore %274 %int_n5 + OpBranch %261 + %264 = OpLabel + %276 = OpLoad %int %i_3 + %277 = OpAccessChain %_ptr_Private_int %data %276 + OpStore %277 %int_n4 + OpBranch %261 + %265 = OpLabel + %279 = OpLoad %int %i_3 + %280 = OpAccessChain %_ptr_Private_int %data %279 + OpStore %280 %int_n3 + OpBranch %261 + %266 = OpLabel + %282 = OpLoad %int %i_3 + %283 = OpAccessChain %_ptr_Private_int %data %282 + OpStore %283 %int_n2 + OpBranch %261 + %267 = OpLabel + %285 = OpLoad %int %i_3 + %286 = OpAccessChain %_ptr_Private_int %data %285 + OpStore %286 %int_n1 + OpBranch %261 + %268 = OpLabel + %288 = OpLoad %int %i_3 + %289 = OpAccessChain %_ptr_Private_int %data %288 + OpStore %289 %int_0 + OpBranch %261 + %269 = OpLabel + %290 = OpLoad %int %i_3 + %291 = OpAccessChain %_ptr_Private_int %data %290 + OpStore %291 %int_1 + OpBranch %261 + %270 = OpLabel + %292 = OpLoad %int %i_3 + %293 = OpAccessChain %_ptr_Private_int %data %292 + OpStore %293 %int_2 + OpBranch %261 + %271 = OpLabel + %294 = OpLoad %int %i_3 + %295 = OpAccessChain %_ptr_Private_int %data %294 + OpStore %295 %int_3 + OpBranch %261 + %272 = OpLabel + %297 = OpLoad %int %i_3 + %298 = OpAccessChain %_ptr_Private_int %data %297 + OpStore %298 %int_4 + OpBranch %261 + %262 = OpLabel + OpBranch %261 + %261 = OpLabel + %299 = OpLoad %int %i_3 + %300 = OpIAdd %int %299 %int_1 + OpStore %i_3 %300 + OpBranch %258 + %258 = OpLabel + %301 = OpLoad %int %i_3 + %302 = OpSLessThan %bool %301 %int_10 + OpSelectionMerge %303 None + OpBranchConditional %302 %304 %305 + %304 = OpLabel + OpBranch %303 + %305 = OpLabel + OpBranch %257 + %303 = OpLabel + OpBranch %256 + %257 = OpLabel + OpStore %j_1 %int_0 + OpBranch %306 + %306 = OpLabel + OpLoopMerge %307 %308 None + OpBranch %309 + %309 = OpLabel + %310 = OpLoad %int %j_1 + %311 = OpSLessThan %bool %310 %int_10 + OpSelectionMerge %312 None + OpBranchConditional %311 %313 %314 + %313 = OpLabel + OpBranch %312 + %314 = OpLabel + OpBranch %307 + %312 = OpLabel + %315 = OpLoad %int %j_1 + %316 = OpLoad %int %j_1 + %317 = OpAccessChain %_ptr_Private_int %data %316 + %318 = OpLoad %int %317 + %319 = OpAccessChain %_ptr_Private_int %temp %315 + OpStore %319 %318 + OpBranch %308 + %308 = OpLabel + %320 = OpLoad %int %j_1 + %321 = OpIAdd %int %320 %int_1 + OpStore %j_1 %321 + OpBranch %306 + %307 = OpLabel + %322 = OpFunctionCall %void %mergeSort_ + %324 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %325 = OpLoad %float %324 + %326 = OpConvertFToS %int %325 + %328 = OpSLessThan %bool %326 %int_30 + OpSelectionMerge %329 None + OpBranchConditional %328 %330 %331 + %330 = OpLabel + %332 = OpAccessChain %_ptr_Private_int %data %int_0 + %333 = OpLoad %int %332 + %335 = OpConvertSToF %float %333 + %337 = OpFDiv %float %335 %float_10 + %338 = OpFAdd %float %float_0_5 %337 + OpStore %grey %338 + OpBranch %329 + %331 = OpLabel + %339 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %340 = OpLoad %float %339 + %341 = OpConvertFToS %int %340 + %343 = OpSLessThan %bool %341 %int_60 + OpSelectionMerge %344 None + OpBranchConditional %343 %345 %346 + %345 = OpLabel + %347 = OpAccessChain %_ptr_Private_int %data %int_1 + %348 = OpLoad %int %347 + %349 = OpConvertSToF %float %348 + %350 = OpFDiv %float %349 %float_10 + %351 = OpFAdd %float %float_0_5 %350 + OpStore %grey %351 + OpBranch %344 + %346 = OpLabel + %352 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %353 = OpLoad %float %352 + %354 = OpConvertFToS %int %353 + %356 = OpSLessThan %bool %354 %int_90 + OpSelectionMerge %357 None + OpBranchConditional %356 %358 %359 + %358 = OpLabel + %360 = OpAccessChain %_ptr_Private_int %data %int_2 + %361 = OpLoad %int %360 + %362 = OpConvertSToF %float %361 + %363 = OpFDiv %float %362 %float_10 + %364 = OpFAdd %float %float_0_5 %363 + OpStore %grey %364 + OpBranch %357 + %359 = OpLabel + %365 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %366 = OpLoad %float %365 + %367 = OpConvertFToS %int %366 + %369 = OpSLessThan %bool %367 %int_120 + OpSelectionMerge %370 None + OpBranchConditional %369 %371 %372 + %371 = OpLabel + %373 = OpAccessChain %_ptr_Private_int %data %int_3 + %374 = OpLoad %int %373 + %375 = OpConvertSToF %float %374 + %376 = OpFDiv %float %375 %float_10 + %377 = OpFAdd %float %float_0_5 %376 + OpStore %grey %377 + OpBranch %370 + %372 = OpLabel + %378 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %379 = OpLoad %float %378 + %380 = OpConvertFToS %int %379 + %382 = OpSLessThan %bool %380 %int_150 + OpSelectionMerge %383 None + OpBranchConditional %382 %384 %385 + %384 = OpLabel + OpKill + %385 = OpLabel + %386 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %387 = OpLoad %float %386 + %388 = OpConvertFToS %int %387 + %390 = OpSLessThan %bool %388 %int_180 + OpSelectionMerge %391 None + OpBranchConditional %390 %392 %393 + %392 = OpLabel + %395 = OpAccessChain %_ptr_Private_int %data %int_5 + %396 = OpLoad %int %395 + %397 = OpConvertSToF %float %396 + %398 = OpFDiv %float %397 %float_10 + %399 = OpFAdd %float %float_0_5 %398 + OpStore %grey %399 + OpBranch %391 + %393 = OpLabel + %400 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %401 = OpLoad %float %400 + %402 = OpConvertFToS %int %401 + %404 = OpSLessThan %bool %402 %int_210 + OpSelectionMerge %405 None + OpBranchConditional %404 %406 %407 + %406 = OpLabel + %409 = OpAccessChain %_ptr_Private_int %data %int_6 + %410 = OpLoad %int %409 + %411 = OpConvertSToF %float %410 + %412 = OpFDiv %float %411 %float_10 + %413 = OpFAdd %float %float_0_5 %412 + OpStore %grey %413 + OpBranch %405 + %407 = OpLabel + %414 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %415 = OpLoad %float %414 + %416 = OpConvertFToS %int %415 + %418 = OpSLessThan %bool %416 %int_240 + OpSelectionMerge %419 None + OpBranchConditional %418 %420 %421 + %420 = OpLabel + %423 = OpAccessChain %_ptr_Private_int %data %int_7 + %424 = OpLoad %int %423 + %425 = OpConvertSToF %float %424 + %426 = OpFDiv %float %425 %float_10 + %427 = OpFAdd %float %float_0_5 %426 + OpStore %grey %427 + OpBranch %419 + %421 = OpLabel + %428 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %429 = OpLoad %float %428 + %430 = OpConvertFToS %int %429 + %432 = OpSLessThan %bool %430 %int_270 + OpSelectionMerge %433 None + OpBranchConditional %432 %434 %435 + %434 = OpLabel + %437 = OpAccessChain %_ptr_Private_int %data %int_8 + %438 = OpLoad %int %437 + %439 = OpConvertSToF %float %438 + %440 = OpFDiv %float %439 %float_10 + %441 = OpFAdd %float %float_0_5 %440 + OpStore %grey %441 + OpBranch %433 + %435 = OpLabel + OpKill + %433 = OpLabel + OpBranch %419 + %419 = OpLabel + OpBranch %405 + %405 = OpLabel + OpBranch %391 + %391 = OpLabel + OpBranch %383 + %383 = OpLabel + OpBranch %370 + %370 = OpLabel + OpBranch %357 + %357 = OpLabel + OpBranch %344 + %344 = OpLabel + OpBranch %329 + %329 = OpLabel + %442 = OpLoad %float %grey + %444 = OpCompositeConstruct %v3float %442 %442 %442 + %445 = OpCompositeExtract %float %444 0 + %446 = OpCompositeExtract %float %444 1 + %447 = OpCompositeExtract %float %444 2 + %449 = OpCompositeConstruct %v4float %445 %446 %447 %float_1 + OpStore %x_GLF_color %449 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %450 +%tint_symbol_1 = OpFunctionParameter %main_out + %454 = OpLabel + %455 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %455 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %180 + %457 = OpLabel + %458 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %458 + %459 = OpFunctionCall %void %main_1 + %461 = OpLoad %v4float %x_GLF_color + %462 = OpCompositeConstruct %main_out %461 + %460 = OpFunctionCall %void %tint_symbol_3 %462 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 258[%258] is not post dominated by the back-edge block 303[%303] + %303 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..460ad4b461 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.spvasm.expected.wgsl @@ -0,0 +1,340 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_260 : i32 = *(from); + k = x_260; + let x_261 : i32 = *(from); + i = x_261; + let x_262 : i32 = *(mid); + j = (x_262 + 1); + loop { + let x_268 : i32 = i; + let x_269 : i32 = *(mid); + let x_271 : i32 = j; + let x_272 : i32 = *(to); + if (((x_268 <= x_269) && (x_271 <= x_272))) { + } else { + break; + } + let x_276 : i32 = i; + let x_278 : i32 = data[x_276]; + let x_279 : i32 = j; + let x_281 : i32 = data[x_279]; + if ((x_278 < x_281)) { + let x_286 : i32 = k; + k = (x_286 + 1); + let x_288 : i32 = i; + i = (x_288 + 1); + let x_291 : i32 = data[x_288]; + temp[x_286] = x_291; + } else { + let x_293 : i32 = k; + k = (x_293 + 1); + let x_295 : i32 = j; + j = (x_295 + 1); + let x_298 : i32 = data[x_295]; + temp[x_293] = x_298; + } + } + loop { + let x_304 : i32 = i; + let x_306 : i32 = i; + let x_307 : i32 = *(mid); + if (((x_304 < 10) && (x_306 <= x_307))) { + } else { + break; + } + let x_311 : i32 = k; + k = (x_311 + 1); + let x_313 : i32 = i; + i = (x_313 + 1); + let x_316 : i32 = data[x_313]; + temp[x_311] = x_316; + } + let x_318 : i32 = *(from); + i_1 = x_318; + loop { + let x_323 : i32 = i_1; + let x_324 : i32 = *(to); + if ((x_323 <= x_324)) { + } else { + break; + } + let x_327 : i32 = i_1; + let x_328 : i32 = i_1; + let x_330 : i32 = temp[x_328]; + data[x_327] = x_330; + + continuing { + let x_332 : i32 = i_1; + i_1 = (x_332 + 1); + } + } + return; +} + +fn func_i1_i1_(m : ptr, high : ptr) -> i32 { + var x : i32; + var x_335 : i32; + var x_336 : i32; + let x_338 : f32 = gl_FragCoord.x; + if ((x_338 >= 0.0)) { + if (false) { + let x_346 : i32 = *(high); + x_336 = (x_346 << bitcast(0)); + } else { + x_336 = 4; + } + let x_348 : i32 = x_336; + x_335 = (1 << bitcast(x_348)); + } else { + x_335 = 1; + } + let x_350 : i32 = x_335; + x = x_350; + let x_351 : i32 = x; + x = (x_351 >> bitcast(4)); + let x_353 : i32 = *(m); + let x_355 : i32 = *(m); + let x_357 : i32 = *(m); + let x_359 : i32 = x; + return clamp((2 * x_353), (2 * x_355), ((2 * x_357) / x_359)); +} + +fn mergeSort_() { + var low : i32; + var high_1 : i32; + var m_1 : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + var param_4 : i32; + low = 0; + high_1 = 9; + m_1 = 1; + loop { + let x_367 : i32 = m_1; + let x_368 : i32 = high_1; + if ((x_367 <= x_368)) { + } else { + break; + } + let x_371 : i32 = low; + i_2 = x_371; + loop { + let x_376 : i32 = i_2; + let x_377 : i32 = high_1; + if ((x_376 < x_377)) { + } else { + break; + } + let x_380 : i32 = i_2; + from_1 = x_380; + let x_381 : i32 = i_2; + let x_382 : i32 = m_1; + mid_1 = ((x_381 + x_382) - 1); + let x_385 : i32 = i_2; + let x_386 : i32 = m_1; + let x_390 : i32 = high_1; + to_1 = min(((x_385 + (2 * x_386)) - 1), x_390); + let x_392 : i32 = from_1; + param = x_392; + let x_393 : i32 = mid_1; + param_1 = x_393; + let x_394 : i32 = to_1; + param_2 = x_394; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_396 : i32 = m_1; + param_3 = x_396; + let x_397 : i32 = high_1; + param_4 = x_397; + let x_398 : i32 = func_i1_i1_(&(param_3), &(param_4)); + let x_399 : i32 = i_2; + i_2 = (x_399 + x_398); + } + } + + continuing { + let x_401 : i32 = m_1; + m_1 = (2 * x_401); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_93 : f32 = x_34.injectionSwitch.x; + i_3 = i32(x_93); + loop { + let x_99 : i32 = i_3; + switch(x_99) { + case 9: { + let x_129 : i32 = i_3; + data[x_129] = -5; + } + case 8: { + let x_127 : i32 = i_3; + data[x_127] = -4; + } + case 7: { + let x_125 : i32 = i_3; + data[x_125] = -3; + } + case 6: { + let x_123 : i32 = i_3; + data[x_123] = -2; + } + case 5: { + let x_121 : i32 = i_3; + data[x_121] = -1; + } + case 4: { + let x_119 : i32 = i_3; + data[x_119] = 0; + } + case 3: { + let x_117 : i32 = i_3; + data[x_117] = 1; + } + case 2: { + let x_115 : i32 = i_3; + data[x_115] = 2; + } + case 1: { + let x_113 : i32 = i_3; + data[x_113] = 3; + } + case 0: { + let x_111 : i32 = i_3; + data[x_111] = 4; + } + default: { + } + } + let x_131 : i32 = i_3; + i_3 = (x_131 + 1); + + continuing { + let x_133 : i32 = i_3; + if ((x_133 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_139 : i32 = j_1; + if ((x_139 < 10)) { + } else { + break; + } + let x_142 : i32 = j_1; + let x_143 : i32 = j_1; + let x_145 : i32 = data[x_143]; + temp[x_142] = x_145; + + continuing { + let x_147 : i32 = j_1; + j_1 = (x_147 + 1); + } + } + mergeSort_(); + let x_151 : f32 = gl_FragCoord.y; + if ((i32(x_151) < 30)) { + let x_158 : i32 = data[0]; + grey = (0.5 + (f32(x_158) / 10.0)); + } else { + let x_163 : f32 = gl_FragCoord.y; + if ((i32(x_163) < 60)) { + let x_170 : i32 = data[1]; + grey = (0.5 + (f32(x_170) / 10.0)); + } else { + let x_175 : f32 = gl_FragCoord.y; + if ((i32(x_175) < 90)) { + let x_182 : i32 = data[2]; + grey = (0.5 + (f32(x_182) / 10.0)); + } else { + let x_187 : f32 = gl_FragCoord.y; + if ((i32(x_187) < 120)) { + let x_194 : i32 = data[3]; + grey = (0.5 + (f32(x_194) / 10.0)); + } else { + let x_199 : f32 = gl_FragCoord.y; + if ((i32(x_199) < 150)) { + discard; + } else { + let x_206 : f32 = gl_FragCoord.y; + if ((i32(x_206) < 180)) { + let x_213 : i32 = data[5]; + grey = (0.5 + (f32(x_213) / 10.0)); + } else { + let x_218 : f32 = gl_FragCoord.y; + if ((i32(x_218) < 210)) { + let x_225 : i32 = data[6]; + grey = (0.5 + (f32(x_225) / 10.0)); + } else { + let x_230 : f32 = gl_FragCoord.y; + if ((i32(x_230) < 240)) { + let x_237 : i32 = data[7]; + grey = (0.5 + (f32(x_237) / 10.0)); + } else { + let x_242 : f32 = gl_FragCoord.y; + if ((i32(x_242) < 270)) { + let x_249 : i32 = data[8]; + grey = (0.5 + (f32(x_249) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_253 : f32 = grey; + let x_254 : vec3 = vec3(x_253, x_253, x_253); + x_GLF_color = vec4(x_254.x, x_254.y, x_254.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl new file mode 100644 index 0000000000..460ad4b461 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl @@ -0,0 +1,340 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_260 : i32 = *(from); + k = x_260; + let x_261 : i32 = *(from); + i = x_261; + let x_262 : i32 = *(mid); + j = (x_262 + 1); + loop { + let x_268 : i32 = i; + let x_269 : i32 = *(mid); + let x_271 : i32 = j; + let x_272 : i32 = *(to); + if (((x_268 <= x_269) && (x_271 <= x_272))) { + } else { + break; + } + let x_276 : i32 = i; + let x_278 : i32 = data[x_276]; + let x_279 : i32 = j; + let x_281 : i32 = data[x_279]; + if ((x_278 < x_281)) { + let x_286 : i32 = k; + k = (x_286 + 1); + let x_288 : i32 = i; + i = (x_288 + 1); + let x_291 : i32 = data[x_288]; + temp[x_286] = x_291; + } else { + let x_293 : i32 = k; + k = (x_293 + 1); + let x_295 : i32 = j; + j = (x_295 + 1); + let x_298 : i32 = data[x_295]; + temp[x_293] = x_298; + } + } + loop { + let x_304 : i32 = i; + let x_306 : i32 = i; + let x_307 : i32 = *(mid); + if (((x_304 < 10) && (x_306 <= x_307))) { + } else { + break; + } + let x_311 : i32 = k; + k = (x_311 + 1); + let x_313 : i32 = i; + i = (x_313 + 1); + let x_316 : i32 = data[x_313]; + temp[x_311] = x_316; + } + let x_318 : i32 = *(from); + i_1 = x_318; + loop { + let x_323 : i32 = i_1; + let x_324 : i32 = *(to); + if ((x_323 <= x_324)) { + } else { + break; + } + let x_327 : i32 = i_1; + let x_328 : i32 = i_1; + let x_330 : i32 = temp[x_328]; + data[x_327] = x_330; + + continuing { + let x_332 : i32 = i_1; + i_1 = (x_332 + 1); + } + } + return; +} + +fn func_i1_i1_(m : ptr, high : ptr) -> i32 { + var x : i32; + var x_335 : i32; + var x_336 : i32; + let x_338 : f32 = gl_FragCoord.x; + if ((x_338 >= 0.0)) { + if (false) { + let x_346 : i32 = *(high); + x_336 = (x_346 << bitcast(0)); + } else { + x_336 = 4; + } + let x_348 : i32 = x_336; + x_335 = (1 << bitcast(x_348)); + } else { + x_335 = 1; + } + let x_350 : i32 = x_335; + x = x_350; + let x_351 : i32 = x; + x = (x_351 >> bitcast(4)); + let x_353 : i32 = *(m); + let x_355 : i32 = *(m); + let x_357 : i32 = *(m); + let x_359 : i32 = x; + return clamp((2 * x_353), (2 * x_355), ((2 * x_357) / x_359)); +} + +fn mergeSort_() { + var low : i32; + var high_1 : i32; + var m_1 : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + var param_4 : i32; + low = 0; + high_1 = 9; + m_1 = 1; + loop { + let x_367 : i32 = m_1; + let x_368 : i32 = high_1; + if ((x_367 <= x_368)) { + } else { + break; + } + let x_371 : i32 = low; + i_2 = x_371; + loop { + let x_376 : i32 = i_2; + let x_377 : i32 = high_1; + if ((x_376 < x_377)) { + } else { + break; + } + let x_380 : i32 = i_2; + from_1 = x_380; + let x_381 : i32 = i_2; + let x_382 : i32 = m_1; + mid_1 = ((x_381 + x_382) - 1); + let x_385 : i32 = i_2; + let x_386 : i32 = m_1; + let x_390 : i32 = high_1; + to_1 = min(((x_385 + (2 * x_386)) - 1), x_390); + let x_392 : i32 = from_1; + param = x_392; + let x_393 : i32 = mid_1; + param_1 = x_393; + let x_394 : i32 = to_1; + param_2 = x_394; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_396 : i32 = m_1; + param_3 = x_396; + let x_397 : i32 = high_1; + param_4 = x_397; + let x_398 : i32 = func_i1_i1_(&(param_3), &(param_4)); + let x_399 : i32 = i_2; + i_2 = (x_399 + x_398); + } + } + + continuing { + let x_401 : i32 = m_1; + m_1 = (2 * x_401); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_93 : f32 = x_34.injectionSwitch.x; + i_3 = i32(x_93); + loop { + let x_99 : i32 = i_3; + switch(x_99) { + case 9: { + let x_129 : i32 = i_3; + data[x_129] = -5; + } + case 8: { + let x_127 : i32 = i_3; + data[x_127] = -4; + } + case 7: { + let x_125 : i32 = i_3; + data[x_125] = -3; + } + case 6: { + let x_123 : i32 = i_3; + data[x_123] = -2; + } + case 5: { + let x_121 : i32 = i_3; + data[x_121] = -1; + } + case 4: { + let x_119 : i32 = i_3; + data[x_119] = 0; + } + case 3: { + let x_117 : i32 = i_3; + data[x_117] = 1; + } + case 2: { + let x_115 : i32 = i_3; + data[x_115] = 2; + } + case 1: { + let x_113 : i32 = i_3; + data[x_113] = 3; + } + case 0: { + let x_111 : i32 = i_3; + data[x_111] = 4; + } + default: { + } + } + let x_131 : i32 = i_3; + i_3 = (x_131 + 1); + + continuing { + let x_133 : i32 = i_3; + if ((x_133 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_139 : i32 = j_1; + if ((x_139 < 10)) { + } else { + break; + } + let x_142 : i32 = j_1; + let x_143 : i32 = j_1; + let x_145 : i32 = data[x_143]; + temp[x_142] = x_145; + + continuing { + let x_147 : i32 = j_1; + j_1 = (x_147 + 1); + } + } + mergeSort_(); + let x_151 : f32 = gl_FragCoord.y; + if ((i32(x_151) < 30)) { + let x_158 : i32 = data[0]; + grey = (0.5 + (f32(x_158) / 10.0)); + } else { + let x_163 : f32 = gl_FragCoord.y; + if ((i32(x_163) < 60)) { + let x_170 : i32 = data[1]; + grey = (0.5 + (f32(x_170) / 10.0)); + } else { + let x_175 : f32 = gl_FragCoord.y; + if ((i32(x_175) < 90)) { + let x_182 : i32 = data[2]; + grey = (0.5 + (f32(x_182) / 10.0)); + } else { + let x_187 : f32 = gl_FragCoord.y; + if ((i32(x_187) < 120)) { + let x_194 : i32 = data[3]; + grey = (0.5 + (f32(x_194) / 10.0)); + } else { + let x_199 : f32 = gl_FragCoord.y; + if ((i32(x_199) < 150)) { + discard; + } else { + let x_206 : f32 = gl_FragCoord.y; + if ((i32(x_206) < 180)) { + let x_213 : i32 = data[5]; + grey = (0.5 + (f32(x_213) / 10.0)); + } else { + let x_218 : f32 = gl_FragCoord.y; + if ((i32(x_218) < 210)) { + let x_225 : i32 = data[6]; + grey = (0.5 + (f32(x_225) / 10.0)); + } else { + let x_230 : f32 = gl_FragCoord.y; + if ((i32(x_230) < 240)) { + let x_237 : i32 = data[7]; + grey = (0.5 + (f32(x_237) / 10.0)); + } else { + let x_242 : f32 = gl_FragCoord.y; + if ((i32(x_242) < 270)) { + let x_249 : i32 = data[8]; + grey = (0.5 + (f32(x_249) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_253 : f32 = grey; + let x_254 : vec3 = vec3(x_253, x_253, x_253); + x_GLF_color = vec4(x_254.x, x_254.y, x_254.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..edd60f7c70 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.hlsl @@ -0,0 +1,302 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_34 : register(b0, space0) { + uint4 x_34[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_260 = from; + k = x_260; + const int x_261 = from; + i = x_261; + const int x_262 = mid; + j = (x_262 + 1); + while (true) { + const int x_268 = i; + const int x_269 = mid; + const int x_271 = j; + const int x_272 = to; + bool tint_tmp = (x_268 <= x_269); + if (tint_tmp) { + tint_tmp = (x_271 <= x_272); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_278 = data[i]; + const int x_281 = data[j]; + if ((x_278 < x_281)) { + const int x_286 = k; + k = (x_286 + 1); + const int x_288 = i; + i = (x_288 + 1); + const int x_291 = data[x_288]; + temp[x_286] = x_291; + } else { + const int x_293 = k; + k = (x_293 + 1); + const int x_295 = j; + j = (x_295 + 1); + const int x_298 = data[x_295]; + temp[x_293] = x_298; + } + } + while (true) { + const int x_304 = i; + const int x_306 = i; + const int x_307 = mid; + bool tint_tmp_1 = (x_304 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_306 <= x_307); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_311 = k; + k = (x_311 + 1); + const int x_313 = i; + i = (x_313 + 1); + const int x_316 = data[x_313]; + temp[x_311] = x_316; + } + const int x_318 = from; + i_1 = x_318; + while (true) { + const int x_323 = i_1; + const int x_324 = to; + if ((x_323 <= x_324)) { + } else { + break; + } + const int x_327 = i_1; + const int x_330 = temp[i_1]; + data[x_327] = x_330; + { + i_1 = (i_1 + 1); + } + } + return; +} + +int func_i1_i1_(inout int m, inout int high) { + int x = 0; + int x_335 = 0; + int x_336 = 0; + const float x_338 = gl_FragCoord.x; + if ((x_338 >= 0.0f)) { + if (false) { + const int x_346 = high; + x_336 = (x_346 << asuint(0)); + } else { + x_336 = 4; + } + x_335 = (1 << asuint(x_336)); + } else { + x_335 = 1; + } + x = x_335; + x = (x >> asuint(4)); + const int x_353 = m; + const int x_355 = m; + const int x_357 = m; + return clamp((2 * x_353), (2 * x_355), ((2 * x_357) / x)); +} + +void mergeSort_() { + int low = 0; + int high_1 = 0; + int m_1 = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int param_4 = 0; + low = 0; + high_1 = 9; + m_1 = 1; + { + for(; (m_1 <= high_1); m_1 = (2 * m_1)) { + i_2 = low; + while (true) { + if ((i_2 < high_1)) { + } else { + break; + } + from_1 = i_2; + mid_1 = ((i_2 + m_1) - 1); + to_1 = min(((i_2 + (2 * m_1)) - 1), high_1); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + { + param_3 = m_1; + param_4 = high_1; + const int x_398 = func_i1_i1_(param_3, param_4); + i_2 = (i_2 + x_398); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + const float x_93 = asfloat(x_34[0].x); + i_3 = int(x_93); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_142 = j_1; + const int x_145 = data[j_1]; + temp[x_142] = x_145; + } + } + mergeSort_(); + const float x_151 = gl_FragCoord.y; + if ((int(x_151) < 30)) { + const int x_158 = data[0]; + grey = (0.5f + (float(x_158) / 10.0f)); + } else { + const float x_163 = gl_FragCoord.y; + if ((int(x_163) < 60)) { + const int x_170 = data[1]; + grey = (0.5f + (float(x_170) / 10.0f)); + } else { + const float x_175 = gl_FragCoord.y; + if ((int(x_175) < 90)) { + const int x_182 = data[2]; + grey = (0.5f + (float(x_182) / 10.0f)); + } else { + const float x_187 = gl_FragCoord.y; + if ((int(x_187) < 120)) { + const int x_194 = data[3]; + grey = (0.5f + (float(x_194) / 10.0f)); + } else { + const float x_199 = gl_FragCoord.y; + if ((int(x_199) < 150)) { + discard; + } else { + const float x_206 = gl_FragCoord.y; + if ((int(x_206) < 180)) { + const int x_213 = data[5]; + grey = (0.5f + (float(x_213) / 10.0f)); + } else { + const float x_218 = gl_FragCoord.y; + if ((int(x_218) < 210)) { + const int x_225 = data[6]; + grey = (0.5f + (float(x_225) / 10.0f)); + } else { + const float x_230 = gl_FragCoord.y; + if ((int(x_230) < 240)) { + const int x_237 = data[7]; + grey = (0.5f + (float(x_237) / 10.0f)); + } else { + const float x_242 = gl_FragCoord.y; + if ((int(x_242) < 270)) { + const int x_249 = data[8]; + grey = (0.5f + (float(x_249) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_253 = grey; + const float3 x_254 = float3(x_253, x_253, x_253); + x_GLF_color = float4(x_254.x, x_254.y, x_254.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.msl new file mode 100644 index 0000000000..eb075ffaee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.msl @@ -0,0 +1,348 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_260 = *(from); + k = x_260; + int const x_261 = *(from); + i = x_261; + int const x_262 = *(mid); + j = (x_262 + 1); + while (true) { + int const x_268 = i; + int const x_269 = *(mid); + int const x_271 = j; + int const x_272 = *(to); + if (((x_268 <= x_269) && (x_271 <= x_272))) { + } else { + break; + } + int const x_276 = i; + int const x_278 = (*(tint_symbol_5)).arr[x_276]; + int const x_279 = j; + int const x_281 = (*(tint_symbol_5)).arr[x_279]; + if ((x_278 < x_281)) { + int const x_286 = k; + k = (x_286 + 1); + int const x_288 = i; + i = (x_288 + 1); + int const x_291 = (*(tint_symbol_5)).arr[x_288]; + (*(tint_symbol_6)).arr[x_286] = x_291; + } else { + int const x_293 = k; + k = (x_293 + 1); + int const x_295 = j; + j = (x_295 + 1); + int const x_298 = (*(tint_symbol_5)).arr[x_295]; + (*(tint_symbol_6)).arr[x_293] = x_298; + } + } + while (true) { + int const x_304 = i; + int const x_306 = i; + int const x_307 = *(mid); + if (((x_304 < 10) && (x_306 <= x_307))) { + } else { + break; + } + int const x_311 = k; + k = (x_311 + 1); + int const x_313 = i; + i = (x_313 + 1); + int const x_316 = (*(tint_symbol_5)).arr[x_313]; + (*(tint_symbol_6)).arr[x_311] = x_316; + } + int const x_318 = *(from); + i_1 = x_318; + while (true) { + int const x_323 = i_1; + int const x_324 = *(to); + if ((x_323 <= x_324)) { + } else { + break; + } + int const x_327 = i_1; + int const x_328 = i_1; + int const x_330 = (*(tint_symbol_6)).arr[x_328]; + (*(tint_symbol_5)).arr[x_327] = x_330; + { + int const x_332 = i_1; + i_1 = (x_332 + 1); + } + } + return; +} + +int func_i1_i1_(thread int* const m, thread int* const high, thread float4* const tint_symbol_7) { + int x = 0; + int x_335 = 0; + int x_336 = 0; + float const x_338 = (*(tint_symbol_7)).x; + if ((x_338 >= 0.0f)) { + if (false) { + int const x_346 = *(high); + x_336 = (x_346 << as_type(0)); + } else { + x_336 = 4; + } + int const x_348 = x_336; + x_335 = (1 << as_type(x_348)); + } else { + x_335 = 1; + } + int const x_350 = x_335; + x = x_350; + int const x_351 = x; + x = (x_351 >> as_type(4)); + int const x_353 = *(m); + int const x_355 = *(m); + int const x_357 = *(m); + int const x_359 = x; + return clamp((2 * x_353), (2 * x_355), ((2 * x_357) / x_359)); +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_8, thread tint_array_wrapper* const tint_symbol_9, thread float4* const tint_symbol_10) { + int low = 0; + int high_1 = 0; + int m_1 = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int param_4 = 0; + low = 0; + high_1 = 9; + m_1 = 1; + while (true) { + int const x_367 = m_1; + int const x_368 = high_1; + if ((x_367 <= x_368)) { + } else { + break; + } + int const x_371 = low; + i_2 = x_371; + while (true) { + int const x_376 = i_2; + int const x_377 = high_1; + if ((x_376 < x_377)) { + } else { + break; + } + int const x_380 = i_2; + from_1 = x_380; + int const x_381 = i_2; + int const x_382 = m_1; + mid_1 = ((x_381 + x_382) - 1); + int const x_385 = i_2; + int const x_386 = m_1; + int const x_390 = high_1; + to_1 = min(((x_385 + (2 * x_386)) - 1), x_390); + int const x_392 = from_1; + param = x_392; + int const x_393 = mid_1; + param_1 = x_393; + int const x_394 = to_1; + param_2 = x_394; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_8, tint_symbol_9); + { + int const x_396 = m_1; + param_3 = x_396; + int const x_397 = high_1; + param_4 = x_397; + int const x_398 = func_i1_i1_(&(param_3), &(param_4), tint_symbol_10); + int const x_399 = i_2; + i_2 = (x_399 + x_398); + } + } + { + int const x_401 = m_1; + m_1 = (2 * x_401); + } + } + return; +} + +void main_1(constant buf0& x_34, thread tint_array_wrapper* const tint_symbol_11, thread tint_array_wrapper* const tint_symbol_12, thread float4* const tint_symbol_13, thread float4* const tint_symbol_14) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + float const x_93 = x_34.injectionSwitch.x; + i_3 = int(x_93); + while (true) { + int const x_99 = i_3; + switch(x_99) { + case 9: { + int const x_129 = i_3; + (*(tint_symbol_11)).arr[x_129] = -5; + break; + } + case 8: { + int const x_127 = i_3; + (*(tint_symbol_11)).arr[x_127] = -4; + break; + } + case 7: { + int const x_125 = i_3; + (*(tint_symbol_11)).arr[x_125] = -3; + break; + } + case 6: { + int const x_123 = i_3; + (*(tint_symbol_11)).arr[x_123] = -2; + break; + } + case 5: { + int const x_121 = i_3; + (*(tint_symbol_11)).arr[x_121] = -1; + break; + } + case 4: { + int const x_119 = i_3; + (*(tint_symbol_11)).arr[x_119] = 0; + break; + } + case 3: { + int const x_117 = i_3; + (*(tint_symbol_11)).arr[x_117] = 1; + break; + } + case 2: { + int const x_115 = i_3; + (*(tint_symbol_11)).arr[x_115] = 2; + break; + } + case 1: { + int const x_113 = i_3; + (*(tint_symbol_11)).arr[x_113] = 3; + break; + } + case 0: { + int const x_111 = i_3; + (*(tint_symbol_11)).arr[x_111] = 4; + break; + } + default: { + break; + } + } + int const x_131 = i_3; + i_3 = (x_131 + 1); + { + int const x_133 = i_3; + if ((x_133 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_139 = j_1; + if ((x_139 < 10)) { + } else { + break; + } + int const x_142 = j_1; + int const x_143 = j_1; + int const x_145 = (*(tint_symbol_11)).arr[x_143]; + (*(tint_symbol_12)).arr[x_142] = x_145; + { + int const x_147 = j_1; + j_1 = (x_147 + 1); + } + } + mergeSort_(tint_symbol_11, tint_symbol_12, tint_symbol_13); + float const x_151 = (*(tint_symbol_13)).y; + if ((int(x_151) < 30)) { + int const x_158 = (*(tint_symbol_11)).arr[0]; + grey = (0.5f + (float(x_158) / 10.0f)); + } else { + float const x_163 = (*(tint_symbol_13)).y; + if ((int(x_163) < 60)) { + int const x_170 = (*(tint_symbol_11)).arr[1]; + grey = (0.5f + (float(x_170) / 10.0f)); + } else { + float const x_175 = (*(tint_symbol_13)).y; + if ((int(x_175) < 90)) { + int const x_182 = (*(tint_symbol_11)).arr[2]; + grey = (0.5f + (float(x_182) / 10.0f)); + } else { + float const x_187 = (*(tint_symbol_13)).y; + if ((int(x_187) < 120)) { + int const x_194 = (*(tint_symbol_11)).arr[3]; + grey = (0.5f + (float(x_194) / 10.0f)); + } else { + float const x_199 = (*(tint_symbol_13)).y; + if ((int(x_199) < 150)) { + discard_fragment(); + } else { + float const x_206 = (*(tint_symbol_13)).y; + if ((int(x_206) < 180)) { + int const x_213 = (*(tint_symbol_11)).arr[5]; + grey = (0.5f + (float(x_213) / 10.0f)); + } else { + float const x_218 = (*(tint_symbol_13)).y; + if ((int(x_218) < 210)) { + int const x_225 = (*(tint_symbol_11)).arr[6]; + grey = (0.5f + (float(x_225) / 10.0f)); + } else { + float const x_230 = (*(tint_symbol_13)).y; + if ((int(x_230) < 240)) { + int const x_237 = (*(tint_symbol_11)).arr[7]; + grey = (0.5f + (float(x_237) / 10.0f)); + } else { + float const x_242 = (*(tint_symbol_13)).y; + if ((int(x_242) < 270)) { + int const x_249 = (*(tint_symbol_11)).arr[8]; + grey = (0.5f + (float(x_249) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_253 = grey; + float3 const x_254 = float3(x_253, x_253, x_253); + *(tint_symbol_14) = float4(x_254.x, x_254.y, x_254.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_34 [[buffer(0)]]) { + thread float4 tint_symbol_15 = 0.0f; + thread tint_array_wrapper tint_symbol_16 = {}; + thread tint_array_wrapper tint_symbol_17 = {}; + thread float4 tint_symbol_18 = 0.0f; + tint_symbol_15 = gl_FragCoord_param; + main_1(x_34, &(tint_symbol_16), &(tint_symbol_17), &(tint_symbol_15), &(tint_symbol_18)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_18}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..6248b33ed0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.spvasm @@ -0,0 +1,716 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 463 +; Schema: 0 + OpCapability Shader + %174 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_34 "x_34" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %func_i1_i1_ "func_i1_i1_" + OpName %m "m" + OpName %high "high" + OpName %x "x" + OpName %x_335 "x_335" + OpName %x_336 "x_336" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high_1 "high_1" + OpName %m_1 "m_1" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %param_4 "param_4" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_34 NonWritable + OpDecorate %x_34 DescriptorSet 0 + OpDecorate %x_34 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %13 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_34 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %132 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %int_2 = OpConstant %int 2 + %180 = OpTypeFunction %void + %int_9 = OpConstant %int 9 +%_ptr_Function_float = OpTypePointer Function %float + %251 = OpConstantNull %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %uint_1 = OpConstant %uint 1 + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %450 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpLoad %int %mid + %51 = OpLoad %int %j + %53 = OpLoad %int %to + %54 = OpSLessThanEqual %bool %48 %50 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %58 = OpSLessThanEqual %bool %51 %53 + OpBranch %56 + %56 = OpLabel + %59 = OpPhi %bool %54 %47 %58 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %45 + %60 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Private_int %data %63 + %66 = OpLoad %int %65 + %67 = OpLoad %int %j + %68 = OpAccessChain %_ptr_Private_int %data %67 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %k + %75 = OpIAdd %int %74 %int_1 + OpStore %k %75 + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + %78 = OpAccessChain %_ptr_Private_int %data %76 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Private_int %temp %74 + OpStore %80 %79 + OpBranch %71 + %73 = OpLabel + %81 = OpLoad %int %k + %82 = OpIAdd %int %81 %int_1 + OpStore %k %82 + %83 = OpLoad %int %j + %84 = OpIAdd %int %83 %int_1 + OpStore %j %84 + %85 = OpAccessChain %_ptr_Private_int %data %83 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Private_int %temp %81 + OpStore %87 %86 + OpBranch %71 + %71 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpLoad %int %i + %95 = OpLoad %int %mid + %97 = OpSLessThan %bool %92 %int_10 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSLessThanEqual %bool %93 %95 + OpBranch %98 + %98 = OpLabel + %101 = OpPhi %bool %97 %91 %100 %99 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpBranch %102 + %104 = OpLabel + OpBranch %89 + %102 = OpLabel + %105 = OpLoad %int %k + %106 = OpIAdd %int %105 %int_1 + OpStore %k %106 + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + %109 = OpAccessChain %_ptr_Private_int %data %107 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Private_int %temp %105 + OpStore %111 %110 + OpBranch %90 + %90 = OpLabel + OpBranch %88 + %89 = OpLabel + %113 = OpLoad %int %from + OpStore %i_1 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpLoad %int %to + %121 = OpSLessThanEqual %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + OpBranch %122 + %124 = OpLabel + OpBranch %115 + %122 = OpLabel + %125 = OpLoad %int %i_1 + %126 = OpLoad %int %i_1 + %127 = OpAccessChain %_ptr_Private_int %temp %126 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %129 %128 + OpBranch %116 + %116 = OpLabel + %130 = OpLoad %int %i_1 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_1 %131 + OpBranch %114 + %115 = OpLabel + OpReturn + OpFunctionEnd +%func_i1_i1_ = OpFunction %int None %132 + %m = OpFunctionParameter %_ptr_Function_int + %high = OpFunctionParameter %_ptr_Function_int + %136 = OpLabel + %x = OpVariable %_ptr_Function_int Function %32 + %x_335 = OpVariable %_ptr_Function_int Function %32 + %x_336 = OpVariable %_ptr_Function_int Function %32 + %142 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %143 = OpLoad %float %142 + %145 = OpFOrdGreaterThanEqual %bool %143 %float_0 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %148 + %147 = OpLabel + OpSelectionMerge %150 None + OpBranchConditional %false %151 %152 + %151 = OpLabel + %154 = OpLoad %int %high + %155 = OpBitcast %uint %int_0 + %157 = OpShiftLeftLogical %int %154 %155 + OpStore %x_336 %157 + OpBranch %150 + %152 = OpLabel + OpStore %x_336 %int_4 + OpBranch %150 + %150 = OpLabel + %159 = OpLoad %int %x_336 + %160 = OpBitcast %uint %159 + %161 = OpShiftLeftLogical %int %int_1 %160 + OpStore %x_335 %161 + OpBranch %146 + %148 = OpLabel + OpStore %x_335 %int_1 + OpBranch %146 + %146 = OpLabel + %162 = OpLoad %int %x_335 + OpStore %x %162 + %163 = OpLoad %int %x + %164 = OpBitcast %uint %int_4 + %165 = OpShiftRightArithmetic %int %163 %164 + OpStore %x %165 + %167 = OpLoad %int %m + %169 = OpLoad %int %m + %171 = OpLoad %int %m + %172 = OpLoad %int %x + %176 = OpIMul %int %int_2 %167 + %177 = OpIMul %int %int_2 %169 + %178 = OpIMul %int %int_2 %171 + %179 = OpSDiv %int %178 %172 + %173 = OpExtInst %int %174 SClamp %176 %177 %179 + OpReturnValue %173 + OpFunctionEnd + %mergeSort_ = OpFunction %void None %180 + %182 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high_1 = OpVariable %_ptr_Function_int Function %32 + %m_1 = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + %param_3 = OpVariable %_ptr_Function_int Function %32 + %param_4 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high_1 %int_9 + OpStore %m_1 %int_1 + OpBranch %196 + %196 = OpLabel + OpLoopMerge %197 %198 None + OpBranch %199 + %199 = OpLabel + %200 = OpLoad %int %m_1 + %201 = OpLoad %int %high_1 + %202 = OpSLessThanEqual %bool %200 %201 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %205 + %204 = OpLabel + OpBranch %203 + %205 = OpLabel + OpBranch %197 + %203 = OpLabel + %206 = OpLoad %int %low + OpStore %i_2 %206 + OpBranch %207 + %207 = OpLabel + OpLoopMerge %208 %209 None + OpBranch %210 + %210 = OpLabel + %211 = OpLoad %int %i_2 + %212 = OpLoad %int %high_1 + %213 = OpSLessThan %bool %211 %212 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %216 + %215 = OpLabel + OpBranch %214 + %216 = OpLabel + OpBranch %208 + %214 = OpLabel + %217 = OpLoad %int %i_2 + OpStore %from_1 %217 + %218 = OpLoad %int %i_2 + %219 = OpLoad %int %m_1 + %220 = OpIAdd %int %218 %219 + %221 = OpISub %int %220 %int_1 + OpStore %mid_1 %221 + %222 = OpLoad %int %i_2 + %223 = OpLoad %int %m_1 + %224 = OpLoad %int %high_1 + %226 = OpIMul %int %int_2 %223 + %227 = OpIAdd %int %222 %226 + %228 = OpISub %int %227 %int_1 + %225 = OpExtInst %int %174 SMin %228 %224 + OpStore %to_1 %225 + %229 = OpLoad %int %from_1 + OpStore %param %229 + %230 = OpLoad %int %mid_1 + OpStore %param_1 %230 + %231 = OpLoad %int %to_1 + OpStore %param_2 %231 + %232 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %209 + %209 = OpLabel + %236 = OpLoad %int %m_1 + OpStore %param_3 %236 + %237 = OpLoad %int %high_1 + OpStore %param_4 %237 + %238 = OpFunctionCall %int %func_i1_i1_ %param_3 %param_4 + %241 = OpLoad %int %i_2 + %242 = OpIAdd %int %241 %238 + OpStore %i_2 %242 + OpBranch %207 + %208 = OpLabel + OpBranch %198 + %198 = OpLabel + %243 = OpLoad %int %m_1 + %244 = OpIMul %int %int_2 %243 + OpStore %m_1 %244 + OpBranch %196 + %197 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %180 + %246 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %251 + %253 = OpAccessChain %_ptr_Uniform_float %x_34 %uint_0 %uint_0 + %254 = OpLoad %float %253 + %255 = OpConvertFToS %int %254 + OpStore %i_3 %255 + OpBranch %256 + %256 = OpLabel + OpLoopMerge %257 %258 None + OpBranch %259 + %259 = OpLabel + %260 = OpLoad %int %i_3 + OpSelectionMerge %261 None + OpSwitch %260 %262 9 %263 8 %264 7 %265 6 %266 5 %267 4 %268 3 %269 2 %270 1 %271 0 %272 + %263 = OpLabel + %273 = OpLoad %int %i_3 + %274 = OpAccessChain %_ptr_Private_int %data %273 + OpStore %274 %int_n5 + OpBranch %261 + %264 = OpLabel + %276 = OpLoad %int %i_3 + %277 = OpAccessChain %_ptr_Private_int %data %276 + OpStore %277 %int_n4 + OpBranch %261 + %265 = OpLabel + %279 = OpLoad %int %i_3 + %280 = OpAccessChain %_ptr_Private_int %data %279 + OpStore %280 %int_n3 + OpBranch %261 + %266 = OpLabel + %282 = OpLoad %int %i_3 + %283 = OpAccessChain %_ptr_Private_int %data %282 + OpStore %283 %int_n2 + OpBranch %261 + %267 = OpLabel + %285 = OpLoad %int %i_3 + %286 = OpAccessChain %_ptr_Private_int %data %285 + OpStore %286 %int_n1 + OpBranch %261 + %268 = OpLabel + %288 = OpLoad %int %i_3 + %289 = OpAccessChain %_ptr_Private_int %data %288 + OpStore %289 %int_0 + OpBranch %261 + %269 = OpLabel + %290 = OpLoad %int %i_3 + %291 = OpAccessChain %_ptr_Private_int %data %290 + OpStore %291 %int_1 + OpBranch %261 + %270 = OpLabel + %292 = OpLoad %int %i_3 + %293 = OpAccessChain %_ptr_Private_int %data %292 + OpStore %293 %int_2 + OpBranch %261 + %271 = OpLabel + %294 = OpLoad %int %i_3 + %295 = OpAccessChain %_ptr_Private_int %data %294 + OpStore %295 %int_3 + OpBranch %261 + %272 = OpLabel + %297 = OpLoad %int %i_3 + %298 = OpAccessChain %_ptr_Private_int %data %297 + OpStore %298 %int_4 + OpBranch %261 + %262 = OpLabel + OpBranch %261 + %261 = OpLabel + %299 = OpLoad %int %i_3 + %300 = OpIAdd %int %299 %int_1 + OpStore %i_3 %300 + OpBranch %258 + %258 = OpLabel + %301 = OpLoad %int %i_3 + %302 = OpSLessThan %bool %301 %int_10 + OpSelectionMerge %303 None + OpBranchConditional %302 %304 %305 + %304 = OpLabel + OpBranch %303 + %305 = OpLabel + OpBranch %257 + %303 = OpLabel + OpBranch %256 + %257 = OpLabel + OpStore %j_1 %int_0 + OpBranch %306 + %306 = OpLabel + OpLoopMerge %307 %308 None + OpBranch %309 + %309 = OpLabel + %310 = OpLoad %int %j_1 + %311 = OpSLessThan %bool %310 %int_10 + OpSelectionMerge %312 None + OpBranchConditional %311 %313 %314 + %313 = OpLabel + OpBranch %312 + %314 = OpLabel + OpBranch %307 + %312 = OpLabel + %315 = OpLoad %int %j_1 + %316 = OpLoad %int %j_1 + %317 = OpAccessChain %_ptr_Private_int %data %316 + %318 = OpLoad %int %317 + %319 = OpAccessChain %_ptr_Private_int %temp %315 + OpStore %319 %318 + OpBranch %308 + %308 = OpLabel + %320 = OpLoad %int %j_1 + %321 = OpIAdd %int %320 %int_1 + OpStore %j_1 %321 + OpBranch %306 + %307 = OpLabel + %322 = OpFunctionCall %void %mergeSort_ + %324 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %325 = OpLoad %float %324 + %326 = OpConvertFToS %int %325 + %328 = OpSLessThan %bool %326 %int_30 + OpSelectionMerge %329 None + OpBranchConditional %328 %330 %331 + %330 = OpLabel + %332 = OpAccessChain %_ptr_Private_int %data %int_0 + %333 = OpLoad %int %332 + %335 = OpConvertSToF %float %333 + %337 = OpFDiv %float %335 %float_10 + %338 = OpFAdd %float %float_0_5 %337 + OpStore %grey %338 + OpBranch %329 + %331 = OpLabel + %339 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %340 = OpLoad %float %339 + %341 = OpConvertFToS %int %340 + %343 = OpSLessThan %bool %341 %int_60 + OpSelectionMerge %344 None + OpBranchConditional %343 %345 %346 + %345 = OpLabel + %347 = OpAccessChain %_ptr_Private_int %data %int_1 + %348 = OpLoad %int %347 + %349 = OpConvertSToF %float %348 + %350 = OpFDiv %float %349 %float_10 + %351 = OpFAdd %float %float_0_5 %350 + OpStore %grey %351 + OpBranch %344 + %346 = OpLabel + %352 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %353 = OpLoad %float %352 + %354 = OpConvertFToS %int %353 + %356 = OpSLessThan %bool %354 %int_90 + OpSelectionMerge %357 None + OpBranchConditional %356 %358 %359 + %358 = OpLabel + %360 = OpAccessChain %_ptr_Private_int %data %int_2 + %361 = OpLoad %int %360 + %362 = OpConvertSToF %float %361 + %363 = OpFDiv %float %362 %float_10 + %364 = OpFAdd %float %float_0_5 %363 + OpStore %grey %364 + OpBranch %357 + %359 = OpLabel + %365 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %366 = OpLoad %float %365 + %367 = OpConvertFToS %int %366 + %369 = OpSLessThan %bool %367 %int_120 + OpSelectionMerge %370 None + OpBranchConditional %369 %371 %372 + %371 = OpLabel + %373 = OpAccessChain %_ptr_Private_int %data %int_3 + %374 = OpLoad %int %373 + %375 = OpConvertSToF %float %374 + %376 = OpFDiv %float %375 %float_10 + %377 = OpFAdd %float %float_0_5 %376 + OpStore %grey %377 + OpBranch %370 + %372 = OpLabel + %378 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %379 = OpLoad %float %378 + %380 = OpConvertFToS %int %379 + %382 = OpSLessThan %bool %380 %int_150 + OpSelectionMerge %383 None + OpBranchConditional %382 %384 %385 + %384 = OpLabel + OpKill + %385 = OpLabel + %386 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %387 = OpLoad %float %386 + %388 = OpConvertFToS %int %387 + %390 = OpSLessThan %bool %388 %int_180 + OpSelectionMerge %391 None + OpBranchConditional %390 %392 %393 + %392 = OpLabel + %395 = OpAccessChain %_ptr_Private_int %data %int_5 + %396 = OpLoad %int %395 + %397 = OpConvertSToF %float %396 + %398 = OpFDiv %float %397 %float_10 + %399 = OpFAdd %float %float_0_5 %398 + OpStore %grey %399 + OpBranch %391 + %393 = OpLabel + %400 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %401 = OpLoad %float %400 + %402 = OpConvertFToS %int %401 + %404 = OpSLessThan %bool %402 %int_210 + OpSelectionMerge %405 None + OpBranchConditional %404 %406 %407 + %406 = OpLabel + %409 = OpAccessChain %_ptr_Private_int %data %int_6 + %410 = OpLoad %int %409 + %411 = OpConvertSToF %float %410 + %412 = OpFDiv %float %411 %float_10 + %413 = OpFAdd %float %float_0_5 %412 + OpStore %grey %413 + OpBranch %405 + %407 = OpLabel + %414 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %415 = OpLoad %float %414 + %416 = OpConvertFToS %int %415 + %418 = OpSLessThan %bool %416 %int_240 + OpSelectionMerge %419 None + OpBranchConditional %418 %420 %421 + %420 = OpLabel + %423 = OpAccessChain %_ptr_Private_int %data %int_7 + %424 = OpLoad %int %423 + %425 = OpConvertSToF %float %424 + %426 = OpFDiv %float %425 %float_10 + %427 = OpFAdd %float %float_0_5 %426 + OpStore %grey %427 + OpBranch %419 + %421 = OpLabel + %428 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %429 = OpLoad %float %428 + %430 = OpConvertFToS %int %429 + %432 = OpSLessThan %bool %430 %int_270 + OpSelectionMerge %433 None + OpBranchConditional %432 %434 %435 + %434 = OpLabel + %437 = OpAccessChain %_ptr_Private_int %data %int_8 + %438 = OpLoad %int %437 + %439 = OpConvertSToF %float %438 + %440 = OpFDiv %float %439 %float_10 + %441 = OpFAdd %float %float_0_5 %440 + OpStore %grey %441 + OpBranch %433 + %435 = OpLabel + OpKill + %433 = OpLabel + OpBranch %419 + %419 = OpLabel + OpBranch %405 + %405 = OpLabel + OpBranch %391 + %391 = OpLabel + OpBranch %383 + %383 = OpLabel + OpBranch %370 + %370 = OpLabel + OpBranch %357 + %357 = OpLabel + OpBranch %344 + %344 = OpLabel + OpBranch %329 + %329 = OpLabel + %442 = OpLoad %float %grey + %444 = OpCompositeConstruct %v3float %442 %442 %442 + %445 = OpCompositeExtract %float %444 0 + %446 = OpCompositeExtract %float %444 1 + %447 = OpCompositeExtract %float %444 2 + %449 = OpCompositeConstruct %v4float %445 %446 %447 %float_1 + OpStore %x_GLF_color %449 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %450 +%tint_symbol_1 = OpFunctionParameter %main_out + %454 = OpLabel + %455 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %455 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %180 + %457 = OpLabel + %458 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %458 + %459 = OpFunctionCall %void %main_1 + %461 = OpLoad %v4float %x_GLF_color + %462 = OpCompositeConstruct %main_out %461 + %460 = OpFunctionCall %void %tint_symbol_3 %462 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 258[%258] is not post dominated by the back-edge block 303[%303] + %303 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..460ad4b461 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-clamped-conditional-bit-shift/1.wgsl.expected.wgsl @@ -0,0 +1,340 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_260 : i32 = *(from); + k = x_260; + let x_261 : i32 = *(from); + i = x_261; + let x_262 : i32 = *(mid); + j = (x_262 + 1); + loop { + let x_268 : i32 = i; + let x_269 : i32 = *(mid); + let x_271 : i32 = j; + let x_272 : i32 = *(to); + if (((x_268 <= x_269) && (x_271 <= x_272))) { + } else { + break; + } + let x_276 : i32 = i; + let x_278 : i32 = data[x_276]; + let x_279 : i32 = j; + let x_281 : i32 = data[x_279]; + if ((x_278 < x_281)) { + let x_286 : i32 = k; + k = (x_286 + 1); + let x_288 : i32 = i; + i = (x_288 + 1); + let x_291 : i32 = data[x_288]; + temp[x_286] = x_291; + } else { + let x_293 : i32 = k; + k = (x_293 + 1); + let x_295 : i32 = j; + j = (x_295 + 1); + let x_298 : i32 = data[x_295]; + temp[x_293] = x_298; + } + } + loop { + let x_304 : i32 = i; + let x_306 : i32 = i; + let x_307 : i32 = *(mid); + if (((x_304 < 10) && (x_306 <= x_307))) { + } else { + break; + } + let x_311 : i32 = k; + k = (x_311 + 1); + let x_313 : i32 = i; + i = (x_313 + 1); + let x_316 : i32 = data[x_313]; + temp[x_311] = x_316; + } + let x_318 : i32 = *(from); + i_1 = x_318; + loop { + let x_323 : i32 = i_1; + let x_324 : i32 = *(to); + if ((x_323 <= x_324)) { + } else { + break; + } + let x_327 : i32 = i_1; + let x_328 : i32 = i_1; + let x_330 : i32 = temp[x_328]; + data[x_327] = x_330; + + continuing { + let x_332 : i32 = i_1; + i_1 = (x_332 + 1); + } + } + return; +} + +fn func_i1_i1_(m : ptr, high : ptr) -> i32 { + var x : i32; + var x_335 : i32; + var x_336 : i32; + let x_338 : f32 = gl_FragCoord.x; + if ((x_338 >= 0.0)) { + if (false) { + let x_346 : i32 = *(high); + x_336 = (x_346 << bitcast(0)); + } else { + x_336 = 4; + } + let x_348 : i32 = x_336; + x_335 = (1 << bitcast(x_348)); + } else { + x_335 = 1; + } + let x_350 : i32 = x_335; + x = x_350; + let x_351 : i32 = x; + x = (x_351 >> bitcast(4)); + let x_353 : i32 = *(m); + let x_355 : i32 = *(m); + let x_357 : i32 = *(m); + let x_359 : i32 = x; + return clamp((2 * x_353), (2 * x_355), ((2 * x_357) / x_359)); +} + +fn mergeSort_() { + var low : i32; + var high_1 : i32; + var m_1 : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + var param_4 : i32; + low = 0; + high_1 = 9; + m_1 = 1; + loop { + let x_367 : i32 = m_1; + let x_368 : i32 = high_1; + if ((x_367 <= x_368)) { + } else { + break; + } + let x_371 : i32 = low; + i_2 = x_371; + loop { + let x_376 : i32 = i_2; + let x_377 : i32 = high_1; + if ((x_376 < x_377)) { + } else { + break; + } + let x_380 : i32 = i_2; + from_1 = x_380; + let x_381 : i32 = i_2; + let x_382 : i32 = m_1; + mid_1 = ((x_381 + x_382) - 1); + let x_385 : i32 = i_2; + let x_386 : i32 = m_1; + let x_390 : i32 = high_1; + to_1 = min(((x_385 + (2 * x_386)) - 1), x_390); + let x_392 : i32 = from_1; + param = x_392; + let x_393 : i32 = mid_1; + param_1 = x_393; + let x_394 : i32 = to_1; + param_2 = x_394; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_396 : i32 = m_1; + param_3 = x_396; + let x_397 : i32 = high_1; + param_4 = x_397; + let x_398 : i32 = func_i1_i1_(&(param_3), &(param_4)); + let x_399 : i32 = i_2; + i_2 = (x_399 + x_398); + } + } + + continuing { + let x_401 : i32 = m_1; + m_1 = (2 * x_401); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + let x_93 : f32 = x_34.injectionSwitch.x; + i_3 = i32(x_93); + loop { + let x_99 : i32 = i_3; + switch(x_99) { + case 9: { + let x_129 : i32 = i_3; + data[x_129] = -5; + } + case 8: { + let x_127 : i32 = i_3; + data[x_127] = -4; + } + case 7: { + let x_125 : i32 = i_3; + data[x_125] = -3; + } + case 6: { + let x_123 : i32 = i_3; + data[x_123] = -2; + } + case 5: { + let x_121 : i32 = i_3; + data[x_121] = -1; + } + case 4: { + let x_119 : i32 = i_3; + data[x_119] = 0; + } + case 3: { + let x_117 : i32 = i_3; + data[x_117] = 1; + } + case 2: { + let x_115 : i32 = i_3; + data[x_115] = 2; + } + case 1: { + let x_113 : i32 = i_3; + data[x_113] = 3; + } + case 0: { + let x_111 : i32 = i_3; + data[x_111] = 4; + } + default: { + } + } + let x_131 : i32 = i_3; + i_3 = (x_131 + 1); + + continuing { + let x_133 : i32 = i_3; + if ((x_133 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_139 : i32 = j_1; + if ((x_139 < 10)) { + } else { + break; + } + let x_142 : i32 = j_1; + let x_143 : i32 = j_1; + let x_145 : i32 = data[x_143]; + temp[x_142] = x_145; + + continuing { + let x_147 : i32 = j_1; + j_1 = (x_147 + 1); + } + } + mergeSort_(); + let x_151 : f32 = gl_FragCoord.y; + if ((i32(x_151) < 30)) { + let x_158 : i32 = data[0]; + grey = (0.5 + (f32(x_158) / 10.0)); + } else { + let x_163 : f32 = gl_FragCoord.y; + if ((i32(x_163) < 60)) { + let x_170 : i32 = data[1]; + grey = (0.5 + (f32(x_170) / 10.0)); + } else { + let x_175 : f32 = gl_FragCoord.y; + if ((i32(x_175) < 90)) { + let x_182 : i32 = data[2]; + grey = (0.5 + (f32(x_182) / 10.0)); + } else { + let x_187 : f32 = gl_FragCoord.y; + if ((i32(x_187) < 120)) { + let x_194 : i32 = data[3]; + grey = (0.5 + (f32(x_194) / 10.0)); + } else { + let x_199 : f32 = gl_FragCoord.y; + if ((i32(x_199) < 150)) { + discard; + } else { + let x_206 : f32 = gl_FragCoord.y; + if ((i32(x_206) < 180)) { + let x_213 : i32 = data[5]; + grey = (0.5 + (f32(x_213) / 10.0)); + } else { + let x_218 : f32 = gl_FragCoord.y; + if ((i32(x_218) < 210)) { + let x_225 : i32 = data[6]; + grey = (0.5 + (f32(x_225) / 10.0)); + } else { + let x_230 : f32 = gl_FragCoord.y; + if ((i32(x_230) < 240)) { + let x_237 : i32 = data[7]; + grey = (0.5 + (f32(x_237) / 10.0)); + } else { + let x_242 : f32 = gl_FragCoord.y; + if ((i32(x_242) < 270)) { + let x_249 : i32 = data[8]; + grey = (0.5 + (f32(x_249) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_253 : f32 = grey; + let x_254 : vec3 = vec3(x_253, x_253, x_253); + x_GLF_color = vec4(x_254.x, x_254.y, x_254.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm new file mode 100644 index 0000000000..ed5aa403b2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm @@ -0,0 +1,416 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 + %int_10 = OpConstant %int 10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %54 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %55 = OpConstantComposite %v2float %float_1 %float_1 + %int_32 = OpConstant %int 32 + %float_0 = OpConstant %float 0 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 +%float_0_100000001 = OpConstant %float 0.100000001 + %main = OpFunction %void None %10 + %60 = OpLabel + %temp = OpVariable %_ptr_Function__arr_int_uint_10 Function + %data = OpVariable %_ptr_Function__arr_int_uint_10 Function + %61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %62 = OpLoad %float %61 + %63 = OpConvertFToS %int %62 + OpBranch %64 + %64 = OpLabel + %65 = OpPhi %int %63 %60 %66 %67 + OpLoopMerge %68 %67 None + OpBranch %69 + %69 = OpLabel + OpSelectionMerge %70 None + OpSwitch %65 %70 0 %71 1 %72 2 %73 3 %74 4 %75 5 %76 6 %77 7 %78 8 %79 9 %80 + %71 = OpLabel + %81 = OpAccessChain %_ptr_Function_int %data %65 + OpStore %81 %int_4 + OpBranch %70 + %72 = OpLabel + %82 = OpAccessChain %_ptr_Function_int %data %65 + OpStore %82 %int_3 + OpBranch %70 + %73 = OpLabel + %83 = OpAccessChain %_ptr_Function_int %data %65 + OpStore %83 %int_2 + OpBranch %70 + %74 = OpLabel + %84 = OpAccessChain %_ptr_Function_int %data %65 + OpStore %84 %int_1 + OpBranch %70 + %75 = OpLabel + %85 = OpAccessChain %_ptr_Function_int %data %65 + OpStore %85 %int_0 + OpBranch %70 + %76 = OpLabel + %86 = OpAccessChain %_ptr_Function_int %data %65 + OpStore %86 %int_n1 + OpBranch %70 + %77 = OpLabel + %87 = OpAccessChain %_ptr_Function_int %data %65 + OpStore %87 %int_n2 + OpBranch %70 + %78 = OpLabel + %88 = OpAccessChain %_ptr_Function_int %data %65 + OpStore %88 %int_n3 + OpBranch %70 + %79 = OpLabel + %89 = OpAccessChain %_ptr_Function_int %data %65 + OpStore %89 %int_n4 + OpBranch %70 + %80 = OpLabel + %90 = OpAccessChain %_ptr_Function_int %data %65 + OpStore %90 %int_n5 + OpBranch %70 + %70 = OpLabel + %66 = OpIAdd %int %65 %int_1 + OpBranch %67 + %67 = OpLabel + %91 = OpSLessThan %bool %66 %int_10 + OpBranchConditional %91 %64 %68 + %68 = OpLabel + OpBranch %92 + %92 = OpLabel + %93 = OpPhi %int %int_0 %68 %94 %95 + %96 = OpSLessThan %bool %93 %int_10 + OpLoopMerge %97 %95 None + OpBranchConditional %96 %95 %97 + %95 = OpLabel + %98 = OpAccessChain %_ptr_Function_int %data %93 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_Function_int %temp %93 + OpStore %100 %99 + %94 = OpIAdd %int %93 %int_1 + OpBranch %92 + %97 = OpLabel + OpBranch %101 + %101 = OpLabel + %102 = OpPhi %int %int_1 %97 %103 %104 + %105 = OpSLessThanEqual %bool %102 %int_9 + OpLoopMerge %106 %104 None + OpBranchConditional %105 %107 %106 + %107 = OpLabel + OpBranch %108 + %108 = OpLabel + %109 = OpPhi %int %int_0 %107 %110 %111 + %112 = OpSLessThan %bool %109 %int_9 + OpLoopMerge %113 %111 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + %115 = OpIAdd %int %109 %102 + %116 = OpISub %int %115 %int_1 + %117 = OpIMul %int %int_2 %102 + %110 = OpIAdd %int %109 %117 + %118 = OpISub %int %110 %int_1 + %119 = OpExtInst %int %1 SMin %118 %int_9 + OpBranch %120 + %120 = OpLabel + %121 = OpPhi %int %109 %114 %122 %123 + %124 = OpPhi %int %115 %114 %125 %123 + %126 = OpPhi %int %109 %114 %127 %123 + %128 = OpSLessThanEqual %bool %126 %116 + %129 = OpSLessThanEqual %bool %124 %119 + %130 = OpLogicalAnd %bool %128 %129 + OpLoopMerge %131 %123 None + OpBranchConditional %130 %132 %131 + %132 = OpLabel + %133 = OpAccessChain %_ptr_Function_int %data %126 + %134 = OpLoad %int %133 + %135 = OpAccessChain %_ptr_Function_int %data %124 + %136 = OpLoad %int %135 + %137 = OpSLessThan %bool %134 %136 + %122 = OpIAdd %int %121 %int_1 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %140 + %139 = OpLabel + %141 = OpIAdd %int %126 %int_1 + %142 = OpLoad %int %133 + %143 = OpAccessChain %_ptr_Function_int %temp %121 + OpStore %143 %142 + OpBranch %138 + %140 = OpLabel + %144 = OpIAdd %int %124 %int_1 + %145 = OpLoad %int %135 + %146 = OpAccessChain %_ptr_Function_int %temp %121 + OpStore %146 %145 + OpBranch %138 + %138 = OpLabel + %125 = OpPhi %int %124 %139 %144 %140 + %127 = OpPhi %int %141 %139 %126 %140 + OpBranch %123 + %123 = OpLabel + OpBranch %120 + %131 = OpLabel + OpBranch %147 + %147 = OpLabel + %148 = OpPhi %int %121 %131 %149 %150 + %151 = OpPhi %int %126 %131 %152 %150 + %153 = OpSLessThan %bool %151 %int_10 + %154 = OpSLessThanEqual %bool %151 %116 + %155 = OpLogicalAnd %bool %153 %154 + OpLoopMerge %156 %150 None + OpBranchConditional %155 %150 %156 + %150 = OpLabel + %149 = OpIAdd %int %148 %int_1 + %152 = OpIAdd %int %151 %int_1 + %157 = OpAccessChain %_ptr_Function_int %data %151 + %158 = OpLoad %int %157 + %159 = OpAccessChain %_ptr_Function_int %temp %148 + OpStore %159 %158 + OpBranch %147 + %156 = OpLabel + OpBranch %160 + %160 = OpLabel + %161 = OpPhi %int %109 %156 %162 %163 + %164 = OpSLessThanEqual %bool %161 %119 + OpLoopMerge %165 %163 None + OpBranchConditional %164 %163 %165 + %163 = OpLabel + %166 = OpAccessChain %_ptr_Function_int %temp %161 + %167 = OpLoad %int %166 + %168 = OpAccessChain %_ptr_Function_int %data %161 + OpStore %168 %167 + %162 = OpIAdd %int %161 %int_1 + OpBranch %160 + %165 = OpLabel + OpBranch %111 + %111 = OpLabel + OpBranch %108 + %113 = OpLabel + OpBranch %104 + %104 = OpLabel + %103 = OpIMul %int %int_2 %102 + OpBranch %101 + %106 = OpLabel + %169 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %170 = OpLoad %float %169 + %171 = OpConvertFToS %int %170 + %172 = OpSLessThan %bool %171 %int_30 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %175 + %174 = OpLabel + %176 = OpAccessChain %_ptr_Function_int %data %int_0 + %177 = OpLoad %int %176 + %178 = OpConvertSToF %float %177 + %179 = OpFMul %float %178 %float_0_100000001 + %180 = OpFAdd %float %float_0_5 %179 + OpBranch %173 + %175 = OpLabel + %181 = OpSLessThan %bool %171 %int_60 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %184 + %183 = OpLabel + %185 = OpAccessChain %_ptr_Function_int %data %int_1 + %186 = OpLoad %int %185 + %187 = OpConvertSToF %float %186 + %188 = OpFMul %float %187 %float_0_100000001 + %189 = OpFAdd %float %float_0_5 %188 + OpBranch %182 + %184 = OpLabel + %190 = OpSLessThan %bool %171 %int_90 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %193 + %192 = OpLabel + %194 = OpAccessChain %_ptr_Function_int %data %int_2 + %195 = OpLoad %int %194 + %196 = OpConvertSToF %float %195 + %197 = OpFMul %float %196 %float_0_100000001 + %198 = OpFAdd %float %float_0_5 %197 + OpBranch %191 + %193 = OpLabel + %199 = OpSLessThan %bool %171 %int_120 + OpSelectionMerge %200 None + OpBranchConditional %199 %201 %202 + %201 = OpLabel + %203 = OpAccessChain %_ptr_Function_int %data %int_3 + %204 = OpLoad %int %203 + %205 = OpConvertSToF %float %204 + %206 = OpFMul %float %205 %float_0_100000001 + %207 = OpFAdd %float %float_0_5 %206 + OpBranch %200 + %202 = OpLabel + %208 = OpSLessThan %bool %171 %int_150 + OpSelectionMerge %209 None + OpBranchConditional %208 %210 %211 + %210 = OpLabel + OpKill + %211 = OpLabel + %212 = OpSLessThan %bool %171 %int_180 + OpSelectionMerge %213 None + OpBranchConditional %212 %214 %215 + %214 = OpLabel + %216 = OpAccessChain %_ptr_Function_int %data %int_5 + %217 = OpLoad %int %216 + %218 = OpConvertSToF %float %217 + %219 = OpFMul %float %218 %float_0_100000001 + %220 = OpFAdd %float %float_0_5 %219 + OpBranch %213 + %215 = OpLabel + %221 = OpSLessThan %bool %171 %int_210 + OpSelectionMerge %222 None + OpBranchConditional %221 %223 %224 + %223 = OpLabel + %225 = OpAccessChain %_ptr_Function_int %data %int_6 + %226 = OpLoad %int %225 + %227 = OpConvertSToF %float %226 + %228 = OpFMul %float %227 %float_0_100000001 + %229 = OpFAdd %float %float_0_5 %228 + OpBranch %222 + %224 = OpLabel + %230 = OpSLessThan %bool %171 %int_240 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %233 + %232 = OpLabel + %234 = OpAccessChain %_ptr_Function_int %data %int_7 + %235 = OpLoad %int %234 + %236 = OpConvertSToF %float %235 + %237 = OpFMul %float %236 %float_0_100000001 + %238 = OpFAdd %float %float_0_5 %237 + OpBranch %231 + %233 = OpLabel + %239 = OpSLessThan %bool %171 %int_270 + OpSelectionMerge %240 None + OpBranchConditional %239 %240 %241 + %240 = OpLabel + %242 = OpAccessChain %_ptr_Function_int %data %int_8 + %243 = OpLoad %int %242 + %244 = OpConvertSToF %float %243 + %245 = OpFMul %float %244 %float_0_100000001 + %246 = OpFAdd %float %float_0_5 %245 + OpBranch %231 + %241 = OpLabel + OpKill + %231 = OpLabel + %247 = OpPhi %float %238 %232 %246 %240 + OpBranch %222 + %222 = OpLabel + %248 = OpPhi %float %229 %223 %247 %231 + OpBranch %213 + %213 = OpLabel + %249 = OpPhi %float %220 %214 %248 %222 + %250 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %251 = OpLoad %float %250 + %252 = OpFOrdGreaterThan %bool %62 %251 + OpSelectionMerge %253 None + OpBranchConditional %252 %254 %253 + %254 = OpLabel + OpStore %_GLF_color %54 + OpBranch %253 + %253 = OpLabel + OpBranch %255 + %255 = OpLabel + %256 = OpPhi %v2float %55 %253 %257 %258 + %259 = OpPhi %int %int_0 %253 %260 %258 + %261 = OpSLessThanEqual %bool %259 %int_32 + OpLoopMerge %262 %258 None + OpBranchConditional %261 %263 %262 + %263 = OpLabel + %264 = OpCompositeExtract %float %256 0 + %265 = OpFOrdLessThan %bool %264 %float_0 + OpSelectionMerge %266 None + OpBranchConditional %265 %267 %266 + %267 = OpLabel + OpSelectionMerge %268 None + OpBranchConditional %252 %269 %268 + %269 = OpLabel + OpKill + %268 = OpLabel + %270 = OpCompositeExtract %float %256 1 + %271 = OpFAdd %float %270 %float_1 + %272 = OpCompositeInsert %v2float %271 %256 1 + OpBranch %266 + %266 = OpLabel + %273 = OpPhi %v2float %256 %263 %272 %268 + %274 = OpCompositeExtract %float %273 1 + %275 = OpCompositeExtract %float %273 0 + %276 = OpFAdd %float %275 %274 + %257 = OpCompositeInsert %v2float %276 %273 0 + OpBranch %258 + %258 = OpLabel + %260 = OpIAdd %int %259 %int_1 + OpBranch %255 + %262 = OpLabel + OpBranch %209 + %209 = OpLabel + OpBranch %200 + %200 = OpLabel + %277 = OpPhi %float %207 %201 %249 %209 + OpBranch %191 + %191 = OpLabel + %278 = OpPhi %float %198 %192 %277 %200 + OpBranch %182 + %182 = OpLabel + %279 = OpPhi %float %189 %183 %278 %191 + OpBranch %173 + %173 = OpLabel + %280 = OpPhi %float %180 %174 %279 %182 + %281 = OpCompositeConstruct %v4float %280 %280 %280 %float_1 + OpStore %_GLF_color %281 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..d8b974e41b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.hlsl @@ -0,0 +1,357 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int temp[10] = (int[10])0; + int data[10] = (int[10])0; + float x_180 = 0.0f; + float x_279 = 0.0f; + int x_65_phi = 0; + int x_93_phi = 0; + int x_102_phi = 0; + float x_280_phi = 0.0f; + const float x_62 = asfloat(x_8[0].x); + const int x_63 = int(x_62); + x_65_phi = x_63; + while (true) { + const int x_65 = x_65_phi; + switch(x_65) { + case 9: { + data[x_65] = -5; + break; + } + case 8: { + data[x_65] = -4; + break; + } + case 7: { + data[x_65] = -3; + break; + } + case 6: { + data[x_65] = -2; + break; + } + case 5: { + data[x_65] = -1; + break; + } + case 4: { + data[x_65] = 0; + break; + } + case 3: { + data[x_65] = 1; + break; + } + case 2: { + data[x_65] = 2; + break; + } + case 1: { + data[x_65] = 3; + break; + } + case 0: { + data[x_65] = 4; + break; + } + default: { + break; + } + } + const int x_66 = (x_65 + 1); + { + x_65_phi = x_66; + if ((x_66 < 10)) { + } else { + break; + } + } + } + x_93_phi = 0; + while (true) { + int x_94 = 0; + const int x_93 = x_93_phi; + if ((x_93 < 10)) { + } else { + break; + } + { + const int x_99 = data[x_93]; + temp[x_93] = x_99; + x_94 = (x_93 + 1); + x_93_phi = x_94; + } + } + x_102_phi = 1; + while (true) { + int x_103 = 0; + int x_109_phi = 0; + const int x_102 = x_102_phi; + if ((x_102 <= 9)) { + } else { + break; + } + x_109_phi = 0; + while (true) { + int x_121 = 0; + int x_126 = 0; + int x_121_phi = 0; + int x_124_phi = 0; + int x_126_phi = 0; + int x_148_phi = 0; + int x_151_phi = 0; + int x_161_phi = 0; + const int x_109 = x_109_phi; + if ((x_109 < 9)) { + } else { + break; + } + const int x_115 = (x_109 + x_102); + const int x_116 = (x_115 - 1); + const int x_110 = (x_109 + (2 * x_102)); + const int x_119 = min((x_110 - 1), 9); + x_121_phi = x_109; + x_124_phi = x_115; + x_126_phi = x_109; + while (true) { + int x_141 = 0; + int x_144 = 0; + int x_125_phi = 0; + int x_127_phi = 0; + x_121 = x_121_phi; + const int x_124 = x_124_phi; + x_126 = x_126_phi; + bool tint_tmp = (x_126 <= x_116); + if (tint_tmp) { + tint_tmp = (x_124 <= x_119); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_133_save = x_126; + const int x_134 = data[x_133_save]; + const int x_135_save = x_124; + const int x_136 = data[x_135_save]; + const int x_122 = asint((x_121 + asint(1))); + if ((x_134 < x_136)) { + x_141 = asint((x_126 + asint(1))); + const int x_142 = data[x_133_save]; + temp[x_121] = x_142; + x_125_phi = x_124; + x_127_phi = x_141; + } else { + x_144 = (x_124 + 1); + const int x_145 = data[x_135_save]; + temp[x_121] = x_145; + x_125_phi = x_144; + x_127_phi = x_126; + } + const int x_125 = x_125_phi; + const int x_127 = x_127_phi; + { + x_121_phi = x_122; + x_124_phi = x_125; + x_126_phi = x_127; + } + } + x_148_phi = x_121; + x_151_phi = x_126; + while (true) { + int x_149 = 0; + int x_152 = 0; + const int x_148 = x_148_phi; + const int x_151 = x_151_phi; + bool tint_tmp_1 = (x_151 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_151 <= x_116); + } + if ((tint_tmp_1)) { + } else { + break; + } + { + x_149 = (x_148 + 1); + x_152 = (x_151 + 1); + const int x_158 = data[x_151]; + temp[x_148] = x_158; + x_148_phi = x_149; + x_151_phi = x_152; + } + } + x_161_phi = x_109; + while (true) { + int x_162 = 0; + const int x_161 = x_161_phi; + if ((x_161 <= x_119)) { + } else { + break; + } + { + const int x_167 = temp[x_161]; + data[x_161] = x_167; + x_162 = (x_161 + 1); + x_161_phi = x_162; + } + } + { + x_109_phi = x_110; + } + } + { + x_103 = (2 * x_102); + x_102_phi = x_103; + } + } + int x_171 = 0; + float x_189 = 0.0f; + float x_278 = 0.0f; + float x_279_phi = 0.0f; + const float x_170 = gl_FragCoord.y; + x_171 = int(x_170); + if ((x_171 < 30)) { + const int x_177 = data[0]; + x_180 = (0.5f + (float(x_177) * 0.100000001f)); + x_280_phi = x_180; + } else { + float x_198 = 0.0f; + float x_277 = 0.0f; + float x_278_phi = 0.0f; + if ((x_171 < 60)) { + const int x_186 = data[1]; + x_189 = (0.5f + (float(x_186) * 0.100000001f)); + x_279_phi = x_189; + } else { + float x_207 = 0.0f; + float x_249 = 0.0f; + float x_277_phi = 0.0f; + if ((x_171 < 90)) { + const int x_195 = data[2]; + x_198 = (0.5f + (float(x_195) * 0.100000001f)); + x_278_phi = x_198; + } else { + if ((x_171 < 120)) { + const int x_204 = data[3]; + x_207 = (0.5f + (float(x_204) * 0.100000001f)); + x_277_phi = x_207; + } else { + float x_220 = 0.0f; + float x_248 = 0.0f; + float x_249_phi = 0.0f; + float2 x_256_phi = float2(0.0f, 0.0f); + int x_259_phi = 0; + if ((x_171 < 150)) { + discard; + } else { + float x_229 = 0.0f; + float x_247 = 0.0f; + float x_248_phi = 0.0f; + if ((x_171 < 180)) { + const int x_217 = data[5]; + x_220 = (0.5f + (float(x_217) * 0.100000001f)); + x_249_phi = x_220; + } else { + float x_238 = 0.0f; + float x_246 = 0.0f; + float x_247_phi = 0.0f; + if ((x_171 < 210)) { + const int x_226 = data[6]; + x_229 = (0.5f + (float(x_226) * 0.100000001f)); + x_248_phi = x_229; + } else { + if ((x_171 < 240)) { + const int x_235 = data[7]; + x_238 = (0.5f + (float(x_235) * 0.100000001f)); + x_247_phi = x_238; + } else { + if ((x_171 < 270)) { + } else { + discard; + } + const int x_243 = data[8]; + x_246 = (0.5f + (float(x_243) * 0.100000001f)); + x_247_phi = x_246; + } + x_247 = x_247_phi; + x_248_phi = x_247; + } + x_248 = x_248_phi; + x_249_phi = x_248; + } + x_249 = x_249_phi; + const float x_251 = asfloat(x_8[0].y); + const bool x_252 = (x_62 > x_251); + if (x_252) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + x_256_phi = float2(1.0f, 1.0f); + x_259_phi = 0; + while (true) { + float2 x_272 = float2(0.0f, 0.0f); + int x_260 = 0; + float2 x_273_phi = float2(0.0f, 0.0f); + const float2 x_256 = x_256_phi; + const int x_259 = x_259_phi; + if ((x_259 <= 32)) { + } else { + break; + } + x_273_phi = x_256; + if ((x_256.x < 0.0f)) { + if (x_252) { + discard; + } + x_272 = x_256; + x_272.y = (x_256.y + 1.0f); + x_273_phi = x_272; + } + const float2 x_273 = x_273_phi; + float2 x_257_1 = x_273; + x_257_1.x = (x_273.x + x_273.y); + const float2 x_257 = x_257_1; + { + x_260 = (x_259 + 1); + x_256_phi = x_257; + x_259_phi = x_260; + } + } + } + x_277_phi = x_249; + } + x_277 = x_277_phi; + x_278_phi = x_277; + } + x_278 = x_278_phi; + x_279_phi = x_278; + } + x_279 = x_279_phi; + x_280_phi = x_279; + } + const float x_280 = x_280_phi; + x_GLF_color = float4(x_280, x_280, x_280, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.msl new file mode 100644 index 0000000000..ae3ef06377 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.msl @@ -0,0 +1,351 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + tint_array_wrapper temp = {}; + tint_array_wrapper data = {}; + float x_180 = 0.0f; + float x_279 = 0.0f; + int x_65_phi = 0; + int x_93_phi = 0; + int x_102_phi = 0; + float x_280_phi = 0.0f; + float const x_62 = x_8.injectionSwitch.x; + int const x_63 = int(x_62); + x_65_phi = x_63; + while (true) { + int const x_65 = x_65_phi; + switch(x_65) { + case 9: { + data.arr[x_65] = -5; + break; + } + case 8: { + data.arr[x_65] = -4; + break; + } + case 7: { + data.arr[x_65] = -3; + break; + } + case 6: { + data.arr[x_65] = -2; + break; + } + case 5: { + data.arr[x_65] = -1; + break; + } + case 4: { + data.arr[x_65] = 0; + break; + } + case 3: { + data.arr[x_65] = 1; + break; + } + case 2: { + data.arr[x_65] = 2; + break; + } + case 1: { + data.arr[x_65] = 3; + break; + } + case 0: { + data.arr[x_65] = 4; + break; + } + default: { + break; + } + } + int const x_66 = (x_65 + 1); + { + x_65_phi = x_66; + if ((x_66 < 10)) { + } else { + break; + } + } + } + x_93_phi = 0; + while (true) { + int x_94 = 0; + int const x_93 = x_93_phi; + if ((x_93 < 10)) { + } else { + break; + } + { + int const x_99 = data.arr[x_93]; + temp.arr[x_93] = x_99; + x_94 = (x_93 + 1); + x_93_phi = x_94; + } + } + x_102_phi = 1; + while (true) { + int x_103 = 0; + int x_109_phi = 0; + int const x_102 = x_102_phi; + if ((x_102 <= 9)) { + } else { + break; + } + x_109_phi = 0; + while (true) { + int x_121 = 0; + int x_126 = 0; + int x_121_phi = 0; + int x_124_phi = 0; + int x_126_phi = 0; + int x_148_phi = 0; + int x_151_phi = 0; + int x_161_phi = 0; + int const x_109 = x_109_phi; + if ((x_109 < 9)) { + } else { + break; + } + int const x_115 = (x_109 + x_102); + int const x_116 = (x_115 - 1); + int const x_110 = (x_109 + (2 * x_102)); + int const x_119 = min((x_110 - 1), 9); + x_121_phi = x_109; + x_124_phi = x_115; + x_126_phi = x_109; + while (true) { + int x_141 = 0; + int x_144 = 0; + int x_125_phi = 0; + int x_127_phi = 0; + x_121 = x_121_phi; + int const x_124 = x_124_phi; + x_126 = x_126_phi; + if (((x_126 <= x_116) && (x_124 <= x_119))) { + } else { + break; + } + int const x_133_save = x_126; + int const x_134 = data.arr[x_133_save]; + int const x_135_save = x_124; + int const x_136 = data.arr[x_135_save]; + int const x_122 = as_type((x_121 + as_type(1))); + if ((x_134 < x_136)) { + x_141 = as_type((x_126 + as_type(1))); + int const x_142 = data.arr[x_133_save]; + temp.arr[x_121] = x_142; + x_125_phi = x_124; + x_127_phi = x_141; + } else { + x_144 = (x_124 + 1); + int const x_145 = data.arr[x_135_save]; + temp.arr[x_121] = x_145; + x_125_phi = x_144; + x_127_phi = x_126; + } + int const x_125 = x_125_phi; + int const x_127 = x_127_phi; + { + x_121_phi = x_122; + x_124_phi = x_125; + x_126_phi = x_127; + } + } + x_148_phi = x_121; + x_151_phi = x_126; + while (true) { + int x_149 = 0; + int x_152 = 0; + int const x_148 = x_148_phi; + int const x_151 = x_151_phi; + if (((x_151 < 10) && (x_151 <= x_116))) { + } else { + break; + } + { + x_149 = (x_148 + 1); + x_152 = (x_151 + 1); + int const x_158 = data.arr[x_151]; + temp.arr[x_148] = x_158; + x_148_phi = x_149; + x_151_phi = x_152; + } + } + x_161_phi = x_109; + while (true) { + int x_162 = 0; + int const x_161 = x_161_phi; + if ((x_161 <= x_119)) { + } else { + break; + } + { + int const x_167 = temp.arr[x_161]; + data.arr[x_161] = x_167; + x_162 = (x_161 + 1); + x_161_phi = x_162; + } + } + { + x_109_phi = x_110; + } + } + { + x_103 = (2 * x_102); + x_102_phi = x_103; + } + } + int x_171 = 0; + float x_189 = 0.0f; + float x_278 = 0.0f; + float x_279_phi = 0.0f; + float const x_170 = (*(tint_symbol_5)).y; + x_171 = int(x_170); + if ((x_171 < 30)) { + int const x_177 = data.arr[0]; + x_180 = (0.5f + (float(x_177) * 0.100000001f)); + x_280_phi = x_180; + } else { + float x_198 = 0.0f; + float x_277 = 0.0f; + float x_278_phi = 0.0f; + if ((x_171 < 60)) { + int const x_186 = data.arr[1]; + x_189 = (0.5f + (float(x_186) * 0.100000001f)); + x_279_phi = x_189; + } else { + float x_207 = 0.0f; + float x_249 = 0.0f; + float x_277_phi = 0.0f; + if ((x_171 < 90)) { + int const x_195 = data.arr[2]; + x_198 = (0.5f + (float(x_195) * 0.100000001f)); + x_278_phi = x_198; + } else { + if ((x_171 < 120)) { + int const x_204 = data.arr[3]; + x_207 = (0.5f + (float(x_204) * 0.100000001f)); + x_277_phi = x_207; + } else { + float x_220 = 0.0f; + float x_248 = 0.0f; + float x_249_phi = 0.0f; + float2 x_256_phi = 0.0f; + int x_259_phi = 0; + if ((x_171 < 150)) { + discard_fragment(); + } else { + float x_229 = 0.0f; + float x_247 = 0.0f; + float x_248_phi = 0.0f; + if ((x_171 < 180)) { + int const x_217 = data.arr[5]; + x_220 = (0.5f + (float(x_217) * 0.100000001f)); + x_249_phi = x_220; + } else { + float x_238 = 0.0f; + float x_246 = 0.0f; + float x_247_phi = 0.0f; + if ((x_171 < 210)) { + int const x_226 = data.arr[6]; + x_229 = (0.5f + (float(x_226) * 0.100000001f)); + x_248_phi = x_229; + } else { + if ((x_171 < 240)) { + int const x_235 = data.arr[7]; + x_238 = (0.5f + (float(x_235) * 0.100000001f)); + x_247_phi = x_238; + } else { + if ((x_171 < 270)) { + } else { + discard_fragment(); + } + int const x_243 = data.arr[8]; + x_246 = (0.5f + (float(x_243) * 0.100000001f)); + x_247_phi = x_246; + } + x_247 = x_247_phi; + x_248_phi = x_247; + } + x_248 = x_248_phi; + x_249_phi = x_248; + } + x_249 = x_249_phi; + float const x_251 = x_8.injectionSwitch.y; + bool const x_252 = (x_62 > x_251); + if (x_252) { + *(tint_symbol_6) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + x_256_phi = float2(1.0f, 1.0f); + x_259_phi = 0; + while (true) { + float2 x_272 = 0.0f; + int x_260 = 0; + float2 x_273_phi = 0.0f; + float2 const x_256 = x_256_phi; + int const x_259 = x_259_phi; + if ((x_259 <= 32)) { + } else { + break; + } + x_273_phi = x_256; + if ((x_256.x < 0.0f)) { + if (x_252) { + discard_fragment(); + } + x_272 = x_256; + x_272.y = (x_256.y + 1.0f); + x_273_phi = x_272; + } + float2 const x_273 = x_273_phi; + float2 x_257_1 = x_273; + x_257_1.x = (x_273.x + x_273.y); + float2 const x_257 = x_257_1; + { + x_260 = (x_259 + 1); + x_256_phi = x_257; + x_259_phi = x_260; + } + } + } + x_277_phi = x_249; + } + x_277 = x_277_phi; + x_278_phi = x_277; + } + x_278 = x_278_phi; + x_279_phi = x_278; + } + x_279 = x_279_phi; + x_280_phi = x_279; + } + float const x_280 = x_280_phi; + *(tint_symbol_6) = float4(x_280, x_280, x_280, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..9831f2b713 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.spvasm @@ -0,0 +1,759 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 435 +; Schema: 0 + OpCapability Shader + %135 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %temp "temp" + OpName %data "data" + OpName %x_180 "x_180" + OpName %x_279 "x_279" + OpName %x_65_phi "x_65_phi" + OpName %x_93_phi "x_93_phi" + OpName %x_102_phi "x_102_phi" + OpName %x_280_phi "x_280_phi" + OpName %x_94 "x_94" + OpName %x_103 "x_103" + OpName %x_109_phi "x_109_phi" + OpName %x_121 "x_121" + OpName %x_126 "x_126" + OpName %x_121_phi "x_121_phi" + OpName %x_124_phi "x_124_phi" + OpName %x_126_phi "x_126_phi" + OpName %x_148_phi "x_148_phi" + OpName %x_151_phi "x_151_phi" + OpName %x_161_phi "x_161_phi" + OpName %x_141 "x_141" + OpName %x_144 "x_144" + OpName %x_125_phi "x_125_phi" + OpName %x_127_phi "x_127_phi" + OpName %x_149 "x_149" + OpName %x_152 "x_152" + OpName %x_162 "x_162" + OpName %x_171 "x_171" + OpName %x_189 "x_189" + OpName %x_278 "x_278" + OpName %x_279_phi "x_279_phi" + OpName %x_198 "x_198" + OpName %x_277 "x_277" + OpName %x_278_phi "x_278_phi" + OpName %x_207 "x_207" + OpName %x_249 "x_249" + OpName %x_277_phi "x_277_phi" + OpName %x_220 "x_220" + OpName %x_248 "x_248" + OpName %x_249_phi "x_249_phi" + OpName %x_256_phi "x_256_phi" + OpName %x_259_phi "x_259_phi" + OpName %x_229 "x_229" + OpName %x_247 "x_247" + OpName %x_248_phi "x_248_phi" + OpName %x_238 "x_238" + OpName %x_246 "x_246" + OpName %x_247_phi "x_247_phi" + OpName %x_272 "x_272" + OpName %x_260 "x_260" + OpName %x_273_phi "x_273_phi" + OpName %x_257_1 "x_257_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %25 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 +%float_0_100000001 = OpConstant %float 0.100000001 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %300 = OpConstantNull %v2float + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %float_1 = OpConstant %float 1 + %377 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %378 = OpConstantComposite %v2float %float_1 %float_1 + %int_32 = OpConstant %int 32 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %422 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %temp = OpVariable %_ptr_Function__arr_int_uint_10 Function %25 + %data = OpVariable %_ptr_Function__arr_int_uint_10 Function %25 + %x_180 = OpVariable %_ptr_Function_float Function %29 + %x_279 = OpVariable %_ptr_Function_float Function %29 + %x_65_phi = OpVariable %_ptr_Function_int Function %33 + %x_93_phi = OpVariable %_ptr_Function_int Function %33 + %x_102_phi = OpVariable %_ptr_Function_int Function %33 + %x_280_phi = OpVariable %_ptr_Function_float Function %29 + %x_94 = OpVariable %_ptr_Function_int Function %33 + %x_103 = OpVariable %_ptr_Function_int Function %33 + %x_109_phi = OpVariable %_ptr_Function_int Function %33 + %x_121 = OpVariable %_ptr_Function_int Function %33 + %x_126 = OpVariable %_ptr_Function_int Function %33 + %x_121_phi = OpVariable %_ptr_Function_int Function %33 + %x_124_phi = OpVariable %_ptr_Function_int Function %33 + %x_126_phi = OpVariable %_ptr_Function_int Function %33 + %x_148_phi = OpVariable %_ptr_Function_int Function %33 + %x_151_phi = OpVariable %_ptr_Function_int Function %33 + %x_161_phi = OpVariable %_ptr_Function_int Function %33 + %x_141 = OpVariable %_ptr_Function_int Function %33 + %x_144 = OpVariable %_ptr_Function_int Function %33 + %x_125_phi = OpVariable %_ptr_Function_int Function %33 + %x_127_phi = OpVariable %_ptr_Function_int Function %33 + %x_149 = OpVariable %_ptr_Function_int Function %33 + %x_152 = OpVariable %_ptr_Function_int Function %33 + %x_162 = OpVariable %_ptr_Function_int Function %33 + %x_171 = OpVariable %_ptr_Function_int Function %33 + %x_189 = OpVariable %_ptr_Function_float Function %29 + %x_278 = OpVariable %_ptr_Function_float Function %29 + %x_279_phi = OpVariable %_ptr_Function_float Function %29 + %x_198 = OpVariable %_ptr_Function_float Function %29 + %x_277 = OpVariable %_ptr_Function_float Function %29 + %x_278_phi = OpVariable %_ptr_Function_float Function %29 + %x_207 = OpVariable %_ptr_Function_float Function %29 + %x_249 = OpVariable %_ptr_Function_float Function %29 + %x_277_phi = OpVariable %_ptr_Function_float Function %29 + %x_220 = OpVariable %_ptr_Function_float Function %29 + %x_248 = OpVariable %_ptr_Function_float Function %29 + %x_249_phi = OpVariable %_ptr_Function_float Function %29 + %x_256_phi = OpVariable %_ptr_Function_v2float Function %300 + %x_259_phi = OpVariable %_ptr_Function_int Function %33 + %x_229 = OpVariable %_ptr_Function_float Function %29 + %x_247 = OpVariable %_ptr_Function_float Function %29 + %x_248_phi = OpVariable %_ptr_Function_float Function %29 + %x_238 = OpVariable %_ptr_Function_float Function %29 + %x_246 = OpVariable %_ptr_Function_float Function %29 + %x_247_phi = OpVariable %_ptr_Function_float Function %29 + %x_272 = OpVariable %_ptr_Function_v2float Function %300 + %x_260 = OpVariable %_ptr_Function_int Function %33 + %x_273_phi = OpVariable %_ptr_Function_v2float Function %300 + %x_257_1 = OpVariable %_ptr_Function_v2float Function %300 + %39 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %40 = OpLoad %float %39 + %41 = OpConvertFToS %int %40 + OpStore %x_65_phi %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %int %x_65_phi + OpSelectionMerge %47 None + OpSwitch %46 %48 9 %49 8 %50 7 %51 6 %52 5 %53 4 %54 3 %55 2 %56 1 %57 0 %58 + %49 = OpLabel + %59 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %59 %int_n5 + OpBranch %47 + %50 = OpLabel + %61 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %61 %int_n4 + OpBranch %47 + %51 = OpLabel + %63 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %63 %int_n3 + OpBranch %47 + %52 = OpLabel + %65 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %65 %int_n2 + OpBranch %47 + %53 = OpLabel + %67 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %67 %int_n1 + OpBranch %47 + %54 = OpLabel + %69 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %69 %int_0 + OpBranch %47 + %55 = OpLabel + %71 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %71 %int_1 + OpBranch %47 + %56 = OpLabel + %73 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %73 %int_2 + OpBranch %47 + %57 = OpLabel + %75 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %75 %int_3 + OpBranch %47 + %58 = OpLabel + %77 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %77 %int_4 + OpBranch %47 + %48 = OpLabel + OpBranch %47 + %47 = OpLabel + %79 = OpIAdd %int %46 %int_1 + OpBranch %44 + %44 = OpLabel + OpStore %x_65_phi %79 + %81 = OpSLessThan %bool %79 %int_10 + OpSelectionMerge %83 None + OpBranchConditional %81 %84 %85 + %84 = OpLabel + OpBranch %83 + %85 = OpLabel + OpBranch %43 + %83 = OpLabel + OpBranch %42 + %43 = OpLabel + OpStore %x_93_phi %int_0 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %87 %88 None + OpBranch %89 + %89 = OpLabel + %91 = OpLoad %int %x_93_phi + %92 = OpSLessThan %bool %91 %int_10 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + OpBranch %93 + %95 = OpLabel + OpBranch %87 + %93 = OpLabel + OpBranch %88 + %88 = OpLabel + %96 = OpAccessChain %_ptr_Function_int %data %91 + %97 = OpLoad %int %96 + %98 = OpAccessChain %_ptr_Function_int %temp %91 + OpStore %98 %97 + %99 = OpIAdd %int %91 %int_1 + OpStore %x_94 %99 + %100 = OpLoad %int %x_94 + OpStore %x_93_phi %100 + OpBranch %86 + %87 = OpLabel + OpStore %x_102_phi %int_1 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %102 %103 None + OpBranch %104 + %104 = OpLabel + %107 = OpLoad %int %x_102_phi + %109 = OpSLessThanEqual %bool %107 %int_9 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %112 + %111 = OpLabel + OpBranch %110 + %112 = OpLabel + OpBranch %102 + %110 = OpLabel + OpStore %x_109_phi %int_0 + OpBranch %113 + %113 = OpLabel + OpLoopMerge %114 %115 None + OpBranch %116 + %116 = OpLabel + %125 = OpLoad %int %x_109_phi + %126 = OpSLessThan %bool %125 %int_9 + OpSelectionMerge %127 None + OpBranchConditional %126 %128 %129 + %128 = OpLabel + OpBranch %127 + %129 = OpLabel + OpBranch %114 + %127 = OpLabel + %130 = OpIAdd %int %125 %107 + %131 = OpISub %int %130 %int_1 + %132 = OpIMul %int %int_2 %107 + %133 = OpIAdd %int %125 %132 + %136 = OpISub %int %133 %int_1 + %134 = OpExtInst %int %135 SMin %136 %int_9 + OpStore %x_121_phi %125 + OpStore %x_124_phi %130 + OpStore %x_126_phi %125 + OpBranch %137 + %137 = OpLabel + OpLoopMerge %138 %139 None + OpBranch %140 + %140 = OpLabel + %145 = OpLoad %int %x_121_phi + OpStore %x_121 %145 + %146 = OpLoad %int %x_124_phi + %147 = OpLoad %int %x_126_phi + OpStore %x_126 %147 + %148 = OpLoad %int %x_126 + %149 = OpSLessThanEqual %bool %148 %131 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %150 + %151 = OpLabel + %152 = OpSLessThanEqual %bool %146 %134 + OpBranch %150 + %150 = OpLabel + %153 = OpPhi %bool %149 %140 %152 %151 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + OpBranch %154 + %156 = OpLabel + OpBranch %138 + %154 = OpLabel + %157 = OpLoad %int %x_126 + %158 = OpAccessChain %_ptr_Function_int %data %157 + %159 = OpLoad %int %158 + %160 = OpAccessChain %_ptr_Function_int %data %146 + %161 = OpLoad %int %160 + %163 = OpLoad %int %x_121 + %164 = OpCopyObject %int %int_1 + %165 = OpIAdd %int %163 %164 + %162 = OpCopyObject %int %165 + %166 = OpSLessThan %bool %159 %161 + OpSelectionMerge %167 None + OpBranchConditional %166 %168 %169 + %168 = OpLabel + %171 = OpLoad %int %x_126 + %172 = OpCopyObject %int %int_1 + %173 = OpIAdd %int %171 %172 + %170 = OpCopyObject %int %173 + OpStore %x_141 %170 + %174 = OpAccessChain %_ptr_Function_int %data %157 + %175 = OpLoad %int %174 + %176 = OpLoad %int %x_121 + %177 = OpAccessChain %_ptr_Function_int %temp %176 + OpStore %177 %175 + OpStore %x_125_phi %146 + %178 = OpLoad %int %x_141 + OpStore %x_127_phi %178 + OpBranch %167 + %169 = OpLabel + %179 = OpIAdd %int %146 %int_1 + OpStore %x_144 %179 + %180 = OpAccessChain %_ptr_Function_int %data %146 + %181 = OpLoad %int %180 + %182 = OpLoad %int %x_121 + %183 = OpAccessChain %_ptr_Function_int %temp %182 + OpStore %183 %181 + %184 = OpLoad %int %x_144 + OpStore %x_125_phi %184 + %185 = OpLoad %int %x_126 + OpStore %x_127_phi %185 + OpBranch %167 + %167 = OpLabel + %186 = OpLoad %int %x_125_phi + %187 = OpLoad %int %x_127_phi + OpBranch %139 + %139 = OpLabel + OpStore %x_121_phi %162 + OpStore %x_124_phi %186 + OpStore %x_126_phi %187 + OpBranch %137 + %138 = OpLabel + %188 = OpLoad %int %x_121 + OpStore %x_148_phi %188 + %189 = OpLoad %int %x_126 + OpStore %x_151_phi %189 + OpBranch %190 + %190 = OpLabel + OpLoopMerge %191 %192 None + OpBranch %193 + %193 = OpLabel + %196 = OpLoad %int %x_148_phi + %197 = OpLoad %int %x_151_phi + %198 = OpSLessThan %bool %197 %int_10 + OpSelectionMerge %199 None + OpBranchConditional %198 %200 %199 + %200 = OpLabel + %201 = OpSLessThanEqual %bool %197 %131 + OpBranch %199 + %199 = OpLabel + %202 = OpPhi %bool %198 %193 %201 %200 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %205 + %204 = OpLabel + OpBranch %203 + %205 = OpLabel + OpBranch %191 + %203 = OpLabel + OpBranch %192 + %192 = OpLabel + %206 = OpIAdd %int %196 %int_1 + OpStore %x_149 %206 + %207 = OpIAdd %int %197 %int_1 + OpStore %x_152 %207 + %208 = OpAccessChain %_ptr_Function_int %data %197 + %209 = OpLoad %int %208 + %210 = OpAccessChain %_ptr_Function_int %temp %196 + OpStore %210 %209 + %211 = OpLoad %int %x_149 + OpStore %x_148_phi %211 + %212 = OpLoad %int %x_152 + OpStore %x_151_phi %212 + OpBranch %190 + %191 = OpLabel + OpStore %x_161_phi %125 + OpBranch %213 + %213 = OpLabel + OpLoopMerge %214 %215 None + OpBranch %216 + %216 = OpLabel + %218 = OpLoad %int %x_161_phi + %219 = OpSLessThanEqual %bool %218 %134 + OpSelectionMerge %220 None + OpBranchConditional %219 %221 %222 + %221 = OpLabel + OpBranch %220 + %222 = OpLabel + OpBranch %214 + %220 = OpLabel + OpBranch %215 + %215 = OpLabel + %223 = OpAccessChain %_ptr_Function_int %temp %218 + %224 = OpLoad %int %223 + %225 = OpAccessChain %_ptr_Function_int %data %218 + OpStore %225 %224 + %226 = OpIAdd %int %218 %int_1 + OpStore %x_162 %226 + %227 = OpLoad %int %x_162 + OpStore %x_161_phi %227 + OpBranch %213 + %214 = OpLabel + OpBranch %115 + %115 = OpLabel + OpStore %x_109_phi %133 + OpBranch %113 + %114 = OpLabel + OpBranch %103 + %103 = OpLabel + %228 = OpIMul %int %int_2 %107 + OpStore %x_103 %228 + %229 = OpLoad %int %x_103 + OpStore %x_102_phi %229 + OpBranch %101 + %102 = OpLabel + %236 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %237 = OpLoad %float %236 + %238 = OpConvertFToS %int %237 + OpStore %x_171 %238 + %239 = OpLoad %int %x_171 + %241 = OpSLessThan %bool %239 %int_30 + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %244 + %243 = OpLabel + %245 = OpAccessChain %_ptr_Function_int %data %int_0 + %246 = OpLoad %int %245 + %248 = OpConvertSToF %float %246 + %250 = OpFMul %float %248 %float_0_100000001 + %251 = OpFAdd %float %float_0_5 %250 + OpStore %x_180 %251 + %252 = OpLoad %float %x_180 + OpStore %x_280_phi %252 + OpBranch %242 + %244 = OpLabel + %256 = OpLoad %int %x_171 + %258 = OpSLessThan %bool %256 %int_60 + OpSelectionMerge %259 None + OpBranchConditional %258 %260 %261 + %260 = OpLabel + %262 = OpAccessChain %_ptr_Function_int %data %int_1 + %263 = OpLoad %int %262 + %264 = OpConvertSToF %float %263 + %265 = OpFMul %float %264 %float_0_100000001 + %266 = OpFAdd %float %float_0_5 %265 + OpStore %x_189 %266 + %267 = OpLoad %float %x_189 + OpStore %x_279_phi %267 + OpBranch %259 + %261 = OpLabel + %271 = OpLoad %int %x_171 + %273 = OpSLessThan %bool %271 %int_90 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %276 + %275 = OpLabel + %277 = OpAccessChain %_ptr_Function_int %data %int_2 + %278 = OpLoad %int %277 + %279 = OpConvertSToF %float %278 + %280 = OpFMul %float %279 %float_0_100000001 + %281 = OpFAdd %float %float_0_5 %280 + OpStore %x_198 %281 + %282 = OpLoad %float %x_198 + OpStore %x_278_phi %282 + OpBranch %274 + %276 = OpLabel + %283 = OpLoad %int %x_171 + %285 = OpSLessThan %bool %283 %int_120 + OpSelectionMerge %286 None + OpBranchConditional %285 %287 %288 + %287 = OpLabel + %289 = OpAccessChain %_ptr_Function_int %data %int_3 + %290 = OpLoad %int %289 + %291 = OpConvertSToF %float %290 + %292 = OpFMul %float %291 %float_0_100000001 + %293 = OpFAdd %float %float_0_5 %292 + OpStore %x_207 %293 + %294 = OpLoad %float %x_207 + OpStore %x_277_phi %294 + OpBranch %286 + %288 = OpLabel + %302 = OpLoad %int %x_171 + %304 = OpSLessThan %bool %302 %int_150 + OpSelectionMerge %305 None + OpBranchConditional %304 %306 %307 + %306 = OpLabel + OpKill + %307 = OpLabel + %311 = OpLoad %int %x_171 + %313 = OpSLessThan %bool %311 %int_180 + OpSelectionMerge %314 None + OpBranchConditional %313 %315 %316 + %315 = OpLabel + %318 = OpAccessChain %_ptr_Function_int %data %int_5 + %319 = OpLoad %int %318 + %320 = OpConvertSToF %float %319 + %321 = OpFMul %float %320 %float_0_100000001 + %322 = OpFAdd %float %float_0_5 %321 + OpStore %x_220 %322 + %323 = OpLoad %float %x_220 + OpStore %x_249_phi %323 + OpBranch %314 + %316 = OpLabel + %327 = OpLoad %int %x_171 + %329 = OpSLessThan %bool %327 %int_210 + OpSelectionMerge %330 None + OpBranchConditional %329 %331 %332 + %331 = OpLabel + %334 = OpAccessChain %_ptr_Function_int %data %int_6 + %335 = OpLoad %int %334 + %336 = OpConvertSToF %float %335 + %337 = OpFMul %float %336 %float_0_100000001 + %338 = OpFAdd %float %float_0_5 %337 + OpStore %x_229 %338 + %339 = OpLoad %float %x_229 + OpStore %x_248_phi %339 + OpBranch %330 + %332 = OpLabel + %340 = OpLoad %int %x_171 + %342 = OpSLessThan %bool %340 %int_240 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %345 + %344 = OpLabel + %347 = OpAccessChain %_ptr_Function_int %data %int_7 + %348 = OpLoad %int %347 + %349 = OpConvertSToF %float %348 + %350 = OpFMul %float %349 %float_0_100000001 + %351 = OpFAdd %float %float_0_5 %350 + OpStore %x_238 %351 + %352 = OpLoad %float %x_238 + OpStore %x_247_phi %352 + OpBranch %343 + %345 = OpLabel + %353 = OpLoad %int %x_171 + %355 = OpSLessThan %bool %353 %int_270 + OpSelectionMerge %356 None + OpBranchConditional %355 %357 %358 + %357 = OpLabel + OpBranch %356 + %358 = OpLabel + OpKill + %356 = OpLabel + %360 = OpAccessChain %_ptr_Function_int %data %int_8 + %361 = OpLoad %int %360 + %362 = OpConvertSToF %float %361 + %363 = OpFMul %float %362 %float_0_100000001 + %364 = OpFAdd %float %float_0_5 %363 + OpStore %x_246 %364 + %365 = OpLoad %float %x_246 + OpStore %x_247_phi %365 + OpBranch %343 + %343 = OpLabel + %366 = OpLoad %float %x_247_phi + OpStore %x_247 %366 + %367 = OpLoad %float %x_247 + OpStore %x_248_phi %367 + OpBranch %330 + %330 = OpLabel + %368 = OpLoad %float %x_248_phi + OpStore %x_248 %368 + %369 = OpLoad %float %x_248 + OpStore %x_249_phi %369 + OpBranch %314 + %314 = OpLabel + %370 = OpLoad %float %x_249_phi + OpStore %x_249 %370 + %371 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %372 = OpLoad %float %371 + %373 = OpFOrdGreaterThan %bool %40 %372 + OpSelectionMerge %374 None + OpBranchConditional %373 %375 %374 + %375 = OpLabel + OpStore %x_GLF_color %377 + OpBranch %374 + %374 = OpLabel + OpStore %x_256_phi %378 + OpStore %x_259_phi %int_0 + OpBranch %379 + %379 = OpLabel + OpLoopMerge %380 %381 None + OpBranch %382 + %382 = OpLabel + %386 = OpLoad %v2float %x_256_phi + %387 = OpLoad %int %x_259_phi + %389 = OpSLessThanEqual %bool %387 %int_32 + OpSelectionMerge %390 None + OpBranchConditional %389 %391 %392 + %391 = OpLabel + OpBranch %390 + %392 = OpLabel + OpBranch %380 + %390 = OpLabel + OpStore %x_273_phi %386 + %393 = OpCompositeExtract %float %386 0 + %395 = OpFOrdLessThan %bool %393 %float_0 + OpSelectionMerge %396 None + OpBranchConditional %395 %397 %396 + %397 = OpLabel + OpSelectionMerge %398 None + OpBranchConditional %373 %399 %398 + %399 = OpLabel + OpKill + %398 = OpLabel + OpStore %x_272 %386 + %400 = OpAccessChain %_ptr_Function_float %x_272 %uint_1 + %401 = OpCompositeExtract %float %386 1 + %402 = OpFAdd %float %401 %float_1 + OpStore %400 %402 + %403 = OpLoad %v2float %x_272 + OpStore %x_273_phi %403 + OpBranch %396 + %396 = OpLabel + %404 = OpLoad %v2float %x_273_phi + OpStore %x_257_1 %404 + %406 = OpAccessChain %_ptr_Function_float %x_257_1 %uint_0 + %407 = OpCompositeExtract %float %404 0 + %408 = OpCompositeExtract %float %404 1 + %409 = OpFAdd %float %407 %408 + OpStore %406 %409 + %410 = OpLoad %v2float %x_257_1 + OpBranch %381 + %381 = OpLabel + %411 = OpIAdd %int %387 %int_1 + OpStore %x_260 %411 + OpStore %x_256_phi %410 + %412 = OpLoad %int %x_260 + OpStore %x_259_phi %412 + OpBranch %379 + %380 = OpLabel + OpBranch %305 + %305 = OpLabel + %413 = OpLoad %float %x_249 + OpStore %x_277_phi %413 + OpBranch %286 + %286 = OpLabel + %414 = OpLoad %float %x_277_phi + OpStore %x_277 %414 + %415 = OpLoad %float %x_277 + OpStore %x_278_phi %415 + OpBranch %274 + %274 = OpLabel + %416 = OpLoad %float %x_278_phi + OpStore %x_278 %416 + %417 = OpLoad %float %x_278 + OpStore %x_279_phi %417 + OpBranch %259 + %259 = OpLabel + %418 = OpLoad %float %x_279_phi + OpStore %x_279 %418 + %419 = OpLoad %float %x_279 + OpStore %x_280_phi %419 + OpBranch %242 + %242 = OpLabel + %420 = OpLoad %float %x_280_phi + %421 = OpCompositeConstruct %v4float %420 %420 %420 %float_1 + OpStore %x_GLF_color %421 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %422 +%tint_symbol_1 = OpFunctionParameter %main_out + %426 = OpLabel + %427 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %427 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %429 = OpLabel + %430 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %430 + %431 = OpFunctionCall %void %main_1 + %433 = OpLoad %v4float %x_GLF_color + %434 = OpCompositeConstruct %main_out %433 + %432 = OpFunctionCall %void %tint_symbol_3 %434 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 44[%44] is not post dominated by the back-edge block 83[%83] + %83 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..eb23a410aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.spvasm.expected.wgsl @@ -0,0 +1,344 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var temp : array; + var data : array; + var x_180 : f32; + var x_279 : f32; + var x_65_phi : i32; + var x_93_phi : i32; + var x_102_phi : i32; + var x_280_phi : f32; + let x_62 : f32 = x_8.injectionSwitch.x; + let x_63 : i32 = i32(x_62); + x_65_phi = x_63; + loop { + let x_65 : i32 = x_65_phi; + switch(x_65) { + case 9: { + data[x_65] = -5; + } + case 8: { + data[x_65] = -4; + } + case 7: { + data[x_65] = -3; + } + case 6: { + data[x_65] = -2; + } + case 5: { + data[x_65] = -1; + } + case 4: { + data[x_65] = 0; + } + case 3: { + data[x_65] = 1; + } + case 2: { + data[x_65] = 2; + } + case 1: { + data[x_65] = 3; + } + case 0: { + data[x_65] = 4; + } + default: { + } + } + let x_66 : i32 = (x_65 + 1); + + continuing { + x_65_phi = x_66; + if ((x_66 < 10)) { + } else { + break; + } + } + } + x_93_phi = 0; + loop { + var x_94 : i32; + let x_93 : i32 = x_93_phi; + if ((x_93 < 10)) { + } else { + break; + } + + continuing { + let x_99 : i32 = data[x_93]; + temp[x_93] = x_99; + x_94 = (x_93 + 1); + x_93_phi = x_94; + } + } + x_102_phi = 1; + loop { + var x_103 : i32; + var x_109_phi : i32; + let x_102 : i32 = x_102_phi; + if ((x_102 <= 9)) { + } else { + break; + } + x_109_phi = 0; + loop { + var x_121 : i32; + var x_126 : i32; + var x_121_phi : i32; + var x_124_phi : i32; + var x_126_phi : i32; + var x_148_phi : i32; + var x_151_phi : i32; + var x_161_phi : i32; + let x_109 : i32 = x_109_phi; + if ((x_109 < 9)) { + } else { + break; + } + let x_115 : i32 = (x_109 + x_102); + let x_116 : i32 = (x_115 - 1); + let x_110 : i32 = (x_109 + (2 * x_102)); + let x_119 : i32 = min((x_110 - 1), 9); + x_121_phi = x_109; + x_124_phi = x_115; + x_126_phi = x_109; + loop { + var x_141 : i32; + var x_144 : i32; + var x_125_phi : i32; + var x_127_phi : i32; + x_121 = x_121_phi; + let x_124 : i32 = x_124_phi; + x_126 = x_126_phi; + if (((x_126 <= x_116) && (x_124 <= x_119))) { + } else { + break; + } + let x_133 : ptr = &(data[x_126]); + let x_134 : i32 = *(x_133); + let x_135 : ptr = &(data[x_124]); + let x_136 : i32 = *(x_135); + let x_122 : i32 = bitcast((x_121 + bitcast(1))); + if ((x_134 < x_136)) { + x_141 = bitcast((x_126 + bitcast(1))); + let x_142 : i32 = *(x_133); + temp[x_121] = x_142; + x_125_phi = x_124; + x_127_phi = x_141; + } else { + x_144 = (x_124 + 1); + let x_145 : i32 = *(x_135); + temp[x_121] = x_145; + x_125_phi = x_144; + x_127_phi = x_126; + } + let x_125 : i32 = x_125_phi; + let x_127 : i32 = x_127_phi; + + continuing { + x_121_phi = x_122; + x_124_phi = x_125; + x_126_phi = x_127; + } + } + x_148_phi = x_121; + x_151_phi = x_126; + loop { + var x_149 : i32; + var x_152 : i32; + let x_148 : i32 = x_148_phi; + let x_151 : i32 = x_151_phi; + if (((x_151 < 10) && (x_151 <= x_116))) { + } else { + break; + } + + continuing { + x_149 = (x_148 + 1); + x_152 = (x_151 + 1); + let x_158 : i32 = data[x_151]; + temp[x_148] = x_158; + x_148_phi = x_149; + x_151_phi = x_152; + } + } + x_161_phi = x_109; + loop { + var x_162 : i32; + let x_161 : i32 = x_161_phi; + if ((x_161 <= x_119)) { + } else { + break; + } + + continuing { + let x_167 : i32 = temp[x_161]; + data[x_161] = x_167; + x_162 = (x_161 + 1); + x_161_phi = x_162; + } + } + + continuing { + x_109_phi = x_110; + } + } + + continuing { + x_103 = (2 * x_102); + x_102_phi = x_103; + } + } + var x_171 : i32; + var x_189 : f32; + var x_278 : f32; + var x_279_phi : f32; + let x_170 : f32 = gl_FragCoord.y; + x_171 = i32(x_170); + if ((x_171 < 30)) { + let x_177 : i32 = data[0]; + x_180 = (0.5 + (f32(x_177) * 0.100000001)); + x_280_phi = x_180; + } else { + var x_198 : f32; + var x_277 : f32; + var x_278_phi : f32; + if ((x_171 < 60)) { + let x_186 : i32 = data[1]; + x_189 = (0.5 + (f32(x_186) * 0.100000001)); + x_279_phi = x_189; + } else { + var x_207 : f32; + var x_249 : f32; + var x_277_phi : f32; + if ((x_171 < 90)) { + let x_195 : i32 = data[2]; + x_198 = (0.5 + (f32(x_195) * 0.100000001)); + x_278_phi = x_198; + } else { + if ((x_171 < 120)) { + let x_204 : i32 = data[3]; + x_207 = (0.5 + (f32(x_204) * 0.100000001)); + x_277_phi = x_207; + } else { + var x_220 : f32; + var x_248 : f32; + var x_249_phi : f32; + var x_256_phi : vec2; + var x_259_phi : i32; + if ((x_171 < 150)) { + discard; + } else { + var x_229 : f32; + var x_247 : f32; + var x_248_phi : f32; + if ((x_171 < 180)) { + let x_217 : i32 = data[5]; + x_220 = (0.5 + (f32(x_217) * 0.100000001)); + x_249_phi = x_220; + } else { + var x_238 : f32; + var x_246 : f32; + var x_247_phi : f32; + if ((x_171 < 210)) { + let x_226 : i32 = data[6]; + x_229 = (0.5 + (f32(x_226) * 0.100000001)); + x_248_phi = x_229; + } else { + if ((x_171 < 240)) { + let x_235 : i32 = data[7]; + x_238 = (0.5 + (f32(x_235) * 0.100000001)); + x_247_phi = x_238; + } else { + if ((x_171 < 270)) { + } else { + discard; + } + let x_243 : i32 = data[8]; + x_246 = (0.5 + (f32(x_243) * 0.100000001)); + x_247_phi = x_246; + } + x_247 = x_247_phi; + x_248_phi = x_247; + } + x_248 = x_248_phi; + x_249_phi = x_248; + } + x_249 = x_249_phi; + let x_251 : f32 = x_8.injectionSwitch.y; + let x_252 : bool = (x_62 > x_251); + if (x_252) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + x_256_phi = vec2(1.0, 1.0); + x_259_phi = 0; + loop { + var x_272 : vec2; + var x_260 : i32; + var x_273_phi : vec2; + let x_256 : vec2 = x_256_phi; + let x_259 : i32 = x_259_phi; + if ((x_259 <= 32)) { + } else { + break; + } + x_273_phi = x_256; + if ((x_256.x < 0.0)) { + if (x_252) { + discard; + } + x_272 = x_256; + x_272.y = (x_256.y + 1.0); + x_273_phi = x_272; + } + let x_273 : vec2 = x_273_phi; + var x_257_1 : vec2 = x_273; + x_257_1.x = (x_273.x + x_273.y); + let x_257 : vec2 = x_257_1; + + continuing { + x_260 = (x_259 + 1); + x_256_phi = x_257; + x_259_phi = x_260; + } + } + } + x_277_phi = x_249; + } + x_277 = x_277_phi; + x_278_phi = x_277; + } + x_278 = x_278_phi; + x_279_phi = x_278; + } + x_279 = x_279_phi; + x_280_phi = x_279; + } + let x_280 : f32 = x_280_phi; + x_GLF_color = vec4(x_280, x_280, x_280, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl new file mode 100644 index 0000000000..eb23a410aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl @@ -0,0 +1,344 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var temp : array; + var data : array; + var x_180 : f32; + var x_279 : f32; + var x_65_phi : i32; + var x_93_phi : i32; + var x_102_phi : i32; + var x_280_phi : f32; + let x_62 : f32 = x_8.injectionSwitch.x; + let x_63 : i32 = i32(x_62); + x_65_phi = x_63; + loop { + let x_65 : i32 = x_65_phi; + switch(x_65) { + case 9: { + data[x_65] = -5; + } + case 8: { + data[x_65] = -4; + } + case 7: { + data[x_65] = -3; + } + case 6: { + data[x_65] = -2; + } + case 5: { + data[x_65] = -1; + } + case 4: { + data[x_65] = 0; + } + case 3: { + data[x_65] = 1; + } + case 2: { + data[x_65] = 2; + } + case 1: { + data[x_65] = 3; + } + case 0: { + data[x_65] = 4; + } + default: { + } + } + let x_66 : i32 = (x_65 + 1); + + continuing { + x_65_phi = x_66; + if ((x_66 < 10)) { + } else { + break; + } + } + } + x_93_phi = 0; + loop { + var x_94 : i32; + let x_93 : i32 = x_93_phi; + if ((x_93 < 10)) { + } else { + break; + } + + continuing { + let x_99 : i32 = data[x_93]; + temp[x_93] = x_99; + x_94 = (x_93 + 1); + x_93_phi = x_94; + } + } + x_102_phi = 1; + loop { + var x_103 : i32; + var x_109_phi : i32; + let x_102 : i32 = x_102_phi; + if ((x_102 <= 9)) { + } else { + break; + } + x_109_phi = 0; + loop { + var x_121 : i32; + var x_126 : i32; + var x_121_phi : i32; + var x_124_phi : i32; + var x_126_phi : i32; + var x_148_phi : i32; + var x_151_phi : i32; + var x_161_phi : i32; + let x_109 : i32 = x_109_phi; + if ((x_109 < 9)) { + } else { + break; + } + let x_115 : i32 = (x_109 + x_102); + let x_116 : i32 = (x_115 - 1); + let x_110 : i32 = (x_109 + (2 * x_102)); + let x_119 : i32 = min((x_110 - 1), 9); + x_121_phi = x_109; + x_124_phi = x_115; + x_126_phi = x_109; + loop { + var x_141 : i32; + var x_144 : i32; + var x_125_phi : i32; + var x_127_phi : i32; + x_121 = x_121_phi; + let x_124 : i32 = x_124_phi; + x_126 = x_126_phi; + if (((x_126 <= x_116) && (x_124 <= x_119))) { + } else { + break; + } + let x_133 : ptr = &(data[x_126]); + let x_134 : i32 = *(x_133); + let x_135 : ptr = &(data[x_124]); + let x_136 : i32 = *(x_135); + let x_122 : i32 = bitcast((x_121 + bitcast(1))); + if ((x_134 < x_136)) { + x_141 = bitcast((x_126 + bitcast(1))); + let x_142 : i32 = *(x_133); + temp[x_121] = x_142; + x_125_phi = x_124; + x_127_phi = x_141; + } else { + x_144 = (x_124 + 1); + let x_145 : i32 = *(x_135); + temp[x_121] = x_145; + x_125_phi = x_144; + x_127_phi = x_126; + } + let x_125 : i32 = x_125_phi; + let x_127 : i32 = x_127_phi; + + continuing { + x_121_phi = x_122; + x_124_phi = x_125; + x_126_phi = x_127; + } + } + x_148_phi = x_121; + x_151_phi = x_126; + loop { + var x_149 : i32; + var x_152 : i32; + let x_148 : i32 = x_148_phi; + let x_151 : i32 = x_151_phi; + if (((x_151 < 10) && (x_151 <= x_116))) { + } else { + break; + } + + continuing { + x_149 = (x_148 + 1); + x_152 = (x_151 + 1); + let x_158 : i32 = data[x_151]; + temp[x_148] = x_158; + x_148_phi = x_149; + x_151_phi = x_152; + } + } + x_161_phi = x_109; + loop { + var x_162 : i32; + let x_161 : i32 = x_161_phi; + if ((x_161 <= x_119)) { + } else { + break; + } + + continuing { + let x_167 : i32 = temp[x_161]; + data[x_161] = x_167; + x_162 = (x_161 + 1); + x_161_phi = x_162; + } + } + + continuing { + x_109_phi = x_110; + } + } + + continuing { + x_103 = (2 * x_102); + x_102_phi = x_103; + } + } + var x_171 : i32; + var x_189 : f32; + var x_278 : f32; + var x_279_phi : f32; + let x_170 : f32 = gl_FragCoord.y; + x_171 = i32(x_170); + if ((x_171 < 30)) { + let x_177 : i32 = data[0]; + x_180 = (0.5 + (f32(x_177) * 0.100000001)); + x_280_phi = x_180; + } else { + var x_198 : f32; + var x_277 : f32; + var x_278_phi : f32; + if ((x_171 < 60)) { + let x_186 : i32 = data[1]; + x_189 = (0.5 + (f32(x_186) * 0.100000001)); + x_279_phi = x_189; + } else { + var x_207 : f32; + var x_249 : f32; + var x_277_phi : f32; + if ((x_171 < 90)) { + let x_195 : i32 = data[2]; + x_198 = (0.5 + (f32(x_195) * 0.100000001)); + x_278_phi = x_198; + } else { + if ((x_171 < 120)) { + let x_204 : i32 = data[3]; + x_207 = (0.5 + (f32(x_204) * 0.100000001)); + x_277_phi = x_207; + } else { + var x_220 : f32; + var x_248 : f32; + var x_249_phi : f32; + var x_256_phi : vec2; + var x_259_phi : i32; + if ((x_171 < 150)) { + discard; + } else { + var x_229 : f32; + var x_247 : f32; + var x_248_phi : f32; + if ((x_171 < 180)) { + let x_217 : i32 = data[5]; + x_220 = (0.5 + (f32(x_217) * 0.100000001)); + x_249_phi = x_220; + } else { + var x_238 : f32; + var x_246 : f32; + var x_247_phi : f32; + if ((x_171 < 210)) { + let x_226 : i32 = data[6]; + x_229 = (0.5 + (f32(x_226) * 0.100000001)); + x_248_phi = x_229; + } else { + if ((x_171 < 240)) { + let x_235 : i32 = data[7]; + x_238 = (0.5 + (f32(x_235) * 0.100000001)); + x_247_phi = x_238; + } else { + if ((x_171 < 270)) { + } else { + discard; + } + let x_243 : i32 = data[8]; + x_246 = (0.5 + (f32(x_243) * 0.100000001)); + x_247_phi = x_246; + } + x_247 = x_247_phi; + x_248_phi = x_247; + } + x_248 = x_248_phi; + x_249_phi = x_248; + } + x_249 = x_249_phi; + let x_251 : f32 = x_8.injectionSwitch.y; + let x_252 : bool = (x_62 > x_251); + if (x_252) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + x_256_phi = vec2(1.0, 1.0); + x_259_phi = 0; + loop { + var x_272 : vec2; + var x_260 : i32; + var x_273_phi : vec2; + let x_256 : vec2 = x_256_phi; + let x_259 : i32 = x_259_phi; + if ((x_259 <= 32)) { + } else { + break; + } + x_273_phi = x_256; + if ((x_256.x < 0.0)) { + if (x_252) { + discard; + } + x_272 = x_256; + x_272.y = (x_256.y + 1.0); + x_273_phi = x_272; + } + let x_273 : vec2 = x_273_phi; + var x_257_1 : vec2 = x_273; + x_257_1.x = (x_273.x + x_273.y); + let x_257 : vec2 = x_257_1; + + continuing { + x_260 = (x_259 + 1); + x_256_phi = x_257; + x_259_phi = x_260; + } + } + } + x_277_phi = x_249; + } + x_277 = x_277_phi; + x_278_phi = x_277; + } + x_278 = x_278_phi; + x_279_phi = x_278; + } + x_279 = x_279_phi; + x_280_phi = x_279; + } + let x_280 : f32 = x_280_phi; + x_GLF_color = vec4(x_280, x_280, x_280, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..d8b974e41b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.hlsl @@ -0,0 +1,357 @@ +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int temp[10] = (int[10])0; + int data[10] = (int[10])0; + float x_180 = 0.0f; + float x_279 = 0.0f; + int x_65_phi = 0; + int x_93_phi = 0; + int x_102_phi = 0; + float x_280_phi = 0.0f; + const float x_62 = asfloat(x_8[0].x); + const int x_63 = int(x_62); + x_65_phi = x_63; + while (true) { + const int x_65 = x_65_phi; + switch(x_65) { + case 9: { + data[x_65] = -5; + break; + } + case 8: { + data[x_65] = -4; + break; + } + case 7: { + data[x_65] = -3; + break; + } + case 6: { + data[x_65] = -2; + break; + } + case 5: { + data[x_65] = -1; + break; + } + case 4: { + data[x_65] = 0; + break; + } + case 3: { + data[x_65] = 1; + break; + } + case 2: { + data[x_65] = 2; + break; + } + case 1: { + data[x_65] = 3; + break; + } + case 0: { + data[x_65] = 4; + break; + } + default: { + break; + } + } + const int x_66 = (x_65 + 1); + { + x_65_phi = x_66; + if ((x_66 < 10)) { + } else { + break; + } + } + } + x_93_phi = 0; + while (true) { + int x_94 = 0; + const int x_93 = x_93_phi; + if ((x_93 < 10)) { + } else { + break; + } + { + const int x_99 = data[x_93]; + temp[x_93] = x_99; + x_94 = (x_93 + 1); + x_93_phi = x_94; + } + } + x_102_phi = 1; + while (true) { + int x_103 = 0; + int x_109_phi = 0; + const int x_102 = x_102_phi; + if ((x_102 <= 9)) { + } else { + break; + } + x_109_phi = 0; + while (true) { + int x_121 = 0; + int x_126 = 0; + int x_121_phi = 0; + int x_124_phi = 0; + int x_126_phi = 0; + int x_148_phi = 0; + int x_151_phi = 0; + int x_161_phi = 0; + const int x_109 = x_109_phi; + if ((x_109 < 9)) { + } else { + break; + } + const int x_115 = (x_109 + x_102); + const int x_116 = (x_115 - 1); + const int x_110 = (x_109 + (2 * x_102)); + const int x_119 = min((x_110 - 1), 9); + x_121_phi = x_109; + x_124_phi = x_115; + x_126_phi = x_109; + while (true) { + int x_141 = 0; + int x_144 = 0; + int x_125_phi = 0; + int x_127_phi = 0; + x_121 = x_121_phi; + const int x_124 = x_124_phi; + x_126 = x_126_phi; + bool tint_tmp = (x_126 <= x_116); + if (tint_tmp) { + tint_tmp = (x_124 <= x_119); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_133_save = x_126; + const int x_134 = data[x_133_save]; + const int x_135_save = x_124; + const int x_136 = data[x_135_save]; + const int x_122 = asint((x_121 + asint(1))); + if ((x_134 < x_136)) { + x_141 = asint((x_126 + asint(1))); + const int x_142 = data[x_133_save]; + temp[x_121] = x_142; + x_125_phi = x_124; + x_127_phi = x_141; + } else { + x_144 = (x_124 + 1); + const int x_145 = data[x_135_save]; + temp[x_121] = x_145; + x_125_phi = x_144; + x_127_phi = x_126; + } + const int x_125 = x_125_phi; + const int x_127 = x_127_phi; + { + x_121_phi = x_122; + x_124_phi = x_125; + x_126_phi = x_127; + } + } + x_148_phi = x_121; + x_151_phi = x_126; + while (true) { + int x_149 = 0; + int x_152 = 0; + const int x_148 = x_148_phi; + const int x_151 = x_151_phi; + bool tint_tmp_1 = (x_151 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_151 <= x_116); + } + if ((tint_tmp_1)) { + } else { + break; + } + { + x_149 = (x_148 + 1); + x_152 = (x_151 + 1); + const int x_158 = data[x_151]; + temp[x_148] = x_158; + x_148_phi = x_149; + x_151_phi = x_152; + } + } + x_161_phi = x_109; + while (true) { + int x_162 = 0; + const int x_161 = x_161_phi; + if ((x_161 <= x_119)) { + } else { + break; + } + { + const int x_167 = temp[x_161]; + data[x_161] = x_167; + x_162 = (x_161 + 1); + x_161_phi = x_162; + } + } + { + x_109_phi = x_110; + } + } + { + x_103 = (2 * x_102); + x_102_phi = x_103; + } + } + int x_171 = 0; + float x_189 = 0.0f; + float x_278 = 0.0f; + float x_279_phi = 0.0f; + const float x_170 = gl_FragCoord.y; + x_171 = int(x_170); + if ((x_171 < 30)) { + const int x_177 = data[0]; + x_180 = (0.5f + (float(x_177) * 0.100000001f)); + x_280_phi = x_180; + } else { + float x_198 = 0.0f; + float x_277 = 0.0f; + float x_278_phi = 0.0f; + if ((x_171 < 60)) { + const int x_186 = data[1]; + x_189 = (0.5f + (float(x_186) * 0.100000001f)); + x_279_phi = x_189; + } else { + float x_207 = 0.0f; + float x_249 = 0.0f; + float x_277_phi = 0.0f; + if ((x_171 < 90)) { + const int x_195 = data[2]; + x_198 = (0.5f + (float(x_195) * 0.100000001f)); + x_278_phi = x_198; + } else { + if ((x_171 < 120)) { + const int x_204 = data[3]; + x_207 = (0.5f + (float(x_204) * 0.100000001f)); + x_277_phi = x_207; + } else { + float x_220 = 0.0f; + float x_248 = 0.0f; + float x_249_phi = 0.0f; + float2 x_256_phi = float2(0.0f, 0.0f); + int x_259_phi = 0; + if ((x_171 < 150)) { + discard; + } else { + float x_229 = 0.0f; + float x_247 = 0.0f; + float x_248_phi = 0.0f; + if ((x_171 < 180)) { + const int x_217 = data[5]; + x_220 = (0.5f + (float(x_217) * 0.100000001f)); + x_249_phi = x_220; + } else { + float x_238 = 0.0f; + float x_246 = 0.0f; + float x_247_phi = 0.0f; + if ((x_171 < 210)) { + const int x_226 = data[6]; + x_229 = (0.5f + (float(x_226) * 0.100000001f)); + x_248_phi = x_229; + } else { + if ((x_171 < 240)) { + const int x_235 = data[7]; + x_238 = (0.5f + (float(x_235) * 0.100000001f)); + x_247_phi = x_238; + } else { + if ((x_171 < 270)) { + } else { + discard; + } + const int x_243 = data[8]; + x_246 = (0.5f + (float(x_243) * 0.100000001f)); + x_247_phi = x_246; + } + x_247 = x_247_phi; + x_248_phi = x_247; + } + x_248 = x_248_phi; + x_249_phi = x_248; + } + x_249 = x_249_phi; + const float x_251 = asfloat(x_8[0].y); + const bool x_252 = (x_62 > x_251); + if (x_252) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + x_256_phi = float2(1.0f, 1.0f); + x_259_phi = 0; + while (true) { + float2 x_272 = float2(0.0f, 0.0f); + int x_260 = 0; + float2 x_273_phi = float2(0.0f, 0.0f); + const float2 x_256 = x_256_phi; + const int x_259 = x_259_phi; + if ((x_259 <= 32)) { + } else { + break; + } + x_273_phi = x_256; + if ((x_256.x < 0.0f)) { + if (x_252) { + discard; + } + x_272 = x_256; + x_272.y = (x_256.y + 1.0f); + x_273_phi = x_272; + } + const float2 x_273 = x_273_phi; + float2 x_257_1 = x_273; + x_257_1.x = (x_273.x + x_273.y); + const float2 x_257 = x_257_1; + { + x_260 = (x_259 + 1); + x_256_phi = x_257; + x_259_phi = x_260; + } + } + } + x_277_phi = x_249; + } + x_277 = x_277_phi; + x_278_phi = x_277; + } + x_278 = x_278_phi; + x_279_phi = x_278; + } + x_279 = x_279_phi; + x_280_phi = x_279; + } + const float x_280 = x_280_phi; + x_GLF_color = float4(x_280, x_280, x_280, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.msl new file mode 100644 index 0000000000..ae3ef06377 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.msl @@ -0,0 +1,351 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + tint_array_wrapper temp = {}; + tint_array_wrapper data = {}; + float x_180 = 0.0f; + float x_279 = 0.0f; + int x_65_phi = 0; + int x_93_phi = 0; + int x_102_phi = 0; + float x_280_phi = 0.0f; + float const x_62 = x_8.injectionSwitch.x; + int const x_63 = int(x_62); + x_65_phi = x_63; + while (true) { + int const x_65 = x_65_phi; + switch(x_65) { + case 9: { + data.arr[x_65] = -5; + break; + } + case 8: { + data.arr[x_65] = -4; + break; + } + case 7: { + data.arr[x_65] = -3; + break; + } + case 6: { + data.arr[x_65] = -2; + break; + } + case 5: { + data.arr[x_65] = -1; + break; + } + case 4: { + data.arr[x_65] = 0; + break; + } + case 3: { + data.arr[x_65] = 1; + break; + } + case 2: { + data.arr[x_65] = 2; + break; + } + case 1: { + data.arr[x_65] = 3; + break; + } + case 0: { + data.arr[x_65] = 4; + break; + } + default: { + break; + } + } + int const x_66 = (x_65 + 1); + { + x_65_phi = x_66; + if ((x_66 < 10)) { + } else { + break; + } + } + } + x_93_phi = 0; + while (true) { + int x_94 = 0; + int const x_93 = x_93_phi; + if ((x_93 < 10)) { + } else { + break; + } + { + int const x_99 = data.arr[x_93]; + temp.arr[x_93] = x_99; + x_94 = (x_93 + 1); + x_93_phi = x_94; + } + } + x_102_phi = 1; + while (true) { + int x_103 = 0; + int x_109_phi = 0; + int const x_102 = x_102_phi; + if ((x_102 <= 9)) { + } else { + break; + } + x_109_phi = 0; + while (true) { + int x_121 = 0; + int x_126 = 0; + int x_121_phi = 0; + int x_124_phi = 0; + int x_126_phi = 0; + int x_148_phi = 0; + int x_151_phi = 0; + int x_161_phi = 0; + int const x_109 = x_109_phi; + if ((x_109 < 9)) { + } else { + break; + } + int const x_115 = (x_109 + x_102); + int const x_116 = (x_115 - 1); + int const x_110 = (x_109 + (2 * x_102)); + int const x_119 = min((x_110 - 1), 9); + x_121_phi = x_109; + x_124_phi = x_115; + x_126_phi = x_109; + while (true) { + int x_141 = 0; + int x_144 = 0; + int x_125_phi = 0; + int x_127_phi = 0; + x_121 = x_121_phi; + int const x_124 = x_124_phi; + x_126 = x_126_phi; + if (((x_126 <= x_116) && (x_124 <= x_119))) { + } else { + break; + } + int const x_133_save = x_126; + int const x_134 = data.arr[x_133_save]; + int const x_135_save = x_124; + int const x_136 = data.arr[x_135_save]; + int const x_122 = as_type((x_121 + as_type(1))); + if ((x_134 < x_136)) { + x_141 = as_type((x_126 + as_type(1))); + int const x_142 = data.arr[x_133_save]; + temp.arr[x_121] = x_142; + x_125_phi = x_124; + x_127_phi = x_141; + } else { + x_144 = (x_124 + 1); + int const x_145 = data.arr[x_135_save]; + temp.arr[x_121] = x_145; + x_125_phi = x_144; + x_127_phi = x_126; + } + int const x_125 = x_125_phi; + int const x_127 = x_127_phi; + { + x_121_phi = x_122; + x_124_phi = x_125; + x_126_phi = x_127; + } + } + x_148_phi = x_121; + x_151_phi = x_126; + while (true) { + int x_149 = 0; + int x_152 = 0; + int const x_148 = x_148_phi; + int const x_151 = x_151_phi; + if (((x_151 < 10) && (x_151 <= x_116))) { + } else { + break; + } + { + x_149 = (x_148 + 1); + x_152 = (x_151 + 1); + int const x_158 = data.arr[x_151]; + temp.arr[x_148] = x_158; + x_148_phi = x_149; + x_151_phi = x_152; + } + } + x_161_phi = x_109; + while (true) { + int x_162 = 0; + int const x_161 = x_161_phi; + if ((x_161 <= x_119)) { + } else { + break; + } + { + int const x_167 = temp.arr[x_161]; + data.arr[x_161] = x_167; + x_162 = (x_161 + 1); + x_161_phi = x_162; + } + } + { + x_109_phi = x_110; + } + } + { + x_103 = (2 * x_102); + x_102_phi = x_103; + } + } + int x_171 = 0; + float x_189 = 0.0f; + float x_278 = 0.0f; + float x_279_phi = 0.0f; + float const x_170 = (*(tint_symbol_5)).y; + x_171 = int(x_170); + if ((x_171 < 30)) { + int const x_177 = data.arr[0]; + x_180 = (0.5f + (float(x_177) * 0.100000001f)); + x_280_phi = x_180; + } else { + float x_198 = 0.0f; + float x_277 = 0.0f; + float x_278_phi = 0.0f; + if ((x_171 < 60)) { + int const x_186 = data.arr[1]; + x_189 = (0.5f + (float(x_186) * 0.100000001f)); + x_279_phi = x_189; + } else { + float x_207 = 0.0f; + float x_249 = 0.0f; + float x_277_phi = 0.0f; + if ((x_171 < 90)) { + int const x_195 = data.arr[2]; + x_198 = (0.5f + (float(x_195) * 0.100000001f)); + x_278_phi = x_198; + } else { + if ((x_171 < 120)) { + int const x_204 = data.arr[3]; + x_207 = (0.5f + (float(x_204) * 0.100000001f)); + x_277_phi = x_207; + } else { + float x_220 = 0.0f; + float x_248 = 0.0f; + float x_249_phi = 0.0f; + float2 x_256_phi = 0.0f; + int x_259_phi = 0; + if ((x_171 < 150)) { + discard_fragment(); + } else { + float x_229 = 0.0f; + float x_247 = 0.0f; + float x_248_phi = 0.0f; + if ((x_171 < 180)) { + int const x_217 = data.arr[5]; + x_220 = (0.5f + (float(x_217) * 0.100000001f)); + x_249_phi = x_220; + } else { + float x_238 = 0.0f; + float x_246 = 0.0f; + float x_247_phi = 0.0f; + if ((x_171 < 210)) { + int const x_226 = data.arr[6]; + x_229 = (0.5f + (float(x_226) * 0.100000001f)); + x_248_phi = x_229; + } else { + if ((x_171 < 240)) { + int const x_235 = data.arr[7]; + x_238 = (0.5f + (float(x_235) * 0.100000001f)); + x_247_phi = x_238; + } else { + if ((x_171 < 270)) { + } else { + discard_fragment(); + } + int const x_243 = data.arr[8]; + x_246 = (0.5f + (float(x_243) * 0.100000001f)); + x_247_phi = x_246; + } + x_247 = x_247_phi; + x_248_phi = x_247; + } + x_248 = x_248_phi; + x_249_phi = x_248; + } + x_249 = x_249_phi; + float const x_251 = x_8.injectionSwitch.y; + bool const x_252 = (x_62 > x_251); + if (x_252) { + *(tint_symbol_6) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + x_256_phi = float2(1.0f, 1.0f); + x_259_phi = 0; + while (true) { + float2 x_272 = 0.0f; + int x_260 = 0; + float2 x_273_phi = 0.0f; + float2 const x_256 = x_256_phi; + int const x_259 = x_259_phi; + if ((x_259 <= 32)) { + } else { + break; + } + x_273_phi = x_256; + if ((x_256.x < 0.0f)) { + if (x_252) { + discard_fragment(); + } + x_272 = x_256; + x_272.y = (x_256.y + 1.0f); + x_273_phi = x_272; + } + float2 const x_273 = x_273_phi; + float2 x_257_1 = x_273; + x_257_1.x = (x_273.x + x_273.y); + float2 const x_257 = x_257_1; + { + x_260 = (x_259 + 1); + x_256_phi = x_257; + x_259_phi = x_260; + } + } + } + x_277_phi = x_249; + } + x_277 = x_277_phi; + x_278_phi = x_277; + } + x_278 = x_278_phi; + x_279_phi = x_278; + } + x_279 = x_279_phi; + x_280_phi = x_279; + } + float const x_280 = x_280_phi; + *(tint_symbol_6) = float4(x_280, x_280, x_280, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..9831f2b713 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.spvasm @@ -0,0 +1,759 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 435 +; Schema: 0 + OpCapability Shader + %135 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %temp "temp" + OpName %data "data" + OpName %x_180 "x_180" + OpName %x_279 "x_279" + OpName %x_65_phi "x_65_phi" + OpName %x_93_phi "x_93_phi" + OpName %x_102_phi "x_102_phi" + OpName %x_280_phi "x_280_phi" + OpName %x_94 "x_94" + OpName %x_103 "x_103" + OpName %x_109_phi "x_109_phi" + OpName %x_121 "x_121" + OpName %x_126 "x_126" + OpName %x_121_phi "x_121_phi" + OpName %x_124_phi "x_124_phi" + OpName %x_126_phi "x_126_phi" + OpName %x_148_phi "x_148_phi" + OpName %x_151_phi "x_151_phi" + OpName %x_161_phi "x_161_phi" + OpName %x_141 "x_141" + OpName %x_144 "x_144" + OpName %x_125_phi "x_125_phi" + OpName %x_127_phi "x_127_phi" + OpName %x_149 "x_149" + OpName %x_152 "x_152" + OpName %x_162 "x_162" + OpName %x_171 "x_171" + OpName %x_189 "x_189" + OpName %x_278 "x_278" + OpName %x_279_phi "x_279_phi" + OpName %x_198 "x_198" + OpName %x_277 "x_277" + OpName %x_278_phi "x_278_phi" + OpName %x_207 "x_207" + OpName %x_249 "x_249" + OpName %x_277_phi "x_277_phi" + OpName %x_220 "x_220" + OpName %x_248 "x_248" + OpName %x_249_phi "x_249_phi" + OpName %x_256_phi "x_256_phi" + OpName %x_259_phi "x_259_phi" + OpName %x_229 "x_229" + OpName %x_247 "x_247" + OpName %x_248_phi "x_248_phi" + OpName %x_238 "x_238" + OpName %x_246 "x_246" + OpName %x_247_phi "x_247_phi" + OpName %x_272 "x_272" + OpName %x_260 "x_260" + OpName %x_273_phi "x_273_phi" + OpName %x_257_1 "x_257_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %25 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float +%_ptr_Function_int = OpTypePointer Function %int + %33 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 +%float_0_100000001 = OpConstant %float 0.100000001 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %300 = OpConstantNull %v2float + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %float_1 = OpConstant %float 1 + %377 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %378 = OpConstantComposite %v2float %float_1 %float_1 + %int_32 = OpConstant %int 32 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %422 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %temp = OpVariable %_ptr_Function__arr_int_uint_10 Function %25 + %data = OpVariable %_ptr_Function__arr_int_uint_10 Function %25 + %x_180 = OpVariable %_ptr_Function_float Function %29 + %x_279 = OpVariable %_ptr_Function_float Function %29 + %x_65_phi = OpVariable %_ptr_Function_int Function %33 + %x_93_phi = OpVariable %_ptr_Function_int Function %33 + %x_102_phi = OpVariable %_ptr_Function_int Function %33 + %x_280_phi = OpVariable %_ptr_Function_float Function %29 + %x_94 = OpVariable %_ptr_Function_int Function %33 + %x_103 = OpVariable %_ptr_Function_int Function %33 + %x_109_phi = OpVariable %_ptr_Function_int Function %33 + %x_121 = OpVariable %_ptr_Function_int Function %33 + %x_126 = OpVariable %_ptr_Function_int Function %33 + %x_121_phi = OpVariable %_ptr_Function_int Function %33 + %x_124_phi = OpVariable %_ptr_Function_int Function %33 + %x_126_phi = OpVariable %_ptr_Function_int Function %33 + %x_148_phi = OpVariable %_ptr_Function_int Function %33 + %x_151_phi = OpVariable %_ptr_Function_int Function %33 + %x_161_phi = OpVariable %_ptr_Function_int Function %33 + %x_141 = OpVariable %_ptr_Function_int Function %33 + %x_144 = OpVariable %_ptr_Function_int Function %33 + %x_125_phi = OpVariable %_ptr_Function_int Function %33 + %x_127_phi = OpVariable %_ptr_Function_int Function %33 + %x_149 = OpVariable %_ptr_Function_int Function %33 + %x_152 = OpVariable %_ptr_Function_int Function %33 + %x_162 = OpVariable %_ptr_Function_int Function %33 + %x_171 = OpVariable %_ptr_Function_int Function %33 + %x_189 = OpVariable %_ptr_Function_float Function %29 + %x_278 = OpVariable %_ptr_Function_float Function %29 + %x_279_phi = OpVariable %_ptr_Function_float Function %29 + %x_198 = OpVariable %_ptr_Function_float Function %29 + %x_277 = OpVariable %_ptr_Function_float Function %29 + %x_278_phi = OpVariable %_ptr_Function_float Function %29 + %x_207 = OpVariable %_ptr_Function_float Function %29 + %x_249 = OpVariable %_ptr_Function_float Function %29 + %x_277_phi = OpVariable %_ptr_Function_float Function %29 + %x_220 = OpVariable %_ptr_Function_float Function %29 + %x_248 = OpVariable %_ptr_Function_float Function %29 + %x_249_phi = OpVariable %_ptr_Function_float Function %29 + %x_256_phi = OpVariable %_ptr_Function_v2float Function %300 + %x_259_phi = OpVariable %_ptr_Function_int Function %33 + %x_229 = OpVariable %_ptr_Function_float Function %29 + %x_247 = OpVariable %_ptr_Function_float Function %29 + %x_248_phi = OpVariable %_ptr_Function_float Function %29 + %x_238 = OpVariable %_ptr_Function_float Function %29 + %x_246 = OpVariable %_ptr_Function_float Function %29 + %x_247_phi = OpVariable %_ptr_Function_float Function %29 + %x_272 = OpVariable %_ptr_Function_v2float Function %300 + %x_260 = OpVariable %_ptr_Function_int Function %33 + %x_273_phi = OpVariable %_ptr_Function_v2float Function %300 + %x_257_1 = OpVariable %_ptr_Function_v2float Function %300 + %39 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %40 = OpLoad %float %39 + %41 = OpConvertFToS %int %40 + OpStore %x_65_phi %41 + OpBranch %42 + %42 = OpLabel + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %46 = OpLoad %int %x_65_phi + OpSelectionMerge %47 None + OpSwitch %46 %48 9 %49 8 %50 7 %51 6 %52 5 %53 4 %54 3 %55 2 %56 1 %57 0 %58 + %49 = OpLabel + %59 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %59 %int_n5 + OpBranch %47 + %50 = OpLabel + %61 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %61 %int_n4 + OpBranch %47 + %51 = OpLabel + %63 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %63 %int_n3 + OpBranch %47 + %52 = OpLabel + %65 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %65 %int_n2 + OpBranch %47 + %53 = OpLabel + %67 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %67 %int_n1 + OpBranch %47 + %54 = OpLabel + %69 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %69 %int_0 + OpBranch %47 + %55 = OpLabel + %71 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %71 %int_1 + OpBranch %47 + %56 = OpLabel + %73 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %73 %int_2 + OpBranch %47 + %57 = OpLabel + %75 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %75 %int_3 + OpBranch %47 + %58 = OpLabel + %77 = OpAccessChain %_ptr_Function_int %data %46 + OpStore %77 %int_4 + OpBranch %47 + %48 = OpLabel + OpBranch %47 + %47 = OpLabel + %79 = OpIAdd %int %46 %int_1 + OpBranch %44 + %44 = OpLabel + OpStore %x_65_phi %79 + %81 = OpSLessThan %bool %79 %int_10 + OpSelectionMerge %83 None + OpBranchConditional %81 %84 %85 + %84 = OpLabel + OpBranch %83 + %85 = OpLabel + OpBranch %43 + %83 = OpLabel + OpBranch %42 + %43 = OpLabel + OpStore %x_93_phi %int_0 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %87 %88 None + OpBranch %89 + %89 = OpLabel + %91 = OpLoad %int %x_93_phi + %92 = OpSLessThan %bool %91 %int_10 + OpSelectionMerge %93 None + OpBranchConditional %92 %94 %95 + %94 = OpLabel + OpBranch %93 + %95 = OpLabel + OpBranch %87 + %93 = OpLabel + OpBranch %88 + %88 = OpLabel + %96 = OpAccessChain %_ptr_Function_int %data %91 + %97 = OpLoad %int %96 + %98 = OpAccessChain %_ptr_Function_int %temp %91 + OpStore %98 %97 + %99 = OpIAdd %int %91 %int_1 + OpStore %x_94 %99 + %100 = OpLoad %int %x_94 + OpStore %x_93_phi %100 + OpBranch %86 + %87 = OpLabel + OpStore %x_102_phi %int_1 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %102 %103 None + OpBranch %104 + %104 = OpLabel + %107 = OpLoad %int %x_102_phi + %109 = OpSLessThanEqual %bool %107 %int_9 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %112 + %111 = OpLabel + OpBranch %110 + %112 = OpLabel + OpBranch %102 + %110 = OpLabel + OpStore %x_109_phi %int_0 + OpBranch %113 + %113 = OpLabel + OpLoopMerge %114 %115 None + OpBranch %116 + %116 = OpLabel + %125 = OpLoad %int %x_109_phi + %126 = OpSLessThan %bool %125 %int_9 + OpSelectionMerge %127 None + OpBranchConditional %126 %128 %129 + %128 = OpLabel + OpBranch %127 + %129 = OpLabel + OpBranch %114 + %127 = OpLabel + %130 = OpIAdd %int %125 %107 + %131 = OpISub %int %130 %int_1 + %132 = OpIMul %int %int_2 %107 + %133 = OpIAdd %int %125 %132 + %136 = OpISub %int %133 %int_1 + %134 = OpExtInst %int %135 SMin %136 %int_9 + OpStore %x_121_phi %125 + OpStore %x_124_phi %130 + OpStore %x_126_phi %125 + OpBranch %137 + %137 = OpLabel + OpLoopMerge %138 %139 None + OpBranch %140 + %140 = OpLabel + %145 = OpLoad %int %x_121_phi + OpStore %x_121 %145 + %146 = OpLoad %int %x_124_phi + %147 = OpLoad %int %x_126_phi + OpStore %x_126 %147 + %148 = OpLoad %int %x_126 + %149 = OpSLessThanEqual %bool %148 %131 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %150 + %151 = OpLabel + %152 = OpSLessThanEqual %bool %146 %134 + OpBranch %150 + %150 = OpLabel + %153 = OpPhi %bool %149 %140 %152 %151 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + OpBranch %154 + %156 = OpLabel + OpBranch %138 + %154 = OpLabel + %157 = OpLoad %int %x_126 + %158 = OpAccessChain %_ptr_Function_int %data %157 + %159 = OpLoad %int %158 + %160 = OpAccessChain %_ptr_Function_int %data %146 + %161 = OpLoad %int %160 + %163 = OpLoad %int %x_121 + %164 = OpCopyObject %int %int_1 + %165 = OpIAdd %int %163 %164 + %162 = OpCopyObject %int %165 + %166 = OpSLessThan %bool %159 %161 + OpSelectionMerge %167 None + OpBranchConditional %166 %168 %169 + %168 = OpLabel + %171 = OpLoad %int %x_126 + %172 = OpCopyObject %int %int_1 + %173 = OpIAdd %int %171 %172 + %170 = OpCopyObject %int %173 + OpStore %x_141 %170 + %174 = OpAccessChain %_ptr_Function_int %data %157 + %175 = OpLoad %int %174 + %176 = OpLoad %int %x_121 + %177 = OpAccessChain %_ptr_Function_int %temp %176 + OpStore %177 %175 + OpStore %x_125_phi %146 + %178 = OpLoad %int %x_141 + OpStore %x_127_phi %178 + OpBranch %167 + %169 = OpLabel + %179 = OpIAdd %int %146 %int_1 + OpStore %x_144 %179 + %180 = OpAccessChain %_ptr_Function_int %data %146 + %181 = OpLoad %int %180 + %182 = OpLoad %int %x_121 + %183 = OpAccessChain %_ptr_Function_int %temp %182 + OpStore %183 %181 + %184 = OpLoad %int %x_144 + OpStore %x_125_phi %184 + %185 = OpLoad %int %x_126 + OpStore %x_127_phi %185 + OpBranch %167 + %167 = OpLabel + %186 = OpLoad %int %x_125_phi + %187 = OpLoad %int %x_127_phi + OpBranch %139 + %139 = OpLabel + OpStore %x_121_phi %162 + OpStore %x_124_phi %186 + OpStore %x_126_phi %187 + OpBranch %137 + %138 = OpLabel + %188 = OpLoad %int %x_121 + OpStore %x_148_phi %188 + %189 = OpLoad %int %x_126 + OpStore %x_151_phi %189 + OpBranch %190 + %190 = OpLabel + OpLoopMerge %191 %192 None + OpBranch %193 + %193 = OpLabel + %196 = OpLoad %int %x_148_phi + %197 = OpLoad %int %x_151_phi + %198 = OpSLessThan %bool %197 %int_10 + OpSelectionMerge %199 None + OpBranchConditional %198 %200 %199 + %200 = OpLabel + %201 = OpSLessThanEqual %bool %197 %131 + OpBranch %199 + %199 = OpLabel + %202 = OpPhi %bool %198 %193 %201 %200 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %205 + %204 = OpLabel + OpBranch %203 + %205 = OpLabel + OpBranch %191 + %203 = OpLabel + OpBranch %192 + %192 = OpLabel + %206 = OpIAdd %int %196 %int_1 + OpStore %x_149 %206 + %207 = OpIAdd %int %197 %int_1 + OpStore %x_152 %207 + %208 = OpAccessChain %_ptr_Function_int %data %197 + %209 = OpLoad %int %208 + %210 = OpAccessChain %_ptr_Function_int %temp %196 + OpStore %210 %209 + %211 = OpLoad %int %x_149 + OpStore %x_148_phi %211 + %212 = OpLoad %int %x_152 + OpStore %x_151_phi %212 + OpBranch %190 + %191 = OpLabel + OpStore %x_161_phi %125 + OpBranch %213 + %213 = OpLabel + OpLoopMerge %214 %215 None + OpBranch %216 + %216 = OpLabel + %218 = OpLoad %int %x_161_phi + %219 = OpSLessThanEqual %bool %218 %134 + OpSelectionMerge %220 None + OpBranchConditional %219 %221 %222 + %221 = OpLabel + OpBranch %220 + %222 = OpLabel + OpBranch %214 + %220 = OpLabel + OpBranch %215 + %215 = OpLabel + %223 = OpAccessChain %_ptr_Function_int %temp %218 + %224 = OpLoad %int %223 + %225 = OpAccessChain %_ptr_Function_int %data %218 + OpStore %225 %224 + %226 = OpIAdd %int %218 %int_1 + OpStore %x_162 %226 + %227 = OpLoad %int %x_162 + OpStore %x_161_phi %227 + OpBranch %213 + %214 = OpLabel + OpBranch %115 + %115 = OpLabel + OpStore %x_109_phi %133 + OpBranch %113 + %114 = OpLabel + OpBranch %103 + %103 = OpLabel + %228 = OpIMul %int %int_2 %107 + OpStore %x_103 %228 + %229 = OpLoad %int %x_103 + OpStore %x_102_phi %229 + OpBranch %101 + %102 = OpLabel + %236 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %237 = OpLoad %float %236 + %238 = OpConvertFToS %int %237 + OpStore %x_171 %238 + %239 = OpLoad %int %x_171 + %241 = OpSLessThan %bool %239 %int_30 + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %244 + %243 = OpLabel + %245 = OpAccessChain %_ptr_Function_int %data %int_0 + %246 = OpLoad %int %245 + %248 = OpConvertSToF %float %246 + %250 = OpFMul %float %248 %float_0_100000001 + %251 = OpFAdd %float %float_0_5 %250 + OpStore %x_180 %251 + %252 = OpLoad %float %x_180 + OpStore %x_280_phi %252 + OpBranch %242 + %244 = OpLabel + %256 = OpLoad %int %x_171 + %258 = OpSLessThan %bool %256 %int_60 + OpSelectionMerge %259 None + OpBranchConditional %258 %260 %261 + %260 = OpLabel + %262 = OpAccessChain %_ptr_Function_int %data %int_1 + %263 = OpLoad %int %262 + %264 = OpConvertSToF %float %263 + %265 = OpFMul %float %264 %float_0_100000001 + %266 = OpFAdd %float %float_0_5 %265 + OpStore %x_189 %266 + %267 = OpLoad %float %x_189 + OpStore %x_279_phi %267 + OpBranch %259 + %261 = OpLabel + %271 = OpLoad %int %x_171 + %273 = OpSLessThan %bool %271 %int_90 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %276 + %275 = OpLabel + %277 = OpAccessChain %_ptr_Function_int %data %int_2 + %278 = OpLoad %int %277 + %279 = OpConvertSToF %float %278 + %280 = OpFMul %float %279 %float_0_100000001 + %281 = OpFAdd %float %float_0_5 %280 + OpStore %x_198 %281 + %282 = OpLoad %float %x_198 + OpStore %x_278_phi %282 + OpBranch %274 + %276 = OpLabel + %283 = OpLoad %int %x_171 + %285 = OpSLessThan %bool %283 %int_120 + OpSelectionMerge %286 None + OpBranchConditional %285 %287 %288 + %287 = OpLabel + %289 = OpAccessChain %_ptr_Function_int %data %int_3 + %290 = OpLoad %int %289 + %291 = OpConvertSToF %float %290 + %292 = OpFMul %float %291 %float_0_100000001 + %293 = OpFAdd %float %float_0_5 %292 + OpStore %x_207 %293 + %294 = OpLoad %float %x_207 + OpStore %x_277_phi %294 + OpBranch %286 + %288 = OpLabel + %302 = OpLoad %int %x_171 + %304 = OpSLessThan %bool %302 %int_150 + OpSelectionMerge %305 None + OpBranchConditional %304 %306 %307 + %306 = OpLabel + OpKill + %307 = OpLabel + %311 = OpLoad %int %x_171 + %313 = OpSLessThan %bool %311 %int_180 + OpSelectionMerge %314 None + OpBranchConditional %313 %315 %316 + %315 = OpLabel + %318 = OpAccessChain %_ptr_Function_int %data %int_5 + %319 = OpLoad %int %318 + %320 = OpConvertSToF %float %319 + %321 = OpFMul %float %320 %float_0_100000001 + %322 = OpFAdd %float %float_0_5 %321 + OpStore %x_220 %322 + %323 = OpLoad %float %x_220 + OpStore %x_249_phi %323 + OpBranch %314 + %316 = OpLabel + %327 = OpLoad %int %x_171 + %329 = OpSLessThan %bool %327 %int_210 + OpSelectionMerge %330 None + OpBranchConditional %329 %331 %332 + %331 = OpLabel + %334 = OpAccessChain %_ptr_Function_int %data %int_6 + %335 = OpLoad %int %334 + %336 = OpConvertSToF %float %335 + %337 = OpFMul %float %336 %float_0_100000001 + %338 = OpFAdd %float %float_0_5 %337 + OpStore %x_229 %338 + %339 = OpLoad %float %x_229 + OpStore %x_248_phi %339 + OpBranch %330 + %332 = OpLabel + %340 = OpLoad %int %x_171 + %342 = OpSLessThan %bool %340 %int_240 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %345 + %344 = OpLabel + %347 = OpAccessChain %_ptr_Function_int %data %int_7 + %348 = OpLoad %int %347 + %349 = OpConvertSToF %float %348 + %350 = OpFMul %float %349 %float_0_100000001 + %351 = OpFAdd %float %float_0_5 %350 + OpStore %x_238 %351 + %352 = OpLoad %float %x_238 + OpStore %x_247_phi %352 + OpBranch %343 + %345 = OpLabel + %353 = OpLoad %int %x_171 + %355 = OpSLessThan %bool %353 %int_270 + OpSelectionMerge %356 None + OpBranchConditional %355 %357 %358 + %357 = OpLabel + OpBranch %356 + %358 = OpLabel + OpKill + %356 = OpLabel + %360 = OpAccessChain %_ptr_Function_int %data %int_8 + %361 = OpLoad %int %360 + %362 = OpConvertSToF %float %361 + %363 = OpFMul %float %362 %float_0_100000001 + %364 = OpFAdd %float %float_0_5 %363 + OpStore %x_246 %364 + %365 = OpLoad %float %x_246 + OpStore %x_247_phi %365 + OpBranch %343 + %343 = OpLabel + %366 = OpLoad %float %x_247_phi + OpStore %x_247 %366 + %367 = OpLoad %float %x_247 + OpStore %x_248_phi %367 + OpBranch %330 + %330 = OpLabel + %368 = OpLoad %float %x_248_phi + OpStore %x_248 %368 + %369 = OpLoad %float %x_248 + OpStore %x_249_phi %369 + OpBranch %314 + %314 = OpLabel + %370 = OpLoad %float %x_249_phi + OpStore %x_249 %370 + %371 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %372 = OpLoad %float %371 + %373 = OpFOrdGreaterThan %bool %40 %372 + OpSelectionMerge %374 None + OpBranchConditional %373 %375 %374 + %375 = OpLabel + OpStore %x_GLF_color %377 + OpBranch %374 + %374 = OpLabel + OpStore %x_256_phi %378 + OpStore %x_259_phi %int_0 + OpBranch %379 + %379 = OpLabel + OpLoopMerge %380 %381 None + OpBranch %382 + %382 = OpLabel + %386 = OpLoad %v2float %x_256_phi + %387 = OpLoad %int %x_259_phi + %389 = OpSLessThanEqual %bool %387 %int_32 + OpSelectionMerge %390 None + OpBranchConditional %389 %391 %392 + %391 = OpLabel + OpBranch %390 + %392 = OpLabel + OpBranch %380 + %390 = OpLabel + OpStore %x_273_phi %386 + %393 = OpCompositeExtract %float %386 0 + %395 = OpFOrdLessThan %bool %393 %float_0 + OpSelectionMerge %396 None + OpBranchConditional %395 %397 %396 + %397 = OpLabel + OpSelectionMerge %398 None + OpBranchConditional %373 %399 %398 + %399 = OpLabel + OpKill + %398 = OpLabel + OpStore %x_272 %386 + %400 = OpAccessChain %_ptr_Function_float %x_272 %uint_1 + %401 = OpCompositeExtract %float %386 1 + %402 = OpFAdd %float %401 %float_1 + OpStore %400 %402 + %403 = OpLoad %v2float %x_272 + OpStore %x_273_phi %403 + OpBranch %396 + %396 = OpLabel + %404 = OpLoad %v2float %x_273_phi + OpStore %x_257_1 %404 + %406 = OpAccessChain %_ptr_Function_float %x_257_1 %uint_0 + %407 = OpCompositeExtract %float %404 0 + %408 = OpCompositeExtract %float %404 1 + %409 = OpFAdd %float %407 %408 + OpStore %406 %409 + %410 = OpLoad %v2float %x_257_1 + OpBranch %381 + %381 = OpLabel + %411 = OpIAdd %int %387 %int_1 + OpStore %x_260 %411 + OpStore %x_256_phi %410 + %412 = OpLoad %int %x_260 + OpStore %x_259_phi %412 + OpBranch %379 + %380 = OpLabel + OpBranch %305 + %305 = OpLabel + %413 = OpLoad %float %x_249 + OpStore %x_277_phi %413 + OpBranch %286 + %286 = OpLabel + %414 = OpLoad %float %x_277_phi + OpStore %x_277 %414 + %415 = OpLoad %float %x_277 + OpStore %x_278_phi %415 + OpBranch %274 + %274 = OpLabel + %416 = OpLoad %float %x_278_phi + OpStore %x_278 %416 + %417 = OpLoad %float %x_278 + OpStore %x_279_phi %417 + OpBranch %259 + %259 = OpLabel + %418 = OpLoad %float %x_279_phi + OpStore %x_279 %418 + %419 = OpLoad %float %x_279 + OpStore %x_280_phi %419 + OpBranch %242 + %242 = OpLabel + %420 = OpLoad %float %x_280_phi + %421 = OpCompositeConstruct %v4float %420 %420 %420 %float_1 + OpStore %x_GLF_color %421 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %422 +%tint_symbol_1 = OpFunctionParameter %main_out + %426 = OpLabel + %427 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %427 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %429 = OpLabel + %430 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %430 + %431 = OpFunctionCall %void %main_1 + %433 = OpLoad %v4float %x_GLF_color + %434 = OpCompositeConstruct %main_out %433 + %432 = OpFunctionCall %void %tint_symbol_3 %434 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 44[%44] is not post dominated by the back-edge block 83[%83] + %83 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..eb23a410aa --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-for-always-false-if-discard/1.wgsl.expected.wgsl @@ -0,0 +1,344 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn main_1() { + var temp : array; + var data : array; + var x_180 : f32; + var x_279 : f32; + var x_65_phi : i32; + var x_93_phi : i32; + var x_102_phi : i32; + var x_280_phi : f32; + let x_62 : f32 = x_8.injectionSwitch.x; + let x_63 : i32 = i32(x_62); + x_65_phi = x_63; + loop { + let x_65 : i32 = x_65_phi; + switch(x_65) { + case 9: { + data[x_65] = -5; + } + case 8: { + data[x_65] = -4; + } + case 7: { + data[x_65] = -3; + } + case 6: { + data[x_65] = -2; + } + case 5: { + data[x_65] = -1; + } + case 4: { + data[x_65] = 0; + } + case 3: { + data[x_65] = 1; + } + case 2: { + data[x_65] = 2; + } + case 1: { + data[x_65] = 3; + } + case 0: { + data[x_65] = 4; + } + default: { + } + } + let x_66 : i32 = (x_65 + 1); + + continuing { + x_65_phi = x_66; + if ((x_66 < 10)) { + } else { + break; + } + } + } + x_93_phi = 0; + loop { + var x_94 : i32; + let x_93 : i32 = x_93_phi; + if ((x_93 < 10)) { + } else { + break; + } + + continuing { + let x_99 : i32 = data[x_93]; + temp[x_93] = x_99; + x_94 = (x_93 + 1); + x_93_phi = x_94; + } + } + x_102_phi = 1; + loop { + var x_103 : i32; + var x_109_phi : i32; + let x_102 : i32 = x_102_phi; + if ((x_102 <= 9)) { + } else { + break; + } + x_109_phi = 0; + loop { + var x_121 : i32; + var x_126 : i32; + var x_121_phi : i32; + var x_124_phi : i32; + var x_126_phi : i32; + var x_148_phi : i32; + var x_151_phi : i32; + var x_161_phi : i32; + let x_109 : i32 = x_109_phi; + if ((x_109 < 9)) { + } else { + break; + } + let x_115 : i32 = (x_109 + x_102); + let x_116 : i32 = (x_115 - 1); + let x_110 : i32 = (x_109 + (2 * x_102)); + let x_119 : i32 = min((x_110 - 1), 9); + x_121_phi = x_109; + x_124_phi = x_115; + x_126_phi = x_109; + loop { + var x_141 : i32; + var x_144 : i32; + var x_125_phi : i32; + var x_127_phi : i32; + x_121 = x_121_phi; + let x_124 : i32 = x_124_phi; + x_126 = x_126_phi; + if (((x_126 <= x_116) && (x_124 <= x_119))) { + } else { + break; + } + let x_133 : ptr = &(data[x_126]); + let x_134 : i32 = *(x_133); + let x_135 : ptr = &(data[x_124]); + let x_136 : i32 = *(x_135); + let x_122 : i32 = bitcast((x_121 + bitcast(1))); + if ((x_134 < x_136)) { + x_141 = bitcast((x_126 + bitcast(1))); + let x_142 : i32 = *(x_133); + temp[x_121] = x_142; + x_125_phi = x_124; + x_127_phi = x_141; + } else { + x_144 = (x_124 + 1); + let x_145 : i32 = *(x_135); + temp[x_121] = x_145; + x_125_phi = x_144; + x_127_phi = x_126; + } + let x_125 : i32 = x_125_phi; + let x_127 : i32 = x_127_phi; + + continuing { + x_121_phi = x_122; + x_124_phi = x_125; + x_126_phi = x_127; + } + } + x_148_phi = x_121; + x_151_phi = x_126; + loop { + var x_149 : i32; + var x_152 : i32; + let x_148 : i32 = x_148_phi; + let x_151 : i32 = x_151_phi; + if (((x_151 < 10) && (x_151 <= x_116))) { + } else { + break; + } + + continuing { + x_149 = (x_148 + 1); + x_152 = (x_151 + 1); + let x_158 : i32 = data[x_151]; + temp[x_148] = x_158; + x_148_phi = x_149; + x_151_phi = x_152; + } + } + x_161_phi = x_109; + loop { + var x_162 : i32; + let x_161 : i32 = x_161_phi; + if ((x_161 <= x_119)) { + } else { + break; + } + + continuing { + let x_167 : i32 = temp[x_161]; + data[x_161] = x_167; + x_162 = (x_161 + 1); + x_161_phi = x_162; + } + } + + continuing { + x_109_phi = x_110; + } + } + + continuing { + x_103 = (2 * x_102); + x_102_phi = x_103; + } + } + var x_171 : i32; + var x_189 : f32; + var x_278 : f32; + var x_279_phi : f32; + let x_170 : f32 = gl_FragCoord.y; + x_171 = i32(x_170); + if ((x_171 < 30)) { + let x_177 : i32 = data[0]; + x_180 = (0.5 + (f32(x_177) * 0.100000001)); + x_280_phi = x_180; + } else { + var x_198 : f32; + var x_277 : f32; + var x_278_phi : f32; + if ((x_171 < 60)) { + let x_186 : i32 = data[1]; + x_189 = (0.5 + (f32(x_186) * 0.100000001)); + x_279_phi = x_189; + } else { + var x_207 : f32; + var x_249 : f32; + var x_277_phi : f32; + if ((x_171 < 90)) { + let x_195 : i32 = data[2]; + x_198 = (0.5 + (f32(x_195) * 0.100000001)); + x_278_phi = x_198; + } else { + if ((x_171 < 120)) { + let x_204 : i32 = data[3]; + x_207 = (0.5 + (f32(x_204) * 0.100000001)); + x_277_phi = x_207; + } else { + var x_220 : f32; + var x_248 : f32; + var x_249_phi : f32; + var x_256_phi : vec2; + var x_259_phi : i32; + if ((x_171 < 150)) { + discard; + } else { + var x_229 : f32; + var x_247 : f32; + var x_248_phi : f32; + if ((x_171 < 180)) { + let x_217 : i32 = data[5]; + x_220 = (0.5 + (f32(x_217) * 0.100000001)); + x_249_phi = x_220; + } else { + var x_238 : f32; + var x_246 : f32; + var x_247_phi : f32; + if ((x_171 < 210)) { + let x_226 : i32 = data[6]; + x_229 = (0.5 + (f32(x_226) * 0.100000001)); + x_248_phi = x_229; + } else { + if ((x_171 < 240)) { + let x_235 : i32 = data[7]; + x_238 = (0.5 + (f32(x_235) * 0.100000001)); + x_247_phi = x_238; + } else { + if ((x_171 < 270)) { + } else { + discard; + } + let x_243 : i32 = data[8]; + x_246 = (0.5 + (f32(x_243) * 0.100000001)); + x_247_phi = x_246; + } + x_247 = x_247_phi; + x_248_phi = x_247; + } + x_248 = x_248_phi; + x_249_phi = x_248; + } + x_249 = x_249_phi; + let x_251 : f32 = x_8.injectionSwitch.y; + let x_252 : bool = (x_62 > x_251); + if (x_252) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + x_256_phi = vec2(1.0, 1.0); + x_259_phi = 0; + loop { + var x_272 : vec2; + var x_260 : i32; + var x_273_phi : vec2; + let x_256 : vec2 = x_256_phi; + let x_259 : i32 = x_259_phi; + if ((x_259 <= 32)) { + } else { + break; + } + x_273_phi = x_256; + if ((x_256.x < 0.0)) { + if (x_252) { + discard; + } + x_272 = x_256; + x_272.y = (x_256.y + 1.0); + x_273_phi = x_272; + } + let x_273 : vec2 = x_273_phi; + var x_257_1 : vec2 = x_273; + x_257_1.x = (x_273.x + x_273.y); + let x_257 : vec2 = x_257_1; + + continuing { + x_260 = (x_259 + 1); + x_256_phi = x_257; + x_259_phi = x_260; + } + } + } + x_277_phi = x_249; + } + x_277 = x_277_phi; + x_278_phi = x_277; + } + x_278 = x_278_phi; + x_279_phi = x_278; + } + x_279 = x_279_phi; + x_280_phi = x_279; + } + let x_280 : f32 = x_280_phi; + x_GLF_color = vec4(x_280, x_280, x_280, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm new file mode 100644 index 0000000000..a853052243 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm @@ -0,0 +1,574 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %merge_i1_i1_i1_ "merge(i1;i1;i1;" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %mergeSort_ "mergeSort(" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %data "data" + OpName %temp "temp" + OpName %i_0 "i" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_1 "i" + OpName %from_0 "from" + OpName %mid_0 "mid" + OpName %to_0 "to" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %i_2 "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %j_0 "j" + OpName %gl_FragCoord "gl_FragCoord" + OpName %grey "grey" + OpName %int_i "int_i" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %33 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %36 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private + %int_10 = OpConstant %int 10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %int_n3 = OpConstant %int -3 + %int_n4 = OpConstant %int -4 + %int_n5 = OpConstant %int -5 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %int_30 = OpConstant %int 30 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %33 + %83 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %grey = OpVariable %_ptr_Function_float Function + %int_i = OpVariable %_ptr_Function_int Function + %84 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %85 = OpLoad %float %84 + %86 = OpConvertFToS %int %85 + OpStore %i_2 %86 + OpBranch %87 + %87 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %int %i_2 + OpSelectionMerge %92 None + OpSwitch %91 %92 0 %93 1 %94 2 %95 3 %96 4 %97 5 %98 6 %99 7 %100 8 %101 9 %102 + %93 = OpLabel + %103 = OpLoad %int %i_2 + %104 = OpAccessChain %_ptr_Private_int %data %103 + OpStore %104 %int_4 + OpBranch %92 + %94 = OpLabel + %105 = OpLoad %int %i_2 + %106 = OpAccessChain %_ptr_Private_int %data %105 + OpStore %106 %int_3 + OpBranch %92 + %95 = OpLabel + %107 = OpLoad %int %i_2 + %108 = OpAccessChain %_ptr_Private_int %data %107 + OpStore %108 %int_2 + OpBranch %92 + %96 = OpLabel + %109 = OpLoad %int %i_2 + %110 = OpAccessChain %_ptr_Private_int %data %109 + OpStore %110 %int_1 + OpBranch %92 + %97 = OpLabel + %111 = OpLoad %int %i_2 + %112 = OpAccessChain %_ptr_Private_int %data %111 + OpStore %112 %int_0 + OpBranch %92 + %98 = OpLabel + %113 = OpLoad %int %i_2 + %114 = OpAccessChain %_ptr_Private_int %data %113 + OpStore %114 %int_n1 + OpBranch %92 + %99 = OpLabel + %115 = OpLoad %int %i_2 + %116 = OpAccessChain %_ptr_Private_int %data %115 + OpStore %116 %int_n2 + OpBranch %92 + %100 = OpLabel + %117 = OpLoad %int %i_2 + %118 = OpAccessChain %_ptr_Private_int %data %117 + OpStore %118 %int_n3 + OpBranch %92 + %101 = OpLabel + %119 = OpLoad %int %i_2 + %120 = OpAccessChain %_ptr_Private_int %data %119 + OpStore %120 %int_n4 + OpBranch %92 + %102 = OpLabel + %121 = OpLoad %int %i_2 + %122 = OpAccessChain %_ptr_Private_int %data %121 + OpStore %122 %int_n5 + OpBranch %92 + %92 = OpLabel + %123 = OpLoad %int %i_2 + %124 = OpIAdd %int %123 %int_1 + OpStore %i_2 %124 + OpBranch %89 + %89 = OpLabel + %125 = OpLoad %int %i_2 + %126 = OpSLessThan %bool %125 %int_10 + OpBranchConditional %126 %87 %88 + %88 = OpLabel + OpStore %j_0 %int_0 + OpBranch %127 + %127 = OpLabel + OpLoopMerge %128 %129 None + OpBranch %130 + %130 = OpLabel + %131 = OpLoad %int %j_0 + %132 = OpSLessThan %bool %131 %int_10 + OpBranchConditional %132 %133 %128 + %133 = OpLabel + %134 = OpLoad %int %j_0 + %135 = OpLoad %int %j_0 + %136 = OpAccessChain %_ptr_Private_int %data %135 + %137 = OpLoad %int %136 + %138 = OpAccessChain %_ptr_Private_int %temp %134 + OpStore %138 %137 + OpBranch %129 + %129 = OpLabel + %139 = OpLoad %int %j_0 + %140 = OpIAdd %int %139 %int_1 + OpStore %j_0 %140 + OpBranch %127 + %128 = OpLabel + %141 = OpFunctionCall %void %mergeSort_ + %142 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %143 = OpLoad %float %142 + %144 = OpConvertFToS %int %143 + %145 = OpSLessThan %bool %144 %int_30 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %148 + %147 = OpLabel + %149 = OpAccessChain %_ptr_Private_int %data %int_0 + %150 = OpLoad %int %149 + %151 = OpConvertSToF %float %150 + %152 = OpFDiv %float %151 %float_10 + %153 = OpFAdd %float %float_0_5 %152 + OpStore %grey %153 + OpBranch %146 + %148 = OpLabel + %154 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %155 = OpLoad %float %154 + %156 = OpConvertFToS %int %155 + %157 = OpSLessThan %bool %156 %int_60 + OpSelectionMerge %158 None + OpBranchConditional %157 %159 %160 + %159 = OpLabel + %161 = OpAccessChain %_ptr_Private_int %data %int_1 + %162 = OpLoad %int %161 + %163 = OpConvertSToF %float %162 + %164 = OpFDiv %float %163 %float_10 + %165 = OpFAdd %float %float_0_5 %164 + OpStore %grey %165 + OpBranch %158 + %160 = OpLabel + %166 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %167 = OpLoad %float %166 + %168 = OpConvertFToS %int %167 + %169 = OpSLessThan %bool %168 %int_90 + OpSelectionMerge %170 None + OpBranchConditional %169 %171 %172 + %171 = OpLabel + %173 = OpAccessChain %_ptr_Private_int %data %int_2 + %174 = OpLoad %int %173 + %175 = OpConvertSToF %float %174 + %176 = OpFDiv %float %175 %float_10 + %177 = OpFAdd %float %float_0_5 %176 + OpStore %grey %177 + OpBranch %170 + %172 = OpLabel + %178 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %179 = OpLoad %float %178 + %180 = OpConvertFToS %int %179 + %181 = OpSLessThan %bool %180 %int_120 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %184 + %183 = OpLabel + %185 = OpAccessChain %_ptr_Private_int %data %int_3 + %186 = OpLoad %int %185 + %187 = OpConvertSToF %float %186 + %188 = OpFDiv %float %187 %float_10 + %189 = OpFAdd %float %float_0_5 %188 + OpStore %grey %189 + OpBranch %182 + %184 = OpLabel + %190 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %191 = OpLoad %float %190 + %192 = OpConvertFToS %int %191 + %193 = OpSLessThan %bool %192 %int_150 + OpSelectionMerge %194 None + OpBranchConditional %193 %195 %196 + %195 = OpLabel + OpStore %int_i %int_1 + OpBranch %197 + %197 = OpLabel + OpLoopMerge %198 %199 None + OpBranch %200 + %200 = OpLabel + %201 = OpLoad %int %int_i + %202 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %203 = OpLoad %float %202 + %204 = OpConvertFToS %int %203 + %205 = OpSGreaterThan %bool %201 %204 + OpBranchConditional %205 %206 %198 + %206 = OpLabel + OpKill + %199 = OpLabel + OpBranch %197 + %198 = OpLabel + OpBranch %194 + %196 = OpLabel + %207 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %208 = OpLoad %float %207 + %209 = OpConvertFToS %int %208 + %210 = OpSLessThan %bool %209 %int_180 + OpSelectionMerge %211 None + OpBranchConditional %210 %212 %213 + %212 = OpLabel + %214 = OpAccessChain %_ptr_Private_int %data %int_5 + %215 = OpLoad %int %214 + %216 = OpConvertSToF %float %215 + %217 = OpFDiv %float %216 %float_10 + %218 = OpFAdd %float %float_0_5 %217 + OpStore %grey %218 + OpBranch %211 + %213 = OpLabel + %219 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %220 = OpLoad %float %219 + %221 = OpConvertFToS %int %220 + %222 = OpSLessThan %bool %221 %int_210 + OpSelectionMerge %223 None + OpBranchConditional %222 %224 %225 + %224 = OpLabel + %226 = OpAccessChain %_ptr_Private_int %data %int_6 + %227 = OpLoad %int %226 + %228 = OpConvertSToF %float %227 + %229 = OpFDiv %float %228 %float_10 + %230 = OpFAdd %float %float_0_5 %229 + OpStore %grey %230 + OpBranch %223 + %225 = OpLabel + %231 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %232 = OpLoad %float %231 + %233 = OpConvertFToS %int %232 + %234 = OpSLessThan %bool %233 %int_240 + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %237 + %236 = OpLabel + %238 = OpAccessChain %_ptr_Private_int %data %int_7 + %239 = OpLoad %int %238 + %240 = OpConvertSToF %float %239 + %241 = OpFDiv %float %240 %float_10 + %242 = OpFAdd %float %float_0_5 %241 + OpStore %grey %242 + OpBranch %235 + %237 = OpLabel + %243 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %244 = OpLoad %float %243 + %245 = OpConvertFToS %int %244 + %246 = OpSLessThan %bool %245 %int_270 + OpSelectionMerge %247 None + OpBranchConditional %246 %248 %249 + %248 = OpLabel + %250 = OpAccessChain %_ptr_Private_int %data %int_8 + %251 = OpLoad %int %250 + %252 = OpConvertSToF %float %251 + %253 = OpFDiv %float %252 %float_10 + %254 = OpFAdd %float %float_0_5 %253 + OpStore %grey %254 + OpBranch %247 + %249 = OpLabel + OpKill + %247 = OpLabel + OpBranch %235 + %235 = OpLabel + OpBranch %223 + %223 = OpLabel + OpBranch %211 + %211 = OpLabel + OpBranch %194 + %194 = OpLabel + OpBranch %182 + %182 = OpLabel + OpBranch %170 + %170 = OpLabel + OpBranch %158 + %158 = OpLabel + OpBranch %146 + %146 = OpLabel + %255 = OpLoad %float %grey + %256 = OpCompositeConstruct %v3float %255 %255 %255 + %257 = OpCompositeExtract %float %256 0 + %258 = OpCompositeExtract %float %256 1 + %259 = OpCompositeExtract %float %256 2 + %260 = OpCompositeConstruct %v4float %257 %258 %259 %float_1 + OpStore %_GLF_color %260 + OpReturn + OpFunctionEnd +%merge_i1_i1_i1_ = OpFunction %void None %36 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %261 = OpLabel + %k = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %262 = OpLoad %int %from + OpStore %k %262 + %263 = OpLoad %int %from + OpStore %i %263 + %264 = OpLoad %int %mid + %265 = OpIAdd %int %264 %int_1 + OpStore %j %265 + OpBranch %266 + %266 = OpLabel + OpLoopMerge %267 %268 None + OpBranch %269 + %269 = OpLabel + %270 = OpLoad %int %i + %271 = OpLoad %int %mid + %272 = OpSLessThanEqual %bool %270 %271 + %273 = OpLoad %int %j + %274 = OpLoad %int %to + %275 = OpSLessThanEqual %bool %273 %274 + %276 = OpLogicalAnd %bool %272 %275 + OpBranchConditional %276 %277 %267 + %277 = OpLabel + %278 = OpLoad %int %i + %279 = OpAccessChain %_ptr_Private_int %data %278 + %280 = OpLoad %int %279 + %281 = OpLoad %int %j + %282 = OpAccessChain %_ptr_Private_int %data %281 + %283 = OpLoad %int %282 + %284 = OpSLessThan %bool %280 %283 + OpSelectionMerge %285 None + OpBranchConditional %284 %286 %287 + %286 = OpLabel + %288 = OpLoad %int %k + %289 = OpIAdd %int %288 %int_1 + OpStore %k %289 + %290 = OpLoad %int %i + %291 = OpIAdd %int %290 %int_1 + OpStore %i %291 + %292 = OpAccessChain %_ptr_Private_int %data %290 + %293 = OpLoad %int %292 + %294 = OpAccessChain %_ptr_Private_int %temp %288 + OpStore %294 %293 + OpBranch %285 + %287 = OpLabel + %295 = OpLoad %int %k + %296 = OpIAdd %int %295 %int_1 + OpStore %k %296 + %297 = OpLoad %int %j + %298 = OpIAdd %int %297 %int_1 + OpStore %j %298 + %299 = OpAccessChain %_ptr_Private_int %data %297 + %300 = OpLoad %int %299 + %301 = OpAccessChain %_ptr_Private_int %temp %295 + OpStore %301 %300 + OpBranch %285 + %285 = OpLabel + OpBranch %268 + %268 = OpLabel + OpBranch %266 + %267 = OpLabel + OpBranch %302 + %302 = OpLabel + OpLoopMerge %303 %304 None + OpBranch %305 + %305 = OpLabel + %306 = OpLoad %int %i + %307 = OpSLessThan %bool %306 %int_10 + %308 = OpLoad %int %i + %309 = OpLoad %int %mid + %310 = OpSLessThanEqual %bool %308 %309 + %311 = OpLogicalAnd %bool %307 %310 + OpBranchConditional %311 %312 %303 + %312 = OpLabel + %313 = OpLoad %int %k + %314 = OpIAdd %int %313 %int_1 + OpStore %k %314 + %315 = OpLoad %int %i + %316 = OpIAdd %int %315 %int_1 + OpStore %i %316 + %317 = OpAccessChain %_ptr_Private_int %data %315 + %318 = OpLoad %int %317 + %319 = OpAccessChain %_ptr_Private_int %temp %313 + OpStore %319 %318 + OpBranch %304 + %304 = OpLabel + OpBranch %302 + %303 = OpLabel + %320 = OpLoad %int %from + OpStore %i_0 %320 + OpBranch %321 + %321 = OpLabel + OpLoopMerge %322 %323 None + OpBranch %324 + %324 = OpLabel + %325 = OpLoad %int %i_0 + %326 = OpLoad %int %to + %327 = OpSLessThanEqual %bool %325 %326 + OpBranchConditional %327 %328 %322 + %328 = OpLabel + %329 = OpLoad %int %i_0 + %330 = OpLoad %int %i_0 + %331 = OpAccessChain %_ptr_Private_int %temp %330 + %332 = OpLoad %int %331 + %333 = OpAccessChain %_ptr_Private_int %data %329 + OpStore %333 %332 + OpBranch %323 + %323 = OpLabel + %334 = OpLoad %int %i_0 + %335 = OpIAdd %int %334 %int_1 + OpStore %i_0 %335 + OpBranch %321 + %322 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %33 + %336 = OpLabel + %low = OpVariable %_ptr_Function_int Function + %high = OpVariable %_ptr_Function_int Function + %m = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %from_0 = OpVariable %_ptr_Function_int Function + %mid_0 = OpVariable %_ptr_Function_int Function + %to_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %337 + %337 = OpLabel + OpLoopMerge %338 %339 None + OpBranch %340 + %340 = OpLabel + %341 = OpLoad %int %m + %342 = OpLoad %int %high + %343 = OpSLessThanEqual %bool %341 %342 + OpBranchConditional %343 %344 %338 + %344 = OpLabel + %345 = OpLoad %int %low + OpStore %i_1 %345 + OpBranch %346 + %346 = OpLabel + OpLoopMerge %347 %348 None + OpBranch %349 + %349 = OpLabel + %350 = OpLoad %int %i_1 + %351 = OpLoad %int %high + %352 = OpSLessThan %bool %350 %351 + OpBranchConditional %352 %353 %347 + %353 = OpLabel + %354 = OpLoad %int %i_1 + OpStore %from_0 %354 + %355 = OpLoad %int %i_1 + %356 = OpLoad %int %m + %357 = OpIAdd %int %355 %356 + %358 = OpISub %int %357 %int_1 + OpStore %mid_0 %358 + %359 = OpLoad %int %i_1 + %360 = OpLoad %int %m + %361 = OpIMul %int %int_2 %360 + %362 = OpIAdd %int %359 %361 + %363 = OpISub %int %362 %int_1 + %364 = OpLoad %int %high + %365 = OpExtInst %int %1 SMin %363 %364 + OpStore %to_0 %365 + %366 = OpLoad %int %from_0 + OpStore %param %366 + %367 = OpLoad %int %mid_0 + OpStore %param_0 %367 + %368 = OpLoad %int %to_0 + OpStore %param_1 %368 + %369 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_0 %param_1 + OpBranch %348 + %348 = OpLabel + %370 = OpLoad %int %m + %371 = OpIMul %int %int_2 %370 + %372 = OpLoad %int %i_1 + %373 = OpIAdd %int %372 %371 + OpStore %i_1 %373 + OpBranch %346 + %347 = OpLabel + OpBranch %339 + %339 = OpLabel + %374 = OpLoad %int %m + %375 = OpIMul %int %int_2 %374 + OpStore %m %375 + OpBranch %337 + %338 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..347df10315 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.hlsl @@ -0,0 +1,278 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_262 = from; + k = x_262; + const int x_263 = from; + i = x_263; + const int x_264 = mid; + j = (x_264 + 1); + while (true) { + const int x_270 = i; + const int x_271 = mid; + const int x_273 = j; + const int x_274 = to; + bool tint_tmp = (x_270 <= x_271); + if (tint_tmp) { + tint_tmp = (x_273 <= x_274); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_280 = data[i]; + const int x_283 = data[j]; + if ((x_280 < x_283)) { + const int x_288 = k; + k = (x_288 + 1); + const int x_290 = i; + i = (x_290 + 1); + const int x_293 = data[x_290]; + temp[x_288] = x_293; + } else { + const int x_295 = k; + k = (x_295 + 1); + const int x_297 = j; + j = (x_297 + 1); + const int x_300 = data[x_297]; + temp[x_295] = x_300; + } + } + while (true) { + const int x_306 = i; + const int x_308 = i; + const int x_309 = mid; + bool tint_tmp_1 = (x_306 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_308 <= x_309); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_313 = k; + k = (x_313 + 1); + const int x_315 = i; + i = (x_315 + 1); + const int x_318 = data[x_315]; + temp[x_313] = x_318; + } + const int x_320 = from; + i_1 = x_320; + while (true) { + const int x_325 = i_1; + const int x_326 = to; + if ((x_325 <= x_326)) { + } else { + break; + } + const int x_329 = i_1; + const int x_332 = temp[i_1]; + data[x_329] = x_332; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + int int_i = 0; + const float x_85 = asfloat(x_28[0].x); + i_3 = int(x_85); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_134 = j_1; + const int x_137 = data[j_1]; + temp[x_134] = x_137; + } + } + mergeSort_(); + const float x_143 = gl_FragCoord.y; + if ((int(x_143) < 30)) { + const int x_150 = data[0]; + grey = (0.5f + (float(x_150) / 10.0f)); + } else { + const float x_155 = gl_FragCoord.y; + if ((int(x_155) < 60)) { + const int x_162 = data[1]; + grey = (0.5f + (float(x_162) / 10.0f)); + } else { + const float x_167 = gl_FragCoord.y; + if ((int(x_167) < 90)) { + const int x_174 = data[2]; + grey = (0.5f + (float(x_174) / 10.0f)); + } else { + const float x_179 = gl_FragCoord.y; + if ((int(x_179) < 120)) { + const int x_186 = data[3]; + grey = (0.5f + (float(x_186) / 10.0f)); + } else { + const float x_191 = gl_FragCoord.y; + if ((int(x_191) < 150)) { + int_i = 1; + while (true) { + const int x_201 = int_i; + const float x_203 = asfloat(x_28[0].x); + if ((x_201 > int(x_203))) { + } else { + break; + } + discard; + } + } else { + const float x_208 = gl_FragCoord.y; + if ((int(x_208) < 180)) { + const int x_215 = data[5]; + grey = (0.5f + (float(x_215) / 10.0f)); + } else { + const float x_220 = gl_FragCoord.y; + if ((int(x_220) < 210)) { + const int x_227 = data[6]; + grey = (0.5f + (float(x_227) / 10.0f)); + } else { + const float x_232 = gl_FragCoord.y; + if ((int(x_232) < 240)) { + const int x_239 = data[7]; + grey = (0.5f + (float(x_239) / 10.0f)); + } else { + const float x_244 = gl_FragCoord.y; + if ((int(x_244) < 270)) { + const int x_251 = data[8]; + grey = (0.5f + (float(x_251) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_255 = grey; + const float3 x_256 = float3(x_255, x_255, x_255); + x_GLF_color = float4(x_256.x, x_256.y, x_256.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.msl new file mode 100644 index 0000000000..23be1b2f01 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.msl @@ -0,0 +1,324 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_262 = *(from); + k = x_262; + int const x_263 = *(from); + i = x_263; + int const x_264 = *(mid); + j = (x_264 + 1); + while (true) { + int const x_270 = i; + int const x_271 = *(mid); + int const x_273 = j; + int const x_274 = *(to); + if (((x_270 <= x_271) && (x_273 <= x_274))) { + } else { + break; + } + int const x_278 = i; + int const x_280 = (*(tint_symbol_5)).arr[x_278]; + int const x_281 = j; + int const x_283 = (*(tint_symbol_5)).arr[x_281]; + if ((x_280 < x_283)) { + int const x_288 = k; + k = (x_288 + 1); + int const x_290 = i; + i = (x_290 + 1); + int const x_293 = (*(tint_symbol_5)).arr[x_290]; + (*(tint_symbol_6)).arr[x_288] = x_293; + } else { + int const x_295 = k; + k = (x_295 + 1); + int const x_297 = j; + j = (x_297 + 1); + int const x_300 = (*(tint_symbol_5)).arr[x_297]; + (*(tint_symbol_6)).arr[x_295] = x_300; + } + } + while (true) { + int const x_306 = i; + int const x_308 = i; + int const x_309 = *(mid); + if (((x_306 < 10) && (x_308 <= x_309))) { + } else { + break; + } + int const x_313 = k; + k = (x_313 + 1); + int const x_315 = i; + i = (x_315 + 1); + int const x_318 = (*(tint_symbol_5)).arr[x_315]; + (*(tint_symbol_6)).arr[x_313] = x_318; + } + int const x_320 = *(from); + i_1 = x_320; + while (true) { + int const x_325 = i_1; + int const x_326 = *(to); + if ((x_325 <= x_326)) { + } else { + break; + } + int const x_329 = i_1; + int const x_330 = i_1; + int const x_332 = (*(tint_symbol_6)).arr[x_330]; + (*(tint_symbol_5)).arr[x_329] = x_332; + { + int const x_334 = i_1; + i_1 = (x_334 + 1); + } + } + return; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_341 = m; + int const x_342 = high; + if ((x_341 <= x_342)) { + } else { + break; + } + int const x_345 = low; + i_2 = x_345; + while (true) { + int const x_350 = i_2; + int const x_351 = high; + if ((x_350 < x_351)) { + } else { + break; + } + int const x_354 = i_2; + from_1 = x_354; + int const x_355 = i_2; + int const x_356 = m; + mid_1 = ((x_355 + x_356) - 1); + int const x_359 = i_2; + int const x_360 = m; + int const x_364 = high; + to_1 = min(((x_359 + (2 * x_360)) - 1), x_364); + int const x_366 = from_1; + param = x_366; + int const x_367 = mid_1; + param_1 = x_367; + int const x_368 = to_1; + param_2 = x_368; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_370 = m; + int const x_372 = i_2; + i_2 = (x_372 + (2 * x_370)); + } + } + { + int const x_374 = m; + m = (2 * x_374); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + int int_i = 0; + float const x_85 = x_28.injectionSwitch.x; + i_3 = int(x_85); + while (true) { + int const x_91 = i_3; + switch(x_91) { + case 9: { + int const x_121 = i_3; + (*(tint_symbol_9)).arr[x_121] = -5; + break; + } + case 8: { + int const x_119 = i_3; + (*(tint_symbol_9)).arr[x_119] = -4; + break; + } + case 7: { + int const x_117 = i_3; + (*(tint_symbol_9)).arr[x_117] = -3; + break; + } + case 6: { + int const x_115 = i_3; + (*(tint_symbol_9)).arr[x_115] = -2; + break; + } + case 5: { + int const x_113 = i_3; + (*(tint_symbol_9)).arr[x_113] = -1; + break; + } + case 4: { + int const x_111 = i_3; + (*(tint_symbol_9)).arr[x_111] = 0; + break; + } + case 3: { + int const x_109 = i_3; + (*(tint_symbol_9)).arr[x_109] = 1; + break; + } + case 2: { + int const x_107 = i_3; + (*(tint_symbol_9)).arr[x_107] = 2; + break; + } + case 1: { + int const x_105 = i_3; + (*(tint_symbol_9)).arr[x_105] = 3; + break; + } + case 0: { + int const x_103 = i_3; + (*(tint_symbol_9)).arr[x_103] = 4; + break; + } + default: { + break; + } + } + int const x_123 = i_3; + i_3 = (x_123 + 1); + { + int const x_125 = i_3; + if ((x_125 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_131 = j_1; + if ((x_131 < 10)) { + } else { + break; + } + int const x_134 = j_1; + int const x_135 = j_1; + int const x_137 = (*(tint_symbol_9)).arr[x_135]; + (*(tint_symbol_10)).arr[x_134] = x_137; + { + int const x_139 = j_1; + j_1 = (x_139 + 1); + } + } + mergeSort_(tint_symbol_9, tint_symbol_10); + float const x_143 = (*(tint_symbol_11)).y; + if ((int(x_143) < 30)) { + int const x_150 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_150) / 10.0f)); + } else { + float const x_155 = (*(tint_symbol_11)).y; + if ((int(x_155) < 60)) { + int const x_162 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_162) / 10.0f)); + } else { + float const x_167 = (*(tint_symbol_11)).y; + if ((int(x_167) < 90)) { + int const x_174 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_174) / 10.0f)); + } else { + float const x_179 = (*(tint_symbol_11)).y; + if ((int(x_179) < 120)) { + int const x_186 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_186) / 10.0f)); + } else { + float const x_191 = (*(tint_symbol_11)).y; + if ((int(x_191) < 150)) { + int_i = 1; + while (true) { + int const x_201 = int_i; + float const x_203 = x_28.injectionSwitch.x; + if ((x_201 > int(x_203))) { + } else { + break; + } + discard_fragment(); + } + } else { + float const x_208 = (*(tint_symbol_11)).y; + if ((int(x_208) < 180)) { + int const x_215 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_215) / 10.0f)); + } else { + float const x_220 = (*(tint_symbol_11)).y; + if ((int(x_220) < 210)) { + int const x_227 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_227) / 10.0f)); + } else { + float const x_232 = (*(tint_symbol_11)).y; + if ((int(x_232) < 240)) { + int const x_239 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_239) / 10.0f)); + } else { + float const x_244 = (*(tint_symbol_11)).y; + if ((int(x_244) < 270)) { + int const x_251 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_251) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_255 = grey; + float3 const x_256 = float3(x_255, x_255, x_255); + *(tint_symbol_12) = float4(x_256.x, x_256.y, x_256.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..6b57991b3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.spvasm @@ -0,0 +1,673 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 429 +; Schema: 0 + OpCapability Shader + %177 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %int_i "int_i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %132 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %201 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %416 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpLoad %int %mid + %51 = OpLoad %int %j + %53 = OpLoad %int %to + %54 = OpSLessThanEqual %bool %48 %50 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %58 = OpSLessThanEqual %bool %51 %53 + OpBranch %56 + %56 = OpLabel + %59 = OpPhi %bool %54 %47 %58 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %45 + %60 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Private_int %data %63 + %66 = OpLoad %int %65 + %67 = OpLoad %int %j + %68 = OpAccessChain %_ptr_Private_int %data %67 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %k + %75 = OpIAdd %int %74 %int_1 + OpStore %k %75 + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + %78 = OpAccessChain %_ptr_Private_int %data %76 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Private_int %temp %74 + OpStore %80 %79 + OpBranch %71 + %73 = OpLabel + %81 = OpLoad %int %k + %82 = OpIAdd %int %81 %int_1 + OpStore %k %82 + %83 = OpLoad %int %j + %84 = OpIAdd %int %83 %int_1 + OpStore %j %84 + %85 = OpAccessChain %_ptr_Private_int %data %83 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Private_int %temp %81 + OpStore %87 %86 + OpBranch %71 + %71 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpLoad %int %i + %95 = OpLoad %int %mid + %97 = OpSLessThan %bool %92 %int_10 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSLessThanEqual %bool %93 %95 + OpBranch %98 + %98 = OpLabel + %101 = OpPhi %bool %97 %91 %100 %99 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpBranch %102 + %104 = OpLabel + OpBranch %89 + %102 = OpLabel + %105 = OpLoad %int %k + %106 = OpIAdd %int %105 %int_1 + OpStore %k %106 + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + %109 = OpAccessChain %_ptr_Private_int %data %107 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Private_int %temp %105 + OpStore %111 %110 + OpBranch %90 + %90 = OpLabel + OpBranch %88 + %89 = OpLabel + %113 = OpLoad %int %from + OpStore %i_1 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpLoad %int %to + %121 = OpSLessThanEqual %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + OpBranch %122 + %124 = OpLabel + OpBranch %115 + %122 = OpLabel + %125 = OpLoad %int %i_1 + %126 = OpLoad %int %i_1 + %127 = OpAccessChain %_ptr_Private_int %temp %126 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %129 %128 + OpBranch %116 + %116 = OpLabel + %130 = OpLoad %int %i_1 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_1 %131 + OpBranch %114 + %115 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %132 + %134 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %151 = OpLoad %int %m + %152 = OpLoad %int %high + %153 = OpSLessThanEqual %bool %151 %152 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + OpBranch %154 + %156 = OpLabel + OpBranch %148 + %154 = OpLabel + %157 = OpLoad %int %low + OpStore %i_2 %157 + OpBranch %158 + %158 = OpLabel + OpLoopMerge %159 %160 None + OpBranch %161 + %161 = OpLabel + %162 = OpLoad %int %i_2 + %163 = OpLoad %int %high + %164 = OpSLessThan %bool %162 %163 + OpSelectionMerge %165 None + OpBranchConditional %164 %166 %167 + %166 = OpLabel + OpBranch %165 + %167 = OpLabel + OpBranch %159 + %165 = OpLabel + %168 = OpLoad %int %i_2 + OpStore %from_1 %168 + %169 = OpLoad %int %i_2 + %170 = OpLoad %int %m + %171 = OpIAdd %int %169 %170 + %172 = OpISub %int %171 %int_1 + OpStore %mid_1 %172 + %173 = OpLoad %int %i_2 + %174 = OpLoad %int %m + %175 = OpLoad %int %high + %179 = OpIMul %int %int_2 %174 + %180 = OpIAdd %int %173 %179 + %181 = OpISub %int %180 %int_1 + %176 = OpExtInst %int %177 SMin %181 %175 + OpStore %to_1 %176 + %182 = OpLoad %int %from_1 + OpStore %param %182 + %183 = OpLoad %int %mid_1 + OpStore %param_1 %183 + %184 = OpLoad %int %to_1 + OpStore %param_2 %184 + %185 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %160 + %160 = OpLabel + %189 = OpLoad %int %m + %190 = OpLoad %int %i_2 + %191 = OpIMul %int %int_2 %189 + %192 = OpIAdd %int %190 %191 + OpStore %i_2 %192 + OpBranch %158 + %159 = OpLabel + OpBranch %149 + %149 = OpLabel + %193 = OpLoad %int %m + %194 = OpIMul %int %int_2 %193 + OpStore %m %194 + OpBranch %147 + %148 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %132 + %196 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %201 + %int_i = OpVariable %_ptr_Function_int Function %32 + %205 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %206 = OpLoad %float %205 + %207 = OpConvertFToS %int %206 + OpStore %i_3 %207 + OpBranch %208 + %208 = OpLabel + OpLoopMerge %209 %210 None + OpBranch %211 + %211 = OpLabel + %212 = OpLoad %int %i_3 + OpSelectionMerge %213 None + OpSwitch %212 %214 9 %215 8 %216 7 %217 6 %218 5 %219 4 %220 3 %221 2 %222 1 %223 0 %224 + %215 = OpLabel + %225 = OpLoad %int %i_3 + %226 = OpAccessChain %_ptr_Private_int %data %225 + OpStore %226 %int_n5 + OpBranch %213 + %216 = OpLabel + %228 = OpLoad %int %i_3 + %229 = OpAccessChain %_ptr_Private_int %data %228 + OpStore %229 %int_n4 + OpBranch %213 + %217 = OpLabel + %231 = OpLoad %int %i_3 + %232 = OpAccessChain %_ptr_Private_int %data %231 + OpStore %232 %int_n3 + OpBranch %213 + %218 = OpLabel + %234 = OpLoad %int %i_3 + %235 = OpAccessChain %_ptr_Private_int %data %234 + OpStore %235 %int_n2 + OpBranch %213 + %219 = OpLabel + %237 = OpLoad %int %i_3 + %238 = OpAccessChain %_ptr_Private_int %data %237 + OpStore %238 %int_n1 + OpBranch %213 + %220 = OpLabel + %240 = OpLoad %int %i_3 + %241 = OpAccessChain %_ptr_Private_int %data %240 + OpStore %241 %int_0 + OpBranch %213 + %221 = OpLabel + %242 = OpLoad %int %i_3 + %243 = OpAccessChain %_ptr_Private_int %data %242 + OpStore %243 %int_1 + OpBranch %213 + %222 = OpLabel + %244 = OpLoad %int %i_3 + %245 = OpAccessChain %_ptr_Private_int %data %244 + OpStore %245 %int_2 + OpBranch %213 + %223 = OpLabel + %246 = OpLoad %int %i_3 + %247 = OpAccessChain %_ptr_Private_int %data %246 + OpStore %247 %int_3 + OpBranch %213 + %224 = OpLabel + %249 = OpLoad %int %i_3 + %250 = OpAccessChain %_ptr_Private_int %data %249 + OpStore %250 %int_4 + OpBranch %213 + %214 = OpLabel + OpBranch %213 + %213 = OpLabel + %252 = OpLoad %int %i_3 + %253 = OpIAdd %int %252 %int_1 + OpStore %i_3 %253 + OpBranch %210 + %210 = OpLabel + %254 = OpLoad %int %i_3 + %255 = OpSLessThan %bool %254 %int_10 + OpSelectionMerge %256 None + OpBranchConditional %255 %257 %258 + %257 = OpLabel + OpBranch %256 + %258 = OpLabel + OpBranch %209 + %256 = OpLabel + OpBranch %208 + %209 = OpLabel + OpStore %j_1 %int_0 + OpBranch %259 + %259 = OpLabel + OpLoopMerge %260 %261 None + OpBranch %262 + %262 = OpLabel + %263 = OpLoad %int %j_1 + %264 = OpSLessThan %bool %263 %int_10 + OpSelectionMerge %265 None + OpBranchConditional %264 %266 %267 + %266 = OpLabel + OpBranch %265 + %267 = OpLabel + OpBranch %260 + %265 = OpLabel + %268 = OpLoad %int %j_1 + %269 = OpLoad %int %j_1 + %270 = OpAccessChain %_ptr_Private_int %data %269 + %271 = OpLoad %int %270 + %272 = OpAccessChain %_ptr_Private_int %temp %268 + OpStore %272 %271 + OpBranch %261 + %261 = OpLabel + %273 = OpLoad %int %j_1 + %274 = OpIAdd %int %273 %int_1 + OpStore %j_1 %274 + OpBranch %259 + %260 = OpLabel + %275 = OpFunctionCall %void %mergeSort_ + %278 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %279 = OpLoad %float %278 + %280 = OpConvertFToS %int %279 + %282 = OpSLessThan %bool %280 %int_30 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %285 + %284 = OpLabel + %286 = OpAccessChain %_ptr_Private_int %data %int_0 + %287 = OpLoad %int %286 + %289 = OpConvertSToF %float %287 + %291 = OpFDiv %float %289 %float_10 + %292 = OpFAdd %float %float_0_5 %291 + OpStore %grey %292 + OpBranch %283 + %285 = OpLabel + %293 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %294 = OpLoad %float %293 + %295 = OpConvertFToS %int %294 + %297 = OpSLessThan %bool %295 %int_60 + OpSelectionMerge %298 None + OpBranchConditional %297 %299 %300 + %299 = OpLabel + %301 = OpAccessChain %_ptr_Private_int %data %int_1 + %302 = OpLoad %int %301 + %303 = OpConvertSToF %float %302 + %304 = OpFDiv %float %303 %float_10 + %305 = OpFAdd %float %float_0_5 %304 + OpStore %grey %305 + OpBranch %298 + %300 = OpLabel + %306 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %307 = OpLoad %float %306 + %308 = OpConvertFToS %int %307 + %310 = OpSLessThan %bool %308 %int_90 + OpSelectionMerge %311 None + OpBranchConditional %310 %312 %313 + %312 = OpLabel + %314 = OpAccessChain %_ptr_Private_int %data %int_2 + %315 = OpLoad %int %314 + %316 = OpConvertSToF %float %315 + %317 = OpFDiv %float %316 %float_10 + %318 = OpFAdd %float %float_0_5 %317 + OpStore %grey %318 + OpBranch %311 + %313 = OpLabel + %319 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %320 = OpLoad %float %319 + %321 = OpConvertFToS %int %320 + %323 = OpSLessThan %bool %321 %int_120 + OpSelectionMerge %324 None + OpBranchConditional %323 %325 %326 + %325 = OpLabel + %327 = OpAccessChain %_ptr_Private_int %data %int_3 + %328 = OpLoad %int %327 + %329 = OpConvertSToF %float %328 + %330 = OpFDiv %float %329 %float_10 + %331 = OpFAdd %float %float_0_5 %330 + OpStore %grey %331 + OpBranch %324 + %326 = OpLabel + %332 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %333 = OpLoad %float %332 + %334 = OpConvertFToS %int %333 + %336 = OpSLessThan %bool %334 %int_150 + OpSelectionMerge %337 None + OpBranchConditional %336 %338 %339 + %338 = OpLabel + OpStore %int_i %int_1 + OpBranch %340 + %340 = OpLabel + OpLoopMerge %341 %342 None + OpBranch %343 + %343 = OpLabel + %344 = OpLoad %int %int_i + %345 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %346 = OpLoad %float %345 + %347 = OpConvertFToS %int %346 + %348 = OpSGreaterThan %bool %344 %347 + OpSelectionMerge %349 None + OpBranchConditional %348 %350 %351 + %350 = OpLabel + OpBranch %349 + %351 = OpLabel + OpBranch %341 + %349 = OpLabel + OpKill + %342 = OpLabel + OpBranch %340 + %341 = OpLabel + OpBranch %337 + %339 = OpLabel + %352 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %353 = OpLoad %float %352 + %354 = OpConvertFToS %int %353 + %356 = OpSLessThan %bool %354 %int_180 + OpSelectionMerge %357 None + OpBranchConditional %356 %358 %359 + %358 = OpLabel + %361 = OpAccessChain %_ptr_Private_int %data %int_5 + %362 = OpLoad %int %361 + %363 = OpConvertSToF %float %362 + %364 = OpFDiv %float %363 %float_10 + %365 = OpFAdd %float %float_0_5 %364 + OpStore %grey %365 + OpBranch %357 + %359 = OpLabel + %366 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %367 = OpLoad %float %366 + %368 = OpConvertFToS %int %367 + %370 = OpSLessThan %bool %368 %int_210 + OpSelectionMerge %371 None + OpBranchConditional %370 %372 %373 + %372 = OpLabel + %375 = OpAccessChain %_ptr_Private_int %data %int_6 + %376 = OpLoad %int %375 + %377 = OpConvertSToF %float %376 + %378 = OpFDiv %float %377 %float_10 + %379 = OpFAdd %float %float_0_5 %378 + OpStore %grey %379 + OpBranch %371 + %373 = OpLabel + %380 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %381 = OpLoad %float %380 + %382 = OpConvertFToS %int %381 + %384 = OpSLessThan %bool %382 %int_240 + OpSelectionMerge %385 None + OpBranchConditional %384 %386 %387 + %386 = OpLabel + %389 = OpAccessChain %_ptr_Private_int %data %int_7 + %390 = OpLoad %int %389 + %391 = OpConvertSToF %float %390 + %392 = OpFDiv %float %391 %float_10 + %393 = OpFAdd %float %float_0_5 %392 + OpStore %grey %393 + OpBranch %385 + %387 = OpLabel + %394 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %395 = OpLoad %float %394 + %396 = OpConvertFToS %int %395 + %398 = OpSLessThan %bool %396 %int_270 + OpSelectionMerge %399 None + OpBranchConditional %398 %400 %401 + %400 = OpLabel + %403 = OpAccessChain %_ptr_Private_int %data %int_8 + %404 = OpLoad %int %403 + %405 = OpConvertSToF %float %404 + %406 = OpFDiv %float %405 %float_10 + %407 = OpFAdd %float %float_0_5 %406 + OpStore %grey %407 + OpBranch %399 + %401 = OpLabel + OpKill + %399 = OpLabel + OpBranch %385 + %385 = OpLabel + OpBranch %371 + %371 = OpLabel + OpBranch %357 + %357 = OpLabel + OpBranch %337 + %337 = OpLabel + OpBranch %324 + %324 = OpLabel + OpBranch %311 + %311 = OpLabel + OpBranch %298 + %298 = OpLabel + OpBranch %283 + %283 = OpLabel + %408 = OpLoad %float %grey + %410 = OpCompositeConstruct %v3float %408 %408 %408 + %411 = OpCompositeExtract %float %410 0 + %412 = OpCompositeExtract %float %410 1 + %413 = OpCompositeExtract %float %410 2 + %415 = OpCompositeConstruct %v4float %411 %412 %413 %float_1 + OpStore %x_GLF_color %415 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %416 +%tint_symbol_1 = OpFunctionParameter %main_out + %420 = OpLabel + %421 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %421 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %132 + %423 = OpLabel + %424 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %424 + %425 = OpFunctionCall %void %main_1 + %427 = OpLoad %v4float %x_GLF_color + %428 = OpCompositeConstruct %main_out %427 + %426 = OpFunctionCall %void %tint_symbol_3 %428 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 210[%210] is not post dominated by the back-edge block 256[%256] + %256 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..c64c646a48 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.spvasm.expected.wgsl @@ -0,0 +1,316 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_262 : i32 = *(from); + k = x_262; + let x_263 : i32 = *(from); + i = x_263; + let x_264 : i32 = *(mid); + j = (x_264 + 1); + loop { + let x_270 : i32 = i; + let x_271 : i32 = *(mid); + let x_273 : i32 = j; + let x_274 : i32 = *(to); + if (((x_270 <= x_271) && (x_273 <= x_274))) { + } else { + break; + } + let x_278 : i32 = i; + let x_280 : i32 = data[x_278]; + let x_281 : i32 = j; + let x_283 : i32 = data[x_281]; + if ((x_280 < x_283)) { + let x_288 : i32 = k; + k = (x_288 + 1); + let x_290 : i32 = i; + i = (x_290 + 1); + let x_293 : i32 = data[x_290]; + temp[x_288] = x_293; + } else { + let x_295 : i32 = k; + k = (x_295 + 1); + let x_297 : i32 = j; + j = (x_297 + 1); + let x_300 : i32 = data[x_297]; + temp[x_295] = x_300; + } + } + loop { + let x_306 : i32 = i; + let x_308 : i32 = i; + let x_309 : i32 = *(mid); + if (((x_306 < 10) && (x_308 <= x_309))) { + } else { + break; + } + let x_313 : i32 = k; + k = (x_313 + 1); + let x_315 : i32 = i; + i = (x_315 + 1); + let x_318 : i32 = data[x_315]; + temp[x_313] = x_318; + } + let x_320 : i32 = *(from); + i_1 = x_320; + loop { + let x_325 : i32 = i_1; + let x_326 : i32 = *(to); + if ((x_325 <= x_326)) { + } else { + break; + } + let x_329 : i32 = i_1; + let x_330 : i32 = i_1; + let x_332 : i32 = temp[x_330]; + data[x_329] = x_332; + + continuing { + let x_334 : i32 = i_1; + i_1 = (x_334 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_341 : i32 = m; + let x_342 : i32 = high; + if ((x_341 <= x_342)) { + } else { + break; + } + let x_345 : i32 = low; + i_2 = x_345; + loop { + let x_350 : i32 = i_2; + let x_351 : i32 = high; + if ((x_350 < x_351)) { + } else { + break; + } + let x_354 : i32 = i_2; + from_1 = x_354; + let x_355 : i32 = i_2; + let x_356 : i32 = m; + mid_1 = ((x_355 + x_356) - 1); + let x_359 : i32 = i_2; + let x_360 : i32 = m; + let x_364 : i32 = high; + to_1 = min(((x_359 + (2 * x_360)) - 1), x_364); + let x_366 : i32 = from_1; + param = x_366; + let x_367 : i32 = mid_1; + param_1 = x_367; + let x_368 : i32 = to_1; + param_2 = x_368; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_370 : i32 = m; + let x_372 : i32 = i_2; + i_2 = (x_372 + (2 * x_370)); + } + } + + continuing { + let x_374 : i32 = m; + m = (2 * x_374); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + var int_i : i32; + let x_85 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_85); + loop { + let x_91 : i32 = i_3; + switch(x_91) { + case 9: { + let x_121 : i32 = i_3; + data[x_121] = -5; + } + case 8: { + let x_119 : i32 = i_3; + data[x_119] = -4; + } + case 7: { + let x_117 : i32 = i_3; + data[x_117] = -3; + } + case 6: { + let x_115 : i32 = i_3; + data[x_115] = -2; + } + case 5: { + let x_113 : i32 = i_3; + data[x_113] = -1; + } + case 4: { + let x_111 : i32 = i_3; + data[x_111] = 0; + } + case 3: { + let x_109 : i32 = i_3; + data[x_109] = 1; + } + case 2: { + let x_107 : i32 = i_3; + data[x_107] = 2; + } + case 1: { + let x_105 : i32 = i_3; + data[x_105] = 3; + } + case 0: { + let x_103 : i32 = i_3; + data[x_103] = 4; + } + default: { + } + } + let x_123 : i32 = i_3; + i_3 = (x_123 + 1); + + continuing { + let x_125 : i32 = i_3; + if ((x_125 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_131 : i32 = j_1; + if ((x_131 < 10)) { + } else { + break; + } + let x_134 : i32 = j_1; + let x_135 : i32 = j_1; + let x_137 : i32 = data[x_135]; + temp[x_134] = x_137; + + continuing { + let x_139 : i32 = j_1; + j_1 = (x_139 + 1); + } + } + mergeSort_(); + let x_143 : f32 = gl_FragCoord.y; + if ((i32(x_143) < 30)) { + let x_150 : i32 = data[0]; + grey = (0.5 + (f32(x_150) / 10.0)); + } else { + let x_155 : f32 = gl_FragCoord.y; + if ((i32(x_155) < 60)) { + let x_162 : i32 = data[1]; + grey = (0.5 + (f32(x_162) / 10.0)); + } else { + let x_167 : f32 = gl_FragCoord.y; + if ((i32(x_167) < 90)) { + let x_174 : i32 = data[2]; + grey = (0.5 + (f32(x_174) / 10.0)); + } else { + let x_179 : f32 = gl_FragCoord.y; + if ((i32(x_179) < 120)) { + let x_186 : i32 = data[3]; + grey = (0.5 + (f32(x_186) / 10.0)); + } else { + let x_191 : f32 = gl_FragCoord.y; + if ((i32(x_191) < 150)) { + int_i = 1; + loop { + let x_201 : i32 = int_i; + let x_203 : f32 = x_28.injectionSwitch.x; + if ((x_201 > i32(x_203))) { + } else { + break; + } + discard; + } + } else { + let x_208 : f32 = gl_FragCoord.y; + if ((i32(x_208) < 180)) { + let x_215 : i32 = data[5]; + grey = (0.5 + (f32(x_215) / 10.0)); + } else { + let x_220 : f32 = gl_FragCoord.y; + if ((i32(x_220) < 210)) { + let x_227 : i32 = data[6]; + grey = (0.5 + (f32(x_227) / 10.0)); + } else { + let x_232 : f32 = gl_FragCoord.y; + if ((i32(x_232) < 240)) { + let x_239 : i32 = data[7]; + grey = (0.5 + (f32(x_239) / 10.0)); + } else { + let x_244 : f32 = gl_FragCoord.y; + if ((i32(x_244) < 270)) { + let x_251 : i32 = data[8]; + grey = (0.5 + (f32(x_251) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_255 : f32 = grey; + let x_256 : vec3 = vec3(x_255, x_255, x_255); + x_GLF_color = vec4(x_256.x, x_256.y, x_256.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl new file mode 100644 index 0000000000..c64c646a48 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl @@ -0,0 +1,316 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_262 : i32 = *(from); + k = x_262; + let x_263 : i32 = *(from); + i = x_263; + let x_264 : i32 = *(mid); + j = (x_264 + 1); + loop { + let x_270 : i32 = i; + let x_271 : i32 = *(mid); + let x_273 : i32 = j; + let x_274 : i32 = *(to); + if (((x_270 <= x_271) && (x_273 <= x_274))) { + } else { + break; + } + let x_278 : i32 = i; + let x_280 : i32 = data[x_278]; + let x_281 : i32 = j; + let x_283 : i32 = data[x_281]; + if ((x_280 < x_283)) { + let x_288 : i32 = k; + k = (x_288 + 1); + let x_290 : i32 = i; + i = (x_290 + 1); + let x_293 : i32 = data[x_290]; + temp[x_288] = x_293; + } else { + let x_295 : i32 = k; + k = (x_295 + 1); + let x_297 : i32 = j; + j = (x_297 + 1); + let x_300 : i32 = data[x_297]; + temp[x_295] = x_300; + } + } + loop { + let x_306 : i32 = i; + let x_308 : i32 = i; + let x_309 : i32 = *(mid); + if (((x_306 < 10) && (x_308 <= x_309))) { + } else { + break; + } + let x_313 : i32 = k; + k = (x_313 + 1); + let x_315 : i32 = i; + i = (x_315 + 1); + let x_318 : i32 = data[x_315]; + temp[x_313] = x_318; + } + let x_320 : i32 = *(from); + i_1 = x_320; + loop { + let x_325 : i32 = i_1; + let x_326 : i32 = *(to); + if ((x_325 <= x_326)) { + } else { + break; + } + let x_329 : i32 = i_1; + let x_330 : i32 = i_1; + let x_332 : i32 = temp[x_330]; + data[x_329] = x_332; + + continuing { + let x_334 : i32 = i_1; + i_1 = (x_334 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_341 : i32 = m; + let x_342 : i32 = high; + if ((x_341 <= x_342)) { + } else { + break; + } + let x_345 : i32 = low; + i_2 = x_345; + loop { + let x_350 : i32 = i_2; + let x_351 : i32 = high; + if ((x_350 < x_351)) { + } else { + break; + } + let x_354 : i32 = i_2; + from_1 = x_354; + let x_355 : i32 = i_2; + let x_356 : i32 = m; + mid_1 = ((x_355 + x_356) - 1); + let x_359 : i32 = i_2; + let x_360 : i32 = m; + let x_364 : i32 = high; + to_1 = min(((x_359 + (2 * x_360)) - 1), x_364); + let x_366 : i32 = from_1; + param = x_366; + let x_367 : i32 = mid_1; + param_1 = x_367; + let x_368 : i32 = to_1; + param_2 = x_368; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_370 : i32 = m; + let x_372 : i32 = i_2; + i_2 = (x_372 + (2 * x_370)); + } + } + + continuing { + let x_374 : i32 = m; + m = (2 * x_374); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + var int_i : i32; + let x_85 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_85); + loop { + let x_91 : i32 = i_3; + switch(x_91) { + case 9: { + let x_121 : i32 = i_3; + data[x_121] = -5; + } + case 8: { + let x_119 : i32 = i_3; + data[x_119] = -4; + } + case 7: { + let x_117 : i32 = i_3; + data[x_117] = -3; + } + case 6: { + let x_115 : i32 = i_3; + data[x_115] = -2; + } + case 5: { + let x_113 : i32 = i_3; + data[x_113] = -1; + } + case 4: { + let x_111 : i32 = i_3; + data[x_111] = 0; + } + case 3: { + let x_109 : i32 = i_3; + data[x_109] = 1; + } + case 2: { + let x_107 : i32 = i_3; + data[x_107] = 2; + } + case 1: { + let x_105 : i32 = i_3; + data[x_105] = 3; + } + case 0: { + let x_103 : i32 = i_3; + data[x_103] = 4; + } + default: { + } + } + let x_123 : i32 = i_3; + i_3 = (x_123 + 1); + + continuing { + let x_125 : i32 = i_3; + if ((x_125 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_131 : i32 = j_1; + if ((x_131 < 10)) { + } else { + break; + } + let x_134 : i32 = j_1; + let x_135 : i32 = j_1; + let x_137 : i32 = data[x_135]; + temp[x_134] = x_137; + + continuing { + let x_139 : i32 = j_1; + j_1 = (x_139 + 1); + } + } + mergeSort_(); + let x_143 : f32 = gl_FragCoord.y; + if ((i32(x_143) < 30)) { + let x_150 : i32 = data[0]; + grey = (0.5 + (f32(x_150) / 10.0)); + } else { + let x_155 : f32 = gl_FragCoord.y; + if ((i32(x_155) < 60)) { + let x_162 : i32 = data[1]; + grey = (0.5 + (f32(x_162) / 10.0)); + } else { + let x_167 : f32 = gl_FragCoord.y; + if ((i32(x_167) < 90)) { + let x_174 : i32 = data[2]; + grey = (0.5 + (f32(x_174) / 10.0)); + } else { + let x_179 : f32 = gl_FragCoord.y; + if ((i32(x_179) < 120)) { + let x_186 : i32 = data[3]; + grey = (0.5 + (f32(x_186) / 10.0)); + } else { + let x_191 : f32 = gl_FragCoord.y; + if ((i32(x_191) < 150)) { + int_i = 1; + loop { + let x_201 : i32 = int_i; + let x_203 : f32 = x_28.injectionSwitch.x; + if ((x_201 > i32(x_203))) { + } else { + break; + } + discard; + } + } else { + let x_208 : f32 = gl_FragCoord.y; + if ((i32(x_208) < 180)) { + let x_215 : i32 = data[5]; + grey = (0.5 + (f32(x_215) / 10.0)); + } else { + let x_220 : f32 = gl_FragCoord.y; + if ((i32(x_220) < 210)) { + let x_227 : i32 = data[6]; + grey = (0.5 + (f32(x_227) / 10.0)); + } else { + let x_232 : f32 = gl_FragCoord.y; + if ((i32(x_232) < 240)) { + let x_239 : i32 = data[7]; + grey = (0.5 + (f32(x_239) / 10.0)); + } else { + let x_244 : f32 = gl_FragCoord.y; + if ((i32(x_244) < 270)) { + let x_251 : i32 = data[8]; + grey = (0.5 + (f32(x_251) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_255 : f32 = grey; + let x_256 : vec3 = vec3(x_255, x_255, x_255); + x_GLF_color = vec4(x_256.x, x_256.y, x_256.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..347df10315 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.hlsl @@ -0,0 +1,278 @@ +static int data[10] = (int[10])0; +static int temp[10] = (int[10])0; +cbuffer cbuffer_x_28 : register(b0, space0) { + uint4 x_28[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void merge_i1_i1_i1_(inout int from, inout int mid, inout int to) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + const int x_262 = from; + k = x_262; + const int x_263 = from; + i = x_263; + const int x_264 = mid; + j = (x_264 + 1); + while (true) { + const int x_270 = i; + const int x_271 = mid; + const int x_273 = j; + const int x_274 = to; + bool tint_tmp = (x_270 <= x_271); + if (tint_tmp) { + tint_tmp = (x_273 <= x_274); + } + if ((tint_tmp)) { + } else { + break; + } + const int x_280 = data[i]; + const int x_283 = data[j]; + if ((x_280 < x_283)) { + const int x_288 = k; + k = (x_288 + 1); + const int x_290 = i; + i = (x_290 + 1); + const int x_293 = data[x_290]; + temp[x_288] = x_293; + } else { + const int x_295 = k; + k = (x_295 + 1); + const int x_297 = j; + j = (x_297 + 1); + const int x_300 = data[x_297]; + temp[x_295] = x_300; + } + } + while (true) { + const int x_306 = i; + const int x_308 = i; + const int x_309 = mid; + bool tint_tmp_1 = (x_306 < 10); + if (tint_tmp_1) { + tint_tmp_1 = (x_308 <= x_309); + } + if ((tint_tmp_1)) { + } else { + break; + } + const int x_313 = k; + k = (x_313 + 1); + const int x_315 = i; + i = (x_315 + 1); + const int x_318 = data[x_315]; + temp[x_313] = x_318; + } + const int x_320 = from; + i_1 = x_320; + while (true) { + const int x_325 = i_1; + const int x_326 = to; + if ((x_325 <= x_326)) { + } else { + break; + } + const int x_329 = i_1; + const int x_332 = temp[i_1]; + data[x_329] = x_332; + { + i_1 = (i_1 + 1); + } + } + return; +} + +void mergeSort_() { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + { + for(; (m <= high); m = (2 * m)) { + i_2 = low; + { + for(; (i_2 < high); i_2 = (i_2 + (2 * m))) { + from_1 = i_2; + mid_1 = ((i_2 + m) - 1); + to_1 = min(((i_2 + (2 * m)) - 1), high); + param = from_1; + param_1 = mid_1; + param_2 = to_1; + merge_i1_i1_i1_(param, param_1, param_2); + } + } + } + } + return; +} + +void main_1() { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + int int_i = 0; + const float x_85 = asfloat(x_28[0].x); + i_3 = int(x_85); + while (true) { + switch(i_3) { + case 9: { + data[i_3] = -5; + break; + } + case 8: { + data[i_3] = -4; + break; + } + case 7: { + data[i_3] = -3; + break; + } + case 6: { + data[i_3] = -2; + break; + } + case 5: { + data[i_3] = -1; + break; + } + case 4: { + data[i_3] = 0; + break; + } + case 3: { + data[i_3] = 1; + break; + } + case 2: { + data[i_3] = 2; + break; + } + case 1: { + data[i_3] = 3; + break; + } + case 0: { + data[i_3] = 4; + break; + } + default: { + break; + } + } + i_3 = (i_3 + 1); + { + if ((i_3 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + { + for(; (j_1 < 10); j_1 = (j_1 + 1)) { + const int x_134 = j_1; + const int x_137 = data[j_1]; + temp[x_134] = x_137; + } + } + mergeSort_(); + const float x_143 = gl_FragCoord.y; + if ((int(x_143) < 30)) { + const int x_150 = data[0]; + grey = (0.5f + (float(x_150) / 10.0f)); + } else { + const float x_155 = gl_FragCoord.y; + if ((int(x_155) < 60)) { + const int x_162 = data[1]; + grey = (0.5f + (float(x_162) / 10.0f)); + } else { + const float x_167 = gl_FragCoord.y; + if ((int(x_167) < 90)) { + const int x_174 = data[2]; + grey = (0.5f + (float(x_174) / 10.0f)); + } else { + const float x_179 = gl_FragCoord.y; + if ((int(x_179) < 120)) { + const int x_186 = data[3]; + grey = (0.5f + (float(x_186) / 10.0f)); + } else { + const float x_191 = gl_FragCoord.y; + if ((int(x_191) < 150)) { + int_i = 1; + while (true) { + const int x_201 = int_i; + const float x_203 = asfloat(x_28[0].x); + if ((x_201 > int(x_203))) { + } else { + break; + } + discard; + } + } else { + const float x_208 = gl_FragCoord.y; + if ((int(x_208) < 180)) { + const int x_215 = data[5]; + grey = (0.5f + (float(x_215) / 10.0f)); + } else { + const float x_220 = gl_FragCoord.y; + if ((int(x_220) < 210)) { + const int x_227 = data[6]; + grey = (0.5f + (float(x_227) / 10.0f)); + } else { + const float x_232 = gl_FragCoord.y; + if ((int(x_232) < 240)) { + const int x_239 = data[7]; + grey = (0.5f + (float(x_239) / 10.0f)); + } else { + const float x_244 = gl_FragCoord.y; + if ((int(x_244) < 270)) { + const int x_251 = data[8]; + grey = (0.5f + (float(x_251) / 10.0f)); + } else { + discard; + } + } + } + } + } + } + } + } + } + const float x_255 = grey; + const float3 x_256 = float3(x_255, x_255, x_255); + x_GLF_color = float4(x_256.x, x_256.y, x_256.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.msl new file mode 100644 index 0000000000..23be1b2f01 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.msl @@ -0,0 +1,324 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { + int k = 0; + int i = 0; + int j = 0; + int i_1 = 0; + int const x_262 = *(from); + k = x_262; + int const x_263 = *(from); + i = x_263; + int const x_264 = *(mid); + j = (x_264 + 1); + while (true) { + int const x_270 = i; + int const x_271 = *(mid); + int const x_273 = j; + int const x_274 = *(to); + if (((x_270 <= x_271) && (x_273 <= x_274))) { + } else { + break; + } + int const x_278 = i; + int const x_280 = (*(tint_symbol_5)).arr[x_278]; + int const x_281 = j; + int const x_283 = (*(tint_symbol_5)).arr[x_281]; + if ((x_280 < x_283)) { + int const x_288 = k; + k = (x_288 + 1); + int const x_290 = i; + i = (x_290 + 1); + int const x_293 = (*(tint_symbol_5)).arr[x_290]; + (*(tint_symbol_6)).arr[x_288] = x_293; + } else { + int const x_295 = k; + k = (x_295 + 1); + int const x_297 = j; + j = (x_297 + 1); + int const x_300 = (*(tint_symbol_5)).arr[x_297]; + (*(tint_symbol_6)).arr[x_295] = x_300; + } + } + while (true) { + int const x_306 = i; + int const x_308 = i; + int const x_309 = *(mid); + if (((x_306 < 10) && (x_308 <= x_309))) { + } else { + break; + } + int const x_313 = k; + k = (x_313 + 1); + int const x_315 = i; + i = (x_315 + 1); + int const x_318 = (*(tint_symbol_5)).arr[x_315]; + (*(tint_symbol_6)).arr[x_313] = x_318; + } + int const x_320 = *(from); + i_1 = x_320; + while (true) { + int const x_325 = i_1; + int const x_326 = *(to); + if ((x_325 <= x_326)) { + } else { + break; + } + int const x_329 = i_1; + int const x_330 = i_1; + int const x_332 = (*(tint_symbol_6)).arr[x_330]; + (*(tint_symbol_5)).arr[x_329] = x_332; + { + int const x_334 = i_1; + i_1 = (x_334 + 1); + } + } + return; +} + +void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { + int low = 0; + int high = 0; + int m = 0; + int i_2 = 0; + int from_1 = 0; + int mid_1 = 0; + int to_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + low = 0; + high = 9; + m = 1; + while (true) { + int const x_341 = m; + int const x_342 = high; + if ((x_341 <= x_342)) { + } else { + break; + } + int const x_345 = low; + i_2 = x_345; + while (true) { + int const x_350 = i_2; + int const x_351 = high; + if ((x_350 < x_351)) { + } else { + break; + } + int const x_354 = i_2; + from_1 = x_354; + int const x_355 = i_2; + int const x_356 = m; + mid_1 = ((x_355 + x_356) - 1); + int const x_359 = i_2; + int const x_360 = m; + int const x_364 = high; + to_1 = min(((x_359 + (2 * x_360)) - 1), x_364); + int const x_366 = from_1; + param = x_366; + int const x_367 = mid_1; + param_1 = x_367; + int const x_368 = to_1; + param_2 = x_368; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); + { + int const x_370 = m; + int const x_372 = i_2; + i_2 = (x_372 + (2 * x_370)); + } + } + { + int const x_374 = m; + m = (2 * x_374); + } + } + return; +} + +void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) { + int i_3 = 0; + int j_1 = 0; + float grey = 0.0f; + int int_i = 0; + float const x_85 = x_28.injectionSwitch.x; + i_3 = int(x_85); + while (true) { + int const x_91 = i_3; + switch(x_91) { + case 9: { + int const x_121 = i_3; + (*(tint_symbol_9)).arr[x_121] = -5; + break; + } + case 8: { + int const x_119 = i_3; + (*(tint_symbol_9)).arr[x_119] = -4; + break; + } + case 7: { + int const x_117 = i_3; + (*(tint_symbol_9)).arr[x_117] = -3; + break; + } + case 6: { + int const x_115 = i_3; + (*(tint_symbol_9)).arr[x_115] = -2; + break; + } + case 5: { + int const x_113 = i_3; + (*(tint_symbol_9)).arr[x_113] = -1; + break; + } + case 4: { + int const x_111 = i_3; + (*(tint_symbol_9)).arr[x_111] = 0; + break; + } + case 3: { + int const x_109 = i_3; + (*(tint_symbol_9)).arr[x_109] = 1; + break; + } + case 2: { + int const x_107 = i_3; + (*(tint_symbol_9)).arr[x_107] = 2; + break; + } + case 1: { + int const x_105 = i_3; + (*(tint_symbol_9)).arr[x_105] = 3; + break; + } + case 0: { + int const x_103 = i_3; + (*(tint_symbol_9)).arr[x_103] = 4; + break; + } + default: { + break; + } + } + int const x_123 = i_3; + i_3 = (x_123 + 1); + { + int const x_125 = i_3; + if ((x_125 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + while (true) { + int const x_131 = j_1; + if ((x_131 < 10)) { + } else { + break; + } + int const x_134 = j_1; + int const x_135 = j_1; + int const x_137 = (*(tint_symbol_9)).arr[x_135]; + (*(tint_symbol_10)).arr[x_134] = x_137; + { + int const x_139 = j_1; + j_1 = (x_139 + 1); + } + } + mergeSort_(tint_symbol_9, tint_symbol_10); + float const x_143 = (*(tint_symbol_11)).y; + if ((int(x_143) < 30)) { + int const x_150 = (*(tint_symbol_9)).arr[0]; + grey = (0.5f + (float(x_150) / 10.0f)); + } else { + float const x_155 = (*(tint_symbol_11)).y; + if ((int(x_155) < 60)) { + int const x_162 = (*(tint_symbol_9)).arr[1]; + grey = (0.5f + (float(x_162) / 10.0f)); + } else { + float const x_167 = (*(tint_symbol_11)).y; + if ((int(x_167) < 90)) { + int const x_174 = (*(tint_symbol_9)).arr[2]; + grey = (0.5f + (float(x_174) / 10.0f)); + } else { + float const x_179 = (*(tint_symbol_11)).y; + if ((int(x_179) < 120)) { + int const x_186 = (*(tint_symbol_9)).arr[3]; + grey = (0.5f + (float(x_186) / 10.0f)); + } else { + float const x_191 = (*(tint_symbol_11)).y; + if ((int(x_191) < 150)) { + int_i = 1; + while (true) { + int const x_201 = int_i; + float const x_203 = x_28.injectionSwitch.x; + if ((x_201 > int(x_203))) { + } else { + break; + } + discard_fragment(); + } + } else { + float const x_208 = (*(tint_symbol_11)).y; + if ((int(x_208) < 180)) { + int const x_215 = (*(tint_symbol_9)).arr[5]; + grey = (0.5f + (float(x_215) / 10.0f)); + } else { + float const x_220 = (*(tint_symbol_11)).y; + if ((int(x_220) < 210)) { + int const x_227 = (*(tint_symbol_9)).arr[6]; + grey = (0.5f + (float(x_227) / 10.0f)); + } else { + float const x_232 = (*(tint_symbol_11)).y; + if ((int(x_232) < 240)) { + int const x_239 = (*(tint_symbol_9)).arr[7]; + grey = (0.5f + (float(x_239) / 10.0f)); + } else { + float const x_244 = (*(tint_symbol_11)).y; + if ((int(x_244) < 270)) { + int const x_251 = (*(tint_symbol_9)).arr[8]; + grey = (0.5f + (float(x_251) / 10.0f)); + } else { + discard_fragment(); + } + } + } + } + } + } + } + } + } + float const x_255 = grey; + float3 const x_256 = float3(x_255, x_255, x_255); + *(tint_symbol_12) = float4(x_256.x, x_256.y, x_256.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { + thread float4 tint_symbol_13 = 0.0f; + thread tint_array_wrapper tint_symbol_14 = {}; + thread tint_array_wrapper tint_symbol_15 = {}; + thread float4 tint_symbol_16 = 0.0f; + tint_symbol_13 = gl_FragCoord_param; + main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b57991b3c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.spvasm @@ -0,0 +1,673 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 429 +; Schema: 0 + OpCapability Shader + %177 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %data "data" + OpName %temp "temp" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_28 "x_28" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_" + OpName %from "from" + OpName %mid "mid" + OpName %to "to" + OpName %k "k" + OpName %i "i" + OpName %j "j" + OpName %i_1 "i_1" + OpName %mergeSort_ "mergeSort_" + OpName %low "low" + OpName %high "high" + OpName %m "m" + OpName %i_2 "i_2" + OpName %from_1 "from_1" + OpName %mid_1 "mid_1" + OpName %to_1 "to_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %main_1 "main_1" + OpName %i_3 "i_3" + OpName %j_1 "j_1" + OpName %grey "grey" + OpName %int_i "int_i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_28 NonWritable + OpDecorate %x_28 DescriptorSet 0 + OpDecorate %x_28 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10 + %7 = OpConstantNull %_arr_int_uint_10 + %data = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %7 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_28 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int + %32 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int + %int_10 = OpConstant %int 10 + %132 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %201 = OpConstantNull %float + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_n5 = OpConstant %int -5 + %int_n4 = OpConstant %int -4 + %int_n3 = OpConstant %int -3 + %int_n2 = OpConstant %int -2 + %int_n1 = OpConstant %int -1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %int_30 = OpConstant %int 30 + %float_0_5 = OpConstant %float 0.5 + %float_10 = OpConstant %float 10 + %int_60 = OpConstant %int 60 + %int_90 = OpConstant %int 90 + %int_120 = OpConstant %int 120 + %int_150 = OpConstant %int 150 + %int_180 = OpConstant %int 180 + %int_5 = OpConstant %int 5 + %int_210 = OpConstant %int 210 + %int_6 = OpConstant %int 6 + %int_240 = OpConstant %int 240 + %int_7 = OpConstant %int 7 + %int_270 = OpConstant %int 270 + %int_8 = OpConstant %int 8 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %416 = OpTypeFunction %void %main_out +%merge_i1_i1_i1_ = OpFunction %void None %23 + %from = OpFunctionParameter %_ptr_Function_int + %mid = OpFunctionParameter %_ptr_Function_int + %to = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %k = OpVariable %_ptr_Function_int Function %32 + %i = OpVariable %_ptr_Function_int Function %32 + %j = OpVariable %_ptr_Function_int Function %32 + %i_1 = OpVariable %_ptr_Function_int Function %32 + %37 = OpLoad %int %from + OpStore %k %37 + %39 = OpLoad %int %from + OpStore %i %39 + %41 = OpLoad %int %mid + %43 = OpIAdd %int %41 %int_1 + OpStore %j %43 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpLoad %int %mid + %51 = OpLoad %int %j + %53 = OpLoad %int %to + %54 = OpSLessThanEqual %bool %48 %50 + OpSelectionMerge %56 None + OpBranchConditional %54 %57 %56 + %57 = OpLabel + %58 = OpSLessThanEqual %bool %51 %53 + OpBranch %56 + %56 = OpLabel + %59 = OpPhi %bool %54 %47 %58 %57 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %45 + %60 = OpLabel + %63 = OpLoad %int %i + %65 = OpAccessChain %_ptr_Private_int %data %63 + %66 = OpLoad %int %65 + %67 = OpLoad %int %j + %68 = OpAccessChain %_ptr_Private_int %data %67 + %69 = OpLoad %int %68 + %70 = OpSLessThan %bool %66 %69 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + %74 = OpLoad %int %k + %75 = OpIAdd %int %74 %int_1 + OpStore %k %75 + %76 = OpLoad %int %i + %77 = OpIAdd %int %76 %int_1 + OpStore %i %77 + %78 = OpAccessChain %_ptr_Private_int %data %76 + %79 = OpLoad %int %78 + %80 = OpAccessChain %_ptr_Private_int %temp %74 + OpStore %80 %79 + OpBranch %71 + %73 = OpLabel + %81 = OpLoad %int %k + %82 = OpIAdd %int %81 %int_1 + OpStore %k %82 + %83 = OpLoad %int %j + %84 = OpIAdd %int %83 %int_1 + OpStore %j %84 + %85 = OpAccessChain %_ptr_Private_int %data %83 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_Private_int %temp %81 + OpStore %87 %86 + OpBranch %71 + %71 = OpLabel + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %92 = OpLoad %int %i + %93 = OpLoad %int %i + %95 = OpLoad %int %mid + %97 = OpSLessThan %bool %92 %int_10 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpSLessThanEqual %bool %93 %95 + OpBranch %98 + %98 = OpLabel + %101 = OpPhi %bool %97 %91 %100 %99 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %104 + %103 = OpLabel + OpBranch %102 + %104 = OpLabel + OpBranch %89 + %102 = OpLabel + %105 = OpLoad %int %k + %106 = OpIAdd %int %105 %int_1 + OpStore %k %106 + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + %109 = OpAccessChain %_ptr_Private_int %data %107 + %110 = OpLoad %int %109 + %111 = OpAccessChain %_ptr_Private_int %temp %105 + OpStore %111 %110 + OpBranch %90 + %90 = OpLabel + OpBranch %88 + %89 = OpLabel + %113 = OpLoad %int %from + OpStore %i_1 %113 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %118 = OpLoad %int %i_1 + %120 = OpLoad %int %to + %121 = OpSLessThanEqual %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %124 + %123 = OpLabel + OpBranch %122 + %124 = OpLabel + OpBranch %115 + %122 = OpLabel + %125 = OpLoad %int %i_1 + %126 = OpLoad %int %i_1 + %127 = OpAccessChain %_ptr_Private_int %temp %126 + %128 = OpLoad %int %127 + %129 = OpAccessChain %_ptr_Private_int %data %125 + OpStore %129 %128 + OpBranch %116 + %116 = OpLabel + %130 = OpLoad %int %i_1 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_1 %131 + OpBranch %114 + %115 = OpLabel + OpReturn + OpFunctionEnd + %mergeSort_ = OpFunction %void None %132 + %134 = OpLabel + %low = OpVariable %_ptr_Function_int Function %32 + %high = OpVariable %_ptr_Function_int Function %32 + %m = OpVariable %_ptr_Function_int Function %32 + %i_2 = OpVariable %_ptr_Function_int Function %32 + %from_1 = OpVariable %_ptr_Function_int Function %32 + %mid_1 = OpVariable %_ptr_Function_int Function %32 + %to_1 = OpVariable %_ptr_Function_int Function %32 + %param = OpVariable %_ptr_Function_int Function %32 + %param_1 = OpVariable %_ptr_Function_int Function %32 + %param_2 = OpVariable %_ptr_Function_int Function %32 + OpStore %low %int_0 + OpStore %high %int_9 + OpStore %m %int_1 + OpBranch %147 + %147 = OpLabel + OpLoopMerge %148 %149 None + OpBranch %150 + %150 = OpLabel + %151 = OpLoad %int %m + %152 = OpLoad %int %high + %153 = OpSLessThanEqual %bool %151 %152 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %156 + %155 = OpLabel + OpBranch %154 + %156 = OpLabel + OpBranch %148 + %154 = OpLabel + %157 = OpLoad %int %low + OpStore %i_2 %157 + OpBranch %158 + %158 = OpLabel + OpLoopMerge %159 %160 None + OpBranch %161 + %161 = OpLabel + %162 = OpLoad %int %i_2 + %163 = OpLoad %int %high + %164 = OpSLessThan %bool %162 %163 + OpSelectionMerge %165 None + OpBranchConditional %164 %166 %167 + %166 = OpLabel + OpBranch %165 + %167 = OpLabel + OpBranch %159 + %165 = OpLabel + %168 = OpLoad %int %i_2 + OpStore %from_1 %168 + %169 = OpLoad %int %i_2 + %170 = OpLoad %int %m + %171 = OpIAdd %int %169 %170 + %172 = OpISub %int %171 %int_1 + OpStore %mid_1 %172 + %173 = OpLoad %int %i_2 + %174 = OpLoad %int %m + %175 = OpLoad %int %high + %179 = OpIMul %int %int_2 %174 + %180 = OpIAdd %int %173 %179 + %181 = OpISub %int %180 %int_1 + %176 = OpExtInst %int %177 SMin %181 %175 + OpStore %to_1 %176 + %182 = OpLoad %int %from_1 + OpStore %param %182 + %183 = OpLoad %int %mid_1 + OpStore %param_1 %183 + %184 = OpLoad %int %to_1 + OpStore %param_2 %184 + %185 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2 + OpBranch %160 + %160 = OpLabel + %189 = OpLoad %int %m + %190 = OpLoad %int %i_2 + %191 = OpIMul %int %int_2 %189 + %192 = OpIAdd %int %190 %191 + OpStore %i_2 %192 + OpBranch %158 + %159 = OpLabel + OpBranch %149 + %149 = OpLabel + %193 = OpLoad %int %m + %194 = OpIMul %int %int_2 %193 + OpStore %m %194 + OpBranch %147 + %148 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %132 + %196 = OpLabel + %i_3 = OpVariable %_ptr_Function_int Function %32 + %j_1 = OpVariable %_ptr_Function_int Function %32 + %grey = OpVariable %_ptr_Function_float Function %201 + %int_i = OpVariable %_ptr_Function_int Function %32 + %205 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %206 = OpLoad %float %205 + %207 = OpConvertFToS %int %206 + OpStore %i_3 %207 + OpBranch %208 + %208 = OpLabel + OpLoopMerge %209 %210 None + OpBranch %211 + %211 = OpLabel + %212 = OpLoad %int %i_3 + OpSelectionMerge %213 None + OpSwitch %212 %214 9 %215 8 %216 7 %217 6 %218 5 %219 4 %220 3 %221 2 %222 1 %223 0 %224 + %215 = OpLabel + %225 = OpLoad %int %i_3 + %226 = OpAccessChain %_ptr_Private_int %data %225 + OpStore %226 %int_n5 + OpBranch %213 + %216 = OpLabel + %228 = OpLoad %int %i_3 + %229 = OpAccessChain %_ptr_Private_int %data %228 + OpStore %229 %int_n4 + OpBranch %213 + %217 = OpLabel + %231 = OpLoad %int %i_3 + %232 = OpAccessChain %_ptr_Private_int %data %231 + OpStore %232 %int_n3 + OpBranch %213 + %218 = OpLabel + %234 = OpLoad %int %i_3 + %235 = OpAccessChain %_ptr_Private_int %data %234 + OpStore %235 %int_n2 + OpBranch %213 + %219 = OpLabel + %237 = OpLoad %int %i_3 + %238 = OpAccessChain %_ptr_Private_int %data %237 + OpStore %238 %int_n1 + OpBranch %213 + %220 = OpLabel + %240 = OpLoad %int %i_3 + %241 = OpAccessChain %_ptr_Private_int %data %240 + OpStore %241 %int_0 + OpBranch %213 + %221 = OpLabel + %242 = OpLoad %int %i_3 + %243 = OpAccessChain %_ptr_Private_int %data %242 + OpStore %243 %int_1 + OpBranch %213 + %222 = OpLabel + %244 = OpLoad %int %i_3 + %245 = OpAccessChain %_ptr_Private_int %data %244 + OpStore %245 %int_2 + OpBranch %213 + %223 = OpLabel + %246 = OpLoad %int %i_3 + %247 = OpAccessChain %_ptr_Private_int %data %246 + OpStore %247 %int_3 + OpBranch %213 + %224 = OpLabel + %249 = OpLoad %int %i_3 + %250 = OpAccessChain %_ptr_Private_int %data %249 + OpStore %250 %int_4 + OpBranch %213 + %214 = OpLabel + OpBranch %213 + %213 = OpLabel + %252 = OpLoad %int %i_3 + %253 = OpIAdd %int %252 %int_1 + OpStore %i_3 %253 + OpBranch %210 + %210 = OpLabel + %254 = OpLoad %int %i_3 + %255 = OpSLessThan %bool %254 %int_10 + OpSelectionMerge %256 None + OpBranchConditional %255 %257 %258 + %257 = OpLabel + OpBranch %256 + %258 = OpLabel + OpBranch %209 + %256 = OpLabel + OpBranch %208 + %209 = OpLabel + OpStore %j_1 %int_0 + OpBranch %259 + %259 = OpLabel + OpLoopMerge %260 %261 None + OpBranch %262 + %262 = OpLabel + %263 = OpLoad %int %j_1 + %264 = OpSLessThan %bool %263 %int_10 + OpSelectionMerge %265 None + OpBranchConditional %264 %266 %267 + %266 = OpLabel + OpBranch %265 + %267 = OpLabel + OpBranch %260 + %265 = OpLabel + %268 = OpLoad %int %j_1 + %269 = OpLoad %int %j_1 + %270 = OpAccessChain %_ptr_Private_int %data %269 + %271 = OpLoad %int %270 + %272 = OpAccessChain %_ptr_Private_int %temp %268 + OpStore %272 %271 + OpBranch %261 + %261 = OpLabel + %273 = OpLoad %int %j_1 + %274 = OpIAdd %int %273 %int_1 + OpStore %j_1 %274 + OpBranch %259 + %260 = OpLabel + %275 = OpFunctionCall %void %mergeSort_ + %278 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %279 = OpLoad %float %278 + %280 = OpConvertFToS %int %279 + %282 = OpSLessThan %bool %280 %int_30 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %285 + %284 = OpLabel + %286 = OpAccessChain %_ptr_Private_int %data %int_0 + %287 = OpLoad %int %286 + %289 = OpConvertSToF %float %287 + %291 = OpFDiv %float %289 %float_10 + %292 = OpFAdd %float %float_0_5 %291 + OpStore %grey %292 + OpBranch %283 + %285 = OpLabel + %293 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %294 = OpLoad %float %293 + %295 = OpConvertFToS %int %294 + %297 = OpSLessThan %bool %295 %int_60 + OpSelectionMerge %298 None + OpBranchConditional %297 %299 %300 + %299 = OpLabel + %301 = OpAccessChain %_ptr_Private_int %data %int_1 + %302 = OpLoad %int %301 + %303 = OpConvertSToF %float %302 + %304 = OpFDiv %float %303 %float_10 + %305 = OpFAdd %float %float_0_5 %304 + OpStore %grey %305 + OpBranch %298 + %300 = OpLabel + %306 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %307 = OpLoad %float %306 + %308 = OpConvertFToS %int %307 + %310 = OpSLessThan %bool %308 %int_90 + OpSelectionMerge %311 None + OpBranchConditional %310 %312 %313 + %312 = OpLabel + %314 = OpAccessChain %_ptr_Private_int %data %int_2 + %315 = OpLoad %int %314 + %316 = OpConvertSToF %float %315 + %317 = OpFDiv %float %316 %float_10 + %318 = OpFAdd %float %float_0_5 %317 + OpStore %grey %318 + OpBranch %311 + %313 = OpLabel + %319 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %320 = OpLoad %float %319 + %321 = OpConvertFToS %int %320 + %323 = OpSLessThan %bool %321 %int_120 + OpSelectionMerge %324 None + OpBranchConditional %323 %325 %326 + %325 = OpLabel + %327 = OpAccessChain %_ptr_Private_int %data %int_3 + %328 = OpLoad %int %327 + %329 = OpConvertSToF %float %328 + %330 = OpFDiv %float %329 %float_10 + %331 = OpFAdd %float %float_0_5 %330 + OpStore %grey %331 + OpBranch %324 + %326 = OpLabel + %332 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %333 = OpLoad %float %332 + %334 = OpConvertFToS %int %333 + %336 = OpSLessThan %bool %334 %int_150 + OpSelectionMerge %337 None + OpBranchConditional %336 %338 %339 + %338 = OpLabel + OpStore %int_i %int_1 + OpBranch %340 + %340 = OpLabel + OpLoopMerge %341 %342 None + OpBranch %343 + %343 = OpLabel + %344 = OpLoad %int %int_i + %345 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0 + %346 = OpLoad %float %345 + %347 = OpConvertFToS %int %346 + %348 = OpSGreaterThan %bool %344 %347 + OpSelectionMerge %349 None + OpBranchConditional %348 %350 %351 + %350 = OpLabel + OpBranch %349 + %351 = OpLabel + OpBranch %341 + %349 = OpLabel + OpKill + %342 = OpLabel + OpBranch %340 + %341 = OpLabel + OpBranch %337 + %339 = OpLabel + %352 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %353 = OpLoad %float %352 + %354 = OpConvertFToS %int %353 + %356 = OpSLessThan %bool %354 %int_180 + OpSelectionMerge %357 None + OpBranchConditional %356 %358 %359 + %358 = OpLabel + %361 = OpAccessChain %_ptr_Private_int %data %int_5 + %362 = OpLoad %int %361 + %363 = OpConvertSToF %float %362 + %364 = OpFDiv %float %363 %float_10 + %365 = OpFAdd %float %float_0_5 %364 + OpStore %grey %365 + OpBranch %357 + %359 = OpLabel + %366 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %367 = OpLoad %float %366 + %368 = OpConvertFToS %int %367 + %370 = OpSLessThan %bool %368 %int_210 + OpSelectionMerge %371 None + OpBranchConditional %370 %372 %373 + %372 = OpLabel + %375 = OpAccessChain %_ptr_Private_int %data %int_6 + %376 = OpLoad %int %375 + %377 = OpConvertSToF %float %376 + %378 = OpFDiv %float %377 %float_10 + %379 = OpFAdd %float %float_0_5 %378 + OpStore %grey %379 + OpBranch %371 + %373 = OpLabel + %380 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %381 = OpLoad %float %380 + %382 = OpConvertFToS %int %381 + %384 = OpSLessThan %bool %382 %int_240 + OpSelectionMerge %385 None + OpBranchConditional %384 %386 %387 + %386 = OpLabel + %389 = OpAccessChain %_ptr_Private_int %data %int_7 + %390 = OpLoad %int %389 + %391 = OpConvertSToF %float %390 + %392 = OpFDiv %float %391 %float_10 + %393 = OpFAdd %float %float_0_5 %392 + OpStore %grey %393 + OpBranch %385 + %387 = OpLabel + %394 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %395 = OpLoad %float %394 + %396 = OpConvertFToS %int %395 + %398 = OpSLessThan %bool %396 %int_270 + OpSelectionMerge %399 None + OpBranchConditional %398 %400 %401 + %400 = OpLabel + %403 = OpAccessChain %_ptr_Private_int %data %int_8 + %404 = OpLoad %int %403 + %405 = OpConvertSToF %float %404 + %406 = OpFDiv %float %405 %float_10 + %407 = OpFAdd %float %float_0_5 %406 + OpStore %grey %407 + OpBranch %399 + %401 = OpLabel + OpKill + %399 = OpLabel + OpBranch %385 + %385 = OpLabel + OpBranch %371 + %371 = OpLabel + OpBranch %357 + %357 = OpLabel + OpBranch %337 + %337 = OpLabel + OpBranch %324 + %324 = OpLabel + OpBranch %311 + %311 = OpLabel + OpBranch %298 + %298 = OpLabel + OpBranch %283 + %283 = OpLabel + %408 = OpLoad %float %grey + %410 = OpCompositeConstruct %v3float %408 %408 %408 + %411 = OpCompositeExtract %float %410 0 + %412 = OpCompositeExtract %float %410 1 + %413 = OpCompositeExtract %float %410 2 + %415 = OpCompositeConstruct %v4float %411 %412 %413 %float_1 + OpStore %x_GLF_color %415 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %416 +%tint_symbol_1 = OpFunctionParameter %main_out + %420 = OpLabel + %421 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %421 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %132 + %423 = OpLabel + %424 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %424 + %425 = OpFunctionCall %void %main_1 + %427 = OpLoad %v4float %x_GLF_color + %428 = OpCompositeConstruct %main_out %427 + %426 = OpFunctionCall %void %tint_symbol_3 %428 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 210[%210] is not post dominated by the back-edge block 256[%256] + %256 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..c64c646a48 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-mergesort-reversed-for-loop/1.wgsl.expected.wgsl @@ -0,0 +1,316 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var data : array; + +var temp : array; + +[[group(0), binding(0)]] var x_28 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn merge_i1_i1_i1_(from : ptr, mid : ptr, to : ptr) { + var k : i32; + var i : i32; + var j : i32; + var i_1 : i32; + let x_262 : i32 = *(from); + k = x_262; + let x_263 : i32 = *(from); + i = x_263; + let x_264 : i32 = *(mid); + j = (x_264 + 1); + loop { + let x_270 : i32 = i; + let x_271 : i32 = *(mid); + let x_273 : i32 = j; + let x_274 : i32 = *(to); + if (((x_270 <= x_271) && (x_273 <= x_274))) { + } else { + break; + } + let x_278 : i32 = i; + let x_280 : i32 = data[x_278]; + let x_281 : i32 = j; + let x_283 : i32 = data[x_281]; + if ((x_280 < x_283)) { + let x_288 : i32 = k; + k = (x_288 + 1); + let x_290 : i32 = i; + i = (x_290 + 1); + let x_293 : i32 = data[x_290]; + temp[x_288] = x_293; + } else { + let x_295 : i32 = k; + k = (x_295 + 1); + let x_297 : i32 = j; + j = (x_297 + 1); + let x_300 : i32 = data[x_297]; + temp[x_295] = x_300; + } + } + loop { + let x_306 : i32 = i; + let x_308 : i32 = i; + let x_309 : i32 = *(mid); + if (((x_306 < 10) && (x_308 <= x_309))) { + } else { + break; + } + let x_313 : i32 = k; + k = (x_313 + 1); + let x_315 : i32 = i; + i = (x_315 + 1); + let x_318 : i32 = data[x_315]; + temp[x_313] = x_318; + } + let x_320 : i32 = *(from); + i_1 = x_320; + loop { + let x_325 : i32 = i_1; + let x_326 : i32 = *(to); + if ((x_325 <= x_326)) { + } else { + break; + } + let x_329 : i32 = i_1; + let x_330 : i32 = i_1; + let x_332 : i32 = temp[x_330]; + data[x_329] = x_332; + + continuing { + let x_334 : i32 = i_1; + i_1 = (x_334 + 1); + } + } + return; +} + +fn mergeSort_() { + var low : i32; + var high : i32; + var m : i32; + var i_2 : i32; + var from_1 : i32; + var mid_1 : i32; + var to_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + low = 0; + high = 9; + m = 1; + loop { + let x_341 : i32 = m; + let x_342 : i32 = high; + if ((x_341 <= x_342)) { + } else { + break; + } + let x_345 : i32 = low; + i_2 = x_345; + loop { + let x_350 : i32 = i_2; + let x_351 : i32 = high; + if ((x_350 < x_351)) { + } else { + break; + } + let x_354 : i32 = i_2; + from_1 = x_354; + let x_355 : i32 = i_2; + let x_356 : i32 = m; + mid_1 = ((x_355 + x_356) - 1); + let x_359 : i32 = i_2; + let x_360 : i32 = m; + let x_364 : i32 = high; + to_1 = min(((x_359 + (2 * x_360)) - 1), x_364); + let x_366 : i32 = from_1; + param = x_366; + let x_367 : i32 = mid_1; + param_1 = x_367; + let x_368 : i32 = to_1; + param_2 = x_368; + merge_i1_i1_i1_(&(param), &(param_1), &(param_2)); + + continuing { + let x_370 : i32 = m; + let x_372 : i32 = i_2; + i_2 = (x_372 + (2 * x_370)); + } + } + + continuing { + let x_374 : i32 = m; + m = (2 * x_374); + } + } + return; +} + +fn main_1() { + var i_3 : i32; + var j_1 : i32; + var grey : f32; + var int_i : i32; + let x_85 : f32 = x_28.injectionSwitch.x; + i_3 = i32(x_85); + loop { + let x_91 : i32 = i_3; + switch(x_91) { + case 9: { + let x_121 : i32 = i_3; + data[x_121] = -5; + } + case 8: { + let x_119 : i32 = i_3; + data[x_119] = -4; + } + case 7: { + let x_117 : i32 = i_3; + data[x_117] = -3; + } + case 6: { + let x_115 : i32 = i_3; + data[x_115] = -2; + } + case 5: { + let x_113 : i32 = i_3; + data[x_113] = -1; + } + case 4: { + let x_111 : i32 = i_3; + data[x_111] = 0; + } + case 3: { + let x_109 : i32 = i_3; + data[x_109] = 1; + } + case 2: { + let x_107 : i32 = i_3; + data[x_107] = 2; + } + case 1: { + let x_105 : i32 = i_3; + data[x_105] = 3; + } + case 0: { + let x_103 : i32 = i_3; + data[x_103] = 4; + } + default: { + } + } + let x_123 : i32 = i_3; + i_3 = (x_123 + 1); + + continuing { + let x_125 : i32 = i_3; + if ((x_125 < 10)) { + } else { + break; + } + } + } + j_1 = 0; + loop { + let x_131 : i32 = j_1; + if ((x_131 < 10)) { + } else { + break; + } + let x_134 : i32 = j_1; + let x_135 : i32 = j_1; + let x_137 : i32 = data[x_135]; + temp[x_134] = x_137; + + continuing { + let x_139 : i32 = j_1; + j_1 = (x_139 + 1); + } + } + mergeSort_(); + let x_143 : f32 = gl_FragCoord.y; + if ((i32(x_143) < 30)) { + let x_150 : i32 = data[0]; + grey = (0.5 + (f32(x_150) / 10.0)); + } else { + let x_155 : f32 = gl_FragCoord.y; + if ((i32(x_155) < 60)) { + let x_162 : i32 = data[1]; + grey = (0.5 + (f32(x_162) / 10.0)); + } else { + let x_167 : f32 = gl_FragCoord.y; + if ((i32(x_167) < 90)) { + let x_174 : i32 = data[2]; + grey = (0.5 + (f32(x_174) / 10.0)); + } else { + let x_179 : f32 = gl_FragCoord.y; + if ((i32(x_179) < 120)) { + let x_186 : i32 = data[3]; + grey = (0.5 + (f32(x_186) / 10.0)); + } else { + let x_191 : f32 = gl_FragCoord.y; + if ((i32(x_191) < 150)) { + int_i = 1; + loop { + let x_201 : i32 = int_i; + let x_203 : f32 = x_28.injectionSwitch.x; + if ((x_201 > i32(x_203))) { + } else { + break; + } + discard; + } + } else { + let x_208 : f32 = gl_FragCoord.y; + if ((i32(x_208) < 180)) { + let x_215 : i32 = data[5]; + grey = (0.5 + (f32(x_215) / 10.0)); + } else { + let x_220 : f32 = gl_FragCoord.y; + if ((i32(x_220) < 210)) { + let x_227 : i32 = data[6]; + grey = (0.5 + (f32(x_227) / 10.0)); + } else { + let x_232 : f32 = gl_FragCoord.y; + if ((i32(x_232) < 240)) { + let x_239 : i32 = data[7]; + grey = (0.5 + (f32(x_239) / 10.0)); + } else { + let x_244 : f32 = gl_FragCoord.y; + if ((i32(x_244) < 270)) { + let x_251 : i32 = data[8]; + grey = (0.5 + (f32(x_251) / 10.0)); + } else { + discard; + } + } + } + } + } + } + } + } + } + let x_255 : f32 = grey; + let x_256 : vec3 = vec3(x_255, x_255, x_255); + x_GLF_color = vec4(x_256.x, x_256.y, x_256.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm new file mode 100644 index 0000000000..c5237977a7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm @@ -0,0 +1,524 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %swap_i1_i1_ "swap(i1;i1;" + OpName %i "i" + OpName %j "j" + OpName %performPartition_i1_i1_ "performPartition(i1;i1;" + OpName %l "l" + OpName %h "h" + OpName %quicksort_ "quicksort(" + OpName %temp "temp" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %pivot "pivot" + OpName %i_0 "i" + OpName %j_0 "j" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %l_0 "l" + OpName %h_0 "h" + OpName %top "top" + OpName %stack "stack" + OpName %int_a "int_a" + OpName %gl_FragCoord "gl_FragCoord" + OpName %clamp_a "clamp_a" + OpName %p "p" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %i_1 "i" + OpName %uv "uv" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %color "color" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %37 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %40 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %41 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %int_10 = OpConstant %int 10 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %70 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %37 + %85 = OpLabel + %i_1 = OpVariable %_ptr_Function_int Function + %uv = OpVariable %_ptr_Function_v2float Function + %color = OpVariable %_ptr_Function_v3float Function + OpStore %i_1 %int_0 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %87 %88 None + OpBranch %89 + %89 = OpLabel + %90 = OpLoad %int %i_1 + %91 = OpSLessThan %bool %90 %int_10 + OpBranchConditional %91 %92 %87 + %92 = OpLabel + %93 = OpLoad %int %i_1 + %94 = OpLoad %int %i_1 + %95 = OpISub %int %int_10 %94 + %96 = OpAccessChain %_ptr_Private_int %obj %int_0 %93 + OpStore %96 %95 + %97 = OpLoad %int %i_1 + %98 = OpLoad %int %i_1 + %99 = OpAccessChain %_ptr_Private_int %obj %int_0 %98 + %100 = OpLoad %int %99 + %101 = OpLoad %int %i_1 + %102 = OpAccessChain %_ptr_Private_int %obj %int_0 %101 + %103 = OpLoad %int %102 + %104 = OpIMul %int %100 %103 + %105 = OpAccessChain %_ptr_Private_int %obj %int_0 %97 + OpStore %105 %104 + OpBranch %88 + %88 = OpLabel + %106 = OpLoad %int %i_1 + %107 = OpIAdd %int %106 %int_1 + OpStore %i_1 %107 + OpBranch %86 + %87 = OpLabel + %108 = OpFunctionCall %void %quicksort_ + %109 = OpLoad %v4float %gl_FragCoord + %110 = OpVectorShuffle %v2float %109 %109 0 1 + %111 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %112 = OpLoad %v2float %111 + %113 = OpFDiv %v2float %110 %112 + OpStore %uv %113 + OpStore %color %70 + %114 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_0 + %115 = OpLoad %int %114 + %116 = OpConvertSToF %float %115 + %117 = OpAccessChain %_ptr_Function_float %color %uint_0 + %118 = OpLoad %float %117 + %119 = OpFAdd %float %118 %116 + %120 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %120 %119 + %121 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %122 = OpLoad %float %121 + %123 = OpFOrdGreaterThan %bool %122 %float_0_25 + OpSelectionMerge %124 None + OpBranchConditional %123 %125 %124 + %125 = OpLabel + %126 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_1 + %127 = OpLoad %int %126 + %128 = OpConvertSToF %float %127 + %129 = OpAccessChain %_ptr_Function_float %color %uint_0 + %130 = OpLoad %float %129 + %131 = OpFAdd %float %130 %128 + %132 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %132 %131 + OpBranch %124 + %124 = OpLabel + %133 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %134 = OpLoad %float %133 + %135 = OpFOrdGreaterThan %bool %134 %float_0_5 + OpSelectionMerge %136 None + OpBranchConditional %135 %137 %136 + %137 = OpLabel + %138 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_2 + %139 = OpLoad %int %138 + %140 = OpConvertSToF %float %139 + %141 = OpAccessChain %_ptr_Function_float %color %uint_1 + %142 = OpLoad %float %141 + %143 = OpFAdd %float %142 %140 + %144 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %144 %143 + OpBranch %136 + %136 = OpLabel + %145 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %146 = OpLoad %float %145 + %147 = OpFOrdGreaterThan %bool %146 %float_0_75 + OpSelectionMerge %148 None + OpBranchConditional %147 %149 %148 + %149 = OpLabel + %150 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_3 + %151 = OpLoad %int %150 + %152 = OpConvertSToF %float %151 + %153 = OpAccessChain %_ptr_Function_float %color %uint_2 + %154 = OpLoad %float %153 + %155 = OpFAdd %float %154 %152 + %156 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %156 %155 + OpBranch %148 + %148 = OpLabel + %157 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_4 + %158 = OpLoad %int %157 + %159 = OpConvertSToF %float %158 + %160 = OpAccessChain %_ptr_Function_float %color %uint_1 + %161 = OpLoad %float %160 + %162 = OpFAdd %float %161 %159 + %163 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %163 %162 + %164 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %165 = OpLoad %float %164 + %166 = OpFOrdGreaterThan %bool %165 %float_0_25 + OpSelectionMerge %167 None + OpBranchConditional %166 %168 %167 + %168 = OpLabel + %169 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_5 + %170 = OpLoad %int %169 + %171 = OpConvertSToF %float %170 + %172 = OpAccessChain %_ptr_Function_float %color %uint_0 + %173 = OpLoad %float %172 + %174 = OpFAdd %float %173 %171 + %175 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %175 %174 + OpBranch %167 + %167 = OpLabel + %176 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %177 = OpLoad %float %176 + %178 = OpFOrdGreaterThan %bool %177 %float_0_5 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %179 + %180 = OpLabel + %181 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_6 + %182 = OpLoad %int %181 + %183 = OpConvertSToF %float %182 + %184 = OpAccessChain %_ptr_Function_float %color %uint_1 + %185 = OpLoad %float %184 + %186 = OpFAdd %float %185 %183 + %187 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %187 %186 + OpBranch %179 + %179 = OpLabel + %188 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %189 = OpLoad %float %188 + %190 = OpFOrdGreaterThan %bool %189 %float_0_75 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %191 + %192 = OpLabel + %193 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_7 + %194 = OpLoad %int %193 + %195 = OpConvertSToF %float %194 + %196 = OpAccessChain %_ptr_Function_float %color %uint_2 + %197 = OpLoad %float %196 + %198 = OpFAdd %float %197 %195 + %199 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %199 %198 + OpBranch %191 + %191 = OpLabel + %200 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_8 + %201 = OpLoad %int %200 + %202 = OpConvertSToF %float %201 + %203 = OpAccessChain %_ptr_Function_float %color %uint_2 + %204 = OpLoad %float %203 + %205 = OpFAdd %float %204 %202 + %206 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %206 %205 + %207 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %208 = OpLoad %float %207 + %209 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %210 = OpLoad %float %209 + %211 = OpFSub %float %208 %210 + %212 = OpExtInst %float %1 FAbs %211 + %213 = OpFOrdLessThan %bool %212 %float_0_25 + OpSelectionMerge %214 None + OpBranchConditional %213 %215 %214 + %215 = OpLabel + %216 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_9 + %217 = OpLoad %int %216 + %218 = OpConvertSToF %float %217 + %219 = OpAccessChain %_ptr_Function_float %color %uint_0 + %220 = OpLoad %float %219 + %221 = OpFAdd %float %220 %218 + %222 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %222 %221 + OpBranch %214 + %214 = OpLabel + %223 = OpLoad %v3float %color + %224 = OpExtInst %v3float %1 Normalize %223 + %225 = OpCompositeExtract %float %224 0 + %226 = OpCompositeExtract %float %224 1 + %227 = OpCompositeExtract %float %224 2 + %228 = OpCompositeConstruct %v4float %225 %226 %227 %float_1 + OpStore %_GLF_color %228 + OpReturn + OpFunctionEnd +%swap_i1_i1_ = OpFunction %void None %40 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %229 = OpLabel + %temp = OpVariable %_ptr_Function_int Function + %230 = OpLoad %int %i + %231 = OpAccessChain %_ptr_Private_int %obj %int_0 %230 + %232 = OpLoad %int %231 + OpStore %temp %232 + %233 = OpLoad %int %i + %234 = OpLoad %int %j + %235 = OpAccessChain %_ptr_Private_int %obj %int_0 %234 + %236 = OpLoad %int %235 + %237 = OpAccessChain %_ptr_Private_int %obj %int_0 %233 + OpStore %237 %236 + %238 = OpLoad %int %j + %239 = OpLoad %int %temp + %240 = OpAccessChain %_ptr_Private_int %obj %int_0 %238 + OpStore %240 %239 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %41 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %241 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_int Function + %242 = OpLoad %int %h + %243 = OpAccessChain %_ptr_Private_int %obj %int_0 %242 + %244 = OpLoad %int %243 + OpStore %pivot %244 + %245 = OpLoad %int %l + %246 = OpISub %int %245 %int_1 + OpStore %i_0 %246 + %247 = OpLoad %int %l + OpStore %j_0 %247 + OpBranch %248 + %248 = OpLabel + OpLoopMerge %249 %250 None + OpBranch %251 + %251 = OpLabel + %252 = OpLoad %int %j_0 + %253 = OpLoad %int %h + %254 = OpISub %int %253 %int_1 + %255 = OpSLessThanEqual %bool %252 %254 + OpBranchConditional %255 %256 %249 + %256 = OpLabel + %257 = OpLoad %int %j_0 + %258 = OpAccessChain %_ptr_Private_int %obj %int_0 %257 + %259 = OpLoad %int %258 + %260 = OpLoad %int %pivot + %261 = OpSLessThanEqual %bool %259 %260 + OpSelectionMerge %262 None + OpBranchConditional %261 %263 %262 + %263 = OpLabel + %264 = OpLoad %int %i_0 + %265 = OpIAdd %int %264 %int_1 + OpStore %i_0 %265 + %266 = OpLoad %int %i_0 + OpStore %param %266 + %267 = OpLoad %int %j_0 + OpStore %param_0 %267 + %268 = OpFunctionCall %void %swap_i1_i1_ %param %param_0 + OpBranch %262 + %262 = OpLabel + OpBranch %250 + %250 = OpLabel + %269 = OpLoad %int %j_0 + %270 = OpIAdd %int %269 %int_1 + OpStore %j_0 %270 + OpBranch %248 + %249 = OpLabel + %271 = OpLoad %int %i_0 + %272 = OpIAdd %int %271 %int_1 + OpStore %i_0 %272 + %273 = OpLoad %int %i_0 + OpStore %param_1 %273 + %274 = OpLoad %int %h + OpStore %param_2 %274 + %275 = OpFunctionCall %void %swap_i1_i1_ %param_1 %param_2 + %276 = OpLoad %int %i_0 + OpReturnValue %276 + OpFunctionEnd + %quicksort_ = OpFunction %void None %37 + %277 = OpLabel + %l_0 = OpVariable %_ptr_Function_int Function + %h_0 = OpVariable %_ptr_Function_int Function + %top = OpVariable %_ptr_Function_int Function + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function + %int_a = OpVariable %_ptr_Function_int Function + %278 = OpVariable %_ptr_Function_int Function + %279 = OpVariable %_ptr_Function_int Function + %clamp_a = OpVariable %_ptr_Function_int Function + %p = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_int Function + %param_4 = OpVariable %_ptr_Function_int Function + OpStore %l_0 %int_0 + OpStore %h_0 %int_9 + OpStore %top %int_n1 + %280 = OpLoad %int %top + %281 = OpIAdd %int %280 %int_1 + OpStore %top %281 + %282 = OpLoad %int %l_0 + %283 = OpAccessChain %_ptr_Function_int %stack %281 + OpStore %283 %282 + %284 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %285 = OpLoad %float %284 + %286 = OpFOrdGreaterThanEqual %bool %285 %float_0 + OpSelectionMerge %287 None + OpBranchConditional %286 %288 %289 + %288 = OpLabel + %290 = OpLoad %int %h_0 + OpSelectionMerge %291 None + OpBranchConditional %false %292 %293 + %292 = OpLabel + OpStore %279 %int_1 + OpBranch %291 + %293 = OpLabel + %294 = OpLoad %int %h_0 + %295 = OpShiftLeftLogical %int %294 %int_0 + OpStore %279 %295 + OpBranch %291 + %291 = OpLabel + %296 = OpLoad %int %279 + %297 = OpBitwiseOr %int %290 %296 + OpStore %278 %297 + OpBranch %287 + %289 = OpLabel + OpStore %278 %int_1 + OpBranch %287 + %287 = OpLabel + %298 = OpLoad %int %278 + OpStore %int_a %298 + %299 = OpLoad %int %h_0 + %300 = OpLoad %int %h_0 + %301 = OpLoad %int %int_a + %302 = OpExtInst %int %1 SClamp %299 %300 %301 + OpStore %clamp_a %302 + %303 = OpLoad %int %top + %304 = OpIAdd %int %303 %int_1 + OpStore %top %304 + %305 = OpLoad %int %clamp_a + %306 = OpSDiv %int %305 %int_1 + %307 = OpAccessChain %_ptr_Function_int %stack %304 + OpStore %307 %306 + OpBranch %308 + %308 = OpLabel + OpLoopMerge %309 %310 None + OpBranch %311 + %311 = OpLabel + %312 = OpLoad %int %top + %313 = OpSGreaterThanEqual %bool %312 %int_0 + OpBranchConditional %313 %314 %309 + %314 = OpLabel + %315 = OpLoad %int %top + %316 = OpISub %int %315 %int_1 + OpStore %top %316 + %317 = OpAccessChain %_ptr_Function_int %stack %315 + %318 = OpLoad %int %317 + OpStore %h_0 %318 + %319 = OpLoad %int %top + %320 = OpISub %int %319 %int_1 + OpStore %top %320 + %321 = OpAccessChain %_ptr_Function_int %stack %319 + %322 = OpLoad %int %321 + OpStore %l_0 %322 + %323 = OpLoad %int %l_0 + OpStore %param_3 %323 + %324 = OpLoad %int %h_0 + OpStore %param_4 %324 + %325 = OpFunctionCall %int %performPartition_i1_i1_ %param_3 %param_4 + OpStore %p %325 + %326 = OpLoad %int %p + %327 = OpISub %int %326 %int_1 + %328 = OpLoad %int %l_0 + %329 = OpSGreaterThan %bool %327 %328 + OpSelectionMerge %330 None + OpBranchConditional %329 %331 %330 + %331 = OpLabel + %332 = OpLoad %int %top + %333 = OpIAdd %int %332 %int_1 + OpStore %top %333 + %334 = OpLoad %int %l_0 + %335 = OpAccessChain %_ptr_Function_int %stack %333 + OpStore %335 %334 + %336 = OpLoad %int %top + %337 = OpIAdd %int %336 %int_1 + OpStore %top %337 + %338 = OpLoad %int %p + %339 = OpISub %int %338 %int_1 + %340 = OpAccessChain %_ptr_Function_int %stack %337 + OpStore %340 %339 + OpBranch %330 + %330 = OpLabel + %341 = OpLoad %int %p + %342 = OpIAdd %int %341 %int_1 + %343 = OpLoad %int %h_0 + %344 = OpSLessThan %bool %342 %343 + OpSelectionMerge %345 None + OpBranchConditional %344 %346 %345 + %346 = OpLabel + %347 = OpLoad %int %top + %348 = OpIAdd %int %347 %int_1 + OpStore %top %348 + %349 = OpLoad %int %p + %350 = OpIAdd %int %349 %int_1 + %351 = OpAccessChain %_ptr_Function_int %stack %348 + OpStore %351 %350 + %352 = OpLoad %int %top + %353 = OpIAdd %int %352 %int_1 + OpStore %top %353 + %354 = OpLoad %int %h_0 + %355 = OpAccessChain %_ptr_Function_int %stack %353 + OpStore %355 %354 + OpBranch %345 + %345 = OpLabel + OpBranch %310 + %310 = OpLabel + OpBranch %308 + %309 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..7c360661e5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.hlsl @@ -0,0 +1,232 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_34 : register(b0, space0) { + uint4 x_34[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_230 = i; + const int x_232 = obj.numbers[x_230]; + temp = x_232; + const int x_233 = i; + const int x_234 = j; + const int x_236 = obj.numbers[x_234]; + obj.numbers[x_233] = x_236; + const int x_238 = j; + obj.numbers[x_238] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_242 = h; + const int x_244 = obj.numbers[x_242]; + pivot = x_244; + const int x_245 = l; + i_1 = (x_245 - 1); + const int x_247 = l; + j_1 = x_247; + while (true) { + const int x_252 = j_1; + const int x_253 = h; + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + const int x_259 = obj.numbers[j_1]; + if ((x_259 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + i_1 = (i_1 + 1); + param_2 = i_1; + const int x_274 = h; + param_3 = x_274; + swap_i1_i1_(param_2, param_3); + return i_1; +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int int_a = 0; + int x_278 = 0; + int x_279 = 0; + int clamp_a = 0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_281 = (top + 1); + top = x_281; + stack[x_281] = l_1; + const float x_285 = gl_FragCoord.y; + if ((x_285 >= 0.0f)) { + const int x_290 = h_1; + if (false) { + x_279 = 1; + } else { + x_279 = (h_1 << asuint(0)); + } + x_278 = (x_290 | x_279); + } else { + x_278 = 1; + } + int_a = x_278; + clamp_a = clamp(h_1, h_1, int_a); + const int x_304 = (top + 1); + top = x_304; + stack[x_304] = (clamp_a / 1); + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_315 = top; + top = (x_315 - 1); + const int x_318 = stack[x_315]; + h_1 = x_318; + const int x_319 = top; + top = (x_319 - 1); + const int x_322 = stack[x_319]; + l_1 = x_322; + param_4 = l_1; + param_5 = h_1; + const int x_325 = performPartition_i1_i1_(param_4, param_5); + p = x_325; + if (((p - 1) > l_1)) { + const int x_333 = (top + 1); + top = x_333; + stack[x_333] = l_1; + const int x_337 = (top + 1); + top = x_337; + stack[x_337] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_348 = (top + 1); + top = x_348; + stack[x_348] = (p + 1); + const int x_353 = (top + 1); + top = x_353; + stack[x_353] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_97 = i_2; + const int x_100 = obj.numbers[i_2]; + const int x_103 = obj.numbers[i_2]; + obj.numbers[x_97] = (x_100 * x_103); + } + } + quicksort_(); + const float4 x_109 = gl_FragCoord; + const float2 x_112 = asfloat(x_34[0].xy); + uv = (float2(x_109.x, x_109.y) / x_112); + color = float3(1.0f, 2.0f, 3.0f); + const int x_115 = obj.numbers[0]; + const float x_118 = color.x; + color.x = (x_118 + float(x_115)); + const float x_122 = uv.x; + if ((x_122 > 0.25f)) { + const int x_127 = obj.numbers[1]; + const float x_130 = color.x; + color.x = (x_130 + float(x_127)); + } + const float x_134 = uv.x; + if ((x_134 > 0.5f)) { + const int x_139 = obj.numbers[2]; + const float x_142 = color.y; + color.y = (x_142 + float(x_139)); + } + const float x_146 = uv.x; + if ((x_146 > 0.75f)) { + const int x_151 = obj.numbers[3]; + const float x_154 = color.z; + color.z = (x_154 + float(x_151)); + } + const int x_158 = obj.numbers[4]; + const float x_161 = color.y; + color.y = (x_161 + float(x_158)); + const float x_165 = uv.y; + if ((x_165 > 0.25f)) { + const int x_170 = obj.numbers[5]; + const float x_173 = color.x; + color.x = (x_173 + float(x_170)); + } + const float x_177 = uv.y; + if ((x_177 > 0.5f)) { + const int x_182 = obj.numbers[6]; + const float x_185 = color.y; + color.y = (x_185 + float(x_182)); + } + const float x_189 = uv.y; + if ((x_189 > 0.75f)) { + const int x_194 = obj.numbers[7]; + const float x_197 = color.z; + color.z = (x_197 + float(x_194)); + } + const int x_201 = obj.numbers[8]; + const float x_204 = color.z; + color.z = (x_204 + float(x_201)); + const float x_208 = uv.x; + const float x_210 = uv.y; + if ((abs((x_208 - x_210)) < 0.25f)) { + const int x_217 = obj.numbers[9]; + const float x_220 = color.x; + color.x = (x_220 + float(x_217)); + } + const float3 x_224 = normalize(color); + x_GLF_color = float4(x_224.x, x_224.y, x_224.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.msl new file mode 100644 index 0000000000..825cedb9e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.msl @@ -0,0 +1,280 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_5) { + int temp = 0; + int const x_230 = *(i); + int const x_232 = (*(tint_symbol_5)).numbers.arr[x_230]; + temp = x_232; + int const x_233 = *(i); + int const x_234 = *(j); + int const x_236 = (*(tint_symbol_5)).numbers.arr[x_234]; + (*(tint_symbol_5)).numbers.arr[x_233] = x_236; + int const x_238 = *(j); + int const x_239 = temp; + (*(tint_symbol_5)).numbers.arr[x_238] = x_239; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_6) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_242 = *(h); + int const x_244 = (*(tint_symbol_6)).numbers.arr[x_242]; + pivot = x_244; + int const x_245 = *(l); + i_1 = (x_245 - 1); + int const x_247 = *(l); + j_1 = x_247; + while (true) { + int const x_252 = j_1; + int const x_253 = *(h); + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + int const x_257 = j_1; + int const x_259 = (*(tint_symbol_6)).numbers.arr[x_257]; + int const x_260 = pivot; + if ((x_259 <= x_260)) { + int const x_264 = i_1; + i_1 = (x_264 + 1); + int const x_266 = i_1; + param = x_266; + int const x_267 = j_1; + param_1 = x_267; + swap_i1_i1_(&(param), &(param_1), tint_symbol_6); + } + { + int const x_269 = j_1; + j_1 = (x_269 + 1); + } + } + int const x_271 = i_1; + i_1 = (x_271 + 1); + int const x_273 = i_1; + param_2 = x_273; + int const x_274 = *(h); + param_3 = x_274; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_6); + int const x_276 = i_1; + return x_276; +} + +void quicksort_(thread float4* const tint_symbol_7, thread QuicksortObject* const tint_symbol_8) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int int_a = 0; + int x_278 = 0; + int x_279 = 0; + int clamp_a = 0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_280 = top; + int const x_281 = (x_280 + 1); + top = x_281; + int const x_282 = l_1; + stack.arr[x_281] = x_282; + float const x_285 = (*(tint_symbol_7)).y; + if ((x_285 >= 0.0f)) { + int const x_290 = h_1; + if (false) { + x_279 = 1; + } else { + int const x_294 = h_1; + x_279 = (x_294 << as_type(0)); + } + int const x_296 = x_279; + x_278 = (x_290 | x_296); + } else { + x_278 = 1; + } + int const x_298 = x_278; + int_a = x_298; + int const x_299 = h_1; + int const x_300 = h_1; + int const x_301 = int_a; + clamp_a = clamp(x_299, x_300, x_301); + int const x_303 = top; + int const x_304 = (x_303 + 1); + top = x_304; + int const x_305 = clamp_a; + stack.arr[x_304] = (x_305 / 1); + while (true) { + int const x_312 = top; + if ((x_312 >= 0)) { + } else { + break; + } + int const x_315 = top; + top = (x_315 - 1); + int const x_318 = stack.arr[x_315]; + h_1 = x_318; + int const x_319 = top; + top = (x_319 - 1); + int const x_322 = stack.arr[x_319]; + l_1 = x_322; + int const x_323 = l_1; + param_4 = x_323; + int const x_324 = h_1; + param_5 = x_324; + int const x_325 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_8); + p = x_325; + int const x_326 = p; + int const x_328 = l_1; + if (((x_326 - 1) > x_328)) { + int const x_332 = top; + int const x_333 = (x_332 + 1); + top = x_333; + int const x_334 = l_1; + stack.arr[x_333] = x_334; + int const x_336 = top; + int const x_337 = (x_336 + 1); + top = x_337; + int const x_338 = p; + stack.arr[x_337] = (x_338 - 1); + } + int const x_341 = p; + int const x_343 = h_1; + if (((x_341 + 1) < x_343)) { + int const x_347 = top; + int const x_348 = (x_347 + 1); + top = x_348; + int const x_349 = p; + stack.arr[x_348] = (x_349 + 1); + int const x_352 = top; + int const x_353 = (x_352 + 1); + top = x_353; + int const x_354 = h_1; + stack.arr[x_353] = x_354; + } + } + return; +} + +void main_1(constant buf0& x_34, thread QuicksortObject* const tint_symbol_9, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) { + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + i_2 = 0; + while (true) { + int const x_90 = i_2; + if ((x_90 < 10)) { + } else { + break; + } + int const x_93 = i_2; + int const x_94 = i_2; + (*(tint_symbol_9)).numbers.arr[x_93] = (10 - x_94); + int const x_97 = i_2; + int const x_98 = i_2; + int const x_100 = (*(tint_symbol_9)).numbers.arr[x_98]; + int const x_101 = i_2; + int const x_103 = (*(tint_symbol_9)).numbers.arr[x_101]; + (*(tint_symbol_9)).numbers.arr[x_97] = (x_100 * x_103); + { + int const x_106 = i_2; + i_2 = (x_106 + 1); + } + } + quicksort_(tint_symbol_10, tint_symbol_9); + float4 const x_109 = *(tint_symbol_10); + float2 const x_112 = x_34.resolution; + uv = (float2(x_109.x, x_109.y) / x_112); + color = float3(1.0f, 2.0f, 3.0f); + int const x_115 = (*(tint_symbol_9)).numbers.arr[0]; + float const x_118 = color.x; + color.x = (x_118 + float(x_115)); + float const x_122 = uv.x; + if ((x_122 > 0.25f)) { + int const x_127 = (*(tint_symbol_9)).numbers.arr[1]; + float const x_130 = color.x; + color.x = (x_130 + float(x_127)); + } + float const x_134 = uv.x; + if ((x_134 > 0.5f)) { + int const x_139 = (*(tint_symbol_9)).numbers.arr[2]; + float const x_142 = color.y; + color.y = (x_142 + float(x_139)); + } + float const x_146 = uv.x; + if ((x_146 > 0.75f)) { + int const x_151 = (*(tint_symbol_9)).numbers.arr[3]; + float const x_154 = color.z; + color.z = (x_154 + float(x_151)); + } + int const x_158 = (*(tint_symbol_9)).numbers.arr[4]; + float const x_161 = color.y; + color.y = (x_161 + float(x_158)); + float const x_165 = uv.y; + if ((x_165 > 0.25f)) { + int const x_170 = (*(tint_symbol_9)).numbers.arr[5]; + float const x_173 = color.x; + color.x = (x_173 + float(x_170)); + } + float const x_177 = uv.y; + if ((x_177 > 0.5f)) { + int const x_182 = (*(tint_symbol_9)).numbers.arr[6]; + float const x_185 = color.y; + color.y = (x_185 + float(x_182)); + } + float const x_189 = uv.y; + if ((x_189 > 0.75f)) { + int const x_194 = (*(tint_symbol_9)).numbers.arr[7]; + float const x_197 = color.z; + color.z = (x_197 + float(x_194)); + } + int const x_201 = (*(tint_symbol_9)).numbers.arr[8]; + float const x_204 = color.z; + color.z = (x_204 + float(x_201)); + float const x_208 = uv.x; + float const x_210 = uv.y; + if ((fabs((x_208 - x_210)) < 0.25f)) { + int const x_217 = (*(tint_symbol_9)).numbers.arr[9]; + float const x_220 = color.x; + color.x = (x_220 + float(x_217)); + } + float3 const x_223 = color; + float3 const x_224 = normalize(x_223); + *(tint_symbol_11) = float4(x_224.x, x_224.y, x_224.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_34 [[buffer(0)]]) { + thread float4 tint_symbol_12 = 0.0f; + thread QuicksortObject tint_symbol_13 = {}; + thread float4 tint_symbol_14 = 0.0f; + tint_symbol_12 = gl_FragCoord_param; + main_1(x_34, &(tint_symbol_13), &(tint_symbol_12), &(tint_symbol_14)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_14}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..003a32d79e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.spvasm @@ -0,0 +1,587 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 402 +; Schema: 0 + OpCapability Shader + %156 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_34 "x_34" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %int_a "int_a" + OpName %x_278 "x_278" + OpName %x_279 "x_279" + OpName %clamp_a "clamp_a" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_34 NonWritable + OpDecorate %x_34 DescriptorSet 0 + OpDecorate %x_34 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %8 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %13 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_34 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %31 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %49 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %109 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %117 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool +%_ptr_Function_v2float = OpTypePointer Function %v2float + %219 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %223 = OpConstantNull %v3float + %int_10 = OpConstant %int 10 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %261 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float + %389 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %23 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %29 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %31 + %33 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Private_int %obj %uint_0 %33 + %37 = OpLoad %int %36 + OpStore %temp %37 + %39 = OpLoad %int %i + %41 = OpLoad %int %j + %42 = OpAccessChain %_ptr_Private_int %obj %uint_0 %41 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Private_int %obj %uint_0 %39 + OpStore %44 %43 + %46 = OpLoad %int %j + %47 = OpLoad %int %temp + %48 = OpAccessChain %_ptr_Private_int %obj %uint_0 %46 + OpStore %48 %47 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %49 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %53 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %31 + %i_1 = OpVariable %_ptr_Function_int Function %31 + %j_1 = OpVariable %_ptr_Function_int Function %31 + %param = OpVariable %_ptr_Function_int Function %31 + %param_1 = OpVariable %_ptr_Function_int Function %31 + %param_2 = OpVariable %_ptr_Function_int Function %31 + %param_3 = OpVariable %_ptr_Function_int Function %31 + %62 = OpLoad %int %h + %63 = OpAccessChain %_ptr_Private_int %obj %uint_0 %62 + %64 = OpLoad %int %63 + OpStore %pivot %64 + %66 = OpLoad %int %l + %68 = OpISub %int %66 %int_1 + OpStore %i_1 %68 + %70 = OpLoad %int %l + OpStore %j_1 %70 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %int %j_1 + %77 = OpLoad %int %h + %78 = OpISub %int %77 %int_1 + %79 = OpSLessThanEqual %bool %75 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %72 + %81 = OpLabel + %84 = OpLoad %int %j_1 + %85 = OpAccessChain %_ptr_Private_int %obj %uint_0 %84 + %86 = OpLoad %int %85 + %87 = OpLoad %int %pivot + %88 = OpSLessThanEqual %bool %86 %87 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + %91 = OpLoad %int %i_1 + %92 = OpIAdd %int %91 %int_1 + OpStore %i_1 %92 + %93 = OpLoad %int %i_1 + OpStore %param %93 + %94 = OpLoad %int %j_1 + OpStore %param_1 %94 + %95 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %89 + %89 = OpLabel + OpBranch %73 + %73 = OpLabel + %98 = OpLoad %int %j_1 + %99 = OpIAdd %int %98 %int_1 + OpStore %j_1 %99 + OpBranch %71 + %72 = OpLabel + %100 = OpLoad %int %i_1 + %101 = OpIAdd %int %100 %int_1 + OpStore %i_1 %101 + %102 = OpLoad %int %i_1 + OpStore %param_2 %102 + %104 = OpLoad %int %h + OpStore %param_3 %104 + %105 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %108 = OpLoad %int %i_1 + OpReturnValue %108 + OpFunctionEnd + %quicksort_ = OpFunction %void None %109 + %111 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %31 + %h_1 = OpVariable %_ptr_Function_int Function %31 + %top = OpVariable %_ptr_Function_int Function %31 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %117 + %int_a = OpVariable %_ptr_Function_int Function %31 + %x_278 = OpVariable %_ptr_Function_int Function %31 + %x_279 = OpVariable %_ptr_Function_int Function %31 + %clamp_a = OpVariable %_ptr_Function_int Function %31 + %p = OpVariable %_ptr_Function_int Function %31 + %param_4 = OpVariable %_ptr_Function_int Function %31 + %param_5 = OpVariable %_ptr_Function_int Function %31 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %128 = OpLoad %int %top + %129 = OpIAdd %int %128 %int_1 + OpStore %top %129 + %130 = OpLoad %int %l_1 + %131 = OpAccessChain %_ptr_Function_int %stack %129 + OpStore %131 %130 + %134 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %135 = OpLoad %float %134 + %137 = OpFOrdGreaterThanEqual %bool %135 %float_0 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %140 + %139 = OpLabel + %141 = OpLoad %int %h_1 + OpSelectionMerge %143 None + OpBranchConditional %false %144 %145 + %144 = OpLabel + OpStore %x_279 %int_1 + OpBranch %143 + %145 = OpLabel + %146 = OpLoad %int %h_1 + %147 = OpBitcast %uint %int_0 + %148 = OpShiftLeftLogical %int %146 %147 + OpStore %x_279 %148 + OpBranch %143 + %143 = OpLabel + %149 = OpLoad %int %x_279 + %150 = OpBitwiseOr %int %141 %149 + OpStore %x_278 %150 + OpBranch %138 + %140 = OpLabel + OpStore %x_278 %int_1 + OpBranch %138 + %138 = OpLabel + %151 = OpLoad %int %x_278 + OpStore %int_a %151 + %152 = OpLoad %int %h_1 + %153 = OpLoad %int %h_1 + %154 = OpLoad %int %int_a + %155 = OpExtInst %int %156 SClamp %152 %153 %154 + OpStore %clamp_a %155 + %157 = OpLoad %int %top + %158 = OpIAdd %int %157 %int_1 + OpStore %top %158 + %159 = OpLoad %int %clamp_a + %160 = OpAccessChain %_ptr_Function_int %stack %158 + %161 = OpSDiv %int %159 %int_1 + OpStore %160 %161 + OpBranch %162 + %162 = OpLabel + OpLoopMerge %163 %164 None + OpBranch %165 + %165 = OpLabel + %166 = OpLoad %int %top + %167 = OpSGreaterThanEqual %bool %166 %int_0 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %163 + %168 = OpLabel + %171 = OpLoad %int %top + %172 = OpISub %int %171 %int_1 + OpStore %top %172 + %173 = OpAccessChain %_ptr_Function_int %stack %171 + %174 = OpLoad %int %173 + OpStore %h_1 %174 + %175 = OpLoad %int %top + %176 = OpISub %int %175 %int_1 + OpStore %top %176 + %177 = OpAccessChain %_ptr_Function_int %stack %175 + %178 = OpLoad %int %177 + OpStore %l_1 %178 + %179 = OpLoad %int %l_1 + OpStore %param_4 %179 + %180 = OpLoad %int %h_1 + OpStore %param_5 %180 + %181 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %181 + %184 = OpLoad %int %p + %185 = OpLoad %int %l_1 + %186 = OpISub %int %184 %int_1 + %187 = OpSGreaterThan %bool %186 %185 + OpSelectionMerge %188 None + OpBranchConditional %187 %189 %188 + %189 = OpLabel + %190 = OpLoad %int %top + %191 = OpIAdd %int %190 %int_1 + OpStore %top %191 + %192 = OpLoad %int %l_1 + %193 = OpAccessChain %_ptr_Function_int %stack %191 + OpStore %193 %192 + %194 = OpLoad %int %top + %195 = OpIAdd %int %194 %int_1 + OpStore %top %195 + %196 = OpLoad %int %p + %197 = OpAccessChain %_ptr_Function_int %stack %195 + %198 = OpISub %int %196 %int_1 + OpStore %197 %198 + OpBranch %188 + %188 = OpLabel + %199 = OpLoad %int %p + %200 = OpLoad %int %h_1 + %201 = OpIAdd %int %199 %int_1 + %202 = OpSLessThan %bool %201 %200 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %203 + %204 = OpLabel + %205 = OpLoad %int %top + %206 = OpIAdd %int %205 %int_1 + OpStore %top %206 + %207 = OpLoad %int %p + %208 = OpAccessChain %_ptr_Function_int %stack %206 + %209 = OpIAdd %int %207 %int_1 + OpStore %208 %209 + %210 = OpLoad %int %top + %211 = OpIAdd %int %210 %int_1 + OpStore %top %211 + %212 = OpLoad %int %h_1 + %213 = OpAccessChain %_ptr_Function_int %stack %211 + OpStore %213 %212 + OpBranch %203 + %203 = OpLabel + OpBranch %164 + %164 = OpLabel + OpBranch %162 + %163 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %109 + %215 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %31 + %uv = OpVariable %_ptr_Function_v2float Function %219 + %color = OpVariable %_ptr_Function_v3float Function %223 + OpStore %i_2 %int_0 + OpBranch %224 + %224 = OpLabel + OpLoopMerge %225 %226 None + OpBranch %227 + %227 = OpLabel + %228 = OpLoad %int %i_2 + %230 = OpSLessThan %bool %228 %int_10 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %233 + %232 = OpLabel + OpBranch %231 + %233 = OpLabel + OpBranch %225 + %231 = OpLabel + %234 = OpLoad %int %i_2 + %235 = OpLoad %int %i_2 + %236 = OpAccessChain %_ptr_Private_int %obj %uint_0 %234 + %237 = OpISub %int %int_10 %235 + OpStore %236 %237 + %238 = OpLoad %int %i_2 + %239 = OpLoad %int %i_2 + %240 = OpAccessChain %_ptr_Private_int %obj %uint_0 %239 + %241 = OpLoad %int %240 + %242 = OpLoad %int %i_2 + %243 = OpAccessChain %_ptr_Private_int %obj %uint_0 %242 + %244 = OpLoad %int %243 + %245 = OpAccessChain %_ptr_Private_int %obj %uint_0 %238 + %246 = OpIMul %int %241 %244 + OpStore %245 %246 + OpBranch %226 + %226 = OpLabel + %247 = OpLoad %int %i_2 + %248 = OpIAdd %int %247 %int_1 + OpStore %i_2 %248 + OpBranch %224 + %225 = OpLabel + %249 = OpFunctionCall %void %quicksort_ + %250 = OpLoad %v4float %gl_FragCoord + %252 = OpAccessChain %_ptr_Uniform_v2float %x_34 %uint_0 + %253 = OpLoad %v2float %252 + %254 = OpCompositeExtract %float %250 0 + %255 = OpCompositeExtract %float %250 1 + %256 = OpCompositeConstruct %v2float %254 %255 + %257 = OpFDiv %v2float %256 %253 + OpStore %uv %257 + OpStore %color %261 + %262 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %263 = OpLoad %int %262 + %265 = OpAccessChain %_ptr_Function_float %color %uint_0 + %266 = OpLoad %float %265 + %267 = OpAccessChain %_ptr_Function_float %color %uint_0 + %268 = OpConvertSToF %float %263 + %269 = OpFAdd %float %266 %268 + OpStore %267 %269 + %270 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %271 = OpLoad %float %270 + %273 = OpFOrdGreaterThan %bool %271 %float_0_25 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %274 + %275 = OpLabel + %276 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %277 = OpLoad %int %276 + %278 = OpAccessChain %_ptr_Function_float %color %uint_0 + %279 = OpLoad %float %278 + %280 = OpAccessChain %_ptr_Function_float %color %uint_0 + %281 = OpConvertSToF %float %277 + %282 = OpFAdd %float %279 %281 + OpStore %280 %282 + OpBranch %274 + %274 = OpLabel + %283 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %284 = OpLoad %float %283 + %286 = OpFOrdGreaterThan %bool %284 %float_0_5 + OpSelectionMerge %287 None + OpBranchConditional %286 %288 %287 + %288 = OpLabel + %290 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %291 = OpLoad %int %290 + %292 = OpAccessChain %_ptr_Function_float %color %uint_1 + %293 = OpLoad %float %292 + %294 = OpAccessChain %_ptr_Function_float %color %uint_1 + %295 = OpConvertSToF %float %291 + %296 = OpFAdd %float %293 %295 + OpStore %294 %296 + OpBranch %287 + %287 = OpLabel + %297 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %298 = OpLoad %float %297 + %300 = OpFOrdGreaterThan %bool %298 %float_0_75 + OpSelectionMerge %301 None + OpBranchConditional %300 %302 %301 + %302 = OpLabel + %304 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %305 = OpLoad %int %304 + %307 = OpAccessChain %_ptr_Function_float %color %uint_2 + %308 = OpLoad %float %307 + %309 = OpAccessChain %_ptr_Function_float %color %uint_2 + %310 = OpConvertSToF %float %305 + %311 = OpFAdd %float %308 %310 + OpStore %309 %311 + OpBranch %301 + %301 = OpLabel + %313 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %314 = OpLoad %int %313 + %315 = OpAccessChain %_ptr_Function_float %color %uint_1 + %316 = OpLoad %float %315 + %317 = OpAccessChain %_ptr_Function_float %color %uint_1 + %318 = OpConvertSToF %float %314 + %319 = OpFAdd %float %316 %318 + OpStore %317 %319 + %320 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %321 = OpLoad %float %320 + %322 = OpFOrdGreaterThan %bool %321 %float_0_25 + OpSelectionMerge %323 None + OpBranchConditional %322 %324 %323 + %324 = OpLabel + %326 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %327 = OpLoad %int %326 + %328 = OpAccessChain %_ptr_Function_float %color %uint_0 + %329 = OpLoad %float %328 + %330 = OpAccessChain %_ptr_Function_float %color %uint_0 + %331 = OpConvertSToF %float %327 + %332 = OpFAdd %float %329 %331 + OpStore %330 %332 + OpBranch %323 + %323 = OpLabel + %333 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %334 = OpLoad %float %333 + %335 = OpFOrdGreaterThan %bool %334 %float_0_5 + OpSelectionMerge %336 None + OpBranchConditional %335 %337 %336 + %337 = OpLabel + %339 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %340 = OpLoad %int %339 + %341 = OpAccessChain %_ptr_Function_float %color %uint_1 + %342 = OpLoad %float %341 + %343 = OpAccessChain %_ptr_Function_float %color %uint_1 + %344 = OpConvertSToF %float %340 + %345 = OpFAdd %float %342 %344 + OpStore %343 %345 + OpBranch %336 + %336 = OpLabel + %346 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %347 = OpLoad %float %346 + %348 = OpFOrdGreaterThan %bool %347 %float_0_75 + OpSelectionMerge %349 None + OpBranchConditional %348 %350 %349 + %350 = OpLabel + %352 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %353 = OpLoad %int %352 + %354 = OpAccessChain %_ptr_Function_float %color %uint_2 + %355 = OpLoad %float %354 + %356 = OpAccessChain %_ptr_Function_float %color %uint_2 + %357 = OpConvertSToF %float %353 + %358 = OpFAdd %float %355 %357 + OpStore %356 %358 + OpBranch %349 + %349 = OpLabel + %360 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %361 = OpLoad %int %360 + %362 = OpAccessChain %_ptr_Function_float %color %uint_2 + %363 = OpLoad %float %362 + %364 = OpAccessChain %_ptr_Function_float %color %uint_2 + %365 = OpConvertSToF %float %361 + %366 = OpFAdd %float %363 %365 + OpStore %364 %366 + %367 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %368 = OpLoad %float %367 + %369 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %370 = OpLoad %float %369 + %372 = OpFSub %float %368 %370 + %371 = OpExtInst %float %156 FAbs %372 + %373 = OpFOrdLessThan %bool %371 %float_0_25 + OpSelectionMerge %374 None + OpBranchConditional %373 %375 %374 + %375 = OpLabel + %376 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %377 = OpLoad %int %376 + %378 = OpAccessChain %_ptr_Function_float %color %uint_0 + %379 = OpLoad %float %378 + %380 = OpAccessChain %_ptr_Function_float %color %uint_0 + %381 = OpConvertSToF %float %377 + %382 = OpFAdd %float %379 %381 + OpStore %380 %382 + OpBranch %374 + %374 = OpLabel + %383 = OpLoad %v3float %color + %384 = OpExtInst %v3float %156 Normalize %383 + %385 = OpCompositeExtract %float %384 0 + %386 = OpCompositeExtract %float %384 1 + %387 = OpCompositeExtract %float %384 2 + %388 = OpCompositeConstruct %v4float %385 %386 %387 %float_1 + OpStore %x_GLF_color %388 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %389 +%tint_symbol_1 = OpFunctionParameter %main_out + %393 = OpLabel + %394 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %394 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %109 + %396 = OpLabel + %397 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %397 + %398 = OpFunctionCall %void %main_1 + %400 = OpLoad %v4float %x_GLF_color + %401 = OpCompositeConstruct %main_out %400 + %399 = OpFunctionCall %void %tint_symbol_3 %401 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..68052db5c8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.wgsl @@ -0,0 +1,280 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var x_GLF_color : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_230 : i32 = *(i); + let x_232 : i32 = obj.numbers[x_230]; + temp = x_232; + let x_233 : i32 = *(i); + let x_234 : i32 = *(j); + let x_236 : i32 = obj.numbers[x_234]; + obj.numbers[x_233] = x_236; + let x_238 : i32 = *(j); + let x_239 : i32 = temp; + obj.numbers[x_238] = x_239; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_242 : i32 = *(h); + let x_244 : i32 = obj.numbers[x_242]; + pivot = x_244; + let x_245 : i32 = *(l); + i_1 = (x_245 - 1); + let x_247 : i32 = *(l); + j_1 = x_247; + loop { + let x_252 : i32 = j_1; + let x_253 : i32 = *(h); + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + let x_257 : i32 = j_1; + let x_259 : i32 = obj.numbers[x_257]; + let x_260 : i32 = pivot; + if ((x_259 <= x_260)) { + let x_264 : i32 = i_1; + i_1 = (x_264 + 1); + let x_266 : i32 = i_1; + param = x_266; + let x_267 : i32 = j_1; + param_1 = x_267; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_269 : i32 = j_1; + j_1 = (x_269 + 1); + } + } + let x_271 : i32 = i_1; + i_1 = (x_271 + 1); + let x_273 : i32 = i_1; + param_2 = x_273; + let x_274 : i32 = *(h); + param_3 = x_274; + swap_i1_i1_(&(param_2), &(param_3)); + let x_276 : i32 = i_1; + return x_276; +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var int_a : i32; + var x_278 : i32; + var x_279 : i32; + var clamp_a : i32; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_280 : i32 = top; + let x_281 : i32 = (x_280 + 1); + top = x_281; + let x_282 : i32 = l_1; + stack[x_281] = x_282; + let x_285 : f32 = gl_FragCoord.y; + if ((x_285 >= 0.0)) { + let x_290 : i32 = h_1; + if (false) { + x_279 = 1; + } else { + let x_294 : i32 = h_1; + x_279 = (x_294 << bitcast(0)); + } + let x_296 : i32 = x_279; + x_278 = (x_290 | x_296); + } else { + x_278 = 1; + } + let x_298 : i32 = x_278; + int_a = x_298; + let x_299 : i32 = h_1; + let x_300 : i32 = h_1; + let x_301 : i32 = int_a; + clamp_a = clamp(x_299, x_300, x_301); + let x_303 : i32 = top; + let x_304 : i32 = (x_303 + 1); + top = x_304; + let x_305 : i32 = clamp_a; + stack[x_304] = (x_305 / 1); + loop { + let x_312 : i32 = top; + if ((x_312 >= 0)) { + } else { + break; + } + let x_315 : i32 = top; + top = (x_315 - 1); + let x_318 : i32 = stack[x_315]; + h_1 = x_318; + let x_319 : i32 = top; + top = (x_319 - 1); + let x_322 : i32 = stack[x_319]; + l_1 = x_322; + let x_323 : i32 = l_1; + param_4 = x_323; + let x_324 : i32 = h_1; + param_5 = x_324; + let x_325 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_325; + let x_326 : i32 = p; + let x_328 : i32 = l_1; + if (((x_326 - 1) > x_328)) { + let x_332 : i32 = top; + let x_333 : i32 = (x_332 + 1); + top = x_333; + let x_334 : i32 = l_1; + stack[x_333] = x_334; + let x_336 : i32 = top; + let x_337 : i32 = (x_336 + 1); + top = x_337; + let x_338 : i32 = p; + stack[x_337] = (x_338 - 1); + } + let x_341 : i32 = p; + let x_343 : i32 = h_1; + if (((x_341 + 1) < x_343)) { + let x_347 : i32 = top; + let x_348 : i32 = (x_347 + 1); + top = x_348; + let x_349 : i32 = p; + stack[x_348] = (x_349 + 1); + let x_352 : i32 = top; + let x_353 : i32 = (x_352 + 1); + top = x_353; + let x_354 : i32 = h_1; + stack[x_353] = x_354; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + i_2 = 0; + loop { + let x_90 : i32 = i_2; + if ((x_90 < 10)) { + } else { + break; + } + let x_93 : i32 = i_2; + let x_94 : i32 = i_2; + obj.numbers[x_93] = (10 - x_94); + let x_97 : i32 = i_2; + let x_98 : i32 = i_2; + let x_100 : i32 = obj.numbers[x_98]; + let x_101 : i32 = i_2; + let x_103 : i32 = obj.numbers[x_101]; + obj.numbers[x_97] = (x_100 * x_103); + + continuing { + let x_106 : i32 = i_2; + i_2 = (x_106 + 1); + } + } + quicksort_(); + let x_109 : vec4 = gl_FragCoord; + let x_112 : vec2 = x_34.resolution; + uv = (vec2(x_109.x, x_109.y) / x_112); + color = vec3(1.0, 2.0, 3.0); + let x_115 : i32 = obj.numbers[0]; + let x_118 : f32 = color.x; + color.x = (x_118 + f32(x_115)); + let x_122 : f32 = uv.x; + if ((x_122 > 0.25)) { + let x_127 : i32 = obj.numbers[1]; + let x_130 : f32 = color.x; + color.x = (x_130 + f32(x_127)); + } + let x_134 : f32 = uv.x; + if ((x_134 > 0.5)) { + let x_139 : i32 = obj.numbers[2]; + let x_142 : f32 = color.y; + color.y = (x_142 + f32(x_139)); + } + let x_146 : f32 = uv.x; + if ((x_146 > 0.75)) { + let x_151 : i32 = obj.numbers[3]; + let x_154 : f32 = color.z; + color.z = (x_154 + f32(x_151)); + } + let x_158 : i32 = obj.numbers[4]; + let x_161 : f32 = color.y; + color.y = (x_161 + f32(x_158)); + let x_165 : f32 = uv.y; + if ((x_165 > 0.25)) { + let x_170 : i32 = obj.numbers[5]; + let x_173 : f32 = color.x; + color.x = (x_173 + f32(x_170)); + } + let x_177 : f32 = uv.y; + if ((x_177 > 0.5)) { + let x_182 : i32 = obj.numbers[6]; + let x_185 : f32 = color.y; + color.y = (x_185 + f32(x_182)); + } + let x_189 : f32 = uv.y; + if ((x_189 > 0.75)) { + let x_194 : i32 = obj.numbers[7]; + let x_197 : f32 = color.z; + color.z = (x_197 + f32(x_194)); + } + let x_201 : i32 = obj.numbers[8]; + let x_204 : f32 = color.z; + color.z = (x_204 + f32(x_201)); + let x_208 : f32 = uv.x; + let x_210 : f32 = uv.y; + if ((abs((x_208 - x_210)) < 0.25)) { + let x_217 : i32 = obj.numbers[9]; + let x_220 : f32 = color.x; + color.x = (x_220 + f32(x_217)); + } + let x_223 : vec3 = color; + let x_224 : vec3 = normalize(x_223); + x_GLF_color = vec4(x_224.x, x_224.y, x_224.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl new file mode 100644 index 0000000000..68052db5c8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl @@ -0,0 +1,280 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var x_GLF_color : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_230 : i32 = *(i); + let x_232 : i32 = obj.numbers[x_230]; + temp = x_232; + let x_233 : i32 = *(i); + let x_234 : i32 = *(j); + let x_236 : i32 = obj.numbers[x_234]; + obj.numbers[x_233] = x_236; + let x_238 : i32 = *(j); + let x_239 : i32 = temp; + obj.numbers[x_238] = x_239; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_242 : i32 = *(h); + let x_244 : i32 = obj.numbers[x_242]; + pivot = x_244; + let x_245 : i32 = *(l); + i_1 = (x_245 - 1); + let x_247 : i32 = *(l); + j_1 = x_247; + loop { + let x_252 : i32 = j_1; + let x_253 : i32 = *(h); + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + let x_257 : i32 = j_1; + let x_259 : i32 = obj.numbers[x_257]; + let x_260 : i32 = pivot; + if ((x_259 <= x_260)) { + let x_264 : i32 = i_1; + i_1 = (x_264 + 1); + let x_266 : i32 = i_1; + param = x_266; + let x_267 : i32 = j_1; + param_1 = x_267; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_269 : i32 = j_1; + j_1 = (x_269 + 1); + } + } + let x_271 : i32 = i_1; + i_1 = (x_271 + 1); + let x_273 : i32 = i_1; + param_2 = x_273; + let x_274 : i32 = *(h); + param_3 = x_274; + swap_i1_i1_(&(param_2), &(param_3)); + let x_276 : i32 = i_1; + return x_276; +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var int_a : i32; + var x_278 : i32; + var x_279 : i32; + var clamp_a : i32; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_280 : i32 = top; + let x_281 : i32 = (x_280 + 1); + top = x_281; + let x_282 : i32 = l_1; + stack[x_281] = x_282; + let x_285 : f32 = gl_FragCoord.y; + if ((x_285 >= 0.0)) { + let x_290 : i32 = h_1; + if (false) { + x_279 = 1; + } else { + let x_294 : i32 = h_1; + x_279 = (x_294 << bitcast(0)); + } + let x_296 : i32 = x_279; + x_278 = (x_290 | x_296); + } else { + x_278 = 1; + } + let x_298 : i32 = x_278; + int_a = x_298; + let x_299 : i32 = h_1; + let x_300 : i32 = h_1; + let x_301 : i32 = int_a; + clamp_a = clamp(x_299, x_300, x_301); + let x_303 : i32 = top; + let x_304 : i32 = (x_303 + 1); + top = x_304; + let x_305 : i32 = clamp_a; + stack[x_304] = (x_305 / 1); + loop { + let x_312 : i32 = top; + if ((x_312 >= 0)) { + } else { + break; + } + let x_315 : i32 = top; + top = (x_315 - 1); + let x_318 : i32 = stack[x_315]; + h_1 = x_318; + let x_319 : i32 = top; + top = (x_319 - 1); + let x_322 : i32 = stack[x_319]; + l_1 = x_322; + let x_323 : i32 = l_1; + param_4 = x_323; + let x_324 : i32 = h_1; + param_5 = x_324; + let x_325 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_325; + let x_326 : i32 = p; + let x_328 : i32 = l_1; + if (((x_326 - 1) > x_328)) { + let x_332 : i32 = top; + let x_333 : i32 = (x_332 + 1); + top = x_333; + let x_334 : i32 = l_1; + stack[x_333] = x_334; + let x_336 : i32 = top; + let x_337 : i32 = (x_336 + 1); + top = x_337; + let x_338 : i32 = p; + stack[x_337] = (x_338 - 1); + } + let x_341 : i32 = p; + let x_343 : i32 = h_1; + if (((x_341 + 1) < x_343)) { + let x_347 : i32 = top; + let x_348 : i32 = (x_347 + 1); + top = x_348; + let x_349 : i32 = p; + stack[x_348] = (x_349 + 1); + let x_352 : i32 = top; + let x_353 : i32 = (x_352 + 1); + top = x_353; + let x_354 : i32 = h_1; + stack[x_353] = x_354; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + i_2 = 0; + loop { + let x_90 : i32 = i_2; + if ((x_90 < 10)) { + } else { + break; + } + let x_93 : i32 = i_2; + let x_94 : i32 = i_2; + obj.numbers[x_93] = (10 - x_94); + let x_97 : i32 = i_2; + let x_98 : i32 = i_2; + let x_100 : i32 = obj.numbers[x_98]; + let x_101 : i32 = i_2; + let x_103 : i32 = obj.numbers[x_101]; + obj.numbers[x_97] = (x_100 * x_103); + + continuing { + let x_106 : i32 = i_2; + i_2 = (x_106 + 1); + } + } + quicksort_(); + let x_109 : vec4 = gl_FragCoord; + let x_112 : vec2 = x_34.resolution; + uv = (vec2(x_109.x, x_109.y) / x_112); + color = vec3(1.0, 2.0, 3.0); + let x_115 : i32 = obj.numbers[0]; + let x_118 : f32 = color.x; + color.x = (x_118 + f32(x_115)); + let x_122 : f32 = uv.x; + if ((x_122 > 0.25)) { + let x_127 : i32 = obj.numbers[1]; + let x_130 : f32 = color.x; + color.x = (x_130 + f32(x_127)); + } + let x_134 : f32 = uv.x; + if ((x_134 > 0.5)) { + let x_139 : i32 = obj.numbers[2]; + let x_142 : f32 = color.y; + color.y = (x_142 + f32(x_139)); + } + let x_146 : f32 = uv.x; + if ((x_146 > 0.75)) { + let x_151 : i32 = obj.numbers[3]; + let x_154 : f32 = color.z; + color.z = (x_154 + f32(x_151)); + } + let x_158 : i32 = obj.numbers[4]; + let x_161 : f32 = color.y; + color.y = (x_161 + f32(x_158)); + let x_165 : f32 = uv.y; + if ((x_165 > 0.25)) { + let x_170 : i32 = obj.numbers[5]; + let x_173 : f32 = color.x; + color.x = (x_173 + f32(x_170)); + } + let x_177 : f32 = uv.y; + if ((x_177 > 0.5)) { + let x_182 : i32 = obj.numbers[6]; + let x_185 : f32 = color.y; + color.y = (x_185 + f32(x_182)); + } + let x_189 : f32 = uv.y; + if ((x_189 > 0.75)) { + let x_194 : i32 = obj.numbers[7]; + let x_197 : f32 = color.z; + color.z = (x_197 + f32(x_194)); + } + let x_201 : i32 = obj.numbers[8]; + let x_204 : f32 = color.z; + color.z = (x_204 + f32(x_201)); + let x_208 : f32 = uv.x; + let x_210 : f32 = uv.y; + if ((abs((x_208 - x_210)) < 0.25)) { + let x_217 : i32 = obj.numbers[9]; + let x_220 : f32 = color.x; + color.x = (x_220 + f32(x_217)); + } + let x_223 : vec3 = color; + let x_224 : vec3 = normalize(x_223); + x_GLF_color = vec4(x_224.x, x_224.y, x_224.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..7c360661e5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.hlsl @@ -0,0 +1,232 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_34 : register(b0, space0) { + uint4 x_34[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_230 = i; + const int x_232 = obj.numbers[x_230]; + temp = x_232; + const int x_233 = i; + const int x_234 = j; + const int x_236 = obj.numbers[x_234]; + obj.numbers[x_233] = x_236; + const int x_238 = j; + obj.numbers[x_238] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_242 = h; + const int x_244 = obj.numbers[x_242]; + pivot = x_244; + const int x_245 = l; + i_1 = (x_245 - 1); + const int x_247 = l; + j_1 = x_247; + while (true) { + const int x_252 = j_1; + const int x_253 = h; + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + const int x_259 = obj.numbers[j_1]; + if ((x_259 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + i_1 = (i_1 + 1); + param_2 = i_1; + const int x_274 = h; + param_3 = x_274; + swap_i1_i1_(param_2, param_3); + return i_1; +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int int_a = 0; + int x_278 = 0; + int x_279 = 0; + int clamp_a = 0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_281 = (top + 1); + top = x_281; + stack[x_281] = l_1; + const float x_285 = gl_FragCoord.y; + if ((x_285 >= 0.0f)) { + const int x_290 = h_1; + if (false) { + x_279 = 1; + } else { + x_279 = (h_1 << asuint(0)); + } + x_278 = (x_290 | x_279); + } else { + x_278 = 1; + } + int_a = x_278; + clamp_a = clamp(h_1, h_1, int_a); + const int x_304 = (top + 1); + top = x_304; + stack[x_304] = (clamp_a / 1); + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_315 = top; + top = (x_315 - 1); + const int x_318 = stack[x_315]; + h_1 = x_318; + const int x_319 = top; + top = (x_319 - 1); + const int x_322 = stack[x_319]; + l_1 = x_322; + param_4 = l_1; + param_5 = h_1; + const int x_325 = performPartition_i1_i1_(param_4, param_5); + p = x_325; + if (((p - 1) > l_1)) { + const int x_333 = (top + 1); + top = x_333; + stack[x_333] = l_1; + const int x_337 = (top + 1); + top = x_337; + stack[x_337] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_348 = (top + 1); + top = x_348; + stack[x_348] = (p + 1); + const int x_353 = (top + 1); + top = x_353; + stack[x_353] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_97 = i_2; + const int x_100 = obj.numbers[i_2]; + const int x_103 = obj.numbers[i_2]; + obj.numbers[x_97] = (x_100 * x_103); + } + } + quicksort_(); + const float4 x_109 = gl_FragCoord; + const float2 x_112 = asfloat(x_34[0].xy); + uv = (float2(x_109.x, x_109.y) / x_112); + color = float3(1.0f, 2.0f, 3.0f); + const int x_115 = obj.numbers[0]; + const float x_118 = color.x; + color.x = (x_118 + float(x_115)); + const float x_122 = uv.x; + if ((x_122 > 0.25f)) { + const int x_127 = obj.numbers[1]; + const float x_130 = color.x; + color.x = (x_130 + float(x_127)); + } + const float x_134 = uv.x; + if ((x_134 > 0.5f)) { + const int x_139 = obj.numbers[2]; + const float x_142 = color.y; + color.y = (x_142 + float(x_139)); + } + const float x_146 = uv.x; + if ((x_146 > 0.75f)) { + const int x_151 = obj.numbers[3]; + const float x_154 = color.z; + color.z = (x_154 + float(x_151)); + } + const int x_158 = obj.numbers[4]; + const float x_161 = color.y; + color.y = (x_161 + float(x_158)); + const float x_165 = uv.y; + if ((x_165 > 0.25f)) { + const int x_170 = obj.numbers[5]; + const float x_173 = color.x; + color.x = (x_173 + float(x_170)); + } + const float x_177 = uv.y; + if ((x_177 > 0.5f)) { + const int x_182 = obj.numbers[6]; + const float x_185 = color.y; + color.y = (x_185 + float(x_182)); + } + const float x_189 = uv.y; + if ((x_189 > 0.75f)) { + const int x_194 = obj.numbers[7]; + const float x_197 = color.z; + color.z = (x_197 + float(x_194)); + } + const int x_201 = obj.numbers[8]; + const float x_204 = color.z; + color.z = (x_204 + float(x_201)); + const float x_208 = uv.x; + const float x_210 = uv.y; + if ((abs((x_208 - x_210)) < 0.25f)) { + const int x_217 = obj.numbers[9]; + const float x_220 = color.x; + color.x = (x_220 + float(x_217)); + } + const float3 x_224 = normalize(color); + x_GLF_color = float4(x_224.x, x_224.y, x_224.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.msl new file mode 100644 index 0000000000..825cedb9e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.msl @@ -0,0 +1,280 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_5) { + int temp = 0; + int const x_230 = *(i); + int const x_232 = (*(tint_symbol_5)).numbers.arr[x_230]; + temp = x_232; + int const x_233 = *(i); + int const x_234 = *(j); + int const x_236 = (*(tint_symbol_5)).numbers.arr[x_234]; + (*(tint_symbol_5)).numbers.arr[x_233] = x_236; + int const x_238 = *(j); + int const x_239 = temp; + (*(tint_symbol_5)).numbers.arr[x_238] = x_239; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_6) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_242 = *(h); + int const x_244 = (*(tint_symbol_6)).numbers.arr[x_242]; + pivot = x_244; + int const x_245 = *(l); + i_1 = (x_245 - 1); + int const x_247 = *(l); + j_1 = x_247; + while (true) { + int const x_252 = j_1; + int const x_253 = *(h); + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + int const x_257 = j_1; + int const x_259 = (*(tint_symbol_6)).numbers.arr[x_257]; + int const x_260 = pivot; + if ((x_259 <= x_260)) { + int const x_264 = i_1; + i_1 = (x_264 + 1); + int const x_266 = i_1; + param = x_266; + int const x_267 = j_1; + param_1 = x_267; + swap_i1_i1_(&(param), &(param_1), tint_symbol_6); + } + { + int const x_269 = j_1; + j_1 = (x_269 + 1); + } + } + int const x_271 = i_1; + i_1 = (x_271 + 1); + int const x_273 = i_1; + param_2 = x_273; + int const x_274 = *(h); + param_3 = x_274; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_6); + int const x_276 = i_1; + return x_276; +} + +void quicksort_(thread float4* const tint_symbol_7, thread QuicksortObject* const tint_symbol_8) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int int_a = 0; + int x_278 = 0; + int x_279 = 0; + int clamp_a = 0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_280 = top; + int const x_281 = (x_280 + 1); + top = x_281; + int const x_282 = l_1; + stack.arr[x_281] = x_282; + float const x_285 = (*(tint_symbol_7)).y; + if ((x_285 >= 0.0f)) { + int const x_290 = h_1; + if (false) { + x_279 = 1; + } else { + int const x_294 = h_1; + x_279 = (x_294 << as_type(0)); + } + int const x_296 = x_279; + x_278 = (x_290 | x_296); + } else { + x_278 = 1; + } + int const x_298 = x_278; + int_a = x_298; + int const x_299 = h_1; + int const x_300 = h_1; + int const x_301 = int_a; + clamp_a = clamp(x_299, x_300, x_301); + int const x_303 = top; + int const x_304 = (x_303 + 1); + top = x_304; + int const x_305 = clamp_a; + stack.arr[x_304] = (x_305 / 1); + while (true) { + int const x_312 = top; + if ((x_312 >= 0)) { + } else { + break; + } + int const x_315 = top; + top = (x_315 - 1); + int const x_318 = stack.arr[x_315]; + h_1 = x_318; + int const x_319 = top; + top = (x_319 - 1); + int const x_322 = stack.arr[x_319]; + l_1 = x_322; + int const x_323 = l_1; + param_4 = x_323; + int const x_324 = h_1; + param_5 = x_324; + int const x_325 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_8); + p = x_325; + int const x_326 = p; + int const x_328 = l_1; + if (((x_326 - 1) > x_328)) { + int const x_332 = top; + int const x_333 = (x_332 + 1); + top = x_333; + int const x_334 = l_1; + stack.arr[x_333] = x_334; + int const x_336 = top; + int const x_337 = (x_336 + 1); + top = x_337; + int const x_338 = p; + stack.arr[x_337] = (x_338 - 1); + } + int const x_341 = p; + int const x_343 = h_1; + if (((x_341 + 1) < x_343)) { + int const x_347 = top; + int const x_348 = (x_347 + 1); + top = x_348; + int const x_349 = p; + stack.arr[x_348] = (x_349 + 1); + int const x_352 = top; + int const x_353 = (x_352 + 1); + top = x_353; + int const x_354 = h_1; + stack.arr[x_353] = x_354; + } + } + return; +} + +void main_1(constant buf0& x_34, thread QuicksortObject* const tint_symbol_9, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) { + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + i_2 = 0; + while (true) { + int const x_90 = i_2; + if ((x_90 < 10)) { + } else { + break; + } + int const x_93 = i_2; + int const x_94 = i_2; + (*(tint_symbol_9)).numbers.arr[x_93] = (10 - x_94); + int const x_97 = i_2; + int const x_98 = i_2; + int const x_100 = (*(tint_symbol_9)).numbers.arr[x_98]; + int const x_101 = i_2; + int const x_103 = (*(tint_symbol_9)).numbers.arr[x_101]; + (*(tint_symbol_9)).numbers.arr[x_97] = (x_100 * x_103); + { + int const x_106 = i_2; + i_2 = (x_106 + 1); + } + } + quicksort_(tint_symbol_10, tint_symbol_9); + float4 const x_109 = *(tint_symbol_10); + float2 const x_112 = x_34.resolution; + uv = (float2(x_109.x, x_109.y) / x_112); + color = float3(1.0f, 2.0f, 3.0f); + int const x_115 = (*(tint_symbol_9)).numbers.arr[0]; + float const x_118 = color.x; + color.x = (x_118 + float(x_115)); + float const x_122 = uv.x; + if ((x_122 > 0.25f)) { + int const x_127 = (*(tint_symbol_9)).numbers.arr[1]; + float const x_130 = color.x; + color.x = (x_130 + float(x_127)); + } + float const x_134 = uv.x; + if ((x_134 > 0.5f)) { + int const x_139 = (*(tint_symbol_9)).numbers.arr[2]; + float const x_142 = color.y; + color.y = (x_142 + float(x_139)); + } + float const x_146 = uv.x; + if ((x_146 > 0.75f)) { + int const x_151 = (*(tint_symbol_9)).numbers.arr[3]; + float const x_154 = color.z; + color.z = (x_154 + float(x_151)); + } + int const x_158 = (*(tint_symbol_9)).numbers.arr[4]; + float const x_161 = color.y; + color.y = (x_161 + float(x_158)); + float const x_165 = uv.y; + if ((x_165 > 0.25f)) { + int const x_170 = (*(tint_symbol_9)).numbers.arr[5]; + float const x_173 = color.x; + color.x = (x_173 + float(x_170)); + } + float const x_177 = uv.y; + if ((x_177 > 0.5f)) { + int const x_182 = (*(tint_symbol_9)).numbers.arr[6]; + float const x_185 = color.y; + color.y = (x_185 + float(x_182)); + } + float const x_189 = uv.y; + if ((x_189 > 0.75f)) { + int const x_194 = (*(tint_symbol_9)).numbers.arr[7]; + float const x_197 = color.z; + color.z = (x_197 + float(x_194)); + } + int const x_201 = (*(tint_symbol_9)).numbers.arr[8]; + float const x_204 = color.z; + color.z = (x_204 + float(x_201)); + float const x_208 = uv.x; + float const x_210 = uv.y; + if ((fabs((x_208 - x_210)) < 0.25f)) { + int const x_217 = (*(tint_symbol_9)).numbers.arr[9]; + float const x_220 = color.x; + color.x = (x_220 + float(x_217)); + } + float3 const x_223 = color; + float3 const x_224 = normalize(x_223); + *(tint_symbol_11) = float4(x_224.x, x_224.y, x_224.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_34 [[buffer(0)]]) { + thread float4 tint_symbol_12 = 0.0f; + thread QuicksortObject tint_symbol_13 = {}; + thread float4 tint_symbol_14 = 0.0f; + tint_symbol_12 = gl_FragCoord_param; + main_1(x_34, &(tint_symbol_13), &(tint_symbol_12), &(tint_symbol_14)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_14}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..003a32d79e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.spvasm @@ -0,0 +1,587 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 402 +; Schema: 0 + OpCapability Shader + %156 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_34 "x_34" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %int_a "int_a" + OpName %x_278 "x_278" + OpName %x_279 "x_279" + OpName %clamp_a "clamp_a" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_34 NonWritable + OpDecorate %x_34 DescriptorSet 0 + OpDecorate %x_34 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %8 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %13 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %13 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_34 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %13 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %31 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %49 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %109 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %117 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool +%_ptr_Function_v2float = OpTypePointer Function %v2float + %219 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %223 = OpConstantNull %v3float + %int_10 = OpConstant %int 10 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %261 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float + %389 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %23 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %29 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %31 + %33 = OpLoad %int %i + %36 = OpAccessChain %_ptr_Private_int %obj %uint_0 %33 + %37 = OpLoad %int %36 + OpStore %temp %37 + %39 = OpLoad %int %i + %41 = OpLoad %int %j + %42 = OpAccessChain %_ptr_Private_int %obj %uint_0 %41 + %43 = OpLoad %int %42 + %44 = OpAccessChain %_ptr_Private_int %obj %uint_0 %39 + OpStore %44 %43 + %46 = OpLoad %int %j + %47 = OpLoad %int %temp + %48 = OpAccessChain %_ptr_Private_int %obj %uint_0 %46 + OpStore %48 %47 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %49 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %53 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %31 + %i_1 = OpVariable %_ptr_Function_int Function %31 + %j_1 = OpVariable %_ptr_Function_int Function %31 + %param = OpVariable %_ptr_Function_int Function %31 + %param_1 = OpVariable %_ptr_Function_int Function %31 + %param_2 = OpVariable %_ptr_Function_int Function %31 + %param_3 = OpVariable %_ptr_Function_int Function %31 + %62 = OpLoad %int %h + %63 = OpAccessChain %_ptr_Private_int %obj %uint_0 %62 + %64 = OpLoad %int %63 + OpStore %pivot %64 + %66 = OpLoad %int %l + %68 = OpISub %int %66 %int_1 + OpStore %i_1 %68 + %70 = OpLoad %int %l + OpStore %j_1 %70 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %int %j_1 + %77 = OpLoad %int %h + %78 = OpISub %int %77 %int_1 + %79 = OpSLessThanEqual %bool %75 %78 + OpSelectionMerge %81 None + OpBranchConditional %79 %82 %83 + %82 = OpLabel + OpBranch %81 + %83 = OpLabel + OpBranch %72 + %81 = OpLabel + %84 = OpLoad %int %j_1 + %85 = OpAccessChain %_ptr_Private_int %obj %uint_0 %84 + %86 = OpLoad %int %85 + %87 = OpLoad %int %pivot + %88 = OpSLessThanEqual %bool %86 %87 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %89 + %90 = OpLabel + %91 = OpLoad %int %i_1 + %92 = OpIAdd %int %91 %int_1 + OpStore %i_1 %92 + %93 = OpLoad %int %i_1 + OpStore %param %93 + %94 = OpLoad %int %j_1 + OpStore %param_1 %94 + %95 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %89 + %89 = OpLabel + OpBranch %73 + %73 = OpLabel + %98 = OpLoad %int %j_1 + %99 = OpIAdd %int %98 %int_1 + OpStore %j_1 %99 + OpBranch %71 + %72 = OpLabel + %100 = OpLoad %int %i_1 + %101 = OpIAdd %int %100 %int_1 + OpStore %i_1 %101 + %102 = OpLoad %int %i_1 + OpStore %param_2 %102 + %104 = OpLoad %int %h + OpStore %param_3 %104 + %105 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %108 = OpLoad %int %i_1 + OpReturnValue %108 + OpFunctionEnd + %quicksort_ = OpFunction %void None %109 + %111 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %31 + %h_1 = OpVariable %_ptr_Function_int Function %31 + %top = OpVariable %_ptr_Function_int Function %31 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %117 + %int_a = OpVariable %_ptr_Function_int Function %31 + %x_278 = OpVariable %_ptr_Function_int Function %31 + %x_279 = OpVariable %_ptr_Function_int Function %31 + %clamp_a = OpVariable %_ptr_Function_int Function %31 + %p = OpVariable %_ptr_Function_int Function %31 + %param_4 = OpVariable %_ptr_Function_int Function %31 + %param_5 = OpVariable %_ptr_Function_int Function %31 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %128 = OpLoad %int %top + %129 = OpIAdd %int %128 %int_1 + OpStore %top %129 + %130 = OpLoad %int %l_1 + %131 = OpAccessChain %_ptr_Function_int %stack %129 + OpStore %131 %130 + %134 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %135 = OpLoad %float %134 + %137 = OpFOrdGreaterThanEqual %bool %135 %float_0 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %140 + %139 = OpLabel + %141 = OpLoad %int %h_1 + OpSelectionMerge %143 None + OpBranchConditional %false %144 %145 + %144 = OpLabel + OpStore %x_279 %int_1 + OpBranch %143 + %145 = OpLabel + %146 = OpLoad %int %h_1 + %147 = OpBitcast %uint %int_0 + %148 = OpShiftLeftLogical %int %146 %147 + OpStore %x_279 %148 + OpBranch %143 + %143 = OpLabel + %149 = OpLoad %int %x_279 + %150 = OpBitwiseOr %int %141 %149 + OpStore %x_278 %150 + OpBranch %138 + %140 = OpLabel + OpStore %x_278 %int_1 + OpBranch %138 + %138 = OpLabel + %151 = OpLoad %int %x_278 + OpStore %int_a %151 + %152 = OpLoad %int %h_1 + %153 = OpLoad %int %h_1 + %154 = OpLoad %int %int_a + %155 = OpExtInst %int %156 SClamp %152 %153 %154 + OpStore %clamp_a %155 + %157 = OpLoad %int %top + %158 = OpIAdd %int %157 %int_1 + OpStore %top %158 + %159 = OpLoad %int %clamp_a + %160 = OpAccessChain %_ptr_Function_int %stack %158 + %161 = OpSDiv %int %159 %int_1 + OpStore %160 %161 + OpBranch %162 + %162 = OpLabel + OpLoopMerge %163 %164 None + OpBranch %165 + %165 = OpLabel + %166 = OpLoad %int %top + %167 = OpSGreaterThanEqual %bool %166 %int_0 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %170 + %169 = OpLabel + OpBranch %168 + %170 = OpLabel + OpBranch %163 + %168 = OpLabel + %171 = OpLoad %int %top + %172 = OpISub %int %171 %int_1 + OpStore %top %172 + %173 = OpAccessChain %_ptr_Function_int %stack %171 + %174 = OpLoad %int %173 + OpStore %h_1 %174 + %175 = OpLoad %int %top + %176 = OpISub %int %175 %int_1 + OpStore %top %176 + %177 = OpAccessChain %_ptr_Function_int %stack %175 + %178 = OpLoad %int %177 + OpStore %l_1 %178 + %179 = OpLoad %int %l_1 + OpStore %param_4 %179 + %180 = OpLoad %int %h_1 + OpStore %param_5 %180 + %181 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %181 + %184 = OpLoad %int %p + %185 = OpLoad %int %l_1 + %186 = OpISub %int %184 %int_1 + %187 = OpSGreaterThan %bool %186 %185 + OpSelectionMerge %188 None + OpBranchConditional %187 %189 %188 + %189 = OpLabel + %190 = OpLoad %int %top + %191 = OpIAdd %int %190 %int_1 + OpStore %top %191 + %192 = OpLoad %int %l_1 + %193 = OpAccessChain %_ptr_Function_int %stack %191 + OpStore %193 %192 + %194 = OpLoad %int %top + %195 = OpIAdd %int %194 %int_1 + OpStore %top %195 + %196 = OpLoad %int %p + %197 = OpAccessChain %_ptr_Function_int %stack %195 + %198 = OpISub %int %196 %int_1 + OpStore %197 %198 + OpBranch %188 + %188 = OpLabel + %199 = OpLoad %int %p + %200 = OpLoad %int %h_1 + %201 = OpIAdd %int %199 %int_1 + %202 = OpSLessThan %bool %201 %200 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %203 + %204 = OpLabel + %205 = OpLoad %int %top + %206 = OpIAdd %int %205 %int_1 + OpStore %top %206 + %207 = OpLoad %int %p + %208 = OpAccessChain %_ptr_Function_int %stack %206 + %209 = OpIAdd %int %207 %int_1 + OpStore %208 %209 + %210 = OpLoad %int %top + %211 = OpIAdd %int %210 %int_1 + OpStore %top %211 + %212 = OpLoad %int %h_1 + %213 = OpAccessChain %_ptr_Function_int %stack %211 + OpStore %213 %212 + OpBranch %203 + %203 = OpLabel + OpBranch %164 + %164 = OpLabel + OpBranch %162 + %163 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %109 + %215 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %31 + %uv = OpVariable %_ptr_Function_v2float Function %219 + %color = OpVariable %_ptr_Function_v3float Function %223 + OpStore %i_2 %int_0 + OpBranch %224 + %224 = OpLabel + OpLoopMerge %225 %226 None + OpBranch %227 + %227 = OpLabel + %228 = OpLoad %int %i_2 + %230 = OpSLessThan %bool %228 %int_10 + OpSelectionMerge %231 None + OpBranchConditional %230 %232 %233 + %232 = OpLabel + OpBranch %231 + %233 = OpLabel + OpBranch %225 + %231 = OpLabel + %234 = OpLoad %int %i_2 + %235 = OpLoad %int %i_2 + %236 = OpAccessChain %_ptr_Private_int %obj %uint_0 %234 + %237 = OpISub %int %int_10 %235 + OpStore %236 %237 + %238 = OpLoad %int %i_2 + %239 = OpLoad %int %i_2 + %240 = OpAccessChain %_ptr_Private_int %obj %uint_0 %239 + %241 = OpLoad %int %240 + %242 = OpLoad %int %i_2 + %243 = OpAccessChain %_ptr_Private_int %obj %uint_0 %242 + %244 = OpLoad %int %243 + %245 = OpAccessChain %_ptr_Private_int %obj %uint_0 %238 + %246 = OpIMul %int %241 %244 + OpStore %245 %246 + OpBranch %226 + %226 = OpLabel + %247 = OpLoad %int %i_2 + %248 = OpIAdd %int %247 %int_1 + OpStore %i_2 %248 + OpBranch %224 + %225 = OpLabel + %249 = OpFunctionCall %void %quicksort_ + %250 = OpLoad %v4float %gl_FragCoord + %252 = OpAccessChain %_ptr_Uniform_v2float %x_34 %uint_0 + %253 = OpLoad %v2float %252 + %254 = OpCompositeExtract %float %250 0 + %255 = OpCompositeExtract %float %250 1 + %256 = OpCompositeConstruct %v2float %254 %255 + %257 = OpFDiv %v2float %256 %253 + OpStore %uv %257 + OpStore %color %261 + %262 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %263 = OpLoad %int %262 + %265 = OpAccessChain %_ptr_Function_float %color %uint_0 + %266 = OpLoad %float %265 + %267 = OpAccessChain %_ptr_Function_float %color %uint_0 + %268 = OpConvertSToF %float %263 + %269 = OpFAdd %float %266 %268 + OpStore %267 %269 + %270 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %271 = OpLoad %float %270 + %273 = OpFOrdGreaterThan %bool %271 %float_0_25 + OpSelectionMerge %274 None + OpBranchConditional %273 %275 %274 + %275 = OpLabel + %276 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %277 = OpLoad %int %276 + %278 = OpAccessChain %_ptr_Function_float %color %uint_0 + %279 = OpLoad %float %278 + %280 = OpAccessChain %_ptr_Function_float %color %uint_0 + %281 = OpConvertSToF %float %277 + %282 = OpFAdd %float %279 %281 + OpStore %280 %282 + OpBranch %274 + %274 = OpLabel + %283 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %284 = OpLoad %float %283 + %286 = OpFOrdGreaterThan %bool %284 %float_0_5 + OpSelectionMerge %287 None + OpBranchConditional %286 %288 %287 + %288 = OpLabel + %290 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %291 = OpLoad %int %290 + %292 = OpAccessChain %_ptr_Function_float %color %uint_1 + %293 = OpLoad %float %292 + %294 = OpAccessChain %_ptr_Function_float %color %uint_1 + %295 = OpConvertSToF %float %291 + %296 = OpFAdd %float %293 %295 + OpStore %294 %296 + OpBranch %287 + %287 = OpLabel + %297 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %298 = OpLoad %float %297 + %300 = OpFOrdGreaterThan %bool %298 %float_0_75 + OpSelectionMerge %301 None + OpBranchConditional %300 %302 %301 + %302 = OpLabel + %304 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %305 = OpLoad %int %304 + %307 = OpAccessChain %_ptr_Function_float %color %uint_2 + %308 = OpLoad %float %307 + %309 = OpAccessChain %_ptr_Function_float %color %uint_2 + %310 = OpConvertSToF %float %305 + %311 = OpFAdd %float %308 %310 + OpStore %309 %311 + OpBranch %301 + %301 = OpLabel + %313 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %314 = OpLoad %int %313 + %315 = OpAccessChain %_ptr_Function_float %color %uint_1 + %316 = OpLoad %float %315 + %317 = OpAccessChain %_ptr_Function_float %color %uint_1 + %318 = OpConvertSToF %float %314 + %319 = OpFAdd %float %316 %318 + OpStore %317 %319 + %320 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %321 = OpLoad %float %320 + %322 = OpFOrdGreaterThan %bool %321 %float_0_25 + OpSelectionMerge %323 None + OpBranchConditional %322 %324 %323 + %324 = OpLabel + %326 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %327 = OpLoad %int %326 + %328 = OpAccessChain %_ptr_Function_float %color %uint_0 + %329 = OpLoad %float %328 + %330 = OpAccessChain %_ptr_Function_float %color %uint_0 + %331 = OpConvertSToF %float %327 + %332 = OpFAdd %float %329 %331 + OpStore %330 %332 + OpBranch %323 + %323 = OpLabel + %333 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %334 = OpLoad %float %333 + %335 = OpFOrdGreaterThan %bool %334 %float_0_5 + OpSelectionMerge %336 None + OpBranchConditional %335 %337 %336 + %337 = OpLabel + %339 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %340 = OpLoad %int %339 + %341 = OpAccessChain %_ptr_Function_float %color %uint_1 + %342 = OpLoad %float %341 + %343 = OpAccessChain %_ptr_Function_float %color %uint_1 + %344 = OpConvertSToF %float %340 + %345 = OpFAdd %float %342 %344 + OpStore %343 %345 + OpBranch %336 + %336 = OpLabel + %346 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %347 = OpLoad %float %346 + %348 = OpFOrdGreaterThan %bool %347 %float_0_75 + OpSelectionMerge %349 None + OpBranchConditional %348 %350 %349 + %350 = OpLabel + %352 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %353 = OpLoad %int %352 + %354 = OpAccessChain %_ptr_Function_float %color %uint_2 + %355 = OpLoad %float %354 + %356 = OpAccessChain %_ptr_Function_float %color %uint_2 + %357 = OpConvertSToF %float %353 + %358 = OpFAdd %float %355 %357 + OpStore %356 %358 + OpBranch %349 + %349 = OpLabel + %360 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %361 = OpLoad %int %360 + %362 = OpAccessChain %_ptr_Function_float %color %uint_2 + %363 = OpLoad %float %362 + %364 = OpAccessChain %_ptr_Function_float %color %uint_2 + %365 = OpConvertSToF %float %361 + %366 = OpFAdd %float %363 %365 + OpStore %364 %366 + %367 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %368 = OpLoad %float %367 + %369 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %370 = OpLoad %float %369 + %372 = OpFSub %float %368 %370 + %371 = OpExtInst %float %156 FAbs %372 + %373 = OpFOrdLessThan %bool %371 %float_0_25 + OpSelectionMerge %374 None + OpBranchConditional %373 %375 %374 + %375 = OpLabel + %376 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %377 = OpLoad %int %376 + %378 = OpAccessChain %_ptr_Function_float %color %uint_0 + %379 = OpLoad %float %378 + %380 = OpAccessChain %_ptr_Function_float %color %uint_0 + %381 = OpConvertSToF %float %377 + %382 = OpFAdd %float %379 %381 + OpStore %380 %382 + OpBranch %374 + %374 = OpLabel + %383 = OpLoad %v3float %color + %384 = OpExtInst %v3float %156 Normalize %383 + %385 = OpCompositeExtract %float %384 0 + %386 = OpCompositeExtract %float %384 1 + %387 = OpCompositeExtract %float %384 2 + %388 = OpCompositeConstruct %v4float %385 %386 %387 %float_1 + OpStore %x_GLF_color %388 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %389 +%tint_symbol_1 = OpFunctionParameter %main_out + %393 = OpLabel + %394 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %394 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %109 + %396 = OpLabel + %397 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %397 + %398 = OpFunctionCall %void %main_1 + %400 = OpLoad %v4float %x_GLF_color + %401 = OpCompositeConstruct %main_out %400 + %399 = OpFunctionCall %void %tint_symbol_3 %401 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..68052db5c8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.wgsl @@ -0,0 +1,280 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var x_GLF_color : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_230 : i32 = *(i); + let x_232 : i32 = obj.numbers[x_230]; + temp = x_232; + let x_233 : i32 = *(i); + let x_234 : i32 = *(j); + let x_236 : i32 = obj.numbers[x_234]; + obj.numbers[x_233] = x_236; + let x_238 : i32 = *(j); + let x_239 : i32 = temp; + obj.numbers[x_238] = x_239; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_242 : i32 = *(h); + let x_244 : i32 = obj.numbers[x_242]; + pivot = x_244; + let x_245 : i32 = *(l); + i_1 = (x_245 - 1); + let x_247 : i32 = *(l); + j_1 = x_247; + loop { + let x_252 : i32 = j_1; + let x_253 : i32 = *(h); + if ((x_252 <= (x_253 - 1))) { + } else { + break; + } + let x_257 : i32 = j_1; + let x_259 : i32 = obj.numbers[x_257]; + let x_260 : i32 = pivot; + if ((x_259 <= x_260)) { + let x_264 : i32 = i_1; + i_1 = (x_264 + 1); + let x_266 : i32 = i_1; + param = x_266; + let x_267 : i32 = j_1; + param_1 = x_267; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_269 : i32 = j_1; + j_1 = (x_269 + 1); + } + } + let x_271 : i32 = i_1; + i_1 = (x_271 + 1); + let x_273 : i32 = i_1; + param_2 = x_273; + let x_274 : i32 = *(h); + param_3 = x_274; + swap_i1_i1_(&(param_2), &(param_3)); + let x_276 : i32 = i_1; + return x_276; +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var int_a : i32; + var x_278 : i32; + var x_279 : i32; + var clamp_a : i32; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_280 : i32 = top; + let x_281 : i32 = (x_280 + 1); + top = x_281; + let x_282 : i32 = l_1; + stack[x_281] = x_282; + let x_285 : f32 = gl_FragCoord.y; + if ((x_285 >= 0.0)) { + let x_290 : i32 = h_1; + if (false) { + x_279 = 1; + } else { + let x_294 : i32 = h_1; + x_279 = (x_294 << bitcast(0)); + } + let x_296 : i32 = x_279; + x_278 = (x_290 | x_296); + } else { + x_278 = 1; + } + let x_298 : i32 = x_278; + int_a = x_298; + let x_299 : i32 = h_1; + let x_300 : i32 = h_1; + let x_301 : i32 = int_a; + clamp_a = clamp(x_299, x_300, x_301); + let x_303 : i32 = top; + let x_304 : i32 = (x_303 + 1); + top = x_304; + let x_305 : i32 = clamp_a; + stack[x_304] = (x_305 / 1); + loop { + let x_312 : i32 = top; + if ((x_312 >= 0)) { + } else { + break; + } + let x_315 : i32 = top; + top = (x_315 - 1); + let x_318 : i32 = stack[x_315]; + h_1 = x_318; + let x_319 : i32 = top; + top = (x_319 - 1); + let x_322 : i32 = stack[x_319]; + l_1 = x_322; + let x_323 : i32 = l_1; + param_4 = x_323; + let x_324 : i32 = h_1; + param_5 = x_324; + let x_325 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_325; + let x_326 : i32 = p; + let x_328 : i32 = l_1; + if (((x_326 - 1) > x_328)) { + let x_332 : i32 = top; + let x_333 : i32 = (x_332 + 1); + top = x_333; + let x_334 : i32 = l_1; + stack[x_333] = x_334; + let x_336 : i32 = top; + let x_337 : i32 = (x_336 + 1); + top = x_337; + let x_338 : i32 = p; + stack[x_337] = (x_338 - 1); + } + let x_341 : i32 = p; + let x_343 : i32 = h_1; + if (((x_341 + 1) < x_343)) { + let x_347 : i32 = top; + let x_348 : i32 = (x_347 + 1); + top = x_348; + let x_349 : i32 = p; + stack[x_348] = (x_349 + 1); + let x_352 : i32 = top; + let x_353 : i32 = (x_352 + 1); + top = x_353; + let x_354 : i32 = h_1; + stack[x_353] = x_354; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + i_2 = 0; + loop { + let x_90 : i32 = i_2; + if ((x_90 < 10)) { + } else { + break; + } + let x_93 : i32 = i_2; + let x_94 : i32 = i_2; + obj.numbers[x_93] = (10 - x_94); + let x_97 : i32 = i_2; + let x_98 : i32 = i_2; + let x_100 : i32 = obj.numbers[x_98]; + let x_101 : i32 = i_2; + let x_103 : i32 = obj.numbers[x_101]; + obj.numbers[x_97] = (x_100 * x_103); + + continuing { + let x_106 : i32 = i_2; + i_2 = (x_106 + 1); + } + } + quicksort_(); + let x_109 : vec4 = gl_FragCoord; + let x_112 : vec2 = x_34.resolution; + uv = (vec2(x_109.x, x_109.y) / x_112); + color = vec3(1.0, 2.0, 3.0); + let x_115 : i32 = obj.numbers[0]; + let x_118 : f32 = color.x; + color.x = (x_118 + f32(x_115)); + let x_122 : f32 = uv.x; + if ((x_122 > 0.25)) { + let x_127 : i32 = obj.numbers[1]; + let x_130 : f32 = color.x; + color.x = (x_130 + f32(x_127)); + } + let x_134 : f32 = uv.x; + if ((x_134 > 0.5)) { + let x_139 : i32 = obj.numbers[2]; + let x_142 : f32 = color.y; + color.y = (x_142 + f32(x_139)); + } + let x_146 : f32 = uv.x; + if ((x_146 > 0.75)) { + let x_151 : i32 = obj.numbers[3]; + let x_154 : f32 = color.z; + color.z = (x_154 + f32(x_151)); + } + let x_158 : i32 = obj.numbers[4]; + let x_161 : f32 = color.y; + color.y = (x_161 + f32(x_158)); + let x_165 : f32 = uv.y; + if ((x_165 > 0.25)) { + let x_170 : i32 = obj.numbers[5]; + let x_173 : f32 = color.x; + color.x = (x_173 + f32(x_170)); + } + let x_177 : f32 = uv.y; + if ((x_177 > 0.5)) { + let x_182 : i32 = obj.numbers[6]; + let x_185 : f32 = color.y; + color.y = (x_185 + f32(x_182)); + } + let x_189 : f32 = uv.y; + if ((x_189 > 0.75)) { + let x_194 : i32 = obj.numbers[7]; + let x_197 : f32 = color.z; + color.z = (x_197 + f32(x_194)); + } + let x_201 : i32 = obj.numbers[8]; + let x_204 : f32 = color.z; + color.z = (x_204 + f32(x_201)); + let x_208 : f32 = uv.x; + let x_210 : f32 = uv.y; + if ((abs((x_208 - x_210)) < 0.25)) { + let x_217 : i32 = obj.numbers[9]; + let x_220 : f32 = color.x; + color.x = (x_220 + f32(x_217)); + } + let x_223 : vec3 = color; + let x_224 : vec3 = normalize(x_223); + x_GLF_color = vec4(x_224.x, x_224.y, x_224.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm new file mode 100644 index 0000000000..b93bfe7f3b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm @@ -0,0 +1,503 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_GLF_pos %frag_color %__0 + OpSource ESSL 310 + OpName %main "main" + OpName %swap_i1_i1_ "swap(i1;i1;" + OpName %i "i" + OpName %j "j" + OpName %performPartition_i1_i1_ "performPartition(i1;i1;" + OpName %l "l" + OpName %h "h" + OpName %quicksort_ "quicksort(" + OpName %temp "temp" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %pivot "pivot" + OpName %i_0 "i" + OpName %j_0 "j" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %l_0 "l" + OpName %h_0 "h" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %_GLF_FragCoord "_GLF_FragCoord" + OpName %_GLF_pos "_GLF_pos" + OpName %i_1 "i" + OpName %uv "uv" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %color "color" + OpName %frag_color "frag_color" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpName %__0 "" + OpDecorate %_GLF_pos Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %frag_color Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %38 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %41 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %42 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float +%_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private +%_ptr_Input_v4float = OpTypePointer Input %v4float + %_GLF_pos = OpVariable %_ptr_Input_v4float Input + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %60 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %62 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_10 = OpConstant %int 10 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %72 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %frag_color = OpVariable %_ptr_Output_v4float Output +%gl_PerVertex = OpTypeStruct %v4float %float +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output + %main = OpFunction %void None %38 + %89 = OpLabel + %i_1 = OpVariable %_ptr_Function_int Function + %uv = OpVariable %_ptr_Function_v2float Function + %color = OpVariable %_ptr_Function_v3float Function + %90 = OpLoad %v4float %_GLF_pos + %91 = OpFAdd %v4float %90 %60 + %92 = OpFMul %v4float %91 %62 + OpStore %_GLF_FragCoord %92 + OpStore %i_1 %int_0 + OpBranch %93 + %93 = OpLabel + OpLoopMerge %94 %95 None + OpBranch %96 + %96 = OpLabel + %97 = OpLoad %int %i_1 + %98 = OpSLessThan %bool %97 %int_10 + OpBranchConditional %98 %99 %94 + %99 = OpLabel + %100 = OpLoad %int %i_1 + %101 = OpLoad %int %i_1 + %102 = OpISub %int %int_10 %101 + %103 = OpAccessChain %_ptr_Private_int %obj %int_0 %100 + OpStore %103 %102 + %104 = OpLoad %int %i_1 + %105 = OpLoad %int %i_1 + %106 = OpAccessChain %_ptr_Private_int %obj %int_0 %105 + %107 = OpLoad %int %106 + %108 = OpLoad %int %i_1 + %109 = OpAccessChain %_ptr_Private_int %obj %int_0 %108 + %110 = OpLoad %int %109 + %111 = OpIMul %int %107 %110 + %112 = OpAccessChain %_ptr_Private_int %obj %int_0 %104 + OpStore %112 %111 + OpBranch %95 + %95 = OpLabel + %113 = OpLoad %int %i_1 + %114 = OpIAdd %int %113 %int_1 + OpStore %i_1 %114 + OpBranch %93 + %94 = OpLabel + %115 = OpFunctionCall %void %quicksort_ + %116 = OpLoad %v4float %_GLF_FragCoord + %117 = OpVectorShuffle %v2float %116 %116 0 1 + %118 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %119 = OpLoad %v2float %118 + %120 = OpFDiv %v2float %117 %119 + OpStore %uv %120 + OpStore %color %72 + %121 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_0 + %122 = OpLoad %int %121 + %123 = OpConvertSToF %float %122 + %124 = OpAccessChain %_ptr_Function_float %color %uint_0 + %125 = OpLoad %float %124 + %126 = OpFAdd %float %125 %123 + %127 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %127 %126 + %128 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %129 = OpLoad %float %128 + %130 = OpFOrdGreaterThan %bool %129 %float_0_25 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %131 + %132 = OpLabel + %133 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_1 + %134 = OpLoad %int %133 + %135 = OpConvertSToF %float %134 + %136 = OpAccessChain %_ptr_Function_float %color %uint_0 + %137 = OpLoad %float %136 + %138 = OpFAdd %float %137 %135 + %139 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %139 %138 + OpBranch %131 + %131 = OpLabel + %140 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %141 = OpLoad %float %140 + %142 = OpFOrdGreaterThan %bool %141 %float_0_5 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %143 + %144 = OpLabel + %145 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_2 + %146 = OpLoad %int %145 + %147 = OpConvertSToF %float %146 + %148 = OpAccessChain %_ptr_Function_float %color %uint_1 + %149 = OpLoad %float %148 + %150 = OpFAdd %float %149 %147 + %151 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %151 %150 + OpBranch %143 + %143 = OpLabel + %152 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %153 = OpLoad %float %152 + %154 = OpFOrdGreaterThan %bool %153 %float_0_75 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %155 + %156 = OpLabel + %157 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_3 + %158 = OpLoad %int %157 + %159 = OpConvertSToF %float %158 + %160 = OpAccessChain %_ptr_Function_float %color %uint_2 + %161 = OpLoad %float %160 + %162 = OpFAdd %float %161 %159 + %163 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %163 %162 + OpBranch %155 + %155 = OpLabel + %164 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_4 + %165 = OpLoad %int %164 + %166 = OpConvertSToF %float %165 + %167 = OpAccessChain %_ptr_Function_float %color %uint_1 + %168 = OpLoad %float %167 + %169 = OpFAdd %float %168 %166 + %170 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %170 %169 + %171 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %172 = OpLoad %float %171 + %173 = OpFOrdGreaterThan %bool %172 %float_0_25 + OpSelectionMerge %174 None + OpBranchConditional %173 %175 %174 + %175 = OpLabel + %176 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_5 + %177 = OpLoad %int %176 + %178 = OpConvertSToF %float %177 + %179 = OpAccessChain %_ptr_Function_float %color %uint_0 + %180 = OpLoad %float %179 + %181 = OpFAdd %float %180 %178 + %182 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %182 %181 + OpBranch %174 + %174 = OpLabel + %183 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %184 = OpLoad %float %183 + %185 = OpFOrdGreaterThan %bool %184 %float_0_5 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %186 + %187 = OpLabel + %188 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_6 + %189 = OpLoad %int %188 + %190 = OpConvertSToF %float %189 + %191 = OpAccessChain %_ptr_Function_float %color %uint_1 + %192 = OpLoad %float %191 + %193 = OpFAdd %float %192 %190 + %194 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %194 %193 + OpBranch %186 + %186 = OpLabel + %195 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %196 = OpLoad %float %195 + %197 = OpFOrdGreaterThan %bool %196 %float_0_75 + OpSelectionMerge %198 None + OpBranchConditional %197 %199 %198 + %199 = OpLabel + %200 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_7 + %201 = OpLoad %int %200 + %202 = OpConvertSToF %float %201 + %203 = OpAccessChain %_ptr_Function_float %color %uint_2 + %204 = OpLoad %float %203 + %205 = OpFAdd %float %204 %202 + %206 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %206 %205 + OpBranch %198 + %198 = OpLabel + %207 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_8 + %208 = OpLoad %int %207 + %209 = OpConvertSToF %float %208 + %210 = OpAccessChain %_ptr_Function_float %color %uint_2 + %211 = OpLoad %float %210 + %212 = OpFAdd %float %211 %209 + %213 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %213 %212 + %214 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %215 = OpLoad %float %214 + %216 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %217 = OpLoad %float %216 + %218 = OpFSub %float %215 %217 + %219 = OpExtInst %float %1 FAbs %218 + %220 = OpFOrdLessThan %bool %219 %float_0_25 + OpSelectionMerge %221 None + OpBranchConditional %220 %222 %221 + %222 = OpLabel + %223 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_9 + %224 = OpLoad %int %223 + %225 = OpConvertSToF %float %224 + %226 = OpAccessChain %_ptr_Function_float %color %uint_0 + %227 = OpLoad %float %226 + %228 = OpFAdd %float %227 %225 + %229 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %229 %228 + OpBranch %221 + %221 = OpLabel + %230 = OpLoad %v3float %color + %231 = OpExtInst %v3float %1 Normalize %230 + %232 = OpCompositeExtract %float %231 0 + %233 = OpCompositeExtract %float %231 1 + %234 = OpCompositeExtract %float %231 2 + %235 = OpCompositeConstruct %v4float %232 %233 %234 %float_1 + OpStore %frag_color %235 + %236 = OpLoad %v4float %_GLF_pos + %237 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %237 %236 + OpReturn + OpFunctionEnd +%swap_i1_i1_ = OpFunction %void None %41 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %238 = OpLabel + %temp = OpVariable %_ptr_Function_int Function + %239 = OpLoad %int %i + %240 = OpAccessChain %_ptr_Private_int %obj %int_0 %239 + %241 = OpLoad %int %240 + OpStore %temp %241 + %242 = OpLoad %int %i + %243 = OpLoad %int %j + %244 = OpAccessChain %_ptr_Private_int %obj %int_0 %243 + %245 = OpLoad %int %244 + %246 = OpAccessChain %_ptr_Private_int %obj %int_0 %242 + OpStore %246 %245 + %247 = OpLoad %int %j + %248 = OpLoad %int %temp + %249 = OpAccessChain %_ptr_Private_int %obj %int_0 %247 + OpStore %249 %248 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %42 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %250 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_int Function + %251 = OpLoad %int %h + %252 = OpAccessChain %_ptr_Private_int %obj %int_0 %251 + %253 = OpLoad %int %252 + OpStore %pivot %253 + %254 = OpLoad %int %l + %255 = OpISub %int %254 %int_1 + OpStore %i_0 %255 + %256 = OpLoad %int %l + OpStore %j_0 %256 + OpBranch %257 + %257 = OpLabel + OpLoopMerge %258 %259 None + OpBranch %260 + %260 = OpLabel + %261 = OpLoad %int %j_0 + %262 = OpLoad %int %h + %263 = OpISub %int %262 %int_1 + %264 = OpSLessThanEqual %bool %261 %263 + OpBranchConditional %264 %265 %258 + %265 = OpLabel + %266 = OpLoad %int %j_0 + %267 = OpAccessChain %_ptr_Private_int %obj %int_0 %266 + %268 = OpLoad %int %267 + %269 = OpLoad %int %pivot + %270 = OpSLessThanEqual %bool %268 %269 + OpSelectionMerge %271 None + OpBranchConditional %270 %272 %271 + %272 = OpLabel + %273 = OpLoad %int %i_0 + %274 = OpIAdd %int %273 %int_1 + OpStore %i_0 %274 + %275 = OpLoad %int %i_0 + OpStore %param %275 + %276 = OpLoad %int %j_0 + OpStore %param_0 %276 + %277 = OpFunctionCall %void %swap_i1_i1_ %param %param_0 + OpBranch %271 + %271 = OpLabel + OpBranch %259 + %259 = OpLabel + %278 = OpLoad %int %j_0 + %279 = OpIAdd %int %278 %int_1 + OpStore %j_0 %279 + OpBranch %257 + %258 = OpLabel + %280 = OpLoad %int %i_0 + %281 = OpIAdd %int %280 %int_1 + OpStore %param_1 %281 + %282 = OpLoad %int %h + OpStore %param_2 %282 + %283 = OpFunctionCall %void %swap_i1_i1_ %param_1 %param_2 + %284 = OpLoad %int %i_0 + %285 = OpIAdd %int %284 %int_1 + OpReturnValue %285 + OpFunctionEnd + %quicksort_ = OpFunction %void None %38 + %286 = OpLabel + %l_0 = OpVariable %_ptr_Function_int Function + %h_0 = OpVariable %_ptr_Function_int Function + %top = OpVariable %_ptr_Function_int Function + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function + %p = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_int Function + %param_4 = OpVariable %_ptr_Function_int Function + OpStore %l_0 %int_0 + OpStore %h_0 %int_9 + OpStore %top %int_n1 + %287 = OpLoad %int %top + %288 = OpIAdd %int %287 %int_1 + OpStore %top %288 + %289 = OpLoad %int %l_0 + %290 = OpAccessChain %_ptr_Function_int %stack %288 + OpStore %290 %289 + %291 = OpLoad %int %top + %292 = OpIAdd %int %291 %int_1 + OpStore %top %292 + %293 = OpLoad %int %h_0 + %294 = OpAccessChain %_ptr_Function_int %stack %292 + OpStore %294 %293 + OpBranch %295 + %295 = OpLabel + OpLoopMerge %296 %297 None + OpBranch %298 + %298 = OpLabel + %299 = OpLoad %int %top + %300 = OpSGreaterThanEqual %bool %299 %int_0 + OpBranchConditional %300 %301 %296 + %301 = OpLabel + %302 = OpLoad %int %top + %303 = OpISub %int %302 %int_1 + OpStore %top %303 + %304 = OpAccessChain %_ptr_Function_int %stack %302 + %305 = OpLoad %int %304 + OpStore %h_0 %305 + %306 = OpLoad %int %top + %307 = OpISub %int %306 %int_1 + OpStore %top %307 + %308 = OpAccessChain %_ptr_Function_int %stack %306 + %309 = OpLoad %int %308 + OpStore %l_0 %309 + %310 = OpLoad %int %l_0 + OpStore %param_3 %310 + %311 = OpLoad %int %h_0 + OpStore %param_4 %311 + %312 = OpFunctionCall %int %performPartition_i1_i1_ %param_3 %param_4 + OpStore %p %312 + %313 = OpLoad %int %p + %314 = OpISub %int %313 %int_1 + %315 = OpLoad %int %l_0 + %316 = OpSGreaterThan %bool %314 %315 + OpSelectionMerge %317 None + OpBranchConditional %316 %318 %317 + %318 = OpLabel + %319 = OpLoad %int %top + %320 = OpIAdd %int %319 %int_1 + OpStore %top %320 + %321 = OpLoad %int %l_0 + %322 = OpAccessChain %_ptr_Function_int %stack %320 + OpStore %322 %321 + %323 = OpLoad %int %top + %324 = OpIAdd %int %323 %int_1 + OpStore %top %324 + %325 = OpLoad %int %p + %326 = OpISub %int %325 %int_1 + %327 = OpAccessChain %_ptr_Function_int %stack %324 + OpStore %327 %326 + OpBranch %317 + %317 = OpLabel + %328 = OpLoad %int %p + %329 = OpIAdd %int %328 %int_1 + %330 = OpLoad %int %h_0 + %331 = OpSLessThan %bool %329 %330 + OpSelectionMerge %332 None + OpBranchConditional %331 %333 %332 + %333 = OpLabel + %334 = OpLoad %int %top + %335 = OpIAdd %int %334 %int_1 + OpStore %top %335 + %336 = OpLoad %int %p + %337 = OpIAdd %int %336 %int_1 + %338 = OpAccessChain %_ptr_Function_int %stack %335 + OpStore %338 %337 + %339 = OpLoad %int %top + %340 = OpIAdd %int %339 %int_1 + OpStore %top %340 + %341 = OpLoad %int %h_0 + %342 = OpAccessChain %_ptr_Function_int %stack %340 + OpStore %342 %341 + OpBranch %332 + %332 = OpLabel + OpBranch %297 + %297 = OpLabel + OpBranch %295 + %296 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..a3206291c1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.hlsl @@ -0,0 +1,219 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_34 : register(b0, space0) { + uint4 x_34[1]; +}; +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_239 = i; + const int x_241 = obj.numbers[x_239]; + temp = x_241; + const int x_242 = i; + const int x_243 = j; + const int x_245 = obj.numbers[x_243]; + obj.numbers[x_242] = x_245; + const int x_247 = j; + obj.numbers[x_247] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_251 = h; + const int x_253 = obj.numbers[x_251]; + pivot = x_253; + const int x_254 = l; + i_1 = (x_254 - 1); + const int x_256 = l; + j_1 = x_256; + while (true) { + const int x_261 = j_1; + const int x_262 = h; + if ((x_261 <= (x_262 - 1))) { + } else { + break; + } + const int x_268 = obj.numbers[j_1]; + if ((x_268 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + param_2 = (i_1 + 1); + const int x_282 = h; + param_3 = x_282; + swap_i1_i1_(param_2, param_3); + return (i_1 + 1); +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_288 = (top + 1); + top = x_288; + stack[x_288] = l_1; + const int x_292 = (top + 1); + top = x_292; + stack[x_292] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_302 = top; + top = (x_302 - 1); + const int x_305 = stack[x_302]; + h_1 = x_305; + const int x_306 = top; + top = (x_306 - 1); + const int x_309 = stack[x_306]; + l_1 = x_309; + param_4 = l_1; + param_5 = h_1; + const int x_312 = performPartition_i1_i1_(param_4, param_5); + p = x_312; + if (((p - 1) > l_1)) { + const int x_320 = (top + 1); + top = x_320; + stack[x_320] = l_1; + const int x_324 = (top + 1); + top = x_324; + stack[x_324] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_335 = (top + 1); + top = x_335; + stack[x_335] = (p + 1); + const int x_340 = (top + 1); + top = x_340; + stack[x_340] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_104 = i_2; + const int x_107 = obj.numbers[i_2]; + const int x_110 = obj.numbers[i_2]; + obj.numbers[x_104] = (x_107 * x_110); + } + } + quicksort_(); + const float4 x_116 = x_GLF_FragCoord; + const float2 x_119 = asfloat(x_34[0].xy); + uv = (float2(x_116.x, x_116.y) / x_119); + color = float3(1.0f, 2.0f, 3.0f); + const int x_122 = obj.numbers[0]; + const float x_125 = color.x; + color.x = (x_125 + float(x_122)); + const float x_129 = uv.x; + if ((x_129 > 0.25f)) { + const int x_134 = obj.numbers[1]; + const float x_137 = color.x; + color.x = (x_137 + float(x_134)); + } + const float x_141 = uv.x; + if ((x_141 > 0.5f)) { + const int x_146 = obj.numbers[2]; + const float x_149 = color.y; + color.y = (x_149 + float(x_146)); + } + const float x_153 = uv.x; + if ((x_153 > 0.75f)) { + const int x_158 = obj.numbers[3]; + const float x_161 = color.z; + color.z = (x_161 + float(x_158)); + } + const int x_165 = obj.numbers[4]; + const float x_168 = color.y; + color.y = (x_168 + float(x_165)); + const float x_172 = uv.y; + if ((x_172 > 0.25f)) { + const int x_177 = obj.numbers[5]; + const float x_180 = color.x; + color.x = (x_180 + float(x_177)); + } + const float x_184 = uv.y; + if ((x_184 > 0.5f)) { + const int x_189 = obj.numbers[6]; + const float x_192 = color.y; + color.y = (x_192 + float(x_189)); + } + const float x_196 = uv.y; + if ((x_196 > 0.75f)) { + const int x_201 = obj.numbers[7]; + const float x_204 = color.z; + color.z = (x_204 + float(x_201)); + } + const int x_208 = obj.numbers[8]; + const float x_211 = color.z; + color.z = (x_211 + float(x_208)); + const float x_215 = uv.x; + const float x_217 = uv.y; + if ((abs((x_215 - x_217)) < 0.25f)) { + const int x_224 = obj.numbers[9]; + const float x_227 = color.x; + color.x = (x_227 + float(x_224)); + } + const float3 x_231 = normalize(color); + frag_color = float4(x_231.x, x_231.y, x_231.z, 1.0f); + gl_Position = x_GLF_pos; + return; +} + +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 x_GLF_pos_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_GLF_pos_param = tint_symbol.x_GLF_pos_param; + x_GLF_pos = x_GLF_pos_param; + main_1(); + const main_out tint_symbol_3 = {frag_color, gl_Position}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f82023bf05 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.msl @@ -0,0 +1,266 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_pos_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_6) { + int temp = 0; + int const x_239 = *(i); + int const x_241 = (*(tint_symbol_6)).numbers.arr[x_239]; + temp = x_241; + int const x_242 = *(i); + int const x_243 = *(j); + int const x_245 = (*(tint_symbol_6)).numbers.arr[x_243]; + (*(tint_symbol_6)).numbers.arr[x_242] = x_245; + int const x_247 = *(j); + int const x_248 = temp; + (*(tint_symbol_6)).numbers.arr[x_247] = x_248; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_7) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_251 = *(h); + int const x_253 = (*(tint_symbol_7)).numbers.arr[x_251]; + pivot = x_253; + int const x_254 = *(l); + i_1 = (x_254 - 1); + int const x_256 = *(l); + j_1 = x_256; + while (true) { + int const x_261 = j_1; + int const x_262 = *(h); + if ((x_261 <= (x_262 - 1))) { + } else { + break; + } + int const x_266 = j_1; + int const x_268 = (*(tint_symbol_7)).numbers.arr[x_266]; + int const x_269 = pivot; + if ((x_268 <= x_269)) { + int const x_273 = i_1; + i_1 = (x_273 + 1); + int const x_275 = i_1; + param = x_275; + int const x_276 = j_1; + param_1 = x_276; + swap_i1_i1_(&(param), &(param_1), tint_symbol_7); + } + { + int const x_278 = j_1; + j_1 = (x_278 + 1); + } + } + int const x_280 = i_1; + param_2 = (x_280 + 1); + int const x_282 = *(h); + param_3 = x_282; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_7); + int const x_284 = i_1; + return (x_284 + 1); +} + +void quicksort_(thread QuicksortObject* const tint_symbol_8) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_287 = top; + int const x_288 = (x_287 + 1); + top = x_288; + int const x_289 = l_1; + stack.arr[x_288] = x_289; + int const x_291 = top; + int const x_292 = (x_291 + 1); + top = x_292; + int const x_293 = h_1; + stack.arr[x_292] = x_293; + while (true) { + int const x_299 = top; + if ((x_299 >= 0)) { + } else { + break; + } + int const x_302 = top; + top = (x_302 - 1); + int const x_305 = stack.arr[x_302]; + h_1 = x_305; + int const x_306 = top; + top = (x_306 - 1); + int const x_309 = stack.arr[x_306]; + l_1 = x_309; + int const x_310 = l_1; + param_4 = x_310; + int const x_311 = h_1; + param_5 = x_311; + int const x_312 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_8); + p = x_312; + int const x_313 = p; + int const x_315 = l_1; + if (((x_313 - 1) > x_315)) { + int const x_319 = top; + int const x_320 = (x_319 + 1); + top = x_320; + int const x_321 = l_1; + stack.arr[x_320] = x_321; + int const x_323 = top; + int const x_324 = (x_323 + 1); + top = x_324; + int const x_325 = p; + stack.arr[x_324] = (x_325 - 1); + } + int const x_328 = p; + int const x_330 = h_1; + if (((x_328 + 1) < x_330)) { + int const x_334 = top; + int const x_335 = (x_334 + 1); + top = x_335; + int const x_336 = p; + stack.arr[x_335] = (x_336 + 1); + int const x_339 = top; + int const x_340 = (x_339 + 1); + top = x_340; + int const x_341 = h_1; + stack.arr[x_340] = x_341; + } + } + return; +} + +void main_1(constant buf0& x_34, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10, thread QuicksortObject* const tint_symbol_11, thread float4* const tint_symbol_12, thread float4* const tint_symbol_13) { + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + float4 const x_90 = *(tint_symbol_9); + *(tint_symbol_10) = ((x_90 + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + while (true) { + int const x_97 = i_2; + if ((x_97 < 10)) { + } else { + break; + } + int const x_100 = i_2; + int const x_101 = i_2; + (*(tint_symbol_11)).numbers.arr[x_100] = (10 - x_101); + int const x_104 = i_2; + int const x_105 = i_2; + int const x_107 = (*(tint_symbol_11)).numbers.arr[x_105]; + int const x_108 = i_2; + int const x_110 = (*(tint_symbol_11)).numbers.arr[x_108]; + (*(tint_symbol_11)).numbers.arr[x_104] = (x_107 * x_110); + { + int const x_113 = i_2; + i_2 = (x_113 + 1); + } + } + quicksort_(tint_symbol_11); + float4 const x_116 = *(tint_symbol_10); + float2 const x_119 = x_34.resolution; + uv = (float2(x_116.x, x_116.y) / x_119); + color = float3(1.0f, 2.0f, 3.0f); + int const x_122 = (*(tint_symbol_11)).numbers.arr[0]; + float const x_125 = color.x; + color.x = (x_125 + float(x_122)); + float const x_129 = uv.x; + if ((x_129 > 0.25f)) { + int const x_134 = (*(tint_symbol_11)).numbers.arr[1]; + float const x_137 = color.x; + color.x = (x_137 + float(x_134)); + } + float const x_141 = uv.x; + if ((x_141 > 0.5f)) { + int const x_146 = (*(tint_symbol_11)).numbers.arr[2]; + float const x_149 = color.y; + color.y = (x_149 + float(x_146)); + } + float const x_153 = uv.x; + if ((x_153 > 0.75f)) { + int const x_158 = (*(tint_symbol_11)).numbers.arr[3]; + float const x_161 = color.z; + color.z = (x_161 + float(x_158)); + } + int const x_165 = (*(tint_symbol_11)).numbers.arr[4]; + float const x_168 = color.y; + color.y = (x_168 + float(x_165)); + float const x_172 = uv.y; + if ((x_172 > 0.25f)) { + int const x_177 = (*(tint_symbol_11)).numbers.arr[5]; + float const x_180 = color.x; + color.x = (x_180 + float(x_177)); + } + float const x_184 = uv.y; + if ((x_184 > 0.5f)) { + int const x_189 = (*(tint_symbol_11)).numbers.arr[6]; + float const x_192 = color.y; + color.y = (x_192 + float(x_189)); + } + float const x_196 = uv.y; + if ((x_196 > 0.75f)) { + int const x_201 = (*(tint_symbol_11)).numbers.arr[7]; + float const x_204 = color.z; + color.z = (x_204 + float(x_201)); + } + int const x_208 = (*(tint_symbol_11)).numbers.arr[8]; + float const x_211 = color.z; + color.z = (x_211 + float(x_208)); + float const x_215 = uv.x; + float const x_217 = uv.y; + if ((fabs((x_215 - x_217)) < 0.25f)) { + int const x_224 = (*(tint_symbol_11)).numbers.arr[9]; + float const x_227 = color.x; + color.x = (x_227 + float(x_224)); + } + float3 const x_230 = color; + float3 const x_231 = normalize(x_230); + *(tint_symbol_12) = float4(x_231.x, x_231.y, x_231.z, 1.0f); + float4 const x_236 = *(tint_symbol_9); + *(tint_symbol_13) = x_236; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant buf0& x_34 [[buffer(0)]]) { + thread float4 tint_symbol_14 = 0.0f; + thread float4 tint_symbol_15 = 0.0f; + thread QuicksortObject tint_symbol_16 = {}; + thread float4 tint_symbol_17 = 0.0f; + thread float4 tint_symbol_18 = 0.0f; + float4 const x_GLF_pos_param = tint_symbol_1.x_GLF_pos_param; + tint_symbol_14 = x_GLF_pos_param; + main_1(x_34, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_16), &(tint_symbol_17), &(tint_symbol_18)); + main_out const tint_symbol_4 = {.frag_color_1=tint_symbol_17, .gl_Position=tint_symbol_18}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..db05970459 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.spvasm @@ -0,0 +1,567 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 390 +; Schema: 0 + OpCapability Shader + %356 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %x_GLF_FragCoord "x_GLF_FragCoord" + OpName %x_GLF_pos "x_GLF_pos" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_34 "x_34" + OpName %frag_color "frag_color" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "frag_color_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_34 NonWritable + OpDecorate %x_34 DescriptorSet 0 + OpDecorate %x_34 Binding 0 + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_3 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %12 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private %16 + %x_GLF_pos = OpVariable %_ptr_Private_v4float Private %16 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_34 = OpVariable %_ptr_Uniform_buf0 Uniform + %frag_color = OpVariable %_ptr_Private_v4float Private %16 +%gl_Position = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %16 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %37 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %55 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %115 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %123 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %195 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %199 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %203 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %206 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_10 = OpConstant %int 10 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %244 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float %v4float + %375 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %29 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %35 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %37 + %39 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Private_int %obj %uint_0 %39 + %43 = OpLoad %int %42 + OpStore %temp %43 + %45 = OpLoad %int %i + %47 = OpLoad %int %j + %48 = OpAccessChain %_ptr_Private_int %obj %uint_0 %47 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_Private_int %obj %uint_0 %45 + OpStore %50 %49 + %52 = OpLoad %int %j + %53 = OpLoad %int %temp + %54 = OpAccessChain %_ptr_Private_int %obj %uint_0 %52 + OpStore %54 %53 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %55 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %59 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %37 + %i_1 = OpVariable %_ptr_Function_int Function %37 + %j_1 = OpVariable %_ptr_Function_int Function %37 + %param = OpVariable %_ptr_Function_int Function %37 + %param_1 = OpVariable %_ptr_Function_int Function %37 + %param_2 = OpVariable %_ptr_Function_int Function %37 + %param_3 = OpVariable %_ptr_Function_int Function %37 + %68 = OpLoad %int %h + %69 = OpAccessChain %_ptr_Private_int %obj %uint_0 %68 + %70 = OpLoad %int %69 + OpStore %pivot %70 + %72 = OpLoad %int %l + %74 = OpISub %int %72 %int_1 + OpStore %i_1 %74 + %76 = OpLoad %int %l + OpStore %j_1 %76 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %78 %79 None + OpBranch %80 + %80 = OpLabel + %81 = OpLoad %int %j_1 + %83 = OpLoad %int %h + %84 = OpISub %int %83 %int_1 + %85 = OpSLessThanEqual %bool %81 %84 + OpSelectionMerge %87 None + OpBranchConditional %85 %88 %89 + %88 = OpLabel + OpBranch %87 + %89 = OpLabel + OpBranch %78 + %87 = OpLabel + %90 = OpLoad %int %j_1 + %91 = OpAccessChain %_ptr_Private_int %obj %uint_0 %90 + %92 = OpLoad %int %91 + %93 = OpLoad %int %pivot + %94 = OpSLessThanEqual %bool %92 %93 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + %97 = OpLoad %int %i_1 + %98 = OpIAdd %int %97 %int_1 + OpStore %i_1 %98 + %99 = OpLoad %int %i_1 + OpStore %param %99 + %100 = OpLoad %int %j_1 + OpStore %param_1 %100 + %101 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %95 + %95 = OpLabel + OpBranch %79 + %79 = OpLabel + %104 = OpLoad %int %j_1 + %105 = OpIAdd %int %104 %int_1 + OpStore %j_1 %105 + OpBranch %77 + %78 = OpLabel + %106 = OpLoad %int %i_1 + %107 = OpIAdd %int %106 %int_1 + OpStore %param_2 %107 + %109 = OpLoad %int %h + OpStore %param_3 %109 + %110 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %113 = OpLoad %int %i_1 + %114 = OpIAdd %int %113 %int_1 + OpReturnValue %114 + OpFunctionEnd + %quicksort_ = OpFunction %void None %115 + %117 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %37 + %h_1 = OpVariable %_ptr_Function_int Function %37 + %top = OpVariable %_ptr_Function_int Function %37 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %123 + %p = OpVariable %_ptr_Function_int Function %37 + %param_4 = OpVariable %_ptr_Function_int Function %37 + %param_5 = OpVariable %_ptr_Function_int Function %37 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %130 = OpLoad %int %top + %131 = OpIAdd %int %130 %int_1 + OpStore %top %131 + %132 = OpLoad %int %l_1 + %133 = OpAccessChain %_ptr_Function_int %stack %131 + OpStore %133 %132 + %134 = OpLoad %int %top + %135 = OpIAdd %int %134 %int_1 + OpStore %top %135 + %136 = OpLoad %int %h_1 + %137 = OpAccessChain %_ptr_Function_int %stack %135 + OpStore %137 %136 + OpBranch %138 + %138 = OpLabel + OpLoopMerge %139 %140 None + OpBranch %141 + %141 = OpLabel + %142 = OpLoad %int %top + %143 = OpSGreaterThanEqual %bool %142 %int_0 + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %146 + %145 = OpLabel + OpBranch %144 + %146 = OpLabel + OpBranch %139 + %144 = OpLabel + %147 = OpLoad %int %top + %148 = OpISub %int %147 %int_1 + OpStore %top %148 + %149 = OpAccessChain %_ptr_Function_int %stack %147 + %150 = OpLoad %int %149 + OpStore %h_1 %150 + %151 = OpLoad %int %top + %152 = OpISub %int %151 %int_1 + OpStore %top %152 + %153 = OpAccessChain %_ptr_Function_int %stack %151 + %154 = OpLoad %int %153 + OpStore %l_1 %154 + %155 = OpLoad %int %l_1 + OpStore %param_4 %155 + %156 = OpLoad %int %h_1 + OpStore %param_5 %156 + %157 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %157 + %160 = OpLoad %int %p + %161 = OpLoad %int %l_1 + %162 = OpISub %int %160 %int_1 + %163 = OpSGreaterThan %bool %162 %161 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %164 + %165 = OpLabel + %166 = OpLoad %int %top + %167 = OpIAdd %int %166 %int_1 + OpStore %top %167 + %168 = OpLoad %int %l_1 + %169 = OpAccessChain %_ptr_Function_int %stack %167 + OpStore %169 %168 + %170 = OpLoad %int %top + %171 = OpIAdd %int %170 %int_1 + OpStore %top %171 + %172 = OpLoad %int %p + %173 = OpAccessChain %_ptr_Function_int %stack %171 + %174 = OpISub %int %172 %int_1 + OpStore %173 %174 + OpBranch %164 + %164 = OpLabel + %175 = OpLoad %int %p + %176 = OpLoad %int %h_1 + %177 = OpIAdd %int %175 %int_1 + %178 = OpSLessThan %bool %177 %176 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %179 + %180 = OpLabel + %181 = OpLoad %int %top + %182 = OpIAdd %int %181 %int_1 + OpStore %top %182 + %183 = OpLoad %int %p + %184 = OpAccessChain %_ptr_Function_int %stack %182 + %185 = OpIAdd %int %183 %int_1 + OpStore %184 %185 + %186 = OpLoad %int %top + %187 = OpIAdd %int %186 %int_1 + OpStore %top %187 + %188 = OpLoad %int %h_1 + %189 = OpAccessChain %_ptr_Function_int %stack %187 + OpStore %189 %188 + OpBranch %179 + %179 = OpLabel + OpBranch %140 + %140 = OpLabel + OpBranch %138 + %139 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %115 + %191 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %37 + %uv = OpVariable %_ptr_Function_v2float Function %195 + %color = OpVariable %_ptr_Function_v3float Function %199 + %200 = OpLoad %v4float %x_GLF_pos + %204 = OpFAdd %v4float %200 %203 + %207 = OpFMul %v4float %204 %206 + OpStore %x_GLF_FragCoord %207 + OpStore %i_2 %int_0 + OpBranch %208 + %208 = OpLabel + OpLoopMerge %209 %210 None + OpBranch %211 + %211 = OpLabel + %212 = OpLoad %int %i_2 + %214 = OpSLessThan %bool %212 %int_10 + OpSelectionMerge %215 None + OpBranchConditional %214 %216 %217 + %216 = OpLabel + OpBranch %215 + %217 = OpLabel + OpBranch %209 + %215 = OpLabel + %218 = OpLoad %int %i_2 + %219 = OpLoad %int %i_2 + %220 = OpAccessChain %_ptr_Private_int %obj %uint_0 %218 + %221 = OpISub %int %int_10 %219 + OpStore %220 %221 + %222 = OpLoad %int %i_2 + %223 = OpLoad %int %i_2 + %224 = OpAccessChain %_ptr_Private_int %obj %uint_0 %223 + %225 = OpLoad %int %224 + %226 = OpLoad %int %i_2 + %227 = OpAccessChain %_ptr_Private_int %obj %uint_0 %226 + %228 = OpLoad %int %227 + %229 = OpAccessChain %_ptr_Private_int %obj %uint_0 %222 + %230 = OpIMul %int %225 %228 + OpStore %229 %230 + OpBranch %210 + %210 = OpLabel + %231 = OpLoad %int %i_2 + %232 = OpIAdd %int %231 %int_1 + OpStore %i_2 %232 + OpBranch %208 + %209 = OpLabel + %233 = OpFunctionCall %void %quicksort_ + %234 = OpLoad %v4float %x_GLF_FragCoord + %236 = OpAccessChain %_ptr_Uniform_v2float %x_34 %uint_0 + %237 = OpLoad %v2float %236 + %238 = OpCompositeExtract %float %234 0 + %239 = OpCompositeExtract %float %234 1 + %240 = OpCompositeConstruct %v2float %238 %239 + %241 = OpFDiv %v2float %240 %237 + OpStore %uv %241 + OpStore %color %244 + %245 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %246 = OpLoad %int %245 + %248 = OpAccessChain %_ptr_Function_float %color %uint_0 + %249 = OpLoad %float %248 + %250 = OpAccessChain %_ptr_Function_float %color %uint_0 + %251 = OpConvertSToF %float %246 + %252 = OpFAdd %float %249 %251 + OpStore %250 %252 + %253 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %254 = OpLoad %float %253 + %256 = OpFOrdGreaterThan %bool %254 %float_0_25 + OpSelectionMerge %257 None + OpBranchConditional %256 %258 %257 + %258 = OpLabel + %259 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %260 = OpLoad %int %259 + %261 = OpAccessChain %_ptr_Function_float %color %uint_0 + %262 = OpLoad %float %261 + %263 = OpAccessChain %_ptr_Function_float %color %uint_0 + %264 = OpConvertSToF %float %260 + %265 = OpFAdd %float %262 %264 + OpStore %263 %265 + OpBranch %257 + %257 = OpLabel + %266 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %267 = OpLoad %float %266 + %269 = OpFOrdGreaterThan %bool %267 %float_0_5 + OpSelectionMerge %270 None + OpBranchConditional %269 %271 %270 + %271 = OpLabel + %273 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %274 = OpLoad %int %273 + %276 = OpAccessChain %_ptr_Function_float %color %uint_1 + %277 = OpLoad %float %276 + %278 = OpAccessChain %_ptr_Function_float %color %uint_1 + %279 = OpConvertSToF %float %274 + %280 = OpFAdd %float %277 %279 + OpStore %278 %280 + OpBranch %270 + %270 = OpLabel + %281 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %282 = OpLoad %float %281 + %284 = OpFOrdGreaterThan %bool %282 %float_0_75 + OpSelectionMerge %285 None + OpBranchConditional %284 %286 %285 + %286 = OpLabel + %288 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %289 = OpLoad %int %288 + %291 = OpAccessChain %_ptr_Function_float %color %uint_2 + %292 = OpLoad %float %291 + %293 = OpAccessChain %_ptr_Function_float %color %uint_2 + %294 = OpConvertSToF %float %289 + %295 = OpFAdd %float %292 %294 + OpStore %293 %295 + OpBranch %285 + %285 = OpLabel + %297 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %298 = OpLoad %int %297 + %299 = OpAccessChain %_ptr_Function_float %color %uint_1 + %300 = OpLoad %float %299 + %301 = OpAccessChain %_ptr_Function_float %color %uint_1 + %302 = OpConvertSToF %float %298 + %303 = OpFAdd %float %300 %302 + OpStore %301 %303 + %304 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %305 = OpLoad %float %304 + %306 = OpFOrdGreaterThan %bool %305 %float_0_25 + OpSelectionMerge %307 None + OpBranchConditional %306 %308 %307 + %308 = OpLabel + %310 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %311 = OpLoad %int %310 + %312 = OpAccessChain %_ptr_Function_float %color %uint_0 + %313 = OpLoad %float %312 + %314 = OpAccessChain %_ptr_Function_float %color %uint_0 + %315 = OpConvertSToF %float %311 + %316 = OpFAdd %float %313 %315 + OpStore %314 %316 + OpBranch %307 + %307 = OpLabel + %317 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %318 = OpLoad %float %317 + %319 = OpFOrdGreaterThan %bool %318 %float_0_5 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %320 + %321 = OpLabel + %323 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %324 = OpLoad %int %323 + %325 = OpAccessChain %_ptr_Function_float %color %uint_1 + %326 = OpLoad %float %325 + %327 = OpAccessChain %_ptr_Function_float %color %uint_1 + %328 = OpConvertSToF %float %324 + %329 = OpFAdd %float %326 %328 + OpStore %327 %329 + OpBranch %320 + %320 = OpLabel + %330 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %331 = OpLoad %float %330 + %332 = OpFOrdGreaterThan %bool %331 %float_0_75 + OpSelectionMerge %333 None + OpBranchConditional %332 %334 %333 + %334 = OpLabel + %336 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %337 = OpLoad %int %336 + %338 = OpAccessChain %_ptr_Function_float %color %uint_2 + %339 = OpLoad %float %338 + %340 = OpAccessChain %_ptr_Function_float %color %uint_2 + %341 = OpConvertSToF %float %337 + %342 = OpFAdd %float %339 %341 + OpStore %340 %342 + OpBranch %333 + %333 = OpLabel + %344 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %345 = OpLoad %int %344 + %346 = OpAccessChain %_ptr_Function_float %color %uint_2 + %347 = OpLoad %float %346 + %348 = OpAccessChain %_ptr_Function_float %color %uint_2 + %349 = OpConvertSToF %float %345 + %350 = OpFAdd %float %347 %349 + OpStore %348 %350 + %351 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %352 = OpLoad %float %351 + %353 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %354 = OpLoad %float %353 + %357 = OpFSub %float %352 %354 + %355 = OpExtInst %float %356 FAbs %357 + %358 = OpFOrdLessThan %bool %355 %float_0_25 + OpSelectionMerge %359 None + OpBranchConditional %358 %360 %359 + %360 = OpLabel + %361 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %362 = OpLoad %int %361 + %363 = OpAccessChain %_ptr_Function_float %color %uint_0 + %364 = OpLoad %float %363 + %365 = OpAccessChain %_ptr_Function_float %color %uint_0 + %366 = OpConvertSToF %float %362 + %367 = OpFAdd %float %364 %366 + OpStore %365 %367 + OpBranch %359 + %359 = OpLabel + %368 = OpLoad %v3float %color + %369 = OpExtInst %v3float %356 Normalize %368 + %370 = OpCompositeExtract %float %369 0 + %371 = OpCompositeExtract %float %369 1 + %372 = OpCompositeExtract %float %369 2 + %373 = OpCompositeConstruct %v4float %370 %371 %372 %float_1 + OpStore %frag_color %373 + %374 = OpLoad %v4float %x_GLF_pos + OpStore %gl_Position %374 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %375 +%tint_symbol_1 = OpFunctionParameter %main_out + %379 = OpLabel + %380 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %380 + %381 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %381 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %115 + %383 = OpLabel + OpStore %tint_pointsize %float_1 + %384 = OpLoad %v4float %tint_symbol + OpStore %x_GLF_pos %384 + %385 = OpFunctionCall %void %main_1 + %387 = OpLoad %v4float %frag_color + %388 = OpLoad %v4float %gl_Position + %389 = OpCompositeConstruct %main_out %387 %388 + %386 = OpFunctionCall %void %tint_symbol_4 %389 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..134b77f6f9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.wgsl @@ -0,0 +1,264 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_239 : i32 = *(i); + let x_241 : i32 = obj.numbers[x_239]; + temp = x_241; + let x_242 : i32 = *(i); + let x_243 : i32 = *(j); + let x_245 : i32 = obj.numbers[x_243]; + obj.numbers[x_242] = x_245; + let x_247 : i32 = *(j); + let x_248 : i32 = temp; + obj.numbers[x_247] = x_248; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_251 : i32 = *(h); + let x_253 : i32 = obj.numbers[x_251]; + pivot = x_253; + let x_254 : i32 = *(l); + i_1 = (x_254 - 1); + let x_256 : i32 = *(l); + j_1 = x_256; + loop { + let x_261 : i32 = j_1; + let x_262 : i32 = *(h); + if ((x_261 <= (x_262 - 1))) { + } else { + break; + } + let x_266 : i32 = j_1; + let x_268 : i32 = obj.numbers[x_266]; + let x_269 : i32 = pivot; + if ((x_268 <= x_269)) { + let x_273 : i32 = i_1; + i_1 = (x_273 + 1); + let x_275 : i32 = i_1; + param = x_275; + let x_276 : i32 = j_1; + param_1 = x_276; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_278 : i32 = j_1; + j_1 = (x_278 + 1); + } + } + let x_280 : i32 = i_1; + param_2 = (x_280 + 1); + let x_282 : i32 = *(h); + param_3 = x_282; + swap_i1_i1_(&(param_2), &(param_3)); + let x_284 : i32 = i_1; + return (x_284 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_287 : i32 = top; + let x_288 : i32 = (x_287 + 1); + top = x_288; + let x_289 : i32 = l_1; + stack[x_288] = x_289; + let x_291 : i32 = top; + let x_292 : i32 = (x_291 + 1); + top = x_292; + let x_293 : i32 = h_1; + stack[x_292] = x_293; + loop { + let x_299 : i32 = top; + if ((x_299 >= 0)) { + } else { + break; + } + let x_302 : i32 = top; + top = (x_302 - 1); + let x_305 : i32 = stack[x_302]; + h_1 = x_305; + let x_306 : i32 = top; + top = (x_306 - 1); + let x_309 : i32 = stack[x_306]; + l_1 = x_309; + let x_310 : i32 = l_1; + param_4 = x_310; + let x_311 : i32 = h_1; + param_5 = x_311; + let x_312 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_312; + let x_313 : i32 = p; + let x_315 : i32 = l_1; + if (((x_313 - 1) > x_315)) { + let x_319 : i32 = top; + let x_320 : i32 = (x_319 + 1); + top = x_320; + let x_321 : i32 = l_1; + stack[x_320] = x_321; + let x_323 : i32 = top; + let x_324 : i32 = (x_323 + 1); + top = x_324; + let x_325 : i32 = p; + stack[x_324] = (x_325 - 1); + } + let x_328 : i32 = p; + let x_330 : i32 = h_1; + if (((x_328 + 1) < x_330)) { + let x_334 : i32 = top; + let x_335 : i32 = (x_334 + 1); + top = x_335; + let x_336 : i32 = p; + stack[x_335] = (x_336 + 1); + let x_339 : i32 = top; + let x_340 : i32 = (x_339 + 1); + top = x_340; + let x_341 : i32 = h_1; + stack[x_340] = x_341; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_90 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_90 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_97 : i32 = i_2; + if ((x_97 < 10)) { + } else { + break; + } + let x_100 : i32 = i_2; + let x_101 : i32 = i_2; + obj.numbers[x_100] = (10 - x_101); + let x_104 : i32 = i_2; + let x_105 : i32 = i_2; + let x_107 : i32 = obj.numbers[x_105]; + let x_108 : i32 = i_2; + let x_110 : i32 = obj.numbers[x_108]; + obj.numbers[x_104] = (x_107 * x_110); + + continuing { + let x_113 : i32 = i_2; + i_2 = (x_113 + 1); + } + } + quicksort_(); + let x_116 : vec4 = x_GLF_FragCoord; + let x_119 : vec2 = x_34.resolution; + uv = (vec2(x_116.x, x_116.y) / x_119); + color = vec3(1.0, 2.0, 3.0); + let x_122 : i32 = obj.numbers[0]; + let x_125 : f32 = color.x; + color.x = (x_125 + f32(x_122)); + let x_129 : f32 = uv.x; + if ((x_129 > 0.25)) { + let x_134 : i32 = obj.numbers[1]; + let x_137 : f32 = color.x; + color.x = (x_137 + f32(x_134)); + } + let x_141 : f32 = uv.x; + if ((x_141 > 0.5)) { + let x_146 : i32 = obj.numbers[2]; + let x_149 : f32 = color.y; + color.y = (x_149 + f32(x_146)); + } + let x_153 : f32 = uv.x; + if ((x_153 > 0.75)) { + let x_158 : i32 = obj.numbers[3]; + let x_161 : f32 = color.z; + color.z = (x_161 + f32(x_158)); + } + let x_165 : i32 = obj.numbers[4]; + let x_168 : f32 = color.y; + color.y = (x_168 + f32(x_165)); + let x_172 : f32 = uv.y; + if ((x_172 > 0.25)) { + let x_177 : i32 = obj.numbers[5]; + let x_180 : f32 = color.x; + color.x = (x_180 + f32(x_177)); + } + let x_184 : f32 = uv.y; + if ((x_184 > 0.5)) { + let x_189 : i32 = obj.numbers[6]; + let x_192 : f32 = color.y; + color.y = (x_192 + f32(x_189)); + } + let x_196 : f32 = uv.y; + if ((x_196 > 0.75)) { + let x_201 : i32 = obj.numbers[7]; + let x_204 : f32 = color.z; + color.z = (x_204 + f32(x_201)); + } + let x_208 : i32 = obj.numbers[8]; + let x_211 : f32 = color.z; + color.z = (x_211 + f32(x_208)); + let x_215 : f32 = uv.x; + let x_217 : f32 = uv.y; + if ((abs((x_215 - x_217)) < 0.25)) { + let x_224 : i32 = obj.numbers[9]; + let x_227 : f32 = color.x; + color.x = (x_227 + f32(x_224)); + } + let x_230 : vec3 = color; + let x_231 : vec3 = normalize(x_230); + frag_color = vec4(x_231.x, x_231.y, x_231.z, 1.0); + let x_236 : vec4 = x_GLF_pos; + gl_Position = x_236; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl new file mode 100644 index 0000000000..134b77f6f9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl @@ -0,0 +1,264 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_239 : i32 = *(i); + let x_241 : i32 = obj.numbers[x_239]; + temp = x_241; + let x_242 : i32 = *(i); + let x_243 : i32 = *(j); + let x_245 : i32 = obj.numbers[x_243]; + obj.numbers[x_242] = x_245; + let x_247 : i32 = *(j); + let x_248 : i32 = temp; + obj.numbers[x_247] = x_248; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_251 : i32 = *(h); + let x_253 : i32 = obj.numbers[x_251]; + pivot = x_253; + let x_254 : i32 = *(l); + i_1 = (x_254 - 1); + let x_256 : i32 = *(l); + j_1 = x_256; + loop { + let x_261 : i32 = j_1; + let x_262 : i32 = *(h); + if ((x_261 <= (x_262 - 1))) { + } else { + break; + } + let x_266 : i32 = j_1; + let x_268 : i32 = obj.numbers[x_266]; + let x_269 : i32 = pivot; + if ((x_268 <= x_269)) { + let x_273 : i32 = i_1; + i_1 = (x_273 + 1); + let x_275 : i32 = i_1; + param = x_275; + let x_276 : i32 = j_1; + param_1 = x_276; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_278 : i32 = j_1; + j_1 = (x_278 + 1); + } + } + let x_280 : i32 = i_1; + param_2 = (x_280 + 1); + let x_282 : i32 = *(h); + param_3 = x_282; + swap_i1_i1_(&(param_2), &(param_3)); + let x_284 : i32 = i_1; + return (x_284 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_287 : i32 = top; + let x_288 : i32 = (x_287 + 1); + top = x_288; + let x_289 : i32 = l_1; + stack[x_288] = x_289; + let x_291 : i32 = top; + let x_292 : i32 = (x_291 + 1); + top = x_292; + let x_293 : i32 = h_1; + stack[x_292] = x_293; + loop { + let x_299 : i32 = top; + if ((x_299 >= 0)) { + } else { + break; + } + let x_302 : i32 = top; + top = (x_302 - 1); + let x_305 : i32 = stack[x_302]; + h_1 = x_305; + let x_306 : i32 = top; + top = (x_306 - 1); + let x_309 : i32 = stack[x_306]; + l_1 = x_309; + let x_310 : i32 = l_1; + param_4 = x_310; + let x_311 : i32 = h_1; + param_5 = x_311; + let x_312 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_312; + let x_313 : i32 = p; + let x_315 : i32 = l_1; + if (((x_313 - 1) > x_315)) { + let x_319 : i32 = top; + let x_320 : i32 = (x_319 + 1); + top = x_320; + let x_321 : i32 = l_1; + stack[x_320] = x_321; + let x_323 : i32 = top; + let x_324 : i32 = (x_323 + 1); + top = x_324; + let x_325 : i32 = p; + stack[x_324] = (x_325 - 1); + } + let x_328 : i32 = p; + let x_330 : i32 = h_1; + if (((x_328 + 1) < x_330)) { + let x_334 : i32 = top; + let x_335 : i32 = (x_334 + 1); + top = x_335; + let x_336 : i32 = p; + stack[x_335] = (x_336 + 1); + let x_339 : i32 = top; + let x_340 : i32 = (x_339 + 1); + top = x_340; + let x_341 : i32 = h_1; + stack[x_340] = x_341; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_90 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_90 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_97 : i32 = i_2; + if ((x_97 < 10)) { + } else { + break; + } + let x_100 : i32 = i_2; + let x_101 : i32 = i_2; + obj.numbers[x_100] = (10 - x_101); + let x_104 : i32 = i_2; + let x_105 : i32 = i_2; + let x_107 : i32 = obj.numbers[x_105]; + let x_108 : i32 = i_2; + let x_110 : i32 = obj.numbers[x_108]; + obj.numbers[x_104] = (x_107 * x_110); + + continuing { + let x_113 : i32 = i_2; + i_2 = (x_113 + 1); + } + } + quicksort_(); + let x_116 : vec4 = x_GLF_FragCoord; + let x_119 : vec2 = x_34.resolution; + uv = (vec2(x_116.x, x_116.y) / x_119); + color = vec3(1.0, 2.0, 3.0); + let x_122 : i32 = obj.numbers[0]; + let x_125 : f32 = color.x; + color.x = (x_125 + f32(x_122)); + let x_129 : f32 = uv.x; + if ((x_129 > 0.25)) { + let x_134 : i32 = obj.numbers[1]; + let x_137 : f32 = color.x; + color.x = (x_137 + f32(x_134)); + } + let x_141 : f32 = uv.x; + if ((x_141 > 0.5)) { + let x_146 : i32 = obj.numbers[2]; + let x_149 : f32 = color.y; + color.y = (x_149 + f32(x_146)); + } + let x_153 : f32 = uv.x; + if ((x_153 > 0.75)) { + let x_158 : i32 = obj.numbers[3]; + let x_161 : f32 = color.z; + color.z = (x_161 + f32(x_158)); + } + let x_165 : i32 = obj.numbers[4]; + let x_168 : f32 = color.y; + color.y = (x_168 + f32(x_165)); + let x_172 : f32 = uv.y; + if ((x_172 > 0.25)) { + let x_177 : i32 = obj.numbers[5]; + let x_180 : f32 = color.x; + color.x = (x_180 + f32(x_177)); + } + let x_184 : f32 = uv.y; + if ((x_184 > 0.5)) { + let x_189 : i32 = obj.numbers[6]; + let x_192 : f32 = color.y; + color.y = (x_192 + f32(x_189)); + } + let x_196 : f32 = uv.y; + if ((x_196 > 0.75)) { + let x_201 : i32 = obj.numbers[7]; + let x_204 : f32 = color.z; + color.z = (x_204 + f32(x_201)); + } + let x_208 : i32 = obj.numbers[8]; + let x_211 : f32 = color.z; + color.z = (x_211 + f32(x_208)); + let x_215 : f32 = uv.x; + let x_217 : f32 = uv.y; + if ((abs((x_215 - x_217)) < 0.25)) { + let x_224 : i32 = obj.numbers[9]; + let x_227 : f32 = color.x; + color.x = (x_227 + f32(x_224)); + } + let x_230 : vec3 = color; + let x_231 : vec3 = normalize(x_230); + frag_color = vec4(x_231.x, x_231.y, x_231.z, 1.0); + let x_236 : vec4 = x_GLF_pos; + gl_Position = x_236; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..a3206291c1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.hlsl @@ -0,0 +1,219 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_34 : register(b0, space0) { + uint4 x_34[1]; +}; +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_239 = i; + const int x_241 = obj.numbers[x_239]; + temp = x_241; + const int x_242 = i; + const int x_243 = j; + const int x_245 = obj.numbers[x_243]; + obj.numbers[x_242] = x_245; + const int x_247 = j; + obj.numbers[x_247] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_251 = h; + const int x_253 = obj.numbers[x_251]; + pivot = x_253; + const int x_254 = l; + i_1 = (x_254 - 1); + const int x_256 = l; + j_1 = x_256; + while (true) { + const int x_261 = j_1; + const int x_262 = h; + if ((x_261 <= (x_262 - 1))) { + } else { + break; + } + const int x_268 = obj.numbers[j_1]; + if ((x_268 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + param_2 = (i_1 + 1); + const int x_282 = h; + param_3 = x_282; + swap_i1_i1_(param_2, param_3); + return (i_1 + 1); +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_288 = (top + 1); + top = x_288; + stack[x_288] = l_1; + const int x_292 = (top + 1); + top = x_292; + stack[x_292] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_302 = top; + top = (x_302 - 1); + const int x_305 = stack[x_302]; + h_1 = x_305; + const int x_306 = top; + top = (x_306 - 1); + const int x_309 = stack[x_306]; + l_1 = x_309; + param_4 = l_1; + param_5 = h_1; + const int x_312 = performPartition_i1_i1_(param_4, param_5); + p = x_312; + if (((p - 1) > l_1)) { + const int x_320 = (top + 1); + top = x_320; + stack[x_320] = l_1; + const int x_324 = (top + 1); + top = x_324; + stack[x_324] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_335 = (top + 1); + top = x_335; + stack[x_335] = (p + 1); + const int x_340 = (top + 1); + top = x_340; + stack[x_340] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_104 = i_2; + const int x_107 = obj.numbers[i_2]; + const int x_110 = obj.numbers[i_2]; + obj.numbers[x_104] = (x_107 * x_110); + } + } + quicksort_(); + const float4 x_116 = x_GLF_FragCoord; + const float2 x_119 = asfloat(x_34[0].xy); + uv = (float2(x_116.x, x_116.y) / x_119); + color = float3(1.0f, 2.0f, 3.0f); + const int x_122 = obj.numbers[0]; + const float x_125 = color.x; + color.x = (x_125 + float(x_122)); + const float x_129 = uv.x; + if ((x_129 > 0.25f)) { + const int x_134 = obj.numbers[1]; + const float x_137 = color.x; + color.x = (x_137 + float(x_134)); + } + const float x_141 = uv.x; + if ((x_141 > 0.5f)) { + const int x_146 = obj.numbers[2]; + const float x_149 = color.y; + color.y = (x_149 + float(x_146)); + } + const float x_153 = uv.x; + if ((x_153 > 0.75f)) { + const int x_158 = obj.numbers[3]; + const float x_161 = color.z; + color.z = (x_161 + float(x_158)); + } + const int x_165 = obj.numbers[4]; + const float x_168 = color.y; + color.y = (x_168 + float(x_165)); + const float x_172 = uv.y; + if ((x_172 > 0.25f)) { + const int x_177 = obj.numbers[5]; + const float x_180 = color.x; + color.x = (x_180 + float(x_177)); + } + const float x_184 = uv.y; + if ((x_184 > 0.5f)) { + const int x_189 = obj.numbers[6]; + const float x_192 = color.y; + color.y = (x_192 + float(x_189)); + } + const float x_196 = uv.y; + if ((x_196 > 0.75f)) { + const int x_201 = obj.numbers[7]; + const float x_204 = color.z; + color.z = (x_204 + float(x_201)); + } + const int x_208 = obj.numbers[8]; + const float x_211 = color.z; + color.z = (x_211 + float(x_208)); + const float x_215 = uv.x; + const float x_217 = uv.y; + if ((abs((x_215 - x_217)) < 0.25f)) { + const int x_224 = obj.numbers[9]; + const float x_227 = color.x; + color.x = (x_227 + float(x_224)); + } + const float3 x_231 = normalize(color); + frag_color = float4(x_231.x, x_231.y, x_231.z, 1.0f); + gl_Position = x_GLF_pos; + return; +} + +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 x_GLF_pos_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_GLF_pos_param = tint_symbol.x_GLF_pos_param; + x_GLF_pos = x_GLF_pos_param; + main_1(); + const main_out tint_symbol_3 = {frag_color, gl_Position}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f82023bf05 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.msl @@ -0,0 +1,266 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_pos_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_6) { + int temp = 0; + int const x_239 = *(i); + int const x_241 = (*(tint_symbol_6)).numbers.arr[x_239]; + temp = x_241; + int const x_242 = *(i); + int const x_243 = *(j); + int const x_245 = (*(tint_symbol_6)).numbers.arr[x_243]; + (*(tint_symbol_6)).numbers.arr[x_242] = x_245; + int const x_247 = *(j); + int const x_248 = temp; + (*(tint_symbol_6)).numbers.arr[x_247] = x_248; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_7) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_251 = *(h); + int const x_253 = (*(tint_symbol_7)).numbers.arr[x_251]; + pivot = x_253; + int const x_254 = *(l); + i_1 = (x_254 - 1); + int const x_256 = *(l); + j_1 = x_256; + while (true) { + int const x_261 = j_1; + int const x_262 = *(h); + if ((x_261 <= (x_262 - 1))) { + } else { + break; + } + int const x_266 = j_1; + int const x_268 = (*(tint_symbol_7)).numbers.arr[x_266]; + int const x_269 = pivot; + if ((x_268 <= x_269)) { + int const x_273 = i_1; + i_1 = (x_273 + 1); + int const x_275 = i_1; + param = x_275; + int const x_276 = j_1; + param_1 = x_276; + swap_i1_i1_(&(param), &(param_1), tint_symbol_7); + } + { + int const x_278 = j_1; + j_1 = (x_278 + 1); + } + } + int const x_280 = i_1; + param_2 = (x_280 + 1); + int const x_282 = *(h); + param_3 = x_282; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_7); + int const x_284 = i_1; + return (x_284 + 1); +} + +void quicksort_(thread QuicksortObject* const tint_symbol_8) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_287 = top; + int const x_288 = (x_287 + 1); + top = x_288; + int const x_289 = l_1; + stack.arr[x_288] = x_289; + int const x_291 = top; + int const x_292 = (x_291 + 1); + top = x_292; + int const x_293 = h_1; + stack.arr[x_292] = x_293; + while (true) { + int const x_299 = top; + if ((x_299 >= 0)) { + } else { + break; + } + int const x_302 = top; + top = (x_302 - 1); + int const x_305 = stack.arr[x_302]; + h_1 = x_305; + int const x_306 = top; + top = (x_306 - 1); + int const x_309 = stack.arr[x_306]; + l_1 = x_309; + int const x_310 = l_1; + param_4 = x_310; + int const x_311 = h_1; + param_5 = x_311; + int const x_312 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_8); + p = x_312; + int const x_313 = p; + int const x_315 = l_1; + if (((x_313 - 1) > x_315)) { + int const x_319 = top; + int const x_320 = (x_319 + 1); + top = x_320; + int const x_321 = l_1; + stack.arr[x_320] = x_321; + int const x_323 = top; + int const x_324 = (x_323 + 1); + top = x_324; + int const x_325 = p; + stack.arr[x_324] = (x_325 - 1); + } + int const x_328 = p; + int const x_330 = h_1; + if (((x_328 + 1) < x_330)) { + int const x_334 = top; + int const x_335 = (x_334 + 1); + top = x_335; + int const x_336 = p; + stack.arr[x_335] = (x_336 + 1); + int const x_339 = top; + int const x_340 = (x_339 + 1); + top = x_340; + int const x_341 = h_1; + stack.arr[x_340] = x_341; + } + } + return; +} + +void main_1(constant buf0& x_34, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10, thread QuicksortObject* const tint_symbol_11, thread float4* const tint_symbol_12, thread float4* const tint_symbol_13) { + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + float4 const x_90 = *(tint_symbol_9); + *(tint_symbol_10) = ((x_90 + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + while (true) { + int const x_97 = i_2; + if ((x_97 < 10)) { + } else { + break; + } + int const x_100 = i_2; + int const x_101 = i_2; + (*(tint_symbol_11)).numbers.arr[x_100] = (10 - x_101); + int const x_104 = i_2; + int const x_105 = i_2; + int const x_107 = (*(tint_symbol_11)).numbers.arr[x_105]; + int const x_108 = i_2; + int const x_110 = (*(tint_symbol_11)).numbers.arr[x_108]; + (*(tint_symbol_11)).numbers.arr[x_104] = (x_107 * x_110); + { + int const x_113 = i_2; + i_2 = (x_113 + 1); + } + } + quicksort_(tint_symbol_11); + float4 const x_116 = *(tint_symbol_10); + float2 const x_119 = x_34.resolution; + uv = (float2(x_116.x, x_116.y) / x_119); + color = float3(1.0f, 2.0f, 3.0f); + int const x_122 = (*(tint_symbol_11)).numbers.arr[0]; + float const x_125 = color.x; + color.x = (x_125 + float(x_122)); + float const x_129 = uv.x; + if ((x_129 > 0.25f)) { + int const x_134 = (*(tint_symbol_11)).numbers.arr[1]; + float const x_137 = color.x; + color.x = (x_137 + float(x_134)); + } + float const x_141 = uv.x; + if ((x_141 > 0.5f)) { + int const x_146 = (*(tint_symbol_11)).numbers.arr[2]; + float const x_149 = color.y; + color.y = (x_149 + float(x_146)); + } + float const x_153 = uv.x; + if ((x_153 > 0.75f)) { + int const x_158 = (*(tint_symbol_11)).numbers.arr[3]; + float const x_161 = color.z; + color.z = (x_161 + float(x_158)); + } + int const x_165 = (*(tint_symbol_11)).numbers.arr[4]; + float const x_168 = color.y; + color.y = (x_168 + float(x_165)); + float const x_172 = uv.y; + if ((x_172 > 0.25f)) { + int const x_177 = (*(tint_symbol_11)).numbers.arr[5]; + float const x_180 = color.x; + color.x = (x_180 + float(x_177)); + } + float const x_184 = uv.y; + if ((x_184 > 0.5f)) { + int const x_189 = (*(tint_symbol_11)).numbers.arr[6]; + float const x_192 = color.y; + color.y = (x_192 + float(x_189)); + } + float const x_196 = uv.y; + if ((x_196 > 0.75f)) { + int const x_201 = (*(tint_symbol_11)).numbers.arr[7]; + float const x_204 = color.z; + color.z = (x_204 + float(x_201)); + } + int const x_208 = (*(tint_symbol_11)).numbers.arr[8]; + float const x_211 = color.z; + color.z = (x_211 + float(x_208)); + float const x_215 = uv.x; + float const x_217 = uv.y; + if ((fabs((x_215 - x_217)) < 0.25f)) { + int const x_224 = (*(tint_symbol_11)).numbers.arr[9]; + float const x_227 = color.x; + color.x = (x_227 + float(x_224)); + } + float3 const x_230 = color; + float3 const x_231 = normalize(x_230); + *(tint_symbol_12) = float4(x_231.x, x_231.y, x_231.z, 1.0f); + float4 const x_236 = *(tint_symbol_9); + *(tint_symbol_13) = x_236; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant buf0& x_34 [[buffer(0)]]) { + thread float4 tint_symbol_14 = 0.0f; + thread float4 tint_symbol_15 = 0.0f; + thread QuicksortObject tint_symbol_16 = {}; + thread float4 tint_symbol_17 = 0.0f; + thread float4 tint_symbol_18 = 0.0f; + float4 const x_GLF_pos_param = tint_symbol_1.x_GLF_pos_param; + tint_symbol_14 = x_GLF_pos_param; + main_1(x_34, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_16), &(tint_symbol_17), &(tint_symbol_18)); + main_out const tint_symbol_4 = {.frag_color_1=tint_symbol_17, .gl_Position=tint_symbol_18}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..db05970459 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.spvasm @@ -0,0 +1,567 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 390 +; Schema: 0 + OpCapability Shader + %356 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %x_GLF_FragCoord "x_GLF_FragCoord" + OpName %x_GLF_pos "x_GLF_pos" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_34 "x_34" + OpName %frag_color "frag_color" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "frag_color_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_34 NonWritable + OpDecorate %x_34 DescriptorSet 0 + OpDecorate %x_34 Binding 0 + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_3 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %12 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private %16 + %x_GLF_pos = OpVariable %_ptr_Private_v4float Private %16 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_34 = OpVariable %_ptr_Uniform_buf0 Uniform + %frag_color = OpVariable %_ptr_Private_v4float Private %16 +%gl_Position = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %16 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %37 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %55 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %115 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %123 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %195 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %199 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %203 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %206 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_10 = OpConstant %int 10 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %244 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float %v4float + %375 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %29 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %35 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %37 + %39 = OpLoad %int %i + %42 = OpAccessChain %_ptr_Private_int %obj %uint_0 %39 + %43 = OpLoad %int %42 + OpStore %temp %43 + %45 = OpLoad %int %i + %47 = OpLoad %int %j + %48 = OpAccessChain %_ptr_Private_int %obj %uint_0 %47 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_Private_int %obj %uint_0 %45 + OpStore %50 %49 + %52 = OpLoad %int %j + %53 = OpLoad %int %temp + %54 = OpAccessChain %_ptr_Private_int %obj %uint_0 %52 + OpStore %54 %53 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %55 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %59 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %37 + %i_1 = OpVariable %_ptr_Function_int Function %37 + %j_1 = OpVariable %_ptr_Function_int Function %37 + %param = OpVariable %_ptr_Function_int Function %37 + %param_1 = OpVariable %_ptr_Function_int Function %37 + %param_2 = OpVariable %_ptr_Function_int Function %37 + %param_3 = OpVariable %_ptr_Function_int Function %37 + %68 = OpLoad %int %h + %69 = OpAccessChain %_ptr_Private_int %obj %uint_0 %68 + %70 = OpLoad %int %69 + OpStore %pivot %70 + %72 = OpLoad %int %l + %74 = OpISub %int %72 %int_1 + OpStore %i_1 %74 + %76 = OpLoad %int %l + OpStore %j_1 %76 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %78 %79 None + OpBranch %80 + %80 = OpLabel + %81 = OpLoad %int %j_1 + %83 = OpLoad %int %h + %84 = OpISub %int %83 %int_1 + %85 = OpSLessThanEqual %bool %81 %84 + OpSelectionMerge %87 None + OpBranchConditional %85 %88 %89 + %88 = OpLabel + OpBranch %87 + %89 = OpLabel + OpBranch %78 + %87 = OpLabel + %90 = OpLoad %int %j_1 + %91 = OpAccessChain %_ptr_Private_int %obj %uint_0 %90 + %92 = OpLoad %int %91 + %93 = OpLoad %int %pivot + %94 = OpSLessThanEqual %bool %92 %93 + OpSelectionMerge %95 None + OpBranchConditional %94 %96 %95 + %96 = OpLabel + %97 = OpLoad %int %i_1 + %98 = OpIAdd %int %97 %int_1 + OpStore %i_1 %98 + %99 = OpLoad %int %i_1 + OpStore %param %99 + %100 = OpLoad %int %j_1 + OpStore %param_1 %100 + %101 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %95 + %95 = OpLabel + OpBranch %79 + %79 = OpLabel + %104 = OpLoad %int %j_1 + %105 = OpIAdd %int %104 %int_1 + OpStore %j_1 %105 + OpBranch %77 + %78 = OpLabel + %106 = OpLoad %int %i_1 + %107 = OpIAdd %int %106 %int_1 + OpStore %param_2 %107 + %109 = OpLoad %int %h + OpStore %param_3 %109 + %110 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %113 = OpLoad %int %i_1 + %114 = OpIAdd %int %113 %int_1 + OpReturnValue %114 + OpFunctionEnd + %quicksort_ = OpFunction %void None %115 + %117 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %37 + %h_1 = OpVariable %_ptr_Function_int Function %37 + %top = OpVariable %_ptr_Function_int Function %37 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %123 + %p = OpVariable %_ptr_Function_int Function %37 + %param_4 = OpVariable %_ptr_Function_int Function %37 + %param_5 = OpVariable %_ptr_Function_int Function %37 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %130 = OpLoad %int %top + %131 = OpIAdd %int %130 %int_1 + OpStore %top %131 + %132 = OpLoad %int %l_1 + %133 = OpAccessChain %_ptr_Function_int %stack %131 + OpStore %133 %132 + %134 = OpLoad %int %top + %135 = OpIAdd %int %134 %int_1 + OpStore %top %135 + %136 = OpLoad %int %h_1 + %137 = OpAccessChain %_ptr_Function_int %stack %135 + OpStore %137 %136 + OpBranch %138 + %138 = OpLabel + OpLoopMerge %139 %140 None + OpBranch %141 + %141 = OpLabel + %142 = OpLoad %int %top + %143 = OpSGreaterThanEqual %bool %142 %int_0 + OpSelectionMerge %144 None + OpBranchConditional %143 %145 %146 + %145 = OpLabel + OpBranch %144 + %146 = OpLabel + OpBranch %139 + %144 = OpLabel + %147 = OpLoad %int %top + %148 = OpISub %int %147 %int_1 + OpStore %top %148 + %149 = OpAccessChain %_ptr_Function_int %stack %147 + %150 = OpLoad %int %149 + OpStore %h_1 %150 + %151 = OpLoad %int %top + %152 = OpISub %int %151 %int_1 + OpStore %top %152 + %153 = OpAccessChain %_ptr_Function_int %stack %151 + %154 = OpLoad %int %153 + OpStore %l_1 %154 + %155 = OpLoad %int %l_1 + OpStore %param_4 %155 + %156 = OpLoad %int %h_1 + OpStore %param_5 %156 + %157 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %157 + %160 = OpLoad %int %p + %161 = OpLoad %int %l_1 + %162 = OpISub %int %160 %int_1 + %163 = OpSGreaterThan %bool %162 %161 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %164 + %165 = OpLabel + %166 = OpLoad %int %top + %167 = OpIAdd %int %166 %int_1 + OpStore %top %167 + %168 = OpLoad %int %l_1 + %169 = OpAccessChain %_ptr_Function_int %stack %167 + OpStore %169 %168 + %170 = OpLoad %int %top + %171 = OpIAdd %int %170 %int_1 + OpStore %top %171 + %172 = OpLoad %int %p + %173 = OpAccessChain %_ptr_Function_int %stack %171 + %174 = OpISub %int %172 %int_1 + OpStore %173 %174 + OpBranch %164 + %164 = OpLabel + %175 = OpLoad %int %p + %176 = OpLoad %int %h_1 + %177 = OpIAdd %int %175 %int_1 + %178 = OpSLessThan %bool %177 %176 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %179 + %180 = OpLabel + %181 = OpLoad %int %top + %182 = OpIAdd %int %181 %int_1 + OpStore %top %182 + %183 = OpLoad %int %p + %184 = OpAccessChain %_ptr_Function_int %stack %182 + %185 = OpIAdd %int %183 %int_1 + OpStore %184 %185 + %186 = OpLoad %int %top + %187 = OpIAdd %int %186 %int_1 + OpStore %top %187 + %188 = OpLoad %int %h_1 + %189 = OpAccessChain %_ptr_Function_int %stack %187 + OpStore %189 %188 + OpBranch %179 + %179 = OpLabel + OpBranch %140 + %140 = OpLabel + OpBranch %138 + %139 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %115 + %191 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %37 + %uv = OpVariable %_ptr_Function_v2float Function %195 + %color = OpVariable %_ptr_Function_v3float Function %199 + %200 = OpLoad %v4float %x_GLF_pos + %204 = OpFAdd %v4float %200 %203 + %207 = OpFMul %v4float %204 %206 + OpStore %x_GLF_FragCoord %207 + OpStore %i_2 %int_0 + OpBranch %208 + %208 = OpLabel + OpLoopMerge %209 %210 None + OpBranch %211 + %211 = OpLabel + %212 = OpLoad %int %i_2 + %214 = OpSLessThan %bool %212 %int_10 + OpSelectionMerge %215 None + OpBranchConditional %214 %216 %217 + %216 = OpLabel + OpBranch %215 + %217 = OpLabel + OpBranch %209 + %215 = OpLabel + %218 = OpLoad %int %i_2 + %219 = OpLoad %int %i_2 + %220 = OpAccessChain %_ptr_Private_int %obj %uint_0 %218 + %221 = OpISub %int %int_10 %219 + OpStore %220 %221 + %222 = OpLoad %int %i_2 + %223 = OpLoad %int %i_2 + %224 = OpAccessChain %_ptr_Private_int %obj %uint_0 %223 + %225 = OpLoad %int %224 + %226 = OpLoad %int %i_2 + %227 = OpAccessChain %_ptr_Private_int %obj %uint_0 %226 + %228 = OpLoad %int %227 + %229 = OpAccessChain %_ptr_Private_int %obj %uint_0 %222 + %230 = OpIMul %int %225 %228 + OpStore %229 %230 + OpBranch %210 + %210 = OpLabel + %231 = OpLoad %int %i_2 + %232 = OpIAdd %int %231 %int_1 + OpStore %i_2 %232 + OpBranch %208 + %209 = OpLabel + %233 = OpFunctionCall %void %quicksort_ + %234 = OpLoad %v4float %x_GLF_FragCoord + %236 = OpAccessChain %_ptr_Uniform_v2float %x_34 %uint_0 + %237 = OpLoad %v2float %236 + %238 = OpCompositeExtract %float %234 0 + %239 = OpCompositeExtract %float %234 1 + %240 = OpCompositeConstruct %v2float %238 %239 + %241 = OpFDiv %v2float %240 %237 + OpStore %uv %241 + OpStore %color %244 + %245 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %246 = OpLoad %int %245 + %248 = OpAccessChain %_ptr_Function_float %color %uint_0 + %249 = OpLoad %float %248 + %250 = OpAccessChain %_ptr_Function_float %color %uint_0 + %251 = OpConvertSToF %float %246 + %252 = OpFAdd %float %249 %251 + OpStore %250 %252 + %253 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %254 = OpLoad %float %253 + %256 = OpFOrdGreaterThan %bool %254 %float_0_25 + OpSelectionMerge %257 None + OpBranchConditional %256 %258 %257 + %258 = OpLabel + %259 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %260 = OpLoad %int %259 + %261 = OpAccessChain %_ptr_Function_float %color %uint_0 + %262 = OpLoad %float %261 + %263 = OpAccessChain %_ptr_Function_float %color %uint_0 + %264 = OpConvertSToF %float %260 + %265 = OpFAdd %float %262 %264 + OpStore %263 %265 + OpBranch %257 + %257 = OpLabel + %266 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %267 = OpLoad %float %266 + %269 = OpFOrdGreaterThan %bool %267 %float_0_5 + OpSelectionMerge %270 None + OpBranchConditional %269 %271 %270 + %271 = OpLabel + %273 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %274 = OpLoad %int %273 + %276 = OpAccessChain %_ptr_Function_float %color %uint_1 + %277 = OpLoad %float %276 + %278 = OpAccessChain %_ptr_Function_float %color %uint_1 + %279 = OpConvertSToF %float %274 + %280 = OpFAdd %float %277 %279 + OpStore %278 %280 + OpBranch %270 + %270 = OpLabel + %281 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %282 = OpLoad %float %281 + %284 = OpFOrdGreaterThan %bool %282 %float_0_75 + OpSelectionMerge %285 None + OpBranchConditional %284 %286 %285 + %286 = OpLabel + %288 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %289 = OpLoad %int %288 + %291 = OpAccessChain %_ptr_Function_float %color %uint_2 + %292 = OpLoad %float %291 + %293 = OpAccessChain %_ptr_Function_float %color %uint_2 + %294 = OpConvertSToF %float %289 + %295 = OpFAdd %float %292 %294 + OpStore %293 %295 + OpBranch %285 + %285 = OpLabel + %297 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %298 = OpLoad %int %297 + %299 = OpAccessChain %_ptr_Function_float %color %uint_1 + %300 = OpLoad %float %299 + %301 = OpAccessChain %_ptr_Function_float %color %uint_1 + %302 = OpConvertSToF %float %298 + %303 = OpFAdd %float %300 %302 + OpStore %301 %303 + %304 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %305 = OpLoad %float %304 + %306 = OpFOrdGreaterThan %bool %305 %float_0_25 + OpSelectionMerge %307 None + OpBranchConditional %306 %308 %307 + %308 = OpLabel + %310 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %311 = OpLoad %int %310 + %312 = OpAccessChain %_ptr_Function_float %color %uint_0 + %313 = OpLoad %float %312 + %314 = OpAccessChain %_ptr_Function_float %color %uint_0 + %315 = OpConvertSToF %float %311 + %316 = OpFAdd %float %313 %315 + OpStore %314 %316 + OpBranch %307 + %307 = OpLabel + %317 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %318 = OpLoad %float %317 + %319 = OpFOrdGreaterThan %bool %318 %float_0_5 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %320 + %321 = OpLabel + %323 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %324 = OpLoad %int %323 + %325 = OpAccessChain %_ptr_Function_float %color %uint_1 + %326 = OpLoad %float %325 + %327 = OpAccessChain %_ptr_Function_float %color %uint_1 + %328 = OpConvertSToF %float %324 + %329 = OpFAdd %float %326 %328 + OpStore %327 %329 + OpBranch %320 + %320 = OpLabel + %330 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %331 = OpLoad %float %330 + %332 = OpFOrdGreaterThan %bool %331 %float_0_75 + OpSelectionMerge %333 None + OpBranchConditional %332 %334 %333 + %334 = OpLabel + %336 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %337 = OpLoad %int %336 + %338 = OpAccessChain %_ptr_Function_float %color %uint_2 + %339 = OpLoad %float %338 + %340 = OpAccessChain %_ptr_Function_float %color %uint_2 + %341 = OpConvertSToF %float %337 + %342 = OpFAdd %float %339 %341 + OpStore %340 %342 + OpBranch %333 + %333 = OpLabel + %344 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %345 = OpLoad %int %344 + %346 = OpAccessChain %_ptr_Function_float %color %uint_2 + %347 = OpLoad %float %346 + %348 = OpAccessChain %_ptr_Function_float %color %uint_2 + %349 = OpConvertSToF %float %345 + %350 = OpFAdd %float %347 %349 + OpStore %348 %350 + %351 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %352 = OpLoad %float %351 + %353 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %354 = OpLoad %float %353 + %357 = OpFSub %float %352 %354 + %355 = OpExtInst %float %356 FAbs %357 + %358 = OpFOrdLessThan %bool %355 %float_0_25 + OpSelectionMerge %359 None + OpBranchConditional %358 %360 %359 + %360 = OpLabel + %361 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %362 = OpLoad %int %361 + %363 = OpAccessChain %_ptr_Function_float %color %uint_0 + %364 = OpLoad %float %363 + %365 = OpAccessChain %_ptr_Function_float %color %uint_0 + %366 = OpConvertSToF %float %362 + %367 = OpFAdd %float %364 %366 + OpStore %365 %367 + OpBranch %359 + %359 = OpLabel + %368 = OpLoad %v3float %color + %369 = OpExtInst %v3float %356 Normalize %368 + %370 = OpCompositeExtract %float %369 0 + %371 = OpCompositeExtract %float %369 1 + %372 = OpCompositeExtract %float %369 2 + %373 = OpCompositeConstruct %v4float %370 %371 %372 %float_1 + OpStore %frag_color %373 + %374 = OpLoad %v4float %x_GLF_pos + OpStore %gl_Position %374 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %375 +%tint_symbol_1 = OpFunctionParameter %main_out + %379 = OpLabel + %380 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %380 + %381 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %381 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %115 + %383 = OpLabel + OpStore %tint_pointsize %float_1 + %384 = OpLoad %v4float %tint_symbol + OpStore %x_GLF_pos %384 + %385 = OpFunctionCall %void %main_1 + %387 = OpLoad %v4float %frag_color + %388 = OpLoad %v4float %gl_Position + %389 = OpCompositeConstruct %main_out %387 %388 + %386 = OpFunctionCall %void %tint_symbol_4 %389 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..134b77f6f9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.wgsl @@ -0,0 +1,264 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_239 : i32 = *(i); + let x_241 : i32 = obj.numbers[x_239]; + temp = x_241; + let x_242 : i32 = *(i); + let x_243 : i32 = *(j); + let x_245 : i32 = obj.numbers[x_243]; + obj.numbers[x_242] = x_245; + let x_247 : i32 = *(j); + let x_248 : i32 = temp; + obj.numbers[x_247] = x_248; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_251 : i32 = *(h); + let x_253 : i32 = obj.numbers[x_251]; + pivot = x_253; + let x_254 : i32 = *(l); + i_1 = (x_254 - 1); + let x_256 : i32 = *(l); + j_1 = x_256; + loop { + let x_261 : i32 = j_1; + let x_262 : i32 = *(h); + if ((x_261 <= (x_262 - 1))) { + } else { + break; + } + let x_266 : i32 = j_1; + let x_268 : i32 = obj.numbers[x_266]; + let x_269 : i32 = pivot; + if ((x_268 <= x_269)) { + let x_273 : i32 = i_1; + i_1 = (x_273 + 1); + let x_275 : i32 = i_1; + param = x_275; + let x_276 : i32 = j_1; + param_1 = x_276; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_278 : i32 = j_1; + j_1 = (x_278 + 1); + } + } + let x_280 : i32 = i_1; + param_2 = (x_280 + 1); + let x_282 : i32 = *(h); + param_3 = x_282; + swap_i1_i1_(&(param_2), &(param_3)); + let x_284 : i32 = i_1; + return (x_284 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_287 : i32 = top; + let x_288 : i32 = (x_287 + 1); + top = x_288; + let x_289 : i32 = l_1; + stack[x_288] = x_289; + let x_291 : i32 = top; + let x_292 : i32 = (x_291 + 1); + top = x_292; + let x_293 : i32 = h_1; + stack[x_292] = x_293; + loop { + let x_299 : i32 = top; + if ((x_299 >= 0)) { + } else { + break; + } + let x_302 : i32 = top; + top = (x_302 - 1); + let x_305 : i32 = stack[x_302]; + h_1 = x_305; + let x_306 : i32 = top; + top = (x_306 - 1); + let x_309 : i32 = stack[x_306]; + l_1 = x_309; + let x_310 : i32 = l_1; + param_4 = x_310; + let x_311 : i32 = h_1; + param_5 = x_311; + let x_312 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_312; + let x_313 : i32 = p; + let x_315 : i32 = l_1; + if (((x_313 - 1) > x_315)) { + let x_319 : i32 = top; + let x_320 : i32 = (x_319 + 1); + top = x_320; + let x_321 : i32 = l_1; + stack[x_320] = x_321; + let x_323 : i32 = top; + let x_324 : i32 = (x_323 + 1); + top = x_324; + let x_325 : i32 = p; + stack[x_324] = (x_325 - 1); + } + let x_328 : i32 = p; + let x_330 : i32 = h_1; + if (((x_328 + 1) < x_330)) { + let x_334 : i32 = top; + let x_335 : i32 = (x_334 + 1); + top = x_335; + let x_336 : i32 = p; + stack[x_335] = (x_336 + 1); + let x_339 : i32 = top; + let x_340 : i32 = (x_339 + 1); + top = x_340; + let x_341 : i32 = h_1; + stack[x_340] = x_341; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_90 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_90 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_97 : i32 = i_2; + if ((x_97 < 10)) { + } else { + break; + } + let x_100 : i32 = i_2; + let x_101 : i32 = i_2; + obj.numbers[x_100] = (10 - x_101); + let x_104 : i32 = i_2; + let x_105 : i32 = i_2; + let x_107 : i32 = obj.numbers[x_105]; + let x_108 : i32 = i_2; + let x_110 : i32 = obj.numbers[x_108]; + obj.numbers[x_104] = (x_107 * x_110); + + continuing { + let x_113 : i32 = i_2; + i_2 = (x_113 + 1); + } + } + quicksort_(); + let x_116 : vec4 = x_GLF_FragCoord; + let x_119 : vec2 = x_34.resolution; + uv = (vec2(x_116.x, x_116.y) / x_119); + color = vec3(1.0, 2.0, 3.0); + let x_122 : i32 = obj.numbers[0]; + let x_125 : f32 = color.x; + color.x = (x_125 + f32(x_122)); + let x_129 : f32 = uv.x; + if ((x_129 > 0.25)) { + let x_134 : i32 = obj.numbers[1]; + let x_137 : f32 = color.x; + color.x = (x_137 + f32(x_134)); + } + let x_141 : f32 = uv.x; + if ((x_141 > 0.5)) { + let x_146 : i32 = obj.numbers[2]; + let x_149 : f32 = color.y; + color.y = (x_149 + f32(x_146)); + } + let x_153 : f32 = uv.x; + if ((x_153 > 0.75)) { + let x_158 : i32 = obj.numbers[3]; + let x_161 : f32 = color.z; + color.z = (x_161 + f32(x_158)); + } + let x_165 : i32 = obj.numbers[4]; + let x_168 : f32 = color.y; + color.y = (x_168 + f32(x_165)); + let x_172 : f32 = uv.y; + if ((x_172 > 0.25)) { + let x_177 : i32 = obj.numbers[5]; + let x_180 : f32 = color.x; + color.x = (x_180 + f32(x_177)); + } + let x_184 : f32 = uv.y; + if ((x_184 > 0.5)) { + let x_189 : i32 = obj.numbers[6]; + let x_192 : f32 = color.y; + color.y = (x_192 + f32(x_189)); + } + let x_196 : f32 = uv.y; + if ((x_196 > 0.75)) { + let x_201 : i32 = obj.numbers[7]; + let x_204 : f32 = color.z; + color.z = (x_204 + f32(x_201)); + } + let x_208 : i32 = obj.numbers[8]; + let x_211 : f32 = color.z; + color.z = (x_211 + f32(x_208)); + let x_215 : f32 = uv.x; + let x_217 : f32 = uv.y; + if ((abs((x_215 - x_217)) < 0.25)) { + let x_224 : i32 = obj.numbers[9]; + let x_227 : f32 = color.x; + color.x = (x_227 + f32(x_224)); + } + let x_230 : vec3 = color; + let x_231 : vec3 = normalize(x_230); + frag_color = vec4(x_231.x, x_231.y, x_231.z, 1.0); + let x_236 : vec4 = x_GLF_pos; + gl_Position = x_236; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm new file mode 100644 index 0000000000..90b4e34fea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm @@ -0,0 +1,25 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %frag_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %frag_color "frag_color" + OpDecorate %_GLF_color Location 0 + OpDecorate %frag_color Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %frag_color = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %6 + %11 = OpLabel + %12 = OpLoad %v4float %frag_color + OpStore %_GLF_color %12 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..266b98a40d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.hlsl @@ -0,0 +1,26 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + x_GLF_color = frag_color; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 frag_color_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 frag_color_param = tint_symbol.frag_color_param; + frag_color = frag_color_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.msl new file mode 100644 index 0000000000..bd94fa88ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 frag_color_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_12 = *(tint_symbol_6); + *(tint_symbol_7) = x_12; + return; +} + +fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const frag_color_param = tint_symbol_1.frag_color_param; + tint_symbol_8 = frag_color_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_4.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..834d21fe11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.spvasm @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %frag_color "frag_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %frag_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %16 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %15 = OpLoad %v4float %frag_color + OpStore %x_GLF_color %15 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %16 +%tint_symbol_1 = OpFunctionParameter %main_out + %20 = OpLabel + %21 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %21 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %23 = OpLabel + %24 = OpLoad %v4float %tint_symbol + OpStore %frag_color %24 + %25 = OpFunctionCall %void %main_1 + %27 = OpLoad %v4float %x_GLF_color + %28 = OpCompositeConstruct %main_out %27 + %26 = OpFunctionCall %void %tint_symbol_3 %28 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..b7d3ed1cb9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var x_GLF_color : vec4; + +var frag_color : vec4; + +fn main_1() { + let x_12 : vec4 = frag_color; + x_GLF_color = x_12; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[location(0)]] frag_color_param : vec4) -> main_out { + frag_color = frag_color_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl new file mode 100644 index 0000000000..b7d3ed1cb9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl @@ -0,0 +1,21 @@ +var x_GLF_color : vec4; + +var frag_color : vec4; + +fn main_1() { + let x_12 : vec4 = frag_color; + x_GLF_color = x_12; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[location(0)]] frag_color_param : vec4) -> main_out { + frag_color = frag_color_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..266b98a40d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + x_GLF_color = frag_color; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 frag_color_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 frag_color_param = tint_symbol.frag_color_param; + frag_color = frag_color_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.msl new file mode 100644 index 0000000000..bd94fa88ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 frag_color_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_12 = *(tint_symbol_6); + *(tint_symbol_7) = x_12; + return; +} + +fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const frag_color_param = tint_symbol_1.frag_color_param; + tint_symbol_8 = frag_color_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_4.x_GLF_color_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..834d21fe11 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.spvasm @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %frag_color "frag_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %frag_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %16 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %15 = OpLoad %v4float %frag_color + OpStore %x_GLF_color %15 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %16 +%tint_symbol_1 = OpFunctionParameter %main_out + %20 = OpLabel + %21 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %21 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %23 = OpLabel + %24 = OpLoad %v4float %tint_symbol + OpStore %frag_color %24 + %25 = OpFunctionCall %void %main_1 + %27 = OpLoad %v4float %x_GLF_color + %28 = OpCompositeConstruct %main_out %27 + %26 = OpFunctionCall %void %tint_symbol_3 %28 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..b7d3ed1cb9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +var x_GLF_color : vec4; + +var frag_color : vec4; + +fn main_1() { + let x_12 : vec4 = frag_color; + x_GLF_color = x_12; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[location(0)]] frag_color_param : vec4) -> main_out { + frag_color = frag_color_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm new file mode 100644 index 0000000000..9b0be333c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm @@ -0,0 +1,524 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_GLF_pos %frag_color %__1 + OpSource ESSL 310 + OpName %main "main" + OpName %swap_i1_i1_ "swap(i1;i1;" + OpName %i "i" + OpName %j "j" + OpName %performPartition_i1_i1_ "performPartition(i1;i1;" + OpName %l "l" + OpName %h "h" + OpName %quicksort_ "quicksort(" + OpName %temp "temp" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %pivot "pivot" + OpName %i_0 "i" + OpName %j_0 "j" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %l_0 "l" + OpName %h_0 "h" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %_GLF_FragCoord "_GLF_FragCoord" + OpName %_GLF_pos "_GLF_pos" + OpName %i_1 "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %uv "uv" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %__0 "" + OpName %color "color" + OpName %frag_color "frag_color" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpName %__1 "" + OpDecorate %_GLF_pos Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %frag_color Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %40 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %43 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %44 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float +%_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private +%_ptr_Input_v4float = OpTypePointer Input %v4float + %_GLF_pos = OpVariable %_ptr_Input_v4float Input + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %62 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %64 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_10 = OpConstant %int 10 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %__0 = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %78 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %frag_color = OpVariable %_ptr_Output_v4float Output +%gl_PerVertex = OpTypeStruct %v4float %float +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__1 = OpVariable %_ptr_Output_gl_PerVertex Output + %main = OpFunction %void None %40 + %93 = OpLabel + %i_1 = OpVariable %_ptr_Function_int Function + %uv = OpVariable %_ptr_Function_v2float Function + %color = OpVariable %_ptr_Function_v3float Function + %94 = OpLoad %v4float %_GLF_pos + %95 = OpFAdd %v4float %94 %62 + %96 = OpFMul %v4float %95 %64 + OpStore %_GLF_FragCoord %96 + OpStore %i_1 %int_0 + OpBranch %97 + %97 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %101 = OpLoad %int %i_1 + %102 = OpSLessThan %bool %101 %int_10 + OpBranchConditional %102 %103 %98 + %103 = OpLabel + %104 = OpLoad %int %i_1 + %105 = OpLoad %int %i_1 + %106 = OpISub %int %int_10 %105 + %107 = OpAccessChain %_ptr_Private_int %obj %int_0 %104 + OpStore %107 %106 + %108 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %109 = OpLoad %float %108 + %110 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %111 = OpLoad %float %110 + %112 = OpFOrdGreaterThan %bool %109 %111 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + OpBranch %98 + %113 = OpLabel + %115 = OpLoad %int %i_1 + %116 = OpLoad %int %i_1 + %117 = OpAccessChain %_ptr_Private_int %obj %int_0 %116 + %118 = OpLoad %int %117 + %119 = OpLoad %int %i_1 + %120 = OpAccessChain %_ptr_Private_int %obj %int_0 %119 + %121 = OpLoad %int %120 + %122 = OpIMul %int %118 %121 + %123 = OpAccessChain %_ptr_Private_int %obj %int_0 %115 + OpStore %123 %122 + OpBranch %99 + %99 = OpLabel + %124 = OpLoad %int %i_1 + %125 = OpIAdd %int %124 %int_1 + OpStore %i_1 %125 + OpBranch %97 + %98 = OpLabel + %126 = OpFunctionCall %void %quicksort_ + %127 = OpLoad %v4float %_GLF_FragCoord + %128 = OpVectorShuffle %v2float %127 %127 0 1 + %129 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 + %130 = OpLoad %v2float %129 + %131 = OpFDiv %v2float %128 %130 + OpStore %uv %131 + OpStore %color %78 + %132 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_0 + %133 = OpLoad %int %132 + %134 = OpConvertSToF %float %133 + %135 = OpAccessChain %_ptr_Function_float %color %uint_0 + %136 = OpLoad %float %135 + %137 = OpFAdd %float %136 %134 + %138 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %138 %137 + %139 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %140 = OpLoad %float %139 + %141 = OpFOrdGreaterThan %bool %140 %float_0_25 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %142 + %143 = OpLabel + %144 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_1 + %145 = OpLoad %int %144 + %146 = OpConvertSToF %float %145 + %147 = OpAccessChain %_ptr_Function_float %color %uint_0 + %148 = OpLoad %float %147 + %149 = OpFAdd %float %148 %146 + %150 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %150 %149 + OpBranch %142 + %142 = OpLabel + %151 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %152 = OpLoad %float %151 + %153 = OpFOrdGreaterThan %bool %152 %float_0_5 + OpSelectionMerge %154 None + OpBranchConditional %153 %155 %154 + %155 = OpLabel + %156 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_2 + %157 = OpLoad %int %156 + %158 = OpConvertSToF %float %157 + %159 = OpAccessChain %_ptr_Function_float %color %uint_1 + %160 = OpLoad %float %159 + %161 = OpFAdd %float %160 %158 + %162 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %162 %161 + OpBranch %154 + %154 = OpLabel + %163 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %164 = OpLoad %float %163 + %165 = OpFOrdGreaterThan %bool %164 %float_0_75 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %166 + %167 = OpLabel + %168 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_3 + %169 = OpLoad %int %168 + %170 = OpConvertSToF %float %169 + %171 = OpAccessChain %_ptr_Function_float %color %uint_2 + %172 = OpLoad %float %171 + %173 = OpFAdd %float %172 %170 + %174 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %174 %173 + OpBranch %166 + %166 = OpLabel + %175 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_4 + %176 = OpLoad %int %175 + %177 = OpConvertSToF %float %176 + %178 = OpAccessChain %_ptr_Function_float %color %uint_1 + %179 = OpLoad %float %178 + %180 = OpFAdd %float %179 %177 + %181 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %181 %180 + %182 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %183 = OpLoad %float %182 + %184 = OpFOrdGreaterThan %bool %183 %float_0_25 + OpSelectionMerge %185 None + OpBranchConditional %184 %186 %185 + %186 = OpLabel + %187 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_5 + %188 = OpLoad %int %187 + %189 = OpConvertSToF %float %188 + %190 = OpAccessChain %_ptr_Function_float %color %uint_0 + %191 = OpLoad %float %190 + %192 = OpFAdd %float %191 %189 + %193 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %193 %192 + OpBranch %185 + %185 = OpLabel + %194 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %195 = OpLoad %float %194 + %196 = OpFOrdGreaterThan %bool %195 %float_0_5 + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %197 + %198 = OpLabel + %199 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_6 + %200 = OpLoad %int %199 + %201 = OpConvertSToF %float %200 + %202 = OpAccessChain %_ptr_Function_float %color %uint_1 + %203 = OpLoad %float %202 + %204 = OpFAdd %float %203 %201 + %205 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %205 %204 + OpBranch %197 + %197 = OpLabel + %206 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %207 = OpLoad %float %206 + %208 = OpFOrdGreaterThan %bool %207 %float_0_75 + OpSelectionMerge %209 None + OpBranchConditional %208 %210 %209 + %210 = OpLabel + %211 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_7 + %212 = OpLoad %int %211 + %213 = OpConvertSToF %float %212 + %214 = OpAccessChain %_ptr_Function_float %color %uint_2 + %215 = OpLoad %float %214 + %216 = OpFAdd %float %215 %213 + %217 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %217 %216 + OpBranch %209 + %209 = OpLabel + %218 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_8 + %219 = OpLoad %int %218 + %220 = OpConvertSToF %float %219 + %221 = OpAccessChain %_ptr_Function_float %color %uint_2 + %222 = OpLoad %float %221 + %223 = OpFAdd %float %222 %220 + %224 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %224 %223 + %225 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %226 = OpLoad %float %225 + %227 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %228 = OpLoad %float %227 + %229 = OpFSub %float %226 %228 + %230 = OpExtInst %float %1 FAbs %229 + %231 = OpFOrdLessThan %bool %230 %float_0_25 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %232 + %233 = OpLabel + %234 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_9 + %235 = OpLoad %int %234 + %236 = OpConvertSToF %float %235 + %237 = OpAccessChain %_ptr_Function_float %color %uint_0 + %238 = OpLoad %float %237 + %239 = OpFAdd %float %238 %236 + %240 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %240 %239 + OpBranch %232 + %232 = OpLabel + %241 = OpLoad %v3float %color + %242 = OpExtInst %v3float %1 Normalize %241 + %243 = OpCompositeExtract %float %242 0 + %244 = OpCompositeExtract %float %242 1 + %245 = OpCompositeExtract %float %242 2 + %246 = OpCompositeConstruct %v4float %243 %244 %245 %float_1 + OpStore %frag_color %246 + %247 = OpLoad %v4float %_GLF_pos + %248 = OpAccessChain %_ptr_Output_v4float %__1 %int_0 + OpStore %248 %247 + OpReturn + OpFunctionEnd +%swap_i1_i1_ = OpFunction %void None %43 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %249 = OpLabel + %temp = OpVariable %_ptr_Function_int Function + %250 = OpLoad %int %i + %251 = OpAccessChain %_ptr_Private_int %obj %int_0 %250 + %252 = OpLoad %int %251 + OpStore %temp %252 + %253 = OpLoad %int %i + %254 = OpLoad %int %j + %255 = OpAccessChain %_ptr_Private_int %obj %int_0 %254 + %256 = OpLoad %int %255 + %257 = OpAccessChain %_ptr_Private_int %obj %int_0 %253 + OpStore %257 %256 + %258 = OpLoad %int %j + %259 = OpLoad %int %temp + %260 = OpAccessChain %_ptr_Private_int %obj %int_0 %258 + OpStore %260 %259 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %44 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %261 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_int Function + %262 = OpLoad %int %h + %263 = OpAccessChain %_ptr_Private_int %obj %int_0 %262 + %264 = OpLoad %int %263 + OpStore %pivot %264 + %265 = OpLoad %int %l + %266 = OpISub %int %265 %int_1 + OpStore %i_0 %266 + %267 = OpLoad %int %l + OpStore %j_0 %267 + OpBranch %268 + %268 = OpLabel + OpLoopMerge %269 %270 None + OpBranch %271 + %271 = OpLabel + %272 = OpLoad %int %j_0 + %273 = OpLoad %int %h + %274 = OpISub %int %273 %int_1 + %275 = OpSLessThanEqual %bool %272 %274 + OpBranchConditional %275 %276 %269 + %276 = OpLabel + %277 = OpLoad %int %j_0 + %278 = OpAccessChain %_ptr_Private_int %obj %int_0 %277 + %279 = OpLoad %int %278 + %280 = OpLoad %int %pivot + %281 = OpSLessThanEqual %bool %279 %280 + OpSelectionMerge %282 None + OpBranchConditional %281 %283 %282 + %283 = OpLabel + %284 = OpLoad %int %i_0 + %285 = OpIAdd %int %284 %int_1 + OpStore %i_0 %285 + %286 = OpLoad %int %i_0 + OpStore %param %286 + %287 = OpLoad %int %j_0 + OpStore %param_0 %287 + %288 = OpFunctionCall %void %swap_i1_i1_ %param %param_0 + OpBranch %282 + %282 = OpLabel + OpBranch %270 + %270 = OpLabel + %289 = OpLoad %int %j_0 + %290 = OpIAdd %int %289 %int_1 + OpStore %j_0 %290 + OpBranch %268 + %269 = OpLabel + %291 = OpLoad %int %i_0 + %292 = OpIAdd %int %291 %int_1 + OpStore %param_1 %292 + %293 = OpLoad %int %h + OpStore %param_2 %293 + %294 = OpFunctionCall %void %swap_i1_i1_ %param_1 %param_2 + %295 = OpLoad %int %i_0 + %296 = OpIAdd %int %295 %int_1 + OpReturnValue %296 + OpFunctionEnd + %quicksort_ = OpFunction %void None %40 + %297 = OpLabel + %l_0 = OpVariable %_ptr_Function_int Function + %h_0 = OpVariable %_ptr_Function_int Function + %top = OpVariable %_ptr_Function_int Function + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function + %p = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_int Function + %param_4 = OpVariable %_ptr_Function_int Function + OpStore %l_0 %int_0 + OpStore %h_0 %int_9 + OpStore %top %int_n1 + %298 = OpLoad %int %top + %299 = OpIAdd %int %298 %int_1 + OpStore %top %299 + %300 = OpLoad %int %l_0 + %301 = OpAccessChain %_ptr_Function_int %stack %299 + OpStore %301 %300 + %302 = OpLoad %int %top + %303 = OpIAdd %int %302 %int_1 + OpStore %top %303 + %304 = OpLoad %int %h_0 + %305 = OpAccessChain %_ptr_Function_int %stack %303 + OpStore %305 %304 + OpBranch %306 + %306 = OpLabel + OpLoopMerge %307 %308 None + OpBranch %309 + %309 = OpLabel + %310 = OpLoad %int %top + %311 = OpSGreaterThanEqual %bool %310 %int_0 + OpBranchConditional %311 %312 %307 + %312 = OpLabel + %313 = OpLoad %int %top + %314 = OpISub %int %313 %int_1 + OpStore %top %314 + %315 = OpAccessChain %_ptr_Function_int %stack %313 + %316 = OpLoad %int %315 + OpStore %h_0 %316 + %317 = OpLoad %int %top + %318 = OpISub %int %317 %int_1 + OpStore %top %318 + %319 = OpAccessChain %_ptr_Function_int %stack %317 + %320 = OpLoad %int %319 + OpStore %l_0 %320 + %321 = OpLoad %int %l_0 + OpStore %param_3 %321 + %322 = OpLoad %int %h_0 + OpStore %param_4 %322 + %323 = OpFunctionCall %int %performPartition_i1_i1_ %param_3 %param_4 + OpStore %p %323 + %324 = OpLoad %int %p + %325 = OpISub %int %324 %int_1 + %326 = OpLoad %int %l_0 + %327 = OpSGreaterThan %bool %325 %326 + OpSelectionMerge %328 None + OpBranchConditional %327 %329 %328 + %329 = OpLabel + %330 = OpLoad %int %top + %331 = OpIAdd %int %330 %int_1 + OpStore %top %331 + %332 = OpLoad %int %l_0 + %333 = OpAccessChain %_ptr_Function_int %stack %331 + OpStore %333 %332 + %334 = OpLoad %int %top + %335 = OpIAdd %int %334 %int_1 + OpStore %top %335 + %336 = OpLoad %int %p + %337 = OpISub %int %336 %int_1 + %338 = OpAccessChain %_ptr_Function_int %stack %335 + OpStore %338 %337 + OpBranch %328 + %328 = OpLabel + %339 = OpLoad %int %p + %340 = OpIAdd %int %339 %int_1 + %341 = OpLoad %int %h_0 + %342 = OpSLessThan %bool %340 %341 + OpSelectionMerge %343 None + OpBranchConditional %342 %344 %343 + %344 = OpLabel + %345 = OpLoad %int %top + %346 = OpIAdd %int %345 %int_1 + OpStore %top %346 + %347 = OpLoad %int %p + %348 = OpIAdd %int %347 %int_1 + %349 = OpAccessChain %_ptr_Function_int %stack %346 + OpStore %349 %348 + %350 = OpLoad %int %top + %351 = OpIAdd %int %350 %int_1 + OpStore %top %351 + %352 = OpLoad %int %h_0 + %353 = OpAccessChain %_ptr_Function_int %stack %351 + OpStore %353 %352 + OpBranch %343 + %343 = OpLabel + OpBranch %308 + %308 = OpLabel + OpBranch %306 + %307 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..017bbe6300 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.hlsl @@ -0,0 +1,227 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_33 : register(b0, space0) { + uint4 x_33[1]; +}; +cbuffer cbuffer_x_36 : register(b1, space0) { + uint4 x_36[1]; +}; +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_250 = i; + const int x_252 = obj.numbers[x_250]; + temp = x_252; + const int x_253 = i; + const int x_254 = j; + const int x_256 = obj.numbers[x_254]; + obj.numbers[x_253] = x_256; + const int x_258 = j; + obj.numbers[x_258] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_262 = h; + const int x_264 = obj.numbers[x_262]; + pivot = x_264; + const int x_265 = l; + i_1 = (x_265 - 1); + const int x_267 = l; + j_1 = x_267; + while (true) { + const int x_272 = j_1; + const int x_273 = h; + if ((x_272 <= (x_273 - 1))) { + } else { + break; + } + const int x_279 = obj.numbers[j_1]; + if ((x_279 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + param_2 = (i_1 + 1); + const int x_293 = h; + param_3 = x_293; + swap_i1_i1_(param_2, param_3); + return (i_1 + 1); +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_299 = (top + 1); + top = x_299; + stack[x_299] = l_1; + const int x_303 = (top + 1); + top = x_303; + stack[x_303] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_313 = top; + top = (x_313 - 1); + const int x_316 = stack[x_313]; + h_1 = x_316; + const int x_317 = top; + top = (x_317 - 1); + const int x_320 = stack[x_317]; + l_1 = x_320; + param_4 = l_1; + param_5 = h_1; + const int x_323 = performPartition_i1_i1_(param_4, param_5); + p = x_323; + if (((p - 1) > l_1)) { + const int x_331 = (top + 1); + top = x_331; + stack[x_331] = l_1; + const int x_335 = (top + 1); + top = x_335; + stack[x_335] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_346 = (top + 1); + top = x_346; + stack[x_346] = (p + 1); + const int x_351 = (top + 1); + top = x_351; + stack[x_351] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const float x_109 = asfloat(x_33[0].x); + const float x_111 = asfloat(x_33[0].y); + if ((x_109 > x_111)) { + break; + } + const int x_115 = i_2; + const int x_118 = obj.numbers[i_2]; + const int x_121 = obj.numbers[i_2]; + obj.numbers[x_115] = (x_118 * x_121); + } + } + quicksort_(); + const float4 x_127 = x_GLF_FragCoord; + const float2 x_130 = asfloat(x_36[0].xy); + uv = (float2(x_127.x, x_127.y) / x_130); + color = float3(1.0f, 2.0f, 3.0f); + const int x_133 = obj.numbers[0]; + const float x_136 = color.x; + color.x = (x_136 + float(x_133)); + const float x_140 = uv.x; + if ((x_140 > 0.25f)) { + const int x_145 = obj.numbers[1]; + const float x_148 = color.x; + color.x = (x_148 + float(x_145)); + } + const float x_152 = uv.x; + if ((x_152 > 0.5f)) { + const int x_157 = obj.numbers[2]; + const float x_160 = color.y; + color.y = (x_160 + float(x_157)); + } + const float x_164 = uv.x; + if ((x_164 > 0.75f)) { + const int x_169 = obj.numbers[3]; + const float x_172 = color.z; + color.z = (x_172 + float(x_169)); + } + const int x_176 = obj.numbers[4]; + const float x_179 = color.y; + color.y = (x_179 + float(x_176)); + const float x_183 = uv.y; + if ((x_183 > 0.25f)) { + const int x_188 = obj.numbers[5]; + const float x_191 = color.x; + color.x = (x_191 + float(x_188)); + } + const float x_195 = uv.y; + if ((x_195 > 0.5f)) { + const int x_200 = obj.numbers[6]; + const float x_203 = color.y; + color.y = (x_203 + float(x_200)); + } + const float x_207 = uv.y; + if ((x_207 > 0.75f)) { + const int x_212 = obj.numbers[7]; + const float x_215 = color.z; + color.z = (x_215 + float(x_212)); + } + const int x_219 = obj.numbers[8]; + const float x_222 = color.z; + color.z = (x_222 + float(x_219)); + const float x_226 = uv.x; + const float x_228 = uv.y; + if ((abs((x_226 - x_228)) < 0.25f)) { + const int x_235 = obj.numbers[9]; + const float x_238 = color.x; + color.x = (x_238 + float(x_235)); + } + const float3 x_242 = normalize(color); + frag_color = float4(x_242.x, x_242.y, x_242.z, 1.0f); + gl_Position = x_GLF_pos; + return; +} + +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 x_GLF_pos_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_GLF_pos_param = tint_symbol.x_GLF_pos_param; + x_GLF_pos = x_GLF_pos_param; + main_1(); + const main_out tint_symbol_3 = {frag_color, gl_Position}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.msl new file mode 100644 index 0000000000..fae0fc6dcb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.msl @@ -0,0 +1,274 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_pos_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_6) { + int temp = 0; + int const x_250 = *(i); + int const x_252 = (*(tint_symbol_6)).numbers.arr[x_250]; + temp = x_252; + int const x_253 = *(i); + int const x_254 = *(j); + int const x_256 = (*(tint_symbol_6)).numbers.arr[x_254]; + (*(tint_symbol_6)).numbers.arr[x_253] = x_256; + int const x_258 = *(j); + int const x_259 = temp; + (*(tint_symbol_6)).numbers.arr[x_258] = x_259; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_7) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_262 = *(h); + int const x_264 = (*(tint_symbol_7)).numbers.arr[x_262]; + pivot = x_264; + int const x_265 = *(l); + i_1 = (x_265 - 1); + int const x_267 = *(l); + j_1 = x_267; + while (true) { + int const x_272 = j_1; + int const x_273 = *(h); + if ((x_272 <= (x_273 - 1))) { + } else { + break; + } + int const x_277 = j_1; + int const x_279 = (*(tint_symbol_7)).numbers.arr[x_277]; + int const x_280 = pivot; + if ((x_279 <= x_280)) { + int const x_284 = i_1; + i_1 = (x_284 + 1); + int const x_286 = i_1; + param = x_286; + int const x_287 = j_1; + param_1 = x_287; + swap_i1_i1_(&(param), &(param_1), tint_symbol_7); + } + { + int const x_289 = j_1; + j_1 = (x_289 + 1); + } + } + int const x_291 = i_1; + param_2 = (x_291 + 1); + int const x_293 = *(h); + param_3 = x_293; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_7); + int const x_295 = i_1; + return (x_295 + 1); +} + +void quicksort_(thread QuicksortObject* const tint_symbol_8) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_298 = top; + int const x_299 = (x_298 + 1); + top = x_299; + int const x_300 = l_1; + stack.arr[x_299] = x_300; + int const x_302 = top; + int const x_303 = (x_302 + 1); + top = x_303; + int const x_304 = h_1; + stack.arr[x_303] = x_304; + while (true) { + int const x_310 = top; + if ((x_310 >= 0)) { + } else { + break; + } + int const x_313 = top; + top = (x_313 - 1); + int const x_316 = stack.arr[x_313]; + h_1 = x_316; + int const x_317 = top; + top = (x_317 - 1); + int const x_320 = stack.arr[x_317]; + l_1 = x_320; + int const x_321 = l_1; + param_4 = x_321; + int const x_322 = h_1; + param_5 = x_322; + int const x_323 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_8); + p = x_323; + int const x_324 = p; + int const x_326 = l_1; + if (((x_324 - 1) > x_326)) { + int const x_330 = top; + int const x_331 = (x_330 + 1); + top = x_331; + int const x_332 = l_1; + stack.arr[x_331] = x_332; + int const x_334 = top; + int const x_335 = (x_334 + 1); + top = x_335; + int const x_336 = p; + stack.arr[x_335] = (x_336 - 1); + } + int const x_339 = p; + int const x_341 = h_1; + if (((x_339 + 1) < x_341)) { + int const x_345 = top; + int const x_346 = (x_345 + 1); + top = x_346; + int const x_347 = p; + stack.arr[x_346] = (x_347 + 1); + int const x_350 = top; + int const x_351 = (x_350 + 1); + top = x_351; + int const x_352 = h_1; + stack.arr[x_351] = x_352; + } + } + return; +} + +void main_1(constant buf0& x_33, constant buf1& x_36, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10, thread QuicksortObject* const tint_symbol_11, thread float4* const tint_symbol_12, thread float4* const tint_symbol_13) { + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + float4 const x_94 = *(tint_symbol_9); + *(tint_symbol_10) = ((x_94 + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + while (true) { + int const x_101 = i_2; + if ((x_101 < 10)) { + } else { + break; + } + int const x_104 = i_2; + int const x_105 = i_2; + (*(tint_symbol_11)).numbers.arr[x_104] = (10 - x_105); + float const x_109 = x_33.injectionSwitch.x; + float const x_111 = x_33.injectionSwitch.y; + if ((x_109 > x_111)) { + break; + } + int const x_115 = i_2; + int const x_116 = i_2; + int const x_118 = (*(tint_symbol_11)).numbers.arr[x_116]; + int const x_119 = i_2; + int const x_121 = (*(tint_symbol_11)).numbers.arr[x_119]; + (*(tint_symbol_11)).numbers.arr[x_115] = (x_118 * x_121); + { + int const x_124 = i_2; + i_2 = (x_124 + 1); + } + } + quicksort_(tint_symbol_11); + float4 const x_127 = *(tint_symbol_10); + float2 const x_130 = x_36.resolution; + uv = (float2(x_127.x, x_127.y) / x_130); + color = float3(1.0f, 2.0f, 3.0f); + int const x_133 = (*(tint_symbol_11)).numbers.arr[0]; + float const x_136 = color.x; + color.x = (x_136 + float(x_133)); + float const x_140 = uv.x; + if ((x_140 > 0.25f)) { + int const x_145 = (*(tint_symbol_11)).numbers.arr[1]; + float const x_148 = color.x; + color.x = (x_148 + float(x_145)); + } + float const x_152 = uv.x; + if ((x_152 > 0.5f)) { + int const x_157 = (*(tint_symbol_11)).numbers.arr[2]; + float const x_160 = color.y; + color.y = (x_160 + float(x_157)); + } + float const x_164 = uv.x; + if ((x_164 > 0.75f)) { + int const x_169 = (*(tint_symbol_11)).numbers.arr[3]; + float const x_172 = color.z; + color.z = (x_172 + float(x_169)); + } + int const x_176 = (*(tint_symbol_11)).numbers.arr[4]; + float const x_179 = color.y; + color.y = (x_179 + float(x_176)); + float const x_183 = uv.y; + if ((x_183 > 0.25f)) { + int const x_188 = (*(tint_symbol_11)).numbers.arr[5]; + float const x_191 = color.x; + color.x = (x_191 + float(x_188)); + } + float const x_195 = uv.y; + if ((x_195 > 0.5f)) { + int const x_200 = (*(tint_symbol_11)).numbers.arr[6]; + float const x_203 = color.y; + color.y = (x_203 + float(x_200)); + } + float const x_207 = uv.y; + if ((x_207 > 0.75f)) { + int const x_212 = (*(tint_symbol_11)).numbers.arr[7]; + float const x_215 = color.z; + color.z = (x_215 + float(x_212)); + } + int const x_219 = (*(tint_symbol_11)).numbers.arr[8]; + float const x_222 = color.z; + color.z = (x_222 + float(x_219)); + float const x_226 = uv.x; + float const x_228 = uv.y; + if ((fabs((x_226 - x_228)) < 0.25f)) { + int const x_235 = (*(tint_symbol_11)).numbers.arr[9]; + float const x_238 = color.x; + color.x = (x_238 + float(x_235)); + } + float3 const x_241 = color; + float3 const x_242 = normalize(x_241); + *(tint_symbol_12) = float4(x_242.x, x_242.y, x_242.z, 1.0f); + float4 const x_247 = *(tint_symbol_9); + *(tint_symbol_13) = x_247; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant buf0& x_33 [[buffer(0)]], constant buf1& x_36 [[buffer(1)]]) { + thread float4 tint_symbol_14 = 0.0f; + thread float4 tint_symbol_15 = 0.0f; + thread QuicksortObject tint_symbol_16 = {}; + thread float4 tint_symbol_17 = 0.0f; + thread float4 tint_symbol_18 = 0.0f; + float4 const x_GLF_pos_param = tint_symbol_1.x_GLF_pos_param; + tint_symbol_14 = x_GLF_pos_param; + main_1(x_33, x_36, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_16), &(tint_symbol_17), &(tint_symbol_18)); + main_out const tint_symbol_4 = {.frag_color_1=tint_symbol_17, .gl_Position=tint_symbol_18}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..e0c2ca0e5c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.spvasm @@ -0,0 +1,589 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 401 +; Schema: 0 + OpCapability Shader + %367 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %x_GLF_FragCoord "x_GLF_FragCoord" + OpName %x_GLF_pos "x_GLF_pos" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_33 "x_33" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_36 "x_36" + OpName %frag_color "frag_color" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "frag_color_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_33 NonWritable + OpDecorate %x_33 DescriptorSet 0 + OpDecorate %x_33 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_36 NonWritable + OpDecorate %x_36 DescriptorSet 0 + OpDecorate %x_36 Binding 1 + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_3 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %12 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private %16 + %x_GLF_pos = OpVariable %_ptr_Private_v4float Private %16 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_33 = OpVariable %_ptr_Uniform_buf0 Uniform + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_36 = OpVariable %_ptr_Uniform_buf1 Uniform + %frag_color = OpVariable %_ptr_Private_v4float Private %16 +%gl_Position = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %16 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %32 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %40 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %58 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %118 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %126 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %198 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %202 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %206 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %209 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_10 = OpConstant %int 10 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %256 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float %v4float + %386 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %32 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %38 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %40 + %42 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + %46 = OpLoad %int %45 + OpStore %temp %46 + %48 = OpLoad %int %i + %50 = OpLoad %int %j + %51 = OpAccessChain %_ptr_Private_int %obj %uint_0 %50 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 + OpStore %53 %52 + %55 = OpLoad %int %j + %56 = OpLoad %int %temp + %57 = OpAccessChain %_ptr_Private_int %obj %uint_0 %55 + OpStore %57 %56 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %58 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %62 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %40 + %i_1 = OpVariable %_ptr_Function_int Function %40 + %j_1 = OpVariable %_ptr_Function_int Function %40 + %param = OpVariable %_ptr_Function_int Function %40 + %param_1 = OpVariable %_ptr_Function_int Function %40 + %param_2 = OpVariable %_ptr_Function_int Function %40 + %param_3 = OpVariable %_ptr_Function_int Function %40 + %71 = OpLoad %int %h + %72 = OpAccessChain %_ptr_Private_int %obj %uint_0 %71 + %73 = OpLoad %int %72 + OpStore %pivot %73 + %75 = OpLoad %int %l + %77 = OpISub %int %75 %int_1 + OpStore %i_1 %77 + %79 = OpLoad %int %l + OpStore %j_1 %79 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %int %j_1 + %86 = OpLoad %int %h + %87 = OpISub %int %86 %int_1 + %88 = OpSLessThanEqual %bool %84 %87 + OpSelectionMerge %90 None + OpBranchConditional %88 %91 %92 + %91 = OpLabel + OpBranch %90 + %92 = OpLabel + OpBranch %81 + %90 = OpLabel + %93 = OpLoad %int %j_1 + %94 = OpAccessChain %_ptr_Private_int %obj %uint_0 %93 + %95 = OpLoad %int %94 + %96 = OpLoad %int %pivot + %97 = OpSLessThanEqual %bool %95 %96 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpLoad %int %i_1 + %101 = OpIAdd %int %100 %int_1 + OpStore %i_1 %101 + %102 = OpLoad %int %i_1 + OpStore %param %102 + %103 = OpLoad %int %j_1 + OpStore %param_1 %103 + %104 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %98 + %98 = OpLabel + OpBranch %82 + %82 = OpLabel + %107 = OpLoad %int %j_1 + %108 = OpIAdd %int %107 %int_1 + OpStore %j_1 %108 + OpBranch %80 + %81 = OpLabel + %109 = OpLoad %int %i_1 + %110 = OpIAdd %int %109 %int_1 + OpStore %param_2 %110 + %112 = OpLoad %int %h + OpStore %param_3 %112 + %113 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %116 = OpLoad %int %i_1 + %117 = OpIAdd %int %116 %int_1 + OpReturnValue %117 + OpFunctionEnd + %quicksort_ = OpFunction %void None %118 + %120 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %40 + %h_1 = OpVariable %_ptr_Function_int Function %40 + %top = OpVariable %_ptr_Function_int Function %40 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %126 + %p = OpVariable %_ptr_Function_int Function %40 + %param_4 = OpVariable %_ptr_Function_int Function %40 + %param_5 = OpVariable %_ptr_Function_int Function %40 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %133 = OpLoad %int %top + %134 = OpIAdd %int %133 %int_1 + OpStore %top %134 + %135 = OpLoad %int %l_1 + %136 = OpAccessChain %_ptr_Function_int %stack %134 + OpStore %136 %135 + %137 = OpLoad %int %top + %138 = OpIAdd %int %137 %int_1 + OpStore %top %138 + %139 = OpLoad %int %h_1 + %140 = OpAccessChain %_ptr_Function_int %stack %138 + OpStore %140 %139 + OpBranch %141 + %141 = OpLabel + OpLoopMerge %142 %143 None + OpBranch %144 + %144 = OpLabel + %145 = OpLoad %int %top + %146 = OpSGreaterThanEqual %bool %145 %int_0 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %149 + %148 = OpLabel + OpBranch %147 + %149 = OpLabel + OpBranch %142 + %147 = OpLabel + %150 = OpLoad %int %top + %151 = OpISub %int %150 %int_1 + OpStore %top %151 + %152 = OpAccessChain %_ptr_Function_int %stack %150 + %153 = OpLoad %int %152 + OpStore %h_1 %153 + %154 = OpLoad %int %top + %155 = OpISub %int %154 %int_1 + OpStore %top %155 + %156 = OpAccessChain %_ptr_Function_int %stack %154 + %157 = OpLoad %int %156 + OpStore %l_1 %157 + %158 = OpLoad %int %l_1 + OpStore %param_4 %158 + %159 = OpLoad %int %h_1 + OpStore %param_5 %159 + %160 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %160 + %163 = OpLoad %int %p + %164 = OpLoad %int %l_1 + %165 = OpISub %int %163 %int_1 + %166 = OpSGreaterThan %bool %165 %164 + OpSelectionMerge %167 None + OpBranchConditional %166 %168 %167 + %168 = OpLabel + %169 = OpLoad %int %top + %170 = OpIAdd %int %169 %int_1 + OpStore %top %170 + %171 = OpLoad %int %l_1 + %172 = OpAccessChain %_ptr_Function_int %stack %170 + OpStore %172 %171 + %173 = OpLoad %int %top + %174 = OpIAdd %int %173 %int_1 + OpStore %top %174 + %175 = OpLoad %int %p + %176 = OpAccessChain %_ptr_Function_int %stack %174 + %177 = OpISub %int %175 %int_1 + OpStore %176 %177 + OpBranch %167 + %167 = OpLabel + %178 = OpLoad %int %p + %179 = OpLoad %int %h_1 + %180 = OpIAdd %int %178 %int_1 + %181 = OpSLessThan %bool %180 %179 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %184 = OpLoad %int %top + %185 = OpIAdd %int %184 %int_1 + OpStore %top %185 + %186 = OpLoad %int %p + %187 = OpAccessChain %_ptr_Function_int %stack %185 + %188 = OpIAdd %int %186 %int_1 + OpStore %187 %188 + %189 = OpLoad %int %top + %190 = OpIAdd %int %189 %int_1 + OpStore %top %190 + %191 = OpLoad %int %h_1 + %192 = OpAccessChain %_ptr_Function_int %stack %190 + OpStore %192 %191 + OpBranch %182 + %182 = OpLabel + OpBranch %143 + %143 = OpLabel + OpBranch %141 + %142 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %118 + %194 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %40 + %uv = OpVariable %_ptr_Function_v2float Function %198 + %color = OpVariable %_ptr_Function_v3float Function %202 + %203 = OpLoad %v4float %x_GLF_pos + %207 = OpFAdd %v4float %203 %206 + %210 = OpFMul %v4float %207 %209 + OpStore %x_GLF_FragCoord %210 + OpStore %i_2 %int_0 + OpBranch %211 + %211 = OpLabel + OpLoopMerge %212 %213 None + OpBranch %214 + %214 = OpLabel + %215 = OpLoad %int %i_2 + %217 = OpSLessThan %bool %215 %int_10 + OpSelectionMerge %218 None + OpBranchConditional %217 %219 %220 + %219 = OpLabel + OpBranch %218 + %220 = OpLabel + OpBranch %212 + %218 = OpLabel + %221 = OpLoad %int %i_2 + %222 = OpLoad %int %i_2 + %223 = OpAccessChain %_ptr_Private_int %obj %uint_0 %221 + %224 = OpISub %int %int_10 %222 + OpStore %223 %224 + %226 = OpAccessChain %_ptr_Uniform_float %x_33 %uint_0 %uint_0 + %227 = OpLoad %float %226 + %229 = OpAccessChain %_ptr_Uniform_float %x_33 %uint_0 %uint_1 + %230 = OpLoad %float %229 + %231 = OpFOrdGreaterThan %bool %227 %230 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %232 + %233 = OpLabel + OpBranch %212 + %232 = OpLabel + %234 = OpLoad %int %i_2 + %235 = OpLoad %int %i_2 + %236 = OpAccessChain %_ptr_Private_int %obj %uint_0 %235 + %237 = OpLoad %int %236 + %238 = OpLoad %int %i_2 + %239 = OpAccessChain %_ptr_Private_int %obj %uint_0 %238 + %240 = OpLoad %int %239 + %241 = OpAccessChain %_ptr_Private_int %obj %uint_0 %234 + %242 = OpIMul %int %237 %240 + OpStore %241 %242 + OpBranch %213 + %213 = OpLabel + %243 = OpLoad %int %i_2 + %244 = OpIAdd %int %243 %int_1 + OpStore %i_2 %244 + OpBranch %211 + %212 = OpLabel + %245 = OpFunctionCall %void %quicksort_ + %246 = OpLoad %v4float %x_GLF_FragCoord + %248 = OpAccessChain %_ptr_Uniform_v2float %x_36 %uint_0 + %249 = OpLoad %v2float %248 + %250 = OpCompositeExtract %float %246 0 + %251 = OpCompositeExtract %float %246 1 + %252 = OpCompositeConstruct %v2float %250 %251 + %253 = OpFDiv %v2float %252 %249 + OpStore %uv %253 + OpStore %color %256 + %257 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %258 = OpLoad %int %257 + %260 = OpAccessChain %_ptr_Function_float %color %uint_0 + %261 = OpLoad %float %260 + %262 = OpAccessChain %_ptr_Function_float %color %uint_0 + %263 = OpConvertSToF %float %258 + %264 = OpFAdd %float %261 %263 + OpStore %262 %264 + %265 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %266 = OpLoad %float %265 + %268 = OpFOrdGreaterThan %bool %266 %float_0_25 + OpSelectionMerge %269 None + OpBranchConditional %268 %270 %269 + %270 = OpLabel + %271 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %272 = OpLoad %int %271 + %273 = OpAccessChain %_ptr_Function_float %color %uint_0 + %274 = OpLoad %float %273 + %275 = OpAccessChain %_ptr_Function_float %color %uint_0 + %276 = OpConvertSToF %float %272 + %277 = OpFAdd %float %274 %276 + OpStore %275 %277 + OpBranch %269 + %269 = OpLabel + %278 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %279 = OpLoad %float %278 + %281 = OpFOrdGreaterThan %bool %279 %float_0_5 + OpSelectionMerge %282 None + OpBranchConditional %281 %283 %282 + %283 = OpLabel + %285 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %286 = OpLoad %int %285 + %287 = OpAccessChain %_ptr_Function_float %color %uint_1 + %288 = OpLoad %float %287 + %289 = OpAccessChain %_ptr_Function_float %color %uint_1 + %290 = OpConvertSToF %float %286 + %291 = OpFAdd %float %288 %290 + OpStore %289 %291 + OpBranch %282 + %282 = OpLabel + %292 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %293 = OpLoad %float %292 + %295 = OpFOrdGreaterThan %bool %293 %float_0_75 + OpSelectionMerge %296 None + OpBranchConditional %295 %297 %296 + %297 = OpLabel + %299 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %300 = OpLoad %int %299 + %302 = OpAccessChain %_ptr_Function_float %color %uint_2 + %303 = OpLoad %float %302 + %304 = OpAccessChain %_ptr_Function_float %color %uint_2 + %305 = OpConvertSToF %float %300 + %306 = OpFAdd %float %303 %305 + OpStore %304 %306 + OpBranch %296 + %296 = OpLabel + %308 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %309 = OpLoad %int %308 + %310 = OpAccessChain %_ptr_Function_float %color %uint_1 + %311 = OpLoad %float %310 + %312 = OpAccessChain %_ptr_Function_float %color %uint_1 + %313 = OpConvertSToF %float %309 + %314 = OpFAdd %float %311 %313 + OpStore %312 %314 + %315 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %316 = OpLoad %float %315 + %317 = OpFOrdGreaterThan %bool %316 %float_0_25 + OpSelectionMerge %318 None + OpBranchConditional %317 %319 %318 + %319 = OpLabel + %321 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %322 = OpLoad %int %321 + %323 = OpAccessChain %_ptr_Function_float %color %uint_0 + %324 = OpLoad %float %323 + %325 = OpAccessChain %_ptr_Function_float %color %uint_0 + %326 = OpConvertSToF %float %322 + %327 = OpFAdd %float %324 %326 + OpStore %325 %327 + OpBranch %318 + %318 = OpLabel + %328 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %329 = OpLoad %float %328 + %330 = OpFOrdGreaterThan %bool %329 %float_0_5 + OpSelectionMerge %331 None + OpBranchConditional %330 %332 %331 + %332 = OpLabel + %334 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %335 = OpLoad %int %334 + %336 = OpAccessChain %_ptr_Function_float %color %uint_1 + %337 = OpLoad %float %336 + %338 = OpAccessChain %_ptr_Function_float %color %uint_1 + %339 = OpConvertSToF %float %335 + %340 = OpFAdd %float %337 %339 + OpStore %338 %340 + OpBranch %331 + %331 = OpLabel + %341 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %342 = OpLoad %float %341 + %343 = OpFOrdGreaterThan %bool %342 %float_0_75 + OpSelectionMerge %344 None + OpBranchConditional %343 %345 %344 + %345 = OpLabel + %347 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %348 = OpLoad %int %347 + %349 = OpAccessChain %_ptr_Function_float %color %uint_2 + %350 = OpLoad %float %349 + %351 = OpAccessChain %_ptr_Function_float %color %uint_2 + %352 = OpConvertSToF %float %348 + %353 = OpFAdd %float %350 %352 + OpStore %351 %353 + OpBranch %344 + %344 = OpLabel + %355 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %356 = OpLoad %int %355 + %357 = OpAccessChain %_ptr_Function_float %color %uint_2 + %358 = OpLoad %float %357 + %359 = OpAccessChain %_ptr_Function_float %color %uint_2 + %360 = OpConvertSToF %float %356 + %361 = OpFAdd %float %358 %360 + OpStore %359 %361 + %362 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %363 = OpLoad %float %362 + %364 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %365 = OpLoad %float %364 + %368 = OpFSub %float %363 %365 + %366 = OpExtInst %float %367 FAbs %368 + %369 = OpFOrdLessThan %bool %366 %float_0_25 + OpSelectionMerge %370 None + OpBranchConditional %369 %371 %370 + %371 = OpLabel + %372 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %373 = OpLoad %int %372 + %374 = OpAccessChain %_ptr_Function_float %color %uint_0 + %375 = OpLoad %float %374 + %376 = OpAccessChain %_ptr_Function_float %color %uint_0 + %377 = OpConvertSToF %float %373 + %378 = OpFAdd %float %375 %377 + OpStore %376 %378 + OpBranch %370 + %370 = OpLabel + %379 = OpLoad %v3float %color + %380 = OpExtInst %v3float %367 Normalize %379 + %381 = OpCompositeExtract %float %380 0 + %382 = OpCompositeExtract %float %380 1 + %383 = OpCompositeExtract %float %380 2 + %384 = OpCompositeConstruct %v4float %381 %382 %383 %float_1 + OpStore %frag_color %384 + %385 = OpLoad %v4float %x_GLF_pos + OpStore %gl_Position %385 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %386 +%tint_symbol_1 = OpFunctionParameter %main_out + %390 = OpLabel + %391 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %391 + %392 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %392 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %118 + %394 = OpLabel + OpStore %tint_pointsize %float_1 + %395 = OpLoad %v4float %tint_symbol + OpStore %x_GLF_pos %395 + %396 = OpFunctionCall %void %main_1 + %398 = OpLoad %v4float %frag_color + %399 = OpLoad %v4float %gl_Position + %400 = OpCompositeConstruct %main_out %398 %399 + %397 = OpFunctionCall %void %tint_symbol_4 %400 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b0ecbc43da --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.wgsl @@ -0,0 +1,276 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(0)]] var x_33 : buf0; + +[[group(0), binding(1)]] var x_36 : buf1; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_250 : i32 = *(i); + let x_252 : i32 = obj.numbers[x_250]; + temp = x_252; + let x_253 : i32 = *(i); + let x_254 : i32 = *(j); + let x_256 : i32 = obj.numbers[x_254]; + obj.numbers[x_253] = x_256; + let x_258 : i32 = *(j); + let x_259 : i32 = temp; + obj.numbers[x_258] = x_259; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_262 : i32 = *(h); + let x_264 : i32 = obj.numbers[x_262]; + pivot = x_264; + let x_265 : i32 = *(l); + i_1 = (x_265 - 1); + let x_267 : i32 = *(l); + j_1 = x_267; + loop { + let x_272 : i32 = j_1; + let x_273 : i32 = *(h); + if ((x_272 <= (x_273 - 1))) { + } else { + break; + } + let x_277 : i32 = j_1; + let x_279 : i32 = obj.numbers[x_277]; + let x_280 : i32 = pivot; + if ((x_279 <= x_280)) { + let x_284 : i32 = i_1; + i_1 = (x_284 + 1); + let x_286 : i32 = i_1; + param = x_286; + let x_287 : i32 = j_1; + param_1 = x_287; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_289 : i32 = j_1; + j_1 = (x_289 + 1); + } + } + let x_291 : i32 = i_1; + param_2 = (x_291 + 1); + let x_293 : i32 = *(h); + param_3 = x_293; + swap_i1_i1_(&(param_2), &(param_3)); + let x_295 : i32 = i_1; + return (x_295 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_298 : i32 = top; + let x_299 : i32 = (x_298 + 1); + top = x_299; + let x_300 : i32 = l_1; + stack[x_299] = x_300; + let x_302 : i32 = top; + let x_303 : i32 = (x_302 + 1); + top = x_303; + let x_304 : i32 = h_1; + stack[x_303] = x_304; + loop { + let x_310 : i32 = top; + if ((x_310 >= 0)) { + } else { + break; + } + let x_313 : i32 = top; + top = (x_313 - 1); + let x_316 : i32 = stack[x_313]; + h_1 = x_316; + let x_317 : i32 = top; + top = (x_317 - 1); + let x_320 : i32 = stack[x_317]; + l_1 = x_320; + let x_321 : i32 = l_1; + param_4 = x_321; + let x_322 : i32 = h_1; + param_5 = x_322; + let x_323 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_323; + let x_324 : i32 = p; + let x_326 : i32 = l_1; + if (((x_324 - 1) > x_326)) { + let x_330 : i32 = top; + let x_331 : i32 = (x_330 + 1); + top = x_331; + let x_332 : i32 = l_1; + stack[x_331] = x_332; + let x_334 : i32 = top; + let x_335 : i32 = (x_334 + 1); + top = x_335; + let x_336 : i32 = p; + stack[x_335] = (x_336 - 1); + } + let x_339 : i32 = p; + let x_341 : i32 = h_1; + if (((x_339 + 1) < x_341)) { + let x_345 : i32 = top; + let x_346 : i32 = (x_345 + 1); + top = x_346; + let x_347 : i32 = p; + stack[x_346] = (x_347 + 1); + let x_350 : i32 = top; + let x_351 : i32 = (x_350 + 1); + top = x_351; + let x_352 : i32 = h_1; + stack[x_351] = x_352; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_94 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_94 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_101 : i32 = i_2; + if ((x_101 < 10)) { + } else { + break; + } + let x_104 : i32 = i_2; + let x_105 : i32 = i_2; + obj.numbers[x_104] = (10 - x_105); + let x_109 : f32 = x_33.injectionSwitch.x; + let x_111 : f32 = x_33.injectionSwitch.y; + if ((x_109 > x_111)) { + break; + } + let x_115 : i32 = i_2; + let x_116 : i32 = i_2; + let x_118 : i32 = obj.numbers[x_116]; + let x_119 : i32 = i_2; + let x_121 : i32 = obj.numbers[x_119]; + obj.numbers[x_115] = (x_118 * x_121); + + continuing { + let x_124 : i32 = i_2; + i_2 = (x_124 + 1); + } + } + quicksort_(); + let x_127 : vec4 = x_GLF_FragCoord; + let x_130 : vec2 = x_36.resolution; + uv = (vec2(x_127.x, x_127.y) / x_130); + color = vec3(1.0, 2.0, 3.0); + let x_133 : i32 = obj.numbers[0]; + let x_136 : f32 = color.x; + color.x = (x_136 + f32(x_133)); + let x_140 : f32 = uv.x; + if ((x_140 > 0.25)) { + let x_145 : i32 = obj.numbers[1]; + let x_148 : f32 = color.x; + color.x = (x_148 + f32(x_145)); + } + let x_152 : f32 = uv.x; + if ((x_152 > 0.5)) { + let x_157 : i32 = obj.numbers[2]; + let x_160 : f32 = color.y; + color.y = (x_160 + f32(x_157)); + } + let x_164 : f32 = uv.x; + if ((x_164 > 0.75)) { + let x_169 : i32 = obj.numbers[3]; + let x_172 : f32 = color.z; + color.z = (x_172 + f32(x_169)); + } + let x_176 : i32 = obj.numbers[4]; + let x_179 : f32 = color.y; + color.y = (x_179 + f32(x_176)); + let x_183 : f32 = uv.y; + if ((x_183 > 0.25)) { + let x_188 : i32 = obj.numbers[5]; + let x_191 : f32 = color.x; + color.x = (x_191 + f32(x_188)); + } + let x_195 : f32 = uv.y; + if ((x_195 > 0.5)) { + let x_200 : i32 = obj.numbers[6]; + let x_203 : f32 = color.y; + color.y = (x_203 + f32(x_200)); + } + let x_207 : f32 = uv.y; + if ((x_207 > 0.75)) { + let x_212 : i32 = obj.numbers[7]; + let x_215 : f32 = color.z; + color.z = (x_215 + f32(x_212)); + } + let x_219 : i32 = obj.numbers[8]; + let x_222 : f32 = color.z; + color.z = (x_222 + f32(x_219)); + let x_226 : f32 = uv.x; + let x_228 : f32 = uv.y; + if ((abs((x_226 - x_228)) < 0.25)) { + let x_235 : i32 = obj.numbers[9]; + let x_238 : f32 = color.x; + color.x = (x_238 + f32(x_235)); + } + let x_241 : vec3 = color; + let x_242 : vec3 = normalize(x_241); + frag_color = vec4(x_242.x, x_242.y, x_242.z, 1.0); + let x_247 : vec4 = x_GLF_pos; + gl_Position = x_247; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl new file mode 100644 index 0000000000..b0ecbc43da --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl @@ -0,0 +1,276 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(0)]] var x_33 : buf0; + +[[group(0), binding(1)]] var x_36 : buf1; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_250 : i32 = *(i); + let x_252 : i32 = obj.numbers[x_250]; + temp = x_252; + let x_253 : i32 = *(i); + let x_254 : i32 = *(j); + let x_256 : i32 = obj.numbers[x_254]; + obj.numbers[x_253] = x_256; + let x_258 : i32 = *(j); + let x_259 : i32 = temp; + obj.numbers[x_258] = x_259; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_262 : i32 = *(h); + let x_264 : i32 = obj.numbers[x_262]; + pivot = x_264; + let x_265 : i32 = *(l); + i_1 = (x_265 - 1); + let x_267 : i32 = *(l); + j_1 = x_267; + loop { + let x_272 : i32 = j_1; + let x_273 : i32 = *(h); + if ((x_272 <= (x_273 - 1))) { + } else { + break; + } + let x_277 : i32 = j_1; + let x_279 : i32 = obj.numbers[x_277]; + let x_280 : i32 = pivot; + if ((x_279 <= x_280)) { + let x_284 : i32 = i_1; + i_1 = (x_284 + 1); + let x_286 : i32 = i_1; + param = x_286; + let x_287 : i32 = j_1; + param_1 = x_287; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_289 : i32 = j_1; + j_1 = (x_289 + 1); + } + } + let x_291 : i32 = i_1; + param_2 = (x_291 + 1); + let x_293 : i32 = *(h); + param_3 = x_293; + swap_i1_i1_(&(param_2), &(param_3)); + let x_295 : i32 = i_1; + return (x_295 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_298 : i32 = top; + let x_299 : i32 = (x_298 + 1); + top = x_299; + let x_300 : i32 = l_1; + stack[x_299] = x_300; + let x_302 : i32 = top; + let x_303 : i32 = (x_302 + 1); + top = x_303; + let x_304 : i32 = h_1; + stack[x_303] = x_304; + loop { + let x_310 : i32 = top; + if ((x_310 >= 0)) { + } else { + break; + } + let x_313 : i32 = top; + top = (x_313 - 1); + let x_316 : i32 = stack[x_313]; + h_1 = x_316; + let x_317 : i32 = top; + top = (x_317 - 1); + let x_320 : i32 = stack[x_317]; + l_1 = x_320; + let x_321 : i32 = l_1; + param_4 = x_321; + let x_322 : i32 = h_1; + param_5 = x_322; + let x_323 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_323; + let x_324 : i32 = p; + let x_326 : i32 = l_1; + if (((x_324 - 1) > x_326)) { + let x_330 : i32 = top; + let x_331 : i32 = (x_330 + 1); + top = x_331; + let x_332 : i32 = l_1; + stack[x_331] = x_332; + let x_334 : i32 = top; + let x_335 : i32 = (x_334 + 1); + top = x_335; + let x_336 : i32 = p; + stack[x_335] = (x_336 - 1); + } + let x_339 : i32 = p; + let x_341 : i32 = h_1; + if (((x_339 + 1) < x_341)) { + let x_345 : i32 = top; + let x_346 : i32 = (x_345 + 1); + top = x_346; + let x_347 : i32 = p; + stack[x_346] = (x_347 + 1); + let x_350 : i32 = top; + let x_351 : i32 = (x_350 + 1); + top = x_351; + let x_352 : i32 = h_1; + stack[x_351] = x_352; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_94 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_94 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_101 : i32 = i_2; + if ((x_101 < 10)) { + } else { + break; + } + let x_104 : i32 = i_2; + let x_105 : i32 = i_2; + obj.numbers[x_104] = (10 - x_105); + let x_109 : f32 = x_33.injectionSwitch.x; + let x_111 : f32 = x_33.injectionSwitch.y; + if ((x_109 > x_111)) { + break; + } + let x_115 : i32 = i_2; + let x_116 : i32 = i_2; + let x_118 : i32 = obj.numbers[x_116]; + let x_119 : i32 = i_2; + let x_121 : i32 = obj.numbers[x_119]; + obj.numbers[x_115] = (x_118 * x_121); + + continuing { + let x_124 : i32 = i_2; + i_2 = (x_124 + 1); + } + } + quicksort_(); + let x_127 : vec4 = x_GLF_FragCoord; + let x_130 : vec2 = x_36.resolution; + uv = (vec2(x_127.x, x_127.y) / x_130); + color = vec3(1.0, 2.0, 3.0); + let x_133 : i32 = obj.numbers[0]; + let x_136 : f32 = color.x; + color.x = (x_136 + f32(x_133)); + let x_140 : f32 = uv.x; + if ((x_140 > 0.25)) { + let x_145 : i32 = obj.numbers[1]; + let x_148 : f32 = color.x; + color.x = (x_148 + f32(x_145)); + } + let x_152 : f32 = uv.x; + if ((x_152 > 0.5)) { + let x_157 : i32 = obj.numbers[2]; + let x_160 : f32 = color.y; + color.y = (x_160 + f32(x_157)); + } + let x_164 : f32 = uv.x; + if ((x_164 > 0.75)) { + let x_169 : i32 = obj.numbers[3]; + let x_172 : f32 = color.z; + color.z = (x_172 + f32(x_169)); + } + let x_176 : i32 = obj.numbers[4]; + let x_179 : f32 = color.y; + color.y = (x_179 + f32(x_176)); + let x_183 : f32 = uv.y; + if ((x_183 > 0.25)) { + let x_188 : i32 = obj.numbers[5]; + let x_191 : f32 = color.x; + color.x = (x_191 + f32(x_188)); + } + let x_195 : f32 = uv.y; + if ((x_195 > 0.5)) { + let x_200 : i32 = obj.numbers[6]; + let x_203 : f32 = color.y; + color.y = (x_203 + f32(x_200)); + } + let x_207 : f32 = uv.y; + if ((x_207 > 0.75)) { + let x_212 : i32 = obj.numbers[7]; + let x_215 : f32 = color.z; + color.z = (x_215 + f32(x_212)); + } + let x_219 : i32 = obj.numbers[8]; + let x_222 : f32 = color.z; + color.z = (x_222 + f32(x_219)); + let x_226 : f32 = uv.x; + let x_228 : f32 = uv.y; + if ((abs((x_226 - x_228)) < 0.25)) { + let x_235 : i32 = obj.numbers[9]; + let x_238 : f32 = color.x; + color.x = (x_238 + f32(x_235)); + } + let x_241 : vec3 = color; + let x_242 : vec3 = normalize(x_241); + frag_color = vec4(x_242.x, x_242.y, x_242.z, 1.0); + let x_247 : vec4 = x_GLF_pos; + gl_Position = x_247; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..017bbe6300 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.hlsl @@ -0,0 +1,227 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_33 : register(b0, space0) { + uint4 x_33[1]; +}; +cbuffer cbuffer_x_36 : register(b1, space0) { + uint4 x_36[1]; +}; +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_250 = i; + const int x_252 = obj.numbers[x_250]; + temp = x_252; + const int x_253 = i; + const int x_254 = j; + const int x_256 = obj.numbers[x_254]; + obj.numbers[x_253] = x_256; + const int x_258 = j; + obj.numbers[x_258] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_262 = h; + const int x_264 = obj.numbers[x_262]; + pivot = x_264; + const int x_265 = l; + i_1 = (x_265 - 1); + const int x_267 = l; + j_1 = x_267; + while (true) { + const int x_272 = j_1; + const int x_273 = h; + if ((x_272 <= (x_273 - 1))) { + } else { + break; + } + const int x_279 = obj.numbers[j_1]; + if ((x_279 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + param_2 = (i_1 + 1); + const int x_293 = h; + param_3 = x_293; + swap_i1_i1_(param_2, param_3); + return (i_1 + 1); +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_299 = (top + 1); + top = x_299; + stack[x_299] = l_1; + const int x_303 = (top + 1); + top = x_303; + stack[x_303] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_313 = top; + top = (x_313 - 1); + const int x_316 = stack[x_313]; + h_1 = x_316; + const int x_317 = top; + top = (x_317 - 1); + const int x_320 = stack[x_317]; + l_1 = x_320; + param_4 = l_1; + param_5 = h_1; + const int x_323 = performPartition_i1_i1_(param_4, param_5); + p = x_323; + if (((p - 1) > l_1)) { + const int x_331 = (top + 1); + top = x_331; + stack[x_331] = l_1; + const int x_335 = (top + 1); + top = x_335; + stack[x_335] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_346 = (top + 1); + top = x_346; + stack[x_346] = (p + 1); + const int x_351 = (top + 1); + top = x_351; + stack[x_351] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const float x_109 = asfloat(x_33[0].x); + const float x_111 = asfloat(x_33[0].y); + if ((x_109 > x_111)) { + break; + } + const int x_115 = i_2; + const int x_118 = obj.numbers[i_2]; + const int x_121 = obj.numbers[i_2]; + obj.numbers[x_115] = (x_118 * x_121); + } + } + quicksort_(); + const float4 x_127 = x_GLF_FragCoord; + const float2 x_130 = asfloat(x_36[0].xy); + uv = (float2(x_127.x, x_127.y) / x_130); + color = float3(1.0f, 2.0f, 3.0f); + const int x_133 = obj.numbers[0]; + const float x_136 = color.x; + color.x = (x_136 + float(x_133)); + const float x_140 = uv.x; + if ((x_140 > 0.25f)) { + const int x_145 = obj.numbers[1]; + const float x_148 = color.x; + color.x = (x_148 + float(x_145)); + } + const float x_152 = uv.x; + if ((x_152 > 0.5f)) { + const int x_157 = obj.numbers[2]; + const float x_160 = color.y; + color.y = (x_160 + float(x_157)); + } + const float x_164 = uv.x; + if ((x_164 > 0.75f)) { + const int x_169 = obj.numbers[3]; + const float x_172 = color.z; + color.z = (x_172 + float(x_169)); + } + const int x_176 = obj.numbers[4]; + const float x_179 = color.y; + color.y = (x_179 + float(x_176)); + const float x_183 = uv.y; + if ((x_183 > 0.25f)) { + const int x_188 = obj.numbers[5]; + const float x_191 = color.x; + color.x = (x_191 + float(x_188)); + } + const float x_195 = uv.y; + if ((x_195 > 0.5f)) { + const int x_200 = obj.numbers[6]; + const float x_203 = color.y; + color.y = (x_203 + float(x_200)); + } + const float x_207 = uv.y; + if ((x_207 > 0.75f)) { + const int x_212 = obj.numbers[7]; + const float x_215 = color.z; + color.z = (x_215 + float(x_212)); + } + const int x_219 = obj.numbers[8]; + const float x_222 = color.z; + color.z = (x_222 + float(x_219)); + const float x_226 = uv.x; + const float x_228 = uv.y; + if ((abs((x_226 - x_228)) < 0.25f)) { + const int x_235 = obj.numbers[9]; + const float x_238 = color.x; + color.x = (x_238 + float(x_235)); + } + const float3 x_242 = normalize(color); + frag_color = float4(x_242.x, x_242.y, x_242.z, 1.0f); + gl_Position = x_GLF_pos; + return; +} + +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 x_GLF_pos_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_GLF_pos_param = tint_symbol.x_GLF_pos_param; + x_GLF_pos = x_GLF_pos_param; + main_1(); + const main_out tint_symbol_3 = {frag_color, gl_Position}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.msl new file mode 100644 index 0000000000..fae0fc6dcb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.msl @@ -0,0 +1,274 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_pos_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_6) { + int temp = 0; + int const x_250 = *(i); + int const x_252 = (*(tint_symbol_6)).numbers.arr[x_250]; + temp = x_252; + int const x_253 = *(i); + int const x_254 = *(j); + int const x_256 = (*(tint_symbol_6)).numbers.arr[x_254]; + (*(tint_symbol_6)).numbers.arr[x_253] = x_256; + int const x_258 = *(j); + int const x_259 = temp; + (*(tint_symbol_6)).numbers.arr[x_258] = x_259; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_7) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_262 = *(h); + int const x_264 = (*(tint_symbol_7)).numbers.arr[x_262]; + pivot = x_264; + int const x_265 = *(l); + i_1 = (x_265 - 1); + int const x_267 = *(l); + j_1 = x_267; + while (true) { + int const x_272 = j_1; + int const x_273 = *(h); + if ((x_272 <= (x_273 - 1))) { + } else { + break; + } + int const x_277 = j_1; + int const x_279 = (*(tint_symbol_7)).numbers.arr[x_277]; + int const x_280 = pivot; + if ((x_279 <= x_280)) { + int const x_284 = i_1; + i_1 = (x_284 + 1); + int const x_286 = i_1; + param = x_286; + int const x_287 = j_1; + param_1 = x_287; + swap_i1_i1_(&(param), &(param_1), tint_symbol_7); + } + { + int const x_289 = j_1; + j_1 = (x_289 + 1); + } + } + int const x_291 = i_1; + param_2 = (x_291 + 1); + int const x_293 = *(h); + param_3 = x_293; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_7); + int const x_295 = i_1; + return (x_295 + 1); +} + +void quicksort_(thread QuicksortObject* const tint_symbol_8) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_298 = top; + int const x_299 = (x_298 + 1); + top = x_299; + int const x_300 = l_1; + stack.arr[x_299] = x_300; + int const x_302 = top; + int const x_303 = (x_302 + 1); + top = x_303; + int const x_304 = h_1; + stack.arr[x_303] = x_304; + while (true) { + int const x_310 = top; + if ((x_310 >= 0)) { + } else { + break; + } + int const x_313 = top; + top = (x_313 - 1); + int const x_316 = stack.arr[x_313]; + h_1 = x_316; + int const x_317 = top; + top = (x_317 - 1); + int const x_320 = stack.arr[x_317]; + l_1 = x_320; + int const x_321 = l_1; + param_4 = x_321; + int const x_322 = h_1; + param_5 = x_322; + int const x_323 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_8); + p = x_323; + int const x_324 = p; + int const x_326 = l_1; + if (((x_324 - 1) > x_326)) { + int const x_330 = top; + int const x_331 = (x_330 + 1); + top = x_331; + int const x_332 = l_1; + stack.arr[x_331] = x_332; + int const x_334 = top; + int const x_335 = (x_334 + 1); + top = x_335; + int const x_336 = p; + stack.arr[x_335] = (x_336 - 1); + } + int const x_339 = p; + int const x_341 = h_1; + if (((x_339 + 1) < x_341)) { + int const x_345 = top; + int const x_346 = (x_345 + 1); + top = x_346; + int const x_347 = p; + stack.arr[x_346] = (x_347 + 1); + int const x_350 = top; + int const x_351 = (x_350 + 1); + top = x_351; + int const x_352 = h_1; + stack.arr[x_351] = x_352; + } + } + return; +} + +void main_1(constant buf0& x_33, constant buf1& x_36, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10, thread QuicksortObject* const tint_symbol_11, thread float4* const tint_symbol_12, thread float4* const tint_symbol_13) { + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + float4 const x_94 = *(tint_symbol_9); + *(tint_symbol_10) = ((x_94 + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + while (true) { + int const x_101 = i_2; + if ((x_101 < 10)) { + } else { + break; + } + int const x_104 = i_2; + int const x_105 = i_2; + (*(tint_symbol_11)).numbers.arr[x_104] = (10 - x_105); + float const x_109 = x_33.injectionSwitch.x; + float const x_111 = x_33.injectionSwitch.y; + if ((x_109 > x_111)) { + break; + } + int const x_115 = i_2; + int const x_116 = i_2; + int const x_118 = (*(tint_symbol_11)).numbers.arr[x_116]; + int const x_119 = i_2; + int const x_121 = (*(tint_symbol_11)).numbers.arr[x_119]; + (*(tint_symbol_11)).numbers.arr[x_115] = (x_118 * x_121); + { + int const x_124 = i_2; + i_2 = (x_124 + 1); + } + } + quicksort_(tint_symbol_11); + float4 const x_127 = *(tint_symbol_10); + float2 const x_130 = x_36.resolution; + uv = (float2(x_127.x, x_127.y) / x_130); + color = float3(1.0f, 2.0f, 3.0f); + int const x_133 = (*(tint_symbol_11)).numbers.arr[0]; + float const x_136 = color.x; + color.x = (x_136 + float(x_133)); + float const x_140 = uv.x; + if ((x_140 > 0.25f)) { + int const x_145 = (*(tint_symbol_11)).numbers.arr[1]; + float const x_148 = color.x; + color.x = (x_148 + float(x_145)); + } + float const x_152 = uv.x; + if ((x_152 > 0.5f)) { + int const x_157 = (*(tint_symbol_11)).numbers.arr[2]; + float const x_160 = color.y; + color.y = (x_160 + float(x_157)); + } + float const x_164 = uv.x; + if ((x_164 > 0.75f)) { + int const x_169 = (*(tint_symbol_11)).numbers.arr[3]; + float const x_172 = color.z; + color.z = (x_172 + float(x_169)); + } + int const x_176 = (*(tint_symbol_11)).numbers.arr[4]; + float const x_179 = color.y; + color.y = (x_179 + float(x_176)); + float const x_183 = uv.y; + if ((x_183 > 0.25f)) { + int const x_188 = (*(tint_symbol_11)).numbers.arr[5]; + float const x_191 = color.x; + color.x = (x_191 + float(x_188)); + } + float const x_195 = uv.y; + if ((x_195 > 0.5f)) { + int const x_200 = (*(tint_symbol_11)).numbers.arr[6]; + float const x_203 = color.y; + color.y = (x_203 + float(x_200)); + } + float const x_207 = uv.y; + if ((x_207 > 0.75f)) { + int const x_212 = (*(tint_symbol_11)).numbers.arr[7]; + float const x_215 = color.z; + color.z = (x_215 + float(x_212)); + } + int const x_219 = (*(tint_symbol_11)).numbers.arr[8]; + float const x_222 = color.z; + color.z = (x_222 + float(x_219)); + float const x_226 = uv.x; + float const x_228 = uv.y; + if ((fabs((x_226 - x_228)) < 0.25f)) { + int const x_235 = (*(tint_symbol_11)).numbers.arr[9]; + float const x_238 = color.x; + color.x = (x_238 + float(x_235)); + } + float3 const x_241 = color; + float3 const x_242 = normalize(x_241); + *(tint_symbol_12) = float4(x_242.x, x_242.y, x_242.z, 1.0f); + float4 const x_247 = *(tint_symbol_9); + *(tint_symbol_13) = x_247; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant buf0& x_33 [[buffer(0)]], constant buf1& x_36 [[buffer(1)]]) { + thread float4 tint_symbol_14 = 0.0f; + thread float4 tint_symbol_15 = 0.0f; + thread QuicksortObject tint_symbol_16 = {}; + thread float4 tint_symbol_17 = 0.0f; + thread float4 tint_symbol_18 = 0.0f; + float4 const x_GLF_pos_param = tint_symbol_1.x_GLF_pos_param; + tint_symbol_14 = x_GLF_pos_param; + main_1(x_33, x_36, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_16), &(tint_symbol_17), &(tint_symbol_18)); + main_out const tint_symbol_4 = {.frag_color_1=tint_symbol_17, .gl_Position=tint_symbol_18}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..e0c2ca0e5c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.spvasm @@ -0,0 +1,589 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 401 +; Schema: 0 + OpCapability Shader + %367 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %x_GLF_FragCoord "x_GLF_FragCoord" + OpName %x_GLF_pos "x_GLF_pos" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_33 "x_33" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_36 "x_36" + OpName %frag_color "frag_color" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "frag_color_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_33 NonWritable + OpDecorate %x_33 DescriptorSet 0 + OpDecorate %x_33 Binding 0 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_36 NonWritable + OpDecorate %x_36 DescriptorSet 0 + OpDecorate %x_36 Binding 1 + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_3 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %12 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private %16 + %x_GLF_pos = OpVariable %_ptr_Private_v4float Private %16 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_33 = OpVariable %_ptr_Uniform_buf0 Uniform + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_36 = OpVariable %_ptr_Uniform_buf1 Uniform + %frag_color = OpVariable %_ptr_Private_v4float Private %16 +%gl_Position = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %16 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %32 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %40 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %58 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %118 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %126 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %198 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %202 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %206 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %209 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_10 = OpConstant %int 10 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %256 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float %v4float + %386 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %32 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %38 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %40 + %42 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + %46 = OpLoad %int %45 + OpStore %temp %46 + %48 = OpLoad %int %i + %50 = OpLoad %int %j + %51 = OpAccessChain %_ptr_Private_int %obj %uint_0 %50 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 + OpStore %53 %52 + %55 = OpLoad %int %j + %56 = OpLoad %int %temp + %57 = OpAccessChain %_ptr_Private_int %obj %uint_0 %55 + OpStore %57 %56 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %58 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %62 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %40 + %i_1 = OpVariable %_ptr_Function_int Function %40 + %j_1 = OpVariable %_ptr_Function_int Function %40 + %param = OpVariable %_ptr_Function_int Function %40 + %param_1 = OpVariable %_ptr_Function_int Function %40 + %param_2 = OpVariable %_ptr_Function_int Function %40 + %param_3 = OpVariable %_ptr_Function_int Function %40 + %71 = OpLoad %int %h + %72 = OpAccessChain %_ptr_Private_int %obj %uint_0 %71 + %73 = OpLoad %int %72 + OpStore %pivot %73 + %75 = OpLoad %int %l + %77 = OpISub %int %75 %int_1 + OpStore %i_1 %77 + %79 = OpLoad %int %l + OpStore %j_1 %79 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %int %j_1 + %86 = OpLoad %int %h + %87 = OpISub %int %86 %int_1 + %88 = OpSLessThanEqual %bool %84 %87 + OpSelectionMerge %90 None + OpBranchConditional %88 %91 %92 + %91 = OpLabel + OpBranch %90 + %92 = OpLabel + OpBranch %81 + %90 = OpLabel + %93 = OpLoad %int %j_1 + %94 = OpAccessChain %_ptr_Private_int %obj %uint_0 %93 + %95 = OpLoad %int %94 + %96 = OpLoad %int %pivot + %97 = OpSLessThanEqual %bool %95 %96 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpLoad %int %i_1 + %101 = OpIAdd %int %100 %int_1 + OpStore %i_1 %101 + %102 = OpLoad %int %i_1 + OpStore %param %102 + %103 = OpLoad %int %j_1 + OpStore %param_1 %103 + %104 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %98 + %98 = OpLabel + OpBranch %82 + %82 = OpLabel + %107 = OpLoad %int %j_1 + %108 = OpIAdd %int %107 %int_1 + OpStore %j_1 %108 + OpBranch %80 + %81 = OpLabel + %109 = OpLoad %int %i_1 + %110 = OpIAdd %int %109 %int_1 + OpStore %param_2 %110 + %112 = OpLoad %int %h + OpStore %param_3 %112 + %113 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %116 = OpLoad %int %i_1 + %117 = OpIAdd %int %116 %int_1 + OpReturnValue %117 + OpFunctionEnd + %quicksort_ = OpFunction %void None %118 + %120 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %40 + %h_1 = OpVariable %_ptr_Function_int Function %40 + %top = OpVariable %_ptr_Function_int Function %40 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %126 + %p = OpVariable %_ptr_Function_int Function %40 + %param_4 = OpVariable %_ptr_Function_int Function %40 + %param_5 = OpVariable %_ptr_Function_int Function %40 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %133 = OpLoad %int %top + %134 = OpIAdd %int %133 %int_1 + OpStore %top %134 + %135 = OpLoad %int %l_1 + %136 = OpAccessChain %_ptr_Function_int %stack %134 + OpStore %136 %135 + %137 = OpLoad %int %top + %138 = OpIAdd %int %137 %int_1 + OpStore %top %138 + %139 = OpLoad %int %h_1 + %140 = OpAccessChain %_ptr_Function_int %stack %138 + OpStore %140 %139 + OpBranch %141 + %141 = OpLabel + OpLoopMerge %142 %143 None + OpBranch %144 + %144 = OpLabel + %145 = OpLoad %int %top + %146 = OpSGreaterThanEqual %bool %145 %int_0 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %149 + %148 = OpLabel + OpBranch %147 + %149 = OpLabel + OpBranch %142 + %147 = OpLabel + %150 = OpLoad %int %top + %151 = OpISub %int %150 %int_1 + OpStore %top %151 + %152 = OpAccessChain %_ptr_Function_int %stack %150 + %153 = OpLoad %int %152 + OpStore %h_1 %153 + %154 = OpLoad %int %top + %155 = OpISub %int %154 %int_1 + OpStore %top %155 + %156 = OpAccessChain %_ptr_Function_int %stack %154 + %157 = OpLoad %int %156 + OpStore %l_1 %157 + %158 = OpLoad %int %l_1 + OpStore %param_4 %158 + %159 = OpLoad %int %h_1 + OpStore %param_5 %159 + %160 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %160 + %163 = OpLoad %int %p + %164 = OpLoad %int %l_1 + %165 = OpISub %int %163 %int_1 + %166 = OpSGreaterThan %bool %165 %164 + OpSelectionMerge %167 None + OpBranchConditional %166 %168 %167 + %168 = OpLabel + %169 = OpLoad %int %top + %170 = OpIAdd %int %169 %int_1 + OpStore %top %170 + %171 = OpLoad %int %l_1 + %172 = OpAccessChain %_ptr_Function_int %stack %170 + OpStore %172 %171 + %173 = OpLoad %int %top + %174 = OpIAdd %int %173 %int_1 + OpStore %top %174 + %175 = OpLoad %int %p + %176 = OpAccessChain %_ptr_Function_int %stack %174 + %177 = OpISub %int %175 %int_1 + OpStore %176 %177 + OpBranch %167 + %167 = OpLabel + %178 = OpLoad %int %p + %179 = OpLoad %int %h_1 + %180 = OpIAdd %int %178 %int_1 + %181 = OpSLessThan %bool %180 %179 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %184 = OpLoad %int %top + %185 = OpIAdd %int %184 %int_1 + OpStore %top %185 + %186 = OpLoad %int %p + %187 = OpAccessChain %_ptr_Function_int %stack %185 + %188 = OpIAdd %int %186 %int_1 + OpStore %187 %188 + %189 = OpLoad %int %top + %190 = OpIAdd %int %189 %int_1 + OpStore %top %190 + %191 = OpLoad %int %h_1 + %192 = OpAccessChain %_ptr_Function_int %stack %190 + OpStore %192 %191 + OpBranch %182 + %182 = OpLabel + OpBranch %143 + %143 = OpLabel + OpBranch %141 + %142 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %118 + %194 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %40 + %uv = OpVariable %_ptr_Function_v2float Function %198 + %color = OpVariable %_ptr_Function_v3float Function %202 + %203 = OpLoad %v4float %x_GLF_pos + %207 = OpFAdd %v4float %203 %206 + %210 = OpFMul %v4float %207 %209 + OpStore %x_GLF_FragCoord %210 + OpStore %i_2 %int_0 + OpBranch %211 + %211 = OpLabel + OpLoopMerge %212 %213 None + OpBranch %214 + %214 = OpLabel + %215 = OpLoad %int %i_2 + %217 = OpSLessThan %bool %215 %int_10 + OpSelectionMerge %218 None + OpBranchConditional %217 %219 %220 + %219 = OpLabel + OpBranch %218 + %220 = OpLabel + OpBranch %212 + %218 = OpLabel + %221 = OpLoad %int %i_2 + %222 = OpLoad %int %i_2 + %223 = OpAccessChain %_ptr_Private_int %obj %uint_0 %221 + %224 = OpISub %int %int_10 %222 + OpStore %223 %224 + %226 = OpAccessChain %_ptr_Uniform_float %x_33 %uint_0 %uint_0 + %227 = OpLoad %float %226 + %229 = OpAccessChain %_ptr_Uniform_float %x_33 %uint_0 %uint_1 + %230 = OpLoad %float %229 + %231 = OpFOrdGreaterThan %bool %227 %230 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %232 + %233 = OpLabel + OpBranch %212 + %232 = OpLabel + %234 = OpLoad %int %i_2 + %235 = OpLoad %int %i_2 + %236 = OpAccessChain %_ptr_Private_int %obj %uint_0 %235 + %237 = OpLoad %int %236 + %238 = OpLoad %int %i_2 + %239 = OpAccessChain %_ptr_Private_int %obj %uint_0 %238 + %240 = OpLoad %int %239 + %241 = OpAccessChain %_ptr_Private_int %obj %uint_0 %234 + %242 = OpIMul %int %237 %240 + OpStore %241 %242 + OpBranch %213 + %213 = OpLabel + %243 = OpLoad %int %i_2 + %244 = OpIAdd %int %243 %int_1 + OpStore %i_2 %244 + OpBranch %211 + %212 = OpLabel + %245 = OpFunctionCall %void %quicksort_ + %246 = OpLoad %v4float %x_GLF_FragCoord + %248 = OpAccessChain %_ptr_Uniform_v2float %x_36 %uint_0 + %249 = OpLoad %v2float %248 + %250 = OpCompositeExtract %float %246 0 + %251 = OpCompositeExtract %float %246 1 + %252 = OpCompositeConstruct %v2float %250 %251 + %253 = OpFDiv %v2float %252 %249 + OpStore %uv %253 + OpStore %color %256 + %257 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %258 = OpLoad %int %257 + %260 = OpAccessChain %_ptr_Function_float %color %uint_0 + %261 = OpLoad %float %260 + %262 = OpAccessChain %_ptr_Function_float %color %uint_0 + %263 = OpConvertSToF %float %258 + %264 = OpFAdd %float %261 %263 + OpStore %262 %264 + %265 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %266 = OpLoad %float %265 + %268 = OpFOrdGreaterThan %bool %266 %float_0_25 + OpSelectionMerge %269 None + OpBranchConditional %268 %270 %269 + %270 = OpLabel + %271 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %272 = OpLoad %int %271 + %273 = OpAccessChain %_ptr_Function_float %color %uint_0 + %274 = OpLoad %float %273 + %275 = OpAccessChain %_ptr_Function_float %color %uint_0 + %276 = OpConvertSToF %float %272 + %277 = OpFAdd %float %274 %276 + OpStore %275 %277 + OpBranch %269 + %269 = OpLabel + %278 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %279 = OpLoad %float %278 + %281 = OpFOrdGreaterThan %bool %279 %float_0_5 + OpSelectionMerge %282 None + OpBranchConditional %281 %283 %282 + %283 = OpLabel + %285 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %286 = OpLoad %int %285 + %287 = OpAccessChain %_ptr_Function_float %color %uint_1 + %288 = OpLoad %float %287 + %289 = OpAccessChain %_ptr_Function_float %color %uint_1 + %290 = OpConvertSToF %float %286 + %291 = OpFAdd %float %288 %290 + OpStore %289 %291 + OpBranch %282 + %282 = OpLabel + %292 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %293 = OpLoad %float %292 + %295 = OpFOrdGreaterThan %bool %293 %float_0_75 + OpSelectionMerge %296 None + OpBranchConditional %295 %297 %296 + %297 = OpLabel + %299 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %300 = OpLoad %int %299 + %302 = OpAccessChain %_ptr_Function_float %color %uint_2 + %303 = OpLoad %float %302 + %304 = OpAccessChain %_ptr_Function_float %color %uint_2 + %305 = OpConvertSToF %float %300 + %306 = OpFAdd %float %303 %305 + OpStore %304 %306 + OpBranch %296 + %296 = OpLabel + %308 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %309 = OpLoad %int %308 + %310 = OpAccessChain %_ptr_Function_float %color %uint_1 + %311 = OpLoad %float %310 + %312 = OpAccessChain %_ptr_Function_float %color %uint_1 + %313 = OpConvertSToF %float %309 + %314 = OpFAdd %float %311 %313 + OpStore %312 %314 + %315 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %316 = OpLoad %float %315 + %317 = OpFOrdGreaterThan %bool %316 %float_0_25 + OpSelectionMerge %318 None + OpBranchConditional %317 %319 %318 + %319 = OpLabel + %321 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %322 = OpLoad %int %321 + %323 = OpAccessChain %_ptr_Function_float %color %uint_0 + %324 = OpLoad %float %323 + %325 = OpAccessChain %_ptr_Function_float %color %uint_0 + %326 = OpConvertSToF %float %322 + %327 = OpFAdd %float %324 %326 + OpStore %325 %327 + OpBranch %318 + %318 = OpLabel + %328 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %329 = OpLoad %float %328 + %330 = OpFOrdGreaterThan %bool %329 %float_0_5 + OpSelectionMerge %331 None + OpBranchConditional %330 %332 %331 + %332 = OpLabel + %334 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %335 = OpLoad %int %334 + %336 = OpAccessChain %_ptr_Function_float %color %uint_1 + %337 = OpLoad %float %336 + %338 = OpAccessChain %_ptr_Function_float %color %uint_1 + %339 = OpConvertSToF %float %335 + %340 = OpFAdd %float %337 %339 + OpStore %338 %340 + OpBranch %331 + %331 = OpLabel + %341 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %342 = OpLoad %float %341 + %343 = OpFOrdGreaterThan %bool %342 %float_0_75 + OpSelectionMerge %344 None + OpBranchConditional %343 %345 %344 + %345 = OpLabel + %347 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %348 = OpLoad %int %347 + %349 = OpAccessChain %_ptr_Function_float %color %uint_2 + %350 = OpLoad %float %349 + %351 = OpAccessChain %_ptr_Function_float %color %uint_2 + %352 = OpConvertSToF %float %348 + %353 = OpFAdd %float %350 %352 + OpStore %351 %353 + OpBranch %344 + %344 = OpLabel + %355 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %356 = OpLoad %int %355 + %357 = OpAccessChain %_ptr_Function_float %color %uint_2 + %358 = OpLoad %float %357 + %359 = OpAccessChain %_ptr_Function_float %color %uint_2 + %360 = OpConvertSToF %float %356 + %361 = OpFAdd %float %358 %360 + OpStore %359 %361 + %362 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %363 = OpLoad %float %362 + %364 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %365 = OpLoad %float %364 + %368 = OpFSub %float %363 %365 + %366 = OpExtInst %float %367 FAbs %368 + %369 = OpFOrdLessThan %bool %366 %float_0_25 + OpSelectionMerge %370 None + OpBranchConditional %369 %371 %370 + %371 = OpLabel + %372 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %373 = OpLoad %int %372 + %374 = OpAccessChain %_ptr_Function_float %color %uint_0 + %375 = OpLoad %float %374 + %376 = OpAccessChain %_ptr_Function_float %color %uint_0 + %377 = OpConvertSToF %float %373 + %378 = OpFAdd %float %375 %377 + OpStore %376 %378 + OpBranch %370 + %370 = OpLabel + %379 = OpLoad %v3float %color + %380 = OpExtInst %v3float %367 Normalize %379 + %381 = OpCompositeExtract %float %380 0 + %382 = OpCompositeExtract %float %380 1 + %383 = OpCompositeExtract %float %380 2 + %384 = OpCompositeConstruct %v4float %381 %382 %383 %float_1 + OpStore %frag_color %384 + %385 = OpLoad %v4float %x_GLF_pos + OpStore %gl_Position %385 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %386 +%tint_symbol_1 = OpFunctionParameter %main_out + %390 = OpLabel + %391 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %391 + %392 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %392 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %118 + %394 = OpLabel + OpStore %tint_pointsize %float_1 + %395 = OpLoad %v4float %tint_symbol + OpStore %x_GLF_pos %395 + %396 = OpFunctionCall %void %main_1 + %398 = OpLoad %v4float %frag_color + %399 = OpLoad %v4float %gl_Position + %400 = OpCompositeConstruct %main_out %398 %399 + %397 = OpFunctionCall %void %tint_symbol_4 %400 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b0ecbc43da --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.wgsl @@ -0,0 +1,276 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(0)]] var x_33 : buf0; + +[[group(0), binding(1)]] var x_36 : buf1; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_250 : i32 = *(i); + let x_252 : i32 = obj.numbers[x_250]; + temp = x_252; + let x_253 : i32 = *(i); + let x_254 : i32 = *(j); + let x_256 : i32 = obj.numbers[x_254]; + obj.numbers[x_253] = x_256; + let x_258 : i32 = *(j); + let x_259 : i32 = temp; + obj.numbers[x_258] = x_259; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_262 : i32 = *(h); + let x_264 : i32 = obj.numbers[x_262]; + pivot = x_264; + let x_265 : i32 = *(l); + i_1 = (x_265 - 1); + let x_267 : i32 = *(l); + j_1 = x_267; + loop { + let x_272 : i32 = j_1; + let x_273 : i32 = *(h); + if ((x_272 <= (x_273 - 1))) { + } else { + break; + } + let x_277 : i32 = j_1; + let x_279 : i32 = obj.numbers[x_277]; + let x_280 : i32 = pivot; + if ((x_279 <= x_280)) { + let x_284 : i32 = i_1; + i_1 = (x_284 + 1); + let x_286 : i32 = i_1; + param = x_286; + let x_287 : i32 = j_1; + param_1 = x_287; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_289 : i32 = j_1; + j_1 = (x_289 + 1); + } + } + let x_291 : i32 = i_1; + param_2 = (x_291 + 1); + let x_293 : i32 = *(h); + param_3 = x_293; + swap_i1_i1_(&(param_2), &(param_3)); + let x_295 : i32 = i_1; + return (x_295 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_298 : i32 = top; + let x_299 : i32 = (x_298 + 1); + top = x_299; + let x_300 : i32 = l_1; + stack[x_299] = x_300; + let x_302 : i32 = top; + let x_303 : i32 = (x_302 + 1); + top = x_303; + let x_304 : i32 = h_1; + stack[x_303] = x_304; + loop { + let x_310 : i32 = top; + if ((x_310 >= 0)) { + } else { + break; + } + let x_313 : i32 = top; + top = (x_313 - 1); + let x_316 : i32 = stack[x_313]; + h_1 = x_316; + let x_317 : i32 = top; + top = (x_317 - 1); + let x_320 : i32 = stack[x_317]; + l_1 = x_320; + let x_321 : i32 = l_1; + param_4 = x_321; + let x_322 : i32 = h_1; + param_5 = x_322; + let x_323 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_323; + let x_324 : i32 = p; + let x_326 : i32 = l_1; + if (((x_324 - 1) > x_326)) { + let x_330 : i32 = top; + let x_331 : i32 = (x_330 + 1); + top = x_331; + let x_332 : i32 = l_1; + stack[x_331] = x_332; + let x_334 : i32 = top; + let x_335 : i32 = (x_334 + 1); + top = x_335; + let x_336 : i32 = p; + stack[x_335] = (x_336 - 1); + } + let x_339 : i32 = p; + let x_341 : i32 = h_1; + if (((x_339 + 1) < x_341)) { + let x_345 : i32 = top; + let x_346 : i32 = (x_345 + 1); + top = x_346; + let x_347 : i32 = p; + stack[x_346] = (x_347 + 1); + let x_350 : i32 = top; + let x_351 : i32 = (x_350 + 1); + top = x_351; + let x_352 : i32 = h_1; + stack[x_351] = x_352; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_94 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_94 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_101 : i32 = i_2; + if ((x_101 < 10)) { + } else { + break; + } + let x_104 : i32 = i_2; + let x_105 : i32 = i_2; + obj.numbers[x_104] = (10 - x_105); + let x_109 : f32 = x_33.injectionSwitch.x; + let x_111 : f32 = x_33.injectionSwitch.y; + if ((x_109 > x_111)) { + break; + } + let x_115 : i32 = i_2; + let x_116 : i32 = i_2; + let x_118 : i32 = obj.numbers[x_116]; + let x_119 : i32 = i_2; + let x_121 : i32 = obj.numbers[x_119]; + obj.numbers[x_115] = (x_118 * x_121); + + continuing { + let x_124 : i32 = i_2; + i_2 = (x_124 + 1); + } + } + quicksort_(); + let x_127 : vec4 = x_GLF_FragCoord; + let x_130 : vec2 = x_36.resolution; + uv = (vec2(x_127.x, x_127.y) / x_130); + color = vec3(1.0, 2.0, 3.0); + let x_133 : i32 = obj.numbers[0]; + let x_136 : f32 = color.x; + color.x = (x_136 + f32(x_133)); + let x_140 : f32 = uv.x; + if ((x_140 > 0.25)) { + let x_145 : i32 = obj.numbers[1]; + let x_148 : f32 = color.x; + color.x = (x_148 + f32(x_145)); + } + let x_152 : f32 = uv.x; + if ((x_152 > 0.5)) { + let x_157 : i32 = obj.numbers[2]; + let x_160 : f32 = color.y; + color.y = (x_160 + f32(x_157)); + } + let x_164 : f32 = uv.x; + if ((x_164 > 0.75)) { + let x_169 : i32 = obj.numbers[3]; + let x_172 : f32 = color.z; + color.z = (x_172 + f32(x_169)); + } + let x_176 : i32 = obj.numbers[4]; + let x_179 : f32 = color.y; + color.y = (x_179 + f32(x_176)); + let x_183 : f32 = uv.y; + if ((x_183 > 0.25)) { + let x_188 : i32 = obj.numbers[5]; + let x_191 : f32 = color.x; + color.x = (x_191 + f32(x_188)); + } + let x_195 : f32 = uv.y; + if ((x_195 > 0.5)) { + let x_200 : i32 = obj.numbers[6]; + let x_203 : f32 = color.y; + color.y = (x_203 + f32(x_200)); + } + let x_207 : f32 = uv.y; + if ((x_207 > 0.75)) { + let x_212 : i32 = obj.numbers[7]; + let x_215 : f32 = color.z; + color.z = (x_215 + f32(x_212)); + } + let x_219 : i32 = obj.numbers[8]; + let x_222 : f32 = color.z; + color.z = (x_222 + f32(x_219)); + let x_226 : f32 = uv.x; + let x_228 : f32 = uv.y; + if ((abs((x_226 - x_228)) < 0.25)) { + let x_235 : i32 = obj.numbers[9]; + let x_238 : f32 = color.x; + color.x = (x_238 + f32(x_235)); + } + let x_241 : vec3 = color; + let x_242 : vec3 = normalize(x_241); + frag_color = vec4(x_242.x, x_242.y, x_242.z, 1.0); + let x_247 : vec4 = x_GLF_pos; + gl_Position = x_247; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm new file mode 100644 index 0000000000..fa20c31762 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm @@ -0,0 +1,689 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_GLF_pos %frag_color %__0 + OpSource ESSL 310 + OpName %main "main" + OpName %swap_i1_i1_ "swap(i1;i1;" + OpName %i "i" + OpName %j "j" + OpName %performPartition_i1_i1_ "performPartition(i1;i1;" + OpName %l "l" + OpName %h "h" + OpName %quicksort_ "quicksort(" + OpName %temp "temp" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %pivot "pivot" + OpName %i_0 "i" + OpName %j_0 "j" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %l_0 "l" + OpName %h_0 "h" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %_GLF_FragCoord "_GLF_FragCoord" + OpName %_GLF_pos "_GLF_pos" + OpName %i_1 "i" + OpName %uv "uv" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %color "color" + OpName %frag_color "frag_color" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpName %__0 "" + OpDecorate %_GLF_pos Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %frag_color Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %38 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %41 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %42 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float +%_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private +%_ptr_Input_v4float = OpTypePointer Input %v4float + %_GLF_pos = OpVariable %_ptr_Input_v4float Input + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %60 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %62 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_10 = OpConstant %int 10 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %72 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %frag_color = OpVariable %_ptr_Output_v4float Output +%gl_PerVertex = OpTypeStruct %v4float %float +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output + %main = OpFunction %void None %38 + %89 = OpLabel + %90 = OpVariable %_ptr_Function_int Function + %91 = OpVariable %_ptr_Function_int Function + %92 = OpVariable %_ptr_Function_int Function + %93 = OpVariable %_ptr_Function_int Function + %94 = OpVariable %_ptr_Function_int Function + %95 = OpVariable %_ptr_Function_int Function + %96 = OpVariable %_ptr_Function_int Function + %97 = OpVariable %_ptr_Function_int Function + %98 = OpVariable %_ptr_Function_int Function + %99 = OpVariable %_ptr_Function_int Function + %100 = OpVariable %_ptr_Function_int Function + %101 = OpVariable %_ptr_Function_int Function + %102 = OpVariable %_ptr_Function_int Function + %103 = OpVariable %_ptr_Function__arr_int_uint_10 Function + %104 = OpVariable %_ptr_Function_int Function + %105 = OpVariable %_ptr_Function_int Function + %106 = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %uv = OpVariable %_ptr_Function_v2float Function + %color = OpVariable %_ptr_Function_v3float Function + %107 = OpLoad %v4float %_GLF_pos + %108 = OpFAdd %v4float %107 %60 + %109 = OpFMul %v4float %108 %62 + OpStore %_GLF_FragCoord %109 + OpStore %i_1 %int_0 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %int %i_1 + %115 = OpSLessThan %bool %114 %int_10 + OpBranchConditional %115 %116 %111 + %116 = OpLabel + %117 = OpLoad %int %i_1 + %118 = OpLoad %int %i_1 + %119 = OpISub %int %int_10 %118 + %120 = OpAccessChain %_ptr_Private_int %obj %int_0 %117 + OpStore %120 %119 + %121 = OpLoad %int %i_1 + %122 = OpLoad %int %i_1 + %123 = OpAccessChain %_ptr_Private_int %obj %int_0 %122 + %124 = OpLoad %int %123 + %125 = OpLoad %int %i_1 + %126 = OpAccessChain %_ptr_Private_int %obj %int_0 %125 + %127 = OpLoad %int %126 + %128 = OpIMul %int %124 %127 + %129 = OpAccessChain %_ptr_Private_int %obj %int_0 %121 + OpStore %129 %128 + OpBranch %112 + %112 = OpLabel + %130 = OpLoad %int %i_1 + %131 = OpIAdd %int %130 %int_1 + OpStore %i_1 %131 + OpBranch %110 + %111 = OpLabel + OpStore %100 %int_0 + OpStore %101 %int_9 + OpStore %102 %int_n1 + %132 = OpLoad %int %102 + %133 = OpIAdd %int %132 %int_1 + OpStore %102 %133 + %134 = OpLoad %int %100 + %135 = OpAccessChain %_ptr_Function_int %103 %133 + OpStore %135 %134 + %136 = OpLoad %int %102 + %137 = OpIAdd %int %136 %int_1 + OpStore %102 %137 + %138 = OpLoad %int %101 + %139 = OpAccessChain %_ptr_Function_int %103 %137 + OpStore %139 %138 + OpBranch %140 + %140 = OpLabel + OpLoopMerge %141 %142 None + OpBranch %143 + %143 = OpLabel + %144 = OpLoad %int %102 + %145 = OpSGreaterThanEqual %bool %144 %int_0 + OpBranchConditional %145 %146 %141 + %146 = OpLabel + %147 = OpLoad %int %102 + %148 = OpISub %int %147 %int_1 + OpStore %102 %148 + %149 = OpAccessChain %_ptr_Function_int %103 %147 + %150 = OpLoad %int %149 + OpStore %101 %150 + %151 = OpLoad %int %102 + %152 = OpISub %int %151 %int_1 + OpStore %102 %152 + %153 = OpAccessChain %_ptr_Function_int %103 %151 + %154 = OpLoad %int %153 + OpStore %100 %154 + %155 = OpLoad %int %100 + OpStore %105 %155 + %156 = OpLoad %int %101 + OpStore %106 %156 + %157 = OpLoad %int %106 + %158 = OpAccessChain %_ptr_Private_int %obj %int_0 %157 + %159 = OpLoad %int %158 + OpStore %92 %159 + %160 = OpLoad %int %105 + %161 = OpISub %int %160 %int_1 + OpStore %93 %161 + %162 = OpLoad %int %105 + OpStore %94 %162 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %164 %165 None + OpBranch %166 + %166 = OpLabel + %167 = OpLoad %int %94 + %168 = OpLoad %int %106 + %169 = OpISub %int %168 %int_1 + %170 = OpSLessThanEqual %bool %167 %169 + OpBranchConditional %170 %171 %164 + %171 = OpLabel + %172 = OpLoad %int %94 + %173 = OpAccessChain %_ptr_Private_int %obj %int_0 %172 + %174 = OpLoad %int %173 + %175 = OpLoad %int %92 + %176 = OpSLessThanEqual %bool %174 %175 + OpSelectionMerge %177 None + OpBranchConditional %176 %178 %177 + %178 = OpLabel + %179 = OpLoad %int %93 + %180 = OpIAdd %int %179 %int_1 + OpStore %93 %180 + %181 = OpLoad %int %93 + OpStore %95 %181 + %182 = OpLoad %int %94 + OpStore %96 %182 + %183 = OpLoad %int %95 + %184 = OpAccessChain %_ptr_Private_int %obj %int_0 %183 + %185 = OpLoad %int %184 + OpStore %91 %185 + %186 = OpLoad %int %95 + %187 = OpLoad %int %96 + %188 = OpAccessChain %_ptr_Private_int %obj %int_0 %187 + %189 = OpLoad %int %188 + %190 = OpAccessChain %_ptr_Private_int %obj %int_0 %186 + OpStore %190 %189 + %191 = OpLoad %int %96 + %192 = OpLoad %int %91 + %193 = OpAccessChain %_ptr_Private_int %obj %int_0 %191 + OpStore %193 %192 + OpBranch %177 + %177 = OpLabel + OpBranch %165 + %165 = OpLabel + %194 = OpLoad %int %94 + %195 = OpIAdd %int %194 %int_1 + OpStore %94 %195 + OpBranch %163 + %164 = OpLabel + %196 = OpLoad %int %93 + %197 = OpIAdd %int %196 %int_1 + OpStore %97 %197 + %198 = OpLoad %int %106 + OpStore %98 %198 + %199 = OpLoad %int %97 + %200 = OpAccessChain %_ptr_Private_int %obj %int_0 %199 + %201 = OpLoad %int %200 + OpStore %90 %201 + %202 = OpLoad %int %97 + %203 = OpLoad %int %98 + %204 = OpAccessChain %_ptr_Private_int %obj %int_0 %203 + %205 = OpLoad %int %204 + %206 = OpAccessChain %_ptr_Private_int %obj %int_0 %202 + OpStore %206 %205 + %207 = OpLoad %int %98 + %208 = OpLoad %int %90 + %209 = OpAccessChain %_ptr_Private_int %obj %int_0 %207 + OpStore %209 %208 + %210 = OpLoad %int %93 + %211 = OpIAdd %int %210 %int_1 + OpStore %99 %211 + %212 = OpLoad %int %99 + OpStore %104 %212 + %213 = OpLoad %int %104 + %214 = OpISub %int %213 %int_1 + %215 = OpLoad %int %100 + %216 = OpSGreaterThan %bool %214 %215 + OpSelectionMerge %217 None + OpBranchConditional %216 %218 %217 + %218 = OpLabel + %219 = OpLoad %int %102 + %220 = OpIAdd %int %219 %int_1 + OpStore %102 %220 + %221 = OpLoad %int %100 + %222 = OpAccessChain %_ptr_Function_int %103 %220 + OpStore %222 %221 + %223 = OpLoad %int %102 + %224 = OpIAdd %int %223 %int_1 + OpStore %102 %224 + %225 = OpLoad %int %104 + %226 = OpISub %int %225 %int_1 + %227 = OpAccessChain %_ptr_Function_int %103 %224 + OpStore %227 %226 + OpBranch %217 + %217 = OpLabel + %228 = OpLoad %int %104 + %229 = OpIAdd %int %228 %int_1 + %230 = OpLoad %int %101 + %231 = OpSLessThan %bool %229 %230 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %232 + %233 = OpLabel + %234 = OpLoad %int %102 + %235 = OpIAdd %int %234 %int_1 + OpStore %102 %235 + %236 = OpLoad %int %104 + %237 = OpIAdd %int %236 %int_1 + %238 = OpAccessChain %_ptr_Function_int %103 %235 + OpStore %238 %237 + %239 = OpLoad %int %102 + %240 = OpIAdd %int %239 %int_1 + OpStore %102 %240 + %241 = OpLoad %int %101 + %242 = OpAccessChain %_ptr_Function_int %103 %240 + OpStore %242 %241 + OpBranch %232 + %232 = OpLabel + OpBranch %142 + %142 = OpLabel + OpBranch %140 + %141 = OpLabel + %243 = OpLoad %v4float %_GLF_FragCoord + %244 = OpVectorShuffle %v2float %243 %243 0 1 + %245 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %246 = OpLoad %v2float %245 + %247 = OpFDiv %v2float %244 %246 + OpStore %uv %247 + OpStore %color %72 + %248 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_0 + %249 = OpLoad %int %248 + %250 = OpConvertSToF %float %249 + %251 = OpAccessChain %_ptr_Function_float %color %uint_0 + %252 = OpLoad %float %251 + %253 = OpFAdd %float %252 %250 + %254 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %254 %253 + %255 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %256 = OpLoad %float %255 + %257 = OpFOrdGreaterThan %bool %256 %float_0_25 + OpSelectionMerge %258 None + OpBranchConditional %257 %259 %258 + %259 = OpLabel + %260 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_1 + %261 = OpLoad %int %260 + %262 = OpConvertSToF %float %261 + %263 = OpAccessChain %_ptr_Function_float %color %uint_0 + %264 = OpLoad %float %263 + %265 = OpFAdd %float %264 %262 + %266 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %266 %265 + OpBranch %258 + %258 = OpLabel + %267 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %268 = OpLoad %float %267 + %269 = OpFOrdGreaterThan %bool %268 %float_0_5 + OpSelectionMerge %270 None + OpBranchConditional %269 %271 %270 + %271 = OpLabel + %272 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_2 + %273 = OpLoad %int %272 + %274 = OpConvertSToF %float %273 + %275 = OpAccessChain %_ptr_Function_float %color %uint_1 + %276 = OpLoad %float %275 + %277 = OpFAdd %float %276 %274 + %278 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %278 %277 + OpBranch %270 + %270 = OpLabel + %279 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %280 = OpLoad %float %279 + %281 = OpFOrdGreaterThan %bool %280 %float_0_75 + OpSelectionMerge %282 None + OpBranchConditional %281 %283 %282 + %283 = OpLabel + %284 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_3 + %285 = OpLoad %int %284 + %286 = OpConvertSToF %float %285 + %287 = OpAccessChain %_ptr_Function_float %color %uint_2 + %288 = OpLoad %float %287 + %289 = OpFAdd %float %288 %286 + %290 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %290 %289 + OpBranch %282 + %282 = OpLabel + %291 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_4 + %292 = OpLoad %int %291 + %293 = OpConvertSToF %float %292 + %294 = OpAccessChain %_ptr_Function_float %color %uint_1 + %295 = OpLoad %float %294 + %296 = OpFAdd %float %295 %293 + %297 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %297 %296 + %298 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %299 = OpLoad %float %298 + %300 = OpFOrdGreaterThan %bool %299 %float_0_25 + OpSelectionMerge %301 None + OpBranchConditional %300 %302 %301 + %302 = OpLabel + %303 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_5 + %304 = OpLoad %int %303 + %305 = OpConvertSToF %float %304 + %306 = OpAccessChain %_ptr_Function_float %color %uint_0 + %307 = OpLoad %float %306 + %308 = OpFAdd %float %307 %305 + %309 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %309 %308 + OpBranch %301 + %301 = OpLabel + %310 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %311 = OpLoad %float %310 + %312 = OpFOrdGreaterThan %bool %311 %float_0_5 + OpSelectionMerge %313 None + OpBranchConditional %312 %314 %313 + %314 = OpLabel + %315 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_6 + %316 = OpLoad %int %315 + %317 = OpConvertSToF %float %316 + %318 = OpAccessChain %_ptr_Function_float %color %uint_1 + %319 = OpLoad %float %318 + %320 = OpFAdd %float %319 %317 + %321 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %321 %320 + OpBranch %313 + %313 = OpLabel + %322 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %323 = OpLoad %float %322 + %324 = OpFOrdGreaterThan %bool %323 %float_0_75 + OpSelectionMerge %325 None + OpBranchConditional %324 %326 %325 + %326 = OpLabel + %327 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_7 + %328 = OpLoad %int %327 + %329 = OpConvertSToF %float %328 + %330 = OpAccessChain %_ptr_Function_float %color %uint_2 + %331 = OpLoad %float %330 + %332 = OpFAdd %float %331 %329 + %333 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %333 %332 + OpBranch %325 + %325 = OpLabel + %334 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_8 + %335 = OpLoad %int %334 + %336 = OpConvertSToF %float %335 + %337 = OpAccessChain %_ptr_Function_float %color %uint_2 + %338 = OpLoad %float %337 + %339 = OpFAdd %float %338 %336 + %340 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %340 %339 + %341 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %342 = OpLoad %float %341 + %343 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %344 = OpLoad %float %343 + %345 = OpFSub %float %342 %344 + %346 = OpExtInst %float %1 FAbs %345 + %347 = OpFOrdLessThan %bool %346 %float_0_25 + OpSelectionMerge %348 None + OpBranchConditional %347 %349 %348 + %349 = OpLabel + %350 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_9 + %351 = OpLoad %int %350 + %352 = OpConvertSToF %float %351 + %353 = OpAccessChain %_ptr_Function_float %color %uint_0 + %354 = OpLoad %float %353 + %355 = OpFAdd %float %354 %352 + %356 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %356 %355 + OpBranch %348 + %348 = OpLabel + %357 = OpLoad %v3float %color + %358 = OpExtInst %v3float %1 Normalize %357 + %359 = OpCompositeExtract %float %358 0 + %360 = OpCompositeExtract %float %358 1 + %361 = OpCompositeExtract %float %358 2 + %362 = OpCompositeConstruct %v4float %359 %360 %361 %float_1 + OpStore %frag_color %362 + %363 = OpLoad %v4float %_GLF_pos + %364 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %364 %363 + OpReturn + OpFunctionEnd +%swap_i1_i1_ = OpFunction %void None %41 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %365 = OpLabel + %temp = OpVariable %_ptr_Function_int Function + %366 = OpLoad %int %i + %367 = OpAccessChain %_ptr_Private_int %obj %int_0 %366 + %368 = OpLoad %int %367 + OpStore %temp %368 + %369 = OpLoad %int %i + %370 = OpLoad %int %j + %371 = OpAccessChain %_ptr_Private_int %obj %int_0 %370 + %372 = OpLoad %int %371 + %373 = OpAccessChain %_ptr_Private_int %obj %int_0 %369 + OpStore %373 %372 + %374 = OpLoad %int %j + %375 = OpLoad %int %temp + %376 = OpAccessChain %_ptr_Private_int %obj %int_0 %374 + OpStore %376 %375 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %42 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %377 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_int Function + %378 = OpLoad %int %h + %379 = OpAccessChain %_ptr_Private_int %obj %int_0 %378 + %380 = OpLoad %int %379 + OpStore %pivot %380 + %381 = OpLoad %int %l + %382 = OpISub %int %381 %int_1 + OpStore %i_0 %382 + %383 = OpLoad %int %l + OpStore %j_0 %383 + OpBranch %384 + %384 = OpLabel + OpLoopMerge %385 %386 None + OpBranch %387 + %387 = OpLabel + %388 = OpLoad %int %j_0 + %389 = OpLoad %int %h + %390 = OpISub %int %389 %int_1 + %391 = OpSLessThanEqual %bool %388 %390 + OpBranchConditional %391 %392 %385 + %392 = OpLabel + %393 = OpLoad %int %j_0 + %394 = OpAccessChain %_ptr_Private_int %obj %int_0 %393 + %395 = OpLoad %int %394 + %396 = OpLoad %int %pivot + %397 = OpSLessThanEqual %bool %395 %396 + OpSelectionMerge %398 None + OpBranchConditional %397 %399 %398 + %399 = OpLabel + %400 = OpLoad %int %i_0 + %401 = OpIAdd %int %400 %int_1 + OpStore %i_0 %401 + %402 = OpLoad %int %i_0 + OpStore %param %402 + %403 = OpLoad %int %j_0 + OpStore %param_0 %403 + %404 = OpFunctionCall %void %swap_i1_i1_ %param %param_0 + OpBranch %398 + %398 = OpLabel + OpBranch %386 + %386 = OpLabel + %405 = OpLoad %int %j_0 + %406 = OpIAdd %int %405 %int_1 + OpStore %j_0 %406 + OpBranch %384 + %385 = OpLabel + %407 = OpLoad %int %i_0 + %408 = OpIAdd %int %407 %int_1 + OpStore %param_1 %408 + %409 = OpLoad %int %h + OpStore %param_2 %409 + %410 = OpFunctionCall %void %swap_i1_i1_ %param_1 %param_2 + %411 = OpLoad %int %i_0 + %412 = OpIAdd %int %411 %int_1 + OpReturnValue %412 + OpFunctionEnd + %quicksort_ = OpFunction %void None %38 + %413 = OpLabel + %l_0 = OpVariable %_ptr_Function_int Function + %h_0 = OpVariable %_ptr_Function_int Function + %top = OpVariable %_ptr_Function_int Function + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function + %p = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_int Function + %param_4 = OpVariable %_ptr_Function_int Function + OpStore %l_0 %int_0 + OpStore %h_0 %int_9 + OpStore %top %int_n1 + %414 = OpLoad %int %top + %415 = OpIAdd %int %414 %int_1 + OpStore %top %415 + %416 = OpLoad %int %l_0 + %417 = OpAccessChain %_ptr_Function_int %stack %415 + OpStore %417 %416 + %418 = OpLoad %int %top + %419 = OpIAdd %int %418 %int_1 + OpStore %top %419 + %420 = OpLoad %int %h_0 + %421 = OpAccessChain %_ptr_Function_int %stack %419 + OpStore %421 %420 + OpBranch %422 + %422 = OpLabel + OpLoopMerge %423 %424 None + OpBranch %425 + %425 = OpLabel + %426 = OpLoad %int %top + %427 = OpSGreaterThanEqual %bool %426 %int_0 + OpBranchConditional %427 %428 %423 + %428 = OpLabel + %429 = OpLoad %int %top + %430 = OpISub %int %429 %int_1 + OpStore %top %430 + %431 = OpAccessChain %_ptr_Function_int %stack %429 + %432 = OpLoad %int %431 + OpStore %h_0 %432 + %433 = OpLoad %int %top + %434 = OpISub %int %433 %int_1 + OpStore %top %434 + %435 = OpAccessChain %_ptr_Function_int %stack %433 + %436 = OpLoad %int %435 + OpStore %l_0 %436 + %437 = OpLoad %int %l_0 + OpStore %param_3 %437 + %438 = OpLoad %int %h_0 + OpStore %param_4 %438 + %439 = OpFunctionCall %int %performPartition_i1_i1_ %param_3 %param_4 + OpStore %p %439 + %440 = OpLoad %int %p + %441 = OpISub %int %440 %int_1 + %442 = OpLoad %int %l_0 + %443 = OpSGreaterThan %bool %441 %442 + OpSelectionMerge %444 None + OpBranchConditional %443 %445 %444 + %445 = OpLabel + %446 = OpLoad %int %top + %447 = OpIAdd %int %446 %int_1 + OpStore %top %447 + %448 = OpLoad %int %l_0 + %449 = OpAccessChain %_ptr_Function_int %stack %447 + OpStore %449 %448 + %450 = OpLoad %int %top + %451 = OpIAdd %int %450 %int_1 + OpStore %top %451 + %452 = OpLoad %int %p + %453 = OpISub %int %452 %int_1 + %454 = OpAccessChain %_ptr_Function_int %stack %451 + OpStore %454 %453 + OpBranch %444 + %444 = OpLabel + %455 = OpLoad %int %p + %456 = OpIAdd %int %455 %int_1 + %457 = OpLoad %int %h_0 + %458 = OpSLessThan %bool %456 %457 + OpSelectionMerge %459 None + OpBranchConditional %458 %460 %459 + %460 = OpLabel + %461 = OpLoad %int %top + %462 = OpIAdd %int %461 %int_1 + OpStore %top %462 + %463 = OpLoad %int %p + %464 = OpIAdd %int %463 %int_1 + %465 = OpAccessChain %_ptr_Function_int %stack %462 + OpStore %465 %464 + %466 = OpLoad %int %top + %467 = OpIAdd %int %466 %int_1 + OpStore %top %467 + %468 = OpLoad %int %h_0 + %469 = OpAccessChain %_ptr_Function_int %stack %467 + OpStore %469 %468 + OpBranch %459 + %459 = OpLabel + OpBranch %424 + %424 = OpLabel + OpBranch %422 + %423 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..99862c315c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.hlsl @@ -0,0 +1,306 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_34 : register(b0, space0) { + uint4 x_34[1]; +}; +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_90 = 0; + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94 = 0; + int x_95 = 0; + int x_96 = 0; + int x_97 = 0; + int x_98 = 0; + int x_99 = 0; + int x_100 = 0; + int x_101 = 0; + int x_102 = 0; + int x_103[10] = (int[10])0; + int x_104 = 0; + int x_105 = 0; + int x_106 = 0; + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_121 = i_2; + const int x_124 = obj.numbers[i_2]; + const int x_127 = obj.numbers[i_2]; + obj.numbers[x_121] = (x_124 * x_127); + } + } + x_100 = 0; + x_101 = 9; + x_102 = -1; + const int x_133 = (x_102 + 1); + x_102 = x_133; + x_103[x_133] = x_100; + const int x_137 = (x_102 + 1); + x_102 = x_137; + x_103[x_137] = x_101; + while (true) { + if ((x_102 >= 0)) { + } else { + break; + } + const int x_147 = x_102; + x_102 = (x_147 - 1); + const int x_150 = x_103[x_147]; + x_101 = x_150; + const int x_151 = x_102; + x_102 = (x_151 - 1); + const int x_154 = x_103[x_151]; + x_100 = x_154; + x_105 = x_100; + x_106 = x_101; + const int x_159 = obj.numbers[x_106]; + x_92 = x_159; + x_93 = (x_105 - 1); + x_94 = x_105; + { + for(; (x_94 <= (x_106 - 1)); x_94 = (x_94 + 1)) { + const int x_174 = obj.numbers[x_94]; + if ((x_174 <= x_92)) { + x_93 = (x_93 + 1); + x_95 = x_93; + x_96 = x_94; + const int x_185 = obj.numbers[x_95]; + x_91 = x_185; + const int x_186 = x_95; + const int x_189 = obj.numbers[x_96]; + obj.numbers[x_186] = x_189; + obj.numbers[x_96] = x_91; + } + } + } + x_97 = (x_93 + 1); + x_98 = x_106; + const int x_201 = obj.numbers[x_97]; + x_90 = x_201; + const int x_202 = x_97; + const int x_205 = obj.numbers[x_98]; + obj.numbers[x_202] = x_205; + obj.numbers[x_98] = x_90; + x_99 = (x_93 + 1); + x_104 = x_99; + if (((x_104 - 1) > x_100)) { + const int x_220 = (x_102 + 1); + x_102 = x_220; + x_103[x_220] = x_100; + const int x_224 = (x_102 + 1); + x_102 = x_224; + x_103[x_224] = (x_104 - 1); + } + if (((x_104 + 1) < x_101)) { + const int x_235 = (x_102 + 1); + x_102 = x_235; + x_103[x_235] = (x_104 + 1); + const int x_240 = (x_102 + 1); + x_102 = x_240; + x_103[x_240] = x_101; + } + } + const float4 x_243 = x_GLF_FragCoord; + const float2 x_246 = asfloat(x_34[0].xy); + uv = (float2(x_243.x, x_243.y) / x_246); + color = float3(1.0f, 2.0f, 3.0f); + const int x_249 = obj.numbers[0]; + const float x_252 = color.x; + color.x = (x_252 + float(x_249)); + const float x_256 = uv.x; + if ((x_256 > 0.25f)) { + const int x_261 = obj.numbers[1]; + const float x_264 = color.x; + color.x = (x_264 + float(x_261)); + } + const float x_268 = uv.x; + if ((x_268 > 0.5f)) { + const int x_273 = obj.numbers[2]; + const float x_276 = color.y; + color.y = (x_276 + float(x_273)); + } + const float x_280 = uv.x; + if ((x_280 > 0.75f)) { + const int x_285 = obj.numbers[3]; + const float x_288 = color.z; + color.z = (x_288 + float(x_285)); + } + const int x_292 = obj.numbers[4]; + const float x_295 = color.y; + color.y = (x_295 + float(x_292)); + const float x_299 = uv.y; + if ((x_299 > 0.25f)) { + const int x_304 = obj.numbers[5]; + const float x_307 = color.x; + color.x = (x_307 + float(x_304)); + } + const float x_311 = uv.y; + if ((x_311 > 0.5f)) { + const int x_316 = obj.numbers[6]; + const float x_319 = color.y; + color.y = (x_319 + float(x_316)); + } + const float x_323 = uv.y; + if ((x_323 > 0.75f)) { + const int x_328 = obj.numbers[7]; + const float x_331 = color.z; + color.z = (x_331 + float(x_328)); + } + const int x_335 = obj.numbers[8]; + const float x_338 = color.z; + color.z = (x_338 + float(x_335)); + const float x_342 = uv.x; + const float x_344 = uv.y; + if ((abs((x_342 - x_344)) < 0.25f)) { + const int x_351 = obj.numbers[9]; + const float x_354 = color.x; + color.x = (x_354 + float(x_351)); + } + const float3 x_358 = normalize(color); + frag_color = float4(x_358.x, x_358.y, x_358.z, 1.0f); + gl_Position = x_GLF_pos; + return; +} + +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 x_GLF_pos_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_GLF_pos_param = tint_symbol.x_GLF_pos_param; + x_GLF_pos = x_GLF_pos_param; + main_1(); + const main_out tint_symbol_3 = {frag_color, gl_Position}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_5; +} + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_366 = i; + const int x_368 = obj.numbers[x_366]; + temp = x_368; + const int x_369 = i; + const int x_370 = j; + const int x_372 = obj.numbers[x_370]; + obj.numbers[x_369] = x_372; + const int x_374 = j; + obj.numbers[x_374] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_378 = h; + const int x_380 = obj.numbers[x_378]; + pivot = x_380; + const int x_381 = l; + i_1 = (x_381 - 1); + const int x_383 = l; + j_1 = x_383; + while (true) { + const int x_388 = j_1; + const int x_389 = h; + if ((x_388 <= (x_389 - 1))) { + } else { + break; + } + const int x_395 = obj.numbers[j_1]; + if ((x_395 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + param_2 = (i_1 + 1); + const int x_409 = h; + param_3 = x_409; + swap_i1_i1_(param_2, param_3); + return (i_1 + 1); +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_415 = (top + 1); + top = x_415; + stack[x_415] = l_1; + const int x_419 = (top + 1); + top = x_419; + stack[x_419] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_429 = top; + top = (x_429 - 1); + const int x_432 = stack[x_429]; + h_1 = x_432; + const int x_433 = top; + top = (x_433 - 1); + const int x_436 = stack[x_433]; + l_1 = x_436; + param_4 = l_1; + param_5 = h_1; + const int x_439 = performPartition_i1_i1_(param_4, param_5); + p = x_439; + if (((p - 1) > l_1)) { + const int x_447 = (top + 1); + top = x_447; + stack[x_447] = l_1; + const int x_451 = (top + 1); + top = x_451; + stack[x_451] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_462 = (top + 1); + top = x_462; + stack[x_462] = (p + 1); + const int x_467 = (top + 1); + top = x_467; + stack[x_467] = h_1; + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.msl new file mode 100644 index 0000000000..45ba09a9e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.msl @@ -0,0 +1,400 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_pos_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void main_1(constant buf0& x_34, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7, thread QuicksortObject* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + int x_90 = 0; + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94 = 0; + int x_95 = 0; + int x_96 = 0; + int x_97 = 0; + int x_98 = 0; + int x_99 = 0; + int x_100 = 0; + int x_101 = 0; + int x_102 = 0; + tint_array_wrapper x_103 = {}; + int x_104 = 0; + int x_105 = 0; + int x_106 = 0; + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + float4 const x_107 = *(tint_symbol_6); + *(tint_symbol_7) = ((x_107 + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + while (true) { + int const x_114 = i_2; + if ((x_114 < 10)) { + } else { + break; + } + int const x_117 = i_2; + int const x_118 = i_2; + (*(tint_symbol_8)).numbers.arr[x_117] = (10 - x_118); + int const x_121 = i_2; + int const x_122 = i_2; + int const x_124 = (*(tint_symbol_8)).numbers.arr[x_122]; + int const x_125 = i_2; + int const x_127 = (*(tint_symbol_8)).numbers.arr[x_125]; + (*(tint_symbol_8)).numbers.arr[x_121] = (x_124 * x_127); + { + int const x_130 = i_2; + i_2 = (x_130 + 1); + } + } + x_100 = 0; + x_101 = 9; + x_102 = -1; + int const x_132 = x_102; + int const x_133 = (x_132 + 1); + x_102 = x_133; + int const x_134 = x_100; + x_103.arr[x_133] = x_134; + int const x_136 = x_102; + int const x_137 = (x_136 + 1); + x_102 = x_137; + int const x_138 = x_101; + x_103.arr[x_137] = x_138; + while (true) { + int const x_144 = x_102; + if ((x_144 >= 0)) { + } else { + break; + } + int const x_147 = x_102; + x_102 = (x_147 - 1); + int const x_150 = x_103.arr[x_147]; + x_101 = x_150; + int const x_151 = x_102; + x_102 = (x_151 - 1); + int const x_154 = x_103.arr[x_151]; + x_100 = x_154; + int const x_155 = x_100; + x_105 = x_155; + int const x_156 = x_101; + x_106 = x_156; + int const x_157 = x_106; + int const x_159 = (*(tint_symbol_8)).numbers.arr[x_157]; + x_92 = x_159; + int const x_160 = x_105; + x_93 = (x_160 - 1); + int const x_162 = x_105; + x_94 = x_162; + while (true) { + int const x_167 = x_94; + int const x_168 = x_106; + if ((x_167 <= (x_168 - 1))) { + } else { + break; + } + int const x_172 = x_94; + int const x_174 = (*(tint_symbol_8)).numbers.arr[x_172]; + int const x_175 = x_92; + if ((x_174 <= x_175)) { + int const x_179 = x_93; + x_93 = (x_179 + 1); + int const x_181 = x_93; + x_95 = x_181; + int const x_182 = x_94; + x_96 = x_182; + int const x_183 = x_95; + int const x_185 = (*(tint_symbol_8)).numbers.arr[x_183]; + x_91 = x_185; + int const x_186 = x_95; + int const x_187 = x_96; + int const x_189 = (*(tint_symbol_8)).numbers.arr[x_187]; + (*(tint_symbol_8)).numbers.arr[x_186] = x_189; + int const x_191 = x_96; + int const x_192 = x_91; + (*(tint_symbol_8)).numbers.arr[x_191] = x_192; + } + { + int const x_194 = x_94; + x_94 = (x_194 + 1); + } + } + int const x_196 = x_93; + x_97 = (x_196 + 1); + int const x_198 = x_106; + x_98 = x_198; + int const x_199 = x_97; + int const x_201 = (*(tint_symbol_8)).numbers.arr[x_199]; + x_90 = x_201; + int const x_202 = x_97; + int const x_203 = x_98; + int const x_205 = (*(tint_symbol_8)).numbers.arr[x_203]; + (*(tint_symbol_8)).numbers.arr[x_202] = x_205; + int const x_207 = x_98; + int const x_208 = x_90; + (*(tint_symbol_8)).numbers.arr[x_207] = x_208; + int const x_210 = x_93; + x_99 = (x_210 + 1); + int const x_212 = x_99; + x_104 = x_212; + int const x_213 = x_104; + int const x_215 = x_100; + if (((x_213 - 1) > x_215)) { + int const x_219 = x_102; + int const x_220 = (x_219 + 1); + x_102 = x_220; + int const x_221 = x_100; + x_103.arr[x_220] = x_221; + int const x_223 = x_102; + int const x_224 = (x_223 + 1); + x_102 = x_224; + int const x_225 = x_104; + x_103.arr[x_224] = (x_225 - 1); + } + int const x_228 = x_104; + int const x_230 = x_101; + if (((x_228 + 1) < x_230)) { + int const x_234 = x_102; + int const x_235 = (x_234 + 1); + x_102 = x_235; + int const x_236 = x_104; + x_103.arr[x_235] = (x_236 + 1); + int const x_239 = x_102; + int const x_240 = (x_239 + 1); + x_102 = x_240; + int const x_241 = x_101; + x_103.arr[x_240] = x_241; + } + } + float4 const x_243 = *(tint_symbol_7); + float2 const x_246 = x_34.resolution; + uv = (float2(x_243.x, x_243.y) / x_246); + color = float3(1.0f, 2.0f, 3.0f); + int const x_249 = (*(tint_symbol_8)).numbers.arr[0]; + float const x_252 = color.x; + color.x = (x_252 + float(x_249)); + float const x_256 = uv.x; + if ((x_256 > 0.25f)) { + int const x_261 = (*(tint_symbol_8)).numbers.arr[1]; + float const x_264 = color.x; + color.x = (x_264 + float(x_261)); + } + float const x_268 = uv.x; + if ((x_268 > 0.5f)) { + int const x_273 = (*(tint_symbol_8)).numbers.arr[2]; + float const x_276 = color.y; + color.y = (x_276 + float(x_273)); + } + float const x_280 = uv.x; + if ((x_280 > 0.75f)) { + int const x_285 = (*(tint_symbol_8)).numbers.arr[3]; + float const x_288 = color.z; + color.z = (x_288 + float(x_285)); + } + int const x_292 = (*(tint_symbol_8)).numbers.arr[4]; + float const x_295 = color.y; + color.y = (x_295 + float(x_292)); + float const x_299 = uv.y; + if ((x_299 > 0.25f)) { + int const x_304 = (*(tint_symbol_8)).numbers.arr[5]; + float const x_307 = color.x; + color.x = (x_307 + float(x_304)); + } + float const x_311 = uv.y; + if ((x_311 > 0.5f)) { + int const x_316 = (*(tint_symbol_8)).numbers.arr[6]; + float const x_319 = color.y; + color.y = (x_319 + float(x_316)); + } + float const x_323 = uv.y; + if ((x_323 > 0.75f)) { + int const x_328 = (*(tint_symbol_8)).numbers.arr[7]; + float const x_331 = color.z; + color.z = (x_331 + float(x_328)); + } + int const x_335 = (*(tint_symbol_8)).numbers.arr[8]; + float const x_338 = color.z; + color.z = (x_338 + float(x_335)); + float const x_342 = uv.x; + float const x_344 = uv.y; + if ((fabs((x_342 - x_344)) < 0.25f)) { + int const x_351 = (*(tint_symbol_8)).numbers.arr[9]; + float const x_354 = color.x; + color.x = (x_354 + float(x_351)); + } + float3 const x_357 = color; + float3 const x_358 = normalize(x_357); + *(tint_symbol_9) = float4(x_358.x, x_358.y, x_358.z, 1.0f); + float4 const x_363 = *(tint_symbol_6); + *(tint_symbol_10) = x_363; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant buf0& x_34 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + thread QuicksortObject tint_symbol_13 = {}; + thread float4 tint_symbol_14 = 0.0f; + thread float4 tint_symbol_15 = 0.0f; + float4 const x_GLF_pos_param = tint_symbol_1.x_GLF_pos_param; + tint_symbol_11 = x_GLF_pos_param; + main_1(x_34, &(tint_symbol_11), &(tint_symbol_12), &(tint_symbol_13), &(tint_symbol_14), &(tint_symbol_15)); + main_out const tint_symbol_4 = {.frag_color_1=tint_symbol_14, .gl_Position=tint_symbol_15}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_16) { + int temp = 0; + int const x_366 = *(i); + int const x_368 = (*(tint_symbol_16)).numbers.arr[x_366]; + temp = x_368; + int const x_369 = *(i); + int const x_370 = *(j); + int const x_372 = (*(tint_symbol_16)).numbers.arr[x_370]; + (*(tint_symbol_16)).numbers.arr[x_369] = x_372; + int const x_374 = *(j); + int const x_375 = temp; + (*(tint_symbol_16)).numbers.arr[x_374] = x_375; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_17) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_378 = *(h); + int const x_380 = (*(tint_symbol_17)).numbers.arr[x_378]; + pivot = x_380; + int const x_381 = *(l); + i_1 = (x_381 - 1); + int const x_383 = *(l); + j_1 = x_383; + while (true) { + int const x_388 = j_1; + int const x_389 = *(h); + if ((x_388 <= (x_389 - 1))) { + } else { + break; + } + int const x_393 = j_1; + int const x_395 = (*(tint_symbol_17)).numbers.arr[x_393]; + int const x_396 = pivot; + if ((x_395 <= x_396)) { + int const x_400 = i_1; + i_1 = (x_400 + 1); + int const x_402 = i_1; + param = x_402; + int const x_403 = j_1; + param_1 = x_403; + swap_i1_i1_(&(param), &(param_1), tint_symbol_17); + } + { + int const x_405 = j_1; + j_1 = (x_405 + 1); + } + } + int const x_407 = i_1; + param_2 = (x_407 + 1); + int const x_409 = *(h); + param_3 = x_409; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_17); + int const x_411 = i_1; + return (x_411 + 1); +} + +void quicksort_(thread QuicksortObject* const tint_symbol_18) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_414 = top; + int const x_415 = (x_414 + 1); + top = x_415; + int const x_416 = l_1; + stack.arr[x_415] = x_416; + int const x_418 = top; + int const x_419 = (x_418 + 1); + top = x_419; + int const x_420 = h_1; + stack.arr[x_419] = x_420; + while (true) { + int const x_426 = top; + if ((x_426 >= 0)) { + } else { + break; + } + int const x_429 = top; + top = (x_429 - 1); + int const x_432 = stack.arr[x_429]; + h_1 = x_432; + int const x_433 = top; + top = (x_433 - 1); + int const x_436 = stack.arr[x_433]; + l_1 = x_436; + int const x_437 = l_1; + param_4 = x_437; + int const x_438 = h_1; + param_5 = x_438; + int const x_439 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_18); + p = x_439; + int const x_440 = p; + int const x_442 = l_1; + if (((x_440 - 1) > x_442)) { + int const x_446 = top; + int const x_447 = (x_446 + 1); + top = x_447; + int const x_448 = l_1; + stack.arr[x_447] = x_448; + int const x_450 = top; + int const x_451 = (x_450 + 1); + top = x_451; + int const x_452 = p; + stack.arr[x_451] = (x_452 - 1); + } + int const x_455 = p; + int const x_457 = h_1; + if (((x_455 + 1) < x_457)) { + int const x_461 = top; + int const x_462 = (x_461 + 1); + top = x_462; + int const x_463 = p; + stack.arr[x_462] = (x_463 + 1); + int const x_466 = top; + int const x_467 = (x_466 + 1); + top = x_467; + int const x_468 = h_1; + stack.arr[x_467] = x_468; + } + } + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..6f5c5f8917 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.spvasm @@ -0,0 +1,780 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 521 +; Schema: 0 + OpCapability Shader + %339 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %x_GLF_FragCoord "x_GLF_FragCoord" + OpName %x_GLF_pos "x_GLF_pos" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_34 "x_34" + OpName %frag_color "frag_color" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %x_90 "x_90" + OpName %x_91 "x_91" + OpName %x_92 "x_92" + OpName %x_93 "x_93" + OpName %x_94 "x_94" + OpName %x_95 "x_95" + OpName %x_96 "x_96" + OpName %x_97 "x_97" + OpName %x_98 "x_98" + OpName %x_99 "x_99" + OpName %x_100 "x_100" + OpName %x_101 "x_101" + OpName %x_102 "x_102" + OpName %x_103 "x_103" + OpName %x_104 "x_104" + OpName %x_105 "x_105" + OpName %x_106 "x_106" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "frag_color_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpDecorate %tint_pointsize BuiltIn PointSize + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_34 NonWritable + OpDecorate %x_34 DescriptorSet 0 + OpDecorate %x_34 Binding 0 + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_3 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %12 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private %16 + %x_GLF_pos = OpVariable %_ptr_Private_v4float Private %16 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_34 = OpVariable %_ptr_Uniform_buf0 Uniform + %frag_color = OpVariable %_ptr_Private_v4float Private %16 +%gl_Position = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %16 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %29 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpConstantNull %int +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %50 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %57 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %61 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %65 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %68 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %227 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float %v4float + %358 = OpTypeFunction %void %main_out + %373 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %394 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %main_1 = OpFunction %void None %29 + %32 = OpLabel + %x_90 = OpVariable %_ptr_Function_int Function %35 + %x_91 = OpVariable %_ptr_Function_int Function %35 + %x_92 = OpVariable %_ptr_Function_int Function %35 + %x_93 = OpVariable %_ptr_Function_int Function %35 + %x_94 = OpVariable %_ptr_Function_int Function %35 + %x_95 = OpVariable %_ptr_Function_int Function %35 + %x_96 = OpVariable %_ptr_Function_int Function %35 + %x_97 = OpVariable %_ptr_Function_int Function %35 + %x_98 = OpVariable %_ptr_Function_int Function %35 + %x_99 = OpVariable %_ptr_Function_int Function %35 + %x_100 = OpVariable %_ptr_Function_int Function %35 + %x_101 = OpVariable %_ptr_Function_int Function %35 + %x_102 = OpVariable %_ptr_Function_int Function %35 + %x_103 = OpVariable %_ptr_Function__arr_int_uint_10 Function %50 + %x_104 = OpVariable %_ptr_Function_int Function %35 + %x_105 = OpVariable %_ptr_Function_int Function %35 + %x_106 = OpVariable %_ptr_Function_int Function %35 + %i_2 = OpVariable %_ptr_Function_int Function %35 + %uv = OpVariable %_ptr_Function_v2float Function %57 + %color = OpVariable %_ptr_Function_v3float Function %61 + %62 = OpLoad %v4float %x_GLF_pos + %66 = OpFAdd %v4float %62 %65 + %69 = OpFMul %v4float %66 %68 + OpStore %x_GLF_FragCoord %69 + OpStore %i_2 %int_0 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %int %i_2 + %77 = OpSLessThan %bool %75 %int_10 + OpSelectionMerge %79 None + OpBranchConditional %77 %80 %81 + %80 = OpLabel + OpBranch %79 + %81 = OpLabel + OpBranch %72 + %79 = OpLabel + %82 = OpLoad %int %i_2 + %83 = OpLoad %int %i_2 + %86 = OpAccessChain %_ptr_Private_int %obj %uint_0 %82 + %87 = OpISub %int %int_10 %83 + OpStore %86 %87 + %88 = OpLoad %int %i_2 + %89 = OpLoad %int %i_2 + %90 = OpAccessChain %_ptr_Private_int %obj %uint_0 %89 + %91 = OpLoad %int %90 + %92 = OpLoad %int %i_2 + %93 = OpAccessChain %_ptr_Private_int %obj %uint_0 %92 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Private_int %obj %uint_0 %88 + %96 = OpIMul %int %91 %94 + OpStore %95 %96 + OpBranch %73 + %73 = OpLabel + %97 = OpLoad %int %i_2 + %99 = OpIAdd %int %97 %int_1 + OpStore %i_2 %99 + OpBranch %71 + %72 = OpLabel + OpStore %x_100 %int_0 + OpStore %x_101 %int_9 + OpStore %x_102 %int_n1 + %102 = OpLoad %int %x_102 + %103 = OpIAdd %int %102 %int_1 + OpStore %x_102 %103 + %104 = OpLoad %int %x_100 + %105 = OpAccessChain %_ptr_Function_int %x_103 %103 + OpStore %105 %104 + %106 = OpLoad %int %x_102 + %107 = OpIAdd %int %106 %int_1 + OpStore %x_102 %107 + %108 = OpLoad %int %x_101 + %109 = OpAccessChain %_ptr_Function_int %x_103 %107 + OpStore %109 %108 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %int %x_102 + %115 = OpSGreaterThanEqual %bool %114 %int_0 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %118 + %117 = OpLabel + OpBranch %116 + %118 = OpLabel + OpBranch %111 + %116 = OpLabel + %119 = OpLoad %int %x_102 + %120 = OpISub %int %119 %int_1 + OpStore %x_102 %120 + %121 = OpAccessChain %_ptr_Function_int %x_103 %119 + %122 = OpLoad %int %121 + OpStore %x_101 %122 + %123 = OpLoad %int %x_102 + %124 = OpISub %int %123 %int_1 + OpStore %x_102 %124 + %125 = OpAccessChain %_ptr_Function_int %x_103 %123 + %126 = OpLoad %int %125 + OpStore %x_100 %126 + %127 = OpLoad %int %x_100 + OpStore %x_105 %127 + %128 = OpLoad %int %x_101 + OpStore %x_106 %128 + %129 = OpLoad %int %x_106 + %130 = OpAccessChain %_ptr_Private_int %obj %uint_0 %129 + %131 = OpLoad %int %130 + OpStore %x_92 %131 + %132 = OpLoad %int %x_105 + %133 = OpISub %int %132 %int_1 + OpStore %x_93 %133 + %134 = OpLoad %int %x_105 + OpStore %x_94 %134 + OpBranch %135 + %135 = OpLabel + OpLoopMerge %136 %137 None + OpBranch %138 + %138 = OpLabel + %139 = OpLoad %int %x_94 + %140 = OpLoad %int %x_106 + %141 = OpISub %int %140 %int_1 + %142 = OpSLessThanEqual %bool %139 %141 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %145 + %144 = OpLabel + OpBranch %143 + %145 = OpLabel + OpBranch %136 + %143 = OpLabel + %146 = OpLoad %int %x_94 + %147 = OpAccessChain %_ptr_Private_int %obj %uint_0 %146 + %148 = OpLoad %int %147 + %149 = OpLoad %int %x_92 + %150 = OpSLessThanEqual %bool %148 %149 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %151 + %152 = OpLabel + %153 = OpLoad %int %x_93 + %154 = OpIAdd %int %153 %int_1 + OpStore %x_93 %154 + %155 = OpLoad %int %x_93 + OpStore %x_95 %155 + %156 = OpLoad %int %x_94 + OpStore %x_96 %156 + %157 = OpLoad %int %x_95 + %158 = OpAccessChain %_ptr_Private_int %obj %uint_0 %157 + %159 = OpLoad %int %158 + OpStore %x_91 %159 + %160 = OpLoad %int %x_95 + %161 = OpLoad %int %x_96 + %162 = OpAccessChain %_ptr_Private_int %obj %uint_0 %161 + %163 = OpLoad %int %162 + %164 = OpAccessChain %_ptr_Private_int %obj %uint_0 %160 + OpStore %164 %163 + %165 = OpLoad %int %x_96 + %166 = OpLoad %int %x_91 + %167 = OpAccessChain %_ptr_Private_int %obj %uint_0 %165 + OpStore %167 %166 + OpBranch %151 + %151 = OpLabel + OpBranch %137 + %137 = OpLabel + %168 = OpLoad %int %x_94 + %169 = OpIAdd %int %168 %int_1 + OpStore %x_94 %169 + OpBranch %135 + %136 = OpLabel + %170 = OpLoad %int %x_93 + %171 = OpIAdd %int %170 %int_1 + OpStore %x_97 %171 + %172 = OpLoad %int %x_106 + OpStore %x_98 %172 + %173 = OpLoad %int %x_97 + %174 = OpAccessChain %_ptr_Private_int %obj %uint_0 %173 + %175 = OpLoad %int %174 + OpStore %x_90 %175 + %176 = OpLoad %int %x_97 + %177 = OpLoad %int %x_98 + %178 = OpAccessChain %_ptr_Private_int %obj %uint_0 %177 + %179 = OpLoad %int %178 + %180 = OpAccessChain %_ptr_Private_int %obj %uint_0 %176 + OpStore %180 %179 + %181 = OpLoad %int %x_98 + %182 = OpLoad %int %x_90 + %183 = OpAccessChain %_ptr_Private_int %obj %uint_0 %181 + OpStore %183 %182 + %184 = OpLoad %int %x_93 + %185 = OpIAdd %int %184 %int_1 + OpStore %x_99 %185 + %186 = OpLoad %int %x_99 + OpStore %x_104 %186 + %187 = OpLoad %int %x_104 + %188 = OpLoad %int %x_100 + %189 = OpISub %int %187 %int_1 + %190 = OpSGreaterThan %bool %189 %188 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %191 + %192 = OpLabel + %193 = OpLoad %int %x_102 + %194 = OpIAdd %int %193 %int_1 + OpStore %x_102 %194 + %195 = OpLoad %int %x_100 + %196 = OpAccessChain %_ptr_Function_int %x_103 %194 + OpStore %196 %195 + %197 = OpLoad %int %x_102 + %198 = OpIAdd %int %197 %int_1 + OpStore %x_102 %198 + %199 = OpLoad %int %x_104 + %200 = OpAccessChain %_ptr_Function_int %x_103 %198 + %201 = OpISub %int %199 %int_1 + OpStore %200 %201 + OpBranch %191 + %191 = OpLabel + %202 = OpLoad %int %x_104 + %203 = OpLoad %int %x_101 + %204 = OpIAdd %int %202 %int_1 + %205 = OpSLessThan %bool %204 %203 + OpSelectionMerge %206 None + OpBranchConditional %205 %207 %206 + %207 = OpLabel + %208 = OpLoad %int %x_102 + %209 = OpIAdd %int %208 %int_1 + OpStore %x_102 %209 + %210 = OpLoad %int %x_104 + %211 = OpAccessChain %_ptr_Function_int %x_103 %209 + %212 = OpIAdd %int %210 %int_1 + OpStore %211 %212 + %213 = OpLoad %int %x_102 + %214 = OpIAdd %int %213 %int_1 + OpStore %x_102 %214 + %215 = OpLoad %int %x_101 + %216 = OpAccessChain %_ptr_Function_int %x_103 %214 + OpStore %216 %215 + OpBranch %206 + %206 = OpLabel + OpBranch %112 + %112 = OpLabel + OpBranch %110 + %111 = OpLabel + %217 = OpLoad %v4float %x_GLF_FragCoord + %219 = OpAccessChain %_ptr_Uniform_v2float %x_34 %uint_0 + %220 = OpLoad %v2float %219 + %221 = OpCompositeExtract %float %217 0 + %222 = OpCompositeExtract %float %217 1 + %223 = OpCompositeConstruct %v2float %221 %222 + %224 = OpFDiv %v2float %223 %220 + OpStore %uv %224 + OpStore %color %227 + %228 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %229 = OpLoad %int %228 + %231 = OpAccessChain %_ptr_Function_float %color %uint_0 + %232 = OpLoad %float %231 + %233 = OpAccessChain %_ptr_Function_float %color %uint_0 + %234 = OpConvertSToF %float %229 + %235 = OpFAdd %float %232 %234 + OpStore %233 %235 + %236 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %237 = OpLoad %float %236 + %239 = OpFOrdGreaterThan %bool %237 %float_0_25 + OpSelectionMerge %240 None + OpBranchConditional %239 %241 %240 + %241 = OpLabel + %242 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %243 = OpLoad %int %242 + %244 = OpAccessChain %_ptr_Function_float %color %uint_0 + %245 = OpLoad %float %244 + %246 = OpAccessChain %_ptr_Function_float %color %uint_0 + %247 = OpConvertSToF %float %243 + %248 = OpFAdd %float %245 %247 + OpStore %246 %248 + OpBranch %240 + %240 = OpLabel + %249 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %250 = OpLoad %float %249 + %252 = OpFOrdGreaterThan %bool %250 %float_0_5 + OpSelectionMerge %253 None + OpBranchConditional %252 %254 %253 + %254 = OpLabel + %256 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %257 = OpLoad %int %256 + %259 = OpAccessChain %_ptr_Function_float %color %uint_1 + %260 = OpLoad %float %259 + %261 = OpAccessChain %_ptr_Function_float %color %uint_1 + %262 = OpConvertSToF %float %257 + %263 = OpFAdd %float %260 %262 + OpStore %261 %263 + OpBranch %253 + %253 = OpLabel + %264 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %265 = OpLoad %float %264 + %267 = OpFOrdGreaterThan %bool %265 %float_0_75 + OpSelectionMerge %268 None + OpBranchConditional %267 %269 %268 + %269 = OpLabel + %271 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %272 = OpLoad %int %271 + %274 = OpAccessChain %_ptr_Function_float %color %uint_2 + %275 = OpLoad %float %274 + %276 = OpAccessChain %_ptr_Function_float %color %uint_2 + %277 = OpConvertSToF %float %272 + %278 = OpFAdd %float %275 %277 + OpStore %276 %278 + OpBranch %268 + %268 = OpLabel + %280 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %281 = OpLoad %int %280 + %282 = OpAccessChain %_ptr_Function_float %color %uint_1 + %283 = OpLoad %float %282 + %284 = OpAccessChain %_ptr_Function_float %color %uint_1 + %285 = OpConvertSToF %float %281 + %286 = OpFAdd %float %283 %285 + OpStore %284 %286 + %287 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %288 = OpLoad %float %287 + %289 = OpFOrdGreaterThan %bool %288 %float_0_25 + OpSelectionMerge %290 None + OpBranchConditional %289 %291 %290 + %291 = OpLabel + %293 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %294 = OpLoad %int %293 + %295 = OpAccessChain %_ptr_Function_float %color %uint_0 + %296 = OpLoad %float %295 + %297 = OpAccessChain %_ptr_Function_float %color %uint_0 + %298 = OpConvertSToF %float %294 + %299 = OpFAdd %float %296 %298 + OpStore %297 %299 + OpBranch %290 + %290 = OpLabel + %300 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %301 = OpLoad %float %300 + %302 = OpFOrdGreaterThan %bool %301 %float_0_5 + OpSelectionMerge %303 None + OpBranchConditional %302 %304 %303 + %304 = OpLabel + %306 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %307 = OpLoad %int %306 + %308 = OpAccessChain %_ptr_Function_float %color %uint_1 + %309 = OpLoad %float %308 + %310 = OpAccessChain %_ptr_Function_float %color %uint_1 + %311 = OpConvertSToF %float %307 + %312 = OpFAdd %float %309 %311 + OpStore %310 %312 + OpBranch %303 + %303 = OpLabel + %313 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %314 = OpLoad %float %313 + %315 = OpFOrdGreaterThan %bool %314 %float_0_75 + OpSelectionMerge %316 None + OpBranchConditional %315 %317 %316 + %317 = OpLabel + %319 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %320 = OpLoad %int %319 + %321 = OpAccessChain %_ptr_Function_float %color %uint_2 + %322 = OpLoad %float %321 + %323 = OpAccessChain %_ptr_Function_float %color %uint_2 + %324 = OpConvertSToF %float %320 + %325 = OpFAdd %float %322 %324 + OpStore %323 %325 + OpBranch %316 + %316 = OpLabel + %327 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %328 = OpLoad %int %327 + %329 = OpAccessChain %_ptr_Function_float %color %uint_2 + %330 = OpLoad %float %329 + %331 = OpAccessChain %_ptr_Function_float %color %uint_2 + %332 = OpConvertSToF %float %328 + %333 = OpFAdd %float %330 %332 + OpStore %331 %333 + %334 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %335 = OpLoad %float %334 + %336 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %337 = OpLoad %float %336 + %340 = OpFSub %float %335 %337 + %338 = OpExtInst %float %339 FAbs %340 + %341 = OpFOrdLessThan %bool %338 %float_0_25 + OpSelectionMerge %342 None + OpBranchConditional %341 %343 %342 + %343 = OpLabel + %344 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %345 = OpLoad %int %344 + %346 = OpAccessChain %_ptr_Function_float %color %uint_0 + %347 = OpLoad %float %346 + %348 = OpAccessChain %_ptr_Function_float %color %uint_0 + %349 = OpConvertSToF %float %345 + %350 = OpFAdd %float %347 %349 + OpStore %348 %350 + OpBranch %342 + %342 = OpLabel + %351 = OpLoad %v3float %color + %352 = OpExtInst %v3float %339 Normalize %351 + %353 = OpCompositeExtract %float %352 0 + %354 = OpCompositeExtract %float %352 1 + %355 = OpCompositeExtract %float %352 2 + %356 = OpCompositeConstruct %v4float %353 %354 %355 %float_1 + OpStore %frag_color %356 + %357 = OpLoad %v4float %x_GLF_pos + OpStore %gl_Position %357 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %358 +%tint_symbol_1 = OpFunctionParameter %main_out + %362 = OpLabel + %363 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %363 + %364 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %364 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %29 + %366 = OpLabel + OpStore %tint_pointsize %float_1 + %367 = OpLoad %v4float %tint_symbol + OpStore %x_GLF_pos %367 + %368 = OpFunctionCall %void %main_1 + %370 = OpLoad %v4float %frag_color + %371 = OpLoad %v4float %gl_Position + %372 = OpCompositeConstruct %main_out %370 %371 + %369 = OpFunctionCall %void %tint_symbol_4 %372 + OpReturn + OpFunctionEnd +%swap_i1_i1_ = OpFunction %void None %373 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %377 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %35 + %380 = OpLoad %int %i + %381 = OpAccessChain %_ptr_Private_int %obj %uint_0 %380 + %382 = OpLoad %int %381 + OpStore %temp %382 + %384 = OpLoad %int %i + %386 = OpLoad %int %j + %387 = OpAccessChain %_ptr_Private_int %obj %uint_0 %386 + %388 = OpLoad %int %387 + %389 = OpAccessChain %_ptr_Private_int %obj %uint_0 %384 + OpStore %389 %388 + %391 = OpLoad %int %j + %392 = OpLoad %int %temp + %393 = OpAccessChain %_ptr_Private_int %obj %uint_0 %391 + OpStore %393 %392 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %394 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %398 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %35 + %i_1 = OpVariable %_ptr_Function_int Function %35 + %j_1 = OpVariable %_ptr_Function_int Function %35 + %param = OpVariable %_ptr_Function_int Function %35 + %param_1 = OpVariable %_ptr_Function_int Function %35 + %param_2 = OpVariable %_ptr_Function_int Function %35 + %param_3 = OpVariable %_ptr_Function_int Function %35 + %407 = OpLoad %int %h + %408 = OpAccessChain %_ptr_Private_int %obj %uint_0 %407 + %409 = OpLoad %int %408 + OpStore %pivot %409 + %411 = OpLoad %int %l + %412 = OpISub %int %411 %int_1 + OpStore %i_1 %412 + %414 = OpLoad %int %l + OpStore %j_1 %414 + OpBranch %415 + %415 = OpLabel + OpLoopMerge %416 %417 None + OpBranch %418 + %418 = OpLabel + %419 = OpLoad %int %j_1 + %421 = OpLoad %int %h + %422 = OpISub %int %421 %int_1 + %423 = OpSLessThanEqual %bool %419 %422 + OpSelectionMerge %424 None + OpBranchConditional %423 %425 %426 + %425 = OpLabel + OpBranch %424 + %426 = OpLabel + OpBranch %416 + %424 = OpLabel + %427 = OpLoad %int %j_1 + %428 = OpAccessChain %_ptr_Private_int %obj %uint_0 %427 + %429 = OpLoad %int %428 + %430 = OpLoad %int %pivot + %431 = OpSLessThanEqual %bool %429 %430 + OpSelectionMerge %432 None + OpBranchConditional %431 %433 %432 + %433 = OpLabel + %434 = OpLoad %int %i_1 + %435 = OpIAdd %int %434 %int_1 + OpStore %i_1 %435 + %436 = OpLoad %int %i_1 + OpStore %param %436 + %437 = OpLoad %int %j_1 + OpStore %param_1 %437 + %438 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %432 + %432 = OpLabel + OpBranch %417 + %417 = OpLabel + %441 = OpLoad %int %j_1 + %442 = OpIAdd %int %441 %int_1 + OpStore %j_1 %442 + OpBranch %415 + %416 = OpLabel + %443 = OpLoad %int %i_1 + %444 = OpIAdd %int %443 %int_1 + OpStore %param_2 %444 + %446 = OpLoad %int %h + OpStore %param_3 %446 + %447 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %450 = OpLoad %int %i_1 + %451 = OpIAdd %int %450 %int_1 + OpReturnValue %451 + OpFunctionEnd + %quicksort_ = OpFunction %void None %29 + %453 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %35 + %h_1 = OpVariable %_ptr_Function_int Function %35 + %top = OpVariable %_ptr_Function_int Function %35 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %50 + %p = OpVariable %_ptr_Function_int Function %35 + %param_4 = OpVariable %_ptr_Function_int Function %35 + %param_5 = OpVariable %_ptr_Function_int Function %35 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %461 = OpLoad %int %top + %462 = OpIAdd %int %461 %int_1 + OpStore %top %462 + %463 = OpLoad %int %l_1 + %464 = OpAccessChain %_ptr_Function_int %stack %462 + OpStore %464 %463 + %465 = OpLoad %int %top + %466 = OpIAdd %int %465 %int_1 + OpStore %top %466 + %467 = OpLoad %int %h_1 + %468 = OpAccessChain %_ptr_Function_int %stack %466 + OpStore %468 %467 + OpBranch %469 + %469 = OpLabel + OpLoopMerge %470 %471 None + OpBranch %472 + %472 = OpLabel + %473 = OpLoad %int %top + %474 = OpSGreaterThanEqual %bool %473 %int_0 + OpSelectionMerge %475 None + OpBranchConditional %474 %476 %477 + %476 = OpLabel + OpBranch %475 + %477 = OpLabel + OpBranch %470 + %475 = OpLabel + %478 = OpLoad %int %top + %479 = OpISub %int %478 %int_1 + OpStore %top %479 + %480 = OpAccessChain %_ptr_Function_int %stack %478 + %481 = OpLoad %int %480 + OpStore %h_1 %481 + %482 = OpLoad %int %top + %483 = OpISub %int %482 %int_1 + OpStore %top %483 + %484 = OpAccessChain %_ptr_Function_int %stack %482 + %485 = OpLoad %int %484 + OpStore %l_1 %485 + %486 = OpLoad %int %l_1 + OpStore %param_4 %486 + %487 = OpLoad %int %h_1 + OpStore %param_5 %487 + %488 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %488 + %491 = OpLoad %int %p + %492 = OpLoad %int %l_1 + %493 = OpISub %int %491 %int_1 + %494 = OpSGreaterThan %bool %493 %492 + OpSelectionMerge %495 None + OpBranchConditional %494 %496 %495 + %496 = OpLabel + %497 = OpLoad %int %top + %498 = OpIAdd %int %497 %int_1 + OpStore %top %498 + %499 = OpLoad %int %l_1 + %500 = OpAccessChain %_ptr_Function_int %stack %498 + OpStore %500 %499 + %501 = OpLoad %int %top + %502 = OpIAdd %int %501 %int_1 + OpStore %top %502 + %503 = OpLoad %int %p + %504 = OpAccessChain %_ptr_Function_int %stack %502 + %505 = OpISub %int %503 %int_1 + OpStore %504 %505 + OpBranch %495 + %495 = OpLabel + %506 = OpLoad %int %p + %507 = OpLoad %int %h_1 + %508 = OpIAdd %int %506 %int_1 + %509 = OpSLessThan %bool %508 %507 + OpSelectionMerge %510 None + OpBranchConditional %509 %511 %510 + %511 = OpLabel + %512 = OpLoad %int %top + %513 = OpIAdd %int %512 %int_1 + OpStore %top %513 + %514 = OpLoad %int %p + %515 = OpAccessChain %_ptr_Function_int %stack %513 + %516 = OpIAdd %int %514 %int_1 + OpStore %515 %516 + %517 = OpLoad %int %top + %518 = OpIAdd %int %517 %int_1 + OpStore %top %518 + %519 = OpLoad %int %h_1 + %520 = OpAccessChain %_ptr_Function_int %stack %518 + OpStore %520 %519 + OpBranch %510 + %510 = OpLabel + OpBranch %471 + %471 = OpLabel + OpBranch %469 + %470 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..dcc08359cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.wgsl @@ -0,0 +1,399 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn main_1() { + var x_90 : i32; + var x_91 : i32; + var x_92 : i32; + var x_93 : i32; + var x_94 : i32; + var x_95 : i32; + var x_96 : i32; + var x_97 : i32; + var x_98 : i32; + var x_99 : i32; + var x_100 : i32; + var x_101 : i32; + var x_102 : i32; + var x_103 : array; + var x_104 : i32; + var x_105 : i32; + var x_106 : i32; + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_107 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_107 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_114 : i32 = i_2; + if ((x_114 < 10)) { + } else { + break; + } + let x_117 : i32 = i_2; + let x_118 : i32 = i_2; + obj.numbers[x_117] = (10 - x_118); + let x_121 : i32 = i_2; + let x_122 : i32 = i_2; + let x_124 : i32 = obj.numbers[x_122]; + let x_125 : i32 = i_2; + let x_127 : i32 = obj.numbers[x_125]; + obj.numbers[x_121] = (x_124 * x_127); + + continuing { + let x_130 : i32 = i_2; + i_2 = (x_130 + 1); + } + } + x_100 = 0; + x_101 = 9; + x_102 = -1; + let x_132 : i32 = x_102; + let x_133 : i32 = (x_132 + 1); + x_102 = x_133; + let x_134 : i32 = x_100; + x_103[x_133] = x_134; + let x_136 : i32 = x_102; + let x_137 : i32 = (x_136 + 1); + x_102 = x_137; + let x_138 : i32 = x_101; + x_103[x_137] = x_138; + loop { + let x_144 : i32 = x_102; + if ((x_144 >= 0)) { + } else { + break; + } + let x_147 : i32 = x_102; + x_102 = (x_147 - 1); + let x_150 : i32 = x_103[x_147]; + x_101 = x_150; + let x_151 : i32 = x_102; + x_102 = (x_151 - 1); + let x_154 : i32 = x_103[x_151]; + x_100 = x_154; + let x_155 : i32 = x_100; + x_105 = x_155; + let x_156 : i32 = x_101; + x_106 = x_156; + let x_157 : i32 = x_106; + let x_159 : i32 = obj.numbers[x_157]; + x_92 = x_159; + let x_160 : i32 = x_105; + x_93 = (x_160 - 1); + let x_162 : i32 = x_105; + x_94 = x_162; + loop { + let x_167 : i32 = x_94; + let x_168 : i32 = x_106; + if ((x_167 <= (x_168 - 1))) { + } else { + break; + } + let x_172 : i32 = x_94; + let x_174 : i32 = obj.numbers[x_172]; + let x_175 : i32 = x_92; + if ((x_174 <= x_175)) { + let x_179 : i32 = x_93; + x_93 = (x_179 + 1); + let x_181 : i32 = x_93; + x_95 = x_181; + let x_182 : i32 = x_94; + x_96 = x_182; + let x_183 : i32 = x_95; + let x_185 : i32 = obj.numbers[x_183]; + x_91 = x_185; + let x_186 : i32 = x_95; + let x_187 : i32 = x_96; + let x_189 : i32 = obj.numbers[x_187]; + obj.numbers[x_186] = x_189; + let x_191 : i32 = x_96; + let x_192 : i32 = x_91; + obj.numbers[x_191] = x_192; + } + + continuing { + let x_194 : i32 = x_94; + x_94 = (x_194 + 1); + } + } + let x_196 : i32 = x_93; + x_97 = (x_196 + 1); + let x_198 : i32 = x_106; + x_98 = x_198; + let x_199 : i32 = x_97; + let x_201 : i32 = obj.numbers[x_199]; + x_90 = x_201; + let x_202 : i32 = x_97; + let x_203 : i32 = x_98; + let x_205 : i32 = obj.numbers[x_203]; + obj.numbers[x_202] = x_205; + let x_207 : i32 = x_98; + let x_208 : i32 = x_90; + obj.numbers[x_207] = x_208; + let x_210 : i32 = x_93; + x_99 = (x_210 + 1); + let x_212 : i32 = x_99; + x_104 = x_212; + let x_213 : i32 = x_104; + let x_215 : i32 = x_100; + if (((x_213 - 1) > x_215)) { + let x_219 : i32 = x_102; + let x_220 : i32 = (x_219 + 1); + x_102 = x_220; + let x_221 : i32 = x_100; + x_103[x_220] = x_221; + let x_223 : i32 = x_102; + let x_224 : i32 = (x_223 + 1); + x_102 = x_224; + let x_225 : i32 = x_104; + x_103[x_224] = (x_225 - 1); + } + let x_228 : i32 = x_104; + let x_230 : i32 = x_101; + if (((x_228 + 1) < x_230)) { + let x_234 : i32 = x_102; + let x_235 : i32 = (x_234 + 1); + x_102 = x_235; + let x_236 : i32 = x_104; + x_103[x_235] = (x_236 + 1); + let x_239 : i32 = x_102; + let x_240 : i32 = (x_239 + 1); + x_102 = x_240; + let x_241 : i32 = x_101; + x_103[x_240] = x_241; + } + } + let x_243 : vec4 = x_GLF_FragCoord; + let x_246 : vec2 = x_34.resolution; + uv = (vec2(x_243.x, x_243.y) / x_246); + color = vec3(1.0, 2.0, 3.0); + let x_249 : i32 = obj.numbers[0]; + let x_252 : f32 = color.x; + color.x = (x_252 + f32(x_249)); + let x_256 : f32 = uv.x; + if ((x_256 > 0.25)) { + let x_261 : i32 = obj.numbers[1]; + let x_264 : f32 = color.x; + color.x = (x_264 + f32(x_261)); + } + let x_268 : f32 = uv.x; + if ((x_268 > 0.5)) { + let x_273 : i32 = obj.numbers[2]; + let x_276 : f32 = color.y; + color.y = (x_276 + f32(x_273)); + } + let x_280 : f32 = uv.x; + if ((x_280 > 0.75)) { + let x_285 : i32 = obj.numbers[3]; + let x_288 : f32 = color.z; + color.z = (x_288 + f32(x_285)); + } + let x_292 : i32 = obj.numbers[4]; + let x_295 : f32 = color.y; + color.y = (x_295 + f32(x_292)); + let x_299 : f32 = uv.y; + if ((x_299 > 0.25)) { + let x_304 : i32 = obj.numbers[5]; + let x_307 : f32 = color.x; + color.x = (x_307 + f32(x_304)); + } + let x_311 : f32 = uv.y; + if ((x_311 > 0.5)) { + let x_316 : i32 = obj.numbers[6]; + let x_319 : f32 = color.y; + color.y = (x_319 + f32(x_316)); + } + let x_323 : f32 = uv.y; + if ((x_323 > 0.75)) { + let x_328 : i32 = obj.numbers[7]; + let x_331 : f32 = color.z; + color.z = (x_331 + f32(x_328)); + } + let x_335 : i32 = obj.numbers[8]; + let x_338 : f32 = color.z; + color.z = (x_338 + f32(x_335)); + let x_342 : f32 = uv.x; + let x_344 : f32 = uv.y; + if ((abs((x_342 - x_344)) < 0.25)) { + let x_351 : i32 = obj.numbers[9]; + let x_354 : f32 = color.x; + color.x = (x_354 + f32(x_351)); + } + let x_357 : vec3 = color; + let x_358 : vec3 = normalize(x_357); + frag_color = vec4(x_358.x, x_358.y, x_358.z, 1.0); + let x_363 : vec4 = x_GLF_pos; + gl_Position = x_363; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_366 : i32 = *(i); + let x_368 : i32 = obj.numbers[x_366]; + temp = x_368; + let x_369 : i32 = *(i); + let x_370 : i32 = *(j); + let x_372 : i32 = obj.numbers[x_370]; + obj.numbers[x_369] = x_372; + let x_374 : i32 = *(j); + let x_375 : i32 = temp; + obj.numbers[x_374] = x_375; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_378 : i32 = *(h); + let x_380 : i32 = obj.numbers[x_378]; + pivot = x_380; + let x_381 : i32 = *(l); + i_1 = (x_381 - 1); + let x_383 : i32 = *(l); + j_1 = x_383; + loop { + let x_388 : i32 = j_1; + let x_389 : i32 = *(h); + if ((x_388 <= (x_389 - 1))) { + } else { + break; + } + let x_393 : i32 = j_1; + let x_395 : i32 = obj.numbers[x_393]; + let x_396 : i32 = pivot; + if ((x_395 <= x_396)) { + let x_400 : i32 = i_1; + i_1 = (x_400 + 1); + let x_402 : i32 = i_1; + param = x_402; + let x_403 : i32 = j_1; + param_1 = x_403; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_405 : i32 = j_1; + j_1 = (x_405 + 1); + } + } + let x_407 : i32 = i_1; + param_2 = (x_407 + 1); + let x_409 : i32 = *(h); + param_3 = x_409; + swap_i1_i1_(&(param_2), &(param_3)); + let x_411 : i32 = i_1; + return (x_411 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_414 : i32 = top; + let x_415 : i32 = (x_414 + 1); + top = x_415; + let x_416 : i32 = l_1; + stack[x_415] = x_416; + let x_418 : i32 = top; + let x_419 : i32 = (x_418 + 1); + top = x_419; + let x_420 : i32 = h_1; + stack[x_419] = x_420; + loop { + let x_426 : i32 = top; + if ((x_426 >= 0)) { + } else { + break; + } + let x_429 : i32 = top; + top = (x_429 - 1); + let x_432 : i32 = stack[x_429]; + h_1 = x_432; + let x_433 : i32 = top; + top = (x_433 - 1); + let x_436 : i32 = stack[x_433]; + l_1 = x_436; + let x_437 : i32 = l_1; + param_4 = x_437; + let x_438 : i32 = h_1; + param_5 = x_438; + let x_439 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_439; + let x_440 : i32 = p; + let x_442 : i32 = l_1; + if (((x_440 - 1) > x_442)) { + let x_446 : i32 = top; + let x_447 : i32 = (x_446 + 1); + top = x_447; + let x_448 : i32 = l_1; + stack[x_447] = x_448; + let x_450 : i32 = top; + let x_451 : i32 = (x_450 + 1); + top = x_451; + let x_452 : i32 = p; + stack[x_451] = (x_452 - 1); + } + let x_455 : i32 = p; + let x_457 : i32 = h_1; + if (((x_455 + 1) < x_457)) { + let x_461 : i32 = top; + let x_462 : i32 = (x_461 + 1); + top = x_462; + let x_463 : i32 = p; + stack[x_462] = (x_463 + 1); + let x_466 : i32 = top; + let x_467 : i32 = (x_466 + 1); + top = x_467; + let x_468 : i32 = h_1; + stack[x_467] = x_468; + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl new file mode 100644 index 0000000000..dcc08359cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl @@ -0,0 +1,399 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn main_1() { + var x_90 : i32; + var x_91 : i32; + var x_92 : i32; + var x_93 : i32; + var x_94 : i32; + var x_95 : i32; + var x_96 : i32; + var x_97 : i32; + var x_98 : i32; + var x_99 : i32; + var x_100 : i32; + var x_101 : i32; + var x_102 : i32; + var x_103 : array; + var x_104 : i32; + var x_105 : i32; + var x_106 : i32; + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_107 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_107 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_114 : i32 = i_2; + if ((x_114 < 10)) { + } else { + break; + } + let x_117 : i32 = i_2; + let x_118 : i32 = i_2; + obj.numbers[x_117] = (10 - x_118); + let x_121 : i32 = i_2; + let x_122 : i32 = i_2; + let x_124 : i32 = obj.numbers[x_122]; + let x_125 : i32 = i_2; + let x_127 : i32 = obj.numbers[x_125]; + obj.numbers[x_121] = (x_124 * x_127); + + continuing { + let x_130 : i32 = i_2; + i_2 = (x_130 + 1); + } + } + x_100 = 0; + x_101 = 9; + x_102 = -1; + let x_132 : i32 = x_102; + let x_133 : i32 = (x_132 + 1); + x_102 = x_133; + let x_134 : i32 = x_100; + x_103[x_133] = x_134; + let x_136 : i32 = x_102; + let x_137 : i32 = (x_136 + 1); + x_102 = x_137; + let x_138 : i32 = x_101; + x_103[x_137] = x_138; + loop { + let x_144 : i32 = x_102; + if ((x_144 >= 0)) { + } else { + break; + } + let x_147 : i32 = x_102; + x_102 = (x_147 - 1); + let x_150 : i32 = x_103[x_147]; + x_101 = x_150; + let x_151 : i32 = x_102; + x_102 = (x_151 - 1); + let x_154 : i32 = x_103[x_151]; + x_100 = x_154; + let x_155 : i32 = x_100; + x_105 = x_155; + let x_156 : i32 = x_101; + x_106 = x_156; + let x_157 : i32 = x_106; + let x_159 : i32 = obj.numbers[x_157]; + x_92 = x_159; + let x_160 : i32 = x_105; + x_93 = (x_160 - 1); + let x_162 : i32 = x_105; + x_94 = x_162; + loop { + let x_167 : i32 = x_94; + let x_168 : i32 = x_106; + if ((x_167 <= (x_168 - 1))) { + } else { + break; + } + let x_172 : i32 = x_94; + let x_174 : i32 = obj.numbers[x_172]; + let x_175 : i32 = x_92; + if ((x_174 <= x_175)) { + let x_179 : i32 = x_93; + x_93 = (x_179 + 1); + let x_181 : i32 = x_93; + x_95 = x_181; + let x_182 : i32 = x_94; + x_96 = x_182; + let x_183 : i32 = x_95; + let x_185 : i32 = obj.numbers[x_183]; + x_91 = x_185; + let x_186 : i32 = x_95; + let x_187 : i32 = x_96; + let x_189 : i32 = obj.numbers[x_187]; + obj.numbers[x_186] = x_189; + let x_191 : i32 = x_96; + let x_192 : i32 = x_91; + obj.numbers[x_191] = x_192; + } + + continuing { + let x_194 : i32 = x_94; + x_94 = (x_194 + 1); + } + } + let x_196 : i32 = x_93; + x_97 = (x_196 + 1); + let x_198 : i32 = x_106; + x_98 = x_198; + let x_199 : i32 = x_97; + let x_201 : i32 = obj.numbers[x_199]; + x_90 = x_201; + let x_202 : i32 = x_97; + let x_203 : i32 = x_98; + let x_205 : i32 = obj.numbers[x_203]; + obj.numbers[x_202] = x_205; + let x_207 : i32 = x_98; + let x_208 : i32 = x_90; + obj.numbers[x_207] = x_208; + let x_210 : i32 = x_93; + x_99 = (x_210 + 1); + let x_212 : i32 = x_99; + x_104 = x_212; + let x_213 : i32 = x_104; + let x_215 : i32 = x_100; + if (((x_213 - 1) > x_215)) { + let x_219 : i32 = x_102; + let x_220 : i32 = (x_219 + 1); + x_102 = x_220; + let x_221 : i32 = x_100; + x_103[x_220] = x_221; + let x_223 : i32 = x_102; + let x_224 : i32 = (x_223 + 1); + x_102 = x_224; + let x_225 : i32 = x_104; + x_103[x_224] = (x_225 - 1); + } + let x_228 : i32 = x_104; + let x_230 : i32 = x_101; + if (((x_228 + 1) < x_230)) { + let x_234 : i32 = x_102; + let x_235 : i32 = (x_234 + 1); + x_102 = x_235; + let x_236 : i32 = x_104; + x_103[x_235] = (x_236 + 1); + let x_239 : i32 = x_102; + let x_240 : i32 = (x_239 + 1); + x_102 = x_240; + let x_241 : i32 = x_101; + x_103[x_240] = x_241; + } + } + let x_243 : vec4 = x_GLF_FragCoord; + let x_246 : vec2 = x_34.resolution; + uv = (vec2(x_243.x, x_243.y) / x_246); + color = vec3(1.0, 2.0, 3.0); + let x_249 : i32 = obj.numbers[0]; + let x_252 : f32 = color.x; + color.x = (x_252 + f32(x_249)); + let x_256 : f32 = uv.x; + if ((x_256 > 0.25)) { + let x_261 : i32 = obj.numbers[1]; + let x_264 : f32 = color.x; + color.x = (x_264 + f32(x_261)); + } + let x_268 : f32 = uv.x; + if ((x_268 > 0.5)) { + let x_273 : i32 = obj.numbers[2]; + let x_276 : f32 = color.y; + color.y = (x_276 + f32(x_273)); + } + let x_280 : f32 = uv.x; + if ((x_280 > 0.75)) { + let x_285 : i32 = obj.numbers[3]; + let x_288 : f32 = color.z; + color.z = (x_288 + f32(x_285)); + } + let x_292 : i32 = obj.numbers[4]; + let x_295 : f32 = color.y; + color.y = (x_295 + f32(x_292)); + let x_299 : f32 = uv.y; + if ((x_299 > 0.25)) { + let x_304 : i32 = obj.numbers[5]; + let x_307 : f32 = color.x; + color.x = (x_307 + f32(x_304)); + } + let x_311 : f32 = uv.y; + if ((x_311 > 0.5)) { + let x_316 : i32 = obj.numbers[6]; + let x_319 : f32 = color.y; + color.y = (x_319 + f32(x_316)); + } + let x_323 : f32 = uv.y; + if ((x_323 > 0.75)) { + let x_328 : i32 = obj.numbers[7]; + let x_331 : f32 = color.z; + color.z = (x_331 + f32(x_328)); + } + let x_335 : i32 = obj.numbers[8]; + let x_338 : f32 = color.z; + color.z = (x_338 + f32(x_335)); + let x_342 : f32 = uv.x; + let x_344 : f32 = uv.y; + if ((abs((x_342 - x_344)) < 0.25)) { + let x_351 : i32 = obj.numbers[9]; + let x_354 : f32 = color.x; + color.x = (x_354 + f32(x_351)); + } + let x_357 : vec3 = color; + let x_358 : vec3 = normalize(x_357); + frag_color = vec4(x_358.x, x_358.y, x_358.z, 1.0); + let x_363 : vec4 = x_GLF_pos; + gl_Position = x_363; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_366 : i32 = *(i); + let x_368 : i32 = obj.numbers[x_366]; + temp = x_368; + let x_369 : i32 = *(i); + let x_370 : i32 = *(j); + let x_372 : i32 = obj.numbers[x_370]; + obj.numbers[x_369] = x_372; + let x_374 : i32 = *(j); + let x_375 : i32 = temp; + obj.numbers[x_374] = x_375; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_378 : i32 = *(h); + let x_380 : i32 = obj.numbers[x_378]; + pivot = x_380; + let x_381 : i32 = *(l); + i_1 = (x_381 - 1); + let x_383 : i32 = *(l); + j_1 = x_383; + loop { + let x_388 : i32 = j_1; + let x_389 : i32 = *(h); + if ((x_388 <= (x_389 - 1))) { + } else { + break; + } + let x_393 : i32 = j_1; + let x_395 : i32 = obj.numbers[x_393]; + let x_396 : i32 = pivot; + if ((x_395 <= x_396)) { + let x_400 : i32 = i_1; + i_1 = (x_400 + 1); + let x_402 : i32 = i_1; + param = x_402; + let x_403 : i32 = j_1; + param_1 = x_403; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_405 : i32 = j_1; + j_1 = (x_405 + 1); + } + } + let x_407 : i32 = i_1; + param_2 = (x_407 + 1); + let x_409 : i32 = *(h); + param_3 = x_409; + swap_i1_i1_(&(param_2), &(param_3)); + let x_411 : i32 = i_1; + return (x_411 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_414 : i32 = top; + let x_415 : i32 = (x_414 + 1); + top = x_415; + let x_416 : i32 = l_1; + stack[x_415] = x_416; + let x_418 : i32 = top; + let x_419 : i32 = (x_418 + 1); + top = x_419; + let x_420 : i32 = h_1; + stack[x_419] = x_420; + loop { + let x_426 : i32 = top; + if ((x_426 >= 0)) { + } else { + break; + } + let x_429 : i32 = top; + top = (x_429 - 1); + let x_432 : i32 = stack[x_429]; + h_1 = x_432; + let x_433 : i32 = top; + top = (x_433 - 1); + let x_436 : i32 = stack[x_433]; + l_1 = x_436; + let x_437 : i32 = l_1; + param_4 = x_437; + let x_438 : i32 = h_1; + param_5 = x_438; + let x_439 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_439; + let x_440 : i32 = p; + let x_442 : i32 = l_1; + if (((x_440 - 1) > x_442)) { + let x_446 : i32 = top; + let x_447 : i32 = (x_446 + 1); + top = x_447; + let x_448 : i32 = l_1; + stack[x_447] = x_448; + let x_450 : i32 = top; + let x_451 : i32 = (x_450 + 1); + top = x_451; + let x_452 : i32 = p; + stack[x_451] = (x_452 - 1); + } + let x_455 : i32 = p; + let x_457 : i32 = h_1; + if (((x_455 + 1) < x_457)) { + let x_461 : i32 = top; + let x_462 : i32 = (x_461 + 1); + top = x_462; + let x_463 : i32 = p; + stack[x_462] = (x_463 + 1); + let x_466 : i32 = top; + let x_467 : i32 = (x_466 + 1); + top = x_467; + let x_468 : i32 = h_1; + stack[x_467] = x_468; + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..99862c315c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.hlsl @@ -0,0 +1,306 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_34 : register(b0, space0) { + uint4 x_34[1]; +}; +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x_90 = 0; + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94 = 0; + int x_95 = 0; + int x_96 = 0; + int x_97 = 0; + int x_98 = 0; + int x_99 = 0; + int x_100 = 0; + int x_101 = 0; + int x_102 = 0; + int x_103[10] = (int[10])0; + int x_104 = 0; + int x_105 = 0; + int x_106 = 0; + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_121 = i_2; + const int x_124 = obj.numbers[i_2]; + const int x_127 = obj.numbers[i_2]; + obj.numbers[x_121] = (x_124 * x_127); + } + } + x_100 = 0; + x_101 = 9; + x_102 = -1; + const int x_133 = (x_102 + 1); + x_102 = x_133; + x_103[x_133] = x_100; + const int x_137 = (x_102 + 1); + x_102 = x_137; + x_103[x_137] = x_101; + while (true) { + if ((x_102 >= 0)) { + } else { + break; + } + const int x_147 = x_102; + x_102 = (x_147 - 1); + const int x_150 = x_103[x_147]; + x_101 = x_150; + const int x_151 = x_102; + x_102 = (x_151 - 1); + const int x_154 = x_103[x_151]; + x_100 = x_154; + x_105 = x_100; + x_106 = x_101; + const int x_159 = obj.numbers[x_106]; + x_92 = x_159; + x_93 = (x_105 - 1); + x_94 = x_105; + { + for(; (x_94 <= (x_106 - 1)); x_94 = (x_94 + 1)) { + const int x_174 = obj.numbers[x_94]; + if ((x_174 <= x_92)) { + x_93 = (x_93 + 1); + x_95 = x_93; + x_96 = x_94; + const int x_185 = obj.numbers[x_95]; + x_91 = x_185; + const int x_186 = x_95; + const int x_189 = obj.numbers[x_96]; + obj.numbers[x_186] = x_189; + obj.numbers[x_96] = x_91; + } + } + } + x_97 = (x_93 + 1); + x_98 = x_106; + const int x_201 = obj.numbers[x_97]; + x_90 = x_201; + const int x_202 = x_97; + const int x_205 = obj.numbers[x_98]; + obj.numbers[x_202] = x_205; + obj.numbers[x_98] = x_90; + x_99 = (x_93 + 1); + x_104 = x_99; + if (((x_104 - 1) > x_100)) { + const int x_220 = (x_102 + 1); + x_102 = x_220; + x_103[x_220] = x_100; + const int x_224 = (x_102 + 1); + x_102 = x_224; + x_103[x_224] = (x_104 - 1); + } + if (((x_104 + 1) < x_101)) { + const int x_235 = (x_102 + 1); + x_102 = x_235; + x_103[x_235] = (x_104 + 1); + const int x_240 = (x_102 + 1); + x_102 = x_240; + x_103[x_240] = x_101; + } + } + const float4 x_243 = x_GLF_FragCoord; + const float2 x_246 = asfloat(x_34[0].xy); + uv = (float2(x_243.x, x_243.y) / x_246); + color = float3(1.0f, 2.0f, 3.0f); + const int x_249 = obj.numbers[0]; + const float x_252 = color.x; + color.x = (x_252 + float(x_249)); + const float x_256 = uv.x; + if ((x_256 > 0.25f)) { + const int x_261 = obj.numbers[1]; + const float x_264 = color.x; + color.x = (x_264 + float(x_261)); + } + const float x_268 = uv.x; + if ((x_268 > 0.5f)) { + const int x_273 = obj.numbers[2]; + const float x_276 = color.y; + color.y = (x_276 + float(x_273)); + } + const float x_280 = uv.x; + if ((x_280 > 0.75f)) { + const int x_285 = obj.numbers[3]; + const float x_288 = color.z; + color.z = (x_288 + float(x_285)); + } + const int x_292 = obj.numbers[4]; + const float x_295 = color.y; + color.y = (x_295 + float(x_292)); + const float x_299 = uv.y; + if ((x_299 > 0.25f)) { + const int x_304 = obj.numbers[5]; + const float x_307 = color.x; + color.x = (x_307 + float(x_304)); + } + const float x_311 = uv.y; + if ((x_311 > 0.5f)) { + const int x_316 = obj.numbers[6]; + const float x_319 = color.y; + color.y = (x_319 + float(x_316)); + } + const float x_323 = uv.y; + if ((x_323 > 0.75f)) { + const int x_328 = obj.numbers[7]; + const float x_331 = color.z; + color.z = (x_331 + float(x_328)); + } + const int x_335 = obj.numbers[8]; + const float x_338 = color.z; + color.z = (x_338 + float(x_335)); + const float x_342 = uv.x; + const float x_344 = uv.y; + if ((abs((x_342 - x_344)) < 0.25f)) { + const int x_351 = obj.numbers[9]; + const float x_354 = color.x; + color.x = (x_354 + float(x_351)); + } + const float3 x_358 = normalize(color); + frag_color = float4(x_358.x, x_358.y, x_358.z, 1.0f); + gl_Position = x_GLF_pos; + return; +} + +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 x_GLF_pos_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_GLF_pos_param = tint_symbol.x_GLF_pos_param; + x_GLF_pos = x_GLF_pos_param; + main_1(); + const main_out tint_symbol_3 = {frag_color, gl_Position}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_5; +} + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_366 = i; + const int x_368 = obj.numbers[x_366]; + temp = x_368; + const int x_369 = i; + const int x_370 = j; + const int x_372 = obj.numbers[x_370]; + obj.numbers[x_369] = x_372; + const int x_374 = j; + obj.numbers[x_374] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_378 = h; + const int x_380 = obj.numbers[x_378]; + pivot = x_380; + const int x_381 = l; + i_1 = (x_381 - 1); + const int x_383 = l; + j_1 = x_383; + while (true) { + const int x_388 = j_1; + const int x_389 = h; + if ((x_388 <= (x_389 - 1))) { + } else { + break; + } + const int x_395 = obj.numbers[j_1]; + if ((x_395 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + param_2 = (i_1 + 1); + const int x_409 = h; + param_3 = x_409; + swap_i1_i1_(param_2, param_3); + return (i_1 + 1); +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_415 = (top + 1); + top = x_415; + stack[x_415] = l_1; + const int x_419 = (top + 1); + top = x_419; + stack[x_419] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_429 = top; + top = (x_429 - 1); + const int x_432 = stack[x_429]; + h_1 = x_432; + const int x_433 = top; + top = (x_433 - 1); + const int x_436 = stack[x_433]; + l_1 = x_436; + param_4 = l_1; + param_5 = h_1; + const int x_439 = performPartition_i1_i1_(param_4, param_5); + p = x_439; + if (((p - 1) > l_1)) { + const int x_447 = (top + 1); + top = x_447; + stack[x_447] = l_1; + const int x_451 = (top + 1); + top = x_451; + stack[x_451] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_462 = (top + 1); + top = x_462; + stack[x_462] = (p + 1); + const int x_467 = (top + 1); + top = x_467; + stack[x_467] = h_1; + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.msl new file mode 100644 index 0000000000..45ba09a9e3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.msl @@ -0,0 +1,400 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_pos_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void main_1(constant buf0& x_34, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7, thread QuicksortObject* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { + int x_90 = 0; + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94 = 0; + int x_95 = 0; + int x_96 = 0; + int x_97 = 0; + int x_98 = 0; + int x_99 = 0; + int x_100 = 0; + int x_101 = 0; + int x_102 = 0; + tint_array_wrapper x_103 = {}; + int x_104 = 0; + int x_105 = 0; + int x_106 = 0; + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + float4 const x_107 = *(tint_symbol_6); + *(tint_symbol_7) = ((x_107 + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + while (true) { + int const x_114 = i_2; + if ((x_114 < 10)) { + } else { + break; + } + int const x_117 = i_2; + int const x_118 = i_2; + (*(tint_symbol_8)).numbers.arr[x_117] = (10 - x_118); + int const x_121 = i_2; + int const x_122 = i_2; + int const x_124 = (*(tint_symbol_8)).numbers.arr[x_122]; + int const x_125 = i_2; + int const x_127 = (*(tint_symbol_8)).numbers.arr[x_125]; + (*(tint_symbol_8)).numbers.arr[x_121] = (x_124 * x_127); + { + int const x_130 = i_2; + i_2 = (x_130 + 1); + } + } + x_100 = 0; + x_101 = 9; + x_102 = -1; + int const x_132 = x_102; + int const x_133 = (x_132 + 1); + x_102 = x_133; + int const x_134 = x_100; + x_103.arr[x_133] = x_134; + int const x_136 = x_102; + int const x_137 = (x_136 + 1); + x_102 = x_137; + int const x_138 = x_101; + x_103.arr[x_137] = x_138; + while (true) { + int const x_144 = x_102; + if ((x_144 >= 0)) { + } else { + break; + } + int const x_147 = x_102; + x_102 = (x_147 - 1); + int const x_150 = x_103.arr[x_147]; + x_101 = x_150; + int const x_151 = x_102; + x_102 = (x_151 - 1); + int const x_154 = x_103.arr[x_151]; + x_100 = x_154; + int const x_155 = x_100; + x_105 = x_155; + int const x_156 = x_101; + x_106 = x_156; + int const x_157 = x_106; + int const x_159 = (*(tint_symbol_8)).numbers.arr[x_157]; + x_92 = x_159; + int const x_160 = x_105; + x_93 = (x_160 - 1); + int const x_162 = x_105; + x_94 = x_162; + while (true) { + int const x_167 = x_94; + int const x_168 = x_106; + if ((x_167 <= (x_168 - 1))) { + } else { + break; + } + int const x_172 = x_94; + int const x_174 = (*(tint_symbol_8)).numbers.arr[x_172]; + int const x_175 = x_92; + if ((x_174 <= x_175)) { + int const x_179 = x_93; + x_93 = (x_179 + 1); + int const x_181 = x_93; + x_95 = x_181; + int const x_182 = x_94; + x_96 = x_182; + int const x_183 = x_95; + int const x_185 = (*(tint_symbol_8)).numbers.arr[x_183]; + x_91 = x_185; + int const x_186 = x_95; + int const x_187 = x_96; + int const x_189 = (*(tint_symbol_8)).numbers.arr[x_187]; + (*(tint_symbol_8)).numbers.arr[x_186] = x_189; + int const x_191 = x_96; + int const x_192 = x_91; + (*(tint_symbol_8)).numbers.arr[x_191] = x_192; + } + { + int const x_194 = x_94; + x_94 = (x_194 + 1); + } + } + int const x_196 = x_93; + x_97 = (x_196 + 1); + int const x_198 = x_106; + x_98 = x_198; + int const x_199 = x_97; + int const x_201 = (*(tint_symbol_8)).numbers.arr[x_199]; + x_90 = x_201; + int const x_202 = x_97; + int const x_203 = x_98; + int const x_205 = (*(tint_symbol_8)).numbers.arr[x_203]; + (*(tint_symbol_8)).numbers.arr[x_202] = x_205; + int const x_207 = x_98; + int const x_208 = x_90; + (*(tint_symbol_8)).numbers.arr[x_207] = x_208; + int const x_210 = x_93; + x_99 = (x_210 + 1); + int const x_212 = x_99; + x_104 = x_212; + int const x_213 = x_104; + int const x_215 = x_100; + if (((x_213 - 1) > x_215)) { + int const x_219 = x_102; + int const x_220 = (x_219 + 1); + x_102 = x_220; + int const x_221 = x_100; + x_103.arr[x_220] = x_221; + int const x_223 = x_102; + int const x_224 = (x_223 + 1); + x_102 = x_224; + int const x_225 = x_104; + x_103.arr[x_224] = (x_225 - 1); + } + int const x_228 = x_104; + int const x_230 = x_101; + if (((x_228 + 1) < x_230)) { + int const x_234 = x_102; + int const x_235 = (x_234 + 1); + x_102 = x_235; + int const x_236 = x_104; + x_103.arr[x_235] = (x_236 + 1); + int const x_239 = x_102; + int const x_240 = (x_239 + 1); + x_102 = x_240; + int const x_241 = x_101; + x_103.arr[x_240] = x_241; + } + } + float4 const x_243 = *(tint_symbol_7); + float2 const x_246 = x_34.resolution; + uv = (float2(x_243.x, x_243.y) / x_246); + color = float3(1.0f, 2.0f, 3.0f); + int const x_249 = (*(tint_symbol_8)).numbers.arr[0]; + float const x_252 = color.x; + color.x = (x_252 + float(x_249)); + float const x_256 = uv.x; + if ((x_256 > 0.25f)) { + int const x_261 = (*(tint_symbol_8)).numbers.arr[1]; + float const x_264 = color.x; + color.x = (x_264 + float(x_261)); + } + float const x_268 = uv.x; + if ((x_268 > 0.5f)) { + int const x_273 = (*(tint_symbol_8)).numbers.arr[2]; + float const x_276 = color.y; + color.y = (x_276 + float(x_273)); + } + float const x_280 = uv.x; + if ((x_280 > 0.75f)) { + int const x_285 = (*(tint_symbol_8)).numbers.arr[3]; + float const x_288 = color.z; + color.z = (x_288 + float(x_285)); + } + int const x_292 = (*(tint_symbol_8)).numbers.arr[4]; + float const x_295 = color.y; + color.y = (x_295 + float(x_292)); + float const x_299 = uv.y; + if ((x_299 > 0.25f)) { + int const x_304 = (*(tint_symbol_8)).numbers.arr[5]; + float const x_307 = color.x; + color.x = (x_307 + float(x_304)); + } + float const x_311 = uv.y; + if ((x_311 > 0.5f)) { + int const x_316 = (*(tint_symbol_8)).numbers.arr[6]; + float const x_319 = color.y; + color.y = (x_319 + float(x_316)); + } + float const x_323 = uv.y; + if ((x_323 > 0.75f)) { + int const x_328 = (*(tint_symbol_8)).numbers.arr[7]; + float const x_331 = color.z; + color.z = (x_331 + float(x_328)); + } + int const x_335 = (*(tint_symbol_8)).numbers.arr[8]; + float const x_338 = color.z; + color.z = (x_338 + float(x_335)); + float const x_342 = uv.x; + float const x_344 = uv.y; + if ((fabs((x_342 - x_344)) < 0.25f)) { + int const x_351 = (*(tint_symbol_8)).numbers.arr[9]; + float const x_354 = color.x; + color.x = (x_354 + float(x_351)); + } + float3 const x_357 = color; + float3 const x_358 = normalize(x_357); + *(tint_symbol_9) = float4(x_358.x, x_358.y, x_358.z, 1.0f); + float4 const x_363 = *(tint_symbol_6); + *(tint_symbol_10) = x_363; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant buf0& x_34 [[buffer(0)]]) { + thread float4 tint_symbol_11 = 0.0f; + thread float4 tint_symbol_12 = 0.0f; + thread QuicksortObject tint_symbol_13 = {}; + thread float4 tint_symbol_14 = 0.0f; + thread float4 tint_symbol_15 = 0.0f; + float4 const x_GLF_pos_param = tint_symbol_1.x_GLF_pos_param; + tint_symbol_11 = x_GLF_pos_param; + main_1(x_34, &(tint_symbol_11), &(tint_symbol_12), &(tint_symbol_13), &(tint_symbol_14), &(tint_symbol_15)); + main_out const tint_symbol_4 = {.frag_color_1=tint_symbol_14, .gl_Position=tint_symbol_15}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_16) { + int temp = 0; + int const x_366 = *(i); + int const x_368 = (*(tint_symbol_16)).numbers.arr[x_366]; + temp = x_368; + int const x_369 = *(i); + int const x_370 = *(j); + int const x_372 = (*(tint_symbol_16)).numbers.arr[x_370]; + (*(tint_symbol_16)).numbers.arr[x_369] = x_372; + int const x_374 = *(j); + int const x_375 = temp; + (*(tint_symbol_16)).numbers.arr[x_374] = x_375; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_17) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_378 = *(h); + int const x_380 = (*(tint_symbol_17)).numbers.arr[x_378]; + pivot = x_380; + int const x_381 = *(l); + i_1 = (x_381 - 1); + int const x_383 = *(l); + j_1 = x_383; + while (true) { + int const x_388 = j_1; + int const x_389 = *(h); + if ((x_388 <= (x_389 - 1))) { + } else { + break; + } + int const x_393 = j_1; + int const x_395 = (*(tint_symbol_17)).numbers.arr[x_393]; + int const x_396 = pivot; + if ((x_395 <= x_396)) { + int const x_400 = i_1; + i_1 = (x_400 + 1); + int const x_402 = i_1; + param = x_402; + int const x_403 = j_1; + param_1 = x_403; + swap_i1_i1_(&(param), &(param_1), tint_symbol_17); + } + { + int const x_405 = j_1; + j_1 = (x_405 + 1); + } + } + int const x_407 = i_1; + param_2 = (x_407 + 1); + int const x_409 = *(h); + param_3 = x_409; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_17); + int const x_411 = i_1; + return (x_411 + 1); +} + +void quicksort_(thread QuicksortObject* const tint_symbol_18) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_414 = top; + int const x_415 = (x_414 + 1); + top = x_415; + int const x_416 = l_1; + stack.arr[x_415] = x_416; + int const x_418 = top; + int const x_419 = (x_418 + 1); + top = x_419; + int const x_420 = h_1; + stack.arr[x_419] = x_420; + while (true) { + int const x_426 = top; + if ((x_426 >= 0)) { + } else { + break; + } + int const x_429 = top; + top = (x_429 - 1); + int const x_432 = stack.arr[x_429]; + h_1 = x_432; + int const x_433 = top; + top = (x_433 - 1); + int const x_436 = stack.arr[x_433]; + l_1 = x_436; + int const x_437 = l_1; + param_4 = x_437; + int const x_438 = h_1; + param_5 = x_438; + int const x_439 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_18); + p = x_439; + int const x_440 = p; + int const x_442 = l_1; + if (((x_440 - 1) > x_442)) { + int const x_446 = top; + int const x_447 = (x_446 + 1); + top = x_447; + int const x_448 = l_1; + stack.arr[x_447] = x_448; + int const x_450 = top; + int const x_451 = (x_450 + 1); + top = x_451; + int const x_452 = p; + stack.arr[x_451] = (x_452 - 1); + } + int const x_455 = p; + int const x_457 = h_1; + if (((x_455 + 1) < x_457)) { + int const x_461 = top; + int const x_462 = (x_461 + 1); + top = x_462; + int const x_463 = p; + stack.arr[x_462] = (x_463 + 1); + int const x_466 = top; + int const x_467 = (x_466 + 1); + top = x_467; + int const x_468 = h_1; + stack.arr[x_467] = x_468; + } + } + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..6f5c5f8917 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.spvasm @@ -0,0 +1,780 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 521 +; Schema: 0 + OpCapability Shader + %339 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %x_GLF_FragCoord "x_GLF_FragCoord" + OpName %x_GLF_pos "x_GLF_pos" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_34 "x_34" + OpName %frag_color "frag_color" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %x_90 "x_90" + OpName %x_91 "x_91" + OpName %x_92 "x_92" + OpName %x_93 "x_93" + OpName %x_94 "x_94" + OpName %x_95 "x_95" + OpName %x_96 "x_96" + OpName %x_97 "x_97" + OpName %x_98 "x_98" + OpName %x_99 "x_99" + OpName %x_100 "x_100" + OpName %x_101 "x_101" + OpName %x_102 "x_102" + OpName %x_103 "x_103" + OpName %x_104 "x_104" + OpName %x_105 "x_105" + OpName %x_106 "x_106" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "frag_color_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpDecorate %tint_pointsize BuiltIn PointSize + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_34 NonWritable + OpDecorate %x_34 DescriptorSet 0 + OpDecorate %x_34 Binding 0 + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_3 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %12 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private %16 + %x_GLF_pos = OpVariable %_ptr_Private_v4float Private %16 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_34 = OpVariable %_ptr_Uniform_buf0 Uniform + %frag_color = OpVariable %_ptr_Private_v4float Private %16 +%gl_Position = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %16 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %29 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %35 = OpConstantNull %int +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %50 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %57 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %61 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %65 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %68 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %227 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float %v4float + %358 = OpTypeFunction %void %main_out + %373 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %394 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %main_1 = OpFunction %void None %29 + %32 = OpLabel + %x_90 = OpVariable %_ptr_Function_int Function %35 + %x_91 = OpVariable %_ptr_Function_int Function %35 + %x_92 = OpVariable %_ptr_Function_int Function %35 + %x_93 = OpVariable %_ptr_Function_int Function %35 + %x_94 = OpVariable %_ptr_Function_int Function %35 + %x_95 = OpVariable %_ptr_Function_int Function %35 + %x_96 = OpVariable %_ptr_Function_int Function %35 + %x_97 = OpVariable %_ptr_Function_int Function %35 + %x_98 = OpVariable %_ptr_Function_int Function %35 + %x_99 = OpVariable %_ptr_Function_int Function %35 + %x_100 = OpVariable %_ptr_Function_int Function %35 + %x_101 = OpVariable %_ptr_Function_int Function %35 + %x_102 = OpVariable %_ptr_Function_int Function %35 + %x_103 = OpVariable %_ptr_Function__arr_int_uint_10 Function %50 + %x_104 = OpVariable %_ptr_Function_int Function %35 + %x_105 = OpVariable %_ptr_Function_int Function %35 + %x_106 = OpVariable %_ptr_Function_int Function %35 + %i_2 = OpVariable %_ptr_Function_int Function %35 + %uv = OpVariable %_ptr_Function_v2float Function %57 + %color = OpVariable %_ptr_Function_v3float Function %61 + %62 = OpLoad %v4float %x_GLF_pos + %66 = OpFAdd %v4float %62 %65 + %69 = OpFMul %v4float %66 %68 + OpStore %x_GLF_FragCoord %69 + OpStore %i_2 %int_0 + OpBranch %71 + %71 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %74 + %74 = OpLabel + %75 = OpLoad %int %i_2 + %77 = OpSLessThan %bool %75 %int_10 + OpSelectionMerge %79 None + OpBranchConditional %77 %80 %81 + %80 = OpLabel + OpBranch %79 + %81 = OpLabel + OpBranch %72 + %79 = OpLabel + %82 = OpLoad %int %i_2 + %83 = OpLoad %int %i_2 + %86 = OpAccessChain %_ptr_Private_int %obj %uint_0 %82 + %87 = OpISub %int %int_10 %83 + OpStore %86 %87 + %88 = OpLoad %int %i_2 + %89 = OpLoad %int %i_2 + %90 = OpAccessChain %_ptr_Private_int %obj %uint_0 %89 + %91 = OpLoad %int %90 + %92 = OpLoad %int %i_2 + %93 = OpAccessChain %_ptr_Private_int %obj %uint_0 %92 + %94 = OpLoad %int %93 + %95 = OpAccessChain %_ptr_Private_int %obj %uint_0 %88 + %96 = OpIMul %int %91 %94 + OpStore %95 %96 + OpBranch %73 + %73 = OpLabel + %97 = OpLoad %int %i_2 + %99 = OpIAdd %int %97 %int_1 + OpStore %i_2 %99 + OpBranch %71 + %72 = OpLabel + OpStore %x_100 %int_0 + OpStore %x_101 %int_9 + OpStore %x_102 %int_n1 + %102 = OpLoad %int %x_102 + %103 = OpIAdd %int %102 %int_1 + OpStore %x_102 %103 + %104 = OpLoad %int %x_100 + %105 = OpAccessChain %_ptr_Function_int %x_103 %103 + OpStore %105 %104 + %106 = OpLoad %int %x_102 + %107 = OpIAdd %int %106 %int_1 + OpStore %x_102 %107 + %108 = OpLoad %int %x_101 + %109 = OpAccessChain %_ptr_Function_int %x_103 %107 + OpStore %109 %108 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %int %x_102 + %115 = OpSGreaterThanEqual %bool %114 %int_0 + OpSelectionMerge %116 None + OpBranchConditional %115 %117 %118 + %117 = OpLabel + OpBranch %116 + %118 = OpLabel + OpBranch %111 + %116 = OpLabel + %119 = OpLoad %int %x_102 + %120 = OpISub %int %119 %int_1 + OpStore %x_102 %120 + %121 = OpAccessChain %_ptr_Function_int %x_103 %119 + %122 = OpLoad %int %121 + OpStore %x_101 %122 + %123 = OpLoad %int %x_102 + %124 = OpISub %int %123 %int_1 + OpStore %x_102 %124 + %125 = OpAccessChain %_ptr_Function_int %x_103 %123 + %126 = OpLoad %int %125 + OpStore %x_100 %126 + %127 = OpLoad %int %x_100 + OpStore %x_105 %127 + %128 = OpLoad %int %x_101 + OpStore %x_106 %128 + %129 = OpLoad %int %x_106 + %130 = OpAccessChain %_ptr_Private_int %obj %uint_0 %129 + %131 = OpLoad %int %130 + OpStore %x_92 %131 + %132 = OpLoad %int %x_105 + %133 = OpISub %int %132 %int_1 + OpStore %x_93 %133 + %134 = OpLoad %int %x_105 + OpStore %x_94 %134 + OpBranch %135 + %135 = OpLabel + OpLoopMerge %136 %137 None + OpBranch %138 + %138 = OpLabel + %139 = OpLoad %int %x_94 + %140 = OpLoad %int %x_106 + %141 = OpISub %int %140 %int_1 + %142 = OpSLessThanEqual %bool %139 %141 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %145 + %144 = OpLabel + OpBranch %143 + %145 = OpLabel + OpBranch %136 + %143 = OpLabel + %146 = OpLoad %int %x_94 + %147 = OpAccessChain %_ptr_Private_int %obj %uint_0 %146 + %148 = OpLoad %int %147 + %149 = OpLoad %int %x_92 + %150 = OpSLessThanEqual %bool %148 %149 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %151 + %152 = OpLabel + %153 = OpLoad %int %x_93 + %154 = OpIAdd %int %153 %int_1 + OpStore %x_93 %154 + %155 = OpLoad %int %x_93 + OpStore %x_95 %155 + %156 = OpLoad %int %x_94 + OpStore %x_96 %156 + %157 = OpLoad %int %x_95 + %158 = OpAccessChain %_ptr_Private_int %obj %uint_0 %157 + %159 = OpLoad %int %158 + OpStore %x_91 %159 + %160 = OpLoad %int %x_95 + %161 = OpLoad %int %x_96 + %162 = OpAccessChain %_ptr_Private_int %obj %uint_0 %161 + %163 = OpLoad %int %162 + %164 = OpAccessChain %_ptr_Private_int %obj %uint_0 %160 + OpStore %164 %163 + %165 = OpLoad %int %x_96 + %166 = OpLoad %int %x_91 + %167 = OpAccessChain %_ptr_Private_int %obj %uint_0 %165 + OpStore %167 %166 + OpBranch %151 + %151 = OpLabel + OpBranch %137 + %137 = OpLabel + %168 = OpLoad %int %x_94 + %169 = OpIAdd %int %168 %int_1 + OpStore %x_94 %169 + OpBranch %135 + %136 = OpLabel + %170 = OpLoad %int %x_93 + %171 = OpIAdd %int %170 %int_1 + OpStore %x_97 %171 + %172 = OpLoad %int %x_106 + OpStore %x_98 %172 + %173 = OpLoad %int %x_97 + %174 = OpAccessChain %_ptr_Private_int %obj %uint_0 %173 + %175 = OpLoad %int %174 + OpStore %x_90 %175 + %176 = OpLoad %int %x_97 + %177 = OpLoad %int %x_98 + %178 = OpAccessChain %_ptr_Private_int %obj %uint_0 %177 + %179 = OpLoad %int %178 + %180 = OpAccessChain %_ptr_Private_int %obj %uint_0 %176 + OpStore %180 %179 + %181 = OpLoad %int %x_98 + %182 = OpLoad %int %x_90 + %183 = OpAccessChain %_ptr_Private_int %obj %uint_0 %181 + OpStore %183 %182 + %184 = OpLoad %int %x_93 + %185 = OpIAdd %int %184 %int_1 + OpStore %x_99 %185 + %186 = OpLoad %int %x_99 + OpStore %x_104 %186 + %187 = OpLoad %int %x_104 + %188 = OpLoad %int %x_100 + %189 = OpISub %int %187 %int_1 + %190 = OpSGreaterThan %bool %189 %188 + OpSelectionMerge %191 None + OpBranchConditional %190 %192 %191 + %192 = OpLabel + %193 = OpLoad %int %x_102 + %194 = OpIAdd %int %193 %int_1 + OpStore %x_102 %194 + %195 = OpLoad %int %x_100 + %196 = OpAccessChain %_ptr_Function_int %x_103 %194 + OpStore %196 %195 + %197 = OpLoad %int %x_102 + %198 = OpIAdd %int %197 %int_1 + OpStore %x_102 %198 + %199 = OpLoad %int %x_104 + %200 = OpAccessChain %_ptr_Function_int %x_103 %198 + %201 = OpISub %int %199 %int_1 + OpStore %200 %201 + OpBranch %191 + %191 = OpLabel + %202 = OpLoad %int %x_104 + %203 = OpLoad %int %x_101 + %204 = OpIAdd %int %202 %int_1 + %205 = OpSLessThan %bool %204 %203 + OpSelectionMerge %206 None + OpBranchConditional %205 %207 %206 + %207 = OpLabel + %208 = OpLoad %int %x_102 + %209 = OpIAdd %int %208 %int_1 + OpStore %x_102 %209 + %210 = OpLoad %int %x_104 + %211 = OpAccessChain %_ptr_Function_int %x_103 %209 + %212 = OpIAdd %int %210 %int_1 + OpStore %211 %212 + %213 = OpLoad %int %x_102 + %214 = OpIAdd %int %213 %int_1 + OpStore %x_102 %214 + %215 = OpLoad %int %x_101 + %216 = OpAccessChain %_ptr_Function_int %x_103 %214 + OpStore %216 %215 + OpBranch %206 + %206 = OpLabel + OpBranch %112 + %112 = OpLabel + OpBranch %110 + %111 = OpLabel + %217 = OpLoad %v4float %x_GLF_FragCoord + %219 = OpAccessChain %_ptr_Uniform_v2float %x_34 %uint_0 + %220 = OpLoad %v2float %219 + %221 = OpCompositeExtract %float %217 0 + %222 = OpCompositeExtract %float %217 1 + %223 = OpCompositeConstruct %v2float %221 %222 + %224 = OpFDiv %v2float %223 %220 + OpStore %uv %224 + OpStore %color %227 + %228 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %229 = OpLoad %int %228 + %231 = OpAccessChain %_ptr_Function_float %color %uint_0 + %232 = OpLoad %float %231 + %233 = OpAccessChain %_ptr_Function_float %color %uint_0 + %234 = OpConvertSToF %float %229 + %235 = OpFAdd %float %232 %234 + OpStore %233 %235 + %236 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %237 = OpLoad %float %236 + %239 = OpFOrdGreaterThan %bool %237 %float_0_25 + OpSelectionMerge %240 None + OpBranchConditional %239 %241 %240 + %241 = OpLabel + %242 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %243 = OpLoad %int %242 + %244 = OpAccessChain %_ptr_Function_float %color %uint_0 + %245 = OpLoad %float %244 + %246 = OpAccessChain %_ptr_Function_float %color %uint_0 + %247 = OpConvertSToF %float %243 + %248 = OpFAdd %float %245 %247 + OpStore %246 %248 + OpBranch %240 + %240 = OpLabel + %249 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %250 = OpLoad %float %249 + %252 = OpFOrdGreaterThan %bool %250 %float_0_5 + OpSelectionMerge %253 None + OpBranchConditional %252 %254 %253 + %254 = OpLabel + %256 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %257 = OpLoad %int %256 + %259 = OpAccessChain %_ptr_Function_float %color %uint_1 + %260 = OpLoad %float %259 + %261 = OpAccessChain %_ptr_Function_float %color %uint_1 + %262 = OpConvertSToF %float %257 + %263 = OpFAdd %float %260 %262 + OpStore %261 %263 + OpBranch %253 + %253 = OpLabel + %264 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %265 = OpLoad %float %264 + %267 = OpFOrdGreaterThan %bool %265 %float_0_75 + OpSelectionMerge %268 None + OpBranchConditional %267 %269 %268 + %269 = OpLabel + %271 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %272 = OpLoad %int %271 + %274 = OpAccessChain %_ptr_Function_float %color %uint_2 + %275 = OpLoad %float %274 + %276 = OpAccessChain %_ptr_Function_float %color %uint_2 + %277 = OpConvertSToF %float %272 + %278 = OpFAdd %float %275 %277 + OpStore %276 %278 + OpBranch %268 + %268 = OpLabel + %280 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %281 = OpLoad %int %280 + %282 = OpAccessChain %_ptr_Function_float %color %uint_1 + %283 = OpLoad %float %282 + %284 = OpAccessChain %_ptr_Function_float %color %uint_1 + %285 = OpConvertSToF %float %281 + %286 = OpFAdd %float %283 %285 + OpStore %284 %286 + %287 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %288 = OpLoad %float %287 + %289 = OpFOrdGreaterThan %bool %288 %float_0_25 + OpSelectionMerge %290 None + OpBranchConditional %289 %291 %290 + %291 = OpLabel + %293 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %294 = OpLoad %int %293 + %295 = OpAccessChain %_ptr_Function_float %color %uint_0 + %296 = OpLoad %float %295 + %297 = OpAccessChain %_ptr_Function_float %color %uint_0 + %298 = OpConvertSToF %float %294 + %299 = OpFAdd %float %296 %298 + OpStore %297 %299 + OpBranch %290 + %290 = OpLabel + %300 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %301 = OpLoad %float %300 + %302 = OpFOrdGreaterThan %bool %301 %float_0_5 + OpSelectionMerge %303 None + OpBranchConditional %302 %304 %303 + %304 = OpLabel + %306 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %307 = OpLoad %int %306 + %308 = OpAccessChain %_ptr_Function_float %color %uint_1 + %309 = OpLoad %float %308 + %310 = OpAccessChain %_ptr_Function_float %color %uint_1 + %311 = OpConvertSToF %float %307 + %312 = OpFAdd %float %309 %311 + OpStore %310 %312 + OpBranch %303 + %303 = OpLabel + %313 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %314 = OpLoad %float %313 + %315 = OpFOrdGreaterThan %bool %314 %float_0_75 + OpSelectionMerge %316 None + OpBranchConditional %315 %317 %316 + %317 = OpLabel + %319 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %320 = OpLoad %int %319 + %321 = OpAccessChain %_ptr_Function_float %color %uint_2 + %322 = OpLoad %float %321 + %323 = OpAccessChain %_ptr_Function_float %color %uint_2 + %324 = OpConvertSToF %float %320 + %325 = OpFAdd %float %322 %324 + OpStore %323 %325 + OpBranch %316 + %316 = OpLabel + %327 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %328 = OpLoad %int %327 + %329 = OpAccessChain %_ptr_Function_float %color %uint_2 + %330 = OpLoad %float %329 + %331 = OpAccessChain %_ptr_Function_float %color %uint_2 + %332 = OpConvertSToF %float %328 + %333 = OpFAdd %float %330 %332 + OpStore %331 %333 + %334 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %335 = OpLoad %float %334 + %336 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %337 = OpLoad %float %336 + %340 = OpFSub %float %335 %337 + %338 = OpExtInst %float %339 FAbs %340 + %341 = OpFOrdLessThan %bool %338 %float_0_25 + OpSelectionMerge %342 None + OpBranchConditional %341 %343 %342 + %343 = OpLabel + %344 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %345 = OpLoad %int %344 + %346 = OpAccessChain %_ptr_Function_float %color %uint_0 + %347 = OpLoad %float %346 + %348 = OpAccessChain %_ptr_Function_float %color %uint_0 + %349 = OpConvertSToF %float %345 + %350 = OpFAdd %float %347 %349 + OpStore %348 %350 + OpBranch %342 + %342 = OpLabel + %351 = OpLoad %v3float %color + %352 = OpExtInst %v3float %339 Normalize %351 + %353 = OpCompositeExtract %float %352 0 + %354 = OpCompositeExtract %float %352 1 + %355 = OpCompositeExtract %float %352 2 + %356 = OpCompositeConstruct %v4float %353 %354 %355 %float_1 + OpStore %frag_color %356 + %357 = OpLoad %v4float %x_GLF_pos + OpStore %gl_Position %357 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %358 +%tint_symbol_1 = OpFunctionParameter %main_out + %362 = OpLabel + %363 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %363 + %364 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %364 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %29 + %366 = OpLabel + OpStore %tint_pointsize %float_1 + %367 = OpLoad %v4float %tint_symbol + OpStore %x_GLF_pos %367 + %368 = OpFunctionCall %void %main_1 + %370 = OpLoad %v4float %frag_color + %371 = OpLoad %v4float %gl_Position + %372 = OpCompositeConstruct %main_out %370 %371 + %369 = OpFunctionCall %void %tint_symbol_4 %372 + OpReturn + OpFunctionEnd +%swap_i1_i1_ = OpFunction %void None %373 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %377 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %35 + %380 = OpLoad %int %i + %381 = OpAccessChain %_ptr_Private_int %obj %uint_0 %380 + %382 = OpLoad %int %381 + OpStore %temp %382 + %384 = OpLoad %int %i + %386 = OpLoad %int %j + %387 = OpAccessChain %_ptr_Private_int %obj %uint_0 %386 + %388 = OpLoad %int %387 + %389 = OpAccessChain %_ptr_Private_int %obj %uint_0 %384 + OpStore %389 %388 + %391 = OpLoad %int %j + %392 = OpLoad %int %temp + %393 = OpAccessChain %_ptr_Private_int %obj %uint_0 %391 + OpStore %393 %392 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %394 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %398 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %35 + %i_1 = OpVariable %_ptr_Function_int Function %35 + %j_1 = OpVariable %_ptr_Function_int Function %35 + %param = OpVariable %_ptr_Function_int Function %35 + %param_1 = OpVariable %_ptr_Function_int Function %35 + %param_2 = OpVariable %_ptr_Function_int Function %35 + %param_3 = OpVariable %_ptr_Function_int Function %35 + %407 = OpLoad %int %h + %408 = OpAccessChain %_ptr_Private_int %obj %uint_0 %407 + %409 = OpLoad %int %408 + OpStore %pivot %409 + %411 = OpLoad %int %l + %412 = OpISub %int %411 %int_1 + OpStore %i_1 %412 + %414 = OpLoad %int %l + OpStore %j_1 %414 + OpBranch %415 + %415 = OpLabel + OpLoopMerge %416 %417 None + OpBranch %418 + %418 = OpLabel + %419 = OpLoad %int %j_1 + %421 = OpLoad %int %h + %422 = OpISub %int %421 %int_1 + %423 = OpSLessThanEqual %bool %419 %422 + OpSelectionMerge %424 None + OpBranchConditional %423 %425 %426 + %425 = OpLabel + OpBranch %424 + %426 = OpLabel + OpBranch %416 + %424 = OpLabel + %427 = OpLoad %int %j_1 + %428 = OpAccessChain %_ptr_Private_int %obj %uint_0 %427 + %429 = OpLoad %int %428 + %430 = OpLoad %int %pivot + %431 = OpSLessThanEqual %bool %429 %430 + OpSelectionMerge %432 None + OpBranchConditional %431 %433 %432 + %433 = OpLabel + %434 = OpLoad %int %i_1 + %435 = OpIAdd %int %434 %int_1 + OpStore %i_1 %435 + %436 = OpLoad %int %i_1 + OpStore %param %436 + %437 = OpLoad %int %j_1 + OpStore %param_1 %437 + %438 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %432 + %432 = OpLabel + OpBranch %417 + %417 = OpLabel + %441 = OpLoad %int %j_1 + %442 = OpIAdd %int %441 %int_1 + OpStore %j_1 %442 + OpBranch %415 + %416 = OpLabel + %443 = OpLoad %int %i_1 + %444 = OpIAdd %int %443 %int_1 + OpStore %param_2 %444 + %446 = OpLoad %int %h + OpStore %param_3 %446 + %447 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %450 = OpLoad %int %i_1 + %451 = OpIAdd %int %450 %int_1 + OpReturnValue %451 + OpFunctionEnd + %quicksort_ = OpFunction %void None %29 + %453 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %35 + %h_1 = OpVariable %_ptr_Function_int Function %35 + %top = OpVariable %_ptr_Function_int Function %35 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %50 + %p = OpVariable %_ptr_Function_int Function %35 + %param_4 = OpVariable %_ptr_Function_int Function %35 + %param_5 = OpVariable %_ptr_Function_int Function %35 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %461 = OpLoad %int %top + %462 = OpIAdd %int %461 %int_1 + OpStore %top %462 + %463 = OpLoad %int %l_1 + %464 = OpAccessChain %_ptr_Function_int %stack %462 + OpStore %464 %463 + %465 = OpLoad %int %top + %466 = OpIAdd %int %465 %int_1 + OpStore %top %466 + %467 = OpLoad %int %h_1 + %468 = OpAccessChain %_ptr_Function_int %stack %466 + OpStore %468 %467 + OpBranch %469 + %469 = OpLabel + OpLoopMerge %470 %471 None + OpBranch %472 + %472 = OpLabel + %473 = OpLoad %int %top + %474 = OpSGreaterThanEqual %bool %473 %int_0 + OpSelectionMerge %475 None + OpBranchConditional %474 %476 %477 + %476 = OpLabel + OpBranch %475 + %477 = OpLabel + OpBranch %470 + %475 = OpLabel + %478 = OpLoad %int %top + %479 = OpISub %int %478 %int_1 + OpStore %top %479 + %480 = OpAccessChain %_ptr_Function_int %stack %478 + %481 = OpLoad %int %480 + OpStore %h_1 %481 + %482 = OpLoad %int %top + %483 = OpISub %int %482 %int_1 + OpStore %top %483 + %484 = OpAccessChain %_ptr_Function_int %stack %482 + %485 = OpLoad %int %484 + OpStore %l_1 %485 + %486 = OpLoad %int %l_1 + OpStore %param_4 %486 + %487 = OpLoad %int %h_1 + OpStore %param_5 %487 + %488 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %488 + %491 = OpLoad %int %p + %492 = OpLoad %int %l_1 + %493 = OpISub %int %491 %int_1 + %494 = OpSGreaterThan %bool %493 %492 + OpSelectionMerge %495 None + OpBranchConditional %494 %496 %495 + %496 = OpLabel + %497 = OpLoad %int %top + %498 = OpIAdd %int %497 %int_1 + OpStore %top %498 + %499 = OpLoad %int %l_1 + %500 = OpAccessChain %_ptr_Function_int %stack %498 + OpStore %500 %499 + %501 = OpLoad %int %top + %502 = OpIAdd %int %501 %int_1 + OpStore %top %502 + %503 = OpLoad %int %p + %504 = OpAccessChain %_ptr_Function_int %stack %502 + %505 = OpISub %int %503 %int_1 + OpStore %504 %505 + OpBranch %495 + %495 = OpLabel + %506 = OpLoad %int %p + %507 = OpLoad %int %h_1 + %508 = OpIAdd %int %506 %int_1 + %509 = OpSLessThan %bool %508 %507 + OpSelectionMerge %510 None + OpBranchConditional %509 %511 %510 + %511 = OpLabel + %512 = OpLoad %int %top + %513 = OpIAdd %int %512 %int_1 + OpStore %top %513 + %514 = OpLoad %int %p + %515 = OpAccessChain %_ptr_Function_int %stack %513 + %516 = OpIAdd %int %514 %int_1 + OpStore %515 %516 + %517 = OpLoad %int %top + %518 = OpIAdd %int %517 %int_1 + OpStore %top %518 + %519 = OpLoad %int %h_1 + %520 = OpAccessChain %_ptr_Function_int %stack %518 + OpStore %520 %519 + OpBranch %510 + %510 = OpLabel + OpBranch %471 + %471 = OpLabel + OpBranch %469 + %470 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..dcc08359cb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.wgsl @@ -0,0 +1,399 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn main_1() { + var x_90 : i32; + var x_91 : i32; + var x_92 : i32; + var x_93 : i32; + var x_94 : i32; + var x_95 : i32; + var x_96 : i32; + var x_97 : i32; + var x_98 : i32; + var x_99 : i32; + var x_100 : i32; + var x_101 : i32; + var x_102 : i32; + var x_103 : array; + var x_104 : i32; + var x_105 : i32; + var x_106 : i32; + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_107 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_107 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_114 : i32 = i_2; + if ((x_114 < 10)) { + } else { + break; + } + let x_117 : i32 = i_2; + let x_118 : i32 = i_2; + obj.numbers[x_117] = (10 - x_118); + let x_121 : i32 = i_2; + let x_122 : i32 = i_2; + let x_124 : i32 = obj.numbers[x_122]; + let x_125 : i32 = i_2; + let x_127 : i32 = obj.numbers[x_125]; + obj.numbers[x_121] = (x_124 * x_127); + + continuing { + let x_130 : i32 = i_2; + i_2 = (x_130 + 1); + } + } + x_100 = 0; + x_101 = 9; + x_102 = -1; + let x_132 : i32 = x_102; + let x_133 : i32 = (x_132 + 1); + x_102 = x_133; + let x_134 : i32 = x_100; + x_103[x_133] = x_134; + let x_136 : i32 = x_102; + let x_137 : i32 = (x_136 + 1); + x_102 = x_137; + let x_138 : i32 = x_101; + x_103[x_137] = x_138; + loop { + let x_144 : i32 = x_102; + if ((x_144 >= 0)) { + } else { + break; + } + let x_147 : i32 = x_102; + x_102 = (x_147 - 1); + let x_150 : i32 = x_103[x_147]; + x_101 = x_150; + let x_151 : i32 = x_102; + x_102 = (x_151 - 1); + let x_154 : i32 = x_103[x_151]; + x_100 = x_154; + let x_155 : i32 = x_100; + x_105 = x_155; + let x_156 : i32 = x_101; + x_106 = x_156; + let x_157 : i32 = x_106; + let x_159 : i32 = obj.numbers[x_157]; + x_92 = x_159; + let x_160 : i32 = x_105; + x_93 = (x_160 - 1); + let x_162 : i32 = x_105; + x_94 = x_162; + loop { + let x_167 : i32 = x_94; + let x_168 : i32 = x_106; + if ((x_167 <= (x_168 - 1))) { + } else { + break; + } + let x_172 : i32 = x_94; + let x_174 : i32 = obj.numbers[x_172]; + let x_175 : i32 = x_92; + if ((x_174 <= x_175)) { + let x_179 : i32 = x_93; + x_93 = (x_179 + 1); + let x_181 : i32 = x_93; + x_95 = x_181; + let x_182 : i32 = x_94; + x_96 = x_182; + let x_183 : i32 = x_95; + let x_185 : i32 = obj.numbers[x_183]; + x_91 = x_185; + let x_186 : i32 = x_95; + let x_187 : i32 = x_96; + let x_189 : i32 = obj.numbers[x_187]; + obj.numbers[x_186] = x_189; + let x_191 : i32 = x_96; + let x_192 : i32 = x_91; + obj.numbers[x_191] = x_192; + } + + continuing { + let x_194 : i32 = x_94; + x_94 = (x_194 + 1); + } + } + let x_196 : i32 = x_93; + x_97 = (x_196 + 1); + let x_198 : i32 = x_106; + x_98 = x_198; + let x_199 : i32 = x_97; + let x_201 : i32 = obj.numbers[x_199]; + x_90 = x_201; + let x_202 : i32 = x_97; + let x_203 : i32 = x_98; + let x_205 : i32 = obj.numbers[x_203]; + obj.numbers[x_202] = x_205; + let x_207 : i32 = x_98; + let x_208 : i32 = x_90; + obj.numbers[x_207] = x_208; + let x_210 : i32 = x_93; + x_99 = (x_210 + 1); + let x_212 : i32 = x_99; + x_104 = x_212; + let x_213 : i32 = x_104; + let x_215 : i32 = x_100; + if (((x_213 - 1) > x_215)) { + let x_219 : i32 = x_102; + let x_220 : i32 = (x_219 + 1); + x_102 = x_220; + let x_221 : i32 = x_100; + x_103[x_220] = x_221; + let x_223 : i32 = x_102; + let x_224 : i32 = (x_223 + 1); + x_102 = x_224; + let x_225 : i32 = x_104; + x_103[x_224] = (x_225 - 1); + } + let x_228 : i32 = x_104; + let x_230 : i32 = x_101; + if (((x_228 + 1) < x_230)) { + let x_234 : i32 = x_102; + let x_235 : i32 = (x_234 + 1); + x_102 = x_235; + let x_236 : i32 = x_104; + x_103[x_235] = (x_236 + 1); + let x_239 : i32 = x_102; + let x_240 : i32 = (x_239 + 1); + x_102 = x_240; + let x_241 : i32 = x_101; + x_103[x_240] = x_241; + } + } + let x_243 : vec4 = x_GLF_FragCoord; + let x_246 : vec2 = x_34.resolution; + uv = (vec2(x_243.x, x_243.y) / x_246); + color = vec3(1.0, 2.0, 3.0); + let x_249 : i32 = obj.numbers[0]; + let x_252 : f32 = color.x; + color.x = (x_252 + f32(x_249)); + let x_256 : f32 = uv.x; + if ((x_256 > 0.25)) { + let x_261 : i32 = obj.numbers[1]; + let x_264 : f32 = color.x; + color.x = (x_264 + f32(x_261)); + } + let x_268 : f32 = uv.x; + if ((x_268 > 0.5)) { + let x_273 : i32 = obj.numbers[2]; + let x_276 : f32 = color.y; + color.y = (x_276 + f32(x_273)); + } + let x_280 : f32 = uv.x; + if ((x_280 > 0.75)) { + let x_285 : i32 = obj.numbers[3]; + let x_288 : f32 = color.z; + color.z = (x_288 + f32(x_285)); + } + let x_292 : i32 = obj.numbers[4]; + let x_295 : f32 = color.y; + color.y = (x_295 + f32(x_292)); + let x_299 : f32 = uv.y; + if ((x_299 > 0.25)) { + let x_304 : i32 = obj.numbers[5]; + let x_307 : f32 = color.x; + color.x = (x_307 + f32(x_304)); + } + let x_311 : f32 = uv.y; + if ((x_311 > 0.5)) { + let x_316 : i32 = obj.numbers[6]; + let x_319 : f32 = color.y; + color.y = (x_319 + f32(x_316)); + } + let x_323 : f32 = uv.y; + if ((x_323 > 0.75)) { + let x_328 : i32 = obj.numbers[7]; + let x_331 : f32 = color.z; + color.z = (x_331 + f32(x_328)); + } + let x_335 : i32 = obj.numbers[8]; + let x_338 : f32 = color.z; + color.z = (x_338 + f32(x_335)); + let x_342 : f32 = uv.x; + let x_344 : f32 = uv.y; + if ((abs((x_342 - x_344)) < 0.25)) { + let x_351 : i32 = obj.numbers[9]; + let x_354 : f32 = color.x; + color.x = (x_354 + f32(x_351)); + } + let x_357 : vec3 = color; + let x_358 : vec3 = normalize(x_357); + frag_color = vec4(x_358.x, x_358.y, x_358.z, 1.0); + let x_363 : vec4 = x_GLF_pos; + gl_Position = x_363; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_366 : i32 = *(i); + let x_368 : i32 = obj.numbers[x_366]; + temp = x_368; + let x_369 : i32 = *(i); + let x_370 : i32 = *(j); + let x_372 : i32 = obj.numbers[x_370]; + obj.numbers[x_369] = x_372; + let x_374 : i32 = *(j); + let x_375 : i32 = temp; + obj.numbers[x_374] = x_375; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_378 : i32 = *(h); + let x_380 : i32 = obj.numbers[x_378]; + pivot = x_380; + let x_381 : i32 = *(l); + i_1 = (x_381 - 1); + let x_383 : i32 = *(l); + j_1 = x_383; + loop { + let x_388 : i32 = j_1; + let x_389 : i32 = *(h); + if ((x_388 <= (x_389 - 1))) { + } else { + break; + } + let x_393 : i32 = j_1; + let x_395 : i32 = obj.numbers[x_393]; + let x_396 : i32 = pivot; + if ((x_395 <= x_396)) { + let x_400 : i32 = i_1; + i_1 = (x_400 + 1); + let x_402 : i32 = i_1; + param = x_402; + let x_403 : i32 = j_1; + param_1 = x_403; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_405 : i32 = j_1; + j_1 = (x_405 + 1); + } + } + let x_407 : i32 = i_1; + param_2 = (x_407 + 1); + let x_409 : i32 = *(h); + param_3 = x_409; + swap_i1_i1_(&(param_2), &(param_3)); + let x_411 : i32 = i_1; + return (x_411 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_414 : i32 = top; + let x_415 : i32 = (x_414 + 1); + top = x_415; + let x_416 : i32 = l_1; + stack[x_415] = x_416; + let x_418 : i32 = top; + let x_419 : i32 = (x_418 + 1); + top = x_419; + let x_420 : i32 = h_1; + stack[x_419] = x_420; + loop { + let x_426 : i32 = top; + if ((x_426 >= 0)) { + } else { + break; + } + let x_429 : i32 = top; + top = (x_429 - 1); + let x_432 : i32 = stack[x_429]; + h_1 = x_432; + let x_433 : i32 = top; + top = (x_433 - 1); + let x_436 : i32 = stack[x_433]; + l_1 = x_436; + let x_437 : i32 = l_1; + param_4 = x_437; + let x_438 : i32 = h_1; + param_5 = x_438; + let x_439 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_439; + let x_440 : i32 = p; + let x_442 : i32 = l_1; + if (((x_440 - 1) > x_442)) { + let x_446 : i32 = top; + let x_447 : i32 = (x_446 + 1); + top = x_447; + let x_448 : i32 = l_1; + stack[x_447] = x_448; + let x_450 : i32 = top; + let x_451 : i32 = (x_450 + 1); + top = x_451; + let x_452 : i32 = p; + stack[x_451] = (x_452 - 1); + } + let x_455 : i32 = p; + let x_457 : i32 = h_1; + if (((x_455 + 1) < x_457)) { + let x_461 : i32 = top; + let x_462 : i32 = (x_461 + 1); + top = x_462; + let x_463 : i32 = p; + stack[x_462] = (x_463 + 1); + let x_466 : i32 = top; + let x_467 : i32 = (x_466 + 1); + top = x_467; + let x_468 : i32 = h_1; + stack[x_467] = x_468; + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm new file mode 100644 index 0000000000..2355739d5a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm @@ -0,0 +1,636 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_GLF_pos %frag_color %__0 + OpSource ESSL 310 + OpName %main "main" + OpName %swap_i1_i1_ "swap(i1;i1;" + OpName %i "i" + OpName %j "j" + OpName %performPartition_i1_i1_ "performPartition(i1;i1;" + OpName %l "l" + OpName %h "h" + OpName %quicksort_ "quicksort(" + OpName %temp "temp" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %pivot "pivot" + OpName %i_0 "i" + OpName %j_0 "j" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %l_0 "l" + OpName %h_0 "h" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %_GLF_FragCoord "_GLF_FragCoord" + OpName %_GLF_pos "_GLF_pos" + OpName %i_1 "i" + OpName %uv "uv" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %color "color" + OpName %frag_color "frag_color" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpName %__0 "" + OpDecorate %_GLF_pos Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %frag_color Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %38 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %41 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %42 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float +%_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private +%_ptr_Input_v4float = OpTypePointer Input %v4float + %_GLF_pos = OpVariable %_ptr_Input_v4float Input + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %61 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %63 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_10 = OpConstant %int 10 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %73 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %frag_color = OpVariable %_ptr_Output_v4float Output +%gl_PerVertex = OpTypeStruct %v4float %float +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__0 = OpVariable %_ptr_Output_gl_PerVertex Output + %main = OpFunction %void None %38 + %90 = OpLabel + %91 = OpVariable %_ptr_Function_int Function + %92 = OpVariable %_ptr_Function_int Function + %93 = OpVariable %_ptr_Function_int Function + %94 = OpVariable %_ptr_Function__arr_int_uint_10 Function + %95 = OpVariable %_ptr_Function_int Function + %96 = OpVariable %_ptr_Function_int Function + %97 = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %uv = OpVariable %_ptr_Function_v2float Function + %color = OpVariable %_ptr_Function_v3float Function + %98 = OpLoad %v4float %_GLF_pos + %99 = OpFAdd %v4float %98 %61 + %100 = OpFMul %v4float %99 %63 + OpStore %_GLF_FragCoord %100 + OpStore %i_1 %int_0 + OpBranch %101 + %101 = OpLabel + OpLoopMerge %102 %103 None + OpBranch %104 + %104 = OpLabel + %105 = OpLoad %int %i_1 + %106 = OpSLessThan %bool %105 %int_10 + OpBranchConditional %106 %107 %102 + %107 = OpLabel + %108 = OpLoad %int %i_1 + %109 = OpLoad %int %i_1 + %110 = OpISub %int %int_10 %109 + %111 = OpAccessChain %_ptr_Private_int %obj %int_0 %108 + OpStore %111 %110 + %112 = OpLoad %int %i_1 + %113 = OpLoad %int %i_1 + %114 = OpAccessChain %_ptr_Private_int %obj %int_0 %113 + %115 = OpLoad %int %114 + %116 = OpLoad %int %i_1 + %117 = OpAccessChain %_ptr_Private_int %obj %int_0 %116 + %118 = OpLoad %int %117 + %119 = OpIMul %int %115 %118 + %120 = OpAccessChain %_ptr_Private_int %obj %int_0 %112 + OpStore %120 %119 + OpBranch %103 + %103 = OpLabel + %121 = OpLoad %int %i_1 + %122 = OpIAdd %int %121 %int_1 + OpStore %i_1 %122 + OpBranch %101 + %102 = OpLabel + OpStore %91 %int_0 + OpStore %92 %int_9 + OpStore %93 %int_n1 + %123 = OpLoad %int %93 + %124 = OpIAdd %int %123 %int_1 + OpStore %93 %124 + %125 = OpLoad %int %91 + %126 = OpAccessChain %_ptr_Function_int %94 %124 + OpStore %126 %125 + %127 = OpLoad %int %93 + %128 = OpIAdd %int %127 %int_1 + OpStore %93 %128 + %129 = OpLoad %int %92 + %130 = OpAccessChain %_ptr_Function_int %94 %128 + OpStore %130 %129 + OpBranch %131 + %131 = OpLabel + OpLoopMerge %132 %133 None + OpBranch %134 + %134 = OpLabel + %135 = OpLoad %int %93 + %136 = OpSGreaterThanEqual %bool %135 %int_0 + OpBranchConditional %136 %137 %132 + %137 = OpLabel + %138 = OpLoad %int %93 + %139 = OpISub %int %138 %int_1 + OpStore %93 %139 + %140 = OpAccessChain %_ptr_Function_int %94 %138 + %141 = OpLoad %int %140 + OpStore %92 %141 + %142 = OpLoad %int %93 + %143 = OpISub %int %142 %int_1 + OpStore %93 %143 + %144 = OpAccessChain %_ptr_Function_int %94 %142 + %145 = OpLoad %int %144 + OpStore %91 %145 + %146 = OpLoad %int %91 + OpStore %96 %146 + %147 = OpLoad %int %92 + OpStore %97 %147 + %148 = OpFunctionCall %int %performPartition_i1_i1_ %96 %97 + OpStore %95 %148 + %149 = OpLoad %int %95 + %150 = OpISub %int %149 %int_1 + %151 = OpLoad %int %91 + %152 = OpSGreaterThan %bool %150 %151 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + %155 = OpLoad %int %93 + %156 = OpIAdd %int %155 %int_1 + OpStore %93 %156 + %157 = OpLoad %int %91 + %158 = OpAccessChain %_ptr_Function_int %94 %156 + OpStore %158 %157 + %159 = OpLoad %int %93 + %160 = OpIAdd %int %159 %int_1 + OpStore %93 %160 + %161 = OpLoad %int %95 + %162 = OpISub %int %161 %int_1 + %163 = OpAccessChain %_ptr_Function_int %94 %160 + OpStore %163 %162 + OpBranch %153 + %153 = OpLabel + %164 = OpLoad %int %95 + %165 = OpIAdd %int %164 %int_1 + %166 = OpLoad %int %92 + %167 = OpSLessThan %bool %165 %166 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %168 + %169 = OpLabel + %170 = OpLoad %int %93 + %171 = OpIAdd %int %170 %int_1 + OpStore %93 %171 + %172 = OpLoad %int %95 + %173 = OpIAdd %int %172 %int_1 + %174 = OpAccessChain %_ptr_Function_int %94 %171 + OpStore %174 %173 + %175 = OpLoad %int %93 + %176 = OpIAdd %int %175 %int_1 + OpStore %93 %176 + %177 = OpLoad %int %92 + %178 = OpAccessChain %_ptr_Function_int %94 %176 + OpStore %178 %177 + OpBranch %168 + %168 = OpLabel + OpBranch %133 + %133 = OpLabel + OpBranch %131 + %132 = OpLabel + %179 = OpLoad %v4float %_GLF_FragCoord + %180 = OpVectorShuffle %v2float %179 %179 0 1 + %181 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %182 = OpLoad %v2float %181 + %183 = OpFDiv %v2float %180 %182 + OpStore %uv %183 + OpStore %color %73 + %184 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_0 + %185 = OpLoad %int %184 + %186 = OpConvertSToF %float %185 + %187 = OpAccessChain %_ptr_Function_float %color %uint_0 + %188 = OpLoad %float %187 + %189 = OpFAdd %float %188 %186 + %190 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %190 %189 + %191 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %192 = OpLoad %float %191 + %193 = OpFOrdGreaterThan %bool %192 %float_0_25 + OpSelectionMerge %194 None + OpBranchConditional %193 %195 %194 + %195 = OpLabel + %196 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_1 + %197 = OpLoad %int %196 + %198 = OpConvertSToF %float %197 + %199 = OpAccessChain %_ptr_Function_float %color %uint_0 + %200 = OpLoad %float %199 + %201 = OpFAdd %float %200 %198 + %202 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %202 %201 + OpBranch %194 + %194 = OpLabel + %203 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %204 = OpLoad %float %203 + %205 = OpFOrdGreaterThan %bool %204 %float_0_5 + OpSelectionMerge %206 None + OpBranchConditional %205 %207 %206 + %207 = OpLabel + %208 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_2 + %209 = OpLoad %int %208 + %210 = OpConvertSToF %float %209 + %211 = OpAccessChain %_ptr_Function_float %color %uint_1 + %212 = OpLoad %float %211 + %213 = OpFAdd %float %212 %210 + %214 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %214 %213 + OpBranch %206 + %206 = OpLabel + %215 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %216 = OpLoad %float %215 + %217 = OpFOrdGreaterThan %bool %216 %float_0_75 + OpSelectionMerge %218 None + OpBranchConditional %217 %219 %218 + %219 = OpLabel + %220 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_3 + %221 = OpLoad %int %220 + %222 = OpConvertSToF %float %221 + %223 = OpAccessChain %_ptr_Function_float %color %uint_2 + %224 = OpLoad %float %223 + %225 = OpFAdd %float %224 %222 + %226 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %226 %225 + OpBranch %218 + %218 = OpLabel + %227 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_4 + %228 = OpLoad %int %227 + %229 = OpConvertSToF %float %228 + %230 = OpAccessChain %_ptr_Function_float %color %uint_1 + %231 = OpLoad %float %230 + %232 = OpFAdd %float %231 %229 + %233 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %233 %232 + %234 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %235 = OpLoad %float %234 + %236 = OpFOrdGreaterThan %bool %235 %float_0_25 + OpSelectionMerge %237 None + OpBranchConditional %236 %238 %237 + %238 = OpLabel + %239 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_5 + %240 = OpLoad %int %239 + %241 = OpConvertSToF %float %240 + %242 = OpAccessChain %_ptr_Function_float %color %uint_0 + %243 = OpLoad %float %242 + %244 = OpFAdd %float %243 %241 + %245 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %245 %244 + OpBranch %237 + %237 = OpLabel + %246 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %247 = OpLoad %float %246 + %248 = OpFOrdGreaterThan %bool %247 %float_0_5 + OpSelectionMerge %249 None + OpBranchConditional %248 %250 %249 + %250 = OpLabel + %251 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_6 + %252 = OpLoad %int %251 + %253 = OpConvertSToF %float %252 + %254 = OpAccessChain %_ptr_Function_float %color %uint_1 + %255 = OpLoad %float %254 + %256 = OpFAdd %float %255 %253 + %257 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %257 %256 + OpBranch %249 + %249 = OpLabel + %258 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %259 = OpLoad %float %258 + %260 = OpFOrdGreaterThan %bool %259 %float_0_75 + OpSelectionMerge %261 None + OpBranchConditional %260 %262 %261 + %262 = OpLabel + %263 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_7 + %264 = OpLoad %int %263 + %265 = OpConvertSToF %float %264 + %266 = OpAccessChain %_ptr_Function_float %color %uint_2 + %267 = OpLoad %float %266 + %268 = OpFAdd %float %267 %265 + %269 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %269 %268 + OpBranch %261 + %261 = OpLabel + %270 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_8 + %271 = OpLoad %int %270 + %272 = OpConvertSToF %float %271 + %273 = OpAccessChain %_ptr_Function_float %color %uint_2 + %274 = OpLoad %float %273 + %275 = OpFAdd %float %274 %272 + %276 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %276 %275 + %277 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %278 = OpLoad %float %277 + %279 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %280 = OpLoad %float %279 + %281 = OpFSub %float %278 %280 + %282 = OpExtInst %float %1 FAbs %281 + %283 = OpFOrdLessThan %bool %282 %float_0_25 + OpSelectionMerge %284 None + OpBranchConditional %283 %285 %284 + %285 = OpLabel + %286 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_9 + %287 = OpLoad %int %286 + %288 = OpConvertSToF %float %287 + %289 = OpAccessChain %_ptr_Function_float %color %uint_0 + %290 = OpLoad %float %289 + %291 = OpFAdd %float %290 %288 + %292 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %292 %291 + OpBranch %284 + %284 = OpLabel + %293 = OpLoad %v3float %color + %294 = OpExtInst %v3float %1 Normalize %293 + %295 = OpCompositeExtract %float %294 0 + %296 = OpCompositeExtract %float %294 1 + %297 = OpCompositeExtract %float %294 2 + %298 = OpCompositeConstruct %v4float %295 %296 %297 %float_1 + OpStore %frag_color %298 + %299 = OpLoad %v4float %_GLF_pos + %300 = OpAccessChain %_ptr_Output_v4float %__0 %int_0 + OpStore %300 %299 + OpReturn + OpFunctionEnd +%swap_i1_i1_ = OpFunction %void None %41 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %301 = OpLabel + %temp = OpVariable %_ptr_Function_int Function + %302 = OpLoad %int %i + %303 = OpAccessChain %_ptr_Private_int %obj %int_0 %302 + %304 = OpLoad %int %303 + OpStore %temp %304 + %305 = OpLoad %int %i + %306 = OpLoad %int %j + %307 = OpAccessChain %_ptr_Private_int %obj %int_0 %306 + %308 = OpLoad %int %307 + %309 = OpAccessChain %_ptr_Private_int %obj %int_0 %305 + OpStore %309 %308 + %310 = OpLoad %int %j + %311 = OpLoad %int %temp + %312 = OpAccessChain %_ptr_Private_int %obj %int_0 %310 + OpStore %312 %311 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %42 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %313 = OpLabel + %314 = OpVariable %_ptr_Function_int Function + %315 = OpVariable %_ptr_Function_int Function + %pivot = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_int Function + %316 = OpLoad %int %h + %317 = OpAccessChain %_ptr_Private_int %obj %int_0 %316 + %318 = OpLoad %int %317 + OpStore %pivot %318 + %319 = OpLoad %int %l + %320 = OpISub %int %319 %int_1 + OpStore %i_0 %320 + %321 = OpLoad %int %l + OpStore %j_0 %321 + OpBranch %322 + %322 = OpLabel + OpLoopMerge %323 %324 None + OpBranch %325 + %325 = OpLabel + %326 = OpLoad %int %j_0 + %327 = OpLoad %int %h + %328 = OpISub %int %327 %int_1 + %329 = OpSLessThanEqual %bool %326 %328 + OpBranchConditional %329 %330 %323 + %330 = OpLabel + %331 = OpLoad %int %j_0 + %332 = OpAccessChain %_ptr_Private_int %obj %int_0 %331 + %333 = OpLoad %int %332 + %334 = OpLoad %int %pivot + %335 = OpSLessThanEqual %bool %333 %334 + OpSelectionMerge %336 None + OpBranchConditional %335 %337 %336 + %337 = OpLabel + %338 = OpLoad %int %i_0 + %339 = OpIAdd %int %338 %int_1 + OpStore %i_0 %339 + %340 = OpLoad %int %i_0 + OpStore %param %340 + %341 = OpLoad %int %j_0 + OpStore %param_0 %341 + %342 = OpLoad %int %param + %343 = OpAccessChain %_ptr_Private_int %obj %int_0 %342 + %344 = OpLoad %int %343 + OpStore %315 %344 + %345 = OpLoad %int %param + %346 = OpLoad %int %param_0 + %347 = OpAccessChain %_ptr_Private_int %obj %int_0 %346 + %348 = OpLoad %int %347 + %349 = OpAccessChain %_ptr_Private_int %obj %int_0 %345 + OpStore %349 %348 + %350 = OpLoad %int %param_0 + %351 = OpLoad %int %315 + %352 = OpAccessChain %_ptr_Private_int %obj %int_0 %350 + OpStore %352 %351 + OpBranch %336 + %336 = OpLabel + OpBranch %324 + %324 = OpLabel + %353 = OpLoad %int %j_0 + %354 = OpIAdd %int %353 %int_1 + OpStore %j_0 %354 + OpBranch %322 + %323 = OpLabel + %355 = OpLoad %int %i_0 + %356 = OpIAdd %int %355 %int_1 + OpStore %param_1 %356 + %357 = OpLoad %int %h + OpStore %param_2 %357 + %358 = OpLoad %int %param_1 + %359 = OpAccessChain %_ptr_Private_int %obj %int_0 %358 + %360 = OpLoad %int %359 + OpStore %314 %360 + %361 = OpLoad %int %param_1 + %362 = OpLoad %int %param_2 + %363 = OpAccessChain %_ptr_Private_int %obj %int_0 %362 + %364 = OpLoad %int %363 + %365 = OpAccessChain %_ptr_Private_int %obj %int_0 %361 + OpStore %365 %364 + %366 = OpLoad %int %param_2 + %367 = OpLoad %int %314 + %368 = OpAccessChain %_ptr_Private_int %obj %int_0 %366 + OpStore %368 %367 + OpSelectionMerge %369 None + OpBranchConditional %false %370 %371 + %370 = OpLabel + OpBranch %369 + %371 = OpLabel + %372 = OpLoad %int %i_0 + %373 = OpIAdd %int %372 %int_1 + OpReturnValue %373 + %369 = OpLabel + %374 = OpUndef %int + OpReturnValue %374 + OpFunctionEnd + %quicksort_ = OpFunction %void None %38 + %375 = OpLabel + %l_0 = OpVariable %_ptr_Function_int Function + %h_0 = OpVariable %_ptr_Function_int Function + %top = OpVariable %_ptr_Function_int Function + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function + %p = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_int Function + %param_4 = OpVariable %_ptr_Function_int Function + OpStore %l_0 %int_0 + OpStore %h_0 %int_9 + OpStore %top %int_n1 + %376 = OpLoad %int %top + %377 = OpIAdd %int %376 %int_1 + OpStore %top %377 + %378 = OpLoad %int %l_0 + %379 = OpAccessChain %_ptr_Function_int %stack %377 + OpStore %379 %378 + %380 = OpLoad %int %top + %381 = OpIAdd %int %380 %int_1 + OpStore %top %381 + %382 = OpLoad %int %h_0 + %383 = OpAccessChain %_ptr_Function_int %stack %381 + OpStore %383 %382 + OpBranch %384 + %384 = OpLabel + OpLoopMerge %385 %386 None + OpBranch %387 + %387 = OpLabel + %388 = OpLoad %int %top + %389 = OpSGreaterThanEqual %bool %388 %int_0 + OpBranchConditional %389 %390 %385 + %390 = OpLabel + %391 = OpLoad %int %top + %392 = OpISub %int %391 %int_1 + OpStore %top %392 + %393 = OpAccessChain %_ptr_Function_int %stack %391 + %394 = OpLoad %int %393 + OpStore %h_0 %394 + %395 = OpLoad %int %top + %396 = OpISub %int %395 %int_1 + OpStore %top %396 + %397 = OpAccessChain %_ptr_Function_int %stack %395 + %398 = OpLoad %int %397 + OpStore %l_0 %398 + %399 = OpLoad %int %l_0 + OpStore %param_3 %399 + %400 = OpLoad %int %h_0 + OpStore %param_4 %400 + %401 = OpFunctionCall %int %performPartition_i1_i1_ %param_3 %param_4 + OpStore %p %401 + %402 = OpLoad %int %p + %403 = OpISub %int %402 %int_1 + %404 = OpLoad %int %l_0 + %405 = OpSGreaterThan %bool %403 %404 + OpSelectionMerge %406 None + OpBranchConditional %405 %407 %406 + %407 = OpLabel + %408 = OpLoad %int %top + %409 = OpIAdd %int %408 %int_1 + OpStore %top %409 + %410 = OpLoad %int %l_0 + %411 = OpAccessChain %_ptr_Function_int %stack %409 + OpStore %411 %410 + %412 = OpLoad %int %top + %413 = OpIAdd %int %412 %int_1 + OpStore %top %413 + %414 = OpLoad %int %p + %415 = OpISub %int %414 %int_1 + %416 = OpAccessChain %_ptr_Function_int %stack %413 + OpStore %416 %415 + OpBranch %406 + %406 = OpLabel + %417 = OpLoad %int %p + %418 = OpIAdd %int %417 %int_1 + %419 = OpLoad %int %h_0 + %420 = OpSLessThan %bool %418 %419 + OpSelectionMerge %421 None + OpBranchConditional %420 %422 %421 + %422 = OpLabel + %423 = OpLoad %int %top + %424 = OpIAdd %int %423 %int_1 + OpStore %top %424 + %425 = OpLoad %int %p + %426 = OpIAdd %int %425 %int_1 + %427 = OpAccessChain %_ptr_Function_int %stack %424 + OpStore %427 %426 + %428 = OpLoad %int %top + %429 = OpIAdd %int %428 %int_1 + OpStore %top %429 + %430 = OpLoad %int %h_0 + %431 = OpAccessChain %_ptr_Function_int %stack %429 + OpStore %431 %430 + OpBranch %421 + %421 = OpLabel + OpBranch %386 + %386 = OpLabel + OpBranch %384 + %385 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.hlsl new file mode 100644 index 0000000000..dd128c452e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.hlsl @@ -0,0 +1,284 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_34 : register(b0, space0) { + uint4 x_34[1]; +}; +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int performPartition_i1_i1_(inout int l, inout int h) { + int x_314 = 0; + int x_315 = 0; + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_316 = h; + const int x_318 = obj.numbers[x_316]; + pivot = x_318; + const int x_319 = l; + i_1 = (x_319 - 1); + const int x_321 = l; + j_1 = x_321; + while (true) { + const int x_326 = j_1; + const int x_327 = h; + if ((x_326 <= (x_327 - 1))) { + } else { + break; + } + const int x_333 = obj.numbers[j_1]; + if ((x_333 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + const int x_344 = obj.numbers[param]; + x_315 = x_344; + const int x_345 = param; + const int x_348 = obj.numbers[param_1]; + obj.numbers[x_345] = x_348; + obj.numbers[param_1] = x_315; + } + { + j_1 = (j_1 + 1); + } + } + param_2 = (i_1 + 1); + const int x_357 = h; + param_3 = x_357; + const int x_360 = obj.numbers[param_2]; + x_314 = x_360; + const int x_361 = param_2; + const int x_364 = obj.numbers[param_3]; + obj.numbers[x_361] = x_364; + obj.numbers[param_3] = x_314; + if (false) { + } else { + return (i_1 + 1); + } + return 0; +} + +void main_1() { + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94[10] = (int[10])0; + int x_95 = 0; + int x_96 = 0; + int x_97 = 0; + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_112 = i_2; + const int x_115 = obj.numbers[i_2]; + const int x_118 = obj.numbers[i_2]; + obj.numbers[x_112] = (x_115 * x_118); + } + } + x_91 = 0; + x_92 = 9; + x_93 = -1; + const int x_124 = (x_93 + 1); + x_93 = x_124; + x_94[x_124] = x_91; + const int x_128 = (x_93 + 1); + x_93 = x_128; + x_94[x_128] = x_92; + while (true) { + if ((x_93 >= 0)) { + } else { + break; + } + const int x_138 = x_93; + x_93 = (x_138 - 1); + const int x_141 = x_94[x_138]; + x_92 = x_141; + const int x_142 = x_93; + x_93 = (x_142 - 1); + const int x_145 = x_94[x_142]; + x_91 = x_145; + x_96 = x_91; + x_97 = x_92; + const int x_148 = performPartition_i1_i1_(x_96, x_97); + x_95 = x_148; + if (((x_95 - 1) > x_91)) { + const int x_156 = (x_93 + 1); + x_93 = x_156; + x_94[x_156] = x_91; + const int x_160 = (x_93 + 1); + x_93 = x_160; + x_94[x_160] = (x_95 - 1); + } + if (((x_95 + 1) < x_92)) { + const int x_171 = (x_93 + 1); + x_93 = x_171; + x_94[x_171] = (x_95 + 1); + const int x_176 = (x_93 + 1); + x_93 = x_176; + x_94[x_176] = x_92; + } + } + const float4 x_179 = x_GLF_FragCoord; + const float2 x_182 = asfloat(x_34[0].xy); + uv = (float2(x_179.x, x_179.y) / x_182); + color = float3(1.0f, 2.0f, 3.0f); + const int x_185 = obj.numbers[0]; + const float x_188 = color.x; + color.x = (x_188 + float(x_185)); + const float x_192 = uv.x; + if ((x_192 > 0.25f)) { + const int x_197 = obj.numbers[1]; + const float x_200 = color.x; + color.x = (x_200 + float(x_197)); + } + const float x_204 = uv.x; + if ((x_204 > 0.5f)) { + const int x_209 = obj.numbers[2]; + const float x_212 = color.y; + color.y = (x_212 + float(x_209)); + } + const float x_216 = uv.x; + if ((x_216 > 0.75f)) { + const int x_221 = obj.numbers[3]; + const float x_224 = color.z; + color.z = (x_224 + float(x_221)); + } + const int x_228 = obj.numbers[4]; + const float x_231 = color.y; + color.y = (x_231 + float(x_228)); + const float x_235 = uv.y; + if ((x_235 > 0.25f)) { + const int x_240 = obj.numbers[5]; + const float x_243 = color.x; + color.x = (x_243 + float(x_240)); + } + const float x_247 = uv.y; + if ((x_247 > 0.5f)) { + const int x_252 = obj.numbers[6]; + const float x_255 = color.y; + color.y = (x_255 + float(x_252)); + } + const float x_259 = uv.y; + if ((x_259 > 0.75f)) { + const int x_264 = obj.numbers[7]; + const float x_267 = color.z; + color.z = (x_267 + float(x_264)); + } + const int x_271 = obj.numbers[8]; + const float x_274 = color.z; + color.z = (x_274 + float(x_271)); + const float x_278 = uv.x; + const float x_280 = uv.y; + if ((abs((x_278 - x_280)) < 0.25f)) { + const int x_287 = obj.numbers[9]; + const float x_290 = color.x; + color.x = (x_290 + float(x_287)); + } + const float3 x_294 = normalize(color); + frag_color = float4(x_294.x, x_294.y, x_294.z, 1.0f); + gl_Position = x_GLF_pos; + return; +} + +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 x_GLF_pos_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_GLF_pos_param = tint_symbol.x_GLF_pos_param; + x_GLF_pos = x_GLF_pos_param; + main_1(); + const main_out tint_symbol_3 = {frag_color, gl_Position}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_5; +} + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_302 = i; + const int x_304 = obj.numbers[x_302]; + temp = x_304; + const int x_305 = i; + const int x_306 = j; + const int x_308 = obj.numbers[x_306]; + obj.numbers[x_305] = x_308; + const int x_310 = j; + obj.numbers[x_310] = temp; + return; +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_377 = (top + 1); + top = x_377; + stack[x_377] = l_1; + const int x_381 = (top + 1); + top = x_381; + stack[x_381] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_391 = top; + top = (x_391 - 1); + const int x_394 = stack[x_391]; + h_1 = x_394; + const int x_395 = top; + top = (x_395 - 1); + const int x_398 = stack[x_395]; + l_1 = x_398; + param_4 = l_1; + param_5 = h_1; + const int x_401 = performPartition_i1_i1_(param_4, param_5); + p = x_401; + if (((p - 1) > l_1)) { + const int x_409 = (top + 1); + top = x_409; + stack[x_409] = l_1; + const int x_413 = (top + 1); + top = x_413; + stack[x_413] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_424 = (top + 1); + top = x_424; + stack[x_424] = (p + 1); + const int x_429 = (top + 1); + top = x_429; + stack[x_429] = h_1; + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.msl new file mode 100644 index 0000000000..f6f5a8ad0b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.msl @@ -0,0 +1,358 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_pos_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_6) { + int x_314 = 0; + int x_315 = 0; + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_316 = *(h); + int const x_318 = (*(tint_symbol_6)).numbers.arr[x_316]; + pivot = x_318; + int const x_319 = *(l); + i_1 = (x_319 - 1); + int const x_321 = *(l); + j_1 = x_321; + while (true) { + int const x_326 = j_1; + int const x_327 = *(h); + if ((x_326 <= (x_327 - 1))) { + } else { + break; + } + int const x_331 = j_1; + int const x_333 = (*(tint_symbol_6)).numbers.arr[x_331]; + int const x_334 = pivot; + if ((x_333 <= x_334)) { + int const x_338 = i_1; + i_1 = (x_338 + 1); + int const x_340 = i_1; + param = x_340; + int const x_341 = j_1; + param_1 = x_341; + int const x_342 = param; + int const x_344 = (*(tint_symbol_6)).numbers.arr[x_342]; + x_315 = x_344; + int const x_345 = param; + int const x_346 = param_1; + int const x_348 = (*(tint_symbol_6)).numbers.arr[x_346]; + (*(tint_symbol_6)).numbers.arr[x_345] = x_348; + int const x_350 = param_1; + int const x_351 = x_315; + (*(tint_symbol_6)).numbers.arr[x_350] = x_351; + } + { + int const x_353 = j_1; + j_1 = (x_353 + 1); + } + } + int const x_355 = i_1; + param_2 = (x_355 + 1); + int const x_357 = *(h); + param_3 = x_357; + int const x_358 = param_2; + int const x_360 = (*(tint_symbol_6)).numbers.arr[x_358]; + x_314 = x_360; + int const x_361 = param_2; + int const x_362 = param_3; + int const x_364 = (*(tint_symbol_6)).numbers.arr[x_362]; + (*(tint_symbol_6)).numbers.arr[x_361] = x_364; + int const x_366 = param_3; + int const x_367 = x_314; + (*(tint_symbol_6)).numbers.arr[x_366] = x_367; + if (false) { + } else { + int const x_372 = i_1; + return (x_372 + 1); + } + return 0; +} + +void main_1(constant buf0& x_34, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8, thread QuicksortObject* const tint_symbol_9, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) { + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + tint_array_wrapper x_94 = {}; + int x_95 = 0; + int x_96 = 0; + int x_97 = 0; + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + float4 const x_98 = *(tint_symbol_7); + *(tint_symbol_8) = ((x_98 + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + while (true) { + int const x_105 = i_2; + if ((x_105 < 10)) { + } else { + break; + } + int const x_108 = i_2; + int const x_109 = i_2; + (*(tint_symbol_9)).numbers.arr[x_108] = (10 - x_109); + int const x_112 = i_2; + int const x_113 = i_2; + int const x_115 = (*(tint_symbol_9)).numbers.arr[x_113]; + int const x_116 = i_2; + int const x_118 = (*(tint_symbol_9)).numbers.arr[x_116]; + (*(tint_symbol_9)).numbers.arr[x_112] = (x_115 * x_118); + { + int const x_121 = i_2; + i_2 = (x_121 + 1); + } + } + x_91 = 0; + x_92 = 9; + x_93 = -1; + int const x_123 = x_93; + int const x_124 = (x_123 + 1); + x_93 = x_124; + int const x_125 = x_91; + x_94.arr[x_124] = x_125; + int const x_127 = x_93; + int const x_128 = (x_127 + 1); + x_93 = x_128; + int const x_129 = x_92; + x_94.arr[x_128] = x_129; + while (true) { + int const x_135 = x_93; + if ((x_135 >= 0)) { + } else { + break; + } + int const x_138 = x_93; + x_93 = (x_138 - 1); + int const x_141 = x_94.arr[x_138]; + x_92 = x_141; + int const x_142 = x_93; + x_93 = (x_142 - 1); + int const x_145 = x_94.arr[x_142]; + x_91 = x_145; + int const x_146 = x_91; + x_96 = x_146; + int const x_147 = x_92; + x_97 = x_147; + int const x_148 = performPartition_i1_i1_(&(x_96), &(x_97), tint_symbol_9); + x_95 = x_148; + int const x_149 = x_95; + int const x_151 = x_91; + if (((x_149 - 1) > x_151)) { + int const x_155 = x_93; + int const x_156 = (x_155 + 1); + x_93 = x_156; + int const x_157 = x_91; + x_94.arr[x_156] = x_157; + int const x_159 = x_93; + int const x_160 = (x_159 + 1); + x_93 = x_160; + int const x_161 = x_95; + x_94.arr[x_160] = (x_161 - 1); + } + int const x_164 = x_95; + int const x_166 = x_92; + if (((x_164 + 1) < x_166)) { + int const x_170 = x_93; + int const x_171 = (x_170 + 1); + x_93 = x_171; + int const x_172 = x_95; + x_94.arr[x_171] = (x_172 + 1); + int const x_175 = x_93; + int const x_176 = (x_175 + 1); + x_93 = x_176; + int const x_177 = x_92; + x_94.arr[x_176] = x_177; + } + } + float4 const x_179 = *(tint_symbol_8); + float2 const x_182 = x_34.resolution; + uv = (float2(x_179.x, x_179.y) / x_182); + color = float3(1.0f, 2.0f, 3.0f); + int const x_185 = (*(tint_symbol_9)).numbers.arr[0]; + float const x_188 = color.x; + color.x = (x_188 + float(x_185)); + float const x_192 = uv.x; + if ((x_192 > 0.25f)) { + int const x_197 = (*(tint_symbol_9)).numbers.arr[1]; + float const x_200 = color.x; + color.x = (x_200 + float(x_197)); + } + float const x_204 = uv.x; + if ((x_204 > 0.5f)) { + int const x_209 = (*(tint_symbol_9)).numbers.arr[2]; + float const x_212 = color.y; + color.y = (x_212 + float(x_209)); + } + float const x_216 = uv.x; + if ((x_216 > 0.75f)) { + int const x_221 = (*(tint_symbol_9)).numbers.arr[3]; + float const x_224 = color.z; + color.z = (x_224 + float(x_221)); + } + int const x_228 = (*(tint_symbol_9)).numbers.arr[4]; + float const x_231 = color.y; + color.y = (x_231 + float(x_228)); + float const x_235 = uv.y; + if ((x_235 > 0.25f)) { + int const x_240 = (*(tint_symbol_9)).numbers.arr[5]; + float const x_243 = color.x; + color.x = (x_243 + float(x_240)); + } + float const x_247 = uv.y; + if ((x_247 > 0.5f)) { + int const x_252 = (*(tint_symbol_9)).numbers.arr[6]; + float const x_255 = color.y; + color.y = (x_255 + float(x_252)); + } + float const x_259 = uv.y; + if ((x_259 > 0.75f)) { + int const x_264 = (*(tint_symbol_9)).numbers.arr[7]; + float const x_267 = color.z; + color.z = (x_267 + float(x_264)); + } + int const x_271 = (*(tint_symbol_9)).numbers.arr[8]; + float const x_274 = color.z; + color.z = (x_274 + float(x_271)); + float const x_278 = uv.x; + float const x_280 = uv.y; + if ((fabs((x_278 - x_280)) < 0.25f)) { + int const x_287 = (*(tint_symbol_9)).numbers.arr[9]; + float const x_290 = color.x; + color.x = (x_290 + float(x_287)); + } + float3 const x_293 = color; + float3 const x_294 = normalize(x_293); + *(tint_symbol_10) = float4(x_294.x, x_294.y, x_294.z, 1.0f); + float4 const x_299 = *(tint_symbol_7); + *(tint_symbol_11) = x_299; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant buf0& x_34 [[buffer(0)]]) { + thread float4 tint_symbol_12 = 0.0f; + thread float4 tint_symbol_13 = 0.0f; + thread QuicksortObject tint_symbol_14 = {}; + thread float4 tint_symbol_15 = 0.0f; + thread float4 tint_symbol_16 = 0.0f; + float4 const x_GLF_pos_param = tint_symbol_1.x_GLF_pos_param; + tint_symbol_12 = x_GLF_pos_param; + main_1(x_34, &(tint_symbol_12), &(tint_symbol_13), &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_16)); + main_out const tint_symbol_4 = {.frag_color_1=tint_symbol_15, .gl_Position=tint_symbol_16}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_17) { + int temp = 0; + int const x_302 = *(i); + int const x_304 = (*(tint_symbol_17)).numbers.arr[x_302]; + temp = x_304; + int const x_305 = *(i); + int const x_306 = *(j); + int const x_308 = (*(tint_symbol_17)).numbers.arr[x_306]; + (*(tint_symbol_17)).numbers.arr[x_305] = x_308; + int const x_310 = *(j); + int const x_311 = temp; + (*(tint_symbol_17)).numbers.arr[x_310] = x_311; + return; +} + +void quicksort_(thread QuicksortObject* const tint_symbol_18) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_376 = top; + int const x_377 = (x_376 + 1); + top = x_377; + int const x_378 = l_1; + stack.arr[x_377] = x_378; + int const x_380 = top; + int const x_381 = (x_380 + 1); + top = x_381; + int const x_382 = h_1; + stack.arr[x_381] = x_382; + while (true) { + int const x_388 = top; + if ((x_388 >= 0)) { + } else { + break; + } + int const x_391 = top; + top = (x_391 - 1); + int const x_394 = stack.arr[x_391]; + h_1 = x_394; + int const x_395 = top; + top = (x_395 - 1); + int const x_398 = stack.arr[x_395]; + l_1 = x_398; + int const x_399 = l_1; + param_4 = x_399; + int const x_400 = h_1; + param_5 = x_400; + int const x_401 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_18); + p = x_401; + int const x_402 = p; + int const x_404 = l_1; + if (((x_402 - 1) > x_404)) { + int const x_408 = top; + int const x_409 = (x_408 + 1); + top = x_409; + int const x_410 = l_1; + stack.arr[x_409] = x_410; + int const x_412 = top; + int const x_413 = (x_412 + 1); + top = x_413; + int const x_414 = p; + stack.arr[x_413] = (x_414 - 1); + } + int const x_417 = p; + int const x_419 = h_1; + if (((x_417 + 1) < x_419)) { + int const x_423 = top; + int const x_424 = (x_423 + 1); + top = x_424; + int const x_425 = p; + stack.arr[x_424] = (x_425 + 1); + int const x_428 = top; + int const x_429 = (x_428 + 1); + top = x_429; + int const x_430 = h_1; + stack.arr[x_429] = x_430; + } + } + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.spvasm new file mode 100644 index 0000000000..01d7e035e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.spvasm @@ -0,0 +1,713 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 478 +; Schema: 0 + OpCapability Shader + %354 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %x_GLF_FragCoord "x_GLF_FragCoord" + OpName %x_GLF_pos "x_GLF_pos" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_34 "x_34" + OpName %frag_color "frag_color" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %x_314 "x_314" + OpName %x_315 "x_315" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %main_1 "main_1" + OpName %x_91 "x_91" + OpName %x_92 "x_92" + OpName %x_93 "x_93" + OpName %x_94 "x_94" + OpName %x_95 "x_95" + OpName %x_96 "x_96" + OpName %x_97 "x_97" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "frag_color_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpDecorate %tint_pointsize BuiltIn PointSize + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_34 NonWritable + OpDecorate %x_34 DescriptorSet 0 + OpDecorate %x_34 Binding 0 + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_3 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %12 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private %16 + %x_GLF_pos = OpVariable %_ptr_Private_v4float Private %16 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_34 = OpVariable %_ptr_Uniform_buf0 Uniform + %frag_color = OpVariable %_ptr_Private_v4float Private %16 +%gl_Position = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %16 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %16 +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %36 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %int_0 = OpConstant %int 0 + %void = OpTypeVoid + %116 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %125 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %132 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %136 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %140 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %143 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_10 = OpConstant %int 10 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %242 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float %v4float + %373 = OpTypeFunction %void %main_out + %388 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int +%performPartition_i1_i1_ = OpFunction %int None %29 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %34 = OpLabel + %x_314 = OpVariable %_ptr_Function_int Function %36 + %x_315 = OpVariable %_ptr_Function_int Function %36 + %pivot = OpVariable %_ptr_Function_int Function %36 + %i_1 = OpVariable %_ptr_Function_int Function %36 + %j_1 = OpVariable %_ptr_Function_int Function %36 + %param = OpVariable %_ptr_Function_int Function %36 + %param_1 = OpVariable %_ptr_Function_int Function %36 + %param_2 = OpVariable %_ptr_Function_int Function %36 + %param_3 = OpVariable %_ptr_Function_int Function %36 + %46 = OpLoad %int %h + %49 = OpAccessChain %_ptr_Private_int %obj %uint_0 %46 + %50 = OpLoad %int %49 + OpStore %pivot %50 + %52 = OpLoad %int %l + %54 = OpISub %int %52 %int_1 + OpStore %i_1 %54 + %56 = OpLoad %int %l + OpStore %j_1 %56 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %j_1 + %63 = OpLoad %int %h + %64 = OpISub %int %63 %int_1 + %65 = OpSLessThanEqual %bool %61 %64 + OpSelectionMerge %67 None + OpBranchConditional %65 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %58 + %67 = OpLabel + %70 = OpLoad %int %j_1 + %71 = OpAccessChain %_ptr_Private_int %obj %uint_0 %70 + %72 = OpLoad %int %71 + %73 = OpLoad %int %pivot + %74 = OpSLessThanEqual %bool %72 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + %77 = OpLoad %int %i_1 + %78 = OpIAdd %int %77 %int_1 + OpStore %i_1 %78 + %79 = OpLoad %int %i_1 + OpStore %param %79 + %80 = OpLoad %int %j_1 + OpStore %param_1 %80 + %81 = OpLoad %int %param + %82 = OpAccessChain %_ptr_Private_int %obj %uint_0 %81 + %83 = OpLoad %int %82 + OpStore %x_315 %83 + %84 = OpLoad %int %param + %85 = OpLoad %int %param_1 + %86 = OpAccessChain %_ptr_Private_int %obj %uint_0 %85 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Private_int %obj %uint_0 %84 + OpStore %88 %87 + %89 = OpLoad %int %param_1 + %90 = OpLoad %int %x_315 + %91 = OpAccessChain %_ptr_Private_int %obj %uint_0 %89 + OpStore %91 %90 + OpBranch %75 + %75 = OpLabel + OpBranch %59 + %59 = OpLabel + %92 = OpLoad %int %j_1 + %93 = OpIAdd %int %92 %int_1 + OpStore %j_1 %93 + OpBranch %57 + %58 = OpLabel + %94 = OpLoad %int %i_1 + %95 = OpIAdd %int %94 %int_1 + OpStore %param_2 %95 + %97 = OpLoad %int %h + OpStore %param_3 %97 + %98 = OpLoad %int %param_2 + %99 = OpAccessChain %_ptr_Private_int %obj %uint_0 %98 + %100 = OpLoad %int %99 + OpStore %x_314 %100 + %101 = OpLoad %int %param_2 + %102 = OpLoad %int %param_3 + %103 = OpAccessChain %_ptr_Private_int %obj %uint_0 %102 + %104 = OpLoad %int %103 + %105 = OpAccessChain %_ptr_Private_int %obj %uint_0 %101 + OpStore %105 %104 + %106 = OpLoad %int %param_3 + %107 = OpLoad %int %x_314 + %108 = OpAccessChain %_ptr_Private_int %obj %uint_0 %106 + OpStore %108 %107 + OpSelectionMerge %110 None + OpBranchConditional %false %111 %112 + %111 = OpLabel + OpBranch %110 + %112 = OpLabel + %113 = OpLoad %int %i_1 + %114 = OpIAdd %int %113 %int_1 + OpReturnValue %114 + %110 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %116 + %119 = OpLabel + %x_91 = OpVariable %_ptr_Function_int Function %36 + %x_92 = OpVariable %_ptr_Function_int Function %36 + %x_93 = OpVariable %_ptr_Function_int Function %36 + %x_94 = OpVariable %_ptr_Function__arr_int_uint_10 Function %125 + %x_95 = OpVariable %_ptr_Function_int Function %36 + %x_96 = OpVariable %_ptr_Function_int Function %36 + %x_97 = OpVariable %_ptr_Function_int Function %36 + %i_2 = OpVariable %_ptr_Function_int Function %36 + %uv = OpVariable %_ptr_Function_v2float Function %132 + %color = OpVariable %_ptr_Function_v3float Function %136 + %137 = OpLoad %v4float %x_GLF_pos + %141 = OpFAdd %v4float %137 %140 + %144 = OpFMul %v4float %141 %143 + OpStore %x_GLF_FragCoord %144 + OpStore %i_2 %int_0 + OpBranch %145 + %145 = OpLabel + OpLoopMerge %146 %147 None + OpBranch %148 + %148 = OpLabel + %149 = OpLoad %int %i_2 + %151 = OpSLessThan %bool %149 %int_10 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %154 + %153 = OpLabel + OpBranch %152 + %154 = OpLabel + OpBranch %146 + %152 = OpLabel + %155 = OpLoad %int %i_2 + %156 = OpLoad %int %i_2 + %157 = OpAccessChain %_ptr_Private_int %obj %uint_0 %155 + %158 = OpISub %int %int_10 %156 + OpStore %157 %158 + %159 = OpLoad %int %i_2 + %160 = OpLoad %int %i_2 + %161 = OpAccessChain %_ptr_Private_int %obj %uint_0 %160 + %162 = OpLoad %int %161 + %163 = OpLoad %int %i_2 + %164 = OpAccessChain %_ptr_Private_int %obj %uint_0 %163 + %165 = OpLoad %int %164 + %166 = OpAccessChain %_ptr_Private_int %obj %uint_0 %159 + %167 = OpIMul %int %162 %165 + OpStore %166 %167 + OpBranch %147 + %147 = OpLabel + %168 = OpLoad %int %i_2 + %169 = OpIAdd %int %168 %int_1 + OpStore %i_2 %169 + OpBranch %145 + %146 = OpLabel + OpStore %x_91 %int_0 + OpStore %x_92 %int_9 + OpStore %x_93 %int_n1 + %172 = OpLoad %int %x_93 + %173 = OpIAdd %int %172 %int_1 + OpStore %x_93 %173 + %174 = OpLoad %int %x_91 + %175 = OpAccessChain %_ptr_Function_int %x_94 %173 + OpStore %175 %174 + %176 = OpLoad %int %x_93 + %177 = OpIAdd %int %176 %int_1 + OpStore %x_93 %177 + %178 = OpLoad %int %x_92 + %179 = OpAccessChain %_ptr_Function_int %x_94 %177 + OpStore %179 %178 + OpBranch %180 + %180 = OpLabel + OpLoopMerge %181 %182 None + OpBranch %183 + %183 = OpLabel + %184 = OpLoad %int %x_93 + %185 = OpSGreaterThanEqual %bool %184 %int_0 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + OpBranch %186 + %188 = OpLabel + OpBranch %181 + %186 = OpLabel + %189 = OpLoad %int %x_93 + %190 = OpISub %int %189 %int_1 + OpStore %x_93 %190 + %191 = OpAccessChain %_ptr_Function_int %x_94 %189 + %192 = OpLoad %int %191 + OpStore %x_92 %192 + %193 = OpLoad %int %x_93 + %194 = OpISub %int %193 %int_1 + OpStore %x_93 %194 + %195 = OpAccessChain %_ptr_Function_int %x_94 %193 + %196 = OpLoad %int %195 + OpStore %x_91 %196 + %197 = OpLoad %int %x_91 + OpStore %x_96 %197 + %198 = OpLoad %int %x_92 + OpStore %x_97 %198 + %199 = OpFunctionCall %int %performPartition_i1_i1_ %x_96 %x_97 + OpStore %x_95 %199 + %202 = OpLoad %int %x_95 + %203 = OpLoad %int %x_91 + %204 = OpISub %int %202 %int_1 + %205 = OpSGreaterThan %bool %204 %203 + OpSelectionMerge %206 None + OpBranchConditional %205 %207 %206 + %207 = OpLabel + %208 = OpLoad %int %x_93 + %209 = OpIAdd %int %208 %int_1 + OpStore %x_93 %209 + %210 = OpLoad %int %x_91 + %211 = OpAccessChain %_ptr_Function_int %x_94 %209 + OpStore %211 %210 + %212 = OpLoad %int %x_93 + %213 = OpIAdd %int %212 %int_1 + OpStore %x_93 %213 + %214 = OpLoad %int %x_95 + %215 = OpAccessChain %_ptr_Function_int %x_94 %213 + %216 = OpISub %int %214 %int_1 + OpStore %215 %216 + OpBranch %206 + %206 = OpLabel + %217 = OpLoad %int %x_95 + %218 = OpLoad %int %x_92 + %219 = OpIAdd %int %217 %int_1 + %220 = OpSLessThan %bool %219 %218 + OpSelectionMerge %221 None + OpBranchConditional %220 %222 %221 + %222 = OpLabel + %223 = OpLoad %int %x_93 + %224 = OpIAdd %int %223 %int_1 + OpStore %x_93 %224 + %225 = OpLoad %int %x_95 + %226 = OpAccessChain %_ptr_Function_int %x_94 %224 + %227 = OpIAdd %int %225 %int_1 + OpStore %226 %227 + %228 = OpLoad %int %x_93 + %229 = OpIAdd %int %228 %int_1 + OpStore %x_93 %229 + %230 = OpLoad %int %x_92 + %231 = OpAccessChain %_ptr_Function_int %x_94 %229 + OpStore %231 %230 + OpBranch %221 + %221 = OpLabel + OpBranch %182 + %182 = OpLabel + OpBranch %180 + %181 = OpLabel + %232 = OpLoad %v4float %x_GLF_FragCoord + %234 = OpAccessChain %_ptr_Uniform_v2float %x_34 %uint_0 + %235 = OpLoad %v2float %234 + %236 = OpCompositeExtract %float %232 0 + %237 = OpCompositeExtract %float %232 1 + %238 = OpCompositeConstruct %v2float %236 %237 + %239 = OpFDiv %v2float %238 %235 + OpStore %uv %239 + OpStore %color %242 + %243 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %244 = OpLoad %int %243 + %246 = OpAccessChain %_ptr_Function_float %color %uint_0 + %247 = OpLoad %float %246 + %248 = OpAccessChain %_ptr_Function_float %color %uint_0 + %249 = OpConvertSToF %float %244 + %250 = OpFAdd %float %247 %249 + OpStore %248 %250 + %251 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %252 = OpLoad %float %251 + %254 = OpFOrdGreaterThan %bool %252 %float_0_25 + OpSelectionMerge %255 None + OpBranchConditional %254 %256 %255 + %256 = OpLabel + %257 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %258 = OpLoad %int %257 + %259 = OpAccessChain %_ptr_Function_float %color %uint_0 + %260 = OpLoad %float %259 + %261 = OpAccessChain %_ptr_Function_float %color %uint_0 + %262 = OpConvertSToF %float %258 + %263 = OpFAdd %float %260 %262 + OpStore %261 %263 + OpBranch %255 + %255 = OpLabel + %264 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %265 = OpLoad %float %264 + %267 = OpFOrdGreaterThan %bool %265 %float_0_5 + OpSelectionMerge %268 None + OpBranchConditional %267 %269 %268 + %269 = OpLabel + %271 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %272 = OpLoad %int %271 + %274 = OpAccessChain %_ptr_Function_float %color %uint_1 + %275 = OpLoad %float %274 + %276 = OpAccessChain %_ptr_Function_float %color %uint_1 + %277 = OpConvertSToF %float %272 + %278 = OpFAdd %float %275 %277 + OpStore %276 %278 + OpBranch %268 + %268 = OpLabel + %279 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %280 = OpLoad %float %279 + %282 = OpFOrdGreaterThan %bool %280 %float_0_75 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %283 + %284 = OpLabel + %286 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %287 = OpLoad %int %286 + %289 = OpAccessChain %_ptr_Function_float %color %uint_2 + %290 = OpLoad %float %289 + %291 = OpAccessChain %_ptr_Function_float %color %uint_2 + %292 = OpConvertSToF %float %287 + %293 = OpFAdd %float %290 %292 + OpStore %291 %293 + OpBranch %283 + %283 = OpLabel + %295 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %296 = OpLoad %int %295 + %297 = OpAccessChain %_ptr_Function_float %color %uint_1 + %298 = OpLoad %float %297 + %299 = OpAccessChain %_ptr_Function_float %color %uint_1 + %300 = OpConvertSToF %float %296 + %301 = OpFAdd %float %298 %300 + OpStore %299 %301 + %302 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %303 = OpLoad %float %302 + %304 = OpFOrdGreaterThan %bool %303 %float_0_25 + OpSelectionMerge %305 None + OpBranchConditional %304 %306 %305 + %306 = OpLabel + %308 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %309 = OpLoad %int %308 + %310 = OpAccessChain %_ptr_Function_float %color %uint_0 + %311 = OpLoad %float %310 + %312 = OpAccessChain %_ptr_Function_float %color %uint_0 + %313 = OpConvertSToF %float %309 + %314 = OpFAdd %float %311 %313 + OpStore %312 %314 + OpBranch %305 + %305 = OpLabel + %315 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %316 = OpLoad %float %315 + %317 = OpFOrdGreaterThan %bool %316 %float_0_5 + OpSelectionMerge %318 None + OpBranchConditional %317 %319 %318 + %319 = OpLabel + %321 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %322 = OpLoad %int %321 + %323 = OpAccessChain %_ptr_Function_float %color %uint_1 + %324 = OpLoad %float %323 + %325 = OpAccessChain %_ptr_Function_float %color %uint_1 + %326 = OpConvertSToF %float %322 + %327 = OpFAdd %float %324 %326 + OpStore %325 %327 + OpBranch %318 + %318 = OpLabel + %328 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %329 = OpLoad %float %328 + %330 = OpFOrdGreaterThan %bool %329 %float_0_75 + OpSelectionMerge %331 None + OpBranchConditional %330 %332 %331 + %332 = OpLabel + %334 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %335 = OpLoad %int %334 + %336 = OpAccessChain %_ptr_Function_float %color %uint_2 + %337 = OpLoad %float %336 + %338 = OpAccessChain %_ptr_Function_float %color %uint_2 + %339 = OpConvertSToF %float %335 + %340 = OpFAdd %float %337 %339 + OpStore %338 %340 + OpBranch %331 + %331 = OpLabel + %342 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %343 = OpLoad %int %342 + %344 = OpAccessChain %_ptr_Function_float %color %uint_2 + %345 = OpLoad %float %344 + %346 = OpAccessChain %_ptr_Function_float %color %uint_2 + %347 = OpConvertSToF %float %343 + %348 = OpFAdd %float %345 %347 + OpStore %346 %348 + %349 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %350 = OpLoad %float %349 + %351 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %352 = OpLoad %float %351 + %355 = OpFSub %float %350 %352 + %353 = OpExtInst %float %354 FAbs %355 + %356 = OpFOrdLessThan %bool %353 %float_0_25 + OpSelectionMerge %357 None + OpBranchConditional %356 %358 %357 + %358 = OpLabel + %359 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %360 = OpLoad %int %359 + %361 = OpAccessChain %_ptr_Function_float %color %uint_0 + %362 = OpLoad %float %361 + %363 = OpAccessChain %_ptr_Function_float %color %uint_0 + %364 = OpConvertSToF %float %360 + %365 = OpFAdd %float %362 %364 + OpStore %363 %365 + OpBranch %357 + %357 = OpLabel + %366 = OpLoad %v3float %color + %367 = OpExtInst %v3float %354 Normalize %366 + %368 = OpCompositeExtract %float %367 0 + %369 = OpCompositeExtract %float %367 1 + %370 = OpCompositeExtract %float %367 2 + %371 = OpCompositeConstruct %v4float %368 %369 %370 %float_1 + OpStore %frag_color %371 + %372 = OpLoad %v4float %x_GLF_pos + OpStore %gl_Position %372 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %373 +%tint_symbol_1 = OpFunctionParameter %main_out + %377 = OpLabel + %378 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %378 + %379 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %379 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %116 + %381 = OpLabel + OpStore %tint_pointsize %float_1 + %382 = OpLoad %v4float %tint_symbol + OpStore %x_GLF_pos %382 + %383 = OpFunctionCall %void %main_1 + %385 = OpLoad %v4float %frag_color + %386 = OpLoad %v4float %gl_Position + %387 = OpCompositeConstruct %main_out %385 %386 + %384 = OpFunctionCall %void %tint_symbol_4 %387 + OpReturn + OpFunctionEnd +%swap_i1_i1_ = OpFunction %void None %388 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %392 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %36 + %395 = OpLoad %int %i + %396 = OpAccessChain %_ptr_Private_int %obj %uint_0 %395 + %397 = OpLoad %int %396 + OpStore %temp %397 + %399 = OpLoad %int %i + %401 = OpLoad %int %j + %402 = OpAccessChain %_ptr_Private_int %obj %uint_0 %401 + %403 = OpLoad %int %402 + %404 = OpAccessChain %_ptr_Private_int %obj %uint_0 %399 + OpStore %404 %403 + %406 = OpLoad %int %j + %407 = OpLoad %int %temp + %408 = OpAccessChain %_ptr_Private_int %obj %uint_0 %406 + OpStore %408 %407 + OpReturn + OpFunctionEnd + %quicksort_ = OpFunction %void None %116 + %410 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %36 + %h_1 = OpVariable %_ptr_Function_int Function %36 + %top = OpVariable %_ptr_Function_int Function %36 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %125 + %p = OpVariable %_ptr_Function_int Function %36 + %param_4 = OpVariable %_ptr_Function_int Function %36 + %param_5 = OpVariable %_ptr_Function_int Function %36 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %418 = OpLoad %int %top + %419 = OpIAdd %int %418 %int_1 + OpStore %top %419 + %420 = OpLoad %int %l_1 + %421 = OpAccessChain %_ptr_Function_int %stack %419 + OpStore %421 %420 + %422 = OpLoad %int %top + %423 = OpIAdd %int %422 %int_1 + OpStore %top %423 + %424 = OpLoad %int %h_1 + %425 = OpAccessChain %_ptr_Function_int %stack %423 + OpStore %425 %424 + OpBranch %426 + %426 = OpLabel + OpLoopMerge %427 %428 None + OpBranch %429 + %429 = OpLabel + %430 = OpLoad %int %top + %431 = OpSGreaterThanEqual %bool %430 %int_0 + OpSelectionMerge %432 None + OpBranchConditional %431 %433 %434 + %433 = OpLabel + OpBranch %432 + %434 = OpLabel + OpBranch %427 + %432 = OpLabel + %435 = OpLoad %int %top + %436 = OpISub %int %435 %int_1 + OpStore %top %436 + %437 = OpAccessChain %_ptr_Function_int %stack %435 + %438 = OpLoad %int %437 + OpStore %h_1 %438 + %439 = OpLoad %int %top + %440 = OpISub %int %439 %int_1 + OpStore %top %440 + %441 = OpAccessChain %_ptr_Function_int %stack %439 + %442 = OpLoad %int %441 + OpStore %l_1 %442 + %443 = OpLoad %int %l_1 + OpStore %param_4 %443 + %444 = OpLoad %int %h_1 + OpStore %param_5 %444 + %445 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %445 + %448 = OpLoad %int %p + %449 = OpLoad %int %l_1 + %450 = OpISub %int %448 %int_1 + %451 = OpSGreaterThan %bool %450 %449 + OpSelectionMerge %452 None + OpBranchConditional %451 %453 %452 + %453 = OpLabel + %454 = OpLoad %int %top + %455 = OpIAdd %int %454 %int_1 + OpStore %top %455 + %456 = OpLoad %int %l_1 + %457 = OpAccessChain %_ptr_Function_int %stack %455 + OpStore %457 %456 + %458 = OpLoad %int %top + %459 = OpIAdd %int %458 %int_1 + OpStore %top %459 + %460 = OpLoad %int %p + %461 = OpAccessChain %_ptr_Function_int %stack %459 + %462 = OpISub %int %460 %int_1 + OpStore %461 %462 + OpBranch %452 + %452 = OpLabel + %463 = OpLoad %int %p + %464 = OpLoad %int %h_1 + %465 = OpIAdd %int %463 %int_1 + %466 = OpSLessThan %bool %465 %464 + OpSelectionMerge %467 None + OpBranchConditional %466 %468 %467 + %468 = OpLabel + %469 = OpLoad %int %top + %470 = OpIAdd %int %469 %int_1 + OpStore %top %470 + %471 = OpLoad %int %p + %472 = OpAccessChain %_ptr_Function_int %stack %470 + %473 = OpIAdd %int %471 %int_1 + OpStore %472 %473 + %474 = OpLoad %int %top + %475 = OpIAdd %int %474 %int_1 + OpStore %top %475 + %476 = OpLoad %int %h_1 + %477 = OpAccessChain %_ptr_Function_int %stack %475 + OpStore %477 %476 + OpBranch %467 + %467 = OpLabel + OpBranch %428 + %428 = OpLabel + OpBranch %426 + %427 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.wgsl new file mode 100644 index 0000000000..7c15a5cc22 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.wgsl @@ -0,0 +1,356 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var x_314 : i32; + var x_315 : i32; + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_316 : i32 = *(h); + let x_318 : i32 = obj.numbers[x_316]; + pivot = x_318; + let x_319 : i32 = *(l); + i_1 = (x_319 - 1); + let x_321 : i32 = *(l); + j_1 = x_321; + loop { + let x_326 : i32 = j_1; + let x_327 : i32 = *(h); + if ((x_326 <= (x_327 - 1))) { + } else { + break; + } + let x_331 : i32 = j_1; + let x_333 : i32 = obj.numbers[x_331]; + let x_334 : i32 = pivot; + if ((x_333 <= x_334)) { + let x_338 : i32 = i_1; + i_1 = (x_338 + 1); + let x_340 : i32 = i_1; + param = x_340; + let x_341 : i32 = j_1; + param_1 = x_341; + let x_342 : i32 = param; + let x_344 : i32 = obj.numbers[x_342]; + x_315 = x_344; + let x_345 : i32 = param; + let x_346 : i32 = param_1; + let x_348 : i32 = obj.numbers[x_346]; + obj.numbers[x_345] = x_348; + let x_350 : i32 = param_1; + let x_351 : i32 = x_315; + obj.numbers[x_350] = x_351; + } + + continuing { + let x_353 : i32 = j_1; + j_1 = (x_353 + 1); + } + } + let x_355 : i32 = i_1; + param_2 = (x_355 + 1); + let x_357 : i32 = *(h); + param_3 = x_357; + let x_358 : i32 = param_2; + let x_360 : i32 = obj.numbers[x_358]; + x_314 = x_360; + let x_361 : i32 = param_2; + let x_362 : i32 = param_3; + let x_364 : i32 = obj.numbers[x_362]; + obj.numbers[x_361] = x_364; + let x_366 : i32 = param_3; + let x_367 : i32 = x_314; + obj.numbers[x_366] = x_367; + if (false) { + } else { + let x_372 : i32 = i_1; + return (x_372 + 1); + } + return 0; +} + +fn main_1() { + var x_91 : i32; + var x_92 : i32; + var x_93 : i32; + var x_94 : array; + var x_95 : i32; + var x_96 : i32; + var x_97 : i32; + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_98 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_98 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_105 : i32 = i_2; + if ((x_105 < 10)) { + } else { + break; + } + let x_108 : i32 = i_2; + let x_109 : i32 = i_2; + obj.numbers[x_108] = (10 - x_109); + let x_112 : i32 = i_2; + let x_113 : i32 = i_2; + let x_115 : i32 = obj.numbers[x_113]; + let x_116 : i32 = i_2; + let x_118 : i32 = obj.numbers[x_116]; + obj.numbers[x_112] = (x_115 * x_118); + + continuing { + let x_121 : i32 = i_2; + i_2 = (x_121 + 1); + } + } + x_91 = 0; + x_92 = 9; + x_93 = -1; + let x_123 : i32 = x_93; + let x_124 : i32 = (x_123 + 1); + x_93 = x_124; + let x_125 : i32 = x_91; + x_94[x_124] = x_125; + let x_127 : i32 = x_93; + let x_128 : i32 = (x_127 + 1); + x_93 = x_128; + let x_129 : i32 = x_92; + x_94[x_128] = x_129; + loop { + let x_135 : i32 = x_93; + if ((x_135 >= 0)) { + } else { + break; + } + let x_138 : i32 = x_93; + x_93 = (x_138 - 1); + let x_141 : i32 = x_94[x_138]; + x_92 = x_141; + let x_142 : i32 = x_93; + x_93 = (x_142 - 1); + let x_145 : i32 = x_94[x_142]; + x_91 = x_145; + let x_146 : i32 = x_91; + x_96 = x_146; + let x_147 : i32 = x_92; + x_97 = x_147; + let x_148 : i32 = performPartition_i1_i1_(&(x_96), &(x_97)); + x_95 = x_148; + let x_149 : i32 = x_95; + let x_151 : i32 = x_91; + if (((x_149 - 1) > x_151)) { + let x_155 : i32 = x_93; + let x_156 : i32 = (x_155 + 1); + x_93 = x_156; + let x_157 : i32 = x_91; + x_94[x_156] = x_157; + let x_159 : i32 = x_93; + let x_160 : i32 = (x_159 + 1); + x_93 = x_160; + let x_161 : i32 = x_95; + x_94[x_160] = (x_161 - 1); + } + let x_164 : i32 = x_95; + let x_166 : i32 = x_92; + if (((x_164 + 1) < x_166)) { + let x_170 : i32 = x_93; + let x_171 : i32 = (x_170 + 1); + x_93 = x_171; + let x_172 : i32 = x_95; + x_94[x_171] = (x_172 + 1); + let x_175 : i32 = x_93; + let x_176 : i32 = (x_175 + 1); + x_93 = x_176; + let x_177 : i32 = x_92; + x_94[x_176] = x_177; + } + } + let x_179 : vec4 = x_GLF_FragCoord; + let x_182 : vec2 = x_34.resolution; + uv = (vec2(x_179.x, x_179.y) / x_182); + color = vec3(1.0, 2.0, 3.0); + let x_185 : i32 = obj.numbers[0]; + let x_188 : f32 = color.x; + color.x = (x_188 + f32(x_185)); + let x_192 : f32 = uv.x; + if ((x_192 > 0.25)) { + let x_197 : i32 = obj.numbers[1]; + let x_200 : f32 = color.x; + color.x = (x_200 + f32(x_197)); + } + let x_204 : f32 = uv.x; + if ((x_204 > 0.5)) { + let x_209 : i32 = obj.numbers[2]; + let x_212 : f32 = color.y; + color.y = (x_212 + f32(x_209)); + } + let x_216 : f32 = uv.x; + if ((x_216 > 0.75)) { + let x_221 : i32 = obj.numbers[3]; + let x_224 : f32 = color.z; + color.z = (x_224 + f32(x_221)); + } + let x_228 : i32 = obj.numbers[4]; + let x_231 : f32 = color.y; + color.y = (x_231 + f32(x_228)); + let x_235 : f32 = uv.y; + if ((x_235 > 0.25)) { + let x_240 : i32 = obj.numbers[5]; + let x_243 : f32 = color.x; + color.x = (x_243 + f32(x_240)); + } + let x_247 : f32 = uv.y; + if ((x_247 > 0.5)) { + let x_252 : i32 = obj.numbers[6]; + let x_255 : f32 = color.y; + color.y = (x_255 + f32(x_252)); + } + let x_259 : f32 = uv.y; + if ((x_259 > 0.75)) { + let x_264 : i32 = obj.numbers[7]; + let x_267 : f32 = color.z; + color.z = (x_267 + f32(x_264)); + } + let x_271 : i32 = obj.numbers[8]; + let x_274 : f32 = color.z; + color.z = (x_274 + f32(x_271)); + let x_278 : f32 = uv.x; + let x_280 : f32 = uv.y; + if ((abs((x_278 - x_280)) < 0.25)) { + let x_287 : i32 = obj.numbers[9]; + let x_290 : f32 = color.x; + color.x = (x_290 + f32(x_287)); + } + let x_293 : vec3 = color; + let x_294 : vec3 = normalize(x_293); + frag_color = vec4(x_294.x, x_294.y, x_294.z, 1.0); + let x_299 : vec4 = x_GLF_pos; + gl_Position = x_299; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_302 : i32 = *(i); + let x_304 : i32 = obj.numbers[x_302]; + temp = x_304; + let x_305 : i32 = *(i); + let x_306 : i32 = *(j); + let x_308 : i32 = obj.numbers[x_306]; + obj.numbers[x_305] = x_308; + let x_310 : i32 = *(j); + let x_311 : i32 = temp; + obj.numbers[x_310] = x_311; + return; +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_376 : i32 = top; + let x_377 : i32 = (x_376 + 1); + top = x_377; + let x_378 : i32 = l_1; + stack[x_377] = x_378; + let x_380 : i32 = top; + let x_381 : i32 = (x_380 + 1); + top = x_381; + let x_382 : i32 = h_1; + stack[x_381] = x_382; + loop { + let x_388 : i32 = top; + if ((x_388 >= 0)) { + } else { + break; + } + let x_391 : i32 = top; + top = (x_391 - 1); + let x_394 : i32 = stack[x_391]; + h_1 = x_394; + let x_395 : i32 = top; + top = (x_395 - 1); + let x_398 : i32 = stack[x_395]; + l_1 = x_398; + let x_399 : i32 = l_1; + param_4 = x_399; + let x_400 : i32 = h_1; + param_5 = x_400; + let x_401 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_401; + let x_402 : i32 = p; + let x_404 : i32 = l_1; + if (((x_402 - 1) > x_404)) { + let x_408 : i32 = top; + let x_409 : i32 = (x_408 + 1); + top = x_409; + let x_410 : i32 = l_1; + stack[x_409] = x_410; + let x_412 : i32 = top; + let x_413 : i32 = (x_412 + 1); + top = x_413; + let x_414 : i32 = p; + stack[x_413] = (x_414 - 1); + } + let x_417 : i32 = p; + let x_419 : i32 = h_1; + if (((x_417 + 1) < x_419)) { + let x_423 : i32 = top; + let x_424 : i32 = (x_423 + 1); + top = x_424; + let x_425 : i32 = p; + stack[x_424] = (x_425 + 1); + let x_428 : i32 = top; + let x_429 : i32 = (x_428 + 1); + top = x_429; + let x_430 : i32 = h_1; + stack[x_429] = x_430; + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl new file mode 100644 index 0000000000..7c15a5cc22 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl @@ -0,0 +1,356 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var x_314 : i32; + var x_315 : i32; + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_316 : i32 = *(h); + let x_318 : i32 = obj.numbers[x_316]; + pivot = x_318; + let x_319 : i32 = *(l); + i_1 = (x_319 - 1); + let x_321 : i32 = *(l); + j_1 = x_321; + loop { + let x_326 : i32 = j_1; + let x_327 : i32 = *(h); + if ((x_326 <= (x_327 - 1))) { + } else { + break; + } + let x_331 : i32 = j_1; + let x_333 : i32 = obj.numbers[x_331]; + let x_334 : i32 = pivot; + if ((x_333 <= x_334)) { + let x_338 : i32 = i_1; + i_1 = (x_338 + 1); + let x_340 : i32 = i_1; + param = x_340; + let x_341 : i32 = j_1; + param_1 = x_341; + let x_342 : i32 = param; + let x_344 : i32 = obj.numbers[x_342]; + x_315 = x_344; + let x_345 : i32 = param; + let x_346 : i32 = param_1; + let x_348 : i32 = obj.numbers[x_346]; + obj.numbers[x_345] = x_348; + let x_350 : i32 = param_1; + let x_351 : i32 = x_315; + obj.numbers[x_350] = x_351; + } + + continuing { + let x_353 : i32 = j_1; + j_1 = (x_353 + 1); + } + } + let x_355 : i32 = i_1; + param_2 = (x_355 + 1); + let x_357 : i32 = *(h); + param_3 = x_357; + let x_358 : i32 = param_2; + let x_360 : i32 = obj.numbers[x_358]; + x_314 = x_360; + let x_361 : i32 = param_2; + let x_362 : i32 = param_3; + let x_364 : i32 = obj.numbers[x_362]; + obj.numbers[x_361] = x_364; + let x_366 : i32 = param_3; + let x_367 : i32 = x_314; + obj.numbers[x_366] = x_367; + if (false) { + } else { + let x_372 : i32 = i_1; + return (x_372 + 1); + } + return 0; +} + +fn main_1() { + var x_91 : i32; + var x_92 : i32; + var x_93 : i32; + var x_94 : array; + var x_95 : i32; + var x_96 : i32; + var x_97 : i32; + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_98 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_98 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_105 : i32 = i_2; + if ((x_105 < 10)) { + } else { + break; + } + let x_108 : i32 = i_2; + let x_109 : i32 = i_2; + obj.numbers[x_108] = (10 - x_109); + let x_112 : i32 = i_2; + let x_113 : i32 = i_2; + let x_115 : i32 = obj.numbers[x_113]; + let x_116 : i32 = i_2; + let x_118 : i32 = obj.numbers[x_116]; + obj.numbers[x_112] = (x_115 * x_118); + + continuing { + let x_121 : i32 = i_2; + i_2 = (x_121 + 1); + } + } + x_91 = 0; + x_92 = 9; + x_93 = -1; + let x_123 : i32 = x_93; + let x_124 : i32 = (x_123 + 1); + x_93 = x_124; + let x_125 : i32 = x_91; + x_94[x_124] = x_125; + let x_127 : i32 = x_93; + let x_128 : i32 = (x_127 + 1); + x_93 = x_128; + let x_129 : i32 = x_92; + x_94[x_128] = x_129; + loop { + let x_135 : i32 = x_93; + if ((x_135 >= 0)) { + } else { + break; + } + let x_138 : i32 = x_93; + x_93 = (x_138 - 1); + let x_141 : i32 = x_94[x_138]; + x_92 = x_141; + let x_142 : i32 = x_93; + x_93 = (x_142 - 1); + let x_145 : i32 = x_94[x_142]; + x_91 = x_145; + let x_146 : i32 = x_91; + x_96 = x_146; + let x_147 : i32 = x_92; + x_97 = x_147; + let x_148 : i32 = performPartition_i1_i1_(&(x_96), &(x_97)); + x_95 = x_148; + let x_149 : i32 = x_95; + let x_151 : i32 = x_91; + if (((x_149 - 1) > x_151)) { + let x_155 : i32 = x_93; + let x_156 : i32 = (x_155 + 1); + x_93 = x_156; + let x_157 : i32 = x_91; + x_94[x_156] = x_157; + let x_159 : i32 = x_93; + let x_160 : i32 = (x_159 + 1); + x_93 = x_160; + let x_161 : i32 = x_95; + x_94[x_160] = (x_161 - 1); + } + let x_164 : i32 = x_95; + let x_166 : i32 = x_92; + if (((x_164 + 1) < x_166)) { + let x_170 : i32 = x_93; + let x_171 : i32 = (x_170 + 1); + x_93 = x_171; + let x_172 : i32 = x_95; + x_94[x_171] = (x_172 + 1); + let x_175 : i32 = x_93; + let x_176 : i32 = (x_175 + 1); + x_93 = x_176; + let x_177 : i32 = x_92; + x_94[x_176] = x_177; + } + } + let x_179 : vec4 = x_GLF_FragCoord; + let x_182 : vec2 = x_34.resolution; + uv = (vec2(x_179.x, x_179.y) / x_182); + color = vec3(1.0, 2.0, 3.0); + let x_185 : i32 = obj.numbers[0]; + let x_188 : f32 = color.x; + color.x = (x_188 + f32(x_185)); + let x_192 : f32 = uv.x; + if ((x_192 > 0.25)) { + let x_197 : i32 = obj.numbers[1]; + let x_200 : f32 = color.x; + color.x = (x_200 + f32(x_197)); + } + let x_204 : f32 = uv.x; + if ((x_204 > 0.5)) { + let x_209 : i32 = obj.numbers[2]; + let x_212 : f32 = color.y; + color.y = (x_212 + f32(x_209)); + } + let x_216 : f32 = uv.x; + if ((x_216 > 0.75)) { + let x_221 : i32 = obj.numbers[3]; + let x_224 : f32 = color.z; + color.z = (x_224 + f32(x_221)); + } + let x_228 : i32 = obj.numbers[4]; + let x_231 : f32 = color.y; + color.y = (x_231 + f32(x_228)); + let x_235 : f32 = uv.y; + if ((x_235 > 0.25)) { + let x_240 : i32 = obj.numbers[5]; + let x_243 : f32 = color.x; + color.x = (x_243 + f32(x_240)); + } + let x_247 : f32 = uv.y; + if ((x_247 > 0.5)) { + let x_252 : i32 = obj.numbers[6]; + let x_255 : f32 = color.y; + color.y = (x_255 + f32(x_252)); + } + let x_259 : f32 = uv.y; + if ((x_259 > 0.75)) { + let x_264 : i32 = obj.numbers[7]; + let x_267 : f32 = color.z; + color.z = (x_267 + f32(x_264)); + } + let x_271 : i32 = obj.numbers[8]; + let x_274 : f32 = color.z; + color.z = (x_274 + f32(x_271)); + let x_278 : f32 = uv.x; + let x_280 : f32 = uv.y; + if ((abs((x_278 - x_280)) < 0.25)) { + let x_287 : i32 = obj.numbers[9]; + let x_290 : f32 = color.x; + color.x = (x_290 + f32(x_287)); + } + let x_293 : vec3 = color; + let x_294 : vec3 = normalize(x_293); + frag_color = vec4(x_294.x, x_294.y, x_294.z, 1.0); + let x_299 : vec4 = x_GLF_pos; + gl_Position = x_299; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_302 : i32 = *(i); + let x_304 : i32 = obj.numbers[x_302]; + temp = x_304; + let x_305 : i32 = *(i); + let x_306 : i32 = *(j); + let x_308 : i32 = obj.numbers[x_306]; + obj.numbers[x_305] = x_308; + let x_310 : i32 = *(j); + let x_311 : i32 = temp; + obj.numbers[x_310] = x_311; + return; +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_376 : i32 = top; + let x_377 : i32 = (x_376 + 1); + top = x_377; + let x_378 : i32 = l_1; + stack[x_377] = x_378; + let x_380 : i32 = top; + let x_381 : i32 = (x_380 + 1); + top = x_381; + let x_382 : i32 = h_1; + stack[x_381] = x_382; + loop { + let x_388 : i32 = top; + if ((x_388 >= 0)) { + } else { + break; + } + let x_391 : i32 = top; + top = (x_391 - 1); + let x_394 : i32 = stack[x_391]; + h_1 = x_394; + let x_395 : i32 = top; + top = (x_395 - 1); + let x_398 : i32 = stack[x_395]; + l_1 = x_398; + let x_399 : i32 = l_1; + param_4 = x_399; + let x_400 : i32 = h_1; + param_5 = x_400; + let x_401 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_401; + let x_402 : i32 = p; + let x_404 : i32 = l_1; + if (((x_402 - 1) > x_404)) { + let x_408 : i32 = top; + let x_409 : i32 = (x_408 + 1); + top = x_409; + let x_410 : i32 = l_1; + stack[x_409] = x_410; + let x_412 : i32 = top; + let x_413 : i32 = (x_412 + 1); + top = x_413; + let x_414 : i32 = p; + stack[x_413] = (x_414 - 1); + } + let x_417 : i32 = p; + let x_419 : i32 = h_1; + if (((x_417 + 1) < x_419)) { + let x_423 : i32 = top; + let x_424 : i32 = (x_423 + 1); + top = x_424; + let x_425 : i32 = p; + stack[x_424] = (x_425 + 1); + let x_428 : i32 = top; + let x_429 : i32 = (x_428 + 1); + top = x_429; + let x_430 : i32 = h_1; + stack[x_429] = x_430; + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.hlsl new file mode 100644 index 0000000000..dd128c452e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.hlsl @@ -0,0 +1,284 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_34 : register(b0, space0) { + uint4 x_34[1]; +}; +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int performPartition_i1_i1_(inout int l, inout int h) { + int x_314 = 0; + int x_315 = 0; + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_316 = h; + const int x_318 = obj.numbers[x_316]; + pivot = x_318; + const int x_319 = l; + i_1 = (x_319 - 1); + const int x_321 = l; + j_1 = x_321; + while (true) { + const int x_326 = j_1; + const int x_327 = h; + if ((x_326 <= (x_327 - 1))) { + } else { + break; + } + const int x_333 = obj.numbers[j_1]; + if ((x_333 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + const int x_344 = obj.numbers[param]; + x_315 = x_344; + const int x_345 = param; + const int x_348 = obj.numbers[param_1]; + obj.numbers[x_345] = x_348; + obj.numbers[param_1] = x_315; + } + { + j_1 = (j_1 + 1); + } + } + param_2 = (i_1 + 1); + const int x_357 = h; + param_3 = x_357; + const int x_360 = obj.numbers[param_2]; + x_314 = x_360; + const int x_361 = param_2; + const int x_364 = obj.numbers[param_3]; + obj.numbers[x_361] = x_364; + obj.numbers[param_3] = x_314; + if (false) { + } else { + return (i_1 + 1); + } + return 0; +} + +void main_1() { + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + int x_94[10] = (int[10])0; + int x_95 = 0; + int x_96 = 0; + int x_97 = 0; + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_112 = i_2; + const int x_115 = obj.numbers[i_2]; + const int x_118 = obj.numbers[i_2]; + obj.numbers[x_112] = (x_115 * x_118); + } + } + x_91 = 0; + x_92 = 9; + x_93 = -1; + const int x_124 = (x_93 + 1); + x_93 = x_124; + x_94[x_124] = x_91; + const int x_128 = (x_93 + 1); + x_93 = x_128; + x_94[x_128] = x_92; + while (true) { + if ((x_93 >= 0)) { + } else { + break; + } + const int x_138 = x_93; + x_93 = (x_138 - 1); + const int x_141 = x_94[x_138]; + x_92 = x_141; + const int x_142 = x_93; + x_93 = (x_142 - 1); + const int x_145 = x_94[x_142]; + x_91 = x_145; + x_96 = x_91; + x_97 = x_92; + const int x_148 = performPartition_i1_i1_(x_96, x_97); + x_95 = x_148; + if (((x_95 - 1) > x_91)) { + const int x_156 = (x_93 + 1); + x_93 = x_156; + x_94[x_156] = x_91; + const int x_160 = (x_93 + 1); + x_93 = x_160; + x_94[x_160] = (x_95 - 1); + } + if (((x_95 + 1) < x_92)) { + const int x_171 = (x_93 + 1); + x_93 = x_171; + x_94[x_171] = (x_95 + 1); + const int x_176 = (x_93 + 1); + x_93 = x_176; + x_94[x_176] = x_92; + } + } + const float4 x_179 = x_GLF_FragCoord; + const float2 x_182 = asfloat(x_34[0].xy); + uv = (float2(x_179.x, x_179.y) / x_182); + color = float3(1.0f, 2.0f, 3.0f); + const int x_185 = obj.numbers[0]; + const float x_188 = color.x; + color.x = (x_188 + float(x_185)); + const float x_192 = uv.x; + if ((x_192 > 0.25f)) { + const int x_197 = obj.numbers[1]; + const float x_200 = color.x; + color.x = (x_200 + float(x_197)); + } + const float x_204 = uv.x; + if ((x_204 > 0.5f)) { + const int x_209 = obj.numbers[2]; + const float x_212 = color.y; + color.y = (x_212 + float(x_209)); + } + const float x_216 = uv.x; + if ((x_216 > 0.75f)) { + const int x_221 = obj.numbers[3]; + const float x_224 = color.z; + color.z = (x_224 + float(x_221)); + } + const int x_228 = obj.numbers[4]; + const float x_231 = color.y; + color.y = (x_231 + float(x_228)); + const float x_235 = uv.y; + if ((x_235 > 0.25f)) { + const int x_240 = obj.numbers[5]; + const float x_243 = color.x; + color.x = (x_243 + float(x_240)); + } + const float x_247 = uv.y; + if ((x_247 > 0.5f)) { + const int x_252 = obj.numbers[6]; + const float x_255 = color.y; + color.y = (x_255 + float(x_252)); + } + const float x_259 = uv.y; + if ((x_259 > 0.75f)) { + const int x_264 = obj.numbers[7]; + const float x_267 = color.z; + color.z = (x_267 + float(x_264)); + } + const int x_271 = obj.numbers[8]; + const float x_274 = color.z; + color.z = (x_274 + float(x_271)); + const float x_278 = uv.x; + const float x_280 = uv.y; + if ((abs((x_278 - x_280)) < 0.25f)) { + const int x_287 = obj.numbers[9]; + const float x_290 = color.x; + color.x = (x_290 + float(x_287)); + } + const float3 x_294 = normalize(color); + frag_color = float4(x_294.x, x_294.y, x_294.z, 1.0f); + gl_Position = x_GLF_pos; + return; +} + +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 x_GLF_pos_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_GLF_pos_param = tint_symbol.x_GLF_pos_param; + x_GLF_pos = x_GLF_pos_param; + main_1(); + const main_out tint_symbol_3 = {frag_color, gl_Position}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_5; +} + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_302 = i; + const int x_304 = obj.numbers[x_302]; + temp = x_304; + const int x_305 = i; + const int x_306 = j; + const int x_308 = obj.numbers[x_306]; + obj.numbers[x_305] = x_308; + const int x_310 = j; + obj.numbers[x_310] = temp; + return; +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_377 = (top + 1); + top = x_377; + stack[x_377] = l_1; + const int x_381 = (top + 1); + top = x_381; + stack[x_381] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_391 = top; + top = (x_391 - 1); + const int x_394 = stack[x_391]; + h_1 = x_394; + const int x_395 = top; + top = (x_395 - 1); + const int x_398 = stack[x_395]; + l_1 = x_398; + param_4 = l_1; + param_5 = h_1; + const int x_401 = performPartition_i1_i1_(param_4, param_5); + p = x_401; + if (((p - 1) > l_1)) { + const int x_409 = (top + 1); + top = x_409; + stack[x_409] = l_1; + const int x_413 = (top + 1); + top = x_413; + stack[x_413] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_424 = (top + 1); + top = x_424; + stack[x_424] = (p + 1); + const int x_429 = (top + 1); + top = x_429; + stack[x_429] = h_1; + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.msl new file mode 100644 index 0000000000..f6f5a8ad0b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.msl @@ -0,0 +1,358 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_pos_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_6) { + int x_314 = 0; + int x_315 = 0; + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_316 = *(h); + int const x_318 = (*(tint_symbol_6)).numbers.arr[x_316]; + pivot = x_318; + int const x_319 = *(l); + i_1 = (x_319 - 1); + int const x_321 = *(l); + j_1 = x_321; + while (true) { + int const x_326 = j_1; + int const x_327 = *(h); + if ((x_326 <= (x_327 - 1))) { + } else { + break; + } + int const x_331 = j_1; + int const x_333 = (*(tint_symbol_6)).numbers.arr[x_331]; + int const x_334 = pivot; + if ((x_333 <= x_334)) { + int const x_338 = i_1; + i_1 = (x_338 + 1); + int const x_340 = i_1; + param = x_340; + int const x_341 = j_1; + param_1 = x_341; + int const x_342 = param; + int const x_344 = (*(tint_symbol_6)).numbers.arr[x_342]; + x_315 = x_344; + int const x_345 = param; + int const x_346 = param_1; + int const x_348 = (*(tint_symbol_6)).numbers.arr[x_346]; + (*(tint_symbol_6)).numbers.arr[x_345] = x_348; + int const x_350 = param_1; + int const x_351 = x_315; + (*(tint_symbol_6)).numbers.arr[x_350] = x_351; + } + { + int const x_353 = j_1; + j_1 = (x_353 + 1); + } + } + int const x_355 = i_1; + param_2 = (x_355 + 1); + int const x_357 = *(h); + param_3 = x_357; + int const x_358 = param_2; + int const x_360 = (*(tint_symbol_6)).numbers.arr[x_358]; + x_314 = x_360; + int const x_361 = param_2; + int const x_362 = param_3; + int const x_364 = (*(tint_symbol_6)).numbers.arr[x_362]; + (*(tint_symbol_6)).numbers.arr[x_361] = x_364; + int const x_366 = param_3; + int const x_367 = x_314; + (*(tint_symbol_6)).numbers.arr[x_366] = x_367; + if (false) { + } else { + int const x_372 = i_1; + return (x_372 + 1); + } + return 0; +} + +void main_1(constant buf0& x_34, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8, thread QuicksortObject* const tint_symbol_9, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) { + int x_91 = 0; + int x_92 = 0; + int x_93 = 0; + tint_array_wrapper x_94 = {}; + int x_95 = 0; + int x_96 = 0; + int x_97 = 0; + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + float4 const x_98 = *(tint_symbol_7); + *(tint_symbol_8) = ((x_98 + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + while (true) { + int const x_105 = i_2; + if ((x_105 < 10)) { + } else { + break; + } + int const x_108 = i_2; + int const x_109 = i_2; + (*(tint_symbol_9)).numbers.arr[x_108] = (10 - x_109); + int const x_112 = i_2; + int const x_113 = i_2; + int const x_115 = (*(tint_symbol_9)).numbers.arr[x_113]; + int const x_116 = i_2; + int const x_118 = (*(tint_symbol_9)).numbers.arr[x_116]; + (*(tint_symbol_9)).numbers.arr[x_112] = (x_115 * x_118); + { + int const x_121 = i_2; + i_2 = (x_121 + 1); + } + } + x_91 = 0; + x_92 = 9; + x_93 = -1; + int const x_123 = x_93; + int const x_124 = (x_123 + 1); + x_93 = x_124; + int const x_125 = x_91; + x_94.arr[x_124] = x_125; + int const x_127 = x_93; + int const x_128 = (x_127 + 1); + x_93 = x_128; + int const x_129 = x_92; + x_94.arr[x_128] = x_129; + while (true) { + int const x_135 = x_93; + if ((x_135 >= 0)) { + } else { + break; + } + int const x_138 = x_93; + x_93 = (x_138 - 1); + int const x_141 = x_94.arr[x_138]; + x_92 = x_141; + int const x_142 = x_93; + x_93 = (x_142 - 1); + int const x_145 = x_94.arr[x_142]; + x_91 = x_145; + int const x_146 = x_91; + x_96 = x_146; + int const x_147 = x_92; + x_97 = x_147; + int const x_148 = performPartition_i1_i1_(&(x_96), &(x_97), tint_symbol_9); + x_95 = x_148; + int const x_149 = x_95; + int const x_151 = x_91; + if (((x_149 - 1) > x_151)) { + int const x_155 = x_93; + int const x_156 = (x_155 + 1); + x_93 = x_156; + int const x_157 = x_91; + x_94.arr[x_156] = x_157; + int const x_159 = x_93; + int const x_160 = (x_159 + 1); + x_93 = x_160; + int const x_161 = x_95; + x_94.arr[x_160] = (x_161 - 1); + } + int const x_164 = x_95; + int const x_166 = x_92; + if (((x_164 + 1) < x_166)) { + int const x_170 = x_93; + int const x_171 = (x_170 + 1); + x_93 = x_171; + int const x_172 = x_95; + x_94.arr[x_171] = (x_172 + 1); + int const x_175 = x_93; + int const x_176 = (x_175 + 1); + x_93 = x_176; + int const x_177 = x_92; + x_94.arr[x_176] = x_177; + } + } + float4 const x_179 = *(tint_symbol_8); + float2 const x_182 = x_34.resolution; + uv = (float2(x_179.x, x_179.y) / x_182); + color = float3(1.0f, 2.0f, 3.0f); + int const x_185 = (*(tint_symbol_9)).numbers.arr[0]; + float const x_188 = color.x; + color.x = (x_188 + float(x_185)); + float const x_192 = uv.x; + if ((x_192 > 0.25f)) { + int const x_197 = (*(tint_symbol_9)).numbers.arr[1]; + float const x_200 = color.x; + color.x = (x_200 + float(x_197)); + } + float const x_204 = uv.x; + if ((x_204 > 0.5f)) { + int const x_209 = (*(tint_symbol_9)).numbers.arr[2]; + float const x_212 = color.y; + color.y = (x_212 + float(x_209)); + } + float const x_216 = uv.x; + if ((x_216 > 0.75f)) { + int const x_221 = (*(tint_symbol_9)).numbers.arr[3]; + float const x_224 = color.z; + color.z = (x_224 + float(x_221)); + } + int const x_228 = (*(tint_symbol_9)).numbers.arr[4]; + float const x_231 = color.y; + color.y = (x_231 + float(x_228)); + float const x_235 = uv.y; + if ((x_235 > 0.25f)) { + int const x_240 = (*(tint_symbol_9)).numbers.arr[5]; + float const x_243 = color.x; + color.x = (x_243 + float(x_240)); + } + float const x_247 = uv.y; + if ((x_247 > 0.5f)) { + int const x_252 = (*(tint_symbol_9)).numbers.arr[6]; + float const x_255 = color.y; + color.y = (x_255 + float(x_252)); + } + float const x_259 = uv.y; + if ((x_259 > 0.75f)) { + int const x_264 = (*(tint_symbol_9)).numbers.arr[7]; + float const x_267 = color.z; + color.z = (x_267 + float(x_264)); + } + int const x_271 = (*(tint_symbol_9)).numbers.arr[8]; + float const x_274 = color.z; + color.z = (x_274 + float(x_271)); + float const x_278 = uv.x; + float const x_280 = uv.y; + if ((fabs((x_278 - x_280)) < 0.25f)) { + int const x_287 = (*(tint_symbol_9)).numbers.arr[9]; + float const x_290 = color.x; + color.x = (x_290 + float(x_287)); + } + float3 const x_293 = color; + float3 const x_294 = normalize(x_293); + *(tint_symbol_10) = float4(x_294.x, x_294.y, x_294.z, 1.0f); + float4 const x_299 = *(tint_symbol_7); + *(tint_symbol_11) = x_299; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant buf0& x_34 [[buffer(0)]]) { + thread float4 tint_symbol_12 = 0.0f; + thread float4 tint_symbol_13 = 0.0f; + thread QuicksortObject tint_symbol_14 = {}; + thread float4 tint_symbol_15 = 0.0f; + thread float4 tint_symbol_16 = 0.0f; + float4 const x_GLF_pos_param = tint_symbol_1.x_GLF_pos_param; + tint_symbol_12 = x_GLF_pos_param; + main_1(x_34, &(tint_symbol_12), &(tint_symbol_13), &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_16)); + main_out const tint_symbol_4 = {.frag_color_1=tint_symbol_15, .gl_Position=tint_symbol_16}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_17) { + int temp = 0; + int const x_302 = *(i); + int const x_304 = (*(tint_symbol_17)).numbers.arr[x_302]; + temp = x_304; + int const x_305 = *(i); + int const x_306 = *(j); + int const x_308 = (*(tint_symbol_17)).numbers.arr[x_306]; + (*(tint_symbol_17)).numbers.arr[x_305] = x_308; + int const x_310 = *(j); + int const x_311 = temp; + (*(tint_symbol_17)).numbers.arr[x_310] = x_311; + return; +} + +void quicksort_(thread QuicksortObject* const tint_symbol_18) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_376 = top; + int const x_377 = (x_376 + 1); + top = x_377; + int const x_378 = l_1; + stack.arr[x_377] = x_378; + int const x_380 = top; + int const x_381 = (x_380 + 1); + top = x_381; + int const x_382 = h_1; + stack.arr[x_381] = x_382; + while (true) { + int const x_388 = top; + if ((x_388 >= 0)) { + } else { + break; + } + int const x_391 = top; + top = (x_391 - 1); + int const x_394 = stack.arr[x_391]; + h_1 = x_394; + int const x_395 = top; + top = (x_395 - 1); + int const x_398 = stack.arr[x_395]; + l_1 = x_398; + int const x_399 = l_1; + param_4 = x_399; + int const x_400 = h_1; + param_5 = x_400; + int const x_401 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_18); + p = x_401; + int const x_402 = p; + int const x_404 = l_1; + if (((x_402 - 1) > x_404)) { + int const x_408 = top; + int const x_409 = (x_408 + 1); + top = x_409; + int const x_410 = l_1; + stack.arr[x_409] = x_410; + int const x_412 = top; + int const x_413 = (x_412 + 1); + top = x_413; + int const x_414 = p; + stack.arr[x_413] = (x_414 - 1); + } + int const x_417 = p; + int const x_419 = h_1; + if (((x_417 + 1) < x_419)) { + int const x_423 = top; + int const x_424 = (x_423 + 1); + top = x_424; + int const x_425 = p; + stack.arr[x_424] = (x_425 + 1); + int const x_428 = top; + int const x_429 = (x_428 + 1); + top = x_429; + int const x_430 = h_1; + stack.arr[x_429] = x_430; + } + } + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.spvasm new file mode 100644 index 0000000000..01d7e035e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.spvasm @@ -0,0 +1,713 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 478 +; Schema: 0 + OpCapability Shader + %354 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %x_GLF_FragCoord "x_GLF_FragCoord" + OpName %x_GLF_pos "x_GLF_pos" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_34 "x_34" + OpName %frag_color "frag_color" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %x_314 "x_314" + OpName %x_315 "x_315" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %main_1 "main_1" + OpName %x_91 "x_91" + OpName %x_92 "x_92" + OpName %x_93 "x_93" + OpName %x_94 "x_94" + OpName %x_95 "x_95" + OpName %x_96 "x_96" + OpName %x_97 "x_97" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "frag_color_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpDecorate %tint_pointsize BuiltIn PointSize + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_34 NonWritable + OpDecorate %x_34 DescriptorSet 0 + OpDecorate %x_34 Binding 0 + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_3 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %12 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private %16 + %x_GLF_pos = OpVariable %_ptr_Private_v4float Private %16 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_34 = OpVariable %_ptr_Uniform_buf0 Uniform + %frag_color = OpVariable %_ptr_Private_v4float Private %16 +%gl_Position = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %16 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %16 +%_ptr_Function_int = OpTypePointer Function %int + %29 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %36 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %int_0 = OpConstant %int 0 + %void = OpTypeVoid + %116 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %125 = OpConstantNull %_arr_int_uint_10 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %132 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %136 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %140 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %143 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_10 = OpConstant %int 10 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %242 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float %v4float + %373 = OpTypeFunction %void %main_out + %388 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int +%performPartition_i1_i1_ = OpFunction %int None %29 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %34 = OpLabel + %x_314 = OpVariable %_ptr_Function_int Function %36 + %x_315 = OpVariable %_ptr_Function_int Function %36 + %pivot = OpVariable %_ptr_Function_int Function %36 + %i_1 = OpVariable %_ptr_Function_int Function %36 + %j_1 = OpVariable %_ptr_Function_int Function %36 + %param = OpVariable %_ptr_Function_int Function %36 + %param_1 = OpVariable %_ptr_Function_int Function %36 + %param_2 = OpVariable %_ptr_Function_int Function %36 + %param_3 = OpVariable %_ptr_Function_int Function %36 + %46 = OpLoad %int %h + %49 = OpAccessChain %_ptr_Private_int %obj %uint_0 %46 + %50 = OpLoad %int %49 + OpStore %pivot %50 + %52 = OpLoad %int %l + %54 = OpISub %int %52 %int_1 + OpStore %i_1 %54 + %56 = OpLoad %int %l + OpStore %j_1 %56 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %j_1 + %63 = OpLoad %int %h + %64 = OpISub %int %63 %int_1 + %65 = OpSLessThanEqual %bool %61 %64 + OpSelectionMerge %67 None + OpBranchConditional %65 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %58 + %67 = OpLabel + %70 = OpLoad %int %j_1 + %71 = OpAccessChain %_ptr_Private_int %obj %uint_0 %70 + %72 = OpLoad %int %71 + %73 = OpLoad %int %pivot + %74 = OpSLessThanEqual %bool %72 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + %77 = OpLoad %int %i_1 + %78 = OpIAdd %int %77 %int_1 + OpStore %i_1 %78 + %79 = OpLoad %int %i_1 + OpStore %param %79 + %80 = OpLoad %int %j_1 + OpStore %param_1 %80 + %81 = OpLoad %int %param + %82 = OpAccessChain %_ptr_Private_int %obj %uint_0 %81 + %83 = OpLoad %int %82 + OpStore %x_315 %83 + %84 = OpLoad %int %param + %85 = OpLoad %int %param_1 + %86 = OpAccessChain %_ptr_Private_int %obj %uint_0 %85 + %87 = OpLoad %int %86 + %88 = OpAccessChain %_ptr_Private_int %obj %uint_0 %84 + OpStore %88 %87 + %89 = OpLoad %int %param_1 + %90 = OpLoad %int %x_315 + %91 = OpAccessChain %_ptr_Private_int %obj %uint_0 %89 + OpStore %91 %90 + OpBranch %75 + %75 = OpLabel + OpBranch %59 + %59 = OpLabel + %92 = OpLoad %int %j_1 + %93 = OpIAdd %int %92 %int_1 + OpStore %j_1 %93 + OpBranch %57 + %58 = OpLabel + %94 = OpLoad %int %i_1 + %95 = OpIAdd %int %94 %int_1 + OpStore %param_2 %95 + %97 = OpLoad %int %h + OpStore %param_3 %97 + %98 = OpLoad %int %param_2 + %99 = OpAccessChain %_ptr_Private_int %obj %uint_0 %98 + %100 = OpLoad %int %99 + OpStore %x_314 %100 + %101 = OpLoad %int %param_2 + %102 = OpLoad %int %param_3 + %103 = OpAccessChain %_ptr_Private_int %obj %uint_0 %102 + %104 = OpLoad %int %103 + %105 = OpAccessChain %_ptr_Private_int %obj %uint_0 %101 + OpStore %105 %104 + %106 = OpLoad %int %param_3 + %107 = OpLoad %int %x_314 + %108 = OpAccessChain %_ptr_Private_int %obj %uint_0 %106 + OpStore %108 %107 + OpSelectionMerge %110 None + OpBranchConditional %false %111 %112 + %111 = OpLabel + OpBranch %110 + %112 = OpLabel + %113 = OpLoad %int %i_1 + %114 = OpIAdd %int %113 %int_1 + OpReturnValue %114 + %110 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %116 + %119 = OpLabel + %x_91 = OpVariable %_ptr_Function_int Function %36 + %x_92 = OpVariable %_ptr_Function_int Function %36 + %x_93 = OpVariable %_ptr_Function_int Function %36 + %x_94 = OpVariable %_ptr_Function__arr_int_uint_10 Function %125 + %x_95 = OpVariable %_ptr_Function_int Function %36 + %x_96 = OpVariable %_ptr_Function_int Function %36 + %x_97 = OpVariable %_ptr_Function_int Function %36 + %i_2 = OpVariable %_ptr_Function_int Function %36 + %uv = OpVariable %_ptr_Function_v2float Function %132 + %color = OpVariable %_ptr_Function_v3float Function %136 + %137 = OpLoad %v4float %x_GLF_pos + %141 = OpFAdd %v4float %137 %140 + %144 = OpFMul %v4float %141 %143 + OpStore %x_GLF_FragCoord %144 + OpStore %i_2 %int_0 + OpBranch %145 + %145 = OpLabel + OpLoopMerge %146 %147 None + OpBranch %148 + %148 = OpLabel + %149 = OpLoad %int %i_2 + %151 = OpSLessThan %bool %149 %int_10 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %154 + %153 = OpLabel + OpBranch %152 + %154 = OpLabel + OpBranch %146 + %152 = OpLabel + %155 = OpLoad %int %i_2 + %156 = OpLoad %int %i_2 + %157 = OpAccessChain %_ptr_Private_int %obj %uint_0 %155 + %158 = OpISub %int %int_10 %156 + OpStore %157 %158 + %159 = OpLoad %int %i_2 + %160 = OpLoad %int %i_2 + %161 = OpAccessChain %_ptr_Private_int %obj %uint_0 %160 + %162 = OpLoad %int %161 + %163 = OpLoad %int %i_2 + %164 = OpAccessChain %_ptr_Private_int %obj %uint_0 %163 + %165 = OpLoad %int %164 + %166 = OpAccessChain %_ptr_Private_int %obj %uint_0 %159 + %167 = OpIMul %int %162 %165 + OpStore %166 %167 + OpBranch %147 + %147 = OpLabel + %168 = OpLoad %int %i_2 + %169 = OpIAdd %int %168 %int_1 + OpStore %i_2 %169 + OpBranch %145 + %146 = OpLabel + OpStore %x_91 %int_0 + OpStore %x_92 %int_9 + OpStore %x_93 %int_n1 + %172 = OpLoad %int %x_93 + %173 = OpIAdd %int %172 %int_1 + OpStore %x_93 %173 + %174 = OpLoad %int %x_91 + %175 = OpAccessChain %_ptr_Function_int %x_94 %173 + OpStore %175 %174 + %176 = OpLoad %int %x_93 + %177 = OpIAdd %int %176 %int_1 + OpStore %x_93 %177 + %178 = OpLoad %int %x_92 + %179 = OpAccessChain %_ptr_Function_int %x_94 %177 + OpStore %179 %178 + OpBranch %180 + %180 = OpLabel + OpLoopMerge %181 %182 None + OpBranch %183 + %183 = OpLabel + %184 = OpLoad %int %x_93 + %185 = OpSGreaterThanEqual %bool %184 %int_0 + OpSelectionMerge %186 None + OpBranchConditional %185 %187 %188 + %187 = OpLabel + OpBranch %186 + %188 = OpLabel + OpBranch %181 + %186 = OpLabel + %189 = OpLoad %int %x_93 + %190 = OpISub %int %189 %int_1 + OpStore %x_93 %190 + %191 = OpAccessChain %_ptr_Function_int %x_94 %189 + %192 = OpLoad %int %191 + OpStore %x_92 %192 + %193 = OpLoad %int %x_93 + %194 = OpISub %int %193 %int_1 + OpStore %x_93 %194 + %195 = OpAccessChain %_ptr_Function_int %x_94 %193 + %196 = OpLoad %int %195 + OpStore %x_91 %196 + %197 = OpLoad %int %x_91 + OpStore %x_96 %197 + %198 = OpLoad %int %x_92 + OpStore %x_97 %198 + %199 = OpFunctionCall %int %performPartition_i1_i1_ %x_96 %x_97 + OpStore %x_95 %199 + %202 = OpLoad %int %x_95 + %203 = OpLoad %int %x_91 + %204 = OpISub %int %202 %int_1 + %205 = OpSGreaterThan %bool %204 %203 + OpSelectionMerge %206 None + OpBranchConditional %205 %207 %206 + %207 = OpLabel + %208 = OpLoad %int %x_93 + %209 = OpIAdd %int %208 %int_1 + OpStore %x_93 %209 + %210 = OpLoad %int %x_91 + %211 = OpAccessChain %_ptr_Function_int %x_94 %209 + OpStore %211 %210 + %212 = OpLoad %int %x_93 + %213 = OpIAdd %int %212 %int_1 + OpStore %x_93 %213 + %214 = OpLoad %int %x_95 + %215 = OpAccessChain %_ptr_Function_int %x_94 %213 + %216 = OpISub %int %214 %int_1 + OpStore %215 %216 + OpBranch %206 + %206 = OpLabel + %217 = OpLoad %int %x_95 + %218 = OpLoad %int %x_92 + %219 = OpIAdd %int %217 %int_1 + %220 = OpSLessThan %bool %219 %218 + OpSelectionMerge %221 None + OpBranchConditional %220 %222 %221 + %222 = OpLabel + %223 = OpLoad %int %x_93 + %224 = OpIAdd %int %223 %int_1 + OpStore %x_93 %224 + %225 = OpLoad %int %x_95 + %226 = OpAccessChain %_ptr_Function_int %x_94 %224 + %227 = OpIAdd %int %225 %int_1 + OpStore %226 %227 + %228 = OpLoad %int %x_93 + %229 = OpIAdd %int %228 %int_1 + OpStore %x_93 %229 + %230 = OpLoad %int %x_92 + %231 = OpAccessChain %_ptr_Function_int %x_94 %229 + OpStore %231 %230 + OpBranch %221 + %221 = OpLabel + OpBranch %182 + %182 = OpLabel + OpBranch %180 + %181 = OpLabel + %232 = OpLoad %v4float %x_GLF_FragCoord + %234 = OpAccessChain %_ptr_Uniform_v2float %x_34 %uint_0 + %235 = OpLoad %v2float %234 + %236 = OpCompositeExtract %float %232 0 + %237 = OpCompositeExtract %float %232 1 + %238 = OpCompositeConstruct %v2float %236 %237 + %239 = OpFDiv %v2float %238 %235 + OpStore %uv %239 + OpStore %color %242 + %243 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %244 = OpLoad %int %243 + %246 = OpAccessChain %_ptr_Function_float %color %uint_0 + %247 = OpLoad %float %246 + %248 = OpAccessChain %_ptr_Function_float %color %uint_0 + %249 = OpConvertSToF %float %244 + %250 = OpFAdd %float %247 %249 + OpStore %248 %250 + %251 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %252 = OpLoad %float %251 + %254 = OpFOrdGreaterThan %bool %252 %float_0_25 + OpSelectionMerge %255 None + OpBranchConditional %254 %256 %255 + %256 = OpLabel + %257 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %258 = OpLoad %int %257 + %259 = OpAccessChain %_ptr_Function_float %color %uint_0 + %260 = OpLoad %float %259 + %261 = OpAccessChain %_ptr_Function_float %color %uint_0 + %262 = OpConvertSToF %float %258 + %263 = OpFAdd %float %260 %262 + OpStore %261 %263 + OpBranch %255 + %255 = OpLabel + %264 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %265 = OpLoad %float %264 + %267 = OpFOrdGreaterThan %bool %265 %float_0_5 + OpSelectionMerge %268 None + OpBranchConditional %267 %269 %268 + %269 = OpLabel + %271 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_2 + %272 = OpLoad %int %271 + %274 = OpAccessChain %_ptr_Function_float %color %uint_1 + %275 = OpLoad %float %274 + %276 = OpAccessChain %_ptr_Function_float %color %uint_1 + %277 = OpConvertSToF %float %272 + %278 = OpFAdd %float %275 %277 + OpStore %276 %278 + OpBranch %268 + %268 = OpLabel + %279 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %280 = OpLoad %float %279 + %282 = OpFOrdGreaterThan %bool %280 %float_0_75 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %283 + %284 = OpLabel + %286 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %287 = OpLoad %int %286 + %289 = OpAccessChain %_ptr_Function_float %color %uint_2 + %290 = OpLoad %float %289 + %291 = OpAccessChain %_ptr_Function_float %color %uint_2 + %292 = OpConvertSToF %float %287 + %293 = OpFAdd %float %290 %292 + OpStore %291 %293 + OpBranch %283 + %283 = OpLabel + %295 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %296 = OpLoad %int %295 + %297 = OpAccessChain %_ptr_Function_float %color %uint_1 + %298 = OpLoad %float %297 + %299 = OpAccessChain %_ptr_Function_float %color %uint_1 + %300 = OpConvertSToF %float %296 + %301 = OpFAdd %float %298 %300 + OpStore %299 %301 + %302 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %303 = OpLoad %float %302 + %304 = OpFOrdGreaterThan %bool %303 %float_0_25 + OpSelectionMerge %305 None + OpBranchConditional %304 %306 %305 + %306 = OpLabel + %308 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %309 = OpLoad %int %308 + %310 = OpAccessChain %_ptr_Function_float %color %uint_0 + %311 = OpLoad %float %310 + %312 = OpAccessChain %_ptr_Function_float %color %uint_0 + %313 = OpConvertSToF %float %309 + %314 = OpFAdd %float %311 %313 + OpStore %312 %314 + OpBranch %305 + %305 = OpLabel + %315 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %316 = OpLoad %float %315 + %317 = OpFOrdGreaterThan %bool %316 %float_0_5 + OpSelectionMerge %318 None + OpBranchConditional %317 %319 %318 + %319 = OpLabel + %321 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %322 = OpLoad %int %321 + %323 = OpAccessChain %_ptr_Function_float %color %uint_1 + %324 = OpLoad %float %323 + %325 = OpAccessChain %_ptr_Function_float %color %uint_1 + %326 = OpConvertSToF %float %322 + %327 = OpFAdd %float %324 %326 + OpStore %325 %327 + OpBranch %318 + %318 = OpLabel + %328 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %329 = OpLoad %float %328 + %330 = OpFOrdGreaterThan %bool %329 %float_0_75 + OpSelectionMerge %331 None + OpBranchConditional %330 %332 %331 + %332 = OpLabel + %334 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %335 = OpLoad %int %334 + %336 = OpAccessChain %_ptr_Function_float %color %uint_2 + %337 = OpLoad %float %336 + %338 = OpAccessChain %_ptr_Function_float %color %uint_2 + %339 = OpConvertSToF %float %335 + %340 = OpFAdd %float %337 %339 + OpStore %338 %340 + OpBranch %331 + %331 = OpLabel + %342 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %343 = OpLoad %int %342 + %344 = OpAccessChain %_ptr_Function_float %color %uint_2 + %345 = OpLoad %float %344 + %346 = OpAccessChain %_ptr_Function_float %color %uint_2 + %347 = OpConvertSToF %float %343 + %348 = OpFAdd %float %345 %347 + OpStore %346 %348 + %349 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %350 = OpLoad %float %349 + %351 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %352 = OpLoad %float %351 + %355 = OpFSub %float %350 %352 + %353 = OpExtInst %float %354 FAbs %355 + %356 = OpFOrdLessThan %bool %353 %float_0_25 + OpSelectionMerge %357 None + OpBranchConditional %356 %358 %357 + %358 = OpLabel + %359 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %360 = OpLoad %int %359 + %361 = OpAccessChain %_ptr_Function_float %color %uint_0 + %362 = OpLoad %float %361 + %363 = OpAccessChain %_ptr_Function_float %color %uint_0 + %364 = OpConvertSToF %float %360 + %365 = OpFAdd %float %362 %364 + OpStore %363 %365 + OpBranch %357 + %357 = OpLabel + %366 = OpLoad %v3float %color + %367 = OpExtInst %v3float %354 Normalize %366 + %368 = OpCompositeExtract %float %367 0 + %369 = OpCompositeExtract %float %367 1 + %370 = OpCompositeExtract %float %367 2 + %371 = OpCompositeConstruct %v4float %368 %369 %370 %float_1 + OpStore %frag_color %371 + %372 = OpLoad %v4float %x_GLF_pos + OpStore %gl_Position %372 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %373 +%tint_symbol_1 = OpFunctionParameter %main_out + %377 = OpLabel + %378 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %378 + %379 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %379 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %116 + %381 = OpLabel + OpStore %tint_pointsize %float_1 + %382 = OpLoad %v4float %tint_symbol + OpStore %x_GLF_pos %382 + %383 = OpFunctionCall %void %main_1 + %385 = OpLoad %v4float %frag_color + %386 = OpLoad %v4float %gl_Position + %387 = OpCompositeConstruct %main_out %385 %386 + %384 = OpFunctionCall %void %tint_symbol_4 %387 + OpReturn + OpFunctionEnd +%swap_i1_i1_ = OpFunction %void None %388 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %392 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %36 + %395 = OpLoad %int %i + %396 = OpAccessChain %_ptr_Private_int %obj %uint_0 %395 + %397 = OpLoad %int %396 + OpStore %temp %397 + %399 = OpLoad %int %i + %401 = OpLoad %int %j + %402 = OpAccessChain %_ptr_Private_int %obj %uint_0 %401 + %403 = OpLoad %int %402 + %404 = OpAccessChain %_ptr_Private_int %obj %uint_0 %399 + OpStore %404 %403 + %406 = OpLoad %int %j + %407 = OpLoad %int %temp + %408 = OpAccessChain %_ptr_Private_int %obj %uint_0 %406 + OpStore %408 %407 + OpReturn + OpFunctionEnd + %quicksort_ = OpFunction %void None %116 + %410 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %36 + %h_1 = OpVariable %_ptr_Function_int Function %36 + %top = OpVariable %_ptr_Function_int Function %36 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %125 + %p = OpVariable %_ptr_Function_int Function %36 + %param_4 = OpVariable %_ptr_Function_int Function %36 + %param_5 = OpVariable %_ptr_Function_int Function %36 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %418 = OpLoad %int %top + %419 = OpIAdd %int %418 %int_1 + OpStore %top %419 + %420 = OpLoad %int %l_1 + %421 = OpAccessChain %_ptr_Function_int %stack %419 + OpStore %421 %420 + %422 = OpLoad %int %top + %423 = OpIAdd %int %422 %int_1 + OpStore %top %423 + %424 = OpLoad %int %h_1 + %425 = OpAccessChain %_ptr_Function_int %stack %423 + OpStore %425 %424 + OpBranch %426 + %426 = OpLabel + OpLoopMerge %427 %428 None + OpBranch %429 + %429 = OpLabel + %430 = OpLoad %int %top + %431 = OpSGreaterThanEqual %bool %430 %int_0 + OpSelectionMerge %432 None + OpBranchConditional %431 %433 %434 + %433 = OpLabel + OpBranch %432 + %434 = OpLabel + OpBranch %427 + %432 = OpLabel + %435 = OpLoad %int %top + %436 = OpISub %int %435 %int_1 + OpStore %top %436 + %437 = OpAccessChain %_ptr_Function_int %stack %435 + %438 = OpLoad %int %437 + OpStore %h_1 %438 + %439 = OpLoad %int %top + %440 = OpISub %int %439 %int_1 + OpStore %top %440 + %441 = OpAccessChain %_ptr_Function_int %stack %439 + %442 = OpLoad %int %441 + OpStore %l_1 %442 + %443 = OpLoad %int %l_1 + OpStore %param_4 %443 + %444 = OpLoad %int %h_1 + OpStore %param_5 %444 + %445 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %445 + %448 = OpLoad %int %p + %449 = OpLoad %int %l_1 + %450 = OpISub %int %448 %int_1 + %451 = OpSGreaterThan %bool %450 %449 + OpSelectionMerge %452 None + OpBranchConditional %451 %453 %452 + %453 = OpLabel + %454 = OpLoad %int %top + %455 = OpIAdd %int %454 %int_1 + OpStore %top %455 + %456 = OpLoad %int %l_1 + %457 = OpAccessChain %_ptr_Function_int %stack %455 + OpStore %457 %456 + %458 = OpLoad %int %top + %459 = OpIAdd %int %458 %int_1 + OpStore %top %459 + %460 = OpLoad %int %p + %461 = OpAccessChain %_ptr_Function_int %stack %459 + %462 = OpISub %int %460 %int_1 + OpStore %461 %462 + OpBranch %452 + %452 = OpLabel + %463 = OpLoad %int %p + %464 = OpLoad %int %h_1 + %465 = OpIAdd %int %463 %int_1 + %466 = OpSLessThan %bool %465 %464 + OpSelectionMerge %467 None + OpBranchConditional %466 %468 %467 + %468 = OpLabel + %469 = OpLoad %int %top + %470 = OpIAdd %int %469 %int_1 + OpStore %top %470 + %471 = OpLoad %int %p + %472 = OpAccessChain %_ptr_Function_int %stack %470 + %473 = OpIAdd %int %471 %int_1 + OpStore %472 %473 + %474 = OpLoad %int %top + %475 = OpIAdd %int %474 %int_1 + OpStore %top %475 + %476 = OpLoad %int %h_1 + %477 = OpAccessChain %_ptr_Function_int %stack %475 + OpStore %477 %476 + OpBranch %467 + %467 = OpLabel + OpBranch %428 + %428 = OpLabel + OpBranch %426 + %427 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.wgsl new file mode 100644 index 0000000000..7c15a5cc22 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.wgsl @@ -0,0 +1,356 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(0)]] var x_34 : buf0; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var x_314 : i32; + var x_315 : i32; + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_316 : i32 = *(h); + let x_318 : i32 = obj.numbers[x_316]; + pivot = x_318; + let x_319 : i32 = *(l); + i_1 = (x_319 - 1); + let x_321 : i32 = *(l); + j_1 = x_321; + loop { + let x_326 : i32 = j_1; + let x_327 : i32 = *(h); + if ((x_326 <= (x_327 - 1))) { + } else { + break; + } + let x_331 : i32 = j_1; + let x_333 : i32 = obj.numbers[x_331]; + let x_334 : i32 = pivot; + if ((x_333 <= x_334)) { + let x_338 : i32 = i_1; + i_1 = (x_338 + 1); + let x_340 : i32 = i_1; + param = x_340; + let x_341 : i32 = j_1; + param_1 = x_341; + let x_342 : i32 = param; + let x_344 : i32 = obj.numbers[x_342]; + x_315 = x_344; + let x_345 : i32 = param; + let x_346 : i32 = param_1; + let x_348 : i32 = obj.numbers[x_346]; + obj.numbers[x_345] = x_348; + let x_350 : i32 = param_1; + let x_351 : i32 = x_315; + obj.numbers[x_350] = x_351; + } + + continuing { + let x_353 : i32 = j_1; + j_1 = (x_353 + 1); + } + } + let x_355 : i32 = i_1; + param_2 = (x_355 + 1); + let x_357 : i32 = *(h); + param_3 = x_357; + let x_358 : i32 = param_2; + let x_360 : i32 = obj.numbers[x_358]; + x_314 = x_360; + let x_361 : i32 = param_2; + let x_362 : i32 = param_3; + let x_364 : i32 = obj.numbers[x_362]; + obj.numbers[x_361] = x_364; + let x_366 : i32 = param_3; + let x_367 : i32 = x_314; + obj.numbers[x_366] = x_367; + if (false) { + } else { + let x_372 : i32 = i_1; + return (x_372 + 1); + } + return 0; +} + +fn main_1() { + var x_91 : i32; + var x_92 : i32; + var x_93 : i32; + var x_94 : array; + var x_95 : i32; + var x_96 : i32; + var x_97 : i32; + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_98 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_98 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_105 : i32 = i_2; + if ((x_105 < 10)) { + } else { + break; + } + let x_108 : i32 = i_2; + let x_109 : i32 = i_2; + obj.numbers[x_108] = (10 - x_109); + let x_112 : i32 = i_2; + let x_113 : i32 = i_2; + let x_115 : i32 = obj.numbers[x_113]; + let x_116 : i32 = i_2; + let x_118 : i32 = obj.numbers[x_116]; + obj.numbers[x_112] = (x_115 * x_118); + + continuing { + let x_121 : i32 = i_2; + i_2 = (x_121 + 1); + } + } + x_91 = 0; + x_92 = 9; + x_93 = -1; + let x_123 : i32 = x_93; + let x_124 : i32 = (x_123 + 1); + x_93 = x_124; + let x_125 : i32 = x_91; + x_94[x_124] = x_125; + let x_127 : i32 = x_93; + let x_128 : i32 = (x_127 + 1); + x_93 = x_128; + let x_129 : i32 = x_92; + x_94[x_128] = x_129; + loop { + let x_135 : i32 = x_93; + if ((x_135 >= 0)) { + } else { + break; + } + let x_138 : i32 = x_93; + x_93 = (x_138 - 1); + let x_141 : i32 = x_94[x_138]; + x_92 = x_141; + let x_142 : i32 = x_93; + x_93 = (x_142 - 1); + let x_145 : i32 = x_94[x_142]; + x_91 = x_145; + let x_146 : i32 = x_91; + x_96 = x_146; + let x_147 : i32 = x_92; + x_97 = x_147; + let x_148 : i32 = performPartition_i1_i1_(&(x_96), &(x_97)); + x_95 = x_148; + let x_149 : i32 = x_95; + let x_151 : i32 = x_91; + if (((x_149 - 1) > x_151)) { + let x_155 : i32 = x_93; + let x_156 : i32 = (x_155 + 1); + x_93 = x_156; + let x_157 : i32 = x_91; + x_94[x_156] = x_157; + let x_159 : i32 = x_93; + let x_160 : i32 = (x_159 + 1); + x_93 = x_160; + let x_161 : i32 = x_95; + x_94[x_160] = (x_161 - 1); + } + let x_164 : i32 = x_95; + let x_166 : i32 = x_92; + if (((x_164 + 1) < x_166)) { + let x_170 : i32 = x_93; + let x_171 : i32 = (x_170 + 1); + x_93 = x_171; + let x_172 : i32 = x_95; + x_94[x_171] = (x_172 + 1); + let x_175 : i32 = x_93; + let x_176 : i32 = (x_175 + 1); + x_93 = x_176; + let x_177 : i32 = x_92; + x_94[x_176] = x_177; + } + } + let x_179 : vec4 = x_GLF_FragCoord; + let x_182 : vec2 = x_34.resolution; + uv = (vec2(x_179.x, x_179.y) / x_182); + color = vec3(1.0, 2.0, 3.0); + let x_185 : i32 = obj.numbers[0]; + let x_188 : f32 = color.x; + color.x = (x_188 + f32(x_185)); + let x_192 : f32 = uv.x; + if ((x_192 > 0.25)) { + let x_197 : i32 = obj.numbers[1]; + let x_200 : f32 = color.x; + color.x = (x_200 + f32(x_197)); + } + let x_204 : f32 = uv.x; + if ((x_204 > 0.5)) { + let x_209 : i32 = obj.numbers[2]; + let x_212 : f32 = color.y; + color.y = (x_212 + f32(x_209)); + } + let x_216 : f32 = uv.x; + if ((x_216 > 0.75)) { + let x_221 : i32 = obj.numbers[3]; + let x_224 : f32 = color.z; + color.z = (x_224 + f32(x_221)); + } + let x_228 : i32 = obj.numbers[4]; + let x_231 : f32 = color.y; + color.y = (x_231 + f32(x_228)); + let x_235 : f32 = uv.y; + if ((x_235 > 0.25)) { + let x_240 : i32 = obj.numbers[5]; + let x_243 : f32 = color.x; + color.x = (x_243 + f32(x_240)); + } + let x_247 : f32 = uv.y; + if ((x_247 > 0.5)) { + let x_252 : i32 = obj.numbers[6]; + let x_255 : f32 = color.y; + color.y = (x_255 + f32(x_252)); + } + let x_259 : f32 = uv.y; + if ((x_259 > 0.75)) { + let x_264 : i32 = obj.numbers[7]; + let x_267 : f32 = color.z; + color.z = (x_267 + f32(x_264)); + } + let x_271 : i32 = obj.numbers[8]; + let x_274 : f32 = color.z; + color.z = (x_274 + f32(x_271)); + let x_278 : f32 = uv.x; + let x_280 : f32 = uv.y; + if ((abs((x_278 - x_280)) < 0.25)) { + let x_287 : i32 = obj.numbers[9]; + let x_290 : f32 = color.x; + color.x = (x_290 + f32(x_287)); + } + let x_293 : vec3 = color; + let x_294 : vec3 = normalize(x_293); + frag_color = vec4(x_294.x, x_294.y, x_294.z, 1.0); + let x_299 : vec4 = x_GLF_pos; + gl_Position = x_299; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_302 : i32 = *(i); + let x_304 : i32 = obj.numbers[x_302]; + temp = x_304; + let x_305 : i32 = *(i); + let x_306 : i32 = *(j); + let x_308 : i32 = obj.numbers[x_306]; + obj.numbers[x_305] = x_308; + let x_310 : i32 = *(j); + let x_311 : i32 = temp; + obj.numbers[x_310] = x_311; + return; +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_376 : i32 = top; + let x_377 : i32 = (x_376 + 1); + top = x_377; + let x_378 : i32 = l_1; + stack[x_377] = x_378; + let x_380 : i32 = top; + let x_381 : i32 = (x_380 + 1); + top = x_381; + let x_382 : i32 = h_1; + stack[x_381] = x_382; + loop { + let x_388 : i32 = top; + if ((x_388 >= 0)) { + } else { + break; + } + let x_391 : i32 = top; + top = (x_391 - 1); + let x_394 : i32 = stack[x_391]; + h_1 = x_394; + let x_395 : i32 = top; + top = (x_395 - 1); + let x_398 : i32 = stack[x_395]; + l_1 = x_398; + let x_399 : i32 = l_1; + param_4 = x_399; + let x_400 : i32 = h_1; + param_5 = x_400; + let x_401 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_401; + let x_402 : i32 = p; + let x_404 : i32 = l_1; + if (((x_402 - 1) > x_404)) { + let x_408 : i32 = top; + let x_409 : i32 = (x_408 + 1); + top = x_409; + let x_410 : i32 = l_1; + stack[x_409] = x_410; + let x_412 : i32 = top; + let x_413 : i32 = (x_412 + 1); + top = x_413; + let x_414 : i32 = p; + stack[x_413] = (x_414 - 1); + } + let x_417 : i32 = p; + let x_419 : i32 = h_1; + if (((x_417 + 1) < x_419)) { + let x_423 : i32 = top; + let x_424 : i32 = (x_423 + 1); + top = x_424; + let x_425 : i32 = p; + stack[x_424] = (x_425 + 1); + let x_428 : i32 = top; + let x_429 : i32 = (x_428 + 1); + top = x_429; + let x_430 : i32 = h_1; + stack[x_429] = x_430; + } + } + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm new file mode 100644 index 0000000000..2426da3e0f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm @@ -0,0 +1,528 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_GLF_pos %frag_color %__1 + OpSource ESSL 310 + OpName %main "main" + OpName %swap_i1_i1_ "swap(i1;i1;" + OpName %i "i" + OpName %j "j" + OpName %performPartition_i1_i1_ "performPartition(i1;i1;" + OpName %l "l" + OpName %h "h" + OpName %quicksort_ "quicksort(" + OpName %temp "temp" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %pivot "pivot" + OpName %i_0 "i" + OpName %j_0 "j" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %l_0 "l" + OpName %h_0 "h" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %_GLF_FragCoord "_GLF_FragCoord" + OpName %_GLF_pos "_GLF_pos" + OpName %i_1 "i" + OpName %uv "uv" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %_ "" + OpName %color "color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %__0 "" + OpName %frag_color "frag_color" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpName %__1 "" + OpDecorate %_GLF_pos Location 0 + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %frag_color Location 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %40 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %43 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %44 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private + %int_0 = OpConstant %int 0 +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float +%_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private +%_ptr_Input_v4float = OpTypePointer Input %v4float + %_GLF_pos = OpVariable %_ptr_Input_v4float Input + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %62 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %64 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_10 = OpConstant %int 10 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %74 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %int_2 = OpConstant %int 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %frag_color = OpVariable %_ptr_Output_v4float Output +%gl_PerVertex = OpTypeStruct %v4float %float +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__1 = OpVariable %_ptr_Output_gl_PerVertex Output + %main = OpFunction %void None %40 + %93 = OpLabel + %i_1 = OpVariable %_ptr_Function_int Function + %uv = OpVariable %_ptr_Function_v2float Function + %color = OpVariable %_ptr_Function_v3float Function + %94 = OpLoad %v4float %_GLF_pos + %95 = OpFAdd %v4float %94 %62 + %96 = OpFMul %v4float %95 %64 + OpStore %_GLF_FragCoord %96 + OpStore %i_1 %int_0 + OpBranch %97 + %97 = OpLabel + OpLoopMerge %98 %99 None + OpBranch %100 + %100 = OpLabel + %101 = OpLoad %int %i_1 + %102 = OpSLessThan %bool %101 %int_10 + OpBranchConditional %102 %103 %98 + %103 = OpLabel + %104 = OpLoad %int %i_1 + %105 = OpLoad %int %i_1 + %106 = OpISub %int %int_10 %105 + %107 = OpAccessChain %_ptr_Private_int %obj %int_0 %104 + OpStore %107 %106 + %108 = OpLoad %int %i_1 + %109 = OpLoad %int %i_1 + %110 = OpAccessChain %_ptr_Private_int %obj %int_0 %109 + %111 = OpLoad %int %110 + %112 = OpLoad %int %i_1 + %113 = OpAccessChain %_ptr_Private_int %obj %int_0 %112 + %114 = OpLoad %int %113 + %115 = OpIMul %int %111 %114 + %116 = OpAccessChain %_ptr_Private_int %obj %int_0 %108 + OpStore %116 %115 + OpBranch %99 + %99 = OpLabel + %117 = OpLoad %int %i_1 + %118 = OpIAdd %int %117 %int_1 + OpStore %i_1 %118 + OpBranch %97 + %98 = OpLabel + %119 = OpFunctionCall %void %quicksort_ + %120 = OpLoad %v4float %_GLF_FragCoord + %121 = OpVectorShuffle %v2float %120 %120 0 1 + %122 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %123 = OpLoad %v2float %122 + %124 = OpFDiv %v2float %121 %123 + OpStore %uv %124 + OpStore %color %74 + %125 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_0 + %126 = OpLoad %int %125 + %127 = OpConvertSToF %float %126 + %128 = OpAccessChain %_ptr_Function_float %color %uint_0 + %129 = OpLoad %float %128 + %130 = OpFAdd %float %129 %127 + %131 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %131 %130 + %132 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %133 = OpLoad %float %132 + %134 = OpFOrdGreaterThan %bool %133 %float_0_25 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %135 + %136 = OpLabel + %137 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_1 + %138 = OpLoad %int %137 + %139 = OpConvertSToF %float %138 + %140 = OpAccessChain %_ptr_Function_float %color %uint_0 + %141 = OpLoad %float %140 + %142 = OpFAdd %float %141 %139 + %143 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %143 %142 + OpBranch %135 + %135 = OpLabel + %144 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %145 = OpLoad %float %144 + %146 = OpFOrdGreaterThan %bool %145 %float_0_5 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %147 + %148 = OpLabel + %149 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %150 = OpLoad %float %149 + %151 = OpConvertFToS %int %150 + %152 = OpIMul %int %int_2 %151 + %153 = OpExtInst %int %1 SMax %152 %int_2 + %154 = OpAccessChain %_ptr_Private_int %obj %int_0 %153 + %155 = OpLoad %int %154 + %156 = OpConvertSToF %float %155 + %157 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %158 = OpLoad %float %157 + %159 = OpConvertFToS %int %158 + %160 = OpIMul %int %int_2 %159 + %161 = OpExtInst %int %1 SMax %160 %int_2 + %162 = OpAccessChain %_ptr_Private_int %obj %int_0 %161 + %163 = OpLoad %int %162 + %164 = OpConvertSToF %float %163 + %165 = OpExtInst %float %1 FMax %156 %164 + %166 = OpAccessChain %_ptr_Function_float %color %uint_1 + %167 = OpLoad %float %166 + %168 = OpFAdd %float %167 %165 + %169 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %169 %168 + OpBranch %147 + %147 = OpLabel + %170 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %171 = OpLoad %float %170 + %172 = OpFOrdGreaterThan %bool %171 %float_0_75 + OpSelectionMerge %173 None + OpBranchConditional %172 %174 %173 + %174 = OpLabel + %175 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_3 + %176 = OpLoad %int %175 + %177 = OpConvertSToF %float %176 + %178 = OpAccessChain %_ptr_Function_float %color %uint_2 + %179 = OpLoad %float %178 + %180 = OpFAdd %float %179 %177 + %181 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %181 %180 + OpBranch %173 + %173 = OpLabel + %182 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_4 + %183 = OpLoad %int %182 + %184 = OpConvertSToF %float %183 + %185 = OpAccessChain %_ptr_Function_float %color %uint_1 + %186 = OpLoad %float %185 + %187 = OpFAdd %float %186 %184 + %188 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %188 %187 + %189 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %190 = OpLoad %float %189 + %191 = OpFOrdGreaterThan %bool %190 %float_0_25 + OpSelectionMerge %192 None + OpBranchConditional %191 %193 %192 + %193 = OpLabel + %194 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_5 + %195 = OpLoad %int %194 + %196 = OpConvertSToF %float %195 + %197 = OpAccessChain %_ptr_Function_float %color %uint_0 + %198 = OpLoad %float %197 + %199 = OpFAdd %float %198 %196 + %200 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %200 %199 + OpBranch %192 + %192 = OpLabel + %201 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %202 = OpLoad %float %201 + %203 = OpFOrdGreaterThan %bool %202 %float_0_5 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %204 + %205 = OpLabel + %206 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_6 + %207 = OpLoad %int %206 + %208 = OpConvertSToF %float %207 + %209 = OpAccessChain %_ptr_Function_float %color %uint_1 + %210 = OpLoad %float %209 + %211 = OpFAdd %float %210 %208 + %212 = OpAccessChain %_ptr_Function_float %color %uint_1 + OpStore %212 %211 + OpBranch %204 + %204 = OpLabel + %213 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %214 = OpLoad %float %213 + %215 = OpFOrdGreaterThan %bool %214 %float_0_75 + OpSelectionMerge %216 None + OpBranchConditional %215 %217 %216 + %217 = OpLabel + %218 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_7 + %219 = OpLoad %int %218 + %220 = OpConvertSToF %float %219 + %221 = OpAccessChain %_ptr_Function_float %color %uint_2 + %222 = OpLoad %float %221 + %223 = OpFAdd %float %222 %220 + %224 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %224 %223 + OpBranch %216 + %216 = OpLabel + %225 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_8 + %226 = OpLoad %int %225 + %227 = OpConvertSToF %float %226 + %228 = OpAccessChain %_ptr_Function_float %color %uint_2 + %229 = OpLoad %float %228 + %230 = OpFAdd %float %229 %227 + %231 = OpAccessChain %_ptr_Function_float %color %uint_2 + OpStore %231 %230 + %232 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %233 = OpLoad %float %232 + %234 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %235 = OpLoad %float %234 + %236 = OpFSub %float %233 %235 + %237 = OpExtInst %float %1 FAbs %236 + %238 = OpFOrdLessThan %bool %237 %float_0_25 + OpSelectionMerge %239 None + OpBranchConditional %238 %240 %239 + %240 = OpLabel + %241 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_9 + %242 = OpLoad %int %241 + %243 = OpConvertSToF %float %242 + %244 = OpAccessChain %_ptr_Function_float %color %uint_0 + %245 = OpLoad %float %244 + %246 = OpFAdd %float %245 %243 + %247 = OpAccessChain %_ptr_Function_float %color %uint_0 + OpStore %247 %246 + OpBranch %239 + %239 = OpLabel + %248 = OpLoad %v3float %color + %249 = OpExtInst %v3float %1 Normalize %248 + %250 = OpCompositeExtract %float %249 0 + %251 = OpCompositeExtract %float %249 1 + %252 = OpCompositeExtract %float %249 2 + %253 = OpCompositeConstruct %v4float %250 %251 %252 %float_1 + OpStore %frag_color %253 + %254 = OpLoad %v4float %_GLF_pos + %255 = OpAccessChain %_ptr_Output_v4float %__1 %int_0 + OpStore %255 %254 + OpReturn + OpFunctionEnd +%swap_i1_i1_ = OpFunction %void None %43 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %256 = OpLabel + %temp = OpVariable %_ptr_Function_int Function + %257 = OpLoad %int %i + %258 = OpAccessChain %_ptr_Private_int %obj %int_0 %257 + %259 = OpLoad %int %258 + OpStore %temp %259 + %260 = OpLoad %int %i + %261 = OpLoad %int %j + %262 = OpAccessChain %_ptr_Private_int %obj %int_0 %261 + %263 = OpLoad %int %262 + %264 = OpAccessChain %_ptr_Private_int %obj %int_0 %260 + OpStore %264 %263 + %265 = OpLoad %int %j + %266 = OpLoad %int %temp + %267 = OpAccessChain %_ptr_Private_int %obj %int_0 %265 + OpStore %267 %266 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %44 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %268 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %j_0 = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_int Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_int Function + %269 = OpLoad %int %h + %270 = OpAccessChain %_ptr_Private_int %obj %int_0 %269 + %271 = OpLoad %int %270 + OpStore %pivot %271 + %272 = OpLoad %int %l + %273 = OpISub %int %272 %int_1 + OpStore %i_0 %273 + %274 = OpLoad %int %l + OpStore %j_0 %274 + OpBranch %275 + %275 = OpLabel + OpLoopMerge %276 %277 None + OpBranch %278 + %278 = OpLabel + %279 = OpLoad %int %j_0 + %280 = OpLoad %int %h + %281 = OpISub %int %280 %int_1 + %282 = OpSLessThanEqual %bool %279 %281 + OpBranchConditional %282 %283 %276 + %283 = OpLabel + %284 = OpLoad %int %j_0 + %285 = OpAccessChain %_ptr_Private_int %obj %int_0 %284 + %286 = OpLoad %int %285 + %287 = OpLoad %int %pivot + %288 = OpSLessThanEqual %bool %286 %287 + OpSelectionMerge %289 None + OpBranchConditional %288 %290 %289 + %290 = OpLabel + %291 = OpLoad %int %i_0 + %292 = OpIAdd %int %291 %int_1 + OpStore %i_0 %292 + %293 = OpLoad %int %i_0 + OpStore %param %293 + %294 = OpLoad %int %j_0 + OpStore %param_0 %294 + %295 = OpFunctionCall %void %swap_i1_i1_ %param %param_0 + OpBranch %289 + %289 = OpLabel + OpBranch %277 + %277 = OpLabel + %296 = OpLoad %int %j_0 + %297 = OpIAdd %int %296 %int_1 + OpStore %j_0 %297 + OpBranch %275 + %276 = OpLabel + %298 = OpLoad %int %i_0 + %299 = OpIAdd %int %298 %int_1 + OpStore %param_1 %299 + %300 = OpLoad %int %h + OpStore %param_2 %300 + %301 = OpFunctionCall %void %swap_i1_i1_ %param_1 %param_2 + %302 = OpLoad %int %i_0 + %303 = OpIAdd %int %302 %int_1 + OpReturnValue %303 + OpFunctionEnd + %quicksort_ = OpFunction %void None %40 + %304 = OpLabel + %l_0 = OpVariable %_ptr_Function_int Function + %h_0 = OpVariable %_ptr_Function_int Function + %top = OpVariable %_ptr_Function_int Function + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function + %p = OpVariable %_ptr_Function_int Function + %param_3 = OpVariable %_ptr_Function_int Function + %param_4 = OpVariable %_ptr_Function_int Function + OpStore %l_0 %int_0 + OpStore %h_0 %int_9 + OpStore %top %int_n1 + %305 = OpLoad %int %top + %306 = OpIAdd %int %305 %int_1 + OpStore %top %306 + %307 = OpLoad %int %l_0 + %308 = OpAccessChain %_ptr_Function_int %stack %306 + OpStore %308 %307 + %309 = OpLoad %int %top + %310 = OpIAdd %int %309 %int_1 + OpStore %top %310 + %311 = OpLoad %int %h_0 + %312 = OpAccessChain %_ptr_Function_int %stack %310 + OpStore %312 %311 + OpBranch %313 + %313 = OpLabel + OpLoopMerge %314 %315 None + OpBranch %316 + %316 = OpLabel + %317 = OpLoad %int %top + %318 = OpSGreaterThanEqual %bool %317 %int_0 + OpBranchConditional %318 %319 %314 + %319 = OpLabel + %320 = OpLoad %int %top + %321 = OpISub %int %320 %int_1 + OpStore %top %321 + %322 = OpAccessChain %_ptr_Function_int %stack %320 + %323 = OpLoad %int %322 + OpStore %h_0 %323 + %324 = OpLoad %int %top + %325 = OpISub %int %324 %int_1 + OpStore %top %325 + %326 = OpAccessChain %_ptr_Function_int %stack %324 + %327 = OpLoad %int %326 + OpStore %l_0 %327 + %328 = OpLoad %int %l_0 + OpStore %param_3 %328 + %329 = OpLoad %int %h_0 + OpStore %param_4 %329 + %330 = OpFunctionCall %int %performPartition_i1_i1_ %param_3 %param_4 + OpStore %p %330 + %331 = OpLoad %int %p + %332 = OpISub %int %331 %int_1 + %333 = OpLoad %int %l_0 + %334 = OpSGreaterThan %bool %332 %333 + OpSelectionMerge %335 None + OpBranchConditional %334 %336 %335 + %336 = OpLabel + %337 = OpLoad %int %top + %338 = OpIAdd %int %337 %int_1 + OpStore %top %338 + %339 = OpLoad %int %l_0 + %340 = OpAccessChain %_ptr_Function_int %stack %338 + OpStore %340 %339 + %341 = OpLoad %int %top + %342 = OpIAdd %int %341 %int_1 + OpStore %top %342 + %343 = OpLoad %int %p + %344 = OpISub %int %343 %int_1 + %345 = OpAccessChain %_ptr_Function_int %stack %342 + OpStore %345 %344 + OpBranch %335 + %335 = OpLabel + %346 = OpLoad %int %p + %347 = OpIAdd %int %346 %int_1 + %348 = OpLoad %int %h_0 + %349 = OpSLessThan %bool %347 %348 + OpSelectionMerge %350 None + OpBranchConditional %349 %351 %350 + %351 = OpLabel + %352 = OpLoad %int %top + %353 = OpIAdd %int %352 %int_1 + OpStore %top %353 + %354 = OpLoad %int %p + %355 = OpIAdd %int %354 %int_1 + %356 = OpAccessChain %_ptr_Function_int %stack %353 + OpStore %356 %355 + %357 = OpLoad %int %top + %358 = OpIAdd %int %357 %int_1 + OpStore %top %358 + %359 = OpLoad %int %h_0 + %360 = OpAccessChain %_ptr_Function_int %stack %358 + OpStore %360 %359 + OpBranch %350 + %350 = OpLabel + OpBranch %315 + %315 = OpLabel + OpBranch %313 + %314 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..231fdaf925 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.hlsl @@ -0,0 +1,225 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_34 : register(b1, space0) { + uint4 x_34[1]; +}; +cbuffer cbuffer_x_37 : register(b0, space0) { + uint4 x_37[1]; +}; +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_257 = i; + const int x_259 = obj.numbers[x_257]; + temp = x_259; + const int x_260 = i; + const int x_261 = j; + const int x_263 = obj.numbers[x_261]; + obj.numbers[x_260] = x_263; + const int x_265 = j; + obj.numbers[x_265] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_269 = h; + const int x_271 = obj.numbers[x_269]; + pivot = x_271; + const int x_272 = l; + i_1 = (x_272 - 1); + const int x_274 = l; + j_1 = x_274; + while (true) { + const int x_279 = j_1; + const int x_280 = h; + if ((x_279 <= (x_280 - 1))) { + } else { + break; + } + const int x_286 = obj.numbers[j_1]; + if ((x_286 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + param_2 = (i_1 + 1); + const int x_300 = h; + param_3 = x_300; + swap_i1_i1_(param_2, param_3); + return (i_1 + 1); +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_306 = (top + 1); + top = x_306; + stack[x_306] = l_1; + const int x_310 = (top + 1); + top = x_310; + stack[x_310] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_320 = top; + top = (x_320 - 1); + const int x_323 = stack[x_320]; + h_1 = x_323; + const int x_324 = top; + top = (x_324 - 1); + const int x_327 = stack[x_324]; + l_1 = x_327; + param_4 = l_1; + param_5 = h_1; + const int x_330 = performPartition_i1_i1_(param_4, param_5); + p = x_330; + if (((p - 1) > l_1)) { + const int x_338 = (top + 1); + top = x_338; + stack[x_338] = l_1; + const int x_342 = (top + 1); + top = x_342; + stack[x_342] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_353 = (top + 1); + top = x_353; + stack[x_353] = (p + 1); + const int x_358 = (top + 1); + top = x_358; + stack[x_358] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_108 = i_2; + const int x_111 = obj.numbers[i_2]; + const int x_114 = obj.numbers[i_2]; + obj.numbers[x_108] = (x_111 * x_114); + } + } + quicksort_(); + const float4 x_120 = x_GLF_FragCoord; + const float2 x_123 = asfloat(x_34[0].xy); + uv = (float2(x_120.x, x_120.y) / x_123); + color = float3(1.0f, 2.0f, 3.0f); + const int x_126 = obj.numbers[0]; + const float x_129 = color.x; + color.x = (x_129 + float(x_126)); + const float x_133 = uv.x; + if ((x_133 > 0.25f)) { + const int x_138 = obj.numbers[1]; + const float x_141 = color.x; + color.x = (x_141 + float(x_138)); + } + const float x_145 = uv.x; + if ((x_145 > 0.5f)) { + const float x_150 = asfloat(x_37[0].y); + const int x_155 = obj.numbers[max((2 * int(x_150)), 2)]; + const float x_158 = asfloat(x_37[0].y); + const int x_163 = obj.numbers[max((2 * int(x_158)), 2)]; + const float x_167 = color.y; + color.y = (x_167 + max(float(x_155), float(x_163))); + } + const float x_171 = uv.x; + if ((x_171 > 0.75f)) { + const int x_176 = obj.numbers[3]; + const float x_179 = color.z; + color.z = (x_179 + float(x_176)); + } + const int x_183 = obj.numbers[4]; + const float x_186 = color.y; + color.y = (x_186 + float(x_183)); + const float x_190 = uv.y; + if ((x_190 > 0.25f)) { + const int x_195 = obj.numbers[5]; + const float x_198 = color.x; + color.x = (x_198 + float(x_195)); + } + const float x_202 = uv.y; + if ((x_202 > 0.5f)) { + const int x_207 = obj.numbers[6]; + const float x_210 = color.y; + color.y = (x_210 + float(x_207)); + } + const float x_214 = uv.y; + if ((x_214 > 0.75f)) { + const int x_219 = obj.numbers[7]; + const float x_222 = color.z; + color.z = (x_222 + float(x_219)); + } + const int x_226 = obj.numbers[8]; + const float x_229 = color.z; + color.z = (x_229 + float(x_226)); + const float x_233 = uv.x; + const float x_235 = uv.y; + if ((abs((x_233 - x_235)) < 0.25f)) { + const int x_242 = obj.numbers[9]; + const float x_245 = color.x; + color.x = (x_245 + float(x_242)); + } + const float3 x_249 = normalize(color); + frag_color = float4(x_249.x, x_249.y, x_249.z, 1.0f); + gl_Position = x_GLF_pos; + return; +} + +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 x_GLF_pos_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_GLF_pos_param = tint_symbol.x_GLF_pos_param; + x_GLF_pos = x_GLF_pos_param; + main_1(); + const main_out tint_symbol_3 = {frag_color, gl_Position}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.msl new file mode 100644 index 0000000000..99d503991c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.msl @@ -0,0 +1,272 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_pos_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_6) { + int temp = 0; + int const x_257 = *(i); + int const x_259 = (*(tint_symbol_6)).numbers.arr[x_257]; + temp = x_259; + int const x_260 = *(i); + int const x_261 = *(j); + int const x_263 = (*(tint_symbol_6)).numbers.arr[x_261]; + (*(tint_symbol_6)).numbers.arr[x_260] = x_263; + int const x_265 = *(j); + int const x_266 = temp; + (*(tint_symbol_6)).numbers.arr[x_265] = x_266; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_7) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_269 = *(h); + int const x_271 = (*(tint_symbol_7)).numbers.arr[x_269]; + pivot = x_271; + int const x_272 = *(l); + i_1 = (x_272 - 1); + int const x_274 = *(l); + j_1 = x_274; + while (true) { + int const x_279 = j_1; + int const x_280 = *(h); + if ((x_279 <= (x_280 - 1))) { + } else { + break; + } + int const x_284 = j_1; + int const x_286 = (*(tint_symbol_7)).numbers.arr[x_284]; + int const x_287 = pivot; + if ((x_286 <= x_287)) { + int const x_291 = i_1; + i_1 = (x_291 + 1); + int const x_293 = i_1; + param = x_293; + int const x_294 = j_1; + param_1 = x_294; + swap_i1_i1_(&(param), &(param_1), tint_symbol_7); + } + { + int const x_296 = j_1; + j_1 = (x_296 + 1); + } + } + int const x_298 = i_1; + param_2 = (x_298 + 1); + int const x_300 = *(h); + param_3 = x_300; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_7); + int const x_302 = i_1; + return (x_302 + 1); +} + +void quicksort_(thread QuicksortObject* const tint_symbol_8) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_305 = top; + int const x_306 = (x_305 + 1); + top = x_306; + int const x_307 = l_1; + stack.arr[x_306] = x_307; + int const x_309 = top; + int const x_310 = (x_309 + 1); + top = x_310; + int const x_311 = h_1; + stack.arr[x_310] = x_311; + while (true) { + int const x_317 = top; + if ((x_317 >= 0)) { + } else { + break; + } + int const x_320 = top; + top = (x_320 - 1); + int const x_323 = stack.arr[x_320]; + h_1 = x_323; + int const x_324 = top; + top = (x_324 - 1); + int const x_327 = stack.arr[x_324]; + l_1 = x_327; + int const x_328 = l_1; + param_4 = x_328; + int const x_329 = h_1; + param_5 = x_329; + int const x_330 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_8); + p = x_330; + int const x_331 = p; + int const x_333 = l_1; + if (((x_331 - 1) > x_333)) { + int const x_337 = top; + int const x_338 = (x_337 + 1); + top = x_338; + int const x_339 = l_1; + stack.arr[x_338] = x_339; + int const x_341 = top; + int const x_342 = (x_341 + 1); + top = x_342; + int const x_343 = p; + stack.arr[x_342] = (x_343 - 1); + } + int const x_346 = p; + int const x_348 = h_1; + if (((x_346 + 1) < x_348)) { + int const x_352 = top; + int const x_353 = (x_352 + 1); + top = x_353; + int const x_354 = p; + stack.arr[x_353] = (x_354 + 1); + int const x_357 = top; + int const x_358 = (x_357 + 1); + top = x_358; + int const x_359 = h_1; + stack.arr[x_358] = x_359; + } + } + return; +} + +void main_1(constant buf1& x_34, constant buf0& x_37, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10, thread QuicksortObject* const tint_symbol_11, thread float4* const tint_symbol_12, thread float4* const tint_symbol_13) { + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + float4 const x_94 = *(tint_symbol_9); + *(tint_symbol_10) = ((x_94 + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + while (true) { + int const x_101 = i_2; + if ((x_101 < 10)) { + } else { + break; + } + int const x_104 = i_2; + int const x_105 = i_2; + (*(tint_symbol_11)).numbers.arr[x_104] = (10 - x_105); + int const x_108 = i_2; + int const x_109 = i_2; + int const x_111 = (*(tint_symbol_11)).numbers.arr[x_109]; + int const x_112 = i_2; + int const x_114 = (*(tint_symbol_11)).numbers.arr[x_112]; + (*(tint_symbol_11)).numbers.arr[x_108] = (x_111 * x_114); + { + int const x_117 = i_2; + i_2 = (x_117 + 1); + } + } + quicksort_(tint_symbol_11); + float4 const x_120 = *(tint_symbol_10); + float2 const x_123 = x_34.resolution; + uv = (float2(x_120.x, x_120.y) / x_123); + color = float3(1.0f, 2.0f, 3.0f); + int const x_126 = (*(tint_symbol_11)).numbers.arr[0]; + float const x_129 = color.x; + color.x = (x_129 + float(x_126)); + float const x_133 = uv.x; + if ((x_133 > 0.25f)) { + int const x_138 = (*(tint_symbol_11)).numbers.arr[1]; + float const x_141 = color.x; + color.x = (x_141 + float(x_138)); + } + float const x_145 = uv.x; + if ((x_145 > 0.5f)) { + float const x_150 = x_37.injectionSwitch.y; + int const x_155 = (*(tint_symbol_11)).numbers.arr[max((2 * int(x_150)), 2)]; + float const x_158 = x_37.injectionSwitch.y; + int const x_163 = (*(tint_symbol_11)).numbers.arr[max((2 * int(x_158)), 2)]; + float const x_167 = color.y; + color.y = (x_167 + fmax(float(x_155), float(x_163))); + } + float const x_171 = uv.x; + if ((x_171 > 0.75f)) { + int const x_176 = (*(tint_symbol_11)).numbers.arr[3]; + float const x_179 = color.z; + color.z = (x_179 + float(x_176)); + } + int const x_183 = (*(tint_symbol_11)).numbers.arr[4]; + float const x_186 = color.y; + color.y = (x_186 + float(x_183)); + float const x_190 = uv.y; + if ((x_190 > 0.25f)) { + int const x_195 = (*(tint_symbol_11)).numbers.arr[5]; + float const x_198 = color.x; + color.x = (x_198 + float(x_195)); + } + float const x_202 = uv.y; + if ((x_202 > 0.5f)) { + int const x_207 = (*(tint_symbol_11)).numbers.arr[6]; + float const x_210 = color.y; + color.y = (x_210 + float(x_207)); + } + float const x_214 = uv.y; + if ((x_214 > 0.75f)) { + int const x_219 = (*(tint_symbol_11)).numbers.arr[7]; + float const x_222 = color.z; + color.z = (x_222 + float(x_219)); + } + int const x_226 = (*(tint_symbol_11)).numbers.arr[8]; + float const x_229 = color.z; + color.z = (x_229 + float(x_226)); + float const x_233 = uv.x; + float const x_235 = uv.y; + if ((fabs((x_233 - x_235)) < 0.25f)) { + int const x_242 = (*(tint_symbol_11)).numbers.arr[9]; + float const x_245 = color.x; + color.x = (x_245 + float(x_242)); + } + float3 const x_248 = color; + float3 const x_249 = normalize(x_248); + *(tint_symbol_12) = float4(x_249.x, x_249.y, x_249.z, 1.0f); + float4 const x_254 = *(tint_symbol_9); + *(tint_symbol_13) = x_254; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant buf1& x_34 [[buffer(1)]], constant buf0& x_37 [[buffer(0)]]) { + thread float4 tint_symbol_14 = 0.0f; + thread float4 tint_symbol_15 = 0.0f; + thread QuicksortObject tint_symbol_16 = {}; + thread float4 tint_symbol_17 = 0.0f; + thread float4 tint_symbol_18 = 0.0f; + float4 const x_GLF_pos_param = tint_symbol_1.x_GLF_pos_param; + tint_symbol_14 = x_GLF_pos_param; + main_1(x_34, x_37, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_16), &(tint_symbol_17), &(tint_symbol_18)); + main_out const tint_symbol_4 = {.frag_color_1=tint_symbol_17, .gl_Position=tint_symbol_18}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..f53a11bbc1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.spvasm @@ -0,0 +1,593 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 408 +; Schema: 0 + OpCapability Shader + %280 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %x_GLF_FragCoord "x_GLF_FragCoord" + OpName %x_GLF_pos "x_GLF_pos" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_34 "x_34" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_37 "x_37" + OpName %frag_color "frag_color" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "frag_color_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_34 NonWritable + OpDecorate %x_34 DescriptorSet 0 + OpDecorate %x_34 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_37 NonWritable + OpDecorate %x_37 DescriptorSet 0 + OpDecorate %x_37 Binding 0 + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_3 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %12 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private %16 + %x_GLF_pos = OpVariable %_ptr_Private_v4float Private %16 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_34 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_37 = OpVariable %_ptr_Uniform_buf0 Uniform + %frag_color = OpVariable %_ptr_Private_v4float Private %16 +%gl_Position = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %16 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %32 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %40 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %58 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %118 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %126 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %198 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %202 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %206 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %209 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_10 = OpConstant %int 10 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %247 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float %v4float + %393 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %32 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %38 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %40 + %42 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + %46 = OpLoad %int %45 + OpStore %temp %46 + %48 = OpLoad %int %i + %50 = OpLoad %int %j + %51 = OpAccessChain %_ptr_Private_int %obj %uint_0 %50 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 + OpStore %53 %52 + %55 = OpLoad %int %j + %56 = OpLoad %int %temp + %57 = OpAccessChain %_ptr_Private_int %obj %uint_0 %55 + OpStore %57 %56 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %58 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %62 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %40 + %i_1 = OpVariable %_ptr_Function_int Function %40 + %j_1 = OpVariable %_ptr_Function_int Function %40 + %param = OpVariable %_ptr_Function_int Function %40 + %param_1 = OpVariable %_ptr_Function_int Function %40 + %param_2 = OpVariable %_ptr_Function_int Function %40 + %param_3 = OpVariable %_ptr_Function_int Function %40 + %71 = OpLoad %int %h + %72 = OpAccessChain %_ptr_Private_int %obj %uint_0 %71 + %73 = OpLoad %int %72 + OpStore %pivot %73 + %75 = OpLoad %int %l + %77 = OpISub %int %75 %int_1 + OpStore %i_1 %77 + %79 = OpLoad %int %l + OpStore %j_1 %79 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %int %j_1 + %86 = OpLoad %int %h + %87 = OpISub %int %86 %int_1 + %88 = OpSLessThanEqual %bool %84 %87 + OpSelectionMerge %90 None + OpBranchConditional %88 %91 %92 + %91 = OpLabel + OpBranch %90 + %92 = OpLabel + OpBranch %81 + %90 = OpLabel + %93 = OpLoad %int %j_1 + %94 = OpAccessChain %_ptr_Private_int %obj %uint_0 %93 + %95 = OpLoad %int %94 + %96 = OpLoad %int %pivot + %97 = OpSLessThanEqual %bool %95 %96 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpLoad %int %i_1 + %101 = OpIAdd %int %100 %int_1 + OpStore %i_1 %101 + %102 = OpLoad %int %i_1 + OpStore %param %102 + %103 = OpLoad %int %j_1 + OpStore %param_1 %103 + %104 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %98 + %98 = OpLabel + OpBranch %82 + %82 = OpLabel + %107 = OpLoad %int %j_1 + %108 = OpIAdd %int %107 %int_1 + OpStore %j_1 %108 + OpBranch %80 + %81 = OpLabel + %109 = OpLoad %int %i_1 + %110 = OpIAdd %int %109 %int_1 + OpStore %param_2 %110 + %112 = OpLoad %int %h + OpStore %param_3 %112 + %113 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %116 = OpLoad %int %i_1 + %117 = OpIAdd %int %116 %int_1 + OpReturnValue %117 + OpFunctionEnd + %quicksort_ = OpFunction %void None %118 + %120 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %40 + %h_1 = OpVariable %_ptr_Function_int Function %40 + %top = OpVariable %_ptr_Function_int Function %40 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %126 + %p = OpVariable %_ptr_Function_int Function %40 + %param_4 = OpVariable %_ptr_Function_int Function %40 + %param_5 = OpVariable %_ptr_Function_int Function %40 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %133 = OpLoad %int %top + %134 = OpIAdd %int %133 %int_1 + OpStore %top %134 + %135 = OpLoad %int %l_1 + %136 = OpAccessChain %_ptr_Function_int %stack %134 + OpStore %136 %135 + %137 = OpLoad %int %top + %138 = OpIAdd %int %137 %int_1 + OpStore %top %138 + %139 = OpLoad %int %h_1 + %140 = OpAccessChain %_ptr_Function_int %stack %138 + OpStore %140 %139 + OpBranch %141 + %141 = OpLabel + OpLoopMerge %142 %143 None + OpBranch %144 + %144 = OpLabel + %145 = OpLoad %int %top + %146 = OpSGreaterThanEqual %bool %145 %int_0 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %149 + %148 = OpLabel + OpBranch %147 + %149 = OpLabel + OpBranch %142 + %147 = OpLabel + %150 = OpLoad %int %top + %151 = OpISub %int %150 %int_1 + OpStore %top %151 + %152 = OpAccessChain %_ptr_Function_int %stack %150 + %153 = OpLoad %int %152 + OpStore %h_1 %153 + %154 = OpLoad %int %top + %155 = OpISub %int %154 %int_1 + OpStore %top %155 + %156 = OpAccessChain %_ptr_Function_int %stack %154 + %157 = OpLoad %int %156 + OpStore %l_1 %157 + %158 = OpLoad %int %l_1 + OpStore %param_4 %158 + %159 = OpLoad %int %h_1 + OpStore %param_5 %159 + %160 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %160 + %163 = OpLoad %int %p + %164 = OpLoad %int %l_1 + %165 = OpISub %int %163 %int_1 + %166 = OpSGreaterThan %bool %165 %164 + OpSelectionMerge %167 None + OpBranchConditional %166 %168 %167 + %168 = OpLabel + %169 = OpLoad %int %top + %170 = OpIAdd %int %169 %int_1 + OpStore %top %170 + %171 = OpLoad %int %l_1 + %172 = OpAccessChain %_ptr_Function_int %stack %170 + OpStore %172 %171 + %173 = OpLoad %int %top + %174 = OpIAdd %int %173 %int_1 + OpStore %top %174 + %175 = OpLoad %int %p + %176 = OpAccessChain %_ptr_Function_int %stack %174 + %177 = OpISub %int %175 %int_1 + OpStore %176 %177 + OpBranch %167 + %167 = OpLabel + %178 = OpLoad %int %p + %179 = OpLoad %int %h_1 + %180 = OpIAdd %int %178 %int_1 + %181 = OpSLessThan %bool %180 %179 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %184 = OpLoad %int %top + %185 = OpIAdd %int %184 %int_1 + OpStore %top %185 + %186 = OpLoad %int %p + %187 = OpAccessChain %_ptr_Function_int %stack %185 + %188 = OpIAdd %int %186 %int_1 + OpStore %187 %188 + %189 = OpLoad %int %top + %190 = OpIAdd %int %189 %int_1 + OpStore %top %190 + %191 = OpLoad %int %h_1 + %192 = OpAccessChain %_ptr_Function_int %stack %190 + OpStore %192 %191 + OpBranch %182 + %182 = OpLabel + OpBranch %143 + %143 = OpLabel + OpBranch %141 + %142 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %118 + %194 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %40 + %uv = OpVariable %_ptr_Function_v2float Function %198 + %color = OpVariable %_ptr_Function_v3float Function %202 + %203 = OpLoad %v4float %x_GLF_pos + %207 = OpFAdd %v4float %203 %206 + %210 = OpFMul %v4float %207 %209 + OpStore %x_GLF_FragCoord %210 + OpStore %i_2 %int_0 + OpBranch %211 + %211 = OpLabel + OpLoopMerge %212 %213 None + OpBranch %214 + %214 = OpLabel + %215 = OpLoad %int %i_2 + %217 = OpSLessThan %bool %215 %int_10 + OpSelectionMerge %218 None + OpBranchConditional %217 %219 %220 + %219 = OpLabel + OpBranch %218 + %220 = OpLabel + OpBranch %212 + %218 = OpLabel + %221 = OpLoad %int %i_2 + %222 = OpLoad %int %i_2 + %223 = OpAccessChain %_ptr_Private_int %obj %uint_0 %221 + %224 = OpISub %int %int_10 %222 + OpStore %223 %224 + %225 = OpLoad %int %i_2 + %226 = OpLoad %int %i_2 + %227 = OpAccessChain %_ptr_Private_int %obj %uint_0 %226 + %228 = OpLoad %int %227 + %229 = OpLoad %int %i_2 + %230 = OpAccessChain %_ptr_Private_int %obj %uint_0 %229 + %231 = OpLoad %int %230 + %232 = OpAccessChain %_ptr_Private_int %obj %uint_0 %225 + %233 = OpIMul %int %228 %231 + OpStore %232 %233 + OpBranch %213 + %213 = OpLabel + %234 = OpLoad %int %i_2 + %235 = OpIAdd %int %234 %int_1 + OpStore %i_2 %235 + OpBranch %211 + %212 = OpLabel + %236 = OpFunctionCall %void %quicksort_ + %237 = OpLoad %v4float %x_GLF_FragCoord + %239 = OpAccessChain %_ptr_Uniform_v2float %x_34 %uint_0 + %240 = OpLoad %v2float %239 + %241 = OpCompositeExtract %float %237 0 + %242 = OpCompositeExtract %float %237 1 + %243 = OpCompositeConstruct %v2float %241 %242 + %244 = OpFDiv %v2float %243 %240 + OpStore %uv %244 + OpStore %color %247 + %248 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %249 = OpLoad %int %248 + %251 = OpAccessChain %_ptr_Function_float %color %uint_0 + %252 = OpLoad %float %251 + %253 = OpAccessChain %_ptr_Function_float %color %uint_0 + %254 = OpConvertSToF %float %249 + %255 = OpFAdd %float %252 %254 + OpStore %253 %255 + %256 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %257 = OpLoad %float %256 + %259 = OpFOrdGreaterThan %bool %257 %float_0_25 + OpSelectionMerge %260 None + OpBranchConditional %259 %261 %260 + %261 = OpLabel + %262 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %263 = OpLoad %int %262 + %264 = OpAccessChain %_ptr_Function_float %color %uint_0 + %265 = OpLoad %float %264 + %266 = OpAccessChain %_ptr_Function_float %color %uint_0 + %267 = OpConvertSToF %float %263 + %268 = OpFAdd %float %265 %267 + OpStore %266 %268 + OpBranch %260 + %260 = OpLabel + %269 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %270 = OpLoad %float %269 + %272 = OpFOrdGreaterThan %bool %270 %float_0_5 + OpSelectionMerge %273 None + OpBranchConditional %272 %274 %273 + %274 = OpLabel + %277 = OpAccessChain %_ptr_Uniform_float %x_37 %uint_0 %uint_1 + %278 = OpLoad %float %277 + %282 = OpConvertFToS %int %278 + %283 = OpIMul %int %int_2 %282 + %279 = OpExtInst %int %280 SMax %283 %int_2 + %284 = OpAccessChain %_ptr_Private_int %obj %uint_0 %279 + %285 = OpLoad %int %284 + %286 = OpAccessChain %_ptr_Uniform_float %x_37 %uint_0 %uint_1 + %287 = OpLoad %float %286 + %289 = OpConvertFToS %int %287 + %290 = OpIMul %int %int_2 %289 + %288 = OpExtInst %int %280 SMax %290 %int_2 + %291 = OpAccessChain %_ptr_Private_int %obj %uint_0 %288 + %292 = OpLoad %int %291 + %293 = OpAccessChain %_ptr_Function_float %color %uint_1 + %294 = OpLoad %float %293 + %295 = OpAccessChain %_ptr_Function_float %color %uint_1 + %297 = OpConvertSToF %float %285 + %298 = OpConvertSToF %float %292 + %296 = OpExtInst %float %280 NMax %297 %298 + %299 = OpFAdd %float %294 %296 + OpStore %295 %299 + OpBranch %273 + %273 = OpLabel + %300 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %301 = OpLoad %float %300 + %303 = OpFOrdGreaterThan %bool %301 %float_0_75 + OpSelectionMerge %304 None + OpBranchConditional %303 %305 %304 + %305 = OpLabel + %307 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %308 = OpLoad %int %307 + %310 = OpAccessChain %_ptr_Function_float %color %uint_2 + %311 = OpLoad %float %310 + %312 = OpAccessChain %_ptr_Function_float %color %uint_2 + %313 = OpConvertSToF %float %308 + %314 = OpFAdd %float %311 %313 + OpStore %312 %314 + OpBranch %304 + %304 = OpLabel + %316 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %317 = OpLoad %int %316 + %318 = OpAccessChain %_ptr_Function_float %color %uint_1 + %319 = OpLoad %float %318 + %320 = OpAccessChain %_ptr_Function_float %color %uint_1 + %321 = OpConvertSToF %float %317 + %322 = OpFAdd %float %319 %321 + OpStore %320 %322 + %323 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %324 = OpLoad %float %323 + %325 = OpFOrdGreaterThan %bool %324 %float_0_25 + OpSelectionMerge %326 None + OpBranchConditional %325 %327 %326 + %327 = OpLabel + %329 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %330 = OpLoad %int %329 + %331 = OpAccessChain %_ptr_Function_float %color %uint_0 + %332 = OpLoad %float %331 + %333 = OpAccessChain %_ptr_Function_float %color %uint_0 + %334 = OpConvertSToF %float %330 + %335 = OpFAdd %float %332 %334 + OpStore %333 %335 + OpBranch %326 + %326 = OpLabel + %336 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %337 = OpLoad %float %336 + %338 = OpFOrdGreaterThan %bool %337 %float_0_5 + OpSelectionMerge %339 None + OpBranchConditional %338 %340 %339 + %340 = OpLabel + %342 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %343 = OpLoad %int %342 + %344 = OpAccessChain %_ptr_Function_float %color %uint_1 + %345 = OpLoad %float %344 + %346 = OpAccessChain %_ptr_Function_float %color %uint_1 + %347 = OpConvertSToF %float %343 + %348 = OpFAdd %float %345 %347 + OpStore %346 %348 + OpBranch %339 + %339 = OpLabel + %349 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %350 = OpLoad %float %349 + %351 = OpFOrdGreaterThan %bool %350 %float_0_75 + OpSelectionMerge %352 None + OpBranchConditional %351 %353 %352 + %353 = OpLabel + %355 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %356 = OpLoad %int %355 + %357 = OpAccessChain %_ptr_Function_float %color %uint_2 + %358 = OpLoad %float %357 + %359 = OpAccessChain %_ptr_Function_float %color %uint_2 + %360 = OpConvertSToF %float %356 + %361 = OpFAdd %float %358 %360 + OpStore %359 %361 + OpBranch %352 + %352 = OpLabel + %363 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %364 = OpLoad %int %363 + %365 = OpAccessChain %_ptr_Function_float %color %uint_2 + %366 = OpLoad %float %365 + %367 = OpAccessChain %_ptr_Function_float %color %uint_2 + %368 = OpConvertSToF %float %364 + %369 = OpFAdd %float %366 %368 + OpStore %367 %369 + %370 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %371 = OpLoad %float %370 + %372 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %373 = OpLoad %float %372 + %375 = OpFSub %float %371 %373 + %374 = OpExtInst %float %280 FAbs %375 + %376 = OpFOrdLessThan %bool %374 %float_0_25 + OpSelectionMerge %377 None + OpBranchConditional %376 %378 %377 + %378 = OpLabel + %379 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %380 = OpLoad %int %379 + %381 = OpAccessChain %_ptr_Function_float %color %uint_0 + %382 = OpLoad %float %381 + %383 = OpAccessChain %_ptr_Function_float %color %uint_0 + %384 = OpConvertSToF %float %380 + %385 = OpFAdd %float %382 %384 + OpStore %383 %385 + OpBranch %377 + %377 = OpLabel + %386 = OpLoad %v3float %color + %387 = OpExtInst %v3float %280 Normalize %386 + %388 = OpCompositeExtract %float %387 0 + %389 = OpCompositeExtract %float %387 1 + %390 = OpCompositeExtract %float %387 2 + %391 = OpCompositeConstruct %v4float %388 %389 %390 %float_1 + OpStore %frag_color %391 + %392 = OpLoad %v4float %x_GLF_pos + OpStore %gl_Position %392 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %393 +%tint_symbol_1 = OpFunctionParameter %main_out + %397 = OpLabel + %398 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %398 + %399 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %399 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %118 + %401 = OpLabel + OpStore %tint_pointsize %float_1 + %402 = OpLoad %v4float %tint_symbol + OpStore %x_GLF_pos %402 + %403 = OpFunctionCall %void %main_1 + %405 = OpLoad %v4float %frag_color + %406 = OpLoad %v4float %gl_Position + %407 = OpCompositeConstruct %main_out %405 %406 + %404 = OpFunctionCall %void %tint_symbol_4 %407 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..3d6cec0304 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.wgsl @@ -0,0 +1,274 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(1)]] var x_34 : buf1; + +[[group(0), binding(0)]] var x_37 : buf0; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_257 : i32 = *(i); + let x_259 : i32 = obj.numbers[x_257]; + temp = x_259; + let x_260 : i32 = *(i); + let x_261 : i32 = *(j); + let x_263 : i32 = obj.numbers[x_261]; + obj.numbers[x_260] = x_263; + let x_265 : i32 = *(j); + let x_266 : i32 = temp; + obj.numbers[x_265] = x_266; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_269 : i32 = *(h); + let x_271 : i32 = obj.numbers[x_269]; + pivot = x_271; + let x_272 : i32 = *(l); + i_1 = (x_272 - 1); + let x_274 : i32 = *(l); + j_1 = x_274; + loop { + let x_279 : i32 = j_1; + let x_280 : i32 = *(h); + if ((x_279 <= (x_280 - 1))) { + } else { + break; + } + let x_284 : i32 = j_1; + let x_286 : i32 = obj.numbers[x_284]; + let x_287 : i32 = pivot; + if ((x_286 <= x_287)) { + let x_291 : i32 = i_1; + i_1 = (x_291 + 1); + let x_293 : i32 = i_1; + param = x_293; + let x_294 : i32 = j_1; + param_1 = x_294; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_296 : i32 = j_1; + j_1 = (x_296 + 1); + } + } + let x_298 : i32 = i_1; + param_2 = (x_298 + 1); + let x_300 : i32 = *(h); + param_3 = x_300; + swap_i1_i1_(&(param_2), &(param_3)); + let x_302 : i32 = i_1; + return (x_302 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_305 : i32 = top; + let x_306 : i32 = (x_305 + 1); + top = x_306; + let x_307 : i32 = l_1; + stack[x_306] = x_307; + let x_309 : i32 = top; + let x_310 : i32 = (x_309 + 1); + top = x_310; + let x_311 : i32 = h_1; + stack[x_310] = x_311; + loop { + let x_317 : i32 = top; + if ((x_317 >= 0)) { + } else { + break; + } + let x_320 : i32 = top; + top = (x_320 - 1); + let x_323 : i32 = stack[x_320]; + h_1 = x_323; + let x_324 : i32 = top; + top = (x_324 - 1); + let x_327 : i32 = stack[x_324]; + l_1 = x_327; + let x_328 : i32 = l_1; + param_4 = x_328; + let x_329 : i32 = h_1; + param_5 = x_329; + let x_330 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_330; + let x_331 : i32 = p; + let x_333 : i32 = l_1; + if (((x_331 - 1) > x_333)) { + let x_337 : i32 = top; + let x_338 : i32 = (x_337 + 1); + top = x_338; + let x_339 : i32 = l_1; + stack[x_338] = x_339; + let x_341 : i32 = top; + let x_342 : i32 = (x_341 + 1); + top = x_342; + let x_343 : i32 = p; + stack[x_342] = (x_343 - 1); + } + let x_346 : i32 = p; + let x_348 : i32 = h_1; + if (((x_346 + 1) < x_348)) { + let x_352 : i32 = top; + let x_353 : i32 = (x_352 + 1); + top = x_353; + let x_354 : i32 = p; + stack[x_353] = (x_354 + 1); + let x_357 : i32 = top; + let x_358 : i32 = (x_357 + 1); + top = x_358; + let x_359 : i32 = h_1; + stack[x_358] = x_359; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_94 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_94 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_101 : i32 = i_2; + if ((x_101 < 10)) { + } else { + break; + } + let x_104 : i32 = i_2; + let x_105 : i32 = i_2; + obj.numbers[x_104] = (10 - x_105); + let x_108 : i32 = i_2; + let x_109 : i32 = i_2; + let x_111 : i32 = obj.numbers[x_109]; + let x_112 : i32 = i_2; + let x_114 : i32 = obj.numbers[x_112]; + obj.numbers[x_108] = (x_111 * x_114); + + continuing { + let x_117 : i32 = i_2; + i_2 = (x_117 + 1); + } + } + quicksort_(); + let x_120 : vec4 = x_GLF_FragCoord; + let x_123 : vec2 = x_34.resolution; + uv = (vec2(x_120.x, x_120.y) / x_123); + color = vec3(1.0, 2.0, 3.0); + let x_126 : i32 = obj.numbers[0]; + let x_129 : f32 = color.x; + color.x = (x_129 + f32(x_126)); + let x_133 : f32 = uv.x; + if ((x_133 > 0.25)) { + let x_138 : i32 = obj.numbers[1]; + let x_141 : f32 = color.x; + color.x = (x_141 + f32(x_138)); + } + let x_145 : f32 = uv.x; + if ((x_145 > 0.5)) { + let x_150 : f32 = x_37.injectionSwitch.y; + let x_155 : i32 = obj.numbers[max((2 * i32(x_150)), 2)]; + let x_158 : f32 = x_37.injectionSwitch.y; + let x_163 : i32 = obj.numbers[max((2 * i32(x_158)), 2)]; + let x_167 : f32 = color.y; + color.y = (x_167 + max(f32(x_155), f32(x_163))); + } + let x_171 : f32 = uv.x; + if ((x_171 > 0.75)) { + let x_176 : i32 = obj.numbers[3]; + let x_179 : f32 = color.z; + color.z = (x_179 + f32(x_176)); + } + let x_183 : i32 = obj.numbers[4]; + let x_186 : f32 = color.y; + color.y = (x_186 + f32(x_183)); + let x_190 : f32 = uv.y; + if ((x_190 > 0.25)) { + let x_195 : i32 = obj.numbers[5]; + let x_198 : f32 = color.x; + color.x = (x_198 + f32(x_195)); + } + let x_202 : f32 = uv.y; + if ((x_202 > 0.5)) { + let x_207 : i32 = obj.numbers[6]; + let x_210 : f32 = color.y; + color.y = (x_210 + f32(x_207)); + } + let x_214 : f32 = uv.y; + if ((x_214 > 0.75)) { + let x_219 : i32 = obj.numbers[7]; + let x_222 : f32 = color.z; + color.z = (x_222 + f32(x_219)); + } + let x_226 : i32 = obj.numbers[8]; + let x_229 : f32 = color.z; + color.z = (x_229 + f32(x_226)); + let x_233 : f32 = uv.x; + let x_235 : f32 = uv.y; + if ((abs((x_233 - x_235)) < 0.25)) { + let x_242 : i32 = obj.numbers[9]; + let x_245 : f32 = color.x; + color.x = (x_245 + f32(x_242)); + } + let x_248 : vec3 = color; + let x_249 : vec3 = normalize(x_248); + frag_color = vec4(x_249.x, x_249.y, x_249.z, 1.0); + let x_254 : vec4 = x_GLF_pos; + gl_Position = x_254; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl new file mode 100644 index 0000000000..3d6cec0304 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl @@ -0,0 +1,274 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(1)]] var x_34 : buf1; + +[[group(0), binding(0)]] var x_37 : buf0; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_257 : i32 = *(i); + let x_259 : i32 = obj.numbers[x_257]; + temp = x_259; + let x_260 : i32 = *(i); + let x_261 : i32 = *(j); + let x_263 : i32 = obj.numbers[x_261]; + obj.numbers[x_260] = x_263; + let x_265 : i32 = *(j); + let x_266 : i32 = temp; + obj.numbers[x_265] = x_266; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_269 : i32 = *(h); + let x_271 : i32 = obj.numbers[x_269]; + pivot = x_271; + let x_272 : i32 = *(l); + i_1 = (x_272 - 1); + let x_274 : i32 = *(l); + j_1 = x_274; + loop { + let x_279 : i32 = j_1; + let x_280 : i32 = *(h); + if ((x_279 <= (x_280 - 1))) { + } else { + break; + } + let x_284 : i32 = j_1; + let x_286 : i32 = obj.numbers[x_284]; + let x_287 : i32 = pivot; + if ((x_286 <= x_287)) { + let x_291 : i32 = i_1; + i_1 = (x_291 + 1); + let x_293 : i32 = i_1; + param = x_293; + let x_294 : i32 = j_1; + param_1 = x_294; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_296 : i32 = j_1; + j_1 = (x_296 + 1); + } + } + let x_298 : i32 = i_1; + param_2 = (x_298 + 1); + let x_300 : i32 = *(h); + param_3 = x_300; + swap_i1_i1_(&(param_2), &(param_3)); + let x_302 : i32 = i_1; + return (x_302 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_305 : i32 = top; + let x_306 : i32 = (x_305 + 1); + top = x_306; + let x_307 : i32 = l_1; + stack[x_306] = x_307; + let x_309 : i32 = top; + let x_310 : i32 = (x_309 + 1); + top = x_310; + let x_311 : i32 = h_1; + stack[x_310] = x_311; + loop { + let x_317 : i32 = top; + if ((x_317 >= 0)) { + } else { + break; + } + let x_320 : i32 = top; + top = (x_320 - 1); + let x_323 : i32 = stack[x_320]; + h_1 = x_323; + let x_324 : i32 = top; + top = (x_324 - 1); + let x_327 : i32 = stack[x_324]; + l_1 = x_327; + let x_328 : i32 = l_1; + param_4 = x_328; + let x_329 : i32 = h_1; + param_5 = x_329; + let x_330 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_330; + let x_331 : i32 = p; + let x_333 : i32 = l_1; + if (((x_331 - 1) > x_333)) { + let x_337 : i32 = top; + let x_338 : i32 = (x_337 + 1); + top = x_338; + let x_339 : i32 = l_1; + stack[x_338] = x_339; + let x_341 : i32 = top; + let x_342 : i32 = (x_341 + 1); + top = x_342; + let x_343 : i32 = p; + stack[x_342] = (x_343 - 1); + } + let x_346 : i32 = p; + let x_348 : i32 = h_1; + if (((x_346 + 1) < x_348)) { + let x_352 : i32 = top; + let x_353 : i32 = (x_352 + 1); + top = x_353; + let x_354 : i32 = p; + stack[x_353] = (x_354 + 1); + let x_357 : i32 = top; + let x_358 : i32 = (x_357 + 1); + top = x_358; + let x_359 : i32 = h_1; + stack[x_358] = x_359; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_94 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_94 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_101 : i32 = i_2; + if ((x_101 < 10)) { + } else { + break; + } + let x_104 : i32 = i_2; + let x_105 : i32 = i_2; + obj.numbers[x_104] = (10 - x_105); + let x_108 : i32 = i_2; + let x_109 : i32 = i_2; + let x_111 : i32 = obj.numbers[x_109]; + let x_112 : i32 = i_2; + let x_114 : i32 = obj.numbers[x_112]; + obj.numbers[x_108] = (x_111 * x_114); + + continuing { + let x_117 : i32 = i_2; + i_2 = (x_117 + 1); + } + } + quicksort_(); + let x_120 : vec4 = x_GLF_FragCoord; + let x_123 : vec2 = x_34.resolution; + uv = (vec2(x_120.x, x_120.y) / x_123); + color = vec3(1.0, 2.0, 3.0); + let x_126 : i32 = obj.numbers[0]; + let x_129 : f32 = color.x; + color.x = (x_129 + f32(x_126)); + let x_133 : f32 = uv.x; + if ((x_133 > 0.25)) { + let x_138 : i32 = obj.numbers[1]; + let x_141 : f32 = color.x; + color.x = (x_141 + f32(x_138)); + } + let x_145 : f32 = uv.x; + if ((x_145 > 0.5)) { + let x_150 : f32 = x_37.injectionSwitch.y; + let x_155 : i32 = obj.numbers[max((2 * i32(x_150)), 2)]; + let x_158 : f32 = x_37.injectionSwitch.y; + let x_163 : i32 = obj.numbers[max((2 * i32(x_158)), 2)]; + let x_167 : f32 = color.y; + color.y = (x_167 + max(f32(x_155), f32(x_163))); + } + let x_171 : f32 = uv.x; + if ((x_171 > 0.75)) { + let x_176 : i32 = obj.numbers[3]; + let x_179 : f32 = color.z; + color.z = (x_179 + f32(x_176)); + } + let x_183 : i32 = obj.numbers[4]; + let x_186 : f32 = color.y; + color.y = (x_186 + f32(x_183)); + let x_190 : f32 = uv.y; + if ((x_190 > 0.25)) { + let x_195 : i32 = obj.numbers[5]; + let x_198 : f32 = color.x; + color.x = (x_198 + f32(x_195)); + } + let x_202 : f32 = uv.y; + if ((x_202 > 0.5)) { + let x_207 : i32 = obj.numbers[6]; + let x_210 : f32 = color.y; + color.y = (x_210 + f32(x_207)); + } + let x_214 : f32 = uv.y; + if ((x_214 > 0.75)) { + let x_219 : i32 = obj.numbers[7]; + let x_222 : f32 = color.z; + color.z = (x_222 + f32(x_219)); + } + let x_226 : i32 = obj.numbers[8]; + let x_229 : f32 = color.z; + color.z = (x_229 + f32(x_226)); + let x_233 : f32 = uv.x; + let x_235 : f32 = uv.y; + if ((abs((x_233 - x_235)) < 0.25)) { + let x_242 : i32 = obj.numbers[9]; + let x_245 : f32 = color.x; + color.x = (x_245 + f32(x_242)); + } + let x_248 : vec3 = color; + let x_249 : vec3 = normalize(x_248); + frag_color = vec4(x_249.x, x_249.y, x_249.z, 1.0); + let x_254 : vec4 = x_GLF_pos; + gl_Position = x_254; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..231fdaf925 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.hlsl @@ -0,0 +1,225 @@ +struct QuicksortObject { + int numbers[10]; +}; + +static QuicksortObject obj = (QuicksortObject)0; +static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_34 : register(b1, space0) { + uint4 x_34[1]; +}; +cbuffer cbuffer_x_37 : register(b0, space0) { + uint4 x_37[1]; +}; +static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void swap_i1_i1_(inout int i, inout int j) { + int temp = 0; + const int x_257 = i; + const int x_259 = obj.numbers[x_257]; + temp = x_259; + const int x_260 = i; + const int x_261 = j; + const int x_263 = obj.numbers[x_261]; + obj.numbers[x_260] = x_263; + const int x_265 = j; + obj.numbers[x_265] = temp; + return; +} + +int performPartition_i1_i1_(inout int l, inout int h) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + const int x_269 = h; + const int x_271 = obj.numbers[x_269]; + pivot = x_271; + const int x_272 = l; + i_1 = (x_272 - 1); + const int x_274 = l; + j_1 = x_274; + while (true) { + const int x_279 = j_1; + const int x_280 = h; + if ((x_279 <= (x_280 - 1))) { + } else { + break; + } + const int x_286 = obj.numbers[j_1]; + if ((x_286 <= pivot)) { + i_1 = (i_1 + 1); + param = i_1; + param_1 = j_1; + swap_i1_i1_(param, param_1); + } + { + j_1 = (j_1 + 1); + } + } + param_2 = (i_1 + 1); + const int x_300 = h; + param_3 = x_300; + swap_i1_i1_(param_2, param_3); + return (i_1 + 1); +} + +void quicksort_() { + int l_1 = 0; + int h_1 = 0; + int top = 0; + int stack[10] = (int[10])0; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + const int x_306 = (top + 1); + top = x_306; + stack[x_306] = l_1; + const int x_310 = (top + 1); + top = x_310; + stack[x_310] = h_1; + while (true) { + if ((top >= 0)) { + } else { + break; + } + const int x_320 = top; + top = (x_320 - 1); + const int x_323 = stack[x_320]; + h_1 = x_323; + const int x_324 = top; + top = (x_324 - 1); + const int x_327 = stack[x_324]; + l_1 = x_327; + param_4 = l_1; + param_5 = h_1; + const int x_330 = performPartition_i1_i1_(param_4, param_5); + p = x_330; + if (((p - 1) > l_1)) { + const int x_338 = (top + 1); + top = x_338; + stack[x_338] = l_1; + const int x_342 = (top + 1); + top = x_342; + stack[x_342] = (p - 1); + } + if (((p + 1) < h_1)) { + const int x_353 = (top + 1); + top = x_353; + stack[x_353] = (p + 1); + const int x_358 = (top + 1); + top = x_358; + stack[x_358] = h_1; + } + } + return; +} + +void main_1() { + int i_2 = 0; + float2 uv = float2(0.0f, 0.0f); + float3 color = float3(0.0f, 0.0f, 0.0f); + x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + { + for(; (i_2 < 10); i_2 = (i_2 + 1)) { + obj.numbers[i_2] = (10 - i_2); + const int x_108 = i_2; + const int x_111 = obj.numbers[i_2]; + const int x_114 = obj.numbers[i_2]; + obj.numbers[x_108] = (x_111 * x_114); + } + } + quicksort_(); + const float4 x_120 = x_GLF_FragCoord; + const float2 x_123 = asfloat(x_34[0].xy); + uv = (float2(x_120.x, x_120.y) / x_123); + color = float3(1.0f, 2.0f, 3.0f); + const int x_126 = obj.numbers[0]; + const float x_129 = color.x; + color.x = (x_129 + float(x_126)); + const float x_133 = uv.x; + if ((x_133 > 0.25f)) { + const int x_138 = obj.numbers[1]; + const float x_141 = color.x; + color.x = (x_141 + float(x_138)); + } + const float x_145 = uv.x; + if ((x_145 > 0.5f)) { + const float x_150 = asfloat(x_37[0].y); + const int x_155 = obj.numbers[max((2 * int(x_150)), 2)]; + const float x_158 = asfloat(x_37[0].y); + const int x_163 = obj.numbers[max((2 * int(x_158)), 2)]; + const float x_167 = color.y; + color.y = (x_167 + max(float(x_155), float(x_163))); + } + const float x_171 = uv.x; + if ((x_171 > 0.75f)) { + const int x_176 = obj.numbers[3]; + const float x_179 = color.z; + color.z = (x_179 + float(x_176)); + } + const int x_183 = obj.numbers[4]; + const float x_186 = color.y; + color.y = (x_186 + float(x_183)); + const float x_190 = uv.y; + if ((x_190 > 0.25f)) { + const int x_195 = obj.numbers[5]; + const float x_198 = color.x; + color.x = (x_198 + float(x_195)); + } + const float x_202 = uv.y; + if ((x_202 > 0.5f)) { + const int x_207 = obj.numbers[6]; + const float x_210 = color.y; + color.y = (x_210 + float(x_207)); + } + const float x_214 = uv.y; + if ((x_214 > 0.75f)) { + const int x_219 = obj.numbers[7]; + const float x_222 = color.z; + color.z = (x_222 + float(x_219)); + } + const int x_226 = obj.numbers[8]; + const float x_229 = color.z; + color.z = (x_229 + float(x_226)); + const float x_233 = uv.x; + const float x_235 = uv.y; + if ((abs((x_233 - x_235)) < 0.25f)) { + const int x_242 = obj.numbers[9]; + const float x_245 = color.x; + color.x = (x_245 + float(x_242)); + } + const float3 x_249 = normalize(color); + frag_color = float4(x_249.x, x_249.y, x_249.z, 1.0f); + gl_Position = x_GLF_pos; + return; +} + +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 x_GLF_pos_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 frag_color_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_GLF_pos_param = tint_symbol.x_GLF_pos_param; + x_GLF_pos = x_GLF_pos_param; + main_1(); + const main_out tint_symbol_3 = {frag_color, gl_Position}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.msl new file mode 100644 index 0000000000..99d503991c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.msl @@ -0,0 +1,272 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + int arr[10]; +}; +struct QuicksortObject { + tint_array_wrapper numbers; +}; +struct buf1 { + /* 0x0000 */ packed_float2 resolution; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 frag_color_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_pos_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 frag_color_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_6) { + int temp = 0; + int const x_257 = *(i); + int const x_259 = (*(tint_symbol_6)).numbers.arr[x_257]; + temp = x_259; + int const x_260 = *(i); + int const x_261 = *(j); + int const x_263 = (*(tint_symbol_6)).numbers.arr[x_261]; + (*(tint_symbol_6)).numbers.arr[x_260] = x_263; + int const x_265 = *(j); + int const x_266 = temp; + (*(tint_symbol_6)).numbers.arr[x_265] = x_266; + return; +} + +int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_7) { + int pivot = 0; + int i_1 = 0; + int j_1 = 0; + int param = 0; + int param_1 = 0; + int param_2 = 0; + int param_3 = 0; + int const x_269 = *(h); + int const x_271 = (*(tint_symbol_7)).numbers.arr[x_269]; + pivot = x_271; + int const x_272 = *(l); + i_1 = (x_272 - 1); + int const x_274 = *(l); + j_1 = x_274; + while (true) { + int const x_279 = j_1; + int const x_280 = *(h); + if ((x_279 <= (x_280 - 1))) { + } else { + break; + } + int const x_284 = j_1; + int const x_286 = (*(tint_symbol_7)).numbers.arr[x_284]; + int const x_287 = pivot; + if ((x_286 <= x_287)) { + int const x_291 = i_1; + i_1 = (x_291 + 1); + int const x_293 = i_1; + param = x_293; + int const x_294 = j_1; + param_1 = x_294; + swap_i1_i1_(&(param), &(param_1), tint_symbol_7); + } + { + int const x_296 = j_1; + j_1 = (x_296 + 1); + } + } + int const x_298 = i_1; + param_2 = (x_298 + 1); + int const x_300 = *(h); + param_3 = x_300; + swap_i1_i1_(&(param_2), &(param_3), tint_symbol_7); + int const x_302 = i_1; + return (x_302 + 1); +} + +void quicksort_(thread QuicksortObject* const tint_symbol_8) { + int l_1 = 0; + int h_1 = 0; + int top = 0; + tint_array_wrapper stack = {}; + int p = 0; + int param_4 = 0; + int param_5 = 0; + l_1 = 0; + h_1 = 9; + top = -1; + int const x_305 = top; + int const x_306 = (x_305 + 1); + top = x_306; + int const x_307 = l_1; + stack.arr[x_306] = x_307; + int const x_309 = top; + int const x_310 = (x_309 + 1); + top = x_310; + int const x_311 = h_1; + stack.arr[x_310] = x_311; + while (true) { + int const x_317 = top; + if ((x_317 >= 0)) { + } else { + break; + } + int const x_320 = top; + top = (x_320 - 1); + int const x_323 = stack.arr[x_320]; + h_1 = x_323; + int const x_324 = top; + top = (x_324 - 1); + int const x_327 = stack.arr[x_324]; + l_1 = x_327; + int const x_328 = l_1; + param_4 = x_328; + int const x_329 = h_1; + param_5 = x_329; + int const x_330 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_8); + p = x_330; + int const x_331 = p; + int const x_333 = l_1; + if (((x_331 - 1) > x_333)) { + int const x_337 = top; + int const x_338 = (x_337 + 1); + top = x_338; + int const x_339 = l_1; + stack.arr[x_338] = x_339; + int const x_341 = top; + int const x_342 = (x_341 + 1); + top = x_342; + int const x_343 = p; + stack.arr[x_342] = (x_343 - 1); + } + int const x_346 = p; + int const x_348 = h_1; + if (((x_346 + 1) < x_348)) { + int const x_352 = top; + int const x_353 = (x_352 + 1); + top = x_353; + int const x_354 = p; + stack.arr[x_353] = (x_354 + 1); + int const x_357 = top; + int const x_358 = (x_357 + 1); + top = x_358; + int const x_359 = h_1; + stack.arr[x_358] = x_359; + } + } + return; +} + +void main_1(constant buf1& x_34, constant buf0& x_37, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10, thread QuicksortObject* const tint_symbol_11, thread float4* const tint_symbol_12, thread float4* const tint_symbol_13) { + int i_2 = 0; + float2 uv = 0.0f; + float3 color = 0.0f; + float4 const x_94 = *(tint_symbol_9); + *(tint_symbol_10) = ((x_94 + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f)); + i_2 = 0; + while (true) { + int const x_101 = i_2; + if ((x_101 < 10)) { + } else { + break; + } + int const x_104 = i_2; + int const x_105 = i_2; + (*(tint_symbol_11)).numbers.arr[x_104] = (10 - x_105); + int const x_108 = i_2; + int const x_109 = i_2; + int const x_111 = (*(tint_symbol_11)).numbers.arr[x_109]; + int const x_112 = i_2; + int const x_114 = (*(tint_symbol_11)).numbers.arr[x_112]; + (*(tint_symbol_11)).numbers.arr[x_108] = (x_111 * x_114); + { + int const x_117 = i_2; + i_2 = (x_117 + 1); + } + } + quicksort_(tint_symbol_11); + float4 const x_120 = *(tint_symbol_10); + float2 const x_123 = x_34.resolution; + uv = (float2(x_120.x, x_120.y) / x_123); + color = float3(1.0f, 2.0f, 3.0f); + int const x_126 = (*(tint_symbol_11)).numbers.arr[0]; + float const x_129 = color.x; + color.x = (x_129 + float(x_126)); + float const x_133 = uv.x; + if ((x_133 > 0.25f)) { + int const x_138 = (*(tint_symbol_11)).numbers.arr[1]; + float const x_141 = color.x; + color.x = (x_141 + float(x_138)); + } + float const x_145 = uv.x; + if ((x_145 > 0.5f)) { + float const x_150 = x_37.injectionSwitch.y; + int const x_155 = (*(tint_symbol_11)).numbers.arr[max((2 * int(x_150)), 2)]; + float const x_158 = x_37.injectionSwitch.y; + int const x_163 = (*(tint_symbol_11)).numbers.arr[max((2 * int(x_158)), 2)]; + float const x_167 = color.y; + color.y = (x_167 + fmax(float(x_155), float(x_163))); + } + float const x_171 = uv.x; + if ((x_171 > 0.75f)) { + int const x_176 = (*(tint_symbol_11)).numbers.arr[3]; + float const x_179 = color.z; + color.z = (x_179 + float(x_176)); + } + int const x_183 = (*(tint_symbol_11)).numbers.arr[4]; + float const x_186 = color.y; + color.y = (x_186 + float(x_183)); + float const x_190 = uv.y; + if ((x_190 > 0.25f)) { + int const x_195 = (*(tint_symbol_11)).numbers.arr[5]; + float const x_198 = color.x; + color.x = (x_198 + float(x_195)); + } + float const x_202 = uv.y; + if ((x_202 > 0.5f)) { + int const x_207 = (*(tint_symbol_11)).numbers.arr[6]; + float const x_210 = color.y; + color.y = (x_210 + float(x_207)); + } + float const x_214 = uv.y; + if ((x_214 > 0.75f)) { + int const x_219 = (*(tint_symbol_11)).numbers.arr[7]; + float const x_222 = color.z; + color.z = (x_222 + float(x_219)); + } + int const x_226 = (*(tint_symbol_11)).numbers.arr[8]; + float const x_229 = color.z; + color.z = (x_229 + float(x_226)); + float const x_233 = uv.x; + float const x_235 = uv.y; + if ((fabs((x_233 - x_235)) < 0.25f)) { + int const x_242 = (*(tint_symbol_11)).numbers.arr[9]; + float const x_245 = color.x; + color.x = (x_245 + float(x_242)); + } + float3 const x_248 = color; + float3 const x_249 = normalize(x_248); + *(tint_symbol_12) = float4(x_249.x, x_249.y, x_249.z, 1.0f); + float4 const x_254 = *(tint_symbol_9); + *(tint_symbol_13) = x_254; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant buf1& x_34 [[buffer(1)]], constant buf0& x_37 [[buffer(0)]]) { + thread float4 tint_symbol_14 = 0.0f; + thread float4 tint_symbol_15 = 0.0f; + thread QuicksortObject tint_symbol_16 = {}; + thread float4 tint_symbol_17 = 0.0f; + thread float4 tint_symbol_18 = 0.0f; + float4 const x_GLF_pos_param = tint_symbol_1.x_GLF_pos_param; + tint_symbol_14 = x_GLF_pos_param; + main_1(x_34, x_37, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_16), &(tint_symbol_17), &(tint_symbol_18)); + main_out const tint_symbol_4 = {.frag_color_1=tint_symbol_17, .gl_Position=tint_symbol_18}; + tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..f53a11bbc1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.spvasm @@ -0,0 +1,593 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 408 +; Schema: 0 + OpCapability Shader + %280 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %QuicksortObject "QuicksortObject" + OpMemberName %QuicksortObject 0 "numbers" + OpName %obj "obj" + OpName %x_GLF_FragCoord "x_GLF_FragCoord" + OpName %x_GLF_pos "x_GLF_pos" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %x_34 "x_34" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_37 "x_37" + OpName %frag_color "frag_color" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %swap_i1_i1_ "swap_i1_i1_" + OpName %i "i" + OpName %j "j" + OpName %temp "temp" + OpName %performPartition_i1_i1_ "performPartition_i1_i1_" + OpName %l "l" + OpName %h "h" + OpName %pivot "pivot" + OpName %i_1 "i_1" + OpName %j_1 "j_1" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %quicksort_ "quicksort_" + OpName %l_1 "l_1" + OpName %h_1 "h_1" + OpName %top "top" + OpName %stack "stack" + OpName %p "p" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %main_1 "main_1" + OpName %i_2 "i_2" + OpName %uv "uv" + OpName %color "color" + OpName %main_out "main_out" + OpMemberName %main_out 0 "frag_color_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpMemberDecorate %QuicksortObject 0 Offset 0 + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_34 NonWritable + OpDecorate %x_34 DescriptorSet 0 + OpDecorate %x_34 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_37 NonWritable + OpDecorate %x_37 DescriptorSet 0 + OpDecorate %x_37 Binding 0 + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_3 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%QuicksortObject = OpTypeStruct %_arr_int_uint_10 +%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject + %12 = OpConstantNull %QuicksortObject + %obj = OpVariable %_ptr_Private_QuicksortObject Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%x_GLF_FragCoord = OpVariable %_ptr_Private_v4float Private %16 + %x_GLF_pos = OpVariable %_ptr_Private_v4float Private %16 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_34 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_37 = OpVariable %_ptr_Uniform_buf0 Uniform + %frag_color = OpVariable %_ptr_Private_v4float Private %16 +%gl_Position = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %16 +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid +%_ptr_Function_int = OpTypePointer Function %int + %32 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %40 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_int = OpTypePointer Private %int + %58 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %118 = OpTypeFunction %void +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %126 = OpConstantNull %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %int_9 = OpConstant %int 9 + %int_n1 = OpConstant %int -1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %198 = OpConstantNull %v2float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %202 = OpConstantNull %v3float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %206 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_0 + %float_128 = OpConstant %float 128 + %209 = OpConstantComposite %v4float %float_128 %float_128 %float_1 %float_1 + %int_10 = OpConstant %int 10 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %247 = OpConstantComposite %v3float %float_1 %float_2 %float_3 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %float_0_5 = OpConstant %float 0.5 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %float_0_75 = OpConstant %float 0.75 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %main_out = OpTypeStruct %v4float %v4float + %393 = OpTypeFunction %void %main_out +%swap_i1_i1_ = OpFunction %void None %32 + %i = OpFunctionParameter %_ptr_Function_int + %j = OpFunctionParameter %_ptr_Function_int + %38 = OpLabel + %temp = OpVariable %_ptr_Function_int Function %40 + %42 = OpLoad %int %i + %45 = OpAccessChain %_ptr_Private_int %obj %uint_0 %42 + %46 = OpLoad %int %45 + OpStore %temp %46 + %48 = OpLoad %int %i + %50 = OpLoad %int %j + %51 = OpAccessChain %_ptr_Private_int %obj %uint_0 %50 + %52 = OpLoad %int %51 + %53 = OpAccessChain %_ptr_Private_int %obj %uint_0 %48 + OpStore %53 %52 + %55 = OpLoad %int %j + %56 = OpLoad %int %temp + %57 = OpAccessChain %_ptr_Private_int %obj %uint_0 %55 + OpStore %57 %56 + OpReturn + OpFunctionEnd +%performPartition_i1_i1_ = OpFunction %int None %58 + %l = OpFunctionParameter %_ptr_Function_int + %h = OpFunctionParameter %_ptr_Function_int + %62 = OpLabel + %pivot = OpVariable %_ptr_Function_int Function %40 + %i_1 = OpVariable %_ptr_Function_int Function %40 + %j_1 = OpVariable %_ptr_Function_int Function %40 + %param = OpVariable %_ptr_Function_int Function %40 + %param_1 = OpVariable %_ptr_Function_int Function %40 + %param_2 = OpVariable %_ptr_Function_int Function %40 + %param_3 = OpVariable %_ptr_Function_int Function %40 + %71 = OpLoad %int %h + %72 = OpAccessChain %_ptr_Private_int %obj %uint_0 %71 + %73 = OpLoad %int %72 + OpStore %pivot %73 + %75 = OpLoad %int %l + %77 = OpISub %int %75 %int_1 + OpStore %i_1 %77 + %79 = OpLoad %int %l + OpStore %j_1 %79 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %int %j_1 + %86 = OpLoad %int %h + %87 = OpISub %int %86 %int_1 + %88 = OpSLessThanEqual %bool %84 %87 + OpSelectionMerge %90 None + OpBranchConditional %88 %91 %92 + %91 = OpLabel + OpBranch %90 + %92 = OpLabel + OpBranch %81 + %90 = OpLabel + %93 = OpLoad %int %j_1 + %94 = OpAccessChain %_ptr_Private_int %obj %uint_0 %93 + %95 = OpLoad %int %94 + %96 = OpLoad %int %pivot + %97 = OpSLessThanEqual %bool %95 %96 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + %100 = OpLoad %int %i_1 + %101 = OpIAdd %int %100 %int_1 + OpStore %i_1 %101 + %102 = OpLoad %int %i_1 + OpStore %param %102 + %103 = OpLoad %int %j_1 + OpStore %param_1 %103 + %104 = OpFunctionCall %void %swap_i1_i1_ %param %param_1 + OpBranch %98 + %98 = OpLabel + OpBranch %82 + %82 = OpLabel + %107 = OpLoad %int %j_1 + %108 = OpIAdd %int %107 %int_1 + OpStore %j_1 %108 + OpBranch %80 + %81 = OpLabel + %109 = OpLoad %int %i_1 + %110 = OpIAdd %int %109 %int_1 + OpStore %param_2 %110 + %112 = OpLoad %int %h + OpStore %param_3 %112 + %113 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3 + %116 = OpLoad %int %i_1 + %117 = OpIAdd %int %116 %int_1 + OpReturnValue %117 + OpFunctionEnd + %quicksort_ = OpFunction %void None %118 + %120 = OpLabel + %l_1 = OpVariable %_ptr_Function_int Function %40 + %h_1 = OpVariable %_ptr_Function_int Function %40 + %top = OpVariable %_ptr_Function_int Function %40 + %stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %126 + %p = OpVariable %_ptr_Function_int Function %40 + %param_4 = OpVariable %_ptr_Function_int Function %40 + %param_5 = OpVariable %_ptr_Function_int Function %40 + OpStore %l_1 %int_0 + OpStore %h_1 %int_9 + OpStore %top %int_n1 + %133 = OpLoad %int %top + %134 = OpIAdd %int %133 %int_1 + OpStore %top %134 + %135 = OpLoad %int %l_1 + %136 = OpAccessChain %_ptr_Function_int %stack %134 + OpStore %136 %135 + %137 = OpLoad %int %top + %138 = OpIAdd %int %137 %int_1 + OpStore %top %138 + %139 = OpLoad %int %h_1 + %140 = OpAccessChain %_ptr_Function_int %stack %138 + OpStore %140 %139 + OpBranch %141 + %141 = OpLabel + OpLoopMerge %142 %143 None + OpBranch %144 + %144 = OpLabel + %145 = OpLoad %int %top + %146 = OpSGreaterThanEqual %bool %145 %int_0 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %149 + %148 = OpLabel + OpBranch %147 + %149 = OpLabel + OpBranch %142 + %147 = OpLabel + %150 = OpLoad %int %top + %151 = OpISub %int %150 %int_1 + OpStore %top %151 + %152 = OpAccessChain %_ptr_Function_int %stack %150 + %153 = OpLoad %int %152 + OpStore %h_1 %153 + %154 = OpLoad %int %top + %155 = OpISub %int %154 %int_1 + OpStore %top %155 + %156 = OpAccessChain %_ptr_Function_int %stack %154 + %157 = OpLoad %int %156 + OpStore %l_1 %157 + %158 = OpLoad %int %l_1 + OpStore %param_4 %158 + %159 = OpLoad %int %h_1 + OpStore %param_5 %159 + %160 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5 + OpStore %p %160 + %163 = OpLoad %int %p + %164 = OpLoad %int %l_1 + %165 = OpISub %int %163 %int_1 + %166 = OpSGreaterThan %bool %165 %164 + OpSelectionMerge %167 None + OpBranchConditional %166 %168 %167 + %168 = OpLabel + %169 = OpLoad %int %top + %170 = OpIAdd %int %169 %int_1 + OpStore %top %170 + %171 = OpLoad %int %l_1 + %172 = OpAccessChain %_ptr_Function_int %stack %170 + OpStore %172 %171 + %173 = OpLoad %int %top + %174 = OpIAdd %int %173 %int_1 + OpStore %top %174 + %175 = OpLoad %int %p + %176 = OpAccessChain %_ptr_Function_int %stack %174 + %177 = OpISub %int %175 %int_1 + OpStore %176 %177 + OpBranch %167 + %167 = OpLabel + %178 = OpLoad %int %p + %179 = OpLoad %int %h_1 + %180 = OpIAdd %int %178 %int_1 + %181 = OpSLessThan %bool %180 %179 + OpSelectionMerge %182 None + OpBranchConditional %181 %183 %182 + %183 = OpLabel + %184 = OpLoad %int %top + %185 = OpIAdd %int %184 %int_1 + OpStore %top %185 + %186 = OpLoad %int %p + %187 = OpAccessChain %_ptr_Function_int %stack %185 + %188 = OpIAdd %int %186 %int_1 + OpStore %187 %188 + %189 = OpLoad %int %top + %190 = OpIAdd %int %189 %int_1 + OpStore %top %190 + %191 = OpLoad %int %h_1 + %192 = OpAccessChain %_ptr_Function_int %stack %190 + OpStore %192 %191 + OpBranch %182 + %182 = OpLabel + OpBranch %143 + %143 = OpLabel + OpBranch %141 + %142 = OpLabel + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %118 + %194 = OpLabel + %i_2 = OpVariable %_ptr_Function_int Function %40 + %uv = OpVariable %_ptr_Function_v2float Function %198 + %color = OpVariable %_ptr_Function_v3float Function %202 + %203 = OpLoad %v4float %x_GLF_pos + %207 = OpFAdd %v4float %203 %206 + %210 = OpFMul %v4float %207 %209 + OpStore %x_GLF_FragCoord %210 + OpStore %i_2 %int_0 + OpBranch %211 + %211 = OpLabel + OpLoopMerge %212 %213 None + OpBranch %214 + %214 = OpLabel + %215 = OpLoad %int %i_2 + %217 = OpSLessThan %bool %215 %int_10 + OpSelectionMerge %218 None + OpBranchConditional %217 %219 %220 + %219 = OpLabel + OpBranch %218 + %220 = OpLabel + OpBranch %212 + %218 = OpLabel + %221 = OpLoad %int %i_2 + %222 = OpLoad %int %i_2 + %223 = OpAccessChain %_ptr_Private_int %obj %uint_0 %221 + %224 = OpISub %int %int_10 %222 + OpStore %223 %224 + %225 = OpLoad %int %i_2 + %226 = OpLoad %int %i_2 + %227 = OpAccessChain %_ptr_Private_int %obj %uint_0 %226 + %228 = OpLoad %int %227 + %229 = OpLoad %int %i_2 + %230 = OpAccessChain %_ptr_Private_int %obj %uint_0 %229 + %231 = OpLoad %int %230 + %232 = OpAccessChain %_ptr_Private_int %obj %uint_0 %225 + %233 = OpIMul %int %228 %231 + OpStore %232 %233 + OpBranch %213 + %213 = OpLabel + %234 = OpLoad %int %i_2 + %235 = OpIAdd %int %234 %int_1 + OpStore %i_2 %235 + OpBranch %211 + %212 = OpLabel + %236 = OpFunctionCall %void %quicksort_ + %237 = OpLoad %v4float %x_GLF_FragCoord + %239 = OpAccessChain %_ptr_Uniform_v2float %x_34 %uint_0 + %240 = OpLoad %v2float %239 + %241 = OpCompositeExtract %float %237 0 + %242 = OpCompositeExtract %float %237 1 + %243 = OpCompositeConstruct %v2float %241 %242 + %244 = OpFDiv %v2float %243 %240 + OpStore %uv %244 + OpStore %color %247 + %248 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0 + %249 = OpLoad %int %248 + %251 = OpAccessChain %_ptr_Function_float %color %uint_0 + %252 = OpLoad %float %251 + %253 = OpAccessChain %_ptr_Function_float %color %uint_0 + %254 = OpConvertSToF %float %249 + %255 = OpFAdd %float %252 %254 + OpStore %253 %255 + %256 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %257 = OpLoad %float %256 + %259 = OpFOrdGreaterThan %bool %257 %float_0_25 + OpSelectionMerge %260 None + OpBranchConditional %259 %261 %260 + %261 = OpLabel + %262 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_1 + %263 = OpLoad %int %262 + %264 = OpAccessChain %_ptr_Function_float %color %uint_0 + %265 = OpLoad %float %264 + %266 = OpAccessChain %_ptr_Function_float %color %uint_0 + %267 = OpConvertSToF %float %263 + %268 = OpFAdd %float %265 %267 + OpStore %266 %268 + OpBranch %260 + %260 = OpLabel + %269 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %270 = OpLoad %float %269 + %272 = OpFOrdGreaterThan %bool %270 %float_0_5 + OpSelectionMerge %273 None + OpBranchConditional %272 %274 %273 + %274 = OpLabel + %277 = OpAccessChain %_ptr_Uniform_float %x_37 %uint_0 %uint_1 + %278 = OpLoad %float %277 + %282 = OpConvertFToS %int %278 + %283 = OpIMul %int %int_2 %282 + %279 = OpExtInst %int %280 SMax %283 %int_2 + %284 = OpAccessChain %_ptr_Private_int %obj %uint_0 %279 + %285 = OpLoad %int %284 + %286 = OpAccessChain %_ptr_Uniform_float %x_37 %uint_0 %uint_1 + %287 = OpLoad %float %286 + %289 = OpConvertFToS %int %287 + %290 = OpIMul %int %int_2 %289 + %288 = OpExtInst %int %280 SMax %290 %int_2 + %291 = OpAccessChain %_ptr_Private_int %obj %uint_0 %288 + %292 = OpLoad %int %291 + %293 = OpAccessChain %_ptr_Function_float %color %uint_1 + %294 = OpLoad %float %293 + %295 = OpAccessChain %_ptr_Function_float %color %uint_1 + %297 = OpConvertSToF %float %285 + %298 = OpConvertSToF %float %292 + %296 = OpExtInst %float %280 NMax %297 %298 + %299 = OpFAdd %float %294 %296 + OpStore %295 %299 + OpBranch %273 + %273 = OpLabel + %300 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %301 = OpLoad %float %300 + %303 = OpFOrdGreaterThan %bool %301 %float_0_75 + OpSelectionMerge %304 None + OpBranchConditional %303 %305 %304 + %305 = OpLabel + %307 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_3 + %308 = OpLoad %int %307 + %310 = OpAccessChain %_ptr_Function_float %color %uint_2 + %311 = OpLoad %float %310 + %312 = OpAccessChain %_ptr_Function_float %color %uint_2 + %313 = OpConvertSToF %float %308 + %314 = OpFAdd %float %311 %313 + OpStore %312 %314 + OpBranch %304 + %304 = OpLabel + %316 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4 + %317 = OpLoad %int %316 + %318 = OpAccessChain %_ptr_Function_float %color %uint_1 + %319 = OpLoad %float %318 + %320 = OpAccessChain %_ptr_Function_float %color %uint_1 + %321 = OpConvertSToF %float %317 + %322 = OpFAdd %float %319 %321 + OpStore %320 %322 + %323 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %324 = OpLoad %float %323 + %325 = OpFOrdGreaterThan %bool %324 %float_0_25 + OpSelectionMerge %326 None + OpBranchConditional %325 %327 %326 + %327 = OpLabel + %329 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_5 + %330 = OpLoad %int %329 + %331 = OpAccessChain %_ptr_Function_float %color %uint_0 + %332 = OpLoad %float %331 + %333 = OpAccessChain %_ptr_Function_float %color %uint_0 + %334 = OpConvertSToF %float %330 + %335 = OpFAdd %float %332 %334 + OpStore %333 %335 + OpBranch %326 + %326 = OpLabel + %336 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %337 = OpLoad %float %336 + %338 = OpFOrdGreaterThan %bool %337 %float_0_5 + OpSelectionMerge %339 None + OpBranchConditional %338 %340 %339 + %340 = OpLabel + %342 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_6 + %343 = OpLoad %int %342 + %344 = OpAccessChain %_ptr_Function_float %color %uint_1 + %345 = OpLoad %float %344 + %346 = OpAccessChain %_ptr_Function_float %color %uint_1 + %347 = OpConvertSToF %float %343 + %348 = OpFAdd %float %345 %347 + OpStore %346 %348 + OpBranch %339 + %339 = OpLabel + %349 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %350 = OpLoad %float %349 + %351 = OpFOrdGreaterThan %bool %350 %float_0_75 + OpSelectionMerge %352 None + OpBranchConditional %351 %353 %352 + %353 = OpLabel + %355 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_7 + %356 = OpLoad %int %355 + %357 = OpAccessChain %_ptr_Function_float %color %uint_2 + %358 = OpLoad %float %357 + %359 = OpAccessChain %_ptr_Function_float %color %uint_2 + %360 = OpConvertSToF %float %356 + %361 = OpFAdd %float %358 %360 + OpStore %359 %361 + OpBranch %352 + %352 = OpLabel + %363 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_8 + %364 = OpLoad %int %363 + %365 = OpAccessChain %_ptr_Function_float %color %uint_2 + %366 = OpLoad %float %365 + %367 = OpAccessChain %_ptr_Function_float %color %uint_2 + %368 = OpConvertSToF %float %364 + %369 = OpFAdd %float %366 %368 + OpStore %367 %369 + %370 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %371 = OpLoad %float %370 + %372 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %373 = OpLoad %float %372 + %375 = OpFSub %float %371 %373 + %374 = OpExtInst %float %280 FAbs %375 + %376 = OpFOrdLessThan %bool %374 %float_0_25 + OpSelectionMerge %377 None + OpBranchConditional %376 %378 %377 + %378 = OpLabel + %379 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_9 + %380 = OpLoad %int %379 + %381 = OpAccessChain %_ptr_Function_float %color %uint_0 + %382 = OpLoad %float %381 + %383 = OpAccessChain %_ptr_Function_float %color %uint_0 + %384 = OpConvertSToF %float %380 + %385 = OpFAdd %float %382 %384 + OpStore %383 %385 + OpBranch %377 + %377 = OpLabel + %386 = OpLoad %v3float %color + %387 = OpExtInst %v3float %280 Normalize %386 + %388 = OpCompositeExtract %float %387 0 + %389 = OpCompositeExtract %float %387 1 + %390 = OpCompositeExtract %float %387 2 + %391 = OpCompositeConstruct %v4float %388 %389 %390 %float_1 + OpStore %frag_color %391 + %392 = OpLoad %v4float %x_GLF_pos + OpStore %gl_Position %392 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %393 +%tint_symbol_1 = OpFunctionParameter %main_out + %397 = OpLabel + %398 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %398 + %399 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %399 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %118 + %401 = OpLabel + OpStore %tint_pointsize %float_1 + %402 = OpLoad %v4float %tint_symbol + OpStore %x_GLF_pos %402 + %403 = OpFunctionCall %void %main_1 + %405 = OpLoad %v4float %frag_color + %406 = OpLoad %v4float %gl_Position + %407 = OpCompositeConstruct %main_out %405 %406 + %404 = OpFunctionCall %void %tint_symbol_4 %407 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d6cec0304 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.wgsl @@ -0,0 +1,274 @@ +struct QuicksortObject { + numbers : array; +}; + +[[block]] +struct buf1 { + resolution : vec2; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var obj : QuicksortObject; + +var x_GLF_FragCoord : vec4; + +var x_GLF_pos : vec4; + +[[group(0), binding(1)]] var x_34 : buf1; + +[[group(0), binding(0)]] var x_37 : buf0; + +var frag_color : vec4; + +var gl_Position : vec4; + +fn swap_i1_i1_(i : ptr, j : ptr) { + var temp : i32; + let x_257 : i32 = *(i); + let x_259 : i32 = obj.numbers[x_257]; + temp = x_259; + let x_260 : i32 = *(i); + let x_261 : i32 = *(j); + let x_263 : i32 = obj.numbers[x_261]; + obj.numbers[x_260] = x_263; + let x_265 : i32 = *(j); + let x_266 : i32 = temp; + obj.numbers[x_265] = x_266; + return; +} + +fn performPartition_i1_i1_(l : ptr, h : ptr) -> i32 { + var pivot : i32; + var i_1 : i32; + var j_1 : i32; + var param : i32; + var param_1 : i32; + var param_2 : i32; + var param_3 : i32; + let x_269 : i32 = *(h); + let x_271 : i32 = obj.numbers[x_269]; + pivot = x_271; + let x_272 : i32 = *(l); + i_1 = (x_272 - 1); + let x_274 : i32 = *(l); + j_1 = x_274; + loop { + let x_279 : i32 = j_1; + let x_280 : i32 = *(h); + if ((x_279 <= (x_280 - 1))) { + } else { + break; + } + let x_284 : i32 = j_1; + let x_286 : i32 = obj.numbers[x_284]; + let x_287 : i32 = pivot; + if ((x_286 <= x_287)) { + let x_291 : i32 = i_1; + i_1 = (x_291 + 1); + let x_293 : i32 = i_1; + param = x_293; + let x_294 : i32 = j_1; + param_1 = x_294; + swap_i1_i1_(&(param), &(param_1)); + } + + continuing { + let x_296 : i32 = j_1; + j_1 = (x_296 + 1); + } + } + let x_298 : i32 = i_1; + param_2 = (x_298 + 1); + let x_300 : i32 = *(h); + param_3 = x_300; + swap_i1_i1_(&(param_2), &(param_3)); + let x_302 : i32 = i_1; + return (x_302 + 1); +} + +fn quicksort_() { + var l_1 : i32; + var h_1 : i32; + var top : i32; + var stack : array; + var p : i32; + var param_4 : i32; + var param_5 : i32; + l_1 = 0; + h_1 = 9; + top = -1; + let x_305 : i32 = top; + let x_306 : i32 = (x_305 + 1); + top = x_306; + let x_307 : i32 = l_1; + stack[x_306] = x_307; + let x_309 : i32 = top; + let x_310 : i32 = (x_309 + 1); + top = x_310; + let x_311 : i32 = h_1; + stack[x_310] = x_311; + loop { + let x_317 : i32 = top; + if ((x_317 >= 0)) { + } else { + break; + } + let x_320 : i32 = top; + top = (x_320 - 1); + let x_323 : i32 = stack[x_320]; + h_1 = x_323; + let x_324 : i32 = top; + top = (x_324 - 1); + let x_327 : i32 = stack[x_324]; + l_1 = x_327; + let x_328 : i32 = l_1; + param_4 = x_328; + let x_329 : i32 = h_1; + param_5 = x_329; + let x_330 : i32 = performPartition_i1_i1_(&(param_4), &(param_5)); + p = x_330; + let x_331 : i32 = p; + let x_333 : i32 = l_1; + if (((x_331 - 1) > x_333)) { + let x_337 : i32 = top; + let x_338 : i32 = (x_337 + 1); + top = x_338; + let x_339 : i32 = l_1; + stack[x_338] = x_339; + let x_341 : i32 = top; + let x_342 : i32 = (x_341 + 1); + top = x_342; + let x_343 : i32 = p; + stack[x_342] = (x_343 - 1); + } + let x_346 : i32 = p; + let x_348 : i32 = h_1; + if (((x_346 + 1) < x_348)) { + let x_352 : i32 = top; + let x_353 : i32 = (x_352 + 1); + top = x_353; + let x_354 : i32 = p; + stack[x_353] = (x_354 + 1); + let x_357 : i32 = top; + let x_358 : i32 = (x_357 + 1); + top = x_358; + let x_359 : i32 = h_1; + stack[x_358] = x_359; + } + } + return; +} + +fn main_1() { + var i_2 : i32; + var uv : vec2; + var color : vec3; + let x_94 : vec4 = x_GLF_pos; + x_GLF_FragCoord = ((x_94 + vec4(1.0, 1.0, 0.0, 0.0)) * vec4(128.0, 128.0, 1.0, 1.0)); + i_2 = 0; + loop { + let x_101 : i32 = i_2; + if ((x_101 < 10)) { + } else { + break; + } + let x_104 : i32 = i_2; + let x_105 : i32 = i_2; + obj.numbers[x_104] = (10 - x_105); + let x_108 : i32 = i_2; + let x_109 : i32 = i_2; + let x_111 : i32 = obj.numbers[x_109]; + let x_112 : i32 = i_2; + let x_114 : i32 = obj.numbers[x_112]; + obj.numbers[x_108] = (x_111 * x_114); + + continuing { + let x_117 : i32 = i_2; + i_2 = (x_117 + 1); + } + } + quicksort_(); + let x_120 : vec4 = x_GLF_FragCoord; + let x_123 : vec2 = x_34.resolution; + uv = (vec2(x_120.x, x_120.y) / x_123); + color = vec3(1.0, 2.0, 3.0); + let x_126 : i32 = obj.numbers[0]; + let x_129 : f32 = color.x; + color.x = (x_129 + f32(x_126)); + let x_133 : f32 = uv.x; + if ((x_133 > 0.25)) { + let x_138 : i32 = obj.numbers[1]; + let x_141 : f32 = color.x; + color.x = (x_141 + f32(x_138)); + } + let x_145 : f32 = uv.x; + if ((x_145 > 0.5)) { + let x_150 : f32 = x_37.injectionSwitch.y; + let x_155 : i32 = obj.numbers[max((2 * i32(x_150)), 2)]; + let x_158 : f32 = x_37.injectionSwitch.y; + let x_163 : i32 = obj.numbers[max((2 * i32(x_158)), 2)]; + let x_167 : f32 = color.y; + color.y = (x_167 + max(f32(x_155), f32(x_163))); + } + let x_171 : f32 = uv.x; + if ((x_171 > 0.75)) { + let x_176 : i32 = obj.numbers[3]; + let x_179 : f32 = color.z; + color.z = (x_179 + f32(x_176)); + } + let x_183 : i32 = obj.numbers[4]; + let x_186 : f32 = color.y; + color.y = (x_186 + f32(x_183)); + let x_190 : f32 = uv.y; + if ((x_190 > 0.25)) { + let x_195 : i32 = obj.numbers[5]; + let x_198 : f32 = color.x; + color.x = (x_198 + f32(x_195)); + } + let x_202 : f32 = uv.y; + if ((x_202 > 0.5)) { + let x_207 : i32 = obj.numbers[6]; + let x_210 : f32 = color.y; + color.y = (x_210 + f32(x_207)); + } + let x_214 : f32 = uv.y; + if ((x_214 > 0.75)) { + let x_219 : i32 = obj.numbers[7]; + let x_222 : f32 = color.z; + color.z = (x_222 + f32(x_219)); + } + let x_226 : i32 = obj.numbers[8]; + let x_229 : f32 = color.z; + color.z = (x_229 + f32(x_226)); + let x_233 : f32 = uv.x; + let x_235 : f32 = uv.y; + if ((abs((x_233 - x_235)) < 0.25)) { + let x_242 : i32 = obj.numbers[9]; + let x_245 : f32 = color.x; + color.x = (x_245 + f32(x_242)); + } + let x_248 : vec3 = color; + let x_249 : vec3 = normalize(x_248); + frag_color = vec4(x_249.x, x_249.y, x_249.z, 1.0); + let x_254 : vec4 = x_GLF_pos; + gl_Position = x_254; + return; +} + +struct main_out { + [[location(0)]] + frag_color_1 : vec4; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_GLF_pos_param : vec4) -> main_out { + x_GLF_pos = x_GLF_pos_param; + main_1(); + return main_out(frag_color, gl_Position); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm new file mode 100644 index 0000000000..f72cf88e66 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm @@ -0,0 +1,284 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %collision_vf2_vf4_ "collision(vf2;vf4;" + OpName %pos "pos" + OpName %quad "quad" + OpName %match_vf2_ "match(vf2;" + OpName %pos_0 "pos" + OpName %res "res" + OpName %gl_FragCoord "gl_FragCoord" + OpName %i "i" + OpName %param "param" + OpName %param_0 "param" + OpName %indexable "indexable" + OpName %indexable_0 "indexable" + OpName %indexable_1 "indexable" + OpName %indexable_2 "indexable" + OpName %lin "lin" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %param_1 "param" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool + %30 = OpTypeFunction %bool %_ptr_Function_v2float %_ptr_Function_v4float + %31 = OpTypeFunction %v4float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %float_0_5 = OpConstant %float 0.5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %float_n1 = OpConstant %float -1 + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_8 = OpConstant %int 8 + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %54 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %55 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %56 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %58 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %61 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %63 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %65 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %67 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %68 = OpConstantComposite %_arr_v4float_uint_8 %54 %55 %56 %58 %61 %63 %65 %67 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 + %72 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %73 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %74 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %75 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %76 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %77 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %78 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %79 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %80 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %81 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %82 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %83 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %84 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %85 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %86 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %87 = OpConstantComposite %_arr_v4float_uint_16 %72 %73 %74 %75 %76 %77 %78 %79 %72 %80 %81 %82 %83 %84 %85 %86 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %int_1 = OpConstant %int 1 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %23 + %97 = OpLabel + %lin = OpVariable %_ptr_Function_v2float Function + %param_1 = OpVariable %_ptr_Function_v2float Function + %98 = OpLoad %v4float %gl_FragCoord + %99 = OpVectorShuffle %v2float %98 %98 0 1 + %100 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %101 = OpLoad %v2float %100 + %102 = OpFDiv %v2float %99 %101 + OpStore %lin %102 + %103 = OpLoad %v2float %lin + %104 = OpVectorTimesScalar %v2float %103 %float_32 + %105 = OpExtInst %v2float %1 Floor %104 + OpStore %lin %105 + %106 = OpLoad %v2float %lin + OpStore %param_1 %106 + %107 = OpFunctionCall %v4float %match_vf2_ %param_1 + OpStore %_GLF_color %107 + OpReturn + OpFunctionEnd +%collision_vf2_vf4_ = OpFunction %bool None %30 + %pos = OpFunctionParameter %_ptr_Function_v2float + %quad = OpFunctionParameter %_ptr_Function_v4float + %108 = OpLabel + %109 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %110 = OpLoad %float %109 + %111 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %112 = OpLoad %float %111 + %113 = OpFOrdLessThan %bool %110 %112 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %114 + %115 = OpLabel + OpReturnValue %false + %114 = OpLabel + %116 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %117 = OpLoad %float %116 + %118 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %119 = OpLoad %float %118 + %120 = OpFOrdLessThan %bool %117 %119 + OpSelectionMerge %121 None + OpBranchConditional %120 %122 %121 + %122 = OpLabel + OpReturnValue %false + %121 = OpLabel + %123 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %124 = OpLoad %float %123 + %125 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %126 = OpLoad %float %125 + %127 = OpAccessChain %_ptr_Function_float %quad %uint_2 + %128 = OpLoad %float %127 + %129 = OpFAdd %float %126 %128 + %130 = OpFOrdGreaterThan %bool %124 %129 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %131 + %132 = OpLabel + OpReturnValue %false + %131 = OpLabel + %133 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %134 = OpLoad %float %133 + %135 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %136 = OpLoad %float %135 + %137 = OpAccessChain %_ptr_Function_float %quad %uint_3 + %138 = OpLoad %float %137 + %139 = OpFAdd %float %136 %138 + %140 = OpFOrdGreaterThan %bool %134 %139 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + OpReturnValue %false + %141 = OpLabel + OpReturnValue %true + OpFunctionEnd + %match_vf2_ = OpFunction %v4float None %31 + %pos_0 = OpFunctionParameter %_ptr_Function_v2float + %143 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function + %144 = OpVariable %_ptr_Function_float Function + %145 = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_v2float Function + %param_0 = OpVariable %_ptr_Function_v4float Function + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_8 Function +%indexable_0 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function +%indexable_1 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function +%indexable_2 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function + %146 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %147 = OpLoad %float %146 + %148 = OpFOrdLessThan %bool %147 %float_0 + OpSelectionMerge %149 None + OpBranchConditional %148 %150 %151 + %150 = OpLabel + OpStore %144 %float_n1 + OpBranch %149 + %151 = OpLabel + %152 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %153 = OpLoad %float %152 + %154 = OpFOrdGreaterThanEqual %bool %153 %float_0 + OpSelectionMerge %155 None + OpBranchConditional %154 %156 %157 + %156 = OpLabel + %158 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %159 = OpLoad %float %158 + %160 = OpFOrdGreaterThanEqual %bool %159 %float_0 + %161 = OpSelect %float %160 %float_0_5 %float_1 + OpStore %145 %161 + OpBranch %155 + %157 = OpLabel + OpStore %145 %float_1 + OpBranch %155 + %155 = OpLabel + %162 = OpLoad %float %145 + %163 = OpExtInst %float %1 FMin %162 %float_0_5 + OpStore %144 %163 + OpBranch %149 + %149 = OpLabel + %164 = OpLoad %float %144 + %165 = OpExtInst %float %1 FClamp %float_0_5 %float_0_5 %164 + %166 = OpCompositeConstruct %v4float %165 %float_0_5 %float_1 %float_1 + OpStore %res %166 + OpStore %i %int_0 + OpBranch %167 + %167 = OpLabel + OpLoopMerge %168 %169 None + OpBranch %170 + %170 = OpLabel + %171 = OpLoad %int %i + %172 = OpSLessThan %bool %171 %int_8 + OpBranchConditional %172 %173 %168 + %173 = OpLabel + %174 = OpLoad %int %i + %175 = OpLoad %v2float %pos_0 + OpStore %param %175 + OpStore %indexable %68 + %176 = OpAccessChain %_ptr_Function_v4float %indexable %174 + %177 = OpLoad %v4float %176 + OpStore %param_0 %177 + %178 = OpFunctionCall %bool %collision_vf2_vf4_ %param %param_0 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %179 + %180 = OpLabel + %181 = OpLoad %int %i + OpStore %indexable_0 %68 + %182 = OpAccessChain %_ptr_Function_float %indexable_0 %181 %uint_0 + %183 = OpLoad %float %182 + %184 = OpConvertFToS %int %183 + %185 = OpLoad %int %i + OpStore %indexable_1 %68 + %186 = OpAccessChain %_ptr_Function_float %indexable_1 %185 %uint_1 + %187 = OpLoad %float %186 + %188 = OpConvertFToS %int %187 + %189 = OpIMul %int %184 %188 + %190 = OpLoad %int %i + %191 = OpIMul %int %190 %int_9 + %192 = OpIAdd %int %189 %191 + %193 = OpIAdd %int %192 %int_11 + %194 = OpSMod %int %193 %int_16 + OpStore %indexable_2 %87 + %195 = OpAccessChain %_ptr_Function_v4float %indexable_2 %194 + %196 = OpLoad %v4float %195 + OpStore %res %196 + OpBranch %179 + %179 = OpLabel + OpBranch %169 + %169 = OpLabel + %197 = OpLoad %int %i + %198 = OpIAdd %int %197 %int_1 + OpStore %i %198 + OpBranch %167 + %168 = OpLabel + %199 = OpLoad %v4float %res + OpReturnValue %199 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..69f3fe68ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.hlsl @@ -0,0 +1,119 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_20 : register(b0, space0) { + uint4 x_20[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +bool collision_vf2_vf4_(inout float2 pos, inout float4 quad) { + const float x_110 = pos.x; + const float x_112 = quad.x; + if ((x_110 < x_112)) { + return false; + } + const float x_117 = pos.y; + const float x_119 = quad.y; + if ((x_117 < x_119)) { + return false; + } + const float x_124 = pos.x; + const float x_126 = quad.x; + const float x_128 = quad.z; + if ((x_124 > (x_126 + x_128))) { + return false; + } + const float x_134 = pos.y; + const float x_136 = quad.y; + const float x_138 = quad.w; + if ((x_134 > (x_136 + x_138))) { + return false; + } + return true; +} + +float4 match_vf2_(inout float2 pos_1) { + float4 res = float4(0.0f, 0.0f, 0.0f, 0.0f); + float x_144 = 0.0f; + float x_145 = 0.0f; + int i = 0; + float2 param = float2(0.0f, 0.0f); + float4 param_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 indexable[8] = (float4[8])0; + float4 indexable_1[8] = (float4[8])0; + float4 indexable_2[8] = (float4[8])0; + float4 indexable_3[16] = (float4[16])0; + const float x_147 = gl_FragCoord.x; + if ((x_147 < 0.0f)) { + x_144 = -1.0f; + } else { + const float x_153 = gl_FragCoord.x; + if ((x_153 >= 0.0f)) { + const float x_159 = gl_FragCoord.x; + x_145 = ((x_159 >= 0.0f) ? 0.5f : 1.0f); + } else { + x_145 = 1.0f; + } + x_144 = min(x_145, 0.5f); + } + res = float4(clamp(0.5f, 0.5f, x_144), 0.5f, 1.0f, 1.0f); + i = 0; + { + for(; (i < 8); i = (i + 1)) { + const int x_174 = i; + const float2 x_175 = pos_1; + param = x_175; + const float4 tint_symbol_5[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable = tint_symbol_5; + const float4 x_177 = indexable[x_174]; + param_1 = x_177; + const bool x_178 = collision_vf2_vf4_(param, param_1); + if (x_178) { + const int x_181 = i; + const float4 tint_symbol_6[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable_1 = tint_symbol_6; + const float x_183 = indexable_1[x_181].x; + const int x_185 = i; + const float4 tint_symbol_7[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable_2 = tint_symbol_7; + const float x_187 = indexable_2[x_185].y; + const int x_190 = i; + const float4 tint_symbol_8[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable_3 = tint_symbol_8; + const float4 x_196 = indexable_3[((((int(x_183) * int(x_187)) + (x_190 * 9)) + 11) % 16)]; + res = x_196; + } + } + } + return res; +} + +void main_1() { + float2 lin = float2(0.0f, 0.0f); + float2 param_2 = float2(0.0f, 0.0f); + const float4 x_98 = gl_FragCoord; + const float2 x_101 = asfloat(x_20[0].xy); + lin = (float2(x_98.x, x_98.y) / x_101); + lin = floor((lin * 32.0f)); + param_2 = lin; + const float4 x_107 = match_vf2_(param_2); + x_GLF_color = x_107; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.msl new file mode 100644 index 0000000000..840a67c981 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.msl @@ -0,0 +1,136 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[8]; +}; +struct tint_array_wrapper_1 { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +bool collision_vf2_vf4_(thread float2* const pos, thread float4* const quad) { + float const x_110 = (*(pos)).x; + float const x_112 = (*(quad)).x; + if ((x_110 < x_112)) { + return false; + } + float const x_117 = (*(pos)).y; + float const x_119 = (*(quad)).y; + if ((x_117 < x_119)) { + return false; + } + float const x_124 = (*(pos)).x; + float const x_126 = (*(quad)).x; + float const x_128 = (*(quad)).z; + if ((x_124 > (x_126 + x_128))) { + return false; + } + float const x_134 = (*(pos)).y; + float const x_136 = (*(quad)).y; + float const x_138 = (*(quad)).w; + if ((x_134 > (x_136 + x_138))) { + return false; + } + return true; +} + +float4 match_vf2_(thread float2* const pos_1, thread float4* const tint_symbol_9) { + float4 res = 0.0f; + float x_144 = 0.0f; + float x_145 = 0.0f; + int i = 0; + float2 param = 0.0f; + float4 param_1 = 0.0f; + tint_array_wrapper indexable = {}; + tint_array_wrapper indexable_1 = {}; + tint_array_wrapper indexable_2 = {}; + tint_array_wrapper_1 indexable_3 = {}; + float const x_147 = (*(tint_symbol_9)).x; + if ((x_147 < 0.0f)) { + x_144 = -1.0f; + } else { + float const x_153 = (*(tint_symbol_9)).x; + if ((x_153 >= 0.0f)) { + float const x_159 = (*(tint_symbol_9)).x; + x_145 = select(1.0f, 0.5f, (x_159 >= 0.0f)); + } else { + x_145 = 1.0f; + } + float const x_162 = x_145; + x_144 = fmin(x_162, 0.5f); + } + float const x_164 = x_144; + res = float4(clamp(0.5f, 0.5f, x_164), 0.5f, 1.0f, 1.0f); + i = 0; + while (true) { + int const x_171 = i; + if ((x_171 < 8)) { + } else { + break; + } + int const x_174 = i; + float2 const x_175 = *(pos_1); + param = x_175; + tint_array_wrapper const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable = tint_symbol_4; + float4 const x_177 = indexable.arr[x_174]; + param_1 = x_177; + bool const x_178 = collision_vf2_vf4_(&(param), &(param_1)); + if (x_178) { + int const x_181 = i; + tint_array_wrapper const tint_symbol_5 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable_1 = tint_symbol_5; + float const x_183 = indexable_1.arr[x_181].x; + int const x_185 = i; + tint_array_wrapper const tint_symbol_6 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable_2 = tint_symbol_6; + float const x_187 = indexable_2.arr[x_185].y; + int const x_190 = i; + tint_array_wrapper_1 const tint_symbol_7 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable_3 = tint_symbol_7; + float4 const x_196 = indexable_3.arr[((((int(x_183) * int(x_187)) + (x_190 * 9)) + 11) % 16)]; + res = x_196; + } + { + int const x_197 = i; + i = (x_197 + 1); + } + } + float4 const x_199 = res; + return x_199; +} + +void main_1(constant buf0& x_20, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) { + float2 lin = 0.0f; + float2 param_2 = 0.0f; + float4 const x_98 = *(tint_symbol_10); + float2 const x_101 = x_20.resolution; + lin = (float2(x_98.x, x_98.y) / x_101); + float2 const x_103 = lin; + lin = floor((x_103 * 32.0f)); + float2 const x_106 = lin; + param_2 = x_106; + float4 const x_107 = match_vf2_(&(param_2), tint_symbol_10); + *(tint_symbol_11) = x_107; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_20 [[buffer(0)]]) { + thread float4 tint_symbol_12 = 0.0f; + thread float4 tint_symbol_13 = 0.0f; + tint_symbol_12 = gl_FragCoord_param; + main_1(x_20, &(tint_symbol_12), &(tint_symbol_13)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..5d8773e452 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.spvasm @@ -0,0 +1,336 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 240 +; Schema: 0 + OpCapability Shader + %125 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_20 "x_20" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %collision_vf2_vf4_ "collision_vf2_vf4_" + OpName %pos "pos" + OpName %quad "quad" + OpName %match_vf2_ "match_vf2_" + OpName %pos_1 "pos_1" + OpName %res "res" + OpName %x_144 "x_144" + OpName %x_145 "x_145" + OpName %i "i" + OpName %param "param" + OpName %param_1 "param_1" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %indexable_2 "indexable_2" + OpName %indexable_3 "indexable_3" + OpName %main_1 "main_1" + OpName %lin "lin" + OpName %param_2 "param_2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_20 NonWritable + OpDecorate %x_20 DescriptorSet 0 + OpDecorate %x_20 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_8 ArrayStride 16 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_20 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %bool = OpTypeBool +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %15 = OpTypeFunction %bool %_ptr_Function_v2float %_ptr_Function_v4float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %75 = OpTypeFunction %v4float %_ptr_Function_v2float + %81 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %86 = OpConstantNull %int + %88 = OpConstantNull %v2float + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %94 = OpConstantNull %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %101 = OpConstantNull %_arr_v4float_uint_16 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %float_n1 = OpConstant %float -1 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %int_0 = OpConstant %int 0 + %int_8 = OpConstant %int 8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %145 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %146 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %147 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %149 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %152 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %154 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %156 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %158 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %159 = OpConstantComposite %_arr_v4float_uint_8 %145 %146 %147 %149 %152 %154 %156 %158 + %174 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %175 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %176 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %177 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %178 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %179 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %180 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %181 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %182 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %183 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %184 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %185 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %186 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %187 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %188 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %189 = OpConstantComposite %_arr_v4float_uint_16 %174 %175 %176 %177 %178 %179 %180 %181 %174 %182 %183 %184 %185 %186 %187 %188 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %206 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 + %main_out = OpTypeStruct %v4float + %227 = OpTypeFunction %void %main_out +%collision_vf2_vf4_ = OpFunction %bool None %15 + %pos = OpFunctionParameter %_ptr_Function_v2float + %quad = OpFunctionParameter %_ptr_Function_v4float + %22 = OpLabel + %27 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %28 = OpLoad %float %27 + %30 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %31 = OpLoad %float %30 + %32 = OpFOrdLessThan %bool %28 %31 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %33 + %34 = OpLabel + OpReturnValue %false + %33 = OpLabel + %38 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %39 = OpLoad %float %38 + %41 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %42 = OpLoad %float %41 + %43 = OpFOrdLessThan %bool %39 %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + OpReturnValue %false + %44 = OpLabel + %47 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %48 = OpLoad %float %47 + %50 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %51 = OpLoad %float %50 + %54 = OpAccessChain %_ptr_Function_float %quad %uint_2 + %55 = OpLoad %float %54 + %56 = OpFAdd %float %51 %55 + %57 = OpFOrdGreaterThan %bool %48 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + OpReturnValue %false + %58 = OpLabel + %61 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %62 = OpLoad %float %61 + %64 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %65 = OpLoad %float %64 + %68 = OpAccessChain %_ptr_Function_float %quad %uint_3 + %69 = OpLoad %float %68 + %70 = OpFAdd %float %65 %69 + %71 = OpFOrdGreaterThan %bool %62 %70 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + OpReturnValue %false + %72 = OpLabel + OpReturnValue %true + OpFunctionEnd + %match_vf2_ = OpFunction %v4float None %75 + %pos_1 = OpFunctionParameter %_ptr_Function_v2float + %78 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %x_144 = OpVariable %_ptr_Function_float Function %81 + %x_145 = OpVariable %_ptr_Function_float Function %81 + %i = OpVariable %_ptr_Function_int Function %86 + %param = OpVariable %_ptr_Function_v2float Function %88 + %param_1 = OpVariable %_ptr_Function_v4float Function %5 + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %94 +%indexable_1 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %94 +%indexable_2 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %94 +%indexable_3 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %101 + %103 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %104 = OpLoad %float %103 + %106 = OpFOrdLessThan %bool %104 %float_0 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %109 + %108 = OpLabel + OpStore %x_144 %float_n1 + OpBranch %107 + %109 = OpLabel + %111 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %112 = OpLoad %float %111 + %113 = OpFOrdGreaterThanEqual %bool %112 %float_0 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %116 + %115 = OpLabel + %117 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %118 = OpLoad %float %117 + %120 = OpFOrdGreaterThanEqual %bool %118 %float_0 + %119 = OpSelect %float %120 %float_0_5 %float_1 + OpStore %x_145 %119 + OpBranch %114 + %116 = OpLabel + OpStore %x_145 %float_1 + OpBranch %114 + %114 = OpLabel + %123 = OpLoad %float %x_145 + %124 = OpExtInst %float %125 NMin %123 %float_0_5 + OpStore %x_144 %124 + OpBranch %107 + %107 = OpLabel + %126 = OpLoad %float %x_144 + %127 = OpExtInst %float %125 NClamp %float_0_5 %float_0_5 %126 + %128 = OpCompositeConstruct %v4float %127 %float_0_5 %float_1 %float_1 + OpStore %res %128 + OpStore %i %int_0 + OpBranch %130 + %130 = OpLabel + OpLoopMerge %131 %132 None + OpBranch %133 + %133 = OpLabel + %134 = OpLoad %int %i + %136 = OpSLessThan %bool %134 %int_8 + OpSelectionMerge %137 None + OpBranchConditional %136 %138 %139 + %138 = OpLabel + OpBranch %137 + %139 = OpLabel + OpBranch %131 + %137 = OpLabel + %140 = OpLoad %int %i + %142 = OpLoad %v2float %pos_1 + OpStore %param %142 + OpStore %indexable %159 + %160 = OpAccessChain %_ptr_Function_v4float %indexable %140 + %161 = OpLoad %v4float %160 + OpStore %param_1 %161 + %162 = OpFunctionCall %bool %collision_vf2_vf4_ %param %param_1 + OpSelectionMerge %165 None + OpBranchConditional %162 %166 %165 + %166 = OpLabel + %167 = OpLoad %int %i + OpStore %indexable_1 %159 + %168 = OpAccessChain %_ptr_Function_float %indexable_1 %167 %uint_0 + %169 = OpLoad %float %168 + %170 = OpLoad %int %i + OpStore %indexable_2 %159 + %171 = OpAccessChain %_ptr_Function_float %indexable_2 %170 %uint_1 + %172 = OpLoad %float %171 + %173 = OpLoad %int %i + OpStore %indexable_3 %189 + %190 = OpConvertFToS %int %169 + %191 = OpConvertFToS %int %172 + %192 = OpIMul %int %190 %191 + %194 = OpIMul %int %173 %int_9 + %195 = OpIAdd %int %192 %194 + %197 = OpIAdd %int %195 %int_11 + %199 = OpSMod %int %197 %int_16 + %200 = OpAccessChain %_ptr_Function_v4float %indexable_3 %199 + %201 = OpLoad %v4float %200 + OpStore %res %201 + OpBranch %165 + %165 = OpLabel + OpBranch %132 + %132 = OpLabel + %202 = OpLoad %int %i + %204 = OpIAdd %int %202 %int_1 + OpStore %i %204 + OpBranch %130 + %131 = OpLabel + %205 = OpLoad %v4float %res + OpReturnValue %205 + OpFunctionEnd + %main_1 = OpFunction %void None %206 + %209 = OpLabel + %lin = OpVariable %_ptr_Function_v2float Function %88 + %param_2 = OpVariable %_ptr_Function_v2float Function %88 + %212 = OpLoad %v4float %gl_FragCoord + %214 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_0 + %215 = OpLoad %v2float %214 + %216 = OpCompositeExtract %float %212 0 + %217 = OpCompositeExtract %float %212 1 + %218 = OpCompositeConstruct %v2float %216 %217 + %219 = OpFDiv %v2float %218 %215 + OpStore %lin %219 + %220 = OpLoad %v2float %lin + %223 = OpVectorTimesScalar %v2float %220 %float_32 + %221 = OpExtInst %v2float %125 Floor %223 + OpStore %lin %221 + %224 = OpLoad %v2float %lin + OpStore %param_2 %224 + %225 = OpFunctionCall %v4float %match_vf2_ %param_2 + OpStore %x_GLF_color %225 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %227 +%tint_symbol_1 = OpFunctionParameter %main_out + %231 = OpLabel + %232 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %232 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %206 + %234 = OpLabel + %235 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %235 + %236 = OpFunctionCall %void %main_1 + %238 = OpLoad %v4float %x_GLF_color + %239 = OpCompositeConstruct %main_out %238 + %237 = OpFunctionCall %void %tint_symbol_3 %239 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..4b3b3b5674 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.spvasm.expected.wgsl @@ -0,0 +1,126 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_20 : buf0; + +var x_GLF_color : vec4; + +fn collision_vf2_vf4_(pos : ptr>, quad : ptr>) -> bool { + let x_110 : f32 = (*(pos)).x; + let x_112 : f32 = (*(quad)).x; + if ((x_110 < x_112)) { + return false; + } + let x_117 : f32 = (*(pos)).y; + let x_119 : f32 = (*(quad)).y; + if ((x_117 < x_119)) { + return false; + } + let x_124 : f32 = (*(pos)).x; + let x_126 : f32 = (*(quad)).x; + let x_128 : f32 = (*(quad)).z; + if ((x_124 > (x_126 + x_128))) { + return false; + } + let x_134 : f32 = (*(pos)).y; + let x_136 : f32 = (*(quad)).y; + let x_138 : f32 = (*(quad)).w; + if ((x_134 > (x_136 + x_138))) { + return false; + } + return true; +} + +fn match_vf2_(pos_1 : ptr>) -> vec4 { + var res : vec4; + var x_144 : f32; + var x_145 : f32; + var i : i32; + var param : vec2; + var param_1 : vec4; + var indexable : array, 8>; + var indexable_1 : array, 8>; + var indexable_2 : array, 8>; + var indexable_3 : array, 16>; + let x_147 : f32 = gl_FragCoord.x; + if ((x_147 < 0.0)) { + x_144 = -1.0; + } else { + let x_153 : f32 = gl_FragCoord.x; + if ((x_153 >= 0.0)) { + let x_159 : f32 = gl_FragCoord.x; + x_145 = select(1.0, 0.5, (x_159 >= 0.0)); + } else { + x_145 = 1.0; + } + let x_162 : f32 = x_145; + x_144 = min(x_162, 0.5); + } + let x_164 : f32 = x_144; + res = vec4(clamp(0.5, 0.5, x_164), 0.5, 1.0, 1.0); + i = 0; + loop { + let x_171 : i32 = i; + if ((x_171 < 8)) { + } else { + break; + } + let x_174 : i32 = i; + let x_175 : vec2 = *(pos_1); + param = x_175; + indexable = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_177 : vec4 = indexable[x_174]; + param_1 = x_177; + let x_178 : bool = collision_vf2_vf4_(&(param), &(param_1)); + if (x_178) { + let x_181 : i32 = i; + indexable_1 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_183 : f32 = indexable_1[x_181].x; + let x_185 : i32 = i; + indexable_2 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_187 : f32 = indexable_2[x_185].y; + let x_190 : i32 = i; + indexable_3 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_196 : vec4 = indexable_3[((((i32(x_183) * i32(x_187)) + (x_190 * 9)) + 11) % 16)]; + res = x_196; + } + + continuing { + let x_197 : i32 = i; + i = (x_197 + 1); + } + } + let x_199 : vec4 = res; + return x_199; +} + +fn main_1() { + var lin : vec2; + var param_2 : vec2; + let x_98 : vec4 = gl_FragCoord; + let x_101 : vec2 = x_20.resolution; + lin = (vec2(x_98.x, x_98.y) / x_101); + let x_103 : vec2 = lin; + lin = floor((x_103 * 32.0)); + let x_106 : vec2 = lin; + param_2 = x_106; + let x_107 : vec4 = match_vf2_(&(param_2)); + x_GLF_color = x_107; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl new file mode 100644 index 0000000000..4b3b3b5674 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl @@ -0,0 +1,126 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_20 : buf0; + +var x_GLF_color : vec4; + +fn collision_vf2_vf4_(pos : ptr>, quad : ptr>) -> bool { + let x_110 : f32 = (*(pos)).x; + let x_112 : f32 = (*(quad)).x; + if ((x_110 < x_112)) { + return false; + } + let x_117 : f32 = (*(pos)).y; + let x_119 : f32 = (*(quad)).y; + if ((x_117 < x_119)) { + return false; + } + let x_124 : f32 = (*(pos)).x; + let x_126 : f32 = (*(quad)).x; + let x_128 : f32 = (*(quad)).z; + if ((x_124 > (x_126 + x_128))) { + return false; + } + let x_134 : f32 = (*(pos)).y; + let x_136 : f32 = (*(quad)).y; + let x_138 : f32 = (*(quad)).w; + if ((x_134 > (x_136 + x_138))) { + return false; + } + return true; +} + +fn match_vf2_(pos_1 : ptr>) -> vec4 { + var res : vec4; + var x_144 : f32; + var x_145 : f32; + var i : i32; + var param : vec2; + var param_1 : vec4; + var indexable : array, 8>; + var indexable_1 : array, 8>; + var indexable_2 : array, 8>; + var indexable_3 : array, 16>; + let x_147 : f32 = gl_FragCoord.x; + if ((x_147 < 0.0)) { + x_144 = -1.0; + } else { + let x_153 : f32 = gl_FragCoord.x; + if ((x_153 >= 0.0)) { + let x_159 : f32 = gl_FragCoord.x; + x_145 = select(1.0, 0.5, (x_159 >= 0.0)); + } else { + x_145 = 1.0; + } + let x_162 : f32 = x_145; + x_144 = min(x_162, 0.5); + } + let x_164 : f32 = x_144; + res = vec4(clamp(0.5, 0.5, x_164), 0.5, 1.0, 1.0); + i = 0; + loop { + let x_171 : i32 = i; + if ((x_171 < 8)) { + } else { + break; + } + let x_174 : i32 = i; + let x_175 : vec2 = *(pos_1); + param = x_175; + indexable = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_177 : vec4 = indexable[x_174]; + param_1 = x_177; + let x_178 : bool = collision_vf2_vf4_(&(param), &(param_1)); + if (x_178) { + let x_181 : i32 = i; + indexable_1 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_183 : f32 = indexable_1[x_181].x; + let x_185 : i32 = i; + indexable_2 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_187 : f32 = indexable_2[x_185].y; + let x_190 : i32 = i; + indexable_3 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_196 : vec4 = indexable_3[((((i32(x_183) * i32(x_187)) + (x_190 * 9)) + 11) % 16)]; + res = x_196; + } + + continuing { + let x_197 : i32 = i; + i = (x_197 + 1); + } + } + let x_199 : vec4 = res; + return x_199; +} + +fn main_1() { + var lin : vec2; + var param_2 : vec2; + let x_98 : vec4 = gl_FragCoord; + let x_101 : vec2 = x_20.resolution; + lin = (vec2(x_98.x, x_98.y) / x_101); + let x_103 : vec2 = lin; + lin = floor((x_103 * 32.0)); + let x_106 : vec2 = lin; + param_2 = x_106; + let x_107 : vec4 = match_vf2_(&(param_2)); + x_GLF_color = x_107; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..69f3fe68ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.hlsl @@ -0,0 +1,119 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_20 : register(b0, space0) { + uint4 x_20[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +bool collision_vf2_vf4_(inout float2 pos, inout float4 quad) { + const float x_110 = pos.x; + const float x_112 = quad.x; + if ((x_110 < x_112)) { + return false; + } + const float x_117 = pos.y; + const float x_119 = quad.y; + if ((x_117 < x_119)) { + return false; + } + const float x_124 = pos.x; + const float x_126 = quad.x; + const float x_128 = quad.z; + if ((x_124 > (x_126 + x_128))) { + return false; + } + const float x_134 = pos.y; + const float x_136 = quad.y; + const float x_138 = quad.w; + if ((x_134 > (x_136 + x_138))) { + return false; + } + return true; +} + +float4 match_vf2_(inout float2 pos_1) { + float4 res = float4(0.0f, 0.0f, 0.0f, 0.0f); + float x_144 = 0.0f; + float x_145 = 0.0f; + int i = 0; + float2 param = float2(0.0f, 0.0f); + float4 param_1 = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 indexable[8] = (float4[8])0; + float4 indexable_1[8] = (float4[8])0; + float4 indexable_2[8] = (float4[8])0; + float4 indexable_3[16] = (float4[16])0; + const float x_147 = gl_FragCoord.x; + if ((x_147 < 0.0f)) { + x_144 = -1.0f; + } else { + const float x_153 = gl_FragCoord.x; + if ((x_153 >= 0.0f)) { + const float x_159 = gl_FragCoord.x; + x_145 = ((x_159 >= 0.0f) ? 0.5f : 1.0f); + } else { + x_145 = 1.0f; + } + x_144 = min(x_145, 0.5f); + } + res = float4(clamp(0.5f, 0.5f, x_144), 0.5f, 1.0f, 1.0f); + i = 0; + { + for(; (i < 8); i = (i + 1)) { + const int x_174 = i; + const float2 x_175 = pos_1; + param = x_175; + const float4 tint_symbol_5[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable = tint_symbol_5; + const float4 x_177 = indexable[x_174]; + param_1 = x_177; + const bool x_178 = collision_vf2_vf4_(param, param_1); + if (x_178) { + const int x_181 = i; + const float4 tint_symbol_6[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable_1 = tint_symbol_6; + const float x_183 = indexable_1[x_181].x; + const int x_185 = i; + const float4 tint_symbol_7[8] = {float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}; + indexable_2 = tint_symbol_7; + const float x_187 = indexable_2[x_185].y; + const int x_190 = i; + const float4 tint_symbol_8[16] = {float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}; + indexable_3 = tint_symbol_8; + const float4 x_196 = indexable_3[((((int(x_183) * int(x_187)) + (x_190 * 9)) + 11) % 16)]; + res = x_196; + } + } + } + return res; +} + +void main_1() { + float2 lin = float2(0.0f, 0.0f); + float2 param_2 = float2(0.0f, 0.0f); + const float4 x_98 = gl_FragCoord; + const float2 x_101 = asfloat(x_20[0].xy); + lin = (float2(x_98.x, x_98.y) / x_101); + lin = floor((lin * 32.0f)); + param_2 = lin; + const float4 x_107 = match_vf2_(param_2); + x_GLF_color = x_107; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_9 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_9; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.msl new file mode 100644 index 0000000000..840a67c981 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.msl @@ -0,0 +1,136 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct tint_array_wrapper { + float4 arr[8]; +}; +struct tint_array_wrapper_1 { + float4 arr[16]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +bool collision_vf2_vf4_(thread float2* const pos, thread float4* const quad) { + float const x_110 = (*(pos)).x; + float const x_112 = (*(quad)).x; + if ((x_110 < x_112)) { + return false; + } + float const x_117 = (*(pos)).y; + float const x_119 = (*(quad)).y; + if ((x_117 < x_119)) { + return false; + } + float const x_124 = (*(pos)).x; + float const x_126 = (*(quad)).x; + float const x_128 = (*(quad)).z; + if ((x_124 > (x_126 + x_128))) { + return false; + } + float const x_134 = (*(pos)).y; + float const x_136 = (*(quad)).y; + float const x_138 = (*(quad)).w; + if ((x_134 > (x_136 + x_138))) { + return false; + } + return true; +} + +float4 match_vf2_(thread float2* const pos_1, thread float4* const tint_symbol_9) { + float4 res = 0.0f; + float x_144 = 0.0f; + float x_145 = 0.0f; + int i = 0; + float2 param = 0.0f; + float4 param_1 = 0.0f; + tint_array_wrapper indexable = {}; + tint_array_wrapper indexable_1 = {}; + tint_array_wrapper indexable_2 = {}; + tint_array_wrapper_1 indexable_3 = {}; + float const x_147 = (*(tint_symbol_9)).x; + if ((x_147 < 0.0f)) { + x_144 = -1.0f; + } else { + float const x_153 = (*(tint_symbol_9)).x; + if ((x_153 >= 0.0f)) { + float const x_159 = (*(tint_symbol_9)).x; + x_145 = select(1.0f, 0.5f, (x_159 >= 0.0f)); + } else { + x_145 = 1.0f; + } + float const x_162 = x_145; + x_144 = fmin(x_162, 0.5f); + } + float const x_164 = x_144; + res = float4(clamp(0.5f, 0.5f, x_164), 0.5f, 1.0f, 1.0f); + i = 0; + while (true) { + int const x_171 = i; + if ((x_171 < 8)) { + } else { + break; + } + int const x_174 = i; + float2 const x_175 = *(pos_1); + param = x_175; + tint_array_wrapper const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable = tint_symbol_4; + float4 const x_177 = indexable.arr[x_174]; + param_1 = x_177; + bool const x_178 = collision_vf2_vf4_(&(param), &(param_1)); + if (x_178) { + int const x_181 = i; + tint_array_wrapper const tint_symbol_5 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable_1 = tint_symbol_5; + float const x_183 = indexable_1.arr[x_181].x; + int const x_185 = i; + tint_array_wrapper const tint_symbol_6 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}}; + indexable_2 = tint_symbol_6; + float const x_187 = indexable_2.arr[x_185].y; + int const x_190 = i; + tint_array_wrapper_1 const tint_symbol_7 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; + indexable_3 = tint_symbol_7; + float4 const x_196 = indexable_3.arr[((((int(x_183) * int(x_187)) + (x_190 * 9)) + 11) % 16)]; + res = x_196; + } + { + int const x_197 = i; + i = (x_197 + 1); + } + } + float4 const x_199 = res; + return x_199; +} + +void main_1(constant buf0& x_20, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) { + float2 lin = 0.0f; + float2 param_2 = 0.0f; + float4 const x_98 = *(tint_symbol_10); + float2 const x_101 = x_20.resolution; + lin = (float2(x_98.x, x_98.y) / x_101); + float2 const x_103 = lin; + lin = floor((x_103 * 32.0f)); + float2 const x_106 = lin; + param_2 = x_106; + float4 const x_107 = match_vf2_(&(param_2), tint_symbol_10); + *(tint_symbol_11) = x_107; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_20 [[buffer(0)]]) { + thread float4 tint_symbol_12 = 0.0f; + thread float4 tint_symbol_13 = 0.0f; + tint_symbol_12 = gl_FragCoord_param; + main_1(x_20, &(tint_symbol_12), &(tint_symbol_13)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13}; + tint_symbol_2 const tint_symbol_8 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_8; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d8773e452 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.spvasm @@ -0,0 +1,336 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 240 +; Schema: 0 + OpCapability Shader + %125 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_20 "x_20" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %collision_vf2_vf4_ "collision_vf2_vf4_" + OpName %pos "pos" + OpName %quad "quad" + OpName %match_vf2_ "match_vf2_" + OpName %pos_1 "pos_1" + OpName %res "res" + OpName %x_144 "x_144" + OpName %x_145 "x_145" + OpName %i "i" + OpName %param "param" + OpName %param_1 "param_1" + OpName %indexable "indexable" + OpName %indexable_1 "indexable_1" + OpName %indexable_2 "indexable_2" + OpName %indexable_3 "indexable_3" + OpName %main_1 "main_1" + OpName %lin "lin" + OpName %param_2 "param_2" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_20 NonWritable + OpDecorate %x_20 DescriptorSet 0 + OpDecorate %x_20 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_v4float_uint_8 ArrayStride 16 + OpDecorate %_arr_v4float_uint_16 ArrayStride 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_20 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %bool = OpTypeBool +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %15 = OpTypeFunction %bool %_ptr_Function_v2float %_ptr_Function_v4float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %true = OpConstantTrue %bool + %75 = OpTypeFunction %v4float %_ptr_Function_v2float + %81 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %86 = OpConstantNull %int + %88 = OpConstantNull %v2float + %uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8 = OpTypePointer Function %_arr_v4float_uint_8 + %94 = OpConstantNull %_arr_v4float_uint_8 + %uint_16 = OpConstant %uint 16 +%_arr_v4float_uint_16 = OpTypeArray %v4float %uint_16 +%_ptr_Function__arr_v4float_uint_16 = OpTypePointer Function %_arr_v4float_uint_16 + %101 = OpConstantNull %_arr_v4float_uint_16 +%_ptr_Private_float = OpTypePointer Private %float + %float_0 = OpConstant %float 0 + %float_n1 = OpConstant %float -1 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %int_0 = OpConstant %int 0 + %int_8 = OpConstant %int 8 + %float_4 = OpConstant %float 4 + %float_20 = OpConstant %float 20 + %145 = OpConstantComposite %v4float %float_4 %float_4 %float_20 %float_4 + %146 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_20 + %147 = OpConstantComposite %v4float %float_4 %float_20 %float_20 %float_4 + %float_8 = OpConstant %float 8 + %149 = OpConstantComposite %v4float %float_20 %float_4 %float_4 %float_8 + %float_6 = OpConstant %float 6 + %float_2 = OpConstant %float 2 + %152 = OpConstantComposite %v4float %float_8 %float_6 %float_4 %float_2 + %float_12 = OpConstant %float 12 + %154 = OpConstantComposite %v4float %float_2 %float_12 %float_2 %float_4 + %float_16 = OpConstant %float 16 + %156 = OpConstantComposite %v4float %float_16 %float_2 %float_4 %float_4 + %float_22 = OpConstant %float 22 + %158 = OpConstantComposite %v4float %float_12 %float_22 %float_4 %float_4 + %159 = OpConstantComposite %_arr_v4float_uint_8 %145 %146 %147 %149 %152 %154 %156 %158 + %174 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %175 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_1 + %176 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_1 + %177 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 + %178 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_1 + %179 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0_5 %float_1 + %180 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0_5 %float_1 + %181 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_1 + %182 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %183 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %184 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %185 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %186 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_1 + %187 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1 + %188 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %189 = OpConstantComposite %_arr_v4float_uint_16 %174 %175 %176 %177 %178 %179 %180 %181 %174 %182 %183 %184 %185 %186 %187 %188 + %int_9 = OpConstant %int 9 + %int_11 = OpConstant %int 11 + %int_16 = OpConstant %int 16 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %206 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_32 = OpConstant %float 32 + %main_out = OpTypeStruct %v4float + %227 = OpTypeFunction %void %main_out +%collision_vf2_vf4_ = OpFunction %bool None %15 + %pos = OpFunctionParameter %_ptr_Function_v2float + %quad = OpFunctionParameter %_ptr_Function_v4float + %22 = OpLabel + %27 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %28 = OpLoad %float %27 + %30 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %31 = OpLoad %float %30 + %32 = OpFOrdLessThan %bool %28 %31 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %33 + %34 = OpLabel + OpReturnValue %false + %33 = OpLabel + %38 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %39 = OpLoad %float %38 + %41 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %42 = OpLoad %float %41 + %43 = OpFOrdLessThan %bool %39 %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + OpReturnValue %false + %44 = OpLabel + %47 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %48 = OpLoad %float %47 + %50 = OpAccessChain %_ptr_Function_float %quad %uint_0 + %51 = OpLoad %float %50 + %54 = OpAccessChain %_ptr_Function_float %quad %uint_2 + %55 = OpLoad %float %54 + %56 = OpFAdd %float %51 %55 + %57 = OpFOrdGreaterThan %bool %48 %56 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + OpReturnValue %false + %58 = OpLabel + %61 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %62 = OpLoad %float %61 + %64 = OpAccessChain %_ptr_Function_float %quad %uint_1 + %65 = OpLoad %float %64 + %68 = OpAccessChain %_ptr_Function_float %quad %uint_3 + %69 = OpLoad %float %68 + %70 = OpFAdd %float %65 %69 + %71 = OpFOrdGreaterThan %bool %62 %70 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %72 + %73 = OpLabel + OpReturnValue %false + %72 = OpLabel + OpReturnValue %true + OpFunctionEnd + %match_vf2_ = OpFunction %v4float None %75 + %pos_1 = OpFunctionParameter %_ptr_Function_v2float + %78 = OpLabel + %res = OpVariable %_ptr_Function_v4float Function %5 + %x_144 = OpVariable %_ptr_Function_float Function %81 + %x_145 = OpVariable %_ptr_Function_float Function %81 + %i = OpVariable %_ptr_Function_int Function %86 + %param = OpVariable %_ptr_Function_v2float Function %88 + %param_1 = OpVariable %_ptr_Function_v4float Function %5 + %indexable = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %94 +%indexable_1 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %94 +%indexable_2 = OpVariable %_ptr_Function__arr_v4float_uint_8 Function %94 +%indexable_3 = OpVariable %_ptr_Function__arr_v4float_uint_16 Function %101 + %103 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %104 = OpLoad %float %103 + %106 = OpFOrdLessThan %bool %104 %float_0 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %109 + %108 = OpLabel + OpStore %x_144 %float_n1 + OpBranch %107 + %109 = OpLabel + %111 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %112 = OpLoad %float %111 + %113 = OpFOrdGreaterThanEqual %bool %112 %float_0 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %116 + %115 = OpLabel + %117 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %118 = OpLoad %float %117 + %120 = OpFOrdGreaterThanEqual %bool %118 %float_0 + %119 = OpSelect %float %120 %float_0_5 %float_1 + OpStore %x_145 %119 + OpBranch %114 + %116 = OpLabel + OpStore %x_145 %float_1 + OpBranch %114 + %114 = OpLabel + %123 = OpLoad %float %x_145 + %124 = OpExtInst %float %125 NMin %123 %float_0_5 + OpStore %x_144 %124 + OpBranch %107 + %107 = OpLabel + %126 = OpLoad %float %x_144 + %127 = OpExtInst %float %125 NClamp %float_0_5 %float_0_5 %126 + %128 = OpCompositeConstruct %v4float %127 %float_0_5 %float_1 %float_1 + OpStore %res %128 + OpStore %i %int_0 + OpBranch %130 + %130 = OpLabel + OpLoopMerge %131 %132 None + OpBranch %133 + %133 = OpLabel + %134 = OpLoad %int %i + %136 = OpSLessThan %bool %134 %int_8 + OpSelectionMerge %137 None + OpBranchConditional %136 %138 %139 + %138 = OpLabel + OpBranch %137 + %139 = OpLabel + OpBranch %131 + %137 = OpLabel + %140 = OpLoad %int %i + %142 = OpLoad %v2float %pos_1 + OpStore %param %142 + OpStore %indexable %159 + %160 = OpAccessChain %_ptr_Function_v4float %indexable %140 + %161 = OpLoad %v4float %160 + OpStore %param_1 %161 + %162 = OpFunctionCall %bool %collision_vf2_vf4_ %param %param_1 + OpSelectionMerge %165 None + OpBranchConditional %162 %166 %165 + %166 = OpLabel + %167 = OpLoad %int %i + OpStore %indexable_1 %159 + %168 = OpAccessChain %_ptr_Function_float %indexable_1 %167 %uint_0 + %169 = OpLoad %float %168 + %170 = OpLoad %int %i + OpStore %indexable_2 %159 + %171 = OpAccessChain %_ptr_Function_float %indexable_2 %170 %uint_1 + %172 = OpLoad %float %171 + %173 = OpLoad %int %i + OpStore %indexable_3 %189 + %190 = OpConvertFToS %int %169 + %191 = OpConvertFToS %int %172 + %192 = OpIMul %int %190 %191 + %194 = OpIMul %int %173 %int_9 + %195 = OpIAdd %int %192 %194 + %197 = OpIAdd %int %195 %int_11 + %199 = OpSMod %int %197 %int_16 + %200 = OpAccessChain %_ptr_Function_v4float %indexable_3 %199 + %201 = OpLoad %v4float %200 + OpStore %res %201 + OpBranch %165 + %165 = OpLabel + OpBranch %132 + %132 = OpLabel + %202 = OpLoad %int %i + %204 = OpIAdd %int %202 %int_1 + OpStore %i %204 + OpBranch %130 + %131 = OpLabel + %205 = OpLoad %v4float %res + OpReturnValue %205 + OpFunctionEnd + %main_1 = OpFunction %void None %206 + %209 = OpLabel + %lin = OpVariable %_ptr_Function_v2float Function %88 + %param_2 = OpVariable %_ptr_Function_v2float Function %88 + %212 = OpLoad %v4float %gl_FragCoord + %214 = OpAccessChain %_ptr_Uniform_v2float %x_20 %uint_0 + %215 = OpLoad %v2float %214 + %216 = OpCompositeExtract %float %212 0 + %217 = OpCompositeExtract %float %212 1 + %218 = OpCompositeConstruct %v2float %216 %217 + %219 = OpFDiv %v2float %218 %215 + OpStore %lin %219 + %220 = OpLoad %v2float %lin + %223 = OpVectorTimesScalar %v2float %220 %float_32 + %221 = OpExtInst %v2float %125 Floor %223 + OpStore %lin %221 + %224 = OpLoad %v2float %lin + OpStore %param_2 %224 + %225 = OpFunctionCall %v4float %match_vf2_ %param_2 + OpStore %x_GLF_color %225 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %227 +%tint_symbol_1 = OpFunctionParameter %main_out + %231 = OpLabel + %232 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %232 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %206 + %234 = OpLabel + %235 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %235 + %236 = OpFunctionCall %void %main_1 + %238 = OpLoad %v4float %x_GLF_color + %239 = OpCompositeConstruct %main_out %238 + %237 = OpFunctionCall %void %tint_symbol_3 %239 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..4b3b3b5674 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-rects-vec4-clamp-conditional-min-mix/1.wgsl.expected.wgsl @@ -0,0 +1,126 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_20 : buf0; + +var x_GLF_color : vec4; + +fn collision_vf2_vf4_(pos : ptr>, quad : ptr>) -> bool { + let x_110 : f32 = (*(pos)).x; + let x_112 : f32 = (*(quad)).x; + if ((x_110 < x_112)) { + return false; + } + let x_117 : f32 = (*(pos)).y; + let x_119 : f32 = (*(quad)).y; + if ((x_117 < x_119)) { + return false; + } + let x_124 : f32 = (*(pos)).x; + let x_126 : f32 = (*(quad)).x; + let x_128 : f32 = (*(quad)).z; + if ((x_124 > (x_126 + x_128))) { + return false; + } + let x_134 : f32 = (*(pos)).y; + let x_136 : f32 = (*(quad)).y; + let x_138 : f32 = (*(quad)).w; + if ((x_134 > (x_136 + x_138))) { + return false; + } + return true; +} + +fn match_vf2_(pos_1 : ptr>) -> vec4 { + var res : vec4; + var x_144 : f32; + var x_145 : f32; + var i : i32; + var param : vec2; + var param_1 : vec4; + var indexable : array, 8>; + var indexable_1 : array, 8>; + var indexable_2 : array, 8>; + var indexable_3 : array, 16>; + let x_147 : f32 = gl_FragCoord.x; + if ((x_147 < 0.0)) { + x_144 = -1.0; + } else { + let x_153 : f32 = gl_FragCoord.x; + if ((x_153 >= 0.0)) { + let x_159 : f32 = gl_FragCoord.x; + x_145 = select(1.0, 0.5, (x_159 >= 0.0)); + } else { + x_145 = 1.0; + } + let x_162 : f32 = x_145; + x_144 = min(x_162, 0.5); + } + let x_164 : f32 = x_144; + res = vec4(clamp(0.5, 0.5, x_164), 0.5, 1.0, 1.0); + i = 0; + loop { + let x_171 : i32 = i; + if ((x_171 < 8)) { + } else { + break; + } + let x_174 : i32 = i; + let x_175 : vec2 = *(pos_1); + param = x_175; + indexable = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_177 : vec4 = indexable[x_174]; + param_1 = x_177; + let x_178 : bool = collision_vf2_vf4_(&(param), &(param_1)); + if (x_178) { + let x_181 : i32 = i; + indexable_1 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_183 : f32 = indexable_1[x_181].x; + let x_185 : i32 = i; + indexable_2 = array, 8>(vec4(4.0, 4.0, 20.0, 4.0), vec4(4.0, 4.0, 4.0, 20.0), vec4(4.0, 20.0, 20.0, 4.0), vec4(20.0, 4.0, 4.0, 8.0), vec4(8.0, 6.0, 4.0, 2.0), vec4(2.0, 12.0, 2.0, 4.0), vec4(16.0, 2.0, 4.0, 4.0), vec4(12.0, 22.0, 4.0, 4.0)); + let x_187 : f32 = indexable_2[x_185].y; + let x_190 : i32 = i; + indexable_3 = array, 16>(vec4(0.0, 0.0, 0.0, 1.0), vec4(0.5, 0.0, 0.0, 1.0), vec4(0.0, 0.5, 0.0, 1.0), vec4(0.5, 0.5, 0.0, 1.0), vec4(0.0, 0.0, 0.5, 1.0), vec4(0.5, 0.0, 0.5, 1.0), vec4(0.0, 0.5, 0.5, 1.0), vec4(0.5, 0.5, 0.5, 1.0), vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 0.0, 0.0, 1.0), vec4(0.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(0.0, 0.0, 1.0, 1.0), vec4(1.0, 0.0, 1.0, 1.0), vec4(0.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + let x_196 : vec4 = indexable_3[((((i32(x_183) * i32(x_187)) + (x_190 * 9)) + 11) % 16)]; + res = x_196; + } + + continuing { + let x_197 : i32 = i; + i = (x_197 + 1); + } + } + let x_199 : vec4 = res; + return x_199; +} + +fn main_1() { + var lin : vec2; + var param_2 : vec2; + let x_98 : vec4 = gl_FragCoord; + let x_101 : vec2 = x_20.resolution; + lin = (vec2(x_98.x, x_98.y) / x_101); + let x_103 : vec2 = lin; + lin = floor((x_103 * 32.0)); + let x_106 : vec2 = lin; + param_2 = x_106; + let x_107 : vec4 = match_vf2_(&(param_2)); + x_GLF_color = x_107; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm new file mode 100644 index 0000000000..b885c183cf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm @@ -0,0 +1,259 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %cross2d_vf2_vf2_ "cross2d(vf2;vf2;" + OpName %a "a" + OpName %b "b" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %p "p" + OpName %a_0 "a" + OpName %b_0 "b" + OpName %c "c" + OpName %pab "pab" + OpName %param "param" + OpName %param_0 "param" + OpName %pbc "pbc" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %pca "pca" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %pos "pos" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %param_5 "param" + OpName %param_6 "param" + OpName %param_7 "param" + OpName %param_8 "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %30 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %34 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float + %int = OpTypeInt 32 1 + %36 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %51 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %54 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %57 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %60 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %61 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%_ptr_Function_int = OpTypePointer Function %int + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %main = OpFunction %void None %30 + %66 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function + %param_5 = OpVariable %_ptr_Function_v2float Function + %param_6 = OpVariable %_ptr_Function_v2float Function + %param_7 = OpVariable %_ptr_Function_v2float Function + %param_8 = OpVariable %_ptr_Function_v2float Function + %67 = OpLoad %v4float %gl_FragCoord + %68 = OpVectorShuffle %v2float %67 %67 0 1 + %69 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %70 = OpLoad %v2float %69 + %71 = OpFDiv %v2float %68 %70 + OpStore %pos %71 + OpStore %param_5 %71 + OpStore %param_6 %51 + OpStore %param_7 %54 + OpStore %param_8 %57 + %72 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_5 %param_6 %param_7 %param_8 + %73 = OpIEqual %bool %72 %int_1 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + OpStore %_GLF_color %60 + OpBranch %74 + %76 = OpLabel + OpStore %_GLF_color %61 + OpBranch %74 + %74 = OpLabel + OpReturn + OpFunctionEnd +%cross2d_vf2_vf2_ = OpFunction %float None %34 + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %77 = OpLabel + %78 = OpAccessChain %_ptr_Function_float %a %uint_0 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Function_float %b %uint_1 + %81 = OpLoad %float %80 + %82 = OpFMul %float %79 %81 + %83 = OpAccessChain %_ptr_Function_float %b %uint_0 + %84 = OpLoad %float %83 + %85 = OpAccessChain %_ptr_Function_float %a %uint_1 + %86 = OpLoad %float %85 + %87 = OpFMul %float %84 %86 + %88 = OpFSub %float %82 %87 + OpReturnValue %88 + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %36 + %p = OpFunctionParameter %_ptr_Function_v2float + %a_0 = OpFunctionParameter %_ptr_Function_v2float + %b_0 = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %89 = OpLabel + %90 = OpVariable %_ptr_Function_bool Function %false + %91 = OpVariable %_ptr_Function_int Function + %pab = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_v2float Function + %param_0 = OpVariable %_ptr_Function_v2float Function + %pbc = OpVariable %_ptr_Function_float Function + %param_1 = OpVariable %_ptr_Function_v2float Function + %param_2 = OpVariable %_ptr_Function_v2float Function + %pca = OpVariable %_ptr_Function_float Function + %param_3 = OpVariable %_ptr_Function_v2float Function + %param_4 = OpVariable %_ptr_Function_v2float Function + OpSelectionMerge %92 None + OpSwitch %uint_0 %93 + %93 = OpLabel + %94 = OpAccessChain %_ptr_Function_float %p %uint_0 + %95 = OpLoad %float %94 + %96 = OpAccessChain %_ptr_Function_float %a_0 %uint_0 + %97 = OpLoad %float %96 + %98 = OpFSub %float %95 %97 + %99 = OpAccessChain %_ptr_Function_float %p %uint_1 + %100 = OpLoad %float %99 + %101 = OpAccessChain %_ptr_Function_float %a_0 %uint_1 + %102 = OpLoad %float %101 + %103 = OpFSub %float %100 %102 + %104 = OpCompositeConstruct %v2float %98 %103 + %105 = OpAccessChain %_ptr_Function_float %b_0 %uint_0 + %106 = OpLoad %float %105 + %107 = OpLoad %float %96 + %108 = OpFSub %float %106 %107 + %109 = OpAccessChain %_ptr_Function_float %b_0 %uint_1 + %110 = OpLoad %float %109 + %111 = OpLoad %float %101 + %112 = OpFSub %float %110 %111 + %113 = OpCompositeConstruct %v2float %108 %112 + OpStore %param %104 + OpStore %param_0 %113 + %114 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_0 + OpStore %pab %114 + %115 = OpLoad %float %94 + %116 = OpLoad %float %105 + %117 = OpFSub %float %115 %116 + %118 = OpLoad %float %99 + %119 = OpLoad %float %109 + %120 = OpFSub %float %118 %119 + %121 = OpCompositeConstruct %v2float %117 %120 + %122 = OpAccessChain %_ptr_Function_float %c %uint_0 + %123 = OpLoad %float %122 + %124 = OpLoad %float %105 + %125 = OpFSub %float %123 %124 + %126 = OpAccessChain %_ptr_Function_float %c %uint_1 + %127 = OpLoad %float %126 + %128 = OpLoad %float %109 + %129 = OpFSub %float %127 %128 + %130 = OpCompositeConstruct %v2float %125 %129 + OpStore %param_1 %121 + OpStore %param_2 %130 + %131 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_1 %param_2 + OpStore %pbc %131 + %132 = OpFOrdLessThan %bool %114 %float_0 + %133 = OpFOrdLessThan %bool %131 %float_0 + %134 = OpLogicalAnd %bool %132 %133 + %135 = OpLogicalNot %bool %134 + OpSelectionMerge %136 None + OpBranchConditional %135 %137 %136 + %137 = OpLabel + %138 = OpFOrdGreaterThanEqual %bool %114 %float_0 + %139 = OpFOrdGreaterThanEqual %bool %131 %float_0 + %140 = OpLogicalAnd %bool %138 %139 + OpBranch %136 + %136 = OpLabel + %141 = OpPhi %bool %134 %93 %140 %137 + %142 = OpLogicalNot %bool %141 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %143 + %144 = OpLabel + OpStore %90 %true + OpStore %91 %int_0 + OpBranch %92 + %143 = OpLabel + %145 = OpLoad %float %94 + %146 = OpLoad %float %122 + %147 = OpFSub %float %145 %146 + %148 = OpLoad %float %99 + %149 = OpLoad %float %126 + %150 = OpFSub %float %148 %149 + %151 = OpCompositeConstruct %v2float %147 %150 + %152 = OpLoad %float %96 + %153 = OpLoad %float %122 + %154 = OpFSub %float %152 %153 + %155 = OpLoad %float %101 + %156 = OpLoad %float %126 + %157 = OpFSub %float %155 %156 + %158 = OpCompositeConstruct %v2float %154 %157 + OpStore %param_3 %151 + OpStore %param_4 %158 + %159 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_3 %param_4 + OpStore %pca %159 + %160 = OpFOrdLessThan %bool %114 %float_0 + %161 = OpFOrdLessThan %bool %159 %float_0 + %162 = OpLogicalAnd %bool %160 %161 + %163 = OpLogicalNot %bool %162 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %164 + %165 = OpLabel + %166 = OpFOrdGreaterThanEqual %bool %114 %float_0 + %167 = OpFOrdGreaterThanEqual %bool %159 %float_0 + %168 = OpLogicalAnd %bool %166 %167 + OpBranch %164 + %164 = OpLabel + %169 = OpPhi %bool %162 %143 %168 %165 + %170 = OpLogicalNot %bool %169 + OpSelectionMerge %171 None + OpBranchConditional %170 %172 %171 + %172 = OpLabel + OpStore %90 %true + OpStore %91 %int_0 + OpBranch %92 + %171 = OpLabel + OpStore %90 %true + OpStore %91 %int_1 + OpBranch %92 + %92 = OpLabel + %173 = OpPhi %int %int_0 %144 %int_0 %172 %int_1 %171 + OpReturnValue %173 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..fd9d668103 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,159 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_24 : register(b0, space0) { + uint4 x_24[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float cross2d_vf2_vf2_(inout float2 a, inout float2 b) { + const float x_79 = a.x; + const float x_81 = b.y; + const float x_84 = b.x; + const float x_86 = a.y; + return ((x_79 * x_81) - (x_84 * x_86)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout float2 b_1, inout float2 c) { + bool x_90 = false; + int x_91 = 0; + float pab = 0.0f; + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + float pbc = 0.0f; + float2 param_2 = float2(0.0f, 0.0f); + float2 param_3 = float2(0.0f, 0.0f); + float pca = 0.0f; + float2 param_4 = float2(0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + bool x_140 = false; + bool x_168 = false; + bool x_141_phi = false; + bool x_169_phi = false; + int x_173_phi = 0; + switch(0u) { + default: { + const float x_95 = p.x; + const float x_97 = a_1.x; + const float x_100 = p.y; + const float x_102 = a_1.y; + const float x_106 = b_1.x; + const float x_107 = a_1.x; + const float x_110 = b_1.y; + const float x_111 = a_1.y; + param = float2((x_95 - x_97), (x_100 - x_102)); + param_1 = float2((x_106 - x_107), (x_110 - x_111)); + const float x_114 = cross2d_vf2_vf2_(param, param_1); + pab = x_114; + const float x_115 = p.x; + const float x_116 = b_1.x; + const float x_118 = p.y; + const float x_119 = b_1.y; + const float x_123 = c.x; + const float x_124 = b_1.x; + const float x_127 = c.y; + const float x_128 = b_1.y; + param_2 = float2((x_115 - x_116), (x_118 - x_119)); + param_3 = float2((x_123 - x_124), (x_127 - x_128)); + const float x_131 = cross2d_vf2_vf2_(param_2, param_3); + pbc = x_131; + bool tint_tmp = (x_114 < 0.0f); + if (tint_tmp) { + tint_tmp = (x_131 < 0.0f); + } + const bool x_134 = (tint_tmp); + x_141_phi = x_134; + if (!(x_134)) { + bool tint_tmp_1 = (x_114 >= 0.0f); + if (tint_tmp_1) { + tint_tmp_1 = (x_131 >= 0.0f); + } + x_140 = (tint_tmp_1); + x_141_phi = x_140; + } + if (!(x_141_phi)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + const float x_145 = p.x; + const float x_146 = c.x; + const float x_148 = p.y; + const float x_149 = c.y; + const float x_152 = a_1.x; + const float x_153 = c.x; + const float x_155 = a_1.y; + const float x_156 = c.y; + param_4 = float2((x_145 - x_146), (x_148 - x_149)); + param_5 = float2((x_152 - x_153), (x_155 - x_156)); + const float x_159 = cross2d_vf2_vf2_(param_4, param_5); + pca = x_159; + bool tint_tmp_2 = (x_114 < 0.0f); + if (tint_tmp_2) { + tint_tmp_2 = (x_159 < 0.0f); + } + const bool x_162 = (tint_tmp_2); + x_169_phi = x_162; + if (!(x_162)) { + bool tint_tmp_3 = (x_114 >= 0.0f); + if (tint_tmp_3) { + tint_tmp_3 = (x_159 >= 0.0f); + } + x_168 = (tint_tmp_3); + x_169_phi = x_168; + } + if (!(x_169_phi)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + x_90 = true; + x_91 = 1; + x_173_phi = 1; + break; + } + } + return x_173_phi; +} + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + float2 param_6 = float2(0.0f, 0.0f); + float2 param_7 = float2(0.0f, 0.0f); + float2 param_8 = float2(0.0f, 0.0f); + float2 param_9 = float2(0.0f, 0.0f); + const float4 x_67 = gl_FragCoord; + const float2 x_70 = asfloat(x_24[0].xy); + const float2 x_71 = (float2(x_67.x, x_67.y) / x_70); + pos = x_71; + param_6 = x_71; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + const int x_72 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9); + if ((x_72 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..c8cbf19939 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,145 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float cross2d_vf2_vf2_(thread float2* const a, thread float2* const b) { + float const x_79 = (*(a)).x; + float const x_81 = (*(b)).y; + float const x_84 = (*(b)).x; + float const x_86 = (*(a)).y; + return ((x_79 * x_81) - (x_84 * x_86)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) { + bool x_90 = false; + int x_91 = 0; + float pab = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + float pbc = 0.0f; + float2 param_2 = 0.0f; + float2 param_3 = 0.0f; + float pca = 0.0f; + float2 param_4 = 0.0f; + float2 param_5 = 0.0f; + bool x_140 = false; + bool x_168 = false; + bool x_141_phi = false; + bool x_169_phi = false; + int x_173_phi = 0; + switch(0u) { + default: { + float const x_95 = (*(p)).x; + float const x_97 = (*(a_1)).x; + float const x_100 = (*(p)).y; + float const x_102 = (*(a_1)).y; + float const x_106 = (*(b_1)).x; + float const x_107 = (*(a_1)).x; + float const x_110 = (*(b_1)).y; + float const x_111 = (*(a_1)).y; + param = float2((x_95 - x_97), (x_100 - x_102)); + param_1 = float2((x_106 - x_107), (x_110 - x_111)); + float const x_114 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_114; + float const x_115 = (*(p)).x; + float const x_116 = (*(b_1)).x; + float const x_118 = (*(p)).y; + float const x_119 = (*(b_1)).y; + float const x_123 = (*(c)).x; + float const x_124 = (*(b_1)).x; + float const x_127 = (*(c)).y; + float const x_128 = (*(b_1)).y; + param_2 = float2((x_115 - x_116), (x_118 - x_119)); + param_3 = float2((x_123 - x_124), (x_127 - x_128)); + float const x_131 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_131; + bool const x_134 = ((x_114 < 0.0f) && (x_131 < 0.0f)); + x_141_phi = x_134; + if (!(x_134)) { + x_140 = ((x_114 >= 0.0f) && (x_131 >= 0.0f)); + x_141_phi = x_140; + } + bool const x_141 = x_141_phi; + if (!(x_141)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + float const x_145 = (*(p)).x; + float const x_146 = (*(c)).x; + float const x_148 = (*(p)).y; + float const x_149 = (*(c)).y; + float const x_152 = (*(a_1)).x; + float const x_153 = (*(c)).x; + float const x_155 = (*(a_1)).y; + float const x_156 = (*(c)).y; + param_4 = float2((x_145 - x_146), (x_148 - x_149)); + param_5 = float2((x_152 - x_153), (x_155 - x_156)); + float const x_159 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_159; + bool const x_162 = ((x_114 < 0.0f) && (x_159 < 0.0f)); + x_169_phi = x_162; + if (!(x_162)) { + x_168 = ((x_114 >= 0.0f) && (x_159 >= 0.0f)); + x_169_phi = x_168; + } + bool const x_169 = x_169_phi; + if (!(x_169)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + x_90 = true; + x_91 = 1; + x_173_phi = 1; + break; + } + } + int const x_173 = x_173_phi; + return x_173; +} + +void main_1(constant buf0& x_24, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 pos = 0.0f; + float2 param_6 = 0.0f; + float2 param_7 = 0.0f; + float2 param_8 = 0.0f; + float2 param_9 = 0.0f; + float4 const x_67 = *(tint_symbol_5); + float2 const x_70 = x_24.resolution; + float2 const x_71 = (float2(x_67.x, x_67.y) / x_70); + pos = x_71; + param_6 = x_71; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + int const x_72 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_72 == 1)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_24 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_24, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..59e04f8590 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,360 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 265 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_24 "x_24" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %cross2d_vf2_vf2_ "cross2d_vf2_vf2_" + OpName %a "a" + OpName %b "b" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_" + OpName %p "p" + OpName %a_1 "a_1" + OpName %b_1 "b_1" + OpName %c "c" + OpName %x_90 "x_90" + OpName %x_91 "x_91" + OpName %pab "pab" + OpName %param "param" + OpName %param_1 "param_1" + OpName %pbc "pbc" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %pca "pca" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %x_140 "x_140" + OpName %x_168 "x_168" + OpName %x_141_phi "x_141_phi" + OpName %x_169_phi "x_169_phi" + OpName %x_173_phi "x_173_phi" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_24 NonWritable + OpDecorate %x_24 DescriptorSet 0 + OpDecorate %x_24 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_24 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %40 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %52 = OpConstantNull %bool +%_ptr_Function_int = OpTypePointer Function %int + %55 = OpConstantNull %int + %57 = OpConstantNull %float + %59 = OpConstantNull %v2float + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %214 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %233 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %236 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %239 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 + %float_1 = OpConstant %float 1 + %250 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %251 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %252 = OpTypeFunction %void %main_out +%cross2d_vf2_vf2_ = OpFunction %float None %15 + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %20 = OpLabel + %25 = OpAccessChain %_ptr_Function_float %a %uint_0 + %26 = OpLoad %float %25 + %29 = OpAccessChain %_ptr_Function_float %b %uint_1 + %30 = OpLoad %float %29 + %32 = OpAccessChain %_ptr_Function_float %b %uint_0 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Function_float %a %uint_1 + %36 = OpLoad %float %35 + %37 = OpFMul %float %26 %30 + %38 = OpFMul %float %33 %36 + %39 = OpFSub %float %37 %38 + OpReturnValue %39 + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %40 + %p = OpFunctionParameter %_ptr_Function_v2float + %a_1 = OpFunctionParameter %_ptr_Function_v2float + %b_1 = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %47 = OpLabel + %x_90 = OpVariable %_ptr_Function_bool Function %52 + %x_91 = OpVariable %_ptr_Function_int Function %55 + %pab = OpVariable %_ptr_Function_float Function %57 + %param = OpVariable %_ptr_Function_v2float Function %59 + %param_1 = OpVariable %_ptr_Function_v2float Function %59 + %pbc = OpVariable %_ptr_Function_float Function %57 + %param_2 = OpVariable %_ptr_Function_v2float Function %59 + %param_3 = OpVariable %_ptr_Function_v2float Function %59 + %pca = OpVariable %_ptr_Function_float Function %57 + %param_4 = OpVariable %_ptr_Function_v2float Function %59 + %param_5 = OpVariable %_ptr_Function_v2float Function %59 + %x_140 = OpVariable %_ptr_Function_bool Function %52 + %x_168 = OpVariable %_ptr_Function_bool Function %52 + %x_141_phi = OpVariable %_ptr_Function_bool Function %52 + %x_169_phi = OpVariable %_ptr_Function_bool Function %52 + %x_173_phi = OpVariable %_ptr_Function_int Function %55 + OpStore %x_90 %false + OpSelectionMerge %72 None + OpSwitch %uint_0 %73 + %73 = OpLabel + %75 = OpAccessChain %_ptr_Function_float %p %uint_0 + %76 = OpLoad %float %75 + %78 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %79 = OpLoad %float %78 + %81 = OpAccessChain %_ptr_Function_float %p %uint_1 + %82 = OpLoad %float %81 + %84 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %85 = OpLoad %float %84 + %87 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %88 = OpLoad %float %87 + %90 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %91 = OpLoad %float %90 + %93 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %94 = OpLoad %float %93 + %96 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %97 = OpLoad %float %96 + %98 = OpFSub %float %76 %79 + %99 = OpFSub %float %82 %85 + %100 = OpCompositeConstruct %v2float %98 %99 + OpStore %param %100 + %101 = OpFSub %float %88 %91 + %102 = OpFSub %float %94 %97 + %103 = OpCompositeConstruct %v2float %101 %102 + OpStore %param_1 %103 + %104 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_1 + OpStore %pab %104 + %108 = OpAccessChain %_ptr_Function_float %p %uint_0 + %109 = OpLoad %float %108 + %111 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %112 = OpLoad %float %111 + %114 = OpAccessChain %_ptr_Function_float %p %uint_1 + %115 = OpLoad %float %114 + %117 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %118 = OpLoad %float %117 + %120 = OpAccessChain %_ptr_Function_float %c %uint_0 + %121 = OpLoad %float %120 + %123 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %124 = OpLoad %float %123 + %126 = OpAccessChain %_ptr_Function_float %c %uint_1 + %127 = OpLoad %float %126 + %129 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %130 = OpLoad %float %129 + %131 = OpFSub %float %109 %112 + %132 = OpFSub %float %115 %118 + %133 = OpCompositeConstruct %v2float %131 %132 + OpStore %param_2 %133 + %134 = OpFSub %float %121 %124 + %135 = OpFSub %float %127 %130 + %136 = OpCompositeConstruct %v2float %134 %135 + OpStore %param_3 %136 + %137 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_2 %param_3 + OpStore %pbc %137 + %141 = OpFOrdLessThan %bool %104 %float_0 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %142 + %143 = OpLabel + %144 = OpFOrdLessThan %bool %137 %float_0 + OpBranch %142 + %142 = OpLabel + %145 = OpPhi %bool %141 %73 %144 %143 + OpStore %x_141_phi %145 + %146 = OpLogicalNot %bool %145 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %147 + %148 = OpLabel + %149 = OpFOrdGreaterThanEqual %bool %104 %float_0 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %150 + %151 = OpLabel + %152 = OpFOrdGreaterThanEqual %bool %137 %float_0 + OpBranch %150 + %150 = OpLabel + %153 = OpPhi %bool %149 %148 %152 %151 + OpStore %x_140 %153 + %154 = OpLoad %bool %x_140 + OpStore %x_141_phi %154 + OpBranch %147 + %147 = OpLabel + %155 = OpLoad %bool %x_141_phi + %156 = OpLogicalNot %bool %155 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %157 + %158 = OpLabel + OpStore %x_90 %true + OpStore %x_91 %int_0 + OpStore %x_173_phi %int_0 + OpBranch %72 + %157 = OpLabel + %162 = OpAccessChain %_ptr_Function_float %p %uint_0 + %163 = OpLoad %float %162 + %165 = OpAccessChain %_ptr_Function_float %c %uint_0 + %166 = OpLoad %float %165 + %168 = OpAccessChain %_ptr_Function_float %p %uint_1 + %169 = OpLoad %float %168 + %171 = OpAccessChain %_ptr_Function_float %c %uint_1 + %172 = OpLoad %float %171 + %174 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %175 = OpLoad %float %174 + %177 = OpAccessChain %_ptr_Function_float %c %uint_0 + %178 = OpLoad %float %177 + %180 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %181 = OpLoad %float %180 + %183 = OpAccessChain %_ptr_Function_float %c %uint_1 + %184 = OpLoad %float %183 + %185 = OpFSub %float %163 %166 + %186 = OpFSub %float %169 %172 + %187 = OpCompositeConstruct %v2float %185 %186 + OpStore %param_4 %187 + %188 = OpFSub %float %175 %178 + %189 = OpFSub %float %181 %184 + %190 = OpCompositeConstruct %v2float %188 %189 + OpStore %param_5 %190 + %191 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5 + OpStore %pca %191 + %194 = OpFOrdLessThan %bool %104 %float_0 + OpSelectionMerge %195 None + OpBranchConditional %194 %196 %195 + %196 = OpLabel + %197 = OpFOrdLessThan %bool %191 %float_0 + OpBranch %195 + %195 = OpLabel + %198 = OpPhi %bool %194 %157 %197 %196 + OpStore %x_169_phi %198 + %199 = OpLogicalNot %bool %198 + OpSelectionMerge %200 None + OpBranchConditional %199 %201 %200 + %201 = OpLabel + %202 = OpFOrdGreaterThanEqual %bool %104 %float_0 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %203 + %204 = OpLabel + %205 = OpFOrdGreaterThanEqual %bool %191 %float_0 + OpBranch %203 + %203 = OpLabel + %206 = OpPhi %bool %202 %201 %205 %204 + OpStore %x_168 %206 + %207 = OpLoad %bool %x_168 + OpStore %x_169_phi %207 + OpBranch %200 + %200 = OpLabel + %208 = OpLoad %bool %x_169_phi + %209 = OpLogicalNot %bool %208 + OpSelectionMerge %210 None + OpBranchConditional %209 %211 %210 + %211 = OpLabel + OpStore %x_90 %true + OpStore %x_91 %int_0 + OpStore %x_173_phi %int_0 + OpBranch %72 + %210 = OpLabel + OpStore %x_90 %true + OpStore %x_91 %int_1 + OpStore %x_173_phi %int_1 + OpBranch %72 + %72 = OpLabel + %213 = OpLoad %int %x_173_phi + OpReturnValue %213 + OpFunctionEnd + %main_1 = OpFunction %void None %214 + %217 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %59 + %param_6 = OpVariable %_ptr_Function_v2float Function %59 + %param_7 = OpVariable %_ptr_Function_v2float Function %59 + %param_8 = OpVariable %_ptr_Function_v2float Function %59 + %param_9 = OpVariable %_ptr_Function_v2float Function %59 + %223 = OpLoad %v4float %gl_FragCoord + %225 = OpAccessChain %_ptr_Uniform_v2float %x_24 %uint_0 + %226 = OpLoad %v2float %225 + %227 = OpCompositeExtract %float %223 0 + %228 = OpCompositeExtract %float %223 1 + %229 = OpCompositeConstruct %v2float %227 %228 + %230 = OpFDiv %v2float %229 %226 + OpStore %pos %230 + OpStore %param_6 %230 + OpStore %param_7 %233 + OpStore %param_8 %236 + OpStore %param_9 %239 + %240 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9 + %245 = OpIEqual %bool %240 %int_1 + OpSelectionMerge %246 None + OpBranchConditional %245 %247 %248 + %247 = OpLabel + OpStore %x_GLF_color %250 + OpBranch %246 + %248 = OpLabel + OpStore %x_GLF_color %251 + OpBranch %246 + %246 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %252 +%tint_symbol_1 = OpFunctionParameter %main_out + %256 = OpLabel + %257 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %257 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %214 + %259 = OpLabel + %260 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %260 + %261 = OpFunctionCall %void %main_1 + %263 = OpLoad %v4float %x_GLF_color + %264 = OpCompositeConstruct %main_out %263 + %262 = OpFunctionCall %void %tint_symbol_3 %264 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..d2eec410b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,151 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_24 : buf0; + +var x_GLF_color : vec4; + +fn cross2d_vf2_vf2_(a : ptr>, b : ptr>) -> f32 { + let x_79 : f32 = (*(a)).x; + let x_81 : f32 = (*(b)).y; + let x_84 : f32 = (*(b)).x; + let x_86 : f32 = (*(a)).y; + return ((x_79 * x_81) - (x_84 * x_86)); +} + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a_1 : ptr>, b_1 : ptr>, c : ptr>) -> i32 { + var x_90 : bool = false; + var x_91 : i32; + var pab : f32; + var param : vec2; + var param_1 : vec2; + var pbc : f32; + var param_2 : vec2; + var param_3 : vec2; + var pca : f32; + var param_4 : vec2; + var param_5 : vec2; + var x_140 : bool; + var x_168 : bool; + var x_141_phi : bool; + var x_169_phi : bool; + var x_173_phi : i32; + switch(0u) { + default: { + let x_94 : ptr = &((*(p)).x); + let x_95 : f32 = *(x_94); + let x_96 : ptr = &((*(a_1)).x); + let x_97 : f32 = *(x_96); + let x_99 : ptr = &((*(p)).y); + let x_100 : f32 = *(x_99); + let x_101 : ptr = &((*(a_1)).y); + let x_102 : f32 = *(x_101); + let x_105 : ptr = &((*(b_1)).x); + let x_106 : f32 = *(x_105); + let x_107 : f32 = *(x_96); + let x_109 : ptr = &((*(b_1)).y); + let x_110 : f32 = *(x_109); + let x_111 : f32 = *(x_101); + param = vec2((x_95 - x_97), (x_100 - x_102)); + param_1 = vec2((x_106 - x_107), (x_110 - x_111)); + let x_114 : f32 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_114; + let x_115 : f32 = *(x_94); + let x_116 : f32 = *(x_105); + let x_118 : f32 = *(x_99); + let x_119 : f32 = *(x_109); + let x_122 : ptr = &((*(c)).x); + let x_123 : f32 = *(x_122); + let x_124 : f32 = *(x_105); + let x_126 : ptr = &((*(c)).y); + let x_127 : f32 = *(x_126); + let x_128 : f32 = *(x_109); + param_2 = vec2((x_115 - x_116), (x_118 - x_119)); + param_3 = vec2((x_123 - x_124), (x_127 - x_128)); + let x_131 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_131; + let x_134 : bool = ((x_114 < 0.0) && (x_131 < 0.0)); + x_141_phi = x_134; + if (!(x_134)) { + x_140 = ((x_114 >= 0.0) && (x_131 >= 0.0)); + x_141_phi = x_140; + } + let x_141 : bool = x_141_phi; + if (!(x_141)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + let x_145 : f32 = *(x_94); + let x_146 : f32 = *(x_122); + let x_148 : f32 = *(x_99); + let x_149 : f32 = *(x_126); + let x_152 : f32 = *(x_96); + let x_153 : f32 = *(x_122); + let x_155 : f32 = *(x_101); + let x_156 : f32 = *(x_126); + param_4 = vec2((x_145 - x_146), (x_148 - x_149)); + param_5 = vec2((x_152 - x_153), (x_155 - x_156)); + let x_159 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_159; + let x_162 : bool = ((x_114 < 0.0) && (x_159 < 0.0)); + x_169_phi = x_162; + if (!(x_162)) { + x_168 = ((x_114 >= 0.0) && (x_159 >= 0.0)); + x_169_phi = x_168; + } + let x_169 : bool = x_169_phi; + if (!(x_169)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + x_90 = true; + x_91 = 1; + x_173_phi = 1; + } + } + let x_173 : i32 = x_173_phi; + return x_173; +} + +fn main_1() { + var pos : vec2; + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_67 : vec4 = gl_FragCoord; + let x_70 : vec2 = x_24.resolution; + let x_71 : vec2 = (vec2(x_67.x, x_67.y) / x_70); + pos = x_71; + param_6 = x_71; + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_72 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_72 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl new file mode 100644 index 0000000000..d2eec410b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl @@ -0,0 +1,151 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_24 : buf0; + +var x_GLF_color : vec4; + +fn cross2d_vf2_vf2_(a : ptr>, b : ptr>) -> f32 { + let x_79 : f32 = (*(a)).x; + let x_81 : f32 = (*(b)).y; + let x_84 : f32 = (*(b)).x; + let x_86 : f32 = (*(a)).y; + return ((x_79 * x_81) - (x_84 * x_86)); +} + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a_1 : ptr>, b_1 : ptr>, c : ptr>) -> i32 { + var x_90 : bool = false; + var x_91 : i32; + var pab : f32; + var param : vec2; + var param_1 : vec2; + var pbc : f32; + var param_2 : vec2; + var param_3 : vec2; + var pca : f32; + var param_4 : vec2; + var param_5 : vec2; + var x_140 : bool; + var x_168 : bool; + var x_141_phi : bool; + var x_169_phi : bool; + var x_173_phi : i32; + switch(0u) { + default: { + let x_94 : ptr = &((*(p)).x); + let x_95 : f32 = *(x_94); + let x_96 : ptr = &((*(a_1)).x); + let x_97 : f32 = *(x_96); + let x_99 : ptr = &((*(p)).y); + let x_100 : f32 = *(x_99); + let x_101 : ptr = &((*(a_1)).y); + let x_102 : f32 = *(x_101); + let x_105 : ptr = &((*(b_1)).x); + let x_106 : f32 = *(x_105); + let x_107 : f32 = *(x_96); + let x_109 : ptr = &((*(b_1)).y); + let x_110 : f32 = *(x_109); + let x_111 : f32 = *(x_101); + param = vec2((x_95 - x_97), (x_100 - x_102)); + param_1 = vec2((x_106 - x_107), (x_110 - x_111)); + let x_114 : f32 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_114; + let x_115 : f32 = *(x_94); + let x_116 : f32 = *(x_105); + let x_118 : f32 = *(x_99); + let x_119 : f32 = *(x_109); + let x_122 : ptr = &((*(c)).x); + let x_123 : f32 = *(x_122); + let x_124 : f32 = *(x_105); + let x_126 : ptr = &((*(c)).y); + let x_127 : f32 = *(x_126); + let x_128 : f32 = *(x_109); + param_2 = vec2((x_115 - x_116), (x_118 - x_119)); + param_3 = vec2((x_123 - x_124), (x_127 - x_128)); + let x_131 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_131; + let x_134 : bool = ((x_114 < 0.0) && (x_131 < 0.0)); + x_141_phi = x_134; + if (!(x_134)) { + x_140 = ((x_114 >= 0.0) && (x_131 >= 0.0)); + x_141_phi = x_140; + } + let x_141 : bool = x_141_phi; + if (!(x_141)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + let x_145 : f32 = *(x_94); + let x_146 : f32 = *(x_122); + let x_148 : f32 = *(x_99); + let x_149 : f32 = *(x_126); + let x_152 : f32 = *(x_96); + let x_153 : f32 = *(x_122); + let x_155 : f32 = *(x_101); + let x_156 : f32 = *(x_126); + param_4 = vec2((x_145 - x_146), (x_148 - x_149)); + param_5 = vec2((x_152 - x_153), (x_155 - x_156)); + let x_159 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_159; + let x_162 : bool = ((x_114 < 0.0) && (x_159 < 0.0)); + x_169_phi = x_162; + if (!(x_162)) { + x_168 = ((x_114 >= 0.0) && (x_159 >= 0.0)); + x_169_phi = x_168; + } + let x_169 : bool = x_169_phi; + if (!(x_169)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + x_90 = true; + x_91 = 1; + x_173_phi = 1; + } + } + let x_173 : i32 = x_173_phi; + return x_173; +} + +fn main_1() { + var pos : vec2; + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_67 : vec4 = gl_FragCoord; + let x_70 : vec2 = x_24.resolution; + let x_71 : vec2 = (vec2(x_67.x, x_67.y) / x_70); + pos = x_71; + param_6 = x_71; + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_72 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_72 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..fd9d668103 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,159 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_24 : register(b0, space0) { + uint4 x_24[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float cross2d_vf2_vf2_(inout float2 a, inout float2 b) { + const float x_79 = a.x; + const float x_81 = b.y; + const float x_84 = b.x; + const float x_86 = a.y; + return ((x_79 * x_81) - (x_84 * x_86)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout float2 b_1, inout float2 c) { + bool x_90 = false; + int x_91 = 0; + float pab = 0.0f; + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + float pbc = 0.0f; + float2 param_2 = float2(0.0f, 0.0f); + float2 param_3 = float2(0.0f, 0.0f); + float pca = 0.0f; + float2 param_4 = float2(0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + bool x_140 = false; + bool x_168 = false; + bool x_141_phi = false; + bool x_169_phi = false; + int x_173_phi = 0; + switch(0u) { + default: { + const float x_95 = p.x; + const float x_97 = a_1.x; + const float x_100 = p.y; + const float x_102 = a_1.y; + const float x_106 = b_1.x; + const float x_107 = a_1.x; + const float x_110 = b_1.y; + const float x_111 = a_1.y; + param = float2((x_95 - x_97), (x_100 - x_102)); + param_1 = float2((x_106 - x_107), (x_110 - x_111)); + const float x_114 = cross2d_vf2_vf2_(param, param_1); + pab = x_114; + const float x_115 = p.x; + const float x_116 = b_1.x; + const float x_118 = p.y; + const float x_119 = b_1.y; + const float x_123 = c.x; + const float x_124 = b_1.x; + const float x_127 = c.y; + const float x_128 = b_1.y; + param_2 = float2((x_115 - x_116), (x_118 - x_119)); + param_3 = float2((x_123 - x_124), (x_127 - x_128)); + const float x_131 = cross2d_vf2_vf2_(param_2, param_3); + pbc = x_131; + bool tint_tmp = (x_114 < 0.0f); + if (tint_tmp) { + tint_tmp = (x_131 < 0.0f); + } + const bool x_134 = (tint_tmp); + x_141_phi = x_134; + if (!(x_134)) { + bool tint_tmp_1 = (x_114 >= 0.0f); + if (tint_tmp_1) { + tint_tmp_1 = (x_131 >= 0.0f); + } + x_140 = (tint_tmp_1); + x_141_phi = x_140; + } + if (!(x_141_phi)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + const float x_145 = p.x; + const float x_146 = c.x; + const float x_148 = p.y; + const float x_149 = c.y; + const float x_152 = a_1.x; + const float x_153 = c.x; + const float x_155 = a_1.y; + const float x_156 = c.y; + param_4 = float2((x_145 - x_146), (x_148 - x_149)); + param_5 = float2((x_152 - x_153), (x_155 - x_156)); + const float x_159 = cross2d_vf2_vf2_(param_4, param_5); + pca = x_159; + bool tint_tmp_2 = (x_114 < 0.0f); + if (tint_tmp_2) { + tint_tmp_2 = (x_159 < 0.0f); + } + const bool x_162 = (tint_tmp_2); + x_169_phi = x_162; + if (!(x_162)) { + bool tint_tmp_3 = (x_114 >= 0.0f); + if (tint_tmp_3) { + tint_tmp_3 = (x_159 >= 0.0f); + } + x_168 = (tint_tmp_3); + x_169_phi = x_168; + } + if (!(x_169_phi)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + x_90 = true; + x_91 = 1; + x_173_phi = 1; + break; + } + } + return x_173_phi; +} + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + float2 param_6 = float2(0.0f, 0.0f); + float2 param_7 = float2(0.0f, 0.0f); + float2 param_8 = float2(0.0f, 0.0f); + float2 param_9 = float2(0.0f, 0.0f); + const float4 x_67 = gl_FragCoord; + const float2 x_70 = asfloat(x_24[0].xy); + const float2 x_71 = (float2(x_67.x, x_67.y) / x_70); + pos = x_71; + param_6 = x_71; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + const int x_72 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9); + if ((x_72 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..c8cbf19939 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,145 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float cross2d_vf2_vf2_(thread float2* const a, thread float2* const b) { + float const x_79 = (*(a)).x; + float const x_81 = (*(b)).y; + float const x_84 = (*(b)).x; + float const x_86 = (*(a)).y; + return ((x_79 * x_81) - (x_84 * x_86)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) { + bool x_90 = false; + int x_91 = 0; + float pab = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + float pbc = 0.0f; + float2 param_2 = 0.0f; + float2 param_3 = 0.0f; + float pca = 0.0f; + float2 param_4 = 0.0f; + float2 param_5 = 0.0f; + bool x_140 = false; + bool x_168 = false; + bool x_141_phi = false; + bool x_169_phi = false; + int x_173_phi = 0; + switch(0u) { + default: { + float const x_95 = (*(p)).x; + float const x_97 = (*(a_1)).x; + float const x_100 = (*(p)).y; + float const x_102 = (*(a_1)).y; + float const x_106 = (*(b_1)).x; + float const x_107 = (*(a_1)).x; + float const x_110 = (*(b_1)).y; + float const x_111 = (*(a_1)).y; + param = float2((x_95 - x_97), (x_100 - x_102)); + param_1 = float2((x_106 - x_107), (x_110 - x_111)); + float const x_114 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_114; + float const x_115 = (*(p)).x; + float const x_116 = (*(b_1)).x; + float const x_118 = (*(p)).y; + float const x_119 = (*(b_1)).y; + float const x_123 = (*(c)).x; + float const x_124 = (*(b_1)).x; + float const x_127 = (*(c)).y; + float const x_128 = (*(b_1)).y; + param_2 = float2((x_115 - x_116), (x_118 - x_119)); + param_3 = float2((x_123 - x_124), (x_127 - x_128)); + float const x_131 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_131; + bool const x_134 = ((x_114 < 0.0f) && (x_131 < 0.0f)); + x_141_phi = x_134; + if (!(x_134)) { + x_140 = ((x_114 >= 0.0f) && (x_131 >= 0.0f)); + x_141_phi = x_140; + } + bool const x_141 = x_141_phi; + if (!(x_141)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + float const x_145 = (*(p)).x; + float const x_146 = (*(c)).x; + float const x_148 = (*(p)).y; + float const x_149 = (*(c)).y; + float const x_152 = (*(a_1)).x; + float const x_153 = (*(c)).x; + float const x_155 = (*(a_1)).y; + float const x_156 = (*(c)).y; + param_4 = float2((x_145 - x_146), (x_148 - x_149)); + param_5 = float2((x_152 - x_153), (x_155 - x_156)); + float const x_159 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_159; + bool const x_162 = ((x_114 < 0.0f) && (x_159 < 0.0f)); + x_169_phi = x_162; + if (!(x_162)) { + x_168 = ((x_114 >= 0.0f) && (x_159 >= 0.0f)); + x_169_phi = x_168; + } + bool const x_169 = x_169_phi; + if (!(x_169)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + x_90 = true; + x_91 = 1; + x_173_phi = 1; + break; + } + } + int const x_173 = x_173_phi; + return x_173; +} + +void main_1(constant buf0& x_24, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 pos = 0.0f; + float2 param_6 = 0.0f; + float2 param_7 = 0.0f; + float2 param_8 = 0.0f; + float2 param_9 = 0.0f; + float4 const x_67 = *(tint_symbol_5); + float2 const x_70 = x_24.resolution; + float2 const x_71 = (float2(x_67.x, x_67.y) / x_70); + pos = x_71; + param_6 = x_71; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + int const x_72 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_72 == 1)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_24 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_24, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..59e04f8590 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,360 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 265 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_24 "x_24" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %cross2d_vf2_vf2_ "cross2d_vf2_vf2_" + OpName %a "a" + OpName %b "b" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_" + OpName %p "p" + OpName %a_1 "a_1" + OpName %b_1 "b_1" + OpName %c "c" + OpName %x_90 "x_90" + OpName %x_91 "x_91" + OpName %pab "pab" + OpName %param "param" + OpName %param_1 "param_1" + OpName %pbc "pbc" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %pca "pca" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %x_140 "x_140" + OpName %x_168 "x_168" + OpName %x_141_phi "x_141_phi" + OpName %x_169_phi "x_169_phi" + OpName %x_173_phi "x_173_phi" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_24 NonWritable + OpDecorate %x_24 DescriptorSet 0 + OpDecorate %x_24 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_24 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %40 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %52 = OpConstantNull %bool +%_ptr_Function_int = OpTypePointer Function %int + %55 = OpConstantNull %int + %57 = OpConstantNull %float + %59 = OpConstantNull %v2float + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %214 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %233 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %236 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %239 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 + %float_1 = OpConstant %float 1 + %250 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %251 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %252 = OpTypeFunction %void %main_out +%cross2d_vf2_vf2_ = OpFunction %float None %15 + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %20 = OpLabel + %25 = OpAccessChain %_ptr_Function_float %a %uint_0 + %26 = OpLoad %float %25 + %29 = OpAccessChain %_ptr_Function_float %b %uint_1 + %30 = OpLoad %float %29 + %32 = OpAccessChain %_ptr_Function_float %b %uint_0 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Function_float %a %uint_1 + %36 = OpLoad %float %35 + %37 = OpFMul %float %26 %30 + %38 = OpFMul %float %33 %36 + %39 = OpFSub %float %37 %38 + OpReturnValue %39 + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %40 + %p = OpFunctionParameter %_ptr_Function_v2float + %a_1 = OpFunctionParameter %_ptr_Function_v2float + %b_1 = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %47 = OpLabel + %x_90 = OpVariable %_ptr_Function_bool Function %52 + %x_91 = OpVariable %_ptr_Function_int Function %55 + %pab = OpVariable %_ptr_Function_float Function %57 + %param = OpVariable %_ptr_Function_v2float Function %59 + %param_1 = OpVariable %_ptr_Function_v2float Function %59 + %pbc = OpVariable %_ptr_Function_float Function %57 + %param_2 = OpVariable %_ptr_Function_v2float Function %59 + %param_3 = OpVariable %_ptr_Function_v2float Function %59 + %pca = OpVariable %_ptr_Function_float Function %57 + %param_4 = OpVariable %_ptr_Function_v2float Function %59 + %param_5 = OpVariable %_ptr_Function_v2float Function %59 + %x_140 = OpVariable %_ptr_Function_bool Function %52 + %x_168 = OpVariable %_ptr_Function_bool Function %52 + %x_141_phi = OpVariable %_ptr_Function_bool Function %52 + %x_169_phi = OpVariable %_ptr_Function_bool Function %52 + %x_173_phi = OpVariable %_ptr_Function_int Function %55 + OpStore %x_90 %false + OpSelectionMerge %72 None + OpSwitch %uint_0 %73 + %73 = OpLabel + %75 = OpAccessChain %_ptr_Function_float %p %uint_0 + %76 = OpLoad %float %75 + %78 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %79 = OpLoad %float %78 + %81 = OpAccessChain %_ptr_Function_float %p %uint_1 + %82 = OpLoad %float %81 + %84 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %85 = OpLoad %float %84 + %87 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %88 = OpLoad %float %87 + %90 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %91 = OpLoad %float %90 + %93 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %94 = OpLoad %float %93 + %96 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %97 = OpLoad %float %96 + %98 = OpFSub %float %76 %79 + %99 = OpFSub %float %82 %85 + %100 = OpCompositeConstruct %v2float %98 %99 + OpStore %param %100 + %101 = OpFSub %float %88 %91 + %102 = OpFSub %float %94 %97 + %103 = OpCompositeConstruct %v2float %101 %102 + OpStore %param_1 %103 + %104 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_1 + OpStore %pab %104 + %108 = OpAccessChain %_ptr_Function_float %p %uint_0 + %109 = OpLoad %float %108 + %111 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %112 = OpLoad %float %111 + %114 = OpAccessChain %_ptr_Function_float %p %uint_1 + %115 = OpLoad %float %114 + %117 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %118 = OpLoad %float %117 + %120 = OpAccessChain %_ptr_Function_float %c %uint_0 + %121 = OpLoad %float %120 + %123 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %124 = OpLoad %float %123 + %126 = OpAccessChain %_ptr_Function_float %c %uint_1 + %127 = OpLoad %float %126 + %129 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %130 = OpLoad %float %129 + %131 = OpFSub %float %109 %112 + %132 = OpFSub %float %115 %118 + %133 = OpCompositeConstruct %v2float %131 %132 + OpStore %param_2 %133 + %134 = OpFSub %float %121 %124 + %135 = OpFSub %float %127 %130 + %136 = OpCompositeConstruct %v2float %134 %135 + OpStore %param_3 %136 + %137 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_2 %param_3 + OpStore %pbc %137 + %141 = OpFOrdLessThan %bool %104 %float_0 + OpSelectionMerge %142 None + OpBranchConditional %141 %143 %142 + %143 = OpLabel + %144 = OpFOrdLessThan %bool %137 %float_0 + OpBranch %142 + %142 = OpLabel + %145 = OpPhi %bool %141 %73 %144 %143 + OpStore %x_141_phi %145 + %146 = OpLogicalNot %bool %145 + OpSelectionMerge %147 None + OpBranchConditional %146 %148 %147 + %148 = OpLabel + %149 = OpFOrdGreaterThanEqual %bool %104 %float_0 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %150 + %151 = OpLabel + %152 = OpFOrdGreaterThanEqual %bool %137 %float_0 + OpBranch %150 + %150 = OpLabel + %153 = OpPhi %bool %149 %148 %152 %151 + OpStore %x_140 %153 + %154 = OpLoad %bool %x_140 + OpStore %x_141_phi %154 + OpBranch %147 + %147 = OpLabel + %155 = OpLoad %bool %x_141_phi + %156 = OpLogicalNot %bool %155 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %157 + %158 = OpLabel + OpStore %x_90 %true + OpStore %x_91 %int_0 + OpStore %x_173_phi %int_0 + OpBranch %72 + %157 = OpLabel + %162 = OpAccessChain %_ptr_Function_float %p %uint_0 + %163 = OpLoad %float %162 + %165 = OpAccessChain %_ptr_Function_float %c %uint_0 + %166 = OpLoad %float %165 + %168 = OpAccessChain %_ptr_Function_float %p %uint_1 + %169 = OpLoad %float %168 + %171 = OpAccessChain %_ptr_Function_float %c %uint_1 + %172 = OpLoad %float %171 + %174 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %175 = OpLoad %float %174 + %177 = OpAccessChain %_ptr_Function_float %c %uint_0 + %178 = OpLoad %float %177 + %180 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %181 = OpLoad %float %180 + %183 = OpAccessChain %_ptr_Function_float %c %uint_1 + %184 = OpLoad %float %183 + %185 = OpFSub %float %163 %166 + %186 = OpFSub %float %169 %172 + %187 = OpCompositeConstruct %v2float %185 %186 + OpStore %param_4 %187 + %188 = OpFSub %float %175 %178 + %189 = OpFSub %float %181 %184 + %190 = OpCompositeConstruct %v2float %188 %189 + OpStore %param_5 %190 + %191 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5 + OpStore %pca %191 + %194 = OpFOrdLessThan %bool %104 %float_0 + OpSelectionMerge %195 None + OpBranchConditional %194 %196 %195 + %196 = OpLabel + %197 = OpFOrdLessThan %bool %191 %float_0 + OpBranch %195 + %195 = OpLabel + %198 = OpPhi %bool %194 %157 %197 %196 + OpStore %x_169_phi %198 + %199 = OpLogicalNot %bool %198 + OpSelectionMerge %200 None + OpBranchConditional %199 %201 %200 + %201 = OpLabel + %202 = OpFOrdGreaterThanEqual %bool %104 %float_0 + OpSelectionMerge %203 None + OpBranchConditional %202 %204 %203 + %204 = OpLabel + %205 = OpFOrdGreaterThanEqual %bool %191 %float_0 + OpBranch %203 + %203 = OpLabel + %206 = OpPhi %bool %202 %201 %205 %204 + OpStore %x_168 %206 + %207 = OpLoad %bool %x_168 + OpStore %x_169_phi %207 + OpBranch %200 + %200 = OpLabel + %208 = OpLoad %bool %x_169_phi + %209 = OpLogicalNot %bool %208 + OpSelectionMerge %210 None + OpBranchConditional %209 %211 %210 + %211 = OpLabel + OpStore %x_90 %true + OpStore %x_91 %int_0 + OpStore %x_173_phi %int_0 + OpBranch %72 + %210 = OpLabel + OpStore %x_90 %true + OpStore %x_91 %int_1 + OpStore %x_173_phi %int_1 + OpBranch %72 + %72 = OpLabel + %213 = OpLoad %int %x_173_phi + OpReturnValue %213 + OpFunctionEnd + %main_1 = OpFunction %void None %214 + %217 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %59 + %param_6 = OpVariable %_ptr_Function_v2float Function %59 + %param_7 = OpVariable %_ptr_Function_v2float Function %59 + %param_8 = OpVariable %_ptr_Function_v2float Function %59 + %param_9 = OpVariable %_ptr_Function_v2float Function %59 + %223 = OpLoad %v4float %gl_FragCoord + %225 = OpAccessChain %_ptr_Uniform_v2float %x_24 %uint_0 + %226 = OpLoad %v2float %225 + %227 = OpCompositeExtract %float %223 0 + %228 = OpCompositeExtract %float %223 1 + %229 = OpCompositeConstruct %v2float %227 %228 + %230 = OpFDiv %v2float %229 %226 + OpStore %pos %230 + OpStore %param_6 %230 + OpStore %param_7 %233 + OpStore %param_8 %236 + OpStore %param_9 %239 + %240 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9 + %245 = OpIEqual %bool %240 %int_1 + OpSelectionMerge %246 None + OpBranchConditional %245 %247 %248 + %247 = OpLabel + OpStore %x_GLF_color %250 + OpBranch %246 + %248 = OpLabel + OpStore %x_GLF_color %251 + OpBranch %246 + %246 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %252 +%tint_symbol_1 = OpFunctionParameter %main_out + %256 = OpLabel + %257 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %257 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %214 + %259 = OpLabel + %260 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %260 + %261 = OpFunctionCall %void %main_1 + %263 = OpLoad %v4float %x_GLF_color + %264 = OpCompositeConstruct %main_out %263 + %262 = OpFunctionCall %void %tint_symbol_3 %264 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..d2eec410b9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-array-nested-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,151 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_24 : buf0; + +var x_GLF_color : vec4; + +fn cross2d_vf2_vf2_(a : ptr>, b : ptr>) -> f32 { + let x_79 : f32 = (*(a)).x; + let x_81 : f32 = (*(b)).y; + let x_84 : f32 = (*(b)).x; + let x_86 : f32 = (*(a)).y; + return ((x_79 * x_81) - (x_84 * x_86)); +} + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a_1 : ptr>, b_1 : ptr>, c : ptr>) -> i32 { + var x_90 : bool = false; + var x_91 : i32; + var pab : f32; + var param : vec2; + var param_1 : vec2; + var pbc : f32; + var param_2 : vec2; + var param_3 : vec2; + var pca : f32; + var param_4 : vec2; + var param_5 : vec2; + var x_140 : bool; + var x_168 : bool; + var x_141_phi : bool; + var x_169_phi : bool; + var x_173_phi : i32; + switch(0u) { + default: { + let x_94 : ptr = &((*(p)).x); + let x_95 : f32 = *(x_94); + let x_96 : ptr = &((*(a_1)).x); + let x_97 : f32 = *(x_96); + let x_99 : ptr = &((*(p)).y); + let x_100 : f32 = *(x_99); + let x_101 : ptr = &((*(a_1)).y); + let x_102 : f32 = *(x_101); + let x_105 : ptr = &((*(b_1)).x); + let x_106 : f32 = *(x_105); + let x_107 : f32 = *(x_96); + let x_109 : ptr = &((*(b_1)).y); + let x_110 : f32 = *(x_109); + let x_111 : f32 = *(x_101); + param = vec2((x_95 - x_97), (x_100 - x_102)); + param_1 = vec2((x_106 - x_107), (x_110 - x_111)); + let x_114 : f32 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_114; + let x_115 : f32 = *(x_94); + let x_116 : f32 = *(x_105); + let x_118 : f32 = *(x_99); + let x_119 : f32 = *(x_109); + let x_122 : ptr = &((*(c)).x); + let x_123 : f32 = *(x_122); + let x_124 : f32 = *(x_105); + let x_126 : ptr = &((*(c)).y); + let x_127 : f32 = *(x_126); + let x_128 : f32 = *(x_109); + param_2 = vec2((x_115 - x_116), (x_118 - x_119)); + param_3 = vec2((x_123 - x_124), (x_127 - x_128)); + let x_131 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_131; + let x_134 : bool = ((x_114 < 0.0) && (x_131 < 0.0)); + x_141_phi = x_134; + if (!(x_134)) { + x_140 = ((x_114 >= 0.0) && (x_131 >= 0.0)); + x_141_phi = x_140; + } + let x_141 : bool = x_141_phi; + if (!(x_141)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + let x_145 : f32 = *(x_94); + let x_146 : f32 = *(x_122); + let x_148 : f32 = *(x_99); + let x_149 : f32 = *(x_126); + let x_152 : f32 = *(x_96); + let x_153 : f32 = *(x_122); + let x_155 : f32 = *(x_101); + let x_156 : f32 = *(x_126); + param_4 = vec2((x_145 - x_146), (x_148 - x_149)); + param_5 = vec2((x_152 - x_153), (x_155 - x_156)); + let x_159 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_159; + let x_162 : bool = ((x_114 < 0.0) && (x_159 < 0.0)); + x_169_phi = x_162; + if (!(x_162)) { + x_168 = ((x_114 >= 0.0) && (x_159 >= 0.0)); + x_169_phi = x_168; + } + let x_169 : bool = x_169_phi; + if (!(x_169)) { + x_90 = true; + x_91 = 0; + x_173_phi = 0; + break; + } + x_90 = true; + x_91 = 1; + x_173_phi = 1; + } + } + let x_173 : i32 = x_173_phi; + return x_173; +} + +fn main_1() { + var pos : vec2; + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_67 : vec4 = gl_FragCoord; + let x_70 : vec2 = x_24.resolution; + let x_71 : vec2 = (vec2(x_67.x, x_67.y) / x_70); + pos = x_71; + param_6 = x_71; + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_72 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_72 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm new file mode 100644 index 0000000000..43c7e0babd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm @@ -0,0 +1,250 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %cross2d_vf2_vf2_ "cross2d(vf2;vf2;" + OpName %a "a" + OpName %b "b" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %p "p" + OpName %a_0 "a" + OpName %b_0 "b" + OpName %c "c" + OpName %pab "pab" + OpName %param "param" + OpName %param_0 "param" + OpName %pbc "pbc" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %pca "pca" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %pos "pos" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %param_5 "param" + OpName %param_6 "param" + OpName %param_7 "param" + OpName %param_8 "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %30 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %34 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float + %int = OpTypeInt 32 1 + %36 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %51 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %54 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %57 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %60 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %61 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main = OpFunction %void None %30 + %62 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function + %param_5 = OpVariable %_ptr_Function_v2float Function + %param_6 = OpVariable %_ptr_Function_v2float Function + %param_7 = OpVariable %_ptr_Function_v2float Function + %param_8 = OpVariable %_ptr_Function_v2float Function + %63 = OpLoad %v4float %gl_FragCoord + %64 = OpVectorShuffle %v2float %63 %63 0 1 + %65 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %66 = OpLoad %v2float %65 + %67 = OpFDiv %v2float %64 %66 + OpStore %pos %67 + %68 = OpLoad %v2float %pos + OpStore %param_5 %68 + OpStore %param_6 %51 + OpStore %param_7 %54 + OpStore %param_8 %57 + %69 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_5 %param_6 %param_7 %param_8 + %70 = OpIEqual %bool %69 %int_1 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpStore %_GLF_color %60 + OpBranch %71 + %73 = OpLabel + OpStore %_GLF_color %61 + OpBranch %71 + %71 = OpLabel + OpReturn + OpFunctionEnd +%cross2d_vf2_vf2_ = OpFunction %float None %34 + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %74 = OpLabel + %75 = OpAccessChain %_ptr_Function_float %a %uint_0 + %76 = OpLoad %float %75 + %77 = OpAccessChain %_ptr_Function_float %b %uint_1 + %78 = OpLoad %float %77 + %79 = OpFMul %float %76 %78 + %80 = OpAccessChain %_ptr_Function_float %b %uint_0 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Function_float %a %uint_1 + %83 = OpLoad %float %82 + %84 = OpFMul %float %81 %83 + %85 = OpFSub %float %79 %84 + OpReturnValue %85 + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %36 + %p = OpFunctionParameter %_ptr_Function_v2float + %a_0 = OpFunctionParameter %_ptr_Function_v2float + %b_0 = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %86 = OpLabel + %pab = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_v2float Function + %param_0 = OpVariable %_ptr_Function_v2float Function + %pbc = OpVariable %_ptr_Function_float Function + %param_1 = OpVariable %_ptr_Function_v2float Function + %param_2 = OpVariable %_ptr_Function_v2float Function + %pca = OpVariable %_ptr_Function_float Function + %param_3 = OpVariable %_ptr_Function_v2float Function + %param_4 = OpVariable %_ptr_Function_v2float Function + %87 = OpAccessChain %_ptr_Function_float %p %uint_0 + %88 = OpLoad %float %87 + %89 = OpAccessChain %_ptr_Function_float %a_0 %uint_0 + %90 = OpLoad %float %89 + %91 = OpFSub %float %88 %90 + %92 = OpAccessChain %_ptr_Function_float %p %uint_1 + %93 = OpLoad %float %92 + %94 = OpAccessChain %_ptr_Function_float %a_0 %uint_1 + %95 = OpLoad %float %94 + %96 = OpFSub %float %93 %95 + %97 = OpCompositeConstruct %v2float %91 %96 + %98 = OpAccessChain %_ptr_Function_float %b_0 %uint_0 + %99 = OpLoad %float %98 + %100 = OpLoad %float %89 + %101 = OpFSub %float %99 %100 + %102 = OpAccessChain %_ptr_Function_float %b_0 %uint_1 + %103 = OpLoad %float %102 + %104 = OpLoad %float %94 + %105 = OpFSub %float %103 %104 + %106 = OpCompositeConstruct %v2float %101 %105 + OpStore %param %97 + OpStore %param_0 %106 + %107 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_0 + OpStore %pab %107 + %108 = OpLoad %float %87 + %109 = OpLoad %float %98 + %110 = OpFSub %float %108 %109 + %111 = OpLoad %float %92 + %112 = OpLoad %float %102 + %113 = OpFSub %float %111 %112 + %114 = OpCompositeConstruct %v2float %110 %113 + %115 = OpAccessChain %_ptr_Function_float %c %uint_0 + %116 = OpLoad %float %115 + %117 = OpLoad %float %98 + %118 = OpFSub %float %116 %117 + %119 = OpAccessChain %_ptr_Function_float %c %uint_1 + %120 = OpLoad %float %119 + %121 = OpLoad %float %102 + %122 = OpFSub %float %120 %121 + %123 = OpCompositeConstruct %v2float %118 %122 + OpStore %param_1 %114 + OpStore %param_2 %123 + %124 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_1 %param_2 + OpStore %pbc %124 + %125 = OpLoad %float %pab + %126 = OpFOrdLessThan %bool %125 %float_0 + %127 = OpLoad %float %pbc + %128 = OpFOrdLessThan %bool %127 %float_0 + %129 = OpLogicalAnd %bool %126 %128 + %130 = OpLogicalNot %bool %129 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %131 + %132 = OpLabel + %133 = OpLoad %float %pab + %134 = OpFOrdGreaterThanEqual %bool %133 %float_0 + %135 = OpLoad %float %pbc + %136 = OpFOrdGreaterThanEqual %bool %135 %float_0 + %137 = OpLogicalAnd %bool %134 %136 + OpBranch %131 + %131 = OpLabel + %138 = OpPhi %bool %129 %86 %137 %132 + %139 = OpLogicalNot %bool %138 + OpSelectionMerge %140 None + OpBranchConditional %139 %141 %140 + %141 = OpLabel + OpReturnValue %int_0 + %140 = OpLabel + %142 = OpLoad %float %87 + %143 = OpLoad %float %115 + %144 = OpFSub %float %142 %143 + %145 = OpLoad %float %92 + %146 = OpLoad %float %119 + %147 = OpFSub %float %145 %146 + %148 = OpCompositeConstruct %v2float %144 %147 + %149 = OpLoad %float %89 + %150 = OpLoad %float %115 + %151 = OpFSub %float %149 %150 + %152 = OpLoad %float %94 + %153 = OpLoad %float %119 + %154 = OpFSub %float %152 %153 + %155 = OpCompositeConstruct %v2float %151 %154 + OpStore %param_3 %148 + OpStore %param_4 %155 + %156 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_3 %param_4 + OpStore %pca %156 + %157 = OpLoad %float %pab + %158 = OpFOrdLessThan %bool %157 %float_0 + %159 = OpLoad %float %pca + %160 = OpFOrdLessThan %bool %159 %float_0 + %161 = OpLogicalAnd %bool %158 %160 + %162 = OpLogicalNot %bool %161 + OpSelectionMerge %163 None + OpBranchConditional %162 %164 %163 + %164 = OpLabel + %165 = OpLoad %float %pab + %166 = OpFOrdGreaterThanEqual %bool %165 %float_0 + %167 = OpLoad %float %pca + %168 = OpFOrdGreaterThanEqual %bool %167 %float_0 + %169 = OpLogicalAnd %bool %166 %168 + OpBranch %163 + %163 = OpLabel + %170 = OpPhi %bool %161 %140 %169 %164 + %171 = OpLogicalNot %bool %170 + OpSelectionMerge %172 None + OpBranchConditional %171 %173 %172 + %173 = OpLabel + OpReturnValue %int_0 + %172 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..421b7ed216 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.hlsl @@ -0,0 +1,141 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_24 : register(b0, space0) { + uint4 x_24[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float cross2d_vf2_vf2_(inout float2 a, inout float2 b) { + const float x_76 = a.x; + const float x_78 = b.y; + const float x_81 = b.x; + const float x_83 = a.y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout float2 b_1, inout float2 c) { + float pab = 0.0f; + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + float pbc = 0.0f; + float2 param_2 = float2(0.0f, 0.0f); + float2 param_3 = float2(0.0f, 0.0f); + float pca = 0.0f; + float2 param_4 = float2(0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + bool x_137 = false; + bool x_169 = false; + bool x_138_phi = false; + bool x_170_phi = false; + const float x_88 = p.x; + const float x_90 = a_1.x; + const float x_93 = p.y; + const float x_95 = a_1.y; + const float x_99 = b_1.x; + const float x_100 = a_1.x; + const float x_103 = b_1.y; + const float x_104 = a_1.y; + param = float2((x_88 - x_90), (x_93 - x_95)); + param_1 = float2((x_99 - x_100), (x_103 - x_104)); + const float x_107 = cross2d_vf2_vf2_(param, param_1); + pab = x_107; + const float x_108 = p.x; + const float x_109 = b_1.x; + const float x_111 = p.y; + const float x_112 = b_1.y; + const float x_116 = c.x; + const float x_117 = b_1.x; + const float x_120 = c.y; + const float x_121 = b_1.y; + param_2 = float2((x_108 - x_109), (x_111 - x_112)); + param_3 = float2((x_116 - x_117), (x_120 - x_121)); + const float x_124 = cross2d_vf2_vf2_(param_2, param_3); + pbc = x_124; + bool tint_tmp = (pab < 0.0f); + if (tint_tmp) { + tint_tmp = (pbc < 0.0f); + } + const bool x_129 = (tint_tmp); + x_138_phi = x_129; + if (!(x_129)) { + bool tint_tmp_1 = (pab >= 0.0f); + if (tint_tmp_1) { + tint_tmp_1 = (pbc >= 0.0f); + } + x_137 = (tint_tmp_1); + x_138_phi = x_137; + } + if (!(x_138_phi)) { + return 0; + } + const float x_142 = p.x; + const float x_143 = c.x; + const float x_145 = p.y; + const float x_146 = c.y; + const float x_149 = a_1.x; + const float x_150 = c.x; + const float x_152 = a_1.y; + const float x_153 = c.y; + param_4 = float2((x_142 - x_143), (x_145 - x_146)); + param_5 = float2((x_149 - x_150), (x_152 - x_153)); + const float x_156 = cross2d_vf2_vf2_(param_4, param_5); + pca = x_156; + bool tint_tmp_2 = (pab < 0.0f); + if (tint_tmp_2) { + tint_tmp_2 = (pca < 0.0f); + } + const bool x_161 = (tint_tmp_2); + x_170_phi = x_161; + if (!(x_161)) { + bool tint_tmp_3 = (pab >= 0.0f); + if (tint_tmp_3) { + tint_tmp_3 = (pca >= 0.0f); + } + x_169 = (tint_tmp_3); + x_170_phi = x_169; + } + if (!(x_170_phi)) { + return 0; + } + return 1; +} + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + float2 param_6 = float2(0.0f, 0.0f); + float2 param_7 = float2(0.0f, 0.0f); + float2 param_8 = float2(0.0f, 0.0f); + float2 param_9 = float2(0.0f, 0.0f); + const float4 x_63 = gl_FragCoord; + const float2 x_66 = asfloat(x_24[0].xy); + pos = (float2(x_63.x, x_63.y) / x_66); + param_6 = pos; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + const int x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9); + if ((x_69 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.msl new file mode 100644 index 0000000000..ed7f0784eb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.msl @@ -0,0 +1,135 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float cross2d_vf2_vf2_(thread float2* const a, thread float2* const b) { + float const x_76 = (*(a)).x; + float const x_78 = (*(b)).y; + float const x_81 = (*(b)).x; + float const x_83 = (*(a)).y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) { + float pab = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + float pbc = 0.0f; + float2 param_2 = 0.0f; + float2 param_3 = 0.0f; + float pca = 0.0f; + float2 param_4 = 0.0f; + float2 param_5 = 0.0f; + bool x_137 = false; + bool x_169 = false; + bool x_138_phi = false; + bool x_170_phi = false; + float const x_88 = (*(p)).x; + float const x_90 = (*(a_1)).x; + float const x_93 = (*(p)).y; + float const x_95 = (*(a_1)).y; + float const x_99 = (*(b_1)).x; + float const x_100 = (*(a_1)).x; + float const x_103 = (*(b_1)).y; + float const x_104 = (*(a_1)).y; + param = float2((x_88 - x_90), (x_93 - x_95)); + param_1 = float2((x_99 - x_100), (x_103 - x_104)); + float const x_107 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_107; + float const x_108 = (*(p)).x; + float const x_109 = (*(b_1)).x; + float const x_111 = (*(p)).y; + float const x_112 = (*(b_1)).y; + float const x_116 = (*(c)).x; + float const x_117 = (*(b_1)).x; + float const x_120 = (*(c)).y; + float const x_121 = (*(b_1)).y; + param_2 = float2((x_108 - x_109), (x_111 - x_112)); + param_3 = float2((x_116 - x_117), (x_120 - x_121)); + float const x_124 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_124; + float const x_125 = pab; + float const x_127 = pbc; + bool const x_129 = ((x_125 < 0.0f) && (x_127 < 0.0f)); + x_138_phi = x_129; + if (!(x_129)) { + float const x_133 = pab; + float const x_135 = pbc; + x_137 = ((x_133 >= 0.0f) && (x_135 >= 0.0f)); + x_138_phi = x_137; + } + bool const x_138 = x_138_phi; + if (!(x_138)) { + return 0; + } + float const x_142 = (*(p)).x; + float const x_143 = (*(c)).x; + float const x_145 = (*(p)).y; + float const x_146 = (*(c)).y; + float const x_149 = (*(a_1)).x; + float const x_150 = (*(c)).x; + float const x_152 = (*(a_1)).y; + float const x_153 = (*(c)).y; + param_4 = float2((x_142 - x_143), (x_145 - x_146)); + param_5 = float2((x_149 - x_150), (x_152 - x_153)); + float const x_156 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_156; + float const x_157 = pab; + float const x_159 = pca; + bool const x_161 = ((x_157 < 0.0f) && (x_159 < 0.0f)); + x_170_phi = x_161; + if (!(x_161)) { + float const x_165 = pab; + float const x_167 = pca; + x_169 = ((x_165 >= 0.0f) && (x_167 >= 0.0f)); + x_170_phi = x_169; + } + bool const x_170 = x_170_phi; + if (!(x_170)) { + return 0; + } + return 1; +} + +void main_1(constant buf0& x_24, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 pos = 0.0f; + float2 param_6 = 0.0f; + float2 param_7 = 0.0f; + float2 param_8 = 0.0f; + float2 param_9 = 0.0f; + float4 const x_63 = *(tint_symbol_5); + float2 const x_66 = x_24.resolution; + pos = (float2(x_63.x, x_63.y) / x_66); + float2 const x_68 = pos; + param_6 = x_68; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + int const x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_69 == 1)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_24 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_24, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..dadcc8e970 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.spvasm @@ -0,0 +1,343 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 264 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_24 "x_24" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %cross2d_vf2_vf2_ "cross2d_vf2_vf2_" + OpName %a "a" + OpName %b "b" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_" + OpName %p "p" + OpName %a_1 "a_1" + OpName %b_1 "b_1" + OpName %c "c" + OpName %pab "pab" + OpName %param "param" + OpName %param_1 "param_1" + OpName %pbc "pbc" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %pca "pca" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %x_137 "x_137" + OpName %x_169 "x_169" + OpName %x_138_phi "x_138_phi" + OpName %x_170_phi "x_170_phi" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_24 NonWritable + OpDecorate %x_24 DescriptorSet 0 + OpDecorate %x_24 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_24 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %40 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %49 = OpConstantNull %float + %51 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %62 = OpConstantNull %bool + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %212 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %232 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %235 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %238 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 + %float_1 = OpConstant %float 1 + %249 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %250 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %251 = OpTypeFunction %void %main_out +%cross2d_vf2_vf2_ = OpFunction %float None %15 + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %20 = OpLabel + %25 = OpAccessChain %_ptr_Function_float %a %uint_0 + %26 = OpLoad %float %25 + %29 = OpAccessChain %_ptr_Function_float %b %uint_1 + %30 = OpLoad %float %29 + %32 = OpAccessChain %_ptr_Function_float %b %uint_0 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Function_float %a %uint_1 + %36 = OpLoad %float %35 + %37 = OpFMul %float %26 %30 + %38 = OpFMul %float %33 %36 + %39 = OpFSub %float %37 %38 + OpReturnValue %39 + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %40 + %p = OpFunctionParameter %_ptr_Function_v2float + %a_1 = OpFunctionParameter %_ptr_Function_v2float + %b_1 = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %47 = OpLabel + %pab = OpVariable %_ptr_Function_float Function %49 + %param = OpVariable %_ptr_Function_v2float Function %51 + %param_1 = OpVariable %_ptr_Function_v2float Function %51 + %pbc = OpVariable %_ptr_Function_float Function %49 + %param_2 = OpVariable %_ptr_Function_v2float Function %51 + %param_3 = OpVariable %_ptr_Function_v2float Function %51 + %pca = OpVariable %_ptr_Function_float Function %49 + %param_4 = OpVariable %_ptr_Function_v2float Function %51 + %param_5 = OpVariable %_ptr_Function_v2float Function %51 + %x_137 = OpVariable %_ptr_Function_bool Function %62 + %x_169 = OpVariable %_ptr_Function_bool Function %62 + %x_138_phi = OpVariable %_ptr_Function_bool Function %62 + %x_170_phi = OpVariable %_ptr_Function_bool Function %62 + %67 = OpAccessChain %_ptr_Function_float %p %uint_0 + %68 = OpLoad %float %67 + %70 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %71 = OpLoad %float %70 + %73 = OpAccessChain %_ptr_Function_float %p %uint_1 + %74 = OpLoad %float %73 + %76 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %77 = OpLoad %float %76 + %79 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %80 = OpLoad %float %79 + %82 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %83 = OpLoad %float %82 + %85 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %86 = OpLoad %float %85 + %88 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %89 = OpLoad %float %88 + %90 = OpFSub %float %68 %71 + %91 = OpFSub %float %74 %77 + %92 = OpCompositeConstruct %v2float %90 %91 + OpStore %param %92 + %93 = OpFSub %float %80 %83 + %94 = OpFSub %float %86 %89 + %95 = OpCompositeConstruct %v2float %93 %94 + OpStore %param_1 %95 + %96 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_1 + OpStore %pab %96 + %100 = OpAccessChain %_ptr_Function_float %p %uint_0 + %101 = OpLoad %float %100 + %103 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %104 = OpLoad %float %103 + %106 = OpAccessChain %_ptr_Function_float %p %uint_1 + %107 = OpLoad %float %106 + %109 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %110 = OpLoad %float %109 + %112 = OpAccessChain %_ptr_Function_float %c %uint_0 + %113 = OpLoad %float %112 + %115 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %116 = OpLoad %float %115 + %118 = OpAccessChain %_ptr_Function_float %c %uint_1 + %119 = OpLoad %float %118 + %121 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %122 = OpLoad %float %121 + %123 = OpFSub %float %101 %104 + %124 = OpFSub %float %107 %110 + %125 = OpCompositeConstruct %v2float %123 %124 + OpStore %param_2 %125 + %126 = OpFSub %float %113 %116 + %127 = OpFSub %float %119 %122 + %128 = OpCompositeConstruct %v2float %126 %127 + OpStore %param_3 %128 + %129 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_2 %param_3 + OpStore %pbc %129 + %132 = OpLoad %float %pab + %133 = OpLoad %float %pbc + %135 = OpFOrdLessThan %bool %132 %float_0 + OpSelectionMerge %136 None + OpBranchConditional %135 %137 %136 + %137 = OpLabel + %138 = OpFOrdLessThan %bool %133 %float_0 + OpBranch %136 + %136 = OpLabel + %139 = OpPhi %bool %135 %47 %138 %137 + OpStore %x_138_phi %139 + %140 = OpLogicalNot %bool %139 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + %143 = OpLoad %float %pab + %144 = OpLoad %float %pbc + %145 = OpFOrdGreaterThanEqual %bool %143 %float_0 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %148 = OpFOrdGreaterThanEqual %bool %144 %float_0 + OpBranch %146 + %146 = OpLabel + %149 = OpPhi %bool %145 %142 %148 %147 + OpStore %x_137 %149 + %150 = OpLoad %bool %x_137 + OpStore %x_138_phi %150 + OpBranch %141 + %141 = OpLabel + %151 = OpLoad %bool %x_138_phi + %152 = OpLogicalNot %bool %151 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + OpReturnValue %int_0 + %153 = OpLabel + %157 = OpAccessChain %_ptr_Function_float %p %uint_0 + %158 = OpLoad %float %157 + %160 = OpAccessChain %_ptr_Function_float %c %uint_0 + %161 = OpLoad %float %160 + %163 = OpAccessChain %_ptr_Function_float %p %uint_1 + %164 = OpLoad %float %163 + %166 = OpAccessChain %_ptr_Function_float %c %uint_1 + %167 = OpLoad %float %166 + %169 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %170 = OpLoad %float %169 + %172 = OpAccessChain %_ptr_Function_float %c %uint_0 + %173 = OpLoad %float %172 + %175 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %176 = OpLoad %float %175 + %178 = OpAccessChain %_ptr_Function_float %c %uint_1 + %179 = OpLoad %float %178 + %180 = OpFSub %float %158 %161 + %181 = OpFSub %float %164 %167 + %182 = OpCompositeConstruct %v2float %180 %181 + OpStore %param_4 %182 + %183 = OpFSub %float %170 %173 + %184 = OpFSub %float %176 %179 + %185 = OpCompositeConstruct %v2float %183 %184 + OpStore %param_5 %185 + %186 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5 + OpStore %pca %186 + %189 = OpLoad %float %pab + %190 = OpLoad %float %pca + %191 = OpFOrdLessThan %bool %189 %float_0 + OpSelectionMerge %192 None + OpBranchConditional %191 %193 %192 + %193 = OpLabel + %194 = OpFOrdLessThan %bool %190 %float_0 + OpBranch %192 + %192 = OpLabel + %195 = OpPhi %bool %191 %153 %194 %193 + OpStore %x_170_phi %195 + %196 = OpLogicalNot %bool %195 + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %197 + %198 = OpLabel + %199 = OpLoad %float %pab + %200 = OpLoad %float %pca + %201 = OpFOrdGreaterThanEqual %bool %199 %float_0 + OpSelectionMerge %202 None + OpBranchConditional %201 %203 %202 + %203 = OpLabel + %204 = OpFOrdGreaterThanEqual %bool %200 %float_0 + OpBranch %202 + %202 = OpLabel + %205 = OpPhi %bool %201 %198 %204 %203 + OpStore %x_169 %205 + %206 = OpLoad %bool %x_169 + OpStore %x_170_phi %206 + OpBranch %197 + %197 = OpLabel + %207 = OpLoad %bool %x_170_phi + %208 = OpLogicalNot %bool %207 + OpSelectionMerge %209 None + OpBranchConditional %208 %210 %209 + %210 = OpLabel + OpReturnValue %int_0 + %209 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %212 + %215 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %51 + %param_6 = OpVariable %_ptr_Function_v2float Function %51 + %param_7 = OpVariable %_ptr_Function_v2float Function %51 + %param_8 = OpVariable %_ptr_Function_v2float Function %51 + %param_9 = OpVariable %_ptr_Function_v2float Function %51 + %221 = OpLoad %v4float %gl_FragCoord + %223 = OpAccessChain %_ptr_Uniform_v2float %x_24 %uint_0 + %224 = OpLoad %v2float %223 + %225 = OpCompositeExtract %float %221 0 + %226 = OpCompositeExtract %float %221 1 + %227 = OpCompositeConstruct %v2float %225 %226 + %228 = OpFDiv %v2float %227 %224 + OpStore %pos %228 + %229 = OpLoad %v2float %pos + OpStore %param_6 %229 + OpStore %param_7 %232 + OpStore %param_8 %235 + OpStore %param_9 %238 + %239 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9 + %244 = OpIEqual %bool %239 %int_1 + OpSelectionMerge %245 None + OpBranchConditional %244 %246 %247 + %246 = OpLabel + OpStore %x_GLF_color %249 + OpBranch %245 + %247 = OpLabel + OpStore %x_GLF_color %250 + OpBranch %245 + %245 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %251 +%tint_symbol_1 = OpFunctionParameter %main_out + %255 = OpLabel + %256 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %256 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %212 + %258 = OpLabel + %259 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %259 + %260 = OpFunctionCall %void %main_1 + %262 = OpLoad %v4float %x_GLF_color + %263 = OpCompositeConstruct %main_out %262 + %261 = OpFunctionCall %void %tint_symbol_3 %263 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..11cfd54ef8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.spvasm.expected.wgsl @@ -0,0 +1,142 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_24 : buf0; + +var x_GLF_color : vec4; + +fn cross2d_vf2_vf2_(a : ptr>, b : ptr>) -> f32 { + let x_76 : f32 = (*(a)).x; + let x_78 : f32 = (*(b)).y; + let x_81 : f32 = (*(b)).x; + let x_83 : f32 = (*(a)).y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a_1 : ptr>, b_1 : ptr>, c : ptr>) -> i32 { + var pab : f32; + var param : vec2; + var param_1 : vec2; + var pbc : f32; + var param_2 : vec2; + var param_3 : vec2; + var pca : f32; + var param_4 : vec2; + var param_5 : vec2; + var x_137 : bool; + var x_169 : bool; + var x_138_phi : bool; + var x_170_phi : bool; + let x_87 : ptr = &((*(p)).x); + let x_88 : f32 = *(x_87); + let x_89 : ptr = &((*(a_1)).x); + let x_90 : f32 = *(x_89); + let x_92 : ptr = &((*(p)).y); + let x_93 : f32 = *(x_92); + let x_94 : ptr = &((*(a_1)).y); + let x_95 : f32 = *(x_94); + let x_98 : ptr = &((*(b_1)).x); + let x_99 : f32 = *(x_98); + let x_100 : f32 = *(x_89); + let x_102 : ptr = &((*(b_1)).y); + let x_103 : f32 = *(x_102); + let x_104 : f32 = *(x_94); + param = vec2((x_88 - x_90), (x_93 - x_95)); + param_1 = vec2((x_99 - x_100), (x_103 - x_104)); + let x_107 : f32 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_107; + let x_108 : f32 = *(x_87); + let x_109 : f32 = *(x_98); + let x_111 : f32 = *(x_92); + let x_112 : f32 = *(x_102); + let x_115 : ptr = &((*(c)).x); + let x_116 : f32 = *(x_115); + let x_117 : f32 = *(x_98); + let x_119 : ptr = &((*(c)).y); + let x_120 : f32 = *(x_119); + let x_121 : f32 = *(x_102); + param_2 = vec2((x_108 - x_109), (x_111 - x_112)); + param_3 = vec2((x_116 - x_117), (x_120 - x_121)); + let x_124 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_124; + let x_125 : f32 = pab; + let x_127 : f32 = pbc; + let x_129 : bool = ((x_125 < 0.0) && (x_127 < 0.0)); + x_138_phi = x_129; + if (!(x_129)) { + let x_133 : f32 = pab; + let x_135 : f32 = pbc; + x_137 = ((x_133 >= 0.0) && (x_135 >= 0.0)); + x_138_phi = x_137; + } + let x_138 : bool = x_138_phi; + if (!(x_138)) { + return 0; + } + let x_142 : f32 = *(x_87); + let x_143 : f32 = *(x_115); + let x_145 : f32 = *(x_92); + let x_146 : f32 = *(x_119); + let x_149 : f32 = *(x_89); + let x_150 : f32 = *(x_115); + let x_152 : f32 = *(x_94); + let x_153 : f32 = *(x_119); + param_4 = vec2((x_142 - x_143), (x_145 - x_146)); + param_5 = vec2((x_149 - x_150), (x_152 - x_153)); + let x_156 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_156; + let x_157 : f32 = pab; + let x_159 : f32 = pca; + let x_161 : bool = ((x_157 < 0.0) && (x_159 < 0.0)); + x_170_phi = x_161; + if (!(x_161)) { + let x_165 : f32 = pab; + let x_167 : f32 = pca; + x_169 = ((x_165 >= 0.0) && (x_167 >= 0.0)); + x_170_phi = x_169; + } + let x_170 : bool = x_170_phi; + if (!(x_170)) { + return 0; + } + return 1; +} + +fn main_1() { + var pos : vec2; + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_63 : vec4 = gl_FragCoord; + let x_66 : vec2 = x_24.resolution; + pos = (vec2(x_63.x, x_63.y) / x_66); + let x_68 : vec2 = pos; + param_6 = x_68; + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_69 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_69 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl new file mode 100644 index 0000000000..11cfd54ef8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl @@ -0,0 +1,142 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_24 : buf0; + +var x_GLF_color : vec4; + +fn cross2d_vf2_vf2_(a : ptr>, b : ptr>) -> f32 { + let x_76 : f32 = (*(a)).x; + let x_78 : f32 = (*(b)).y; + let x_81 : f32 = (*(b)).x; + let x_83 : f32 = (*(a)).y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a_1 : ptr>, b_1 : ptr>, c : ptr>) -> i32 { + var pab : f32; + var param : vec2; + var param_1 : vec2; + var pbc : f32; + var param_2 : vec2; + var param_3 : vec2; + var pca : f32; + var param_4 : vec2; + var param_5 : vec2; + var x_137 : bool; + var x_169 : bool; + var x_138_phi : bool; + var x_170_phi : bool; + let x_87 : ptr = &((*(p)).x); + let x_88 : f32 = *(x_87); + let x_89 : ptr = &((*(a_1)).x); + let x_90 : f32 = *(x_89); + let x_92 : ptr = &((*(p)).y); + let x_93 : f32 = *(x_92); + let x_94 : ptr = &((*(a_1)).y); + let x_95 : f32 = *(x_94); + let x_98 : ptr = &((*(b_1)).x); + let x_99 : f32 = *(x_98); + let x_100 : f32 = *(x_89); + let x_102 : ptr = &((*(b_1)).y); + let x_103 : f32 = *(x_102); + let x_104 : f32 = *(x_94); + param = vec2((x_88 - x_90), (x_93 - x_95)); + param_1 = vec2((x_99 - x_100), (x_103 - x_104)); + let x_107 : f32 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_107; + let x_108 : f32 = *(x_87); + let x_109 : f32 = *(x_98); + let x_111 : f32 = *(x_92); + let x_112 : f32 = *(x_102); + let x_115 : ptr = &((*(c)).x); + let x_116 : f32 = *(x_115); + let x_117 : f32 = *(x_98); + let x_119 : ptr = &((*(c)).y); + let x_120 : f32 = *(x_119); + let x_121 : f32 = *(x_102); + param_2 = vec2((x_108 - x_109), (x_111 - x_112)); + param_3 = vec2((x_116 - x_117), (x_120 - x_121)); + let x_124 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_124; + let x_125 : f32 = pab; + let x_127 : f32 = pbc; + let x_129 : bool = ((x_125 < 0.0) && (x_127 < 0.0)); + x_138_phi = x_129; + if (!(x_129)) { + let x_133 : f32 = pab; + let x_135 : f32 = pbc; + x_137 = ((x_133 >= 0.0) && (x_135 >= 0.0)); + x_138_phi = x_137; + } + let x_138 : bool = x_138_phi; + if (!(x_138)) { + return 0; + } + let x_142 : f32 = *(x_87); + let x_143 : f32 = *(x_115); + let x_145 : f32 = *(x_92); + let x_146 : f32 = *(x_119); + let x_149 : f32 = *(x_89); + let x_150 : f32 = *(x_115); + let x_152 : f32 = *(x_94); + let x_153 : f32 = *(x_119); + param_4 = vec2((x_142 - x_143), (x_145 - x_146)); + param_5 = vec2((x_149 - x_150), (x_152 - x_153)); + let x_156 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_156; + let x_157 : f32 = pab; + let x_159 : f32 = pca; + let x_161 : bool = ((x_157 < 0.0) && (x_159 < 0.0)); + x_170_phi = x_161; + if (!(x_161)) { + let x_165 : f32 = pab; + let x_167 : f32 = pca; + x_169 = ((x_165 >= 0.0) && (x_167 >= 0.0)); + x_170_phi = x_169; + } + let x_170 : bool = x_170_phi; + if (!(x_170)) { + return 0; + } + return 1; +} + +fn main_1() { + var pos : vec2; + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_63 : vec4 = gl_FragCoord; + let x_66 : vec2 = x_24.resolution; + pos = (vec2(x_63.x, x_63.y) / x_66); + let x_68 : vec2 = pos; + param_6 = x_68; + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_69 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_69 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..421b7ed216 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.hlsl @@ -0,0 +1,141 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_24 : register(b0, space0) { + uint4 x_24[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float cross2d_vf2_vf2_(inout float2 a, inout float2 b) { + const float x_76 = a.x; + const float x_78 = b.y; + const float x_81 = b.x; + const float x_83 = a.y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout float2 b_1, inout float2 c) { + float pab = 0.0f; + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + float pbc = 0.0f; + float2 param_2 = float2(0.0f, 0.0f); + float2 param_3 = float2(0.0f, 0.0f); + float pca = 0.0f; + float2 param_4 = float2(0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + bool x_137 = false; + bool x_169 = false; + bool x_138_phi = false; + bool x_170_phi = false; + const float x_88 = p.x; + const float x_90 = a_1.x; + const float x_93 = p.y; + const float x_95 = a_1.y; + const float x_99 = b_1.x; + const float x_100 = a_1.x; + const float x_103 = b_1.y; + const float x_104 = a_1.y; + param = float2((x_88 - x_90), (x_93 - x_95)); + param_1 = float2((x_99 - x_100), (x_103 - x_104)); + const float x_107 = cross2d_vf2_vf2_(param, param_1); + pab = x_107; + const float x_108 = p.x; + const float x_109 = b_1.x; + const float x_111 = p.y; + const float x_112 = b_1.y; + const float x_116 = c.x; + const float x_117 = b_1.x; + const float x_120 = c.y; + const float x_121 = b_1.y; + param_2 = float2((x_108 - x_109), (x_111 - x_112)); + param_3 = float2((x_116 - x_117), (x_120 - x_121)); + const float x_124 = cross2d_vf2_vf2_(param_2, param_3); + pbc = x_124; + bool tint_tmp = (pab < 0.0f); + if (tint_tmp) { + tint_tmp = (pbc < 0.0f); + } + const bool x_129 = (tint_tmp); + x_138_phi = x_129; + if (!(x_129)) { + bool tint_tmp_1 = (pab >= 0.0f); + if (tint_tmp_1) { + tint_tmp_1 = (pbc >= 0.0f); + } + x_137 = (tint_tmp_1); + x_138_phi = x_137; + } + if (!(x_138_phi)) { + return 0; + } + const float x_142 = p.x; + const float x_143 = c.x; + const float x_145 = p.y; + const float x_146 = c.y; + const float x_149 = a_1.x; + const float x_150 = c.x; + const float x_152 = a_1.y; + const float x_153 = c.y; + param_4 = float2((x_142 - x_143), (x_145 - x_146)); + param_5 = float2((x_149 - x_150), (x_152 - x_153)); + const float x_156 = cross2d_vf2_vf2_(param_4, param_5); + pca = x_156; + bool tint_tmp_2 = (pab < 0.0f); + if (tint_tmp_2) { + tint_tmp_2 = (pca < 0.0f); + } + const bool x_161 = (tint_tmp_2); + x_170_phi = x_161; + if (!(x_161)) { + bool tint_tmp_3 = (pab >= 0.0f); + if (tint_tmp_3) { + tint_tmp_3 = (pca >= 0.0f); + } + x_169 = (tint_tmp_3); + x_170_phi = x_169; + } + if (!(x_170_phi)) { + return 0; + } + return 1; +} + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + float2 param_6 = float2(0.0f, 0.0f); + float2 param_7 = float2(0.0f, 0.0f); + float2 param_8 = float2(0.0f, 0.0f); + float2 param_9 = float2(0.0f, 0.0f); + const float4 x_63 = gl_FragCoord; + const float2 x_66 = asfloat(x_24[0].xy); + pos = (float2(x_63.x, x_63.y) / x_66); + param_6 = pos; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + const int x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9); + if ((x_69 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.msl new file mode 100644 index 0000000000..ed7f0784eb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.msl @@ -0,0 +1,135 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float cross2d_vf2_vf2_(thread float2* const a, thread float2* const b) { + float const x_76 = (*(a)).x; + float const x_78 = (*(b)).y; + float const x_81 = (*(b)).x; + float const x_83 = (*(a)).y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) { + float pab = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + float pbc = 0.0f; + float2 param_2 = 0.0f; + float2 param_3 = 0.0f; + float pca = 0.0f; + float2 param_4 = 0.0f; + float2 param_5 = 0.0f; + bool x_137 = false; + bool x_169 = false; + bool x_138_phi = false; + bool x_170_phi = false; + float const x_88 = (*(p)).x; + float const x_90 = (*(a_1)).x; + float const x_93 = (*(p)).y; + float const x_95 = (*(a_1)).y; + float const x_99 = (*(b_1)).x; + float const x_100 = (*(a_1)).x; + float const x_103 = (*(b_1)).y; + float const x_104 = (*(a_1)).y; + param = float2((x_88 - x_90), (x_93 - x_95)); + param_1 = float2((x_99 - x_100), (x_103 - x_104)); + float const x_107 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_107; + float const x_108 = (*(p)).x; + float const x_109 = (*(b_1)).x; + float const x_111 = (*(p)).y; + float const x_112 = (*(b_1)).y; + float const x_116 = (*(c)).x; + float const x_117 = (*(b_1)).x; + float const x_120 = (*(c)).y; + float const x_121 = (*(b_1)).y; + param_2 = float2((x_108 - x_109), (x_111 - x_112)); + param_3 = float2((x_116 - x_117), (x_120 - x_121)); + float const x_124 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_124; + float const x_125 = pab; + float const x_127 = pbc; + bool const x_129 = ((x_125 < 0.0f) && (x_127 < 0.0f)); + x_138_phi = x_129; + if (!(x_129)) { + float const x_133 = pab; + float const x_135 = pbc; + x_137 = ((x_133 >= 0.0f) && (x_135 >= 0.0f)); + x_138_phi = x_137; + } + bool const x_138 = x_138_phi; + if (!(x_138)) { + return 0; + } + float const x_142 = (*(p)).x; + float const x_143 = (*(c)).x; + float const x_145 = (*(p)).y; + float const x_146 = (*(c)).y; + float const x_149 = (*(a_1)).x; + float const x_150 = (*(c)).x; + float const x_152 = (*(a_1)).y; + float const x_153 = (*(c)).y; + param_4 = float2((x_142 - x_143), (x_145 - x_146)); + param_5 = float2((x_149 - x_150), (x_152 - x_153)); + float const x_156 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_156; + float const x_157 = pab; + float const x_159 = pca; + bool const x_161 = ((x_157 < 0.0f) && (x_159 < 0.0f)); + x_170_phi = x_161; + if (!(x_161)) { + float const x_165 = pab; + float const x_167 = pca; + x_169 = ((x_165 >= 0.0f) && (x_167 >= 0.0f)); + x_170_phi = x_169; + } + bool const x_170 = x_170_phi; + if (!(x_170)) { + return 0; + } + return 1; +} + +void main_1(constant buf0& x_24, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 pos = 0.0f; + float2 param_6 = 0.0f; + float2 param_7 = 0.0f; + float2 param_8 = 0.0f; + float2 param_9 = 0.0f; + float4 const x_63 = *(tint_symbol_5); + float2 const x_66 = x_24.resolution; + pos = (float2(x_63.x, x_63.y) / x_66); + float2 const x_68 = pos; + param_6 = x_68; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + int const x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_69 == 1)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_24 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_24, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..dadcc8e970 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.spvasm @@ -0,0 +1,343 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 264 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_24 "x_24" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %cross2d_vf2_vf2_ "cross2d_vf2_vf2_" + OpName %a "a" + OpName %b "b" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_" + OpName %p "p" + OpName %a_1 "a_1" + OpName %b_1 "b_1" + OpName %c "c" + OpName %pab "pab" + OpName %param "param" + OpName %param_1 "param_1" + OpName %pbc "pbc" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %pca "pca" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %x_137 "x_137" + OpName %x_169 "x_169" + OpName %x_138_phi "x_138_phi" + OpName %x_170_phi "x_170_phi" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_24 NonWritable + OpDecorate %x_24 DescriptorSet 0 + OpDecorate %x_24 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_24 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %40 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %49 = OpConstantNull %float + %51 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %62 = OpConstantNull %bool + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %212 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %232 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %235 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %238 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 + %float_1 = OpConstant %float 1 + %249 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %250 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %251 = OpTypeFunction %void %main_out +%cross2d_vf2_vf2_ = OpFunction %float None %15 + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %20 = OpLabel + %25 = OpAccessChain %_ptr_Function_float %a %uint_0 + %26 = OpLoad %float %25 + %29 = OpAccessChain %_ptr_Function_float %b %uint_1 + %30 = OpLoad %float %29 + %32 = OpAccessChain %_ptr_Function_float %b %uint_0 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Function_float %a %uint_1 + %36 = OpLoad %float %35 + %37 = OpFMul %float %26 %30 + %38 = OpFMul %float %33 %36 + %39 = OpFSub %float %37 %38 + OpReturnValue %39 + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %40 + %p = OpFunctionParameter %_ptr_Function_v2float + %a_1 = OpFunctionParameter %_ptr_Function_v2float + %b_1 = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %47 = OpLabel + %pab = OpVariable %_ptr_Function_float Function %49 + %param = OpVariable %_ptr_Function_v2float Function %51 + %param_1 = OpVariable %_ptr_Function_v2float Function %51 + %pbc = OpVariable %_ptr_Function_float Function %49 + %param_2 = OpVariable %_ptr_Function_v2float Function %51 + %param_3 = OpVariable %_ptr_Function_v2float Function %51 + %pca = OpVariable %_ptr_Function_float Function %49 + %param_4 = OpVariable %_ptr_Function_v2float Function %51 + %param_5 = OpVariable %_ptr_Function_v2float Function %51 + %x_137 = OpVariable %_ptr_Function_bool Function %62 + %x_169 = OpVariable %_ptr_Function_bool Function %62 + %x_138_phi = OpVariable %_ptr_Function_bool Function %62 + %x_170_phi = OpVariable %_ptr_Function_bool Function %62 + %67 = OpAccessChain %_ptr_Function_float %p %uint_0 + %68 = OpLoad %float %67 + %70 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %71 = OpLoad %float %70 + %73 = OpAccessChain %_ptr_Function_float %p %uint_1 + %74 = OpLoad %float %73 + %76 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %77 = OpLoad %float %76 + %79 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %80 = OpLoad %float %79 + %82 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %83 = OpLoad %float %82 + %85 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %86 = OpLoad %float %85 + %88 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %89 = OpLoad %float %88 + %90 = OpFSub %float %68 %71 + %91 = OpFSub %float %74 %77 + %92 = OpCompositeConstruct %v2float %90 %91 + OpStore %param %92 + %93 = OpFSub %float %80 %83 + %94 = OpFSub %float %86 %89 + %95 = OpCompositeConstruct %v2float %93 %94 + OpStore %param_1 %95 + %96 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_1 + OpStore %pab %96 + %100 = OpAccessChain %_ptr_Function_float %p %uint_0 + %101 = OpLoad %float %100 + %103 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %104 = OpLoad %float %103 + %106 = OpAccessChain %_ptr_Function_float %p %uint_1 + %107 = OpLoad %float %106 + %109 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %110 = OpLoad %float %109 + %112 = OpAccessChain %_ptr_Function_float %c %uint_0 + %113 = OpLoad %float %112 + %115 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %116 = OpLoad %float %115 + %118 = OpAccessChain %_ptr_Function_float %c %uint_1 + %119 = OpLoad %float %118 + %121 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %122 = OpLoad %float %121 + %123 = OpFSub %float %101 %104 + %124 = OpFSub %float %107 %110 + %125 = OpCompositeConstruct %v2float %123 %124 + OpStore %param_2 %125 + %126 = OpFSub %float %113 %116 + %127 = OpFSub %float %119 %122 + %128 = OpCompositeConstruct %v2float %126 %127 + OpStore %param_3 %128 + %129 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_2 %param_3 + OpStore %pbc %129 + %132 = OpLoad %float %pab + %133 = OpLoad %float %pbc + %135 = OpFOrdLessThan %bool %132 %float_0 + OpSelectionMerge %136 None + OpBranchConditional %135 %137 %136 + %137 = OpLabel + %138 = OpFOrdLessThan %bool %133 %float_0 + OpBranch %136 + %136 = OpLabel + %139 = OpPhi %bool %135 %47 %138 %137 + OpStore %x_138_phi %139 + %140 = OpLogicalNot %bool %139 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + %143 = OpLoad %float %pab + %144 = OpLoad %float %pbc + %145 = OpFOrdGreaterThanEqual %bool %143 %float_0 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %148 = OpFOrdGreaterThanEqual %bool %144 %float_0 + OpBranch %146 + %146 = OpLabel + %149 = OpPhi %bool %145 %142 %148 %147 + OpStore %x_137 %149 + %150 = OpLoad %bool %x_137 + OpStore %x_138_phi %150 + OpBranch %141 + %141 = OpLabel + %151 = OpLoad %bool %x_138_phi + %152 = OpLogicalNot %bool %151 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + OpReturnValue %int_0 + %153 = OpLabel + %157 = OpAccessChain %_ptr_Function_float %p %uint_0 + %158 = OpLoad %float %157 + %160 = OpAccessChain %_ptr_Function_float %c %uint_0 + %161 = OpLoad %float %160 + %163 = OpAccessChain %_ptr_Function_float %p %uint_1 + %164 = OpLoad %float %163 + %166 = OpAccessChain %_ptr_Function_float %c %uint_1 + %167 = OpLoad %float %166 + %169 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %170 = OpLoad %float %169 + %172 = OpAccessChain %_ptr_Function_float %c %uint_0 + %173 = OpLoad %float %172 + %175 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %176 = OpLoad %float %175 + %178 = OpAccessChain %_ptr_Function_float %c %uint_1 + %179 = OpLoad %float %178 + %180 = OpFSub %float %158 %161 + %181 = OpFSub %float %164 %167 + %182 = OpCompositeConstruct %v2float %180 %181 + OpStore %param_4 %182 + %183 = OpFSub %float %170 %173 + %184 = OpFSub %float %176 %179 + %185 = OpCompositeConstruct %v2float %183 %184 + OpStore %param_5 %185 + %186 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5 + OpStore %pca %186 + %189 = OpLoad %float %pab + %190 = OpLoad %float %pca + %191 = OpFOrdLessThan %bool %189 %float_0 + OpSelectionMerge %192 None + OpBranchConditional %191 %193 %192 + %193 = OpLabel + %194 = OpFOrdLessThan %bool %190 %float_0 + OpBranch %192 + %192 = OpLabel + %195 = OpPhi %bool %191 %153 %194 %193 + OpStore %x_170_phi %195 + %196 = OpLogicalNot %bool %195 + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %197 + %198 = OpLabel + %199 = OpLoad %float %pab + %200 = OpLoad %float %pca + %201 = OpFOrdGreaterThanEqual %bool %199 %float_0 + OpSelectionMerge %202 None + OpBranchConditional %201 %203 %202 + %203 = OpLabel + %204 = OpFOrdGreaterThanEqual %bool %200 %float_0 + OpBranch %202 + %202 = OpLabel + %205 = OpPhi %bool %201 %198 %204 %203 + OpStore %x_169 %205 + %206 = OpLoad %bool %x_169 + OpStore %x_170_phi %206 + OpBranch %197 + %197 = OpLabel + %207 = OpLoad %bool %x_170_phi + %208 = OpLogicalNot %bool %207 + OpSelectionMerge %209 None + OpBranchConditional %208 %210 %209 + %210 = OpLabel + OpReturnValue %int_0 + %209 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %212 + %215 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %51 + %param_6 = OpVariable %_ptr_Function_v2float Function %51 + %param_7 = OpVariable %_ptr_Function_v2float Function %51 + %param_8 = OpVariable %_ptr_Function_v2float Function %51 + %param_9 = OpVariable %_ptr_Function_v2float Function %51 + %221 = OpLoad %v4float %gl_FragCoord + %223 = OpAccessChain %_ptr_Uniform_v2float %x_24 %uint_0 + %224 = OpLoad %v2float %223 + %225 = OpCompositeExtract %float %221 0 + %226 = OpCompositeExtract %float %221 1 + %227 = OpCompositeConstruct %v2float %225 %226 + %228 = OpFDiv %v2float %227 %224 + OpStore %pos %228 + %229 = OpLoad %v2float %pos + OpStore %param_6 %229 + OpStore %param_7 %232 + OpStore %param_8 %235 + OpStore %param_9 %238 + %239 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9 + %244 = OpIEqual %bool %239 %int_1 + OpSelectionMerge %245 None + OpBranchConditional %244 %246 %247 + %246 = OpLabel + OpStore %x_GLF_color %249 + OpBranch %245 + %247 = OpLabel + OpStore %x_GLF_color %250 + OpBranch %245 + %245 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %251 +%tint_symbol_1 = OpFunctionParameter %main_out + %255 = OpLabel + %256 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %256 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %212 + %258 = OpLabel + %259 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %259 + %260 = OpFunctionCall %void %main_1 + %262 = OpLoad %v4float %x_GLF_color + %263 = OpCompositeConstruct %main_out %262 + %261 = OpFunctionCall %void %tint_symbol_3 %263 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..11cfd54ef8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/0.wgsl.expected.wgsl @@ -0,0 +1,142 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_24 : buf0; + +var x_GLF_color : vec4; + +fn cross2d_vf2_vf2_(a : ptr>, b : ptr>) -> f32 { + let x_76 : f32 = (*(a)).x; + let x_78 : f32 = (*(b)).y; + let x_81 : f32 = (*(b)).x; + let x_83 : f32 = (*(a)).y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a_1 : ptr>, b_1 : ptr>, c : ptr>) -> i32 { + var pab : f32; + var param : vec2; + var param_1 : vec2; + var pbc : f32; + var param_2 : vec2; + var param_3 : vec2; + var pca : f32; + var param_4 : vec2; + var param_5 : vec2; + var x_137 : bool; + var x_169 : bool; + var x_138_phi : bool; + var x_170_phi : bool; + let x_87 : ptr = &((*(p)).x); + let x_88 : f32 = *(x_87); + let x_89 : ptr = &((*(a_1)).x); + let x_90 : f32 = *(x_89); + let x_92 : ptr = &((*(p)).y); + let x_93 : f32 = *(x_92); + let x_94 : ptr = &((*(a_1)).y); + let x_95 : f32 = *(x_94); + let x_98 : ptr = &((*(b_1)).x); + let x_99 : f32 = *(x_98); + let x_100 : f32 = *(x_89); + let x_102 : ptr = &((*(b_1)).y); + let x_103 : f32 = *(x_102); + let x_104 : f32 = *(x_94); + param = vec2((x_88 - x_90), (x_93 - x_95)); + param_1 = vec2((x_99 - x_100), (x_103 - x_104)); + let x_107 : f32 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_107; + let x_108 : f32 = *(x_87); + let x_109 : f32 = *(x_98); + let x_111 : f32 = *(x_92); + let x_112 : f32 = *(x_102); + let x_115 : ptr = &((*(c)).x); + let x_116 : f32 = *(x_115); + let x_117 : f32 = *(x_98); + let x_119 : ptr = &((*(c)).y); + let x_120 : f32 = *(x_119); + let x_121 : f32 = *(x_102); + param_2 = vec2((x_108 - x_109), (x_111 - x_112)); + param_3 = vec2((x_116 - x_117), (x_120 - x_121)); + let x_124 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_124; + let x_125 : f32 = pab; + let x_127 : f32 = pbc; + let x_129 : bool = ((x_125 < 0.0) && (x_127 < 0.0)); + x_138_phi = x_129; + if (!(x_129)) { + let x_133 : f32 = pab; + let x_135 : f32 = pbc; + x_137 = ((x_133 >= 0.0) && (x_135 >= 0.0)); + x_138_phi = x_137; + } + let x_138 : bool = x_138_phi; + if (!(x_138)) { + return 0; + } + let x_142 : f32 = *(x_87); + let x_143 : f32 = *(x_115); + let x_145 : f32 = *(x_92); + let x_146 : f32 = *(x_119); + let x_149 : f32 = *(x_89); + let x_150 : f32 = *(x_115); + let x_152 : f32 = *(x_94); + let x_153 : f32 = *(x_119); + param_4 = vec2((x_142 - x_143), (x_145 - x_146)); + param_5 = vec2((x_149 - x_150), (x_152 - x_153)); + let x_156 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_156; + let x_157 : f32 = pab; + let x_159 : f32 = pca; + let x_161 : bool = ((x_157 < 0.0) && (x_159 < 0.0)); + x_170_phi = x_161; + if (!(x_161)) { + let x_165 : f32 = pab; + let x_167 : f32 = pca; + x_169 = ((x_165 >= 0.0) && (x_167 >= 0.0)); + x_170_phi = x_169; + } + let x_170 : bool = x_170_phi; + if (!(x_170)) { + return 0; + } + return 1; +} + +fn main_1() { + var pos : vec2; + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_63 : vec4 = gl_FragCoord; + let x_66 : vec2 = x_24.resolution; + pos = (vec2(x_63.x, x_63.y) / x_66); + let x_68 : vec2 = pos; + param_6 = x_68; + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_69 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_69 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm new file mode 100644 index 0000000000..8a7252f65f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm @@ -0,0 +1,302 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %cross2d_vf2_vf2_ "cross2d(vf2;vf2;" + OpName %a "a" + OpName %b "b" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %p "p" + OpName %a_0 "a" + OpName %b_0 "b" + OpName %c "c" + OpName %var_y "var_y" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %clamp_y "clamp_y" + OpName %pab "pab" + OpName %param "param" + OpName %param_0 "param" + OpName %pbc "pbc" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %pca "pca" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %pos "pos" + OpName %gl_FragCoord "gl_FragCoord" + OpName %param_5 "param" + OpName %param_6 "param" + OpName %param_7 "param" + OpName %param_8 "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %32 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %36 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float + %int = OpTypeInt 32 1 + %38 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %true = OpConstantTrue %bool + %v2bool = OpTypeVector %bool 2 + %false = OpConstantFalse %bool + %51 = OpConstantComposite %v2bool %false %false + %float_n1 = OpConstant %float -1 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %60 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %63 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %66 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %68 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %69 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %70 = OpUndef %float + %main = OpFunction %void None %32 + %71 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function + %param_5 = OpVariable %_ptr_Function_v2float Function + %param_6 = OpVariable %_ptr_Function_v2float Function + %param_7 = OpVariable %_ptr_Function_v2float Function + %param_8 = OpVariable %_ptr_Function_v2float Function + %72 = OpLoad %v4float %gl_FragCoord + %73 = OpVectorShuffle %v2float %72 %72 0 1 + %74 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %75 = OpLoad %v2float %74 + %76 = OpFDiv %v2float %73 %75 + OpStore %pos %76 + %77 = OpLoad %v2float %pos + OpStore %param_5 %77 + OpStore %param_6 %60 + OpStore %param_7 %63 + OpStore %param_8 %66 + %78 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_5 %param_6 %param_7 %param_8 + %79 = OpIEqual %bool %78 %int_1 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + OpStore %_GLF_color %68 + OpBranch %80 + %82 = OpLabel + OpStore %_GLF_color %69 + OpBranch %80 + %80 = OpLabel + OpReturn + OpFunctionEnd +%cross2d_vf2_vf2_ = OpFunction %float None %36 + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %83 = OpLabel + %84 = OpAccessChain %_ptr_Function_float %a %uint_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Function_float %b %uint_1 + %87 = OpLoad %float %86 + %88 = OpFMul %float %85 %87 + %89 = OpAccessChain %_ptr_Function_float %b %uint_0 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Function_float %a %uint_1 + %92 = OpLoad %float %91 + %93 = OpFMul %float %90 %92 + %94 = OpFSub %float %88 %93 + OpReturnValue %94 + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %38 + %p = OpFunctionParameter %_ptr_Function_v2float + %a_0 = OpFunctionParameter %_ptr_Function_v2float + %b_0 = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %95 = OpLabel + %var_y = OpVariable %_ptr_Function_float Function + %96 = OpVariable %_ptr_Function_float Function + %97 = OpVariable %_ptr_Function_float Function + %clamp_y = OpVariable %_ptr_Function_float Function + %pab = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_v2float Function + %param_0 = OpVariable %_ptr_Function_v2float Function + %pbc = OpVariable %_ptr_Function_float Function + %param_1 = OpVariable %_ptr_Function_v2float Function + %param_2 = OpVariable %_ptr_Function_v2float Function + %pca = OpVariable %_ptr_Function_float Function + %param_3 = OpVariable %_ptr_Function_v2float Function + %param_4 = OpVariable %_ptr_Function_v2float Function + %98 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %101 = OpLoad %float %100 + %102 = OpFOrdEqual %bool %99 %101 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %105 + %104 = OpLabel + %106 = OpAccessChain %_ptr_Function_float %c %uint_1 + %107 = OpLoad %float %106 + %108 = OpCompositeConstruct %v2float %70 %107 + OpSelectionMerge %109 None + OpBranchConditional %true %110 %111 + %110 = OpLabel + %112 = OpLoad %float %106 + OpStore %97 %112 + OpBranch %109 + %111 = OpLabel + OpStore %97 %float_1 + OpBranch %109 + %109 = OpLabel + %113 = OpLoad %float %97 + %114 = OpLoad %float %106 + %115 = OpExtInst %float %1 FMax %113 %114 + %116 = OpCompositeConstruct %v2float %float_1 %115 + %117 = OpVectorShuffle %v2float %116 %108 2 3 + OpStore %96 %107 + OpBranch %103 + %105 = OpLabel + OpStore %96 %float_n1 + OpBranch %103 + %103 = OpLabel + %118 = OpLoad %float %96 + OpStore %var_y %118 + %119 = OpAccessChain %_ptr_Function_float %c %uint_1 + %120 = OpLoad %float %119 + %121 = OpLoad %float %119 + %122 = OpLoad %float %var_y + %123 = OpExtInst %float %1 FClamp %120 %121 %122 + OpStore %clamp_y %123 + %124 = OpAccessChain %_ptr_Function_float %p %uint_0 + %125 = OpLoad %float %124 + %126 = OpAccessChain %_ptr_Function_float %a_0 %uint_0 + %127 = OpLoad %float %126 + %128 = OpFSub %float %125 %127 + %129 = OpAccessChain %_ptr_Function_float %p %uint_1 + %130 = OpLoad %float %129 + %131 = OpAccessChain %_ptr_Function_float %a_0 %uint_1 + %132 = OpLoad %float %131 + %133 = OpFSub %float %130 %132 + %134 = OpCompositeConstruct %v2float %128 %133 + %135 = OpAccessChain %_ptr_Function_float %b_0 %uint_0 + %136 = OpLoad %float %135 + %137 = OpLoad %float %126 + %138 = OpFSub %float %136 %137 + %139 = OpAccessChain %_ptr_Function_float %b_0 %uint_1 + %140 = OpLoad %float %139 + %141 = OpLoad %float %131 + %142 = OpFSub %float %140 %141 + %143 = OpCompositeConstruct %v2float %138 %142 + OpStore %param %134 + OpStore %param_0 %143 + %144 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_0 + OpStore %pab %144 + %145 = OpLoad %float %124 + %146 = OpLoad %float %135 + %147 = OpFSub %float %145 %146 + %148 = OpLoad %float %129 + %149 = OpLoad %float %139 + %150 = OpFSub %float %148 %149 + %151 = OpCompositeConstruct %v2float %147 %150 + %152 = OpAccessChain %_ptr_Function_float %c %uint_0 + %153 = OpLoad %float %152 + %154 = OpLoad %float %135 + %155 = OpFSub %float %153 %154 + %156 = OpLoad %float %clamp_y + %157 = OpLoad %float %139 + %158 = OpFSub %float %156 %157 + %159 = OpCompositeConstruct %v2float %155 %158 + OpStore %param_1 %151 + OpStore %param_2 %159 + %160 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_1 %param_2 + OpStore %pbc %160 + %161 = OpLoad %float %pab + %162 = OpFOrdLessThan %bool %161 %float_0 + %163 = OpLoad %float %pbc + %164 = OpFOrdLessThan %bool %163 %float_0 + %165 = OpLogicalAnd %bool %162 %164 + %166 = OpLogicalNot %bool %165 + OpSelectionMerge %167 None + OpBranchConditional %166 %168 %167 + %168 = OpLabel + %169 = OpLoad %float %pab + %170 = OpFOrdGreaterThanEqual %bool %169 %float_0 + %171 = OpLoad %float %pbc + %172 = OpFOrdGreaterThanEqual %bool %171 %float_0 + %173 = OpLogicalAnd %bool %170 %172 + OpBranch %167 + %167 = OpLabel + %174 = OpPhi %bool %165 %103 %173 %168 + %175 = OpLogicalNot %bool %174 + OpSelectionMerge %176 None + OpBranchConditional %175 %177 %176 + %177 = OpLabel + OpReturnValue %int_0 + %176 = OpLabel + %178 = OpLoad %float %124 + %179 = OpLoad %float %152 + %180 = OpFSub %float %178 %179 + %181 = OpLoad %float %129 + %182 = OpLoad %float %119 + %183 = OpFSub %float %181 %182 + %184 = OpCompositeConstruct %v2float %180 %183 + %185 = OpLoad %float %126 + %186 = OpLoad %float %152 + %187 = OpFSub %float %185 %186 + %188 = OpLoad %float %131 + %189 = OpLoad %float %119 + %190 = OpFSub %float %188 %189 + %191 = OpCompositeConstruct %v2float %187 %190 + OpStore %param_3 %184 + OpStore %param_4 %191 + %192 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_3 %param_4 + OpStore %pca %192 + %193 = OpLoad %float %pab + %194 = OpFOrdLessThan %bool %193 %float_0 + %195 = OpLoad %float %pca + %196 = OpFOrdLessThan %bool %195 %float_0 + %197 = OpLogicalAnd %bool %194 %196 + %198 = OpLogicalNot %bool %197 + OpSelectionMerge %199 None + OpBranchConditional %198 %200 %199 + %200 = OpLabel + %201 = OpLoad %float %pab + %202 = OpFOrdGreaterThanEqual %bool %201 %float_0 + %203 = OpLoad %float %pca + %204 = OpFOrdGreaterThanEqual %bool %203 %float_0 + %205 = OpLogicalAnd %bool %202 %204 + OpBranch %199 + %199 = OpLabel + %206 = OpPhi %bool %197 %176 %205 %200 + %207 = OpLogicalNot %bool %206 + OpSelectionMerge %208 None + OpBranchConditional %207 %209 %208 + %209 = OpLabel + OpReturnValue %int_0 + %208 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..75aaaf62a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.hlsl @@ -0,0 +1,168 @@ +cbuffer cbuffer_x_15 : register(b0, space0) { + uint4 x_15[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float cross2d_vf2_vf2_(inout float2 a, inout float2 b) { + const float x_85 = a.x; + const float x_87 = b.y; + const float x_90 = b.x; + const float x_92 = a.y; + return ((x_85 * x_87) - (x_90 * x_92)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout float2 b_1, inout float2 c) { + float var_y = 0.0f; + float x_96 = 0.0f; + float x_97 = 0.0f; + float clamp_y = 0.0f; + float pab = 0.0f; + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + float pbc = 0.0f; + float2 param_2 = float2(0.0f, 0.0f); + float2 param_3 = float2(0.0f, 0.0f); + float pca = 0.0f; + float2 param_4 = float2(0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + bool x_173 = false; + bool x_205 = false; + bool x_174_phi = false; + bool x_206_phi = false; + const float x_99 = asfloat(x_15[0].x); + const float x_101 = asfloat(x_15[0].y); + if ((x_99 == x_101)) { + const float x_107 = c.y; + const float2 x_108 = float2(0.0f, x_107); + if (true) { + const float x_112 = c.y; + x_97 = x_112; + } else { + x_97 = 1.0f; + } + const float x_113 = x_97; + const float x_114 = c.y; + const float2 x_116 = float2(1.0f, max(x_113, x_114)); + const float2 x_117 = float2(x_108.x, x_108.y); + x_96 = x_107; + } else { + x_96 = -1.0f; + } + var_y = x_96; + const float x_120 = c.y; + const float x_121 = c.y; + clamp_y = clamp(x_120, x_121, var_y); + const float x_125 = p.x; + const float x_127 = a_1.x; + const float x_130 = p.y; + const float x_132 = a_1.y; + const float x_136 = b_1.x; + const float x_137 = a_1.x; + const float x_140 = b_1.y; + const float x_141 = a_1.y; + param = float2((x_125 - x_127), (x_130 - x_132)); + param_1 = float2((x_136 - x_137), (x_140 - x_141)); + const float x_144 = cross2d_vf2_vf2_(param, param_1); + pab = x_144; + const float x_145 = p.x; + const float x_146 = b_1.x; + const float x_148 = p.y; + const float x_149 = b_1.y; + const float x_153 = c.x; + const float x_154 = b_1.x; + const float x_156 = clamp_y; + const float x_157 = b_1.y; + param_2 = float2((x_145 - x_146), (x_148 - x_149)); + param_3 = float2((x_153 - x_154), (x_156 - x_157)); + const float x_160 = cross2d_vf2_vf2_(param_2, param_3); + pbc = x_160; + bool tint_tmp = (pab < 0.0f); + if (tint_tmp) { + tint_tmp = (pbc < 0.0f); + } + const bool x_165 = (tint_tmp); + x_174_phi = x_165; + if (!(x_165)) { + bool tint_tmp_1 = (pab >= 0.0f); + if (tint_tmp_1) { + tint_tmp_1 = (pbc >= 0.0f); + } + x_173 = (tint_tmp_1); + x_174_phi = x_173; + } + if (!(x_174_phi)) { + return 0; + } + const float x_178 = p.x; + const float x_179 = c.x; + const float x_181 = p.y; + const float x_182 = c.y; + const float x_185 = a_1.x; + const float x_186 = c.x; + const float x_188 = a_1.y; + const float x_189 = c.y; + param_4 = float2((x_178 - x_179), (x_181 - x_182)); + param_5 = float2((x_185 - x_186), (x_188 - x_189)); + const float x_192 = cross2d_vf2_vf2_(param_4, param_5); + pca = x_192; + bool tint_tmp_2 = (pab < 0.0f); + if (tint_tmp_2) { + tint_tmp_2 = (pca < 0.0f); + } + const bool x_197 = (tint_tmp_2); + x_206_phi = x_197; + if (!(x_197)) { + bool tint_tmp_3 = (pab >= 0.0f); + if (tint_tmp_3) { + tint_tmp_3 = (pca >= 0.0f); + } + x_205 = (tint_tmp_3); + x_206_phi = x_205; + } + if (!(x_206_phi)) { + return 0; + } + return 1; +} + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + float2 param_6 = float2(0.0f, 0.0f); + float2 param_7 = float2(0.0f, 0.0f); + float2 param_8 = float2(0.0f, 0.0f); + float2 param_9 = float2(0.0f, 0.0f); + const float4 x_72 = gl_FragCoord; + const float2 x_75 = asfloat(x_15[0].xy); + pos = (float2(x_72.x, x_72.y) / x_75); + param_6 = pos; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + const int x_78 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9); + if ((x_78 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.msl new file mode 100644 index 0000000000..d0400d8b0a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.msl @@ -0,0 +1,164 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float cross2d_vf2_vf2_(thread float2* const a, thread float2* const b) { + float const x_85 = (*(a)).x; + float const x_87 = (*(b)).y; + float const x_90 = (*(b)).x; + float const x_92 = (*(a)).y; + return ((x_85 * x_87) - (x_90 * x_92)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(constant buf0& x_15, thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) { + float var_y = 0.0f; + float x_96 = 0.0f; + float x_97 = 0.0f; + float clamp_y = 0.0f; + float pab = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + float pbc = 0.0f; + float2 param_2 = 0.0f; + float2 param_3 = 0.0f; + float pca = 0.0f; + float2 param_4 = 0.0f; + float2 param_5 = 0.0f; + bool x_173 = false; + bool x_205 = false; + bool x_174_phi = false; + bool x_206_phi = false; + float const x_99 = x_15.resolution.x; + float const x_101 = x_15.resolution.y; + if ((x_99 == x_101)) { + float const x_107 = (*(c)).y; + float2 const x_108 = float2(0.0f, x_107); + if (true) { + float const x_112 = (*(c)).y; + x_97 = x_112; + } else { + x_97 = 1.0f; + } + float const x_113 = x_97; + float const x_114 = (*(c)).y; + float2 const x_116 = float2(1.0f, fmax(x_113, x_114)); + float2 const x_117 = float2(x_108.x, x_108.y); + x_96 = x_107; + } else { + x_96 = -1.0f; + } + float const x_118 = x_96; + var_y = x_118; + float const x_120 = (*(c)).y; + float const x_121 = (*(c)).y; + float const x_122 = var_y; + clamp_y = clamp(x_120, x_121, x_122); + float const x_125 = (*(p)).x; + float const x_127 = (*(a_1)).x; + float const x_130 = (*(p)).y; + float const x_132 = (*(a_1)).y; + float const x_136 = (*(b_1)).x; + float const x_137 = (*(a_1)).x; + float const x_140 = (*(b_1)).y; + float const x_141 = (*(a_1)).y; + param = float2((x_125 - x_127), (x_130 - x_132)); + param_1 = float2((x_136 - x_137), (x_140 - x_141)); + float const x_144 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_144; + float const x_145 = (*(p)).x; + float const x_146 = (*(b_1)).x; + float const x_148 = (*(p)).y; + float const x_149 = (*(b_1)).y; + float const x_153 = (*(c)).x; + float const x_154 = (*(b_1)).x; + float const x_156 = clamp_y; + float const x_157 = (*(b_1)).y; + param_2 = float2((x_145 - x_146), (x_148 - x_149)); + param_3 = float2((x_153 - x_154), (x_156 - x_157)); + float const x_160 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_160; + float const x_161 = pab; + float const x_163 = pbc; + bool const x_165 = ((x_161 < 0.0f) && (x_163 < 0.0f)); + x_174_phi = x_165; + if (!(x_165)) { + float const x_169 = pab; + float const x_171 = pbc; + x_173 = ((x_169 >= 0.0f) && (x_171 >= 0.0f)); + x_174_phi = x_173; + } + bool const x_174 = x_174_phi; + if (!(x_174)) { + return 0; + } + float const x_178 = (*(p)).x; + float const x_179 = (*(c)).x; + float const x_181 = (*(p)).y; + float const x_182 = (*(c)).y; + float const x_185 = (*(a_1)).x; + float const x_186 = (*(c)).x; + float const x_188 = (*(a_1)).y; + float const x_189 = (*(c)).y; + param_4 = float2((x_178 - x_179), (x_181 - x_182)); + param_5 = float2((x_185 - x_186), (x_188 - x_189)); + float const x_192 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_192; + float const x_193 = pab; + float const x_195 = pca; + bool const x_197 = ((x_193 < 0.0f) && (x_195 < 0.0f)); + x_206_phi = x_197; + if (!(x_197)) { + float const x_201 = pab; + float const x_203 = pca; + x_205 = ((x_201 >= 0.0f) && (x_203 >= 0.0f)); + x_206_phi = x_205; + } + bool const x_206 = x_206_phi; + if (!(x_206)) { + return 0; + } + return 1; +} + +void main_1(constant buf0& x_15, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 pos = 0.0f; + float2 param_6 = 0.0f; + float2 param_7 = 0.0f; + float2 param_8 = 0.0f; + float2 param_9 = 0.0f; + float4 const x_72 = *(tint_symbol_5); + float2 const x_75 = x_15.resolution; + pos = (float2(x_72.x, x_72.y) / x_75); + float2 const x_77 = pos; + param_6 = x_77; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + int const x_78 = pointInTriangle_vf2_vf2_vf2_vf2_(x_15, &(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_78 == 1)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_15 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_15, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..98ab5e516d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.spvasm @@ -0,0 +1,399 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 306 +; Schema: 0 + OpCapability Shader + %97 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_15 "x_15" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %cross2d_vf2_vf2_ "cross2d_vf2_vf2_" + OpName %a "a" + OpName %b "b" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_" + OpName %p "p" + OpName %a_1 "a_1" + OpName %b_1 "b_1" + OpName %c "c" + OpName %var_y "var_y" + OpName %x_96 "x_96" + OpName %x_97 "x_97" + OpName %clamp_y "clamp_y" + OpName %pab "pab" + OpName %param "param" + OpName %param_1 "param_1" + OpName %pbc "pbc" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %pca "pca" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %x_173 "x_173" + OpName %x_205 "x_205" + OpName %x_174_phi "x_174_phi" + OpName %x_206_phi "x_206_phi" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_15 NonWritable + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_15 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %40 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %49 = OpConstantNull %float + %55 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %66 = OpConstantNull %bool +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %float_n1 = OpConstant %float -1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %255 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %275 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %278 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %281 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 + %291 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %292 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %293 = OpTypeFunction %void %main_out +%cross2d_vf2_vf2_ = OpFunction %float None %15 + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %20 = OpLabel + %25 = OpAccessChain %_ptr_Function_float %a %uint_0 + %26 = OpLoad %float %25 + %29 = OpAccessChain %_ptr_Function_float %b %uint_1 + %30 = OpLoad %float %29 + %32 = OpAccessChain %_ptr_Function_float %b %uint_0 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Function_float %a %uint_1 + %36 = OpLoad %float %35 + %37 = OpFMul %float %26 %30 + %38 = OpFMul %float %33 %36 + %39 = OpFSub %float %37 %38 + OpReturnValue %39 + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %40 + %p = OpFunctionParameter %_ptr_Function_v2float + %a_1 = OpFunctionParameter %_ptr_Function_v2float + %b_1 = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %47 = OpLabel + %var_y = OpVariable %_ptr_Function_float Function %49 + %x_96 = OpVariable %_ptr_Function_float Function %49 + %x_97 = OpVariable %_ptr_Function_float Function %49 + %clamp_y = OpVariable %_ptr_Function_float Function %49 + %pab = OpVariable %_ptr_Function_float Function %49 + %param = OpVariable %_ptr_Function_v2float Function %55 + %param_1 = OpVariable %_ptr_Function_v2float Function %55 + %pbc = OpVariable %_ptr_Function_float Function %49 + %param_2 = OpVariable %_ptr_Function_v2float Function %55 + %param_3 = OpVariable %_ptr_Function_v2float Function %55 + %pca = OpVariable %_ptr_Function_float Function %49 + %param_4 = OpVariable %_ptr_Function_v2float Function %55 + %param_5 = OpVariable %_ptr_Function_v2float Function %55 + %x_173 = OpVariable %_ptr_Function_bool Function %66 + %x_205 = OpVariable %_ptr_Function_bool Function %66 + %x_174_phi = OpVariable %_ptr_Function_bool Function %66 + %x_206_phi = OpVariable %_ptr_Function_bool Function %66 + %71 = OpAccessChain %_ptr_Uniform_float %x_15 %uint_0 %uint_0 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Uniform_float %x_15 %uint_0 %uint_1 + %74 = OpLoad %float %73 + %75 = OpFOrdEqual %bool %72 %74 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %78 + %77 = OpLabel + %80 = OpAccessChain %_ptr_Function_float %c %uint_1 + %81 = OpLoad %float %80 + %83 = OpCompositeConstruct %v2float %float_0 %81 + OpSelectionMerge %85 None + OpBranchConditional %true %86 %87 + %86 = OpLabel + %89 = OpAccessChain %_ptr_Function_float %c %uint_1 + %90 = OpLoad %float %89 + OpStore %x_97 %90 + OpBranch %85 + %87 = OpLabel + OpStore %x_97 %float_1 + OpBranch %85 + %85 = OpLabel + %92 = OpLoad %float %x_97 + %94 = OpAccessChain %_ptr_Function_float %c %uint_1 + %95 = OpLoad %float %94 + %96 = OpExtInst %float %97 NMax %92 %95 + %98 = OpCompositeConstruct %v2float %float_1 %96 + %99 = OpCompositeExtract %float %83 0 + %100 = OpCompositeExtract %float %83 1 + %101 = OpCompositeConstruct %v2float %99 %100 + OpStore %x_96 %81 + OpBranch %76 + %78 = OpLabel + OpStore %x_96 %float_n1 + OpBranch %76 + %76 = OpLabel + %103 = OpLoad %float %x_96 + OpStore %var_y %103 + %105 = OpAccessChain %_ptr_Function_float %c %uint_1 + %106 = OpLoad %float %105 + %108 = OpAccessChain %_ptr_Function_float %c %uint_1 + %109 = OpLoad %float %108 + %110 = OpLoad %float %var_y + %111 = OpExtInst %float %97 NClamp %106 %109 %110 + OpStore %clamp_y %111 + %113 = OpAccessChain %_ptr_Function_float %p %uint_0 + %114 = OpLoad %float %113 + %116 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %117 = OpLoad %float %116 + %119 = OpAccessChain %_ptr_Function_float %p %uint_1 + %120 = OpLoad %float %119 + %122 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %123 = OpLoad %float %122 + %125 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %126 = OpLoad %float %125 + %128 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %129 = OpLoad %float %128 + %131 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %132 = OpLoad %float %131 + %134 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %135 = OpLoad %float %134 + %136 = OpFSub %float %114 %117 + %137 = OpFSub %float %120 %123 + %138 = OpCompositeConstruct %v2float %136 %137 + OpStore %param %138 + %139 = OpFSub %float %126 %129 + %140 = OpFSub %float %132 %135 + %141 = OpCompositeConstruct %v2float %139 %140 + OpStore %param_1 %141 + %142 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_1 + OpStore %pab %142 + %146 = OpAccessChain %_ptr_Function_float %p %uint_0 + %147 = OpLoad %float %146 + %149 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %150 = OpLoad %float %149 + %152 = OpAccessChain %_ptr_Function_float %p %uint_1 + %153 = OpLoad %float %152 + %155 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %156 = OpLoad %float %155 + %158 = OpAccessChain %_ptr_Function_float %c %uint_0 + %159 = OpLoad %float %158 + %161 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %162 = OpLoad %float %161 + %163 = OpLoad %float %clamp_y + %165 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %166 = OpLoad %float %165 + %167 = OpFSub %float %147 %150 + %168 = OpFSub %float %153 %156 + %169 = OpCompositeConstruct %v2float %167 %168 + OpStore %param_2 %169 + %170 = OpFSub %float %159 %162 + %171 = OpFSub %float %163 %166 + %172 = OpCompositeConstruct %v2float %170 %171 + OpStore %param_3 %172 + %173 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_2 %param_3 + OpStore %pbc %173 + %176 = OpLoad %float %pab + %177 = OpLoad %float %pbc + %178 = OpFOrdLessThan %bool %176 %float_0 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %179 + %180 = OpLabel + %181 = OpFOrdLessThan %bool %177 %float_0 + OpBranch %179 + %179 = OpLabel + %182 = OpPhi %bool %178 %76 %181 %180 + OpStore %x_174_phi %182 + %183 = OpLogicalNot %bool %182 + OpSelectionMerge %184 None + OpBranchConditional %183 %185 %184 + %185 = OpLabel + %186 = OpLoad %float %pab + %187 = OpLoad %float %pbc + %188 = OpFOrdGreaterThanEqual %bool %186 %float_0 + OpSelectionMerge %189 None + OpBranchConditional %188 %190 %189 + %190 = OpLabel + %191 = OpFOrdGreaterThanEqual %bool %187 %float_0 + OpBranch %189 + %189 = OpLabel + %192 = OpPhi %bool %188 %185 %191 %190 + OpStore %x_173 %192 + %193 = OpLoad %bool %x_173 + OpStore %x_174_phi %193 + OpBranch %184 + %184 = OpLabel + %194 = OpLoad %bool %x_174_phi + %195 = OpLogicalNot %bool %194 + OpSelectionMerge %196 None + OpBranchConditional %195 %197 %196 + %197 = OpLabel + OpReturnValue %int_0 + %196 = OpLabel + %200 = OpAccessChain %_ptr_Function_float %p %uint_0 + %201 = OpLoad %float %200 + %203 = OpAccessChain %_ptr_Function_float %c %uint_0 + %204 = OpLoad %float %203 + %206 = OpAccessChain %_ptr_Function_float %p %uint_1 + %207 = OpLoad %float %206 + %209 = OpAccessChain %_ptr_Function_float %c %uint_1 + %210 = OpLoad %float %209 + %212 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %213 = OpLoad %float %212 + %215 = OpAccessChain %_ptr_Function_float %c %uint_0 + %216 = OpLoad %float %215 + %218 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %219 = OpLoad %float %218 + %221 = OpAccessChain %_ptr_Function_float %c %uint_1 + %222 = OpLoad %float %221 + %223 = OpFSub %float %201 %204 + %224 = OpFSub %float %207 %210 + %225 = OpCompositeConstruct %v2float %223 %224 + OpStore %param_4 %225 + %226 = OpFSub %float %213 %216 + %227 = OpFSub %float %219 %222 + %228 = OpCompositeConstruct %v2float %226 %227 + OpStore %param_5 %228 + %229 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5 + OpStore %pca %229 + %232 = OpLoad %float %pab + %233 = OpLoad %float %pca + %234 = OpFOrdLessThan %bool %232 %float_0 + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %235 + %236 = OpLabel + %237 = OpFOrdLessThan %bool %233 %float_0 + OpBranch %235 + %235 = OpLabel + %238 = OpPhi %bool %234 %196 %237 %236 + OpStore %x_206_phi %238 + %239 = OpLogicalNot %bool %238 + OpSelectionMerge %240 None + OpBranchConditional %239 %241 %240 + %241 = OpLabel + %242 = OpLoad %float %pab + %243 = OpLoad %float %pca + %244 = OpFOrdGreaterThanEqual %bool %242 %float_0 + OpSelectionMerge %245 None + OpBranchConditional %244 %246 %245 + %246 = OpLabel + %247 = OpFOrdGreaterThanEqual %bool %243 %float_0 + OpBranch %245 + %245 = OpLabel + %248 = OpPhi %bool %244 %241 %247 %246 + OpStore %x_205 %248 + %249 = OpLoad %bool %x_205 + OpStore %x_206_phi %249 + OpBranch %240 + %240 = OpLabel + %250 = OpLoad %bool %x_206_phi + %251 = OpLogicalNot %bool %250 + OpSelectionMerge %252 None + OpBranchConditional %251 %253 %252 + %253 = OpLabel + OpReturnValue %int_0 + %252 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %255 + %258 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %55 + %param_6 = OpVariable %_ptr_Function_v2float Function %55 + %param_7 = OpVariable %_ptr_Function_v2float Function %55 + %param_8 = OpVariable %_ptr_Function_v2float Function %55 + %param_9 = OpVariable %_ptr_Function_v2float Function %55 + %264 = OpLoad %v4float %gl_FragCoord + %266 = OpAccessChain %_ptr_Uniform_v2float %x_15 %uint_0 + %267 = OpLoad %v2float %266 + %268 = OpCompositeExtract %float %264 0 + %269 = OpCompositeExtract %float %264 1 + %270 = OpCompositeConstruct %v2float %268 %269 + %271 = OpFDiv %v2float %270 %267 + OpStore %pos %271 + %272 = OpLoad %v2float %pos + OpStore %param_6 %272 + OpStore %param_7 %275 + OpStore %param_8 %278 + OpStore %param_9 %281 + %282 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9 + %287 = OpIEqual %bool %282 %int_1 + OpSelectionMerge %288 None + OpBranchConditional %287 %289 %290 + %289 = OpLabel + OpStore %x_GLF_color %291 + OpBranch %288 + %290 = OpLabel + OpStore %x_GLF_color %292 + OpBranch %288 + %288 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %293 +%tint_symbol_1 = OpFunctionParameter %main_out + %297 = OpLabel + %298 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %298 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %255 + %300 = OpLabel + %301 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %301 + %302 = OpFunctionCall %void %main_1 + %304 = OpLoad %v4float %x_GLF_color + %305 = OpCompositeConstruct %main_out %304 + %303 = OpFunctionCall %void %tint_symbol_3 %305 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..d58c35ba03 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.spvasm.expected.wgsl @@ -0,0 +1,172 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_15 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn cross2d_vf2_vf2_(a : ptr>, b : ptr>) -> f32 { + let x_85 : f32 = (*(a)).x; + let x_87 : f32 = (*(b)).y; + let x_90 : f32 = (*(b)).x; + let x_92 : f32 = (*(a)).y; + return ((x_85 * x_87) - (x_90 * x_92)); +} + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a_1 : ptr>, b_1 : ptr>, c : ptr>) -> i32 { + var var_y : f32; + var x_96 : f32; + var x_97 : f32; + var clamp_y : f32; + var pab : f32; + var param : vec2; + var param_1 : vec2; + var pbc : f32; + var param_2 : vec2; + var param_3 : vec2; + var pca : f32; + var param_4 : vec2; + var param_5 : vec2; + var x_173 : bool; + var x_205 : bool; + var x_174_phi : bool; + var x_206_phi : bool; + let x_99 : f32 = x_15.resolution.x; + let x_101 : f32 = x_15.resolution.y; + if ((x_99 == x_101)) { + let x_106 : ptr = &((*(c)).y); + let x_107 : f32 = *(x_106); + let x_108 : vec2 = vec2(0.0, x_107); + if (true) { + let x_112 : f32 = *(x_106); + x_97 = x_112; + } else { + x_97 = 1.0; + } + let x_113 : f32 = x_97; + let x_114 : f32 = *(x_106); + let x_116 : vec2 = vec2(1.0, max(x_113, x_114)); + let x_117 : vec2 = vec2(x_108.x, x_108.y); + x_96 = x_107; + } else { + x_96 = -1.0; + } + let x_118 : f32 = x_96; + var_y = x_118; + let x_119 : ptr = &((*(c)).y); + let x_120 : f32 = *(x_119); + let x_121 : f32 = *(x_119); + let x_122 : f32 = var_y; + clamp_y = clamp(x_120, x_121, x_122); + let x_124 : ptr = &((*(p)).x); + let x_125 : f32 = *(x_124); + let x_126 : ptr = &((*(a_1)).x); + let x_127 : f32 = *(x_126); + let x_129 : ptr = &((*(p)).y); + let x_130 : f32 = *(x_129); + let x_131 : ptr = &((*(a_1)).y); + let x_132 : f32 = *(x_131); + let x_135 : ptr = &((*(b_1)).x); + let x_136 : f32 = *(x_135); + let x_137 : f32 = *(x_126); + let x_139 : ptr = &((*(b_1)).y); + let x_140 : f32 = *(x_139); + let x_141 : f32 = *(x_131); + param = vec2((x_125 - x_127), (x_130 - x_132)); + param_1 = vec2((x_136 - x_137), (x_140 - x_141)); + let x_144 : f32 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_144; + let x_145 : f32 = *(x_124); + let x_146 : f32 = *(x_135); + let x_148 : f32 = *(x_129); + let x_149 : f32 = *(x_139); + let x_152 : ptr = &((*(c)).x); + let x_153 : f32 = *(x_152); + let x_154 : f32 = *(x_135); + let x_156 : f32 = clamp_y; + let x_157 : f32 = *(x_139); + param_2 = vec2((x_145 - x_146), (x_148 - x_149)); + param_3 = vec2((x_153 - x_154), (x_156 - x_157)); + let x_160 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_160; + let x_161 : f32 = pab; + let x_163 : f32 = pbc; + let x_165 : bool = ((x_161 < 0.0) && (x_163 < 0.0)); + x_174_phi = x_165; + if (!(x_165)) { + let x_169 : f32 = pab; + let x_171 : f32 = pbc; + x_173 = ((x_169 >= 0.0) && (x_171 >= 0.0)); + x_174_phi = x_173; + } + let x_174 : bool = x_174_phi; + if (!(x_174)) { + return 0; + } + let x_178 : f32 = *(x_124); + let x_179 : f32 = *(x_152); + let x_181 : f32 = *(x_129); + let x_182 : f32 = *(x_119); + let x_185 : f32 = *(x_126); + let x_186 : f32 = *(x_152); + let x_188 : f32 = *(x_131); + let x_189 : f32 = *(x_119); + param_4 = vec2((x_178 - x_179), (x_181 - x_182)); + param_5 = vec2((x_185 - x_186), (x_188 - x_189)); + let x_192 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_192; + let x_193 : f32 = pab; + let x_195 : f32 = pca; + let x_197 : bool = ((x_193 < 0.0) && (x_195 < 0.0)); + x_206_phi = x_197; + if (!(x_197)) { + let x_201 : f32 = pab; + let x_203 : f32 = pca; + x_205 = ((x_201 >= 0.0) && (x_203 >= 0.0)); + x_206_phi = x_205; + } + let x_206 : bool = x_206_phi; + if (!(x_206)) { + return 0; + } + return 1; +} + +fn main_1() { + var pos : vec2; + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_72 : vec4 = gl_FragCoord; + let x_75 : vec2 = x_15.resolution; + pos = (vec2(x_72.x, x_72.y) / x_75); + let x_77 : vec2 = pos; + param_6 = x_77; + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_78 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_78 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl new file mode 100644 index 0000000000..d58c35ba03 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl @@ -0,0 +1,172 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_15 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn cross2d_vf2_vf2_(a : ptr>, b : ptr>) -> f32 { + let x_85 : f32 = (*(a)).x; + let x_87 : f32 = (*(b)).y; + let x_90 : f32 = (*(b)).x; + let x_92 : f32 = (*(a)).y; + return ((x_85 * x_87) - (x_90 * x_92)); +} + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a_1 : ptr>, b_1 : ptr>, c : ptr>) -> i32 { + var var_y : f32; + var x_96 : f32; + var x_97 : f32; + var clamp_y : f32; + var pab : f32; + var param : vec2; + var param_1 : vec2; + var pbc : f32; + var param_2 : vec2; + var param_3 : vec2; + var pca : f32; + var param_4 : vec2; + var param_5 : vec2; + var x_173 : bool; + var x_205 : bool; + var x_174_phi : bool; + var x_206_phi : bool; + let x_99 : f32 = x_15.resolution.x; + let x_101 : f32 = x_15.resolution.y; + if ((x_99 == x_101)) { + let x_106 : ptr = &((*(c)).y); + let x_107 : f32 = *(x_106); + let x_108 : vec2 = vec2(0.0, x_107); + if (true) { + let x_112 : f32 = *(x_106); + x_97 = x_112; + } else { + x_97 = 1.0; + } + let x_113 : f32 = x_97; + let x_114 : f32 = *(x_106); + let x_116 : vec2 = vec2(1.0, max(x_113, x_114)); + let x_117 : vec2 = vec2(x_108.x, x_108.y); + x_96 = x_107; + } else { + x_96 = -1.0; + } + let x_118 : f32 = x_96; + var_y = x_118; + let x_119 : ptr = &((*(c)).y); + let x_120 : f32 = *(x_119); + let x_121 : f32 = *(x_119); + let x_122 : f32 = var_y; + clamp_y = clamp(x_120, x_121, x_122); + let x_124 : ptr = &((*(p)).x); + let x_125 : f32 = *(x_124); + let x_126 : ptr = &((*(a_1)).x); + let x_127 : f32 = *(x_126); + let x_129 : ptr = &((*(p)).y); + let x_130 : f32 = *(x_129); + let x_131 : ptr = &((*(a_1)).y); + let x_132 : f32 = *(x_131); + let x_135 : ptr = &((*(b_1)).x); + let x_136 : f32 = *(x_135); + let x_137 : f32 = *(x_126); + let x_139 : ptr = &((*(b_1)).y); + let x_140 : f32 = *(x_139); + let x_141 : f32 = *(x_131); + param = vec2((x_125 - x_127), (x_130 - x_132)); + param_1 = vec2((x_136 - x_137), (x_140 - x_141)); + let x_144 : f32 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_144; + let x_145 : f32 = *(x_124); + let x_146 : f32 = *(x_135); + let x_148 : f32 = *(x_129); + let x_149 : f32 = *(x_139); + let x_152 : ptr = &((*(c)).x); + let x_153 : f32 = *(x_152); + let x_154 : f32 = *(x_135); + let x_156 : f32 = clamp_y; + let x_157 : f32 = *(x_139); + param_2 = vec2((x_145 - x_146), (x_148 - x_149)); + param_3 = vec2((x_153 - x_154), (x_156 - x_157)); + let x_160 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_160; + let x_161 : f32 = pab; + let x_163 : f32 = pbc; + let x_165 : bool = ((x_161 < 0.0) && (x_163 < 0.0)); + x_174_phi = x_165; + if (!(x_165)) { + let x_169 : f32 = pab; + let x_171 : f32 = pbc; + x_173 = ((x_169 >= 0.0) && (x_171 >= 0.0)); + x_174_phi = x_173; + } + let x_174 : bool = x_174_phi; + if (!(x_174)) { + return 0; + } + let x_178 : f32 = *(x_124); + let x_179 : f32 = *(x_152); + let x_181 : f32 = *(x_129); + let x_182 : f32 = *(x_119); + let x_185 : f32 = *(x_126); + let x_186 : f32 = *(x_152); + let x_188 : f32 = *(x_131); + let x_189 : f32 = *(x_119); + param_4 = vec2((x_178 - x_179), (x_181 - x_182)); + param_5 = vec2((x_185 - x_186), (x_188 - x_189)); + let x_192 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_192; + let x_193 : f32 = pab; + let x_195 : f32 = pca; + let x_197 : bool = ((x_193 < 0.0) && (x_195 < 0.0)); + x_206_phi = x_197; + if (!(x_197)) { + let x_201 : f32 = pab; + let x_203 : f32 = pca; + x_205 = ((x_201 >= 0.0) && (x_203 >= 0.0)); + x_206_phi = x_205; + } + let x_206 : bool = x_206_phi; + if (!(x_206)) { + return 0; + } + return 1; +} + +fn main_1() { + var pos : vec2; + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_72 : vec4 = gl_FragCoord; + let x_75 : vec2 = x_15.resolution; + pos = (vec2(x_72.x, x_72.y) / x_75); + let x_77 : vec2 = pos; + param_6 = x_77; + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_78 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_78 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..75aaaf62a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.hlsl @@ -0,0 +1,168 @@ +cbuffer cbuffer_x_15 : register(b0, space0) { + uint4 x_15[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float cross2d_vf2_vf2_(inout float2 a, inout float2 b) { + const float x_85 = a.x; + const float x_87 = b.y; + const float x_90 = b.x; + const float x_92 = a.y; + return ((x_85 * x_87) - (x_90 * x_92)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout float2 b_1, inout float2 c) { + float var_y = 0.0f; + float x_96 = 0.0f; + float x_97 = 0.0f; + float clamp_y = 0.0f; + float pab = 0.0f; + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + float pbc = 0.0f; + float2 param_2 = float2(0.0f, 0.0f); + float2 param_3 = float2(0.0f, 0.0f); + float pca = 0.0f; + float2 param_4 = float2(0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + bool x_173 = false; + bool x_205 = false; + bool x_174_phi = false; + bool x_206_phi = false; + const float x_99 = asfloat(x_15[0].x); + const float x_101 = asfloat(x_15[0].y); + if ((x_99 == x_101)) { + const float x_107 = c.y; + const float2 x_108 = float2(0.0f, x_107); + if (true) { + const float x_112 = c.y; + x_97 = x_112; + } else { + x_97 = 1.0f; + } + const float x_113 = x_97; + const float x_114 = c.y; + const float2 x_116 = float2(1.0f, max(x_113, x_114)); + const float2 x_117 = float2(x_108.x, x_108.y); + x_96 = x_107; + } else { + x_96 = -1.0f; + } + var_y = x_96; + const float x_120 = c.y; + const float x_121 = c.y; + clamp_y = clamp(x_120, x_121, var_y); + const float x_125 = p.x; + const float x_127 = a_1.x; + const float x_130 = p.y; + const float x_132 = a_1.y; + const float x_136 = b_1.x; + const float x_137 = a_1.x; + const float x_140 = b_1.y; + const float x_141 = a_1.y; + param = float2((x_125 - x_127), (x_130 - x_132)); + param_1 = float2((x_136 - x_137), (x_140 - x_141)); + const float x_144 = cross2d_vf2_vf2_(param, param_1); + pab = x_144; + const float x_145 = p.x; + const float x_146 = b_1.x; + const float x_148 = p.y; + const float x_149 = b_1.y; + const float x_153 = c.x; + const float x_154 = b_1.x; + const float x_156 = clamp_y; + const float x_157 = b_1.y; + param_2 = float2((x_145 - x_146), (x_148 - x_149)); + param_3 = float2((x_153 - x_154), (x_156 - x_157)); + const float x_160 = cross2d_vf2_vf2_(param_2, param_3); + pbc = x_160; + bool tint_tmp = (pab < 0.0f); + if (tint_tmp) { + tint_tmp = (pbc < 0.0f); + } + const bool x_165 = (tint_tmp); + x_174_phi = x_165; + if (!(x_165)) { + bool tint_tmp_1 = (pab >= 0.0f); + if (tint_tmp_1) { + tint_tmp_1 = (pbc >= 0.0f); + } + x_173 = (tint_tmp_1); + x_174_phi = x_173; + } + if (!(x_174_phi)) { + return 0; + } + const float x_178 = p.x; + const float x_179 = c.x; + const float x_181 = p.y; + const float x_182 = c.y; + const float x_185 = a_1.x; + const float x_186 = c.x; + const float x_188 = a_1.y; + const float x_189 = c.y; + param_4 = float2((x_178 - x_179), (x_181 - x_182)); + param_5 = float2((x_185 - x_186), (x_188 - x_189)); + const float x_192 = cross2d_vf2_vf2_(param_4, param_5); + pca = x_192; + bool tint_tmp_2 = (pab < 0.0f); + if (tint_tmp_2) { + tint_tmp_2 = (pca < 0.0f); + } + const bool x_197 = (tint_tmp_2); + x_206_phi = x_197; + if (!(x_197)) { + bool tint_tmp_3 = (pab >= 0.0f); + if (tint_tmp_3) { + tint_tmp_3 = (pca >= 0.0f); + } + x_205 = (tint_tmp_3); + x_206_phi = x_205; + } + if (!(x_206_phi)) { + return 0; + } + return 1; +} + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + float2 param_6 = float2(0.0f, 0.0f); + float2 param_7 = float2(0.0f, 0.0f); + float2 param_8 = float2(0.0f, 0.0f); + float2 param_9 = float2(0.0f, 0.0f); + const float4 x_72 = gl_FragCoord; + const float2 x_75 = asfloat(x_15[0].xy); + pos = (float2(x_72.x, x_72.y) / x_75); + param_6 = pos; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + const int x_78 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9); + if ((x_78 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.msl new file mode 100644 index 0000000000..d0400d8b0a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.msl @@ -0,0 +1,164 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float cross2d_vf2_vf2_(thread float2* const a, thread float2* const b) { + float const x_85 = (*(a)).x; + float const x_87 = (*(b)).y; + float const x_90 = (*(b)).x; + float const x_92 = (*(a)).y; + return ((x_85 * x_87) - (x_90 * x_92)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(constant buf0& x_15, thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) { + float var_y = 0.0f; + float x_96 = 0.0f; + float x_97 = 0.0f; + float clamp_y = 0.0f; + float pab = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + float pbc = 0.0f; + float2 param_2 = 0.0f; + float2 param_3 = 0.0f; + float pca = 0.0f; + float2 param_4 = 0.0f; + float2 param_5 = 0.0f; + bool x_173 = false; + bool x_205 = false; + bool x_174_phi = false; + bool x_206_phi = false; + float const x_99 = x_15.resolution.x; + float const x_101 = x_15.resolution.y; + if ((x_99 == x_101)) { + float const x_107 = (*(c)).y; + float2 const x_108 = float2(0.0f, x_107); + if (true) { + float const x_112 = (*(c)).y; + x_97 = x_112; + } else { + x_97 = 1.0f; + } + float const x_113 = x_97; + float const x_114 = (*(c)).y; + float2 const x_116 = float2(1.0f, fmax(x_113, x_114)); + float2 const x_117 = float2(x_108.x, x_108.y); + x_96 = x_107; + } else { + x_96 = -1.0f; + } + float const x_118 = x_96; + var_y = x_118; + float const x_120 = (*(c)).y; + float const x_121 = (*(c)).y; + float const x_122 = var_y; + clamp_y = clamp(x_120, x_121, x_122); + float const x_125 = (*(p)).x; + float const x_127 = (*(a_1)).x; + float const x_130 = (*(p)).y; + float const x_132 = (*(a_1)).y; + float const x_136 = (*(b_1)).x; + float const x_137 = (*(a_1)).x; + float const x_140 = (*(b_1)).y; + float const x_141 = (*(a_1)).y; + param = float2((x_125 - x_127), (x_130 - x_132)); + param_1 = float2((x_136 - x_137), (x_140 - x_141)); + float const x_144 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_144; + float const x_145 = (*(p)).x; + float const x_146 = (*(b_1)).x; + float const x_148 = (*(p)).y; + float const x_149 = (*(b_1)).y; + float const x_153 = (*(c)).x; + float const x_154 = (*(b_1)).x; + float const x_156 = clamp_y; + float const x_157 = (*(b_1)).y; + param_2 = float2((x_145 - x_146), (x_148 - x_149)); + param_3 = float2((x_153 - x_154), (x_156 - x_157)); + float const x_160 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_160; + float const x_161 = pab; + float const x_163 = pbc; + bool const x_165 = ((x_161 < 0.0f) && (x_163 < 0.0f)); + x_174_phi = x_165; + if (!(x_165)) { + float const x_169 = pab; + float const x_171 = pbc; + x_173 = ((x_169 >= 0.0f) && (x_171 >= 0.0f)); + x_174_phi = x_173; + } + bool const x_174 = x_174_phi; + if (!(x_174)) { + return 0; + } + float const x_178 = (*(p)).x; + float const x_179 = (*(c)).x; + float const x_181 = (*(p)).y; + float const x_182 = (*(c)).y; + float const x_185 = (*(a_1)).x; + float const x_186 = (*(c)).x; + float const x_188 = (*(a_1)).y; + float const x_189 = (*(c)).y; + param_4 = float2((x_178 - x_179), (x_181 - x_182)); + param_5 = float2((x_185 - x_186), (x_188 - x_189)); + float const x_192 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_192; + float const x_193 = pab; + float const x_195 = pca; + bool const x_197 = ((x_193 < 0.0f) && (x_195 < 0.0f)); + x_206_phi = x_197; + if (!(x_197)) { + float const x_201 = pab; + float const x_203 = pca; + x_205 = ((x_201 >= 0.0f) && (x_203 >= 0.0f)); + x_206_phi = x_205; + } + bool const x_206 = x_206_phi; + if (!(x_206)) { + return 0; + } + return 1; +} + +void main_1(constant buf0& x_15, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 pos = 0.0f; + float2 param_6 = 0.0f; + float2 param_7 = 0.0f; + float2 param_8 = 0.0f; + float2 param_9 = 0.0f; + float4 const x_72 = *(tint_symbol_5); + float2 const x_75 = x_15.resolution; + pos = (float2(x_72.x, x_72.y) / x_75); + float2 const x_77 = pos; + param_6 = x_77; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + int const x_78 = pointInTriangle_vf2_vf2_vf2_vf2_(x_15, &(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_78 == 1)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_15 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_15, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..98ab5e516d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.spvasm @@ -0,0 +1,399 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 306 +; Schema: 0 + OpCapability Shader + %97 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_15 "x_15" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %cross2d_vf2_vf2_ "cross2d_vf2_vf2_" + OpName %a "a" + OpName %b "b" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_" + OpName %p "p" + OpName %a_1 "a_1" + OpName %b_1 "b_1" + OpName %c "c" + OpName %var_y "var_y" + OpName %x_96 "x_96" + OpName %x_97 "x_97" + OpName %clamp_y "clamp_y" + OpName %pab "pab" + OpName %param "param" + OpName %param_1 "param_1" + OpName %pbc "pbc" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %pca "pca" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %x_173 "x_173" + OpName %x_205 "x_205" + OpName %x_174_phi "x_174_phi" + OpName %x_206_phi "x_206_phi" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_15 NonWritable + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_15 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %40 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %49 = OpConstantNull %float + %55 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %66 = OpConstantNull %bool +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %float_n1 = OpConstant %float -1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %255 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %275 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %278 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %281 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 + %291 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %292 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %293 = OpTypeFunction %void %main_out +%cross2d_vf2_vf2_ = OpFunction %float None %15 + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %20 = OpLabel + %25 = OpAccessChain %_ptr_Function_float %a %uint_0 + %26 = OpLoad %float %25 + %29 = OpAccessChain %_ptr_Function_float %b %uint_1 + %30 = OpLoad %float %29 + %32 = OpAccessChain %_ptr_Function_float %b %uint_0 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Function_float %a %uint_1 + %36 = OpLoad %float %35 + %37 = OpFMul %float %26 %30 + %38 = OpFMul %float %33 %36 + %39 = OpFSub %float %37 %38 + OpReturnValue %39 + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %40 + %p = OpFunctionParameter %_ptr_Function_v2float + %a_1 = OpFunctionParameter %_ptr_Function_v2float + %b_1 = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %47 = OpLabel + %var_y = OpVariable %_ptr_Function_float Function %49 + %x_96 = OpVariable %_ptr_Function_float Function %49 + %x_97 = OpVariable %_ptr_Function_float Function %49 + %clamp_y = OpVariable %_ptr_Function_float Function %49 + %pab = OpVariable %_ptr_Function_float Function %49 + %param = OpVariable %_ptr_Function_v2float Function %55 + %param_1 = OpVariable %_ptr_Function_v2float Function %55 + %pbc = OpVariable %_ptr_Function_float Function %49 + %param_2 = OpVariable %_ptr_Function_v2float Function %55 + %param_3 = OpVariable %_ptr_Function_v2float Function %55 + %pca = OpVariable %_ptr_Function_float Function %49 + %param_4 = OpVariable %_ptr_Function_v2float Function %55 + %param_5 = OpVariable %_ptr_Function_v2float Function %55 + %x_173 = OpVariable %_ptr_Function_bool Function %66 + %x_205 = OpVariable %_ptr_Function_bool Function %66 + %x_174_phi = OpVariable %_ptr_Function_bool Function %66 + %x_206_phi = OpVariable %_ptr_Function_bool Function %66 + %71 = OpAccessChain %_ptr_Uniform_float %x_15 %uint_0 %uint_0 + %72 = OpLoad %float %71 + %73 = OpAccessChain %_ptr_Uniform_float %x_15 %uint_0 %uint_1 + %74 = OpLoad %float %73 + %75 = OpFOrdEqual %bool %72 %74 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %78 + %77 = OpLabel + %80 = OpAccessChain %_ptr_Function_float %c %uint_1 + %81 = OpLoad %float %80 + %83 = OpCompositeConstruct %v2float %float_0 %81 + OpSelectionMerge %85 None + OpBranchConditional %true %86 %87 + %86 = OpLabel + %89 = OpAccessChain %_ptr_Function_float %c %uint_1 + %90 = OpLoad %float %89 + OpStore %x_97 %90 + OpBranch %85 + %87 = OpLabel + OpStore %x_97 %float_1 + OpBranch %85 + %85 = OpLabel + %92 = OpLoad %float %x_97 + %94 = OpAccessChain %_ptr_Function_float %c %uint_1 + %95 = OpLoad %float %94 + %96 = OpExtInst %float %97 NMax %92 %95 + %98 = OpCompositeConstruct %v2float %float_1 %96 + %99 = OpCompositeExtract %float %83 0 + %100 = OpCompositeExtract %float %83 1 + %101 = OpCompositeConstruct %v2float %99 %100 + OpStore %x_96 %81 + OpBranch %76 + %78 = OpLabel + OpStore %x_96 %float_n1 + OpBranch %76 + %76 = OpLabel + %103 = OpLoad %float %x_96 + OpStore %var_y %103 + %105 = OpAccessChain %_ptr_Function_float %c %uint_1 + %106 = OpLoad %float %105 + %108 = OpAccessChain %_ptr_Function_float %c %uint_1 + %109 = OpLoad %float %108 + %110 = OpLoad %float %var_y + %111 = OpExtInst %float %97 NClamp %106 %109 %110 + OpStore %clamp_y %111 + %113 = OpAccessChain %_ptr_Function_float %p %uint_0 + %114 = OpLoad %float %113 + %116 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %117 = OpLoad %float %116 + %119 = OpAccessChain %_ptr_Function_float %p %uint_1 + %120 = OpLoad %float %119 + %122 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %123 = OpLoad %float %122 + %125 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %126 = OpLoad %float %125 + %128 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %129 = OpLoad %float %128 + %131 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %132 = OpLoad %float %131 + %134 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %135 = OpLoad %float %134 + %136 = OpFSub %float %114 %117 + %137 = OpFSub %float %120 %123 + %138 = OpCompositeConstruct %v2float %136 %137 + OpStore %param %138 + %139 = OpFSub %float %126 %129 + %140 = OpFSub %float %132 %135 + %141 = OpCompositeConstruct %v2float %139 %140 + OpStore %param_1 %141 + %142 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_1 + OpStore %pab %142 + %146 = OpAccessChain %_ptr_Function_float %p %uint_0 + %147 = OpLoad %float %146 + %149 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %150 = OpLoad %float %149 + %152 = OpAccessChain %_ptr_Function_float %p %uint_1 + %153 = OpLoad %float %152 + %155 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %156 = OpLoad %float %155 + %158 = OpAccessChain %_ptr_Function_float %c %uint_0 + %159 = OpLoad %float %158 + %161 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %162 = OpLoad %float %161 + %163 = OpLoad %float %clamp_y + %165 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %166 = OpLoad %float %165 + %167 = OpFSub %float %147 %150 + %168 = OpFSub %float %153 %156 + %169 = OpCompositeConstruct %v2float %167 %168 + OpStore %param_2 %169 + %170 = OpFSub %float %159 %162 + %171 = OpFSub %float %163 %166 + %172 = OpCompositeConstruct %v2float %170 %171 + OpStore %param_3 %172 + %173 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_2 %param_3 + OpStore %pbc %173 + %176 = OpLoad %float %pab + %177 = OpLoad %float %pbc + %178 = OpFOrdLessThan %bool %176 %float_0 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %179 + %180 = OpLabel + %181 = OpFOrdLessThan %bool %177 %float_0 + OpBranch %179 + %179 = OpLabel + %182 = OpPhi %bool %178 %76 %181 %180 + OpStore %x_174_phi %182 + %183 = OpLogicalNot %bool %182 + OpSelectionMerge %184 None + OpBranchConditional %183 %185 %184 + %185 = OpLabel + %186 = OpLoad %float %pab + %187 = OpLoad %float %pbc + %188 = OpFOrdGreaterThanEqual %bool %186 %float_0 + OpSelectionMerge %189 None + OpBranchConditional %188 %190 %189 + %190 = OpLabel + %191 = OpFOrdGreaterThanEqual %bool %187 %float_0 + OpBranch %189 + %189 = OpLabel + %192 = OpPhi %bool %188 %185 %191 %190 + OpStore %x_173 %192 + %193 = OpLoad %bool %x_173 + OpStore %x_174_phi %193 + OpBranch %184 + %184 = OpLabel + %194 = OpLoad %bool %x_174_phi + %195 = OpLogicalNot %bool %194 + OpSelectionMerge %196 None + OpBranchConditional %195 %197 %196 + %197 = OpLabel + OpReturnValue %int_0 + %196 = OpLabel + %200 = OpAccessChain %_ptr_Function_float %p %uint_0 + %201 = OpLoad %float %200 + %203 = OpAccessChain %_ptr_Function_float %c %uint_0 + %204 = OpLoad %float %203 + %206 = OpAccessChain %_ptr_Function_float %p %uint_1 + %207 = OpLoad %float %206 + %209 = OpAccessChain %_ptr_Function_float %c %uint_1 + %210 = OpLoad %float %209 + %212 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %213 = OpLoad %float %212 + %215 = OpAccessChain %_ptr_Function_float %c %uint_0 + %216 = OpLoad %float %215 + %218 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %219 = OpLoad %float %218 + %221 = OpAccessChain %_ptr_Function_float %c %uint_1 + %222 = OpLoad %float %221 + %223 = OpFSub %float %201 %204 + %224 = OpFSub %float %207 %210 + %225 = OpCompositeConstruct %v2float %223 %224 + OpStore %param_4 %225 + %226 = OpFSub %float %213 %216 + %227 = OpFSub %float %219 %222 + %228 = OpCompositeConstruct %v2float %226 %227 + OpStore %param_5 %228 + %229 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5 + OpStore %pca %229 + %232 = OpLoad %float %pab + %233 = OpLoad %float %pca + %234 = OpFOrdLessThan %bool %232 %float_0 + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %235 + %236 = OpLabel + %237 = OpFOrdLessThan %bool %233 %float_0 + OpBranch %235 + %235 = OpLabel + %238 = OpPhi %bool %234 %196 %237 %236 + OpStore %x_206_phi %238 + %239 = OpLogicalNot %bool %238 + OpSelectionMerge %240 None + OpBranchConditional %239 %241 %240 + %241 = OpLabel + %242 = OpLoad %float %pab + %243 = OpLoad %float %pca + %244 = OpFOrdGreaterThanEqual %bool %242 %float_0 + OpSelectionMerge %245 None + OpBranchConditional %244 %246 %245 + %246 = OpLabel + %247 = OpFOrdGreaterThanEqual %bool %243 %float_0 + OpBranch %245 + %245 = OpLabel + %248 = OpPhi %bool %244 %241 %247 %246 + OpStore %x_205 %248 + %249 = OpLoad %bool %x_205 + OpStore %x_206_phi %249 + OpBranch %240 + %240 = OpLabel + %250 = OpLoad %bool %x_206_phi + %251 = OpLogicalNot %bool %250 + OpSelectionMerge %252 None + OpBranchConditional %251 %253 %252 + %253 = OpLabel + OpReturnValue %int_0 + %252 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %255 + %258 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %55 + %param_6 = OpVariable %_ptr_Function_v2float Function %55 + %param_7 = OpVariable %_ptr_Function_v2float Function %55 + %param_8 = OpVariable %_ptr_Function_v2float Function %55 + %param_9 = OpVariable %_ptr_Function_v2float Function %55 + %264 = OpLoad %v4float %gl_FragCoord + %266 = OpAccessChain %_ptr_Uniform_v2float %x_15 %uint_0 + %267 = OpLoad %v2float %266 + %268 = OpCompositeExtract %float %264 0 + %269 = OpCompositeExtract %float %264 1 + %270 = OpCompositeConstruct %v2float %268 %269 + %271 = OpFDiv %v2float %270 %267 + OpStore %pos %271 + %272 = OpLoad %v2float %pos + OpStore %param_6 %272 + OpStore %param_7 %275 + OpStore %param_8 %278 + OpStore %param_9 %281 + %282 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9 + %287 = OpIEqual %bool %282 %int_1 + OpSelectionMerge %288 None + OpBranchConditional %287 %289 %290 + %289 = OpLabel + OpStore %x_GLF_color %291 + OpBranch %288 + %290 = OpLabel + OpStore %x_GLF_color %292 + OpBranch %288 + %288 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %293 +%tint_symbol_1 = OpFunctionParameter %main_out + %297 = OpLabel + %298 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %298 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %255 + %300 = OpLabel + %301 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %301 + %302 = OpFunctionCall %void %main_1 + %304 = OpLoad %v4float %x_GLF_color + %305 = OpCompositeConstruct %main_out %304 + %303 = OpFunctionCall %void %tint_symbol_3 %305 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..d58c35ba03 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-clamp-conditional-mix/1.wgsl.expected.wgsl @@ -0,0 +1,172 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(0)]] var x_15 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn cross2d_vf2_vf2_(a : ptr>, b : ptr>) -> f32 { + let x_85 : f32 = (*(a)).x; + let x_87 : f32 = (*(b)).y; + let x_90 : f32 = (*(b)).x; + let x_92 : f32 = (*(a)).y; + return ((x_85 * x_87) - (x_90 * x_92)); +} + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a_1 : ptr>, b_1 : ptr>, c : ptr>) -> i32 { + var var_y : f32; + var x_96 : f32; + var x_97 : f32; + var clamp_y : f32; + var pab : f32; + var param : vec2; + var param_1 : vec2; + var pbc : f32; + var param_2 : vec2; + var param_3 : vec2; + var pca : f32; + var param_4 : vec2; + var param_5 : vec2; + var x_173 : bool; + var x_205 : bool; + var x_174_phi : bool; + var x_206_phi : bool; + let x_99 : f32 = x_15.resolution.x; + let x_101 : f32 = x_15.resolution.y; + if ((x_99 == x_101)) { + let x_106 : ptr = &((*(c)).y); + let x_107 : f32 = *(x_106); + let x_108 : vec2 = vec2(0.0, x_107); + if (true) { + let x_112 : f32 = *(x_106); + x_97 = x_112; + } else { + x_97 = 1.0; + } + let x_113 : f32 = x_97; + let x_114 : f32 = *(x_106); + let x_116 : vec2 = vec2(1.0, max(x_113, x_114)); + let x_117 : vec2 = vec2(x_108.x, x_108.y); + x_96 = x_107; + } else { + x_96 = -1.0; + } + let x_118 : f32 = x_96; + var_y = x_118; + let x_119 : ptr = &((*(c)).y); + let x_120 : f32 = *(x_119); + let x_121 : f32 = *(x_119); + let x_122 : f32 = var_y; + clamp_y = clamp(x_120, x_121, x_122); + let x_124 : ptr = &((*(p)).x); + let x_125 : f32 = *(x_124); + let x_126 : ptr = &((*(a_1)).x); + let x_127 : f32 = *(x_126); + let x_129 : ptr = &((*(p)).y); + let x_130 : f32 = *(x_129); + let x_131 : ptr = &((*(a_1)).y); + let x_132 : f32 = *(x_131); + let x_135 : ptr = &((*(b_1)).x); + let x_136 : f32 = *(x_135); + let x_137 : f32 = *(x_126); + let x_139 : ptr = &((*(b_1)).y); + let x_140 : f32 = *(x_139); + let x_141 : f32 = *(x_131); + param = vec2((x_125 - x_127), (x_130 - x_132)); + param_1 = vec2((x_136 - x_137), (x_140 - x_141)); + let x_144 : f32 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_144; + let x_145 : f32 = *(x_124); + let x_146 : f32 = *(x_135); + let x_148 : f32 = *(x_129); + let x_149 : f32 = *(x_139); + let x_152 : ptr = &((*(c)).x); + let x_153 : f32 = *(x_152); + let x_154 : f32 = *(x_135); + let x_156 : f32 = clamp_y; + let x_157 : f32 = *(x_139); + param_2 = vec2((x_145 - x_146), (x_148 - x_149)); + param_3 = vec2((x_153 - x_154), (x_156 - x_157)); + let x_160 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_160; + let x_161 : f32 = pab; + let x_163 : f32 = pbc; + let x_165 : bool = ((x_161 < 0.0) && (x_163 < 0.0)); + x_174_phi = x_165; + if (!(x_165)) { + let x_169 : f32 = pab; + let x_171 : f32 = pbc; + x_173 = ((x_169 >= 0.0) && (x_171 >= 0.0)); + x_174_phi = x_173; + } + let x_174 : bool = x_174_phi; + if (!(x_174)) { + return 0; + } + let x_178 : f32 = *(x_124); + let x_179 : f32 = *(x_152); + let x_181 : f32 = *(x_129); + let x_182 : f32 = *(x_119); + let x_185 : f32 = *(x_126); + let x_186 : f32 = *(x_152); + let x_188 : f32 = *(x_131); + let x_189 : f32 = *(x_119); + param_4 = vec2((x_178 - x_179), (x_181 - x_182)); + param_5 = vec2((x_185 - x_186), (x_188 - x_189)); + let x_192 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_192; + let x_193 : f32 = pab; + let x_195 : f32 = pca; + let x_197 : bool = ((x_193 < 0.0) && (x_195 < 0.0)); + x_206_phi = x_197; + if (!(x_197)) { + let x_201 : f32 = pab; + let x_203 : f32 = pca; + x_205 = ((x_201 >= 0.0) && (x_203 >= 0.0)); + x_206_phi = x_205; + } + let x_206 : bool = x_206_phi; + if (!(x_206)) { + return 0; + } + return 1; +} + +fn main_1() { + var pos : vec2; + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_72 : vec4 = gl_FragCoord; + let x_75 : vec2 = x_15.resolution; + pos = (vec2(x_72.x, x_72.y) / x_75); + let x_77 : vec2 = pos; + param_6 = x_77; + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_78 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_78 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm new file mode 100644 index 0000000000..73527284f3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm @@ -0,0 +1,266 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %cross2d_vf2_vf2_ "cross2d(vf2;vf2;" + OpName %a "a" + OpName %b "b" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %p "p" + OpName %a_0 "a" + OpName %b_0 "b" + OpName %c "c" + OpName %pab "pab" + OpName %param "param" + OpName %param_0 "param" + OpName %pbc "pbc" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %pca "pca" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %pos "pos" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %param_5 "param" + OpName %param_6 "param" + OpName %param_7 "param" + OpName %param_8 "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %30 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %34 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float + %int = OpTypeInt 32 1 + %36 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %51 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %54 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %57 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %60 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %61 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main = OpFunction %void None %30 + %62 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function + %param_5 = OpVariable %_ptr_Function_v2float Function + %param_6 = OpVariable %_ptr_Function_v2float Function + %param_7 = OpVariable %_ptr_Function_v2float Function + %param_8 = OpVariable %_ptr_Function_v2float Function + %63 = OpLoad %v4float %gl_FragCoord + %64 = OpVectorShuffle %v2float %63 %63 0 1 + %65 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %66 = OpLoad %v2float %65 + %67 = OpFDiv %v2float %64 %66 + OpStore %pos %67 + %68 = OpLoad %v2float %pos + OpStore %param_5 %68 + OpStore %param_6 %51 + OpStore %param_7 %54 + OpStore %param_8 %57 + %69 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_5 %param_6 %param_7 %param_8 + %70 = OpIEqual %bool %69 %int_1 + OpSelectionMerge %71 None + OpBranchConditional %70 %72 %73 + %72 = OpLabel + OpStore %_GLF_color %60 + OpBranch %71 + %73 = OpLabel + OpStore %_GLF_color %61 + OpBranch %71 + %71 = OpLabel + OpReturn + OpFunctionEnd +%cross2d_vf2_vf2_ = OpFunction %float None %34 + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %74 = OpLabel + %75 = OpAccessChain %_ptr_Function_float %a %uint_0 + %76 = OpLoad %float %75 + %77 = OpAccessChain %_ptr_Function_float %b %uint_1 + %78 = OpLoad %float %77 + %79 = OpFMul %float %76 %78 + %80 = OpAccessChain %_ptr_Function_float %b %uint_0 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Function_float %a %uint_1 + %83 = OpLoad %float %82 + %84 = OpFMul %float %81 %83 + %85 = OpFSub %float %79 %84 + OpReturnValue %85 + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %36 + %p = OpFunctionParameter %_ptr_Function_v2float + %a_0 = OpFunctionParameter %_ptr_Function_v2float + %b_0 = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %86 = OpLabel + %pab = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_v2float Function + %param_0 = OpVariable %_ptr_Function_v2float Function + %pbc = OpVariable %_ptr_Function_float Function + %param_1 = OpVariable %_ptr_Function_v2float Function + %param_2 = OpVariable %_ptr_Function_v2float Function + %pca = OpVariable %_ptr_Function_float Function + %param_3 = OpVariable %_ptr_Function_v2float Function + %param_4 = OpVariable %_ptr_Function_v2float Function + %87 = OpAccessChain %_ptr_Function_float %p %uint_0 + %88 = OpLoad %float %87 + %89 = OpAccessChain %_ptr_Function_float %a_0 %uint_0 + %90 = OpLoad %float %89 + %91 = OpFSub %float %88 %90 + %92 = OpAccessChain %_ptr_Function_float %p %uint_1 + %93 = OpLoad %float %92 + %94 = OpAccessChain %_ptr_Function_float %a_0 %uint_1 + %95 = OpLoad %float %94 + %96 = OpFSub %float %93 %95 + %97 = OpCompositeConstruct %v2float %91 %96 + %98 = OpAccessChain %_ptr_Function_float %b_0 %uint_0 + %99 = OpLoad %float %98 + %100 = OpAccessChain %_ptr_Function_float %a_0 %uint_0 + %101 = OpLoad %float %100 + %102 = OpFSub %float %99 %101 + %103 = OpAccessChain %_ptr_Function_float %b_0 %uint_1 + %104 = OpLoad %float %103 + %105 = OpAccessChain %_ptr_Function_float %a_0 %uint_1 + %106 = OpLoad %float %105 + %107 = OpFSub %float %104 %106 + %108 = OpCompositeConstruct %v2float %102 %107 + OpStore %param %97 + OpStore %param_0 %108 + %109 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_0 + OpStore %pab %109 + %110 = OpAccessChain %_ptr_Function_float %p %uint_0 + %111 = OpLoad %float %110 + %112 = OpAccessChain %_ptr_Function_float %b_0 %uint_0 + %113 = OpLoad %float %112 + %114 = OpFSub %float %111 %113 + %115 = OpAccessChain %_ptr_Function_float %p %uint_1 + %116 = OpLoad %float %115 + %117 = OpAccessChain %_ptr_Function_float %b_0 %uint_1 + %118 = OpLoad %float %117 + %119 = OpFSub %float %116 %118 + %120 = OpCompositeConstruct %v2float %114 %119 + %121 = OpAccessChain %_ptr_Function_float %c %uint_0 + %122 = OpLoad %float %121 + %123 = OpAccessChain %_ptr_Function_float %b_0 %uint_0 + %124 = OpLoad %float %123 + %125 = OpFSub %float %122 %124 + %126 = OpAccessChain %_ptr_Function_float %c %uint_1 + %127 = OpLoad %float %126 + %128 = OpAccessChain %_ptr_Function_float %b_0 %uint_1 + %129 = OpLoad %float %128 + %130 = OpFSub %float %127 %129 + %131 = OpCompositeConstruct %v2float %125 %130 + OpStore %param_1 %120 + OpStore %param_2 %131 + %132 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_1 %param_2 + OpStore %pbc %132 + %133 = OpLoad %float %pab + %134 = OpFOrdLessThan %bool %133 %float_0 + %135 = OpLoad %float %pbc + %136 = OpFOrdLessThan %bool %135 %float_0 + %137 = OpLogicalAnd %bool %134 %136 + %138 = OpLogicalNot %bool %137 + OpSelectionMerge %139 None + OpBranchConditional %138 %140 %139 + %140 = OpLabel + %141 = OpLoad %float %pab + %142 = OpFOrdGreaterThanEqual %bool %141 %float_0 + %143 = OpLoad %float %pbc + %144 = OpFOrdGreaterThanEqual %bool %143 %float_0 + %145 = OpLogicalAnd %bool %142 %144 + OpBranch %139 + %139 = OpLabel + %146 = OpPhi %bool %137 %86 %145 %140 + %147 = OpLogicalNot %bool %146 + OpSelectionMerge %148 None + OpBranchConditional %147 %149 %148 + %149 = OpLabel + OpReturnValue %int_0 + %148 = OpLabel + %150 = OpAccessChain %_ptr_Function_float %p %uint_0 + %151 = OpLoad %float %150 + %152 = OpAccessChain %_ptr_Function_float %c %uint_0 + %153 = OpLoad %float %152 + %154 = OpFSub %float %151 %153 + %155 = OpAccessChain %_ptr_Function_float %p %uint_1 + %156 = OpLoad %float %155 + %157 = OpAccessChain %_ptr_Function_float %c %uint_1 + %158 = OpLoad %float %157 + %159 = OpFSub %float %156 %158 + %160 = OpCompositeConstruct %v2float %154 %159 + %161 = OpAccessChain %_ptr_Function_float %a_0 %uint_0 + %162 = OpLoad %float %161 + %163 = OpAccessChain %_ptr_Function_float %c %uint_0 + %164 = OpLoad %float %163 + %165 = OpFSub %float %162 %164 + %166 = OpAccessChain %_ptr_Function_float %a_0 %uint_1 + %167 = OpLoad %float %166 + %168 = OpAccessChain %_ptr_Function_float %c %uint_1 + %169 = OpLoad %float %168 + %170 = OpFSub %float %167 %169 + %171 = OpCompositeConstruct %v2float %165 %170 + OpStore %param_3 %160 + OpStore %param_4 %171 + %172 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_3 %param_4 + OpStore %pca %172 + %173 = OpLoad %float %pab + %174 = OpFOrdLessThan %bool %173 %float_0 + %175 = OpLoad %float %pca + %176 = OpFOrdLessThan %bool %175 %float_0 + %177 = OpLogicalAnd %bool %174 %176 + %178 = OpLogicalNot %bool %177 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %179 + %180 = OpLabel + %181 = OpLoad %float %pab + %182 = OpFOrdGreaterThanEqual %bool %181 %float_0 + %183 = OpLoad %float %pca + %184 = OpFOrdGreaterThanEqual %bool %183 %float_0 + %185 = OpLogicalAnd %bool %182 %184 + OpBranch %179 + %179 = OpLabel + %186 = OpPhi %bool %177 %148 %185 %180 + %187 = OpLogicalNot %bool %186 + OpSelectionMerge %188 None + OpBranchConditional %187 %189 %188 + %189 = OpLabel + OpReturnValue %int_0 + %188 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..f228156100 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.hlsl @@ -0,0 +1,141 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_24 : register(b0, space0) { + uint4 x_24[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float cross2d_vf2_vf2_(inout float2 a, inout float2 b) { + const float x_76 = a.x; + const float x_78 = b.y; + const float x_81 = b.x; + const float x_83 = a.y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout float2 b_1, inout float2 c) { + float pab = 0.0f; + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + float pbc = 0.0f; + float2 param_2 = float2(0.0f, 0.0f); + float2 param_3 = float2(0.0f, 0.0f); + float pca = 0.0f; + float2 param_4 = float2(0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + bool x_145 = false; + bool x_185 = false; + bool x_146_phi = false; + bool x_186_phi = false; + const float x_88 = p.x; + const float x_90 = a_1.x; + const float x_93 = p.y; + const float x_95 = a_1.y; + const float x_99 = b_1.x; + const float x_101 = a_1.x; + const float x_104 = b_1.y; + const float x_106 = a_1.y; + param = float2((x_88 - x_90), (x_93 - x_95)); + param_1 = float2((x_99 - x_101), (x_104 - x_106)); + const float x_109 = cross2d_vf2_vf2_(param, param_1); + pab = x_109; + const float x_111 = p.x; + const float x_113 = b_1.x; + const float x_116 = p.y; + const float x_118 = b_1.y; + const float x_122 = c.x; + const float x_124 = b_1.x; + const float x_127 = c.y; + const float x_129 = b_1.y; + param_2 = float2((x_111 - x_113), (x_116 - x_118)); + param_3 = float2((x_122 - x_124), (x_127 - x_129)); + const float x_132 = cross2d_vf2_vf2_(param_2, param_3); + pbc = x_132; + bool tint_tmp = (pab < 0.0f); + if (tint_tmp) { + tint_tmp = (pbc < 0.0f); + } + const bool x_137 = (tint_tmp); + x_146_phi = x_137; + if (!(x_137)) { + bool tint_tmp_1 = (pab >= 0.0f); + if (tint_tmp_1) { + tint_tmp_1 = (pbc >= 0.0f); + } + x_145 = (tint_tmp_1); + x_146_phi = x_145; + } + if (!(x_146_phi)) { + return 0; + } + const float x_151 = p.x; + const float x_153 = c.x; + const float x_156 = p.y; + const float x_158 = c.y; + const float x_162 = a_1.x; + const float x_164 = c.x; + const float x_167 = a_1.y; + const float x_169 = c.y; + param_4 = float2((x_151 - x_153), (x_156 - x_158)); + param_5 = float2((x_162 - x_164), (x_167 - x_169)); + const float x_172 = cross2d_vf2_vf2_(param_4, param_5); + pca = x_172; + bool tint_tmp_2 = (pab < 0.0f); + if (tint_tmp_2) { + tint_tmp_2 = (pca < 0.0f); + } + const bool x_177 = (tint_tmp_2); + x_186_phi = x_177; + if (!(x_177)) { + bool tint_tmp_3 = (pab >= 0.0f); + if (tint_tmp_3) { + tint_tmp_3 = (pca >= 0.0f); + } + x_185 = (tint_tmp_3); + x_186_phi = x_185; + } + if (!(x_186_phi)) { + return 0; + } + return 1; +} + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + float2 param_6 = float2(0.0f, 0.0f); + float2 param_7 = float2(0.0f, 0.0f); + float2 param_8 = float2(0.0f, 0.0f); + float2 param_9 = float2(0.0f, 0.0f); + const float4 x_63 = gl_FragCoord; + const float2 x_66 = asfloat(x_24[0].xy); + pos = (float2(x_63.x, x_63.y) / x_66); + param_6 = pos; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + const int x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9); + if ((x_69 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.msl new file mode 100644 index 0000000000..8d1f7be31c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.msl @@ -0,0 +1,135 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float cross2d_vf2_vf2_(thread float2* const a, thread float2* const b) { + float const x_76 = (*(a)).x; + float const x_78 = (*(b)).y; + float const x_81 = (*(b)).x; + float const x_83 = (*(a)).y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) { + float pab = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + float pbc = 0.0f; + float2 param_2 = 0.0f; + float2 param_3 = 0.0f; + float pca = 0.0f; + float2 param_4 = 0.0f; + float2 param_5 = 0.0f; + bool x_145 = false; + bool x_185 = false; + bool x_146_phi = false; + bool x_186_phi = false; + float const x_88 = (*(p)).x; + float const x_90 = (*(a_1)).x; + float const x_93 = (*(p)).y; + float const x_95 = (*(a_1)).y; + float const x_99 = (*(b_1)).x; + float const x_101 = (*(a_1)).x; + float const x_104 = (*(b_1)).y; + float const x_106 = (*(a_1)).y; + param = float2((x_88 - x_90), (x_93 - x_95)); + param_1 = float2((x_99 - x_101), (x_104 - x_106)); + float const x_109 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_109; + float const x_111 = (*(p)).x; + float const x_113 = (*(b_1)).x; + float const x_116 = (*(p)).y; + float const x_118 = (*(b_1)).y; + float const x_122 = (*(c)).x; + float const x_124 = (*(b_1)).x; + float const x_127 = (*(c)).y; + float const x_129 = (*(b_1)).y; + param_2 = float2((x_111 - x_113), (x_116 - x_118)); + param_3 = float2((x_122 - x_124), (x_127 - x_129)); + float const x_132 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_132; + float const x_133 = pab; + float const x_135 = pbc; + bool const x_137 = ((x_133 < 0.0f) && (x_135 < 0.0f)); + x_146_phi = x_137; + if (!(x_137)) { + float const x_141 = pab; + float const x_143 = pbc; + x_145 = ((x_141 >= 0.0f) && (x_143 >= 0.0f)); + x_146_phi = x_145; + } + bool const x_146 = x_146_phi; + if (!(x_146)) { + return 0; + } + float const x_151 = (*(p)).x; + float const x_153 = (*(c)).x; + float const x_156 = (*(p)).y; + float const x_158 = (*(c)).y; + float const x_162 = (*(a_1)).x; + float const x_164 = (*(c)).x; + float const x_167 = (*(a_1)).y; + float const x_169 = (*(c)).y; + param_4 = float2((x_151 - x_153), (x_156 - x_158)); + param_5 = float2((x_162 - x_164), (x_167 - x_169)); + float const x_172 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_172; + float const x_173 = pab; + float const x_175 = pca; + bool const x_177 = ((x_173 < 0.0f) && (x_175 < 0.0f)); + x_186_phi = x_177; + if (!(x_177)) { + float const x_181 = pab; + float const x_183 = pca; + x_185 = ((x_181 >= 0.0f) && (x_183 >= 0.0f)); + x_186_phi = x_185; + } + bool const x_186 = x_186_phi; + if (!(x_186)) { + return 0; + } + return 1; +} + +void main_1(constant buf0& x_24, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 pos = 0.0f; + float2 param_6 = 0.0f; + float2 param_7 = 0.0f; + float2 param_8 = 0.0f; + float2 param_9 = 0.0f; + float4 const x_63 = *(tint_symbol_5); + float2 const x_66 = x_24.resolution; + pos = (float2(x_63.x, x_63.y) / x_66); + float2 const x_68 = pos; + param_6 = x_68; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + int const x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_69 == 1)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_24 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_24, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..0d3239b1b8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.spvasm @@ -0,0 +1,343 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 264 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_24 "x_24" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %cross2d_vf2_vf2_ "cross2d_vf2_vf2_" + OpName %a "a" + OpName %b "b" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_" + OpName %p "p" + OpName %a_1 "a_1" + OpName %b_1 "b_1" + OpName %c "c" + OpName %pab "pab" + OpName %param "param" + OpName %param_1 "param_1" + OpName %pbc "pbc" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %pca "pca" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %x_145 "x_145" + OpName %x_185 "x_185" + OpName %x_146_phi "x_146_phi" + OpName %x_186_phi "x_186_phi" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_24 NonWritable + OpDecorate %x_24 DescriptorSet 0 + OpDecorate %x_24 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_24 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %40 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %49 = OpConstantNull %float + %51 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %62 = OpConstantNull %bool + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %212 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %232 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %235 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %238 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 + %float_1 = OpConstant %float 1 + %249 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %250 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %251 = OpTypeFunction %void %main_out +%cross2d_vf2_vf2_ = OpFunction %float None %15 + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %20 = OpLabel + %25 = OpAccessChain %_ptr_Function_float %a %uint_0 + %26 = OpLoad %float %25 + %29 = OpAccessChain %_ptr_Function_float %b %uint_1 + %30 = OpLoad %float %29 + %32 = OpAccessChain %_ptr_Function_float %b %uint_0 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Function_float %a %uint_1 + %36 = OpLoad %float %35 + %37 = OpFMul %float %26 %30 + %38 = OpFMul %float %33 %36 + %39 = OpFSub %float %37 %38 + OpReturnValue %39 + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %40 + %p = OpFunctionParameter %_ptr_Function_v2float + %a_1 = OpFunctionParameter %_ptr_Function_v2float + %b_1 = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %47 = OpLabel + %pab = OpVariable %_ptr_Function_float Function %49 + %param = OpVariable %_ptr_Function_v2float Function %51 + %param_1 = OpVariable %_ptr_Function_v2float Function %51 + %pbc = OpVariable %_ptr_Function_float Function %49 + %param_2 = OpVariable %_ptr_Function_v2float Function %51 + %param_3 = OpVariable %_ptr_Function_v2float Function %51 + %pca = OpVariable %_ptr_Function_float Function %49 + %param_4 = OpVariable %_ptr_Function_v2float Function %51 + %param_5 = OpVariable %_ptr_Function_v2float Function %51 + %x_145 = OpVariable %_ptr_Function_bool Function %62 + %x_185 = OpVariable %_ptr_Function_bool Function %62 + %x_146_phi = OpVariable %_ptr_Function_bool Function %62 + %x_186_phi = OpVariable %_ptr_Function_bool Function %62 + %67 = OpAccessChain %_ptr_Function_float %p %uint_0 + %68 = OpLoad %float %67 + %70 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %71 = OpLoad %float %70 + %73 = OpAccessChain %_ptr_Function_float %p %uint_1 + %74 = OpLoad %float %73 + %76 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %77 = OpLoad %float %76 + %79 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %80 = OpLoad %float %79 + %82 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %83 = OpLoad %float %82 + %85 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %86 = OpLoad %float %85 + %88 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %89 = OpLoad %float %88 + %90 = OpFSub %float %68 %71 + %91 = OpFSub %float %74 %77 + %92 = OpCompositeConstruct %v2float %90 %91 + OpStore %param %92 + %93 = OpFSub %float %80 %83 + %94 = OpFSub %float %86 %89 + %95 = OpCompositeConstruct %v2float %93 %94 + OpStore %param_1 %95 + %96 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_1 + OpStore %pab %96 + %100 = OpAccessChain %_ptr_Function_float %p %uint_0 + %101 = OpLoad %float %100 + %103 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %104 = OpLoad %float %103 + %106 = OpAccessChain %_ptr_Function_float %p %uint_1 + %107 = OpLoad %float %106 + %109 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %110 = OpLoad %float %109 + %112 = OpAccessChain %_ptr_Function_float %c %uint_0 + %113 = OpLoad %float %112 + %115 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %116 = OpLoad %float %115 + %118 = OpAccessChain %_ptr_Function_float %c %uint_1 + %119 = OpLoad %float %118 + %121 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %122 = OpLoad %float %121 + %123 = OpFSub %float %101 %104 + %124 = OpFSub %float %107 %110 + %125 = OpCompositeConstruct %v2float %123 %124 + OpStore %param_2 %125 + %126 = OpFSub %float %113 %116 + %127 = OpFSub %float %119 %122 + %128 = OpCompositeConstruct %v2float %126 %127 + OpStore %param_3 %128 + %129 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_2 %param_3 + OpStore %pbc %129 + %132 = OpLoad %float %pab + %133 = OpLoad %float %pbc + %135 = OpFOrdLessThan %bool %132 %float_0 + OpSelectionMerge %136 None + OpBranchConditional %135 %137 %136 + %137 = OpLabel + %138 = OpFOrdLessThan %bool %133 %float_0 + OpBranch %136 + %136 = OpLabel + %139 = OpPhi %bool %135 %47 %138 %137 + OpStore %x_146_phi %139 + %140 = OpLogicalNot %bool %139 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + %143 = OpLoad %float %pab + %144 = OpLoad %float %pbc + %145 = OpFOrdGreaterThanEqual %bool %143 %float_0 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %148 = OpFOrdGreaterThanEqual %bool %144 %float_0 + OpBranch %146 + %146 = OpLabel + %149 = OpPhi %bool %145 %142 %148 %147 + OpStore %x_145 %149 + %150 = OpLoad %bool %x_145 + OpStore %x_146_phi %150 + OpBranch %141 + %141 = OpLabel + %151 = OpLoad %bool %x_146_phi + %152 = OpLogicalNot %bool %151 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + OpReturnValue %int_0 + %153 = OpLabel + %157 = OpAccessChain %_ptr_Function_float %p %uint_0 + %158 = OpLoad %float %157 + %160 = OpAccessChain %_ptr_Function_float %c %uint_0 + %161 = OpLoad %float %160 + %163 = OpAccessChain %_ptr_Function_float %p %uint_1 + %164 = OpLoad %float %163 + %166 = OpAccessChain %_ptr_Function_float %c %uint_1 + %167 = OpLoad %float %166 + %169 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %170 = OpLoad %float %169 + %172 = OpAccessChain %_ptr_Function_float %c %uint_0 + %173 = OpLoad %float %172 + %175 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %176 = OpLoad %float %175 + %178 = OpAccessChain %_ptr_Function_float %c %uint_1 + %179 = OpLoad %float %178 + %180 = OpFSub %float %158 %161 + %181 = OpFSub %float %164 %167 + %182 = OpCompositeConstruct %v2float %180 %181 + OpStore %param_4 %182 + %183 = OpFSub %float %170 %173 + %184 = OpFSub %float %176 %179 + %185 = OpCompositeConstruct %v2float %183 %184 + OpStore %param_5 %185 + %186 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5 + OpStore %pca %186 + %189 = OpLoad %float %pab + %190 = OpLoad %float %pca + %191 = OpFOrdLessThan %bool %189 %float_0 + OpSelectionMerge %192 None + OpBranchConditional %191 %193 %192 + %193 = OpLabel + %194 = OpFOrdLessThan %bool %190 %float_0 + OpBranch %192 + %192 = OpLabel + %195 = OpPhi %bool %191 %153 %194 %193 + OpStore %x_186_phi %195 + %196 = OpLogicalNot %bool %195 + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %197 + %198 = OpLabel + %199 = OpLoad %float %pab + %200 = OpLoad %float %pca + %201 = OpFOrdGreaterThanEqual %bool %199 %float_0 + OpSelectionMerge %202 None + OpBranchConditional %201 %203 %202 + %203 = OpLabel + %204 = OpFOrdGreaterThanEqual %bool %200 %float_0 + OpBranch %202 + %202 = OpLabel + %205 = OpPhi %bool %201 %198 %204 %203 + OpStore %x_185 %205 + %206 = OpLoad %bool %x_185 + OpStore %x_186_phi %206 + OpBranch %197 + %197 = OpLabel + %207 = OpLoad %bool %x_186_phi + %208 = OpLogicalNot %bool %207 + OpSelectionMerge %209 None + OpBranchConditional %208 %210 %209 + %210 = OpLabel + OpReturnValue %int_0 + %209 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %212 + %215 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %51 + %param_6 = OpVariable %_ptr_Function_v2float Function %51 + %param_7 = OpVariable %_ptr_Function_v2float Function %51 + %param_8 = OpVariable %_ptr_Function_v2float Function %51 + %param_9 = OpVariable %_ptr_Function_v2float Function %51 + %221 = OpLoad %v4float %gl_FragCoord + %223 = OpAccessChain %_ptr_Uniform_v2float %x_24 %uint_0 + %224 = OpLoad %v2float %223 + %225 = OpCompositeExtract %float %221 0 + %226 = OpCompositeExtract %float %221 1 + %227 = OpCompositeConstruct %v2float %225 %226 + %228 = OpFDiv %v2float %227 %224 + OpStore %pos %228 + %229 = OpLoad %v2float %pos + OpStore %param_6 %229 + OpStore %param_7 %232 + OpStore %param_8 %235 + OpStore %param_9 %238 + %239 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9 + %244 = OpIEqual %bool %239 %int_1 + OpSelectionMerge %245 None + OpBranchConditional %244 %246 %247 + %246 = OpLabel + OpStore %x_GLF_color %249 + OpBranch %245 + %247 = OpLabel + OpStore %x_GLF_color %250 + OpBranch %245 + %245 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %251 +%tint_symbol_1 = OpFunctionParameter %main_out + %255 = OpLabel + %256 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %256 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %212 + %258 = OpLabel + %259 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %259 + %260 = OpFunctionCall %void %main_1 + %262 = OpLoad %v4float %x_GLF_color + %263 = OpCompositeConstruct %main_out %262 + %261 = OpFunctionCall %void %tint_symbol_3 %263 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..33d8a7df5a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.spvasm.expected.wgsl @@ -0,0 +1,134 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_24 : buf0; + +var x_GLF_color : vec4; + +fn cross2d_vf2_vf2_(a : ptr>, b : ptr>) -> f32 { + let x_76 : f32 = (*(a)).x; + let x_78 : f32 = (*(b)).y; + let x_81 : f32 = (*(b)).x; + let x_83 : f32 = (*(a)).y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a_1 : ptr>, b_1 : ptr>, c : ptr>) -> i32 { + var pab : f32; + var param : vec2; + var param_1 : vec2; + var pbc : f32; + var param_2 : vec2; + var param_3 : vec2; + var pca : f32; + var param_4 : vec2; + var param_5 : vec2; + var x_145 : bool; + var x_185 : bool; + var x_146_phi : bool; + var x_186_phi : bool; + let x_88 : f32 = (*(p)).x; + let x_90 : f32 = (*(a_1)).x; + let x_93 : f32 = (*(p)).y; + let x_95 : f32 = (*(a_1)).y; + let x_99 : f32 = (*(b_1)).x; + let x_101 : f32 = (*(a_1)).x; + let x_104 : f32 = (*(b_1)).y; + let x_106 : f32 = (*(a_1)).y; + param = vec2((x_88 - x_90), (x_93 - x_95)); + param_1 = vec2((x_99 - x_101), (x_104 - x_106)); + let x_109 : f32 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_109; + let x_111 : f32 = (*(p)).x; + let x_113 : f32 = (*(b_1)).x; + let x_116 : f32 = (*(p)).y; + let x_118 : f32 = (*(b_1)).y; + let x_122 : f32 = (*(c)).x; + let x_124 : f32 = (*(b_1)).x; + let x_127 : f32 = (*(c)).y; + let x_129 : f32 = (*(b_1)).y; + param_2 = vec2((x_111 - x_113), (x_116 - x_118)); + param_3 = vec2((x_122 - x_124), (x_127 - x_129)); + let x_132 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_132; + let x_133 : f32 = pab; + let x_135 : f32 = pbc; + let x_137 : bool = ((x_133 < 0.0) && (x_135 < 0.0)); + x_146_phi = x_137; + if (!(x_137)) { + let x_141 : f32 = pab; + let x_143 : f32 = pbc; + x_145 = ((x_141 >= 0.0) && (x_143 >= 0.0)); + x_146_phi = x_145; + } + let x_146 : bool = x_146_phi; + if (!(x_146)) { + return 0; + } + let x_151 : f32 = (*(p)).x; + let x_153 : f32 = (*(c)).x; + let x_156 : f32 = (*(p)).y; + let x_158 : f32 = (*(c)).y; + let x_162 : f32 = (*(a_1)).x; + let x_164 : f32 = (*(c)).x; + let x_167 : f32 = (*(a_1)).y; + let x_169 : f32 = (*(c)).y; + param_4 = vec2((x_151 - x_153), (x_156 - x_158)); + param_5 = vec2((x_162 - x_164), (x_167 - x_169)); + let x_172 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_172; + let x_173 : f32 = pab; + let x_175 : f32 = pca; + let x_177 : bool = ((x_173 < 0.0) && (x_175 < 0.0)); + x_186_phi = x_177; + if (!(x_177)) { + let x_181 : f32 = pab; + let x_183 : f32 = pca; + x_185 = ((x_181 >= 0.0) && (x_183 >= 0.0)); + x_186_phi = x_185; + } + let x_186 : bool = x_186_phi; + if (!(x_186)) { + return 0; + } + return 1; +} + +fn main_1() { + var pos : vec2; + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_63 : vec4 = gl_FragCoord; + let x_66 : vec2 = x_24.resolution; + pos = (vec2(x_63.x, x_63.y) / x_66); + let x_68 : vec2 = pos; + param_6 = x_68; + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_69 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_69 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl new file mode 100644 index 0000000000..33d8a7df5a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl @@ -0,0 +1,134 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_24 : buf0; + +var x_GLF_color : vec4; + +fn cross2d_vf2_vf2_(a : ptr>, b : ptr>) -> f32 { + let x_76 : f32 = (*(a)).x; + let x_78 : f32 = (*(b)).y; + let x_81 : f32 = (*(b)).x; + let x_83 : f32 = (*(a)).y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a_1 : ptr>, b_1 : ptr>, c : ptr>) -> i32 { + var pab : f32; + var param : vec2; + var param_1 : vec2; + var pbc : f32; + var param_2 : vec2; + var param_3 : vec2; + var pca : f32; + var param_4 : vec2; + var param_5 : vec2; + var x_145 : bool; + var x_185 : bool; + var x_146_phi : bool; + var x_186_phi : bool; + let x_88 : f32 = (*(p)).x; + let x_90 : f32 = (*(a_1)).x; + let x_93 : f32 = (*(p)).y; + let x_95 : f32 = (*(a_1)).y; + let x_99 : f32 = (*(b_1)).x; + let x_101 : f32 = (*(a_1)).x; + let x_104 : f32 = (*(b_1)).y; + let x_106 : f32 = (*(a_1)).y; + param = vec2((x_88 - x_90), (x_93 - x_95)); + param_1 = vec2((x_99 - x_101), (x_104 - x_106)); + let x_109 : f32 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_109; + let x_111 : f32 = (*(p)).x; + let x_113 : f32 = (*(b_1)).x; + let x_116 : f32 = (*(p)).y; + let x_118 : f32 = (*(b_1)).y; + let x_122 : f32 = (*(c)).x; + let x_124 : f32 = (*(b_1)).x; + let x_127 : f32 = (*(c)).y; + let x_129 : f32 = (*(b_1)).y; + param_2 = vec2((x_111 - x_113), (x_116 - x_118)); + param_3 = vec2((x_122 - x_124), (x_127 - x_129)); + let x_132 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_132; + let x_133 : f32 = pab; + let x_135 : f32 = pbc; + let x_137 : bool = ((x_133 < 0.0) && (x_135 < 0.0)); + x_146_phi = x_137; + if (!(x_137)) { + let x_141 : f32 = pab; + let x_143 : f32 = pbc; + x_145 = ((x_141 >= 0.0) && (x_143 >= 0.0)); + x_146_phi = x_145; + } + let x_146 : bool = x_146_phi; + if (!(x_146)) { + return 0; + } + let x_151 : f32 = (*(p)).x; + let x_153 : f32 = (*(c)).x; + let x_156 : f32 = (*(p)).y; + let x_158 : f32 = (*(c)).y; + let x_162 : f32 = (*(a_1)).x; + let x_164 : f32 = (*(c)).x; + let x_167 : f32 = (*(a_1)).y; + let x_169 : f32 = (*(c)).y; + param_4 = vec2((x_151 - x_153), (x_156 - x_158)); + param_5 = vec2((x_162 - x_164), (x_167 - x_169)); + let x_172 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_172; + let x_173 : f32 = pab; + let x_175 : f32 = pca; + let x_177 : bool = ((x_173 < 0.0) && (x_175 < 0.0)); + x_186_phi = x_177; + if (!(x_177)) { + let x_181 : f32 = pab; + let x_183 : f32 = pca; + x_185 = ((x_181 >= 0.0) && (x_183 >= 0.0)); + x_186_phi = x_185; + } + let x_186 : bool = x_186_phi; + if (!(x_186)) { + return 0; + } + return 1; +} + +fn main_1() { + var pos : vec2; + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_63 : vec4 = gl_FragCoord; + let x_66 : vec2 = x_24.resolution; + pos = (vec2(x_63.x, x_63.y) / x_66); + let x_68 : vec2 = pos; + param_6 = x_68; + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_69 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_69 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..f228156100 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.hlsl @@ -0,0 +1,141 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_24 : register(b0, space0) { + uint4 x_24[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float cross2d_vf2_vf2_(inout float2 a, inout float2 b) { + const float x_76 = a.x; + const float x_78 = b.y; + const float x_81 = b.x; + const float x_83 = a.y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout float2 b_1, inout float2 c) { + float pab = 0.0f; + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + float pbc = 0.0f; + float2 param_2 = float2(0.0f, 0.0f); + float2 param_3 = float2(0.0f, 0.0f); + float pca = 0.0f; + float2 param_4 = float2(0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + bool x_145 = false; + bool x_185 = false; + bool x_146_phi = false; + bool x_186_phi = false; + const float x_88 = p.x; + const float x_90 = a_1.x; + const float x_93 = p.y; + const float x_95 = a_1.y; + const float x_99 = b_1.x; + const float x_101 = a_1.x; + const float x_104 = b_1.y; + const float x_106 = a_1.y; + param = float2((x_88 - x_90), (x_93 - x_95)); + param_1 = float2((x_99 - x_101), (x_104 - x_106)); + const float x_109 = cross2d_vf2_vf2_(param, param_1); + pab = x_109; + const float x_111 = p.x; + const float x_113 = b_1.x; + const float x_116 = p.y; + const float x_118 = b_1.y; + const float x_122 = c.x; + const float x_124 = b_1.x; + const float x_127 = c.y; + const float x_129 = b_1.y; + param_2 = float2((x_111 - x_113), (x_116 - x_118)); + param_3 = float2((x_122 - x_124), (x_127 - x_129)); + const float x_132 = cross2d_vf2_vf2_(param_2, param_3); + pbc = x_132; + bool tint_tmp = (pab < 0.0f); + if (tint_tmp) { + tint_tmp = (pbc < 0.0f); + } + const bool x_137 = (tint_tmp); + x_146_phi = x_137; + if (!(x_137)) { + bool tint_tmp_1 = (pab >= 0.0f); + if (tint_tmp_1) { + tint_tmp_1 = (pbc >= 0.0f); + } + x_145 = (tint_tmp_1); + x_146_phi = x_145; + } + if (!(x_146_phi)) { + return 0; + } + const float x_151 = p.x; + const float x_153 = c.x; + const float x_156 = p.y; + const float x_158 = c.y; + const float x_162 = a_1.x; + const float x_164 = c.x; + const float x_167 = a_1.y; + const float x_169 = c.y; + param_4 = float2((x_151 - x_153), (x_156 - x_158)); + param_5 = float2((x_162 - x_164), (x_167 - x_169)); + const float x_172 = cross2d_vf2_vf2_(param_4, param_5); + pca = x_172; + bool tint_tmp_2 = (pab < 0.0f); + if (tint_tmp_2) { + tint_tmp_2 = (pca < 0.0f); + } + const bool x_177 = (tint_tmp_2); + x_186_phi = x_177; + if (!(x_177)) { + bool tint_tmp_3 = (pab >= 0.0f); + if (tint_tmp_3) { + tint_tmp_3 = (pca >= 0.0f); + } + x_185 = (tint_tmp_3); + x_186_phi = x_185; + } + if (!(x_186_phi)) { + return 0; + } + return 1; +} + +void main_1() { + float2 pos = float2(0.0f, 0.0f); + float2 param_6 = float2(0.0f, 0.0f); + float2 param_7 = float2(0.0f, 0.0f); + float2 param_8 = float2(0.0f, 0.0f); + float2 param_9 = float2(0.0f, 0.0f); + const float4 x_63 = gl_FragCoord; + const float2 x_66 = asfloat(x_24[0].xy); + pos = (float2(x_63.x, x_63.y) / x_66); + param_6 = pos; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + const int x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9); + if ((x_69 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.msl new file mode 100644 index 0000000000..8d1f7be31c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.msl @@ -0,0 +1,135 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float cross2d_vf2_vf2_(thread float2* const a, thread float2* const b) { + float const x_76 = (*(a)).x; + float const x_78 = (*(b)).y; + float const x_81 = (*(b)).x; + float const x_83 = (*(a)).y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) { + float pab = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + float pbc = 0.0f; + float2 param_2 = 0.0f; + float2 param_3 = 0.0f; + float pca = 0.0f; + float2 param_4 = 0.0f; + float2 param_5 = 0.0f; + bool x_145 = false; + bool x_185 = false; + bool x_146_phi = false; + bool x_186_phi = false; + float const x_88 = (*(p)).x; + float const x_90 = (*(a_1)).x; + float const x_93 = (*(p)).y; + float const x_95 = (*(a_1)).y; + float const x_99 = (*(b_1)).x; + float const x_101 = (*(a_1)).x; + float const x_104 = (*(b_1)).y; + float const x_106 = (*(a_1)).y; + param = float2((x_88 - x_90), (x_93 - x_95)); + param_1 = float2((x_99 - x_101), (x_104 - x_106)); + float const x_109 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_109; + float const x_111 = (*(p)).x; + float const x_113 = (*(b_1)).x; + float const x_116 = (*(p)).y; + float const x_118 = (*(b_1)).y; + float const x_122 = (*(c)).x; + float const x_124 = (*(b_1)).x; + float const x_127 = (*(c)).y; + float const x_129 = (*(b_1)).y; + param_2 = float2((x_111 - x_113), (x_116 - x_118)); + param_3 = float2((x_122 - x_124), (x_127 - x_129)); + float const x_132 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_132; + float const x_133 = pab; + float const x_135 = pbc; + bool const x_137 = ((x_133 < 0.0f) && (x_135 < 0.0f)); + x_146_phi = x_137; + if (!(x_137)) { + float const x_141 = pab; + float const x_143 = pbc; + x_145 = ((x_141 >= 0.0f) && (x_143 >= 0.0f)); + x_146_phi = x_145; + } + bool const x_146 = x_146_phi; + if (!(x_146)) { + return 0; + } + float const x_151 = (*(p)).x; + float const x_153 = (*(c)).x; + float const x_156 = (*(p)).y; + float const x_158 = (*(c)).y; + float const x_162 = (*(a_1)).x; + float const x_164 = (*(c)).x; + float const x_167 = (*(a_1)).y; + float const x_169 = (*(c)).y; + param_4 = float2((x_151 - x_153), (x_156 - x_158)); + param_5 = float2((x_162 - x_164), (x_167 - x_169)); + float const x_172 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_172; + float const x_173 = pab; + float const x_175 = pca; + bool const x_177 = ((x_173 < 0.0f) && (x_175 < 0.0f)); + x_186_phi = x_177; + if (!(x_177)) { + float const x_181 = pab; + float const x_183 = pca; + x_185 = ((x_181 >= 0.0f) && (x_183 >= 0.0f)); + x_186_phi = x_185; + } + bool const x_186 = x_186_phi; + if (!(x_186)) { + return 0; + } + return 1; +} + +void main_1(constant buf0& x_24, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 pos = 0.0f; + float2 param_6 = 0.0f; + float2 param_7 = 0.0f; + float2 param_8 = 0.0f; + float2 param_9 = 0.0f; + float4 const x_63 = *(tint_symbol_5); + float2 const x_66 = x_24.resolution; + pos = (float2(x_63.x, x_63.y) / x_66); + float2 const x_68 = pos; + param_6 = x_68; + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + int const x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_69 == 1)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_24 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_24, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..0d3239b1b8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.spvasm @@ -0,0 +1,343 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 264 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_24 "x_24" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %cross2d_vf2_vf2_ "cross2d_vf2_vf2_" + OpName %a "a" + OpName %b "b" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_" + OpName %p "p" + OpName %a_1 "a_1" + OpName %b_1 "b_1" + OpName %c "c" + OpName %pab "pab" + OpName %param "param" + OpName %param_1 "param_1" + OpName %pbc "pbc" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %pca "pca" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %x_145 "x_145" + OpName %x_185 "x_185" + OpName %x_146_phi "x_146_phi" + OpName %x_186_phi "x_186_phi" + OpName %main_1 "main_1" + OpName %pos "pos" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_24 NonWritable + OpDecorate %x_24 DescriptorSet 0 + OpDecorate %x_24 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_24 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %40 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %49 = OpConstantNull %float + %51 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %62 = OpConstantNull %bool + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %212 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %232 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %235 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %238 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 + %float_1 = OpConstant %float 1 + %249 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %250 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %251 = OpTypeFunction %void %main_out +%cross2d_vf2_vf2_ = OpFunction %float None %15 + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %20 = OpLabel + %25 = OpAccessChain %_ptr_Function_float %a %uint_0 + %26 = OpLoad %float %25 + %29 = OpAccessChain %_ptr_Function_float %b %uint_1 + %30 = OpLoad %float %29 + %32 = OpAccessChain %_ptr_Function_float %b %uint_0 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Function_float %a %uint_1 + %36 = OpLoad %float %35 + %37 = OpFMul %float %26 %30 + %38 = OpFMul %float %33 %36 + %39 = OpFSub %float %37 %38 + OpReturnValue %39 + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %40 + %p = OpFunctionParameter %_ptr_Function_v2float + %a_1 = OpFunctionParameter %_ptr_Function_v2float + %b_1 = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %47 = OpLabel + %pab = OpVariable %_ptr_Function_float Function %49 + %param = OpVariable %_ptr_Function_v2float Function %51 + %param_1 = OpVariable %_ptr_Function_v2float Function %51 + %pbc = OpVariable %_ptr_Function_float Function %49 + %param_2 = OpVariable %_ptr_Function_v2float Function %51 + %param_3 = OpVariable %_ptr_Function_v2float Function %51 + %pca = OpVariable %_ptr_Function_float Function %49 + %param_4 = OpVariable %_ptr_Function_v2float Function %51 + %param_5 = OpVariable %_ptr_Function_v2float Function %51 + %x_145 = OpVariable %_ptr_Function_bool Function %62 + %x_185 = OpVariable %_ptr_Function_bool Function %62 + %x_146_phi = OpVariable %_ptr_Function_bool Function %62 + %x_186_phi = OpVariable %_ptr_Function_bool Function %62 + %67 = OpAccessChain %_ptr_Function_float %p %uint_0 + %68 = OpLoad %float %67 + %70 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %71 = OpLoad %float %70 + %73 = OpAccessChain %_ptr_Function_float %p %uint_1 + %74 = OpLoad %float %73 + %76 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %77 = OpLoad %float %76 + %79 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %80 = OpLoad %float %79 + %82 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %83 = OpLoad %float %82 + %85 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %86 = OpLoad %float %85 + %88 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %89 = OpLoad %float %88 + %90 = OpFSub %float %68 %71 + %91 = OpFSub %float %74 %77 + %92 = OpCompositeConstruct %v2float %90 %91 + OpStore %param %92 + %93 = OpFSub %float %80 %83 + %94 = OpFSub %float %86 %89 + %95 = OpCompositeConstruct %v2float %93 %94 + OpStore %param_1 %95 + %96 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_1 + OpStore %pab %96 + %100 = OpAccessChain %_ptr_Function_float %p %uint_0 + %101 = OpLoad %float %100 + %103 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %104 = OpLoad %float %103 + %106 = OpAccessChain %_ptr_Function_float %p %uint_1 + %107 = OpLoad %float %106 + %109 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %110 = OpLoad %float %109 + %112 = OpAccessChain %_ptr_Function_float %c %uint_0 + %113 = OpLoad %float %112 + %115 = OpAccessChain %_ptr_Function_float %b_1 %uint_0 + %116 = OpLoad %float %115 + %118 = OpAccessChain %_ptr_Function_float %c %uint_1 + %119 = OpLoad %float %118 + %121 = OpAccessChain %_ptr_Function_float %b_1 %uint_1 + %122 = OpLoad %float %121 + %123 = OpFSub %float %101 %104 + %124 = OpFSub %float %107 %110 + %125 = OpCompositeConstruct %v2float %123 %124 + OpStore %param_2 %125 + %126 = OpFSub %float %113 %116 + %127 = OpFSub %float %119 %122 + %128 = OpCompositeConstruct %v2float %126 %127 + OpStore %param_3 %128 + %129 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_2 %param_3 + OpStore %pbc %129 + %132 = OpLoad %float %pab + %133 = OpLoad %float %pbc + %135 = OpFOrdLessThan %bool %132 %float_0 + OpSelectionMerge %136 None + OpBranchConditional %135 %137 %136 + %137 = OpLabel + %138 = OpFOrdLessThan %bool %133 %float_0 + OpBranch %136 + %136 = OpLabel + %139 = OpPhi %bool %135 %47 %138 %137 + OpStore %x_146_phi %139 + %140 = OpLogicalNot %bool %139 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + %143 = OpLoad %float %pab + %144 = OpLoad %float %pbc + %145 = OpFOrdGreaterThanEqual %bool %143 %float_0 + OpSelectionMerge %146 None + OpBranchConditional %145 %147 %146 + %147 = OpLabel + %148 = OpFOrdGreaterThanEqual %bool %144 %float_0 + OpBranch %146 + %146 = OpLabel + %149 = OpPhi %bool %145 %142 %148 %147 + OpStore %x_145 %149 + %150 = OpLoad %bool %x_145 + OpStore %x_146_phi %150 + OpBranch %141 + %141 = OpLabel + %151 = OpLoad %bool %x_146_phi + %152 = OpLogicalNot %bool %151 + OpSelectionMerge %153 None + OpBranchConditional %152 %154 %153 + %154 = OpLabel + OpReturnValue %int_0 + %153 = OpLabel + %157 = OpAccessChain %_ptr_Function_float %p %uint_0 + %158 = OpLoad %float %157 + %160 = OpAccessChain %_ptr_Function_float %c %uint_0 + %161 = OpLoad %float %160 + %163 = OpAccessChain %_ptr_Function_float %p %uint_1 + %164 = OpLoad %float %163 + %166 = OpAccessChain %_ptr_Function_float %c %uint_1 + %167 = OpLoad %float %166 + %169 = OpAccessChain %_ptr_Function_float %a_1 %uint_0 + %170 = OpLoad %float %169 + %172 = OpAccessChain %_ptr_Function_float %c %uint_0 + %173 = OpLoad %float %172 + %175 = OpAccessChain %_ptr_Function_float %a_1 %uint_1 + %176 = OpLoad %float %175 + %178 = OpAccessChain %_ptr_Function_float %c %uint_1 + %179 = OpLoad %float %178 + %180 = OpFSub %float %158 %161 + %181 = OpFSub %float %164 %167 + %182 = OpCompositeConstruct %v2float %180 %181 + OpStore %param_4 %182 + %183 = OpFSub %float %170 %173 + %184 = OpFSub %float %176 %179 + %185 = OpCompositeConstruct %v2float %183 %184 + OpStore %param_5 %185 + %186 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5 + OpStore %pca %186 + %189 = OpLoad %float %pab + %190 = OpLoad %float %pca + %191 = OpFOrdLessThan %bool %189 %float_0 + OpSelectionMerge %192 None + OpBranchConditional %191 %193 %192 + %193 = OpLabel + %194 = OpFOrdLessThan %bool %190 %float_0 + OpBranch %192 + %192 = OpLabel + %195 = OpPhi %bool %191 %153 %194 %193 + OpStore %x_186_phi %195 + %196 = OpLogicalNot %bool %195 + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %197 + %198 = OpLabel + %199 = OpLoad %float %pab + %200 = OpLoad %float %pca + %201 = OpFOrdGreaterThanEqual %bool %199 %float_0 + OpSelectionMerge %202 None + OpBranchConditional %201 %203 %202 + %203 = OpLabel + %204 = OpFOrdGreaterThanEqual %bool %200 %float_0 + OpBranch %202 + %202 = OpLabel + %205 = OpPhi %bool %201 %198 %204 %203 + OpStore %x_185 %205 + %206 = OpLoad %bool %x_185 + OpStore %x_186_phi %206 + OpBranch %197 + %197 = OpLabel + %207 = OpLoad %bool %x_186_phi + %208 = OpLogicalNot %bool %207 + OpSelectionMerge %209 None + OpBranchConditional %208 %210 %209 + %210 = OpLabel + OpReturnValue %int_0 + %209 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %212 + %215 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function %51 + %param_6 = OpVariable %_ptr_Function_v2float Function %51 + %param_7 = OpVariable %_ptr_Function_v2float Function %51 + %param_8 = OpVariable %_ptr_Function_v2float Function %51 + %param_9 = OpVariable %_ptr_Function_v2float Function %51 + %221 = OpLoad %v4float %gl_FragCoord + %223 = OpAccessChain %_ptr_Uniform_v2float %x_24 %uint_0 + %224 = OpLoad %v2float %223 + %225 = OpCompositeExtract %float %221 0 + %226 = OpCompositeExtract %float %221 1 + %227 = OpCompositeConstruct %v2float %225 %226 + %228 = OpFDiv %v2float %227 %224 + OpStore %pos %228 + %229 = OpLoad %v2float %pos + OpStore %param_6 %229 + OpStore %param_7 %232 + OpStore %param_8 %235 + OpStore %param_9 %238 + %239 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9 + %244 = OpIEqual %bool %239 %int_1 + OpSelectionMerge %245 None + OpBranchConditional %244 %246 %247 + %246 = OpLabel + OpStore %x_GLF_color %249 + OpBranch %245 + %247 = OpLabel + OpStore %x_GLF_color %250 + OpBranch %245 + %245 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %251 +%tint_symbol_1 = OpFunctionParameter %main_out + %255 = OpLabel + %256 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %256 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %212 + %258 = OpLabel + %259 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %259 + %260 = OpFunctionCall %void %main_1 + %262 = OpLoad %v4float %x_GLF_color + %263 = OpCompositeConstruct %main_out %262 + %261 = OpFunctionCall %void %tint_symbol_3 %263 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..33d8a7df5a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-conditional-clamped-float/0.wgsl.expected.wgsl @@ -0,0 +1,134 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_24 : buf0; + +var x_GLF_color : vec4; + +fn cross2d_vf2_vf2_(a : ptr>, b : ptr>) -> f32 { + let x_76 : f32 = (*(a)).x; + let x_78 : f32 = (*(b)).y; + let x_81 : f32 = (*(b)).x; + let x_83 : f32 = (*(a)).y; + return ((x_76 * x_78) - (x_81 * x_83)); +} + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a_1 : ptr>, b_1 : ptr>, c : ptr>) -> i32 { + var pab : f32; + var param : vec2; + var param_1 : vec2; + var pbc : f32; + var param_2 : vec2; + var param_3 : vec2; + var pca : f32; + var param_4 : vec2; + var param_5 : vec2; + var x_145 : bool; + var x_185 : bool; + var x_146_phi : bool; + var x_186_phi : bool; + let x_88 : f32 = (*(p)).x; + let x_90 : f32 = (*(a_1)).x; + let x_93 : f32 = (*(p)).y; + let x_95 : f32 = (*(a_1)).y; + let x_99 : f32 = (*(b_1)).x; + let x_101 : f32 = (*(a_1)).x; + let x_104 : f32 = (*(b_1)).y; + let x_106 : f32 = (*(a_1)).y; + param = vec2((x_88 - x_90), (x_93 - x_95)); + param_1 = vec2((x_99 - x_101), (x_104 - x_106)); + let x_109 : f32 = cross2d_vf2_vf2_(&(param), &(param_1)); + pab = x_109; + let x_111 : f32 = (*(p)).x; + let x_113 : f32 = (*(b_1)).x; + let x_116 : f32 = (*(p)).y; + let x_118 : f32 = (*(b_1)).y; + let x_122 : f32 = (*(c)).x; + let x_124 : f32 = (*(b_1)).x; + let x_127 : f32 = (*(c)).y; + let x_129 : f32 = (*(b_1)).y; + param_2 = vec2((x_111 - x_113), (x_116 - x_118)); + param_3 = vec2((x_122 - x_124), (x_127 - x_129)); + let x_132 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3)); + pbc = x_132; + let x_133 : f32 = pab; + let x_135 : f32 = pbc; + let x_137 : bool = ((x_133 < 0.0) && (x_135 < 0.0)); + x_146_phi = x_137; + if (!(x_137)) { + let x_141 : f32 = pab; + let x_143 : f32 = pbc; + x_145 = ((x_141 >= 0.0) && (x_143 >= 0.0)); + x_146_phi = x_145; + } + let x_146 : bool = x_146_phi; + if (!(x_146)) { + return 0; + } + let x_151 : f32 = (*(p)).x; + let x_153 : f32 = (*(c)).x; + let x_156 : f32 = (*(p)).y; + let x_158 : f32 = (*(c)).y; + let x_162 : f32 = (*(a_1)).x; + let x_164 : f32 = (*(c)).x; + let x_167 : f32 = (*(a_1)).y; + let x_169 : f32 = (*(c)).y; + param_4 = vec2((x_151 - x_153), (x_156 - x_158)); + param_5 = vec2((x_162 - x_164), (x_167 - x_169)); + let x_172 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5)); + pca = x_172; + let x_173 : f32 = pab; + let x_175 : f32 = pca; + let x_177 : bool = ((x_173 < 0.0) && (x_175 < 0.0)); + x_186_phi = x_177; + if (!(x_177)) { + let x_181 : f32 = pab; + let x_183 : f32 = pca; + x_185 = ((x_181 >= 0.0) && (x_183 >= 0.0)); + x_186_phi = x_185; + } + let x_186 : bool = x_186_phi; + if (!(x_186)) { + return 0; + } + return 1; +} + +fn main_1() { + var pos : vec2; + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_63 : vec4 = gl_FragCoord; + let x_66 : vec2 = x_24.resolution; + pos = (vec2(x_63.x, x_63.y) / x_66); + let x_68 : vec2 = pos; + param_6 = x_68; + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_69 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_69 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm new file mode 100644 index 0000000000..6806bf061f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm @@ -0,0 +1,243 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %p "p" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %param_5 "param" + OpName %param_6 "param" + OpName %param_7 "param" + OpName %param_8 "param" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %28 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %43 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %46 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %49 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %52 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %53 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main = OpFunction %void None %23 + %54 = OpLabel + %param_5 = OpVariable %_ptr_Function_v2float Function + %param_6 = OpVariable %_ptr_Function_v2float Function + %param_7 = OpVariable %_ptr_Function_v2float Function + %param_8 = OpVariable %_ptr_Function_v2float Function + %55 = OpLoad %v4float %gl_FragCoord + %56 = OpVectorShuffle %v2float %55 %55 0 1 + %57 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %58 = OpLoad %v2float %57 + %59 = OpFDiv %v2float %56 %58 + OpStore %param_5 %59 + OpStore %param_6 %43 + OpStore %param_7 %46 + OpStore %param_8 %49 + %60 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_5 %param_6 %param_7 %param_8 + %61 = OpIEqual %bool %60 %int_1 + OpSelectionMerge %62 None + OpBranchConditional %61 %63 %64 + %63 = OpLabel + OpStore %_GLF_color %52 + OpBranch %62 + %64 = OpLabel + OpStore %_GLF_color %53 + OpBranch %62 + %62 = OpLabel + OpReturn + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %28 + %p = OpFunctionParameter %_ptr_Function_v2float + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %65 = OpLabel + %66 = OpVariable %_ptr_Function_float Function + %67 = OpVariable %_ptr_Function_float Function + %68 = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_v2float Function + %param_0 = OpVariable %_ptr_Function_v2float Function + %param_1 = OpVariable %_ptr_Function_v2float Function + %param_2 = OpVariable %_ptr_Function_v2float Function + %param_3 = OpVariable %_ptr_Function_v2float Function + %param_4 = OpVariable %_ptr_Function_v2float Function + %69 = OpAccessChain %_ptr_Function_float %p %uint_0 + %70 = OpLoad %float %69 + %71 = OpAccessChain %_ptr_Function_float %a %uint_0 + %72 = OpLoad %float %71 + %73 = OpFSub %float %70 %72 + %74 = OpAccessChain %_ptr_Function_float %p %uint_1 + %75 = OpLoad %float %74 + %76 = OpAccessChain %_ptr_Function_float %a %uint_1 + %77 = OpLoad %float %76 + %78 = OpFSub %float %75 %77 + %79 = OpCompositeConstruct %v2float %73 %78 + %80 = OpAccessChain %_ptr_Function_float %b %uint_0 + %81 = OpLoad %float %80 + %82 = OpLoad %float %71 + %83 = OpFSub %float %81 %82 + %84 = OpAccessChain %_ptr_Function_float %b %uint_1 + %85 = OpLoad %float %84 + %86 = OpLoad %float %76 + %87 = OpFSub %float %85 %86 + %88 = OpCompositeConstruct %v2float %83 %87 + OpStore %param %79 + OpStore %param_0 %88 + %89 = OpAccessChain %_ptr_Function_float %param %uint_0 + %90 = OpLoad %float %89 + %91 = OpAccessChain %_ptr_Function_float %param_0 %uint_1 + %92 = OpLoad %float %91 + %93 = OpFMul %float %90 %92 + %94 = OpAccessChain %_ptr_Function_float %param_0 %uint_0 + %95 = OpLoad %float %94 + %96 = OpAccessChain %_ptr_Function_float %param %uint_1 + %97 = OpLoad %float %96 + %98 = OpFMul %float %95 %97 + %99 = OpFSub %float %93 %98 + OpStore %68 %99 + %100 = OpLoad %float %69 + %101 = OpLoad %float %80 + %102 = OpFSub %float %100 %101 + %103 = OpLoad %float %74 + %104 = OpLoad %float %84 + %105 = OpFSub %float %103 %104 + %106 = OpCompositeConstruct %v2float %102 %105 + %107 = OpAccessChain %_ptr_Function_float %c %uint_0 + %108 = OpLoad %float %107 + %109 = OpLoad %float %80 + %110 = OpFSub %float %108 %109 + %111 = OpAccessChain %_ptr_Function_float %c %uint_1 + %112 = OpLoad %float %111 + %113 = OpLoad %float %84 + %114 = OpFSub %float %112 %113 + %115 = OpCompositeConstruct %v2float %110 %114 + OpStore %param_1 %106 + OpStore %param_2 %115 + %116 = OpAccessChain %_ptr_Function_float %param_1 %uint_0 + %117 = OpLoad %float %116 + %118 = OpAccessChain %_ptr_Function_float %param_2 %uint_1 + %119 = OpLoad %float %118 + %120 = OpFMul %float %117 %119 + %121 = OpAccessChain %_ptr_Function_float %param_2 %uint_0 + %122 = OpLoad %float %121 + %123 = OpAccessChain %_ptr_Function_float %param_1 %uint_1 + %124 = OpLoad %float %123 + %125 = OpFMul %float %122 %124 + %126 = OpFSub %float %120 %125 + OpStore %67 %126 + %127 = OpFOrdLessThan %bool %99 %float_0 + %128 = OpFOrdLessThan %bool %126 %float_0 + %129 = OpLogicalAnd %bool %127 %128 + %130 = OpLogicalNot %bool %129 + OpSelectionMerge %131 None + OpBranchConditional %130 %132 %131 + %132 = OpLabel + %133 = OpFOrdGreaterThanEqual %bool %99 %float_0 + %134 = OpFOrdGreaterThanEqual %bool %126 %float_0 + %135 = OpLogicalAnd %bool %133 %134 + OpBranch %131 + %131 = OpLabel + %136 = OpPhi %bool %129 %65 %135 %132 + %137 = OpLogicalNot %bool %136 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %138 + %139 = OpLabel + OpReturnValue %int_0 + %138 = OpLabel + %140 = OpLoad %float %69 + %141 = OpLoad %float %107 + %142 = OpFSub %float %140 %141 + %143 = OpLoad %float %74 + %144 = OpLoad %float %111 + %145 = OpFSub %float %143 %144 + %146 = OpCompositeConstruct %v2float %142 %145 + %147 = OpLoad %float %71 + %148 = OpLoad %float %107 + %149 = OpFSub %float %147 %148 + %150 = OpLoad %float %76 + %151 = OpLoad %float %111 + %152 = OpFSub %float %150 %151 + %153 = OpCompositeConstruct %v2float %149 %152 + OpStore %param_3 %146 + OpStore %param_4 %153 + %154 = OpAccessChain %_ptr_Function_float %param_3 %uint_0 + %155 = OpLoad %float %154 + %156 = OpAccessChain %_ptr_Function_float %param_4 %uint_1 + %157 = OpLoad %float %156 + %158 = OpFMul %float %155 %157 + %159 = OpAccessChain %_ptr_Function_float %param_4 %uint_0 + %160 = OpLoad %float %159 + %161 = OpAccessChain %_ptr_Function_float %param_3 %uint_1 + %162 = OpLoad %float %161 + %163 = OpFMul %float %160 %162 + %164 = OpFSub %float %158 %163 + OpStore %66 %164 + %165 = OpFOrdLessThan %bool %164 %float_0 + %166 = OpLogicalAnd %bool %127 %165 + %167 = OpLogicalNot %bool %166 + OpSelectionMerge %168 None + OpBranchConditional %167 %169 %168 + %169 = OpLabel + %170 = OpFOrdGreaterThanEqual %bool %99 %float_0 + %171 = OpFOrdGreaterThanEqual %bool %164 %float_0 + %172 = OpLogicalAnd %bool %170 %171 + OpBranch %168 + %168 = OpLabel + %173 = OpPhi %bool %166 %138 %172 %169 + %174 = OpLogicalNot %bool %173 + OpSelectionMerge %175 None + OpBranchConditional %174 %176 %175 + %176 = OpLabel + OpReturnValue %int_0 + %175 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..c32dae7f7f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.hlsl @@ -0,0 +1,144 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_17 : register(b0, space0) { + uint4 x_17[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a, inout float2 b, inout float2 c) { + float x_66 = 0.0f; + float x_67 = 0.0f; + float x_68 = 0.0f; + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + float2 param_2 = float2(0.0f, 0.0f); + float2 param_3 = float2(0.0f, 0.0f); + float2 param_4 = float2(0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + bool x_135 = false; + bool x_172 = false; + bool x_136_phi = false; + bool x_173_phi = false; + const float x_70 = p.x; + const float x_72 = a.x; + const float x_75 = p.y; + const float x_77 = a.y; + const float x_81 = b.x; + const float x_82 = a.x; + const float x_85 = b.y; + const float x_86 = a.y; + param = float2((x_70 - x_72), (x_75 - x_77)); + param_1 = float2((x_81 - x_82), (x_85 - x_86)); + const float x_90 = param.x; + const float x_92 = param_1.y; + const float x_95 = param_1.x; + const float x_97 = param.y; + const float x_99 = ((x_90 * x_92) - (x_95 * x_97)); + x_68 = x_99; + const float x_100 = p.x; + const float x_101 = b.x; + const float x_103 = p.y; + const float x_104 = b.y; + const float x_108 = c.x; + const float x_109 = b.x; + const float x_112 = c.y; + const float x_113 = b.y; + param_2 = float2((x_100 - x_101), (x_103 - x_104)); + param_3 = float2((x_108 - x_109), (x_112 - x_113)); + const float x_117 = param_2.x; + const float x_119 = param_3.y; + const float x_122 = param_3.x; + const float x_124 = param_2.y; + const float x_126 = ((x_117 * x_119) - (x_122 * x_124)); + x_67 = x_126; + const bool x_127 = (x_99 < 0.0f); + bool tint_tmp = x_127; + if (tint_tmp) { + tint_tmp = (x_126 < 0.0f); + } + const bool x_129 = (tint_tmp); + x_136_phi = x_129; + if (!(x_129)) { + bool tint_tmp_1 = (x_99 >= 0.0f); + if (tint_tmp_1) { + tint_tmp_1 = (x_126 >= 0.0f); + } + x_135 = (tint_tmp_1); + x_136_phi = x_135; + } + if (!(x_136_phi)) { + return 0; + } + const float x_140 = p.x; + const float x_141 = c.x; + const float x_143 = p.y; + const float x_144 = c.y; + const float x_147 = a.x; + const float x_148 = c.x; + const float x_150 = a.y; + const float x_151 = c.y; + param_4 = float2((x_140 - x_141), (x_143 - x_144)); + param_5 = float2((x_147 - x_148), (x_150 - x_151)); + const float x_155 = param_4.x; + const float x_157 = param_5.y; + const float x_160 = param_5.x; + const float x_162 = param_4.y; + const float x_164 = ((x_155 * x_157) - (x_160 * x_162)); + x_66 = x_164; + bool tint_tmp_2 = x_127; + if (tint_tmp_2) { + tint_tmp_2 = (x_164 < 0.0f); + } + const bool x_166 = (tint_tmp_2); + x_173_phi = x_166; + if (!(x_166)) { + bool tint_tmp_3 = (x_99 >= 0.0f); + if (tint_tmp_3) { + tint_tmp_3 = (x_164 >= 0.0f); + } + x_172 = (tint_tmp_3); + x_173_phi = x_172; + } + if (!(x_173_phi)) { + return 0; + } + return 1; +} + +void main_1() { + float2 param_6 = float2(0.0f, 0.0f); + float2 param_7 = float2(0.0f, 0.0f); + float2 param_8 = float2(0.0f, 0.0f); + float2 param_9 = float2(0.0f, 0.0f); + const float4 x_55 = gl_FragCoord; + const float2 x_58 = asfloat(x_17[0].xy); + param_6 = (float2(x_55.x, x_55.y) / x_58); + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + const int x_60 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9); + if ((x_60 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.msl new file mode 100644 index 0000000000..fc78937c7a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.msl @@ -0,0 +1,129 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a, thread float2* const b, thread float2* const c) { + float x_66 = 0.0f; + float x_67 = 0.0f; + float x_68 = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + float2 param_2 = 0.0f; + float2 param_3 = 0.0f; + float2 param_4 = 0.0f; + float2 param_5 = 0.0f; + bool x_135 = false; + bool x_172 = false; + bool x_136_phi = false; + bool x_173_phi = false; + float const x_70 = (*(p)).x; + float const x_72 = (*(a)).x; + float const x_75 = (*(p)).y; + float const x_77 = (*(a)).y; + float const x_81 = (*(b)).x; + float const x_82 = (*(a)).x; + float const x_85 = (*(b)).y; + float const x_86 = (*(a)).y; + param = float2((x_70 - x_72), (x_75 - x_77)); + param_1 = float2((x_81 - x_82), (x_85 - x_86)); + float const x_90 = param.x; + float const x_92 = param_1.y; + float const x_95 = param_1.x; + float const x_97 = param.y; + float const x_99 = ((x_90 * x_92) - (x_95 * x_97)); + x_68 = x_99; + float const x_100 = (*(p)).x; + float const x_101 = (*(b)).x; + float const x_103 = (*(p)).y; + float const x_104 = (*(b)).y; + float const x_108 = (*(c)).x; + float const x_109 = (*(b)).x; + float const x_112 = (*(c)).y; + float const x_113 = (*(b)).y; + param_2 = float2((x_100 - x_101), (x_103 - x_104)); + param_3 = float2((x_108 - x_109), (x_112 - x_113)); + float const x_117 = param_2.x; + float const x_119 = param_3.y; + float const x_122 = param_3.x; + float const x_124 = param_2.y; + float const x_126 = ((x_117 * x_119) - (x_122 * x_124)); + x_67 = x_126; + bool const x_127 = (x_99 < 0.0f); + bool const x_129 = (x_127 && (x_126 < 0.0f)); + x_136_phi = x_129; + if (!(x_129)) { + x_135 = ((x_99 >= 0.0f) && (x_126 >= 0.0f)); + x_136_phi = x_135; + } + bool const x_136 = x_136_phi; + if (!(x_136)) { + return 0; + } + float const x_140 = (*(p)).x; + float const x_141 = (*(c)).x; + float const x_143 = (*(p)).y; + float const x_144 = (*(c)).y; + float const x_147 = (*(a)).x; + float const x_148 = (*(c)).x; + float const x_150 = (*(a)).y; + float const x_151 = (*(c)).y; + param_4 = float2((x_140 - x_141), (x_143 - x_144)); + param_5 = float2((x_147 - x_148), (x_150 - x_151)); + float const x_155 = param_4.x; + float const x_157 = param_5.y; + float const x_160 = param_5.x; + float const x_162 = param_4.y; + float const x_164 = ((x_155 * x_157) - (x_160 * x_162)); + x_66 = x_164; + bool const x_166 = (x_127 && (x_164 < 0.0f)); + x_173_phi = x_166; + if (!(x_166)) { + x_172 = ((x_99 >= 0.0f) && (x_164 >= 0.0f)); + x_173_phi = x_172; + } + bool const x_173 = x_173_phi; + if (!(x_173)) { + return 0; + } + return 1; +} + +void main_1(constant buf0& x_17, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 param_6 = 0.0f; + float2 param_7 = 0.0f; + float2 param_8 = 0.0f; + float2 param_9 = 0.0f; + float4 const x_55 = *(tint_symbol_5); + float2 const x_58 = x_17.resolution; + param_6 = (float2(x_55.x, x_55.y) / x_58); + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + int const x_60 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_60 == 1)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_17 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_17, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..69ebf787a2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.spvasm @@ -0,0 +1,339 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 257 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_17 "x_17" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_" + OpName %p "p" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %x_66 "x_66" + OpName %x_67 "x_67" + OpName %x_68 "x_68" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %x_135 "x_135" + OpName %x_172 "x_172" + OpName %x_136_phi "x_136_phi" + OpName %x_173_phi "x_173_phi" + OpName %main_1 "main_1" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_17 NonWritable + OpDecorate %x_17 DescriptorSet 0 + OpDecorate %x_17 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_17 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %30 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %39 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %207 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %225 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %228 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %231 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 + %float_1 = OpConstant %float 1 + %242 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %243 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %244 = OpTypeFunction %void %main_out +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %15 + %p = OpFunctionParameter %_ptr_Function_v2float + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %23 = OpLabel + %x_66 = OpVariable %_ptr_Function_float Function %26 + %x_67 = OpVariable %_ptr_Function_float Function %26 + %x_68 = OpVariable %_ptr_Function_float Function %26 + %param = OpVariable %_ptr_Function_v2float Function %30 + %param_1 = OpVariable %_ptr_Function_v2float Function %30 + %param_2 = OpVariable %_ptr_Function_v2float Function %30 + %param_3 = OpVariable %_ptr_Function_v2float Function %30 + %param_4 = OpVariable %_ptr_Function_v2float Function %30 + %param_5 = OpVariable %_ptr_Function_v2float Function %30 + %x_135 = OpVariable %_ptr_Function_bool Function %39 + %x_172 = OpVariable %_ptr_Function_bool Function %39 + %x_136_phi = OpVariable %_ptr_Function_bool Function %39 + %x_173_phi = OpVariable %_ptr_Function_bool Function %39 + %46 = OpAccessChain %_ptr_Function_float %p %uint_0 + %47 = OpLoad %float %46 + %49 = OpAccessChain %_ptr_Function_float %a %uint_0 + %50 = OpLoad %float %49 + %53 = OpAccessChain %_ptr_Function_float %p %uint_1 + %54 = OpLoad %float %53 + %56 = OpAccessChain %_ptr_Function_float %a %uint_1 + %57 = OpLoad %float %56 + %59 = OpAccessChain %_ptr_Function_float %b %uint_0 + %60 = OpLoad %float %59 + %62 = OpAccessChain %_ptr_Function_float %a %uint_0 + %63 = OpLoad %float %62 + %65 = OpAccessChain %_ptr_Function_float %b %uint_1 + %66 = OpLoad %float %65 + %68 = OpAccessChain %_ptr_Function_float %a %uint_1 + %69 = OpLoad %float %68 + %70 = OpFSub %float %47 %50 + %71 = OpFSub %float %54 %57 + %72 = OpCompositeConstruct %v2float %70 %71 + OpStore %param %72 + %73 = OpFSub %float %60 %63 + %74 = OpFSub %float %66 %69 + %75 = OpCompositeConstruct %v2float %73 %74 + OpStore %param_1 %75 + %76 = OpAccessChain %_ptr_Function_float %param %uint_0 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Function_float %param_1 %uint_1 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Function_float %param_1 %uint_0 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Function_float %param %uint_1 + %83 = OpLoad %float %82 + %84 = OpFMul %float %77 %79 + %85 = OpFMul %float %81 %83 + %86 = OpFSub %float %84 %85 + OpStore %x_68 %86 + %88 = OpAccessChain %_ptr_Function_float %p %uint_0 + %89 = OpLoad %float %88 + %91 = OpAccessChain %_ptr_Function_float %b %uint_0 + %92 = OpLoad %float %91 + %94 = OpAccessChain %_ptr_Function_float %p %uint_1 + %95 = OpLoad %float %94 + %97 = OpAccessChain %_ptr_Function_float %b %uint_1 + %98 = OpLoad %float %97 + %100 = OpAccessChain %_ptr_Function_float %c %uint_0 + %101 = OpLoad %float %100 + %103 = OpAccessChain %_ptr_Function_float %b %uint_0 + %104 = OpLoad %float %103 + %106 = OpAccessChain %_ptr_Function_float %c %uint_1 + %107 = OpLoad %float %106 + %109 = OpAccessChain %_ptr_Function_float %b %uint_1 + %110 = OpLoad %float %109 + %111 = OpFSub %float %89 %92 + %112 = OpFSub %float %95 %98 + %113 = OpCompositeConstruct %v2float %111 %112 + OpStore %param_2 %113 + %114 = OpFSub %float %101 %104 + %115 = OpFSub %float %107 %110 + %116 = OpCompositeConstruct %v2float %114 %115 + OpStore %param_3 %116 + %117 = OpAccessChain %_ptr_Function_float %param_2 %uint_0 + %118 = OpLoad %float %117 + %119 = OpAccessChain %_ptr_Function_float %param_3 %uint_1 + %120 = OpLoad %float %119 + %121 = OpAccessChain %_ptr_Function_float %param_3 %uint_0 + %122 = OpLoad %float %121 + %123 = OpAccessChain %_ptr_Function_float %param_2 %uint_1 + %124 = OpLoad %float %123 + %125 = OpFMul %float %118 %120 + %126 = OpFMul %float %122 %124 + %127 = OpFSub %float %125 %126 + OpStore %x_67 %127 + %129 = OpFOrdLessThan %bool %86 %float_0 + OpSelectionMerge %130 None + OpBranchConditional %129 %131 %130 + %131 = OpLabel + %132 = OpFOrdLessThan %bool %127 %float_0 + OpBranch %130 + %130 = OpLabel + %133 = OpPhi %bool %129 %23 %132 %131 + OpStore %x_136_phi %133 + %134 = OpLogicalNot %bool %133 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %135 + %136 = OpLabel + %137 = OpFOrdGreaterThanEqual %bool %86 %float_0 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %138 + %139 = OpLabel + %140 = OpFOrdGreaterThanEqual %bool %127 %float_0 + OpBranch %138 + %138 = OpLabel + %141 = OpPhi %bool %137 %136 %140 %139 + OpStore %x_135 %141 + %142 = OpLoad %bool %x_135 + OpStore %x_136_phi %142 + OpBranch %135 + %135 = OpLabel + %143 = OpLoad %bool %x_136_phi + %144 = OpLogicalNot %bool %143 + OpSelectionMerge %145 None + OpBranchConditional %144 %146 %145 + %146 = OpLabel + OpReturnValue %int_0 + %145 = OpLabel + %149 = OpAccessChain %_ptr_Function_float %p %uint_0 + %150 = OpLoad %float %149 + %152 = OpAccessChain %_ptr_Function_float %c %uint_0 + %153 = OpLoad %float %152 + %155 = OpAccessChain %_ptr_Function_float %p %uint_1 + %156 = OpLoad %float %155 + %158 = OpAccessChain %_ptr_Function_float %c %uint_1 + %159 = OpLoad %float %158 + %161 = OpAccessChain %_ptr_Function_float %a %uint_0 + %162 = OpLoad %float %161 + %164 = OpAccessChain %_ptr_Function_float %c %uint_0 + %165 = OpLoad %float %164 + %167 = OpAccessChain %_ptr_Function_float %a %uint_1 + %168 = OpLoad %float %167 + %170 = OpAccessChain %_ptr_Function_float %c %uint_1 + %171 = OpLoad %float %170 + %172 = OpFSub %float %150 %153 + %173 = OpFSub %float %156 %159 + %174 = OpCompositeConstruct %v2float %172 %173 + OpStore %param_4 %174 + %175 = OpFSub %float %162 %165 + %176 = OpFSub %float %168 %171 + %177 = OpCompositeConstruct %v2float %175 %176 + OpStore %param_5 %177 + %178 = OpAccessChain %_ptr_Function_float %param_4 %uint_0 + %179 = OpLoad %float %178 + %180 = OpAccessChain %_ptr_Function_float %param_5 %uint_1 + %181 = OpLoad %float %180 + %182 = OpAccessChain %_ptr_Function_float %param_5 %uint_0 + %183 = OpLoad %float %182 + %184 = OpAccessChain %_ptr_Function_float %param_4 %uint_1 + %185 = OpLoad %float %184 + %186 = OpFMul %float %179 %181 + %187 = OpFMul %float %183 %185 + %188 = OpFSub %float %186 %187 + OpStore %x_66 %188 + OpSelectionMerge %189 None + OpBranchConditional %129 %190 %189 + %190 = OpLabel + %191 = OpFOrdLessThan %bool %188 %float_0 + OpBranch %189 + %189 = OpLabel + %192 = OpPhi %bool %129 %145 %191 %190 + OpStore %x_173_phi %192 + %193 = OpLogicalNot %bool %192 + OpSelectionMerge %194 None + OpBranchConditional %193 %195 %194 + %195 = OpLabel + %196 = OpFOrdGreaterThanEqual %bool %86 %float_0 + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %197 + %198 = OpLabel + %199 = OpFOrdGreaterThanEqual %bool %188 %float_0 + OpBranch %197 + %197 = OpLabel + %200 = OpPhi %bool %196 %195 %199 %198 + OpStore %x_172 %200 + %201 = OpLoad %bool %x_172 + OpStore %x_173_phi %201 + OpBranch %194 + %194 = OpLabel + %202 = OpLoad %bool %x_173_phi + %203 = OpLogicalNot %bool %202 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %204 + %205 = OpLabel + OpReturnValue %int_0 + %204 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %207 + %210 = OpLabel + %param_6 = OpVariable %_ptr_Function_v2float Function %30 + %param_7 = OpVariable %_ptr_Function_v2float Function %30 + %param_8 = OpVariable %_ptr_Function_v2float Function %30 + %param_9 = OpVariable %_ptr_Function_v2float Function %30 + %215 = OpLoad %v4float %gl_FragCoord + %217 = OpAccessChain %_ptr_Uniform_v2float %x_17 %uint_0 + %218 = OpLoad %v2float %217 + %219 = OpCompositeExtract %float %215 0 + %220 = OpCompositeExtract %float %215 1 + %221 = OpCompositeConstruct %v2float %219 %220 + %222 = OpFDiv %v2float %221 %218 + OpStore %param_6 %222 + OpStore %param_7 %225 + OpStore %param_8 %228 + OpStore %param_9 %231 + %232 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9 + %237 = OpIEqual %bool %232 %int_1 + OpSelectionMerge %238 None + OpBranchConditional %237 %239 %240 + %239 = OpLabel + OpStore %x_GLF_color %242 + OpBranch %238 + %240 = OpLabel + OpStore %x_GLF_color %243 + OpBranch %238 + %238 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %244 +%tint_symbol_1 = OpFunctionParameter %main_out + %248 = OpLabel + %249 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %249 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %207 + %251 = OpLabel + %252 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %252 + %253 = OpFunctionCall %void %main_1 + %255 = OpLoad %v4float %x_GLF_color + %256 = OpCompositeConstruct %main_out %255 + %254 = OpFunctionCall %void %tint_symbol_3 %256 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..414b559a93 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.spvasm.expected.wgsl @@ -0,0 +1,136 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_17 : buf0; + +var x_GLF_color : vec4; + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a : ptr>, b : ptr>, c : ptr>) -> i32 { + var x_66 : f32; + var x_67 : f32; + var x_68 : f32; + var param : vec2; + var param_1 : vec2; + var param_2 : vec2; + var param_3 : vec2; + var param_4 : vec2; + var param_5 : vec2; + var x_135 : bool; + var x_172 : bool; + var x_136_phi : bool; + var x_173_phi : bool; + let x_69 : ptr = &((*(p)).x); + let x_70 : f32 = *(x_69); + let x_71 : ptr = &((*(a)).x); + let x_72 : f32 = *(x_71); + let x_74 : ptr = &((*(p)).y); + let x_75 : f32 = *(x_74); + let x_76 : ptr = &((*(a)).y); + let x_77 : f32 = *(x_76); + let x_80 : ptr = &((*(b)).x); + let x_81 : f32 = *(x_80); + let x_82 : f32 = *(x_71); + let x_84 : ptr = &((*(b)).y); + let x_85 : f32 = *(x_84); + let x_86 : f32 = *(x_76); + param = vec2((x_70 - x_72), (x_75 - x_77)); + param_1 = vec2((x_81 - x_82), (x_85 - x_86)); + let x_90 : f32 = param.x; + let x_92 : f32 = param_1.y; + let x_95 : f32 = param_1.x; + let x_97 : f32 = param.y; + let x_99 : f32 = ((x_90 * x_92) - (x_95 * x_97)); + x_68 = x_99; + let x_100 : f32 = *(x_69); + let x_101 : f32 = *(x_80); + let x_103 : f32 = *(x_74); + let x_104 : f32 = *(x_84); + let x_107 : ptr = &((*(c)).x); + let x_108 : f32 = *(x_107); + let x_109 : f32 = *(x_80); + let x_111 : ptr = &((*(c)).y); + let x_112 : f32 = *(x_111); + let x_113 : f32 = *(x_84); + param_2 = vec2((x_100 - x_101), (x_103 - x_104)); + param_3 = vec2((x_108 - x_109), (x_112 - x_113)); + let x_117 : f32 = param_2.x; + let x_119 : f32 = param_3.y; + let x_122 : f32 = param_3.x; + let x_124 : f32 = param_2.y; + let x_126 : f32 = ((x_117 * x_119) - (x_122 * x_124)); + x_67 = x_126; + let x_127 : bool = (x_99 < 0.0); + let x_129 : bool = (x_127 && (x_126 < 0.0)); + x_136_phi = x_129; + if (!(x_129)) { + x_135 = ((x_99 >= 0.0) && (x_126 >= 0.0)); + x_136_phi = x_135; + } + let x_136 : bool = x_136_phi; + if (!(x_136)) { + return 0; + } + let x_140 : f32 = *(x_69); + let x_141 : f32 = *(x_107); + let x_143 : f32 = *(x_74); + let x_144 : f32 = *(x_111); + let x_147 : f32 = *(x_71); + let x_148 : f32 = *(x_107); + let x_150 : f32 = *(x_76); + let x_151 : f32 = *(x_111); + param_4 = vec2((x_140 - x_141), (x_143 - x_144)); + param_5 = vec2((x_147 - x_148), (x_150 - x_151)); + let x_155 : f32 = param_4.x; + let x_157 : f32 = param_5.y; + let x_160 : f32 = param_5.x; + let x_162 : f32 = param_4.y; + let x_164 : f32 = ((x_155 * x_157) - (x_160 * x_162)); + x_66 = x_164; + let x_166 : bool = (x_127 && (x_164 < 0.0)); + x_173_phi = x_166; + if (!(x_166)) { + x_172 = ((x_99 >= 0.0) && (x_164 >= 0.0)); + x_173_phi = x_172; + } + let x_173 : bool = x_173_phi; + if (!(x_173)) { + return 0; + } + return 1; +} + +fn main_1() { + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_55 : vec4 = gl_FragCoord; + let x_58 : vec2 = x_17.resolution; + param_6 = (vec2(x_55.x, x_55.y) / x_58); + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_60 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_60 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl new file mode 100644 index 0000000000..414b559a93 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl @@ -0,0 +1,136 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_17 : buf0; + +var x_GLF_color : vec4; + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a : ptr>, b : ptr>, c : ptr>) -> i32 { + var x_66 : f32; + var x_67 : f32; + var x_68 : f32; + var param : vec2; + var param_1 : vec2; + var param_2 : vec2; + var param_3 : vec2; + var param_4 : vec2; + var param_5 : vec2; + var x_135 : bool; + var x_172 : bool; + var x_136_phi : bool; + var x_173_phi : bool; + let x_69 : ptr = &((*(p)).x); + let x_70 : f32 = *(x_69); + let x_71 : ptr = &((*(a)).x); + let x_72 : f32 = *(x_71); + let x_74 : ptr = &((*(p)).y); + let x_75 : f32 = *(x_74); + let x_76 : ptr = &((*(a)).y); + let x_77 : f32 = *(x_76); + let x_80 : ptr = &((*(b)).x); + let x_81 : f32 = *(x_80); + let x_82 : f32 = *(x_71); + let x_84 : ptr = &((*(b)).y); + let x_85 : f32 = *(x_84); + let x_86 : f32 = *(x_76); + param = vec2((x_70 - x_72), (x_75 - x_77)); + param_1 = vec2((x_81 - x_82), (x_85 - x_86)); + let x_90 : f32 = param.x; + let x_92 : f32 = param_1.y; + let x_95 : f32 = param_1.x; + let x_97 : f32 = param.y; + let x_99 : f32 = ((x_90 * x_92) - (x_95 * x_97)); + x_68 = x_99; + let x_100 : f32 = *(x_69); + let x_101 : f32 = *(x_80); + let x_103 : f32 = *(x_74); + let x_104 : f32 = *(x_84); + let x_107 : ptr = &((*(c)).x); + let x_108 : f32 = *(x_107); + let x_109 : f32 = *(x_80); + let x_111 : ptr = &((*(c)).y); + let x_112 : f32 = *(x_111); + let x_113 : f32 = *(x_84); + param_2 = vec2((x_100 - x_101), (x_103 - x_104)); + param_3 = vec2((x_108 - x_109), (x_112 - x_113)); + let x_117 : f32 = param_2.x; + let x_119 : f32 = param_3.y; + let x_122 : f32 = param_3.x; + let x_124 : f32 = param_2.y; + let x_126 : f32 = ((x_117 * x_119) - (x_122 * x_124)); + x_67 = x_126; + let x_127 : bool = (x_99 < 0.0); + let x_129 : bool = (x_127 && (x_126 < 0.0)); + x_136_phi = x_129; + if (!(x_129)) { + x_135 = ((x_99 >= 0.0) && (x_126 >= 0.0)); + x_136_phi = x_135; + } + let x_136 : bool = x_136_phi; + if (!(x_136)) { + return 0; + } + let x_140 : f32 = *(x_69); + let x_141 : f32 = *(x_107); + let x_143 : f32 = *(x_74); + let x_144 : f32 = *(x_111); + let x_147 : f32 = *(x_71); + let x_148 : f32 = *(x_107); + let x_150 : f32 = *(x_76); + let x_151 : f32 = *(x_111); + param_4 = vec2((x_140 - x_141), (x_143 - x_144)); + param_5 = vec2((x_147 - x_148), (x_150 - x_151)); + let x_155 : f32 = param_4.x; + let x_157 : f32 = param_5.y; + let x_160 : f32 = param_5.x; + let x_162 : f32 = param_4.y; + let x_164 : f32 = ((x_155 * x_157) - (x_160 * x_162)); + x_66 = x_164; + let x_166 : bool = (x_127 && (x_164 < 0.0)); + x_173_phi = x_166; + if (!(x_166)) { + x_172 = ((x_99 >= 0.0) && (x_164 >= 0.0)); + x_173_phi = x_172; + } + let x_173 : bool = x_173_phi; + if (!(x_173)) { + return 0; + } + return 1; +} + +fn main_1() { + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_55 : vec4 = gl_FragCoord; + let x_58 : vec2 = x_17.resolution; + param_6 = (vec2(x_55.x, x_55.y) / x_58); + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_60 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_60 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..c32dae7f7f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.hlsl @@ -0,0 +1,144 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_17 : register(b0, space0) { + uint4 x_17[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a, inout float2 b, inout float2 c) { + float x_66 = 0.0f; + float x_67 = 0.0f; + float x_68 = 0.0f; + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + float2 param_2 = float2(0.0f, 0.0f); + float2 param_3 = float2(0.0f, 0.0f); + float2 param_4 = float2(0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + bool x_135 = false; + bool x_172 = false; + bool x_136_phi = false; + bool x_173_phi = false; + const float x_70 = p.x; + const float x_72 = a.x; + const float x_75 = p.y; + const float x_77 = a.y; + const float x_81 = b.x; + const float x_82 = a.x; + const float x_85 = b.y; + const float x_86 = a.y; + param = float2((x_70 - x_72), (x_75 - x_77)); + param_1 = float2((x_81 - x_82), (x_85 - x_86)); + const float x_90 = param.x; + const float x_92 = param_1.y; + const float x_95 = param_1.x; + const float x_97 = param.y; + const float x_99 = ((x_90 * x_92) - (x_95 * x_97)); + x_68 = x_99; + const float x_100 = p.x; + const float x_101 = b.x; + const float x_103 = p.y; + const float x_104 = b.y; + const float x_108 = c.x; + const float x_109 = b.x; + const float x_112 = c.y; + const float x_113 = b.y; + param_2 = float2((x_100 - x_101), (x_103 - x_104)); + param_3 = float2((x_108 - x_109), (x_112 - x_113)); + const float x_117 = param_2.x; + const float x_119 = param_3.y; + const float x_122 = param_3.x; + const float x_124 = param_2.y; + const float x_126 = ((x_117 * x_119) - (x_122 * x_124)); + x_67 = x_126; + const bool x_127 = (x_99 < 0.0f); + bool tint_tmp = x_127; + if (tint_tmp) { + tint_tmp = (x_126 < 0.0f); + } + const bool x_129 = (tint_tmp); + x_136_phi = x_129; + if (!(x_129)) { + bool tint_tmp_1 = (x_99 >= 0.0f); + if (tint_tmp_1) { + tint_tmp_1 = (x_126 >= 0.0f); + } + x_135 = (tint_tmp_1); + x_136_phi = x_135; + } + if (!(x_136_phi)) { + return 0; + } + const float x_140 = p.x; + const float x_141 = c.x; + const float x_143 = p.y; + const float x_144 = c.y; + const float x_147 = a.x; + const float x_148 = c.x; + const float x_150 = a.y; + const float x_151 = c.y; + param_4 = float2((x_140 - x_141), (x_143 - x_144)); + param_5 = float2((x_147 - x_148), (x_150 - x_151)); + const float x_155 = param_4.x; + const float x_157 = param_5.y; + const float x_160 = param_5.x; + const float x_162 = param_4.y; + const float x_164 = ((x_155 * x_157) - (x_160 * x_162)); + x_66 = x_164; + bool tint_tmp_2 = x_127; + if (tint_tmp_2) { + tint_tmp_2 = (x_164 < 0.0f); + } + const bool x_166 = (tint_tmp_2); + x_173_phi = x_166; + if (!(x_166)) { + bool tint_tmp_3 = (x_99 >= 0.0f); + if (tint_tmp_3) { + tint_tmp_3 = (x_164 >= 0.0f); + } + x_172 = (tint_tmp_3); + x_173_phi = x_172; + } + if (!(x_173_phi)) { + return 0; + } + return 1; +} + +void main_1() { + float2 param_6 = float2(0.0f, 0.0f); + float2 param_7 = float2(0.0f, 0.0f); + float2 param_8 = float2(0.0f, 0.0f); + float2 param_9 = float2(0.0f, 0.0f); + const float4 x_55 = gl_FragCoord; + const float2 x_58 = asfloat(x_17[0].xy); + param_6 = (float2(x_55.x, x_55.y) / x_58); + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + const int x_60 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9); + if ((x_60 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.msl new file mode 100644 index 0000000000..fc78937c7a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.msl @@ -0,0 +1,129 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a, thread float2* const b, thread float2* const c) { + float x_66 = 0.0f; + float x_67 = 0.0f; + float x_68 = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + float2 param_2 = 0.0f; + float2 param_3 = 0.0f; + float2 param_4 = 0.0f; + float2 param_5 = 0.0f; + bool x_135 = false; + bool x_172 = false; + bool x_136_phi = false; + bool x_173_phi = false; + float const x_70 = (*(p)).x; + float const x_72 = (*(a)).x; + float const x_75 = (*(p)).y; + float const x_77 = (*(a)).y; + float const x_81 = (*(b)).x; + float const x_82 = (*(a)).x; + float const x_85 = (*(b)).y; + float const x_86 = (*(a)).y; + param = float2((x_70 - x_72), (x_75 - x_77)); + param_1 = float2((x_81 - x_82), (x_85 - x_86)); + float const x_90 = param.x; + float const x_92 = param_1.y; + float const x_95 = param_1.x; + float const x_97 = param.y; + float const x_99 = ((x_90 * x_92) - (x_95 * x_97)); + x_68 = x_99; + float const x_100 = (*(p)).x; + float const x_101 = (*(b)).x; + float const x_103 = (*(p)).y; + float const x_104 = (*(b)).y; + float const x_108 = (*(c)).x; + float const x_109 = (*(b)).x; + float const x_112 = (*(c)).y; + float const x_113 = (*(b)).y; + param_2 = float2((x_100 - x_101), (x_103 - x_104)); + param_3 = float2((x_108 - x_109), (x_112 - x_113)); + float const x_117 = param_2.x; + float const x_119 = param_3.y; + float const x_122 = param_3.x; + float const x_124 = param_2.y; + float const x_126 = ((x_117 * x_119) - (x_122 * x_124)); + x_67 = x_126; + bool const x_127 = (x_99 < 0.0f); + bool const x_129 = (x_127 && (x_126 < 0.0f)); + x_136_phi = x_129; + if (!(x_129)) { + x_135 = ((x_99 >= 0.0f) && (x_126 >= 0.0f)); + x_136_phi = x_135; + } + bool const x_136 = x_136_phi; + if (!(x_136)) { + return 0; + } + float const x_140 = (*(p)).x; + float const x_141 = (*(c)).x; + float const x_143 = (*(p)).y; + float const x_144 = (*(c)).y; + float const x_147 = (*(a)).x; + float const x_148 = (*(c)).x; + float const x_150 = (*(a)).y; + float const x_151 = (*(c)).y; + param_4 = float2((x_140 - x_141), (x_143 - x_144)); + param_5 = float2((x_147 - x_148), (x_150 - x_151)); + float const x_155 = param_4.x; + float const x_157 = param_5.y; + float const x_160 = param_5.x; + float const x_162 = param_4.y; + float const x_164 = ((x_155 * x_157) - (x_160 * x_162)); + x_66 = x_164; + bool const x_166 = (x_127 && (x_164 < 0.0f)); + x_173_phi = x_166; + if (!(x_166)) { + x_172 = ((x_99 >= 0.0f) && (x_164 >= 0.0f)); + x_173_phi = x_172; + } + bool const x_173 = x_173_phi; + if (!(x_173)) { + return 0; + } + return 1; +} + +void main_1(constant buf0& x_17, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float2 param_6 = 0.0f; + float2 param_7 = 0.0f; + float2 param_8 = 0.0f; + float2 param_9 = 0.0f; + float4 const x_55 = *(tint_symbol_5); + float2 const x_58 = x_17.resolution; + param_6 = (float2(x_55.x, x_55.y) / x_58); + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + int const x_60 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_60 == 1)) { + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_17 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_17, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..69ebf787a2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.spvasm @@ -0,0 +1,339 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 257 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_17 "x_17" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_" + OpName %p "p" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %x_66 "x_66" + OpName %x_67 "x_67" + OpName %x_68 "x_68" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %x_135 "x_135" + OpName %x_172 "x_172" + OpName %x_136_phi "x_136_phi" + OpName %x_173_phi "x_173_phi" + OpName %main_1 "main_1" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_17 NonWritable + OpDecorate %x_17 DescriptorSet 0 + OpDecorate %x_17 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_17 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float +%_ptr_Function_float = OpTypePointer Function %float + %26 = OpConstantNull %float + %30 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %39 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %207 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %225 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %228 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %231 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 + %float_1 = OpConstant %float 1 + %242 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %243 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %244 = OpTypeFunction %void %main_out +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %15 + %p = OpFunctionParameter %_ptr_Function_v2float + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %23 = OpLabel + %x_66 = OpVariable %_ptr_Function_float Function %26 + %x_67 = OpVariable %_ptr_Function_float Function %26 + %x_68 = OpVariable %_ptr_Function_float Function %26 + %param = OpVariable %_ptr_Function_v2float Function %30 + %param_1 = OpVariable %_ptr_Function_v2float Function %30 + %param_2 = OpVariable %_ptr_Function_v2float Function %30 + %param_3 = OpVariable %_ptr_Function_v2float Function %30 + %param_4 = OpVariable %_ptr_Function_v2float Function %30 + %param_5 = OpVariable %_ptr_Function_v2float Function %30 + %x_135 = OpVariable %_ptr_Function_bool Function %39 + %x_172 = OpVariable %_ptr_Function_bool Function %39 + %x_136_phi = OpVariable %_ptr_Function_bool Function %39 + %x_173_phi = OpVariable %_ptr_Function_bool Function %39 + %46 = OpAccessChain %_ptr_Function_float %p %uint_0 + %47 = OpLoad %float %46 + %49 = OpAccessChain %_ptr_Function_float %a %uint_0 + %50 = OpLoad %float %49 + %53 = OpAccessChain %_ptr_Function_float %p %uint_1 + %54 = OpLoad %float %53 + %56 = OpAccessChain %_ptr_Function_float %a %uint_1 + %57 = OpLoad %float %56 + %59 = OpAccessChain %_ptr_Function_float %b %uint_0 + %60 = OpLoad %float %59 + %62 = OpAccessChain %_ptr_Function_float %a %uint_0 + %63 = OpLoad %float %62 + %65 = OpAccessChain %_ptr_Function_float %b %uint_1 + %66 = OpLoad %float %65 + %68 = OpAccessChain %_ptr_Function_float %a %uint_1 + %69 = OpLoad %float %68 + %70 = OpFSub %float %47 %50 + %71 = OpFSub %float %54 %57 + %72 = OpCompositeConstruct %v2float %70 %71 + OpStore %param %72 + %73 = OpFSub %float %60 %63 + %74 = OpFSub %float %66 %69 + %75 = OpCompositeConstruct %v2float %73 %74 + OpStore %param_1 %75 + %76 = OpAccessChain %_ptr_Function_float %param %uint_0 + %77 = OpLoad %float %76 + %78 = OpAccessChain %_ptr_Function_float %param_1 %uint_1 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Function_float %param_1 %uint_0 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Function_float %param %uint_1 + %83 = OpLoad %float %82 + %84 = OpFMul %float %77 %79 + %85 = OpFMul %float %81 %83 + %86 = OpFSub %float %84 %85 + OpStore %x_68 %86 + %88 = OpAccessChain %_ptr_Function_float %p %uint_0 + %89 = OpLoad %float %88 + %91 = OpAccessChain %_ptr_Function_float %b %uint_0 + %92 = OpLoad %float %91 + %94 = OpAccessChain %_ptr_Function_float %p %uint_1 + %95 = OpLoad %float %94 + %97 = OpAccessChain %_ptr_Function_float %b %uint_1 + %98 = OpLoad %float %97 + %100 = OpAccessChain %_ptr_Function_float %c %uint_0 + %101 = OpLoad %float %100 + %103 = OpAccessChain %_ptr_Function_float %b %uint_0 + %104 = OpLoad %float %103 + %106 = OpAccessChain %_ptr_Function_float %c %uint_1 + %107 = OpLoad %float %106 + %109 = OpAccessChain %_ptr_Function_float %b %uint_1 + %110 = OpLoad %float %109 + %111 = OpFSub %float %89 %92 + %112 = OpFSub %float %95 %98 + %113 = OpCompositeConstruct %v2float %111 %112 + OpStore %param_2 %113 + %114 = OpFSub %float %101 %104 + %115 = OpFSub %float %107 %110 + %116 = OpCompositeConstruct %v2float %114 %115 + OpStore %param_3 %116 + %117 = OpAccessChain %_ptr_Function_float %param_2 %uint_0 + %118 = OpLoad %float %117 + %119 = OpAccessChain %_ptr_Function_float %param_3 %uint_1 + %120 = OpLoad %float %119 + %121 = OpAccessChain %_ptr_Function_float %param_3 %uint_0 + %122 = OpLoad %float %121 + %123 = OpAccessChain %_ptr_Function_float %param_2 %uint_1 + %124 = OpLoad %float %123 + %125 = OpFMul %float %118 %120 + %126 = OpFMul %float %122 %124 + %127 = OpFSub %float %125 %126 + OpStore %x_67 %127 + %129 = OpFOrdLessThan %bool %86 %float_0 + OpSelectionMerge %130 None + OpBranchConditional %129 %131 %130 + %131 = OpLabel + %132 = OpFOrdLessThan %bool %127 %float_0 + OpBranch %130 + %130 = OpLabel + %133 = OpPhi %bool %129 %23 %132 %131 + OpStore %x_136_phi %133 + %134 = OpLogicalNot %bool %133 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %135 + %136 = OpLabel + %137 = OpFOrdGreaterThanEqual %bool %86 %float_0 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %138 + %139 = OpLabel + %140 = OpFOrdGreaterThanEqual %bool %127 %float_0 + OpBranch %138 + %138 = OpLabel + %141 = OpPhi %bool %137 %136 %140 %139 + OpStore %x_135 %141 + %142 = OpLoad %bool %x_135 + OpStore %x_136_phi %142 + OpBranch %135 + %135 = OpLabel + %143 = OpLoad %bool %x_136_phi + %144 = OpLogicalNot %bool %143 + OpSelectionMerge %145 None + OpBranchConditional %144 %146 %145 + %146 = OpLabel + OpReturnValue %int_0 + %145 = OpLabel + %149 = OpAccessChain %_ptr_Function_float %p %uint_0 + %150 = OpLoad %float %149 + %152 = OpAccessChain %_ptr_Function_float %c %uint_0 + %153 = OpLoad %float %152 + %155 = OpAccessChain %_ptr_Function_float %p %uint_1 + %156 = OpLoad %float %155 + %158 = OpAccessChain %_ptr_Function_float %c %uint_1 + %159 = OpLoad %float %158 + %161 = OpAccessChain %_ptr_Function_float %a %uint_0 + %162 = OpLoad %float %161 + %164 = OpAccessChain %_ptr_Function_float %c %uint_0 + %165 = OpLoad %float %164 + %167 = OpAccessChain %_ptr_Function_float %a %uint_1 + %168 = OpLoad %float %167 + %170 = OpAccessChain %_ptr_Function_float %c %uint_1 + %171 = OpLoad %float %170 + %172 = OpFSub %float %150 %153 + %173 = OpFSub %float %156 %159 + %174 = OpCompositeConstruct %v2float %172 %173 + OpStore %param_4 %174 + %175 = OpFSub %float %162 %165 + %176 = OpFSub %float %168 %171 + %177 = OpCompositeConstruct %v2float %175 %176 + OpStore %param_5 %177 + %178 = OpAccessChain %_ptr_Function_float %param_4 %uint_0 + %179 = OpLoad %float %178 + %180 = OpAccessChain %_ptr_Function_float %param_5 %uint_1 + %181 = OpLoad %float %180 + %182 = OpAccessChain %_ptr_Function_float %param_5 %uint_0 + %183 = OpLoad %float %182 + %184 = OpAccessChain %_ptr_Function_float %param_4 %uint_1 + %185 = OpLoad %float %184 + %186 = OpFMul %float %179 %181 + %187 = OpFMul %float %183 %185 + %188 = OpFSub %float %186 %187 + OpStore %x_66 %188 + OpSelectionMerge %189 None + OpBranchConditional %129 %190 %189 + %190 = OpLabel + %191 = OpFOrdLessThan %bool %188 %float_0 + OpBranch %189 + %189 = OpLabel + %192 = OpPhi %bool %129 %145 %191 %190 + OpStore %x_173_phi %192 + %193 = OpLogicalNot %bool %192 + OpSelectionMerge %194 None + OpBranchConditional %193 %195 %194 + %195 = OpLabel + %196 = OpFOrdGreaterThanEqual %bool %86 %float_0 + OpSelectionMerge %197 None + OpBranchConditional %196 %198 %197 + %198 = OpLabel + %199 = OpFOrdGreaterThanEqual %bool %188 %float_0 + OpBranch %197 + %197 = OpLabel + %200 = OpPhi %bool %196 %195 %199 %198 + OpStore %x_172 %200 + %201 = OpLoad %bool %x_172 + OpStore %x_173_phi %201 + OpBranch %194 + %194 = OpLabel + %202 = OpLoad %bool %x_173_phi + %203 = OpLogicalNot %bool %202 + OpSelectionMerge %204 None + OpBranchConditional %203 %205 %204 + %205 = OpLabel + OpReturnValue %int_0 + %204 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %207 + %210 = OpLabel + %param_6 = OpVariable %_ptr_Function_v2float Function %30 + %param_7 = OpVariable %_ptr_Function_v2float Function %30 + %param_8 = OpVariable %_ptr_Function_v2float Function %30 + %param_9 = OpVariable %_ptr_Function_v2float Function %30 + %215 = OpLoad %v4float %gl_FragCoord + %217 = OpAccessChain %_ptr_Uniform_v2float %x_17 %uint_0 + %218 = OpLoad %v2float %217 + %219 = OpCompositeExtract %float %215 0 + %220 = OpCompositeExtract %float %215 1 + %221 = OpCompositeConstruct %v2float %219 %220 + %222 = OpFDiv %v2float %221 %218 + OpStore %param_6 %222 + OpStore %param_7 %225 + OpStore %param_8 %228 + OpStore %param_9 %231 + %232 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9 + %237 = OpIEqual %bool %232 %int_1 + OpSelectionMerge %238 None + OpBranchConditional %237 %239 %240 + %239 = OpLabel + OpStore %x_GLF_color %242 + OpBranch %238 + %240 = OpLabel + OpStore %x_GLF_color %243 + OpBranch %238 + %238 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %244 +%tint_symbol_1 = OpFunctionParameter %main_out + %248 = OpLabel + %249 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %249 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %207 + %251 = OpLabel + %252 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %252 + %253 = OpFunctionCall %void %main_1 + %255 = OpLoad %v4float %x_GLF_color + %256 = OpCompositeConstruct %main_out %255 + %254 = OpFunctionCall %void %tint_symbol_3 %256 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..414b559a93 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/0.wgsl.expected.wgsl @@ -0,0 +1,136 @@ +[[block]] +struct buf0 { + resolution : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_17 : buf0; + +var x_GLF_color : vec4; + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a : ptr>, b : ptr>, c : ptr>) -> i32 { + var x_66 : f32; + var x_67 : f32; + var x_68 : f32; + var param : vec2; + var param_1 : vec2; + var param_2 : vec2; + var param_3 : vec2; + var param_4 : vec2; + var param_5 : vec2; + var x_135 : bool; + var x_172 : bool; + var x_136_phi : bool; + var x_173_phi : bool; + let x_69 : ptr = &((*(p)).x); + let x_70 : f32 = *(x_69); + let x_71 : ptr = &((*(a)).x); + let x_72 : f32 = *(x_71); + let x_74 : ptr = &((*(p)).y); + let x_75 : f32 = *(x_74); + let x_76 : ptr = &((*(a)).y); + let x_77 : f32 = *(x_76); + let x_80 : ptr = &((*(b)).x); + let x_81 : f32 = *(x_80); + let x_82 : f32 = *(x_71); + let x_84 : ptr = &((*(b)).y); + let x_85 : f32 = *(x_84); + let x_86 : f32 = *(x_76); + param = vec2((x_70 - x_72), (x_75 - x_77)); + param_1 = vec2((x_81 - x_82), (x_85 - x_86)); + let x_90 : f32 = param.x; + let x_92 : f32 = param_1.y; + let x_95 : f32 = param_1.x; + let x_97 : f32 = param.y; + let x_99 : f32 = ((x_90 * x_92) - (x_95 * x_97)); + x_68 = x_99; + let x_100 : f32 = *(x_69); + let x_101 : f32 = *(x_80); + let x_103 : f32 = *(x_74); + let x_104 : f32 = *(x_84); + let x_107 : ptr = &((*(c)).x); + let x_108 : f32 = *(x_107); + let x_109 : f32 = *(x_80); + let x_111 : ptr = &((*(c)).y); + let x_112 : f32 = *(x_111); + let x_113 : f32 = *(x_84); + param_2 = vec2((x_100 - x_101), (x_103 - x_104)); + param_3 = vec2((x_108 - x_109), (x_112 - x_113)); + let x_117 : f32 = param_2.x; + let x_119 : f32 = param_3.y; + let x_122 : f32 = param_3.x; + let x_124 : f32 = param_2.y; + let x_126 : f32 = ((x_117 * x_119) - (x_122 * x_124)); + x_67 = x_126; + let x_127 : bool = (x_99 < 0.0); + let x_129 : bool = (x_127 && (x_126 < 0.0)); + x_136_phi = x_129; + if (!(x_129)) { + x_135 = ((x_99 >= 0.0) && (x_126 >= 0.0)); + x_136_phi = x_135; + } + let x_136 : bool = x_136_phi; + if (!(x_136)) { + return 0; + } + let x_140 : f32 = *(x_69); + let x_141 : f32 = *(x_107); + let x_143 : f32 = *(x_74); + let x_144 : f32 = *(x_111); + let x_147 : f32 = *(x_71); + let x_148 : f32 = *(x_107); + let x_150 : f32 = *(x_76); + let x_151 : f32 = *(x_111); + param_4 = vec2((x_140 - x_141), (x_143 - x_144)); + param_5 = vec2((x_147 - x_148), (x_150 - x_151)); + let x_155 : f32 = param_4.x; + let x_157 : f32 = param_5.y; + let x_160 : f32 = param_5.x; + let x_162 : f32 = param_4.y; + let x_164 : f32 = ((x_155 * x_157) - (x_160 * x_162)); + x_66 = x_164; + let x_166 : bool = (x_127 && (x_164 < 0.0)); + x_173_phi = x_166; + if (!(x_166)) { + x_172 = ((x_99 >= 0.0) && (x_164 >= 0.0)); + x_173_phi = x_172; + } + let x_173 : bool = x_173_phi; + if (!(x_173)) { + return 0; + } + return 1; +} + +fn main_1() { + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_55 : vec4 = gl_FragCoord; + let x_58 : vec2 = x_17.resolution; + param_6 = (vec2(x_55.x, x_55.y) / x_58); + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_60 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_60 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm new file mode 100644 index 0000000000..48966c3643 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm @@ -0,0 +1,298 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle(vf2;vf2;vf2;vf2;" + OpName %p "p" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %__0 "" + OpName %param_5 "param" + OpName %param_6 "param" + OpName %param_7 "param" + OpName %param_8 "param" + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_GLF_color Location 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %25 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int = OpTypeInt 32 1 + %30 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %33 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int_0 = OpConstant %int 0 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %50 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %53 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %56 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 + %57 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %58 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main = OpFunction %void None %25 + %59 = OpLabel + %param_5 = OpVariable %_ptr_Function_v2float Function + %param_6 = OpVariable %_ptr_Function_v2float Function + %param_7 = OpVariable %_ptr_Function_v2float Function + %param_8 = OpVariable %_ptr_Function_v2float Function + %60 = OpLoad %v4float %gl_FragCoord + %61 = OpVectorShuffle %v2float %60 %60 0 1 + %62 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 + %63 = OpLoad %v2float %62 + %64 = OpFDiv %v2float %61 %63 + OpStore %param_5 %64 + OpStore %param_6 %50 + OpStore %param_7 %53 + OpStore %param_8 %56 + %65 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_5 %param_6 %param_7 %param_8 + %66 = OpIEqual %bool %65 %int_1 + OpSelectionMerge %67 None + OpBranchConditional %66 %68 %69 + %68 = OpLabel + %70 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %73 = OpLoad %float %72 + %74 = OpFOrdGreaterThanEqual %bool %71 %73 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + OpStore %_GLF_color %57 + OpBranch %75 + %75 = OpLabel + OpBranch %67 + %69 = OpLabel + OpStore %_GLF_color %58 + OpBranch %67 + %67 = OpLabel + OpReturn + OpFunctionEnd +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %30 + %p = OpFunctionParameter %_ptr_Function_v2float + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %77 = OpLabel + %78 = OpVariable %_ptr_Function_float Function + %79 = OpVariable %_ptr_Function_float Function + %80 = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_v2float Function + %param_0 = OpVariable %_ptr_Function_v2float Function + %param_1 = OpVariable %_ptr_Function_v2float Function + %param_2 = OpVariable %_ptr_Function_v2float Function + %param_3 = OpVariable %_ptr_Function_v2float Function + %param_4 = OpVariable %_ptr_Function_v2float Function + %81 = OpAccessChain %_ptr_Function_float %p %uint_0 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Function_float %a %uint_0 + %84 = OpLoad %float %83 + %85 = OpFSub %float %82 %84 + %86 = OpAccessChain %_ptr_Function_float %p %uint_1 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Function_float %a %uint_1 + %89 = OpLoad %float %88 + %90 = OpFSub %float %87 %89 + %91 = OpCompositeConstruct %v2float %85 %90 + %92 = OpAccessChain %_ptr_Function_float %b %uint_0 + %93 = OpLoad %float %92 + %94 = OpLoad %float %83 + %95 = OpFSub %float %93 %94 + %96 = OpAccessChain %_ptr_Function_float %b %uint_1 + %97 = OpLoad %float %96 + %98 = OpLoad %float %88 + %99 = OpFSub %float %97 %98 + %100 = OpCompositeConstruct %v2float %95 %99 + OpStore %param %91 + OpStore %param_0 %100 + %101 = OpAccessChain %_ptr_Function_float %param %uint_0 + %102 = OpLoad %float %101 + %103 = OpAccessChain %_ptr_Function_float %param_0 %uint_1 + %104 = OpLoad %float %103 + %105 = OpFMul %float %102 %104 + %106 = OpAccessChain %_ptr_Function_float %param_0 %uint_0 + %107 = OpLoad %float %106 + %108 = OpAccessChain %_ptr_Function_float %param %uint_1 + %109 = OpLoad %float %108 + %110 = OpFMul %float %107 %109 + %111 = OpFSub %float %105 %110 + OpStore %80 %111 + %112 = OpLoad %float %81 + %113 = OpLoad %float %92 + %114 = OpFSub %float %112 %113 + %115 = OpLoad %float %86 + %116 = OpLoad %float %96 + %117 = OpFSub %float %115 %116 + %118 = OpCompositeConstruct %v2float %114 %117 + %119 = OpAccessChain %_ptr_Function_float %c %uint_0 + %120 = OpLoad %float %119 + %121 = OpLoad %float %92 + %122 = OpFSub %float %120 %121 + %123 = OpAccessChain %_ptr_Function_float %c %uint_1 + %124 = OpLoad %float %123 + %125 = OpLoad %float %96 + %126 = OpFSub %float %124 %125 + %127 = OpCompositeConstruct %v2float %122 %126 + OpStore %param_1 %118 + OpStore %param_2 %127 + %128 = OpAccessChain %_ptr_Function_float %param_1 %uint_0 + %129 = OpLoad %float %128 + %130 = OpAccessChain %_ptr_Function_float %param_2 %uint_1 + %131 = OpLoad %float %130 + %132 = OpFMul %float %129 %131 + %133 = OpAccessChain %_ptr_Function_float %param_2 %uint_0 + %134 = OpLoad %float %133 + %135 = OpAccessChain %_ptr_Function_float %param_1 %uint_1 + %136 = OpLoad %float %135 + %137 = OpFMul %float %134 %136 + %138 = OpFSub %float %132 %137 + OpStore %79 %138 + %139 = OpFOrdLessThan %bool %111 %float_0 + %140 = OpFOrdLessThan %bool %138 %float_0 + %141 = OpLogicalAnd %bool %139 %140 + %142 = OpLogicalNot %bool %141 + OpSelectionMerge %143 None + OpBranchConditional %142 %144 %143 + %144 = OpLabel + %145 = OpFOrdGreaterThanEqual %bool %111 %float_0 + %146 = OpFOrdGreaterThanEqual %bool %138 %float_0 + %147 = OpLogicalAnd %bool %145 %146 + OpBranch %143 + %143 = OpLabel + %148 = OpPhi %bool %141 %77 %147 %144 + %149 = OpLogicalNot %bool %148 + OpSelectionMerge %150 None + OpBranchConditional %149 %151 %150 + %151 = OpLabel + OpBranch %152 + %152 = OpLabel + %153 = OpPhi %int %int_0 %151 %154 %155 + OpLoopMerge %156 %155 None + OpBranch %157 + %157 = OpLabel + %158 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %159 = OpLoad %float %158 + %160 = OpConvertFToS %int %159 + %161 = OpSLessThan %bool %153 %160 + OpBranchConditional %161 %162 %156 + %162 = OpLabel + OpStore %_GLF_color %33 + OpBranch %163 + %163 = OpLabel + %164 = OpPhi %int %int_0 %162 %165 %166 + OpLoopMerge %167 %166 None + OpBranch %168 + %168 = OpLabel + %169 = OpSLessThan %bool %164 %160 + OpBranchConditional %169 %170 %167 + %170 = OpLabel + OpStore %_GLF_color %33 + OpBranch %166 + %166 = OpLabel + %165 = OpIAdd %int %164 %int_1 + OpBranch %163 + %167 = OpLabel + OpBranch %155 + %155 = OpLabel + %154 = OpIAdd %int %153 %int_1 + OpBranch %152 + %156 = OpLabel + OpReturnValue %int_0 + %150 = OpLabel + %171 = OpLoad %float %81 + %172 = OpLoad %float %119 + %173 = OpFSub %float %171 %172 + %174 = OpLoad %float %86 + %175 = OpLoad %float %123 + %176 = OpFSub %float %174 %175 + %177 = OpCompositeConstruct %v2float %173 %176 + %178 = OpLoad %float %83 + %179 = OpLoad %float %119 + %180 = OpFSub %float %178 %179 + %181 = OpLoad %float %88 + %182 = OpLoad %float %123 + %183 = OpFSub %float %181 %182 + %184 = OpCompositeConstruct %v2float %180 %183 + OpStore %param_3 %177 + OpStore %param_4 %184 + %185 = OpAccessChain %_ptr_Function_float %param_3 %uint_0 + %186 = OpLoad %float %185 + %187 = OpAccessChain %_ptr_Function_float %param_4 %uint_1 + %188 = OpLoad %float %187 + %189 = OpFMul %float %186 %188 + %190 = OpAccessChain %_ptr_Function_float %param_4 %uint_0 + %191 = OpLoad %float %190 + %192 = OpAccessChain %_ptr_Function_float %param_3 %uint_1 + %193 = OpLoad %float %192 + %194 = OpFMul %float %191 %193 + %195 = OpFSub %float %189 %194 + OpStore %78 %195 + %196 = OpFOrdLessThan %bool %195 %float_0 + %197 = OpLogicalAnd %bool %139 %196 + %198 = OpLogicalNot %bool %197 + OpSelectionMerge %199 None + OpBranchConditional %198 %200 %199 + %200 = OpLabel + %201 = OpFOrdGreaterThanEqual %bool %111 %float_0 + %202 = OpFOrdGreaterThanEqual %bool %195 %float_0 + %203 = OpLogicalAnd %bool %201 %202 + OpBranch %199 + %199 = OpLabel + %204 = OpPhi %bool %197 %150 %203 %200 + %205 = OpLogicalNot %bool %204 + OpSelectionMerge %206 None + OpBranchConditional %205 %207 %206 + %207 = OpLabel + OpReturnValue %int_0 + %206 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..1e6b252bb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.hlsl @@ -0,0 +1,183 @@ +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_19 : register(b0, space0) { + uint4 x_19[1]; +}; + +int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a, inout float2 b, inout float2 c) { + float x_78 = 0.0f; + float x_79 = 0.0f; + float x_80 = 0.0f; + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + float2 param_2 = float2(0.0f, 0.0f); + float2 param_3 = float2(0.0f, 0.0f); + float2 param_4 = float2(0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + bool x_147 = false; + bool x_203 = false; + bool x_148_phi = false; + bool x_204_phi = false; + const float x_82 = p.x; + const float x_84 = a.x; + const float x_87 = p.y; + const float x_89 = a.y; + const float x_93 = b.x; + const float x_94 = a.x; + const float x_97 = b.y; + const float x_98 = a.y; + param = float2((x_82 - x_84), (x_87 - x_89)); + param_1 = float2((x_93 - x_94), (x_97 - x_98)); + const float x_102 = param.x; + const float x_104 = param_1.y; + const float x_107 = param_1.x; + const float x_109 = param.y; + const float x_111 = ((x_102 * x_104) - (x_107 * x_109)); + x_80 = x_111; + const float x_112 = p.x; + const float x_113 = b.x; + const float x_115 = p.y; + const float x_116 = b.y; + const float x_120 = c.x; + const float x_121 = b.x; + const float x_124 = c.y; + const float x_125 = b.y; + param_2 = float2((x_112 - x_113), (x_115 - x_116)); + param_3 = float2((x_120 - x_121), (x_124 - x_125)); + const float x_129 = param_2.x; + const float x_131 = param_3.y; + const float x_134 = param_3.x; + const float x_136 = param_2.y; + const float x_138 = ((x_129 * x_131) - (x_134 * x_136)); + x_79 = x_138; + const bool x_139 = (x_111 < 0.0f); + bool tint_tmp = x_139; + if (tint_tmp) { + tint_tmp = (x_138 < 0.0f); + } + const bool x_141 = (tint_tmp); + x_148_phi = x_141; + if (!(x_141)) { + bool tint_tmp_1 = (x_111 >= 0.0f); + if (tint_tmp_1) { + tint_tmp_1 = (x_138 >= 0.0f); + } + x_147 = (tint_tmp_1); + x_148_phi = x_147; + } + int x_153_phi = 0; + if (!(x_148_phi)) { + x_153_phi = 0; + while (true) { + int x_154 = 0; + int x_164_phi = 0; + const int x_153 = x_153_phi; + const float x_159 = asfloat(x_11[0].y); + const int x_160 = int(x_159); + if ((x_153 < x_160)) { + } else { + break; + } + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + x_164_phi = 0; + while (true) { + int x_165 = 0; + const int x_164 = x_164_phi; + if ((x_164 < x_160)) { + } else { + break; + } + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + { + x_165 = (x_164 + 1); + x_164_phi = x_165; + } + } + { + x_154 = (x_153 + 1); + x_153_phi = x_154; + } + } + return 0; + } + const float x_171 = p.x; + const float x_172 = c.x; + const float x_174 = p.y; + const float x_175 = c.y; + const float x_178 = a.x; + const float x_179 = c.x; + const float x_181 = a.y; + const float x_182 = c.y; + param_4 = float2((x_171 - x_172), (x_174 - x_175)); + param_5 = float2((x_178 - x_179), (x_181 - x_182)); + const float x_186 = param_4.x; + const float x_188 = param_5.y; + const float x_191 = param_5.x; + const float x_193 = param_4.y; + const float x_195 = ((x_186 * x_188) - (x_191 * x_193)); + x_78 = x_195; + bool tint_tmp_2 = x_139; + if (tint_tmp_2) { + tint_tmp_2 = (x_195 < 0.0f); + } + const bool x_197 = (tint_tmp_2); + x_204_phi = x_197; + if (!(x_197)) { + bool tint_tmp_3 = (x_111 >= 0.0f); + if (tint_tmp_3) { + tint_tmp_3 = (x_195 >= 0.0f); + } + x_203 = (tint_tmp_3); + x_204_phi = x_203; + } + if (!(x_204_phi)) { + return 0; + } + return 1; +} + +void main_1() { + float2 param_6 = float2(0.0f, 0.0f); + float2 param_7 = float2(0.0f, 0.0f); + float2 param_8 = float2(0.0f, 0.0f); + float2 param_9 = float2(0.0f, 0.0f); + const float4 x_60 = gl_FragCoord; + const float2 x_63 = asfloat(x_19[0].xy); + param_6 = (float2(x_60.x, x_60.y) / x_63); + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + const int x_65 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9); + if ((x_65 == 1)) { + const float x_71 = asfloat(x_11[0].y); + const float x_73 = asfloat(x_11[0].x); + if ((x_71 >= x_73)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.msl new file mode 100644 index 0000000000..6537e89975 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.msl @@ -0,0 +1,168 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int pointInTriangle_vf2_vf2_vf2_vf2_(constant buf1& x_11, thread float2* const p, thread float2* const a, thread float2* const b, thread float2* const c, thread float4* const tint_symbol_5) { + float x_78 = 0.0f; + float x_79 = 0.0f; + float x_80 = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + float2 param_2 = 0.0f; + float2 param_3 = 0.0f; + float2 param_4 = 0.0f; + float2 param_5 = 0.0f; + bool x_147 = false; + bool x_203 = false; + bool x_148_phi = false; + bool x_204_phi = false; + float const x_82 = (*(p)).x; + float const x_84 = (*(a)).x; + float const x_87 = (*(p)).y; + float const x_89 = (*(a)).y; + float const x_93 = (*(b)).x; + float const x_94 = (*(a)).x; + float const x_97 = (*(b)).y; + float const x_98 = (*(a)).y; + param = float2((x_82 - x_84), (x_87 - x_89)); + param_1 = float2((x_93 - x_94), (x_97 - x_98)); + float const x_102 = param.x; + float const x_104 = param_1.y; + float const x_107 = param_1.x; + float const x_109 = param.y; + float const x_111 = ((x_102 * x_104) - (x_107 * x_109)); + x_80 = x_111; + float const x_112 = (*(p)).x; + float const x_113 = (*(b)).x; + float const x_115 = (*(p)).y; + float const x_116 = (*(b)).y; + float const x_120 = (*(c)).x; + float const x_121 = (*(b)).x; + float const x_124 = (*(c)).y; + float const x_125 = (*(b)).y; + param_2 = float2((x_112 - x_113), (x_115 - x_116)); + param_3 = float2((x_120 - x_121), (x_124 - x_125)); + float const x_129 = param_2.x; + float const x_131 = param_3.y; + float const x_134 = param_3.x; + float const x_136 = param_2.y; + float const x_138 = ((x_129 * x_131) - (x_134 * x_136)); + x_79 = x_138; + bool const x_139 = (x_111 < 0.0f); + bool const x_141 = (x_139 && (x_138 < 0.0f)); + x_148_phi = x_141; + if (!(x_141)) { + x_147 = ((x_111 >= 0.0f) && (x_138 >= 0.0f)); + x_148_phi = x_147; + } + int x_153_phi = 0; + bool const x_148 = x_148_phi; + if (!(x_148)) { + x_153_phi = 0; + while (true) { + int x_154 = 0; + int x_164_phi = 0; + int const x_153 = x_153_phi; + float const x_159 = x_11.injectionSwitch.y; + int const x_160 = int(x_159); + if ((x_153 < x_160)) { + } else { + break; + } + *(tint_symbol_5) = float4(1.0f, 1.0f, 1.0f, 1.0f); + x_164_phi = 0; + while (true) { + int x_165 = 0; + int const x_164 = x_164_phi; + if ((x_164 < x_160)) { + } else { + break; + } + *(tint_symbol_5) = float4(1.0f, 1.0f, 1.0f, 1.0f); + { + x_165 = (x_164 + 1); + x_164_phi = x_165; + } + } + { + x_154 = (x_153 + 1); + x_153_phi = x_154; + } + } + return 0; + } + float const x_171 = (*(p)).x; + float const x_172 = (*(c)).x; + float const x_174 = (*(p)).y; + float const x_175 = (*(c)).y; + float const x_178 = (*(a)).x; + float const x_179 = (*(c)).x; + float const x_181 = (*(a)).y; + float const x_182 = (*(c)).y; + param_4 = float2((x_171 - x_172), (x_174 - x_175)); + param_5 = float2((x_178 - x_179), (x_181 - x_182)); + float const x_186 = param_4.x; + float const x_188 = param_5.y; + float const x_191 = param_5.x; + float const x_193 = param_4.y; + float const x_195 = ((x_186 * x_188) - (x_191 * x_193)); + x_78 = x_195; + bool const x_197 = (x_139 && (x_195 < 0.0f)); + x_204_phi = x_197; + if (!(x_197)) { + x_203 = ((x_111 >= 0.0f) && (x_195 >= 0.0f)); + x_204_phi = x_203; + } + bool const x_204 = x_204_phi; + if (!(x_204)) { + return 0; + } + return 1; +} + +void main_1(constant buf0& x_19, constant buf1& x_11, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float2 param_6 = 0.0f; + float2 param_7 = 0.0f; + float2 param_8 = 0.0f; + float2 param_9 = 0.0f; + float4 const x_60 = *(tint_symbol_6); + float2 const x_63 = x_19.resolution; + param_6 = (float2(x_60.x, x_60.y) / x_63); + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + int const x_65 = pointInTriangle_vf2_vf2_vf2_vf2_(x_11, &(param_6), &(param_7), &(param_8), &(param_9), tint_symbol_7); + if ((x_65 == 1)) { + float const x_71 = x_11.injectionSwitch.y; + float const x_73 = x_11.injectionSwitch.x; + if ((x_71 >= x_73)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_19 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_19, x_11, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..8e4e6fce17 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.spvasm @@ -0,0 +1,423 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 300 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_19 "x_19" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_" + OpName %p "p" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %x_78 "x_78" + OpName %x_79 "x_79" + OpName %x_80 "x_80" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %x_147 "x_147" + OpName %x_203 "x_203" + OpName %x_148_phi "x_148_phi" + OpName %x_204_phi "x_204_phi" + OpName %x_153_phi "x_153_phi" + OpName %x_154 "x_154" + OpName %x_164_phi "x_164_phi" + OpName %x_165 "x_165" + OpName %main_1 "main_1" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_19 NonWritable + OpDecorate %x_19 DescriptorSet 0 + OpDecorate %x_19 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_19 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %int = OpTypeInt 32 1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float + %33 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %42 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_int = OpTypePointer Function %int + %148 = OpConstantNull %int + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %170 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %244 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %262 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %265 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %268 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 + %285 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %286 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %287 = OpTypeFunction %void %main_out +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %18 + %p = OpFunctionParameter %_ptr_Function_v2float + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %26 = OpLabel + %x_78 = OpVariable %_ptr_Function_float Function %29 + %x_79 = OpVariable %_ptr_Function_float Function %29 + %x_80 = OpVariable %_ptr_Function_float Function %29 + %param = OpVariable %_ptr_Function_v2float Function %33 + %param_1 = OpVariable %_ptr_Function_v2float Function %33 + %param_2 = OpVariable %_ptr_Function_v2float Function %33 + %param_3 = OpVariable %_ptr_Function_v2float Function %33 + %param_4 = OpVariable %_ptr_Function_v2float Function %33 + %param_5 = OpVariable %_ptr_Function_v2float Function %33 + %x_147 = OpVariable %_ptr_Function_bool Function %42 + %x_203 = OpVariable %_ptr_Function_bool Function %42 + %x_148_phi = OpVariable %_ptr_Function_bool Function %42 + %x_204_phi = OpVariable %_ptr_Function_bool Function %42 + %x_153_phi = OpVariable %_ptr_Function_int Function %148 + %x_154 = OpVariable %_ptr_Function_int Function %148 + %x_164_phi = OpVariable %_ptr_Function_int Function %148 + %x_165 = OpVariable %_ptr_Function_int Function %148 + %49 = OpAccessChain %_ptr_Function_float %p %uint_0 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Function_float %a %uint_0 + %53 = OpLoad %float %52 + %56 = OpAccessChain %_ptr_Function_float %p %uint_1 + %57 = OpLoad %float %56 + %59 = OpAccessChain %_ptr_Function_float %a %uint_1 + %60 = OpLoad %float %59 + %62 = OpAccessChain %_ptr_Function_float %b %uint_0 + %63 = OpLoad %float %62 + %65 = OpAccessChain %_ptr_Function_float %a %uint_0 + %66 = OpLoad %float %65 + %68 = OpAccessChain %_ptr_Function_float %b %uint_1 + %69 = OpLoad %float %68 + %71 = OpAccessChain %_ptr_Function_float %a %uint_1 + %72 = OpLoad %float %71 + %73 = OpFSub %float %50 %53 + %74 = OpFSub %float %57 %60 + %75 = OpCompositeConstruct %v2float %73 %74 + OpStore %param %75 + %76 = OpFSub %float %63 %66 + %77 = OpFSub %float %69 %72 + %78 = OpCompositeConstruct %v2float %76 %77 + OpStore %param_1 %78 + %79 = OpAccessChain %_ptr_Function_float %param %uint_0 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Function_float %param_1 %uint_1 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Function_float %param_1 %uint_0 + %84 = OpLoad %float %83 + %85 = OpAccessChain %_ptr_Function_float %param %uint_1 + %86 = OpLoad %float %85 + %87 = OpFMul %float %80 %82 + %88 = OpFMul %float %84 %86 + %89 = OpFSub %float %87 %88 + OpStore %x_80 %89 + %91 = OpAccessChain %_ptr_Function_float %p %uint_0 + %92 = OpLoad %float %91 + %94 = OpAccessChain %_ptr_Function_float %b %uint_0 + %95 = OpLoad %float %94 + %97 = OpAccessChain %_ptr_Function_float %p %uint_1 + %98 = OpLoad %float %97 + %100 = OpAccessChain %_ptr_Function_float %b %uint_1 + %101 = OpLoad %float %100 + %103 = OpAccessChain %_ptr_Function_float %c %uint_0 + %104 = OpLoad %float %103 + %106 = OpAccessChain %_ptr_Function_float %b %uint_0 + %107 = OpLoad %float %106 + %109 = OpAccessChain %_ptr_Function_float %c %uint_1 + %110 = OpLoad %float %109 + %112 = OpAccessChain %_ptr_Function_float %b %uint_1 + %113 = OpLoad %float %112 + %114 = OpFSub %float %92 %95 + %115 = OpFSub %float %98 %101 + %116 = OpCompositeConstruct %v2float %114 %115 + OpStore %param_2 %116 + %117 = OpFSub %float %104 %107 + %118 = OpFSub %float %110 %113 + %119 = OpCompositeConstruct %v2float %117 %118 + OpStore %param_3 %119 + %120 = OpAccessChain %_ptr_Function_float %param_2 %uint_0 + %121 = OpLoad %float %120 + %122 = OpAccessChain %_ptr_Function_float %param_3 %uint_1 + %123 = OpLoad %float %122 + %124 = OpAccessChain %_ptr_Function_float %param_3 %uint_0 + %125 = OpLoad %float %124 + %126 = OpAccessChain %_ptr_Function_float %param_2 %uint_1 + %127 = OpLoad %float %126 + %128 = OpFMul %float %121 %123 + %129 = OpFMul %float %125 %127 + %130 = OpFSub %float %128 %129 + OpStore %x_79 %130 + %132 = OpFOrdLessThan %bool %89 %float_0 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %133 + %134 = OpLabel + %135 = OpFOrdLessThan %bool %130 %float_0 + OpBranch %133 + %133 = OpLabel + %136 = OpPhi %bool %132 %26 %135 %134 + OpStore %x_148_phi %136 + %137 = OpLogicalNot %bool %136 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %138 + %139 = OpLabel + %140 = OpFOrdGreaterThanEqual %bool %89 %float_0 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + %143 = OpFOrdGreaterThanEqual %bool %130 %float_0 + OpBranch %141 + %141 = OpLabel + %144 = OpPhi %bool %140 %139 %143 %142 + OpStore %x_147 %144 + %145 = OpLoad %bool %x_147 + OpStore %x_148_phi %145 + OpBranch %138 + %138 = OpLabel + %149 = OpLoad %bool %x_148_phi + %150 = OpLogicalNot %bool %149 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %151 + %152 = OpLabel + OpStore %x_153_phi %int_0 + OpBranch %154 + %154 = OpLabel + OpLoopMerge %155 %156 None + OpBranch %157 + %157 = OpLabel + %160 = OpLoad %int %x_153_phi + %162 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_1 + %163 = OpLoad %float %162 + %164 = OpConvertFToS %int %163 + %165 = OpSLessThan %bool %160 %164 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %168 + %167 = OpLabel + OpBranch %166 + %168 = OpLabel + OpBranch %155 + %166 = OpLabel + OpStore %x_GLF_color %170 + OpStore %x_164_phi %int_0 + OpBranch %171 + %171 = OpLabel + OpLoopMerge %172 %173 None + OpBranch %174 + %174 = OpLabel + %176 = OpLoad %int %x_164_phi + %177 = OpSLessThan %bool %176 %164 + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %180 + %179 = OpLabel + OpBranch %178 + %180 = OpLabel + OpBranch %172 + %178 = OpLabel + OpStore %x_GLF_color %170 + OpBranch %173 + %173 = OpLabel + %182 = OpIAdd %int %176 %int_1 + OpStore %x_165 %182 + %183 = OpLoad %int %x_165 + OpStore %x_164_phi %183 + OpBranch %171 + %172 = OpLabel + OpBranch %156 + %156 = OpLabel + %184 = OpIAdd %int %160 %int_1 + OpStore %x_154 %184 + %185 = OpLoad %int %x_154 + OpStore %x_153_phi %185 + OpBranch %154 + %155 = OpLabel + OpReturnValue %int_0 + %151 = OpLabel + %187 = OpAccessChain %_ptr_Function_float %p %uint_0 + %188 = OpLoad %float %187 + %190 = OpAccessChain %_ptr_Function_float %c %uint_0 + %191 = OpLoad %float %190 + %193 = OpAccessChain %_ptr_Function_float %p %uint_1 + %194 = OpLoad %float %193 + %196 = OpAccessChain %_ptr_Function_float %c %uint_1 + %197 = OpLoad %float %196 + %199 = OpAccessChain %_ptr_Function_float %a %uint_0 + %200 = OpLoad %float %199 + %202 = OpAccessChain %_ptr_Function_float %c %uint_0 + %203 = OpLoad %float %202 + %205 = OpAccessChain %_ptr_Function_float %a %uint_1 + %206 = OpLoad %float %205 + %208 = OpAccessChain %_ptr_Function_float %c %uint_1 + %209 = OpLoad %float %208 + %210 = OpFSub %float %188 %191 + %211 = OpFSub %float %194 %197 + %212 = OpCompositeConstruct %v2float %210 %211 + OpStore %param_4 %212 + %213 = OpFSub %float %200 %203 + %214 = OpFSub %float %206 %209 + %215 = OpCompositeConstruct %v2float %213 %214 + OpStore %param_5 %215 + %216 = OpAccessChain %_ptr_Function_float %param_4 %uint_0 + %217 = OpLoad %float %216 + %218 = OpAccessChain %_ptr_Function_float %param_5 %uint_1 + %219 = OpLoad %float %218 + %220 = OpAccessChain %_ptr_Function_float %param_5 %uint_0 + %221 = OpLoad %float %220 + %222 = OpAccessChain %_ptr_Function_float %param_4 %uint_1 + %223 = OpLoad %float %222 + %224 = OpFMul %float %217 %219 + %225 = OpFMul %float %221 %223 + %226 = OpFSub %float %224 %225 + OpStore %x_78 %226 + OpSelectionMerge %227 None + OpBranchConditional %132 %228 %227 + %228 = OpLabel + %229 = OpFOrdLessThan %bool %226 %float_0 + OpBranch %227 + %227 = OpLabel + %230 = OpPhi %bool %132 %151 %229 %228 + OpStore %x_204_phi %230 + %231 = OpLogicalNot %bool %230 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %232 + %233 = OpLabel + %234 = OpFOrdGreaterThanEqual %bool %89 %float_0 + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %235 + %236 = OpLabel + %237 = OpFOrdGreaterThanEqual %bool %226 %float_0 + OpBranch %235 + %235 = OpLabel + %238 = OpPhi %bool %234 %233 %237 %236 + OpStore %x_203 %238 + %239 = OpLoad %bool %x_203 + OpStore %x_204_phi %239 + OpBranch %232 + %232 = OpLabel + %240 = OpLoad %bool %x_204_phi + %241 = OpLogicalNot %bool %240 + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %242 + %243 = OpLabel + OpReturnValue %int_0 + %242 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %244 + %247 = OpLabel + %param_6 = OpVariable %_ptr_Function_v2float Function %33 + %param_7 = OpVariable %_ptr_Function_v2float Function %33 + %param_8 = OpVariable %_ptr_Function_v2float Function %33 + %param_9 = OpVariable %_ptr_Function_v2float Function %33 + %252 = OpLoad %v4float %gl_FragCoord + %254 = OpAccessChain %_ptr_Uniform_v2float %x_19 %uint_0 + %255 = OpLoad %v2float %254 + %256 = OpCompositeExtract %float %252 0 + %257 = OpCompositeExtract %float %252 1 + %258 = OpCompositeConstruct %v2float %256 %257 + %259 = OpFDiv %v2float %258 %255 + OpStore %param_6 %259 + OpStore %param_7 %262 + OpStore %param_8 %265 + OpStore %param_9 %268 + %269 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9 + %274 = OpIEqual %bool %269 %int_1 + OpSelectionMerge %275 None + OpBranchConditional %274 %276 %277 + %276 = OpLabel + %278 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_1 + %279 = OpLoad %float %278 + %280 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_0 + %281 = OpLoad %float %280 + %282 = OpFOrdGreaterThanEqual %bool %279 %281 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %283 + %284 = OpLabel + OpStore %x_GLF_color %285 + OpBranch %283 + %283 = OpLabel + OpBranch %275 + %277 = OpLabel + OpStore %x_GLF_color %286 + OpBranch %275 + %275 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %287 +%tint_symbol_1 = OpFunctionParameter %main_out + %291 = OpLabel + %292 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %292 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %244 + %294 = OpLabel + %295 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %295 + %296 = OpFunctionCall %void %main_1 + %298 = OpLoad %v4float %x_GLF_color + %299 = OpCompositeConstruct %main_out %298 + %297 = OpFunctionCall %void %tint_symbol_3 %299 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..c9e248c547 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.spvasm.expected.wgsl @@ -0,0 +1,181 @@ +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_19 : buf0; + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a : ptr>, b : ptr>, c : ptr>) -> i32 { + var x_78 : f32; + var x_79 : f32; + var x_80 : f32; + var param : vec2; + var param_1 : vec2; + var param_2 : vec2; + var param_3 : vec2; + var param_4 : vec2; + var param_5 : vec2; + var x_147 : bool; + var x_203 : bool; + var x_148_phi : bool; + var x_204_phi : bool; + let x_81 : ptr = &((*(p)).x); + let x_82 : f32 = *(x_81); + let x_83 : ptr = &((*(a)).x); + let x_84 : f32 = *(x_83); + let x_86 : ptr = &((*(p)).y); + let x_87 : f32 = *(x_86); + let x_88 : ptr = &((*(a)).y); + let x_89 : f32 = *(x_88); + let x_92 : ptr = &((*(b)).x); + let x_93 : f32 = *(x_92); + let x_94 : f32 = *(x_83); + let x_96 : ptr = &((*(b)).y); + let x_97 : f32 = *(x_96); + let x_98 : f32 = *(x_88); + param = vec2((x_82 - x_84), (x_87 - x_89)); + param_1 = vec2((x_93 - x_94), (x_97 - x_98)); + let x_102 : f32 = param.x; + let x_104 : f32 = param_1.y; + let x_107 : f32 = param_1.x; + let x_109 : f32 = param.y; + let x_111 : f32 = ((x_102 * x_104) - (x_107 * x_109)); + x_80 = x_111; + let x_112 : f32 = *(x_81); + let x_113 : f32 = *(x_92); + let x_115 : f32 = *(x_86); + let x_116 : f32 = *(x_96); + let x_119 : ptr = &((*(c)).x); + let x_120 : f32 = *(x_119); + let x_121 : f32 = *(x_92); + let x_123 : ptr = &((*(c)).y); + let x_124 : f32 = *(x_123); + let x_125 : f32 = *(x_96); + param_2 = vec2((x_112 - x_113), (x_115 - x_116)); + param_3 = vec2((x_120 - x_121), (x_124 - x_125)); + let x_129 : f32 = param_2.x; + let x_131 : f32 = param_3.y; + let x_134 : f32 = param_3.x; + let x_136 : f32 = param_2.y; + let x_138 : f32 = ((x_129 * x_131) - (x_134 * x_136)); + x_79 = x_138; + let x_139 : bool = (x_111 < 0.0); + let x_141 : bool = (x_139 && (x_138 < 0.0)); + x_148_phi = x_141; + if (!(x_141)) { + x_147 = ((x_111 >= 0.0) && (x_138 >= 0.0)); + x_148_phi = x_147; + } + var x_153_phi : i32; + let x_148 : bool = x_148_phi; + if (!(x_148)) { + x_153_phi = 0; + loop { + var x_154 : i32; + var x_164_phi : i32; + let x_153 : i32 = x_153_phi; + let x_159 : f32 = x_11.injectionSwitch.y; + let x_160 : i32 = i32(x_159); + if ((x_153 < x_160)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + x_164_phi = 0; + loop { + var x_165 : i32; + let x_164 : i32 = x_164_phi; + if ((x_164 < x_160)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + + continuing { + x_165 = (x_164 + 1); + x_164_phi = x_165; + } + } + + continuing { + x_154 = (x_153 + 1); + x_153_phi = x_154; + } + } + return 0; + } + let x_171 : f32 = *(x_81); + let x_172 : f32 = *(x_119); + let x_174 : f32 = *(x_86); + let x_175 : f32 = *(x_123); + let x_178 : f32 = *(x_83); + let x_179 : f32 = *(x_119); + let x_181 : f32 = *(x_88); + let x_182 : f32 = *(x_123); + param_4 = vec2((x_171 - x_172), (x_174 - x_175)); + param_5 = vec2((x_178 - x_179), (x_181 - x_182)); + let x_186 : f32 = param_4.x; + let x_188 : f32 = param_5.y; + let x_191 : f32 = param_5.x; + let x_193 : f32 = param_4.y; + let x_195 : f32 = ((x_186 * x_188) - (x_191 * x_193)); + x_78 = x_195; + let x_197 : bool = (x_139 && (x_195 < 0.0)); + x_204_phi = x_197; + if (!(x_197)) { + x_203 = ((x_111 >= 0.0) && (x_195 >= 0.0)); + x_204_phi = x_203; + } + let x_204 : bool = x_204_phi; + if (!(x_204)) { + return 0; + } + return 1; +} + +fn main_1() { + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_60 : vec4 = gl_FragCoord; + let x_63 : vec2 = x_19.resolution; + param_6 = (vec2(x_60.x, x_60.y) / x_63); + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_65 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_65 == 1)) { + let x_71 : f32 = x_11.injectionSwitch.y; + let x_73 : f32 = x_11.injectionSwitch.x; + if ((x_71 >= x_73)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl new file mode 100644 index 0000000000..c9e248c547 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl @@ -0,0 +1,181 @@ +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_19 : buf0; + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a : ptr>, b : ptr>, c : ptr>) -> i32 { + var x_78 : f32; + var x_79 : f32; + var x_80 : f32; + var param : vec2; + var param_1 : vec2; + var param_2 : vec2; + var param_3 : vec2; + var param_4 : vec2; + var param_5 : vec2; + var x_147 : bool; + var x_203 : bool; + var x_148_phi : bool; + var x_204_phi : bool; + let x_81 : ptr = &((*(p)).x); + let x_82 : f32 = *(x_81); + let x_83 : ptr = &((*(a)).x); + let x_84 : f32 = *(x_83); + let x_86 : ptr = &((*(p)).y); + let x_87 : f32 = *(x_86); + let x_88 : ptr = &((*(a)).y); + let x_89 : f32 = *(x_88); + let x_92 : ptr = &((*(b)).x); + let x_93 : f32 = *(x_92); + let x_94 : f32 = *(x_83); + let x_96 : ptr = &((*(b)).y); + let x_97 : f32 = *(x_96); + let x_98 : f32 = *(x_88); + param = vec2((x_82 - x_84), (x_87 - x_89)); + param_1 = vec2((x_93 - x_94), (x_97 - x_98)); + let x_102 : f32 = param.x; + let x_104 : f32 = param_1.y; + let x_107 : f32 = param_1.x; + let x_109 : f32 = param.y; + let x_111 : f32 = ((x_102 * x_104) - (x_107 * x_109)); + x_80 = x_111; + let x_112 : f32 = *(x_81); + let x_113 : f32 = *(x_92); + let x_115 : f32 = *(x_86); + let x_116 : f32 = *(x_96); + let x_119 : ptr = &((*(c)).x); + let x_120 : f32 = *(x_119); + let x_121 : f32 = *(x_92); + let x_123 : ptr = &((*(c)).y); + let x_124 : f32 = *(x_123); + let x_125 : f32 = *(x_96); + param_2 = vec2((x_112 - x_113), (x_115 - x_116)); + param_3 = vec2((x_120 - x_121), (x_124 - x_125)); + let x_129 : f32 = param_2.x; + let x_131 : f32 = param_3.y; + let x_134 : f32 = param_3.x; + let x_136 : f32 = param_2.y; + let x_138 : f32 = ((x_129 * x_131) - (x_134 * x_136)); + x_79 = x_138; + let x_139 : bool = (x_111 < 0.0); + let x_141 : bool = (x_139 && (x_138 < 0.0)); + x_148_phi = x_141; + if (!(x_141)) { + x_147 = ((x_111 >= 0.0) && (x_138 >= 0.0)); + x_148_phi = x_147; + } + var x_153_phi : i32; + let x_148 : bool = x_148_phi; + if (!(x_148)) { + x_153_phi = 0; + loop { + var x_154 : i32; + var x_164_phi : i32; + let x_153 : i32 = x_153_phi; + let x_159 : f32 = x_11.injectionSwitch.y; + let x_160 : i32 = i32(x_159); + if ((x_153 < x_160)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + x_164_phi = 0; + loop { + var x_165 : i32; + let x_164 : i32 = x_164_phi; + if ((x_164 < x_160)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + + continuing { + x_165 = (x_164 + 1); + x_164_phi = x_165; + } + } + + continuing { + x_154 = (x_153 + 1); + x_153_phi = x_154; + } + } + return 0; + } + let x_171 : f32 = *(x_81); + let x_172 : f32 = *(x_119); + let x_174 : f32 = *(x_86); + let x_175 : f32 = *(x_123); + let x_178 : f32 = *(x_83); + let x_179 : f32 = *(x_119); + let x_181 : f32 = *(x_88); + let x_182 : f32 = *(x_123); + param_4 = vec2((x_171 - x_172), (x_174 - x_175)); + param_5 = vec2((x_178 - x_179), (x_181 - x_182)); + let x_186 : f32 = param_4.x; + let x_188 : f32 = param_5.y; + let x_191 : f32 = param_5.x; + let x_193 : f32 = param_4.y; + let x_195 : f32 = ((x_186 * x_188) - (x_191 * x_193)); + x_78 = x_195; + let x_197 : bool = (x_139 && (x_195 < 0.0)); + x_204_phi = x_197; + if (!(x_197)) { + x_203 = ((x_111 >= 0.0) && (x_195 >= 0.0)); + x_204_phi = x_203; + } + let x_204 : bool = x_204_phi; + if (!(x_204)) { + return 0; + } + return 1; +} + +fn main_1() { + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_60 : vec4 = gl_FragCoord; + let x_63 : vec2 = x_19.resolution; + param_6 = (vec2(x_60.x, x_60.y) / x_63); + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_65 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_65 == 1)) { + let x_71 : f32 = x_11.injectionSwitch.y; + let x_73 : f32 = x_11.injectionSwitch.x; + if ((x_71 >= x_73)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..1e6b252bb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.hlsl @@ -0,0 +1,183 @@ +cbuffer cbuffer_x_11 : register(b1, space0) { + uint4 x_11[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_19 : register(b0, space0) { + uint4 x_19[1]; +}; + +int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a, inout float2 b, inout float2 c) { + float x_78 = 0.0f; + float x_79 = 0.0f; + float x_80 = 0.0f; + float2 param = float2(0.0f, 0.0f); + float2 param_1 = float2(0.0f, 0.0f); + float2 param_2 = float2(0.0f, 0.0f); + float2 param_3 = float2(0.0f, 0.0f); + float2 param_4 = float2(0.0f, 0.0f); + float2 param_5 = float2(0.0f, 0.0f); + bool x_147 = false; + bool x_203 = false; + bool x_148_phi = false; + bool x_204_phi = false; + const float x_82 = p.x; + const float x_84 = a.x; + const float x_87 = p.y; + const float x_89 = a.y; + const float x_93 = b.x; + const float x_94 = a.x; + const float x_97 = b.y; + const float x_98 = a.y; + param = float2((x_82 - x_84), (x_87 - x_89)); + param_1 = float2((x_93 - x_94), (x_97 - x_98)); + const float x_102 = param.x; + const float x_104 = param_1.y; + const float x_107 = param_1.x; + const float x_109 = param.y; + const float x_111 = ((x_102 * x_104) - (x_107 * x_109)); + x_80 = x_111; + const float x_112 = p.x; + const float x_113 = b.x; + const float x_115 = p.y; + const float x_116 = b.y; + const float x_120 = c.x; + const float x_121 = b.x; + const float x_124 = c.y; + const float x_125 = b.y; + param_2 = float2((x_112 - x_113), (x_115 - x_116)); + param_3 = float2((x_120 - x_121), (x_124 - x_125)); + const float x_129 = param_2.x; + const float x_131 = param_3.y; + const float x_134 = param_3.x; + const float x_136 = param_2.y; + const float x_138 = ((x_129 * x_131) - (x_134 * x_136)); + x_79 = x_138; + const bool x_139 = (x_111 < 0.0f); + bool tint_tmp = x_139; + if (tint_tmp) { + tint_tmp = (x_138 < 0.0f); + } + const bool x_141 = (tint_tmp); + x_148_phi = x_141; + if (!(x_141)) { + bool tint_tmp_1 = (x_111 >= 0.0f); + if (tint_tmp_1) { + tint_tmp_1 = (x_138 >= 0.0f); + } + x_147 = (tint_tmp_1); + x_148_phi = x_147; + } + int x_153_phi = 0; + if (!(x_148_phi)) { + x_153_phi = 0; + while (true) { + int x_154 = 0; + int x_164_phi = 0; + const int x_153 = x_153_phi; + const float x_159 = asfloat(x_11[0].y); + const int x_160 = int(x_159); + if ((x_153 < x_160)) { + } else { + break; + } + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + x_164_phi = 0; + while (true) { + int x_165 = 0; + const int x_164 = x_164_phi; + if ((x_164 < x_160)) { + } else { + break; + } + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + { + x_165 = (x_164 + 1); + x_164_phi = x_165; + } + } + { + x_154 = (x_153 + 1); + x_153_phi = x_154; + } + } + return 0; + } + const float x_171 = p.x; + const float x_172 = c.x; + const float x_174 = p.y; + const float x_175 = c.y; + const float x_178 = a.x; + const float x_179 = c.x; + const float x_181 = a.y; + const float x_182 = c.y; + param_4 = float2((x_171 - x_172), (x_174 - x_175)); + param_5 = float2((x_178 - x_179), (x_181 - x_182)); + const float x_186 = param_4.x; + const float x_188 = param_5.y; + const float x_191 = param_5.x; + const float x_193 = param_4.y; + const float x_195 = ((x_186 * x_188) - (x_191 * x_193)); + x_78 = x_195; + bool tint_tmp_2 = x_139; + if (tint_tmp_2) { + tint_tmp_2 = (x_195 < 0.0f); + } + const bool x_197 = (tint_tmp_2); + x_204_phi = x_197; + if (!(x_197)) { + bool tint_tmp_3 = (x_111 >= 0.0f); + if (tint_tmp_3) { + tint_tmp_3 = (x_195 >= 0.0f); + } + x_203 = (tint_tmp_3); + x_204_phi = x_203; + } + if (!(x_204_phi)) { + return 0; + } + return 1; +} + +void main_1() { + float2 param_6 = float2(0.0f, 0.0f); + float2 param_7 = float2(0.0f, 0.0f); + float2 param_8 = float2(0.0f, 0.0f); + float2 param_9 = float2(0.0f, 0.0f); + const float4 x_60 = gl_FragCoord; + const float2 x_63 = asfloat(x_19[0].xy); + param_6 = (float2(x_60.x, x_60.y) / x_63); + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + const int x_65 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9); + if ((x_65 == 1)) { + const float x_71 = asfloat(x_11[0].y); + const float x_73 = asfloat(x_11[0].x); + if ((x_71 >= x_73)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.msl new file mode 100644 index 0000000000..6537e89975 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.msl @@ -0,0 +1,168 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf0 { + /* 0x0000 */ packed_float2 resolution; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int pointInTriangle_vf2_vf2_vf2_vf2_(constant buf1& x_11, thread float2* const p, thread float2* const a, thread float2* const b, thread float2* const c, thread float4* const tint_symbol_5) { + float x_78 = 0.0f; + float x_79 = 0.0f; + float x_80 = 0.0f; + float2 param = 0.0f; + float2 param_1 = 0.0f; + float2 param_2 = 0.0f; + float2 param_3 = 0.0f; + float2 param_4 = 0.0f; + float2 param_5 = 0.0f; + bool x_147 = false; + bool x_203 = false; + bool x_148_phi = false; + bool x_204_phi = false; + float const x_82 = (*(p)).x; + float const x_84 = (*(a)).x; + float const x_87 = (*(p)).y; + float const x_89 = (*(a)).y; + float const x_93 = (*(b)).x; + float const x_94 = (*(a)).x; + float const x_97 = (*(b)).y; + float const x_98 = (*(a)).y; + param = float2((x_82 - x_84), (x_87 - x_89)); + param_1 = float2((x_93 - x_94), (x_97 - x_98)); + float const x_102 = param.x; + float const x_104 = param_1.y; + float const x_107 = param_1.x; + float const x_109 = param.y; + float const x_111 = ((x_102 * x_104) - (x_107 * x_109)); + x_80 = x_111; + float const x_112 = (*(p)).x; + float const x_113 = (*(b)).x; + float const x_115 = (*(p)).y; + float const x_116 = (*(b)).y; + float const x_120 = (*(c)).x; + float const x_121 = (*(b)).x; + float const x_124 = (*(c)).y; + float const x_125 = (*(b)).y; + param_2 = float2((x_112 - x_113), (x_115 - x_116)); + param_3 = float2((x_120 - x_121), (x_124 - x_125)); + float const x_129 = param_2.x; + float const x_131 = param_3.y; + float const x_134 = param_3.x; + float const x_136 = param_2.y; + float const x_138 = ((x_129 * x_131) - (x_134 * x_136)); + x_79 = x_138; + bool const x_139 = (x_111 < 0.0f); + bool const x_141 = (x_139 && (x_138 < 0.0f)); + x_148_phi = x_141; + if (!(x_141)) { + x_147 = ((x_111 >= 0.0f) && (x_138 >= 0.0f)); + x_148_phi = x_147; + } + int x_153_phi = 0; + bool const x_148 = x_148_phi; + if (!(x_148)) { + x_153_phi = 0; + while (true) { + int x_154 = 0; + int x_164_phi = 0; + int const x_153 = x_153_phi; + float const x_159 = x_11.injectionSwitch.y; + int const x_160 = int(x_159); + if ((x_153 < x_160)) { + } else { + break; + } + *(tint_symbol_5) = float4(1.0f, 1.0f, 1.0f, 1.0f); + x_164_phi = 0; + while (true) { + int x_165 = 0; + int const x_164 = x_164_phi; + if ((x_164 < x_160)) { + } else { + break; + } + *(tint_symbol_5) = float4(1.0f, 1.0f, 1.0f, 1.0f); + { + x_165 = (x_164 + 1); + x_164_phi = x_165; + } + } + { + x_154 = (x_153 + 1); + x_153_phi = x_154; + } + } + return 0; + } + float const x_171 = (*(p)).x; + float const x_172 = (*(c)).x; + float const x_174 = (*(p)).y; + float const x_175 = (*(c)).y; + float const x_178 = (*(a)).x; + float const x_179 = (*(c)).x; + float const x_181 = (*(a)).y; + float const x_182 = (*(c)).y; + param_4 = float2((x_171 - x_172), (x_174 - x_175)); + param_5 = float2((x_178 - x_179), (x_181 - x_182)); + float const x_186 = param_4.x; + float const x_188 = param_5.y; + float const x_191 = param_5.x; + float const x_193 = param_4.y; + float const x_195 = ((x_186 * x_188) - (x_191 * x_193)); + x_78 = x_195; + bool const x_197 = (x_139 && (x_195 < 0.0f)); + x_204_phi = x_197; + if (!(x_197)) { + x_203 = ((x_111 >= 0.0f) && (x_195 >= 0.0f)); + x_204_phi = x_203; + } + bool const x_204 = x_204_phi; + if (!(x_204)) { + return 0; + } + return 1; +} + +void main_1(constant buf0& x_19, constant buf1& x_11, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float2 param_6 = 0.0f; + float2 param_7 = 0.0f; + float2 param_8 = 0.0f; + float2 param_9 = 0.0f; + float4 const x_60 = *(tint_symbol_6); + float2 const x_63 = x_19.resolution; + param_6 = (float2(x_60.x, x_60.y) / x_63); + param_7 = float2(0.699999988f, 0.300000012f); + param_8 = float2(0.5f, 0.899999976f); + param_9 = float2(0.100000001f, 0.400000006f); + int const x_65 = pointInTriangle_vf2_vf2_vf2_vf2_(x_11, &(param_6), &(param_7), &(param_8), &(param_9), tint_symbol_7); + if ((x_65 == 1)) { + float const x_71 = x_11.injectionSwitch.y; + float const x_73 = x_11.injectionSwitch.x; + if ((x_71 >= x_73)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_19 [[buffer(0)]], constant buf1& x_11 [[buffer(1)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_19, x_11, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e4e6fce17 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.spvasm @@ -0,0 +1,423 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 300 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_11 "x_11" + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %x_19 "x_19" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_" + OpName %p "p" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %x_78 "x_78" + OpName %x_79 "x_79" + OpName %x_80 "x_80" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %param_4 "param_4" + OpName %param_5 "param_5" + OpName %x_147 "x_147" + OpName %x_203 "x_203" + OpName %x_148_phi "x_148_phi" + OpName %x_204_phi "x_204_phi" + OpName %x_153_phi "x_153_phi" + OpName %x_154 "x_154" + OpName %x_164_phi "x_164_phi" + OpName %x_165 "x_165" + OpName %main_1 "main_1" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_11 NonWritable + OpDecorate %x_11 DescriptorSet 0 + OpDecorate %x_11 Binding 1 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_19 NonWritable + OpDecorate %x_19 DescriptorSet 0 + OpDecorate %x_19 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_11 = OpVariable %_ptr_Uniform_buf1 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_19 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %int = OpTypeInt 32 1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float +%_ptr_Function_float = OpTypePointer Function %float + %29 = OpConstantNull %float + %33 = OpConstantNull %v2float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %42 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 +%_ptr_Function_int = OpTypePointer Function %int + %148 = OpConstantNull %int + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %170 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %244 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%float_0_699999988 = OpConstant %float 0.699999988 +%float_0_300000012 = OpConstant %float 0.300000012 + %262 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012 + %float_0_5 = OpConstant %float 0.5 +%float_0_899999976 = OpConstant %float 0.899999976 + %265 = OpConstantComposite %v2float %float_0_5 %float_0_899999976 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_400000006 = OpConstant %float 0.400000006 + %268 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006 + %285 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %286 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %287 = OpTypeFunction %void %main_out +%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %18 + %p = OpFunctionParameter %_ptr_Function_v2float + %a = OpFunctionParameter %_ptr_Function_v2float + %b = OpFunctionParameter %_ptr_Function_v2float + %c = OpFunctionParameter %_ptr_Function_v2float + %26 = OpLabel + %x_78 = OpVariable %_ptr_Function_float Function %29 + %x_79 = OpVariable %_ptr_Function_float Function %29 + %x_80 = OpVariable %_ptr_Function_float Function %29 + %param = OpVariable %_ptr_Function_v2float Function %33 + %param_1 = OpVariable %_ptr_Function_v2float Function %33 + %param_2 = OpVariable %_ptr_Function_v2float Function %33 + %param_3 = OpVariable %_ptr_Function_v2float Function %33 + %param_4 = OpVariable %_ptr_Function_v2float Function %33 + %param_5 = OpVariable %_ptr_Function_v2float Function %33 + %x_147 = OpVariable %_ptr_Function_bool Function %42 + %x_203 = OpVariable %_ptr_Function_bool Function %42 + %x_148_phi = OpVariable %_ptr_Function_bool Function %42 + %x_204_phi = OpVariable %_ptr_Function_bool Function %42 + %x_153_phi = OpVariable %_ptr_Function_int Function %148 + %x_154 = OpVariable %_ptr_Function_int Function %148 + %x_164_phi = OpVariable %_ptr_Function_int Function %148 + %x_165 = OpVariable %_ptr_Function_int Function %148 + %49 = OpAccessChain %_ptr_Function_float %p %uint_0 + %50 = OpLoad %float %49 + %52 = OpAccessChain %_ptr_Function_float %a %uint_0 + %53 = OpLoad %float %52 + %56 = OpAccessChain %_ptr_Function_float %p %uint_1 + %57 = OpLoad %float %56 + %59 = OpAccessChain %_ptr_Function_float %a %uint_1 + %60 = OpLoad %float %59 + %62 = OpAccessChain %_ptr_Function_float %b %uint_0 + %63 = OpLoad %float %62 + %65 = OpAccessChain %_ptr_Function_float %a %uint_0 + %66 = OpLoad %float %65 + %68 = OpAccessChain %_ptr_Function_float %b %uint_1 + %69 = OpLoad %float %68 + %71 = OpAccessChain %_ptr_Function_float %a %uint_1 + %72 = OpLoad %float %71 + %73 = OpFSub %float %50 %53 + %74 = OpFSub %float %57 %60 + %75 = OpCompositeConstruct %v2float %73 %74 + OpStore %param %75 + %76 = OpFSub %float %63 %66 + %77 = OpFSub %float %69 %72 + %78 = OpCompositeConstruct %v2float %76 %77 + OpStore %param_1 %78 + %79 = OpAccessChain %_ptr_Function_float %param %uint_0 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Function_float %param_1 %uint_1 + %82 = OpLoad %float %81 + %83 = OpAccessChain %_ptr_Function_float %param_1 %uint_0 + %84 = OpLoad %float %83 + %85 = OpAccessChain %_ptr_Function_float %param %uint_1 + %86 = OpLoad %float %85 + %87 = OpFMul %float %80 %82 + %88 = OpFMul %float %84 %86 + %89 = OpFSub %float %87 %88 + OpStore %x_80 %89 + %91 = OpAccessChain %_ptr_Function_float %p %uint_0 + %92 = OpLoad %float %91 + %94 = OpAccessChain %_ptr_Function_float %b %uint_0 + %95 = OpLoad %float %94 + %97 = OpAccessChain %_ptr_Function_float %p %uint_1 + %98 = OpLoad %float %97 + %100 = OpAccessChain %_ptr_Function_float %b %uint_1 + %101 = OpLoad %float %100 + %103 = OpAccessChain %_ptr_Function_float %c %uint_0 + %104 = OpLoad %float %103 + %106 = OpAccessChain %_ptr_Function_float %b %uint_0 + %107 = OpLoad %float %106 + %109 = OpAccessChain %_ptr_Function_float %c %uint_1 + %110 = OpLoad %float %109 + %112 = OpAccessChain %_ptr_Function_float %b %uint_1 + %113 = OpLoad %float %112 + %114 = OpFSub %float %92 %95 + %115 = OpFSub %float %98 %101 + %116 = OpCompositeConstruct %v2float %114 %115 + OpStore %param_2 %116 + %117 = OpFSub %float %104 %107 + %118 = OpFSub %float %110 %113 + %119 = OpCompositeConstruct %v2float %117 %118 + OpStore %param_3 %119 + %120 = OpAccessChain %_ptr_Function_float %param_2 %uint_0 + %121 = OpLoad %float %120 + %122 = OpAccessChain %_ptr_Function_float %param_3 %uint_1 + %123 = OpLoad %float %122 + %124 = OpAccessChain %_ptr_Function_float %param_3 %uint_0 + %125 = OpLoad %float %124 + %126 = OpAccessChain %_ptr_Function_float %param_2 %uint_1 + %127 = OpLoad %float %126 + %128 = OpFMul %float %121 %123 + %129 = OpFMul %float %125 %127 + %130 = OpFSub %float %128 %129 + OpStore %x_79 %130 + %132 = OpFOrdLessThan %bool %89 %float_0 + OpSelectionMerge %133 None + OpBranchConditional %132 %134 %133 + %134 = OpLabel + %135 = OpFOrdLessThan %bool %130 %float_0 + OpBranch %133 + %133 = OpLabel + %136 = OpPhi %bool %132 %26 %135 %134 + OpStore %x_148_phi %136 + %137 = OpLogicalNot %bool %136 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %138 + %139 = OpLabel + %140 = OpFOrdGreaterThanEqual %bool %89 %float_0 + OpSelectionMerge %141 None + OpBranchConditional %140 %142 %141 + %142 = OpLabel + %143 = OpFOrdGreaterThanEqual %bool %130 %float_0 + OpBranch %141 + %141 = OpLabel + %144 = OpPhi %bool %140 %139 %143 %142 + OpStore %x_147 %144 + %145 = OpLoad %bool %x_147 + OpStore %x_148_phi %145 + OpBranch %138 + %138 = OpLabel + %149 = OpLoad %bool %x_148_phi + %150 = OpLogicalNot %bool %149 + OpSelectionMerge %151 None + OpBranchConditional %150 %152 %151 + %152 = OpLabel + OpStore %x_153_phi %int_0 + OpBranch %154 + %154 = OpLabel + OpLoopMerge %155 %156 None + OpBranch %157 + %157 = OpLabel + %160 = OpLoad %int %x_153_phi + %162 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_1 + %163 = OpLoad %float %162 + %164 = OpConvertFToS %int %163 + %165 = OpSLessThan %bool %160 %164 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %168 + %167 = OpLabel + OpBranch %166 + %168 = OpLabel + OpBranch %155 + %166 = OpLabel + OpStore %x_GLF_color %170 + OpStore %x_164_phi %int_0 + OpBranch %171 + %171 = OpLabel + OpLoopMerge %172 %173 None + OpBranch %174 + %174 = OpLabel + %176 = OpLoad %int %x_164_phi + %177 = OpSLessThan %bool %176 %164 + OpSelectionMerge %178 None + OpBranchConditional %177 %179 %180 + %179 = OpLabel + OpBranch %178 + %180 = OpLabel + OpBranch %172 + %178 = OpLabel + OpStore %x_GLF_color %170 + OpBranch %173 + %173 = OpLabel + %182 = OpIAdd %int %176 %int_1 + OpStore %x_165 %182 + %183 = OpLoad %int %x_165 + OpStore %x_164_phi %183 + OpBranch %171 + %172 = OpLabel + OpBranch %156 + %156 = OpLabel + %184 = OpIAdd %int %160 %int_1 + OpStore %x_154 %184 + %185 = OpLoad %int %x_154 + OpStore %x_153_phi %185 + OpBranch %154 + %155 = OpLabel + OpReturnValue %int_0 + %151 = OpLabel + %187 = OpAccessChain %_ptr_Function_float %p %uint_0 + %188 = OpLoad %float %187 + %190 = OpAccessChain %_ptr_Function_float %c %uint_0 + %191 = OpLoad %float %190 + %193 = OpAccessChain %_ptr_Function_float %p %uint_1 + %194 = OpLoad %float %193 + %196 = OpAccessChain %_ptr_Function_float %c %uint_1 + %197 = OpLoad %float %196 + %199 = OpAccessChain %_ptr_Function_float %a %uint_0 + %200 = OpLoad %float %199 + %202 = OpAccessChain %_ptr_Function_float %c %uint_0 + %203 = OpLoad %float %202 + %205 = OpAccessChain %_ptr_Function_float %a %uint_1 + %206 = OpLoad %float %205 + %208 = OpAccessChain %_ptr_Function_float %c %uint_1 + %209 = OpLoad %float %208 + %210 = OpFSub %float %188 %191 + %211 = OpFSub %float %194 %197 + %212 = OpCompositeConstruct %v2float %210 %211 + OpStore %param_4 %212 + %213 = OpFSub %float %200 %203 + %214 = OpFSub %float %206 %209 + %215 = OpCompositeConstruct %v2float %213 %214 + OpStore %param_5 %215 + %216 = OpAccessChain %_ptr_Function_float %param_4 %uint_0 + %217 = OpLoad %float %216 + %218 = OpAccessChain %_ptr_Function_float %param_5 %uint_1 + %219 = OpLoad %float %218 + %220 = OpAccessChain %_ptr_Function_float %param_5 %uint_0 + %221 = OpLoad %float %220 + %222 = OpAccessChain %_ptr_Function_float %param_4 %uint_1 + %223 = OpLoad %float %222 + %224 = OpFMul %float %217 %219 + %225 = OpFMul %float %221 %223 + %226 = OpFSub %float %224 %225 + OpStore %x_78 %226 + OpSelectionMerge %227 None + OpBranchConditional %132 %228 %227 + %228 = OpLabel + %229 = OpFOrdLessThan %bool %226 %float_0 + OpBranch %227 + %227 = OpLabel + %230 = OpPhi %bool %132 %151 %229 %228 + OpStore %x_204_phi %230 + %231 = OpLogicalNot %bool %230 + OpSelectionMerge %232 None + OpBranchConditional %231 %233 %232 + %233 = OpLabel + %234 = OpFOrdGreaterThanEqual %bool %89 %float_0 + OpSelectionMerge %235 None + OpBranchConditional %234 %236 %235 + %236 = OpLabel + %237 = OpFOrdGreaterThanEqual %bool %226 %float_0 + OpBranch %235 + %235 = OpLabel + %238 = OpPhi %bool %234 %233 %237 %236 + OpStore %x_203 %238 + %239 = OpLoad %bool %x_203 + OpStore %x_204_phi %239 + OpBranch %232 + %232 = OpLabel + %240 = OpLoad %bool %x_204_phi + %241 = OpLogicalNot %bool %240 + OpSelectionMerge %242 None + OpBranchConditional %241 %243 %242 + %243 = OpLabel + OpReturnValue %int_0 + %242 = OpLabel + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %244 + %247 = OpLabel + %param_6 = OpVariable %_ptr_Function_v2float Function %33 + %param_7 = OpVariable %_ptr_Function_v2float Function %33 + %param_8 = OpVariable %_ptr_Function_v2float Function %33 + %param_9 = OpVariable %_ptr_Function_v2float Function %33 + %252 = OpLoad %v4float %gl_FragCoord + %254 = OpAccessChain %_ptr_Uniform_v2float %x_19 %uint_0 + %255 = OpLoad %v2float %254 + %256 = OpCompositeExtract %float %252 0 + %257 = OpCompositeExtract %float %252 1 + %258 = OpCompositeConstruct %v2float %256 %257 + %259 = OpFDiv %v2float %258 %255 + OpStore %param_6 %259 + OpStore %param_7 %262 + OpStore %param_8 %265 + OpStore %param_9 %268 + %269 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9 + %274 = OpIEqual %bool %269 %int_1 + OpSelectionMerge %275 None + OpBranchConditional %274 %276 %277 + %276 = OpLabel + %278 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_1 + %279 = OpLoad %float %278 + %280 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_0 + %281 = OpLoad %float %280 + %282 = OpFOrdGreaterThanEqual %bool %279 %281 + OpSelectionMerge %283 None + OpBranchConditional %282 %284 %283 + %284 = OpLabel + OpStore %x_GLF_color %285 + OpBranch %283 + %283 = OpLabel + OpBranch %275 + %277 = OpLabel + OpStore %x_GLF_color %286 + OpBranch %275 + %275 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %287 +%tint_symbol_1 = OpFunctionParameter %main_out + %291 = OpLabel + %292 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %292 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %244 + %294 = OpLabel + %295 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %295 + %296 = OpFunctionCall %void %main_1 + %298 = OpLoad %v4float %x_GLF_color + %299 = OpCompositeConstruct %main_out %298 + %297 = OpFunctionCall %void %tint_symbol_3 %299 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..c9e248c547 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/stable-triangle-nested-for-loop-and-true-if/1.wgsl.expected.wgsl @@ -0,0 +1,181 @@ +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf0 { + resolution : vec2; +}; + +[[group(0), binding(1)]] var x_11 : buf1; + +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_19 : buf0; + +fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr>, a : ptr>, b : ptr>, c : ptr>) -> i32 { + var x_78 : f32; + var x_79 : f32; + var x_80 : f32; + var param : vec2; + var param_1 : vec2; + var param_2 : vec2; + var param_3 : vec2; + var param_4 : vec2; + var param_5 : vec2; + var x_147 : bool; + var x_203 : bool; + var x_148_phi : bool; + var x_204_phi : bool; + let x_81 : ptr = &((*(p)).x); + let x_82 : f32 = *(x_81); + let x_83 : ptr = &((*(a)).x); + let x_84 : f32 = *(x_83); + let x_86 : ptr = &((*(p)).y); + let x_87 : f32 = *(x_86); + let x_88 : ptr = &((*(a)).y); + let x_89 : f32 = *(x_88); + let x_92 : ptr = &((*(b)).x); + let x_93 : f32 = *(x_92); + let x_94 : f32 = *(x_83); + let x_96 : ptr = &((*(b)).y); + let x_97 : f32 = *(x_96); + let x_98 : f32 = *(x_88); + param = vec2((x_82 - x_84), (x_87 - x_89)); + param_1 = vec2((x_93 - x_94), (x_97 - x_98)); + let x_102 : f32 = param.x; + let x_104 : f32 = param_1.y; + let x_107 : f32 = param_1.x; + let x_109 : f32 = param.y; + let x_111 : f32 = ((x_102 * x_104) - (x_107 * x_109)); + x_80 = x_111; + let x_112 : f32 = *(x_81); + let x_113 : f32 = *(x_92); + let x_115 : f32 = *(x_86); + let x_116 : f32 = *(x_96); + let x_119 : ptr = &((*(c)).x); + let x_120 : f32 = *(x_119); + let x_121 : f32 = *(x_92); + let x_123 : ptr = &((*(c)).y); + let x_124 : f32 = *(x_123); + let x_125 : f32 = *(x_96); + param_2 = vec2((x_112 - x_113), (x_115 - x_116)); + param_3 = vec2((x_120 - x_121), (x_124 - x_125)); + let x_129 : f32 = param_2.x; + let x_131 : f32 = param_3.y; + let x_134 : f32 = param_3.x; + let x_136 : f32 = param_2.y; + let x_138 : f32 = ((x_129 * x_131) - (x_134 * x_136)); + x_79 = x_138; + let x_139 : bool = (x_111 < 0.0); + let x_141 : bool = (x_139 && (x_138 < 0.0)); + x_148_phi = x_141; + if (!(x_141)) { + x_147 = ((x_111 >= 0.0) && (x_138 >= 0.0)); + x_148_phi = x_147; + } + var x_153_phi : i32; + let x_148 : bool = x_148_phi; + if (!(x_148)) { + x_153_phi = 0; + loop { + var x_154 : i32; + var x_164_phi : i32; + let x_153 : i32 = x_153_phi; + let x_159 : f32 = x_11.injectionSwitch.y; + let x_160 : i32 = i32(x_159); + if ((x_153 < x_160)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + x_164_phi = 0; + loop { + var x_165 : i32; + let x_164 : i32 = x_164_phi; + if ((x_164 < x_160)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + + continuing { + x_165 = (x_164 + 1); + x_164_phi = x_165; + } + } + + continuing { + x_154 = (x_153 + 1); + x_153_phi = x_154; + } + } + return 0; + } + let x_171 : f32 = *(x_81); + let x_172 : f32 = *(x_119); + let x_174 : f32 = *(x_86); + let x_175 : f32 = *(x_123); + let x_178 : f32 = *(x_83); + let x_179 : f32 = *(x_119); + let x_181 : f32 = *(x_88); + let x_182 : f32 = *(x_123); + param_4 = vec2((x_171 - x_172), (x_174 - x_175)); + param_5 = vec2((x_178 - x_179), (x_181 - x_182)); + let x_186 : f32 = param_4.x; + let x_188 : f32 = param_5.y; + let x_191 : f32 = param_5.x; + let x_193 : f32 = param_4.y; + let x_195 : f32 = ((x_186 * x_188) - (x_191 * x_193)); + x_78 = x_195; + let x_197 : bool = (x_139 && (x_195 < 0.0)); + x_204_phi = x_197; + if (!(x_197)) { + x_203 = ((x_111 >= 0.0) && (x_195 >= 0.0)); + x_204_phi = x_203; + } + let x_204 : bool = x_204_phi; + if (!(x_204)) { + return 0; + } + return 1; +} + +fn main_1() { + var param_6 : vec2; + var param_7 : vec2; + var param_8 : vec2; + var param_9 : vec2; + let x_60 : vec4 = gl_FragCoord; + let x_63 : vec2 = x_19.resolution; + param_6 = (vec2(x_60.x, x_60.y) / x_63); + param_7 = vec2(0.699999988, 0.300000012); + param_8 = vec2(0.5, 0.899999976); + param_9 = vec2(0.100000001, 0.400000006); + let x_65 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9)); + if ((x_65 == 1)) { + let x_71 : f32 = x_11.injectionSwitch.y; + let x_73 : f32 = x_11.injectionSwitch.x; + if ((x_71 >= x_73)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm new file mode 100644 index 0000000000..cca8b7aacd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm @@ -0,0 +1,89 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %makeTreeNode_struct_BST_i1_i1_i11_ "makeTreeNode(struct-BST-i1-i1-i11;" + OpName %tree "tree" + OpName %tree_0 "tree" + OpName %param "param" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %BST 0 RelaxedPrecision + OpMemberDecorate %BST 1 RelaxedPrecision + OpMemberDecorate %BST 2 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int +%_ptr_Function_BST = OpTypePointer Function %BST + %17 = OpTypeFunction %void %_ptr_Function_BST + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %int_0 = OpConstant %int 0 +%_ptr_Private_BST = OpTypePointer Private %BST +%_ptr_Private_int = OpTypePointer Private %int + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 +%_ptr_Function__arr_BST_uint_10 = OpTypePointer Function %_arr_BST_uint_10 + %main = OpFunction %void None %14 + %36 = OpLabel + %tree_0 = OpVariable %_ptr_Function__arr_BST_uint_10 Function + %param = OpVariable %_ptr_Function_BST Function + %37 = OpLoad %_arr_BST_uint_10 %tree_0 + %38 = OpCompositeExtract %BST %37 0 + OpStore %param %38 + %39 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_ %param + %40 = OpLoad %BST %param + %41 = OpLoad %_arr_BST_uint_10 %tree_0 + %42 = OpCompositeInsert %_arr_BST_uint_10 %40 %41 0 + OpStore %tree_0 %42 + %43 = OpAccessChain %_ptr_Function_int %tree_0 %int_0 %int_2 + %11 = OpLoad %_arr_BST_uint_10 %tree_0 + %9 = OpCompositeExtract %int %11 0 2 + %44 = OpIEqual %bool %9 %int_0 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %47 None + OpBranch %47 + %48 = OpLabel + OpUnreachable + %45 = OpLabel + %12 = OpLoad %_arr_BST_uint_10 %tree_0 + %10 = OpCompositeExtract %int %12 0 2 + %49 = OpConvertSToF %float %10 + %50 = OpCompositeConstruct %v4float %49 %float_0 %float_0 %float_1 + OpStore %_GLF_color %50 + OpReturn + OpFunctionEnd +%makeTreeNode_struct_BST_i1_i1_i11_ = OpFunction %void None %17 + %tree = OpFunctionParameter %_ptr_Function_BST + %51 = OpLabel + %52 = OpAccessChain %_ptr_Function_int %tree %int_2 + OpStore %52 %int_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..f6f974f7fc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.hlsl @@ -0,0 +1,44 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_(inout BST tree) { + tree.rightIndex = 1; + return; +} + +void main_1() { + BST tree_1[10] = (BST[10])0; + BST param = (BST)0; + param = tree_1[0u]; + makeTreeNode_struct_BST_i1_i1_i11_(param); + const BST x_40 = param; + BST x_42_1[10] = tree_1; + x_42_1[0u] = x_40; + tree_1 = x_42_1; + if ((tree_1[0u].rightIndex == 0)) { + while (true) { + } + return; + } + x_GLF_color = float4(float(tree_1[0u].rightIndex), 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.msl new file mode 100644 index 0000000000..0c4598037d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_(thread BST* const tree) { + (*(tree)).rightIndex = 1; + return; +} + +void main_1(thread float4* const tint_symbol_4) { + tint_array_wrapper tree_1 = {}; + BST param = {}; + tint_array_wrapper const x_37 = tree_1; + param = x_37.arr[0u]; + makeTreeNode_struct_BST_i1_i1_i11_(&(param)); + BST const x_40 = param; + tint_array_wrapper const x_41 = tree_1; + tint_array_wrapper x_42_1 = x_41; + x_42_1.arr[0u] = x_40; + tint_array_wrapper const x_42 = x_42_1; + tree_1 = x_42; + tint_array_wrapper const x_11 = tree_1; + if ((x_11.arr[0u].rightIndex == 0)) { + while (true) { + } + return; + } + tint_array_wrapper const x_12 = tree_1; + *(tint_symbol_4) = float4(float(x_12.arr[0u].rightIndex), 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..902b81dd3b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %makeTreeNode_struct_BST_i1_i1_i11_ "makeTreeNode_struct_BST_i1_i1_i11_" + OpName %tree "tree" + OpName %main_1 "main_1" + OpName %tree_1 "tree_1" + OpName %param "param" + OpName %x_42_1 "x_42_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int +%_ptr_Function_BST = OpTypePointer Function %BST + %8 = OpTypeFunction %void %_ptr_Function_BST + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %22 = OpTypeFunction %void + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Function__arr_BST_uint_10 = OpTypePointer Function %_arr_BST_uint_10 + %29 = OpConstantNull %_arr_BST_uint_10 + %31 = OpConstantNull %BST + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %61 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_ = OpFunction %void None %8 + %tree = OpFunctionParameter %_ptr_Function_BST + %15 = OpLabel + %20 = OpAccessChain %_ptr_Function_int %tree %uint_2 + OpStore %20 %int_1 + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %22 + %24 = OpLabel + %tree_1 = OpVariable %_ptr_Function__arr_BST_uint_10 Function %29 + %param = OpVariable %_ptr_Function_BST Function %31 + %x_42_1 = OpVariable %_ptr_Function__arr_BST_uint_10 Function %29 + %32 = OpLoad %_arr_BST_uint_10 %tree_1 + %34 = OpCompositeExtract %BST %32 0 + OpStore %param %34 + %35 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_ %param + %37 = OpLoad %BST %param + %38 = OpLoad %_arr_BST_uint_10 %tree_1 + OpStore %x_42_1 %38 + %40 = OpAccessChain %_ptr_Function_BST %x_42_1 %uint_0 + OpStore %40 %37 + %41 = OpLoad %_arr_BST_uint_10 %x_42_1 + OpStore %tree_1 %41 + %42 = OpLoad %_arr_BST_uint_10 %tree_1 + %43 = OpCompositeExtract %BST %42 0 + %44 = OpCompositeExtract %int %43 2 + %46 = OpIEqual %bool %44 %int_0 + OpSelectionMerge %48 None + OpBranchConditional %46 %49 %48 + %49 = OpLabel + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + OpBranch %52 + %52 = OpLabel + OpBranch %50 + %51 = OpLabel + OpReturn + %48 = OpLabel + %54 = OpLoad %_arr_BST_uint_10 %tree_1 + %56 = OpCompositeExtract %BST %54 0 + %57 = OpCompositeExtract %int %56 2 + %55 = OpConvertSToF %float %57 + %60 = OpCompositeConstruct %v4float %55 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %60 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %61 +%tint_symbol = OpFunctionParameter %main_out + %65 = OpLabel + %66 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %66 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %68 = OpLabel + %69 = OpFunctionCall %void %main_1 + %71 = OpLoad %v4float %x_GLF_color + %72 = OpCompositeConstruct %main_out %71 + %70 = OpFunctionCall %void %tint_symbol_2 %72 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..974581d65a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.spvasm.expected.wgsl @@ -0,0 +1,47 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_(tree : ptr) { + (*(tree)).rightIndex = 1; + return; +} + +fn main_1() { + var tree_1 : array; + var param : BST; + let x_37 : array = tree_1; + param = x_37[0u]; + makeTreeNode_struct_BST_i1_i1_i11_(&(param)); + let x_40 : BST = param; + let x_41 : array = tree_1; + var x_42_1 : array = x_41; + x_42_1[0u] = x_40; + let x_42 : array = x_42_1; + tree_1 = x_42; + let x_43 : ptr = &(tree_1[0].rightIndex); + let x_11 : array = tree_1; + if ((x_11[0u].rightIndex == 0)) { + loop { + } + return; + } + let x_12 : array = tree_1; + x_GLF_color = vec4(f32(x_12[0u].rightIndex), 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl new file mode 100644 index 0000000000..974581d65a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl @@ -0,0 +1,47 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_(tree : ptr) { + (*(tree)).rightIndex = 1; + return; +} + +fn main_1() { + var tree_1 : array; + var param : BST; + let x_37 : array = tree_1; + param = x_37[0u]; + makeTreeNode_struct_BST_i1_i1_i11_(&(param)); + let x_40 : BST = param; + let x_41 : array = tree_1; + var x_42_1 : array = x_41; + x_42_1[0u] = x_40; + let x_42 : array = x_42_1; + tree_1 = x_42; + let x_43 : ptr = &(tree_1[0].rightIndex); + let x_11 : array = tree_1; + if ((x_11[0u].rightIndex == 0)) { + loop { + } + return; + } + let x_12 : array = tree_1; + x_GLF_color = vec4(f32(x_12[0u].rightIndex), 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..f6f974f7fc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.hlsl @@ -0,0 +1,44 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_(inout BST tree) { + tree.rightIndex = 1; + return; +} + +void main_1() { + BST tree_1[10] = (BST[10])0; + BST param = (BST)0; + param = tree_1[0u]; + makeTreeNode_struct_BST_i1_i1_i11_(param); + const BST x_40 = param; + BST x_42_1[10] = tree_1; + x_42_1[0u] = x_40; + tree_1 = x_42_1; + if ((tree_1[0u].rightIndex == 0)) { + while (true) { + } + return; + } + x_GLF_color = float4(float(tree_1[0u].rightIndex), 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.msl new file mode 100644 index 0000000000..0c4598037d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct tint_array_wrapper { + BST arr[10]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_(thread BST* const tree) { + (*(tree)).rightIndex = 1; + return; +} + +void main_1(thread float4* const tint_symbol_4) { + tint_array_wrapper tree_1 = {}; + BST param = {}; + tint_array_wrapper const x_37 = tree_1; + param = x_37.arr[0u]; + makeTreeNode_struct_BST_i1_i1_i11_(&(param)); + BST const x_40 = param; + tint_array_wrapper const x_41 = tree_1; + tint_array_wrapper x_42_1 = x_41; + x_42_1.arr[0u] = x_40; + tint_array_wrapper const x_42 = x_42_1; + tree_1 = x_42; + tint_array_wrapper const x_11 = tree_1; + if ((x_11.arr[0u].rightIndex == 0)) { + while (true) { + } + return; + } + tint_array_wrapper const x_12 = tree_1; + *(tint_symbol_4) = float4(float(x_12.arr[0u].rightIndex), 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..902b81dd3b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %makeTreeNode_struct_BST_i1_i1_i11_ "makeTreeNode_struct_BST_i1_i1_i11_" + OpName %tree "tree" + OpName %main_1 "main_1" + OpName %tree_1 "tree_1" + OpName %param "param" + OpName %x_42_1 "x_42_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int +%_ptr_Function_BST = OpTypePointer Function %BST + %8 = OpTypeFunction %void %_ptr_Function_BST + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %22 = OpTypeFunction %void + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Function__arr_BST_uint_10 = OpTypePointer Function %_arr_BST_uint_10 + %29 = OpConstantNull %_arr_BST_uint_10 + %31 = OpConstantNull %BST + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %61 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_ = OpFunction %void None %8 + %tree = OpFunctionParameter %_ptr_Function_BST + %15 = OpLabel + %20 = OpAccessChain %_ptr_Function_int %tree %uint_2 + OpStore %20 %int_1 + OpReturn + OpFunctionEnd + %main_1 = OpFunction %void None %22 + %24 = OpLabel + %tree_1 = OpVariable %_ptr_Function__arr_BST_uint_10 Function %29 + %param = OpVariable %_ptr_Function_BST Function %31 + %x_42_1 = OpVariable %_ptr_Function__arr_BST_uint_10 Function %29 + %32 = OpLoad %_arr_BST_uint_10 %tree_1 + %34 = OpCompositeExtract %BST %32 0 + OpStore %param %34 + %35 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_ %param + %37 = OpLoad %BST %param + %38 = OpLoad %_arr_BST_uint_10 %tree_1 + OpStore %x_42_1 %38 + %40 = OpAccessChain %_ptr_Function_BST %x_42_1 %uint_0 + OpStore %40 %37 + %41 = OpLoad %_arr_BST_uint_10 %x_42_1 + OpStore %tree_1 %41 + %42 = OpLoad %_arr_BST_uint_10 %tree_1 + %43 = OpCompositeExtract %BST %42 0 + %44 = OpCompositeExtract %int %43 2 + %46 = OpIEqual %bool %44 %int_0 + OpSelectionMerge %48 None + OpBranchConditional %46 %49 %48 + %49 = OpLabel + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + OpBranch %52 + %52 = OpLabel + OpBranch %50 + %51 = OpLabel + OpReturn + %48 = OpLabel + %54 = OpLoad %_arr_BST_uint_10 %tree_1 + %56 = OpCompositeExtract %BST %54 0 + %57 = OpCompositeExtract %int %56 2 + %55 = OpConvertSToF %float %57 + %60 = OpCompositeConstruct %v4float %55 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %60 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %61 +%tint_symbol = OpFunctionParameter %main_out + %65 = OpLabel + %66 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %66 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %22 + %68 = OpLabel + %69 = OpFunctionCall %void %main_1 + %71 = OpLoad %v4float %x_GLF_color + %72 = OpCompositeConstruct %main_out %71 + %70 = OpFunctionCall %void %tint_symbol_2 %72 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..974581d65a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-and-unreachable-infinite-loop/0.wgsl.expected.wgsl @@ -0,0 +1,47 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_(tree : ptr) { + (*(tree)).rightIndex = 1; + return; +} + +fn main_1() { + var tree_1 : array; + var param : BST; + let x_37 : array = tree_1; + param = x_37[0u]; + makeTreeNode_struct_BST_i1_i1_i11_(&(param)); + let x_40 : BST = param; + let x_41 : array = tree_1; + var x_42_1 : array = x_41; + x_42_1[0u] = x_40; + let x_42 : array = x_42_1; + tree_1 = x_42; + let x_43 : ptr = &(tree_1[0].rightIndex); + let x_11 : array = tree_1; + if ((x_11[0u].rightIndex == 0)) { + loop { + } + return; + } + let x_12 : array = tree_1; + x_GLF_color = vec4(f32(x_12[0u].rightIndex), 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm new file mode 100644 index 0000000000..1091070a9d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm @@ -0,0 +1,97 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %struct_base "struct_base" + OpMemberName %struct_base 0 "data" + OpMemberName %struct_base 1 "leftIndex" + OpMemberName %struct_base 2 "rightIndex" + OpName %struct_array "struct_array" + OpName %index "index" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%struct_base = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_struct_base_uint_3 = OpTypeArray %struct_base %uint_3 +%_ptr_Private__arr_struct_base_uint_3 = OpTypePointer Private %_arr_struct_base_uint_3 +%struct_array = OpVariable %_ptr_Private__arr_struct_base_uint_3 Private + %int_1 = OpConstant %int 1 + %17 = OpConstantComposite %struct_base %int_1 %int_1 %int_1 + %18 = OpConstantComposite %_arr_struct_base_uint_3 %17 %17 %17 +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 +%_ptr_Private_int = OpTypePointer Private %int + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %34 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %35 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %10 + %36 = OpLabel + %index = OpVariable %_ptr_Function_int Function + OpStore %struct_array %18 + OpStore %index %int_1 + %37 = OpAccessChain %_ptr_Private_int %struct_array %int_1 %int_2 + OpStore %37 %int_1 + %38 = OpAccessChain %_ptr_Private_int %struct_array %int_1 %int_1 + %39 = OpLoad %int %38 + %40 = OpIEqual %bool %39 %int_1 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %43 + %42 = OpLabel + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %45 = OpLoad %float %44 + %46 = OpConvertFToS %int %45 + %47 = OpAccessChain %_ptr_Private_int %struct_array %46 %int_2 + %48 = OpLoad %int %47 + OpStore %index %48 + OpBranch %41 + %43 = OpLabel + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %50 = OpLoad %float %49 + %51 = OpConvertFToS %int %50 + %52 = OpAccessChain %_ptr_Private_int %struct_array %51 %int_1 + %53 = OpLoad %int %52 + OpStore %index %53 + OpBranch %41 + %41 = OpLabel + %54 = OpAccessChain %_ptr_Private_int %struct_array %int_1 %int_1 + %55 = OpLoad %int %54 + %56 = OpIEqual %bool %55 %int_1 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %59 + %58 = OpLabel + OpStore %_GLF_color %34 + OpBranch %57 + %59 = OpLabel + OpStore %_GLF_color %35 + OpBranch %57 + %57 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..a1dacbe77f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.hlsl @@ -0,0 +1,53 @@ +struct struct_base { + int data; + int leftIndex; + int rightIndex; +}; + +static struct_base struct_array[3] = (struct_base[3])0; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int index = 0; + const struct_base tint_symbol_3 = {1, 1, 1}; + const struct_base tint_symbol_4 = {1, 1, 1}; + const struct_base tint_symbol_5 = {1, 1, 1}; + const struct_base tint_symbol_6[3] = {tint_symbol_3, tint_symbol_4, tint_symbol_5}; + struct_array = tint_symbol_6; + index = 1; + struct_array[1].rightIndex = 1; + const int x_39 = struct_array[1].leftIndex; + if ((x_39 == 1)) { + const float x_45 = asfloat(x_8[0].x); + const int x_48 = struct_array[int(x_45)].rightIndex; + index = x_48; + } else { + const float x_50 = asfloat(x_8[0].y); + const int x_53 = struct_array[int(x_50)].leftIndex; + index = x_53; + } + const int x_55 = struct_array[1].leftIndex; + if ((x_55 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_7 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.msl new file mode 100644 index 0000000000..0f1196e766 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; +struct struct_base { + int data; + int leftIndex; + int rightIndex; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + struct_base arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread tint_array_wrapper* const tint_symbol_8, thread float4* const tint_symbol_9) { + int index = 0; + struct_base const tint_symbol_3 = {.data=1, .leftIndex=1, .rightIndex=1}; + struct_base const tint_symbol_4 = {.data=1, .leftIndex=1, .rightIndex=1}; + struct_base const tint_symbol_5 = {.data=1, .leftIndex=1, .rightIndex=1}; + tint_array_wrapper const tint_symbol_6 = {.arr={tint_symbol_3, tint_symbol_4, tint_symbol_5}}; + *(tint_symbol_8) = tint_symbol_6; + index = 1; + (*(tint_symbol_8)).arr[1].rightIndex = 1; + int const x_39 = (*(tint_symbol_8)).arr[1].leftIndex; + if ((x_39 == 1)) { + float const x_45 = x_8.injectionSwitch.x; + int const x_48 = (*(tint_symbol_8)).arr[int(x_45)].rightIndex; + index = x_48; + } else { + float const x_50 = x_8.injectionSwitch.y; + int const x_53 = (*(tint_symbol_8)).arr[int(x_50)].leftIndex; + index = x_53; + } + int const x_55 = (*(tint_symbol_8)).arr[1].leftIndex; + if ((x_55 == 1)) { + *(tint_symbol_9) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_9) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread tint_array_wrapper tint_symbol_10 = {}; + thread float4 tint_symbol_11 = 0.0f; + main_1(x_8, &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_11}; + tint_symbol_1 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..cc8e8c1210 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.spvasm @@ -0,0 +1,133 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %struct_base "struct_base" + OpMemberName %struct_base 0 "data" + OpMemberName %struct_base 1 "leftIndex" + OpMemberName %struct_base 2 "rightIndex" + OpName %struct_array "struct_array" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %index "index" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpMemberDecorate %struct_base 0 Offset 0 + OpMemberDecorate %struct_base 1 Offset 4 + OpMemberDecorate %struct_base 2 Offset 8 + OpDecorate %_arr_struct_base_uint_3 ArrayStride 12 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%struct_base = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_struct_base_uint_3 = OpTypeArray %struct_base %uint_3 +%_ptr_Private__arr_struct_base_uint_3 = OpTypePointer Private %_arr_struct_base_uint_3 + %8 = OpConstantNull %_arr_struct_base_uint_3 +%struct_array = OpVariable %_ptr_Private__arr_struct_base_uint_3 Private %8 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %28 = OpConstantComposite %struct_base %int_1 %int_1 %int_1 + %29 = OpConstantComposite %_arr_struct_base_uint_3 %28 %28 %28 + %uint_2 = OpConstant %uint 2 +%_ptr_Private_int = OpTypePointer Private %int + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %61 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %62 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %63 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %index = OpVariable %_ptr_Function_int Function %26 + OpStore %struct_array %29 + OpStore %index %int_1 + %32 = OpAccessChain %_ptr_Private_int %struct_array %int_1 %uint_2 + OpStore %32 %int_1 + %34 = OpAccessChain %_ptr_Private_int %struct_array %int_1 %uint_1 + %35 = OpLoad %int %34 + %36 = OpIEqual %bool %35 %int_1 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %44 = OpLoad %float %43 + %45 = OpConvertFToS %int %44 + %46 = OpAccessChain %_ptr_Private_int %struct_array %45 %uint_2 + %47 = OpLoad %int %46 + OpStore %index %47 + OpBranch %38 + %40 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %49 = OpLoad %float %48 + %50 = OpConvertFToS %int %49 + %51 = OpAccessChain %_ptr_Private_int %struct_array %50 %uint_1 + %52 = OpLoad %int %51 + OpStore %index %52 + OpBranch %38 + %38 = OpLabel + %53 = OpAccessChain %_ptr_Private_int %struct_array %int_1 %uint_1 + %54 = OpLoad %int %53 + %55 = OpIEqual %bool %54 %int_1 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpStore %x_GLF_color %61 + OpBranch %56 + %58 = OpLabel + OpStore %x_GLF_color %62 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %63 +%tint_symbol = OpFunctionParameter %main_out + %67 = OpLabel + %68 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %68 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %70 = OpLabel + %71 = OpFunctionCall %void %main_1 + %73 = OpLoad %v4float %x_GLF_color + %74 = OpCompositeConstruct %main_out %73 + %72 = OpFunctionCall %void %tint_symbol_2 %74 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..914402c7c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.spvasm.expected.wgsl @@ -0,0 +1,51 @@ +struct struct_base { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var struct_array : array; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var index : i32; + struct_array = array(struct_base(1, 1, 1), struct_base(1, 1, 1), struct_base(1, 1, 1)); + index = 1; + struct_array[1].rightIndex = 1; + let x_39 : i32 = struct_array[1].leftIndex; + if ((x_39 == 1)) { + let x_45 : f32 = x_8.injectionSwitch.x; + let x_48 : i32 = struct_array[i32(x_45)].rightIndex; + index = x_48; + } else { + let x_50 : f32 = x_8.injectionSwitch.y; + let x_53 : i32 = struct_array[i32(x_50)].leftIndex; + index = x_53; + } + let x_55 : i32 = struct_array[1].leftIndex; + if ((x_55 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl new file mode 100644 index 0000000000..914402c7c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl @@ -0,0 +1,51 @@ +struct struct_base { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var struct_array : array; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var index : i32; + struct_array = array(struct_base(1, 1, 1), struct_base(1, 1, 1), struct_base(1, 1, 1)); + index = 1; + struct_array[1].rightIndex = 1; + let x_39 : i32 = struct_array[1].leftIndex; + if ((x_39 == 1)) { + let x_45 : f32 = x_8.injectionSwitch.x; + let x_48 : i32 = struct_array[i32(x_45)].rightIndex; + index = x_48; + } else { + let x_50 : f32 = x_8.injectionSwitch.y; + let x_53 : i32 = struct_array[i32(x_50)].leftIndex; + index = x_53; + } + let x_55 : i32 = struct_array[1].leftIndex; + if ((x_55 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..a1dacbe77f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.hlsl @@ -0,0 +1,53 @@ +struct struct_base { + int data; + int leftIndex; + int rightIndex; +}; + +static struct_base struct_array[3] = (struct_base[3])0; +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int index = 0; + const struct_base tint_symbol_3 = {1, 1, 1}; + const struct_base tint_symbol_4 = {1, 1, 1}; + const struct_base tint_symbol_5 = {1, 1, 1}; + const struct_base tint_symbol_6[3] = {tint_symbol_3, tint_symbol_4, tint_symbol_5}; + struct_array = tint_symbol_6; + index = 1; + struct_array[1].rightIndex = 1; + const int x_39 = struct_array[1].leftIndex; + if ((x_39 == 1)) { + const float x_45 = asfloat(x_8[0].x); + const int x_48 = struct_array[int(x_45)].rightIndex; + index = x_48; + } else { + const float x_50 = asfloat(x_8[0].y); + const int x_53 = struct_array[int(x_50)].leftIndex; + index = x_53; + } + const int x_55 = struct_array[1].leftIndex; + if ((x_55 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_7 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_7; +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.msl new file mode 100644 index 0000000000..0f1196e766 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; +struct struct_base { + int data; + int leftIndex; + int rightIndex; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + struct_base arr[3]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread tint_array_wrapper* const tint_symbol_8, thread float4* const tint_symbol_9) { + int index = 0; + struct_base const tint_symbol_3 = {.data=1, .leftIndex=1, .rightIndex=1}; + struct_base const tint_symbol_4 = {.data=1, .leftIndex=1, .rightIndex=1}; + struct_base const tint_symbol_5 = {.data=1, .leftIndex=1, .rightIndex=1}; + tint_array_wrapper const tint_symbol_6 = {.arr={tint_symbol_3, tint_symbol_4, tint_symbol_5}}; + *(tint_symbol_8) = tint_symbol_6; + index = 1; + (*(tint_symbol_8)).arr[1].rightIndex = 1; + int const x_39 = (*(tint_symbol_8)).arr[1].leftIndex; + if ((x_39 == 1)) { + float const x_45 = x_8.injectionSwitch.x; + int const x_48 = (*(tint_symbol_8)).arr[int(x_45)].rightIndex; + index = x_48; + } else { + float const x_50 = x_8.injectionSwitch.y; + int const x_53 = (*(tint_symbol_8)).arr[int(x_50)].leftIndex; + index = x_53; + } + int const x_55 = (*(tint_symbol_8)).arr[1].leftIndex; + if ((x_55 == 1)) { + *(tint_symbol_9) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_9) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread tint_array_wrapper tint_symbol_10 = {}; + thread float4 tint_symbol_11 = 0.0f; + main_1(x_8, &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_11}; + tint_symbol_1 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_7; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc8e8c1210 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.spvasm @@ -0,0 +1,133 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 75 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %struct_base "struct_base" + OpMemberName %struct_base 0 "data" + OpMemberName %struct_base 1 "leftIndex" + OpMemberName %struct_base 2 "rightIndex" + OpName %struct_array "struct_array" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %index "index" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpMemberDecorate %struct_base 0 Offset 0 + OpMemberDecorate %struct_base 1 Offset 4 + OpMemberDecorate %struct_base 2 Offset 8 + OpDecorate %_arr_struct_base_uint_3 ArrayStride 12 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 +%struct_base = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_struct_base_uint_3 = OpTypeArray %struct_base %uint_3 +%_ptr_Private__arr_struct_base_uint_3 = OpTypePointer Private %_arr_struct_base_uint_3 + %8 = OpConstantNull %_arr_struct_base_uint_3 +%struct_array = OpVariable %_ptr_Private__arr_struct_base_uint_3 Private %8 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %28 = OpConstantComposite %struct_base %int_1 %int_1 %int_1 + %29 = OpConstantComposite %_arr_struct_base_uint_3 %28 %28 %28 + %uint_2 = OpConstant %uint 2 +%_ptr_Private_int = OpTypePointer Private %int + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %61 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %62 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %63 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %index = OpVariable %_ptr_Function_int Function %26 + OpStore %struct_array %29 + OpStore %index %int_1 + %32 = OpAccessChain %_ptr_Private_int %struct_array %int_1 %uint_2 + OpStore %32 %int_1 + %34 = OpAccessChain %_ptr_Private_int %struct_array %int_1 %uint_1 + %35 = OpLoad %int %34 + %36 = OpIEqual %bool %35 %int_1 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + %43 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %44 = OpLoad %float %43 + %45 = OpConvertFToS %int %44 + %46 = OpAccessChain %_ptr_Private_int %struct_array %45 %uint_2 + %47 = OpLoad %int %46 + OpStore %index %47 + OpBranch %38 + %40 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %49 = OpLoad %float %48 + %50 = OpConvertFToS %int %49 + %51 = OpAccessChain %_ptr_Private_int %struct_array %50 %uint_1 + %52 = OpLoad %int %51 + OpStore %index %52 + OpBranch %38 + %38 = OpLabel + %53 = OpAccessChain %_ptr_Private_int %struct_array %int_1 %uint_1 + %54 = OpLoad %int %53 + %55 = OpIEqual %bool %54 %int_1 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %58 + %57 = OpLabel + OpStore %x_GLF_color %61 + OpBranch %56 + %58 = OpLabel + OpStore %x_GLF_color %62 + OpBranch %56 + %56 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %63 +%tint_symbol = OpFunctionParameter %main_out + %67 = OpLabel + %68 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %68 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %70 = OpLabel + %71 = OpFunctionCall %void %main_1 + %73 = OpLoad %v4float %x_GLF_color + %74 = OpCompositeConstruct %main_out %73 + %72 = OpFunctionCall %void %tint_symbol_2 %74 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..914402c7c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-array-index/0.wgsl.expected.wgsl @@ -0,0 +1,51 @@ +struct struct_base { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var struct_array : array; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var index : i32; + struct_array = array(struct_base(1, 1, 1), struct_base(1, 1, 1), struct_base(1, 1, 1)); + index = 1; + struct_array[1].rightIndex = 1; + let x_39 : i32 = struct_array[1].leftIndex; + if ((x_39 == 1)) { + let x_45 : f32 = x_8.injectionSwitch.x; + let x_48 : i32 = struct_array[i32(x_45)].rightIndex; + index = x_48; + } else { + let x_50 : f32 = x_8.injectionSwitch.y; + let x_53 : i32 = struct_array[i32(x_50)].leftIndex; + index = x_53; + } + let x_55 : i32 = struct_array[1].leftIndex; + if ((x_55 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm new file mode 100644 index 0000000000..0f3e40919c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm @@ -0,0 +1,95 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %S "S" + OpMemberName %S 0 "f0" + OpMemberName %S 1 "f1" + OpName %ll "ll" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %sums "sums" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %S 0 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %S = OpTypeStruct %int %v3bool +%_ptr_Function_S = OpTypePointer Function %S + %int_0 = OpConstant %int 0 + %true = OpConstantTrue %bool + %22 = OpConstantComposite %v3bool %true %true %true + %23 = OpConstantComposite %S %int_0 %22 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %float_0 = OpConstant %float 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %15 + %39 = OpLabel + %ll = OpVariable %_ptr_Function_S Function + %sums = OpVariable %_ptr_Function__arr_float_uint_9 Function + OpStore %ll %23 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %12 = OpLoad %S %ll + %9 = OpCompositeExtract %int %12 0 + %44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %45 = OpLoad %float %44 + %46 = OpConvertFToS %int %45 + %47 = OpINotEqual %bool %9 %46 + OpBranchConditional %47 %48 %41 + %48 = OpLabel + %49 = OpAccessChain %_ptr_Function_float %sums %int_0 + OpStore %49 %float_0 + OpBranch %42 + %42 = OpLabel + %13 = OpLoad %S %ll + %10 = OpCompositeExtract %int %13 0 + %11 = OpIAdd %int %10 %int_1 + %50 = OpLoad %S %ll + %51 = OpCompositeInsert %S %11 %50 0 + OpStore %ll %51 + OpBranch %40 + %41 = OpLabel + %52 = OpAccessChain %_ptr_Function_float %sums %int_0 + %53 = OpLoad %float %52 + %54 = OpCompositeConstruct %v2float %53 %53 + %55 = OpCompositeExtract %float %54 0 + %56 = OpCompositeExtract %float %54 1 + %57 = OpCompositeConstruct %v4float %float_1 %55 %56 %float_1 + OpStore %_GLF_color %57 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ba4731728e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,49 @@ +struct S { + int f0; + bool3 f1; +}; + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + S ll = (S)0; + float sums[9] = (float[9])0; + const S tint_symbol_3 = {0, bool3(true, true, true)}; + ll = tint_symbol_3; + while (true) { + const S x_12 = ll; + const float x_45 = asfloat(x_7[0].y); + if ((x_12.f0 != int(x_45))) { + } else { + break; + } + sums[0] = 0.0f; + { + const S x_13 = ll; + S x_51_1 = ll; + x_51_1.f0 = (x_13.f0 + 1); + ll = x_51_1; + } + } + const float x_53 = sums[0]; + const float2 x_54 = float2(x_53, x_53); + x_GLF_color = float4(1.0f, x_54.x, x_54.y, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..c9860b9633 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,56 @@ +#include + +using namespace metal; +struct S { + int f0; + bool3 f1; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5) { + S ll = {}; + tint_array_wrapper sums = {}; + S const tint_symbol_3 = {.f0=0, .f1=bool3(true, true, true)}; + ll = tint_symbol_3; + while (true) { + S const x_12 = ll; + float const x_45 = x_7.injectionSwitch.y; + if ((x_12.f0 != int(x_45))) { + } else { + break; + } + sums.arr[0] = 0.0f; + { + S const x_13 = ll; + S const x_50 = ll; + S x_51_1 = x_50; + x_51_1.f0 = (x_13.f0 + 1); + S const x_51 = x_51_1; + ll = x_51; + } + } + float const x_53 = sums.arr[0]; + float2 const x_54 = float2(x_53, x_53); + *(tint_symbol_5) = float4(1.0f, x_54.x, x_54.y, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..1b17c76f3f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,137 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 80 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %S "S" + OpMemberName %S 0 "f0" + OpMemberName %S 1 "f1" + OpName %ll "ll" + OpName %sums "sums" + OpName %x_51_1 "x_51_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 16 + OpDecorate %_arr_float_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %S = OpTypeStruct %int %v3bool +%_ptr_Function_S = OpTypePointer Function %S + %22 = OpConstantNull %S + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %28 = OpConstantNull %_arr_float_uint_9 + %int_0 = OpConstant %int 0 + %true = OpConstantTrue %bool + %31 = OpConstantComposite %v3bool %true %true %true + %32 = OpConstantComposite %S %int_0 %31 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %68 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %ll = OpVariable %_ptr_Function_S Function %22 + %sums = OpVariable %_ptr_Function__arr_float_uint_9 Function %28 + %x_51_1 = OpVariable %_ptr_Function_S Function %22 + OpStore %ll %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %S %ll + %41 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %42 = OpLoad %float %41 + %43 = OpCompositeExtract %int %37 0 + %44 = OpConvertFToS %int %42 + %45 = OpINotEqual %bool %43 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %34 + %46 = OpLabel + %50 = OpAccessChain %_ptr_Function_float %sums %int_0 + OpStore %50 %float_0 + OpBranch %35 + %35 = OpLabel + %52 = OpLoad %S %ll + %53 = OpLoad %S %ll + OpStore %x_51_1 %53 + %56 = OpAccessChain %_ptr_Function_int %x_51_1 %uint_0 + %57 = OpCompositeExtract %int %52 0 + %59 = OpIAdd %int %57 %int_1 + OpStore %56 %59 + %60 = OpLoad %S %x_51_1 + OpStore %ll %60 + OpBranch %33 + %34 = OpLabel + %61 = OpAccessChain %_ptr_Function_float %sums %int_0 + %62 = OpLoad %float %61 + %63 = OpCompositeConstruct %v2float %62 %62 + %65 = OpCompositeExtract %float %63 0 + %66 = OpCompositeExtract %float %63 1 + %67 = OpCompositeConstruct %v4float %float_1 %65 %66 %float_1 + OpStore %x_GLF_color %67 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %68 +%tint_symbol = OpFunctionParameter %main_out + %72 = OpLabel + %73 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %73 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %75 = OpLabel + %76 = OpFunctionCall %void %main_1 + %78 = OpLoad %v4float %x_GLF_color + %79 = OpCompositeConstruct %main_out %78 + %77 = OpFunctionCall %void %tint_symbol_2 %79 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..863b10cfb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,52 @@ +struct S { + f0 : i32; + f1 : vec3; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var ll : S; + var sums : array; + ll = S(0, vec3(true, true, true)); + loop { + let x_12 : S = ll; + let x_45 : f32 = x_7.injectionSwitch.y; + if ((x_12.f0 != i32(x_45))) { + } else { + break; + } + sums[0] = 0.0; + + continuing { + let x_13 : S = ll; + let x_50 : S = ll; + var x_51_1 : S = x_50; + x_51_1.f0 = (x_13.f0 + 1); + let x_51 : S = x_51_1; + ll = x_51; + } + } + let x_53 : f32 = sums[0]; + let x_54 : vec2 = vec2(x_53, x_53); + x_GLF_color = vec4(1.0, x_54.x, x_54.y, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl new file mode 100644 index 0000000000..863b10cfb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl @@ -0,0 +1,52 @@ +struct S { + f0 : i32; + f1 : vec3; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var ll : S; + var sums : array; + ll = S(0, vec3(true, true, true)); + loop { + let x_12 : S = ll; + let x_45 : f32 = x_7.injectionSwitch.y; + if ((x_12.f0 != i32(x_45))) { + } else { + break; + } + sums[0] = 0.0; + + continuing { + let x_13 : S = ll; + let x_50 : S = ll; + var x_51_1 : S = x_50; + x_51_1.f0 = (x_13.f0 + 1); + let x_51 : S = x_51_1; + ll = x_51; + } + } + let x_53 : f32 = sums[0]; + let x_54 : vec2 = vec2(x_53, x_53); + x_GLF_color = vec4(1.0, x_54.x, x_54.y, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..ba4731728e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,49 @@ +struct S { + int f0; + bool3 f1; +}; + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + S ll = (S)0; + float sums[9] = (float[9])0; + const S tint_symbol_3 = {0, bool3(true, true, true)}; + ll = tint_symbol_3; + while (true) { + const S x_12 = ll; + const float x_45 = asfloat(x_7[0].y); + if ((x_12.f0 != int(x_45))) { + } else { + break; + } + sums[0] = 0.0f; + { + const S x_13 = ll; + S x_51_1 = ll; + x_51_1.f0 = (x_13.f0 + 1); + ll = x_51_1; + } + } + const float x_53 = sums[0]; + const float2 x_54 = float2(x_53, x_53); + x_GLF_color = float4(1.0f, x_54.x, x_54.y, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..c9860b9633 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,56 @@ +#include + +using namespace metal; +struct S { + int f0; + bool3 f1; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5) { + S ll = {}; + tint_array_wrapper sums = {}; + S const tint_symbol_3 = {.f0=0, .f1=bool3(true, true, true)}; + ll = tint_symbol_3; + while (true) { + S const x_12 = ll; + float const x_45 = x_7.injectionSwitch.y; + if ((x_12.f0 != int(x_45))) { + } else { + break; + } + sums.arr[0] = 0.0f; + { + S const x_13 = ll; + S const x_50 = ll; + S x_51_1 = x_50; + x_51_1.f0 = (x_13.f0 + 1); + S const x_51 = x_51_1; + ll = x_51; + } + } + float const x_53 = sums.arr[0]; + float2 const x_54 = float2(x_53, x_53); + *(tint_symbol_5) = float4(1.0f, x_54.x, x_54.y, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..1b17c76f3f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,137 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 80 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %S "S" + OpMemberName %S 0 "f0" + OpMemberName %S 1 "f1" + OpName %ll "ll" + OpName %sums "sums" + OpName %x_51_1 "x_51_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 16 + OpDecorate %_arr_float_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %S = OpTypeStruct %int %v3bool +%_ptr_Function_S = OpTypePointer Function %S + %22 = OpConstantNull %S + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %28 = OpConstantNull %_arr_float_uint_9 + %int_0 = OpConstant %int 0 + %true = OpConstantTrue %bool + %31 = OpConstantComposite %v3bool %true %true %true + %32 = OpConstantComposite %S %int_0 %31 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %68 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %ll = OpVariable %_ptr_Function_S Function %22 + %sums = OpVariable %_ptr_Function__arr_float_uint_9 Function %28 + %x_51_1 = OpVariable %_ptr_Function_S Function %22 + OpStore %ll %32 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %S %ll + %41 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %42 = OpLoad %float %41 + %43 = OpCompositeExtract %int %37 0 + %44 = OpConvertFToS %int %42 + %45 = OpINotEqual %bool %43 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %34 + %46 = OpLabel + %50 = OpAccessChain %_ptr_Function_float %sums %int_0 + OpStore %50 %float_0 + OpBranch %35 + %35 = OpLabel + %52 = OpLoad %S %ll + %53 = OpLoad %S %ll + OpStore %x_51_1 %53 + %56 = OpAccessChain %_ptr_Function_int %x_51_1 %uint_0 + %57 = OpCompositeExtract %int %52 0 + %59 = OpIAdd %int %57 %int_1 + OpStore %56 %59 + %60 = OpLoad %S %x_51_1 + OpStore %ll %60 + OpBranch %33 + %34 = OpLabel + %61 = OpAccessChain %_ptr_Function_float %sums %int_0 + %62 = OpLoad %float %61 + %63 = OpCompositeConstruct %v2float %62 %62 + %65 = OpCompositeExtract %float %63 0 + %66 = OpCompositeExtract %float %63 1 + %67 = OpCompositeConstruct %v4float %float_1 %65 %66 %float_1 + OpStore %x_GLF_color %67 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %68 +%tint_symbol = OpFunctionParameter %main_out + %72 = OpLabel + %73 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %73 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %75 = OpLabel + %76 = OpFunctionCall %void %main_1 + %78 = OpLoad %v4float %x_GLF_color + %79 = OpCompositeConstruct %main_out %78 + %77 = OpFunctionCall %void %tint_symbol_2 %79 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..863b10cfb4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-controlled-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,52 @@ +struct S { + f0 : i32; + f1 : vec3; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var ll : S; + var sums : array; + ll = S(0, vec3(true, true, true)); + loop { + let x_12 : S = ll; + let x_45 : f32 = x_7.injectionSwitch.y; + if ((x_12.f0 != i32(x_45))) { + } else { + break; + } + sums[0] = 0.0; + + continuing { + let x_13 : S = ll; + let x_50 : S = ll; + var x_51_1 : S = x_50; + x_51_1.f0 = (x_13.f0 + 1); + let x_51 : S = x_51_1; + ll = x_51; + } + } + let x_53 : f32 = sums[0]; + let x_54 : vec2 = vec2(x_53, x_53); + x_GLF_color = vec4(1.0, x_54.x, x_54.y, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm new file mode 100644 index 0000000000..e3788e22d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm @@ -0,0 +1,35 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource ESSL 310 + OpDecorate %3 Location 0 + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %_struct_4 Block + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + OpDecorate %6 RelaxedPrecision + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %3 = OpVariable %_ptr_Output_v4float Output + %_struct_4 = OpTypeStruct %v4float +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 + %5 = OpVariable %_ptr_Uniform__struct_4 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %_struct_16 = OpTypeStruct %v4float + %17 = OpUndef %_struct_16 + %2 = OpFunction %void None %8 + %18 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_v4float %5 %int_0 + %20 = OpLoad %v4float %19 + %21 = OpCompositeInsert %_struct_16 %20 %17 0 + %6 = OpCompositeExtract %v4float %21 0 + OpStore %3 %6 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..82d98ae397 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.hlsl @@ -0,0 +1,30 @@ +struct S_1 { + float4 field0; +}; + +static float4 x_3 = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + const float4 x_20 = asfloat(x_5[0]); + S_1 x_21_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; + x_21_1.field0 = x_20; + x_3 = x_21_1.field0; + return; +} + +struct main_out { + float4 x_3_1; +}; +struct tint_symbol { + float4 x_3_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_3}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_3_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..c1935072c0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ packed_float4 field0; +}; +struct S_1 { + float4 field0; +}; +struct main_out { + float4 x_3_1; +}; +struct tint_symbol_1 { + float4 x_3_1 [[color(0)]]; +}; + +void main_1(constant S& x_5, thread float4* const tint_symbol_4) { + float4 const x_20 = x_5.field0; + S_1 x_21_1 = {.field0=float4(0.0f, 0.0f, 0.0f, 0.0f)}; + x_21_1.field0 = x_20; + S_1 const x_21 = x_21_1; + *(tint_symbol_4) = x_21.field0; + return; +} + +fragment tint_symbol_1 tint_symbol(constant S& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_3_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_3_1=tint_symbol_2.x_3_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4cdb9e6ea4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_3 "x_3" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %S_1 "S_1" + OpMemberName %S_1 0 "field0" + OpName %x_21_1 "x_21_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_3_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S_1 0 Offset 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_3 = OpVariable %_ptr_Private_v4float Private %5 + %S = OpTypeStruct %v4float +%_ptr_Uniform_S = OpTypePointer Uniform %S + %x_5 = OpVariable %_ptr_Uniform_S Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %S_1 = OpTypeStruct %v4float + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %23 = OpConstantComposite %S_1 %22 +%_ptr_Function_S_1 = OpTypePointer Function %S_1 + %26 = OpConstantNull %S_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %31 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_21_1 = OpVariable %_ptr_Function_S_1 Function %26 + %18 = OpAccessChain %_ptr_Uniform_v4float %x_5 %uint_0 + %19 = OpLoad %v4float %18 + OpStore %x_21_1 %23 + %28 = OpAccessChain %_ptr_Function_v4float %x_21_1 %uint_0 + OpStore %28 %19 + %29 = OpLoad %S_1 %x_21_1 + %30 = OpCompositeExtract %v4float %29 0 + OpStore %x_3 %30 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %31 +%tint_symbol = OpFunctionParameter %main_out + %35 = OpLabel + %36 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %36 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %38 = OpLabel + %39 = OpFunctionCall %void %main_1 + %41 = OpLoad %v4float %x_3 + %42 = OpCompositeConstruct %main_out %41 + %40 = OpFunctionCall %void %tint_symbol_2 %42 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..de69a653b8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct S { + field0 : vec4; +}; + +struct S_1 { + field0 : vec4; +}; + +var x_3 : vec4; + +[[group(0), binding(0)]] var x_5 : S; + +fn main_1() { + let x_20 : vec4 = x_5.field0; + var x_21_1 : S_1 = S_1(vec4(0.0, 0.0, 0.0, 0.0)); + x_21_1.field0 = x_20; + let x_21 : S_1 = x_21_1; + x_3 = x_21.field0; + return; +} + +struct main_out { + [[location(0)]] + x_3_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_3); +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl new file mode 100644 index 0000000000..de69a653b8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct S { + field0 : vec4; +}; + +struct S_1 { + field0 : vec4; +}; + +var x_3 : vec4; + +[[group(0), binding(0)]] var x_5 : S; + +fn main_1() { + let x_20 : vec4 = x_5.field0; + var x_21_1 : S_1 = S_1(vec4(0.0, 0.0, 0.0, 0.0)); + x_21_1.field0 = x_20; + let x_21 : S_1 = x_21_1; + x_3 = x_21.field0; + return; +} + +struct main_out { + [[location(0)]] + x_3_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_3); +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..82d98ae397 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.hlsl @@ -0,0 +1,30 @@ +struct S_1 { + float4 field0; +}; + +static float4 x_3 = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + const float4 x_20 = asfloat(x_5[0]); + S_1 x_21_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; + x_21_1.field0 = x_20; + x_3 = x_21_1.field0; + return; +} + +struct main_out { + float4 x_3_1; +}; +struct tint_symbol { + float4 x_3_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_3}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_3_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..c1935072c0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ packed_float4 field0; +}; +struct S_1 { + float4 field0; +}; +struct main_out { + float4 x_3_1; +}; +struct tint_symbol_1 { + float4 x_3_1 [[color(0)]]; +}; + +void main_1(constant S& x_5, thread float4* const tint_symbol_4) { + float4 const x_20 = x_5.field0; + S_1 x_21_1 = {.field0=float4(0.0f, 0.0f, 0.0f, 0.0f)}; + x_21_1.field0 = x_20; + S_1 const x_21 = x_21_1; + *(tint_symbol_4) = x_21.field0; + return; +} + +fragment tint_symbol_1 tint_symbol(constant S& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_3_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_3_1=tint_symbol_2.x_3_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4cdb9e6ea4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_3 "x_3" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %S_1 "S_1" + OpMemberName %S_1 0 "field0" + OpName %x_21_1 "x_21_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_3_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %S_1 0 Offset 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_3 = OpVariable %_ptr_Private_v4float Private %5 + %S = OpTypeStruct %v4float +%_ptr_Uniform_S = OpTypePointer Uniform %S + %x_5 = OpVariable %_ptr_Uniform_S Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %S_1 = OpTypeStruct %v4float + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %23 = OpConstantComposite %S_1 %22 +%_ptr_Function_S_1 = OpTypePointer Function %S_1 + %26 = OpConstantNull %S_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %main_out = OpTypeStruct %v4float + %31 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_21_1 = OpVariable %_ptr_Function_S_1 Function %26 + %18 = OpAccessChain %_ptr_Uniform_v4float %x_5 %uint_0 + %19 = OpLoad %v4float %18 + OpStore %x_21_1 %23 + %28 = OpAccessChain %_ptr_Function_v4float %x_21_1 %uint_0 + OpStore %28 %19 + %29 = OpLoad %S_1 %x_21_1 + %30 = OpCompositeExtract %v4float %29 0 + OpStore %x_3 %30 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %31 +%tint_symbol = OpFunctionParameter %main_out + %35 = OpLabel + %36 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %36 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %38 = OpLabel + %39 = OpFunctionCall %void %main_1 + %41 = OpLoad %v4float %x_3 + %42 = OpCompositeConstruct %main_out %41 + %40 = OpFunctionCall %void %tint_symbol_2 %42 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..de69a653b8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/struct-used-as-temporary/0-opt.wgsl.expected.wgsl @@ -0,0 +1,32 @@ +[[block]] +struct S { + field0 : vec4; +}; + +struct S_1 { + field0 : vec4; +}; + +var x_3 : vec4; + +[[group(0), binding(0)]] var x_5 : S; + +fn main_1() { + let x_20 : vec4 = x_5.field0; + var x_21_1 : S_1 = S_1(vec4(0.0, 0.0, 0.0, 0.0)); + x_21_1.field0 = x_20; + let x_21 : S_1 = x_21_1; + x_3 = x_21.field0; + return; +} + +struct main_out { + [[location(0)]] + x_3_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_3); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm new file mode 100644 index 0000000000..2d47ed637c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm @@ -0,0 +1,59 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %7 + %23 = OpLabel + %24 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %25 = OpLoad %float %24 + %26 = OpConvertFToS %int %25 + OpSelectionMerge %27 None + OpSwitch %26 %27 -1 %28 + %28 = OpLabel + %29 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %30 = OpLoad %float %29 + %31 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %32 = OpLoad %float %31 + %33 = OpFOrdGreaterThan %bool %30 %32 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + OpKill + %34 = OpLabel + OpBranch %27 + %27 = OpLabel + OpStore %_GLF_color %22 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..89dad7e3e9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.hlsl @@ -0,0 +1,37 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_25 = asfloat(x_5[0].y); + switch(int(x_25)) { + case -1: { + const float x_30 = asfloat(x_5[0].y); + const float x_32 = asfloat(x_5[0].x); + if ((x_30 > x_32)) { + discard; + } + break; + } + default: { + break; + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..e06f14d238 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float const x_25 = x_5.injectionSwitch.y; + switch(int(x_25)) { + case -1: { + float const x_30 = x_5.injectionSwitch.y; + float const x_32 = x_5.injectionSwitch.x; + if ((x_30 > x_32)) { + discard_fragment(); + } + break; + } + default: { + break; + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..33527dee1d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %37 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %20 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %21 = OpLoad %float %20 + %23 = OpConvertFToS %int %21 + OpSelectionMerge %22 None + OpSwitch %23 %25 -1 %26 + %26 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %28 = OpLoad %float %27 + %29 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %30 = OpLoad %float %29 + %31 = OpFOrdGreaterThan %bool %28 %30 + OpSelectionMerge %33 None + OpBranchConditional %31 %34 %33 + %34 = OpLabel + OpKill + %33 = OpLabel + OpBranch %22 + %25 = OpLabel + OpBranch %22 + %22 = OpLabel + OpStore %x_GLF_color %37 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %38 +%tint_symbol = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %main_1 + %48 = OpLoad %v4float %x_GLF_color + %49 = OpCompositeConstruct %main_out %48 + %47 = OpFunctionCall %void %tint_symbol_2 %49 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..2a93d7f6e0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_25 : f32 = x_5.injectionSwitch.y; + switch(i32(x_25)) { + case -1: { + let x_30 : f32 = x_5.injectionSwitch.y; + let x_32 : f32 = x_5.injectionSwitch.x; + if ((x_30 > x_32)) { + discard; + } + } + default: { + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl new file mode 100644 index 0000000000..2a93d7f6e0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl @@ -0,0 +1,36 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_25 : f32 = x_5.injectionSwitch.y; + switch(i32(x_25)) { + case -1: { + let x_30 : f32 = x_5.injectionSwitch.y; + let x_32 : f32 = x_5.injectionSwitch.x; + if ((x_30 > x_32)) { + discard; + } + } + default: { + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..89dad7e3e9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_25 = asfloat(x_5[0].y); + switch(int(x_25)) { + case -1: { + const float x_30 = asfloat(x_5[0].y); + const float x_32 = asfloat(x_5[0].x); + if ((x_30 > x_32)) { + discard; + } + break; + } + default: { + break; + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..e06f14d238 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.msl @@ -0,0 +1,40 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float const x_25 = x_5.injectionSwitch.y; + switch(int(x_25)) { + case -1: { + float const x_30 = x_5.injectionSwitch.y; + float const x_32 = x_5.injectionSwitch.x; + if ((x_30 > x_32)) { + discard_fragment(); + } + break; + } + default: { + break; + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..33527dee1d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.spvasm @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %37 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %20 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %21 = OpLoad %float %20 + %23 = OpConvertFToS %int %21 + OpSelectionMerge %22 None + OpSwitch %23 %25 -1 %26 + %26 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %28 = OpLoad %float %27 + %29 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %30 = OpLoad %float %29 + %31 = OpFOrdGreaterThan %bool %28 %30 + OpSelectionMerge %33 None + OpBranchConditional %31 %34 %33 + %34 = OpLabel + OpKill + %33 = OpLabel + OpBranch %22 + %25 = OpLabel + OpBranch %22 + %22 = OpLabel + OpStore %x_GLF_color %37 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %38 +%tint_symbol = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %45 = OpLabel + %46 = OpFunctionCall %void %main_1 + %48 = OpLoad %v4float %x_GLF_color + %49 = OpCompositeConstruct %main_out %48 + %47 = OpFunctionCall %void %tint_symbol_2 %49 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..2a93d7f6e0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-if-discard/0-opt.wgsl.expected.wgsl @@ -0,0 +1,36 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + let x_25 : f32 = x_5.injectionSwitch.y; + switch(i32(x_25)) { + case -1: { + let x_30 : f32 = x_5.injectionSwitch.y; + let x_32 : f32 = x_5.injectionSwitch.x; + if ((x_30 > x_32)) { + discard; + } + } + default: { + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm new file mode 100644 index 0000000000..6f83ac1feb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm @@ -0,0 +1,83 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %merge_ "merge(" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %res "res" + OpDecorate %merge_ RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + OpDecorate %res RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %13 = OpTypeFunction %int + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool +%_ptr_Function_int = OpTypePointer Function %int + %main = OpFunction %void None %11 + %26 = OpLabel + %res = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %23 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %32 = OpLoad %float %31 + %33 = OpConvertFToS %int %32 + OpSelectionMerge %34 None + OpSwitch %33 %34 0 %35 + %35 = OpLabel + OpReturn + %34 = OpLabel + OpBranch %29 + %29 = OpLabel + OpBranchConditional %false %27 %28 + %28 = OpLabel + %8 = OpFunctionCall %int %merge_ + OpStore %res %8 + %9 = OpLoad %int %res + %36 = OpConvertSToF %float %9 + %37 = OpCompositeConstruct %v4float %36 %36 %36 %36 + OpStore %_GLF_color %37 + OpReturn + OpFunctionEnd + %merge_ = OpFunction %int None %13 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %40 = OpLoad %float %39 + %41 = OpFOrdLessThan %bool %40 %float_0 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpReturnValue %int_0 + %42 = OpLabel + %44 = OpUndef %int + OpReturnValue %44 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..804140c5c7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.hlsl @@ -0,0 +1,54 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int merge_() { + const float x_40 = asfloat(x_6[0].x); + if ((x_40 < 0.0f)) { + return 0; + } + return 0; +} + +void main_1() { + int res = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + while (true) { + const float x_32 = asfloat(x_6[0].x); + switch(int(x_32)) { + case 0: { + return; + break; + } + default: { + break; + } + } + { + if (false) { + } else { + break; + } + } + } + const int x_8 = merge_(); + res = x_8; + const float x_36 = float(res); + x_GLF_color = float4(x_36, x_36, x_36, x_36); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..e33cab57c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int merge_(constant buf0& x_6) { + float const x_40 = x_6.zero; + if ((x_40 < 0.0f)) { + return 0; + } + return 0; +} + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int res = 0; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + while (true) { + float const x_32 = x_6.zero; + switch(int(x_32)) { + case 0: { + return; + break; + } + default: { + break; + } + } + { + if (false) { + } else { + break; + } + } + } + int const x_8 = merge_(x_6); + res = x_8; + int const x_9 = res; + float const x_36 = float(x_9); + *(tint_symbol_4) = float4(x_36, x_36, x_36, x_36); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..a32e26e561 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.spvasm @@ -0,0 +1,126 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %merge_ "merge_" + OpName %main_1 "main_1" + OpName %res "res" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeFunction %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %void = OpTypeVoid + %26 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %32 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %34 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %merge_ = OpFunction %int None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %19 = OpLoad %float %18 + %21 = OpFOrdLessThan %bool %19 %float_0 + OpSelectionMerge %23 None + OpBranchConditional %21 %24 %23 + %24 = OpLabel + OpReturnValue %int_0 + %23 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %26 + %29 = OpLabel + %res = OpVariable %_ptr_Function_int Function %32 + OpStore %x_GLF_color %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %40 = OpLoad %float %39 + %42 = OpConvertFToS %int %40 + OpSelectionMerge %41 None + OpSwitch %42 %43 0 %44 + %44 = OpLabel + OpReturn + %43 = OpLabel + OpBranch %41 + %41 = OpLabel + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %46 None + OpBranchConditional %false %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %36 + %46 = OpLabel + OpBranch %35 + %36 = OpLabel + %49 = OpFunctionCall %int %merge_ + OpStore %res %49 + %50 = OpLoad %int %res + %51 = OpConvertSToF %float %50 + %52 = OpCompositeConstruct %v4float %51 %51 %51 %51 + OpStore %x_GLF_color %52 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %53 +%tint_symbol = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %26 + %60 = OpLabel + %61 = OpFunctionCall %void %main_1 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpCompositeConstruct %main_out %63 + %62 = OpFunctionCall %void %tint_symbol_2 %64 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 37[%37] is not post dominated by the back-edge block 46[%46] + %46 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..546668aabe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.spvasm.expected.wgsl @@ -0,0 +1,55 @@ +[[block]] +struct buf0 { + zero : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn merge_() -> i32 { + let x_40 : f32 = x_6.zero; + if ((x_40 < 0.0)) { + return 0; + } + return 0; +} + +fn main_1() { + var res : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + loop { + let x_32 : f32 = x_6.zero; + switch(i32(x_32)) { + case 0: { + return; + } + default: { + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + let x_8 : i32 = merge_(); + res = x_8; + let x_9 : i32 = res; + let x_36 : f32 = f32(x_9); + x_GLF_color = vec4(x_36, x_36, x_36, x_36); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl new file mode 100644 index 0000000000..546668aabe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl @@ -0,0 +1,55 @@ +[[block]] +struct buf0 { + zero : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn merge_() -> i32 { + let x_40 : f32 = x_6.zero; + if ((x_40 < 0.0)) { + return 0; + } + return 0; +} + +fn main_1() { + var res : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + loop { + let x_32 : f32 = x_6.zero; + switch(i32(x_32)) { + case 0: { + return; + } + default: { + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + let x_8 : i32 = merge_(); + res = x_8; + let x_9 : i32 = res; + let x_36 : f32 = f32(x_9); + x_GLF_color = vec4(x_36, x_36, x_36, x_36); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..804140c5c7 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.hlsl @@ -0,0 +1,54 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int merge_() { + const float x_40 = asfloat(x_6[0].x); + if ((x_40 < 0.0f)) { + return 0; + } + return 0; +} + +void main_1() { + int res = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + while (true) { + const float x_32 = asfloat(x_6[0].x); + switch(int(x_32)) { + case 0: { + return; + break; + } + default: { + break; + } + } + { + if (false) { + } else { + break; + } + } + } + const int x_8 = merge_(); + res = x_8; + const float x_36 = float(res); + x_GLF_color = float4(x_36, x_36, x_36, x_36); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..e33cab57c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.msl @@ -0,0 +1,58 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float zero; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int merge_(constant buf0& x_6) { + float const x_40 = x_6.zero; + if ((x_40 < 0.0f)) { + return 0; + } + return 0; +} + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int res = 0; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + while (true) { + float const x_32 = x_6.zero; + switch(int(x_32)) { + case 0: { + return; + break; + } + default: { + break; + } + } + { + if (false) { + } else { + break; + } + } + } + int const x_8 = merge_(x_6); + res = x_8; + int const x_9 = res; + float const x_36 = float(x_9); + *(tint_symbol_4) = float4(x_36, x_36, x_36, x_36); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..a32e26e561 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.spvasm @@ -0,0 +1,126 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "zero" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %merge_ "merge_" + OpName %main_1 "main_1" + OpName %res "res" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %buf0 = OpTypeStruct %float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8 + %int = OpTypeInt 32 1 + %11 = OpTypeFunction %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %void = OpTypeVoid + %26 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %32 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %34 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %53 = OpTypeFunction %void %main_out + %merge_ = OpFunction %int None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %19 = OpLoad %float %18 + %21 = OpFOrdLessThan %bool %19 %float_0 + OpSelectionMerge %23 None + OpBranchConditional %21 %24 %23 + %24 = OpLabel + OpReturnValue %int_0 + %23 = OpLabel + OpReturnValue %int_0 + OpFunctionEnd + %main_1 = OpFunction %void None %26 + %29 = OpLabel + %res = OpVariable %_ptr_Function_int Function %32 + OpStore %x_GLF_color %34 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 + %40 = OpLoad %float %39 + %42 = OpConvertFToS %int %40 + OpSelectionMerge %41 None + OpSwitch %42 %43 0 %44 + %44 = OpLabel + OpReturn + %43 = OpLabel + OpBranch %41 + %41 = OpLabel + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %46 None + OpBranchConditional %false %47 %48 + %47 = OpLabel + OpBranch %46 + %48 = OpLabel + OpBranch %36 + %46 = OpLabel + OpBranch %35 + %36 = OpLabel + %49 = OpFunctionCall %int %merge_ + OpStore %res %49 + %50 = OpLoad %int %res + %51 = OpConvertSToF %float %50 + %52 = OpCompositeConstruct %v4float %51 %51 %51 %51 + OpStore %x_GLF_color %52 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %53 +%tint_symbol = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %58 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %26 + %60 = OpLabel + %61 = OpFunctionCall %void %main_1 + %63 = OpLoad %v4float %x_GLF_color + %64 = OpCompositeConstruct %main_out %63 + %62 = OpFunctionCall %void %tint_symbol_2 %64 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 37[%37] is not post dominated by the back-edge block 46[%46] + %46 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..546668aabe --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-inside-while-always-return/0-opt.wgsl.expected.wgsl @@ -0,0 +1,55 @@ +[[block]] +struct buf0 { + zero : f32; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn merge_() -> i32 { + let x_40 : f32 = x_6.zero; + if ((x_40 < 0.0)) { + return 0; + } + return 0; +} + +fn main_1() { + var res : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + loop { + let x_32 : f32 = x_6.zero; + switch(i32(x_32)) { + case 0: { + return; + } + default: { + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + let x_8 : i32 = merge_(); + res = x_8; + let x_9 : i32 = res; + let x_36 : f32 = f32(x_9); + x_GLF_color = vec4(x_36, x_36, x_36, x_36); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm new file mode 100644 index 0000000000..099b620022 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm @@ -0,0 +1,134 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpDecorate %i RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %24 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_7 = OpConstant %int 7 + %int_200 = OpConstant %int 200 + %bool = OpTypeBool + %int_100 = OpConstant %int 100 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_n2 = OpConstant %int -2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %47 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %48 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main = OpFunction %void None %24 + %49 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %50 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %51 = OpLoad %float %50 + %7 = OpConvertFToS %int %51 + OpStore %i %7 + %8 = OpLoad %int %i + OpSelectionMerge %52 None + OpSwitch %8 %53 0 %54 + %53 = OpLabel + %20 = OpLoad %int %i + %21 = OpISub %int %20 %int_3 + OpStore %i %21 + OpBranch %52 + %54 = OpLabel + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %9 = OpLoad %int %i + %10 = OpIAdd %int %9 %int_1 + OpStore %i %10 + %11 = OpLoad %int %i + OpSelectionMerge %59 None + OpSwitch %11 %60 1 %61 2 %62 + %60 = OpLabel + %14 = OpLoad %int %i + %15 = OpIAdd %int %14 %int_7 + OpStore %i %15 + OpBranch %59 + %61 = OpLabel + OpBranch %57 + %62 = OpLabel + %12 = OpLoad %int %i + %13 = OpIAdd %int %12 %int_5 + OpStore %i %13 + OpBranch %59 + %59 = OpLabel + OpBranch %57 + %57 = OpLabel + %16 = OpLoad %int %i + %63 = OpSGreaterThan %bool %16 %int_200 + OpBranchConditional %63 %55 %56 + %56 = OpLabel + %17 = OpLoad %int %i + %64 = OpSGreaterThan %bool %17 %int_100 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + %18 = OpLoad %int %i + %19 = OpISub %int %18 %int_2 + OpStore %i %19 + OpBranch %52 + %65 = OpLabel + OpBranch %53 + %52 = OpLabel + %22 = OpLoad %int %i + %67 = OpIEqual %bool %22 %int_n2 + OpSelectionMerge %68 None + OpBranchConditional %67 %69 %70 + %69 = OpLabel + OpStore %_GLF_color %47 + OpBranch %68 + %70 = OpLabel + OpStore %_GLF_color %48 + OpBranch %68 + %68 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..68b63f97a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.hlsl @@ -0,0 +1,72 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + const float x_51 = asfloat(x_6[0].x); + i = int(x_51); + switch(i) { + case 0: { + while (true) { + i = (i + 1); + switch(i) { + case 2: { + i = (i + 5); + break; + } + case 1: { + { + if ((i > 200)) { + } else { + break; + } + } + continue; + break; + } + default: { + i = (i + 7); + break; + } + } + { + if ((i > 200)) { + } else { + break; + } + } + } + if ((i > 100)) { + i = (i - 2); + break; + } + /* fallthrough */ + } + default: { + i = (i - 3); + break; + } + } + if ((i == -2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..dbb6a91819 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.msl @@ -0,0 +1,86 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + float const x_51 = x_6.injectionSwitch.x; + i = int(x_51); + int const x_8 = i; + switch(x_8) { + case 0: { + while (true) { + int const x_9 = i; + i = (x_9 + 1); + int const x_11 = i; + switch(x_11) { + case 2: { + int const x_12 = i; + i = (x_12 + 5); + break; + } + case 1: { + { + int const x_16 = i; + if ((x_16 > 200)) { + } else { + break; + } + } + continue; + break; + } + default: { + int const x_14 = i; + i = (x_14 + 7); + break; + } + } + { + int const x_16 = i; + if ((x_16 > 200)) { + } else { + break; + } + } + } + int const x_17 = i; + if ((x_17 > 100)) { + int const x_18 = i; + i = (x_18 - 2); + break; + } + /* fallthrough */ + } + default: { + int const x_20 = i; + i = (x_20 - 3); + break; + } + } + int const x_22 = i; + if ((x_22 == -2)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8c6337d0d0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.spvasm @@ -0,0 +1,160 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 88 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_7 = OpConstant %int 7 + %int_200 = OpConstant %int 200 + %bool = OpTypeBool + %int_100 = OpConstant %int 100 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_n2 = OpConstant %int -2 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %74 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %75 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %76 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %i = OpVariable %_ptr_Function_int Function %19 + %23 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %24 = OpLoad %float %23 + %25 = OpConvertFToS %int %24 + OpStore %i %25 + %26 = OpLoad %int %i + OpSelectionMerge %27 None + OpSwitch %26 %28 0 %29 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %36 = OpIAdd %int %34 %int_1 + OpStore %i %36 + %37 = OpLoad %int %i + OpSelectionMerge %38 None + OpSwitch %37 %39 2 %40 1 %41 + %40 = OpLabel + %42 = OpLoad %int %i + %44 = OpIAdd %int %42 %int_5 + OpStore %i %44 + OpBranch %38 + %41 = OpLabel + OpBranch %32 + %39 = OpLabel + %45 = OpLoad %int %i + %47 = OpIAdd %int %45 %int_7 + OpStore %i %47 + OpBranch %38 + %38 = OpLabel + OpBranch %32 + %32 = OpLabel + %48 = OpLoad %int %i + %50 = OpSGreaterThan %bool %48 %int_200 + OpSelectionMerge %52 None + OpBranchConditional %50 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %31 + %52 = OpLabel + OpBranch %30 + %31 = OpLabel + %55 = OpLoad %int %i + %57 = OpSGreaterThan %bool %55 %int_100 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + %60 = OpLoad %int %i + %62 = OpISub %int %60 %int_2 + OpStore %i %62 + OpBranch %27 + %58 = OpLabel + OpBranch %28 + %28 = OpLabel + %63 = OpLoad %int %i + %65 = OpISub %int %63 %int_3 + OpStore %i %65 + OpBranch %27 + %27 = OpLabel + %66 = OpLoad %int %i + %68 = OpIEqual %bool %66 %int_n2 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + OpStore %x_GLF_color %74 + OpBranch %69 + %71 = OpLabel + OpStore %x_GLF_color %75 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %76 +%tint_symbol = OpFunctionParameter %main_out + %80 = OpLabel + %81 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %81 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %83 = OpLabel + %84 = OpFunctionCall %void %main_1 + %86 = OpLoad %v4float %x_GLF_color + %87 = OpCompositeConstruct %main_out %86 + %85 = OpFunctionCall %void %tint_symbol_2 %87 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 32[%32] is not post dominated by the back-edge block 52[%52] + %52 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..8c6c5d7203 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.wgsl @@ -0,0 +1,74 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + let x_51 : f32 = x_6.injectionSwitch.x; + i = i32(x_51); + let x_8 : i32 = i; + switch(x_8) { + case 0: { + loop { + let x_9 : i32 = i; + i = (x_9 + 1); + let x_11 : i32 = i; + switch(x_11) { + case 2: { + let x_12 : i32 = i; + i = (x_12 + 5); + } + case 1: { + continue; + } + default: { + let x_14 : i32 = i; + i = (x_14 + 7); + } + } + + continuing { + let x_16 : i32 = i; + if ((x_16 > 200)) { + } else { + break; + } + } + } + let x_17 : i32 = i; + if ((x_17 > 100)) { + let x_18 : i32 = i; + i = (x_18 - 2); + break; + } + fallthrough; + } + default: { + let x_20 : i32 = i; + i = (x_20 - 3); + } + } + let x_22 : i32 = i; + if ((x_22 == -2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl new file mode 100644 index 0000000000..8c6c5d7203 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl @@ -0,0 +1,74 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + let x_51 : f32 = x_6.injectionSwitch.x; + i = i32(x_51); + let x_8 : i32 = i; + switch(x_8) { + case 0: { + loop { + let x_9 : i32 = i; + i = (x_9 + 1); + let x_11 : i32 = i; + switch(x_11) { + case 2: { + let x_12 : i32 = i; + i = (x_12 + 5); + } + case 1: { + continue; + } + default: { + let x_14 : i32 = i; + i = (x_14 + 7); + } + } + + continuing { + let x_16 : i32 = i; + if ((x_16 > 200)) { + } else { + break; + } + } + } + let x_17 : i32 = i; + if ((x_17 > 100)) { + let x_18 : i32 = i; + i = (x_18 - 2); + break; + } + fallthrough; + } + default: { + let x_20 : i32 = i; + i = (x_20 - 3); + } + } + let x_22 : i32 = i; + if ((x_22 == -2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..68b63f97a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.hlsl @@ -0,0 +1,72 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + const float x_51 = asfloat(x_6[0].x); + i = int(x_51); + switch(i) { + case 0: { + while (true) { + i = (i + 1); + switch(i) { + case 2: { + i = (i + 5); + break; + } + case 1: { + { + if ((i > 200)) { + } else { + break; + } + } + continue; + break; + } + default: { + i = (i + 7); + break; + } + } + { + if ((i > 200)) { + } else { + break; + } + } + } + if ((i > 100)) { + i = (i - 2); + break; + } + /* fallthrough */ + } + default: { + i = (i - 3); + break; + } + } + if ((i == -2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..dbb6a91819 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.msl @@ -0,0 +1,86 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + float const x_51 = x_6.injectionSwitch.x; + i = int(x_51); + int const x_8 = i; + switch(x_8) { + case 0: { + while (true) { + int const x_9 = i; + i = (x_9 + 1); + int const x_11 = i; + switch(x_11) { + case 2: { + int const x_12 = i; + i = (x_12 + 5); + break; + } + case 1: { + { + int const x_16 = i; + if ((x_16 > 200)) { + } else { + break; + } + } + continue; + break; + } + default: { + int const x_14 = i; + i = (x_14 + 7); + break; + } + } + { + int const x_16 = i; + if ((x_16 > 200)) { + } else { + break; + } + } + } + int const x_17 = i; + if ((x_17 > 100)) { + int const x_18 = i; + i = (x_18 - 2); + break; + } + /* fallthrough */ + } + default: { + int const x_20 = i; + i = (x_20 - 3); + break; + } + } + int const x_22 = i; + if ((x_22 == -2)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c6337d0d0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.spvasm @@ -0,0 +1,160 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 88 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 + %int_7 = OpConstant %int 7 + %int_200 = OpConstant %int 200 + %bool = OpTypeBool + %int_100 = OpConstant %int 100 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_n2 = OpConstant %int -2 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %74 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %75 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %76 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %i = OpVariable %_ptr_Function_int Function %19 + %23 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %24 = OpLoad %float %23 + %25 = OpConvertFToS %int %24 + OpStore %i %25 + %26 = OpLoad %int %i + OpSelectionMerge %27 None + OpSwitch %26 %28 0 %29 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %36 = OpIAdd %int %34 %int_1 + OpStore %i %36 + %37 = OpLoad %int %i + OpSelectionMerge %38 None + OpSwitch %37 %39 2 %40 1 %41 + %40 = OpLabel + %42 = OpLoad %int %i + %44 = OpIAdd %int %42 %int_5 + OpStore %i %44 + OpBranch %38 + %41 = OpLabel + OpBranch %32 + %39 = OpLabel + %45 = OpLoad %int %i + %47 = OpIAdd %int %45 %int_7 + OpStore %i %47 + OpBranch %38 + %38 = OpLabel + OpBranch %32 + %32 = OpLabel + %48 = OpLoad %int %i + %50 = OpSGreaterThan %bool %48 %int_200 + OpSelectionMerge %52 None + OpBranchConditional %50 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %31 + %52 = OpLabel + OpBranch %30 + %31 = OpLabel + %55 = OpLoad %int %i + %57 = OpSGreaterThan %bool %55 %int_100 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + %60 = OpLoad %int %i + %62 = OpISub %int %60 %int_2 + OpStore %i %62 + OpBranch %27 + %58 = OpLabel + OpBranch %28 + %28 = OpLabel + %63 = OpLoad %int %i + %65 = OpISub %int %63 %int_3 + OpStore %i %65 + OpBranch %27 + %27 = OpLabel + %66 = OpLoad %int %i + %68 = OpIEqual %bool %66 %int_n2 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %71 + %70 = OpLabel + OpStore %x_GLF_color %74 + OpBranch %69 + %71 = OpLabel + OpStore %x_GLF_color %75 + OpBranch %69 + %69 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %76 +%tint_symbol = OpFunctionParameter %main_out + %80 = OpLabel + %81 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %81 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %83 = OpLabel + %84 = OpFunctionCall %void %main_1 + %86 = OpLoad %v4float %x_GLF_color + %87 = OpCompositeConstruct %main_out %86 + %85 = OpFunctionCall %void %tint_symbol_2 %87 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 32[%32] is not post dominated by the back-edge block 52[%52] + %52 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c6c5d7203 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.wgsl @@ -0,0 +1,74 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + let x_51 : f32 = x_6.injectionSwitch.x; + i = i32(x_51); + let x_8 : i32 = i; + switch(x_8) { + case 0: { + loop { + let x_9 : i32 = i; + i = (x_9 + 1); + let x_11 : i32 = i; + switch(x_11) { + case 2: { + let x_12 : i32 = i; + i = (x_12 + 5); + } + case 1: { + continue; + } + default: { + let x_14 : i32 = i; + i = (x_14 + 7); + } + } + + continuing { + let x_16 : i32 = i; + if ((x_16 > 200)) { + } else { + break; + } + } + } + let x_17 : i32 = i; + if ((x_17 > 100)) { + let x_18 : i32 = i; + i = (x_18 - 2); + break; + } + fallthrough; + } + default: { + let x_20 : i32 = i; + i = (x_20 - 3); + } + } + let x_22 : i32 = i; + if ((x_22 == -2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm new file mode 100644 index 0000000000..87e09856bd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm @@ -0,0 +1,37 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %15 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %5 + %16 = OpLabel + OpSelectionMerge %17 None + OpSwitch %int_0 %17 0 %18 + %18 = OpLabel + OpSelectionMerge %19 None + OpBranchConditional %false %20 %19 + %20 = OpLabel + OpBranch %19 + %19 = OpLabel + OpBranch %17 + %17 = OpLabel + OpStore %_GLF_color %15 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..3d1073726b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.hlsl @@ -0,0 +1,30 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + switch(0) { + case 0: { + if (false) { + } + break; + } + default: { + break; + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.msl new file mode 100644 index 0000000000..0c08cdc001 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + switch(0) { + case 0: { + if (false) { + } + break; + } + default: { + break; + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..f8108c82a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %24 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + OpSelectionMerge %12 None + OpSwitch %int_0 %15 0 %16 + %16 = OpLabel + OpSelectionMerge %19 None + OpBranchConditional %false %20 %19 + %20 = OpLabel + OpBranch %19 + %19 = OpLabel + OpBranch %12 + %15 = OpLabel + OpBranch %12 + %12 = OpLabel + OpStore %x_GLF_color %23 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %24 +%tint_symbol = OpFunctionParameter %main_out + %28 = OpLabel + %29 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %29 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %31 = OpLabel + %32 = OpFunctionCall %void %main_1 + %34 = OpLoad %v4float %x_GLF_color + %35 = OpCompositeConstruct %main_out %34 + %33 = OpFunctionCall %void %tint_symbol_2 %35 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..cdab78bd87 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +var x_GLF_color : vec4; + +fn main_1() { + switch(0) { + case 0: { + if (false) { + } + } + default: { + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl new file mode 100644 index 0000000000..cdab78bd87 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl @@ -0,0 +1,25 @@ +var x_GLF_color : vec4; + +fn main_1() { + switch(0) { + case 0: { + if (false) { + } + } + default: { + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..3d1073726b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.hlsl @@ -0,0 +1,30 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + switch(0) { + case 0: { + if (false) { + } + break; + } + default: { + break; + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.msl new file mode 100644 index 0000000000..0c08cdc001 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + switch(0) { + case 0: { + if (false) { + } + break; + } + default: { + break; + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..f8108c82a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %24 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + OpSelectionMerge %12 None + OpSwitch %int_0 %15 0 %16 + %16 = OpLabel + OpSelectionMerge %19 None + OpBranchConditional %false %20 %19 + %20 = OpLabel + OpBranch %19 + %19 = OpLabel + OpBranch %12 + %15 = OpLabel + OpBranch %12 + %12 = OpLabel + OpStore %x_GLF_color %23 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %24 +%tint_symbol = OpFunctionParameter %main_out + %28 = OpLabel + %29 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %29 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %31 = OpLabel + %32 = OpFunctionCall %void %main_1 + %34 = OpLoad %v4float %x_GLF_color + %35 = OpCompositeConstruct %main_out %34 + %33 = OpFunctionCall %void %tint_symbol_2 %35 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..cdab78bd87 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-empty-if-false/0.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +var x_GLF_color : vec4; + +fn main_1() { + switch(0) { + case 0: { + if (false) { + } + } + default: { + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm new file mode 100644 index 0000000000..20a942dccd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm @@ -0,0 +1,96 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %value "value" + OpName %y "y" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %main = OpFunction %void None %10 + %29 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %value = OpVariable %_ptr_Function_int Function + %y = OpVariable %_ptr_Function_float Function + OpStore %i %int_0 + OpBranch %30 + %30 = OpLabel + %31 = OpPhi %int %int_0 %29 %32 %33 + OpLoopMerge %34 %33 None + OpBranch %35 + %35 = OpLabel + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %37 = OpLoad %float %36 + %38 = OpConvertFToS %int %37 + %39 = OpIAdd %int %int_2 %38 + %40 = OpSLessThan %bool %31 %39 + OpBranchConditional %40 %41 %34 + %41 = OpLabel + OpStore %value %31 + OpStore %y %float_0_5 + OpSelectionMerge %42 None + OpSwitch %31 %43 0 %44 1 %45 2 %43 + %43 = OpLabel + %46 = OpPhi %float %float_0_5 %41 %47 %45 + %48 = OpFOrdEqual %bool %46 %float_1 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + %51 = OpIAdd %int %31 %int_1 + %52 = OpConvertSToF %float %51 + %53 = OpCompositeConstruct %v4float %52 %float_0 %float_0 %float_1 + OpStore %_GLF_color %53 + OpReturn + %49 = OpLabel + OpBranch %42 + %44 = OpLabel + %54 = OpFAdd %float %float_0_5 %float_0_5 + OpStore %y %54 + OpBranch %45 + %45 = OpLabel + %55 = OpPhi %float %float_0_5 %41 %54 %44 + %47 = OpExtInst %float %1 FClamp %float_1 %float_0_5 %55 + OpStore %y %47 + OpBranch %43 + %42 = OpLabel + OpBranch %33 + %33 = OpLabel + %32 = OpIAdd %int %31 %int_1 + OpStore %i %32 + OpBranch %30 + %34 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..437ce7447b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.hlsl @@ -0,0 +1,71 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int value = 0; + float y = 0.0f; + int x_31_phi = 0; + i = 0; + x_31_phi = 0; + while (true) { + const int x_31 = x_31_phi; + const float x_37 = asfloat(x_6[0].x); + if ((x_31 < (2 + int(x_37)))) { + } else { + break; + } + float x_55_phi = 0.0f; + float x_46_phi = 0.0f; + value = x_31; + y = 0.5f; + x_55_phi = 0.5f; + x_46_phi = 0.5f; + switch(x_31) { + case 0: { + const float x_54 = (0.5f + 0.5f); + y = x_54; + x_55_phi = x_54; + /* fallthrough */ + } + case 1: { + const float x_47 = clamp(1.0f, 0.5f, x_55_phi); + y = x_47; + x_46_phi = x_47; + /* fallthrough */ + } + default: { + /* fallthrough */ + } + case 2: { + if ((x_46_phi == 1.0f)) { + x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f); + return; + } + break; + } + } + { + const int x_32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..084529b486 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.msl @@ -0,0 +1,76 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + int value = 0; + float y = 0.0f; + int x_31_phi = 0; + i = 0; + x_31_phi = 0; + while (true) { + int const x_31 = x_31_phi; + float const x_37 = x_6.injectionSwitch.x; + if ((x_31 < (2 + int(x_37)))) { + } else { + break; + } + float x_55_phi = 0.0f; + float x_46_phi = 0.0f; + value = x_31; + y = 0.5f; + x_55_phi = 0.5f; + x_46_phi = 0.5f; + switch(x_31) { + case 0: { + float const x_54 = (0.5f + 0.5f); + y = x_54; + x_55_phi = x_54; + /* fallthrough */ + } + case 1: { + float const x_55 = x_55_phi; + float const x_47 = clamp(1.0f, 0.5f, x_55); + y = x_47; + x_46_phi = x_47; + /* fallthrough */ + } + default: { + /* fallthrough */ + } + case 2: { + float const x_46 = x_46_phi; + if ((x_46 == 1.0f)) { + *(tint_symbol_4) = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f); + return; + } + break; + } + } + { + int const x_32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..387a26aac9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.spvasm @@ -0,0 +1,149 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %55 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %value "value" + OpName %y "y" + OpName %x_31_phi "x_31_phi" + OpName %x_55_phi "x_55_phi" + OpName %x_46_phi "x_46_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %23 = OpConstantNull %float + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %i = OpVariable %_ptr_Function_int Function %19 + %value = OpVariable %_ptr_Function_int Function %19 + %y = OpVariable %_ptr_Function_float Function %23 + %x_31_phi = OpVariable %_ptr_Function_int Function %19 + %x_55_phi = OpVariable %_ptr_Function_float Function %23 + %x_46_phi = OpVariable %_ptr_Function_float Function %23 + OpStore %i %int_0 + OpStore %x_31_phi %int_0 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %x_31_phi + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %35 = OpLoad %float %34 + %37 = OpConvertFToS %int %35 + %38 = OpIAdd %int %int_2 %37 + %39 = OpSLessThan %bool %30 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %27 + %41 = OpLabel + OpStore %value %30 + OpStore %y %float_0_5 + OpStore %x_55_phi %float_0_5 + OpStore %x_46_phi %float_0_5 + OpSelectionMerge %47 None + OpSwitch %30 %48 0 %49 1 %50 2 %51 + %49 = OpLabel + %52 = OpFAdd %float %float_0_5 %float_0_5 + OpStore %y %52 + OpStore %x_55_phi %52 + OpBranch %50 + %50 = OpLabel + %53 = OpLoad %float %x_55_phi + %54 = OpExtInst %float %55 NClamp %float_1 %float_0_5 %53 + OpStore %y %54 + OpStore %x_46_phi %54 + OpBranch %48 + %48 = OpLabel + OpBranch %51 + %51 = OpLabel + %57 = OpLoad %float %x_46_phi + %58 = OpFOrdEqual %bool %57 %float_1 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + %63 = OpIAdd %int %30 %int_1 + %61 = OpConvertSToF %float %63 + %65 = OpCompositeConstruct %v4float %61 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %65 + OpReturn + %59 = OpLabel + OpBranch %47 + %47 = OpLabel + OpBranch %28 + %28 = OpLabel + %66 = OpIAdd %int %30 %int_1 + OpStore %i %66 + OpStore %x_31_phi %66 + OpBranch %26 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..b469ccc25c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.wgsl @@ -0,0 +1,74 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var value : i32; + var y : f32; + var x_31_phi : i32; + i = 0; + x_31_phi = 0; + loop { + let x_31 : i32 = x_31_phi; + let x_37 : f32 = x_6.injectionSwitch.x; + if ((x_31 < (2 + i32(x_37)))) { + } else { + break; + } + var x_55_phi : f32; + var x_46_phi : f32; + value = x_31; + y = 0.5; + x_55_phi = 0.5; + x_46_phi = 0.5; + switch(x_31) { + case 0: { + let x_54 : f32 = (0.5 + 0.5); + y = x_54; + x_55_phi = x_54; + fallthrough; + } + case 1: { + let x_55 : f32 = x_55_phi; + let x_47 : f32 = clamp(1.0, 0.5, x_55); + y = x_47; + x_46_phi = x_47; + fallthrough; + } + default: { + fallthrough; + } + case 2: { + let x_46 : f32 = x_46_phi; + if ((x_46 == 1.0)) { + x_GLF_color = vec4(f32((x_31 + 1)), 0.0, 0.0, 1.0); + return; + } + } + } + + continuing { + let x_32 : i32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl new file mode 100644 index 0000000000..b469ccc25c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl @@ -0,0 +1,74 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var value : i32; + var y : f32; + var x_31_phi : i32; + i = 0; + x_31_phi = 0; + loop { + let x_31 : i32 = x_31_phi; + let x_37 : f32 = x_6.injectionSwitch.x; + if ((x_31 < (2 + i32(x_37)))) { + } else { + break; + } + var x_55_phi : f32; + var x_46_phi : f32; + value = x_31; + y = 0.5; + x_55_phi = 0.5; + x_46_phi = 0.5; + switch(x_31) { + case 0: { + let x_54 : f32 = (0.5 + 0.5); + y = x_54; + x_55_phi = x_54; + fallthrough; + } + case 1: { + let x_55 : f32 = x_55_phi; + let x_47 : f32 = clamp(1.0, 0.5, x_55); + y = x_47; + x_46_phi = x_47; + fallthrough; + } + default: { + fallthrough; + } + case 2: { + let x_46 : f32 = x_46_phi; + if ((x_46 == 1.0)) { + x_GLF_color = vec4(f32((x_31 + 1)), 0.0, 0.0, 1.0); + return; + } + } + } + + continuing { + let x_32 : i32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..437ce7447b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.hlsl @@ -0,0 +1,71 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + int value = 0; + float y = 0.0f; + int x_31_phi = 0; + i = 0; + x_31_phi = 0; + while (true) { + const int x_31 = x_31_phi; + const float x_37 = asfloat(x_6[0].x); + if ((x_31 < (2 + int(x_37)))) { + } else { + break; + } + float x_55_phi = 0.0f; + float x_46_phi = 0.0f; + value = x_31; + y = 0.5f; + x_55_phi = 0.5f; + x_46_phi = 0.5f; + switch(x_31) { + case 0: { + const float x_54 = (0.5f + 0.5f); + y = x_54; + x_55_phi = x_54; + /* fallthrough */ + } + case 1: { + const float x_47 = clamp(1.0f, 0.5f, x_55_phi); + y = x_47; + x_46_phi = x_47; + /* fallthrough */ + } + default: { + /* fallthrough */ + } + case 2: { + if ((x_46_phi == 1.0f)) { + x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f); + return; + } + break; + } + } + { + const int x_32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..084529b486 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.msl @@ -0,0 +1,76 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int i = 0; + int value = 0; + float y = 0.0f; + int x_31_phi = 0; + i = 0; + x_31_phi = 0; + while (true) { + int const x_31 = x_31_phi; + float const x_37 = x_6.injectionSwitch.x; + if ((x_31 < (2 + int(x_37)))) { + } else { + break; + } + float x_55_phi = 0.0f; + float x_46_phi = 0.0f; + value = x_31; + y = 0.5f; + x_55_phi = 0.5f; + x_46_phi = 0.5f; + switch(x_31) { + case 0: { + float const x_54 = (0.5f + 0.5f); + y = x_54; + x_55_phi = x_54; + /* fallthrough */ + } + case 1: { + float const x_55 = x_55_phi; + float const x_47 = clamp(1.0f, 0.5f, x_55); + y = x_47; + x_46_phi = x_47; + /* fallthrough */ + } + default: { + /* fallthrough */ + } + case 2: { + float const x_46 = x_46_phi; + if ((x_46 == 1.0f)) { + *(tint_symbol_4) = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f); + return; + } + break; + } + } + { + int const x_32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..387a26aac9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.spvasm @@ -0,0 +1,149 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %55 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %value "value" + OpName %y "y" + OpName %x_31_phi "x_31_phi" + OpName %x_55_phi "x_55_phi" + OpName %x_46_phi "x_46_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %23 = OpConstantNull %float + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %i = OpVariable %_ptr_Function_int Function %19 + %value = OpVariable %_ptr_Function_int Function %19 + %y = OpVariable %_ptr_Function_float Function %23 + %x_31_phi = OpVariable %_ptr_Function_int Function %19 + %x_55_phi = OpVariable %_ptr_Function_float Function %23 + %x_46_phi = OpVariable %_ptr_Function_float Function %23 + OpStore %i %int_0 + OpStore %x_31_phi %int_0 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %x_31_phi + %34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %35 = OpLoad %float %34 + %37 = OpConvertFToS %int %35 + %38 = OpIAdd %int %int_2 %37 + %39 = OpSLessThan %bool %30 %38 + OpSelectionMerge %41 None + OpBranchConditional %39 %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %27 + %41 = OpLabel + OpStore %value %30 + OpStore %y %float_0_5 + OpStore %x_55_phi %float_0_5 + OpStore %x_46_phi %float_0_5 + OpSelectionMerge %47 None + OpSwitch %30 %48 0 %49 1 %50 2 %51 + %49 = OpLabel + %52 = OpFAdd %float %float_0_5 %float_0_5 + OpStore %y %52 + OpStore %x_55_phi %52 + OpBranch %50 + %50 = OpLabel + %53 = OpLoad %float %x_55_phi + %54 = OpExtInst %float %55 NClamp %float_1 %float_0_5 %53 + OpStore %y %54 + OpStore %x_46_phi %54 + OpBranch %48 + %48 = OpLabel + OpBranch %51 + %51 = OpLabel + %57 = OpLoad %float %x_46_phi + %58 = OpFOrdEqual %bool %57 %float_1 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + %63 = OpIAdd %int %30 %int_1 + %61 = OpConvertSToF %float %63 + %65 = OpCompositeConstruct %v4float %61 %float_0 %float_0 %float_1 + OpStore %x_GLF_color %65 + OpReturn + %59 = OpLabel + OpBranch %47 + %47 = OpLabel + OpBranch %28 + %28 = OpLabel + %66 = OpIAdd %int %30 %int_1 + OpStore %i %66 + OpStore %x_31_phi %66 + OpBranch %26 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..b469ccc25c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.wgsl @@ -0,0 +1,74 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var value : i32; + var y : f32; + var x_31_phi : i32; + i = 0; + x_31_phi = 0; + loop { + let x_31 : i32 = x_31_phi; + let x_37 : f32 = x_6.injectionSwitch.x; + if ((x_31 < (2 + i32(x_37)))) { + } else { + break; + } + var x_55_phi : f32; + var x_46_phi : f32; + value = x_31; + y = 0.5; + x_55_phi = 0.5; + x_46_phi = 0.5; + switch(x_31) { + case 0: { + let x_54 : f32 = (0.5 + 0.5); + y = x_54; + x_55_phi = x_54; + fallthrough; + } + case 1: { + let x_55 : f32 = x_55_phi; + let x_47 : f32 = clamp(1.0, 0.5, x_55); + y = x_47; + x_46_phi = x_47; + fallthrough; + } + default: { + fallthrough; + } + case 2: { + let x_46 : f32 = x_46_phi; + if ((x_46 == 1.0)) { + x_GLF_color = vec4(f32((x_31 + 1)), 0.0, 0.0, 1.0); + return; + } + } + } + + continuing { + let x_32 : i32 = (x_31 + 1); + i = x_32; + x_31_phi = x_32; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm new file mode 100644 index 0000000000..c5e0d326db --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm @@ -0,0 +1,77 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %_GLF_color Location 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %14 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%mat4v3float = OpTypeMatrix %v3float 4 + %20 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %21 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %22 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %23 = OpConstantComposite %mat4v3float %14 %20 %21 %22 +%mat3v4float = OpTypeMatrix %v4float 3 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_0 + %26 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_0 + %27 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_0 + %28 = OpConstantComposite %mat3v4float %25 %26 %27 + %29 = OpUndef %v3float + %main = OpFunction %void None %6 + %30 = OpLabel + %31 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %32 = OpLoad %float %31 + %33 = OpFOrdLessThan %bool %32 %float_1 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %36 + %35 = OpLabel + OpBranch %34 + %36 = OpLabel + %37 = OpTranspose %mat4v3float %28 + OpBranch %34 + %34 = OpLabel + %38 = OpPhi %mat4v3float %23 %35 %37 %36 + %39 = OpTranspose %mat3v4float %38 + %40 = OpCompositeExtract %float %39 0 1 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpFOrdGreaterThan %bool %40 %float_1 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + OpBranch %42 + %46 = OpLabel + OpBranch %42 + %43 = OpLabel + OpBranch %41 + %42 = OpLabel + %48 = OpPhi %v3float %29 %47 %14 %46 + %49 = OpCompositeExtract %float %48 0 + %50 = OpCompositeExtract %float %48 1 + %51 = OpCompositeExtract %float %48 2 + %52 = OpCompositeConstruct %v4float %49 %50 %51 %float_1 + OpStore %_GLF_color %52 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..2999e7dbad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.hlsl @@ -0,0 +1,46 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x3 x_37 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x3 x_38_phi = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3 x_48_phi = float3(0.0f, 0.0f, 0.0f); + const float x_32 = gl_FragCoord.y; + if ((x_32 < 1.0f)) { + x_38_phi = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); + } else { + x_37 = transpose(float3x4(float4(1.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 1.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 1.0f, 0.0f))); + x_38_phi = x_37; + } + const float x_40 = transpose(x_38_phi)[0u].y; + while (true) { + if ((x_40 > 1.0f)) { + x_48_phi = float3(0.0f, 0.0f, 0.0f); + break; + } + x_48_phi = float3(1.0f, 0.0f, 0.0f); + break; + } + const float3 x_48 = x_48_phi; + x_GLF_color = float4(x_48.x, x_48.y, x_48.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.msl new file mode 100644 index 0000000000..f58d0acd2d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float4x3 x_37 = float4x3(0.0f); + float4x3 x_38_phi = float4x3(0.0f); + float3 x_48_phi = 0.0f; + float const x_32 = (*(tint_symbol_5)).y; + if ((x_32 < 1.0f)) { + x_38_phi = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); + } else { + x_37 = transpose(float3x4(float4(1.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 1.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 1.0f, 0.0f))); + x_38_phi = x_37; + } + float4x3 const x_38 = x_38_phi; + float const x_40 = transpose(x_38)[0u].y; + while (true) { + if ((x_40 > 1.0f)) { + x_48_phi = float3(0.0f, 0.0f, 0.0f); + break; + } + x_48_phi = float3(1.0f, 0.0f, 0.0f); + break; + } + float3 const x_48 = x_48_phi; + *(tint_symbol_6) = float4(x_48.x, x_48.y, x_48.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..7ed4633414 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_37 "x_37" + OpName %x_38_phi "x_38_phi" + OpName %x_48_phi "x_48_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %19 = OpConstantNull %mat4v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %23 = OpConstantNull %v3float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %37 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %38 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %39 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %40 = OpConstantComposite %mat4v3float %36 %37 %38 %39 +%mat3v4float = OpTypeMatrix %v4float 3 + %43 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_0 + %44 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_0 + %45 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_0 + %46 = OpConstantComposite %mat3v4float %43 %44 %45 + %uint_0 = OpConstant %uint 0 + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_37 = OpVariable %_ptr_Function_mat4v3float Function %19 + %x_38_phi = OpVariable %_ptr_Function_mat4v3float Function %19 + %x_48_phi = OpVariable %_ptr_Function_v3float Function %23 + %27 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %28 = OpLoad %float %27 + %30 = OpFOrdLessThan %bool %28 %float_1 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpStore %x_38_phi %40 + OpBranch %32 + %34 = OpLabel + %41 = OpTranspose %mat4v3float %46 + OpStore %x_37 %41 + %47 = OpLoad %mat4v3float %x_37 + OpStore %x_38_phi %47 + OpBranch %32 + %32 = OpLabel + %48 = OpLoad %mat4v3float %x_38_phi + %49 = OpTranspose %mat3v4float %48 + %51 = OpCompositeExtract %v4float %49 0 + %52 = OpCompositeExtract %float %51 1 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpFOrdGreaterThan %bool %52 %float_1 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + OpStore %x_48_phi %39 + OpBranch %54 + %58 = OpLabel + OpStore %x_48_phi %36 + OpBranch %54 + %55 = OpLabel + OpBranch %53 + %54 = OpLabel + %60 = OpLoad %v3float %x_48_phi + %61 = OpCompositeExtract %float %60 0 + %62 = OpCompositeExtract %float %60 1 + %63 = OpCompositeExtract %float %60 2 + %64 = OpCompositeConstruct %v4float %61 %62 %63 %float_1 + OpStore %x_GLF_color %64 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %65 +%tint_symbol_1 = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %72 = OpLabel + %73 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %73 + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_3 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..cf0d932758 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.spvasm.expected.wgsl @@ -0,0 +1,41 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var x_37 : mat4x3; + var x_38_phi : mat4x3; + var x_48_phi : vec3; + let x_32 : f32 = gl_FragCoord.y; + if ((x_32 < 1.0)) { + x_38_phi = mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0)); + } else { + x_37 = transpose(mat3x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0))); + x_38_phi = x_37; + } + let x_38 : mat4x3 = x_38_phi; + let x_40 : f32 = transpose(x_38)[0u].y; + loop { + if ((x_40 > 1.0)) { + x_48_phi = vec3(0.0, 0.0, 0.0); + break; + } + x_48_phi = vec3(1.0, 0.0, 0.0); + break; + } + let x_48 : vec3 = x_48_phi; + x_GLF_color = vec4(x_48.x, x_48.y, x_48.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl new file mode 100644 index 0000000000..cf0d932758 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl @@ -0,0 +1,41 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var x_37 : mat4x3; + var x_38_phi : mat4x3; + var x_48_phi : vec3; + let x_32 : f32 = gl_FragCoord.y; + if ((x_32 < 1.0)) { + x_38_phi = mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0)); + } else { + x_37 = transpose(mat3x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0))); + x_38_phi = x_37; + } + let x_38 : mat4x3 = x_38_phi; + let x_40 : f32 = transpose(x_38)[0u].y; + loop { + if ((x_40 > 1.0)) { + x_48_phi = vec3(0.0, 0.0, 0.0); + break; + } + x_48_phi = vec3(1.0, 0.0, 0.0); + break; + } + let x_48 : vec3 = x_48_phi; + x_GLF_color = vec4(x_48.x, x_48.y, x_48.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..2999e7dbad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.hlsl @@ -0,0 +1,46 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x3 x_37 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float4x3 x_38_phi = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + float3 x_48_phi = float3(0.0f, 0.0f, 0.0f); + const float x_32 = gl_FragCoord.y; + if ((x_32 < 1.0f)) { + x_38_phi = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); + } else { + x_37 = transpose(float3x4(float4(1.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 1.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 1.0f, 0.0f))); + x_38_phi = x_37; + } + const float x_40 = transpose(x_38_phi)[0u].y; + while (true) { + if ((x_40 > 1.0f)) { + x_48_phi = float3(0.0f, 0.0f, 0.0f); + break; + } + x_48_phi = float3(1.0f, 0.0f, 0.0f); + break; + } + const float3 x_48 = x_48_phi; + x_GLF_color = float4(x_48.x, x_48.y, x_48.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.msl new file mode 100644 index 0000000000..f58d0acd2d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float4x3 x_37 = float4x3(0.0f); + float4x3 x_38_phi = float4x3(0.0f); + float3 x_48_phi = 0.0f; + float const x_32 = (*(tint_symbol_5)).y; + if ((x_32 < 1.0f)) { + x_38_phi = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); + } else { + x_37 = transpose(float3x4(float4(1.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 1.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 1.0f, 0.0f))); + x_38_phi = x_37; + } + float4x3 const x_38 = x_38_phi; + float const x_40 = transpose(x_38)[0u].y; + while (true) { + if ((x_40 > 1.0f)) { + x_48_phi = float3(0.0f, 0.0f, 0.0f); + break; + } + x_48_phi = float3(1.0f, 0.0f, 0.0f); + break; + } + float3 const x_48 = x_48_phi; + *(tint_symbol_6) = float4(x_48.x, x_48.y, x_48.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..7ed4633414 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.spvasm @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_37 "x_37" + OpName %x_38_phi "x_38_phi" + OpName %x_48_phi "x_48_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %19 = OpConstantNull %mat4v3float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %23 = OpConstantNull %v3float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_float = OpTypePointer Private %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %36 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %37 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %38 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %39 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %40 = OpConstantComposite %mat4v3float %36 %37 %38 %39 +%mat3v4float = OpTypeMatrix %v4float 3 + %43 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_0 + %44 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_0 + %45 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_0 + %46 = OpConstantComposite %mat3v4float %43 %44 %45 + %uint_0 = OpConstant %uint 0 + %main_out = OpTypeStruct %v4float + %65 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_37 = OpVariable %_ptr_Function_mat4v3float Function %19 + %x_38_phi = OpVariable %_ptr_Function_mat4v3float Function %19 + %x_48_phi = OpVariable %_ptr_Function_v3float Function %23 + %27 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %28 = OpLoad %float %27 + %30 = OpFOrdLessThan %bool %28 %float_1 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + OpStore %x_38_phi %40 + OpBranch %32 + %34 = OpLabel + %41 = OpTranspose %mat4v3float %46 + OpStore %x_37 %41 + %47 = OpLoad %mat4v3float %x_37 + OpStore %x_38_phi %47 + OpBranch %32 + %32 = OpLabel + %48 = OpLoad %mat4v3float %x_38_phi + %49 = OpTranspose %mat3v4float %48 + %51 = OpCompositeExtract %v4float %49 0 + %52 = OpCompositeExtract %float %51 1 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpFOrdGreaterThan %bool %52 %float_1 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + OpStore %x_48_phi %39 + OpBranch %54 + %58 = OpLabel + OpStore %x_48_phi %36 + OpBranch %54 + %55 = OpLabel + OpBranch %53 + %54 = OpLabel + %60 = OpLoad %v3float %x_48_phi + %61 = OpCompositeExtract %float %60 0 + %62 = OpCompositeExtract %float %60 1 + %63 = OpCompositeExtract %float %60 2 + %64 = OpCompositeConstruct %v4float %61 %62 %63 %float_1 + OpStore %x_GLF_color %64 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %65 +%tint_symbol_1 = OpFunctionParameter %main_out + %69 = OpLabel + %70 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %70 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %72 = OpLabel + %73 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %73 + %74 = OpFunctionCall %void %main_1 + %76 = OpLoad %v4float %x_GLF_color + %77 = OpCompositeConstruct %main_out %76 + %75 = OpFunctionCall %void %tint_symbol_3 %77 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..cf0d932758 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/transpose-rectangular-matrix/0.wgsl.expected.wgsl @@ -0,0 +1,41 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var x_37 : mat4x3; + var x_38_phi : mat4x3; + var x_48_phi : vec3; + let x_32 : f32 = gl_FragCoord.y; + if ((x_32 < 1.0)) { + x_38_phi = mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0)); + } else { + x_37 = transpose(mat3x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0))); + x_38_phi = x_37; + } + let x_38 : mat4x3 = x_38_phi; + let x_40 : f32 = transpose(x_38)[0u].y; + loop { + if ((x_40 > 1.0)) { + x_48_phi = vec3(0.0, 0.0, 0.0); + break; + } + x_48_phi = vec3(1.0, 0.0, 0.0); + break; + } + let x_48 : vec3 = x_48_phi; + x_GLF_color = vec4(x_48.x, x_48.y, x_48.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm new file mode 100644 index 0000000000..489ba288a1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm @@ -0,0 +1,211 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %odd_index "odd_index" + OpName %even_index "even_index" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %j "j" + OpName %ll "ll" + OpDecorate %_GLF_color Location 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %odd_index RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %even_index RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %15 RelaxedPrecision + OpDecorate %j RelaxedPrecision + OpDecorate %ll RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + %void = OpTypeVoid + %25 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %bool = OpTypeBool +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_128 = OpConstant %float 128 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_0_25 = OpConstant %float 0.25 +%_ptr_Output_float = OpTypePointer Output %float + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %int_3 = OpConstant %int 3 + %50 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %25 + %51 = OpLabel + %odd_index = OpVariable %_ptr_Function_int Function + %even_index = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %ll = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %31 + %52 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %53 = OpLoad %float %52 + %54 = OpFOrdLessThan %bool %53 %float_128 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %55 + %56 = OpLabel + %57 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %58 = OpLoad %float %57 + %59 = OpFOrdLessThan %bool %58 %float_128 + OpBranch %55 + %55 = OpLabel + %60 = OpPhi %bool %54 %51 %59 %56 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpReturn + %61 = OpLabel + OpStore %odd_index %int_0 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %11 = OpLoad %int %odd_index + %67 = OpSLessThanEqual %bool %11 %int_1 + OpBranchConditional %67 %68 %64 + %68 = OpLabel + %69 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_0 + %70 = OpLoad %float %69 + %71 = OpFAdd %float %70 %float_0_25 + %72 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_0 + OpStore %72 %71 + %12 = OpLoad %int %odd_index + %13 = OpIAdd %int %12 %int_1 + OpStore %odd_index %13 + OpBranch %65 + %65 = OpLabel + OpBranch %63 + %64 = OpLabel + OpStore %even_index %int_1 + OpBranch %73 + %73 = OpLabel + OpLoopMerge %74 %75 None + OpBranch %76 + %76 = OpLabel + %14 = OpLoad %int %even_index + %77 = OpSGreaterThanEqual %bool %14 %int_0 + OpBranchConditional %77 %78 %74 + %78 = OpLabel + %79 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_0 + %80 = OpLoad %float %79 + %81 = OpFAdd %float %80 %float_0_25 + %82 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_0 + OpStore %82 %81 + %83 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %84 = OpLoad %float %83 + %85 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %86 = OpLoad %float %85 + %87 = OpFOrdGreaterThan %bool %84 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + OpBranch %75 + %88 = OpLabel + %15 = OpLoad %int %even_index + %90 = OpSGreaterThanEqual %bool %15 %int_1 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %91 + %92 = OpLabel + OpKill + %91 = OpLabel + OpStore %j %int_1 + OpBranch %93 + %93 = OpLabel + OpLoopMerge %94 %95 None + OpBranch %96 + %96 = OpLabel + OpBranchConditional %true %97 %94 + %97 = OpLabel + %16 = OpLoad %int %ll + %98 = OpSGreaterThanEqual %bool %16 %int_3 + OpSelectionMerge %99 None + OpBranchConditional %98 %100 %99 + %100 = OpLabel + OpBranch %94 + %99 = OpLabel + %17 = OpLoad %int %ll + %18 = OpIAdd %int %17 %int_1 + OpStore %ll %18 + %19 = OpLoad %int %j + %101 = OpBitcast %uint %19 + %102 = OpULessThan %bool %101 %uint_1 + OpSelectionMerge %103 None + OpBranchConditional %102 %104 %103 + %104 = OpLabel + OpBranch %95 + %103 = OpLabel + %105 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %106 = OpLoad %float %105 + %107 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %108 = OpLoad %float %107 + %109 = OpFOrdGreaterThan %bool %106 %108 + OpSelectionMerge %110 None + OpBranchConditional %109 %111 %110 + %111 = OpLabel + OpBranch %94 + %110 = OpLabel + OpBranch %95 + %95 = OpLabel + %20 = OpLoad %int %j + %21 = OpIAdd %int %20 %int_1 + OpStore %j %21 + OpBranch %93 + %94 = OpLabel + %112 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %113 = OpLoad %float %112 + %114 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %115 = OpLoad %float %114 + %116 = OpFOrdGreaterThan %bool %113 %115 + OpSelectionMerge %117 None + OpBranchConditional %116 %118 %117 + %118 = OpLabel + OpStore %_GLF_color %50 + OpBranch %117 + %117 = OpLabel + %22 = OpLoad %int %even_index + %23 = OpISub %int %22 %int_1 + OpStore %even_index %23 + OpBranch %75 + %75 = OpLabel + OpBranch %73 + %74 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..e97beb75ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.hlsl @@ -0,0 +1,96 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; + +void main_1() { + int odd_index = 0; + int even_index = 0; + int j = 0; + int ll = 0; + bool x_59 = false; + bool x_60_phi = false; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_53 = gl_FragCoord.x; + const bool x_54 = (x_53 < 128.0f); + x_60_phi = x_54; + if (x_54) { + const float x_58 = gl_FragCoord.y; + x_59 = (x_58 < 128.0f); + x_60_phi = x_59; + } + if (x_60_phi) { + return; + } + odd_index = 0; + while (true) { + if ((odd_index <= 1)) { + } else { + break; + } + const float x_70 = x_GLF_color.x; + x_GLF_color.x = (x_70 + 0.25f); + odd_index = (odd_index + 1); + } + even_index = 1; + while (true) { + if ((even_index >= 0)) { + } else { + break; + } + const float x_80 = x_GLF_color.x; + x_GLF_color.x = (x_80 + 0.25f); + const float x_84 = asfloat(x_8[0].x); + const float x_86 = asfloat(x_8[0].y); + if ((x_84 > x_86)) { + continue; + } + if ((even_index >= 1)) { + discard; + } + j = 1; + { + for(; true; j = (j + 1)) { + if ((ll >= 3)) { + break; + } + ll = (ll + 1); + if ((asuint(j) < 1u)) { + continue; + } + const float x_106 = asfloat(x_8[0].x); + const float x_108 = asfloat(x_8[0].y); + if ((x_106 > x_108)) { + break; + } + } + } + const float x_113 = asfloat(x_8[0].x); + const float x_115 = asfloat(x_8[0].y); + if ((x_113 > x_115)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + even_index = (even_index - 1); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..67500c562d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.msl @@ -0,0 +1,114 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int odd_index = 0; + int even_index = 0; + int j = 0; + int ll = 0; + bool x_59 = false; + bool x_60_phi = false; + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + float const x_53 = (*(tint_symbol_6)).x; + bool const x_54 = (x_53 < 128.0f); + x_60_phi = x_54; + if (x_54) { + float const x_58 = (*(tint_symbol_6)).y; + x_59 = (x_58 < 128.0f); + x_60_phi = x_59; + } + bool const x_60 = x_60_phi; + if (x_60) { + return; + } + odd_index = 0; + while (true) { + int const x_11 = odd_index; + if ((x_11 <= 1)) { + } else { + break; + } + float const x_70 = (*(tint_symbol_5)).x; + (*(tint_symbol_5)).x = (x_70 + 0.25f); + int const x_12 = odd_index; + odd_index = (x_12 + 1); + } + even_index = 1; + while (true) { + int const x_14 = even_index; + if ((x_14 >= 0)) { + } else { + break; + } + float const x_80 = (*(tint_symbol_5)).x; + (*(tint_symbol_5)).x = (x_80 + 0.25f); + float const x_84 = x_8.injectionSwitch.x; + float const x_86 = x_8.injectionSwitch.y; + if ((x_84 > x_86)) { + continue; + } + int const x_15 = even_index; + if ((x_15 >= 1)) { + discard_fragment(); + } + j = 1; + while (true) { + if (true) { + } else { + break; + } + int const x_16 = ll; + if ((x_16 >= 3)) { + break; + } + int const x_17 = ll; + ll = (x_17 + 1); + int const x_19 = j; + if ((as_type(x_19) < 1u)) { + { + int const x_20 = j; + j = (x_20 + 1); + } + continue; + } + float const x_106 = x_8.injectionSwitch.x; + float const x_108 = x_8.injectionSwitch.y; + if ((x_106 > x_108)) { + break; + } + { + int const x_20 = j; + j = (x_20 + 1); + } + } + float const x_113 = x_8.injectionSwitch.x; + float const x_115 = x_8.injectionSwitch.y; + if ((x_113 > x_115)) { + *(tint_symbol_5) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + int const x_22 = even_index; + even_index = (x_22 - 1); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8dcb8278eb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.spvasm @@ -0,0 +1,254 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 146 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %odd_index "odd_index" + OpName %even_index "even_index" + OpName %j "j" + OpName %ll "ll" + OpName %x_59 "x_59" + OpName %x_60_phi "x_60_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %29 = OpConstantNull %bool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_128 = OpConstant %float 128 + %uint_1 = OpConstant %uint 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_0_25 = OpConstant %float 0.25 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %int_3 = OpConstant %int 3 + %130 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %133 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %odd_index = OpVariable %_ptr_Function_int Function %22 + %even_index = OpVariable %_ptr_Function_int Function %22 + %j = OpVariable %_ptr_Function_int Function %22 + %ll = OpVariable %_ptr_Function_int Function %22 + %x_59 = OpVariable %_ptr_Function_bool Function %29 + %x_60_phi = OpVariable %_ptr_Function_bool Function %29 + OpStore %x_GLF_color %33 + %37 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + %40 = OpFOrdLessThan %bool %38 %float_128 + OpStore %x_60_phi %40 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + %44 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %45 = OpLoad %float %44 + %46 = OpFOrdLessThan %bool %45 %float_128 + OpStore %x_59 %46 + %47 = OpLoad %bool %x_59 + OpStore %x_60_phi %47 + OpBranch %41 + %41 = OpLabel + %48 = OpLoad %bool %x_60_phi + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + OpReturn + %49 = OpLabel + OpStore %odd_index %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %odd_index + %58 = OpSLessThanEqual %bool %56 %int_1 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + OpBranch %59 + %61 = OpLabel + OpBranch %53 + %59 = OpLabel + %62 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %63 = OpLoad %float %62 + %64 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %66 = OpFAdd %float %63 %float_0_25 + OpStore %64 %66 + %67 = OpLoad %int %odd_index + %68 = OpIAdd %int %67 %int_1 + OpStore %odd_index %68 + OpBranch %54 + %54 = OpLabel + OpBranch %52 + %53 = OpLabel + OpStore %even_index %int_1 + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %int %even_index + %74 = OpSGreaterThanEqual %bool %73 %int_0 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpBranch %75 + %77 = OpLabel + OpBranch %70 + %75 = OpLabel + %78 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %81 = OpFAdd %float %79 %float_0_25 + OpStore %80 %81 + %83 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %84 = OpLoad %float %83 + %85 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %86 = OpLoad %float %85 + %87 = OpFOrdGreaterThan %bool %84 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + OpBranch %71 + %88 = OpLabel + %90 = OpLoad %int %even_index + %91 = OpSGreaterThanEqual %bool %90 %int_1 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %92 + %93 = OpLabel + OpKill + %92 = OpLabel + OpStore %j %int_1 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %95 %96 None + OpBranch %97 + %97 = OpLabel + OpSelectionMerge %99 None + OpBranchConditional %true %100 %101 + %100 = OpLabel + OpBranch %99 + %101 = OpLabel + OpBranch %95 + %99 = OpLabel + %102 = OpLoad %int %ll + %104 = OpSGreaterThanEqual %bool %102 %int_3 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %105 + %106 = OpLabel + OpBranch %95 + %105 = OpLabel + %107 = OpLoad %int %ll + %108 = OpIAdd %int %107 %int_1 + OpStore %ll %108 + %109 = OpLoad %int %j + %110 = OpBitcast %uint %109 + %111 = OpULessThan %bool %110 %uint_1 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %112 + %113 = OpLabel + OpBranch %96 + %112 = OpLabel + %114 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %115 = OpLoad %float %114 + %116 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %117 = OpLoad %float %116 + %118 = OpFOrdGreaterThan %bool %115 %117 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %119 + %120 = OpLabel + OpBranch %95 + %119 = OpLabel + OpBranch %96 + %96 = OpLabel + %121 = OpLoad %int %j + %122 = OpIAdd %int %121 %int_1 + OpStore %j %122 + OpBranch %94 + %95 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %124 = OpLoad %float %123 + %125 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %126 = OpLoad %float %125 + %127 = OpFOrdGreaterThan %bool %124 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %128 + %129 = OpLabel + OpStore %x_GLF_color %130 + OpBranch %128 + %128 = OpLabel + %131 = OpLoad %int %even_index + %132 = OpISub %int %131 %int_1 + OpStore %even_index %132 + OpBranch %71 + %71 = OpLabel + OpBranch %69 + %70 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %133 +%tint_symbol_1 = OpFunctionParameter %main_out + %137 = OpLabel + %138 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %138 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %140 = OpLabel + %141 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %141 + %142 = OpFunctionCall %void %main_1 + %144 = OpLoad %v4float %x_GLF_color + %145 = OpCompositeConstruct %main_out %144 + %143 = OpFunctionCall %void %tint_symbol_3 %145 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..aec3b115b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.spvasm.expected.wgsl @@ -0,0 +1,110 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var odd_index : i32; + var even_index : i32; + var j : i32; + var ll : i32; + var x_59 : bool; + var x_60_phi : bool; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_53 : f32 = gl_FragCoord.x; + let x_54 : bool = (x_53 < 128.0); + x_60_phi = x_54; + if (x_54) { + let x_58 : f32 = gl_FragCoord.y; + x_59 = (x_58 < 128.0); + x_60_phi = x_59; + } + let x_60 : bool = x_60_phi; + if (x_60) { + return; + } + odd_index = 0; + loop { + let x_11 : i32 = odd_index; + if ((x_11 <= 1)) { + } else { + break; + } + let x_70 : f32 = x_GLF_color.x; + x_GLF_color.x = (x_70 + 0.25); + let x_12 : i32 = odd_index; + odd_index = (x_12 + 1); + } + even_index = 1; + loop { + let x_14 : i32 = even_index; + if ((x_14 >= 0)) { + } else { + break; + } + let x_80 : f32 = x_GLF_color.x; + x_GLF_color.x = (x_80 + 0.25); + let x_84 : f32 = x_8.injectionSwitch.x; + let x_86 : f32 = x_8.injectionSwitch.y; + if ((x_84 > x_86)) { + continue; + } + let x_15 : i32 = even_index; + if ((x_15 >= 1)) { + discard; + } + j = 1; + loop { + if (true) { + } else { + break; + } + let x_16 : i32 = ll; + if ((x_16 >= 3)) { + break; + } + let x_17 : i32 = ll; + ll = (x_17 + 1); + let x_19 : i32 = j; + if ((bitcast(x_19) < 1u)) { + continue; + } + let x_106 : f32 = x_8.injectionSwitch.x; + let x_108 : f32 = x_8.injectionSwitch.y; + if ((x_106 > x_108)) { + break; + } + + continuing { + let x_20 : i32 = j; + j = (x_20 + 1); + } + } + let x_113 : f32 = x_8.injectionSwitch.x; + let x_115 : f32 = x_8.injectionSwitch.y; + if ((x_113 > x_115)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + let x_22 : i32 = even_index; + even_index = (x_22 - 1); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl new file mode 100644 index 0000000000..aec3b115b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl @@ -0,0 +1,110 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var odd_index : i32; + var even_index : i32; + var j : i32; + var ll : i32; + var x_59 : bool; + var x_60_phi : bool; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_53 : f32 = gl_FragCoord.x; + let x_54 : bool = (x_53 < 128.0); + x_60_phi = x_54; + if (x_54) { + let x_58 : f32 = gl_FragCoord.y; + x_59 = (x_58 < 128.0); + x_60_phi = x_59; + } + let x_60 : bool = x_60_phi; + if (x_60) { + return; + } + odd_index = 0; + loop { + let x_11 : i32 = odd_index; + if ((x_11 <= 1)) { + } else { + break; + } + let x_70 : f32 = x_GLF_color.x; + x_GLF_color.x = (x_70 + 0.25); + let x_12 : i32 = odd_index; + odd_index = (x_12 + 1); + } + even_index = 1; + loop { + let x_14 : i32 = even_index; + if ((x_14 >= 0)) { + } else { + break; + } + let x_80 : f32 = x_GLF_color.x; + x_GLF_color.x = (x_80 + 0.25); + let x_84 : f32 = x_8.injectionSwitch.x; + let x_86 : f32 = x_8.injectionSwitch.y; + if ((x_84 > x_86)) { + continue; + } + let x_15 : i32 = even_index; + if ((x_15 >= 1)) { + discard; + } + j = 1; + loop { + if (true) { + } else { + break; + } + let x_16 : i32 = ll; + if ((x_16 >= 3)) { + break; + } + let x_17 : i32 = ll; + ll = (x_17 + 1); + let x_19 : i32 = j; + if ((bitcast(x_19) < 1u)) { + continue; + } + let x_106 : f32 = x_8.injectionSwitch.x; + let x_108 : f32 = x_8.injectionSwitch.y; + if ((x_106 > x_108)) { + break; + } + + continuing { + let x_20 : i32 = j; + j = (x_20 + 1); + } + } + let x_113 : f32 = x_8.injectionSwitch.x; + let x_115 : f32 = x_8.injectionSwitch.y; + if ((x_113 > x_115)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + let x_22 : i32 = even_index; + even_index = (x_22 - 1); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..e97beb75ee --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.hlsl @@ -0,0 +1,96 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[1]; +}; + +void main_1() { + int odd_index = 0; + int even_index = 0; + int j = 0; + int ll = 0; + bool x_59 = false; + bool x_60_phi = false; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_53 = gl_FragCoord.x; + const bool x_54 = (x_53 < 128.0f); + x_60_phi = x_54; + if (x_54) { + const float x_58 = gl_FragCoord.y; + x_59 = (x_58 < 128.0f); + x_60_phi = x_59; + } + if (x_60_phi) { + return; + } + odd_index = 0; + while (true) { + if ((odd_index <= 1)) { + } else { + break; + } + const float x_70 = x_GLF_color.x; + x_GLF_color.x = (x_70 + 0.25f); + odd_index = (odd_index + 1); + } + even_index = 1; + while (true) { + if ((even_index >= 0)) { + } else { + break; + } + const float x_80 = x_GLF_color.x; + x_GLF_color.x = (x_80 + 0.25f); + const float x_84 = asfloat(x_8[0].x); + const float x_86 = asfloat(x_8[0].y); + if ((x_84 > x_86)) { + continue; + } + if ((even_index >= 1)) { + discard; + } + j = 1; + { + for(; true; j = (j + 1)) { + if ((ll >= 3)) { + break; + } + ll = (ll + 1); + if ((asuint(j) < 1u)) { + continue; + } + const float x_106 = asfloat(x_8[0].x); + const float x_108 = asfloat(x_8[0].y); + if ((x_106 > x_108)) { + break; + } + } + } + const float x_113 = asfloat(x_8[0].x); + const float x_115 = asfloat(x_8[0].y); + if ((x_113 > x_115)) { + x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + even_index = (even_index - 1); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..67500c562d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.msl @@ -0,0 +1,114 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int odd_index = 0; + int even_index = 0; + int j = 0; + int ll = 0; + bool x_59 = false; + bool x_60_phi = false; + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + float const x_53 = (*(tint_symbol_6)).x; + bool const x_54 = (x_53 < 128.0f); + x_60_phi = x_54; + if (x_54) { + float const x_58 = (*(tint_symbol_6)).y; + x_59 = (x_58 < 128.0f); + x_60_phi = x_59; + } + bool const x_60 = x_60_phi; + if (x_60) { + return; + } + odd_index = 0; + while (true) { + int const x_11 = odd_index; + if ((x_11 <= 1)) { + } else { + break; + } + float const x_70 = (*(tint_symbol_5)).x; + (*(tint_symbol_5)).x = (x_70 + 0.25f); + int const x_12 = odd_index; + odd_index = (x_12 + 1); + } + even_index = 1; + while (true) { + int const x_14 = even_index; + if ((x_14 >= 0)) { + } else { + break; + } + float const x_80 = (*(tint_symbol_5)).x; + (*(tint_symbol_5)).x = (x_80 + 0.25f); + float const x_84 = x_8.injectionSwitch.x; + float const x_86 = x_8.injectionSwitch.y; + if ((x_84 > x_86)) { + continue; + } + int const x_15 = even_index; + if ((x_15 >= 1)) { + discard_fragment(); + } + j = 1; + while (true) { + if (true) { + } else { + break; + } + int const x_16 = ll; + if ((x_16 >= 3)) { + break; + } + int const x_17 = ll; + ll = (x_17 + 1); + int const x_19 = j; + if ((as_type(x_19) < 1u)) { + { + int const x_20 = j; + j = (x_20 + 1); + } + continue; + } + float const x_106 = x_8.injectionSwitch.x; + float const x_108 = x_8.injectionSwitch.y; + if ((x_106 > x_108)) { + break; + } + { + int const x_20 = j; + j = (x_20 + 1); + } + } + float const x_113 = x_8.injectionSwitch.x; + float const x_115 = x_8.injectionSwitch.y; + if ((x_113 > x_115)) { + *(tint_symbol_5) = float4(1.0f, 1.0f, 1.0f, 1.0f); + } + int const x_22 = even_index; + even_index = (x_22 - 1); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_8, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8dcb8278eb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.spvasm @@ -0,0 +1,254 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 146 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_8 "x_8" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %odd_index "odd_index" + OpName %even_index "even_index" + OpName %j "j" + OpName %ll "ll" + OpName %x_59 "x_59" + OpName %x_60_phi "x_60_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %29 = OpConstantNull %bool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_128 = OpConstant %float 128 + %uint_1 = OpConstant %uint 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_0_25 = OpConstant %float 0.25 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %true = OpConstantTrue %bool + %int_3 = OpConstant %int 3 + %130 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %133 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %odd_index = OpVariable %_ptr_Function_int Function %22 + %even_index = OpVariable %_ptr_Function_int Function %22 + %j = OpVariable %_ptr_Function_int Function %22 + %ll = OpVariable %_ptr_Function_int Function %22 + %x_59 = OpVariable %_ptr_Function_bool Function %29 + %x_60_phi = OpVariable %_ptr_Function_bool Function %29 + OpStore %x_GLF_color %33 + %37 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %38 = OpLoad %float %37 + %40 = OpFOrdLessThan %bool %38 %float_128 + OpStore %x_60_phi %40 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + %44 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %45 = OpLoad %float %44 + %46 = OpFOrdLessThan %bool %45 %float_128 + OpStore %x_59 %46 + %47 = OpLoad %bool %x_59 + OpStore %x_60_phi %47 + OpBranch %41 + %41 = OpLabel + %48 = OpLoad %bool %x_60_phi + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %49 + %50 = OpLabel + OpReturn + %49 = OpLabel + OpStore %odd_index %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %odd_index + %58 = OpSLessThanEqual %bool %56 %int_1 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + OpBranch %59 + %61 = OpLabel + OpBranch %53 + %59 = OpLabel + %62 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %63 = OpLoad %float %62 + %64 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %66 = OpFAdd %float %63 %float_0_25 + OpStore %64 %66 + %67 = OpLoad %int %odd_index + %68 = OpIAdd %int %67 %int_1 + OpStore %odd_index %68 + OpBranch %54 + %54 = OpLabel + OpBranch %52 + %53 = OpLabel + OpStore %even_index %int_1 + OpBranch %69 + %69 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %73 = OpLoad %int %even_index + %74 = OpSGreaterThanEqual %bool %73 %int_0 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + OpBranch %75 + %77 = OpLabel + OpBranch %70 + %75 = OpLabel + %78 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %81 = OpFAdd %float %79 %float_0_25 + OpStore %80 %81 + %83 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %84 = OpLoad %float %83 + %85 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %86 = OpLoad %float %85 + %87 = OpFOrdGreaterThan %bool %84 %86 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %88 + %89 = OpLabel + OpBranch %71 + %88 = OpLabel + %90 = OpLoad %int %even_index + %91 = OpSGreaterThanEqual %bool %90 %int_1 + OpSelectionMerge %92 None + OpBranchConditional %91 %93 %92 + %93 = OpLabel + OpKill + %92 = OpLabel + OpStore %j %int_1 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %95 %96 None + OpBranch %97 + %97 = OpLabel + OpSelectionMerge %99 None + OpBranchConditional %true %100 %101 + %100 = OpLabel + OpBranch %99 + %101 = OpLabel + OpBranch %95 + %99 = OpLabel + %102 = OpLoad %int %ll + %104 = OpSGreaterThanEqual %bool %102 %int_3 + OpSelectionMerge %105 None + OpBranchConditional %104 %106 %105 + %106 = OpLabel + OpBranch %95 + %105 = OpLabel + %107 = OpLoad %int %ll + %108 = OpIAdd %int %107 %int_1 + OpStore %ll %108 + %109 = OpLoad %int %j + %110 = OpBitcast %uint %109 + %111 = OpULessThan %bool %110 %uint_1 + OpSelectionMerge %112 None + OpBranchConditional %111 %113 %112 + %113 = OpLabel + OpBranch %96 + %112 = OpLabel + %114 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %115 = OpLoad %float %114 + %116 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %117 = OpLoad %float %116 + %118 = OpFOrdGreaterThan %bool %115 %117 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %119 + %120 = OpLabel + OpBranch %95 + %119 = OpLabel + OpBranch %96 + %96 = OpLabel + %121 = OpLoad %int %j + %122 = OpIAdd %int %121 %int_1 + OpStore %j %122 + OpBranch %94 + %95 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_0 + %124 = OpLoad %float %123 + %125 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %uint_1 + %126 = OpLoad %float %125 + %127 = OpFOrdGreaterThan %bool %124 %126 + OpSelectionMerge %128 None + OpBranchConditional %127 %129 %128 + %129 = OpLabel + OpStore %x_GLF_color %130 + OpBranch %128 + %128 = OpLabel + %131 = OpLoad %int %even_index + %132 = OpISub %int %131 %int_1 + OpStore %even_index %132 + OpBranch %71 + %71 = OpLabel + OpBranch %69 + %70 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %133 +%tint_symbol_1 = OpFunctionParameter %main_out + %137 = OpLabel + %138 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %138 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %140 = OpLabel + %141 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %141 + %142 = OpFunctionCall %void %main_1 + %144 = OpLoad %v4float %x_GLF_color + %145 = OpCompositeConstruct %main_out %144 + %143 = OpFunctionCall %void %tint_symbol_3 %145 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..aec3b115b1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-2-iteration-loops/0-opt.wgsl.expected.wgsl @@ -0,0 +1,110 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_8 : buf0; + +fn main_1() { + var odd_index : i32; + var even_index : i32; + var j : i32; + var ll : i32; + var x_59 : bool; + var x_60_phi : bool; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_53 : f32 = gl_FragCoord.x; + let x_54 : bool = (x_53 < 128.0); + x_60_phi = x_54; + if (x_54) { + let x_58 : f32 = gl_FragCoord.y; + x_59 = (x_58 < 128.0); + x_60_phi = x_59; + } + let x_60 : bool = x_60_phi; + if (x_60) { + return; + } + odd_index = 0; + loop { + let x_11 : i32 = odd_index; + if ((x_11 <= 1)) { + } else { + break; + } + let x_70 : f32 = x_GLF_color.x; + x_GLF_color.x = (x_70 + 0.25); + let x_12 : i32 = odd_index; + odd_index = (x_12 + 1); + } + even_index = 1; + loop { + let x_14 : i32 = even_index; + if ((x_14 >= 0)) { + } else { + break; + } + let x_80 : f32 = x_GLF_color.x; + x_GLF_color.x = (x_80 + 0.25); + let x_84 : f32 = x_8.injectionSwitch.x; + let x_86 : f32 = x_8.injectionSwitch.y; + if ((x_84 > x_86)) { + continue; + } + let x_15 : i32 = even_index; + if ((x_15 >= 1)) { + discard; + } + j = 1; + loop { + if (true) { + } else { + break; + } + let x_16 : i32 = ll; + if ((x_16 >= 3)) { + break; + } + let x_17 : i32 = ll; + ll = (x_17 + 1); + let x_19 : i32 = j; + if ((bitcast(x_19) < 1u)) { + continue; + } + let x_106 : f32 = x_8.injectionSwitch.x; + let x_108 : f32 = x_8.injectionSwitch.y; + if ((x_106 > x_108)) { + break; + } + + continuing { + let x_20 : i32 = j; + j = (x_20 + 1); + } + } + let x_113 : f32 = x_8.injectionSwitch.x; + let x_115 : f32 = x_8.injectionSwitch.y; + if ((x_113 > x_115)) { + x_GLF_color = vec4(1.0, 1.0, 1.0, 1.0); + } + let x_22 : i32 = even_index; + even_index = (x_22 - 1); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm new file mode 100644 index 0000000000..f4d1bab486 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm @@ -0,0 +1,184 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 18 6 + OpSource ESSL 310 + OpName %main "main" + OpName %GLF_live2_looplimiter1 "GLF_live2_looplimiter1" + OpName %i "i" + OpName %j "j" + OpName %GLF_live2gl_FragCoord "GLF_live2gl_FragCoord" + OpName %GLF_dead3x "GLF_dead3x" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %GLF_dead3k "GLF_dead3k" + OpName %doesNotMatter "doesNotMatter" + OpMemberName %doesNotMatter 0 "_compute_data" + OpName %__0 "" + OpDecorate %GLF_live2gl_FragCoord RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %doesNotMatter 0 Offset 0 + OpDecorate %doesNotMatter BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %20 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float +%GLF_live2gl_FragCoord = OpVariable %_ptr_Private_v4float Private + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_120 = OpConstant %int 120 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 +%_ptr_Function_float = OpTypePointer Function %float + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %float_4 = OpConstant %float 4 +%_runtimearr_uint = OpTypeRuntimeArray %uint +%doesNotMatter = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_doesNotMatter = OpTypePointer Uniform %doesNotMatter + %__0 = OpVariable %_ptr_Uniform_doesNotMatter Uniform + %uint_42 = OpConstant %uint 42 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %v3uint = OpTypeVector %uint 3 + %uint_18 = OpConstant %uint 18 + %uint_6 = OpConstant %uint 6 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_18 %uint_6 + %main = OpFunction %void None %20 + %50 = OpLabel +%GLF_live2_looplimiter1 = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %GLF_dead3x = OpVariable %_ptr_Function_float Function + %51 = OpVariable %_ptr_Function_float Function + %GLF_dead3k = OpVariable %_ptr_Function_int Function + OpStore %GLF_live2_looplimiter1 %int_0 + OpStore %i %int_0 + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %i + %57 = OpSLessThan %bool %56 %int_1 + OpBranchConditional %57 %58 %53 + %58 = OpLabel + %59 = OpLoad %int %GLF_live2_looplimiter1 + %60 = OpSGreaterThanEqual %bool %59 %int_3 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpStore %j %int_0 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpLoad %int %j + %68 = OpSLessThan %bool %67 %int_1 + OpBranchConditional %68 %69 %64 + %69 = OpLabel + %70 = OpAccessChain %_ptr_Private_float %GLF_live2gl_FragCoord %uint_0 + %13 = OpLoad %float %70 + %71 = OpConvertFToS %int %13 + %72 = OpSLessThan %bool %71 %int_120 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + OpBranch %73 + %75 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %73 + %73 = OpLabel + OpBranch %65 + %65 = OpLabel + %76 = OpLoad %int %j + %77 = OpIAdd %int %76 %int_1 + OpStore %j %77 + OpBranch %63 + %64 = OpLabel + OpBranch %53 + %61 = OpLabel + OpBranch %54 + %54 = OpLabel + %78 = OpLoad %int %i + %79 = OpIAdd %int %78 %int_1 + OpStore %i %79 + OpBranch %52 + %53 = OpLabel + %80 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %81 = OpLoad %float %80 + %82 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %83 = OpLoad %float %82 + %84 = OpFOrdGreaterThan %bool %81 %83 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %87 + %86 = OpLabel + %88 = OpAccessChain %_ptr_Private_float %GLF_live2gl_FragCoord %uint_0 + %14 = OpLoad %float %88 + OpStore %51 %14 + OpBranch %85 + %87 = OpLabel + OpStore %51 %float_0 + OpBranch %85 + %85 = OpLabel + %15 = OpLoad %float %51 + OpStore %GLF_dead3x %15 + OpStore %GLF_dead3k %int_0 + OpBranch %89 + %89 = OpLabel + OpLoopMerge %90 %91 None + OpBranch %92 + %92 = OpLabel + %93 = OpLoad %int %GLF_dead3k + %94 = OpSLessThan %bool %93 %int_2 + OpBranchConditional %94 %95 %90 + %95 = OpLabel + %96 = OpLoad %float %GLF_dead3x + %97 = OpFOrdGreaterThan %bool %96 %float_4 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %98 + %99 = OpLabel + OpBranch %90 + %98 = OpLabel + %100 = OpAccessChain %_ptr_Private_float %GLF_live2gl_FragCoord %uint_0 + %16 = OpLoad %float %100 + OpStore %GLF_dead3x %16 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %91 + %91 = OpLabel + %101 = OpLoad %int %GLF_dead3k + %102 = OpIAdd %int %101 %int_1 + OpStore %GLF_dead3k %102 + OpBranch %89 + %90 = OpLabel + %103 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %int_0 + OpStore %103 %uint_42 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..054c86341b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.hlsl @@ -0,0 +1,61 @@ +static float4 GLF_live2gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[1]; +}; +RWByteAddressBuffer x_12 : register(u0, space0); + +void main_1() { + int GLF_live2_looplimiter1 = 0; + int i = 0; + int j = 0; + float GLF_dead3x = 0.0f; + float x_51 = 0.0f; + int GLF_dead3k = 0; + GLF_live2_looplimiter1 = 0; + i = 0; + { + for(; (i < 1); i = (i + 1)) { + if ((GLF_live2_looplimiter1 >= 3)) { + j = 0; + { + for(; (j < 1); j = (j + 1)) { + const float x_13 = GLF_live2gl_FragCoord.x; + if ((int(x_13) < 120)) { + } else { + GroupMemoryBarrierWithGroupSync(); + } + } + } + break; + } + } + } + const float x_81 = asfloat(x_9[0].x); + const float x_83 = asfloat(x_9[0].y); + if ((x_81 > x_83)) { + const float x_14 = GLF_live2gl_FragCoord.x; + x_51 = x_14; + } else { + x_51 = 0.0f; + } + GLF_dead3x = x_51; + GLF_dead3k = 0; + { + for(; (GLF_dead3k < 2); GLF_dead3k = (GLF_dead3k + 1)) { + if ((GLF_dead3x > 4.0f)) { + break; + } + const float x_16 = GLF_live2gl_FragCoord.x; + GLF_dead3x = x_16; + GroupMemoryBarrierWithGroupSync(); + } + } + x_12.Store((4u * uint(0)), asuint(42u)); + return; +} + +[numthreads(1, 18, 6)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..e1b045ea40 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.msl @@ -0,0 +1,90 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct doesNotMatter { + /* 0x0000 */ uint x_compute_data[1]; +}; + +void main_1(constant buf0& x_9, device doesNotMatter& x_12, thread float4* const tint_symbol_1) { + int GLF_live2_looplimiter1 = 0; + int i = 0; + int j = 0; + float GLF_dead3x = 0.0f; + float x_51 = 0.0f; + int GLF_dead3k = 0; + GLF_live2_looplimiter1 = 0; + i = 0; + while (true) { + int const x_56 = i; + if ((x_56 < 1)) { + } else { + break; + } + int const x_59 = GLF_live2_looplimiter1; + if ((x_59 >= 3)) { + j = 0; + while (true) { + int const x_67 = j; + if ((x_67 < 1)) { + } else { + break; + } + float const x_13 = (*(tint_symbol_1)).x; + if ((int(x_13) < 120)) { + } else { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + { + int const x_76 = j; + j = (x_76 + 1); + } + } + break; + } + { + int const x_78 = i; + i = (x_78 + 1); + } + } + float const x_81 = x_9.injectionSwitch.x; + float const x_83 = x_9.injectionSwitch.y; + if ((x_81 > x_83)) { + float const x_14 = (*(tint_symbol_1)).x; + x_51 = x_14; + } else { + x_51 = 0.0f; + } + float const x_15 = x_51; + GLF_dead3x = x_15; + GLF_dead3k = 0; + while (true) { + int const x_93 = GLF_dead3k; + if ((x_93 < 2)) { + } else { + break; + } + float const x_96 = GLF_dead3x; + if ((x_96 > 4.0f)) { + break; + } + float const x_16 = (*(tint_symbol_1)).x; + GLF_dead3x = x_16; + threadgroup_barrier(mem_flags::mem_threadgroup); + { + int const x_101 = GLF_dead3k; + GLF_dead3k = (x_101 + 1); + } + } + x_12.x_compute_data[0] = 42u; + return; +} + +kernel void tint_symbol(constant buf0& x_9 [[buffer(1)]], device doesNotMatter& x_12 [[buffer(0)]]) { + thread float4 tint_symbol_2 = 0.0f; + main_1(x_9, x_12, &(tint_symbol_2)); + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8978ada4a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.spvasm @@ -0,0 +1,203 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 113 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 18 6 + OpName %GLF_live2gl_FragCoord "GLF_live2gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %doesNotMatter "doesNotMatter" + OpMemberName %doesNotMatter 0 "x_compute_data" + OpName %x_12 "x_12" + OpName %main_1 "main_1" + OpName %GLF_live2_looplimiter1 "GLF_live2_looplimiter1" + OpName %i "i" + OpName %j "j" + OpName %GLF_dead3x "GLF_dead3x" + OpName %x_51 "x_51" + OpName %GLF_dead3k "GLF_dead3k" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %doesNotMatter Block + OpMemberDecorate %doesNotMatter 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%GLF_live2gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint +%doesNotMatter = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_doesNotMatter = OpTypePointer StorageBuffer %doesNotMatter + %x_12 = OpVariable %_ptr_StorageBuffer_doesNotMatter StorageBuffer + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %27 = OpConstantNull %float + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_120 = OpConstant %int 120 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %float_4 = OpConstant %float 4 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_42 = OpConstant %uint 42 + %main_1 = OpFunction %void None %15 + %18 = OpLabel +%GLF_live2_looplimiter1 = OpVariable %_ptr_Function_int Function %22 + %i = OpVariable %_ptr_Function_int Function %22 + %j = OpVariable %_ptr_Function_int Function %22 + %GLF_dead3x = OpVariable %_ptr_Function_float Function %27 + %x_51 = OpVariable %_ptr_Function_float Function %27 + %GLF_dead3k = OpVariable %_ptr_Function_int Function %22 + OpStore %GLF_live2_looplimiter1 %int_0 + OpStore %i %int_0 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %int %i + %37 = OpSLessThan %bool %35 %int_1 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %32 + %39 = OpLabel + %42 = OpLoad %int %GLF_live2_looplimiter1 + %44 = OpSGreaterThanEqual %bool %42 %int_3 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + OpStore %j %int_0 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %j + %52 = OpSLessThan %bool %51 %int_1 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + OpBranch %53 + %55 = OpLabel + OpBranch %48 + %53 = OpLabel + %58 = OpAccessChain %_ptr_Private_float %GLF_live2gl_FragCoord %uint_0 + %59 = OpLoad %float %58 + %60 = OpConvertFToS %int %59 + %62 = OpSLessThan %bool %60 %int_120 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %63 + %63 = OpLabel + OpBranch %49 + %49 = OpLabel + %69 = OpLoad %int %j + %70 = OpIAdd %int %69 %int_1 + OpStore %j %70 + OpBranch %47 + %48 = OpLabel + OpBranch %32 + %45 = OpLabel + OpBranch %33 + %33 = OpLabel + %71 = OpLoad %int %i + %72 = OpIAdd %int %71 %int_1 + OpStore %i %72 + OpBranch %31 + %32 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %75 = OpLoad %float %74 + %77 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %78 = OpLoad %float %77 + %79 = OpFOrdGreaterThan %bool %75 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + %83 = OpAccessChain %_ptr_Private_float %GLF_live2gl_FragCoord %uint_0 + %84 = OpLoad %float %83 + OpStore %x_51 %84 + OpBranch %80 + %82 = OpLabel + OpStore %x_51 %float_0 + OpBranch %80 + %80 = OpLabel + %86 = OpLoad %float %x_51 + OpStore %GLF_dead3x %86 + OpStore %GLF_dead3k %int_0 + OpBranch %87 + %87 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %int %GLF_dead3k + %93 = OpSLessThan %bool %91 %int_2 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %96 + %95 = OpLabel + OpBranch %94 + %96 = OpLabel + OpBranch %88 + %94 = OpLabel + %97 = OpLoad %float %GLF_dead3x + %99 = OpFOrdGreaterThan %bool %97 %float_4 + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %100 + %101 = OpLabel + OpBranch %88 + %100 = OpLabel + %102 = OpAccessChain %_ptr_Private_float %GLF_live2gl_FragCoord %uint_0 + %103 = OpLoad %float %102 + OpStore %GLF_dead3x %103 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %89 + %89 = OpLabel + %105 = OpLoad %int %GLF_dead3k + %106 = OpIAdd %int %105 %int_1 + OpStore %GLF_dead3k %106 + OpBranch %87 + %88 = OpLabel + %108 = OpAccessChain %_ptr_StorageBuffer_uint %x_12 %uint_0 %int_0 + OpStore %108 %uint_42 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %111 = OpLabel + %112 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..bc88eb2a41 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.spvasm.expected.wgsl @@ -0,0 +1,99 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +type RTArr = [[stride(4)]] array; + +[[block]] +struct doesNotMatter { + x_compute_data : RTArr; +}; + +var GLF_live2gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf0; + +[[group(0), binding(0)]] var x_12 : doesNotMatter; + +fn main_1() { + var GLF_live2_looplimiter1 : i32; + var i : i32; + var j : i32; + var GLF_dead3x : f32; + var x_51 : f32; + var GLF_dead3k : i32; + GLF_live2_looplimiter1 = 0; + i = 0; + loop { + let x_56 : i32 = i; + if ((x_56 < 1)) { + } else { + break; + } + let x_59 : i32 = GLF_live2_looplimiter1; + if ((x_59 >= 3)) { + j = 0; + loop { + let x_67 : i32 = j; + if ((x_67 < 1)) { + } else { + break; + } + let x_13 : f32 = GLF_live2gl_FragCoord.x; + if ((i32(x_13) < 120)) { + } else { + workgroupBarrier(); + } + + continuing { + let x_76 : i32 = j; + j = (x_76 + 1); + } + } + break; + } + + continuing { + let x_78 : i32 = i; + i = (x_78 + 1); + } + } + let x_81 : f32 = x_9.injectionSwitch.x; + let x_83 : f32 = x_9.injectionSwitch.y; + if ((x_81 > x_83)) { + let x_14 : f32 = GLF_live2gl_FragCoord.x; + x_51 = x_14; + } else { + x_51 = 0.0; + } + let x_15 : f32 = x_51; + GLF_dead3x = x_15; + GLF_dead3k = 0; + loop { + let x_93 : i32 = GLF_dead3k; + if ((x_93 < 2)) { + } else { + break; + } + let x_96 : f32 = GLF_dead3x; + if ((x_96 > 4.0)) { + break; + } + let x_16 : f32 = GLF_live2gl_FragCoord.x; + GLF_dead3x = x_16; + workgroupBarrier(); + + continuing { + let x_101 : i32 = GLF_dead3k; + GLF_dead3k = (x_101 + 1); + } + } + x_12.x_compute_data[0] = 42u; + return; +} + +[[stage(compute), workgroup_size(1, 18, 6)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl new file mode 100644 index 0000000000..bc88eb2a41 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl @@ -0,0 +1,99 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +type RTArr = [[stride(4)]] array; + +[[block]] +struct doesNotMatter { + x_compute_data : RTArr; +}; + +var GLF_live2gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf0; + +[[group(0), binding(0)]] var x_12 : doesNotMatter; + +fn main_1() { + var GLF_live2_looplimiter1 : i32; + var i : i32; + var j : i32; + var GLF_dead3x : f32; + var x_51 : f32; + var GLF_dead3k : i32; + GLF_live2_looplimiter1 = 0; + i = 0; + loop { + let x_56 : i32 = i; + if ((x_56 < 1)) { + } else { + break; + } + let x_59 : i32 = GLF_live2_looplimiter1; + if ((x_59 >= 3)) { + j = 0; + loop { + let x_67 : i32 = j; + if ((x_67 < 1)) { + } else { + break; + } + let x_13 : f32 = GLF_live2gl_FragCoord.x; + if ((i32(x_13) < 120)) { + } else { + workgroupBarrier(); + } + + continuing { + let x_76 : i32 = j; + j = (x_76 + 1); + } + } + break; + } + + continuing { + let x_78 : i32 = i; + i = (x_78 + 1); + } + } + let x_81 : f32 = x_9.injectionSwitch.x; + let x_83 : f32 = x_9.injectionSwitch.y; + if ((x_81 > x_83)) { + let x_14 : f32 = GLF_live2gl_FragCoord.x; + x_51 = x_14; + } else { + x_51 = 0.0; + } + let x_15 : f32 = x_51; + GLF_dead3x = x_15; + GLF_dead3k = 0; + loop { + let x_93 : i32 = GLF_dead3k; + if ((x_93 < 2)) { + } else { + break; + } + let x_96 : f32 = GLF_dead3x; + if ((x_96 > 4.0)) { + break; + } + let x_16 : f32 = GLF_live2gl_FragCoord.x; + GLF_dead3x = x_16; + workgroupBarrier(); + + continuing { + let x_101 : i32 = GLF_dead3k; + GLF_dead3k = (x_101 + 1); + } + } + x_12.x_compute_data[0] = 42u; + return; +} + +[[stage(compute), workgroup_size(1, 18, 6)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..054c86341b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.hlsl @@ -0,0 +1,61 @@ +static float4 GLF_live2gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_9 : register(b1, space0) { + uint4 x_9[1]; +}; +RWByteAddressBuffer x_12 : register(u0, space0); + +void main_1() { + int GLF_live2_looplimiter1 = 0; + int i = 0; + int j = 0; + float GLF_dead3x = 0.0f; + float x_51 = 0.0f; + int GLF_dead3k = 0; + GLF_live2_looplimiter1 = 0; + i = 0; + { + for(; (i < 1); i = (i + 1)) { + if ((GLF_live2_looplimiter1 >= 3)) { + j = 0; + { + for(; (j < 1); j = (j + 1)) { + const float x_13 = GLF_live2gl_FragCoord.x; + if ((int(x_13) < 120)) { + } else { + GroupMemoryBarrierWithGroupSync(); + } + } + } + break; + } + } + } + const float x_81 = asfloat(x_9[0].x); + const float x_83 = asfloat(x_9[0].y); + if ((x_81 > x_83)) { + const float x_14 = GLF_live2gl_FragCoord.x; + x_51 = x_14; + } else { + x_51 = 0.0f; + } + GLF_dead3x = x_51; + GLF_dead3k = 0; + { + for(; (GLF_dead3k < 2); GLF_dead3k = (GLF_dead3k + 1)) { + if ((GLF_dead3x > 4.0f)) { + break; + } + const float x_16 = GLF_live2gl_FragCoord.x; + GLF_dead3x = x_16; + GroupMemoryBarrierWithGroupSync(); + } + } + x_12.Store((4u * uint(0)), asuint(42u)); + return; +} + +[numthreads(1, 18, 6)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..e1b045ea40 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.msl @@ -0,0 +1,90 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct doesNotMatter { + /* 0x0000 */ uint x_compute_data[1]; +}; + +void main_1(constant buf0& x_9, device doesNotMatter& x_12, thread float4* const tint_symbol_1) { + int GLF_live2_looplimiter1 = 0; + int i = 0; + int j = 0; + float GLF_dead3x = 0.0f; + float x_51 = 0.0f; + int GLF_dead3k = 0; + GLF_live2_looplimiter1 = 0; + i = 0; + while (true) { + int const x_56 = i; + if ((x_56 < 1)) { + } else { + break; + } + int const x_59 = GLF_live2_looplimiter1; + if ((x_59 >= 3)) { + j = 0; + while (true) { + int const x_67 = j; + if ((x_67 < 1)) { + } else { + break; + } + float const x_13 = (*(tint_symbol_1)).x; + if ((int(x_13) < 120)) { + } else { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + { + int const x_76 = j; + j = (x_76 + 1); + } + } + break; + } + { + int const x_78 = i; + i = (x_78 + 1); + } + } + float const x_81 = x_9.injectionSwitch.x; + float const x_83 = x_9.injectionSwitch.y; + if ((x_81 > x_83)) { + float const x_14 = (*(tint_symbol_1)).x; + x_51 = x_14; + } else { + x_51 = 0.0f; + } + float const x_15 = x_51; + GLF_dead3x = x_15; + GLF_dead3k = 0; + while (true) { + int const x_93 = GLF_dead3k; + if ((x_93 < 2)) { + } else { + break; + } + float const x_96 = GLF_dead3x; + if ((x_96 > 4.0f)) { + break; + } + float const x_16 = (*(tint_symbol_1)).x; + GLF_dead3x = x_16; + threadgroup_barrier(mem_flags::mem_threadgroup); + { + int const x_101 = GLF_dead3k; + GLF_dead3k = (x_101 + 1); + } + } + x_12.x_compute_data[0] = 42u; + return; +} + +kernel void tint_symbol(constant buf0& x_9 [[buffer(1)]], device doesNotMatter& x_12 [[buffer(0)]]) { + thread float4 tint_symbol_2 = 0.0f; + main_1(x_9, x_12, &(tint_symbol_2)); + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8978ada4a4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.spvasm @@ -0,0 +1,203 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 113 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 18 6 + OpName %GLF_live2gl_FragCoord "GLF_live2gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_9 "x_9" + OpName %doesNotMatter "doesNotMatter" + OpMemberName %doesNotMatter 0 "x_compute_data" + OpName %x_12 "x_12" + OpName %main_1 "main_1" + OpName %GLF_live2_looplimiter1 "GLF_live2_looplimiter1" + OpName %i "i" + OpName %j "j" + OpName %GLF_dead3x "GLF_dead3x" + OpName %x_51 "x_51" + OpName %GLF_dead3k "GLF_dead3k" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 1 + OpDecorate %doesNotMatter Block + OpMemberDecorate %doesNotMatter 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%GLF_live2gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint +%doesNotMatter = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_doesNotMatter = OpTypePointer StorageBuffer %doesNotMatter + %x_12 = OpVariable %_ptr_StorageBuffer_doesNotMatter StorageBuffer + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %27 = OpConstantNull %float + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_120 = OpConstant %int 120 + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %float_4 = OpConstant %float 4 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %uint_42 = OpConstant %uint 42 + %main_1 = OpFunction %void None %15 + %18 = OpLabel +%GLF_live2_looplimiter1 = OpVariable %_ptr_Function_int Function %22 + %i = OpVariable %_ptr_Function_int Function %22 + %j = OpVariable %_ptr_Function_int Function %22 + %GLF_dead3x = OpVariable %_ptr_Function_float Function %27 + %x_51 = OpVariable %_ptr_Function_float Function %27 + %GLF_dead3k = OpVariable %_ptr_Function_int Function %22 + OpStore %GLF_live2_looplimiter1 %int_0 + OpStore %i %int_0 + OpBranch %31 + %31 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %int %i + %37 = OpSLessThan %bool %35 %int_1 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %41 + %40 = OpLabel + OpBranch %39 + %41 = OpLabel + OpBranch %32 + %39 = OpLabel + %42 = OpLoad %int %GLF_live2_looplimiter1 + %44 = OpSGreaterThanEqual %bool %42 %int_3 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + OpStore %j %int_0 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %j + %52 = OpSLessThan %bool %51 %int_1 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %55 + %54 = OpLabel + OpBranch %53 + %55 = OpLabel + OpBranch %48 + %53 = OpLabel + %58 = OpAccessChain %_ptr_Private_float %GLF_live2gl_FragCoord %uint_0 + %59 = OpLoad %float %58 + %60 = OpConvertFToS %int %59 + %62 = OpSLessThan %bool %60 %int_120 + OpSelectionMerge %63 None + OpBranchConditional %62 %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %63 + %63 = OpLabel + OpBranch %49 + %49 = OpLabel + %69 = OpLoad %int %j + %70 = OpIAdd %int %69 %int_1 + OpStore %j %70 + OpBranch %47 + %48 = OpLabel + OpBranch %32 + %45 = OpLabel + OpBranch %33 + %33 = OpLabel + %71 = OpLoad %int %i + %72 = OpIAdd %int %71 %int_1 + OpStore %i %72 + OpBranch %31 + %32 = OpLabel + %74 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_0 + %75 = OpLoad %float %74 + %77 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %uint_1 + %78 = OpLoad %float %77 + %79 = OpFOrdGreaterThan %bool %75 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %82 + %81 = OpLabel + %83 = OpAccessChain %_ptr_Private_float %GLF_live2gl_FragCoord %uint_0 + %84 = OpLoad %float %83 + OpStore %x_51 %84 + OpBranch %80 + %82 = OpLabel + OpStore %x_51 %float_0 + OpBranch %80 + %80 = OpLabel + %86 = OpLoad %float %x_51 + OpStore %GLF_dead3x %86 + OpStore %GLF_dead3k %int_0 + OpBranch %87 + %87 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %int %GLF_dead3k + %93 = OpSLessThan %bool %91 %int_2 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %96 + %95 = OpLabel + OpBranch %94 + %96 = OpLabel + OpBranch %88 + %94 = OpLabel + %97 = OpLoad %float %GLF_dead3x + %99 = OpFOrdGreaterThan %bool %97 %float_4 + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %100 + %101 = OpLabel + OpBranch %88 + %100 = OpLabel + %102 = OpAccessChain %_ptr_Private_float %GLF_live2gl_FragCoord %uint_0 + %103 = OpLoad %float %102 + OpStore %GLF_dead3x %103 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %89 + %89 = OpLabel + %105 = OpLoad %int %GLF_dead3k + %106 = OpIAdd %int %105 %int_1 + OpStore %GLF_dead3k %106 + OpBranch %87 + %88 = OpLabel + %108 = OpAccessChain %_ptr_StorageBuffer_uint %x_12 %uint_0 %int_0 + OpStore %108 %uint_42 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %111 = OpLabel + %112 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc88eb2a41 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-for-loops-with-barrier-function/0-opt.wgsl.expected.wgsl @@ -0,0 +1,99 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +type RTArr = [[stride(4)]] array; + +[[block]] +struct doesNotMatter { + x_compute_data : RTArr; +}; + +var GLF_live2gl_FragCoord : vec4; + +[[group(0), binding(1)]] var x_9 : buf0; + +[[group(0), binding(0)]] var x_12 : doesNotMatter; + +fn main_1() { + var GLF_live2_looplimiter1 : i32; + var i : i32; + var j : i32; + var GLF_dead3x : f32; + var x_51 : f32; + var GLF_dead3k : i32; + GLF_live2_looplimiter1 = 0; + i = 0; + loop { + let x_56 : i32 = i; + if ((x_56 < 1)) { + } else { + break; + } + let x_59 : i32 = GLF_live2_looplimiter1; + if ((x_59 >= 3)) { + j = 0; + loop { + let x_67 : i32 = j; + if ((x_67 < 1)) { + } else { + break; + } + let x_13 : f32 = GLF_live2gl_FragCoord.x; + if ((i32(x_13) < 120)) { + } else { + workgroupBarrier(); + } + + continuing { + let x_76 : i32 = j; + j = (x_76 + 1); + } + } + break; + } + + continuing { + let x_78 : i32 = i; + i = (x_78 + 1); + } + } + let x_81 : f32 = x_9.injectionSwitch.x; + let x_83 : f32 = x_9.injectionSwitch.y; + if ((x_81 > x_83)) { + let x_14 : f32 = GLF_live2gl_FragCoord.x; + x_51 = x_14; + } else { + x_51 = 0.0; + } + let x_15 : f32 = x_51; + GLF_dead3x = x_15; + GLF_dead3k = 0; + loop { + let x_93 : i32 = GLF_dead3k; + if ((x_93 < 2)) { + } else { + break; + } + let x_96 : f32 = GLF_dead3x; + if ((x_96 > 4.0)) { + break; + } + let x_16 : f32 = GLF_live2gl_FragCoord.x; + GLF_dead3x = x_16; + workgroupBarrier(); + + continuing { + let x_101 : i32 = GLF_dead3k; + GLF_dead3k = (x_101 + 1); + } + } + x_12.x_compute_data[0] = 42u; + return; +} + +[[stage(compute), workgroup_size(1, 18, 6)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm new file mode 100644 index 0000000000..7f00636c43 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm @@ -0,0 +1,126 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %x "x" + OpName %matrix_u "matrix_u" + OpName %b "b" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "matrix_a_uni" + OpName %_ "" + OpName %matrix_b "matrix_b" + OpName %_GLF_color "_GLF_color" + OpDecorate %x RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %b RelaxedPrecision + OpMemberDecorate %buf0 0 ColMajor + OpMemberDecorate %buf0 0 Offset 0 + OpMemberDecorate %buf0 0 MatrixStride 16 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_4 = OpConstant %int 4 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float +%mat4v4float = OpTypeMatrix %v4float 4 + %buf0 = OpTypeStruct %mat4v4float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_n1 = OpConstant %float -1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %40 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %19 + %41 = OpLabel + %x = OpVariable %_ptr_Function_int Function + %matrix_u = OpVariable %_ptr_Function_v4float Function + %b = OpVariable %_ptr_Function_int Function + %matrix_b = OpVariable %_ptr_Function_v4float Function + %42 = OpVariable %_ptr_Function_v4float Function + OpStore %x %int_4 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %10 = OpLoad %int %x + %47 = OpSGreaterThanEqual %bool %10 %int_1 + OpBranchConditional %47 %48 %44 + %48 = OpLabel + %11 = OpLoad %int %x + %49 = OpAccessChain %_ptr_Function_float %matrix_u %11 + OpStore %49 %float_1 + OpBranch %45 + %45 = OpLabel + %12 = OpLoad %int %x + %13 = OpISub %int %12 %int_1 + OpStore %x %13 + OpBranch %43 + %44 = OpLabel + OpStore %b %int_4 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 %uint_0 + %55 = OpLoad %float %54 + %56 = OpFOrdLessThan %bool %55 %float_n1 + OpBranchConditional %56 %57 %51 + %57 = OpLabel + %14 = OpLoad %int %b + %15 = OpLoad %int %b + %58 = OpSGreaterThan %bool %15 %int_1 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + %62 = OpLoad %v4float %matrix_b + %63 = OpLoad %v4float %matrix_b + %64 = OpExtInst %v4float %1 FMin %62 %63 + OpStore %42 %64 + OpBranch %59 + %61 = OpLabel + %65 = OpLoad %v4float %matrix_u + OpStore %42 %65 + OpBranch %59 + %59 = OpLabel + %66 = OpAccessChain %_ptr_Function_float %42 %uint_1 + %67 = OpLoad %float %66 + %68 = OpAccessChain %_ptr_Function_float %matrix_b %14 + OpStore %68 %67 + OpBranch %52 + %52 = OpLabel + %16 = OpLoad %int %b + %17 = OpISub %int %16 %int_1 + OpStore %b %17 + OpBranch %50 + %51 = OpLabel + OpStore %_GLF_color %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..807ea01a4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.hlsl @@ -0,0 +1,58 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x = 0; + float4 matrix_u = float4(0.0f, 0.0f, 0.0f, 0.0f); + int b = 0; + float4 matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_42 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x = 4; + { + for(; (x >= 1); x = (x - 1)) { + set_float4(matrix_u, x, 1.0f); + } + } + b = 4; + while (true) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_55 < -1.0f)) { + } else { + break; + } + const int x_14 = b; + if ((b > 1)) { + x_42 = min(matrix_b, matrix_b); + } else { + x_42 = matrix_u; + } + const float x_67 = x_42.y; + set_float4(matrix_b, x_14, x_67); + { + b = (b - 1); + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.msl new file mode 100644 index 0000000000..3b8cbfcc54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.msl @@ -0,0 +1,69 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float4x4 matrix_a_uni; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + int x = 0; + float4 matrix_u = 0.0f; + int b = 0; + float4 matrix_b = 0.0f; + float4 x_42 = 0.0f; + x = 4; + while (true) { + int const x_10 = x; + if ((x_10 >= 1)) { + } else { + break; + } + int const x_11 = x; + matrix_u[x_11] = 1.0f; + { + int const x_12 = x; + x = (x_12 - 1); + } + } + b = 4; + while (true) { + float const x_55 = x_8.matrix_a_uni[0].x; + if ((x_55 < -1.0f)) { + } else { + break; + } + int const x_14 = b; + int const x_15 = b; + if ((x_15 > 1)) { + float4 const x_62 = matrix_b; + float4 const x_63 = matrix_b; + x_42 = fmin(x_62, x_63); + } else { + float4 const x_65 = matrix_u; + x_42 = x_65; + } + float const x_67 = x_42.y; + matrix_b[x_14] = x_67; + { + int const x_16 = b; + b = (x_16 - 1); + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..3f924a6a19 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.spvasm @@ -0,0 +1,160 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + %67 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "matrix_a_uni" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x "x" + OpName %matrix_u "matrix_u" + OpName %b "b" + OpName %matrix_b "matrix_b" + OpName %x_42 "x_42" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpMemberDecorate %buf0 0 ColMajor + OpMemberDecorate %buf0 0 MatrixStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %buf0 = OpTypeStruct %mat4v4float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int_4 = OpConstant %int 4 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_n1 = OpConstant %float -1 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %76 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x = OpVariable %_ptr_Function_int Function %19 + %matrix_u = OpVariable %_ptr_Function_v4float Function %9 + %b = OpVariable %_ptr_Function_int Function %19 + %matrix_b = OpVariable %_ptr_Function_v4float Function %9 + %x_42 = OpVariable %_ptr_Function_v4float Function %9 + OpStore %x %int_4 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %x + %32 = OpSGreaterThanEqual %bool %30 %int_1 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + OpBranch %34 + %36 = OpLabel + OpBranch %27 + %34 = OpLabel + %37 = OpLoad %int %x + %39 = OpAccessChain %_ptr_Function_float %matrix_u %37 + OpStore %39 %float_1 + OpBranch %28 + %28 = OpLabel + %41 = OpLoad %int %x + %42 = OpISub %int %41 %int_1 + OpStore %x %42 + OpBranch %26 + %27 = OpLabel + OpStore %b %int_4 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 %uint_0 + %52 = OpLoad %float %51 + %54 = OpFOrdLessThan %bool %52 %float_n1 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %44 + %55 = OpLabel + %58 = OpLoad %int %b + %59 = OpLoad %int %b + %60 = OpSGreaterThan %bool %59 %int_1 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + %64 = OpLoad %v4float %matrix_b + %65 = OpLoad %v4float %matrix_b + %66 = OpExtInst %v4float %67 NMin %64 %65 + OpStore %x_42 %66 + OpBranch %61 + %63 = OpLabel + %68 = OpLoad %v4float %matrix_u + OpStore %x_42 %68 + OpBranch %61 + %61 = OpLabel + %70 = OpAccessChain %_ptr_Function_float %x_42 %uint_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Function_float %matrix_b %58 + OpStore %72 %71 + OpBranch %45 + %45 = OpLabel + %73 = OpLoad %int %b + %74 = OpISub %int %73 %int_1 + OpStore %b %74 + OpBranch %43 + %44 = OpLabel + OpStore %x_GLF_color %76 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %77 +%tint_symbol = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %84 = OpLabel + %85 = OpFunctionCall %void %main_1 + %87 = OpLoad %v4float %x_GLF_color + %88 = OpCompositeConstruct %main_out %87 + %86 = OpFunctionCall %void %tint_symbol_2 %88 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..71733ddf52 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.spvasm.expected.wgsl @@ -0,0 +1,69 @@ +[[block]] +struct buf0 { + matrix_a_uni : mat4x4; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x : i32; + var matrix_u : vec4; + var b : i32; + var matrix_b : vec4; + var x_42 : vec4; + x = 4; + loop { + let x_10 : i32 = x; + if ((x_10 >= 1)) { + } else { + break; + } + let x_11 : i32 = x; + matrix_u[x_11] = 1.0; + + continuing { + let x_12 : i32 = x; + x = (x_12 - 1); + } + } + b = 4; + loop { + let x_55 : f32 = x_8.matrix_a_uni[0].x; + if ((x_55 < -1.0)) { + } else { + break; + } + let x_14 : i32 = b; + let x_15 : i32 = b; + if ((x_15 > 1)) { + let x_62 : vec4 = matrix_b; + let x_63 : vec4 = matrix_b; + x_42 = min(x_62, x_63); + } else { + let x_65 : vec4 = matrix_u; + x_42 = x_65; + } + let x_67 : f32 = x_42.y; + matrix_b[x_14] = x_67; + + continuing { + let x_16 : i32 = b; + b = (x_16 - 1); + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl new file mode 100644 index 0000000000..71733ddf52 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl @@ -0,0 +1,69 @@ +[[block]] +struct buf0 { + matrix_a_uni : mat4x4; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x : i32; + var matrix_u : vec4; + var b : i32; + var matrix_b : vec4; + var x_42 : vec4; + x = 4; + loop { + let x_10 : i32 = x; + if ((x_10 >= 1)) { + } else { + break; + } + let x_11 : i32 = x; + matrix_u[x_11] = 1.0; + + continuing { + let x_12 : i32 = x; + x = (x_12 - 1); + } + } + b = 4; + loop { + let x_55 : f32 = x_8.matrix_a_uni[0].x; + if ((x_55 < -1.0)) { + } else { + break; + } + let x_14 : i32 = b; + let x_15 : i32 = b; + if ((x_15 > 1)) { + let x_62 : vec4 = matrix_b; + let x_63 : vec4 = matrix_b; + x_42 = min(x_62, x_63); + } else { + let x_65 : vec4 = matrix_u; + x_42 = x_65; + } + let x_67 : f32 = x_42.y; + matrix_b[x_14] = x_67; + + continuing { + let x_16 : i32 = b; + b = (x_16 - 1); + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..807ea01a4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.hlsl @@ -0,0 +1,58 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +cbuffer cbuffer_x_8 : register(b0, space0) { + uint4 x_8[4]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int x = 0; + float4 matrix_u = float4(0.0f, 0.0f, 0.0f, 0.0f); + int b = 0; + float4 matrix_b = float4(0.0f, 0.0f, 0.0f, 0.0f); + float4 x_42 = float4(0.0f, 0.0f, 0.0f, 0.0f); + x = 4; + { + for(; (x >= 1); x = (x - 1)) { + set_float4(matrix_u, x, 1.0f); + } + } + b = 4; + while (true) { + const uint scalar_offset = ((16u * uint(0))) / 4; + const float x_55 = asfloat(x_8[scalar_offset / 4][scalar_offset % 4]); + if ((x_55 < -1.0f)) { + } else { + break; + } + const int x_14 = b; + if ((b > 1)) { + x_42 = min(matrix_b, matrix_b); + } else { + x_42 = matrix_u; + } + const float x_67 = x_42.y; + set_float4(matrix_b, x_14, x_67); + { + b = (b - 1); + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.msl new file mode 100644 index 0000000000..3b8cbfcc54 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.msl @@ -0,0 +1,69 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ float4x4 matrix_a_uni; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) { + int x = 0; + float4 matrix_u = 0.0f; + int b = 0; + float4 matrix_b = 0.0f; + float4 x_42 = 0.0f; + x = 4; + while (true) { + int const x_10 = x; + if ((x_10 >= 1)) { + } else { + break; + } + int const x_11 = x; + matrix_u[x_11] = 1.0f; + { + int const x_12 = x; + x = (x_12 - 1); + } + } + b = 4; + while (true) { + float const x_55 = x_8.matrix_a_uni[0].x; + if ((x_55 < -1.0f)) { + } else { + break; + } + int const x_14 = b; + int const x_15 = b; + if ((x_15 > 1)) { + float4 const x_62 = matrix_b; + float4 const x_63 = matrix_b; + x_42 = fmin(x_62, x_63); + } else { + float4 const x_65 = matrix_u; + x_42 = x_65; + } + float const x_67 = x_42.y; + matrix_b[x_14] = x_67; + { + int const x_16 = b; + b = (x_16 - 1); + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_8, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..3f924a6a19 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.spvasm @@ -0,0 +1,160 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + %67 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "matrix_a_uni" + OpName %x_8 "x_8" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x "x" + OpName %matrix_u "matrix_u" + OpName %b "b" + OpName %matrix_b "matrix_b" + OpName %x_42 "x_42" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpMemberDecorate %buf0 0 ColMajor + OpMemberDecorate %buf0 0 MatrixStride 16 + OpDecorate %x_8 NonWritable + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %buf0 = OpTypeStruct %mat4v4float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_8 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int_4 = OpConstant %int 4 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_n1 = OpConstant %float -1 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %76 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %77 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x = OpVariable %_ptr_Function_int Function %19 + %matrix_u = OpVariable %_ptr_Function_v4float Function %9 + %b = OpVariable %_ptr_Function_int Function %19 + %matrix_b = OpVariable %_ptr_Function_v4float Function %9 + %x_42 = OpVariable %_ptr_Function_v4float Function %9 + OpStore %x %int_4 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %x + %32 = OpSGreaterThanEqual %bool %30 %int_1 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + OpBranch %34 + %36 = OpLabel + OpBranch %27 + %34 = OpLabel + %37 = OpLoad %int %x + %39 = OpAccessChain %_ptr_Function_float %matrix_u %37 + OpStore %39 %float_1 + OpBranch %28 + %28 = OpLabel + %41 = OpLoad %int %x + %42 = OpISub %int %41 %int_1 + OpStore %x %42 + OpBranch %26 + %27 = OpLabel + OpStore %b %int_4 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %51 = OpAccessChain %_ptr_Uniform_float %x_8 %uint_0 %int_0 %uint_0 + %52 = OpLoad %float %51 + %54 = OpFOrdLessThan %bool %52 %float_n1 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %44 + %55 = OpLabel + %58 = OpLoad %int %b + %59 = OpLoad %int %b + %60 = OpSGreaterThan %bool %59 %int_1 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %63 + %62 = OpLabel + %64 = OpLoad %v4float %matrix_b + %65 = OpLoad %v4float %matrix_b + %66 = OpExtInst %v4float %67 NMin %64 %65 + OpStore %x_42 %66 + OpBranch %61 + %63 = OpLabel + %68 = OpLoad %v4float %matrix_u + OpStore %x_42 %68 + OpBranch %61 + %61 = OpLabel + %70 = OpAccessChain %_ptr_Function_float %x_42 %uint_1 + %71 = OpLoad %float %70 + %72 = OpAccessChain %_ptr_Function_float %matrix_b %58 + OpStore %72 %71 + OpBranch %45 + %45 = OpLabel + %73 = OpLoad %int %b + %74 = OpISub %int %73 %int_1 + OpStore %b %74 + OpBranch %43 + %44 = OpLabel + OpStore %x_GLF_color %76 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %77 +%tint_symbol = OpFunctionParameter %main_out + %81 = OpLabel + %82 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %82 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %84 = OpLabel + %85 = OpFunctionCall %void %main_1 + %87 = OpLoad %v4float %x_GLF_color + %88 = OpCompositeConstruct %main_out %87 + %86 = OpFunctionCall %void %tint_symbol_2 %88 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..71733ddf52 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-matrix/0.wgsl.expected.wgsl @@ -0,0 +1,69 @@ +[[block]] +struct buf0 { + matrix_a_uni : mat4x4; +}; + +[[group(0), binding(0)]] var x_8 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x : i32; + var matrix_u : vec4; + var b : i32; + var matrix_b : vec4; + var x_42 : vec4; + x = 4; + loop { + let x_10 : i32 = x; + if ((x_10 >= 1)) { + } else { + break; + } + let x_11 : i32 = x; + matrix_u[x_11] = 1.0; + + continuing { + let x_12 : i32 = x; + x = (x_12 - 1); + } + } + b = 4; + loop { + let x_55 : f32 = x_8.matrix_a_uni[0].x; + if ((x_55 < -1.0)) { + } else { + break; + } + let x_14 : i32 = b; + let x_15 : i32 = b; + if ((x_15 > 1)) { + let x_62 : vec4 = matrix_b; + let x_63 : vec4 = matrix_b; + x_42 = min(x_62, x_63); + } else { + let x_65 : vec4 = matrix_u; + x_42 = x_65; + } + let x_67 : f32 = x_42.y; + matrix_b[x_14] = x_67; + + continuing { + let x_16 : i32 = b; + b = (x_16 - 1); + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm new file mode 100644 index 0000000000..5657c008b6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm @@ -0,0 +1,84 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %StructType "StructType" + OpMemberName %StructType 0 "col" + OpMemberName %StructType 1 "bbbb" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %v3float = OpTypeVector %float 3 + %v4bool = OpTypeVector %bool 4 + %StructType = OpTypeStruct %v3float %v4bool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %26 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %30 = OpUndef %StructType + %main = OpFunction %void None %12 + %31 = OpLabel + OpBranch %32 + %32 = OpLabel + %33 = OpPhi %StructType %30 %31 %34 %35 + %9 = OpPhi %int %int_0 %31 %7 %35 + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %37 = OpLoad %float %36 + %38 = OpConvertFToS %int %37 + %39 = OpSLessThan %bool %9 %38 + OpLoopMerge %40 %35 None + OpBranchConditional %39 %35 %40 + %35 = OpLabel + %34 = OpCompositeInsert %StructType %26 %33 0 + %7 = OpIAdd %int %9 %int_1 + OpBranch %32 + %40 = OpLabel + OpBranch %41 + %41 = OpLabel + %42 = OpPhi %StructType %33 %40 %43 %44 + %10 = OpPhi %int %int_0 %40 %8 %44 + %45 = OpSLessThan %bool %10 %38 + OpLoopMerge %46 %44 None + OpBranchConditional %45 %44 %46 + %44 = OpLabel + %43 = OpCompositeInsert %StructType %26 %42 0 + %8 = OpIAdd %int %10 %int_1 + OpBranch %41 + %46 = OpLabel + %47 = OpCompositeExtract %v3float %42 0 + %48 = OpCompositeExtract %float %47 0 + %49 = OpCompositeExtract %float %47 1 + %50 = OpCompositeExtract %float %47 2 + %51 = OpCompositeConstruct %v4float %48 %49 %50 %float_1 + OpStore %_GLF_color %51 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..3a00c148ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.hlsl @@ -0,0 +1,77 @@ +struct StructType { + float3 col; + bool4 bbbb; +}; + +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + StructType x_33 = (StructType)0; + int x_38 = 0; + StructType x_42 = (StructType)0; + StructType x_33_phi = (StructType)0; + int x_9_phi = 0; + StructType x_42_phi = (StructType)0; + int x_10_phi = 0; + const StructType tint_symbol_3 = {float3(0.0f, 0.0f, 0.0f), bool4(false, false, false, false)}; + x_33_phi = tint_symbol_3; + x_9_phi = 0; + while (true) { + StructType x_34 = (StructType)0; + int x_7 = 0; + x_33 = x_33_phi; + const int x_9 = x_9_phi; + const float x_37 = asfloat(x_5[0].y); + x_38 = int(x_37); + if ((x_9 < x_38)) { + } else { + break; + } + { + x_34 = x_33; + x_34.col = float3(1.0f, 0.0f, 0.0f); + x_7 = (x_9 + 1); + x_33_phi = x_34; + x_9_phi = x_7; + } + } + x_42_phi = x_33; + x_10_phi = 0; + while (true) { + StructType x_43 = (StructType)0; + int x_8 = 0; + x_42 = x_42_phi; + const int x_10 = x_10_phi; + if ((x_10 < x_38)) { + } else { + break; + } + { + x_43 = x_42; + x_43.col = float3(1.0f, 0.0f, 0.0f); + x_8 = (x_10 + 1); + x_42_phi = x_43; + x_10_phi = x_8; + } + } + const float3 x_47 = x_42.col; + x_GLF_color = float4(x_47.x, x_47.y, x_47.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.msl new file mode 100644 index 0000000000..51c44be9d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct StructType { + float3 col; + bool4 bbbb; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_5) { + StructType x_33 = {}; + int x_38 = 0; + StructType x_42 = {}; + StructType x_33_phi = {}; + int x_9_phi = 0; + StructType x_42_phi = {}; + int x_10_phi = 0; + StructType const tint_symbol_3 = {.col=float3(0.0f, 0.0f, 0.0f), .bbbb=bool4(false, false, false, false)}; + x_33_phi = tint_symbol_3; + x_9_phi = 0; + while (true) { + StructType x_34 = {}; + int x_7 = 0; + x_33 = x_33_phi; + int const x_9 = x_9_phi; + float const x_37 = x_5.injectionSwitch.y; + x_38 = int(x_37); + if ((x_9 < x_38)) { + } else { + break; + } + { + x_34 = x_33; + x_34.col = float3(1.0f, 0.0f, 0.0f); + x_7 = (x_9 + 1); + x_33_phi = x_34; + x_9_phi = x_7; + } + } + x_42_phi = x_33; + x_10_phi = 0; + while (true) { + StructType x_43 = {}; + int x_8 = 0; + x_42 = x_42_phi; + int const x_10 = x_10_phi; + if ((x_10 < x_38)) { + } else { + break; + } + { + x_43 = x_42; + x_43.col = float3(1.0f, 0.0f, 0.0f); + x_8 = (x_10 + 1); + x_42_phi = x_43; + x_10_phi = x_8; + } + } + float3 const x_47 = x_42.col; + *(tint_symbol_5) = float4(x_47.x, x_47.y, x_47.z, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_5, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..c14f116ce1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.spvasm @@ -0,0 +1,189 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %StructType "StructType" + OpMemberName %StructType 0 "col" + OpMemberName %StructType 1 "bbbb" + OpName %x_33 "x_33" + OpName %x_38 "x_38" + OpName %x_42 "x_42" + OpName %x_33_phi "x_33_phi" + OpName %x_9_phi "x_9_phi" + OpName %x_42_phi "x_42_phi" + OpName %x_10_phi "x_10_phi" + OpName %x_34 "x_34" + OpName %x_7 "x_7" + OpName %x_43 "x_43" + OpName %x_8 "x_8" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %StructType 0 Offset 0 + OpMemberDecorate %StructType 1 Offset 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %StructType = OpTypeStruct %v3float %v4bool +%_ptr_Function_StructType = OpTypePointer Function %StructType + %22 = OpConstantNull %StructType + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %35 = OpConstantComposite %v4bool %false %false %false %false + %36 = OpConstantComposite %StructType %33 %35 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 + %62 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %92 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_33 = OpVariable %_ptr_Function_StructType Function %22 + %x_38 = OpVariable %_ptr_Function_int Function %26 + %x_42 = OpVariable %_ptr_Function_StructType Function %22 + %x_33_phi = OpVariable %_ptr_Function_StructType Function %22 + %x_9_phi = OpVariable %_ptr_Function_int Function %26 + %x_42_phi = OpVariable %_ptr_Function_StructType Function %22 + %x_10_phi = OpVariable %_ptr_Function_int Function %26 + %x_34 = OpVariable %_ptr_Function_StructType Function %22 + %x_7 = OpVariable %_ptr_Function_int Function %26 + %x_43 = OpVariable %_ptr_Function_StructType Function %22 + %x_8 = OpVariable %_ptr_Function_int Function %26 + OpStore %x_33_phi %36 + OpStore %x_9_phi %int_0 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %44 = OpLoad %StructType %x_33_phi + OpStore %x_33 %44 + %45 = OpLoad %int %x_9_phi + %50 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %51 = OpLoad %float %50 + %52 = OpConvertFToS %int %51 + OpStore %x_38 %52 + %53 = OpLoad %int %x_38 + %54 = OpSLessThan %bool %45 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %39 + %55 = OpLabel + OpBranch %40 + %40 = OpLabel + %58 = OpLoad %StructType %x_33 + OpStore %x_34 %58 + %60 = OpAccessChain %_ptr_Function_v3float %x_34 %uint_0 + OpStore %60 %62 + %64 = OpIAdd %int %45 %int_1 + OpStore %x_7 %64 + %65 = OpLoad %StructType %x_34 + OpStore %x_33_phi %65 + %66 = OpLoad %int %x_7 + OpStore %x_9_phi %66 + OpBranch %38 + %39 = OpLabel + %67 = OpLoad %StructType %x_33 + OpStore %x_42_phi %67 + OpStore %x_10_phi %int_0 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %74 = OpLoad %StructType %x_42_phi + OpStore %x_42 %74 + %75 = OpLoad %int %x_10_phi + %76 = OpLoad %int %x_38 + %77 = OpSLessThan %bool %75 %76 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + OpBranch %78 + %80 = OpLabel + OpBranch %69 + %78 = OpLabel + OpBranch %70 + %70 = OpLabel + %81 = OpLoad %StructType %x_42 + OpStore %x_43 %81 + %82 = OpAccessChain %_ptr_Function_v3float %x_43 %uint_0 + OpStore %82 %62 + %83 = OpIAdd %int %75 %int_1 + OpStore %x_8 %83 + %84 = OpLoad %StructType %x_43 + OpStore %x_42_phi %84 + %85 = OpLoad %int %x_8 + OpStore %x_10_phi %85 + OpBranch %68 + %69 = OpLabel + %86 = OpAccessChain %_ptr_Function_v3float %x_42 %uint_0 + %87 = OpLoad %v3float %86 + %88 = OpCompositeExtract %float %87 0 + %89 = OpCompositeExtract %float %87 1 + %90 = OpCompositeExtract %float %87 2 + %91 = OpCompositeConstruct %v4float %88 %89 %90 %float_1 + OpStore %x_GLF_color %91 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %92 +%tint_symbol = OpFunctionParameter %main_out + %96 = OpLabel + %97 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %97 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %99 = OpLabel + %100 = OpFunctionCall %void %main_1 + %102 = OpLoad %v4float %x_GLF_color + %103 = OpCompositeConstruct %main_out %102 + %101 = OpFunctionCall %void %tint_symbol_2 %103 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..187ea36502 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.spvasm.expected.wgsl @@ -0,0 +1,79 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +struct StructType { + col : vec3; + bbbb : vec4; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_33 : StructType; + var x_38 : i32; + var x_42 : StructType; + var x_33_phi : StructType; + var x_9_phi : i32; + var x_42_phi : StructType; + var x_10_phi : i32; + x_33_phi = StructType(vec3(0.0, 0.0, 0.0), vec4(false, false, false, false)); + x_9_phi = 0; + loop { + var x_34 : StructType; + var x_7 : i32; + x_33 = x_33_phi; + let x_9 : i32 = x_9_phi; + let x_37 : f32 = x_5.injectionSwitch.y; + x_38 = i32(x_37); + if ((x_9 < x_38)) { + } else { + break; + } + + continuing { + x_34 = x_33; + x_34.col = vec3(1.0, 0.0, 0.0); + x_7 = (x_9 + 1); + x_33_phi = x_34; + x_9_phi = x_7; + } + } + x_42_phi = x_33; + x_10_phi = 0; + loop { + var x_43 : StructType; + var x_8 : i32; + x_42 = x_42_phi; + let x_10 : i32 = x_10_phi; + if ((x_10 < x_38)) { + } else { + break; + } + + continuing { + x_43 = x_42; + x_43.col = vec3(1.0, 0.0, 0.0); + x_8 = (x_10 + 1); + x_42_phi = x_43; + x_10_phi = x_8; + } + } + let x_47 : vec3 = x_42.col; + x_GLF_color = vec4(x_47.x, x_47.y, x_47.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl new file mode 100644 index 0000000000..187ea36502 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl @@ -0,0 +1,79 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +struct StructType { + col : vec3; + bbbb : vec4; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_33 : StructType; + var x_38 : i32; + var x_42 : StructType; + var x_33_phi : StructType; + var x_9_phi : i32; + var x_42_phi : StructType; + var x_10_phi : i32; + x_33_phi = StructType(vec3(0.0, 0.0, 0.0), vec4(false, false, false, false)); + x_9_phi = 0; + loop { + var x_34 : StructType; + var x_7 : i32; + x_33 = x_33_phi; + let x_9 : i32 = x_9_phi; + let x_37 : f32 = x_5.injectionSwitch.y; + x_38 = i32(x_37); + if ((x_9 < x_38)) { + } else { + break; + } + + continuing { + x_34 = x_33; + x_34.col = vec3(1.0, 0.0, 0.0); + x_7 = (x_9 + 1); + x_33_phi = x_34; + x_9_phi = x_7; + } + } + x_42_phi = x_33; + x_10_phi = 0; + loop { + var x_43 : StructType; + var x_8 : i32; + x_42 = x_42_phi; + let x_10 : i32 = x_10_phi; + if ((x_10 < x_38)) { + } else { + break; + } + + continuing { + x_43 = x_42; + x_43.col = vec3(1.0, 0.0, 0.0); + x_8 = (x_10 + 1); + x_42_phi = x_43; + x_10_phi = x_8; + } + } + let x_47 : vec3 = x_42.col; + x_GLF_color = vec4(x_47.x, x_47.y, x_47.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..3a00c148ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.hlsl @@ -0,0 +1,77 @@ +struct StructType { + float3 col; + bool4 bbbb; +}; + +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + StructType x_33 = (StructType)0; + int x_38 = 0; + StructType x_42 = (StructType)0; + StructType x_33_phi = (StructType)0; + int x_9_phi = 0; + StructType x_42_phi = (StructType)0; + int x_10_phi = 0; + const StructType tint_symbol_3 = {float3(0.0f, 0.0f, 0.0f), bool4(false, false, false, false)}; + x_33_phi = tint_symbol_3; + x_9_phi = 0; + while (true) { + StructType x_34 = (StructType)0; + int x_7 = 0; + x_33 = x_33_phi; + const int x_9 = x_9_phi; + const float x_37 = asfloat(x_5[0].y); + x_38 = int(x_37); + if ((x_9 < x_38)) { + } else { + break; + } + { + x_34 = x_33; + x_34.col = float3(1.0f, 0.0f, 0.0f); + x_7 = (x_9 + 1); + x_33_phi = x_34; + x_9_phi = x_7; + } + } + x_42_phi = x_33; + x_10_phi = 0; + while (true) { + StructType x_43 = (StructType)0; + int x_8 = 0; + x_42 = x_42_phi; + const int x_10 = x_10_phi; + if ((x_10 < x_38)) { + } else { + break; + } + { + x_43 = x_42; + x_43.col = float3(1.0f, 0.0f, 0.0f); + x_8 = (x_10 + 1); + x_42_phi = x_43; + x_10_phi = x_8; + } + } + const float3 x_47 = x_42.col; + x_GLF_color = float4(x_47.x, x_47.y, x_47.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_4 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.msl new file mode 100644 index 0000000000..51c44be9d5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.msl @@ -0,0 +1,79 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct StructType { + float3 col; + bool4 bbbb; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_5) { + StructType x_33 = {}; + int x_38 = 0; + StructType x_42 = {}; + StructType x_33_phi = {}; + int x_9_phi = 0; + StructType x_42_phi = {}; + int x_10_phi = 0; + StructType const tint_symbol_3 = {.col=float3(0.0f, 0.0f, 0.0f), .bbbb=bool4(false, false, false, false)}; + x_33_phi = tint_symbol_3; + x_9_phi = 0; + while (true) { + StructType x_34 = {}; + int x_7 = 0; + x_33 = x_33_phi; + int const x_9 = x_9_phi; + float const x_37 = x_5.injectionSwitch.y; + x_38 = int(x_37); + if ((x_9 < x_38)) { + } else { + break; + } + { + x_34 = x_33; + x_34.col = float3(1.0f, 0.0f, 0.0f); + x_7 = (x_9 + 1); + x_33_phi = x_34; + x_9_phi = x_7; + } + } + x_42_phi = x_33; + x_10_phi = 0; + while (true) { + StructType x_43 = {}; + int x_8 = 0; + x_42 = x_42_phi; + int const x_10 = x_10_phi; + if ((x_10 < x_38)) { + } else { + break; + } + { + x_43 = x_42; + x_43.col = float3(1.0f, 0.0f, 0.0f); + x_8 = (x_10 + 1); + x_42_phi = x_43; + x_10_phi = x_8; + } + } + float3 const x_47 = x_42.col; + *(tint_symbol_5) = float4(x_47.x, x_47.y, x_47.z, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_5, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..c14f116ce1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.spvasm @@ -0,0 +1,189 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 104 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %StructType "StructType" + OpMemberName %StructType 0 "col" + OpMemberName %StructType 1 "bbbb" + OpName %x_33 "x_33" + OpName %x_38 "x_38" + OpName %x_42 "x_42" + OpName %x_33_phi "x_33_phi" + OpName %x_9_phi "x_9_phi" + OpName %x_42_phi "x_42_phi" + OpName %x_10_phi "x_10_phi" + OpName %x_34 "x_34" + OpName %x_7 "x_7" + OpName %x_43 "x_43" + OpName %x_8 "x_8" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %StructType 0 Offset 0 + OpMemberDecorate %StructType 1 Offset 16 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %StructType = OpTypeStruct %v3float %v4bool +%_ptr_Function_StructType = OpTypePointer Function %StructType + %22 = OpConstantNull %StructType + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %26 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %33 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %false = OpConstantFalse %bool + %35 = OpConstantComposite %v4bool %false %false %false %false + %36 = OpConstantComposite %StructType %33 %35 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 + %62 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %92 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_33 = OpVariable %_ptr_Function_StructType Function %22 + %x_38 = OpVariable %_ptr_Function_int Function %26 + %x_42 = OpVariable %_ptr_Function_StructType Function %22 + %x_33_phi = OpVariable %_ptr_Function_StructType Function %22 + %x_9_phi = OpVariable %_ptr_Function_int Function %26 + %x_42_phi = OpVariable %_ptr_Function_StructType Function %22 + %x_10_phi = OpVariable %_ptr_Function_int Function %26 + %x_34 = OpVariable %_ptr_Function_StructType Function %22 + %x_7 = OpVariable %_ptr_Function_int Function %26 + %x_43 = OpVariable %_ptr_Function_StructType Function %22 + %x_8 = OpVariable %_ptr_Function_int Function %26 + OpStore %x_33_phi %36 + OpStore %x_9_phi %int_0 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %44 = OpLoad %StructType %x_33_phi + OpStore %x_33 %44 + %45 = OpLoad %int %x_9_phi + %50 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %51 = OpLoad %float %50 + %52 = OpConvertFToS %int %51 + OpStore %x_38 %52 + %53 = OpLoad %int %x_38 + %54 = OpSLessThan %bool %45 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpBranch %55 + %57 = OpLabel + OpBranch %39 + %55 = OpLabel + OpBranch %40 + %40 = OpLabel + %58 = OpLoad %StructType %x_33 + OpStore %x_34 %58 + %60 = OpAccessChain %_ptr_Function_v3float %x_34 %uint_0 + OpStore %60 %62 + %64 = OpIAdd %int %45 %int_1 + OpStore %x_7 %64 + %65 = OpLoad %StructType %x_34 + OpStore %x_33_phi %65 + %66 = OpLoad %int %x_7 + OpStore %x_9_phi %66 + OpBranch %38 + %39 = OpLabel + %67 = OpLoad %StructType %x_33 + OpStore %x_42_phi %67 + OpStore %x_10_phi %int_0 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %74 = OpLoad %StructType %x_42_phi + OpStore %x_42 %74 + %75 = OpLoad %int %x_10_phi + %76 = OpLoad %int %x_38 + %77 = OpSLessThan %bool %75 %76 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + OpBranch %78 + %80 = OpLabel + OpBranch %69 + %78 = OpLabel + OpBranch %70 + %70 = OpLabel + %81 = OpLoad %StructType %x_42 + OpStore %x_43 %81 + %82 = OpAccessChain %_ptr_Function_v3float %x_43 %uint_0 + OpStore %82 %62 + %83 = OpIAdd %int %75 %int_1 + OpStore %x_8 %83 + %84 = OpLoad %StructType %x_43 + OpStore %x_42_phi %84 + %85 = OpLoad %int %x_8 + OpStore %x_10_phi %85 + OpBranch %68 + %69 = OpLabel + %86 = OpAccessChain %_ptr_Function_v3float %x_42 %uint_0 + %87 = OpLoad %v3float %86 + %88 = OpCompositeExtract %float %87 0 + %89 = OpCompositeExtract %float %87 1 + %90 = OpCompositeExtract %float %87 2 + %91 = OpCompositeConstruct %v4float %88 %89 %90 %float_1 + OpStore %x_GLF_color %91 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %92 +%tint_symbol = OpFunctionParameter %main_out + %96 = OpLabel + %97 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %97 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %99 = OpLabel + %100 = OpFunctionCall %void %main_1 + %102 = OpLoad %v4float %x_GLF_color + %103 = OpCompositeConstruct %main_out %102 + %101 = OpFunctionCall %void %tint_symbol_2 %103 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..187ea36502 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-set-struct/0.wgsl.expected.wgsl @@ -0,0 +1,79 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +struct StructType { + col : vec3; + bbbb : vec4; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_33 : StructType; + var x_38 : i32; + var x_42 : StructType; + var x_33_phi : StructType; + var x_9_phi : i32; + var x_42_phi : StructType; + var x_10_phi : i32; + x_33_phi = StructType(vec3(0.0, 0.0, 0.0), vec4(false, false, false, false)); + x_9_phi = 0; + loop { + var x_34 : StructType; + var x_7 : i32; + x_33 = x_33_phi; + let x_9 : i32 = x_9_phi; + let x_37 : f32 = x_5.injectionSwitch.y; + x_38 = i32(x_37); + if ((x_9 < x_38)) { + } else { + break; + } + + continuing { + x_34 = x_33; + x_34.col = vec3(1.0, 0.0, 0.0); + x_7 = (x_9 + 1); + x_33_phi = x_34; + x_9_phi = x_7; + } + } + x_42_phi = x_33; + x_10_phi = 0; + loop { + var x_43 : StructType; + var x_8 : i32; + x_42 = x_42_phi; + let x_10 : i32 = x_10_phi; + if ((x_10 < x_38)) { + } else { + break; + } + + continuing { + x_43 = x_42; + x_43.col = vec3(1.0, 0.0, 0.0); + x_8 = (x_10 + 1); + x_42_phi = x_43; + x_10_phi = x_8; + } + } + let x_47 : vec3 = x_42.col; + x_GLF_color = vec4(x_47.x, x_47.y, x_47.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm new file mode 100644 index 0000000000..f71423f92b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm @@ -0,0 +1,127 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %GLF_live15c "GLF_live15c" + OpName %GLF_live15i "GLF_live15i" + OpName %GLF_live15d "GLF_live15d" + OpName %GLF_live15i_0 "GLF_live15i" + OpName %_GLF_color "_GLF_color" + OpDecorate %GLF_live15i RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %GLF_live15i_0 RelaxedPrecision + OpDecorate %13 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %37 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %19 + %38 = OpLabel +%GLF_live15c = OpVariable %_ptr_Function_v4float Function +%GLF_live15i = OpVariable %_ptr_Function_int Function +%GLF_live15d = OpVariable %_ptr_Function_v4float Function +%GLF_live15i_0 = OpVariable %_ptr_Function_int Function + OpStore %GLF_live15c %24 + OpStore %GLF_live15i %int_0 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %8 = OpLoad %int %GLF_live15i + %43 = OpSLessThan %bool %8 %int_4 + OpBranchConditional %43 %44 %40 + %44 = OpLabel + %9 = OpLoad %int %GLF_live15i + %45 = OpSGreaterThanEqual %bool %9 %int_3 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + OpBranch %40 + %46 = OpLabel + %48 = OpAccessChain %_ptr_Function_float %GLF_live15c %uint_1 + %49 = OpLoad %float %48 + %50 = OpFOrdGreaterThanEqual %bool %49 %float_1 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %51 + %52 = OpLabel + %10 = OpLoad %int %GLF_live15i + %53 = OpAccessChain %_ptr_Function_float %GLF_live15c %10 + OpStore %53 %float_1 + OpBranch %51 + %51 = OpLabel + OpBranch %41 + %41 = OpLabel + %11 = OpLoad %int %GLF_live15i + %12 = OpIAdd %int %11 %int_1 + OpStore %GLF_live15i %12 + OpBranch %39 + %40 = OpLabel + OpStore %GLF_live15d %24 + OpStore %GLF_live15i_0 %int_0 + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %13 = OpLoad %int %GLF_live15i_0 + %58 = OpSLessThan %bool %13 %int_4 + OpBranchConditional %58 %59 %55 + %59 = OpLabel + %14 = OpLoad %int %GLF_live15i_0 + %60 = OpSGreaterThanEqual %bool %14 %int_3 + OpSelectionMerge %61 None + OpBranchConditional %60 %62 %61 + %62 = OpLabel + OpBranch %55 + %61 = OpLabel + %63 = OpAccessChain %_ptr_Function_float %GLF_live15d %uint_1 + %64 = OpLoad %float %63 + %65 = OpFOrdGreaterThanEqual %bool %64 %float_1 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %66 + %67 = OpLabel + %15 = OpLoad %int %GLF_live15i_0 + %68 = OpAccessChain %_ptr_Function_float %GLF_live15d %15 + OpStore %68 %float_1 + OpBranch %66 + %66 = OpLabel + OpBranch %56 + %56 = OpLabel + %16 = OpLoad %int %GLF_live15i_0 + %17 = OpIAdd %int %16 %int_1 + OpStore %GLF_live15i_0 %17 + OpBranch %54 + %55 = OpLabel + OpStore %_GLF_color %37 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..55bac3a760 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.hlsl @@ -0,0 +1,54 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 GLF_live15c = float4(0.0f, 0.0f, 0.0f, 0.0f); + int GLF_live15i = 0; + float4 GLF_live15d = float4(0.0f, 0.0f, 0.0f, 0.0f); + int GLF_live15i_1 = 0; + GLF_live15c = float4(0.0f, 0.0f, 0.0f, 0.0f); + GLF_live15i = 0; + { + for(; (GLF_live15i < 4); GLF_live15i = (GLF_live15i + 1)) { + if ((GLF_live15i >= 3)) { + break; + } + const float x_49 = GLF_live15c.y; + if ((x_49 >= 1.0f)) { + set_float4(GLF_live15c, GLF_live15i, 1.0f); + } + } + } + GLF_live15d = float4(0.0f, 0.0f, 0.0f, 0.0f); + GLF_live15i_1 = 0; + { + for(; (GLF_live15i_1 < 4); GLF_live15i_1 = (GLF_live15i_1 + 1)) { + if ((GLF_live15i_1 >= 3)) { + break; + } + const float x_64 = GLF_live15d.y; + if ((x_64 >= 1.0f)) { + set_float4(GLF_live15d, GLF_live15i_1, 1.0f); + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..afbd08f972 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float4 GLF_live15c = 0.0f; + int GLF_live15i = 0; + float4 GLF_live15d = 0.0f; + int GLF_live15i_1 = 0; + GLF_live15c = float4(0.0f, 0.0f, 0.0f, 0.0f); + GLF_live15i = 0; + while (true) { + int const x_8 = GLF_live15i; + if ((x_8 < 4)) { + } else { + break; + } + int const x_9 = GLF_live15i; + if ((x_9 >= 3)) { + break; + } + float const x_49 = GLF_live15c.y; + if ((x_49 >= 1.0f)) { + int const x_10 = GLF_live15i; + GLF_live15c[x_10] = 1.0f; + } + { + int const x_11 = GLF_live15i; + GLF_live15i = (x_11 + 1); + } + } + GLF_live15d = float4(0.0f, 0.0f, 0.0f, 0.0f); + GLF_live15i_1 = 0; + while (true) { + int const x_13 = GLF_live15i_1; + if ((x_13 < 4)) { + } else { + break; + } + int const x_14 = GLF_live15i_1; + if ((x_14 >= 3)) { + break; + } + float const x_64 = GLF_live15d.y; + if ((x_64 >= 1.0f)) { + int const x_15 = GLF_live15i_1; + GLF_live15d[x_15] = 1.0f; + } + { + int const x_16 = GLF_live15i_1; + GLF_live15i_1 = (x_16 + 1); + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..9128fc2fe8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.spvasm @@ -0,0 +1,156 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 88 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %GLF_live15c "GLF_live15c" + OpName %GLF_live15i "GLF_live15i" + OpName %GLF_live15d "GLF_live15d" + OpName %GLF_live15i_1 "GLF_live15i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %75 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %76 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel +%GLF_live15c = OpVariable %_ptr_Function_v4float Function %5 +%GLF_live15i = OpVariable %_ptr_Function_int Function %17 +%GLF_live15d = OpVariable %_ptr_Function_v4float Function %5 +%GLF_live15i_1 = OpVariable %_ptr_Function_int Function %17 + OpStore %GLF_live15c %21 + OpStore %GLF_live15i %int_0 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %27 = OpLoad %int %GLF_live15i + %29 = OpSLessThan %bool %27 %int_4 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpBranch %24 + %31 = OpLabel + %34 = OpLoad %int %GLF_live15i + %36 = OpSGreaterThanEqual %bool %34 %int_3 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + OpBranch %24 + %37 = OpLabel + %42 = OpAccessChain %_ptr_Function_float %GLF_live15c %uint_1 + %43 = OpLoad %float %42 + %45 = OpFOrdGreaterThanEqual %bool %43 %float_1 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + %48 = OpLoad %int %GLF_live15i + %49 = OpAccessChain %_ptr_Function_float %GLF_live15c %48 + OpStore %49 %float_1 + OpBranch %46 + %46 = OpLabel + OpBranch %25 + %25 = OpLabel + %50 = OpLoad %int %GLF_live15i + %52 = OpIAdd %int %50 %int_1 + OpStore %GLF_live15i %52 + OpBranch %23 + %24 = OpLabel + OpStore %GLF_live15d %21 + OpStore %GLF_live15i_1 %int_0 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %int %GLF_live15i_1 + %58 = OpSLessThan %bool %57 %int_4 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + OpBranch %59 + %61 = OpLabel + OpBranch %54 + %59 = OpLabel + %62 = OpLoad %int %GLF_live15i_1 + %63 = OpSGreaterThanEqual %bool %62 %int_3 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + OpBranch %54 + %64 = OpLabel + %66 = OpAccessChain %_ptr_Function_float %GLF_live15d %uint_1 + %67 = OpLoad %float %66 + %68 = OpFOrdGreaterThanEqual %bool %67 %float_1 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + %71 = OpLoad %int %GLF_live15i_1 + %72 = OpAccessChain %_ptr_Function_float %GLF_live15d %71 + OpStore %72 %float_1 + OpBranch %69 + %69 = OpLabel + OpBranch %55 + %55 = OpLabel + %73 = OpLoad %int %GLF_live15i_1 + %74 = OpIAdd %int %73 %int_1 + OpStore %GLF_live15i_1 %74 + OpBranch %53 + %54 = OpLabel + OpStore %x_GLF_color %75 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %76 +%tint_symbol = OpFunctionParameter %main_out + %80 = OpLabel + %81 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %81 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %83 = OpLabel + %84 = OpFunctionCall %void %main_1 + %86 = OpLoad %v4float %x_GLF_color + %87 = OpCompositeConstruct %main_out %86 + %85 = OpFunctionCall %void %tint_symbol_2 %87 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a5541a28ca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.spvasm.expected.wgsl @@ -0,0 +1,67 @@ +var x_GLF_color : vec4; + +fn main_1() { + var GLF_live15c : vec4; + var GLF_live15i : i32; + var GLF_live15d : vec4; + var GLF_live15i_1 : i32; + GLF_live15c = vec4(0.0, 0.0, 0.0, 0.0); + GLF_live15i = 0; + loop { + let x_8 : i32 = GLF_live15i; + if ((x_8 < 4)) { + } else { + break; + } + let x_9 : i32 = GLF_live15i; + if ((x_9 >= 3)) { + break; + } + let x_49 : f32 = GLF_live15c.y; + if ((x_49 >= 1.0)) { + let x_10 : i32 = GLF_live15i; + GLF_live15c[x_10] = 1.0; + } + + continuing { + let x_11 : i32 = GLF_live15i; + GLF_live15i = (x_11 + 1); + } + } + GLF_live15d = vec4(0.0, 0.0, 0.0, 0.0); + GLF_live15i_1 = 0; + loop { + let x_13 : i32 = GLF_live15i_1; + if ((x_13 < 4)) { + } else { + break; + } + let x_14 : i32 = GLF_live15i_1; + if ((x_14 >= 3)) { + break; + } + let x_64 : f32 = GLF_live15d.y; + if ((x_64 >= 1.0)) { + let x_15 : i32 = GLF_live15i_1; + GLF_live15d[x_15] = 1.0; + } + + continuing { + let x_16 : i32 = GLF_live15i_1; + GLF_live15i_1 = (x_16 + 1); + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl new file mode 100644 index 0000000000..a5541a28ca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl @@ -0,0 +1,67 @@ +var x_GLF_color : vec4; + +fn main_1() { + var GLF_live15c : vec4; + var GLF_live15i : i32; + var GLF_live15d : vec4; + var GLF_live15i_1 : i32; + GLF_live15c = vec4(0.0, 0.0, 0.0, 0.0); + GLF_live15i = 0; + loop { + let x_8 : i32 = GLF_live15i; + if ((x_8 < 4)) { + } else { + break; + } + let x_9 : i32 = GLF_live15i; + if ((x_9 >= 3)) { + break; + } + let x_49 : f32 = GLF_live15c.y; + if ((x_49 >= 1.0)) { + let x_10 : i32 = GLF_live15i; + GLF_live15c[x_10] = 1.0; + } + + continuing { + let x_11 : i32 = GLF_live15i; + GLF_live15i = (x_11 + 1); + } + } + GLF_live15d = vec4(0.0, 0.0, 0.0, 0.0); + GLF_live15i_1 = 0; + loop { + let x_13 : i32 = GLF_live15i_1; + if ((x_13 < 4)) { + } else { + break; + } + let x_14 : i32 = GLF_live15i_1; + if ((x_14 >= 3)) { + break; + } + let x_64 : f32 = GLF_live15d.y; + if ((x_64 >= 1.0)) { + let x_15 : i32 = GLF_live15i_1; + GLF_live15d[x_15] = 1.0; + } + + continuing { + let x_16 : i32 = GLF_live15i_1; + GLF_live15i_1 = (x_16 + 1); + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..55bac3a760 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.hlsl @@ -0,0 +1,54 @@ +void set_float4(inout float4 vec, int idx, float val) { + vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec; +} + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4 GLF_live15c = float4(0.0f, 0.0f, 0.0f, 0.0f); + int GLF_live15i = 0; + float4 GLF_live15d = float4(0.0f, 0.0f, 0.0f, 0.0f); + int GLF_live15i_1 = 0; + GLF_live15c = float4(0.0f, 0.0f, 0.0f, 0.0f); + GLF_live15i = 0; + { + for(; (GLF_live15i < 4); GLF_live15i = (GLF_live15i + 1)) { + if ((GLF_live15i >= 3)) { + break; + } + const float x_49 = GLF_live15c.y; + if ((x_49 >= 1.0f)) { + set_float4(GLF_live15c, GLF_live15i, 1.0f); + } + } + } + GLF_live15d = float4(0.0f, 0.0f, 0.0f, 0.0f); + GLF_live15i_1 = 0; + { + for(; (GLF_live15i_1 < 4); GLF_live15i_1 = (GLF_live15i_1 + 1)) { + if ((GLF_live15i_1 >= 3)) { + break; + } + const float x_64 = GLF_live15d.y; + if ((x_64 >= 1.0f)) { + set_float4(GLF_live15d, GLF_live15i_1, 1.0f); + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..afbd08f972 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.msl @@ -0,0 +1,71 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float4 GLF_live15c = 0.0f; + int GLF_live15i = 0; + float4 GLF_live15d = 0.0f; + int GLF_live15i_1 = 0; + GLF_live15c = float4(0.0f, 0.0f, 0.0f, 0.0f); + GLF_live15i = 0; + while (true) { + int const x_8 = GLF_live15i; + if ((x_8 < 4)) { + } else { + break; + } + int const x_9 = GLF_live15i; + if ((x_9 >= 3)) { + break; + } + float const x_49 = GLF_live15c.y; + if ((x_49 >= 1.0f)) { + int const x_10 = GLF_live15i; + GLF_live15c[x_10] = 1.0f; + } + { + int const x_11 = GLF_live15i; + GLF_live15i = (x_11 + 1); + } + } + GLF_live15d = float4(0.0f, 0.0f, 0.0f, 0.0f); + GLF_live15i_1 = 0; + while (true) { + int const x_13 = GLF_live15i_1; + if ((x_13 < 4)) { + } else { + break; + } + int const x_14 = GLF_live15i_1; + if ((x_14 >= 3)) { + break; + } + float const x_64 = GLF_live15d.y; + if ((x_64 >= 1.0f)) { + int const x_15 = GLF_live15i_1; + GLF_live15d[x_15] = 1.0f; + } + { + int const x_16 = GLF_live15i_1; + GLF_live15i_1 = (x_16 + 1); + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..9128fc2fe8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.spvasm @@ -0,0 +1,156 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 88 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %GLF_live15c "GLF_live15c" + OpName %GLF_live15i "GLF_live15i" + OpName %GLF_live15d "GLF_live15d" + OpName %GLF_live15i_1 "GLF_live15i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %17 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_3 = OpConstant %int 3 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %75 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %76 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel +%GLF_live15c = OpVariable %_ptr_Function_v4float Function %5 +%GLF_live15i = OpVariable %_ptr_Function_int Function %17 +%GLF_live15d = OpVariable %_ptr_Function_v4float Function %5 +%GLF_live15i_1 = OpVariable %_ptr_Function_int Function %17 + OpStore %GLF_live15c %21 + OpStore %GLF_live15i %int_0 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %27 = OpLoad %int %GLF_live15i + %29 = OpSLessThan %bool %27 %int_4 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpBranch %24 + %31 = OpLabel + %34 = OpLoad %int %GLF_live15i + %36 = OpSGreaterThanEqual %bool %34 %int_3 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + OpBranch %24 + %37 = OpLabel + %42 = OpAccessChain %_ptr_Function_float %GLF_live15c %uint_1 + %43 = OpLoad %float %42 + %45 = OpFOrdGreaterThanEqual %bool %43 %float_1 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + %48 = OpLoad %int %GLF_live15i + %49 = OpAccessChain %_ptr_Function_float %GLF_live15c %48 + OpStore %49 %float_1 + OpBranch %46 + %46 = OpLabel + OpBranch %25 + %25 = OpLabel + %50 = OpLoad %int %GLF_live15i + %52 = OpIAdd %int %50 %int_1 + OpStore %GLF_live15i %52 + OpBranch %23 + %24 = OpLabel + OpStore %GLF_live15d %21 + OpStore %GLF_live15i_1 %int_0 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %int %GLF_live15i_1 + %58 = OpSLessThan %bool %57 %int_4 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %61 + %60 = OpLabel + OpBranch %59 + %61 = OpLabel + OpBranch %54 + %59 = OpLabel + %62 = OpLoad %int %GLF_live15i_1 + %63 = OpSGreaterThanEqual %bool %62 %int_3 + OpSelectionMerge %64 None + OpBranchConditional %63 %65 %64 + %65 = OpLabel + OpBranch %54 + %64 = OpLabel + %66 = OpAccessChain %_ptr_Function_float %GLF_live15d %uint_1 + %67 = OpLoad %float %66 + %68 = OpFOrdGreaterThanEqual %bool %67 %float_1 + OpSelectionMerge %69 None + OpBranchConditional %68 %70 %69 + %70 = OpLabel + %71 = OpLoad %int %GLF_live15i_1 + %72 = OpAccessChain %_ptr_Function_float %GLF_live15d %71 + OpStore %72 %float_1 + OpBranch %69 + %69 = OpLabel + OpBranch %55 + %55 = OpLabel + %73 = OpLoad %int %GLF_live15i_1 + %74 = OpIAdd %int %73 %int_1 + OpStore %GLF_live15i_1 %74 + OpBranch %53 + %54 = OpLabel + OpStore %x_GLF_color %75 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %76 +%tint_symbol = OpFunctionParameter %main_out + %80 = OpLabel + %81 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %81 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %83 = OpLabel + %84 = OpFunctionCall %void %main_1 + %86 = OpLoad %v4float %x_GLF_color + %87 = OpCompositeConstruct %main_out %86 + %85 = OpFunctionCall %void %tint_symbol_2 %87 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a5541a28ca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-loops-with-break/0-opt.wgsl.expected.wgsl @@ -0,0 +1,67 @@ +var x_GLF_color : vec4; + +fn main_1() { + var GLF_live15c : vec4; + var GLF_live15i : i32; + var GLF_live15d : vec4; + var GLF_live15i_1 : i32; + GLF_live15c = vec4(0.0, 0.0, 0.0, 0.0); + GLF_live15i = 0; + loop { + let x_8 : i32 = GLF_live15i; + if ((x_8 < 4)) { + } else { + break; + } + let x_9 : i32 = GLF_live15i; + if ((x_9 >= 3)) { + break; + } + let x_49 : f32 = GLF_live15c.y; + if ((x_49 >= 1.0)) { + let x_10 : i32 = GLF_live15i; + GLF_live15c[x_10] = 1.0; + } + + continuing { + let x_11 : i32 = GLF_live15i; + GLF_live15i = (x_11 + 1); + } + } + GLF_live15d = vec4(0.0, 0.0, 0.0, 0.0); + GLF_live15i_1 = 0; + loop { + let x_13 : i32 = GLF_live15i_1; + if ((x_13 < 4)) { + } else { + break; + } + let x_14 : i32 = GLF_live15i_1; + if ((x_14 >= 3)) { + break; + } + let x_64 : f32 = GLF_live15d.y; + if ((x_64 >= 1.0)) { + let x_15 : i32 = GLF_live15i_1; + GLF_live15d[x_15] = 1.0; + } + + continuing { + let x_16 : i32 = GLF_live15i_1; + GLF_live15i_1 = (x_16 + 1); + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm new file mode 100644 index 0000000000..33f273e231 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm @@ -0,0 +1,133 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %i "i" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %i_0 "i" + OpName %i_1 "i" + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %17 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %float_n1 = OpConstant %float -1 + %int_256 = OpConstant %int 256 + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %main = OpFunction %void None %11 + %33 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %17 + OpStore %i %int_0 + %34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %35 = OpLoad %float %34 + %36 = OpFOrdLessThan %bool %35 %float_0 + OpSelectionMerge %37 None + OpBranchConditional %36 %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + %40 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %41 = OpLoad %float %40 + %42 = OpFOrdLessThan %bool %41 %float_n1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %46 + %46 = OpLabel + OpLoopMerge %47 %48 None + OpBranch %49 + %49 = OpLabel + %50 = OpLoad %int %i + %51 = OpSGreaterThanEqual %bool %50 %int_256 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + OpBranch %47 + %52 = OpLabel + OpBranch %54 + %54 = OpLabel + OpStore %i_0 %int_0 + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %58 = OpLoad %int %i_0 + %59 = OpSLessThan %bool %58 %int_1 + OpLoopMerge %60 %61 None + OpBranchConditional %59 %62 %60 + %62 = OpLabel + OpSelectionMerge %63 None + OpBranchConditional %42 %64 %63 + %64 = OpLabel + OpStore %i_1 %int_0 + OpBranch %65 + %65 = OpLabel + %66 = OpLoad %int %i_1 + %67 = OpSLessThan %bool %66 %int_1 + OpLoopMerge %68 %69 None + OpBranchConditional %67 %69 %68 + %69 = OpLabel + %70 = OpLoad %int %i_1 + %71 = OpIAdd %int %70 %int_1 + OpStore %i_1 %71 + OpBranch %65 + %68 = OpLabel + OpBranch %61 + %61 = OpLabel + %72 = OpLoad %int %i_0 + %73 = OpIAdd %int %72 %int_1 + OpStore %i_0 %73 + OpBranch %57 + %63 = OpLabel + OpReturn + %60 = OpLabel + OpBranch %56 + %56 = OpLabel + OpBranchConditional %false %54 %55 + %55 = OpLabel + OpBranch %48 + %48 = OpLabel + OpBranchConditional %false %46 %47 + %47 = OpLabel + OpBranch %43 + %43 = OpLabel + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..3f53893923 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.hlsl @@ -0,0 +1,98 @@ +SKIP: FAILED + + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +fn main_1() { + var i : i32; + var i_1 : i32; + var i_2 : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + let x_35 : f32 = x_7.injectionSwitch.y; + if ((x_35 < 0.0)) { + } else { + var x_42 : bool; + let x_41 : f32 = gl_FragCoord.y; + x_42 = (x_41 < -1.0); + if (x_42) { + } else { + loop { + let x_50 : i32 = i; + if ((x_50 >= 256)) { + break; + } + loop { + i_1 = 0; + loop { + let x_58 : i32 = i_1; + if ((x_58 < 1)) { + } else { + break; + } + if (x_42) { + i_2 = 0; + loop { + let x_66 : i32 = i_2; + if ((x_66 < 1)) { + } else { + break; + } + + continuing { + let x_70 : i32 = i_2; + i_2 = (x_70 + 1); + } + } + continue; + } + return; + + continuing { + let x_72 : i32 = i_1; + i_1 = (x_72 + 1); + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} + +Failed to generate: error: break statement must be in a loop or switch case diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4489a5b990 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.msl @@ -0,0 +1,94 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + int i_1 = 0; + int i_2 = 0; + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + float const x_35 = x_7.injectionSwitch.y; + if ((x_35 < 0.0f)) { + } else { + bool x_42 = false; + float const x_41 = (*(tint_symbol_6)).y; + x_42 = (x_41 < -1.0f); + if (x_42) { + } else { + while (true) { + int const x_50 = i; + if ((x_50 >= 256)) { + break; + } + while (true) { + i_1 = 0; + while (true) { + int const x_58 = i_1; + if ((x_58 < 1)) { + } else { + break; + } + if (x_42) { + i_2 = 0; + while (true) { + int const x_66 = i_2; + if ((x_66 < 1)) { + } else { + break; + } + { + int const x_70 = i_2; + i_2 = (x_70 + 1); + } + } + { + int const x_72 = i_1; + i_1 = (x_72 + 1); + } + continue; + } + return; + { + int const x_72 = i_1; + i_1 = (x_72 + 1); + } + } + { + if (false) { + } else { + break; + } + } + } + { + if (false) { + } else { + break; + } + } + } + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..3fe30e2923 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.spvasm @@ -0,0 +1,214 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 111 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %x_42 "x_42" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %42 = OpConstantNull %bool +%_ptr_Private_float = OpTypePointer Private %float + %float_n1 = OpConstant %float -1 + %int_256 = OpConstant %int 256 + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %98 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %i = OpVariable %_ptr_Function_int Function %22 + %i_1 = OpVariable %_ptr_Function_int Function %22 + %i_2 = OpVariable %_ptr_Function_int Function %22 + %x_42 = OpVariable %_ptr_Function_bool Function %42 + OpStore %x_GLF_color %27 + OpStore %i %int_0 + %33 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %34 = OpLoad %float %33 + %35 = OpFOrdLessThan %bool %34 %float_0 + OpSelectionMerge %37 None + OpBranchConditional %35 %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + %44 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %45 = OpLoad %float %44 + %47 = OpFOrdLessThan %bool %45 %float_n1 + OpStore %x_42 %47 + %48 = OpLoad %bool %x_42 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %i + %58 = OpSGreaterThanEqual %bool %56 %int_256 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + OpBranch %53 + %59 = OpLabel + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + OpStore %i_1 %int_0 + OpBranch %65 + %65 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %69 = OpLoad %int %i_1 + %71 = OpSLessThan %bool %69 %int_1 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %74 + %73 = OpLabel + OpBranch %72 + %74 = OpLabel + OpBranch %66 + %72 = OpLabel + %75 = OpLoad %bool %x_42 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %76 + %77 = OpLabel + OpStore %i_2 %int_0 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %int %i_2 + %83 = OpSLessThan %bool %82 %int_1 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + OpBranch %84 + %86 = OpLabel + OpBranch %79 + %84 = OpLabel + OpBranch %80 + %80 = OpLabel + %87 = OpLoad %int %i_2 + %88 = OpIAdd %int %87 %int_1 + OpStore %i_2 %88 + OpBranch %78 + %79 = OpLabel + OpBranch %67 + %76 = OpLabel + OpReturn + %67 = OpLabel + %89 = OpLoad %int %i_1 + %90 = OpIAdd %int %89 %int_1 + OpStore %i_1 %90 + OpBranch %65 + %66 = OpLabel + OpBranch %63 + %63 = OpLabel + OpSelectionMerge %92 None + OpBranchConditional %false %93 %94 + %93 = OpLabel + OpBranch %92 + %94 = OpLabel + OpBranch %62 + %92 = OpLabel + OpBranch %61 + %62 = OpLabel + OpBranch %54 + %54 = OpLabel + OpSelectionMerge %95 None + OpBranchConditional %false %96 %97 + %96 = OpLabel + OpBranch %95 + %97 = OpLabel + OpBranch %53 + %95 = OpLabel + OpBranch %52 + %53 = OpLabel + OpBranch %49 + %49 = OpLabel + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %98 +%tint_symbol_1 = OpFunctionParameter %main_out + %102 = OpLabel + %103 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %103 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %105 = OpLabel + %106 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %106 + %107 = OpFunctionCall %void %main_1 + %109 = OpLoad %v4float %x_GLF_color + %110 = OpCompositeConstruct %main_out %109 + %108 = OpFunctionCall %void %tint_symbol_3 %110 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 54[%54] is not post dominated by the back-edge block 95[%95] + %95 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a826fa8033 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.spvasm.expected.wgsl @@ -0,0 +1,93 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +fn main_1() { + var i : i32; + var i_1 : i32; + var i_2 : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + let x_35 : f32 = x_7.injectionSwitch.y; + if ((x_35 < 0.0)) { + } else { + var x_42 : bool; + let x_41 : f32 = gl_FragCoord.y; + x_42 = (x_41 < -1.0); + if (x_42) { + } else { + loop { + let x_50 : i32 = i; + if ((x_50 >= 256)) { + break; + } + loop { + i_1 = 0; + loop { + let x_58 : i32 = i_1; + if ((x_58 < 1)) { + } else { + break; + } + if (x_42) { + i_2 = 0; + loop { + let x_66 : i32 = i_2; + if ((x_66 < 1)) { + } else { + break; + } + + continuing { + let x_70 : i32 = i_2; + i_2 = (x_70 + 1); + } + } + continue; + } + return; + + continuing { + let x_72 : i32 = i_1; + i_1 = (x_72 + 1); + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl new file mode 100644 index 0000000000..a826fa8033 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl @@ -0,0 +1,93 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +fn main_1() { + var i : i32; + var i_1 : i32; + var i_2 : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + let x_35 : f32 = x_7.injectionSwitch.y; + if ((x_35 < 0.0)) { + } else { + var x_42 : bool; + let x_41 : f32 = gl_FragCoord.y; + x_42 = (x_41 < -1.0); + if (x_42) { + } else { + loop { + let x_50 : i32 = i; + if ((x_50 >= 256)) { + break; + } + loop { + i_1 = 0; + loop { + let x_58 : i32 = i_1; + if ((x_58 < 1)) { + } else { + break; + } + if (x_42) { + i_2 = 0; + loop { + let x_66 : i32 = i_2; + if ((x_66 < 1)) { + } else { + break; + } + + continuing { + let x_70 : i32 = i_2; + i_2 = (x_70 + 1); + } + } + continue; + } + return; + + continuing { + let x_72 : i32 = i_1; + i_1 = (x_72 + 1); + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..8a64f0cfb5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.hlsl @@ -0,0 +1,101 @@ +SKIP: FAILED + + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +fn main_1() { + var i : i32; + var i_1 : i32; + var i_2 : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + let x_35 : f32 = x_7.injectionSwitch.y; + if ((x_35 < 0.0)) { + } else { + var x_42 : bool; + let x_41 : f32 = gl_FragCoord.y; + x_42 = (x_41 < -1.0); + if (x_42) { + } else { + loop { + let x_50 : i32 = i; + if ((x_50 >= 256)) { + break; + } + loop { + i_1 = 0; + loop { + let x_58 : i32 = i_1; + if ((x_58 < 1)) { + } else { + break; + } + if (x_42) { + i_2 = 0; + loop { + let x_66 : i32 = i_2; + if ((x_66 < 1)) { + } else { + break; + } + + continuing { + let x_70 : i32 = i_2; + i_2 = (x_70 + 1); + } + } + continue; + } + return; + + continuing { + let x_72 : i32 = i_1; + i_1 = (x_72 + 1); + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} + +Failed to generate: graphicsfuzz/two-nested-do-whiles/0-opt.wgsl:74:13 error: break statement must be in a loop or switch case + break; + ^^^^^ + diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4489a5b990 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.msl @@ -0,0 +1,94 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + int i = 0; + int i_1 = 0; + int i_2 = 0; + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + float const x_35 = x_7.injectionSwitch.y; + if ((x_35 < 0.0f)) { + } else { + bool x_42 = false; + float const x_41 = (*(tint_symbol_6)).y; + x_42 = (x_41 < -1.0f); + if (x_42) { + } else { + while (true) { + int const x_50 = i; + if ((x_50 >= 256)) { + break; + } + while (true) { + i_1 = 0; + while (true) { + int const x_58 = i_1; + if ((x_58 < 1)) { + } else { + break; + } + if (x_42) { + i_2 = 0; + while (true) { + int const x_66 = i_2; + if ((x_66 < 1)) { + } else { + break; + } + { + int const x_70 = i_2; + i_2 = (x_70 + 1); + } + } + { + int const x_72 = i_1; + i_1 = (x_72 + 1); + } + continue; + } + return; + { + int const x_72 = i_1; + i_1 = (x_72 + 1); + } + } + { + if (false) { + } else { + break; + } + } + } + { + if (false) { + } else { + break; + } + } + } + } + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..3fe30e2923 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.spvasm @@ -0,0 +1,214 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 111 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %i "i" + OpName %i_1 "i_1" + OpName %i_2 "i_2" + OpName %x_42 "x_42" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %42 = OpConstantNull %bool +%_ptr_Private_float = OpTypePointer Private %float + %float_n1 = OpConstant %float -1 + %int_256 = OpConstant %int 256 + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %98 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %i = OpVariable %_ptr_Function_int Function %22 + %i_1 = OpVariable %_ptr_Function_int Function %22 + %i_2 = OpVariable %_ptr_Function_int Function %22 + %x_42 = OpVariable %_ptr_Function_bool Function %42 + OpStore %x_GLF_color %27 + OpStore %i %int_0 + %33 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %34 = OpLoad %float %33 + %35 = OpFOrdLessThan %bool %34 %float_0 + OpSelectionMerge %37 None + OpBranchConditional %35 %38 %39 + %38 = OpLabel + OpBranch %37 + %39 = OpLabel + %44 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %45 = OpLoad %float %44 + %47 = OpFOrdLessThan %bool %45 %float_n1 + OpStore %x_42 %47 + %48 = OpLoad %bool %x_42 + OpSelectionMerge %49 None + OpBranchConditional %48 %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %52 + %52 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %i + %58 = OpSGreaterThanEqual %bool %56 %int_256 + OpSelectionMerge %59 None + OpBranchConditional %58 %60 %59 + %60 = OpLabel + OpBranch %53 + %59 = OpLabel + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + OpStore %i_1 %int_0 + OpBranch %65 + %65 = OpLabel + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %69 = OpLoad %int %i_1 + %71 = OpSLessThan %bool %69 %int_1 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %74 + %73 = OpLabel + OpBranch %72 + %74 = OpLabel + OpBranch %66 + %72 = OpLabel + %75 = OpLoad %bool %x_42 + OpSelectionMerge %76 None + OpBranchConditional %75 %77 %76 + %77 = OpLabel + OpStore %i_2 %int_0 + OpBranch %78 + %78 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %int %i_2 + %83 = OpSLessThan %bool %82 %int_1 + OpSelectionMerge %84 None + OpBranchConditional %83 %85 %86 + %85 = OpLabel + OpBranch %84 + %86 = OpLabel + OpBranch %79 + %84 = OpLabel + OpBranch %80 + %80 = OpLabel + %87 = OpLoad %int %i_2 + %88 = OpIAdd %int %87 %int_1 + OpStore %i_2 %88 + OpBranch %78 + %79 = OpLabel + OpBranch %67 + %76 = OpLabel + OpReturn + %67 = OpLabel + %89 = OpLoad %int %i_1 + %90 = OpIAdd %int %89 %int_1 + OpStore %i_1 %90 + OpBranch %65 + %66 = OpLabel + OpBranch %63 + %63 = OpLabel + OpSelectionMerge %92 None + OpBranchConditional %false %93 %94 + %93 = OpLabel + OpBranch %92 + %94 = OpLabel + OpBranch %62 + %92 = OpLabel + OpBranch %61 + %62 = OpLabel + OpBranch %54 + %54 = OpLabel + OpSelectionMerge %95 None + OpBranchConditional %false %96 %97 + %96 = OpLabel + OpBranch %95 + %97 = OpLabel + OpBranch %53 + %95 = OpLabel + OpBranch %52 + %53 = OpLabel + OpBranch %49 + %49 = OpLabel + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %98 +%tint_symbol_1 = OpFunctionParameter %main_out + %102 = OpLabel + %103 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %103 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %105 = OpLabel + %106 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %106 + %107 = OpFunctionCall %void %main_1 + %109 = OpLoad %v4float %x_GLF_color + %110 = OpCompositeConstruct %main_out %109 + %108 = OpFunctionCall %void %tint_symbol_3 %110 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 54[%54] is not post dominated by the back-edge block 95[%95] + %95 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a826fa8033 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-do-whiles/0-opt.wgsl.expected.wgsl @@ -0,0 +1,93 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +fn main_1() { + var i : i32; + var i_1 : i32; + var i_2 : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + let x_35 : f32 = x_7.injectionSwitch.y; + if ((x_35 < 0.0)) { + } else { + var x_42 : bool; + let x_41 : f32 = gl_FragCoord.y; + x_42 = (x_41 < -1.0); + if (x_42) { + } else { + loop { + let x_50 : i32 = i; + if ((x_50 >= 256)) { + break; + } + loop { + i_1 = 0; + loop { + let x_58 : i32 = i_1; + if ((x_58 < 1)) { + } else { + break; + } + if (x_42) { + i_2 = 0; + loop { + let x_66 : i32 = i_2; + if ((x_66 < 1)) { + } else { + break; + } + + continuing { + let x_70 : i32 = i_2; + i_2 = (x_70 + 1); + } + } + continue; + } + return; + + continuing { + let x_72 : i32 = i_1; + i_1 = (x_72 + 1); + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm new file mode 100644 index 0000000000..a49611f011 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm @@ -0,0 +1,102 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource ESSL 310 + OpName %main "main" + OpName %nb_mod_ "nb_mod(" + OpName %s "s" + OpName %i "i" + OpName %GLF_live1i "GLF_live1i" + OpName %GLF_live1_looplimiter2 "GLF_live1_looplimiter2" + OpName %doesNotMatter "doesNotMatter" + OpMemberName %doesNotMatter 0 "_compute_data" + OpName %_ "" + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %doesNotMatter 0 Offset 0 + OpDecorate %doesNotMatter BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %14 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_5 = OpConstant %int 5 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %float_42 = OpConstant %float 42 + %int_1 = OpConstant %int 1 +%_runtimearr_float = OpTypeRuntimeArray %float +%doesNotMatter = OpTypeStruct %_runtimearr_float +%_ptr_Uniform_doesNotMatter = OpTypePointer Uniform %doesNotMatter + %_ = OpVariable %_ptr_Uniform_doesNotMatter Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %29 = OpUndef %int + %30 = OpUndef %float + %main = OpFunction %void None %12 + %31 = OpLabel + %32 = OpFunctionCall %float %nb_mod_ + %33 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 + OpStore %33 %32 + OpReturn + OpFunctionEnd + %nb_mod_ = OpFunction %float None %14 + %34 = OpLabel + %s = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %GLF_live1i = OpVariable %_ptr_Function_int Function +%GLF_live1_looplimiter2 = OpVariable %_ptr_Function_int Function + OpStore %s %float_0 + OpStore %i %int_5 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpSLessThan %bool %int_5 %int_800 + OpBranchConditional %39 %40 %36 + %40 = OpLabel + OpStore %GLF_live1i %int_0 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpSLessThan %bool %int_0 %int_20 + OpBranchConditional %45 %46 %42 + %46 = OpLabel + %47 = OpSGreaterThanEqual %bool %29 %int_5 + OpSelectionMerge %48 None + OpBranchConditional %47 %49 %48 + %49 = OpLabel + %50 = OpFAdd %float %float_0 %float_1 + OpStore %s %50 + OpBranch %42 + %48 = OpLabel + OpReturnValue %float_42 + %43 = OpLabel + OpBranch %41 + %42 = OpLabel + %51 = OpPhi %float %float_0 %44 %50 %49 + %52 = OpConvertSToF %float %int_5 + %53 = OpFOrdLessThanEqual %bool %52 %51 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + OpBranch %36 + %54 = OpLabel + OpReturnValue %float_42 + %37 = OpLabel + OpBranch %35 + %36 = OpLabel + %56 = OpPhi %float %float_0 %38 %51 %55 + OpReturnValue %56 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..522b92da6c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.hlsl @@ -0,0 +1,55 @@ +RWByteAddressBuffer x_9 : register(u0, space0); + +float nb_mod_() { + float s = 0.0f; + int i = 0; + int GLF_live1i = 0; + int GLF_live1_looplimiter2 = 0; + float x_51 = 0.0f; + float x_56_phi = 0.0f; + s = 0.0f; + i = 5; + while (true) { + float x_50 = 0.0f; + float x_51_phi = 0.0f; + x_56_phi = 0.0f; + if ((5 < 800)) { + } else { + break; + } + GLF_live1i = 0; + while (true) { + x_51_phi = 0.0f; + if ((0 < 20)) { + } else { + break; + } + if ((0 >= 5)) { + x_50 = (0.0f + 1.0f); + s = x_50; + x_51_phi = x_50; + break; + } + return 42.0f; + } + x_51 = x_51_phi; + if ((float(5) <= x_51)) { + x_56_phi = x_51; + break; + } + return 42.0f; + } + return x_56_phi; +} + +void main_1() { + const float x_32 = nb_mod_(); + x_9.Store((4u * uint(0)), asuint(x_32)); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d1dd6dfe0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct doesNotMatter { + /* 0x0000 */ float x_compute_data[1]; +}; + +float nb_mod_() { + float s = 0.0f; + int i = 0; + int GLF_live1i = 0; + int GLF_live1_looplimiter2 = 0; + float x_51 = 0.0f; + float x_56_phi = 0.0f; + s = 0.0f; + i = 5; + while (true) { + float x_50 = 0.0f; + float x_51_phi = 0.0f; + x_56_phi = 0.0f; + if ((5 < 800)) { + } else { + break; + } + GLF_live1i = 0; + while (true) { + x_51_phi = 0.0f; + if ((0 < 20)) { + } else { + break; + } + if ((0 >= 5)) { + x_50 = (0.0f + 1.0f); + s = x_50; + x_51_phi = x_50; + break; + } + return 42.0f; + } + x_51 = x_51_phi; + if ((float(5) <= x_51)) { + x_56_phi = x_51; + break; + } + return 42.0f; + } + float const x_56 = x_56_phi; + return x_56; +} + +void main_1(device doesNotMatter& x_9) { + float const x_32 = nb_mod_(); + x_9.x_compute_data[0] = x_32; + return; +} + +kernel void tint_symbol(device doesNotMatter& x_9 [[buffer(0)]]) { + main_1(x_9); + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..6f88948039 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %doesNotMatter "doesNotMatter" + OpMemberName %doesNotMatter 0 "x_compute_data" + OpName %x_9 "x_9" + OpName %nb_mod_ "nb_mod_" + OpName %s "s" + OpName %i "i" + OpName %GLF_live1i "GLF_live1i" + OpName %GLF_live1_looplimiter2 "GLF_live1_looplimiter2" + OpName %x_51 "x_51" + OpName %x_56_phi "x_56_phi" + OpName %x_50 "x_50" + OpName %x_51_phi "x_51_phi" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %doesNotMatter Block + OpMemberDecorate %doesNotMatter 0 Offset 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float +%doesNotMatter = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer_doesNotMatter = OpTypePointer StorageBuffer %doesNotMatter + %x_9 = OpVariable %_ptr_StorageBuffer_doesNotMatter StorageBuffer + %6 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %11 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %int_5 = OpConstant %int 5 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %float_42 = OpConstant %float 42 + %float_5 = OpConstant %float 5 + %void = OpTypeVoid + %60 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %nb_mod_ = OpFunction %float None %6 + %8 = OpLabel + %s = OpVariable %_ptr_Function_float Function %11 + %i = OpVariable %_ptr_Function_int Function %15 + %GLF_live1i = OpVariable %_ptr_Function_int Function %15 +%GLF_live1_looplimiter2 = OpVariable %_ptr_Function_int Function %15 + %x_51 = OpVariable %_ptr_Function_float Function %11 + %x_56_phi = OpVariable %_ptr_Function_float Function %11 + %x_50 = OpVariable %_ptr_Function_float Function %11 + %x_51_phi = OpVariable %_ptr_Function_float Function %11 + OpStore %s %float_0 + OpStore %i %int_5 + OpBranch %22 + %22 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + OpStore %x_56_phi %float_0 + %29 = OpSLessThan %bool %int_5 %int_800 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpBranch %23 + %31 = OpLabel + OpStore %GLF_live1i %int_0 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + OpStore %x_51_phi %float_0 + %40 = OpSLessThan %bool %int_0 %int_20 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %36 + %41 = OpLabel + %44 = OpSGreaterThanEqual %bool %int_0 %int_5 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + %48 = OpFAdd %float %float_0 %float_1 + OpStore %x_50 %48 + %49 = OpLoad %float %x_50 + OpStore %s %49 + %50 = OpLoad %float %x_50 + OpStore %x_51_phi %50 + OpBranch %36 + %45 = OpLabel + OpReturnValue %float_42 + %37 = OpLabel + OpBranch %35 + %36 = OpLabel + %52 = OpLoad %float %x_51_phi + OpStore %x_51 %52 + %54 = OpLoad %float %x_51 + %55 = OpFOrdLessThanEqual %bool %float_5 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + %58 = OpLoad %float %x_51 + OpStore %x_56_phi %58 + OpBranch %23 + %56 = OpLabel + OpReturnValue %float_42 + %24 = OpLabel + OpBranch %22 + %23 = OpLabel + %59 = OpLoad %float %x_56_phi + OpReturnValue %59 + OpFunctionEnd + %main_1 = OpFunction %void None %60 + %63 = OpLabel + %64 = OpFunctionCall %float %nb_mod_ + %68 = OpAccessChain %_ptr_StorageBuffer_float %x_9 %uint_0 %int_0 + OpStore %68 %64 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %60 + %70 = OpLabel + %71 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..01d9e68be0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.spvasm.expected.wgsl @@ -0,0 +1,62 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct doesNotMatter { + x_compute_data : RTArr; +}; + +[[group(0), binding(0)]] var x_9 : doesNotMatter; + +fn nb_mod_() -> f32 { + var s : f32; + var i : i32; + var GLF_live1i : i32; + var GLF_live1_looplimiter2 : i32; + var x_51 : f32; + var x_56_phi : f32; + s = 0.0; + i = 5; + loop { + var x_50 : f32; + var x_51_phi : f32; + x_56_phi = 0.0; + if ((5 < 800)) { + } else { + break; + } + GLF_live1i = 0; + loop { + x_51_phi = 0.0; + if ((0 < 20)) { + } else { + break; + } + if ((0 >= 5)) { + x_50 = (0.0 + 1.0); + s = x_50; + x_51_phi = x_50; + break; + } + return 42.0; + } + x_51 = x_51_phi; + if ((f32(5) <= x_51)) { + x_56_phi = x_51; + break; + } + return 42.0; + } + let x_56 : f32 = x_56_phi; + return x_56; +} + +fn main_1() { + let x_32 : f32 = nb_mod_(); + x_9.x_compute_data[0] = x_32; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl new file mode 100644 index 0000000000..01d9e68be0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl @@ -0,0 +1,62 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct doesNotMatter { + x_compute_data : RTArr; +}; + +[[group(0), binding(0)]] var x_9 : doesNotMatter; + +fn nb_mod_() -> f32 { + var s : f32; + var i : i32; + var GLF_live1i : i32; + var GLF_live1_looplimiter2 : i32; + var x_51 : f32; + var x_56_phi : f32; + s = 0.0; + i = 5; + loop { + var x_50 : f32; + var x_51_phi : f32; + x_56_phi = 0.0; + if ((5 < 800)) { + } else { + break; + } + GLF_live1i = 0; + loop { + x_51_phi = 0.0; + if ((0 < 20)) { + } else { + break; + } + if ((0 >= 5)) { + x_50 = (0.0 + 1.0); + s = x_50; + x_51_phi = x_50; + break; + } + return 42.0; + } + x_51 = x_51_phi; + if ((f32(5) <= x_51)) { + x_56_phi = x_51; + break; + } + return 42.0; + } + let x_56 : f32 = x_56_phi; + return x_56; +} + +fn main_1() { + let x_32 : f32 = nb_mod_(); + x_9.x_compute_data[0] = x_32; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..522b92da6c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.hlsl @@ -0,0 +1,55 @@ +RWByteAddressBuffer x_9 : register(u0, space0); + +float nb_mod_() { + float s = 0.0f; + int i = 0; + int GLF_live1i = 0; + int GLF_live1_looplimiter2 = 0; + float x_51 = 0.0f; + float x_56_phi = 0.0f; + s = 0.0f; + i = 5; + while (true) { + float x_50 = 0.0f; + float x_51_phi = 0.0f; + x_56_phi = 0.0f; + if ((5 < 800)) { + } else { + break; + } + GLF_live1i = 0; + while (true) { + x_51_phi = 0.0f; + if ((0 < 20)) { + } else { + break; + } + if ((0 >= 5)) { + x_50 = (0.0f + 1.0f); + s = x_50; + x_51_phi = x_50; + break; + } + return 42.0f; + } + x_51 = x_51_phi; + if ((float(5) <= x_51)) { + x_56_phi = x_51; + break; + } + return 42.0f; + } + return x_56_phi; +} + +void main_1() { + const float x_32 = nb_mod_(); + x_9.Store((4u * uint(0)), asuint(x_32)); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d1dd6dfe0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.msl @@ -0,0 +1,61 @@ +#include + +using namespace metal; +struct doesNotMatter { + /* 0x0000 */ float x_compute_data[1]; +}; + +float nb_mod_() { + float s = 0.0f; + int i = 0; + int GLF_live1i = 0; + int GLF_live1_looplimiter2 = 0; + float x_51 = 0.0f; + float x_56_phi = 0.0f; + s = 0.0f; + i = 5; + while (true) { + float x_50 = 0.0f; + float x_51_phi = 0.0f; + x_56_phi = 0.0f; + if ((5 < 800)) { + } else { + break; + } + GLF_live1i = 0; + while (true) { + x_51_phi = 0.0f; + if ((0 < 20)) { + } else { + break; + } + if ((0 >= 5)) { + x_50 = (0.0f + 1.0f); + s = x_50; + x_51_phi = x_50; + break; + } + return 42.0f; + } + x_51 = x_51_phi; + if ((float(5) <= x_51)) { + x_56_phi = x_51; + break; + } + return 42.0f; + } + float const x_56 = x_56_phi; + return x_56; +} + +void main_1(device doesNotMatter& x_9) { + float const x_32 = nb_mod_(); + x_9.x_compute_data[0] = x_32; + return; +} + +kernel void tint_symbol(device doesNotMatter& x_9 [[buffer(0)]]) { + main_1(x_9); + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..6f88948039 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.spvasm @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 72 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %doesNotMatter "doesNotMatter" + OpMemberName %doesNotMatter 0 "x_compute_data" + OpName %x_9 "x_9" + OpName %nb_mod_ "nb_mod_" + OpName %s "s" + OpName %i "i" + OpName %GLF_live1i "GLF_live1i" + OpName %GLF_live1_looplimiter2 "GLF_live1_looplimiter2" + OpName %x_51 "x_51" + OpName %x_56_phi "x_56_phi" + OpName %x_50 "x_50" + OpName %x_51_phi "x_51_phi" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %doesNotMatter Block + OpMemberDecorate %doesNotMatter 0 Offset 0 + OpDecorate %_runtimearr_float ArrayStride 4 + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float +%doesNotMatter = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer_doesNotMatter = OpTypePointer StorageBuffer %doesNotMatter + %x_9 = OpVariable %_ptr_StorageBuffer_doesNotMatter StorageBuffer + %6 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %11 = OpConstantNull %float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %float_0 = OpConstant %float 0 + %int_5 = OpConstant %int 5 + %int_800 = OpConstant %int 800 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_20 = OpConstant %int 20 + %float_1 = OpConstant %float 1 + %float_42 = OpConstant %float 42 + %float_5 = OpConstant %float 5 + %void = OpTypeVoid + %60 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %nb_mod_ = OpFunction %float None %6 + %8 = OpLabel + %s = OpVariable %_ptr_Function_float Function %11 + %i = OpVariable %_ptr_Function_int Function %15 + %GLF_live1i = OpVariable %_ptr_Function_int Function %15 +%GLF_live1_looplimiter2 = OpVariable %_ptr_Function_int Function %15 + %x_51 = OpVariable %_ptr_Function_float Function %11 + %x_56_phi = OpVariable %_ptr_Function_float Function %11 + %x_50 = OpVariable %_ptr_Function_float Function %11 + %x_51_phi = OpVariable %_ptr_Function_float Function %11 + OpStore %s %float_0 + OpStore %i %int_5 + OpBranch %22 + %22 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + OpStore %x_56_phi %float_0 + %29 = OpSLessThan %bool %int_5 %int_800 + OpSelectionMerge %31 None + OpBranchConditional %29 %32 %33 + %32 = OpLabel + OpBranch %31 + %33 = OpLabel + OpBranch %23 + %31 = OpLabel + OpStore %GLF_live1i %int_0 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + OpStore %x_51_phi %float_0 + %40 = OpSLessThan %bool %int_0 %int_20 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %43 + %42 = OpLabel + OpBranch %41 + %43 = OpLabel + OpBranch %36 + %41 = OpLabel + %44 = OpSGreaterThanEqual %bool %int_0 %int_5 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + %48 = OpFAdd %float %float_0 %float_1 + OpStore %x_50 %48 + %49 = OpLoad %float %x_50 + OpStore %s %49 + %50 = OpLoad %float %x_50 + OpStore %x_51_phi %50 + OpBranch %36 + %45 = OpLabel + OpReturnValue %float_42 + %37 = OpLabel + OpBranch %35 + %36 = OpLabel + %52 = OpLoad %float %x_51_phi + OpStore %x_51 %52 + %54 = OpLoad %float %x_51 + %55 = OpFOrdLessThanEqual %bool %float_5 %54 + OpSelectionMerge %56 None + OpBranchConditional %55 %57 %56 + %57 = OpLabel + %58 = OpLoad %float %x_51 + OpStore %x_56_phi %58 + OpBranch %23 + %56 = OpLabel + OpReturnValue %float_42 + %24 = OpLabel + OpBranch %22 + %23 = OpLabel + %59 = OpLoad %float %x_56_phi + OpReturnValue %59 + OpFunctionEnd + %main_1 = OpFunction %void None %60 + %63 = OpLabel + %64 = OpFunctionCall %float %nb_mod_ + %68 = OpAccessChain %_ptr_StorageBuffer_float %x_9 %uint_0 %int_0 + OpStore %68 %64 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %60 + %70 = OpLabel + %71 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..01d9e68be0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-for-loops-with-returns/0-opt.wgsl.expected.wgsl @@ -0,0 +1,62 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct doesNotMatter { + x_compute_data : RTArr; +}; + +[[group(0), binding(0)]] var x_9 : doesNotMatter; + +fn nb_mod_() -> f32 { + var s : f32; + var i : i32; + var GLF_live1i : i32; + var GLF_live1_looplimiter2 : i32; + var x_51 : f32; + var x_56_phi : f32; + s = 0.0; + i = 5; + loop { + var x_50 : f32; + var x_51_phi : f32; + x_56_phi = 0.0; + if ((5 < 800)) { + } else { + break; + } + GLF_live1i = 0; + loop { + x_51_phi = 0.0; + if ((0 < 20)) { + } else { + break; + } + if ((0 >= 5)) { + x_50 = (0.0 + 1.0); + s = x_50; + x_51_phi = x_50; + break; + } + return 42.0; + } + x_51 = x_51_phi; + if ((f32(5) <= x_51)) { + x_56_phi = x_51; + break; + } + return 42.0; + } + let x_56 : f32 = x_56_phi; + return x_56; +} + +fn main_1() { + let x_32 : f32 = nb_mod_(); + x_9.x_compute_data[0] = x_32; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm new file mode 100644 index 0000000000..bfce82b28f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm @@ -0,0 +1,91 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %mand_ "mand(" + OpName %k "k" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %j "j" + OpName %_GLF_color "_GLF_color" + OpDecorate %k RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %j RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %int_0 RelaxedPrecision + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %14 = OpTypeFunction %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1000 = OpConstant %int 1000 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %21 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %int_4 = OpConstant %int 4 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %33 = OpUndef %int + %true = OpConstantTrue %bool + %main = OpFunction %void None %11 + %35 = OpLabel + %j = OpVariable %_ptr_Function_int Function + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %39 = OpLoad %float %38 + %40 = OpFOrdGreaterThan %bool %37 %39 + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + OpStore %j %int_0 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %44 %45 None + OpBranchConditional %true %45 %44 + %45 = OpLabel + %46 = OpFunctionCall %v3float %mand_ + OpBranch %43 + %44 = OpLabel + OpBranch %41 + %41 = OpLabel + OpStore %_GLF_color %32 + OpReturn + OpFunctionEnd + %mand_ = OpFunction %v3float None %14 + %47 = OpLabel + %k = OpVariable %_ptr_Function_int Function + OpStore %k %int_0 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranchConditional %true %51 %49 + %51 = OpLabel + OpKill + %50 = OpLabel + OpBranch %48 + %49 = OpLabel + OpReturnValue %21 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.hlsl new file mode 100755 index 0000000000..6b19022f4e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.hlsl @@ -0,0 +1,57 @@ +SKIP: FAILED + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 mand_() { + int k = 0; + k = 0; + while (true) { + if (true) { + } else { + break; + } + discard; + } + return float3(1.0f, 1.0f, 1.0f); +} + +void main_1() { + int j = 0; + const float x_37 = asfloat(x_7[0].x); + const float x_39 = asfloat(x_7[0].y); + if ((x_37 > x_39)) { + j = 0; + { + for(; true; const float3 x_46 = mand_()) { + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} +T:\tmp\udpk.0:26:19: error: expected expression + for(; true; const float3 x_46 = mand_()) { + ^ +T:\tmp\udpk.0:26:19: error: expected ')' +T:\tmp\udpk.0:26:10: note: to match this '(' + for(; true; const float3 x_46 = mand_()) { + ^ + + diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..82947bc766 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 mand_() { + int k = 0; + k = 0; + while (true) { + if (true) { + } else { + break; + } + discard_fragment(); + } + return float3(1.0f, 1.0f, 1.0f); +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int j = 0; + float const x_37 = x_7.injectionSwitch.x; + float const x_39 = x_7.injectionSwitch.y; + if ((x_37 > x_39)) { + j = 0; + while (true) { + if (true) { + } else { + break; + } + { + float3 const x_46 = mand_(); + } + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..8d1e068b8e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.spvasm @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 70 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %mand_ "mand_" + OpName %k "k" + OpName %main_1 "main_1" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %v3float = OpTypeVector %float 3 + %12 = OpTypeFunction %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %void = OpTypeVoid + %32 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %57 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %mand_ = OpFunction %v3float None %12 + %15 = OpLabel + %k = OpVariable %_ptr_Function_int Function %19 + OpStore %k %int_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + OpSelectionMerge %27 None + OpBranchConditional %true %28 %29 + %28 = OpLabel + OpBranch %27 + %29 = OpLabel + OpBranch %22 + %27 = OpLabel + OpKill + %23 = OpLabel + OpBranch %21 + %22 = OpLabel + OpReturnValue %31 + OpFunctionEnd + %main_1 = OpFunction %void None %32 + %35 = OpLabel + %j = OpVariable %_ptr_Function_int Function %19 + %40 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %44 = OpLoad %float %43 + %45 = OpFOrdGreaterThan %bool %41 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + OpStore %j %int_0 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + OpSelectionMerge %52 None + OpBranchConditional %true %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %49 + %52 = OpLabel + OpBranch %50 + %50 = OpLabel + %55 = OpFunctionCall %v3float %mand_ + OpBranch %48 + %49 = OpLabel + OpBranch %46 + %46 = OpLabel + OpStore %x_GLF_color %57 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %58 +%tint_symbol = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %32 + %65 = OpLabel + %66 = OpFunctionCall %void %main_1 + %68 = OpLoad %v4float %x_GLF_color + %69 = OpCompositeConstruct %main_out %68 + %67 = OpFunctionCall %void %tint_symbol_2 %69 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..26e82264c9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.spvasm.expected.wgsl @@ -0,0 +1,53 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn mand_() -> vec3 { + var k : i32; + k = 0; + loop { + if (true) { + } else { + break; + } + discard; + } + return vec3(1.0, 1.0, 1.0); +} + +fn main_1() { + var j : i32; + let x_37 : f32 = x_7.injectionSwitch.x; + let x_39 : f32 = x_7.injectionSwitch.y; + if ((x_37 > x_39)) { + j = 0; + loop { + if (true) { + } else { + break; + } + + continuing { + let x_46 : vec3 = mand_(); + } + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl new file mode 100644 index 0000000000..26e82264c9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl @@ -0,0 +1,53 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn mand_() -> vec3 { + var k : i32; + k = 0; + loop { + if (true) { + } else { + break; + } + discard; + } + return vec3(1.0, 1.0, 1.0); +} + +fn main_1() { + var j : i32; + let x_37 : f32 = x_7.injectionSwitch.x; + let x_39 : f32 = x_7.injectionSwitch.y; + if ((x_37 > x_39)) { + j = 0; + loop { + if (true) { + } else { + break; + } + + continuing { + let x_46 : vec3 = mand_(); + } + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.hlsl new file mode 100755 index 0000000000..05c271772a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.hlsl @@ -0,0 +1,57 @@ +SKIP: FAILED + +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 mand_() { + int k = 0; + k = 0; + while (true) { + if (true) { + } else { + break; + } + discard; + } + return float3(1.0f, 1.0f, 1.0f); +} + +void main_1() { + int j = 0; + const float x_37 = asfloat(x_7[0].x); + const float x_39 = asfloat(x_7[0].y); + if ((x_37 > x_39)) { + j = 0; + { + for(; true; const float3 x_46 = mand_()) { + } + } + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} +T:\tmp\ub0s.0:26:19: error: expected expression + for(; true; const float3 x_46 = mand_()) { + ^ +T:\tmp\ub0s.0:26:19: error: expected ')' +T:\tmp\ub0s.0:26:10: note: to match this '(' + for(; true; const float3 x_46 = mand_()) { + ^ + + diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..82947bc766 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.msl @@ -0,0 +1,54 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 mand_() { + int k = 0; + k = 0; + while (true) { + if (true) { + } else { + break; + } + discard_fragment(); + } + return float3(1.0f, 1.0f, 1.0f); +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_4) { + int j = 0; + float const x_37 = x_7.injectionSwitch.x; + float const x_39 = x_7.injectionSwitch.y; + if ((x_37 > x_39)) { + j = 0; + while (true) { + if (true) { + } else { + break; + } + { + float3 const x_46 = mand_(); + } + } + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_7, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..8d1e068b8e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.spvasm @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 70 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %mand_ "mand_" + OpName %k "k" + OpName %main_1 "main_1" + OpName %j "j" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %v3float = OpTypeVector %float 3 + %12 = OpTypeFunction %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %31 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %void = OpTypeVoid + %32 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %57 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %58 = OpTypeFunction %void %main_out + %mand_ = OpFunction %v3float None %12 + %15 = OpLabel + %k = OpVariable %_ptr_Function_int Function %19 + OpStore %k %int_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + OpSelectionMerge %27 None + OpBranchConditional %true %28 %29 + %28 = OpLabel + OpBranch %27 + %29 = OpLabel + OpBranch %22 + %27 = OpLabel + OpKill + %23 = OpLabel + OpBranch %21 + %22 = OpLabel + OpReturnValue %31 + OpFunctionEnd + %main_1 = OpFunction %void None %32 + %35 = OpLabel + %j = OpVariable %_ptr_Function_int Function %19 + %40 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %44 = OpLoad %float %43 + %45 = OpFOrdGreaterThan %bool %41 %44 + OpSelectionMerge %46 None + OpBranchConditional %45 %47 %46 + %47 = OpLabel + OpStore %j %int_0 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + OpSelectionMerge %52 None + OpBranchConditional %true %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %49 + %52 = OpLabel + OpBranch %50 + %50 = OpLabel + %55 = OpFunctionCall %v3float %mand_ + OpBranch %48 + %49 = OpLabel + OpBranch %46 + %46 = OpLabel + OpStore %x_GLF_color %57 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %58 +%tint_symbol = OpFunctionParameter %main_out + %62 = OpLabel + %63 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %63 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %32 + %65 = OpLabel + %66 = OpFunctionCall %void %main_1 + %68 = OpLoad %v4float %x_GLF_color + %69 = OpCompositeConstruct %main_out %68 + %67 = OpFunctionCall %void %tint_symbol_2 %69 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..26e82264c9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/two-nested-infinite-loops-discard/0-opt.wgsl.expected.wgsl @@ -0,0 +1,53 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var x_GLF_color : vec4; + +fn mand_() -> vec3 { + var k : i32; + k = 0; + loop { + if (true) { + } else { + break; + } + discard; + } + return vec3(1.0, 1.0, 1.0); +} + +fn main_1() { + var j : i32; + let x_37 : f32 = x_7.injectionSwitch.x; + let x_39 : f32 = x_7.injectionSwitch.y; + if ((x_37 > x_39)) { + j = 0; + loop { + if (true) { + } else { + break; + } + + continuing { + let x_46 : vec3 = mand_(); + } + } + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm new file mode 100644 index 0000000000..de10e0ec4d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm @@ -0,0 +1,82 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %GLF_dead6index "GLF_dead6index" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %GLF_dead6currentNode "GLF_dead6currentNode" + OpName %donor_replacementGLF_dead6tree "donor_replacementGLF_dead6tree" + OpDecorate %_GLF_color Location 0 + OpDecorate %GLF_dead6index RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %GLF_dead6currentNode RelaxedPrecision + OpDecorate %donor_replacementGLF_dead6tree RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_arr_int_uint_1 = OpTypeArray %int %uint_1 +%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1 + %main = OpFunction %void None %13 + %32 = OpLabel +%GLF_dead6index = OpVariable %_ptr_Function_int Function +%GLF_dead6currentNode = OpVariable %_ptr_Function_int Function +%donor_replacementGLF_dead6tree = OpVariable %_ptr_Function__arr_int_uint_1 Function + OpStore %_GLF_color %19 + OpStore %GLF_dead6index %int_0 + %33 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %34 = OpLoad %float %33 + %35 = OpFOrdLessThan %bool %34 %float_0 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %36 + %37 = OpLabel + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + OpBranchConditional %true %42 %39 + %42 = OpLabel + %9 = OpLoad %int %GLF_dead6index + %43 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead6tree %9 + %10 = OpLoad %int %43 + OpStore %GLF_dead6currentNode %10 + %11 = OpLoad %int %GLF_dead6currentNode + OpStore %GLF_dead6index %11 + OpBranch %40 + %40 = OpLabel + OpBranch %38 + %39 = OpLabel + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.hlsl new file mode 100755 index 0000000000..cd1e8944fc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + int GLF_dead6index = 0; + int GLF_dead6currentNode = 0; + int donor_replacementGLF_dead6tree[1] = (int[1])0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + GLF_dead6index = 0; + const float x_34 = asfloat(x_6[0].y); + if ((x_34 < 0.0f)) { + while (true) { + if (true) { + } else { + break; + } + const int x_10 = donor_replacementGLF_dead6tree[GLF_dead6index]; + GLF_dead6currentNode = x_10; + GLF_dead6index = GLF_dead6currentNode; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} +error: validation errors +T:\tmp\u4lc.0:34: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.msl new file mode 100644 index 0000000000..3986db2c36 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.msl @@ -0,0 +1,47 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[1]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int GLF_dead6index = 0; + int GLF_dead6currentNode = 0; + tint_array_wrapper donor_replacementGLF_dead6tree = {}; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + GLF_dead6index = 0; + float const x_34 = x_6.injectionSwitch.y; + if ((x_34 < 0.0f)) { + while (true) { + if (true) { + } else { + break; + } + int const x_9 = GLF_dead6index; + int const x_10 = donor_replacementGLF_dead6tree.arr[x_9]; + GLF_dead6currentNode = x_10; + int const x_11 = GLF_dead6currentNode; + GLF_dead6index = x_11; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..4f5ea06549 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.spvasm @@ -0,0 +1,116 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %GLF_dead6index "GLF_dead6index" + OpName %GLF_dead6currentNode "GLF_dead6currentNode" + OpName %donor_replacementGLF_dead6tree "donor_replacementGLF_dead6tree" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_1 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 +%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1 + %26 = OpConstantNull %_arr_int_uint_1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %51 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel +%GLF_dead6index = OpVariable %_ptr_Function_int Function %19 +%GLF_dead6currentNode = OpVariable %_ptr_Function_int Function %19 +%donor_replacementGLF_dead6tree = OpVariable %_ptr_Function__arr_int_uint_1 Function %26 + OpStore %x_GLF_color %29 + OpStore %GLF_dead6index %int_0 + %33 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %34 = OpLoad %float %33 + %35 = OpFOrdLessThan %bool %34 %float_0 + OpSelectionMerge %37 None + OpBranchConditional %35 %38 %37 + %38 = OpLabel + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + OpSelectionMerge %44 None + OpBranchConditional %true %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %40 + %44 = OpLabel + %47 = OpLoad %int %GLF_dead6index + %48 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead6tree %47 + %49 = OpLoad %int %48 + OpStore %GLF_dead6currentNode %49 + %50 = OpLoad %int %GLF_dead6currentNode + OpStore %GLF_dead6index %50 + OpBranch %41 + %41 = OpLabel + OpBranch %39 + %40 = OpLabel + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %51 +%tint_symbol = OpFunctionParameter %main_out + %55 = OpLabel + %56 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %56 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %58 = OpLabel + %59 = OpFunctionCall %void %main_1 + %61 = OpLoad %v4float %x_GLF_color + %62 = OpCompositeConstruct %main_out %61 + %60 = OpFunctionCall %void %tint_symbol_2 %62 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..eec717ff79 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.wgsl @@ -0,0 +1,42 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var GLF_dead6index : i32; + var GLF_dead6currentNode : i32; + var donor_replacementGLF_dead6tree : array; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + GLF_dead6index = 0; + let x_34 : f32 = x_6.injectionSwitch.y; + if ((x_34 < 0.0)) { + loop { + if (true) { + } else { + break; + } + let x_9 : i32 = GLF_dead6index; + let x_10 : i32 = donor_replacementGLF_dead6tree[x_9]; + GLF_dead6currentNode = x_10; + let x_11 : i32 = GLF_dead6currentNode; + GLF_dead6index = x_11; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl new file mode 100644 index 0000000000..eec717ff79 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl @@ -0,0 +1,42 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var GLF_dead6index : i32; + var GLF_dead6currentNode : i32; + var donor_replacementGLF_dead6tree : array; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + GLF_dead6index = 0; + let x_34 : f32 = x_6.injectionSwitch.y; + if ((x_34 < 0.0)) { + loop { + if (true) { + } else { + break; + } + let x_9 : i32 = GLF_dead6index; + let x_10 : i32 = donor_replacementGLF_dead6tree[x_9]; + GLF_dead6currentNode = x_10; + let x_11 : i32 = GLF_dead6currentNode; + GLF_dead6index = x_11; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.hlsl new file mode 100755 index 0000000000..633f6e3e1e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.hlsl @@ -0,0 +1,47 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + int GLF_dead6index = 0; + int GLF_dead6currentNode = 0; + int donor_replacementGLF_dead6tree[1] = (int[1])0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + GLF_dead6index = 0; + const float x_34 = asfloat(x_6[0].y); + if ((x_34 < 0.0f)) { + while (true) { + if (true) { + } else { + break; + } + const int x_10 = donor_replacementGLF_dead6tree[GLF_dead6index]; + GLF_dead6currentNode = x_10; + GLF_dead6index = GLF_dead6currentNode; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} +error: validation errors +T:\tmp\u4wo.0:34: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.msl new file mode 100644 index 0000000000..3986db2c36 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.msl @@ -0,0 +1,47 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + int arr[1]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int GLF_dead6index = 0; + int GLF_dead6currentNode = 0; + tint_array_wrapper donor_replacementGLF_dead6tree = {}; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + GLF_dead6index = 0; + float const x_34 = x_6.injectionSwitch.y; + if ((x_34 < 0.0f)) { + while (true) { + if (true) { + } else { + break; + } + int const x_9 = GLF_dead6index; + int const x_10 = donor_replacementGLF_dead6tree.arr[x_9]; + GLF_dead6currentNode = x_10; + int const x_11 = GLF_dead6currentNode; + GLF_dead6index = x_11; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..4f5ea06549 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.spvasm @@ -0,0 +1,116 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %GLF_dead6index "GLF_dead6index" + OpName %GLF_dead6currentNode "GLF_dead6currentNode" + OpName %donor_replacementGLF_dead6tree "donor_replacementGLF_dead6tree" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_int_uint_1 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_int_uint_1 = OpTypeArray %int %uint_1 +%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1 + %26 = OpConstantNull %_arr_int_uint_1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %51 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel +%GLF_dead6index = OpVariable %_ptr_Function_int Function %19 +%GLF_dead6currentNode = OpVariable %_ptr_Function_int Function %19 +%donor_replacementGLF_dead6tree = OpVariable %_ptr_Function__arr_int_uint_1 Function %26 + OpStore %x_GLF_color %29 + OpStore %GLF_dead6index %int_0 + %33 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %34 = OpLoad %float %33 + %35 = OpFOrdLessThan %bool %34 %float_0 + OpSelectionMerge %37 None + OpBranchConditional %35 %38 %37 + %38 = OpLabel + OpBranch %39 + %39 = OpLabel + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + OpSelectionMerge %44 None + OpBranchConditional %true %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %40 + %44 = OpLabel + %47 = OpLoad %int %GLF_dead6index + %48 = OpAccessChain %_ptr_Function_int %donor_replacementGLF_dead6tree %47 + %49 = OpLoad %int %48 + OpStore %GLF_dead6currentNode %49 + %50 = OpLoad %int %GLF_dead6currentNode + OpStore %GLF_dead6index %50 + OpBranch %41 + %41 = OpLabel + OpBranch %39 + %40 = OpLabel + OpBranch %37 + %37 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %51 +%tint_symbol = OpFunctionParameter %main_out + %55 = OpLabel + %56 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %56 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %58 = OpLabel + %59 = OpFunctionCall %void %main_1 + %61 = OpLoad %v4float %x_GLF_color + %62 = OpCompositeConstruct %main_out %61 + %60 = OpFunctionCall %void %tint_symbol_2 %62 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..eec717ff79 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.wgsl @@ -0,0 +1,42 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var GLF_dead6index : i32; + var GLF_dead6currentNode : i32; + var donor_replacementGLF_dead6tree : array; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + GLF_dead6index = 0; + let x_34 : f32 = x_6.injectionSwitch.y; + if ((x_34 < 0.0)) { + loop { + if (true) { + } else { + break; + } + let x_9 : i32 = GLF_dead6index; + let x_10 : i32 = donor_replacementGLF_dead6tree[x_9]; + GLF_dead6currentNode = x_10; + let x_11 : i32 = GLF_dead6currentNode; + GLF_dead6index = x_11; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm new file mode 100644 index 0000000000..180f4848f1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm @@ -0,0 +1,113 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %performPartition_ "performPartition(" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %GLF_live0i "GLF_live0i" + OpName %i "i" + OpDecorate %performPartition_ RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %GLF_live0i RelaxedPrecision + OpDecorate %i RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %11 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + %void = OpTypeVoid + %13 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %15 = OpTypeFunction %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %32 = OpUndef %int + %true = OpConstantTrue %bool + %main = OpFunction %void None %13 + %34 = OpLabel + %9 = OpFunctionCall %int %performPartition_ + OpReturn + OpFunctionEnd +%performPartition_ = OpFunction %int None %15 + %35 = OpLabel + %GLF_live0i = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %21 + OpBranch %36 + %36 = OpLabel + %10 = OpPhi %int %32 %35 %11 %37 + OpLoopMerge %38 %37 None + OpBranch %39 + %39 = OpLabel + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %41 = OpLoad %float %40 + %42 = OpFOrdLessThan %bool %41 %float_0 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %45 = OpLabel + OpStore %GLF_live0i %int_0 + OpBranch %46 + %46 = OpLabel + %47 = OpSLessThan %bool %int_0 %int_1 + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + OpSelectionMerge %51 None + OpBranchConditional %42 %48 %51 + %48 = OpLabel + OpSelectionMerge %52 None + OpBranchConditional %42 %53 %52 + %51 = OpLabel + OpReturnValue %int_1 + %49 = OpLabel + OpBranch %46 + %53 = OpLabel + OpBranch %54 + %54 = OpLabel + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + OpReturnValue %int_1 + %56 = OpLabel + OpBranch %54 + %55 = OpLabel + OpUnreachable + %52 = OpLabel + OpBranch %37 + %44 = OpLabel + OpBranch %37 + %43 = OpLabel + OpBranch %37 + %37 = OpLabel + %11 = OpPhi %int %10 %44 %10 %52 %int_0 %43 + OpBranchConditional %false %36 %38 + %38 = OpLabel + OpReturnValue %11 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..301c3755e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.hlsl @@ -0,0 +1,86 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +int performPartition_() { + int GLF_live0i = 0; + int i = 0; + int x_11 = 0; + int x_10_phi = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_10_phi = 0; + while (true) { + int x_11_phi = 0; + const int x_10 = x_10_phi; + bool x_42 = false; + const float x_41 = asfloat(x_6[0].y); + x_42 = (x_41 < 0.0f); + if (x_42) { + x_11_phi = x_10; + { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + continue; + } else { + GLF_live0i = 0; + while (true) { + const bool x_47 = (0 < 1); + if (x_42) { + break; + } + return 1; + } + if (x_42) { + while (true) { + return 1; + } + return 0; + } + x_11_phi = x_10; + { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + continue; + } + x_11_phi = 0; + { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + } + return x_11; +} + +void main_1() { + const int x_9 = performPartition_(); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..4c1cf9d75d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.msl @@ -0,0 +1,89 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int performPartition_(constant buf0& x_6, thread float4* const tint_symbol_4) { + int GLF_live0i = 0; + int i = 0; + int x_11 = 0; + int x_10_phi = 0; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_10_phi = 0; + while (true) { + int x_11_phi = 0; + int const x_10 = x_10_phi; + bool x_42 = false; + float const x_41 = x_6.injectionSwitch.y; + x_42 = (x_41 < 0.0f); + if (x_42) { + x_11_phi = x_10; + { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + continue; + } else { + GLF_live0i = 0; + while (true) { + bool const x_47 = (0 < 1); + if (x_42) { + break; + } + return 1; + } + if (x_42) { + while (true) { + return 1; + } + return 0; + } + x_11_phi = x_10; + { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + continue; + } + x_11_phi = 0; + { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + } + return x_11; +} + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5) { + int const x_9 = performPartition_(x_6, tint_symbol_5); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b8befb6369 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.spvasm @@ -0,0 +1,172 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %performPartition_ "performPartition_" + OpName %GLF_live0i "GLF_live0i" + OpName %i "i" + OpName %x_11 "x_11" + OpName %x_10_phi "x_10_phi" + OpName %x_11_phi "x_11_phi" + OpName %x_42 "x_42" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 + %12 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %35 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %void = OpTypeVoid + %70 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %75 = OpTypeFunction %void %main_out +%performPartition_ = OpFunction %int None %12 + %15 = OpLabel + %GLF_live0i = OpVariable %_ptr_Function_int Function %18 + %i = OpVariable %_ptr_Function_int Function %18 + %x_11 = OpVariable %_ptr_Function_int Function %18 + %x_10_phi = OpVariable %_ptr_Function_int Function %18 + %x_11_phi = OpVariable %_ptr_Function_int Function %18 + %x_42 = OpVariable %_ptr_Function_bool Function %35 + OpStore %x_GLF_color %24 + OpStore %x_10_phi %int_0 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %31 = OpLoad %int %x_10_phi + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %41 = OpLoad %float %40 + %42 = OpFOrdLessThan %bool %41 %float_0 + OpStore %x_42 %42 + %43 = OpLoad %bool %x_42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %46 + %45 = OpLabel + OpStore %x_11_phi %31 + OpBranch %28 + %46 = OpLabel + OpStore %GLF_live0i %int_0 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %52 = OpSLessThan %bool %int_0 %int_1 + %53 = OpLoad %bool %x_42 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + OpBranch %48 + %54 = OpLabel + OpReturnValue %int_1 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + %56 = OpLoad %bool %x_42 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + OpReturnValue %int_1 + %61 = OpLabel + OpBranch %59 + %60 = OpLabel + OpReturnValue %int_0 + %57 = OpLabel + OpStore %x_11_phi %31 + OpBranch %28 + %44 = OpLabel + OpStore %x_11_phi %int_0 + OpBranch %28 + %28 = OpLabel + %63 = OpLoad %int %x_11_phi + OpStore %x_11 %63 + %64 = OpLoad %int %x_11 + OpStore %x_10_phi %64 + OpSelectionMerge %66 None + OpBranchConditional %false %67 %68 + %67 = OpLabel + OpBranch %66 + %68 = OpLabel + OpBranch %27 + %66 = OpLabel + OpBranch %26 + %27 = OpLabel + %69 = OpLoad %int %x_11 + OpReturnValue %69 + OpFunctionEnd + %main_1 = OpFunction %void None %70 + %73 = OpLabel + %74 = OpFunctionCall %int %performPartition_ + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %75 +%tint_symbol = OpFunctionParameter %main_out + %79 = OpLabel + %80 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %80 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %70 + %82 = OpLabel + %83 = OpFunctionCall %void %main_1 + %85 = OpLoad %v4float %x_GLF_color + %86 = OpCompositeConstruct %main_out %85 + %84 = OpFunctionCall %void %tint_symbol_2 %86 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 28[%28] is not post dominated by the back-edge block 66[%66] + %66 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..0ddfab8907 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.spvasm.expected.wgsl @@ -0,0 +1,72 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn performPartition_() -> i32 { + var GLF_live0i : i32; + var i : i32; + var x_11 : i32; + var x_10_phi : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_10_phi = 0; + loop { + var x_11_phi : i32; + let x_10 : i32 = x_10_phi; + var x_42 : bool; + let x_41 : f32 = x_6.injectionSwitch.y; + x_42 = (x_41 < 0.0); + if (x_42) { + x_11_phi = x_10; + continue; + } else { + GLF_live0i = 0; + loop { + let x_47 : bool = (0 < 1); + if (x_42) { + break; + } + return 1; + } + if (x_42) { + loop { + return 1; + } + return 0; + } + x_11_phi = x_10; + continue; + } + x_11_phi = 0; + + continuing { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + } + return x_11; +} + +fn main_1() { + let x_9 : i32 = performPartition_(); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl new file mode 100644 index 0000000000..0ddfab8907 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl @@ -0,0 +1,72 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn performPartition_() -> i32 { + var GLF_live0i : i32; + var i : i32; + var x_11 : i32; + var x_10_phi : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_10_phi = 0; + loop { + var x_11_phi : i32; + let x_10 : i32 = x_10_phi; + var x_42 : bool; + let x_41 : f32 = x_6.injectionSwitch.y; + x_42 = (x_41 < 0.0); + if (x_42) { + x_11_phi = x_10; + continue; + } else { + GLF_live0i = 0; + loop { + let x_47 : bool = (0 < 1); + if (x_42) { + break; + } + return 1; + } + if (x_42) { + loop { + return 1; + } + return 0; + } + x_11_phi = x_10; + continue; + } + x_11_phi = 0; + + continuing { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + } + return x_11; +} + +fn main_1() { + let x_9 : i32 = performPartition_(); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..301c3755e4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.hlsl @@ -0,0 +1,86 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +int performPartition_() { + int GLF_live0i = 0; + int i = 0; + int x_11 = 0; + int x_10_phi = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_10_phi = 0; + while (true) { + int x_11_phi = 0; + const int x_10 = x_10_phi; + bool x_42 = false; + const float x_41 = asfloat(x_6[0].y); + x_42 = (x_41 < 0.0f); + if (x_42) { + x_11_phi = x_10; + { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + continue; + } else { + GLF_live0i = 0; + while (true) { + const bool x_47 = (0 < 1); + if (x_42) { + break; + } + return 1; + } + if (x_42) { + while (true) { + return 1; + } + return 0; + } + x_11_phi = x_10; + { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + continue; + } + x_11_phi = 0; + { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + } + return x_11; +} + +void main_1() { + const int x_9 = performPartition_(); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..4c1cf9d75d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.msl @@ -0,0 +1,89 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int performPartition_(constant buf0& x_6, thread float4* const tint_symbol_4) { + int GLF_live0i = 0; + int i = 0; + int x_11 = 0; + int x_10_phi = 0; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_10_phi = 0; + while (true) { + int x_11_phi = 0; + int const x_10 = x_10_phi; + bool x_42 = false; + float const x_41 = x_6.injectionSwitch.y; + x_42 = (x_41 < 0.0f); + if (x_42) { + x_11_phi = x_10; + { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + continue; + } else { + GLF_live0i = 0; + while (true) { + bool const x_47 = (0 < 1); + if (x_42) { + break; + } + return 1; + } + if (x_42) { + while (true) { + return 1; + } + return 0; + } + x_11_phi = x_10; + { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + continue; + } + x_11_phi = 0; + { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + } + return x_11; +} + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_5) { + int const x_9 = performPartition_(x_6, tint_symbol_5); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_6, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b8befb6369 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.spvasm @@ -0,0 +1,172 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 87 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %performPartition_ "performPartition_" + OpName %GLF_live0i "GLF_live0i" + OpName %i "i" + OpName %x_11 "x_11" + OpName %x_10_phi "x_10_phi" + OpName %x_11_phi "x_11_phi" + OpName %x_42 "x_42" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 + %12 = OpTypeFunction %int +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %35 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 + %false = OpConstantFalse %bool + %void = OpTypeVoid + %70 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %75 = OpTypeFunction %void %main_out +%performPartition_ = OpFunction %int None %12 + %15 = OpLabel + %GLF_live0i = OpVariable %_ptr_Function_int Function %18 + %i = OpVariable %_ptr_Function_int Function %18 + %x_11 = OpVariable %_ptr_Function_int Function %18 + %x_10_phi = OpVariable %_ptr_Function_int Function %18 + %x_11_phi = OpVariable %_ptr_Function_int Function %18 + %x_42 = OpVariable %_ptr_Function_bool Function %35 + OpStore %x_GLF_color %24 + OpStore %x_10_phi %int_0 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %31 = OpLoad %int %x_10_phi + %40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %41 = OpLoad %float %40 + %42 = OpFOrdLessThan %bool %41 %float_0 + OpStore %x_42 %42 + %43 = OpLoad %bool %x_42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %46 + %45 = OpLabel + OpStore %x_11_phi %31 + OpBranch %28 + %46 = OpLabel + OpStore %GLF_live0i %int_0 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %52 = OpSLessThan %bool %int_0 %int_1 + %53 = OpLoad %bool %x_42 + OpSelectionMerge %54 None + OpBranchConditional %53 %55 %54 + %55 = OpLabel + OpBranch %48 + %54 = OpLabel + OpReturnValue %int_1 + %49 = OpLabel + OpBranch %47 + %48 = OpLabel + %56 = OpLoad %bool %x_42 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + OpReturnValue %int_1 + %61 = OpLabel + OpBranch %59 + %60 = OpLabel + OpReturnValue %int_0 + %57 = OpLabel + OpStore %x_11_phi %31 + OpBranch %28 + %44 = OpLabel + OpStore %x_11_phi %int_0 + OpBranch %28 + %28 = OpLabel + %63 = OpLoad %int %x_11_phi + OpStore %x_11 %63 + %64 = OpLoad %int %x_11 + OpStore %x_10_phi %64 + OpSelectionMerge %66 None + OpBranchConditional %false %67 %68 + %67 = OpLabel + OpBranch %66 + %68 = OpLabel + OpBranch %27 + %66 = OpLabel + OpBranch %26 + %27 = OpLabel + %69 = OpLoad %int %x_11 + OpReturnValue %69 + OpFunctionEnd + %main_1 = OpFunction %void None %70 + %73 = OpLabel + %74 = OpFunctionCall %int %performPartition_ + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %75 +%tint_symbol = OpFunctionParameter %main_out + %79 = OpLabel + %80 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %80 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %70 + %82 = OpLabel + %83 = OpFunctionCall %void %main_1 + %85 = OpLoad %v4float %x_GLF_color + %86 = OpCompositeConstruct %main_out %85 + %84 = OpFunctionCall %void %tint_symbol_2 %86 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 28[%28] is not post dominated by the back-edge block 66[%66] + %66 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..0ddfab8907 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/undefined-integer-in-function/0-opt.wgsl.expected.wgsl @@ -0,0 +1,72 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn performPartition_() -> i32 { + var GLF_live0i : i32; + var i : i32; + var x_11 : i32; + var x_10_phi : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_10_phi = 0; + loop { + var x_11_phi : i32; + let x_10 : i32 = x_10_phi; + var x_42 : bool; + let x_41 : f32 = x_6.injectionSwitch.y; + x_42 = (x_41 < 0.0); + if (x_42) { + x_11_phi = x_10; + continue; + } else { + GLF_live0i = 0; + loop { + let x_47 : bool = (0 < 1); + if (x_42) { + break; + } + return 1; + } + if (x_42) { + loop { + return 1; + } + return 0; + } + x_11_phi = x_10; + continue; + } + x_11_phi = 0; + + continuing { + x_11 = x_11_phi; + x_10_phi = x_11; + if (false) { + } else { + break; + } + } + } + return x_11; +} + +fn main_1() { + let x_9 : i32 = performPartition_(); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm new file mode 100644 index 0000000000..88da2e95ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm @@ -0,0 +1,71 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Function__arr_float_uint_1 = OpTypePointer Function %_arr_float_uint_1 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_float = OpTypePointer Function %float + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %28 = OpUndef %float + %main = OpFunction %void None %7 + %29 = OpLabel + %30 = OpVariable %_ptr_Function_float Function + OpBranch %31 + %31 = OpLabel + %32 = OpPhi %float %28 %29 %33 %34 + OpLoopMerge %35 %34 None + OpBranch %36 + %36 = OpLabel + %33 = OpPhi %float %32 %31 %28 %37 + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %41 = OpLoad %float %40 + %42 = OpFOrdLessThan %bool %39 %41 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %34 + %37 = OpLabel + OpBranch %36 + %44 = OpLabel + OpStore %_GLF_color %27 + OpReturn + %43 = OpLabel + OpBranch %34 + %34 = OpLabel + OpBranch %31 + %35 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..704ebff464 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.hlsl @@ -0,0 +1,44 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float x_30 = 0.0f; + float x_32_phi = 0.0f; + x_32_phi = 0.0f; + while (true) { + float x_33_phi = 0.0f; + x_33_phi = x_32_phi; + const float x_33 = x_33_phi; + const float x_39 = asfloat(x_5[0].x); + const float x_41 = asfloat(x_5[0].y); + if ((x_39 < x_41)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; + } else { + { + x_32_phi = x_33; + } + continue; + } + { + x_32_phi = x_33; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f3bfdd29ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float x_30 = 0.0f; + float x_32_phi = 0.0f; + x_32_phi = 0.0f; + while (true) { + float x_33_phi = 0.0f; + float const x_32 = x_32_phi; + x_33_phi = x_32; + float const x_33 = x_33_phi; + float const x_39 = x_5.injectionSwitch.x; + float const x_41 = x_5.injectionSwitch.y; + if ((x_39 < x_41)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; + } else { + { + x_32_phi = x_33; + } + continue; + } + { + x_32_phi = x_33; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2cc6d3bdbf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_30 "x_30" + OpName %x_32_phi "x_32_phi" + OpName %x_33_phi "x_33_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpConstantNull %float + %float_0 = OpConstant %float 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %42 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %43 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_30 = OpVariable %_ptr_Function_float Function %18 + %x_32_phi = OpVariable %_ptr_Function_float Function %18 + %x_33_phi = OpVariable %_ptr_Function_float Function %18 + OpStore %x_32_phi %float_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %26 = OpLoad %float %x_32_phi + OpStore %x_33_phi %26 + %27 = OpLoad %float %x_33_phi + %31 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %32 = OpLoad %float %31 + %34 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %35 = OpLoad %float %34 + %36 = OpFOrdLessThan %bool %32 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + OpStore %x_GLF_color %42 + OpReturn + %40 = OpLabel + OpBranch %23 + %38 = OpLabel + OpBranch %23 + %23 = OpLabel + OpStore %x_32_phi %27 + OpBranch %21 + %22 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %43 +%tint_symbol = OpFunctionParameter %main_out + %47 = OpLabel + %48 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %48 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %50 = OpLabel + %51 = OpFunctionCall %void %main_1 + %53 = OpLoad %v4float %x_GLF_color + %54 = OpCompositeConstruct %main_out %53 + %52 = OpFunctionCall %void %tint_symbol_2 %54 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..ee9a420426 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.spvasm.expected.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_30 : f32; + var x_32_phi : f32; + x_32_phi = 0.0; + loop { + var x_33_phi : f32; + let x_32 : f32 = x_32_phi; + x_33_phi = x_32; + let x_33 : f32 = x_33_phi; + let x_39 : f32 = x_5.injectionSwitch.x; + let x_41 : f32 = x_5.injectionSwitch.y; + if ((x_39 < x_41)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; + } else { + continue; + } + + continuing { + x_32_phi = x_33; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl new file mode 100644 index 0000000000..ee9a420426 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_30 : f32; + var x_32_phi : f32; + x_32_phi = 0.0; + loop { + var x_33_phi : f32; + let x_32 : f32 = x_32_phi; + x_33_phi = x_32; + let x_33 : f32 = x_33_phi; + let x_39 : f32 = x_5.injectionSwitch.x; + let x_41 : f32 = x_5.injectionSwitch.y; + if ((x_39 < x_41)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; + } else { + continue; + } + + continuing { + x_32_phi = x_33; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..704ebff464 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.hlsl @@ -0,0 +1,44 @@ +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float x_30 = 0.0f; + float x_32_phi = 0.0f; + x_32_phi = 0.0f; + while (true) { + float x_33_phi = 0.0f; + x_33_phi = x_32_phi; + const float x_33 = x_33_phi; + const float x_39 = asfloat(x_5[0].x); + const float x_41 = asfloat(x_5[0].y); + if ((x_39 < x_41)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; + } else { + { + x_32_phi = x_33; + } + continue; + } + { + x_32_phi = x_33; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f3bfdd29ce --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + float x_30 = 0.0f; + float x_32_phi = 0.0f; + x_32_phi = 0.0f; + while (true) { + float x_33_phi = 0.0f; + float const x_32 = x_32_phi; + x_33_phi = x_32; + float const x_33 = x_33_phi; + float const x_39 = x_5.injectionSwitch.x; + float const x_41 = x_5.injectionSwitch.y; + if ((x_39 < x_41)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; + } else { + { + x_32_phi = x_33; + } + continue; + } + { + x_32_phi = x_33; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2cc6d3bdbf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 55 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_5 "x_5" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_30 "x_30" + OpName %x_32_phi "x_32_phi" + OpName %x_33_phi "x_33_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpConstantNull %float + %float_0 = OpConstant %float 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %42 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %43 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %x_30 = OpVariable %_ptr_Function_float Function %18 + %x_32_phi = OpVariable %_ptr_Function_float Function %18 + %x_33_phi = OpVariable %_ptr_Function_float Function %18 + OpStore %x_32_phi %float_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %26 = OpLoad %float %x_32_phi + OpStore %x_33_phi %26 + %27 = OpLoad %float %x_33_phi + %31 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %32 = OpLoad %float %31 + %34 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %35 = OpLoad %float %34 + %36 = OpFOrdLessThan %bool %32 %35 + OpSelectionMerge %38 None + OpBranchConditional %36 %39 %40 + %39 = OpLabel + OpStore %x_GLF_color %42 + OpReturn + %40 = OpLabel + OpBranch %23 + %38 = OpLabel + OpBranch %23 + %23 = OpLabel + OpStore %x_32_phi %27 + OpBranch %21 + %22 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %43 +%tint_symbol = OpFunctionParameter %main_out + %47 = OpLabel + %48 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %48 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %50 = OpLabel + %51 = OpFunctionCall %void %main_1 + %53 = OpLoad %v4float %x_GLF_color + %54 = OpCompositeConstruct %main_out %53 + %52 = OpFunctionCall %void %tint_symbol_2 %54 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..ee9a420426 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninit-element-cast-in-loop/0-opt.wgsl.expected.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_5 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var x_30 : f32; + var x_32_phi : f32; + x_32_phi = 0.0; + loop { + var x_33_phi : f32; + let x_32 : f32 = x_32_phi; + x_33_phi = x_32; + let x_33 : f32 = x_33_phi; + let x_39 : f32 = x_5.injectionSwitch.x; + let x_41 : f32 = x_5.injectionSwitch.y; + if ((x_39 < x_41)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; + } else { + continue; + } + + continuing { + x_32_phi = x_33; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm new file mode 100644 index 0000000000..2dd3c4d757 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm @@ -0,0 +1,67 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %foo "foo" + OpDecorate %_GLF_color Location 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %foo RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %16 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_n1 = OpConstant %float -1 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_float = OpTypePointer Output %float +%uint_178493 = OpConstant %uint 178493 +%_ptr_Function_uint = OpTypePointer Function %uint + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %10 + %29 = OpLabel + %30 = OpVariable %_ptr_Function_float Function + %foo = OpVariable %_ptr_Function_uint Function + OpStore %_GLF_color %16 + %31 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %32 = OpLoad %float %31 + %33 = OpFOrdGreaterThan %bool %32 %float_n1 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %36 + %35 = OpLabel + %37 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_0 + %38 = OpLoad %float %37 + OpStore %30 %38 + OpBranch %34 + %36 = OpLabel + %6 = OpLoad %uint %foo + %7 = OpISub %uint %6 %int_1 + OpStore %foo %7 + %8 = OpIAdd %uint %uint_178493 %7 + %39 = OpConvertUToF %float %8 + OpStore %30 %39 + OpBranch %34 + %34 = OpLabel + %40 = OpLoad %float %30 + %41 = OpAccessChain %_ptr_Output_float %_GLF_color %uint_0 + OpStore %41 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..9722e0dc86 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.hlsl @@ -0,0 +1,38 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float x_30 = 0.0f; + uint foo = 0u; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_32 = gl_FragCoord.x; + if ((x_32 > -1.0f)) { + const float x_38 = x_GLF_color.x; + x_30 = x_38; + } else { + const uint x_7 = (foo - asuint(1)); + foo = x_7; + x_30 = float((178493u + x_7)); + } + x_GLF_color.x = x_30; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a3f6ec635c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float x_30 = 0.0f; + uint foo = 0u; + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + float const x_32 = (*(tint_symbol_6)).x; + if ((x_32 > -1.0f)) { + float const x_38 = (*(tint_symbol_5)).x; + x_30 = x_38; + } else { + uint const x_6 = foo; + uint const x_7 = (x_6 - as_type(1)); + foo = x_7; + x_30 = float((178493u + x_7)); + } + float const x_40 = x_30; + (*(tint_symbol_5)).x = x_40; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..10ff9fa965 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.spvasm @@ -0,0 +1,100 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_30 "x_30" + OpName %foo "foo" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_n1 = OpConstant %float -1 + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%uint_178493 = OpConstant %uint 178493 + %main_out = OpTypeStruct %v4float + %47 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_30 = OpVariable %_ptr_Function_float Function %17 + %foo = OpVariable %_ptr_Function_uint Function %21 + OpStore %x_GLF_color %24 + %27 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %28 = OpLoad %float %27 + %30 = OpFOrdGreaterThan %bool %28 %float_n1 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + %35 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %36 = OpLoad %float %35 + OpStore %x_30 %36 + OpBranch %32 + %34 = OpLabel + %37 = OpLoad %uint %foo + %38 = OpBitcast %uint %int_1 + %41 = OpISub %uint %37 %38 + OpStore %foo %41 + %44 = OpIAdd %uint %uint_178493 %41 + %42 = OpConvertUToF %float %44 + OpStore %x_30 %42 + OpBranch %32 + %32 = OpLabel + %45 = OpLoad %float %x_30 + %46 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + OpStore %46 %45 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %47 +%tint_symbol_1 = OpFunctionParameter %main_out + %51 = OpLabel + %52 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %52 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %54 = OpLabel + %55 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %55 + %56 = OpFunctionCall %void %main_1 + %58 = OpLoad %v4float %x_GLF_color + %59 = OpCompositeConstruct %main_out %58 + %57 = OpFunctionCall %void %tint_symbol_3 %59 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..3b84978d61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.spvasm.expected.wgsl @@ -0,0 +1,34 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var x_30 : f32; + var foo : u32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_32 : f32 = gl_FragCoord.x; + if ((x_32 > -1.0)) { + let x_38 : f32 = x_GLF_color.x; + x_30 = x_38; + } else { + let x_6 : u32 = foo; + let x_7 : u32 = (x_6 - bitcast(1)); + foo = x_7; + x_30 = f32((178493u + x_7)); + } + let x_40 : f32 = x_30; + x_GLF_color.x = x_40; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl new file mode 100644 index 0000000000..3b84978d61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl @@ -0,0 +1,34 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var x_30 : f32; + var foo : u32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_32 : f32 = gl_FragCoord.x; + if ((x_32 > -1.0)) { + let x_38 : f32 = x_GLF_color.x; + x_30 = x_38; + } else { + let x_6 : u32 = foo; + let x_7 : u32 = (x_6 - bitcast(1)); + foo = x_7; + x_30 = f32((178493u + x_7)); + } + let x_40 : f32 = x_30; + x_GLF_color.x = x_40; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..9722e0dc86 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.hlsl @@ -0,0 +1,38 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float x_30 = 0.0f; + uint foo = 0u; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_32 = gl_FragCoord.x; + if ((x_32 > -1.0f)) { + const float x_38 = x_GLF_color.x; + x_30 = x_38; + } else { + const uint x_7 = (foo - asuint(1)); + foo = x_7; + x_30 = float((178493u + x_7)); + } + x_GLF_color.x = x_30; + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a3f6ec635c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float x_30 = 0.0f; + uint foo = 0u; + *(tint_symbol_5) = float4(1.0f, 0.0f, 0.0f, 1.0f); + float const x_32 = (*(tint_symbol_6)).x; + if ((x_32 > -1.0f)) { + float const x_38 = (*(tint_symbol_5)).x; + x_30 = x_38; + } else { + uint const x_6 = foo; + uint const x_7 = (x_6 - as_type(1)); + foo = x_7; + x_30 = float((178493u + x_7)); + } + float const x_40 = x_30; + (*(tint_symbol_5)).x = x_40; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_8), &(tint_symbol_7)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..10ff9fa965 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.spvasm @@ -0,0 +1,100 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_30 "x_30" + OpName %foo "foo" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %17 = OpConstantNull %float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %21 = OpConstantNull %uint + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_n1 = OpConstant %float -1 + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%uint_178493 = OpConstant %uint 178493 + %main_out = OpTypeStruct %v4float + %47 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %x_30 = OpVariable %_ptr_Function_float Function %17 + %foo = OpVariable %_ptr_Function_uint Function %21 + OpStore %x_GLF_color %24 + %27 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %28 = OpLoad %float %27 + %30 = OpFOrdGreaterThan %bool %28 %float_n1 + OpSelectionMerge %32 None + OpBranchConditional %30 %33 %34 + %33 = OpLabel + %35 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + %36 = OpLoad %float %35 + OpStore %x_30 %36 + OpBranch %32 + %34 = OpLabel + %37 = OpLoad %uint %foo + %38 = OpBitcast %uint %int_1 + %41 = OpISub %uint %37 %38 + OpStore %foo %41 + %44 = OpIAdd %uint %uint_178493 %41 + %42 = OpConvertUToF %float %44 + OpStore %x_30 %42 + OpBranch %32 + %32 = OpLabel + %45 = OpLoad %float %x_30 + %46 = OpAccessChain %_ptr_Private_float %x_GLF_color %uint_0 + OpStore %46 %45 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %47 +%tint_symbol_1 = OpFunctionParameter %main_out + %51 = OpLabel + %52 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %52 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %54 = OpLabel + %55 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %55 + %56 = OpFunctionCall %void %main_1 + %58 = OpLoad %v4float %x_GLF_color + %59 = OpCompositeConstruct %main_out %58 + %57 = OpFunctionCall %void %tint_symbol_3 %59 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..3b84978d61 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uninitialized-var-decrement-and-add/0-opt.wgsl.expected.wgsl @@ -0,0 +1,34 @@ +var x_GLF_color : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + var x_30 : f32; + var foo : u32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_32 : f32 = gl_FragCoord.x; + if ((x_32 > -1.0)) { + let x_38 : f32 = x_GLF_color.x; + x_30 = x_38; + } else { + let x_6 : u32 = foo; + let x_7 : u32 = (x_6 - bitcast(1)); + foo = x_7; + x_30 = f32((178493u + x_7)); + } + let x_40 : f32 = x_30; + x_GLF_color.x = x_40; + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm new file mode 100644 index 0000000000..d6a929a542 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm @@ -0,0 +1,269 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpSource ESSL 310 + OpName %main "main" + OpName %A "A" + OpName %i "i" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %value "value" + OpName %m "m" + OpName %l "l" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %_ "" + OpName %n "n" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "resolution" + OpName %__0 "" + OpName %doesNotMatter "doesNotMatter" + OpMemberName %doesNotMatter 0 "_compute_data" + OpName %__1 "" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %buf2 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 2 + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %doesNotMatter 0 Offset 0 + OpDecorate %doesNotMatter BufferBlock + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 0 + %void = OpTypeVoid + %18 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Function__arr_float_uint_1 = OpTypePointer Function %_arr_float_uint_1 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function_int = OpTypePointer Function %int + %int_50 = OpConstant %int 50 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_100 = OpConstant %uint 100 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %40 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_120 = OpConstant %uint 120 + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %__0 = OpVariable %_ptr_Uniform_buf2 Uniform + %false = OpConstantFalse %bool +%_runtimearr_int = OpTypeRuntimeArray %int +%doesNotMatter = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_doesNotMatter = OpTypePointer Uniform %doesNotMatter + %__1 = OpVariable %_ptr_Uniform_doesNotMatter Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %uint_3 = OpConstant %uint 3 + %main = OpFunction %void None %18 + %54 = OpLabel + %A = OpVariable %_ptr_Function__arr_float_uint_1 Function + %i = OpVariable %_ptr_Function_int Function + %value = OpVariable %_ptr_Function_v4float Function + %m = OpVariable %_ptr_Function_int Function + %l = OpVariable %_ptr_Function_int Function + %n = OpVariable %_ptr_Function_int Function + %55 = OpAccessChain %_ptr_Function_float %A %int_0 + OpStore %55 %float_0 + OpStore %i %int_0 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %int %i + %61 = OpSLessThan %bool %60 %int_50 + OpBranchConditional %61 %62 %57 + %62 = OpLabel + %63 = OpLoad %int %i + %64 = OpSGreaterThan %bool %63 %int_0 + OpSelectionMerge %65 None + OpBranchConditional %64 %66 %65 + %66 = OpLabel + %67 = OpAccessChain %_ptr_Function_float %A %int_0 + %68 = OpLoad %float %67 + %69 = OpAccessChain %_ptr_Function_float %A %int_0 + %70 = OpLoad %float %69 + %71 = OpFAdd %float %70 %68 + %72 = OpAccessChain %_ptr_Function_float %A %int_0 + OpStore %72 %71 + OpBranch %65 + %65 = OpLabel + OpBranch %58 + %58 = OpLabel + %73 = OpLoad %int %i + %74 = OpIAdd %int %73 %int_1 + OpStore %i %74 + OpBranch %56 + %57 = OpLabel + OpBranch %75 + %75 = OpLabel + OpLoopMerge %76 %77 None + OpBranch %78 + %78 = OpLabel + %79 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %80 = OpLoad %uint %79 + %81 = OpULessThan %bool %80 %uint_100 + OpSelectionMerge %82 None + OpBranchConditional %81 %83 %84 + %83 = OpLabel + OpStore %value %40 + OpStore %m %int_0 + OpBranch %85 + %85 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %89 = OpLoad %int %m + %90 = OpSLessThan %bool %89 %int_1 + OpBranchConditional %90 %91 %86 + %91 = OpLabel + OpStore %l %int_0 + OpBranch %92 + %92 = OpLabel + OpLoopMerge %93 %94 None + OpBranch %95 + %95 = OpLabel + %96 = OpLoad %int %l + %97 = OpSLessThan %bool %96 %int_1 + OpBranchConditional %97 %98 %93 + %98 = OpLabel + %99 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %100 = OpLoad %float %99 + %101 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %102 = OpLoad %float %101 + %103 = OpFOrdGreaterThan %bool %100 %102 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + OpReturn + %104 = OpLabel + OpBranch %94 + %94 = OpLabel + %106 = OpLoad %int %l + %107 = OpIAdd %int %106 %int_1 + OpStore %l %107 + OpBranch %92 + %93 = OpLabel + OpBranch %87 + %87 = OpLabel + %108 = OpLoad %int %m + %109 = OpIAdd %int %108 %int_1 + OpStore %m %109 + OpBranch %85 + %86 = OpLabel + OpStore %n %int_0 + OpBranch %110 + %110 = OpLabel + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %114 = OpLoad %int %n + %115 = OpSLessThan %bool %114 %int_1 + OpBranchConditional %115 %116 %111 + %116 = OpLabel + %117 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %118 = OpLoad %float %117 + %119 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %120 = OpLoad %float %119 + %121 = OpFOrdGreaterThan %bool %118 %120 + OpSelectionMerge %122 None + OpBranchConditional %121 %123 %122 + %123 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %122 + %122 = OpLabel + OpBranch %112 + %112 = OpLabel + %124 = OpLoad %int %n + %125 = OpIAdd %int %124 %int_1 + OpStore %n %125 + OpBranch %110 + %111 = OpLabel + OpBranch %82 + %84 = OpLabel + %126 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %127 = OpLoad %uint %126 + %128 = OpULessThan %bool %127 %uint_120 + OpSelectionMerge %129 None + OpBranchConditional %128 %130 %131 + %130 = OpLabel + %132 = OpAccessChain %_ptr_Function_float %A %int_0 + %133 = OpLoad %float %132 + %134 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_0 + %135 = OpLoad %float %134 + %136 = OpFDiv %float %133 %135 + %137 = OpAccessChain %_ptr_Function_float %A %int_0 + %138 = OpLoad %float %137 + %139 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %140 = OpLoad %float %139 + %141 = OpFDiv %float %138 %140 + %142 = OpCompositeConstruct %v4float %136 %141 %float_0 %float_1 + OpStore %value %142 + OpBranch %129 + %131 = OpLabel + %143 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %144 = OpLoad %float %143 + %145 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %146 = OpLoad %float %145 + %147 = OpFOrdGreaterThan %bool %144 %146 + OpSelectionMerge %148 None + OpBranchConditional %147 %149 %148 + %149 = OpLabel + OpBranch %77 + %148 = OpLabel + OpBranch %129 + %129 = OpLabel + OpBranch %82 + %82 = OpLabel + OpBranch %77 + %77 = OpLabel + OpBranchConditional %false %75 %76 + %76 = OpLabel + %150 = OpAccessChain %_ptr_Function_float %value %uint_0 + %151 = OpLoad %float %150 + %152 = OpConvertFToS %int %151 + %153 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0 + OpStore %153 %152 + %154 = OpAccessChain %_ptr_Function_float %value %uint_1 + %155 = OpLoad %float %154 + %156 = OpConvertFToS %int %155 + %157 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1 + OpStore %157 %156 + %158 = OpAccessChain %_ptr_Function_float %value %uint_2 + %159 = OpLoad %float %158 + %160 = OpConvertFToS %int %159 + %161 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_2 + OpStore %161 %160 + %162 = OpAccessChain %_ptr_Function_float %value %uint_3 + %163 = OpLoad %float %162 + %164 = OpConvertFToS %int %163 + %165 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_3 + OpStore %165 %164 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..47ae9f1c86 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.hlsl @@ -0,0 +1,107 @@ +static uint3 gl_GlobalInvocationID = uint3(0u, 0u, 0u); +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[1]; +}; +cbuffer cbuffer_x_13 : register(b2, space0) { + uint4 x_13[1]; +}; +RWByteAddressBuffer x_15 : register(u0, space0); + +void main_1() { + float A[1] = (float[1])0; + int i = 0; + float4 value = float4(0.0f, 0.0f, 0.0f, 0.0f); + int m = 0; + int l = 0; + int n = 0; + A[0] = 0.0f; + i = 0; + { + for(; (i < 50); i = (i + 1)) { + if ((i > 0)) { + const float x_68 = A[0]; + const float x_70 = A[0]; + A[0] = (x_70 + x_68); + } + } + } + while (true) { + const uint x_80 = gl_GlobalInvocationID.x; + if ((x_80 < 100u)) { + value = float4(0.0f, 0.0f, 0.0f, 1.0f); + m = 0; + { + for(; (m < 1); m = (m + 1)) { + l = 0; + { + for(; (l < 1); l = (l + 1)) { + const float x_100 = asfloat(x_10[0].x); + const float x_102 = asfloat(x_10[0].y); + if ((x_100 > x_102)) { + return; + } + } + } + } + } + n = 0; + { + for(; (n < 1); n = (n + 1)) { + const float x_118 = asfloat(x_10[0].x); + const float x_120 = asfloat(x_10[0].y); + if ((x_118 > x_120)) { + GroupMemoryBarrierWithGroupSync(); + } + } + } + } else { + const uint x_127 = gl_GlobalInvocationID.x; + if ((x_127 < 120u)) { + const float x_133 = A[0]; + const float x_135 = asfloat(x_13[0].x); + const float x_138 = A[0]; + const float x_140 = asfloat(x_13[0].y); + value = float4((x_133 / x_135), (x_138 / x_140), 0.0f, 1.0f); + } else { + const float x_144 = asfloat(x_10[0].x); + const float x_146 = asfloat(x_10[0].y); + if ((x_144 > x_146)) { + { + if (false) { + } else { + break; + } + } + continue; + } + } + } + { + if (false) { + } else { + break; + } + } + } + const float x_151 = value.x; + x_15.Store((4u * uint(0)), asuint(int(x_151))); + const float x_155 = value.y; + x_15.Store(4u, asuint(int(x_155))); + const float x_159 = value.z; + x_15.Store(8u, asuint(int(x_159))); + const float x_163 = value.w; + x_15.Store(12u, asuint(int(x_163))); + return; +} + +struct tint_symbol_1 { + uint3 gl_GlobalInvocationID_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 gl_GlobalInvocationID_param = tint_symbol.gl_GlobalInvocationID_param; + gl_GlobalInvocationID = gl_GlobalInvocationID_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a4f03c0ae4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.msl @@ -0,0 +1,139 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf2 { + /* 0x0000 */ packed_float2 resolution; +}; +struct doesNotMatter { + /* 0x0000 */ int x_compute_data[1]; +}; +struct tint_array_wrapper { + float arr[1]; +}; + +void main_1(constant buf1& x_10, constant buf2& x_13, device doesNotMatter& x_15, thread uint3* const tint_symbol_2) { + tint_array_wrapper A = {}; + int i = 0; + float4 value = 0.0f; + int m = 0; + int l = 0; + int n = 0; + A.arr[0] = 0.0f; + i = 0; + while (true) { + int const x_60 = i; + if ((x_60 < 50)) { + } else { + break; + } + int const x_63 = i; + if ((x_63 > 0)) { + float const x_68 = A.arr[0]; + float const x_70 = A.arr[0]; + A.arr[0] = (x_70 + x_68); + } + { + int const x_73 = i; + i = (x_73 + 1); + } + } + while (true) { + uint const x_80 = (*(tint_symbol_2)).x; + if ((x_80 < 100u)) { + value = float4(0.0f, 0.0f, 0.0f, 1.0f); + m = 0; + while (true) { + int const x_89 = m; + if ((x_89 < 1)) { + } else { + break; + } + l = 0; + while (true) { + int const x_96 = l; + if ((x_96 < 1)) { + } else { + break; + } + float const x_100 = x_10.injectionSwitch.x; + float const x_102 = x_10.injectionSwitch.y; + if ((x_100 > x_102)) { + return; + } + { + int const x_106 = l; + l = (x_106 + 1); + } + } + { + int const x_108 = m; + m = (x_108 + 1); + } + } + n = 0; + while (true) { + int const x_114 = n; + if ((x_114 < 1)) { + } else { + break; + } + float const x_118 = x_10.injectionSwitch.x; + float const x_120 = x_10.injectionSwitch.y; + if ((x_118 > x_120)) { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + { + int const x_124 = n; + n = (x_124 + 1); + } + } + } else { + uint const x_127 = (*(tint_symbol_2)).x; + if ((x_127 < 120u)) { + float const x_133 = A.arr[0]; + float const x_135 = x_13.resolution.x; + float const x_138 = A.arr[0]; + float const x_140 = x_13.resolution.y; + value = float4((x_133 / x_135), (x_138 / x_140), 0.0f, 1.0f); + } else { + float const x_144 = x_10.injectionSwitch.x; + float const x_146 = x_10.injectionSwitch.y; + if ((x_144 > x_146)) { + { + if (false) { + } else { + break; + } + } + continue; + } + } + } + { + if (false) { + } else { + break; + } + } + } + float const x_151 = value.x; + x_15.x_compute_data[0] = int(x_151); + float const x_155 = value.y; + x_15.x_compute_data[1] = int(x_155); + float const x_159 = value.z; + x_15.x_compute_data[2] = int(x_159); + float const x_163 = value.w; + x_15.x_compute_data[3] = int(x_163); + return; +} + +kernel void tint_symbol(uint3 gl_GlobalInvocationID_param [[thread_position_in_grid]], constant buf1& x_10 [[buffer(1)]], constant buf2& x_13 [[buffer(2)]], device doesNotMatter& x_15 [[buffer(0)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = gl_GlobalInvocationID_param; + main_1(x_10, x_13, x_15, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..553aab9234 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.spvasm @@ -0,0 +1,322 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 187 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_10 "x_10" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "resolution" + OpName %x_13 "x_13" + OpName %doesNotMatter "doesNotMatter" + OpMemberName %doesNotMatter 0 "x_compute_data" + OpName %x_15 "x_15" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %A "A" + OpName %i "i" + OpName %value "value" + OpName %m "m" + OpName %l "l" + OpName %n "n" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 2 + OpDecorate %doesNotMatter Block + OpMemberDecorate %doesNotMatter 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 0 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + OpDecorate %_arr_float_uint_1 ArrayStride 4 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Private_v3uint Private %5 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_13 = OpVariable %_ptr_Uniform_buf2 Uniform + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int +%doesNotMatter = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_doesNotMatter = OpTypePointer StorageBuffer %doesNotMatter + %x_15 = OpVariable %_ptr_StorageBuffer_doesNotMatter StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %21 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Function__arr_float_uint_1 = OpTypePointer Function %_arr_float_uint_1 + %29 = OpConstantNull %_arr_float_uint_1 +%_ptr_Function_int = OpTypePointer Function %int + %32 = OpConstantNull %int + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %36 = OpConstantNull %v4float + %int_0 = OpConstant %int 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 + %int_50 = OpConstant %int 50 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %uint_100 = OpConstant %uint 100 + %float_1 = OpConstant %float 1 + %82 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_120 = OpConstant %uint 120 + %false = OpConstantFalse %bool +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_2 = OpConstant %int 2 + %uint_3 = OpConstant %uint 3 + %int_3 = OpConstant %int 3 + %main_1 = OpFunction %void None %21 + %24 = OpLabel + %A = OpVariable %_ptr_Function__arr_float_uint_1 Function %29 + %i = OpVariable %_ptr_Function_int Function %32 + %value = OpVariable %_ptr_Function_v4float Function %36 + %m = OpVariable %_ptr_Function_int Function %32 + %l = OpVariable %_ptr_Function_int Function %32 + %n = OpVariable %_ptr_Function_int Function %32 + %42 = OpAccessChain %_ptr_Function_float %A %int_0 + OpStore %42 %float_0 + OpStore %i %int_0 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpSLessThan %bool %48 %int_50 + OpSelectionMerge %52 None + OpBranchConditional %50 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %45 + %52 = OpLabel + %55 = OpLoad %int %i + %56 = OpSGreaterThan %bool %55 %int_0 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + %59 = OpAccessChain %_ptr_Function_float %A %int_0 + %60 = OpLoad %float %59 + %61 = OpAccessChain %_ptr_Function_float %A %int_0 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Function_float %A %int_0 + %64 = OpFAdd %float %62 %60 + OpStore %63 %64 + OpBranch %57 + %57 = OpLabel + OpBranch %46 + %46 = OpLabel + %65 = OpLoad %int %i + %67 = OpIAdd %int %65 %int_1 + OpStore %i %67 + OpBranch %44 + %45 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %74 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 + %75 = OpLoad %uint %74 + %77 = OpULessThan %bool %75 %uint_100 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + OpStore %value %82 + OpStore %m %int_0 + OpBranch %83 + %83 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + %87 = OpLoad %int %m + %88 = OpSLessThan %bool %87 %int_1 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %91 + %90 = OpLabel + OpBranch %89 + %91 = OpLabel + OpBranch %84 + %89 = OpLabel + OpStore %l %int_0 + OpBranch %92 + %92 = OpLabel + OpLoopMerge %93 %94 None + OpBranch %95 + %95 = OpLabel + %96 = OpLoad %int %l + %97 = OpSLessThan %bool %96 %int_1 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %100 + %99 = OpLabel + OpBranch %98 + %100 = OpLabel + OpBranch %93 + %98 = OpLabel + %102 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_1 + %105 = OpLoad %float %104 + %106 = OpFOrdGreaterThan %bool %103 %105 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %107 + %108 = OpLabel + OpReturn + %107 = OpLabel + OpBranch %94 + %94 = OpLabel + %109 = OpLoad %int %l + %110 = OpIAdd %int %109 %int_1 + OpStore %l %110 + OpBranch %92 + %93 = OpLabel + OpBranch %85 + %85 = OpLabel + %111 = OpLoad %int %m + %112 = OpIAdd %int %111 %int_1 + OpStore %m %112 + OpBranch %83 + %84 = OpLabel + OpStore %n %int_0 + OpBranch %113 + %113 = OpLabel + OpLoopMerge %114 %115 None + OpBranch %116 + %116 = OpLabel + %117 = OpLoad %int %n + %118 = OpSLessThan %bool %117 %int_1 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %121 + %120 = OpLabel + OpBranch %119 + %121 = OpLabel + OpBranch %114 + %119 = OpLabel + %122 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0 + %123 = OpLoad %float %122 + %124 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_1 + %125 = OpLoad %float %124 + %126 = OpFOrdGreaterThan %bool %123 %125 + OpSelectionMerge %127 None + OpBranchConditional %126 %128 %127 + %128 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %127 + %127 = OpLabel + OpBranch %115 + %115 = OpLabel + %132 = OpLoad %int %n + %133 = OpIAdd %int %132 %int_1 + OpStore %n %133 + OpBranch %113 + %114 = OpLabel + OpBranch %78 + %80 = OpLabel + %134 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 + %135 = OpLoad %uint %134 + %137 = OpULessThan %bool %135 %uint_120 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %140 + %139 = OpLabel + %141 = OpAccessChain %_ptr_Function_float %A %int_0 + %142 = OpLoad %float %141 + %143 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0 + %144 = OpLoad %float %143 + %145 = OpAccessChain %_ptr_Function_float %A %int_0 + %146 = OpLoad %float %145 + %147 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_1 + %148 = OpLoad %float %147 + %149 = OpFDiv %float %142 %144 + %150 = OpFDiv %float %146 %148 + %151 = OpCompositeConstruct %v4float %149 %150 %float_0 %float_1 + OpStore %value %151 + OpBranch %138 + %140 = OpLabel + %152 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0 + %153 = OpLoad %float %152 + %154 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_1 + %155 = OpLoad %float %154 + %156 = OpFOrdGreaterThan %bool %153 %155 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %157 + %158 = OpLabel + OpBranch %70 + %157 = OpLabel + OpBranch %138 + %138 = OpLabel + OpBranch %78 + %78 = OpLabel + OpBranch %70 + %70 = OpLabel + OpSelectionMerge %160 None + OpBranchConditional %false %161 %162 + %161 = OpLabel + OpBranch %160 + %162 = OpLabel + OpBranch %69 + %160 = OpLabel + OpBranch %68 + %69 = OpLabel + %163 = OpAccessChain %_ptr_Function_float %value %uint_0 + %164 = OpLoad %float %163 + %166 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %int_0 + %167 = OpConvertFToS %int %164 + OpStore %166 %167 + %168 = OpAccessChain %_ptr_Function_float %value %uint_1 + %169 = OpLoad %float %168 + %170 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %int_1 + %171 = OpConvertFToS %int %169 + OpStore %170 %171 + %172 = OpAccessChain %_ptr_Function_float %value %uint_2 + %173 = OpLoad %float %172 + %175 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %int_2 + %176 = OpConvertFToS %int %173 + OpStore %175 %176 + %178 = OpAccessChain %_ptr_Function_float %value %uint_3 + %179 = OpLoad %float %178 + %181 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %int_3 + %182 = OpConvertFToS %int %179 + OpStore %181 %182 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %21 + %184 = OpLabel + %185 = OpLoad %v3uint %tint_symbol + OpStore %gl_GlobalInvocationID %185 + %186 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 70[%70] is not post dominated by the back-edge block 160[%160] + %160 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..2b4eb0e50d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.spvasm.expected.wgsl @@ -0,0 +1,145 @@ +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf2 { + resolution : vec2; +}; + +type RTArr = [[stride(4)]] array; + +[[block]] +struct doesNotMatter { + x_compute_data : RTArr; +}; + +var gl_GlobalInvocationID : vec3; + +[[group(0), binding(1)]] var x_10 : buf1; + +[[group(0), binding(2)]] var x_13 : buf2; + +[[group(0), binding(0)]] var x_15 : doesNotMatter; + +fn main_1() { + var A : array; + var i : i32; + var value : vec4; + var m : i32; + var l : i32; + var n : i32; + A[0] = 0.0; + i = 0; + loop { + let x_60 : i32 = i; + if ((x_60 < 50)) { + } else { + break; + } + let x_63 : i32 = i; + if ((x_63 > 0)) { + let x_68 : f32 = A[0]; + let x_70 : f32 = A[0]; + A[0] = (x_70 + x_68); + } + + continuing { + let x_73 : i32 = i; + i = (x_73 + 1); + } + } + loop { + let x_80 : u32 = gl_GlobalInvocationID.x; + if ((x_80 < 100u)) { + value = vec4(0.0, 0.0, 0.0, 1.0); + m = 0; + loop { + let x_89 : i32 = m; + if ((x_89 < 1)) { + } else { + break; + } + l = 0; + loop { + let x_96 : i32 = l; + if ((x_96 < 1)) { + } else { + break; + } + let x_100 : f32 = x_10.injectionSwitch.x; + let x_102 : f32 = x_10.injectionSwitch.y; + if ((x_100 > x_102)) { + return; + } + + continuing { + let x_106 : i32 = l; + l = (x_106 + 1); + } + } + + continuing { + let x_108 : i32 = m; + m = (x_108 + 1); + } + } + n = 0; + loop { + let x_114 : i32 = n; + if ((x_114 < 1)) { + } else { + break; + } + let x_118 : f32 = x_10.injectionSwitch.x; + let x_120 : f32 = x_10.injectionSwitch.y; + if ((x_118 > x_120)) { + workgroupBarrier(); + } + + continuing { + let x_124 : i32 = n; + n = (x_124 + 1); + } + } + } else { + let x_127 : u32 = gl_GlobalInvocationID.x; + if ((x_127 < 120u)) { + let x_133 : f32 = A[0]; + let x_135 : f32 = x_13.resolution.x; + let x_138 : f32 = A[0]; + let x_140 : f32 = x_13.resolution.y; + value = vec4((x_133 / x_135), (x_138 / x_140), 0.0, 1.0); + } else { + let x_144 : f32 = x_10.injectionSwitch.x; + let x_146 : f32 = x_10.injectionSwitch.y; + if ((x_144 > x_146)) { + continue; + } + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + let x_151 : f32 = value.x; + x_15.x_compute_data[0] = i32(x_151); + let x_155 : f32 = value.y; + x_15.x_compute_data[1] = i32(x_155); + let x_159 : f32 = value.z; + x_15.x_compute_data[2] = i32(x_159); + let x_163 : f32 = value.w; + x_15.x_compute_data[3] = i32(x_163); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] gl_GlobalInvocationID_param : vec3) { + gl_GlobalInvocationID = gl_GlobalInvocationID_param; + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl new file mode 100644 index 0000000000..2b4eb0e50d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl @@ -0,0 +1,145 @@ +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf2 { + resolution : vec2; +}; + +type RTArr = [[stride(4)]] array; + +[[block]] +struct doesNotMatter { + x_compute_data : RTArr; +}; + +var gl_GlobalInvocationID : vec3; + +[[group(0), binding(1)]] var x_10 : buf1; + +[[group(0), binding(2)]] var x_13 : buf2; + +[[group(0), binding(0)]] var x_15 : doesNotMatter; + +fn main_1() { + var A : array; + var i : i32; + var value : vec4; + var m : i32; + var l : i32; + var n : i32; + A[0] = 0.0; + i = 0; + loop { + let x_60 : i32 = i; + if ((x_60 < 50)) { + } else { + break; + } + let x_63 : i32 = i; + if ((x_63 > 0)) { + let x_68 : f32 = A[0]; + let x_70 : f32 = A[0]; + A[0] = (x_70 + x_68); + } + + continuing { + let x_73 : i32 = i; + i = (x_73 + 1); + } + } + loop { + let x_80 : u32 = gl_GlobalInvocationID.x; + if ((x_80 < 100u)) { + value = vec4(0.0, 0.0, 0.0, 1.0); + m = 0; + loop { + let x_89 : i32 = m; + if ((x_89 < 1)) { + } else { + break; + } + l = 0; + loop { + let x_96 : i32 = l; + if ((x_96 < 1)) { + } else { + break; + } + let x_100 : f32 = x_10.injectionSwitch.x; + let x_102 : f32 = x_10.injectionSwitch.y; + if ((x_100 > x_102)) { + return; + } + + continuing { + let x_106 : i32 = l; + l = (x_106 + 1); + } + } + + continuing { + let x_108 : i32 = m; + m = (x_108 + 1); + } + } + n = 0; + loop { + let x_114 : i32 = n; + if ((x_114 < 1)) { + } else { + break; + } + let x_118 : f32 = x_10.injectionSwitch.x; + let x_120 : f32 = x_10.injectionSwitch.y; + if ((x_118 > x_120)) { + workgroupBarrier(); + } + + continuing { + let x_124 : i32 = n; + n = (x_124 + 1); + } + } + } else { + let x_127 : u32 = gl_GlobalInvocationID.x; + if ((x_127 < 120u)) { + let x_133 : f32 = A[0]; + let x_135 : f32 = x_13.resolution.x; + let x_138 : f32 = A[0]; + let x_140 : f32 = x_13.resolution.y; + value = vec4((x_133 / x_135), (x_138 / x_140), 0.0, 1.0); + } else { + let x_144 : f32 = x_10.injectionSwitch.x; + let x_146 : f32 = x_10.injectionSwitch.y; + if ((x_144 > x_146)) { + continue; + } + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + let x_151 : f32 = value.x; + x_15.x_compute_data[0] = i32(x_151); + let x_155 : f32 = value.y; + x_15.x_compute_data[1] = i32(x_155); + let x_159 : f32 = value.z; + x_15.x_compute_data[2] = i32(x_159); + let x_163 : f32 = value.w; + x_15.x_compute_data[3] = i32(x_163); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] gl_GlobalInvocationID_param : vec3) { + gl_GlobalInvocationID = gl_GlobalInvocationID_param; + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..47ae9f1c86 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.hlsl @@ -0,0 +1,107 @@ +static uint3 gl_GlobalInvocationID = uint3(0u, 0u, 0u); +cbuffer cbuffer_x_10 : register(b1, space0) { + uint4 x_10[1]; +}; +cbuffer cbuffer_x_13 : register(b2, space0) { + uint4 x_13[1]; +}; +RWByteAddressBuffer x_15 : register(u0, space0); + +void main_1() { + float A[1] = (float[1])0; + int i = 0; + float4 value = float4(0.0f, 0.0f, 0.0f, 0.0f); + int m = 0; + int l = 0; + int n = 0; + A[0] = 0.0f; + i = 0; + { + for(; (i < 50); i = (i + 1)) { + if ((i > 0)) { + const float x_68 = A[0]; + const float x_70 = A[0]; + A[0] = (x_70 + x_68); + } + } + } + while (true) { + const uint x_80 = gl_GlobalInvocationID.x; + if ((x_80 < 100u)) { + value = float4(0.0f, 0.0f, 0.0f, 1.0f); + m = 0; + { + for(; (m < 1); m = (m + 1)) { + l = 0; + { + for(; (l < 1); l = (l + 1)) { + const float x_100 = asfloat(x_10[0].x); + const float x_102 = asfloat(x_10[0].y); + if ((x_100 > x_102)) { + return; + } + } + } + } + } + n = 0; + { + for(; (n < 1); n = (n + 1)) { + const float x_118 = asfloat(x_10[0].x); + const float x_120 = asfloat(x_10[0].y); + if ((x_118 > x_120)) { + GroupMemoryBarrierWithGroupSync(); + } + } + } + } else { + const uint x_127 = gl_GlobalInvocationID.x; + if ((x_127 < 120u)) { + const float x_133 = A[0]; + const float x_135 = asfloat(x_13[0].x); + const float x_138 = A[0]; + const float x_140 = asfloat(x_13[0].y); + value = float4((x_133 / x_135), (x_138 / x_140), 0.0f, 1.0f); + } else { + const float x_144 = asfloat(x_10[0].x); + const float x_146 = asfloat(x_10[0].y); + if ((x_144 > x_146)) { + { + if (false) { + } else { + break; + } + } + continue; + } + } + } + { + if (false) { + } else { + break; + } + } + } + const float x_151 = value.x; + x_15.Store((4u * uint(0)), asuint(int(x_151))); + const float x_155 = value.y; + x_15.Store(4u, asuint(int(x_155))); + const float x_159 = value.z; + x_15.Store(8u, asuint(int(x_159))); + const float x_163 = value.w; + x_15.Store(12u, asuint(int(x_163))); + return; +} + +struct tint_symbol_1 { + uint3 gl_GlobalInvocationID_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 gl_GlobalInvocationID_param = tint_symbol.gl_GlobalInvocationID_param; + gl_GlobalInvocationID = gl_GlobalInvocationID_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a4f03c0ae4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.msl @@ -0,0 +1,139 @@ +#include + +using namespace metal; +struct buf1 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct buf2 { + /* 0x0000 */ packed_float2 resolution; +}; +struct doesNotMatter { + /* 0x0000 */ int x_compute_data[1]; +}; +struct tint_array_wrapper { + float arr[1]; +}; + +void main_1(constant buf1& x_10, constant buf2& x_13, device doesNotMatter& x_15, thread uint3* const tint_symbol_2) { + tint_array_wrapper A = {}; + int i = 0; + float4 value = 0.0f; + int m = 0; + int l = 0; + int n = 0; + A.arr[0] = 0.0f; + i = 0; + while (true) { + int const x_60 = i; + if ((x_60 < 50)) { + } else { + break; + } + int const x_63 = i; + if ((x_63 > 0)) { + float const x_68 = A.arr[0]; + float const x_70 = A.arr[0]; + A.arr[0] = (x_70 + x_68); + } + { + int const x_73 = i; + i = (x_73 + 1); + } + } + while (true) { + uint const x_80 = (*(tint_symbol_2)).x; + if ((x_80 < 100u)) { + value = float4(0.0f, 0.0f, 0.0f, 1.0f); + m = 0; + while (true) { + int const x_89 = m; + if ((x_89 < 1)) { + } else { + break; + } + l = 0; + while (true) { + int const x_96 = l; + if ((x_96 < 1)) { + } else { + break; + } + float const x_100 = x_10.injectionSwitch.x; + float const x_102 = x_10.injectionSwitch.y; + if ((x_100 > x_102)) { + return; + } + { + int const x_106 = l; + l = (x_106 + 1); + } + } + { + int const x_108 = m; + m = (x_108 + 1); + } + } + n = 0; + while (true) { + int const x_114 = n; + if ((x_114 < 1)) { + } else { + break; + } + float const x_118 = x_10.injectionSwitch.x; + float const x_120 = x_10.injectionSwitch.y; + if ((x_118 > x_120)) { + threadgroup_barrier(mem_flags::mem_threadgroup); + } + { + int const x_124 = n; + n = (x_124 + 1); + } + } + } else { + uint const x_127 = (*(tint_symbol_2)).x; + if ((x_127 < 120u)) { + float const x_133 = A.arr[0]; + float const x_135 = x_13.resolution.x; + float const x_138 = A.arr[0]; + float const x_140 = x_13.resolution.y; + value = float4((x_133 / x_135), (x_138 / x_140), 0.0f, 1.0f); + } else { + float const x_144 = x_10.injectionSwitch.x; + float const x_146 = x_10.injectionSwitch.y; + if ((x_144 > x_146)) { + { + if (false) { + } else { + break; + } + } + continue; + } + } + } + { + if (false) { + } else { + break; + } + } + } + float const x_151 = value.x; + x_15.x_compute_data[0] = int(x_151); + float const x_155 = value.y; + x_15.x_compute_data[1] = int(x_155); + float const x_159 = value.z; + x_15.x_compute_data[2] = int(x_159); + float const x_163 = value.w; + x_15.x_compute_data[3] = int(x_163); + return; +} + +kernel void tint_symbol(uint3 gl_GlobalInvocationID_param [[thread_position_in_grid]], constant buf1& x_10 [[buffer(1)]], constant buf2& x_13 [[buffer(2)]], device doesNotMatter& x_15 [[buffer(0)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = gl_GlobalInvocationID_param; + main_1(x_10, x_13, x_15, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..553aab9234 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.spvasm @@ -0,0 +1,322 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 187 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "injectionSwitch" + OpName %x_10 "x_10" + OpName %buf2 "buf2" + OpMemberName %buf2 0 "resolution" + OpName %x_13 "x_13" + OpName %doesNotMatter "doesNotMatter" + OpMemberName %doesNotMatter 0 "x_compute_data" + OpName %x_15 "x_15" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %A "A" + OpName %i "i" + OpName %value "value" + OpName %m "m" + OpName %l "l" + OpName %n "n" + OpName %main "main" + OpDecorate %buf1 Block + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 1 + OpDecorate %buf2 Block + OpMemberDecorate %buf2 0 Offset 0 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 2 + OpDecorate %doesNotMatter Block + OpMemberDecorate %doesNotMatter 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 0 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + OpDecorate %_arr_float_uint_1 ArrayStride 4 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Private_v3uint Private %5 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %x_10 = OpVariable %_ptr_Uniform_buf1 Uniform + %buf2 = OpTypeStruct %v2float +%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2 + %x_13 = OpVariable %_ptr_Uniform_buf2 Uniform + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int +%doesNotMatter = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_doesNotMatter = OpTypePointer StorageBuffer %doesNotMatter + %x_15 = OpVariable %_ptr_StorageBuffer_doesNotMatter StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %21 = OpTypeFunction %void + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Function__arr_float_uint_1 = OpTypePointer Function %_arr_float_uint_1 + %29 = OpConstantNull %_arr_float_uint_1 +%_ptr_Function_int = OpTypePointer Function %int + %32 = OpConstantNull %int + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %36 = OpConstantNull %v4float + %int_0 = OpConstant %int 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 + %int_50 = OpConstant %int 50 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %uint_100 = OpConstant %uint 100 + %float_1 = OpConstant %float 1 + %82 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_120 = OpConstant %uint 120 + %false = OpConstantFalse %bool +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_2 = OpConstant %int 2 + %uint_3 = OpConstant %uint 3 + %int_3 = OpConstant %int 3 + %main_1 = OpFunction %void None %21 + %24 = OpLabel + %A = OpVariable %_ptr_Function__arr_float_uint_1 Function %29 + %i = OpVariable %_ptr_Function_int Function %32 + %value = OpVariable %_ptr_Function_v4float Function %36 + %m = OpVariable %_ptr_Function_int Function %32 + %l = OpVariable %_ptr_Function_int Function %32 + %n = OpVariable %_ptr_Function_int Function %32 + %42 = OpAccessChain %_ptr_Function_float %A %int_0 + OpStore %42 %float_0 + OpStore %i %int_0 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %50 = OpSLessThan %bool %48 %int_50 + OpSelectionMerge %52 None + OpBranchConditional %50 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %45 + %52 = OpLabel + %55 = OpLoad %int %i + %56 = OpSGreaterThan %bool %55 %int_0 + OpSelectionMerge %57 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + %59 = OpAccessChain %_ptr_Function_float %A %int_0 + %60 = OpLoad %float %59 + %61 = OpAccessChain %_ptr_Function_float %A %int_0 + %62 = OpLoad %float %61 + %63 = OpAccessChain %_ptr_Function_float %A %int_0 + %64 = OpFAdd %float %62 %60 + OpStore %63 %64 + OpBranch %57 + %57 = OpLabel + OpBranch %46 + %46 = OpLabel + %65 = OpLoad %int %i + %67 = OpIAdd %int %65 %int_1 + OpStore %i %67 + OpBranch %44 + %45 = OpLabel + OpBranch %68 + %68 = OpLabel + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %74 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 + %75 = OpLoad %uint %74 + %77 = OpULessThan %bool %75 %uint_100 + OpSelectionMerge %78 None + OpBranchConditional %77 %79 %80 + %79 = OpLabel + OpStore %value %82 + OpStore %m %int_0 + OpBranch %83 + %83 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + %87 = OpLoad %int %m + %88 = OpSLessThan %bool %87 %int_1 + OpSelectionMerge %89 None + OpBranchConditional %88 %90 %91 + %90 = OpLabel + OpBranch %89 + %91 = OpLabel + OpBranch %84 + %89 = OpLabel + OpStore %l %int_0 + OpBranch %92 + %92 = OpLabel + OpLoopMerge %93 %94 None + OpBranch %95 + %95 = OpLabel + %96 = OpLoad %int %l + %97 = OpSLessThan %bool %96 %int_1 + OpSelectionMerge %98 None + OpBranchConditional %97 %99 %100 + %99 = OpLabel + OpBranch %98 + %100 = OpLabel + OpBranch %93 + %98 = OpLabel + %102 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_1 + %105 = OpLoad %float %104 + %106 = OpFOrdGreaterThan %bool %103 %105 + OpSelectionMerge %107 None + OpBranchConditional %106 %108 %107 + %108 = OpLabel + OpReturn + %107 = OpLabel + OpBranch %94 + %94 = OpLabel + %109 = OpLoad %int %l + %110 = OpIAdd %int %109 %int_1 + OpStore %l %110 + OpBranch %92 + %93 = OpLabel + OpBranch %85 + %85 = OpLabel + %111 = OpLoad %int %m + %112 = OpIAdd %int %111 %int_1 + OpStore %m %112 + OpBranch %83 + %84 = OpLabel + OpStore %n %int_0 + OpBranch %113 + %113 = OpLabel + OpLoopMerge %114 %115 None + OpBranch %116 + %116 = OpLabel + %117 = OpLoad %int %n + %118 = OpSLessThan %bool %117 %int_1 + OpSelectionMerge %119 None + OpBranchConditional %118 %120 %121 + %120 = OpLabel + OpBranch %119 + %121 = OpLabel + OpBranch %114 + %119 = OpLabel + %122 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0 + %123 = OpLoad %float %122 + %124 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_1 + %125 = OpLoad %float %124 + %126 = OpFOrdGreaterThan %bool %123 %125 + OpSelectionMerge %127 None + OpBranchConditional %126 %128 %127 + %128 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpBranch %127 + %127 = OpLabel + OpBranch %115 + %115 = OpLabel + %132 = OpLoad %int %n + %133 = OpIAdd %int %132 %int_1 + OpStore %n %133 + OpBranch %113 + %114 = OpLabel + OpBranch %78 + %80 = OpLabel + %134 = OpAccessChain %_ptr_Private_uint %gl_GlobalInvocationID %uint_0 + %135 = OpLoad %uint %134 + %137 = OpULessThan %bool %135 %uint_120 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %140 + %139 = OpLabel + %141 = OpAccessChain %_ptr_Function_float %A %int_0 + %142 = OpLoad %float %141 + %143 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_0 + %144 = OpLoad %float %143 + %145 = OpAccessChain %_ptr_Function_float %A %int_0 + %146 = OpLoad %float %145 + %147 = OpAccessChain %_ptr_Uniform_float %x_13 %uint_0 %uint_1 + %148 = OpLoad %float %147 + %149 = OpFDiv %float %142 %144 + %150 = OpFDiv %float %146 %148 + %151 = OpCompositeConstruct %v4float %149 %150 %float_0 %float_1 + OpStore %value %151 + OpBranch %138 + %140 = OpLabel + %152 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_0 + %153 = OpLoad %float %152 + %154 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_1 + %155 = OpLoad %float %154 + %156 = OpFOrdGreaterThan %bool %153 %155 + OpSelectionMerge %157 None + OpBranchConditional %156 %158 %157 + %158 = OpLabel + OpBranch %70 + %157 = OpLabel + OpBranch %138 + %138 = OpLabel + OpBranch %78 + %78 = OpLabel + OpBranch %70 + %70 = OpLabel + OpSelectionMerge %160 None + OpBranchConditional %false %161 %162 + %161 = OpLabel + OpBranch %160 + %162 = OpLabel + OpBranch %69 + %160 = OpLabel + OpBranch %68 + %69 = OpLabel + %163 = OpAccessChain %_ptr_Function_float %value %uint_0 + %164 = OpLoad %float %163 + %166 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %int_0 + %167 = OpConvertFToS %int %164 + OpStore %166 %167 + %168 = OpAccessChain %_ptr_Function_float %value %uint_1 + %169 = OpLoad %float %168 + %170 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %int_1 + %171 = OpConvertFToS %int %169 + OpStore %170 %171 + %172 = OpAccessChain %_ptr_Function_float %value %uint_2 + %173 = OpLoad %float %172 + %175 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %int_2 + %176 = OpConvertFToS %int %173 + OpStore %175 %176 + %178 = OpAccessChain %_ptr_Function_float %value %uint_3 + %179 = OpLoad %float %178 + %181 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %int_3 + %182 = OpConvertFToS %int %179 + OpStore %181 %182 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %21 + %184 = OpLabel + %185 = OpLoad %v3uint %tint_symbol + OpStore %gl_GlobalInvocationID %185 + %186 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 70[%70] is not post dominated by the back-edge block 160[%160] + %160 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..2b4eb0e50d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-barrier-in-loops/0-opt.wgsl.expected.wgsl @@ -0,0 +1,145 @@ +[[block]] +struct buf1 { + injectionSwitch : vec2; +}; + +[[block]] +struct buf2 { + resolution : vec2; +}; + +type RTArr = [[stride(4)]] array; + +[[block]] +struct doesNotMatter { + x_compute_data : RTArr; +}; + +var gl_GlobalInvocationID : vec3; + +[[group(0), binding(1)]] var x_10 : buf1; + +[[group(0), binding(2)]] var x_13 : buf2; + +[[group(0), binding(0)]] var x_15 : doesNotMatter; + +fn main_1() { + var A : array; + var i : i32; + var value : vec4; + var m : i32; + var l : i32; + var n : i32; + A[0] = 0.0; + i = 0; + loop { + let x_60 : i32 = i; + if ((x_60 < 50)) { + } else { + break; + } + let x_63 : i32 = i; + if ((x_63 > 0)) { + let x_68 : f32 = A[0]; + let x_70 : f32 = A[0]; + A[0] = (x_70 + x_68); + } + + continuing { + let x_73 : i32 = i; + i = (x_73 + 1); + } + } + loop { + let x_80 : u32 = gl_GlobalInvocationID.x; + if ((x_80 < 100u)) { + value = vec4(0.0, 0.0, 0.0, 1.0); + m = 0; + loop { + let x_89 : i32 = m; + if ((x_89 < 1)) { + } else { + break; + } + l = 0; + loop { + let x_96 : i32 = l; + if ((x_96 < 1)) { + } else { + break; + } + let x_100 : f32 = x_10.injectionSwitch.x; + let x_102 : f32 = x_10.injectionSwitch.y; + if ((x_100 > x_102)) { + return; + } + + continuing { + let x_106 : i32 = l; + l = (x_106 + 1); + } + } + + continuing { + let x_108 : i32 = m; + m = (x_108 + 1); + } + } + n = 0; + loop { + let x_114 : i32 = n; + if ((x_114 < 1)) { + } else { + break; + } + let x_118 : f32 = x_10.injectionSwitch.x; + let x_120 : f32 = x_10.injectionSwitch.y; + if ((x_118 > x_120)) { + workgroupBarrier(); + } + + continuing { + let x_124 : i32 = n; + n = (x_124 + 1); + } + } + } else { + let x_127 : u32 = gl_GlobalInvocationID.x; + if ((x_127 < 120u)) { + let x_133 : f32 = A[0]; + let x_135 : f32 = x_13.resolution.x; + let x_138 : f32 = A[0]; + let x_140 : f32 = x_13.resolution.y; + value = vec4((x_133 / x_135), (x_138 / x_140), 0.0, 1.0); + } else { + let x_144 : f32 = x_10.injectionSwitch.x; + let x_146 : f32 = x_10.injectionSwitch.y; + if ((x_144 > x_146)) { + continue; + } + } + } + + continuing { + if (false) { + } else { + break; + } + } + } + let x_151 : f32 = value.x; + x_15.x_compute_data[0] = i32(x_151); + let x_155 : f32 = value.y; + x_15.x_compute_data[1] = i32(x_155); + let x_159 : f32 = value.z; + x_15.x_compute_data[2] = i32(x_159); + let x_163 : f32 = value.w; + x_15.x_compute_data[3] = i32(x_163); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] gl_GlobalInvocationID_param : vec3) { + gl_GlobalInvocationID = gl_GlobalInvocationID_param; + main_1(); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm new file mode 100644 index 0000000000..ef406acc2c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm @@ -0,0 +1,81 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %computeColor_ "computeColor(" + OpName %_GLF_color "_GLF_color" + OpName %_injected_loop_counter "_injected_loop_counter" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpDecorate %_injected_loop_counter RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %12 = OpTypeFunction %v3float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %17 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %29 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %main = OpFunction %void None %9 + %30 = OpLabel + %31 = OpFunctionCall %v3float %computeColor_ + OpReturn + OpFunctionEnd +%computeColor_ = OpFunction %v3float None %12 + %32 = OpLabel +%_injected_loop_counter = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %17 + OpStore %_injected_loop_counter %int_1 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %38 = OpLoad %float %37 + %39 = OpFOrdGreaterThan %bool %38 %float_1 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + %42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %43 = OpLoad %float %42 + %44 = OpFOrdGreaterThan %bool %43 %float_1 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %35 + %46 = OpLabel + OpBranch %35 + %45 = OpLabel + OpBranch %35 + %35 = OpLabel + OpBranch %33 + %40 = OpLabel + OpReturnValue %29 + %34 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..701d8d9dc1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.hlsl @@ -0,0 +1,43 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; + +float3 computeColor_() { + int x_injected_loop_counter = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_injected_loop_counter = 1; + while (true) { + const float x_38 = asfloat(x_7[0].x); + if ((x_38 > 1.0f)) { + const float x_43 = asfloat(x_7[0].x); + if ((x_43 > 1.0f)) { + continue; + } else { + continue; + } + continue; + } + return float3(1.0f, 1.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + const float3 x_31 = computeColor_(); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.msl new file mode 100644 index 0000000000..ac448be949 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 computeColor_(constant buf0& x_7, thread float4* const tint_symbol_4) { + int x_injected_loop_counter = 0; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_injected_loop_counter = 1; + while (true) { + float const x_38 = x_7.injectionSwitch.x; + if ((x_38 > 1.0f)) { + float const x_43 = x_7.injectionSwitch.x; + if ((x_43 > 1.0f)) { + continue; + } else { + continue; + } + continue; + } + return float3(1.0f, 1.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5) { + float3 const x_31 = computeColor_(x_7, tint_symbol_5); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..d114d3cc5c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.spvasm @@ -0,0 +1,113 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %computeColor_ "computeColor_" + OpName %x_injected_loop_counter "x_injected_loop_counter" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %12 = OpTypeFunction %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %43 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %44 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %45 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out +%computeColor_ = OpFunction %v3float None %12 + %15 = OpLabel +%x_injected_loop_counter = OpVariable %_ptr_Function_int Function %19 + OpStore %x_GLF_color %22 + OpStore %x_injected_loop_counter %int_1 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %31 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %32 = OpLoad %float %31 + %33 = OpFOrdGreaterThan %bool %32 %float_1 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %38 = OpLoad %float %37 + %39 = OpFOrdGreaterThan %bool %38 %float_1 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %42 + %41 = OpLabel + OpBranch %26 + %42 = OpLabel + OpBranch %26 + %40 = OpLabel + OpBranch %26 + %35 = OpLabel + OpReturnValue %43 + %26 = OpLabel + OpBranch %24 + %25 = OpLabel + OpReturnValue %44 + OpFunctionEnd + %main_1 = OpFunction %void None %45 + %48 = OpLabel + %49 = OpFunctionCall %v3float %computeColor_ + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %50 +%tint_symbol = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %45 + %57 = OpLabel + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_2 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..543e524242 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.spvasm.expected.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +fn computeColor_() -> vec3 { + var x_injected_loop_counter : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_injected_loop_counter = 1; + loop { + let x_38 : f32 = x_7.injectionSwitch.x; + if ((x_38 > 1.0)) { + let x_43 : f32 = x_7.injectionSwitch.x; + if ((x_43 > 1.0)) { + continue; + } else { + continue; + } + continue; + } + return vec3(1.0, 1.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + let x_31 : vec3 = computeColor_(); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl new file mode 100644 index 0000000000..543e524242 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +fn computeColor_() -> vec3 { + var x_injected_loop_counter : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_injected_loop_counter = 1; + loop { + let x_38 : f32 = x_7.injectionSwitch.x; + if ((x_38 > 1.0)) { + let x_43 : f32 = x_7.injectionSwitch.x; + if ((x_43 > 1.0)) { + continue; + } else { + continue; + } + continue; + } + return vec3(1.0, 1.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + let x_31 : vec3 = computeColor_(); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..701d8d9dc1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.hlsl @@ -0,0 +1,43 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; + +float3 computeColor_() { + int x_injected_loop_counter = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_injected_loop_counter = 1; + while (true) { + const float x_38 = asfloat(x_7[0].x); + if ((x_38 > 1.0f)) { + const float x_43 = asfloat(x_7[0].x); + if ((x_43 > 1.0f)) { + continue; + } else { + continue; + } + continue; + } + return float3(1.0f, 1.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + const float3 x_31 = computeColor_(); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.msl new file mode 100644 index 0000000000..ac448be949 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.msl @@ -0,0 +1,46 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 computeColor_(constant buf0& x_7, thread float4* const tint_symbol_4) { + int x_injected_loop_counter = 0; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_injected_loop_counter = 1; + while (true) { + float const x_38 = x_7.injectionSwitch.x; + if ((x_38 > 1.0f)) { + float const x_43 = x_7.injectionSwitch.x; + if ((x_43 > 1.0f)) { + continue; + } else { + continue; + } + continue; + } + return float3(1.0f, 1.0f, 1.0f); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5) { + float3 const x_31 = computeColor_(x_7, tint_symbol_5); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_6 = 0.0f; + main_1(x_7, &(tint_symbol_6)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..d114d3cc5c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.spvasm @@ -0,0 +1,113 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %computeColor_ "computeColor_" + OpName %x_injected_loop_counter "x_injected_loop_counter" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %12 = OpTypeFunction %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %43 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %44 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %45 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out +%computeColor_ = OpFunction %v3float None %12 + %15 = OpLabel +%x_injected_loop_counter = OpVariable %_ptr_Function_int Function %19 + OpStore %x_GLF_color %22 + OpStore %x_injected_loop_counter %int_1 + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %31 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %32 = OpLoad %float %31 + %33 = OpFOrdGreaterThan %bool %32 %float_1 + OpSelectionMerge %35 None + OpBranchConditional %33 %36 %35 + %36 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %38 = OpLoad %float %37 + %39 = OpFOrdGreaterThan %bool %38 %float_1 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %42 + %41 = OpLabel + OpBranch %26 + %42 = OpLabel + OpBranch %26 + %40 = OpLabel + OpBranch %26 + %35 = OpLabel + OpReturnValue %43 + %26 = OpLabel + OpBranch %24 + %25 = OpLabel + OpReturnValue %44 + OpFunctionEnd + %main_1 = OpFunction %void None %45 + %48 = OpLabel + %49 = OpFunctionCall %v3float %computeColor_ + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %50 +%tint_symbol = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %45 + %57 = OpLabel + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_2 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..543e524242 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-continue-statement/0.wgsl.expected.wgsl @@ -0,0 +1,44 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_7 : buf0; + +fn computeColor_() -> vec3 { + var x_injected_loop_counter : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_injected_loop_counter = 1; + loop { + let x_38 : f32 = x_7.injectionSwitch.x; + if ((x_38 > 1.0)) { + let x_43 : f32 = x_7.injectionSwitch.x; + if ((x_43 > 1.0)) { + continue; + } else { + continue; + } + continue; + } + return vec3(1.0, 1.0, 1.0); + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + let x_31 : vec3 = computeColor_(); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm new file mode 100644 index 0000000000..b17f848ec0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm @@ -0,0 +1,90 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %computePoint_ "computePoint(" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %12 = OpTypeFunction %v3float + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %23 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %false = OpConstantFalse %bool + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %30 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %main = OpFunction %void None %9 + %33 = OpLabel + %34 = OpVariable %_ptr_Function_bool Function %false + OpBranch %35 + %35 = OpLabel + %36 = OpFunctionCall %v3float %computePoint_ + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %41 = OpLoad %float %40 + %42 = OpFOrdLessThan %bool %41 %float_0 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpStore %34 %true + OpBranch %37 + %43 = OpLabel + %45 = OpFunctionCall %v3float %computePoint_ + OpStore %_GLF_color %30 + OpStore %34 %true + OpBranch %37 + %38 = OpLabel + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd +%computePoint_ = OpFunction %v3float None %12 + %46 = OpLabel + %47 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %48 = OpLoad %float %47 + %49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %50 = OpLoad %float %49 + %51 = OpFOrdGreaterThan %bool %48 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + OpKill + %52 = OpLabel + %54 = OpUndef %v3float + OpReturnValue %54 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..ccaa9603e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.hlsl @@ -0,0 +1,50 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 computePoint_() { + const float x_48 = asfloat(x_7[0].x); + const float x_50 = asfloat(x_7[0].y); + if ((x_48 > x_50)) { + discard; + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + bool x_34 = false; + while (true) { + const float3 x_36 = computePoint_(); + const float x_41 = gl_FragCoord.x; + if ((x_41 < 0.0f)) { + x_34 = true; + break; + } + const float3 x_45 = computePoint_(); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_34 = true; + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d52c896021 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 computePoint_(constant buf0& x_7) { + float const x_48 = x_7.injectionSwitch.x; + float const x_50 = x_7.injectionSwitch.y; + if ((x_48 > x_50)) { + discard_fragment(); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + bool x_34 = false; + while (true) { + float3 const x_36 = computePoint_(x_7); + float const x_41 = (*(tint_symbol_5)).x; + if ((x_41 < 0.0f)) { + x_34 = true; + break; + } + float3 const x_45 = computePoint_(x_7); + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_34 = true; + break; + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..c4ffa4cc73 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %computePoint_ "computePoint_" + OpName %main_1 "main_1" + OpName %x_34 "x_34" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %v3float = OpTypeVector %float 3 + %15 = OpTypeFunction %v3float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %33 = OpTypeFunction %void + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool +%_ptr_Private_float = OpTypePointer Private %float + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %55 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %56 = OpTypeFunction %void %main_out +%computePoint_ = OpFunction %v3float None %15 + %18 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %23 = OpLoad %float %22 + %25 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %26 = OpLoad %float %25 + %27 = OpFOrdGreaterThan %bool %23 %26 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %29 + %30 = OpLabel + OpKill + %29 = OpLabel + OpReturnValue %32 + OpFunctionEnd + %main_1 = OpFunction %void None %33 + %36 = OpLabel + %x_34 = OpVariable %_ptr_Function_bool Function %40 + OpStore %x_34 %false + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpFunctionCall %v3float %computePoint_ + %47 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %48 = OpLoad %float %47 + %49 = OpFOrdLessThan %bool %48 %float_0 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpStore %x_34 %true + OpBranch %42 + %50 = OpLabel + %53 = OpFunctionCall %v3float %computePoint_ + OpStore %x_GLF_color %55 + OpStore %x_34 %true + OpBranch %42 + %43 = OpLabel + OpBranch %41 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %56 +%tint_symbol_1 = OpFunctionParameter %main_out + %60 = OpLabel + %61 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %61 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %33 + %63 = OpLabel + %64 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %64 + %65 = OpFunctionCall %void %main_1 + %67 = OpLoad %v4float %x_GLF_color + %68 = OpCompositeConstruct %main_out %67 + %66 = OpFunctionCall %void %tint_symbol_3 %68 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..98738010a6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.wgsl @@ -0,0 +1,48 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn computePoint_() -> vec3 { + let x_48 : f32 = x_7.injectionSwitch.x; + let x_50 : f32 = x_7.injectionSwitch.y; + if ((x_48 > x_50)) { + discard; + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + var x_34 : bool = false; + loop { + let x_36 : vec3 = computePoint_(); + let x_41 : f32 = gl_FragCoord.x; + if ((x_41 < 0.0)) { + x_34 = true; + break; + } + let x_45 : vec3 = computePoint_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_34 = true; + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl new file mode 100644 index 0000000000..98738010a6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl @@ -0,0 +1,48 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn computePoint_() -> vec3 { + let x_48 : f32 = x_7.injectionSwitch.x; + let x_50 : f32 = x_7.injectionSwitch.y; + if ((x_48 > x_50)) { + discard; + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + var x_34 : bool = false; + loop { + let x_36 : vec3 = computePoint_(); + let x_41 : f32 = gl_FragCoord.x; + if ((x_41 < 0.0)) { + x_34 = true; + break; + } + let x_45 : vec3 = computePoint_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_34 = true; + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..ccaa9603e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.hlsl @@ -0,0 +1,50 @@ +cbuffer cbuffer_x_7 : register(b0, space0) { + uint4 x_7[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 computePoint_() { + const float x_48 = asfloat(x_7[0].x); + const float x_50 = asfloat(x_7[0].y); + if ((x_48 > x_50)) { + discard; + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1() { + bool x_34 = false; + while (true) { + const float3 x_36 = computePoint_(); + const float x_41 = gl_FragCoord.x; + if ((x_41 < 0.0f)) { + x_34 = true; + break; + } + const float3 x_45 = computePoint_(); + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_34 = true; + break; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d52c896021 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 computePoint_(constant buf0& x_7) { + float const x_48 = x_7.injectionSwitch.x; + float const x_50 = x_7.injectionSwitch.y; + if ((x_48 > x_50)) { + discard_fragment(); + } + return float3(0.0f, 0.0f, 0.0f); +} + +void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + bool x_34 = false; + while (true) { + float3 const x_36 = computePoint_(x_7); + float const x_41 = (*(tint_symbol_5)).x; + if ((x_41 < 0.0f)) { + x_34 = true; + break; + } + float3 const x_45 = computePoint_(x_7); + *(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f); + x_34 = true; + break; + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(x_7, &(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..c4ffa4cc73 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.spvasm @@ -0,0 +1,125 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_7 "x_7" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %computePoint_ "computePoint_" + OpName %main_1 "main_1" + OpName %x_34 "x_34" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_7 NonWritable + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_7 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %9 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %9 + %v3float = OpTypeVector %float 3 + %15 = OpTypeFunction %v3float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %void = OpTypeVoid + %33 = OpTypeFunction %void + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %40 = OpConstantNull %bool +%_ptr_Private_float = OpTypePointer Private %float + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %55 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %56 = OpTypeFunction %void %main_out +%computePoint_ = OpFunction %v3float None %15 + %18 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0 + %23 = OpLoad %float %22 + %25 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1 + %26 = OpLoad %float %25 + %27 = OpFOrdGreaterThan %bool %23 %26 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %29 + %30 = OpLabel + OpKill + %29 = OpLabel + OpReturnValue %32 + OpFunctionEnd + %main_1 = OpFunction %void None %33 + %36 = OpLabel + %x_34 = OpVariable %_ptr_Function_bool Function %40 + OpStore %x_34 %false + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpFunctionCall %v3float %computePoint_ + %47 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %48 = OpLoad %float %47 + %49 = OpFOrdLessThan %bool %48 %float_0 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpStore %x_34 %true + OpBranch %42 + %50 = OpLabel + %53 = OpFunctionCall %v3float %computePoint_ + OpStore %x_GLF_color %55 + OpStore %x_34 %true + OpBranch %42 + %43 = OpLabel + OpBranch %41 + %42 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %56 +%tint_symbol_1 = OpFunctionParameter %main_out + %60 = OpLabel + %61 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %61 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %33 + %63 = OpLabel + %64 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %64 + %65 = OpFunctionCall %void %main_1 + %67 = OpLoad %v4float %x_GLF_color + %68 = OpCompositeConstruct %main_out %67 + %66 = OpFunctionCall %void %tint_symbol_3 %68 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..98738010a6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.wgsl @@ -0,0 +1,48 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_7 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn computePoint_() -> vec3 { + let x_48 : f32 = x_7.injectionSwitch.x; + let x_50 : f32 = x_7.injectionSwitch.y; + if ((x_48 > x_50)) { + discard; + } + return vec3(0.0, 0.0, 0.0); +} + +fn main_1() { + var x_34 : bool = false; + loop { + let x_36 : vec3 = computePoint_(); + let x_41 : f32 = gl_FragCoord.x; + if ((x_41 < 0.0)) { + x_34 = true; + break; + } + let x_45 : vec3 = computePoint_(); + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + x_34 = true; + break; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm new file mode 100644 index 0000000000..f051a44128 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm @@ -0,0 +1,94 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %mand_ "mand(" + OpName %k "k" + OpName %_GLF_color "_GLF_color" + OpName %i "i" + OpDecorate %k RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %i RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %15 = OpTypeFunction %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1000 = OpConstant %int 1000 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %27 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_4 = OpConstant %int 4 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %main = OpFunction %void None %12 + %33 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %27 + OpStore %i %int_0 + OpBranch %34 + %34 = OpLabel + %8 = OpLoad %int %i + %35 = OpSLessThan %bool %8 %int_4 + OpLoopMerge %36 %37 None + OpBranchConditional %35 %37 %36 + %37 = OpLabel + %38 = OpFunctionCall %v3float %mand_ + %9 = OpLoad %int %i + %10 = OpIAdd %int %9 %int_1 + OpStore %i %10 + OpBranch %34 + %36 = OpLabel + OpReturn + OpFunctionEnd + %mand_ = OpFunction %v3float None %15 + %39 = OpLabel + %40 = OpVariable %_ptr_Function_bool Function %false + %41 = OpVariable %_ptr_Function_v3float Function + %k = OpVariable %_ptr_Function_int Function + OpBranch %42 + %42 = OpLabel + OpStore %k %int_0 + OpLoopMerge %43 %44 None + OpBranch %45 + %45 = OpLabel + %7 = OpLoad %int %k + %46 = OpSLessThan %bool %7 %int_1000 + OpLoopMerge %47 %48 None + OpBranchConditional %46 %49 %47 + %49 = OpLabel + OpStore %40 %true + OpStore %41 %22 + OpBranch %47 + %48 = OpLabel + OpBranch %45 + %47 = OpLabel + %50 = OpLoad %bool %40 + OpSelectionMerge %51 None + OpBranchConditional %50 %43 %51 + %51 = OpLabel + OpKill + %44 = OpLabel + OpBranch %42 + %43 = OpLabel + %52 = OpLoad %v3float %41 + OpReturnValue %52 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..a06fe40f57 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.hlsl @@ -0,0 +1,55 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 mand_() { + bool x_40 = false; + float3 x_41 = float3(0.0f, 0.0f, 0.0f); + int k = 0; + while (true) { + k = 0; + while (true) { + if ((k < 1000)) { + } else { + break; + } + x_40 = true; + x_41 = float3(1.0f, 1.0f, 1.0f); + break; + } + if (x_40) { + break; + } + discard; + } + return x_41; +} + +void main_1() { + int i = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + while (true) { + if ((i < 4)) { + } else { + break; + } + { + const float3 x_38 = mand_(); + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.msl new file mode 100644 index 0000000000..73ff170d47 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 mand_() { + bool x_40 = false; + float3 x_41 = 0.0f; + int k = 0; + while (true) { + k = 0; + while (true) { + int const x_7 = k; + if ((x_7 < 1000)) { + } else { + break; + } + x_40 = true; + x_41 = float3(1.0f, 1.0f, 1.0f); + break; + } + bool const x_50 = x_40; + if (x_50) { + break; + } + discard_fragment(); + } + float3 const x_52 = x_41; + return x_52; +} + +void main_1(thread float4* const tint_symbol_4) { + int i = 0; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + while (true) { + int const x_8 = i; + if ((x_8 < 4)) { + } else { + break; + } + { + float3 const x_38 = mand_(); + int const x_9 = i; + i = (x_9 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..422a368074 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %mand_ "mand_" + OpName %x_40 "x_40" + OpName %x_41 "x_41" + OpName %k "k" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %8 = OpTypeFunction %v3float + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %16 = OpConstantNull %bool +%_ptr_Function_v3float = OpTypePointer Function %v3float + %19 = OpConstantNull %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_1000 = OpConstant %int 1000 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %41 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %void = OpTypeVoid + %46 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %52 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_4 = OpConstant %int 4 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %mand_ = OpFunction %v3float None %8 + %11 = OpLabel + %x_40 = OpVariable %_ptr_Function_bool Function %16 + %x_41 = OpVariable %_ptr_Function_v3float Function %19 + %k = OpVariable %_ptr_Function_int Function %23 + OpStore %x_40 %false + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + OpStore %k %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %k + %35 = OpSLessThan %bool %33 %int_1000 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %38 + %37 = OpLabel + OpBranch %36 + %38 = OpLabel + OpBranch %30 + %36 = OpLabel + OpStore %x_40 %true + OpStore %x_41 %41 + OpBranch %30 + %31 = OpLabel + OpBranch %29 + %30 = OpLabel + %42 = OpLoad %bool %x_40 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpBranch %25 + %43 = OpLabel + OpKill + %26 = OpLabel + OpBranch %24 + %25 = OpLabel + %45 = OpLoad %v3float %x_41 + OpReturnValue %45 + OpFunctionEnd + %main_1 = OpFunction %void None %46 + %49 = OpLabel + %i = OpVariable %_ptr_Function_int Function %23 + OpStore %x_GLF_color %52 + OpStore %i %int_0 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %int %i + %59 = OpSLessThan %bool %57 %int_4 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %54 + %60 = OpLabel + OpBranch %55 + %55 = OpLabel + %63 = OpFunctionCall %v3float %mand_ + %64 = OpLoad %int %i + %66 = OpIAdd %int %64 %int_1 + OpStore %i %66 + OpBranch %53 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %46 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..5ad0b89c81 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.spvasm.expected.wgsl @@ -0,0 +1,58 @@ +var x_GLF_color : vec4; + +fn mand_() -> vec3 { + var x_40 : bool = false; + var x_41 : vec3; + var k : i32; + loop { + k = 0; + loop { + let x_7 : i32 = k; + if ((x_7 < 1000)) { + } else { + break; + } + x_40 = true; + x_41 = vec3(1.0, 1.0, 1.0); + break; + } + let x_50 : bool = x_40; + if (x_50) { + break; + } + discard; + } + let x_52 : vec3 = x_41; + return x_52; +} + +fn main_1() { + var i : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + loop { + let x_8 : i32 = i; + if ((x_8 < 4)) { + } else { + break; + } + + continuing { + let x_38 : vec3 = mand_(); + let x_9 : i32 = i; + i = (x_9 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl new file mode 100644 index 0000000000..5ad0b89c81 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl @@ -0,0 +1,58 @@ +var x_GLF_color : vec4; + +fn mand_() -> vec3 { + var x_40 : bool = false; + var x_41 : vec3; + var k : i32; + loop { + k = 0; + loop { + let x_7 : i32 = k; + if ((x_7 < 1000)) { + } else { + break; + } + x_40 = true; + x_41 = vec3(1.0, 1.0, 1.0); + break; + } + let x_50 : bool = x_40; + if (x_50) { + break; + } + discard; + } + let x_52 : vec3 = x_41; + return x_52; +} + +fn main_1() { + var i : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + loop { + let x_8 : i32 = i; + if ((x_8 < 4)) { + } else { + break; + } + + continuing { + let x_38 : vec3 = mand_(); + let x_9 : i32 = i; + i = (x_9 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..a06fe40f57 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.hlsl @@ -0,0 +1,55 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float3 mand_() { + bool x_40 = false; + float3 x_41 = float3(0.0f, 0.0f, 0.0f); + int k = 0; + while (true) { + k = 0; + while (true) { + if ((k < 1000)) { + } else { + break; + } + x_40 = true; + x_41 = float3(1.0f, 1.0f, 1.0f); + break; + } + if (x_40) { + break; + } + discard; + } + return x_41; +} + +void main_1() { + int i = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + while (true) { + if ((i < 4)) { + } else { + break; + } + { + const float3 x_38 = mand_(); + i = (i + 1); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.msl new file mode 100644 index 0000000000..73ff170d47 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.msl @@ -0,0 +1,63 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float3 mand_() { + bool x_40 = false; + float3 x_41 = 0.0f; + int k = 0; + while (true) { + k = 0; + while (true) { + int const x_7 = k; + if ((x_7 < 1000)) { + } else { + break; + } + x_40 = true; + x_41 = float3(1.0f, 1.0f, 1.0f); + break; + } + bool const x_50 = x_40; + if (x_50) { + break; + } + discard_fragment(); + } + float3 const x_52 = x_41; + return x_52; +} + +void main_1(thread float4* const tint_symbol_4) { + int i = 0; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + while (true) { + int const x_8 = i; + if ((x_8 < 4)) { + } else { + break; + } + { + float3 const x_38 = mand_(); + int const x_9 = i; + i = (x_9 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..422a368074 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.spvasm @@ -0,0 +1,144 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 79 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %mand_ "mand_" + OpName %x_40 "x_40" + OpName %x_41 "x_41" + OpName %k "k" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %v3float = OpTypeVector %float 3 + %8 = OpTypeFunction %v3float + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %16 = OpConstantNull %bool +%_ptr_Function_v3float = OpTypePointer Function %v3float + %19 = OpConstantNull %v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %int_0 = OpConstant %int 0 + %int_1000 = OpConstant %int 1000 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %41 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %void = OpTypeVoid + %46 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %52 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_4 = OpConstant %int 4 + %int_1 = OpConstant %int 1 + %main_out = OpTypeStruct %v4float + %67 = OpTypeFunction %void %main_out + %mand_ = OpFunction %v3float None %8 + %11 = OpLabel + %x_40 = OpVariable %_ptr_Function_bool Function %16 + %x_41 = OpVariable %_ptr_Function_v3float Function %19 + %k = OpVariable %_ptr_Function_int Function %23 + OpStore %x_40 %false + OpBranch %24 + %24 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + OpStore %k %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %int %k + %35 = OpSLessThan %bool %33 %int_1000 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %38 + %37 = OpLabel + OpBranch %36 + %38 = OpLabel + OpBranch %30 + %36 = OpLabel + OpStore %x_40 %true + OpStore %x_41 %41 + OpBranch %30 + %31 = OpLabel + OpBranch %29 + %30 = OpLabel + %42 = OpLoad %bool %x_40 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpBranch %25 + %43 = OpLabel + OpKill + %26 = OpLabel + OpBranch %24 + %25 = OpLabel + %45 = OpLoad %v3float %x_41 + OpReturnValue %45 + OpFunctionEnd + %main_1 = OpFunction %void None %46 + %49 = OpLabel + %i = OpVariable %_ptr_Function_int Function %23 + OpStore %x_GLF_color %52 + OpStore %i %int_0 + OpBranch %53 + %53 = OpLabel + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %57 = OpLoad %int %i + %59 = OpSLessThan %bool %57 %int_4 + OpSelectionMerge %60 None + OpBranchConditional %59 %61 %62 + %61 = OpLabel + OpBranch %60 + %62 = OpLabel + OpBranch %54 + %60 = OpLabel + OpBranch %55 + %55 = OpLabel + %63 = OpFunctionCall %v3float %mand_ + %64 = OpLoad %int %i + %66 = OpIAdd %int %64 %int_1 + OpStore %i %66 + OpBranch %53 + %54 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %67 +%tint_symbol = OpFunctionParameter %main_out + %71 = OpLabel + %72 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %72 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %46 + %74 = OpLabel + %75 = OpFunctionCall %void %main_1 + %77 = OpLoad %v4float %x_GLF_color + %78 = OpCompositeConstruct %main_out %77 + %76 = OpFunctionCall %void %tint_symbol_2 %78 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..5ad0b89c81 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement/0.wgsl.expected.wgsl @@ -0,0 +1,58 @@ +var x_GLF_color : vec4; + +fn mand_() -> vec3 { + var x_40 : bool = false; + var x_41 : vec3; + var k : i32; + loop { + k = 0; + loop { + let x_7 : i32 = k; + if ((x_7 < 1000)) { + } else { + break; + } + x_40 = true; + x_41 = vec3(1.0, 1.0, 1.0); + break; + } + let x_50 : bool = x_40; + if (x_50) { + break; + } + discard; + } + let x_52 : vec3 = x_41; + return x_52; +} + +fn main_1() { + var i : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + loop { + let x_8 : i32 = i; + if ((x_8 < 4)) { + } else { + break; + } + + continuing { + let x_38 : vec3 = mand_(); + let x_9 : i32 = i; + i = (x_9 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm new file mode 100644 index 0000000000..5791da8cf2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm @@ -0,0 +1,116 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %i "i" + OpName %data "data" + OpDecorate %_GLF_color Location 0 + OpDecorate %i RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %10 RelaxedPrecision + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Function__arr_float_uint_1 = OpTypePointer Function %_arr_float_uint_1 +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %float_2 = OpConstant %float 2 + %main = OpFunction %void None %12 + %32 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %data = OpVariable %_ptr_Function__arr_float_uint_1 Function + OpStore %_GLF_color %18 + OpStore %i %int_0 + OpBranch %33 + %33 = OpLabel + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %6 = OpLoad %int %i + %37 = OpSLessThan %bool %6 %int_1 + OpBranchConditional %37 %38 %34 + %38 = OpLabel + %7 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Function_float %data %7 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Function_float %data %int_0 + %42 = OpLoad %float %41 + %43 = OpFOrdLessThan %bool %40 %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + OpSelectionMerge %46 None + OpBranchConditional %false %47 %46 + %47 = OpLabel + %8 = OpLoad %int %i + %48 = OpConvertSToF %float %8 + %49 = OpFOrdGreaterThanEqual %bool %48 %float_1 + OpSelectionMerge %50 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpBranch %50 + %50 = OpLabel + OpBranch %46 + %46 = OpLabel + OpSelectionMerge %52 None + OpSwitch %int_0 %52 1 %53 0 %54 + %53 = OpLabel + OpBranch %55 + %55 = OpLabel + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + OpBranchConditional %true %59 %56 + %59 = OpLabel + OpBranch %57 + %57 = OpLabel + OpBranch %55 + %56 = OpLabel + OpBranch %60 + %60 = OpLabel + OpLoopMerge %61 %62 None + OpBranch %63 + %63 = OpLabel + OpBranch %62 + %62 = OpLabel + OpBranch %60 + %61 = OpLabel + OpBranch %54 + %54 = OpLabel + %64 = OpAccessChain %_ptr_Function_float %data %int_0 + OpStore %64 %float_2 + OpBranch %52 + %52 = OpLabel + OpBranch %44 + %44 = OpLabel + OpBranch %35 + %35 = OpLabel + %9 = OpLoad %int %i + %10 = OpIAdd %int %9 %int_1 + OpStore %i %10 + OpBranch %33 + %34 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..49336f598e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.hlsl @@ -0,0 +1,55 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + float data[1] = (float[1])0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + { + for(; (i < 1); i = (i + 1)) { + const float x_40 = data[i]; + const float x_42 = data[0]; + if ((x_40 < x_42)) { + if (false) { + if ((float(i) >= 1.0f)) { + } + } + switch(0) { + case 1: { + while (true) { + if (true) { + } else { + break; + } + } + while (true) { + } + /* fallthrough */ + } + case 0: { + data[0] = 2.0f; + break; + } + default: { + break; + } + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.msl new file mode 100644 index 0000000000..cc9b3ff154 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.msl @@ -0,0 +1,70 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + float arr[1]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int i = 0; + tint_array_wrapper data = {}; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + while (true) { + int const x_6 = i; + if ((x_6 < 1)) { + } else { + break; + } + int const x_7 = i; + float const x_40 = data.arr[x_7]; + float const x_42 = data.arr[0]; + if ((x_40 < x_42)) { + if (false) { + int const x_8 = i; + if ((float(x_8) >= 1.0f)) { + } + } + switch(0) { + case 1: { + while (true) { + if (true) { + } else { + break; + } + } + while (true) { + } + /* fallthrough */ + } + case 0: { + data.arr[0] = 2.0f; + break; + } + default: { + break; + } + } + } + { + int const x_9 = i; + i = (x_9 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..74f2106bc6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.spvasm @@ -0,0 +1,155 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 86 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %data "data" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_1 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Function__arr_float_uint_1 = OpTypePointer Function %_arr_float_uint_1 + %21 = OpConstantNull %_arr_float_uint_1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %float_2 = OpConstant %float 2 + %main_out = OpTypeStruct %v4float + %74 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %i = OpVariable %_ptr_Function_int Function %15 + %data = OpVariable %_ptr_Function__arr_float_uint_1 Function %21 + OpStore %x_GLF_color %24 + OpStore %i %int_0 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %i + %32 = OpSLessThan %bool %30 %int_1 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + OpBranch %34 + %36 = OpLabel + OpBranch %27 + %34 = OpLabel + %37 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Function_float %data %37 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Function_float %data %int_0 + %42 = OpLoad %float %41 + %43 = OpFOrdLessThan %bool %40 %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + OpSelectionMerge %47 None + OpBranchConditional %false %48 %47 + %48 = OpLabel + %49 = OpLoad %int %i + %50 = OpConvertSToF %float %49 + %51 = OpFOrdGreaterThanEqual %bool %50 %float_1 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + OpBranch %52 + %52 = OpLabel + OpBranch %47 + %47 = OpLabel + OpSelectionMerge %54 None + OpSwitch %int_0 %55 1 %56 0 %57 + %56 = OpLabel + OpBranch %58 + %58 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + OpSelectionMerge %63 None + OpBranchConditional %true %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %59 + %63 = OpLabel + OpBranch %60 + %60 = OpLabel + OpBranch %58 + %59 = OpLabel + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + OpBranch %68 + %68 = OpLabel + OpBranch %66 + %67 = OpLabel + OpBranch %57 + %57 = OpLabel + %70 = OpAccessChain %_ptr_Function_float %data %int_0 + OpStore %70 %float_2 + OpBranch %54 + %55 = OpLabel + OpBranch %54 + %54 = OpLabel + OpBranch %44 + %44 = OpLabel + OpBranch %28 + %28 = OpLabel + %72 = OpLoad %int %i + %73 = OpIAdd %int %72 %int_1 + OpStore %i %73 + OpBranch %26 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %74 +%tint_symbol = OpFunctionParameter %main_out + %78 = OpLabel + %79 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %79 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %81 = OpLabel + %82 = OpFunctionCall %void %main_1 + %84 = OpLoad %v4float %x_GLF_color + %85 = OpCompositeConstruct %main_out %84 + %83 = OpFunctionCall %void %tint_symbol_2 %85 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..27a00c6bb0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.wgsl @@ -0,0 +1,60 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var data : array; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + loop { + let x_6 : i32 = i; + if ((x_6 < 1)) { + } else { + break; + } + let x_7 : i32 = i; + let x_40 : f32 = data[x_7]; + let x_42 : f32 = data[0]; + if ((x_40 < x_42)) { + if (false) { + let x_8 : i32 = i; + if ((f32(x_8) >= 1.0)) { + } + } + switch(0) { + case 1: { + loop { + if (true) { + } else { + break; + } + } + loop { + } + fallthrough; + } + case 0: { + data[0] = 2.0; + } + default: { + } + } + } + + continuing { + let x_9 : i32 = i; + i = (x_9 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl new file mode 100644 index 0000000000..27a00c6bb0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl @@ -0,0 +1,60 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var data : array; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + loop { + let x_6 : i32 = i; + if ((x_6 < 1)) { + } else { + break; + } + let x_7 : i32 = i; + let x_40 : f32 = data[x_7]; + let x_42 : f32 = data[0]; + if ((x_40 < x_42)) { + if (false) { + let x_8 : i32 = i; + if ((f32(x_8) >= 1.0)) { + } + } + switch(0) { + case 1: { + loop { + if (true) { + } else { + break; + } + } + loop { + } + fallthrough; + } + case 0: { + data[0] = 2.0; + } + default: { + } + } + } + + continuing { + let x_9 : i32 = i; + i = (x_9 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..49336f598e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.hlsl @@ -0,0 +1,55 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int i = 0; + float data[1] = (float[1])0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + { + for(; (i < 1); i = (i + 1)) { + const float x_40 = data[i]; + const float x_42 = data[0]; + if ((x_40 < x_42)) { + if (false) { + if ((float(i) >= 1.0f)) { + } + } + switch(0) { + case 1: { + while (true) { + if (true) { + } else { + break; + } + } + while (true) { + } + /* fallthrough */ + } + case 0: { + data[0] = 2.0f; + break; + } + default: { + break; + } + } + } + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.msl new file mode 100644 index 0000000000..cc9b3ff154 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.msl @@ -0,0 +1,70 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + float arr[1]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + int i = 0; + tint_array_wrapper data = {}; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + i = 0; + while (true) { + int const x_6 = i; + if ((x_6 < 1)) { + } else { + break; + } + int const x_7 = i; + float const x_40 = data.arr[x_7]; + float const x_42 = data.arr[0]; + if ((x_40 < x_42)) { + if (false) { + int const x_8 = i; + if ((float(x_8) >= 1.0f)) { + } + } + switch(0) { + case 1: { + while (true) { + if (true) { + } else { + break; + } + } + while (true) { + } + /* fallthrough */ + } + case 0: { + data.arr[0] = 2.0f; + break; + } + default: { + break; + } + } + } + { + int const x_9 = i; + i = (x_9 + 1); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..74f2106bc6 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.spvasm @@ -0,0 +1,155 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 86 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %i "i" + OpName %data "data" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_1 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %15 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Function__arr_float_uint_1 = OpTypePointer Function %_arr_float_uint_1 + %21 = OpConstantNull %_arr_float_uint_1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %float_2 = OpConstant %float 2 + %main_out = OpTypeStruct %v4float + %74 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %i = OpVariable %_ptr_Function_int Function %15 + %data = OpVariable %_ptr_Function__arr_float_uint_1 Function %21 + OpStore %x_GLF_color %24 + OpStore %i %int_0 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %i + %32 = OpSLessThan %bool %30 %int_1 + OpSelectionMerge %34 None + OpBranchConditional %32 %35 %36 + %35 = OpLabel + OpBranch %34 + %36 = OpLabel + OpBranch %27 + %34 = OpLabel + %37 = OpLoad %int %i + %39 = OpAccessChain %_ptr_Function_float %data %37 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Function_float %data %int_0 + %42 = OpLoad %float %41 + %43 = OpFOrdLessThan %bool %40 %42 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %44 + %45 = OpLabel + OpSelectionMerge %47 None + OpBranchConditional %false %48 %47 + %48 = OpLabel + %49 = OpLoad %int %i + %50 = OpConvertSToF %float %49 + %51 = OpFOrdGreaterThanEqual %bool %50 %float_1 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + OpBranch %52 + %52 = OpLabel + OpBranch %47 + %47 = OpLabel + OpSelectionMerge %54 None + OpSwitch %int_0 %55 1 %56 0 %57 + %56 = OpLabel + OpBranch %58 + %58 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + OpSelectionMerge %63 None + OpBranchConditional %true %64 %65 + %64 = OpLabel + OpBranch %63 + %65 = OpLabel + OpBranch %59 + %63 = OpLabel + OpBranch %60 + %60 = OpLabel + OpBranch %58 + %59 = OpLabel + OpBranch %66 + %66 = OpLabel + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + OpBranch %68 + %68 = OpLabel + OpBranch %66 + %67 = OpLabel + OpBranch %57 + %57 = OpLabel + %70 = OpAccessChain %_ptr_Function_float %data %int_0 + OpStore %70 %float_2 + OpBranch %54 + %55 = OpLabel + OpBranch %54 + %54 = OpLabel + OpBranch %44 + %44 = OpLabel + OpBranch %28 + %28 = OpLabel + %72 = OpLoad %int %i + %73 = OpIAdd %int %72 %int_1 + OpStore %i %73 + OpBranch %26 + %27 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %74 +%tint_symbol = OpFunctionParameter %main_out + %78 = OpLabel + %79 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %79 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %81 = OpLabel + %82 = OpFunctionCall %void %main_1 + %84 = OpLoad %v4float %x_GLF_color + %85 = OpCompositeConstruct %main_out %84 + %83 = OpFunctionCall %void %tint_symbol_2 %85 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..27a00c6bb0 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.wgsl @@ -0,0 +1,60 @@ +var x_GLF_color : vec4; + +fn main_1() { + var i : i32; + var data : array; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + i = 0; + loop { + let x_6 : i32 = i; + if ((x_6 < 1)) { + } else { + break; + } + let x_7 : i32 = i; + let x_40 : f32 = data[x_7]; + let x_42 : f32 = data[0]; + if ((x_40 < x_42)) { + if (false) { + let x_8 : i32 = i; + if ((f32(x_8) >= 1.0)) { + } + } + switch(0) { + case 1: { + loop { + if (true) { + } else { + break; + } + } + loop { + } + fallthrough; + } + case 0: { + data[0] = 2.0; + } + default: { + } + } + } + + continuing { + let x_9 : i32 = i; + i = (x_9 + 1); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm new file mode 100644 index 0000000000..66d7a31240 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm @@ -0,0 +1,80 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injected" + OpName %_ "" + OpName %m "m" + OpDecorate %_GLF_color Location 0 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %m RelaxedPrecision + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %14 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Function_int = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool + %main = OpFunction %void None %8 + %28 = OpLabel + %m = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %14 + %29 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %30 = OpLoad %float %29 + %31 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %32 = OpLoad %float %31 + %33 = OpFOrdGreaterThan %bool %30 %32 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + OpBranch %38 + %38 = OpLabel + OpBranchConditional %false %36 %37 + %37 = OpLabel + OpStore %m %int_1 + OpBranch %40 + %40 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + OpBranchConditional %true %44 %41 + %44 = OpLabel + OpStore %_GLF_color %14 + OpBranch %42 + %42 = OpLabel + OpBranch %40 + %41 = OpLabel + OpBranch %34 + %34 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.hlsl new file mode 100755 index 0000000000..807cb12bf5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.hlsl @@ -0,0 +1,52 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + int m = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_30 = asfloat(x_5[0].x); + const float x_32 = asfloat(x_5[0].y); + if ((x_30 > x_32)) { + while (true) { + { + if (false) { + } else { + break; + } + } + } + m = 1; + while (true) { + if (true) { + } else { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} +error: validation errors +T:\tmp\u8hw.0:39: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..da051cdb0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.msl @@ -0,0 +1,47 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injected; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int m = 0; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + float const x_30 = x_5.injected.x; + float const x_32 = x_5.injected.y; + if ((x_30 > x_32)) { + while (true) { + { + if (false) { + } else { + break; + } + } + } + m = 1; + while (true) { + if (true) { + } else { + break; + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..65afab8bbc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.spvasm @@ -0,0 +1,127 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injected" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %52 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %m = OpVariable %_ptr_Function_int Function %19 + OpStore %x_GLF_color %22 + %26 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %27 = OpLoad %float %26 + %29 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %30 = OpLoad %float %29 + %31 = OpFOrdGreaterThan %bool %27 %30 + OpSelectionMerge %33 None + OpBranchConditional %31 %34 %33 + %34 = OpLabel + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %40 None + OpBranchConditional %false %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %36 + %40 = OpLabel + OpBranch %35 + %36 = OpLabel + OpStore %m %int_1 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + OpSelectionMerge %49 None + OpBranchConditional %true %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %45 + %49 = OpLabel + OpStore %x_GLF_color %22 + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %52 +%tint_symbol = OpFunctionParameter %main_out + %56 = OpLabel + %57 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %57 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %59 = OpLabel + %60 = OpFunctionCall %void %main_1 + %62 = OpLoad %v4float %x_GLF_color + %63 = OpCompositeConstruct %main_out %62 + %61 = OpFunctionCall %void %tint_symbol_2 %63 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 37[%37] is not post dominated by the back-edge block 40[%40] + %40 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..204bbaec7c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.wgsl @@ -0,0 +1,46 @@ +[[block]] +struct buf0 { + injected : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var m : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_30 : f32 = x_5.injected.x; + let x_32 : f32 = x_5.injected.y; + if ((x_30 > x_32)) { + loop { + + continuing { + if (false) { + } else { + break; + } + } + } + m = 1; + loop { + if (true) { + } else { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl new file mode 100644 index 0000000000..204bbaec7c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl @@ -0,0 +1,46 @@ +[[block]] +struct buf0 { + injected : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var m : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_30 : f32 = x_5.injected.x; + let x_32 : f32 = x_5.injected.y; + if ((x_30 > x_32)) { + loop { + + continuing { + if (false) { + } else { + break; + } + } + } + m = 1; + loop { + if (true) { + } else { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.hlsl new file mode 100755 index 0000000000..a35bdfcb53 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.hlsl @@ -0,0 +1,52 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_5 : register(b0, space0) { + uint4 x_5[1]; +}; + +void main_1() { + int m = 0; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + const float x_30 = asfloat(x_5[0].x); + const float x_32 = asfloat(x_5[0].y); + if ((x_30 > x_32)) { + while (true) { + { + if (false) { + } else { + break; + } + } + } + m = 1; + while (true) { + if (true) { + } else { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} +error: validation errors +T:\tmp\u7ck.0:39: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..da051cdb0d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.msl @@ -0,0 +1,47 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injected; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) { + int m = 0; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + float const x_30 = x_5.injected.x; + float const x_32 = x_5.injected.y; + if ((x_30 > x_32)) { + while (true) { + { + if (false) { + } else { + break; + } + } + } + m = 1; + while (true) { + if (true) { + } else { + break; + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_5, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..65afab8bbc --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.spvasm @@ -0,0 +1,127 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injected" + OpName %x_5 "x_5" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m "m" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_5 NonWritable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_5 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %int_1 = OpConstant %int 1 + %true = OpConstantTrue %bool + %main_out = OpTypeStruct %v4float + %52 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %m = OpVariable %_ptr_Function_int Function %19 + OpStore %x_GLF_color %22 + %26 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_0 + %27 = OpLoad %float %26 + %29 = OpAccessChain %_ptr_Uniform_float %x_5 %uint_0 %uint_1 + %30 = OpLoad %float %29 + %31 = OpFOrdGreaterThan %bool %27 %30 + OpSelectionMerge %33 None + OpBranchConditional %31 %34 %33 + %34 = OpLabel + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + OpBranch %37 + %37 = OpLabel + OpSelectionMerge %40 None + OpBranchConditional %false %41 %42 + %41 = OpLabel + OpBranch %40 + %42 = OpLabel + OpBranch %36 + %40 = OpLabel + OpBranch %35 + %36 = OpLabel + OpStore %m %int_1 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + OpSelectionMerge %49 None + OpBranchConditional %true %50 %51 + %50 = OpLabel + OpBranch %49 + %51 = OpLabel + OpBranch %45 + %49 = OpLabel + OpStore %x_GLF_color %22 + OpBranch %46 + %46 = OpLabel + OpBranch %44 + %45 = OpLabel + OpBranch %33 + %33 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %52 +%tint_symbol = OpFunctionParameter %main_out + %56 = OpLabel + %57 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %57 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %59 = OpLabel + %60 = OpFunctionCall %void %main_1 + %62 = OpLoad %v4float %x_GLF_color + %63 = OpCompositeConstruct %main_out %62 + %61 = OpFunctionCall %void %tint_symbol_2 %63 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 37[%37] is not post dominated by the back-edge block 40[%40] + %40 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..204bbaec7c --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.wgsl @@ -0,0 +1,46 @@ +[[block]] +struct buf0 { + injected : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_5 : buf0; + +fn main_1() { + var m : i32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_30 : f32 = x_5.injected.x; + let x_32 : f32 = x_5.injected.y; + if ((x_30 > x_32)) { + loop { + + continuing { + if (false) { + } else { + break; + } + } + } + m = 1; + loop { + if (true) { + } else { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm new file mode 100644 index 0000000000..4ec26d60af --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm @@ -0,0 +1,53 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %15 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %18 = OpUndef %bool + %main = OpFunction %void None %5 + %19 = OpLabel + OpBranch %20 + %20 = OpLabel + %21 = OpPhi %bool %false %19 %18 %22 + OpLoopMerge %23 %22 None + OpBranch %24 + %24 = OpLabel + %25 = OpPhi %bool %21 %20 %18 %26 + %27 = OpSLessThan %bool %int_1 %int_0 + OpLoopMerge %28 %26 None + OpBranchConditional %27 %29 %28 + %29 = OpLabel + OpBranch %28 + %26 = OpLabel + OpBranch %24 + %28 = OpLabel + %30 = OpPhi %bool %25 %24 %true %29 + OpSelectionMerge %31 None + OpBranchConditional %30 %23 %31 + %31 = OpLabel + OpStore %_GLF_color %15 + OpBranch %23 + %22 = OpLabel + OpBranch %20 + %23 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.hlsl new file mode 100755 index 0000000000..423d10190b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.hlsl @@ -0,0 +1,52 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_21_phi = false; + x_21_phi = false; + while (true) { + bool x_25 = false; + bool x_25_phi = false; + bool x_30_phi = false; + x_25_phi = x_21_phi; + while (true) { + x_25 = x_25_phi; + x_30_phi = x_25; + if ((1 < 0)) { + } else { + break; + } + x_30_phi = true; + break; + { + x_25_phi = false; + } + } + if (x_30_phi) { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + { + x_21_phi = false; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} +Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.msl new file mode 100644 index 0000000000..1daa9605c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.msl @@ -0,0 +1,53 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool x_21_phi = false; + x_21_phi = false; + while (true) { + bool x_25 = false; + bool x_25_phi = false; + bool x_30_phi = false; + bool const x_21 = x_21_phi; + x_25_phi = x_21; + while (true) { + x_25 = x_25_phi; + x_30_phi = x_25; + if ((1 < 0)) { + } else { + break; + } + x_30_phi = true; + break; + { + x_25_phi = false; + } + } + bool const x_30 = x_30_phi; + if (x_30) { + break; + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + { + x_21_phi = false; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..335fc7b71d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.spvasm @@ -0,0 +1,111 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_21_phi "x_21_phi" + OpName %x_25 "x_25" + OpName %x_25_phi "x_25_phi" + OpName %x_30_phi "x_30_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %15 = OpConstantNull %bool + %false = OpConstantFalse %bool + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %45 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %x_21_phi = OpVariable %_ptr_Function_bool Function %15 + %x_25 = OpVariable %_ptr_Function_bool Function %15 + %x_25_phi = OpVariable %_ptr_Function_bool Function %15 + %x_30_phi = OpVariable %_ptr_Function_bool Function %15 + OpStore %x_21_phi %false + OpBranch %17 + %17 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %24 = OpLoad %bool %x_21_phi + OpStore %x_25_phi %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %bool %x_25_phi + OpStore %x_25 %29 + %30 = OpLoad %bool %x_25 + OpStore %x_30_phi %30 + %34 = OpSLessThan %bool %int_1 %int_0 + OpSelectionMerge %35 None + OpBranchConditional %34 %36 %37 + %36 = OpLabel + OpBranch %35 + %37 = OpLabel + OpBranch %26 + %35 = OpLabel + OpStore %x_30_phi %true + OpBranch %26 + %27 = OpLabel + OpStore %x_25_phi %false + OpBranch %25 + %26 = OpLabel + %39 = OpLoad %bool %x_30_phi + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + OpBranch %18 + %40 = OpLabel + OpStore %x_GLF_color %44 + OpBranch %18 + %19 = OpLabel + OpStore %x_21_phi %false + OpBranch %17 + %18 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %45 +%tint_symbol = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %52 = OpLabel + %53 = OpFunctionCall %void %main_1 + %55 = OpLoad %v4float %x_GLF_color + %56 = OpCompositeConstruct %main_out %55 + %54 = OpFunctionCall %void %tint_symbol_2 %56 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..005fa198de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.wgsl @@ -0,0 +1,49 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x_21_phi : bool; + x_21_phi = false; + loop { + var x_25 : bool; + var x_25_phi : bool; + var x_30_phi : bool; + let x_21 : bool = x_21_phi; + x_25_phi = x_21; + loop { + x_25 = x_25_phi; + x_30_phi = x_25; + if ((1 < 0)) { + } else { + break; + } + x_30_phi = true; + break; + + continuing { + x_25_phi = false; + } + } + let x_30 : bool = x_30_phi; + if (x_30) { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + + continuing { + x_21_phi = false; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl new file mode 100644 index 0000000000..005fa198de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl @@ -0,0 +1,49 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x_21_phi : bool; + x_21_phi = false; + loop { + var x_25 : bool; + var x_25_phi : bool; + var x_30_phi : bool; + let x_21 : bool = x_21_phi; + x_25_phi = x_21; + loop { + x_25 = x_25_phi; + x_30_phi = x_25; + if ((1 < 0)) { + } else { + break; + } + x_30_phi = true; + break; + + continuing { + x_25_phi = false; + } + } + let x_30 : bool = x_30_phi; + if (x_30) { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + + continuing { + x_21_phi = false; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.hlsl new file mode 100755 index 0000000000..423d10190b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.hlsl @@ -0,0 +1,52 @@ +SKIP: FAILED + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool x_21_phi = false; + x_21_phi = false; + while (true) { + bool x_25 = false; + bool x_25_phi = false; + bool x_30_phi = false; + x_25_phi = x_21_phi; + while (true) { + x_25 = x_25_phi; + x_30_phi = x_25; + if ((1 < 0)) { + } else { + break; + } + x_30_phi = true; + break; + { + x_25_phi = false; + } + } + if (x_30_phi) { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + { + x_21_phi = false; + } + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} +Internal compiler error: access violation. Attempted to read from address 0x0000000000000048 + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.msl new file mode 100644 index 0000000000..1daa9605c4 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.msl @@ -0,0 +1,53 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool x_21_phi = false; + x_21_phi = false; + while (true) { + bool x_25 = false; + bool x_25_phi = false; + bool x_30_phi = false; + bool const x_21 = x_21_phi; + x_25_phi = x_21; + while (true) { + x_25 = x_25_phi; + x_30_phi = x_25; + if ((1 < 0)) { + } else { + break; + } + x_30_phi = true; + break; + { + x_25_phi = false; + } + } + bool const x_30 = x_30_phi; + if (x_30) { + break; + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + { + x_21_phi = false; + } + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..335fc7b71d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.spvasm @@ -0,0 +1,111 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %x_21_phi "x_21_phi" + OpName %x_25 "x_25" + OpName %x_25_phi "x_25_phi" + OpName %x_30_phi "x_30_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %15 = OpConstantNull %bool + %false = OpConstantFalse %bool + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %45 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %x_21_phi = OpVariable %_ptr_Function_bool Function %15 + %x_25 = OpVariable %_ptr_Function_bool Function %15 + %x_25_phi = OpVariable %_ptr_Function_bool Function %15 + %x_30_phi = OpVariable %_ptr_Function_bool Function %15 + OpStore %x_21_phi %false + OpBranch %17 + %17 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %24 = OpLoad %bool %x_21_phi + OpStore %x_25_phi %24 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %bool %x_25_phi + OpStore %x_25 %29 + %30 = OpLoad %bool %x_25 + OpStore %x_30_phi %30 + %34 = OpSLessThan %bool %int_1 %int_0 + OpSelectionMerge %35 None + OpBranchConditional %34 %36 %37 + %36 = OpLabel + OpBranch %35 + %37 = OpLabel + OpBranch %26 + %35 = OpLabel + OpStore %x_30_phi %true + OpBranch %26 + %27 = OpLabel + OpStore %x_25_phi %false + OpBranch %25 + %26 = OpLabel + %39 = OpLoad %bool %x_30_phi + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + OpBranch %18 + %40 = OpLabel + OpStore %x_GLF_color %44 + OpBranch %18 + %19 = OpLabel + OpStore %x_21_phi %false + OpBranch %17 + %18 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %45 +%tint_symbol = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %52 = OpLabel + %53 = OpFunctionCall %void %main_1 + %55 = OpLoad %v4float %x_GLF_color + %56 = OpCompositeConstruct %main_out %55 + %54 = OpFunctionCall %void %tint_symbol_2 %56 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..005fa198de --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.wgsl @@ -0,0 +1,49 @@ +var x_GLF_color : vec4; + +fn main_1() { + var x_21_phi : bool; + x_21_phi = false; + loop { + var x_25 : bool; + var x_25_phi : bool; + var x_30_phi : bool; + let x_21 : bool = x_21_phi; + x_25_phi = x_21; + loop { + x_25 = x_25_phi; + x_30_phi = x_25; + if ((1 < 0)) { + } else { + break; + } + x_30_phi = true; + break; + + continuing { + x_25_phi = false; + } + } + let x_30 : bool = x_30_phi; + if (x_30) { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + + continuing { + x_21_phi = false; + } + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm new file mode 100644 index 0000000000..7284b6b501 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm @@ -0,0 +1,74 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %c1 "c1" + OpName %uv "uv" + OpName %i "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %i RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + OpDecorate %9 RelaxedPrecision + %void = OpTypeVoid + %11 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %30 = OpUndef %int + %31 = OpUndef %bool + %main = OpFunction %void None %11 + %32 = OpLabel + %c1 = OpVariable %_ptr_Function_bool Function + %uv = OpVariable %_ptr_Function_v2float Function + %i = OpVariable %_ptr_Function_int Function + %33 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %34 = OpLoad %float %33 + %35 = OpFOrdLessThan %bool %34 %float_0_25 + OpStore %c1 %35 + OpStore %i %int_0 + OpBranch %36 + %36 = OpLabel + %37 = OpPhi %bool %35 %32 %31 %38 + %9 = OpPhi %int %int_0 %32 %30 %38 + OpLoopMerge %39 %38 None + OpBranch %40 + %40 = OpLabel + %41 = OpSLessThan %bool %9 %int_1 + OpBranchConditional %41 %42 %39 + %42 = OpLabel + OpStore %_GLF_color %29 + OpReturn + %38 = OpLabel + %7 = OpLoad %int %i + %8 = OpIAdd %int %7 %int_1 + OpStore %i %8 + OpBranch %36 + %39 = OpLabel + OpSelectionMerge %43 None + OpBranchConditional %37 %44 %43 + %44 = OpLabel + OpReturn + %43 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..49c10a453a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.hlsl @@ -0,0 +1,48 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool c1 = false; + float2 uv = float2(0.0f, 0.0f); + int i = 0; + bool x_37 = false; + bool x_37_phi = false; + int x_9_phi = 0; + const float x_34 = uv.y; + const bool x_35 = (x_34 < 0.25f); + c1 = x_35; + i = 0; + x_37_phi = x_35; + x_9_phi = 0; + while (true) { + x_37 = x_37_phi; + if ((x_9_phi < 1)) { + } else { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; + { + i = (i + 1); + x_37_phi = false; + x_9_phi = 0; + } + } + if (x_37) { + return; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.msl new file mode 100644 index 0000000000..04778b97f8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.msl @@ -0,0 +1,53 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool c1 = false; + float2 uv = 0.0f; + int i = 0; + bool x_37 = false; + bool x_37_phi = false; + int x_9_phi = 0; + float const x_34 = uv.y; + bool const x_35 = (x_34 < 0.25f); + c1 = x_35; + i = 0; + x_37_phi = x_35; + x_9_phi = 0; + while (true) { + x_37 = x_37_phi; + int const x_9 = x_9_phi; + if ((x_9 < 1)) { + } else { + break; + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; + { + int const x_7 = i; + i = (x_7 + 1); + x_37_phi = false; + x_9_phi = 0; + } + } + if (x_37) { + return; + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..d8fd8783e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.spvasm @@ -0,0 +1,119 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %c1 "c1" + OpName %uv "uv" + OpName %i "i" + OpName %x_37 "x_37" + OpName %x_37_phi "x_37_phi" + OpName %x_9_phi "x_9_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %15 = OpConstantNull %bool + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %19 = OpConstantNull %v2float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %c1 = OpVariable %_ptr_Function_bool Function %15 + %uv = OpVariable %_ptr_Function_v2float Function %19 + %i = OpVariable %_ptr_Function_int Function %23 + %x_37 = OpVariable %_ptr_Function_bool Function %15 + %x_37_phi = OpVariable %_ptr_Function_bool Function %15 + %x_9_phi = OpVariable %_ptr_Function_int Function %23 + %30 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %31 = OpLoad %float %30 + %33 = OpFOrdLessThan %bool %31 %float_0_25 + OpStore %c1 %33 + OpStore %i %int_0 + OpStore %x_37_phi %33 + OpStore %x_9_phi %int_0 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %bool %x_37_phi + OpStore %x_37 %39 + %40 = OpLoad %int %x_9_phi + %42 = OpSLessThan %bool %40 %int_1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %36 + %43 = OpLabel + OpStore %x_GLF_color %48 + OpReturn + %37 = OpLabel + %49 = OpLoad %int %i + %50 = OpIAdd %int %49 %int_1 + OpStore %i %50 + OpStore %x_37_phi %false + OpStore %x_9_phi %int_0 + OpBranch %35 + %36 = OpLabel + %52 = OpLoad %bool %x_37 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + OpReturn + %53 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..bd4cfadacd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.spvasm.expected.wgsl @@ -0,0 +1,48 @@ +var x_GLF_color : vec4; + +fn main_1() { + var c1 : bool; + var uv : vec2; + var i : i32; + var x_37 : bool; + var x_37_phi : bool; + var x_9_phi : i32; + let x_34 : f32 = uv.y; + let x_35 : bool = (x_34 < 0.25); + c1 = x_35; + i = 0; + x_37_phi = x_35; + x_9_phi = 0; + loop { + x_37 = x_37_phi; + let x_9 : i32 = x_9_phi; + if ((x_9 < 1)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; + + continuing { + let x_7 : i32 = i; + i = (x_7 + 1); + x_37_phi = false; + x_9_phi = 0; + } + } + if (x_37) { + return; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl new file mode 100644 index 0000000000..bd4cfadacd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl @@ -0,0 +1,48 @@ +var x_GLF_color : vec4; + +fn main_1() { + var c1 : bool; + var uv : vec2; + var i : i32; + var x_37 : bool; + var x_37_phi : bool; + var x_9_phi : i32; + let x_34 : f32 = uv.y; + let x_35 : bool = (x_34 < 0.25); + c1 = x_35; + i = 0; + x_37_phi = x_35; + x_9_phi = 0; + loop { + x_37 = x_37_phi; + let x_9 : i32 = x_9_phi; + if ((x_9 < 1)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; + + continuing { + let x_7 : i32 = i; + i = (x_7 + 1); + x_37_phi = false; + x_9_phi = 0; + } + } + if (x_37) { + return; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..49c10a453a --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.hlsl @@ -0,0 +1,48 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + bool c1 = false; + float2 uv = float2(0.0f, 0.0f); + int i = 0; + bool x_37 = false; + bool x_37_phi = false; + int x_9_phi = 0; + const float x_34 = uv.y; + const bool x_35 = (x_34 < 0.25f); + c1 = x_35; + i = 0; + x_37_phi = x_35; + x_9_phi = 0; + while (true) { + x_37 = x_37_phi; + if ((x_9_phi < 1)) { + } else { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; + { + i = (i + 1); + x_37_phi = false; + x_9_phi = 0; + } + } + if (x_37) { + return; + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.msl new file mode 100644 index 0000000000..04778b97f8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.msl @@ -0,0 +1,53 @@ +#include + +using namespace metal; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + bool c1 = false; + float2 uv = 0.0f; + int i = 0; + bool x_37 = false; + bool x_37_phi = false; + int x_9_phi = 0; + float const x_34 = uv.y; + bool const x_35 = (x_34 < 0.25f); + c1 = x_35; + i = 0; + x_37_phi = x_35; + x_9_phi = 0; + while (true) { + x_37 = x_37_phi; + int const x_9 = x_9_phi; + if ((x_9 < 1)) { + } else { + break; + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; + { + int const x_7 = i; + i = (x_7 + 1); + x_37_phi = false; + x_9_phi = 0; + } + } + if (x_37) { + return; + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..d8fd8783e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.spvasm @@ -0,0 +1,119 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %c1 "c1" + OpName %uv "uv" + OpName %i "i" + OpName %x_37 "x_37" + OpName %x_37_phi "x_37_phi" + OpName %x_9_phi "x_9_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %15 = OpConstantNull %bool + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %19 = OpConstantNull %v2float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_0_25 = OpConstant %float 0.25 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %48 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %false = OpConstantFalse %bool + %main_out = OpTypeStruct %v4float + %55 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %c1 = OpVariable %_ptr_Function_bool Function %15 + %uv = OpVariable %_ptr_Function_v2float Function %19 + %i = OpVariable %_ptr_Function_int Function %23 + %x_37 = OpVariable %_ptr_Function_bool Function %15 + %x_37_phi = OpVariable %_ptr_Function_bool Function %15 + %x_9_phi = OpVariable %_ptr_Function_int Function %23 + %30 = OpAccessChain %_ptr_Function_float %uv %uint_1 + %31 = OpLoad %float %30 + %33 = OpFOrdLessThan %bool %31 %float_0_25 + OpStore %c1 %33 + OpStore %i %int_0 + OpStore %x_37_phi %33 + OpStore %x_9_phi %int_0 + OpBranch %35 + %35 = OpLabel + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %39 = OpLoad %bool %x_37_phi + OpStore %x_37 %39 + %40 = OpLoad %int %x_9_phi + %42 = OpSLessThan %bool %40 %int_1 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %45 + %44 = OpLabel + OpBranch %43 + %45 = OpLabel + OpBranch %36 + %43 = OpLabel + OpStore %x_GLF_color %48 + OpReturn + %37 = OpLabel + %49 = OpLoad %int %i + %50 = OpIAdd %int %49 %int_1 + OpStore %i %50 + OpStore %x_37_phi %false + OpStore %x_9_phi %int_0 + OpBranch %35 + %36 = OpLabel + %52 = OpLoad %bool %x_37 + OpSelectionMerge %53 None + OpBranchConditional %52 %54 %53 + %54 = OpLabel + OpReturn + %53 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %55 +%tint_symbol = OpFunctionParameter %main_out + %59 = OpLabel + %60 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %60 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %62 = OpLabel + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %v4float %x_GLF_color + %66 = OpCompositeConstruct %main_out %65 + %64 = OpFunctionCall %void %tint_symbol_2 %66 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd4cfadacd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/uv-value-comparison-as-boolean/0.wgsl.expected.wgsl @@ -0,0 +1,48 @@ +var x_GLF_color : vec4; + +fn main_1() { + var c1 : bool; + var uv : vec2; + var i : i32; + var x_37 : bool; + var x_37_phi : bool; + var x_9_phi : i32; + let x_34 : f32 = uv.y; + let x_35 : bool = (x_34 < 0.25); + c1 = x_35; + i = 0; + x_37_phi = x_35; + x_9_phi = 0; + loop { + x_37 = x_37_phi; + let x_9 : i32 = x_9_phi; + if ((x_9 < 1)) { + } else { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; + + continuing { + let x_7 : i32 = i; + i = (x_7 + 1); + x_37_phi = false; + x_9_phi = 0; + } + } + if (x_37) { + return; + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm new file mode 100644 index 0000000000..b5dc0a0775 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm @@ -0,0 +1,195 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %alwaysFalse "alwaysFalse" + OpName %gl_FragCoord "gl_FragCoord" + OpName %value "value" + OpName %a "a" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %i "i" + OpName %count "count" + OpName %i_0 "i" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 + %17 = OpTypeFunction %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_n1 = OpConstant %float -1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %34 = OpConstantComposite %v2float %float_2 %float_2 +%_ptr_Function_int = OpTypePointer Function %int + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main = OpFunction %void None %15 + %46 = OpLabel + %count = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + OpStore %count %int_0 + OpStore %i_0 %int_0 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %int %i_0 + %52 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %53 = OpLoad %float %52 + %54 = OpConvertFToS %int %53 + %55 = OpIAdd %int %54 %int_1 + %56 = OpSLessThan %bool %51 %55 + OpBranchConditional %56 %57 %48 + %57 = OpLabel + %58 = OpFunctionCall %float %func_ + %59 = OpConvertFToS %int %58 + %60 = OpLoad %int %count + %61 = OpIAdd %int %60 %59 + OpStore %count %61 + OpBranch %49 + %49 = OpLabel + %62 = OpLoad %int %i_0 + %63 = OpIAdd %int %62 %int_1 + OpStore %i_0 %63 + OpBranch %47 + %48 = OpLabel + %64 = OpLoad %int %count + %65 = OpIEqual %bool %64 %int_2 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %68 + %67 = OpLabel + OpStore %_GLF_color %44 + OpBranch %66 + %68 = OpLabel + OpStore %_GLF_color %45 + OpBranch %66 + %66 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %float None %17 + %69 = OpLabel +%alwaysFalse = OpVariable %_ptr_Function_bool Function + %value = OpVariable %_ptr_Function_v4float Function + %a = OpVariable %_ptr_Function_v2float Function + %i = OpVariable %_ptr_Function_int Function + %70 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %71 = OpLoad %float %70 + %72 = OpFOrdLessThan %bool %71 %float_n1 + OpStore %alwaysFalse %72 + %73 = OpLoad %bool %alwaysFalse + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %74 + %75 = OpLabel + %76 = OpLoad %v2float %a + %77 = OpLoad %v4float %value + %78 = OpVectorShuffle %v4float %77 %76 4 5 2 3 + OpStore %value %78 + OpBranch %74 + %74 = OpLabel + %79 = OpLoad %bool %alwaysFalse + %80 = OpLogicalNot %bool %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + %83 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %84 = OpLoad %v2float %83 + %85 = OpLoad %v4float %value + %86 = OpVectorShuffle %v4float %85 %84 4 5 2 3 + OpStore %value %86 + OpBranch %81 + %81 = OpLabel + %87 = OpLoad %v4float %gl_FragCoord + %88 = OpVectorShuffle %v2float %87 %87 0 1 + %89 = OpLoad %v4float %value + %90 = OpVectorShuffle %v2float %89 %89 0 1 + %91 = OpFMul %v2float %88 %90 + %92 = OpFMul %v2float %91 %34 + %93 = OpLoad %v4float %value + %94 = OpVectorShuffle %v2float %93 %93 0 1 + %95 = OpFAdd %v2float %92 %94 + %96 = OpLoad %v4float %value + %97 = OpVectorShuffle %v4float %96 %95 0 1 4 5 + OpStore %value %97 + OpStore %i %int_0 + OpBranch %98 + %98 = OpLabel + OpLoopMerge %99 %100 None + OpBranch %101 + %101 = OpLabel + %102 = OpLoad %int %i + %103 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %104 = OpLoad %float %103 + %105 = OpConvertFToS %int %104 + %106 = OpIAdd %int %105 %int_1 + %107 = OpSLessThan %bool %102 %106 + OpBranchConditional %107 %108 %99 + %108 = OpLabel + %109 = OpLoad %int %i + %110 = OpConvertSToF %float %109 + %111 = OpAccessChain %_ptr_Function_float %value %uint_0 + OpStore %111 %110 + OpBranch %100 + %100 = OpLabel + %112 = OpLoad %int %i + %113 = OpIAdd %int %112 %int_1 + OpStore %i %113 + OpBranch %98 + %99 = OpLabel + %114 = OpAccessChain %_ptr_Function_float %value %uint_0 + %115 = OpLoad %float %114 + %116 = OpFOrdEqual %bool %115 %float_1 + OpSelectionMerge %117 None + OpBranchConditional %116 %118 %117 + %118 = OpLabel + %119 = OpAccessChain %_ptr_Function_float %value %uint_1 + %120 = OpLoad %float %119 + %121 = OpFOrdEqual %bool %120 %float_1 + OpBranch %117 + %117 = OpLabel + %122 = OpPhi %bool %116 %99 %121 %118 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %125 + %124 = OpLabel + OpReturnValue %float_1 + %125 = OpLabel + OpReturnValue %float_0 + %123 = OpLabel + OpUnreachable + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..f65360e6ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.hlsl @@ -0,0 +1,104 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_() { + bool alwaysFalse = false; + float4 value = float4(0.0f, 0.0f, 0.0f, 0.0f); + float2 a = float2(0.0f, 0.0f); + int i = 0; + bool x_121 = false; + bool x_122_phi = false; + const float x_71 = gl_FragCoord.x; + alwaysFalse = (x_71 < -1.0f); + if (alwaysFalse) { + const float2 x_76 = a; + const float4 x_77 = value; + value = float4(x_76.x, x_76.y, x_77.z, x_77.w); + } + if (!(alwaysFalse)) { + const float2 x_84 = asfloat(x_10[0].xy); + const float4 x_85 = value; + value = float4(x_84.x, x_84.y, x_85.z, x_85.w); + } + const float4 x_87 = gl_FragCoord; + const float4 x_89 = value; + const float4 x_93 = value; + const float2 x_95 = (((float2(x_87.x, x_87.y) * float2(x_89.x, x_89.y)) * float2(2.0f, 2.0f)) + float2(x_93.x, x_93.y)); + const float4 x_96 = value; + value = float4(x_96.x, x_96.y, x_95.x, x_95.y); + i = 0; + while (true) { + const int x_102 = i; + const float x_104 = asfloat(x_10[0].y); + if ((x_102 < (int(x_104) + 1))) { + } else { + break; + } + value.x = float(i); + { + i = (i + 1); + } + } + const float x_115 = value.x; + const bool x_116 = (x_115 == 1.0f); + x_122_phi = x_116; + if (x_116) { + const float x_120 = value.y; + x_121 = (x_120 == 1.0f); + x_122_phi = x_121; + } + if (x_122_phi) { + return 1.0f; + } else { + return 0.0f; + } + return 0.0f; +} + +void main_1() { + int count = 0; + int i_1 = 0; + count = 0; + i_1 = 0; + while (true) { + const int x_51 = i_1; + const float x_53 = asfloat(x_10[0].y); + if ((x_51 < (int(x_53) + 1))) { + } else { + break; + } + const float x_58 = func_(); + count = (count + int(x_58)); + { + i_1 = (i_1 + 1); + } + } + if ((count == 2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..282221c8e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.msl @@ -0,0 +1,111 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_(constant buf0& x_10, thread float4* const tint_symbol_5) { + bool alwaysFalse = false; + float4 value = 0.0f; + float2 a = 0.0f; + int i = 0; + bool x_121 = false; + bool x_122_phi = false; + float const x_71 = (*(tint_symbol_5)).x; + alwaysFalse = (x_71 < -1.0f); + bool const x_73 = alwaysFalse; + if (x_73) { + float2 const x_76 = a; + float4 const x_77 = value; + value = float4(x_76.x, x_76.y, x_77.z, x_77.w); + } + bool const x_79 = alwaysFalse; + if (!(x_79)) { + float2 const x_84 = x_10.injectionSwitch; + float4 const x_85 = value; + value = float4(x_84.x, x_84.y, x_85.z, x_85.w); + } + float4 const x_87 = *(tint_symbol_5); + float4 const x_89 = value; + float4 const x_93 = value; + float2 const x_95 = (((float2(x_87.x, x_87.y) * float2(x_89.x, x_89.y)) * float2(2.0f, 2.0f)) + float2(x_93.x, x_93.y)); + float4 const x_96 = value; + value = float4(x_96.x, x_96.y, x_95.x, x_95.y); + i = 0; + while (true) { + int const x_102 = i; + float const x_104 = x_10.injectionSwitch.y; + if ((x_102 < (int(x_104) + 1))) { + } else { + break; + } + int const x_109 = i; + value.x = float(x_109); + { + int const x_112 = i; + i = (x_112 + 1); + } + } + float const x_115 = value.x; + bool const x_116 = (x_115 == 1.0f); + x_122_phi = x_116; + if (x_116) { + float const x_120 = value.y; + x_121 = (x_120 == 1.0f); + x_122_phi = x_121; + } + bool const x_122 = x_122_phi; + if (x_122) { + return 1.0f; + } else { + return 0.0f; + } + return 0.0f; +} + +void main_1(constant buf0& x_10, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int count = 0; + int i_1 = 0; + count = 0; + i_1 = 0; + while (true) { + int const x_51 = i_1; + float const x_53 = x_10.injectionSwitch.y; + if ((x_51 < (int(x_53) + 1))) { + } else { + break; + } + float const x_58 = func_(x_10, tint_symbol_6); + int const x_60 = count; + count = (x_60 + int(x_58)); + { + int const x_62 = i_1; + i_1 = (x_62 + 1); + } + } + int const x_64 = count; + if ((x_64 == 2)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_10, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..b6beec436f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.spvasm @@ -0,0 +1,269 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 170 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_ "func_" + OpName %alwaysFalse "alwaysFalse" + OpName %value "value" + OpName %a "a" + OpName %i "i" + OpName %x_121 "x_121" + OpName %x_122_phi "x_122_phi" + OpName %main_1 "main_1" + OpName %count "count" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %15 = OpTypeFunction %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %21 = OpConstantNull %bool +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpConstantNull %v2float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_n1 = OpConstant %float -1 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %74 = OpConstantComposite %v2float %float_2 %float_2 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %void = OpTypeVoid + %124 = OpTypeFunction %void + %int_2 = OpConstant %int 2 + %155 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %157 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %15 + %17 = OpLabel +%alwaysFalse = OpVariable %_ptr_Function_bool Function %21 + %value = OpVariable %_ptr_Function_v4float Function %5 + %a = OpVariable %_ptr_Function_v2float Function %26 + %i = OpVariable %_ptr_Function_int Function %30 + %x_121 = OpVariable %_ptr_Function_bool Function %21 + %x_122_phi = OpVariable %_ptr_Function_bool Function %21 + %36 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %37 = OpLoad %float %36 + %39 = OpFOrdLessThan %bool %37 %float_n1 + OpStore %alwaysFalse %39 + %40 = OpLoad %bool %alwaysFalse + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + %43 = OpLoad %v2float %a + %44 = OpLoad %v4float %value + %45 = OpCompositeExtract %float %43 0 + %46 = OpCompositeExtract %float %43 1 + %47 = OpCompositeExtract %float %44 2 + %48 = OpCompositeExtract %float %44 3 + %49 = OpCompositeConstruct %v4float %45 %46 %47 %48 + OpStore %value %49 + OpBranch %41 + %41 = OpLabel + %50 = OpLoad %bool %alwaysFalse + %51 = OpLogicalNot %bool %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_v2float %x_10 %uint_0 + %56 = OpLoad %v2float %55 + %57 = OpLoad %v4float %value + %58 = OpCompositeExtract %float %56 0 + %59 = OpCompositeExtract %float %56 1 + %60 = OpCompositeExtract %float %57 2 + %61 = OpCompositeExtract %float %57 3 + %62 = OpCompositeConstruct %v4float %58 %59 %60 %61 + OpStore %value %62 + OpBranch %52 + %52 = OpLabel + %63 = OpLoad %v4float %gl_FragCoord + %64 = OpLoad %v4float %value + %65 = OpLoad %v4float %value + %66 = OpCompositeExtract %float %63 0 + %67 = OpCompositeExtract %float %63 1 + %68 = OpCompositeConstruct %v2float %66 %67 + %69 = OpCompositeExtract %float %64 0 + %70 = OpCompositeExtract %float %64 1 + %71 = OpCompositeConstruct %v2float %69 %70 + %72 = OpFMul %v2float %68 %71 + %75 = OpFMul %v2float %72 %74 + %76 = OpCompositeExtract %float %65 0 + %77 = OpCompositeExtract %float %65 1 + %78 = OpCompositeConstruct %v2float %76 %77 + %79 = OpFAdd %v2float %75 %78 + %80 = OpLoad %v4float %value + %81 = OpCompositeExtract %float %80 0 + %82 = OpCompositeExtract %float %80 1 + %83 = OpCompositeExtract %float %79 0 + %84 = OpCompositeExtract %float %79 1 + %85 = OpCompositeConstruct %v4float %81 %82 %83 %84 + OpStore %value %85 + OpStore %i %int_0 + OpBranch %87 + %87 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %int %i + %94 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_1 + %95 = OpLoad %float %94 + %96 = OpConvertFToS %int %95 + %98 = OpIAdd %int %96 %int_1 + %99 = OpSLessThan %bool %91 %98 + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %102 + %101 = OpLabel + OpBranch %100 + %102 = OpLabel + OpBranch %88 + %100 = OpLabel + %103 = OpLoad %int %i + %105 = OpAccessChain %_ptr_Function_float %value %uint_0 + %106 = OpConvertSToF %float %103 + OpStore %105 %106 + OpBranch %89 + %89 = OpLabel + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + OpBranch %87 + %88 = OpLabel + %109 = OpAccessChain %_ptr_Function_float %value %uint_0 + %110 = OpLoad %float %109 + %112 = OpFOrdEqual %bool %110 %float_1 + OpStore %x_122_phi %112 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + %115 = OpAccessChain %_ptr_Function_float %value %uint_1 + %116 = OpLoad %float %115 + %117 = OpFOrdEqual %bool %116 %float_1 + OpStore %x_121 %117 + %118 = OpLoad %bool %x_121 + OpStore %x_122_phi %118 + OpBranch %113 + %113 = OpLabel + %119 = OpLoad %bool %x_122_phi + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %122 + %121 = OpLabel + OpReturnValue %float_1 + %122 = OpLabel + OpReturnValue %float_0 + %120 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + %main_1 = OpFunction %void None %124 + %127 = OpLabel + %count = OpVariable %_ptr_Function_int Function %30 + %i_1 = OpVariable %_ptr_Function_int Function %30 + OpStore %count %int_0 + OpStore %i_1 %int_0 + OpBranch %130 + %130 = OpLabel + OpLoopMerge %131 %132 None + OpBranch %133 + %133 = OpLabel + %134 = OpLoad %int %i_1 + %135 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_1 + %136 = OpLoad %float %135 + %137 = OpConvertFToS %int %136 + %138 = OpIAdd %int %137 %int_1 + %139 = OpSLessThan %bool %134 %138 + OpSelectionMerge %140 None + OpBranchConditional %139 %141 %142 + %141 = OpLabel + OpBranch %140 + %142 = OpLabel + OpBranch %131 + %140 = OpLabel + %143 = OpFunctionCall %float %func_ + %144 = OpLoad %int %count + %145 = OpConvertFToS %int %143 + %146 = OpIAdd %int %144 %145 + OpStore %count %146 + OpBranch %132 + %132 = OpLabel + %147 = OpLoad %int %i_1 + %148 = OpIAdd %int %147 %int_1 + OpStore %i_1 %148 + OpBranch %130 + %131 = OpLabel + %149 = OpLoad %int %count + %151 = OpIEqual %bool %149 %int_2 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %154 + %153 = OpLabel + OpStore %x_GLF_color %155 + OpBranch %152 + %154 = OpLabel + OpStore %x_GLF_color %156 + OpBranch %152 + %152 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %157 +%tint_symbol_1 = OpFunctionParameter %main_out + %161 = OpLabel + %162 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %162 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %124 + %164 = OpLabel + %165 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %165 + %166 = OpFunctionCall %void %main_1 + %168 = OpLoad %v4float %x_GLF_color + %169 = OpCompositeConstruct %main_out %168 + %167 = OpFunctionCall %void %tint_symbol_3 %169 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..1036f48ddd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.spvasm.expected.wgsl @@ -0,0 +1,112 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var alwaysFalse : bool; + var value : vec4; + var a : vec2; + var i : i32; + var x_121 : bool; + var x_122_phi : bool; + let x_71 : f32 = gl_FragCoord.x; + alwaysFalse = (x_71 < -1.0); + let x_73 : bool = alwaysFalse; + if (x_73) { + let x_76 : vec2 = a; + let x_77 : vec4 = value; + value = vec4(x_76.x, x_76.y, x_77.z, x_77.w); + } + let x_79 : bool = alwaysFalse; + if (!(x_79)) { + let x_84 : vec2 = x_10.injectionSwitch; + let x_85 : vec4 = value; + value = vec4(x_84.x, x_84.y, x_85.z, x_85.w); + } + let x_87 : vec4 = gl_FragCoord; + let x_89 : vec4 = value; + let x_93 : vec4 = value; + let x_95 : vec2 = (((vec2(x_87.x, x_87.y) * vec2(x_89.x, x_89.y)) * vec2(2.0, 2.0)) + vec2(x_93.x, x_93.y)); + let x_96 : vec4 = value; + value = vec4(x_96.x, x_96.y, x_95.x, x_95.y); + i = 0; + loop { + let x_102 : i32 = i; + let x_104 : f32 = x_10.injectionSwitch.y; + if ((x_102 < (i32(x_104) + 1))) { + } else { + break; + } + let x_109 : i32 = i; + value.x = f32(x_109); + + continuing { + let x_112 : i32 = i; + i = (x_112 + 1); + } + } + let x_115 : f32 = value.x; + let x_116 : bool = (x_115 == 1.0); + x_122_phi = x_116; + if (x_116) { + let x_120 : f32 = value.y; + x_121 = (x_120 == 1.0); + x_122_phi = x_121; + } + let x_122 : bool = x_122_phi; + if (x_122) { + return 1.0; + } else { + return 0.0; + } + return 0.0; +} + +fn main_1() { + var count : i32; + var i_1 : i32; + count = 0; + i_1 = 0; + loop { + let x_51 : i32 = i_1; + let x_53 : f32 = x_10.injectionSwitch.y; + if ((x_51 < (i32(x_53) + 1))) { + } else { + break; + } + let x_58 : f32 = func_(); + let x_60 : i32 = count; + count = (x_60 + i32(x_58)); + + continuing { + let x_62 : i32 = i_1; + i_1 = (x_62 + 1); + } + } + let x_64 : i32 = count; + if ((x_64 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl new file mode 100644 index 0000000000..1036f48ddd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl @@ -0,0 +1,112 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var alwaysFalse : bool; + var value : vec4; + var a : vec2; + var i : i32; + var x_121 : bool; + var x_122_phi : bool; + let x_71 : f32 = gl_FragCoord.x; + alwaysFalse = (x_71 < -1.0); + let x_73 : bool = alwaysFalse; + if (x_73) { + let x_76 : vec2 = a; + let x_77 : vec4 = value; + value = vec4(x_76.x, x_76.y, x_77.z, x_77.w); + } + let x_79 : bool = alwaysFalse; + if (!(x_79)) { + let x_84 : vec2 = x_10.injectionSwitch; + let x_85 : vec4 = value; + value = vec4(x_84.x, x_84.y, x_85.z, x_85.w); + } + let x_87 : vec4 = gl_FragCoord; + let x_89 : vec4 = value; + let x_93 : vec4 = value; + let x_95 : vec2 = (((vec2(x_87.x, x_87.y) * vec2(x_89.x, x_89.y)) * vec2(2.0, 2.0)) + vec2(x_93.x, x_93.y)); + let x_96 : vec4 = value; + value = vec4(x_96.x, x_96.y, x_95.x, x_95.y); + i = 0; + loop { + let x_102 : i32 = i; + let x_104 : f32 = x_10.injectionSwitch.y; + if ((x_102 < (i32(x_104) + 1))) { + } else { + break; + } + let x_109 : i32 = i; + value.x = f32(x_109); + + continuing { + let x_112 : i32 = i; + i = (x_112 + 1); + } + } + let x_115 : f32 = value.x; + let x_116 : bool = (x_115 == 1.0); + x_122_phi = x_116; + if (x_116) { + let x_120 : f32 = value.y; + x_121 = (x_120 == 1.0); + x_122_phi = x_121; + } + let x_122 : bool = x_122_phi; + if (x_122) { + return 1.0; + } else { + return 0.0; + } + return 0.0; +} + +fn main_1() { + var count : i32; + var i_1 : i32; + count = 0; + i_1 = 0; + loop { + let x_51 : i32 = i_1; + let x_53 : f32 = x_10.injectionSwitch.y; + if ((x_51 < (i32(x_53) + 1))) { + } else { + break; + } + let x_58 : f32 = func_(); + let x_60 : i32 = count; + count = (x_60 + i32(x_58)); + + continuing { + let x_62 : i32 = i_1; + i_1 = (x_62 + 1); + } + } + let x_64 : i32 = count; + if ((x_64 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..f65360e6ad --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.hlsl @@ -0,0 +1,104 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_10 : register(b0, space0) { + uint4 x_10[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +float func_() { + bool alwaysFalse = false; + float4 value = float4(0.0f, 0.0f, 0.0f, 0.0f); + float2 a = float2(0.0f, 0.0f); + int i = 0; + bool x_121 = false; + bool x_122_phi = false; + const float x_71 = gl_FragCoord.x; + alwaysFalse = (x_71 < -1.0f); + if (alwaysFalse) { + const float2 x_76 = a; + const float4 x_77 = value; + value = float4(x_76.x, x_76.y, x_77.z, x_77.w); + } + if (!(alwaysFalse)) { + const float2 x_84 = asfloat(x_10[0].xy); + const float4 x_85 = value; + value = float4(x_84.x, x_84.y, x_85.z, x_85.w); + } + const float4 x_87 = gl_FragCoord; + const float4 x_89 = value; + const float4 x_93 = value; + const float2 x_95 = (((float2(x_87.x, x_87.y) * float2(x_89.x, x_89.y)) * float2(2.0f, 2.0f)) + float2(x_93.x, x_93.y)); + const float4 x_96 = value; + value = float4(x_96.x, x_96.y, x_95.x, x_95.y); + i = 0; + while (true) { + const int x_102 = i; + const float x_104 = asfloat(x_10[0].y); + if ((x_102 < (int(x_104) + 1))) { + } else { + break; + } + value.x = float(i); + { + i = (i + 1); + } + } + const float x_115 = value.x; + const bool x_116 = (x_115 == 1.0f); + x_122_phi = x_116; + if (x_116) { + const float x_120 = value.y; + x_121 = (x_120 == 1.0f); + x_122_phi = x_121; + } + if (x_122_phi) { + return 1.0f; + } else { + return 0.0f; + } + return 0.0f; +} + +void main_1() { + int count = 0; + int i_1 = 0; + count = 0; + i_1 = 0; + while (true) { + const int x_51 = i_1; + const float x_53 = asfloat(x_10[0].y); + if ((x_51 < (int(x_53) + 1))) { + } else { + break; + } + const float x_58 = func_(); + count = (count + int(x_58)); + { + i_1 = (i_1 + 1); + } + } + if ((count == 2)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_6; +} diff --git a/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..282221c8e2 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.msl @@ -0,0 +1,111 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +float func_(constant buf0& x_10, thread float4* const tint_symbol_5) { + bool alwaysFalse = false; + float4 value = 0.0f; + float2 a = 0.0f; + int i = 0; + bool x_121 = false; + bool x_122_phi = false; + float const x_71 = (*(tint_symbol_5)).x; + alwaysFalse = (x_71 < -1.0f); + bool const x_73 = alwaysFalse; + if (x_73) { + float2 const x_76 = a; + float4 const x_77 = value; + value = float4(x_76.x, x_76.y, x_77.z, x_77.w); + } + bool const x_79 = alwaysFalse; + if (!(x_79)) { + float2 const x_84 = x_10.injectionSwitch; + float4 const x_85 = value; + value = float4(x_84.x, x_84.y, x_85.z, x_85.w); + } + float4 const x_87 = *(tint_symbol_5); + float4 const x_89 = value; + float4 const x_93 = value; + float2 const x_95 = (((float2(x_87.x, x_87.y) * float2(x_89.x, x_89.y)) * float2(2.0f, 2.0f)) + float2(x_93.x, x_93.y)); + float4 const x_96 = value; + value = float4(x_96.x, x_96.y, x_95.x, x_95.y); + i = 0; + while (true) { + int const x_102 = i; + float const x_104 = x_10.injectionSwitch.y; + if ((x_102 < (int(x_104) + 1))) { + } else { + break; + } + int const x_109 = i; + value.x = float(x_109); + { + int const x_112 = i; + i = (x_112 + 1); + } + } + float const x_115 = value.x; + bool const x_116 = (x_115 == 1.0f); + x_122_phi = x_116; + if (x_116) { + float const x_120 = value.y; + x_121 = (x_120 == 1.0f); + x_122_phi = x_121; + } + bool const x_122 = x_122_phi; + if (x_122) { + return 1.0f; + } else { + return 0.0f; + } + return 0.0f; +} + +void main_1(constant buf0& x_10, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + int count = 0; + int i_1 = 0; + count = 0; + i_1 = 0; + while (true) { + int const x_51 = i_1; + float const x_53 = x_10.injectionSwitch.y; + if ((x_51 < (int(x_53) + 1))) { + } else { + break; + } + float const x_58 = func_(x_10, tint_symbol_6); + int const x_60 = count; + count = (x_60 + int(x_58)); + { + int const x_62 = i_1; + i_1 = (x_62 + 1); + } + } + int const x_64 = count; + if ((x_64 == 2)) { + *(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_10 [[buffer(0)]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(x_10, &(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..b6beec436f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.spvasm @@ -0,0 +1,269 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 170 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_10 "x_10" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %func_ "func_" + OpName %alwaysFalse "alwaysFalse" + OpName %value "value" + OpName %a "a" + OpName %i "i" + OpName %x_121 "x_121" + OpName %x_122_phi "x_122_phi" + OpName %main_1 "main_1" + OpName %count "count" + OpName %i_1 "i_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_10 NonWritable + OpDecorate %x_10 DescriptorSet 0 + OpDecorate %x_10 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_10 = OpVariable %_ptr_Uniform_buf0 Uniform +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %15 = OpTypeFunction %float + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %21 = OpConstantNull %bool +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %26 = OpConstantNull %v2float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %30 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_n1 = OpConstant %float -1 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_2 = OpConstant %float 2 + %74 = OpConstantComposite %v2float %float_2 %float_2 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %void = OpTypeVoid + %124 = OpTypeFunction %void + %int_2 = OpConstant %int 2 + %155 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %156 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %157 = OpTypeFunction %void %main_out + %func_ = OpFunction %float None %15 + %17 = OpLabel +%alwaysFalse = OpVariable %_ptr_Function_bool Function %21 + %value = OpVariable %_ptr_Function_v4float Function %5 + %a = OpVariable %_ptr_Function_v2float Function %26 + %i = OpVariable %_ptr_Function_int Function %30 + %x_121 = OpVariable %_ptr_Function_bool Function %21 + %x_122_phi = OpVariable %_ptr_Function_bool Function %21 + %36 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %37 = OpLoad %float %36 + %39 = OpFOrdLessThan %bool %37 %float_n1 + OpStore %alwaysFalse %39 + %40 = OpLoad %bool %alwaysFalse + OpSelectionMerge %41 None + OpBranchConditional %40 %42 %41 + %42 = OpLabel + %43 = OpLoad %v2float %a + %44 = OpLoad %v4float %value + %45 = OpCompositeExtract %float %43 0 + %46 = OpCompositeExtract %float %43 1 + %47 = OpCompositeExtract %float %44 2 + %48 = OpCompositeExtract %float %44 3 + %49 = OpCompositeConstruct %v4float %45 %46 %47 %48 + OpStore %value %49 + OpBranch %41 + %41 = OpLabel + %50 = OpLoad %bool %alwaysFalse + %51 = OpLogicalNot %bool %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %52 + %53 = OpLabel + %55 = OpAccessChain %_ptr_Uniform_v2float %x_10 %uint_0 + %56 = OpLoad %v2float %55 + %57 = OpLoad %v4float %value + %58 = OpCompositeExtract %float %56 0 + %59 = OpCompositeExtract %float %56 1 + %60 = OpCompositeExtract %float %57 2 + %61 = OpCompositeExtract %float %57 3 + %62 = OpCompositeConstruct %v4float %58 %59 %60 %61 + OpStore %value %62 + OpBranch %52 + %52 = OpLabel + %63 = OpLoad %v4float %gl_FragCoord + %64 = OpLoad %v4float %value + %65 = OpLoad %v4float %value + %66 = OpCompositeExtract %float %63 0 + %67 = OpCompositeExtract %float %63 1 + %68 = OpCompositeConstruct %v2float %66 %67 + %69 = OpCompositeExtract %float %64 0 + %70 = OpCompositeExtract %float %64 1 + %71 = OpCompositeConstruct %v2float %69 %70 + %72 = OpFMul %v2float %68 %71 + %75 = OpFMul %v2float %72 %74 + %76 = OpCompositeExtract %float %65 0 + %77 = OpCompositeExtract %float %65 1 + %78 = OpCompositeConstruct %v2float %76 %77 + %79 = OpFAdd %v2float %75 %78 + %80 = OpLoad %v4float %value + %81 = OpCompositeExtract %float %80 0 + %82 = OpCompositeExtract %float %80 1 + %83 = OpCompositeExtract %float %79 0 + %84 = OpCompositeExtract %float %79 1 + %85 = OpCompositeConstruct %v4float %81 %82 %83 %84 + OpStore %value %85 + OpStore %i %int_0 + OpBranch %87 + %87 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %int %i + %94 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_1 + %95 = OpLoad %float %94 + %96 = OpConvertFToS %int %95 + %98 = OpIAdd %int %96 %int_1 + %99 = OpSLessThan %bool %91 %98 + OpSelectionMerge %100 None + OpBranchConditional %99 %101 %102 + %101 = OpLabel + OpBranch %100 + %102 = OpLabel + OpBranch %88 + %100 = OpLabel + %103 = OpLoad %int %i + %105 = OpAccessChain %_ptr_Function_float %value %uint_0 + %106 = OpConvertSToF %float %103 + OpStore %105 %106 + OpBranch %89 + %89 = OpLabel + %107 = OpLoad %int %i + %108 = OpIAdd %int %107 %int_1 + OpStore %i %108 + OpBranch %87 + %88 = OpLabel + %109 = OpAccessChain %_ptr_Function_float %value %uint_0 + %110 = OpLoad %float %109 + %112 = OpFOrdEqual %bool %110 %float_1 + OpStore %x_122_phi %112 + OpSelectionMerge %113 None + OpBranchConditional %112 %114 %113 + %114 = OpLabel + %115 = OpAccessChain %_ptr_Function_float %value %uint_1 + %116 = OpLoad %float %115 + %117 = OpFOrdEqual %bool %116 %float_1 + OpStore %x_121 %117 + %118 = OpLoad %bool %x_121 + OpStore %x_122_phi %118 + OpBranch %113 + %113 = OpLabel + %119 = OpLoad %bool %x_122_phi + OpSelectionMerge %120 None + OpBranchConditional %119 %121 %122 + %121 = OpLabel + OpReturnValue %float_1 + %122 = OpLabel + OpReturnValue %float_0 + %120 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + %main_1 = OpFunction %void None %124 + %127 = OpLabel + %count = OpVariable %_ptr_Function_int Function %30 + %i_1 = OpVariable %_ptr_Function_int Function %30 + OpStore %count %int_0 + OpStore %i_1 %int_0 + OpBranch %130 + %130 = OpLabel + OpLoopMerge %131 %132 None + OpBranch %133 + %133 = OpLabel + %134 = OpLoad %int %i_1 + %135 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0 %uint_1 + %136 = OpLoad %float %135 + %137 = OpConvertFToS %int %136 + %138 = OpIAdd %int %137 %int_1 + %139 = OpSLessThan %bool %134 %138 + OpSelectionMerge %140 None + OpBranchConditional %139 %141 %142 + %141 = OpLabel + OpBranch %140 + %142 = OpLabel + OpBranch %131 + %140 = OpLabel + %143 = OpFunctionCall %float %func_ + %144 = OpLoad %int %count + %145 = OpConvertFToS %int %143 + %146 = OpIAdd %int %144 %145 + OpStore %count %146 + OpBranch %132 + %132 = OpLabel + %147 = OpLoad %int %i_1 + %148 = OpIAdd %int %147 %int_1 + OpStore %i_1 %148 + OpBranch %130 + %131 = OpLabel + %149 = OpLoad %int %count + %151 = OpIEqual %bool %149 %int_2 + OpSelectionMerge %152 None + OpBranchConditional %151 %153 %154 + %153 = OpLabel + OpStore %x_GLF_color %155 + OpBranch %152 + %154 = OpLabel + OpStore %x_GLF_color %156 + OpBranch %152 + %152 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %157 +%tint_symbol_1 = OpFunctionParameter %main_out + %161 = OpLabel + %162 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %162 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %124 + %164 = OpLabel + %165 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %165 + %166 = OpFunctionCall %void %main_1 + %168 = OpLoad %v4float %x_GLF_color + %169 = OpCompositeConstruct %main_out %168 + %167 = OpFunctionCall %void %tint_symbol_3 %169 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..1036f48ddd --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vector-values-multiplied-by-fragcoord/0-opt.wgsl.expected.wgsl @@ -0,0 +1,112 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var gl_FragCoord : vec4; + +[[group(0), binding(0)]] var x_10 : buf0; + +var x_GLF_color : vec4; + +fn func_() -> f32 { + var alwaysFalse : bool; + var value : vec4; + var a : vec2; + var i : i32; + var x_121 : bool; + var x_122_phi : bool; + let x_71 : f32 = gl_FragCoord.x; + alwaysFalse = (x_71 < -1.0); + let x_73 : bool = alwaysFalse; + if (x_73) { + let x_76 : vec2 = a; + let x_77 : vec4 = value; + value = vec4(x_76.x, x_76.y, x_77.z, x_77.w); + } + let x_79 : bool = alwaysFalse; + if (!(x_79)) { + let x_84 : vec2 = x_10.injectionSwitch; + let x_85 : vec4 = value; + value = vec4(x_84.x, x_84.y, x_85.z, x_85.w); + } + let x_87 : vec4 = gl_FragCoord; + let x_89 : vec4 = value; + let x_93 : vec4 = value; + let x_95 : vec2 = (((vec2(x_87.x, x_87.y) * vec2(x_89.x, x_89.y)) * vec2(2.0, 2.0)) + vec2(x_93.x, x_93.y)); + let x_96 : vec4 = value; + value = vec4(x_96.x, x_96.y, x_95.x, x_95.y); + i = 0; + loop { + let x_102 : i32 = i; + let x_104 : f32 = x_10.injectionSwitch.y; + if ((x_102 < (i32(x_104) + 1))) { + } else { + break; + } + let x_109 : i32 = i; + value.x = f32(x_109); + + continuing { + let x_112 : i32 = i; + i = (x_112 + 1); + } + } + let x_115 : f32 = value.x; + let x_116 : bool = (x_115 == 1.0); + x_122_phi = x_116; + if (x_116) { + let x_120 : f32 = value.y; + x_121 = (x_120 == 1.0); + x_122_phi = x_121; + } + let x_122 : bool = x_122_phi; + if (x_122) { + return 1.0; + } else { + return 0.0; + } + return 0.0; +} + +fn main_1() { + var count : i32; + var i_1 : i32; + count = 0; + i_1 = 0; + loop { + let x_51 : i32 = i_1; + let x_53 : f32 = x_10.injectionSwitch.y; + if ((x_51 < (i32(x_53) + 1))) { + } else { + break; + } + let x_58 : f32 = func_(); + let x_60 : i32 = count; + count = (x_60 + i32(x_58)); + + continuing { + let x_62 : i32 = i_1; + i_1 = (x_62 + 1); + } + } + let x_64 : i32 = count; + if ((x_64 == 2)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm new file mode 100644 index 0000000000..0e0d5416bf --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm @@ -0,0 +1,81 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %func_ "func(" + OpName %coord "coord" + OpName %tmp3 "tmp3" + OpName %tmp2 "tmp2" + OpName %tmp "tmp" + OpName %_GLF_color "_GLF_color" + OpDecorate %func_ RelaxedPrecision + OpDecorate %9 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %13 = OpTypeFunction %int + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v2float %float_1 %float_1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float + %int_180 = OpConstant %int 180 + %bool = OpTypeBool +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Function__arr_float_uint_1 = OpTypePointer Function %_arr_float_uint_1 + %int_0 = OpConstant %int 0 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %32 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %33 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main = OpFunction %void None %11 + %34 = OpLabel + %9 = OpFunctionCall %int %func_ + %35 = OpIEqual %bool %9 %int_1 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %38 + %37 = OpLabel + OpStore %_GLF_color %32 + OpBranch %36 + %38 = OpLabel + OpStore %_GLF_color %33 + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd + %func_ = OpFunction %int None %13 + %39 = OpLabel + %coord = OpVariable %_ptr_Function_v2float Function + %tmp3 = OpVariable %_ptr_Function_float Function + %tmp2 = OpVariable %_ptr_Function__arr_float_uint_1 Function + %tmp = OpVariable %_ptr_Function_v4float Function + OpStore %coord %18 + %40 = OpAccessChain %_ptr_Function_float %coord %uint_1 + %41 = OpLoad %float %40 + %42 = OpConvertFToS %int %41 + %43 = OpSLessThan %bool %42 %int_180 + OpSelectionMerge %44 None + OpBranchConditional %43 %45 %46 + %45 = OpLabel + %47 = OpAccessChain %_ptr_Function_float %tmp2 %int_0 + %48 = OpLoad %float %47 + OpStore %tmp3 %48 + OpBranch %44 + %46 = OpLabel + OpKill + %44 = OpLabel + %49 = OpCompositeConstruct %v4float %48 %48 %48 %48 + OpStore %tmp %49 + OpReturnValue %int_1 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..10510034ab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.hlsl @@ -0,0 +1,43 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_() { + float2 coord = float2(0.0f, 0.0f); + float tmp3 = 0.0f; + float tmp2[1] = (float[1])0; + float4 tmp = float4(0.0f, 0.0f, 0.0f, 0.0f); + float x_48 = 0.0f; + coord = float2(1.0f, 1.0f); + const float x_41 = coord.y; + if ((int(x_41) < 180)) { + x_48 = tmp2[0]; + tmp3 = x_48; + } else { + discard; + } + tmp = float4(x_48, x_48, x_48, x_48); + return 1; +} + +void main_1() { + const int x_9 = func_(); + if ((x_9 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.msl new file mode 100644 index 0000000000..ed94dc2241 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + float arr[1]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_() { + float2 coord = 0.0f; + float tmp3 = 0.0f; + tint_array_wrapper tmp2 = {}; + float4 tmp = 0.0f; + float x_48 = 0.0f; + coord = float2(1.0f, 1.0f); + float const x_41 = coord.y; + if ((int(x_41) < 180)) { + x_48 = tmp2.arr[0]; + tmp3 = x_48; + } else { + discard_fragment(); + } + tmp = float4(x_48, x_48, x_48, x_48); + return 1; +} + +void main_1(thread float4* const tint_symbol_4) { + int const x_9 = func_(); + if ((x_9 == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..658ed916ef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.spvasm @@ -0,0 +1,121 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %coord "coord" + OpName %tmp3 "tmp3" + OpName %tmp2 "tmp2" + OpName %tmp "tmp" + OpName %x_48 "x_48" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_1 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 + %8 = OpTypeFunction %int + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Function__arr_float_uint_1 = OpTypePointer Function %_arr_float_uint_1 + %24 = OpConstantNull %_arr_float_uint_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %29 = OpConstantComposite %v2float %float_1 %float_1 + %int_180 = OpConstant %int 180 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %49 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %59 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %60 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %61 = OpTypeFunction %void %main_out + %func_ = OpFunction %int None %8 + %11 = OpLabel + %coord = OpVariable %_ptr_Function_v2float Function %15 + %tmp3 = OpVariable %_ptr_Function_float Function %18 + %tmp2 = OpVariable %_ptr_Function__arr_float_uint_1 Function %24 + %tmp = OpVariable %_ptr_Function_v4float Function %5 + %x_48 = OpVariable %_ptr_Function_float Function %18 + OpStore %coord %29 + %30 = OpAccessChain %_ptr_Function_float %coord %uint_1 + %31 = OpLoad %float %30 + %32 = OpConvertFToS %int %31 + %34 = OpSLessThan %bool %32 %int_180 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %38 + %37 = OpLabel + %40 = OpAccessChain %_ptr_Function_float %tmp2 %int_0 + %41 = OpLoad %float %40 + OpStore %x_48 %41 + %42 = OpLoad %float %x_48 + OpStore %tmp3 %42 + OpBranch %36 + %38 = OpLabel + OpKill + %36 = OpLabel + %43 = OpLoad %float %x_48 + %44 = OpLoad %float %x_48 + %45 = OpLoad %float %x_48 + %46 = OpLoad %float %x_48 + %47 = OpCompositeConstruct %v4float %43 %44 %45 %46 + OpStore %tmp %47 + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %49 + %52 = OpLabel + %53 = OpFunctionCall %int %func_ + %54 = OpIEqual %bool %53 %int_1 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpStore %x_GLF_color %59 + OpBranch %55 + %57 = OpLabel + OpStore %x_GLF_color %60 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %61 +%tint_symbol = OpFunctionParameter %main_out + %65 = OpLabel + %66 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %66 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %49 + %68 = OpLabel + %69 = OpFunctionCall %void %main_1 + %71 = OpLoad %v4float %x_GLF_color + %72 = OpCompositeConstruct %main_out %71 + %70 = OpFunctionCall %void %tint_symbol_2 %72 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..3461a66bea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.spvasm.expected.wgsl @@ -0,0 +1,40 @@ +var x_GLF_color : vec4; + +fn func_() -> i32 { + var coord : vec2; + var tmp3 : f32; + var tmp2 : array; + var tmp : vec4; + var x_48 : f32; + coord = vec2(1.0, 1.0); + let x_41 : f32 = coord.y; + if ((i32(x_41) < 180)) { + x_48 = tmp2[0]; + tmp3 = x_48; + } else { + discard; + } + tmp = vec4(x_48, x_48, x_48, x_48); + return 1; +} + +fn main_1() { + let x_9 : i32 = func_(); + if ((x_9 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl new file mode 100644 index 0000000000..3461a66bea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl @@ -0,0 +1,40 @@ +var x_GLF_color : vec4; + +fn func_() -> i32 { + var coord : vec2; + var tmp3 : f32; + var tmp2 : array; + var tmp : vec4; + var x_48 : f32; + coord = vec2(1.0, 1.0); + let x_41 : f32 = coord.y; + if ((i32(x_41) < 180)) { + x_48 = tmp2[0]; + tmp3 = x_48; + } else { + discard; + } + tmp = vec4(x_48, x_48, x_48, x_48); + return 1; +} + +fn main_1() { + let x_9 : i32 = func_(); + if ((x_9 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..10510034ab --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.hlsl @@ -0,0 +1,43 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +int func_() { + float2 coord = float2(0.0f, 0.0f); + float tmp3 = 0.0f; + float tmp2[1] = (float[1])0; + float4 tmp = float4(0.0f, 0.0f, 0.0f, 0.0f); + float x_48 = 0.0f; + coord = float2(1.0f, 1.0f); + const float x_41 = coord.y; + if ((int(x_41) < 180)) { + x_48 = tmp2[0]; + tmp3 = x_48; + } else { + discard; + } + tmp = float4(x_48, x_48, x_48, x_48); + return 1; +} + +void main_1() { + const int x_9 = func_(); + if ((x_9 == 1)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.msl new file mode 100644 index 0000000000..ed94dc2241 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + float arr[1]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +int func_() { + float2 coord = 0.0f; + float tmp3 = 0.0f; + tint_array_wrapper tmp2 = {}; + float4 tmp = 0.0f; + float x_48 = 0.0f; + coord = float2(1.0f, 1.0f); + float const x_41 = coord.y; + if ((int(x_41) < 180)) { + x_48 = tmp2.arr[0]; + tmp3 = x_48; + } else { + discard_fragment(); + } + tmp = float4(x_48, x_48, x_48, x_48); + return 1; +} + +void main_1(thread float4* const tint_symbol_4) { + int const x_9 = func_(); + if ((x_9 == 1)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + } else { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..658ed916ef --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.spvasm @@ -0,0 +1,121 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 73 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %func_ "func_" + OpName %coord "coord" + OpName %tmp3 "tmp3" + OpName %tmp2 "tmp2" + OpName %tmp "tmp" + OpName %x_48 "x_48" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_1 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %int = OpTypeInt 32 1 + %8 = OpTypeFunction %int + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %15 = OpConstantNull %v2float +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpConstantNull %float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Function__arr_float_uint_1 = OpTypePointer Function %_arr_float_uint_1 + %24 = OpConstantNull %_arr_float_uint_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %29 = OpConstantComposite %v2float %float_1 %float_1 + %int_180 = OpConstant %int 180 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %void = OpTypeVoid + %49 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %59 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %60 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %61 = OpTypeFunction %void %main_out + %func_ = OpFunction %int None %8 + %11 = OpLabel + %coord = OpVariable %_ptr_Function_v2float Function %15 + %tmp3 = OpVariable %_ptr_Function_float Function %18 + %tmp2 = OpVariable %_ptr_Function__arr_float_uint_1 Function %24 + %tmp = OpVariable %_ptr_Function_v4float Function %5 + %x_48 = OpVariable %_ptr_Function_float Function %18 + OpStore %coord %29 + %30 = OpAccessChain %_ptr_Function_float %coord %uint_1 + %31 = OpLoad %float %30 + %32 = OpConvertFToS %int %31 + %34 = OpSLessThan %bool %32 %int_180 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %38 + %37 = OpLabel + %40 = OpAccessChain %_ptr_Function_float %tmp2 %int_0 + %41 = OpLoad %float %40 + OpStore %x_48 %41 + %42 = OpLoad %float %x_48 + OpStore %tmp3 %42 + OpBranch %36 + %38 = OpLabel + OpKill + %36 = OpLabel + %43 = OpLoad %float %x_48 + %44 = OpLoad %float %x_48 + %45 = OpLoad %float %x_48 + %46 = OpLoad %float %x_48 + %47 = OpCompositeConstruct %v4float %43 %44 %45 %46 + OpStore %tmp %47 + OpReturnValue %int_1 + OpFunctionEnd + %main_1 = OpFunction %void None %49 + %52 = OpLabel + %53 = OpFunctionCall %int %func_ + %54 = OpIEqual %bool %53 %int_1 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %56 = OpLabel + OpStore %x_GLF_color %59 + OpBranch %55 + %57 = OpLabel + OpStore %x_GLF_color %60 + OpBranch %55 + %55 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %61 +%tint_symbol = OpFunctionParameter %main_out + %65 = OpLabel + %66 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %66 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %49 + %68 = OpLabel + %69 = OpFunctionCall %void %main_1 + %71 = OpLoad %v4float %x_GLF_color + %72 = OpCompositeConstruct %main_out %71 + %70 = OpFunctionCall %void %tint_symbol_2 %72 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..3461a66bea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/vectors-and-discard-in-function/0.wgsl.expected.wgsl @@ -0,0 +1,40 @@ +var x_GLF_color : vec4; + +fn func_() -> i32 { + var coord : vec2; + var tmp3 : f32; + var tmp2 : array; + var tmp : vec4; + var x_48 : f32; + coord = vec2(1.0, 1.0); + let x_41 : f32 = coord.y; + if ((i32(x_41) < 180)) { + x_48 = tmp2[0]; + tmp3 = x_48; + } else { + discard; + } + tmp = vec4(x_48, x_48, x_48, x_48); + return 1; +} + +fn main_1() { + let x_9 : i32 = func_(); + if ((x_9 == 1)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + } else { + x_GLF_color = vec4(0.0, 0.0, 0.0, 1.0); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm new file mode 100644 index 0000000000..39c774d32e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm @@ -0,0 +1,75 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpName %j "j" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpDecorate %_GLF_color Location 0 + OpDecorate %j RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %16 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %10 + %29 = OpLabel + %j = OpVariable %_ptr_Function_int Function + OpStore %_GLF_color %16 + OpBranch %30 + %30 = OpLabel + %31 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %32 = OpLoad %float %31 + %7 = OpConvertFToS %int %32 + OpStore %j %7 + OpLoopMerge %33 %34 None + OpBranch %35 + %35 = OpLabel + %8 = OpLoad %int %j + %36 = OpSLessThan %bool %8 %int_2 + OpLoopMerge %37 %38 None + OpBranchConditional %36 %39 %37 + %39 = OpLabel + OpReturn + %38 = OpLabel + OpBranch %35 + %37 = OpLabel + OpBranch %34 + %34 = OpLabel + %40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %41 = OpLoad %float %40 + %42 = OpFOrdGreaterThan %bool %float_0 %41 + OpBranchConditional %42 %30 %33 + %33 = OpLabel + %43 = OpConvertFToS %int %41 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..257e1e6110 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.hlsl @@ -0,0 +1,44 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + int j = 0; + float x_41 = 0.0f; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + while (true) { + const float x_32 = asfloat(x_6[0].x); + j = int(x_32); + while (true) { + if ((j < 2)) { + } else { + break; + } + return; + } + { + x_41 = asfloat(x_6[0].y); + if ((0.0f > x_41)) { + } else { + break; + } + } + } + const int x_43 = int(x_41); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..042f1771d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int j = 0; + float x_41 = 0.0f; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + while (true) { + float const x_32 = x_6.injectionSwitch.x; + j = int(x_32); + while (true) { + int const x_8 = j; + if ((x_8 < 2)) { + } else { + break; + } + return; + } + { + x_41 = x_6.injectionSwitch.y; + if ((0.0f > x_41)) { + } else { + break; + } + } + } + int const x_43 = int(x_41); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..1f04f3b8be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.spvasm @@ -0,0 +1,130 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %j "j" + OpName %x_41 "x_41" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %57 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %j = OpVariable %_ptr_Function_int Function %19 + %x_41 = OpVariable %_ptr_Function_float Function %22 + OpStore %x_GLF_color %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %33 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %34 = OpLoad %float %33 + %35 = OpConvertFToS %int %34 + OpStore %j %35 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %j + %42 = OpSLessThan %bool %40 %int_2 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %37 + %44 = OpLabel + OpReturn + %38 = OpLabel + OpBranch %36 + %37 = OpLabel + OpBranch %28 + %28 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %49 = OpLoad %float %48 + OpStore %x_41 %49 + %50 = OpLoad %float %x_41 + %51 = OpFOrdGreaterThan %bool %float_0 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %27 + %52 = OpLabel + OpBranch %26 + %27 = OpLabel + %56 = OpLoad %float %x_41 + %55 = OpConvertFToS %int %56 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %57 +%tint_symbol = OpFunctionParameter %main_out + %61 = OpLabel + %62 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %62 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %64 = OpLabel + %65 = OpFunctionCall %void %main_1 + %67 = OpLoad %v4float %x_GLF_color + %68 = OpCompositeConstruct %main_out %67 + %66 = OpFunctionCall %void %tint_symbol_2 %68 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 28[%28] is not post dominated by the back-edge block 52[%52] + %52 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..563d5c343b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.spvasm.expected.wgsl @@ -0,0 +1,47 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var j : i32; + var x_41 : f32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + loop { + let x_32 : f32 = x_6.injectionSwitch.x; + j = i32(x_32); + loop { + let x_8 : i32 = j; + if ((x_8 < 2)) { + } else { + break; + } + return; + } + + continuing { + x_41 = x_6.injectionSwitch.y; + if ((0.0 > x_41)) { + } else { + break; + } + } + } + let x_43 : i32 = i32(x_41); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl new file mode 100644 index 0000000000..563d5c343b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl @@ -0,0 +1,47 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var j : i32; + var x_41 : f32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + loop { + let x_32 : f32 = x_6.injectionSwitch.x; + j = i32(x_32); + loop { + let x_8 : i32 = j; + if ((x_8 < 2)) { + } else { + break; + } + return; + } + + continuing { + x_41 = x_6.injectionSwitch.y; + if ((0.0 > x_41)) { + } else { + break; + } + } + } + let x_43 : i32 = i32(x_41); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..257e1e6110 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.hlsl @@ -0,0 +1,44 @@ +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; + +void main_1() { + int j = 0; + float x_41 = 0.0f; + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + while (true) { + const float x_32 = asfloat(x_6[0].x); + j = int(x_32); + while (true) { + if ((j < 2)) { + } else { + break; + } + return; + } + { + x_41 = asfloat(x_6[0].y); + if ((0.0f > x_41)) { + } else { + break; + } + } + } + const int x_43 = int(x_41); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..042f1771d1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.msl @@ -0,0 +1,48 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + int j = 0; + float x_41 = 0.0f; + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + while (true) { + float const x_32 = x_6.injectionSwitch.x; + j = int(x_32); + while (true) { + int const x_8 = j; + if ((x_8 < 2)) { + } else { + break; + } + return; + } + { + x_41 = x_6.injectionSwitch.y; + if ((0.0f > x_41)) { + } else { + break; + } + } + } + int const x_43 = int(x_41); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..1f04f3b8be --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.spvasm @@ -0,0 +1,130 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 69 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %j "j" + OpName %x_41 "x_41" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %19 = OpConstantNull %int +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpConstantNull %float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %57 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %j = OpVariable %_ptr_Function_int Function %19 + %x_41 = OpVariable %_ptr_Function_float Function %22 + OpStore %x_GLF_color %25 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %33 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_0 + %34 = OpLoad %float %33 + %35 = OpConvertFToS %int %34 + OpStore %j %35 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %int %j + %42 = OpSLessThan %bool %40 %int_2 + OpSelectionMerge %44 None + OpBranchConditional %42 %45 %46 + %45 = OpLabel + OpBranch %44 + %46 = OpLabel + OpBranch %37 + %44 = OpLabel + OpReturn + %38 = OpLabel + OpBranch %36 + %37 = OpLabel + OpBranch %28 + %28 = OpLabel + %48 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %49 = OpLoad %float %48 + OpStore %x_41 %49 + %50 = OpLoad %float %x_41 + %51 = OpFOrdGreaterThan %bool %float_0 %50 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %27 + %52 = OpLabel + OpBranch %26 + %27 = OpLabel + %56 = OpLoad %float %x_41 + %55 = OpConvertFToS %int %56 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %57 +%tint_symbol = OpFunctionParameter %main_out + %61 = OpLabel + %62 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %62 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %64 = OpLabel + %65 = OpFunctionCall %void %main_1 + %67 = OpLoad %v4float %x_GLF_color + %68 = OpCompositeConstruct %main_out %67 + %66 = OpFunctionCall %void %tint_symbol_2 %68 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 28[%28] is not post dominated by the back-edge block 52[%52] + %52 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..563d5c343b --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/while-function-always-false/0-opt.wgsl.expected.wgsl @@ -0,0 +1,47 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +var x_GLF_color : vec4; + +[[group(0), binding(0)]] var x_6 : buf0; + +fn main_1() { + var j : i32; + var x_41 : f32; + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + loop { + let x_32 : f32 = x_6.injectionSwitch.x; + j = i32(x_32); + loop { + let x_8 : i32 = j; + if ((x_8 < 2)) { + } else { + break; + } + return; + } + + continuing { + x_41 = x_6.injectionSwitch.y; + if ((0.0 > x_41)) { + } else { + break; + } + } + } + let x_43 : i32 = i32(x_41); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm new file mode 100644 index 0000000000..806ac7a714 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm @@ -0,0 +1,231 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %idx "idx" + OpName %m43 "m43" + OpName %ll_1 "ll_1" + OpName %GLF_live6rows "GLF_live6rows" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injected" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpName %z "z" + OpName %ll_2 "ll_2" + OpName %ctr "ctr" + OpName %tempm43 "tempm43" + OpName %ll_3 "ll_3" + OpName %c "c" + OpName %d "d" + OpName %GLF_live6sums "GLF_live6sums" + OpDecorate %idx RelaxedPrecision + OpDecorate %ll_1 RelaxedPrecision + OpDecorate %GLF_live6rows RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpMemberDecorate %buf0 0 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %19 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %z RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %ll_2 RelaxedPrecision + OpDecorate %ctr RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %ll_3 RelaxedPrecision + OpDecorate %c RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %d RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + %void = OpTypeVoid + %46 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %56 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %57 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %58 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %59 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %60 = OpConstantComposite %mat4v3float %56 %57 %58 %59 + %int_2 = OpConstant %int 2 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %67 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %46 + %78 = OpLabel + %idx = OpVariable %_ptr_Function_int Function + %m43 = OpVariable %_ptr_Function_mat4v3float Function + %ll_1 = OpVariable %_ptr_Function_int Function +%GLF_live6rows = OpVariable %_ptr_Function_int Function + %z = OpVariable %_ptr_Function_int Function + %ll_2 = OpVariable %_ptr_Function_int Function + %ctr = OpVariable %_ptr_Function_int Function + %tempm43 = OpVariable %_ptr_Function_mat4v3float Function + %ll_3 = OpVariable %_ptr_Function_int Function + %c = OpVariable %_ptr_Function_int Function + %d = OpVariable %_ptr_Function_int Function +%GLF_live6sums = OpVariable %_ptr_Function__arr_float_uint_9 Function + OpStore %idx %int_0 + OpStore %m43 %60 + OpStore %ll_1 %int_0 + OpStore %GLF_live6rows %int_2 + OpBranch %79 + %79 = OpLabel + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %18 = OpLoad %int %ll_1 + %83 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %19 = OpLoad %int %83 + %84 = OpSGreaterThanEqual %bool %18 %19 + OpSelectionMerge %85 None + OpBranchConditional %84 %86 %85 + %86 = OpLabel + OpStore %_GLF_color %67 + OpBranch %80 + %85 = OpLabel + %20 = OpLoad %int %ll_1 + %21 = OpIAdd %int %20 %int_1 + OpStore %ll_1 %21 + %87 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %22 = OpLoad %int %87 + OpStore %z %22 + OpStore %ll_2 %int_0 + OpStore %ctr %int_0 + OpBranch %88 + %88 = OpLabel + OpLoopMerge %89 %90 None + OpBranch %91 + %91 = OpLabel + %23 = OpLoad %int %ctr + %92 = OpSLessThan %bool %23 %int_1 + OpBranchConditional %92 %93 %89 + %93 = OpLabel + %24 = OpLoad %int %ll_2 + %94 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %25 = OpLoad %int %94 + %95 = OpSGreaterThanEqual %bool %24 %25 + OpSelectionMerge %96 None + OpBranchConditional %95 %97 %96 + %97 = OpLabel + OpBranch %89 + %96 = OpLabel + %26 = OpLoad %int %ll_2 + %27 = OpIAdd %int %26 %int_1 + OpStore %ll_2 %27 + %98 = OpLoad %mat4v3float %m43 + OpStore %tempm43 %98 + OpStore %ll_3 %int_0 + OpStore %c %int_0 + OpBranch %99 + %99 = OpLabel + OpLoopMerge %100 %101 None + OpBranch %102 + %102 = OpLabel + %28 = OpLoad %int %z + %103 = OpSLessThan %bool %int_1 %28 + OpBranchConditional %103 %104 %100 + %104 = OpLabel + OpStore %d %int_0 + %29 = OpLoad %int %c + %105 = OpSGreaterThanEqual %bool %29 %int_0 + %30 = OpLoad %int %c + %106 = OpSLessThan %bool %30 %int_4 + %107 = OpLogicalAnd %bool %105 %106 + %31 = OpLoad %int %c + %108 = OpSelect %int %107 %31 %int_0 + %32 = OpLoad %int %d + %109 = OpSGreaterThanEqual %bool %32 %int_0 + %33 = OpLoad %int %d + %110 = OpSLessThan %bool %33 %int_3 + %111 = OpLogicalAnd %bool %109 %110 + %34 = OpLoad %int %d + %112 = OpSelect %int %111 %34 %int_0 + %113 = OpAccessChain %_ptr_Function_float %tempm43 %108 %112 + OpStore %113 %float_1 + OpBranch %101 + %101 = OpLabel + %35 = OpLoad %int %c + %36 = OpIAdd %int %35 %int_1 + OpStore %c %36 + OpBranch %99 + %100 = OpLabel + %37 = OpLoad %int %idx + %114 = OpSGreaterThanEqual %bool %37 %int_0 + %38 = OpLoad %int %idx + %115 = OpSLessThan %bool %38 %int_9 + %116 = OpLogicalAnd %bool %114 %115 + %39 = OpLoad %int %idx + %117 = OpSelect %int %116 %39 %int_0 + %40 = OpLoad %int %ctr + %118 = OpAccessChain %_ptr_Function_float %m43 %40 %uint_1 + %119 = OpLoad %float %118 + %120 = OpAccessChain %_ptr_Function_float %GLF_live6sums %117 + %121 = OpLoad %float %120 + %122 = OpFAdd %float %121 %119 + %123 = OpAccessChain %_ptr_Function_float %GLF_live6sums %117 + OpStore %123 %122 + OpBranch %90 + %90 = OpLabel + %41 = OpLoad %int %ctr + %42 = OpIAdd %int %41 %int_1 + OpStore %ctr %42 + OpBranch %88 + %89 = OpLabel + %43 = OpLoad %int %idx + %44 = OpIAdd %int %43 %int_1 + OpStore %idx %44 + OpBranch %81 + %81 = OpLabel + OpBranch %79 + %80 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.hlsl new file mode 100755 index 0000000000..66b4a0e350 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.hlsl @@ -0,0 +1,99 @@ +SKIP: FAILED + +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int idx = 0; + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll_1 = 0; + int GLF_live6rows = 0; + int z = 0; + int ll_2 = 0; + int ctr = 0; + float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll_3 = 0; + int c = 0; + int d = 0; + float GLF_live6sums[9] = (float[9])0; + idx = 0; + m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); + ll_1 = 0; + GLF_live6rows = 2; + while (true) { + const int x_18 = ll_1; + const int x_19 = asint(x_9[0].x); + if ((x_18 >= x_19)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + ll_1 = (ll_1 + 1); + const int x_22 = asint(x_9[0].x); + z = x_22; + ll_2 = 0; + ctr = 0; + { + for(; (ctr < 1); ctr = (ctr + 1)) { + const int x_24 = ll_2; + const int x_25 = asint(x_9[0].x); + if ((x_24 >= x_25)) { + break; + } + ll_2 = (ll_2 + 1); + tempm43 = m43; + ll_3 = 0; + c = 0; + { + for(; (1 < z); c = (c + 1)) { + d = 0; + bool tint_tmp = (c >= 0); + if (tint_tmp) { + tint_tmp = (c < 4); + } + bool tint_tmp_1 = (d >= 0); + if (tint_tmp_1) { + tint_tmp_1 = (d < 3); + } + set_float3(tempm43[((tint_tmp) ? c : 0)], ((tint_tmp_1) ? d : 0), 1.0f); + } + } + bool tint_tmp_2 = (idx >= 0); + if (tint_tmp_2) { + tint_tmp_2 = (idx < 9); + } + const int x_117 = ((tint_tmp_2) ? idx : 0); + const float x_119 = m43[ctr].y; + const float x_121 = GLF_live6sums[x_117]; + GLF_live6sums[x_117] = (x_121 + x_119); + } + } + idx = (idx + 1); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} +error: validation errors +T:\tmp\ufmo.0:86: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..aa5c43e802 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.msl @@ -0,0 +1,109 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int injected; +}; +struct tint_array_wrapper { + float arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_9, thread float4* const tint_symbol_4) { + int idx = 0; + float4x3 m43 = float4x3(0.0f); + int ll_1 = 0; + int GLF_live6rows = 0; + int z = 0; + int ll_2 = 0; + int ctr = 0; + float4x3 tempm43 = float4x3(0.0f); + int ll_3 = 0; + int c = 0; + int d = 0; + tint_array_wrapper GLF_live6sums = {}; + idx = 0; + m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); + ll_1 = 0; + GLF_live6rows = 2; + while (true) { + int const x_18 = ll_1; + int const x_19 = x_9.injected; + if ((x_18 >= x_19)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + int const x_20 = ll_1; + ll_1 = (x_20 + 1); + int const x_22 = x_9.injected; + z = x_22; + ll_2 = 0; + ctr = 0; + while (true) { + int const x_23 = ctr; + if ((x_23 < 1)) { + } else { + break; + } + int const x_24 = ll_2; + int const x_25 = x_9.injected; + if ((x_24 >= x_25)) { + break; + } + int const x_26 = ll_2; + ll_2 = (x_26 + 1); + float4x3 const x_98 = m43; + tempm43 = x_98; + ll_3 = 0; + c = 0; + while (true) { + int const x_28 = z; + if ((1 < x_28)) { + } else { + break; + } + d = 0; + int const x_29 = c; + int const x_30 = c; + int const x_31 = c; + int const x_32 = d; + int const x_33 = d; + int const x_34 = d; + tempm43[select(0, x_31, ((x_29 >= 0) && (x_30 < 4)))][select(0, x_34, ((x_32 >= 0) && (x_33 < 3)))] = 1.0f; + { + int const x_35 = c; + c = (x_35 + 1); + } + } + int const x_37 = idx; + int const x_38 = idx; + int const x_39 = idx; + int const x_117 = select(0, x_39, ((x_37 >= 0) && (x_38 < 9))); + int const x_40 = ctr; + float const x_119 = m43[x_40].y; + float const x_121 = GLF_live6sums.arr[x_117]; + GLF_live6sums.arr[x_117] = (x_121 + x_119); + { + int const x_41 = ctr; + ctr = (x_41 + 1); + } + } + int const x_43 = idx; + idx = (x_43 + 1); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..63de0fc91f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.spvasm @@ -0,0 +1,255 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 152 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injected" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %idx "idx" + OpName %m43 "m43" + OpName %ll_1 "ll_1" + OpName %GLF_live6rows "GLF_live6rows" + OpName %z "z" + OpName %ll_2 "ll_2" + OpName %ctr "ctr" + OpName %tempm43 "tempm43" + OpName %ll_3 "ll_3" + OpName %c "c" + OpName %d "d" + OpName %GLF_live6sums "GLF_live6sums" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %23 = OpConstantNull %mat4v3float + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %38 = OpConstantNull %_arr_float_uint_9 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %42 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %43 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %44 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %46 = OpConstantComposite %mat4v3float %42 %43 %44 %45 + %int_2 = OpConstant %int 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %61 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 +%_ptr_Function_float = OpTypePointer Function %float + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %140 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %idx = OpVariable %_ptr_Function_int Function %18 + %m43 = OpVariable %_ptr_Function_mat4v3float Function %23 + %ll_1 = OpVariable %_ptr_Function_int Function %18 +%GLF_live6rows = OpVariable %_ptr_Function_int Function %18 + %z = OpVariable %_ptr_Function_int Function %18 + %ll_2 = OpVariable %_ptr_Function_int Function %18 + %ctr = OpVariable %_ptr_Function_int Function %18 + %tempm43 = OpVariable %_ptr_Function_mat4v3float Function %23 + %ll_3 = OpVariable %_ptr_Function_int Function %18 + %c = OpVariable %_ptr_Function_int Function %18 + %d = OpVariable %_ptr_Function_int Function %18 +%GLF_live6sums = OpVariable %_ptr_Function__arr_float_uint_9 Function %38 + OpStore %idx %int_0 + OpStore %m43 %46 + OpStore %ll_1 %int_0 + OpStore %GLF_live6rows %int_2 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %int %ll_1 + %55 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %56 = OpLoad %int %55 + %57 = OpSGreaterThanEqual %bool %52 %56 + OpSelectionMerge %59 None + OpBranchConditional %57 %60 %59 + %60 = OpLabel + OpStore %x_GLF_color %61 + OpBranch %49 + %59 = OpLabel + %62 = OpLoad %int %ll_1 + %64 = OpIAdd %int %62 %int_1 + OpStore %ll_1 %64 + %65 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %66 = OpLoad %int %65 + OpStore %z %66 + OpStore %ll_2 %int_0 + OpStore %ctr %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %ctr + %72 = OpSLessThan %bool %71 %int_1 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + OpBranch %73 + %75 = OpLabel + OpBranch %68 + %73 = OpLabel + %76 = OpLoad %int %ll_2 + %77 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %78 = OpLoad %int %77 + %79 = OpSGreaterThanEqual %bool %76 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %80 + %81 = OpLabel + OpBranch %68 + %80 = OpLabel + %82 = OpLoad %int %ll_2 + %83 = OpIAdd %int %82 %int_1 + OpStore %ll_2 %83 + %84 = OpLoad %mat4v3float %m43 + OpStore %tempm43 %84 + OpStore %ll_3 %int_0 + OpStore %c %int_0 + OpBranch %85 + %85 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %89 = OpLoad %int %z + %90 = OpSLessThan %bool %int_1 %89 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %93 + %92 = OpLabel + OpBranch %91 + %93 = OpLabel + OpBranch %86 + %91 = OpLabel + OpStore %d %int_0 + %94 = OpLoad %int %c + %95 = OpLoad %int %c + %96 = OpLoad %int %c + %97 = OpLoad %int %d + %98 = OpLoad %int %d + %99 = OpLoad %int %d + %101 = OpSGreaterThanEqual %bool %94 %int_0 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + %105 = OpSLessThan %bool %95 %int_4 + OpBranch %102 + %102 = OpLabel + %106 = OpPhi %bool %101 %91 %105 %103 + %100 = OpSelect %int %106 %96 %int_0 + %108 = OpSGreaterThanEqual %bool %97 %int_0 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %109 + %110 = OpLabel + %112 = OpSLessThan %bool %98 %int_3 + OpBranch %109 + %109 = OpLabel + %113 = OpPhi %bool %108 %102 %112 %110 + %107 = OpSelect %int %113 %99 %int_0 + %115 = OpAccessChain %_ptr_Function_float %tempm43 %100 %107 + OpStore %115 %float_1 + OpBranch %87 + %87 = OpLabel + %116 = OpLoad %int %c + %117 = OpIAdd %int %116 %int_1 + OpStore %c %117 + OpBranch %85 + %86 = OpLabel + %118 = OpLoad %int %idx + %119 = OpLoad %int %idx + %120 = OpLoad %int %idx + %122 = OpSGreaterThanEqual %bool %118 %int_0 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %123 + %124 = OpLabel + %126 = OpSLessThan %bool %119 %int_9 + OpBranch %123 + %123 = OpLabel + %127 = OpPhi %bool %122 %86 %126 %124 + %121 = OpSelect %int %127 %120 %int_0 + %128 = OpLoad %int %ctr + %130 = OpAccessChain %_ptr_Function_float %m43 %128 %uint_1 + %131 = OpLoad %float %130 + %132 = OpAccessChain %_ptr_Function_float %GLF_live6sums %121 + %133 = OpLoad %float %132 + %134 = OpAccessChain %_ptr_Function_float %GLF_live6sums %121 + %135 = OpFAdd %float %133 %131 + OpStore %134 %135 + OpBranch %69 + %69 = OpLabel + %136 = OpLoad %int %ctr + %137 = OpIAdd %int %136 %int_1 + OpStore %ctr %137 + OpBranch %67 + %68 = OpLabel + %138 = OpLoad %int %idx + %139 = OpIAdd %int %138 %int_1 + OpStore %idx %139 + OpBranch %50 + %50 = OpLabel + OpBranch %48 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %140 +%tint_symbol = OpFunctionParameter %main_out + %144 = OpLabel + %145 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %145 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %147 = OpLabel + %148 = OpFunctionCall %void %main_1 + %150 = OpLoad %v4float %x_GLF_color + %151 = OpCompositeConstruct %main_out %150 + %149 = OpFunctionCall %void %tint_symbol_2 %151 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..00e805eaca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.wgsl @@ -0,0 +1,106 @@ +[[block]] +struct buf0 { + injected : i32; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var idx : i32; + var m43 : mat4x3; + var ll_1 : i32; + var GLF_live6rows : i32; + var z : i32; + var ll_2 : i32; + var ctr : i32; + var tempm43 : mat4x3; + var ll_3 : i32; + var c : i32; + var d : i32; + var GLF_live6sums : array; + idx = 0; + m43 = mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0)); + ll_1 = 0; + GLF_live6rows = 2; + loop { + let x_18 : i32 = ll_1; + let x_19 : i32 = x_9.injected; + if ((x_18 >= x_19)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + } + let x_20 : i32 = ll_1; + ll_1 = (x_20 + 1); + let x_22 : i32 = x_9.injected; + z = x_22; + ll_2 = 0; + ctr = 0; + loop { + let x_23 : i32 = ctr; + if ((x_23 < 1)) { + } else { + break; + } + let x_24 : i32 = ll_2; + let x_25 : i32 = x_9.injected; + if ((x_24 >= x_25)) { + break; + } + let x_26 : i32 = ll_2; + ll_2 = (x_26 + 1); + let x_98 : mat4x3 = m43; + tempm43 = x_98; + ll_3 = 0; + c = 0; + loop { + let x_28 : i32 = z; + if ((1 < x_28)) { + } else { + break; + } + d = 0; + let x_29 : i32 = c; + let x_30 : i32 = c; + let x_31 : i32 = c; + let x_32 : i32 = d; + let x_33 : i32 = d; + let x_34 : i32 = d; + tempm43[select(0, x_31, ((x_29 >= 0) && (x_30 < 4)))][select(0, x_34, ((x_32 >= 0) && (x_33 < 3)))] = 1.0; + + continuing { + let x_35 : i32 = c; + c = (x_35 + 1); + } + } + let x_37 : i32 = idx; + let x_38 : i32 = idx; + let x_39 : i32 = idx; + let x_117 : i32 = select(0, x_39, ((x_37 >= 0) && (x_38 < 9))); + let x_40 : i32 = ctr; + let x_119 : f32 = m43[x_40].y; + let x_121 : f32 = GLF_live6sums[x_117]; + GLF_live6sums[x_117] = (x_121 + x_119); + + continuing { + let x_41 : i32 = ctr; + ctr = (x_41 + 1); + } + } + let x_43 : i32 = idx; + idx = (x_43 + 1); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl new file mode 100644 index 0000000000..00e805eaca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl @@ -0,0 +1,106 @@ +[[block]] +struct buf0 { + injected : i32; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var idx : i32; + var m43 : mat4x3; + var ll_1 : i32; + var GLF_live6rows : i32; + var z : i32; + var ll_2 : i32; + var ctr : i32; + var tempm43 : mat4x3; + var ll_3 : i32; + var c : i32; + var d : i32; + var GLF_live6sums : array; + idx = 0; + m43 = mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0)); + ll_1 = 0; + GLF_live6rows = 2; + loop { + let x_18 : i32 = ll_1; + let x_19 : i32 = x_9.injected; + if ((x_18 >= x_19)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + } + let x_20 : i32 = ll_1; + ll_1 = (x_20 + 1); + let x_22 : i32 = x_9.injected; + z = x_22; + ll_2 = 0; + ctr = 0; + loop { + let x_23 : i32 = ctr; + if ((x_23 < 1)) { + } else { + break; + } + let x_24 : i32 = ll_2; + let x_25 : i32 = x_9.injected; + if ((x_24 >= x_25)) { + break; + } + let x_26 : i32 = ll_2; + ll_2 = (x_26 + 1); + let x_98 : mat4x3 = m43; + tempm43 = x_98; + ll_3 = 0; + c = 0; + loop { + let x_28 : i32 = z; + if ((1 < x_28)) { + } else { + break; + } + d = 0; + let x_29 : i32 = c; + let x_30 : i32 = c; + let x_31 : i32 = c; + let x_32 : i32 = d; + let x_33 : i32 = d; + let x_34 : i32 = d; + tempm43[select(0, x_31, ((x_29 >= 0) && (x_30 < 4)))][select(0, x_34, ((x_32 >= 0) && (x_33 < 3)))] = 1.0; + + continuing { + let x_35 : i32 = c; + c = (x_35 + 1); + } + } + let x_37 : i32 = idx; + let x_38 : i32 = idx; + let x_39 : i32 = idx; + let x_117 : i32 = select(0, x_39, ((x_37 >= 0) && (x_38 < 9))); + let x_40 : i32 = ctr; + let x_119 : f32 = m43[x_40].y; + let x_121 : f32 = GLF_live6sums[x_117]; + GLF_live6sums[x_117] = (x_121 + x_119); + + continuing { + let x_41 : i32 = ctr; + ctr = (x_41 + 1); + } + } + let x_43 : i32 = idx; + idx = (x_43 + 1); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.hlsl new file mode 100755 index 0000000000..b2cb2a37a5 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.hlsl @@ -0,0 +1,99 @@ +SKIP: FAILED + +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +cbuffer cbuffer_x_9 : register(b0, space0) { + uint4 x_9[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + int idx = 0; + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll_1 = 0; + int GLF_live6rows = 0; + int z = 0; + int ll_2 = 0; + int ctr = 0; + float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll_3 = 0; + int c = 0; + int d = 0; + float GLF_live6sums[9] = (float[9])0; + idx = 0; + m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); + ll_1 = 0; + GLF_live6rows = 2; + while (true) { + const int x_18 = ll_1; + const int x_19 = asint(x_9[0].x); + if ((x_18 >= x_19)) { + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + ll_1 = (ll_1 + 1); + const int x_22 = asint(x_9[0].x); + z = x_22; + ll_2 = 0; + ctr = 0; + { + for(; (ctr < 1); ctr = (ctr + 1)) { + const int x_24 = ll_2; + const int x_25 = asint(x_9[0].x); + if ((x_24 >= x_25)) { + break; + } + ll_2 = (ll_2 + 1); + tempm43 = m43; + ll_3 = 0; + c = 0; + { + for(; (1 < z); c = (c + 1)) { + d = 0; + bool tint_tmp = (c >= 0); + if (tint_tmp) { + tint_tmp = (c < 4); + } + bool tint_tmp_1 = (d >= 0); + if (tint_tmp_1) { + tint_tmp_1 = (d < 3); + } + set_float3(tempm43[((tint_tmp) ? c : 0)], ((tint_tmp_1) ? d : 0), 1.0f); + } + } + bool tint_tmp_2 = (idx >= 0); + if (tint_tmp_2) { + tint_tmp_2 = (idx < 9); + } + const int x_117 = ((tint_tmp_2) ? idx : 0); + const float x_119 = m43[ctr].y; + const float x_121 = GLF_live6sums[x_117]; + GLF_live6sums[x_117] = (x_121 + x_119); + } + } + idx = (idx + 1); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} +error: validation errors +T:\tmp\udx0.0:86: error: Loop must have break. +Validation failed. + + + diff --git a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..aa5c43e802 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.msl @@ -0,0 +1,109 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ int injected; +}; +struct tint_array_wrapper { + float arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_9, thread float4* const tint_symbol_4) { + int idx = 0; + float4x3 m43 = float4x3(0.0f); + int ll_1 = 0; + int GLF_live6rows = 0; + int z = 0; + int ll_2 = 0; + int ctr = 0; + float4x3 tempm43 = float4x3(0.0f); + int ll_3 = 0; + int c = 0; + int d = 0; + tint_array_wrapper GLF_live6sums = {}; + idx = 0; + m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); + ll_1 = 0; + GLF_live6rows = 2; + while (true) { + int const x_18 = ll_1; + int const x_19 = x_9.injected; + if ((x_18 >= x_19)) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + break; + } + int const x_20 = ll_1; + ll_1 = (x_20 + 1); + int const x_22 = x_9.injected; + z = x_22; + ll_2 = 0; + ctr = 0; + while (true) { + int const x_23 = ctr; + if ((x_23 < 1)) { + } else { + break; + } + int const x_24 = ll_2; + int const x_25 = x_9.injected; + if ((x_24 >= x_25)) { + break; + } + int const x_26 = ll_2; + ll_2 = (x_26 + 1); + float4x3 const x_98 = m43; + tempm43 = x_98; + ll_3 = 0; + c = 0; + while (true) { + int const x_28 = z; + if ((1 < x_28)) { + } else { + break; + } + d = 0; + int const x_29 = c; + int const x_30 = c; + int const x_31 = c; + int const x_32 = d; + int const x_33 = d; + int const x_34 = d; + tempm43[select(0, x_31, ((x_29 >= 0) && (x_30 < 4)))][select(0, x_34, ((x_32 >= 0) && (x_33 < 3)))] = 1.0f; + { + int const x_35 = c; + c = (x_35 + 1); + } + } + int const x_37 = idx; + int const x_38 = idx; + int const x_39 = idx; + int const x_117 = select(0, x_39, ((x_37 >= 0) && (x_38 < 9))); + int const x_40 = ctr; + float const x_119 = m43[x_40].y; + float const x_121 = GLF_live6sums.arr[x_117]; + GLF_live6sums.arr[x_117] = (x_121 + x_119); + { + int const x_41 = ctr; + ctr = (x_41 + 1); + } + } + int const x_43 = idx; + idx = (x_43 + 1); + } + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_9 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_9, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..63de0fc91f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.spvasm @@ -0,0 +1,255 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 152 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injected" + OpName %x_9 "x_9" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %idx "idx" + OpName %m43 "m43" + OpName %ll_1 "ll_1" + OpName %GLF_live6rows "GLF_live6rows" + OpName %z "z" + OpName %ll_2 "ll_2" + OpName %ctr "ctr" + OpName %tempm43 "tempm43" + OpName %ll_3 "ll_3" + OpName %c "c" + OpName %d "d" + OpName %GLF_live6sums "GLF_live6sums" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_9 NonWritable + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %buf0 = OpTypeStruct %int +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_9 = OpVariable %_ptr_Uniform_buf0 Uniform + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %18 = OpConstantNull %int + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %23 = OpConstantNull %mat4v3float + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %38 = OpConstantNull %_arr_float_uint_9 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %42 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %43 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %44 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %45 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %46 = OpConstantComposite %mat4v3float %42 %43 %44 %45 + %int_2 = OpConstant %int 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %bool = OpTypeBool + %61 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 +%_ptr_Function_float = OpTypePointer Function %float + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %140 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %idx = OpVariable %_ptr_Function_int Function %18 + %m43 = OpVariable %_ptr_Function_mat4v3float Function %23 + %ll_1 = OpVariable %_ptr_Function_int Function %18 +%GLF_live6rows = OpVariable %_ptr_Function_int Function %18 + %z = OpVariable %_ptr_Function_int Function %18 + %ll_2 = OpVariable %_ptr_Function_int Function %18 + %ctr = OpVariable %_ptr_Function_int Function %18 + %tempm43 = OpVariable %_ptr_Function_mat4v3float Function %23 + %ll_3 = OpVariable %_ptr_Function_int Function %18 + %c = OpVariable %_ptr_Function_int Function %18 + %d = OpVariable %_ptr_Function_int Function %18 +%GLF_live6sums = OpVariable %_ptr_Function__arr_float_uint_9 Function %38 + OpStore %idx %int_0 + OpStore %m43 %46 + OpStore %ll_1 %int_0 + OpStore %GLF_live6rows %int_2 + OpBranch %48 + %48 = OpLabel + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %52 = OpLoad %int %ll_1 + %55 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %56 = OpLoad %int %55 + %57 = OpSGreaterThanEqual %bool %52 %56 + OpSelectionMerge %59 None + OpBranchConditional %57 %60 %59 + %60 = OpLabel + OpStore %x_GLF_color %61 + OpBranch %49 + %59 = OpLabel + %62 = OpLoad %int %ll_1 + %64 = OpIAdd %int %62 %int_1 + OpStore %ll_1 %64 + %65 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %66 = OpLoad %int %65 + OpStore %z %66 + OpStore %ll_2 %int_0 + OpStore %ctr %int_0 + OpBranch %67 + %67 = OpLabel + OpLoopMerge %68 %69 None + OpBranch %70 + %70 = OpLabel + %71 = OpLoad %int %ctr + %72 = OpSLessThan %bool %71 %int_1 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + OpBranch %73 + %75 = OpLabel + OpBranch %68 + %73 = OpLabel + %76 = OpLoad %int %ll_2 + %77 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 + %78 = OpLoad %int %77 + %79 = OpSGreaterThanEqual %bool %76 %78 + OpSelectionMerge %80 None + OpBranchConditional %79 %81 %80 + %81 = OpLabel + OpBranch %68 + %80 = OpLabel + %82 = OpLoad %int %ll_2 + %83 = OpIAdd %int %82 %int_1 + OpStore %ll_2 %83 + %84 = OpLoad %mat4v3float %m43 + OpStore %tempm43 %84 + OpStore %ll_3 %int_0 + OpStore %c %int_0 + OpBranch %85 + %85 = OpLabel + OpLoopMerge %86 %87 None + OpBranch %88 + %88 = OpLabel + %89 = OpLoad %int %z + %90 = OpSLessThan %bool %int_1 %89 + OpSelectionMerge %91 None + OpBranchConditional %90 %92 %93 + %92 = OpLabel + OpBranch %91 + %93 = OpLabel + OpBranch %86 + %91 = OpLabel + OpStore %d %int_0 + %94 = OpLoad %int %c + %95 = OpLoad %int %c + %96 = OpLoad %int %c + %97 = OpLoad %int %d + %98 = OpLoad %int %d + %99 = OpLoad %int %d + %101 = OpSGreaterThanEqual %bool %94 %int_0 + OpSelectionMerge %102 None + OpBranchConditional %101 %103 %102 + %103 = OpLabel + %105 = OpSLessThan %bool %95 %int_4 + OpBranch %102 + %102 = OpLabel + %106 = OpPhi %bool %101 %91 %105 %103 + %100 = OpSelect %int %106 %96 %int_0 + %108 = OpSGreaterThanEqual %bool %97 %int_0 + OpSelectionMerge %109 None + OpBranchConditional %108 %110 %109 + %110 = OpLabel + %112 = OpSLessThan %bool %98 %int_3 + OpBranch %109 + %109 = OpLabel + %113 = OpPhi %bool %108 %102 %112 %110 + %107 = OpSelect %int %113 %99 %int_0 + %115 = OpAccessChain %_ptr_Function_float %tempm43 %100 %107 + OpStore %115 %float_1 + OpBranch %87 + %87 = OpLabel + %116 = OpLoad %int %c + %117 = OpIAdd %int %116 %int_1 + OpStore %c %117 + OpBranch %85 + %86 = OpLabel + %118 = OpLoad %int %idx + %119 = OpLoad %int %idx + %120 = OpLoad %int %idx + %122 = OpSGreaterThanEqual %bool %118 %int_0 + OpSelectionMerge %123 None + OpBranchConditional %122 %124 %123 + %124 = OpLabel + %126 = OpSLessThan %bool %119 %int_9 + OpBranch %123 + %123 = OpLabel + %127 = OpPhi %bool %122 %86 %126 %124 + %121 = OpSelect %int %127 %120 %int_0 + %128 = OpLoad %int %ctr + %130 = OpAccessChain %_ptr_Function_float %m43 %128 %uint_1 + %131 = OpLoad %float %130 + %132 = OpAccessChain %_ptr_Function_float %GLF_live6sums %121 + %133 = OpLoad %float %132 + %134 = OpAccessChain %_ptr_Function_float %GLF_live6sums %121 + %135 = OpFAdd %float %133 %131 + OpStore %134 %135 + OpBranch %69 + %69 = OpLabel + %136 = OpLoad %int %ctr + %137 = OpIAdd %int %136 %int_1 + OpStore %ctr %137 + OpBranch %67 + %68 = OpLabel + %138 = OpLoad %int %idx + %139 = OpIAdd %int %138 %int_1 + OpStore %idx %139 + OpBranch %50 + %50 = OpLabel + OpBranch %48 + %49 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %140 +%tint_symbol = OpFunctionParameter %main_out + %144 = OpLabel + %145 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %145 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %147 = OpLabel + %148 = OpFunctionCall %void %main_1 + %150 = OpLoad %v4float %x_GLF_color + %151 = OpCompositeConstruct %main_out %150 + %149 = OpFunctionCall %void %tint_symbol_2 %151 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..00e805eaca --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.wgsl @@ -0,0 +1,106 @@ +[[block]] +struct buf0 { + injected : i32; +}; + +[[group(0), binding(0)]] var x_9 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var idx : i32; + var m43 : mat4x3; + var ll_1 : i32; + var GLF_live6rows : i32; + var z : i32; + var ll_2 : i32; + var ctr : i32; + var tempm43 : mat4x3; + var ll_3 : i32; + var c : i32; + var d : i32; + var GLF_live6sums : array; + idx = 0; + m43 = mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0)); + ll_1 = 0; + GLF_live6rows = 2; + loop { + let x_18 : i32 = ll_1; + let x_19 : i32 = x_9.injected; + if ((x_18 >= x_19)) { + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + } + let x_20 : i32 = ll_1; + ll_1 = (x_20 + 1); + let x_22 : i32 = x_9.injected; + z = x_22; + ll_2 = 0; + ctr = 0; + loop { + let x_23 : i32 = ctr; + if ((x_23 < 1)) { + } else { + break; + } + let x_24 : i32 = ll_2; + let x_25 : i32 = x_9.injected; + if ((x_24 >= x_25)) { + break; + } + let x_26 : i32 = ll_2; + ll_2 = (x_26 + 1); + let x_98 : mat4x3 = m43; + tempm43 = x_98; + ll_3 = 0; + c = 0; + loop { + let x_28 : i32 = z; + if ((1 < x_28)) { + } else { + break; + } + d = 0; + let x_29 : i32 = c; + let x_30 : i32 = c; + let x_31 : i32 = c; + let x_32 : i32 = d; + let x_33 : i32 = d; + let x_34 : i32 = d; + tempm43[select(0, x_31, ((x_29 >= 0) && (x_30 < 4)))][select(0, x_34, ((x_32 >= 0) && (x_33 < 3)))] = 1.0; + + continuing { + let x_35 : i32 = c; + c = (x_35 + 1); + } + } + let x_37 : i32 = idx; + let x_38 : i32 = idx; + let x_39 : i32 = idx; + let x_117 : i32 = select(0, x_39, ((x_37 >= 0) && (x_38 < 9))); + let x_40 : i32 = ctr; + let x_119 : f32 = m43[x_40].y; + let x_121 : f32 = GLF_live6sums[x_117]; + GLF_live6sums[x_117] = (x_121 + x_119); + + continuing { + let x_41 : i32 = ctr; + ctr = (x_41 + 1); + } + } + let x_43 : i32 = idx; + idx = (x_43 + 1); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm new file mode 100644 index 0000000000..2e992276a9 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm @@ -0,0 +1,817 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode(struct-BST-i1-i1-i11;i1;" + OpName %tree "tree" + OpName %data "data" + OpName %insert_i1_i1_ "insert(i1;i1;" + OpName %treeIndex "treeIndex" + OpName %data_0 "data" + OpName %search_i1_ "search(i1;" + OpName %target "target" + OpName %hueColor_f1_ "hueColor(f1;" + OpName %angle "angle" + OpName %makeFrame_f1_ "makeFrame(f1;" + OpName %v "v" + OpName %baseIndex "baseIndex" + OpName %tree_0 "tree" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %GLF_live8i "GLF_live8i" + OpName %GLF_live8A "GLF_live8A" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %nodeData "nodeData" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %param_5 "param" + OpName %param_6 "param" + OpName %treeIndex_0 "treeIndex" + OpName %param_7 "param" + OpName %param_8 "param" + OpName %param_9 "param" + OpName %param_10 "param" + OpName %GLF_live1_looplimiter2 "GLF_live1_looplimiter2" + OpName %GLF_live1i "GLF_live1i" + OpName %param_11 "param" + OpName %param_12 "param" + OpName %param_13 "param" + OpName %param_14 "param" + OpName %param_15 "param" + OpName %param_16 "param" + OpName %param_17 "param" + OpName %param_18 "param" + OpName %param_19 "param" + OpName %param_20 "param" + OpName %param_21 "param" + OpName %param_22 "param" + OpName %GLF_live4_looplimiter3 "GLF_live4_looplimiter3" + OpName %GLF_live4i "GLF_live4i" + OpName %GLF_live4index "GLF_live4index" + OpName %Obj "Obj" + OpMemberName %Obj 0 "odd_numbers" + OpMemberName %Obj 1 "even_numbers" + OpName %GLF_live4obj "GLF_live4obj" + OpName %param_23 "param" + OpName %param_24 "param" + OpName %param_25 "param" + OpName %param_26 "param" + OpName %z "z" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x "x" + OpName %param_27 "param" + OpName %y "y" + OpName %param_28 "param" + OpName %sum "sum" + OpName %target_0 "target" + OpName %result "result" + OpName %param_29 "param" + OpName %a "a" + OpName %_GLF_color "_GLF_color" + OpName %param_30 "param" + OpMemberDecorate %BST 0 RelaxedPrecision + OpMemberDecorate %BST 1 RelaxedPrecision + OpMemberDecorate %BST 2 RelaxedPrecision + OpDecorate %data RelaxedPrecision + OpDecorate %treeIndex RelaxedPrecision + OpDecorate %data_0 RelaxedPrecision + OpDecorate %search_i1_ RelaxedPrecision + OpDecorate %target RelaxedPrecision + OpDecorate %74 RelaxedPrecision + OpDecorate %baseIndex RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %77 RelaxedPrecision + OpDecorate %78 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %82 RelaxedPrecision + OpDecorate %83 RelaxedPrecision + OpDecorate %84 RelaxedPrecision + OpDecorate %85 RelaxedPrecision + OpDecorate %86 RelaxedPrecision + OpDecorate %87 RelaxedPrecision + OpDecorate %88 RelaxedPrecision + OpDecorate %89 RelaxedPrecision + OpDecorate %90 RelaxedPrecision + OpDecorate %91 RelaxedPrecision + OpDecorate %92 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %GLF_live8i RelaxedPrecision + OpDecorate %94 RelaxedPrecision + OpDecorate %95 RelaxedPrecision + OpDecorate %96 RelaxedPrecision + OpDecorate %97 RelaxedPrecision + OpDecorate %98 RelaxedPrecision + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %index RelaxedPrecision + OpDecorate %99 RelaxedPrecision + OpDecorate %100 RelaxedPrecision + OpDecorate %101 RelaxedPrecision + OpDecorate %102 RelaxedPrecision + OpDecorate %103 RelaxedPrecision + OpDecorate %104 RelaxedPrecision + OpDecorate %105 RelaxedPrecision + OpDecorate %106 RelaxedPrecision + OpDecorate %107 RelaxedPrecision + OpDecorate %108 RelaxedPrecision + OpDecorate %109 RelaxedPrecision + OpDecorate %110 RelaxedPrecision + OpDecorate %111 RelaxedPrecision + OpDecorate %112 RelaxedPrecision + OpDecorate %treeIndex_0 RelaxedPrecision + OpDecorate %113 RelaxedPrecision + OpDecorate %114 RelaxedPrecision + OpDecorate %115 RelaxedPrecision + OpDecorate %116 RelaxedPrecision + OpDecorate %117 RelaxedPrecision + OpDecorate %GLF_live1_looplimiter2 RelaxedPrecision + OpDecorate %GLF_live1i RelaxedPrecision + OpDecorate %118 RelaxedPrecision + OpDecorate %119 RelaxedPrecision + OpDecorate %120 RelaxedPrecision + OpDecorate %121 RelaxedPrecision + OpDecorate %122 RelaxedPrecision + OpDecorate %123 RelaxedPrecision + OpDecorate %124 RelaxedPrecision + OpDecorate %125 RelaxedPrecision + OpDecorate %126 RelaxedPrecision + OpDecorate %127 RelaxedPrecision + OpDecorate %128 RelaxedPrecision + OpDecorate %129 RelaxedPrecision + OpDecorate %130 RelaxedPrecision + OpDecorate %131 RelaxedPrecision + OpDecorate %132 RelaxedPrecision + OpDecorate %133 RelaxedPrecision + OpDecorate %134 RelaxedPrecision + OpDecorate %135 RelaxedPrecision + OpDecorate %136 RelaxedPrecision + OpDecorate %137 RelaxedPrecision + OpDecorate %138 RelaxedPrecision + OpDecorate %139 RelaxedPrecision + OpDecorate %140 RelaxedPrecision + OpDecorate %GLF_live4_looplimiter3 RelaxedPrecision + OpDecorate %GLF_live4i RelaxedPrecision + OpDecorate %141 RelaxedPrecision + OpDecorate %142 RelaxedPrecision + OpDecorate %143 RelaxedPrecision + OpDecorate %GLF_live4index RelaxedPrecision + OpDecorate %144 RelaxedPrecision + OpDecorate %145 RelaxedPrecision + OpDecorate %146 RelaxedPrecision + OpDecorate %147 RelaxedPrecision + OpDecorate %148 RelaxedPrecision + OpDecorate %149 RelaxedPrecision + OpDecorate %150 RelaxedPrecision + OpDecorate %151 RelaxedPrecision + OpDecorate %152 RelaxedPrecision + OpDecorate %153 RelaxedPrecision + OpDecorate %154 RelaxedPrecision + OpDecorate %155 RelaxedPrecision + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %sum RelaxedPrecision + OpDecorate %target_0 RelaxedPrecision + OpDecorate %156 RelaxedPrecision + OpDecorate %result RelaxedPrecision + OpDecorate %157 RelaxedPrecision + OpDecorate %158 RelaxedPrecision + OpDecorate %159 RelaxedPrecision + OpDecorate %160 RelaxedPrecision + OpDecorate %161 RelaxedPrecision + OpDecorate %162 RelaxedPrecision + OpDecorate %163 RelaxedPrecision + OpDecorate %164 RelaxedPrecision + OpDecorate %165 RelaxedPrecision + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %167 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %171 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %172 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %173 = OpTypeFunction %int %_ptr_Function_int + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %v3float = OpTypeVector %float 3 + %177 = OpTypeFunction %v3float %_ptr_Function_float + %178 = OpTypeFunction %float %_ptr_Function_float + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %tree_0 = OpVariable %_ptr_Private__arr_BST_uint_10 Private +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %uint_50 = OpConstant %uint 50 +%_arr_float_uint_50 = OpTypeArray %float %uint_50 +%_ptr_Function__arr_float_uint_50 = OpTypePointer Function %_arr_float_uint_50 + %int_50 = OpConstant %int 50 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_1 = OpConstant %uint 1 + %int_15 = OpConstant %int 15 + %float_30 = OpConstant %float 30 + %float_1 = OpConstant %float 1 + %float_5 = OpConstant %float 5 + %float_50 = OpConstant %float 50 + %float_6_5 = OpConstant %float 6.5 + %float_1_5 = OpConstant %float 1.5 + %int_100 = OpConstant %int 100 + %float_4 = OpConstant %float 4 + %float_0 = OpConstant %float 0 + %int_6 = OpConstant %int 6 + %float_10 = OpConstant %float 10 + %int_30 = OpConstant %int 30 + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %true = OpConstantTrue %bool + %int_7 = OpConstant %int 7 + %int_12 = OpConstant %int 12 + %int_8 = OpConstant %int 8 + %int_3 = OpConstant %int 3 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 + %Obj = OpTypeStruct %_arr_float_uint_10 %_arr_float_uint_10 +%_ptr_Function_Obj = OpTypePointer Function %Obj + %int_10 = OpConstant %int 10 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %float_256 = OpConstant %float 256 + %228 = OpConstantComposite %v2float %float_256 %float_256 + %int_n100 = OpConstant %int -100 + %int_20 = OpConstant %int 20 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_v3float = OpTypePointer Function %v3float + %233 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %main = OpFunction %void None %167 + %234 = OpLabel +%treeIndex_0 = OpVariable %_ptr_Function_int Function + %param_7 = OpVariable %_ptr_Function_BST Function + %param_8 = OpVariable %_ptr_Function_int Function + %param_9 = OpVariable %_ptr_Function_int Function + %param_10 = OpVariable %_ptr_Function_int Function +%GLF_live1_looplimiter2 = OpVariable %_ptr_Function_int Function + %GLF_live1i = OpVariable %_ptr_Function_int Function + %param_11 = OpVariable %_ptr_Function_int Function + %param_12 = OpVariable %_ptr_Function_int Function + %param_13 = OpVariable %_ptr_Function_int Function + %param_14 = OpVariable %_ptr_Function_int Function + %param_15 = OpVariable %_ptr_Function_int Function + %param_16 = OpVariable %_ptr_Function_int Function + %param_17 = OpVariable %_ptr_Function_int Function + %param_18 = OpVariable %_ptr_Function_int Function + %param_19 = OpVariable %_ptr_Function_int Function + %param_20 = OpVariable %_ptr_Function_int Function + %param_21 = OpVariable %_ptr_Function_int Function + %param_22 = OpVariable %_ptr_Function_int Function +%GLF_live4_looplimiter3 = OpVariable %_ptr_Function_int Function + %GLF_live4i = OpVariable %_ptr_Function_int Function +%GLF_live4index = OpVariable %_ptr_Function_int Function +%GLF_live4obj = OpVariable %_ptr_Function_Obj Function + %param_23 = OpVariable %_ptr_Function_int Function + %param_24 = OpVariable %_ptr_Function_int Function + %param_25 = OpVariable %_ptr_Function_int Function + %param_26 = OpVariable %_ptr_Function_int Function + %z = OpVariable %_ptr_Function_v2float Function + %x = OpVariable %_ptr_Function_float Function + %param_27 = OpVariable %_ptr_Function_float Function + %y = OpVariable %_ptr_Function_float Function + %param_28 = OpVariable %_ptr_Function_float Function + %sum = OpVariable %_ptr_Function_int Function + %target_0 = OpVariable %_ptr_Function_int Function + %result = OpVariable %_ptr_Function_int Function + %param_29 = OpVariable %_ptr_Function_int Function + %a = OpVariable %_ptr_Function_float Function + %235 = OpVariable %_ptr_Function_v3float Function + %param_30 = OpVariable %_ptr_Function_float Function + OpStore %treeIndex_0 %int_0 + %236 = OpAccessChain %_ptr_Private_BST %tree_0 %int_0 + %237 = OpLoad %BST %236 + OpStore %param_7 %237 + OpStore %param_8 %int_9 + %238 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_7 %param_8 + %239 = OpLoad %BST %param_7 + %240 = OpAccessChain %_ptr_Private_BST %tree_0 %int_0 + OpStore %240 %239 + %113 = OpLoad %int %treeIndex_0 + %114 = OpIAdd %int %113 %int_1 + OpStore %treeIndex_0 %114 + %115 = OpLoad %int %treeIndex_0 + OpStore %param_9 %115 + OpStore %param_10 %int_5 + %241 = OpFunctionCall %void %insert_i1_i1_ %param_9 %param_10 + %116 = OpLoad %int %treeIndex_0 + %117 = OpIAdd %int %116 %int_1 + OpStore %treeIndex_0 %117 + OpStore %GLF_live1_looplimiter2 %int_0 + OpStore %GLF_live1i %int_0 + OpBranch %242 + %242 = OpLabel + OpLoopMerge %243 %244 None + OpBranch %245 + %245 = OpLabel + OpBranchConditional %true %246 %243 + %246 = OpLabel + %118 = OpLoad %int %GLF_live1_looplimiter2 + %247 = OpSGreaterThanEqual %bool %118 %int_7 + OpSelectionMerge %248 None + OpBranchConditional %247 %249 %248 + %249 = OpLabel + OpBranch %243 + %248 = OpLabel + %119 = OpLoad %int %GLF_live1_looplimiter2 + %120 = OpIAdd %int %119 %int_1 + OpStore %GLF_live1_looplimiter2 %120 + OpBranch %244 + %244 = OpLabel + %121 = OpLoad %int %GLF_live1i + %122 = OpIAdd %int %121 %int_1 + OpStore %GLF_live1i %122 + OpBranch %242 + %243 = OpLabel + %123 = OpLoad %int %treeIndex_0 + OpStore %param_11 %123 + OpStore %param_12 %int_12 + %250 = OpFunctionCall %void %insert_i1_i1_ %param_11 %param_12 + %124 = OpLoad %int %treeIndex_0 + %125 = OpIAdd %int %124 %int_1 + OpStore %treeIndex_0 %125 + %126 = OpLoad %int %treeIndex_0 + OpStore %param_13 %126 + OpStore %param_14 %int_15 + %251 = OpFunctionCall %void %insert_i1_i1_ %param_13 %param_14 + %127 = OpLoad %int %treeIndex_0 + %128 = OpIAdd %int %127 %int_1 + OpStore %treeIndex_0 %128 + %129 = OpLoad %int %treeIndex_0 + OpStore %param_15 %129 + OpStore %param_16 %int_7 + %252 = OpFunctionCall %void %insert_i1_i1_ %param_15 %param_16 + %130 = OpLoad %int %treeIndex_0 + %131 = OpIAdd %int %130 %int_1 + OpStore %treeIndex_0 %131 + %132 = OpLoad %int %treeIndex_0 + OpStore %param_17 %132 + OpStore %param_18 %int_8 + %253 = OpFunctionCall %void %insert_i1_i1_ %param_17 %param_18 + %133 = OpLoad %int %treeIndex_0 + %134 = OpIAdd %int %133 %int_1 + OpStore %treeIndex_0 %134 + %135 = OpLoad %int %treeIndex_0 + OpStore %param_19 %135 + OpStore %param_20 %int_2 + %254 = OpFunctionCall %void %insert_i1_i1_ %param_19 %param_20 + %136 = OpLoad %int %treeIndex_0 + %137 = OpIAdd %int %136 %int_1 + OpStore %treeIndex_0 %137 + %138 = OpLoad %int %treeIndex_0 + OpStore %param_21 %138 + OpStore %param_22 %int_6 + %255 = OpFunctionCall %void %insert_i1_i1_ %param_21 %param_22 + %139 = OpLoad %int %treeIndex_0 + %140 = OpIAdd %int %139 %int_1 + OpStore %treeIndex_0 %140 + OpStore %GLF_live4_looplimiter3 %int_0 + OpStore %GLF_live4i %int_0 + OpBranch %256 + %256 = OpLabel + OpLoopMerge %257 %258 None + OpBranch %259 + %259 = OpLabel + OpBranchConditional %true %260 %257 + %260 = OpLabel + %141 = OpLoad %int %GLF_live4_looplimiter3 + %261 = OpSGreaterThanEqual %bool %141 %int_3 + OpSelectionMerge %262 None + OpBranchConditional %261 %263 %262 + %263 = OpLabel + OpBranch %257 + %262 = OpLabel + %142 = OpLoad %int %GLF_live4_looplimiter3 + %143 = OpIAdd %int %142 %int_1 + OpStore %GLF_live4_looplimiter3 %143 + OpStore %GLF_live4index %int_1 + %144 = OpLoad %int %GLF_live4index + %264 = OpSGreaterThanEqual %bool %144 %int_0 + %145 = OpLoad %int %GLF_live4index + %265 = OpSLessThan %bool %145 %int_10 + %266 = OpLogicalAnd %bool %264 %265 + %146 = OpLoad %int %GLF_live4index + %267 = OpSelect %int %266 %146 %int_0 + %268 = OpAccessChain %_ptr_Function_float %GLF_live4obj %int_1 %int_1 + %269 = OpLoad %float %268 + %270 = OpAccessChain %_ptr_Function_float %GLF_live4obj %int_1 %267 + OpStore %270 %269 + %147 = OpLoad %int %GLF_live4i + %271 = OpSGreaterThanEqual %bool %147 %int_0 + %148 = OpLoad %int %GLF_live4i + %272 = OpSLessThan %bool %148 %int_10 + %273 = OpLogicalAnd %bool %271 %272 + %149 = OpLoad %int %GLF_live4i + %274 = OpSelect %int %273 %149 %int_0 + %275 = OpAccessChain %_ptr_Function_float %GLF_live4obj %int_1 %274 + OpStore %275 %float_1 + OpBranch %258 + %258 = OpLabel + %150 = OpLoad %int %GLF_live4i + %151 = OpIAdd %int %150 %int_1 + OpStore %GLF_live4i %151 + OpBranch %256 + %257 = OpLabel + %152 = OpLoad %int %treeIndex_0 + OpStore %param_23 %152 + OpStore %param_24 %int_17 + %276 = OpFunctionCall %void %insert_i1_i1_ %param_23 %param_24 + %277 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %278 = OpLoad %float %277 + %279 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %280 = OpLoad %float %279 + %281 = OpFOrdGreaterThan %bool %278 %280 + OpSelectionMerge %282 None + OpBranchConditional %281 %283 %282 + %283 = OpLabel + OpReturn + %282 = OpLabel + %153 = OpLoad %int %treeIndex_0 + %154 = OpIAdd %int %153 %int_1 + OpStore %treeIndex_0 %154 + %155 = OpLoad %int %treeIndex_0 + OpStore %param_25 %155 + OpStore %param_26 %int_13 + %284 = OpFunctionCall %void %insert_i1_i1_ %param_25 %param_26 + %285 = OpLoad %v4float %gl_FragCoord + %286 = OpVectorShuffle %v2float %285 %285 1 0 + %287 = OpFDiv %v2float %286 %228 + OpStore %z %287 + %288 = OpAccessChain %_ptr_Function_float %z %uint_0 + %289 = OpLoad %float %288 + OpStore %param_27 %289 + %290 = OpFunctionCall %float %makeFrame_f1_ %param_27 + OpStore %x %290 + %291 = OpAccessChain %_ptr_Function_float %z %uint_1 + %292 = OpLoad %float %291 + OpStore %param_28 %292 + %293 = OpFunctionCall %float %makeFrame_f1_ %param_28 + OpStore %y %293 + OpStore %sum %int_n100 + OpStore %target_0 %int_0 + OpBranch %294 + %294 = OpLabel + OpLoopMerge %295 %296 None + OpBranch %297 + %297 = OpLabel + %156 = OpLoad %int %target_0 + %298 = OpSLessThan %bool %156 %int_20 + OpBranchConditional %298 %299 %295 + %299 = OpLabel + %157 = OpLoad %int %target_0 + OpStore %param_29 %157 + %158 = OpFunctionCall %int %search_i1_ %param_29 + OpStore %result %158 + %159 = OpLoad %int %result + %300 = OpSGreaterThan %bool %159 %int_0 + OpSelectionMerge %301 None + OpBranchConditional %300 %302 %303 + %302 = OpLabel + OpBranch %301 + %303 = OpLabel + %160 = OpLoad %int %result + OpSelectionMerge %304 None + OpSwitch %160 %304 -1 %305 0 %306 + %305 = OpLabel + %161 = OpLoad %int %sum + %162 = OpIAdd %int %161 %int_1 + OpStore %sum %162 + OpBranch %304 + %306 = OpLabel + OpReturn + %304 = OpLabel + OpBranch %301 + %301 = OpLabel + OpBranch %296 + %296 = OpLabel + %163 = OpLoad %int %target_0 + %164 = OpIAdd %int %163 %int_1 + OpStore %target_0 %164 + OpBranch %294 + %295 = OpLabel + %307 = OpLoad %float %x + %308 = OpLoad %float %y + %165 = OpLoad %int %sum + %309 = OpConvertSToF %float %165 + %310 = OpFMul %float %308 %309 + %311 = OpFAdd %float %307 %310 + OpStore %a %311 + %312 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %313 = OpLoad %float %312 + %314 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %315 = OpLoad %float %314 + %316 = OpFOrdLessThan %bool %313 %315 + OpSelectionMerge %317 None + OpBranchConditional %316 %318 %319 + %318 = OpLabel + OpStore %235 %233 + OpBranch %317 + %319 = OpLabel + %320 = OpLoad %float %a + OpStore %param_30 %320 + %321 = OpFunctionCall %v3float %hueColor_f1_ %param_30 + OpStore %235 %321 + OpBranch %317 + %317 = OpLabel + %322 = OpLoad %v3float %235 + %323 = OpCompositeExtract %float %322 0 + %324 = OpCompositeExtract %float %322 1 + %325 = OpCompositeExtract %float %322 2 + %326 = OpCompositeConstruct %v4float %323 %324 %325 %float_1 + OpStore %_GLF_color %326 + OpReturn + OpFunctionEnd +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %171 + %tree = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %327 = OpLabel + %74 = OpLoad %int %data + %328 = OpAccessChain %_ptr_Function_int %tree %int_0 + OpStore %328 %74 + %329 = OpAccessChain %_ptr_Function_int %tree %int_1 + OpStore %329 %int_n1 + %330 = OpAccessChain %_ptr_Function_int %tree %int_2 + OpStore %330 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %172 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_0 = OpFunctionParameter %_ptr_Function_int + %331 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_BST Function + %param_0 = OpVariable %_ptr_Function_int Function + %param_1 = OpVariable %_ptr_Function_BST Function + %param_2 = OpVariable %_ptr_Function_int Function + %GLF_live8i = OpVariable %_ptr_Function_int Function + %GLF_live8A = OpVariable %_ptr_Function__arr_float_uint_50 Function + OpStore %baseIndex %int_0 + OpBranch %332 + %332 = OpLabel + OpLoopMerge %333 %334 None + OpBranch %335 + %335 = OpLabel + %75 = OpLoad %int %baseIndex + %76 = OpLoad %int %treeIndex + %336 = OpSLessThanEqual %bool %75 %76 + OpBranchConditional %336 %337 %333 + %337 = OpLabel + %77 = OpLoad %int %data_0 + %78 = OpLoad %int %baseIndex + %338 = OpAccessChain %_ptr_Private_int %tree_0 %78 %int_0 + %79 = OpLoad %int %338 + %339 = OpSLessThanEqual %bool %77 %79 + OpSelectionMerge %340 None + OpBranchConditional %339 %341 %342 + %341 = OpLabel + %80 = OpLoad %int %baseIndex + %343 = OpAccessChain %_ptr_Private_int %tree_0 %80 %int_1 + %81 = OpLoad %int %343 + %344 = OpIEqual %bool %81 %int_n1 + OpSelectionMerge %345 None + OpBranchConditional %344 %346 %347 + %346 = OpLabel + %82 = OpLoad %int %baseIndex + %83 = OpLoad %int %treeIndex + %348 = OpAccessChain %_ptr_Private_int %tree_0 %82 %int_1 + OpStore %348 %83 + %84 = OpLoad %int %treeIndex + %349 = OpAccessChain %_ptr_Private_BST %tree_0 %84 + %350 = OpLoad %BST %349 + OpStore %param %350 + %85 = OpLoad %int %data_0 + OpStore %param_0 %85 + %351 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_0 + %352 = OpLoad %BST %param + %353 = OpAccessChain %_ptr_Private_BST %tree_0 %84 + OpStore %353 %352 + OpReturn + %347 = OpLabel + %86 = OpLoad %int %baseIndex + %354 = OpAccessChain %_ptr_Private_int %tree_0 %86 %int_1 + %87 = OpLoad %int %354 + OpStore %baseIndex %87 + OpBranch %334 + %345 = OpLabel + OpBranch %340 + %342 = OpLabel + %88 = OpLoad %int %baseIndex + %355 = OpAccessChain %_ptr_Private_int %tree_0 %88 %int_2 + %89 = OpLoad %int %355 + %356 = OpIEqual %bool %89 %int_n1 + OpSelectionMerge %357 None + OpBranchConditional %356 %358 %359 + %358 = OpLabel + %90 = OpLoad %int %baseIndex + %91 = OpLoad %int %treeIndex + %360 = OpAccessChain %_ptr_Private_int %tree_0 %90 %int_2 + OpStore %360 %91 + %92 = OpLoad %int %treeIndex + %361 = OpAccessChain %_ptr_Private_BST %tree_0 %92 + %362 = OpLoad %BST %361 + OpStore %param_1 %362 + %93 = OpLoad %int %data_0 + OpStore %param_2 %93 + %363 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_1 %param_2 + %364 = OpLoad %BST %param_1 + %365 = OpAccessChain %_ptr_Private_BST %tree_0 %92 + OpStore %365 %364 + OpReturn + %359 = OpLabel + OpStore %GLF_live8i %int_1 + %94 = OpLoad %int %GLF_live8i + %366 = OpSGreaterThanEqual %bool %94 %int_0 + %95 = OpLoad %int %GLF_live8i + %367 = OpSLessThan %bool %95 %int_50 + %368 = OpLogicalAnd %bool %366 %367 + %96 = OpLoad %int %GLF_live8i + %369 = OpSelect %int %368 %96 %int_0 + %370 = OpAccessChain %_ptr_Function_float %GLF_live8A %int_0 + %371 = OpLoad %float %370 + %372 = OpAccessChain %_ptr_Function_float %GLF_live8A %369 + %373 = OpLoad %float %372 + %374 = OpFAdd %float %373 %371 + %375 = OpAccessChain %_ptr_Function_float %GLF_live8A %369 + OpStore %375 %374 + OpBranch %376 + %376 = OpLabel + OpLoopMerge %377 %378 None + OpBranch %379 + %379 = OpLabel + %97 = OpLoad %int %baseIndex + %380 = OpAccessChain %_ptr_Private_int %tree_0 %97 %int_2 + %98 = OpLoad %int %380 + OpStore %baseIndex %98 + OpBranch %378 + %378 = OpLabel + %381 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %382 = OpLoad %float %381 + %383 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %384 = OpLoad %float %383 + %385 = OpFOrdGreaterThan %bool %382 %384 + OpBranchConditional %385 %376 %377 + %377 = OpLabel + OpBranch %334 + %357 = OpLabel + OpBranch %340 + %340 = OpLabel + OpBranch %334 + %334 = OpLabel + OpBranch %332 + %333 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %173 + %target = OpFunctionParameter %_ptr_Function_int + %386 = OpLabel + %index = OpVariable %_ptr_Function_int Function +%currentNode = OpVariable %_ptr_Function_BST Function + %387 = OpVariable %_ptr_Function_int Function + OpStore %index %int_0 + OpBranch %388 + %388 = OpLabel + OpLoopMerge %389 %390 None + OpBranch %391 + %391 = OpLabel + %99 = OpLoad %int %index + %392 = OpINotEqual %bool %99 %int_n1 + OpBranchConditional %392 %393 %389 + %393 = OpLabel + %100 = OpLoad %int %index + %394 = OpAccessChain %_ptr_Private_BST %tree_0 %100 + %395 = OpLoad %BST %394 + OpStore %currentNode %395 + %396 = OpAccessChain %_ptr_Function_int %currentNode %int_0 + %101 = OpLoad %int %396 + %102 = OpLoad %int %target + %397 = OpIEqual %bool %101 %102 + OpSelectionMerge %398 None + OpBranchConditional %397 %399 %398 + %399 = OpLabel + %103 = OpLoad %int %target + OpReturnValue %103 + %398 = OpLabel + %104 = OpLoad %int %target + %400 = OpAccessChain %_ptr_Function_int %currentNode %int_0 + %105 = OpLoad %int %400 + %401 = OpSGreaterThan %bool %104 %105 + OpSelectionMerge %402 None + OpBranchConditional %401 %403 %404 + %403 = OpLabel + %405 = OpAccessChain %_ptr_Function_int %currentNode %int_2 + %106 = OpLoad %int %405 + OpStore %387 %106 + OpBranch %402 + %404 = OpLabel + %406 = OpAccessChain %_ptr_Function_int %currentNode %int_1 + %107 = OpLoad %int %406 + OpStore %387 %107 + OpBranch %402 + %402 = OpLabel + %108 = OpLoad %int %387 + OpStore %index %108 + OpBranch %390 + %390 = OpLabel + OpBranch %388 + %389 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd +%hueColor_f1_ = OpFunction %v3float None %177 + %angle = OpFunctionParameter %_ptr_Function_float + %407 = OpLabel + %nodeData = OpVariable %_ptr_Function_float Function + %param_3 = OpVariable %_ptr_Function_int Function + OpStore %param_3 %int_15 + %109 = OpFunctionCall %int %search_i1_ %param_3 + %408 = OpConvertSToF %float %109 + OpStore %nodeData %408 + %409 = OpLoad %float %angle + %410 = OpLoad %float %nodeData + %411 = OpCompositeConstruct %v3float %float_1 %float_5 %410 + %412 = OpVectorTimesScalar %v3float %411 %409 + %413 = OpCompositeConstruct %v3float %float_30 %float_30 %float_30 + %414 = OpFAdd %v3float %413 %412 + %415 = OpCompositeConstruct %v3float %float_50 %float_50 %float_50 + %416 = OpFDiv %v3float %414 %415 + OpReturnValue %416 + OpFunctionEnd +%makeFrame_f1_ = OpFunction %float None %178 + %v = OpFunctionParameter %_ptr_Function_float + %417 = OpLabel + %param_4 = OpVariable %_ptr_Function_int Function + %param_5 = OpVariable %_ptr_Function_int Function + %param_6 = OpVariable %_ptr_Function_int Function + %418 = OpLoad %float %v + %419 = OpFMul %float %418 %float_6_5 + OpStore %v %419 + %420 = OpLoad %float %v + %421 = OpFOrdLessThan %bool %420 %float_1_5 + OpSelectionMerge %422 None + OpBranchConditional %421 %423 %422 + %423 = OpLabel + OpStore %param_4 %int_100 + %110 = OpFunctionCall %int %search_i1_ %param_4 + %424 = OpConvertSToF %float %110 + OpReturnValue %424 + %422 = OpLabel + %425 = OpLoad %float %v + %426 = OpFOrdLessThan %bool %425 %float_4 + OpSelectionMerge %427 None + OpBranchConditional %426 %428 %427 + %428 = OpLabel + OpReturnValue %float_0 + %427 = OpLabel + %429 = OpLoad %float %v + OpStore %param_5 %int_6 + %111 = OpFunctionCall %int %search_i1_ %param_5 + %430 = OpConvertSToF %float %111 + %431 = OpFOrdLessThan %bool %429 %430 + OpSelectionMerge %432 None + OpBranchConditional %431 %433 %432 + %433 = OpLabel + OpReturnValue %float_1 + %432 = OpLabel + OpStore %param_6 %int_30 + %112 = OpFunctionCall %int %search_i1_ %param_6 + %434 = OpConvertSToF %float %112 + %435 = OpFAdd %float %float_10 %434 + OpReturnValue %435 + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..4e1c940777 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.hlsl @@ -0,0 +1,364 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct Obj { + float odd_numbers[10]; + float even_numbers[10]; +}; + +static BST tree_1[10] = (BST[10])0; +cbuffer cbuffer_x_27 : register(b0, space0) { + uint4 x_27[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_74 = data; + tree.data = x_74; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + int GLF_live8i = 0; + float GLF_live8A[50] = (float[50])0; + baseIndex = 0; + while (true) { + const int x_75 = baseIndex; + const int x_76 = treeIndex; + if ((x_75 <= x_76)) { + } else { + break; + } + const int x_77 = data_1; + const int x_79 = tree_1[baseIndex].data; + if ((x_77 <= x_79)) { + const int x_81 = tree_1[baseIndex].leftIndex; + if ((x_81 == -1)) { + const int x_82 = baseIndex; + const int x_83 = treeIndex; + tree_1[x_82].leftIndex = x_83; + const int x_84 = treeIndex; + const BST x_350 = tree_1[x_84]; + param = x_350; + const int x_85 = data_1; + param_1 = x_85; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_84] = param; + return; + } else { + const int x_87 = tree_1[baseIndex].leftIndex; + baseIndex = x_87; + continue; + } + } else { + const int x_89 = tree_1[baseIndex].rightIndex; + if ((x_89 == -1)) { + const int x_90 = baseIndex; + const int x_91 = treeIndex; + tree_1[x_90].rightIndex = x_91; + const int x_92 = treeIndex; + const BST x_362 = tree_1[x_92]; + param_2 = x_362; + const int x_93 = data_1; + param_3 = x_93; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_92] = param_2; + return; + } else { + GLF_live8i = 1; + bool tint_tmp = (GLF_live8i >= 0); + if (tint_tmp) { + tint_tmp = (GLF_live8i < 50); + } + const int x_369 = ((tint_tmp) ? GLF_live8i : 0); + const float x_371 = GLF_live8A[0]; + const float x_373 = GLF_live8A[x_369]; + GLF_live8A[x_369] = (x_373 + x_371); + while (true) { + const int x_98 = tree_1[baseIndex].rightIndex; + baseIndex = x_98; + { + const float x_382 = asfloat(x_27[0].x); + const float x_384 = asfloat(x_27[0].y); + if ((x_382 > x_384)) { + } else { + break; + } + } + } + continue; + } + } + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_387 = 0; + index = 0; + while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_395 = tree_1[index]; + currentNode = x_395; + const int x_101 = currentNode.data; + const int x_102 = target; + if ((x_101 == x_102)) { + const int x_103 = target; + return x_103; + } + const int x_104 = target; + const int x_105 = currentNode.data; + if ((x_104 > x_105)) { + const int x_106 = currentNode.rightIndex; + x_387 = x_106; + } else { + const int x_107 = currentNode.leftIndex; + x_387 = x_107; + } + index = x_387; + } + return -1; +} + +float makeFrame_f1_(inout float v) { + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + const float x_418 = v; + v = (x_418 * 6.5f); + const float x_420 = v; + if ((x_420 < 1.5f)) { + param_5 = 100; + const int x_110 = search_i1_(param_5); + return float(x_110); + } + const float x_425 = v; + if ((x_425 < 4.0f)) { + return 0.0f; + } + const float x_429 = v; + param_6 = 6; + const int x_111 = search_i1_(param_6); + if ((x_429 < float(x_111))) { + return 1.0f; + } + param_7 = 30; + const int x_112 = search_i1_(param_7); + return (10.0f + float(x_112)); +} + +float3 hueColor_f1_(inout float angle) { + float nodeData = 0.0f; + int param_4 = 0; + param_4 = 15; + const int x_109 = search_i1_(param_4); + nodeData = float(x_109); + const float x_409 = angle; + return ((float3(30.0f, 30.0f, 30.0f) + (float3(1.0f, 5.0f, nodeData) * x_409)) / float3(50.0f, 50.0f, 50.0f)); +} + +void main_1() { + int treeIndex_1 = 0; + BST param_8 = (BST)0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int GLF_live1_looplimiter2 = 0; + int GLF_live1i = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int GLF_live4_looplimiter3 = 0; + int GLF_live4i = 0; + int GLF_live4index = 0; + Obj GLF_live4obj = (Obj)0; + int param_24 = 0; + int param_25 = 0; + int param_26 = 0; + int param_27 = 0; + float2 z = float2(0.0f, 0.0f); + float x_1 = 0.0f; + float param_28 = 0.0f; + float y_1 = 0.0f; + float param_29 = 0.0f; + int sum = 0; + int target_1 = 0; + int result = 0; + int param_30 = 0; + float a = 0.0f; + float3 x_235 = float3(0.0f, 0.0f, 0.0f); + float param_31 = 0.0f; + treeIndex_1 = 0; + const BST x_237 = tree_1[0]; + param_8 = x_237; + param_9 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_8, param_9); + tree_1[0] = param_8; + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 5; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + GLF_live1_looplimiter2 = 0; + GLF_live1i = 0; + { + for(; true; GLF_live1i = (GLF_live1i + 1)) { + if ((GLF_live1_looplimiter2 >= 7)) { + break; + } + GLF_live1_looplimiter2 = (GLF_live1_looplimiter2 + 1); + } + } + param_12 = treeIndex_1; + param_13 = 12; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 15; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 7; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 8; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 2; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 6; + insert_i1_i1_(param_22, param_23); + treeIndex_1 = (treeIndex_1 + 1); + GLF_live4_looplimiter3 = 0; + GLF_live4i = 0; + { + for(; true; GLF_live4i = (GLF_live4i + 1)) { + if ((GLF_live4_looplimiter3 >= 3)) { + break; + } + GLF_live4_looplimiter3 = (GLF_live4_looplimiter3 + 1); + GLF_live4index = 1; + const int x_144 = GLF_live4index; + const int x_145 = GLF_live4index; + const int x_146 = GLF_live4index; + const float x_269 = GLF_live4obj.even_numbers[1]; + bool tint_tmp_1 = (x_144 >= 0); + if (tint_tmp_1) { + tint_tmp_1 = (x_145 < 10); + } + GLF_live4obj.even_numbers[((tint_tmp_1) ? x_146 : 0)] = x_269; + bool tint_tmp_2 = (GLF_live4i >= 0); + if (tint_tmp_2) { + tint_tmp_2 = (GLF_live4i < 10); + } + GLF_live4obj.even_numbers[((tint_tmp_2) ? GLF_live4i : 0)] = 1.0f; + } + } + param_24 = treeIndex_1; + param_25 = 17; + insert_i1_i1_(param_24, param_25); + const float x_278 = asfloat(x_27[0].x); + const float x_280 = asfloat(x_27[0].y); + if ((x_278 > x_280)) { + return; + } + treeIndex_1 = (treeIndex_1 + 1); + param_26 = treeIndex_1; + param_27 = 13; + insert_i1_i1_(param_26, param_27); + const float4 x_285 = gl_FragCoord; + z = (float2(x_285.y, x_285.x) / float2(256.0f, 256.0f)); + const float x_289 = z.x; + param_28 = x_289; + const float x_290 = makeFrame_f1_(param_28); + x_1 = x_290; + const float x_292 = z.y; + param_29 = x_292; + const float x_293 = makeFrame_f1_(param_29); + y_1 = x_293; + sum = -100; + target_1 = 0; + { + for(; (target_1 < 20); target_1 = (target_1 + 1)) { + param_30 = target_1; + const int x_158 = search_i1_(param_30); + result = x_158; + if ((result > 0)) { + } else { + switch(result) { + case 0: { + return; + break; + } + case -1: { + sum = (sum + 1); + break; + } + default: { + break; + } + } + } + } + } + a = (x_1 + (y_1 * float(sum))); + const float x_313 = asfloat(x_27[0].x); + const float x_315 = asfloat(x_27[0].y); + if ((x_313 < x_315)) { + x_235 = float3(1.0f, 0.0f, 0.0f); + } else { + param_31 = a; + const float3 x_321 = hueColor_f1_(param_31); + x_235 = x_321; + } + const float3 x_322 = x_235; + x_GLF_color = float4(x_322.x, x_322.y, x_322.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..10ddae2a75 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.msl @@ -0,0 +1,426 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[10]; +}; +struct Obj { + tint_array_wrapper odd_numbers; + tint_array_wrapper even_numbers; +}; +struct tint_array_wrapper_1 { + BST arr[10]; +}; +struct tint_array_wrapper_2 { + float arr[50]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const tree, thread int* const data) { + int const x_74 = *(data); + (*(tree)).data = x_74; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +void insert_i1_i1_(constant buf0& x_27, thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper_1* const tint_symbol_5) { + int baseIndex = 0; + BST param = {}; + int param_1 = 0; + BST param_2 = {}; + int param_3 = 0; + int GLF_live8i = 0; + tint_array_wrapper_2 GLF_live8A = {}; + baseIndex = 0; + while (true) { + int const x_75 = baseIndex; + int const x_76 = *(treeIndex); + if ((x_75 <= x_76)) { + } else { + break; + } + int const x_77 = *(data_1); + int const x_78 = baseIndex; + int const x_79 = (*(tint_symbol_5)).arr[x_78].data; + if ((x_77 <= x_79)) { + int const x_80 = baseIndex; + int const x_81 = (*(tint_symbol_5)).arr[x_80].leftIndex; + if ((x_81 == -1)) { + int const x_82 = baseIndex; + int const x_83 = *(treeIndex); + (*(tint_symbol_5)).arr[x_82].leftIndex = x_83; + int const x_84 = *(treeIndex); + BST const x_350 = (*(tint_symbol_5)).arr[x_84]; + param = x_350; + int const x_85 = *(data_1); + param_1 = x_85; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + BST const x_352 = param; + (*(tint_symbol_5)).arr[x_84] = x_352; + return; + } else { + int const x_86 = baseIndex; + int const x_87 = (*(tint_symbol_5)).arr[x_86].leftIndex; + baseIndex = x_87; + continue; + } + } else { + int const x_88 = baseIndex; + int const x_89 = (*(tint_symbol_5)).arr[x_88].rightIndex; + if ((x_89 == -1)) { + int const x_90 = baseIndex; + int const x_91 = *(treeIndex); + (*(tint_symbol_5)).arr[x_90].rightIndex = x_91; + int const x_92 = *(treeIndex); + BST const x_362 = (*(tint_symbol_5)).arr[x_92]; + param_2 = x_362; + int const x_93 = *(data_1); + param_3 = x_93; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + BST const x_364 = param_2; + (*(tint_symbol_5)).arr[x_92] = x_364; + return; + } else { + GLF_live8i = 1; + int const x_94 = GLF_live8i; + int const x_95 = GLF_live8i; + int const x_96 = GLF_live8i; + int const x_369 = select(0, x_96, ((x_94 >= 0) && (x_95 < 50))); + float const x_371 = GLF_live8A.arr[0]; + float const x_373 = GLF_live8A.arr[x_369]; + GLF_live8A.arr[x_369] = (x_373 + x_371); + while (true) { + int const x_97 = baseIndex; + int const x_98 = (*(tint_symbol_5)).arr[x_97].rightIndex; + baseIndex = x_98; + { + float const x_382 = x_27.injectionSwitch.x; + float const x_384 = x_27.injectionSwitch.y; + if ((x_382 > x_384)) { + } else { + break; + } + } + } + continue; + } + } + } + return; +} + +int search_i1_(thread int* const target, thread tint_array_wrapper_1* const tint_symbol_6) { + int index = 0; + BST currentNode = {}; + int x_387 = 0; + index = 0; + while (true) { + int const x_99 = index; + if ((x_99 != -1)) { + } else { + break; + } + int const x_100 = index; + BST const x_395 = (*(tint_symbol_6)).arr[x_100]; + currentNode = x_395; + int const x_101 = currentNode.data; + int const x_102 = *(target); + if ((x_101 == x_102)) { + int const x_103 = *(target); + return x_103; + } + int const x_104 = *(target); + int const x_105 = currentNode.data; + if ((x_104 > x_105)) { + int const x_106 = currentNode.rightIndex; + x_387 = x_106; + } else { + int const x_107 = currentNode.leftIndex; + x_387 = x_107; + } + int const x_108 = x_387; + index = x_108; + } + return -1; +} + +float makeFrame_f1_(thread float* const v, thread tint_array_wrapper_1* const tint_symbol_7) { + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + float const x_418 = *(v); + *(v) = (x_418 * 6.5f); + float const x_420 = *(v); + if ((x_420 < 1.5f)) { + param_5 = 100; + int const x_110 = search_i1_(&(param_5), tint_symbol_7); + return float(x_110); + } + float const x_425 = *(v); + if ((x_425 < 4.0f)) { + return 0.0f; + } + float const x_429 = *(v); + param_6 = 6; + int const x_111 = search_i1_(&(param_6), tint_symbol_7); + if ((x_429 < float(x_111))) { + return 1.0f; + } + param_7 = 30; + int const x_112 = search_i1_(&(param_7), tint_symbol_7); + return (10.0f + float(x_112)); +} + +float3 hueColor_f1_(thread float* const angle, thread tint_array_wrapper_1* const tint_symbol_8) { + float nodeData = 0.0f; + int param_4 = 0; + param_4 = 15; + int const x_109 = search_i1_(&(param_4), tint_symbol_8); + nodeData = float(x_109); + float const x_409 = *(angle); + float const x_410 = nodeData; + return ((float3(30.0f, 30.0f, 30.0f) + (float3(1.0f, 5.0f, x_410) * x_409)) / float3(50.0f, 50.0f, 50.0f)); +} + +void main_1(constant buf0& x_27, thread tint_array_wrapper_1* const tint_symbol_9, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) { + int treeIndex_1 = 0; + BST param_8 = {}; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int GLF_live1_looplimiter2 = 0; + int GLF_live1i = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int GLF_live4_looplimiter3 = 0; + int GLF_live4i = 0; + int GLF_live4index = 0; + Obj GLF_live4obj = {}; + int param_24 = 0; + int param_25 = 0; + int param_26 = 0; + int param_27 = 0; + float2 z = 0.0f; + float x_1 = 0.0f; + float param_28 = 0.0f; + float y_1 = 0.0f; + float param_29 = 0.0f; + int sum = 0; + int target_1 = 0; + int result = 0; + int param_30 = 0; + float a = 0.0f; + float3 x_235 = 0.0f; + float param_31 = 0.0f; + treeIndex_1 = 0; + BST const x_237 = (*(tint_symbol_9)).arr[0]; + param_8 = x_237; + param_9 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_8), &(param_9)); + BST const x_239 = param_8; + (*(tint_symbol_9)).arr[0] = x_239; + int const x_113 = treeIndex_1; + treeIndex_1 = (x_113 + 1); + int const x_115 = treeIndex_1; + param_10 = x_115; + param_11 = 5; + insert_i1_i1_(x_27, &(param_10), &(param_11), tint_symbol_9); + int const x_116 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + GLF_live1_looplimiter2 = 0; + GLF_live1i = 0; + while (true) { + if (true) { + } else { + break; + } + int const x_118 = GLF_live1_looplimiter2; + if ((x_118 >= 7)) { + break; + } + int const x_119 = GLF_live1_looplimiter2; + GLF_live1_looplimiter2 = (x_119 + 1); + { + int const x_121 = GLF_live1i; + GLF_live1i = (x_121 + 1); + } + } + int const x_123 = treeIndex_1; + param_12 = x_123; + param_13 = 12; + insert_i1_i1_(x_27, &(param_12), &(param_13), tint_symbol_9); + int const x_124 = treeIndex_1; + treeIndex_1 = (x_124 + 1); + int const x_126 = treeIndex_1; + param_14 = x_126; + param_15 = 15; + insert_i1_i1_(x_27, &(param_14), &(param_15), tint_symbol_9); + int const x_127 = treeIndex_1; + treeIndex_1 = (x_127 + 1); + int const x_129 = treeIndex_1; + param_16 = x_129; + param_17 = 7; + insert_i1_i1_(x_27, &(param_16), &(param_17), tint_symbol_9); + int const x_130 = treeIndex_1; + treeIndex_1 = (x_130 + 1); + int const x_132 = treeIndex_1; + param_18 = x_132; + param_19 = 8; + insert_i1_i1_(x_27, &(param_18), &(param_19), tint_symbol_9); + int const x_133 = treeIndex_1; + treeIndex_1 = (x_133 + 1); + int const x_135 = treeIndex_1; + param_20 = x_135; + param_21 = 2; + insert_i1_i1_(x_27, &(param_20), &(param_21), tint_symbol_9); + int const x_136 = treeIndex_1; + treeIndex_1 = (x_136 + 1); + int const x_138 = treeIndex_1; + param_22 = x_138; + param_23 = 6; + insert_i1_i1_(x_27, &(param_22), &(param_23), tint_symbol_9); + int const x_139 = treeIndex_1; + treeIndex_1 = (x_139 + 1); + GLF_live4_looplimiter3 = 0; + GLF_live4i = 0; + while (true) { + if (true) { + } else { + break; + } + int const x_141 = GLF_live4_looplimiter3; + if ((x_141 >= 3)) { + break; + } + int const x_142 = GLF_live4_looplimiter3; + GLF_live4_looplimiter3 = (x_142 + 1); + GLF_live4index = 1; + int const x_144 = GLF_live4index; + int const x_145 = GLF_live4index; + int const x_146 = GLF_live4index; + float const x_269 = GLF_live4obj.even_numbers.arr[1]; + GLF_live4obj.even_numbers.arr[select(0, x_146, ((x_144 >= 0) && (x_145 < 10)))] = x_269; + int const x_147 = GLF_live4i; + int const x_148 = GLF_live4i; + int const x_149 = GLF_live4i; + GLF_live4obj.even_numbers.arr[select(0, x_149, ((x_147 >= 0) && (x_148 < 10)))] = 1.0f; + { + int const x_150 = GLF_live4i; + GLF_live4i = (x_150 + 1); + } + } + int const x_152 = treeIndex_1; + param_24 = x_152; + param_25 = 17; + insert_i1_i1_(x_27, &(param_24), &(param_25), tint_symbol_9); + float const x_278 = x_27.injectionSwitch.x; + float const x_280 = x_27.injectionSwitch.y; + if ((x_278 > x_280)) { + return; + } + int const x_153 = treeIndex_1; + treeIndex_1 = (x_153 + 1); + int const x_155 = treeIndex_1; + param_26 = x_155; + param_27 = 13; + insert_i1_i1_(x_27, &(param_26), &(param_27), tint_symbol_9); + float4 const x_285 = *(tint_symbol_10); + z = (float2(x_285.y, x_285.x) / float2(256.0f, 256.0f)); + float const x_289 = z.x; + param_28 = x_289; + float const x_290 = makeFrame_f1_(&(param_28), tint_symbol_9); + x_1 = x_290; + float const x_292 = z.y; + param_29 = x_292; + float const x_293 = makeFrame_f1_(&(param_29), tint_symbol_9); + y_1 = x_293; + sum = -100; + target_1 = 0; + while (true) { + int const x_156 = target_1; + if ((x_156 < 20)) { + } else { + break; + } + int const x_157 = target_1; + param_30 = x_157; + int const x_158 = search_i1_(&(param_30), tint_symbol_9); + result = x_158; + int const x_159 = result; + if ((x_159 > 0)) { + } else { + int const x_160 = result; + switch(x_160) { + case 0: { + return; + break; + } + case -1: { + int const x_161 = sum; + sum = (x_161 + 1); + break; + } + default: { + break; + } + } + } + { + int const x_163 = target_1; + target_1 = (x_163 + 1); + } + } + float const x_307 = x_1; + float const x_308 = y_1; + int const x_165 = sum; + a = (x_307 + (x_308 * float(x_165))); + float const x_313 = x_27.injectionSwitch.x; + float const x_315 = x_27.injectionSwitch.y; + if ((x_313 < x_315)) { + x_235 = float3(1.0f, 0.0f, 0.0f); + } else { + float const x_320 = a; + param_31 = x_320; + float3 const x_321 = hueColor_f1_(&(param_31), tint_symbol_9); + x_235 = x_321; + } + float3 const x_322 = x_235; + *(tint_symbol_11) = float4(x_322.x, x_322.y, x_322.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_27 [[buffer(0)]]) { + thread float4 tint_symbol_12 = 0.0f; + thread tint_array_wrapper_1 tint_symbol_13 = {}; + thread float4 tint_symbol_14 = 0.0f; + tint_symbol_12 = gl_FragCoord_param; + main_1(x_27, &(tint_symbol_13), &(tint_symbol_12), &(tint_symbol_14)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_14}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..ff486986c8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.spvasm @@ -0,0 +1,815 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 536 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree_1 "tree_1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_27 "x_27" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode_struct_BST_i1_i1_i11_i1_" + OpName %tree "tree" + OpName %data "data" + OpName %insert_i1_i1_ "insert_i1_i1_" + OpName %treeIndex "treeIndex" + OpName %data_1 "data_1" + OpName %baseIndex "baseIndex" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %GLF_live8i "GLF_live8i" + OpName %GLF_live8A "GLF_live8A" + OpName %search_i1_ "search_i1_" + OpName %target "target" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %x_387 "x_387" + OpName %makeFrame_f1_ "makeFrame_f1_" + OpName %v "v" + OpName %param_5 "param_5" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %hueColor_f1_ "hueColor_f1_" + OpName %angle "angle" + OpName %nodeData "nodeData" + OpName %param_4 "param_4" + OpName %main_1 "main_1" + OpName %treeIndex_1 "treeIndex_1" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %param_10 "param_10" + OpName %param_11 "param_11" + OpName %GLF_live1_looplimiter2 "GLF_live1_looplimiter2" + OpName %GLF_live1i "GLF_live1i" + OpName %param_12 "param_12" + OpName %param_13 "param_13" + OpName %param_14 "param_14" + OpName %param_15 "param_15" + OpName %param_16 "param_16" + OpName %param_17 "param_17" + OpName %param_18 "param_18" + OpName %param_19 "param_19" + OpName %param_20 "param_20" + OpName %param_21 "param_21" + OpName %param_22 "param_22" + OpName %param_23 "param_23" + OpName %GLF_live4_looplimiter3 "GLF_live4_looplimiter3" + OpName %GLF_live4i "GLF_live4i" + OpName %GLF_live4index "GLF_live4index" + OpName %Obj "Obj" + OpMemberName %Obj 0 "odd_numbers" + OpMemberName %Obj 1 "even_numbers" + OpName %GLF_live4obj "GLF_live4obj" + OpName %param_24 "param_24" + OpName %param_25 "param_25" + OpName %param_26 "param_26" + OpName %param_27 "param_27" + OpName %z "z" + OpName %x "x" + OpName %param_28 "param_28" + OpName %y "y" + OpName %param_29 "param_29" + OpName %sum "sum" + OpName %target_1 "target_1" + OpName %result "result" + OpName %param_30 "param_30" + OpName %a "a" + OpName %x_235 "x_235" + OpName %param_31 "param_31" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_27 NonWritable + OpDecorate %x_27 DescriptorSet 0 + OpDecorate %x_27 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_50 ArrayStride 4 + OpMemberDecorate %Obj 0 Offset 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %Obj 1 Offset 40 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %8 = OpConstantNull %_arr_BST_uint_10 + %tree_1 = OpVariable %_ptr_Private__arr_BST_uint_10 Private %8 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_27 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int_n1 = OpConstant %int -1 + %uint_2 = OpConstant %uint 2 + %43 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %49 = OpConstantNull %int + %51 = OpConstantNull %BST + %uint_50 = OpConstant %uint 50 +%_arr_float_uint_50 = OpTypeArray %float %uint_50 +%_ptr_Function__arr_float_uint_50 = OpTypePointer Function %_arr_float_uint_50 + %60 = OpConstantNull %_arr_float_uint_50 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %int_1 = OpConstant %int 1 + %int_50 = OpConstant %int 50 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %166 = OpTypeFunction %int %_ptr_Function_int + %207 = OpTypeFunction %float %_ptr_Function_float + %float_6_5 = OpConstant %float 6.5 + %float_1_5 = OpConstant %float 1.5 + %int_100 = OpConstant %int 100 + %float_4 = OpConstant %float 4 + %float_0 = OpConstant %float 0 + %int_6 = OpConstant %int 6 + %float_1 = OpConstant %float 1 + %int_30 = OpConstant %int 30 + %float_10 = OpConstant %float 10 + %v3float = OpTypeVector %float 3 + %252 = OpTypeFunction %v3float %_ptr_Function_float + %258 = OpConstantNull %float + %int_15 = OpConstant %int 15 + %float_30 = OpConstant %float 30 + %268 = OpConstantComposite %v3float %float_30 %float_30 %float_30 + %float_5 = OpConstant %float 5 + %float_50 = OpConstant %float 50 + %274 = OpConstantComposite %v3float %float_50 %float_50 %float_50 + %276 = OpTypeFunction %void +%_arr_float_uint_10 = OpTypeArray %float %uint_10 + %Obj = OpTypeStruct %_arr_float_uint_10 %_arr_float_uint_10 +%_ptr_Function_Obj = OpTypePointer Function %Obj + %305 = OpConstantNull %Obj +%_ptr_Function_v2float = OpTypePointer Function %v2float + %312 = OpConstantNull %v2float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %324 = OpConstantNull %v3float + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %true = OpConstantTrue %bool + %int_7 = OpConstant %int 7 + %int_12 = OpConstant %int 12 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_10 = OpConstant %int 10 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %float_256 = OpConstant %float 256 + %462 = OpConstantComposite %v2float %float_256 %float_256 + %int_n100 = OpConstant %int -100 + %int_20 = OpConstant %int 20 + %514 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %523 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %23 + %tree = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %32 = OpLoad %int %data + %35 = OpAccessChain %_ptr_Function_int %tree %uint_0 + OpStore %35 %32 + %38 = OpAccessChain %_ptr_Function_int %tree %uint_1 + OpStore %38 %int_n1 + %42 = OpAccessChain %_ptr_Function_int %tree %uint_2 + OpStore %42 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %43 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_1 = OpFunctionParameter %_ptr_Function_int + %47 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function %49 + %param = OpVariable %_ptr_Function_BST Function %51 + %param_1 = OpVariable %_ptr_Function_int Function %49 + %param_2 = OpVariable %_ptr_Function_BST Function %51 + %param_3 = OpVariable %_ptr_Function_int Function %49 + %GLF_live8i = OpVariable %_ptr_Function_int Function %49 + %GLF_live8A = OpVariable %_ptr_Function__arr_float_uint_50 Function %60 + OpStore %baseIndex %int_0 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %66 = OpLoad %int %baseIndex + %68 = OpLoad %int %treeIndex + %69 = OpSLessThanEqual %bool %66 %68 + OpSelectionMerge %71 None + OpBranchConditional %69 %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %63 + %71 = OpLabel + %75 = OpLoad %int %data_1 + %76 = OpLoad %int %baseIndex + %78 = OpAccessChain %_ptr_Private_int %tree_1 %76 %uint_0 + %79 = OpLoad %int %78 + %80 = OpSLessThanEqual %bool %75 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %84 = OpLoad %int %baseIndex + %85 = OpAccessChain %_ptr_Private_int %tree_1 %84 %uint_1 + %86 = OpLoad %int %85 + %87 = OpIEqual %bool %86 %int_n1 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %90 + %89 = OpLabel + %91 = OpLoad %int %baseIndex + %93 = OpLoad %int %treeIndex + %94 = OpAccessChain %_ptr_Private_int %tree_1 %91 %uint_1 + OpStore %94 %93 + %96 = OpLoad %int %treeIndex + %98 = OpAccessChain %_ptr_Private_BST %tree_1 %96 + %99 = OpLoad %BST %98 + OpStore %param %99 + %101 = OpLoad %int %data_1 + OpStore %param_1 %101 + %102 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_1 + %105 = OpLoad %BST %param + %106 = OpAccessChain %_ptr_Private_BST %tree_1 %96 + OpStore %106 %105 + OpReturn + %90 = OpLabel + %107 = OpLoad %int %baseIndex + %108 = OpAccessChain %_ptr_Private_int %tree_1 %107 %uint_1 + %109 = OpLoad %int %108 + OpStore %baseIndex %109 + OpBranch %64 + %88 = OpLabel + OpBranch %81 + %83 = OpLabel + %110 = OpLoad %int %baseIndex + %111 = OpAccessChain %_ptr_Private_int %tree_1 %110 %uint_2 + %112 = OpLoad %int %111 + %113 = OpIEqual %bool %112 %int_n1 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %116 + %115 = OpLabel + %117 = OpLoad %int %baseIndex + %119 = OpLoad %int %treeIndex + %120 = OpAccessChain %_ptr_Private_int %tree_1 %117 %uint_2 + OpStore %120 %119 + %122 = OpLoad %int %treeIndex + %123 = OpAccessChain %_ptr_Private_BST %tree_1 %122 + %124 = OpLoad %BST %123 + OpStore %param_2 %124 + %126 = OpLoad %int %data_1 + OpStore %param_3 %126 + %127 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_2 %param_3 + %130 = OpLoad %BST %param_2 + %131 = OpAccessChain %_ptr_Private_BST %tree_1 %122 + OpStore %131 %130 + OpReturn + %116 = OpLabel + OpStore %GLF_live8i %int_1 + %133 = OpLoad %int %GLF_live8i + %134 = OpLoad %int %GLF_live8i + %135 = OpLoad %int %GLF_live8i + %137 = OpSGreaterThanEqual %bool %133 %int_0 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %138 + %139 = OpLabel + %141 = OpSLessThan %bool %134 %int_50 + OpBranch %138 + %138 = OpLabel + %142 = OpPhi %bool %137 %116 %141 %139 + %136 = OpSelect %int %142 %135 %int_0 + %144 = OpAccessChain %_ptr_Function_float %GLF_live8A %int_0 + %145 = OpLoad %float %144 + %146 = OpAccessChain %_ptr_Function_float %GLF_live8A %136 + %147 = OpLoad %float %146 + %148 = OpAccessChain %_ptr_Function_float %GLF_live8A %136 + %149 = OpFAdd %float %147 %145 + OpStore %148 %149 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %154 = OpLoad %int %baseIndex + %155 = OpAccessChain %_ptr_Private_int %tree_1 %154 %uint_2 + %156 = OpLoad %int %155 + OpStore %baseIndex %156 + OpBranch %152 + %152 = OpLabel + %158 = OpAccessChain %_ptr_Uniform_float %x_27 %uint_0 %uint_0 + %159 = OpLoad %float %158 + %160 = OpAccessChain %_ptr_Uniform_float %x_27 %uint_0 %uint_1 + %161 = OpLoad %float %160 + %162 = OpFOrdGreaterThan %bool %159 %161 + OpSelectionMerge %163 None + OpBranchConditional %162 %164 %165 + %164 = OpLabel + OpBranch %163 + %165 = OpLabel + OpBranch %151 + %163 = OpLabel + OpBranch %150 + %151 = OpLabel + OpBranch %64 + %114 = OpLabel + OpBranch %81 + %81 = OpLabel + OpBranch %64 + %64 = OpLabel + OpBranch %62 + %63 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %166 + %target = OpFunctionParameter %_ptr_Function_int + %169 = OpLabel + %index = OpVariable %_ptr_Function_int Function %49 +%currentNode = OpVariable %_ptr_Function_BST Function %51 + %x_387 = OpVariable %_ptr_Function_int Function %49 + OpStore %index %int_0 + OpBranch %173 + %173 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %int %index + %178 = OpINotEqual %bool %177 %int_n1 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %181 + %180 = OpLabel + OpBranch %179 + %181 = OpLabel + OpBranch %174 + %179 = OpLabel + %182 = OpLoad %int %index + %183 = OpAccessChain %_ptr_Private_BST %tree_1 %182 + %184 = OpLoad %BST %183 + OpStore %currentNode %184 + %185 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %186 = OpLoad %int %185 + %188 = OpLoad %int %target + %189 = OpIEqual %bool %186 %188 + OpSelectionMerge %190 None + OpBranchConditional %189 %191 %190 + %191 = OpLabel + %193 = OpLoad %int %target + OpReturnValue %193 + %190 = OpLabel + %195 = OpLoad %int %target + %196 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %197 = OpLoad %int %196 + %198 = OpSGreaterThan %bool %195 %197 + OpSelectionMerge %199 None + OpBranchConditional %198 %200 %201 + %200 = OpLabel + %202 = OpAccessChain %_ptr_Function_int %currentNode %uint_2 + %203 = OpLoad %int %202 + OpStore %x_387 %203 + OpBranch %199 + %201 = OpLabel + %204 = OpAccessChain %_ptr_Function_int %currentNode %uint_1 + %205 = OpLoad %int %204 + OpStore %x_387 %205 + OpBranch %199 + %199 = OpLabel + %206 = OpLoad %int %x_387 + OpStore %index %206 + OpBranch %175 + %175 = OpLabel + OpBranch %173 + %174 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd +%makeFrame_f1_ = OpFunction %float None %207 + %v = OpFunctionParameter %_ptr_Function_float + %210 = OpLabel + %param_5 = OpVariable %_ptr_Function_int Function %49 + %param_6 = OpVariable %_ptr_Function_int Function %49 + %param_7 = OpVariable %_ptr_Function_int Function %49 + %215 = OpLoad %float %v + %218 = OpFMul %float %215 %float_6_5 + OpStore %v %218 + %220 = OpLoad %float %v + %222 = OpFOrdLessThan %bool %220 %float_1_5 + OpSelectionMerge %223 None + OpBranchConditional %222 %224 %223 + %224 = OpLabel + OpStore %param_5 %int_100 + %226 = OpFunctionCall %int %search_i1_ %param_5 + %228 = OpConvertSToF %float %226 + OpReturnValue %228 + %223 = OpLabel + %230 = OpLoad %float %v + %232 = OpFOrdLessThan %bool %230 %float_4 + OpSelectionMerge %233 None + OpBranchConditional %232 %234 %233 + %234 = OpLabel + OpReturnValue %float_0 + %233 = OpLabel + %237 = OpLoad %float %v + OpStore %param_6 %int_6 + %239 = OpFunctionCall %int %search_i1_ %param_6 + %241 = OpConvertSToF %float %239 + %242 = OpFOrdLessThan %bool %237 %241 + OpSelectionMerge %243 None + OpBranchConditional %242 %244 %243 + %244 = OpLabel + OpReturnValue %float_1 + %243 = OpLabel + OpStore %param_7 %int_30 + %247 = OpFunctionCall %int %search_i1_ %param_7 + %250 = OpConvertSToF %float %247 + %251 = OpFAdd %float %float_10 %250 + OpReturnValue %251 + OpFunctionEnd +%hueColor_f1_ = OpFunction %v3float None %252 + %angle = OpFunctionParameter %_ptr_Function_float + %256 = OpLabel + %nodeData = OpVariable %_ptr_Function_float Function %258 + %param_4 = OpVariable %_ptr_Function_int Function %49 + OpStore %param_4 %int_15 + %261 = OpFunctionCall %int %search_i1_ %param_4 + %263 = OpConvertSToF %float %261 + OpStore %nodeData %263 + %265 = OpLoad %float %angle + %266 = OpLoad %float %nodeData + %270 = OpCompositeConstruct %v3float %float_1 %float_5 %266 + %271 = OpVectorTimesScalar %v3float %270 %265 + %272 = OpFAdd %v3float %268 %271 + %275 = OpFDiv %v3float %272 %274 + OpReturnValue %275 + OpFunctionEnd + %main_1 = OpFunction %void None %276 + %278 = OpLabel +%treeIndex_1 = OpVariable %_ptr_Function_int Function %49 + %param_8 = OpVariable %_ptr_Function_BST Function %51 + %param_9 = OpVariable %_ptr_Function_int Function %49 + %param_10 = OpVariable %_ptr_Function_int Function %49 + %param_11 = OpVariable %_ptr_Function_int Function %49 +%GLF_live1_looplimiter2 = OpVariable %_ptr_Function_int Function %49 + %GLF_live1i = OpVariable %_ptr_Function_int Function %49 + %param_12 = OpVariable %_ptr_Function_int Function %49 + %param_13 = OpVariable %_ptr_Function_int Function %49 + %param_14 = OpVariable %_ptr_Function_int Function %49 + %param_15 = OpVariable %_ptr_Function_int Function %49 + %param_16 = OpVariable %_ptr_Function_int Function %49 + %param_17 = OpVariable %_ptr_Function_int Function %49 + %param_18 = OpVariable %_ptr_Function_int Function %49 + %param_19 = OpVariable %_ptr_Function_int Function %49 + %param_20 = OpVariable %_ptr_Function_int Function %49 + %param_21 = OpVariable %_ptr_Function_int Function %49 + %param_22 = OpVariable %_ptr_Function_int Function %49 + %param_23 = OpVariable %_ptr_Function_int Function %49 +%GLF_live4_looplimiter3 = OpVariable %_ptr_Function_int Function %49 + %GLF_live4i = OpVariable %_ptr_Function_int Function %49 +%GLF_live4index = OpVariable %_ptr_Function_int Function %49 +%GLF_live4obj = OpVariable %_ptr_Function_Obj Function %305 + %param_24 = OpVariable %_ptr_Function_int Function %49 + %param_25 = OpVariable %_ptr_Function_int Function %49 + %param_26 = OpVariable %_ptr_Function_int Function %49 + %param_27 = OpVariable %_ptr_Function_int Function %49 + %z = OpVariable %_ptr_Function_v2float Function %312 + %x = OpVariable %_ptr_Function_float Function %258 + %param_28 = OpVariable %_ptr_Function_float Function %258 + %y = OpVariable %_ptr_Function_float Function %258 + %param_29 = OpVariable %_ptr_Function_float Function %258 + %sum = OpVariable %_ptr_Function_int Function %49 + %target_1 = OpVariable %_ptr_Function_int Function %49 + %result = OpVariable %_ptr_Function_int Function %49 + %param_30 = OpVariable %_ptr_Function_int Function %49 + %a = OpVariable %_ptr_Function_float Function %258 + %x_235 = OpVariable %_ptr_Function_v3float Function %324 + %param_31 = OpVariable %_ptr_Function_float Function %258 + OpStore %treeIndex_1 %int_0 + %326 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + %327 = OpLoad %BST %326 + OpStore %param_8 %327 + OpStore %param_9 %int_9 + %329 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_8 %param_9 + %332 = OpLoad %BST %param_8 + %333 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + OpStore %333 %332 + %334 = OpLoad %int %treeIndex_1 + %335 = OpIAdd %int %334 %int_1 + OpStore %treeIndex_1 %335 + %336 = OpLoad %int %treeIndex_1 + OpStore %param_10 %336 + OpStore %param_11 %int_5 + %338 = OpFunctionCall %void %insert_i1_i1_ %param_10 %param_11 + %341 = OpLoad %int %treeIndex_1 + %342 = OpIAdd %int %341 %int_1 + OpStore %treeIndex_1 %342 + OpStore %GLF_live1_looplimiter2 %int_0 + OpStore %GLF_live1i %int_0 + OpBranch %343 + %343 = OpLabel + OpLoopMerge %344 %345 None + OpBranch %346 + %346 = OpLabel + OpSelectionMerge %348 None + OpBranchConditional %true %349 %350 + %349 = OpLabel + OpBranch %348 + %350 = OpLabel + OpBranch %344 + %348 = OpLabel + %351 = OpLoad %int %GLF_live1_looplimiter2 + %353 = OpSGreaterThanEqual %bool %351 %int_7 + OpSelectionMerge %354 None + OpBranchConditional %353 %355 %354 + %355 = OpLabel + OpBranch %344 + %354 = OpLabel + %356 = OpLoad %int %GLF_live1_looplimiter2 + %357 = OpIAdd %int %356 %int_1 + OpStore %GLF_live1_looplimiter2 %357 + OpBranch %345 + %345 = OpLabel + %358 = OpLoad %int %GLF_live1i + %359 = OpIAdd %int %358 %int_1 + OpStore %GLF_live1i %359 + OpBranch %343 + %344 = OpLabel + %360 = OpLoad %int %treeIndex_1 + OpStore %param_12 %360 + OpStore %param_13 %int_12 + %362 = OpFunctionCall %void %insert_i1_i1_ %param_12 %param_13 + %365 = OpLoad %int %treeIndex_1 + %366 = OpIAdd %int %365 %int_1 + OpStore %treeIndex_1 %366 + %367 = OpLoad %int %treeIndex_1 + OpStore %param_14 %367 + OpStore %param_15 %int_15 + %368 = OpFunctionCall %void %insert_i1_i1_ %param_14 %param_15 + %371 = OpLoad %int %treeIndex_1 + %372 = OpIAdd %int %371 %int_1 + OpStore %treeIndex_1 %372 + %373 = OpLoad %int %treeIndex_1 + OpStore %param_16 %373 + OpStore %param_17 %int_7 + %374 = OpFunctionCall %void %insert_i1_i1_ %param_16 %param_17 + %377 = OpLoad %int %treeIndex_1 + %378 = OpIAdd %int %377 %int_1 + OpStore %treeIndex_1 %378 + %379 = OpLoad %int %treeIndex_1 + OpStore %param_18 %379 + OpStore %param_19 %int_8 + %381 = OpFunctionCall %void %insert_i1_i1_ %param_18 %param_19 + %384 = OpLoad %int %treeIndex_1 + %385 = OpIAdd %int %384 %int_1 + OpStore %treeIndex_1 %385 + %386 = OpLoad %int %treeIndex_1 + OpStore %param_20 %386 + OpStore %param_21 %int_2 + %388 = OpFunctionCall %void %insert_i1_i1_ %param_20 %param_21 + %391 = OpLoad %int %treeIndex_1 + %392 = OpIAdd %int %391 %int_1 + OpStore %treeIndex_1 %392 + %393 = OpLoad %int %treeIndex_1 + OpStore %param_22 %393 + OpStore %param_23 %int_6 + %394 = OpFunctionCall %void %insert_i1_i1_ %param_22 %param_23 + %397 = OpLoad %int %treeIndex_1 + %398 = OpIAdd %int %397 %int_1 + OpStore %treeIndex_1 %398 + OpStore %GLF_live4_looplimiter3 %int_0 + OpStore %GLF_live4i %int_0 + OpBranch %399 + %399 = OpLabel + OpLoopMerge %400 %401 None + OpBranch %402 + %402 = OpLabel + OpSelectionMerge %403 None + OpBranchConditional %true %404 %405 + %404 = OpLabel + OpBranch %403 + %405 = OpLabel + OpBranch %400 + %403 = OpLabel + %406 = OpLoad %int %GLF_live4_looplimiter3 + %408 = OpSGreaterThanEqual %bool %406 %int_3 + OpSelectionMerge %409 None + OpBranchConditional %408 %410 %409 + %410 = OpLabel + OpBranch %400 + %409 = OpLabel + %411 = OpLoad %int %GLF_live4_looplimiter3 + %412 = OpIAdd %int %411 %int_1 + OpStore %GLF_live4_looplimiter3 %412 + OpStore %GLF_live4index %int_1 + %413 = OpLoad %int %GLF_live4index + %414 = OpLoad %int %GLF_live4index + %415 = OpLoad %int %GLF_live4index + %416 = OpAccessChain %_ptr_Function_float %GLF_live4obj %uint_1 %int_1 + %417 = OpLoad %float %416 + %419 = OpSGreaterThanEqual %bool %413 %int_0 + OpSelectionMerge %420 None + OpBranchConditional %419 %421 %420 + %421 = OpLabel + %423 = OpSLessThan %bool %414 %int_10 + OpBranch %420 + %420 = OpLabel + %424 = OpPhi %bool %419 %409 %423 %421 + %418 = OpSelect %int %424 %415 %int_0 + %425 = OpAccessChain %_ptr_Function_float %GLF_live4obj %uint_1 %418 + OpStore %425 %417 + %426 = OpLoad %int %GLF_live4i + %427 = OpLoad %int %GLF_live4i + %428 = OpLoad %int %GLF_live4i + %430 = OpSGreaterThanEqual %bool %426 %int_0 + OpSelectionMerge %431 None + OpBranchConditional %430 %432 %431 + %432 = OpLabel + %433 = OpSLessThan %bool %427 %int_10 + OpBranch %431 + %431 = OpLabel + %434 = OpPhi %bool %430 %420 %433 %432 + %429 = OpSelect %int %434 %428 %int_0 + %435 = OpAccessChain %_ptr_Function_float %GLF_live4obj %uint_1 %429 + OpStore %435 %float_1 + OpBranch %401 + %401 = OpLabel + %436 = OpLoad %int %GLF_live4i + %437 = OpIAdd %int %436 %int_1 + OpStore %GLF_live4i %437 + OpBranch %399 + %400 = OpLabel + %438 = OpLoad %int %treeIndex_1 + OpStore %param_24 %438 + OpStore %param_25 %int_17 + %440 = OpFunctionCall %void %insert_i1_i1_ %param_24 %param_25 + %443 = OpAccessChain %_ptr_Uniform_float %x_27 %uint_0 %uint_0 + %444 = OpLoad %float %443 + %445 = OpAccessChain %_ptr_Uniform_float %x_27 %uint_0 %uint_1 + %446 = OpLoad %float %445 + %447 = OpFOrdGreaterThan %bool %444 %446 + OpSelectionMerge %448 None + OpBranchConditional %447 %449 %448 + %449 = OpLabel + OpReturn + %448 = OpLabel + %450 = OpLoad %int %treeIndex_1 + %451 = OpIAdd %int %450 %int_1 + OpStore %treeIndex_1 %451 + %452 = OpLoad %int %treeIndex_1 + OpStore %param_26 %452 + OpStore %param_27 %int_13 + %454 = OpFunctionCall %void %insert_i1_i1_ %param_26 %param_27 + %457 = OpLoad %v4float %gl_FragCoord + %458 = OpCompositeExtract %float %457 1 + %459 = OpCompositeExtract %float %457 0 + %460 = OpCompositeConstruct %v2float %458 %459 + %463 = OpFDiv %v2float %460 %462 + OpStore %z %463 + %464 = OpAccessChain %_ptr_Function_float %z %uint_0 + %465 = OpLoad %float %464 + OpStore %param_28 %465 + %466 = OpFunctionCall %float %makeFrame_f1_ %param_28 + OpStore %x %466 + %468 = OpAccessChain %_ptr_Function_float %z %uint_1 + %469 = OpLoad %float %468 + OpStore %param_29 %469 + %470 = OpFunctionCall %float %makeFrame_f1_ %param_29 + OpStore %y %470 + OpStore %sum %int_n100 + OpStore %target_1 %int_0 + OpBranch %473 + %473 = OpLabel + OpLoopMerge %474 %475 None + OpBranch %476 + %476 = OpLabel + %477 = OpLoad %int %target_1 + %479 = OpSLessThan %bool %477 %int_20 + OpSelectionMerge %480 None + OpBranchConditional %479 %481 %482 + %481 = OpLabel + OpBranch %480 + %482 = OpLabel + OpBranch %474 + %480 = OpLabel + %483 = OpLoad %int %target_1 + OpStore %param_30 %483 + %484 = OpFunctionCall %int %search_i1_ %param_30 + OpStore %result %484 + %486 = OpLoad %int %result + %487 = OpSGreaterThan %bool %486 %int_0 + OpSelectionMerge %488 None + OpBranchConditional %487 %489 %490 + %489 = OpLabel + OpBranch %488 + %490 = OpLabel + %491 = OpLoad %int %result + OpSelectionMerge %492 None + OpSwitch %491 %493 0 %494 -1 %495 + %494 = OpLabel + OpReturn + %495 = OpLabel + %496 = OpLoad %int %sum + %497 = OpIAdd %int %496 %int_1 + OpStore %sum %497 + OpBranch %492 + %493 = OpLabel + OpBranch %492 + %492 = OpLabel + OpBranch %488 + %488 = OpLabel + OpBranch %475 + %475 = OpLabel + %498 = OpLoad %int %target_1 + %499 = OpIAdd %int %498 %int_1 + OpStore %target_1 %499 + OpBranch %473 + %474 = OpLabel + %500 = OpLoad %float %x + %501 = OpLoad %float %y + %502 = OpLoad %int %sum + %503 = OpConvertSToF %float %502 + %504 = OpFMul %float %501 %503 + %505 = OpFAdd %float %500 %504 + OpStore %a %505 + %506 = OpAccessChain %_ptr_Uniform_float %x_27 %uint_0 %uint_0 + %507 = OpLoad %float %506 + %508 = OpAccessChain %_ptr_Uniform_float %x_27 %uint_0 %uint_1 + %509 = OpLoad %float %508 + %510 = OpFOrdLessThan %bool %507 %509 + OpSelectionMerge %511 None + OpBranchConditional %510 %512 %513 + %512 = OpLabel + OpStore %x_235 %514 + OpBranch %511 + %513 = OpLabel + %515 = OpLoad %float %a + OpStore %param_31 %515 + %516 = OpFunctionCall %v3float %hueColor_f1_ %param_31 + OpStore %x_235 %516 + OpBranch %511 + %511 = OpLabel + %518 = OpLoad %v3float %x_235 + %519 = OpCompositeExtract %float %518 0 + %520 = OpCompositeExtract %float %518 1 + %521 = OpCompositeExtract %float %518 2 + %522 = OpCompositeConstruct %v4float %519 %520 %521 %float_1 + OpStore %x_GLF_color %522 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %523 +%tint_symbol_1 = OpFunctionParameter %main_out + %527 = OpLabel + %528 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %528 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %276 + %530 = OpLabel + %531 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %531 + %532 = OpFunctionCall %void %main_1 + %534 = OpLoad %v4float %x_GLF_color + %535 = OpCompositeConstruct %main_out %534 + %533 = OpFunctionCall %void %tint_symbol_3 %535 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 152[%152] is not post dominated by the back-edge block 163[%163] + %163 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..eaa0aec7ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.wgsl @@ -0,0 +1,420 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +struct Obj { + odd_numbers : array; + even_numbers : array; +}; + +var tree_1 : array; + +[[group(0), binding(0)]] var x_27 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(tree : ptr, data : ptr) { + let x_74 : i32 = *(data); + (*(tree)).data = x_74; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + var GLF_live8i : i32; + var GLF_live8A : array; + baseIndex = 0; + loop { + let x_75 : i32 = baseIndex; + let x_76 : i32 = *(treeIndex); + if ((x_75 <= x_76)) { + } else { + break; + } + let x_77 : i32 = *(data_1); + let x_78 : i32 = baseIndex; + let x_79 : i32 = tree_1[x_78].data; + if ((x_77 <= x_79)) { + let x_80 : i32 = baseIndex; + let x_81 : i32 = tree_1[x_80].leftIndex; + if ((x_81 == -1)) { + let x_82 : i32 = baseIndex; + let x_83 : i32 = *(treeIndex); + tree_1[x_82].leftIndex = x_83; + let x_84 : i32 = *(treeIndex); + let x_350 : BST = tree_1[x_84]; + param = x_350; + let x_85 : i32 = *(data_1); + param_1 = x_85; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_352 : BST = param; + tree_1[x_84] = x_352; + return; + } else { + let x_86 : i32 = baseIndex; + let x_87 : i32 = tree_1[x_86].leftIndex; + baseIndex = x_87; + continue; + } + } else { + let x_88 : i32 = baseIndex; + let x_89 : i32 = tree_1[x_88].rightIndex; + if ((x_89 == -1)) { + let x_90 : i32 = baseIndex; + let x_91 : i32 = *(treeIndex); + tree_1[x_90].rightIndex = x_91; + let x_92 : i32 = *(treeIndex); + let x_362 : BST = tree_1[x_92]; + param_2 = x_362; + let x_93 : i32 = *(data_1); + param_3 = x_93; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_364 : BST = param_2; + tree_1[x_92] = x_364; + return; + } else { + GLF_live8i = 1; + let x_94 : i32 = GLF_live8i; + let x_95 : i32 = GLF_live8i; + let x_96 : i32 = GLF_live8i; + let x_369 : i32 = select(0, x_96, ((x_94 >= 0) && (x_95 < 50))); + let x_371 : f32 = GLF_live8A[0]; + let x_373 : f32 = GLF_live8A[x_369]; + GLF_live8A[x_369] = (x_373 + x_371); + loop { + let x_97 : i32 = baseIndex; + let x_98 : i32 = tree_1[x_97].rightIndex; + baseIndex = x_98; + + continuing { + let x_382 : f32 = x_27.injectionSwitch.x; + let x_384 : f32 = x_27.injectionSwitch.y; + if ((x_382 > x_384)) { + } else { + break; + } + } + } + continue; + } + } + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_387 : i32; + index = 0; + loop { + let x_99 : i32 = index; + if ((x_99 != -1)) { + } else { + break; + } + let x_100 : i32 = index; + let x_395 : BST = tree_1[x_100]; + currentNode = x_395; + let x_101 : i32 = currentNode.data; + let x_102 : i32 = *(target); + if ((x_101 == x_102)) { + let x_103 : i32 = *(target); + return x_103; + } + let x_104 : i32 = *(target); + let x_105 : i32 = currentNode.data; + if ((x_104 > x_105)) { + let x_106 : i32 = currentNode.rightIndex; + x_387 = x_106; + } else { + let x_107 : i32 = currentNode.leftIndex; + x_387 = x_107; + } + let x_108 : i32 = x_387; + index = x_108; + } + return -1; +} + +fn makeFrame_f1_(v : ptr) -> f32 { + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + let x_418 : f32 = *(v); + *(v) = (x_418 * 6.5); + let x_420 : f32 = *(v); + if ((x_420 < 1.5)) { + param_5 = 100; + let x_110 : i32 = search_i1_(&(param_5)); + return f32(x_110); + } + let x_425 : f32 = *(v); + if ((x_425 < 4.0)) { + return 0.0; + } + let x_429 : f32 = *(v); + param_6 = 6; + let x_111 : i32 = search_i1_(&(param_6)); + if ((x_429 < f32(x_111))) { + return 1.0; + } + param_7 = 30; + let x_112 : i32 = search_i1_(&(param_7)); + return (10.0 + f32(x_112)); +} + +fn hueColor_f1_(angle : ptr) -> vec3 { + var nodeData : f32; + var param_4 : i32; + param_4 = 15; + let x_109 : i32 = search_i1_(&(param_4)); + nodeData = f32(x_109); + let x_409 : f32 = *(angle); + let x_410 : f32 = nodeData; + return ((vec3(30.0, 30.0, 30.0) + (vec3(1.0, 5.0, x_410) * x_409)) / vec3(50.0, 50.0, 50.0)); +} + +fn main_1() { + var treeIndex_1 : i32; + var param_8 : BST; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var GLF_live1_looplimiter2 : i32; + var GLF_live1i : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var GLF_live4_looplimiter3 : i32; + var GLF_live4i : i32; + var GLF_live4index : i32; + var GLF_live4obj : Obj; + var param_24 : i32; + var param_25 : i32; + var param_26 : i32; + var param_27 : i32; + var z : vec2; + var x : f32; + var param_28 : f32; + var y : f32; + var param_29 : f32; + var sum : i32; + var target_1 : i32; + var result : i32; + var param_30 : i32; + var a : f32; + var x_235 : vec3; + var param_31 : f32; + treeIndex_1 = 0; + let x_237 : BST = tree_1[0]; + param_8 = x_237; + param_9 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_8), &(param_9)); + let x_239 : BST = param_8; + tree_1[0] = x_239; + let x_113 : i32 = treeIndex_1; + treeIndex_1 = (x_113 + 1); + let x_115 : i32 = treeIndex_1; + param_10 = x_115; + param_11 = 5; + insert_i1_i1_(&(param_10), &(param_11)); + let x_116 : i32 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + GLF_live1_looplimiter2 = 0; + GLF_live1i = 0; + loop { + if (true) { + } else { + break; + } + let x_118 : i32 = GLF_live1_looplimiter2; + if ((x_118 >= 7)) { + break; + } + let x_119 : i32 = GLF_live1_looplimiter2; + GLF_live1_looplimiter2 = (x_119 + 1); + + continuing { + let x_121 : i32 = GLF_live1i; + GLF_live1i = (x_121 + 1); + } + } + let x_123 : i32 = treeIndex_1; + param_12 = x_123; + param_13 = 12; + insert_i1_i1_(&(param_12), &(param_13)); + let x_124 : i32 = treeIndex_1; + treeIndex_1 = (x_124 + 1); + let x_126 : i32 = treeIndex_1; + param_14 = x_126; + param_15 = 15; + insert_i1_i1_(&(param_14), &(param_15)); + let x_127 : i32 = treeIndex_1; + treeIndex_1 = (x_127 + 1); + let x_129 : i32 = treeIndex_1; + param_16 = x_129; + param_17 = 7; + insert_i1_i1_(&(param_16), &(param_17)); + let x_130 : i32 = treeIndex_1; + treeIndex_1 = (x_130 + 1); + let x_132 : i32 = treeIndex_1; + param_18 = x_132; + param_19 = 8; + insert_i1_i1_(&(param_18), &(param_19)); + let x_133 : i32 = treeIndex_1; + treeIndex_1 = (x_133 + 1); + let x_135 : i32 = treeIndex_1; + param_20 = x_135; + param_21 = 2; + insert_i1_i1_(&(param_20), &(param_21)); + let x_136 : i32 = treeIndex_1; + treeIndex_1 = (x_136 + 1); + let x_138 : i32 = treeIndex_1; + param_22 = x_138; + param_23 = 6; + insert_i1_i1_(&(param_22), &(param_23)); + let x_139 : i32 = treeIndex_1; + treeIndex_1 = (x_139 + 1); + GLF_live4_looplimiter3 = 0; + GLF_live4i = 0; + loop { + if (true) { + } else { + break; + } + let x_141 : i32 = GLF_live4_looplimiter3; + if ((x_141 >= 3)) { + break; + } + let x_142 : i32 = GLF_live4_looplimiter3; + GLF_live4_looplimiter3 = (x_142 + 1); + GLF_live4index = 1; + let x_144 : i32 = GLF_live4index; + let x_145 : i32 = GLF_live4index; + let x_146 : i32 = GLF_live4index; + let x_269 : f32 = GLF_live4obj.even_numbers[1]; + GLF_live4obj.even_numbers[select(0, x_146, ((x_144 >= 0) && (x_145 < 10)))] = x_269; + let x_147 : i32 = GLF_live4i; + let x_148 : i32 = GLF_live4i; + let x_149 : i32 = GLF_live4i; + GLF_live4obj.even_numbers[select(0, x_149, ((x_147 >= 0) && (x_148 < 10)))] = 1.0; + + continuing { + let x_150 : i32 = GLF_live4i; + GLF_live4i = (x_150 + 1); + } + } + let x_152 : i32 = treeIndex_1; + param_24 = x_152; + param_25 = 17; + insert_i1_i1_(&(param_24), &(param_25)); + let x_278 : f32 = x_27.injectionSwitch.x; + let x_280 : f32 = x_27.injectionSwitch.y; + if ((x_278 > x_280)) { + return; + } + let x_153 : i32 = treeIndex_1; + treeIndex_1 = (x_153 + 1); + let x_155 : i32 = treeIndex_1; + param_26 = x_155; + param_27 = 13; + insert_i1_i1_(&(param_26), &(param_27)); + let x_285 : vec4 = gl_FragCoord; + z = (vec2(x_285.y, x_285.x) / vec2(256.0, 256.0)); + let x_289 : f32 = z.x; + param_28 = x_289; + let x_290 : f32 = makeFrame_f1_(&(param_28)); + x = x_290; + let x_292 : f32 = z.y; + param_29 = x_292; + let x_293 : f32 = makeFrame_f1_(&(param_29)); + y = x_293; + sum = -100; + target_1 = 0; + loop { + let x_156 : i32 = target_1; + if ((x_156 < 20)) { + } else { + break; + } + let x_157 : i32 = target_1; + param_30 = x_157; + let x_158 : i32 = search_i1_(&(param_30)); + result = x_158; + let x_159 : i32 = result; + if ((x_159 > 0)) { + } else { + let x_160 : i32 = result; + switch(x_160) { + case 0: { + return; + } + case -1: { + let x_161 : i32 = sum; + sum = (x_161 + 1); + } + default: { + } + } + } + + continuing { + let x_163 : i32 = target_1; + target_1 = (x_163 + 1); + } + } + let x_307 : f32 = x; + let x_308 : f32 = y; + let x_165 : i32 = sum; + a = (x_307 + (x_308 * f32(x_165))); + let x_313 : f32 = x_27.injectionSwitch.x; + let x_315 : f32 = x_27.injectionSwitch.y; + if ((x_313 < x_315)) { + x_235 = vec3(1.0, 0.0, 0.0); + } else { + let x_320 : f32 = a; + param_31 = x_320; + let x_321 : vec3 = hueColor_f1_(&(param_31)); + x_235 = x_321; + } + let x_322 : vec3 = x_235; + x_GLF_color = vec4(x_322.x, x_322.y, x_322.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl new file mode 100644 index 0000000000..eaa0aec7ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl @@ -0,0 +1,420 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +struct Obj { + odd_numbers : array; + even_numbers : array; +}; + +var tree_1 : array; + +[[group(0), binding(0)]] var x_27 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(tree : ptr, data : ptr) { + let x_74 : i32 = *(data); + (*(tree)).data = x_74; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + var GLF_live8i : i32; + var GLF_live8A : array; + baseIndex = 0; + loop { + let x_75 : i32 = baseIndex; + let x_76 : i32 = *(treeIndex); + if ((x_75 <= x_76)) { + } else { + break; + } + let x_77 : i32 = *(data_1); + let x_78 : i32 = baseIndex; + let x_79 : i32 = tree_1[x_78].data; + if ((x_77 <= x_79)) { + let x_80 : i32 = baseIndex; + let x_81 : i32 = tree_1[x_80].leftIndex; + if ((x_81 == -1)) { + let x_82 : i32 = baseIndex; + let x_83 : i32 = *(treeIndex); + tree_1[x_82].leftIndex = x_83; + let x_84 : i32 = *(treeIndex); + let x_350 : BST = tree_1[x_84]; + param = x_350; + let x_85 : i32 = *(data_1); + param_1 = x_85; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_352 : BST = param; + tree_1[x_84] = x_352; + return; + } else { + let x_86 : i32 = baseIndex; + let x_87 : i32 = tree_1[x_86].leftIndex; + baseIndex = x_87; + continue; + } + } else { + let x_88 : i32 = baseIndex; + let x_89 : i32 = tree_1[x_88].rightIndex; + if ((x_89 == -1)) { + let x_90 : i32 = baseIndex; + let x_91 : i32 = *(treeIndex); + tree_1[x_90].rightIndex = x_91; + let x_92 : i32 = *(treeIndex); + let x_362 : BST = tree_1[x_92]; + param_2 = x_362; + let x_93 : i32 = *(data_1); + param_3 = x_93; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_364 : BST = param_2; + tree_1[x_92] = x_364; + return; + } else { + GLF_live8i = 1; + let x_94 : i32 = GLF_live8i; + let x_95 : i32 = GLF_live8i; + let x_96 : i32 = GLF_live8i; + let x_369 : i32 = select(0, x_96, ((x_94 >= 0) && (x_95 < 50))); + let x_371 : f32 = GLF_live8A[0]; + let x_373 : f32 = GLF_live8A[x_369]; + GLF_live8A[x_369] = (x_373 + x_371); + loop { + let x_97 : i32 = baseIndex; + let x_98 : i32 = tree_1[x_97].rightIndex; + baseIndex = x_98; + + continuing { + let x_382 : f32 = x_27.injectionSwitch.x; + let x_384 : f32 = x_27.injectionSwitch.y; + if ((x_382 > x_384)) { + } else { + break; + } + } + } + continue; + } + } + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_387 : i32; + index = 0; + loop { + let x_99 : i32 = index; + if ((x_99 != -1)) { + } else { + break; + } + let x_100 : i32 = index; + let x_395 : BST = tree_1[x_100]; + currentNode = x_395; + let x_101 : i32 = currentNode.data; + let x_102 : i32 = *(target); + if ((x_101 == x_102)) { + let x_103 : i32 = *(target); + return x_103; + } + let x_104 : i32 = *(target); + let x_105 : i32 = currentNode.data; + if ((x_104 > x_105)) { + let x_106 : i32 = currentNode.rightIndex; + x_387 = x_106; + } else { + let x_107 : i32 = currentNode.leftIndex; + x_387 = x_107; + } + let x_108 : i32 = x_387; + index = x_108; + } + return -1; +} + +fn makeFrame_f1_(v : ptr) -> f32 { + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + let x_418 : f32 = *(v); + *(v) = (x_418 * 6.5); + let x_420 : f32 = *(v); + if ((x_420 < 1.5)) { + param_5 = 100; + let x_110 : i32 = search_i1_(&(param_5)); + return f32(x_110); + } + let x_425 : f32 = *(v); + if ((x_425 < 4.0)) { + return 0.0; + } + let x_429 : f32 = *(v); + param_6 = 6; + let x_111 : i32 = search_i1_(&(param_6)); + if ((x_429 < f32(x_111))) { + return 1.0; + } + param_7 = 30; + let x_112 : i32 = search_i1_(&(param_7)); + return (10.0 + f32(x_112)); +} + +fn hueColor_f1_(angle : ptr) -> vec3 { + var nodeData : f32; + var param_4 : i32; + param_4 = 15; + let x_109 : i32 = search_i1_(&(param_4)); + nodeData = f32(x_109); + let x_409 : f32 = *(angle); + let x_410 : f32 = nodeData; + return ((vec3(30.0, 30.0, 30.0) + (vec3(1.0, 5.0, x_410) * x_409)) / vec3(50.0, 50.0, 50.0)); +} + +fn main_1() { + var treeIndex_1 : i32; + var param_8 : BST; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var GLF_live1_looplimiter2 : i32; + var GLF_live1i : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var GLF_live4_looplimiter3 : i32; + var GLF_live4i : i32; + var GLF_live4index : i32; + var GLF_live4obj : Obj; + var param_24 : i32; + var param_25 : i32; + var param_26 : i32; + var param_27 : i32; + var z : vec2; + var x : f32; + var param_28 : f32; + var y : f32; + var param_29 : f32; + var sum : i32; + var target_1 : i32; + var result : i32; + var param_30 : i32; + var a : f32; + var x_235 : vec3; + var param_31 : f32; + treeIndex_1 = 0; + let x_237 : BST = tree_1[0]; + param_8 = x_237; + param_9 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_8), &(param_9)); + let x_239 : BST = param_8; + tree_1[0] = x_239; + let x_113 : i32 = treeIndex_1; + treeIndex_1 = (x_113 + 1); + let x_115 : i32 = treeIndex_1; + param_10 = x_115; + param_11 = 5; + insert_i1_i1_(&(param_10), &(param_11)); + let x_116 : i32 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + GLF_live1_looplimiter2 = 0; + GLF_live1i = 0; + loop { + if (true) { + } else { + break; + } + let x_118 : i32 = GLF_live1_looplimiter2; + if ((x_118 >= 7)) { + break; + } + let x_119 : i32 = GLF_live1_looplimiter2; + GLF_live1_looplimiter2 = (x_119 + 1); + + continuing { + let x_121 : i32 = GLF_live1i; + GLF_live1i = (x_121 + 1); + } + } + let x_123 : i32 = treeIndex_1; + param_12 = x_123; + param_13 = 12; + insert_i1_i1_(&(param_12), &(param_13)); + let x_124 : i32 = treeIndex_1; + treeIndex_1 = (x_124 + 1); + let x_126 : i32 = treeIndex_1; + param_14 = x_126; + param_15 = 15; + insert_i1_i1_(&(param_14), &(param_15)); + let x_127 : i32 = treeIndex_1; + treeIndex_1 = (x_127 + 1); + let x_129 : i32 = treeIndex_1; + param_16 = x_129; + param_17 = 7; + insert_i1_i1_(&(param_16), &(param_17)); + let x_130 : i32 = treeIndex_1; + treeIndex_1 = (x_130 + 1); + let x_132 : i32 = treeIndex_1; + param_18 = x_132; + param_19 = 8; + insert_i1_i1_(&(param_18), &(param_19)); + let x_133 : i32 = treeIndex_1; + treeIndex_1 = (x_133 + 1); + let x_135 : i32 = treeIndex_1; + param_20 = x_135; + param_21 = 2; + insert_i1_i1_(&(param_20), &(param_21)); + let x_136 : i32 = treeIndex_1; + treeIndex_1 = (x_136 + 1); + let x_138 : i32 = treeIndex_1; + param_22 = x_138; + param_23 = 6; + insert_i1_i1_(&(param_22), &(param_23)); + let x_139 : i32 = treeIndex_1; + treeIndex_1 = (x_139 + 1); + GLF_live4_looplimiter3 = 0; + GLF_live4i = 0; + loop { + if (true) { + } else { + break; + } + let x_141 : i32 = GLF_live4_looplimiter3; + if ((x_141 >= 3)) { + break; + } + let x_142 : i32 = GLF_live4_looplimiter3; + GLF_live4_looplimiter3 = (x_142 + 1); + GLF_live4index = 1; + let x_144 : i32 = GLF_live4index; + let x_145 : i32 = GLF_live4index; + let x_146 : i32 = GLF_live4index; + let x_269 : f32 = GLF_live4obj.even_numbers[1]; + GLF_live4obj.even_numbers[select(0, x_146, ((x_144 >= 0) && (x_145 < 10)))] = x_269; + let x_147 : i32 = GLF_live4i; + let x_148 : i32 = GLF_live4i; + let x_149 : i32 = GLF_live4i; + GLF_live4obj.even_numbers[select(0, x_149, ((x_147 >= 0) && (x_148 < 10)))] = 1.0; + + continuing { + let x_150 : i32 = GLF_live4i; + GLF_live4i = (x_150 + 1); + } + } + let x_152 : i32 = treeIndex_1; + param_24 = x_152; + param_25 = 17; + insert_i1_i1_(&(param_24), &(param_25)); + let x_278 : f32 = x_27.injectionSwitch.x; + let x_280 : f32 = x_27.injectionSwitch.y; + if ((x_278 > x_280)) { + return; + } + let x_153 : i32 = treeIndex_1; + treeIndex_1 = (x_153 + 1); + let x_155 : i32 = treeIndex_1; + param_26 = x_155; + param_27 = 13; + insert_i1_i1_(&(param_26), &(param_27)); + let x_285 : vec4 = gl_FragCoord; + z = (vec2(x_285.y, x_285.x) / vec2(256.0, 256.0)); + let x_289 : f32 = z.x; + param_28 = x_289; + let x_290 : f32 = makeFrame_f1_(&(param_28)); + x = x_290; + let x_292 : f32 = z.y; + param_29 = x_292; + let x_293 : f32 = makeFrame_f1_(&(param_29)); + y = x_293; + sum = -100; + target_1 = 0; + loop { + let x_156 : i32 = target_1; + if ((x_156 < 20)) { + } else { + break; + } + let x_157 : i32 = target_1; + param_30 = x_157; + let x_158 : i32 = search_i1_(&(param_30)); + result = x_158; + let x_159 : i32 = result; + if ((x_159 > 0)) { + } else { + let x_160 : i32 = result; + switch(x_160) { + case 0: { + return; + } + case -1: { + let x_161 : i32 = sum; + sum = (x_161 + 1); + } + default: { + } + } + } + + continuing { + let x_163 : i32 = target_1; + target_1 = (x_163 + 1); + } + } + let x_307 : f32 = x; + let x_308 : f32 = y; + let x_165 : i32 = sum; + a = (x_307 + (x_308 * f32(x_165))); + let x_313 : f32 = x_27.injectionSwitch.x; + let x_315 : f32 = x_27.injectionSwitch.y; + if ((x_313 < x_315)) { + x_235 = vec3(1.0, 0.0, 0.0); + } else { + let x_320 : f32 = a; + param_31 = x_320; + let x_321 : vec3 = hueColor_f1_(&(param_31)); + x_235 = x_321; + } + let x_322 : vec3 = x_235; + x_GLF_color = vec4(x_322.x, x_322.y, x_322.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..4e1c940777 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.hlsl @@ -0,0 +1,364 @@ +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct Obj { + float odd_numbers[10]; + float even_numbers[10]; +}; + +static BST tree_1[10] = (BST[10])0; +cbuffer cbuffer_x_27 : register(b0, space0) { + uint4 x_27[1]; +}; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) { + const int x_74 = data; + tree.data = x_74; + tree.leftIndex = -1; + tree.rightIndex = -1; + return; +} + +void insert_i1_i1_(inout int treeIndex, inout int data_1) { + int baseIndex = 0; + BST param = (BST)0; + int param_1 = 0; + BST param_2 = (BST)0; + int param_3 = 0; + int GLF_live8i = 0; + float GLF_live8A[50] = (float[50])0; + baseIndex = 0; + while (true) { + const int x_75 = baseIndex; + const int x_76 = treeIndex; + if ((x_75 <= x_76)) { + } else { + break; + } + const int x_77 = data_1; + const int x_79 = tree_1[baseIndex].data; + if ((x_77 <= x_79)) { + const int x_81 = tree_1[baseIndex].leftIndex; + if ((x_81 == -1)) { + const int x_82 = baseIndex; + const int x_83 = treeIndex; + tree_1[x_82].leftIndex = x_83; + const int x_84 = treeIndex; + const BST x_350 = tree_1[x_84]; + param = x_350; + const int x_85 = data_1; + param_1 = x_85; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1); + tree_1[x_84] = param; + return; + } else { + const int x_87 = tree_1[baseIndex].leftIndex; + baseIndex = x_87; + continue; + } + } else { + const int x_89 = tree_1[baseIndex].rightIndex; + if ((x_89 == -1)) { + const int x_90 = baseIndex; + const int x_91 = treeIndex; + tree_1[x_90].rightIndex = x_91; + const int x_92 = treeIndex; + const BST x_362 = tree_1[x_92]; + param_2 = x_362; + const int x_93 = data_1; + param_3 = x_93; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3); + tree_1[x_92] = param_2; + return; + } else { + GLF_live8i = 1; + bool tint_tmp = (GLF_live8i >= 0); + if (tint_tmp) { + tint_tmp = (GLF_live8i < 50); + } + const int x_369 = ((tint_tmp) ? GLF_live8i : 0); + const float x_371 = GLF_live8A[0]; + const float x_373 = GLF_live8A[x_369]; + GLF_live8A[x_369] = (x_373 + x_371); + while (true) { + const int x_98 = tree_1[baseIndex].rightIndex; + baseIndex = x_98; + { + const float x_382 = asfloat(x_27[0].x); + const float x_384 = asfloat(x_27[0].y); + if ((x_382 > x_384)) { + } else { + break; + } + } + } + continue; + } + } + } + return; +} + +int search_i1_(inout int target) { + int index = 0; + BST currentNode = (BST)0; + int x_387 = 0; + index = 0; + while (true) { + if ((index != -1)) { + } else { + break; + } + const BST x_395 = tree_1[index]; + currentNode = x_395; + const int x_101 = currentNode.data; + const int x_102 = target; + if ((x_101 == x_102)) { + const int x_103 = target; + return x_103; + } + const int x_104 = target; + const int x_105 = currentNode.data; + if ((x_104 > x_105)) { + const int x_106 = currentNode.rightIndex; + x_387 = x_106; + } else { + const int x_107 = currentNode.leftIndex; + x_387 = x_107; + } + index = x_387; + } + return -1; +} + +float makeFrame_f1_(inout float v) { + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + const float x_418 = v; + v = (x_418 * 6.5f); + const float x_420 = v; + if ((x_420 < 1.5f)) { + param_5 = 100; + const int x_110 = search_i1_(param_5); + return float(x_110); + } + const float x_425 = v; + if ((x_425 < 4.0f)) { + return 0.0f; + } + const float x_429 = v; + param_6 = 6; + const int x_111 = search_i1_(param_6); + if ((x_429 < float(x_111))) { + return 1.0f; + } + param_7 = 30; + const int x_112 = search_i1_(param_7); + return (10.0f + float(x_112)); +} + +float3 hueColor_f1_(inout float angle) { + float nodeData = 0.0f; + int param_4 = 0; + param_4 = 15; + const int x_109 = search_i1_(param_4); + nodeData = float(x_109); + const float x_409 = angle; + return ((float3(30.0f, 30.0f, 30.0f) + (float3(1.0f, 5.0f, nodeData) * x_409)) / float3(50.0f, 50.0f, 50.0f)); +} + +void main_1() { + int treeIndex_1 = 0; + BST param_8 = (BST)0; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int GLF_live1_looplimiter2 = 0; + int GLF_live1i = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int GLF_live4_looplimiter3 = 0; + int GLF_live4i = 0; + int GLF_live4index = 0; + Obj GLF_live4obj = (Obj)0; + int param_24 = 0; + int param_25 = 0; + int param_26 = 0; + int param_27 = 0; + float2 z = float2(0.0f, 0.0f); + float x_1 = 0.0f; + float param_28 = 0.0f; + float y_1 = 0.0f; + float param_29 = 0.0f; + int sum = 0; + int target_1 = 0; + int result = 0; + int param_30 = 0; + float a = 0.0f; + float3 x_235 = float3(0.0f, 0.0f, 0.0f); + float param_31 = 0.0f; + treeIndex_1 = 0; + const BST x_237 = tree_1[0]; + param_8 = x_237; + param_9 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(param_8, param_9); + tree_1[0] = param_8; + treeIndex_1 = (treeIndex_1 + 1); + param_10 = treeIndex_1; + param_11 = 5; + insert_i1_i1_(param_10, param_11); + treeIndex_1 = (treeIndex_1 + 1); + GLF_live1_looplimiter2 = 0; + GLF_live1i = 0; + { + for(; true; GLF_live1i = (GLF_live1i + 1)) { + if ((GLF_live1_looplimiter2 >= 7)) { + break; + } + GLF_live1_looplimiter2 = (GLF_live1_looplimiter2 + 1); + } + } + param_12 = treeIndex_1; + param_13 = 12; + insert_i1_i1_(param_12, param_13); + treeIndex_1 = (treeIndex_1 + 1); + param_14 = treeIndex_1; + param_15 = 15; + insert_i1_i1_(param_14, param_15); + treeIndex_1 = (treeIndex_1 + 1); + param_16 = treeIndex_1; + param_17 = 7; + insert_i1_i1_(param_16, param_17); + treeIndex_1 = (treeIndex_1 + 1); + param_18 = treeIndex_1; + param_19 = 8; + insert_i1_i1_(param_18, param_19); + treeIndex_1 = (treeIndex_1 + 1); + param_20 = treeIndex_1; + param_21 = 2; + insert_i1_i1_(param_20, param_21); + treeIndex_1 = (treeIndex_1 + 1); + param_22 = treeIndex_1; + param_23 = 6; + insert_i1_i1_(param_22, param_23); + treeIndex_1 = (treeIndex_1 + 1); + GLF_live4_looplimiter3 = 0; + GLF_live4i = 0; + { + for(; true; GLF_live4i = (GLF_live4i + 1)) { + if ((GLF_live4_looplimiter3 >= 3)) { + break; + } + GLF_live4_looplimiter3 = (GLF_live4_looplimiter3 + 1); + GLF_live4index = 1; + const int x_144 = GLF_live4index; + const int x_145 = GLF_live4index; + const int x_146 = GLF_live4index; + const float x_269 = GLF_live4obj.even_numbers[1]; + bool tint_tmp_1 = (x_144 >= 0); + if (tint_tmp_1) { + tint_tmp_1 = (x_145 < 10); + } + GLF_live4obj.even_numbers[((tint_tmp_1) ? x_146 : 0)] = x_269; + bool tint_tmp_2 = (GLF_live4i >= 0); + if (tint_tmp_2) { + tint_tmp_2 = (GLF_live4i < 10); + } + GLF_live4obj.even_numbers[((tint_tmp_2) ? GLF_live4i : 0)] = 1.0f; + } + } + param_24 = treeIndex_1; + param_25 = 17; + insert_i1_i1_(param_24, param_25); + const float x_278 = asfloat(x_27[0].x); + const float x_280 = asfloat(x_27[0].y); + if ((x_278 > x_280)) { + return; + } + treeIndex_1 = (treeIndex_1 + 1); + param_26 = treeIndex_1; + param_27 = 13; + insert_i1_i1_(param_26, param_27); + const float4 x_285 = gl_FragCoord; + z = (float2(x_285.y, x_285.x) / float2(256.0f, 256.0f)); + const float x_289 = z.x; + param_28 = x_289; + const float x_290 = makeFrame_f1_(param_28); + x_1 = x_290; + const float x_292 = z.y; + param_29 = x_292; + const float x_293 = makeFrame_f1_(param_29); + y_1 = x_293; + sum = -100; + target_1 = 0; + { + for(; (target_1 < 20); target_1 = (target_1 + 1)) { + param_30 = target_1; + const int x_158 = search_i1_(param_30); + result = x_158; + if ((result > 0)) { + } else { + switch(result) { + case 0: { + return; + break; + } + case -1: { + sum = (sum + 1); + break; + } + default: { + break; + } + } + } + } + } + a = (x_1 + (y_1 * float(sum))); + const float x_313 = asfloat(x_27[0].x); + const float x_315 = asfloat(x_27[0].y); + if ((x_313 < x_315)) { + x_235 = float3(1.0f, 0.0f, 0.0f); + } else { + param_31 = a; + const float3 x_321 = hueColor_f1_(param_31); + x_235 = x_321; + } + const float3 x_322 = x_235; + x_GLF_color = float4(x_322.x, x_322.y, x_322.z, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {x_GLF_color}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..10ddae2a75 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.msl @@ -0,0 +1,426 @@ +#include + +using namespace metal; +struct BST { + int data; + int leftIndex; + int rightIndex; +}; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct tint_array_wrapper { + float arr[10]; +}; +struct Obj { + tint_array_wrapper odd_numbers; + tint_array_wrapper even_numbers; +}; +struct tint_array_wrapper_1 { + BST arr[10]; +}; +struct tint_array_wrapper_2 { + float arr[50]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_2 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const tree, thread int* const data) { + int const x_74 = *(data); + (*(tree)).data = x_74; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +void insert_i1_i1_(constant buf0& x_27, thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper_1* const tint_symbol_5) { + int baseIndex = 0; + BST param = {}; + int param_1 = 0; + BST param_2 = {}; + int param_3 = 0; + int GLF_live8i = 0; + tint_array_wrapper_2 GLF_live8A = {}; + baseIndex = 0; + while (true) { + int const x_75 = baseIndex; + int const x_76 = *(treeIndex); + if ((x_75 <= x_76)) { + } else { + break; + } + int const x_77 = *(data_1); + int const x_78 = baseIndex; + int const x_79 = (*(tint_symbol_5)).arr[x_78].data; + if ((x_77 <= x_79)) { + int const x_80 = baseIndex; + int const x_81 = (*(tint_symbol_5)).arr[x_80].leftIndex; + if ((x_81 == -1)) { + int const x_82 = baseIndex; + int const x_83 = *(treeIndex); + (*(tint_symbol_5)).arr[x_82].leftIndex = x_83; + int const x_84 = *(treeIndex); + BST const x_350 = (*(tint_symbol_5)).arr[x_84]; + param = x_350; + int const x_85 = *(data_1); + param_1 = x_85; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + BST const x_352 = param; + (*(tint_symbol_5)).arr[x_84] = x_352; + return; + } else { + int const x_86 = baseIndex; + int const x_87 = (*(tint_symbol_5)).arr[x_86].leftIndex; + baseIndex = x_87; + continue; + } + } else { + int const x_88 = baseIndex; + int const x_89 = (*(tint_symbol_5)).arr[x_88].rightIndex; + if ((x_89 == -1)) { + int const x_90 = baseIndex; + int const x_91 = *(treeIndex); + (*(tint_symbol_5)).arr[x_90].rightIndex = x_91; + int const x_92 = *(treeIndex); + BST const x_362 = (*(tint_symbol_5)).arr[x_92]; + param_2 = x_362; + int const x_93 = *(data_1); + param_3 = x_93; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + BST const x_364 = param_2; + (*(tint_symbol_5)).arr[x_92] = x_364; + return; + } else { + GLF_live8i = 1; + int const x_94 = GLF_live8i; + int const x_95 = GLF_live8i; + int const x_96 = GLF_live8i; + int const x_369 = select(0, x_96, ((x_94 >= 0) && (x_95 < 50))); + float const x_371 = GLF_live8A.arr[0]; + float const x_373 = GLF_live8A.arr[x_369]; + GLF_live8A.arr[x_369] = (x_373 + x_371); + while (true) { + int const x_97 = baseIndex; + int const x_98 = (*(tint_symbol_5)).arr[x_97].rightIndex; + baseIndex = x_98; + { + float const x_382 = x_27.injectionSwitch.x; + float const x_384 = x_27.injectionSwitch.y; + if ((x_382 > x_384)) { + } else { + break; + } + } + } + continue; + } + } + } + return; +} + +int search_i1_(thread int* const target, thread tint_array_wrapper_1* const tint_symbol_6) { + int index = 0; + BST currentNode = {}; + int x_387 = 0; + index = 0; + while (true) { + int const x_99 = index; + if ((x_99 != -1)) { + } else { + break; + } + int const x_100 = index; + BST const x_395 = (*(tint_symbol_6)).arr[x_100]; + currentNode = x_395; + int const x_101 = currentNode.data; + int const x_102 = *(target); + if ((x_101 == x_102)) { + int const x_103 = *(target); + return x_103; + } + int const x_104 = *(target); + int const x_105 = currentNode.data; + if ((x_104 > x_105)) { + int const x_106 = currentNode.rightIndex; + x_387 = x_106; + } else { + int const x_107 = currentNode.leftIndex; + x_387 = x_107; + } + int const x_108 = x_387; + index = x_108; + } + return -1; +} + +float makeFrame_f1_(thread float* const v, thread tint_array_wrapper_1* const tint_symbol_7) { + int param_5 = 0; + int param_6 = 0; + int param_7 = 0; + float const x_418 = *(v); + *(v) = (x_418 * 6.5f); + float const x_420 = *(v); + if ((x_420 < 1.5f)) { + param_5 = 100; + int const x_110 = search_i1_(&(param_5), tint_symbol_7); + return float(x_110); + } + float const x_425 = *(v); + if ((x_425 < 4.0f)) { + return 0.0f; + } + float const x_429 = *(v); + param_6 = 6; + int const x_111 = search_i1_(&(param_6), tint_symbol_7); + if ((x_429 < float(x_111))) { + return 1.0f; + } + param_7 = 30; + int const x_112 = search_i1_(&(param_7), tint_symbol_7); + return (10.0f + float(x_112)); +} + +float3 hueColor_f1_(thread float* const angle, thread tint_array_wrapper_1* const tint_symbol_8) { + float nodeData = 0.0f; + int param_4 = 0; + param_4 = 15; + int const x_109 = search_i1_(&(param_4), tint_symbol_8); + nodeData = float(x_109); + float const x_409 = *(angle); + float const x_410 = nodeData; + return ((float3(30.0f, 30.0f, 30.0f) + (float3(1.0f, 5.0f, x_410) * x_409)) / float3(50.0f, 50.0f, 50.0f)); +} + +void main_1(constant buf0& x_27, thread tint_array_wrapper_1* const tint_symbol_9, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) { + int treeIndex_1 = 0; + BST param_8 = {}; + int param_9 = 0; + int param_10 = 0; + int param_11 = 0; + int GLF_live1_looplimiter2 = 0; + int GLF_live1i = 0; + int param_12 = 0; + int param_13 = 0; + int param_14 = 0; + int param_15 = 0; + int param_16 = 0; + int param_17 = 0; + int param_18 = 0; + int param_19 = 0; + int param_20 = 0; + int param_21 = 0; + int param_22 = 0; + int param_23 = 0; + int GLF_live4_looplimiter3 = 0; + int GLF_live4i = 0; + int GLF_live4index = 0; + Obj GLF_live4obj = {}; + int param_24 = 0; + int param_25 = 0; + int param_26 = 0; + int param_27 = 0; + float2 z = 0.0f; + float x_1 = 0.0f; + float param_28 = 0.0f; + float y_1 = 0.0f; + float param_29 = 0.0f; + int sum = 0; + int target_1 = 0; + int result = 0; + int param_30 = 0; + float a = 0.0f; + float3 x_235 = 0.0f; + float param_31 = 0.0f; + treeIndex_1 = 0; + BST const x_237 = (*(tint_symbol_9)).arr[0]; + param_8 = x_237; + param_9 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_8), &(param_9)); + BST const x_239 = param_8; + (*(tint_symbol_9)).arr[0] = x_239; + int const x_113 = treeIndex_1; + treeIndex_1 = (x_113 + 1); + int const x_115 = treeIndex_1; + param_10 = x_115; + param_11 = 5; + insert_i1_i1_(x_27, &(param_10), &(param_11), tint_symbol_9); + int const x_116 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + GLF_live1_looplimiter2 = 0; + GLF_live1i = 0; + while (true) { + if (true) { + } else { + break; + } + int const x_118 = GLF_live1_looplimiter2; + if ((x_118 >= 7)) { + break; + } + int const x_119 = GLF_live1_looplimiter2; + GLF_live1_looplimiter2 = (x_119 + 1); + { + int const x_121 = GLF_live1i; + GLF_live1i = (x_121 + 1); + } + } + int const x_123 = treeIndex_1; + param_12 = x_123; + param_13 = 12; + insert_i1_i1_(x_27, &(param_12), &(param_13), tint_symbol_9); + int const x_124 = treeIndex_1; + treeIndex_1 = (x_124 + 1); + int const x_126 = treeIndex_1; + param_14 = x_126; + param_15 = 15; + insert_i1_i1_(x_27, &(param_14), &(param_15), tint_symbol_9); + int const x_127 = treeIndex_1; + treeIndex_1 = (x_127 + 1); + int const x_129 = treeIndex_1; + param_16 = x_129; + param_17 = 7; + insert_i1_i1_(x_27, &(param_16), &(param_17), tint_symbol_9); + int const x_130 = treeIndex_1; + treeIndex_1 = (x_130 + 1); + int const x_132 = treeIndex_1; + param_18 = x_132; + param_19 = 8; + insert_i1_i1_(x_27, &(param_18), &(param_19), tint_symbol_9); + int const x_133 = treeIndex_1; + treeIndex_1 = (x_133 + 1); + int const x_135 = treeIndex_1; + param_20 = x_135; + param_21 = 2; + insert_i1_i1_(x_27, &(param_20), &(param_21), tint_symbol_9); + int const x_136 = treeIndex_1; + treeIndex_1 = (x_136 + 1); + int const x_138 = treeIndex_1; + param_22 = x_138; + param_23 = 6; + insert_i1_i1_(x_27, &(param_22), &(param_23), tint_symbol_9); + int const x_139 = treeIndex_1; + treeIndex_1 = (x_139 + 1); + GLF_live4_looplimiter3 = 0; + GLF_live4i = 0; + while (true) { + if (true) { + } else { + break; + } + int const x_141 = GLF_live4_looplimiter3; + if ((x_141 >= 3)) { + break; + } + int const x_142 = GLF_live4_looplimiter3; + GLF_live4_looplimiter3 = (x_142 + 1); + GLF_live4index = 1; + int const x_144 = GLF_live4index; + int const x_145 = GLF_live4index; + int const x_146 = GLF_live4index; + float const x_269 = GLF_live4obj.even_numbers.arr[1]; + GLF_live4obj.even_numbers.arr[select(0, x_146, ((x_144 >= 0) && (x_145 < 10)))] = x_269; + int const x_147 = GLF_live4i; + int const x_148 = GLF_live4i; + int const x_149 = GLF_live4i; + GLF_live4obj.even_numbers.arr[select(0, x_149, ((x_147 >= 0) && (x_148 < 10)))] = 1.0f; + { + int const x_150 = GLF_live4i; + GLF_live4i = (x_150 + 1); + } + } + int const x_152 = treeIndex_1; + param_24 = x_152; + param_25 = 17; + insert_i1_i1_(x_27, &(param_24), &(param_25), tint_symbol_9); + float const x_278 = x_27.injectionSwitch.x; + float const x_280 = x_27.injectionSwitch.y; + if ((x_278 > x_280)) { + return; + } + int const x_153 = treeIndex_1; + treeIndex_1 = (x_153 + 1); + int const x_155 = treeIndex_1; + param_26 = x_155; + param_27 = 13; + insert_i1_i1_(x_27, &(param_26), &(param_27), tint_symbol_9); + float4 const x_285 = *(tint_symbol_10); + z = (float2(x_285.y, x_285.x) / float2(256.0f, 256.0f)); + float const x_289 = z.x; + param_28 = x_289; + float const x_290 = makeFrame_f1_(&(param_28), tint_symbol_9); + x_1 = x_290; + float const x_292 = z.y; + param_29 = x_292; + float const x_293 = makeFrame_f1_(&(param_29), tint_symbol_9); + y_1 = x_293; + sum = -100; + target_1 = 0; + while (true) { + int const x_156 = target_1; + if ((x_156 < 20)) { + } else { + break; + } + int const x_157 = target_1; + param_30 = x_157; + int const x_158 = search_i1_(&(param_30), tint_symbol_9); + result = x_158; + int const x_159 = result; + if ((x_159 > 0)) { + } else { + int const x_160 = result; + switch(x_160) { + case 0: { + return; + break; + } + case -1: { + int const x_161 = sum; + sum = (x_161 + 1); + break; + } + default: { + break; + } + } + } + { + int const x_163 = target_1; + target_1 = (x_163 + 1); + } + } + float const x_307 = x_1; + float const x_308 = y_1; + int const x_165 = sum; + a = (x_307 + (x_308 * float(x_165))); + float const x_313 = x_27.injectionSwitch.x; + float const x_315 = x_27.injectionSwitch.y; + if ((x_313 < x_315)) { + x_235 = float3(1.0f, 0.0f, 0.0f); + } else { + float const x_320 = a; + param_31 = x_320; + float3 const x_321 = hueColor_f1_(&(param_31), tint_symbol_9); + x_235 = x_321; + } + float3 const x_322 = x_235; + *(tint_symbol_11) = float4(x_322.x, x_322.y, x_322.z, 1.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_27 [[buffer(0)]]) { + thread float4 tint_symbol_12 = 0.0f; + thread tint_array_wrapper_1 tint_symbol_13 = {}; + thread float4 tint_symbol_14 = 0.0f; + tint_symbol_12 = gl_FragCoord_param; + main_1(x_27, &(tint_symbol_13), &(tint_symbol_12), &(tint_symbol_14)); + main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_14}; + tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..ff486986c8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.spvasm @@ -0,0 +1,815 @@ +SKIP: FAILED + +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 536 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %BST "BST" + OpMemberName %BST 0 "data" + OpMemberName %BST 1 "leftIndex" + OpMemberName %BST 2 "rightIndex" + OpName %tree_1 "tree_1" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_27 "x_27" + OpName %gl_FragCoord "gl_FragCoord" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %makeTreeNode_struct_BST_i1_i1_i11_i1_ "makeTreeNode_struct_BST_i1_i1_i11_i1_" + OpName %tree "tree" + OpName %data "data" + OpName %insert_i1_i1_ "insert_i1_i1_" + OpName %treeIndex "treeIndex" + OpName %data_1 "data_1" + OpName %baseIndex "baseIndex" + OpName %param "param" + OpName %param_1 "param_1" + OpName %param_2 "param_2" + OpName %param_3 "param_3" + OpName %GLF_live8i "GLF_live8i" + OpName %GLF_live8A "GLF_live8A" + OpName %search_i1_ "search_i1_" + OpName %target "target" + OpName %index "index" + OpName %currentNode "currentNode" + OpName %x_387 "x_387" + OpName %makeFrame_f1_ "makeFrame_f1_" + OpName %v "v" + OpName %param_5 "param_5" + OpName %param_6 "param_6" + OpName %param_7 "param_7" + OpName %hueColor_f1_ "hueColor_f1_" + OpName %angle "angle" + OpName %nodeData "nodeData" + OpName %param_4 "param_4" + OpName %main_1 "main_1" + OpName %treeIndex_1 "treeIndex_1" + OpName %param_8 "param_8" + OpName %param_9 "param_9" + OpName %param_10 "param_10" + OpName %param_11 "param_11" + OpName %GLF_live1_looplimiter2 "GLF_live1_looplimiter2" + OpName %GLF_live1i "GLF_live1i" + OpName %param_12 "param_12" + OpName %param_13 "param_13" + OpName %param_14 "param_14" + OpName %param_15 "param_15" + OpName %param_16 "param_16" + OpName %param_17 "param_17" + OpName %param_18 "param_18" + OpName %param_19 "param_19" + OpName %param_20 "param_20" + OpName %param_21 "param_21" + OpName %param_22 "param_22" + OpName %param_23 "param_23" + OpName %GLF_live4_looplimiter3 "GLF_live4_looplimiter3" + OpName %GLF_live4i "GLF_live4i" + OpName %GLF_live4index "GLF_live4index" + OpName %Obj "Obj" + OpMemberName %Obj 0 "odd_numbers" + OpMemberName %Obj 1 "even_numbers" + OpName %GLF_live4obj "GLF_live4obj" + OpName %param_24 "param_24" + OpName %param_25 "param_25" + OpName %param_26 "param_26" + OpName %param_27 "param_27" + OpName %z "z" + OpName %x "x" + OpName %param_28 "param_28" + OpName %y "y" + OpName %param_29 "param_29" + OpName %sum "sum" + OpName %target_1 "target_1" + OpName %result "result" + OpName %param_30 "param_30" + OpName %a "a" + OpName %x_235 "x_235" + OpName %param_31 "param_31" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpMemberDecorate %BST 0 Offset 0 + OpMemberDecorate %BST 1 Offset 4 + OpMemberDecorate %BST 2 Offset 8 + OpDecorate %_arr_BST_uint_10 ArrayStride 12 + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_27 NonWritable + OpDecorate %x_27 DescriptorSet 0 + OpDecorate %x_27 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %_arr_float_uint_50 ArrayStride 4 + OpMemberDecorate %Obj 0 Offset 0 + OpDecorate %_arr_float_uint_10 ArrayStride 4 + OpMemberDecorate %Obj 1 Offset 40 + OpMemberDecorate %main_out 0 Offset 0 + %int = OpTypeInt 32 1 + %BST = OpTypeStruct %int %int %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_BST_uint_10 = OpTypeArray %BST %uint_10 +%_ptr_Private__arr_BST_uint_10 = OpTypePointer Private %_arr_BST_uint_10 + %8 = OpConstantNull %_arr_BST_uint_10 + %tree_1 = OpVariable %_ptr_Private__arr_BST_uint_10 Private %8 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_27 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17 +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid +%_ptr_Function_BST = OpTypePointer Function %BST +%_ptr_Function_int = OpTypePointer Function %int + %23 = OpTypeFunction %void %_ptr_Function_BST %_ptr_Function_int + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int_n1 = OpConstant %int -1 + %uint_2 = OpConstant %uint 2 + %43 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int + %49 = OpConstantNull %int + %51 = OpConstantNull %BST + %uint_50 = OpConstant %uint 50 +%_arr_float_uint_50 = OpTypeArray %float %uint_50 +%_ptr_Function__arr_float_uint_50 = OpTypePointer Function %_arr_float_uint_50 + %60 = OpConstantNull %_arr_float_uint_50 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Private_int = OpTypePointer Private %int +%_ptr_Private_BST = OpTypePointer Private %BST + %int_1 = OpConstant %int 1 + %int_50 = OpConstant %int 50 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %166 = OpTypeFunction %int %_ptr_Function_int + %207 = OpTypeFunction %float %_ptr_Function_float + %float_6_5 = OpConstant %float 6.5 + %float_1_5 = OpConstant %float 1.5 + %int_100 = OpConstant %int 100 + %float_4 = OpConstant %float 4 + %float_0 = OpConstant %float 0 + %int_6 = OpConstant %int 6 + %float_1 = OpConstant %float 1 + %int_30 = OpConstant %int 30 + %float_10 = OpConstant %float 10 + %v3float = OpTypeVector %float 3 + %252 = OpTypeFunction %v3float %_ptr_Function_float + %258 = OpConstantNull %float + %int_15 = OpConstant %int 15 + %float_30 = OpConstant %float 30 + %268 = OpConstantComposite %v3float %float_30 %float_30 %float_30 + %float_5 = OpConstant %float 5 + %float_50 = OpConstant %float 50 + %274 = OpConstantComposite %v3float %float_50 %float_50 %float_50 + %276 = OpTypeFunction %void +%_arr_float_uint_10 = OpTypeArray %float %uint_10 + %Obj = OpTypeStruct %_arr_float_uint_10 %_arr_float_uint_10 +%_ptr_Function_Obj = OpTypePointer Function %Obj + %305 = OpConstantNull %Obj +%_ptr_Function_v2float = OpTypePointer Function %v2float + %312 = OpConstantNull %v2float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %324 = OpConstantNull %v3float + %int_9 = OpConstant %int 9 + %int_5 = OpConstant %int 5 + %true = OpConstantTrue %bool + %int_7 = OpConstant %int 7 + %int_12 = OpConstant %int 12 + %int_8 = OpConstant %int 8 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_10 = OpConstant %int 10 + %int_17 = OpConstant %int 17 + %int_13 = OpConstant %int 13 + %float_256 = OpConstant %float 256 + %462 = OpConstantComposite %v2float %float_256 %float_256 + %int_n100 = OpConstant %int -100 + %int_20 = OpConstant %int 20 + %514 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %main_out = OpTypeStruct %v4float + %523 = OpTypeFunction %void %main_out +%makeTreeNode_struct_BST_i1_i1_i11_i1_ = OpFunction %void None %23 + %tree = OpFunctionParameter %_ptr_Function_BST + %data = OpFunctionParameter %_ptr_Function_int + %30 = OpLabel + %32 = OpLoad %int %data + %35 = OpAccessChain %_ptr_Function_int %tree %uint_0 + OpStore %35 %32 + %38 = OpAccessChain %_ptr_Function_int %tree %uint_1 + OpStore %38 %int_n1 + %42 = OpAccessChain %_ptr_Function_int %tree %uint_2 + OpStore %42 %int_n1 + OpReturn + OpFunctionEnd +%insert_i1_i1_ = OpFunction %void None %43 + %treeIndex = OpFunctionParameter %_ptr_Function_int + %data_1 = OpFunctionParameter %_ptr_Function_int + %47 = OpLabel + %baseIndex = OpVariable %_ptr_Function_int Function %49 + %param = OpVariable %_ptr_Function_BST Function %51 + %param_1 = OpVariable %_ptr_Function_int Function %49 + %param_2 = OpVariable %_ptr_Function_BST Function %51 + %param_3 = OpVariable %_ptr_Function_int Function %49 + %GLF_live8i = OpVariable %_ptr_Function_int Function %49 + %GLF_live8A = OpVariable %_ptr_Function__arr_float_uint_50 Function %60 + OpStore %baseIndex %int_0 + OpBranch %62 + %62 = OpLabel + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %66 = OpLoad %int %baseIndex + %68 = OpLoad %int %treeIndex + %69 = OpSLessThanEqual %bool %66 %68 + OpSelectionMerge %71 None + OpBranchConditional %69 %72 %73 + %72 = OpLabel + OpBranch %71 + %73 = OpLabel + OpBranch %63 + %71 = OpLabel + %75 = OpLoad %int %data_1 + %76 = OpLoad %int %baseIndex + %78 = OpAccessChain %_ptr_Private_int %tree_1 %76 %uint_0 + %79 = OpLoad %int %78 + %80 = OpSLessThanEqual %bool %75 %79 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %83 + %82 = OpLabel + %84 = OpLoad %int %baseIndex + %85 = OpAccessChain %_ptr_Private_int %tree_1 %84 %uint_1 + %86 = OpLoad %int %85 + %87 = OpIEqual %bool %86 %int_n1 + OpSelectionMerge %88 None + OpBranchConditional %87 %89 %90 + %89 = OpLabel + %91 = OpLoad %int %baseIndex + %93 = OpLoad %int %treeIndex + %94 = OpAccessChain %_ptr_Private_int %tree_1 %91 %uint_1 + OpStore %94 %93 + %96 = OpLoad %int %treeIndex + %98 = OpAccessChain %_ptr_Private_BST %tree_1 %96 + %99 = OpLoad %BST %98 + OpStore %param %99 + %101 = OpLoad %int %data_1 + OpStore %param_1 %101 + %102 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param %param_1 + %105 = OpLoad %BST %param + %106 = OpAccessChain %_ptr_Private_BST %tree_1 %96 + OpStore %106 %105 + OpReturn + %90 = OpLabel + %107 = OpLoad %int %baseIndex + %108 = OpAccessChain %_ptr_Private_int %tree_1 %107 %uint_1 + %109 = OpLoad %int %108 + OpStore %baseIndex %109 + OpBranch %64 + %88 = OpLabel + OpBranch %81 + %83 = OpLabel + %110 = OpLoad %int %baseIndex + %111 = OpAccessChain %_ptr_Private_int %tree_1 %110 %uint_2 + %112 = OpLoad %int %111 + %113 = OpIEqual %bool %112 %int_n1 + OpSelectionMerge %114 None + OpBranchConditional %113 %115 %116 + %115 = OpLabel + %117 = OpLoad %int %baseIndex + %119 = OpLoad %int %treeIndex + %120 = OpAccessChain %_ptr_Private_int %tree_1 %117 %uint_2 + OpStore %120 %119 + %122 = OpLoad %int %treeIndex + %123 = OpAccessChain %_ptr_Private_BST %tree_1 %122 + %124 = OpLoad %BST %123 + OpStore %param_2 %124 + %126 = OpLoad %int %data_1 + OpStore %param_3 %126 + %127 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_2 %param_3 + %130 = OpLoad %BST %param_2 + %131 = OpAccessChain %_ptr_Private_BST %tree_1 %122 + OpStore %131 %130 + OpReturn + %116 = OpLabel + OpStore %GLF_live8i %int_1 + %133 = OpLoad %int %GLF_live8i + %134 = OpLoad %int %GLF_live8i + %135 = OpLoad %int %GLF_live8i + %137 = OpSGreaterThanEqual %bool %133 %int_0 + OpSelectionMerge %138 None + OpBranchConditional %137 %139 %138 + %139 = OpLabel + %141 = OpSLessThan %bool %134 %int_50 + OpBranch %138 + %138 = OpLabel + %142 = OpPhi %bool %137 %116 %141 %139 + %136 = OpSelect %int %142 %135 %int_0 + %144 = OpAccessChain %_ptr_Function_float %GLF_live8A %int_0 + %145 = OpLoad %float %144 + %146 = OpAccessChain %_ptr_Function_float %GLF_live8A %136 + %147 = OpLoad %float %146 + %148 = OpAccessChain %_ptr_Function_float %GLF_live8A %136 + %149 = OpFAdd %float %147 %145 + OpStore %148 %149 + OpBranch %150 + %150 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %154 = OpLoad %int %baseIndex + %155 = OpAccessChain %_ptr_Private_int %tree_1 %154 %uint_2 + %156 = OpLoad %int %155 + OpStore %baseIndex %156 + OpBranch %152 + %152 = OpLabel + %158 = OpAccessChain %_ptr_Uniform_float %x_27 %uint_0 %uint_0 + %159 = OpLoad %float %158 + %160 = OpAccessChain %_ptr_Uniform_float %x_27 %uint_0 %uint_1 + %161 = OpLoad %float %160 + %162 = OpFOrdGreaterThan %bool %159 %161 + OpSelectionMerge %163 None + OpBranchConditional %162 %164 %165 + %164 = OpLabel + OpBranch %163 + %165 = OpLabel + OpBranch %151 + %163 = OpLabel + OpBranch %150 + %151 = OpLabel + OpBranch %64 + %114 = OpLabel + OpBranch %81 + %81 = OpLabel + OpBranch %64 + %64 = OpLabel + OpBranch %62 + %63 = OpLabel + OpReturn + OpFunctionEnd + %search_i1_ = OpFunction %int None %166 + %target = OpFunctionParameter %_ptr_Function_int + %169 = OpLabel + %index = OpVariable %_ptr_Function_int Function %49 +%currentNode = OpVariable %_ptr_Function_BST Function %51 + %x_387 = OpVariable %_ptr_Function_int Function %49 + OpStore %index %int_0 + OpBranch %173 + %173 = OpLabel + OpLoopMerge %174 %175 None + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %int %index + %178 = OpINotEqual %bool %177 %int_n1 + OpSelectionMerge %179 None + OpBranchConditional %178 %180 %181 + %180 = OpLabel + OpBranch %179 + %181 = OpLabel + OpBranch %174 + %179 = OpLabel + %182 = OpLoad %int %index + %183 = OpAccessChain %_ptr_Private_BST %tree_1 %182 + %184 = OpLoad %BST %183 + OpStore %currentNode %184 + %185 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %186 = OpLoad %int %185 + %188 = OpLoad %int %target + %189 = OpIEqual %bool %186 %188 + OpSelectionMerge %190 None + OpBranchConditional %189 %191 %190 + %191 = OpLabel + %193 = OpLoad %int %target + OpReturnValue %193 + %190 = OpLabel + %195 = OpLoad %int %target + %196 = OpAccessChain %_ptr_Function_int %currentNode %uint_0 + %197 = OpLoad %int %196 + %198 = OpSGreaterThan %bool %195 %197 + OpSelectionMerge %199 None + OpBranchConditional %198 %200 %201 + %200 = OpLabel + %202 = OpAccessChain %_ptr_Function_int %currentNode %uint_2 + %203 = OpLoad %int %202 + OpStore %x_387 %203 + OpBranch %199 + %201 = OpLabel + %204 = OpAccessChain %_ptr_Function_int %currentNode %uint_1 + %205 = OpLoad %int %204 + OpStore %x_387 %205 + OpBranch %199 + %199 = OpLabel + %206 = OpLoad %int %x_387 + OpStore %index %206 + OpBranch %175 + %175 = OpLabel + OpBranch %173 + %174 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd +%makeFrame_f1_ = OpFunction %float None %207 + %v = OpFunctionParameter %_ptr_Function_float + %210 = OpLabel + %param_5 = OpVariable %_ptr_Function_int Function %49 + %param_6 = OpVariable %_ptr_Function_int Function %49 + %param_7 = OpVariable %_ptr_Function_int Function %49 + %215 = OpLoad %float %v + %218 = OpFMul %float %215 %float_6_5 + OpStore %v %218 + %220 = OpLoad %float %v + %222 = OpFOrdLessThan %bool %220 %float_1_5 + OpSelectionMerge %223 None + OpBranchConditional %222 %224 %223 + %224 = OpLabel + OpStore %param_5 %int_100 + %226 = OpFunctionCall %int %search_i1_ %param_5 + %228 = OpConvertSToF %float %226 + OpReturnValue %228 + %223 = OpLabel + %230 = OpLoad %float %v + %232 = OpFOrdLessThan %bool %230 %float_4 + OpSelectionMerge %233 None + OpBranchConditional %232 %234 %233 + %234 = OpLabel + OpReturnValue %float_0 + %233 = OpLabel + %237 = OpLoad %float %v + OpStore %param_6 %int_6 + %239 = OpFunctionCall %int %search_i1_ %param_6 + %241 = OpConvertSToF %float %239 + %242 = OpFOrdLessThan %bool %237 %241 + OpSelectionMerge %243 None + OpBranchConditional %242 %244 %243 + %244 = OpLabel + OpReturnValue %float_1 + %243 = OpLabel + OpStore %param_7 %int_30 + %247 = OpFunctionCall %int %search_i1_ %param_7 + %250 = OpConvertSToF %float %247 + %251 = OpFAdd %float %float_10 %250 + OpReturnValue %251 + OpFunctionEnd +%hueColor_f1_ = OpFunction %v3float None %252 + %angle = OpFunctionParameter %_ptr_Function_float + %256 = OpLabel + %nodeData = OpVariable %_ptr_Function_float Function %258 + %param_4 = OpVariable %_ptr_Function_int Function %49 + OpStore %param_4 %int_15 + %261 = OpFunctionCall %int %search_i1_ %param_4 + %263 = OpConvertSToF %float %261 + OpStore %nodeData %263 + %265 = OpLoad %float %angle + %266 = OpLoad %float %nodeData + %270 = OpCompositeConstruct %v3float %float_1 %float_5 %266 + %271 = OpVectorTimesScalar %v3float %270 %265 + %272 = OpFAdd %v3float %268 %271 + %275 = OpFDiv %v3float %272 %274 + OpReturnValue %275 + OpFunctionEnd + %main_1 = OpFunction %void None %276 + %278 = OpLabel +%treeIndex_1 = OpVariable %_ptr_Function_int Function %49 + %param_8 = OpVariable %_ptr_Function_BST Function %51 + %param_9 = OpVariable %_ptr_Function_int Function %49 + %param_10 = OpVariable %_ptr_Function_int Function %49 + %param_11 = OpVariable %_ptr_Function_int Function %49 +%GLF_live1_looplimiter2 = OpVariable %_ptr_Function_int Function %49 + %GLF_live1i = OpVariable %_ptr_Function_int Function %49 + %param_12 = OpVariable %_ptr_Function_int Function %49 + %param_13 = OpVariable %_ptr_Function_int Function %49 + %param_14 = OpVariable %_ptr_Function_int Function %49 + %param_15 = OpVariable %_ptr_Function_int Function %49 + %param_16 = OpVariable %_ptr_Function_int Function %49 + %param_17 = OpVariable %_ptr_Function_int Function %49 + %param_18 = OpVariable %_ptr_Function_int Function %49 + %param_19 = OpVariable %_ptr_Function_int Function %49 + %param_20 = OpVariable %_ptr_Function_int Function %49 + %param_21 = OpVariable %_ptr_Function_int Function %49 + %param_22 = OpVariable %_ptr_Function_int Function %49 + %param_23 = OpVariable %_ptr_Function_int Function %49 +%GLF_live4_looplimiter3 = OpVariable %_ptr_Function_int Function %49 + %GLF_live4i = OpVariable %_ptr_Function_int Function %49 +%GLF_live4index = OpVariable %_ptr_Function_int Function %49 +%GLF_live4obj = OpVariable %_ptr_Function_Obj Function %305 + %param_24 = OpVariable %_ptr_Function_int Function %49 + %param_25 = OpVariable %_ptr_Function_int Function %49 + %param_26 = OpVariable %_ptr_Function_int Function %49 + %param_27 = OpVariable %_ptr_Function_int Function %49 + %z = OpVariable %_ptr_Function_v2float Function %312 + %x = OpVariable %_ptr_Function_float Function %258 + %param_28 = OpVariable %_ptr_Function_float Function %258 + %y = OpVariable %_ptr_Function_float Function %258 + %param_29 = OpVariable %_ptr_Function_float Function %258 + %sum = OpVariable %_ptr_Function_int Function %49 + %target_1 = OpVariable %_ptr_Function_int Function %49 + %result = OpVariable %_ptr_Function_int Function %49 + %param_30 = OpVariable %_ptr_Function_int Function %49 + %a = OpVariable %_ptr_Function_float Function %258 + %x_235 = OpVariable %_ptr_Function_v3float Function %324 + %param_31 = OpVariable %_ptr_Function_float Function %258 + OpStore %treeIndex_1 %int_0 + %326 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + %327 = OpLoad %BST %326 + OpStore %param_8 %327 + OpStore %param_9 %int_9 + %329 = OpFunctionCall %void %makeTreeNode_struct_BST_i1_i1_i11_i1_ %param_8 %param_9 + %332 = OpLoad %BST %param_8 + %333 = OpAccessChain %_ptr_Private_BST %tree_1 %int_0 + OpStore %333 %332 + %334 = OpLoad %int %treeIndex_1 + %335 = OpIAdd %int %334 %int_1 + OpStore %treeIndex_1 %335 + %336 = OpLoad %int %treeIndex_1 + OpStore %param_10 %336 + OpStore %param_11 %int_5 + %338 = OpFunctionCall %void %insert_i1_i1_ %param_10 %param_11 + %341 = OpLoad %int %treeIndex_1 + %342 = OpIAdd %int %341 %int_1 + OpStore %treeIndex_1 %342 + OpStore %GLF_live1_looplimiter2 %int_0 + OpStore %GLF_live1i %int_0 + OpBranch %343 + %343 = OpLabel + OpLoopMerge %344 %345 None + OpBranch %346 + %346 = OpLabel + OpSelectionMerge %348 None + OpBranchConditional %true %349 %350 + %349 = OpLabel + OpBranch %348 + %350 = OpLabel + OpBranch %344 + %348 = OpLabel + %351 = OpLoad %int %GLF_live1_looplimiter2 + %353 = OpSGreaterThanEqual %bool %351 %int_7 + OpSelectionMerge %354 None + OpBranchConditional %353 %355 %354 + %355 = OpLabel + OpBranch %344 + %354 = OpLabel + %356 = OpLoad %int %GLF_live1_looplimiter2 + %357 = OpIAdd %int %356 %int_1 + OpStore %GLF_live1_looplimiter2 %357 + OpBranch %345 + %345 = OpLabel + %358 = OpLoad %int %GLF_live1i + %359 = OpIAdd %int %358 %int_1 + OpStore %GLF_live1i %359 + OpBranch %343 + %344 = OpLabel + %360 = OpLoad %int %treeIndex_1 + OpStore %param_12 %360 + OpStore %param_13 %int_12 + %362 = OpFunctionCall %void %insert_i1_i1_ %param_12 %param_13 + %365 = OpLoad %int %treeIndex_1 + %366 = OpIAdd %int %365 %int_1 + OpStore %treeIndex_1 %366 + %367 = OpLoad %int %treeIndex_1 + OpStore %param_14 %367 + OpStore %param_15 %int_15 + %368 = OpFunctionCall %void %insert_i1_i1_ %param_14 %param_15 + %371 = OpLoad %int %treeIndex_1 + %372 = OpIAdd %int %371 %int_1 + OpStore %treeIndex_1 %372 + %373 = OpLoad %int %treeIndex_1 + OpStore %param_16 %373 + OpStore %param_17 %int_7 + %374 = OpFunctionCall %void %insert_i1_i1_ %param_16 %param_17 + %377 = OpLoad %int %treeIndex_1 + %378 = OpIAdd %int %377 %int_1 + OpStore %treeIndex_1 %378 + %379 = OpLoad %int %treeIndex_1 + OpStore %param_18 %379 + OpStore %param_19 %int_8 + %381 = OpFunctionCall %void %insert_i1_i1_ %param_18 %param_19 + %384 = OpLoad %int %treeIndex_1 + %385 = OpIAdd %int %384 %int_1 + OpStore %treeIndex_1 %385 + %386 = OpLoad %int %treeIndex_1 + OpStore %param_20 %386 + OpStore %param_21 %int_2 + %388 = OpFunctionCall %void %insert_i1_i1_ %param_20 %param_21 + %391 = OpLoad %int %treeIndex_1 + %392 = OpIAdd %int %391 %int_1 + OpStore %treeIndex_1 %392 + %393 = OpLoad %int %treeIndex_1 + OpStore %param_22 %393 + OpStore %param_23 %int_6 + %394 = OpFunctionCall %void %insert_i1_i1_ %param_22 %param_23 + %397 = OpLoad %int %treeIndex_1 + %398 = OpIAdd %int %397 %int_1 + OpStore %treeIndex_1 %398 + OpStore %GLF_live4_looplimiter3 %int_0 + OpStore %GLF_live4i %int_0 + OpBranch %399 + %399 = OpLabel + OpLoopMerge %400 %401 None + OpBranch %402 + %402 = OpLabel + OpSelectionMerge %403 None + OpBranchConditional %true %404 %405 + %404 = OpLabel + OpBranch %403 + %405 = OpLabel + OpBranch %400 + %403 = OpLabel + %406 = OpLoad %int %GLF_live4_looplimiter3 + %408 = OpSGreaterThanEqual %bool %406 %int_3 + OpSelectionMerge %409 None + OpBranchConditional %408 %410 %409 + %410 = OpLabel + OpBranch %400 + %409 = OpLabel + %411 = OpLoad %int %GLF_live4_looplimiter3 + %412 = OpIAdd %int %411 %int_1 + OpStore %GLF_live4_looplimiter3 %412 + OpStore %GLF_live4index %int_1 + %413 = OpLoad %int %GLF_live4index + %414 = OpLoad %int %GLF_live4index + %415 = OpLoad %int %GLF_live4index + %416 = OpAccessChain %_ptr_Function_float %GLF_live4obj %uint_1 %int_1 + %417 = OpLoad %float %416 + %419 = OpSGreaterThanEqual %bool %413 %int_0 + OpSelectionMerge %420 None + OpBranchConditional %419 %421 %420 + %421 = OpLabel + %423 = OpSLessThan %bool %414 %int_10 + OpBranch %420 + %420 = OpLabel + %424 = OpPhi %bool %419 %409 %423 %421 + %418 = OpSelect %int %424 %415 %int_0 + %425 = OpAccessChain %_ptr_Function_float %GLF_live4obj %uint_1 %418 + OpStore %425 %417 + %426 = OpLoad %int %GLF_live4i + %427 = OpLoad %int %GLF_live4i + %428 = OpLoad %int %GLF_live4i + %430 = OpSGreaterThanEqual %bool %426 %int_0 + OpSelectionMerge %431 None + OpBranchConditional %430 %432 %431 + %432 = OpLabel + %433 = OpSLessThan %bool %427 %int_10 + OpBranch %431 + %431 = OpLabel + %434 = OpPhi %bool %430 %420 %433 %432 + %429 = OpSelect %int %434 %428 %int_0 + %435 = OpAccessChain %_ptr_Function_float %GLF_live4obj %uint_1 %429 + OpStore %435 %float_1 + OpBranch %401 + %401 = OpLabel + %436 = OpLoad %int %GLF_live4i + %437 = OpIAdd %int %436 %int_1 + OpStore %GLF_live4i %437 + OpBranch %399 + %400 = OpLabel + %438 = OpLoad %int %treeIndex_1 + OpStore %param_24 %438 + OpStore %param_25 %int_17 + %440 = OpFunctionCall %void %insert_i1_i1_ %param_24 %param_25 + %443 = OpAccessChain %_ptr_Uniform_float %x_27 %uint_0 %uint_0 + %444 = OpLoad %float %443 + %445 = OpAccessChain %_ptr_Uniform_float %x_27 %uint_0 %uint_1 + %446 = OpLoad %float %445 + %447 = OpFOrdGreaterThan %bool %444 %446 + OpSelectionMerge %448 None + OpBranchConditional %447 %449 %448 + %449 = OpLabel + OpReturn + %448 = OpLabel + %450 = OpLoad %int %treeIndex_1 + %451 = OpIAdd %int %450 %int_1 + OpStore %treeIndex_1 %451 + %452 = OpLoad %int %treeIndex_1 + OpStore %param_26 %452 + OpStore %param_27 %int_13 + %454 = OpFunctionCall %void %insert_i1_i1_ %param_26 %param_27 + %457 = OpLoad %v4float %gl_FragCoord + %458 = OpCompositeExtract %float %457 1 + %459 = OpCompositeExtract %float %457 0 + %460 = OpCompositeConstruct %v2float %458 %459 + %463 = OpFDiv %v2float %460 %462 + OpStore %z %463 + %464 = OpAccessChain %_ptr_Function_float %z %uint_0 + %465 = OpLoad %float %464 + OpStore %param_28 %465 + %466 = OpFunctionCall %float %makeFrame_f1_ %param_28 + OpStore %x %466 + %468 = OpAccessChain %_ptr_Function_float %z %uint_1 + %469 = OpLoad %float %468 + OpStore %param_29 %469 + %470 = OpFunctionCall %float %makeFrame_f1_ %param_29 + OpStore %y %470 + OpStore %sum %int_n100 + OpStore %target_1 %int_0 + OpBranch %473 + %473 = OpLabel + OpLoopMerge %474 %475 None + OpBranch %476 + %476 = OpLabel + %477 = OpLoad %int %target_1 + %479 = OpSLessThan %bool %477 %int_20 + OpSelectionMerge %480 None + OpBranchConditional %479 %481 %482 + %481 = OpLabel + OpBranch %480 + %482 = OpLabel + OpBranch %474 + %480 = OpLabel + %483 = OpLoad %int %target_1 + OpStore %param_30 %483 + %484 = OpFunctionCall %int %search_i1_ %param_30 + OpStore %result %484 + %486 = OpLoad %int %result + %487 = OpSGreaterThan %bool %486 %int_0 + OpSelectionMerge %488 None + OpBranchConditional %487 %489 %490 + %489 = OpLabel + OpBranch %488 + %490 = OpLabel + %491 = OpLoad %int %result + OpSelectionMerge %492 None + OpSwitch %491 %493 0 %494 -1 %495 + %494 = OpLabel + OpReturn + %495 = OpLabel + %496 = OpLoad %int %sum + %497 = OpIAdd %int %496 %int_1 + OpStore %sum %497 + OpBranch %492 + %493 = OpLabel + OpBranch %492 + %492 = OpLabel + OpBranch %488 + %488 = OpLabel + OpBranch %475 + %475 = OpLabel + %498 = OpLoad %int %target_1 + %499 = OpIAdd %int %498 %int_1 + OpStore %target_1 %499 + OpBranch %473 + %474 = OpLabel + %500 = OpLoad %float %x + %501 = OpLoad %float %y + %502 = OpLoad %int %sum + %503 = OpConvertSToF %float %502 + %504 = OpFMul %float %501 %503 + %505 = OpFAdd %float %500 %504 + OpStore %a %505 + %506 = OpAccessChain %_ptr_Uniform_float %x_27 %uint_0 %uint_0 + %507 = OpLoad %float %506 + %508 = OpAccessChain %_ptr_Uniform_float %x_27 %uint_0 %uint_1 + %509 = OpLoad %float %508 + %510 = OpFOrdLessThan %bool %507 %509 + OpSelectionMerge %511 None + OpBranchConditional %510 %512 %513 + %512 = OpLabel + OpStore %x_235 %514 + OpBranch %511 + %513 = OpLabel + %515 = OpLoad %float %a + OpStore %param_31 %515 + %516 = OpFunctionCall %v3float %hueColor_f1_ %param_31 + OpStore %x_235 %516 + OpBranch %511 + %511 = OpLabel + %518 = OpLoad %v3float %x_235 + %519 = OpCompositeExtract %float %518 0 + %520 = OpCompositeExtract %float %518 1 + %521 = OpCompositeExtract %float %518 2 + %522 = OpCompositeConstruct %v4float %519 %520 %521 %float_1 + OpStore %x_GLF_color %522 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %523 +%tint_symbol_1 = OpFunctionParameter %main_out + %527 = OpLabel + %528 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %528 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %276 + %530 = OpLabel + %531 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %531 + %532 = OpFunctionCall %void %main_1 + %534 = OpLoad %v4float %x_GLF_color + %535 = OpCompositeConstruct %main_out %534 + %533 = OpFunctionCall %void %tint_symbol_3 %535 + OpReturn + OpFunctionEnd +1:1: The continue construct with the continue target 152[%152] is not post dominated by the back-edge block 163[%163] + %163 = OpLabel + diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..eaa0aec7ea --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.wgsl @@ -0,0 +1,420 @@ +struct BST { + data : i32; + leftIndex : i32; + rightIndex : i32; +}; + +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +struct Obj { + odd_numbers : array; + even_numbers : array; +}; + +var tree_1 : array; + +[[group(0), binding(0)]] var x_27 : buf0; + +var gl_FragCoord : vec4; + +var x_GLF_color : vec4; + +fn makeTreeNode_struct_BST_i1_i1_i11_i1_(tree : ptr, data : ptr) { + let x_74 : i32 = *(data); + (*(tree)).data = x_74; + (*(tree)).leftIndex = -1; + (*(tree)).rightIndex = -1; + return; +} + +fn insert_i1_i1_(treeIndex : ptr, data_1 : ptr) { + var baseIndex : i32; + var param : BST; + var param_1 : i32; + var param_2 : BST; + var param_3 : i32; + var GLF_live8i : i32; + var GLF_live8A : array; + baseIndex = 0; + loop { + let x_75 : i32 = baseIndex; + let x_76 : i32 = *(treeIndex); + if ((x_75 <= x_76)) { + } else { + break; + } + let x_77 : i32 = *(data_1); + let x_78 : i32 = baseIndex; + let x_79 : i32 = tree_1[x_78].data; + if ((x_77 <= x_79)) { + let x_80 : i32 = baseIndex; + let x_81 : i32 = tree_1[x_80].leftIndex; + if ((x_81 == -1)) { + let x_82 : i32 = baseIndex; + let x_83 : i32 = *(treeIndex); + tree_1[x_82].leftIndex = x_83; + let x_84 : i32 = *(treeIndex); + let x_350 : BST = tree_1[x_84]; + param = x_350; + let x_85 : i32 = *(data_1); + param_1 = x_85; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1)); + let x_352 : BST = param; + tree_1[x_84] = x_352; + return; + } else { + let x_86 : i32 = baseIndex; + let x_87 : i32 = tree_1[x_86].leftIndex; + baseIndex = x_87; + continue; + } + } else { + let x_88 : i32 = baseIndex; + let x_89 : i32 = tree_1[x_88].rightIndex; + if ((x_89 == -1)) { + let x_90 : i32 = baseIndex; + let x_91 : i32 = *(treeIndex); + tree_1[x_90].rightIndex = x_91; + let x_92 : i32 = *(treeIndex); + let x_362 : BST = tree_1[x_92]; + param_2 = x_362; + let x_93 : i32 = *(data_1); + param_3 = x_93; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3)); + let x_364 : BST = param_2; + tree_1[x_92] = x_364; + return; + } else { + GLF_live8i = 1; + let x_94 : i32 = GLF_live8i; + let x_95 : i32 = GLF_live8i; + let x_96 : i32 = GLF_live8i; + let x_369 : i32 = select(0, x_96, ((x_94 >= 0) && (x_95 < 50))); + let x_371 : f32 = GLF_live8A[0]; + let x_373 : f32 = GLF_live8A[x_369]; + GLF_live8A[x_369] = (x_373 + x_371); + loop { + let x_97 : i32 = baseIndex; + let x_98 : i32 = tree_1[x_97].rightIndex; + baseIndex = x_98; + + continuing { + let x_382 : f32 = x_27.injectionSwitch.x; + let x_384 : f32 = x_27.injectionSwitch.y; + if ((x_382 > x_384)) { + } else { + break; + } + } + } + continue; + } + } + } + return; +} + +fn search_i1_(target : ptr) -> i32 { + var index : i32; + var currentNode : BST; + var x_387 : i32; + index = 0; + loop { + let x_99 : i32 = index; + if ((x_99 != -1)) { + } else { + break; + } + let x_100 : i32 = index; + let x_395 : BST = tree_1[x_100]; + currentNode = x_395; + let x_101 : i32 = currentNode.data; + let x_102 : i32 = *(target); + if ((x_101 == x_102)) { + let x_103 : i32 = *(target); + return x_103; + } + let x_104 : i32 = *(target); + let x_105 : i32 = currentNode.data; + if ((x_104 > x_105)) { + let x_106 : i32 = currentNode.rightIndex; + x_387 = x_106; + } else { + let x_107 : i32 = currentNode.leftIndex; + x_387 = x_107; + } + let x_108 : i32 = x_387; + index = x_108; + } + return -1; +} + +fn makeFrame_f1_(v : ptr) -> f32 { + var param_5 : i32; + var param_6 : i32; + var param_7 : i32; + let x_418 : f32 = *(v); + *(v) = (x_418 * 6.5); + let x_420 : f32 = *(v); + if ((x_420 < 1.5)) { + param_5 = 100; + let x_110 : i32 = search_i1_(&(param_5)); + return f32(x_110); + } + let x_425 : f32 = *(v); + if ((x_425 < 4.0)) { + return 0.0; + } + let x_429 : f32 = *(v); + param_6 = 6; + let x_111 : i32 = search_i1_(&(param_6)); + if ((x_429 < f32(x_111))) { + return 1.0; + } + param_7 = 30; + let x_112 : i32 = search_i1_(&(param_7)); + return (10.0 + f32(x_112)); +} + +fn hueColor_f1_(angle : ptr) -> vec3 { + var nodeData : f32; + var param_4 : i32; + param_4 = 15; + let x_109 : i32 = search_i1_(&(param_4)); + nodeData = f32(x_109); + let x_409 : f32 = *(angle); + let x_410 : f32 = nodeData; + return ((vec3(30.0, 30.0, 30.0) + (vec3(1.0, 5.0, x_410) * x_409)) / vec3(50.0, 50.0, 50.0)); +} + +fn main_1() { + var treeIndex_1 : i32; + var param_8 : BST; + var param_9 : i32; + var param_10 : i32; + var param_11 : i32; + var GLF_live1_looplimiter2 : i32; + var GLF_live1i : i32; + var param_12 : i32; + var param_13 : i32; + var param_14 : i32; + var param_15 : i32; + var param_16 : i32; + var param_17 : i32; + var param_18 : i32; + var param_19 : i32; + var param_20 : i32; + var param_21 : i32; + var param_22 : i32; + var param_23 : i32; + var GLF_live4_looplimiter3 : i32; + var GLF_live4i : i32; + var GLF_live4index : i32; + var GLF_live4obj : Obj; + var param_24 : i32; + var param_25 : i32; + var param_26 : i32; + var param_27 : i32; + var z : vec2; + var x : f32; + var param_28 : f32; + var y : f32; + var param_29 : f32; + var sum : i32; + var target_1 : i32; + var result : i32; + var param_30 : i32; + var a : f32; + var x_235 : vec3; + var param_31 : f32; + treeIndex_1 = 0; + let x_237 : BST = tree_1[0]; + param_8 = x_237; + param_9 = 9; + makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_8), &(param_9)); + let x_239 : BST = param_8; + tree_1[0] = x_239; + let x_113 : i32 = treeIndex_1; + treeIndex_1 = (x_113 + 1); + let x_115 : i32 = treeIndex_1; + param_10 = x_115; + param_11 = 5; + insert_i1_i1_(&(param_10), &(param_11)); + let x_116 : i32 = treeIndex_1; + treeIndex_1 = (x_116 + 1); + GLF_live1_looplimiter2 = 0; + GLF_live1i = 0; + loop { + if (true) { + } else { + break; + } + let x_118 : i32 = GLF_live1_looplimiter2; + if ((x_118 >= 7)) { + break; + } + let x_119 : i32 = GLF_live1_looplimiter2; + GLF_live1_looplimiter2 = (x_119 + 1); + + continuing { + let x_121 : i32 = GLF_live1i; + GLF_live1i = (x_121 + 1); + } + } + let x_123 : i32 = treeIndex_1; + param_12 = x_123; + param_13 = 12; + insert_i1_i1_(&(param_12), &(param_13)); + let x_124 : i32 = treeIndex_1; + treeIndex_1 = (x_124 + 1); + let x_126 : i32 = treeIndex_1; + param_14 = x_126; + param_15 = 15; + insert_i1_i1_(&(param_14), &(param_15)); + let x_127 : i32 = treeIndex_1; + treeIndex_1 = (x_127 + 1); + let x_129 : i32 = treeIndex_1; + param_16 = x_129; + param_17 = 7; + insert_i1_i1_(&(param_16), &(param_17)); + let x_130 : i32 = treeIndex_1; + treeIndex_1 = (x_130 + 1); + let x_132 : i32 = treeIndex_1; + param_18 = x_132; + param_19 = 8; + insert_i1_i1_(&(param_18), &(param_19)); + let x_133 : i32 = treeIndex_1; + treeIndex_1 = (x_133 + 1); + let x_135 : i32 = treeIndex_1; + param_20 = x_135; + param_21 = 2; + insert_i1_i1_(&(param_20), &(param_21)); + let x_136 : i32 = treeIndex_1; + treeIndex_1 = (x_136 + 1); + let x_138 : i32 = treeIndex_1; + param_22 = x_138; + param_23 = 6; + insert_i1_i1_(&(param_22), &(param_23)); + let x_139 : i32 = treeIndex_1; + treeIndex_1 = (x_139 + 1); + GLF_live4_looplimiter3 = 0; + GLF_live4i = 0; + loop { + if (true) { + } else { + break; + } + let x_141 : i32 = GLF_live4_looplimiter3; + if ((x_141 >= 3)) { + break; + } + let x_142 : i32 = GLF_live4_looplimiter3; + GLF_live4_looplimiter3 = (x_142 + 1); + GLF_live4index = 1; + let x_144 : i32 = GLF_live4index; + let x_145 : i32 = GLF_live4index; + let x_146 : i32 = GLF_live4index; + let x_269 : f32 = GLF_live4obj.even_numbers[1]; + GLF_live4obj.even_numbers[select(0, x_146, ((x_144 >= 0) && (x_145 < 10)))] = x_269; + let x_147 : i32 = GLF_live4i; + let x_148 : i32 = GLF_live4i; + let x_149 : i32 = GLF_live4i; + GLF_live4obj.even_numbers[select(0, x_149, ((x_147 >= 0) && (x_148 < 10)))] = 1.0; + + continuing { + let x_150 : i32 = GLF_live4i; + GLF_live4i = (x_150 + 1); + } + } + let x_152 : i32 = treeIndex_1; + param_24 = x_152; + param_25 = 17; + insert_i1_i1_(&(param_24), &(param_25)); + let x_278 : f32 = x_27.injectionSwitch.x; + let x_280 : f32 = x_27.injectionSwitch.y; + if ((x_278 > x_280)) { + return; + } + let x_153 : i32 = treeIndex_1; + treeIndex_1 = (x_153 + 1); + let x_155 : i32 = treeIndex_1; + param_26 = x_155; + param_27 = 13; + insert_i1_i1_(&(param_26), &(param_27)); + let x_285 : vec4 = gl_FragCoord; + z = (vec2(x_285.y, x_285.x) / vec2(256.0, 256.0)); + let x_289 : f32 = z.x; + param_28 = x_289; + let x_290 : f32 = makeFrame_f1_(&(param_28)); + x = x_290; + let x_292 : f32 = z.y; + param_29 = x_292; + let x_293 : f32 = makeFrame_f1_(&(param_29)); + y = x_293; + sum = -100; + target_1 = 0; + loop { + let x_156 : i32 = target_1; + if ((x_156 < 20)) { + } else { + break; + } + let x_157 : i32 = target_1; + param_30 = x_157; + let x_158 : i32 = search_i1_(&(param_30)); + result = x_158; + let x_159 : i32 = result; + if ((x_159 > 0)) { + } else { + let x_160 : i32 = result; + switch(x_160) { + case 0: { + return; + } + case -1: { + let x_161 : i32 = sum; + sum = (x_161 + 1); + } + default: { + } + } + } + + continuing { + let x_163 : i32 = target_1; + target_1 = (x_163 + 1); + } + } + let x_307 : f32 = x; + let x_308 : f32 = y; + let x_165 : i32 = sum; + a = (x_307 + (x_308 * f32(x_165))); + let x_313 : f32 = x_27.injectionSwitch.x; + let x_315 : f32 = x_27.injectionSwitch.y; + if ((x_313 < x_315)) { + x_235 = vec3(1.0, 0.0, 0.0); + } else { + let x_320 : f32 = a; + param_31 = x_320; + let x_321 : vec3 = hueColor_f1_(&(param_31)); + x_235 = x_321; + } + let x_322 : vec3 = x_235; + x_GLF_color = vec4(x_322.x, x_322.y, x_322.z, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm new file mode 100644 index 0000000000..553996a5bb --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm @@ -0,0 +1,213 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %m43 "m43" + OpName %ll1 "ll1" + OpName %rows "rows" + OpName %_GLF_color "_GLF_color" + OpName %ll4 "ll4" + OpName %ll2 "ll2" + OpName %c "c" + OpName %tempm43 "tempm43" + OpName %ll3 "ll3" + OpName %d "d" + OpName %r "r" + OpName %sums "sums" + OpName %idx "idx" + OpDecorate %ll1 RelaxedPrecision + OpDecorate %rows RelaxedPrecision + OpDecorate %_GLF_color Location 0 + OpDecorate %16 RelaxedPrecision + OpDecorate %17 RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %ll4 RelaxedPrecision + OpDecorate %ll2 RelaxedPrecision + OpDecorate %c RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %22 RelaxedPrecision + OpDecorate %ll3 RelaxedPrecision + OpDecorate %d RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %r RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %idx RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + %void = OpTypeVoid + %41 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %48 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %49 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %50 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %51 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %52 = OpConstantComposite %mat4v3float %48 %49 %50 %51 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %61 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_5 = OpConstant %int 5 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 +%_ptr_Function_float = OpTypePointer Function %float + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %41 + %74 = OpLabel + %m43 = OpVariable %_ptr_Function_mat4v3float Function + %ll1 = OpVariable %_ptr_Function_int Function + %rows = OpVariable %_ptr_Function_int Function + %ll4 = OpVariable %_ptr_Function_int Function + %ll2 = OpVariable %_ptr_Function_int Function + %c = OpVariable %_ptr_Function_int Function + %tempm43 = OpVariable %_ptr_Function_mat4v3float Function + %ll3 = OpVariable %_ptr_Function_int Function + %d = OpVariable %_ptr_Function_int Function + %r = OpVariable %_ptr_Function_int Function + %sums = OpVariable %_ptr_Function__arr_float_uint_9 Function + %idx = OpVariable %_ptr_Function_int Function + OpStore %m43 %52 + OpStore %ll1 %int_0 + OpStore %rows %int_2 + OpBranch %75 + %75 = OpLabel + OpLoopMerge %76 %77 None + OpBranch %78 + %78 = OpLabel + OpBranchConditional %true %79 %76 + %79 = OpLabel + OpStore %_GLF_color %61 + %16 = OpLoad %int %ll1 + %80 = OpSGreaterThanEqual %bool %16 %int_5 + OpSelectionMerge %81 None + OpBranchConditional %80 %82 %81 + %82 = OpLabel + OpBranch %76 + %81 = OpLabel + %17 = OpLoad %int %ll1 + %18 = OpIAdd %int %17 %int_1 + OpStore %ll1 %18 + OpStore %ll4 %int_10 + OpStore %ll2 %int_0 + OpStore %c %int_0 + OpBranch %83 + %83 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + %19 = OpLoad %int %c + %87 = OpSLessThan %bool %19 %int_1 + OpBranchConditional %87 %88 %84 + %88 = OpLabel + %20 = OpLoad %int %ll2 + %89 = OpSGreaterThanEqual %bool %20 %int_0 + OpSelectionMerge %90 None + OpBranchConditional %89 %91 %90 + %91 = OpLabel + OpBranch %84 + %90 = OpLabel + %21 = OpLoad %int %ll2 + %22 = OpIAdd %int %21 %int_1 + OpStore %ll2 %22 + %92 = OpLoad %mat4v3float %m43 + OpStore %tempm43 %92 + OpStore %ll3 %int_0 + OpStore %d %int_0 + OpBranch %93 + %93 = OpLabel + OpLoopMerge %94 %95 None + OpBranch %96 + %96 = OpLabel + %23 = OpLoad %int %ll4 + %97 = OpSLessThan %bool %int_1 %23 + OpBranchConditional %97 %98 %94 + %98 = OpLabel + %24 = OpLoad %int %d + %99 = OpSGreaterThanEqual %bool %24 %int_0 + %25 = OpLoad %int %d + %100 = OpSLessThan %bool %25 %int_4 + %101 = OpLogicalAnd %bool %99 %100 + %26 = OpLoad %int %d + %102 = OpSelect %int %101 %26 %int_0 + %27 = OpLoad %int %r + %103 = OpSGreaterThanEqual %bool %27 %int_0 + %28 = OpLoad %int %r + %104 = OpSLessThan %bool %28 %int_3 + %105 = OpLogicalAnd %bool %103 %104 + %29 = OpLoad %int %r + %106 = OpSelect %int %105 %29 %int_0 + %107 = OpAccessChain %_ptr_Function_float %tempm43 %102 %106 + OpStore %107 %float_1 + OpBranch %95 + %95 = OpLabel + %30 = OpLoad %int %d + %31 = OpIAdd %int %30 %int_1 + OpStore %d %31 + OpBranch %93 + %94 = OpLabel + %32 = OpLoad %int %idx + %108 = OpSGreaterThanEqual %bool %32 %int_0 + %33 = OpLoad %int %idx + %109 = OpSLessThan %bool %33 %int_9 + %110 = OpLogicalAnd %bool %108 %109 + %34 = OpLoad %int %idx + %111 = OpSelect %int %110 %34 %int_0 + %35 = OpLoad %int %c + %112 = OpAccessChain %_ptr_Function_float %m43 %35 %uint_1 + %113 = OpLoad %float %112 + %114 = OpAccessChain %_ptr_Function_float %sums %111 + %115 = OpLoad %float %114 + %116 = OpFAdd %float %115 %113 + %117 = OpAccessChain %_ptr_Function_float %sums %111 + OpStore %117 %116 + OpBranch %85 + %85 = OpLabel + %36 = OpLoad %int %c + %37 = OpIAdd %int %36 %int_1 + OpStore %c %37 + OpBranch %83 + %84 = OpLabel + %38 = OpLoad %int %idx + %39 = OpIAdd %int %38 %int_1 + OpStore %idx %39 + OpBranch %77 + %77 = OpLabel + OpBranch %75 + %76 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..26a0704d05 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.hlsl @@ -0,0 +1,85 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll1 = 0; + int rows = 0; + int ll4 = 0; + int ll2 = 0; + int c = 0; + float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll3 = 0; + int d = 0; + int r = 0; + float sums[9] = (float[9])0; + int idx = 0; + m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); + ll1 = 0; + rows = 2; + while (true) { + if (true) { + } else { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + if ((ll1 >= 5)) { + break; + } + ll1 = (ll1 + 1); + ll4 = 10; + ll2 = 0; + c = 0; + { + for(; (c < 1); c = (c + 1)) { + if ((ll2 >= 0)) { + break; + } + ll2 = (ll2 + 1); + tempm43 = m43; + ll3 = 0; + d = 0; + { + for(; (1 < ll4); d = (d + 1)) { + bool tint_tmp = (d >= 0); + if (tint_tmp) { + tint_tmp = (d < 4); + } + bool tint_tmp_1 = (r >= 0); + if (tint_tmp_1) { + tint_tmp_1 = (r < 3); + } + set_float3(tempm43[((tint_tmp) ? d : 0)], ((tint_tmp_1) ? r : 0), 1.0f); + } + } + bool tint_tmp_2 = (idx >= 0); + if (tint_tmp_2) { + tint_tmp_2 = (idx < 9); + } + const int x_111 = ((tint_tmp_2) ? idx : 0); + const float x_113 = m43[c].y; + const float x_115 = sums[x_111]; + sums[x_111] = (x_115 + x_113); + } + } + idx = (idx + 1); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..2070937b5d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.msl @@ -0,0 +1,105 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + float arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float4x3 m43 = float4x3(0.0f); + int ll1 = 0; + int rows = 0; + int ll4 = 0; + int ll2 = 0; + int c = 0; + float4x3 tempm43 = float4x3(0.0f); + int ll3 = 0; + int d = 0; + int r = 0; + tint_array_wrapper sums = {}; + int idx = 0; + m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); + ll1 = 0; + rows = 2; + while (true) { + if (true) { + } else { + break; + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + int const x_16 = ll1; + if ((x_16 >= 5)) { + break; + } + int const x_17 = ll1; + ll1 = (x_17 + 1); + ll4 = 10; + ll2 = 0; + c = 0; + while (true) { + int const x_19 = c; + if ((x_19 < 1)) { + } else { + break; + } + int const x_20 = ll2; + if ((x_20 >= 0)) { + break; + } + int const x_21 = ll2; + ll2 = (x_21 + 1); + float4x3 const x_92 = m43; + tempm43 = x_92; + ll3 = 0; + d = 0; + while (true) { + int const x_23 = ll4; + if ((1 < x_23)) { + } else { + break; + } + int const x_24 = d; + int const x_25 = d; + int const x_26 = d; + int const x_27 = r; + int const x_28 = r; + int const x_29 = r; + tempm43[select(0, x_26, ((x_24 >= 0) && (x_25 < 4)))][select(0, x_29, ((x_27 >= 0) && (x_28 < 3)))] = 1.0f; + { + int const x_30 = d; + d = (x_30 + 1); + } + } + int const x_32 = idx; + int const x_33 = idx; + int const x_34 = idx; + int const x_111 = select(0, x_34, ((x_32 >= 0) && (x_33 < 9))); + int const x_35 = c; + float const x_113 = m43[x_35].y; + float const x_115 = sums.arr[x_111]; + sums.arr[x_111] = (x_115 + x_113); + { + int const x_36 = c; + c = (x_36 + 1); + } + } + int const x_38 = idx; + idx = (x_38 + 1); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..397a1d8e9d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.spvasm @@ -0,0 +1,244 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 147 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m43 "m43" + OpName %ll1 "ll1" + OpName %rows "rows" + OpName %ll4 "ll4" + OpName %ll2 "ll2" + OpName %c "c" + OpName %tempm43 "tempm43" + OpName %ll3 "ll3" + OpName %d "d" + OpName %r "r" + OpName %sums "sums" + OpName %idx "idx" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %16 = OpConstantNull %mat4v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %34 = OpConstantNull %_arr_float_uint_9 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %39 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %40 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %41 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %42 = OpConstantComposite %mat4v3float %38 %39 %40 %41 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %54 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_5 = OpConstant %int 5 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 +%_ptr_Function_float = OpTypePointer Function %float + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %135 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %m43 = OpVariable %_ptr_Function_mat4v3float Function %16 + %ll1 = OpVariable %_ptr_Function_int Function %20 + %rows = OpVariable %_ptr_Function_int Function %20 + %ll4 = OpVariable %_ptr_Function_int Function %20 + %ll2 = OpVariable %_ptr_Function_int Function %20 + %c = OpVariable %_ptr_Function_int Function %20 + %tempm43 = OpVariable %_ptr_Function_mat4v3float Function %16 + %ll3 = OpVariable %_ptr_Function_int Function %20 + %d = OpVariable %_ptr_Function_int Function %20 + %r = OpVariable %_ptr_Function_int Function %20 + %sums = OpVariable %_ptr_Function__arr_float_uint_9 Function %34 + %idx = OpVariable %_ptr_Function_int Function %20 + OpStore %m43 %42 + OpStore %ll1 %int_0 + OpStore %rows %int_2 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + OpSelectionMerge %51 None + OpBranchConditional %true %52 %53 + %52 = OpLabel + OpBranch %51 + %53 = OpLabel + OpBranch %46 + %51 = OpLabel + OpStore %x_GLF_color %54 + %55 = OpLoad %int %ll1 + %57 = OpSGreaterThanEqual %bool %55 %int_5 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + OpBranch %46 + %58 = OpLabel + %60 = OpLoad %int %ll1 + %62 = OpIAdd %int %60 %int_1 + OpStore %ll1 %62 + OpStore %ll4 %int_10 + OpStore %ll2 %int_0 + OpStore %c %int_0 + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %int %c + %69 = OpSLessThan %bool %68 %int_1 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %65 + %70 = OpLabel + %73 = OpLoad %int %ll2 + %74 = OpSGreaterThanEqual %bool %73 %int_0 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + OpBranch %65 + %75 = OpLabel + %77 = OpLoad %int %ll2 + %78 = OpIAdd %int %77 %int_1 + OpStore %ll2 %78 + %79 = OpLoad %mat4v3float %m43 + OpStore %tempm43 %79 + OpStore %ll3 %int_0 + OpStore %d %int_0 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %int %ll4 + %85 = OpSLessThan %bool %int_1 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + OpBranch %86 + %88 = OpLabel + OpBranch %81 + %86 = OpLabel + %89 = OpLoad %int %d + %90 = OpLoad %int %d + %91 = OpLoad %int %d + %92 = OpLoad %int %r + %93 = OpLoad %int %r + %94 = OpLoad %int %r + %96 = OpSGreaterThanEqual %bool %89 %int_0 + OpSelectionMerge %97 None + OpBranchConditional %96 %98 %97 + %98 = OpLabel + %100 = OpSLessThan %bool %90 %int_4 + OpBranch %97 + %97 = OpLabel + %101 = OpPhi %bool %96 %86 %100 %98 + %95 = OpSelect %int %101 %91 %int_0 + %103 = OpSGreaterThanEqual %bool %92 %int_0 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + %107 = OpSLessThan %bool %93 %int_3 + OpBranch %104 + %104 = OpLabel + %108 = OpPhi %bool %103 %97 %107 %105 + %102 = OpSelect %int %108 %94 %int_0 + %110 = OpAccessChain %_ptr_Function_float %tempm43 %95 %102 + OpStore %110 %float_1 + OpBranch %82 + %82 = OpLabel + %111 = OpLoad %int %d + %112 = OpIAdd %int %111 %int_1 + OpStore %d %112 + OpBranch %80 + %81 = OpLabel + %113 = OpLoad %int %idx + %114 = OpLoad %int %idx + %115 = OpLoad %int %idx + %117 = OpSGreaterThanEqual %bool %113 %int_0 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %121 = OpSLessThan %bool %114 %int_9 + OpBranch %118 + %118 = OpLabel + %122 = OpPhi %bool %117 %81 %121 %119 + %116 = OpSelect %int %122 %115 %int_0 + %123 = OpLoad %int %c + %125 = OpAccessChain %_ptr_Function_float %m43 %123 %uint_1 + %126 = OpLoad %float %125 + %127 = OpAccessChain %_ptr_Function_float %sums %116 + %128 = OpLoad %float %127 + %129 = OpAccessChain %_ptr_Function_float %sums %116 + %130 = OpFAdd %float %128 %126 + OpStore %129 %130 + OpBranch %66 + %66 = OpLabel + %131 = OpLoad %int %c + %132 = OpIAdd %int %131 %int_1 + OpStore %c %132 + OpBranch %64 + %65 = OpLabel + %133 = OpLoad %int %idx + %134 = OpIAdd %int %133 %int_1 + OpStore %idx %134 + OpBranch %47 + %47 = OpLabel + OpBranch %45 + %46 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %135 +%tint_symbol = OpFunctionParameter %main_out + %139 = OpLabel + %140 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %140 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %142 = OpLabel + %143 = OpFunctionCall %void %main_1 + %145 = OpLoad %v4float %x_GLF_color + %146 = OpCompositeConstruct %main_out %145 + %144 = OpFunctionCall %void %tint_symbol_2 %146 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..dd185738e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.wgsl @@ -0,0 +1,98 @@ +var x_GLF_color : vec4; + +fn main_1() { + var m43 : mat4x3; + var ll1 : i32; + var rows : i32; + var ll4 : i32; + var ll2 : i32; + var c : i32; + var tempm43 : mat4x3; + var ll3 : i32; + var d : i32; + var r : i32; + var sums : array; + var idx : i32; + m43 = mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0)); + ll1 = 0; + rows = 2; + loop { + if (true) { + } else { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_16 : i32 = ll1; + if ((x_16 >= 5)) { + break; + } + let x_17 : i32 = ll1; + ll1 = (x_17 + 1); + ll4 = 10; + ll2 = 0; + c = 0; + loop { + let x_19 : i32 = c; + if ((x_19 < 1)) { + } else { + break; + } + let x_20 : i32 = ll2; + if ((x_20 >= 0)) { + break; + } + let x_21 : i32 = ll2; + ll2 = (x_21 + 1); + let x_92 : mat4x3 = m43; + tempm43 = x_92; + ll3 = 0; + d = 0; + loop { + let x_23 : i32 = ll4; + if ((1 < x_23)) { + } else { + break; + } + let x_24 : i32 = d; + let x_25 : i32 = d; + let x_26 : i32 = d; + let x_27 : i32 = r; + let x_28 : i32 = r; + let x_29 : i32 = r; + tempm43[select(0, x_26, ((x_24 >= 0) && (x_25 < 4)))][select(0, x_29, ((x_27 >= 0) && (x_28 < 3)))] = 1.0; + + continuing { + let x_30 : i32 = d; + d = (x_30 + 1); + } + } + let x_32 : i32 = idx; + let x_33 : i32 = idx; + let x_34 : i32 = idx; + let x_111 : i32 = select(0, x_34, ((x_32 >= 0) && (x_33 < 9))); + let x_35 : i32 = c; + let x_113 : f32 = m43[x_35].y; + let x_115 : f32 = sums[x_111]; + sums[x_111] = (x_115 + x_113); + + continuing { + let x_36 : i32 = c; + c = (x_36 + 1); + } + } + let x_38 : i32 = idx; + idx = (x_38 + 1); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl new file mode 100644 index 0000000000..dd185738e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl @@ -0,0 +1,98 @@ +var x_GLF_color : vec4; + +fn main_1() { + var m43 : mat4x3; + var ll1 : i32; + var rows : i32; + var ll4 : i32; + var ll2 : i32; + var c : i32; + var tempm43 : mat4x3; + var ll3 : i32; + var d : i32; + var r : i32; + var sums : array; + var idx : i32; + m43 = mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0)); + ll1 = 0; + rows = 2; + loop { + if (true) { + } else { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_16 : i32 = ll1; + if ((x_16 >= 5)) { + break; + } + let x_17 : i32 = ll1; + ll1 = (x_17 + 1); + ll4 = 10; + ll2 = 0; + c = 0; + loop { + let x_19 : i32 = c; + if ((x_19 < 1)) { + } else { + break; + } + let x_20 : i32 = ll2; + if ((x_20 >= 0)) { + break; + } + let x_21 : i32 = ll2; + ll2 = (x_21 + 1); + let x_92 : mat4x3 = m43; + tempm43 = x_92; + ll3 = 0; + d = 0; + loop { + let x_23 : i32 = ll4; + if ((1 < x_23)) { + } else { + break; + } + let x_24 : i32 = d; + let x_25 : i32 = d; + let x_26 : i32 = d; + let x_27 : i32 = r; + let x_28 : i32 = r; + let x_29 : i32 = r; + tempm43[select(0, x_26, ((x_24 >= 0) && (x_25 < 4)))][select(0, x_29, ((x_27 >= 0) && (x_28 < 3)))] = 1.0; + + continuing { + let x_30 : i32 = d; + d = (x_30 + 1); + } + } + let x_32 : i32 = idx; + let x_33 : i32 = idx; + let x_34 : i32 = idx; + let x_111 : i32 = select(0, x_34, ((x_32 >= 0) && (x_33 < 9))); + let x_35 : i32 = c; + let x_113 : f32 = m43[x_35].y; + let x_115 : f32 = sums[x_111]; + sums[x_111] = (x_115 + x_113); + + continuing { + let x_36 : i32 = c; + c = (x_36 + 1); + } + } + let x_38 : i32 = idx; + idx = (x_38 + 1); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..26a0704d05 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.hlsl @@ -0,0 +1,85 @@ +void set_float3(inout float3 vec, int idx, float val) { + vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec; +} + +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll1 = 0; + int rows = 0; + int ll4 = 0; + int ll2 = 0; + int c = 0; + float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + int ll3 = 0; + int d = 0; + int r = 0; + float sums[9] = (float[9])0; + int idx = 0; + m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); + ll1 = 0; + rows = 2; + while (true) { + if (true) { + } else { + break; + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + if ((ll1 >= 5)) { + break; + } + ll1 = (ll1 + 1); + ll4 = 10; + ll2 = 0; + c = 0; + { + for(; (c < 1); c = (c + 1)) { + if ((ll2 >= 0)) { + break; + } + ll2 = (ll2 + 1); + tempm43 = m43; + ll3 = 0; + d = 0; + { + for(; (1 < ll4); d = (d + 1)) { + bool tint_tmp = (d >= 0); + if (tint_tmp) { + tint_tmp = (d < 4); + } + bool tint_tmp_1 = (r >= 0); + if (tint_tmp_1) { + tint_tmp_1 = (r < 3); + } + set_float3(tempm43[((tint_tmp) ? d : 0)], ((tint_tmp_1) ? r : 0), 1.0f); + } + } + bool tint_tmp_2 = (idx >= 0); + if (tint_tmp_2) { + tint_tmp_2 = (idx < 9); + } + const int x_111 = ((tint_tmp_2) ? idx : 0); + const float x_113 = m43[c].y; + const float x_115 = sums[x_111]; + sums[x_111] = (x_115 + x_113); + } + } + idx = (idx + 1); + } + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..2070937b5d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.msl @@ -0,0 +1,105 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + float arr[9]; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + float4x3 m43 = float4x3(0.0f); + int ll1 = 0; + int rows = 0; + int ll4 = 0; + int ll2 = 0; + int c = 0; + float4x3 tempm43 = float4x3(0.0f); + int ll3 = 0; + int d = 0; + int r = 0; + tint_array_wrapper sums = {}; + int idx = 0; + m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f)); + ll1 = 0; + rows = 2; + while (true) { + if (true) { + } else { + break; + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + int const x_16 = ll1; + if ((x_16 >= 5)) { + break; + } + int const x_17 = ll1; + ll1 = (x_17 + 1); + ll4 = 10; + ll2 = 0; + c = 0; + while (true) { + int const x_19 = c; + if ((x_19 < 1)) { + } else { + break; + } + int const x_20 = ll2; + if ((x_20 >= 0)) { + break; + } + int const x_21 = ll2; + ll2 = (x_21 + 1); + float4x3 const x_92 = m43; + tempm43 = x_92; + ll3 = 0; + d = 0; + while (true) { + int const x_23 = ll4; + if ((1 < x_23)) { + } else { + break; + } + int const x_24 = d; + int const x_25 = d; + int const x_26 = d; + int const x_27 = r; + int const x_28 = r; + int const x_29 = r; + tempm43[select(0, x_26, ((x_24 >= 0) && (x_25 < 4)))][select(0, x_29, ((x_27 >= 0) && (x_28 < 3)))] = 1.0f; + { + int const x_30 = d; + d = (x_30 + 1); + } + } + int const x_32 = idx; + int const x_33 = idx; + int const x_34 = idx; + int const x_111 = select(0, x_34, ((x_32 >= 0) && (x_33 < 9))); + int const x_35 = c; + float const x_113 = m43[x_35].y; + float const x_115 = sums.arr[x_111]; + sums.arr[x_111] = (x_115 + x_113); + { + int const x_36 = c; + c = (x_36 + 1); + } + } + int const x_38 = idx; + idx = (x_38 + 1); + } + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..397a1d8e9d --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.spvasm @@ -0,0 +1,244 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 147 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %m43 "m43" + OpName %ll1 "ll1" + OpName %rows "rows" + OpName %ll4 "ll4" + OpName %ll2 "ll2" + OpName %c "c" + OpName %tempm43 "tempm43" + OpName %ll3 "ll3" + OpName %d "d" + OpName %r "r" + OpName %sums "sums" + OpName %idx "idx" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %_arr_float_uint_9 ArrayStride 4 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %16 = OpConstantNull %mat4v3float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %20 = OpConstantNull %int + %uint = OpTypeInt 32 0 + %uint_9 = OpConstant %uint 9 +%_arr_float_uint_9 = OpTypeArray %float %uint_9 +%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9 + %34 = OpConstantNull %_arr_float_uint_9 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %38 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %39 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %40 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %41 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %42 = OpConstantComposite %mat4v3float %38 %39 %40 %41 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %54 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %int_5 = OpConstant %int 5 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 +%_ptr_Function_float = OpTypePointer Function %float + %int_9 = OpConstant %int 9 + %uint_1 = OpConstant %uint 1 + %main_out = OpTypeStruct %v4float + %135 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + %m43 = OpVariable %_ptr_Function_mat4v3float Function %16 + %ll1 = OpVariable %_ptr_Function_int Function %20 + %rows = OpVariable %_ptr_Function_int Function %20 + %ll4 = OpVariable %_ptr_Function_int Function %20 + %ll2 = OpVariable %_ptr_Function_int Function %20 + %c = OpVariable %_ptr_Function_int Function %20 + %tempm43 = OpVariable %_ptr_Function_mat4v3float Function %16 + %ll3 = OpVariable %_ptr_Function_int Function %20 + %d = OpVariable %_ptr_Function_int Function %20 + %r = OpVariable %_ptr_Function_int Function %20 + %sums = OpVariable %_ptr_Function__arr_float_uint_9 Function %34 + %idx = OpVariable %_ptr_Function_int Function %20 + OpStore %m43 %42 + OpStore %ll1 %int_0 + OpStore %rows %int_2 + OpBranch %45 + %45 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + OpSelectionMerge %51 None + OpBranchConditional %true %52 %53 + %52 = OpLabel + OpBranch %51 + %53 = OpLabel + OpBranch %46 + %51 = OpLabel + OpStore %x_GLF_color %54 + %55 = OpLoad %int %ll1 + %57 = OpSGreaterThanEqual %bool %55 %int_5 + OpSelectionMerge %58 None + OpBranchConditional %57 %59 %58 + %59 = OpLabel + OpBranch %46 + %58 = OpLabel + %60 = OpLoad %int %ll1 + %62 = OpIAdd %int %60 %int_1 + OpStore %ll1 %62 + OpStore %ll4 %int_10 + OpStore %ll2 %int_0 + OpStore %c %int_0 + OpBranch %64 + %64 = OpLabel + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %68 = OpLoad %int %c + %69 = OpSLessThan %bool %68 %int_1 + OpSelectionMerge %70 None + OpBranchConditional %69 %71 %72 + %71 = OpLabel + OpBranch %70 + %72 = OpLabel + OpBranch %65 + %70 = OpLabel + %73 = OpLoad %int %ll2 + %74 = OpSGreaterThanEqual %bool %73 %int_0 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %75 + %76 = OpLabel + OpBranch %65 + %75 = OpLabel + %77 = OpLoad %int %ll2 + %78 = OpIAdd %int %77 %int_1 + OpStore %ll2 %78 + %79 = OpLoad %mat4v3float %m43 + OpStore %tempm43 %79 + OpStore %ll3 %int_0 + OpStore %d %int_0 + OpBranch %80 + %80 = OpLabel + OpLoopMerge %81 %82 None + OpBranch %83 + %83 = OpLabel + %84 = OpLoad %int %ll4 + %85 = OpSLessThan %bool %int_1 %84 + OpSelectionMerge %86 None + OpBranchConditional %85 %87 %88 + %87 = OpLabel + OpBranch %86 + %88 = OpLabel + OpBranch %81 + %86 = OpLabel + %89 = OpLoad %int %d + %90 = OpLoad %int %d + %91 = OpLoad %int %d + %92 = OpLoad %int %r + %93 = OpLoad %int %r + %94 = OpLoad %int %r + %96 = OpSGreaterThanEqual %bool %89 %int_0 + OpSelectionMerge %97 None + OpBranchConditional %96 %98 %97 + %98 = OpLabel + %100 = OpSLessThan %bool %90 %int_4 + OpBranch %97 + %97 = OpLabel + %101 = OpPhi %bool %96 %86 %100 %98 + %95 = OpSelect %int %101 %91 %int_0 + %103 = OpSGreaterThanEqual %bool %92 %int_0 + OpSelectionMerge %104 None + OpBranchConditional %103 %105 %104 + %105 = OpLabel + %107 = OpSLessThan %bool %93 %int_3 + OpBranch %104 + %104 = OpLabel + %108 = OpPhi %bool %103 %97 %107 %105 + %102 = OpSelect %int %108 %94 %int_0 + %110 = OpAccessChain %_ptr_Function_float %tempm43 %95 %102 + OpStore %110 %float_1 + OpBranch %82 + %82 = OpLabel + %111 = OpLoad %int %d + %112 = OpIAdd %int %111 %int_1 + OpStore %d %112 + OpBranch %80 + %81 = OpLabel + %113 = OpLoad %int %idx + %114 = OpLoad %int %idx + %115 = OpLoad %int %idx + %117 = OpSGreaterThanEqual %bool %113 %int_0 + OpSelectionMerge %118 None + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %121 = OpSLessThan %bool %114 %int_9 + OpBranch %118 + %118 = OpLabel + %122 = OpPhi %bool %117 %81 %121 %119 + %116 = OpSelect %int %122 %115 %int_0 + %123 = OpLoad %int %c + %125 = OpAccessChain %_ptr_Function_float %m43 %123 %uint_1 + %126 = OpLoad %float %125 + %127 = OpAccessChain %_ptr_Function_float %sums %116 + %128 = OpLoad %float %127 + %129 = OpAccessChain %_ptr_Function_float %sums %116 + %130 = OpFAdd %float %128 %126 + OpStore %129 %130 + OpBranch %66 + %66 = OpLabel + %131 = OpLoad %int %c + %132 = OpIAdd %int %131 %int_1 + OpStore %c %132 + OpBranch %64 + %65 = OpLabel + %133 = OpLoad %int %idx + %134 = OpIAdd %int %133 %int_1 + OpStore %idx %134 + OpBranch %47 + %47 = OpLabel + OpBranch %45 + %46 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %135 +%tint_symbol = OpFunctionParameter %main_out + %139 = OpLabel + %140 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %140 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %142 = OpLabel + %143 = OpFunctionCall %void %main_1 + %145 = OpLoad %v4float %x_GLF_color + %146 = OpCompositeConstruct %main_out %145 + %144 = OpFunctionCall %void %tint_symbol_2 %146 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..dd185738e1 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.wgsl @@ -0,0 +1,98 @@ +var x_GLF_color : vec4; + +fn main_1() { + var m43 : mat4x3; + var ll1 : i32; + var rows : i32; + var ll4 : i32; + var ll2 : i32; + var c : i32; + var tempm43 : mat4x3; + var ll3 : i32; + var d : i32; + var r : i32; + var sums : array; + var idx : i32; + m43 = mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0)); + ll1 = 0; + rows = 2; + loop { + if (true) { + } else { + break; + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + let x_16 : i32 = ll1; + if ((x_16 >= 5)) { + break; + } + let x_17 : i32 = ll1; + ll1 = (x_17 + 1); + ll4 = 10; + ll2 = 0; + c = 0; + loop { + let x_19 : i32 = c; + if ((x_19 < 1)) { + } else { + break; + } + let x_20 : i32 = ll2; + if ((x_20 >= 0)) { + break; + } + let x_21 : i32 = ll2; + ll2 = (x_21 + 1); + let x_92 : mat4x3 = m43; + tempm43 = x_92; + ll3 = 0; + d = 0; + loop { + let x_23 : i32 = ll4; + if ((1 < x_23)) { + } else { + break; + } + let x_24 : i32 = d; + let x_25 : i32 = d; + let x_26 : i32 = d; + let x_27 : i32 = r; + let x_28 : i32 = r; + let x_29 : i32 = r; + tempm43[select(0, x_26, ((x_24 >= 0) && (x_25 < 4)))][select(0, x_29, ((x_27 >= 0) && (x_28 < 3)))] = 1.0; + + continuing { + let x_30 : i32 = d; + d = (x_30 + 1); + } + } + let x_32 : i32 = idx; + let x_33 : i32 = idx; + let x_34 : i32 = idx; + let x_111 : i32 = select(0, x_34, ((x_32 >= 0) && (x_33 < 9))); + let x_35 : i32 = c; + let x_113 : f32 = m43[x_35].y; + let x_115 : f32 = sums[x_111]; + sums[x_111] = (x_115 + x_113); + + continuing { + let x_36 : i32 = c; + c = (x_36 + 1); + } + } + let x_38 : i32 = idx; + idx = (x_38 + 1); + } + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm new file mode 100644 index 0000000000..04eff6cbc8 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm @@ -0,0 +1,70 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %height "height" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %_ "" + OpName %_GLF_color "_GLF_color" + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_256 = OpConstant %float 256 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output +%float_30_1800003 = OpConstant %float 30.1800003 +%float_8840 = OpConstant %float 8840.0 +%float_469_970001 = OpConstant %float 469.970001 +%float_18_2399998 = OpConstant %float 18.2399998 + %27 = OpConstantComposite %v4float %float_30_1800003 %float_8840 %float_469_970001 %float_18_2399998 +%float_9_89999962 = OpConstant %float 9.89999962 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_1169_5387 = OpConstant %float 1169.5387 +%float_55_7900009 = OpConstant %float 55.7900009 + %32 = OpConstantComposite %v4float %float_9_89999962 %float_0_100000001 %float_1169_5387 %float_55_7900009 +%float_7612_94531 = OpConstant %float 7612.94531 +%float_797_010986 = OpConstant %float 797.010986 + %float_9 = OpConstant %float 9 + %float_1 = OpConstant %float 1 + %37 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %8 + %38 = OpLabel + %height = OpVariable %_ptr_Function_float Function + OpStore %height %float_256 + %39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %40 = OpLoad %float %39 + %41 = OpFOrdLessThan %bool %40 %float_0 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + %44 = OpLoad %float %height + %45 = OpCompositeConstruct %v4float %float_7612_94531 %float_797_010986 %44 %float_9 + %46 = OpExtInst %v4float %1 FMix %27 %32 %45 + OpStore %_GLF_color %46 + OpBranch %42 + %42 = OpLabel + OpStore %_GLF_color %37 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..c608e007a3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.hlsl @@ -0,0 +1,29 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float height = 0.0f; + height = 256.0f; + const float x_40 = asfloat(x_6[0].y); + if ((x_40 < 0.0f)) { + x_GLF_color = lerp(float4(30.180000305f, 8840.0f, 469.970001221f, 18.239999771f), float4(9.899999619f, 0.100000001f, 1169.538696289f, 55.790000916f), float4(7612.9453125f, 797.010986328f, height, 9.0f)); + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.msl b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..25fe33c25e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float height = 0.0f; + height = 256.0f; + float const x_40 = x_6.injectionSwitch.y; + if ((x_40 < 0.0f)) { + float const x_44 = height; + *(tint_symbol_4) = mix(float4(30.180000305f, 8840.0f, 469.970001221f, 18.239999771f), float4(9.899999619f, 0.100000001f, 1169.538696289f, 55.790000916f), float4(7612.9453125f, 797.010986328f, x_44, 9.0f)); + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..864cc6dc15 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + %33 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %height "height" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpConstantNull %float + %float_256 = OpConstant %float 256 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool +%float_30_1800003 = OpConstant %float 30.1800003 + %float_8840 = OpConstant %float 8840 +%float_469_970001 = OpConstant %float 469.970001 +%float_18_2399998 = OpConstant %float 18.2399998 + %38 = OpConstantComposite %v4float %float_30_1800003 %float_8840 %float_469_970001 %float_18_2399998 +%float_9_89999962 = OpConstant %float 9.89999962 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_1169_5387 = OpConstant %float 1169.5387 +%float_55_7900009 = OpConstant %float 55.7900009 + %43 = OpConstantComposite %v4float %float_9_89999962 %float_0_100000001 %float_1169_5387 %float_55_7900009 +%float_7612_94531 = OpConstant %float 7612.94531 +%float_797_010986 = OpConstant %float 797.010986 + %float_9 = OpConstant %float 9 + %float_1 = OpConstant %float 1 + %49 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %height = OpVariable %_ptr_Function_float Function %18 + OpStore %height %float_256 + %24 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %25 = OpLoad %float %24 + %27 = OpFOrdLessThan %bool %25 %float_0 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %29 + %30 = OpLabel + %31 = OpLoad %float %height + %47 = OpCompositeConstruct %v4float %float_7612_94531 %float_797_010986 %31 %float_9 + %32 = OpExtInst %v4float %33 FMix %38 %43 %47 + OpStore %x_GLF_color %32 + OpBranch %29 + %29 = OpLabel + OpStore %x_GLF_color %49 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %50 +%tint_symbol = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %57 = OpLabel + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_2 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a5f11f503f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.spvasm.expected.wgsl @@ -0,0 +1,31 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var height : f32; + height = 256.0; + let x_40 : f32 = x_6.injectionSwitch.y; + if ((x_40 < 0.0)) { + let x_44 : f32 = height; + x_GLF_color = mix(vec4(30.180000305, 8840.0, 469.970001221, 18.239999771), vec4(9.899999619, 0.100000001, 1169.538696289, 55.790000916), vec4(7612.9453125, 797.010986328, x_44, 9.0)); + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl new file mode 100644 index 0000000000..a5f11f503f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl @@ -0,0 +1,31 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var height : f32; + height = 256.0; + let x_40 : f32 = x_6.injectionSwitch.y; + if ((x_40 < 0.0)) { + let x_44 : f32 = height; + x_GLF_color = mix(vec4(30.180000305, 8840.0, 469.970001221, 18.239999771), vec4(9.899999619, 0.100000001, 1169.538696289, 55.790000916), vec4(7612.9453125, 797.010986328, x_44, 9.0)); + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..c608e007a3 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.hlsl @@ -0,0 +1,29 @@ +cbuffer cbuffer_x_6 : register(b0, space0) { + uint4 x_6[1]; +}; +static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + float height = 0.0f; + height = 256.0f; + const float x_40 = asfloat(x_6[0].y); + if ((x_40 < 0.0f)) { + x_GLF_color = lerp(float4(30.180000305f, 8840.0f, 469.970001221f, 18.239999771f), float4(9.899999619f, 0.100000001f, 1169.538696289f, 55.790000916f), float4(7612.9453125f, 797.010986328f, height, 9.0f)); + } + x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol { + float4 x_GLF_color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {x_GLF_color}; + const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; + return tint_symbol_3; +} diff --git a/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.msl b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..25fe33c25e --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct buf0 { + /* 0x0000 */ packed_float2 injectionSwitch; +}; +struct main_out { + float4 x_GLF_color_1; +}; +struct tint_symbol_1 { + float4 x_GLF_color_1 [[color(0)]]; +}; + +void main_1(constant buf0& x_6, thread float4* const tint_symbol_4) { + float height = 0.0f; + height = 256.0f; + float const x_40 = x_6.injectionSwitch.y; + if ((x_40 < 0.0f)) { + float const x_44 = height; + *(tint_symbol_4) = mix(float4(30.180000305f, 8840.0f, 469.970001221f, 18.239999771f), float4(9.899999619f, 0.100000001f, 1169.538696289f, 55.790000916f), float4(7612.9453125f, 797.010986328f, x_44, 9.0f)); + } + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]]) { + thread float4 tint_symbol_5 = 0.0f; + main_1(x_6, &(tint_symbol_5)); + main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..864cc6dc15 --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.spvasm @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + %33 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %x_6 "x_6" + OpName %x_GLF_color "x_GLF_color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %height "height" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_GLF_color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %buf0 Block + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %x_6 NonWritable + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %x_6 = OpVariable %_ptr_Uniform_buf0 Uniform + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %9 = OpConstantNull %v4float +%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9 + %void = OpTypeVoid + %12 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %18 = OpConstantNull %float + %float_256 = OpConstant %float 256 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool +%float_30_1800003 = OpConstant %float 30.1800003 + %float_8840 = OpConstant %float 8840 +%float_469_970001 = OpConstant %float 469.970001 +%float_18_2399998 = OpConstant %float 18.2399998 + %38 = OpConstantComposite %v4float %float_30_1800003 %float_8840 %float_469_970001 %float_18_2399998 +%float_9_89999962 = OpConstant %float 9.89999962 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_1169_5387 = OpConstant %float 1169.5387 +%float_55_7900009 = OpConstant %float 55.7900009 + %43 = OpConstantComposite %v4float %float_9_89999962 %float_0_100000001 %float_1169_5387 %float_55_7900009 +%float_7612_94531 = OpConstant %float 7612.94531 +%float_797_010986 = OpConstant %float 797.010986 + %float_9 = OpConstant %float 9 + %float_1 = OpConstant %float 1 + %49 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main_out = OpTypeStruct %v4float + %50 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %12 + %15 = OpLabel + %height = OpVariable %_ptr_Function_float Function %18 + OpStore %height %float_256 + %24 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %uint_1 + %25 = OpLoad %float %24 + %27 = OpFOrdLessThan %bool %25 %float_0 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %29 + %30 = OpLabel + %31 = OpLoad %float %height + %47 = OpCompositeConstruct %v4float %float_7612_94531 %float_797_010986 %31 %float_9 + %32 = OpExtInst %v4float %33 FMix %38 %43 %47 + OpStore %x_GLF_color %32 + OpBranch %29 + %29 = OpLabel + OpStore %x_GLF_color %49 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %50 +%tint_symbol = OpFunctionParameter %main_out + %54 = OpLabel + %55 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %55 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %12 + %57 = OpLabel + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %v4float %x_GLF_color + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_2 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a5f11f503f --- /dev/null +++ b/test/vk-gl-cts/graphicsfuzz/wrong-color-in-always-false-if/0-opt.wgsl.expected.wgsl @@ -0,0 +1,31 @@ +[[block]] +struct buf0 { + injectionSwitch : vec2; +}; + +[[group(0), binding(0)]] var x_6 : buf0; + +var x_GLF_color : vec4; + +fn main_1() { + var height : f32; + height = 256.0; + let x_40 : f32 = x_6.injectionSwitch.y; + if ((x_40 < 0.0)) { + let x_44 : f32 = height; + x_GLF_color = mix(vec4(30.180000305, 8840.0, 469.970001221, 18.239999771), vec4(9.899999619, 0.100000001, 1169.538696289, 55.790000916), vec4(7612.9453125, 797.010986328, x_44, 9.0)); + } + x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_GLF_color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(x_GLF_color); +} diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm new file mode 100644 index 0000000000..cc4f09dacd --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm @@ -0,0 +1,209 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_WorkGroupID + OpExecutionMode %main LocalSize 4 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %base_index_in "base_index_in" + OpName %gl_WorkGroupID "gl_WorkGroupID" + OpName %base_index_out "base_index_out" + OpName %index_in0 "index_in0" + OpName %index_in1 "index_in1" + OpName %index_out0 "index_out0" + OpName %index_out1 "index_out1" + OpName %condition_index "condition_index" + OpName %i "i" + OpName %In2 "In2" + OpMemberName %In2 0 "data_in2" + OpName %_ "" + OpName %Out0 "Out0" + OpMemberName %Out0 0 "data_out0" + OpName %__0 "" + OpName %In1 "In1" + OpMemberName %In1 0 "data_in1" + OpName %__1 "" + OpName %In0 "In0" + OpMemberName %In0 0 "data_in0" + OpName %__2 "" + OpName %temp0 "temp0" + OpName %temp1 "temp1" + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %_arr_int_uint_8 ArrayStride 4 + OpMemberDecorate %In2 0 NonWritable + OpMemberDecorate %In2 0 Offset 0 + OpDecorate %In2 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 2 + OpDecorate %_arr_int_uint_1024 ArrayStride 4 + OpMemberDecorate %Out0 0 NonReadable + OpMemberDecorate %Out0 0 Offset 0 + OpDecorate %Out0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 3 + OpDecorate %_arr_int_uint_512 ArrayStride 4 + OpMemberDecorate %In1 0 NonWritable + OpMemberDecorate %In1 0 Offset 0 + OpDecorate %In1 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 1 + OpDecorate %_arr_int_uint_512_0 ArrayStride 4 + OpMemberDecorate %In0 0 NonWritable + OpMemberDecorate %In0 0 Offset 0 + OpDecorate %In0 Block + OpDecorate %__2 DescriptorSet 0 + OpDecorate %__2 Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %28 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_128 = OpConstant %uint 128 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_256 = OpConstant %uint 256 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_127 = OpConstant %int 127 + %int_383 = OpConstant %int 383 + %int_255 = OpConstant %int 255 + %int_0 = OpConstant %int 0 + %int_256 = OpConstant %int 256 + %bool = OpTypeBool + %uint_8 = OpConstant %uint 8 +%_arr_int_uint_8 = OpTypeArray %int %uint_8 + %In2 = OpTypeStruct %_arr_int_uint_8 +%_ptr_StorageBuffer_In2 = OpTypePointer StorageBuffer %In2 + %_ = OpVariable %_ptr_StorageBuffer_In2 StorageBuffer +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %uint_1024 = OpConstant %uint 1024 +%_arr_int_uint_1024 = OpTypeArray %int %uint_1024 + %Out0 = OpTypeStruct %_arr_int_uint_1024 +%_ptr_StorageBuffer_Out0 = OpTypePointer StorageBuffer %Out0 + %__0 = OpVariable %_ptr_StorageBuffer_Out0 StorageBuffer + %uint_512 = OpConstant %uint 512 +%_arr_int_uint_512 = OpTypeArray %int %uint_512 + %In1 = OpTypeStruct %_arr_int_uint_512 +%_ptr_StorageBuffer_In1 = OpTypePointer StorageBuffer %In1 + %__1 = OpVariable %_ptr_StorageBuffer_In1 StorageBuffer + %int_1 = OpConstant %int 1 +%_arr_int_uint_512_0 = OpTypeArray %int %uint_512 + %In0 = OpTypeStruct %_arr_int_uint_512_0 +%_ptr_StorageBuffer_In0 = OpTypePointer StorageBuffer %In0 + %__2 = OpVariable %_ptr_StorageBuffer_In0 StorageBuffer + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_4 %uint_1 %uint_1 + %main = OpFunction %void None %28 + %56 = OpLabel +%base_index_in = OpVariable %_ptr_Function_uint Function +%base_index_out = OpVariable %_ptr_Function_uint Function + %index_in0 = OpVariable %_ptr_Function_int Function + %index_in1 = OpVariable %_ptr_Function_int Function + %index_out0 = OpVariable %_ptr_Function_int Function + %index_out1 = OpVariable %_ptr_Function_int Function +%condition_index = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %temp0 = OpVariable %_ptr_Function_int Function + %temp1 = OpVariable %_ptr_Function_int Function + %57 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %58 = OpLoad %uint %57 + %59 = OpIMul %uint %uint_128 %58 + OpStore %base_index_in %59 + %60 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %61 = OpLoad %uint %60 + %62 = OpIMul %uint %uint_256 %61 + OpStore %base_index_out %62 + OpStore %index_in0 %int_127 + OpStore %index_in1 %int_383 + OpStore %index_out0 %int_255 + OpStore %index_out1 %int_383 + OpStore %condition_index %int_0 + OpStore %i %int_0 + OpBranch %63 + %63 = OpLabel + OpLoopMerge %64 %65 None + OpBranch %66 + %66 = OpLabel + %67 = OpLoad %int %i + %68 = OpSLessThan %bool %67 %int_256 + OpBranchConditional %68 %69 %64 + %69 = OpLabel + %70 = OpLoad %int %condition_index + %71 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 %70 + %72 = OpLoad %int %71 + %73 = OpIEqual %bool %72 %int_0 + OpSelectionMerge %74 None + OpBranchConditional %73 %75 %76 + %75 = OpLabel + %77 = OpLoad %uint %base_index_out + %78 = OpLoad %int %index_out0 + %79 = OpBitcast %uint %78 + %80 = OpIAdd %uint %77 %79 + %81 = OpLoad %uint %base_index_in + %82 = OpLoad %int %index_in0 + %83 = OpBitcast %uint %82 + %84 = OpIAdd %uint %81 %83 + %85 = OpAccessChain %_ptr_StorageBuffer_int %__1 %int_0 %84 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_StorageBuffer_int %__0 %int_0 %80 + OpStore %87 %86 + %88 = OpLoad %int %index_out0 + %89 = OpISub %int %88 %int_1 + OpStore %index_out0 %89 + %90 = OpLoad %int %index_in1 + %91 = OpISub %int %90 %int_1 + OpStore %index_in1 %91 + OpBranch %74 + %76 = OpLabel + %92 = OpLoad %uint %base_index_out + %93 = OpLoad %int %index_out1 + %94 = OpBitcast %uint %93 + %95 = OpIAdd %uint %92 %94 + %96 = OpLoad %uint %base_index_in + %97 = OpLoad %int %index_in1 + %98 = OpBitcast %uint %97 + %99 = OpIAdd %uint %96 %98 + %100 = OpAccessChain %_ptr_StorageBuffer_int %__2 %int_0 %99 + %101 = OpLoad %int %100 + %102 = OpAccessChain %_ptr_StorageBuffer_int %__0 %int_0 %95 + OpStore %102 %101 + %103 = OpLoad %int %index_out1 + %104 = OpISub %int %103 %int_1 + OpStore %index_out1 %104 + %105 = OpLoad %int %index_in1 + %106 = OpISub %int %105 %int_1 + OpStore %index_in1 %106 + OpBranch %74 + %74 = OpLabel + %107 = OpLoad %int %condition_index + %108 = OpIAdd %int %107 %int_1 + %109 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 %108 + %110 = OpLoad %int %109 + %111 = OpLoad %int %condition_index + %112 = OpIAdd %int %111 %110 + OpStore %condition_index %112 + %113 = OpLoad %int %index_in0 + OpStore %temp0 %113 + %114 = OpLoad %int %index_in1 + OpStore %index_in0 %114 + %115 = OpLoad %int %temp0 + OpStore %index_in1 %115 + %116 = OpLoad %int %index_out0 + OpStore %temp1 %116 + %117 = OpLoad %int %index_out1 + OpStore %index_out0 %117 + %118 = OpLoad %int %temp1 + OpStore %index_out1 %118 + OpBranch %65 + %65 = OpLabel + %119 = OpLoad %int %i + %120 = OpIAdd %int %119 %int_1 + OpStore %i %120 + OpBranch %63 + %64 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..14fc121456 --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.hlsl @@ -0,0 +1,69 @@ +static uint3 gl_WorkGroupID = uint3(0u, 0u, 0u); +ByteAddressBuffer x_13 : register(t2, space0); +RWByteAddressBuffer x_15 : register(u3, space0); +ByteAddressBuffer x_17 : register(t1, space0); +ByteAddressBuffer x_19 : register(t0, space0); + +void main_1() { + uint base_index_in = 0u; + uint base_index_out = 0u; + int index_in0 = 0; + int index_in1 = 0; + int index_out0 = 0; + int index_out1 = 0; + int condition_index = 0; + int i = 0; + int temp0 = 0; + int temp1 = 0; + const uint x_58 = gl_WorkGroupID.x; + base_index_in = (128u * x_58); + const uint x_61 = gl_WorkGroupID.x; + base_index_out = (256u * x_61); + index_in0 = 127; + index_in1 = 383; + index_out0 = 255; + index_out1 = 383; + condition_index = 0; + i = 0; + { + for(; (i < 256); i = (i + 1)) { + const int x_72 = asint(x_13.Load((4u * uint(condition_index)))); + if ((x_72 == 0)) { + const uint x_77 = base_index_out; + const int x_78 = index_out0; + const int x_86 = asint(x_17.Load((4u * (base_index_in + asuint(index_in0))))); + x_15.Store((4u * (x_77 + asuint(x_78))), asuint(x_86)); + index_out0 = (index_out0 - 1); + index_in1 = (index_in1 - 1); + } else { + const uint x_92 = base_index_out; + const int x_93 = index_out1; + const int x_101 = asint(x_19.Load((4u * (base_index_in + asuint(index_in1))))); + x_15.Store((4u * (x_92 + asuint(x_93))), asuint(x_101)); + index_out1 = (index_out1 - 1); + index_in1 = (index_in1 - 1); + } + const int x_110 = asint(x_13.Load((4u * uint((condition_index + 1))))); + condition_index = (condition_index + x_110); + temp0 = index_in0; + index_in0 = index_in1; + index_in1 = temp0; + temp1 = index_out0; + index_out0 = index_out1; + index_out1 = temp1; + } + } + return; +} + +struct tint_symbol_1 { + uint3 gl_WorkGroupID_param : SV_GroupID; +}; + +[numthreads(4, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 gl_WorkGroupID_param = tint_symbol.gl_WorkGroupID_param; + gl_WorkGroupID = gl_WorkGroupID_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.msl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..be9d4565d7 --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + /* 0x0000 */ int arr[8]; +}; +struct In2 { + /* 0x0000 */ tint_array_wrapper data_in2; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ int arr[1024]; +}; +struct Out0 { + /* 0x0000 */ tint_array_wrapper_1 data_out0; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ int arr[512]; +}; +struct In1 { + /* 0x0000 */ tint_array_wrapper_2 data_in1; +}; +struct In0 { + /* 0x0000 */ tint_array_wrapper_2 data_in0; +}; + +void main_1(const device In2& x_13, const device In1& x_17, device Out0& x_15, const device In0& x_19, thread uint3* const tint_symbol_2) { + uint base_index_in = 0u; + uint base_index_out = 0u; + int index_in0 = 0; + int index_in1 = 0; + int index_out0 = 0; + int index_out1 = 0; + int condition_index = 0; + int i = 0; + int temp0 = 0; + int temp1 = 0; + uint const x_58 = (*(tint_symbol_2)).x; + base_index_in = (128u * x_58); + uint const x_61 = (*(tint_symbol_2)).x; + base_index_out = (256u * x_61); + index_in0 = 127; + index_in1 = 383; + index_out0 = 255; + index_out1 = 383; + condition_index = 0; + i = 0; + while (true) { + int const x_67 = i; + if ((x_67 < 256)) { + } else { + break; + } + int const x_70 = condition_index; + int const x_72 = x_13.data_in2.arr[x_70]; + if ((x_72 == 0)) { + uint const x_77 = base_index_out; + int const x_78 = index_out0; + uint const x_81 = base_index_in; + int const x_82 = index_in0; + int const x_86 = x_17.data_in1.arr[(x_81 + as_type(x_82))]; + x_15.data_out0.arr[(x_77 + as_type(x_78))] = x_86; + int const x_88 = index_out0; + index_out0 = (x_88 - 1); + int const x_90 = index_in1; + index_in1 = (x_90 - 1); + } else { + uint const x_92 = base_index_out; + int const x_93 = index_out1; + uint const x_96 = base_index_in; + int const x_97 = index_in1; + int const x_101 = x_19.data_in0.arr[(x_96 + as_type(x_97))]; + x_15.data_out0.arr[(x_92 + as_type(x_93))] = x_101; + int const x_103 = index_out1; + index_out1 = (x_103 - 1); + int const x_105 = index_in1; + index_in1 = (x_105 - 1); + } + int const x_107 = condition_index; + int const x_110 = x_13.data_in2.arr[(x_107 + 1)]; + int const x_111 = condition_index; + condition_index = (x_111 + x_110); + int const x_113 = index_in0; + temp0 = x_113; + int const x_114 = index_in1; + index_in0 = x_114; + int const x_115 = temp0; + index_in1 = x_115; + int const x_116 = index_out0; + temp1 = x_116; + int const x_117 = index_out1; + index_out0 = x_117; + int const x_118 = temp1; + index_out1 = x_118; + { + int const x_119 = i; + i = (x_119 + 1); + } + } + return; +} + +kernel void tint_symbol(uint3 gl_WorkGroupID_param [[threadgroup_position_in_grid]], const device In2& x_13 [[buffer(2)]], const device In1& x_17 [[buffer(1)]], device Out0& x_15 [[buffer(3)]], const device In0& x_19 [[buffer(0)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = gl_WorkGroupID_param; + main_1(x_13, x_17, x_15, x_19, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..85465cc6a2 --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.spvasm @@ -0,0 +1,224 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 127 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 4 1 1 + OpName %gl_WorkGroupID "gl_WorkGroupID" + OpName %In2 "In2" + OpMemberName %In2 0 "data_in2" + OpName %x_13 "x_13" + OpName %Out0 "Out0" + OpMemberName %Out0 0 "data_out0" + OpName %x_15 "x_15" + OpName %In1 "In1" + OpMemberName %In1 0 "data_in1" + OpName %x_17 "x_17" + OpName %In0 "In0" + OpMemberName %In0 0 "data_in0" + OpName %x_19 "x_19" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %base_index_in "base_index_in" + OpName %base_index_out "base_index_out" + OpName %index_in0 "index_in0" + OpName %index_in1 "index_in1" + OpName %index_out0 "index_out0" + OpName %index_out1 "index_out1" + OpName %condition_index "condition_index" + OpName %i "i" + OpName %temp0 "temp0" + OpName %temp1 "temp1" + OpName %main "main" + OpDecorate %In2 Block + OpMemberDecorate %In2 0 Offset 0 + OpDecorate %_arr_int_uint_8 ArrayStride 4 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 2 + OpDecorate %Out0 Block + OpMemberDecorate %Out0 0 Offset 0 + OpDecorate %_arr_int_uint_1024 ArrayStride 4 + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 3 + OpDecorate %In1 Block + OpMemberDecorate %In1 0 Offset 0 + OpDecorate %_arr_int_uint_512 ArrayStride 4 + OpDecorate %x_17 NonWritable + OpDecorate %x_17 DescriptorSet 0 + OpDecorate %x_17 Binding 1 + OpDecorate %In0 Block + OpMemberDecorate %In0 0 Offset 0 + OpDecorate %x_19 NonWritable + OpDecorate %x_19 DescriptorSet 0 + OpDecorate %x_19 Binding 0 + OpDecorate %tint_symbol BuiltIn WorkgroupId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint +%gl_WorkGroupID = OpVariable %_ptr_Private_v3uint Private %5 + %int = OpTypeInt 32 1 + %uint_8 = OpConstant %uint 8 +%_arr_int_uint_8 = OpTypeArray %int %uint_8 + %In2 = OpTypeStruct %_arr_int_uint_8 +%_ptr_StorageBuffer_In2 = OpTypePointer StorageBuffer %In2 + %x_13 = OpVariable %_ptr_StorageBuffer_In2 StorageBuffer + %uint_1024 = OpConstant %uint 1024 +%_arr_int_uint_1024 = OpTypeArray %int %uint_1024 + %Out0 = OpTypeStruct %_arr_int_uint_1024 +%_ptr_StorageBuffer_Out0 = OpTypePointer StorageBuffer %Out0 + %x_15 = OpVariable %_ptr_StorageBuffer_Out0 StorageBuffer + %uint_512 = OpConstant %uint 512 +%_arr_int_uint_512 = OpTypeArray %int %uint_512 + %In1 = OpTypeStruct %_arr_int_uint_512 +%_ptr_StorageBuffer_In1 = OpTypePointer StorageBuffer %In1 + %x_17 = OpVariable %_ptr_StorageBuffer_In1 StorageBuffer + %In0 = OpTypeStruct %_arr_int_uint_512 +%_ptr_StorageBuffer_In0 = OpTypePointer StorageBuffer %In0 + %x_19 = OpVariable %_ptr_StorageBuffer_In0 StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %33 = OpConstantNull %uint +%_ptr_Function_int = OpTypePointer Function %int + %37 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %uint_128 = OpConstant %uint 128 + %uint_256 = OpConstant %uint 256 + %int_127 = OpConstant %int 127 + %int_383 = OpConstant %int 383 + %int_255 = OpConstant %int 255 + %int_0 = OpConstant %int 0 + %int_256 = OpConstant %int 256 + %bool = OpTypeBool +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 + %main_1 = OpFunction %void None %27 + %30 = OpLabel +%base_index_in = OpVariable %_ptr_Function_uint Function %33 +%base_index_out = OpVariable %_ptr_Function_uint Function %33 + %index_in0 = OpVariable %_ptr_Function_int Function %37 + %index_in1 = OpVariable %_ptr_Function_int Function %37 + %index_out0 = OpVariable %_ptr_Function_int Function %37 + %index_out1 = OpVariable %_ptr_Function_int Function %37 +%condition_index = OpVariable %_ptr_Function_int Function %37 + %i = OpVariable %_ptr_Function_int Function %37 + %temp0 = OpVariable %_ptr_Function_int Function %37 + %temp1 = OpVariable %_ptr_Function_int Function %37 + %47 = OpAccessChain %_ptr_Private_uint %gl_WorkGroupID %uint_0 + %48 = OpLoad %uint %47 + %50 = OpIMul %uint %uint_128 %48 + OpStore %base_index_in %50 + %51 = OpAccessChain %_ptr_Private_uint %gl_WorkGroupID %uint_0 + %52 = OpLoad %uint %51 + %54 = OpIMul %uint %uint_256 %52 + OpStore %base_index_out %54 + OpStore %index_in0 %int_127 + OpStore %index_in1 %int_383 + OpStore %index_out0 %int_255 + OpStore %index_out1 %int_383 + OpStore %condition_index %int_0 + OpStore %i %int_0 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %int %i + %65 = OpSLessThan %bool %63 %int_256 + OpSelectionMerge %67 None + OpBranchConditional %65 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %60 + %67 = OpLabel + %70 = OpLoad %int %condition_index + %72 = OpAccessChain %_ptr_StorageBuffer_int %x_13 %uint_0 %70 + %73 = OpLoad %int %72 + %74 = OpIEqual %bool %73 %int_0 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + %78 = OpLoad %uint %base_index_out + %79 = OpLoad %int %index_out0 + %80 = OpLoad %uint %base_index_in + %81 = OpLoad %int %index_in0 + %82 = OpBitcast %uint %81 + %83 = OpIAdd %uint %80 %82 + %84 = OpAccessChain %_ptr_StorageBuffer_int %x_17 %uint_0 %83 + %85 = OpLoad %int %84 + %86 = OpBitcast %uint %79 + %87 = OpIAdd %uint %78 %86 + %88 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %87 + OpStore %88 %85 + %89 = OpLoad %int %index_out0 + %91 = OpISub %int %89 %int_1 + OpStore %index_out0 %91 + %92 = OpLoad %int %index_in1 + %93 = OpISub %int %92 %int_1 + OpStore %index_in1 %93 + OpBranch %75 + %77 = OpLabel + %94 = OpLoad %uint %base_index_out + %95 = OpLoad %int %index_out1 + %96 = OpLoad %uint %base_index_in + %97 = OpLoad %int %index_in1 + %98 = OpBitcast %uint %97 + %99 = OpIAdd %uint %96 %98 + %100 = OpAccessChain %_ptr_StorageBuffer_int %x_19 %uint_0 %99 + %101 = OpLoad %int %100 + %102 = OpBitcast %uint %95 + %103 = OpIAdd %uint %94 %102 + %104 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %103 + OpStore %104 %101 + %105 = OpLoad %int %index_out1 + %106 = OpISub %int %105 %int_1 + OpStore %index_out1 %106 + %107 = OpLoad %int %index_in1 + %108 = OpISub %int %107 %int_1 + OpStore %index_in1 %108 + OpBranch %75 + %75 = OpLabel + %109 = OpLoad %int %condition_index + %110 = OpIAdd %int %109 %int_1 + %111 = OpAccessChain %_ptr_StorageBuffer_int %x_13 %uint_0 %110 + %112 = OpLoad %int %111 + %113 = OpLoad %int %condition_index + %114 = OpIAdd %int %113 %112 + OpStore %condition_index %114 + %115 = OpLoad %int %index_in0 + OpStore %temp0 %115 + %116 = OpLoad %int %index_in1 + OpStore %index_in0 %116 + %117 = OpLoad %int %temp0 + OpStore %index_in1 %117 + %118 = OpLoad %int %index_out0 + OpStore %temp1 %118 + %119 = OpLoad %int %index_out1 + OpStore %index_out0 %119 + %120 = OpLoad %int %temp1 + OpStore %index_out1 %120 + OpBranch %61 + %61 = OpLabel + %121 = OpLoad %int %i + %122 = OpIAdd %int %121 %int_1 + OpStore %i %122 + OpBranch %59 + %60 = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %124 = OpLabel + %125 = OpLoad %v3uint %tint_symbol + OpStore %gl_WorkGroupID %125 + %126 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..e16f3b9b58 --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.spvasm.expected.wgsl @@ -0,0 +1,120 @@ +type Arr = [[stride(4)]] array; + +[[block]] +struct In2 { + data_in2 : Arr; +}; + +type Arr_1 = [[stride(4)]] array; + +[[block]] +struct Out0 { + data_out0 : Arr_1; +}; + +type Arr_2 = [[stride(4)]] array; + +type Arr_3 = [[stride(4)]] array; + +[[block]] +struct In1 { + data_in1 : Arr_3; +}; + +[[block]] +struct In0 { + data_in0 : Arr_3; +}; + +var gl_WorkGroupID : vec3; + +[[group(0), binding(2)]] var x_13 : In2; + +[[group(0), binding(3)]] var x_15 : Out0; + +[[group(0), binding(1)]] var x_17 : In1; + +[[group(0), binding(0)]] var x_19 : In0; + +fn main_1() { + var base_index_in : u32; + var base_index_out : u32; + var index_in0 : i32; + var index_in1 : i32; + var index_out0 : i32; + var index_out1 : i32; + var condition_index : i32; + var i : i32; + var temp0 : i32; + var temp1 : i32; + let x_58 : u32 = gl_WorkGroupID.x; + base_index_in = (128u * x_58); + let x_61 : u32 = gl_WorkGroupID.x; + base_index_out = (256u * x_61); + index_in0 = 127; + index_in1 = 383; + index_out0 = 255; + index_out1 = 383; + condition_index = 0; + i = 0; + loop { + let x_67 : i32 = i; + if ((x_67 < 256)) { + } else { + break; + } + let x_70 : i32 = condition_index; + let x_72 : i32 = x_13.data_in2[x_70]; + if ((x_72 == 0)) { + let x_77 : u32 = base_index_out; + let x_78 : i32 = index_out0; + let x_81 : u32 = base_index_in; + let x_82 : i32 = index_in0; + let x_86 : i32 = x_17.data_in1[(x_81 + bitcast(x_82))]; + x_15.data_out0[(x_77 + bitcast(x_78))] = x_86; + let x_88 : i32 = index_out0; + index_out0 = (x_88 - 1); + let x_90 : i32 = index_in1; + index_in1 = (x_90 - 1); + } else { + let x_92 : u32 = base_index_out; + let x_93 : i32 = index_out1; + let x_96 : u32 = base_index_in; + let x_97 : i32 = index_in1; + let x_101 : i32 = x_19.data_in0[(x_96 + bitcast(x_97))]; + x_15.data_out0[(x_92 + bitcast(x_93))] = x_101; + let x_103 : i32 = index_out1; + index_out1 = (x_103 - 1); + let x_105 : i32 = index_in1; + index_in1 = (x_105 - 1); + } + let x_107 : i32 = condition_index; + let x_110 : i32 = x_13.data_in2[(x_107 + 1)]; + let x_111 : i32 = condition_index; + condition_index = (x_111 + x_110); + let x_113 : i32 = index_in0; + temp0 = x_113; + let x_114 : i32 = index_in1; + index_in0 = x_114; + let x_115 : i32 = temp0; + index_in1 = x_115; + let x_116 : i32 = index_out0; + temp1 = x_116; + let x_117 : i32 = index_out1; + index_out0 = x_117; + let x_118 : i32 = temp1; + index_out1 = x_118; + + continuing { + let x_119 : i32 = i; + i = (x_119 + 1); + } + } + return; +} + +[[stage(compute), workgroup_size(4, 1, 1)]] +fn main([[builtin(workgroup_id)]] gl_WorkGroupID_param : vec3) { + gl_WorkGroupID = gl_WorkGroupID_param; + main_1(); +} diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl new file mode 100644 index 0000000000..e16f3b9b58 --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl @@ -0,0 +1,120 @@ +type Arr = [[stride(4)]] array; + +[[block]] +struct In2 { + data_in2 : Arr; +}; + +type Arr_1 = [[stride(4)]] array; + +[[block]] +struct Out0 { + data_out0 : Arr_1; +}; + +type Arr_2 = [[stride(4)]] array; + +type Arr_3 = [[stride(4)]] array; + +[[block]] +struct In1 { + data_in1 : Arr_3; +}; + +[[block]] +struct In0 { + data_in0 : Arr_3; +}; + +var gl_WorkGroupID : vec3; + +[[group(0), binding(2)]] var x_13 : In2; + +[[group(0), binding(3)]] var x_15 : Out0; + +[[group(0), binding(1)]] var x_17 : In1; + +[[group(0), binding(0)]] var x_19 : In0; + +fn main_1() { + var base_index_in : u32; + var base_index_out : u32; + var index_in0 : i32; + var index_in1 : i32; + var index_out0 : i32; + var index_out1 : i32; + var condition_index : i32; + var i : i32; + var temp0 : i32; + var temp1 : i32; + let x_58 : u32 = gl_WorkGroupID.x; + base_index_in = (128u * x_58); + let x_61 : u32 = gl_WorkGroupID.x; + base_index_out = (256u * x_61); + index_in0 = 127; + index_in1 = 383; + index_out0 = 255; + index_out1 = 383; + condition_index = 0; + i = 0; + loop { + let x_67 : i32 = i; + if ((x_67 < 256)) { + } else { + break; + } + let x_70 : i32 = condition_index; + let x_72 : i32 = x_13.data_in2[x_70]; + if ((x_72 == 0)) { + let x_77 : u32 = base_index_out; + let x_78 : i32 = index_out0; + let x_81 : u32 = base_index_in; + let x_82 : i32 = index_in0; + let x_86 : i32 = x_17.data_in1[(x_81 + bitcast(x_82))]; + x_15.data_out0[(x_77 + bitcast(x_78))] = x_86; + let x_88 : i32 = index_out0; + index_out0 = (x_88 - 1); + let x_90 : i32 = index_in1; + index_in1 = (x_90 - 1); + } else { + let x_92 : u32 = base_index_out; + let x_93 : i32 = index_out1; + let x_96 : u32 = base_index_in; + let x_97 : i32 = index_in1; + let x_101 : i32 = x_19.data_in0[(x_96 + bitcast(x_97))]; + x_15.data_out0[(x_92 + bitcast(x_93))] = x_101; + let x_103 : i32 = index_out1; + index_out1 = (x_103 - 1); + let x_105 : i32 = index_in1; + index_in1 = (x_105 - 1); + } + let x_107 : i32 = condition_index; + let x_110 : i32 = x_13.data_in2[(x_107 + 1)]; + let x_111 : i32 = condition_index; + condition_index = (x_111 + x_110); + let x_113 : i32 = index_in0; + temp0 = x_113; + let x_114 : i32 = index_in1; + index_in0 = x_114; + let x_115 : i32 = temp0; + index_in1 = x_115; + let x_116 : i32 = index_out0; + temp1 = x_116; + let x_117 : i32 = index_out1; + index_out0 = x_117; + let x_118 : i32 = temp1; + index_out1 = x_118; + + continuing { + let x_119 : i32 = i; + i = (x_119 + 1); + } + } + return; +} + +[[stage(compute), workgroup_size(4, 1, 1)]] +fn main([[builtin(workgroup_id)]] gl_WorkGroupID_param : vec3) { + gl_WorkGroupID = gl_WorkGroupID_param; + main_1(); +} diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..14fc121456 --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.hlsl @@ -0,0 +1,69 @@ +static uint3 gl_WorkGroupID = uint3(0u, 0u, 0u); +ByteAddressBuffer x_13 : register(t2, space0); +RWByteAddressBuffer x_15 : register(u3, space0); +ByteAddressBuffer x_17 : register(t1, space0); +ByteAddressBuffer x_19 : register(t0, space0); + +void main_1() { + uint base_index_in = 0u; + uint base_index_out = 0u; + int index_in0 = 0; + int index_in1 = 0; + int index_out0 = 0; + int index_out1 = 0; + int condition_index = 0; + int i = 0; + int temp0 = 0; + int temp1 = 0; + const uint x_58 = gl_WorkGroupID.x; + base_index_in = (128u * x_58); + const uint x_61 = gl_WorkGroupID.x; + base_index_out = (256u * x_61); + index_in0 = 127; + index_in1 = 383; + index_out0 = 255; + index_out1 = 383; + condition_index = 0; + i = 0; + { + for(; (i < 256); i = (i + 1)) { + const int x_72 = asint(x_13.Load((4u * uint(condition_index)))); + if ((x_72 == 0)) { + const uint x_77 = base_index_out; + const int x_78 = index_out0; + const int x_86 = asint(x_17.Load((4u * (base_index_in + asuint(index_in0))))); + x_15.Store((4u * (x_77 + asuint(x_78))), asuint(x_86)); + index_out0 = (index_out0 - 1); + index_in1 = (index_in1 - 1); + } else { + const uint x_92 = base_index_out; + const int x_93 = index_out1; + const int x_101 = asint(x_19.Load((4u * (base_index_in + asuint(index_in1))))); + x_15.Store((4u * (x_92 + asuint(x_93))), asuint(x_101)); + index_out1 = (index_out1 - 1); + index_in1 = (index_in1 - 1); + } + const int x_110 = asint(x_13.Load((4u * uint((condition_index + 1))))); + condition_index = (condition_index + x_110); + temp0 = index_in0; + index_in0 = index_in1; + index_in1 = temp0; + temp1 = index_out0; + index_out0 = index_out1; + index_out1 = temp1; + } + } + return; +} + +struct tint_symbol_1 { + uint3 gl_WorkGroupID_param : SV_GroupID; +}; + +[numthreads(4, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 gl_WorkGroupID_param = tint_symbol.gl_WorkGroupID_param; + gl_WorkGroupID = gl_WorkGroupID_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.msl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..be9d4565d7 --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + /* 0x0000 */ int arr[8]; +}; +struct In2 { + /* 0x0000 */ tint_array_wrapper data_in2; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ int arr[1024]; +}; +struct Out0 { + /* 0x0000 */ tint_array_wrapper_1 data_out0; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ int arr[512]; +}; +struct In1 { + /* 0x0000 */ tint_array_wrapper_2 data_in1; +}; +struct In0 { + /* 0x0000 */ tint_array_wrapper_2 data_in0; +}; + +void main_1(const device In2& x_13, const device In1& x_17, device Out0& x_15, const device In0& x_19, thread uint3* const tint_symbol_2) { + uint base_index_in = 0u; + uint base_index_out = 0u; + int index_in0 = 0; + int index_in1 = 0; + int index_out0 = 0; + int index_out1 = 0; + int condition_index = 0; + int i = 0; + int temp0 = 0; + int temp1 = 0; + uint const x_58 = (*(tint_symbol_2)).x; + base_index_in = (128u * x_58); + uint const x_61 = (*(tint_symbol_2)).x; + base_index_out = (256u * x_61); + index_in0 = 127; + index_in1 = 383; + index_out0 = 255; + index_out1 = 383; + condition_index = 0; + i = 0; + while (true) { + int const x_67 = i; + if ((x_67 < 256)) { + } else { + break; + } + int const x_70 = condition_index; + int const x_72 = x_13.data_in2.arr[x_70]; + if ((x_72 == 0)) { + uint const x_77 = base_index_out; + int const x_78 = index_out0; + uint const x_81 = base_index_in; + int const x_82 = index_in0; + int const x_86 = x_17.data_in1.arr[(x_81 + as_type(x_82))]; + x_15.data_out0.arr[(x_77 + as_type(x_78))] = x_86; + int const x_88 = index_out0; + index_out0 = (x_88 - 1); + int const x_90 = index_in1; + index_in1 = (x_90 - 1); + } else { + uint const x_92 = base_index_out; + int const x_93 = index_out1; + uint const x_96 = base_index_in; + int const x_97 = index_in1; + int const x_101 = x_19.data_in0.arr[(x_96 + as_type(x_97))]; + x_15.data_out0.arr[(x_92 + as_type(x_93))] = x_101; + int const x_103 = index_out1; + index_out1 = (x_103 - 1); + int const x_105 = index_in1; + index_in1 = (x_105 - 1); + } + int const x_107 = condition_index; + int const x_110 = x_13.data_in2.arr[(x_107 + 1)]; + int const x_111 = condition_index; + condition_index = (x_111 + x_110); + int const x_113 = index_in0; + temp0 = x_113; + int const x_114 = index_in1; + index_in0 = x_114; + int const x_115 = temp0; + index_in1 = x_115; + int const x_116 = index_out0; + temp1 = x_116; + int const x_117 = index_out1; + index_out0 = x_117; + int const x_118 = temp1; + index_out1 = x_118; + { + int const x_119 = i; + i = (x_119 + 1); + } + } + return; +} + +kernel void tint_symbol(uint3 gl_WorkGroupID_param [[threadgroup_position_in_grid]], const device In2& x_13 [[buffer(2)]], const device In1& x_17 [[buffer(1)]], device Out0& x_15 [[buffer(3)]], const device In0& x_19 [[buffer(0)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = gl_WorkGroupID_param; + main_1(x_13, x_17, x_15, x_19, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..85465cc6a2 --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.spvasm @@ -0,0 +1,224 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 127 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 4 1 1 + OpName %gl_WorkGroupID "gl_WorkGroupID" + OpName %In2 "In2" + OpMemberName %In2 0 "data_in2" + OpName %x_13 "x_13" + OpName %Out0 "Out0" + OpMemberName %Out0 0 "data_out0" + OpName %x_15 "x_15" + OpName %In1 "In1" + OpMemberName %In1 0 "data_in1" + OpName %x_17 "x_17" + OpName %In0 "In0" + OpMemberName %In0 0 "data_in0" + OpName %x_19 "x_19" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %base_index_in "base_index_in" + OpName %base_index_out "base_index_out" + OpName %index_in0 "index_in0" + OpName %index_in1 "index_in1" + OpName %index_out0 "index_out0" + OpName %index_out1 "index_out1" + OpName %condition_index "condition_index" + OpName %i "i" + OpName %temp0 "temp0" + OpName %temp1 "temp1" + OpName %main "main" + OpDecorate %In2 Block + OpMemberDecorate %In2 0 Offset 0 + OpDecorate %_arr_int_uint_8 ArrayStride 4 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 2 + OpDecorate %Out0 Block + OpMemberDecorate %Out0 0 Offset 0 + OpDecorate %_arr_int_uint_1024 ArrayStride 4 + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 3 + OpDecorate %In1 Block + OpMemberDecorate %In1 0 Offset 0 + OpDecorate %_arr_int_uint_512 ArrayStride 4 + OpDecorate %x_17 NonWritable + OpDecorate %x_17 DescriptorSet 0 + OpDecorate %x_17 Binding 1 + OpDecorate %In0 Block + OpMemberDecorate %In0 0 Offset 0 + OpDecorate %x_19 NonWritable + OpDecorate %x_19 DescriptorSet 0 + OpDecorate %x_19 Binding 0 + OpDecorate %tint_symbol BuiltIn WorkgroupId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint +%gl_WorkGroupID = OpVariable %_ptr_Private_v3uint Private %5 + %int = OpTypeInt 32 1 + %uint_8 = OpConstant %uint 8 +%_arr_int_uint_8 = OpTypeArray %int %uint_8 + %In2 = OpTypeStruct %_arr_int_uint_8 +%_ptr_StorageBuffer_In2 = OpTypePointer StorageBuffer %In2 + %x_13 = OpVariable %_ptr_StorageBuffer_In2 StorageBuffer + %uint_1024 = OpConstant %uint 1024 +%_arr_int_uint_1024 = OpTypeArray %int %uint_1024 + %Out0 = OpTypeStruct %_arr_int_uint_1024 +%_ptr_StorageBuffer_Out0 = OpTypePointer StorageBuffer %Out0 + %x_15 = OpVariable %_ptr_StorageBuffer_Out0 StorageBuffer + %uint_512 = OpConstant %uint 512 +%_arr_int_uint_512 = OpTypeArray %int %uint_512 + %In1 = OpTypeStruct %_arr_int_uint_512 +%_ptr_StorageBuffer_In1 = OpTypePointer StorageBuffer %In1 + %x_17 = OpVariable %_ptr_StorageBuffer_In1 StorageBuffer + %In0 = OpTypeStruct %_arr_int_uint_512 +%_ptr_StorageBuffer_In0 = OpTypePointer StorageBuffer %In0 + %x_19 = OpVariable %_ptr_StorageBuffer_In0 StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %33 = OpConstantNull %uint +%_ptr_Function_int = OpTypePointer Function %int + %37 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %uint_128 = OpConstant %uint 128 + %uint_256 = OpConstant %uint 256 + %int_127 = OpConstant %int 127 + %int_383 = OpConstant %int 383 + %int_255 = OpConstant %int 255 + %int_0 = OpConstant %int 0 + %int_256 = OpConstant %int 256 + %bool = OpTypeBool +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 + %main_1 = OpFunction %void None %27 + %30 = OpLabel +%base_index_in = OpVariable %_ptr_Function_uint Function %33 +%base_index_out = OpVariable %_ptr_Function_uint Function %33 + %index_in0 = OpVariable %_ptr_Function_int Function %37 + %index_in1 = OpVariable %_ptr_Function_int Function %37 + %index_out0 = OpVariable %_ptr_Function_int Function %37 + %index_out1 = OpVariable %_ptr_Function_int Function %37 +%condition_index = OpVariable %_ptr_Function_int Function %37 + %i = OpVariable %_ptr_Function_int Function %37 + %temp0 = OpVariable %_ptr_Function_int Function %37 + %temp1 = OpVariable %_ptr_Function_int Function %37 + %47 = OpAccessChain %_ptr_Private_uint %gl_WorkGroupID %uint_0 + %48 = OpLoad %uint %47 + %50 = OpIMul %uint %uint_128 %48 + OpStore %base_index_in %50 + %51 = OpAccessChain %_ptr_Private_uint %gl_WorkGroupID %uint_0 + %52 = OpLoad %uint %51 + %54 = OpIMul %uint %uint_256 %52 + OpStore %base_index_out %54 + OpStore %index_in0 %int_127 + OpStore %index_in1 %int_383 + OpStore %index_out0 %int_255 + OpStore %index_out1 %int_383 + OpStore %condition_index %int_0 + OpStore %i %int_0 + OpBranch %59 + %59 = OpLabel + OpLoopMerge %60 %61 None + OpBranch %62 + %62 = OpLabel + %63 = OpLoad %int %i + %65 = OpSLessThan %bool %63 %int_256 + OpSelectionMerge %67 None + OpBranchConditional %65 %68 %69 + %68 = OpLabel + OpBranch %67 + %69 = OpLabel + OpBranch %60 + %67 = OpLabel + %70 = OpLoad %int %condition_index + %72 = OpAccessChain %_ptr_StorageBuffer_int %x_13 %uint_0 %70 + %73 = OpLoad %int %72 + %74 = OpIEqual %bool %73 %int_0 + OpSelectionMerge %75 None + OpBranchConditional %74 %76 %77 + %76 = OpLabel + %78 = OpLoad %uint %base_index_out + %79 = OpLoad %int %index_out0 + %80 = OpLoad %uint %base_index_in + %81 = OpLoad %int %index_in0 + %82 = OpBitcast %uint %81 + %83 = OpIAdd %uint %80 %82 + %84 = OpAccessChain %_ptr_StorageBuffer_int %x_17 %uint_0 %83 + %85 = OpLoad %int %84 + %86 = OpBitcast %uint %79 + %87 = OpIAdd %uint %78 %86 + %88 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %87 + OpStore %88 %85 + %89 = OpLoad %int %index_out0 + %91 = OpISub %int %89 %int_1 + OpStore %index_out0 %91 + %92 = OpLoad %int %index_in1 + %93 = OpISub %int %92 %int_1 + OpStore %index_in1 %93 + OpBranch %75 + %77 = OpLabel + %94 = OpLoad %uint %base_index_out + %95 = OpLoad %int %index_out1 + %96 = OpLoad %uint %base_index_in + %97 = OpLoad %int %index_in1 + %98 = OpBitcast %uint %97 + %99 = OpIAdd %uint %96 %98 + %100 = OpAccessChain %_ptr_StorageBuffer_int %x_19 %uint_0 %99 + %101 = OpLoad %int %100 + %102 = OpBitcast %uint %95 + %103 = OpIAdd %uint %94 %102 + %104 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %103 + OpStore %104 %101 + %105 = OpLoad %int %index_out1 + %106 = OpISub %int %105 %int_1 + OpStore %index_out1 %106 + %107 = OpLoad %int %index_in1 + %108 = OpISub %int %107 %int_1 + OpStore %index_in1 %108 + OpBranch %75 + %75 = OpLabel + %109 = OpLoad %int %condition_index + %110 = OpIAdd %int %109 %int_1 + %111 = OpAccessChain %_ptr_StorageBuffer_int %x_13 %uint_0 %110 + %112 = OpLoad %int %111 + %113 = OpLoad %int %condition_index + %114 = OpIAdd %int %113 %112 + OpStore %condition_index %114 + %115 = OpLoad %int %index_in0 + OpStore %temp0 %115 + %116 = OpLoad %int %index_in1 + OpStore %index_in0 %116 + %117 = OpLoad %int %temp0 + OpStore %index_in1 %117 + %118 = OpLoad %int %index_out0 + OpStore %temp1 %118 + %119 = OpLoad %int %index_out1 + OpStore %index_out0 %119 + %120 = OpLoad %int %temp1 + OpStore %index_out1 %120 + OpBranch %61 + %61 = OpLabel + %121 = OpLoad %int %i + %122 = OpIAdd %int %121 %int_1 + OpStore %i %122 + OpBranch %59 + %60 = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %124 = OpLabel + %125 = OpLoad %v3uint %tint_symbol + OpStore %gl_WorkGroupID %125 + %126 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..e16f3b9b58 --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_overflow/0-opt.wgsl.expected.wgsl @@ -0,0 +1,120 @@ +type Arr = [[stride(4)]] array; + +[[block]] +struct In2 { + data_in2 : Arr; +}; + +type Arr_1 = [[stride(4)]] array; + +[[block]] +struct Out0 { + data_out0 : Arr_1; +}; + +type Arr_2 = [[stride(4)]] array; + +type Arr_3 = [[stride(4)]] array; + +[[block]] +struct In1 { + data_in1 : Arr_3; +}; + +[[block]] +struct In0 { + data_in0 : Arr_3; +}; + +var gl_WorkGroupID : vec3; + +[[group(0), binding(2)]] var x_13 : In2; + +[[group(0), binding(3)]] var x_15 : Out0; + +[[group(0), binding(1)]] var x_17 : In1; + +[[group(0), binding(0)]] var x_19 : In0; + +fn main_1() { + var base_index_in : u32; + var base_index_out : u32; + var index_in0 : i32; + var index_in1 : i32; + var index_out0 : i32; + var index_out1 : i32; + var condition_index : i32; + var i : i32; + var temp0 : i32; + var temp1 : i32; + let x_58 : u32 = gl_WorkGroupID.x; + base_index_in = (128u * x_58); + let x_61 : u32 = gl_WorkGroupID.x; + base_index_out = (256u * x_61); + index_in0 = 127; + index_in1 = 383; + index_out0 = 255; + index_out1 = 383; + condition_index = 0; + i = 0; + loop { + let x_67 : i32 = i; + if ((x_67 < 256)) { + } else { + break; + } + let x_70 : i32 = condition_index; + let x_72 : i32 = x_13.data_in2[x_70]; + if ((x_72 == 0)) { + let x_77 : u32 = base_index_out; + let x_78 : i32 = index_out0; + let x_81 : u32 = base_index_in; + let x_82 : i32 = index_in0; + let x_86 : i32 = x_17.data_in1[(x_81 + bitcast(x_82))]; + x_15.data_out0[(x_77 + bitcast(x_78))] = x_86; + let x_88 : i32 = index_out0; + index_out0 = (x_88 - 1); + let x_90 : i32 = index_in1; + index_in1 = (x_90 - 1); + } else { + let x_92 : u32 = base_index_out; + let x_93 : i32 = index_out1; + let x_96 : u32 = base_index_in; + let x_97 : i32 = index_in1; + let x_101 : i32 = x_19.data_in0[(x_96 + bitcast(x_97))]; + x_15.data_out0[(x_92 + bitcast(x_93))] = x_101; + let x_103 : i32 = index_out1; + index_out1 = (x_103 - 1); + let x_105 : i32 = index_in1; + index_in1 = (x_105 - 1); + } + let x_107 : i32 = condition_index; + let x_110 : i32 = x_13.data_in2[(x_107 + 1)]; + let x_111 : i32 = condition_index; + condition_index = (x_111 + x_110); + let x_113 : i32 = index_in0; + temp0 = x_113; + let x_114 : i32 = index_in1; + index_in0 = x_114; + let x_115 : i32 = temp0; + index_in1 = x_115; + let x_116 : i32 = index_out0; + temp1 = x_116; + let x_117 : i32 = index_out1; + index_out0 = x_117; + let x_118 : i32 = temp1; + index_out1 = x_118; + + continuing { + let x_119 : i32 = i; + i = (x_119 + 1); + } + } + return; +} + +[[stage(compute), workgroup_size(4, 1, 1)]] +fn main([[builtin(workgroup_id)]] gl_WorkGroupID_param : vec3) { + gl_WorkGroupID = gl_WorkGroupID_param; + main_1(); +} diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm new file mode 100644 index 0000000000..50b5277b71 --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm @@ -0,0 +1,207 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_WorkGroupID + OpExecutionMode %main LocalSize 4 1 1 + OpSource GLSL 430 + OpName %main "main" + OpName %base_index_in "base_index_in" + OpName %gl_WorkGroupID "gl_WorkGroupID" + OpName %base_index_out "base_index_out" + OpName %index_in0 "index_in0" + OpName %index_in1 "index_in1" + OpName %index_out0 "index_out0" + OpName %index_out1 "index_out1" + OpName %condition_index "condition_index" + OpName %i "i" + OpName %In2 "In2" + OpMemberName %In2 0 "data_in2" + OpName %_ "" + OpName %Out0 "Out0" + OpMemberName %Out0 0 "data_out0" + OpName %__0 "" + OpName %In0 "In0" + OpMemberName %In0 0 "data_in0" + OpName %__1 "" + OpName %In1 "In1" + OpMemberName %In1 0 "data_in1" + OpName %__2 "" + OpName %temp0 "temp0" + OpName %temp1 "temp1" + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %_arr_int_uint_8 ArrayStride 4 + OpMemberDecorate %In2 0 NonWritable + OpMemberDecorate %In2 0 Offset 0 + OpDecorate %In2 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 2 + OpDecorate %_arr_int_uint_1024 ArrayStride 4 + OpMemberDecorate %Out0 0 NonReadable + OpMemberDecorate %Out0 0 Offset 0 + OpDecorate %Out0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 3 + OpDecorate %_arr_int_uint_512 ArrayStride 4 + OpMemberDecorate %In0 0 NonWritable + OpMemberDecorate %In0 0 Offset 0 + OpDecorate %In0 Block + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 0 + OpDecorate %_arr_int_uint_512_0 ArrayStride 4 + OpMemberDecorate %In1 0 NonWritable + OpMemberDecorate %In1 0 Offset 0 + OpDecorate %In1 Block + OpDecorate %__2 DescriptorSet 0 + OpDecorate %__2 Binding 1 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %28 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_128 = OpConstant %uint 128 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_256 = OpConstant %uint 256 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_n128 = OpConstant %int -128 + %int_256 = OpConstant %int 256 + %bool = OpTypeBool + %uint_8 = OpConstant %uint 8 +%_arr_int_uint_8 = OpTypeArray %int %uint_8 + %In2 = OpTypeStruct %_arr_int_uint_8 +%_ptr_StorageBuffer_In2 = OpTypePointer StorageBuffer %In2 + %_ = OpVariable %_ptr_StorageBuffer_In2 StorageBuffer +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %uint_1024 = OpConstant %uint 1024 +%_arr_int_uint_1024 = OpTypeArray %int %uint_1024 + %Out0 = OpTypeStruct %_arr_int_uint_1024 +%_ptr_StorageBuffer_Out0 = OpTypePointer StorageBuffer %Out0 + %__0 = OpVariable %_ptr_StorageBuffer_Out0 StorageBuffer + %uint_512 = OpConstant %uint 512 +%_arr_int_uint_512 = OpTypeArray %int %uint_512 + %In0 = OpTypeStruct %_arr_int_uint_512 +%_ptr_StorageBuffer_In0 = OpTypePointer StorageBuffer %In0 + %__1 = OpVariable %_ptr_StorageBuffer_In0 StorageBuffer + %int_1 = OpConstant %int 1 +%_arr_int_uint_512_0 = OpTypeArray %int %uint_512 + %In1 = OpTypeStruct %_arr_int_uint_512_0 +%_ptr_StorageBuffer_In1 = OpTypePointer StorageBuffer %In1 + %__2 = OpVariable %_ptr_StorageBuffer_In1 StorageBuffer + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_4 %uint_1 %uint_1 + %main = OpFunction %void None %28 + %54 = OpLabel +%base_index_in = OpVariable %_ptr_Function_uint Function +%base_index_out = OpVariable %_ptr_Function_uint Function + %index_in0 = OpVariable %_ptr_Function_int Function + %index_in1 = OpVariable %_ptr_Function_int Function + %index_out0 = OpVariable %_ptr_Function_int Function + %index_out1 = OpVariable %_ptr_Function_int Function +%condition_index = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %temp0 = OpVariable %_ptr_Function_int Function + %temp1 = OpVariable %_ptr_Function_int Function + %55 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %56 = OpLoad %uint %55 + %57 = OpIMul %uint %uint_128 %56 + OpStore %base_index_in %57 + %58 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %59 = OpLoad %uint %58 + %60 = OpIMul %uint %uint_256 %59 + OpStore %base_index_out %60 + OpStore %index_in0 %int_0 + OpStore %index_in1 %int_n128 + OpStore %index_out0 %int_0 + OpStore %index_out1 %int_n128 + OpStore %condition_index %int_0 + OpStore %i %int_0 + OpBranch %61 + %61 = OpLabel + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %65 = OpLoad %int %i + %66 = OpSLessThan %bool %65 %int_256 + OpBranchConditional %66 %67 %62 + %67 = OpLabel + %68 = OpLoad %int %condition_index + %69 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 %68 + %70 = OpLoad %int %69 + %71 = OpIEqual %bool %70 %int_0 + OpSelectionMerge %72 None + OpBranchConditional %71 %73 %74 + %73 = OpLabel + %75 = OpLoad %uint %base_index_out + %76 = OpLoad %int %index_out0 + %77 = OpBitcast %uint %76 + %78 = OpIAdd %uint %75 %77 + %79 = OpLoad %uint %base_index_in + %80 = OpLoad %int %index_in0 + %81 = OpBitcast %uint %80 + %82 = OpIAdd %uint %79 %81 + %83 = OpAccessChain %_ptr_StorageBuffer_int %__1 %int_0 %82 + %84 = OpLoad %int %83 + %85 = OpAccessChain %_ptr_StorageBuffer_int %__0 %int_0 %78 + OpStore %85 %84 + %86 = OpLoad %int %index_out0 + %87 = OpIAdd %int %86 %int_1 + OpStore %index_out0 %87 + %88 = OpLoad %int %index_in1 + %89 = OpIAdd %int %88 %int_1 + OpStore %index_in1 %89 + OpBranch %72 + %74 = OpLabel + %90 = OpLoad %uint %base_index_out + %91 = OpLoad %int %index_out1 + %92 = OpBitcast %uint %91 + %93 = OpIAdd %uint %90 %92 + %94 = OpLoad %uint %base_index_in + %95 = OpLoad %int %index_in1 + %96 = OpBitcast %uint %95 + %97 = OpIAdd %uint %94 %96 + %98 = OpAccessChain %_ptr_StorageBuffer_int %__2 %int_0 %97 + %99 = OpLoad %int %98 + %100 = OpAccessChain %_ptr_StorageBuffer_int %__0 %int_0 %93 + OpStore %100 %99 + %101 = OpLoad %int %index_out1 + %102 = OpIAdd %int %101 %int_1 + OpStore %index_out1 %102 + %103 = OpLoad %int %index_in1 + %104 = OpIAdd %int %103 %int_1 + OpStore %index_in1 %104 + OpBranch %72 + %72 = OpLabel + %105 = OpLoad %int %condition_index + %106 = OpIAdd %int %105 %int_1 + %107 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 %106 + %108 = OpLoad %int %107 + %109 = OpLoad %int %condition_index + %110 = OpIAdd %int %109 %108 + OpStore %condition_index %110 + %111 = OpLoad %int %index_in0 + OpStore %temp0 %111 + %112 = OpLoad %int %index_in1 + OpStore %index_in0 %112 + %113 = OpLoad %int %temp0 + OpStore %index_in1 %113 + %114 = OpLoad %int %index_out0 + OpStore %temp1 %114 + %115 = OpLoad %int %index_out1 + OpStore %index_out0 %115 + %116 = OpLoad %int %temp1 + OpStore %index_out1 %116 + OpBranch %63 + %63 = OpLabel + %117 = OpLoad %int %i + %118 = OpIAdd %int %117 %int_1 + OpStore %i %118 + OpBranch %61 + %62 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..df55b6b7fa --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.hlsl @@ -0,0 +1,69 @@ +static uint3 gl_WorkGroupID = uint3(0u, 0u, 0u); +ByteAddressBuffer x_13 : register(t2, space0); +RWByteAddressBuffer x_15 : register(u3, space0); +ByteAddressBuffer x_17 : register(t0, space0); +ByteAddressBuffer x_19 : register(t1, space0); + +void main_1() { + uint base_index_in = 0u; + uint base_index_out = 0u; + int index_in0 = 0; + int index_in1 = 0; + int index_out0 = 0; + int index_out1 = 0; + int condition_index = 0; + int i = 0; + int temp0 = 0; + int temp1 = 0; + const uint x_56 = gl_WorkGroupID.x; + base_index_in = (128u * x_56); + const uint x_59 = gl_WorkGroupID.x; + base_index_out = (256u * x_59); + index_in0 = 0; + index_in1 = -128; + index_out0 = 0; + index_out1 = -128; + condition_index = 0; + i = 0; + { + for(; (i < 256); i = (i + 1)) { + const int x_70 = asint(x_13.Load((4u * uint(condition_index)))); + if ((x_70 == 0)) { + const uint x_75 = base_index_out; + const int x_76 = index_out0; + const int x_84 = asint(x_17.Load((4u * (base_index_in + asuint(index_in0))))); + x_15.Store((4u * (x_75 + asuint(x_76))), asuint(x_84)); + index_out0 = (index_out0 + 1); + index_in1 = (index_in1 + 1); + } else { + const uint x_90 = base_index_out; + const int x_91 = index_out1; + const int x_99 = asint(x_19.Load((4u * (base_index_in + asuint(index_in1))))); + x_15.Store((4u * (x_90 + asuint(x_91))), asuint(x_99)); + index_out1 = (index_out1 + 1); + index_in1 = (index_in1 + 1); + } + const int x_108 = asint(x_13.Load((4u * uint((condition_index + 1))))); + condition_index = (condition_index + x_108); + temp0 = index_in0; + index_in0 = index_in1; + index_in1 = temp0; + temp1 = index_out0; + index_out0 = index_out1; + index_out1 = temp1; + } + } + return; +} + +struct tint_symbol_1 { + uint3 gl_WorkGroupID_param : SV_GroupID; +}; + +[numthreads(4, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 gl_WorkGroupID_param = tint_symbol.gl_WorkGroupID_param; + gl_WorkGroupID = gl_WorkGroupID_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.msl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..734a346dfa --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + /* 0x0000 */ int arr[8]; +}; +struct In2 { + /* 0x0000 */ tint_array_wrapper data_in2; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ int arr[1024]; +}; +struct Out0 { + /* 0x0000 */ tint_array_wrapper_1 data_out0; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ int arr[512]; +}; +struct In0 { + /* 0x0000 */ tint_array_wrapper_2 data_in0; +}; +struct In1 { + /* 0x0000 */ tint_array_wrapper_2 data_in1; +}; + +void main_1(const device In2& x_13, const device In0& x_17, device Out0& x_15, const device In1& x_19, thread uint3* const tint_symbol_2) { + uint base_index_in = 0u; + uint base_index_out = 0u; + int index_in0 = 0; + int index_in1 = 0; + int index_out0 = 0; + int index_out1 = 0; + int condition_index = 0; + int i = 0; + int temp0 = 0; + int temp1 = 0; + uint const x_56 = (*(tint_symbol_2)).x; + base_index_in = (128u * x_56); + uint const x_59 = (*(tint_symbol_2)).x; + base_index_out = (256u * x_59); + index_in0 = 0; + index_in1 = -128; + index_out0 = 0; + index_out1 = -128; + condition_index = 0; + i = 0; + while (true) { + int const x_65 = i; + if ((x_65 < 256)) { + } else { + break; + } + int const x_68 = condition_index; + int const x_70 = x_13.data_in2.arr[x_68]; + if ((x_70 == 0)) { + uint const x_75 = base_index_out; + int const x_76 = index_out0; + uint const x_79 = base_index_in; + int const x_80 = index_in0; + int const x_84 = x_17.data_in0.arr[(x_79 + as_type(x_80))]; + x_15.data_out0.arr[(x_75 + as_type(x_76))] = x_84; + int const x_86 = index_out0; + index_out0 = (x_86 + 1); + int const x_88 = index_in1; + index_in1 = (x_88 + 1); + } else { + uint const x_90 = base_index_out; + int const x_91 = index_out1; + uint const x_94 = base_index_in; + int const x_95 = index_in1; + int const x_99 = x_19.data_in1.arr[(x_94 + as_type(x_95))]; + x_15.data_out0.arr[(x_90 + as_type(x_91))] = x_99; + int const x_101 = index_out1; + index_out1 = (x_101 + 1); + int const x_103 = index_in1; + index_in1 = (x_103 + 1); + } + int const x_105 = condition_index; + int const x_108 = x_13.data_in2.arr[(x_105 + 1)]; + int const x_109 = condition_index; + condition_index = (x_109 + x_108); + int const x_111 = index_in0; + temp0 = x_111; + int const x_112 = index_in1; + index_in0 = x_112; + int const x_113 = temp0; + index_in1 = x_113; + int const x_114 = index_out0; + temp1 = x_114; + int const x_115 = index_out1; + index_out0 = x_115; + int const x_116 = temp1; + index_out1 = x_116; + { + int const x_117 = i; + i = (x_117 + 1); + } + } + return; +} + +kernel void tint_symbol(uint3 gl_WorkGroupID_param [[threadgroup_position_in_grid]], const device In2& x_13 [[buffer(2)]], const device In0& x_17 [[buffer(0)]], device Out0& x_15 [[buffer(3)]], const device In1& x_19 [[buffer(1)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = gl_WorkGroupID_param; + main_1(x_13, x_17, x_15, x_19, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..fd4ea43634 --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.spvasm @@ -0,0 +1,222 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 125 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 4 1 1 + OpName %gl_WorkGroupID "gl_WorkGroupID" + OpName %In2 "In2" + OpMemberName %In2 0 "data_in2" + OpName %x_13 "x_13" + OpName %Out0 "Out0" + OpMemberName %Out0 0 "data_out0" + OpName %x_15 "x_15" + OpName %In0 "In0" + OpMemberName %In0 0 "data_in0" + OpName %x_17 "x_17" + OpName %In1 "In1" + OpMemberName %In1 0 "data_in1" + OpName %x_19 "x_19" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %base_index_in "base_index_in" + OpName %base_index_out "base_index_out" + OpName %index_in0 "index_in0" + OpName %index_in1 "index_in1" + OpName %index_out0 "index_out0" + OpName %index_out1 "index_out1" + OpName %condition_index "condition_index" + OpName %i "i" + OpName %temp0 "temp0" + OpName %temp1 "temp1" + OpName %main "main" + OpDecorate %In2 Block + OpMemberDecorate %In2 0 Offset 0 + OpDecorate %_arr_int_uint_8 ArrayStride 4 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 2 + OpDecorate %Out0 Block + OpMemberDecorate %Out0 0 Offset 0 + OpDecorate %_arr_int_uint_1024 ArrayStride 4 + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 3 + OpDecorate %In0 Block + OpMemberDecorate %In0 0 Offset 0 + OpDecorate %_arr_int_uint_512 ArrayStride 4 + OpDecorate %x_17 NonWritable + OpDecorate %x_17 DescriptorSet 0 + OpDecorate %x_17 Binding 0 + OpDecorate %In1 Block + OpMemberDecorate %In1 0 Offset 0 + OpDecorate %x_19 NonWritable + OpDecorate %x_19 DescriptorSet 0 + OpDecorate %x_19 Binding 1 + OpDecorate %tint_symbol BuiltIn WorkgroupId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint +%gl_WorkGroupID = OpVariable %_ptr_Private_v3uint Private %5 + %int = OpTypeInt 32 1 + %uint_8 = OpConstant %uint 8 +%_arr_int_uint_8 = OpTypeArray %int %uint_8 + %In2 = OpTypeStruct %_arr_int_uint_8 +%_ptr_StorageBuffer_In2 = OpTypePointer StorageBuffer %In2 + %x_13 = OpVariable %_ptr_StorageBuffer_In2 StorageBuffer + %uint_1024 = OpConstant %uint 1024 +%_arr_int_uint_1024 = OpTypeArray %int %uint_1024 + %Out0 = OpTypeStruct %_arr_int_uint_1024 +%_ptr_StorageBuffer_Out0 = OpTypePointer StorageBuffer %Out0 + %x_15 = OpVariable %_ptr_StorageBuffer_Out0 StorageBuffer + %uint_512 = OpConstant %uint 512 +%_arr_int_uint_512 = OpTypeArray %int %uint_512 + %In0 = OpTypeStruct %_arr_int_uint_512 +%_ptr_StorageBuffer_In0 = OpTypePointer StorageBuffer %In0 + %x_17 = OpVariable %_ptr_StorageBuffer_In0 StorageBuffer + %In1 = OpTypeStruct %_arr_int_uint_512 +%_ptr_StorageBuffer_In1 = OpTypePointer StorageBuffer %In1 + %x_19 = OpVariable %_ptr_StorageBuffer_In1 StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %33 = OpConstantNull %uint +%_ptr_Function_int = OpTypePointer Function %int + %37 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %uint_128 = OpConstant %uint 128 + %uint_256 = OpConstant %uint 256 + %int_0 = OpConstant %int 0 + %int_n128 = OpConstant %int -128 + %int_256 = OpConstant %int 256 + %bool = OpTypeBool +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 + %main_1 = OpFunction %void None %27 + %30 = OpLabel +%base_index_in = OpVariable %_ptr_Function_uint Function %33 +%base_index_out = OpVariable %_ptr_Function_uint Function %33 + %index_in0 = OpVariable %_ptr_Function_int Function %37 + %index_in1 = OpVariable %_ptr_Function_int Function %37 + %index_out0 = OpVariable %_ptr_Function_int Function %37 + %index_out1 = OpVariable %_ptr_Function_int Function %37 +%condition_index = OpVariable %_ptr_Function_int Function %37 + %i = OpVariable %_ptr_Function_int Function %37 + %temp0 = OpVariable %_ptr_Function_int Function %37 + %temp1 = OpVariable %_ptr_Function_int Function %37 + %47 = OpAccessChain %_ptr_Private_uint %gl_WorkGroupID %uint_0 + %48 = OpLoad %uint %47 + %50 = OpIMul %uint %uint_128 %48 + OpStore %base_index_in %50 + %51 = OpAccessChain %_ptr_Private_uint %gl_WorkGroupID %uint_0 + %52 = OpLoad %uint %51 + %54 = OpIMul %uint %uint_256 %52 + OpStore %base_index_out %54 + OpStore %index_in0 %int_0 + OpStore %index_in1 %int_n128 + OpStore %index_out0 %int_0 + OpStore %index_out1 %int_n128 + OpStore %condition_index %int_0 + OpStore %i %int_0 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %i + %63 = OpSLessThan %bool %61 %int_256 + OpSelectionMerge %65 None + OpBranchConditional %63 %66 %67 + %66 = OpLabel + OpBranch %65 + %67 = OpLabel + OpBranch %58 + %65 = OpLabel + %68 = OpLoad %int %condition_index + %70 = OpAccessChain %_ptr_StorageBuffer_int %x_13 %uint_0 %68 + %71 = OpLoad %int %70 + %72 = OpIEqual %bool %71 %int_0 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + %76 = OpLoad %uint %base_index_out + %77 = OpLoad %int %index_out0 + %78 = OpLoad %uint %base_index_in + %79 = OpLoad %int %index_in0 + %80 = OpBitcast %uint %79 + %81 = OpIAdd %uint %78 %80 + %82 = OpAccessChain %_ptr_StorageBuffer_int %x_17 %uint_0 %81 + %83 = OpLoad %int %82 + %84 = OpBitcast %uint %77 + %85 = OpIAdd %uint %76 %84 + %86 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %85 + OpStore %86 %83 + %87 = OpLoad %int %index_out0 + %89 = OpIAdd %int %87 %int_1 + OpStore %index_out0 %89 + %90 = OpLoad %int %index_in1 + %91 = OpIAdd %int %90 %int_1 + OpStore %index_in1 %91 + OpBranch %73 + %75 = OpLabel + %92 = OpLoad %uint %base_index_out + %93 = OpLoad %int %index_out1 + %94 = OpLoad %uint %base_index_in + %95 = OpLoad %int %index_in1 + %96 = OpBitcast %uint %95 + %97 = OpIAdd %uint %94 %96 + %98 = OpAccessChain %_ptr_StorageBuffer_int %x_19 %uint_0 %97 + %99 = OpLoad %int %98 + %100 = OpBitcast %uint %93 + %101 = OpIAdd %uint %92 %100 + %102 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %101 + OpStore %102 %99 + %103 = OpLoad %int %index_out1 + %104 = OpIAdd %int %103 %int_1 + OpStore %index_out1 %104 + %105 = OpLoad %int %index_in1 + %106 = OpIAdd %int %105 %int_1 + OpStore %index_in1 %106 + OpBranch %73 + %73 = OpLabel + %107 = OpLoad %int %condition_index + %108 = OpIAdd %int %107 %int_1 + %109 = OpAccessChain %_ptr_StorageBuffer_int %x_13 %uint_0 %108 + %110 = OpLoad %int %109 + %111 = OpLoad %int %condition_index + %112 = OpIAdd %int %111 %110 + OpStore %condition_index %112 + %113 = OpLoad %int %index_in0 + OpStore %temp0 %113 + %114 = OpLoad %int %index_in1 + OpStore %index_in0 %114 + %115 = OpLoad %int %temp0 + OpStore %index_in1 %115 + %116 = OpLoad %int %index_out0 + OpStore %temp1 %116 + %117 = OpLoad %int %index_out1 + OpStore %index_out0 %117 + %118 = OpLoad %int %temp1 + OpStore %index_out1 %118 + OpBranch %59 + %59 = OpLabel + %119 = OpLoad %int %i + %120 = OpIAdd %int %119 %int_1 + OpStore %i %120 + OpBranch %57 + %58 = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %122 = OpLabel + %123 = OpLoad %v3uint %tint_symbol + OpStore %gl_WorkGroupID %123 + %124 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..6aa8659a1b --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.spvasm.expected.wgsl @@ -0,0 +1,120 @@ +type Arr = [[stride(4)]] array; + +[[block]] +struct In2 { + data_in2 : Arr; +}; + +type Arr_1 = [[stride(4)]] array; + +[[block]] +struct Out0 { + data_out0 : Arr_1; +}; + +type Arr_2 = [[stride(4)]] array; + +type Arr_3 = [[stride(4)]] array; + +[[block]] +struct In0 { + data_in0 : Arr_3; +}; + +[[block]] +struct In1 { + data_in1 : Arr_3; +}; + +var gl_WorkGroupID : vec3; + +[[group(0), binding(2)]] var x_13 : In2; + +[[group(0), binding(3)]] var x_15 : Out0; + +[[group(0), binding(0)]] var x_17 : In0; + +[[group(0), binding(1)]] var x_19 : In1; + +fn main_1() { + var base_index_in : u32; + var base_index_out : u32; + var index_in0 : i32; + var index_in1 : i32; + var index_out0 : i32; + var index_out1 : i32; + var condition_index : i32; + var i : i32; + var temp0 : i32; + var temp1 : i32; + let x_56 : u32 = gl_WorkGroupID.x; + base_index_in = (128u * x_56); + let x_59 : u32 = gl_WorkGroupID.x; + base_index_out = (256u * x_59); + index_in0 = 0; + index_in1 = -128; + index_out0 = 0; + index_out1 = -128; + condition_index = 0; + i = 0; + loop { + let x_65 : i32 = i; + if ((x_65 < 256)) { + } else { + break; + } + let x_68 : i32 = condition_index; + let x_70 : i32 = x_13.data_in2[x_68]; + if ((x_70 == 0)) { + let x_75 : u32 = base_index_out; + let x_76 : i32 = index_out0; + let x_79 : u32 = base_index_in; + let x_80 : i32 = index_in0; + let x_84 : i32 = x_17.data_in0[(x_79 + bitcast(x_80))]; + x_15.data_out0[(x_75 + bitcast(x_76))] = x_84; + let x_86 : i32 = index_out0; + index_out0 = (x_86 + 1); + let x_88 : i32 = index_in1; + index_in1 = (x_88 + 1); + } else { + let x_90 : u32 = base_index_out; + let x_91 : i32 = index_out1; + let x_94 : u32 = base_index_in; + let x_95 : i32 = index_in1; + let x_99 : i32 = x_19.data_in1[(x_94 + bitcast(x_95))]; + x_15.data_out0[(x_90 + bitcast(x_91))] = x_99; + let x_101 : i32 = index_out1; + index_out1 = (x_101 + 1); + let x_103 : i32 = index_in1; + index_in1 = (x_103 + 1); + } + let x_105 : i32 = condition_index; + let x_108 : i32 = x_13.data_in2[(x_105 + 1)]; + let x_109 : i32 = condition_index; + condition_index = (x_109 + x_108); + let x_111 : i32 = index_in0; + temp0 = x_111; + let x_112 : i32 = index_in1; + index_in0 = x_112; + let x_113 : i32 = temp0; + index_in1 = x_113; + let x_114 : i32 = index_out0; + temp1 = x_114; + let x_115 : i32 = index_out1; + index_out0 = x_115; + let x_116 : i32 = temp1; + index_out1 = x_116; + + continuing { + let x_117 : i32 = i; + i = (x_117 + 1); + } + } + return; +} + +[[stage(compute), workgroup_size(4, 1, 1)]] +fn main([[builtin(workgroup_id)]] gl_WorkGroupID_param : vec3) { + gl_WorkGroupID = gl_WorkGroupID_param; + main_1(); +} diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl new file mode 100644 index 0000000000..6aa8659a1b --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl @@ -0,0 +1,120 @@ +type Arr = [[stride(4)]] array; + +[[block]] +struct In2 { + data_in2 : Arr; +}; + +type Arr_1 = [[stride(4)]] array; + +[[block]] +struct Out0 { + data_out0 : Arr_1; +}; + +type Arr_2 = [[stride(4)]] array; + +type Arr_3 = [[stride(4)]] array; + +[[block]] +struct In0 { + data_in0 : Arr_3; +}; + +[[block]] +struct In1 { + data_in1 : Arr_3; +}; + +var gl_WorkGroupID : vec3; + +[[group(0), binding(2)]] var x_13 : In2; + +[[group(0), binding(3)]] var x_15 : Out0; + +[[group(0), binding(0)]] var x_17 : In0; + +[[group(0), binding(1)]] var x_19 : In1; + +fn main_1() { + var base_index_in : u32; + var base_index_out : u32; + var index_in0 : i32; + var index_in1 : i32; + var index_out0 : i32; + var index_out1 : i32; + var condition_index : i32; + var i : i32; + var temp0 : i32; + var temp1 : i32; + let x_56 : u32 = gl_WorkGroupID.x; + base_index_in = (128u * x_56); + let x_59 : u32 = gl_WorkGroupID.x; + base_index_out = (256u * x_59); + index_in0 = 0; + index_in1 = -128; + index_out0 = 0; + index_out1 = -128; + condition_index = 0; + i = 0; + loop { + let x_65 : i32 = i; + if ((x_65 < 256)) { + } else { + break; + } + let x_68 : i32 = condition_index; + let x_70 : i32 = x_13.data_in2[x_68]; + if ((x_70 == 0)) { + let x_75 : u32 = base_index_out; + let x_76 : i32 = index_out0; + let x_79 : u32 = base_index_in; + let x_80 : i32 = index_in0; + let x_84 : i32 = x_17.data_in0[(x_79 + bitcast(x_80))]; + x_15.data_out0[(x_75 + bitcast(x_76))] = x_84; + let x_86 : i32 = index_out0; + index_out0 = (x_86 + 1); + let x_88 : i32 = index_in1; + index_in1 = (x_88 + 1); + } else { + let x_90 : u32 = base_index_out; + let x_91 : i32 = index_out1; + let x_94 : u32 = base_index_in; + let x_95 : i32 = index_in1; + let x_99 : i32 = x_19.data_in1[(x_94 + bitcast(x_95))]; + x_15.data_out0[(x_90 + bitcast(x_91))] = x_99; + let x_101 : i32 = index_out1; + index_out1 = (x_101 + 1); + let x_103 : i32 = index_in1; + index_in1 = (x_103 + 1); + } + let x_105 : i32 = condition_index; + let x_108 : i32 = x_13.data_in2[(x_105 + 1)]; + let x_109 : i32 = condition_index; + condition_index = (x_109 + x_108); + let x_111 : i32 = index_in0; + temp0 = x_111; + let x_112 : i32 = index_in1; + index_in0 = x_112; + let x_113 : i32 = temp0; + index_in1 = x_113; + let x_114 : i32 = index_out0; + temp1 = x_114; + let x_115 : i32 = index_out1; + index_out0 = x_115; + let x_116 : i32 = temp1; + index_out1 = x_116; + + continuing { + let x_117 : i32 = i; + i = (x_117 + 1); + } + } + return; +} + +[[stage(compute), workgroup_size(4, 1, 1)]] +fn main([[builtin(workgroup_id)]] gl_WorkGroupID_param : vec3) { + gl_WorkGroupID = gl_WorkGroupID_param; + main_1(); +} diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..df55b6b7fa --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.hlsl @@ -0,0 +1,69 @@ +static uint3 gl_WorkGroupID = uint3(0u, 0u, 0u); +ByteAddressBuffer x_13 : register(t2, space0); +RWByteAddressBuffer x_15 : register(u3, space0); +ByteAddressBuffer x_17 : register(t0, space0); +ByteAddressBuffer x_19 : register(t1, space0); + +void main_1() { + uint base_index_in = 0u; + uint base_index_out = 0u; + int index_in0 = 0; + int index_in1 = 0; + int index_out0 = 0; + int index_out1 = 0; + int condition_index = 0; + int i = 0; + int temp0 = 0; + int temp1 = 0; + const uint x_56 = gl_WorkGroupID.x; + base_index_in = (128u * x_56); + const uint x_59 = gl_WorkGroupID.x; + base_index_out = (256u * x_59); + index_in0 = 0; + index_in1 = -128; + index_out0 = 0; + index_out1 = -128; + condition_index = 0; + i = 0; + { + for(; (i < 256); i = (i + 1)) { + const int x_70 = asint(x_13.Load((4u * uint(condition_index)))); + if ((x_70 == 0)) { + const uint x_75 = base_index_out; + const int x_76 = index_out0; + const int x_84 = asint(x_17.Load((4u * (base_index_in + asuint(index_in0))))); + x_15.Store((4u * (x_75 + asuint(x_76))), asuint(x_84)); + index_out0 = (index_out0 + 1); + index_in1 = (index_in1 + 1); + } else { + const uint x_90 = base_index_out; + const int x_91 = index_out1; + const int x_99 = asint(x_19.Load((4u * (base_index_in + asuint(index_in1))))); + x_15.Store((4u * (x_90 + asuint(x_91))), asuint(x_99)); + index_out1 = (index_out1 + 1); + index_in1 = (index_in1 + 1); + } + const int x_108 = asint(x_13.Load((4u * uint((condition_index + 1))))); + condition_index = (condition_index + x_108); + temp0 = index_in0; + index_in0 = index_in1; + index_in1 = temp0; + temp1 = index_out0; + index_out0 = index_out1; + index_out1 = temp1; + } + } + return; +} + +struct tint_symbol_1 { + uint3 gl_WorkGroupID_param : SV_GroupID; +}; + +[numthreads(4, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 gl_WorkGroupID_param = tint_symbol.gl_WorkGroupID_param; + gl_WorkGroupID = gl_WorkGroupID_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.msl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..734a346dfa --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.msl @@ -0,0 +1,108 @@ +#include + +using namespace metal; +struct tint_array_wrapper { + /* 0x0000 */ int arr[8]; +}; +struct In2 { + /* 0x0000 */ tint_array_wrapper data_in2; +}; +struct tint_array_wrapper_1 { + /* 0x0000 */ int arr[1024]; +}; +struct Out0 { + /* 0x0000 */ tint_array_wrapper_1 data_out0; +}; +struct tint_array_wrapper_2 { + /* 0x0000 */ int arr[512]; +}; +struct In0 { + /* 0x0000 */ tint_array_wrapper_2 data_in0; +}; +struct In1 { + /* 0x0000 */ tint_array_wrapper_2 data_in1; +}; + +void main_1(const device In2& x_13, const device In0& x_17, device Out0& x_15, const device In1& x_19, thread uint3* const tint_symbol_2) { + uint base_index_in = 0u; + uint base_index_out = 0u; + int index_in0 = 0; + int index_in1 = 0; + int index_out0 = 0; + int index_out1 = 0; + int condition_index = 0; + int i = 0; + int temp0 = 0; + int temp1 = 0; + uint const x_56 = (*(tint_symbol_2)).x; + base_index_in = (128u * x_56); + uint const x_59 = (*(tint_symbol_2)).x; + base_index_out = (256u * x_59); + index_in0 = 0; + index_in1 = -128; + index_out0 = 0; + index_out1 = -128; + condition_index = 0; + i = 0; + while (true) { + int const x_65 = i; + if ((x_65 < 256)) { + } else { + break; + } + int const x_68 = condition_index; + int const x_70 = x_13.data_in2.arr[x_68]; + if ((x_70 == 0)) { + uint const x_75 = base_index_out; + int const x_76 = index_out0; + uint const x_79 = base_index_in; + int const x_80 = index_in0; + int const x_84 = x_17.data_in0.arr[(x_79 + as_type(x_80))]; + x_15.data_out0.arr[(x_75 + as_type(x_76))] = x_84; + int const x_86 = index_out0; + index_out0 = (x_86 + 1); + int const x_88 = index_in1; + index_in1 = (x_88 + 1); + } else { + uint const x_90 = base_index_out; + int const x_91 = index_out1; + uint const x_94 = base_index_in; + int const x_95 = index_in1; + int const x_99 = x_19.data_in1.arr[(x_94 + as_type(x_95))]; + x_15.data_out0.arr[(x_90 + as_type(x_91))] = x_99; + int const x_101 = index_out1; + index_out1 = (x_101 + 1); + int const x_103 = index_in1; + index_in1 = (x_103 + 1); + } + int const x_105 = condition_index; + int const x_108 = x_13.data_in2.arr[(x_105 + 1)]; + int const x_109 = condition_index; + condition_index = (x_109 + x_108); + int const x_111 = index_in0; + temp0 = x_111; + int const x_112 = index_in1; + index_in0 = x_112; + int const x_113 = temp0; + index_in1 = x_113; + int const x_114 = index_out0; + temp1 = x_114; + int const x_115 = index_out1; + index_out0 = x_115; + int const x_116 = temp1; + index_out1 = x_116; + { + int const x_117 = i; + i = (x_117 + 1); + } + } + return; +} + +kernel void tint_symbol(uint3 gl_WorkGroupID_param [[threadgroup_position_in_grid]], const device In2& x_13 [[buffer(2)]], const device In0& x_17 [[buffer(0)]], device Out0& x_15 [[buffer(3)]], const device In1& x_19 [[buffer(1)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = gl_WorkGroupID_param; + main_1(x_13, x_17, x_15, x_19, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd4ea43634 --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.spvasm @@ -0,0 +1,222 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 125 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 4 1 1 + OpName %gl_WorkGroupID "gl_WorkGroupID" + OpName %In2 "In2" + OpMemberName %In2 0 "data_in2" + OpName %x_13 "x_13" + OpName %Out0 "Out0" + OpMemberName %Out0 0 "data_out0" + OpName %x_15 "x_15" + OpName %In0 "In0" + OpMemberName %In0 0 "data_in0" + OpName %x_17 "x_17" + OpName %In1 "In1" + OpMemberName %In1 0 "data_in1" + OpName %x_19 "x_19" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %base_index_in "base_index_in" + OpName %base_index_out "base_index_out" + OpName %index_in0 "index_in0" + OpName %index_in1 "index_in1" + OpName %index_out0 "index_out0" + OpName %index_out1 "index_out1" + OpName %condition_index "condition_index" + OpName %i "i" + OpName %temp0 "temp0" + OpName %temp1 "temp1" + OpName %main "main" + OpDecorate %In2 Block + OpMemberDecorate %In2 0 Offset 0 + OpDecorate %_arr_int_uint_8 ArrayStride 4 + OpDecorate %x_13 NonWritable + OpDecorate %x_13 DescriptorSet 0 + OpDecorate %x_13 Binding 2 + OpDecorate %Out0 Block + OpMemberDecorate %Out0 0 Offset 0 + OpDecorate %_arr_int_uint_1024 ArrayStride 4 + OpDecorate %x_15 DescriptorSet 0 + OpDecorate %x_15 Binding 3 + OpDecorate %In0 Block + OpMemberDecorate %In0 0 Offset 0 + OpDecorate %_arr_int_uint_512 ArrayStride 4 + OpDecorate %x_17 NonWritable + OpDecorate %x_17 DescriptorSet 0 + OpDecorate %x_17 Binding 0 + OpDecorate %In1 Block + OpMemberDecorate %In1 0 Offset 0 + OpDecorate %x_19 NonWritable + OpDecorate %x_19 DescriptorSet 0 + OpDecorate %x_19 Binding 1 + OpDecorate %tint_symbol BuiltIn WorkgroupId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint +%gl_WorkGroupID = OpVariable %_ptr_Private_v3uint Private %5 + %int = OpTypeInt 32 1 + %uint_8 = OpConstant %uint 8 +%_arr_int_uint_8 = OpTypeArray %int %uint_8 + %In2 = OpTypeStruct %_arr_int_uint_8 +%_ptr_StorageBuffer_In2 = OpTypePointer StorageBuffer %In2 + %x_13 = OpVariable %_ptr_StorageBuffer_In2 StorageBuffer + %uint_1024 = OpConstant %uint 1024 +%_arr_int_uint_1024 = OpTypeArray %int %uint_1024 + %Out0 = OpTypeStruct %_arr_int_uint_1024 +%_ptr_StorageBuffer_Out0 = OpTypePointer StorageBuffer %Out0 + %x_15 = OpVariable %_ptr_StorageBuffer_Out0 StorageBuffer + %uint_512 = OpConstant %uint 512 +%_arr_int_uint_512 = OpTypeArray %int %uint_512 + %In0 = OpTypeStruct %_arr_int_uint_512 +%_ptr_StorageBuffer_In0 = OpTypePointer StorageBuffer %In0 + %x_17 = OpVariable %_ptr_StorageBuffer_In0 StorageBuffer + %In1 = OpTypeStruct %_arr_int_uint_512 +%_ptr_StorageBuffer_In1 = OpTypePointer StorageBuffer %In1 + %x_19 = OpVariable %_ptr_StorageBuffer_In1 StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %27 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %33 = OpConstantNull %uint +%_ptr_Function_int = OpTypePointer Function %int + %37 = OpConstantNull %int + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %uint_128 = OpConstant %uint 128 + %uint_256 = OpConstant %uint 256 + %int_0 = OpConstant %int 0 + %int_n128 = OpConstant %int -128 + %int_256 = OpConstant %int 256 + %bool = OpTypeBool +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 + %main_1 = OpFunction %void None %27 + %30 = OpLabel +%base_index_in = OpVariable %_ptr_Function_uint Function %33 +%base_index_out = OpVariable %_ptr_Function_uint Function %33 + %index_in0 = OpVariable %_ptr_Function_int Function %37 + %index_in1 = OpVariable %_ptr_Function_int Function %37 + %index_out0 = OpVariable %_ptr_Function_int Function %37 + %index_out1 = OpVariable %_ptr_Function_int Function %37 +%condition_index = OpVariable %_ptr_Function_int Function %37 + %i = OpVariable %_ptr_Function_int Function %37 + %temp0 = OpVariable %_ptr_Function_int Function %37 + %temp1 = OpVariable %_ptr_Function_int Function %37 + %47 = OpAccessChain %_ptr_Private_uint %gl_WorkGroupID %uint_0 + %48 = OpLoad %uint %47 + %50 = OpIMul %uint %uint_128 %48 + OpStore %base_index_in %50 + %51 = OpAccessChain %_ptr_Private_uint %gl_WorkGroupID %uint_0 + %52 = OpLoad %uint %51 + %54 = OpIMul %uint %uint_256 %52 + OpStore %base_index_out %54 + OpStore %index_in0 %int_0 + OpStore %index_in1 %int_n128 + OpStore %index_out0 %int_0 + OpStore %index_out1 %int_n128 + OpStore %condition_index %int_0 + OpStore %i %int_0 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %i + %63 = OpSLessThan %bool %61 %int_256 + OpSelectionMerge %65 None + OpBranchConditional %63 %66 %67 + %66 = OpLabel + OpBranch %65 + %67 = OpLabel + OpBranch %58 + %65 = OpLabel + %68 = OpLoad %int %condition_index + %70 = OpAccessChain %_ptr_StorageBuffer_int %x_13 %uint_0 %68 + %71 = OpLoad %int %70 + %72 = OpIEqual %bool %71 %int_0 + OpSelectionMerge %73 None + OpBranchConditional %72 %74 %75 + %74 = OpLabel + %76 = OpLoad %uint %base_index_out + %77 = OpLoad %int %index_out0 + %78 = OpLoad %uint %base_index_in + %79 = OpLoad %int %index_in0 + %80 = OpBitcast %uint %79 + %81 = OpIAdd %uint %78 %80 + %82 = OpAccessChain %_ptr_StorageBuffer_int %x_17 %uint_0 %81 + %83 = OpLoad %int %82 + %84 = OpBitcast %uint %77 + %85 = OpIAdd %uint %76 %84 + %86 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %85 + OpStore %86 %83 + %87 = OpLoad %int %index_out0 + %89 = OpIAdd %int %87 %int_1 + OpStore %index_out0 %89 + %90 = OpLoad %int %index_in1 + %91 = OpIAdd %int %90 %int_1 + OpStore %index_in1 %91 + OpBranch %73 + %75 = OpLabel + %92 = OpLoad %uint %base_index_out + %93 = OpLoad %int %index_out1 + %94 = OpLoad %uint %base_index_in + %95 = OpLoad %int %index_in1 + %96 = OpBitcast %uint %95 + %97 = OpIAdd %uint %94 %96 + %98 = OpAccessChain %_ptr_StorageBuffer_int %x_19 %uint_0 %97 + %99 = OpLoad %int %98 + %100 = OpBitcast %uint %93 + %101 = OpIAdd %uint %92 %100 + %102 = OpAccessChain %_ptr_StorageBuffer_int %x_15 %uint_0 %101 + OpStore %102 %99 + %103 = OpLoad %int %index_out1 + %104 = OpIAdd %int %103 %int_1 + OpStore %index_out1 %104 + %105 = OpLoad %int %index_in1 + %106 = OpIAdd %int %105 %int_1 + OpStore %index_in1 %106 + OpBranch %73 + %73 = OpLabel + %107 = OpLoad %int %condition_index + %108 = OpIAdd %int %107 %int_1 + %109 = OpAccessChain %_ptr_StorageBuffer_int %x_13 %uint_0 %108 + %110 = OpLoad %int %109 + %111 = OpLoad %int %condition_index + %112 = OpIAdd %int %111 %110 + OpStore %condition_index %112 + %113 = OpLoad %int %index_in0 + OpStore %temp0 %113 + %114 = OpLoad %int %index_in1 + OpStore %index_in0 %114 + %115 = OpLoad %int %temp0 + OpStore %index_in1 %115 + %116 = OpLoad %int %index_out0 + OpStore %temp1 %116 + %117 = OpLoad %int %index_out1 + OpStore %index_out0 %117 + %118 = OpLoad %int %temp1 + OpStore %index_out1 %118 + OpBranch %59 + %59 = OpLabel + %119 = OpLoad %int %i + %120 = OpIAdd %int %119 %int_1 + OpStore %i %120 + OpBranch %57 + %58 = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %27 + %122 = OpLabel + %123 = OpLoad %v3uint %tint_symbol + OpStore %gl_WorkGroupID %123 + %124 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..6aa8659a1b --- /dev/null +++ b/test/vk-gl-cts/non_robust_buffer_access/unexecuted_oob_underflow/0-opt.wgsl.expected.wgsl @@ -0,0 +1,120 @@ +type Arr = [[stride(4)]] array; + +[[block]] +struct In2 { + data_in2 : Arr; +}; + +type Arr_1 = [[stride(4)]] array; + +[[block]] +struct Out0 { + data_out0 : Arr_1; +}; + +type Arr_2 = [[stride(4)]] array; + +type Arr_3 = [[stride(4)]] array; + +[[block]] +struct In0 { + data_in0 : Arr_3; +}; + +[[block]] +struct In1 { + data_in1 : Arr_3; +}; + +var gl_WorkGroupID : vec3; + +[[group(0), binding(2)]] var x_13 : In2; + +[[group(0), binding(3)]] var x_15 : Out0; + +[[group(0), binding(0)]] var x_17 : In0; + +[[group(0), binding(1)]] var x_19 : In1; + +fn main_1() { + var base_index_in : u32; + var base_index_out : u32; + var index_in0 : i32; + var index_in1 : i32; + var index_out0 : i32; + var index_out1 : i32; + var condition_index : i32; + var i : i32; + var temp0 : i32; + var temp1 : i32; + let x_56 : u32 = gl_WorkGroupID.x; + base_index_in = (128u * x_56); + let x_59 : u32 = gl_WorkGroupID.x; + base_index_out = (256u * x_59); + index_in0 = 0; + index_in1 = -128; + index_out0 = 0; + index_out1 = -128; + condition_index = 0; + i = 0; + loop { + let x_65 : i32 = i; + if ((x_65 < 256)) { + } else { + break; + } + let x_68 : i32 = condition_index; + let x_70 : i32 = x_13.data_in2[x_68]; + if ((x_70 == 0)) { + let x_75 : u32 = base_index_out; + let x_76 : i32 = index_out0; + let x_79 : u32 = base_index_in; + let x_80 : i32 = index_in0; + let x_84 : i32 = x_17.data_in0[(x_79 + bitcast(x_80))]; + x_15.data_out0[(x_75 + bitcast(x_76))] = x_84; + let x_86 : i32 = index_out0; + index_out0 = (x_86 + 1); + let x_88 : i32 = index_in1; + index_in1 = (x_88 + 1); + } else { + let x_90 : u32 = base_index_out; + let x_91 : i32 = index_out1; + let x_94 : u32 = base_index_in; + let x_95 : i32 = index_in1; + let x_99 : i32 = x_19.data_in1[(x_94 + bitcast(x_95))]; + x_15.data_out0[(x_90 + bitcast(x_91))] = x_99; + let x_101 : i32 = index_out1; + index_out1 = (x_101 + 1); + let x_103 : i32 = index_in1; + index_in1 = (x_103 + 1); + } + let x_105 : i32 = condition_index; + let x_108 : i32 = x_13.data_in2[(x_105 + 1)]; + let x_109 : i32 = condition_index; + condition_index = (x_109 + x_108); + let x_111 : i32 = index_in0; + temp0 = x_111; + let x_112 : i32 = index_in1; + index_in0 = x_112; + let x_113 : i32 = temp0; + index_in1 = x_113; + let x_114 : i32 = index_out0; + temp1 = x_114; + let x_115 : i32 = index_out1; + index_out0 = x_115; + let x_116 : i32 = temp1; + index_out1 = x_116; + + continuing { + let x_117 : i32 = i; + i = (x_117 + 1); + } + } + return; +} + +[[stage(compute), workgroup_size(4, 1, 1)]] +fn main([[builtin(workgroup_id)]] gl_WorkGroupID_param : vec3) { + gl_WorkGroupID = gl_WorkGroupID_param; + main_1(); +} diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm new file mode 100644 index 0000000000..38520f7129 --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm @@ -0,0 +1,22 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpName %main "main" + OpName %color "color" + OpDecorate %color Location 0 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %10 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %5 + %11 = OpLabel + OpStore %color %10 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.hlsl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..bd7ca9ffef --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.hlsl @@ -0,0 +1,20 @@ +static float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + color = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; +} + +struct main_out { + float4 color_1; +}; +struct tint_symbol { + float4 color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.msl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.msl new file mode 100644 index 0000000000..8c9629d15c --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +using namespace metal; +struct main_out { + float4 color_1; +}; +struct tint_symbol_1 { + float4 color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.color_1=tint_symbol_2.color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.spvasm b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..7964ca830e --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %color "color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %13 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %14 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + OpStore %color %13 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %14 +%tint_symbol = OpFunctionParameter %main_out + %18 = OpLabel + %19 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %19 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %21 = OpLabel + %22 = OpFunctionCall %void %main_1 + %24 = OpLoad %v4float %color + %25 = OpCompositeConstruct %main_out %24 + %23 = OpFunctionCall %void %tint_symbol_2 %25 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.wgsl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..c1d101cf7b --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var color : vec4; + +fn main_1() { + color = vec4(1.0, 1.0, 1.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color); +} diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl new file mode 100644 index 0000000000..c1d101cf7b --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl @@ -0,0 +1,17 @@ +var color : vec4; + +fn main_1() { + color = vec4(1.0, 1.0, 1.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color); +} diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.hlsl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..bd7ca9ffef --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.hlsl @@ -0,0 +1,20 @@ +static float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + color = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; +} + +struct main_out { + float4 color_1; +}; +struct tint_symbol { + float4 color_1 : SV_Target0; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {color}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.color_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.msl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.msl new file mode 100644 index 0000000000..8c9629d15c --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.msl @@ -0,0 +1,23 @@ +#include + +using namespace metal; +struct main_out { + float4 color_1; +}; +struct tint_symbol_1 { + float4 color_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_4) { + *(tint_symbol_4) = float4(1.0f, 1.0f, 1.0f, 1.0f); + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_5 = 0.0f; + main_1(&(tint_symbol_5)); + main_out const tint_symbol_2 = {.color_1=tint_symbol_5}; + tint_symbol_1 const tint_symbol_3 = {.color_1=tint_symbol_2.color_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.spvasm b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..7964ca830e --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.spvasm @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 + OpExecutionMode %main OriginUpperLeft + OpName %color "color" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %13 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main_out = OpTypeStruct %v4float + %14 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %8 + %11 = OpLabel + OpStore %color %13 + OpReturn + OpFunctionEnd +%tint_symbol_2 = OpFunction %void None %14 +%tint_symbol = OpFunctionParameter %main_out + %18 = OpLabel + %19 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %19 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %8 + %21 = OpLabel + %22 = OpFunctionCall %void %main_1 + %24 = OpLoad %v4float %color + %25 = OpCompositeConstruct %main_out %24 + %23 = OpFunctionCall %void %tint_symbol_2 %25 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.wgsl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..c1d101cf7b --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/0.wgsl.expected.wgsl @@ -0,0 +1,17 @@ +var color : vec4; + +fn main_1() { + color = vec4(1.0, 1.0, 1.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + color_1 : vec4; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color); +} diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm new file mode 100644 index 0000000000..5b5e77b6e1 --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm @@ -0,0 +1,39 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %texture "texture" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %color_out Location 0 + OpDecorate %texture DescriptorSet 0 + OpDecorate %texture Binding 0 + OpDecorate %texture NonWritable + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %11 = OpTypeImage %float 2D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %texture = OpVariable %_ptr_UniformConstant_11 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %main = OpFunction %void None %7 + %17 = OpLabel + %18 = OpLoad %11 %texture + %19 = OpLoad %v4float %gl_FragCoord + %20 = OpVectorShuffle %v2float %19 %19 0 1 + %21 = OpConvertFToS %v2int %20 + %22 = OpImageRead %v4float %18 %21 + OpStore %color_out %22 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.hlsl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..64748f3b42 --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.hlsl @@ -0,0 +1,29 @@ +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); +Texture2D tint_symbol : register(t0, space0); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_19 = gl_FragCoord; + const float4 x_22 = tint_symbol.Load(int3(float2(x_19.x, x_19.y), 0)); + color_out = x_22; + return; +} + +struct main_out { + float4 color_out_1; +}; +struct tint_symbol_2 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_3 { + float4 color_out_1 : SV_Target0; +}; + +tint_symbol_3 main(tint_symbol_2 tint_symbol_1) { + const float4 gl_FragCoord_param = tint_symbol_1.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {color_out}; + const tint_symbol_3 tint_symbol_5 = {tint_symbol_4.color_out_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.msl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.msl new file mode 100644 index 0000000000..43e2437494 --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; +}; +struct tint_symbol_3 { + float4 color_out_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, texture2d tint_symbol_7, thread float4* const tint_symbol_8) { + float4 const x_19 = *(tint_symbol_6); + float4 const x_22 = tint_symbol_7.read(uint2(int2(float2(x_19.x, x_19.y)))); + *(tint_symbol_8) = x_22; + return; +} + +fragment tint_symbol_3 tint_symbol_1(texture2d tint_symbol_10 [[texture(0)]], float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(&(tint_symbol_9), tint_symbol_10, &(tint_symbol_11)); + main_out const tint_symbol_4 = {.color_out_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.color_out_1=tint_symbol_4.color_out_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.spvasm b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..5055955dda --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %color_out "color_out" + OpName %texture "texture" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %texture NonWritable + OpDecorate %texture DescriptorSet 0 + OpDecorate %texture Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color_out = OpVariable %_ptr_Private_v4float Private %5 + %8 = OpTypeImage %float 2D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_8 = OpTypePointer UniformConstant %8 + %texture = OpVariable %_ptr_UniformConstant_8 UniformConstant +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v2float = OpTypeVector %float 2 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %gl_FragCoord + %20 = OpLoad %8 %texture + %25 = OpCompositeExtract %float %18 0 + %26 = OpCompositeExtract %float %18 1 + %27 = OpCompositeConstruct %v2float %25 %26 + %21 = OpConvertFToS %v2int %27 + %19 = OpImageRead %v4float %20 %21 + OpStore %color_out %19 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + %36 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %color_out + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.wgsl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..85b125f452 --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var color_out : vec4; + +[[group(0), binding(0)]] var texture : texture_storage_2d; + +var gl_FragCoord : vec4; + +fn main_1() { + let x_19 : vec4 = gl_FragCoord; + let x_22 : vec4 = textureLoad(texture, vec2(vec2(x_19.x, x_19.y))); + color_out = x_22; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(color_out); +} diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl new file mode 100644 index 0000000000..85b125f452 --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl @@ -0,0 +1,24 @@ +var color_out : vec4; + +[[group(0), binding(0)]] var texture : texture_storage_2d; + +var gl_FragCoord : vec4; + +fn main_1() { + let x_19 : vec4 = gl_FragCoord; + let x_22 : vec4 = textureLoad(texture, vec2(vec2(x_19.x, x_19.y))); + color_out = x_22; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(color_out); +} diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.hlsl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..64748f3b42 --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.hlsl @@ -0,0 +1,29 @@ +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); +Texture2D tint_symbol : register(t0, space0); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_19 = gl_FragCoord; + const float4 x_22 = tint_symbol.Load(int3(float2(x_19.x, x_19.y), 0)); + color_out = x_22; + return; +} + +struct main_out { + float4 color_out_1; +}; +struct tint_symbol_2 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_3 { + float4 color_out_1 : SV_Target0; +}; + +tint_symbol_3 main(tint_symbol_2 tint_symbol_1) { + const float4 gl_FragCoord_param = tint_symbol_1.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_4 = {color_out}; + const tint_symbol_3 tint_symbol_5 = {tint_symbol_4.color_out_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.msl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.msl new file mode 100644 index 0000000000..43e2437494 --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; +}; +struct tint_symbol_3 { + float4 color_out_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, texture2d tint_symbol_7, thread float4* const tint_symbol_8) { + float4 const x_19 = *(tint_symbol_6); + float4 const x_22 = tint_symbol_7.read(uint2(int2(float2(x_19.x, x_19.y)))); + *(tint_symbol_8) = x_22; + return; +} + +fragment tint_symbol_3 tint_symbol_1(texture2d tint_symbol_10 [[texture(0)]], float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_11 = 0.0f; + tint_symbol_9 = gl_FragCoord_param; + main_1(&(tint_symbol_9), tint_symbol_10, &(tint_symbol_11)); + main_out const tint_symbol_4 = {.color_out_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.color_out_1=tint_symbol_4.color_out_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.spvasm b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..5055955dda --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %color_out "color_out" + OpName %texture "texture" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %texture NonWritable + OpDecorate %texture DescriptorSet 0 + OpDecorate %texture Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color_out = OpVariable %_ptr_Private_v4float Private %5 + %8 = OpTypeImage %float 2D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_8 = OpTypePointer UniformConstant %8 + %texture = OpVariable %_ptr_UniformConstant_8 UniformConstant +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %v2float = OpTypeVector %float 2 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %gl_FragCoord + %20 = OpLoad %8 %texture + %25 = OpCompositeExtract %float %18 0 + %26 = OpCompositeExtract %float %18 1 + %27 = OpCompositeConstruct %v2float %25 %26 + %21 = OpConvertFToS %v2int %27 + %19 = OpImageRead %v4float %20 %21 + OpStore %color_out %19 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + %36 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %color_out + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.wgsl b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..85b125f452 --- /dev/null +++ b/test/vk-gl-cts/rasterization/line_continuity/line-strip/1.wgsl.expected.wgsl @@ -0,0 +1,24 @@ +var color_out : vec4; + +[[group(0), binding(0)]] var texture : texture_storage_2d; + +var gl_FragCoord : vec4; + +fn main_1() { + let x_19 : vec4 = gl_FragCoord; + let x_22 : vec4 = textureLoad(texture, vec2(vec2(x_19.x, x_19.y))); + color_out = x_22; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(color_out); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm new file mode 100644 index 0000000000..e24aea7653 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm @@ -0,0 +1,84 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource ESSL 320 + OpName %main "main" + OpName %Buf1 "Buf1" + OpMemberName %Buf1 0 "result" + OpName %_ "" + OpName %i "i" + OpName %Buf0 "Buf0" + OpMemberName %Buf0 0 "values" + OpName %__0 "" + OpMemberDecorate %Buf1 0 Offset 0 + OpDecorate %Buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %Buf0 0 Offset 0 + OpDecorate %Buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %11 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %Buf1 = OpTypeStruct %int +%_ptr_StorageBuffer_Buf1 = OpTypePointer StorageBuffer %Buf1 + %_ = OpVariable %_ptr_StorageBuffer_Buf1 StorageBuffer + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %uint_512 = OpConstant %uint 512 + %bool = OpTypeBool +%_runtimearr_uint = OpTypeRuntimeArray %uint + %Buf0 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_Buf0 = OpTypePointer StorageBuffer %Buf0 + %__0 = OpVariable %_ptr_StorageBuffer_Buf0 StorageBuffer + %uint_2 = OpConstant %uint 2 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %11 + %27 = OpLabel + %i = OpVariable %_ptr_Function_uint Function + %28 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 + OpStore %28 %int_1 + OpStore %i %uint_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %uint %i + %34 = OpULessThan %bool %33 %uint_512 + OpBranchConditional %34 %35 %30 + %35 = OpLabel + %36 = OpLoad %uint %i + %37 = OpIMul %uint %36 %uint_2 + %38 = OpAccessChain %_ptr_StorageBuffer_uint %__0 %int_0 %37 + %39 = OpLoad %uint %38 + %40 = OpLoad %uint %i + %41 = OpINotEqual %bool %39 %40 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + %44 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 + OpStore %44 %int_0 + OpBranch %42 + %42 = OpLabel + OpBranch %31 + %31 = OpLabel + %45 = OpLoad %uint %i + %46 = OpIAdd %uint %45 %int_1 + OpStore %i %46 + OpBranch %29 + %30 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..db86fa577a --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer x_4 : register(u1, space0); +RWByteAddressBuffer x_7 : register(u0, space0); + +void main_1() { + uint i = 0u; + x_4.Store(0u, asuint(1)); + i = 0u; + { + for(; (i < 512u); i = (i + asuint(1))) { + const uint x_39 = x_7.Load((4u * (i * 2u))); + if ((x_39 != i)) { + x_4.Store(0u, asuint(0)); + } + } + } + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.msl new file mode 100644 index 0000000000..1917c7a885 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +struct Buf1 { + /* 0x0000 */ int result; +}; +struct Buf0 { + /* 0x0000 */ uint values[1]; +}; + +void main_1(device Buf1& x_4, device Buf0& x_7) { + uint i = 0u; + x_4.result = 1; + i = 0u; + while (true) { + uint const x_33 = i; + if ((x_33 < 512u)) { + } else { + break; + } + uint const x_36 = i; + uint const x_39 = x_7.values[(x_36 * 2u)]; + uint const x_40 = i; + if ((x_39 != x_40)) { + x_4.result = 0; + } + { + uint const x_45 = i; + i = (x_45 + as_type(1)); + } + } + return; +} + +kernel void tint_symbol(device Buf1& x_4 [[buffer(1)]], device Buf0& x_7 [[buffer(0)]]) { + main_1(x_4, x_7); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..9b18e23e60 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %Buf1 "Buf1" + OpMemberName %Buf1 0 "result" + OpName %x_4 "x_4" + OpName %Buf0 "Buf0" + OpMemberName %Buf0 0 "values" + OpName %x_7 "x_7" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main "main" + OpDecorate %Buf1 Block + OpMemberDecorate %Buf1 0 Offset 0 + OpDecorate %x_4 DescriptorSet 0 + OpDecorate %x_4 Binding 1 + OpDecorate %Buf0 Block + OpMemberDecorate %Buf0 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + %int = OpTypeInt 32 1 + %Buf1 = OpTypeStruct %int +%_ptr_StorageBuffer_Buf1 = OpTypePointer StorageBuffer %Buf1 + %x_4 = OpVariable %_ptr_StorageBuffer_Buf1 StorageBuffer + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %Buf0 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_Buf0 = OpTypePointer StorageBuffer %Buf0 + %x_7 = OpVariable %_ptr_StorageBuffer_Buf0 StorageBuffer + %void = OpTypeVoid + %10 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %16 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 + %uint_512 = OpConstant %uint 512 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int_0 = OpConstant %int 0 + %main_1 = OpFunction %void None %10 + %13 = OpLabel + %i = OpVariable %_ptr_Function_uint Function %16 + %19 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_0 + OpStore %19 %int_1 + OpStore %i %uint_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %uint %i + %27 = OpULessThan %bool %25 %uint_512 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpBranch %29 + %31 = OpLabel + OpBranch %22 + %29 = OpLabel + %32 = OpLoad %uint %i + %34 = OpIMul %uint %32 %uint_2 + %36 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %34 + %37 = OpLoad %uint %36 + %38 = OpLoad %uint %i + %39 = OpINotEqual %bool %37 %38 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + %42 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_0 + OpStore %42 %int_0 + OpBranch %40 + %40 = OpLabel + OpBranch %23 + %23 = OpLabel + %44 = OpLoad %uint %i + %45 = OpBitcast %uint %int_1 + %46 = OpIAdd %uint %44 %45 + OpStore %i %46 + OpBranch %21 + %22 = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %10 + %48 = OpLabel + %49 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..8c7af0e65a --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.spvasm.expected.wgsl @@ -0,0 +1,45 @@ +[[block]] +struct Buf1 { + result : i32; +}; + +type RTArr = [[stride(4)]] array; + +[[block]] +struct Buf0 { + values : RTArr; +}; + +[[group(0), binding(1)]] var x_4 : Buf1; + +[[group(0), binding(0)]] var x_7 : Buf0; + +fn main_1() { + var i : u32; + x_4.result = 1; + i = 0u; + loop { + let x_33 : u32 = i; + if ((x_33 < 512u)) { + } else { + break; + } + let x_36 : u32 = i; + let x_39 : u32 = x_7.values[(x_36 * 2u)]; + let x_40 : u32 = i; + if ((x_39 != x_40)) { + x_4.result = 0; + } + + continuing { + let x_45 : u32 = i; + i = (x_45 + bitcast(1)); + } + } + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl new file mode 100644 index 0000000000..8c7af0e65a --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl @@ -0,0 +1,45 @@ +[[block]] +struct Buf1 { + result : i32; +}; + +type RTArr = [[stride(4)]] array; + +[[block]] +struct Buf0 { + values : RTArr; +}; + +[[group(0), binding(1)]] var x_4 : Buf1; + +[[group(0), binding(0)]] var x_7 : Buf0; + +fn main_1() { + var i : u32; + x_4.result = 1; + i = 0u; + loop { + let x_33 : u32 = i; + if ((x_33 < 512u)) { + } else { + break; + } + let x_36 : u32 = i; + let x_39 : u32 = x_7.values[(x_36 * 2u)]; + let x_40 : u32 = i; + if ((x_39 != x_40)) { + x_4.result = 0; + } + + continuing { + let x_45 : u32 = i; + i = (x_45 + bitcast(1)); + } + } + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..db86fa577a --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.hlsl @@ -0,0 +1,23 @@ +RWByteAddressBuffer x_4 : register(u1, space0); +RWByteAddressBuffer x_7 : register(u0, space0); + +void main_1() { + uint i = 0u; + x_4.Store(0u, asuint(1)); + i = 0u; + { + for(; (i < 512u); i = (i + asuint(1))) { + const uint x_39 = x_7.Load((4u * (i * 2u))); + if ((x_39 != i)) { + x_4.Store(0u, asuint(0)); + } + } + } + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.msl new file mode 100644 index 0000000000..1917c7a885 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +struct Buf1 { + /* 0x0000 */ int result; +}; +struct Buf0 { + /* 0x0000 */ uint values[1]; +}; + +void main_1(device Buf1& x_4, device Buf0& x_7) { + uint i = 0u; + x_4.result = 1; + i = 0u; + while (true) { + uint const x_33 = i; + if ((x_33 < 512u)) { + } else { + break; + } + uint const x_36 = i; + uint const x_39 = x_7.values[(x_36 * 2u)]; + uint const x_40 = i; + if ((x_39 != x_40)) { + x_4.result = 0; + } + { + uint const x_45 = i; + i = (x_45 + as_type(1)); + } + } + return; +} + +kernel void tint_symbol(device Buf1& x_4 [[buffer(1)]], device Buf0& x_7 [[buffer(0)]]) { + main_1(x_4, x_7); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..9b18e23e60 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.spvasm @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %Buf1 "Buf1" + OpMemberName %Buf1 0 "result" + OpName %x_4 "x_4" + OpName %Buf0 "Buf0" + OpMemberName %Buf0 0 "values" + OpName %x_7 "x_7" + OpName %main_1 "main_1" + OpName %i "i" + OpName %main "main" + OpDecorate %Buf1 Block + OpMemberDecorate %Buf1 0 Offset 0 + OpDecorate %x_4 DescriptorSet 0 + OpDecorate %x_4 Binding 1 + OpDecorate %Buf0 Block + OpMemberDecorate %Buf0 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 0 + %int = OpTypeInt 32 1 + %Buf1 = OpTypeStruct %int +%_ptr_StorageBuffer_Buf1 = OpTypePointer StorageBuffer %Buf1 + %x_4 = OpVariable %_ptr_StorageBuffer_Buf1 StorageBuffer + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %Buf0 = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_Buf0 = OpTypePointer StorageBuffer %Buf0 + %x_7 = OpVariable %_ptr_StorageBuffer_Buf0 StorageBuffer + %void = OpTypeVoid + %10 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %16 = OpConstantNull %uint + %uint_0 = OpConstant %uint 0 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_1 = OpConstant %int 1 + %uint_512 = OpConstant %uint 512 + %bool = OpTypeBool + %uint_2 = OpConstant %uint 2 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int_0 = OpConstant %int 0 + %main_1 = OpFunction %void None %10 + %13 = OpLabel + %i = OpVariable %_ptr_Function_uint Function %16 + %19 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_0 + OpStore %19 %int_1 + OpStore %i %uint_0 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %uint %i + %27 = OpULessThan %bool %25 %uint_512 + OpSelectionMerge %29 None + OpBranchConditional %27 %30 %31 + %30 = OpLabel + OpBranch %29 + %31 = OpLabel + OpBranch %22 + %29 = OpLabel + %32 = OpLoad %uint %i + %34 = OpIMul %uint %32 %uint_2 + %36 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %34 + %37 = OpLoad %uint %36 + %38 = OpLoad %uint %i + %39 = OpINotEqual %bool %37 %38 + OpSelectionMerge %40 None + OpBranchConditional %39 %41 %40 + %41 = OpLabel + %42 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_0 + OpStore %42 %int_0 + OpBranch %40 + %40 = OpLabel + OpBranch %23 + %23 = OpLabel + %44 = OpLoad %uint %i + %45 = OpBitcast %uint %int_1 + %46 = OpIAdd %uint %44 %45 + OpStore %i %46 + OpBranch %21 + %22 = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %10 + %48 = OpLabel + %49 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c7af0e65a --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/arraylength/array-stride-larger-than-element-size/1.wgsl.expected.wgsl @@ -0,0 +1,45 @@ +[[block]] +struct Buf1 { + result : i32; +}; + +type RTArr = [[stride(4)]] array; + +[[block]] +struct Buf0 { + values : RTArr; +}; + +[[group(0), binding(1)]] var x_4 : Buf1; + +[[group(0), binding(0)]] var x_7 : Buf0; + +fn main_1() { + var i : u32; + x_4.result = 1; + i = 0u; + loop { + let x_33 : u32 = i; + if ((x_33 < 512u)) { + } else { + break; + } + let x_36 : u32 = i; + let x_39 : u32 = x_7.values[(x_36 * 2u)]; + let x_40 : u32 = i; + if ((x_39 != x_40)) { + x_4.result = 0; + } + + continuing { + let x_45 : u32 = i; + i = (x_45 + bitcast(1)); + } + } + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm new file mode 100644 index 0000000000..cde9063683 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %gl_GlobalInvocationID + OpExecutionMode %1 LocalSize 1 1 1 + OpSource OpenCL_C 120 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %_struct_4 BufferBlock + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 1 + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 2 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_4 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %5 = OpVariable %_ptr_Uniform__struct_4 Uniform + %6 = OpVariable %_ptr_Uniform__struct_4 Uniform + %7 = OpVariable %_ptr_Uniform__struct_4 Uniform + %1 = OpFunction %void None %11 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %22 = OpAccessChain %_ptr_Uniform_uint %5 %uint_0 %21 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_Uniform_uint %6 %uint_0 %21 + %25 = OpLoad %uint %24 + %26 = OpSGreaterThan %bool %23 %25 + %27 = OpSelect %uint %26 %uint_1 %uint_0 + %28 = OpAccessChain %_ptr_Uniform_uint %7 %uint_0 %21 + OpStore %28 %27 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..666291eb07 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_2 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_5 : register(u0, space0); +RWByteAddressBuffer x_6 : register(u1, space0); +RWByteAddressBuffer x_7 : register(u2, space0); + +void main_1() { + const uint x_21 = x_2.x; + const uint x_23 = x_5.Load((4u * x_21)); + const uint x_25 = x_6.Load((4u * x_21)); + x_7.Store((4u * x_21), asuint(((asint(x_23) > asint(x_25)) ? 1u : 0u))); + return; +} + +struct tint_symbol_1 { + uint3 x_2_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_2_param = tint_symbol.x_2_param; + x_2 = x_2_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.msl new file mode 100644 index 0000000000..5a1dc97870 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_5, device S& x_6, device S& x_7, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_5.field0[x_21]; + uint const x_25 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (as_type(x_23) > as_type(x_25))); + return; +} + +kernel void tint_symbol(uint3 x_2_param [[thread_position_in_grid]], device S& x_5 [[buffer(0)]], device S& x_6 [[buffer(1)]], device S& x_7 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_2_param; + main_1(x_5, x_6, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..21ad2a6987 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_2 "x_2" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_2 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_2 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_5 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %29 = OpBitcast %int %24 + %31 = OpBitcast %int %26 + %32 = OpSGreaterThan %bool %29 %31 + %28 = OpSelect %uint %32 %uint_1 %uint_0 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %36 = OpLabel + %37 = OpLoad %v3uint %tint_symbol + OpStore %x_2 %37 + %38 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..b5c093a171 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_2.x; + let x_23 : u32 = x_5.field0[x_21]; + let x_25 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (bitcast(x_23) > bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl new file mode 100644 index 0000000000..b5c093a171 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_2.x; + let x_23 : u32 = x_5.field0[x_21]; + let x_25 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (bitcast(x_23) > bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..666291eb07 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_2 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_5 : register(u0, space0); +RWByteAddressBuffer x_6 : register(u1, space0); +RWByteAddressBuffer x_7 : register(u2, space0); + +void main_1() { + const uint x_21 = x_2.x; + const uint x_23 = x_5.Load((4u * x_21)); + const uint x_25 = x_6.Load((4u * x_21)); + x_7.Store((4u * x_21), asuint(((asint(x_23) > asint(x_25)) ? 1u : 0u))); + return; +} + +struct tint_symbol_1 { + uint3 x_2_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_2_param = tint_symbol.x_2_param; + x_2 = x_2_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.msl new file mode 100644 index 0000000000..5a1dc97870 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_5, device S& x_6, device S& x_7, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_5.field0[x_21]; + uint const x_25 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (as_type(x_23) > as_type(x_25))); + return; +} + +kernel void tint_symbol(uint3 x_2_param [[thread_position_in_grid]], device S& x_5 [[buffer(0)]], device S& x_6 [[buffer(1)]], device S& x_7 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_2_param; + main_1(x_5, x_6, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..21ad2a6987 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_2 "x_2" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_2 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_2 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_5 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %29 = OpBitcast %int %24 + %31 = OpBitcast %int %26 + %32 = OpSGreaterThan %bool %29 %31 + %28 = OpSelect %uint %32 %uint_1 %uint_0 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %36 = OpLabel + %37 = OpLoad %v3uint %tint_symbol + OpStore %x_2 %37 + %38 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..b5c093a171 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthan/0.wgsl.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_2.x; + let x_23 : u32 = x_5.field0[x_21]; + let x_25 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (bitcast(x_23) > bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm new file mode 100644 index 0000000000..1560001e7f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %gl_GlobalInvocationID + OpExecutionMode %1 LocalSize 1 1 1 + OpSource OpenCL_C 120 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %_struct_4 BufferBlock + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 1 + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 2 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_4 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %5 = OpVariable %_ptr_Uniform__struct_4 Uniform + %6 = OpVariable %_ptr_Uniform__struct_4 Uniform + %7 = OpVariable %_ptr_Uniform__struct_4 Uniform + %1 = OpFunction %void None %11 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %22 = OpAccessChain %_ptr_Uniform_uint %5 %uint_0 %21 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_Uniform_uint %6 %uint_0 %21 + %25 = OpLoad %uint %24 + %26 = OpSGreaterThanEqual %bool %23 %25 + %27 = OpSelect %uint %26 %uint_1 %uint_0 + %28 = OpAccessChain %_ptr_Uniform_uint %7 %uint_0 %21 + OpStore %28 %27 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..95f5645480 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_2 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_5 : register(u0, space0); +RWByteAddressBuffer x_6 : register(u1, space0); +RWByteAddressBuffer x_7 : register(u2, space0); + +void main_1() { + const uint x_21 = x_2.x; + const uint x_23 = x_5.Load((4u * x_21)); + const uint x_25 = x_6.Load((4u * x_21)); + x_7.Store((4u * x_21), asuint(((asint(x_23) >= asint(x_25)) ? 1u : 0u))); + return; +} + +struct tint_symbol_1 { + uint3 x_2_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_2_param = tint_symbol.x_2_param; + x_2 = x_2_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.msl new file mode 100644 index 0000000000..459deef2fe --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_5, device S& x_6, device S& x_7, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_5.field0[x_21]; + uint const x_25 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (as_type(x_23) >= as_type(x_25))); + return; +} + +kernel void tint_symbol(uint3 x_2_param [[thread_position_in_grid]], device S& x_5 [[buffer(0)]], device S& x_6 [[buffer(1)]], device S& x_7 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_2_param; + main_1(x_5, x_6, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..b55f16ecb7 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_2 "x_2" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_2 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_2 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_5 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %29 = OpBitcast %int %24 + %31 = OpBitcast %int %26 + %32 = OpSGreaterThanEqual %bool %29 %31 + %28 = OpSelect %uint %32 %uint_1 %uint_0 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %36 = OpLabel + %37 = OpLoad %v3uint %tint_symbol + OpStore %x_2 %37 + %38 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..4aba7acd90 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_2.x; + let x_23 : u32 = x_5.field0[x_21]; + let x_25 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (bitcast(x_23) >= bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl new file mode 100644 index 0000000000..4aba7acd90 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_2.x; + let x_23 : u32 = x_5.field0[x_21]; + let x_25 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (bitcast(x_23) >= bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..95f5645480 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_2 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_5 : register(u0, space0); +RWByteAddressBuffer x_6 : register(u1, space0); +RWByteAddressBuffer x_7 : register(u2, space0); + +void main_1() { + const uint x_21 = x_2.x; + const uint x_23 = x_5.Load((4u * x_21)); + const uint x_25 = x_6.Load((4u * x_21)); + x_7.Store((4u * x_21), asuint(((asint(x_23) >= asint(x_25)) ? 1u : 0u))); + return; +} + +struct tint_symbol_1 { + uint3 x_2_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_2_param = tint_symbol.x_2_param; + x_2 = x_2_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.msl new file mode 100644 index 0000000000..459deef2fe --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_5, device S& x_6, device S& x_7, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_5.field0[x_21]; + uint const x_25 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (as_type(x_23) >= as_type(x_25))); + return; +} + +kernel void tint_symbol(uint3 x_2_param [[thread_position_in_grid]], device S& x_5 [[buffer(0)]], device S& x_6 [[buffer(1)]], device S& x_7 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_2_param; + main_1(x_5, x_6, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..b55f16ecb7 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_2 "x_2" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_2 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_2 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_5 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %29 = OpBitcast %int %24 + %31 = OpBitcast %int %26 + %32 = OpSGreaterThanEqual %bool %29 %31 + %28 = OpSelect %uint %32 %uint_1 %uint_0 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %36 = OpLabel + %37 = OpLoad %v3uint %tint_symbol + OpStore %x_2 %37 + %38 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..4aba7acd90 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_sgreaterthanequal/0.wgsl.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_2.x; + let x_23 : u32 = x_5.field0[x_21]; + let x_25 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (bitcast(x_23) >= bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm new file mode 100644 index 0000000000..6c13257f50 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %gl_GlobalInvocationID + OpExecutionMode %1 LocalSize 1 1 1 + OpSource OpenCL_C 120 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %_struct_4 BufferBlock + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 1 + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 2 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_4 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %5 = OpVariable %_ptr_Uniform__struct_4 Uniform + %6 = OpVariable %_ptr_Uniform__struct_4 Uniform + %7 = OpVariable %_ptr_Uniform__struct_4 Uniform + %1 = OpFunction %void None %11 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %22 = OpAccessChain %_ptr_Uniform_uint %5 %uint_0 %21 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_Uniform_uint %6 %uint_0 %21 + %25 = OpLoad %uint %24 + %26 = OpSLessThan %bool %23 %25 + %27 = OpSelect %uint %26 %uint_1 %uint_0 + %28 = OpAccessChain %_ptr_Uniform_uint %7 %uint_0 %21 + OpStore %28 %27 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..03594c8f46 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_2 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_5 : register(u0, space0); +RWByteAddressBuffer x_6 : register(u1, space0); +RWByteAddressBuffer x_7 : register(u2, space0); + +void main_1() { + const uint x_21 = x_2.x; + const uint x_23 = x_5.Load((4u * x_21)); + const uint x_25 = x_6.Load((4u * x_21)); + x_7.Store((4u * x_21), asuint(((asint(x_23) < asint(x_25)) ? 1u : 0u))); + return; +} + +struct tint_symbol_1 { + uint3 x_2_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_2_param = tint_symbol.x_2_param; + x_2 = x_2_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.msl new file mode 100644 index 0000000000..169d49e21e --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_5, device S& x_6, device S& x_7, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_5.field0[x_21]; + uint const x_25 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (as_type(x_23) < as_type(x_25))); + return; +} + +kernel void tint_symbol(uint3 x_2_param [[thread_position_in_grid]], device S& x_5 [[buffer(0)]], device S& x_6 [[buffer(1)]], device S& x_7 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_2_param; + main_1(x_5, x_6, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..19b5307337 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_2 "x_2" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_2 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_2 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_5 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %29 = OpBitcast %int %24 + %31 = OpBitcast %int %26 + %32 = OpSLessThan %bool %29 %31 + %28 = OpSelect %uint %32 %uint_1 %uint_0 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %36 = OpLabel + %37 = OpLoad %v3uint %tint_symbol + OpStore %x_2 %37 + %38 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..c8fe7077d8 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_2.x; + let x_23 : u32 = x_5.field0[x_21]; + let x_25 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (bitcast(x_23) < bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl new file mode 100644 index 0000000000..c8fe7077d8 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_2.x; + let x_23 : u32 = x_5.field0[x_21]; + let x_25 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (bitcast(x_23) < bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..03594c8f46 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_2 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_5 : register(u0, space0); +RWByteAddressBuffer x_6 : register(u1, space0); +RWByteAddressBuffer x_7 : register(u2, space0); + +void main_1() { + const uint x_21 = x_2.x; + const uint x_23 = x_5.Load((4u * x_21)); + const uint x_25 = x_6.Load((4u * x_21)); + x_7.Store((4u * x_21), asuint(((asint(x_23) < asint(x_25)) ? 1u : 0u))); + return; +} + +struct tint_symbol_1 { + uint3 x_2_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_2_param = tint_symbol.x_2_param; + x_2 = x_2_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.msl new file mode 100644 index 0000000000..169d49e21e --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_5, device S& x_6, device S& x_7, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_5.field0[x_21]; + uint const x_25 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (as_type(x_23) < as_type(x_25))); + return; +} + +kernel void tint_symbol(uint3 x_2_param [[thread_position_in_grid]], device S& x_5 [[buffer(0)]], device S& x_6 [[buffer(1)]], device S& x_7 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_2_param; + main_1(x_5, x_6, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..19b5307337 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_2 "x_2" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_2 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_2 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_5 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %29 = OpBitcast %int %24 + %31 = OpBitcast %int %26 + %32 = OpSLessThan %bool %29 %31 + %28 = OpSelect %uint %32 %uint_1 %uint_0 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %36 = OpLabel + %37 = OpLoad %v3uint %tint_symbol + OpStore %x_2 %37 + %38 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..c8fe7077d8 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthan/0.wgsl.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_2.x; + let x_23 : u32 = x_5.field0[x_21]; + let x_25 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (bitcast(x_23) < bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm new file mode 100644 index 0000000000..e38823e3fe --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %gl_GlobalInvocationID + OpExecutionMode %1 LocalSize 1 1 1 + OpSource OpenCL_C 120 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %_struct_4 BufferBlock + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 1 + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 2 + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_4 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %5 = OpVariable %_ptr_Uniform__struct_4 Uniform + %6 = OpVariable %_ptr_Uniform__struct_4 Uniform + %7 = OpVariable %_ptr_Uniform__struct_4 Uniform + %1 = OpFunction %void None %11 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %22 = OpAccessChain %_ptr_Uniform_uint %5 %uint_0 %21 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_Uniform_uint %6 %uint_0 %21 + %25 = OpLoad %uint %24 + %26 = OpSLessThanEqual %bool %23 %25 + %27 = OpSelect %uint %26 %uint_1 %uint_0 + %28 = OpAccessChain %_ptr_Uniform_uint %7 %uint_0 %21 + OpStore %28 %27 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..65e9ee6005 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_2 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_5 : register(u0, space0); +RWByteAddressBuffer x_6 : register(u1, space0); +RWByteAddressBuffer x_7 : register(u2, space0); + +void main_1() { + const uint x_21 = x_2.x; + const uint x_23 = x_5.Load((4u * x_21)); + const uint x_25 = x_6.Load((4u * x_21)); + x_7.Store((4u * x_21), asuint(((asint(x_23) <= asint(x_25)) ? 1u : 0u))); + return; +} + +struct tint_symbol_1 { + uint3 x_2_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_2_param = tint_symbol.x_2_param; + x_2 = x_2_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.msl new file mode 100644 index 0000000000..7ae0315e4e --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_5, device S& x_6, device S& x_7, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_5.field0[x_21]; + uint const x_25 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (as_type(x_23) <= as_type(x_25))); + return; +} + +kernel void tint_symbol(uint3 x_2_param [[thread_position_in_grid]], device S& x_5 [[buffer(0)]], device S& x_6 [[buffer(1)]], device S& x_7 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_2_param; + main_1(x_5, x_6, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..830ac7dba3 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_2 "x_2" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_2 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_2 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_5 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %29 = OpBitcast %int %24 + %31 = OpBitcast %int %26 + %32 = OpSLessThanEqual %bool %29 %31 + %28 = OpSelect %uint %32 %uint_1 %uint_0 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %36 = OpLabel + %37 = OpLoad %v3uint %tint_symbol + OpStore %x_2 %37 + %38 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..a8c97bf7e6 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_2.x; + let x_23 : u32 = x_5.field0[x_21]; + let x_25 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (bitcast(x_23) <= bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl new file mode 100644 index 0000000000..a8c97bf7e6 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_2.x; + let x_23 : u32 = x_5.field0[x_21]; + let x_25 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (bitcast(x_23) <= bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..65e9ee6005 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_2 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_5 : register(u0, space0); +RWByteAddressBuffer x_6 : register(u1, space0); +RWByteAddressBuffer x_7 : register(u2, space0); + +void main_1() { + const uint x_21 = x_2.x; + const uint x_23 = x_5.Load((4u * x_21)); + const uint x_25 = x_6.Load((4u * x_21)); + x_7.Store((4u * x_21), asuint(((asint(x_23) <= asint(x_25)) ? 1u : 0u))); + return; +} + +struct tint_symbol_1 { + uint3 x_2_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_2_param = tint_symbol.x_2_param; + x_2 = x_2_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.msl new file mode 100644 index 0000000000..7ae0315e4e --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_5, device S& x_6, device S& x_7, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_5.field0[x_21]; + uint const x_25 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (as_type(x_23) <= as_type(x_25))); + return; +} + +kernel void tint_symbol(uint3 x_2_param [[thread_position_in_grid]], device S& x_5 [[buffer(0)]], device S& x_6 [[buffer(1)]], device S& x_7 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_2_param; + main_1(x_5, x_6, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..830ac7dba3 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_2 "x_2" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_2 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_2 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_5 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %29 = OpBitcast %int %24 + %31 = OpBitcast %int %26 + %32 = OpSLessThanEqual %bool %29 %31 + %28 = OpSelect %uint %32 %uint_1 %uint_0 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %36 = OpLabel + %37 = OpLoad %v3uint %tint_symbol + OpStore %x_2 %37 + %38 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..a8c97bf7e6 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_int_compare/uint_slessthanequal/0.wgsl.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_2.x; + let x_23 : u32 = x_5.field0[x_21]; + let x_25 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = select(0u, 1u, (bitcast(x_23) <= bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm new file mode 100644 index 0000000000..0e25dbbe13 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm @@ -0,0 +1,53 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %gl_GlobalInvocationID + OpExecutionMode %2 LocalSize 1 1 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %_struct_5 BufferBlock + OpMemberDecorate %_struct_5 0 Offset 0 + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 0 + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 1 + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 2 + OpDecorate %9 DescriptorSet 0 + OpDecorate %9 Binding 3 + %uint = OpTypeInt 32 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %void = OpTypeVoid + %16 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %v4int = OpTypeVector %int 4 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Uniform_int = OpTypePointer Uniform %int + %_struct_5 = OpTypeStruct %_runtimearr_int +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %6 = OpVariable %_ptr_Uniform__struct_5 Uniform + %7 = OpVariable %_ptr_Uniform__struct_5 Uniform + %8 = OpVariable %_ptr_Uniform__struct_5 Uniform + %9 = OpVariable %_ptr_Uniform__struct_5 Uniform + %2 = OpFunction %void None %16 + %24 = OpLabel + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_Uniform_int %6 %uint_0 %26 + %28 = OpLoad %int %27 + %29 = OpAccessChain %_ptr_Uniform_int %7 %uint_0 %26 + %30 = OpLoad %int %29 + %31 = OpAccessChain %_ptr_Uniform_int %8 %uint_0 %26 + %32 = OpLoad %int %31 + %33 = OpExtInst %int %1 UClamp %28 %30 %32 + %34 = OpAccessChain %_ptr_Uniform_int %9 %uint_0 %26 + OpStore %34 %33 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..09ae3b9ddd --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,26 @@ +static uint3 x_3 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_6 : register(u0, space0); +RWByteAddressBuffer x_7 : register(u1, space0); +RWByteAddressBuffer x_8 : register(u2, space0); +RWByteAddressBuffer x_9 : register(u3, space0); + +void main_1() { + const uint x_26 = x_3.x; + const int x_28 = asint(x_6.Load((4u * x_26))); + const int x_30 = asint(x_7.Load((4u * x_26))); + const int x_32 = asint(x_8.Load((4u * x_26))); + x_9.Store((4u * x_26), asuint(asint(clamp(asuint(x_28), asuint(x_30), asuint(x_32))))); + return; +} + +struct tint_symbol_1 { + uint3 x_3_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_3_param = tint_symbol.x_3_param; + x_3 = x_3_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..ef9ae4b503 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ int field0[1]; +}; + +void main_1(device S& x_6, device S& x_7, device S& x_8, device S& x_9, thread uint3* const tint_symbol_2) { + uint const x_26 = (*(tint_symbol_2)).x; + int const x_28 = x_6.field0[x_26]; + int const x_30 = x_7.field0[x_26]; + int const x_32 = x_8.field0[x_26]; + x_9.field0[x_26] = as_type(clamp(as_type(x_28), as_type(x_30), as_type(x_32))); + return; +} + +kernel void tint_symbol(uint3 x_3_param [[thread_position_in_grid]], device S& x_6 [[buffer(0)]], device S& x_7 [[buffer(1)]], device S& x_8 [[buffer(2)]], device S& x_9 [[buffer(3)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_3_param; + main_1(x_6, x_7, x_8, x_9, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2f44746ca2 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %34 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_3 "x_3" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %x_8 "x_8" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 3 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_3 = OpVariable %_ptr_Private_v3uint Private %5 + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %S = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_8 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_9 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %16 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %main_1 = OpFunction %void None %16 + %19 = OpLabel + %22 = OpAccessChain %_ptr_Private_uint %x_3 %uint_0 + %23 = OpLoad %uint %22 + %25 = OpAccessChain %_ptr_StorageBuffer_int %x_6 %uint_0 %23 + %26 = OpLoad %int %25 + %27 = OpAccessChain %_ptr_StorageBuffer_int %x_7 %uint_0 %23 + %28 = OpLoad %int %27 + %29 = OpAccessChain %_ptr_StorageBuffer_int %x_8 %uint_0 %23 + %30 = OpLoad %int %29 + %31 = OpAccessChain %_ptr_StorageBuffer_int %x_9 %uint_0 %23 + %35 = OpBitcast %uint %26 + %36 = OpBitcast %uint %28 + %37 = OpBitcast %uint %30 + %33 = OpExtInst %uint %34 UClamp %35 %36 %37 + %32 = OpBitcast %int %33 + OpStore %31 %32 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %16 + %39 = OpLabel + %40 = OpLoad %v3uint %tint_symbol + OpStore %x_3 %40 + %41 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..d03857bb09 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,31 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +[[group(0), binding(2)]] var x_8 : S; + +[[group(0), binding(3)]] var x_9 : S; + +fn main_1() { + let x_26 : u32 = x_3.x; + let x_28 : i32 = x_6.field0[x_26]; + let x_30 : i32 = x_7.field0[x_26]; + let x_32 : i32 = x_8.field0[x_26]; + x_9.field0[x_26] = bitcast(clamp(bitcast(x_28), bitcast(x_30), bitcast(x_32))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl new file mode 100644 index 0000000000..d03857bb09 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl @@ -0,0 +1,31 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +[[group(0), binding(2)]] var x_8 : S; + +[[group(0), binding(3)]] var x_9 : S; + +fn main_1() { + let x_26 : u32 = x_3.x; + let x_28 : i32 = x_6.field0[x_26]; + let x_30 : i32 = x_7.field0[x_26]; + let x_32 : i32 = x_8.field0[x_26]; + x_9.field0[x_26] = bitcast(clamp(bitcast(x_28), bitcast(x_30), bitcast(x_32))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..09ae3b9ddd --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +static uint3 x_3 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_6 : register(u0, space0); +RWByteAddressBuffer x_7 : register(u1, space0); +RWByteAddressBuffer x_8 : register(u2, space0); +RWByteAddressBuffer x_9 : register(u3, space0); + +void main_1() { + const uint x_26 = x_3.x; + const int x_28 = asint(x_6.Load((4u * x_26))); + const int x_30 = asint(x_7.Load((4u * x_26))); + const int x_32 = asint(x_8.Load((4u * x_26))); + x_9.Store((4u * x_26), asuint(asint(clamp(asuint(x_28), asuint(x_30), asuint(x_32))))); + return; +} + +struct tint_symbol_1 { + uint3 x_3_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_3_param = tint_symbol.x_3_param; + x_3 = x_3_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..ef9ae4b503 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.msl @@ -0,0 +1,23 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ int field0[1]; +}; + +void main_1(device S& x_6, device S& x_7, device S& x_8, device S& x_9, thread uint3* const tint_symbol_2) { + uint const x_26 = (*(tint_symbol_2)).x; + int const x_28 = x_6.field0[x_26]; + int const x_30 = x_7.field0[x_26]; + int const x_32 = x_8.field0[x_26]; + x_9.field0[x_26] = as_type(clamp(as_type(x_28), as_type(x_30), as_type(x_32))); + return; +} + +kernel void tint_symbol(uint3 x_3_param [[thread_position_in_grid]], device S& x_6 [[buffer(0)]], device S& x_7 [[buffer(1)]], device S& x_8 [[buffer(2)]], device S& x_9 [[buffer(3)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_3_param; + main_1(x_6, x_7, x_8, x_9, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2f44746ca2 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %34 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_3 "x_3" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %x_8 "x_8" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 3 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_3 = OpVariable %_ptr_Private_v3uint Private %5 + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %S = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_8 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_9 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %16 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %main_1 = OpFunction %void None %16 + %19 = OpLabel + %22 = OpAccessChain %_ptr_Private_uint %x_3 %uint_0 + %23 = OpLoad %uint %22 + %25 = OpAccessChain %_ptr_StorageBuffer_int %x_6 %uint_0 %23 + %26 = OpLoad %int %25 + %27 = OpAccessChain %_ptr_StorageBuffer_int %x_7 %uint_0 %23 + %28 = OpLoad %int %27 + %29 = OpAccessChain %_ptr_StorageBuffer_int %x_8 %uint_0 %23 + %30 = OpLoad %int %29 + %31 = OpAccessChain %_ptr_StorageBuffer_int %x_9 %uint_0 %23 + %35 = OpBitcast %uint %26 + %36 = OpBitcast %uint %28 + %37 = OpBitcast %uint %30 + %33 = OpExtInst %uint %34 UClamp %35 %36 %37 + %32 = OpBitcast %int %33 + OpStore %31 %32 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %16 + %39 = OpLabel + %40 = OpLoad %v3uint %tint_symbol + OpStore %x_3 %40 + %41 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..d03857bb09 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_int_uclamp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,31 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +[[group(0), binding(2)]] var x_8 : S; + +[[group(0), binding(3)]] var x_9 : S; + +fn main_1() { + let x_26 : u32 = x_3.x; + let x_28 : i32 = x_6.field0[x_26]; + let x_30 : i32 = x_7.field0[x_26]; + let x_32 : i32 = x_8.field0[x_26]; + x_9.field0[x_26] = bitcast(clamp(bitcast(x_28), bitcast(x_30), bitcast(x_32))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm new file mode 100644 index 0000000000..9da709ee50 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm @@ -0,0 +1,40 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %gl_GlobalInvocationID + OpExecutionMode %2 LocalSize 1 1 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %_struct_5 BufferBlock + OpMemberDecorate %_struct_5 0 Offset 0 + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 0 + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 1 + %uint = OpTypeInt 32 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %v2uint = OpTypeVector %uint 2 + %_struct_5 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %6 = OpVariable %_ptr_Uniform__struct_5 Uniform + %7 = OpVariable %_ptr_Uniform__struct_5 Uniform + %2 = OpFunction %void None %14 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %22 = OpAccessChain %_ptr_Uniform_uint %6 %uint_0 %21 + %23 = OpLoad %uint %22 + %24 = OpExtInst %uint %1 SAbs %23 + %25 = OpAccessChain %_ptr_Uniform_uint %7 %uint_0 %21 + OpStore %25 %24 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..fd7b050fae --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.hlsl @@ -0,0 +1,22 @@ +static uint3 x_3 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_6 : register(u0, space0); +RWByteAddressBuffer x_7 : register(u1, space0); + +void main_1() { + const uint x_21 = x_3.x; + const uint x_23 = x_6.Load((4u * x_21)); + x_7.Store((4u * x_21), asuint(asuint(abs(asint(x_23))))); + return; +} + +struct tint_symbol_1 { + uint3 x_3_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_3_param = tint_symbol.x_3_param; + x_3 = x_3_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..dd60856f81 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_6, device S& x_7, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_6.field0[x_21]; + x_7.field0[x_21] = as_type(abs(as_type(x_23))); + return; +} + +kernel void tint_symbol(uint3 x_3_param [[thread_position_in_grid]], device S& x_6 [[buffer(0)]], device S& x_7 [[buffer(1)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_3_param; + main_1(x_6, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..866a110745 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %28 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_3 "x_3" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_3 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %13 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %main_1 = OpFunction %void None %13 + %16 = OpLabel + %19 = OpAccessChain %_ptr_Private_uint %x_3 %uint_0 + %20 = OpLoad %uint %19 + %22 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %20 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %20 + %29 = OpBitcast %int %23 + %26 = OpExtInst %int %28 SAbs %29 + %25 = OpBitcast %uint %26 + OpStore %24 %25 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpLoad %v3uint %tint_symbol + OpStore %x_3 %32 + %33 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..52b153293f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_3.x; + let x_23 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = bitcast(abs(bitcast(x_23))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl new file mode 100644 index 0000000000..52b153293f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl @@ -0,0 +1,25 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_3.x; + let x_23 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = bitcast(abs(bitcast(x_23))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..fd7b050fae --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.hlsl @@ -0,0 +1,22 @@ +static uint3 x_3 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_6 : register(u0, space0); +RWByteAddressBuffer x_7 : register(u1, space0); + +void main_1() { + const uint x_21 = x_3.x; + const uint x_23 = x_6.Load((4u * x_21)); + x_7.Store((4u * x_21), asuint(asuint(abs(asint(x_23))))); + return; +} + +struct tint_symbol_1 { + uint3 x_3_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_3_param = tint_symbol.x_3_param; + x_3 = x_3_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..dd60856f81 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_6, device S& x_7, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_6.field0[x_21]; + x_7.field0[x_21] = as_type(abs(as_type(x_23))); + return; +} + +kernel void tint_symbol(uint3 x_3_param [[thread_position_in_grid]], device S& x_6 [[buffer(0)]], device S& x_7 [[buffer(1)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_3_param; + main_1(x_6, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..866a110745 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %28 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_3 "x_3" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_3 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %13 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %main_1 = OpFunction %void None %13 + %16 = OpLabel + %19 = OpAccessChain %_ptr_Private_uint %x_3 %uint_0 + %20 = OpLoad %uint %19 + %22 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %20 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %20 + %29 = OpBitcast %int %23 + %26 = OpExtInst %int %28 SAbs %29 + %25 = OpBitcast %uint %26 + OpStore %24 %25 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %31 = OpLabel + %32 = OpLoad %v3uint %tint_symbol + OpStore %x_3 %32 + %33 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..52b153293f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sabs/0-opt.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +fn main_1() { + let x_21 : u32 = x_3.x; + let x_23 : u32 = x_6.field0[x_21]; + x_7.field0[x_21] = bitcast(abs(bitcast(x_23))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm new file mode 100644 index 0000000000..9b588f9f24 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm @@ -0,0 +1,50 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %gl_GlobalInvocationID + OpExecutionMode %2 LocalSize 1 1 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %_struct_5 BufferBlock + OpMemberDecorate %_struct_5 0 Offset 0 + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 0 + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 1 + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 2 + OpDecorate %9 DescriptorSet 0 + OpDecorate %9 Binding 3 + %uint = OpTypeInt 32 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %void = OpTypeVoid + %16 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %v4uint = OpTypeVector %uint 4 + %_struct_5 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %6 = OpVariable %_ptr_Uniform__struct_5 Uniform + %7 = OpVariable %_ptr_Uniform__struct_5 Uniform + %8 = OpVariable %_ptr_Uniform__struct_5 Uniform + %9 = OpVariable %_ptr_Uniform__struct_5 Uniform + %2 = OpFunction %void None %16 + %21 = OpLabel + %22 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_Uniform_uint %6 %uint_0 %23 + %25 = OpLoad %uint %24 + %26 = OpAccessChain %_ptr_Uniform_uint %7 %uint_0 %23 + %27 = OpLoad %uint %26 + %28 = OpAccessChain %_ptr_Uniform_uint %8 %uint_0 %23 + %29 = OpLoad %uint %28 + %30 = OpExtInst %uint %1 SClamp %25 %27 %29 + %31 = OpAccessChain %_ptr_Uniform_uint %9 %uint_0 %23 + OpStore %31 %30 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..55f55f52d4 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.hlsl @@ -0,0 +1,26 @@ +static uint3 x_3 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_6 : register(u0, space0); +RWByteAddressBuffer x_7 : register(u1, space0); +RWByteAddressBuffer x_8 : register(u2, space0); +RWByteAddressBuffer x_9 : register(u3, space0); + +void main_1() { + const uint x_23 = x_3.x; + const uint x_25 = x_6.Load((4u * x_23)); + const uint x_27 = x_7.Load((4u * x_23)); + const uint x_29 = x_8.Load((4u * x_23)); + x_9.Store((4u * x_23), asuint(asuint(clamp(asint(x_25), asint(x_27), asint(x_29))))); + return; +} + +struct tint_symbol_1 { + uint3 x_3_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_3_param = tint_symbol.x_3_param; + x_3 = x_3_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f8e42e1abf --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_6, device S& x_7, device S& x_8, device S& x_9, thread uint3* const tint_symbol_2) { + uint const x_23 = (*(tint_symbol_2)).x; + uint const x_25 = x_6.field0[x_23]; + uint const x_27 = x_7.field0[x_23]; + uint const x_29 = x_8.field0[x_23]; + x_9.field0[x_23] = as_type(clamp(as_type(x_25), as_type(x_27), as_type(x_29))); + return; +} + +kernel void tint_symbol(uint3 x_3_param [[thread_position_in_grid]], device S& x_6 [[buffer(0)]], device S& x_7 [[buffer(1)]], device S& x_8 [[buffer(2)]], device S& x_9 [[buffer(3)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_3_param; + main_1(x_6, x_7, x_8, x_9, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..35000efc3e --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %34 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_3 "x_3" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %x_8 "x_8" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 3 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_3 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_8 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_9 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Private_uint %x_3 %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %22 + %25 = OpLoad %uint %24 + %26 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %22 + %27 = OpLoad %uint %26 + %28 = OpAccessChain %_ptr_StorageBuffer_uint %x_8 %uint_0 %22 + %29 = OpLoad %uint %28 + %30 = OpAccessChain %_ptr_StorageBuffer_uint %x_9 %uint_0 %22 + %35 = OpBitcast %int %25 + %36 = OpBitcast %int %27 + %37 = OpBitcast %int %29 + %32 = OpExtInst %int %34 SClamp %35 %36 %37 + %31 = OpBitcast %uint %32 + OpStore %30 %31 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %39 = OpLabel + %40 = OpLoad %v3uint %tint_symbol + OpStore %x_3 %40 + %41 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..e58290301c --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.spvasm.expected.wgsl @@ -0,0 +1,31 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +[[group(0), binding(2)]] var x_8 : S; + +[[group(0), binding(3)]] var x_9 : S; + +fn main_1() { + let x_23 : u32 = x_3.x; + let x_25 : u32 = x_6.field0[x_23]; + let x_27 : u32 = x_7.field0[x_23]; + let x_29 : u32 = x_8.field0[x_23]; + x_9.field0[x_23] = bitcast(clamp(bitcast(x_25), bitcast(x_27), bitcast(x_29))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl new file mode 100644 index 0000000000..e58290301c --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl @@ -0,0 +1,31 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +[[group(0), binding(2)]] var x_8 : S; + +[[group(0), binding(3)]] var x_9 : S; + +fn main_1() { + let x_23 : u32 = x_3.x; + let x_25 : u32 = x_6.field0[x_23]; + let x_27 : u32 = x_7.field0[x_23]; + let x_29 : u32 = x_8.field0[x_23]; + x_9.field0[x_23] = bitcast(clamp(bitcast(x_25), bitcast(x_27), bitcast(x_29))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..55f55f52d4 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +static uint3 x_3 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_6 : register(u0, space0); +RWByteAddressBuffer x_7 : register(u1, space0); +RWByteAddressBuffer x_8 : register(u2, space0); +RWByteAddressBuffer x_9 : register(u3, space0); + +void main_1() { + const uint x_23 = x_3.x; + const uint x_25 = x_6.Load((4u * x_23)); + const uint x_27 = x_7.Load((4u * x_23)); + const uint x_29 = x_8.Load((4u * x_23)); + x_9.Store((4u * x_23), asuint(asuint(clamp(asint(x_25), asint(x_27), asint(x_29))))); + return; +} + +struct tint_symbol_1 { + uint3 x_3_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_3_param = tint_symbol.x_3_param; + x_3 = x_3_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f8e42e1abf --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.msl @@ -0,0 +1,23 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_6, device S& x_7, device S& x_8, device S& x_9, thread uint3* const tint_symbol_2) { + uint const x_23 = (*(tint_symbol_2)).x; + uint const x_25 = x_6.field0[x_23]; + uint const x_27 = x_7.field0[x_23]; + uint const x_29 = x_8.field0[x_23]; + x_9.field0[x_23] = as_type(clamp(as_type(x_25), as_type(x_27), as_type(x_29))); + return; +} + +kernel void tint_symbol(uint3 x_3_param [[thread_position_in_grid]], device S& x_6 [[buffer(0)]], device S& x_7 [[buffer(1)]], device S& x_8 [[buffer(2)]], device S& x_9 [[buffer(3)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_3_param; + main_1(x_6, x_7, x_8, x_9, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..35000efc3e --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.spvasm @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %34 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_3 "x_3" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %x_8 "x_8" + OpName %x_9 "x_9" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %x_9 DescriptorSet 0 + OpDecorate %x_9 Binding 3 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_3 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_8 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_9 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %main_1 = OpFunction %void None %15 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Private_uint %x_3 %uint_0 + %22 = OpLoad %uint %21 + %24 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %22 + %25 = OpLoad %uint %24 + %26 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %22 + %27 = OpLoad %uint %26 + %28 = OpAccessChain %_ptr_StorageBuffer_uint %x_8 %uint_0 %22 + %29 = OpLoad %uint %28 + %30 = OpAccessChain %_ptr_StorageBuffer_uint %x_9 %uint_0 %22 + %35 = OpBitcast %int %25 + %36 = OpBitcast %int %27 + %37 = OpBitcast %int %29 + %32 = OpExtInst %int %34 SClamp %35 %36 %37 + %31 = OpBitcast %uint %32 + OpStore %30 %31 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %15 + %39 = OpLabel + %40 = OpLoad %v3uint %tint_symbol + OpStore %x_3 %40 + %41 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..e58290301c --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_sclamp/0-opt.wgsl.expected.wgsl @@ -0,0 +1,31 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +[[group(0), binding(2)]] var x_8 : S; + +[[group(0), binding(3)]] var x_9 : S; + +fn main_1() { + let x_23 : u32 = x_3.x; + let x_25 : u32 = x_6.field0[x_23]; + let x_27 : u32 = x_7.field0[x_23]; + let x_29 : u32 = x_8.field0[x_23]; + x_9.field0[x_23] = bitcast(clamp(bitcast(x_25), bitcast(x_27), bitcast(x_29))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm new file mode 100644 index 0000000000..e472f013dc --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm @@ -0,0 +1,44 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %gl_GlobalInvocationID + OpExecutionMode %2 LocalSize 1 1 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %_struct_5 BufferBlock + OpMemberDecorate %_struct_5 0 Offset 0 + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 0 + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 1 + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 2 + %uint = OpTypeInt 32 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_5 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %6 = OpVariable %_ptr_Uniform__struct_5 Uniform + %7 = OpVariable %_ptr_Uniform__struct_5 Uniform + %8 = OpVariable %_ptr_Uniform__struct_5 Uniform + %2 = OpFunction %void None %15 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %22 = OpAccessChain %_ptr_Uniform_uint %6 %uint_0 %21 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_Uniform_uint %7 %uint_0 %21 + %25 = OpLoad %uint %24 + %26 = OpExtInst %uint %1 SMax %23 %25 + %27 = OpAccessChain %_ptr_Uniform_uint %8 %uint_0 %21 + OpStore %27 %26 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..31dbd68538 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_3 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_6 : register(u0, space0); +RWByteAddressBuffer x_7 : register(u1, space0); +RWByteAddressBuffer x_8 : register(u2, space0); + +void main_1() { + const uint x_21 = x_3.x; + const uint x_23 = x_6.Load((4u * x_21)); + const uint x_25 = x_7.Load((4u * x_21)); + x_8.Store((4u * x_21), asuint(asuint(max(asint(x_23), asint(x_25))))); + return; +} + +struct tint_symbol_1 { + uint3 x_3_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_3_param = tint_symbol.x_3_param; + x_3 = x_3_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d2e3922aac --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_6, device S& x_7, device S& x_8, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_6.field0[x_21]; + uint const x_25 = x_7.field0[x_21]; + x_8.field0[x_21] = as_type(max(as_type(x_23), as_type(x_25))); + return; +} + +kernel void tint_symbol(uint3 x_3_param [[thread_position_in_grid]], device S& x_6 [[buffer(0)]], device S& x_7 [[buffer(1)]], device S& x_8 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_3_param; + main_1(x_6, x_7, x_8, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..9f6c616016 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %31 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_3 "x_3" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %x_8 "x_8" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_3 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_8 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_3 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_8 %uint_0 %21 + %32 = OpBitcast %int %24 + %33 = OpBitcast %int %26 + %29 = OpExtInst %int %31 SMax %32 %33 + %28 = OpBitcast %uint %29 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + %36 = OpLoad %v3uint %tint_symbol + OpStore %x_3 %36 + %37 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..883eb2a84f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +[[group(0), binding(2)]] var x_8 : S; + +fn main_1() { + let x_21 : u32 = x_3.x; + let x_23 : u32 = x_6.field0[x_21]; + let x_25 : u32 = x_7.field0[x_21]; + x_8.field0[x_21] = bitcast(max(bitcast(x_23), bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl new file mode 100644 index 0000000000..883eb2a84f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +[[group(0), binding(2)]] var x_8 : S; + +fn main_1() { + let x_21 : u32 = x_3.x; + let x_23 : u32 = x_6.field0[x_21]; + let x_25 : u32 = x_7.field0[x_21]; + x_8.field0[x_21] = bitcast(max(bitcast(x_23), bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..31dbd68538 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_3 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_6 : register(u0, space0); +RWByteAddressBuffer x_7 : register(u1, space0); +RWByteAddressBuffer x_8 : register(u2, space0); + +void main_1() { + const uint x_21 = x_3.x; + const uint x_23 = x_6.Load((4u * x_21)); + const uint x_25 = x_7.Load((4u * x_21)); + x_8.Store((4u * x_21), asuint(asuint(max(asint(x_23), asint(x_25))))); + return; +} + +struct tint_symbol_1 { + uint3 x_3_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_3_param = tint_symbol.x_3_param; + x_3 = x_3_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d2e3922aac --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_6, device S& x_7, device S& x_8, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_6.field0[x_21]; + uint const x_25 = x_7.field0[x_21]; + x_8.field0[x_21] = as_type(max(as_type(x_23), as_type(x_25))); + return; +} + +kernel void tint_symbol(uint3 x_3_param [[thread_position_in_grid]], device S& x_6 [[buffer(0)]], device S& x_7 [[buffer(1)]], device S& x_8 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_3_param; + main_1(x_6, x_7, x_8, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..9f6c616016 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %31 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_3 "x_3" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %x_8 "x_8" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_3 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_8 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_3 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_8 %uint_0 %21 + %32 = OpBitcast %int %24 + %33 = OpBitcast %int %26 + %29 = OpExtInst %int %31 SMax %32 %33 + %28 = OpBitcast %uint %29 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + %36 = OpLoad %v3uint %tint_symbol + OpStore %x_3 %36 + %37 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..883eb2a84f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smax/0-opt.wgsl.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +[[group(0), binding(2)]] var x_8 : S; + +fn main_1() { + let x_21 : u32 = x_3.x; + let x_23 : u32 = x_6.field0[x_21]; + let x_25 : u32 = x_7.field0[x_21]; + x_8.field0[x_21] = bitcast(max(bitcast(x_23), bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm new file mode 100644 index 0000000000..da2186c561 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm @@ -0,0 +1,44 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %gl_GlobalInvocationID + OpExecutionMode %2 LocalSize 1 1 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %_struct_5 BufferBlock + OpMemberDecorate %_struct_5 0 Offset 0 + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 0 + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 1 + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 2 + %uint = OpTypeInt 32 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_5 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %6 = OpVariable %_ptr_Uniform__struct_5 Uniform + %7 = OpVariable %_ptr_Uniform__struct_5 Uniform + %8 = OpVariable %_ptr_Uniform__struct_5 Uniform + %2 = OpFunction %void None %15 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %22 = OpAccessChain %_ptr_Uniform_uint %6 %uint_0 %21 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_Uniform_uint %7 %uint_0 %21 + %25 = OpLoad %uint %24 + %26 = OpExtInst %uint %1 SMin %23 %25 + %27 = OpAccessChain %_ptr_Uniform_uint %8 %uint_0 %21 + OpStore %27 %26 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..12b249cbf9 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_3 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_6 : register(u0, space0); +RWByteAddressBuffer x_7 : register(u1, space0); +RWByteAddressBuffer x_8 : register(u2, space0); + +void main_1() { + const uint x_21 = x_3.x; + const uint x_23 = x_6.Load((4u * x_21)); + const uint x_25 = x_7.Load((4u * x_21)); + x_8.Store((4u * x_21), asuint(asuint(min(asint(x_23), asint(x_25))))); + return; +} + +struct tint_symbol_1 { + uint3 x_3_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_3_param = tint_symbol.x_3_param; + x_3 = x_3_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..aa0d2805d8 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_6, device S& x_7, device S& x_8, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_6.field0[x_21]; + uint const x_25 = x_7.field0[x_21]; + x_8.field0[x_21] = as_type(min(as_type(x_23), as_type(x_25))); + return; +} + +kernel void tint_symbol(uint3 x_3_param [[thread_position_in_grid]], device S& x_6 [[buffer(0)]], device S& x_7 [[buffer(1)]], device S& x_8 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_3_param; + main_1(x_6, x_7, x_8, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..46045f1ebd --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %31 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_3 "x_3" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %x_8 "x_8" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_3 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_8 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_3 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_8 %uint_0 %21 + %32 = OpBitcast %int %24 + %33 = OpBitcast %int %26 + %29 = OpExtInst %int %31 SMin %32 %33 + %28 = OpBitcast %uint %29 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + %36 = OpLoad %v3uint %tint_symbol + OpStore %x_3 %36 + %37 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..93b1988ca2 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +[[group(0), binding(2)]] var x_8 : S; + +fn main_1() { + let x_21 : u32 = x_3.x; + let x_23 : u32 = x_6.field0[x_21]; + let x_25 : u32 = x_7.field0[x_21]; + x_8.field0[x_21] = bitcast(min(bitcast(x_23), bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl new file mode 100644 index 0000000000..93b1988ca2 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +[[group(0), binding(2)]] var x_8 : S; + +fn main_1() { + let x_21 : u32 = x_3.x; + let x_23 : u32 = x_6.field0[x_21]; + let x_25 : u32 = x_7.field0[x_21]; + x_8.field0[x_21] = bitcast(min(bitcast(x_23), bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..12b249cbf9 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_3 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_6 : register(u0, space0); +RWByteAddressBuffer x_7 : register(u1, space0); +RWByteAddressBuffer x_8 : register(u2, space0); + +void main_1() { + const uint x_21 = x_3.x; + const uint x_23 = x_6.Load((4u * x_21)); + const uint x_25 = x_7.Load((4u * x_21)); + x_8.Store((4u * x_21), asuint(asuint(min(asint(x_23), asint(x_25))))); + return; +} + +struct tint_symbol_1 { + uint3 x_3_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_3_param = tint_symbol.x_3_param; + x_3 = x_3_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..aa0d2805d8 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_6, device S& x_7, device S& x_8, thread uint3* const tint_symbol_2) { + uint const x_21 = (*(tint_symbol_2)).x; + uint const x_23 = x_6.field0[x_21]; + uint const x_25 = x_7.field0[x_21]; + x_8.field0[x_21] = as_type(min(as_type(x_23), as_type(x_25))); + return; +} + +kernel void tint_symbol(uint3 x_3_param [[thread_position_in_grid]], device S& x_6 [[buffer(0)]], device S& x_7 [[buffer(1)]], device S& x_8 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_3_param; + main_1(x_6, x_7, x_8, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..46045f1ebd --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %31 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_3 "x_3" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %x_8 "x_8" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 0 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 1 + OpDecorate %x_8 DescriptorSet 0 + OpDecorate %x_8 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_3 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_8 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_3 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_8 %uint_0 %21 + %32 = OpBitcast %int %24 + %33 = OpBitcast %int %26 + %29 = OpExtInst %int %31 SMin %32 %33 + %28 = OpBitcast %uint %29 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + %36 = OpLoad %v3uint %tint_symbol + OpStore %x_3 %36 + %37 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..93b1988ca2 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/glsl_uint_smin/0-opt.wgsl.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_3 : vec3; + +[[group(0), binding(0)]] var x_6 : S; + +[[group(0), binding(1)]] var x_7 : S; + +[[group(0), binding(2)]] var x_8 : S; + +fn main_1() { + let x_21 : u32 = x_3.x; + let x_23 : u32 = x_6.field0[x_21]; + let x_25 : u32 = x_7.field0[x_21]; + x_8.field0[x_21] = bitcast(min(bitcast(x_23), bitcast(x_25))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_3_param : vec3) { + x_3 = x_3_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm new file mode 100644 index 0000000000..3ebec95c3f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm @@ -0,0 +1,43 @@ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %gl_GlobalInvocationID + OpExecutionMode %1 LocalSize 1 1 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %_struct_4 BufferBlock + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 1 + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 2 + %uint = OpTypeInt 32 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %_struct_4 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %5 = OpVariable %_ptr_Uniform__struct_4 Uniform + %6 = OpVariable %_ptr_Uniform__struct_4 Uniform + %7 = OpVariable %_ptr_Uniform__struct_4 Uniform + %1 = OpFunction %void None %14 + %18 = OpLabel + %19 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %20 = OpLoad %uint %19 + %21 = OpAccessChain %_ptr_Uniform_uint %5 %uint_0 %20 + %22 = OpLoad %uint %21 + %23 = OpAccessChain %_ptr_Uniform_uint %6 %uint_0 %20 + %24 = OpLoad %uint %23 + %25 = OpSDiv %uint %22 %24 + %26 = OpAccessChain %_ptr_Uniform_uint %7 %uint_0 %20 + OpStore %26 %25 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..0533d3d36c --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_2 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_5 : register(u0, space0); +RWByteAddressBuffer x_6 : register(u1, space0); +RWByteAddressBuffer x_7 : register(u2, space0); + +void main_1() { + const uint x_20 = x_2.x; + const uint x_22 = x_5.Load((4u * x_20)); + const uint x_24 = x_6.Load((4u * x_20)); + x_7.Store((4u * x_20), asuint(asuint((asint(x_22) / asint(x_24))))); + return; +} + +struct tint_symbol_1 { + uint3 x_2_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_2_param = tint_symbol.x_2_param; + x_2 = x_2_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..df3eba3114 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_5, device S& x_6, device S& x_7, thread uint3* const tint_symbol_2) { + uint const x_20 = (*(tint_symbol_2)).x; + uint const x_22 = x_5.field0[x_20]; + uint const x_24 = x_6.field0[x_20]; + x_7.field0[x_20] = as_type((as_type(x_22) / as_type(x_24))); + return; +} + +kernel void tint_symbol(uint3 x_2_param [[thread_position_in_grid]], device S& x_5 [[buffer(0)]], device S& x_6 [[buffer(1)]], device S& x_7 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_2_param; + main_1(x_5, x_6, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..5b924e465f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_2 "x_2" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_2 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_2 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_5 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %29 = OpBitcast %int %24 + %31 = OpBitcast %int %26 + %32 = OpSDiv %int %29 %31 + %28 = OpBitcast %uint %32 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %34 = OpLabel + %35 = OpLoad %v3uint %tint_symbol + OpStore %x_2 %35 + %36 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..c6a7af66a2 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_20 : u32 = x_2.x; + let x_22 : u32 = x_5.field0[x_20]; + let x_24 : u32 = x_6.field0[x_20]; + x_7.field0[x_20] = bitcast((bitcast(x_22) / bitcast(x_24))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl new file mode 100644 index 0000000000..c6a7af66a2 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_20 : u32 = x_2.x; + let x_22 : u32 = x_5.field0[x_20]; + let x_24 : u32 = x_6.field0[x_20]; + x_7.field0[x_20] = bitcast((bitcast(x_22) / bitcast(x_24))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..0533d3d36c --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static uint3 x_2 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_5 : register(u0, space0); +RWByteAddressBuffer x_6 : register(u1, space0); +RWByteAddressBuffer x_7 : register(u2, space0); + +void main_1() { + const uint x_20 = x_2.x; + const uint x_22 = x_5.Load((4u * x_20)); + const uint x_24 = x_6.Load((4u * x_20)); + x_7.Store((4u * x_20), asuint(asuint((asint(x_22) / asint(x_24))))); + return; +} + +struct tint_symbol_1 { + uint3 x_2_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_2_param = tint_symbol.x_2_param; + x_2 = x_2_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..df3eba3114 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.msl @@ -0,0 +1,22 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_5, device S& x_6, device S& x_7, thread uint3* const tint_symbol_2) { + uint const x_20 = (*(tint_symbol_2)).x; + uint const x_22 = x_5.field0[x_20]; + uint const x_24 = x_6.field0[x_20]; + x_7.field0[x_20] = as_type((as_type(x_22) / as_type(x_24))); + return; +} + +kernel void tint_symbol(uint3 x_2_param [[thread_position_in_grid]], device S& x_5 [[buffer(0)]], device S& x_6 [[buffer(1)]], device S& x_7 [[buffer(2)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_2_param; + main_1(x_5, x_6, x_7, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..5b924e465f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_2 "x_2" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %x_6 "x_6" + OpName %x_7 "x_7" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %x_7 DescriptorSet 0 + OpDecorate %x_7 Binding 2 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_2 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_7 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %14 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %20 = OpAccessChain %_ptr_Private_uint %x_2 %uint_0 + %21 = OpLoad %uint %20 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %x_5 %uint_0 %21 + %24 = OpLoad %uint %23 + %25 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %21 + %26 = OpLoad %uint %25 + %27 = OpAccessChain %_ptr_StorageBuffer_uint %x_7 %uint_0 %21 + %29 = OpBitcast %int %24 + %31 = OpBitcast %int %26 + %32 = OpSDiv %int %29 %31 + %28 = OpBitcast %uint %32 + OpStore %27 %28 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %34 = OpLabel + %35 = OpLoad %v3uint %tint_symbol + OpStore %x_2 %35 + %36 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..c6a7af66a2 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_sdiv/0-opt.wgsl.expected.wgsl @@ -0,0 +1,28 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +[[group(0), binding(2)]] var x_7 : S; + +fn main_1() { + let x_20 : u32 = x_2.x; + let x_22 : u32 = x_5.field0[x_20]; + let x_24 : u32 = x_6.field0[x_20]; + x_7.field0[x_20] = bitcast((bitcast(x_22) / bitcast(x_24))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm new file mode 100644 index 0000000000..40a9c24b70 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm @@ -0,0 +1,39 @@ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %gl_GlobalInvocationID + OpExecutionMode %1 LocalSize 1 1 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %_struct_4 BufferBlock + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 1 + %uint = OpTypeInt 32 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Input_uint = OpTypePointer Input %uint + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %void = OpTypeVoid + %13 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %v2uint = OpTypeVector %uint 2 + %_struct_4 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %5 = OpVariable %_ptr_Uniform__struct_4 Uniform + %6 = OpVariable %_ptr_Uniform__struct_4 Uniform + %1 = OpFunction %void None %13 + %18 = OpLabel + %19 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %20 = OpLoad %uint %19 + %21 = OpAccessChain %_ptr_Uniform_uint %5 %uint_0 %20 + %22 = OpLoad %uint %21 + %23 = OpSNegate %uint %22 + %24 = OpAccessChain %_ptr_Uniform_uint %6 %uint_0 %20 + OpStore %24 %23 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..35858e0617 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.hlsl @@ -0,0 +1,22 @@ +static uint3 x_2 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_5 : register(u0, space0); +RWByteAddressBuffer x_6 : register(u1, space0); + +void main_1() { + const uint x_20 = x_2.x; + const uint x_22 = x_5.Load((4u * x_20)); + x_6.Store((4u * x_20), asuint(asuint(-(asint(x_22))))); + return; +} + +struct tint_symbol_1 { + uint3 x_2_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_2_param = tint_symbol.x_2_param; + x_2 = x_2_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..d7828a3b2b --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_5, device S& x_6, thread uint3* const tint_symbol_2) { + uint const x_20 = (*(tint_symbol_2)).x; + uint const x_22 = x_5.field0[x_20]; + x_6.field0[x_20] = as_type(-(as_type(x_22))); + return; +} + +kernel void tint_symbol(uint3 x_2_param [[thread_position_in_grid]], device S& x_5 [[buffer(0)]], device S& x_6 [[buffer(1)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_2_param; + main_1(x_5, x_6, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..4ce732fa6f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_2 "x_2" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %x_6 "x_6" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_2 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %13 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %main_1 = OpFunction %void None %13 + %16 = OpLabel + %19 = OpAccessChain %_ptr_Private_uint %x_2 %uint_0 + %20 = OpLoad %uint %19 + %22 = OpAccessChain %_ptr_StorageBuffer_uint %x_5 %uint_0 %20 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %20 + %27 = OpBitcast %int %23 + %26 = OpSNegate %int %27 + %25 = OpBitcast %uint %26 + OpStore %24 %25 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpLoad %v3uint %tint_symbol + OpStore %x_2 %31 + %32 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..1956524f90 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +fn main_1() { + let x_20 : u32 = x_2.x; + let x_22 : u32 = x_5.field0[x_20]; + x_6.field0[x_20] = bitcast(-(bitcast(x_22))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl new file mode 100644 index 0000000000..1956524f90 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl @@ -0,0 +1,25 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +fn main_1() { + let x_20 : u32 = x_2.x; + let x_22 : u32 = x_5.field0[x_20]; + x_6.field0[x_20] = bitcast(-(bitcast(x_22))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..35858e0617 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.hlsl @@ -0,0 +1,22 @@ +static uint3 x_2 = uint3(0u, 0u, 0u); +RWByteAddressBuffer x_5 : register(u0, space0); +RWByteAddressBuffer x_6 : register(u1, space0); + +void main_1() { + const uint x_20 = x_2.x; + const uint x_22 = x_5.Load((4u * x_20)); + x_6.Store((4u * x_20), asuint(asuint(-(asint(x_22))))); + return; +} + +struct tint_symbol_1 { + uint3 x_2_param : SV_DispatchThreadID; +}; + +[numthreads(1, 1, 1)] +void main(tint_symbol_1 tint_symbol) { + const uint3 x_2_param = tint_symbol.x_2_param; + x_2 = x_2_param; + main_1(); + return; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..d7828a3b2b --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.msl @@ -0,0 +1,21 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ uint field0[1]; +}; + +void main_1(device S& x_5, device S& x_6, thread uint3* const tint_symbol_2) { + uint const x_20 = (*(tint_symbol_2)).x; + uint const x_22 = x_5.field0[x_20]; + x_6.field0[x_20] = as_type(-(as_type(x_22))); + return; +} + +kernel void tint_symbol(uint3 x_2_param [[thread_position_in_grid]], device S& x_5 [[buffer(0)]], device S& x_6 [[buffer(1)]]) { + thread uint3 tint_symbol_3 = 0u; + tint_symbol_3 = x_2_param; + main_1(x_5, x_6, &(tint_symbol_3)); + return; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..4ce732fa6f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.spvasm @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %tint_symbol + OpExecutionMode %main LocalSize 1 1 1 + OpName %x_2 "x_2" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %x_6 "x_6" + OpName %tint_symbol "tint_symbol" + OpName %main_1 "main_1" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %x_6 DescriptorSet 0 + OpDecorate %x_6 Binding 1 + OpDecorate %tint_symbol BuiltIn GlobalInvocationId + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %5 = OpConstantNull %v3uint + %x_2 = OpVariable %_ptr_Private_v3uint Private %5 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %S = OpTypeStruct %_runtimearr_uint +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %x_6 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%tint_symbol = OpVariable %_ptr_Input_v3uint Input + %void = OpTypeVoid + %13 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_uint = OpTypePointer Private %uint +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int = OpTypeInt 32 1 + %main_1 = OpFunction %void None %13 + %16 = OpLabel + %19 = OpAccessChain %_ptr_Private_uint %x_2 %uint_0 + %20 = OpLoad %uint %19 + %22 = OpAccessChain %_ptr_StorageBuffer_uint %x_5 %uint_0 %20 + %23 = OpLoad %uint %22 + %24 = OpAccessChain %_ptr_StorageBuffer_uint %x_6 %uint_0 %20 + %27 = OpBitcast %int %23 + %26 = OpSNegate %int %27 + %25 = OpBitcast %uint %26 + OpStore %24 %25 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %30 = OpLabel + %31 = OpLoad %v3uint %tint_symbol + OpStore %x_2 %31 + %32 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..1956524f90 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/compute/signed_op/uint_snegate/0-opt.wgsl.expected.wgsl @@ -0,0 +1,25 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec3; + +[[group(0), binding(0)]] var x_5 : S; + +[[group(0), binding(1)]] var x_6 : S; + +fn main_1() { + let x_20 : u32 = x_2.x; + let x_22 : u32 = x_5.field0[x_20]; + x_6.field0[x_20] = bitcast(-(bitcast(x_22))); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_2_param : vec3) { + x_2 = x_2_param; + main_1(); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm new file mode 100644 index 0000000000..a99e3baa3b --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm @@ -0,0 +1,61 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %2 "main" %3 %4 %5 + OpDecorate %3 Location 0 + OpDecorate %4 Flat + OpDecorate %4 Location 0 + OpMemberDecorate %_struct_6 0 BuiltIn Position + OpMemberDecorate %_struct_6 1 BuiltIn PointSize + OpMemberDecorate %_struct_6 2 BuiltIn ClipDistance + OpDecorate %_struct_6 Block + %void = OpTypeVoid + %8 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %3 = OpVariable %_ptr_Input_v2float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %4 = OpVariable %_ptr_Output_uint Output + %uint_36 = OpConstant %uint 36 + %v4float = OpTypeVector %float 4 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 + %_struct_6 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output__struct_6 = OpTypePointer Output %_struct_6 + %5 = OpVariable %_ptr_Output__struct_6 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %2 = OpFunction %void None %8 + %28 = OpLabel + %29 = OpAccessChain %_ptr_Input_float %3 %uint_0 + %30 = OpLoad %float %29 + %31 = OpFAdd %float %30 %float_1_02777779 + %32 = OpFMul %float %31 %float_18 + %33 = OpFSub %float %32 %float_1 + %34 = OpConvertFToU %uint %33 + %35 = OpAccessChain %_ptr_Input_float %3 %uint_1 + %36 = OpLoad %float %35 + %37 = OpFAdd %float %36 %float_1_02777779 + %38 = OpFMul %float %37 %float_18 + %39 = OpFSub %float %38 %float_1 + %40 = OpConvertFToU %uint %39 + %41 = OpIMul %uint %40 %uint_36 + %42 = OpIAdd %uint %34 %41 + OpStore %4 %42 + %43 = OpLoad %v2float %3 + %44 = OpCompositeExtract %float %43 0 + %45 = OpCompositeExtract %float %43 1 + %46 = OpCompositeConstruct %v4float %44 %45 %float_0 %float_1 + %47 = OpAccessChain %_ptr_Output_v4float %5 %int_0 + OpStore %47 %46 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..1e05739fb1 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.hlsl @@ -0,0 +1,33 @@ +static float2 x_3 = float2(0.0f, 0.0f); +static uint x_4 = 0u; +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_30 = x_3.x; + const float x_36 = x_3.y; + x_4 = (uint((((x_30 + 1.027777791f) * 18.0f) - 1.0f)) + (uint((((x_36 + 1.027777791f) * 18.0f) - 1.0f)) * 36u)); + const float2 x_43 = x_3; + gl_Position = float4(x_43.x, x_43.y, 0.0f, 1.0f); + return; +} + +struct main_out { + uint x_4_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float2 x_3_param : TEXCOORD0; +}; +struct tint_symbol_2 { + uint x_4_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float2 x_3_param = tint_symbol.x_3_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4, gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_4_1, tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.msl new file mode 100644 index 0000000000..7bcd3c26f3 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +struct main_out { + uint x_4_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float2 x_3_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + uint x_4_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void main_1(thread float2* const tint_symbol_6, thread uint* const tint_symbol_7, thread float4* const tint_symbol_8) { + float const x_30 = (*(tint_symbol_6)).x; + float const x_36 = (*(tint_symbol_6)).y; + *(tint_symbol_7) = (uint((((x_30 + 1.027777791f) * 18.0f) - 1.0f)) + (uint((((x_36 + 1.027777791f) * 18.0f) - 1.0f)) * 36u)); + float2 const x_43 = *(tint_symbol_6); + *(tint_symbol_8) = float4(x_43.x, x_43.y, 0.0f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float2 tint_symbol_9 = 0.0f; + thread uint tint_symbol_10 = 0u; + thread float4 tint_symbol_11 = 0.0f; + float2 const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_9 = x_3_param; + main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_10, .gl_Position=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..b95f7944b5 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_2 Flat + OpDecorate %tint_symbol_3 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v2float = OpTypeVector %float 2 +%_ptr_Private_v2float = OpTypePointer Private %v2float + %8 = OpConstantNull %v2float + %x_3 = OpVariable %_ptr_Private_v2float Private %8 + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %12 = OpConstantNull %uint + %x_4 = OpVariable %_ptr_Private_uint Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%gl_Position = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Input_v2float = OpTypePointer Input %v2float +%tint_symbol = OpVariable %_ptr_Input_v2float Input +%_ptr_Output_uint = OpTypePointer Output %uint +%tint_symbol_2 = OpVariable %_ptr_Output_uint Output %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %float_1 = OpConstant %float 1 + %uint_36 = OpConstant %uint 36 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %uint %v4float + %53 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %29 = OpAccessChain %_ptr_Private_float %x_3 %uint_0 + %30 = OpLoad %float %29 + %32 = OpAccessChain %_ptr_Private_float %x_3 %uint_1 + %33 = OpLoad %float %32 + %36 = OpFAdd %float %30 %float_1_02777779 + %38 = OpFMul %float %36 %float_18 + %40 = OpFSub %float %38 %float_1 + %34 = OpConvertFToU %uint %40 + %42 = OpFAdd %float %33 %float_1_02777779 + %43 = OpFMul %float %42 %float_18 + %44 = OpFSub %float %43 %float_1 + %41 = OpConvertFToU %uint %44 + %46 = OpIMul %uint %41 %uint_36 + %47 = OpIAdd %uint %34 %46 + OpStore %x_4 %47 + %48 = OpLoad %v2float %x_3 + %49 = OpCompositeExtract %float %48 0 + %50 = OpCompositeExtract %float %48 1 + %52 = OpCompositeConstruct %v4float %49 %50 %float_0 %float_1 + OpStore %gl_Position %52 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %53 +%tint_symbol_1 = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %uint %tint_symbol_1 0 + OpStore %tint_symbol_2 %58 + %59 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %59 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %61 = OpLabel + OpStore %tint_pointsize %float_1 + %62 = OpLoad %v2float %tint_symbol + OpStore %x_3 %62 + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %uint %x_4 + %66 = OpLoad %v4float %gl_Position + %67 = OpCompositeConstruct %main_out %65 %66 + %64 = OpFunctionCall %void %tint_symbol_4 %67 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..eef9fd15a4 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +var x_3 : vec2; + +var x_4 : u32; + +var gl_Position : vec4; + +fn main_1() { + let x_30 : f32 = x_3.x; + let x_36 : f32 = x_3.y; + x_4 = (u32((((x_30 + 1.027777791) * 18.0) - 1.0)) + (u32((((x_36 + 1.027777791) * 18.0) - 1.0)) * 36u)); + let x_43 : vec2 = x_3; + gl_Position = vec4(x_43.x, x_43.y, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : u32; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_3_param : vec2) -> main_out { + x_3 = x_3_param; + main_1(); + return main_out(x_4, gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl new file mode 100644 index 0000000000..eef9fd15a4 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl @@ -0,0 +1,28 @@ +var x_3 : vec2; + +var x_4 : u32; + +var gl_Position : vec4; + +fn main_1() { + let x_30 : f32 = x_3.x; + let x_36 : f32 = x_3.y; + x_4 = (u32((((x_30 + 1.027777791) * 18.0) - 1.0)) + (u32((((x_36 + 1.027777791) * 18.0) - 1.0)) * 36u)); + let x_43 : vec2 = x_3; + gl_Position = vec4(x_43.x, x_43.y, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : u32; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_3_param : vec2) -> main_out { + x_3 = x_3_param; + main_1(); + return main_out(x_4, gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..1e05739fb1 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +static float2 x_3 = float2(0.0f, 0.0f); +static uint x_4 = 0u; +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_30 = x_3.x; + const float x_36 = x_3.y; + x_4 = (uint((((x_30 + 1.027777791f) * 18.0f) - 1.0f)) + (uint((((x_36 + 1.027777791f) * 18.0f) - 1.0f)) * 36u)); + const float2 x_43 = x_3; + gl_Position = float4(x_43.x, x_43.y, 0.0f, 1.0f); + return; +} + +struct main_out { + uint x_4_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float2 x_3_param : TEXCOORD0; +}; +struct tint_symbol_2 { + uint x_4_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float2 x_3_param = tint_symbol.x_3_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4, gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_4_1, tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.msl new file mode 100644 index 0000000000..7bcd3c26f3 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.msl @@ -0,0 +1,36 @@ +#include + +using namespace metal; +struct main_out { + uint x_4_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float2 x_3_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + uint x_4_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void main_1(thread float2* const tint_symbol_6, thread uint* const tint_symbol_7, thread float4* const tint_symbol_8) { + float const x_30 = (*(tint_symbol_6)).x; + float const x_36 = (*(tint_symbol_6)).y; + *(tint_symbol_7) = (uint((((x_30 + 1.027777791f) * 18.0f) - 1.0f)) + (uint((((x_36 + 1.027777791f) * 18.0f) - 1.0f)) * 36u)); + float2 const x_43 = *(tint_symbol_6); + *(tint_symbol_8) = float4(x_43.x, x_43.y, 0.0f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float2 tint_symbol_9 = 0.0f; + thread uint tint_symbol_10 = 0u; + thread float4 tint_symbol_11 = 0.0f; + float2 const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_9 = x_3_param; + main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_10, .gl_Position=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..b95f7944b5 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.spvasm @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_2 Flat + OpDecorate %tint_symbol_3 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v2float = OpTypeVector %float 2 +%_ptr_Private_v2float = OpTypePointer Private %v2float + %8 = OpConstantNull %v2float + %x_3 = OpVariable %_ptr_Private_v2float Private %8 + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %12 = OpConstantNull %uint + %x_4 = OpVariable %_ptr_Private_uint Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %16 = OpConstantNull %v4float +%gl_Position = OpVariable %_ptr_Private_v4float Private %16 +%_ptr_Input_v2float = OpTypePointer Input %v2float +%tint_symbol = OpVariable %_ptr_Input_v2float Input +%_ptr_Output_uint = OpTypePointer Output %uint +%tint_symbol_2 = OpVariable %_ptr_Output_uint Output %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %16 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 +%float_1_02777779 = OpConstant %float 1.02777779 + %float_18 = OpConstant %float 18 + %float_1 = OpConstant %float 1 + %uint_36 = OpConstant %uint 36 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %uint %v4float + %53 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %23 + %26 = OpLabel + %29 = OpAccessChain %_ptr_Private_float %x_3 %uint_0 + %30 = OpLoad %float %29 + %32 = OpAccessChain %_ptr_Private_float %x_3 %uint_1 + %33 = OpLoad %float %32 + %36 = OpFAdd %float %30 %float_1_02777779 + %38 = OpFMul %float %36 %float_18 + %40 = OpFSub %float %38 %float_1 + %34 = OpConvertFToU %uint %40 + %42 = OpFAdd %float %33 %float_1_02777779 + %43 = OpFMul %float %42 %float_18 + %44 = OpFSub %float %43 %float_1 + %41 = OpConvertFToU %uint %44 + %46 = OpIMul %uint %41 %uint_36 + %47 = OpIAdd %uint %34 %46 + OpStore %x_4 %47 + %48 = OpLoad %v2float %x_3 + %49 = OpCompositeExtract %float %48 0 + %50 = OpCompositeExtract %float %48 1 + %52 = OpCompositeConstruct %v4float %49 %50 %float_0 %float_1 + OpStore %gl_Position %52 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %53 +%tint_symbol_1 = OpFunctionParameter %main_out + %57 = OpLabel + %58 = OpCompositeExtract %uint %tint_symbol_1 0 + OpStore %tint_symbol_2 %58 + %59 = OpCompositeExtract %v4float %tint_symbol_1 1 + OpStore %tint_symbol_3 %59 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %23 + %61 = OpLabel + OpStore %tint_pointsize %float_1 + %62 = OpLoad %v2float %tint_symbol + OpStore %x_3 %62 + %63 = OpFunctionCall %void %main_1 + %65 = OpLoad %uint %x_4 + %66 = OpLoad %v4float %gl_Position + %67 = OpCompositeConstruct %main_out %65 %66 + %64 = OpFunctionCall %void %tint_symbol_4 %67 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..eef9fd15a4 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/float32/comparison/frexpstruct_1_frag/0.wgsl.expected.wgsl @@ -0,0 +1,28 @@ +var x_3 : vec2; + +var x_4 : u32; + +var gl_Position : vec4; + +fn main_1() { + let x_30 : f32 = x_3.x; + let x_36 : f32 = x_3.y; + x_4 = (u32((((x_30 + 1.027777791) * 18.0) - 1.0)) + (u32((((x_36 + 1.027777791) * 18.0) - 1.0)) * 36u)); + let x_43 : vec2 = x_3; + gl_Position = vec4(x_43.x, x_43.y, 0.0, 1.0); + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : u32; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_3_param : vec2) -> main_out { + x_3 = x_3_param; + main_1(); + return main_out(x_4, gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm new file mode 100644 index 0000000000..4dca9c5829 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %position + OpSource GLSL 430 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %_ "" + OpName %position "position" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %position Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %position = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %7 + %21 = OpLabel + %22 = OpLoad %v4float %position + %23 = OpVectorShuffle %v2float %22 %22 0 1 + %24 = OpCompositeExtract %float %23 0 + %25 = OpCompositeExtract %float %23 1 + %26 = OpCompositeConstruct %v4float %24 %25 %float_0_5 %float_1 + %27 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %27 %26 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..067c7f0458 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_22 = position; + const float2 x_23 = float2(x_22.x, x_22.y); + gl_Position = float4(x_23.x, x_23.y, 0.5f, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f6543149fb --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_22 = *(tint_symbol_6); + float2 const x_23 = float2(x_22.x, x_22.y); + *(tint_symbol_7) = float4(x_23.x, x_23.y, 0.5f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..bb27f18661 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %position + %20 = OpCompositeExtract %float %18 0 + %21 = OpCompositeExtract %float %18 1 + %22 = OpCompositeConstruct %v2float %20 %21 + %23 = OpCompositeExtract %float %22 0 + %24 = OpCompositeExtract %float %22 1 + %27 = OpCompositeConstruct %v4float %23 %24 %float_0_5 %float_1 + OpStore %gl_Position %27 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..bf7b1a4ab1 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.5, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl new file mode 100644 index 0000000000..bf7b1a4ab1 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.5, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..067c7f0458 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_22 = position; + const float2 x_23 = float2(x_22.x, x_22.y); + gl_Position = float4(x_23.x, x_23.y, 0.5f, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f6543149fb --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_22 = *(tint_symbol_6); + float2 const x_23 = float2(x_22.x, x_22.y); + *(tint_symbol_7) = float4(x_23.x, x_23.y, 0.5f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..bb27f18661 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %position + %20 = OpCompositeExtract %float %18 0 + %21 = OpCompositeExtract %float %18 1 + %22 = OpCompositeConstruct %v2float %20 %21 + %23 = OpCompositeExtract %float %22 0 + %24 = OpCompositeExtract %float %22 1 + %27 = OpCompositeConstruct %v4float %23 %24 %float_0_5 %float_1 + OpStore %gl_Position %27 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..bf7b1a4ab1 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/0-opt.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.5, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm new file mode 100644 index 0000000000..c63fe284d0 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm @@ -0,0 +1,31 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyFragmentTests + OpExecutionMode %main DepthReplacing + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_0_300000012 = OpConstant %float 0.300000012 + %main = OpFunction %void None %6 + %15 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_300000012 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..25aecc7b1d --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + color_out = float4(1.0f, 0.0f, 0.0f, 1.0f); + gl_FragDepth = 0.300000012f; + return; +} + +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 color_out_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {color_out, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.color_out_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.msl new file mode 100644 index 0000000000..d3a44441db --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 color_out_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + *(tint_symbol_5) = 0.300000012f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.color_out_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.color_out_1=tint_symbol_2.color_out_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..2656eac2fb --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color_out = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%float_0_300000012 = OpConstant %float 0.300000012 + %main_out = OpTypeStruct %v4float %float + %21 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %color_out %19 + OpStore %gl_FragDepth %float_0_300000012 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %21 +%tint_symbol = OpFunctionParameter %main_out + %25 = OpLabel + %26 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %26 + %27 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %27 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %void %main_1 + %32 = OpLoad %v4float %color_out + %33 = OpLoad %float %gl_FragDepth + %34 = OpCompositeConstruct %main_out %32 %33 + %31 = OpFunctionCall %void %tint_symbol_3 %34 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..48a9583a80 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var color_out : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.300000012; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color_out, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl new file mode 100644 index 0000000000..48a9583a80 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl @@ -0,0 +1,22 @@ +var color_out : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.300000012; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color_out, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..25aecc7b1d --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + color_out = float4(1.0f, 0.0f, 0.0f, 1.0f); + gl_FragDepth = 0.300000012f; + return; +} + +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 color_out_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {color_out, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.color_out_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.msl new file mode 100644 index 0000000000..d3a44441db --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 color_out_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + *(tint_symbol_5) = 0.300000012f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.color_out_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.color_out_1=tint_symbol_2.color_out_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..2656eac2fb --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color_out = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%float_0_300000012 = OpConstant %float 0.300000012 + %main_out = OpTypeStruct %v4float %float + %21 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %color_out %19 + OpStore %gl_FragDepth %float_0_300000012 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %21 +%tint_symbol = OpFunctionParameter %main_out + %25 = OpLabel + %26 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %26 + %27 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %27 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %void %main_1 + %32 = OpLoad %v4float %color_out + %33 = OpLoad %float %gl_FragDepth + %34 = OpCompositeConstruct %main_out %32 %33 + %31 = OpFunctionCall %void %tint_symbol_3 %34 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..48a9583a80 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_equal/1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var color_out : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.300000012; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color_out, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm new file mode 100644 index 0000000000..6944ce4e9b --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %position + OpSource GLSL 430 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %_ "" + OpName %position "position" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %position Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %position = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 +%float_0_600000024 = OpConstant %float 0.600000024 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %7 + %21 = OpLabel + %22 = OpLoad %v4float %position + %23 = OpVectorShuffle %v2float %22 %22 0 1 + %24 = OpCompositeExtract %float %23 0 + %25 = OpCompositeExtract %float %23 1 + %26 = OpCompositeConstruct %v4float %24 %25 %float_0_600000024 %float_1 + %27 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %27 %26 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..224ce12c82 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_22 = position; + const float2 x_23 = float2(x_22.x, x_22.y); + gl_Position = float4(x_23.x, x_23.y, 0.600000024f, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..ccc433eab1 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_22 = *(tint_symbol_6); + float2 const x_23 = float2(x_22.x, x_22.y); + *(tint_symbol_7) = float4(x_23.x, x_23.y, 0.600000024f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..67f68ab25b --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%float_0_600000024 = OpConstant %float 0.600000024 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %position + %20 = OpCompositeExtract %float %18 0 + %21 = OpCompositeExtract %float %18 1 + %22 = OpCompositeConstruct %v2float %20 %21 + %23 = OpCompositeExtract %float %22 0 + %24 = OpCompositeExtract %float %22 1 + %27 = OpCompositeConstruct %v4float %23 %24 %float_0_600000024 %float_1 + OpStore %gl_Position %27 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..574d2de18a --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.600000024, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl new file mode 100644 index 0000000000..574d2de18a --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.600000024, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..224ce12c82 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_22 = position; + const float2 x_23 = float2(x_22.x, x_22.y); + gl_Position = float4(x_23.x, x_23.y, 0.600000024f, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..ccc433eab1 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_22 = *(tint_symbol_6); + float2 const x_23 = float2(x_22.x, x_22.y); + *(tint_symbol_7) = float4(x_23.x, x_23.y, 0.600000024f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..67f68ab25b --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%float_0_600000024 = OpConstant %float 0.600000024 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %position + %20 = OpCompositeExtract %float %18 0 + %21 = OpCompositeExtract %float %18 1 + %22 = OpCompositeConstruct %v2float %20 %21 + %23 = OpCompositeExtract %float %22 0 + %24 = OpCompositeExtract %float %22 1 + %27 = OpCompositeConstruct %v4float %23 %24 %float_0_600000024 %float_1 + OpStore %gl_Position %27 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..574d2de18a --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/0-opt.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.600000024, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm new file mode 100644 index 0000000000..490b9efd05 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm @@ -0,0 +1,32 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyFragmentTests + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthGreater + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_0_400000006 = OpConstant %float 0.400000006 + %main = OpFunction %void None %6 + %15 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_400000006 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..4e8b74db24 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + color_out = float4(1.0f, 0.0f, 0.0f, 1.0f); + gl_FragDepth = 0.400000006f; + return; +} + +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 color_out_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {color_out, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.color_out_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.msl new file mode 100644 index 0000000000..01893070d2 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 color_out_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + *(tint_symbol_5) = 0.400000006f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.color_out_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.color_out_1=tint_symbol_2.color_out_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..2c1b030109 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color_out = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%float_0_400000006 = OpConstant %float 0.400000006 + %main_out = OpTypeStruct %v4float %float + %21 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %color_out %19 + OpStore %gl_FragDepth %float_0_400000006 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %21 +%tint_symbol = OpFunctionParameter %main_out + %25 = OpLabel + %26 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %26 + %27 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %27 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %void %main_1 + %32 = OpLoad %v4float %color_out + %33 = OpLoad %float %gl_FragDepth + %34 = OpCompositeConstruct %main_out %32 %33 + %31 = OpFunctionCall %void %tint_symbol_3 %34 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..df3c7e3256 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var color_out : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.400000006; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color_out, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl new file mode 100644 index 0000000000..df3c7e3256 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl @@ -0,0 +1,22 @@ +var color_out : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.400000006; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color_out, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..4e8b74db24 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + color_out = float4(1.0f, 0.0f, 0.0f, 1.0f); + gl_FragDepth = 0.400000006f; + return; +} + +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 color_out_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {color_out, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.color_out_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.msl new file mode 100644 index 0000000000..01893070d2 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 color_out_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + *(tint_symbol_5) = 0.400000006f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.color_out_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.color_out_1=tint_symbol_2.color_out_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c1b030109 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color_out = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%float_0_400000006 = OpConstant %float 0.400000006 + %main_out = OpTypeStruct %v4float %float + %21 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %color_out %19 + OpStore %gl_FragDepth %float_0_400000006 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %21 +%tint_symbol = OpFunctionParameter %main_out + %25 = OpLabel + %26 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %26 + %27 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %27 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %void %main_1 + %32 = OpLoad %v4float %color_out + %33 = OpLoad %float %gl_FragDepth + %34 = OpCompositeConstruct %main_out %32 %33 + %31 = OpFunctionCall %void %tint_symbol_3 %34 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..df3c7e3256 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_greater/1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var color_out : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.400000006; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color_out, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm new file mode 100644 index 0000000000..716c4b7cb5 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %position + OpSource GLSL 430 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %_ "" + OpName %position "position" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %position Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %position = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 +%float_0_400000006 = OpConstant %float 0.400000006 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %7 + %21 = OpLabel + %22 = OpLoad %v4float %position + %23 = OpVectorShuffle %v2float %22 %22 0 1 + %24 = OpCompositeExtract %float %23 0 + %25 = OpCompositeExtract %float %23 1 + %26 = OpCompositeConstruct %v4float %24 %25 %float_0_400000006 %float_1 + %27 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %27 %26 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..2f5b031312 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_22 = position; + const float2 x_23 = float2(x_22.x, x_22.y); + gl_Position = float4(x_23.x, x_23.y, 0.400000006f, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..0f220e3275 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_22 = *(tint_symbol_6); + float2 const x_23 = float2(x_22.x, x_22.y); + *(tint_symbol_7) = float4(x_23.x, x_23.y, 0.400000006f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..57cab41c74 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%float_0_400000006 = OpConstant %float 0.400000006 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %position + %20 = OpCompositeExtract %float %18 0 + %21 = OpCompositeExtract %float %18 1 + %22 = OpCompositeConstruct %v2float %20 %21 + %23 = OpCompositeExtract %float %22 0 + %24 = OpCompositeExtract %float %22 1 + %27 = OpCompositeConstruct %v4float %23 %24 %float_0_400000006 %float_1 + OpStore %gl_Position %27 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f3aec87ce9 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.400000006, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl new file mode 100644 index 0000000000..f3aec87ce9 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.400000006, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..2f5b031312 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_22 = position; + const float2 x_23 = float2(x_22.x, x_22.y); + gl_Position = float4(x_23.x, x_23.y, 0.400000006f, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..0f220e3275 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_22 = *(tint_symbol_6); + float2 const x_23 = float2(x_22.x, x_22.y); + *(tint_symbol_7) = float4(x_23.x, x_23.y, 0.400000006f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..57cab41c74 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%float_0_400000006 = OpConstant %float 0.400000006 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %position + %20 = OpCompositeExtract %float %18 0 + %21 = OpCompositeExtract %float %18 1 + %22 = OpCompositeConstruct %v2float %20 %21 + %23 = OpCompositeExtract %float %22 0 + %24 = OpCompositeExtract %float %22 1 + %27 = OpCompositeConstruct %v4float %23 %24 %float_0_400000006 %float_1 + OpStore %gl_Position %27 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f3aec87ce9 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less/0-opt.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.400000006, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm new file mode 100644 index 0000000000..c195cb3a84 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm @@ -0,0 +1,31 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyFragmentTests + OpExecutionMode %main DepthReplacing + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_0_699999988 = OpConstant %float 0.699999988 + %main = OpFunction %void None %6 + %15 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_699999988 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..47aefbb5ab --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + color_out = float4(1.0f, 0.0f, 0.0f, 1.0f); + gl_FragDepth = 0.699999988f; + return; +} + +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 color_out_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {color_out, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.color_out_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.msl new file mode 100644 index 0000000000..842cf9d0ca --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 color_out_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + *(tint_symbol_5) = 0.699999988f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.color_out_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.color_out_1=tint_symbol_2.color_out_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..2f52f93e45 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color_out = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%float_0_699999988 = OpConstant %float 0.699999988 + %main_out = OpTypeStruct %v4float %float + %21 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %color_out %19 + OpStore %gl_FragDepth %float_0_699999988 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %21 +%tint_symbol = OpFunctionParameter %main_out + %25 = OpLabel + %26 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %26 + %27 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %27 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %void %main_1 + %32 = OpLoad %v4float %color_out + %33 = OpLoad %float %gl_FragDepth + %34 = OpCompositeConstruct %main_out %32 %33 + %31 = OpFunctionCall %void %tint_symbol_3 %34 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..8bf833ae8f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var color_out : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.699999988; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color_out, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl new file mode 100644 index 0000000000..8bf833ae8f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl @@ -0,0 +1,22 @@ +var color_out : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.699999988; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color_out, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..47aefbb5ab --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + color_out = float4(1.0f, 0.0f, 0.0f, 1.0f); + gl_FragDepth = 0.699999988f; + return; +} + +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 color_out_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {color_out, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.color_out_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.msl new file mode 100644 index 0000000000..842cf9d0ca --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 color_out_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + *(tint_symbol_5) = 0.699999988f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.color_out_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.color_out_1=tint_symbol_2.color_out_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..2f52f93e45 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color_out = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%float_0_699999988 = OpConstant %float 0.699999988 + %main_out = OpTypeStruct %v4float %float + %21 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %color_out %19 + OpStore %gl_FragDepth %float_0_699999988 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %21 +%tint_symbol = OpFunctionParameter %main_out + %25 = OpLabel + %26 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %26 + %27 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %27 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %void %main_1 + %32 = OpLoad %v4float %color_out + %33 = OpLoad %float %gl_FragDepth + %34 = OpCompositeConstruct %main_out %32 %33 + %31 = OpFunctionCall %void %tint_symbol_3 %34 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..8bf833ae8f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_less_or_equal/1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var color_out : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.699999988; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color_out, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm new file mode 100644 index 0000000000..0d5987dcb7 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %position + OpSource GLSL 430 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %_ "" + OpName %position "position" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %position Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %position = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 +%float_0_300000012 = OpConstant %float 0.300000012 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %7 + %21 = OpLabel + %22 = OpLoad %v4float %position + %23 = OpVectorShuffle %v2float %22 %22 0 1 + %24 = OpCompositeExtract %float %23 0 + %25 = OpCompositeExtract %float %23 1 + %26 = OpCompositeConstruct %v4float %24 %25 %float_0_300000012 %float_1 + %27 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %27 %26 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..c0bd655f3a --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_22 = position; + const float2 x_23 = float2(x_22.x, x_22.y); + gl_Position = float4(x_23.x, x_23.y, 0.300000012f, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..771a789d44 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_22 = *(tint_symbol_6); + float2 const x_23 = float2(x_22.x, x_22.y); + *(tint_symbol_7) = float4(x_23.x, x_23.y, 0.300000012f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..18e2bcafbb --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%float_0_300000012 = OpConstant %float 0.300000012 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %position + %20 = OpCompositeExtract %float %18 0 + %21 = OpCompositeExtract %float %18 1 + %22 = OpCompositeConstruct %v2float %20 %21 + %23 = OpCompositeExtract %float %22 0 + %24 = OpCompositeExtract %float %22 1 + %27 = OpCompositeConstruct %v4float %23 %24 %float_0_300000012 %float_1 + OpStore %gl_Position %27 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..1cc00dd49d --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.300000012, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl new file mode 100644 index 0000000000..1cc00dd49d --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.300000012, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..c0bd655f3a --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_22 = position; + const float2 x_23 = float2(x_22.x, x_22.y); + gl_Position = float4(x_23.x, x_23.y, 0.300000012f, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..771a789d44 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_22 = *(tint_symbol_6); + float2 const x_23 = float2(x_22.x, x_22.y); + *(tint_symbol_7) = float4(x_23.x, x_23.y, 0.300000012f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..18e2bcafbb --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%float_0_300000012 = OpConstant %float 0.300000012 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %position + %20 = OpCompositeExtract %float %18 0 + %21 = OpCompositeExtract %float %18 1 + %22 = OpCompositeConstruct %v2float %20 %21 + %23 = OpCompositeExtract %float %22 0 + %24 = OpCompositeExtract %float %22 1 + %27 = OpCompositeConstruct %v4float %23 %24 %float_0_300000012 %float_1 + OpStore %gl_Position %27 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..1cc00dd49d --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/0-opt.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.300000012, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm new file mode 100644 index 0000000000..2667aee07e --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm @@ -0,0 +1,31 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main EarlyFragmentTests + OpExecutionMode %main DepthReplacing + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %color_out Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output + %float_0_5 = OpConstant %float 0.5 + %main = OpFunction %void None %6 + %15 = OpLabel + OpStore %color_out %12 + OpStore %gl_FragDepth %float_0_5 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..434319539f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + color_out = float4(1.0f, 0.0f, 0.0f, 1.0f); + gl_FragDepth = 0.5f; + return; +} + +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 color_out_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {color_out, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.color_out_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.msl new file mode 100644 index 0000000000..ed4b69c082 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 color_out_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + *(tint_symbol_5) = 0.5f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.color_out_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.color_out_1=tint_symbol_2.color_out_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..a305e7a8cc --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color_out = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %main_out = OpTypeStruct %v4float %float + %21 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %color_out %19 + OpStore %gl_FragDepth %float_0_5 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %21 +%tint_symbol = OpFunctionParameter %main_out + %25 = OpLabel + %26 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %26 + %27 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %27 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %void %main_1 + %32 = OpLoad %v4float %color_out + %33 = OpLoad %float %gl_FragDepth + %34 = OpCompositeConstruct %main_out %32 %33 + %31 = OpFunctionCall %void %tint_symbol_3 %34 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..50511693c4 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var color_out : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.5; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color_out, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl new file mode 100644 index 0000000000..50511693c4 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl @@ -0,0 +1,22 @@ +var color_out : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.5; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color_out, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..434319539f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + color_out = float4(1.0f, 0.0f, 0.0f, 1.0f); + gl_FragDepth = 0.5f; + return; +} + +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 color_out_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {color_out, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.color_out_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.msl new file mode 100644 index 0000000000..ed4b69c082 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 color_out_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f); + *(tint_symbol_5) = 0.5f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.color_out_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.color_out_1=tint_symbol_2.color_out_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..a305e7a8cc --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %color_out "color_out" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color_out = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %float_0_5 = OpConstant %float 0.5 + %main_out = OpTypeStruct %v4float %float + %21 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %color_out %19 + OpStore %gl_FragDepth %float_0_5 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %21 +%tint_symbol = OpFunctionParameter %main_out + %25 = OpLabel + %26 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %26 + %27 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %27 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %29 = OpLabel + %30 = OpFunctionCall %void %main_1 + %32 = OpLoad %v4float %color_out + %33 = OpLoad %float %gl_FragDepth + %34 = OpCompositeConstruct %main_out %32 %33 + %31 = OpFunctionCall %void %tint_symbol_3 %34 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..50511693c4 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/early_fragment/depth_not_equal/1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var color_out : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.5; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(color_out, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm new file mode 100644 index 0000000000..872cc9fa70 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %position + OpSource GLSL 430 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %_ "" + OpName %position "position" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %position Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %position = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 +%float_0_699999988 = OpConstant %float 0.699999988 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %7 + %21 = OpLabel + %22 = OpLoad %v4float %position + %23 = OpVectorShuffle %v2float %22 %22 0 1 + %24 = OpCompositeExtract %float %23 0 + %25 = OpCompositeExtract %float %23 1 + %26 = OpCompositeConstruct %v4float %24 %25 %float_0_699999988 %float_1 + %27 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %27 %26 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..bf017e3047 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_22 = position; + const float2 x_23 = float2(x_22.x, x_22.y); + gl_Position = float4(x_23.x, x_23.y, 0.699999988f, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..0c5e876727 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_22 = *(tint_symbol_6); + float2 const x_23 = float2(x_22.x, x_22.y); + *(tint_symbol_7) = float4(x_23.x, x_23.y, 0.699999988f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..cf0602b045 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%float_0_699999988 = OpConstant %float 0.699999988 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %position + %20 = OpCompositeExtract %float %18 0 + %21 = OpCompositeExtract %float %18 1 + %22 = OpCompositeConstruct %v2float %20 %21 + %23 = OpCompositeExtract %float %22 0 + %24 = OpCompositeExtract %float %22 1 + %27 = OpCompositeConstruct %v4float %23 %24 %float_0_699999988 %float_1 + OpStore %gl_Position %27 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..788ee5b2e9 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.699999988, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl new file mode 100644 index 0000000000..788ee5b2e9 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.699999988, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..bf017e3047 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_22 = position; + const float2 x_23 = float2(x_22.x, x_22.y); + gl_Position = float4(x_23.x, x_23.y, 0.699999988f, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..0c5e876727 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_22 = *(tint_symbol_6); + float2 const x_23 = float2(x_22.x, x_22.y); + *(tint_symbol_7) = float4(x_23.x, x_23.y, 0.699999988f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..cf0602b045 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%float_0_699999988 = OpConstant %float 0.699999988 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %position + %20 = OpCompositeExtract %float %18 0 + %21 = OpCompositeExtract %float %18 1 + %22 = OpCompositeConstruct %v2float %20 %21 + %23 = OpCompositeExtract %float %22 0 + %24 = OpCompositeExtract %float %22 1 + %27 = OpCompositeConstruct %v4float %23 %24 %float_0_699999988 %float_1 + OpStore %gl_Position %27 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..788ee5b2e9 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_1/0-opt.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.699999988, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm new file mode 100644 index 0000000000..3d18840c81 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm @@ -0,0 +1,46 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %position + OpSource GLSL 430 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %_ "" + OpName %position "position" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %position Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %position = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 +%float_0_200000003 = OpConstant %float 0.200000003 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %7 + %21 = OpLabel + %22 = OpLoad %v4float %position + %23 = OpVectorShuffle %v2float %22 %22 0 1 + %24 = OpCompositeExtract %float %23 0 + %25 = OpCompositeExtract %float %23 1 + %26 = OpCompositeConstruct %v4float %24 %25 %float_0_200000003 %float_1 + %27 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %27 %26 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..0ae955521b --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_22 = position; + const float2 x_23 = float2(x_22.x, x_22.y); + gl_Position = float4(x_23.x, x_23.y, 0.200000003f, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..94ed6c12c0 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_22 = *(tint_symbol_6); + float2 const x_23 = float2(x_22.x, x_22.y); + *(tint_symbol_7) = float4(x_23.x, x_23.y, 0.200000003f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..240e6797d9 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%float_0_200000003 = OpConstant %float 0.200000003 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %position + %20 = OpCompositeExtract %float %18 0 + %21 = OpCompositeExtract %float %18 1 + %22 = OpCompositeConstruct %v2float %20 %21 + %23 = OpCompositeExtract %float %22 0 + %24 = OpCompositeExtract %float %22 1 + %27 = OpCompositeConstruct %v4float %23 %24 %float_0_200000003 %float_1 + OpStore %gl_Position %27 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..f71b32002d --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.200000003, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl new file mode 100644 index 0000000000..f71b32002d --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.200000003, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..0ae955521b --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float4 x_22 = position; + const float2 x_23 = float2(x_22.x, x_22.y); + gl_Position = float4(x_23.x, x_23.y, 0.200000003f, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..94ed6c12c0 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_22 = *(tint_symbol_6); + float2 const x_23 = float2(x_22.x, x_22.y); + *(tint_symbol_7) = float4(x_23.x, x_23.y, 0.200000003f, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..240e6797d9 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.spvasm @@ -0,0 +1,73 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%float_0_200000003 = OpConstant %float 0.200000003 + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %28 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %18 = OpLoad %v4float %position + %20 = OpCompositeExtract %float %18 0 + %21 = OpCompositeExtract %float %18 1 + %22 = OpCompositeConstruct %v2float %20 %21 + %23 = OpCompositeExtract %float %22 0 + %24 = OpCompositeExtract %float %22 1 + %27 = OpCompositeConstruct %v4float %23 %24 %float_0_200000003 %float_1 + OpStore %gl_Position %27 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %28 +%tint_symbol_1 = OpFunctionParameter %main_out + %32 = OpLabel + %33 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %33 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %35 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpCompositeConstruct %main_out %39 + %38 = OpFunctionCall %void %tint_symbol_3 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..f71b32002d --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/0-opt.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var position : vec4; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + let x_23 : vec2 = vec2(x_22.x, x_22.y); + gl_Position = vec4(x_23.x, x_23.y, 0.200000003, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm new file mode 100644 index 0000000000..ff79f72474 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm @@ -0,0 +1,30 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthGreater + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_0_300000012 = OpConstant %float 0.300000012 + %main = OpFunction %void None %6 + %14 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_0_300000012 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..5cb181313c --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static float4 outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + gl_FragDepth = 0.300000012f; + return; +} + +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 outColor_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {outColor, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.outColor_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.msl new file mode 100644 index 0000000000..620803a4f0 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 outColor_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + *(tint_symbol_5) = 0.300000012f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.outColor_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.outColor_1=tint_symbol_2.outColor_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..bb4715af47 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "outColor_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %outColor = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_300000012 = OpConstant %float 0.300000012 + %main_out = OpTypeStruct %v4float %float + %20 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %outColor %18 + OpStore %gl_FragDepth %float_0_300000012 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %20 +%tint_symbol = OpFunctionParameter %main_out + %24 = OpLabel + %25 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %25 + %26 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %26 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %void %main_1 + %31 = OpLoad %v4float %outColor + %32 = OpLoad %float %gl_FragDepth + %33 = OpCompositeConstruct %main_out %31 %32 + %30 = OpFunctionCall %void %tint_symbol_3 %33 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..b6e0701d00 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.300000012; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl new file mode 100644 index 0000000000..b6e0701d00 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.300000012; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..5cb181313c --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static float4 outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + gl_FragDepth = 0.300000012f; + return; +} + +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 outColor_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {outColor, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.outColor_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.msl new file mode 100644 index 0000000000..620803a4f0 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 outColor_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + *(tint_symbol_5) = 0.300000012f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.outColor_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.outColor_1=tint_symbol_2.outColor_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..bb4715af47 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "outColor_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %outColor = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_300000012 = OpConstant %float 0.300000012 + %main_out = OpTypeStruct %v4float %float + %20 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %outColor %18 + OpStore %gl_FragDepth %float_0_300000012 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %20 +%tint_symbol = OpFunctionParameter %main_out + %24 = OpLabel + %25 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %25 + %26 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %26 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %void %main_1 + %31 = OpLoad %v4float %outColor + %32 = OpLoad %float %gl_FragDepth + %33 = OpCompositeConstruct %main_out %31 %32 + %30 = OpFunctionCall %void %tint_symbol_3 %33 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..b6e0701d00 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthgreater_2/1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.300000012; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm new file mode 100644 index 0000000000..e503380237 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm @@ -0,0 +1,30 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthLess + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_0_100000001 = OpConstant %float 0.100000001 + %main = OpFunction %void None %6 + %14 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_0_100000001 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..195740d4e3 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static float4 outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + gl_FragDepth = 0.100000001f; + return; +} + +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 outColor_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {outColor, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.outColor_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.msl new file mode 100644 index 0000000000..1f7be87d42 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 outColor_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + *(tint_symbol_5) = 0.100000001f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.outColor_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.outColor_1=tint_symbol_2.outColor_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..d7a733d1cd --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "outColor_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %outColor = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_100000001 = OpConstant %float 0.100000001 + %main_out = OpTypeStruct %v4float %float + %20 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %outColor %18 + OpStore %gl_FragDepth %float_0_100000001 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %20 +%tint_symbol = OpFunctionParameter %main_out + %24 = OpLabel + %25 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %25 + %26 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %26 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %void %main_1 + %31 = OpLoad %v4float %outColor + %32 = OpLoad %float %gl_FragDepth + %33 = OpCompositeConstruct %main_out %31 %32 + %30 = OpFunctionCall %void %tint_symbol_3 %33 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..9f726a7476 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.100000001; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl new file mode 100644 index 0000000000..9f726a7476 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.100000001; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..195740d4e3 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static float4 outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + gl_FragDepth = 0.100000001f; + return; +} + +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 outColor_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {outColor, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.outColor_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.msl new file mode 100644 index 0000000000..1f7be87d42 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 outColor_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + *(tint_symbol_5) = 0.100000001f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.outColor_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.outColor_1=tint_symbol_2.outColor_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..d7a733d1cd --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "outColor_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %outColor = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_100000001 = OpConstant %float 0.100000001 + %main_out = OpTypeStruct %v4float %float + %20 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %outColor %18 + OpStore %gl_FragDepth %float_0_100000001 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %20 +%tint_symbol = OpFunctionParameter %main_out + %24 = OpLabel + %25 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %25 + %26 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %26 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %void %main_1 + %31 = OpLoad %v4float %outColor + %32 = OpLoad %float %gl_FragDepth + %33 = OpCompositeConstruct %main_out %31 %32 + %30 = OpFunctionCall %void %tint_symbol_3 %33 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..9f726a7476 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_0/1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.100000001; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm new file mode 100644 index 0000000000..29ea362631 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm @@ -0,0 +1,30 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthLess + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_0_600000024 = OpConstant %float 0.600000024 + %main = OpFunction %void None %6 + %14 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_0_600000024 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..d098fd2556 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static float4 outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + gl_FragDepth = 0.600000024f; + return; +} + +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 outColor_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {outColor, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.outColor_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.msl new file mode 100644 index 0000000000..ea4a1fc9cf --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 outColor_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + *(tint_symbol_5) = 0.600000024f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.outColor_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.outColor_1=tint_symbol_2.outColor_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..927ca49a8e --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "outColor_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %outColor = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_600000024 = OpConstant %float 0.600000024 + %main_out = OpTypeStruct %v4float %float + %20 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %outColor %18 + OpStore %gl_FragDepth %float_0_600000024 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %20 +%tint_symbol = OpFunctionParameter %main_out + %24 = OpLabel + %25 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %25 + %26 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %26 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %void %main_1 + %31 = OpLoad %v4float %outColor + %32 = OpLoad %float %gl_FragDepth + %33 = OpCompositeConstruct %main_out %31 %32 + %30 = OpFunctionCall %void %tint_symbol_3 %33 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..bc535caa16 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.600000024; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl new file mode 100644 index 0000000000..bc535caa16 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.600000024; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..d098fd2556 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static float4 outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + gl_FragDepth = 0.600000024f; + return; +} + +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 outColor_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {outColor, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.outColor_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.msl new file mode 100644 index 0000000000..ea4a1fc9cf --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 outColor_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + *(tint_symbol_5) = 0.600000024f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.outColor_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.outColor_1=tint_symbol_2.outColor_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..927ca49a8e --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "outColor_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %outColor = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_600000024 = OpConstant %float 0.600000024 + %main_out = OpTypeStruct %v4float %float + %20 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %outColor %18 + OpStore %gl_FragDepth %float_0_600000024 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %20 +%tint_symbol = OpFunctionParameter %main_out + %24 = OpLabel + %25 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %25 + %26 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %26 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %void %main_1 + %31 = OpLoad %v4float %outColor + %32 = OpLoad %float %gl_FragDepth + %33 = OpCompositeConstruct %main_out %31 %32 + %30 = OpFunctionCall %void %tint_symbol_3 %33 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc535caa16 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthless_2/1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.600000024; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm new file mode 100644 index 0000000000..544b4ffa52 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm @@ -0,0 +1,38 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthUnchanged + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Input_float = OpTypePointer Input %float + %main = OpFunction %void None %7 + %18 = OpLabel + OpStore %outColor %12 + %19 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_2 + %20 = OpLoad %float %19 + OpStore %gl_FragDepth %20 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..9aee57cc1a --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.hlsl @@ -0,0 +1,31 @@ +static float4 outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_20 = gl_FragCoord.z; + gl_FragDepth = x_20; + return; +} + +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 outColor_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {outColor, gl_FragDepth}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.outColor_1, tint_symbol_3.gl_FragDepth_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.msl new file mode 100644 index 0000000000..b08a200516 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_2 { + float4 outColor_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6, thread float* const tint_symbol_7) { + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + float const x_20 = (*(tint_symbol_6)).z; + *(tint_symbol_7) = x_20; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + thread float tint_symbol_10 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(&(tint_symbol_9), &(tint_symbol_8), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.outColor_1=tint_symbol_9, .gl_FragDepth_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_4 = {.outColor_1=tint_symbol_3.outColor_1, .gl_FragDepth_1=tint_symbol_3.gl_FragDepth_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..ce10d20e23 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "outColor_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_3 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %outColor = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_3 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %main_out = OpTypeStruct %v4float %float + %26 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %16 + %19 = OpLabel + OpStore %outColor %21 + %24 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_2 + %25 = OpLoad %float %24 + OpStore %gl_FragDepth %25 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %26 +%tint_symbol_1 = OpFunctionParameter %main_out + %30 = OpLabel + %31 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %31 + %32 = OpCompositeExtract %float %tint_symbol_1 1 + OpStore %tint_symbol_3 %32 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %16 + %34 = OpLabel + %35 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %35 + %36 = OpFunctionCall %void %main_1 + %38 = OpLoad %v4float %outColor + %39 = OpLoad %float %gl_FragDepth + %40 = OpCompositeConstruct %main_out %38 %39 + %37 = OpFunctionCall %void %tint_symbol_4 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..0fe24e6ab7 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.spvasm.expected.wgsl @@ -0,0 +1,26 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +var gl_FragCoord : vec4; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + let x_20 : f32 = gl_FragCoord.z; + gl_FragDepth = x_20; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl new file mode 100644 index 0000000000..0fe24e6ab7 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl @@ -0,0 +1,26 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +var gl_FragCoord : vec4; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + let x_20 : f32 = gl_FragCoord.z; + gl_FragDepth = x_20; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..9aee57cc1a --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.hlsl @@ -0,0 +1,31 @@ +static float4 outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + const float x_20 = gl_FragCoord.z; + gl_FragDepth = x_20; + return; +} + +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 outColor_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {outColor, gl_FragDepth}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.outColor_1, tint_symbol_3.gl_FragDepth_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.msl new file mode 100644 index 0000000000..b08a200516 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_2 { + float4 outColor_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6, thread float* const tint_symbol_7) { + *(tint_symbol_5) = float4(0.0f, 0.0f, 0.0f, 0.0f); + float const x_20 = (*(tint_symbol_6)).z; + *(tint_symbol_7) = x_20; + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + thread float tint_symbol_10 = 0.0f; + tint_symbol_8 = gl_FragCoord_param; + main_1(&(tint_symbol_9), &(tint_symbol_8), &(tint_symbol_10)); + main_out const tint_symbol_3 = {.outColor_1=tint_symbol_9, .gl_FragDepth_1=tint_symbol_10}; + tint_symbol_2 const tint_symbol_4 = {.outColor_1=tint_symbol_3.outColor_1, .gl_FragDepth_1=tint_symbol_3.gl_FragDepth_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..ce10d20e23 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 41 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "outColor_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpDecorate %tint_symbol_3 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %outColor = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_3 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %main_out = OpTypeStruct %v4float %float + %26 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %16 + %19 = OpLabel + OpStore %outColor %21 + %24 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_2 + %25 = OpLoad %float %24 + OpStore %gl_FragDepth %25 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %26 +%tint_symbol_1 = OpFunctionParameter %main_out + %30 = OpLabel + %31 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %31 + %32 = OpCompositeExtract %float %tint_symbol_1 1 + OpStore %tint_symbol_3 %32 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %16 + %34 = OpLabel + %35 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %35 + %36 = OpFunctionCall %void %main_1 + %38 = OpLoad %v4float %outColor + %39 = OpLoad %float %gl_FragDepth + %40 = OpCompositeConstruct %main_out %38 %39 + %37 = OpFunctionCall %void %tint_symbol_4 %40 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..0fe24e6ab7 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_0/1.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +var gl_FragCoord : vec4; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + let x_20 : f32 = gl_FragCoord.z; + gl_FragDepth = x_20; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm new file mode 100644 index 0000000000..65f7b457a8 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm @@ -0,0 +1,30 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthUnchanged + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_0_699999988 = OpConstant %float 0.699999988 + %main = OpFunction %void None %6 + %14 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_0_699999988 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..2776dc2003 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static float4 outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + gl_FragDepth = 0.699999988f; + return; +} + +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 outColor_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {outColor, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.outColor_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.msl new file mode 100644 index 0000000000..a3796dc735 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 outColor_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + *(tint_symbol_5) = 0.699999988f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.outColor_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.outColor_1=tint_symbol_2.outColor_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..9df6dabdf0 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "outColor_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %outColor = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_699999988 = OpConstant %float 0.699999988 + %main_out = OpTypeStruct %v4float %float + %20 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %outColor %18 + OpStore %gl_FragDepth %float_0_699999988 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %20 +%tint_symbol = OpFunctionParameter %main_out + %24 = OpLabel + %25 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %25 + %26 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %26 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %void %main_1 + %31 = OpLoad %v4float %outColor + %32 = OpLoad %float %gl_FragDepth + %33 = OpCompositeConstruct %main_out %31 %32 + %30 = OpFunctionCall %void %tint_symbol_3 %33 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..04a6db7787 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.699999988; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl new file mode 100644 index 0000000000..04a6db7787 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.699999988; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..2776dc2003 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static float4 outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + gl_FragDepth = 0.699999988f; + return; +} + +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 outColor_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {outColor, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.outColor_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.msl new file mode 100644 index 0000000000..a3796dc735 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 outColor_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + *(tint_symbol_5) = 0.699999988f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.outColor_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.outColor_1=tint_symbol_2.outColor_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..9df6dabdf0 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "outColor_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %outColor = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_699999988 = OpConstant %float 0.699999988 + %main_out = OpTypeStruct %v4float %float + %20 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %outColor %18 + OpStore %gl_FragDepth %float_0_699999988 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %20 +%tint_symbol = OpFunctionParameter %main_out + %24 = OpLabel + %25 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %25 + %26 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %26 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %void %main_1 + %31 = OpLoad %v4float %outColor + %32 = OpLoad %float %gl_FragDepth + %33 = OpCompositeConstruct %main_out %31 %32 + %30 = OpFunctionCall %void %tint_symbol_3 %33 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..04a6db7787 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_2/1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.699999988; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm new file mode 100644 index 0000000000..0842b2d69d --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm @@ -0,0 +1,30 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outColor %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpExecutionMode %main DepthUnchanged + OpSource GLSL 430 + OpName %main "main" + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %outColor Location 0 + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%float_0_400000006 = OpConstant %float 0.400000006 + %main = OpFunction %void None %6 + %14 = OpLabel + OpStore %outColor %11 + OpStore %gl_FragDepth %float_0_400000006 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..7047d54407 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +static float4 outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + gl_FragDepth = 0.400000006f; + return; +} + +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 outColor_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {outColor, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.outColor_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.msl new file mode 100644 index 0000000000..99a77a3fec --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 outColor_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + *(tint_symbol_5) = 0.400000006f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.outColor_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.outColor_1=tint_symbol_2.outColor_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..abc3df811d --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "outColor_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %outColor = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_400000006 = OpConstant %float 0.400000006 + %main_out = OpTypeStruct %v4float %float + %20 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %outColor %18 + OpStore %gl_FragDepth %float_0_400000006 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %20 +%tint_symbol = OpFunctionParameter %main_out + %24 = OpLabel + %25 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %25 + %26 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %26 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %void %main_1 + %31 = OpLoad %v4float %outColor + %32 = OpLoad %float %gl_FragDepth + %33 = OpCompositeConstruct %main_out %31 %32 + %30 = OpFunctionCall %void %tint_symbol_3 %33 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..f6cb3ea08f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.400000006; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl new file mode 100644 index 0000000000..f6cb3ea08f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.400000006; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..7047d54407 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.hlsl @@ -0,0 +1,24 @@ +static float4 outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float gl_FragDepth = 0.0f; + +void main_1() { + outColor = float4(0.0f, 0.0f, 0.0f, 0.0f); + gl_FragDepth = 0.400000006f; + return; +} + +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol { + float4 outColor_1 : SV_Target0; + float gl_FragDepth_1 : SV_Depth; +}; + +tint_symbol main() { + main_1(); + const main_out tint_symbol_1 = {outColor, gl_FragDepth}; + const tint_symbol tint_symbol_2 = {tint_symbol_1.outColor_1, tint_symbol_1.gl_FragDepth_1}; + return tint_symbol_2; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.msl new file mode 100644 index 0000000000..99a77a3fec --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 outColor_1; + float gl_FragDepth_1; +}; +struct tint_symbol_1 { + float4 outColor_1 [[color(0)]]; + float gl_FragDepth_1 [[depth(any)]]; +}; + +void main_1(thread float4* const tint_symbol_4, thread float* const tint_symbol_5) { + *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f); + *(tint_symbol_5) = 0.400000006f; + return; +} + +fragment tint_symbol_1 tint_symbol() { + thread float4 tint_symbol_6 = 0.0f; + thread float tint_symbol_7 = 0.0f; + main_1(&(tint_symbol_6), &(tint_symbol_7)); + main_out const tint_symbol_2 = {.outColor_1=tint_symbol_6, .gl_FragDepth_1=tint_symbol_7}; + tint_symbol_1 const tint_symbol_3 = {.outColor_1=tint_symbol_2.outColor_1, .gl_FragDepth_1=tint_symbol_2.gl_FragDepth_1}; + return tint_symbol_3; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..abc3df811d --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.spvasm @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpName %outColor "outColor" + OpName %gl_FragDepth "gl_FragDepth" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "outColor_1" + OpMemberName %main_out 1 "gl_FragDepth_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol "tint_symbol" + OpName %main "main" + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_2 BuiltIn FragDepth + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %outColor = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Private_float = OpTypePointer Private %float + %8 = OpConstantNull %float +%gl_FragDepth = OpVariable %_ptr_Private_float Private %8 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5 +%_ptr_Output_float = OpTypePointer Output %float +%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_400000006 = OpConstant %float 0.400000006 + %main_out = OpTypeStruct %v4float %float + %20 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %13 + %16 = OpLabel + OpStore %outColor %18 + OpStore %gl_FragDepth %float_0_400000006 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %20 +%tint_symbol = OpFunctionParameter %main_out + %24 = OpLabel + %25 = OpCompositeExtract %v4float %tint_symbol 0 + OpStore %tint_symbol_1 %25 + %26 = OpCompositeExtract %float %tint_symbol 1 + OpStore %tint_symbol_2 %26 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %13 + %28 = OpLabel + %29 = OpFunctionCall %void %main_1 + %31 = OpLoad %v4float %outColor + %32 = OpLoad %float %gl_FragDepth + %33 = OpCompositeConstruct %main_out %31 %32 + %30 = OpFunctionCall %void %tint_symbol_3 %33 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..f6cb3ea08f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/graphics/execution_mode/depthunchanged_3/1.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var outColor : vec4; + +var gl_FragDepth : f32; + +fn main_1() { + outColor = vec4(0.0, 0.0, 0.0, 0.0); + gl_FragDepth = 0.400000006; + return; +} + +struct main_out { + [[location(0)]] + outColor_1 : vec4; + [[builtin(frag_depth)]] + gl_FragDepth_1 : f32; +}; + +[[stage(fragment)]] +fn main() -> main_out { + main_1(); + return main_out(outColor, gl_FragDepth); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm new file mode 100644 index 0000000000..ba4adaf969 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm @@ -0,0 +1,48 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %position %pos + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %position "position" + OpName %pos "pos" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %position Location 0 + OpDecorate %pos Flat + OpDecorate %pos Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %position = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output_uint = OpTypePointer Output %uint + %pos = OpVariable %_ptr_Output_uint Output + %uint_0 = OpConstant %uint 0 + %main = OpFunction %void None %8 + %21 = OpLabel + %22 = OpLoad %v4float %position + %23 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %23 %22 + OpStore %pos %uint_0 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..b121d9e595 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.hlsl @@ -0,0 +1,30 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static uint pos = 0u; +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + gl_Position = position; + pos = 0u; + return; +} + +struct main_out { + float4 gl_Position; + uint pos_1; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + uint pos_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position, pos}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.pos_1, tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.msl new file mode 100644 index 0000000000..5a99a8eaf6 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; + uint pos_1; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + uint pos_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7, thread uint* const tint_symbol_8) { + float4 const x_22 = *(tint_symbol_6); + *(tint_symbol_7) = x_22; + *(tint_symbol_8) = 0u; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + thread uint tint_symbol_11 = 0u; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_9 = position_param; + main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_10, .pos_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.pos_1=tint_symbol_4.pos_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..b7ee73556c --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %pos "pos" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpMemberName %main_out 1 "pos_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpDecorate %tint_symbol_3 Location 0 + OpDecorate %tint_symbol_3 Flat + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %12 = OpConstantNull %uint + %pos = OpVariable %_ptr_Private_uint Private %12 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 +%_ptr_Output_uint = OpTypePointer Output %uint +%tint_symbol_3 = OpVariable %_ptr_Output_uint Output %12 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %main_out = OpTypeStruct %v4float %uint + %26 = OpTypeFunction %void %main_out + %float_1 = OpConstant %float 1 + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %24 = OpLoad %v4float %position + OpStore %gl_Position %24 + OpStore %pos %uint_0 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %26 +%tint_symbol_1 = OpFunctionParameter %main_out + %30 = OpLabel + %31 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %31 + %32 = OpCompositeExtract %uint %tint_symbol_1 1 + OpStore %tint_symbol_3 %32 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %34 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpLoad %uint %pos + %41 = OpCompositeConstruct %main_out %39 %40 + %38 = OpFunctionCall %void %tint_symbol_4 %41 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..081740c776 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.spvasm.expected.wgsl @@ -0,0 +1,26 @@ +var position : vec4; + +var pos : u32; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + gl_Position = x_22; + pos = 0u; + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; + [[location(0)]] + pos_1 : u32; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position, pos); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl new file mode 100644 index 0000000000..081740c776 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl @@ -0,0 +1,26 @@ +var position : vec4; + +var pos : u32; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + gl_Position = x_22; + pos = 0u; + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; + [[location(0)]] + pos_1 : u32; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position, pos); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..b121d9e595 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.hlsl @@ -0,0 +1,30 @@ +static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f); +static uint pos = 0u; +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + gl_Position = position; + pos = 0u; + return; +} + +struct main_out { + float4 gl_Position; + uint pos_1; +}; +struct tint_symbol_1 { + float4 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + uint pos_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position, pos}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.pos_1, tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.msl new file mode 100644 index 0000000000..5a99a8eaf6 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.msl @@ -0,0 +1,34 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; + uint pos_1; +}; +struct tint_symbol_2 { + float4 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + uint pos_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7, thread uint* const tint_symbol_8) { + float4 const x_22 = *(tint_symbol_6); + *(tint_symbol_7) = x_22; + *(tint_symbol_8) = 0u; + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_9 = 0.0f; + thread float4 tint_symbol_10 = 0.0f; + thread uint tint_symbol_11 = 0u; + float4 const position_param = tint_symbol_1.position_param; + tint_symbol_9 = position_param; + main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_10, .pos_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.pos_1=tint_symbol_4.pos_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..b7ee73556c --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.spvasm @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %pos "pos" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpMemberName %main_out 1 "pos_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpDecorate %tint_symbol_3 Location 0 + OpDecorate %tint_symbol_3 Flat + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %8 = OpConstantNull %v4float + %position = OpVariable %_ptr_Private_v4float Private %8 + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %12 = OpConstantNull %uint + %pos = OpVariable %_ptr_Private_uint Private %12 +%gl_Position = OpVariable %_ptr_Private_v4float Private %8 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %8 +%_ptr_Output_uint = OpTypePointer Output %uint +%tint_symbol_3 = OpVariable %_ptr_Output_uint Output %12 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %main_out = OpTypeStruct %v4float %uint + %26 = OpTypeFunction %void %main_out + %float_1 = OpConstant %float 1 + %main_1 = OpFunction %void None %20 + %23 = OpLabel + %24 = OpLoad %v4float %position + OpStore %gl_Position %24 + OpStore %pos %uint_0 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %26 +%tint_symbol_1 = OpFunctionParameter %main_out + %30 = OpLabel + %31 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %31 + %32 = OpCompositeExtract %uint %tint_symbol_1 1 + OpStore %tint_symbol_3 %32 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %34 = OpLabel + OpStore %tint_pointsize %float_1 + %36 = OpLoad %v4float %tint_symbol + OpStore %position %36 + %37 = OpFunctionCall %void %main_1 + %39 = OpLoad %v4float %gl_Position + %40 = OpLoad %uint %pos + %41 = OpCompositeConstruct %main_out %39 %40 + %38 = OpFunctionCall %void %tint_symbol_4 %41 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..081740c776 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/spirv1p4/hlsl_functionality1/decorate_string/0.wgsl.expected.wgsl @@ -0,0 +1,26 @@ +var position : vec4; + +var pos : u32; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec4 = position; + gl_Position = x_22; + pos = 0u; + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; + [[location(0)]] + pos_1 : u32; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec4) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position, pos); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm new file mode 100644 index 0000000000..b74d27f19f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm @@ -0,0 +1,36 @@ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %1 "main" %2 %3 %4 %5 + OpDecorate %2 Location 0 + OpDecorate %3 Location 1 + OpDecorate %4 Location 0 + OpDecorate %_struct_6 Block + OpMemberDecorate %_struct_6 0 BuiltIn Position + %void = OpTypeVoid + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 + %v3float = OpTypeVector %float 3 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_int = OpTypePointer Output %int + %_struct_6 = OpTypeStruct %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output__struct_6 = OpTypePointer Output %_struct_6 + %2 = OpVariable %_ptr_Input_v3float Input + %3 = OpVariable %_ptr_Input_int Input + %4 = OpVariable %_ptr_Output_int Output + %5 = OpVariable %_ptr_Output__struct_6 Output + %20 = OpTypeFunction %void + %1 = OpFunction %void None %20 + %21 = OpLabel + %22 = OpLoad %v3float %2 + %23 = OpCompositeConstruct %v4float %22 %float_1 + %24 = OpAccessChain %_ptr_Output_v4float %5 %int_0 + OpStore %24 %23 + OpCopyMemory %4 %3 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..4d470f29a4 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.hlsl @@ -0,0 +1,34 @@ +static float3 x_2 = float3(0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + gl_Position = float4(x_2, 1.0f); + x_4 = x_3; + return; +} + +struct main_out { + int x_4_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float3 x_2_param : TEXCOORD0; + int x_3_param : TEXCOORD1; +}; +struct tint_symbol_2 { + int x_4_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float3 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4, gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_4_1, tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..fcba4ccff0 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct main_out { + int x_4_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float3 x_2_param [[attribute(0)]]; + int x_3_param [[attribute(1)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void main_1(thread float3* const tint_symbol_6, thread float4* const tint_symbol_7, thread int* const tint_symbol_8, thread int* const tint_symbol_9) { + float3 const x_22 = *(tint_symbol_6); + *(tint_symbol_7) = float4(x_22, 1.0f); + *(tint_symbol_8) = *(tint_symbol_9); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float3 tint_symbol_10 = 0.0f; + thread int tint_symbol_11 = 0; + thread float4 tint_symbol_12 = 0.0f; + thread int tint_symbol_13 = 0; + float3 const x_2_param = tint_symbol_1.x_2_param; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_10 = x_2_param; + tint_symbol_11 = x_3_param; + main_1(&(tint_symbol_10), &(tint_symbol_12), &(tint_symbol_13), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_13, .gl_Position=tint_symbol_12}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..2bfe24c6a6 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_1 %tint_symbol_3 %tint_symbol_4 + OpName %tint_pointsize "tint_pointsize" + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_5 "tint_symbol_5" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_1 Location 1 + OpDecorate %tint_symbol_3 Location 0 + OpDecorate %tint_symbol_3 Flat + OpDecorate %tint_symbol_4 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v3float = OpTypeVector %float 3 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %8 = OpConstantNull %v3float + %x_2 = OpVariable %_ptr_Private_v3float Private %8 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %12 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %12 + %x_4 = OpVariable %_ptr_Private_int Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_Position = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%tint_symbol = OpVariable %_ptr_Input_v3float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_4 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %26 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %int %v4float + %37 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %26 + %29 = OpLabel + %30 = OpLoad %v3float %x_2 + %31 = OpCompositeExtract %float %30 0 + %32 = OpCompositeExtract %float %30 1 + %33 = OpCompositeExtract %float %30 2 + %35 = OpCompositeConstruct %v4float %31 %32 %33 %float_1 + OpStore %gl_Position %35 + %36 = OpLoad %int %x_3 + OpStore %x_4 %36 + OpReturn + OpFunctionEnd +%tint_symbol_5 = OpFunction %void None %37 +%tint_symbol_2 = OpFunctionParameter %main_out + %41 = OpLabel + %42 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %42 + %43 = OpCompositeExtract %v4float %tint_symbol_2 1 + OpStore %tint_symbol_4 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %26 + %45 = OpLabel + OpStore %tint_pointsize %float_1 + %46 = OpLoad %v3float %tint_symbol + OpStore %x_2 %46 + %47 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %47 + %48 = OpFunctionCall %void %main_1 + %50 = OpLoad %int %x_4 + %51 = OpLoad %v4float %gl_Position + %52 = OpCompositeConstruct %main_out %50 %51 + %49 = OpFunctionCall %void %tint_symbol_5 %52 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..9959aa6072 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var x_2 : vec3; + +var x_3 : i32; + +var x_4 : i32; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec3 = x_2; + gl_Position = vec4(x_22, 1.0); + x_4 = x_3; + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_2_param : vec3, [[location(1)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4, gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl new file mode 100644 index 0000000000..9959aa6072 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl @@ -0,0 +1,29 @@ +var x_2 : vec3; + +var x_3 : i32; + +var x_4 : i32; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec3 = x_2; + gl_Position = vec4(x_22, 1.0); + x_4 = x_3; + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_2_param : vec3, [[location(1)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4, gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..4d470f29a4 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +static float3 x_2 = float3(0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + gl_Position = float4(x_2, 1.0f); + x_4 = x_3; + return; +} + +struct main_out { + int x_4_1; + float4 gl_Position; +}; +struct tint_symbol_1 { + float3 x_2_param : TEXCOORD0; + int x_3_param : TEXCOORD1; +}; +struct tint_symbol_2 { + int x_4_1 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float3 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4, gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_4_1, tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..fcba4ccff0 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct main_out { + int x_4_1; + float4 gl_Position; +}; +struct tint_symbol_2 { + float3 x_2_param [[attribute(0)]]; + int x_3_param [[attribute(1)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +void main_1(thread float3* const tint_symbol_6, thread float4* const tint_symbol_7, thread int* const tint_symbol_8, thread int* const tint_symbol_9) { + float3 const x_22 = *(tint_symbol_6); + *(tint_symbol_7) = float4(x_22, 1.0f); + *(tint_symbol_8) = *(tint_symbol_9); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float3 tint_symbol_10 = 0.0f; + thread int tint_symbol_11 = 0; + thread float4 tint_symbol_12 = 0.0f; + thread int tint_symbol_13 = 0; + float3 const x_2_param = tint_symbol_1.x_2_param; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_10 = x_2_param; + tint_symbol_11 = x_3_param; + main_1(&(tint_symbol_10), &(tint_symbol_12), &(tint_symbol_13), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_13, .gl_Position=tint_symbol_12}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1, .gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..2bfe24c6a6 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_1 %tint_symbol_3 %tint_symbol_4 + OpName %tint_pointsize "tint_pointsize" + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpMemberName %main_out 1 "gl_Position" + OpName %tint_symbol_5 "tint_symbol_5" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_1 Location 1 + OpDecorate %tint_symbol_3 Location 0 + OpDecorate %tint_symbol_3 Flat + OpDecorate %tint_symbol_4 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + OpMemberDecorate %main_out 1 Offset 16 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v3float = OpTypeVector %float 3 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %8 = OpConstantNull %v3float + %x_2 = OpVariable %_ptr_Private_v3float Private %8 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %12 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %12 + %x_4 = OpVariable %_ptr_Private_int Private %12 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %17 = OpConstantNull %v4float +%gl_Position = OpVariable %_ptr_Private_v4float Private %17 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%tint_symbol = OpVariable %_ptr_Input_v3float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %12 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_4 = OpVariable %_ptr_Output_v4float Output %17 + %void = OpTypeVoid + %26 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %int %v4float + %37 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %26 + %29 = OpLabel + %30 = OpLoad %v3float %x_2 + %31 = OpCompositeExtract %float %30 0 + %32 = OpCompositeExtract %float %30 1 + %33 = OpCompositeExtract %float %30 2 + %35 = OpCompositeConstruct %v4float %31 %32 %33 %float_1 + OpStore %gl_Position %35 + %36 = OpLoad %int %x_3 + OpStore %x_4 %36 + OpReturn + OpFunctionEnd +%tint_symbol_5 = OpFunction %void None %37 +%tint_symbol_2 = OpFunctionParameter %main_out + %41 = OpLabel + %42 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %42 + %43 = OpCompositeExtract %v4float %tint_symbol_2 1 + OpStore %tint_symbol_4 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %26 + %45 = OpLabel + OpStore %tint_pointsize %float_1 + %46 = OpLoad %v3float %tint_symbol + OpStore %x_2 %46 + %47 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %47 + %48 = OpFunctionCall %void %main_1 + %50 = OpLoad %int %x_4 + %51 = OpLoad %v4float %gl_Position + %52 = OpCompositeConstruct %main_out %50 %51 + %49 = OpFunctionCall %void %tint_symbol_5 %52 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..9959aa6072 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_atomic/0-opt.wgsl.expected.wgsl @@ -0,0 +1,29 @@ +var x_2 : vec3; + +var x_3 : i32; + +var x_4 : i32; + +var gl_Position : vec4; + +fn main_1() { + let x_22 : vec3 = x_2; + gl_Position = vec4(x_22, 1.0); + x_4 = x_3; + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] x_2_param : vec3, [[location(1)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4, gl_Position); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm new file mode 100644 index 0000000000..d84314ba71 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm @@ -0,0 +1,58 @@ + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %1 "main" %gl_FragCoord %3 %4 + OpExecutionMode %1 OriginUpperLeft + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %3 Location 0 + OpDecorate %3 Flat + OpDecorate %4 Location 0 + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + %void = OpTypeVoid + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_8 = OpConstant %int 8 + %v2int = OpTypeVector %int 2 + %v4int = OpTypeVector %int 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_int = OpTypePointer Output %int +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %3 = OpVariable %_ptr_Input_int Input + %4 = OpVariable %_ptr_Output_int Output + %19 = OpTypeImage %int 2D 0 0 0 2 R32i +%_ptr_UniformConstant_19 = OpTypePointer UniformConstant %19 + %5 = OpVariable %_ptr_UniformConstant_19 UniformConstant + %21 = OpTypeFunction %void + %1 = OpFunction %void None %21 + %22 = OpLabel + OpStore %4 %int_1 + %23 = OpLoad %v4float %gl_FragCoord + %24 = OpCompositeExtract %float %23 0 + %25 = OpCompositeExtract %float %23 1 + %26 = OpCompositeExtract %float %23 2 + %27 = OpConvertFToS %int %24 + %28 = OpConvertFToS %int %25 + %29 = OpConvertFToS %int %26 + %30 = OpBitwiseAnd %int %27 %int_1 + %31 = OpBitwiseAnd %int %28 %int_1 + %32 = OpIAdd %int %30 %31 + %33 = OpLoad %int %3 + %34 = OpIAdd %int %32 %33 + %35 = OpIEqual %bool %34 %29 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %36 + %37 = OpLabel + OpTerminateInvocation + %36 = OpLabel + %38 = OpCompositeConstruct %v4int %27 %int_0 %int_0 %int_0 + %39 = OpCompositeConstruct %v2int %27 %28 + %40 = OpLoad %19 %5 + OpImageWrite %40 %39 %38 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..0097cb232c --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.hlsl @@ -0,0 +1,37 @@ +static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; +RWTexture2D x_5 : register(u0, space0); + +void main_1() { + x_4 = 1; + const float4 x_23 = x_2; + const int x_27 = int(x_23.x); + const int x_28 = int(x_23.y); + if (((((x_27 & 1) + (x_28 & 1)) + x_3) == int(x_23.z))) { + } + x_5[int2(x_27, x_28)] = int4(x_27, 0, 0, 0); + return; +} + +struct main_out { + int x_4_1; +}; +struct tint_symbol_1 { + int x_3_param : TEXCOORD0; + float4 x_2_param : SV_Position; +}; +struct tint_symbol_2 { + int x_4_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_4_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.msl new file mode 100644 index 0000000000..88c8f1c3cd --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct main_out { + int x_4_1; +}; +struct tint_symbol_2 { + int x_3_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[color(0)]]; +}; + +void main_1(thread int* const tint_symbol_6, thread float4* const tint_symbol_7, thread int* const tint_symbol_8, texture2d tint_symbol_9) { + *(tint_symbol_6) = 1; + float4 const x_23 = *(tint_symbol_7); + int const x_27 = int(x_23.x); + int const x_28 = int(x_23.y); + int const x_33 = *(tint_symbol_8); + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == int(x_23.z))) { + } + tint_symbol_9.write(int4(x_27, 0, 0, 0), uint2(int2(x_27, x_28))); + return; +} + +fragment tint_symbol_3 tint_symbol(texture2d tint_symbol_13 [[texture(0)]], float4 x_2_param [[position]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_10 = 0.0f; + thread int tint_symbol_11 = 0; + thread int tint_symbol_12 = 0; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_10 = x_2_param; + tint_symbol_11 = x_3_param; + main_1(&(tint_symbol_12), &(tint_symbol_10), &(tint_symbol_11), tint_symbol_13); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_12}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..3a722c8f03 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %x_5 "x_5" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %x_5 NonReadable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_1 Flat + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_2 = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %9 + %x_4 = OpVariable %_ptr_Private_int Private %9 + %13 = OpTypeImage %int 2D 0 0 0 2 R32i +%_ptr_UniformConstant_13 = OpTypePointer UniformConstant %13 + %x_5 = OpVariable %_ptr_UniformConstant_13 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %v2int = OpTypeVector %int 2 + %v4int = OpTypeVector %int 4 + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %int + %48 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + OpStore %x_4 %int_1 + %25 = OpLoad %v4float %x_2 + %27 = OpCompositeExtract %float %25 0 + %26 = OpConvertFToS %int %27 + %29 = OpCompositeExtract %float %25 1 + %28 = OpConvertFToS %int %29 + %30 = OpLoad %int %x_3 + %31 = OpBitwiseAnd %int %26 %int_1 + %32 = OpBitwiseAnd %int %28 %int_1 + %33 = OpIAdd %int %31 %32 + %34 = OpIAdd %int %33 %30 + %36 = OpCompositeExtract %float %25 2 + %35 = OpConvertFToS %int %36 + %37 = OpIEqual %bool %34 %35 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %39 + %40 = OpLabel + OpBranch %39 + %39 = OpLabel + %42 = OpLoad %13 %x_5 + %44 = OpCompositeConstruct %v2int %26 %28 + %47 = OpCompositeConstruct %v4int %26 %int_0 %int_0 %int_0 + OpImageWrite %42 %44 %47 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %48 +%tint_symbol_2 = OpFunctionParameter %main_out + %52 = OpLabel + %53 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %53 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %55 = OpLabel + %56 = OpLoad %v4float %tint_symbol + OpStore %x_2 %56 + %57 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %57 + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %int %x_4 + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_4 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..0f3c7320e5 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +[[group(0), binding(0)]] var x_5 : texture_storage_2d; + +fn main_1() { + x_4 = 1; + let x_23 : vec4 = x_2; + let x_27 : i32 = i32(x_23.x); + let x_28 : i32 = i32(x_23.y); + let x_33 : i32 = x_3; + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == i32(x_23.z))) { + } + textureStore(x_5, vec2(x_27, x_28), vec4(x_27, 0, 0, 0)); + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl new file mode 100644 index 0000000000..0f3c7320e5 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl @@ -0,0 +1,32 @@ +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +[[group(0), binding(0)]] var x_5 : texture_storage_2d; + +fn main_1() { + x_4 = 1; + let x_23 : vec4 = x_2; + let x_27 : i32 = i32(x_23.x); + let x_28 : i32 = i32(x_23.y); + let x_33 : i32 = x_3; + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == i32(x_23.z))) { + } + textureStore(x_5, vec2(x_27, x_28), vec4(x_27, 0, 0, 0)); + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..0097cb232c --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; +RWTexture2D x_5 : register(u0, space0); + +void main_1() { + x_4 = 1; + const float4 x_23 = x_2; + const int x_27 = int(x_23.x); + const int x_28 = int(x_23.y); + if (((((x_27 & 1) + (x_28 & 1)) + x_3) == int(x_23.z))) { + } + x_5[int2(x_27, x_28)] = int4(x_27, 0, 0, 0); + return; +} + +struct main_out { + int x_4_1; +}; +struct tint_symbol_1 { + int x_3_param : TEXCOORD0; + float4 x_2_param : SV_Position; +}; +struct tint_symbol_2 { + int x_4_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_4_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.msl new file mode 100644 index 0000000000..88c8f1c3cd --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.msl @@ -0,0 +1,38 @@ +#include + +using namespace metal; +struct main_out { + int x_4_1; +}; +struct tint_symbol_2 { + int x_3_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[color(0)]]; +}; + +void main_1(thread int* const tint_symbol_6, thread float4* const tint_symbol_7, thread int* const tint_symbol_8, texture2d tint_symbol_9) { + *(tint_symbol_6) = 1; + float4 const x_23 = *(tint_symbol_7); + int const x_27 = int(x_23.x); + int const x_28 = int(x_23.y); + int const x_33 = *(tint_symbol_8); + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == int(x_23.z))) { + } + tint_symbol_9.write(int4(x_27, 0, 0, 0), uint2(int2(x_27, x_28))); + return; +} + +fragment tint_symbol_3 tint_symbol(texture2d tint_symbol_13 [[texture(0)]], float4 x_2_param [[position]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_10 = 0.0f; + thread int tint_symbol_11 = 0; + thread int tint_symbol_12 = 0; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_10 = x_2_param; + tint_symbol_11 = x_3_param; + main_1(&(tint_symbol_12), &(tint_symbol_10), &(tint_symbol_11), tint_symbol_13); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_12}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..3a722c8f03 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.spvasm @@ -0,0 +1,104 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %x_5 "x_5" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %x_5 NonReadable + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_1 Flat + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_2 = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %9 + %x_4 = OpVariable %_ptr_Private_int Private %9 + %13 = OpTypeImage %int 2D 0 0 0 2 R32i +%_ptr_UniformConstant_13 = OpTypePointer UniformConstant %13 + %x_5 = OpVariable %_ptr_UniformConstant_13 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %20 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %v2int = OpTypeVector %int 2 + %v4int = OpTypeVector %int 4 + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %int + %48 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %20 + %23 = OpLabel + OpStore %x_4 %int_1 + %25 = OpLoad %v4float %x_2 + %27 = OpCompositeExtract %float %25 0 + %26 = OpConvertFToS %int %27 + %29 = OpCompositeExtract %float %25 1 + %28 = OpConvertFToS %int %29 + %30 = OpLoad %int %x_3 + %31 = OpBitwiseAnd %int %26 %int_1 + %32 = OpBitwiseAnd %int %28 %int_1 + %33 = OpIAdd %int %31 %32 + %34 = OpIAdd %int %33 %30 + %36 = OpCompositeExtract %float %25 2 + %35 = OpConvertFToS %int %36 + %37 = OpIEqual %bool %34 %35 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %39 + %40 = OpLabel + OpBranch %39 + %39 = OpLabel + %42 = OpLoad %13 %x_5 + %44 = OpCompositeConstruct %v2int %26 %28 + %47 = OpCompositeConstruct %v4int %26 %int_0 %int_0 %int_0 + OpImageWrite %42 %44 %47 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %48 +%tint_symbol_2 = OpFunctionParameter %main_out + %52 = OpLabel + %53 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %53 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %20 + %55 = OpLabel + %56 = OpLoad %v4float %tint_symbol + OpStore %x_2 %56 + %57 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %57 + %58 = OpFunctionCall %void %main_1 + %60 = OpLoad %int %x_4 + %61 = OpCompositeConstruct %main_out %60 + %59 = OpFunctionCall %void %tint_symbol_4 %61 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..0f3c7320e5 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.wgsl @@ -0,0 +1,32 @@ +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +[[group(0), binding(0)]] var x_5 : texture_storage_2d; + +fn main_1() { + x_4 = 1; + let x_23 : vec4 = x_2; + let x_27 : i32 = i32(x_23.x); + let x_28 : i32 = i32(x_23.y); + let x_33 : i32 = x_3; + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == i32(x_23.z))) { + } + textureStore(x_5, vec2(x_27, x_28), vec4(x_27, 0, 0, 0)); + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm new file mode 100644 index 0000000000..e70d79aec9 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm @@ -0,0 +1,45 @@ + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %1 "main" %gl_FragCoord %3 %4 + OpExecutionMode %1 OriginUpperLeft + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %3 Location 0 + OpDecorate %3 Flat + OpDecorate %4 Location 0 + %void = OpTypeVoid + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_int = OpTypePointer Output %int +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %3 = OpVariable %_ptr_Input_int Input + %4 = OpVariable %_ptr_Output_int Output + %14 = OpTypeFunction %void + %1 = OpFunction %void None %14 + %15 = OpLabel + %16 = OpLoad %v4float %gl_FragCoord + %17 = OpCompositeExtract %float %16 0 + %18 = OpCompositeExtract %float %16 1 + %19 = OpCompositeExtract %float %16 2 + %20 = OpConvertFToS %int %17 + %21 = OpConvertFToS %int %18 + %22 = OpConvertFToS %int %19 + %23 = OpBitwiseAnd %int %20 %int_1 + %24 = OpBitwiseAnd %int %21 %int_1 + %25 = OpIAdd %int %23 %24 + %26 = OpLoad %int %3 + %27 = OpIAdd %int %25 %26 + %28 = OpIEqual %bool %27 %22 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %29 + %30 = OpLabel + OpTerminateInvocation + %29 = OpLabel + OpStore %4 %int_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..a97b541ec0 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.hlsl @@ -0,0 +1,33 @@ +static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; + +void main_1() { + const float4 x_16 = x_2; + if (((((int(x_16.x) & 1) + (int(x_16.y) & 1)) + x_3) == int(x_16.z))) { + } + x_4 = 1; + return; +} + +struct main_out { + int x_4_1; +}; +struct tint_symbol_1 { + int x_3_param : TEXCOORD0; + float4 x_2_param : SV_Position; +}; +struct tint_symbol_2 { + int x_4_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_4_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.msl new file mode 100644 index 0000000000..a72a5095c5 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct main_out { + int x_4_1; +}; +struct tint_symbol_2 { + int x_3_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread int* const tint_symbol_7, thread int* const tint_symbol_8) { + float4 const x_16 = *(tint_symbol_6); + int const x_26 = *(tint_symbol_7); + if (((((int(x_16.x) & 1) + (int(x_16.y) & 1)) + x_26) == int(x_16.z))) { + } + *(tint_symbol_8) = 1; + return; +} + +fragment tint_symbol_3 tint_symbol(float4 x_2_param [[position]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_9 = 0.0f; + thread int tint_symbol_10 = 0; + thread int tint_symbol_11 = 0; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_9 = x_2_param; + tint_symbol_10 = x_3_param; + main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..99bfcd9c50 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_1 Flat + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_2 = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %9 + %x_4 = OpVariable %_ptr_Private_int Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %int + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %17 + %20 = OpLabel + %21 = OpLoad %v4float %x_2 + %22 = OpLoad %int %x_3 + %24 = OpCompositeExtract %float %21 0 + %23 = OpConvertFToS %int %24 + %26 = OpBitwiseAnd %int %23 %int_1 + %28 = OpCompositeExtract %float %21 1 + %27 = OpConvertFToS %int %28 + %29 = OpBitwiseAnd %int %27 %int_1 + %30 = OpIAdd %int %26 %29 + %31 = OpIAdd %int %30 %22 + %33 = OpCompositeExtract %float %21 2 + %32 = OpConvertFToS %int %33 + %34 = OpIEqual %bool %31 %32 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %36 + %37 = OpLabel + OpBranch %36 + %36 = OpLabel + OpStore %x_4 %int_1 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %38 +%tint_symbol_2 = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %17 + %45 = OpLabel + %46 = OpLoad %v4float %tint_symbol + OpStore %x_2 %46 + %47 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %47 + %48 = OpFunctionCall %void %main_1 + %50 = OpLoad %int %x_4 + %51 = OpCompositeConstruct %main_out %50 + %49 = OpFunctionCall %void %tint_symbol_4 %51 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..affcd631f4 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.wgsl @@ -0,0 +1,27 @@ +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +fn main_1() { + let x_16 : vec4 = x_2; + let x_26 : i32 = x_3; + if (((((i32(x_16.x) & 1) + (i32(x_16.y) & 1)) + x_26) == i32(x_16.z))) { + } + x_4 = 1; + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl new file mode 100644 index 0000000000..affcd631f4 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl @@ -0,0 +1,27 @@ +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +fn main_1() { + let x_16 : vec4 = x_2; + let x_26 : i32 = x_3; + if (((((i32(x_16.x) & 1) + (i32(x_16.y) & 1)) + x_26) == i32(x_16.z))) { + } + x_4 = 1; + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..a97b541ec0 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.hlsl @@ -0,0 +1,33 @@ +static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; + +void main_1() { + const float4 x_16 = x_2; + if (((((int(x_16.x) & 1) + (int(x_16.y) & 1)) + x_3) == int(x_16.z))) { + } + x_4 = 1; + return; +} + +struct main_out { + int x_4_1; +}; +struct tint_symbol_1 { + int x_3_param : TEXCOORD0; + float4 x_2_param : SV_Position; +}; +struct tint_symbol_2 { + int x_4_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_4_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.msl new file mode 100644 index 0000000000..a72a5095c5 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct main_out { + int x_4_1; +}; +struct tint_symbol_2 { + int x_3_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread int* const tint_symbol_7, thread int* const tint_symbol_8) { + float4 const x_16 = *(tint_symbol_6); + int const x_26 = *(tint_symbol_7); + if (((((int(x_16.x) & 1) + (int(x_16.y) & 1)) + x_26) == int(x_16.z))) { + } + *(tint_symbol_8) = 1; + return; +} + +fragment tint_symbol_3 tint_symbol(float4 x_2_param [[position]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_9 = 0.0f; + thread int tint_symbol_10 = 0; + thread int tint_symbol_11 = 0; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_9 = x_2_param; + tint_symbol_10 = x_3_param; + main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..99bfcd9c50 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_1 Flat + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_2 = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %9 + %x_4 = OpVariable %_ptr_Private_int Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %int + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %17 + %20 = OpLabel + %21 = OpLoad %v4float %x_2 + %22 = OpLoad %int %x_3 + %24 = OpCompositeExtract %float %21 0 + %23 = OpConvertFToS %int %24 + %26 = OpBitwiseAnd %int %23 %int_1 + %28 = OpCompositeExtract %float %21 1 + %27 = OpConvertFToS %int %28 + %29 = OpBitwiseAnd %int %27 %int_1 + %30 = OpIAdd %int %26 %29 + %31 = OpIAdd %int %30 %22 + %33 = OpCompositeExtract %float %21 2 + %32 = OpConvertFToS %int %33 + %34 = OpIEqual %bool %31 %32 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %36 + %37 = OpLabel + OpBranch %36 + %36 = OpLabel + OpStore %x_4 %int_1 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %38 +%tint_symbol_2 = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %17 + %45 = OpLabel + %46 = OpLoad %v4float %tint_symbol + OpStore %x_2 %46 + %47 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %47 + %48 = OpFunctionCall %void %main_1 + %50 = OpLoad %int %x_4 + %51 = OpCompositeConstruct %main_out %50 + %49 = OpFunctionCall %void %tint_symbol_4 %51 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..affcd631f4 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.wgsl @@ -0,0 +1,27 @@ +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +fn main_1() { + let x_16 : vec4 = x_2; + let x_26 : i32 = x_3; + if (((((i32(x_16.x) & 1) + (i32(x_16.y) & 1)) + x_26) == i32(x_16.z))) { + } + x_4 = 1; + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm new file mode 100644 index 0000000000..c677499623 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm @@ -0,0 +1,53 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %out_data + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %x_is_odd "x_is_odd" + OpName %gl_FragCoord "gl_FragCoord" + OpName %y_is_odd "y_is_odd" + OpName %out_data "out_data" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %out_data Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_int = OpTypePointer Output %int + %out_data = OpVariable %_ptr_Output_int Output + %int_0 = OpConstant %int 0 + %main = OpFunction %void None %8 + %22 = OpLabel + %x_is_odd = OpVariable %_ptr_Function_bool Function + %y_is_odd = OpVariable %_ptr_Function_bool Function + %23 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %24 = OpLoad %float %23 + %25 = OpConvertFToS %int %24 + %26 = OpBitwiseAnd %int %25 %int_1 + %27 = OpIEqual %bool %26 %int_1 + OpStore %x_is_odd %27 + %28 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %29 = OpLoad %float %28 + %30 = OpConvertFToS %int %29 + %31 = OpBitwiseAnd %int %30 %int_1 + %32 = OpIEqual %bool %31 %int_1 + OpStore %y_is_odd %32 + %33 = OpLoad %bool %x_is_odd + %34 = OpLoad %bool %y_is_odd + %35 = OpLogicalOr %bool %33 %34 + %36 = OpSelect %int %35 %int_1 %int_0 + OpStore %out_data %36 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..1ad88d2698 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.hlsl @@ -0,0 +1,36 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int out_data = 0; + +void main_1() { + bool x_is_odd = false; + bool y_is_odd = false; + const float x_24 = gl_FragCoord.x; + x_is_odd = ((int(x_24) & 1) == 1); + const float x_29 = gl_FragCoord.y; + y_is_odd = ((int(x_29) & 1) == 1); + bool tint_tmp = x_is_odd; + if (!tint_tmp) { + tint_tmp = y_is_odd; + } + out_data = ((tint_tmp) ? 1 : 0); + return; +} + +struct main_out { + int out_data_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + int out_data_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {out_data}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.out_data_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.msl new file mode 100644 index 0000000000..a2b97bfc87 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct main_out { + int out_data_1; +}; +struct tint_symbol_2 { + int out_data_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread int* const tint_symbol_6) { + bool x_is_odd = false; + bool y_is_odd = false; + float const x_24 = (*(tint_symbol_5)).x; + x_is_odd = ((int(x_24) & 1) == 1); + float const x_29 = (*(tint_symbol_5)).y; + y_is_odd = ((int(x_29) & 1) == 1); + bool const x_33 = x_is_odd; + bool const x_34 = y_is_odd; + *(tint_symbol_6) = select(0, 1, (x_33 || x_34)); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread int tint_symbol_8 = 0; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.out_data_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.out_data_1=tint_symbol_3.out_data_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..34887530b8 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %out_data "out_data" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_is_odd "x_is_odd" + OpName %y_is_odd "y_is_odd" + OpName %main_out "main_out" + OpMemberName %main_out 0 "out_data_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %out_data = OpVariable %_ptr_Private_int Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_2 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %21 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %int + %45 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %x_is_odd = OpVariable %_ptr_Function_bool Function %21 + %y_is_odd = OpVariable %_ptr_Function_bool Function %21 + %26 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %27 = OpLoad %float %26 + %28 = OpConvertFToS %int %27 + %30 = OpBitwiseAnd %int %28 %int_1 + %31 = OpIEqual %bool %30 %int_1 + OpStore %x_is_odd %31 + %33 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %34 = OpLoad %float %33 + %35 = OpConvertFToS %int %34 + %36 = OpBitwiseAnd %int %35 %int_1 + %37 = OpIEqual %bool %36 %int_1 + OpStore %y_is_odd %37 + %38 = OpLoad %bool %x_is_odd + %39 = OpLoad %bool %y_is_odd + OpSelectionMerge %41 None + OpBranchConditional %38 %41 %42 + %42 = OpLabel + OpBranch %41 + %41 = OpLabel + %43 = OpPhi %bool %38 %17 %39 %42 + %40 = OpSelect %int %43 %int_1 %int_0 + OpStore %out_data %40 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %45 +%tint_symbol_1 = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %int %tint_symbol_1 0 + OpStore %tint_symbol_2 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %52 = OpLabel + %53 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %53 + %54 = OpFunctionCall %void %main_1 + %56 = OpLoad %int %out_data + %57 = OpCompositeConstruct %main_out %56 + %55 = OpFunctionCall %void %tint_symbol_3 %57 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..3820a70371 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +var gl_FragCoord : vec4; + +var out_data : i32; + +fn main_1() { + var x_is_odd : bool; + var y_is_odd : bool; + let x_24 : f32 = gl_FragCoord.x; + x_is_odd = ((i32(x_24) & 1) == 1); + let x_29 : f32 = gl_FragCoord.y; + y_is_odd = ((i32(x_29) & 1) == 1); + let x_33 : bool = x_is_odd; + let x_34 : bool = y_is_odd; + out_data = select(0, 1, (x_33 || x_34)); + return; +} + +struct main_out { + [[location(0)]] + out_data_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(out_data); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl new file mode 100644 index 0000000000..3820a70371 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl @@ -0,0 +1,28 @@ +var gl_FragCoord : vec4; + +var out_data : i32; + +fn main_1() { + var x_is_odd : bool; + var y_is_odd : bool; + let x_24 : f32 = gl_FragCoord.x; + x_is_odd = ((i32(x_24) & 1) == 1); + let x_29 : f32 = gl_FragCoord.y; + y_is_odd = ((i32(x_29) & 1) == 1); + let x_33 : bool = x_is_odd; + let x_34 : bool = y_is_odd; + out_data = select(0, 1, (x_33 || x_34)); + return; +} + +struct main_out { + [[location(0)]] + out_data_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(out_data); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..1ad88d2698 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.hlsl @@ -0,0 +1,36 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int out_data = 0; + +void main_1() { + bool x_is_odd = false; + bool y_is_odd = false; + const float x_24 = gl_FragCoord.x; + x_is_odd = ((int(x_24) & 1) == 1); + const float x_29 = gl_FragCoord.y; + y_is_odd = ((int(x_29) & 1) == 1); + bool tint_tmp = x_is_odd; + if (!tint_tmp) { + tint_tmp = y_is_odd; + } + out_data = ((tint_tmp) ? 1 : 0); + return; +} + +struct main_out { + int out_data_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + int out_data_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {out_data}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.out_data_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.msl new file mode 100644 index 0000000000..a2b97bfc87 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +struct main_out { + int out_data_1; +}; +struct tint_symbol_2 { + int out_data_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread int* const tint_symbol_6) { + bool x_is_odd = false; + bool y_is_odd = false; + float const x_24 = (*(tint_symbol_5)).x; + x_is_odd = ((int(x_24) & 1) == 1); + float const x_29 = (*(tint_symbol_5)).y; + y_is_odd = ((int(x_29) & 1) == 1); + bool const x_33 = x_is_odd; + bool const x_34 = y_is_odd; + *(tint_symbol_6) = select(0, 1, (x_33 || x_34)); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread int tint_symbol_8 = 0; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.out_data_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.out_data_1=tint_symbol_3.out_data_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..34887530b8 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.spvasm @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %out_data "out_data" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %x_is_odd "x_is_odd" + OpName %y_is_odd "y_is_odd" + OpName %main_out "main_out" + OpMemberName %main_out 0 "out_data_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %out_data = OpVariable %_ptr_Private_int Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_2 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %21 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 + %int_0 = OpConstant %int 0 + %main_out = OpTypeStruct %int + %45 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %x_is_odd = OpVariable %_ptr_Function_bool Function %21 + %y_is_odd = OpVariable %_ptr_Function_bool Function %21 + %26 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %27 = OpLoad %float %26 + %28 = OpConvertFToS %int %27 + %30 = OpBitwiseAnd %int %28 %int_1 + %31 = OpIEqual %bool %30 %int_1 + OpStore %x_is_odd %31 + %33 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %34 = OpLoad %float %33 + %35 = OpConvertFToS %int %34 + %36 = OpBitwiseAnd %int %35 %int_1 + %37 = OpIEqual %bool %36 %int_1 + OpStore %y_is_odd %37 + %38 = OpLoad %bool %x_is_odd + %39 = OpLoad %bool %y_is_odd + OpSelectionMerge %41 None + OpBranchConditional %38 %41 %42 + %42 = OpLabel + OpBranch %41 + %41 = OpLabel + %43 = OpPhi %bool %38 %17 %39 %42 + %40 = OpSelect %int %43 %int_1 %int_0 + OpStore %out_data %40 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %45 +%tint_symbol_1 = OpFunctionParameter %main_out + %49 = OpLabel + %50 = OpCompositeExtract %int %tint_symbol_1 0 + OpStore %tint_symbol_2 %50 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %52 = OpLabel + %53 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %53 + %54 = OpFunctionCall %void %main_1 + %56 = OpLoad %int %out_data + %57 = OpCompositeConstruct %main_out %56 + %55 = OpFunctionCall %void %tint_symbol_3 %57 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..3820a70371 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/2-opt.wgsl.expected.wgsl @@ -0,0 +1,28 @@ +var gl_FragCoord : vec4; + +var out_data : i32; + +fn main_1() { + var x_is_odd : bool; + var y_is_odd : bool; + let x_24 : f32 = gl_FragCoord.x; + x_is_odd = ((i32(x_24) & 1) == 1); + let x_29 : f32 = gl_FragCoord.y; + y_is_odd = ((i32(x_29) & 1) == 1); + let x_33 : bool = x_is_odd; + let x_34 : bool = y_is_odd; + out_data = select(0, 1, (x_33 || x_34)); + return; +} + +struct main_out { + [[location(0)]] + out_data_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(out_data); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm new file mode 100644 index 0000000000..0a6b2401fe --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm @@ -0,0 +1,45 @@ + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %1 "main" %gl_FragCoord %3 %4 + OpExecutionMode %1 OriginUpperLeft + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %3 Location 0 + OpDecorate %3 Flat + OpDecorate %4 Location 0 + %void = OpTypeVoid + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_int = OpTypePointer Output %int +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %3 = OpVariable %_ptr_Input_int Input + %4 = OpVariable %_ptr_Output_int Output + %14 = OpTypeFunction %void + %1 = OpFunction %void None %14 + %15 = OpLabel + %16 = OpLoad %v4float %gl_FragCoord + %17 = OpCompositeExtract %float %16 0 + %18 = OpCompositeExtract %float %16 1 + %19 = OpCompositeExtract %float %16 2 + %20 = OpConvertFToS %int %17 + %21 = OpConvertFToS %int %18 + %22 = OpConvertFToS %int %19 + %23 = OpBitwiseAnd %int %20 %int_1 + %24 = OpBitwiseAnd %int %21 %int_1 + %25 = OpIAdd %int %23 %24 + %26 = OpLoad %int %3 + OpStore %4 %int_1 + %27 = OpIAdd %int %25 %26 + %28 = OpIEqual %bool %27 %22 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %29 + %30 = OpLabel + OpTerminateInvocation + %29 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..e3d1bee52f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.hlsl @@ -0,0 +1,34 @@ +static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; + +void main_1() { + const float4 x_16 = x_2; + const int x_26 = x_3; + x_4 = 1; + if (((((int(x_16.x) & 1) + (int(x_16.y) & 1)) + x_26) == int(x_16.z))) { + } + return; +} + +struct main_out { + int x_4_1; +}; +struct tint_symbol_1 { + int x_3_param : TEXCOORD0; + float4 x_2_param : SV_Position; +}; +struct tint_symbol_2 { + int x_4_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_4_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.msl new file mode 100644 index 0000000000..06facd98fc --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct main_out { + int x_4_1; +}; +struct tint_symbol_2 { + int x_3_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread int* const tint_symbol_7, thread int* const tint_symbol_8) { + float4 const x_16 = *(tint_symbol_6); + int const x_26 = *(tint_symbol_7); + *(tint_symbol_8) = 1; + if (((((int(x_16.x) & 1) + (int(x_16.y) & 1)) + x_26) == int(x_16.z))) { + } + return; +} + +fragment tint_symbol_3 tint_symbol(float4 x_2_param [[position]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_9 = 0.0f; + thread int tint_symbol_10 = 0; + thread int tint_symbol_11 = 0; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_9 = x_2_param; + tint_symbol_10 = x_3_param; + main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..6d9599fae0 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_1 Flat + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_2 = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %9 + %x_4 = OpVariable %_ptr_Private_int Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %int + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %17 + %20 = OpLabel + %21 = OpLoad %v4float %x_2 + %22 = OpLoad %int %x_3 + OpStore %x_4 %int_1 + %25 = OpCompositeExtract %float %21 0 + %24 = OpConvertFToS %int %25 + %26 = OpBitwiseAnd %int %24 %int_1 + %28 = OpCompositeExtract %float %21 1 + %27 = OpConvertFToS %int %28 + %29 = OpBitwiseAnd %int %27 %int_1 + %30 = OpIAdd %int %26 %29 + %31 = OpIAdd %int %30 %22 + %33 = OpCompositeExtract %float %21 2 + %32 = OpConvertFToS %int %33 + %34 = OpIEqual %bool %31 %32 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %36 + %37 = OpLabel + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %38 +%tint_symbol_2 = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %17 + %45 = OpLabel + %46 = OpLoad %v4float %tint_symbol + OpStore %x_2 %46 + %47 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %47 + %48 = OpFunctionCall %void %main_1 + %50 = OpLoad %int %x_4 + %51 = OpCompositeConstruct %main_out %50 + %49 = OpFunctionCall %void %tint_symbol_4 %51 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..e0e933a000 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.wgsl @@ -0,0 +1,27 @@ +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +fn main_1() { + let x_16 : vec4 = x_2; + let x_26 : i32 = x_3; + x_4 = 1; + if (((((i32(x_16.x) & 1) + (i32(x_16.y) & 1)) + x_26) == i32(x_16.z))) { + } + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl new file mode 100644 index 0000000000..e0e933a000 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl @@ -0,0 +1,27 @@ +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +fn main_1() { + let x_16 : vec4 = x_2; + let x_26 : i32 = x_3; + x_4 = 1; + if (((((i32(x_16.x) & 1) + (i32(x_16.y) & 1)) + x_26) == i32(x_16.z))) { + } + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..e3d1bee52f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.hlsl @@ -0,0 +1,34 @@ +static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; + +void main_1() { + const float4 x_16 = x_2; + const int x_26 = x_3; + x_4 = 1; + if (((((int(x_16.x) & 1) + (int(x_16.y) & 1)) + x_26) == int(x_16.z))) { + } + return; +} + +struct main_out { + int x_4_1; +}; +struct tint_symbol_1 { + int x_3_param : TEXCOORD0; + float4 x_2_param : SV_Position; +}; +struct tint_symbol_2 { + int x_4_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_4_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.msl new file mode 100644 index 0000000000..06facd98fc --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.msl @@ -0,0 +1,35 @@ +#include + +using namespace metal; +struct main_out { + int x_4_1; +}; +struct tint_symbol_2 { + int x_3_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread int* const tint_symbol_7, thread int* const tint_symbol_8) { + float4 const x_16 = *(tint_symbol_6); + int const x_26 = *(tint_symbol_7); + *(tint_symbol_8) = 1; + if (((((int(x_16.x) & 1) + (int(x_16.y) & 1)) + x_26) == int(x_16.z))) { + } + return; +} + +fragment tint_symbol_3 tint_symbol(float4 x_2_param [[position]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_9 = 0.0f; + thread int tint_symbol_10 = 0; + thread int tint_symbol_11 = 0; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_9 = x_2_param; + tint_symbol_10 = x_3_param; + main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..6d9599fae0 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.spvasm @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_1 Flat + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_2 = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %9 + %x_4 = OpVariable %_ptr_Private_int Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %main_out = OpTypeStruct %int + %38 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %17 + %20 = OpLabel + %21 = OpLoad %v4float %x_2 + %22 = OpLoad %int %x_3 + OpStore %x_4 %int_1 + %25 = OpCompositeExtract %float %21 0 + %24 = OpConvertFToS %int %25 + %26 = OpBitwiseAnd %int %24 %int_1 + %28 = OpCompositeExtract %float %21 1 + %27 = OpConvertFToS %int %28 + %29 = OpBitwiseAnd %int %27 %int_1 + %30 = OpIAdd %int %26 %29 + %31 = OpIAdd %int %30 %22 + %33 = OpCompositeExtract %float %21 2 + %32 = OpConvertFToS %int %33 + %34 = OpIEqual %bool %31 %32 + OpSelectionMerge %36 None + OpBranchConditional %34 %37 %36 + %37 = OpLabel + OpBranch %36 + %36 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %38 +%tint_symbol_2 = OpFunctionParameter %main_out + %42 = OpLabel + %43 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %43 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %17 + %45 = OpLabel + %46 = OpLoad %v4float %tint_symbol + OpStore %x_2 %46 + %47 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %47 + %48 = OpFunctionCall %void %main_1 + %50 = OpLoad %int %x_4 + %51 = OpCompositeConstruct %main_out %50 + %49 = OpFunctionCall %void %tint_symbol_4 %51 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..e0e933a000 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.wgsl @@ -0,0 +1,27 @@ +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +fn main_1() { + let x_16 : vec4 = x_2; + let x_26 : i32 = x_3; + x_4 = 1; + if (((((i32(x_16.x) & 1) + (i32(x_16.y) & 1)) + x_26) == i32(x_16.z))) { + } + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm new file mode 100644 index 0000000000..0adb9cb3e6 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm @@ -0,0 +1,62 @@ + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %1 "main" %gl_FragCoord %3 %4 + OpExecutionMode %1 OriginUpperLeft + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %3 Location 0 + OpDecorate %3 Flat + OpDecorate %4 Location 0 + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + OpDecorate %_struct_6 Block + OpMemberDecorate %_struct_6 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + %void = OpTypeVoid + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_8 = OpConstant %int 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_int = OpTypePointer Output %int +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %3 = OpVariable %_ptr_Input_int Input + %4 = OpVariable %_ptr_Output_int Output +%_runtimearr_int = OpTypeRuntimeArray %int + %_struct_6 = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%_ptr_StorageBuffer__struct_6 = OpTypePointer StorageBuffer %_struct_6 + %5 = OpVariable %_ptr_StorageBuffer__struct_6 StorageBuffer + %21 = OpTypeFunction %void + %1 = OpFunction %void None %21 + %22 = OpLabel + OpStore %4 %int_1 + %23 = OpLoad %v4float %gl_FragCoord + %24 = OpCompositeExtract %float %23 0 + %25 = OpCompositeExtract %float %23 1 + %26 = OpCompositeExtract %float %23 2 + %27 = OpConvertFToS %int %24 + %28 = OpConvertFToS %int %25 + %29 = OpConvertFToS %int %26 + %30 = OpBitwiseAnd %int %27 %int_1 + %31 = OpBitwiseAnd %int %28 %int_1 + %32 = OpIAdd %int %30 %31 + %33 = OpLoad %int %3 + %34 = OpIAdd %int %32 %33 + %35 = OpIEqual %bool %34 %29 + OpSelectionMerge %36 None + OpBranchConditional %35 %37 %36 + %37 = OpLabel + OpTerminateInvocation + %36 = OpLabel + %38 = OpIMul %int %28 %int_8 + %39 = OpIAdd %int %27 %38 + %40 = OpAccessChain %_ptr_StorageBuffer_int %5 %int_0 %39 + OpStore %40 %27 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..ad10f80944 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.hlsl @@ -0,0 +1,37 @@ +static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; +RWByteAddressBuffer x_5 : register(u0, space0); + +void main_1() { + x_4 = 1; + const float4 x_23 = x_2; + const int x_27 = int(x_23.x); + const int x_28 = int(x_23.y); + if (((((x_27 & 1) + (x_28 & 1)) + x_3) == int(x_23.z))) { + } + x_5.Store((4u * uint((x_27 + (x_28 * 8)))), asuint(x_27)); + return; +} + +struct main_out { + int x_4_1; +}; +struct tint_symbol_1 { + int x_3_param : TEXCOORD0; + float4 x_2_param : SV_Position; +}; +struct tint_symbol_2 { + int x_4_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_4_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.msl new file mode 100644 index 0000000000..bf23c884e6 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ int field0[1]; +}; +struct main_out { + int x_4_1; +}; +struct tint_symbol_2 { + int x_3_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[color(0)]]; +}; + +void main_1(device S& x_5, thread int* const tint_symbol_6, thread float4* const tint_symbol_7, thread int* const tint_symbol_8) { + *(tint_symbol_6) = 1; + float4 const x_23 = *(tint_symbol_7); + int const x_27 = int(x_23.x); + int const x_28 = int(x_23.y); + int const x_33 = *(tint_symbol_8); + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == int(x_23.z))) { + } + x_5.field0[(x_27 + (x_28 * 8))] = x_27; + return; +} + +fragment tint_symbol_3 tint_symbol(float4 x_2_param [[position]], tint_symbol_2 tint_symbol_1 [[stage_in]], device S& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread int tint_symbol_10 = 0; + thread int tint_symbol_11 = 0; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_9 = x_2_param; + tint_symbol_10 = x_3_param; + main_1(x_5, &(tint_symbol_11), &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..fef8d541b9 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_1 Flat + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_2 = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %9 + %x_4 = OpVariable %_ptr_Private_int Private %9 +%_runtimearr_int = OpTypeRuntimeArray %int + %S = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %21 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int_8 = OpConstant %int 8 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %main_out = OpTypeStruct %int + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %21 + %24 = OpLabel + OpStore %x_4 %int_1 + %26 = OpLoad %v4float %x_2 + %28 = OpCompositeExtract %float %26 0 + %27 = OpConvertFToS %int %28 + %30 = OpCompositeExtract %float %26 1 + %29 = OpConvertFToS %int %30 + %31 = OpLoad %int %x_3 + %32 = OpBitwiseAnd %int %27 %int_1 + %33 = OpBitwiseAnd %int %29 %int_1 + %34 = OpIAdd %int %32 %33 + %35 = OpIAdd %int %34 %31 + %37 = OpCompositeExtract %float %26 2 + %36 = OpConvertFToS %int %37 + %38 = OpIEqual %bool %35 %36 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %40 + %41 = OpLabel + OpBranch %40 + %40 = OpLabel + %45 = OpIMul %int %29 %int_8 + %46 = OpIAdd %int %27 %45 + %48 = OpAccessChain %_ptr_StorageBuffer_int %x_5 %uint_0 %46 + OpStore %48 %27 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %49 +%tint_symbol_2 = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %21 + %56 = OpLabel + %57 = OpLoad %v4float %tint_symbol + OpStore %x_2 %57 + %58 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %58 + %59 = OpFunctionCall %void %main_1 + %61 = OpLoad %int %x_4 + %62 = OpCompositeConstruct %main_out %61 + %60 = OpFunctionCall %void %tint_symbol_4 %62 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..8bf85f1e05 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +[[group(0), binding(0)]] var x_5 : S; + +fn main_1() { + x_4 = 1; + let x_23 : vec4 = x_2; + let x_27 : i32 = i32(x_23.x); + let x_28 : i32 = i32(x_23.y); + let x_33 : i32 = x_3; + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == i32(x_23.z))) { + } + x_5.field0[(x_27 + (x_28 * 8))] = x_27; + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl new file mode 100644 index 0000000000..8bf85f1e05 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl @@ -0,0 +1,39 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +[[group(0), binding(0)]] var x_5 : S; + +fn main_1() { + x_4 = 1; + let x_23 : vec4 = x_2; + let x_27 : i32 = i32(x_23.x); + let x_28 : i32 = i32(x_23.y); + let x_33 : i32 = x_3; + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == i32(x_23.z))) { + } + x_5.field0[(x_27 + (x_28 * 8))] = x_27; + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..ad10f80944 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.hlsl @@ -0,0 +1,37 @@ +static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; +RWByteAddressBuffer x_5 : register(u0, space0); + +void main_1() { + x_4 = 1; + const float4 x_23 = x_2; + const int x_27 = int(x_23.x); + const int x_28 = int(x_23.y); + if (((((x_27 & 1) + (x_28 & 1)) + x_3) == int(x_23.z))) { + } + x_5.Store((4u * uint((x_27 + (x_28 * 8)))), asuint(x_27)); + return; +} + +struct main_out { + int x_4_1; +}; +struct tint_symbol_1 { + int x_3_param : TEXCOORD0; + float4 x_2_param : SV_Position; +}; +struct tint_symbol_2 { + int x_4_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_4_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.msl new file mode 100644 index 0000000000..bf23c884e6 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ int field0[1]; +}; +struct main_out { + int x_4_1; +}; +struct tint_symbol_2 { + int x_3_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[color(0)]]; +}; + +void main_1(device S& x_5, thread int* const tint_symbol_6, thread float4* const tint_symbol_7, thread int* const tint_symbol_8) { + *(tint_symbol_6) = 1; + float4 const x_23 = *(tint_symbol_7); + int const x_27 = int(x_23.x); + int const x_28 = int(x_23.y); + int const x_33 = *(tint_symbol_8); + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == int(x_23.z))) { + } + x_5.field0[(x_27 + (x_28 * 8))] = x_27; + return; +} + +fragment tint_symbol_3 tint_symbol(float4 x_2_param [[position]], tint_symbol_2 tint_symbol_1 [[stage_in]], device S& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread int tint_symbol_10 = 0; + thread int tint_symbol_11 = 0; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_9 = x_2_param; + tint_symbol_10 = x_3_param; + main_1(x_5, &(tint_symbol_11), &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..fef8d541b9 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_1 Flat + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_2 = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %9 + %x_4 = OpVariable %_ptr_Private_int Private %9 +%_runtimearr_int = OpTypeRuntimeArray %int + %S = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %21 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int_8 = OpConstant %int 8 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %main_out = OpTypeStruct %int + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %21 + %24 = OpLabel + OpStore %x_4 %int_1 + %26 = OpLoad %v4float %x_2 + %28 = OpCompositeExtract %float %26 0 + %27 = OpConvertFToS %int %28 + %30 = OpCompositeExtract %float %26 1 + %29 = OpConvertFToS %int %30 + %31 = OpLoad %int %x_3 + %32 = OpBitwiseAnd %int %27 %int_1 + %33 = OpBitwiseAnd %int %29 %int_1 + %34 = OpIAdd %int %32 %33 + %35 = OpIAdd %int %34 %31 + %37 = OpCompositeExtract %float %26 2 + %36 = OpConvertFToS %int %37 + %38 = OpIEqual %bool %35 %36 + OpSelectionMerge %40 None + OpBranchConditional %38 %41 %40 + %41 = OpLabel + OpBranch %40 + %40 = OpLabel + %45 = OpIMul %int %29 %int_8 + %46 = OpIAdd %int %27 %45 + %48 = OpAccessChain %_ptr_StorageBuffer_int %x_5 %uint_0 %46 + OpStore %48 %27 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %49 +%tint_symbol_2 = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %21 + %56 = OpLabel + %57 = OpLoad %v4float %tint_symbol + OpStore %x_2 %57 + %58 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %58 + %59 = OpFunctionCall %void %main_1 + %61 = OpLoad %int %x_4 + %62 = OpCompositeConstruct %main_out %61 + %60 = OpFunctionCall %void %tint_symbol_4 %62 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..8bf85f1e05 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.wgsl @@ -0,0 +1,39 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +[[group(0), binding(0)]] var x_5 : S; + +fn main_1() { + x_4 = 1; + let x_23 : vec4 = x_2; + let x_27 : i32 = i32(x_23.x); + let x_28 : i32 = i32(x_23.y); + let x_33 : i32 = x_3; + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == i32(x_23.z))) { + } + x_5.field0[(x_27 + (x_28 * 8))] = x_27; + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm new file mode 100644 index 0000000000..7ca50028f7 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm @@ -0,0 +1,62 @@ + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %1 "main" %gl_FragCoord %3 %4 + OpExecutionMode %1 OriginUpperLeft + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %3 Location 0 + OpDecorate %3 Flat + OpDecorate %4 Location 0 + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + OpDecorate %_struct_6 Block + OpMemberDecorate %_struct_6 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + %void = OpTypeVoid + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_8 = OpConstant %int 8 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_int = OpTypePointer Output %int +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %3 = OpVariable %_ptr_Input_int Input + %4 = OpVariable %_ptr_Output_int Output +%_runtimearr_int = OpTypeRuntimeArray %int + %_struct_6 = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%_ptr_StorageBuffer__struct_6 = OpTypePointer StorageBuffer %_struct_6 + %5 = OpVariable %_ptr_StorageBuffer__struct_6 StorageBuffer + %21 = OpTypeFunction %void + %1 = OpFunction %void None %21 + %22 = OpLabel + OpStore %4 %int_1 + %23 = OpLoad %v4float %gl_FragCoord + %24 = OpCompositeExtract %float %23 0 + %25 = OpCompositeExtract %float %23 1 + %26 = OpCompositeExtract %float %23 2 + %27 = OpConvertFToS %int %24 + %28 = OpConvertFToS %int %25 + %29 = OpConvertFToS %int %26 + %30 = OpBitwiseAnd %int %27 %int_1 + %31 = OpBitwiseAnd %int %28 %int_1 + %32 = OpIAdd %int %30 %31 + %33 = OpLoad %int %3 + %34 = OpIAdd %int %32 %33 + %35 = OpIMul %int %28 %int_8 + %36 = OpIAdd %int %27 %35 + %37 = OpAccessChain %_ptr_StorageBuffer_int %5 %int_0 %36 + OpStore %37 %27 + %38 = OpIEqual %bool %34 %29 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %39 + %40 = OpLabel + OpTerminateInvocation + %39 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..bb7ac26acf --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.hlsl @@ -0,0 +1,38 @@ +static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; +RWByteAddressBuffer x_5 : register(u0, space0); + +void main_1() { + x_4 = 1; + const float4 x_23 = x_2; + const int x_27 = int(x_23.x); + const int x_28 = int(x_23.y); + const int x_33 = x_3; + x_5.Store((4u * uint((x_27 + (x_28 * 8)))), asuint(x_27)); + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == int(x_23.z))) { + } + return; +} + +struct main_out { + int x_4_1; +}; +struct tint_symbol_1 { + int x_3_param : TEXCOORD0; + float4 x_2_param : SV_Position; +}; +struct tint_symbol_2 { + int x_4_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_4_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.msl new file mode 100644 index 0000000000..893315ff6d --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ int field0[1]; +}; +struct main_out { + int x_4_1; +}; +struct tint_symbol_2 { + int x_3_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[color(0)]]; +}; + +void main_1(device S& x_5, thread int* const tint_symbol_6, thread float4* const tint_symbol_7, thread int* const tint_symbol_8) { + *(tint_symbol_6) = 1; + float4 const x_23 = *(tint_symbol_7); + int const x_27 = int(x_23.x); + int const x_28 = int(x_23.y); + int const x_33 = *(tint_symbol_8); + x_5.field0[(x_27 + (x_28 * 8))] = x_27; + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == int(x_23.z))) { + } + return; +} + +fragment tint_symbol_3 tint_symbol(float4 x_2_param [[position]], tint_symbol_2 tint_symbol_1 [[stage_in]], device S& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread int tint_symbol_10 = 0; + thread int tint_symbol_11 = 0; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_9 = x_2_param; + tint_symbol_10 = x_3_param; + main_1(x_5, &(tint_symbol_11), &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..ef97582764 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_1 Flat + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_2 = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %9 + %x_4 = OpVariable %_ptr_Private_int Private %9 +%_runtimearr_int = OpTypeRuntimeArray %int + %S = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %21 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int_8 = OpConstant %int 8 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %bool = OpTypeBool + %main_out = OpTypeStruct %int + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %21 + %24 = OpLabel + OpStore %x_4 %int_1 + %26 = OpLoad %v4float %x_2 + %28 = OpCompositeExtract %float %26 0 + %27 = OpConvertFToS %int %28 + %30 = OpCompositeExtract %float %26 1 + %29 = OpConvertFToS %int %30 + %31 = OpLoad %int %x_3 + %35 = OpIMul %int %29 %int_8 + %36 = OpIAdd %int %27 %35 + %38 = OpAccessChain %_ptr_StorageBuffer_int %x_5 %uint_0 %36 + OpStore %38 %27 + %39 = OpBitwiseAnd %int %27 %int_1 + %40 = OpBitwiseAnd %int %29 %int_1 + %41 = OpIAdd %int %39 %40 + %42 = OpIAdd %int %41 %31 + %44 = OpCompositeExtract %float %26 2 + %43 = OpConvertFToS %int %44 + %45 = OpIEqual %bool %42 %43 + OpSelectionMerge %47 None + OpBranchConditional %45 %48 %47 + %48 = OpLabel + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %49 +%tint_symbol_2 = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %21 + %56 = OpLabel + %57 = OpLoad %v4float %tint_symbol + OpStore %x_2 %57 + %58 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %58 + %59 = OpFunctionCall %void %main_1 + %61 = OpLoad %int %x_4 + %62 = OpCompositeConstruct %main_out %61 + %60 = OpFunctionCall %void %tint_symbol_4 %62 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..55cb745376 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.wgsl @@ -0,0 +1,39 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +[[group(0), binding(0)]] var x_5 : S; + +fn main_1() { + x_4 = 1; + let x_23 : vec4 = x_2; + let x_27 : i32 = i32(x_23.x); + let x_28 : i32 = i32(x_23.y); + let x_33 : i32 = x_3; + x_5.field0[(x_27 + (x_28 * 8))] = x_27; + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == i32(x_23.z))) { + } + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl new file mode 100644 index 0000000000..55cb745376 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl @@ -0,0 +1,39 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +[[group(0), binding(0)]] var x_5 : S; + +fn main_1() { + x_4 = 1; + let x_23 : vec4 = x_2; + let x_27 : i32 = i32(x_23.x); + let x_28 : i32 = i32(x_23.y); + let x_33 : i32 = x_3; + x_5.field0[(x_27 + (x_28 * 8))] = x_27; + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == i32(x_23.z))) { + } + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..bb7ac26acf --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.hlsl @@ -0,0 +1,38 @@ +static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; +RWByteAddressBuffer x_5 : register(u0, space0); + +void main_1() { + x_4 = 1; + const float4 x_23 = x_2; + const int x_27 = int(x_23.x); + const int x_28 = int(x_23.y); + const int x_33 = x_3; + x_5.Store((4u * uint((x_27 + (x_28 * 8)))), asuint(x_27)); + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == int(x_23.z))) { + } + return; +} + +struct main_out { + int x_4_1; +}; +struct tint_symbol_1 { + int x_3_param : TEXCOORD0; + float4 x_2_param : SV_Position; +}; +struct tint_symbol_2 { + int x_4_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4}; + const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_4_1}; + return tint_symbol_5; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.msl new file mode 100644 index 0000000000..893315ff6d --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.msl @@ -0,0 +1,41 @@ +#include + +using namespace metal; +struct S { + /* 0x0000 */ int field0[1]; +}; +struct main_out { + int x_4_1; +}; +struct tint_symbol_2 { + int x_3_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[color(0)]]; +}; + +void main_1(device S& x_5, thread int* const tint_symbol_6, thread float4* const tint_symbol_7, thread int* const tint_symbol_8) { + *(tint_symbol_6) = 1; + float4 const x_23 = *(tint_symbol_7); + int const x_27 = int(x_23.x); + int const x_28 = int(x_23.y); + int const x_33 = *(tint_symbol_8); + x_5.field0[(x_27 + (x_28 * 8))] = x_27; + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == int(x_23.z))) { + } + return; +} + +fragment tint_symbol_3 tint_symbol(float4 x_2_param [[position]], tint_symbol_2 tint_symbol_1 [[stage_in]], device S& x_5 [[buffer(0)]]) { + thread float4 tint_symbol_9 = 0.0f; + thread int tint_symbol_10 = 0; + thread int tint_symbol_11 = 0; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_9 = x_2_param; + tint_symbol_10 = x_3_param; + main_1(x_5, &(tint_symbol_11), &(tint_symbol_9), &(tint_symbol_10)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..ef97582764 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.spvasm @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %S "S" + OpMemberName %S 0 "field0" + OpName %x_5 "x_5" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %S Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_int ArrayStride 4 + OpDecorate %x_5 DescriptorSet 0 + OpDecorate %x_5 Binding 0 + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_1 Flat + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_2 = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %9 + %x_4 = OpVariable %_ptr_Private_int Private %9 +%_runtimearr_int = OpTypeRuntimeArray %int + %S = OpTypeStruct %_runtimearr_int +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %x_5 = OpVariable %_ptr_StorageBuffer_S StorageBuffer +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %21 = OpTypeFunction %void + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int_8 = OpConstant %int 8 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %bool = OpTypeBool + %main_out = OpTypeStruct %int + %49 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %21 + %24 = OpLabel + OpStore %x_4 %int_1 + %26 = OpLoad %v4float %x_2 + %28 = OpCompositeExtract %float %26 0 + %27 = OpConvertFToS %int %28 + %30 = OpCompositeExtract %float %26 1 + %29 = OpConvertFToS %int %30 + %31 = OpLoad %int %x_3 + %35 = OpIMul %int %29 %int_8 + %36 = OpIAdd %int %27 %35 + %38 = OpAccessChain %_ptr_StorageBuffer_int %x_5 %uint_0 %36 + OpStore %38 %27 + %39 = OpBitwiseAnd %int %27 %int_1 + %40 = OpBitwiseAnd %int %29 %int_1 + %41 = OpIAdd %int %39 %40 + %42 = OpIAdd %int %41 %31 + %44 = OpCompositeExtract %float %26 2 + %43 = OpConvertFToS %int %44 + %45 = OpIEqual %bool %42 %43 + OpSelectionMerge %47 None + OpBranchConditional %45 %48 %47 + %48 = OpLabel + OpBranch %47 + %47 = OpLabel + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %49 +%tint_symbol_2 = OpFunctionParameter %main_out + %53 = OpLabel + %54 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %54 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %21 + %56 = OpLabel + %57 = OpLoad %v4float %tint_symbol + OpStore %x_2 %57 + %58 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %58 + %59 = OpFunctionCall %void %main_1 + %61 = OpLoad %int %x_4 + %62 = OpCompositeConstruct %main_out %61 + %60 = OpFunctionCall %void %tint_symbol_4 %62 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..55cb745376 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.wgsl @@ -0,0 +1,39 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : RTArr; +}; + +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +[[group(0), binding(0)]] var x_5 : S; + +fn main_1() { + x_4 = 1; + let x_23 : vec4 = x_2; + let x_27 : i32 = i32(x_23.x); + let x_28 : i32 = i32(x_23.y); + let x_33 : i32 = x_3; + x_5.field0[(x_27 + (x_28 * 8))] = x_27; + if (((((x_27 & 1) + (x_28 & 1)) + x_33) == i32(x_23.z))) { + } + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm new file mode 100644 index 0000000000..4fd14af431 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm @@ -0,0 +1,57 @@ + OpCapability Shader + OpExtension "SPV_KHR_terminate_invocation" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %1 "main" %gl_FragCoord %3 %4 + OpExecutionMode %1 OriginUpperLeft + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %3 Location 0 + OpDecorate %3 Flat + OpDecorate %4 Location 0 + %void = OpTypeVoid + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_int = OpTypePointer Output %int +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %3 = OpVariable %_ptr_Input_int Input + %4 = OpVariable %_ptr_Output_int Output + %16 = OpTypeFunction %void + %1 = OpFunction %void None %16 + %17 = OpLabel + %18 = OpLoad %v4float %gl_FragCoord + %19 = OpCompositeExtract %float %18 0 + %20 = OpCompositeExtract %float %18 1 + %21 = OpCompositeExtract %float %18 2 + %22 = OpConvertFToS %int %19 + %23 = OpConvertFToS %int %20 + %24 = OpConvertFToS %int %21 + %25 = OpBitwiseAnd %int %22 %int_1 + %26 = OpBitwiseAnd %int %23 %int_1 + %27 = OpIAdd %int %25 %26 + %28 = OpLoad %int %3 + %29 = OpIAdd %int %27 %28 + %30 = OpIEqual %bool %29 %24 + OpSelectionMerge %31 None + OpBranchConditional %30 %32 %31 + %32 = OpLabel + %33 = OpPhi %int %int_0 %17 %34 %35 + %36 = OpULessThan %bool %33 %int_10 + OpLoopMerge %37 %35 None + OpBranchConditional %36 %38 %37 + %38 = OpLabel + OpTerminateInvocation + %35 = OpLabel + %34 = OpIAdd %int %33 %int_1 + OpBranch %32 + %37 = OpLabel + OpBranch %31 + %31 = OpLabel + OpStore %4 %int_1 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..e1ac82b81f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.hlsl @@ -0,0 +1,48 @@ +static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; + +void main_1() { + int x_33_phi = 0; + const float4 x_18 = x_2; + const int x_28 = x_3; + x_33_phi = 0; + if (((((int(x_18.x) & 1) + (int(x_18.y) & 1)) + x_28) == int(x_18.z))) { + while (true) { + int x_34 = 0; + const int x_33 = x_33_phi; + if ((asuint(x_33) < asuint(10))) { + } else { + break; + } + { + x_34 = (x_33 + 1); + x_33_phi = x_34; + } + } + } + x_4 = 1; + return; +} + +struct main_out { + int x_4_1; +}; +struct tint_symbol_1 { + int x_3_param : TEXCOORD0; + float4 x_2_param : SV_Position; +}; +struct tint_symbol_2 { + int x_4_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_4_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.msl new file mode 100644 index 0000000000..27b481f4a2 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct main_out { + int x_4_1; +}; +struct tint_symbol_2 { + int x_3_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread int* const tint_symbol_7, thread int* const tint_symbol_8) { + int x_33_phi = 0; + float4 const x_18 = *(tint_symbol_6); + int const x_28 = *(tint_symbol_7); + x_33_phi = 0; + if (((((int(x_18.x) & 1) + (int(x_18.y) & 1)) + x_28) == int(x_18.z))) { + while (true) { + int x_34 = 0; + int const x_33 = x_33_phi; + if ((as_type(x_33) < as_type(10))) { + } else { + break; + } + { + x_34 = (x_33 + 1); + x_33_phi = x_34; + } + } + } + *(tint_symbol_8) = 1; + return; +} + +fragment tint_symbol_3 tint_symbol(float4 x_2_param [[position]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_9 = 0.0f; + thread int tint_symbol_10 = 0; + thread int tint_symbol_11 = 0; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_9 = x_2_param; + tint_symbol_10 = x_3_param; + main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..cdf2918591 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.spvasm @@ -0,0 +1,123 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %x_33_phi "x_33_phi" + OpName %x_34 "x_34" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_1 Flat + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_2 = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %9 + %x_4 = OpVariable %_ptr_Private_int Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %int_10 = OpConstant %int 10 + %main_out = OpTypeStruct %int + %57 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %17 + %20 = OpLabel + %x_33_phi = OpVariable %_ptr_Function_int Function %9 + %x_34 = OpVariable %_ptr_Function_int Function %9 + %23 = OpLoad %v4float %x_2 + %24 = OpLoad %int %x_3 + OpStore %x_33_phi %int_0 + %27 = OpCompositeExtract %float %23 0 + %26 = OpConvertFToS %int %27 + %29 = OpBitwiseAnd %int %26 %int_1 + %31 = OpCompositeExtract %float %23 1 + %30 = OpConvertFToS %int %31 + %32 = OpBitwiseAnd %int %30 %int_1 + %33 = OpIAdd %int %29 %32 + %34 = OpIAdd %int %33 %24 + %36 = OpCompositeExtract %float %23 2 + %35 = OpConvertFToS %int %36 + %37 = OpIEqual %bool %34 %35 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %39 + %40 = OpLabel + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %46 = OpLoad %int %x_33_phi + %47 = OpBitcast %uint %46 + %49 = OpBitcast %uint %int_10 + %51 = OpULessThan %bool %47 %49 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %42 + %52 = OpLabel + OpBranch %43 + %43 = OpLabel + %55 = OpIAdd %int %46 %int_1 + OpStore %x_34 %55 + %56 = OpLoad %int %x_34 + OpStore %x_33_phi %56 + OpBranch %41 + %42 = OpLabel + OpBranch %39 + %39 = OpLabel + OpStore %x_4 %int_1 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %57 +%tint_symbol_2 = OpFunctionParameter %main_out + %61 = OpLabel + %62 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %62 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %17 + %64 = OpLabel + %65 = OpLoad %v4float %tint_symbol + OpStore %x_2 %65 + %66 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %66 + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %int %x_4 + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_4 %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..5142f3d897 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.wgsl @@ -0,0 +1,42 @@ +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +fn main_1() { + var x_33_phi : i32; + let x_18 : vec4 = x_2; + let x_28 : i32 = x_3; + x_33_phi = 0; + if (((((i32(x_18.x) & 1) + (i32(x_18.y) & 1)) + x_28) == i32(x_18.z))) { + loop { + var x_34 : i32; + let x_33 : i32 = x_33_phi; + if ((bitcast(x_33) < bitcast(10))) { + } else { + break; + } + + continuing { + x_34 = (x_33 + 1); + x_33_phi = x_34; + } + } + } + x_4 = 1; + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl new file mode 100644 index 0000000000..5142f3d897 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl @@ -0,0 +1,42 @@ +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +fn main_1() { + var x_33_phi : i32; + let x_18 : vec4 = x_2; + let x_28 : i32 = x_3; + x_33_phi = 0; + if (((((i32(x_18.x) & 1) + (i32(x_18.y) & 1)) + x_28) == i32(x_18.z))) { + loop { + var x_34 : i32; + let x_33 : i32 = x_33_phi; + if ((bitcast(x_33) < bitcast(10))) { + } else { + break; + } + + continuing { + x_34 = (x_33 + 1); + x_33_phi = x_34; + } + } + } + x_4 = 1; + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.hlsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..e1ac82b81f --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.hlsl @@ -0,0 +1,48 @@ +static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int x_3 = 0; +static int x_4 = 0; + +void main_1() { + int x_33_phi = 0; + const float4 x_18 = x_2; + const int x_28 = x_3; + x_33_phi = 0; + if (((((int(x_18.x) & 1) + (int(x_18.y) & 1)) + x_28) == int(x_18.z))) { + while (true) { + int x_34 = 0; + const int x_33 = x_33_phi; + if ((asuint(x_33) < asuint(10))) { + } else { + break; + } + { + x_34 = (x_33 + 1); + x_33_phi = x_34; + } + } + } + x_4 = 1; + return; +} + +struct main_out { + int x_4_1; +}; +struct tint_symbol_1 { + int x_3_param : TEXCOORD0; + float4 x_2_param : SV_Position; +}; +struct tint_symbol_2 { + int x_4_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 x_2_param = tint_symbol.x_2_param; + const int x_3_param = tint_symbol.x_3_param; + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + const main_out tint_symbol_3 = {x_4}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_4_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.msl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.msl new file mode 100644 index 0000000000..27b481f4a2 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.msl @@ -0,0 +1,49 @@ +#include + +using namespace metal; +struct main_out { + int x_4_1; +}; +struct tint_symbol_2 { + int x_3_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + int x_4_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread int* const tint_symbol_7, thread int* const tint_symbol_8) { + int x_33_phi = 0; + float4 const x_18 = *(tint_symbol_6); + int const x_28 = *(tint_symbol_7); + x_33_phi = 0; + if (((((int(x_18.x) & 1) + (int(x_18.y) & 1)) + x_28) == int(x_18.z))) { + while (true) { + int x_34 = 0; + int const x_33 = x_33_phi; + if ((as_type(x_33) < as_type(10))) { + } else { + break; + } + { + x_34 = (x_33 + 1); + x_33_phi = x_34; + } + } + } + *(tint_symbol_8) = 1; + return; +} + +fragment tint_symbol_3 tint_symbol(float4 x_2_param [[position]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_9 = 0.0f; + thread int tint_symbol_10 = 0; + thread int tint_symbol_11 = 0; + int const x_3_param = tint_symbol_1.x_3_param; + tint_symbol_9 = x_2_param; + tint_symbol_10 = x_3_param; + main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11)); + main_out const tint_symbol_4 = {.x_4_1=tint_symbol_11}; + tint_symbol_3 const tint_symbol_5 = {.x_4_1=tint_symbol_4.x_4_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.spvasm b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..cdf2918591 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.spvasm @@ -0,0 +1,123 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_3 + OpExecutionMode %main OriginUpperLeft + OpName %x_2 "x_2" + OpName %x_3 "x_3" + OpName %x_4 "x_4" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %main_1 "main_1" + OpName %x_33_phi "x_33_phi" + OpName %x_34 "x_34" + OpName %main_out "main_out" + OpMemberName %main_out 0 "x_4_1" + OpName %tint_symbol_4 "tint_symbol_4" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_1 Location 0 + OpDecorate %tint_symbol_1 Flat + OpDecorate %tint_symbol_3 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %x_2 = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %x_3 = OpVariable %_ptr_Private_int Private %9 + %x_4 = OpVariable %_ptr_Private_int Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_int = OpTypePointer Input %int +%tint_symbol_1 = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_3 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %int_10 = OpConstant %int 10 + %main_out = OpTypeStruct %int + %57 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %17 + %20 = OpLabel + %x_33_phi = OpVariable %_ptr_Function_int Function %9 + %x_34 = OpVariable %_ptr_Function_int Function %9 + %23 = OpLoad %v4float %x_2 + %24 = OpLoad %int %x_3 + OpStore %x_33_phi %int_0 + %27 = OpCompositeExtract %float %23 0 + %26 = OpConvertFToS %int %27 + %29 = OpBitwiseAnd %int %26 %int_1 + %31 = OpCompositeExtract %float %23 1 + %30 = OpConvertFToS %int %31 + %32 = OpBitwiseAnd %int %30 %int_1 + %33 = OpIAdd %int %29 %32 + %34 = OpIAdd %int %33 %24 + %36 = OpCompositeExtract %float %23 2 + %35 = OpConvertFToS %int %36 + %37 = OpIEqual %bool %34 %35 + OpSelectionMerge %39 None + OpBranchConditional %37 %40 %39 + %40 = OpLabel + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %46 = OpLoad %int %x_33_phi + %47 = OpBitcast %uint %46 + %49 = OpBitcast %uint %int_10 + %51 = OpULessThan %bool %47 %49 + OpSelectionMerge %52 None + OpBranchConditional %51 %53 %54 + %53 = OpLabel + OpBranch %52 + %54 = OpLabel + OpBranch %42 + %52 = OpLabel + OpBranch %43 + %43 = OpLabel + %55 = OpIAdd %int %46 %int_1 + OpStore %x_34 %55 + %56 = OpLoad %int %x_34 + OpStore %x_33_phi %56 + OpBranch %41 + %42 = OpLabel + OpBranch %39 + %39 = OpLabel + OpStore %x_4 %int_1 + OpReturn + OpFunctionEnd +%tint_symbol_4 = OpFunction %void None %57 +%tint_symbol_2 = OpFunctionParameter %main_out + %61 = OpLabel + %62 = OpCompositeExtract %int %tint_symbol_2 0 + OpStore %tint_symbol_3 %62 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %17 + %64 = OpLabel + %65 = OpLoad %v4float %tint_symbol + OpStore %x_2 %65 + %66 = OpLoad %int %tint_symbol_1 + OpStore %x_3 %66 + %67 = OpFunctionCall %void %main_1 + %69 = OpLoad %int %x_4 + %70 = OpCompositeConstruct %main_out %69 + %68 = OpFunctionCall %void %tint_symbol_4 %70 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.wgsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..5142f3d897 --- /dev/null +++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.wgsl @@ -0,0 +1,42 @@ +var x_2 : vec4; + +var x_3 : i32; + +var x_4 : i32; + +fn main_1() { + var x_33_phi : i32; + let x_18 : vec4 = x_2; + let x_28 : i32 = x_3; + x_33_phi = 0; + if (((((i32(x_18.x) & 1) + (i32(x_18.y) & 1)) + x_28) == i32(x_18.z))) { + loop { + var x_34 : i32; + let x_33 : i32 = x_33_phi; + if ((bitcast(x_33) < bitcast(10))) { + } else { + break; + } + + continuing { + x_34 = (x_33 + 1); + x_33_phi = x_34; + } + } + } + x_4 = 1; + return; +} + +struct main_out { + [[location(0)]] + x_4_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] x_2_param : vec4, [[location(0)]] x_3_param : i32) -> main_out { + x_2 = x_2_param; + x_3 = x_3_param; + main_1(); + return main_out(x_4); +} diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm new file mode 100644 index 0000000000..5efeeaddf9 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm @@ -0,0 +1,45 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %position + OpSource GLSL 430 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %_ "" + OpName %position "position" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %position Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %position = OpVariable %_ptr_Input_v3float Input + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %7 + %20 = OpLabel + %21 = OpLoad %v3float %position + %22 = OpCompositeExtract %float %21 0 + %23 = OpCompositeExtract %float %21 1 + %24 = OpCompositeExtract %float %21 2 + %25 = OpCompositeConstruct %v4float %22 %23 %24 %float_1 + %26 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %26 %25 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.hlsl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.hlsl new file mode 100644 index 0000000000..5d7eab8504 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.hlsl @@ -0,0 +1,27 @@ +static float3 position = float3(0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float3 x_21 = position; + gl_Position = float4(x_21.x, x_21.y, x_21.z, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float3 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float3 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.msl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.msl new file mode 100644 index 0000000000..87dbf224c6 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float3 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float3* const tint_symbol_6, thread float4* const tint_symbol_7) { + float3 const x_21 = *(tint_symbol_6); + *(tint_symbol_7) = float4(x_21.x, x_21.y, x_21.z, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float3 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float3 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.spvasm b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.spvasm new file mode 100644 index 0000000000..3a3cd5529b --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v3float = OpTypeVector %float 3 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %8 = OpConstantNull %v3float + %position = OpVariable %_ptr_Private_v3float Private %8 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_Position = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%tint_symbol = OpVariable %_ptr_Input_v3float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %27 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %17 + %20 = OpLabel + %21 = OpLoad %v3float %position + %22 = OpCompositeExtract %float %21 0 + %23 = OpCompositeExtract %float %21 1 + %24 = OpCompositeExtract %float %21 2 + %26 = OpCompositeConstruct %v4float %22 %23 %24 %float_1 + OpStore %gl_Position %26 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %27 +%tint_symbol_1 = OpFunctionParameter %main_out + %31 = OpLabel + %32 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %32 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %17 + %34 = OpLabel + OpStore %tint_pointsize %float_1 + %35 = OpLoad %v3float %tint_symbol + OpStore %position %35 + %36 = OpFunctionCall %void %main_1 + %38 = OpLoad %v4float %gl_Position + %39 = OpCompositeConstruct %main_out %38 + %37 = OpFunctionCall %void %tint_symbol_3 %39 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.wgsl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.wgsl new file mode 100644 index 0000000000..cfebf749e2 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var position : vec3; + +var gl_Position : vec4; + +fn main_1() { + let x_21 : vec3 = position; + gl_Position = vec4(x_21.x, x_21.y, x_21.z, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec3) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl new file mode 100644 index 0000000000..cfebf749e2 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl @@ -0,0 +1,21 @@ +var position : vec3; + +var gl_Position : vec4; + +fn main_1() { + let x_21 : vec3 = position; + gl_Position = vec4(x_21.x, x_21.y, x_21.z, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec3) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.hlsl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.hlsl new file mode 100644 index 0000000000..5d7eab8504 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.hlsl @@ -0,0 +1,27 @@ +static float3 position = float3(0.0f, 0.0f, 0.0f); +static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float3 x_21 = position; + gl_Position = float4(x_21.x, x_21.y, x_21.z, 1.0f); + return; +} + +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_1 { + float3 position_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 gl_Position : SV_Position; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float3 position_param = tint_symbol.position_param; + position = position_param; + main_1(); + const main_out tint_symbol_3 = {gl_Position}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.gl_Position}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.msl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.msl new file mode 100644 index 0000000000..87dbf224c6 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 gl_Position; +}; +struct tint_symbol_2 { + float3 position_param [[attribute(0)]]; +}; +struct tint_symbol_3 { + float4 gl_Position [[position]]; +}; + +void main_1(thread float3* const tint_symbol_6, thread float4* const tint_symbol_7) { + float3 const x_21 = *(tint_symbol_6); + *(tint_symbol_7) = float4(x_21.x, x_21.y, x_21.z, 1.0f); + return; +} + +vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float3 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float3 const position_param = tint_symbol_1.position_param; + tint_symbol_8 = position_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.gl_Position=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.gl_Position=tint_symbol_4.gl_Position}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.spvasm b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.spvasm new file mode 100644 index 0000000000..3a3cd5529b --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.spvasm @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 + OpName %tint_pointsize "tint_pointsize" + OpName %position "position" + OpName %gl_Position "gl_Position" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "gl_Position" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_pointsize BuiltIn PointSize + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 BuiltIn Position + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %4 = OpConstantNull %float +%tint_pointsize = OpVariable %_ptr_Output_float Output %4 + %v3float = OpTypeVector %float 3 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %8 = OpConstantNull %v3float + %position = OpVariable %_ptr_Private_v3float Private %8 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %12 = OpConstantNull %v4float +%gl_Position = OpVariable %_ptr_Private_v4float Private %12 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%tint_symbol = OpVariable %_ptr_Input_v3float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %float_1 = OpConstant %float 1 + %main_out = OpTypeStruct %v4float + %27 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %17 + %20 = OpLabel + %21 = OpLoad %v3float %position + %22 = OpCompositeExtract %float %21 0 + %23 = OpCompositeExtract %float %21 1 + %24 = OpCompositeExtract %float %21 2 + %26 = OpCompositeConstruct %v4float %22 %23 %24 %float_1 + OpStore %gl_Position %26 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %27 +%tint_symbol_1 = OpFunctionParameter %main_out + %31 = OpLabel + %32 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %32 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %17 + %34 = OpLabel + OpStore %tint_pointsize %float_1 + %35 = OpLoad %v3float %tint_symbol + OpStore %position %35 + %36 = OpFunctionCall %void %main_1 + %38 = OpLoad %v4float %gl_Position + %39 = OpCompositeConstruct %main_out %38 + %37 = OpFunctionCall %void %tint_symbol_3 %39 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.wgsl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.wgsl new file mode 100644 index 0000000000..cfebf749e2 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/0.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +var position : vec3; + +var gl_Position : vec4; + +fn main_1() { + let x_21 : vec3 = position; + gl_Position = vec4(x_21.x, x_21.y, x_21.z, 1.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[stage(vertex)]] +fn main([[location(0)]] position_param : vec3) -> main_out { + position = position_param; + main_1(); + return main_out(gl_Position); +} diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm new file mode 100644 index 0000000000..6d8de5f586 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm @@ -0,0 +1,55 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %expect + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpSourceExtension "GL_KHR_shader_subgroup_ballot" + OpSourceExtension "GL_KHR_shader_subgroup_basic" + OpSourceExtension "GL_KHR_shader_subgroup_vote" + OpName %main "main" + OpName %inbounds "inbounds" + OpName %gl_FragCoord "gl_FragCoord" + OpName %expect "expect" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %expect Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_128 = OpConstant %float 128 + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 +%_ptr_Output_int = OpTypePointer Output %int + %expect = OpVariable %_ptr_Output_int Output + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %main = OpFunction %void None %7 + %22 = OpLabel + %inbounds = OpVariable %_ptr_Function_bool Function + %23 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %24 = OpLoad %float %23 + %25 = OpFOrdLessThan %bool %24 %float_128 + %26 = OpLogicalNot %bool %25 + OpSelectionMerge %27 None + OpBranchConditional %26 %28 %27 + %28 = OpLabel + %29 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %30 = OpLoad %float %29 + %31 = OpFOrdLessThan %bool %30 %float_128 + OpBranch %27 + %27 = OpLabel + %32 = OpPhi %bool %25 %22 %31 %28 + OpStore %inbounds %32 + %33 = OpLoad %bool %inbounds + %34 = OpSelect %int %33 %int_1 %int_n1 + OpStore %expect %34 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.hlsl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..72a9fa898a --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.hlsl @@ -0,0 +1,38 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int expect = 0; + +void main_1() { + bool inbounds = false; + bool x_31 = false; + bool x_32_phi = false; + const float x_24 = gl_FragCoord.x; + const bool x_25 = (x_24 < 128.0f); + x_32_phi = x_25; + if (!(x_25)) { + const float x_30 = gl_FragCoord.y; + x_31 = (x_30 < 128.0f); + x_32_phi = x_31; + } + inbounds = x_32_phi; + expect = (inbounds ? 1 : -1); + return; +} + +struct main_out { + int expect_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + int expect_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {expect}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.expect_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.msl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.msl new file mode 100644 index 0000000000..f604d95314 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +struct main_out { + int expect_1; +}; +struct tint_symbol_2 { + int expect_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread int* const tint_symbol_6) { + bool inbounds = false; + bool x_31 = false; + bool x_32_phi = false; + float const x_24 = (*(tint_symbol_5)).x; + bool const x_25 = (x_24 < 128.0f); + x_32_phi = x_25; + if (!(x_25)) { + float const x_30 = (*(tint_symbol_5)).y; + x_31 = (x_30 < 128.0f); + x_32_phi = x_31; + } + bool const x_32 = x_32_phi; + inbounds = x_32; + bool const x_33 = inbounds; + *(tint_symbol_6) = select(-1, 1, x_33); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread int tint_symbol_8 = 0; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.expect_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.expect_1=tint_symbol_3.expect_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.spvasm b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..08bdcac1aa --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %expect "expect" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %inbounds "inbounds" + OpName %x_31 "x_31" + OpName %x_32_phi "x_32_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "expect_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %expect = OpVariable %_ptr_Private_int Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_2 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %21 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_128 = OpConstant %float 128 + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %main_out = OpTypeStruct %int + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %inbounds = OpVariable %_ptr_Function_bool Function %21 + %x_31 = OpVariable %_ptr_Function_bool Function %21 + %x_32_phi = OpVariable %_ptr_Function_bool Function %21 + %27 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %28 = OpLoad %float %27 + %30 = OpFOrdLessThan %bool %28 %float_128 + OpStore %x_32_phi %30 + %31 = OpLogicalNot %bool %30 + OpSelectionMerge %32 None + OpBranchConditional %31 %33 %32 + %33 = OpLabel + %35 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %36 = OpLoad %float %35 + %37 = OpFOrdLessThan %bool %36 %float_128 + OpStore %x_31 %37 + %38 = OpLoad %bool %x_31 + OpStore %x_32_phi %38 + OpBranch %32 + %32 = OpLabel + %39 = OpLoad %bool %x_32_phi + OpStore %inbounds %39 + %40 = OpLoad %bool %inbounds + %41 = OpSelect %int %40 %int_1 %int_n1 + OpStore %expect %41 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %44 +%tint_symbol_1 = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %int %tint_symbol_1 0 + OpStore %tint_symbol_2 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %51 = OpLabel + %52 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %52 + %53 = OpFunctionCall %void %main_1 + %55 = OpLoad %int %expect + %56 = OpCompositeConstruct %main_out %55 + %54 = OpFunctionCall %void %tint_symbol_3 %56 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.wgsl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..a3e9f61490 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.spvasm.expected.wgsl @@ -0,0 +1,34 @@ +var gl_FragCoord : vec4; + +var expect : i32; + +fn main_1() { + var inbounds : bool; + var x_31 : bool; + var x_32_phi : bool; + let x_24 : f32 = gl_FragCoord.x; + let x_25 : bool = (x_24 < 128.0); + x_32_phi = x_25; + if (!(x_25)) { + let x_30 : f32 = gl_FragCoord.y; + x_31 = (x_30 < 128.0); + x_32_phi = x_31; + } + let x_32 : bool = x_32_phi; + inbounds = x_32; + let x_33 : bool = inbounds; + expect = select(-1, 1, x_33); + return; +} + +struct main_out { + [[location(0)]] + expect_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(expect); +} diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl new file mode 100644 index 0000000000..a3e9f61490 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl @@ -0,0 +1,34 @@ +var gl_FragCoord : vec4; + +var expect : i32; + +fn main_1() { + var inbounds : bool; + var x_31 : bool; + var x_32_phi : bool; + let x_24 : f32 = gl_FragCoord.x; + let x_25 : bool = (x_24 < 128.0); + x_32_phi = x_25; + if (!(x_25)) { + let x_30 : f32 = gl_FragCoord.y; + x_31 = (x_30 < 128.0); + x_32_phi = x_31; + } + let x_32 : bool = x_32_phi; + inbounds = x_32; + let x_33 : bool = inbounds; + expect = select(-1, 1, x_33); + return; +} + +struct main_out { + [[location(0)]] + expect_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(expect); +} diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.hlsl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..72a9fa898a --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.hlsl @@ -0,0 +1,38 @@ +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); +static int expect = 0; + +void main_1() { + bool inbounds = false; + bool x_31 = false; + bool x_32_phi = false; + const float x_24 = gl_FragCoord.x; + const bool x_25 = (x_24 < 128.0f); + x_32_phi = x_25; + if (!(x_25)) { + const float x_30 = gl_FragCoord.y; + x_31 = (x_30 < 128.0f); + x_32_phi = x_31; + } + inbounds = x_32_phi; + expect = (inbounds ? 1 : -1); + return; +} + +struct main_out { + int expect_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + int expect_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {expect}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.expect_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.msl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.msl new file mode 100644 index 0000000000..f604d95314 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +struct main_out { + int expect_1; +}; +struct tint_symbol_2 { + int expect_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread int* const tint_symbol_6) { + bool inbounds = false; + bool x_31 = false; + bool x_32_phi = false; + float const x_24 = (*(tint_symbol_5)).x; + bool const x_25 = (x_24 < 128.0f); + x_32_phi = x_25; + if (!(x_25)) { + float const x_30 = (*(tint_symbol_5)).y; + x_31 = (x_30 < 128.0f); + x_32_phi = x_31; + } + bool const x_32 = x_32_phi; + inbounds = x_32; + bool const x_33 = inbounds; + *(tint_symbol_6) = select(-1, 1, x_33); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread int tint_symbol_8 = 0; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.expect_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.expect_1=tint_symbol_3.expect_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.spvasm b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..08bdcac1aa --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.spvasm @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 57 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %gl_FragCoord "gl_FragCoord" + OpName %expect "expect" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %inbounds "inbounds" + OpName %x_31 "x_31" + OpName %x_32_phi "x_32_phi" + OpName %main_out "main_out" + OpMemberName %main_out 0 "expect_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %9 = OpConstantNull %int + %expect = OpVariable %_ptr_Private_int Private %9 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_int = OpTypePointer Output %int +%tint_symbol_2 = OpVariable %_ptr_Output_int Output %9 + %void = OpTypeVoid + %14 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %21 = OpConstantNull %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %float_128 = OpConstant %float 128 + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %int_n1 = OpConstant %int -1 + %main_out = OpTypeStruct %int + %44 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %inbounds = OpVariable %_ptr_Function_bool Function %21 + %x_31 = OpVariable %_ptr_Function_bool Function %21 + %x_32_phi = OpVariable %_ptr_Function_bool Function %21 + %27 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %28 = OpLoad %float %27 + %30 = OpFOrdLessThan %bool %28 %float_128 + OpStore %x_32_phi %30 + %31 = OpLogicalNot %bool %30 + OpSelectionMerge %32 None + OpBranchConditional %31 %33 %32 + %33 = OpLabel + %35 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %36 = OpLoad %float %35 + %37 = OpFOrdLessThan %bool %36 %float_128 + OpStore %x_31 %37 + %38 = OpLoad %bool %x_31 + OpStore %x_32_phi %38 + OpBranch %32 + %32 = OpLabel + %39 = OpLoad %bool %x_32_phi + OpStore %inbounds %39 + %40 = OpLoad %bool %inbounds + %41 = OpSelect %int %40 %int_1 %int_n1 + OpStore %expect %41 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %44 +%tint_symbol_1 = OpFunctionParameter %main_out + %48 = OpLabel + %49 = OpCompositeExtract %int %tint_symbol_1 0 + OpStore %tint_symbol_2 %49 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %51 = OpLabel + %52 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %52 + %53 = OpFunctionCall %void %main_1 + %55 = OpLoad %int %expect + %56 = OpCompositeConstruct %main_out %55 + %54 = OpFunctionCall %void %tint_symbol_3 %56 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.wgsl b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..a3e9f61490 --- /dev/null +++ b/test/vk-gl-cts/subgroup_uniform_control_flow/discard/subgroup_reconverge_discard00/2-opt.wgsl.expected.wgsl @@ -0,0 +1,34 @@ +var gl_FragCoord : vec4; + +var expect : i32; + +fn main_1() { + var inbounds : bool; + var x_31 : bool; + var x_32_phi : bool; + let x_24 : f32 = gl_FragCoord.x; + let x_25 : bool = (x_24 < 128.0); + x_32_phi = x_25; + if (!(x_25)) { + let x_30 : f32 = gl_FragCoord.y; + x_31 = (x_30 < 128.0); + x_32_phi = x_31; + } + let x_32 : bool = x_32_phi; + inbounds = x_32; + let x_33 : bool = inbounds; + expect = select(-1, 1, x_33); + return; +} + +struct main_out { + [[location(0)]] + expect_1 : i32; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(expect); +} diff --git a/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm new file mode 100644 index 0000000000..a9ff549dfd --- /dev/null +++ b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm @@ -0,0 +1,25 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %color_out %color_in + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpName %main "main" + OpName %color_out "color_out" + OpName %color_in "color_in" + OpDecorate %color_out Location 0 + OpDecorate %color_in Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %color_out = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %color_in = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %6 + %11 = OpLabel + %12 = OpLoad %v4float %color_in + OpStore %color_out %12 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.hlsl b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.hlsl new file mode 100644 index 0000000000..c1e727e999 --- /dev/null +++ b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.hlsl @@ -0,0 +1,26 @@ +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 color_in = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + color_out = color_in; + return; +} + +struct main_out { + float4 color_out_1; +}; +struct tint_symbol_1 { + float4 color_in_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 color_out_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 color_in_param = tint_symbol.color_in_param; + color_in = color_in_param; + main_1(); + const main_out tint_symbol_3 = {color_out}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.color_out_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.msl b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.msl new file mode 100644 index 0000000000..dad0955905 --- /dev/null +++ b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; +}; +struct tint_symbol_2 { + float4 color_in_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + float4 color_out_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_12 = *(tint_symbol_6); + *(tint_symbol_7) = x_12; + return; +} + +fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const color_in_param = tint_symbol_1.color_in_param; + tint_symbol_8 = color_in_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.color_out_1=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.color_out_1=tint_symbol_4.color_out_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.spvasm b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.spvasm new file mode 100644 index 0000000000..2050b3e61a --- /dev/null +++ b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.spvasm @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %color_out "color_out" + OpName %color_in "color_in" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color_out = OpVariable %_ptr_Private_v4float Private %5 + %color_in = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %16 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %15 = OpLoad %v4float %color_in + OpStore %color_out %15 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %16 +%tint_symbol_1 = OpFunctionParameter %main_out + %20 = OpLabel + %21 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %21 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %23 = OpLabel + %24 = OpLoad %v4float %tint_symbol + OpStore %color_in %24 + %25 = OpFunctionCall %void %main_1 + %27 = OpLoad %v4float %color_out + %28 = OpCompositeConstruct %main_out %27 + %26 = OpFunctionCall %void %tint_symbol_3 %28 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.wgsl b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.wgsl new file mode 100644 index 0000000000..cd7d76c70a --- /dev/null +++ b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var color_out : vec4; + +var color_in : vec4; + +fn main_1() { + let x_12 : vec4 = color_in; + color_out = x_12; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[location(0)]] color_in_param : vec4) -> main_out { + color_in = color_in_param; + main_1(); + return main_out(color_out); +} diff --git a/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl new file mode 100644 index 0000000000..cd7d76c70a --- /dev/null +++ b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl @@ -0,0 +1,21 @@ +var color_out : vec4; + +var color_in : vec4; + +fn main_1() { + let x_12 : vec4 = color_in; + color_out = x_12; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[location(0)]] color_in_param : vec4) -> main_out { + color_in = color_in_param; + main_1(); + return main_out(color_out); +} diff --git a/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.hlsl b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.hlsl new file mode 100644 index 0000000000..c1e727e999 --- /dev/null +++ b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 color_in = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + color_out = color_in; + return; +} + +struct main_out { + float4 color_out_1; +}; +struct tint_symbol_1 { + float4 color_in_param : TEXCOORD0; +}; +struct tint_symbol_2 { + float4 color_out_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 color_in_param = tint_symbol.color_in_param; + color_in = color_in_param; + main_1(); + const main_out tint_symbol_3 = {color_out}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.color_out_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.msl b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.msl new file mode 100644 index 0000000000..dad0955905 --- /dev/null +++ b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +struct main_out { + float4 color_out_1; +}; +struct tint_symbol_2 { + float4 color_in_param [[user(locn0)]]; +}; +struct tint_symbol_3 { + float4 color_out_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) { + float4 const x_12 = *(tint_symbol_6); + *(tint_symbol_7) = x_12; + return; +} + +fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_8 = 0.0f; + thread float4 tint_symbol_9 = 0.0f; + float4 const color_in_param = tint_symbol_1.color_in_param; + tint_symbol_8 = color_in_param; + main_1(&(tint_symbol_8), &(tint_symbol_9)); + main_out const tint_symbol_4 = {.color_out_1=tint_symbol_9}; + tint_symbol_3 const tint_symbol_5 = {.color_out_1=tint_symbol_4.color_out_1}; + return tint_symbol_5; +} + diff --git a/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.spvasm b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.spvasm new file mode 100644 index 0000000000..2050b3e61a --- /dev/null +++ b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.spvasm @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %color_out "color_out" + OpName %color_in "color_in" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "color_out_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol Location 0 + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %color_out = OpVariable %_ptr_Private_v4float Private %5 + %color_in = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %main_out = OpTypeStruct %v4float + %16 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %15 = OpLoad %v4float %color_in + OpStore %color_out %15 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %16 +%tint_symbol_1 = OpFunctionParameter %main_out + %20 = OpLabel + %21 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %21 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %23 = OpLabel + %24 = OpLoad %v4float %tint_symbol + OpStore %color_in %24 + %25 = OpFunctionCall %void %main_1 + %27 = OpLoad %v4float %color_out + %28 = OpCompositeConstruct %main_out %27 + %26 = OpFunctionCall %void %tint_symbol_3 %28 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.wgsl b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.wgsl new file mode 100644 index 0000000000..cd7d76c70a --- /dev/null +++ b/test/vk-gl-cts/texture/subgroup_lod/texel_fetch/1.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +var color_out : vec4; + +var color_in : vec4; + +fn main_1() { + let x_12 : vec4 = color_in; + color_out = x_12; + return; +} + +struct main_out { + [[location(0)]] + color_out_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[location(0)]] color_in_param : vec4) -> main_out { + color_in = color_in_param; + main_1(); + return main_out(color_out); +} diff --git a/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm new file mode 100644 index 0000000000..baa40eed9d --- /dev/null +++ b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm @@ -0,0 +1,39 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %result %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpName %main "main" + OpName %result "result" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %result Location 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %result = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_255 = OpConstant %float 255 + %uint_1 = OpConstant %uint 1 + %float_0 = OpConstant %float 0 + %main = OpFunction %void None %6 + %17 = OpLabel + %18 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %19 = OpLoad %float %18 + %20 = OpExtInst %float %1 Floor %19 + %21 = OpFDiv %float %20 %float_255 + %22 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %23 = OpLoad %float %22 + %24 = OpExtInst %float %1 Floor %23 + %25 = OpFDiv %float %24 %float_255 + %26 = OpCompositeConstruct %v4float %21 %25 %float_0 %float_0 + OpStore %result %26 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.hlsl new file mode 100644 index 0000000000..6b9138bba3 --- /dev/null +++ b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.hlsl @@ -0,0 +1,28 @@ +static float4 result = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_19 = gl_FragCoord.x; + const float x_23 = gl_FragCoord.y; + result = float4((floor(x_19) / 255.0f), (floor(x_23) / 255.0f), 0.0f, 0.0f); + return; +} + +struct main_out { + float4 result_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 result_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {result}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.result_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.msl b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.msl new file mode 100644 index 0000000000..6f93315a3e --- /dev/null +++ b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 result_1; +}; +struct tint_symbol_2 { + float4 result_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_19 = (*(tint_symbol_5)).x; + float const x_23 = (*(tint_symbol_5)).y; + *(tint_symbol_6) = float4((floor(x_19) / 255.0f), (floor(x_23) / 255.0f), 0.0f, 0.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.result_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.result_1=tint_symbol_3.result_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.spvasm b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.spvasm new file mode 100644 index 0000000000..9f527439bd --- /dev/null +++ b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + %24 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %result "result" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "result_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %result = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 + %float_255 = OpConstant %float 255 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %31 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %19 = OpLoad %float %18 + %21 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %22 = OpLoad %float %21 + %23 = OpExtInst %float %24 Floor %19 + %26 = OpFDiv %float %23 %float_255 + %27 = OpExtInst %float %24 Floor %22 + %28 = OpFDiv %float %27 %float_255 + %30 = OpCompositeConstruct %v4float %26 %28 %float_0 %float_0 + OpStore %result %30 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %31 +%tint_symbol_1 = OpFunctionParameter %main_out + %35 = OpLabel + %36 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %36 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %38 = OpLabel + %39 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %39 + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %result + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_3 %43 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.wgsl b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.wgsl new file mode 100644 index 0000000000..2130c1a52a --- /dev/null +++ b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var result : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + let x_19 : f32 = gl_FragCoord.x; + let x_23 : f32 = gl_FragCoord.y; + result = vec4((floor(x_19) / 255.0), (floor(x_23) / 255.0), 0.0, 0.0); + return; +} + +struct main_out { + [[location(0)]] + result_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(result); +} diff --git a/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl new file mode 100644 index 0000000000..2130c1a52a --- /dev/null +++ b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl @@ -0,0 +1,22 @@ +var result : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + let x_19 : f32 = gl_FragCoord.x; + let x_23 : f32 = gl_FragCoord.y; + result = vec4((floor(x_19) / 255.0), (floor(x_23) / 255.0), 0.0, 0.0); + return; +} + +struct main_out { + [[location(0)]] + result_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(result); +} diff --git a/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.hlsl new file mode 100644 index 0000000000..6b9138bba3 --- /dev/null +++ b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.hlsl @@ -0,0 +1,28 @@ +static float4 result = float4(0.0f, 0.0f, 0.0f, 0.0f); +static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); + +void main_1() { + const float x_19 = gl_FragCoord.x; + const float x_23 = gl_FragCoord.y; + result = float4((floor(x_19) / 255.0f), (floor(x_23) / 255.0f), 0.0f, 0.0f); + return; +} + +struct main_out { + float4 result_1; +}; +struct tint_symbol_1 { + float4 gl_FragCoord_param : SV_Position; +}; +struct tint_symbol_2 { + float4 result_1 : SV_Target0; +}; + +tint_symbol_2 main(tint_symbol_1 tint_symbol) { + const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param; + gl_FragCoord = gl_FragCoord_param; + main_1(); + const main_out tint_symbol_3 = {result}; + const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.result_1}; + return tint_symbol_4; +} diff --git a/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.msl b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.msl new file mode 100644 index 0000000000..6f93315a3e --- /dev/null +++ b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +struct main_out { + float4 result_1; +}; +struct tint_symbol_2 { + float4 result_1 [[color(0)]]; +}; + +void main_1(thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) { + float const x_19 = (*(tint_symbol_5)).x; + float const x_23 = (*(tint_symbol_5)).y; + *(tint_symbol_6) = float4((floor(x_19) / 255.0f), (floor(x_23) / 255.0f), 0.0f, 0.0f); + return; +} + +fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) { + thread float4 tint_symbol_7 = 0.0f; + thread float4 tint_symbol_8 = 0.0f; + tint_symbol_7 = gl_FragCoord_param; + main_1(&(tint_symbol_7), &(tint_symbol_8)); + main_out const tint_symbol_3 = {.result_1=tint_symbol_8}; + tint_symbol_2 const tint_symbol_4 = {.result_1=tint_symbol_3.result_1}; + return tint_symbol_4; +} + diff --git a/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.spvasm b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.spvasm new file mode 100644 index 0000000000..9f527439bd --- /dev/null +++ b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + %24 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2 + OpExecutionMode %main OriginUpperLeft + OpName %result "result" + OpName %gl_FragCoord "gl_FragCoord" + OpName %tint_symbol "tint_symbol" + OpName %tint_symbol_2 "tint_symbol_2" + OpName %main_1 "main_1" + OpName %main_out "main_out" + OpMemberName %main_out 0 "result_1" + OpName %tint_symbol_3 "tint_symbol_3" + OpName %tint_symbol_1 "tint_symbol_1" + OpName %main "main" + OpDecorate %tint_symbol BuiltIn FragCoord + OpDecorate %tint_symbol_2 Location 0 + OpMemberDecorate %main_out 0 Offset 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %5 = OpConstantNull %v4float + %result = OpVariable %_ptr_Private_v4float Private %5 +%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%tint_symbol = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Private_float = OpTypePointer Private %float + %uint_1 = OpConstant %uint 1 + %float_255 = OpConstant %float 255 + %float_0 = OpConstant %float 0 + %main_out = OpTypeStruct %v4float + %31 = OpTypeFunction %void %main_out + %main_1 = OpFunction %void None %11 + %14 = OpLabel + %18 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0 + %19 = OpLoad %float %18 + %21 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1 + %22 = OpLoad %float %21 + %23 = OpExtInst %float %24 Floor %19 + %26 = OpFDiv %float %23 %float_255 + %27 = OpExtInst %float %24 Floor %22 + %28 = OpFDiv %float %27 %float_255 + %30 = OpCompositeConstruct %v4float %26 %28 %float_0 %float_0 + OpStore %result %30 + OpReturn + OpFunctionEnd +%tint_symbol_3 = OpFunction %void None %31 +%tint_symbol_1 = OpFunctionParameter %main_out + %35 = OpLabel + %36 = OpCompositeExtract %v4float %tint_symbol_1 0 + OpStore %tint_symbol_2 %36 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %11 + %38 = OpLabel + %39 = OpLoad %v4float %tint_symbol + OpStore %gl_FragCoord %39 + %40 = OpFunctionCall %void %main_1 + %42 = OpLoad %v4float %result + %43 = OpCompositeConstruct %main_out %42 + %41 = OpFunctionCall %void %tint_symbol_3 %43 + OpReturn + OpFunctionEnd diff --git a/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.wgsl b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.wgsl new file mode 100644 index 0000000000..2130c1a52a --- /dev/null +++ b/test/vk-gl-cts/texture/texel_offset/texel_offset/0-opt.wgsl.expected.wgsl @@ -0,0 +1,22 @@ +var result : vec4; + +var gl_FragCoord : vec4; + +fn main_1() { + let x_19 : f32 = gl_FragCoord.x; + let x_23 : f32 = gl_FragCoord.y; + result = vec4((floor(x_19) / 255.0), (floor(x_23) / 255.0), 0.0, 0.0); + return; +} + +struct main_out { + [[location(0)]] + result_1 : vec4; +}; + +[[stage(fragment)]] +fn main([[builtin(position)]] gl_FragCoord_param : vec4) -> main_out { + gl_FragCoord = gl_FragCoord_param; + main_1(); + return main_out(result); +}